summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Marchi <simon.marchi@polymtl.ca>2023-02-08 15:36:23 -0500
committerSimon Marchi <simon.marchi@polymtl.ca>2023-02-08 15:46:02 -0500
commitc583a2520616c2736cffc389c89a48b159366e6c (patch)
treeb4925f26506fcee96c16119431c01760f05db95d
parentca7f92c2f15b86b09c4a8ad14806bef666308d31 (diff)
downloadbinutils-gdb-users/simark/clang-format.tar.gz
Run clang-format.shusers/simark/clang-format
Change-Id: Ia948cc26d534b0dd02702244d52434b1a2093968
-rw-r--r--gdb/aarch32-linux-nat.c8
-rw-r--r--gdb/aarch64-fbsd-nat.c48
-rw-r--r--gdb/aarch64-fbsd-tdep.c135
-rw-r--r--gdb/aarch64-fbsd-tdep.h4
-rw-r--r--gdb/aarch64-linux-nat.c114
-rw-r--r--gdb/aarch64-linux-tdep.c475
-rw-r--r--gdb/aarch64-linux-tdep.h2
-rw-r--r--gdb/aarch64-nat.c45
-rw-r--r--gdb/aarch64-nat.h36
-rw-r--r--gdb/aarch64-newlib-tdep.c1
-rw-r--r--gdb/aarch64-ravenscar-thread.c98
-rw-r--r--gdb/aarch64-tdep.c789
-rw-r--r--gdb/aarch64-tdep.h59
-rw-r--r--gdb/ada-casefold.h1765
-rw-r--r--gdb/ada-exp.h300
-rw-r--r--gdb/ada-lang.c2812
-rw-r--r--gdb/ada-lang.h127
-rw-r--r--gdb/ada-tasks.c458
-rw-r--r--gdb/ada-typeprint.c143
-rw-r--r--gdb/ada-valprint.c140
-rw-r--r--gdb/ada-varobj.c257
-rw-r--r--gdb/addrmap.c126
-rw-r--r--gdb/addrmap.h25
-rw-r--r--gdb/agent.c30
-rw-r--r--gdb/aix-thread.c512
-rw-r--r--gdb/alloc.c8
-rw-r--r--gdb/alpha-bsd-nat.c39
-rw-r--r--gdb/alpha-bsd-tdep.c4
-rw-r--r--gdb/alpha-bsd-tdep.h8
-rw-r--r--gdb/alpha-linux-nat.c26
-rw-r--r--gdb/alpha-linux-tdep.c99
-rw-r--r--gdb/alpha-mdebug-tdep.c45
-rw-r--r--gdb/alpha-netbsd-tdep.c82
-rw-r--r--gdb/alpha-obsd-tdep.c17
-rw-r--r--gdb/alpha-tdep.c355
-rw-r--r--gdb/alpha-tdep.h60
-rw-r--r--gdb/amd-dbgapi-target.c505
-rw-r--r--gdb/amd-dbgapi-target.h10
-rw-r--r--gdb/amd64-bsd-nat.c13
-rw-r--r--gdb/amd64-bsd-nat.h9
-rw-r--r--gdb/amd64-darwin-tdep.c54
-rw-r--r--gdb/amd64-dicos-tdep.c4
-rw-r--r--gdb/amd64-fbsd-nat.c83
-rw-r--r--gdb/amd64-fbsd-tdep.c245
-rw-r--r--gdb/amd64-linux-nat.c154
-rw-r--r--gdb/amd64-linux-tdep.c1941
-rw-r--r--gdb/amd64-linux-tdep.h6
-rw-r--r--gdb/amd64-nat.c9
-rw-r--r--gdb/amd64-netbsd-nat.c36
-rw-r--r--gdb/amd64-netbsd-tdep.c56
-rw-r--r--gdb/amd64-obsd-nat.c37
-rw-r--r--gdb/amd64-obsd-tdep.c204
-rw-r--r--gdb/amd64-ravenscar-thread.c3
-rw-r--r--gdb/amd64-sol2-tdep.c52
-rw-r--r--gdb/amd64-tdep.c825
-rw-r--r--gdb/amd64-tdep.h83
-rw-r--r--gdb/amd64-windows-nat.c97
-rw-r--r--gdb/amd64-windows-tdep.c312
-rw-r--r--gdb/amdgpu-tdep.c434
-rw-r--r--gdb/amdgpu-tdep.h8
-rw-r--r--gdb/annotate.c17
-rw-r--r--gdb/annotate.h1
-rw-r--r--gdb/arc-linux-nat.c35
-rw-r--r--gdb/arc-linux-tdep.c141
-rw-r--r--gdb/arc-linux-tdep.h8
-rw-r--r--gdb/arc-newlib-tdep.c1
-rw-r--r--gdb/arc-tdep.c549
-rw-r--r--gdb/arc-tdep.h120
-rw-r--r--gdb/arch-utils.c316
-rw-r--r--gdb/arch-utils.h82
-rw-r--r--gdb/arch/aarch64-insn.c36
-rw-r--r--gdb/arch/aarch64-insn.h146
-rw-r--r--gdb/arch/aarch64-mte-linux.h6
-rw-r--r--gdb/arch/aarch64.h94
-rw-r--r--gdb/arch/arc.c26
-rw-r--r--gdb/arch/arc.h19
-rw-r--r--gdb/arch/arm-get-next-pcs.c162
-rw-r--r--gdb/arch/arm-get-next-pcs.h6
-rw-r--r--gdb/arch/arm-linux.c11
-rw-r--r--gdb/arch/arm-linux.h9
-rw-r--r--gdb/arch/arm.c48
-rw-r--r--gdb/arch/arm.h172
-rw-r--r--gdb/arch/loongarch.c12
-rw-r--r--gdb/arch/loongarch.h32
-rw-r--r--gdb/arch/ppc-linux-common.c38
-rw-r--r--gdb/arch/ppc-linux-common.h28
-rw-r--r--gdb/arch/riscv.c8
-rw-r--r--gdb/arch/riscv.h25
-rw-r--r--gdb/arch/xtensa.h8
-rw-r--r--gdb/arm-bsd-tdep.c25
-rw-r--r--gdb/arm-fbsd-nat.c1
-rw-r--r--gdb/arm-fbsd-tdep.c133
-rw-r--r--gdb/arm-fbsd-tdep.h23
-rw-r--r--gdb/arm-linux-nat.c185
-rw-r--r--gdb/arm-linux-tdep.c1437
-rw-r--r--gdb/arm-linux-tdep.h32
-rw-r--r--gdb/arm-netbsd-nat.c55
-rw-r--r--gdb/arm-netbsd-tdep.c43
-rw-r--r--gdb/arm-netbsd-tdep.h6
-rw-r--r--gdb/arm-none-tdep.c56
-rw-r--r--gdb/arm-obsd-tdep.c42
-rw-r--r--gdb/arm-pikeos-tdep.c8
-rw-r--r--gdb/arm-tdep.c2867
-rw-r--r--gdb/arm-tdep.h162
-rw-r--r--gdb/arm-wince-tdep.c11
-rw-r--r--gdb/async-event.c22
-rw-r--r--gdb/async-event.h14
-rw-r--r--gdb/auto-load.c365
-rw-r--r--gdb/auto-load.h12
-rw-r--r--gdb/auxv.c206
-rw-r--r--gdb/auxv.h17
-rw-r--r--gdb/avr-tdep.c277
-rw-r--r--gdb/ax-gdb.c492
-rw-r--r--gdb/ax-gdb.h57
-rw-r--r--gdb/ax-general.c111
-rw-r--r--gdb/ax.h124
-rw-r--r--gdb/bcache.c83
-rw-r--r--gdb/bcache.h18
-rw-r--r--gdb/bfd-target.c35
-rw-r--r--gdb/bfin-linux-tdep.c130
-rw-r--r--gdb/bfin-tdep.c274
-rw-r--r--gdb/bfin-tdep.h8
-rw-r--r--gdb/block.c51
-rw-r--r--gdb/block.h119
-rw-r--r--gdb/blockframe.c22
-rw-r--r--gdb/bpf-tdep.c84
-rw-r--r--gdb/break-catch-exec.c19
-rw-r--r--gdb/break-catch-fork.c52
-rw-r--r--gdb/break-catch-load.c53
-rw-r--r--gdb/break-catch-sig.c36
-rw-r--r--gdb/break-catch-syscall.c57
-rw-r--r--gdb/break-catch-throw.c110
-rw-r--r--gdb/breakpoint.c2857
-rw-r--r--gdb/breakpoint.h491
-rw-r--r--gdb/bsd-kvm.c64
-rw-r--r--gdb/bsd-kvm.h4
-rw-r--r--gdb/bsd-uthread.c102
-rw-r--r--gdb/bsd-uthread.h13
-rw-r--r--gdb/bt-utils.c24
-rw-r--r--gdb/bt-utils.h25
-rw-r--r--gdb/btrace.c534
-rw-r--r--gdb/btrace.h31
-rw-r--r--gdb/build-id.c30
-rw-r--r--gdb/build-id.h9
-rw-r--r--gdb/buildsym-legacy.c6
-rw-r--r--gdb/buildsym-legacy.h3
-rw-r--r--gdb/buildsym.c217
-rw-r--r--gdb/buildsym.h142
-rw-r--r--gdb/c-exp.h129
-rw-r--r--gdb/c-lang.c280
-rw-r--r--gdb/c-lang.h57
-rw-r--r--gdb/c-typeprint.c378
-rw-r--r--gdb/c-valprint.c91
-rw-r--r--gdb/c-varobj.c150
-rw-r--r--gdb/charset-list.h1380
-rw-r--r--gdb/charset.c217
-rw-r--r--gdb/charset.h42
-rw-r--r--gdb/cli-out.c39
-rw-r--r--gdb/cli-out.h29
-rw-r--r--gdb/cli/cli-cmds.c694
-rw-r--r--gdb/cli/cli-cmds.h8
-rw-r--r--gdb/cli/cli-decode.c750
-rw-r--r--gdb/cli/cli-decode.h30
-rw-r--r--gdb/cli/cli-dump.c209
-rw-r--r--gdb/cli/cli-interp.c144
-rw-r--r--gdb/cli/cli-interp.h2
-rw-r--r--gdb/cli/cli-logging.c130
-rw-r--r--gdb/cli/cli-option.c169
-rw-r--r--gdb/cli/cli-option.h148
-rw-r--r--gdb/cli/cli-script.c235
-rw-r--r--gdb/cli/cli-script.h60
-rw-r--r--gdb/cli/cli-setshow.c96
-rw-r--r--gdb/cli/cli-setshow.h6
-rw-r--r--gdb/cli/cli-style.c202
-rw-r--r--gdb/cli/cli-utils.c66
-rw-r--r--gdb/cli/cli-utils.h21
-rw-r--r--gdb/coff-pe-read.c176
-rw-r--r--gdb/coff-pe-read.h2
-rw-r--r--gdb/coffread.c445
-rw-r--r--gdb/command.h674
-rw-r--r--gdb/compile/compile-c-support.c240
-rw-r--r--gdb/compile/compile-c-symbols.c137
-rw-r--r--gdb/compile/compile-c-types.c107
-rw-r--r--gdb/compile/compile-c.h14
-rw-r--r--gdb/compile/compile-cplus-symbols.c98
-rw-r--r--gdb/compile/compile-cplus-types.c467
-rw-r--r--gdb/compile/compile-cplus.h18
-rw-r--r--gdb/compile/compile-internal.h14
-rw-r--r--gdb/compile/compile-loc2c.c219
-rw-r--r--gdb/compile/compile-object-load.c288
-rw-r--r--gdb/compile/compile-object-load.h6
-rw-r--r--gdb/compile/compile-object-run.c22
-rw-r--r--gdb/compile/compile.c182
-rw-r--r--gdb/compile/compile.h59
-rw-r--r--gdb/compile/gcc-c-plugin.h5
-rw-r--r--gdb/complaints.c68
-rw-r--r--gdb/complaints.h23
-rw-r--r--gdb/completer.c478
-rw-r--r--gdb/completer.h136
-rw-r--r--gdb/config/nm-linux.h2
-rw-r--r--gdb/copying.c1289
-rw-r--r--gdb/corefile.c107
-rw-r--r--gdb/corelow.c409
-rw-r--r--gdb/cp-abi.c86
-rw-r--r--gdb/cp-abi.h63
-rw-r--r--gdb/cp-namespace.c266
-rw-r--r--gdb/cp-support.c429
-rw-r--r--gdb/cp-support.h76
-rw-r--r--gdb/cp-valprint.c162
-rw-r--r--gdb/cris-linux-tdep.c2
-rw-r--r--gdb/cris-tdep.c747
-rw-r--r--gdb/csky-linux-tdep.c172
-rw-r--r--gdb/csky-tdep.c1454
-rw-r--r--gdb/csky-tdep.h36
-rw-r--r--gdb/ctfread.c565
-rw-r--r--gdb/d-lang.c115
-rw-r--r--gdb/d-lang.h13
-rw-r--r--gdb/d-namespace.c103
-rw-r--r--gdb/d-valprint.c32
-rw-r--r--gdb/darwin-nat-info.c320
-rw-r--r--gdb/darwin-nat.c611
-rw-r--r--gdb/darwin-nat.h22
-rw-r--r--gdb/dbxread.c1177
-rw-r--r--gdb/dcache.c133
-rw-r--r--gdb/dcache.h16
-rw-r--r--gdb/debuginfod-support.c170
-rw-r--r--gdb/debuginfod-support.h15
-rw-r--r--gdb/defs.h247
-rw-r--r--gdb/dicos-tdep.c13
-rw-r--r--gdb/dictionary.c238
-rw-r--r--gdb/dictionary.h29
-rw-r--r--gdb/disasm-flags.h22
-rw-r--r--gdb/disasm-selftests.c31
-rw-r--r--gdb/disasm.c320
-rw-r--r--gdb/disasm.h78
-rw-r--r--gdb/displaced-stepping.c67
-rw-r--r--gdb/displaced-stepping.h33
-rw-r--r--gdb/dtrace-probe.c215
-rw-r--r--gdb/dummy-frame.c44
-rw-r--r--gdb/dummy-frame.h8
-rw-r--r--gdb/dwarf2/abbrev-cache.c10
-rw-r--r--gdb/dwarf2/abbrev-cache.h1
-rw-r--r--gdb/dwarf2/abbrev.c15
-rw-r--r--gdb/dwarf2/abbrev.h7
-rw-r--r--gdb/dwarf2/attribute.c80
-rw-r--r--gdb/dwarf2/attribute.h40
-rw-r--r--gdb/dwarf2/call-site.h52
-rw-r--r--gdb/dwarf2/comp-unit-head.c63
-rw-r--r--gdb/dwarf2/comp-unit-head.h43
-rw-r--r--gdb/dwarf2/cooked-index.c240
-rw-r--r--gdb/dwarf2/cooked-index.h48
-rw-r--r--gdb/dwarf2/cu.c11
-rw-r--r--gdb/dwarf2/cu.h12
-rw-r--r--gdb/dwarf2/die.h16
-rw-r--r--gdb/dwarf2/dwz.c29
-rw-r--r--gdb/dwarf2/dwz.h34
-rw-r--r--gdb/dwarf2/expr.c418
-rw-r--r--gdb/dwarf2/expr.h26
-rw-r--r--gdb/dwarf2/file-and-dir.h10
-rw-r--r--gdb/dwarf2/frame-tailcall.c52
-rw-r--r--gdb/dwarf2/frame-tailcall.h10
-rw-r--r--gdb/dwarf2/frame.c360
-rw-r--r--gdb/dwarf2/frame.h75
-rw-r--r--gdb/dwarf2/index-cache.c100
-rw-r--r--gdb/dwarf2/index-cache.h12
-rw-r--r--gdb/dwarf2/index-write.c364
-rw-r--r--gdb/dwarf2/index-write.h7
-rw-r--r--gdb/dwarf2/leb.c4
-rw-r--r--gdb/dwarf2/line-header.c74
-rw-r--r--gdb/dwarf2/line-header.h36
-rw-r--r--gdb/dwarf2/loc.c879
-rw-r--r--gdb/dwarf2/loc.h58
-rw-r--r--gdb/dwarf2/macro.c217
-rw-r--r--gdb/dwarf2/macro.h3
-rw-r--r--gdb/dwarf2/mapped-index.h18
-rw-r--r--gdb/dwarf2/read.c5526
-rw-r--r--gdb/dwarf2/read.h90
-rw-r--r--gdb/dwarf2/sect-names.h6
-rw-r--r--gdb/dwarf2/section.c25
-rw-r--r--gdb/dwarf2/section.h1
-rw-r--r--gdb/elf-none-tdep.c8
-rw-r--r--gdb/elfread.c381
-rw-r--r--gdb/eval.c633
-rw-r--r--gdb/event-top.c162
-rw-r--r--gdb/event-top.h6
-rw-r--r--gdb/exceptions.c4
-rw-r--r--gdb/exceptions.h4
-rw-r--r--gdb/exec.c289
-rw-r--r--gdb/exec.h23
-rw-r--r--gdb/expop.h982
-rw-r--r--gdb/expprint.c61
-rw-r--r--gdb/expression.h83
-rw-r--r--gdb/extension-priv.h46
-rw-r--r--gdb/extension.c152
-rw-r--r--gdb/extension.h212
-rw-r--r--gdb/f-array-walker.h64
-rw-r--r--gdb/f-exp.h175
-rw-r--r--gdb/f-lang.c430
-rw-r--r--gdb/f-lang.h86
-rw-r--r--gdb/f-typeprint.c72
-rw-r--r--gdb/f-valprint.c138
-rw-r--r--gdb/fbsd-nat.c256
-rw-r--r--gdb/fbsd-nat.h47
-rw-r--r--gdb/fbsd-tdep.c1038
-rw-r--r--gdb/fbsd-tdep.h15
-rw-r--r--gdb/features/microblaze-with-stack-protect.c7
-rw-r--r--gdb/features/microblaze.c4
-rw-r--r--gdb/features/mips-dsp-linux.c1
-rw-r--r--gdb/features/mips-linux.c1
-rw-r--r--gdb/features/mips64-dsp-linux.c1
-rw-r--r--gdb/features/mips64-linux.c1
-rw-r--r--gdb/features/nds32.c1
-rw-r--r--gdb/features/nios2.c1
-rw-r--r--gdb/features/or1k-linux.c1
-rw-r--r--gdb/features/or1k.c1
-rw-r--r--gdb/features/rx.c1
-rw-r--r--gdb/features/s390-gs-linux64.c1
-rw-r--r--gdb/features/s390-linux32.c1
-rw-r--r--gdb/features/s390-linux32v1.c1
-rw-r--r--gdb/features/s390-linux32v2.c1
-rw-r--r--gdb/features/s390-linux64.c1
-rw-r--r--gdb/features/s390-linux64v1.c1
-rw-r--r--gdb/features/s390-linux64v2.c1
-rw-r--r--gdb/features/s390-te-linux64.c1
-rw-r--r--gdb/features/s390-tevx-linux64.c1
-rw-r--r--gdb/features/s390-vx-linux64.c1
-rw-r--r--gdb/features/s390x-gs-linux64.c1
-rw-r--r--gdb/features/s390x-linux64.c1
-rw-r--r--gdb/features/s390x-linux64v1.c1
-rw-r--r--gdb/features/s390x-linux64v2.c1
-rw-r--r--gdb/features/s390x-te-linux64.c1
-rw-r--r--gdb/features/s390x-tevx-linux64.c1
-rw-r--r--gdb/features/s390x-vx-linux64.c1
-rw-r--r--gdb/features/z80.c1
-rw-r--r--gdb/filename-seen-cache.c7
-rw-r--r--gdb/filename-seen-cache.h15
-rw-r--r--gdb/filesystem.c37
-rw-r--r--gdb/filesystem.h13
-rw-r--r--gdb/findcmd.c39
-rw-r--r--gdb/findvar.c163
-rw-r--r--gdb/fork-child.c31
-rw-r--r--gdb/frame-base.c10
-rw-r--r--gdb/frame-base.h8
-rw-r--r--gdb/frame-id.h7
-rw-r--r--gdb/frame-unwind.c30
-rw-r--r--gdb/frame-unwind.h24
-rw-r--r--gdb/frame.c368
-rw-r--r--gdb/frame.h129
-rw-r--r--gdb/frv-linux-tdep.c166
-rw-r--r--gdb/frv-tdep.c235
-rw-r--r--gdb/frv-tdep.h12
-rw-r--r--gdb/ft32-tdep.c122
-rw-r--r--gdb/gcore-elf.c80
-rw-r--r--gdb/gcore-elf.h13
-rw-r--r--gdb/gcore.c112
-rw-r--r--gdb/gcore.h2
-rw-r--r--gdb/gdb-demangle.c85
-rw-r--r--gdb/gdb-stabs.h71
-rw-r--r--gdb/gdb_bfd.c161
-rw-r--r--gdb/gdb_bfd.h40
-rw-r--r--gdb/gdb_curses.h14
-rw-r--r--gdb/gdb_expat.h4
-rw-r--r--gdb/gdb_wchar.h17
-rw-r--r--gdb/gdbarch-gen.h1755
-rw-r--r--gdb/gdbarch-selftests.c65
-rw-r--r--gdb/gdbarch.c2075
-rw-r--r--gdb/gdbarch.h66
-rw-r--r--gdb/gdbcmd.h20
-rw-r--r--gdb/gdbcore.h22
-rw-r--r--gdb/gdbthread.h131
-rw-r--r--gdb/gdbtypes.c1288
-rw-r--r--gdb/gdbtypes.h627
-rw-r--r--gdb/glibc-tdep.c8
-rw-r--r--gdb/gmp-utils.c28
-rw-r--r--gdb/gmp-utils.h18
-rw-r--r--gdb/gnu-nat.c1005
-rw-r--r--gdb/gnu-nat.h95
-rw-r--r--gdb/gnu-v2-abi.c74
-rw-r--r--gdb/gnu-v3-abi.c206
-rw-r--r--gdb/go-lang.c58
-rw-r--r--gdb/go-lang.h27
-rw-r--r--gdb/go-valprint.c78
-rw-r--r--gdb/go32-nat.c915
-rw-r--r--gdb/guile/guile-internal.h175
-rw-r--r--gdb/guile/guile.c210
-rw-r--r--gdb/guile/scm-arch.c120
-rw-r--r--gdb/guile/scm-auto-load.c14
-rw-r--r--gdb/guile/scm-block.c120
-rw-r--r--gdb/guile/scm-breakpoint.c294
-rw-r--r--gdb/guile/scm-cmd.c157
-rw-r--r--gdb/guile/scm-disasm.c72
-rw-r--r--gdb/guile/scm-exception.c136
-rw-r--r--gdb/guile/scm-frame.c184
-rw-r--r--gdb/guile/scm-gsmob.c41
-rw-r--r--gdb/guile/scm-iterator.c38
-rw-r--r--gdb/guile/scm-lazy-string.c80
-rw-r--r--gdb/guile/scm-math.c320
-rw-r--r--gdb/guile/scm-objfile.c62
-rw-r--r--gdb/guile/scm-param.c388
-rw-r--r--gdb/guile/scm-ports.c213
-rw-r--r--gdb/guile/scm-pretty-print.c190
-rw-r--r--gdb/guile/scm-progspace.c64
-rw-r--r--gdb/guile/scm-safe-call.c19
-rw-r--r--gdb/guile/scm-string.c33
-rw-r--r--gdb/guile/scm-symbol.c146
-rw-r--r--gdb/guile/scm-symtab.c77
-rw-r--r--gdb/guile/scm-type.c201
-rw-r--r--gdb/guile/scm-utils.c102
-rw-r--r--gdb/guile/scm-value.c490
-rw-r--r--gdb/h8300-tdep.c287
-rw-r--r--gdb/hppa-bsd-tdep.c9
-rw-r--r--gdb/hppa-linux-nat.c345
-rw-r--r--gdb/hppa-linux-offsets.h168
-rw-r--r--gdb/hppa-linux-tdep.c128
-rw-r--r--gdb/hppa-netbsd-nat.c29
-rw-r--r--gdb/hppa-netbsd-tdep.c163
-rw-r--r--gdb/hppa-obsd-nat.c27
-rw-r--r--gdb/hppa-obsd-tdep.c36
-rw-r--r--gdb/hppa-tdep.c666
-rw-r--r--gdb/hppa-tdep.h194
-rw-r--r--gdb/i386-bsd-nat.c86
-rw-r--r--gdb/i386-bsd-nat.h9
-rw-r--r--gdb/i386-bsd-tdep.c38
-rw-r--r--gdb/i386-darwin-nat.c102
-rw-r--r--gdb/i386-darwin-tdep.c59
-rw-r--r--gdb/i386-dicos-tdep.c1
-rw-r--r--gdb/i386-fbsd-nat.c50
-rw-r--r--gdb/i386-fbsd-tdep.c286
-rw-r--r--gdb/i386-gnu-nat.c61
-rw-r--r--gdb/i386-gnu-tdep.c112
-rw-r--r--gdb/i386-go32-tdep.c3
-rw-r--r--gdb/i386-linux-nat.c146
-rw-r--r--gdb/i386-linux-tdep.c271
-rw-r--r--gdb/i386-linux-tdep.h2
-rw-r--r--gdb/i386-netbsd-nat.c3
-rw-r--r--gdb/i386-netbsd-tdep.c545
-rw-r--r--gdb/i386-nto-tdep.c55
-rw-r--r--gdb/i386-obsd-nat.c7
-rw-r--r--gdb/i386-obsd-tdep.c226
-rw-r--r--gdb/i386-sol2-nat.c120
-rw-r--r--gdb/i386-sol2-tdep.c41
-rw-r--r--gdb/i386-tdep.c2392
-rw-r--r--gdb/i386-tdep.h144
-rw-r--r--gdb/i386-windows-nat.c82
-rw-r--r--gdb/i386-windows-tdep.c27
-rw-r--r--gdb/i387-tdep.c536
-rw-r--r--gdb/i387-tdep.h22
-rw-r--r--gdb/ia64-libunwind-tdep.c110
-rw-r--r--gdb/ia64-libunwind-tdep.h13
-rw-r--r--gdb/ia64-linux-nat.c939
-rw-r--r--gdb/ia64-linux-tdep.c128
-rw-r--r--gdb/ia64-tdep.c1271
-rw-r--r--gdb/ia64-tdep.h284
-rw-r--r--gdb/ia64-vms-tdep.c24
-rw-r--r--gdb/inf-child.c26
-rw-r--r--gdb/inf-child.h27
-rw-r--r--gdb/inf-loop.c2
-rw-r--r--gdb/inf-loop.h2
-rw-r--r--gdb/inf-ptrace.c71
-rw-r--r--gdb/inf-ptrace.h30
-rw-r--r--gdb/infcall.c403
-rw-r--r--gdb/infcall.h11
-rw-r--r--gdb/infcmd.c602
-rw-r--r--gdb/inferior-iter.h20
-rw-r--r--gdb/inferior.c163
-rw-r--r--gdb/inferior.h114
-rw-r--r--gdb/inflow.c38
-rw-r--r--gdb/infrun.c1317
-rw-r--r--gdb/infrun.h26
-rw-r--r--gdb/inline-frame.c75
-rw-r--r--gdb/inline-frame.h2
-rw-r--r--gdb/interps.c56
-rw-r--r--gdb/interps.h42
-rw-r--r--gdb/iq2000-tdep.c255
-rw-r--r--gdb/jit.c278
-rw-r--r--gdb/jit.h3
-rw-r--r--gdb/language.c306
-rw-r--r--gdb/language.h245
-rw-r--r--gdb/linespec.c775
-rw-r--r--gdb/linespec.h36
-rw-r--r--gdb/linux-fork.c106
-rw-r--r--gdb/linux-nat-trad.c24
-rw-r--r--gdb/linux-nat-trad.h8
-rw-r--r--gdb/linux-nat.c562
-rw-r--r--gdb/linux-nat.h69
-rw-r--r--gdb/linux-record.c295
-rw-r--r--gdb/linux-record.h5
-rw-r--r--gdb/linux-tdep.c756
-rw-r--r--gdb/linux-tdep.h22
-rw-r--r--gdb/linux-thread-db.c387
-rw-r--r--gdb/lm32-tdep.c102
-rw-r--r--gdb/location.c115
-rw-r--r--gdb/location.h55
-rw-r--r--gdb/loongarch-linux-nat.c87
-rw-r--r--gdb/loongarch-linux-tdep.c171
-rw-r--r--gdb/loongarch-tdep.c417
-rw-r--r--gdb/m2-exp.h30
-rw-r--r--gdb/m2-lang.c59
-rw-r--r--gdb/m2-lang.h32
-rw-r--r--gdb/m2-typeprint.c141
-rw-r--r--gdb/m2-valprint.c149
-rw-r--r--gdb/m32c-tdep.c766
-rw-r--r--gdb/m32r-linux-nat.c40
-rw-r--r--gdb/m32r-linux-tdep.c183
-rw-r--r--gdb/m32r-tdep.c150
-rw-r--r--gdb/m68hc11-tdep.c372
-rw-r--r--gdb/m68k-bsd-nat.c22
-rw-r--r--gdb/m68k-bsd-tdep.c39
-rw-r--r--gdb/m68k-linux-nat.c115
-rw-r--r--gdb/m68k-linux-tdep.c308
-rw-r--r--gdb/m68k-tdep.c186
-rw-r--r--gdb/m68k-tdep.h43
-rw-r--r--gdb/machoread.c197
-rw-r--r--gdb/macrocmd.c128
-rw-r--r--gdb/macroexp.c313
-rw-r--r--gdb/macroexp.h2
-rw-r--r--gdb/macroscope.c18
-rw-r--r--gdb/macroscope.h10
-rw-r--r--gdb/macrotab.c194
-rw-r--r--gdb/macrotab.h42
-rw-r--r--gdb/main.c368
-rw-r--r--gdb/maint-test-options.c140
-rw-r--r--gdb/maint-test-settings.c129
-rw-r--r--gdb/maint.c456
-rw-r--r--gdb/maint.h4
-rw-r--r--gdb/mdebugread.c1051
-rw-r--r--gdb/mdebugread.h9
-rw-r--r--gdb/mem-break.c6
-rw-r--r--gdb/memattr.c119
-rw-r--r--gdb/memattr.h47
-rw-r--r--gdb/memory-map.c83
-rw-r--r--gdb/memory-map.h1
-rw-r--r--gdb/memrange.c10
-rw-r--r--gdb/memrange.h15
-rw-r--r--gdb/memtag.c11
-rw-r--r--gdb/mep-tdep.c726
-rw-r--r--gdb/mi/mi-cmd-break.c183
-rw-r--r--gdb/mi/mi-cmd-catch.c149
-rw-r--r--gdb/mi/mi-cmd-disas.c86
-rw-r--r--gdb/mi/mi-cmd-env.c45
-rw-r--r--gdb/mi/mi-cmd-file.c35
-rw-r--r--gdb/mi/mi-cmd-info.c9
-rw-r--r--gdb/mi/mi-cmd-stack.c256
-rw-r--r--gdb/mi/mi-cmd-target.c22
-rw-r--r--gdb/mi/mi-cmd-var.c125
-rw-r--r--gdb/mi/mi-cmds.c42
-rw-r--r--gdb/mi/mi-cmds.h18
-rw-r--r--gdb/mi/mi-common.c44
-rw-r--r--gdb/mi/mi-console.c3
-rw-r--r--gdb/mi/mi-console.h2
-rw-r--r--gdb/mi/mi-getopt.c22
-rw-r--r--gdb/mi/mi-getopt.h16
-rw-r--r--gdb/mi/mi-interp.c758
-rw-r--r--gdb/mi/mi-interp.h4
-rw-r--r--gdb/mi/mi-main.c511
-rw-r--r--gdb/mi/mi-main.h3
-rw-r--r--gdb/mi/mi-out.c26
-rw-r--r--gdb/mi/mi-out.h39
-rw-r--r--gdb/mi/mi-parse.c109
-rw-r--r--gdb/mi/mi-parse.h53
-rw-r--r--gdb/mi/mi-symbol-cmds.c115
-rw-r--r--gdb/microblaze-linux-tdep.c41
-rw-r--r--gdb/microblaze-tdep.c281
-rw-r--r--gdb/microblaze-tdep.h21
-rw-r--r--gdb/mingw-hdep.c51
-rw-r--r--gdb/minidebug.c40
-rw-r--r--gdb/minsyms.c351
-rw-r--r--gdb/minsyms.h47
-rw-r--r--gdb/mips-fbsd-nat.c16
-rw-r--r--gdb/mips-fbsd-tdep.c222
-rw-r--r--gdb/mips-linux-nat.c167
-rw-r--r--gdb/mips-linux-tdep.c582
-rw-r--r--gdb/mips-linux-tdep.h104
-rw-r--r--gdb/mips-netbsd-nat.c23
-rw-r--r--gdb/mips-netbsd-tdep.c92
-rw-r--r--gdb/mips-sde-tdep.c65
-rw-r--r--gdb/mips-tdep.c2322
-rw-r--r--gdb/mips-tdep.h100
-rw-r--r--gdb/mips64-obsd-nat.c16
-rw-r--r--gdb/mips64-obsd-tdep.c62
-rw-r--r--gdb/mipsread.c103
-rw-r--r--gdb/mn10300-linux-tdep.c735
-rw-r--r--gdb/mn10300-tdep.c226
-rw-r--r--gdb/mn10300-tdep.h23
-rw-r--r--gdb/moxie-tdep.c218
-rw-r--r--gdb/msp430-tdep.c131
-rw-r--r--gdb/namespace.c16
-rw-r--r--gdb/namespace.h9
-rw-r--r--gdb/nat/aarch64-hw-point.c81
-rw-r--r--gdb/nat/aarch64-hw-point.h8
-rw-r--r--gdb/nat/aarch64-linux-hw-point.c51
-rw-r--r--gdb/nat/aarch64-linux-hw-point.h44
-rw-r--r--gdb/nat/aarch64-linux.c7
-rw-r--r--gdb/nat/aarch64-linux.h9
-rw-r--r--gdb/nat/aarch64-mte-linux-ptrace.c30
-rw-r--r--gdb/nat/aarch64-mte-linux-ptrace.h4
-rw-r--r--gdb/nat/aarch64-sve-linux-ptrace.c24
-rw-r--r--gdb/nat/aarch64-sve-linux-ptrace.h5
-rw-r--r--gdb/nat/aarch64-sve-linux-sigcontext.h151
-rw-r--r--gdb/nat/amd64-linux-siginfo.c17
-rw-r--r--gdb/nat/amd64-linux-siginfo.h7
-rw-r--r--gdb/nat/fork-inferior.c106
-rw-r--r--gdb/nat/fork-inferior.h27
-rw-r--r--gdb/nat/gdb_ptrace.h80
-rw-r--r--gdb/nat/gdb_thread_db.h13
-rw-r--r--gdb/nat/glibc_thread_db.h184
-rw-r--r--gdb/nat/linux-btrace.c82
-rw-r--r--gdb/nat/linux-btrace.h6
-rw-r--r--gdb/nat/linux-namespaces.c187
-rw-r--r--gdb/nat/linux-namespaces.h32
-rw-r--r--gdb/nat/linux-nat.h6
-rw-r--r--gdb/nat/linux-osdata.c473
-rw-r--r--gdb/nat/linux-personality.c19
-rw-r--r--gdb/nat/linux-procfs.c15
-rw-r--r--gdb/nat/linux-ptrace.c106
-rw-r--r--gdb/nat/linux-ptrace.h71
-rw-r--r--gdb/nat/linux-waitpid.c3
-rw-r--r--gdb/nat/mips-linux-watch.c21
-rw-r--r--gdb/nat/mips-linux-watch.h12
-rw-r--r--gdb/nat/netbsd-nat.c86
-rw-r--r--gdb/nat/netbsd-nat.h2
-rw-r--r--gdb/nat/ppc-linux.h2
-rw-r--r--gdb/nat/riscv-linux-tdesc.c10
-rw-r--r--gdb/nat/windows-nat.c224
-rw-r--r--gdb/nat/windows-nat.h94
-rw-r--r--gdb/nat/x86-cpuid.h10
-rw-r--r--gdb/nat/x86-dregs.c376
-rw-r--r--gdb/nat/x86-dregs.h43
-rw-r--r--gdb/nat/x86-gcc-cpuid.h236
-rw-r--r--gdb/nat/x86-linux-dregs.c22
-rw-r--r--gdb/nat/x86-linux.h3
-rw-r--r--gdb/nds32-tdep.c496
-rw-r--r--gdb/nds32-tdep.h12
-rw-r--r--gdb/netbsd-nat.c156
-rw-r--r--gdb/netbsd-nat.h10
-rw-r--r--gdb/netbsd-tdep.c140
-rw-r--r--gdb/netbsd-tdep.h4
-rw-r--r--gdb/nios2-linux-tdep.c78
-rw-r--r--gdb/nios2-tdep.c327
-rw-r--r--gdb/nios2-tdep.h22
-rw-r--r--gdb/nto-procfs.c218
-rw-r--r--gdb/nto-tdep.c89
-rw-r--r--gdb/nto-tdep.h26
-rw-r--r--gdb/objc-lang.c559
-rw-r--r--gdb/objc-lang.h11
-rw-r--r--gdb/objfile-flags.h38
-rw-r--r--gdb/objfiles.c139
-rw-r--r--gdb/objfiles.h151
-rw-r--r--gdb/obsd-nat.c22
-rw-r--r--gdb/obsd-nat.h4
-rw-r--r--gdb/obsd-tdep.c79
-rw-r--r--gdb/observable.c18
-rw-r--r--gdb/observable.h80
-rw-r--r--gdb/opencl-lang.c300
-rw-r--r--gdb/or1k-linux-nat.c31
-rw-r--r--gdb/or1k-linux-tdep.c71
-rw-r--r--gdb/or1k-tdep.c186
-rw-r--r--gdb/or1k-tdep.h43
-rw-r--r--gdb/osabi.c178
-rw-r--r--gdb/osabi.h12
-rw-r--r--gdb/osdata.c120
-rw-r--r--gdb/osdata.h11
-rw-r--r--gdb/p-lang.c37
-rw-r--r--gdb/p-lang.h60
-rw-r--r--gdb/p-typeprint.c148
-rw-r--r--gdb/p-valprint.c204
-rw-r--r--gdb/pager.h6
-rw-r--r--gdb/parse.c150
-rw-r--r--gdb/parser-defs.h127
-rw-r--r--gdb/posix-hdep.c2
-rw-r--r--gdb/ppc-fbsd-nat.c30
-rw-r--r--gdb/ppc-fbsd-tdep.c157
-rw-r--r--gdb/ppc-linux-nat.c630
-rw-r--r--gdb/ppc-linux-tdep.c890
-rw-r--r--gdb/ppc-linux-tdep.h7
-rw-r--r--gdb/ppc-netbsd-nat.c43
-rw-r--r--gdb/ppc-netbsd-tdep.c94
-rw-r--r--gdb/ppc-obsd-nat.c45
-rw-r--r--gdb/ppc-obsd-tdep.c80
-rw-r--r--gdb/ppc-obsd-tdep.h1
-rw-r--r--gdb/ppc-ravenscar-thread.c70
-rw-r--r--gdb/ppc-sysv-tdep.c386
-rw-r--r--gdb/ppc-tdep.h301
-rw-r--r--gdb/ppc64-tdep.c602
-rw-r--r--gdb/printcmd.c731
-rw-r--r--gdb/probe.c183
-rw-r--r--gdb/probe.h100
-rw-r--r--gdb/proc-api.c370
-rw-r--r--gdb/proc-events.c38
-rw-r--r--gdb/proc-flags.c12
-rw-r--r--gdb/proc-service.c24
-rw-r--r--gdb/proc-utils.h36
-rw-r--r--gdb/proc-why.c60
-rw-r--r--gdb/process-stratum-target.c54
-rw-r--r--gdb/process-stratum-target.h12
-rw-r--r--gdb/procfs.c1025
-rw-r--r--gdb/producer.c48
-rw-r--r--gdb/progspace-and-thread.h1
-rw-r--r--gdb/progspace.c36
-rw-r--r--gdb/progspace.h71
-rw-r--r--gdb/prologue-value.c98
-rw-r--r--gdb/prologue-value.h38
-rw-r--r--gdb/psympriv.h153
-rw-r--r--gdb/psymtab.c404
-rw-r--r--gdb/psymtab.h7
-rw-r--r--gdb/python/py-arch.c161
-rw-r--r--gdb/python/py-auto-load.c25
-rw-r--r--gdb/python/py-block.c234
-rw-r--r--gdb/python/py-bpevent.c11
-rw-r--r--gdb/python/py-breakpoint.c509
-rw-r--r--gdb/python/py-cmd.c228
-rw-r--r--gdb/python/py-connection.c268
-rw-r--r--gdb/python/py-dap.c26
-rw-r--r--gdb/python/py-disasm.c362
-rw-r--r--gdb/python/py-event.c98
-rw-r--r--gdb/python/py-event.h22
-rw-r--r--gdb/python/py-events.h6
-rw-r--r--gdb/python/py-evtregistry.c86
-rw-r--r--gdb/python/py-evts.c22
-rw-r--r--gdb/python/py-exitedevent.c10
-rw-r--r--gdb/python/py-finishbreakpoint.c160
-rw-r--r--gdb/python/py-frame.c190
-rw-r--r--gdb/python/py-framefilter.c190
-rw-r--r--gdb/python/py-function.c95
-rw-r--r--gdb/python/py-gdb-readline.c1
-rw-r--r--gdb/python/py-inferior.c211
-rw-r--r--gdb/python/py-infevents.c6
-rw-r--r--gdb/python/py-infthread.c180
-rw-r--r--gdb/python/py-instruction.c23
-rw-r--r--gdb/python/py-lazy-string.c94
-rw-r--r--gdb/python/py-linetable.c306
-rw-r--r--gdb/python/py-membuf.c99
-rw-r--r--gdb/python/py-micmd.c167
-rw-r--r--gdb/python/py-newobjfileevent.c18
-rw-r--r--gdb/python/py-objfile.c354
-rw-r--r--gdb/python/py-param.c410
-rw-r--r--gdb/python/py-prettyprint.c173
-rw-r--r--gdb/python/py-progspace.c194
-rw-r--r--gdb/python/py-record-btrace.c177
-rw-r--r--gdb/python/py-record-btrace.h3
-rw-r--r--gdb/python/py-record.c231
-rw-r--r--gdb/python/py-record.h16
-rw-r--r--gdb/python/py-ref.h16
-rw-r--r--gdb/python/py-registers.c349
-rw-r--r--gdb/python/py-signalevent.c6
-rw-r--r--gdb/python/py-stopevent.c13
-rw-r--r--gdb/python/py-stopevent.h3
-rw-r--r--gdb/python/py-symbol.c248
-rw-r--r--gdb/python/py-symtab.c249
-rw-r--r--gdb/python/py-threadevent.c8
-rw-r--r--gdb/python/py-tui.c186
-rw-r--r--gdb/python/py-type.c529
-rw-r--r--gdb/python/py-unwind.c291
-rw-r--r--gdb/python/py-utils.c61
-rw-r--r--gdb/python/py-value.c417
-rw-r--r--gdb/python/py-varobj.c22
-rw-r--r--gdb/python/py-xmethods.c72
-rw-r--r--gdb/python/python-internal.h355
-rw-r--r--gdb/python/python.c619
-rw-r--r--gdb/quick-symbol.h75
-rw-r--r--gdb/ravenscar-thread.c92
-rw-r--r--gdb/ravenscar-thread.h16
-rw-r--r--gdb/record-btrace.c408
-rw-r--r--gdb/record-full.c642
-rw-r--r--gdb/record.c142
-rw-r--r--gdb/record.h11
-rw-r--r--gdb/regcache-dump.c75
-rw-r--r--gdb/regcache.c262
-rw-r--r--gdb/regcache.h111
-rw-r--r--gdb/regformats/regdef.h17
-rw-r--r--gdb/reggroups.c34
-rw-r--r--gdb/reggroups.h15
-rw-r--r--gdb/registry.h36
-rw-r--r--gdb/regset.h9
-rw-r--r--gdb/remote-fileio.c263
-rw-r--r--gdb/remote-fileio.h13
-rw-r--r--gdb/remote-notif.c41
-rw-r--r--gdb/remote-notif.h14
-rw-r--r--gdb/remote-sim.c194
-rw-r--r--gdb/remote.c2542
-rw-r--r--gdb/remote.h11
-rw-r--r--gdb/reverse.c61
-rw-r--r--gdb/riscv-fbsd-nat.c7
-rw-r--r--gdb/riscv-fbsd-tdep.c115
-rw-r--r--gdb/riscv-fbsd-tdep.h2
-rw-r--r--gdb/riscv-linux-nat.c91
-rw-r--r--gdb/riscv-linux-tdep.c81
-rw-r--r--gdb/riscv-none-tdep.c60
-rw-r--r--gdb/riscv-tdep.c905
-rw-r--r--gdb/riscv-tdep.h38
-rw-r--r--gdb/rl78-tdep.c690
-rw-r--r--gdb/rs6000-aix-nat.c167
-rw-r--r--gdb/rs6000-aix-tdep.c273
-rw-r--r--gdb/rs6000-aix-tdep.h6
-rw-r--r--gdb/rs6000-lynx178-tdep.c32
-rw-r--r--gdb/rs6000-tdep.c4397
-rw-r--r--gdb/run-on-main-thread.c1
-rw-r--r--gdb/rust-exp.h90
-rw-r--r--gdb/rust-lang.c364
-rw-r--r--gdb/rust-lang.h55
-rw-r--r--gdb/rust-parse.c350
-rw-r--r--gdb/rx-tdep.c177
-rw-r--r--gdb/s12z-tdep.c220
-rw-r--r--gdb/s390-linux-nat.c308
-rw-r--r--gdb/s390-linux-tdep.c389
-rw-r--r--gdb/s390-linux-tdep.h10
-rw-r--r--gdb/s390-tdep.c2446
-rw-r--r--gdb/s390-tdep.h175
-rw-r--r--gdb/scoped-mock-context.h11
-rw-r--r--gdb/selftest-arch.c30
-rw-r--r--gdb/selftest-arch.h6
-rw-r--r--gdb/sentinel-frame.c16
-rw-r--r--gdb/sentinel-frame.h2
-rw-r--r--gdb/ser-base.c38
-rw-r--r--gdb/ser-base.h2
-rw-r--r--gdb/ser-event.c17
-rw-r--r--gdb/ser-go32.c415
-rw-r--r--gdb/ser-mingw.c293
-rw-r--r--gdb/ser-pipe.c58
-rw-r--r--gdb/ser-tcp.c129
-rw-r--r--gdb/ser-uds.c58
-rw-r--r--gdb/ser-unix.c195
-rw-r--r--gdb/ser-unix.h2
-rw-r--r--gdb/serial.c98
-rw-r--r--gdb/serial.h137
-rw-r--r--gdb/sh-linux-tdep.c143
-rw-r--r--gdb/sh-netbsd-nat.c31
-rw-r--r--gdb/sh-netbsd-tdep.c54
-rw-r--r--gdb/sh-tdep.c650
-rw-r--r--gdb/sh-tdep.h124
-rw-r--r--gdb/sim-regno.h3
-rw-r--r--gdb/skip.c188
-rw-r--r--gdb/skip.h2
-rw-r--r--gdb/sol-thread.c353
-rw-r--r--gdb/sol2-tdep.c9
-rw-r--r--gdb/solib-aix.c155
-rw-r--r--gdb/solib-darwin.c65
-rw-r--r--gdb/solib-dsbt.c182
-rw-r--r--gdb/solib-frv.c160
-rw-r--r--gdb/solib-rocm.c92
-rw-r--r--gdb/solib-svr4.c543
-rw-r--r--gdb/solib-svr4.h52
-rw-r--r--gdb/solib-target.c124
-rw-r--r--gdb/solib.c369
-rw-r--r--gdb/solib.h19
-rw-r--r--gdb/solist.h17
-rw-r--r--gdb/source-cache.c60
-rw-r--r--gdb/source-cache.h11
-rw-r--r--gdb/source.c357
-rw-r--r--gdb/source.h43
-rw-r--r--gdb/sparc-linux-nat.c14
-rw-r--r--gdb/sparc-linux-tdep.c145
-rw-r--r--gdb/sparc-nat.c54
-rw-r--r--gdb/sparc-nat.h46
-rw-r--r--gdb/sparc-netbsd-nat.c1
-rw-r--r--gdb/sparc-netbsd-tdep.c82
-rw-r--r--gdb/sparc-obsd-tdep.c47
-rw-r--r--gdb/sparc-ravenscar-thread.c14
-rw-r--r--gdb/sparc-sol2-nat.c4
-rw-r--r--gdb/sparc-sol2-tdep.c107
-rw-r--r--gdb/sparc-tdep.c321
-rw-r--r--gdb/sparc-tdep.h91
-rw-r--r--gdb/sparc64-fbsd-nat.c2
-rw-r--r--gdb/sparc64-fbsd-tdep.c101
-rw-r--r--gdb/sparc64-linux-nat.c40
-rw-r--r--gdb/sparc64-linux-tdep.c132
-rw-r--r--gdb/sparc64-nat.c7
-rw-r--r--gdb/sparc64-netbsd-nat.c28
-rw-r--r--gdb/sparc64-netbsd-tdep.c84
-rw-r--r--gdb/sparc64-obsd-nat.c12
-rw-r--r--gdb/sparc64-obsd-tdep.c160
-rw-r--r--gdb/sparc64-sol2-tdep.c105
-rw-r--r--gdb/sparc64-tdep.c360
-rw-r--r--gdb/sparc64-tdep.h74
-rw-r--r--gdb/split-name.c7
-rw-r--r--gdb/stabsread.c639
-rw-r--r--gdb/stabsread.h71
-rw-r--r--gdb/stack.c842
-rw-r--r--gdb/stack.h8
-rw-r--r--gdb/stap-probe.c229
-rw-r--r--gdb/stap-probe.h5
-rw-r--r--gdb/std-regs.c16
-rw-r--r--gdb/stub-termcap.c26
-rw-r--r--gdb/stubs/i386-stub.c472
-rw-r--r--gdb/stubs/ia64vms-stub.c663
-rw-r--r--gdb/stubs/m32r-stub.c426
-rw-r--r--gdb/stubs/m68k-stub.c248
-rw-r--r--gdb/stubs/sh-stub.c1088
-rw-r--r--gdb/stubs/sparc-stub.c333
-rw-r--r--gdb/stubs/z80-stub.c578
-rw-r--r--gdb/symfile-add-flags.h30
-rw-r--r--gdb/symfile-debug.c249
-rw-r--r--gdb/symfile-mem.c50
-rw-r--r--gdb/symfile.c742
-rw-r--r--gdb/symfile.h67
-rw-r--r--gdb/symmisc.c248
-rw-r--r--gdb/symtab.c1676
-rw-r--r--gdb/symtab.h637
-rw-r--r--gdb/target-connection.c8
-rw-r--r--gdb/target-dcache.c40
-rw-r--r--gdb/target-debug.h122
-rw-r--r--gdb/target-delegates.c1532
-rw-r--r--gdb/target-descriptions.c404
-rw-r--r--gdb/target-descriptions.h50
-rw-r--r--gdb/target-float.c861
-rw-r--r--gdb/target-float.h21
-rw-r--r--gdb/target-memory.c45
-rw-r--r--gdb/target.c763
-rw-r--r--gdb/target.h1263
-rw-r--r--gdb/target/target.c34
-rw-r--r--gdb/target/target.h20
-rw-r--r--gdb/target/waitstatus.c12
-rw-r--r--gdb/target/waitstatus.h57
-rw-r--r--gdb/terminal.h2
-rw-r--r--gdb/test-target.c7
-rw-r--r--gdb/test-target.h27
-rw-r--r--gdb/thread-fsm.h24
-rw-r--r--gdb/thread-iter.c7
-rw-r--r--gdb/thread-iter.h82
-rw-r--r--gdb/thread.c307
-rw-r--r--gdb/tic6x-linux-tdep.c64
-rw-r--r--gdb/tic6x-tdep.c214
-rw-r--r--gdb/tic6x-tdep.h8
-rw-r--r--gdb/tid-parse.c38
-rw-r--r--gdb/tid-parse.h23
-rw-r--r--gdb/tilegx-linux-nat.c41
-rw-r--r--gdb/tilegx-linux-tdep.c49
-rw-r--r--gdb/tilegx-tdep.c280
-rw-r--r--gdb/tilegx-tdep.h149
-rw-r--r--gdb/top.c563
-rw-r--r--gdb/top.h19
-rw-r--r--gdb/tracectf.c432
-rw-r--r--gdb/tracefile-tfile.c215
-rw-r--r--gdb/tracefile.c122
-rw-r--r--gdb/tracefile.h28
-rw-r--r--gdb/tracepoint.c991
-rw-r--r--gdb/tracepoint.h95
-rw-r--r--gdb/trad-frame.c16
-rw-r--r--gdb/trad-frame.h37
-rw-r--r--gdb/tramp-frame.c24
-rw-r--r--gdb/tramp-frame.h13
-rw-r--r--gdb/tui/tui-command.h27
-rw-r--r--gdb/tui/tui-data.c10
-rw-r--r--gdb/tui/tui-data.h76
-rw-r--r--gdb/tui/tui-disasm.c31
-rw-r--r--gdb/tui/tui-disasm.h8
-rw-r--r--gdb/tui/tui-file.h4
-rw-r--r--gdb/tui/tui-hooks.c22
-rw-r--r--gdb/tui/tui-interp.c8
-rw-r--r--gdb/tui/tui-io.c51
-rw-r--r--gdb/tui/tui-layout.c171
-rw-r--r--gdb/tui/tui-layout.h35
-rw-r--r--gdb/tui/tui-location.c5
-rw-r--r--gdb/tui/tui-location.h20
-rw-r--r--gdb/tui/tui-out.h14
-rw-r--r--gdb/tui/tui-regs.c48
-rw-r--r--gdb/tui/tui-regs.h18
-rw-r--r--gdb/tui/tui-source.c17
-rw-r--r--gdb/tui/tui-source.h12
-rw-r--r--gdb/tui/tui-stack.c55
-rw-r--r--gdb/tui/tui-stack.h41
-rw-r--r--gdb/tui/tui-win.c397
-rw-r--r--gdb/tui/tui-wingeneral.c27
-rw-r--r--gdb/tui/tui-winsource.c62
-rw-r--r--gdb/tui/tui-winsource.h47
-rw-r--r--gdb/tui/tui.c74
-rw-r--r--gdb/tui/tui.h7
-rw-r--r--gdb/type-stack.c29
-rw-r--r--gdb/type-stack.h45
-rw-r--r--gdb/typeprint.c196
-rw-r--r--gdb/typeprint.h10
-rw-r--r--gdb/ui-file.c51
-rw-r--r--gdb/ui-file.h109
-rw-r--r--gdb/ui-out.c178
-rw-r--r--gdb/ui-out.h117
-rw-r--r--gdb/ui-style.c34
-rw-r--r--gdb/ui-style.h55
-rw-r--r--gdb/unittests/array-view-selftests.c176
-rw-r--r--gdb/unittests/child-path-selftests.c15
-rw-r--r--gdb/unittests/cli-utils-selftests.c14
-rw-r--r--gdb/unittests/command-def-selftests.c64
-rw-r--r--gdb/unittests/common-utils-selftests.c17
-rw-r--r--gdb/unittests/copy_bitwise-selftests.c32
-rw-r--r--gdb/unittests/enum-flags-selftests.c204
-rw-r--r--gdb/unittests/environ-selftests.c11
-rw-r--r--gdb/unittests/filtered_iterator-selftests.c34
-rw-r--r--gdb/unittests/format_pieces-selftests.c99
-rw-r--r--gdb/unittests/frame_info_ptr-selftests.c8
-rw-r--r--gdb/unittests/function-view-selftests.c49
-rw-r--r--gdb/unittests/gdb_tilde_expand-selftests.c21
-rw-r--r--gdb/unittests/gmp-utils-selftests.c55
-rw-r--r--gdb/unittests/intrusive_list-selftests.c152
-rw-r--r--gdb/unittests/lookup_name_info-selftests.c42
-rw-r--r--gdb/unittests/main-thread-selftests.c24
-rw-r--r--gdb/unittests/memory-map-selftests.c13
-rw-r--r--gdb/unittests/memrange-selftests.c13
-rw-r--r--gdb/unittests/mkdir-recursive-selftests.c22
-rw-r--r--gdb/unittests/observable-selftests.c91
-rw-r--r--gdb/unittests/offset-type-selftests.c65
-rw-r--r--gdb/unittests/optional-selftests.c7
-rw-r--r--gdb/unittests/packed-selftests.c9
-rw-r--r--gdb/unittests/parallel-for-selftests.c96
-rw-r--r--gdb/unittests/parse-connection-spec-selftests.c195
-rw-r--r--gdb/unittests/path-join-selftests.c16
-rw-r--r--gdb/unittests/ptid-selftests.c10
-rw-r--r--gdb/unittests/rsp-low-selftests.c16
-rw-r--r--gdb/unittests/scoped_fd-selftests.c12
-rw-r--r--gdb/unittests/scoped_ignore_signal-selftests.c28
-rw-r--r--gdb/unittests/scoped_mmap-selftests.c23
-rw-r--r--gdb/unittests/scoped_restore-selftests.c16
-rw-r--r--gdb/unittests/search-memory-selftests.c44
-rw-r--r--gdb/unittests/string_view-selftests.c7
-rw-r--r--gdb/unittests/style-selftests.c10
-rw-r--r--gdb/unittests/tracepoint-selftests.c13
-rw-r--r--gdb/unittests/tui-selftests.c7
-rw-r--r--gdb/unittests/ui-file-selftests.c22
-rw-r--r--gdb/unittests/unique_xmalloc_ptr_char.c11
-rw-r--r--gdb/unittests/unpack-selftests.c19
-rw-r--r--gdb/unittests/utils-selftests.c24
-rw-r--r--gdb/unittests/vec-utils-selftests.c23
-rw-r--r--gdb/unittests/xml-utils-selftests.c20
-rw-r--r--gdb/user-regs.c6
-rw-r--r--gdb/user-regs.h5
-rw-r--r--gdb/utils.c653
-rw-r--r--gdb/utils.h56
-rw-r--r--gdb/v850-tdep.c1234
-rw-r--r--gdb/valarith.c323
-rw-r--r--gdb/valops.c1151
-rw-r--r--gdb/valprint.c929
-rw-r--r--gdb/valprint.h80
-rw-r--r--gdb/value.c537
-rw-r--r--gdb/value.h212
-rw-r--r--gdb/varobj.c224
-rw-r--r--gdb/varobj.h86
-rw-r--r--gdb/vax-bsd-nat.c17
-rw-r--r--gdb/vax-netbsd-tdep.c5
-rw-r--r--gdb/vax-tdep.c82
-rw-r--r--gdb/vax-tdep.h10
-rw-r--r--gdb/windows-nat.c684
-rw-r--r--gdb/windows-nat.h1
-rw-r--r--gdb/windows-tdep.c346
-rw-r--r--gdb/windows-tdep.h2
-rw-r--r--gdb/x86-bsd-nat.c12
-rw-r--r--gdb/x86-bsd-nat.h4
-rw-r--r--gdb/x86-fbsd-nat.h3
-rw-r--r--gdb/x86-linux-nat.c38
-rw-r--r--gdb/x86-linux-nat.h43
-rw-r--r--gdb/x86-nat.c37
-rw-r--r--gdb/x86-nat.h57
-rw-r--r--gdb/x86-tdep.c7
-rw-r--r--gdb/x86-tdep.h2
-rw-r--r--gdb/xcoffread.c656
-rw-r--r--gdb/xml-support.c206
-rw-r--r--gdb/xml-support.h54
-rw-r--r--gdb/xml-syscall.c123
-rw-r--r--gdb/xml-syscall.h7
-rw-r--r--gdb/xml-tdesc.c382
-rw-r--r--gdb/xml-tdesc.h1
-rw-r--r--gdb/xstormy16-tdep.c175
-rw-r--r--gdb/xtensa-config.c866
-rw-r--r--gdb/xtensa-linux-nat.c143
-rw-r--r--gdb/xtensa-linux-tdep.c22
-rw-r--r--gdb/xtensa-tdep.c970
-rw-r--r--gdb/xtensa-tdep.h231
-rw-r--r--gdb/xtensa-xtregs.c6
-rw-r--r--gdb/yy-remap.h100
-rw-r--r--gdb/z80-tdep.c620
-rw-r--r--gdb/z80-tdep.h14
-rw-r--r--gdbserver/ax.cc1591
-rw-r--r--gdbserver/ax.h29
-rw-r--r--gdbserver/debug.cc16
-rw-r--r--gdbserver/debug.h8
-rw-r--r--gdbserver/dll.cc25
-rw-r--r--gdbserver/dll.h10
-rw-r--r--gdbserver/fork-child.cc7
-rw-r--r--gdbserver/gdbreplay.cc198
-rw-r--r--gdbserver/gdbthread.h42
-rw-r--r--gdbserver/hostio.cc119
-rw-r--r--gdbserver/i387-fp.cc647
-rw-r--r--gdbserver/inferiors.cc26
-rw-r--r--gdbserver/inferiors.h10
-rw-r--r--gdbserver/linux-aarch32-low.cc92
-rw-r--r--gdbserver/linux-aarch32-low.h4
-rw-r--r--gdbserver/linux-aarch32-tdesc.h2
-rw-r--r--gdbserver/linux-aarch64-ipa.cc128
-rw-r--r--gdbserver/linux-aarch64-low.cc671
-rw-r--r--gdbserver/linux-aarch64-tdesc.cc12
-rw-r--r--gdbserver/linux-aarch64-tdesc.h2
-rw-r--r--gdbserver/linux-amd64-ipa.cc114
-rw-r--r--gdbserver/linux-arc-low.cc58
-rw-r--r--gdbserver/linux-arm-low.cc348
-rw-r--r--gdbserver/linux-arm-tdesc.cc2
-rw-r--r--gdbserver/linux-arm-tdesc.h2
-rw-r--r--gdbserver/linux-csky-low.cc95
-rw-r--r--gdbserver/linux-i386-ipa.cc155
-rw-r--r--gdbserver/linux-ia64-low.cc741
-rw-r--r--gdbserver/linux-loongarch-low.cc68
-rw-r--r--gdbserver/linux-low.cc3611
-rw-r--r--gdbserver/linux-low.h127
-rw-r--r--gdbserver/linux-m68k-low.cc82
-rw-r--r--gdbserver/linux-mips-low.cc369
-rw-r--r--gdbserver/linux-nios2-low.cc66
-rw-r--r--gdbserver/linux-or1k-low.cc58
-rw-r--r--gdbserver/linux-ppc-ipa.cc74
-rw-r--r--gdbserver/linux-ppc-low.cc1615
-rw-r--r--gdbserver/linux-ppc-tdesc-init.h5
-rw-r--r--gdbserver/linux-riscv-low.cc94
-rw-r--r--gdbserver/linux-s390-ipa.cc691
-rw-r--r--gdbserver/linux-s390-low.cc1730
-rw-r--r--gdbserver/linux-s390-tdesc.h3
-rw-r--r--gdbserver/linux-sh-low.cc95
-rw-r--r--gdbserver/linux-sparc-low.cc132
-rw-r--r--gdbserver/linux-tic6x-low.cc157
-rw-r--r--gdbserver/linux-x86-low.cc1607
-rw-r--r--gdbserver/linux-x86-tdesc.cc33
-rw-r--r--gdbserver/linux-x86-tdesc.h5
-rw-r--r--gdbserver/linux-xtensa-low.cc162
-rw-r--r--gdbserver/mem-break.cc744
-rw-r--r--gdbserver/mem-break.h46
-rw-r--r--gdbserver/netbsd-aarch64-low.cc30
-rw-r--r--gdbserver/netbsd-amd64-low.cc89
-rw-r--r--gdbserver/netbsd-i386-low.cc61
-rw-r--r--gdbserver/netbsd-low.cc509
-rw-r--r--gdbserver/netbsd-low.h28
-rw-r--r--gdbserver/notif.cc16
-rw-r--r--gdbserver/notif.h7
-rw-r--r--gdbserver/proc-service.cc17
-rw-r--r--gdbserver/regcache.cc84
-rw-r--r--gdbserver/regcache.h18
-rw-r--r--gdbserver/remote-utils.cc711
-rw-r--r--gdbserver/remote-utils.h31
-rw-r--r--gdbserver/server.cc2920
-rw-r--r--gdbserver/server.h18
-rw-r--r--gdbserver/symbol.cc2
-rw-r--r--gdbserver/target.cc147
-rw-r--r--gdbserver/target.h221
-rw-r--r--gdbserver/tdesc.cc45
-rw-r--r--gdbserver/tdesc.h11
-rw-r--r--gdbserver/thread-db.cc186
-rw-r--r--gdbserver/tracepoint.cc3213
-rw-r--r--gdbserver/tracepoint.h70
-rw-r--r--gdbserver/utils.cc22
-rw-r--r--gdbserver/win32-i386-low.cc364
-rw-r--r--gdbserver/win32-low.cc532
-rw-r--r--gdbserver/win32-low.h50
-rw-r--r--gdbserver/x86-low.cc10
-rw-r--r--gdbserver/x86-tdesc.h4
-rw-r--r--gdbserver/xtensa-xtregs.cc32
-rw-r--r--gdbsupport/agent.cc79
-rw-r--r--gdbsupport/agent.h10
-rw-r--r--gdbsupport/alt-stack.h3
-rw-r--r--gdbsupport/array-view.h107
-rw-r--r--gdbsupport/block-signals.h3
-rw-r--r--gdbsupport/break-common.h12
-rw-r--r--gdbsupport/btrace-common.cc118
-rw-r--r--gdbsupport/btrace-common.h20
-rw-r--r--gdbsupport/buffer.cc169
-rw-r--r--gdbsupport/buffer.h8
-rw-r--r--gdbsupport/buildargv.h70
-rw-r--r--gdbsupport/byte-vector.h3
-rw-r--r--gdbsupport/cleanups.cc11
-rw-r--r--gdbsupport/common-debug.cc4
-rw-r--r--gdbsupport/common-debug.h128
-rw-r--r--gdbsupport/common-defs.h28
-rw-r--r--gdbsupport/common-exceptions.cc113
-rw-r--r--gdbsupport/common-exceptions.h101
-rw-r--r--gdbsupport/common-gdbthread.h2
-rw-r--r--gdbsupport/common-inferior.cc108
-rw-r--r--gdbsupport/common-inferior.h3
-rw-r--r--gdbsupport/common-regcache.cc4
-rw-r--r--gdbsupport/common-regcache.h21
-rw-r--r--gdbsupport/common-types.h7
-rw-r--r--gdbsupport/common-utils.cc116
-rw-r--r--gdbsupport/common-utils.h28
-rw-r--r--gdbsupport/def-vector.h7
-rw-r--r--gdbsupport/default-init-alloc.h9
-rw-r--r--gdbsupport/eintr.h2
-rw-r--r--gdbsupport/enum-flags.h420
-rw-r--r--gdbsupport/environ.cc8
-rw-r--r--gdbsupport/environ.h5
-rw-r--r--gdbsupport/errors.cc34
-rw-r--r--gdbsupport/errors.h41
-rw-r--r--gdbsupport/event-loop.cc491
-rw-r--r--gdbsupport/event-loop.h29
-rw-r--r--gdbsupport/event-pipe.h11
-rw-r--r--gdbsupport/fileio.cc175
-rw-r--r--gdbsupport/fileio.h143
-rw-r--r--gdbsupport/filestuff.cc156
-rw-r--r--gdbsupport/filestuff.h14
-rw-r--r--gdbsupport/filtered-iterator.h16
-rw-r--r--gdbsupport/format.cc639
-rw-r--r--gdbsupport/format.h43
-rw-r--r--gdbsupport/forward-scope-exit.h23
-rw-r--r--gdbsupport/function-view.h114
-rw-r--r--gdbsupport/gdb-checked-static-cast.h6
-rw-r--r--gdbsupport/gdb-dlfcn.cc18
-rw-r--r--gdbsupport/gdb-dlfcn.h2
-rw-r--r--gdbsupport/gdb-hashtab.h5
-rw-r--r--gdbsupport/gdb-sigmask.h1
-rw-r--r--gdbsupport/gdb-xfree.h6
-rw-r--r--gdbsupport/gdb_assert.h17
-rw-r--r--gdbsupport/gdb_binary_search.h12
-rw-r--r--gdbsupport/gdb_file.h5
-rw-r--r--gdbsupport/gdb_locale.h20
-rw-r--r--gdbsupport/gdb_obstack.cc2
-rw-r--r--gdbsupport/gdb_obstack.h42
-rw-r--r--gdbsupport/gdb_optional.h104
-rw-r--r--gdbsupport/gdb_proc_service.h74
-rw-r--r--gdbsupport/gdb_ref_ptr.h81
-rw-r--r--gdbsupport/gdb_regex.cc11
-rw-r--r--gdbsupport/gdb_regex.h14
-rw-r--r--gdbsupport/gdb_select.h9
-rw-r--r--gdbsupport/gdb_setjmp.h12
-rw-r--r--gdbsupport/gdb_splay_tree.h10
-rw-r--r--gdbsupport/gdb_string_view.h1014
-rw-r--r--gdbsupport/gdb_sys_time.h4
-rw-r--r--gdbsupport/gdb_tilde_expand.cc34
-rw-r--r--gdbsupport/gdb_unique_ptr.h10
-rw-r--r--gdbsupport/gdb_unlinker.h16
-rw-r--r--gdbsupport/gdb_vecs.cc24
-rw-r--r--gdbsupport/gdb_vecs.h14
-rw-r--r--gdbsupport/gdb_wait.cc48
-rw-r--r--gdbsupport/gdb_wait.h80
-rw-r--r--gdbsupport/hash_enum.h3
-rw-r--r--gdbsupport/host-defs.h14
-rw-r--r--gdbsupport/intrusive_list.h157
-rw-r--r--gdbsupport/iterator-range.h27
-rw-r--r--gdbsupport/job-control.cc4
-rw-r--r--gdbsupport/netstuff.cc93
-rw-r--r--gdbsupport/netstuff.h11
-rw-r--r--gdbsupport/new-op.cc30
-rw-r--r--gdbsupport/next-iterator.h18
-rw-r--r--gdbsupport/observable.h74
-rw-r--r--gdbsupport/offset-type.h71
-rw-r--r--gdbsupport/packed.h86
-rw-r--r--gdbsupport/parallel-for.h223
-rw-r--r--gdbsupport/pathstuff.cc22
-rw-r--r--gdbsupport/pathstuff.h9
-rw-r--r--gdbsupport/poison.h39
-rw-r--r--gdbsupport/preprocessor.h2
-rw-r--r--gdbsupport/print-utils.cc92
-rw-r--r--gdbsupport/print-utils.h4
-rw-r--r--gdbsupport/ptid.h54
-rw-r--r--gdbsupport/range-chain.h46
-rw-r--r--gdbsupport/refcounted-object.h10
-rw-r--r--gdbsupport/reference-to-pointer-iterator.h29
-rw-r--r--gdbsupport/rsp-low.cc91
-rw-r--r--gdbsupport/rsp-low.h6
-rw-r--r--gdbsupport/run-time-clock.cc2
-rw-r--r--gdbsupport/run-time-clock.h2
-rw-r--r--gdbsupport/safe-iterator.h26
-rw-r--r--gdbsupport/scope-exit.h55
-rw-r--r--gdbsupport/scoped_fd.h16
-rw-r--r--gdbsupport/scoped_ignore_signal.h44
-rw-r--r--gdbsupport/scoped_ignore_sigttou.h10
-rw-r--r--gdbsupport/scoped_mmap.cc5
-rw-r--r--gdbsupport/scoped_mmap.h10
-rw-r--r--gdbsupport/scoped_restore.h23
-rw-r--r--gdbsupport/search.cc78
-rw-r--r--gdbsupport/search.h12
-rw-r--r--gdbsupport/selftest.cc42
-rw-r--r--gdbsupport/selftest.h27
-rw-r--r--gdbsupport/signals-state-save-restore.cc47
-rw-r--r--gdbsupport/signals.cc278
-rw-r--r--gdbsupport/symbol.h2
-rw-r--r--gdbsupport/tdesc.cc187
-rw-r--r--gdbsupport/tdesc.h165
-rw-r--r--gdbsupport/thread-pool.cc57
-rw-r--r--gdbsupport/thread-pool.h17
-rw-r--r--gdbsupport/traits.h77
-rw-r--r--gdbsupport/valid-expr.h81
-rw-r--r--gdbsupport/x86-xstate.h82
-rw-r--r--gdbsupport/xml-utils.cc188
1273 files changed, 107713 insertions, 118737 deletions
diff --git a/gdb/aarch32-linux-nat.c b/gdb/aarch32-linux-nat.c
index bddc3bbbcee..f92f8f07d46 100644
--- a/gdb/aarch32-linux-nat.c
+++ b/gdb/aarch32-linux-nat.c
@@ -45,8 +45,8 @@ aarch32_gp_regcache_supply (struct regcache *regcache, uint32_t *regs,
else
regcache->raw_supply (ARM_PS_REGNUM, &regs[ARM_PC_REGNUM]);
- regs[ARM_PC_REGNUM] = gdbarch_addr_bits_remove
- (regcache->arch (), regs[ARM_PC_REGNUM]);
+ regs[ARM_PC_REGNUM]
+ = gdbarch_addr_bits_remove (regcache->arch (), regs[ARM_PC_REGNUM]);
regcache->raw_supply (ARM_PC_REGNUM, &regs[ARM_PC_REGNUM]);
}
@@ -72,8 +72,8 @@ aarch32_gp_regcache_collect (const struct regcache *regcache, uint32_t *regs,
regcache->raw_collect (ARM_PS_REGNUM, &regs[ARM_CPSR_GREGNUM]);
/* Keep reserved bits bit 20 to bit 23. */
- regs[ARM_CPSR_GREGNUM] = ((regs[ARM_CPSR_GREGNUM] & 0xff0fffff)
- | (cpsr & 0x00f00000));
+ regs[ARM_CPSR_GREGNUM]
+ = ((regs[ARM_CPSR_GREGNUM] & 0xff0fffff) | (cpsr & 0x00f00000));
}
}
diff --git a/gdb/aarch64-fbsd-nat.c b/gdb/aarch64-fbsd-nat.c
index 9dbbaf951f2..f39656ac404 100644
--- a/gdb/aarch64-fbsd-nat.c
+++ b/gdb/aarch64-fbsd-nat.c
@@ -38,7 +38,7 @@
#include "inf-ptrace.h"
#if __FreeBSD_version >= 1400005
-#define HAVE_DBREG
+#define HAVE_DBREG
#include <unordered_set>
#endif
@@ -70,6 +70,7 @@ struct aarch64_fbsd_nat_target final : public fbsd_nat_target
void low_prepare_to_resume (thread_info *) override;
private:
+
void probe_debug_regs (int pid);
static bool debug_regs_probed;
#endif
@@ -121,7 +122,7 @@ const struct target_desc *
aarch64_fbsd_nat_target::read_description ()
{
aarch64_features features;
- features.tls = have_regset (inferior_ptid, NT_ARM_TLS)? 1 : 0;
+ features.tls = have_regset (inferior_ptid, NT_ARM_TLS) ? 1 : 0;
return aarch64_read_description (features);
}
@@ -144,8 +145,7 @@ aarch64_fbsd_nat_target::stopped_data_address (CORE_ADDR *addr_p)
return false;
/* This must be a hardware breakpoint. */
- if (siginfo.si_signo != SIGTRAP
- || siginfo.si_code != TRAP_TRACE
+ if (siginfo.si_signo != SIGTRAP || siginfo.si_code != TRAP_TRACE
|| siginfo.si_trapno != EXCP_WATCHPT_EL0)
return false;
@@ -178,12 +178,11 @@ aarch64_fbsd_nat_target::stopped_by_hw_breakpoint ()
return false;
/* This must be a hardware breakpoint. */
- if (siginfo.si_signo != SIGTRAP
- || siginfo.si_code != TRAP_TRACE
+ if (siginfo.si_signo != SIGTRAP || siginfo.si_code != TRAP_TRACE
|| siginfo.si_trapno != EXCP_WATCHPT_EL0)
return false;
- return !stopped_by_watchpoint();
+ return !stopped_by_watchpoint ();
}
/* Implement the "supports_stopped_by_hw_breakpoint" target_ops method. */
@@ -207,7 +206,7 @@ aarch64_fbsd_nat_target::probe_debug_regs (int pid)
aarch64_num_bp_regs = 0;
aarch64_num_wp_regs = 0;
- if (ptrace(PT_GETDBREGS, pid, (PTRACE_TYPE_ARG3) &reg, 0) == 0)
+ if (ptrace (PT_GETDBREGS, pid, (PTRACE_TYPE_ARG3) &reg, 0) == 0)
{
switch (reg.db_debug_ver)
{
@@ -223,16 +222,16 @@ aarch64_fbsd_nat_target::probe_debug_regs (int pid)
aarch64_num_bp_regs = reg.db_nbkpts;
if (aarch64_num_bp_regs > AARCH64_HBP_MAX_NUM)
{
- warning (_("Unexpected number of hardware breakpoint registers"
- " reported by ptrace, got %d, expected %d."),
+ warning (_ ("Unexpected number of hardware breakpoint registers"
+ " reported by ptrace, got %d, expected %d."),
aarch64_num_bp_regs, AARCH64_HBP_MAX_NUM);
aarch64_num_bp_regs = AARCH64_HBP_MAX_NUM;
}
aarch64_num_wp_regs = reg.db_nwtpts;
if (aarch64_num_wp_regs > AARCH64_HWP_MAX_NUM)
{
- warning (_("Unexpected number of hardware watchpoint registers"
- " reported by ptrace, got %d, expected %d."),
+ warning (_ ("Unexpected number of hardware watchpoint registers"
+ " reported by ptrace, got %d, expected %d."),
aarch64_num_wp_regs, AARCH64_HWP_MAX_NUM);
aarch64_num_wp_regs = AARCH64_HWP_MAX_NUM;
}
@@ -288,8 +287,8 @@ aarch64_fbsd_nat_target::low_new_fork (ptid_t parent, pid_t child)
current inferior. */
void
-aarch64_notify_debug_reg_change (ptid_t ptid,
- int is_watchpoint, unsigned int idx)
+aarch64_notify_debug_reg_change (ptid_t ptid, int is_watchpoint,
+ unsigned int idx)
{
for (thread_info *tp : current_inferior ()->non_exited_threads ())
{
@@ -303,7 +302,7 @@ aarch64_notify_debug_reg_change (ptid_t ptid,
void
aarch64_fbsd_nat_target::low_delete_thread (thread_info *tp)
{
- gdb_assert(tp->ptid.lwp_p ());
+ gdb_assert (tp->ptid.lwp_p ());
aarch64_debug_pending_threads.erase (tp->ptid.lwp ());
}
@@ -312,17 +311,17 @@ aarch64_fbsd_nat_target::low_delete_thread (thread_info *tp)
void
aarch64_fbsd_nat_target::low_prepare_to_resume (thread_info *tp)
{
- gdb_assert(tp->ptid.lwp_p ());
+ gdb_assert (tp->ptid.lwp_p ());
if (aarch64_debug_pending_threads.erase (tp->ptid.lwp ()) == 0)
return;
- struct aarch64_debug_reg_state *state =
- aarch64_lookup_debug_reg_state (tp->ptid.pid ());
- gdb_assert(state != nullptr);
+ struct aarch64_debug_reg_state *state
+ = aarch64_lookup_debug_reg_state (tp->ptid.pid ());
+ gdb_assert (state != nullptr);
struct dbreg reg;
- memset (&reg, 0, sizeof(reg));
+ memset (&reg, 0, sizeof (reg));
for (int i = 0; i < aarch64_num_bp_regs; i++)
{
reg.db_breakregs[i].dbr_addr = state->dr_addr_bp[i];
@@ -333,20 +332,21 @@ aarch64_fbsd_nat_target::low_prepare_to_resume (thread_info *tp)
reg.db_watchregs[i].dbw_addr = state->dr_addr_wp[i];
reg.db_watchregs[i].dbw_ctrl = state->dr_ctrl_wp[i];
}
- if (ptrace(PT_SETDBREGS, tp->ptid.lwp (), (PTRACE_TYPE_ARG3) &reg, 0) != 0)
- error (_("Failed to set hardware debug registers"));
+ if (ptrace (PT_SETDBREGS, tp->ptid.lwp (), (PTRACE_TYPE_ARG3) &reg, 0) != 0)
+ error (_ ("Failed to set hardware debug registers"));
}
#else
/* A stub that should never be called. */
void
-aarch64_notify_debug_reg_change (ptid_t ptid,
- int is_watchpoint, unsigned int idx)
+aarch64_notify_debug_reg_change (ptid_t ptid, int is_watchpoint,
+ unsigned int idx)
{
gdb_assert (true);
}
#endif
void _initialize_aarch64_fbsd_nat ();
+
void
_initialize_aarch64_fbsd_nat ()
{
diff --git a/gdb/aarch64-fbsd-tdep.c b/gdb/aarch64-fbsd-tdep.c
index 1102eb0d13b..311c456eaf1 100644
--- a/gdb/aarch64-fbsd-tdep.c
+++ b/gdb/aarch64-fbsd-tdep.c
@@ -32,31 +32,25 @@
/* Register maps. */
-static const struct regcache_map_entry aarch64_fbsd_gregmap[] =
- {
- { 30, AARCH64_X0_REGNUM, 8 }, /* x0 ... x29 */
- { 1, AARCH64_LR_REGNUM, 8 },
- { 1, AARCH64_SP_REGNUM, 8 },
- { 1, AARCH64_PC_REGNUM, 8 },
- { 1, AARCH64_CPSR_REGNUM, 4 },
- { 0 }
- };
-
-static const struct regcache_map_entry aarch64_fbsd_fpregmap[] =
- {
- { 32, AARCH64_V0_REGNUM, 16 }, /* v0 ... v31 */
- { 1, AARCH64_FPSR_REGNUM, 4 },
- { 1, AARCH64_FPCR_REGNUM, 4 },
- { 0 }
- };
+static const struct regcache_map_entry aarch64_fbsd_gregmap[]
+ = { { 30, AARCH64_X0_REGNUM, 8 }, /* x0 ... x29 */
+ { 1, AARCH64_LR_REGNUM, 8 },
+ { 1, AARCH64_SP_REGNUM, 8 },
+ { 1, AARCH64_PC_REGNUM, 8 },
+ { 1, AARCH64_CPSR_REGNUM, 4 },
+ { 0 } };
+
+static const struct regcache_map_entry aarch64_fbsd_fpregmap[]
+ = { { 32, AARCH64_V0_REGNUM, 16 }, /* v0 ... v31 */
+ { 1, AARCH64_FPSR_REGNUM, 4 },
+ { 1, AARCH64_FPCR_REGNUM, 4 },
+ { 0 } };
/* Register numbers are relative to tdep->tls_regnum_base. */
-static const struct regcache_map_entry aarch64_fbsd_tls_regmap[] =
- {
- { 1, 0, 8 }, /* tpidr */
- { 0 }
- };
+static const struct regcache_map_entry aarch64_fbsd_tls_regmap[]
+ = { { 1, 0, 8 }, /* tpidr */
+ { 0 } };
/* In a signal frame, sp points to a 'struct sigframe' which is
defined as:
@@ -78,75 +72,65 @@ static const struct regcache_map_entry aarch64_fbsd_tls_regmap[] =
by the floating point register set. The floating point register
set is only valid if the _MC_FP_VALID flag is set in mc_flags. */
-#define AARCH64_SIGFRAME_UCONTEXT_OFFSET 80
-#define AARCH64_UCONTEXT_MCONTEXT_OFFSET 16
-#define AARCH64_MCONTEXT_FPREGS_OFFSET 272
-#define AARCH64_MCONTEXT_FLAGS_OFFSET 800
-#define AARCH64_MCONTEXT_FLAG_FP_VALID 0x1
+#define AARCH64_SIGFRAME_UCONTEXT_OFFSET 80
+#define AARCH64_UCONTEXT_MCONTEXT_OFFSET 16
+#define AARCH64_MCONTEXT_FPREGS_OFFSET 272
+#define AARCH64_MCONTEXT_FLAGS_OFFSET 800
+#define AARCH64_MCONTEXT_FLAG_FP_VALID 0x1
/* Implement the "init" method of struct tramp_frame. */
static void
aarch64_fbsd_sigframe_init (const struct tramp_frame *self,
- frame_info_ptr this_frame,
- struct trad_frame_cache *this_cache,
- CORE_ADDR func)
+ frame_info_ptr this_frame,
+ struct trad_frame_cache *this_cache,
+ CORE_ADDR func)
{
struct gdbarch *gdbarch = get_frame_arch (this_frame);
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
CORE_ADDR sp = get_frame_register_unsigned (this_frame, AARCH64_SP_REGNUM);
- CORE_ADDR mcontext_addr
- = (sp
- + AARCH64_SIGFRAME_UCONTEXT_OFFSET
- + AARCH64_UCONTEXT_MCONTEXT_OFFSET);
+ CORE_ADDR mcontext_addr = (sp + AARCH64_SIGFRAME_UCONTEXT_OFFSET
+ + AARCH64_UCONTEXT_MCONTEXT_OFFSET);
gdb_byte buf[4];
trad_frame_set_reg_regmap (this_cache, aarch64_fbsd_gregmap, mcontext_addr,
regcache_map_entry_size (aarch64_fbsd_gregmap));
if (target_read_memory (mcontext_addr + AARCH64_MCONTEXT_FLAGS_OFFSET, buf,
- 4) == 0
+ 4)
+ == 0
&& (extract_unsigned_integer (buf, 4, byte_order)
& AARCH64_MCONTEXT_FLAG_FP_VALID))
- trad_frame_set_reg_regmap (this_cache, aarch64_fbsd_fpregmap,
- mcontext_addr + AARCH64_MCONTEXT_FPREGS_OFFSET,
- regcache_map_entry_size (aarch64_fbsd_fpregmap));
+ trad_frame_set_reg_regmap (
+ this_cache, aarch64_fbsd_fpregmap,
+ mcontext_addr + AARCH64_MCONTEXT_FPREGS_OFFSET,
+ regcache_map_entry_size (aarch64_fbsd_fpregmap));
trad_frame_set_id (this_cache, frame_id_build (sp, func));
}
-static const struct tramp_frame aarch64_fbsd_sigframe =
-{
- SIGTRAMP_FRAME,
- 4,
- {
- {0x910003e0, ULONGEST_MAX}, /* mov x0, sp */
- {0x91014000, ULONGEST_MAX}, /* add x0, x0, #SF_UC */
- {0xd2803428, ULONGEST_MAX}, /* mov x8, #SYS_sigreturn */
- {0xd4000001, ULONGEST_MAX}, /* svc 0x0 */
- {TRAMP_SENTINEL_INSN, ULONGEST_MAX}
- },
- aarch64_fbsd_sigframe_init
-};
+static const struct tramp_frame aarch64_fbsd_sigframe
+ = { SIGTRAMP_FRAME,
+ 4,
+ { { 0x910003e0, ULONGEST_MAX }, /* mov x0, sp */
+ { 0x91014000, ULONGEST_MAX }, /* add x0, x0, #SF_UC */
+ { 0xd2803428, ULONGEST_MAX }, /* mov x8, #SYS_sigreturn */
+ { 0xd4000001, ULONGEST_MAX }, /* svc 0x0 */
+ { TRAMP_SENTINEL_INSN, ULONGEST_MAX } },
+ aarch64_fbsd_sigframe_init };
/* Register set definitions. */
-const struct regset aarch64_fbsd_gregset =
- {
- aarch64_fbsd_gregmap,
- regcache_supply_regset, regcache_collect_regset
- };
+const struct regset aarch64_fbsd_gregset
+ = { aarch64_fbsd_gregmap, regcache_supply_regset, regcache_collect_regset };
-const struct regset aarch64_fbsd_fpregset =
- {
- aarch64_fbsd_fpregmap,
- regcache_supply_regset, regcache_collect_regset
- };
+const struct regset aarch64_fbsd_fpregset
+ = { aarch64_fbsd_fpregmap, regcache_supply_regset, regcache_collect_regset };
static void
aarch64_fbsd_supply_tls_regset (const struct regset *regset,
- struct regcache *regcache,
- int regnum, const void *buf, size_t size)
+ struct regcache *regcache, int regnum,
+ const void *buf, size_t size)
{
struct gdbarch *gdbarch = regcache->arch ();
aarch64_gdbarch_tdep *tdep = gdbarch_tdep<aarch64_gdbarch_tdep> (gdbarch);
@@ -156,8 +140,8 @@ aarch64_fbsd_supply_tls_regset (const struct regset *regset,
static void
aarch64_fbsd_collect_tls_regset (const struct regset *regset,
- const struct regcache *regcache,
- int regnum, void *buf, size_t size)
+ const struct regcache *regcache, int regnum,
+ void *buf, size_t size)
{
struct gdbarch *gdbarch = regcache->arch ();
aarch64_gdbarch_tdep *tdep = gdbarch_tdep<aarch64_gdbarch_tdep> (gdbarch);
@@ -165,11 +149,9 @@ aarch64_fbsd_collect_tls_regset (const struct regset *regset,
regcache->collect_regset (regset, tdep->tls_regnum_base, regnum, buf, size);
}
-const struct regset aarch64_fbsd_tls_regset =
- {
- aarch64_fbsd_tls_regmap,
- aarch64_fbsd_supply_tls_regset, aarch64_fbsd_collect_tls_regset
- };
+const struct regset aarch64_fbsd_tls_regset
+ = { aarch64_fbsd_tls_regmap, aarch64_fbsd_supply_tls_regset,
+ aarch64_fbsd_collect_tls_regset };
/* Implement the "iterate_over_regset_sections" gdbarch method. */
@@ -201,7 +183,7 @@ aarch64_fbsd_core_read_description (struct gdbarch *gdbarch,
asection *tls = bfd_get_section_by_name (abfd, ".reg-aarch-tls");
aarch64_features features;
- features.tls = tls != nullptr? 1 : 0;
+ features.tls = tls != nullptr ? 1 : 0;
return aarch64_read_description (features);
}
@@ -222,7 +204,7 @@ aarch64_fbsd_get_thread_local_address (struct gdbarch *gdbarch, ptid_t ptid,
ULONGEST tpidr;
if (regcache->cooked_read (tdep->tls_regnum_base, &tpidr) != REG_VALID)
- error (_("Unable to fetch %%tpidr"));
+ error (_ ("Unable to fetch %%tpidr"));
/* %tpidr points to the TCB whose first member is the dtv
pointer. */
@@ -248,8 +230,8 @@ aarch64_fbsd_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
/* Enable longjmp. */
tdep->jb_pc = 13;
- set_gdbarch_iterate_over_regset_sections
- (gdbarch, aarch64_fbsd_iterate_over_regset_sections);
+ set_gdbarch_iterate_over_regset_sections (
+ gdbarch, aarch64_fbsd_iterate_over_regset_sections);
set_gdbarch_core_read_description (gdbarch,
aarch64_fbsd_core_read_description);
@@ -257,12 +239,13 @@ aarch64_fbsd_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
{
set_gdbarch_fetch_tls_load_module_address (gdbarch,
svr4_fetch_objfile_link_map);
- set_gdbarch_get_thread_local_address
- (gdbarch, aarch64_fbsd_get_thread_local_address);
+ set_gdbarch_get_thread_local_address (
+ gdbarch, aarch64_fbsd_get_thread_local_address);
}
}
void _initialize_aarch64_fbsd_tdep ();
+
void
_initialize_aarch64_fbsd_tdep ()
{
diff --git a/gdb/aarch64-fbsd-tdep.h b/gdb/aarch64-fbsd-tdep.h
index 46c27cb41de..54b77fd90bd 100644
--- a/gdb/aarch64-fbsd-tdep.h
+++ b/gdb/aarch64-fbsd-tdep.h
@@ -25,7 +25,7 @@
/* The general-purpose regset consists of 30 X registers, plus LR, SP,
ELR, and SPSR registers. SPSR is 32 bits but the structure is
padded to 64 bit alignment. */
-#define AARCH64_FBSD_SIZEOF_GREGSET (34 * X_REGISTER_SIZE)
+#define AARCH64_FBSD_SIZEOF_GREGSET (34 * X_REGISTER_SIZE)
/* The fp regset consists of 32 V registers, plus FPSR and FPCR which
are 4 bytes wide each, and the whole structure is padded to 128 bit
@@ -33,7 +33,7 @@
#define AARCH64_FBSD_SIZEOF_FPREGSET (33 * V_REGISTER_SIZE)
/* The TLS regset consists of a single register. */
-#define AARCH64_FBSD_SIZEOF_TLSREGSET (X_REGISTER_SIZE)
+#define AARCH64_FBSD_SIZEOF_TLSREGSET (X_REGISTER_SIZE)
extern const struct regset aarch64_fbsd_gregset;
extern const struct regset aarch64_fbsd_fpregset;
diff --git a/gdb/aarch64-linux-nat.c b/gdb/aarch64-linux-nat.c
index e4158236db2..3279af5dc9a 100644
--- a/gdb/aarch64-linux-nat.c
+++ b/gdb/aarch64-linux-nat.c
@@ -64,6 +64,7 @@ class aarch64_linux_nat_target final
: public aarch64_nat_target<linux_nat_target>
{
public:
+
/* Add our register access methods. */
void fetch_registers (struct regcache *, int) override;
void store_registers (struct regcache *, int) override;
@@ -84,26 +85,34 @@ public:
/* These three defer to common nat/ code. */
void low_new_thread (struct lwp_info *lp) override
- { aarch64_linux_new_thread (lp); }
+ {
+ aarch64_linux_new_thread (lp);
+ }
+
void low_delete_thread (struct arch_lwp_info *lp) override
- { aarch64_linux_delete_thread (lp); }
+ {
+ aarch64_linux_delete_thread (lp);
+ }
+
void low_prepare_to_resume (struct lwp_info *lp) override
- { aarch64_linux_prepare_to_resume (lp); }
+ {
+ aarch64_linux_prepare_to_resume (lp);
+ }
void low_new_fork (struct lwp_info *parent, pid_t child_pid) override;
void low_forget_process (pid_t pid) override;
/* Add our siginfo layout converter. */
- bool low_siginfo_fixup (siginfo_t *ptrace, gdb_byte *inf, int direction)
- override;
+ bool low_siginfo_fixup (siginfo_t *ptrace, gdb_byte *inf,
+ int direction) override;
struct gdbarch *thread_architecture (ptid_t) override;
bool supports_memory_tagging () override;
/* Read memory allocation tags from memory via PTRACE. */
- bool fetch_memtags (CORE_ADDR address, size_t len,
- gdb::byte_vector &tags, int type) override;
+ bool fetch_memtags (CORE_ADDR address, size_t len, gdb::byte_vector &tags,
+ int type) override;
/* Write allocation tags to memory via PTRACE. */
bool store_memtags (CORE_ADDR address, size_t len,
@@ -146,7 +155,7 @@ fetch_gregs_from_thread (struct regcache *regcache)
ret = ptrace (PTRACE_GETREGSET, tid, NT_PRSTATUS, &iovec);
if (ret < 0)
- perror_with_name (_("Unable to fetch general registers"));
+ perror_with_name (_ ("Unable to fetch general registers"));
if (gdbarch_bfd_arch_info (gdbarch)->bits_per_word == 32)
aarch32_gp_regcache_supply (regcache, (uint32_t *) regs, 1);
@@ -183,7 +192,7 @@ store_gregs_to_thread (const struct regcache *regcache)
ret = ptrace (PTRACE_GETREGSET, tid, NT_PRSTATUS, &iovec);
if (ret < 0)
- perror_with_name (_("Unable to fetch general registers"));
+ perror_with_name (_ ("Unable to fetch general registers"));
if (gdbarch_bfd_arch_info (gdbarch)->bits_per_word == 32)
aarch32_gp_regcache_collect (regcache, (uint32_t *) regs, 1);
@@ -198,7 +207,7 @@ store_gregs_to_thread (const struct regcache *regcache)
ret = ptrace (PTRACE_SETREGSET, tid, NT_PRSTATUS, &iovec);
if (ret < 0)
- perror_with_name (_("Unable to store general registers"));
+ perror_with_name (_ ("Unable to store general registers"));
}
/* Fill GDB's register array with the fp/simd register values
@@ -226,7 +235,7 @@ fetch_fpregs_from_thread (struct regcache *regcache)
ret = ptrace (PTRACE_GETREGSET, tid, NT_ARM_VFP, &iovec);
if (ret < 0)
- perror_with_name (_("Unable to fetch VFP registers"));
+ perror_with_name (_ ("Unable to fetch VFP registers"));
aarch32_vfp_regcache_supply (regcache, (gdb_byte *) &regs, 32);
}
@@ -238,7 +247,7 @@ fetch_fpregs_from_thread (struct regcache *regcache)
ret = ptrace (PTRACE_GETREGSET, tid, NT_FPREGSET, &iovec);
if (ret < 0)
- perror_with_name (_("Unable to fetch vFP/SIMD registers"));
+ perror_with_name (_ ("Unable to fetch vFP/SIMD registers"));
for (regno = AARCH64_V0_REGNUM; regno <= AARCH64_V31_REGNUM; regno++)
regcache->raw_supply (regno, &regs.vregs[regno - AARCH64_V0_REGNUM]);
@@ -272,7 +281,7 @@ store_fpregs_to_thread (const struct regcache *regcache)
ret = ptrace (PTRACE_GETREGSET, tid, NT_ARM_VFP, &iovec);
if (ret < 0)
- perror_with_name (_("Unable to fetch VFP registers"));
+ perror_with_name (_ ("Unable to fetch VFP registers"));
aarch32_vfp_regcache_collect (regcache, (gdb_byte *) &regs, 32);
}
@@ -284,12 +293,12 @@ store_fpregs_to_thread (const struct regcache *regcache)
ret = ptrace (PTRACE_GETREGSET, tid, NT_FPREGSET, &iovec);
if (ret < 0)
- perror_with_name (_("Unable to fetch FP/SIMD registers"));
+ perror_with_name (_ ("Unable to fetch FP/SIMD registers"));
for (regno = AARCH64_V0_REGNUM; regno <= AARCH64_V31_REGNUM; regno++)
if (REG_VALID == regcache->get_register_status (regno))
- regcache->raw_collect
- (regno, (char *) &regs.vregs[regno - AARCH64_V0_REGNUM]);
+ regcache->raw_collect (
+ regno, (char *) &regs.vregs[regno - AARCH64_V0_REGNUM]);
if (REG_VALID == regcache->get_register_status (AARCH64_FPSR_REGNUM))
regcache->raw_collect (AARCH64_FPSR_REGNUM, (char *) &regs.fpsr);
@@ -301,13 +310,13 @@ store_fpregs_to_thread (const struct regcache *regcache)
{
ret = ptrace (PTRACE_SETREGSET, tid, NT_ARM_VFP, &iovec);
if (ret < 0)
- perror_with_name (_("Unable to store VFP registers"));
+ perror_with_name (_ ("Unable to store VFP registers"));
}
else
{
ret = ptrace (PTRACE_SETREGSET, tid, NT_FPREGSET, &iovec);
if (ret < 0)
- perror_with_name (_("Unable to store FP/SIMD registers"));
+ perror_with_name (_ ("Unable to store FP/SIMD registers"));
}
}
@@ -335,7 +344,7 @@ store_sveregs_to_thread (struct regcache *regcache)
/* First store vector length to the thread. This is done first to ensure the
ptrace buffers read from the kernel are the correct size. */
if (!aarch64_sve_set_vq (tid, regcache))
- perror_with_name (_("Unable to set VG register"));
+ perror_with_name (_ ("Unable to set VG register"));
/* Obtain a dump of SVE registers from ptrace. */
std::unique_ptr<gdb_byte[]> base = aarch64_sve_get_sveregs (tid);
@@ -349,7 +358,7 @@ store_sveregs_to_thread (struct regcache *regcache)
ret = ptrace (PTRACE_SETREGSET, tid, NT_ARM_SVE, &iovec);
if (ret < 0)
- perror_with_name (_("Unable to store sve registers"));
+ perror_with_name (_ ("Unable to store sve registers"));
}
/* Fill GDB's register array with the pointer authentication mask values from
@@ -362,7 +371,7 @@ fetch_pauth_masks_from_thread (struct regcache *regcache)
= gdbarch_tdep<aarch64_gdbarch_tdep> (regcache->arch ());
int ret;
struct iovec iovec;
- uint64_t pauth_regset[2] = {0, 0};
+ uint64_t pauth_regset[2] = { 0, 0 };
int tid = regcache->ptid ().lwp ();
iovec.iov_base = &pauth_regset;
@@ -370,7 +379,7 @@ fetch_pauth_masks_from_thread (struct regcache *regcache)
ret = ptrace (PTRACE_GETREGSET, tid, NT_ARM_PAC_MASK, &iovec);
if (ret != 0)
- perror_with_name (_("unable to fetch pauth registers"));
+ perror_with_name (_ ("unable to fetch pauth registers"));
regcache->raw_supply (AARCH64_PAUTH_DMASK_REGNUM (tdep->pauth_reg_base),
&pauth_regset[0]);
@@ -398,7 +407,7 @@ fetch_mteregs_from_thread (struct regcache *regcache)
int tid = get_ptrace_pid (regcache->ptid ());
if (ptrace (PTRACE_GETREGSET, tid, NT_ARM_TAGGED_ADDR_CTRL, &iovec) != 0)
- perror_with_name (_("unable to fetch MTE registers"));
+ perror_with_name (_ ("unable to fetch MTE registers"));
regcache->raw_supply (regno, &tag_ctl);
}
@@ -429,7 +438,7 @@ store_mteregs_to_thread (struct regcache *regcache)
int tid = get_ptrace_pid (regcache->ptid ());
if (ptrace (PTRACE_SETREGSET, tid, NT_ARM_TAGGED_ADDR_CTRL, &iovec) != 0)
- perror_with_name (_("unable to store MTE registers"));
+ perror_with_name (_ ("unable to store MTE registers"));
}
/* Fill GDB's register array with the TLS register values from
@@ -452,7 +461,7 @@ fetch_tlsregs_from_thread (struct regcache *regcache)
int tid = get_ptrace_pid (regcache->ptid ());
if (ptrace (PTRACE_GETREGSET, tid, NT_ARM_TLS, &iovec) != 0)
- perror_with_name (_("unable to fetch TLS registers"));
+ perror_with_name (_ ("unable to fetch TLS registers"));
for (int i = 0; i < tdep->tls_register_count; i++)
regcache->raw_supply (regno + i, &tpidrs[i]);
@@ -487,7 +496,7 @@ store_tlsregs_to_thread (struct regcache *regcache)
int tid = get_ptrace_pid (regcache->ptid ());
if (ptrace (PTRACE_SETREGSET, tid, NT_ARM_TLS, &iovec) != 0)
- perror_with_name (_("unable to store TLS register"));
+ perror_with_name (_ ("unable to store TLS register"));
}
/* The AArch64 version of the "fetch_registers" target_ops method. Fetch
@@ -531,12 +540,10 @@ aarch64_fetch_registers (struct regcache *regcache, int regno)
}
/* Fetch individual MTE registers. */
- if (tdep->has_mte ()
- && (regno == tdep->mte_reg_base))
+ if (tdep->has_mte () && (regno == tdep->mte_reg_base))
fetch_mteregs_from_thread (regcache);
- if (tdep->has_tls ()
- && regno >= tdep->tls_regnum_base
+ if (tdep->has_tls () && regno >= tdep->tls_regnum_base
&& regno < tdep->tls_regnum_base + tdep->tls_register_count)
fetch_tlsregs_from_thread (regcache);
}
@@ -548,8 +555,7 @@ aarch64_fetch_registers (struct regcache *regcache, int regno)
static void
aarch32_fetch_registers (struct regcache *regcache, int regno)
{
- arm_gdbarch_tdep *tdep
- = gdbarch_tdep<arm_gdbarch_tdep> (regcache->arch ());
+ arm_gdbarch_tdep *tdep = gdbarch_tdep<arm_gdbarch_tdep> (regcache->arch ());
if (regno == -1)
{
@@ -559,8 +565,7 @@ aarch32_fetch_registers (struct regcache *regcache, int regno)
}
else if (regno < ARM_F0_REGNUM || regno == ARM_PS_REGNUM)
fetch_gregs_from_thread (regcache);
- else if (tdep->vfp_register_count > 0
- && regno >= ARM_D0_REGNUM
+ else if (tdep->vfp_register_count > 0 && regno >= ARM_D0_REGNUM
&& (regno < ARM_D0_REGNUM + tdep->vfp_register_count
|| regno == ARM_FPSCR_REGNUM))
fetch_fpregs_from_thread (regcache);
@@ -609,12 +614,10 @@ aarch64_store_registers (struct regcache *regcache, int regno)
store_fpregs_to_thread (regcache);
/* Store MTE registers. */
- if (tdep->has_mte ()
- && (regno == tdep->mte_reg_base))
+ if (tdep->has_mte () && (regno == tdep->mte_reg_base))
store_mteregs_to_thread (regcache);
- if (tdep->has_tls ()
- && regno >= tdep->tls_regnum_base
+ if (tdep->has_tls () && regno >= tdep->tls_regnum_base
&& regno < tdep->tls_regnum_base + tdep->tls_register_count)
store_tlsregs_to_thread (regcache);
}
@@ -626,8 +629,7 @@ aarch64_store_registers (struct regcache *regcache, int regno)
static void
aarch32_store_registers (struct regcache *regcache, int regno)
{
- arm_gdbarch_tdep *tdep
- = gdbarch_tdep<arm_gdbarch_tdep> (regcache->arch ());
+ arm_gdbarch_tdep *tdep = gdbarch_tdep<arm_gdbarch_tdep> (regcache->arch ());
if (regno == -1)
{
@@ -637,8 +639,7 @@ aarch32_store_registers (struct regcache *regcache, int regno)
}
else if (regno < ARM_F0_REGNUM || regno == ARM_PS_REGNUM)
store_gregs_to_thread (regcache);
- else if (tdep->vfp_register_count > 0
- && regno >= ARM_D0_REGNUM
+ else if (tdep->vfp_register_count > 0 && regno >= ARM_D0_REGNUM
&& (regno < ARM_D0_REGNUM + tdep->vfp_register_count
|| regno == ARM_FPSCR_REGNUM))
store_fpregs_to_thread (regcache);
@@ -661,11 +662,11 @@ aarch64_linux_nat_target::store_registers (struct regcache *regcache,
do this for all registers. */
void
-fill_gregset (const struct regcache *regcache,
- gdb_gregset_t *gregsetp, int regno)
+fill_gregset (const struct regcache *regcache, gdb_gregset_t *gregsetp,
+ int regno)
{
- regcache_collect_regset (&aarch64_linux_gregset, regcache,
- regno, (gdb_byte *) gregsetp,
+ regcache_collect_regset (&aarch64_linux_gregset, regcache, regno,
+ (gdb_byte *) gregsetp,
AARCH64_LINUX_SIZEOF_GREGSET);
}
@@ -685,11 +686,11 @@ supply_gregset (struct regcache *regcache, const gdb_gregset_t *gregsetp)
do this for all registers. */
void
-fill_fpregset (const struct regcache *regcache,
- gdb_fpregset_t *fpregsetp, int regno)
+fill_fpregset (const struct regcache *regcache, gdb_fpregset_t *fpregsetp,
+ int regno)
{
- regcache_collect_regset (&aarch64_linux_fpregset, regcache,
- regno, (gdb_byte *) fpregsetp,
+ regcache_collect_regset (&aarch64_linux_fpregset, regcache, regno,
+ (gdb_byte *) fpregsetp,
AARCH64_LINUX_SIZEOF_FPREGSET);
}
@@ -730,21 +731,19 @@ aarch64_linux_nat_target::low_new_fork (struct lwp_info *parent,
child_state = aarch64_get_debug_reg_state (child_pid);
*child_state = *parent_state;
}
-
/* Called by libthread_db. Returns a pointer to the thread local
storage (or its descriptor). */
ps_err_e
-ps_get_thread_area (struct ps_prochandle *ph,
- lwpid_t lwpid, int idx, void **base)
+ps_get_thread_area (struct ps_prochandle *ph, lwpid_t lwpid, int idx,
+ void **base)
{
int is_64bit_p
= (gdbarch_bfd_arch_info (target_gdbarch ())->bits_per_word == 64);
return aarch64_ps_get_thread_area (ph, lwpid, idx, base, is_64bit_p);
}
-
/* Implement the virtual inf_ptrace_target::post_startup_inferior method. */
@@ -842,8 +841,7 @@ aarch64_linux_nat_target::stopped_data_address (CORE_ADDR *addr_p)
return false;
/* This must be a hardware breakpoint. */
- if (siginfo.si_signo != SIGTRAP
- || (siginfo.si_code & 0xffff) != TRAP_HWBKPT)
+ if (siginfo.si_signo != SIGTRAP || (siginfo.si_code & 0xffff) != TRAP_HWBKPT)
return false;
/* Make sure to ignore the top byte, otherwise we may not recognize a
@@ -948,7 +946,8 @@ aarch64_linux_nat_target::fetch_memtags (CORE_ADDR address, size_t len,
bool
aarch64_linux_nat_target::store_memtags (CORE_ADDR address, size_t len,
- const gdb::byte_vector &tags, int type)
+ const gdb::byte_vector &tags,
+ int type)
{
int tid = get_ptrace_pid (inferior_ptid);
@@ -960,6 +959,7 @@ aarch64_linux_nat_target::store_memtags (CORE_ADDR address, size_t len,
}
void _initialize_aarch64_linux_nat ();
+
void
_initialize_aarch64_linux_nat ()
{
diff --git a/gdb/aarch64-linux-tdep.c b/gdb/aarch64-linux-tdep.c
index 20a041c599e..b1d80895bea 100644
--- a/gdb/aarch64-linux-tdep.c
+++ b/gdb/aarch64-linux-tdep.c
@@ -140,38 +140,37 @@
/* These magic numbers need to reflect the layout of the kernel
defined struct rt_sigframe and ucontext. */
-#define AARCH64_SIGCONTEXT_REG_SIZE 8
-#define AARCH64_RT_SIGFRAME_UCONTEXT_OFFSET 128
-#define AARCH64_UCONTEXT_SIGCONTEXT_OFFSET 176
-#define AARCH64_SIGCONTEXT_XO_OFFSET 8
-#define AARCH64_SIGCONTEXT_RESERVED_OFFSET 288
+#define AARCH64_SIGCONTEXT_REG_SIZE 8
+#define AARCH64_RT_SIGFRAME_UCONTEXT_OFFSET 128
+#define AARCH64_UCONTEXT_SIGCONTEXT_OFFSET 176
+#define AARCH64_SIGCONTEXT_XO_OFFSET 8
+#define AARCH64_SIGCONTEXT_RESERVED_OFFSET 288
-#define AARCH64_SIGCONTEXT_RESERVED_SIZE 4096
+#define AARCH64_SIGCONTEXT_RESERVED_SIZE 4096
/* Unique identifiers that may be used for aarch64_ctx.magic. */
-#define AARCH64_EXTRA_MAGIC 0x45585401
-#define AARCH64_FPSIMD_MAGIC 0x46508001
-#define AARCH64_SVE_MAGIC 0x53564501
+#define AARCH64_EXTRA_MAGIC 0x45585401
+#define AARCH64_FPSIMD_MAGIC 0x46508001
+#define AARCH64_SVE_MAGIC 0x53564501
/* Defines for the extra_context that follows an AARCH64_EXTRA_MAGIC. */
-#define AARCH64_EXTRA_DATAP_OFFSET 8
+#define AARCH64_EXTRA_DATAP_OFFSET 8
/* Defines for the fpsimd that follows an AARCH64_FPSIMD_MAGIC. */
-#define AARCH64_FPSIMD_FPSR_OFFSET 8
-#define AARCH64_FPSIMD_FPCR_OFFSET 12
-#define AARCH64_FPSIMD_V0_OFFSET 16
-#define AARCH64_FPSIMD_VREG_SIZE 16
+#define AARCH64_FPSIMD_FPSR_OFFSET 8
+#define AARCH64_FPSIMD_FPCR_OFFSET 12
+#define AARCH64_FPSIMD_V0_OFFSET 16
+#define AARCH64_FPSIMD_VREG_SIZE 16
/* Defines for the sve structure that follows an AARCH64_SVE_MAGIC. */
-#define AARCH64_SVE_CONTEXT_VL_OFFSET 8
-#define AARCH64_SVE_CONTEXT_REGS_OFFSET 16
+#define AARCH64_SVE_CONTEXT_VL_OFFSET 8
+#define AARCH64_SVE_CONTEXT_REGS_OFFSET 16
#define AARCH64_SVE_CONTEXT_P_REGS_OFFSET(vq) (32 * vq * 16)
#define AARCH64_SVE_CONTEXT_FFR_OFFSET(vq) \
(AARCH64_SVE_CONTEXT_P_REGS_OFFSET (vq) + (16 * vq * 2))
#define AARCH64_SVE_CONTEXT_SIZE(vq) \
(AARCH64_SVE_CONTEXT_FFR_OFFSET (vq) + (vq * 2))
-
/* Read an aarch64_ctx, returning the magic value, and setting *SIZE to the
size, or return 0 on error. */
@@ -221,41 +220,46 @@ aarch64_linux_restore_vreg (struct trad_frame_cache *cache, int num_regs,
if (target_read_memory (offset, buf, V_REGISTER_SIZE) != 0)
{
- size_t size = V_REGISTER_SIZE/2;
+ size_t size = V_REGISTER_SIZE / 2;
/* Read the two halves of the V register in reverse byte order. */
- CORE_ADDR u64 = extract_unsigned_integer (buf, size,
- byte_order);
- CORE_ADDR l64 = extract_unsigned_integer (buf + size, size,
- byte_order);
+ CORE_ADDR u64 = extract_unsigned_integer (buf, size, byte_order);
+ CORE_ADDR l64
+ = extract_unsigned_integer (buf + size, size, byte_order);
/* Copy the reversed bytes to the buffer. */
store_unsigned_integer (buf, size, BFD_ENDIAN_LITTLE, l64);
- store_unsigned_integer (buf + size , size, BFD_ENDIAN_LITTLE, u64);
+ store_unsigned_integer (buf + size, size, BFD_ENDIAN_LITTLE, u64);
/* Now we can store the correct bytes for the V register. */
trad_frame_set_reg_value_bytes (cache, AARCH64_V0_REGNUM + vreg_num,
- {buf, V_REGISTER_SIZE});
+ { buf, V_REGISTER_SIZE });
trad_frame_set_reg_value_bytes (cache,
num_regs + AARCH64_Q0_REGNUM
- + vreg_num, {buf, Q_REGISTER_SIZE});
+ + vreg_num,
+ { buf, Q_REGISTER_SIZE });
trad_frame_set_reg_value_bytes (cache,
num_regs + AARCH64_D0_REGNUM
- + vreg_num, {buf, D_REGISTER_SIZE});
+ + vreg_num,
+ { buf, D_REGISTER_SIZE });
trad_frame_set_reg_value_bytes (cache,
num_regs + AARCH64_S0_REGNUM
- + vreg_num, {buf, S_REGISTER_SIZE});
+ + vreg_num,
+ { buf, S_REGISTER_SIZE });
trad_frame_set_reg_value_bytes (cache,
num_regs + AARCH64_H0_REGNUM
- + vreg_num, {buf, H_REGISTER_SIZE});
+ + vreg_num,
+ { buf, H_REGISTER_SIZE });
trad_frame_set_reg_value_bytes (cache,
num_regs + AARCH64_B0_REGNUM
- + vreg_num, {buf, B_REGISTER_SIZE});
+ + vreg_num,
+ { buf, B_REGISTER_SIZE });
if (has_sve)
trad_frame_set_reg_value_bytes (cache,
num_regs + AARCH64_SVE_V0_REGNUM
- + vreg_num, {buf, V_REGISTER_SIZE});
+ + vreg_num,
+ { buf, V_REGISTER_SIZE });
}
return;
}
@@ -275,9 +279,9 @@ aarch64_linux_restore_vreg (struct trad_frame_cache *cache, int num_regs,
offset);
if (has_sve)
- trad_frame_set_reg_addr (cache, num_regs + AARCH64_SVE_V0_REGNUM
- + vreg_num, offset);
-
+ trad_frame_set_reg_addr (cache,
+ num_regs + AARCH64_SVE_V0_REGNUM + vreg_num,
+ offset);
}
/* Implement the "init" method of struct tramp_frame. */
@@ -293,7 +297,7 @@ aarch64_linux_sigframe_init (const struct tramp_frame *self,
aarch64_gdbarch_tdep *tdep = gdbarch_tdep<aarch64_gdbarch_tdep> (gdbarch);
CORE_ADDR sp = get_frame_register_unsigned (this_frame, AARCH64_SP_REGNUM);
CORE_ADDR sigcontext_addr = (sp + AARCH64_RT_SIGFRAME_UCONTEXT_OFFSET
- + AARCH64_UCONTEXT_SIGCONTEXT_OFFSET );
+ + AARCH64_UCONTEXT_SIGCONTEXT_OFFSET);
CORE_ADDR section = sigcontext_addr + AARCH64_SIGCONTEXT_RESERVED_OFFSET;
CORE_ADDR section_end = section + AARCH64_SIGCONTEXT_RESERVED_SIZE;
CORE_ADDR fpsimd = 0;
@@ -306,8 +310,7 @@ aarch64_linux_sigframe_init (const struct tramp_frame *self,
for (int i = 0; i < 31; i++)
{
- trad_frame_set_reg_addr (this_cache,
- AARCH64_X0_REGNUM + i,
+ trad_frame_set_reg_addr (this_cache, AARCH64_X0_REGNUM + i,
sigcontext_addr + AARCH64_SIGCONTEXT_XO_OFFSET
+ i * AARCH64_SIGCONTEXT_REG_SIZE);
}
@@ -340,15 +343,17 @@ aarch64_linux_sigframe_init (const struct tramp_frame *self,
break;
if (target_read_memory (section + AARCH64_SVE_CONTEXT_VL_OFFSET,
- buf, 2) != 0)
+ buf, 2)
+ != 0)
{
section += size;
break;
}
- vq = sve_vq_from_vl (extract_unsigned_integer (buf, 2, byte_order));
+ vq
+ = sve_vq_from_vl (extract_unsigned_integer (buf, 2, byte_order));
if (vq != tdep->vq)
- error (_("Invalid vector length in signal frame %d vs %s."), vq,
+ error (_ ("Invalid vector length in signal frame %d vs %s."), vq,
pulongest (tdep->vq));
if (size >= AARCH64_SVE_CONTEXT_SIZE (vq))
@@ -366,8 +371,9 @@ aarch64_linux_sigframe_init (const struct tramp_frame *self,
structures. */
gdb_byte buf[8];
- if (target_read_memory (section + AARCH64_EXTRA_DATAP_OFFSET,
- buf, 8) != 0)
+ if (target_read_memory (section + AARCH64_EXTRA_DATAP_OFFSET, buf,
+ 8)
+ != 0)
{
section += size;
break;
@@ -402,16 +408,16 @@ aarch64_linux_sigframe_init (const struct tramp_frame *self,
trad_frame_set_reg_addr (this_cache,
num_regs + AARCH64_SVE_V0_REGNUM + i,
offset);
- trad_frame_set_reg_addr (this_cache, num_regs + AARCH64_Q0_REGNUM + i,
- offset);
- trad_frame_set_reg_addr (this_cache, num_regs + AARCH64_D0_REGNUM + i,
- offset);
- trad_frame_set_reg_addr (this_cache, num_regs + AARCH64_S0_REGNUM + i,
- offset);
- trad_frame_set_reg_addr (this_cache, num_regs + AARCH64_H0_REGNUM + i,
- offset);
- trad_frame_set_reg_addr (this_cache, num_regs + AARCH64_B0_REGNUM + i,
- offset);
+ trad_frame_set_reg_addr (this_cache,
+ num_regs + AARCH64_Q0_REGNUM + i, offset);
+ trad_frame_set_reg_addr (this_cache,
+ num_regs + AARCH64_D0_REGNUM + i, offset);
+ trad_frame_set_reg_addr (this_cache,
+ num_regs + AARCH64_S0_REGNUM + i, offset);
+ trad_frame_set_reg_addr (this_cache,
+ num_regs + AARCH64_H0_REGNUM + i, offset);
+ trad_frame_set_reg_addr (this_cache,
+ num_regs + AARCH64_B0_REGNUM + i, offset);
}
offset = sve_regs + AARCH64_SVE_CONTEXT_P_REGS_OFFSET (tdep->vq);
@@ -447,80 +453,66 @@ aarch64_linux_sigframe_init (const struct tramp_frame *self,
trad_frame_set_id (this_cache, frame_id_build (sp, func));
}
-static const struct tramp_frame aarch64_linux_rt_sigframe =
-{
- SIGTRAMP_FRAME,
- 4,
- {
- /* movz x8, 0x8b (S=1,o=10,h=0,i=0x8b,r=8)
+static const struct tramp_frame aarch64_linux_rt_sigframe
+ = { SIGTRAMP_FRAME,
+ 4,
+ { /* movz x8, 0x8b (S=1,o=10,h=0,i=0x8b,r=8)
Soo1 0010 1hhi iiii iiii iiii iiir rrrr */
- {0xd2801168, ULONGEST_MAX},
+ { 0xd2801168, ULONGEST_MAX },
- /* svc 0x0 (o=0, l=1)
+ /* svc 0x0 (o=0, l=1)
1101 0100 oooi iiii iiii iiii iii0 00ll */
- {0xd4000001, ULONGEST_MAX},
- {TRAMP_SENTINEL_INSN, ULONGEST_MAX}
- },
- aarch64_linux_sigframe_init
-};
+ { 0xd4000001, ULONGEST_MAX },
+ { TRAMP_SENTINEL_INSN, ULONGEST_MAX } },
+ aarch64_linux_sigframe_init };
/* Register maps. */
-static const struct regcache_map_entry aarch64_linux_gregmap[] =
- {
- { 31, AARCH64_X0_REGNUM, 8 }, /* x0 ... x30 */
- { 1, AARCH64_SP_REGNUM, 8 },
- { 1, AARCH64_PC_REGNUM, 8 },
- { 1, AARCH64_CPSR_REGNUM, 8 },
- { 0 }
- };
+static const struct regcache_map_entry aarch64_linux_gregmap[]
+ = { { 31, AARCH64_X0_REGNUM, 8 }, /* x0 ... x30 */
+ { 1, AARCH64_SP_REGNUM, 8 },
+ { 1, AARCH64_PC_REGNUM, 8 },
+ { 1, AARCH64_CPSR_REGNUM, 8 },
+ { 0 } };
-static const struct regcache_map_entry aarch64_linux_fpregmap[] =
- {
- { 32, AARCH64_V0_REGNUM, 16 }, /* v0 ... v31 */
- { 1, AARCH64_FPSR_REGNUM, 4 },
- { 1, AARCH64_FPCR_REGNUM, 4 },
- { 0 }
- };
+static const struct regcache_map_entry aarch64_linux_fpregmap[]
+ = { { 32, AARCH64_V0_REGNUM, 16 }, /* v0 ... v31 */
+ { 1, AARCH64_FPSR_REGNUM, 4 },
+ { 1, AARCH64_FPCR_REGNUM, 4 },
+ { 0 } };
/* Register set definitions. */
-const struct regset aarch64_linux_gregset =
- {
- aarch64_linux_gregmap,
- regcache_supply_regset, regcache_collect_regset
- };
+const struct regset aarch64_linux_gregset
+ = { aarch64_linux_gregmap, regcache_supply_regset, regcache_collect_regset };
-const struct regset aarch64_linux_fpregset =
- {
- aarch64_linux_fpregmap,
- regcache_supply_regset, regcache_collect_regset
- };
+const struct regset aarch64_linux_fpregset
+ = { aarch64_linux_fpregmap, regcache_supply_regset,
+ regcache_collect_regset };
/* The fields in an SVE header at the start of a SVE regset. */
-#define SVE_HEADER_SIZE_LENGTH 4
-#define SVE_HEADER_MAX_SIZE_LENGTH 4
-#define SVE_HEADER_VL_LENGTH 2
-#define SVE_HEADER_MAX_VL_LENGTH 2
-#define SVE_HEADER_FLAGS_LENGTH 2
-#define SVE_HEADER_RESERVED_LENGTH 2
+#define SVE_HEADER_SIZE_LENGTH 4
+#define SVE_HEADER_MAX_SIZE_LENGTH 4
+#define SVE_HEADER_VL_LENGTH 2
+#define SVE_HEADER_MAX_VL_LENGTH 2
+#define SVE_HEADER_FLAGS_LENGTH 2
+#define SVE_HEADER_RESERVED_LENGTH 2
-#define SVE_HEADER_SIZE_OFFSET 0
-#define SVE_HEADER_MAX_SIZE_OFFSET \
+#define SVE_HEADER_SIZE_OFFSET 0
+#define SVE_HEADER_MAX_SIZE_OFFSET \
(SVE_HEADER_SIZE_OFFSET + SVE_HEADER_SIZE_LENGTH)
-#define SVE_HEADER_VL_OFFSET \
+#define SVE_HEADER_VL_OFFSET \
(SVE_HEADER_MAX_SIZE_OFFSET + SVE_HEADER_MAX_SIZE_LENGTH)
-#define SVE_HEADER_MAX_VL_OFFSET \
- (SVE_HEADER_VL_OFFSET + SVE_HEADER_VL_LENGTH)
-#define SVE_HEADER_FLAGS_OFFSET \
+#define SVE_HEADER_MAX_VL_OFFSET (SVE_HEADER_VL_OFFSET + SVE_HEADER_VL_LENGTH)
+#define SVE_HEADER_FLAGS_OFFSET \
(SVE_HEADER_MAX_VL_OFFSET + SVE_HEADER_MAX_VL_LENGTH)
-#define SVE_HEADER_RESERVED_OFFSET \
+#define SVE_HEADER_RESERVED_OFFSET \
(SVE_HEADER_FLAGS_OFFSET + SVE_HEADER_FLAGS_LENGTH)
-#define SVE_HEADER_SIZE \
+#define SVE_HEADER_SIZE \
(SVE_HEADER_RESERVED_OFFSET + SVE_HEADER_RESERVED_LENGTH)
-#define SVE_HEADER_FLAG_SVE 1
+#define SVE_HEADER_FLAG_SVE 1
/* Get VQ value from SVE section in the core dump. */
@@ -542,14 +534,15 @@ aarch64_linux_core_read_vq (struct gdbarch *gdbarch, bfd *abfd)
/* Check extended state size. */
if (size < SVE_HEADER_SIZE)
{
- warning (_("'.reg-aarch-sve' section in core file too small."));
+ warning (_ ("'.reg-aarch-sve' section in core file too small."));
return 0;
}
- if (!bfd_get_section_contents (abfd, sve_section, header, 0, SVE_HEADER_SIZE))
+ if (!bfd_get_section_contents (abfd, sve_section, header, 0,
+ SVE_HEADER_SIZE))
{
- warning (_("Couldn't read sve header from "
- "'.reg-aarch-sve' section in core file."));
+ warning (_ ("Couldn't read sve header from "
+ "'.reg-aarch-sve' section in core file."));
return 0;
}
@@ -559,13 +552,15 @@ aarch64_linux_core_read_vq (struct gdbarch *gdbarch, bfd *abfd)
if (vq > AARCH64_MAX_SVE_VQ)
{
- warning (_("SVE Vector length in core file not supported by this version"
- " of GDB. (VQ=%s)"), pulongest (vq));
+ warning (
+ _ ("SVE Vector length in core file not supported by this version"
+ " of GDB. (VQ=%s)"),
+ pulongest (vq));
return 0;
}
else if (vq == 0)
{
- warning (_("SVE Vector length in core file is invalid. (VQ=%s"),
+ warning (_ ("SVE Vector length in core file is invalid. (VQ=%s"),
pulongest (vq));
return 0;
}
@@ -579,8 +574,8 @@ aarch64_linux_core_read_vq (struct gdbarch *gdbarch, bfd *abfd)
static void
aarch64_linux_supply_sve_regset (const struct regset *regset,
- struct regcache *regcache,
- int regnum, const void *buf, size_t size)
+ struct regcache *regcache, int regnum,
+ const void *buf, size_t size)
{
gdb_byte *header = (gdb_byte *) buf;
struct gdbarch *gdbarch = regcache->arch ();
@@ -596,14 +591,14 @@ aarch64_linux_supply_sve_regset (const struct regset *regset,
/* Extract required fields from the header. */
ULONGEST vl = extract_unsigned_integer (header + SVE_HEADER_VL_OFFSET,
SVE_HEADER_VL_LENGTH, byte_order);
- uint16_t flags = extract_unsigned_integer (header + SVE_HEADER_FLAGS_OFFSET,
- SVE_HEADER_FLAGS_LENGTH,
- byte_order);
+ uint16_t flags
+ = extract_unsigned_integer (header + SVE_HEADER_FLAGS_OFFSET,
+ SVE_HEADER_FLAGS_LENGTH, byte_order);
if (regnum == -1 || regnum == AARCH64_SVE_VG_REGNUM)
{
gdb_byte vg_target[8];
- store_integer ((gdb_byte *)&vg_target, sizeof (uint64_t), byte_order,
+ store_integer ((gdb_byte *) &vg_target, sizeof (uint64_t), byte_order,
sve_vg_from_vl (vl));
regcache->raw_supply (AARCH64_SVE_VG_REGNUM, &vg_target);
}
@@ -638,8 +633,8 @@ aarch64_linux_supply_sve_regset (const struct regset *regset,
static void
aarch64_linux_collect_sve_regset (const struct regset *regset,
- const struct regcache *regcache,
- int regnum, void *buf, size_t size)
+ const struct regcache *regcache, int regnum,
+ void *buf, size_t size)
{
gdb_byte *header = (gdb_byte *) buf;
struct gdbarch *gdbarch = regcache->arch ();
@@ -675,10 +670,9 @@ aarch64_linux_collect_sve_regset (const struct regset *regset,
/* Implement the "iterate_over_regset_sections" gdbarch method. */
static void
-aarch64_linux_iterate_over_regset_sections (struct gdbarch *gdbarch,
- iterate_over_regset_sections_cb *cb,
- void *cb_data,
- const struct regcache *regcache)
+aarch64_linux_iterate_over_regset_sections (
+ struct gdbarch *gdbarch, iterate_over_regset_sections_cb *cb, void *cb_data,
+ const struct regcache *regcache)
{
aarch64_gdbarch_tdep *tdep = gdbarch_tdep<aarch64_gdbarch_tdep> (gdbarch);
@@ -688,22 +682,17 @@ aarch64_linux_iterate_over_regset_sections (struct gdbarch *gdbarch,
if (tdep->has_sve ())
{
/* Create this on the fly in order to handle vector register sizes. */
- const struct regcache_map_entry sve_regmap[] =
- {
- { 32, AARCH64_SVE_Z0_REGNUM, (int) (tdep->vq * 16) },
- { 16, AARCH64_SVE_P0_REGNUM, (int) (tdep->vq * 16 / 8) },
- { 1, AARCH64_SVE_FFR_REGNUM, (int) (tdep->vq * 16 / 8) },
- { 1, AARCH64_FPSR_REGNUM, 4 },
- { 1, AARCH64_FPCR_REGNUM, 4 },
- { 0 }
- };
-
- const struct regset aarch64_linux_sve_regset =
- {
- sve_regmap,
- aarch64_linux_supply_sve_regset, aarch64_linux_collect_sve_regset,
- REGSET_VARIABLE_SIZE
- };
+ const struct regcache_map_entry sve_regmap[]
+ = { { 32, AARCH64_SVE_Z0_REGNUM, (int) (tdep->vq * 16) },
+ { 16, AARCH64_SVE_P0_REGNUM, (int) (tdep->vq * 16 / 8) },
+ { 1, AARCH64_SVE_FFR_REGNUM, (int) (tdep->vq * 16 / 8) },
+ { 1, AARCH64_FPSR_REGNUM, 4 },
+ { 1, AARCH64_FPCR_REGNUM, 4 },
+ { 0 } };
+
+ const struct regset aarch64_linux_sve_regset
+ = { sve_regmap, aarch64_linux_supply_sve_regset,
+ aarch64_linux_collect_sve_regset, REGSET_VARIABLE_SIZE };
cb (".reg-aarch-sve",
SVE_HEADER_SIZE + regcache_map_entry_size (aarch64_linux_fpregmap),
@@ -714,20 +703,15 @@ aarch64_linux_iterate_over_regset_sections (struct gdbarch *gdbarch,
cb (".reg2", AARCH64_LINUX_SIZEOF_FPREGSET, AARCH64_LINUX_SIZEOF_FPREGSET,
&aarch64_linux_fpregset, NULL, cb_data);
-
if (tdep->has_pauth ())
{
/* Create this on the fly in order to handle the variable location. */
- const struct regcache_map_entry pauth_regmap[] =
- {
- { 2, AARCH64_PAUTH_DMASK_REGNUM (tdep->pauth_reg_base), 8},
- { 0 }
- };
+ const struct regcache_map_entry pauth_regmap[]
+ = { { 2, AARCH64_PAUTH_DMASK_REGNUM (tdep->pauth_reg_base), 8 },
+ { 0 } };
- const struct regset aarch64_linux_pauth_regset =
- {
- pauth_regmap, regcache_supply_regset, regcache_collect_regset
- };
+ const struct regset aarch64_linux_pauth_regset
+ = { pauth_regmap, regcache_supply_regset, regcache_collect_regset };
cb (".reg-aarch-pauth", AARCH64_LINUX_SIZEOF_PAUTH,
AARCH64_LINUX_SIZEOF_PAUTH, &aarch64_linux_pauth_regset,
@@ -738,16 +722,11 @@ aarch64_linux_iterate_over_regset_sections (struct gdbarch *gdbarch,
if (tdep->has_mte ())
{
/* Create this on the fly in order to handle the variable location. */
- const struct regcache_map_entry mte_regmap[] =
- {
- { 1, tdep->mte_reg_base, 8},
- { 0 }
- };
+ const struct regcache_map_entry mte_regmap[]
+ = { { 1, tdep->mte_reg_base, 8 }, { 0 } };
- const struct regset aarch64_linux_mte_regset =
- {
- mte_regmap, regcache_supply_regset, regcache_collect_regset
- };
+ const struct regset aarch64_linux_mte_regset
+ = { mte_regmap, regcache_supply_regset, regcache_collect_regset };
cb (".reg-aarch-mte", AARCH64_LINUX_SIZEOF_MTE_REGSET,
AARCH64_LINUX_SIZEOF_MTE_REGSET, &aarch64_linux_mte_regset,
@@ -763,18 +742,14 @@ aarch64_linux_iterate_over_regset_sections (struct gdbarch *gdbarch,
int sizeof_tls_regset
= AARCH64_TLS_REGISTER_SIZE * tdep->tls_register_count;
- const struct regcache_map_entry tls_regmap[] =
- {
- { tdep->tls_register_count, tdep->tls_regnum_base,
- AARCH64_TLS_REGISTER_SIZE },
- { 0 }
- };
+ const struct regcache_map_entry tls_regmap[]
+ = { { tdep->tls_register_count, tdep->tls_regnum_base,
+ AARCH64_TLS_REGISTER_SIZE },
+ { 0 } };
- const struct regset aarch64_linux_tls_regset =
- {
- tls_regmap, regcache_supply_regset, regcache_collect_regset,
- REGSET_VARIABLE_SIZE
- };
+ const struct regset aarch64_linux_tls_regset
+ = { tls_regmap, regcache_supply_regset, regcache_collect_regset,
+ REGSET_VARIABLE_SIZE };
cb (".reg-aarch-tls", sizeof_tls_regset, sizeof_tls_regset,
&aarch64_linux_tls_regset, "TLS register", cb_data);
@@ -816,8 +791,8 @@ static int
aarch64_stap_is_single_operand (struct gdbarch *gdbarch, const char *s)
{
return (*s == '#' || isdigit (*s) /* Literal number. */
- || *s == '[' /* Register indirection. */
- || isalpha (*s)); /* Register value. */
+ || *s == '[' /* Register indirection. */
+ || isalpha (*s)); /* Register value. */
}
/* This routine is used to parse a special token in AArch64's assembly.
@@ -858,7 +833,7 @@ aarch64_stap_parse_special_token (struct gdbarch *gdbarch,
std::string regname (start, len);
if (user_reg_map_name_to_regnum (gdbarch, regname.c_str (), len) == -1)
- error (_("Invalid register name `%s' on expression `%s'."),
+ error (_ ("Invalid register name `%s' on expression `%s'."),
regname.c_str (), p->saved_arg);
++tmp;
@@ -893,8 +868,8 @@ aarch64_stap_parse_special_token (struct gdbarch *gdbarch,
struct type *long_type = builtin_type (gdbarch)->builtin_long;
if (got_minus)
displacement = -displacement;
- operation_up disp = make_operation<long_const_operation> (long_type,
- displacement);
+ operation_up disp
+ = make_operation<long_const_operation> (long_type, displacement);
/* The register name. */
operation_up reg
@@ -905,8 +880,8 @@ aarch64_stap_parse_special_token (struct gdbarch *gdbarch,
/* Casting to the expected type. */
struct type *arg_ptr_type = lookup_pointer_type (p->arg_type);
- sum = make_operation<unop_cast_operation> (std::move (sum),
- arg_ptr_type);
+ sum
+ = make_operation<unop_cast_operation> (std::move (sum), arg_ptr_type);
return make_operation<unop_ind_operation> (std::move (sum));
}
return {};
@@ -919,7 +894,8 @@ static linux_record_tdep aarch64_linux_record_tdep;
/* Enum that defines the AArch64 linux specific syscall identifiers used for
process record/replay. */
-enum aarch64_syscall {
+enum aarch64_syscall
+{
aarch64_sys_io_setup = 0,
aarch64_sys_io_destroy = 1,
aarch64_sys_io_submit = 2,
@@ -1190,11 +1166,13 @@ enum aarch64_syscall {
static enum gdb_syscall
aarch64_canonicalize_syscall (enum aarch64_syscall syscall_number)
{
-#define SYSCALL_MAP(SYSCALL) case aarch64_sys_##SYSCALL: \
- return gdb_sys_##SYSCALL
+#define SYSCALL_MAP(SYSCALL) \
+ case aarch64_sys_##SYSCALL: \
+ return gdb_sys_##SYSCALL
-#define UNSUPPORTED_SYSCALL_MAP(SYSCALL) case aarch64_sys_##SYSCALL: \
- return gdb_sys_no_syscall
+#define UNSUPPORTED_SYSCALL_MAP(SYSCALL) \
+ case aarch64_sys_##SYSCALL: \
+ return gdb_sys_no_syscall
switch (syscall_number)
{
@@ -1464,9 +1442,9 @@ aarch64_canonicalize_syscall (enum aarch64_syscall syscall_number)
UNSUPPORTED_SYSCALL_MAP (sched_setattr);
UNSUPPORTED_SYSCALL_MAP (sched_getattr);
SYSCALL_MAP (getrandom);
- default:
- return gdb_sys_no_syscall;
- }
+ default:
+ return gdb_sys_no_syscall;
+ }
}
/* Retrieve the syscall number at a ptrace syscall-stop, either on syscall entry
@@ -1496,7 +1474,7 @@ aarch64_linux_get_syscall_number (struct gdbarch *gdbarch, thread_info *thread)
regs->cooked_read (AARCH64_X0_REGNUM + 1, &x1);
regs->cooked_read (AARCH64_FP_REGNUM, &fp);
regs->cooked_read (AARCH64_LR_REGNUM, &lr);
- if (x1 == 0 && fp ==0 && lr == 0)
+ if (x1 == 0 && fp == 0 && lr == 0)
return aarch64_sys_execve;
}
@@ -1529,25 +1507,24 @@ aarch64_linux_syscall_record (struct regcache *regcache,
int ret = 0;
enum gdb_syscall syscall_gdb;
- syscall_gdb =
- aarch64_canonicalize_syscall ((enum aarch64_syscall) svc_number);
+ syscall_gdb
+ = aarch64_canonicalize_syscall ((enum aarch64_syscall) svc_number);
if (syscall_gdb < 0)
{
gdb_printf (gdb_stderr,
- _("Process record and replay target doesn't "
- "support syscall number %s\n"),
+ _ ("Process record and replay target doesn't "
+ "support syscall number %s\n"),
plongest (svc_number));
return -1;
}
- if (syscall_gdb == gdb_sys_sigreturn
- || syscall_gdb == gdb_sys_rt_sigreturn)
- {
- if (aarch64_all_but_pc_registers_record (regcache))
- return -1;
- return 0;
- }
+ if (syscall_gdb == gdb_sys_sigreturn || syscall_gdb == gdb_sys_rt_sigreturn)
+ {
+ if (aarch64_all_but_pc_registers_record (regcache))
+ return -1;
+ return 0;
+ }
ret = record_linux_system_call (syscall_gdb, regcache,
&aarch64_linux_record_tdep);
@@ -1592,7 +1569,7 @@ aarch64_mte_get_atag (CORE_ADDR address)
/* Only one tag should've been returned. Make sure we got exactly that. */
if (tags.size () != 1)
- error (_("Target returned an unexpected number of tags."));
+ error (_ ("Target returned an unexpected number of tags."));
/* Although our tags are 4 bits in size, they are stored in a
byte. */
@@ -1622,8 +1599,7 @@ aarch64_linux_tagged_address_p (struct gdbarch *gdbarch, struct value *address)
/* Implement the memtag_matches_p gdbarch method. */
static bool
-aarch64_linux_memtag_matches_p (struct gdbarch *gdbarch,
- struct value *address)
+aarch64_linux_memtag_matches_p (struct gdbarch *gdbarch, struct value *address)
{
gdb_assert (address != nullptr);
@@ -1698,10 +1674,10 @@ aarch64_linux_set_memtags (struct gdbarch *gdbarch, struct value *address,
size_t n = tags.size ();
if (g < n)
- warning (_("Got more tags than memory granules. Tags will be "
- "truncated."));
+ warning (_ ("Got more tags than memory granules. Tags will be "
+ "truncated."));
else if (g > n)
- warning (_("Using tag pattern to fill memory range."));
+ warning (_ ("Using tag pattern to fill memory range."));
if (!target_store_memtags (addr, length, tags,
static_cast<int> (memtag_type::allocation)))
@@ -1748,7 +1724,8 @@ aarch64_linux_get_memtag (struct gdbarch *gdbarch, struct value *address,
/* Implement the memtag_to_string gdbarch method. */
static std::string
-aarch64_linux_memtag_to_string (struct gdbarch *gdbarch, struct value *tag_value)
+aarch64_linux_memtag_to_string (struct gdbarch *gdbarch,
+ struct value *tag_value)
{
if (tag_value == nullptr)
return "";
@@ -1795,12 +1772,12 @@ aarch64_linux_report_signal_info (struct gdbarch *gdbarch,
uiout->text ("\n");
- uiout->field_string ("sigcode-meaning", _("Memory tag violation"));
+ uiout->field_string ("sigcode-meaning", _ ("Memory tag violation"));
/* For synchronous faults, show additional information. */
if (si_code == SEGV_MTESERR)
{
- uiout->text (_(" while accessing address "));
+ uiout->text (_ (" while accessing address "));
uiout->field_core_addr ("fault-addr", gdbarch, fault_addr);
uiout->text ("\n");
@@ -1810,20 +1787,20 @@ aarch64_linux_report_signal_info (struct gdbarch *gdbarch,
gdb_byte ltag = aarch64_mte_get_ltag (fault_addr);
if (!atag.has_value ())
- uiout->text (_("Allocation tag unavailable"));
+ uiout->text (_ ("Allocation tag unavailable"));
else
{
- uiout->text (_("Allocation tag "));
+ uiout->text (_ ("Allocation tag "));
uiout->field_string ("allocation-tag", hex_string (*atag));
uiout->text ("\n");
- uiout->text (_("Logical tag "));
+ uiout->text (_ ("Logical tag "));
uiout->field_string ("logical-tag", hex_string (ltag));
}
}
else
{
uiout->text ("\n");
- uiout->text (_("Fault address unavailable"));
+ uiout->text (_ ("Fault address unavailable"));
}
}
@@ -1894,17 +1871,16 @@ aarch64_linux_fill_memtag_section (struct gdbarch *gdbarch, asection *osec)
{
/* Transfer tags in chunks. */
gdb::byte_vector tags_read;
- size_t xfer_len
- = ((granules >= MAX_TAGS_TO_TRANSFER)
- ? MAX_TAGS_TO_TRANSFER * AARCH64_MTE_GRANULE_SIZE
- : granules * AARCH64_MTE_GRANULE_SIZE);
+ size_t xfer_len = ((granules >= MAX_TAGS_TO_TRANSFER)
+ ? MAX_TAGS_TO_TRANSFER * AARCH64_MTE_GRANULE_SIZE
+ : granules * AARCH64_MTE_GRANULE_SIZE);
if (!target_fetch_memtags (address, xfer_len, tags_read,
static_cast<int> (memtag_type::allocation)))
{
- warning (_("Failed to read MTE tags from memory range [%s,%s)."),
- phex_nz (start_address, sizeof (start_address)),
- phex_nz (end_address, sizeof (end_address)));
+ warning (_ ("Failed to read MTE tags from memory range [%s,%s)."),
+ phex_nz (start_address, sizeof (start_address)),
+ phex_nz (end_address, sizeof (end_address)));
return false;
}
@@ -1919,13 +1895,12 @@ aarch64_linux_fill_memtag_section (struct gdbarch *gdbarch, asection *osec)
/* Pack the MTE tag bits. */
aarch64_mte_pack_tags (tags);
- if (!bfd_set_section_contents (osec->owner, osec, tags.data (),
- 0, tags.size ()))
+ if (!bfd_set_section_contents (osec->owner, osec, tags.data (), 0,
+ tags.size ()))
{
- warning (_("Failed to write %s bytes of corefile memory "
- "tag content (%s)."),
- pulongest (tags.size ()),
- bfd_errmsg (bfd_get_error ()));
+ warning (_ ("Failed to write %s bytes of corefile memory "
+ "tag content (%s)."),
+ pulongest (tags.size ()), bfd_errmsg (bfd_get_error ()));
}
return true;
}
@@ -1938,8 +1913,7 @@ aarch64_linux_fill_memtag_section (struct gdbarch *gdbarch, asection *osec)
static gdb::byte_vector
aarch64_linux_decode_memtag_section (struct gdbarch *gdbarch,
- bfd_section *section,
- int type,
+ bfd_section *section, int type,
CORE_ADDR address, size_t length)
{
gdb_assert (section != nullptr);
@@ -1948,8 +1922,8 @@ aarch64_linux_decode_memtag_section (struct gdbarch *gdbarch,
gdb_assert (section->vma <= address);
/* Figure out how many tags we need to fetch in this memory range. */
- size_t granules = aarch64_mte_get_tag_granules (address, length,
- AARCH64_MTE_GRANULE_SIZE);
+ size_t granules
+ = aarch64_mte_get_tag_granules (address, length, AARCH64_MTE_GRANULE_SIZE);
/* Sanity check. */
gdb_assert (granules > 0);
@@ -1965,9 +1939,9 @@ aarch64_linux_decode_memtag_section (struct gdbarch *gdbarch,
/* Figure out the starting offset into the packed tags data. */
file_ptr offset = ((granules_from_vma - granules) >> 1);
- if (!bfd_get_section_contents (section->owner, section, tags.data (),
- offset, tags.size ()))
- error (_("Couldn't read contents from memtag section."));
+ if (!bfd_get_section_contents (section->owner, section, tags.data (), offset,
+ tags.size ()))
+ error (_ ("Couldn't read contents from memtag section."));
/* At this point, the tags are packed 2 per byte. Unpack them before
returning. */
@@ -2019,10 +1993,10 @@ aarch64_linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
{
static const char *const stap_integer_prefixes[] = { "#", "", NULL };
static const char *const stap_register_prefixes[] = { "", NULL };
- static const char *const stap_register_indirection_prefixes[] = { "[",
- NULL };
- static const char *const stap_register_indirection_suffixes[] = { "]",
- NULL };
+ static const char *const stap_register_indirection_prefixes[]
+ = { "[", NULL };
+ static const char *const stap_register_indirection_suffixes[]
+ = { "]", NULL };
aarch64_gdbarch_tdep *tdep = gdbarch_tdep<aarch64_gdbarch_tdep> (gdbarch);
tdep->lowest_pc = 0x8000;
@@ -2045,18 +2019,18 @@ aarch64_linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
/* Enable longjmp. */
tdep->jb_pc = 11;
- set_gdbarch_iterate_over_regset_sections
- (gdbarch, aarch64_linux_iterate_over_regset_sections);
- set_gdbarch_core_read_description
- (gdbarch, aarch64_linux_core_read_description);
+ set_gdbarch_iterate_over_regset_sections (
+ gdbarch, aarch64_linux_iterate_over_regset_sections);
+ set_gdbarch_core_read_description (gdbarch,
+ aarch64_linux_core_read_description);
/* SystemTap related. */
set_gdbarch_stap_integer_prefixes (gdbarch, stap_integer_prefixes);
set_gdbarch_stap_register_prefixes (gdbarch, stap_register_prefixes);
- set_gdbarch_stap_register_indirection_prefixes (gdbarch,
- stap_register_indirection_prefixes);
- set_gdbarch_stap_register_indirection_suffixes (gdbarch,
- stap_register_indirection_suffixes);
+ set_gdbarch_stap_register_indirection_prefixes (
+ gdbarch, stap_register_indirection_prefixes);
+ set_gdbarch_stap_register_indirection_suffixes (
+ gdbarch, stap_register_indirection_suffixes);
set_gdbarch_stap_is_single_operand (gdbarch, aarch64_stap_is_single_operand);
set_gdbarch_stap_parse_special_token (gdbarch,
aarch64_stap_parse_special_token);
@@ -2079,8 +2053,7 @@ aarch64_linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
set_gdbarch_tagged_address_p (gdbarch, aarch64_linux_tagged_address_p);
/* Register a hook for checking if there is a memory tag match. */
- set_gdbarch_memtag_matches_p (gdbarch,
- aarch64_linux_memtag_matches_p);
+ set_gdbarch_memtag_matches_p (gdbarch, aarch64_linux_memtag_matches_p);
/* Register a hook for setting the logical/allocation tags for
a range of addresses. */
@@ -2103,12 +2076,12 @@ aarch64_linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
/* Core file helper to create a memory tag section for a particular
PT_LOAD segment. */
- set_gdbarch_create_memtag_section
- (gdbarch, aarch64_linux_create_memtag_section);
+ set_gdbarch_create_memtag_section (gdbarch,
+ aarch64_linux_create_memtag_section);
/* Core file helper to fill a memory tag section with tag data. */
- set_gdbarch_fill_memtag_section
- (gdbarch, aarch64_linux_fill_memtag_section);
+ set_gdbarch_fill_memtag_section (gdbarch,
+ aarch64_linux_fill_memtag_section);
/* Core file helper to decode a memory tag section. */
set_gdbarch_decode_memtag_section (gdbarch,
@@ -2284,15 +2257,16 @@ aarch64_linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
set_gdbarch_displaced_step_copy_insn (gdbarch,
aarch64_displaced_step_copy_insn);
set_gdbarch_displaced_step_fixup (gdbarch, aarch64_displaced_step_fixup);
- set_gdbarch_displaced_step_hw_singlestep (gdbarch,
- aarch64_displaced_step_hw_singlestep);
+ set_gdbarch_displaced_step_hw_singlestep (
+ gdbarch, aarch64_displaced_step_hw_singlestep);
set_gdbarch_gcc_target_options (gdbarch, aarch64_linux_gcc_target_options);
}
#if GDB_SELF_TEST
-namespace selftests {
+namespace selftests
+{
/* Verify functions to read and write logical tags. */
@@ -2315,6 +2289,7 @@ aarch64_linux_ltag_tests (void)
#endif /* GDB_SELF_TEST */
void _initialize_aarch64_linux_tdep ();
+
void
_initialize_aarch64_linux_tdep ()
{
diff --git a/gdb/aarch64-linux-tdep.h b/gdb/aarch64-linux-tdep.h
index 2077597f211..531c7c091dc 100644
--- a/gdb/aarch64-linux-tdep.h
+++ b/gdb/aarch64-linux-tdep.h
@@ -26,7 +26,7 @@
/* The general-purpose regset consists of 31 X registers, plus SP, PC,
and PSTATE registers, as defined in the AArch64 port of the Linux
kernel. */
-#define AARCH64_LINUX_SIZEOF_GREGSET (34 * X_REGISTER_SIZE)
+#define AARCH64_LINUX_SIZEOF_GREGSET (34 * X_REGISTER_SIZE)
/* The fp regset consists of 32 V registers, plus FPCR and FPSR which
are 4 bytes wide each, and the whole structure is padded to 128 bit
diff --git a/gdb/aarch64-nat.c b/gdb/aarch64-nat.c
index ee8c5a1e21d..0bd30ead8a5 100644
--- a/gdb/aarch64-nat.c
+++ b/gdb/aarch64-nat.c
@@ -31,7 +31,7 @@
(e.g., fork children, checkpoints). */
static std::unordered_map<pid_t, aarch64_debug_reg_state>
-aarch64_debug_process_state;
+ aarch64_debug_process_state;
/* See aarch64-nat.h. */
@@ -123,8 +123,8 @@ aarch64_insert_hw_breakpoint (struct gdbarch *gdbarch,
if (show_debug_regs)
{
- aarch64_show_debug_reg_state (state,
- "insert_hw_breakpoint", addr, len, type);
+ aarch64_show_debug_reg_state (state, "insert_hw_breakpoint", addr, len,
+ type);
}
return ret;
@@ -156,8 +156,8 @@ aarch64_remove_hw_breakpoint (struct gdbarch *gdbarch,
if (show_debug_regs)
{
- aarch64_show_debug_reg_state (state,
- "remove_hw_watchpoint", addr, len, type);
+ aarch64_show_debug_reg_state (state, "remove_hw_watchpoint", addr, len,
+ type);
}
return ret;
@@ -168,7 +168,8 @@ aarch64_remove_hw_breakpoint (struct gdbarch *gdbarch,
of the type TYPE. Return 0 on success, -1 on failure. */
int
-aarch64_insert_watchpoint (CORE_ADDR addr, int len, enum target_hw_bp_type type,
+aarch64_insert_watchpoint (CORE_ADDR addr, int len,
+ enum target_hw_bp_type type,
struct expression *cond)
{
int ret;
@@ -187,8 +188,8 @@ aarch64_insert_watchpoint (CORE_ADDR addr, int len, enum target_hw_bp_type type,
if (show_debug_regs)
{
- aarch64_show_debug_reg_state (state,
- "insert_watchpoint", addr, len, type);
+ aarch64_show_debug_reg_state (state, "insert_watchpoint", addr, len,
+ type);
}
return ret;
@@ -199,7 +200,8 @@ aarch64_insert_watchpoint (CORE_ADDR addr, int len, enum target_hw_bp_type type,
type TYPE. Return 0 on success, -1 on failure. */
int
-aarch64_remove_watchpoint (CORE_ADDR addr, int len, enum target_hw_bp_type type,
+aarch64_remove_watchpoint (CORE_ADDR addr, int len,
+ enum target_hw_bp_type type,
struct expression *cond)
{
int ret;
@@ -218,8 +220,8 @@ aarch64_remove_watchpoint (CORE_ADDR addr, int len, enum target_hw_bp_type type,
if (show_debug_regs)
{
- aarch64_show_debug_reg_state (state,
- "remove_watchpoint", addr, len, type);
+ aarch64_show_debug_reg_state (state, "remove_watchpoint", addr, len,
+ type);
}
return ret;
@@ -237,15 +239,16 @@ aarch64_stopped_data_address (const struct aarch64_debug_reg_state *state,
{
const unsigned int offset
= aarch64_watchpoint_offset (state->dr_ctrl_wp[i]);
- const unsigned int len = aarch64_watchpoint_length (state->dr_ctrl_wp[i]);
+ const unsigned int len
+ = aarch64_watchpoint_length (state->dr_ctrl_wp[i]);
const CORE_ADDR addr_watch = state->dr_addr_wp[i] + offset;
- const CORE_ADDR addr_watch_aligned = align_down (state->dr_addr_wp[i], 8);
+ const CORE_ADDR addr_watch_aligned
+ = align_down (state->dr_addr_wp[i], 8);
const CORE_ADDR addr_orig = state->dr_addr_orig_wp[i];
if (state->dr_ref_count_wp[i]
&& DR_CONTROL_ENABLED (state->dr_ctrl_wp[i])
- && addr_trap >= addr_watch_aligned
- && addr_trap < addr_watch + len)
+ && addr_trap >= addr_watch_aligned && addr_trap < addr_watch + len)
{
/* ADDR_TRAP reports the first address of the memory range
accessed by the CPU, regardless of what was the memory
@@ -281,16 +284,16 @@ add_show_debug_regs_command (void)
/* A maintenance command to enable printing the internal DRi mirror
variables. */
add_setshow_boolean_cmd ("show-debug-regs", class_maintenance,
- &show_debug_regs, _("\
-Set whether to show variables that mirror the AArch64 debug registers."), _("\
-Show whether to show variables that mirror the AArch64 debug registers."), _("\
+ &show_debug_regs, _ ("\
+Set whether to show variables that mirror the AArch64 debug registers."),
+ _ ("\
+Show whether to show variables that mirror the AArch64 debug registers."),
+ _ ("\
Use \"on\" to enable, \"off\" to disable.\n\
If enabled, the debug registers values are shown when GDB inserts\n\
or removes a hardware breakpoint or watchpoint, and when the inferior\n\
triggers a breakpoint or watchpoint."),
- NULL,
- NULL,
- &maintenance_set_cmdlist,
+ NULL, NULL, &maintenance_set_cmdlist,
&maintenance_show_cmdlist);
}
diff --git a/gdb/aarch64-nat.h b/gdb/aarch64-nat.h
index fee6bda2577..fece3e42034 100644
--- a/gdb/aarch64-nat.h
+++ b/gdb/aarch64-nat.h
@@ -72,38 +72,50 @@ int aarch64_stopped_by_hw_breakpoint ();
/* Convenience template mixin used to add aarch64 watchpoints support to a
target. */
-template <typename BaseTarget>
+template<typename BaseTarget>
struct aarch64_nat_target : public BaseTarget
{
/* Hook in common aarch64 hardware watchpoints/breakpoints support. */
int can_use_hw_breakpoint (enum bptype type, int cnt, int othertype) override
- { return aarch64_can_use_hw_breakpoint (type, cnt, othertype); }
+ {
+ return aarch64_can_use_hw_breakpoint (type, cnt, othertype);
+ }
int region_ok_for_hw_watchpoint (CORE_ADDR addr, int len) override
- { return aarch64_region_ok_for_watchpoint (addr, len); }
+ {
+ return aarch64_region_ok_for_watchpoint (addr, len);
+ }
- int insert_watchpoint (CORE_ADDR addr, int len,
- enum target_hw_bp_type type,
+ int insert_watchpoint (CORE_ADDR addr, int len, enum target_hw_bp_type type,
struct expression *cond) override
- { return aarch64_insert_watchpoint (addr, len, type, cond); }
+ {
+ return aarch64_insert_watchpoint (addr, len, type, cond);
+ }
- int remove_watchpoint (CORE_ADDR addr, int len,
- enum target_hw_bp_type type,
+ int remove_watchpoint (CORE_ADDR addr, int len, enum target_hw_bp_type type,
struct expression *cond) override
- { return aarch64_remove_watchpoint (addr, len, type, cond); }
+ {
+ return aarch64_remove_watchpoint (addr, len, type, cond);
+ }
int insert_hw_breakpoint (struct gdbarch *gdbarch,
struct bp_target_info *bp_tgt) override
- { return aarch64_insert_hw_breakpoint (gdbarch, bp_tgt); }
+ {
+ return aarch64_insert_hw_breakpoint (gdbarch, bp_tgt);
+ }
int remove_hw_breakpoint (struct gdbarch *gdbarch,
struct bp_target_info *bp_tgt) override
- { return aarch64_remove_hw_breakpoint (gdbarch, bp_tgt); }
+ {
+ return aarch64_remove_hw_breakpoint (gdbarch, bp_tgt);
+ }
bool watchpoint_addr_within_range (CORE_ADDR addr, CORE_ADDR start,
int length) override
- { return start <= addr && start + length - 1 >= addr; }
+ {
+ return start <= addr && start + length - 1 >= addr;
+ }
};
#endif /* AARCH64_NAT_H */
diff --git a/gdb/aarch64-newlib-tdep.c b/gdb/aarch64-newlib-tdep.c
index 276d88d187d..1182895a2f0 100644
--- a/gdb/aarch64-newlib-tdep.c
+++ b/gdb/aarch64-newlib-tdep.c
@@ -37,6 +37,7 @@ aarch64_newlib_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
}
void _initialize_aarch64_newlib_tdep ();
+
void
_initialize_aarch64_newlib_tdep ()
{
diff --git a/gdb/aarch64-ravenscar-thread.c b/gdb/aarch64-ravenscar-thread.c
index 7f6d9ef1429..09df197cde5 100644
--- a/gdb/aarch64-ravenscar-thread.c
+++ b/gdb/aarch64-ravenscar-thread.c
@@ -30,48 +30,94 @@
/* See aarch64-tdep.h for register numbers. */
-static const int aarch64_context_offsets[] =
-{
+static const int aarch64_context_offsets[] = {
/* X0 - X28 */
- NO_OFFSET, NO_OFFSET, NO_OFFSET, NO_OFFSET,
- NO_OFFSET, NO_OFFSET, NO_OFFSET, NO_OFFSET,
- NO_OFFSET, NO_OFFSET, NO_OFFSET, NO_OFFSET,
- NO_OFFSET, NO_OFFSET, NO_OFFSET, NO_OFFSET,
- NO_OFFSET, NO_OFFSET, NO_OFFSET, 0,
- 8, 16, 24, 32,
- 40, 48, 56, 64,
+ NO_OFFSET,
+ NO_OFFSET,
+ NO_OFFSET,
+ NO_OFFSET,
+ NO_OFFSET,
+ NO_OFFSET,
+ NO_OFFSET,
+ NO_OFFSET,
+ NO_OFFSET,
+ NO_OFFSET,
+ NO_OFFSET,
+ NO_OFFSET,
+ NO_OFFSET,
+ NO_OFFSET,
+ NO_OFFSET,
+ NO_OFFSET,
+ NO_OFFSET,
+ NO_OFFSET,
+ NO_OFFSET,
+ 0,
+ 8,
+ 16,
+ 24,
+ 32,
+ 40,
+ 48,
+ 56,
+ 64,
72,
/* FP, LR, SP, PC, CPSR */
/* Note that as task switch is synchronous, PC is in fact the LR here */
- 80, 88, 96, 88,
+ 80,
+ 88,
+ 96,
+ 88,
NO_OFFSET,
/* V0 - V31 */
- 128, 144, 160, 176,
- 192, 208, 224, 240,
- 256, 272, 288, 304,
- 320, 336, 352, 368,
- 384, 400, 416, 432,
- 448, 464, 480, 496,
- 512, 528, 544, 560,
- 576, 592, 608, 624,
+ 128,
+ 144,
+ 160,
+ 176,
+ 192,
+ 208,
+ 224,
+ 240,
+ 256,
+ 272,
+ 288,
+ 304,
+ 320,
+ 336,
+ 352,
+ 368,
+ 384,
+ 400,
+ 416,
+ 432,
+ 448,
+ 464,
+ 480,
+ 496,
+ 512,
+ 528,
+ 544,
+ 560,
+ 576,
+ 592,
+ 608,
+ 624,
/* FPSR, FPCR */
- 112, 116,
+ 112,
+ 116,
};
#define V_INIT_OFFSET 640
/* The ravenscar_arch_ops vector for most Aarch64 targets. */
-static struct ravenscar_arch_ops aarch64_ravenscar_ops
- (aarch64_context_offsets,
- -1, -1,
- V_INIT_OFFSET,
- /* The FPU context buffer starts with the FPSR register. */
- aarch64_context_offsets[AARCH64_FPSR_REGNUM],
- AARCH64_V0_REGNUM, AARCH64_FPCR_REGNUM);
+static struct ravenscar_arch_ops aarch64_ravenscar_ops (
+ aarch64_context_offsets, -1, -1, V_INIT_OFFSET,
+ /* The FPU context buffer starts with the FPSR register. */
+ aarch64_context_offsets[AARCH64_FPSR_REGNUM], AARCH64_V0_REGNUM,
+ AARCH64_FPCR_REGNUM);
/* Register aarch64_ravenscar_ops in GDBARCH. */
diff --git a/gdb/aarch64-tdep.c b/gdb/aarch64-tdep.c
index ea93e9ad0d2..2e7af2010ff 100644
--- a/gdb/aarch64-tdep.c
+++ b/gdb/aarch64-tdep.c
@@ -57,10 +57,10 @@
/* A Homogeneous Floating-Point or Short-Vector Aggregate may have at most
four members. */
-#define HA_MAX_NUM_FLDS 4
+#define HA_MAX_NUM_FLDS 4
/* All possible aarch64 target descriptors. */
-static std::unordered_map <aarch64_features, target_desc *> tdesc_aarch64_map;
+static std::unordered_map<aarch64_features, target_desc *> tdesc_aarch64_map;
/* The standard register names, and all the valid aliases for them.
We're not adding fp here, that name is already taken, see
@@ -69,82 +69,57 @@ static const struct
{
const char *const name;
int regnum;
-} aarch64_register_aliases[] =
-{
+} aarch64_register_aliases[] = {
/* Link register alias for x30. */
- {"lr", AARCH64_LR_REGNUM},
+ { "lr", AARCH64_LR_REGNUM },
/* SP is the canonical name for x31 according to aarch64_r_register_names,
so we're adding an x31 alias for sp. */
- {"x31", AARCH64_SP_REGNUM},
+ { "x31", AARCH64_SP_REGNUM },
/* specials */
- {"ip0", AARCH64_X0_REGNUM + 16},
- {"ip1", AARCH64_X0_REGNUM + 17}
+ { "ip0", AARCH64_X0_REGNUM + 16 },
+ { "ip1", AARCH64_X0_REGNUM + 17 }
};
/* The required core 'R' registers. */
-static const char *const aarch64_r_register_names[] =
-{
+static const char *const aarch64_r_register_names[] = {
/* These registers must appear in consecutive RAW register number
order and they must begin with AARCH64_X0_REGNUM! */
- "x0", "x1", "x2", "x3",
- "x4", "x5", "x6", "x7",
- "x8", "x9", "x10", "x11",
- "x12", "x13", "x14", "x15",
- "x16", "x17", "x18", "x19",
- "x20", "x21", "x22", "x23",
- "x24", "x25", "x26", "x27",
- "x28", "x29", "x30", "sp",
- "pc", "cpsr"
+ "x0", "x1", "x2", "x3", "x4", "x5", "x6", "x7", "x8",
+ "x9", "x10", "x11", "x12", "x13", "x14", "x15", "x16", "x17",
+ "x18", "x19", "x20", "x21", "x22", "x23", "x24", "x25", "x26",
+ "x27", "x28", "x29", "x30", "sp", "pc", "cpsr"
};
/* The FP/SIMD 'V' registers. */
-static const char *const aarch64_v_register_names[] =
-{
+static const char *const aarch64_v_register_names[] = {
/* These registers must appear in consecutive RAW register number
order and they must begin with AARCH64_V0_REGNUM! */
- "v0", "v1", "v2", "v3",
- "v4", "v5", "v6", "v7",
- "v8", "v9", "v10", "v11",
- "v12", "v13", "v14", "v15",
- "v16", "v17", "v18", "v19",
- "v20", "v21", "v22", "v23",
- "v24", "v25", "v26", "v27",
- "v28", "v29", "v30", "v31",
- "fpsr",
- "fpcr"
+ "v0", "v1", "v2", "v3", "v4", "v5", "v6", "v7", "v8",
+ "v9", "v10", "v11", "v12", "v13", "v14", "v15", "v16", "v17",
+ "v18", "v19", "v20", "v21", "v22", "v23", "v24", "v25", "v26",
+ "v27", "v28", "v29", "v30", "v31", "fpsr", "fpcr"
};
/* The SVE 'Z' and 'P' registers. */
-static const char *const aarch64_sve_register_names[] =
-{
+static const char *const aarch64_sve_register_names[] = {
/* These registers must appear in consecutive RAW register number
order and they must begin with AARCH64_SVE_Z0_REGNUM! */
- "z0", "z1", "z2", "z3",
- "z4", "z5", "z6", "z7",
- "z8", "z9", "z10", "z11",
- "z12", "z13", "z14", "z15",
- "z16", "z17", "z18", "z19",
- "z20", "z21", "z22", "z23",
- "z24", "z25", "z26", "z27",
- "z28", "z29", "z30", "z31",
- "fpsr", "fpcr",
- "p0", "p1", "p2", "p3",
- "p4", "p5", "p6", "p7",
- "p8", "p9", "p10", "p11",
- "p12", "p13", "p14", "p15",
- "ffr", "vg"
+ "z0", "z1", "z2", "z3", "z4", "z5", "z6", "z7", "z8",
+ "z9", "z10", "z11", "z12", "z13", "z14", "z15", "z16", "z17",
+ "z18", "z19", "z20", "z21", "z22", "z23", "z24", "z25", "z26",
+ "z27", "z28", "z29", "z30", "z31", "fpsr", "fpcr", "p0", "p1",
+ "p2", "p3", "p4", "p5", "p6", "p7", "p8", "p9", "p10",
+ "p11", "p12", "p13", "p14", "p15", "ffr", "vg"
};
-static const char *const aarch64_pauth_register_names[] =
-{
+static const char *const aarch64_pauth_register_names[] = {
/* Authentication mask for data pointer. */
"pauth_dmask",
/* Authentication mask for code pointer. */
"pauth_cmask"
};
-static const char *const aarch64_mte_register_names[] =
-{
+static const char *const aarch64_mte_register_names[] = {
/* Tag Control Register. */
"tag_ctl"
};
@@ -187,28 +162,32 @@ static void
show_aarch64_debug (struct ui_file *file, int from_tty,
struct cmd_list_element *c, const char *value)
{
- gdb_printf (file, _("AArch64 debugging is %s.\n"), value);
+ gdb_printf (file, _ ("AArch64 debugging is %s.\n"), value);
}
-namespace {
+namespace
+{
/* Abstract instruction reader. */
class abstract_instruction_reader
{
public:
+
/* Read in one instruction. */
virtual ULONGEST read (CORE_ADDR memaddr, int len,
- enum bfd_endian byte_order) = 0;
+ enum bfd_endian byte_order)
+ = 0;
};
/* Instruction reader from real target. */
class instruction_reader : public abstract_instruction_reader
{
- public:
- ULONGEST read (CORE_ADDR memaddr, int len, enum bfd_endian byte_order)
- override
+public:
+
+ ULONGEST read (CORE_ADDR memaddr, int len,
+ enum bfd_endian byte_order) override
{
return read_code_unsigned_integer (memaddr, len, byte_order);
}
@@ -221,8 +200,8 @@ class instruction_reader : public abstract_instruction_reader
THIS_FRAME. */
static CORE_ADDR
-aarch64_frame_unmask_lr (aarch64_gdbarch_tdep *tdep,
- frame_info_ptr this_frame, CORE_ADDR addr)
+aarch64_frame_unmask_lr (aarch64_gdbarch_tdep *tdep, frame_info_ptr this_frame,
+ CORE_ADDR addr)
{
if (tdep->has_pauth ()
&& frame_unwind_register_unsigned (this_frame,
@@ -255,10 +234,10 @@ aarch64_get_pc_address_flags (frame_info_ptr frame, CORE_ADDR pc)
clobber the stack frame unexpectedly, or an unknown instruction. */
static CORE_ADDR
-aarch64_analyze_prologue (struct gdbarch *gdbarch,
- CORE_ADDR start, CORE_ADDR limit,
+aarch64_analyze_prologue (struct gdbarch *gdbarch, CORE_ADDR start,
+ CORE_ADDR limit,
struct aarch64_prologue_cache *cache,
- abstract_instruction_reader& reader)
+ abstract_instruction_reader &reader)
{
enum bfd_endian byte_order_for_code = gdbarch_byte_order_for_code (gdbarch);
int i;
@@ -299,13 +278,13 @@ aarch64_analyze_prologue (struct gdbarch *gdbarch,
if (inst.opcode->op == OP_ADD)
{
- regs[rd] = pv_add_constant (regs[rn],
- inst.operands[2].imm.value);
+ regs[rd]
+ = pv_add_constant (regs[rn], inst.operands[2].imm.value);
}
else
{
- regs[rd] = pv_add_constant (regs[rn],
- -inst.operands[2].imm.value);
+ regs[rd]
+ = pv_add_constant (regs[rn], -inst.operands[2].imm.value);
}
/* Did we move SP to FP? */
@@ -374,8 +353,7 @@ aarch64_analyze_prologue (struct gdbarch *gdbarch,
gdb_assert (inst.operands[1].type == AARCH64_OPND_Rn);
gdb_assert (inst.operands[2].type == AARCH64_OPND_Rm_SFT);
- if (inst.operands[2].shifter.amount == 0
- && rn == AARCH64_SP_REGNUM)
+ if (inst.operands[2].shifter.amount == 0 && rn == AARCH64_SP_REGNUM)
regs[rd] = regs[rm];
else
{
@@ -397,9 +375,9 @@ aarch64_analyze_prologue (struct gdbarch *gdbarch,
gdb_assert (inst.operands[1].type == AARCH64_OPND_ADDR_SIMM9);
gdb_assert (!inst.operands[1].addr.offset.is_reg);
- stack.store
- (pv_add_constant (regs[rn], inst.operands[1].addr.offset.imm),
- size, regs[rt]);
+ stack.store (pv_add_constant (regs[rn],
+ inst.operands[1].addr.offset.imm),
+ size, regs[rt]);
/* Are we storing with SP as a base? */
if (rn == AARCH64_SP_REGNUM)
@@ -442,7 +420,8 @@ aarch64_analyze_prologue (struct gdbarch *gdbarch,
}
stack.store (pv_add_constant (regs[rn], imm), size, regs[rt1]);
- stack.store (pv_add_constant (regs[rn], imm + size), size, regs[rt2]);
+ stack.store (pv_add_constant (regs[rn], imm + size), size,
+ regs[rt2]);
if (inst.operands[2].addr.writeback)
regs[rn] = pv_add_constant (regs[rn], imm);
@@ -452,7 +431,7 @@ aarch64_analyze_prologue (struct gdbarch *gdbarch,
if (rn == AARCH64_SP_REGNUM && !inst.operands[2].addr.writeback)
seen_stack_set = true;
}
- else if ((inst.opcode->iclass == ldst_imm9 /* Signed immediate. */
+ else if ((inst.opcode->iclass == ldst_imm9 /* Signed immediate. */
|| (inst.opcode->iclass == ldst_pos /* Unsigned immediate. */
&& (inst.opcode->op == OP_STR_POS
|| inst.opcode->op == OP_STRF_POS)))
@@ -490,7 +469,7 @@ aarch64_analyze_prologue (struct gdbarch *gdbarch,
int ra_state_val = 0;
if (insn == 0xd503233f /* paciasp. */
- || insn == 0xd503237f /* pacibsp. */)
+ || insn == 0xd503237f /* pacibsp. */)
{
/* Return addresses are mangled. */
ra_state_val = 1;
@@ -563,8 +542,7 @@ aarch64_analyze_prologue (struct gdbarch *gdbarch,
int regnum = gdbarch_num_regs (gdbarch);
CORE_ADDR offset;
- if (stack.find_reg (gdbarch, i + AARCH64_X_REGISTER_COUNT,
- &offset))
+ if (stack.find_reg (gdbarch, i + AARCH64_X_REGISTER_COUNT, &offset))
cache->saved_regs[i + regnum + AARCH64_D0_REGNUM].set_addr (offset);
}
@@ -572,32 +550,35 @@ aarch64_analyze_prologue (struct gdbarch *gdbarch,
}
static CORE_ADDR
-aarch64_analyze_prologue (struct gdbarch *gdbarch,
- CORE_ADDR start, CORE_ADDR limit,
+aarch64_analyze_prologue (struct gdbarch *gdbarch, CORE_ADDR start,
+ CORE_ADDR limit,
struct aarch64_prologue_cache *cache)
{
instruction_reader reader;
- return aarch64_analyze_prologue (gdbarch, start, limit, cache,
- reader);
+ return aarch64_analyze_prologue (gdbarch, start, limit, cache, reader);
}
#if GDB_SELF_TEST
-namespace selftests {
+namespace selftests
+{
/* Instruction reader from manually cooked instruction sequences. */
class instruction_reader_test : public abstract_instruction_reader
{
public:
+
template<size_t SIZE>
explicit instruction_reader_test (const uint32_t (&insns)[SIZE])
- : m_insns (insns), m_insns_size (SIZE)
- {}
+ : m_insns (insns),
+ m_insns_size (SIZE)
+ {
+ }
- ULONGEST read (CORE_ADDR memaddr, int len, enum bfd_endian byte_order)
- override
+ ULONGEST read (CORE_ADDR memaddr, int len,
+ enum bfd_endian byte_order) override
{
SELF_CHECK (len == 4);
SELF_CHECK (memaddr % 4 == 0);
@@ -607,6 +588,7 @@ public:
}
private:
+
const uint32_t *m_insns;
size_t m_insns_size;
};
@@ -699,7 +681,6 @@ aarch64_analyze_prologue_test (void)
int num_regs = gdbarch_num_regs (gdbarch);
int regnum = i + num_regs + AARCH64_D0_REGNUM;
-
if (i == 0)
SELF_CHECK (cache.saved_regs[regnum].addr () == -24);
else
@@ -832,8 +813,8 @@ aarch64_analyze_prologue_test (void)
instruction_reader_test reader (insns);
trad_frame_reset_saved_regs (gdbarch, cache.saved_regs);
- CORE_ADDR end = aarch64_analyze_prologue (gdbarch, 0, 128, &cache,
- reader);
+ CORE_ADDR end
+ = aarch64_analyze_prologue (gdbarch, 0, 128, &cache, reader);
SELF_CHECK (end == 4 * 4);
SELF_CHECK (cache.framereg == AARCH64_FP_REGNUM);
@@ -860,37 +841,36 @@ aarch64_analyze_prologue_test (void)
}
/* Test a prologue with a BTI instruction. */
- {
- static const uint32_t insns[] = {
- 0xd503245f, /* bti */
- 0xa9bd7bfd, /* stp x29, x30, [sp, #-48]! */
- 0x910003fd, /* mov x29, sp */
- 0xf801c3f3, /* str x19, [sp, #28] */
- 0xb9401fa0, /* ldr x19, [x29, #28] */
- };
- instruction_reader_test reader (insns);
+ {
+ static const uint32_t insns[] = {
+ 0xd503245f, /* bti */
+ 0xa9bd7bfd, /* stp x29, x30, [sp, #-48]! */
+ 0x910003fd, /* mov x29, sp */
+ 0xf801c3f3, /* str x19, [sp, #28] */
+ 0xb9401fa0, /* ldr x19, [x29, #28] */
+ };
+ instruction_reader_test reader (insns);
- trad_frame_reset_saved_regs (gdbarch, cache.saved_regs);
- CORE_ADDR end = aarch64_analyze_prologue (gdbarch, 0, 128, &cache,
- reader);
+ trad_frame_reset_saved_regs (gdbarch, cache.saved_regs);
+ CORE_ADDR end = aarch64_analyze_prologue (gdbarch, 0, 128, &cache, reader);
- SELF_CHECK (end == 4 * 4);
- SELF_CHECK (cache.framereg == AARCH64_FP_REGNUM);
- SELF_CHECK (cache.framesize == 48);
+ SELF_CHECK (end == 4 * 4);
+ SELF_CHECK (cache.framereg == AARCH64_FP_REGNUM);
+ SELF_CHECK (cache.framesize == 48);
- for (int i = 0; i < AARCH64_X_REGISTER_COUNT; i++)
- {
- if (i == 19)
- SELF_CHECK (cache.saved_regs[i].addr () == -20);
- else if (i == AARCH64_FP_REGNUM)
- SELF_CHECK (cache.saved_regs[i].addr () == -48);
- else if (i == AARCH64_LR_REGNUM)
- SELF_CHECK (cache.saved_regs[i].addr () == -40);
- else
- SELF_CHECK (cache.saved_regs[i].is_realreg ()
- && cache.saved_regs[i].realreg () == i);
- }
- }
+ for (int i = 0; i < AARCH64_X_REGISTER_COUNT; i++)
+ {
+ if (i == 19)
+ SELF_CHECK (cache.saved_regs[i].addr () == -20);
+ else if (i == AARCH64_FP_REGNUM)
+ SELF_CHECK (cache.saved_regs[i].addr () == -48);
+ else if (i == AARCH64_LR_REGNUM)
+ SELF_CHECK (cache.saved_regs[i].addr () == -40);
+ else
+ SELF_CHECK (cache.saved_regs[i].is_realreg ()
+ && cache.saved_regs[i].realreg () == i);
+ }
+ }
}
} // namespace selftests
#endif /* GDB_SELF_TEST */
@@ -923,7 +903,7 @@ aarch64_skip_prologue (struct gdbarch *gdbarch, CORE_ADDR pc)
upper bound. */
limit_pc = skip_prologue_using_sal (gdbarch, pc);
if (limit_pc == 0)
- limit_pc = pc + 128; /* Magic. */
+ limit_pc = pc + 128; /* Magic. */
/* Try disassembling prologue. */
return aarch64_analyze_prologue (gdbarch, pc, limit_pc, NULL);
@@ -1078,8 +1058,8 @@ aarch64_prologue_frame_unwind_stop_reason (frame_info_ptr this_frame,
PC and the caller's SP when we were called. */
static void
-aarch64_prologue_this_id (frame_info_ptr this_frame,
- void **this_cache, struct frame_id *this_id)
+aarch64_prologue_this_id (frame_info_ptr this_frame, void **this_cache,
+ struct frame_id *this_id)
{
struct aarch64_prologue_cache *cache
= aarch64_make_prologue_cache (this_frame, this_cache);
@@ -1093,8 +1073,8 @@ aarch64_prologue_this_id (frame_info_ptr this_frame,
/* Implement the "prev_register" frame_unwind method. */
static struct value *
-aarch64_prologue_prev_register (frame_info_ptr this_frame,
- void **this_cache, int prev_regnum)
+aarch64_prologue_prev_register (frame_info_ptr this_frame, void **this_cache,
+ int prev_regnum)
{
struct aarch64_prologue_cache *cache
= aarch64_make_prologue_cache (this_frame, this_cache);
@@ -1134,24 +1114,21 @@ aarch64_prologue_prev_register (frame_info_ptr this_frame,
| |<- SP
+----------+ */
if (prev_regnum == AARCH64_SP_REGNUM)
- return frame_unwind_got_constant (this_frame, prev_regnum,
- cache->prev_sp);
+ return frame_unwind_got_constant (this_frame, prev_regnum, cache->prev_sp);
return trad_frame_get_prev_register (this_frame, cache->saved_regs,
prev_regnum);
}
/* AArch64 prologue unwinder. */
-static frame_unwind aarch64_prologue_unwind =
-{
- "aarch64 prologue",
- NORMAL_FRAME,
- aarch64_prologue_frame_unwind_stop_reason,
- aarch64_prologue_this_id,
- aarch64_prologue_prev_register,
- NULL,
- default_frame_sniffer
-};
+static frame_unwind aarch64_prologue_unwind
+ = { "aarch64 prologue",
+ NORMAL_FRAME,
+ aarch64_prologue_frame_unwind_stop_reason,
+ aarch64_prologue_this_id,
+ aarch64_prologue_prev_register,
+ NULL,
+ default_frame_sniffer };
/* Allocate and fill in *THIS_CACHE with information about the prologue of
*THIS_FRAME. Do not do this is if *THIS_CACHE was already allocated.
@@ -1172,8 +1149,8 @@ aarch64_make_stub_cache (frame_info_ptr this_frame, void **this_cache)
try
{
- cache->prev_sp = get_frame_register_unsigned (this_frame,
- AARCH64_SP_REGNUM);
+ cache->prev_sp
+ = get_frame_register_unsigned (this_frame, AARCH64_SP_REGNUM);
cache->prev_pc = get_frame_pc (this_frame);
cache->available_p = 1;
}
@@ -1204,8 +1181,8 @@ aarch64_stub_frame_unwind_stop_reason (frame_info_ptr this_frame,
/* Our frame ID for a stub frame is the current SP and LR. */
static void
-aarch64_stub_this_id (frame_info_ptr this_frame,
- void **this_cache, struct frame_id *this_id)
+aarch64_stub_this_id (frame_info_ptr this_frame, void **this_cache,
+ struct frame_id *this_id)
{
struct aarch64_prologue_cache *cache
= aarch64_make_stub_cache (this_frame, this_cache);
@@ -1237,16 +1214,14 @@ aarch64_stub_unwind_sniffer (const struct frame_unwind *self,
}
/* AArch64 stub unwinder. */
-static frame_unwind aarch64_stub_unwind =
-{
- "aarch64 stub",
- NORMAL_FRAME,
- aarch64_stub_frame_unwind_stop_reason,
- aarch64_stub_this_id,
- aarch64_prologue_prev_register,
- NULL,
- aarch64_stub_unwind_sniffer
-};
+static frame_unwind aarch64_stub_unwind
+ = { "aarch64 stub",
+ NORMAL_FRAME,
+ aarch64_stub_frame_unwind_stop_reason,
+ aarch64_stub_this_id,
+ aarch64_prologue_prev_register,
+ NULL,
+ aarch64_stub_unwind_sniffer };
/* Return the frame base address of *THIS_FRAME. */
@@ -1260,20 +1235,16 @@ aarch64_normal_frame_base (frame_info_ptr this_frame, void **this_cache)
}
/* AArch64 default frame base information. */
-static frame_base aarch64_normal_base =
-{
- &aarch64_prologue_unwind,
- aarch64_normal_frame_base,
- aarch64_normal_frame_base,
- aarch64_normal_frame_base
-};
+static frame_base aarch64_normal_base
+ = { &aarch64_prologue_unwind, aarch64_normal_frame_base,
+ aarch64_normal_frame_base, aarch64_normal_frame_base };
/* Return the value of the REGNUM register in the previous frame of
*THIS_FRAME. */
static struct value *
-aarch64_dwarf2_prev_register (frame_info_ptr this_frame,
- void **this_cache, int regnum)
+aarch64_dwarf2_prev_register (frame_info_ptr this_frame, void **this_cache,
+ int regnum)
{
gdbarch *arch = get_frame_arch (this_frame);
aarch64_gdbarch_tdep *tdep = gdbarch_tdep<aarch64_gdbarch_tdep> (arch);
@@ -1287,7 +1258,7 @@ aarch64_dwarf2_prev_register (frame_info_ptr this_frame,
return frame_unwind_got_constant (this_frame, regnum, lr);
default:
- internal_error (_("Unexpected register %d"), regnum);
+ internal_error (_ ("Unexpected register %d"), regnum);
}
}
@@ -1391,14 +1362,13 @@ aarch64_program_breakpoint_here_p (gdbarch *gdbarch, CORE_ADDR address)
if (target_read_memory (address, target_mem, insn_len) == 0)
{
- uint32_t insn =
- (uint32_t) extract_unsigned_integer (target_mem, insn_len,
- gdbarch_byte_order_for_code (gdbarch));
+ uint32_t insn = (uint32_t) extract_unsigned_integer (
+ target_mem, insn_len, gdbarch_byte_order_for_code (gdbarch));
/* Check if INSN is a BRK instruction pattern. There are multiple choices
of such instructions with different immediate values. Different OS'
may use a different variation, but they have the same outcome. */
- return ((insn & BRK_INSN_MASK) == BRK_INSN_BASE);
+ return ((insn & BRK_INSN_MASK) == BRK_INSN_BASE);
}
return false;
@@ -1501,14 +1471,15 @@ aapcs_is_vfp_call_or_return_candidate_1 (struct type *type,
else
{
struct type *target_type = type->target_type ();
- int count = aapcs_is_vfp_call_or_return_candidate_1
- (target_type, fundamental_type);
+ int count
+ = aapcs_is_vfp_call_or_return_candidate_1 (target_type,
+ fundamental_type);
if (count == -1)
return count;
count *= (type->length () / target_type->length ());
- return count;
+ return count;
}
}
@@ -1525,8 +1496,9 @@ aapcs_is_vfp_call_or_return_candidate_1 (struct type *type,
struct type *member = check_typedef (type->field (i).type ());
- int sub_count = aapcs_is_vfp_call_or_return_candidate_1
- (member, fundamental_type);
+ int sub_count
+ = aapcs_is_vfp_call_or_return_candidate_1 (member,
+ fundamental_type);
if (sub_count == -1)
return -1;
count += sub_count;
@@ -1535,7 +1507,8 @@ aapcs_is_vfp_call_or_return_candidate_1 (struct type *type,
/* Ensure there is no padding between the fields (allowing for empty
zero length structs) */
int ftype_length = (*fundamental_type == nullptr)
- ? 0 : (*fundamental_type)->length ();
+ ? 0
+ : (*fundamental_type)->length ();
if (count * ftype_length != type->length ())
return -1;
@@ -1576,8 +1549,8 @@ aapcs_is_vfp_call_or_return_candidate (struct type *type, int *count,
*fundamental_type = nullptr;
- int ag_count = aapcs_is_vfp_call_or_return_candidate_1 (type,
- fundamental_type);
+ int ag_count
+ = aapcs_is_vfp_call_or_return_candidate_1 (type, fundamental_type);
if (ag_count > 0 && ag_count <= HA_MAX_NUM_FLDS)
{
@@ -1629,13 +1602,11 @@ pass_in_x (struct gdbarch *gdbarch, struct regcache *regcache,
while (len > 0)
{
int partial_len = len < X_REGISTER_SIZE ? len : X_REGISTER_SIZE;
- CORE_ADDR regval = extract_unsigned_integer (buf, partial_len,
- byte_order);
-
+ CORE_ADDR regval
+ = extract_unsigned_integer (buf, partial_len, byte_order);
/* Adjust sub-word struct/union args when big-endian. */
- if (byte_order == BFD_ENDIAN_BIG
- && partial_len < X_REGISTER_SIZE
+ if (byte_order == BFD_ENDIAN_BIG && partial_len < X_REGISTER_SIZE
&& (typecode == TYPE_CODE_STRUCT || typecode == TYPE_CODE_UNION))
regval <<= ((X_REGISTER_SIZE - partial_len) * TARGET_CHAR_BIT);
@@ -1656,10 +1627,8 @@ pass_in_x (struct gdbarch *gdbarch, struct regcache *regcache,
handle arguments spread across multiple registers. */
static int
-pass_in_v (struct gdbarch *gdbarch,
- struct regcache *regcache,
- struct aarch64_call_info *info,
- int len, const bfd_byte *buf)
+pass_in_v (struct gdbarch *gdbarch, struct regcache *regcache,
+ struct aarch64_call_info *info, int len, const bfd_byte *buf)
{
if (info->nsrn < 8)
{
@@ -1777,8 +1746,7 @@ pass_in_v_vfp_candidate (struct gdbarch *gdbarch, struct regcache *regcache,
const bfd_byte *buf = value_contents (arg).data ();
struct type *target_type = check_typedef (arg_type->target_type ());
- if (!pass_in_v (gdbarch, regcache, info, target_type->length (),
- buf))
+ if (!pass_in_v (gdbarch, regcache, info, target_type->length (), buf))
return false;
return pass_in_v (gdbarch, regcache, info, target_type->length (),
@@ -1818,8 +1786,7 @@ pass_in_v_vfp_candidate (struct gdbarch *gdbarch, struct regcache *regcache,
static CORE_ADDR
aarch64_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
struct regcache *regcache, CORE_ADDR bp_addr,
- int nargs,
- struct value **args, CORE_ADDR sp,
+ int nargs, struct value **args, CORE_ADDR sp,
function_call_return_method return_method,
CORE_ADDR struct_addr)
{
@@ -1860,10 +1827,10 @@ aarch64_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
/* The struct_return pointer occupies X8. */
if (return_method != return_method_normal)
{
- aarch64_debug_printf ("struct return in %s = 0x%s",
- gdbarch_register_name
- (gdbarch, AARCH64_STRUCT_RETURN_REGNUM),
- paddress (gdbarch, struct_addr));
+ aarch64_debug_printf (
+ "struct return in %s = 0x%s",
+ gdbarch_register_name (gdbarch, AARCH64_STRUCT_RETURN_REGNUM),
+ paddress (gdbarch, struct_addr));
regcache_cooked_write_unsigned (regcache, AARCH64_STRUCT_RETURN_REGNUM,
struct_addr);
@@ -2141,8 +2108,9 @@ aarch64_vnv_type (struct gdbarch *gdbarch)
struct type *t = arch_composite_type (gdbarch, "__gdb_builtin_type_vnv",
TYPE_CODE_UNION);
- struct type *sub = arch_composite_type (gdbarch, "__gdb_builtin_type_vnd",
- TYPE_CODE_UNION);
+ struct type *sub
+ = arch_composite_type (gdbarch, "__gdb_builtin_type_vnd",
+ TYPE_CODE_UNION);
append_composite_type_field (sub, "f",
init_vector_type (bt->builtin_double, 2));
append_composite_type_field (sub, "u",
@@ -2247,7 +2215,7 @@ aarch64_gdb_print_insn (bfd_vma memaddr, disassemble_info *info)
/* AArch64 BRK software debug mode instruction.
Note that AArch64 code is always little-endian.
1101.0100.0010.0000.0000.0000.0000.0000 = 0xd4200000. */
-constexpr gdb_byte aarch64_default_breakpoint[] = {0x00, 0x00, 0x20, 0xd4};
+constexpr gdb_byte aarch64_default_breakpoint[] = { 0x00, 0x00, 0x20, 0xd4 };
typedef BP_MANIPULATION (aarch64_default_breakpoint) aarch64_breakpoint;
@@ -2276,9 +2244,9 @@ aarch64_extract_return_value (struct type *type, struct regcache *regs,
gdb_byte buf[register_size (gdbarch, regno)];
gdb_assert (len <= sizeof (buf));
- aarch64_debug_printf
- ("read HFA or HVA return value element %d from %s",
- i + 1, gdbarch_register_name (gdbarch, regno));
+ aarch64_debug_printf (
+ "read HFA or HVA return value element %d from %s", i + 1,
+ gdbarch_register_name (gdbarch, regno));
regs->cooked_read (regno, buf);
@@ -2286,12 +2254,9 @@ aarch64_extract_return_value (struct type *type, struct regcache *regs,
valbuf += len;
}
}
- else if (type->code () == TYPE_CODE_INT
- || type->code () == TYPE_CODE_CHAR
- || type->code () == TYPE_CODE_BOOL
- || type->code () == TYPE_CODE_PTR
- || TYPE_IS_REFERENCE (type)
- || type->code () == TYPE_CODE_ENUM)
+ else if (type->code () == TYPE_CODE_INT || type->code () == TYPE_CODE_CHAR
+ || type->code () == TYPE_CODE_BOOL || type->code () == TYPE_CODE_PTR
+ || TYPE_IS_REFERENCE (type) || type->code () == TYPE_CODE_ENUM)
{
/* If the type is a plain integer, then the access is
straight-forward. Otherwise we have to play around a bit
@@ -2306,8 +2271,9 @@ aarch64_extract_return_value (struct type *type, struct regcache *regs,
anything special for small big-endian values. */
regcache_cooked_read_unsigned (regs, regno++, &tmp);
store_unsigned_integer (valbuf,
- (len > X_REGISTER_SIZE
- ? X_REGISTER_SIZE : len), byte_order, tmp);
+ (len > X_REGISTER_SIZE ? X_REGISTER_SIZE
+ : len),
+ byte_order, tmp);
len -= X_REGISTER_SIZE;
valbuf += X_REGISTER_SIZE;
}
@@ -2331,7 +2297,6 @@ aarch64_extract_return_value (struct type *type, struct regcache *regs,
}
}
-
/* Will a function return an aggregate type in memory or in a
register? Return 0 if an aggregate type can be returned in a
register, 1 if it must be returned in memory. */
@@ -2390,9 +2355,9 @@ aarch64_store_return_value (struct type *type, struct regcache *regs,
gdb_byte tmpbuf[register_size (gdbarch, regno)];
gdb_assert (len <= sizeof (tmpbuf));
- aarch64_debug_printf
- ("write HFA or HVA return value element %d to %s",
- i + 1, gdbarch_register_name (gdbarch, regno));
+ aarch64_debug_printf (
+ "write HFA or HVA return value element %d to %s", i + 1,
+ gdbarch_register_name (gdbarch, regno));
memcpy (tmpbuf, valbuf,
len > V_REGISTER_SIZE ? V_REGISTER_SIZE : len);
@@ -2400,12 +2365,9 @@ aarch64_store_return_value (struct type *type, struct regcache *regs,
valbuf += len;
}
}
- else if (type->code () == TYPE_CODE_INT
- || type->code () == TYPE_CODE_CHAR
- || type->code () == TYPE_CODE_BOOL
- || type->code () == TYPE_CODE_PTR
- || TYPE_IS_REFERENCE (type)
- || type->code () == TYPE_CODE_ENUM)
+ else if (type->code () == TYPE_CODE_INT || type->code () == TYPE_CODE_CHAR
+ || type->code () == TYPE_CODE_BOOL || type->code () == TYPE_CODE_PTR
+ || TYPE_IS_REFERENCE (type) || type->code () == TYPE_CODE_ENUM)
{
if (type->length () <= X_REGISTER_SIZE)
{
@@ -2526,15 +2488,13 @@ aarch64_get_longjmp_target (frame_info_ptr frame, CORE_ADDR *pc)
/* Implement the "gen_return_address" gdbarch method. */
static void
-aarch64_gen_return_address (struct gdbarch *gdbarch,
- struct agent_expr *ax, struct axs_value *value,
- CORE_ADDR scope)
+aarch64_gen_return_address (struct gdbarch *gdbarch, struct agent_expr *ax,
+ struct axs_value *value, CORE_ADDR scope)
{
value->type = register_type (gdbarch, AARCH64_LR_REGNUM);
value->kind = axs_lvalue_register;
value->u.reg = AARCH64_LR_REGNUM;
}
-
/* Return TRUE if REGNUM is a W pseudo-register number. Return FALSE
otherwise. */
@@ -2559,77 +2519,47 @@ aarch64_pseudo_register_name (struct gdbarch *gdbarch, int regnum)
aarch64_gdbarch_tdep *tdep = gdbarch_tdep<aarch64_gdbarch_tdep> (gdbarch);
/* W pseudo-registers. Bottom halves of the X registers. */
- static const char *const w_name[] =
- {
- "w0", "w1", "w2", "w3",
- "w4", "w5", "w6", "w7",
- "w8", "w9", "w10", "w11",
- "w12", "w13", "w14", "w15",
- "w16", "w17", "w18", "w19",
- "w20", "w21", "w22", "w23",
- "w24", "w25", "w26", "w27",
- "w28", "w29", "w30",
- };
-
- static const char *const q_name[] =
- {
- "q0", "q1", "q2", "q3",
- "q4", "q5", "q6", "q7",
- "q8", "q9", "q10", "q11",
- "q12", "q13", "q14", "q15",
- "q16", "q17", "q18", "q19",
- "q20", "q21", "q22", "q23",
- "q24", "q25", "q26", "q27",
- "q28", "q29", "q30", "q31",
- };
-
- static const char *const d_name[] =
- {
- "d0", "d1", "d2", "d3",
- "d4", "d5", "d6", "d7",
- "d8", "d9", "d10", "d11",
- "d12", "d13", "d14", "d15",
- "d16", "d17", "d18", "d19",
- "d20", "d21", "d22", "d23",
- "d24", "d25", "d26", "d27",
- "d28", "d29", "d30", "d31",
- };
-
- static const char *const s_name[] =
- {
- "s0", "s1", "s2", "s3",
- "s4", "s5", "s6", "s7",
- "s8", "s9", "s10", "s11",
- "s12", "s13", "s14", "s15",
- "s16", "s17", "s18", "s19",
- "s20", "s21", "s22", "s23",
- "s24", "s25", "s26", "s27",
- "s28", "s29", "s30", "s31",
- };
-
- static const char *const h_name[] =
- {
- "h0", "h1", "h2", "h3",
- "h4", "h5", "h6", "h7",
- "h8", "h9", "h10", "h11",
- "h12", "h13", "h14", "h15",
- "h16", "h17", "h18", "h19",
- "h20", "h21", "h22", "h23",
- "h24", "h25", "h26", "h27",
- "h28", "h29", "h30", "h31",
- };
-
- static const char *const b_name[] =
- {
- "b0", "b1", "b2", "b3",
- "b4", "b5", "b6", "b7",
- "b8", "b9", "b10", "b11",
- "b12", "b13", "b14", "b15",
- "b16", "b17", "b18", "b19",
- "b20", "b21", "b22", "b23",
- "b24", "b25", "b26", "b27",
- "b28", "b29", "b30", "b31",
- };
+ static const char *const w_name[] = {
+ "w0", "w1", "w2", "w3", "w4", "w5", "w6", "w7",
+ "w8", "w9", "w10", "w11", "w12", "w13", "w14", "w15",
+ "w16", "w17", "w18", "w19", "w20", "w21", "w22", "w23",
+ "w24", "w25", "w26", "w27", "w28", "w29", "w30",
+ };
+
+ static const char *const q_name[] = {
+ "q0", "q1", "q2", "q3", "q4", "q5", "q6", "q7",
+ "q8", "q9", "q10", "q11", "q12", "q13", "q14", "q15",
+ "q16", "q17", "q18", "q19", "q20", "q21", "q22", "q23",
+ "q24", "q25", "q26", "q27", "q28", "q29", "q30", "q31",
+ };
+
+ static const char *const d_name[] = {
+ "d0", "d1", "d2", "d3", "d4", "d5", "d6", "d7",
+ "d8", "d9", "d10", "d11", "d12", "d13", "d14", "d15",
+ "d16", "d17", "d18", "d19", "d20", "d21", "d22", "d23",
+ "d24", "d25", "d26", "d27", "d28", "d29", "d30", "d31",
+ };
+
+ static const char *const s_name[] = {
+ "s0", "s1", "s2", "s3", "s4", "s5", "s6", "s7",
+ "s8", "s9", "s10", "s11", "s12", "s13", "s14", "s15",
+ "s16", "s17", "s18", "s19", "s20", "s21", "s22", "s23",
+ "s24", "s25", "s26", "s27", "s28", "s29", "s30", "s31",
+ };
+
+ static const char *const h_name[] = {
+ "h0", "h1", "h2", "h3", "h4", "h5", "h6", "h7",
+ "h8", "h9", "h10", "h11", "h12", "h13", "h14", "h15",
+ "h16", "h17", "h18", "h19", "h20", "h21", "h22", "h23",
+ "h24", "h25", "h26", "h27", "h28", "h29", "h30", "h31",
+ };
+
+ static const char *const b_name[] = {
+ "b0", "b1", "b2", "b3", "b4", "b5", "b6", "b7",
+ "b8", "b9", "b10", "b11", "b12", "b13", "b14", "b15",
+ "b16", "b17", "b18", "b19", "b20", "b21", "b22", "b23",
+ "b24", "b25", "b26", "b27", "b28", "b29", "b30", "b31",
+ };
int p_regnum = regnum - gdbarch_num_regs (gdbarch);
@@ -2654,17 +2584,12 @@ aarch64_pseudo_register_name (struct gdbarch *gdbarch, int regnum)
if (tdep->has_sve ())
{
- static const char *const sve_v_name[] =
- {
- "v0", "v1", "v2", "v3",
- "v4", "v5", "v6", "v7",
- "v8", "v9", "v10", "v11",
- "v12", "v13", "v14", "v15",
- "v16", "v17", "v18", "v19",
- "v20", "v21", "v22", "v23",
- "v24", "v25", "v26", "v27",
- "v28", "v29", "v30", "v31",
- };
+ static const char *const sve_v_name[] = {
+ "v0", "v1", "v2", "v3", "v4", "v5", "v6", "v7",
+ "v8", "v9", "v10", "v11", "v12", "v13", "v14", "v15",
+ "v16", "v17", "v18", "v19", "v20", "v21", "v22", "v23",
+ "v24", "v25", "v26", "v27", "v28", "v29", "v30", "v31",
+ };
if (p_regnum >= AARCH64_SVE_V0_REGNUM
&& p_regnum < AARCH64_SVE_V0_REGNUM + AARCH64_V_REGS_NUM)
@@ -2677,7 +2602,7 @@ aarch64_pseudo_register_name (struct gdbarch *gdbarch, int regnum)
if (tdep->has_pauth () && regnum == tdep->ra_sign_state_regnum)
return "";
- internal_error (_("aarch64_pseudo_register_name: bad register number %d"),
+ internal_error (_ ("aarch64_pseudo_register_name: bad register number %d"),
p_regnum);
}
@@ -2716,7 +2641,7 @@ aarch64_pseudo_register_type (struct gdbarch *gdbarch, int regnum)
if (tdep->has_pauth () && regnum == tdep->ra_sign_state_regnum)
return builtin_type (gdbarch)->builtin_uint64;
- internal_error (_("aarch64_pseudo_register_type: bad register number %d"),
+ internal_error (_ ("aarch64_pseudo_register_type: bad register number %d"),
p_regnum);
}
@@ -2772,16 +2697,17 @@ aarch64_pseudo_read_value_1 (struct gdbarch *gdbarch,
memcpy (value_contents_raw (result_value).data (), reg_buf, regsize);
return result_value;
- }
+}
/* Implement the "pseudo_register_read_value" gdbarch method. */
static struct value *
-aarch64_pseudo_read_value (struct gdbarch *gdbarch, readable_regcache *regcache,
- int regnum)
+aarch64_pseudo_read_value (struct gdbarch *gdbarch,
+ readable_regcache *regcache, int regnum)
{
aarch64_gdbarch_tdep *tdep = gdbarch_tdep<aarch64_gdbarch_tdep> (gdbarch);
- struct value *result_value = allocate_value (register_type (gdbarch, regnum));
+ struct value *result_value
+ = allocate_value (register_type (gdbarch, regnum));
VALUE_LVAL (result_value) = lval_register;
VALUE_REGNUM (result_value) = regnum;
@@ -2939,7 +2865,6 @@ value_of_aarch64_user_reg (frame_info_ptr frame, const void *baton)
return value_of_register (*reg_p, frame);
}
-
/* Implement the "software_single_step" gdbarch method, needed to
single step through atomic sequences on AArch64. */
@@ -2957,19 +2882,18 @@ aarch64_software_single_step (struct regcache *regcache)
CORE_ADDR closing_insn = 0;
ULONGEST insn_from_memory;
- if (!safe_read_memory_unsigned_integer (loc, insn_size,
- byte_order_for_code,
+ if (!safe_read_memory_unsigned_integer (loc, insn_size, byte_order_for_code,
&insn_from_memory))
- {
- /* Assume we don't have a atomic sequence, as we couldn't read the
+ {
+ /* Assume we don't have a atomic sequence, as we couldn't read the
instruction in this location. */
- return {};
- }
+ return {};
+ }
uint32_t insn = insn_from_memory;
int index;
int insn_count;
- int bc_insn_count = 0; /* Conditional branch instruction count. */
+ int bc_insn_count = 0; /* Conditional branch instruction count. */
int last_breakpoint = 0; /* Defaults to 0 (no breakpoints placed). */
aarch64_inst inst;
@@ -2987,11 +2911,11 @@ aarch64_software_single_step (struct regcache *regcache)
if (!safe_read_memory_unsigned_integer (loc, insn_size,
byte_order_for_code,
&insn_from_memory))
- {
- /* Assume we don't have a atomic sequence, as we couldn't read the
+ {
+ /* Assume we don't have a atomic sequence, as we couldn't read the
instruction in this location. */
- return {};
- }
+ return {};
+ }
insn = insn_from_memory;
if (aarch64_decode_insn (insn, &inst, 1, NULL) != 0)
@@ -3212,8 +3136,8 @@ aarch64_displaced_step_adr (const int32_t offset, const unsigned rd,
address & ~0xfff);
}
else
- regcache_cooked_write_unsigned (dsd->regs, AARCH64_X0_REGNUM + rd,
- address);
+ regcache_cooked_write_unsigned (dsd->regs, AARCH64_X0_REGNUM + rd,
+ address);
dsd->dsc->pc_adjust = 4;
emit_nop (dsd->insn_buf);
@@ -3232,8 +3156,7 @@ aarch64_displaced_step_ldr_literal (const int32_t offset, const int is_sw,
CORE_ADDR address = data->insn_addr + offset;
struct aarch64_memory_operand zero = { MEMORY_OPERAND_OFFSET, 0 };
- regcache_cooked_write_unsigned (dsd->regs, AARCH64_X0_REGNUM + rt,
- address);
+ regcache_cooked_write_unsigned (dsd->regs, AARCH64_X0_REGNUM + rt, address);
if (is_sw)
dsd->insn_count = emit_ldrsw (dsd->insn_buf, aarch64_register (rt, 1),
@@ -3273,23 +3196,18 @@ aarch64_displaced_step_others (const uint32_t insn,
dsd->dsc->pc_adjust = 4;
}
-static const struct aarch64_insn_visitor visitor =
-{
- aarch64_displaced_step_b,
- aarch64_displaced_step_b_cond,
- aarch64_displaced_step_cb,
- aarch64_displaced_step_tb,
- aarch64_displaced_step_adr,
- aarch64_displaced_step_ldr_literal,
+static const struct aarch64_insn_visitor visitor = {
+ aarch64_displaced_step_b, aarch64_displaced_step_b_cond,
+ aarch64_displaced_step_cb, aarch64_displaced_step_tb,
+ aarch64_displaced_step_adr, aarch64_displaced_step_ldr_literal,
aarch64_displaced_step_others,
};
/* Implement the "displaced_step_copy_insn" gdbarch method. */
displaced_step_copy_insn_closure_up
-aarch64_displaced_step_copy_insn (struct gdbarch *gdbarch,
- CORE_ADDR from, CORE_ADDR to,
- struct regcache *regs)
+aarch64_displaced_step_copy_insn (struct gdbarch *gdbarch, CORE_ADDR from,
+ CORE_ADDR to, struct regcache *regs)
{
enum bfd_endian byte_order_for_code = gdbarch_byte_order_for_code (gdbarch);
struct aarch64_displaced_step_data dsd;
@@ -3312,8 +3230,8 @@ aarch64_displaced_step_copy_insn (struct gdbarch *gdbarch,
return NULL;
}
- std::unique_ptr<aarch64_displaced_step_copy_insn_closure> dsc
- (new aarch64_displaced_step_copy_insn_closure);
+ std::unique_ptr<aarch64_displaced_step_copy_insn_closure> dsc (
+ new aarch64_displaced_step_copy_insn_closure);
dsd.base.insn_addr = from;
dsd.new_addr = to;
dsd.regs = regs;
@@ -3331,8 +3249,7 @@ aarch64_displaced_step_copy_insn (struct gdbarch *gdbarch,
relocated instruction(s) there. */
for (i = 0; i < dsd.insn_count; i++)
{
- displaced_debug_printf ("writing insn %.8x at %s",
- dsd.insn_buf[i],
+ displaced_debug_printf ("writing insn %.8x at %s", dsd.insn_buf[i],
paddress (gdbarch, to + i * 4));
write_memory_unsigned_integer (to + i * 4, 4, byte_order_for_code,
@@ -3381,7 +3298,8 @@ aarch64_displaced_step_fixup (struct gdbarch *gdbarch,
dsc->pc_adjust = 4;
}
else
- gdb_assert_not_reached ("Unexpected PC value after displaced stepping");
+ gdb_assert_not_reached (
+ "Unexpected PC value after displaced stepping");
displaced_debug_printf ("[Conditional] pc_adjust after: %d",
dsc->pc_adjust);
@@ -3399,7 +3317,8 @@ aarch64_displaced_step_fixup (struct gdbarch *gdbarch,
took place. */
if ((pc - to) == 0)
{
- displaced_debug_printf ("PC did not move. Discarding PC adjustment.");
+ displaced_debug_printf (
+ "PC did not move. Discarding PC adjustment.");
dsc->pc_adjust = 0;
}
@@ -3431,7 +3350,7 @@ const target_desc *
aarch64_read_description (const aarch64_features &features)
{
if (features.vq > AARCH64_MAX_SVE_VQ)
- error (_("VQ is %" PRIu64 ", maximum supported value is %d"), features.vq,
+ error (_ ("VQ is %" PRIu64 ", maximum supported value is %d"), features.vq,
AARCH64_MAX_SVE_VQ);
struct target_desc *tdesc = tdesc_aarch64_map[features];
@@ -3460,8 +3379,8 @@ aarch64_get_tdesc_vq (const struct target_desc *tdesc)
if (feature_sve == nullptr)
return 0;
- uint64_t vl = tdesc_register_bitsize (feature_sve,
- aarch64_sve_register_names[0]) / 8;
+ uint64_t vl
+ = tdesc_register_bitsize (feature_sve, aarch64_sve_register_names[0]) / 8;
return sve_vq_from_vl (vl);
}
@@ -3477,9 +3396,9 @@ aarch64_features_from_target_desc (const struct target_desc *tdesc)
features.vq = aarch64_get_tdesc_vq (tdesc);
features.pauth
- = (tdesc_find_feature (tdesc, "org.gnu.gdb.aarch64.pauth") != nullptr);
+ = (tdesc_find_feature (tdesc, "org.gnu.gdb.aarch64.pauth") != nullptr);
features.mte
- = (tdesc_find_feature (tdesc, "org.gnu.gdb.aarch64.mte") != nullptr);
+ = (tdesc_find_feature (tdesc, "org.gnu.gdb.aarch64.mte") != nullptr);
const struct tdesc_feature *tls_feature
= tdesc_find_feature (tdesc, "org.gnu.gdb.aarch64.tls");
@@ -3555,8 +3474,8 @@ aarch64_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
uint64_t vq = aarch64_get_tdesc_vq (info.target_desc);
if (vq > AARCH64_MAX_SVE_VQ)
- internal_error (_("VQ out of bounds: %s (max %d)"),
- pulongest (vq), AARCH64_MAX_SVE_VQ);
+ internal_error (_ ("VQ out of bounds: %s (max %d)"), pulongest (vq),
+ AARCH64_MAX_SVE_VQ);
/* If there is already a candidate, use it. */
for (gdbarch_list *best_arch = gdbarch_list_lookup_by_info (arches, &info);
@@ -3576,7 +3495,7 @@ aarch64_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
tdesc = aarch64_read_description ({});
gdb_assert (tdesc);
- feature_core = tdesc_find_feature (tdesc,"org.gnu.gdb.aarch64.core");
+ feature_core = tdesc_find_feature (tdesc, "org.gnu.gdb.aarch64.core");
feature_fpu = tdesc_find_feature (tdesc, "org.gnu.gdb.aarch64.fpu");
feature_sve = tdesc_find_feature (tdesc, "org.gnu.gdb.aarch64.sve");
feature_pauth = tdesc_find_feature (tdesc, "org.gnu.gdb.aarch64.pauth");
@@ -3603,7 +3522,7 @@ aarch64_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
if (feature_fpu != nullptr)
{
if (feature_sve != nullptr)
- error (_("Program contains both fpu and SVE features."));
+ error (_ ("Program contains both fpu and SVE features."));
/* Validate the description provides the mandatory V registers
and allocate their numbers. */
@@ -3626,16 +3545,16 @@ aarch64_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
aarch64_sve_register_names[i]);
num_regs = AARCH64_SVE_Z0_REGNUM + i;
- num_pseudo_regs += 32; /* add the Vn register pseudos. */
+ num_pseudo_regs += 32; /* add the Vn register pseudos. */
}
if (feature_fpu != nullptr || feature_sve != nullptr)
{
- num_pseudo_regs += 32; /* add the Qn scalar register pseudos */
- num_pseudo_regs += 32; /* add the Dn scalar register pseudos */
- num_pseudo_regs += 32; /* add the Sn scalar register pseudos */
- num_pseudo_regs += 32; /* add the Hn scalar register pseudos */
- num_pseudo_regs += 32; /* add the Bn scalar register pseudos */
+ num_pseudo_regs += 32; /* add the Qn scalar register pseudos */
+ num_pseudo_regs += 32; /* add the Dn scalar register pseudos */
+ num_pseudo_regs += 32; /* add the Sn scalar register pseudos */
+ num_pseudo_regs += 32; /* add the Hn scalar register pseudos */
+ num_pseudo_regs += 32; /* add the Bn scalar register pseudos */
}
/* Add the TLS register. */
@@ -3646,9 +3565,8 @@ aarch64_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
/* Look for the TLS registers. tpidr is required, but tpidr2 is
optional. */
- valid_p
- = tdesc_numbered_register (feature_tls, tdesc_data.get (),
- first_tls_regnum, "tpidr");
+ valid_p = tdesc_numbered_register (feature_tls, tdesc_data.get (),
+ first_tls_regnum, "tpidr");
if (valid_p)
{
@@ -3667,8 +3585,8 @@ aarch64_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
}
else
{
- warning (_("Provided TLS register feature doesn't contain "
- "required tpidr register."));
+ warning (_ ("Provided TLS register feature doesn't contain "
+ "required tpidr register."));
return nullptr;
}
}
@@ -3686,7 +3604,7 @@ aarch64_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
aarch64_pauth_register_names[i]);
num_regs += i;
- num_pseudo_regs += 1; /* Count RA_STATE pseudo register. */
+ num_pseudo_regs += 1; /* Count RA_STATE pseudo register. */
}
/* Add the MTE registers. */
@@ -3702,9 +3620,9 @@ aarch64_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
num_regs += i;
}
- /* W pseudo-registers */
- int first_w_regnum = num_pseudo_regs;
- num_pseudo_regs += 31;
+ /* W pseudo-registers */
+ int first_w_regnum = num_pseudo_regs;
+ num_pseudo_regs += 31;
if (!valid_p)
return nullptr;
@@ -3718,7 +3636,7 @@ aarch64_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
/* This should be low enough for everything. */
tdep->lowest_pc = 0x20;
- tdep->jb_pc = -1; /* Longjump support not enabled by default. */
+ tdep->jb_pc = -1; /* Longjump support not enabled by default. */
tdep->jb_elt_size = 8;
tdep->vq = vq;
tdep->pauth_reg_base = first_pauth_regnum;
@@ -3775,7 +3693,8 @@ aarch64_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
set_gdbarch_type_align (gdbarch, aarch64_type_align);
/* Detect whether PC is at a point where the stack has been destroyed. */
- set_gdbarch_stack_frame_destroyed_p (gdbarch, aarch64_stack_frame_destroyed_p);
+ set_gdbarch_stack_frame_destroyed_p (gdbarch,
+ aarch64_stack_frame_destroyed_p);
/* Internal <-> external register number maps. */
set_gdbarch_dwarf2_reg_to_regnum (gdbarch, aarch64_dwarf_reg_to_regnum);
@@ -3796,8 +3715,8 @@ aarch64_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
dwarf2_frame_set_init_reg (gdbarch, aarch64_dwarf2_frame_init_reg);
/* Register DWARF CFA vendor handler. */
- set_gdbarch_execute_dwarf_cfa_vendor_op (gdbarch,
- aarch64_execute_dwarf_cfa_vendor_op);
+ set_gdbarch_execute_dwarf_cfa_vendor_op (
+ gdbarch, aarch64_execute_dwarf_cfa_vendor_op);
/* Permanent/Program breakpoint handling. */
set_gdbarch_program_breakpoint_here_p (gdbarch,
@@ -3857,7 +3776,7 @@ aarch64_dump_tdep (struct gdbarch *gdbarch, struct ui_file *file)
if (tdep == NULL)
return;
- gdb_printf (file, _("aarch64_dump_tdep: Lowest pc = 0x%s\n"),
+ gdb_printf (file, _ ("aarch64_dump_tdep: Lowest pc = 0x%s\n"),
paddress (gdbarch, tdep->lowest_pc));
}
@@ -3869,20 +3788,21 @@ static void aarch64_process_record_test (void);
#endif
void _initialize_aarch64_tdep ();
+
void
_initialize_aarch64_tdep ()
{
- gdbarch_register (bfd_arch_aarch64, aarch64_gdbarch_init,
- aarch64_dump_tdep);
+ gdbarch_register (bfd_arch_aarch64, aarch64_gdbarch_init, aarch64_dump_tdep);
/* Debug this file's internals. */
- add_setshow_boolean_cmd ("aarch64", class_maintenance, &aarch64_debug, _("\
-Set AArch64 debugging."), _("\
-Show AArch64 debugging."), _("\
+ add_setshow_boolean_cmd ("aarch64", class_maintenance, &aarch64_debug, _ ("\
+Set AArch64 debugging."),
+ _ ("\
+Show AArch64 debugging."),
+ _ ("\
When on, AArch64 specific debugging is enabled."),
- NULL,
- show_aarch64_debug,
- &setdebuglist, &showdebuglist);
+ NULL, show_aarch64_debug, &setdebuglist,
+ &showdebuglist);
#if GDB_SELF_TEST
selftests::register_test ("aarch64-analyze-prologue",
@@ -3894,37 +3814,37 @@ When on, AArch64 specific debugging is enabled."),
/* AArch64 process record-replay related structures, defines etc. */
-#define REG_ALLOC(REGS, LENGTH, RECORD_BUF) \
- do \
- { \
- unsigned int reg_len = LENGTH; \
- if (reg_len) \
- { \
- REGS = XNEWVEC (uint32_t, reg_len); \
- memcpy(&REGS[0], &RECORD_BUF[0], sizeof(uint32_t)*LENGTH); \
- } \
- } \
- while (0)
-
-#define MEM_ALLOC(MEMS, LENGTH, RECORD_BUF) \
- do \
- { \
- unsigned int mem_len = LENGTH; \
- if (mem_len) \
- { \
- MEMS = XNEWVEC (struct aarch64_mem_r, mem_len); \
- memcpy(MEMS, &RECORD_BUF[0], \
- sizeof(struct aarch64_mem_r) * LENGTH); \
- } \
- } \
- while (0)
+#define REG_ALLOC(REGS, LENGTH, RECORD_BUF) \
+ do \
+ { \
+ unsigned int reg_len = LENGTH; \
+ if (reg_len) \
+ { \
+ REGS = XNEWVEC (uint32_t, reg_len); \
+ memcpy (&REGS[0], &RECORD_BUF[0], sizeof (uint32_t) * LENGTH); \
+ } \
+ } \
+ while (0)
+
+#define MEM_ALLOC(MEMS, LENGTH, RECORD_BUF) \
+ do \
+ { \
+ unsigned int mem_len = LENGTH; \
+ if (mem_len) \
+ { \
+ MEMS = XNEWVEC (struct aarch64_mem_r, mem_len); \
+ memcpy (MEMS, &RECORD_BUF[0], \
+ sizeof (struct aarch64_mem_r) * LENGTH); \
+ } \
+ } \
+ while (0)
/* AArch64 record/replay structures and enumerations. */
struct aarch64_mem_r
{
- uint64_t len; /* Record length. */
- uint64_t addr; /* Memory address. */
+ uint64_t len; /* Record length. */
+ uint64_t addr; /* Memory address. */
};
enum aarch64_record_result
@@ -3938,12 +3858,12 @@ struct aarch64_insn_decode_record
{
struct gdbarch *gdbarch;
struct regcache *regcache;
- CORE_ADDR this_addr; /* Address of insn to be recorded. */
- uint32_t aarch64_insn; /* Insn to be recorded. */
- uint32_t mem_rec_count; /* Count of memory records. */
- uint32_t reg_rec_count; /* Count of register records. */
- uint32_t *aarch64_regs; /* Registers to be recorded. */
- struct aarch64_mem_r *aarch64_mems; /* Memory locations to be recorded. */
+ CORE_ADDR this_addr; /* Address of insn to be recorded. */
+ uint32_t aarch64_insn; /* Insn to be recorded. */
+ uint32_t mem_rec_count; /* Count of memory records. */
+ uint32_t reg_rec_count; /* Count of register records. */
+ uint32_t *aarch64_regs; /* Registers to be recorded. */
+ struct aarch64_mem_r *aarch64_mems; /* Memory locations to be recorded. */
};
/* Record handler for data processing - register instructions. */
@@ -4034,9 +3954,9 @@ aarch64_record_data_proc_imm (aarch64_insn_decode_record *aarch64_insn_r)
insn_bit23 = bit (aarch64_insn_r->aarch64_insn, 23);
insn_bits24_27 = bits (aarch64_insn_r->aarch64_insn, 24, 27);
- if (insn_bits24_27 == 0x00 /* PC rel addressing. */
- || insn_bits24_27 == 0x03 /* Bitfield and Extract. */
- || (insn_bits24_27 == 0x02 && insn_bit23)) /* Move wide (immediate). */
+ if (insn_bits24_27 == 0x00 /* PC rel addressing. */
+ || insn_bits24_27 == 0x03 /* Bitfield and Extract. */
+ || (insn_bits24_27 == 0x02 && insn_bit23)) /* Move wide (immediate). */
{
record_buf[0] = reg_rd;
aarch64_insn_r->reg_rec_count = 1;
@@ -4072,7 +3992,6 @@ aarch64_record_data_proc_imm (aarch64_insn_decode_record *aarch64_insn_r)
static unsigned int
aarch64_record_branch_except_sys (aarch64_insn_decode_record *aarch64_insn_r)
{
-
aarch64_gdbarch_tdep *tdep
= gdbarch_tdep<aarch64_gdbarch_tdep> (aarch64_insn_r->gdbarch);
uint8_t insn_bits24_27, insn_bits28_31, insn_bits22_23;
@@ -4123,7 +4042,7 @@ aarch64_record_branch_except_sys (aarch64_insn_decode_record *aarch64_insn_r)
}
}
/* Unconditional branch (register). */
- else if((insn_bits24_27 & 0x0e) == 0x06)
+ else if ((insn_bits24_27 & 0x0e) == 0x06)
{
record_buf[aarch64_insn_r->reg_rec_count++] = AARCH64_PC_REGNUM;
if (bits (aarch64_insn_r->aarch64_insn, 21, 22) == 0x01)
@@ -4176,8 +4095,8 @@ aarch64_record_asimd_load_store (aarch64_insn_decode_record *aarch64_insn_r)
{
uint8_t sindex, scale, selem, esize, replicate = 0;
scale = opcode_bits >> 2;
- selem = ((opcode_bits & 0x02) |
- bit (aarch64_insn_r->aarch64_insn, 21)) + 1;
+ selem
+ = ((opcode_bits & 0x02) | bit (aarch64_insn_r->aarch64_insn, 21)) + 1;
switch (scale)
{
case 1:
@@ -4470,8 +4389,8 @@ aarch64_record_load_store (aarch64_insn_decode_record *aarch64_insn_r)
if (record_debug)
{
debug_printf ("Process record: load/store (unsigned immediate):"
- " size %x V %d opc %x\n", size_bits, vector_flag,
- opc);
+ " size %x V %d opc %x\n",
+ size_bits, vector_flag, opc);
}
if (!ld_flag)
@@ -4508,18 +4427,19 @@ aarch64_record_load_store (aarch64_insn_decode_record *aarch64_insn_r)
ld_flag = 0x01;
else
ld_flag = 0x0;
+ else if (size_bits != 0x03)
+ ld_flag = 0x01;
else
- if (size_bits != 0x03)
- ld_flag = 0x01;
- else
- return AARCH64_RECORD_UNKNOWN;
+ return AARCH64_RECORD_UNKNOWN;
if (!ld_flag)
{
ULONGEST reg_rm_val;
regcache_raw_read_unsigned (aarch64_insn_r->regcache,
- bits (aarch64_insn_r->aarch64_insn, 16, 20), &reg_rm_val);
+ bits (aarch64_insn_r->aarch64_insn, 16,
+ 20),
+ &reg_rm_val);
if (bit (aarch64_insn_r->aarch64_insn, 12))
offset = reg_rm_val << size_bits;
else
@@ -4556,17 +4476,17 @@ aarch64_record_load_store (aarch64_insn_decode_record *aarch64_insn_r)
ld_flag = 0x01;
else
ld_flag = 0x0;
+ else if (size_bits != 0x03)
+ ld_flag = 0x01;
else
- if (size_bits != 0x03)
- ld_flag = 0x01;
- else
- return AARCH64_RECORD_UNKNOWN;
+ return AARCH64_RECORD_UNKNOWN;
if (!ld_flag)
{
uint16_t imm9_off;
imm9_off = bits (aarch64_insn_r->aarch64_insn, 12, 20);
- offset = (imm9_off & 0x0100) ? (((~imm9_off) & 0x01ff) + 1) : imm9_off;
+ offset
+ = (imm9_off & 0x0100) ? (((~imm9_off) & 0x01ff) + 1) : imm9_off;
datasize = 8 << size_bits;
regcache_raw_read_unsigned (aarch64_insn_r->regcache, reg_rn,
&address);
@@ -4801,7 +4721,8 @@ deallocate_reg_mem (aarch64_insn_decode_record *record)
}
#if GDB_SELF_TEST
-namespace selftests {
+namespace selftests
+{
static void
aarch64_process_record_test (void)
@@ -4852,8 +4773,7 @@ aarch64_process_record (struct gdbarch *gdbarch, struct regcache *regcache,
memset (&aarch64_record, 0, sizeof (aarch64_insn_decode_record));
target_read_memory (insn_addr, &buf[0], insn_size);
aarch64_record.aarch64_insn
- = (uint32_t) extract_unsigned_integer (&buf[0],
- insn_size,
+ = (uint32_t) extract_unsigned_integer (&buf[0], insn_size,
gdbarch_byte_order (gdbarch));
aarch64_record.regcache = regcache;
aarch64_record.this_addr = insn_addr;
@@ -4863,10 +4783,9 @@ aarch64_process_record (struct gdbarch *gdbarch, struct regcache *regcache,
if (ret == AARCH64_RECORD_UNSUPPORTED)
{
gdb_printf (gdb_stderr,
- _("Process record does not support instruction "
- "0x%0x at address %s.\n"),
- aarch64_record.aarch64_insn,
- paddress (gdbarch, insn_addr));
+ _ ("Process record does not support instruction "
+ "0x%0x at address %s.\n"),
+ aarch64_record.aarch64_insn, paddress (gdbarch, insn_addr));
ret = -1;
}
@@ -4880,16 +4799,16 @@ aarch64_process_record (struct gdbarch *gdbarch, struct regcache *regcache,
AARCH64_CPSR_REGNUM);
if (aarch64_record.aarch64_regs)
for (rec_no = 0; rec_no < aarch64_record.reg_rec_count; rec_no++)
- if (record_full_arch_list_add_reg (aarch64_record.regcache,
- aarch64_record.aarch64_regs[rec_no]))
+ if (record_full_arch_list_add_reg (
+ aarch64_record.regcache, aarch64_record.aarch64_regs[rec_no]))
ret = -1;
/* Record memories. */
if (aarch64_record.aarch64_mems)
for (rec_no = 0; rec_no < aarch64_record.mem_rec_count; rec_no++)
- if (record_full_arch_list_add_mem
- ((CORE_ADDR)aarch64_record.aarch64_mems[rec_no].addr,
- aarch64_record.aarch64_mems[rec_no].len))
+ if (record_full_arch_list_add_mem (
+ (CORE_ADDR) aarch64_record.aarch64_mems[rec_no].addr,
+ aarch64_record.aarch64_mems[rec_no].len))
ret = -1;
if (record_full_arch_list_add_end ())
diff --git a/gdb/aarch64-tdep.h b/gdb/aarch64-tdep.h
index 97b8d0c3793..5deac7ec936 100644
--- a/gdb/aarch64-tdep.h
+++ b/gdb/aarch64-tdep.h
@@ -18,7 +18,6 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
-
#ifndef AARCH64_TDEP_H
#define AARCH64_TDEP_H
@@ -32,22 +31,22 @@ struct gdbarch;
struct regset;
/* AArch64 Dwarf register numbering. */
-#define AARCH64_DWARF_X0 0
-#define AARCH64_DWARF_SP 31
-#define AARCH64_DWARF_PC 32
-#define AARCH64_DWARF_RA_SIGN_STATE 34
-#define AARCH64_DWARF_V0 64
-#define AARCH64_DWARF_SVE_VG 46
-#define AARCH64_DWARF_SVE_FFR 47
-#define AARCH64_DWARF_SVE_P0 48
-#define AARCH64_DWARF_SVE_Z0 96
+#define AARCH64_DWARF_X0 0
+#define AARCH64_DWARF_SP 31
+#define AARCH64_DWARF_PC 32
+#define AARCH64_DWARF_RA_SIGN_STATE 34
+#define AARCH64_DWARF_V0 64
+#define AARCH64_DWARF_SVE_VG 46
+#define AARCH64_DWARF_SVE_FFR 47
+#define AARCH64_DWARF_SVE_P0 48
+#define AARCH64_DWARF_SVE_Z0 96
/* Size of integer registers. */
-#define X_REGISTER_SIZE 8
-#define B_REGISTER_SIZE 1
-#define H_REGISTER_SIZE 2
-#define S_REGISTER_SIZE 4
-#define D_REGISTER_SIZE 8
+#define X_REGISTER_SIZE 8
+#define B_REGISTER_SIZE 1
+#define H_REGISTER_SIZE 2
+#define S_REGISTER_SIZE 4
+#define D_REGISTER_SIZE 8
#define Q_REGISTER_SIZE 16
/* Total number of general (X) registers. */
@@ -82,43 +81,32 @@ struct aarch64_gdbarch_tdep : gdbarch_tdep_base
/* syscall record. */
int (*aarch64_syscall_record) (struct regcache *regcache,
- unsigned long svc_number) = nullptr;
+ unsigned long svc_number)
+ = nullptr;
/* The VQ value for SVE targets, or zero if SVE is not supported. */
uint64_t vq = 0;
/* Returns true if the target supports SVE. */
- bool has_sve () const
- {
- return vq != 0;
- }
+ bool has_sve () const { return vq != 0; }
int pauth_reg_base = 0;
int ra_sign_state_regnum = 0;
/* Returns true if the target supports pauth. */
- bool has_pauth () const
- {
- return pauth_reg_base != -1;
- }
+ bool has_pauth () const { return pauth_reg_base != -1; }
/* First MTE register. This is -1 if no MTE registers are available. */
int mte_reg_base = 0;
/* Returns true if the target supports MTE. */
- bool has_mte () const
- {
- return mte_reg_base != -1;
- }
+ bool has_mte () const { return mte_reg_base != -1; }
/* TLS registers. This is -1 if the TLS registers are not available. */
int tls_regnum_base = 0;
int tls_register_count = 0;
- bool has_tls() const
- {
- return tls_regnum_base != -1;
- }
+ bool has_tls () const { return tls_regnum_base != -1; }
/* The W pseudo-registers. */
int w_pseudo_base = 0;
@@ -130,12 +118,11 @@ aarch64_features
aarch64_features_from_target_desc (const struct target_desc *tdesc);
extern int aarch64_process_record (struct gdbarch *gdbarch,
- struct regcache *regcache, CORE_ADDR addr);
+ struct regcache *regcache, CORE_ADDR addr);
displaced_step_copy_insn_closure_up
- aarch64_displaced_step_copy_insn (struct gdbarch *gdbarch,
- CORE_ADDR from, CORE_ADDR to,
- struct regcache *regs);
+aarch64_displaced_step_copy_insn (struct gdbarch *gdbarch, CORE_ADDR from,
+ CORE_ADDR to, struct regcache *regs);
void aarch64_displaced_step_fixup (struct gdbarch *gdbarch,
displaced_step_copy_insn_closure *dsc,
diff --git a/gdb/ada-casefold.h b/gdb/ada-casefold.h
index f7c1fca25f9..4ba9518bce2 100644
--- a/gdb/ada-casefold.h
+++ b/gdb/ada-casefold.h
@@ -1,5 +1,5 @@
/* *INDENT-OFF* */ /* THIS FILE IS GENERATED -*- buffer-read-only: t -*- */
-/* vi:set ro: */
+ /* vi:set ro: */
/* UTF-32 case-folding for GDB
@@ -24,1322 +24,447 @@
./ada-unicode.py
*/
- {65, 90, 0, 32},
- {97, 122, -32, 0},
- {181, 181, 743, 0},
- {192, 214, 0, 32},
- {216, 222, 0, 32},
- {224, 246, -32, 0},
- {248, 254, -32, 0},
- {255, 255, 121, 0},
- {256, 256, 0, 1},
- {257, 257, -1, 0},
- {258, 258, 0, 1},
- {259, 259, -1, 0},
- {260, 260, 0, 1},
- {261, 261, -1, 0},
- {262, 262, 0, 1},
- {263, 263, -1, 0},
- {264, 264, 0, 1},
- {265, 265, -1, 0},
- {266, 266, 0, 1},
- {267, 267, -1, 0},
- {268, 268, 0, 1},
- {269, 269, -1, 0},
- {270, 270, 0, 1},
- {271, 271, -1, 0},
- {272, 272, 0, 1},
- {273, 273, -1, 0},
- {274, 274, 0, 1},
- {275, 275, -1, 0},
- {276, 276, 0, 1},
- {277, 277, -1, 0},
- {278, 278, 0, 1},
- {279, 279, -1, 0},
- {280, 280, 0, 1},
- {281, 281, -1, 0},
- {282, 282, 0, 1},
- {283, 283, -1, 0},
- {284, 284, 0, 1},
- {285, 285, -1, 0},
- {286, 286, 0, 1},
- {287, 287, -1, 0},
- {288, 288, 0, 1},
- {289, 289, -1, 0},
- {290, 290, 0, 1},
- {291, 291, -1, 0},
- {292, 292, 0, 1},
- {293, 293, -1, 0},
- {294, 294, 0, 1},
- {295, 295, -1, 0},
- {296, 296, 0, 1},
- {297, 297, -1, 0},
- {298, 298, 0, 1},
- {299, 299, -1, 0},
- {300, 300, 0, 1},
- {301, 301, -1, 0},
- {302, 302, 0, 1},
- {303, 303, -1, 0},
- {305, 305, -232, 0},
- {306, 306, 0, 1},
- {307, 307, -1, 0},
- {308, 308, 0, 1},
- {309, 309, -1, 0},
- {310, 310, 0, 1},
- {311, 311, -1, 0},
- {313, 313, 0, 1},
- {314, 314, -1, 0},
- {315, 315, 0, 1},
- {316, 316, -1, 0},
- {317, 317, 0, 1},
- {318, 318, -1, 0},
- {319, 319, 0, 1},
- {320, 320, -1, 0},
- {321, 321, 0, 1},
- {322, 322, -1, 0},
- {323, 323, 0, 1},
- {324, 324, -1, 0},
- {325, 325, 0, 1},
- {326, 326, -1, 0},
- {327, 327, 0, 1},
- {328, 328, -1, 0},
- {330, 330, 0, 1},
- {331, 331, -1, 0},
- {332, 332, 0, 1},
- {333, 333, -1, 0},
- {334, 334, 0, 1},
- {335, 335, -1, 0},
- {336, 336, 0, 1},
- {337, 337, -1, 0},
- {338, 338, 0, 1},
- {339, 339, -1, 0},
- {340, 340, 0, 1},
- {341, 341, -1, 0},
- {342, 342, 0, 1},
- {343, 343, -1, 0},
- {344, 344, 0, 1},
- {345, 345, -1, 0},
- {346, 346, 0, 1},
- {347, 347, -1, 0},
- {348, 348, 0, 1},
- {349, 349, -1, 0},
- {350, 350, 0, 1},
- {351, 351, -1, 0},
- {352, 352, 0, 1},
- {353, 353, -1, 0},
- {354, 354, 0, 1},
- {355, 355, -1, 0},
- {356, 356, 0, 1},
- {357, 357, -1, 0},
- {358, 358, 0, 1},
- {359, 359, -1, 0},
- {360, 360, 0, 1},
- {361, 361, -1, 0},
- {362, 362, 0, 1},
- {363, 363, -1, 0},
- {364, 364, 0, 1},
- {365, 365, -1, 0},
- {366, 366, 0, 1},
- {367, 367, -1, 0},
- {368, 368, 0, 1},
- {369, 369, -1, 0},
- {370, 370, 0, 1},
- {371, 371, -1, 0},
- {372, 372, 0, 1},
- {373, 373, -1, 0},
- {374, 374, 0, 1},
- {375, 375, -1, 0},
- {376, 376, 0, -121},
- {377, 377, 0, 1},
- {378, 378, -1, 0},
- {379, 379, 0, 1},
- {380, 380, -1, 0},
- {381, 381, 0, 1},
- {382, 382, -1, 0},
- {383, 383, -300, 0},
- {384, 384, 195, 0},
- {385, 385, 0, 210},
- {386, 386, 0, 1},
- {387, 387, -1, 0},
- {388, 388, 0, 1},
- {389, 389, -1, 0},
- {390, 390, 0, 206},
- {391, 391, 0, 1},
- {392, 392, -1, 0},
- {393, 394, 0, 205},
- {395, 395, 0, 1},
- {396, 396, -1, 0},
- {398, 398, 0, 79},
- {399, 399, 0, 202},
- {400, 400, 0, 203},
- {401, 401, 0, 1},
- {402, 402, -1, 0},
- {403, 403, 0, 205},
- {404, 404, 0, 207},
- {405, 405, 97, 0},
- {406, 406, 0, 211},
- {407, 407, 0, 209},
- {408, 408, 0, 1},
- {409, 409, -1, 0},
- {410, 410, 163, 0},
- {412, 412, 0, 211},
- {413, 413, 0, 213},
- {414, 414, 130, 0},
- {415, 415, 0, 214},
- {416, 416, 0, 1},
- {417, 417, -1, 0},
- {418, 418, 0, 1},
- {419, 419, -1, 0},
- {420, 420, 0, 1},
- {421, 421, -1, 0},
- {422, 422, 0, 218},
- {423, 423, 0, 1},
- {424, 424, -1, 0},
- {425, 425, 0, 218},
- {428, 428, 0, 1},
- {429, 429, -1, 0},
- {430, 430, 0, 218},
- {431, 431, 0, 1},
- {432, 432, -1, 0},
- {433, 434, 0, 217},
- {435, 435, 0, 1},
- {436, 436, -1, 0},
- {437, 437, 0, 1},
- {438, 438, -1, 0},
- {439, 439, 0, 219},
- {440, 440, 0, 1},
- {441, 441, -1, 0},
- {444, 444, 0, 1},
- {445, 445, -1, 0},
- {447, 447, 56, 0},
- {452, 452, 0, 2},
- {453, 453, -1, 1},
- {454, 454, -2, 0},
- {455, 455, 0, 2},
- {456, 456, -1, 1},
- {457, 457, -2, 0},
- {458, 458, 0, 2},
- {459, 459, -1, 1},
- {460, 460, -2, 0},
- {461, 461, 0, 1},
- {462, 462, -1, 0},
- {463, 463, 0, 1},
- {464, 464, -1, 0},
- {465, 465, 0, 1},
- {466, 466, -1, 0},
- {467, 467, 0, 1},
- {468, 468, -1, 0},
- {469, 469, 0, 1},
- {470, 470, -1, 0},
- {471, 471, 0, 1},
- {472, 472, -1, 0},
- {473, 473, 0, 1},
- {474, 474, -1, 0},
- {475, 475, 0, 1},
- {476, 476, -1, 0},
- {477, 477, -79, 0},
- {478, 478, 0, 1},
- {479, 479, -1, 0},
- {480, 480, 0, 1},
- {481, 481, -1, 0},
- {482, 482, 0, 1},
- {483, 483, -1, 0},
- {484, 484, 0, 1},
- {485, 485, -1, 0},
- {486, 486, 0, 1},
- {487, 487, -1, 0},
- {488, 488, 0, 1},
- {489, 489, -1, 0},
- {490, 490, 0, 1},
- {491, 491, -1, 0},
- {492, 492, 0, 1},
- {493, 493, -1, 0},
- {494, 494, 0, 1},
- {495, 495, -1, 0},
- {497, 497, 0, 2},
- {498, 498, -1, 1},
- {499, 499, -2, 0},
- {500, 500, 0, 1},
- {501, 501, -1, 0},
- {502, 502, 0, -97},
- {503, 503, 0, -56},
- {504, 504, 0, 1},
- {505, 505, -1, 0},
- {506, 506, 0, 1},
- {507, 507, -1, 0},
- {508, 508, 0, 1},
- {509, 509, -1, 0},
- {510, 510, 0, 1},
- {511, 511, -1, 0},
- {512, 512, 0, 1},
- {513, 513, -1, 0},
- {514, 514, 0, 1},
- {515, 515, -1, 0},
- {516, 516, 0, 1},
- {517, 517, -1, 0},
- {518, 518, 0, 1},
- {519, 519, -1, 0},
- {520, 520, 0, 1},
- {521, 521, -1, 0},
- {522, 522, 0, 1},
- {523, 523, -1, 0},
- {524, 524, 0, 1},
- {525, 525, -1, 0},
- {526, 526, 0, 1},
- {527, 527, -1, 0},
- {528, 528, 0, 1},
- {529, 529, -1, 0},
- {530, 530, 0, 1},
- {531, 531, -1, 0},
- {532, 532, 0, 1},
- {533, 533, -1, 0},
- {534, 534, 0, 1},
- {535, 535, -1, 0},
- {536, 536, 0, 1},
- {537, 537, -1, 0},
- {538, 538, 0, 1},
- {539, 539, -1, 0},
- {540, 540, 0, 1},
- {541, 541, -1, 0},
- {542, 542, 0, 1},
- {543, 543, -1, 0},
- {544, 544, 0, -130},
- {546, 546, 0, 1},
- {547, 547, -1, 0},
- {548, 548, 0, 1},
- {549, 549, -1, 0},
- {550, 550, 0, 1},
- {551, 551, -1, 0},
- {552, 552, 0, 1},
- {553, 553, -1, 0},
- {554, 554, 0, 1},
- {555, 555, -1, 0},
- {556, 556, 0, 1},
- {557, 557, -1, 0},
- {558, 558, 0, 1},
- {559, 559, -1, 0},
- {560, 560, 0, 1},
- {561, 561, -1, 0},
- {562, 562, 0, 1},
- {563, 563, -1, 0},
- {570, 570, 0, 10795},
- {571, 571, 0, 1},
- {572, 572, -1, 0},
- {573, 573, 0, -163},
- {574, 574, 0, 10792},
- {575, 576, 10815, 0},
- {577, 577, 0, 1},
- {578, 578, -1, 0},
- {579, 579, 0, -195},
- {580, 580, 0, 69},
- {581, 581, 0, 71},
- {582, 582, 0, 1},
- {583, 583, -1, 0},
- {584, 584, 0, 1},
- {585, 585, -1, 0},
- {586, 586, 0, 1},
- {587, 587, -1, 0},
- {588, 588, 0, 1},
- {589, 589, -1, 0},
- {590, 590, 0, 1},
- {591, 591, -1, 0},
- {592, 592, 10783, 0},
- {593, 593, 10780, 0},
- {594, 594, 10782, 0},
- {595, 595, -210, 0},
- {596, 596, -206, 0},
- {598, 599, -205, 0},
- {601, 601, -202, 0},
- {603, 603, -203, 0},
- {604, 604, 42319, 0},
- {608, 608, -205, 0},
- {609, 609, 42315, 0},
- {611, 611, -207, 0},
- {613, 613, 42280, 0},
- {614, 614, 42308, 0},
- {616, 616, -209, 0},
- {617, 617, -211, 0},
- {618, 618, 42308, 0},
- {619, 619, 10743, 0},
- {620, 620, 42305, 0},
- {623, 623, -211, 0},
- {625, 625, 10749, 0},
- {626, 626, -213, 0},
- {629, 629, -214, 0},
- {637, 637, 10727, 0},
- {640, 640, -218, 0},
- {642, 642, 42307, 0},
- {643, 643, -218, 0},
- {647, 647, 42282, 0},
- {648, 648, -218, 0},
- {649, 649, -69, 0},
- {650, 651, -217, 0},
- {652, 652, -71, 0},
- {658, 658, -219, 0},
- {669, 669, 42261, 0},
- {670, 670, 42258, 0},
- {837, 837, 84, 0},
- {880, 880, 0, 1},
- {881, 881, -1, 0},
- {882, 882, 0, 1},
- {883, 883, -1, 0},
- {886, 886, 0, 1},
- {887, 887, -1, 0},
- {891, 893, 130, 0},
- {895, 895, 0, 116},
- {902, 902, 0, 38},
- {904, 906, 0, 37},
- {908, 908, 0, 64},
- {910, 911, 0, 63},
- {913, 929, 0, 32},
- {931, 939, 0, 32},
- {940, 940, -38, 0},
- {941, 943, -37, 0},
- {945, 961, -32, 0},
- {962, 962, -31, 0},
- {963, 971, -32, 0},
- {972, 972, -64, 0},
- {973, 974, -63, 0},
- {975, 975, 0, 8},
- {976, 976, -62, 0},
- {977, 977, -57, 0},
- {981, 981, -47, 0},
- {982, 982, -54, 0},
- {983, 983, -8, 0},
- {984, 984, 0, 1},
- {985, 985, -1, 0},
- {986, 986, 0, 1},
- {987, 987, -1, 0},
- {988, 988, 0, 1},
- {989, 989, -1, 0},
- {990, 990, 0, 1},
- {991, 991, -1, 0},
- {992, 992, 0, 1},
- {993, 993, -1, 0},
- {994, 994, 0, 1},
- {995, 995, -1, 0},
- {996, 996, 0, 1},
- {997, 997, -1, 0},
- {998, 998, 0, 1},
- {999, 999, -1, 0},
- {1000, 1000, 0, 1},
- {1001, 1001, -1, 0},
- {1002, 1002, 0, 1},
- {1003, 1003, -1, 0},
- {1004, 1004, 0, 1},
- {1005, 1005, -1, 0},
- {1006, 1006, 0, 1},
- {1007, 1007, -1, 0},
- {1008, 1008, -86, 0},
- {1009, 1009, -80, 0},
- {1010, 1010, 7, 0},
- {1011, 1011, -116, 0},
- {1012, 1012, 0, -60},
- {1013, 1013, -96, 0},
- {1015, 1015, 0, 1},
- {1016, 1016, -1, 0},
- {1017, 1017, 0, -7},
- {1018, 1018, 0, 1},
- {1019, 1019, -1, 0},
- {1021, 1023, 0, -130},
- {1024, 1039, 0, 80},
- {1040, 1071, 0, 32},
- {1072, 1103, -32, 0},
- {1104, 1119, -80, 0},
- {1120, 1120, 0, 1},
- {1121, 1121, -1, 0},
- {1122, 1122, 0, 1},
- {1123, 1123, -1, 0},
- {1124, 1124, 0, 1},
- {1125, 1125, -1, 0},
- {1126, 1126, 0, 1},
- {1127, 1127, -1, 0},
- {1128, 1128, 0, 1},
- {1129, 1129, -1, 0},
- {1130, 1130, 0, 1},
- {1131, 1131, -1, 0},
- {1132, 1132, 0, 1},
- {1133, 1133, -1, 0},
- {1134, 1134, 0, 1},
- {1135, 1135, -1, 0},
- {1136, 1136, 0, 1},
- {1137, 1137, -1, 0},
- {1138, 1138, 0, 1},
- {1139, 1139, -1, 0},
- {1140, 1140, 0, 1},
- {1141, 1141, -1, 0},
- {1142, 1142, 0, 1},
- {1143, 1143, -1, 0},
- {1144, 1144, 0, 1},
- {1145, 1145, -1, 0},
- {1146, 1146, 0, 1},
- {1147, 1147, -1, 0},
- {1148, 1148, 0, 1},
- {1149, 1149, -1, 0},
- {1150, 1150, 0, 1},
- {1151, 1151, -1, 0},
- {1152, 1152, 0, 1},
- {1153, 1153, -1, 0},
- {1162, 1162, 0, 1},
- {1163, 1163, -1, 0},
- {1164, 1164, 0, 1},
- {1165, 1165, -1, 0},
- {1166, 1166, 0, 1},
- {1167, 1167, -1, 0},
- {1168, 1168, 0, 1},
- {1169, 1169, -1, 0},
- {1170, 1170, 0, 1},
- {1171, 1171, -1, 0},
- {1172, 1172, 0, 1},
- {1173, 1173, -1, 0},
- {1174, 1174, 0, 1},
- {1175, 1175, -1, 0},
- {1176, 1176, 0, 1},
- {1177, 1177, -1, 0},
- {1178, 1178, 0, 1},
- {1179, 1179, -1, 0},
- {1180, 1180, 0, 1},
- {1181, 1181, -1, 0},
- {1182, 1182, 0, 1},
- {1183, 1183, -1, 0},
- {1184, 1184, 0, 1},
- {1185, 1185, -1, 0},
- {1186, 1186, 0, 1},
- {1187, 1187, -1, 0},
- {1188, 1188, 0, 1},
- {1189, 1189, -1, 0},
- {1190, 1190, 0, 1},
- {1191, 1191, -1, 0},
- {1192, 1192, 0, 1},
- {1193, 1193, -1, 0},
- {1194, 1194, 0, 1},
- {1195, 1195, -1, 0},
- {1196, 1196, 0, 1},
- {1197, 1197, -1, 0},
- {1198, 1198, 0, 1},
- {1199, 1199, -1, 0},
- {1200, 1200, 0, 1},
- {1201, 1201, -1, 0},
- {1202, 1202, 0, 1},
- {1203, 1203, -1, 0},
- {1204, 1204, 0, 1},
- {1205, 1205, -1, 0},
- {1206, 1206, 0, 1},
- {1207, 1207, -1, 0},
- {1208, 1208, 0, 1},
- {1209, 1209, -1, 0},
- {1210, 1210, 0, 1},
- {1211, 1211, -1, 0},
- {1212, 1212, 0, 1},
- {1213, 1213, -1, 0},
- {1214, 1214, 0, 1},
- {1215, 1215, -1, 0},
- {1216, 1216, 0, 15},
- {1217, 1217, 0, 1},
- {1218, 1218, -1, 0},
- {1219, 1219, 0, 1},
- {1220, 1220, -1, 0},
- {1221, 1221, 0, 1},
- {1222, 1222, -1, 0},
- {1223, 1223, 0, 1},
- {1224, 1224, -1, 0},
- {1225, 1225, 0, 1},
- {1226, 1226, -1, 0},
- {1227, 1227, 0, 1},
- {1228, 1228, -1, 0},
- {1229, 1229, 0, 1},
- {1230, 1230, -1, 0},
- {1231, 1231, -15, 0},
- {1232, 1232, 0, 1},
- {1233, 1233, -1, 0},
- {1234, 1234, 0, 1},
- {1235, 1235, -1, 0},
- {1236, 1236, 0, 1},
- {1237, 1237, -1, 0},
- {1238, 1238, 0, 1},
- {1239, 1239, -1, 0},
- {1240, 1240, 0, 1},
- {1241, 1241, -1, 0},
- {1242, 1242, 0, 1},
- {1243, 1243, -1, 0},
- {1244, 1244, 0, 1},
- {1245, 1245, -1, 0},
- {1246, 1246, 0, 1},
- {1247, 1247, -1, 0},
- {1248, 1248, 0, 1},
- {1249, 1249, -1, 0},
- {1250, 1250, 0, 1},
- {1251, 1251, -1, 0},
- {1252, 1252, 0, 1},
- {1253, 1253, -1, 0},
- {1254, 1254, 0, 1},
- {1255, 1255, -1, 0},
- {1256, 1256, 0, 1},
- {1257, 1257, -1, 0},
- {1258, 1258, 0, 1},
- {1259, 1259, -1, 0},
- {1260, 1260, 0, 1},
- {1261, 1261, -1, 0},
- {1262, 1262, 0, 1},
- {1263, 1263, -1, 0},
- {1264, 1264, 0, 1},
- {1265, 1265, -1, 0},
- {1266, 1266, 0, 1},
- {1267, 1267, -1, 0},
- {1268, 1268, 0, 1},
- {1269, 1269, -1, 0},
- {1270, 1270, 0, 1},
- {1271, 1271, -1, 0},
- {1272, 1272, 0, 1},
- {1273, 1273, -1, 0},
- {1274, 1274, 0, 1},
- {1275, 1275, -1, 0},
- {1276, 1276, 0, 1},
- {1277, 1277, -1, 0},
- {1278, 1278, 0, 1},
- {1279, 1279, -1, 0},
- {1280, 1280, 0, 1},
- {1281, 1281, -1, 0},
- {1282, 1282, 0, 1},
- {1283, 1283, -1, 0},
- {1284, 1284, 0, 1},
- {1285, 1285, -1, 0},
- {1286, 1286, 0, 1},
- {1287, 1287, -1, 0},
- {1288, 1288, 0, 1},
- {1289, 1289, -1, 0},
- {1290, 1290, 0, 1},
- {1291, 1291, -1, 0},
- {1292, 1292, 0, 1},
- {1293, 1293, -1, 0},
- {1294, 1294, 0, 1},
- {1295, 1295, -1, 0},
- {1296, 1296, 0, 1},
- {1297, 1297, -1, 0},
- {1298, 1298, 0, 1},
- {1299, 1299, -1, 0},
- {1300, 1300, 0, 1},
- {1301, 1301, -1, 0},
- {1302, 1302, 0, 1},
- {1303, 1303, -1, 0},
- {1304, 1304, 0, 1},
- {1305, 1305, -1, 0},
- {1306, 1306, 0, 1},
- {1307, 1307, -1, 0},
- {1308, 1308, 0, 1},
- {1309, 1309, -1, 0},
- {1310, 1310, 0, 1},
- {1311, 1311, -1, 0},
- {1312, 1312, 0, 1},
- {1313, 1313, -1, 0},
- {1314, 1314, 0, 1},
- {1315, 1315, -1, 0},
- {1316, 1316, 0, 1},
- {1317, 1317, -1, 0},
- {1318, 1318, 0, 1},
- {1319, 1319, -1, 0},
- {1320, 1320, 0, 1},
- {1321, 1321, -1, 0},
- {1322, 1322, 0, 1},
- {1323, 1323, -1, 0},
- {1324, 1324, 0, 1},
- {1325, 1325, -1, 0},
- {1326, 1326, 0, 1},
- {1327, 1327, -1, 0},
- {1329, 1366, 0, 48},
- {1377, 1414, -48, 0},
- {4256, 4293, 0, 7264},
- {4295, 4295, 0, 7264},
- {4301, 4301, 0, 7264},
- {4304, 4346, 3008, 0},
- {4349, 4351, 3008, 0},
- {5024, 5103, 0, 38864},
- {5104, 5109, 0, 8},
- {5112, 5117, -8, 0},
- {7296, 7296, -6254, 0},
- {7297, 7297, -6253, 0},
- {7298, 7298, -6244, 0},
- {7299, 7300, -6242, 0},
- {7301, 7301, -6243, 0},
- {7302, 7302, -6236, 0},
- {7303, 7303, -6181, 0},
- {7304, 7304, 35266, 0},
- {7312, 7354, 0, -3008},
- {7357, 7359, 0, -3008},
- {7545, 7545, 35332, 0},
- {7549, 7549, 3814, 0},
- {7566, 7566, 35384, 0},
- {7680, 7680, 0, 1},
- {7681, 7681, -1, 0},
- {7682, 7682, 0, 1},
- {7683, 7683, -1, 0},
- {7684, 7684, 0, 1},
- {7685, 7685, -1, 0},
- {7686, 7686, 0, 1},
- {7687, 7687, -1, 0},
- {7688, 7688, 0, 1},
- {7689, 7689, -1, 0},
- {7690, 7690, 0, 1},
- {7691, 7691, -1, 0},
- {7692, 7692, 0, 1},
- {7693, 7693, -1, 0},
- {7694, 7694, 0, 1},
- {7695, 7695, -1, 0},
- {7696, 7696, 0, 1},
- {7697, 7697, -1, 0},
- {7698, 7698, 0, 1},
- {7699, 7699, -1, 0},
- {7700, 7700, 0, 1},
- {7701, 7701, -1, 0},
- {7702, 7702, 0, 1},
- {7703, 7703, -1, 0},
- {7704, 7704, 0, 1},
- {7705, 7705, -1, 0},
- {7706, 7706, 0, 1},
- {7707, 7707, -1, 0},
- {7708, 7708, 0, 1},
- {7709, 7709, -1, 0},
- {7710, 7710, 0, 1},
- {7711, 7711, -1, 0},
- {7712, 7712, 0, 1},
- {7713, 7713, -1, 0},
- {7714, 7714, 0, 1},
- {7715, 7715, -1, 0},
- {7716, 7716, 0, 1},
- {7717, 7717, -1, 0},
- {7718, 7718, 0, 1},
- {7719, 7719, -1, 0},
- {7720, 7720, 0, 1},
- {7721, 7721, -1, 0},
- {7722, 7722, 0, 1},
- {7723, 7723, -1, 0},
- {7724, 7724, 0, 1},
- {7725, 7725, -1, 0},
- {7726, 7726, 0, 1},
- {7727, 7727, -1, 0},
- {7728, 7728, 0, 1},
- {7729, 7729, -1, 0},
- {7730, 7730, 0, 1},
- {7731, 7731, -1, 0},
- {7732, 7732, 0, 1},
- {7733, 7733, -1, 0},
- {7734, 7734, 0, 1},
- {7735, 7735, -1, 0},
- {7736, 7736, 0, 1},
- {7737, 7737, -1, 0},
- {7738, 7738, 0, 1},
- {7739, 7739, -1, 0},
- {7740, 7740, 0, 1},
- {7741, 7741, -1, 0},
- {7742, 7742, 0, 1},
- {7743, 7743, -1, 0},
- {7744, 7744, 0, 1},
- {7745, 7745, -1, 0},
- {7746, 7746, 0, 1},
- {7747, 7747, -1, 0},
- {7748, 7748, 0, 1},
- {7749, 7749, -1, 0},
- {7750, 7750, 0, 1},
- {7751, 7751, -1, 0},
- {7752, 7752, 0, 1},
- {7753, 7753, -1, 0},
- {7754, 7754, 0, 1},
- {7755, 7755, -1, 0},
- {7756, 7756, 0, 1},
- {7757, 7757, -1, 0},
- {7758, 7758, 0, 1},
- {7759, 7759, -1, 0},
- {7760, 7760, 0, 1},
- {7761, 7761, -1, 0},
- {7762, 7762, 0, 1},
- {7763, 7763, -1, 0},
- {7764, 7764, 0, 1},
- {7765, 7765, -1, 0},
- {7766, 7766, 0, 1},
- {7767, 7767, -1, 0},
- {7768, 7768, 0, 1},
- {7769, 7769, -1, 0},
- {7770, 7770, 0, 1},
- {7771, 7771, -1, 0},
- {7772, 7772, 0, 1},
- {7773, 7773, -1, 0},
- {7774, 7774, 0, 1},
- {7775, 7775, -1, 0},
- {7776, 7776, 0, 1},
- {7777, 7777, -1, 0},
- {7778, 7778, 0, 1},
- {7779, 7779, -1, 0},
- {7780, 7780, 0, 1},
- {7781, 7781, -1, 0},
- {7782, 7782, 0, 1},
- {7783, 7783, -1, 0},
- {7784, 7784, 0, 1},
- {7785, 7785, -1, 0},
- {7786, 7786, 0, 1},
- {7787, 7787, -1, 0},
- {7788, 7788, 0, 1},
- {7789, 7789, -1, 0},
- {7790, 7790, 0, 1},
- {7791, 7791, -1, 0},
- {7792, 7792, 0, 1},
- {7793, 7793, -1, 0},
- {7794, 7794, 0, 1},
- {7795, 7795, -1, 0},
- {7796, 7796, 0, 1},
- {7797, 7797, -1, 0},
- {7798, 7798, 0, 1},
- {7799, 7799, -1, 0},
- {7800, 7800, 0, 1},
- {7801, 7801, -1, 0},
- {7802, 7802, 0, 1},
- {7803, 7803, -1, 0},
- {7804, 7804, 0, 1},
- {7805, 7805, -1, 0},
- {7806, 7806, 0, 1},
- {7807, 7807, -1, 0},
- {7808, 7808, 0, 1},
- {7809, 7809, -1, 0},
- {7810, 7810, 0, 1},
- {7811, 7811, -1, 0},
- {7812, 7812, 0, 1},
- {7813, 7813, -1, 0},
- {7814, 7814, 0, 1},
- {7815, 7815, -1, 0},
- {7816, 7816, 0, 1},
- {7817, 7817, -1, 0},
- {7818, 7818, 0, 1},
- {7819, 7819, -1, 0},
- {7820, 7820, 0, 1},
- {7821, 7821, -1, 0},
- {7822, 7822, 0, 1},
- {7823, 7823, -1, 0},
- {7824, 7824, 0, 1},
- {7825, 7825, -1, 0},
- {7826, 7826, 0, 1},
- {7827, 7827, -1, 0},
- {7828, 7828, 0, 1},
- {7829, 7829, -1, 0},
- {7835, 7835, -59, 0},
- {7838, 7838, 0, -7615},
- {7840, 7840, 0, 1},
- {7841, 7841, -1, 0},
- {7842, 7842, 0, 1},
- {7843, 7843, -1, 0},
- {7844, 7844, 0, 1},
- {7845, 7845, -1, 0},
- {7846, 7846, 0, 1},
- {7847, 7847, -1, 0},
- {7848, 7848, 0, 1},
- {7849, 7849, -1, 0},
- {7850, 7850, 0, 1},
- {7851, 7851, -1, 0},
- {7852, 7852, 0, 1},
- {7853, 7853, -1, 0},
- {7854, 7854, 0, 1},
- {7855, 7855, -1, 0},
- {7856, 7856, 0, 1},
- {7857, 7857, -1, 0},
- {7858, 7858, 0, 1},
- {7859, 7859, -1, 0},
- {7860, 7860, 0, 1},
- {7861, 7861, -1, 0},
- {7862, 7862, 0, 1},
- {7863, 7863, -1, 0},
- {7864, 7864, 0, 1},
- {7865, 7865, -1, 0},
- {7866, 7866, 0, 1},
- {7867, 7867, -1, 0},
- {7868, 7868, 0, 1},
- {7869, 7869, -1, 0},
- {7870, 7870, 0, 1},
- {7871, 7871, -1, 0},
- {7872, 7872, 0, 1},
- {7873, 7873, -1, 0},
- {7874, 7874, 0, 1},
- {7875, 7875, -1, 0},
- {7876, 7876, 0, 1},
- {7877, 7877, -1, 0},
- {7878, 7878, 0, 1},
- {7879, 7879, -1, 0},
- {7880, 7880, 0, 1},
- {7881, 7881, -1, 0},
- {7882, 7882, 0, 1},
- {7883, 7883, -1, 0},
- {7884, 7884, 0, 1},
- {7885, 7885, -1, 0},
- {7886, 7886, 0, 1},
- {7887, 7887, -1, 0},
- {7888, 7888, 0, 1},
- {7889, 7889, -1, 0},
- {7890, 7890, 0, 1},
- {7891, 7891, -1, 0},
- {7892, 7892, 0, 1},
- {7893, 7893, -1, 0},
- {7894, 7894, 0, 1},
- {7895, 7895, -1, 0},
- {7896, 7896, 0, 1},
- {7897, 7897, -1, 0},
- {7898, 7898, 0, 1},
- {7899, 7899, -1, 0},
- {7900, 7900, 0, 1},
- {7901, 7901, -1, 0},
- {7902, 7902, 0, 1},
- {7903, 7903, -1, 0},
- {7904, 7904, 0, 1},
- {7905, 7905, -1, 0},
- {7906, 7906, 0, 1},
- {7907, 7907, -1, 0},
- {7908, 7908, 0, 1},
- {7909, 7909, -1, 0},
- {7910, 7910, 0, 1},
- {7911, 7911, -1, 0},
- {7912, 7912, 0, 1},
- {7913, 7913, -1, 0},
- {7914, 7914, 0, 1},
- {7915, 7915, -1, 0},
- {7916, 7916, 0, 1},
- {7917, 7917, -1, 0},
- {7918, 7918, 0, 1},
- {7919, 7919, -1, 0},
- {7920, 7920, 0, 1},
- {7921, 7921, -1, 0},
- {7922, 7922, 0, 1},
- {7923, 7923, -1, 0},
- {7924, 7924, 0, 1},
- {7925, 7925, -1, 0},
- {7926, 7926, 0, 1},
- {7927, 7927, -1, 0},
- {7928, 7928, 0, 1},
- {7929, 7929, -1, 0},
- {7930, 7930, 0, 1},
- {7931, 7931, -1, 0},
- {7932, 7932, 0, 1},
- {7933, 7933, -1, 0},
- {7934, 7934, 0, 1},
- {7935, 7935, -1, 0},
- {7936, 7943, 8, 0},
- {7944, 7951, 0, -8},
- {7952, 7957, 8, 0},
- {7960, 7965, 0, -8},
- {7968, 7975, 8, 0},
- {7976, 7983, 0, -8},
- {7984, 7991, 8, 0},
- {7992, 7999, 0, -8},
- {8000, 8005, 8, 0},
- {8008, 8013, 0, -8},
- {8017, 8017, 8, 0},
- {8019, 8019, 8, 0},
- {8021, 8021, 8, 0},
- {8023, 8023, 8, 0},
- {8025, 8025, 0, -8},
- {8027, 8027, 0, -8},
- {8029, 8029, 0, -8},
- {8031, 8031, 0, -8},
- {8032, 8039, 8, 0},
- {8040, 8047, 0, -8},
- {8048, 8049, 74, 0},
- {8050, 8053, 86, 0},
- {8054, 8055, 100, 0},
- {8056, 8057, 128, 0},
- {8058, 8059, 112, 0},
- {8060, 8061, 126, 0},
- {8112, 8113, 8, 0},
- {8120, 8121, 0, -8},
- {8122, 8123, 0, -74},
- {8126, 8126, -7205, 0},
- {8136, 8139, 0, -86},
- {8144, 8145, 8, 0},
- {8152, 8153, 0, -8},
- {8154, 8155, 0, -100},
- {8160, 8161, 8, 0},
- {8165, 8165, 7, 0},
- {8168, 8169, 0, -8},
- {8170, 8171, 0, -112},
- {8172, 8172, 0, -7},
- {8184, 8185, 0, -128},
- {8186, 8187, 0, -126},
- {8486, 8486, 0, -7517},
- {8490, 8490, 0, -8383},
- {8491, 8491, 0, -8262},
- {8498, 8498, 0, 28},
- {8526, 8526, -28, 0},
- {8544, 8559, 0, 16},
- {8560, 8575, -16, 0},
- {8579, 8579, 0, 1},
- {8580, 8580, -1, 0},
- {9398, 9423, 0, 26},
- {9424, 9449, -26, 0},
- {11264, 11310, 0, 48},
- {11312, 11358, -48, 0},
- {11360, 11360, 0, 1},
- {11361, 11361, -1, 0},
- {11362, 11362, 0, -10743},
- {11363, 11363, 0, -3814},
- {11364, 11364, 0, -10727},
- {11365, 11365, -10795, 0},
- {11366, 11366, -10792, 0},
- {11367, 11367, 0, 1},
- {11368, 11368, -1, 0},
- {11369, 11369, 0, 1},
- {11370, 11370, -1, 0},
- {11371, 11371, 0, 1},
- {11372, 11372, -1, 0},
- {11373, 11373, 0, -10780},
- {11374, 11374, 0, -10749},
- {11375, 11375, 0, -10783},
- {11376, 11376, 0, -10782},
- {11378, 11378, 0, 1},
- {11379, 11379, -1, 0},
- {11381, 11381, 0, 1},
- {11382, 11382, -1, 0},
- {11390, 11391, 0, -10815},
- {11392, 11392, 0, 1},
- {11393, 11393, -1, 0},
- {11394, 11394, 0, 1},
- {11395, 11395, -1, 0},
- {11396, 11396, 0, 1},
- {11397, 11397, -1, 0},
- {11398, 11398, 0, 1},
- {11399, 11399, -1, 0},
- {11400, 11400, 0, 1},
- {11401, 11401, -1, 0},
- {11402, 11402, 0, 1},
- {11403, 11403, -1, 0},
- {11404, 11404, 0, 1},
- {11405, 11405, -1, 0},
- {11406, 11406, 0, 1},
- {11407, 11407, -1, 0},
- {11408, 11408, 0, 1},
- {11409, 11409, -1, 0},
- {11410, 11410, 0, 1},
- {11411, 11411, -1, 0},
- {11412, 11412, 0, 1},
- {11413, 11413, -1, 0},
- {11414, 11414, 0, 1},
- {11415, 11415, -1, 0},
- {11416, 11416, 0, 1},
- {11417, 11417, -1, 0},
- {11418, 11418, 0, 1},
- {11419, 11419, -1, 0},
- {11420, 11420, 0, 1},
- {11421, 11421, -1, 0},
- {11422, 11422, 0, 1},
- {11423, 11423, -1, 0},
- {11424, 11424, 0, 1},
- {11425, 11425, -1, 0},
- {11426, 11426, 0, 1},
- {11427, 11427, -1, 0},
- {11428, 11428, 0, 1},
- {11429, 11429, -1, 0},
- {11430, 11430, 0, 1},
- {11431, 11431, -1, 0},
- {11432, 11432, 0, 1},
- {11433, 11433, -1, 0},
- {11434, 11434, 0, 1},
- {11435, 11435, -1, 0},
- {11436, 11436, 0, 1},
- {11437, 11437, -1, 0},
- {11438, 11438, 0, 1},
- {11439, 11439, -1, 0},
- {11440, 11440, 0, 1},
- {11441, 11441, -1, 0},
- {11442, 11442, 0, 1},
- {11443, 11443, -1, 0},
- {11444, 11444, 0, 1},
- {11445, 11445, -1, 0},
- {11446, 11446, 0, 1},
- {11447, 11447, -1, 0},
- {11448, 11448, 0, 1},
- {11449, 11449, -1, 0},
- {11450, 11450, 0, 1},
- {11451, 11451, -1, 0},
- {11452, 11452, 0, 1},
- {11453, 11453, -1, 0},
- {11454, 11454, 0, 1},
- {11455, 11455, -1, 0},
- {11456, 11456, 0, 1},
- {11457, 11457, -1, 0},
- {11458, 11458, 0, 1},
- {11459, 11459, -1, 0},
- {11460, 11460, 0, 1},
- {11461, 11461, -1, 0},
- {11462, 11462, 0, 1},
- {11463, 11463, -1, 0},
- {11464, 11464, 0, 1},
- {11465, 11465, -1, 0},
- {11466, 11466, 0, 1},
- {11467, 11467, -1, 0},
- {11468, 11468, 0, 1},
- {11469, 11469, -1, 0},
- {11470, 11470, 0, 1},
- {11471, 11471, -1, 0},
- {11472, 11472, 0, 1},
- {11473, 11473, -1, 0},
- {11474, 11474, 0, 1},
- {11475, 11475, -1, 0},
- {11476, 11476, 0, 1},
- {11477, 11477, -1, 0},
- {11478, 11478, 0, 1},
- {11479, 11479, -1, 0},
- {11480, 11480, 0, 1},
- {11481, 11481, -1, 0},
- {11482, 11482, 0, 1},
- {11483, 11483, -1, 0},
- {11484, 11484, 0, 1},
- {11485, 11485, -1, 0},
- {11486, 11486, 0, 1},
- {11487, 11487, -1, 0},
- {11488, 11488, 0, 1},
- {11489, 11489, -1, 0},
- {11490, 11490, 0, 1},
- {11491, 11491, -1, 0},
- {11499, 11499, 0, 1},
- {11500, 11500, -1, 0},
- {11501, 11501, 0, 1},
- {11502, 11502, -1, 0},
- {11506, 11506, 0, 1},
- {11507, 11507, -1, 0},
- {11520, 11557, -7264, 0},
- {11559, 11559, -7264, 0},
- {11565, 11565, -7264, 0},
- {42560, 42560, 0, 1},
- {42561, 42561, -1, 0},
- {42562, 42562, 0, 1},
- {42563, 42563, -1, 0},
- {42564, 42564, 0, 1},
- {42565, 42565, -1, 0},
- {42566, 42566, 0, 1},
- {42567, 42567, -1, 0},
- {42568, 42568, 0, 1},
- {42569, 42569, -1, 0},
- {42570, 42570, 0, 1},
- {42571, 42571, -1, 0},
- {42572, 42572, 0, 1},
- {42573, 42573, -1, 0},
- {42574, 42574, 0, 1},
- {42575, 42575, -1, 0},
- {42576, 42576, 0, 1},
- {42577, 42577, -1, 0},
- {42578, 42578, 0, 1},
- {42579, 42579, -1, 0},
- {42580, 42580, 0, 1},
- {42581, 42581, -1, 0},
- {42582, 42582, 0, 1},
- {42583, 42583, -1, 0},
- {42584, 42584, 0, 1},
- {42585, 42585, -1, 0},
- {42586, 42586, 0, 1},
- {42587, 42587, -1, 0},
- {42588, 42588, 0, 1},
- {42589, 42589, -1, 0},
- {42590, 42590, 0, 1},
- {42591, 42591, -1, 0},
- {42592, 42592, 0, 1},
- {42593, 42593, -1, 0},
- {42594, 42594, 0, 1},
- {42595, 42595, -1, 0},
- {42596, 42596, 0, 1},
- {42597, 42597, -1, 0},
- {42598, 42598, 0, 1},
- {42599, 42599, -1, 0},
- {42600, 42600, 0, 1},
- {42601, 42601, -1, 0},
- {42602, 42602, 0, 1},
- {42603, 42603, -1, 0},
- {42604, 42604, 0, 1},
- {42605, 42605, -1, 0},
- {42624, 42624, 0, 1},
- {42625, 42625, -1, 0},
- {42626, 42626, 0, 1},
- {42627, 42627, -1, 0},
- {42628, 42628, 0, 1},
- {42629, 42629, -1, 0},
- {42630, 42630, 0, 1},
- {42631, 42631, -1, 0},
- {42632, 42632, 0, 1},
- {42633, 42633, -1, 0},
- {42634, 42634, 0, 1},
- {42635, 42635, -1, 0},
- {42636, 42636, 0, 1},
- {42637, 42637, -1, 0},
- {42638, 42638, 0, 1},
- {42639, 42639, -1, 0},
- {42640, 42640, 0, 1},
- {42641, 42641, -1, 0},
- {42642, 42642, 0, 1},
- {42643, 42643, -1, 0},
- {42644, 42644, 0, 1},
- {42645, 42645, -1, 0},
- {42646, 42646, 0, 1},
- {42647, 42647, -1, 0},
- {42648, 42648, 0, 1},
- {42649, 42649, -1, 0},
- {42650, 42650, 0, 1},
- {42651, 42651, -1, 0},
- {42786, 42786, 0, 1},
- {42787, 42787, -1, 0},
- {42788, 42788, 0, 1},
- {42789, 42789, -1, 0},
- {42790, 42790, 0, 1},
- {42791, 42791, -1, 0},
- {42792, 42792, 0, 1},
- {42793, 42793, -1, 0},
- {42794, 42794, 0, 1},
- {42795, 42795, -1, 0},
- {42796, 42796, 0, 1},
- {42797, 42797, -1, 0},
- {42798, 42798, 0, 1},
- {42799, 42799, -1, 0},
- {42802, 42802, 0, 1},
- {42803, 42803, -1, 0},
- {42804, 42804, 0, 1},
- {42805, 42805, -1, 0},
- {42806, 42806, 0, 1},
- {42807, 42807, -1, 0},
- {42808, 42808, 0, 1},
- {42809, 42809, -1, 0},
- {42810, 42810, 0, 1},
- {42811, 42811, -1, 0},
- {42812, 42812, 0, 1},
- {42813, 42813, -1, 0},
- {42814, 42814, 0, 1},
- {42815, 42815, -1, 0},
- {42816, 42816, 0, 1},
- {42817, 42817, -1, 0},
- {42818, 42818, 0, 1},
- {42819, 42819, -1, 0},
- {42820, 42820, 0, 1},
- {42821, 42821, -1, 0},
- {42822, 42822, 0, 1},
- {42823, 42823, -1, 0},
- {42824, 42824, 0, 1},
- {42825, 42825, -1, 0},
- {42826, 42826, 0, 1},
- {42827, 42827, -1, 0},
- {42828, 42828, 0, 1},
- {42829, 42829, -1, 0},
- {42830, 42830, 0, 1},
- {42831, 42831, -1, 0},
- {42832, 42832, 0, 1},
- {42833, 42833, -1, 0},
- {42834, 42834, 0, 1},
- {42835, 42835, -1, 0},
- {42836, 42836, 0, 1},
- {42837, 42837, -1, 0},
- {42838, 42838, 0, 1},
- {42839, 42839, -1, 0},
- {42840, 42840, 0, 1},
- {42841, 42841, -1, 0},
- {42842, 42842, 0, 1},
- {42843, 42843, -1, 0},
- {42844, 42844, 0, 1},
- {42845, 42845, -1, 0},
- {42846, 42846, 0, 1},
- {42847, 42847, -1, 0},
- {42848, 42848, 0, 1},
- {42849, 42849, -1, 0},
- {42850, 42850, 0, 1},
- {42851, 42851, -1, 0},
- {42852, 42852, 0, 1},
- {42853, 42853, -1, 0},
- {42854, 42854, 0, 1},
- {42855, 42855, -1, 0},
- {42856, 42856, 0, 1},
- {42857, 42857, -1, 0},
- {42858, 42858, 0, 1},
- {42859, 42859, -1, 0},
- {42860, 42860, 0, 1},
- {42861, 42861, -1, 0},
- {42862, 42862, 0, 1},
- {42863, 42863, -1, 0},
- {42873, 42873, 0, 1},
- {42874, 42874, -1, 0},
- {42875, 42875, 0, 1},
- {42876, 42876, -1, 0},
- {42877, 42877, 0, -35332},
- {42878, 42878, 0, 1},
- {42879, 42879, -1, 0},
- {42880, 42880, 0, 1},
- {42881, 42881, -1, 0},
- {42882, 42882, 0, 1},
- {42883, 42883, -1, 0},
- {42884, 42884, 0, 1},
- {42885, 42885, -1, 0},
- {42886, 42886, 0, 1},
- {42887, 42887, -1, 0},
- {42891, 42891, 0, 1},
- {42892, 42892, -1, 0},
- {42893, 42893, 0, -42280},
- {42896, 42896, 0, 1},
- {42897, 42897, -1, 0},
- {42898, 42898, 0, 1},
- {42899, 42899, -1, 0},
- {42900, 42900, 48, 0},
- {42902, 42902, 0, 1},
- {42903, 42903, -1, 0},
- {42904, 42904, 0, 1},
- {42905, 42905, -1, 0},
- {42906, 42906, 0, 1},
- {42907, 42907, -1, 0},
- {42908, 42908, 0, 1},
- {42909, 42909, -1, 0},
- {42910, 42910, 0, 1},
- {42911, 42911, -1, 0},
- {42912, 42912, 0, 1},
- {42913, 42913, -1, 0},
- {42914, 42914, 0, 1},
- {42915, 42915, -1, 0},
- {42916, 42916, 0, 1},
- {42917, 42917, -1, 0},
- {42918, 42918, 0, 1},
- {42919, 42919, -1, 0},
- {42920, 42920, 0, 1},
- {42921, 42921, -1, 0},
- {42922, 42922, 0, -42308},
- {42923, 42923, 0, -42319},
- {42924, 42924, 0, -42315},
- {42925, 42925, 0, -42305},
- {42926, 42926, 0, -42308},
- {42928, 42928, 0, -42258},
- {42929, 42929, 0, -42282},
- {42930, 42930, 0, -42261},
- {42931, 42931, 0, 928},
- {42932, 42932, 0, 1},
- {42933, 42933, -1, 0},
- {42934, 42934, 0, 1},
- {42935, 42935, -1, 0},
- {42936, 42936, 0, 1},
- {42937, 42937, -1, 0},
- {42938, 42938, 0, 1},
- {42939, 42939, -1, 0},
- {42940, 42940, 0, 1},
- {42941, 42941, -1, 0},
- {42942, 42942, 0, 1},
- {42943, 42943, -1, 0},
- {42946, 42946, 0, 1},
- {42947, 42947, -1, 0},
- {42948, 42948, 0, -48},
- {42949, 42949, 0, -42307},
- {42950, 42950, 0, -35384},
- {42951, 42951, 0, 1},
- {42952, 42952, -1, 0},
- {42953, 42953, 0, 1},
- {42954, 42954, -1, 0},
- {42997, 42997, 0, 1},
- {42998, 42998, -1, 0},
- {43859, 43859, -928, 0},
- {43888, 43967, -38864, 0},
- {65313, 65338, 0, 32},
- {65345, 65370, -32, 0},
- {66560, 66599, 0, 40},
- {66600, 66639, -40, 0},
- {66736, 66771, 0, 40},
- {66776, 66811, -40, 0},
- {68736, 68786, 0, 64},
- {68800, 68850, -64, 0},
- {71840, 71871, 0, 32},
- {71872, 71903, -32, 0},
- {93760, 93791, 0, 32},
- {93792, 93823, -32, 0},
- {125184, 125217, 0, 34},
- {125218, 125251, -34, 0},
+{ 65, 90, 0, 32 }, { 97, 122, -32, 0 }, { 181, 181, 743, 0 },
+ { 192, 214, 0, 32 }, { 216, 222, 0, 32 }, { 224, 246, -32, 0 },
+ { 248, 254, -32, 0 }, { 255, 255, 121, 0 }, { 256, 256, 0, 1 },
+ { 257, 257, -1, 0 }, { 258, 258, 0, 1 }, { 259, 259, -1, 0 },
+ { 260, 260, 0, 1 }, { 261, 261, -1, 0 }, { 262, 262, 0, 1 },
+ { 263, 263, -1, 0 }, { 264, 264, 0, 1 }, { 265, 265, -1, 0 },
+ { 266, 266, 0, 1 }, { 267, 267, -1, 0 }, { 268, 268, 0, 1 },
+ { 269, 269, -1, 0 }, { 270, 270, 0, 1 }, { 271, 271, -1, 0 },
+ { 272, 272, 0, 1 }, { 273, 273, -1, 0 }, { 274, 274, 0, 1 },
+ { 275, 275, -1, 0 }, { 276, 276, 0, 1 }, { 277, 277, -1, 0 },
+ { 278, 278, 0, 1 }, { 279, 279, -1, 0 }, { 280, 280, 0, 1 },
+ { 281, 281, -1, 0 }, { 282, 282, 0, 1 }, { 283, 283, -1, 0 },
+ { 284, 284, 0, 1 }, { 285, 285, -1, 0 }, { 286, 286, 0, 1 },
+ { 287, 287, -1, 0 }, { 288, 288, 0, 1 }, { 289, 289, -1, 0 },
+ { 290, 290, 0, 1 }, { 291, 291, -1, 0 }, { 292, 292, 0, 1 },
+ { 293, 293, -1, 0 }, { 294, 294, 0, 1 }, { 295, 295, -1, 0 },
+ { 296, 296, 0, 1 }, { 297, 297, -1, 0 }, { 298, 298, 0, 1 },
+ { 299, 299, -1, 0 }, { 300, 300, 0, 1 }, { 301, 301, -1, 0 },
+ { 302, 302, 0, 1 }, { 303, 303, -1, 0 }, { 305, 305, -232, 0 },
+ { 306, 306, 0, 1 }, { 307, 307, -1, 0 }, { 308, 308, 0, 1 },
+ { 309, 309, -1, 0 }, { 310, 310, 0, 1 }, { 311, 311, -1, 0 },
+ { 313, 313, 0, 1 }, { 314, 314, -1, 0 }, { 315, 315, 0, 1 },
+ { 316, 316, -1, 0 }, { 317, 317, 0, 1 }, { 318, 318, -1, 0 },
+ { 319, 319, 0, 1 }, { 320, 320, -1, 0 }, { 321, 321, 0, 1 },
+ { 322, 322, -1, 0 }, { 323, 323, 0, 1 }, { 324, 324, -1, 0 },
+ { 325, 325, 0, 1 }, { 326, 326, -1, 0 }, { 327, 327, 0, 1 },
+ { 328, 328, -1, 0 }, { 330, 330, 0, 1 }, { 331, 331, -1, 0 },
+ { 332, 332, 0, 1 }, { 333, 333, -1, 0 }, { 334, 334, 0, 1 },
+ { 335, 335, -1, 0 }, { 336, 336, 0, 1 }, { 337, 337, -1, 0 },
+ { 338, 338, 0, 1 }, { 339, 339, -1, 0 }, { 340, 340, 0, 1 },
+ { 341, 341, -1, 0 }, { 342, 342, 0, 1 }, { 343, 343, -1, 0 },
+ { 344, 344, 0, 1 }, { 345, 345, -1, 0 }, { 346, 346, 0, 1 },
+ { 347, 347, -1, 0 }, { 348, 348, 0, 1 }, { 349, 349, -1, 0 },
+ { 350, 350, 0, 1 }, { 351, 351, -1, 0 }, { 352, 352, 0, 1 },
+ { 353, 353, -1, 0 }, { 354, 354, 0, 1 }, { 355, 355, -1, 0 },
+ { 356, 356, 0, 1 }, { 357, 357, -1, 0 }, { 358, 358, 0, 1 },
+ { 359, 359, -1, 0 }, { 360, 360, 0, 1 }, { 361, 361, -1, 0 },
+ { 362, 362, 0, 1 }, { 363, 363, -1, 0 }, { 364, 364, 0, 1 },
+ { 365, 365, -1, 0 }, { 366, 366, 0, 1 }, { 367, 367, -1, 0 },
+ { 368, 368, 0, 1 }, { 369, 369, -1, 0 }, { 370, 370, 0, 1 },
+ { 371, 371, -1, 0 }, { 372, 372, 0, 1 }, { 373, 373, -1, 0 },
+ { 374, 374, 0, 1 }, { 375, 375, -1, 0 }, { 376, 376, 0, -121 },
+ { 377, 377, 0, 1 }, { 378, 378, -1, 0 }, { 379, 379, 0, 1 },
+ { 380, 380, -1, 0 }, { 381, 381, 0, 1 }, { 382, 382, -1, 0 },
+ { 383, 383, -300, 0 }, { 384, 384, 195, 0 }, { 385, 385, 0, 210 },
+ { 386, 386, 0, 1 }, { 387, 387, -1, 0 }, { 388, 388, 0, 1 },
+ { 389, 389, -1, 0 }, { 390, 390, 0, 206 }, { 391, 391, 0, 1 },
+ { 392, 392, -1, 0 }, { 393, 394, 0, 205 }, { 395, 395, 0, 1 },
+ { 396, 396, -1, 0 }, { 398, 398, 0, 79 }, { 399, 399, 0, 202 },
+ { 400, 400, 0, 203 }, { 401, 401, 0, 1 }, { 402, 402, -1, 0 },
+ { 403, 403, 0, 205 }, { 404, 404, 0, 207 }, { 405, 405, 97, 0 },
+ { 406, 406, 0, 211 }, { 407, 407, 0, 209 }, { 408, 408, 0, 1 },
+ { 409, 409, -1, 0 }, { 410, 410, 163, 0 }, { 412, 412, 0, 211 },
+ { 413, 413, 0, 213 }, { 414, 414, 130, 0 }, { 415, 415, 0, 214 },
+ { 416, 416, 0, 1 }, { 417, 417, -1, 0 }, { 418, 418, 0, 1 },
+ { 419, 419, -1, 0 }, { 420, 420, 0, 1 }, { 421, 421, -1, 0 },
+ { 422, 422, 0, 218 }, { 423, 423, 0, 1 }, { 424, 424, -1, 0 },
+ { 425, 425, 0, 218 }, { 428, 428, 0, 1 }, { 429, 429, -1, 0 },
+ { 430, 430, 0, 218 }, { 431, 431, 0, 1 }, { 432, 432, -1, 0 },
+ { 433, 434, 0, 217 }, { 435, 435, 0, 1 }, { 436, 436, -1, 0 },
+ { 437, 437, 0, 1 }, { 438, 438, -1, 0 }, { 439, 439, 0, 219 },
+ { 440, 440, 0, 1 }, { 441, 441, -1, 0 }, { 444, 444, 0, 1 },
+ { 445, 445, -1, 0 }, { 447, 447, 56, 0 }, { 452, 452, 0, 2 },
+ { 453, 453, -1, 1 }, { 454, 454, -2, 0 }, { 455, 455, 0, 2 },
+ { 456, 456, -1, 1 }, { 457, 457, -2, 0 }, { 458, 458, 0, 2 },
+ { 459, 459, -1, 1 }, { 460, 460, -2, 0 }, { 461, 461, 0, 1 },
+ { 462, 462, -1, 0 }, { 463, 463, 0, 1 }, { 464, 464, -1, 0 },
+ { 465, 465, 0, 1 }, { 466, 466, -1, 0 }, { 467, 467, 0, 1 },
+ { 468, 468, -1, 0 }, { 469, 469, 0, 1 }, { 470, 470, -1, 0 },
+ { 471, 471, 0, 1 }, { 472, 472, -1, 0 }, { 473, 473, 0, 1 },
+ { 474, 474, -1, 0 }, { 475, 475, 0, 1 }, { 476, 476, -1, 0 },
+ { 477, 477, -79, 0 }, { 478, 478, 0, 1 }, { 479, 479, -1, 0 },
+ { 480, 480, 0, 1 }, { 481, 481, -1, 0 }, { 482, 482, 0, 1 },
+ { 483, 483, -1, 0 }, { 484, 484, 0, 1 }, { 485, 485, -1, 0 },
+ { 486, 486, 0, 1 }, { 487, 487, -1, 0 }, { 488, 488, 0, 1 },
+ { 489, 489, -1, 0 }, { 490, 490, 0, 1 }, { 491, 491, -1, 0 },
+ { 492, 492, 0, 1 }, { 493, 493, -1, 0 }, { 494, 494, 0, 1 },
+ { 495, 495, -1, 0 }, { 497, 497, 0, 2 }, { 498, 498, -1, 1 },
+ { 499, 499, -2, 0 }, { 500, 500, 0, 1 }, { 501, 501, -1, 0 },
+ { 502, 502, 0, -97 }, { 503, 503, 0, -56 }, { 504, 504, 0, 1 },
+ { 505, 505, -1, 0 }, { 506, 506, 0, 1 }, { 507, 507, -1, 0 },
+ { 508, 508, 0, 1 }, { 509, 509, -1, 0 }, { 510, 510, 0, 1 },
+ { 511, 511, -1, 0 }, { 512, 512, 0, 1 }, { 513, 513, -1, 0 },
+ { 514, 514, 0, 1 }, { 515, 515, -1, 0 }, { 516, 516, 0, 1 },
+ { 517, 517, -1, 0 }, { 518, 518, 0, 1 }, { 519, 519, -1, 0 },
+ { 520, 520, 0, 1 }, { 521, 521, -1, 0 }, { 522, 522, 0, 1 },
+ { 523, 523, -1, 0 }, { 524, 524, 0, 1 }, { 525, 525, -1, 0 },
+ { 526, 526, 0, 1 }, { 527, 527, -1, 0 }, { 528, 528, 0, 1 },
+ { 529, 529, -1, 0 }, { 530, 530, 0, 1 }, { 531, 531, -1, 0 },
+ { 532, 532, 0, 1 }, { 533, 533, -1, 0 }, { 534, 534, 0, 1 },
+ { 535, 535, -1, 0 }, { 536, 536, 0, 1 }, { 537, 537, -1, 0 },
+ { 538, 538, 0, 1 }, { 539, 539, -1, 0 }, { 540, 540, 0, 1 },
+ { 541, 541, -1, 0 }, { 542, 542, 0, 1 }, { 543, 543, -1, 0 },
+ { 544, 544, 0, -130 }, { 546, 546, 0, 1 }, { 547, 547, -1, 0 },
+ { 548, 548, 0, 1 }, { 549, 549, -1, 0 }, { 550, 550, 0, 1 },
+ { 551, 551, -1, 0 }, { 552, 552, 0, 1 }, { 553, 553, -1, 0 },
+ { 554, 554, 0, 1 }, { 555, 555, -1, 0 }, { 556, 556, 0, 1 },
+ { 557, 557, -1, 0 }, { 558, 558, 0, 1 }, { 559, 559, -1, 0 },
+ { 560, 560, 0, 1 }, { 561, 561, -1, 0 }, { 562, 562, 0, 1 },
+ { 563, 563, -1, 0 }, { 570, 570, 0, 10795 }, { 571, 571, 0, 1 },
+ { 572, 572, -1, 0 }, { 573, 573, 0, -163 }, { 574, 574, 0, 10792 },
+ { 575, 576, 10815, 0 }, { 577, 577, 0, 1 }, { 578, 578, -1, 0 },
+ { 579, 579, 0, -195 }, { 580, 580, 0, 69 }, { 581, 581, 0, 71 },
+ { 582, 582, 0, 1 }, { 583, 583, -1, 0 }, { 584, 584, 0, 1 },
+ { 585, 585, -1, 0 }, { 586, 586, 0, 1 }, { 587, 587, -1, 0 },
+ { 588, 588, 0, 1 }, { 589, 589, -1, 0 }, { 590, 590, 0, 1 },
+ { 591, 591, -1, 0 }, { 592, 592, 10783, 0 }, { 593, 593, 10780, 0 },
+ { 594, 594, 10782, 0 }, { 595, 595, -210, 0 }, { 596, 596, -206, 0 },
+ { 598, 599, -205, 0 }, { 601, 601, -202, 0 }, { 603, 603, -203, 0 },
+ { 604, 604, 42319, 0 }, { 608, 608, -205, 0 }, { 609, 609, 42315, 0 },
+ { 611, 611, -207, 0 }, { 613, 613, 42280, 0 }, { 614, 614, 42308, 0 },
+ { 616, 616, -209, 0 }, { 617, 617, -211, 0 }, { 618, 618, 42308, 0 },
+ { 619, 619, 10743, 0 }, { 620, 620, 42305, 0 }, { 623, 623, -211, 0 },
+ { 625, 625, 10749, 0 }, { 626, 626, -213, 0 }, { 629, 629, -214, 0 },
+ { 637, 637, 10727, 0 }, { 640, 640, -218, 0 }, { 642, 642, 42307, 0 },
+ { 643, 643, -218, 0 }, { 647, 647, 42282, 0 }, { 648, 648, -218, 0 },
+ { 649, 649, -69, 0 }, { 650, 651, -217, 0 }, { 652, 652, -71, 0 },
+ { 658, 658, -219, 0 }, { 669, 669, 42261, 0 }, { 670, 670, 42258, 0 },
+ { 837, 837, 84, 0 }, { 880, 880, 0, 1 }, { 881, 881, -1, 0 },
+ { 882, 882, 0, 1 }, { 883, 883, -1, 0 }, { 886, 886, 0, 1 },
+ { 887, 887, -1, 0 }, { 891, 893, 130, 0 }, { 895, 895, 0, 116 },
+ { 902, 902, 0, 38 }, { 904, 906, 0, 37 }, { 908, 908, 0, 64 },
+ { 910, 911, 0, 63 }, { 913, 929, 0, 32 }, { 931, 939, 0, 32 },
+ { 940, 940, -38, 0 }, { 941, 943, -37, 0 }, { 945, 961, -32, 0 },
+ { 962, 962, -31, 0 }, { 963, 971, -32, 0 }, { 972, 972, -64, 0 },
+ { 973, 974, -63, 0 }, { 975, 975, 0, 8 }, { 976, 976, -62, 0 },
+ { 977, 977, -57, 0 }, { 981, 981, -47, 0 }, { 982, 982, -54, 0 },
+ { 983, 983, -8, 0 }, { 984, 984, 0, 1 }, { 985, 985, -1, 0 },
+ { 986, 986, 0, 1 }, { 987, 987, -1, 0 }, { 988, 988, 0, 1 },
+ { 989, 989, -1, 0 }, { 990, 990, 0, 1 }, { 991, 991, -1, 0 },
+ { 992, 992, 0, 1 }, { 993, 993, -1, 0 }, { 994, 994, 0, 1 },
+ { 995, 995, -1, 0 }, { 996, 996, 0, 1 }, { 997, 997, -1, 0 },
+ { 998, 998, 0, 1 }, { 999, 999, -1, 0 }, { 1000, 1000, 0, 1 },
+ { 1001, 1001, -1, 0 }, { 1002, 1002, 0, 1 }, { 1003, 1003, -1, 0 },
+ { 1004, 1004, 0, 1 }, { 1005, 1005, -1, 0 }, { 1006, 1006, 0, 1 },
+ { 1007, 1007, -1, 0 }, { 1008, 1008, -86, 0 }, { 1009, 1009, -80, 0 },
+ { 1010, 1010, 7, 0 }, { 1011, 1011, -116, 0 }, { 1012, 1012, 0, -60 },
+ { 1013, 1013, -96, 0 }, { 1015, 1015, 0, 1 }, { 1016, 1016, -1, 0 },
+ { 1017, 1017, 0, -7 }, { 1018, 1018, 0, 1 }, { 1019, 1019, -1, 0 },
+ { 1021, 1023, 0, -130 }, { 1024, 1039, 0, 80 }, { 1040, 1071, 0, 32 },
+ { 1072, 1103, -32, 0 }, { 1104, 1119, -80, 0 }, { 1120, 1120, 0, 1 },
+ { 1121, 1121, -1, 0 }, { 1122, 1122, 0, 1 }, { 1123, 1123, -1, 0 },
+ { 1124, 1124, 0, 1 }, { 1125, 1125, -1, 0 }, { 1126, 1126, 0, 1 },
+ { 1127, 1127, -1, 0 }, { 1128, 1128, 0, 1 }, { 1129, 1129, -1, 0 },
+ { 1130, 1130, 0, 1 }, { 1131, 1131, -1, 0 }, { 1132, 1132, 0, 1 },
+ { 1133, 1133, -1, 0 }, { 1134, 1134, 0, 1 }, { 1135, 1135, -1, 0 },
+ { 1136, 1136, 0, 1 }, { 1137, 1137, -1, 0 }, { 1138, 1138, 0, 1 },
+ { 1139, 1139, -1, 0 }, { 1140, 1140, 0, 1 }, { 1141, 1141, -1, 0 },
+ { 1142, 1142, 0, 1 }, { 1143, 1143, -1, 0 }, { 1144, 1144, 0, 1 },
+ { 1145, 1145, -1, 0 }, { 1146, 1146, 0, 1 }, { 1147, 1147, -1, 0 },
+ { 1148, 1148, 0, 1 }, { 1149, 1149, -1, 0 }, { 1150, 1150, 0, 1 },
+ { 1151, 1151, -1, 0 }, { 1152, 1152, 0, 1 }, { 1153, 1153, -1, 0 },
+ { 1162, 1162, 0, 1 }, { 1163, 1163, -1, 0 }, { 1164, 1164, 0, 1 },
+ { 1165, 1165, -1, 0 }, { 1166, 1166, 0, 1 }, { 1167, 1167, -1, 0 },
+ { 1168, 1168, 0, 1 }, { 1169, 1169, -1, 0 }, { 1170, 1170, 0, 1 },
+ { 1171, 1171, -1, 0 }, { 1172, 1172, 0, 1 }, { 1173, 1173, -1, 0 },
+ { 1174, 1174, 0, 1 }, { 1175, 1175, -1, 0 }, { 1176, 1176, 0, 1 },
+ { 1177, 1177, -1, 0 }, { 1178, 1178, 0, 1 }, { 1179, 1179, -1, 0 },
+ { 1180, 1180, 0, 1 }, { 1181, 1181, -1, 0 }, { 1182, 1182, 0, 1 },
+ { 1183, 1183, -1, 0 }, { 1184, 1184, 0, 1 }, { 1185, 1185, -1, 0 },
+ { 1186, 1186, 0, 1 }, { 1187, 1187, -1, 0 }, { 1188, 1188, 0, 1 },
+ { 1189, 1189, -1, 0 }, { 1190, 1190, 0, 1 }, { 1191, 1191, -1, 0 },
+ { 1192, 1192, 0, 1 }, { 1193, 1193, -1, 0 }, { 1194, 1194, 0, 1 },
+ { 1195, 1195, -1, 0 }, { 1196, 1196, 0, 1 }, { 1197, 1197, -1, 0 },
+ { 1198, 1198, 0, 1 }, { 1199, 1199, -1, 0 }, { 1200, 1200, 0, 1 },
+ { 1201, 1201, -1, 0 }, { 1202, 1202, 0, 1 }, { 1203, 1203, -1, 0 },
+ { 1204, 1204, 0, 1 }, { 1205, 1205, -1, 0 }, { 1206, 1206, 0, 1 },
+ { 1207, 1207, -1, 0 }, { 1208, 1208, 0, 1 }, { 1209, 1209, -1, 0 },
+ { 1210, 1210, 0, 1 }, { 1211, 1211, -1, 0 }, { 1212, 1212, 0, 1 },
+ { 1213, 1213, -1, 0 }, { 1214, 1214, 0, 1 }, { 1215, 1215, -1, 0 },
+ { 1216, 1216, 0, 15 }, { 1217, 1217, 0, 1 }, { 1218, 1218, -1, 0 },
+ { 1219, 1219, 0, 1 }, { 1220, 1220, -1, 0 }, { 1221, 1221, 0, 1 },
+ { 1222, 1222, -1, 0 }, { 1223, 1223, 0, 1 }, { 1224, 1224, -1, 0 },
+ { 1225, 1225, 0, 1 }, { 1226, 1226, -1, 0 }, { 1227, 1227, 0, 1 },
+ { 1228, 1228, -1, 0 }, { 1229, 1229, 0, 1 }, { 1230, 1230, -1, 0 },
+ { 1231, 1231, -15, 0 }, { 1232, 1232, 0, 1 }, { 1233, 1233, -1, 0 },
+ { 1234, 1234, 0, 1 }, { 1235, 1235, -1, 0 }, { 1236, 1236, 0, 1 },
+ { 1237, 1237, -1, 0 }, { 1238, 1238, 0, 1 }, { 1239, 1239, -1, 0 },
+ { 1240, 1240, 0, 1 }, { 1241, 1241, -1, 0 }, { 1242, 1242, 0, 1 },
+ { 1243, 1243, -1, 0 }, { 1244, 1244, 0, 1 }, { 1245, 1245, -1, 0 },
+ { 1246, 1246, 0, 1 }, { 1247, 1247, -1, 0 }, { 1248, 1248, 0, 1 },
+ { 1249, 1249, -1, 0 }, { 1250, 1250, 0, 1 }, { 1251, 1251, -1, 0 },
+ { 1252, 1252, 0, 1 }, { 1253, 1253, -1, 0 }, { 1254, 1254, 0, 1 },
+ { 1255, 1255, -1, 0 }, { 1256, 1256, 0, 1 }, { 1257, 1257, -1, 0 },
+ { 1258, 1258, 0, 1 }, { 1259, 1259, -1, 0 }, { 1260, 1260, 0, 1 },
+ { 1261, 1261, -1, 0 }, { 1262, 1262, 0, 1 }, { 1263, 1263, -1, 0 },
+ { 1264, 1264, 0, 1 }, { 1265, 1265, -1, 0 }, { 1266, 1266, 0, 1 },
+ { 1267, 1267, -1, 0 }, { 1268, 1268, 0, 1 }, { 1269, 1269, -1, 0 },
+ { 1270, 1270, 0, 1 }, { 1271, 1271, -1, 0 }, { 1272, 1272, 0, 1 },
+ { 1273, 1273, -1, 0 }, { 1274, 1274, 0, 1 }, { 1275, 1275, -1, 0 },
+ { 1276, 1276, 0, 1 }, { 1277, 1277, -1, 0 }, { 1278, 1278, 0, 1 },
+ { 1279, 1279, -1, 0 }, { 1280, 1280, 0, 1 }, { 1281, 1281, -1, 0 },
+ { 1282, 1282, 0, 1 }, { 1283, 1283, -1, 0 }, { 1284, 1284, 0, 1 },
+ { 1285, 1285, -1, 0 }, { 1286, 1286, 0, 1 }, { 1287, 1287, -1, 0 },
+ { 1288, 1288, 0, 1 }, { 1289, 1289, -1, 0 }, { 1290, 1290, 0, 1 },
+ { 1291, 1291, -1, 0 }, { 1292, 1292, 0, 1 }, { 1293, 1293, -1, 0 },
+ { 1294, 1294, 0, 1 }, { 1295, 1295, -1, 0 }, { 1296, 1296, 0, 1 },
+ { 1297, 1297, -1, 0 }, { 1298, 1298, 0, 1 }, { 1299, 1299, -1, 0 },
+ { 1300, 1300, 0, 1 }, { 1301, 1301, -1, 0 }, { 1302, 1302, 0, 1 },
+ { 1303, 1303, -1, 0 }, { 1304, 1304, 0, 1 }, { 1305, 1305, -1, 0 },
+ { 1306, 1306, 0, 1 }, { 1307, 1307, -1, 0 }, { 1308, 1308, 0, 1 },
+ { 1309, 1309, -1, 0 }, { 1310, 1310, 0, 1 }, { 1311, 1311, -1, 0 },
+ { 1312, 1312, 0, 1 }, { 1313, 1313, -1, 0 }, { 1314, 1314, 0, 1 },
+ { 1315, 1315, -1, 0 }, { 1316, 1316, 0, 1 }, { 1317, 1317, -1, 0 },
+ { 1318, 1318, 0, 1 }, { 1319, 1319, -1, 0 }, { 1320, 1320, 0, 1 },
+ { 1321, 1321, -1, 0 }, { 1322, 1322, 0, 1 }, { 1323, 1323, -1, 0 },
+ { 1324, 1324, 0, 1 }, { 1325, 1325, -1, 0 }, { 1326, 1326, 0, 1 },
+ { 1327, 1327, -1, 0 }, { 1329, 1366, 0, 48 }, { 1377, 1414, -48, 0 },
+ { 4256, 4293, 0, 7264 }, { 4295, 4295, 0, 7264 }, { 4301, 4301, 0, 7264 },
+ { 4304, 4346, 3008, 0 }, { 4349, 4351, 3008, 0 }, { 5024, 5103, 0, 38864 },
+ { 5104, 5109, 0, 8 }, { 5112, 5117, -8, 0 }, { 7296, 7296, -6254, 0 },
+ { 7297, 7297, -6253, 0 }, { 7298, 7298, -6244, 0 }, { 7299, 7300, -6242, 0 },
+ { 7301, 7301, -6243, 0 }, { 7302, 7302, -6236, 0 }, { 7303, 7303, -6181, 0 },
+ { 7304, 7304, 35266, 0 }, { 7312, 7354, 0, -3008 }, { 7357, 7359, 0, -3008 },
+ { 7545, 7545, 35332, 0 }, { 7549, 7549, 3814, 0 }, { 7566, 7566, 35384, 0 },
+ { 7680, 7680, 0, 1 }, { 7681, 7681, -1, 0 }, { 7682, 7682, 0, 1 },
+ { 7683, 7683, -1, 0 }, { 7684, 7684, 0, 1 }, { 7685, 7685, -1, 0 },
+ { 7686, 7686, 0, 1 }, { 7687, 7687, -1, 0 }, { 7688, 7688, 0, 1 },
+ { 7689, 7689, -1, 0 }, { 7690, 7690, 0, 1 }, { 7691, 7691, -1, 0 },
+ { 7692, 7692, 0, 1 }, { 7693, 7693, -1, 0 }, { 7694, 7694, 0, 1 },
+ { 7695, 7695, -1, 0 }, { 7696, 7696, 0, 1 }, { 7697, 7697, -1, 0 },
+ { 7698, 7698, 0, 1 }, { 7699, 7699, -1, 0 }, { 7700, 7700, 0, 1 },
+ { 7701, 7701, -1, 0 }, { 7702, 7702, 0, 1 }, { 7703, 7703, -1, 0 },
+ { 7704, 7704, 0, 1 }, { 7705, 7705, -1, 0 }, { 7706, 7706, 0, 1 },
+ { 7707, 7707, -1, 0 }, { 7708, 7708, 0, 1 }, { 7709, 7709, -1, 0 },
+ { 7710, 7710, 0, 1 }, { 7711, 7711, -1, 0 }, { 7712, 7712, 0, 1 },
+ { 7713, 7713, -1, 0 }, { 7714, 7714, 0, 1 }, { 7715, 7715, -1, 0 },
+ { 7716, 7716, 0, 1 }, { 7717, 7717, -1, 0 }, { 7718, 7718, 0, 1 },
+ { 7719, 7719, -1, 0 }, { 7720, 7720, 0, 1 }, { 7721, 7721, -1, 0 },
+ { 7722, 7722, 0, 1 }, { 7723, 7723, -1, 0 }, { 7724, 7724, 0, 1 },
+ { 7725, 7725, -1, 0 }, { 7726, 7726, 0, 1 }, { 7727, 7727, -1, 0 },
+ { 7728, 7728, 0, 1 }, { 7729, 7729, -1, 0 }, { 7730, 7730, 0, 1 },
+ { 7731, 7731, -1, 0 }, { 7732, 7732, 0, 1 }, { 7733, 7733, -1, 0 },
+ { 7734, 7734, 0, 1 }, { 7735, 7735, -1, 0 }, { 7736, 7736, 0, 1 },
+ { 7737, 7737, -1, 0 }, { 7738, 7738, 0, 1 }, { 7739, 7739, -1, 0 },
+ { 7740, 7740, 0, 1 }, { 7741, 7741, -1, 0 }, { 7742, 7742, 0, 1 },
+ { 7743, 7743, -1, 0 }, { 7744, 7744, 0, 1 }, { 7745, 7745, -1, 0 },
+ { 7746, 7746, 0, 1 }, { 7747, 7747, -1, 0 }, { 7748, 7748, 0, 1 },
+ { 7749, 7749, -1, 0 }, { 7750, 7750, 0, 1 }, { 7751, 7751, -1, 0 },
+ { 7752, 7752, 0, 1 }, { 7753, 7753, -1, 0 }, { 7754, 7754, 0, 1 },
+ { 7755, 7755, -1, 0 }, { 7756, 7756, 0, 1 }, { 7757, 7757, -1, 0 },
+ { 7758, 7758, 0, 1 }, { 7759, 7759, -1, 0 }, { 7760, 7760, 0, 1 },
+ { 7761, 7761, -1, 0 }, { 7762, 7762, 0, 1 }, { 7763, 7763, -1, 0 },
+ { 7764, 7764, 0, 1 }, { 7765, 7765, -1, 0 }, { 7766, 7766, 0, 1 },
+ { 7767, 7767, -1, 0 }, { 7768, 7768, 0, 1 }, { 7769, 7769, -1, 0 },
+ { 7770, 7770, 0, 1 }, { 7771, 7771, -1, 0 }, { 7772, 7772, 0, 1 },
+ { 7773, 7773, -1, 0 }, { 7774, 7774, 0, 1 }, { 7775, 7775, -1, 0 },
+ { 7776, 7776, 0, 1 }, { 7777, 7777, -1, 0 }, { 7778, 7778, 0, 1 },
+ { 7779, 7779, -1, 0 }, { 7780, 7780, 0, 1 }, { 7781, 7781, -1, 0 },
+ { 7782, 7782, 0, 1 }, { 7783, 7783, -1, 0 }, { 7784, 7784, 0, 1 },
+ { 7785, 7785, -1, 0 }, { 7786, 7786, 0, 1 }, { 7787, 7787, -1, 0 },
+ { 7788, 7788, 0, 1 }, { 7789, 7789, -1, 0 }, { 7790, 7790, 0, 1 },
+ { 7791, 7791, -1, 0 }, { 7792, 7792, 0, 1 }, { 7793, 7793, -1, 0 },
+ { 7794, 7794, 0, 1 }, { 7795, 7795, -1, 0 }, { 7796, 7796, 0, 1 },
+ { 7797, 7797, -1, 0 }, { 7798, 7798, 0, 1 }, { 7799, 7799, -1, 0 },
+ { 7800, 7800, 0, 1 }, { 7801, 7801, -1, 0 }, { 7802, 7802, 0, 1 },
+ { 7803, 7803, -1, 0 }, { 7804, 7804, 0, 1 }, { 7805, 7805, -1, 0 },
+ { 7806, 7806, 0, 1 }, { 7807, 7807, -1, 0 }, { 7808, 7808, 0, 1 },
+ { 7809, 7809, -1, 0 }, { 7810, 7810, 0, 1 }, { 7811, 7811, -1, 0 },
+ { 7812, 7812, 0, 1 }, { 7813, 7813, -1, 0 }, { 7814, 7814, 0, 1 },
+ { 7815, 7815, -1, 0 }, { 7816, 7816, 0, 1 }, { 7817, 7817, -1, 0 },
+ { 7818, 7818, 0, 1 }, { 7819, 7819, -1, 0 }, { 7820, 7820, 0, 1 },
+ { 7821, 7821, -1, 0 }, { 7822, 7822, 0, 1 }, { 7823, 7823, -1, 0 },
+ { 7824, 7824, 0, 1 }, { 7825, 7825, -1, 0 }, { 7826, 7826, 0, 1 },
+ { 7827, 7827, -1, 0 }, { 7828, 7828, 0, 1 }, { 7829, 7829, -1, 0 },
+ { 7835, 7835, -59, 0 }, { 7838, 7838, 0, -7615 }, { 7840, 7840, 0, 1 },
+ { 7841, 7841, -1, 0 }, { 7842, 7842, 0, 1 }, { 7843, 7843, -1, 0 },
+ { 7844, 7844, 0, 1 }, { 7845, 7845, -1, 0 }, { 7846, 7846, 0, 1 },
+ { 7847, 7847, -1, 0 }, { 7848, 7848, 0, 1 }, { 7849, 7849, -1, 0 },
+ { 7850, 7850, 0, 1 }, { 7851, 7851, -1, 0 }, { 7852, 7852, 0, 1 },
+ { 7853, 7853, -1, 0 }, { 7854, 7854, 0, 1 }, { 7855, 7855, -1, 0 },
+ { 7856, 7856, 0, 1 }, { 7857, 7857, -1, 0 }, { 7858, 7858, 0, 1 },
+ { 7859, 7859, -1, 0 }, { 7860, 7860, 0, 1 }, { 7861, 7861, -1, 0 },
+ { 7862, 7862, 0, 1 }, { 7863, 7863, -1, 0 }, { 7864, 7864, 0, 1 },
+ { 7865, 7865, -1, 0 }, { 7866, 7866, 0, 1 }, { 7867, 7867, -1, 0 },
+ { 7868, 7868, 0, 1 }, { 7869, 7869, -1, 0 }, { 7870, 7870, 0, 1 },
+ { 7871, 7871, -1, 0 }, { 7872, 7872, 0, 1 }, { 7873, 7873, -1, 0 },
+ { 7874, 7874, 0, 1 }, { 7875, 7875, -1, 0 }, { 7876, 7876, 0, 1 },
+ { 7877, 7877, -1, 0 }, { 7878, 7878, 0, 1 }, { 7879, 7879, -1, 0 },
+ { 7880, 7880, 0, 1 }, { 7881, 7881, -1, 0 }, { 7882, 7882, 0, 1 },
+ { 7883, 7883, -1, 0 }, { 7884, 7884, 0, 1 }, { 7885, 7885, -1, 0 },
+ { 7886, 7886, 0, 1 }, { 7887, 7887, -1, 0 }, { 7888, 7888, 0, 1 },
+ { 7889, 7889, -1, 0 }, { 7890, 7890, 0, 1 }, { 7891, 7891, -1, 0 },
+ { 7892, 7892, 0, 1 }, { 7893, 7893, -1, 0 }, { 7894, 7894, 0, 1 },
+ { 7895, 7895, -1, 0 }, { 7896, 7896, 0, 1 }, { 7897, 7897, -1, 0 },
+ { 7898, 7898, 0, 1 }, { 7899, 7899, -1, 0 }, { 7900, 7900, 0, 1 },
+ { 7901, 7901, -1, 0 }, { 7902, 7902, 0, 1 }, { 7903, 7903, -1, 0 },
+ { 7904, 7904, 0, 1 }, { 7905, 7905, -1, 0 }, { 7906, 7906, 0, 1 },
+ { 7907, 7907, -1, 0 }, { 7908, 7908, 0, 1 }, { 7909, 7909, -1, 0 },
+ { 7910, 7910, 0, 1 }, { 7911, 7911, -1, 0 }, { 7912, 7912, 0, 1 },
+ { 7913, 7913, -1, 0 }, { 7914, 7914, 0, 1 }, { 7915, 7915, -1, 0 },
+ { 7916, 7916, 0, 1 }, { 7917, 7917, -1, 0 }, { 7918, 7918, 0, 1 },
+ { 7919, 7919, -1, 0 }, { 7920, 7920, 0, 1 }, { 7921, 7921, -1, 0 },
+ { 7922, 7922, 0, 1 }, { 7923, 7923, -1, 0 }, { 7924, 7924, 0, 1 },
+ { 7925, 7925, -1, 0 }, { 7926, 7926, 0, 1 }, { 7927, 7927, -1, 0 },
+ { 7928, 7928, 0, 1 }, { 7929, 7929, -1, 0 }, { 7930, 7930, 0, 1 },
+ { 7931, 7931, -1, 0 }, { 7932, 7932, 0, 1 }, { 7933, 7933, -1, 0 },
+ { 7934, 7934, 0, 1 }, { 7935, 7935, -1, 0 }, { 7936, 7943, 8, 0 },
+ { 7944, 7951, 0, -8 }, { 7952, 7957, 8, 0 }, { 7960, 7965, 0, -8 },
+ { 7968, 7975, 8, 0 }, { 7976, 7983, 0, -8 }, { 7984, 7991, 8, 0 },
+ { 7992, 7999, 0, -8 }, { 8000, 8005, 8, 0 }, { 8008, 8013, 0, -8 },
+ { 8017, 8017, 8, 0 }, { 8019, 8019, 8, 0 }, { 8021, 8021, 8, 0 },
+ { 8023, 8023, 8, 0 }, { 8025, 8025, 0, -8 }, { 8027, 8027, 0, -8 },
+ { 8029, 8029, 0, -8 }, { 8031, 8031, 0, -8 }, { 8032, 8039, 8, 0 },
+ { 8040, 8047, 0, -8 }, { 8048, 8049, 74, 0 }, { 8050, 8053, 86, 0 },
+ { 8054, 8055, 100, 0 }, { 8056, 8057, 128, 0 }, { 8058, 8059, 112, 0 },
+ { 8060, 8061, 126, 0 }, { 8112, 8113, 8, 0 }, { 8120, 8121, 0, -8 },
+ { 8122, 8123, 0, -74 }, { 8126, 8126, -7205, 0 }, { 8136, 8139, 0, -86 },
+ { 8144, 8145, 8, 0 }, { 8152, 8153, 0, -8 }, { 8154, 8155, 0, -100 },
+ { 8160, 8161, 8, 0 }, { 8165, 8165, 7, 0 }, { 8168, 8169, 0, -8 },
+ { 8170, 8171, 0, -112 }, { 8172, 8172, 0, -7 }, { 8184, 8185, 0, -128 },
+ { 8186, 8187, 0, -126 }, { 8486, 8486, 0, -7517 }, { 8490, 8490, 0, -8383 },
+ { 8491, 8491, 0, -8262 }, { 8498, 8498, 0, 28 }, { 8526, 8526, -28, 0 },
+ { 8544, 8559, 0, 16 }, { 8560, 8575, -16, 0 }, { 8579, 8579, 0, 1 },
+ { 8580, 8580, -1, 0 }, { 9398, 9423, 0, 26 }, { 9424, 9449, -26, 0 },
+ { 11264, 11310, 0, 48 }, { 11312, 11358, -48, 0 }, { 11360, 11360, 0, 1 },
+ { 11361, 11361, -1, 0 }, { 11362, 11362, 0, -10743 },
+ { 11363, 11363, 0, -3814 }, { 11364, 11364, 0, -10727 },
+ { 11365, 11365, -10795, 0 }, { 11366, 11366, -10792, 0 },
+ { 11367, 11367, 0, 1 }, { 11368, 11368, -1, 0 }, { 11369, 11369, 0, 1 },
+ { 11370, 11370, -1, 0 }, { 11371, 11371, 0, 1 }, { 11372, 11372, -1, 0 },
+ { 11373, 11373, 0, -10780 }, { 11374, 11374, 0, -10749 },
+ { 11375, 11375, 0, -10783 }, { 11376, 11376, 0, -10782 },
+ { 11378, 11378, 0, 1 }, { 11379, 11379, -1, 0 }, { 11381, 11381, 0, 1 },
+ { 11382, 11382, -1, 0 }, { 11390, 11391, 0, -10815 }, { 11392, 11392, 0, 1 },
+ { 11393, 11393, -1, 0 }, { 11394, 11394, 0, 1 }, { 11395, 11395, -1, 0 },
+ { 11396, 11396, 0, 1 }, { 11397, 11397, -1, 0 }, { 11398, 11398, 0, 1 },
+ { 11399, 11399, -1, 0 }, { 11400, 11400, 0, 1 }, { 11401, 11401, -1, 0 },
+ { 11402, 11402, 0, 1 }, { 11403, 11403, -1, 0 }, { 11404, 11404, 0, 1 },
+ { 11405, 11405, -1, 0 }, { 11406, 11406, 0, 1 }, { 11407, 11407, -1, 0 },
+ { 11408, 11408, 0, 1 }, { 11409, 11409, -1, 0 }, { 11410, 11410, 0, 1 },
+ { 11411, 11411, -1, 0 }, { 11412, 11412, 0, 1 }, { 11413, 11413, -1, 0 },
+ { 11414, 11414, 0, 1 }, { 11415, 11415, -1, 0 }, { 11416, 11416, 0, 1 },
+ { 11417, 11417, -1, 0 }, { 11418, 11418, 0, 1 }, { 11419, 11419, -1, 0 },
+ { 11420, 11420, 0, 1 }, { 11421, 11421, -1, 0 }, { 11422, 11422, 0, 1 },
+ { 11423, 11423, -1, 0 }, { 11424, 11424, 0, 1 }, { 11425, 11425, -1, 0 },
+ { 11426, 11426, 0, 1 }, { 11427, 11427, -1, 0 }, { 11428, 11428, 0, 1 },
+ { 11429, 11429, -1, 0 }, { 11430, 11430, 0, 1 }, { 11431, 11431, -1, 0 },
+ { 11432, 11432, 0, 1 }, { 11433, 11433, -1, 0 }, { 11434, 11434, 0, 1 },
+ { 11435, 11435, -1, 0 }, { 11436, 11436, 0, 1 }, { 11437, 11437, -1, 0 },
+ { 11438, 11438, 0, 1 }, { 11439, 11439, -1, 0 }, { 11440, 11440, 0, 1 },
+ { 11441, 11441, -1, 0 }, { 11442, 11442, 0, 1 }, { 11443, 11443, -1, 0 },
+ { 11444, 11444, 0, 1 }, { 11445, 11445, -1, 0 }, { 11446, 11446, 0, 1 },
+ { 11447, 11447, -1, 0 }, { 11448, 11448, 0, 1 }, { 11449, 11449, -1, 0 },
+ { 11450, 11450, 0, 1 }, { 11451, 11451, -1, 0 }, { 11452, 11452, 0, 1 },
+ { 11453, 11453, -1, 0 }, { 11454, 11454, 0, 1 }, { 11455, 11455, -1, 0 },
+ { 11456, 11456, 0, 1 }, { 11457, 11457, -1, 0 }, { 11458, 11458, 0, 1 },
+ { 11459, 11459, -1, 0 }, { 11460, 11460, 0, 1 }, { 11461, 11461, -1, 0 },
+ { 11462, 11462, 0, 1 }, { 11463, 11463, -1, 0 }, { 11464, 11464, 0, 1 },
+ { 11465, 11465, -1, 0 }, { 11466, 11466, 0, 1 }, { 11467, 11467, -1, 0 },
+ { 11468, 11468, 0, 1 }, { 11469, 11469, -1, 0 }, { 11470, 11470, 0, 1 },
+ { 11471, 11471, -1, 0 }, { 11472, 11472, 0, 1 }, { 11473, 11473, -1, 0 },
+ { 11474, 11474, 0, 1 }, { 11475, 11475, -1, 0 }, { 11476, 11476, 0, 1 },
+ { 11477, 11477, -1, 0 }, { 11478, 11478, 0, 1 }, { 11479, 11479, -1, 0 },
+ { 11480, 11480, 0, 1 }, { 11481, 11481, -1, 0 }, { 11482, 11482, 0, 1 },
+ { 11483, 11483, -1, 0 }, { 11484, 11484, 0, 1 }, { 11485, 11485, -1, 0 },
+ { 11486, 11486, 0, 1 }, { 11487, 11487, -1, 0 }, { 11488, 11488, 0, 1 },
+ { 11489, 11489, -1, 0 }, { 11490, 11490, 0, 1 }, { 11491, 11491, -1, 0 },
+ { 11499, 11499, 0, 1 }, { 11500, 11500, -1, 0 }, { 11501, 11501, 0, 1 },
+ { 11502, 11502, -1, 0 }, { 11506, 11506, 0, 1 }, { 11507, 11507, -1, 0 },
+ { 11520, 11557, -7264, 0 }, { 11559, 11559, -7264, 0 },
+ { 11565, 11565, -7264, 0 }, { 42560, 42560, 0, 1 }, { 42561, 42561, -1, 0 },
+ { 42562, 42562, 0, 1 }, { 42563, 42563, -1, 0 }, { 42564, 42564, 0, 1 },
+ { 42565, 42565, -1, 0 }, { 42566, 42566, 0, 1 }, { 42567, 42567, -1, 0 },
+ { 42568, 42568, 0, 1 }, { 42569, 42569, -1, 0 }, { 42570, 42570, 0, 1 },
+ { 42571, 42571, -1, 0 }, { 42572, 42572, 0, 1 }, { 42573, 42573, -1, 0 },
+ { 42574, 42574, 0, 1 }, { 42575, 42575, -1, 0 }, { 42576, 42576, 0, 1 },
+ { 42577, 42577, -1, 0 }, { 42578, 42578, 0, 1 }, { 42579, 42579, -1, 0 },
+ { 42580, 42580, 0, 1 }, { 42581, 42581, -1, 0 }, { 42582, 42582, 0, 1 },
+ { 42583, 42583, -1, 0 }, { 42584, 42584, 0, 1 }, { 42585, 42585, -1, 0 },
+ { 42586, 42586, 0, 1 }, { 42587, 42587, -1, 0 }, { 42588, 42588, 0, 1 },
+ { 42589, 42589, -1, 0 }, { 42590, 42590, 0, 1 }, { 42591, 42591, -1, 0 },
+ { 42592, 42592, 0, 1 }, { 42593, 42593, -1, 0 }, { 42594, 42594, 0, 1 },
+ { 42595, 42595, -1, 0 }, { 42596, 42596, 0, 1 }, { 42597, 42597, -1, 0 },
+ { 42598, 42598, 0, 1 }, { 42599, 42599, -1, 0 }, { 42600, 42600, 0, 1 },
+ { 42601, 42601, -1, 0 }, { 42602, 42602, 0, 1 }, { 42603, 42603, -1, 0 },
+ { 42604, 42604, 0, 1 }, { 42605, 42605, -1, 0 }, { 42624, 42624, 0, 1 },
+ { 42625, 42625, -1, 0 }, { 42626, 42626, 0, 1 }, { 42627, 42627, -1, 0 },
+ { 42628, 42628, 0, 1 }, { 42629, 42629, -1, 0 }, { 42630, 42630, 0, 1 },
+ { 42631, 42631, -1, 0 }, { 42632, 42632, 0, 1 }, { 42633, 42633, -1, 0 },
+ { 42634, 42634, 0, 1 }, { 42635, 42635, -1, 0 }, { 42636, 42636, 0, 1 },
+ { 42637, 42637, -1, 0 }, { 42638, 42638, 0, 1 }, { 42639, 42639, -1, 0 },
+ { 42640, 42640, 0, 1 }, { 42641, 42641, -1, 0 }, { 42642, 42642, 0, 1 },
+ { 42643, 42643, -1, 0 }, { 42644, 42644, 0, 1 }, { 42645, 42645, -1, 0 },
+ { 42646, 42646, 0, 1 }, { 42647, 42647, -1, 0 }, { 42648, 42648, 0, 1 },
+ { 42649, 42649, -1, 0 }, { 42650, 42650, 0, 1 }, { 42651, 42651, -1, 0 },
+ { 42786, 42786, 0, 1 }, { 42787, 42787, -1, 0 }, { 42788, 42788, 0, 1 },
+ { 42789, 42789, -1, 0 }, { 42790, 42790, 0, 1 }, { 42791, 42791, -1, 0 },
+ { 42792, 42792, 0, 1 }, { 42793, 42793, -1, 0 }, { 42794, 42794, 0, 1 },
+ { 42795, 42795, -1, 0 }, { 42796, 42796, 0, 1 }, { 42797, 42797, -1, 0 },
+ { 42798, 42798, 0, 1 }, { 42799, 42799, -1, 0 }, { 42802, 42802, 0, 1 },
+ { 42803, 42803, -1, 0 }, { 42804, 42804, 0, 1 }, { 42805, 42805, -1, 0 },
+ { 42806, 42806, 0, 1 }, { 42807, 42807, -1, 0 }, { 42808, 42808, 0, 1 },
+ { 42809, 42809, -1, 0 }, { 42810, 42810, 0, 1 }, { 42811, 42811, -1, 0 },
+ { 42812, 42812, 0, 1 }, { 42813, 42813, -1, 0 }, { 42814, 42814, 0, 1 },
+ { 42815, 42815, -1, 0 }, { 42816, 42816, 0, 1 }, { 42817, 42817, -1, 0 },
+ { 42818, 42818, 0, 1 }, { 42819, 42819, -1, 0 }, { 42820, 42820, 0, 1 },
+ { 42821, 42821, -1, 0 }, { 42822, 42822, 0, 1 }, { 42823, 42823, -1, 0 },
+ { 42824, 42824, 0, 1 }, { 42825, 42825, -1, 0 }, { 42826, 42826, 0, 1 },
+ { 42827, 42827, -1, 0 }, { 42828, 42828, 0, 1 }, { 42829, 42829, -1, 0 },
+ { 42830, 42830, 0, 1 }, { 42831, 42831, -1, 0 }, { 42832, 42832, 0, 1 },
+ { 42833, 42833, -1, 0 }, { 42834, 42834, 0, 1 }, { 42835, 42835, -1, 0 },
+ { 42836, 42836, 0, 1 }, { 42837, 42837, -1, 0 }, { 42838, 42838, 0, 1 },
+ { 42839, 42839, -1, 0 }, { 42840, 42840, 0, 1 }, { 42841, 42841, -1, 0 },
+ { 42842, 42842, 0, 1 }, { 42843, 42843, -1, 0 }, { 42844, 42844, 0, 1 },
+ { 42845, 42845, -1, 0 }, { 42846, 42846, 0, 1 }, { 42847, 42847, -1, 0 },
+ { 42848, 42848, 0, 1 }, { 42849, 42849, -1, 0 }, { 42850, 42850, 0, 1 },
+ { 42851, 42851, -1, 0 }, { 42852, 42852, 0, 1 }, { 42853, 42853, -1, 0 },
+ { 42854, 42854, 0, 1 }, { 42855, 42855, -1, 0 }, { 42856, 42856, 0, 1 },
+ { 42857, 42857, -1, 0 }, { 42858, 42858, 0, 1 }, { 42859, 42859, -1, 0 },
+ { 42860, 42860, 0, 1 }, { 42861, 42861, -1, 0 }, { 42862, 42862, 0, 1 },
+ { 42863, 42863, -1, 0 }, { 42873, 42873, 0, 1 }, { 42874, 42874, -1, 0 },
+ { 42875, 42875, 0, 1 }, { 42876, 42876, -1, 0 }, { 42877, 42877, 0, -35332 },
+ { 42878, 42878, 0, 1 }, { 42879, 42879, -1, 0 }, { 42880, 42880, 0, 1 },
+ { 42881, 42881, -1, 0 }, { 42882, 42882, 0, 1 }, { 42883, 42883, -1, 0 },
+ { 42884, 42884, 0, 1 }, { 42885, 42885, -1, 0 }, { 42886, 42886, 0, 1 },
+ { 42887, 42887, -1, 0 }, { 42891, 42891, 0, 1 }, { 42892, 42892, -1, 0 },
+ { 42893, 42893, 0, -42280 }, { 42896, 42896, 0, 1 }, { 42897, 42897, -1, 0 },
+ { 42898, 42898, 0, 1 }, { 42899, 42899, -1, 0 }, { 42900, 42900, 48, 0 },
+ { 42902, 42902, 0, 1 }, { 42903, 42903, -1, 0 }, { 42904, 42904, 0, 1 },
+ { 42905, 42905, -1, 0 }, { 42906, 42906, 0, 1 }, { 42907, 42907, -1, 0 },
+ { 42908, 42908, 0, 1 }, { 42909, 42909, -1, 0 }, { 42910, 42910, 0, 1 },
+ { 42911, 42911, -1, 0 }, { 42912, 42912, 0, 1 }, { 42913, 42913, -1, 0 },
+ { 42914, 42914, 0, 1 }, { 42915, 42915, -1, 0 }, { 42916, 42916, 0, 1 },
+ { 42917, 42917, -1, 0 }, { 42918, 42918, 0, 1 }, { 42919, 42919, -1, 0 },
+ { 42920, 42920, 0, 1 }, { 42921, 42921, -1, 0 }, { 42922, 42922, 0, -42308 },
+ { 42923, 42923, 0, -42319 }, { 42924, 42924, 0, -42315 },
+ { 42925, 42925, 0, -42305 }, { 42926, 42926, 0, -42308 },
+ { 42928, 42928, 0, -42258 }, { 42929, 42929, 0, -42282 },
+ { 42930, 42930, 0, -42261 }, { 42931, 42931, 0, 928 },
+ { 42932, 42932, 0, 1 }, { 42933, 42933, -1, 0 }, { 42934, 42934, 0, 1 },
+ { 42935, 42935, -1, 0 }, { 42936, 42936, 0, 1 }, { 42937, 42937, -1, 0 },
+ { 42938, 42938, 0, 1 }, { 42939, 42939, -1, 0 }, { 42940, 42940, 0, 1 },
+ { 42941, 42941, -1, 0 }, { 42942, 42942, 0, 1 }, { 42943, 42943, -1, 0 },
+ { 42946, 42946, 0, 1 }, { 42947, 42947, -1, 0 }, { 42948, 42948, 0, -48 },
+ { 42949, 42949, 0, -42307 }, { 42950, 42950, 0, -35384 },
+ { 42951, 42951, 0, 1 }, { 42952, 42952, -1, 0 }, { 42953, 42953, 0, 1 },
+ { 42954, 42954, -1, 0 }, { 42997, 42997, 0, 1 }, { 42998, 42998, -1, 0 },
+ { 43859, 43859, -928, 0 }, { 43888, 43967, -38864, 0 },
+ { 65313, 65338, 0, 32 }, { 65345, 65370, -32, 0 }, { 66560, 66599, 0, 40 },
+ { 66600, 66639, -40, 0 }, { 66736, 66771, 0, 40 }, { 66776, 66811, -40, 0 },
+ { 68736, 68786, 0, 64 }, { 68800, 68850, -64, 0 }, { 71840, 71871, 0, 32 },
+ { 71872, 71903, -32, 0 }, { 93760, 93791, 0, 32 }, { 93792, 93823, -32, 0 },
+ { 125184, 125217, 0, 34 }, { 125218, 125251, -34, 0 },
diff --git a/gdb/ada-exp.h b/gdb/ada-exp.h
index 36ac3aaddb7..0cd4eb97d4c 100644
--- a/gdb/ada-exp.h
+++ b/gdb/ada-exp.h
@@ -23,19 +23,15 @@
#include "expop.h"
extern struct value *ada_unop_neg (struct type *expect_type,
- struct expression *exp,
- enum noside noside, enum exp_opcode op,
- struct value *arg1);
+ struct expression *exp, enum noside noside,
+ enum exp_opcode op, struct value *arg1);
extern struct value *ada_atr_tag (struct type *expect_type,
- struct expression *exp,
- enum noside noside, enum exp_opcode op,
- struct value *arg1);
+ struct expression *exp, enum noside noside,
+ enum exp_opcode op, struct value *arg1);
extern struct value *ada_atr_size (struct type *expect_type,
- struct expression *exp,
- enum noside noside, enum exp_opcode op,
- struct value *arg1);
-extern struct value *ada_abs (struct type *expect_type,
- struct expression *exp,
+ struct expression *exp, enum noside noside,
+ enum exp_opcode op, struct value *arg1);
+extern struct value *ada_abs (struct type *expect_type, struct expression *exp,
enum noside noside, enum exp_opcode op,
struct value *arg1);
extern struct value *ada_unop_in_range (struct type *expect_type,
@@ -51,30 +47,26 @@ extern struct value *ada_equal_binop (struct type *expect_type,
enum noside noside, enum exp_opcode op,
struct value *arg1, struct value *arg2);
extern struct value *ada_ternop_slice (struct expression *exp,
- enum noside noside,
- struct value *array,
+ enum noside noside, struct value *array,
struct value *low_bound_val,
struct value *high_bound_val);
extern struct value *ada_binop_in_bounds (struct expression *exp,
enum noside noside,
struct value *arg1,
- struct value *arg2,
- int n);
+ struct value *arg2, int n);
extern struct value *ada_binop_minmax (struct type *expect_type,
struct expression *exp,
enum noside noside, enum exp_opcode op,
- struct value *arg1,
- struct value *arg2);
+ struct value *arg1, struct value *arg2);
extern struct value *ada_pos_atr (struct type *expect_type,
- struct expression *exp,
- enum noside noside, enum exp_opcode op,
- struct value *arg);
+ struct expression *exp, enum noside noside,
+ enum exp_opcode op, struct value *arg);
extern struct value *ada_val_atr (enum noside noside, struct type *type,
struct value *arg);
extern struct value *ada_binop_exp (struct type *expect_type,
- struct expression *exp,
- enum noside noside, enum exp_opcode op,
- struct value *arg1, struct value *arg2);
+ struct expression *exp, enum noside noside,
+ enum exp_opcode op, struct value *arg1,
+ struct value *arg2);
namespace expr
{
@@ -90,11 +82,10 @@ struct ada_resolvable
is the expected type of the expression, or nullptr if none is
known. This method should return true if the operation should be
replaced by a function call with this object as the callee. */
- virtual bool resolve (struct expression *exp,
- bool deprocedure_p,
- bool parse_completion,
- innermost_block_tracker *tracker,
- struct type *context_type) = 0;
+ virtual bool
+ resolve (struct expression *exp, bool deprocedure_p, bool parse_completion,
+ innermost_block_tracker *tracker, struct type *context_type)
+ = 0;
/* Possibly replace this object with some other expression object.
This is like 'resolve', but can return a replacement.
@@ -107,47 +98,40 @@ struct ada_resolvable
This should either return a new object, or OWNER -- never
nullptr. */
- virtual operation_up replace (operation_up &&owner,
- struct expression *exp,
- bool deprocedure_p,
- bool parse_completion,
+ virtual operation_up replace (operation_up &&owner, struct expression *exp,
+ bool deprocedure_p, bool parse_completion,
innermost_block_tracker *tracker,
struct type *context_type);
};
/* In Ada, some generic operations must be wrapped with a handler that
handles some Ada-specific type conversions. */
-class ada_wrapped_operation
- : public tuple_holding_operation<operation_up>
+class ada_wrapped_operation : public tuple_holding_operation<operation_up>
{
public:
using tuple_holding_operation::tuple_holding_operation;
- value *evaluate (struct type *expect_type,
- struct expression *exp,
+ value *evaluate (struct type *expect_type, struct expression *exp,
enum noside noside) override;
enum exp_opcode opcode () const override
- { return std::get<0> (m_storage)->opcode (); }
+ {
+ return std::get<0> (m_storage)->opcode ();
+ }
};
/* An Ada string constant. */
-class ada_string_operation
- : public string_operation
+class ada_string_operation : public string_operation
{
public:
using string_operation::string_operation;
/* Return the underlying string. */
- const char *get_name () const
- {
- return std::get<0> (m_storage).c_str ();
- }
+ const char *get_name () const { return std::get<0> (m_storage).c_str (); }
- value *evaluate (struct type *expect_type,
- struct expression *exp,
+ value *evaluate (struct type *expect_type, struct expression *exp,
enum noside noside) override;
};
@@ -159,12 +143,10 @@ public:
using tuple_holding_operation::tuple_holding_operation;
- value *evaluate (struct type *expect_type,
- struct expression *exp,
+ value *evaluate (struct type *expect_type, struct expression *exp,
enum noside noside) override;
- enum exp_opcode opcode () const override
- { return UNOP_QUAL; }
+ enum exp_opcode opcode () const override { return UNOP_QUAL; }
};
/* Ternary in-range operator. */
@@ -175,12 +157,10 @@ public:
using tuple_holding_operation::tuple_holding_operation;
- value *evaluate (struct type *expect_type,
- struct expression *exp,
+ value *evaluate (struct type *expect_type, struct expression *exp,
enum noside noside) override;
- enum exp_opcode opcode () const override
- { return TERNOP_IN_RANGE; }
+ enum exp_opcode opcode () const override { return TERNOP_IN_RANGE; }
};
using ada_neg_operation = unop_operation<UNOP_NEG, ada_unop_neg>;
@@ -197,17 +177,15 @@ public:
using tuple_holding_operation::tuple_holding_operation;
- value *evaluate (struct type *expect_type,
- struct expression *exp,
+ value *evaluate (struct type *expect_type, struct expression *exp,
enum noside noside) override
{
value *val = std::get<0> (m_storage)->evaluate (nullptr, exp, noside);
- return ada_unop_in_range (expect_type, exp, noside, UNOP_IN_RANGE,
- val, std::get<1> (m_storage));
+ return ada_unop_in_range (expect_type, exp, noside, UNOP_IN_RANGE, val,
+ std::get<1> (m_storage));
}
- enum exp_opcode opcode () const override
- { return UNOP_IN_RANGE; }
+ enum exp_opcode opcode () const override { return UNOP_IN_RANGE; }
};
/* The Ada + and - operators. */
@@ -218,12 +196,10 @@ public:
using tuple_holding_operation::tuple_holding_operation;
- value *evaluate (struct type *expect_type,
- struct expression *exp,
+ value *evaluate (struct type *expect_type, struct expression *exp,
enum noside noside) override;
- enum exp_opcode opcode () const override
- { return std::get<0> (m_storage); }
+ enum exp_opcode opcode () const override { return std::get<0> (m_storage); }
};
using ada_binop_mul_operation = binop_operation<BINOP_MUL, ada_mult_binop>;
@@ -244,19 +220,17 @@ public:
using tuple_holding_operation::tuple_holding_operation;
- value *evaluate (struct type *expect_type,
- struct expression *exp,
+ value *evaluate (struct type *expect_type, struct expression *exp,
enum noside noside) override
{
value *arg1 = std::get<1> (m_storage)->evaluate (nullptr, exp, noside);
- value *arg2 = std::get<2> (m_storage)->evaluate (value_type (arg1),
- exp, noside);
+ value *arg2
+ = std::get<2> (m_storage)->evaluate (value_type (arg1), exp, noside);
return ada_equal_binop (expect_type, exp, noside, std::get<0> (m_storage),
arg1, arg2);
}
- enum exp_opcode opcode () const override
- { return std::get<0> (m_storage); }
+ enum exp_opcode opcode () const override { return std::get<0> (m_storage); }
};
/* Bitwise operators for Ada. */
@@ -268,8 +242,7 @@ public:
using maybe_constant_operation::maybe_constant_operation;
- value *evaluate (struct type *expect_type,
- struct expression *exp,
+ value *evaluate (struct type *expect_type, struct expression *exp,
enum noside noside) override
{
value *lhs = std::get<0> (m_storage)->evaluate (nullptr, exp, noside);
@@ -278,8 +251,7 @@ public:
return value_cast (value_type (lhs), result);
}
- enum exp_opcode opcode () const override
- { return OP; }
+ enum exp_opcode opcode () const override { return OP; }
};
using ada_bitwise_and_operation = ada_bitwise_operation<BINOP_BITWISE_AND>;
@@ -295,8 +267,7 @@ public:
using maybe_constant_operation::maybe_constant_operation;
- value *evaluate (struct type *expect_type,
- struct expression *exp,
+ value *evaluate (struct type *expect_type, struct expression *exp,
enum noside noside) override
{
value *array = std::get<0> (m_storage)->evaluate (nullptr, exp, noside);
@@ -305,13 +276,10 @@ public:
return ada_ternop_slice (exp, noside, array, low, high);
}
- enum exp_opcode opcode () const override
- { return TERNOP_SLICE; }
+ enum exp_opcode opcode () const override { return TERNOP_SLICE; }
- bool resolve (struct expression *exp,
- bool deprocedure_p,
- bool parse_completion,
- innermost_block_tracker *tracker,
+ bool resolve (struct expression *exp, bool deprocedure_p,
+ bool parse_completion, innermost_block_tracker *tracker,
struct type *context_type) override;
};
@@ -323,8 +291,7 @@ public:
using maybe_constant_operation::maybe_constant_operation;
- value *evaluate (struct type *expect_type,
- struct expression *exp,
+ value *evaluate (struct type *expect_type, struct expression *exp,
enum noside noside) override
{
value *arg1 = std::get<0> (m_storage)->evaluate (nullptr, exp, noside);
@@ -333,8 +300,7 @@ public:
std::get<2> (m_storage));
}
- enum exp_opcode opcode () const override
- { return BINOP_IN_BOUNDS; }
+ enum exp_opcode opcode () const override { return BINOP_IN_BOUNDS; }
};
/* Implement several unary Ada OP_ATR_* operations. */
@@ -345,37 +311,30 @@ public:
using maybe_constant_operation::maybe_constant_operation;
- value *evaluate (struct type *expect_type,
- struct expression *exp,
+ value *evaluate (struct type *expect_type, struct expression *exp,
enum noside noside) override;
- enum exp_opcode opcode () const override
- { return std::get<1> (m_storage); }
+ enum exp_opcode opcode () const override { return std::get<1> (m_storage); }
};
/* Variant of var_value_operation for Ada. */
-class ada_var_value_operation
- : public var_value_operation, public ada_resolvable
+class ada_var_value_operation : public var_value_operation,
+ public ada_resolvable
{
public:
using var_value_operation::var_value_operation;
- value *evaluate (struct type *expect_type,
- struct expression *exp,
+ value *evaluate (struct type *expect_type, struct expression *exp,
enum noside noside) override;
- value *evaluate_for_cast (struct type *expect_type,
- struct expression *exp,
+ value *evaluate_for_cast (struct type *expect_type, struct expression *exp,
enum noside noside) override;
- const block *get_block () const
- { return std::get<0> (m_storage).block; }
+ const block *get_block () const { return std::get<0> (m_storage).block; }
- bool resolve (struct expression *exp,
- bool deprocedure_p,
- bool parse_completion,
- innermost_block_tracker *tracker,
+ bool resolve (struct expression *exp, bool deprocedure_p,
+ bool parse_completion, innermost_block_tracker *tracker,
struct type *context_type) override;
protected:
@@ -384,15 +343,13 @@ protected:
};
/* Variant of var_msym_value_operation for Ada. */
-class ada_var_msym_value_operation
- : public var_msym_value_operation
+class ada_var_msym_value_operation : public var_msym_value_operation
{
public:
using var_msym_value_operation::var_msym_value_operation;
- value *evaluate_for_cast (struct type *expect_type,
- struct expression *exp,
+ value *evaluate_for_cast (struct type *expect_type, struct expression *exp,
enum noside noside) override;
protected:
@@ -408,47 +365,37 @@ public:
using tuple_holding_operation::tuple_holding_operation;
- value *evaluate (struct type *expect_type,
- struct expression *exp,
+ value *evaluate (struct type *expect_type, struct expression *exp,
enum noside noside) override;
- enum exp_opcode opcode () const override
- { return OP_ATR_VAL; }
+ enum exp_opcode opcode () const override { return OP_ATR_VAL; }
};
/* The indirection operator for Ada. */
-class ada_unop_ind_operation
- : public unop_ind_base_operation
+class ada_unop_ind_operation : public unop_ind_base_operation
{
public:
using unop_ind_base_operation::unop_ind_base_operation;
- value *evaluate (struct type *expect_type,
- struct expression *exp,
+ value *evaluate (struct type *expect_type, struct expression *exp,
enum noside noside) override;
};
/* Implement STRUCTOP_STRUCT for Ada. */
-class ada_structop_operation
- : public structop_base_operation
+class ada_structop_operation : public structop_base_operation
{
public:
using structop_base_operation::structop_base_operation;
- value *evaluate (struct type *expect_type,
- struct expression *exp,
+ value *evaluate (struct type *expect_type, struct expression *exp,
enum noside noside) override;
- enum exp_opcode opcode () const override
- { return STRUCTOP_STRUCT; }
+ enum exp_opcode opcode () const override { return STRUCTOP_STRUCT; }
/* Set the completion prefix. */
- void set_prefix (std::string &&prefix)
- {
- m_prefix = std::move (prefix);
- }
+ void set_prefix (std::string &&prefix) { m_prefix = std::move (prefix); }
bool complete (struct expression *exp, completion_tracker &tracker) override
{
@@ -477,34 +424,27 @@ public:
using tuple_holding_operation::tuple_holding_operation;
- value *evaluate (struct type *expect_type,
- struct expression *exp,
+ value *evaluate (struct type *expect_type, struct expression *exp,
enum noside noside) override;
- bool resolve (struct expression *exp,
- bool deprocedure_p,
- bool parse_completion,
- innermost_block_tracker *tracker,
+ bool resolve (struct expression *exp, bool deprocedure_p,
+ bool parse_completion, innermost_block_tracker *tracker,
struct type *context_type) override;
- enum exp_opcode opcode () const override
- { return OP_FUNCALL; }
+ enum exp_opcode opcode () const override { return OP_FUNCALL; }
};
/* An Ada assignment operation. */
-class ada_assign_operation
- : public assign_operation
+class ada_assign_operation : public assign_operation
{
public:
using assign_operation::assign_operation;
- value *evaluate (struct type *expect_type,
- struct expression *exp,
+ value *evaluate (struct type *expect_type, struct expression *exp,
enum noside noside) override;
- enum exp_opcode opcode () const override
- { return BINOP_ASSIGN; }
+ enum exp_opcode opcode () const override { return BINOP_ASSIGN; }
};
/* This abstract class represents a single component in an Ada
@@ -517,10 +457,10 @@ public:
being evaluated. INDICES, LOW, and HIGH indicate which
sub-components have already been assigned; INDICES should be
updated by this call. */
- virtual void assign (struct value *container,
- struct value *lhs, struct expression *exp,
- std::vector<LONGEST> &indices,
- LONGEST low, LONGEST high) = 0;
+ virtual void assign (struct value *container, struct value *lhs,
+ struct expression *exp, std::vector<LONGEST> &indices,
+ LONGEST low, LONGEST high)
+ = 0;
/* Same as operation::uses_objfile. */
virtual bool uses_objfile (struct objfile *objfile) = 0;
@@ -554,19 +494,16 @@ public:
contents of LHS (unless == CONTAINER). Returns the modified
CONTAINER. */
- value *assign_aggregate (struct value *container,
- struct value *lhs,
+ value *assign_aggregate (struct value *container, struct value *lhs,
struct expression *exp);
- value *evaluate (struct type *expect_type,
- struct expression *exp,
+ value *evaluate (struct type *expect_type, struct expression *exp,
enum noside noside) override
{
- error (_("Aggregates only allowed on the right of an assignment"));
+ error (_ ("Aggregates only allowed on the right of an assignment"));
}
- enum exp_opcode opcode () const override
- { return OP_AGGREGATE; }
+ enum exp_opcode opcode () const override { return OP_AGGREGATE; }
};
/* A component holding a vector of other components to assign. */
@@ -579,9 +516,8 @@ public:
{
}
- void assign (struct value *container,
- struct value *lhs, struct expression *exp,
- std::vector<LONGEST> &indices,
+ void assign (struct value *container, struct value *lhs,
+ struct expression *exp, std::vector<LONGEST> &indices,
LONGEST low, LONGEST high) override;
bool uses_objfile (struct objfile *objfile) override;
@@ -605,9 +541,8 @@ public:
{
}
- void assign (struct value *container,
- struct value *lhs, struct expression *exp,
- std::vector<LONGEST> &indices,
+ void assign (struct value *container, struct value *lhs,
+ struct expression *exp, std::vector<LONGEST> &indices,
LONGEST low, LONGEST high) override;
bool uses_objfile (struct objfile *objfile) override;
@@ -630,9 +565,8 @@ public:
{
}
- void assign (struct value *container,
- struct value *lhs, struct expression *exp,
- std::vector<LONGEST> &indices,
+ void assign (struct value *container, struct value *lhs,
+ struct expression *exp, std::vector<LONGEST> &indices,
LONGEST low, LONGEST high) override;
bool uses_objfile (struct objfile *objfile) override;
@@ -653,12 +587,10 @@ public:
/* Like ada_component::assign, but takes an operation as a
parameter. The operation is evaluated and then assigned into LHS
according to the rules of the concrete implementation. */
- virtual void assign (struct value *container,
- struct value *lhs,
- struct expression *exp,
- std::vector<LONGEST> &indices,
- LONGEST low, LONGEST high,
- operation_up &op) = 0;
+ virtual void assign (struct value *container, struct value *lhs,
+ struct expression *exp, std::vector<LONGEST> &indices,
+ LONGEST low, LONGEST high, operation_up &op)
+ = 0;
/* Same as operation::uses_objfile. */
virtual bool uses_objfile (struct objfile *objfile) = 0;
@@ -696,9 +628,8 @@ public:
m_assocs = std::move (assoc);
}
- void assign (struct value *container,
- struct value *lhs, struct expression *exp,
- std::vector<LONGEST> &indices,
+ void assign (struct value *container, struct value *lhs,
+ struct expression *exp, std::vector<LONGEST> &indices,
LONGEST low, LONGEST high) override;
bool uses_objfile (struct objfile *objfile) override;
@@ -722,11 +653,9 @@ public:
{
}
- void assign (struct value *container,
- struct value *lhs, struct expression *exp,
- std::vector<LONGEST> &indices,
- LONGEST low, LONGEST high,
- operation_up &op) override;
+ void assign (struct value *container, struct value *lhs,
+ struct expression *exp, std::vector<LONGEST> &indices,
+ LONGEST low, LONGEST high, operation_up &op) override;
bool uses_objfile (struct objfile *objfile) override;
@@ -750,11 +679,9 @@ public:
{
}
- void assign (struct value *container,
- struct value *lhs, struct expression *exp,
- std::vector<LONGEST> &indices,
- LONGEST low, LONGEST high,
- operation_up &op) override;
+ void assign (struct value *container, struct value *lhs,
+ struct expression *exp, std::vector<LONGEST> &indices,
+ LONGEST low, LONGEST high, operation_up &op) override;
bool uses_objfile (struct objfile *objfile) override;
@@ -768,17 +695,14 @@ private:
/* A character constant expression. This is a separate operation so
that it can participate in resolution, so that TYPE'(CST) can
work correctly for enums with character enumerators. */
-class ada_char_operation : public long_const_operation,
- public ada_resolvable
+class ada_char_operation : public long_const_operation, public ada_resolvable
{
public:
using long_const_operation::long_const_operation;
- bool resolve (struct expression *exp,
- bool deprocedure_p,
- bool parse_completion,
- innermost_block_tracker *tracker,
+ bool resolve (struct expression *exp, bool deprocedure_p,
+ bool parse_completion, innermost_block_tracker *tracker,
struct type *context_type) override
{
/* This should never be called, because this class also implements
@@ -786,15 +710,12 @@ public:
gdb_assert_not_reached ("unexpected call");
}
- operation_up replace (operation_up &&owner,
- struct expression *exp,
- bool deprocedure_p,
- bool parse_completion,
+ operation_up replace (operation_up &&owner, struct expression *exp,
+ bool deprocedure_p, bool parse_completion,
innermost_block_tracker *tracker,
struct type *context_type) override;
- value *evaluate (struct type *expect_type,
- struct expression *exp,
+ value *evaluate (struct type *expect_type, struct expression *exp,
enum noside noside) override;
};
@@ -804,8 +725,7 @@ public:
using concat_operation::concat_operation;
- value *evaluate (struct type *expect_type,
- struct expression *exp,
+ value *evaluate (struct type *expect_type, struct expression *exp,
enum noside noside) override;
};
diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c
index 3cd6f73f36f..1bc3f5cdbb6 100644
--- a/gdb/ada-lang.c
+++ b/gdb/ada-lang.c
@@ -17,7 +17,6 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
-
#include "defs.h"
#include <ctype.h>
#include "gdbsupport/gdb_regex.h"
@@ -114,8 +113,7 @@ static void ada_add_all_symbols (std::vector<struct block_symbol> &,
static int is_nonfunction (const std::vector<struct block_symbol> &);
static void add_defn_to_vec (std::vector<struct block_symbol> &,
- struct symbol *,
- const struct block *);
+ struct symbol *, const struct block *);
static int possible_user_operator_p (enum exp_opcode, struct value **);
@@ -138,8 +136,8 @@ static struct type *ada_find_parallel_type_with_name (struct type *,
static int is_dynamic_field (struct type *, int);
static struct type *to_fixed_variant_branch_type (struct type *,
- const gdb_byte *,
- CORE_ADDR, struct value *);
+ const gdb_byte *, CORE_ADDR,
+ struct value *);
static struct type *to_fixed_array_type (struct type *, struct value *, int);
@@ -163,8 +161,7 @@ static int ada_is_unconstrained_packed_array_type (struct type *);
static struct value *value_subscript_packed (struct value *, int,
struct value **);
-static struct value *coerce_unspec_val_to_type (struct value *,
- struct type *);
+static struct value *coerce_unspec_val_to_type (struct value *, struct type *);
static int lesseq_defined_than (struct symbol *, struct symbol *);
@@ -185,11 +182,11 @@ static struct value *val_atr (struct type *, LONGEST);
static struct symbol *standard_lookup (const char *, const struct block *,
domain_enum);
-static struct value *ada_search_struct_field (const char *, struct value *, int,
- struct type *);
+static struct value *ada_search_struct_field (const char *, struct value *,
+ int, struct type *);
-static int find_struct_field (const char *, struct type *, int,
- struct type **, int *, int *, int *, int *);
+static int find_struct_field (const char *, struct type *, int, struct type **,
+ int *, int *, int *, int *);
static int ada_resolve_function (std::vector<struct block_symbol> &,
struct value **, int, const char *,
@@ -202,13 +199,10 @@ static struct value *ada_index_struct_field (int, struct value *, int,
static void add_component_interval (LONGEST, LONGEST, std::vector<LONGEST> &);
-
static struct type *ada_find_any_type (const char *name);
-static symbol_name_matcher_ftype *ada_get_symbol_name_matcher
- (const lookup_name_info &lookup_name);
-
-
+static symbol_name_matcher_ftype *
+ada_get_symbol_name_matcher (const lookup_name_info &lookup_name);
/* The character set used for source files. */
static const char *ada_source_charset;
@@ -229,19 +223,13 @@ struct utf8_entry
already lower-case. */
int lower_delta;
- bool operator< (uint32_t val) const
- {
- return end < val;
- }
+ bool operator<(uint32_t val) const { return end < val; }
};
-static const utf8_entry ada_case_fold[] =
-{
+static const utf8_entry ada_case_fold[] = {
#include "ada-casefold.h"
};
-
-
/* The result of a symbol lookup to be stored in our symbol cache. */
struct cache_entry
@@ -298,13 +286,11 @@ static int warning_limit = 2;
expression evaluation. */
static int warnings_issued = 0;
-static const char * const known_runtime_file_name_patterns[] = {
- ADA_KNOWN_RUNTIME_FILE_NAME_PATTERNS NULL
-};
+static const char *const known_runtime_file_name_patterns[]
+ = { ADA_KNOWN_RUNTIME_FILE_NAME_PATTERNS NULL };
-static const char * const known_auxiliary_function_name_patterns[] = {
- ADA_KNOWN_AUXILIARY_FUNCTION_NAME_PATTERNS NULL
-};
+static const char *const known_auxiliary_function_name_patterns[]
+ = { ADA_KNOWN_AUXILIARY_FUNCTION_NAME_PATTERNS NULL };
/* Maintenance-related settings for this module. */
@@ -315,7 +301,7 @@ static struct cmd_list_element *maint_show_ada_cmdlist;
static bool ada_ignore_descriptive_types_p = false;
- /* Inferior-specific data. */
+/* Inferior-specific data. */
/* Per-inferior data for this module. */
@@ -365,8 +351,7 @@ ada_inferior_exit (struct inferior *inf)
ada_inferior_data.clear (inf);
}
-
- /* program-space-specific data. */
+/* program-space-specific data. */
/* This module's per-program-space data. */
struct ada_pspace_data
@@ -396,7 +381,7 @@ get_ada_pspace_data (struct program_space *pspace)
return data;
}
- /* Utilities */
+/* Utilities */
/* If TYPE is a TYPE_CODE_TYPEDEF type, return the target type after
all typedef layers have been peeled. Otherwise, return TYPE.
@@ -441,7 +426,7 @@ static const char *
ada_unqualified_name (const char *decoded_name)
{
const char *result;
-
+
/* If the decoded name starts with '<', it means that the encoded
name does not follow standard naming conventions, and thus that
it is not your typical Ada symbol name. Trying to unqualify it
@@ -451,7 +436,7 @@ ada_unqualified_name (const char *decoded_name)
result = strrchr (decoded_name, '.');
if (result != NULL)
- result++; /* Skip the dot... */
+ result++; /* Skip the dot... */
else
result = decoded_name;
@@ -474,15 +459,13 @@ field_name_match (const char *field_name, const char *target)
{
int len = strlen (target);
- return
- (strncmp (field_name, target, len) == 0
- && (field_name[len] == '\0'
- || (startswith (field_name + len, "___")
- && strcmp (field_name + strlen (field_name) - 6,
- "___XVN") != 0)));
+ return (strncmp (field_name, target, len) == 0
+ && (field_name[len] == '\0'
+ || (startswith (field_name + len, "___")
+ && strcmp (field_name + strlen (field_name) - 6, "___XVN")
+ != 0)));
}
-
/* Assuming TYPE is a TYPE_CODE_STRUCT or a TYPE_CODE_TYPDEF to
a TYPE_CODE_STRUCT, find the field whose name matches FIELD_NAME,
and return its index. This function also handles fields whose name
@@ -503,8 +486,8 @@ ada_get_field_index (const struct type *type, const char *field_name,
return fieldno;
if (!maybe_missing)
- error (_("Unable to find field %s in struct %s. Aborting"),
- field_name, struct_type->name ());
+ error (_ ("Unable to find field %s in struct %s. Aborting"), field_name,
+ struct_type->name ());
return -1;
}
@@ -692,7 +675,7 @@ ada_discrete_type_high_bound (struct type *type)
case TYPE_CODE_INT:
return max_of_type (type);
default:
- error (_("Unexpected type in ada_discrete_type_high_bound."));
+ error (_ ("Unexpected type in ada_discrete_type_high_bound."));
}
}
@@ -727,7 +710,7 @@ ada_discrete_type_low_bound (struct type *type)
case TYPE_CODE_INT:
return min_of_type (type);
default:
- error (_("Unexpected type in ada_discrete_type_low_bound."));
+ error (_ ("Unexpected type in ada_discrete_type_low_bound."));
}
}
@@ -760,7 +743,7 @@ ada_get_decoded_value (struct value *value)
|| (ada_is_constrained_packed_array_type (type)
&& type->code () != TYPE_CODE_PTR))
{
- if (type->code () == TYPE_CODE_TYPEDEF) /* array access type. */
+ if (type->code () == TYPE_CODE_TYPEDEF) /* array access type. */
value = ada_coerce_to_simple_array_ptr (value);
else
value = ada_coerce_to_simple_array (value);
@@ -785,9 +768,7 @@ ada_get_decoded_type (struct type *type)
return type;
}
-
-
- /* Language Selection */
+/* Language Selection */
/* If the main program is in Ada, return language_ada, otherwise return LANG
(the main program is in Ada iif the adainit symbol is found). */
@@ -822,7 +803,7 @@ ada_main_name (void)
{
CORE_ADDR main_program_name_addr = msym.value_address ();
if (main_program_name_addr == 0)
- error (_("Invalid address for Ada main program name."));
+ error (_ ("Invalid address for Ada main program name."));
main_program_name = target_read_string (main_program_name_addr, 1024);
return main_program_name.get ();
@@ -831,36 +812,35 @@ ada_main_name (void)
/* The main procedure doesn't seem to be in Ada. */
return NULL;
}
-
- /* Symbols */
+
+/* Symbols */
/* Table of Ada operators and their GNAT-encoded names. Last entry is pair
of NULLs. */
-const struct ada_opname_map ada_opname_table[] = {
- {"Oadd", "\"+\"", BINOP_ADD},
- {"Osubtract", "\"-\"", BINOP_SUB},
- {"Omultiply", "\"*\"", BINOP_MUL},
- {"Odivide", "\"/\"", BINOP_DIV},
- {"Omod", "\"mod\"", BINOP_MOD},
- {"Orem", "\"rem\"", BINOP_REM},
- {"Oexpon", "\"**\"", BINOP_EXP},
- {"Olt", "\"<\"", BINOP_LESS},
- {"Ole", "\"<=\"", BINOP_LEQ},
- {"Ogt", "\">\"", BINOP_GTR},
- {"Oge", "\">=\"", BINOP_GEQ},
- {"Oeq", "\"=\"", BINOP_EQUAL},
- {"One", "\"/=\"", BINOP_NOTEQUAL},
- {"Oand", "\"and\"", BINOP_BITWISE_AND},
- {"Oor", "\"or\"", BINOP_BITWISE_IOR},
- {"Oxor", "\"xor\"", BINOP_BITWISE_XOR},
- {"Oconcat", "\"&\"", BINOP_CONCAT},
- {"Oabs", "\"abs\"", UNOP_ABS},
- {"Onot", "\"not\"", UNOP_LOGICAL_NOT},
- {"Oadd", "\"+\"", UNOP_PLUS},
- {"Osubtract", "\"-\"", UNOP_NEG},
- {NULL, NULL}
-};
+const struct ada_opname_map ada_opname_table[]
+ = { { "Oadd", "\"+\"", BINOP_ADD },
+ { "Osubtract", "\"-\"", BINOP_SUB },
+ { "Omultiply", "\"*\"", BINOP_MUL },
+ { "Odivide", "\"/\"", BINOP_DIV },
+ { "Omod", "\"mod\"", BINOP_MOD },
+ { "Orem", "\"rem\"", BINOP_REM },
+ { "Oexpon", "\"**\"", BINOP_EXP },
+ { "Olt", "\"<\"", BINOP_LESS },
+ { "Ole", "\"<=\"", BINOP_LEQ },
+ { "Ogt", "\">\"", BINOP_GTR },
+ { "Oge", "\">=\"", BINOP_GEQ },
+ { "Oeq", "\"=\"", BINOP_EQUAL },
+ { "One", "\"/=\"", BINOP_NOTEQUAL },
+ { "Oand", "\"and\"", BINOP_BITWISE_AND },
+ { "Oor", "\"or\"", BINOP_BITWISE_IOR },
+ { "Oxor", "\"xor\"", BINOP_BITWISE_XOR },
+ { "Oconcat", "\"&\"", BINOP_CONCAT },
+ { "Oabs", "\"abs\"", UNOP_ABS },
+ { "Onot", "\"not\"", UNOP_LOGICAL_NOT },
+ { "Oadd", "\"+\"", UNOP_PLUS },
+ { "Osubtract", "\"-\"", UNOP_NEG },
+ { NULL, NULL } };
/* If STR is a decoded version of a compiler-provided suffix (like the
"[cold]" in "symbol[cold]"), return true. Otherwise, return
@@ -954,13 +934,13 @@ ada_encode_1 (const char *decoded, bool throw_errors)
const struct ada_opname_map *mapping;
for (mapping = ada_opname_table;
- mapping->encoded != NULL
- && !startswith (p, mapping->decoded); mapping += 1)
+ mapping->encoded != NULL && !startswith (p, mapping->decoded);
+ mapping += 1)
;
if (mapping->encoded == NULL)
{
if (throw_errors)
- error (_("invalid Ada operator name: %s"), p);
+ error (_ ("invalid Ada operator name: %s"), p);
else
return {};
}
@@ -980,12 +960,10 @@ ada_encode_1 (const char *decoded, bool throw_errors)
bool is_utf8 = ada_source_charset == ada_utf8;
try
{
- convert_between_encodings
- (host_charset (),
- is_utf8 ? HOST_UTF32 : ada_source_charset,
- (const gdb_byte *) encoding_buffer.c_str (),
- encoding_buffer.length (), 1,
- &storage, translit_none);
+ convert_between_encodings (
+ host_charset (), is_utf8 ? HOST_UTF32 : ada_source_charset,
+ (const gdb_byte *) encoding_buffer.c_str (),
+ encoding_buffer.length (), 1, &storage, translit_none);
}
catch (const gdb_exception &)
{
@@ -996,8 +974,9 @@ ada_encode_1 (const char *decoded, bool throw_errors)
if (!warned)
{
warned = true;
- warning (_("charset conversion failure for '%s'.\n"
- "You may have the wrong value for 'set ada source-charset'."),
+ warning (_ ("charset conversion failure for '%s'.\n"
+ "You may have the wrong value for 'set ada "
+ "source-charset'."),
encoding_buffer.c_str ());
}
@@ -1019,11 +998,8 @@ static const utf8_entry *
find_case_fold_entry (uint32_t c)
{
auto iter = std::lower_bound (std::begin (ada_case_fold),
- std::end (ada_case_fold),
- c);
- if (iter == std::end (ada_case_fold)
- || c < iter->start
- || c > iter->end)
+ std::end (ada_case_fold), c);
+ if (iter == std::end (ada_case_fold) || c < iter->start || c > iter->end)
return nullptr;
return &*iter;
}
@@ -1060,11 +1036,10 @@ ada_fold_name (gdb::string_view name, bool throw_on_error = false)
auto_obstack storage;
try
{
- convert_between_encodings
- (host_charset (), HOST_UTF32,
- (const gdb_byte *) name.data (),
- name.length (), 1,
- &storage, translit_none);
+ convert_between_encodings (host_charset (), HOST_UTF32,
+ (const gdb_byte *) name.data (),
+ name.length (), 1, &storage,
+ translit_none);
}
catch (const gdb_exception &)
{
@@ -1078,8 +1053,10 @@ ada_fold_name (gdb::string_view name, bool throw_on_error = false)
if (!warned)
{
warned = true;
- warning (_("could not convert '%s' from the host encoding (%s) to UTF-32.\n"
- "This normally should not happen, please file a bug report."),
+ warning (_ ("could not convert '%s' from the host encoding (%s) "
+ "to UTF-32.\n"
+ "This normally should not happen, please file a bug "
+ "report."),
gdb::to_string (name).c_str (), host_charset ());
}
@@ -1109,15 +1086,14 @@ ada_fold_name (gdb::string_view name, bool throw_on_error = false)
auto_obstack reconverted;
try
{
- convert_between_encodings (HOST_UTF32,
- host_charset (),
+ convert_between_encodings (HOST_UTF32, host_charset (),
(const gdb_byte *) chars,
num_chars * sizeof (uint32_t),
- sizeof (uint32_t),
- &reconverted,
+ sizeof (uint32_t), &reconverted,
translit_none);
obstack_1grow (&reconverted, '\0');
- fold_storage = std::string ((const char *) obstack_base (&reconverted));
+ fold_storage
+ = std::string ((const char *) obstack_base (&reconverted));
}
catch (const gdb_exception &)
{
@@ -1132,8 +1108,8 @@ ada_fold_name (gdb::string_view name, bool throw_on_error = false)
if (!warned)
{
warned = true;
- warning (_("could not convert the lower-cased variant of '%s'\n"
- "from UTF-32 to the host encoding (%s)."),
+ warning (_ ("could not convert the lower-cased variant of '%s'\n"
+ "from UTF-32 to the host encoding (%s)."),
gdb::to_string (name).c_str (), host_charset ());
}
@@ -1214,8 +1190,7 @@ ada_remove_po_subprogram_suffix (const char *encoded, int *len)
we leave these names undecoded, giving the user a clue that this
entity is internal. */
- if (*len > 1
- && encoded[*len - 1] == 'N'
+ if (*len > 1 && encoded[*len - 1] == 'N'
&& (isdigit (encoded[*len - 2]) || islower (encoded[*len - 2])))
*len = *len - 1;
}
@@ -1282,15 +1257,13 @@ convert_from_hex_encoded (std::string &out, const char *str, int n)
gdb_byte one_char = (gdb_byte) value;
convert_between_encodings (ada_source_charset, host_charset (),
- &one_char,
- sizeof (one_char), sizeof (one_char),
- &bytes, translit_none);
+ &one_char, sizeof (one_char),
+ sizeof (one_char), &bytes, translit_none);
}
else
convert_between_encodings (HOST_UTF32, host_charset (),
- (const gdb_byte *) &value,
- sizeof (value), sizeof (value),
- &bytes, translit_none);
+ (const gdb_byte *) &value, sizeof (value),
+ sizeof (value), &bytes, translit_none);
obstack_1grow (&bytes, '\0');
out.append ((const char *) obstack_base (&bytes));
}
@@ -1410,7 +1383,8 @@ ada_decode (const char *encoded, bool wrap, bool operators)
{
int op_len = strlen (ada_opname_table[k].encoded);
if ((strncmp (ada_opname_table[k].encoded + 1, encoded + i + 1,
- op_len - 1) == 0)
+ op_len - 1)
+ == 0)
&& !isalnum (encoded[i + op_len]))
{
decoded.append (ada_opname_table[k].decoded);
@@ -1434,18 +1408,18 @@ ada_decode (const char *encoded, bool wrap, bool operators)
be translated into "." (just below). These are internal names
generated for anonymous blocks inside which our symbol is nested. */
- if (len0 - i > 5 && encoded [i] == '_' && encoded [i+1] == '_'
- && encoded [i+2] == 'B' && encoded [i+3] == '_'
- && isdigit (encoded [i+4]))
+ if (len0 - i > 5 && encoded[i] == '_' && encoded[i + 1] == '_'
+ && encoded[i + 2] == 'B' && encoded[i + 3] == '_'
+ && isdigit (encoded[i + 4]))
{
int k = i + 5;
-
+
while (k < len0 && isdigit (encoded[k]))
- k++; /* Skip any extra digit. */
+ k++; /* Skip any extra digit. */
/* Double-check that the "__B_{DIGITS}+" sequence we found
is indeed followed by "__". */
- if (len0 - k > 2 && encoded [k] == '_' && encoded [k+1] == '_')
+ if (len0 - k > 2 && encoded[k] == '_' && encoded[k + 1] == '_')
i = k;
}
@@ -1462,23 +1436,21 @@ ada_decode (const char *encoded, bool wrap, bool operators)
to give the user a clue that the code he is debugging has been
internally generated. */
- if (len0 - i > 3 && encoded [i] == '_' && encoded[i+1] == 'E'
- && isdigit (encoded[i+2]))
+ if (len0 - i > 3 && encoded[i] == '_' && encoded[i + 1] == 'E'
+ && isdigit (encoded[i + 2]))
{
int k = i + 3;
while (k < len0 && isdigit (encoded[k]))
k++;
- if (k < len0
- && (encoded[k] == 'b' || encoded[k] == 's'))
+ if (k < len0 && (encoded[k] == 'b' || encoded[k] == 's'))
{
k++;
/* Just as an extra precaution, make sure that if this
suffix is followed by anything else, it is a '_'.
Otherwise, we matched this sequence by accident. */
- if (k == len0
- || (k < len0 && encoded[k] == '_'))
+ if (k == len0 || (k < len0 && encoded[k] == '_'))
i = k;
}
}
@@ -1486,8 +1458,8 @@ ada_decode (const char *encoded, bool wrap, bool operators)
/* Remove trailing "N" in [a-z0-9]+N__. The N is added by
the GNAT front-end in protected object subprograms. */
- if (i < len0 + 3
- && encoded[i] == 'N' && encoded[i+1] == '_' && encoded[i+2] == '_')
+ if (i < len0 + 3 && encoded[i] == 'N' && encoded[i + 1] == '_'
+ && encoded[i + 2] == '_')
{
/* Backtrack a bit up until we reach either the begining of
the encoded name, or "__". Make sure that we only find
@@ -1544,7 +1516,7 @@ ada_decode (const char *encoded, bool wrap, bool operators)
}
else if (i < len0 - 2 && encoded[i] == '_' && encoded[i + 1] == '_')
{
- /* Replace '__' by '.'. */
+ /* Replace '__' by '.'. */
decoded.push_back ('.');
at_start_name = 1;
i += 2;
@@ -1563,7 +1535,7 @@ ada_decode (const char *encoded, bool wrap, bool operators)
if (operators)
{
- for (i = 0; i < decoded.length(); ++i)
+ for (i = 0; i < decoded.length (); ++i)
if (isupper (decoded[i]) || decoded[i] == ' ')
goto Suppress;
}
@@ -1581,7 +1553,7 @@ Suppress:
if (encoded[0] == '<')
decoded = encoded;
else
- decoded = '<' + std::string(encoded) + '>';
+ decoded = '<' + std::string (encoded) + '>';
return decoded;
}
@@ -1606,8 +1578,7 @@ const char *
ada_decode_symbol (const struct general_symbol_info *arg)
{
struct general_symbol_info *gsymbol = (struct general_symbol_info *) arg;
- const char **resultp =
- &gsymbol->language_specific.demangled_name;
+ const char **resultp = &gsymbol->language_specific.demangled_name;
if (!gsymbol->ada_mangled)
{
@@ -1637,9 +1608,7 @@ ada_decode_symbol (const struct general_symbol_info *arg)
return *resultp;
}
-
-
- /* Arrays */
+/* Arrays */
/* Assuming that INDEX_DESC_TYPE is an ___XA structure, a structure
generated by the GNAT compiler to describe the index type used
@@ -1682,18 +1651,19 @@ ada_fixup_array_indexes_type (struct type *index_desc_type)
is not equal to the field name. */
if (index_desc_type->field (0).type ()->name () != NULL
&& strcmp (index_desc_type->field (0).type ()->name (),
- index_desc_type->field (0).name ()) == 0)
+ index_desc_type->field (0).name ())
+ == 0)
return;
/* Fixup each field of INDEX_DESC_TYPE. */
for (i = 0; i < index_desc_type->num_fields (); i++)
- {
- const char *name = index_desc_type->field (i).name ();
- struct type *raw_type = ada_check_typedef (ada_find_any_type (name));
+ {
+ const char *name = index_desc_type->field (i).name ();
+ struct type *raw_type = ada_check_typedef (ada_find_any_type (name));
- if (raw_type)
- index_desc_type->field (i).set_type (raw_type);
- }
+ if (raw_type)
+ index_desc_type->field (i).set_type (raw_type);
+ }
}
/* The desc_* routines return primitive portions of array descriptors
@@ -1712,8 +1682,7 @@ desc_base_type (struct type *type)
type = ada_typedef_target_type (type);
if (type != NULL
- && (type->code () == TYPE_CODE_PTR
- || type->code () == TYPE_CODE_REF))
+ && (type->code () == TYPE_CODE_PTR || type->code () == TYPE_CODE_REF))
return ada_check_typedef (type->target_type ());
else
return type;
@@ -1724,9 +1693,8 @@ desc_base_type (struct type *type)
static int
is_thin_pntr (struct type *type)
{
- return
- is_suffix (ada_type_name (desc_base_type (type)), "___XUT")
- || is_suffix (ada_type_name (desc_base_type (type)), "___XUT___XVE");
+ return is_suffix (ada_type_name (desc_base_type (type)), "___XUT")
+ || is_suffix (ada_type_name (desc_base_type (type)), "___XUT___XVE");
}
/* The descriptor type for thin pointer type TYPE. */
@@ -1817,12 +1785,12 @@ desc_bounds (struct value *arr)
if (is_thin_pntr (type))
{
- struct type *bounds_type =
- desc_bounds_type (thin_descriptor_type (type));
+ struct type *bounds_type
+ = desc_bounds_type (thin_descriptor_type (type));
LONGEST addr;
if (bounds_type == NULL)
- error (_("Bad GNAT array descriptor"));
+ error (_ ("Bad GNAT array descriptor"));
/* NOTE: The following calculation is not really kosher, but
since desc_type is an XVE-encoded type (and shouldn't be),
@@ -1832,29 +1800,27 @@ desc_bounds (struct value *arr)
else
addr = value_address (arr);
- return
- value_from_longest (lookup_pointer_type (bounds_type),
- addr - bounds_type->length ());
+ return value_from_longest (lookup_pointer_type (bounds_type),
+ addr - bounds_type->length ());
}
else if (is_thick_pntr (type))
{
- struct value *p_bounds = value_struct_elt (&arr, {}, "P_BOUNDS", NULL,
- _("Bad GNAT array descriptor"));
+ struct value *p_bounds
+ = value_struct_elt (&arr, {}, "P_BOUNDS", NULL,
+ _ ("Bad GNAT array descriptor"));
struct type *p_bounds_type = value_type (p_bounds);
- if (p_bounds_type
- && p_bounds_type->code () == TYPE_CODE_PTR)
+ if (p_bounds_type && p_bounds_type->code () == TYPE_CODE_PTR)
{
struct type *target_type = p_bounds_type->target_type ();
if (target_type->is_stub ())
- p_bounds = value_cast (lookup_pointer_type
- (ada_check_typedef (target_type)),
- p_bounds);
+ p_bounds = value_cast (
+ lookup_pointer_type (ada_check_typedef (target_type)), p_bounds);
}
else
- error (_("Bad GNAT array descriptor"));
+ error (_ ("Bad GNAT array descriptor"));
return p_bounds;
}
@@ -1902,8 +1868,7 @@ desc_data_target_type (struct type *type)
{
struct type *data_type = lookup_struct_elt_type (type, "P_ARRAY", 1);
- if (data_type
- && ada_check_typedef (data_type)->code () == TYPE_CODE_PTR)
+ if (data_type && ada_check_typedef (data_type)->code () == TYPE_CODE_PTR)
return ada_check_typedef (data_type->target_type ());
}
@@ -1922,12 +1887,11 @@ desc_data (struct value *arr)
return thin_data_pntr (arr);
else if (is_thick_pntr (type))
return value_struct_elt (&arr, {}, "P_ARRAY", NULL,
- _("Bad GNAT array descriptor"));
+ _ ("Bad GNAT array descriptor"));
else
return NULL;
}
-
/* If TYPE is the type of an array-descriptor (fat pointer), the bit
position of the field containing the address of the data. */
@@ -1959,10 +1923,10 @@ static struct value *
desc_one_bound (struct value *bounds, int i, int which)
{
char bound_name[20];
- xsnprintf (bound_name, sizeof (bound_name), "%cB%d",
- which ? 'U' : 'L', i - 1);
+ xsnprintf (bound_name, sizeof (bound_name), "%cB%d", which ? 'U' : 'L',
+ i - 1);
return value_struct_elt (&bounds, {}, bound_name, NULL,
- _("Bad GNAT array descriptor bounds"));
+ _ ("Bad GNAT array descriptor bounds"));
}
/* If BOUNDS is an array-bounds structure type, return the bit position
@@ -2042,8 +2006,7 @@ static int
ada_is_array_type (struct type *type)
{
while (type != NULL
- && (type->code () == TYPE_CODE_PTR
- || type->code () == TYPE_CODE_REF))
+ && (type->code () == TYPE_CODE_PTR || type->code () == TYPE_CODE_REF))
type = type->target_type ();
return ada_is_direct_array_type (type);
}
@@ -2072,8 +2035,7 @@ ada_is_array_descriptor_type (struct type *type)
if (type == NULL)
return 0;
type = ada_check_typedef (type);
- return (data_type != NULL
- && data_type->code () == TYPE_CODE_ARRAY
+ return (data_type != NULL && data_type->code () == TYPE_CODE_ARRAY
&& desc_arity (desc_bounds_type (type)) > 0);
}
@@ -2085,15 +2047,12 @@ ada_is_array_descriptor_type (struct type *type)
int
ada_is_bogus_array_descriptor (struct type *type)
{
- return
- type != NULL
- && type->code () == TYPE_CODE_STRUCT
- && (lookup_struct_elt_type (type, "P_BOUNDS", 1) != NULL
- || lookup_struct_elt_type (type, "P_ARRAY", 1) != NULL)
- && !ada_is_array_descriptor_type (type);
+ return type != NULL && type->code () == TYPE_CODE_STRUCT
+ && (lookup_struct_elt_type (type, "P_BOUNDS", 1) != NULL
+ || lookup_struct_elt_type (type, "P_ARRAY", 1) != NULL)
+ && !ada_is_array_descriptor_type (type);
}
-
/* If ARR has a record type in the form of a standard GNAT array descriptor,
(fat pointer) returns the type of the array data described---specifically,
a pointer-to-array type. If BOUNDS is non-zero, the bounds data are filled
@@ -2113,13 +2072,13 @@ ada_type_of_array (struct value *arr, int bounds)
if (!bounds)
{
- struct type *array_type =
- ada_check_typedef (desc_data_target_type (value_type (arr)));
+ struct type *array_type
+ = ada_check_typedef (desc_data_target_type (value_type (arr)));
if (ada_is_unconstrained_packed_array_type (value_type (arr)))
- TYPE_FIELD_BITSIZE (array_type, 0) =
- decode_packed_array_bitsize (value_type (arr));
-
+ TYPE_FIELD_BITSIZE (array_type, 0)
+ = decode_packed_array_bitsize (value_type (arr));
+
return array_type;
}
else
@@ -2158,14 +2117,14 @@ ada_type_of_array (struct value *arr, int bounds)
LONGEST lo = value_as_long (low);
LONGEST hi = value_as_long (high);
- TYPE_FIELD_BITSIZE (elt_type, 0) =
- decode_packed_array_bitsize (value_type (arr));
+ TYPE_FIELD_BITSIZE (elt_type, 0)
+ = decode_packed_array_bitsize (value_type (arr));
/* If the array has no element, then the size is already
zero, and does not need to be recomputed. */
if (lo < hi)
{
- int array_bitsize =
- (hi - lo + 1) * TYPE_FIELD_BITSIZE (elt_type, 0);
+ int array_bitsize
+ = (hi - lo + 1) * TYPE_FIELD_BITSIZE (elt_type, 0);
array_type->set_length ((array_bitsize + 7) / 8);
}
@@ -2210,7 +2169,7 @@ ada_coerce_to_simple_array (struct value *arr)
struct value *arrVal = ada_coerce_to_simple_array_ptr (arr);
if (arrVal == NULL)
- error (_("Bounds unavailable for null array pointer."));
+ error (_ ("Bounds unavailable for null array pointer."));
return value_ind (arrVal);
}
else if (ada_is_constrained_packed_array_type (value_type (arr)))
@@ -2238,15 +2197,14 @@ ada_coerce_to_simple_array_type (struct type *type)
/* Non-zero iff TYPE represents a standard GNAT packed-array type. */
static int
-ada_is_gnat_encoded_packed_array_type (struct type *type)
+ada_is_gnat_encoded_packed_array_type (struct type *type)
{
if (type == NULL)
return 0;
type = desc_base_type (type);
type = ada_check_typedef (type);
- return
- ada_type_name (type) != NULL
- && strstr (ada_type_name (type), "___XP") != NULL;
+ return ada_type_name (type) != NULL
+ && strstr (ada_type_name (type), "___XP") != NULL;
}
/* Non-zero iff TYPE represents a standard GNAT constrained
@@ -2256,7 +2214,7 @@ int
ada_is_constrained_packed_array_type (struct type *type)
{
return ada_is_gnat_encoded_packed_array_type (type)
- && !ada_is_array_descriptor_type (type);
+ && !ada_is_array_descriptor_type (type);
}
/* Non-zero iff TYPE represents an array descriptor for a
@@ -2336,8 +2294,8 @@ decode_packed_array_bitsize (struct type *type)
if (sscanf (tail + sizeof ("___XP") - 1, "%ld", &bits) != 1)
{
- lim_warning
- (_("could not understand bit size information on packed array"));
+ lim_warning (
+ _ ("could not understand bit size information on packed array"));
return 0;
}
@@ -2376,15 +2334,15 @@ constrained_packed_array_type (struct type *type, long *elt_bits)
index_type_desc = ada_find_parallel_type (type, "___XA");
if (index_type_desc)
- index_type = to_fixed_range_type (index_type_desc->field (0).type (),
- NULL);
+ index_type
+ = to_fixed_range_type (index_type_desc->field (0).type (), NULL);
else
index_type = type->index_type ();
new_type = alloc_type_copy (type);
- new_elt_type =
- constrained_packed_array_type (ada_check_typedef (type->target_type ()),
- elt_bits);
+ new_elt_type
+ = constrained_packed_array_type (ada_check_typedef (type->target_type ()),
+ elt_bits);
create_array_type (new_type, new_elt_type, index_type);
TYPE_FIELD_BITSIZE (new_type, 0) = *elt_bits;
new_type->set_name (ada_type_name (type));
@@ -2437,15 +2395,15 @@ decode_constrained_packed_array_type (struct type *type)
if (shadow_type == NULL)
{
- lim_warning (_("could not find bounds information on packed array"));
+ lim_warning (_ ("could not find bounds information on packed array"));
return NULL;
}
shadow_type = check_typedef (shadow_type);
if (shadow_type->code () != TYPE_CODE_ARRAY)
{
- lim_warning (_("could not understand bounds "
- "information on packed array"));
+ lim_warning (_ ("could not understand bounds "
+ "information on packed array"));
return NULL;
}
@@ -2463,8 +2421,7 @@ recursively_update_array_bitsize (struct type *type)
gdb_assert (type->code () == TYPE_CODE_ARRAY);
LONGEST low, high;
- if (!get_discrete_bounds (type->index_type (), &low, &high)
- || low > high)
+ if (!get_discrete_bounds (type->index_type (), &low, &high) || low > high)
return 0;
LONGEST our_len = high - low + 1;
@@ -2507,7 +2464,7 @@ decode_constrained_packed_array (struct value *arr)
type = decode_constrained_packed_array_type (value_type (arr));
if (type == NULL)
{
- error (_("can't unpack array"));
+ error (_ ("can't unpack array"));
return NULL;
}
@@ -2526,7 +2483,7 @@ decode_constrained_packed_array (struct value *arr)
if (type_byte_order (value_type (arr)) == BFD_ENDIAN_BIG
&& ada_is_modular_type (value_type (arr)))
{
- /* This is a (right-justified) modular type representing a packed
+ /* This is a (right-justified) modular type representing a packed
array with no wrapper. In order to interpret the value through
the (left-justified) packed array type we just built, we must
first left-justify it. */
@@ -2541,17 +2498,14 @@ decode_constrained_packed_array (struct value *arr)
mod >>= 1;
}
bit_pos = HOST_CHAR_BIT * value_type (arr)->length () - bit_size;
- arr = ada_value_primitive_packed_val (arr, NULL,
- bit_pos / HOST_CHAR_BIT,
- bit_pos % HOST_CHAR_BIT,
- bit_size,
+ arr = ada_value_primitive_packed_val (arr, NULL, bit_pos / HOST_CHAR_BIT,
+ bit_pos % HOST_CHAR_BIT, bit_size,
type);
}
return coerce_unspec_val_to_type (arr, type);
}
-
/* The value of the element of packed array ARR at the ARITY indices
given in IND. ARR must be a simple array. */
@@ -2571,9 +2525,8 @@ value_subscript_packed (struct value *arr, int arity, struct value **ind)
{
if (elt_type->code () != TYPE_CODE_ARRAY
|| TYPE_FIELD_BITSIZE (elt_type, 0) == 0)
- error
- (_("attempt to do packed indexing of "
- "something other than a packed array"));
+ error (_ ("attempt to do packed indexing of "
+ "something other than a packed array"));
else
{
struct type *range_type = elt_type->index_type ();
@@ -2582,13 +2535,13 @@ value_subscript_packed (struct value *arr, int arity, struct value **ind)
if (!get_discrete_bounds (range_type, &lowerbound, &upperbound))
{
- lim_warning (_("don't know bounds of array"));
+ lim_warning (_ ("don't know bounds of array"));
lowerbound = upperbound = 0;
}
idx = pos_atr (ind[i]);
if (idx < lowerbound || idx > upperbound)
- lim_warning (_("packed array index %ld out of bounds"),
+ lim_warning (_ ("packed array index %ld out of bounds"),
(long) idx);
bits = TYPE_FIELD_BITSIZE (elt_type, 0);
elt_total_bit_offset += (idx - lowerbound) * bits;
@@ -2598,8 +2551,8 @@ value_subscript_packed (struct value *arr, int arity, struct value **ind)
elt_off = elt_total_bit_offset / HOST_CHAR_BIT;
bit_off = elt_total_bit_offset % HOST_CHAR_BIT;
- v = ada_value_primitive_packed_val (arr, NULL, elt_off, bit_off,
- bits, elt_type);
+ v = ada_value_primitive_packed_val (arr, NULL, elt_off, bit_off, bits,
+ elt_type);
return v;
}
@@ -2636,21 +2589,20 @@ has_negatives (struct type *type)
static void
ada_unpack_from_contents (const gdb_byte *src, int bit_offset, int bit_size,
gdb_byte *unpacked, int unpacked_len,
- int is_big_endian, int is_signed_type,
- int is_scalar)
+ int is_big_endian, int is_signed_type, int is_scalar)
{
int src_len = (bit_size + bit_offset + HOST_CHAR_BIT - 1) / 8;
- int src_idx; /* Index into the source area */
- int src_bytes_left; /* Number of source bytes left to process. */
- int srcBitsLeft; /* Number of source bits left to move */
- int unusedLS; /* Number of bits in next significant
+ int src_idx; /* Index into the source area */
+ int src_bytes_left; /* Number of source bytes left to process. */
+ int srcBitsLeft; /* Number of source bits left to move */
+ int unusedLS; /* Number of bits in next significant
byte of source that are unused */
- int unpacked_idx; /* Index into the unpacked buffer */
- int unpacked_bytes_left; /* Number of bytes left to set in unpacked. */
+ int unpacked_idx; /* Index into the unpacked buffer */
+ int unpacked_bytes_left; /* Number of bytes left to set in unpacked. */
- unsigned long accum; /* Staging area for bits being transferred */
- int accumSize; /* Number of meaningful bits in accum */
+ unsigned long accum; /* Staging area for bits being transferred */
+ int accumSize; /* Number of meaningful bits in accum */
unsigned char sign;
/* Transmit bytes from least to most significant; delta is the direction
@@ -2660,8 +2612,8 @@ ada_unpack_from_contents (const gdb_byte *src, int bit_offset, int bit_size,
/* Make sure that unpacked is large enough to receive the BIT_SIZE
bits from SRC. .*/
if ((bit_size + HOST_CHAR_BIT - 1) / HOST_CHAR_BIT > unpacked_len)
- error (_("Cannot unpack %d bits into buffer of %d bytes"),
- bit_size, unpacked_len);
+ error (_ ("Cannot unpack %d bits into buffer of %d bytes"), bit_size,
+ unpacked_len);
srcBitsLeft = bit_size;
src_bytes_left = src_len;
@@ -2675,9 +2627,8 @@ ada_unpack_from_contents (const gdb_byte *src, int bit_offset, int bit_size,
&& ((src[0] << bit_offset) & (1 << (HOST_CHAR_BIT - 1))))
sign = ~0;
- unusedLS =
- (HOST_CHAR_BIT - (bit_size + bit_offset) % HOST_CHAR_BIT)
- % HOST_CHAR_BIT;
+ unusedLS = (HOST_CHAR_BIT - (bit_size + bit_offset) % HOST_CHAR_BIT)
+ % HOST_CHAR_BIT;
if (is_scalar)
{
@@ -2687,8 +2638,8 @@ ada_unpack_from_contents (const gdb_byte *src, int bit_offset, int bit_size,
else
{
/* Non-scalar values must be aligned at a byte boundary... */
- accumSize =
- (HOST_CHAR_BIT - bit_size % HOST_CHAR_BIT) % HOST_CHAR_BIT;
+ accumSize
+ = (HOST_CHAR_BIT - bit_size % HOST_CHAR_BIT) % HOST_CHAR_BIT;
/* ... And are placed at the beginning (most-significant) bytes
of the target. */
unpacked_idx = (bit_size + HOST_CHAR_BIT - 1) / HOST_CHAR_BIT - 1;
@@ -2712,14 +2663,14 @@ ada_unpack_from_contents (const gdb_byte *src, int bit_offset, int bit_size,
{
/* Mask for removing bits of the next source byte that are not
part of the value. */
- unsigned int unusedMSMask =
- (1 << (srcBitsLeft >= HOST_CHAR_BIT ? HOST_CHAR_BIT : srcBitsLeft)) -
- 1;
+ unsigned int unusedMSMask
+ = (1 << (srcBitsLeft >= HOST_CHAR_BIT ? HOST_CHAR_BIT : srcBitsLeft))
+ - 1;
/* Sign-extend bits for this byte. */
unsigned int signMask = sign & ~unusedMSMask;
- accum |=
- (((src[src_idx] >> unusedLS) & unusedMSMask) | signMask) << accumSize;
+ accum |= (((src[src_idx] >> unusedLS) & unusedMSMask) | signMask)
+ << accumSize;
accumSize += HOST_CHAR_BIT - unusedLS;
if (accumSize >= HOST_CHAR_BIT)
{
@@ -2762,7 +2713,7 @@ ada_value_primitive_packed_val (struct value *obj, const gdb_byte *valaddr,
struct type *type)
{
struct value *v;
- const gdb_byte *src; /* First byte containing data to unpack */
+ const gdb_byte *src; /* First byte containing data to unpack */
gdb_byte *unpacked;
const int is_scalar = is_scalar_type (type);
const int is_big_endian = type_byte_order (type) == BFD_ENDIAN_BIG;
@@ -2787,10 +2738,9 @@ ada_value_primitive_packed_val (struct value *obj, const gdb_byte *valaddr,
int staging_len = (bit_size + HOST_CHAR_BIT - 1) / HOST_CHAR_BIT;
staging.resize (staging_len);
- ada_unpack_from_contents (src, bit_offset, bit_size,
- staging.data (), staging.size (),
- is_big_endian, has_negatives (type),
- is_scalar);
+ ada_unpack_from_contents (src, bit_offset, bit_size, staging.data (),
+ staging.size (), is_big_endian,
+ has_negatives (type), is_scalar);
type = resolve_dynamic_type (type, staging, 0);
if (type->length () < (bit_size + HOST_CHAR_BIT - 1) / HOST_CHAR_BIT)
{
@@ -2862,9 +2812,9 @@ ada_value_primitive_packed_val (struct value *obj, const gdb_byte *valaddr,
memcpy (unpacked, staging.data (), staging.size ());
}
else
- ada_unpack_from_contents (src, bit_offset, bit_size,
- unpacked, type->length (),
- is_big_endian, has_negatives (type), is_scalar);
+ ada_unpack_from_contents (src, bit_offset, bit_size, unpacked,
+ type->length (), is_big_endian,
+ has_negatives (type), is_scalar);
return v;
}
@@ -2889,15 +2839,13 @@ ada_value_assign (struct value *toval, struct value *fromval)
fromval = ada_coerce_to_simple_array (fromval);
if (!deprecated_value_modifiable (toval))
- error (_("Left operand of assignment is not a modifiable lvalue."));
+ error (_ ("Left operand of assignment is not a modifiable lvalue."));
- if (VALUE_LVAL (toval) == lval_memory
- && bits > 0
- && (type->code () == TYPE_CODE_FLT
- || type->code () == TYPE_CODE_STRUCT))
+ if (VALUE_LVAL (toval) == lval_memory && bits > 0
+ && (type->code () == TYPE_CODE_FLT || type->code () == TYPE_CODE_STRUCT))
{
- int len = (value_bitpos (toval)
- + bits + HOST_CHAR_BIT - 1) / HOST_CHAR_BIT;
+ int len
+ = (value_bitpos (toval) + bits + HOST_CHAR_BIT - 1) / HOST_CHAR_BIT;
int from_size;
gdb_byte *buffer = (gdb_byte *) alloca (len);
struct value *val;
@@ -2916,14 +2864,13 @@ ada_value_assign (struct value *toval, struct value *fromval)
if (is_big_endian && is_scalar_type (value_type (fromval)))
from_offset = from_size - bits;
copy_bitwise (buffer, value_bitpos (toval),
- value_contents (fromval).data (), from_offset,
- bits, is_big_endian);
+ value_contents (fromval).data (), from_offset, bits,
+ is_big_endian);
write_memory_with_notification (to_addr, buffer, len);
val = value_copy (toval);
memcpy (value_contents_raw (val).data (),
- value_contents (fromval).data (),
- type->length ());
+ value_contents (fromval).data (), type->length ());
deprecated_set_value_type (val, type);
return val;
@@ -2932,7 +2879,6 @@ ada_value_assign (struct value *toval, struct value *fromval)
return value_assign (toval, fromval);
}
-
/* Given that COMPONENT is a memory lvalue that is part of the lvalue
CONTAINER, assign the contents of VAL to COMPONENTS's place in
CONTAINER. Modifies the VALUE_CONTENTS of CONTAINER only, not
@@ -2948,10 +2894,10 @@ static void
value_assign_to_component (struct value *container, struct value *component,
struct value *val)
{
- LONGEST offset_in_container =
- (LONGEST) (value_address (component) - value_address (container));
- int bit_offset_in_container =
- value_bitpos (component) - value_bitpos (container);
+ LONGEST offset_in_container
+ = (LONGEST) (value_address (component) - value_address (container));
+ int bit_offset_in_container
+ = value_bitpos (component) - value_bitpos (container);
int bits;
val = value_cast (value_type (component), val);
@@ -3014,7 +2960,7 @@ ada_value_subscript (struct value *arr, int arity, struct value **ind)
struct type *saved_elt_type = elt_type->target_type ();
if (elt_type->code () != TYPE_CODE_ARRAY)
- error (_("too many subscripts (%d expected)"), k);
+ error (_ ("too many subscripts (%d expected)"), k);
elt = value_subscript (elt, pos_atr (ind[k]));
@@ -3059,11 +3005,9 @@ ada_value_ptr_subscript (struct value *arr, int arity, struct value **ind)
{
int k;
struct value *array_ind = ada_value_ind (arr);
- struct type *type
- = check_typedef (value_enclosing_type (array_ind));
+ struct type *type = check_typedef (value_enclosing_type (array_ind));
- if (type->code () == TYPE_CODE_ARRAY
- && TYPE_FIELD_BITSIZE (type, 0) > 0)
+ if (type->code () == TYPE_CODE_ARRAY && TYPE_FIELD_BITSIZE (type, 0) > 0)
return value_subscript_packed (array_ind, arity, ind);
for (k = 0; k < arity; k += 1)
@@ -3071,7 +3015,7 @@ ada_value_ptr_subscript (struct value *arr, int arity, struct value **ind)
LONGEST lwb, upb;
if (type->code () != TYPE_CODE_ARRAY)
- error (_("too many subscripts (%d expected)"), k);
+ error (_ ("too many subscripts (%d expected)"), k);
arr = value_cast (lookup_pointer_type (type->target_type ()),
value_copy (arr));
get_discrete_bounds (type->index_type (), &lwb, &upb);
@@ -3087,18 +3031,18 @@ ada_value_ptr_subscript (struct value *arr, int arity, struct value **ind)
HIGH'Pos-LOW'Pos+1 elements starting at index LOW. The lower bound of
this array is LOW, as per Ada rules. */
static struct value *
-ada_value_slice_from_ptr (struct value *array_ptr, struct type *type,
- int low, int high)
+ada_value_slice_from_ptr (struct value *array_ptr, struct type *type, int low,
+ int high)
{
struct type *type0 = ada_check_typedef (type);
struct type *base_index_type = type0->index_type ()->target_type ();
struct type *index_type
= create_static_range_type (NULL, base_index_type, low, high);
- struct type *slice_type = create_array_type_with_stride
- (NULL, type0->target_type (), index_type,
- type0->dyn_prop (DYN_PROP_BYTE_STRIDE),
- TYPE_FIELD_BITSIZE (type0, 0));
- int base_low = ada_discrete_type_low_bound (type0->index_type ());
+ struct type *slice_type
+ = create_array_type_with_stride (NULL, type0->target_type (), index_type,
+ type0->dyn_prop (DYN_PROP_BYTE_STRIDE),
+ TYPE_FIELD_BITSIZE (type0, 0));
+ int base_low = ada_discrete_type_low_bound (type0->index_type ());
gdb::optional<LONGEST> base_low_pos, low_pos;
CORE_ADDR base;
@@ -3107,7 +3051,7 @@ ada_value_slice_from_ptr (struct value *array_ptr, struct type *type,
if (!low_pos.has_value () || !base_low_pos.has_value ())
{
- warning (_("unable to get positions in slice, use bounds instead"));
+ warning (_ ("unable to get positions in slice, use bounds instead"));
low_pos = low;
base_low_pos = base_low;
}
@@ -3120,7 +3064,6 @@ ada_value_slice_from_ptr (struct value *array_ptr, struct type *type,
return value_at_lazy (slice_type, base);
}
-
static struct value *
ada_value_slice (struct value *array, int low, int high)
{
@@ -3128,19 +3071,18 @@ ada_value_slice (struct value *array, int low, int high)
struct type *base_index_type = type->index_type ()->target_type ();
struct type *index_type
= create_static_range_type (NULL, type->index_type (), low, high);
- struct type *slice_type = create_array_type_with_stride
- (NULL, type->target_type (), index_type,
- type->dyn_prop (DYN_PROP_BYTE_STRIDE),
- TYPE_FIELD_BITSIZE (type, 0));
+ struct type *slice_type
+ = create_array_type_with_stride (NULL, type->target_type (), index_type,
+ type->dyn_prop (DYN_PROP_BYTE_STRIDE),
+ TYPE_FIELD_BITSIZE (type, 0));
gdb::optional<LONGEST> low_pos, high_pos;
-
low_pos = discrete_position (base_index_type, low);
high_pos = discrete_position (base_index_type, high);
if (!low_pos.has_value () || !high_pos.has_value ())
{
- warning (_("unable to get positions in slice, use bounds instead"));
+ warning (_ ("unable to get positions in slice, use bounds instead"));
low_pos = low;
high_pos = high;
}
@@ -3237,7 +3179,7 @@ ada_index_type (struct type *type, int n, const char *name)
type = desc_base_type (type);
if (n < 0 || n > ada_array_arity (type))
- error (_("invalid dimension number to '%s"), name);
+ error (_ ("invalid dimension number to '%s"), name);
if (ada_is_simple_array_type (type))
{
@@ -3259,7 +3201,7 @@ ada_index_type (struct type *type, int n, const char *name)
{
result_type = desc_index_type (desc_bounds_type (type), n);
if (result_type == NULL)
- error (_("attempt to take bound of something that is not an array"));
+ error (_ ("attempt to take bound of something that is not an array"));
}
return result_type;
@@ -3283,7 +3225,7 @@ ada_array_bound_from_type (struct type *arr_type, int n, int which)
arr_type = decode_constrained_packed_array_type (arr_type);
if (arr_type == NULL || !ada_is_simple_array_type (arr_type))
- return (LONGEST) - which;
+ return (LONGEST) -which;
if (arr_type->code () == TYPE_CODE_PTR)
type = arr_type->target_type ();
@@ -3304,8 +3246,8 @@ ada_array_bound_from_type (struct type *arr_type, int n, int which)
}
if (index_type_desc != NULL)
- index_type = to_fixed_range_type (index_type_desc->field (n - 1).type (),
- NULL);
+ index_type
+ = to_fixed_range_type (index_type_desc->field (n - 1).type (), NULL);
else
{
struct type *elt_type = check_typedef (type);
@@ -3316,10 +3258,8 @@ ada_array_bound_from_type (struct type *arr_type, int n, int which)
index_type = elt_type->index_type ();
}
- return
- (LONGEST) (which == 0
- ? ada_discrete_type_low_bound (index_type)
- : ada_discrete_type_high_bound (index_type));
+ return (LONGEST) (which == 0 ? ada_discrete_type_low_bound (index_type)
+ : ada_discrete_type_high_bound (index_type));
}
/* Given that arr is an array value, returns the lower bound of the
@@ -3399,16 +3339,14 @@ empty_array (struct type *arr_type, int low, int high)
{
struct type *arr_type0 = ada_check_typedef (arr_type);
struct type *index_type
- = create_static_range_type
- (NULL, arr_type0->index_type ()->target_type (), low,
- high < low ? low - 1 : high);
+ = create_static_range_type (NULL, arr_type0->index_type ()->target_type (),
+ low, high < low ? low - 1 : high);
struct type *elt_type = ada_array_element_type (arr_type0, 1);
return allocate_value (create_array_type (NULL, elt_type, index_type));
}
-
- /* Name resolution */
+/* Name resolution */
/* The "decoded" name for the user-definable Ada operator corresponding
to OP. */
@@ -3423,7 +3361,7 @@ ada_decoded_op_name (enum exp_opcode op)
if (ada_opname_table[i].op == op)
return ada_opname_table[i].decoded;
}
- error (_("Could not find operator name for opcode"));
+ error (_ ("Could not find operator name for opcode"));
}
/* Returns true (non-zero) iff decoded name N0 should appear before N1
@@ -3505,9 +3443,7 @@ ada_print_symbol_signature (struct ui_file *stream, struct symbol *sym,
struct type *type = sym->type ();
gdb_printf (stream, "%s", sym->print_name ());
- if (!print_signatures
- || type == NULL
- || type->code () != TYPE_CODE_FUNC)
+ if (!print_signatures || type == NULL || type->code () != TYPE_CODE_FUNC)
return;
if (type->num_fields () > 0)
@@ -3519,8 +3455,7 @@ ada_print_symbol_signature (struct ui_file *stream, struct symbol *sym,
{
if (i > 0)
gdb_printf (stream, "; ");
- ada_print_type (type->field (i).type (), NULL, stream, -1, 0,
- flags);
+ ada_print_type (type->field (i).type (), NULL, stream, -1, 0, flags);
}
gdb_printf (stream, ")");
}
@@ -3565,7 +3500,7 @@ get_selections (int *choices, int n_choices, int max_results,
args = command_line_input (buffer, prompt, annotation_suffix);
if (args == NULL)
- error_no_arg (_("one or more choice numbers"));
+ error_no_arg (_ ("one or more choice numbers"));
n_chosen = 0;
@@ -3578,18 +3513,17 @@ get_selections (int *choices, int n_choices, int max_results,
args = skip_spaces (args);
if (*args == '\0' && n_chosen == 0)
- error_no_arg (_("one or more choice numbers"));
+ error_no_arg (_ ("one or more choice numbers"));
else if (*args == '\0')
break;
choice = strtol (args, &args2, 10);
- if (args == args2 || choice < 0
- || choice > n_choices + first_choice - 1)
- error (_("Argument must be choice number"));
+ if (args == args2 || choice < 0 || choice > n_choices + first_choice - 1)
+ error (_ ("Argument must be choice number"));
args = args2;
if (choice == 0)
- error (_("cancelled"));
+ error (_ ("cancelled"));
if (choice < first_choice)
{
@@ -3616,7 +3550,7 @@ get_selections (int *choices, int n_choices, int max_results,
}
if (n_chosen > max_results)
- error (_("Select no more than %d of the above"), max_results);
+ error (_ ("Select no more than %d of the above"), max_results);
return n_chosen;
}
@@ -3633,18 +3567,18 @@ static int
user_select_syms (struct block_symbol *syms, int nsyms, int max_results)
{
int i;
- int *chosen = XALLOCAVEC (int , nsyms);
+ int *chosen = XALLOCAVEC (int, nsyms);
int n_chosen;
int first_choice = (max_results == 1) ? 1 : 2;
const char *select_mode = multiple_symbols_select_mode ();
if (max_results < 1)
- error (_("Request to select 0 symbols!"));
+ error (_ ("Request to select 0 symbols!"));
if (nsyms <= 1)
return nsyms;
if (select_mode == multiple_symbols_cancel)
- error (_("\
+ error (_ ("\
canceled because the command is ambiguous\n\
See set/show multiple-symbol."));
@@ -3654,9 +3588,9 @@ See set/show multiple-symbol."));
if (select_mode == multiple_symbols_all && max_results > 1)
return nsyms;
- gdb_printf (_("[0] cancel\n"));
+ gdb_printf (_ ("[0] cancel\n"));
if (max_results > 1)
- gdb_printf (_("[1] all\n"));
+ gdb_printf (_ ("[1] all\n"));
sort_choices (syms, nsyms);
@@ -3667,29 +3601,29 @@ See set/show multiple-symbol."));
if (syms[i].symbol->aclass () == LOC_BLOCK)
{
- struct symtab_and_line sal =
- find_function_start_sal (syms[i].symbol, 1);
+ struct symtab_and_line sal
+ = find_function_start_sal (syms[i].symbol, 1);
gdb_printf ("[%d] ", i + first_choice);
ada_print_symbol_signature (gdb_stdout, syms[i].symbol,
&type_print_raw_options);
if (sal.symtab == NULL)
- gdb_printf (_(" at %p[<no source file available>%p]:%d\n"),
+ gdb_printf (_ (" at %p[<no source file available>%p]:%d\n"),
metadata_style.style ().ptr (), nullptr, sal.line);
else
- gdb_printf
- (_(" at %ps:%d\n"),
- styled_string (file_name_style.style (),
- symtab_to_filename_for_display (sal.symtab)),
- sal.line);
+ gdb_printf (
+ _ (" at %ps:%d\n"),
+ styled_string (file_name_style.style (),
+ symtab_to_filename_for_display (sal.symtab)),
+ sal.line);
continue;
}
else
{
- int is_enumeral =
- (syms[i].symbol->aclass () == LOC_CONST
- && syms[i].symbol->type () != NULL
- && syms[i].symbol->type ()->code () == TYPE_CODE_ENUM);
+ int is_enumeral
+ = (syms[i].symbol->aclass () == LOC_CONST
+ && syms[i].symbol->type () != NULL
+ && syms[i].symbol->type ()->code () == TYPE_CODE_ENUM);
struct symtab *symtab = NULL;
if (syms[i].symbol->is_objfile_owned ())
@@ -3700,17 +3634,16 @@ See set/show multiple-symbol."));
gdb_printf ("[%d] ", i + first_choice);
ada_print_symbol_signature (gdb_stdout, syms[i].symbol,
&type_print_raw_options);
- gdb_printf (_(" at %s:%d\n"),
+ gdb_printf (_ (" at %s:%d\n"),
symtab_to_filename_for_display (symtab),
syms[i].symbol->line ());
}
- else if (is_enumeral
- && syms[i].symbol->type ()->name () != NULL)
+ else if (is_enumeral && syms[i].symbol->type ()->name () != NULL)
{
gdb_printf (("[%d] "), i + first_choice);
- ada_print_type (syms[i].symbol->type (), NULL,
- gdb_stdout, -1, 0, &type_print_raw_options);
- gdb_printf (_("'(%s) (enumeral)\n"),
+ ada_print_type (syms[i].symbol->type (), NULL, gdb_stdout, -1, 0,
+ &type_print_raw_options);
+ gdb_printf (_ ("'(%s) (enumeral)\n"),
syms[i].symbol->print_name ());
}
else
@@ -3720,14 +3653,11 @@ See set/show multiple-symbol."));
&type_print_raw_options);
if (symtab != NULL)
- gdb_printf (is_enumeral
- ? _(" in %s (enumeral)\n")
- : _(" at %s:?\n"),
+ gdb_printf (is_enumeral ? _ (" in %s (enumeral)\n")
+ : _ (" at %s:?\n"),
symtab_to_filename_for_display (symtab));
else
- gdb_printf (is_enumeral
- ? _(" (enumeral)\n")
- : _(" at ?\n"));
+ gdb_printf (is_enumeral ? _ (" (enumeral)\n") : _ (" at ?\n"));
}
}
}
@@ -3744,17 +3674,16 @@ See set/show multiple-symbol."));
/* See ada-lang.h. */
block_symbol
-ada_find_operator_symbol (enum exp_opcode op, bool parse_completion,
- int nargs, value *argvec[])
+ada_find_operator_symbol (enum exp_opcode op, bool parse_completion, int nargs,
+ value *argvec[])
{
if (possible_user_operator_p (op, argvec))
{
std::vector<struct block_symbol> candidates
- = ada_lookup_symbol_list (ada_decoded_op_name (op),
- NULL, VAR_DOMAIN);
+ = ada_lookup_symbol_list (ada_decoded_op_name (op), NULL, VAR_DOMAIN);
- int i = ada_resolve_function (candidates, argvec,
- nargs, ada_decoded_op_name (op), NULL,
+ int i = ada_resolve_function (candidates, argvec, nargs,
+ ada_decoded_op_name (op), NULL,
parse_completion);
if (i >= 0)
return candidates[i];
@@ -3766,8 +3695,7 @@ ada_find_operator_symbol (enum exp_opcode op, bool parse_completion,
block_symbol
ada_resolve_funcall (struct symbol *sym, const struct block *block,
- struct type *context_type,
- bool parse_completion,
+ struct type *context_type, bool parse_completion,
int nargs, value *argvec[],
innermost_block_tracker *tracker)
{
@@ -3779,13 +3707,11 @@ ada_resolve_funcall (struct symbol *sym, const struct block *block,
i = 0;
else
{
- i = ada_resolve_function
- (candidates,
- argvec, nargs,
- sym->linkage_name (),
- context_type, parse_completion);
+ i = ada_resolve_function (candidates, argvec, nargs,
+ sym->linkage_name (), context_type,
+ parse_completion);
if (i < 0)
- error (_("Could not find a match for %s"), sym->print_name ());
+ error (_ ("Could not find a match for %s"), sym->print_name ());
}
tracker->update (candidates[i]);
@@ -3796,9 +3722,8 @@ ada_resolve_funcall (struct symbol *sym, const struct block *block,
enumeration type. */
static int
-ada_resolve_enum (std::vector<struct block_symbol> &syms,
- const char *name, struct type *context_type,
- bool parse_completion)
+ada_resolve_enum (std::vector<struct block_symbol> &syms, const char *name,
+ struct type *context_type, bool parse_completion)
{
gdb_assert (context_type->code () == TYPE_CODE_ENUM);
context_type = ada_check_typedef (context_type);
@@ -3811,7 +3736,7 @@ ada_resolve_enum (std::vector<struct block_symbol> &syms,
return i;
}
- error (_("No name '%s' in enumeration type '%s'"), name,
+ error (_ ("No name '%s' in enumeration type '%s'"), name,
ada_type_name (context_type));
}
@@ -3819,78 +3744,65 @@ ada_resolve_enum (std::vector<struct block_symbol> &syms,
block_symbol
ada_resolve_variable (struct symbol *sym, const struct block *block,
- struct type *context_type,
- bool parse_completion,
- int deprocedure_p,
- innermost_block_tracker *tracker)
+ struct type *context_type, bool parse_completion,
+ int deprocedure_p, innermost_block_tracker *tracker)
{
std::vector<struct block_symbol> candidates
= ada_lookup_symbol_list (sym->linkage_name (), block, VAR_DOMAIN);
- if (std::any_of (candidates.begin (),
- candidates.end (),
- [] (block_symbol &bsym)
- {
- switch (bsym.symbol->aclass ())
- {
- case LOC_REGISTER:
- case LOC_ARG:
- case LOC_REF_ARG:
- case LOC_REGPARM_ADDR:
- case LOC_LOCAL:
- case LOC_COMPUTED:
- return true;
- default:
- return false;
- }
- }))
+ if (std::any_of (candidates.begin (), candidates.end (),
+ [] (block_symbol &bsym) {
+ switch (bsym.symbol->aclass ())
+ {
+ case LOC_REGISTER:
+ case LOC_ARG:
+ case LOC_REF_ARG:
+ case LOC_REGPARM_ADDR:
+ case LOC_LOCAL:
+ case LOC_COMPUTED:
+ return true;
+ default:
+ return false;
+ }
+ }))
{
/* Types tend to get re-introduced locally, so if there
are any local symbols that are not types, first filter
out all types. */
- candidates.erase
- (std::remove_if
- (candidates.begin (),
- candidates.end (),
- [] (block_symbol &bsym)
- {
- return bsym.symbol->aclass () == LOC_TYPEDEF;
- }),
- candidates.end ());
+ candidates.erase (std::remove_if (
+ candidates.begin (), candidates.end (),
+ [] (block_symbol &bsym) {
+ return bsym.symbol->aclass () == LOC_TYPEDEF;
+ }),
+ candidates.end ());
}
/* Filter out artificial symbols. */
- candidates.erase
- (std::remove_if
- (candidates.begin (),
- candidates.end (),
- [] (block_symbol &bsym)
- {
- return bsym.symbol->is_artificial ();
- }),
- candidates.end ());
+ candidates.erase (std::remove_if (
+ candidates.begin (), candidates.end (),
+ [] (block_symbol &bsym) {
+ return bsym.symbol->is_artificial ();
+ }),
+ candidates.end ());
int i;
if (candidates.empty ())
- error (_("No definition found for %s"), sym->print_name ());
+ error (_ ("No definition found for %s"), sym->print_name ());
else if (candidates.size () == 1)
i = 0;
- else if (context_type != nullptr
- && context_type->code () == TYPE_CODE_ENUM)
+ else if (context_type != nullptr && context_type->code () == TYPE_CODE_ENUM)
i = ada_resolve_enum (candidates, sym->linkage_name (), context_type,
parse_completion);
else if (deprocedure_p && !is_nonfunction (candidates))
{
- i = ada_resolve_function
- (candidates, NULL, 0,
- sym->linkage_name (),
- context_type, parse_completion);
+ i = ada_resolve_function (candidates, NULL, 0, sym->linkage_name (),
+ context_type, parse_completion);
if (i < 0)
- error (_("Could not find a match for %s"), sym->print_name ());
+ error (_ ("Could not find a match for %s"), sym->print_name ());
}
else
{
- gdb_printf (_("Multiple matches for %s\n"), sym->print_name ());
+ gdb_printf (_ ("Multiple matches for %s\n"), sym->print_name ());
user_select_syms (candidates.data (), candidates.size (), 1);
i = 0;
}
@@ -3968,8 +3880,7 @@ ada_args_match (struct symbol *func, struct value **actuals, int n_actuals)
int i;
struct type *func_type = func->type ();
- if (func->aclass () == LOC_CONST
- && func_type->code () == TYPE_CODE_ENUM)
+ if (func->aclass () == LOC_CONST && func_type->code () == TYPE_CODE_ENUM)
return (n_actuals == 0);
else if (func_type == NULL || func_type->code () != TYPE_CODE_FUNC)
return 0;
@@ -3983,7 +3894,8 @@ ada_args_match (struct symbol *func, struct value **actuals, int n_actuals)
return 0;
else
{
- struct type *ftype = ada_check_typedef (func_type->field (i).type ());
+ struct type *ftype
+ = ada_check_typedef (func_type->field (i).type ());
struct type *atype = ada_check_typedef (value_type (actuals[i]));
if (!ada_type_match (ftype, atype))
@@ -4023,7 +3935,6 @@ return_match (struct type *func_type, struct type *context_type)
return return_type->code () == context_type->code ();
}
-
/* Returns the index in SYMS that contains the symbol for the
function (if any) that matches the types of the NARGS arguments in
ARGS. If CONTEXT_TYPE is non-null and there is at least one match
@@ -4038,13 +3949,12 @@ return_match (struct type *func_type, struct type *context_type)
static int
ada_resolve_function (std::vector<struct block_symbol> &syms,
- struct value **args, int nargs,
- const char *name, struct type *context_type,
- bool parse_completion)
+ struct value **args, int nargs, const char *name,
+ struct type *context_type, bool parse_completion)
{
int fallback;
int k;
- int m; /* Number of hits */
+ int m; /* Number of hits */
m = 0;
/* In the first pass of the loop, we only accept functions matching
@@ -4073,7 +3983,7 @@ ada_resolve_function (std::vector<struct block_symbol> &syms,
return -1;
else if (m > 1 && !parse_completion)
{
- gdb_printf (_("Multiple matches for %s\n"), name);
+ gdb_printf (_ ("Multiple matches for %s\n"), name);
user_select_syms (syms.data (), m, 1);
return 0;
}
@@ -4184,10 +4094,10 @@ discrete_type_p (struct type *type)
static int
possible_user_operator_p (enum exp_opcode op, struct value *args[])
{
- struct type *type0 =
- (args[0] == NULL) ? NULL : ada_check_typedef (value_type (args[0]));
- struct type *type1 =
- (args[1] == NULL) ? NULL : ada_check_typedef (value_type (args[1]));
+ struct type *type0
+ = (args[0] == NULL) ? NULL : ada_check_typedef (value_type (args[0]));
+ struct type *type1
+ = (args[1] == NULL) ? NULL : ada_check_typedef (value_type (args[1]));
if (type0 == NULL)
return 0;
@@ -4229,11 +4139,10 @@ possible_user_operator_p (enum exp_opcode op, struct value *args[])
case UNOP_LOGICAL_NOT:
case UNOP_ABS:
return (!numeric_type_p (type0));
-
}
}
-
- /* Renaming */
+
+/* Renaming */
/* NOTES:
@@ -4267,8 +4176,7 @@ possible_user_operator_p (enum exp_opcode op, struct value *args[])
[Currently, however, GCC does not generate subprogram renamings.] */
enum ada_renaming_category
-ada_parse_renaming (struct symbol *sym,
- const char **renamed_entity, int *len,
+ada_parse_renaming (struct symbol *sym, const char **renamed_entity, int *len,
const char **renaming_expr)
{
enum ada_renaming_category kind;
@@ -4277,7 +4185,7 @@ ada_parse_renaming (struct symbol *sym,
if (sym == NULL)
return ADA_NOT_RENAMING;
- switch (sym->aclass ())
+ switch (sym->aclass ())
{
default:
return ADA_NOT_RENAMING;
@@ -4338,9 +4246,8 @@ ada_read_renaming_var_value (struct symbol *renaming_sym,
expression_up expr = parse_exp_1 (&sym_name, 0, block, 0);
return evaluate_expression (expr.get ());
}
-
- /* Evaluation: Function Calls */
+/* Evaluation: Function Calls */
/* Return an lvalue containing the value VAL. This is the identity on
lvalues, and otherwise has the side-effect of allocating memory
@@ -4349,12 +4256,11 @@ ada_read_renaming_var_value (struct symbol *renaming_sym,
static struct value *
ensure_lval (struct value *val)
{
- if (VALUE_LVAL (val) == not_lval
- || VALUE_LVAL (val) == lval_internalvar)
+ if (VALUE_LVAL (val) == not_lval || VALUE_LVAL (val) == lval_internalvar)
{
int len = ada_check_typedef (value_type (val))->length ();
- const CORE_ADDR addr =
- value_as_long (value_allocate_space_in_inferior (len));
+ const CORE_ADDR addr
+ = value_as_long (value_allocate_space_in_inferior (len));
VALUE_LVAL (val) = lval_memory;
set_value_address (val, addr);
@@ -4442,8 +4348,7 @@ ada_value_struct_elt (struct value *arg, const char *name, int no_err)
/* We first try to find the searched field in the current type.
If not found then let's look in the fixed type. */
- if (!find_struct_field (name, t1, 0,
- nullptr, nullptr, nullptr,
+ if (!find_struct_field (name, t1, 0, nullptr, nullptr, nullptr,
nullptr, nullptr))
check_tag = 1;
else
@@ -4454,16 +4359,15 @@ ada_value_struct_elt (struct value *arg, const char *name, int no_err)
/* Convert to fixed type in all cases, so that we have proper
offsets to each field in unconstrained record types. */
- t1 = ada_to_fixed_type (ada_get_base_type (t1), NULL,
- address, NULL, check_tag);
+ t1 = ada_to_fixed_type (ada_get_base_type (t1), NULL, address, NULL,
+ check_tag);
/* Resolve the dynamic type as well. */
arg = value_from_contents_and_address (t1, nullptr, address);
t1 = value_type (arg);
- if (find_struct_field (name, t1, 0,
- &field_type, &byte_offset, &bit_offset,
- &bit_size, NULL))
+ if (find_struct_field (name, t1, 0, &field_type, &byte_offset,
+ &bit_offset, &bit_size, NULL))
{
if (bit_size != 0)
{
@@ -4483,14 +4387,14 @@ ada_value_struct_elt (struct value *arg, const char *name, int no_err)
if (v != NULL || no_err)
return v;
else
- error (_("There is no member named %s."), name);
+ error (_ ("There is no member named %s."), name);
- BadValue:
+BadValue:
if (no_err)
return NULL;
else
- error (_("Attempt to extract a component of "
- "a value that is not a record."));
+ error (_ ("Attempt to extract a component of "
+ "a value that is not a record."));
}
/* Return the value ACTUAL, converted to be an appropriate value for a
@@ -4503,12 +4407,14 @@ ada_convert_actual (struct value *actual, struct type *formal_type0)
{
struct type *actual_type = ada_check_typedef (value_type (actual));
struct type *formal_type = ada_check_typedef (formal_type0);
- struct type *formal_target =
- formal_type->code () == TYPE_CODE_PTR
- ? ada_check_typedef (formal_type->target_type ()) : formal_type;
- struct type *actual_target =
- actual_type->code () == TYPE_CODE_PTR
- ? ada_check_typedef (actual_type->target_type ()) : actual_type;
+ struct type *formal_target
+ = formal_type->code () == TYPE_CODE_PTR
+ ? ada_check_typedef (formal_type->target_type ())
+ : formal_type;
+ struct type *actual_target
+ = actual_type->code () == TYPE_CODE_PTR
+ ? ada_check_typedef (actual_type->target_type ())
+ : actual_type;
if (ada_is_array_descriptor_type (formal_target)
&& actual_target->code () == TYPE_CODE_ARRAY)
@@ -4572,7 +4478,6 @@ value_pointer (struct value *value, struct type *type)
return addr;
}
-
/* Push a descriptor of type TYPE for array value ARR on the stack at
*SP, updating *SP to reflect the new descriptor. Return either
an lvalue representing the new descriptor, or (if TYPE is a pointer-
@@ -4588,8 +4493,8 @@ make_array_descriptor (struct type *type, struct value *arr)
struct value *bounds = allocate_value (bounds_type);
int i;
- for (i = ada_array_arity (ada_check_typedef (value_type (arr)));
- i > 0; i -= 1)
+ for (i = ada_array_arity (ada_check_typedef (value_type (arr))); i > 0;
+ i -= 1)
{
modify_field (value_type (bounds),
value_contents_writeable (bounds).data (),
@@ -4605,17 +4510,14 @@ make_array_descriptor (struct type *type, struct value *arr)
bounds = ensure_lval (bounds);
- modify_field (value_type (descriptor),
- value_contents_writeable (descriptor).data (),
- value_pointer (ensure_lval (arr),
- desc_type->field (0).type ()),
- fat_pntr_data_bitpos (desc_type),
- fat_pntr_data_bitsize (desc_type));
+ modify_field (
+ value_type (descriptor), value_contents_writeable (descriptor).data (),
+ value_pointer (ensure_lval (arr), desc_type->field (0).type ()),
+ fat_pntr_data_bitpos (desc_type), fat_pntr_data_bitsize (desc_type));
modify_field (value_type (descriptor),
value_contents_writeable (descriptor).data (),
- value_pointer (bounds,
- desc_type->field (1).type ()),
+ value_pointer (bounds, desc_type->field (1).type ()),
fat_pntr_bounds_bitpos (desc_type),
fat_pntr_bounds_bitsize (desc_type));
@@ -4626,8 +4528,8 @@ make_array_descriptor (struct type *type, struct value *arr)
else
return descriptor;
}
-
- /* Symbol Cache Module */
+
+/* Symbol Cache Module */
/* Performance measurements made as of 2010-01-15 indicate that
this cache does bring some noticeable improvements. Depending
@@ -4743,8 +4645,8 @@ cache_symbol (const char *name, domain_enum domain, struct symbol *sym,
e->domain = domain;
e->block = block;
}
-
- /* Symbol Lookup */
+
+/* Symbol Lookup */
/* Return the symbol name match type that should be used used when
searching for all symbols matching LOOKUP_NAME.
@@ -4755,9 +4657,8 @@ cache_symbol (const char *name, domain_enum domain, struct symbol *sym,
static symbol_name_match_type
name_match_type_from_name (const char *lookup_name)
{
- return (strstr (lookup_name, "__") == NULL
- ? symbol_name_match_type::WILD
- : symbol_name_match_type::FULL);
+ return (strstr (lookup_name, "__") == NULL ? symbol_name_match_type::WILD
+ : symbol_name_match_type::FULL);
}
/* Return the result of a standard (literal, C-like) lookup of NAME in
@@ -4777,7 +4678,6 @@ standard_lookup (const char *name, const struct block *block,
return sym.symbol;
}
-
/* Non-zero iff there is at least one non-function/non-enumeral symbol
in the symbol fields of SYMS. We treat enumerals as functions,
since they contend in overloading in the same way. */
@@ -4801,11 +4701,9 @@ equiv_types (struct type *type0, struct type *type1)
{
if (type0 == type1)
return 1;
- if (type0 == NULL || type1 == NULL
- || type0->code () != type1->code ())
+ if (type0 == NULL || type1 == NULL || type0->code () != type1->code ())
return 0;
- if ((type0->code () == TYPE_CODE_STRUCT
- || type0->code () == TYPE_CODE_ENUM)
+ if ((type0->code () == TYPE_CODE_STRUCT || type0->code () == TYPE_CODE_ENUM)
&& ada_type_name (type0) != NULL && ada_type_name (type1) != NULL
&& strcmp (ada_type_name (type0), ada_type_name (type1)) == 0)
return 1;
@@ -4821,8 +4719,7 @@ lesseq_defined_than (struct symbol *sym0, struct symbol *sym1)
{
if (sym0 == sym1)
return 1;
- if (sym0->domain () != sym1->domain ()
- || sym0->aclass () != sym1->aclass ())
+ if (sym0->domain () != sym1->domain () || sym0->aclass () != sym1->aclass ())
return 0;
switch (sym0->aclass ())
@@ -4837,15 +4734,15 @@ lesseq_defined_than (struct symbol *sym0, struct symbol *sym1)
const char *name1 = sym1->linkage_name ();
int len0 = strlen (name0);
- return
- type0->code () == type1->code ()
- && (equiv_types (type0, type1)
- || (len0 < strlen (name1) && strncmp (name0, name1, len0) == 0
- && startswith (name1 + len0, "___XV")));
+ return type0->code () == type1->code ()
+ && (equiv_types (type0, type1)
+ || (len0 < strlen (name1)
+ && strncmp (name0, name1, len0) == 0
+ && startswith (name1 + len0, "___XV")));
}
case LOC_CONST:
return sym0->value_longest () == sym1->value_longest ()
- && equiv_types (sym0->type (), sym1->type ());
+ && equiv_types (sym0->type (), sym1->type ());
case LOC_STATIC:
{
@@ -4864,8 +4761,7 @@ lesseq_defined_than (struct symbol *sym0, struct symbol *sym1)
records in RESULT. Do nothing if SYM is a duplicate. */
static void
-add_defn_to_vec (std::vector<struct block_symbol> &result,
- struct symbol *sym,
+add_defn_to_vec (std::vector<struct block_symbol> &result, struct symbol *sym,
const struct block *block)
{
/* Do not try to complete stub types, as the debugger is probably
@@ -4912,23 +4808,23 @@ ada_lookup_simple_minsym (const char *name, struct objfile *objfile)
symbol_name_matcher_ftype *match_name
= ada_get_symbol_name_matcher (lookup_name);
- gdbarch_iterate_over_objfiles_in_search_order
- (objfile != NULL ? objfile->arch () : target_gdbarch (),
- [&result, lookup_name, match_name] (struct objfile *obj)
- {
- for (minimal_symbol *msymbol : obj->msymbols ())
- {
- if (match_name (msymbol->linkage_name (), lookup_name, nullptr)
- && msymbol->type () != mst_solib_trampoline)
- {
- result.minsym = msymbol;
- result.objfile = obj;
- return 1;
- }
- }
-
- return 0;
- }, objfile);
+ gdbarch_iterate_over_objfiles_in_search_order (
+ objfile != NULL ? objfile->arch () : target_gdbarch (),
+ [&result, lookup_name, match_name] (struct objfile *obj) {
+ for (minimal_symbol *msymbol : obj->msymbols ())
+ {
+ if (match_name (msymbol->linkage_name (), lookup_name, nullptr)
+ && msymbol->type () != mst_solib_trampoline)
+ {
+ result.minsym = msymbol;
+ result.objfile = obj;
+ return 1;
+ }
+ }
+
+ return 0;
+ },
+ objfile);
return result;
}
@@ -4978,9 +4874,9 @@ ada_identical_enum_types_p (struct type *type1, struct type *type2)
ada_remove_trailing_digits (type1->field (i).name (), &len_1);
ada_remove_trailing_digits (type2->field (i).name (), &len_2);
if (len_1 != len_2
- || strncmp (type1->field (i).name (),
- type2->field (i).name (),
- len_1) != 0)
+ || strncmp (type1->field (i).name (), type2->field (i).name (),
+ len_1)
+ != 0)
return 0;
}
@@ -5076,11 +4972,11 @@ remove_extra_symbols (std::vector<struct block_symbol> *syms)
{
for (j = 0; j < syms->size (); j++)
{
- if (j != i
- && !(*syms)[j].symbol->type ()->is_stub ()
+ if (j != i && !(*syms)[j].symbol->type ()->is_stub ()
&& (*syms)[j].symbol->linkage_name () != NULL
&& strcmp ((*syms)[i].symbol->linkage_name (),
- (*syms)[j].symbol->linkage_name ()) == 0)
+ (*syms)[j].symbol->linkage_name ())
+ == 0)
remove_p = 1;
}
}
@@ -5089,23 +4985,23 @@ remove_extra_symbols (std::vector<struct block_symbol> *syms)
should be identical. */
else if ((*syms)[i].symbol->linkage_name () != NULL
- && (*syms)[i].symbol->aclass () == LOC_STATIC
- && is_nondebugging_type ((*syms)[i].symbol->type ()))
+ && (*syms)[i].symbol->aclass () == LOC_STATIC
+ && is_nondebugging_type ((*syms)[i].symbol->type ()))
{
for (j = 0; j < syms->size (); j += 1)
{
- if (i != j
- && (*syms)[j].symbol->linkage_name () != NULL
+ if (i != j && (*syms)[j].symbol->linkage_name () != NULL
&& strcmp ((*syms)[i].symbol->linkage_name (),
- (*syms)[j].symbol->linkage_name ()) == 0
+ (*syms)[j].symbol->linkage_name ())
+ == 0
&& ((*syms)[i].symbol->aclass ()
== (*syms)[j].symbol->aclass ())
&& (*syms)[i].symbol->value_address ()
- == (*syms)[j].symbol->value_address ())
+ == (*syms)[j].symbol->value_address ())
remove_p = 1;
}
}
-
+
if (remove_p)
syms->erase (syms->begin () + i);
else
@@ -5283,8 +5179,8 @@ remove_irrelevant_renamings (std::vector<struct block_symbol> *syms,
is_new_style_renaming = 1;
for (j = 0; j < syms->size (); j += 1)
if (i != j && (*syms)[j].symbol != NULL
- && strncmp (name, (*syms)[j].symbol->linkage_name (),
- name_len) == 0
+ && strncmp (name, (*syms)[j].symbol->linkage_name (), name_len)
+ == 0
&& block == (*syms)[j].block)
(*syms)[j].symbol = NULL;
}
@@ -5295,10 +5191,10 @@ remove_irrelevant_renamings (std::vector<struct block_symbol> *syms,
for (j = k = 0; j < syms->size (); j += 1)
if ((*syms)[j].symbol != NULL)
- {
- (*syms)[k] = (*syms)[j];
- k += 1;
- }
+ {
+ (*syms)[k] = (*syms)[j];
+ k += 1;
+ }
syms->resize (k);
return;
}
@@ -5325,7 +5221,7 @@ remove_irrelevant_renamings (std::vector<struct block_symbol> *syms,
while (i < syms->size ())
{
if (ada_parse_renaming ((*syms)[i].symbol, NULL, NULL, NULL)
- == ADA_OBJECT_RENAMING
+ == ADA_OBJECT_RENAMING
&& old_renaming_is_invisible ((*syms)[i].symbol,
current_function_name))
syms->erase (syms->begin () + i);
@@ -5367,6 +5263,7 @@ struct match_data
: resultp (rp)
{
}
+
DISABLE_COPY_AND_ASSIGN (match_data);
bool operator() (struct block_symbol *bsym);
@@ -5393,7 +5290,7 @@ match_data::operator() (struct block_symbol *bsym)
found_sym = false;
arg_sym = NULL;
}
- else
+ else
{
if (sym->aclass () == LOC_UNRESOLVED)
return true;
@@ -5424,8 +5321,7 @@ ada_add_block_renamings (std::vector<struct block_symbol> &result,
symbol_name_matcher_ftype *name_match
= ada_get_symbol_name_matcher (lookup_name);
- for (renaming = block_using (block);
- renaming != NULL;
+ for (renaming = block_using (block); renaming != NULL;
renaming = renaming->next)
{
const char *r_name;
@@ -5436,8 +5332,7 @@ ada_add_block_renamings (std::vector<struct block_symbol> &result,
Currently, symbol lookup in Ada don't use the namespace machinery from
C++/Fortran support: skip namespace imports that use them. */
if (renaming->searched
- || (renaming->import_src != NULL
- && renaming->import_src[0] != '\0')
+ || (renaming->import_src != NULL && renaming->import_src[0] != '\0')
|| (renaming->import_dest != NULL
&& renaming->import_dest[0] != '\0'))
continue;
@@ -5450,15 +5345,14 @@ ada_add_block_renamings (std::vector<struct block_symbol> &result,
the DWARF reader to associate a symbol to this renaming, instead of a
name. So, for now, we do something simpler: re-use the C++/Fortran
namespace machinery. */
- r_name = (renaming->alias != NULL
- ? renaming->alias
- : renaming->declaration);
+ r_name
+ = (renaming->alias != NULL ? renaming->alias : renaming->declaration);
if (name_match (r_name, lookup_name, NULL))
{
lookup_name_info decl_lookup_name (renaming->declaration,
lookup_name.match_type ());
- ada_add_all_symbols (result, block, decl_lookup_name, domain,
- 1, NULL);
+ ada_add_all_symbols (result, block, decl_lookup_name, domain, 1,
+ NULL);
}
renaming->searched = 0;
}
@@ -5565,11 +5459,8 @@ ada_lookup_name (const lookup_name_info &lookup_name)
static void
map_matching_symbols (struct objfile *objfile,
- const lookup_name_info &lookup_name,
- bool is_wild_match,
- domain_enum domain,
- int global,
- match_data &data)
+ const lookup_name_info &lookup_name, bool is_wild_match,
+ domain_enum domain, int global, match_data &data)
{
data.objfile = objfile;
objfile->expand_matching_symbols (lookup_name, domain, global,
@@ -5578,10 +5469,8 @@ map_matching_symbols (struct objfile *objfile,
const int block_kind = global ? GLOBAL_BLOCK : STATIC_BLOCK;
for (compunit_symtab *symtab : objfile->compunits ())
{
- const struct block *block
- = symtab->blockvector ()->block (block_kind);
- if (!iterate_over_symbols_terminated (block, lookup_name,
- domain, data))
+ const struct block *block = symtab->blockvector ()->block (block_kind);
+ if (!iterate_over_symbols_terminated (block, lookup_name, domain, data))
break;
}
}
@@ -5593,8 +5482,8 @@ map_matching_symbols (struct objfile *objfile,
static void
add_nonlocal_symbols (std::vector<struct block_symbol> &result,
- const lookup_name_info &lookup_name,
- domain_enum domain, int global)
+ const lookup_name_info &lookup_name, domain_enum domain,
+ int global)
{
struct match_data data (&result);
@@ -5647,10 +5536,8 @@ add_nonlocal_symbols (std::vector<struct block_symbol> &result,
static void
ada_add_all_symbols (std::vector<struct block_symbol> &result,
const struct block *block,
- const lookup_name_info &lookup_name,
- domain_enum domain,
- int full_search,
- int *made_global_lookup_p)
+ const lookup_name_info &lookup_name, domain_enum domain,
+ int full_search, int *made_global_lookup_p)
{
struct symbol *sym;
@@ -5688,8 +5575,8 @@ ada_add_all_symbols (std::vector<struct block_symbol> &result,
already performed this search before. If we have, then return
the same result. */
- if (lookup_cached_symbol (ada_lookup_name (lookup_name),
- domain, &sym, &block))
+ if (lookup_cached_symbol (ada_lookup_name (lookup_name), domain, &sym,
+ &block))
{
if (sym != NULL)
add_defn_to_vec (result, sym, block);
@@ -5700,7 +5587,7 @@ ada_add_all_symbols (std::vector<struct block_symbol> &result,
*made_global_lookup_p = 1;
/* Search symbols from all global blocks. */
-
+
add_nonlocal_symbols (result, lookup_name, domain, 1);
/* Now add symbols from all per-file blocks if we've gotten no hits
@@ -5727,15 +5614,14 @@ ada_add_all_symbols (std::vector<struct block_symbol> &result,
static std::vector<struct block_symbol>
ada_lookup_symbol_list_worker (const lookup_name_info &lookup_name,
- const struct block *block,
- domain_enum domain,
+ const struct block *block, domain_enum domain,
int full_search)
{
int syms_from_global_search;
std::vector<struct block_symbol> results;
- ada_add_all_symbols (results, block, lookup_name,
- domain, full_search, &syms_from_global_search);
+ ada_add_all_symbols (results, block, lookup_name, domain, full_search,
+ &syms_from_global_search);
remove_extra_symbols (&results);
@@ -5743,8 +5629,8 @@ ada_lookup_symbol_list_worker (const lookup_name_info &lookup_name,
cache_symbol (ada_lookup_name (lookup_name), domain, NULL, NULL);
if (results.size () == 1 && full_search && syms_from_global_search)
- cache_symbol (ada_lookup_name (lookup_name), domain,
- results[0].symbol, results[0].block);
+ cache_symbol (ada_lookup_name (lookup_name), domain, results[0].symbol,
+ results[0].block);
remove_irrelevant_renamings (&results, block);
return results;
@@ -5774,8 +5660,7 @@ ada_lookup_symbol_list (const char *name, const struct block *block,
void
ada_lookup_encoded_symbol (const char *name, const struct block *block,
- domain_enum domain,
- struct block_symbol *info)
+ domain_enum domain, struct block_symbol *info)
{
/* Since we already have an encoded name, wrap it in '<>' to force a
verbatim match. Otherwise, if the name happens to not look like
@@ -5807,7 +5692,6 @@ ada_lookup_symbol (const char *name, const struct block *block0,
return candidates[0];
}
-
/* True iff STR is a possible encoded suffix of a normal Ada name
that is to be ignored for matching purposes. Suffixes of parallel
names (e.g., XVE) are not included here. Currently, the possible suffixes
@@ -5838,7 +5722,7 @@ is_name_suffix (const char *str)
while (isdigit (str[0]))
str += 1;
}
-
+
/* [.$][0-9]+ */
if (str[0] == '.' || str[0] == '$')
@@ -5884,13 +5768,12 @@ is_name_suffix (const char *str)
#endif
/* _E[0-9]+[bs]$ */
- if (len > 3 && str[0] == '_' && str [1] == 'E' && isdigit (str[2]))
+ if (len > 3 && str[0] == '_' && str[1] == 'E' && isdigit (str[2]))
{
matching = str + 3;
while (isdigit (matching[0]))
matching += 1;
- if ((matching[0] == 'b' || matching[0] == 's')
- && matching [1] == '\0')
+ if ((matching[0] == 'b' || matching[0] == 's') && matching[1] == '\0')
return 1;
}
@@ -5930,8 +5813,8 @@ is_name_suffix (const char *str)
return 1;
if (str[3] != 'X')
return 0;
- if (str[4] == 'F' || str[4] == 'D' || str[4] == 'B'
- || str[4] == 'U' || str[4] == 'P')
+ if (str[4] == 'F' || str[4] == 'D' || str[4] == 'B' || str[4] == 'U'
+ || str[4] == 'P')
return 1;
if (str[4] == 'R' && str[5] != 'T')
return 1;
@@ -5969,7 +5852,7 @@ is_valid_name_for_wild_match (const char *name0)
if (decoded_name[0] == '<')
return 0;
- for (i=0; decoded_name[i] != '\0'; i++)
+ for (i = 0; decoded_name[i] != '\0'; i++)
if (isalpha (decoded_name[i]) && !islower (decoded_name[i]))
return 0;
@@ -6001,8 +5884,9 @@ advance_wild_match (const char **namep, const char *name0, char target0)
else
name += 1;
}
- else if (t1 == '_' && ((name[2] >= 'a' && name[2] <= 'z')
- || name[2] == target0))
+ else if (t1 == '_'
+ && ((name[2] >= 'a' && name[2] <= 'z')
+ || name[2] == target0))
{
name += 2;
break;
@@ -6067,8 +5951,8 @@ wild_match (const char *name, const char *patn)
static void
ada_add_block_symbols (std::vector<struct block_symbol> &result,
const struct block *block,
- const lookup_name_info &lookup_name,
- domain_enum domain, struct objfile *objfile)
+ const lookup_name_info &lookup_name, domain_enum domain,
+ struct objfile *objfile)
{
struct block_iterator iter;
/* A matching argument symbol, if any. */
@@ -6079,8 +5963,7 @@ ada_add_block_symbols (std::vector<struct block_symbol> &result,
arg_sym = NULL;
found_sym = false;
- for (sym = block_iter_match_first (block, lookup_name, &iter);
- sym != NULL;
+ for (sym = block_iter_match_first (block, lookup_name, &iter); sym != NULL;
sym = block_iter_match_next (lookup_name, &iter))
{
if (symbol_matches_domain (sym->language (), sym->domain (), domain))
@@ -6117,37 +6000,35 @@ ada_add_block_symbols (std::vector<struct block_symbol> &result,
size_t name_len = ada_lookup_name.size ();
ALL_BLOCK_SYMBOLS (block, iter, sym)
- {
- if (symbol_matches_domain (sym->language (),
- sym->domain (), domain))
- {
- int cmp;
+ {
+ if (symbol_matches_domain (sym->language (), sym->domain (), domain))
+ {
+ int cmp;
- cmp = (int) '_' - (int) sym->linkage_name ()[0];
- if (cmp == 0)
- {
- cmp = !startswith (sym->linkage_name (), "_ada_");
- if (cmp == 0)
- cmp = strncmp (name, sym->linkage_name () + 5,
- name_len);
- }
+ cmp = (int) '_' - (int) sym->linkage_name ()[0];
+ if (cmp == 0)
+ {
+ cmp = !startswith (sym->linkage_name (), "_ada_");
+ if (cmp == 0)
+ cmp = strncmp (name, sym->linkage_name () + 5, name_len);
+ }
- if (cmp == 0
- && is_name_suffix (sym->linkage_name () + name_len + 5))
- {
- if (sym->aclass () != LOC_UNRESOLVED)
- {
- if (sym->is_argument ())
- arg_sym = sym;
- else
- {
- found_sym = true;
- add_defn_to_vec (result, sym, block);
- }
- }
- }
- }
- }
+ if (cmp == 0
+ && is_name_suffix (sym->linkage_name () + name_len + 5))
+ {
+ if (sym->aclass () != LOC_UNRESOLVED)
+ {
+ if (sym->is_argument ())
+ arg_sym = sym;
+ else
+ {
+ found_sym = true;
+ add_defn_to_vec (result, sym, block);
+ }
+ }
+ }
+ }
+ }
/* NOTE: This really shouldn't be needed for _ada_ symbols.
They aren't parameters, right? */
@@ -6157,17 +6038,15 @@ ada_add_block_symbols (std::vector<struct block_symbol> &result,
}
}
}
-
- /* Symbol Completion */
+/* Symbol Completion */
/* See symtab.h. */
bool
-ada_lookup_name_info::matches
- (const char *sym_name,
- symbol_name_match_type match_type,
- completion_match_result *comp_match_res) const
+ada_lookup_name_info::matches (const char *sym_name,
+ symbol_name_match_type match_type,
+ completion_match_result *comp_match_res) const
{
bool match = false;
const char *text = m_encoded_name.c_str ();
@@ -6199,7 +6078,8 @@ ada_lookup_name_info::matches
angle bracket notation. */
const char *tmp;
- for (tmp = sym_name; *tmp != '\0' && !isupper (*tmp); tmp++);
+ for (tmp = sym_name; *tmp != '\0' && !isupper (*tmp); tmp++)
+ ;
if (*tmp != '\0')
match = false;
}
@@ -6234,7 +6114,6 @@ ada_lookup_name_info::matches
match_str = add_angle_brackets (sym_name);
else
match_str = sym_name;
-
}
comp_match_res->set_match (match_str.c_str ());
@@ -6243,7 +6122,7 @@ ada_lookup_name_info::matches
return true;
}
- /* Field Access */
+/* Field Access */
/* Return non-zero if TYPE is a pointer to the GNAT dispatch table used
for tagged types. */
@@ -6351,8 +6230,7 @@ ada_is_tag_type (struct type *type)
{
const char *name = ada_type_name (type->target_type ());
- return (name != NULL
- && strcmp (name, "ada__tags__dispatch_table") == 0);
+ return (name != NULL && strcmp (name, "ada__tags__dispatch_table") == 0);
}
}
@@ -6400,9 +6278,8 @@ value_tag_from_contents_and_address (struct type *type,
if (find_struct_field ("_tag", resolved_type, 0, &tag_type, &tag_byte_offset,
NULL, NULL, NULL))
{
- const gdb_byte *valaddr1 = ((valaddr == NULL)
- ? NULL
- : valaddr + tag_byte_offset);
+ const gdb_byte *valaddr1
+ = ((valaddr == NULL) ? NULL : valaddr + tag_byte_offset);
CORE_ADDR address1 = (address == 0) ? 0 : address + tag_byte_offset;
return value_from_contents_and_address (tag_type, valaddr1, address1);
@@ -6453,7 +6330,7 @@ ada_tag_value_at_base_address (struct value *obj)
struct type *offset_type
= language_lookup_primitive_type (language_def (language_ada),
- target_gdbarch(), "storage_offset");
+ target_gdbarch (), "storage_offset");
ptr_type = lookup_pointer_type (offset_type);
val = value_cast (ptr_type, tag);
if (!val)
@@ -6565,7 +6442,7 @@ ada_get_tsd_from_tag (struct value *tag)
and instead the tsd pointer is stored just before the dispatch
table. */
- type = ada_get_tsd_type (current_inferior());
+ type = ada_get_tsd_type (current_inferior ());
if (type == NULL)
return NULL;
type = lookup_pointer_type (lookup_pointer_type (type));
@@ -6683,8 +6560,7 @@ ada_is_parent_field (struct type *type, int field_num)
const char *name = ada_check_typedef (type)->field (field_num).name ();
return (name != NULL
- && (startswith (name, "PARENT")
- || startswith (name, "_parent")));
+ && (startswith (name, "PARENT") || startswith (name, "_parent")));
}
/* True iff field number FIELD_NUM of structure type TYPE is a
@@ -6710,10 +6586,9 @@ ada_is_wrapper_field (struct type *type, int field_num)
}
return (name != NULL
- && (startswith (name, "PARENT")
- || strcmp (name, "REP") == 0
- || startswith (name, "_parent")
- || name[0] == 'S' || name[0] == 'R' || name[0] == 'O'));
+ && (startswith (name, "PARENT") || strcmp (name, "REP") == 0
+ || startswith (name, "_parent") || name[0] == 'S'
+ || name[0] == 'R' || name[0] == 'O'));
}
/* True iff field number FIELD_NUM of structure or union type TYPE
@@ -6731,8 +6606,7 @@ ada_is_variant_part (struct type *type, int field_num)
return (field_type->code () == TYPE_CODE_UNION
|| (is_dynamic_field (type, field_num)
- && (field_type->target_type ()->code ()
- == TYPE_CODE_UNION)));
+ && (field_type->target_type ()->code () == TYPE_CODE_UNION)));
}
/* Assuming that VAR_TYPE is a variant wrapper (type of the variant part)
@@ -6797,8 +6671,7 @@ ada_variant_discrim_name (struct type *type0)
{
if (discrim_start == name + 1)
return "";
- if ((discrim_start > name + 3
- && startswith (discrim_start - 3, "___"))
+ if ((discrim_start > name + 3 && startswith (discrim_start - 3, "___"))
|| discrim_start[-1] == '.')
break;
}
@@ -6816,7 +6689,7 @@ ada_variant_discrim_name (struct type *type0)
Assumes 0m does not occur. */
int
-ada_scan_number (const char str[], int k, LONGEST * R, int *new_k)
+ada_scan_number (const char str[], int k, LONGEST *R, int *new_k)
{
ULONGEST RU;
@@ -6884,8 +6757,8 @@ ada_in_variant (LONGEST val, struct type *type, int field_num)
{
LONGEST L, U;
- if (!ada_scan_number (name, p + 1, &L, &p)
- || name[p] != 'T' || !ada_scan_number (name, p + 1, &U, &p))
+ if (!ada_scan_number (name, p + 1, &L, &p) || name[p] != 'T'
+ || !ada_scan_number (name, p + 1, &U, &p))
return 0;
if (val >= L && val <= U)
return 1;
@@ -6925,8 +6798,8 @@ ada_value_primitive_field (struct value *arg1, int offset, int fieldno,
return ada_value_primitive_packed_val (arg1,
value_contents (arg1).data (),
- offset + bit_pos / 8,
- bit_pos % 8, bit_size, type);
+ offset + bit_pos / 8, bit_pos % 8,
+ bit_size, type);
}
else
return value_primitive_field (arg1, offset, fieldno, arg_type);
@@ -6999,9 +6872,8 @@ ada_value_primitive_field (struct value *arg1, int offset, int fieldno,
static int
find_struct_field (const char *name, struct type *type, int offset,
- struct type **field_type_p,
- int *byte_offset_p, int *bit_offset_p, int *bit_size_p,
- int *index_p)
+ struct type **field_type_p, int *byte_offset_p,
+ int *bit_offset_p, int *bit_size_p, int *index_p)
{
int i;
int parent_offset = -1;
@@ -7079,11 +6951,11 @@ find_struct_field (const char *name, struct type *type, int offset,
for (j = 0; j < field_type->num_fields (); j += 1)
{
- if (find_struct_field (name, field_type->field (j).type (),
- fld_offset
- + field_type->field (j).loc_bitpos () / 8,
- field_type_p, byte_offset_p,
- bit_offset_p, bit_size_p, index_p))
+ if (find_struct_field (
+ name, field_type->field (j).type (),
+ fld_offset + field_type->field (j).loc_bitpos () / 8,
+ field_type_p, byte_offset_p, bit_offset_p, bit_size_p,
+ index_p))
return 1;
}
}
@@ -7168,9 +7040,10 @@ ada_search_struct_field (const char *name, struct value *arg, int offset,
else if (ada_is_wrapper_field (type, i))
{
- struct value *v = /* Do not let indent join lines here. */
+ struct value *v = /* Do not let indent join lines here. */
ada_search_struct_field (name, arg,
- offset + type->field (i).loc_bitpos () / 8,
+ offset
+ + type->field (i).loc_bitpos () / 8,
type->field (i).type ());
if (v != NULL)
@@ -7181,7 +7054,8 @@ ada_search_struct_field (const char *name, struct value *arg, int offset,
{
/* PNH: Do we ever get here? See find_struct_field. */
int j;
- struct type *field_type = ada_check_typedef (type->field (i).type ());
+ struct type *field_type
+ = ada_check_typedef (type->field (i).type ());
int var_offset = offset + type->field (i).loc_bitpos () / 8;
for (j = 0; j < field_type->num_fields (); j += 1)
@@ -7214,9 +7088,8 @@ ada_search_struct_field (const char *name, struct value *arg, int offset,
return NULL;
}
-static struct value *ada_index_struct_field_1 (int *, struct value *,
- int, struct type *);
-
+static struct value *ada_index_struct_field_1 (int *, struct value *, int,
+ struct type *);
/* Return field #INDEX in ARG, where the index is that returned by
* find_struct_field through its INDEX_P argument. Adjust the address
@@ -7230,7 +7103,6 @@ ada_index_struct_field (int index, struct value *arg, int offset,
return ada_index_struct_field_1 (&index, arg, offset, type);
}
-
/* Auxiliary function for ada_index_struct_field. Like
* ada_index_struct_field, but takes index from *INDEX_P and modifies
* *INDEX_P. */
@@ -7248,9 +7120,10 @@ ada_index_struct_field_1 (int *index_p, struct value *arg, int offset,
continue;
else if (ada_is_wrapper_field (type, i))
{
- struct value *v = /* Do not let indent join lines here. */
+ struct value *v = /* Do not let indent join lines here. */
ada_index_struct_field_1 (index_p, arg,
- offset + type->field (i).loc_bitpos () / 8,
+ offset
+ + type->field (i).loc_bitpos () / 8,
type->field (i).type ());
if (v != NULL)
@@ -7261,7 +7134,7 @@ ada_index_struct_field_1 (int *index_p, struct value *arg, int offset,
{
/* PNH: Do we ever get here? See ada_search_struct_field,
find_struct_field. */
- error (_("Cannot assign this kind of variant record"));
+ error (_ ("Cannot assign this kind of variant record"));
}
else if (*index_p == 0)
return ada_value_primitive_field (arg, offset, i, type);
@@ -7329,8 +7202,8 @@ ada_lookup_struct_elt_type (struct type *type, const char *name, int refok,
if (noerr)
return NULL;
- error (_("Type %s is not a structure or union type"),
- type != NULL ? type_as_string (type).c_str () : _("(null)"));
+ error (_ ("Type %s is not a structure or union type"),
+ type != NULL ? type_as_string (type).c_str () : _ ("(null)"));
}
type = to_static_fixed_type (type);
@@ -7362,8 +7235,7 @@ ada_lookup_struct_elt_type (struct type *type, const char *name, int refok,
else if (ada_is_wrapper_field (type, i))
{
- t = ada_lookup_struct_elt_type (type->field (i).type (), name,
- 0, 1);
+ t = ada_lookup_struct_elt_type (type->field (i).type (), name, 0, 1);
if (t != NULL)
return t;
}
@@ -7371,7 +7243,8 @@ ada_lookup_struct_elt_type (struct type *type, const char *name, int refok,
else if (ada_is_variant_part (type, i))
{
int j;
- struct type *field_type = ada_check_typedef (type->field (i).type ());
+ struct type *field_type
+ = ada_check_typedef (type->field (i).type ());
for (j = field_type->num_fields () - 1; j >= 0; j -= 1)
{
@@ -7381,7 +7254,7 @@ ada_lookup_struct_elt_type (struct type *type, const char *name, int refok,
if the compiler changes this practice. */
const char *v_field_name = field_type->field (j).name ();
- if (v_field_name != NULL
+ if (v_field_name != NULL
&& field_name_match (v_field_name, name))
t = field_type->field (j).type ();
else
@@ -7392,28 +7265,27 @@ ada_lookup_struct_elt_type (struct type *type, const char *name, int refok,
return t;
}
}
-
}
- /* Field not found so far. If this is a tagged type which
+ /* Field not found so far. If this is a tagged type which
has a parent, try finding that field in the parent now. */
- if (parent_offset != -1)
- {
- struct type *t;
+ if (parent_offset != -1)
+ {
+ struct type *t;
- t = ada_lookup_struct_elt_type (type->field (parent_offset).type (),
- name, 0, 1);
- if (t != NULL)
- return t;
- }
+ t = ada_lookup_struct_elt_type (type->field (parent_offset).type (),
+ name, 0, 1);
+ if (t != NULL)
+ return t;
+ }
BadName:
if (!noerr)
{
- const char *name_str = name != NULL ? name : _("<null>");
+ const char *name_str = name != NULL ? name : _ ("<null>");
- error (_("Type %s has no component named %s"),
+ error (_ ("Type %s has no component named %s"),
type_as_string (type).c_str (), name_str);
}
@@ -7433,7 +7305,6 @@ is_unchecked_variant (struct type *var_type, struct type *outer_type)
return (ada_lookup_struct_elt_type (outer_type, discrim_name, 0, 1) == NULL);
}
-
/* Assuming that VAR_TYPE is the type of a variant part of a record (a union),
within OUTER, determine which variant clause (field number in VAR_TYPE,
numbering from 0) is applicable. Returns -1 if none are. */
@@ -7466,10 +7337,8 @@ ada_which_variant_applies (struct type *var_type, struct value *outer)
return others_clause;
}
-
-
- /* Dynamic-Sized Records */
+/* Dynamic-Sized Records */
/* Strategy: The type ostensibly attached to a value with dynamic size
(i.e., a size that is not statically recorded in the debugging
@@ -7683,7 +7552,7 @@ find_parallel_type_by_descriptive_type (struct type *type, const char *name)
if (result_name == NULL)
{
- warning (_("unexpected null name on descriptive type"));
+ warning (_ ("unexpected null name on descriptive type"));
return NULL;
}
@@ -7791,8 +7660,8 @@ is_dynamic_field (struct type *templ_type, int field_num)
const char *name = templ_type->field (field_num).name ();
return name != NULL
- && templ_type->field (field_num).type ()->code () == TYPE_CODE_PTR
- && strstr (name, "___XVL") != NULL;
+ && templ_type->field (field_num).type ()->code () == TYPE_CODE_PTR
+ && strstr (name, "___XVL") != NULL;
}
/* The index of the variant field of TYPE, or -1 if TYPE does not
@@ -7879,8 +7748,8 @@ ada_template_to_fixed_record_type_1 (struct type *type,
rtype->set_code (TYPE_CODE_STRUCT);
INIT_NONE_SPECIFIC (rtype);
rtype->set_num_fields (nfields);
- rtype->set_fields
- ((struct field *) TYPE_ZALLOC (rtype, nfields * sizeof (struct field)));
+ rtype->set_fields ((struct field *)
+ TYPE_ZALLOC (rtype, nfields * sizeof (struct field)));
rtype->set_name (ada_type_name (type));
rtype->set_is_fixed_instance (true);
@@ -7891,7 +7760,7 @@ ada_template_to_fixed_record_type_1 (struct type *type,
for (f = 0; f < nfields; f += 1)
{
off = align_up (off, field_alignment (type, f))
- + type->field (f).loc_bitpos ();
+ + type->field (f).loc_bitpos ();
rtype->field (f).set_loc_bitpos (off);
TYPE_FIELD_BITSIZE (rtype, f) = 0;
@@ -7912,9 +7781,9 @@ ada_template_to_fixed_record_type_1 (struct type *type,
causes problems because we will end up trying to
resolve a type that is currently being
constructed. */
- dval = value_from_contents_and_address_unresolved (rtype,
- valaddr,
- address);
+ dval
+ = value_from_contents_and_address_unresolved (rtype, valaddr,
+ address);
rtype = value_type (dval);
}
else
@@ -7934,10 +7803,10 @@ ada_template_to_fixed_record_type_1 (struct type *type,
field_type = ada_aligned_type (field_type);
}
- field_valaddr = cond_offset_host (field_valaddr,
- off / TARGET_CHAR_BIT);
- field_address = cond_offset_target (field_address,
- off / TARGET_CHAR_BIT);
+ field_valaddr
+ = cond_offset_host (field_valaddr, off / TARGET_CHAR_BIT);
+ field_address
+ = cond_offset_target (field_address, off / TARGET_CHAR_BIT);
/* Get the fixed type of the field. Note that, in this case,
we do not want to get the real type out of the tag: if
@@ -7974,8 +7843,8 @@ ada_template_to_fixed_record_type_1 (struct type *type,
rtype->field (f).set_type (type->field (f).type ());
rtype->field (f).set_name (type->field (f).name ());
if (TYPE_FIELD_BITSIZE (type, f) > 0)
- fld_bit_len =
- TYPE_FIELD_BITSIZE (rtype, f) = TYPE_FIELD_BITSIZE (type, f);
+ fld_bit_len = TYPE_FIELD_BITSIZE (rtype, f)
+ = TYPE_FIELD_BITSIZE (type, f);
else
{
struct type *field_type = type->field (f).type ();
@@ -7987,14 +7856,15 @@ ada_template_to_fixed_record_type_1 (struct type *type,
if (field_type->code () == TYPE_CODE_TYPEDEF)
field_type = ada_typedef_target_type (field_type);
- fld_bit_len =
- ada_check_typedef (field_type)->length () * TARGET_CHAR_BIT;
+ fld_bit_len
+ = ada_check_typedef (field_type)->length () * TARGET_CHAR_BIT;
}
}
if (off + fld_bit_len > bit_len)
bit_len = off + fld_bit_len;
off += fld_bit_len;
- rtype->set_length (align_up (bit_len, TARGET_CHAR_BIT) / TARGET_CHAR_BIT);
+ rtype->set_length (align_up (bit_len, TARGET_CHAR_BIT)
+ / TARGET_CHAR_BIT);
}
/* We handle the variant part, if any, at the end because of certain
@@ -8019,11 +7889,10 @@ ada_template_to_fixed_record_type_1 (struct type *type,
else
dval = dval0;
- branch_type =
- to_fixed_variant_branch_type
- (type->field (variant_field).type (),
- cond_offset_host (valaddr, off / TARGET_CHAR_BIT),
- cond_offset_target (address, off / TARGET_CHAR_BIT), dval);
+ branch_type = to_fixed_variant_branch_type (
+ type->field (variant_field).type (),
+ cond_offset_host (valaddr, off / TARGET_CHAR_BIT),
+ cond_offset_target (address, off / TARGET_CHAR_BIT), dval);
if (branch_type == NULL)
{
for (f = variant_field + 1; f < rtype->num_fields (); f += 1)
@@ -8034,13 +7903,13 @@ ada_template_to_fixed_record_type_1 (struct type *type,
{
rtype->field (variant_field).set_type (branch_type);
rtype->field (variant_field).set_name ("S");
- fld_bit_len =
- rtype->field (variant_field).type ()->length () * TARGET_CHAR_BIT;
+ fld_bit_len = rtype->field (variant_field).type ()->length ()
+ * TARGET_CHAR_BIT;
if (off + fld_bit_len > bit_len)
bit_len = off + fld_bit_len;
- rtype->set_length
- (align_up (bit_len, TARGET_CHAR_BIT) / TARGET_CHAR_BIT);
+ rtype->set_length (align_up (bit_len, TARGET_CHAR_BIT)
+ / TARGET_CHAR_BIT);
}
}
@@ -8053,10 +7922,10 @@ ada_template_to_fixed_record_type_1 (struct type *type,
if (type->length () <= 0)
{
if (rtype->name ())
- warning (_("Invalid type size for `%s' detected: %s."),
+ warning (_ ("Invalid type size for `%s' detected: %s."),
rtype->name (), pulongest (type->length ()));
else
- warning (_("Invalid type size for <unnamed> detected: %s."),
+ warning (_ ("Invalid type size for <unnamed> detected: %s."),
pulongest (type->length ()));
}
else
@@ -8072,8 +7941,8 @@ static struct type *
template_to_fixed_record_type (struct type *type, const gdb_byte *valaddr,
CORE_ADDR address, struct value *dval0)
{
- return ada_template_to_fixed_record_type_1 (type, valaddr,
- address, dval0, 1);
+ return ada_template_to_fixed_record_type_1 (type, valaddr, address, dval0,
+ 1);
}
/* An ordinary record type in which ___XVL-convention fields and
@@ -8132,9 +8001,8 @@ template_to_static_fixed_type (struct type *type0)
INIT_NONE_SPECIFIC (type);
type->set_num_fields (nfields);
- field *fields =
- ((struct field *)
- TYPE_ALLOC (type, nfields * sizeof (struct field)));
+ field *fields = ((struct field *) TYPE_ALLOC (
+ type, nfields * sizeof (struct field)));
memcpy (fields, type0->fields (),
sizeof (struct field) * nfields);
type->set_fields (fields);
@@ -8185,8 +8053,8 @@ to_record_with_fixed_variant_part (struct type *type, const gdb_byte *valaddr,
INIT_NONE_SPECIFIC (rtype);
rtype->set_num_fields (nfields);
- field *fields =
- (struct field *) TYPE_ALLOC (rtype, nfields * sizeof (struct field));
+ field *fields
+ = (struct field *) TYPE_ALLOC (rtype, nfields * sizeof (struct field));
memcpy (fields, type->fields (), sizeof (struct field) * nfields);
rtype->set_fields (fields);
@@ -8194,14 +8062,13 @@ to_record_with_fixed_variant_part (struct type *type, const gdb_byte *valaddr,
rtype->set_is_fixed_instance (true);
rtype->set_length (type->length ());
- branch_type = to_fixed_variant_branch_type
- (type->field (variant_field).type (),
- cond_offset_host (valaddr,
- type->field (variant_field).loc_bitpos ()
- / TARGET_CHAR_BIT),
- cond_offset_target (address,
- type->field (variant_field).loc_bitpos ()
- / TARGET_CHAR_BIT), dval);
+ branch_type = to_fixed_variant_branch_type (
+ type->field (variant_field).type (),
+ cond_offset_host (valaddr, type->field (variant_field).loc_bitpos ()
+ / TARGET_CHAR_BIT),
+ cond_offset_target (address, type->field (variant_field).loc_bitpos ()
+ / TARGET_CHAR_BIT),
+ dval);
if (branch_type == NULL)
{
int f;
@@ -8259,15 +8126,13 @@ to_fixed_record_type (struct type *type0, const gdb_byte *valaddr,
{
if (dval == NULL && valaddr == NULL && address == 0)
return type0;
- return to_record_with_fixed_variant_part (type0, valaddr, address,
- dval);
+ return to_record_with_fixed_variant_part (type0, valaddr, address, dval);
}
else
{
type0->set_is_fixed_instance (true);
return type0;
}
-
}
/* An ordinary record type (with fixed-length fields) that describes
@@ -8297,18 +8162,17 @@ to_fixed_variant_branch_type (struct type *var_type0, const gdb_byte *valaddr,
var_type = templ_type;
if (is_unchecked_variant (var_type, value_type (dval)))
- return var_type0;
+ return var_type0;
which = ada_which_variant_applies (var_type, dval);
if (which < 0)
return empty_record (var_type);
else if (is_dynamic_field (var_type, which))
- return to_fixed_record_type
- (var_type->field (which).type ()->target_type(), valaddr, address, dval);
+ return to_fixed_record_type (
+ var_type->field (which).type ()->target_type (), valaddr, address, dval);
else if (variant_field_index (var_type->field (which).type ()) >= 0)
- return
- to_fixed_record_type
- (var_type->field (which).type (), valaddr, address, dval);
+ return to_fixed_record_type (var_type->field (which).type (), valaddr,
+ address, dval);
else
return var_type->field (which).type ();
}
@@ -8411,7 +8275,7 @@ to_fixed_array_type (struct type *type0, struct value *dval,
{
type0 = decode_constrained_packed_array_type (type0);
if (type0 == nullptr)
- error (_("could not decode constrained packed array type"));
+ error (_ ("could not decode constrained packed array type"));
}
index_type_desc = ada_find_parallel_type (type0, xa_suffix);
@@ -8473,8 +8337,8 @@ to_fixed_array_type (struct type *type0, struct value *dval,
if (elt_type0 == elt_type && !constrained_packed_array_p)
result = type0;
else
- result = create_array_type (alloc_type_copy (type0),
- elt_type, type0->index_type ());
+ result = create_array_type (alloc_type_copy (type0), elt_type,
+ type0->index_type ());
}
else
{
@@ -8496,17 +8360,17 @@ to_fixed_array_type (struct type *type0, struct value *dval,
the elements of an array of a tagged type should all be of
the same type specified in the debugging info. No need to
consult the object tag. */
- result =
- ada_to_fixed_type (ada_check_typedef (elt_type0), 0, 0, dval, 1);
+ result
+ = ada_to_fixed_type (ada_check_typedef (elt_type0), 0, 0, dval, 1);
elt_type0 = type0;
for (i = index_type_desc->num_fields () - 1; i >= 0; i -= 1)
{
- struct type *range_type =
- to_fixed_range_type (index_type_desc->field (i).type (), dval);
+ struct type *range_type
+ = to_fixed_range_type (index_type_desc->field (i).type (), dval);
- result = create_array_type (alloc_type_copy (elt_type0),
- result, range_type);
+ result = create_array_type (alloc_type_copy (elt_type0), result,
+ range_type);
elt_type0 = elt_type0->target_type ();
}
}
@@ -8535,7 +8399,6 @@ to_fixed_array_type (struct type *type0, struct value *dval,
return result;
}
-
/* A standard type (containing no dynamically sized components)
corresponding to TYPE for the value (TYPE, VALADDR, ADDRESS)
DVAL describes a record containing any discriminants used in TYPE0,
@@ -8547,10 +8410,10 @@ to_fixed_array_type (struct type *type0, struct value *dval,
type. However, when ADDRESS is null, we cannot use it to determine the
location of the tag, and therefore compute the tagged type's actual type.
So we return the tagged type without consulting the tag. */
-
+
static struct type *
ada_to_fixed_type_1 (struct type *type, const gdb_byte *valaddr,
- CORE_ADDR address, struct value *dval, int check_tag)
+ CORE_ADDR address, struct value *dval, int check_tag)
{
type = ada_check_typedef (type);
@@ -8565,8 +8428,8 @@ ada_to_fixed_type_1 (struct type *type, const gdb_byte *valaddr,
case TYPE_CODE_STRUCT:
{
struct type *static_type = to_static_fixed_type (type);
- struct type *fixed_record_type =
- to_fixed_record_type (type, valaddr, address, NULL);
+ struct type *fixed_record_type
+ = to_fixed_record_type (type, valaddr, address, NULL);
/* If STATIC_TYPE is a tagged type and we know the object's address,
then we can determine its tag, and compute the object's actual
@@ -8577,21 +8440,18 @@ ada_to_fixed_type_1 (struct type *type, const gdb_byte *valaddr,
if (check_tag && address != 0 && ada_is_tagged_type (static_type, 0))
{
- struct value *tag =
- value_tag_from_contents_and_address
- (fixed_record_type,
- valaddr,
- address);
+ struct value *tag
+ = value_tag_from_contents_and_address (fixed_record_type,
+ valaddr, address);
struct type *real_type = type_from_tag (tag);
- struct value *obj =
- value_from_contents_and_address (fixed_record_type,
- valaddr,
- address);
+ struct value *obj
+ = value_from_contents_and_address (fixed_record_type, valaddr,
+ address);
fixed_record_type = value_type (obj);
if (real_type != NULL)
- return to_fixed_record_type
- (real_type, NULL,
- value_address (ada_tag_value_at_base_address (obj)), NULL);
+ return to_fixed_record_type (
+ real_type, NULL,
+ value_address (ada_tag_value_at_base_address (obj)), NULL);
}
/* Check to see if there is a parallel ___XVZ variable.
@@ -8617,8 +8477,8 @@ ada_to_fixed_type_1 (struct type *type, const gdb_byte *valaddr,
what went wrong (Eg: the variable might have been
optimized out). */
throw_error (except.error,
- _("unable to read value of %s (%s)"),
- xvz_name, except.what ());
+ _ ("unable to read value of %s (%s)"), xvz_name,
+ except.what ());
}
if (xvz_found && fixed_record_type->length () != size)
@@ -8686,8 +8546,8 @@ ada_to_fixed_type (struct type *type, const gdb_byte *valaddr,
CORE_ADDR address, struct value *dval, int check_tag)
{
- struct type *fixed_type =
- ada_to_fixed_type_1 (type, valaddr, address, dval, check_tag);
+ struct type *fixed_type
+ = ada_to_fixed_type_1 (type, valaddr, address, dval, check_tag);
/* If TYPE is a typedef and its target type is the same as the FIXED_TYPE,
then preserve the typedef layer.
@@ -8803,8 +8663,7 @@ ada_check_typedef (struct type *type)
return type;
type = check_typedef (type);
- if (type == NULL || type->code () != TYPE_CODE_ENUM
- || !type->is_stub ()
+ if (type == NULL || type->code () != TYPE_CODE_ENUM || !type->is_stub ()
|| type->name () == NULL)
return type;
else
@@ -8863,29 +8722,17 @@ ada_to_fixed_value (struct value *val)
val = ada_to_fixed_value_create (value_type (val), value_address (val), val);
return val;
}
-
/* Attributes */
/* Table mapping attribute numbers to names.
NOTE: Keep up to date with enum ada_attribute definition in ada-lang.h. */
-static const char * const attribute_names[] = {
- "<?>",
-
- "first",
- "last",
- "length",
- "image",
- "max",
- "min",
- "modulus",
- "pos",
- "size",
- "tag",
- "val",
- 0
-};
+static const char *const attribute_names[]
+ = { "<?>",
+
+ "first", "last", "length", "image", "max", "min",
+ "modulus", "pos", "size", "tag", "val", 0 };
static const char *
ada_attribute_name (enum exp_opcode n)
@@ -8905,20 +8752,19 @@ pos_atr (struct value *arg)
struct type *type = value_type (val);
if (!discrete_type_p (type))
- error (_("'POS only defined on discrete types"));
+ error (_ ("'POS only defined on discrete types"));
- gdb::optional<LONGEST> result = discrete_position (type, value_as_long (val));
+ gdb::optional<LONGEST> result
+ = discrete_position (type, value_as_long (val));
if (!result.has_value ())
- error (_("enumeration value is invalid: can't find 'POS"));
+ error (_ ("enumeration value is invalid: can't find 'POS"));
return *result;
}
struct value *
-ada_pos_atr (struct type *expect_type,
- struct expression *exp,
- enum noside noside, enum exp_opcode op,
- struct value *arg)
+ada_pos_atr (struct type *expect_type, struct expression *exp,
+ enum noside noside, enum exp_opcode op, struct value *arg)
{
struct type *type = builtin_type (exp->gdbarch)->builtin_int;
if (noside == EVAL_AVOID_SIDE_EFFECTS)
@@ -8937,7 +8783,7 @@ val_atr (struct type *type, LONGEST val)
if (type->code () == TYPE_CODE_ENUM)
{
if (val < 0 || val >= type->num_fields ())
- error (_("argument to 'VAL out of range"));
+ error (_ ("argument to 'VAL out of range"));
val = type->field (val).loc_enumval ();
}
return value_from_longest (type, val);
@@ -8950,15 +8796,14 @@ ada_val_atr (enum noside noside, struct type *type, struct value *arg)
return value_zero (type, not_lval);
if (!discrete_type_p (type))
- error (_("'VAL only defined on discrete types"));
+ error (_ ("'VAL only defined on discrete types"));
if (!integer_type_p (value_type (arg)))
- error (_("'VAL requires integral argument"));
+ error (_ ("'VAL requires integral argument"));
return val_atr (type, value_as_long (arg));
}
-
- /* Evaluation */
+/* Evaluation */
/* True if TYPE appears to be an Ada character type.
[At the moment, this is true only for Character and Wide_Character;
@@ -8973,7 +8818,7 @@ ada_is_character_type (struct type *type)
and don't check any further. */
if (type->code () == TYPE_CODE_CHAR)
return true;
-
+
/* Otherwise, assume it's a character type iff it is a discrete type
with a known character type name. */
name = ada_type_name (type);
@@ -8992,8 +8837,7 @@ bool
ada_is_string_type (struct type *type)
{
type = ada_check_typedef (type);
- if (type != NULL
- && type->code () != TYPE_CODE_PTR
+ if (type != NULL && type->code () != TYPE_CODE_PTR
&& (ada_is_simple_array_type (type)
|| ada_is_array_descriptor_type (type))
&& ada_array_arity (type) == 1)
@@ -9029,8 +8873,7 @@ ada_is_aligner_type (struct type *type)
if (!trust_pad_over_xvs && ada_find_parallel_type (type, "___XVS") != NULL)
return 0;
- return (type->code () == TYPE_CODE_STRUCT
- && type->num_fields () == 1
+ return (type->code () == TYPE_CODE_STRUCT && type->num_fields () == 1
&& strcmp (type->field (0).name (), "F") == 0);
}
@@ -9062,8 +8905,7 @@ ada_get_base_type (struct type *raw_type)
return raw_type;
real_type_namer = ada_find_parallel_type (raw_type, "___XVS");
- if (real_type_namer == NULL
- || real_type_namer->code () != TYPE_CODE_STRUCT
+ if (real_type_namer == NULL || real_type_namer->code () != TYPE_CODE_STRUCT
|| real_type_namer->num_fields () != 1)
return raw_type;
@@ -9094,7 +8936,6 @@ ada_aligned_type (struct type *type)
return ada_get_base_type (type);
}
-
/* The address of the aligned value in an object at address VALADDR
having type TYPE. Assumes ada_is_aligner_type (TYPE). */
@@ -9102,15 +8943,14 @@ const gdb_byte *
ada_aligned_value_addr (struct type *type, const gdb_byte *valaddr)
{
if (ada_is_aligner_type (type))
- return ada_aligned_value_addr
- (type->field (0).type (),
- valaddr + type->field (0).loc_bitpos () / TARGET_CHAR_BIT);
+ return ada_aligned_value_addr (type->field (0).type (),
+ valaddr
+ + type->field (0).loc_bitpos ()
+ / TARGET_CHAR_BIT);
else
return valaddr;
}
-
-
/* The printed representation of an enumeration literal with encoded
name NAME. The value is good to the next call of ada_enum_name. */
const char *
@@ -9213,8 +9053,8 @@ unwrap_value (struct value *val)
}
else
{
- struct type *raw_real_type =
- ada_check_typedef (ada_get_base_type (type));
+ struct type *raw_real_type
+ = ada_check_typedef (ada_get_base_type (type));
/* If there is no parallel XVS or XVE type, then the value is
already unwrapped. Return it without further modification. */
@@ -9222,11 +9062,10 @@ unwrap_value (struct value *val)
&& ada_find_parallel_type (type, "___XVE") == NULL)
return val;
- return
- coerce_unspec_val_to_type
- (val, ada_to_fixed_type (raw_real_type, 0,
- value_address (val),
- NULL, 1));
+ return coerce_unspec_val_to_type (val,
+ ada_to_fixed_type (raw_real_type, 0,
+ value_address (val),
+ NULL, 1));
}
}
@@ -9240,9 +9079,8 @@ ada_same_array_size_p (struct type *t1, struct type *t2)
/* Get the array bounds in order to verify that the size of
the two arrays match. */
- if (!get_array_bounds (t1, &lo1, &hi1)
- || !get_array_bounds (t2, &lo2, &hi2))
- error (_("unable to determine array bounds"));
+ if (!get_array_bounds (t1, &lo1, &hi1) || !get_array_bounds (t2, &lo2, &hi2))
+ error (_ ("unable to determine array bounds"));
/* To make things easier for size comparison, normalize a bit
the case of empty arrays by making sure that the difference
@@ -9279,7 +9117,7 @@ ada_promote_array_of_integrals (struct type *type, struct value *val)
> value_type (val)->target_type ()->length ());
if (!get_array_bounds (type, &lo, &hi))
- error (_("unable to determine array bounds"));
+ error (_ ("unable to determine array bounds"));
value *res = allocate_value (type);
gdb::array_view<gdb_byte> res_contents = value_contents_writeable (res);
@@ -9290,7 +9128,8 @@ ada_promote_array_of_integrals (struct type *type, struct value *val)
struct value *elt = value_cast (elt_type, value_subscript (val, lo + i));
int elt_len = elt_type->length ();
- copy (value_contents_all (elt), res_contents.slice (elt_len * i, elt_len));
+ copy (value_contents_all (elt),
+ res_contents.slice (elt_len * i, elt_len));
}
return res;
@@ -9310,22 +9149,21 @@ coerce_for_assign (struct type *type, struct value *val)
type2 = ada_check_typedef (type2);
type = ada_check_typedef (type);
- if (type2->code () == TYPE_CODE_PTR
- && type->code () == TYPE_CODE_ARRAY)
+ if (type2->code () == TYPE_CODE_PTR && type->code () == TYPE_CODE_ARRAY)
{
val = ada_value_ind (val);
type2 = value_type (val);
}
- if (type2->code () == TYPE_CODE_ARRAY
- && type->code () == TYPE_CODE_ARRAY)
+ if (type2->code () == TYPE_CODE_ARRAY && type->code () == TYPE_CODE_ARRAY)
{
if (!ada_same_array_size_p (type, type2))
- error (_("cannot assign arrays of different length"));
+ error (_ ("cannot assign arrays of different length"));
if (is_integral_type (type->target_type ())
&& is_integral_type (type2->target_type ())
- && type2->target_type ()->length () < type->target_type ()->length ())
+ && type2->target_type ()->length ()
+ < type->target_type ()->length ())
{
/* Allow implicit promotion of the array elements to
a wider type. */
@@ -9333,7 +9171,7 @@ coerce_for_assign (struct type *type, struct value *val)
}
if (type2->target_type ()->length () != type->target_type ()->length ())
- error (_("Incompatible types in assignment"));
+ error (_ ("Incompatible types in assignment"));
deprecated_set_value_type (val, type);
}
return val;
@@ -9351,8 +9189,7 @@ ada_value_binop (struct value *arg1, struct value *arg2, enum exp_opcode op)
type1 = get_base_type (ada_check_typedef (value_type (arg1)));
type2 = get_base_type (ada_check_typedef (value_type (arg2)));
- if (type1->code () != TYPE_CODE_INT
- || type2->code () != TYPE_CODE_INT)
+ if (type1->code () != TYPE_CODE_INT || type2->code () != TYPE_CODE_INT)
return value_binop (arg1, arg2, op);
switch (op)
@@ -9379,7 +9216,7 @@ ada_value_binop (struct value *arg1, struct value *arg2, enum exp_opcode op)
name = "rem";
}
- error (_("second operand of %s must not be zero."), name);
+ error (_ ("second operand of %s must not be zero."), name);
}
if (type1->is_unsigned () || op == BINOP_MOD)
@@ -9405,8 +9242,8 @@ ada_value_binop (struct value *arg1, struct value *arg2, enum exp_opcode op)
val = allocate_value (type1);
store_unsigned_integer (value_contents_raw (val).data (),
- value_type (val)->length (),
- type_byte_order (type1), v);
+ value_type (val)->length (), type_byte_order (type1),
+ v);
return val;
}
@@ -9431,14 +9268,14 @@ ada_value_equal (struct value *arg1, struct value *arg2)
if (arg1_type->code () != TYPE_CODE_ARRAY
|| arg2_type->code () != TYPE_CODE_ARRAY)
- error (_("Attempt to compare array with non-array"));
+ error (_ ("Attempt to compare array with non-array"));
/* FIXME: The following works only for types whose
representations use all bits (no padding or undefined bits)
and do not have user-defined equality. */
return (arg1_type->length () == arg2_type->length ()
&& memcmp (value_contents (arg1).data (),
- value_contents (arg2).data (),
- arg1_type->length ()) == 0);
+ value_contents (arg2).data (), arg1_type->length ())
+ == 0);
}
return value_equal (arg1, arg2);
}
@@ -9486,8 +9323,7 @@ assign_component (struct value *container, struct value *lhs, LONGEST index,
ag_op->assign_aggregate (container, elt, exp);
else
value_assign_to_component (container, elt,
- arg->evaluate (nullptr, exp,
- EVAL_NORMAL));
+ arg->evaluate (nullptr, exp, EVAL_NORMAL));
}
bool
@@ -9502,16 +9338,16 @@ ada_aggregate_component::uses_objfile (struct objfile *objfile)
void
ada_aggregate_component::dump (ui_file *stream, int depth)
{
- gdb_printf (stream, _("%*sAggregate\n"), depth, "");
+ gdb_printf (stream, _ ("%*sAggregate\n"), depth, "");
for (const auto &item : m_components)
item->dump (stream, depth + 1);
}
void
-ada_aggregate_component::assign (struct value *container,
- struct value *lhs, struct expression *exp,
- std::vector<LONGEST> &indices,
- LONGEST low, LONGEST high)
+ada_aggregate_component::assign (struct value *container, struct value *lhs,
+ struct expression *exp,
+ std::vector<LONGEST> &indices, LONGEST low,
+ LONGEST high)
{
for (auto &item : m_components)
item->assign (container, lhs, exp, indices, low, high);
@@ -9532,7 +9368,7 @@ ada_aggregate_operation::assign_aggregate (struct value *container,
container = ada_coerce_to_simple_array (container);
lhs = ada_coerce_ref (lhs);
if (!deprecated_value_modifiable (lhs))
- error (_("Left operand of assignment is not a modifiable lvalue."));
+ error (_ ("Left operand of assignment is not a modifiable lvalue."));
lhs_type = check_typedef (value_type (lhs));
if (ada_is_direct_array_type (lhs_type))
@@ -9548,14 +9384,14 @@ ada_aggregate_operation::assign_aggregate (struct value *container,
high_index = num_visible_fields (lhs_type) - 1;
}
else
- error (_("Left-hand side must be array or record."));
+ error (_ ("Left-hand side must be array or record."));
std::vector<LONGEST> indices (4);
indices[0] = indices[1] = low_index - 1;
indices[2] = indices[3] = high_index + 1;
- std::get<0> (m_storage)->assign (container, lhs, exp, indices,
- low_index, high_index);
+ std::get<0> (m_storage)->assign (container, lhs, exp, indices, low_index,
+ high_index);
return container;
}
@@ -9569,8 +9405,7 @@ ada_positional_component::uses_objfile (struct objfile *objfile)
void
ada_positional_component::dump (ui_file *stream, int depth)
{
- gdb_printf (stream, _("%*sPositional, index = %d\n"),
- depth, "", m_index);
+ gdb_printf (stream, _ ("%*sPositional, index = %d\n"), depth, "", m_index);
m_op->dump (stream, depth + 1);
}
@@ -9579,15 +9414,15 @@ ada_positional_component::dump (ui_file *stream, int depth)
LOW, where HIGH is the upper bound. Record the position in
INDICES. CONTAINER is as for assign_aggregate. */
void
-ada_positional_component::assign (struct value *container,
- struct value *lhs, struct expression *exp,
- std::vector<LONGEST> &indices,
- LONGEST low, LONGEST high)
+ada_positional_component::assign (struct value *container, struct value *lhs,
+ struct expression *exp,
+ std::vector<LONGEST> &indices, LONGEST low,
+ LONGEST high)
{
LONGEST ind = m_index + low;
if (ind - 1 == high)
- warning (_("Extra components in aggregate ignored."));
+ warning (_ ("Extra components in aggregate ignored."));
if (ind <= high)
{
add_component_interval (ind, ind, indices);
@@ -9604,24 +9439,21 @@ ada_discrete_range_association::uses_objfile (struct objfile *objfile)
void
ada_discrete_range_association::dump (ui_file *stream, int depth)
{
- gdb_printf (stream, _("%*sDiscrete range:\n"), depth, "");
+ gdb_printf (stream, _ ("%*sDiscrete range:\n"), depth, "");
m_low->dump (stream, depth + 1);
m_high->dump (stream, depth + 1);
}
void
-ada_discrete_range_association::assign (struct value *container,
- struct value *lhs,
- struct expression *exp,
- std::vector<LONGEST> &indices,
- LONGEST low, LONGEST high,
- operation_up &op)
+ada_discrete_range_association::assign (
+ struct value *container, struct value *lhs, struct expression *exp,
+ std::vector<LONGEST> &indices, LONGEST low, LONGEST high, operation_up &op)
{
LONGEST lower = value_as_long (m_low->evaluate (nullptr, exp, EVAL_NORMAL));
LONGEST upper = value_as_long (m_high->evaluate (nullptr, exp, EVAL_NORMAL));
if (lower <= upper && (lower < low || upper > high))
- error (_("Index in component association out of bounds."));
+ error (_ ("Index in component association out of bounds."));
add_component_interval (lower, upper, indices);
while (lower <= upper)
@@ -9640,17 +9472,15 @@ ada_name_association::uses_objfile (struct objfile *objfile)
void
ada_name_association::dump (ui_file *stream, int depth)
{
- gdb_printf (stream, _("%*sName:\n"), depth, "");
+ gdb_printf (stream, _ ("%*sName:\n"), depth, "");
m_val->dump (stream, depth + 1);
}
void
-ada_name_association::assign (struct value *container,
- struct value *lhs,
+ada_name_association::assign (struct value *container, struct value *lhs,
struct expression *exp,
- std::vector<LONGEST> &indices,
- LONGEST low, LONGEST high,
- operation_up &op)
+ std::vector<LONGEST> &indices, LONGEST low,
+ LONGEST high, operation_up &op)
{
int index;
@@ -9670,14 +9500,14 @@ ada_name_association::assign (struct value *container,
ada_var_value_operation *vvo
= dynamic_cast<ada_var_value_operation *> (m_val.get ());
if (vvo != nullptr)
- error (_("Invalid record component association."));
+ error (_ ("Invalid record component association."));
name = vvo->get_symbol ()->natural_name ();
}
index = 0;
- if (! find_struct_field (name, value_type (lhs), 0,
- NULL, NULL, NULL, NULL, &index))
- error (_("Unknown component name: %s."), name);
+ if (!find_struct_field (name, value_type (lhs), 0, NULL, NULL, NULL,
+ NULL, &index))
+ error (_ ("Unknown component name: %s."), name);
}
add_component_interval (index, index, indices);
@@ -9698,7 +9528,7 @@ ada_choices_component::uses_objfile (struct objfile *objfile)
void
ada_choices_component::dump (ui_file *stream, int depth)
{
- gdb_printf (stream, _("%*sChoices:\n"), depth, "");
+ gdb_printf (stream, _ ("%*sChoices:\n"), depth, "");
m_op->dump (stream, depth + 1);
for (const auto &item : m_assocs)
item->dump (stream, depth + 1);
@@ -9709,10 +9539,10 @@ ada_choices_component::dump (ui_file *stream, int depth)
the allowable indices are LOW..HIGH. Record the indices assigned
to in INDICES. CONTAINER is as for assign_aggregate. */
void
-ada_choices_component::assign (struct value *container,
- struct value *lhs, struct expression *exp,
- std::vector<LONGEST> &indices,
- LONGEST low, LONGEST high)
+ada_choices_component::assign (struct value *container, struct value *lhs,
+ struct expression *exp,
+ std::vector<LONGEST> &indices, LONGEST low,
+ LONGEST high)
{
for (auto &item : m_assocs)
item->assign (container, lhs, exp, indices, low, high, m_op);
@@ -9727,7 +9557,7 @@ ada_others_component::uses_objfile (struct objfile *objfile)
void
ada_others_component::dump (ui_file *stream, int depth)
{
- gdb_printf (stream, _("%*sOthers:\n"), depth, "");
+ gdb_printf (stream, _ ("%*sOthers:\n"), depth, "");
m_op->dump (stream, depth + 1);
}
@@ -9736,10 +9566,10 @@ ada_others_component::dump (ui_file *stream, int depth)
have not been previously assigned. The index intervals already assigned
are in INDICES. CONTAINER is as for assign_aggregate. */
void
-ada_others_component::assign (struct value *container,
- struct value *lhs, struct expression *exp,
- std::vector<LONGEST> &indices,
- LONGEST low, LONGEST high)
+ada_others_component::assign (struct value *container, struct value *lhs,
+ struct expression *exp,
+ std::vector<LONGEST> &indices, LONGEST low,
+ LONGEST high)
{
int num_indices = indices.size ();
for (int i = 0; i < num_indices - 2; i += 2)
@@ -9751,8 +9581,7 @@ ada_others_component::assign (struct value *container,
struct value *
ada_assign_operation::evaluate (struct type *expect_type,
- struct expression *exp,
- enum noside noside)
+ struct expression *exp, enum noside noside)
{
value *arg1 = std::get<0> (m_storage)->evaluate (nullptr, exp, noside);
@@ -9791,33 +9620,34 @@ ada_assign_operation::evaluate (struct type *expect_type,
[ INDICES[0] .. INDICES[1] ],... The resulting intervals do not
overlap. */
static void
-add_component_interval (LONGEST low, LONGEST high,
+add_component_interval (LONGEST low, LONGEST high,
std::vector<LONGEST> &indices)
{
int i, j;
int size = indices.size ();
- for (i = 0; i < size; i += 2) {
- if (high >= indices[i] && low <= indices[i + 1])
- {
- int kh;
+ for (i = 0; i < size; i += 2)
+ {
+ if (high >= indices[i] && low <= indices[i + 1])
+ {
+ int kh;
+
+ for (kh = i + 2; kh < size; kh += 2)
+ if (high < indices[kh])
+ break;
+ if (low < indices[i])
+ indices[i] = low;
+ indices[i + 1] = indices[kh - 1];
+ if (high > indices[i + 1])
+ indices[i + 1] = high;
+ memcpy (indices.data () + i + 2, indices.data () + kh, size - kh);
+ indices.resize (kh - i - 2);
+ return;
+ }
+ else if (high < indices[i])
+ break;
+ }
- for (kh = i + 2; kh < size; kh += 2)
- if (high < indices[kh])
- break;
- if (low < indices[i])
- indices[i] = low;
- indices[i + 1] = indices[kh - 1];
- if (high > indices[i + 1])
- indices[i + 1] = high;
- memcpy (indices.data () + i + 2, indices.data () + kh, size - kh);
- indices.resize (kh - i - 2);
- return;
- }
- else if (high < indices[i])
- break;
- }
-
indices.resize (indices.size () + 2);
for (j = indices.size () - 1; j >= i + 2; j -= 1)
indices[j] = indices[j - 2];
@@ -10095,27 +9925,22 @@ ada_value_cast (struct type *type, struct value *arg2)
static value *
eval_ternop_in_range (struct type *expect_type, struct expression *exp,
- enum noside noside,
- value *arg1, value *arg2, value *arg3)
+ enum noside noside, value *arg1, value *arg2,
+ value *arg3)
{
binop_promote (exp->language_defn, exp->gdbarch, &arg1, &arg2);
binop_promote (exp->language_defn, exp->gdbarch, &arg1, &arg3);
struct type *type = language_bool_type (exp->language_defn, exp->gdbarch);
- return
- value_from_longest (type,
- (value_less (arg1, arg3)
- || value_equal (arg1, arg3))
- && (value_less (arg2, arg1)
- || value_equal (arg2, arg1)));
+ return value_from_longest (
+ type, (value_less (arg1, arg3) || value_equal (arg1, arg3))
+ && (value_less (arg2, arg1) || value_equal (arg2, arg1)));
}
/* A helper function for UNOP_NEG. */
value *
-ada_unop_neg (struct type *expect_type,
- struct expression *exp,
- enum noside noside, enum exp_opcode op,
- struct value *arg1)
+ada_unop_neg (struct type *expect_type, struct expression *exp,
+ enum noside noside, enum exp_opcode op, struct value *arg1)
{
unop_promote (exp->language_defn, exp->gdbarch, &arg1);
return value_neg (arg1);
@@ -10124,44 +9949,36 @@ ada_unop_neg (struct type *expect_type,
/* A helper function for UNOP_IN_RANGE. */
value *
-ada_unop_in_range (struct type *expect_type,
- struct expression *exp,
- enum noside noside, enum exp_opcode op,
- struct value *arg1, struct type *type)
+ada_unop_in_range (struct type *expect_type, struct expression *exp,
+ enum noside noside, enum exp_opcode op, struct value *arg1,
+ struct type *type)
{
struct value *arg2, *arg3;
switch (type->code ())
{
default:
- lim_warning (_("Membership test incompletely implemented; "
- "always returns true"));
+ lim_warning (_ ("Membership test incompletely implemented; "
+ "always returns true"));
type = language_bool_type (exp->language_defn, exp->gdbarch);
return value_from_longest (type, (LONGEST) 1);
case TYPE_CODE_RANGE:
- arg2 = value_from_longest (type,
- type->bounds ()->low.const_val ());
- arg3 = value_from_longest (type,
- type->bounds ()->high.const_val ());
+ arg2 = value_from_longest (type, type->bounds ()->low.const_val ());
+ arg3 = value_from_longest (type, type->bounds ()->high.const_val ());
binop_promote (exp->language_defn, exp->gdbarch, &arg1, &arg2);
binop_promote (exp->language_defn, exp->gdbarch, &arg1, &arg3);
type = language_bool_type (exp->language_defn, exp->gdbarch);
- return
- value_from_longest (type,
- (value_less (arg1, arg3)
- || value_equal (arg1, arg3))
- && (value_less (arg2, arg1)
- || value_equal (arg2, arg1)));
+ return value_from_longest (
+ type, (value_less (arg1, arg3) || value_equal (arg1, arg3))
+ && (value_less (arg2, arg1) || value_equal (arg2, arg1)));
}
}
/* A helper function for OP_ATR_TAG. */
value *
-ada_atr_tag (struct type *expect_type,
- struct expression *exp,
- enum noside noside, enum exp_opcode op,
- struct value *arg1)
+ada_atr_tag (struct type *expect_type, struct expression *exp,
+ enum noside noside, enum exp_opcode op, struct value *arg1)
{
if (noside == EVAL_AVOID_SIDE_EFFECTS)
return value_zero (ada_tag_type (arg1), not_lval);
@@ -10172,10 +9989,8 @@ ada_atr_tag (struct type *expect_type,
/* A helper function for OP_ATR_SIZE. */
value *
-ada_atr_size (struct type *expect_type,
- struct expression *exp,
- enum noside noside, enum exp_opcode op,
- struct value *arg1)
+ada_atr_size (struct type *expect_type, struct expression *exp,
+ enum noside noside, enum exp_opcode op, struct value *arg1)
{
struct type *type = value_type (arg1);
@@ -10195,10 +10010,8 @@ ada_atr_size (struct type *expect_type,
/* A helper function for UNOP_ABS. */
value *
-ada_abs (struct type *expect_type,
- struct expression *exp,
- enum noside noside, enum exp_opcode op,
- struct value *arg1)
+ada_abs (struct type *expect_type, struct expression *exp, enum noside noside,
+ enum exp_opcode op, struct value *arg1)
{
unop_promote (exp->language_defn, exp->gdbarch, &arg1);
if (value_less (arg1, value_zero (value_type (arg1), not_lval)))
@@ -10210,10 +10023,9 @@ ada_abs (struct type *expect_type,
/* A helper function for BINOP_MUL. */
value *
-ada_mult_binop (struct type *expect_type,
- struct expression *exp,
- enum noside noside, enum exp_opcode op,
- struct value *arg1, struct value *arg2)
+ada_mult_binop (struct type *expect_type, struct expression *exp,
+ enum noside noside, enum exp_opcode op, struct value *arg1,
+ struct value *arg2)
{
if (noside == EVAL_AVOID_SIDE_EFFECTS)
{
@@ -10230,10 +10042,9 @@ ada_mult_binop (struct type *expect_type,
/* A helper function for BINOP_EQUAL and BINOP_NOTEQUAL. */
value *
-ada_equal_binop (struct type *expect_type,
- struct expression *exp,
- enum noside noside, enum exp_opcode op,
- struct value *arg1, struct value *arg2)
+ada_equal_binop (struct type *expect_type, struct expression *exp,
+ enum noside noside, enum exp_opcode op, struct value *arg1,
+ struct value *arg2)
{
int tem;
if (noside == EVAL_AVOID_SIDE_EFFECTS)
@@ -10252,8 +10063,7 @@ ada_equal_binop (struct type *expect_type,
/* A helper function for TERNOP_SLICE. */
value *
-ada_ternop_slice (struct expression *exp,
- enum noside noside,
+ada_ternop_slice (struct expression *exp, enum noside noside,
struct value *array, struct value *low_bound_val,
struct value *high_bound_val)
{
@@ -10269,11 +10079,11 @@ ada_ternop_slice (struct expression *exp,
the aligners. */
if (value_type (array)->code () == TYPE_CODE_REF
&& ada_is_aligner_type (value_type (array)->target_type ()))
- value_type (array)->set_target_type
- (ada_aligned_type (value_type (array)->target_type ()));
+ value_type (array)->set_target_type (
+ ada_aligned_type (value_type (array)->target_type ()));
if (ada_is_any_packed_array_type (value_type (array)))
- error (_("cannot slice a packed array"));
+ error (_ ("cannot slice a packed array"));
/* If this is a reference to an array or an array lvalue,
convert to a pointer. */
@@ -10283,18 +10093,15 @@ ada_ternop_slice (struct expression *exp,
array = value_addr (array);
if (noside == EVAL_AVOID_SIDE_EFFECTS
- && ada_is_array_descriptor_type (ada_check_typedef
- (value_type (array))))
- return empty_array (ada_type_of_array (array, 0), low_bound,
- high_bound);
+ && ada_is_array_descriptor_type (ada_check_typedef (value_type (array))))
+ return empty_array (ada_type_of_array (array, 0), low_bound, high_bound);
array = ada_coerce_to_simple_array_ptr (array);
/* If we have more than one level of pointer indirection,
dereference the value until we get only one level. */
while (value_type (array)->code () == TYPE_CODE_PTR
- && (value_type (array)->target_type ()->code ()
- == TYPE_CODE_PTR))
+ && (value_type (array)->target_type ()->code () == TYPE_CODE_PTR))
array = value_ind (array);
/* Make sure we really do have an array type before going further,
@@ -10302,10 +10109,9 @@ ada_ternop_slice (struct expression *exp,
type later down the road if the debug info generated by
the compiler is incorrect or incomplete. */
if (!ada_is_simple_array_type (value_type (array)))
- error (_("cannot take slice of non-array"));
+ error (_ ("cannot take slice of non-array"));
- if (ada_check_typedef (value_type (array))->code ()
- == TYPE_CODE_PTR)
+ if (ada_check_typedef (value_type (array))->code () == TYPE_CODE_PTR)
{
struct type *type0 = ada_check_typedef (value_type (array));
@@ -10313,8 +10119,8 @@ ada_ternop_slice (struct expression *exp,
return empty_array (type0->target_type (), low_bound, high_bound);
else
{
- struct type *arr_type0 =
- to_fixed_array_type (type0->target_type (), NULL, 1);
+ struct type *arr_type0
+ = to_fixed_array_type (type0->target_type (), NULL, 1);
return ada_value_slice_from_ptr (array, arr_type0,
longest_to_int (low_bound),
@@ -10338,8 +10144,8 @@ ada_binop_in_bounds (struct expression *exp, enum noside noside,
{
if (noside == EVAL_AVOID_SIDE_EFFECTS)
{
- struct type *type = language_bool_type (exp->language_defn,
- exp->gdbarch);
+ struct type *type
+ = language_bool_type (exp->language_defn, exp->gdbarch);
return value_zero (type, not_lval);
}
@@ -10353,11 +10159,9 @@ ada_binop_in_bounds (struct expression *exp, enum noside noside,
binop_promote (exp->language_defn, exp->gdbarch, &arg1, &arg2);
binop_promote (exp->language_defn, exp->gdbarch, &arg1, &arg3);
type = language_bool_type (exp->language_defn, exp->gdbarch);
- return value_from_longest (type,
- (value_less (arg1, arg3)
- || value_equal (arg1, arg3))
- && (value_less (arg2, arg1)
- || value_equal (arg2, arg1)));
+ return value_from_longest (
+ type, (value_less (arg1, arg3) || value_equal (arg1, arg3))
+ && (value_less (arg2, arg1) || value_equal (arg2, arg1)));
}
/* A helper function for some attribute operations. */
@@ -10378,12 +10182,12 @@ ada_unop_atr (struct expression *exp, enum noside noside, enum exp_opcode op,
{
switch (op)
{
- default: /* Should never happen. */
- error (_("unexpected attribute encountered"));
+ default: /* Should never happen. */
+ error (_ ("unexpected attribute encountered"));
case OP_ATR_FIRST:
case OP_ATR_LAST:
- type_arg = ada_index_type (type_arg, tem,
- ada_attribute_name (op));
+ type_arg
+ = ada_index_type (type_arg, tem, ada_attribute_name (op));
break;
case OP_ATR_LENGTH:
type_arg = builtin_type (exp->gdbarch)->builtin_int;
@@ -10405,25 +10209,22 @@ ada_unop_atr (struct expression *exp, enum noside noside, enum exp_opcode op,
type = builtin_type (exp->gdbarch)->builtin_int;
else
{
- type = ada_index_type (value_type (arg1), tem,
- ada_attribute_name (op));
+ type
+ = ada_index_type (value_type (arg1), tem, ada_attribute_name (op));
if (type == NULL)
type = builtin_type (exp->gdbarch)->builtin_int;
}
switch (op)
{
- default: /* Should never happen. */
- error (_("unexpected attribute encountered"));
+ default: /* Should never happen. */
+ error (_ ("unexpected attribute encountered"));
case OP_ATR_FIRST:
- return value_from_longest
- (type, ada_array_bound (arg1, tem, 0));
+ return value_from_longest (type, ada_array_bound (arg1, tem, 0));
case OP_ATR_LAST:
- return value_from_longest
- (type, ada_array_bound (arg1, tem, 1));
+ return value_from_longest (type, ada_array_bound (arg1, tem, 1));
case OP_ATR_LENGTH:
- return value_from_longest
- (type, ada_array_length (arg1, tem));
+ return value_from_longest (type, ada_array_length (arg1, tem));
}
}
else if (discrete_type_p (type_arg))
@@ -10439,19 +10240,19 @@ ada_unop_atr (struct expression *exp, enum noside noside, enum exp_opcode op,
switch (op)
{
default:
- error (_("unexpected attribute encountered"));
+ error (_ ("unexpected attribute encountered"));
case OP_ATR_FIRST:
- return value_from_longest
- (range_type, ada_discrete_type_low_bound (range_type));
+ return value_from_longest (range_type,
+ ada_discrete_type_low_bound (range_type));
case OP_ATR_LAST:
- return value_from_longest
- (range_type, ada_discrete_type_high_bound (range_type));
+ return value_from_longest (
+ range_type, ada_discrete_type_high_bound (range_type));
case OP_ATR_LENGTH:
- error (_("the 'length attribute applies only to array types"));
+ error (_ ("the 'length attribute applies only to array types"));
}
}
else if (type_arg->code () == TYPE_CODE_FLT)
- error (_("unimplemented type attribute"));
+ error (_ ("unimplemented type attribute"));
else
{
LONGEST low, high;
@@ -10472,7 +10273,7 @@ ada_unop_atr (struct expression *exp, enum noside noside, enum exp_opcode op,
switch (op)
{
default:
- error (_("unexpected attribute encountered"));
+ error (_ ("unexpected attribute encountered"));
case OP_ATR_FIRST:
low = ada_array_bound_from_type (type_arg, tem, 0);
return value_from_longest (type, low);
@@ -10490,10 +10291,9 @@ ada_unop_atr (struct expression *exp, enum noside noside, enum exp_opcode op,
/* A helper function for OP_ATR_MIN and OP_ATR_MAX. */
struct value *
-ada_binop_minmax (struct type *expect_type,
- struct expression *exp,
- enum noside noside, enum exp_opcode op,
- struct value *arg1, struct value *arg2)
+ada_binop_minmax (struct type *expect_type, struct expression *exp,
+ enum noside noside, enum exp_opcode op, struct value *arg1,
+ struct value *arg2)
{
if (noside == EVAL_AVOID_SIDE_EFFECTS)
return value_zero (value_type (arg1), not_lval);
@@ -10507,10 +10307,9 @@ ada_binop_minmax (struct type *expect_type,
/* A helper function for BINOP_EXP. */
struct value *
-ada_binop_exp (struct type *expect_type,
- struct expression *exp,
- enum noside noside, enum exp_opcode op,
- struct value *arg1, struct value *arg2)
+ada_binop_exp (struct type *expect_type, struct expression *exp,
+ enum noside noside, enum exp_opcode op, struct value *arg1,
+ struct value *arg2)
{
if (noside == EVAL_AVOID_SIDE_EFFECTS)
return value_zero (value_type (arg1), not_lval);
@@ -10533,17 +10332,14 @@ namespace expr
/* See ada-exp.h. */
operation_up
-ada_resolvable::replace (operation_up &&owner,
- struct expression *exp,
- bool deprocedure_p,
- bool parse_completion,
+ada_resolvable::replace (operation_up &&owner, struct expression *exp,
+ bool deprocedure_p, bool parse_completion,
innermost_block_tracker *tracker,
struct type *context_type)
{
if (resolve (exp, deprocedure_p, parse_completion, tracker, context_type))
- return (make_operation<ada_funcall_operation>
- (std::move (owner),
- std::vector<operation_up> ()));
+ return (make_operation<ada_funcall_operation> (
+ std::move (owner), std::vector<operation_up> ()));
return std::move (owner);
}
@@ -10589,8 +10385,7 @@ convert_char_literal (struct type *type, LONGEST val)
}
value *
-ada_char_operation::evaluate (struct type *expect_type,
- struct expression *exp,
+ada_char_operation::evaluate (struct type *expect_type, struct expression *exp,
enum noside noside)
{
value *result = long_const_operation::evaluate (expect_type, exp, noside);
@@ -10602,10 +10397,8 @@ ada_char_operation::evaluate (struct type *expect_type,
/* See ada-exp.h. */
operation_up
-ada_char_operation::replace (operation_up &&owner,
- struct expression *exp,
- bool deprocedure_p,
- bool parse_completion,
+ada_char_operation::replace (operation_up &&owner, struct expression *exp,
+ bool deprocedure_p, bool parse_completion,
innermost_block_tracker *tracker,
struct type *context_type)
{
@@ -10624,8 +10417,7 @@ ada_char_operation::replace (operation_up &&owner,
value *
ada_wrapped_operation::evaluate (struct type *expect_type,
- struct expression *exp,
- enum noside noside)
+ struct expression *exp, enum noside noside)
{
value *result = std::get<0> (m_storage)->evaluate (expect_type, exp, noside);
if (noside == EVAL_NORMAL)
@@ -10647,8 +10439,7 @@ ada_wrapped_operation::evaluate (struct type *expect_type,
value *
ada_string_operation::evaluate (struct type *expect_type,
- struct expression *exp,
- enum noside noside)
+ struct expression *exp, enum noside noside)
{
struct type *char_type;
if (expect_type != nullptr && ada_is_string_type (expect_type))
@@ -10668,8 +10459,7 @@ ada_string_operation::evaluate (struct type *expect_type,
struct type *stringtype
= lookup_array_range_type (char_type, 1, str.length ());
struct value *val = allocate_value (stringtype);
- memcpy (value_contents_raw (val).data (), str.c_str (),
- str.length ());
+ memcpy (value_contents_raw (val).data (), str.c_str (), str.length ());
return val;
}
@@ -10688,31 +10478,26 @@ ada_string_operation::evaluate (struct type *expect_type,
break;
default:
- error (_("unexpected character type size %s"),
+ error (_ ("unexpected character type size %s"),
pulongest (char_type->length ()));
}
auto_obstack converted;
convert_between_encodings (host_charset (), encoding,
- (const gdb_byte *) str.c_str (),
- str.length (), 1,
+ (const gdb_byte *) str.c_str (), str.length (), 1,
&converted, translit_none);
- struct type *stringtype
- = lookup_array_range_type (char_type, 1,
- obstack_object_size (&converted)
- / char_type->length ());
+ struct type *stringtype = lookup_array_range_type (
+ char_type, 1, obstack_object_size (&converted) / char_type->length ());
struct value *val = allocate_value (stringtype);
- memcpy (value_contents_raw (val).data (),
- obstack_base (&converted),
+ memcpy (value_contents_raw (val).data (), obstack_base (&converted),
obstack_object_size (&converted));
return val;
}
value *
ada_concat_operation::evaluate (struct type *expect_type,
- struct expression *exp,
- enum noside noside)
+ struct expression *exp, enum noside noside)
{
/* If one side is a literal, evaluate the other side first so that
the expected type can be set properly. */
@@ -10755,8 +10540,7 @@ ada_concat_operation::evaluate (struct type *expect_type,
}
value *
-ada_qual_operation::evaluate (struct type *expect_type,
- struct expression *exp,
+ada_qual_operation::evaluate (struct type *expect_type, struct expression *exp,
enum noside noside)
{
struct type *type = std::get<1> (m_storage);
@@ -10782,21 +10566,20 @@ ada_binop_addsub_operation::evaluate (struct type *expect_type,
value *arg1 = std::get<1> (m_storage)->evaluate_with_coercion (exp, noside);
value *arg2 = std::get<2> (m_storage)->evaluate_with_coercion (exp, noside);
- auto do_op = [=] (LONGEST x, LONGEST y)
- {
- if (std::get<0> (m_storage) == BINOP_ADD)
- return x + y;
- return x - y;
- };
+ auto do_op = [=] (LONGEST x, LONGEST y) {
+ if (std::get<0> (m_storage) == BINOP_ADD)
+ return x + y;
+ return x - y;
+ };
if (value_type (arg1)->code () == TYPE_CODE_PTR)
- return (value_from_longest
- (value_type (arg1),
- do_op (value_as_long (arg1), value_as_long (arg2))));
+ return (value_from_longest (value_type (arg1),
+ do_op (value_as_long (arg1),
+ value_as_long (arg2))));
if (value_type (arg2)->code () == TYPE_CODE_PTR)
- return (value_from_longest
- (value_type (arg2),
- do_op (value_as_long (arg1), value_as_long (arg2))));
+ return (value_from_longest (value_type (arg2),
+ do_op (value_as_long (arg1),
+ value_as_long (arg2))));
/* Preserve the original type for use by the range case below.
We cannot cast the result to a reference type, so if ARG1 is
a reference type, find its underlying type. */
@@ -10816,8 +10599,7 @@ ada_binop_addsub_operation::evaluate (struct type *expect_type,
value *
ada_unop_atr_operation::evaluate (struct type *expect_type,
- struct expression *exp,
- enum noside noside)
+ struct expression *exp, enum noside noside)
{
struct type *type_arg = nullptr;
value *val = nullptr;
@@ -10831,8 +10613,8 @@ ada_unop_atr_operation::evaluate (struct type *expect_type,
else
val = std::get<0> (m_storage)->evaluate (nullptr, exp, noside);
- return ada_unop_atr (exp, noside, std::get<1> (m_storage),
- val, type_arg, std::get<2> (m_storage));
+ return ada_unop_atr (exp, noside, std::get<1> (m_storage), val, type_arg,
+ std::get<2> (m_storage));
}
value *
@@ -10864,8 +10646,7 @@ ada_var_value_operation::evaluate_for_cast (struct type *expect_type,
struct expression *exp,
enum noside noside)
{
- value *val = evaluate_var_value (noside,
- std::get<0> (m_storage).block,
+ value *val = evaluate_var_value (noside, std::get<0> (m_storage).block,
std::get<0> (m_storage).symbol);
val = ada_value_cast (expect_type, val);
@@ -10883,8 +10664,7 @@ ada_var_value_operation::evaluate_for_cast (struct type *expect_type,
value *
ada_var_value_operation::evaluate (struct type *expect_type,
- struct expression *exp,
- enum noside noside)
+ struct expression *exp, enum noside noside)
{
symbol *sym = std::get<0> (m_storage).symbol;
@@ -10892,7 +10672,7 @@ ada_var_value_operation::evaluate (struct type *expect_type,
/* Only encountered when an unresolved symbol occurs in a
context other than a function call, in which case, it is
invalid. */
- error (_("Unexpected unresolved symbol, %s, during evaluation"),
+ error (_ ("Unexpected unresolved symbol, %s, during evaluation"),
sym->print_name ());
if (noside == EVAL_AVOID_SIDE_EFFECTS)
@@ -10971,8 +10751,7 @@ ada_var_value_operation::evaluate (struct type *expect_type,
}
bool
-ada_var_value_operation::resolve (struct expression *exp,
- bool deprocedure_p,
+ada_var_value_operation::resolve (struct expression *exp, bool deprocedure_p,
bool parse_completion,
innermost_block_tracker *tracker,
struct type *context_type)
@@ -10982,14 +10761,13 @@ ada_var_value_operation::resolve (struct expression *exp,
{
block_symbol resolved
= ada_resolve_variable (sym, std::get<0> (m_storage).block,
- context_type, parse_completion,
- deprocedure_p, tracker);
+ context_type, parse_completion, deprocedure_p,
+ tracker);
std::get<0> (m_storage) = resolved;
}
if (deprocedure_p
- && (std::get<0> (m_storage).symbol->type ()->code ()
- == TYPE_CODE_FUNC))
+ && (std::get<0> (m_storage).symbol->type ()->code () == TYPE_CODE_FUNC))
return true;
return false;
@@ -10997,8 +10775,7 @@ ada_var_value_operation::resolve (struct expression *exp,
value *
ada_atr_val_operation::evaluate (struct type *expect_type,
- struct expression *exp,
- enum noside noside)
+ struct expression *exp, enum noside noside)
{
value *arg = std::get<1> (m_storage)->evaluate (nullptr, exp, noside);
return ada_val_atr (noside, std::get<0> (m_storage), arg);
@@ -11006,8 +10783,7 @@ ada_atr_val_operation::evaluate (struct type *expect_type,
value *
ada_unop_ind_operation::evaluate (struct type *expect_type,
- struct expression *exp,
- enum noside noside)
+ struct expression *exp, enum noside noside)
{
value *arg1 = std::get<0> (m_storage)->evaluate (expect_type, exp, noside);
@@ -11020,7 +10796,7 @@ ada_unop_ind_operation::evaluate (struct type *expect_type,
struct type *arrType = ada_type_of_array (arg1, 0);
if (arrType == NULL)
- error (_("Attempt to dereference null array pointer."));
+ error (_ ("Attempt to dereference null array pointer."));
return value_at_lazy (arrType, 0);
}
else if (type->code () == TYPE_CODE_PTR
@@ -11043,9 +10819,8 @@ ada_unop_ind_operation::evaluate (struct type *expect_type,
}
else
{
- type = to_static_fixed_type
- (ada_aligned_type
- (ada_check_typedef (type->target_type ())));
+ type = to_static_fixed_type (
+ ada_aligned_type (ada_check_typedef (type->target_type ())));
}
return value_zero (type, lval_memory);
}
@@ -11057,15 +10832,15 @@ ada_unop_ind_operation::evaluate (struct type *expect_type,
lval_memory);
else
{
- expect_type =
- to_static_fixed_type (ada_aligned_type (expect_type));
+ expect_type
+ = to_static_fixed_type (ada_aligned_type (expect_type));
return value_zero (expect_type, lval_memory);
}
}
else
- error (_("Attempt to take contents of a non-pointer value."));
+ error (_ ("Attempt to take contents of a non-pointer value."));
}
- arg1 = ada_coerce_ref (arg1); /* FIXME: What is this for?? */
+ arg1 = ada_coerce_ref (arg1); /* FIXME: What is this for?? */
type = ada_check_typedef (value_type (arg1));
if (type->code () == TYPE_CODE_INT)
@@ -11090,8 +10865,7 @@ ada_unop_ind_operation::evaluate (struct type *expect_type,
value *
ada_structop_operation::evaluate (struct type *expect_type,
- struct expression *exp,
- enum noside noside)
+ struct expression *exp, enum noside noside)
{
value *arg1 = std::get<0> (m_storage)->evaluate (nullptr, exp, noside);
const char *str = std::get<1> (m_storage).c_str ();
@@ -11132,8 +10906,7 @@ ada_structop_operation::evaluate (struct type *expect_type,
value *
ada_funcall_operation::evaluate (struct type *expect_type,
- struct expression *exp,
- enum noside noside)
+ struct expression *exp, enum noside noside)
{
const std::vector<operation_up> &args_up = std::get<1> (m_storage);
int nargs = args_up.size ();
@@ -11142,17 +10915,16 @@ ada_funcall_operation::evaluate (struct type *expect_type,
ada_var_value_operation *avv
= dynamic_cast<ada_var_value_operation *> (callee_op.get ());
- if (avv != nullptr
- && avv->get_symbol ()->domain () == UNDEF_DOMAIN)
- error (_("Unexpected unresolved symbol, %s, during evaluation"),
+ if (avv != nullptr && avv->get_symbol ()->domain () == UNDEF_DOMAIN)
+ error (_ ("Unexpected unresolved symbol, %s, during evaluation"),
avv->get_symbol ()->print_name ());
value *callee = callee_op->evaluate (nullptr, exp, noside);
for (int i = 0; i < args_up.size (); ++i)
argvec[i] = args_up[i]->evaluate (nullptr, exp, noside);
- if (ada_is_constrained_packed_array_type
- (desc_base_type (value_type (callee))))
+ if (ada_is_constrained_packed_array_type (
+ desc_base_type (value_type (callee))))
callee = ada_coerce_to_simple_array (callee);
else if (value_type (callee)->code () == TYPE_CODE_ARRAY
&& TYPE_FIELD_BITSIZE (value_type (callee), 0) != 0)
@@ -11195,7 +10967,7 @@ ada_funcall_operation::evaluate (struct type *expect_type,
type = ada_check_typedef (type->target_type ());
break;
default:
- error (_("cannot subscript or call something of type `%s'"),
+ error (_ ("cannot subscript or call something of type `%s'"),
ada_type_name (value_type (callee)));
break;
}
@@ -11216,12 +10988,10 @@ ada_funcall_operation::evaluate (struct type *expect_type,
/* We don't know anything about what the internal
function might return, but we have to return
something. */
- return value_zero (builtin_type (exp->gdbarch)->builtin_int,
- not_lval);
+ return value_zero (builtin_type (exp->gdbarch)->builtin_int, not_lval);
else
return call_internal_function (exp->gdbarch, exp->language_defn,
- callee, nargs,
- argvec.data ());
+ callee, nargs, argvec.data ());
case TYPE_CODE_STRUCT:
{
@@ -11230,51 +11000,46 @@ ada_funcall_operation::evaluate (struct type *expect_type,
arity = ada_array_arity (type);
type = ada_array_element_type (type, nargs);
if (type == NULL)
- error (_("cannot subscript or call a record"));
+ error (_ ("cannot subscript or call a record"));
if (arity != nargs)
- error (_("wrong number of subscripts; expecting %d"), arity);
+ error (_ ("wrong number of subscripts; expecting %d"), arity);
if (noside == EVAL_AVOID_SIDE_EFFECTS)
return value_zero (ada_aligned_type (type), lval_memory);
- return
- unwrap_value (ada_value_subscript
- (callee, nargs, argvec.data ()));
+ return unwrap_value (ada_value_subscript (callee, nargs,
+ argvec.data ()));
}
case TYPE_CODE_ARRAY:
if (noside == EVAL_AVOID_SIDE_EFFECTS)
{
type = ada_array_element_type (type, nargs);
if (type == NULL)
- error (_("element type of array unknown"));
+ error (_ ("element type of array unknown"));
else
return value_zero (ada_aligned_type (type), lval_memory);
}
- return
- unwrap_value (ada_value_subscript
- (ada_coerce_to_simple_array (callee),
- nargs, argvec.data ()));
- case TYPE_CODE_PTR: /* Pointer to array */
+ return unwrap_value (ada_value_subscript (
+ ada_coerce_to_simple_array (callee), nargs, argvec.data ()));
+ case TYPE_CODE_PTR: /* Pointer to array */
if (noside == EVAL_AVOID_SIDE_EFFECTS)
{
type = to_fixed_array_type (type->target_type (), NULL, 1);
type = ada_array_element_type (type, nargs);
if (type == NULL)
- error (_("element type of array unknown"));
+ error (_ ("element type of array unknown"));
else
return value_zero (ada_aligned_type (type), lval_memory);
}
- return
- unwrap_value (ada_value_ptr_subscript (callee, nargs,
- argvec.data ()));
+ return unwrap_value (ada_value_ptr_subscript (callee, nargs,
+ argvec.data ()));
default:
- error (_("Attempt to index or call something other than an "
- "array or function"));
+ error (_ ("Attempt to index or call something other than an "
+ "array or function"));
}
}
bool
-ada_funcall_operation::resolve (struct expression *exp,
- bool deprocedure_p,
+ada_funcall_operation::resolve (struct expression *exp, bool deprocedure_p,
bool parse_completion,
innermost_block_tracker *tracker,
struct type *context_type)
@@ -11299,20 +11064,16 @@ ada_funcall_operation::resolve (struct expression *exp,
const block *block = avv->get_block ();
block_symbol resolved
- = ada_resolve_funcall (sym, block,
- context_type, parse_completion,
- nargs, argvec.data (),
- tracker);
+ = ada_resolve_funcall (sym, block, context_type, parse_completion, nargs,
+ argvec.data (), tracker);
- std::get<0> (m_storage)
- = make_operation<ada_var_value_operation> (resolved);
+ std::get<0> (m_storage) = make_operation<ada_var_value_operation> (resolved);
return false;
}
bool
ada_ternop_slice_operation::resolve (struct expression *exp,
- bool deprocedure_p,
- bool parse_completion,
+ bool deprocedure_p, bool parse_completion,
innermost_block_tracker *tracker,
struct type *context_type)
{
@@ -11321,13 +11082,11 @@ ada_ternop_slice_operation::resolve (struct expression *exp,
value *v = std::get<0> (m_storage)->evaluate (context_type, exp,
EVAL_AVOID_SIDE_EFFECTS);
if (ada_is_any_packed_array_type (value_type (v)))
- error (_("cannot slice a packed array"));
+ error (_ ("cannot slice a packed array"));
return false;
}
-}
-
-
+} // namespace expr
/* Return non-zero iff TYPE represents a System.Address type. */
@@ -11337,9 +11096,7 @@ ada_is_system_address_type (struct type *type)
return (type->name () && strcmp (type->name (), "system__address") == 0);
}
-
-
- /* Range types */
+/* Range types */
/* Scan STR beginning at position K for a discriminant name, and
return the value of that discriminant field of DVAL in *PX. If
@@ -11348,7 +11105,7 @@ ada_is_system_address_type (struct type *type)
not alter *PX and *PNEW_K if unsuccessful. */
static int
-scan_discrim_bound (const char *str, int k, struct value *dval, LONGEST * px,
+scan_discrim_bound (const char *str, int k, struct value *dval, LONGEST *px,
int *pnew_k)
{
static std::string storage;
@@ -11397,8 +11154,7 @@ get_var_value (const char *name, const char *err_msg)
lookup_name_info lookup_name (quoted_name, symbol_name_match_type::FULL);
std::vector<struct block_symbol> syms
- = ada_lookup_symbol_list_worker (lookup_name,
- get_selected_block (0),
+ = ada_lookup_symbol_list_worker (lookup_name, get_selected_block (0),
VAR_DOMAIN, 1);
if (syms.size () != 1)
@@ -11428,7 +11184,6 @@ get_int_var_value (const char *name, LONGEST &value)
return true;
}
-
/* Return a range type whose base type is that of the range type named
NAME in the current environment, and whose bounds are calculated
from NAME according to the GNAT range encoding conventions.
@@ -11485,7 +11240,7 @@ to_fixed_range_type (struct type *raw_type, struct value *dval)
return raw_type;
if (bounds_str[n] == '_')
n += 2;
- else if (bounds_str[n] == '.') /* FIXME? SGI Workshop kludge. */
+ else if (bounds_str[n] == '.') /* FIXME? SGI Workshop kludge. */
n += 1;
subtype_info += 1;
}
@@ -11494,7 +11249,7 @@ to_fixed_range_type (struct type *raw_type, struct value *dval)
std::string name_buf = std::string (name, prefix_len) + "___L";
if (!get_int_var_value (name_buf.c_str (), L))
{
- lim_warning (_("Unknown lower bound, using 1."));
+ lim_warning (_ ("Unknown lower bound, using 1."));
L = 1;
}
}
@@ -11510,13 +11265,13 @@ to_fixed_range_type (struct type *raw_type, struct value *dval)
std::string name_buf = std::string (name, prefix_len) + "___U";
if (!get_int_var_value (name_buf.c_str (), U))
{
- lim_warning (_("Unknown upper bound, using %ld."), (long) L);
+ lim_warning (_ ("Unknown upper bound, using %ld."), (long) L);
U = L;
}
}
- type = create_static_range_type (alloc_type_copy (raw_type),
- base_type, L, U);
+ type = create_static_range_type (alloc_type_copy (raw_type), base_type,
+ L, U);
/* create_static_range_type alters the resulting type's length
to match the size of the base_type, which is not what we want.
Set it back to the original range type's length. */
@@ -11533,9 +11288,8 @@ ada_is_range_type_name (const char *name)
{
return (name != NULL && strstr (name, "___XD"));
}
-
- /* Modular types */
+/* Modular types */
/* True iff TYPE is an Ada modular type. */
@@ -11563,7 +11317,6 @@ ada_modulus (struct type *type)
0, for lack of a better value to return. */
return 0;
}
-
/* Ada exception catchpoint support:
---------------------------------
@@ -11605,12 +11358,8 @@ ada_modulus (struct type *type)
an Ada83 compiler). As such, we do not include Numeric_Error from
this list of standard exceptions. */
-static const char * const standard_exc[] = {
- "constraint_error",
- "program_error",
- "storage_error",
- "tasking_error"
-};
+static const char *const standard_exc[]
+ = { "constraint_error", "program_error", "storage_error", "tasking_error" };
typedef CORE_ADDR (ada_unhandled_exception_name_addr_ftype) (void);
@@ -11619,27 +11368,27 @@ typedef CORE_ADDR (ada_unhandled_exception_name_addr_ftype) (void);
struct exception_support_info
{
- /* The name of the symbol to break on in order to insert
+ /* The name of the symbol to break on in order to insert
a catchpoint on exceptions. */
- const char *catch_exception_sym;
+ const char *catch_exception_sym;
- /* The name of the symbol to break on in order to insert
+ /* The name of the symbol to break on in order to insert
a catchpoint on unhandled exceptions. */
- const char *catch_exception_unhandled_sym;
+ const char *catch_exception_unhandled_sym;
- /* The name of the symbol to break on in order to insert
+ /* The name of the symbol to break on in order to insert
a catchpoint on failed assertions. */
- const char *catch_assert_sym;
+ const char *catch_assert_sym;
- /* The name of the symbol to break on in order to insert
+ /* The name of the symbol to break on in order to insert
a catchpoint on exception handling. */
- const char *catch_handlers_sym;
+ const char *catch_handlers_sym;
- /* Assuming that the inferior just triggered an unhandled exception
+ /* Assuming that the inferior just triggered an unhandled exception
catchpoint, this function is responsible for returning the address
in inferior memory where the name of that exception is stored.
Return zero if the address could not be computed. */
- ada_unhandled_exception_name_addr_ftype *unhandled_exception_name_addr;
+ ada_unhandled_exception_name_addr_ftype *unhandled_exception_name_addr;
};
static CORE_ADDR ada_unhandled_exception_name_addr (void);
@@ -11649,40 +11398,34 @@ static CORE_ADDR ada_unhandled_exception_name_addr_from_raise (void);
implement exception catchpoints with the latest version of the
Ada runtime (as of 2019-08-??). */
-static const struct exception_support_info default_exception_support_info =
-{
- "__gnat_debug_raise_exception", /* catch_exception_sym */
- "__gnat_unhandled_exception", /* catch_exception_unhandled_sym */
- "__gnat_debug_raise_assert_failure", /* catch_assert_sym */
- "__gnat_begin_handler_v1", /* catch_handlers_sym */
- ada_unhandled_exception_name_addr
-};
+static const struct exception_support_info default_exception_support_info
+ = { "__gnat_debug_raise_exception", /* catch_exception_sym */
+ "__gnat_unhandled_exception", /* catch_exception_unhandled_sym */
+ "__gnat_debug_raise_assert_failure", /* catch_assert_sym */
+ "__gnat_begin_handler_v1", /* catch_handlers_sym */
+ ada_unhandled_exception_name_addr };
/* The following exception support info structure describes how to
implement exception catchpoints with an earlier version of the
Ada runtime (as of 2007-03-06) using v0 of the EH ABI. */
-static const struct exception_support_info exception_support_info_v0 =
-{
- "__gnat_debug_raise_exception", /* catch_exception_sym */
- "__gnat_unhandled_exception", /* catch_exception_unhandled_sym */
- "__gnat_debug_raise_assert_failure", /* catch_assert_sym */
- "__gnat_begin_handler", /* catch_handlers_sym */
- ada_unhandled_exception_name_addr
-};
+static const struct exception_support_info exception_support_info_v0
+ = { "__gnat_debug_raise_exception", /* catch_exception_sym */
+ "__gnat_unhandled_exception", /* catch_exception_unhandled_sym */
+ "__gnat_debug_raise_assert_failure", /* catch_assert_sym */
+ "__gnat_begin_handler", /* catch_handlers_sym */
+ ada_unhandled_exception_name_addr };
/* The following exception support info structure describes how to
implement exception catchpoints with a slightly older version
of the Ada runtime. */
-static const struct exception_support_info exception_support_info_fallback =
-{
- "__gnat_raise_nodefer_with_msg", /* catch_exception_sym */
- "__gnat_unhandled_exception", /* catch_exception_unhandled_sym */
- "system__assertions__raise_assert_failure", /* catch_assert_sym */
- "__gnat_begin_handler", /* catch_handlers_sym */
- ada_unhandled_exception_name_addr_from_raise
-};
+static const struct exception_support_info exception_support_info_fallback
+ = { "__gnat_raise_nodefer_with_msg", /* catch_exception_sym */
+ "__gnat_unhandled_exception", /* catch_exception_unhandled_sym */
+ "system__assertions__raise_assert_failure", /* catch_assert_sym */
+ "__gnat_begin_handler", /* catch_handlers_sym */
+ ada_unhandled_exception_name_addr_from_raise };
/* Return nonzero if we can detect the exception support routines
described in EINFO.
@@ -11721,9 +11464,9 @@ ada_has_this_exception_support (const struct exception_support_info *einfo)
= lookup_minimal_symbol (einfo->catch_exception_sym, NULL, NULL);
if (msym.minsym && msym.minsym->type () != mst_solib_trampoline)
- error (_("Your Ada runtime appears to be missing some debugging "
- "information.\nCannot insert Ada exception catchpoint "
- "in this configuration."));
+ error (_ ("Your Ada runtime appears to be missing some debugging "
+ "information.\nCannot insert Ada exception catchpoint "
+ "in this configuration."));
return 0;
}
@@ -11732,7 +11475,7 @@ ada_has_this_exception_support (const struct exception_support_info *einfo)
if (sym->aclass () != LOC_BLOCK)
{
- error (_("Symbol \"%s\" is not a function (class = %d)"),
+ error (_ ("Symbol \"%s\" is not a function (class = %d)"),
sym->linkage_name (), sym->aclass ());
return 0;
}
@@ -11744,9 +11487,9 @@ ada_has_this_exception_support (const struct exception_support_info *einfo)
= lookup_minimal_symbol (einfo->catch_handlers_sym, NULL, NULL);
if (msym.minsym && msym.minsym->type () != mst_solib_trampoline)
- error (_("Your Ada runtime appears to be missing some debugging "
- "information.\nCannot insert Ada exception catchpoint "
- "in this configuration."));
+ error (_ ("Your Ada runtime appears to be missing some debugging "
+ "information.\nCannot insert Ada exception catchpoint "
+ "in this configuration."));
return 0;
}
@@ -11755,7 +11498,7 @@ ada_has_this_exception_support (const struct exception_support_info *einfo)
if (sym->aclass () != LOC_BLOCK)
{
- error (_("Symbol \"%s\" is not a function (class = %d)"),
+ error (_ ("Symbol \"%s\" is not a function (class = %d)"),
sym->linkage_name (), sym->aclass ());
return 0;
}
@@ -11806,7 +11549,7 @@ ada_exception_support_info_sniffer (void)
applicable. */
if (ada_update_initial_language (language_unknown) != language_ada)
- error (_("Unable to insert catchpoint. Is this an Ada main program?"));
+ error (_ ("Unable to insert catchpoint. Is this an Ada main program?"));
/* If the symbol does not exist, then check that the program is
already started, to make sure that shared libraries have been
@@ -11814,7 +11557,7 @@ ada_exception_support_info_sniffer (void)
in a shared library. */
if (inferior_ptid.pid () == 0)
- error (_("Unable to insert catchpoint. Try to start the program first."));
+ error (_ ("Unable to insert catchpoint. Try to start the program first."));
/* At this point, we know that we are debugging an Ada program and
that the inferior has been started, but we still are not able to
@@ -11823,7 +11566,7 @@ ada_exception_support_info_sniffer (void)
out by the linker... In any case, at this point it is not worth
supporting this feature. */
- error (_("Cannot insert Ada exception catchpoints in this configuration."));
+ error (_ ("Cannot insert Ada exception catchpoints in this configuration."));
}
/* True iff FRAME is very likely to be that of a function that is
@@ -11901,7 +11644,6 @@ ada_find_printable_frame (frame_info_ptr fi)
break;
}
}
-
}
/* Assuming that the inferior just triggered an unhandled exception
@@ -11935,7 +11677,7 @@ ada_unhandled_exception_name_addr_from_raise (void)
fi = get_current_frame ();
for (frame_level = 0; frame_level < 3; frame_level += 1)
if (fi != NULL)
- fi = get_prev_frame (fi);
+ fi = get_prev_frame (fi);
while (fi != NULL)
{
@@ -11946,7 +11688,8 @@ ada_unhandled_exception_name_addr_from_raise (void)
if (func_name != NULL)
{
if (strcmp (func_name.get (),
- data->exception_info->catch_exception_sym) == 0)
+ data->exception_info->catch_exception_sym)
+ == 0)
break; /* We found the frame we were looking for... */
}
fi = get_prev_frame (fi);
@@ -11974,26 +11717,26 @@ ada_exception_name_addr_1 (enum ada_exception_catchpoint_kind ex)
switch (ex)
{
- case ada_catch_exception:
- return (parse_and_eval_address ("e.full_name"));
- break;
+ case ada_catch_exception:
+ return (parse_and_eval_address ("e.full_name"));
+ break;
- case ada_catch_exception_unhandled:
- return data->exception_info->unhandled_exception_name_addr ();
- break;
+ case ada_catch_exception_unhandled:
+ return data->exception_info->unhandled_exception_name_addr ();
+ break;
- case ada_catch_handlers:
- return 0; /* The runtimes does not provide access to the exception
+ case ada_catch_handlers:
+ return 0; /* The runtimes does not provide access to the exception
name. */
- break;
+ break;
- case ada_catch_assert:
- return 0; /* Exception name is not relevant in this case. */
- break;
+ case ada_catch_assert:
+ return 0; /* Exception name is not relevant in this case. */
+ break;
- default:
- internal_error (_("unexpected catchpoint type"));
- break;
+ default:
+ internal_error (_ ("unexpected catchpoint type"));
+ break;
}
return 0; /* Should never be reached. */
@@ -12077,16 +11820,16 @@ ada_exception_name_addr (enum ada_exception_catchpoint_kind ex)
catch (const gdb_exception_error &e)
{
- warning (_("failed to get exception name: %s"), e.what ());
+ warning (_ ("failed to get exception name: %s"), e.what ());
return 0;
}
return result;
}
-static std::string ada_exception_catchpoint_cond_string
- (const char *excep_string,
- enum ada_exception_catchpoint_kind ex);
+static std::string
+ada_exception_catchpoint_cond_string (const char *excep_string,
+ enum ada_exception_catchpoint_kind ex);
/* Ada catchpoints.
@@ -12107,11 +11850,8 @@ struct ada_catchpoint : public code_breakpoint
{
ada_catchpoint (struct gdbarch *gdbarch_,
enum ada_exception_catchpoint_kind kind,
- struct symtab_and_line sal,
- const char *addr_string_,
- bool tempflag,
- bool enabled,
- bool from_tty)
+ struct symtab_and_line sal, const char *addr_string_,
+ bool tempflag, bool enabled, bool from_tty)
: code_breakpoint (gdbarch_, bp_catchpoint),
m_kind (kind)
{
@@ -12128,8 +11868,8 @@ struct ada_catchpoint : public code_breakpoint
if (!loc_gdbarch)
loc_gdbarch = gdbarch;
- describe_other_breakpoints (loc_gdbarch,
- sal.pspace, sal.pc, sal.section, -1);
+ describe_other_breakpoints (loc_gdbarch, sal.pspace, sal.pc,
+ sal.section, -1);
/* FIXME: brobecker/2006-12-28: Actually, re-implement a special
version for exception catchpoints, because two catchpoints
used for different exception names will use the same address.
@@ -12142,8 +11882,8 @@ struct ada_catchpoint : public code_breakpoint
enable_state = enabled ? bp_enabled : bp_disabled;
disposition = tempflag ? disp_del : disp_donttouch;
- locspec = string_to_location_spec (&addr_string_,
- language_def (language_ada));
+ locspec
+ = string_to_location_spec (&addr_string_, language_def (language_ada));
language = language_ada;
}
@@ -12168,9 +11908,11 @@ struct ada_catchpoint : public code_breakpoint
class ada_catchpoint_location : public bp_location
{
public:
+
explicit ada_catchpoint_location (ada_catchpoint *owner)
: bp_location (owner, bp_loc_software_breakpoint)
- {}
+ {
+ }
/* The condition that checks whether the exception that was raised
is the specific exception the user specified on catchpoint
@@ -12213,14 +11955,13 @@ create_excep_cond_exprs (struct ada_catchpoint *c,
s = cond_string.c_str ();
try
{
- exp = parse_exp_1 (&s, bl->address,
- block_for_pc (bl->address),
- 0);
+ exp
+ = parse_exp_1 (&s, bl->address, block_for_pc (bl->address), 0);
}
catch (const gdb_exception_error &e)
{
- warning (_("failed to reevaluate internal exception condition "
- "for catchpoint %d: %s"),
+ warning (_ ("failed to reevaluate internal exception condition "
+ "for catchpoint %d: %s"),
c->number, e.what ());
}
}
@@ -12304,12 +12045,13 @@ should_stop_exception (const struct bp_location *bl)
try
{
scoped_value_mark mark;
- stop = value_true (evaluate_expression (ada_loc->excep_cond_expr.get ()));
+ stop
+ = value_true (evaluate_expression (ada_loc->excep_cond_expr.get ()));
}
catch (const gdb_exception &ex)
{
exception_fprintf (gdb_stderr, ex,
- _("Error in testing exception condition:\n"));
+ _ ("Error in testing exception condition:\n"));
}
return stop;
@@ -12341,8 +12083,8 @@ ada_catchpoint::print_it (const bpstat *bs) const
uiout->field_string ("disp", bpdisp_text (disposition));
}
- uiout->text (disposition == disp_del
- ? "\nTemporary catchpoint " : "\nCatchpoint ");
+ uiout->text (disposition == disp_del ? "\nTemporary catchpoint "
+ : "\nCatchpoint ");
print_num_locno (bs, uiout);
uiout->text (", ");
@@ -12355,47 +12097,47 @@ ada_catchpoint::print_it (const bpstat *bs) const
switch (m_kind)
{
- case ada_catch_exception:
- case ada_catch_exception_unhandled:
- case ada_catch_handlers:
- {
- const CORE_ADDR addr = ada_exception_name_addr (m_kind);
- char exception_name[256];
+ case ada_catch_exception:
+ case ada_catch_exception_unhandled:
+ case ada_catch_handlers:
+ {
+ const CORE_ADDR addr = ada_exception_name_addr (m_kind);
+ char exception_name[256];
- if (addr != 0)
- {
- read_memory (addr, (gdb_byte *) exception_name,
- sizeof (exception_name) - 1);
- exception_name [sizeof (exception_name) - 1] = '\0';
- }
- else
- {
- /* For some reason, we were unable to read the exception
+ if (addr != 0)
+ {
+ read_memory (addr, (gdb_byte *) exception_name,
+ sizeof (exception_name) - 1);
+ exception_name[sizeof (exception_name) - 1] = '\0';
+ }
+ else
+ {
+ /* For some reason, we were unable to read the exception
name. This could happen if the Runtime was compiled
without debugging info, for instance. In that case,
just replace the exception name by the generic string
"exception" - it will read as "an exception" in the
notification we are about to print. */
- memcpy (exception_name, "exception", sizeof ("exception"));
- }
- /* In the case of unhandled exception breakpoints, we print
+ memcpy (exception_name, "exception", sizeof ("exception"));
+ }
+ /* In the case of unhandled exception breakpoints, we print
the exception name as "unhandled EXCEPTION_NAME", to make
it clearer to the user which kind of catchpoint just got
hit. We used ui_out_text to make sure that this extra
info does not pollute the exception name in the MI case. */
- if (m_kind == ada_catch_exception_unhandled)
- uiout->text ("unhandled ");
- uiout->field_string ("exception-name", exception_name);
- }
- break;
- case ada_catch_assert:
- /* In this case, the name of the exception is not really
+ if (m_kind == ada_catch_exception_unhandled)
+ uiout->text ("unhandled ");
+ uiout->field_string ("exception-name", exception_name);
+ }
+ break;
+ case ada_catch_assert:
+ /* In this case, the name of the exception is not really
important. Just print "failed assertion" to make it clearer
that his program just hit an assertion-failure catchpoint.
We used ui_out_text because this info does not belong in
the MI output. */
- uiout->text ("failed assertion");
- break;
+ uiout->text ("failed assertion");
+ break;
}
gdb::unique_xmalloc_ptr<char> exception_message = ada_exception_message ();
@@ -12417,7 +12159,7 @@ ada_catchpoint::print_it (const bpstat *bs) const
bool
ada_catchpoint::print_one (bp_location **last_loc) const
-{
+{
struct ui_out *uiout = current_uiout;
struct value_print_options opts;
@@ -12429,41 +12171,40 @@ ada_catchpoint::print_one (bp_location **last_loc) const
annotate_field (5);
switch (m_kind)
{
- case ada_catch_exception:
- if (!excep_string.empty ())
- {
- std::string msg = string_printf (_("`%s' Ada exception"),
- excep_string.c_str ());
+ case ada_catch_exception:
+ if (!excep_string.empty ())
+ {
+ std::string msg
+ = string_printf (_ ("`%s' Ada exception"), excep_string.c_str ());
- uiout->field_string ("what", msg);
- }
- else
- uiout->field_string ("what", "all Ada exceptions");
-
- break;
+ uiout->field_string ("what", msg);
+ }
+ else
+ uiout->field_string ("what", "all Ada exceptions");
- case ada_catch_exception_unhandled:
- uiout->field_string ("what", "unhandled Ada exceptions");
- break;
-
- case ada_catch_handlers:
- if (!excep_string.empty ())
- {
- uiout->field_fmt ("what",
- _("`%s' Ada exception handlers"),
- excep_string.c_str ());
- }
- else
- uiout->field_string ("what", "all Ada exceptions handlers");
- break;
+ break;
- case ada_catch_assert:
- uiout->field_string ("what", "failed Ada assertions");
- break;
+ case ada_catch_exception_unhandled:
+ uiout->field_string ("what", "unhandled Ada exceptions");
+ break;
- default:
- internal_error (_("unexpected catchpoint type"));
- break;
+ case ada_catch_handlers:
+ if (!excep_string.empty ())
+ {
+ uiout->field_fmt ("what", _ ("`%s' Ada exception handlers"),
+ excep_string.c_str ());
+ }
+ else
+ uiout->field_string ("what", "all Ada exceptions handlers");
+ break;
+
+ case ada_catch_assert:
+ uiout->field_string ("what", "failed Ada assertions");
+ break;
+
+ default:
+ internal_error (_ ("unexpected catchpoint type"));
+ break;
}
return true;
@@ -12477,47 +12218,46 @@ ada_catchpoint::print_mention () const
{
struct ui_out *uiout = current_uiout;
- uiout->text (disposition == disp_del ? _("Temporary catchpoint ")
- : _("Catchpoint "));
+ uiout->text (disposition == disp_del ? _ ("Temporary catchpoint ")
+ : _ ("Catchpoint "));
uiout->field_signed ("bkptno", number);
uiout->text (": ");
switch (m_kind)
{
- case ada_catch_exception:
- if (!excep_string.empty ())
- {
- std::string info = string_printf (_("`%s' Ada exception"),
- excep_string.c_str ());
- uiout->text (info);
- }
- else
- uiout->text (_("all Ada exceptions"));
- break;
+ case ada_catch_exception:
+ if (!excep_string.empty ())
+ {
+ std::string info
+ = string_printf (_ ("`%s' Ada exception"), excep_string.c_str ());
+ uiout->text (info);
+ }
+ else
+ uiout->text (_ ("all Ada exceptions"));
+ break;
- case ada_catch_exception_unhandled:
- uiout->text (_("unhandled Ada exceptions"));
- break;
+ case ada_catch_exception_unhandled:
+ uiout->text (_ ("unhandled Ada exceptions"));
+ break;
- case ada_catch_handlers:
- if (!excep_string.empty ())
- {
- std::string info
- = string_printf (_("`%s' Ada exception handlers"),
- excep_string.c_str ());
- uiout->text (info);
- }
- else
- uiout->text (_("all Ada exceptions handlers"));
- break;
+ case ada_catch_handlers:
+ if (!excep_string.empty ())
+ {
+ std::string info = string_printf (_ ("`%s' Ada exception handlers"),
+ excep_string.c_str ());
+ uiout->text (info);
+ }
+ else
+ uiout->text (_ ("all Ada exceptions handlers"));
+ break;
- case ada_catch_assert:
- uiout->text (_("failed Ada assertions"));
- break;
+ case ada_catch_assert:
+ uiout->text (_ ("failed Ada assertions"));
+ break;
- default:
- internal_error (_("unexpected catchpoint type"));
- break;
+ default:
+ internal_error (_ ("unexpected catchpoint type"));
+ break;
}
}
@@ -12529,26 +12269,26 @@ ada_catchpoint::print_recreate (struct ui_file *fp) const
{
switch (m_kind)
{
- case ada_catch_exception:
- gdb_printf (fp, "catch exception");
- if (!excep_string.empty ())
- gdb_printf (fp, " %s", excep_string.c_str ());
- break;
+ case ada_catch_exception:
+ gdb_printf (fp, "catch exception");
+ if (!excep_string.empty ())
+ gdb_printf (fp, " %s", excep_string.c_str ());
+ break;
- case ada_catch_exception_unhandled:
- gdb_printf (fp, "catch exception unhandled");
- break;
+ case ada_catch_exception_unhandled:
+ gdb_printf (fp, "catch exception unhandled");
+ break;
- case ada_catch_handlers:
- gdb_printf (fp, "catch handlers");
- break;
+ case ada_catch_handlers:
+ gdb_printf (fp, "catch handlers");
+ break;
- case ada_catch_assert:
- gdb_printf (fp, "catch assert");
- break;
+ case ada_catch_assert:
+ gdb_printf (fp, "catch assert");
+ break;
- default:
- internal_error (_("unexpected catchpoint type"));
+ default:
+ internal_error (_ ("unexpected catchpoint type"));
}
print_recreate_thread (fp);
}
@@ -12593,14 +12333,13 @@ catch_ada_exception_command_split (const char *args,
/* Check to see if we have a condition. */
args = skip_spaces (args);
- if (startswith (args, "if")
- && (isspace (args[2]) || args[2] == '\0'))
+ if (startswith (args, "if") && (isspace (args[2]) || args[2] == '\0'))
{
args += 2;
args = skip_spaces (args);
if (args[0] == '\0')
- error (_("Condition missing after `if' keyword"));
+ error (_ ("Condition missing after `if' keyword"));
*cond_string = args;
args += strlen (args);
@@ -12610,7 +12349,7 @@ catch_ada_exception_command_split (const char *args,
is unexpected. */
if (args[0] != '\0')
- error (_("Junk at end of expression"));
+ error (_ ("Junk at end of expression"));
if (is_catch_handlers_cmd)
{
@@ -12650,20 +12389,20 @@ ada_exception_sym_name (enum ada_exception_catchpoint_kind ex)
switch (ex)
{
- case ada_catch_exception:
- return (data->exception_info->catch_exception_sym);
- break;
- case ada_catch_exception_unhandled:
- return (data->exception_info->catch_exception_unhandled_sym);
- break;
- case ada_catch_assert:
- return (data->exception_info->catch_assert_sym);
- break;
- case ada_catch_handlers:
- return (data->exception_info->catch_handlers_sym);
- break;
- default:
- internal_error (_("unexpected catchpoint kind (%d)"), ex);
+ case ada_catch_exception:
+ return (data->exception_info->catch_exception_sym);
+ break;
+ case ada_catch_exception_unhandled:
+ return (data->exception_info->catch_exception_unhandled_sym);
+ break;
+ case ada_catch_assert:
+ return (data->exception_info->catch_assert_sym);
+ break;
+ case ada_catch_handlers:
+ return (data->exception_info->catch_handlers_sym);
+ break;
+ default:
+ internal_error (_ ("unexpected catchpoint kind (%d)"), ex);
}
}
@@ -12751,10 +12490,10 @@ ada_exception_sal (enum ada_exception_catchpoint_kind ex,
sym = standard_lookup (sym_name, NULL, VAR_DOMAIN);
if (sym == NULL)
- error (_("Catchpoint symbol not found: %s"), sym_name);
+ error (_ ("Catchpoint symbol not found: %s"), sym_name);
if (sym->aclass () != LOC_BLOCK)
- error (_("Unable to insert catchpoint. %s is not a function."), sym_name);
+ error (_ ("Unable to insert catchpoint. %s is not a function."), sym_name);
/* Set ADDR_STRING. */
*addr_string = sym_name;
@@ -12781,17 +12520,16 @@ void
create_ada_exception_catchpoint (struct gdbarch *gdbarch,
enum ada_exception_catchpoint_kind ex_kind,
const std::string &excep_string,
- const std::string &cond_string,
- int tempflag,
- int disabled,
- int from_tty)
+ const std::string &cond_string, int tempflag,
+ int disabled, int from_tty)
{
std::string addr_string;
struct symtab_and_line sal = ada_exception_sal (ex_kind, &addr_string);
- std::unique_ptr<ada_catchpoint> c
- (new ada_catchpoint (gdbarch, ex_kind, sal, addr_string.c_str (),
- tempflag, disabled, from_tty));
+ std::unique_ptr<ada_catchpoint> c (new ada_catchpoint (gdbarch, ex_kind, sal,
+ addr_string.c_str (),
+ tempflag, disabled,
+ from_tty));
c->excep_string = excep_string;
create_excep_cond_exprs (c.get (), ex_kind);
if (!cond_string.empty ())
@@ -12818,10 +12556,8 @@ catch_ada_exception_command (const char *arg_entry, int from_tty,
arg = "";
catch_ada_exception_command_split (arg, false, &ex_kind, &excep_string,
&cond_string);
- create_ada_exception_catchpoint (gdbarch, ex_kind,
- excep_string, cond_string,
- tempflag, 1 /* enabled */,
- from_tty);
+ create_ada_exception_catchpoint (gdbarch, ex_kind, excep_string, cond_string,
+ tempflag, 1 /* enabled */, from_tty);
}
/* Implement the "catch handlers" command. */
@@ -12843,10 +12579,8 @@ catch_ada_handlers_command (const char *arg_entry, int from_tty,
arg = "";
catch_ada_exception_command_split (arg, true, &ex_kind, &excep_string,
&cond_string);
- create_ada_exception_catchpoint (gdbarch, ex_kind,
- excep_string, cond_string,
- tempflag, 1 /* enabled */,
- from_tty);
+ create_ada_exception_catchpoint (gdbarch, ex_kind, excep_string, cond_string,
+ tempflag, 1 /* enabled */, from_tty);
}
/* Completion function for the Ada "catch" commands. */
@@ -12878,20 +12612,19 @@ catch_ada_assert_command_split (const char *args, std::string &cond_string)
args = skip_spaces (args);
/* Check whether a condition was provided. */
- if (startswith (args, "if")
- && (isspace (args[2]) || args[2] == '\0'))
+ if (startswith (args, "if") && (isspace (args[2]) || args[2] == '\0'))
{
args += 2;
args = skip_spaces (args);
if (args[0] == '\0')
- error (_("condition missing after `if' keyword"));
+ error (_ ("condition missing after `if' keyword"));
cond_string.assign (args);
}
/* Otherwise, there should be no other argument at the end of
the command. */
else if (args[0] != '\0')
- error (_("Junk at end of arguments."));
+ error (_ ("Junk at end of arguments."));
}
/* Implement the "catch assert" command. */
@@ -12910,10 +12643,8 @@ catch_assert_command (const char *arg_entry, int from_tty,
if (!arg)
arg = "";
catch_ada_assert_command_split (arg, cond_string);
- create_ada_exception_catchpoint (gdbarch, ada_catch_assert,
- "", cond_string,
- tempflag, 1 /* enabled */,
- from_tty);
+ create_ada_exception_catchpoint (gdbarch, ada_catch_assert, "", cond_string,
+ tempflag, 1 /* enabled */, from_tty);
}
/* Return non-zero if the symbol SYM is an Ada exception object. */
@@ -12923,10 +12654,8 @@ ada_is_exception_sym (struct symbol *sym)
{
const char *type_name = sym->type ()->name ();
- return (sym->aclass () != LOC_TYPEDEF
- && sym->aclass () != LOC_BLOCK
- && sym->aclass () != LOC_CONST
- && sym->aclass () != LOC_UNRESOLVED
+ return (sym->aclass () != LOC_TYPEDEF && sym->aclass () != LOC_BLOCK
+ && sym->aclass () != LOC_CONST && sym->aclass () != LOC_UNRESOLVED
&& type_name != NULL && strcmp (type_name, "exception") == 0);
}
@@ -12942,7 +12671,7 @@ ada_is_non_standard_exception_sym (struct symbol *sym)
for (const char *name : standard_exc)
if (strcmp (sym->linkage_name (), name) == 0)
- return 0; /* A standard exception. */
+ return 0; /* A standard exception. */
/* Numeric_Error is also a standard exception, so exclude it.
See the STANDARD_EXC description for more details as to why
@@ -12960,7 +12689,7 @@ ada_is_non_standard_exception_sym (struct symbol *sym)
by exception address. */
bool
-ada_exc_info::operator< (const ada_exc_info &other) const
+ada_exc_info::operator<(const ada_exc_info &other) const
{
int result;
@@ -12988,7 +12717,8 @@ sort_remove_dups_ada_exceptions_list (std::vector<ada_exc_info> *exceptions,
int skip)
{
std::sort (exceptions->begin () + skip, exceptions->end ());
- exceptions->erase (std::unique (exceptions->begin () + skip, exceptions->end ()),
+ exceptions->erase (std::unique (exceptions->begin () + skip,
+ exceptions->end ()),
exceptions->end ());
}
@@ -13028,7 +12758,7 @@ ada_add_standard_exceptions (compiled_regex *preg,
&& msymbol->type () != mst_solib_trampoline)
{
ada_exc_info info
- = {name, msymbol->value_address (objfile)};
+ = { name, msymbol->value_address (objfile) };
exceptions->push_back (info);
}
@@ -13049,8 +12779,7 @@ ada_add_standard_exceptions (compiled_regex *preg,
gets pushed. */
static void
-ada_add_exceptions_from_frame (compiled_regex *preg,
- frame_info_ptr frame,
+ada_add_exceptions_from_frame (compiled_regex *preg, frame_info_ptr frame,
std::vector<ada_exc_info> *exceptions)
{
const struct block *block = get_frame_block (frame, 0);
@@ -13071,8 +12800,8 @@ ada_add_exceptions_from_frame (compiled_regex *preg,
default:
if (ada_is_exception_sym (sym))
{
- struct ada_exc_info info = {sym->print_name (),
- sym->value_address ()};
+ struct ada_exc_info info
+ = { sym->print_name (), sym->value_address () };
exceptions->push_back (info);
}
@@ -13119,16 +12848,13 @@ ada_add_global_exceptions (compiled_regex *preg,
/* In Ada, the symbol "search name" is a linkage name, whereas the
regular expression used to do the matching refers to the natural
name. So match against the decoded name. */
- expand_symtabs_matching (NULL,
- lookup_name_info::match_any (),
- [&] (const char *search_name)
- {
- std::string decoded = ada_decode (search_name);
- return name_matches_regex (decoded.c_str (), preg);
- },
- NULL,
- SEARCH_GLOBAL_BLOCK | SEARCH_STATIC_BLOCK,
- VARIABLES_DOMAIN);
+ expand_symtabs_matching (
+ NULL, lookup_name_info::match_any (),
+ [&] (const char *search_name) {
+ std::string decoded = ada_decode (search_name);
+ return name_matches_regex (decoded.c_str (), preg);
+ },
+ NULL, SEARCH_GLOBAL_BLOCK | SEARCH_STATIC_BLOCK, VARIABLES_DOMAIN);
/* Iterate over all objfiles irrespective of scope or linker namespaces
so we get all exceptions anywhere in the progspace. */
@@ -13150,7 +12876,7 @@ ada_add_global_exceptions (compiled_regex *preg,
&& name_matches_regex (sym->natural_name (), preg))
{
struct ada_exc_info info
- = {sym->print_name (), sym->value_address ()};
+ = { sym->print_name (), sym->value_address () };
exceptions->push_back (info);
}
@@ -13183,8 +12909,7 @@ ada_exceptions_list_1 (compiled_regex *preg)
if (has_stack_frames ())
{
prev_len = result.size ();
- ada_add_exceptions_from_frame (preg, get_selected_frame (NULL),
- &result);
+ ada_add_exceptions_from_frame (preg, get_selected_frame (NULL), &result);
if (result.size () > prev_len)
sort_remove_dups_ada_exceptions_list (&result, prev_len);
}
@@ -13219,7 +12944,7 @@ ada_exceptions_list (const char *regexp)
if (regexp == NULL)
return ada_exceptions_list_1 (NULL);
- compiled_regex reg (regexp, REG_NOSUB, _("invalid regular expression"));
+ compiled_regex reg (regexp, REG_NOSUB, _ ("invalid regular expression"));
return ada_exceptions_list_1 (&reg);
}
@@ -13233,17 +12958,16 @@ info_exceptions_command (const char *regexp, int from_tty)
std::vector<ada_exc_info> exceptions = ada_exceptions_list (regexp);
if (regexp != NULL)
- gdb_printf
- (_("All Ada exceptions matching regular expression \"%s\":\n"), regexp);
+ gdb_printf (_ ("All Ada exceptions matching regular expression \"%s\":\n"),
+ regexp);
else
- gdb_printf (_("All defined Ada exceptions:\n"));
+ gdb_printf (_ ("All defined Ada exceptions:\n"));
for (const ada_exc_info &info : exceptions)
gdb_printf ("%s: %s\n", info.name, paddress (gdbarch, info.addr));
}
-
- /* Language vector */
+/* Language vector */
/* symbol_name_matcher_ftype adapter for wild_match. */
@@ -13268,8 +12992,7 @@ do_full_match (const char *symbol_search_name,
handle the comparison. However, if only the symbol name starts
with "_ada_", skip the prefix and let the match proceed as
usual. */
- if (startswith (symbol_search_name, "_ada_")
- && !startswith (lname, "_ada"))
+ if (startswith (symbol_search_name, "_ada_") && !startswith (lname, "_ada"))
symbol_search_name += 5;
/* Likewise for ghost entities. */
if (startswith (symbol_search_name, "___ghost_")
@@ -13287,8 +13010,7 @@ do_full_match (const char *symbol_search_name,
symbol_search_name += 2;
while (isdigit (*symbol_search_name))
++symbol_search_name;
- if (symbol_search_name[0] == '_'
- && symbol_search_name[1] == '_')
+ if (symbol_search_name[0] == '_' && symbol_search_name[1] == '_')
{
symbol_search_name += 2;
continue;
@@ -13321,7 +13043,8 @@ do_exact_match (const char *symbol_search_name,
/* Build the Ada lookup name for LOOKUP_NAME. */
-ada_lookup_name_info::ada_lookup_name_info (const lookup_name_info &lookup_name)
+ada_lookup_name_info::ada_lookup_name_info (
+ const lookup_name_info &lookup_name)
{
gdb::string_view user_name = lookup_name.name ();
@@ -13372,8 +13095,7 @@ ada_lookup_name_info::ada_lookup_name_info (const lookup_name_info &lookup_name)
non-wild matching. */
m_wild_match_p
= (lookup_name.match_type () != symbol_name_match_type::FULL
- && !m_encoded_p
- && !m_standard_p
+ && !m_encoded_p && !m_standard_p
&& user_name.find ('.') == std::string::npos);
}
}
@@ -13402,9 +13124,9 @@ literal_symbol_name_matcher (const char *symbol_search_name,
gdb::string_view name_view = lookup_name.name ();
if (lookup_name.completion_mode ()
- ? (strncmp (symbol_search_name, name_view.data (),
- name_view.size ()) == 0)
- : symbol_search_name == name_view)
+ ? (strncmp (symbol_search_name, name_view.data (), name_view.size ())
+ == 0)
+ : symbol_search_name == name_view)
{
if (comp_match_res != NULL)
comp_match_res->set_match (symbol_search_name);
@@ -13441,19 +13163,19 @@ ada_get_symbol_name_matcher (const lookup_name_info &lookup_name)
class ada_language : public language_defn
{
public:
+
ada_language ()
: language_defn (language_ada)
- { /* Nothing. */ }
+ { /* Nothing. */
+ }
/* See language.h. */
- const char *name () const override
- { return "ada"; }
+ const char *name () const override { return "ada"; }
/* See language.h. */
- const char *natural_name () const override
- { return "Ada"; }
+ const char *natural_name () const override { return "Ada"; }
/* See language.h. */
@@ -13466,8 +13188,7 @@ public:
/* Print an array element index using the Ada syntax. */
- void print_array_index (struct type *index_type,
- LONGEST index,
+ void print_array_index (struct type *index_type, LONGEST index,
struct ui_file *stream,
const value_print_options *options) const override
{
@@ -13510,41 +13231,36 @@ public:
const struct builtin_type *builtin = builtin_type (gdbarch);
/* Helper function to allow shorter lines below. */
- auto add = [&] (struct type *t)
- {
- lai->add_primitive_type (t);
- };
-
- add (arch_integer_type (gdbarch, gdbarch_int_bit (gdbarch),
- 0, "integer"));
- add (arch_integer_type (gdbarch, gdbarch_long_bit (gdbarch),
- 0, "long_integer"));
- add (arch_integer_type (gdbarch, gdbarch_short_bit (gdbarch),
- 0, "short_integer"));
- struct type *char_type = arch_character_type (gdbarch, TARGET_CHAR_BIT,
- 1, "character");
+ auto add = [&] (struct type *t) { lai->add_primitive_type (t); };
+
+ add (arch_integer_type (gdbarch, gdbarch_int_bit (gdbarch), 0, "integer"));
+ add (arch_integer_type (gdbarch, gdbarch_long_bit (gdbarch), 0,
+ "long_integer"));
+ add (arch_integer_type (gdbarch, gdbarch_short_bit (gdbarch), 0,
+ "short_integer"));
+ struct type *char_type
+ = arch_character_type (gdbarch, TARGET_CHAR_BIT, 1, "character");
lai->set_string_char_type (char_type);
add (char_type);
add (arch_character_type (gdbarch, 16, 1, "wide_character"));
add (arch_character_type (gdbarch, 32, 1, "wide_wide_character"));
- add (arch_float_type (gdbarch, gdbarch_float_bit (gdbarch),
- "float", gdbarch_float_format (gdbarch)));
- add (arch_float_type (gdbarch, gdbarch_double_bit (gdbarch),
- "long_float", gdbarch_double_format (gdbarch)));
- add (arch_integer_type (gdbarch, gdbarch_long_long_bit (gdbarch),
- 0, "long_long_integer"));
+ add (arch_float_type (gdbarch, gdbarch_float_bit (gdbarch), "float",
+ gdbarch_float_format (gdbarch)));
+ add (arch_float_type (gdbarch, gdbarch_double_bit (gdbarch), "long_float",
+ gdbarch_double_format (gdbarch)));
+ add (arch_integer_type (gdbarch, gdbarch_long_long_bit (gdbarch), 0,
+ "long_long_integer"));
add (arch_float_type (gdbarch, gdbarch_long_double_bit (gdbarch),
"long_long_float",
gdbarch_long_double_format (gdbarch)));
- add (arch_integer_type (gdbarch, gdbarch_int_bit (gdbarch),
- 0, "natural"));
- add (arch_integer_type (gdbarch, gdbarch_int_bit (gdbarch),
- 0, "positive"));
+ add (arch_integer_type (gdbarch, gdbarch_int_bit (gdbarch), 0, "natural"));
+ add (arch_integer_type (gdbarch, gdbarch_int_bit (gdbarch), 0,
+ "positive"));
add (builtin->builtin_void);
struct type *system_addr_ptr
- = lookup_pointer_type (arch_type (gdbarch, TYPE_CODE_VOID, TARGET_CHAR_BIT,
- "void"));
+ = lookup_pointer_type (arch_type (gdbarch, TYPE_CODE_VOID,
+ TARGET_CHAR_BIT, "void"));
system_addr_ptr->set_name ("system__address");
add (system_addr_ptr);
@@ -13560,10 +13276,10 @@ public:
/* See language.h. */
- bool iterate_over_symbols
- (const struct block *block, const lookup_name_info &name,
- domain_enum domain,
- gdb::function_view<symbol_found_callback_ftype> callback) const override
+ bool iterate_over_symbols (
+ const struct block *block, const lookup_name_info &name,
+ domain_enum domain,
+ gdb::function_view<symbol_found_callback_ftype> callback) const override
{
std::vector<struct block_symbol> results
= ada_lookup_symbol_list_worker (name, block, domain, 0);
@@ -13577,9 +13293,9 @@ public:
}
/* See language.h. */
- bool sniff_from_mangled_name
- (const char *mangled,
- gdb::unique_xmalloc_ptr<char> *out) const override
+ bool
+ sniff_from_mangled_name (const char *mangled,
+ gdb::unique_xmalloc_ptr<char> *out) const override
{
std::string demangled = ada_decode (mangled);
@@ -13641,11 +13357,10 @@ public:
/* See language.h. */
- void collect_symbol_completion_matches (completion_tracker &tracker,
- complete_symbol_mode mode,
- symbol_name_match_type name_match_type,
- const char *text, const char *word,
- enum type_code code) const override
+ void collect_symbol_completion_matches (
+ completion_tracker &tracker, complete_symbol_mode mode,
+ symbol_name_match_type name_match_type, const char *text, const char *word,
+ enum type_code code) const override
{
struct symbol *sym;
const struct block *b, *surrounding_static_block = 0;
@@ -13656,10 +13371,7 @@ public:
lookup_name_info lookup_name (text, name_match_type, true);
/* First, look at the partial symtab symbols. */
- expand_symtabs_matching (NULL,
- lookup_name,
- NULL,
- NULL,
+ expand_symtabs_matching (NULL, lookup_name, NULL, NULL,
SEARCH_GLOBAL_BLOCK | SEARCH_STATIC_BLOCK,
ALL_DOMAIN);
@@ -13694,10 +13406,9 @@ public:
|| symbol_language == language_cplus)
symbol_language = language_ada;
- completion_list_add_name (tracker,
- symbol_language,
- msymbol->linkage_name (),
- lookup_name, text, word);
+ completion_list_add_name (tracker, symbol_language,
+ msymbol->linkage_name (), lookup_name,
+ text, word);
}
}
@@ -13707,17 +13418,16 @@ public:
for (b = get_selected_block (0); b != NULL; b = b->superblock ())
{
if (!b->superblock ())
- surrounding_static_block = b; /* For elmin of dups */
+ surrounding_static_block = b; /* For elmin of dups */
ALL_BLOCK_SYMBOLS (b, iter, sym)
{
if (completion_skip_symbol (mode, sym))
continue;
- completion_list_add_name (tracker,
- sym->language (),
- sym->linkage_name (),
- lookup_name, text, word);
+ completion_list_add_name (tracker, sym->language (),
+ sym->linkage_name (), lookup_name, text,
+ word);
}
}
@@ -13735,10 +13445,9 @@ public:
if (completion_skip_symbol (mode, sym))
continue;
- completion_list_add_name (tracker,
- sym->language (),
- sym->linkage_name (),
- lookup_name, text, word);
+ completion_list_add_name (tracker, sym->language (),
+ sym->linkage_name (), lookup_name,
+ text, word);
}
}
}
@@ -13757,10 +13466,9 @@ public:
if (completion_skip_symbol (mode, sym))
continue;
- completion_list_add_name (tracker,
- sym->language (),
- sym->linkage_name (),
- lookup_name, text, word);
+ completion_list_add_name (tracker, sym->language (),
+ sym->linkage_name (), lookup_name,
+ text, word);
}
}
}
@@ -13768,8 +13476,8 @@ public:
/* See language.h. */
- gdb::unique_xmalloc_ptr<char> watch_location_expression
- (struct type *type, CORE_ADDR addr) const override
+ gdb::unique_xmalloc_ptr<char>
+ watch_location_expression (struct type *type, CORE_ADDR addr) const override
{
type = check_typedef (check_typedef (type)->target_type ());
std::string name = type_to_string (type);
@@ -13786,18 +13494,18 @@ public:
/* See language.h. */
- void value_print_inner
- (struct value *val, struct ui_file *stream, int recurse,
- const struct value_print_options *options) const override
+ void
+ value_print_inner (struct value *val, struct ui_file *stream, int recurse,
+ const struct value_print_options *options) const override
{
return ada_value_print_inner (val, stream, recurse, options);
}
/* See language.h. */
- struct block_symbol lookup_symbol_nonlocal
- (const char *name, const struct block *block,
- const domain_enum domain) const override
+ struct block_symbol
+ lookup_symbol_nonlocal (const char *name, const struct block *block,
+ const domain_enum domain) const override
{
struct block_symbol sym;
@@ -13844,8 +13552,8 @@ public:
/* See language.h. */
- void emitchar (int ch, struct type *chtype,
- struct ui_file *stream, int quoter) const override
+ void emitchar (int ch, struct type *chtype, struct ui_file *stream,
+ int quoter) const override
{
ada_emit_char (ch, chtype, stream, quoter, 1);
}
@@ -13865,8 +13573,8 @@ public:
const char *encoding, int force_ellipses,
const struct value_print_options *options) const override
{
- ada_printstr (stream, elttype, string, length, encoding,
- force_ellipses, options);
+ ada_printstr (stream, elttype, string, length, encoding, force_ellipses,
+ options);
}
/* See language.h. */
@@ -13886,29 +13594,29 @@ public:
/* See language.h. */
- const char *struct_too_deep_ellipsis () const override
- { return "(...)"; }
+ const char *struct_too_deep_ellipsis () const override { return "(...)"; }
/* See language.h. */
- bool c_style_arrays_p () const override
- { return false; }
+ bool c_style_arrays_p () const override { return false; }
/* See language.h. */
- bool store_sym_names_in_linkage_form_p () const override
- { return true; }
+ bool store_sym_names_in_linkage_form_p () const override { return true; }
/* See language.h. */
const struct lang_varobj_ops *varobj_ops () const override
- { return &ada_varobj_ops; }
+ {
+ return &ada_varobj_ops;
+ }
protected:
+
/* See language.h. */
- symbol_name_matcher_ftype *get_symbol_name_matcher_inner
- (const lookup_name_info &lookup_name) const override
+ symbol_name_matcher_ftype *get_symbol_name_matcher_inner (
+ const lookup_name_info &lookup_name) const override
{
return ada_get_symbol_name_matcher (lookup_name);
}
@@ -13939,41 +13647,33 @@ ada_free_objfile_observer (struct objfile *objfile)
}
/* Charsets known to GNAT. */
-static const char * const gnat_source_charsets[] =
-{
+static const char *const gnat_source_charsets[] = {
/* Note that code below assumes that the default comes first.
Latin-1 is the default here, because that is also GNAT's
default. */
- "ISO-8859-1",
- "ISO-8859-2",
- "ISO-8859-3",
- "ISO-8859-4",
- "ISO-8859-5",
- "ISO-8859-15",
- "CP437",
- "CP850",
+ "ISO-8859-1", "ISO-8859-2", "ISO-8859-3", "ISO-8859-4", "ISO-8859-5",
+ "ISO-8859-15", "CP437", "CP850",
/* Note that this value is special-cased in the encoder and
decoder. */
- ada_utf8,
- nullptr
+ ada_utf8, nullptr
};
void _initialize_ada_language ();
+
void
_initialize_ada_language ()
{
- add_setshow_prefix_cmd
- ("ada", no_class,
- _("Prefix command for changing Ada-specific settings."),
- _("Generic command for showing Ada-specific settings."),
- &set_ada_list, &show_ada_list,
- &setlist, &showlist);
+ add_setshow_prefix_cmd (
+ "ada", no_class, _ ("Prefix command for changing Ada-specific settings."),
+ _ ("Generic command for showing Ada-specific settings."), &set_ada_list,
+ &show_ada_list, &setlist, &showlist);
add_setshow_boolean_cmd ("trust-PAD-over-XVS", class_obscure,
- &trust_pad_over_xvs, _("\
-Enable or disable an optimization trusting PAD types over XVS types."), _("\
+ &trust_pad_over_xvs, _ ("\
+Enable or disable an optimization trusting PAD types over XVS types."),
+ _ ("\
Show whether an optimization trusting PAD types over XVS types is activated."),
- _("\
+ _ ("\
This is related to the encoding used by the GNAT compiler. The debugger\n\
should normally trust the contents of PAD types, but certain older versions\n\
of GNAT have a bug that sometimes causes the information in the PAD type\n\
@@ -13981,28 +13681,29 @@ to be incorrect. Turning this setting \"off\" allows the debugger to\n\
work around this bug. It is always safe to turn this option \"off\", but\n\
this incurs a slight performance penalty, so it is recommended to NOT change\n\
this option to \"off\" unless necessary."),
- NULL, NULL, &set_ada_list, &show_ada_list);
+ NULL, NULL, &set_ada_list, &show_ada_list);
- add_setshow_boolean_cmd ("print-signatures", class_vars,
- &print_signatures, _("\
+ add_setshow_boolean_cmd ("print-signatures", class_vars, &print_signatures,
+ _ ("\
Enable or disable the output of formal and return types for functions in the \
-overloads selection menu."), _("\
+overloads selection menu."),
+ _ ("\
Show whether the output of formal and return types for functions in the \
overloads selection menu is activated."),
NULL, NULL, NULL, &set_ada_list, &show_ada_list);
ada_source_charset = gnat_source_charsets[0];
- add_setshow_enum_cmd ("source-charset", class_files,
- gnat_source_charsets,
- &ada_source_charset, _("\
-Set the Ada source character set."), _("\
-Show the Ada source character set."), _("\
+ add_setshow_enum_cmd ("source-charset", class_files, gnat_source_charsets,
+ &ada_source_charset, _ ("\
+Set the Ada source character set."),
+ _ ("\
+Show the Ada source character set."),
+ _ ("\
The character set used for Ada source files.\n\
This must correspond to the '-gnati' or '-gnatW' option passed to GNAT."),
- nullptr, nullptr,
- &set_ada_list, &show_ada_list);
+ nullptr, nullptr, &set_ada_list, &show_ada_list);
- add_catch_command ("exception", _("\
+ add_catch_command ("exception", _ ("\
Catch Ada exceptions, when raised.\n\
Usage: catch exception [ARG] [if CONDITION]\n\
Without any argument, stop when any Ada exception is raised.\n\
@@ -14013,58 +13714,51 @@ Otherwise, the catchpoint only stops when the name of the exception being\n\
raised is the same as ARG.\n\
CONDITION is a boolean expression that is evaluated to see whether the\n\
exception should cause a stop."),
- catch_ada_exception_command,
- catch_ada_completer,
- CATCH_PERMANENT,
- CATCH_TEMPORARY);
+ catch_ada_exception_command, catch_ada_completer,
+ CATCH_PERMANENT, CATCH_TEMPORARY);
- add_catch_command ("handlers", _("\
+ add_catch_command ("handlers", _ ("\
Catch Ada exceptions, when handled.\n\
Usage: catch handlers [ARG] [if CONDITION]\n\
Without any argument, stop when any Ada exception is handled.\n\
With an argument, catch only exceptions with the given name.\n\
CONDITION is a boolean expression that is evaluated to see whether the\n\
exception should cause a stop."),
- catch_ada_handlers_command,
- catch_ada_completer,
- CATCH_PERMANENT,
- CATCH_TEMPORARY);
- add_catch_command ("assert", _("\
+ catch_ada_handlers_command, catch_ada_completer,
+ CATCH_PERMANENT, CATCH_TEMPORARY);
+ add_catch_command ("assert", _ ("\
Catch failed Ada assertions, when raised.\n\
Usage: catch assert [if CONDITION]\n\
CONDITION is a boolean expression that is evaluated to see whether the\n\
exception should cause a stop."),
- catch_assert_command,
- NULL,
- CATCH_PERMANENT,
+ catch_assert_command, NULL, CATCH_PERMANENT,
CATCH_TEMPORARY);
- add_info ("exceptions", info_exceptions_command,
- _("\
+ add_info ("exceptions", info_exceptions_command, _ ("\
List all Ada exception names.\n\
Usage: info exceptions [REGEXP]\n\
If a regular expression is passed as an argument, only those matching\n\
the regular expression are listed."));
add_setshow_prefix_cmd ("ada", class_maintenance,
- _("Set Ada maintenance-related variables."),
- _("Show Ada maintenance-related variables."),
+ _ ("Set Ada maintenance-related variables."),
+ _ ("Show Ada maintenance-related variables."),
&maint_set_ada_cmdlist, &maint_show_ada_cmdlist,
&maintenance_set_cmdlist, &maintenance_show_cmdlist);
- add_setshow_boolean_cmd
- ("ignore-descriptive-types", class_maintenance,
- &ada_ignore_descriptive_types_p,
- _("Set whether descriptive types generated by GNAT should be ignored."),
- _("Show whether descriptive types generated by GNAT should be ignored."),
- _("\
+ add_setshow_boolean_cmd (
+ "ignore-descriptive-types", class_maintenance,
+ &ada_ignore_descriptive_types_p,
+ _ ("Set whether descriptive types generated by GNAT should be ignored."),
+ _ ("Show whether descriptive types generated by GNAT should be ignored."),
+ _ ("\
When enabled, the debugger will stop using the DW_AT_GNAT_descriptive_type\n\
DWARF attribute."),
- NULL, NULL, &maint_set_ada_cmdlist, &maint_show_ada_cmdlist);
+ NULL, NULL, &maint_set_ada_cmdlist, &maint_show_ada_cmdlist);
- decoded_names_store = htab_create_alloc (256, htab_hash_string,
- htab_eq_string,
- NULL, xcalloc, xfree);
+ decoded_names_store
+ = htab_create_alloc (256, htab_hash_string, htab_eq_string, NULL, xcalloc,
+ xfree);
/* The ada-lang observers. */
gdb::observers::new_objfile.attach (ada_new_objfile_observer, "ada-lang");
diff --git a/gdb/ada-lang.h b/gdb/ada-lang.h
index 9fb7ac7f384..a3c53056bbe 100644
--- a/gdb/ada-lang.h
+++ b/gdb/ada-lang.h
@@ -17,7 +17,7 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
-#if !defined (ADA_LANG_H)
+#if !defined(ADA_LANG_H)
#define ADA_LANG_H 1
class frame_info_ptr;
@@ -33,25 +33,22 @@ struct parser_state;
system and that might consider (confusing) debugging information.
Each name (a basic regular expression string) is followed by a
comma. FIXME: Should be part of a configuration file. */
-#if defined (__linux__)
-#define ADA_KNOWN_RUNTIME_FILE_NAME_PATTERNS \
- "^[agis]-.*\\.ad[bs]$", \
- "/lib.*/libpthread\\.so[.0-9]*$", "/lib.*/libpthread\\.a$", \
- "/lib.*/libc\\.so[.0-9]*$", "/lib.*/libc\\.a$",
+#if defined(__linux__)
+#define ADA_KNOWN_RUNTIME_FILE_NAME_PATTERNS \
+ "^[agis]-.*\\.ad[bs]$", "/lib.*/libpthread\\.so[.0-9]*$", \
+ "/lib.*/libpthread\\.a$", "/lib.*/libc\\.so[.0-9]*$", "/lib.*/libc\\.a$",
#endif
-#if !defined (ADA_KNOWN_RUNTIME_FILE_NAME_PATTERNS)
+#if !defined(ADA_KNOWN_RUNTIME_FILE_NAME_PATTERNS)
#define ADA_KNOWN_RUNTIME_FILE_NAME_PATTERNS \
- "^unwind-seh.c$", \
- "^[agis]-.*\\.ad[bs]$",
+ "^unwind-seh.c$", "^[agis]-.*\\.ad[bs]$",
#endif
/* Names of compiler-generated auxiliary functions probably of no
interest to users. Each name (a basic regular expression string)
is followed by a comma. */
#define ADA_KNOWN_AUXILIARY_FUNCTION_NAME_PATTERNS \
- "___clean[.$a-zA-Z0-9_]*$", \
- "___finalizer[.$a-zA-Z0-9_]*$",
+ "___clean[.$a-zA-Z0-9_]*$", "___finalizer[.$a-zA-Z0-9_]*$",
/* The maximum number of frame levels searched for non-local,
non-global symbols. This limit exists as a precaution to prevent
@@ -80,25 +77,25 @@ extern const struct ada_opname_map ada_opname_table[];
/* Denotes a type of renaming symbol (see ada_parse_renaming). */
enum ada_renaming_category
- {
- /* Indicates a symbol that does not encode a renaming. */
- ADA_NOT_RENAMING,
+{
+ /* Indicates a symbol that does not encode a renaming. */
+ ADA_NOT_RENAMING,
- /* For symbols declared
+ /* For symbols declared
Foo : TYPE renamed OBJECT; */
- ADA_OBJECT_RENAMING,
+ ADA_OBJECT_RENAMING,
- /* For symbols declared
+ /* For symbols declared
Foo : exception renames EXCEPTION; */
- ADA_EXCEPTION_RENAMING,
- /* For packages declared
+ ADA_EXCEPTION_RENAMING,
+ /* For packages declared
package Foo renames PACKAGE; */
- ADA_PACKAGE_RENAMING,
- /* For subprograms declared
+ ADA_PACKAGE_RENAMING,
+ /* For subprograms declared
SUBPROGRAM_SPEC renames SUBPROGRAM;
(Currently not used). */
- ADA_SUBPROGRAM_RENAMING
- };
+ ADA_SUBPROGRAM_RENAMING
+};
/* The different types of catchpoints that we introduced for catching
Ada exceptions. */
@@ -150,12 +147,11 @@ struct ada_task_info
};
extern int ada_get_field_index (const struct type *type,
- const char *field_name,
- int maybe_missing);
+ const char *field_name, int maybe_missing);
-extern int ada_parse (struct parser_state *); /* Defined in ada-exp.y */
+extern int ada_parse (struct parser_state *); /* Defined in ada-exp.y */
- /* Defined in ada-typeprint.c */
+/* Defined in ada-typeprint.c */
extern void ada_print_type (struct type *, const char *, struct ui_file *, int,
int, const struct type_print_options *);
@@ -170,7 +166,7 @@ extern void ada_value_print_inner (struct value *, struct ui_file *, int,
extern void ada_value_print (struct value *, struct ui_file *,
const struct value_print_options *);
- /* Defined in ada-lang.c */
+/* Defined in ada-lang.c */
extern void ada_emit_char (int, struct type *, struct ui_file *, int, int);
@@ -223,24 +219,23 @@ extern const char *ada_decode_symbol (const struct general_symbol_info *);
extern std::string ada_decode (const char *name, bool wrap = true,
bool operators = true);
-extern std::vector<struct block_symbol> ada_lookup_symbol_list
- (const char *, const struct block *, domain_enum);
+extern std::vector<struct block_symbol>
+ada_lookup_symbol_list (const char *, const struct block *, domain_enum);
-extern struct block_symbol ada_lookup_symbol (const char *,
- const struct block *,
- domain_enum);
+extern struct block_symbol
+ada_lookup_symbol (const char *, const struct block *, domain_enum);
-extern void ada_lookup_encoded_symbol
- (const char *name, const struct block *block, domain_enum domain,
- struct block_symbol *symbol_info);
+extern void ada_lookup_encoded_symbol (const char *name,
+ const struct block *block,
+ domain_enum domain,
+ struct block_symbol *symbol_info);
extern struct bound_minimal_symbol ada_lookup_simple_minsym (const char *,
objfile *);
extern int ada_scan_number (const char *, int, LONGEST *, int *);
-extern struct value *ada_value_primitive_field (struct value *arg1,
- int offset,
+extern struct value *ada_value_primitive_field (struct value *arg1, int offset,
int fieldno,
struct type *arg_type);
@@ -251,9 +246,8 @@ extern int ada_is_ignored_field (struct type *, int);
extern int ada_is_constrained_packed_array_type (struct type *);
extern struct value *ada_value_primitive_packed_val (struct value *,
- const gdb_byte *,
- long, int, int,
- struct type *);
+ const gdb_byte *, long,
+ int, int, struct type *);
extern struct type *ada_coerce_to_simple_array_type (struct type *);
@@ -296,18 +290,15 @@ extern struct type *ada_to_fixed_type (struct type *, const gdb_byte *,
extern struct value *ada_to_fixed_value (struct value *val);
-extern struct type *ada_template_to_fixed_record_type_1 (struct type *type,
- const gdb_byte *valaddr,
- CORE_ADDR address,
- struct value *dval0,
- int keep_dynamic_fields);
+extern struct type *ada_template_to_fixed_record_type_1 (
+ struct type *type, const gdb_byte *valaddr, CORE_ADDR address,
+ struct value *dval0, int keep_dynamic_fields);
extern int ada_name_prefix_len (const char *);
extern const char *ada_type_name (struct type *);
-extern struct type *ada_find_parallel_type (struct type *,
- const char *suffix);
+extern struct type *ada_find_parallel_type (struct type *, const char *suffix);
extern bool get_int_var_value (const char *, LONGEST &value);
@@ -331,9 +322,8 @@ extern void ada_print_scalar (struct type *, LONGEST, struct ui_file *);
extern int ada_is_range_type_name (const char *);
-extern enum ada_renaming_category ada_parse_renaming (struct symbol *,
- const char **,
- int *, const char **);
+extern enum ada_renaming_category
+ada_parse_renaming (struct symbol *, const char **, int *, const char **);
extern void ada_find_printable_frame (frame_info_ptr fi);
@@ -341,10 +331,10 @@ extern char *ada_breakpoint_rewrite (char *, int *);
extern char *ada_main_name (void);
-extern void create_ada_exception_catchpoint
- (struct gdbarch *gdbarch, enum ada_exception_catchpoint_kind ex_kind,
- const std::string &excep_string, const std::string &cond_string, int tempflag,
- int disabled, int from_tty);
+extern void create_ada_exception_catchpoint (
+ struct gdbarch *gdbarch, enum ada_exception_catchpoint_kind ex_kind,
+ const std::string &excep_string, const std::string &cond_string,
+ int tempflag, int disabled, int from_tty);
/* Return true if BP is an Ada catchpoint. */
@@ -360,7 +350,7 @@ struct ada_exc_info
/* The address of the symbol corresponding to that exception. */
CORE_ADDR addr;
- bool operator< (const ada_exc_info &) const;
+ bool operator<(const ada_exc_info &) const;
bool operator== (const ada_exc_info &) const;
};
@@ -376,13 +366,12 @@ extern int ada_get_task_number (thread_info *thread);
typedef gdb::function_view<void (struct ada_task_info *task)>
ada_task_list_iterator_ftype;
-extern void iterate_over_live_ada_tasks
- (ada_task_list_iterator_ftype iterator);
+extern void
+iterate_over_live_ada_tasks (ada_task_list_iterator_ftype iterator);
extern const char *ada_get_tcb_types_info (void);
-extern void print_ada_task_info (struct ui_out *uiout,
- const char *taskno_str,
+extern void print_ada_task_info (struct ui_out *uiout, const char *taskno_str,
struct inferior *inf);
/* Look for a symbol for an overloaded operator for the operation OP.
@@ -391,8 +380,8 @@ extern void print_ada_task_info (struct ui_out *uiout,
"null" block_symbol if no such operator is found. */
extern block_symbol ada_find_operator_symbol (enum exp_opcode op,
- bool parse_completion,
- int nargs, value *argvec[]);
+ bool parse_completion, int nargs,
+ value *argvec[]);
/* Resolve a function call, selecting among possible function symbols.
SYM and BLOCK are passed to ada_lookup_symbol_list. CONTEXT_TYPE
@@ -404,8 +393,8 @@ extern block_symbol ada_find_operator_symbol (enum exp_opcode op,
extern block_symbol ada_resolve_funcall (struct symbol *sym,
const struct block *block,
struct type *context_type,
- bool parse_completion,
- int nargs, value *argvec[],
+ bool parse_completion, int nargs,
+ value *argvec[],
innermost_block_tracker *tracker);
/* Resolve a symbol reference, selecting among possible values. SYM
@@ -416,12 +405,10 @@ extern block_symbol ada_resolve_funcall (struct symbol *sym,
through ada_resolve_function. This returns the chosen symbol and
will update TRACKER accordingly. */
-extern block_symbol ada_resolve_variable (struct symbol *sym,
- const struct block *block,
- struct type *context_type,
- bool parse_completion,
- int deprocedure_p,
- innermost_block_tracker *tracker);
+extern block_symbol
+ada_resolve_variable (struct symbol *sym, const struct block *block,
+ struct type *context_type, bool parse_completion,
+ int deprocedure_p, innermost_block_tracker *tracker);
/* The type of nth index in arrays of given type (n numbering from 1).
Does not examine memory. Throws an error if N is invalid or TYPE
diff --git a/gdb/ada-tasks.c b/gdb/ada-tasks.c
index a3a28063daa..a5bbf3aff7d 100644
--- a/gdb/ada-tasks.c
+++ b/gdb/ada-tasks.c
@@ -64,75 +64,70 @@ enum task_states
};
/* A short description corresponding to each possible task state. */
-static const char * const task_states[] = {
- N_("Unactivated"),
- N_("Runnable"),
- N_("Terminated"),
- N_("Child Activation Wait"),
- N_("Accept or Select Term"),
- N_("Waiting on entry call"),
- N_("Async Select Wait"),
- N_("Delay Sleep"),
- N_("Child Termination Wait"),
- N_("Wait Child in Term Alt"),
- "",
- "",
- "",
- "",
- N_("Asynchronous Hold"),
- "",
- N_("Activating"),
- N_("Selective Wait")
-};
+static const char *const task_states[] = { N_ ("Unactivated"),
+ N_ ("Runnable"),
+ N_ ("Terminated"),
+ N_ ("Child Activation Wait"),
+ N_ ("Accept or Select Term"),
+ N_ ("Waiting on entry call"),
+ N_ ("Async Select Wait"),
+ N_ ("Delay Sleep"),
+ N_ ("Child Termination Wait"),
+ N_ ("Wait Child in Term Alt"),
+ "",
+ "",
+ "",
+ "",
+ N_ ("Asynchronous Hold"),
+ "",
+ N_ ("Activating"),
+ N_ ("Selective Wait") };
/* Return a string representing the task state. */
static const char *
get_state (unsigned value)
{
- if (value >= 0
- && value <= ARRAY_SIZE (task_states)
+ if (value >= 0 && value <= ARRAY_SIZE (task_states)
&& task_states[value][0] != '\0')
- return _(task_states[value]);
+ return _ (task_states[value]);
static char buffer[100];
- xsnprintf (buffer, sizeof (buffer), _("Unknown task state: %d"), value);
+ xsnprintf (buffer, sizeof (buffer), _ ("Unknown task state: %d"), value);
return buffer;
}
/* A longer description corresponding to each possible task state. */
-static const char * const long_task_states[] = {
- N_("Unactivated"),
- N_("Runnable"),
- N_("Terminated"),
- N_("Waiting for child activation"),
- N_("Blocked in accept or select with terminate"),
- N_("Waiting on entry call"),
- N_("Asynchronous Selective Wait"),
- N_("Delay Sleep"),
- N_("Waiting for children termination"),
- N_("Waiting for children in terminate alternative"),
- "",
- "",
- "",
- "",
- N_("Asynchronous Hold"),
- "",
- N_("Activating"),
- N_("Blocked in selective wait statement")
-};
+static const char *const long_task_states[]
+ = { N_ ("Unactivated"),
+ N_ ("Runnable"),
+ N_ ("Terminated"),
+ N_ ("Waiting for child activation"),
+ N_ ("Blocked in accept or select with terminate"),
+ N_ ("Waiting on entry call"),
+ N_ ("Asynchronous Selective Wait"),
+ N_ ("Delay Sleep"),
+ N_ ("Waiting for children termination"),
+ N_ ("Waiting for children in terminate alternative"),
+ "",
+ "",
+ "",
+ "",
+ N_ ("Asynchronous Hold"),
+ "",
+ N_ ("Activating"),
+ N_ ("Blocked in selective wait statement") };
/* Return a string representing the task state. This uses the long
descriptions. */
static const char *
get_long_state (unsigned value)
{
- if (value >= 0
- && value <= ARRAY_SIZE (long_task_states)
+ if (value >= 0 && value <= ARRAY_SIZE (long_task_states)
&& long_task_states[value][0] != '\0')
- return _(long_task_states[value]);
+ return _ (long_task_states[value]);
static char buffer[100];
- xsnprintf (buffer, sizeof (buffer), _("Unknown task state: %d"), value);
+ xsnprintf (buffer, sizeof (buffer), _ ("Unknown task state: %d"), value);
return buffer;
}
@@ -151,7 +146,7 @@ struct atcb_fieldnos
int parent;
int priority;
int image;
- int image_len; /* This field may be missing. */
+ int image_len; /* This field may be missing. */
int activation_link;
int call;
int ll;
@@ -159,7 +154,7 @@ struct atcb_fieldnos
/* Fields in Task_Primitives.Private_Data. */
int ll_thread;
- int ll_lwp; /* This field may be missing. */
+ int ll_lwp; /* This field may be missing. */
/* Fields in Common_ATCB.Call.all. */
int call_self;
@@ -187,7 +182,9 @@ struct ada_tasks_pspace_data
struct type *atcb_call_type = nullptr;
/* The index of various fields in the ATCB record and sub-records. */
- struct atcb_fieldnos atcb_fieldno {};
+ struct atcb_fieldnos atcb_fieldno
+ {
+ };
/* On some systems, gdbserver applies an offset to the CPU that is
reported. */
@@ -343,12 +340,12 @@ ada_get_task_number (thread_info *thread)
if (data->task_list[i].ptid == thread->ptid)
return i + 1;
- return 0; /* No matching task found. */
+ return 0; /* No matching task found. */
}
/* Return the task number of the task running in inferior INF which
matches TASK_ID , or zero if the task could not be found. */
-
+
static int
get_task_number_from_id (CORE_ADDR task_id, struct inferior *inf)
{
@@ -467,7 +464,7 @@ read_fat_string_value (char *dest, struct value *val, int max_len)
if (bounds_type->code () == TYPE_CODE_PTR)
bounds_type = bounds_type->target_type ();
if (bounds_type->code () != TYPE_CODE_STRUCT)
- error (_("Unknown task name format. Aborting"));
+ error (_ ("Unknown task name format. Aborting"));
upper_bound_fieldno = ada_get_field_index (bounds_type, "UB0", 0);
initialize_fieldnos = 0;
@@ -519,29 +516,33 @@ ada_get_tcb_types_info (void)
are only interested in one instance, use standard (literal,
C-like) lookups to get the first match. */
- struct symbol *atcb_sym =
- lookup_symbol_in_language (atcb_name, NULL, STRUCT_DOMAIN,
- language_c, NULL).symbol;
- const struct symbol *common_atcb_sym =
- lookup_symbol_in_language (common_atcb_name, NULL, STRUCT_DOMAIN,
- language_c, NULL).symbol;
- const struct symbol *private_data_sym =
- lookup_symbol_in_language (private_data_name, NULL, STRUCT_DOMAIN,
- language_c, NULL).symbol;
- const struct symbol *entry_call_record_sym =
- lookup_symbol_in_language (entry_call_record_name, NULL, STRUCT_DOMAIN,
- language_c, NULL).symbol;
+ struct symbol *atcb_sym
+ = lookup_symbol_in_language (atcb_name, NULL, STRUCT_DOMAIN, language_c,
+ NULL)
+ .symbol;
+ const struct symbol *common_atcb_sym
+ = lookup_symbol_in_language (common_atcb_name, NULL, STRUCT_DOMAIN,
+ language_c, NULL)
+ .symbol;
+ const struct symbol *private_data_sym
+ = lookup_symbol_in_language (private_data_name, NULL, STRUCT_DOMAIN,
+ language_c, NULL)
+ .symbol;
+ const struct symbol *entry_call_record_sym
+ = lookup_symbol_in_language (entry_call_record_name, NULL, STRUCT_DOMAIN,
+ language_c, NULL)
+ .symbol;
if (atcb_sym == NULL || atcb_sym->type () == NULL)
{
/* In Ravenscar run-time libs, the ATCB does not have a dynamic
size, so the symbol name differs. */
atcb_sym = lookup_symbol_in_language (atcb_name_fixed, NULL,
- STRUCT_DOMAIN, language_c,
- NULL).symbol;
+ STRUCT_DOMAIN, language_c, NULL)
+ .symbol;
if (atcb_sym == NULL || atcb_sym->type () == NULL)
- return _("Cannot find Ada_Task_Control_Block type");
+ return _ ("Cannot find Ada_Task_Control_Block type");
type = atcb_sym->type ();
}
@@ -554,11 +555,11 @@ ada_get_tcb_types_info (void)
}
if (common_atcb_sym == NULL || common_atcb_sym->type () == NULL)
- return _("Cannot find Common_ATCB type");
- if (private_data_sym == NULL || private_data_sym->type ()== NULL)
- return _("Cannot find Private_Data type");
+ return _ ("Cannot find Common_ATCB type");
+ if (private_data_sym == NULL || private_data_sym->type () == NULL)
+ return _ ("Cannot find Private_Data type");
if (entry_call_record_sym == NULL || entry_call_record_sym->type () == NULL)
- return _("Cannot find Entry_Call_Record type");
+ return _ ("Cannot find Entry_Call_Record type");
/* Get the type for Ada_Task_Control_Block.Common. */
common_type = common_atcb_sym->type ();
@@ -572,15 +573,15 @@ ada_get_tcb_types_info (void)
/* Get the field indices. */
fieldnos.common = ada_get_field_index (type, "common", 0);
fieldnos.entry_calls = ada_get_field_index (type, "entry_calls", 1);
- fieldnos.atc_nesting_level =
- ada_get_field_index (type, "atc_nesting_level", 1);
+ fieldnos.atc_nesting_level
+ = ada_get_field_index (type, "atc_nesting_level", 1);
fieldnos.state = ada_get_field_index (common_type, "state", 0);
fieldnos.parent = ada_get_field_index (common_type, "parent", 1);
fieldnos.priority = ada_get_field_index (common_type, "base_priority", 0);
fieldnos.image = ada_get_field_index (common_type, "task_image", 1);
fieldnos.image_len = ada_get_field_index (common_type, "task_image_len", 1);
- fieldnos.activation_link = ada_get_field_index (common_type,
- "activation_link", 1);
+ fieldnos.activation_link
+ = ada_get_field_index (common_type, "activation_link", 1);
fieldnos.call = ada_get_field_index (common_type, "call", 1);
fieldnos.ll = ada_get_field_index (common_type, "ll", 0);
fieldnos.base_cpu = ada_get_field_index (common_type, "base_cpu", 0);
@@ -675,11 +676,11 @@ read_atcb (CORE_ADDR task_id, struct ada_task_info *task_info)
const char *err_msg = ada_get_tcb_types_info ();
if (err_msg != NULL)
- error (_("%s. Aborting"), err_msg);
+ error (_ ("%s. Aborting"), err_msg);
}
- tcb_value = value_from_contents_and_address (pspace_data->atcb_type,
- NULL, task_id);
+ tcb_value
+ = value_from_contents_and_address (pspace_data->atcb_type, NULL, task_id);
common_value = value_field (tcb_value, pspace_data->atcb_fieldno.common);
/* Fill in the task_id. */
@@ -738,9 +739,9 @@ read_atcb (CORE_ADDR task_id, struct ada_task_info *task_info)
}
else
{
- int len = value_as_long
- (value_field (common_value,
- pspace_data->atcb_fieldno.image_len));
+ int len
+ = value_as_long (value_field (common_value,
+ pspace_data->atcb_fieldno.image_len));
value_as_string (task_info->name,
value_field (common_value,
@@ -750,20 +751,20 @@ read_atcb (CORE_ADDR task_id, struct ada_task_info *task_info)
/* Compute the task state and priority. */
- task_info->state =
- value_as_long (value_field (common_value,
- pspace_data->atcb_fieldno.state));
- task_info->priority =
- value_as_long (value_field (common_value,
- pspace_data->atcb_fieldno.priority));
+ task_info->state
+ = value_as_long (value_field (common_value,
+ pspace_data->atcb_fieldno.state));
+ task_info->priority
+ = value_as_long (value_field (common_value,
+ pspace_data->atcb_fieldno.priority));
/* If the ATCB contains some information about the parent task,
then compute it as well. Otherwise, zero. */
if (pspace_data->atcb_fieldno.parent >= 0)
- task_info->parent =
- value_as_address (value_field (common_value,
- pspace_data->atcb_fieldno.parent));
+ task_info->parent
+ = value_as_address (value_field (common_value,
+ pspace_data->atcb_fieldno.parent));
/* If the task is in an entry call waiting for another task,
then determine which task it is. */
@@ -775,20 +776,19 @@ read_atcb (CORE_ADDR task_id, struct ada_task_info *task_info)
/* Let My_ATCB be the Ada task control block of a task calling the
entry of another task; then the Task_Id of the called task is
in My_ATCB.Entry_Calls (My_ATCB.ATC_Nesting_Level).Called_Task. */
- atc_nesting_level_value =
- value_field (tcb_value, pspace_data->atcb_fieldno.atc_nesting_level);
- entry_calls_value =
- ada_coerce_to_simple_array_ptr
- (value_field (tcb_value, pspace_data->atcb_fieldno.entry_calls));
- entry_calls_value_element =
- value_subscript (entry_calls_value,
- value_as_long (atc_nesting_level_value));
- called_task_fieldno =
- ada_get_field_index (value_type (entry_calls_value_element),
- "called_task", 0);
- task_info->called_task =
- value_as_address (value_field (entry_calls_value_element,
- called_task_fieldno));
+ atc_nesting_level_value
+ = value_field (tcb_value, pspace_data->atcb_fieldno.atc_nesting_level);
+ entry_calls_value = ada_coerce_to_simple_array_ptr (
+ value_field (tcb_value, pspace_data->atcb_fieldno.entry_calls));
+ entry_calls_value_element
+ = value_subscript (entry_calls_value,
+ value_as_long (atc_nesting_level_value));
+ called_task_fieldno
+ = ada_get_field_index (value_type (entry_calls_value_element),
+ "called_task", 0);
+ task_info->called_task
+ = value_as_address (value_field (entry_calls_value_element,
+ called_task_fieldno));
}
/* If the ATCB contains some information about RV callers, then
@@ -798,26 +798,25 @@ read_atcb (CORE_ADDR task_id, struct ada_task_info *task_info)
{
/* Get the ID of the caller task from Common_ATCB.Call.all.Self.
If Common_ATCB.Call is null, then there is no caller. */
- const CORE_ADDR call =
- value_as_address (value_field (common_value,
- pspace_data->atcb_fieldno.call));
+ const CORE_ADDR call
+ = value_as_address (value_field (common_value,
+ pspace_data->atcb_fieldno.call));
struct value *call_val;
if (call != 0)
{
- call_val =
- value_from_contents_and_address (pspace_data->atcb_call_type,
- NULL, call);
- task_info->caller_task =
- value_as_address
- (value_field (call_val, pspace_data->atcb_fieldno.call_self));
+ call_val
+ = value_from_contents_and_address (pspace_data->atcb_call_type,
+ NULL, call);
+ task_info->caller_task = value_as_address (
+ value_field (call_val, pspace_data->atcb_fieldno.call_self));
}
}
task_info->base_cpu
= (pspace_data->cpu_id_offset
- + value_as_long (value_field (common_value,
- pspace_data->atcb_fieldno.base_cpu)));
+ + value_as_long (value_field (common_value,
+ pspace_data->atcb_fieldno.base_cpu)));
/* And finally, compute the task ptid. Note that there is not point
in computing it if the task is no longer alive, in which case
@@ -857,9 +856,9 @@ read_known_tasks_array (struct ada_tasks_inferior_data *data)
read_memory (data->known_tasks_addr, known_tasks, known_tasks_size);
for (i = 0; i < data->known_tasks_length; i++)
{
- CORE_ADDR task_id =
- extract_typed_address (known_tasks + i * target_ptr_byte,
- data->known_tasks_element);
+ CORE_ADDR task_id
+ = extract_typed_address (known_tasks + i * target_ptr_byte,
+ data->known_tasks_element);
if (task_id != 0)
add_ada_task (task_id, current_inferior ());
@@ -898,9 +897,8 @@ read_known_tasks_list (struct ada_tasks_inferior_data *data)
tcb_value = value_from_contents_and_address (pspace_data->atcb_type,
NULL, task_id);
common_value = value_field (tcb_value, pspace_data->atcb_fieldno.common);
- task_id = value_as_address
- (value_field (common_value,
- pspace_data->atcb_fieldno.activation_link));
+ task_id = value_as_address (
+ value_field (common_value, pspace_data->atcb_fieldno.activation_link));
}
return true;
@@ -929,7 +927,8 @@ ada_tasks_inferior_data_sniffer (struct ada_tasks_inferior_data *data)
/* Try to get pointer type and array length from the symtab. */
sym = lookup_symbol_in_language (KNOWN_TASKS_NAME, NULL, VAR_DOMAIN,
- language_c, NULL).symbol;
+ language_c, NULL)
+ .symbol;
if (sym != NULL)
{
/* Validate. */
@@ -939,17 +938,16 @@ ada_tasks_inferior_data_sniffer (struct ada_tasks_inferior_data *data)
if (type->code () == TYPE_CODE_ARRAY)
eltype = check_typedef (type->target_type ());
- if (eltype != NULL
- && eltype->code () == TYPE_CODE_PTR)
+ if (eltype != NULL && eltype->code () == TYPE_CODE_PTR)
idxtype = check_typedef (type->index_type ());
if (idxtype != NULL
&& idxtype->bounds ()->low.kind () != PROP_UNDEFINED
&& idxtype->bounds ()->high.kind () != PROP_UNDEFINED)
{
data->known_tasks_element = eltype;
- data->known_tasks_length =
- (idxtype->bounds ()->high.const_val ()
- - idxtype->bounds ()->low.const_val () + 1);
+ data->known_tasks_length
+ = (idxtype->bounds ()->high.const_val ()
+ - idxtype->bounds ()->low.const_val () + 1);
return;
}
}
@@ -958,13 +956,12 @@ ada_tasks_inferior_data_sniffer (struct ada_tasks_inferior_data *data)
in some distributions), but it is likely that the executable still
contains debug information on the task type (due to implicit with of
Ada.Tasking). */
- data->known_tasks_element =
- builtin_type (target_gdbarch ())->builtin_data_ptr;
+ data->known_tasks_element
+ = builtin_type (target_gdbarch ())->builtin_data_ptr;
data->known_tasks_length = MAX_NUMBER_OF_KNOWN_TASKS;
return;
}
-
/* Try list. */
msym = lookup_minimal_symbol (KNOWN_TASKS_LIST, NULL, NULL);
@@ -975,7 +972,8 @@ ada_tasks_inferior_data_sniffer (struct ada_tasks_inferior_data *data)
data->known_tasks_length = 1;
sym = lookup_symbol_in_language (KNOWN_TASKS_LIST, NULL, VAR_DOMAIN,
- language_c, NULL).symbol;
+ language_c, NULL)
+ .symbol;
if (sym != NULL && sym->value_address () != 0)
{
/* Validate. */
@@ -989,8 +987,8 @@ ada_tasks_inferior_data_sniffer (struct ada_tasks_inferior_data *data)
}
/* Fallback to default values. */
- data->known_tasks_element =
- builtin_type (target_gdbarch ())->builtin_data_ptr;
+ data->known_tasks_element
+ = builtin_type (target_gdbarch ())->builtin_data_ptr;
data->known_tasks_length = 1;
return;
}
@@ -1007,8 +1005,8 @@ ada_tasks_inferior_data_sniffer (struct ada_tasks_inferior_data *data)
static void
read_known_tasks ()
{
- struct ada_tasks_inferior_data *data =
- get_ada_tasks_inferior_data (current_inferior ());
+ struct ada_tasks_inferior_data *data
+ = get_ada_tasks_inferior_data (current_inferior ());
/* Step 1: Clear the current list, if necessary. */
data->task_list.clear ();
@@ -1047,7 +1045,7 @@ ada_build_task_list ()
struct ada_tasks_inferior_data *data;
if (!target_has_stack ())
- error (_("Cannot inspect Ada tasks when program is not running"));
+ error (_ ("Cannot inspect Ada tasks when program is not running"));
data = get_ada_tasks_inferior_data (current_inferior ());
if (!data->task_list_valid_p)
@@ -1062,8 +1060,7 @@ ada_build_task_list ()
that task only. */
void
-print_ada_task_info (struct ui_out *uiout,
- const char *arg_str,
+print_ada_task_info (struct ui_out *uiout, const char *arg_str,
struct inferior *inf)
{
struct ada_tasks_inferior_data *data;
@@ -1073,7 +1070,7 @@ print_ada_task_info (struct ui_out *uiout,
if (ada_build_task_list () == 0)
{
- uiout->message (_("Your application does not use any Ada tasks.\n"));
+ uiout->message (_ ("Your application does not use any Ada tasks.\n"));
return;
}
@@ -1122,9 +1119,9 @@ print_ada_task_info (struct ui_out *uiout,
gdb_assert (task_info != NULL);
- tid_width = std::max (tid_width,
- 1 + strlen (phex_nz (task_info->task_id,
- sizeof (CORE_ADDR))));
+ tid_width = std::max (
+ tid_width,
+ 1 + strlen (phex_nz (task_info->task_id, sizeof (CORE_ADDR))));
}
}
uiout->table_header (tid_width, ui_right, "task-id", "TID");
@@ -1145,8 +1142,8 @@ print_ada_task_info (struct ui_out *uiout,
for (taskno = 1; taskno <= data->task_list.size (); taskno++)
{
- const struct ada_task_info *const task_info =
- &data->task_list[taskno - 1];
+ const struct ada_task_info *const task_info
+ = &data->task_list[taskno - 1];
int parent_id;
gdb_assert (task_info != NULL);
@@ -1170,15 +1167,15 @@ print_ada_task_info (struct ui_out *uiout,
uiout->field_signed ("id", taskno);
/* Print the Task ID. */
- uiout->field_string ("task-id", phex_nz (task_info->task_id,
- sizeof (CORE_ADDR)));
+ uiout->field_string ("task-id",
+ phex_nz (task_info->task_id, sizeof (CORE_ADDR)));
/* Print the associated Thread ID. */
if (uiout->is_mi_like_p ())
{
thread_info *thread = (ada_task_is_alive (task_info)
- ? find_thread_ptid (inf, task_info->ptid)
- : nullptr);
+ ? find_thread_ptid (inf, task_info->ptid)
+ : nullptr);
if (thread != NULL)
uiout->field_signed ("thread-id", thread->global_num);
@@ -1201,13 +1198,11 @@ print_ada_task_info (struct ui_out *uiout,
/* Print the task current state. */
if (task_info->caller_task)
- uiout->field_fmt ("state",
- _("Accepting RV with %-4d"),
+ uiout->field_fmt ("state", _ ("Accepting RV with %-4d"),
get_task_number_from_id (task_info->caller_task,
inf));
else if (task_info->called_task)
- uiout->field_fmt ("state",
- _("Waiting on RV with %-3d"),
+ uiout->field_fmt ("state", _ ("Waiting on RV with %-3d"),
get_task_number_from_id (task_info->called_task,
inf));
else
@@ -1217,13 +1212,11 @@ print_ada_task_info (struct ui_out *uiout,
is not expecting quotes, and in non mi-like no need for quotes
as there is a specific column for the name. */
uiout->field_fmt ("name",
- (task_info->name[0] != '\0'
- ? ui_file_style ()
- : metadata_style.style ()),
+ (task_info->name[0] != '\0' ? ui_file_style ()
+ : metadata_style.style ()),
"%s",
- (task_info->name[0] != '\0'
- ? task_info->name
- : _("<no name>")));
+ (task_info->name[0] != '\0' ? task_info->name
+ : _ ("<no name>")));
uiout->text ("\n");
}
@@ -1242,33 +1235,34 @@ info_task (struct ui_out *uiout, const char *taskno_str, struct inferior *inf)
if (ada_build_task_list () == 0)
{
- uiout->message (_("Your application does not use any Ada tasks.\n"));
+ uiout->message (_ ("Your application does not use any Ada tasks.\n"));
return;
}
if (taskno <= 0 || taskno > data->task_list.size ())
- error (_("Task ID %d not known. Use the \"info tasks\" command to\n"
- "see the IDs of currently known tasks"), taskno);
+ error (_ ("Task ID %d not known. Use the \"info tasks\" command to\n"
+ "see the IDs of currently known tasks"),
+ taskno);
task_info = &data->task_list[taskno - 1];
/* Print the Ada task ID. */
- gdb_printf (_("Ada Task: %s\n"),
+ gdb_printf (_ ("Ada Task: %s\n"),
paddress (target_gdbarch (), task_info->task_id));
/* Print the name of the task. */
if (task_info->name[0] != '\0')
- gdb_printf (_("Name: %s\n"), task_info->name);
+ gdb_printf (_ ("Name: %s\n"), task_info->name);
else
- fprintf_styled (gdb_stdout, metadata_style.style (), _("<no name>\n"));
+ fprintf_styled (gdb_stdout, metadata_style.style (), _ ("<no name>\n"));
/* Print the TID and LWP. */
- gdb_printf (_("Thread: 0x%s\n"), phex_nz (task_info->ptid.tid (),
- sizeof (ULONGEST)));
- gdb_printf (_("LWP: %#lx\n"), task_info->ptid.lwp ());
+ gdb_printf (_ ("Thread: 0x%s\n"),
+ phex_nz (task_info->ptid.tid (), sizeof (ULONGEST)));
+ gdb_printf (_ ("LWP: %#lx\n"), task_info->ptid.lwp ());
/* If set, print the base CPU. */
if (task_info->base_cpu != 0)
- gdb_printf (_("Base CPU: %d\n"), task_info->base_cpu);
+ gdb_printf (_ ("Base CPU: %d\n"), task_info->base_cpu);
/* Print who is the parent (if any). */
if (task_info->parent != 0)
@@ -1277,16 +1271,16 @@ info_task (struct ui_out *uiout, const char *taskno_str, struct inferior *inf)
{
struct ada_task_info *parent = &data->task_list[parent_taskno - 1];
- gdb_printf (_("Parent: %d"), parent_taskno);
+ gdb_printf (_ ("Parent: %d"), parent_taskno);
if (parent->name[0] != '\0')
gdb_printf (" (%s)", parent->name);
gdb_printf ("\n");
}
else
- gdb_printf (_("No parent\n"));
+ gdb_printf (_ ("No parent\n"));
/* Print the base priority. */
- gdb_printf (_("Base Priority: %d\n"), task_info->priority);
+ gdb_printf (_ ("Base Priority: %d\n"), task_info->priority);
/* print the task current state. */
{
@@ -1295,17 +1289,15 @@ info_task (struct ui_out *uiout, const char *taskno_str, struct inferior *inf)
if (task_info->caller_task)
{
target_taskno = get_task_number_from_id (task_info->caller_task, inf);
- gdb_printf (_("State: Accepting rendezvous with %d"),
- target_taskno);
+ gdb_printf (_ ("State: Accepting rendezvous with %d"), target_taskno);
}
else if (task_info->called_task)
{
target_taskno = get_task_number_from_id (task_info->called_task, inf);
- gdb_printf (_("State: Waiting on task %d's entry"),
- target_taskno);
+ gdb_printf (_ ("State: Waiting on task %d's entry"), target_taskno);
}
else
- gdb_printf (_("State: %s"), get_long_state (task_info->state));
+ gdb_printf (_ ("State: %s"), get_long_state (task_info->state));
if (target_taskno)
{
@@ -1345,14 +1337,14 @@ display_current_task_id (void)
const int current_task = ada_get_task_number (inferior_thread ());
if (current_task == 0)
- gdb_printf (_("[Current task is unknown]\n"));
+ gdb_printf (_ ("[Current task is unknown]\n"));
else
{
struct ada_tasks_inferior_data *data
= get_ada_tasks_inferior_data (current_inferior ());
struct ada_task_info *task_info = &data->task_list[current_task - 1];
- gdb_printf (_("[Current task is %s]\n"),
+ gdb_printf (_ ("[Current task is %s]\n"),
task_to_str (current_task, task_info).c_str ());
}
}
@@ -1368,14 +1360,15 @@ task_command_1 (const char *taskno_str, int from_tty, struct inferior *inf)
struct ada_tasks_inferior_data *data = get_ada_tasks_inferior_data (inf);
if (taskno <= 0 || taskno > data->task_list.size ())
- error (_("Task ID %d not known. Use the \"info tasks\" command to\n"
- "see the IDs of currently known tasks"), taskno);
+ error (_ ("Task ID %d not known. Use the \"info tasks\" command to\n"
+ "see the IDs of currently known tasks"),
+ taskno);
task_info = &data->task_list[taskno - 1];
if (!ada_task_is_alive (task_info))
- error (_("Cannot switch to task %s: Task is no longer running"),
+ error (_ ("Cannot switch to task %s: Task is no longer running"),
task_to_str (taskno, task_info).c_str ());
-
+
/* On some platforms, the thread list is not updated until the user
performs a thread-related operation (by using the "info threads"
command, for instance). So this thread list may not be up to date
@@ -1395,20 +1388,19 @@ task_command_1 (const char *taskno_str, int from_tty, struct inferior *inf)
it's nicer for the user to just refuse to perform the task switch. */
thread_info *tp = find_thread_ptid (inf, task_info->ptid);
if (tp == NULL)
- error (_("Unable to compute thread ID for task %s.\n"
- "Cannot switch to this task."),
+ error (_ ("Unable to compute thread ID for task %s.\n"
+ "Cannot switch to this task."),
task_to_str (taskno, task_info).c_str ());
switch_to_thread (tp);
ada_find_printable_frame (get_selected_frame (NULL));
- gdb_printf (_("[Switching to task %s]\n"),
+ gdb_printf (_ ("[Switching to task %s]\n"),
task_to_str (taskno, task_info).c_str ());
print_stack_frame (get_selected_frame (NULL),
frame_relative_level (get_selected_frame (NULL)),
SRC_AND_LOC, 1);
}
-
/* Print the ID of the current task if TASKNO_STR is empty or NULL.
Otherwise, switch to the task indicated by TASKNO_STR. */
@@ -1419,7 +1411,7 @@ task_command (const char *taskno_str, int from_tty)
if (ada_build_task_list () == 0)
{
- uiout->message (_("Your application does not use any Ada tasks.\n"));
+ uiout->message (_ ("Your application does not use any Ada tasks.\n"));
return;
}
@@ -1504,23 +1496,25 @@ ada_tasks_new_objfile_observer (struct objfile *objfile)
/* The qcs command line flags for the "task apply" commands. Keep
this in sync with the "frame apply" commands. */
-using qcs_flag_option_def
- = gdb::option::flag_option_def<qcs_flags>;
+using qcs_flag_option_def = gdb::option::flag_option_def<qcs_flags>;
static const gdb::option::option_def task_qcs_flags_option_defs[] = {
qcs_flag_option_def {
- "q", [] (qcs_flags *opt) { return &opt->quiet; },
- N_("Disables printing the task information."),
+ "q",
+ [] (qcs_flags *opt) { return &opt->quiet; },
+ N_ ("Disables printing the task information."),
},
qcs_flag_option_def {
- "c", [] (qcs_flags *opt) { return &opt->cont; },
- N_("Print any error raised by COMMAND and continue."),
+ "c",
+ [] (qcs_flags *opt) { return &opt->cont; },
+ N_ ("Print any error raised by COMMAND and continue."),
},
qcs_flag_option_def {
- "s", [] (qcs_flags *opt) { return &opt->silent; },
- N_("Silently ignore any errors or empty output produced by COMMAND."),
+ "s",
+ [] (qcs_flags *opt) { return &opt->silent; },
+ N_ ("Silently ignore any errors or empty output produced by COMMAND."),
},
};
@@ -1530,9 +1524,9 @@ static const gdb::option::option_def task_qcs_flags_option_defs[] = {
static inline std::array<gdb::option::option_def_group, 1>
make_task_apply_all_options_def_group (qcs_flags *flags)
{
- return {{
- { {task_qcs_flags_option_defs}, flags },
- }};
+ return { {
+ { { task_qcs_flags_option_defs }, flags },
+ } };
}
/* Create an option_def_group for the "task apply" options, with
@@ -1541,7 +1535,7 @@ make_task_apply_all_options_def_group (qcs_flags *flags)
static inline gdb::option::option_def_group
make_task_apply_options_def_group (qcs_flags *flags)
{
- return {{task_qcs_flags_option_defs}, flags};
+ return { { task_qcs_flags_option_defs }, flags };
}
/* Implementation of 'task apply all'. */
@@ -1552,13 +1546,13 @@ task_apply_all_command (const char *cmd, int from_tty)
qcs_flags flags;
auto group = make_task_apply_all_options_def_group (&flags);
- gdb::option::process_options
- (&cmd, gdb::option::PROCESS_OPTIONS_UNKNOWN_IS_OPERAND, group);
+ gdb::option::process_options (
+ &cmd, gdb::option::PROCESS_OPTIONS_UNKNOWN_IS_OPERAND, group);
validate_flags_qcs ("task apply all", &flags);
if (cmd == nullptr || *cmd == '\0')
- error (_("Please specify a command at the end of 'task apply all'"));
+ error (_ ("Please specify a command at the end of 'task apply all'"));
update_thread_list ();
ada_build_task_list ();
@@ -1579,8 +1573,8 @@ task_apply_all_command (const char *cmd, int from_tty)
thread_info *tp = find_thread_ptid (inf, task.ptid);
if (tp == nullptr)
- warning (_("Unable to compute thread ID for task %s.\n"
- "Cannot switch to this task."),
+ warning (_ ("Unable to compute thread ID for task %s.\n"
+ "Cannot switch to this task."),
task_to_str (i, &task).c_str ());
else
thr_list_cpy.emplace_back (i, thread_info_ref::new_reference (tp));
@@ -1590,8 +1584,8 @@ task_apply_all_command (const char *cmd, int from_tty)
for (const auto &info : thr_list_cpy)
if (switch_to_thread_if_alive (info.second.get ()))
- thread_try_catch_cmd (info.second.get (), info.first, cmd,
- from_tty, flags);
+ thread_try_catch_cmd (info.second.get (), info.first, cmd, from_tty,
+ flags);
}
/* Implementation of 'task apply'. */
@@ -1599,9 +1593,8 @@ task_apply_all_command (const char *cmd, int from_tty)
static void
task_apply_command (const char *tidlist, int from_tty)
{
-
if (tidlist == nullptr || *tidlist == '\0')
- error (_("Please specify a task ID list"));
+ error (_ ("Please specify a task ID list"));
update_thread_list ();
ada_build_task_list ();
@@ -1620,7 +1613,7 @@ task_apply_command (const char *tidlist, int from_tty)
int num = parser.get_number ();
if (num < 1 || num - 1 >= data->task_list.size ())
- warning (_("no Ada Task with number %d"), num);
+ warning (_ ("no Ada Task with number %d"), num);
else
{
ada_task_info &task = data->task_list[num - 1];
@@ -1629,8 +1622,8 @@ task_apply_command (const char *tidlist, int from_tty)
thread_info *tp = find_thread_ptid (inf, task.ptid);
if (tp == nullptr)
- warning (_("Unable to compute thread ID for task %s.\n"
- "Cannot switch to this task."),
+ warning (_ ("Unable to compute thread ID for task %s.\n"
+ "Cannot switch to this task."),
task_to_str (num, &task).c_str ());
else
thr_list_cpy.emplace_back (num,
@@ -1642,23 +1635,24 @@ task_apply_command (const char *tidlist, int from_tty)
const char *cmd = parser.cur_tok ();
auto group = make_task_apply_options_def_group (&flags);
- gdb::option::process_options
- (&cmd, gdb::option::PROCESS_OPTIONS_UNKNOWN_IS_OPERAND, group);
+ gdb::option::process_options (
+ &cmd, gdb::option::PROCESS_OPTIONS_UNKNOWN_IS_OPERAND, group);
validate_flags_qcs ("task apply", &flags);
if (*cmd == '\0')
- error (_("Please specify a command following the task ID list"));
+ error (_ ("Please specify a command following the task ID list"));
scoped_restore_current_thread restore_thread;
for (const auto &info : thr_list_cpy)
if (switch_to_thread_if_alive (info.second.get ()))
- thread_try_catch_cmd (info.second.get (), info.first, cmd,
- from_tty, flags);
+ thread_try_catch_cmd (info.second.get (), info.first, cmd, from_tty,
+ flags);
}
void _initialize_tasks ();
+
void
_initialize_tasks ()
{
@@ -1671,17 +1665,17 @@ _initialize_tasks ()
static struct cmd_list_element *task_cmd_list;
static struct cmd_list_element *task_apply_list;
-
/* Some new commands provided by this module. */
add_info ("tasks", info_tasks_command,
- _("Provide information about all known Ada tasks."));
+ _ ("Provide information about all known Ada tasks."));
add_prefix_cmd ("task", class_run, task_command,
- _("Use this command to switch between Ada tasks.\n\
+ _ ("Use this command to switch between Ada tasks.\n\
Without argument, this command simply prints the current task ID."),
&task_cmd_list, 1, &cmdlist);
-#define TASK_APPLY_OPTION_HELP "\
+#define TASK_APPLY_OPTION_HELP \
+ "\
Prints per-inferior task number followed by COMMAND output.\n\
\n\
By default, an error raised during the execution of COMMAND\n\
@@ -1693,26 +1687,26 @@ Options:\n\
static const auto task_apply_opts
= make_task_apply_options_def_group (nullptr);
- static std::string task_apply_help = gdb::option::build_help (_("\
+ static std::string task_apply_help
+ = gdb::option::build_help (_ ("\
Apply a command to a list of tasks.\n\
Usage: task apply ID... [OPTION]... COMMAND\n\
-ID is a space-separated list of IDs of tasks to apply COMMAND on.\n"
-TASK_APPLY_OPTION_HELP), task_apply_opts);
+ID is a space-separated list of IDs of tasks to apply COMMAND on.\n" TASK_APPLY_OPTION_HELP),
+ task_apply_opts);
- add_prefix_cmd ("apply", class_run,
- task_apply_command,
- task_apply_help.c_str (),
- &task_apply_list, 1,
+ add_prefix_cmd ("apply", class_run, task_apply_command,
+ task_apply_help.c_str (), &task_apply_list, 1,
&task_cmd_list);
static const auto task_apply_all_opts
= make_task_apply_all_options_def_group (nullptr);
- static std::string task_apply_all_help = gdb::option::build_help (_("\
+ static std::string task_apply_all_help
+ = gdb::option::build_help (_ ("\
Apply a command to all tasks in the current inferior.\n\
\n\
-Usage: task apply all [OPTION]... COMMAND\n"
-TASK_APPLY_OPTION_HELP), task_apply_all_opts);
+Usage: task apply all [OPTION]... COMMAND\n" TASK_APPLY_OPTION_HELP),
+ task_apply_all_opts);
add_cmd ("all", class_run, task_apply_all_command,
task_apply_all_help.c_str (), &task_apply_list);
diff --git a/gdb/ada-typeprint.c b/gdb/ada-typeprint.c
index e95034c9285..56e09748706 100644
--- a/gdb/ada-typeprint.c
+++ b/gdb/ada-typeprint.c
@@ -17,7 +17,7 @@
along with this program. If not, see <http://www.gnu.org/licenses/>. */
#include "defs.h"
-#include "bfd.h" /* Binary File Description */
+#include "bfd.h" /* Binary File Description */
#include "gdbtypes.h"
#include "value.h"
#include "c-lang.h"
@@ -27,16 +27,14 @@
#include "ada-lang.h"
#include <ctype.h>
-static int print_selected_record_field_types (struct type *, struct type *,
- int, int,
- struct ui_file *, int, int,
- const struct type_print_options *);
+static int
+print_selected_record_field_types (struct type *, struct type *, int, int,
+ struct ui_file *, int, int,
+ const struct type_print_options *);
static int print_record_field_types (struct type *, struct type *,
struct ui_file *, int, int,
const struct type_print_options *);
-
-
static char *name_buffer;
static int name_buffer_len;
@@ -126,8 +124,7 @@ type_is_full_subrange_of_target_type (struct type *type)
is nonzero. */
static void
-print_range (struct type *type, struct ui_file *stream,
- int bounds_prefered_p)
+print_range (struct type *type, struct ui_file *stream, int bounds_prefered_p)
{
if (!bounds_prefered_p)
{
@@ -179,8 +176,7 @@ print_range (struct type *type, struct ui_file *stream,
}
break;
default:
- gdb_printf (stream, "%.*s",
- ada_name_prefix_len (type->name ()),
+ gdb_printf (stream, "%.*s", ada_name_prefix_len (type->name ()),
type->name ());
break;
}
@@ -361,7 +357,7 @@ print_array_type (struct type *type, struct ui_file *stream, int show,
if (type == NULL)
{
fprintf_styled (stream, metadata_style.style (),
- _("<undecipherable array type>"));
+ _ ("<undecipherable array type>"));
return;
}
@@ -377,7 +373,7 @@ print_array_type (struct type *type, struct ui_file *stream, int show,
bitsize = 0;
if (range_desc_type == NULL)
{
- for (arr_type = type; arr_type->code () == TYPE_CODE_ARRAY; )
+ for (arr_type = type; arr_type->code () == TYPE_CODE_ARRAY;)
{
if (arr_type != type)
gdb_printf (stream, ", ");
@@ -400,14 +396,13 @@ print_array_type (struct type *type, struct ui_file *stream, int show,
int k;
n_indices = range_desc_type->num_fields ();
- for (k = 0, arr_type = type;
- k < n_indices;
+ for (k = 0, arr_type = type; k < n_indices;
k += 1, arr_type = arr_type->target_type ())
{
if (k > 0)
gdb_printf (stream, ", ");
- print_range_type (range_desc_type->field (k).type (),
- stream, 0 /* bounds_prefered_p */);
+ print_range_type (range_desc_type->field (k).type (), stream,
+ 0 /* bounds_prefered_p */);
if (TYPE_FIELD_BITSIZE (arr_type, 0) > 0)
bitsize = TYPE_FIELD_BITSIZE (arr_type, 0);
}
@@ -493,8 +488,8 @@ print_choices (struct type *type, int field_num, struct ui_file *stream,
{
LONGEST L, U;
- if (!ada_scan_number (name, p + 1, &L, &p)
- || name[p] != 'T' || !ada_scan_number (name, p + 1, &U, &p))
+ if (!ada_scan_number (name, p + 1, &L, &p) || name[p] != 'T'
+ || !ada_scan_number (name, p + 1, &U, &p))
goto Huh;
ada_print_scalar (val_type, L, stream);
gdb_printf (stream, " .. ");
@@ -531,14 +526,13 @@ print_variant_clauses (struct type *var_type, struct type *discr_type,
if (print_choices (var_type, i, stream, discr_type))
{
if (print_record_field_types (var_type->field (i).type (),
- outer_type, stream, show, level,
- flags)
+ outer_type, stream, show, level, flags)
<= 0)
gdb_printf (stream, " null;");
}
else
- print_selected_record_field_types (var_type, outer_type, i, i,
- stream, show, level, flags);
+ print_selected_record_field_types (var_type, outer_type, i, i, stream,
+ show, level, flags);
}
}
@@ -596,8 +590,8 @@ print_variant_part (struct type *type, int field_num, struct type *outer_type,
variant = "?";
gdb_printf (stream, "\n%*scase %s is", level + 4, "", variant);
- print_variant_clauses (type, field_num, outer_type, stream, show,
- level + 4, flags);
+ print_variant_clauses (type, field_num, outer_type, stream, show, level + 4,
+ flags);
gdb_printf (stream, "\n%*send case;", level + 4, "");
}
@@ -612,8 +606,8 @@ print_variant_part (struct type *type, int field_num, struct type *outer_type,
static int
print_selected_record_field_types (struct type *type, struct type *outer_type,
- int fld0, int fld1,
- struct ui_file *stream, int show, int level,
+ int fld0, int fld1, struct ui_file *stream,
+ int show, int level,
const struct type_print_options *flags)
{
int i, flds;
@@ -641,8 +635,7 @@ print_selected_record_field_types (struct type *type, struct type *outer_type,
{
flds += 1;
gdb_printf (stream, "\n%*s", level + 4, "");
- ada_print_type (type->field (i).type (),
- type->field (i).name (),
+ ada_print_type (type->field (i).type (), type->field (i).name (),
stream, show - 1, level + 4, flags);
gdb_printf (stream, ";");
}
@@ -651,10 +644,11 @@ print_selected_record_field_types (struct type *type, struct type *outer_type,
return flds;
}
-static void print_record_field_types_dynamic
- (const gdb::array_view<variant_part> &parts,
- int from, int to, struct type *type, struct ui_file *stream,
- int show, int level, const struct type_print_options *flags);
+static void
+print_record_field_types_dynamic (const gdb::array_view<variant_part> &parts,
+ int from, int to, struct type *type,
+ struct ui_file *stream, int show, int level,
+ const struct type_print_options *flags);
/* Print the choices encoded by VARIANT on STREAM. LEVEL is the
indentation level. The type of the discriminant for VARIANT is
@@ -693,9 +687,8 @@ print_choices (struct type *discr_type, const variant &variant,
call. */
static int
-print_variant_part (const variant_part &part,
- struct type *type, struct ui_file *stream,
- int show, int level,
+print_variant_part (const variant_part &part, struct type *type,
+ struct ui_file *stream, int show, int level,
const struct type_print_options *flags)
{
struct type *discr_type = nullptr;
@@ -704,7 +697,8 @@ print_variant_part (const variant_part &part,
name = "?";
else
{
- name = type->field (part.discriminant_index).name ();;
+ name = type->field (part.discriminant_index).name ();
+ ;
discr_type = type->field (part.discriminant_index).type ();
}
@@ -719,8 +713,7 @@ print_variant_part (const variant_part &part,
gdb_printf (stream, " null;");
else
{
- print_record_field_types_dynamic (variant.parts,
- variant.first_field,
+ print_record_field_types_dynamic (variant.parts, variant.first_field,
variant.last_field, type, stream,
show, level + 8, flags);
last_field = variant.last_field;
@@ -739,9 +732,8 @@ print_variant_part (const variant_part &part,
static void
print_record_field_types_dynamic (const gdb::array_view<variant_part> &parts,
- int from, int to,
- struct type *type, struct ui_file *stream,
- int show, int level,
+ int from, int to, struct type *type,
+ struct ui_file *stream, int show, int level,
const struct type_print_options *flags)
{
int field = from;
@@ -753,9 +745,8 @@ print_record_field_types_dynamic (const gdb::array_view<variant_part> &parts,
/* Print any non-varying fields. */
int first_varying = part.variants[0].first_field;
- print_selected_record_field_types (type, type, field,
- first_varying - 1, stream,
- show, level, flags);
+ print_selected_record_field_types (type, type, field, first_varying - 1,
+ stream, show, level, flags);
field = print_variant_part (part, type, stream, show, level, flags);
}
@@ -782,17 +773,16 @@ print_record_field_types (struct type *type, struct type *outer_type,
prop = type->dyn_prop (DYN_PROP_VARIANT_PARTS);
}
gdb_assert (prop->kind () == PROP_VARIANT_PARTS);
- print_record_field_types_dynamic (*prop->variant_parts (),
- 0, type->num_fields (),
- type, stream, show, level, flags);
+ print_record_field_types_dynamic (*prop->variant_parts (), 0,
+ type->num_fields (), type, stream,
+ show, level, flags);
return type->num_fields ();
}
- return print_selected_record_field_types (type, outer_type,
- 0, type->num_fields () - 1,
- stream, show, level, flags);
+ return print_selected_record_field_types (type, outer_type, 0,
+ type->num_fields () - 1, stream,
+ show, level, flags);
}
-
/* Print record type TYPE on STREAM. LEVEL is the recursion (indentation)
level, in case the element type itself has nested structure, and SHOW is
@@ -835,15 +825,15 @@ print_record_type (struct type *type0, struct ui_file *stream, int show,
flds = 0;
if (parent_type != NULL && ada_type_name (parent_type) == NULL)
- flds += print_record_field_types (parent_type, parent_type,
- stream, show, level, flags);
- flds += print_record_field_types (type, type, stream, show, level,
- flags);
+ flds += print_record_field_types (parent_type, parent_type, stream,
+ show, level, flags);
+ flds
+ += print_record_field_types (type, type, stream, show, level, flags);
if (flds > 0)
gdb_printf (stream, "\n%*send record", level, "");
else if (flds < 0)
- gdb_printf (stream, _(" <incomplete type> end record"));
+ gdb_printf (stream, _ (" <incomplete type> end record"));
else
gdb_printf (stream, " null; end record");
}
@@ -866,15 +856,14 @@ print_unchecked_union_type (struct type *type, struct ui_file *stream,
{
gdb_printf (stream, "record (?) is\n%*scase ? is", level + 4, "");
- print_variant_clauses (type, nullptr, type, stream, show, level + 8, flags);
+ print_variant_clauses (type, nullptr, type, stream, show, level + 8,
+ flags);
- gdb_printf (stream, "\n%*send case;\n%*send record",
- level + 4, "", level, "");
+ gdb_printf (stream, "\n%*send case;\n%*send record", level + 4, "",
+ level, "");
}
}
-
-
/* Print function or procedure type TYPE on STREAM. Make it a header
for function or procedure NAME if NAME is not null. */
@@ -907,8 +896,7 @@ print_func_type (struct type *type, struct ui_file *stream, const char *name,
stream->wrap_here (4);
}
gdb_printf (stream, "a%d: ", i + 1);
- ada_print_type (type->field (i).type (), "", stream, -1, 0,
- flags);
+ ada_print_type (type->field (i).type (), "", stream, -1, 0, flags);
}
gdb_printf (stream, ")");
}
@@ -922,7 +910,6 @@ print_func_type (struct type *type, struct ui_file *stream, const char *name,
}
}
-
/* Print a description of a type TYPE0.
Output goes to STREAM (via stdio).
If VARSTRING is a non-NULL, non-empty string, print as an Ada
@@ -961,20 +948,18 @@ ada_print_type (struct type *type0, const char *varstring,
if (type == NULL)
{
if (is_var_decl)
- gdb_printf (stream, "%.*s: ",
- ada_name_prefix_len (varstring), varstring);
+ gdb_printf (stream, "%.*s: ", ada_name_prefix_len (varstring),
+ varstring);
fprintf_styled (stream, metadata_style.style (), "<null type?>");
return;
}
if (is_var_decl && type->code () != TYPE_CODE_FUNC)
- gdb_printf (stream, "%.*s: ",
- ada_name_prefix_len (varstring), varstring);
+ gdb_printf (stream, "%.*s: ", ada_name_prefix_len (varstring), varstring);
if (type_name != NULL && show <= 0 && !ada_is_aligner_type (type))
{
- gdb_printf (stream, "%.*s",
- ada_name_prefix_len (type_name), type_name);
+ gdb_printf (stream, "%.*s", ada_name_prefix_len (type_name), type_name);
return;
}
@@ -999,13 +984,11 @@ ada_print_type (struct type *type0, const char *varstring,
|| (varstring != nullptr
&& strstr (varstring, "___XVL") == nullptr))
gdb_printf (stream, "access ");
- ada_print_type (type->target_type (), "", stream, show, level,
- flags);
+ ada_print_type (type->target_type (), "", stream, show, level, flags);
break;
case TYPE_CODE_REF:
gdb_printf (stream, "<ref> ");
- ada_print_type (type->target_type (), "", stream, show, level,
- flags);
+ ada_print_type (type->target_type (), "", stream, show, level, flags);
break;
case TYPE_CODE_ARRAY:
print_array_type (type, stream, show, level, flags);
@@ -1019,7 +1002,7 @@ ada_print_type (struct type *type0, const char *varstring,
if (!ada_is_range_type_name (name))
fprintf_styled (stream, metadata_style.style (),
- _("<%s-byte integer>"),
+ _ ("<%s-byte integer>"),
pulongest (type->length ()));
else
{
@@ -1036,7 +1019,7 @@ ada_print_type (struct type *type0, const char *varstring,
gdb_printf (stream, ">");
}
else if (ada_is_modular_type (type))
- gdb_printf (stream, "mod %s",
+ gdb_printf (stream, "mod %s",
int_string (ada_modulus (type), 10, 0, 0, 1));
else
{
@@ -1045,8 +1028,7 @@ ada_print_type (struct type *type0, const char *varstring,
}
break;
case TYPE_CODE_FLT:
- fprintf_styled (stream, metadata_style.style (),
- _("<%s-byte float>"),
+ fprintf_styled (stream, metadata_style.style (), _ ("<%s-byte float>"),
pulongest (type->length ()));
break;
case TYPE_CODE_ENUM:
@@ -1059,8 +1041,7 @@ ada_print_type (struct type *type0, const char *varstring,
if (ada_is_array_descriptor_type (type))
print_array_type (type, stream, show, level, flags);
else if (ada_is_bogus_array_descriptor (type))
- gdb_printf (stream,
- _("array (?) of ? (<mal-formed descriptor>)"));
+ gdb_printf (stream, _ ("array (?) of ? (<mal-formed descriptor>)"));
else
print_record_type (type, stream, show, level, flags);
break;
diff --git a/gdb/ada-valprint.c b/gdb/ada-valprint.c
index 10d3b0a41bf..ed9d8a3273e 100644
--- a/gdb/ada-valprint.c
+++ b/gdb/ada-valprint.c
@@ -32,10 +32,8 @@
static int print_field_values (struct value *, struct value *,
struct ui_file *, int,
- const struct value_print_options *,
- int, const struct language_defn *);
-
-
+ const struct value_print_options *, int,
+ const struct language_defn *);
/* Make TYPE unsigned if its range of values includes no negatives. */
static void
@@ -199,8 +197,8 @@ val_print_packed_array_elements (struct type *type, const gdb_byte *valaddr,
if (check_typedef (value_type (v0))->length ()
!= check_typedef (value_type (v1))->length ())
break;
- if (!value_contents_eq (v0, value_embedded_offset (v0),
- v1, value_embedded_offset (v1),
+ if (!value_contents_eq (v0, value_embedded_offset (v0), v1,
+ value_embedded_offset (v1),
check_typedef (value_type (v0))->length ()))
break;
}
@@ -212,10 +210,9 @@ val_print_packed_array_elements (struct type *type, const gdb_byte *valaddr,
opts.deref_ref = false;
common_val_print (v0, stream, recurse + 1, &opts, current_language);
annotate_elt_rep (i - i0);
- gdb_printf (stream, _(" %p[<repeats %u times>%p]"),
+ gdb_printf (stream, _ (" %p[<repeats %u times>%p]"),
metadata_style.style ().ptr (), i - i0, nullptr);
annotate_elt_rep_end ();
-
}
else
{
@@ -237,8 +234,8 @@ val_print_packed_array_elements (struct type *type, const gdb_byte *valaddr,
gdb_printf (stream, ", ");
}
stream->wrap_here (2 + 2 * recurse);
- maybe_print_array_index (index_type, j + low,
- stream, options);
+ maybe_print_array_index (index_type, j + low, stream,
+ options);
}
common_val_print (v0, stream, recurse + 1, &opts,
current_language);
@@ -259,8 +256,8 @@ val_print_packed_array_elements (struct type *type, const gdb_byte *valaddr,
of the character. */
void
-ada_emit_char (int c, struct type *type, struct ui_file *stream,
- int quoter, int type_len)
+ada_emit_char (int c, struct type *type, struct ui_file *stream, int quoter,
+ int type_len)
{
/* If this character fits in the normal ASCII range, and is
a printable character, then print the character as if it was
@@ -293,8 +290,8 @@ char_at (const gdb_byte *string, int i, int type_len,
if (type_len == 1)
return string[i];
else
- return (int) extract_unsigned_integer (string + type_len * i,
- type_len, byte_order);
+ return (int) extract_unsigned_integer (string + type_len * i, type_len,
+ byte_order);
}
/* Print a floating-point value of type TYPE, pointed to in GDB by
@@ -345,8 +342,7 @@ ada_print_floating (const gdb_byte *valaddr, struct type *type,
}
}
- if (pos == std::string::npos
- && s.find ('.') == std::string::npos)
+ if (pos == std::string::npos && s.find ('.') == std::string::npos)
{
pos = s.find ('e');
if (pos == std::string::npos)
@@ -386,7 +382,6 @@ ada_print_scalar (struct type *type, LONGEST val, struct ui_file *stream)
switch (type->code ())
{
-
case TYPE_CODE_ENUM:
len = type->num_fields ();
for (i = 0; i < len; i++)
@@ -438,11 +433,11 @@ ada_print_scalar (struct type *type, LONGEST val, struct ui_file *stream)
case TYPE_CODE_METHODPTR:
case TYPE_CODE_METHOD:
case TYPE_CODE_REF:
- warning (_("internal error: unhandled type in ada_print_scalar"));
+ warning (_ ("internal error: unhandled type in ada_print_scalar"));
break;
default:
- error (_("Invalid type code in symbol table."));
+ error (_ ("Invalid type code in symbol table."));
}
}
@@ -490,7 +485,7 @@ printstr (struct ui_file *stream, struct type *elttype, const gdb_byte *string,
reps = 1;
while (rep1 < length
&& char_at (string, rep1, type_len, byte_order)
- == char_at (string, i, type_len, byte_order))
+ == char_at (string, i, type_len, byte_order))
{
rep1 += 1;
reps += 1;
@@ -504,10 +499,10 @@ printstr (struct ui_file *stream, struct type *elttype, const gdb_byte *string,
in_quotes = 0;
}
gdb_puts ("'", stream);
- ada_emit_char (char_at (string, i, type_len, byte_order),
- elttype, stream, '\'', type_len);
+ ada_emit_char (char_at (string, i, type_len, byte_order), elttype,
+ stream, '\'', type_len);
gdb_puts ("'", stream);
- gdb_printf (stream, _(" %p[<repeats %u times>%p]"),
+ gdb_printf (stream, _ (" %p[<repeats %u times>%p]"),
metadata_style.style ().ptr (), reps, nullptr);
i = rep1 - 1;
things_printed += options->repeat_count_threshold;
@@ -520,8 +515,8 @@ printstr (struct ui_file *stream, struct type *elttype, const gdb_byte *string,
gdb_puts ("\"", stream);
in_quotes = 1;
}
- ada_emit_char (char_at (string, i, type_len, byte_order),
- elttype, stream, '"', type_len);
+ ada_emit_char (char_at (string, i, type_len, byte_order), elttype,
+ stream, '"', type_len);
things_printed += 1;
}
}
@@ -546,11 +541,9 @@ ada_printstr (struct ui_file *stream, struct type *type,
static int
print_variant_part (struct value *value, int field_num,
- struct value *outer_value,
- struct ui_file *stream, int recurse,
- const struct value_print_options *options,
- int comma_needed,
- const struct language_defn *language)
+ struct value *outer_value, struct ui_file *stream,
+ int recurse, const struct value_print_options *options,
+ int comma_needed, const struct language_defn *language)
{
struct type *type = value_type (value);
struct type *var_type = type->field (field_num).type ();
@@ -583,8 +576,7 @@ static int
print_field_values (struct value *value, struct value *outer_value,
struct ui_file *stream, int recurse,
const struct value_print_options *options,
- int comma_needed,
- const struct language_defn *language)
+ int comma_needed, const struct language_defn *language)
{
int i, len;
@@ -598,19 +590,18 @@ print_field_values (struct value *value, struct value *outer_value,
if (ada_is_wrapper_field (type, i))
{
- struct value *field_val = ada_value_primitive_field (value, 0,
- i, type);
- comma_needed =
- print_field_values (field_val, field_val,
- stream, recurse, options,
- comma_needed, language);
+ struct value *field_val
+ = ada_value_primitive_field (value, 0, i, type);
+ comma_needed
+ = print_field_values (field_val, field_val, stream, recurse,
+ options, comma_needed, language);
continue;
}
else if (ada_is_variant_part (type, i))
{
- comma_needed =
- print_variant_part (value, i, outer_value, stream, recurse,
- options, comma_needed, language);
+ comma_needed
+ = print_variant_part (value, i, outer_value, stream, recurse,
+ options, comma_needed, language);
continue;
}
@@ -642,7 +633,7 @@ print_field_values (struct value *value, struct value *outer_value,
order problems. */
if (HAVE_CPLUS_STRUCT (type) && TYPE_FIELD_IGNORE (type, i))
{
- fputs_styled (_("<optimized out or zero length>"),
+ fputs_styled (_ ("<optimized out or zero length>"),
metadata_style.style (), stream);
}
else
@@ -653,11 +644,11 @@ print_field_values (struct value *value, struct value *outer_value,
struct value_print_options opts;
adjust_type_signedness (type->field (i).type ());
- v = ada_value_primitive_packed_val
- (value, nullptr,
- bit_pos / HOST_CHAR_BIT,
- bit_pos % HOST_CHAR_BIT,
- bit_size, type->field (i).type ());
+ v = ada_value_primitive_packed_val (value, nullptr,
+ bit_pos / HOST_CHAR_BIT,
+ bit_pos % HOST_CHAR_BIT,
+ bit_size,
+ type->field (i).type ());
opts = *options;
opts.deref_ref = false;
common_val_print (v, stream, recurse + 1, &opts, language);
@@ -683,8 +674,7 @@ print_field_values (struct value *value, struct value *outer_value,
static void
ada_val_print_string (struct type *type, const gdb_byte *valaddr,
- int offset_aligned,
- struct ui_file *stream, int recurse,
+ int offset_aligned, struct ui_file *stream, int recurse,
const struct value_print_options *options)
{
enum bfd_endian byte_order = type_byte_order (type);
@@ -711,24 +701,23 @@ ada_val_print_string (struct type *type, const gdb_byte *valaddr,
/* Look for a NULL char. */
for (temp_len = 0;
- (temp_len < len
- && temp_len < print_max_chars
- && char_at (valaddr + offset_aligned,
- temp_len, eltlen, byte_order) != 0);
- temp_len += 1);
+ (temp_len < len && temp_len < print_max_chars
+ && char_at (valaddr + offset_aligned, temp_len, eltlen, byte_order)
+ != 0);
+ temp_len += 1)
+ ;
len = temp_len;
}
- printstr (stream, elttype, valaddr + offset_aligned, len, 0,
- eltlen, options);
+ printstr (stream, elttype, valaddr + offset_aligned, len, 0, eltlen,
+ options);
}
/* Implement Ada value_print'ing for the case where TYPE is a
TYPE_CODE_PTR. */
static void
-ada_value_print_ptr (struct value *val,
- struct ui_file *stream, int recurse,
+ada_value_print_ptr (struct value *val, struct ui_file *stream, int recurse,
const struct value_print_options *options)
{
if (!options->format
@@ -778,8 +767,8 @@ ada_value_print_num (struct value *val, struct ui_file *stream, int recurse,
}
else
{
- int format = (options->format ? options->format
- : options->output_format);
+ int format
+ = (options->format ? options->format : options->output_format);
if (format)
{
@@ -857,8 +846,7 @@ ada_val_print_enum (struct value *value, struct ui_file *stream, int recurse,
if (name[0] == '\'')
gdb_printf (stream, "%ld %ps", (long) val,
- styled_string (variable_name_style.style (),
- name));
+ styled_string (variable_name_style.style (), name));
else
fputs_styled (name, variable_name_style.style (), stream);
}
@@ -870,8 +858,7 @@ ada_val_print_enum (struct value *value, struct ui_file *stream, int recurse,
TYPE_CODE_STRUCT or TYPE_CODE_UNION. */
static void
-ada_val_print_struct_union (struct value *value,
- struct ui_file *stream,
+ada_val_print_struct_union (struct value *value, struct ui_file *stream,
int recurse,
const struct value_print_options *options)
{
@@ -883,8 +870,9 @@ ada_val_print_struct_union (struct value *value,
gdb_printf (stream, "(");
- if (print_field_values (value, value, stream, recurse, options,
- 0, language_def (language_ada)) != 0
+ if (print_field_values (value, value, stream, recurse, options, 0,
+ language_def (language_ada))
+ != 0
&& options->prettyformat)
{
gdb_printf (stream, "\n");
@@ -924,8 +912,8 @@ ada_value_print_array (struct value *val, struct ui_file *stream, int recurse,
{
const gdb_byte *valaddr = value_contents_for_printing (val).data ();
int offset_aligned = ada_aligned_value_addr (type, valaddr) - valaddr;
- val_print_packed_array_elements (type, valaddr, offset_aligned,
- stream, recurse, options);
+ val_print_packed_array_elements (type, valaddr, offset_aligned, stream,
+ recurse, options);
}
else
value_print_array_elements (val, stream, recurse, options, 0);
@@ -936,8 +924,8 @@ ada_value_print_array (struct value *val, struct ui_file *stream, int recurse,
a TYPE_CODE_REF. */
static void
-ada_val_print_ref (struct type *type, const gdb_byte *valaddr,
- int offset, int offset_aligned, CORE_ADDR address,
+ada_val_print_ref (struct type *type, const gdb_byte *valaddr, int offset,
+ int offset_aligned, CORE_ADDR address,
struct ui_file *stream, int recurse,
struct value *original_value,
const struct value_print_options *options)
@@ -976,17 +964,16 @@ ada_val_print_ref (struct type *type, const gdb_byte *valaddr,
return;
}
- deref_val
- = ada_value_ind (value_from_pointer (lookup_pointer_type (elttype),
- deref_val_int));
+ deref_val = ada_value_ind (value_from_pointer (lookup_pointer_type (elttype),
+ deref_val_int));
if (ada_is_tagged_type (value_type (deref_val), 1))
deref_val = ada_tag_value_at_base_address (deref_val);
if (value_lazy (deref_val))
value_fetch_lazy (deref_val);
- common_val_print (deref_val, stream, recurse + 1,
- options, language_def (language_ada));
+ common_val_print (deref_val, stream, recurse + 1, options,
+ language_def (language_ada));
}
/* See the comment on ada_value_print. This function differs in that
@@ -1076,8 +1063,7 @@ ada_value_print_inner (struct value *val, struct ui_file *stream, int recurse,
return;
case TYPE_CODE_REF:
- ada_val_print_ref (type, valaddr, 0, 0,
- address, stream, recurse, val,
+ ada_val_print_ref (type, valaddr, 0, 0, address, stream, recurse, val,
options);
break;
}
diff --git a/gdb/ada-varobj.c b/gdb/ada-varobj.c
index 6b92b76f092..5e2b937ab12 100644
--- a/gdb/ada-varobj.c
+++ b/gdb/ada-varobj.c
@@ -90,10 +90,8 @@ ada_varobj_scalar_image (struct type *type, LONGEST val)
corresponding to the field number FIELDNO. */
static void
-ada_varobj_struct_elt (struct value *parent_value,
- struct type *parent_type,
- int fieldno,
- struct value **child_value,
+ada_varobj_struct_elt (struct value *parent_value, struct type *parent_type,
+ int fieldno, struct value **child_value,
struct type **child_type)
{
struct value *value = NULL;
@@ -118,10 +116,8 @@ ada_varobj_struct_elt (struct value *parent_value,
to the dereferenced value. */
static void
-ada_varobj_ind (struct value *parent_value,
- struct type *parent_type,
- struct value **child_value,
- struct type **child_type)
+ada_varobj_ind (struct value *parent_value, struct type *parent_type,
+ struct value **child_value, struct type **child_type)
{
struct value *value = NULL;
struct type *type = NULL;
@@ -167,8 +163,7 @@ ada_varobj_ind (struct value *parent_value,
static void
ada_varobj_simple_array_elt (struct value *parent_value,
- struct type *parent_type,
- int elt_index,
+ struct type *parent_type, int elt_index,
struct value **child_value,
struct type **child_type)
{
@@ -177,8 +172,8 @@ ada_varobj_simple_array_elt (struct value *parent_value,
if (parent_value)
{
- struct value *index_value =
- value_from_longest (parent_type->index_type (), elt_index);
+ struct value *index_value
+ = value_from_longest (parent_type->index_type (), elt_index);
value = ada_value_subscript (parent_value, 1, &index_value);
type = value_type (value);
@@ -199,18 +194,16 @@ ada_varobj_simple_array_elt (struct value *parent_value,
The replacement is performed in place. */
static void
-ada_varobj_adjust_for_child_access (struct value **value,
- struct type **type)
+ada_varobj_adjust_for_child_access (struct value **value, struct type **type)
{
- /* Pointers to struct/union types are special: Instead of having
+ /* Pointers to struct/union types are special: Instead of having
one child (the struct), their children are the components of
the struct/union type. We handle this situation by dereferencing
the (value, type) couple. */
if ((*type)->code () == TYPE_CODE_PTR
&& ((*type)->target_type ()->code () == TYPE_CODE_STRUCT
|| (*type)->target_type ()->code () == TYPE_CODE_UNION)
- && *value != nullptr
- && value_as_address (*value) != 0
+ && *value != nullptr && value_as_address (*value) != 0
&& !ada_is_array_descriptor_type ((*type)->target_type ())
&& !ada_is_constrained_packed_array_type ((*type)->target_type ()))
ada_varobj_ind (*value, *type, value, type);
@@ -235,8 +228,7 @@ ada_varobj_get_array_number_of_children (struct value *parent_value,
{
LONGEST lo, hi;
- if (parent_value == NULL
- && is_dynamic_type (parent_type->index_type ()))
+ if (parent_value == NULL && is_dynamic_type (parent_type->index_type ()))
{
/* This happens when listing the children of an object
which does not exist in memory (Eg: when requesting
@@ -250,7 +242,7 @@ ada_varobj_get_array_number_of_children (struct value *parent_value,
if (!get_array_bounds (parent_type, &lo, &hi))
{
/* Could not get the array bounds. Pretend this is an empty array. */
- warning (_("unable to get bounds of array, assuming null array"));
+ warning (_ ("unable to get bounds of array, assuming null array"));
return 0;
}
@@ -285,8 +277,8 @@ ada_varobj_get_struct_number_of_children (struct value *parent_value,
struct value *elt_value;
struct type *elt_type;
- ada_varobj_struct_elt (parent_value, parent_type, i,
- &elt_value, &elt_type);
+ ada_varobj_struct_elt (parent_value, parent_type, i, &elt_value,
+ &elt_type);
if (ada_is_tagged_type (elt_type, 0))
{
/* We must not use ada_varobj_get_number_of_children
@@ -297,11 +289,13 @@ ada_varobj_get_struct_number_of_children (struct value *parent_value,
real type, which happens to be the parent_type, and
leads to an infinite loop (because the element gets
fixed back into the parent). */
- n_children += ada_varobj_get_struct_number_of_children
- (elt_value, elt_type);
+ n_children
+ += ada_varobj_get_struct_number_of_children (elt_value,
+ elt_type);
}
else
- n_children += ada_varobj_get_number_of_children (elt_value, elt_type);
+ n_children
+ += ada_varobj_get_number_of_children (elt_value, elt_type);
}
else if (ada_is_variant_part (parent_type, i))
{
@@ -360,8 +354,7 @@ ada_varobj_get_number_of_children (struct value *parent_value,
return 1;
if (parent_type->code () == TYPE_CODE_ARRAY)
- return ada_varobj_get_array_number_of_children (parent_value,
- parent_type);
+ return ada_varobj_get_array_number_of_children (parent_value, parent_type);
if (parent_type->code () == TYPE_CODE_STRUCT
|| parent_type->code () == TYPE_CODE_UNION)
@@ -369,8 +362,7 @@ ada_varobj_get_number_of_children (struct value *parent_value,
parent_type);
if (parent_type->code () == TYPE_CODE_PTR)
- return ada_varobj_get_ptr_number_of_children (parent_value,
- parent_type);
+ return ada_varobj_get_ptr_number_of_children (parent_value, parent_type);
/* All other types have no child. */
return 0;
@@ -397,29 +389,21 @@ ada_varobj_get_number_of_children (struct value *parent_value,
PARENT_NAME is the name of the parent, and should never be NULL. */
-static void ada_varobj_describe_child (struct value *parent_value,
- struct type *parent_type,
- const char *parent_name,
- const char *parent_path_expr,
- int child_index,
- std::string *child_name,
- struct value **child_value,
- struct type **child_type,
- std::string *child_path_expr);
+static void ada_varobj_describe_child (
+ struct value *parent_value, struct type *parent_type,
+ const char *parent_name, const char *parent_path_expr, int child_index,
+ std::string *child_name, struct value **child_value,
+ struct type **child_type, std::string *child_path_expr);
/* Same as ada_varobj_describe_child, but limited to struct/union
objects. */
static void
-ada_varobj_describe_struct_child (struct value *parent_value,
- struct type *parent_type,
- const char *parent_name,
- const char *parent_path_expr,
- int child_index,
- std::string *child_name,
- struct value **child_value,
- struct type **child_type,
- std::string *child_path_expr)
+ada_varobj_describe_struct_child (
+ struct value *parent_value, struct type *parent_type,
+ const char *parent_name, const char *parent_path_expr, int child_index,
+ std::string *child_name, struct value **child_value,
+ struct type **child_type, std::string *child_path_expr)
{
int fieldno;
int childno = 0;
@@ -446,12 +430,13 @@ ada_varobj_describe_struct_child (struct value *parent_value,
For tagged types, we must be careful to not call
ada_varobj_get_number_of_children, to prevent our
element from being fixed back into the parent. */
- elt_n_children = ada_varobj_get_struct_number_of_children
- (elt_value, elt_type);
+ elt_n_children
+ = ada_varobj_get_struct_number_of_children (elt_value,
+ elt_type);
}
else
- elt_n_children =
- ada_varobj_get_number_of_children (elt_value, elt_type);
+ elt_n_children
+ = ada_varobj_get_number_of_children (elt_value, elt_type);
/* Is the child we're looking for one of the children
of this wrapper field? */
@@ -463,17 +448,17 @@ ada_varobj_describe_struct_child (struct value *parent_value,
For tagged types, we must be careful to not call
ada_varobj_describe_child, to prevent our element
from being fixed back into the parent. */
- ada_varobj_describe_struct_child
- (elt_value, elt_type, parent_name, parent_path_expr,
- child_index - childno, child_name, child_value,
- child_type, child_path_expr);
+ ada_varobj_describe_struct_child (
+ elt_value, elt_type, parent_name, parent_path_expr,
+ child_index - childno, child_name, child_value, child_type,
+ child_path_expr);
}
else
- ada_varobj_describe_child (elt_value, elt_type,
- parent_name, parent_path_expr,
- child_index - childno,
- child_name, child_value,
- child_type, child_path_expr);
+ ada_varobj_describe_child (elt_value, elt_type, parent_name,
+ parent_path_expr,
+ child_index - childno, child_name,
+ child_value, child_type,
+ child_path_expr);
return;
}
@@ -513,8 +498,8 @@ ada_varobj_describe_struct_child (struct value *parent_value,
child_value, NULL);
if (child_type)
- ada_varobj_struct_elt (parent_value, parent_type, fieldno,
- NULL, child_type);
+ ada_varobj_struct_elt (parent_value, parent_type, fieldno, NULL,
+ child_type);
if (child_path_expr)
{
@@ -525,9 +510,8 @@ ada_varobj_describe_struct_child (struct value *parent_value,
const char *field_name = parent_type->field (fieldno).name ();
int child_name_len = ada_name_prefix_len (field_name);
- *child_path_expr =
- string_printf ("(%s).%.*s", parent_path_expr,
- child_name_len, field_name);
+ *child_path_expr = string_printf ("(%s).%.*s", parent_path_expr,
+ child_name_len, field_name);
}
return;
@@ -550,15 +534,11 @@ ada_varobj_describe_struct_child (struct value *parent_value,
child. */
static void
-ada_varobj_describe_ptr_child (struct value *parent_value,
- struct type *parent_type,
- const char *parent_name,
- const char *parent_path_expr,
- int child_index,
- std::string *child_name,
- struct value **child_value,
- struct type **child_type,
- std::string *child_path_expr)
+ada_varobj_describe_ptr_child (
+ struct value *parent_value, struct type *parent_type,
+ const char *parent_name, const char *parent_path_expr, int child_index,
+ std::string *child_name, struct value **child_value,
+ struct type **child_type, std::string *child_path_expr)
{
if (child_name)
*child_name = string_printf ("%s.all", parent_name);
@@ -580,15 +560,11 @@ ada_varobj_describe_ptr_child (struct value *parent_value,
This is done by ada_varobj_describe_child before calling us. */
static void
-ada_varobj_describe_simple_array_child (struct value *parent_value,
- struct type *parent_type,
- const char *parent_name,
- const char *parent_path_expr,
- int child_index,
- std::string *child_name,
- struct value **child_value,
- struct type **child_type,
- std::string *child_path_expr)
+ada_varobj_describe_simple_array_child (
+ struct value *parent_value, struct type *parent_type,
+ const char *parent_name, const char *parent_path_expr, int child_index,
+ std::string *child_name, struct value **child_value,
+ struct type **child_type, std::string *child_path_expr)
{
struct type *index_type;
int real_index;
@@ -606,8 +582,8 @@ ada_varobj_describe_simple_array_child (struct value *parent_value,
child_value, NULL);
if (child_type)
- ada_varobj_simple_array_elt (parent_value, parent_type, real_index,
- NULL, child_type);
+ ada_varobj_simple_array_elt (parent_value, parent_type, real_index, NULL,
+ child_type);
if (child_path_expr)
{
@@ -648,13 +624,13 @@ ada_varobj_describe_simple_array_child (struct value *parent_value,
}
if (index_type_name != NULL)
- *child_path_expr =
- string_printf ("(%s)(%.*s'(%s))", parent_path_expr,
- ada_name_prefix_len (index_type_name),
- index_type_name, index_img.c_str ());
+ *child_path_expr
+ = string_printf ("(%s)(%.*s'(%s))", parent_path_expr,
+ ada_name_prefix_len (index_type_name),
+ index_type_name, index_img.c_str ());
else
- *child_path_expr =
- string_printf ("(%s)(%s)", parent_path_expr, index_img.c_str ());
+ *child_path_expr
+ = string_printf ("(%s)(%s)", parent_path_expr, index_img.c_str ());
}
}
@@ -662,12 +638,9 @@ ada_varobj_describe_simple_array_child (struct value *parent_value,
static void
ada_varobj_describe_child (struct value *parent_value,
- struct type *parent_type,
- const char *parent_name,
- const char *parent_path_expr,
- int child_index,
- std::string *child_name,
- struct value **child_value,
+ struct type *parent_type, const char *parent_name,
+ const char *parent_path_expr, int child_index,
+ std::string *child_name, struct value **child_value,
struct type **child_type,
std::string *child_path_expr)
{
@@ -691,41 +664,37 @@ ada_varobj_describe_child (struct value *parent_value,
if (ada_is_access_to_unconstrained_array (parent_type))
{
- ada_varobj_describe_ptr_child (parent_value, parent_type,
- parent_name, parent_path_expr,
- child_index, child_name,
- child_value, child_type,
- child_path_expr);
+ ada_varobj_describe_ptr_child (parent_value, parent_type, parent_name,
+ parent_path_expr, child_index, child_name,
+ child_value, child_type, child_path_expr);
return;
}
if (parent_type->code () == TYPE_CODE_ARRAY)
{
- ada_varobj_describe_simple_array_child
- (parent_value, parent_type, parent_name, parent_path_expr,
- child_index, child_name, child_value, child_type,
- child_path_expr);
+ ada_varobj_describe_simple_array_child (parent_value, parent_type,
+ parent_name, parent_path_expr,
+ child_index, child_name,
+ child_value, child_type,
+ child_path_expr);
return;
}
if (parent_type->code () == TYPE_CODE_STRUCT
|| parent_type->code () == TYPE_CODE_UNION)
{
- ada_varobj_describe_struct_child (parent_value, parent_type,
- parent_name, parent_path_expr,
- child_index, child_name,
- child_value, child_type,
+ ada_varobj_describe_struct_child (parent_value, parent_type, parent_name,
+ parent_path_expr, child_index,
+ child_name, child_value, child_type,
child_path_expr);
return;
}
if (parent_type->code () == TYPE_CODE_PTR)
{
- ada_varobj_describe_ptr_child (parent_value, parent_type,
- parent_name, parent_path_expr,
- child_index, child_name,
- child_value, child_type,
- child_path_expr);
+ ada_varobj_describe_ptr_child (parent_value, parent_type, parent_name,
+ parent_path_expr, child_index, child_name,
+ child_value, child_type, child_path_expr);
return;
}
@@ -745,9 +714,8 @@ ada_varobj_get_name_of_child (struct value *parent_value,
{
std::string child_name;
- ada_varobj_describe_child (parent_value, parent_type, parent_name,
- NULL, child_index, &child_name, NULL,
- NULL, NULL);
+ ada_varobj_describe_child (parent_value, parent_type, parent_name, NULL,
+ child_index, &child_name, NULL, NULL, NULL);
return child_name;
}
@@ -766,8 +734,8 @@ ada_varobj_get_path_expr_of_child (struct value *parent_value,
std::string child_path_expr;
ada_varobj_describe_child (parent_value, parent_type, parent_name,
- parent_path_expr, child_index, NULL,
- NULL, NULL, &child_path_expr);
+ parent_path_expr, child_index, NULL, NULL, NULL,
+ &child_path_expr);
return child_path_expr;
}
@@ -782,9 +750,8 @@ ada_varobj_get_value_of_child (struct value *parent_value,
{
struct value *child_value;
- ada_varobj_describe_child (parent_value, parent_type, parent_name,
- NULL, child_index, NULL, &child_value,
- NULL, NULL);
+ ada_varobj_describe_child (parent_value, parent_type, parent_name, NULL,
+ child_index, NULL, &child_value, NULL, NULL);
return child_value;
}
@@ -794,8 +761,7 @@ ada_varobj_get_value_of_child (struct value *parent_value,
static struct type *
ada_varobj_get_type_of_child (struct value *parent_value,
- struct type *parent_type,
- int child_index)
+ struct type *parent_type, int child_index)
{
struct type *child_type;
@@ -831,8 +797,7 @@ ada_varobj_get_value_image (struct value *value,
The result should be deallocated after use using xfree. */
static std::string
-ada_varobj_get_value_of_array_variable (struct value *value,
- struct type *type,
+ada_varobj_get_value_of_array_variable (struct value *value, struct type *type,
struct value_print_options *opts)
{
const int numchild = ada_varobj_get_array_number_of_children (value, type);
@@ -841,8 +806,7 @@ ada_varobj_get_value_of_array_variable (struct value *value,
Otherwise, the only other way to inspect the contents of the string
is by looking at the value of each element, as in any other array,
which is not very convenient... */
- if (value
- && ada_is_string_type (type)
+ if (value && ada_is_string_type (type)
&& (opts->format == 0 || opts->format == 's'))
{
std::string str = ada_varobj_get_value_image (value, opts);
@@ -856,8 +820,7 @@ ada_varobj_get_value_of_array_variable (struct value *value,
the given print options OPTS as our formatting options. */
static std::string
-ada_varobj_get_value_of_variable (struct value *value,
- struct type *type,
+ada_varobj_get_value_of_variable (struct value *value, struct type *type,
struct value_print_options *opts)
{
ada_varobj_decode_var (&value, &type);
@@ -904,11 +867,9 @@ ada_path_expr_of_child (const struct varobj *child)
const struct varobj *parent = child->parent;
const char *parent_path_expr = varobj_get_path_expr (parent);
- return ada_varobj_get_path_expr_of_child (parent->value.get (),
- parent->type,
+ return ada_varobj_get_path_expr_of_child (parent->value.get (), parent->type,
parent->name.c_str (),
- parent_path_expr,
- child->index);
+ parent_path_expr, child->index);
}
static struct value *
@@ -942,8 +903,8 @@ ada_value_of_variable (const struct varobj *var,
static bool
ada_value_is_changeable_p (const struct varobj *var)
{
- struct type *type = (var->value != nullptr
- ? value_type (var->value.get ()) : var->type);
+ struct type *type
+ = (var->value != nullptr ? value_type (var->value.get ()) : var->type);
if (type->code () == TYPE_CODE_REF)
type = type->target_type ();
@@ -996,8 +957,7 @@ ada_value_has_mutated (const struct varobj *var, struct value *new_val,
varobj_restrict_range (var->children, &from, &to);
for (int i = from; i < to; i++)
- if (ada_varobj_get_name_of_child (new_val, new_type,
- var->name.c_str (), i)
+ if (ada_varobj_get_name_of_child (new_val, new_type, var->name.c_str (), i)
!= var->children[i]->name)
return true;
@@ -1006,16 +966,9 @@ ada_value_has_mutated (const struct varobj *var, struct value *new_val,
/* varobj operations for ada. */
-const struct lang_varobj_ops ada_varobj_ops =
-{
- ada_number_of_children,
- ada_name_of_variable,
- ada_name_of_child,
- ada_path_expr_of_child,
- ada_value_of_child,
- ada_type_of_child,
- ada_value_of_variable,
- ada_value_is_changeable_p,
- ada_value_has_mutated,
- varobj_default_is_path_expr_parent
-};
+const struct lang_varobj_ops ada_varobj_ops
+ = { ada_number_of_children, ada_name_of_variable,
+ ada_name_of_child, ada_path_expr_of_child,
+ ada_value_of_child, ada_type_of_child,
+ ada_value_of_variable, ada_value_is_changeable_p,
+ ada_value_has_mutated, varobj_default_is_path_expr_parent };
diff --git a/gdb/addrmap.c b/gdb/addrmap.c
index 33dc7762d91..494590dfae2 100644
--- a/gdb/addrmap.c
+++ b/gdb/addrmap.c
@@ -27,18 +27,15 @@
gdb_static_assert (sizeof (splay_tree_key) >= sizeof (CORE_ADDR *));
gdb_static_assert (sizeof (splay_tree_value) >= sizeof (void *));
-
/* Fixed address maps. */
void
-addrmap_fixed::set_empty (CORE_ADDR start, CORE_ADDR end_inclusive,
- void *obj)
+addrmap_fixed::set_empty (CORE_ADDR start, CORE_ADDR end_inclusive, void *obj)
{
internal_error ("addrmap_fixed_set_empty: "
"fixed addrmaps can't be changed\n");
}
-
void *
addrmap_fixed::do_find (CORE_ADDR addr) const
{
@@ -70,7 +67,6 @@ addrmap_fixed::do_find (CORE_ADDR addr) const
return bottom->value;
}
-
void
addrmap_fixed::relocate (CORE_ADDR offset)
{
@@ -80,7 +76,6 @@ addrmap_fixed::relocate (CORE_ADDR offset)
transitions[i].addr += offset;
}
-
int
addrmap_fixed::do_foreach (addrmap_foreach_fn fn) const
{
@@ -97,8 +92,6 @@ addrmap_fixed::do_foreach (addrmap_foreach_fn fn) const
return 0;
}
-
-
/* Mutable address maps. */
/* Allocate a copy of CORE_ADDR. */
@@ -111,7 +104,6 @@ addrmap_mutable::allocate_key (CORE_ADDR addr)
return (splay_tree_key) key;
}
-
/* Type-correct wrappers for splay tree access. */
splay_tree_node
addrmap_mutable::splay_tree_lookup (CORE_ADDR addr) const
@@ -119,58 +111,48 @@ addrmap_mutable::splay_tree_lookup (CORE_ADDR addr) const
return ::splay_tree_lookup (tree, (splay_tree_key) &addr);
}
-
splay_tree_node
addrmap_mutable::splay_tree_predecessor (CORE_ADDR addr) const
{
return ::splay_tree_predecessor (tree, (splay_tree_key) &addr);
}
-
splay_tree_node
addrmap_mutable::splay_tree_successor (CORE_ADDR addr)
{
return ::splay_tree_successor (tree, (splay_tree_key) &addr);
}
-
void
addrmap_mutable::splay_tree_remove (CORE_ADDR addr)
{
::splay_tree_remove (tree, (splay_tree_key) &addr);
}
-
static CORE_ADDR
addrmap_node_key (splay_tree_node node)
{
- return * (CORE_ADDR *) node->key;
+ return *(CORE_ADDR *) node->key;
}
-
static void *
addrmap_node_value (splay_tree_node node)
{
return (void *) node->value;
}
-
static void
addrmap_node_set_value (splay_tree_node node, void *value)
{
node->value = (splay_tree_value) value;
}
-
void
addrmap_mutable::splay_tree_insert (CORE_ADDR key, void *value)
{
- ::splay_tree_insert (tree,
- allocate_key (key),
- (splay_tree_value) value);
+ ::splay_tree_insert (tree, allocate_key (key), (splay_tree_value) value);
}
-
/* Without changing the mapping of any address, ensure that there is a
tree node at ADDR, even if it would represent a "transition" from
one value to the same value. */
@@ -179,14 +161,13 @@ addrmap_mutable::force_transition (CORE_ADDR addr)
{
splay_tree_node n = splay_tree_lookup (addr);
- if (! n)
+ if (!n)
{
n = splay_tree_predecessor (addr);
splay_tree_insert (addr, n ? addrmap_node_value (n) : NULL);
}
}
-
void
addrmap_mutable::set_empty (CORE_ADDR start, CORE_ADDR end_inclusive,
void *obj)
@@ -216,7 +197,7 @@ addrmap_mutable::set_empty (CORE_ADDR start, CORE_ADDR end_inclusive,
n && addrmap_node_key (n) <= end_inclusive;
n = splay_tree_successor (addrmap_node_key (n)))
{
- if (! addrmap_node_value (n))
+ if (!addrmap_node_value (n))
addrmap_node_set_value (n, obj);
}
@@ -226,8 +207,9 @@ addrmap_mutable::set_empty (CORE_ADDR start, CORE_ADDR end_inclusive,
n = splay_tree_predecessor (start);
prior_value = n ? addrmap_node_value (n) : NULL;
for (n = splay_tree_lookup (start), gdb_assert (n);
- n && (end_inclusive == CORE_ADDR_MAX
- || addrmap_node_key (n) <= end_inclusive + 1);
+ n
+ && (end_inclusive == CORE_ADDR_MAX
+ || addrmap_node_key (n) <= end_inclusive + 1);
n = next)
{
next = splay_tree_successor (addrmap_node_key (n));
@@ -238,7 +220,6 @@ addrmap_mutable::set_empty (CORE_ADDR start, CORE_ADDR end_inclusive,
}
}
-
void *
addrmap_mutable::do_find (CORE_ADDR addr) const
{
@@ -259,52 +240,47 @@ addrmap_mutable::do_find (CORE_ADDR addr) const
return nullptr;
}
-
addrmap_fixed::addrmap_fixed (struct obstack *obstack, addrmap_mutable *mut)
{
size_t transition_count = 0;
/* Count the number of transitions in the tree. */
- mut->foreach ([&] (CORE_ADDR start, void *obj)
- {
- ++transition_count;
- return 0;
- });
+ mut->foreach ([&] (CORE_ADDR start, void *obj) {
+ ++transition_count;
+ return 0;
+ });
/* Include an extra entry for the transition at zero (which fixed
maps have, but mutable maps do not.) */
transition_count++;
num_transitions = 1;
- transitions = XOBNEWVEC (obstack, struct addrmap_transition,
- transition_count);
+ transitions
+ = XOBNEWVEC (obstack, struct addrmap_transition, transition_count);
transitions[0].addr = 0;
transitions[0].value = NULL;
/* Copy all entries from the splay tree to the array, in order
of increasing address. */
- mut->foreach ([&] (CORE_ADDR start, void *obj)
- {
- transitions[num_transitions].addr = start;
- transitions[num_transitions].value = obj;
- ++num_transitions;
- return 0;
- });
+ mut->foreach ([&] (CORE_ADDR start, void *obj) {
+ transitions[num_transitions].addr = start;
+ transitions[num_transitions].value = obj;
+ ++num_transitions;
+ return 0;
+ });
/* We should have filled the array. */
gdb_assert (num_transitions == transition_count);
}
-
void
addrmap_mutable::relocate (CORE_ADDR offset)
{
/* Not needed yet. */
- internal_error (_("addrmap_relocate is not implemented yet "
- "for mutable addrmaps"));
+ internal_error (_ ("addrmap_relocate is not implemented yet "
+ "for mutable addrmaps"));
}
-
/* This is a splay_tree_foreach_fn. */
static int
@@ -315,20 +291,18 @@ addrmap_mutable_foreach_worker (splay_tree_node node, void *data)
return (*fn) (addrmap_node_key (node), addrmap_node_value (node));
}
-
int
addrmap_mutable::do_foreach (addrmap_foreach_fn fn) const
{
return splay_tree_foreach (tree, addrmap_mutable_foreach_worker, &fn);
}
-
/* Compare keys as CORE_ADDR * values. */
static int
splay_compare_CORE_ADDR_ptr (splay_tree_key ak, splay_tree_key bk)
{
- CORE_ADDR a = * (CORE_ADDR *) ak;
- CORE_ADDR b = * (CORE_ADDR *) bk;
+ CORE_ADDR a = *(CORE_ADDR *) ak;
+ CORE_ADDR b = *(CORE_ADDR *) bk;
/* We can't just return a-b here, because of over/underflow. */
if (a < b)
@@ -339,7 +313,6 @@ splay_compare_CORE_ADDR_ptr (splay_tree_key ak, splay_tree_key bk)
return 1;
}
-
static void
xfree_wrapper (splay_tree_key key)
{
@@ -357,7 +330,6 @@ addrmap_mutable::~addrmap_mutable ()
splay_tree_delete (tree);
}
-
/* See addrmap.h. */
void
@@ -368,8 +340,7 @@ addrmap_dump (struct addrmap *map, struct ui_file *outfile, void *payload)
addrmap entry defines the end of the range). */
bool previous_matched = false;
- auto callback = [&] (CORE_ADDR start_addr, const void *obj)
- {
+ auto callback = [&] (CORE_ADDR start_addr, const void *obj) {
QUIT;
bool matches = payload == nullptr || payload == obj;
@@ -380,10 +351,8 @@ addrmap_dump (struct addrmap *map, struct ui_file *outfile, void *payload)
addr_str = "<ends here>";
if (matches || previous_matched)
- gdb_printf (outfile, " %s%s %s\n",
- payload != nullptr ? " " : "",
- core_addr_to_string (start_addr),
- addr_str);
+ gdb_printf (outfile, " %s%s %s\n", payload != nullptr ? " " : "",
+ core_addr_to_string (start_addr), addr_str);
previous_matched = matches;
@@ -394,24 +363,25 @@ addrmap_dump (struct addrmap *map, struct ui_file *outfile, void *payload)
}
#if GDB_SELF_TEST
-namespace selftests {
+namespace selftests
+{
/* Convert P to CORE_ADDR. */
static CORE_ADDR
core_addr (void *p)
{
- return (CORE_ADDR)(uintptr_t)p;
+ return (CORE_ADDR) (uintptr_t) p;
}
/* Check that &ARRAY[LOW]..&ARRAY[HIGH] has VAL in MAP. */
-#define CHECK_ADDRMAP_FIND(MAP, ARRAY, LOW, HIGH, VAL) \
- do \
- { \
- for (unsigned i = LOW; i <= HIGH; ++i) \
- SELF_CHECK (MAP->find (core_addr (&ARRAY[i])) == VAL); \
- } \
+#define CHECK_ADDRMAP_FIND(MAP, ARRAY, LOW, HIGH, VAL) \
+ do \
+ { \
+ for (unsigned i = LOW; i <= HIGH; ++i) \
+ SELF_CHECK (MAP->find (core_addr (&ARRAY[i])) == VAL); \
+ } \
while (0)
/* Entry point for addrmap unit tests. */
@@ -449,18 +419,17 @@ test_addrmap ()
CHECK_ADDRMAP_FIND (map2, array, 13, 19, nullptr);
/* Iterate over both addrmaps. */
- auto callback = [&] (CORE_ADDR start_addr, void *obj)
- {
- if (start_addr == core_addr (nullptr))
- SELF_CHECK (obj == nullptr);
- else if (start_addr == core_addr (&array[10]))
- SELF_CHECK (obj == val1);
- else if (start_addr == core_addr (&array[13]))
- SELF_CHECK (obj == nullptr);
- else
- SELF_CHECK (false);
- return 0;
- };
+ auto callback = [&] (CORE_ADDR start_addr, void *obj) {
+ if (start_addr == core_addr (nullptr))
+ SELF_CHECK (obj == nullptr);
+ else if (start_addr == core_addr (&array[10]))
+ SELF_CHECK (obj == val1);
+ else if (start_addr == core_addr (&array[13]))
+ SELF_CHECK (obj == nullptr);
+ else
+ SELF_CHECK (false);
+ return 0;
+ };
SELF_CHECK (map->foreach (callback) == 0);
SELF_CHECK (map2->foreach (callback) == 0);
@@ -482,6 +451,7 @@ test_addrmap ()
#endif /* GDB_SELF_TEST */
void _initialize_addrmap ();
+
void
_initialize_addrmap ()
{
diff --git a/gdb/addrmap.h b/gdb/addrmap.h
index e00dda6e711..03c866d00f1 100644
--- a/gdb/addrmap.h
+++ b/gdb/addrmap.h
@@ -83,15 +83,13 @@ struct addrmap
semantics than to provide an interface which allows it to be
implemented efficiently, but doesn't reveal too much of the
representation. */
- virtual void set_empty (CORE_ADDR start, CORE_ADDR end_inclusive,
- void *obj) = 0;
+ virtual void set_empty (CORE_ADDR start, CORE_ADDR end_inclusive, void *obj)
+ = 0;
/* Return the object associated with ADDR in MAP. */
- const void *find (CORE_ADDR addr) const
- { return this->do_find (addr); }
+ const void *find (CORE_ADDR addr) const { return this->do_find (addr); }
- void *find (CORE_ADDR addr)
- { return this->do_find (addr); }
+ void *find (CORE_ADDR addr) { return this->do_find (addr); }
/* Relocate all the addresses in MAP by OFFSET. (This can be applied
to either mutable or immutable maps.) */
@@ -102,13 +100,14 @@ struct addrmap
immediately, and the value is returned. Otherwise, this function
returns 0. */
int foreach (addrmap_foreach_const_fn fn) const
- { return this->do_foreach (fn); }
-
- int foreach (addrmap_foreach_fn fn)
- { return this->do_foreach (fn); }
+ {
+ return this->do_foreach (fn);
+ }
+ int foreach (addrmap_foreach_fn fn) { return this->do_foreach (fn); }
private:
+
/* Worker for find, implemented by sub-classes. */
virtual void *do_find (CORE_ADDR addr) const = 0;
@@ -119,8 +118,7 @@ private:
struct addrmap_mutable;
/* Fixed address maps. */
-struct addrmap_fixed : public addrmap,
- public allocate_on_obstack
+struct addrmap_fixed : public addrmap, public allocate_on_obstack
{
public:
@@ -132,6 +130,7 @@ public:
void relocate (CORE_ADDR offset) override;
private:
+
void *do_find (CORE_ADDR addr) const override;
int do_foreach (addrmap_foreach_fn fn) const override;
@@ -170,6 +169,7 @@ public:
void relocate (CORE_ADDR offset) override;
private:
+
void *do_find (CORE_ADDR addr) const override;
int do_foreach (addrmap_foreach_fn fn) const override;
@@ -202,7 +202,6 @@ private:
void splay_tree_insert (CORE_ADDR key, void *value);
};
-
/* Dump the addrmap to OUTFILE. If PAYLOAD is non-NULL, only dump any
components that map to PAYLOAD. (If PAYLOAD is NULL, the entire
map is dumped.) */
diff --git a/gdb/agent.c b/gdb/agent.c
index e2ad3b582fa..b1c46a0a96a 100644
--- a/gdb/agent.c
+++ b/gdb/agent.c
@@ -27,8 +27,7 @@
static const char can_use_agent_on[] = "on";
static const char can_use_agent_off[] = "off";
-static const char * const can_use_agent_enum[] =
-{
+static const char *const can_use_agent_enum[] = {
can_use_agent_on,
can_use_agent_off,
NULL,
@@ -41,8 +40,9 @@ show_can_use_agent (struct ui_file *file, int from_tty,
struct cmd_list_element *c, const char *value)
{
gdb_printf (file,
- _("Debugger's willingness to use agent in inferior "
- "as a helper is %s.\n"), value);
+ _ ("Debugger's willingness to use agent in inferior "
+ "as a helper is %s.\n"),
+ value);
}
static void
@@ -75,23 +75,23 @@ agent_new_objfile (struct objfile *objfile)
}
void _initialize_agent ();
+
void
_initialize_agent ()
{
- gdb::observers::new_objfile.attach (agent_new_objfile,
- "agent");
-
- add_setshow_enum_cmd ("agent", class_run,
- can_use_agent_enum,
- &can_use_agent, _("\
-Set debugger's willingness to use agent as a helper."), _("\
-Show debugger's willingness to use agent as a helper."), _("\
+ gdb::observers::new_objfile.attach (agent_new_objfile, "agent");
+
+ add_setshow_enum_cmd ("agent", class_run, can_use_agent_enum, &can_use_agent,
+ _ ("\
+Set debugger's willingness to use agent as a helper."),
+ _ ("\
+Show debugger's willingness to use agent as a helper."),
+ _ ("\
If on, GDB will delegate some of the debugging operations to the\n\
agent, if the target supports it. This will speed up those\n\
operations that are supported by the agent.\n\
If off, GDB will not use agent, even if such is supported by the\n\
target."),
- set_can_use_agent,
- show_can_use_agent,
- &setlist, &showlist);
+ set_can_use_agent, show_can_use_agent, &setlist,
+ &showlist);
}
diff --git a/gdb/aix-thread.c b/gdb/aix-thread.c
index 1e28b680b50..c73a8679026 100644
--- a/gdb/aix-thread.c
+++ b/gdb/aix-thread.c
@@ -18,7 +18,6 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
-
/* This module uses the libpthdebug.a library provided by AIX 4.3+ for
debugging pthread applications.
@@ -65,24 +64,24 @@ static bool debug_aix_thread;
/* In AIX 5.1, functions use pthdb_tid_t instead of tid_t. */
#ifndef PTHDB_VERSION_3
-#define pthdb_tid_t tid_t
+#define pthdb_tid_t tid_t
#endif
/* Return whether to treat PID as a debuggable thread id. */
-#define PD_TID(ptid) (pd_active && ptid.tid () != 0)
+#define PD_TID(ptid) (pd_active && ptid.tid () != 0)
/* Success and failure values returned by pthdb callbacks. */
-#define PDC_SUCCESS PTHDB_SUCCESS
-#define PDC_FAILURE PTHDB_CALLBACK
+#define PDC_SUCCESS PTHDB_SUCCESS
+#define PDC_FAILURE PTHDB_CALLBACK
/* Private data attached to each element in GDB's thread list. */
struct aix_thread_info : public private_thread_info
{
- pthdb_pthread_t pdtid; /* thread's libpthdebug id */
- pthdb_tid_t tid; /* kernel thread id */
+ pthdb_pthread_t pdtid; /* thread's libpthdebug id */
+ pthdb_tid_t tid; /* kernel thread id */
};
/* Return the aix_thread_info attached to THREAD. */
@@ -95,7 +94,8 @@ get_aix_thread_info (thread_info *thread)
/* Information about a thread of which libpthdebug is aware. */
-struct pd_thread {
+struct pd_thread
+{
pthdb_pthread_t pdtid;
pthread_t pthid;
pthdb_tid_t tid;
@@ -103,17 +103,14 @@ struct pd_thread {
/* This module's target-specific operations, active while pd_able is true. */
-static const target_info aix_thread_target_info = {
- "aix-threads",
- N_("AIX pthread support"),
- N_("AIX pthread support")
-};
+static const target_info aix_thread_target_info
+ = { "aix-threads", N_ ("AIX pthread support"), N_ ("AIX pthread support") };
class aix_thread_target final : public target_ops
{
public:
- const target_info &info () const override
- { return aix_thread_target_info; }
+
+ const target_info &info () const override { return aix_thread_target_info; }
strata stratum () const override { return thread_stratum; }
@@ -125,8 +122,7 @@ public:
void store_registers (struct regcache *, int) override;
enum target_xfer_status xfer_partial (enum target_object object,
- const char *annex,
- gdb_byte *readbuf,
+ const char *annex, gdb_byte *readbuf,
const gdb_byte *writebuf,
ULONGEST offset, ULONGEST len,
ULONGEST *xfered_len) override;
@@ -168,28 +164,19 @@ static int pdc_symbol_addrs (pthdb_user_t, pthdb_symbol_t *, int);
static int pdc_read_data (pthdb_user_t, void *, pthdb_addr_t, size_t);
static int pdc_write_data (pthdb_user_t, void *, pthdb_addr_t, size_t);
static int pdc_read_regs (pthdb_user_t user, pthdb_tid_t tid,
- unsigned long long flags,
- pthdb_context_t *context);
+ unsigned long long flags, pthdb_context_t *context);
static int pdc_write_regs (pthdb_user_t user, pthdb_tid_t tid,
- unsigned long long flags,
- pthdb_context_t *context);
+ unsigned long long flags, pthdb_context_t *context);
static int pdc_alloc (pthdb_user_t, size_t, void **);
static int pdc_realloc (pthdb_user_t, void *, size_t, void **);
static int pdc_dealloc (pthdb_user_t, void *);
/* pthdb callbacks. */
-static pthdb_callbacks_t pd_callbacks = {
- pdc_symbol_addrs,
- pdc_read_data,
- pdc_write_data,
- pdc_read_regs,
- pdc_write_regs,
- pdc_alloc,
- pdc_realloc,
- pdc_dealloc,
- NULL
-};
+static pthdb_callbacks_t pd_callbacks
+ = { pdc_symbol_addrs, pdc_read_data, pdc_write_data,
+ pdc_read_regs, pdc_write_regs, pdc_alloc,
+ pdc_realloc, pdc_dealloc, NULL };
/* Current pthdb session. */
@@ -203,38 +190,70 @@ pd_status2str (int status)
{
switch (status)
{
- case PTHDB_SUCCESS: return "SUCCESS";
- case PTHDB_NOSYS: return "NOSYS";
- case PTHDB_NOTSUP: return "NOTSUP";
- case PTHDB_BAD_VERSION: return "BAD_VERSION";
- case PTHDB_BAD_USER: return "BAD_USER";
- case PTHDB_BAD_SESSION: return "BAD_SESSION";
- case PTHDB_BAD_MODE: return "BAD_MODE";
- case PTHDB_BAD_FLAGS: return "BAD_FLAGS";
- case PTHDB_BAD_CALLBACK: return "BAD_CALLBACK";
- case PTHDB_BAD_POINTER: return "BAD_POINTER";
- case PTHDB_BAD_CMD: return "BAD_CMD";
- case PTHDB_BAD_PTHREAD: return "BAD_PTHREAD";
- case PTHDB_BAD_ATTR: return "BAD_ATTR";
- case PTHDB_BAD_MUTEX: return "BAD_MUTEX";
- case PTHDB_BAD_MUTEXATTR: return "BAD_MUTEXATTR";
- case PTHDB_BAD_COND: return "BAD_COND";
- case PTHDB_BAD_CONDATTR: return "BAD_CONDATTR";
- case PTHDB_BAD_RWLOCK: return "BAD_RWLOCK";
- case PTHDB_BAD_RWLOCKATTR: return "BAD_RWLOCKATTR";
- case PTHDB_BAD_KEY: return "BAD_KEY";
- case PTHDB_BAD_PTID: return "BAD_PTID";
- case PTHDB_BAD_TID: return "BAD_TID";
- case PTHDB_CALLBACK: return "CALLBACK";
- case PTHDB_CONTEXT: return "CONTEXT";
- case PTHDB_HELD: return "HELD";
- case PTHDB_NOT_HELD: return "NOT_HELD";
- case PTHDB_MEMORY: return "MEMORY";
- case PTHDB_NOT_PTHREADED: return "NOT_PTHREADED";
- case PTHDB_SYMBOL: return "SYMBOL";
- case PTHDB_NOT_AVAIL: return "NOT_AVAIL";
- case PTHDB_INTERNAL: return "INTERNAL";
- default: return "UNKNOWN";
+ case PTHDB_SUCCESS:
+ return "SUCCESS";
+ case PTHDB_NOSYS:
+ return "NOSYS";
+ case PTHDB_NOTSUP:
+ return "NOTSUP";
+ case PTHDB_BAD_VERSION:
+ return "BAD_VERSION";
+ case PTHDB_BAD_USER:
+ return "BAD_USER";
+ case PTHDB_BAD_SESSION:
+ return "BAD_SESSION";
+ case PTHDB_BAD_MODE:
+ return "BAD_MODE";
+ case PTHDB_BAD_FLAGS:
+ return "BAD_FLAGS";
+ case PTHDB_BAD_CALLBACK:
+ return "BAD_CALLBACK";
+ case PTHDB_BAD_POINTER:
+ return "BAD_POINTER";
+ case PTHDB_BAD_CMD:
+ return "BAD_CMD";
+ case PTHDB_BAD_PTHREAD:
+ return "BAD_PTHREAD";
+ case PTHDB_BAD_ATTR:
+ return "BAD_ATTR";
+ case PTHDB_BAD_MUTEX:
+ return "BAD_MUTEX";
+ case PTHDB_BAD_MUTEXATTR:
+ return "BAD_MUTEXATTR";
+ case PTHDB_BAD_COND:
+ return "BAD_COND";
+ case PTHDB_BAD_CONDATTR:
+ return "BAD_CONDATTR";
+ case PTHDB_BAD_RWLOCK:
+ return "BAD_RWLOCK";
+ case PTHDB_BAD_RWLOCKATTR:
+ return "BAD_RWLOCKATTR";
+ case PTHDB_BAD_KEY:
+ return "BAD_KEY";
+ case PTHDB_BAD_PTID:
+ return "BAD_PTID";
+ case PTHDB_BAD_TID:
+ return "BAD_TID";
+ case PTHDB_CALLBACK:
+ return "CALLBACK";
+ case PTHDB_CONTEXT:
+ return "CONTEXT";
+ case PTHDB_HELD:
+ return "HELD";
+ case PTHDB_NOT_HELD:
+ return "NOT_HELD";
+ case PTHDB_MEMORY:
+ return "MEMORY";
+ case PTHDB_NOT_PTHREADED:
+ return "NOT_PTHREADED";
+ case PTHDB_SYMBOL:
+ return "SYMBOL";
+ case PTHDB_NOT_AVAIL:
+ return "NOT_AVAIL";
+ case PTHDB_INTERNAL:
+ return "INTERNAL";
+ default:
+ return "UNKNOWN";
}
}
@@ -261,16 +280,15 @@ ptrace_check (int req, int id, int ret)
if (ret == -1 && errno == EPERM)
{
if (debug_aix_thread)
- gdb_printf (gdb_stdlog,
- "ptrace (%d, %d) = %d (errno = %d)\n",
- req, id, ret, errno);
+ gdb_printf (gdb_stdlog, "ptrace (%d, %d) = %d (errno = %d)\n", req,
+ id, ret, errno);
return ret == -1 ? 0 : 1;
}
break;
}
- error (_("aix-thread: ptrace (%d, %d) returned %d (errno = %d %s)"),
- req, id, ret, errno, safe_strerror (errno));
- return 0; /* Not reached. */
+ error (_ ("aix-thread: ptrace (%d, %d) returned %d (errno = %d %s)"), req,
+ id, ret, errno, safe_strerror (errno));
+ return 0; /* Not reached. */
}
/* Call ptracex (REQ, ID, ADDR, DATA, BUF) or
@@ -278,8 +296,8 @@ ptrace_check (int req, int id, int ret)
Return success. */
#ifdef HAVE_PTRACE64
-# define ptracex(request, pid, addr, data, buf) \
- ptrace64 (request, pid, addr, data, buf)
+#define ptracex(request, pid, addr, data, buf) \
+ ptrace64 (request, pid, addr, data, buf)
#endif
static int
@@ -294,19 +312,18 @@ ptrace64aix (int req, int id, long long addr, int data, int *buf)
Return success. */
#ifdef HAVE_PTRACE64
-# define ptrace(request, pid, addr, data, buf) \
- ptrace64 (request, pid, addr, data, buf)
-# define addr_ptr long long
+#define ptrace(request, pid, addr, data, buf) \
+ ptrace64 (request, pid, addr, data, buf)
+#define addr_ptr long long
#else
-# define addr_ptr int *
+#define addr_ptr int *
#endif
static int
ptrace32 (int req, int id, addr_ptr addr, int data, int *buf)
{
errno = 0;
- return ptrace_check (req, id,
- ptrace (req, id, addr, data, buf));
+ return ptrace_check (req, id, ptrace (req, id, addr, data, buf));
}
/* If *PIDP is a composite process/thread id, convert it to a
@@ -326,7 +343,8 @@ pid_to_prc (ptid_t *ptidp)
the address of SYMBOLS[<i>].name. */
static int
-pdc_symbol_addrs (pthdb_user_t user_current_pid, pthdb_symbol_t *symbols, int count)
+pdc_symbol_addrs (pthdb_user_t user_current_pid, pthdb_symbol_t *symbols,
+ int count)
{
struct bound_minimal_symbol ms;
int i;
@@ -334,15 +352,15 @@ pdc_symbol_addrs (pthdb_user_t user_current_pid, pthdb_symbol_t *symbols, int co
if (debug_aix_thread)
gdb_printf (gdb_stdlog,
- "pdc_symbol_addrs (user_current_pid = %ld, symbols = 0x%lx, count = %d)\n",
+ "pdc_symbol_addrs (user_current_pid = %ld, symbols = 0x%lx, "
+ "count = %d)\n",
user_current_pid, (long) symbols, count);
for (i = 0; i < count; i++)
{
name = symbols[i].name;
if (debug_aix_thread)
- gdb_printf (gdb_stdlog,
- " symbols[%d].name = \"%s\"\n", i, name);
+ gdb_printf (gdb_stdlog, " symbols[%d].name = \"%s\"\n", i, name);
if (!*name)
symbols[i].addr = 0;
@@ -358,8 +376,8 @@ pdc_symbol_addrs (pthdb_user_t user_current_pid, pthdb_symbol_t *symbols, int co
symbols[i].addr = ms.value_address ();
}
if (debug_aix_thread)
- gdb_printf (gdb_stdlog, " symbols[%d].addr = %s\n",
- i, hex_string (symbols[i].addr));
+ gdb_printf (gdb_stdlog, " symbols[%d].addr = %s\n", i,
+ hex_string (symbols[i].addr));
}
if (debug_aix_thread)
gdb_printf (gdb_stdlog, " returning PDC_SUCCESS\n");
@@ -373,10 +391,8 @@ pdc_symbol_addrs (pthdb_user_t user_current_pid, pthdb_symbol_t *symbols, int co
If successful return 0, else non-zero is returned. */
static int
-pdc_read_regs (pthdb_user_t user_current_pid,
- pthdb_tid_t tid,
- unsigned long long flags,
- pthdb_context_t *context)
+pdc_read_regs (pthdb_user_t user_current_pid, pthdb_tid_t tid,
+ unsigned long long flags, pthdb_context_t *context)
{
/* This function doesn't appear to be used, so we could probably
just return 0 here. HOWEVER, if it is not defined, the OS will
@@ -389,26 +405,26 @@ pdc_read_regs (pthdb_user_t user_current_pid,
double fprs[ppc_num_fprs];
struct ptxsprs sprs64;
struct ptsprs sprs32;
-
+
if (debug_aix_thread)
- gdb_printf (gdb_stdlog, "pdc_read_regs tid=%d flags=%s\n",
- (int) tid, hex_string (flags));
+ gdb_printf (gdb_stdlog, "pdc_read_regs tid=%d flags=%s\n", (int) tid,
+ hex_string (flags));
/* General-purpose registers. */
if (flags & PTHDB_FLAG_GPRS)
{
if (arch64)
{
- if (!ptrace64aix (PTT_READ_GPRS, tid,
- (unsigned long) gprs64, 0, NULL))
+ if (!ptrace64aix (PTT_READ_GPRS, tid, (unsigned long) gprs64, 0,
+ NULL))
memset (gprs64, 0, sizeof (gprs64));
- memcpy (context->gpr, gprs64, sizeof(gprs64));
+ memcpy (context->gpr, gprs64, sizeof (gprs64));
}
else
{
if (!ptrace32 (PTT_READ_GPRS, tid, (uintptr_t) gprs32, 0, NULL))
memset (gprs32, 0, sizeof (gprs32));
- memcpy (context->gpr, gprs32, sizeof(gprs32));
+ memcpy (context->gpr, gprs32, sizeof (gprs32));
}
}
@@ -417,7 +433,7 @@ pdc_read_regs (pthdb_user_t user_current_pid,
{
if (!ptrace32 (PTT_READ_FPRS, tid, (uintptr_t) fprs, 0, NULL))
memset (fprs, 0, sizeof (fprs));
- memcpy (context->fpr, fprs, sizeof(fprs));
+ memcpy (context->fpr, fprs, sizeof (fprs));
}
/* Special-purpose registers. */
@@ -425,18 +441,18 @@ pdc_read_regs (pthdb_user_t user_current_pid,
{
if (arch64)
{
- if (!ptrace64aix (PTT_READ_SPRS, tid,
- (unsigned long) &sprs64, 0, NULL))
+ if (!ptrace64aix (PTT_READ_SPRS, tid, (unsigned long) &sprs64, 0,
+ NULL))
memset (&sprs64, 0, sizeof (sprs64));
- memcpy (&context->msr, &sprs64, sizeof(sprs64));
+ memcpy (&context->msr, &sprs64, sizeof (sprs64));
}
else
{
if (!ptrace32 (PTT_READ_SPRS, tid, (uintptr_t) &sprs32, 0, NULL))
memset (&sprs32, 0, sizeof (sprs32));
- memcpy (&context->msr, &sprs32, sizeof(sprs32));
+ memcpy (&context->msr, &sprs32, sizeof (sprs32));
}
- }
+ }
return 0;
}
@@ -445,11 +461,9 @@ pdc_read_regs (pthdb_user_t user_current_pid,
If successful return 0, else non-zero is returned. */
static int
-pdc_write_regs (pthdb_user_t user_current_pid,
- pthdb_tid_t tid,
- unsigned long long flags,
- pthdb_context_t *context)
-{
+pdc_write_regs (pthdb_user_t user_current_pid, pthdb_tid_t tid,
+ unsigned long long flags, pthdb_context_t *context)
+{
/* This function doesn't appear to be used, so we could probably
just return 0 here. HOWEVER, if it is not defined, the OS will
complain and several thread debug functions will fail. In case
@@ -457,20 +471,20 @@ pdc_write_regs (pthdb_user_t user_current_pid,
however this code is untested. */
if (debug_aix_thread)
- gdb_printf (gdb_stdlog, "pdc_write_regs tid=%d flags=%s\n",
- (int) tid, hex_string (flags));
+ gdb_printf (gdb_stdlog, "pdc_write_regs tid=%d flags=%s\n", (int) tid,
+ hex_string (flags));
/* General-purpose registers. */
if (flags & PTHDB_FLAG_GPRS)
{
if (arch64)
- ptrace64aix (PTT_WRITE_GPRS, tid,
- (unsigned long) context->gpr, 0, NULL);
+ ptrace64aix (PTT_WRITE_GPRS, tid, (unsigned long) context->gpr, 0,
+ NULL);
else
ptrace32 (PTT_WRITE_GPRS, tid, (uintptr_t) context->gpr, 0, NULL);
}
- /* Floating-point registers. */
+ /* Floating-point registers. */
if (flags & PTHDB_FLAG_FPRS)
{
ptrace32 (PTT_WRITE_FPRS, tid, (uintptr_t) context->fpr, 0, NULL);
@@ -481,8 +495,8 @@ pdc_write_regs (pthdb_user_t user_current_pid,
{
if (arch64)
{
- ptrace64aix (PTT_WRITE_SPRS, tid,
- (unsigned long) &context->msr, 0, NULL);
+ ptrace64aix (PTT_WRITE_SPRS, tid, (unsigned long) &context->msr, 0,
+ NULL);
}
else
{
@@ -495,14 +509,15 @@ pdc_write_regs (pthdb_user_t user_current_pid,
/* pthdb callback: read LEN bytes from process ADDR into BUF. */
static int
-pdc_read_data (pthdb_user_t user_current_pid, void *buf,
- pthdb_addr_t addr, size_t len)
+pdc_read_data (pthdb_user_t user_current_pid, void *buf, pthdb_addr_t addr,
+ size_t len)
{
int status, ret;
if (debug_aix_thread)
gdb_printf (gdb_stdlog,
- "pdc_read_data (user_current_pid = %ld, buf = 0x%lx, addr = %s, len = %ld)\n",
+ "pdc_read_data (user_current_pid = %ld, buf = 0x%lx, addr = "
+ "%s, len = %ld)\n",
user_current_pid, (long) buf, hex_string (addr), len);
/* This is needed to eliminate the dependency of current thread
@@ -521,22 +536,23 @@ pdc_read_data (pthdb_user_t user_current_pid, void *buf,
ret = status == 0 ? PDC_SUCCESS : PDC_FAILURE;
if (debug_aix_thread)
- gdb_printf (gdb_stdlog, " status=%d, returning %s\n",
- status, pd_status2str (ret));
+ gdb_printf (gdb_stdlog, " status=%d, returning %s\n", status,
+ pd_status2str (ret));
return ret;
}
/* pthdb callback: write LEN bytes from BUF to process ADDR. */
static int
-pdc_write_data (pthdb_user_t user_current_pid, void *buf,
- pthdb_addr_t addr, size_t len)
+pdc_write_data (pthdb_user_t user_current_pid, void *buf, pthdb_addr_t addr,
+ size_t len)
{
int status, ret;
if (debug_aix_thread)
gdb_printf (gdb_stdlog,
- "pdc_write_data (user_current_pid = %ld, buf = 0x%lx, addr = %s, len = %ld)\n",
+ "pdc_write_data (user_current_pid = %ld, buf = 0x%lx, addr = "
+ "%s, len = %ld)\n",
user_current_pid, (long) buf, hex_string (addr), len);
status = target_write_memory (addr, (gdb_byte *) buf, len);
@@ -555,13 +571,13 @@ static int
pdc_alloc (pthdb_user_t user_current_pid, size_t len, void **bufp)
{
if (debug_aix_thread)
- gdb_printf (gdb_stdlog,
- "pdc_alloc (user_current_pid = %ld, len = %ld, bufp = 0x%lx)\n",
- user_current_pid, len, (long) bufp);
+ gdb_printf (
+ gdb_stdlog,
+ "pdc_alloc (user_current_pid = %ld, len = %ld, bufp = 0x%lx)\n",
+ user_current_pid, len, (long) bufp);
*bufp = xmalloc (len);
if (debug_aix_thread)
- gdb_printf (gdb_stdlog,
- " malloc returned 0x%lx\n", (long) *bufp);
+ gdb_printf (gdb_stdlog, " malloc returned 0x%lx\n", (long) *bufp);
/* Note: xmalloc() can't return 0; therefore PDC_FAILURE will never
be returned. */
@@ -578,12 +594,12 @@ pdc_realloc (pthdb_user_t user_current_pid, void *buf, size_t len, void **bufp)
{
if (debug_aix_thread)
gdb_printf (gdb_stdlog,
- "pdc_realloc (user_current_pid = %ld, buf = 0x%lx, len = %ld, bufp = 0x%lx)\n",
+ "pdc_realloc (user_current_pid = %ld, buf = 0x%lx, len = %ld, "
+ "bufp = 0x%lx)\n",
user_current_pid, (long) buf, len, (long) bufp);
*bufp = xrealloc (buf, len);
if (debug_aix_thread)
- gdb_printf (gdb_stdlog,
- " realloc returned 0x%lx\n", (long) *bufp);
+ gdb_printf (gdb_stdlog, " realloc returned 0x%lx\n", (long) *bufp);
return *bufp ? PDC_SUCCESS : PDC_FAILURE;
}
@@ -594,9 +610,8 @@ static int
pdc_dealloc (pthdb_user_t user_current_pid, void *buf)
{
if (debug_aix_thread)
- gdb_printf (gdb_stdlog,
- "pdc_free (user_current_pid = %ld, buf = 0x%lx)\n", user_current_pid,
- (long) buf);
+ gdb_printf (gdb_stdlog, "pdc_free (user_current_pid = %ld, buf = 0x%lx)\n",
+ user_current_pid, (long) buf);
xfree (buf);
return PDC_SUCCESS;
}
@@ -610,22 +625,22 @@ state2str (pthdb_state_t state)
{
case PST_IDLE:
/* i18n: Like "Thread-Id %d, [state] idle" */
- return _("idle"); /* being created */
+ return _ ("idle"); /* being created */
case PST_RUN:
/* i18n: Like "Thread-Id %d, [state] running" */
- return _("running"); /* running */
+ return _ ("running"); /* running */
case PST_SLEEP:
/* i18n: Like "Thread-Id %d, [state] sleeping" */
- return _("sleeping"); /* awaiting an event */
+ return _ ("sleeping"); /* awaiting an event */
case PST_READY:
/* i18n: Like "Thread-Id %d, [state] ready" */
- return _("ready"); /* runnable */
+ return _ ("ready"); /* runnable */
case PST_TERM:
/* i18n: Like "Thread-Id %d, [state] finished" */
- return _("finished"); /* awaiting a join/detach */
+ return _ ("finished"); /* awaiting a join/detach */
default:
/* i18n: Like "Thread-Id %d, [state] unknown" */
- return _("unknown");
+ return _ ("unknown");
}
}
@@ -715,8 +730,7 @@ get_signaled_thread (int pid)
while (1)
{
- if (getthrds (pid, &thrinf,
- sizeof (thrinf), &ktid, 1) != 1)
+ if (getthrds (pid, &thrinf, sizeof (thrinf), &ktid, 1) != 1)
break;
if (thrinf.ti_cursig == SIGTRAP)
@@ -770,8 +784,7 @@ sync_threadlists (int pid)
if (pcount == psize)
{
psize *= 2;
- pbuf = (struct pd_thread *) xrealloc (pbuf,
- psize * sizeof *pbuf);
+ pbuf = (struct pd_thread *) xrealloc (pbuf, psize * sizeof *pbuf);
}
pbuf[pcount].pdtid = pdtid;
pbuf[pcount].pthid = pthid;
@@ -812,9 +825,9 @@ sync_threadlists (int pid)
process_stratum_target *proc_target
= current_inferior ()->process_target ();
- thread = add_thread_with_info (proc_target,
- ptid_t (pid, 0, pbuf[pi].pthid),
- priv);
+ thread
+ = add_thread_with_info (proc_target,
+ ptid_t (pid, 0, pbuf[pi].pthid), priv);
pi++;
}
@@ -869,7 +882,7 @@ sync_threadlists (int pid)
static int
iter_tid (struct thread_info *thread, void *tidp)
{
- const pthdb_tid_t tid = *(pthdb_tid_t *)tidp;
+ const pthdb_tid_t tid = *(pthdb_tid_t *) tidp;
aix_thread_info *priv = get_aix_thread_info (thread);
return priv->tid == tid;
@@ -918,10 +931,9 @@ static ptid_t
pd_activate (int pid)
{
int status;
-
+
status = pthdb_session_init (pid, arch64 ? PEM_64BIT : PEM_32BIT,
- PTHDB_FLAG_REGS, &pd_callbacks,
- &pd_session);
+ PTHDB_FLAG_REGS, &pd_callbacks, &pd_session);
if (status != PTHDB_SUCCESS)
{
return ptid_t (pid);
@@ -938,7 +950,7 @@ pd_deactivate (void)
if (!pd_active)
return;
pthdb_session_destroy (pd_session);
-
+
pid_to_prc (&inferior_ptid);
pd_active = 0;
}
@@ -964,8 +976,7 @@ pd_enable (void)
stub_name = NULL;
status = pthdb_session_pthreaded (inferior_ptid.pid (), PTHDB_FLAG_REGS,
&pd_callbacks, &stub_name);
- if ((status != PTHDB_SUCCESS
- && status != PTHDB_NOT_PTHREADED) || !stub_name)
+ if ((status != PTHDB_SUCCESS && status != PTHDB_NOT_PTHREADED) || !stub_name)
return;
/* Set a breakpoint on the returned stub function. */
@@ -1046,7 +1057,7 @@ aix_thread_target::resume (ptid_t ptid, int step, enum gdb_signal sig)
if (!PD_TID (ptid))
{
scoped_restore save_inferior_ptid = make_scoped_restore (&inferior_ptid);
-
+
inferior_ptid = ptid_t (inferior_ptid.pid ());
beneath ()->resume (ptid, step, sig);
}
@@ -1054,23 +1065,21 @@ aix_thread_target::resume (ptid_t ptid, int step, enum gdb_signal sig)
{
thread = find_thread_ptid (current_inferior (), ptid);
if (!thread)
- error (_("aix-thread resume: unknown pthread %ld"),
- ptid.lwp ());
+ error (_ ("aix-thread resume: unknown pthread %ld"), ptid.lwp ());
aix_thread_info *priv = get_aix_thread_info (thread);
tid[0] = priv->tid;
if (tid[0] == PTHDB_INVALID_TID)
- error (_("aix-thread resume: no tid for pthread %ld"),
- ptid.lwp ());
+ error (_ ("aix-thread resume: no tid for pthread %ld"), ptid.lwp ());
tid[1] = 0;
if (arch64)
ptrace64aix (PTT_CONTINUE, tid[0], (long long) 1,
gdb_signal_to_host (sig), (PTRACE_TYPE_ARG5) tid);
else
- ptrace32 (PTT_CONTINUE, tid[0], (addr_ptr) 1,
- gdb_signal_to_host (sig), (PTRACE_TYPE_ARG5) tid);
+ ptrace32 (PTT_CONTINUE, tid[0], (addr_ptr) 1, gdb_signal_to_host (sig),
+ (PTRACE_TYPE_ARG5) tid);
}
}
@@ -1104,8 +1113,8 @@ aix_thread_target::wait (ptid_t ptid, struct target_waitstatus *status,
struct regcache *regcache = get_thread_regcache (proc_target, ptid);
struct gdbarch *gdbarch = regcache->arch ();
- if (regcache_read_pc (regcache)
- - gdbarch_decr_pc_after_break (gdbarch) == pd_brk_addr)
+ if (regcache_read_pc (regcache) - gdbarch_decr_pc_after_break (gdbarch)
+ == pd_brk_addr)
return pd_activate (ptid.pid ());
}
@@ -1117,8 +1126,7 @@ aix_thread_target::wait (ptid_t ptid, struct target_waitstatus *status,
static void
supply_gprs64 (struct regcache *regcache, uint64_t *vals)
{
- ppc_gdbarch_tdep *tdep
- = gdbarch_tdep<ppc_gdbarch_tdep> (regcache->arch ());
+ ppc_gdbarch_tdep *tdep = gdbarch_tdep<ppc_gdbarch_tdep> (regcache->arch ());
int regno;
for (regno = 0; regno < ppc_num_gprs; regno++)
@@ -1148,8 +1156,7 @@ supply_fprs (struct regcache *regcache, double *vals)
gdb_assert (ppc_floating_point_unit_p (gdbarch));
for (regno = tdep->ppc_fp0_regnum;
- regno < tdep->ppc_fp0_regnum + ppc_num_fprs;
- regno++)
+ regno < tdep->ppc_fp0_regnum + ppc_num_fprs; regno++)
regcache->raw_supply (regno,
(char *) (vals + regno - tdep->ppc_fp0_regnum));
}
@@ -1160,24 +1167,19 @@ special_register_p (struct gdbarch *gdbarch, int regno)
{
ppc_gdbarch_tdep *tdep = gdbarch_tdep<ppc_gdbarch_tdep> (gdbarch);
- return regno == gdbarch_pc_regnum (gdbarch)
- || regno == tdep->ppc_ps_regnum
- || regno == tdep->ppc_cr_regnum
- || regno == tdep->ppc_lr_regnum
- || regno == tdep->ppc_ctr_regnum
- || regno == tdep->ppc_xer_regnum
- || (tdep->ppc_fpscr_regnum >= 0 && regno == tdep->ppc_fpscr_regnum)
- || (tdep->ppc_mq_regnum >= 0 && regno == tdep->ppc_mq_regnum);
+ return regno == gdbarch_pc_regnum (gdbarch) || regno == tdep->ppc_ps_regnum
+ || regno == tdep->ppc_cr_regnum || regno == tdep->ppc_lr_regnum
+ || regno == tdep->ppc_ctr_regnum || regno == tdep->ppc_xer_regnum
+ || (tdep->ppc_fpscr_regnum >= 0 && regno == tdep->ppc_fpscr_regnum)
+ || (tdep->ppc_mq_regnum >= 0 && regno == tdep->ppc_mq_regnum);
}
-
/* Record that the special registers contain the specified 64-bit and
32-bit values. */
static void
-supply_sprs64 (struct regcache *regcache,
- uint64_t iar, uint64_t msr, uint32_t cr,
- uint64_t lr, uint64_t ctr, uint32_t xer,
+supply_sprs64 (struct regcache *regcache, uint64_t iar, uint64_t msr,
+ uint32_t cr, uint64_t lr, uint64_t ctr, uint32_t xer,
uint32_t fpscr)
{
struct gdbarch *gdbarch = regcache->arch ();
@@ -1197,9 +1199,8 @@ supply_sprs64 (struct regcache *regcache,
values. */
static void
-supply_sprs32 (struct regcache *regcache,
- uint32_t iar, uint32_t msr, uint32_t cr,
- uint32_t lr, uint32_t ctr, uint32_t xer,
+supply_sprs32 (struct regcache *regcache, uint32_t iar, uint32_t msr,
+ uint32_t cr, uint32_t lr, uint32_t ctr, uint32_t xer,
uint32_t fpscr)
{
struct gdbarch *gdbarch = regcache->arch ();
@@ -1231,12 +1232,12 @@ fetch_regs_user_thread (struct regcache *regcache, pthdb_pthread_t pdtid)
pthdb_context_t ctx;
if (debug_aix_thread)
- gdb_printf (gdb_stdlog,
- "fetch_regs_user_thread %lx\n", (long) pdtid);
+ gdb_printf (gdb_stdlog, "fetch_regs_user_thread %lx\n", (long) pdtid);
status = pthdb_pthread_context (pd_session, pdtid, &ctx);
if (status != PTHDB_SUCCESS)
- error (_("aix-thread: fetch_registers: pthdb_pthread_context returned %s"),
- pd_status2str (status));
+ error (
+ _ ("aix-thread: fetch_registers: pthdb_pthread_context returned %s"),
+ pd_status2str (status));
/* General-purpose registers. */
@@ -1255,10 +1256,10 @@ fetch_regs_user_thread (struct regcache *regcache, pthdb_pthread_t pdtid)
if (arch64)
supply_sprs64 (regcache, ctx.iar, ctx.msr, ctx.cr, ctx.lr, ctx.ctr,
- ctx.xer, ctx.fpscr);
+ ctx.xer, ctx.fpscr);
else
supply_sprs32 (regcache, ctx.iar, ctx.msr, ctx.cr, ctx.lr, ctx.ctr,
- ctx.xer, ctx.fpscr);
+ ctx.xer, ctx.fpscr);
}
/* Fetch register REGNO if != -1 or all registers otherwise from
@@ -1301,8 +1302,8 @@ fetch_regs_kernel_thread (struct regcache *regcache, int regno,
{
if (arch64)
{
- if (!ptrace64aix (PTT_READ_GPRS, tid,
- (unsigned long) gprs64, 0, NULL))
+ if (!ptrace64aix (PTT_READ_GPRS, tid, (unsigned long) gprs64, 0,
+ NULL))
memset (gprs64, 0, sizeof (gprs64));
supply_gprs64 (regcache, gprs64);
}
@@ -1333,12 +1334,12 @@ fetch_regs_kernel_thread (struct regcache *regcache, int regno,
{
if (arch64)
{
- if (!ptrace64aix (PTT_READ_SPRS, tid,
- (unsigned long) &sprs64, 0, NULL))
+ if (!ptrace64aix (PTT_READ_SPRS, tid, (unsigned long) &sprs64, 0,
+ NULL))
memset (&sprs64, 0, sizeof (sprs64));
- supply_sprs64 (regcache, sprs64.pt_iar, sprs64.pt_msr,
- sprs64.pt_cr, sprs64.pt_lr, sprs64.pt_ctr,
- sprs64.pt_xer, sprs64.pt_fpscr);
+ supply_sprs64 (regcache, sprs64.pt_iar, sprs64.pt_msr, sprs64.pt_cr,
+ sprs64.pt_lr, sprs64.pt_ctr, sprs64.pt_xer,
+ sprs64.pt_fpscr);
}
else
{
@@ -1383,26 +1384,24 @@ aix_thread_target::fetch_registers (struct regcache *regcache, int regno)
static void
fill_gprs64 (const struct regcache *regcache, uint64_t *vals)
{
- ppc_gdbarch_tdep *tdep
- = gdbarch_tdep<ppc_gdbarch_tdep> (regcache->arch ());
+ ppc_gdbarch_tdep *tdep = gdbarch_tdep<ppc_gdbarch_tdep> (regcache->arch ());
int regno;
for (regno = 0; regno < ppc_num_gprs; regno++)
- if (REG_VALID == regcache->get_register_status
- (tdep->ppc_gp0_regnum + regno))
+ if (REG_VALID
+ == regcache->get_register_status (tdep->ppc_gp0_regnum + regno))
regcache->raw_collect (tdep->ppc_gp0_regnum + regno, vals + regno);
}
-static void
+static void
fill_gprs32 (const struct regcache *regcache, uint32_t *vals)
{
- ppc_gdbarch_tdep *tdep
- = gdbarch_tdep<ppc_gdbarch_tdep> (regcache->arch ());
+ ppc_gdbarch_tdep *tdep = gdbarch_tdep<ppc_gdbarch_tdep> (regcache->arch ());
int regno;
for (regno = 0; regno < ppc_num_gprs; regno++)
- if (REG_VALID == regcache->get_register_status
- (tdep->ppc_gp0_regnum + regno))
+ if (REG_VALID
+ == regcache->get_register_status (tdep->ppc_gp0_regnum + regno))
regcache->raw_collect (tdep->ppc_gp0_regnum + regno, vals + regno);
}
@@ -1419,8 +1418,7 @@ fill_fprs (const struct regcache *regcache, double *vals)
gdb_assert (ppc_floating_point_unit_p (gdbarch));
for (regno = tdep->ppc_fp0_regnum;
- regno < tdep->ppc_fp0_regnum + ppc_num_fprs;
- regno++)
+ regno < tdep->ppc_fp0_regnum + ppc_num_fprs; regno++)
if (REG_VALID == regcache->get_register_status (regno))
regcache->raw_collect (regno, vals + regno - tdep->ppc_fp0_regnum);
}
@@ -1429,9 +1427,8 @@ fill_fprs (const struct regcache *regcache, double *vals)
locations. */
static void
-fill_sprs64 (const struct regcache *regcache,
- uint64_t *iar, uint64_t *msr, uint32_t *cr,
- uint64_t *lr, uint64_t *ctr, uint32_t *xer,
+fill_sprs64 (const struct regcache *regcache, uint64_t *iar, uint64_t *msr,
+ uint32_t *cr, uint64_t *lr, uint64_t *ctr, uint32_t *xer,
uint32_t *fpscr)
{
struct gdbarch *gdbarch = regcache->arch ();
@@ -1442,8 +1439,8 @@ fill_sprs64 (const struct regcache *regcache,
they're not, then either GDB has been built incorrectly, or
there's some other kind of internal error. To be really safe,
we should check all of the sizes. */
- gdb_assert (sizeof (*iar) == register_size
- (gdbarch, gdbarch_pc_regnum (gdbarch)));
+ gdb_assert (sizeof (*iar)
+ == register_size (gdbarch, gdbarch_pc_regnum (gdbarch)));
if (REG_VALID == regcache->get_register_status (gdbarch_pc_regnum (gdbarch)))
regcache->raw_collect (gdbarch_pc_regnum (gdbarch), iar);
@@ -1463,9 +1460,8 @@ fill_sprs64 (const struct regcache *regcache,
}
static void
-fill_sprs32 (const struct regcache *regcache,
- uint32_t *iar, uint32_t *msr, uint32_t *cr,
- uint32_t *lr, uint32_t *ctr, uint32_t *xer,
+fill_sprs32 (const struct regcache *regcache, uint32_t *iar, uint32_t *msr,
+ uint32_t *cr, uint32_t *lr, uint32_t *ctr, uint32_t *xer,
uint32_t *fpscr)
{
struct gdbarch *gdbarch = regcache->arch ();
@@ -1476,8 +1472,8 @@ fill_sprs32 (const struct regcache *regcache,
they're not, then either GDB has been built incorrectly, or
there's some other kind of internal error. To be really safe,
we should check all of the sizes. */
- gdb_assert (sizeof (*iar) == register_size (gdbarch,
- gdbarch_pc_regnum (gdbarch)));
+ gdb_assert (sizeof (*iar)
+ == register_size (gdbarch, gdbarch_pc_regnum (gdbarch)));
if (REG_VALID == regcache->get_register_status (gdbarch_pc_regnum (gdbarch)))
regcache->raw_collect (gdbarch_pc_regnum (gdbarch), iar);
@@ -1513,15 +1509,15 @@ store_regs_user_thread (const struct regcache *regcache, pthdb_pthread_t pdtid)
uint64_t int64;
if (debug_aix_thread)
- gdb_printf (gdb_stdlog,
- "store_regs_user_thread %lx\n", (long) pdtid);
+ gdb_printf (gdb_stdlog, "store_regs_user_thread %lx\n", (long) pdtid);
/* Retrieve the thread's current context for its non-register
values. */
status = pthdb_pthread_context (pd_session, pdtid, &ctx);
if (status != PTHDB_SUCCESS)
- error (_("aix-thread: store_registers: pthdb_pthread_context returned %s"),
- pd_status2str (status));
+ error (
+ _ ("aix-thread: store_registers: pthdb_pthread_context returned %s"),
+ pd_status2str (status));
/* Collect general-purpose register values from the regcache. */
@@ -1548,26 +1544,25 @@ store_regs_user_thread (const struct regcache *regcache, pthdb_pthread_t pdtid)
if (arch64)
{
fill_sprs64 (regcache, &ctx.iar, &ctx.msr, &ctx.cr, &ctx.lr, &ctx.ctr,
- &ctx.xer, &ctx.fpscr);
+ &ctx.xer, &ctx.fpscr);
}
else
{
/* Problem: ctx.iar etc. are 64 bits, but raw_registers are 32.
Solution: use 32-bit temp variables. */
- uint32_t tmp_iar, tmp_msr, tmp_cr, tmp_lr, tmp_ctr, tmp_xer,
- tmp_fpscr;
+ uint32_t tmp_iar, tmp_msr, tmp_cr, tmp_lr, tmp_ctr, tmp_xer, tmp_fpscr;
fill_sprs32 (regcache, &tmp_iar, &tmp_msr, &tmp_cr, &tmp_lr, &tmp_ctr,
- &tmp_xer, &tmp_fpscr);
- if (REG_VALID == regcache->get_register_status
- (gdbarch_pc_regnum (gdbarch)))
+ &tmp_xer, &tmp_fpscr);
+ if (REG_VALID
+ == regcache->get_register_status (gdbarch_pc_regnum (gdbarch)))
ctx.iar = tmp_iar;
if (REG_VALID == regcache->get_register_status (tdep->ppc_ps_regnum))
ctx.msr = tmp_msr;
if (REG_VALID == regcache->get_register_status (tdep->ppc_cr_regnum))
- ctx.cr = tmp_cr;
+ ctx.cr = tmp_cr;
if (REG_VALID == regcache->get_register_status (tdep->ppc_lr_regnum))
- ctx.lr = tmp_lr;
+ ctx.lr = tmp_lr;
if (REG_VALID == regcache->get_register_status (tdep->ppc_ctr_regnum))
ctx.ctr = tmp_ctr;
if (REG_VALID == regcache->get_register_status (tdep->ppc_xer_regnum))
@@ -1578,8 +1573,8 @@ store_regs_user_thread (const struct regcache *regcache, pthdb_pthread_t pdtid)
status = pthdb_pthread_setcontext (pd_session, pdtid, &ctx);
if (status != PTHDB_SUCCESS)
- error (_("aix-thread: store_registers: "
- "pthdb_pthread_setcontext returned %s"),
+ error (_ ("aix-thread: store_registers: "
+ "pthdb_pthread_setcontext returned %s"),
pd_status2str (status));
}
@@ -1601,11 +1596,10 @@ store_regs_kernel_thread (const struct regcache *regcache, int regno,
uint32_t gprs32[ppc_num_gprs];
double fprs[ppc_num_fprs];
struct ptxsprs sprs64;
- struct ptsprs sprs32;
+ struct ptsprs sprs32;
if (debug_aix_thread)
- gdb_printf (gdb_stdlog,
- "store_regs_kernel_thread tid=%lx regno=%d\n",
+ gdb_printf (gdb_stdlog, "store_regs_kernel_thread tid=%lx regno=%d\n",
(long) tid, regno);
/* General-purpose registers. */
@@ -1649,13 +1643,11 @@ store_regs_kernel_thread (const struct regcache *regcache, int regno,
if (arch64)
{
/* Pre-fetch: some registers won't be in the cache. */
- ptrace64aix (PTT_READ_SPRS, tid,
- (unsigned long) &sprs64, 0, NULL);
- fill_sprs64 (regcache, &sprs64.pt_iar, &sprs64.pt_msr,
- &sprs64.pt_cr, &sprs64.pt_lr, &sprs64.pt_ctr,
- &sprs64.pt_xer, &sprs64.pt_fpscr);
- ptrace64aix (PTT_WRITE_SPRS, tid,
- (unsigned long) &sprs64, 0, NULL);
+ ptrace64aix (PTT_READ_SPRS, tid, (unsigned long) &sprs64, 0, NULL);
+ fill_sprs64 (regcache, &sprs64.pt_iar, &sprs64.pt_msr, &sprs64.pt_cr,
+ &sprs64.pt_lr, &sprs64.pt_ctr, &sprs64.pt_xer,
+ &sprs64.pt_fpscr);
+ ptrace64aix (PTT_WRITE_SPRS, tid, (unsigned long) &sprs64, 0, NULL);
}
else
{
@@ -1666,7 +1658,7 @@ store_regs_kernel_thread (const struct regcache *regcache, int regno,
use "unsigned long", and the size of that type is not what
the headers expect. */
uint32_t tmp_iar, tmp_msr, tmp_cr, tmp_lr, tmp_ctr, tmp_xer,
- tmp_fpscr;
+ tmp_fpscr;
gdb_assert (sizeof (sprs32.pt_iar) == 4);
@@ -1685,8 +1677,8 @@ store_regs_kernel_thread (const struct regcache *regcache, int regno,
sprs32.pt_fpscr = tmp_fpscr;
if (tdep->ppc_mq_regnum >= 0)
- if (REG_VALID == regcache->get_register_status
- (tdep->ppc_mq_regnum))
+ if (REG_VALID
+ == regcache->get_register_status (tdep->ppc_mq_regnum))
regcache->raw_collect (tdep->ppc_mq_regnum, &sprs32.pt_mq);
ptrace32 (PTT_WRITE_SPRS, tid, (uintptr_t) &sprs32, 0, NULL);
@@ -1721,17 +1713,16 @@ aix_thread_target::store_registers (struct regcache *regcache, int regno)
/* Implement the to_xfer_partial target_ops method. */
enum target_xfer_status
-aix_thread_target::xfer_partial (enum target_object object,
- const char *annex, gdb_byte *readbuf,
- const gdb_byte *writebuf,
+aix_thread_target::xfer_partial (enum target_object object, const char *annex,
+ gdb_byte *readbuf, const gdb_byte *writebuf,
ULONGEST offset, ULONGEST len,
ULONGEST *xfered_len)
{
scoped_restore save_inferior_ptid = make_scoped_restore (&inferior_ptid);
inferior_ptid = ptid_t (inferior_ptid.pid ());
- return beneath ()->xfer_partial (object, annex, readbuf,
- writebuf, offset, len, xfered_len);
+ return beneath ()->xfer_partial (object, annex, readbuf, writebuf, offset,
+ len, xfered_len);
}
/* Clean up after the inferior exits. */
@@ -1755,8 +1746,7 @@ aix_thread_target::thread_alive (ptid_t ptid)
/* We update the thread list every time the child stops, so all
valid threads should be in the thread list. */
- process_stratum_target *proc_target
- = current_inferior ()->process_target ();
+ process_stratum_target *proc_target = current_inferior ()->process_target ();
return in_thread_list (proc_target, ptid);
}
@@ -1769,7 +1759,7 @@ aix_thread_target::pid_to_str (ptid_t ptid)
if (!PD_TID (ptid))
return beneath ()->pid_to_str (ptid);
- return string_printf (_("Thread %s"), pulongest (ptid.tid ()));
+ return string_printf (_ ("Thread %s"), pulongest (ptid.tid ()));
}
/* Return a printable representation of extra information about
@@ -1798,33 +1788,31 @@ aix_thread_target::extra_thread_info (struct thread_info *thread)
if (tid != PTHDB_INVALID_TID)
/* i18n: Like "thread-identifier %d, [state] running, suspended" */
- buf.printf (_("tid %d"), (int)tid);
+ buf.printf (_ ("tid %d"), (int) tid);
status = pthdb_pthread_state (pd_session, pdtid, &state);
if (status != PTHDB_SUCCESS)
state = PST_NOTSUP;
buf.printf (", %s", state2str (state));
- status = pthdb_pthread_suspendstate (pd_session, pdtid,
- &suspendstate);
+ status = pthdb_pthread_suspendstate (pd_session, pdtid, &suspendstate);
if (status == PTHDB_SUCCESS && suspendstate == PSS_SUSPENDED)
/* i18n: Like "Thread-Id %d, [state] running, suspended" */
- buf.printf (_(", suspended"));
+ buf.printf (_ (", suspended"));
- status = pthdb_pthread_detachstate (pd_session, pdtid,
- &detachstate);
+ status = pthdb_pthread_detachstate (pd_session, pdtid, &detachstate);
if (status == PTHDB_SUCCESS && detachstate == PDS_DETACHED)
/* i18n: Like "Thread-Id %d, [state] running, detached" */
- buf.printf (_(", detached"));
+ buf.printf (_ (", detached"));
pthdb_pthread_cancelpend (pd_session, pdtid, &cancelpend);
if (status == PTHDB_SUCCESS && cancelpend)
/* i18n: Like "Thread-Id %d, [state] running, cancel pending" */
- buf.printf (_(", cancel pending"));
+ buf.printf (_ (", cancel pending"));
buf.write ("", 1);
- xfree (ret); /* Free old buffer. */
+ xfree (ret); /* Free old buffer. */
ret = xstrdup (buf.c_str ());
@@ -1837,11 +1825,11 @@ aix_thread_target::get_ada_task_ptid (long lwp, ULONGEST thread)
return ptid_t (inferior_ptid.pid (), 0, thread);
}
-
/* Module startup initialization function, automagically called by
init.c. */
void _initialize_aix_thread ();
+
void
_initialize_aix_thread ()
{
@@ -1854,9 +1842,9 @@ _initialize_aix_thread ()
"aix-thread");
add_setshow_boolean_cmd ("aix-thread", class_maintenance, &debug_aix_thread,
- _("Set debugging of AIX thread module."),
- _("Show debugging of AIX thread module."),
- _("Enables debugging output (used to debug GDB)."),
+ _ ("Set debugging of AIX thread module."),
+ _ ("Show debugging of AIX thread module."),
+ _ ("Enables debugging output (used to debug GDB)."),
NULL, NULL,
/* FIXME: i18n: Debugging of AIX thread
module is \"%d\". */
diff --git a/gdb/alloc.c b/gdb/alloc.c
index 82be0a6f1e7..2d09cfc0c5b 100644
--- a/gdb/alloc.c
+++ b/gdb/alloc.c
@@ -54,7 +54,7 @@ xmalloc (size_t size)
if (size == 0)
size = 1;
- val = malloc (size); /* ARI: malloc */
+ val = malloc (size); /* ARI: malloc */
if (val == NULL)
malloc_failure (size);
@@ -72,9 +72,9 @@ xrealloc (void *ptr, size_t size)
size = 1;
if (ptr != NULL)
- val = realloc (ptr, size); /* ARI: realloc */
+ val = realloc (ptr, size); /* ARI: realloc */
else
- val = malloc (size); /* ARI: malloc */
+ val = malloc (size); /* ARI: malloc */
if (val == NULL)
malloc_failure (size);
@@ -94,7 +94,7 @@ xcalloc (size_t number, size_t size)
size = 1;
}
- mem = calloc (number, size); /* ARI: xcalloc */
+ mem = calloc (number, size); /* ARI: xcalloc */
if (mem == NULL)
malloc_failure (number * size);
diff --git a/gdb/alpha-bsd-nat.c b/gdb/alpha-bsd-nat.c
index 683fac31602..ed75b768674 100644
--- a/gdb/alpha-bsd-nat.c
+++ b/gdb/alpha-bsd-nat.c
@@ -62,22 +62,23 @@ alpha_bsd_nat_target::fetch_registers (struct regcache *regcache, int regno)
struct reg gregs;
if (ptrace (PT_GETREGS, regcache->ptid ().pid (),
- (PTRACE_TYPE_ARG3) &gregs, lwp) == -1)
- perror_with_name (_("Couldn't get registers"));
+ (PTRACE_TYPE_ARG3) &gregs, lwp)
+ == -1)
+ perror_with_name (_ ("Couldn't get registers"));
alphabsd_supply_reg (regcache, (char *) &gregs, regno);
if (regno != -1)
return;
}
- if (regno == -1
- || regno >= gdbarch_fp0_regnum (regcache->arch ()))
+ if (regno == -1 || regno >= gdbarch_fp0_regnum (regcache->arch ()))
{
struct fpreg fpregs;
if (ptrace (PT_GETFPREGS, regcache->ptid ().pid (),
- (PTRACE_TYPE_ARG3) &fpregs, lwp) == -1)
- perror_with_name (_("Couldn't get floating point status"));
+ (PTRACE_TYPE_ARG3) &fpregs, lwp)
+ == -1)
+ perror_with_name (_ ("Couldn't get floating point status"));
alphabsd_supply_fpreg (regcache, (char *) &fpregs, regno);
}
@@ -95,36 +96,38 @@ alpha_bsd_nat_target::store_registers (struct regcache *regcache, int regno)
{
struct reg gregs;
if (ptrace (PT_GETREGS, regcache->ptid ().pid (),
- (PTRACE_TYPE_ARG3) &gregs, lwp) == -1)
- perror_with_name (_("Couldn't get registers"));
+ (PTRACE_TYPE_ARG3) &gregs, lwp)
+ == -1)
+ perror_with_name (_ ("Couldn't get registers"));
alphabsd_fill_reg (regcache, (char *) &gregs, regno);
if (ptrace (PT_SETREGS, regcache->ptid ().pid (),
- (PTRACE_TYPE_ARG3) &gregs, lwp) == -1)
- perror_with_name (_("Couldn't write registers"));
+ (PTRACE_TYPE_ARG3) &gregs, lwp)
+ == -1)
+ perror_with_name (_ ("Couldn't write registers"));
if (regno != -1)
return;
}
- if (regno == -1
- || regno >= gdbarch_fp0_regnum (regcache->arch ()))
+ if (regno == -1 || regno >= gdbarch_fp0_regnum (regcache->arch ()))
{
struct fpreg fpregs;
if (ptrace (PT_GETFPREGS, regcache->ptid ().pid (),
- (PTRACE_TYPE_ARG3) &fpregs, lwp) == -1)
- perror_with_name (_("Couldn't get floating point status"));
+ (PTRACE_TYPE_ARG3) &fpregs, lwp)
+ == -1)
+ perror_with_name (_ ("Couldn't get floating point status"));
alphabsd_fill_fpreg (regcache, (char *) &fpregs, regno);
if (ptrace (PT_SETFPREGS, regcache->ptid ().pid (),
- (PTRACE_TYPE_ARG3) &fpregs, lwp) == -1)
- perror_with_name (_("Couldn't write floating point status"));
+ (PTRACE_TYPE_ARG3) &fpregs, lwp)
+ == -1)
+ perror_with_name (_ ("Couldn't write floating point status"));
}
}
-
/* Support for debugging kernel virtual memory images. */
@@ -155,9 +158,9 @@ alphabsd_supply_pcb (struct regcache *regcache, struct pcb *pcb)
return 1;
}
-
void _initialize_alphabsd_nat ();
+
void
_initialize_alphabsd_nat ()
{
diff --git a/gdb/alpha-bsd-tdep.c b/gdb/alpha-bsd-tdep.c
index 58b3fe81522..5ceeb571833 100644
--- a/gdb/alpha-bsd-tdep.c
+++ b/gdb/alpha-bsd-tdep.c
@@ -41,8 +41,8 @@ alphabsd_fill_reg (const struct regcache *regcache, char *regs, int regno)
}
void
-alphabsd_supply_fpreg (struct regcache *regcache,
- const char *fpregs, int regno)
+alphabsd_supply_fpreg (struct regcache *regcache, const char *fpregs,
+ int regno)
{
/* FPCR is at slot 33; slot 32 unused. */
alpha_supply_fp_regs (regcache, regno, fpregs, fpregs + 32 * 8);
diff --git a/gdb/alpha-bsd-tdep.h b/gdb/alpha-bsd-tdep.h
index 973aab735ee..b5871e997a6 100644
--- a/gdb/alpha-bsd-tdep.h
+++ b/gdb/alpha-bsd-tdep.h
@@ -29,14 +29,12 @@ void alphabsd_fill_reg (const struct regcache *, char *, int);
void alphabsd_supply_fpreg (struct regcache *, const char *, int);
void alphabsd_fill_fpreg (const struct regcache *, char *, int);
-
/* Functions exported from alpha-netbsd-tdep.c. */
/* Iterate over supported core file register note sections. */
-void alphanbsd_iterate_over_regset_sections (struct gdbarch *gdbarch,
- iterate_over_regset_sections_cb *cb,
- void *cb_data,
- const struct regcache *regcache);
+void alphanbsd_iterate_over_regset_sections (
+ struct gdbarch *gdbarch, iterate_over_regset_sections_cb *cb, void *cb_data,
+ const struct regcache *regcache);
#endif /* alpha-bsd-tdep.h */
diff --git a/gdb/alpha-linux-nat.c b/gdb/alpha-linux-nat.c
index 29f27bce258..bc4c6b6c001 100644
--- a/gdb/alpha-linux-nat.c
+++ b/gdb/alpha-linux-nat.c
@@ -36,9 +36,10 @@
class alpha_linux_nat_target final : public linux_nat_trad_target
{
protected:
+
/* Override linux_nat_trad_target methods. */
- CORE_ADDR register_u_offset (struct gdbarch *gdbarch,
- int regno, int store_p) override;
+ CORE_ADDR register_u_offset (struct gdbarch *gdbarch, int regno,
+ int store_p) override;
};
static alpha_linux_nat_target the_alpha_linux_nat_target;
@@ -49,17 +50,17 @@ static alpha_linux_nat_target the_alpha_linux_nat_target;
void
supply_gregset (struct regcache *regcache, const gdb_gregset_t *gregsetp)
{
- const long *regp = (const long *)gregsetp;
+ const long *regp = (const long *) gregsetp;
/* PC is in slot 32, UNIQUE is in slot 33. */
alpha_supply_int_regs (regcache, -1, regp, regp + 31, regp + 32);
}
void
-fill_gregset (const struct regcache *regcache,
- gdb_gregset_t *gregsetp, int regno)
+fill_gregset (const struct regcache *regcache, gdb_gregset_t *gregsetp,
+ int regno)
{
- long *regp = (long *)gregsetp;
+ long *regp = (long *) gregsetp;
/* PC is in slot 32, UNIQUE is in slot 33. */
alpha_fill_int_regs (regcache, regno, regp, regp + 31, regp + 32);
@@ -71,25 +72,25 @@ fill_gregset (const struct regcache *regcache,
void
supply_fpregset (struct regcache *regcache, const gdb_fpregset_t *fpregsetp)
{
- const long *regp = (const long *)fpregsetp;
+ const long *regp = (const long *) fpregsetp;
/* FPCR is in slot 32. */
alpha_supply_fp_regs (regcache, -1, regp, regp + 31);
}
void
-fill_fpregset (const struct regcache *regcache,
- gdb_fpregset_t *fpregsetp, int regno)
+fill_fpregset (const struct regcache *regcache, gdb_fpregset_t *fpregsetp,
+ int regno)
{
- long *regp = (long *)fpregsetp;
+ long *regp = (long *) fpregsetp;
/* FPCR is in slot 32. */
alpha_fill_fp_regs (regcache, regno, regp, regp + 31);
}
CORE_ADDR
-alpha_linux_nat_target::register_u_offset (struct gdbarch *gdbarch,
- int regno, int store_p)
+alpha_linux_nat_target::register_u_offset (struct gdbarch *gdbarch, int regno,
+ int store_p)
{
if (regno == gdbarch_pc_regnum (gdbarch))
return PC;
@@ -102,6 +103,7 @@ alpha_linux_nat_target::register_u_offset (struct gdbarch *gdbarch,
}
void _initialize_alpha_linux_nat ();
+
void
_initialize_alpha_linux_nat ()
{
diff --git a/gdb/alpha-linux-tdep.c b/gdb/alpha-linux-tdep.c
index 33b40da2971..3980d3647df 100644
--- a/gdb/alpha-linux-tdep.c
+++ b/gdb/alpha-linux-tdep.c
@@ -35,26 +35,26 @@
from the Linux kernel tree. */
enum
- {
- /* SIGABRT is the same as in the generic implementation, but is
+{
+ /* SIGABRT is the same as in the generic implementation, but is
defined here because SIGIOT depends on it. */
- ALPHA_LINUX_SIGABRT = 6,
- ALPHA_LINUX_SIGEMT = 7,
- ALPHA_LINUX_SIGBUS = 10,
- ALPHA_LINUX_SIGSYS = 12,
- ALPHA_LINUX_SIGURG = 16,
- ALPHA_LINUX_SIGSTOP = 17,
- ALPHA_LINUX_SIGTSTP = 18,
- ALPHA_LINUX_SIGCONT = 19,
- ALPHA_LINUX_SIGCHLD = 20,
- ALPHA_LINUX_SIGIO = 23,
- ALPHA_LINUX_SIGINFO = 29,
- ALPHA_LINUX_SIGUSR1 = 30,
- ALPHA_LINUX_SIGUSR2 = 31,
- ALPHA_LINUX_SIGPOLL = ALPHA_LINUX_SIGIO,
- ALPHA_LINUX_SIGPWR = ALPHA_LINUX_SIGINFO,
- ALPHA_LINUX_SIGIOT = ALPHA_LINUX_SIGABRT,
- };
+ ALPHA_LINUX_SIGABRT = 6,
+ ALPHA_LINUX_SIGEMT = 7,
+ ALPHA_LINUX_SIGBUS = 10,
+ ALPHA_LINUX_SIGSYS = 12,
+ ALPHA_LINUX_SIGURG = 16,
+ ALPHA_LINUX_SIGSTOP = 17,
+ ALPHA_LINUX_SIGTSTP = 18,
+ ALPHA_LINUX_SIGCONT = 19,
+ ALPHA_LINUX_SIGCHLD = 20,
+ ALPHA_LINUX_SIGIO = 23,
+ ALPHA_LINUX_SIGINFO = 29,
+ ALPHA_LINUX_SIGUSR1 = 30,
+ ALPHA_LINUX_SIGUSR2 = 31,
+ ALPHA_LINUX_SIGPOLL = ALPHA_LINUX_SIGIO,
+ ALPHA_LINUX_SIGPWR = ALPHA_LINUX_SIGINFO,
+ ALPHA_LINUX_SIGIOT = ALPHA_LINUX_SIGABRT,
+};
/* Under GNU/Linux, signal handler invocations can be identified by
the designated code sequence that is used to return from a signal
@@ -75,16 +75,16 @@ alpha_linux_sigtramp_offset_1 (struct gdbarch *gdbarch, CORE_ADDR pc)
{
switch (alpha_read_insn (gdbarch, pc))
{
- case 0x47de0410: /* bis $30,$30,$16 */
- case 0x47fe0410: /* bis $31,$30,$16 */
+ case 0x47de0410: /* bis $30,$30,$16 */
+ case 0x47fe0410: /* bis $31,$30,$16 */
return 0;
- case 0x43ecf400: /* addq $31,103,$0 */
- case 0x201f0067: /* lda $0,103($31) */
- case 0x201f015f: /* lda $0,351($31) */
+ case 0x43ecf400: /* addq $31,103,$0 */
+ case 0x201f0067: /* lda $0,103($31) */
+ case 0x201f015f: /* lda $0,351($31) */
return 4;
- case 0x00000083: /* call_pal callsys */
+ case 0x00000083: /* call_pal callsys */
return 8;
default:
@@ -119,8 +119,8 @@ alpha_linux_sigtramp_offset (struct gdbarch *gdbarch, CORE_ADDR pc)
}
static int
-alpha_linux_pc_in_sigtramp (struct gdbarch *gdbarch,
- CORE_ADDR pc, const char *func_name)
+alpha_linux_pc_in_sigtramp (struct gdbarch *gdbarch, CORE_ADDR pc,
+ const char *func_name)
{
return alpha_linux_sigtramp_offset (gdbarch, pc) >= 0;
}
@@ -161,8 +161,8 @@ alpha_linux_sigcontext_addr (frame_info_ptr this_frame)
static void
alpha_linux_supply_gregset (const struct regset *regset,
- struct regcache *regcache,
- int regnum, const void *gregs, size_t len)
+ struct regcache *regcache, int regnum,
+ const void *gregs, size_t len)
{
const gdb_byte *regs = (const gdb_byte *) gregs;
@@ -178,8 +178,8 @@ alpha_linux_supply_gregset (const struct regset *regset,
static void
alpha_linux_collect_gregset (const struct regset *regset,
- const struct regcache *regcache,
- int regnum, void *gregs, size_t len)
+ const struct regcache *regcache, int regnum,
+ void *gregs, size_t len)
{
gdb_byte *regs = (gdb_byte *) gregs;
@@ -194,8 +194,8 @@ alpha_linux_collect_gregset (const struct regset *regset,
static void
alpha_linux_supply_fpregset (const struct regset *regset,
- struct regcache *regcache,
- int regnum, const void *fpregs, size_t len)
+ struct regcache *regcache, int regnum,
+ const void *fpregs, size_t len)
{
const gdb_byte *regs = (const gdb_byte *) fpregs;
@@ -210,8 +210,8 @@ alpha_linux_supply_fpregset (const struct regset *regset,
static void
alpha_linux_collect_fpregset (const struct regset *regset,
- const struct regcache *regcache,
- int regnum, void *fpregs, size_t len)
+ const struct regcache *regcache, int regnum,
+ void *fpregs, size_t len)
{
gdb_byte *regs = (gdb_byte *) fpregs;
@@ -219,17 +219,11 @@ alpha_linux_collect_fpregset (const struct regset *regset,
alpha_fill_fp_regs (regcache, regnum, regs, regs + 31 * 8);
}
-static const struct regset alpha_linux_gregset =
-{
- NULL,
- alpha_linux_supply_gregset, alpha_linux_collect_gregset
-};
+static const struct regset alpha_linux_gregset
+ = { NULL, alpha_linux_supply_gregset, alpha_linux_collect_gregset };
-static const struct regset alpha_linux_fpregset =
-{
- NULL,
- alpha_linux_supply_fpregset, alpha_linux_collect_fpregset
-};
+static const struct regset alpha_linux_fpregset
+ = { NULL, alpha_linux_supply_fpregset, alpha_linux_collect_fpregset };
/* Iterate over core file register note sections. */
@@ -247,8 +241,7 @@ alpha_linux_iterate_over_regset_sections (struct gdbarch *gdbarch,
gdbarch.h. */
static enum gdb_signal
-alpha_linux_gdb_signal_from_target (struct gdbarch *gdbarch,
- int signal)
+alpha_linux_gdb_signal_from_target (struct gdbarch *gdbarch, int signal)
{
switch (signal)
{
@@ -371,23 +364,23 @@ alpha_linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
set_gdbarch_skip_trampoline_code (gdbarch, find_solib_trampoline_target);
- set_solib_svr4_fetch_link_map_offsets
- (gdbarch, linux_lp64_fetch_link_map_offsets);
+ set_solib_svr4_fetch_link_map_offsets (gdbarch,
+ linux_lp64_fetch_link_map_offsets);
/* Enable TLS support. */
set_gdbarch_fetch_tls_load_module_address (gdbarch,
svr4_fetch_objfile_link_map);
- set_gdbarch_iterate_over_regset_sections
- (gdbarch, alpha_linux_iterate_over_regset_sections);
+ set_gdbarch_iterate_over_regset_sections (
+ gdbarch, alpha_linux_iterate_over_regset_sections);
set_gdbarch_gdb_signal_from_target (gdbarch,
alpha_linux_gdb_signal_from_target);
- set_gdbarch_gdb_signal_to_target (gdbarch,
- alpha_linux_gdb_signal_to_target);
+ set_gdbarch_gdb_signal_to_target (gdbarch, alpha_linux_gdb_signal_to_target);
}
void _initialize_alpha_linux_tdep ();
+
void
_initialize_alpha_linux_tdep ()
{
diff --git a/gdb/alpha-mdebug-tdep.c b/gdb/alpha-mdebug-tdep.c
index 7050a7d8a4d..d1f6e72d65d 100644
--- a/gdb/alpha-mdebug-tdep.c
+++ b/gdb/alpha-mdebug-tdep.c
@@ -85,7 +85,7 @@
#define PROC_FREG_OFFSET(proc) ((proc)->pdr.fregoffset)
#define PROC_PC_REG(proc) ((proc)->pdr.pcreg)
#define PROC_LOCALOFF(proc) ((proc)->pdr.localoff)
-
+
/* Locate the mdebug PDR for the given PC. Return null if one can't
be found; you'll have to fall back to other methods in that case. */
@@ -108,8 +108,8 @@ find_proc_desc (CORE_ADDR pc)
symbol reading. */
sym = NULL;
else
- sym = lookup_symbol (MDEBUG_EFI_SYMBOL_NAME, b, LABEL_DOMAIN,
- 0).symbol;
+ sym
+ = lookup_symbol (MDEBUG_EFI_SYMBOL_NAME, b, LABEL_DOMAIN, 0).symbol;
}
if (sym)
@@ -118,8 +118,7 @@ find_proc_desc (CORE_ADDR pc)
/* Correct incorrect setjmp procedure descriptor from the library
to make backtrace through setjmp work. */
- if (proc_desc->pdr.pcreg == 0
- && strcmp (sh_name, "setjmp") == 0)
+ if (proc_desc->pdr.pcreg == 0 && strcmp (sh_name, "setjmp") == 0)
{
proc_desc->pdr.pcreg = ALPHA_RA_REGNUM;
proc_desc->pdr.regmask = 0x80000000;
@@ -173,7 +172,6 @@ alpha_mdebug_in_prologue (CORE_ADDR pc,
return (after_prologue_pc == 0 || pc < after_prologue_pc);
}
-
/* Frame unwinder that reads mdebug PDRs. */
struct alpha_mdebug_unwind_cache
@@ -187,7 +185,7 @@ struct alpha_mdebug_unwind_cache
and store the resulting register save locations in the structure. */
static struct alpha_mdebug_unwind_cache *
-alpha_mdebug_frame_unwind_cache (frame_info_ptr this_frame,
+alpha_mdebug_frame_unwind_cache (frame_info_ptr this_frame,
void **this_prologue_cache)
{
struct alpha_mdebug_unwind_cache *info;
@@ -288,7 +286,7 @@ alpha_mdebug_frame_prev_register (frame_info_ptr this_frame,
the correct place. */
if (regnum == ALPHA_PC_REGNUM)
regnum = PROC_PC_REG (info->proc_desc);
-
+
return trad_frame_get_prev_register (this_frame, info->saved_regs, regnum);
}
@@ -308,8 +306,7 @@ alpha_mdebug_max_frame_size_exceeded (struct mdebug_extra_func_info *proc_desc)
static int
alpha_mdebug_frame_sniffer (const struct frame_unwind *self,
- frame_info_ptr this_frame,
- void **this_cache)
+ frame_info_ptr this_frame, void **this_cache)
{
CORE_ADDR pc = get_frame_address_in_block (this_frame);
struct mdebug_extra_func_info *proc_desc;
@@ -333,16 +330,14 @@ alpha_mdebug_frame_sniffer (const struct frame_unwind *self,
return 1;
}
-static const struct frame_unwind alpha_mdebug_frame_unwind =
-{
- "alpha mdebug",
- NORMAL_FRAME,
- default_frame_unwind_stop_reason,
- alpha_mdebug_frame_this_id,
- alpha_mdebug_frame_prev_register,
- NULL,
- alpha_mdebug_frame_sniffer
-};
+static const struct frame_unwind alpha_mdebug_frame_unwind
+ = { "alpha mdebug",
+ NORMAL_FRAME,
+ default_frame_unwind_stop_reason,
+ alpha_mdebug_frame_this_id,
+ alpha_mdebug_frame_prev_register,
+ NULL,
+ alpha_mdebug_frame_sniffer };
static CORE_ADDR
alpha_mdebug_frame_base_address (frame_info_ptr this_frame,
@@ -374,12 +369,9 @@ alpha_mdebug_frame_args_address (frame_info_ptr this_frame,
return info->vfp - ALPHA_NUM_ARG_REGS * 8;
}
-static const struct frame_base alpha_mdebug_frame_base = {
- &alpha_mdebug_frame_unwind,
- alpha_mdebug_frame_base_address,
- alpha_mdebug_frame_locals_address,
- alpha_mdebug_frame_args_address
-};
+static const struct frame_base alpha_mdebug_frame_base
+ = { &alpha_mdebug_frame_unwind, alpha_mdebug_frame_base_address,
+ alpha_mdebug_frame_locals_address, alpha_mdebug_frame_args_address };
static const struct frame_base *
alpha_mdebug_frame_base_sniffer (frame_info_ptr this_frame)
@@ -401,7 +393,6 @@ alpha_mdebug_frame_base_sniffer (frame_info_ptr this_frame)
return &alpha_mdebug_frame_base;
}
-
void
alpha_mdebug_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
{
diff --git a/gdb/alpha-netbsd-tdep.c b/gdb/alpha-netbsd-tdep.c
index 5ea7d28791c..d4b71a0ef43 100644
--- a/gdb/alpha-netbsd-tdep.c
+++ b/gdb/alpha-netbsd-tdep.c
@@ -36,10 +36,10 @@
/* Core file support. */
/* Sizeof `struct reg' in <machine/reg.h>. */
-#define ALPHANBSD_SIZEOF_GREGS (32 * 8)
+#define ALPHANBSD_SIZEOF_GREGS (32 * 8)
/* Sizeof `struct fpreg' in <machine/reg.h. */
-#define ALPHANBSD_SIZEOF_FPREGS ((32 * 8) + 8)
+#define ALPHANBSD_SIZEOF_FPREGS ((32 * 8) + 8)
/* Supply register REGNUM from the buffer specified by FPREGS and LEN
in the floating-point register set REGSET to register cache
@@ -47,8 +47,8 @@
static void
alphanbsd_supply_fpregset (const struct regset *regset,
- struct regcache *regcache,
- int regnum, const void *fpregs, size_t len)
+ struct regcache *regcache, int regnum,
+ const void *fpregs, size_t len)
{
const gdb_byte *regs = (const gdb_byte *) fpregs;
int i;
@@ -71,28 +71,20 @@ alphanbsd_supply_fpregset (const struct regset *regset,
static void
alphanbsd_aout_supply_gregset (const struct regset *regset,
- struct regcache *regcache,
- int regnum, const void *gregs, size_t len)
+ struct regcache *regcache, int regnum,
+ const void *gregs, size_t len)
{
const gdb_byte *regs = (const gdb_byte *) gregs;
int i;
/* Table to map a GDB register number to a trapframe register index. */
- static const int regmap[] =
- {
- 0, 1, 2, 3,
- 4, 5, 6, 7,
- 8, 9, 10, 11,
- 12, 13, 14, 15,
- 30, 31, 32, 16,
- 17, 18, 19, 20,
- 21, 22, 23, 24,
- 25, 29, 26
- };
+ static const int regmap[]
+ = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
+ 30, 31, 32, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 29, 26 };
gdb_assert (len >= ALPHANBSD_SIZEOF_GREGS);
- for (i = 0; i < ARRAY_SIZE(regmap); i++)
+ for (i = 0; i < ARRAY_SIZE (regmap); i++)
{
if (regnum == i || regnum == -1)
regcache->raw_supply (i, regs + regmap[i] * 8);
@@ -115,8 +107,8 @@ alphanbsd_aout_supply_gregset (const struct regset *regset,
static void
alphanbsd_supply_gregset (const struct regset *regset,
- struct regcache *regcache,
- int regnum, const void *gregs, size_t len)
+ struct regcache *regcache, int regnum,
+ const void *gregs, size_t len)
{
const gdb_byte *regs = (const gdb_byte *) gregs;
int i;
@@ -139,19 +131,11 @@ alphanbsd_supply_gregset (const struct regset *regset,
/* NetBSD/alpha register sets. */
-static const struct regset alphanbsd_gregset =
-{
- NULL,
- alphanbsd_supply_gregset,
- NULL,
- REGSET_VARIABLE_SIZE
-};
+static const struct regset alphanbsd_gregset
+ = { NULL, alphanbsd_supply_gregset, NULL, REGSET_VARIABLE_SIZE };
-static const struct regset alphanbsd_fpregset =
-{
- NULL,
- alphanbsd_supply_fpregset
-};
+static const struct regset alphanbsd_fpregset
+ = { NULL, alphanbsd_supply_fpregset };
/* Iterate over supported core file register note sections. */
@@ -166,7 +150,6 @@ alphanbsd_iterate_over_regset_sections (struct gdbarch *gdbarch,
cb (".reg2", ALPHANBSD_SIZEOF_FPREGS, ALPHANBSD_SIZEOF_FPREGS,
&alphanbsd_fpregset, NULL, cb_data);
}
-
/* Signal trampolines. */
@@ -186,15 +169,14 @@ alphanbsd_iterate_over_regset_sections (struct gdbarch *gdbarch,
sequence and can then check whether we really are executing in the
signal trampoline. If not, -1 is returned, otherwise the offset from the
start of the return sequence is returned. */
-static const gdb_byte sigtramp_retcode[] =
-{
- 0x00, 0x00, 0x1e, 0xa6, /* ldq a0, 0(sp) */
- 0x10, 0x00, 0xde, 0x23, /* lda sp, 16(sp) */
- 0x27, 0x01, 0x1f, 0x20, /* lda v0, 295(zero) */
- 0x83, 0x00, 0x00, 0x00, /* call_pal callsys */
+static const gdb_byte sigtramp_retcode[] = {
+ 0x00, 0x00, 0x1e, 0xa6, /* ldq a0, 0(sp) */
+ 0x10, 0x00, 0xde, 0x23, /* lda sp, 16(sp) */
+ 0x27, 0x01, 0x1f, 0x20, /* lda v0, 295(zero) */
+ 0x83, 0x00, 0x00, 0x00, /* call_pal callsys */
};
-#define RETCODE_NWORDS 4
-#define RETCODE_SIZE (RETCODE_NWORDS * 4)
+#define RETCODE_NWORDS 4
+#define RETCODE_SIZE (RETCODE_NWORDS * 4)
static LONGEST
alphanbsd_sigtramp_offset (struct gdbarch *gdbarch, CORE_ADDR pc)
@@ -227,8 +209,8 @@ alphanbsd_sigtramp_offset (struct gdbarch *gdbarch, CORE_ADDR pc)
}
static int
-alphanbsd_pc_in_sigtramp (struct gdbarch *gdbarch,
- CORE_ADDR pc, const char *func_name)
+alphanbsd_pc_in_sigtramp (struct gdbarch *gdbarch, CORE_ADDR pc,
+ const char *func_name)
{
return (nbsd_pc_in_sigtramp (pc, func_name)
|| alphanbsd_sigtramp_offset (gdbarch, pc) >= 0);
@@ -244,11 +226,9 @@ alphanbsd_sigcontext_addr (frame_info_ptr frame)
return 0;
return get_frame_base (get_next_frame (frame));
}
-
static void
-alphanbsd_init_abi (struct gdbarch_info info,
- struct gdbarch *gdbarch)
+alphanbsd_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
{
alpha_gdbarch_tdep *tdep = gdbarch_tdep<alpha_gdbarch_tdep> (gdbarch);
@@ -265,8 +245,8 @@ alphanbsd_init_abi (struct gdbarch_info info,
set_gdbarch_software_single_step (gdbarch, alpha_software_single_step);
/* NetBSD/alpha has SVR4-style shared libraries. */
- set_solib_svr4_fetch_link_map_offsets
- (gdbarch, svr4_lp64_fetch_link_map_offsets);
+ set_solib_svr4_fetch_link_map_offsets (gdbarch,
+ svr4_lp64_fetch_link_map_offsets);
tdep->dynamic_sigtramp_offset = alphanbsd_sigtramp_offset;
tdep->pc_in_sigtramp = alphanbsd_pc_in_sigtramp;
@@ -275,12 +255,12 @@ alphanbsd_init_abi (struct gdbarch_info info,
tdep->jb_pc = 2;
tdep->jb_elt_size = 8;
- set_gdbarch_iterate_over_regset_sections
- (gdbarch, alphanbsd_iterate_over_regset_sections);
+ set_gdbarch_iterate_over_regset_sections (
+ gdbarch, alphanbsd_iterate_over_regset_sections);
}
-
void _initialize_alphanbsd_tdep ();
+
void
_initialize_alphanbsd_tdep ()
{
diff --git a/gdb/alpha-obsd-tdep.c b/gdb/alpha-obsd-tdep.c
index a3d713ffe68..249149965c3 100644
--- a/gdb/alpha-obsd-tdep.c
+++ b/gdb/alpha-obsd-tdep.c
@@ -46,8 +46,8 @@ alphaobsd_sigtramp_offset (struct gdbarch *gdbarch, CORE_ADDR pc)
}
static int
-alphaobsd_pc_in_sigtramp (struct gdbarch *gdbarch,
- CORE_ADDR pc, const char *name)
+alphaobsd_pc_in_sigtramp (struct gdbarch *gdbarch, CORE_ADDR pc,
+ const char *name)
{
CORE_ADDR start_pc = (pc & ~(alphaobsd_page_size - 1));
unsigned insn;
@@ -92,10 +92,9 @@ alphaobsd_sigcontext_addr (frame_info_ptr this_frame)
return get_frame_register_unsigned (this_frame, ALPHA_A0_REGNUM);
}
}
-
static void
-alphaobsd_init_abi(struct gdbarch_info info, struct gdbarch *gdbarch)
+alphaobsd_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
{
alpha_gdbarch_tdep *tdep = gdbarch_tdep<alpha_gdbarch_tdep> (gdbarch);
@@ -110,8 +109,8 @@ alphaobsd_init_abi(struct gdbarch_info info, struct gdbarch *gdbarch)
set_gdbarch_software_single_step (gdbarch, alpha_software_single_step);
/* OpenBSD/alpha has SVR4-style shared libraries. */
- set_solib_svr4_fetch_link_map_offsets
- (gdbarch, svr4_lp64_fetch_link_map_offsets);
+ set_solib_svr4_fetch_link_map_offsets (gdbarch,
+ svr4_lp64_fetch_link_map_offsets);
set_gdbarch_skip_solib_resolver (gdbarch, obsd_skip_solib_resolver);
tdep->dynamic_sigtramp_offset = alphaobsd_sigtramp_offset;
@@ -121,12 +120,12 @@ alphaobsd_init_abi(struct gdbarch_info info, struct gdbarch *gdbarch)
tdep->jb_pc = 2;
tdep->jb_elt_size = 8;
- set_gdbarch_iterate_over_regset_sections
- (gdbarch, alphanbsd_iterate_over_regset_sections);
+ set_gdbarch_iterate_over_regset_sections (
+ gdbarch, alphanbsd_iterate_over_regset_sections);
}
-
void _initialize_alphaobsd_tdep ();
+
void
_initialize_alphaobsd_tdep ()
{
diff --git a/gdb/alpha-tdep.c b/gdb/alpha-tdep.c
index 14f5a0492d3..363ca71948a 100644
--- a/gdb/alpha-tdep.c
+++ b/gdb/alpha-tdep.c
@@ -59,7 +59,7 @@ static const int lda_opcode = 0x08;
static const int stq_opcode = 0x2d;
/* Branch instruction format */
-#define BR_RA(insn) MEM_RA(insn)
+#define BR_RA(insn) MEM_RA (insn)
static const int br_opcode = 0x30;
static const int bne_opcode = 0x3d;
@@ -67,14 +67,13 @@ static const int bne_opcode = 0x3d;
/* Operate instruction format */
#define OPR_FUNCTION(insn) ((insn & 0xfe0) >> 5)
#define OPR_HAS_IMMEDIATE(insn) ((insn & 0x1000) == 0x1000)
-#define OPR_RA(insn) MEM_RA(insn)
+#define OPR_RA(insn) MEM_RA (insn)
#define OPR_RC(insn) ((insn & 0x1f))
#define OPR_LIT(insn) ((insn & 0x1fe000) >> 13)
static const int subq_opcode = 0x10;
static const int subq_function = 0x29;
-
/* Return the name of the REGNO register.
An empty name corresponds to a register number that used to
@@ -85,18 +84,15 @@ static const int subq_function = 0x29;
static const char *
alpha_register_name (struct gdbarch *gdbarch, int regno)
{
- static const char * const register_names[] =
- {
- "v0", "t0", "t1", "t2", "t3", "t4", "t5", "t6",
- "t7", "s0", "s1", "s2", "s3", "s4", "s5", "fp",
- "a0", "a1", "a2", "a3", "a4", "a5", "t8", "t9",
- "t10", "t11", "ra", "t12", "at", "gp", "sp", "zero",
- "f0", "f1", "f2", "f3", "f4", "f5", "f6", "f7",
- "f8", "f9", "f10", "f11", "f12", "f13", "f14", "f15",
- "f16", "f17", "f18", "f19", "f20", "f21", "f22", "f23",
- "f24", "f25", "f26", "f27", "f28", "f29", "f30", "fpcr",
- "pc", "", "unique"
- };
+ static const char *const register_names[]
+ = { "v0", "t0", "t1", "t2", "t3", "t4", "t5", "t6", "t7",
+ "s0", "s1", "s2", "s3", "s4", "s5", "fp", "a0", "a1",
+ "a2", "a3", "a4", "a5", "t8", "t9", "t10", "t11", "ra",
+ "t12", "at", "gp", "sp", "zero", "f0", "f1", "f2", "f3",
+ "f4", "f5", "f6", "f7", "f8", "f9", "f10", "f11", "f12",
+ "f13", "f14", "f15", "f16", "f17", "f18", "f19", "f20", "f21",
+ "f22", "f23", "f24", "f25", "f26", "f27", "f28", "f29", "f30",
+ "fpcr", "pc", "", "unique" };
gdb_static_assert (ALPHA_NUM_REGS == ARRAY_SIZE (register_names));
return register_names[regno];
@@ -182,8 +178,8 @@ alpha_lds (struct gdbarch *gdbarch, void *out, const void *in)
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
ULONGEST mem
= extract_unsigned_integer ((const gdb_byte *) in, 4, byte_order);
- ULONGEST frac = (mem >> 0) & 0x7fffff;
- ULONGEST sign = (mem >> 31) & 1;
+ ULONGEST frac = (mem >> 0) & 0x7fffff;
+ ULONGEST sign = (mem >> 31) & 1;
ULONGEST exp_msb = (mem >> 30) & 1;
ULONGEST exp_low = (mem >> 23) & 0x7f;
ULONGEST exp, reg;
@@ -234,8 +230,8 @@ alpha_convert_register_p (struct gdbarch *gdbarch, int regno,
static int
alpha_register_to_value (frame_info_ptr frame, int regnum,
- struct type *valtype, gdb_byte *out,
- int *optimizedp, int *unavailablep)
+ struct type *valtype, gdb_byte *out, int *optimizedp,
+ int *unavailablep)
{
struct gdbarch *gdbarch = get_frame_arch (frame);
struct value *value = get_frame_register_value (frame, regnum);
@@ -273,7 +269,6 @@ alpha_value_to_register (frame_info_ptr frame, int regnum,
put_frame_register (frame, regnum, out);
}
-
/* The alpha passes the first six arguments in the registers, the rest on
the stack. The register arguments are stored in ARG_REG_BUFFER, and
then moved into the register file; this simplifies the passing of a
@@ -288,20 +283,21 @@ alpha_value_to_register (frame_info_ptr frame, int regnum,
static CORE_ADDR
alpha_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
- struct regcache *regcache, CORE_ADDR bp_addr,
- int nargs, struct value **args, CORE_ADDR sp,
+ struct regcache *regcache, CORE_ADDR bp_addr, int nargs,
+ struct value **args, CORE_ADDR sp,
function_call_return_method return_method,
CORE_ADDR struct_addr)
{
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
int i;
int accumulate_size = (return_method == return_method_struct) ? 8 : 0;
+
struct alpha_arg
- {
- const gdb_byte *contents;
- int len;
- int offset;
- };
+ {
+ const gdb_byte *contents;
+ int len;
+ int offset;
+ };
struct alpha_arg *alpha_args = XALLOCAVEC (struct alpha_arg, nargs);
struct alpha_arg *m_arg;
gdb_byte arg_reg_buffer[ALPHA_REGISTER_SIZE * ALPHA_NUM_ARG_REGS];
@@ -405,10 +401,10 @@ alpha_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
required_arg_regs = ALPHA_NUM_ARG_REGS;
/* Make room for the arguments on the stack. */
- if (accumulate_size < sizeof(arg_reg_buffer))
+ if (accumulate_size < sizeof (arg_reg_buffer))
accumulate_size = 0;
else
- accumulate_size -= sizeof(arg_reg_buffer);
+ accumulate_size -= sizeof (arg_reg_buffer);
sp -= accumulate_size;
/* Keep sp aligned to a multiple of 16 as the ABI requires. */
@@ -422,16 +418,16 @@ alpha_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
int len = m_arg->len;
/* Copy the bytes destined for registers into arg_reg_buffer. */
- if (offset < sizeof(arg_reg_buffer))
+ if (offset < sizeof (arg_reg_buffer))
{
- if (offset + len <= sizeof(arg_reg_buffer))
+ if (offset + len <= sizeof (arg_reg_buffer))
{
memcpy (arg_reg_buffer + offset, contents, len);
continue;
}
else
{
- int tlen = sizeof(arg_reg_buffer) - offset;
+ int tlen = sizeof (arg_reg_buffer) - offset;
memcpy (arg_reg_buffer + offset, contents, tlen);
offset += tlen;
contents += tlen;
@@ -440,11 +436,11 @@ alpha_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
}
/* Everything else goes to the stack. */
- write_memory (sp + offset - sizeof(arg_reg_buffer), contents, len);
+ write_memory (sp + offset - sizeof (arg_reg_buffer), contents, len);
}
if (return_method == return_method_struct)
- store_unsigned_integer (arg_reg_buffer, ALPHA_REGISTER_SIZE,
- byte_order, struct_addr);
+ store_unsigned_integer (arg_reg_buffer, ALPHA_REGISTER_SIZE, byte_order,
+ struct_addr);
/* Load the argument registers. */
for (i = 0; i < required_arg_regs; i++)
@@ -493,7 +489,7 @@ alpha_extract_return_value (struct type *valtype, struct regcache *regcache,
break;
default:
- internal_error (_("unknown floating point width"));
+ internal_error (_ ("unknown floating point width"));
}
break;
@@ -516,7 +512,7 @@ alpha_extract_return_value (struct type *valtype, struct regcache *regcache,
break;
default:
- internal_error (_("unknown floating point width"));
+ internal_error (_ ("unknown floating point width"));
}
break;
@@ -557,10 +553,10 @@ alpha_store_return_value (struct type *valtype, struct regcache *regcache,
/* FIXME: 128-bit long doubles are returned like structures:
by writing into indirect storage provided by the caller
as the first argument. */
- error (_("Cannot set a 128-bit long double return value."));
+ error (_ ("Cannot set a 128-bit long double return value."));
default:
- internal_error (_("unknown floating point width"));
+ internal_error (_ ("unknown floating point width"));
}
break;
@@ -581,10 +577,10 @@ alpha_store_return_value (struct type *valtype, struct regcache *regcache,
/* FIXME: 128-bit long doubles are returned like structures:
by writing into indirect storage provided by the caller
as the first argument. */
- error (_("Cannot set a 128-bit long double return value."));
+ error (_ ("Cannot set a 128-bit long double return value."));
default:
- internal_error (_("unknown floating point width"));
+ internal_error (_ ("unknown floating point width"));
}
break;
@@ -608,8 +604,7 @@ alpha_return_value (struct gdbarch *gdbarch, struct value *function,
enum type_code code = type->code ();
alpha_gdbarch_tdep *tdep = gdbarch_tdep<alpha_gdbarch_tdep> (gdbarch);
- if ((code == TYPE_CODE_STRUCT
- || code == TYPE_CODE_UNION
+ if ((code == TYPE_CODE_STRUCT || code == TYPE_CODE_UNION
|| code == TYPE_CODE_ARRAY)
&& tdep->return_in_memory (type))
{
@@ -636,13 +631,11 @@ alpha_return_in_memory_always (struct type *type)
{
return 1;
}
-
constexpr gdb_byte alpha_break_insn[] = { 0x80, 0, 0, 0 }; /* call_pal bpt */
typedef BP_MANIPULATION (alpha_break_insn) alpha_breakpoint;
-
/* This returns the PC of the first insn after the prologue.
If we can't find the prologue, then return 0. */
@@ -722,23 +715,23 @@ alpha_skip_prologue (struct gdbarch *gdbarch, CORE_ADDR pc)
{
inst = alpha_read_insn (gdbarch, pc + offset);
- if ((inst & 0xffff0000) == 0x27bb0000) /* ldah $gp,n($t12) */
+ if ((inst & 0xffff0000) == 0x27bb0000) /* ldah $gp,n($t12) */
continue;
- if ((inst & 0xffff0000) == 0x23bd0000) /* lda $gp,n($gp) */
+ if ((inst & 0xffff0000) == 0x23bd0000) /* lda $gp,n($gp) */
continue;
- if ((inst & 0xffff0000) == 0x23de0000) /* lda $sp,n($sp) */
+ if ((inst & 0xffff0000) == 0x23de0000) /* lda $sp,n($sp) */
continue;
- if ((inst & 0xffe01fff) == 0x43c0153e) /* subq $sp,n,$sp */
+ if ((inst & 0xffe01fff) == 0x43c0153e) /* subq $sp,n,$sp */
continue;
- if (((inst & 0xfc1f0000) == 0xb41e0000 /* stq reg,n($sp) */
- || (inst & 0xfc1f0000) == 0x9c1e0000) /* stt reg,n($sp) */
- && (inst & 0x03e00000) != 0x03e00000) /* reg != $zero */
+ if (((inst & 0xfc1f0000) == 0xb41e0000 /* stq reg,n($sp) */
+ || (inst & 0xfc1f0000) == 0x9c1e0000) /* stt reg,n($sp) */
+ && (inst & 0x03e00000) != 0x03e00000) /* reg != $zero */
continue;
- if (inst == 0x47de040f) /* bis sp,sp,fp */
+ if (inst == 0x47de040f) /* bis sp,sp,fp */
continue;
- if (inst == 0x47fe040f) /* bis zero,sp,fp */
+ if (inst == 0x47fe040f) /* bis zero,sp,fp */
continue;
break;
@@ -746,7 +739,6 @@ alpha_skip_prologue (struct gdbarch *gdbarch, CORE_ADDR pc)
return pc + offset;
}
-
static const int ldl_l_opcode = 0x2a;
static const int ldq_l_opcode = 0x2b;
static const int stl_c_opcode = 0x2e;
@@ -760,19 +752,18 @@ static const int stq_c_opcode = 0x2f;
static std::vector<CORE_ADDR>
alpha_deal_with_atomic_sequence (struct gdbarch *gdbarch, CORE_ADDR pc)
{
- CORE_ADDR breaks[2] = {CORE_ADDR_MAX, CORE_ADDR_MAX};
+ CORE_ADDR breaks[2] = { CORE_ADDR_MAX, CORE_ADDR_MAX };
CORE_ADDR loc = pc;
CORE_ADDR closing_insn; /* Instruction that closes the atomic sequence. */
unsigned int insn = alpha_read_insn (gdbarch, loc);
int insn_count;
int index;
- int last_breakpoint = 0; /* Defaults to 0 (no breakpoints placed). */
+ int last_breakpoint = 0; /* Defaults to 0 (no breakpoints placed). */
const int atomic_sequence_length = 16; /* Instruction sequence length. */
int bc_insn_count = 0; /* Conditional branch instruction count. */
/* Assume all atomic sequences start with a LDL_L/LDQ_L instruction. */
- if (INSN_OPCODE (insn) != ldl_l_opcode
- && INSN_OPCODE (insn) != ldq_l_opcode)
+ if (INSN_OPCODE (insn) != ldl_l_opcode && INSN_OPCODE (insn) != ldq_l_opcode)
return {};
/* Assume that no atomic sequence is longer than "atomic_sequence_length"
@@ -807,8 +798,7 @@ alpha_deal_with_atomic_sequence (struct gdbarch *gdbarch, CORE_ADDR pc)
}
/* Assume that the atomic sequence ends with a STL_C/STQ_C instruction. */
- if (INSN_OPCODE (insn) != stl_c_opcode
- && INSN_OPCODE (insn) != stq_c_opcode)
+ if (INSN_OPCODE (insn) != stl_c_opcode && INSN_OPCODE (insn) != stq_c_opcode)
return {};
closing_insn = loc;
@@ -818,7 +808,7 @@ alpha_deal_with_atomic_sequence (struct gdbarch *gdbarch, CORE_ADDR pc)
breaks[0] = loc;
/* Check for duplicated breakpoints. Check also for a breakpoint
- placed (branch instruction's destination) anywhere in sequence. */
+ placed (branch instruction's destination) anywhere in sequence. */
if (last_breakpoint
&& (breaks[1] == breaks[0]
|| (breaks[1] >= pc && breaks[1] <= closing_insn)))
@@ -832,7 +822,6 @@ alpha_deal_with_atomic_sequence (struct gdbarch *gdbarch, CORE_ADDR pc)
return next_pcs;
}
-
/* Figure out where the longjmp will land.
We expect the first arg to be a pointer to the jmp_buf structure from
which we extract the PC (JB_PC) that we will land at. The PC is copied
@@ -857,7 +846,6 @@ alpha_get_longjmp_target (frame_info_ptr frame, CORE_ADDR *pc)
return 1;
}
-
/* Frame unwinder for signal trampolines. We use alpha tdep bits that
describe the location and shape of the sigcontext structure. After
that, all registers are in memory, so it's easy. */
@@ -894,7 +882,7 @@ alpha_sigtramp_frame_unwind_cache (frame_info_ptr this_frame,
static CORE_ADDR
alpha_sigtramp_register_address (struct gdbarch *gdbarch,
CORE_ADDR sigcontext_addr, int regnum)
-{
+{
alpha_gdbarch_tdep *tdep = gdbarch_tdep<alpha_gdbarch_tdep> (gdbarch);
if (regnum >= 0 && regnum < 32)
@@ -902,7 +890,7 @@ alpha_sigtramp_register_address (struct gdbarch *gdbarch,
else if (regnum >= ALPHA_FP0_REGNUM && regnum < ALPHA_FP0_REGNUM + 32)
return sigcontext_addr + tdep->sc_fpregs_offset + regnum * 8;
else if (regnum == ALPHA_PC_REGNUM)
- return sigcontext_addr + tdep->sc_pc_offset;
+ return sigcontext_addr + tdep->sc_pc_offset;
return 0;
}
@@ -944,8 +932,8 @@ alpha_sigtramp_frame_this_id (frame_info_ptr this_frame,
/* The stack address is trivially read from the sigcontext. */
stack_addr = alpha_sigtramp_register_address (gdbarch, info->sigcontext_addr,
ALPHA_SP_REGNUM);
- stack_addr = get_frame_memory_unsigned (this_frame, stack_addr,
- ALPHA_REGISTER_SIZE);
+ stack_addr
+ = get_frame_memory_unsigned (this_frame, stack_addr, ALPHA_REGISTER_SIZE);
*this_id = frame_id_build (stack_addr, code_addr);
}
@@ -1006,18 +994,14 @@ alpha_sigtramp_frame_sniffer (const struct frame_unwind *self,
return 0;
}
-static const struct frame_unwind alpha_sigtramp_frame_unwind =
-{
- "alpha sigtramp",
- SIGTRAMP_FRAME,
- default_frame_unwind_stop_reason,
- alpha_sigtramp_frame_this_id,
- alpha_sigtramp_frame_prev_register,
- NULL,
- alpha_sigtramp_frame_sniffer
-};
-
-
+static const struct frame_unwind alpha_sigtramp_frame_unwind
+ = { "alpha sigtramp",
+ SIGTRAMP_FRAME,
+ default_frame_unwind_stop_reason,
+ alpha_sigtramp_frame_this_id,
+ alpha_sigtramp_frame_prev_register,
+ NULL,
+ alpha_sigtramp_frame_sniffer };
/* Heuristic_proc_start may hunt through the text section for a long
time across a 2400 baud serial line. Allows the user to limit this
@@ -1049,8 +1033,7 @@ alpha_heuristic_proc_start (struct gdbarch *gdbarch, CORE_ADDR pc)
if (func)
return func;
- if (heuristic_fence_post == -1
- || fence < tdep->vm_min_address)
+ if (heuristic_fence_post == -1 || fence < tdep->vm_min_address)
fence = tdep->vm_min_address;
/* Search back for previous return; also stop at a 0, which might be
@@ -1061,12 +1044,12 @@ alpha_heuristic_proc_start (struct gdbarch *gdbarch, CORE_ADDR pc)
unsigned int insn = alpha_read_insn (gdbarch, pc);
switch (insn)
{
- case 0: /* invalid insn */
- case 0x6bfa8001: /* ret $31,($26),1 */
+ case 0: /* invalid insn */
+ case 0x6bfa8001: /* ret $31,($26),1 */
return last_non_nop;
- case 0x2ffe0000: /* unop: ldq_u $31,0($30) */
- case 0x47ff041f: /* nop: bis $31,$31,$31 */
+ case 0x2ffe0000: /* unop: ldq_u $31,0($30) */
+ case 0x47ff041f: /* nop: bis $31,$31,$31 */
break;
default:
@@ -1085,15 +1068,17 @@ alpha_heuristic_proc_start (struct gdbarch *gdbarch, CORE_ADDR pc)
static int blurb_printed = 0;
if (fence == tdep->vm_min_address)
- warning (_("Hit beginning of text section without finding \
-enclosing function for address %s"), paddress (gdbarch, orig_pc));
+ warning (_ ("Hit beginning of text section without finding \
+enclosing function for address %s"),
+ paddress (gdbarch, orig_pc));
else
- warning (_("Hit heuristic-fence-post without finding \
-enclosing function for address %s"), paddress (gdbarch, orig_pc));
+ warning (_ ("Hit heuristic-fence-post without finding \
+enclosing function for address %s"),
+ paddress (gdbarch, orig_pc));
if (!blurb_printed)
{
- gdb_printf (_("\
+ gdb_printf (_ ("\
This warning occurs if you are debugging a function without any symbols\n\
(for example, in a stripped executable). In that case, you may wish to\n\
increase the size of the search with the `set heuristic-fence-post' command.\n\
@@ -1111,7 +1096,7 @@ Otherwise, you told GDB there was a function where there isn't one, or\n\
something about the traditional layout of alpha stack frames. */
struct alpha_heuristic_unwind_cache
-{
+{
CORE_ADDR vfp;
CORE_ADDR start_pc;
trad_frame_saved_reg *saved_regs;
@@ -1160,39 +1145,33 @@ alpha_heuristic_analyze_probing_loop (struct gdbarch *gdbarch, CORE_ADDR *pc,
cur_pc += ALPHA_INSN_SIZE;
insn = alpha_read_insn (gdbarch, cur_pc);
- if (INSN_OPCODE (insn) != lda_opcode
- || MEM_RB (insn) != ALPHA_SP_REGNUM)
+ if (INSN_OPCODE (insn) != lda_opcode || MEM_RB (insn) != ALPHA_SP_REGNUM)
return;
reg_probe = MEM_RA (insn);
cur_frame_size -= MEM_DISP (insn);
/* stq zero,<immediate>(REG_PROBE) */
-
+
cur_pc += ALPHA_INSN_SIZE;
insn = alpha_read_insn (gdbarch, cur_pc);
- if (INSN_OPCODE (insn) != stq_opcode
- || MEM_RA (insn) != 0x1f
+ if (INSN_OPCODE (insn) != stq_opcode || MEM_RA (insn) != 0x1f
|| MEM_RB (insn) != reg_probe)
return;
-
+
/* subq REG_INDEX,0x1,REG_INDEX */
cur_pc += ALPHA_INSN_SIZE;
insn = alpha_read_insn (gdbarch, cur_pc);
- if (INSN_OPCODE (insn) != subq_opcode
- || !OPR_HAS_IMMEDIATE (insn)
- || OPR_FUNCTION (insn) != subq_function
- || OPR_LIT(insn) != 1
- || OPR_RA (insn) != reg_index
- || OPR_RC (insn) != reg_index)
+ if (INSN_OPCODE (insn) != subq_opcode || !OPR_HAS_IMMEDIATE (insn)
+ || OPR_FUNCTION (insn) != subq_function || OPR_LIT (insn) != 1
+ || OPR_RA (insn) != reg_index || OPR_RC (insn) != reg_index)
return;
-
+
/* lda REG_PROBE,<immediate>(REG_PROBE) */
-
+
cur_pc += ALPHA_INSN_SIZE;
insn = alpha_read_insn (gdbarch, cur_pc);
- if (INSN_OPCODE (insn) != lda_opcode
- || MEM_RA (insn) != reg_probe
+ if (INSN_OPCODE (insn) != lda_opcode || MEM_RA (insn) != reg_probe
|| MEM_RB (insn) != reg_probe)
return;
cur_frame_size -= MEM_DISP (insn) * nb_of_iterations;
@@ -1201,16 +1180,14 @@ alpha_heuristic_analyze_probing_loop (struct gdbarch *gdbarch, CORE_ADDR *pc,
cur_pc += ALPHA_INSN_SIZE;
insn = alpha_read_insn (gdbarch, cur_pc);
- if (INSN_OPCODE (insn) != bne_opcode
- || MEM_RA (insn) != reg_index)
+ if (INSN_OPCODE (insn) != bne_opcode || MEM_RA (insn) != reg_index)
return;
/* lda sp,<immediate>(REG_PROBE) */
cur_pc += ALPHA_INSN_SIZE;
insn = alpha_read_insn (gdbarch, cur_pc);
- if (INSN_OPCODE (insn) != lda_opcode
- || MEM_RA (insn) != ALPHA_SP_REGNUM
+ if (INSN_OPCODE (insn) != lda_opcode || MEM_RA (insn) != ALPHA_SP_REGNUM
|| MEM_RB (insn) != reg_probe)
return;
cur_frame_size -= MEM_DISP (insn);
@@ -1257,7 +1234,7 @@ alpha_heuristic_frame_unwind_cache (frame_info_ptr this_frame,
{
unsigned int word = alpha_read_insn (gdbarch, cur_pc);
- if ((word & 0xffff0000) == 0x23de0000) /* lda $sp,n($sp) */
+ if ((word & 0xffff0000) == 0x23de0000) /* lda $sp,n($sp) */
{
if (word & 0x8000)
{
@@ -1274,7 +1251,7 @@ alpha_heuristic_frame_unwind_cache (frame_info_ptr this_frame,
break;
}
}
- else if ((word & 0xfc1f0000) == 0xb41e0000) /* stq reg,n($sp) */
+ else if ((word & 0xfc1f0000) == 0xb41e0000) /* stq reg,n($sp) */
{
reg = (word & 0x03e00000) >> 21;
@@ -1323,18 +1300,16 @@ alpha_heuristic_frame_unwind_cache (frame_info_ptr this_frame,
FIXME: Rewriting GDB to access the procedure descriptors,
e.g. via the minimal symbol table, might obviate this
hack. */
- if (return_reg == -1
- && cur_pc < (start_pc + 80)
- && (reg == ALPHA_T7_REGNUM
- || reg == ALPHA_T9_REGNUM
+ if (return_reg == -1 && cur_pc < (start_pc + 80)
+ && (reg == ALPHA_T7_REGNUM || reg == ALPHA_T9_REGNUM
|| reg == ALPHA_RA_REGNUM))
return_reg = reg;
}
- else if ((word & 0xffe0ffff) == 0x6be08001) /* ret zero,reg,1 */
+ else if ((word & 0xffe0ffff) == 0x6be08001) /* ret zero,reg,1 */
return_reg = (word >> 16) & 0x1f;
- else if (word == 0x47de040f) /* bis sp,sp,fp */
+ else if (word == 0x47de040f) /* bis sp,sp,fp */
frame_reg = ALPHA_GCC_FP_REGNUM;
- else if (word == 0x47fe040f) /* bis zero,sp,fp */
+ else if (word == 0x47fe040f) /* bis zero,sp,fp */
frame_reg = ALPHA_GCC_FP_REGNUM;
alpha_heuristic_analyze_probing_loop (gdbarch, &cur_pc, &frame_size);
@@ -1348,11 +1323,10 @@ alpha_heuristic_frame_unwind_cache (frame_info_ptr this_frame,
{
unsigned int word = alpha_read_insn (gdbarch, cur_pc);
- if ((word & 0xfc1f0000) == 0xb41e0000) /* stq reg,n($sp) */
+ if ((word & 0xfc1f0000) == 0xb41e0000) /* stq reg,n($sp) */
{
reg = (word & 0x03e00000) >> 21;
- if (reg == ALPHA_T7_REGNUM
- || reg == ALPHA_T9_REGNUM
+ if (reg == ALPHA_T7_REGNUM || reg == ALPHA_T9_REGNUM
|| reg == ALPHA_RA_REGNUM)
{
return_reg = reg;
@@ -1382,13 +1356,12 @@ alpha_heuristic_frame_unwind_cache (frame_info_ptr this_frame,
one to the offsets to make all detected offsets non-zero. */
for (reg = 0; reg < ALPHA_NUM_REGS; ++reg)
if (info->saved_regs[reg].is_addr ())
- info->saved_regs[reg].set_addr (info->saved_regs[reg].addr ()
- + val - 1);
+ info->saved_regs[reg].set_addr (info->saved_regs[reg].addr () + val - 1);
/* The stack pointer of the previous frame is computed by popping
the current stack frame. */
if (!info->saved_regs[ALPHA_SP_REGNUM].is_addr ())
- info->saved_regs[ALPHA_SP_REGNUM].set_value (info->vfp);
+ info->saved_regs[ALPHA_SP_REGNUM].set_value (info->vfp);
return info;
}
@@ -1421,20 +1394,18 @@ alpha_heuristic_frame_prev_register (frame_info_ptr this_frame,
the correct place. */
if (regnum == ALPHA_PC_REGNUM)
regnum = info->return_reg;
-
+
return trad_frame_get_prev_register (this_frame, info->saved_regs, regnum);
}
-static const struct frame_unwind alpha_heuristic_frame_unwind =
-{
- "alpha prologue",
- NORMAL_FRAME,
- default_frame_unwind_stop_reason,
- alpha_heuristic_frame_this_id,
- alpha_heuristic_frame_prev_register,
- NULL,
- default_frame_sniffer
-};
+static const struct frame_unwind alpha_heuristic_frame_unwind
+ = { "alpha prologue",
+ NORMAL_FRAME,
+ default_frame_unwind_stop_reason,
+ alpha_heuristic_frame_this_id,
+ alpha_heuristic_frame_prev_register,
+ NULL,
+ default_frame_sniffer };
static CORE_ADDR
alpha_heuristic_frame_base_address (frame_info_ptr this_frame,
@@ -1446,23 +1417,20 @@ alpha_heuristic_frame_base_address (frame_info_ptr this_frame,
return info->vfp;
}
-static const struct frame_base alpha_heuristic_frame_base = {
- &alpha_heuristic_frame_unwind,
- alpha_heuristic_frame_base_address,
- alpha_heuristic_frame_base_address,
- alpha_heuristic_frame_base_address
-};
+static const struct frame_base alpha_heuristic_frame_base
+ = { &alpha_heuristic_frame_unwind, alpha_heuristic_frame_base_address,
+ alpha_heuristic_frame_base_address, alpha_heuristic_frame_base_address };
/* Just like reinit_frame_cache, but with the right arguments to be
callable as an sfunc. Used by the "set heuristic-fence-post" command. */
static void
-reinit_frame_cache_sfunc (const char *args,
- int from_tty, struct cmd_list_element *c)
+reinit_frame_cache_sfunc (const char *args, int from_tty,
+ struct cmd_list_element *c)
{
reinit_frame_cache ();
}
-
+
/* Helper routines for alpha*-nat.c files to move register sets to and
from core files. The UNIQUE pointer is allowed to be NULL, as most
targets don't supply this value in their core files. */
@@ -1493,8 +1461,8 @@ alpha_supply_int_regs (struct regcache *regcache, int regno,
}
void
-alpha_fill_int_regs (const struct regcache *regcache,
- int regno, void *r0_r30, void *pc, void *unique)
+alpha_fill_int_regs (const struct regcache *regcache, int regno, void *r0_r30,
+ void *pc, void *unique)
{
gdb_byte *regs = (gdb_byte *) r0_r30;
int i;
@@ -1511,8 +1479,8 @@ alpha_fill_int_regs (const struct regcache *regcache,
}
void
-alpha_supply_fp_regs (struct regcache *regcache, int regno,
- const void *f0_f30, const void *fpcr)
+alpha_supply_fp_regs (struct regcache *regcache, int regno, const void *f0_f30,
+ const void *fpcr)
{
const gdb_byte *regs = (const gdb_byte *) f0_f30;
int i;
@@ -1526,8 +1494,8 @@ alpha_supply_fp_regs (struct regcache *regcache, int regno,
}
void
-alpha_fill_fp_regs (const struct regcache *regcache,
- int regno, void *f0_f30, void *fpcr)
+alpha_fill_fp_regs (const struct regcache *regcache, int regno, void *f0_f30,
+ void *fpcr)
{
gdb_byte *regs = (gdb_byte *) f0_f30;
int i;
@@ -1540,11 +1508,9 @@ alpha_fill_fp_regs (const struct regcache *regcache,
regcache->raw_collect (ALPHA_FPCR_REGNUM, fpcr);
}
-
-
/* Return nonzero if the G_floating register value in REG is equal to
zero for FP control instructions. */
-
+
static int
fp_register_zero_p (LONGEST reg)
{
@@ -1596,13 +1562,13 @@ alpha_next_pc (struct regcache *regcache, CORE_ADDR pc)
{
/* Branch format: target PC is:
(new PC) + (4 * sext(displacement)) */
- if (op == 0x30 /* BR */
- || op == 0x34) /* BSR */
+ if (op == 0x30 /* BR */
+ || op == 0x34) /* BSR */
{
- branch_taken:
+ branch_taken:
offset = (insn & 0x001fffff);
if (offset & 0x00100000)
- offset |= 0xffe00000;
+ offset |= 0xffe00000;
offset *= ALPHA_INSN_SIZE;
return (pc + ALPHA_INSN_SIZE + offset);
}
@@ -1611,76 +1577,76 @@ alpha_next_pc (struct regcache *regcache, CORE_ADDR pc)
regno = (insn >> 21) & 0x1f;
switch (op)
{
- case 0x31: /* FBEQ */
- case 0x36: /* FBGE */
- case 0x37: /* FBGT */
- case 0x33: /* FBLE */
- case 0x32: /* FBLT */
- case 0x35: /* FBNE */
- regno += gdbarch_fp0_regnum (gdbarch);
+ case 0x31: /* FBEQ */
+ case 0x36: /* FBGE */
+ case 0x37: /* FBGT */
+ case 0x33: /* FBLE */
+ case 0x32: /* FBLT */
+ case 0x35: /* FBNE */
+ regno += gdbarch_fp0_regnum (gdbarch);
}
-
+
rav = regcache_raw_get_signed (regcache, regno);
switch (op)
{
- case 0x38: /* BLBC */
+ case 0x38: /* BLBC */
if ((rav & 1) == 0)
goto branch_taken;
break;
- case 0x3c: /* BLBS */
+ case 0x3c: /* BLBS */
if (rav & 1)
goto branch_taken;
break;
- case 0x39: /* BEQ */
+ case 0x39: /* BEQ */
if (rav == 0)
goto branch_taken;
break;
- case 0x3d: /* BNE */
+ case 0x3d: /* BNE */
if (rav != 0)
goto branch_taken;
break;
- case 0x3a: /* BLT */
+ case 0x3a: /* BLT */
if (rav < 0)
goto branch_taken;
break;
- case 0x3b: /* BLE */
+ case 0x3b: /* BLE */
if (rav <= 0)
goto branch_taken;
break;
- case 0x3f: /* BGT */
+ case 0x3f: /* BGT */
if (rav > 0)
goto branch_taken;
break;
- case 0x3e: /* BGE */
+ case 0x3e: /* BGE */
if (rav >= 0)
goto branch_taken;
break;
- /* Floating point branches. */
-
- case 0x31: /* FBEQ */
+ /* Floating point branches. */
+
+ case 0x31: /* FBEQ */
if (fp_register_zero_p (rav))
goto branch_taken;
break;
- case 0x36: /* FBGE */
+ case 0x36: /* FBGE */
if (fp_register_sign_bit (rav) == 0 || fp_register_zero_p (rav))
goto branch_taken;
break;
- case 0x37: /* FBGT */
- if (fp_register_sign_bit (rav) == 0 && ! fp_register_zero_p (rav))
+ case 0x37: /* FBGT */
+ if (fp_register_sign_bit (rav) == 0 && !fp_register_zero_p (rav))
goto branch_taken;
break;
- case 0x33: /* FBLE */
+ case 0x33: /* FBLE */
if (fp_register_sign_bit (rav) == 1 || fp_register_zero_p (rav))
goto branch_taken;
break;
- case 0x32: /* FBLT */
- if (fp_register_sign_bit (rav) == 1 && ! fp_register_zero_p (rav))
+ case 0x32: /* FBLT */
+ if (fp_register_sign_bit (rav) == 1 && !fp_register_zero_p (rav))
goto branch_taken;
break;
- case 0x35: /* FBNE */
- if (! fp_register_zero_p (rav))
+ case 0x35: /* FBNE */
+ if (!fp_register_zero_p (rav))
goto branch_taken;
break;
}
@@ -1704,10 +1670,9 @@ alpha_software_single_step (struct regcache *regcache)
return next_pcs;
CORE_ADDR next_pc = alpha_next_pc (regcache, pc);
- return {next_pc};
+ return { next_pc };
}
-
/* Initialize the current architecture based on INFO. If possible, re-use an
architecture from ARCHES, which is a list of architectures already created
during this debugging session.
@@ -1737,7 +1702,7 @@ alpha_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
tdep->sc_regs_offset = 4 * 8;
tdep->sc_fpregs_offset = tdep->sc_regs_offset + 32 * 8 + 8;
- tdep->jb_pc = -1; /* longjmp support not enabled by default. */
+ tdep->jb_pc = -1; /* longjmp support not enabled by default. */
tdep->return_in_memory = alpha_return_in_memory_always;
@@ -1819,10 +1784,10 @@ alpha_dwarf2_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
}
void _initialize_alpha_tdep ();
+
void
_initialize_alpha_tdep ()
{
-
gdbarch_register (bfd_arch_alpha, alpha_gdbarch_init, NULL);
/* Let the user set the fence post for heuristic_proc_start. */
@@ -1833,9 +1798,11 @@ _initialize_alpha_tdep ()
/* We need to throw away the frame cache when we set this, since it
might change our ability to get backtraces. */
add_setshow_zinteger_cmd ("heuristic-fence-post", class_support,
- &heuristic_fence_post, _("\
-Set the distance searched for the start of a function."), _("\
-Show the distance searched for the start of a function."), _("\
+ &heuristic_fence_post, _ ("\
+Set the distance searched for the start of a function."),
+ _ ("\
+Show the distance searched for the start of a function."),
+ _ ("\
If you are debugging a stripped executable, GDB needs to search through the\n\
program for the start of a function. This command sets the distance of the\n\
search. The only need to set it is when debugging a stripped executable."),
diff --git a/gdb/alpha-tdep.h b/gdb/alpha-tdep.h
index 9913a082bcd..941eb8f207d 100644
--- a/gdb/alpha-tdep.h
+++ b/gdb/alpha-tdep.h
@@ -35,25 +35,25 @@ struct regcache;
these values are "real" register numbers, and correspond to the
general registers of the machine. */
-#define ALPHA_V0_REGNUM 0 /* Function integer return value */
-#define ALPHA_T7_REGNUM 8 /* Return address register for OSF/1 __add* */
-#define ALPHA_S0_REGNUM 9 /* First saved register */
-#define ALPHA_GCC_FP_REGNUM 15 /* Used by gcc as frame register */
-#define ALPHA_A0_REGNUM 16 /* Loc of first arg during a subr call */
-#define ALPHA_T9_REGNUM 23 /* Return address register for OSF/1 __div* */
-#define ALPHA_RA_REGNUM 26 /* Contains return address value */
-#define ALPHA_T12_REGNUM 27 /* Contains start addr of current proc */
-#define ALPHA_GP_REGNUM 29 /* Contains the global pointer */
-#define ALPHA_SP_REGNUM 30 /* Contains address of top of stack */
-#define ALPHA_ZERO_REGNUM 31 /* Read-only register, always 0 */
-#define ALPHA_FP0_REGNUM 32 /* Floating point register 0 */
-#define ALPHA_FPA0_REGNUM 48 /* First float arg during a subr call */
-#define ALPHA_FPCR_REGNUM 63 /* Floating point control register */
-#define ALPHA_PC_REGNUM 64 /* Contains program counter */
-#define ALPHA_UNIQUE_REGNUM 66 /* PAL_rduniq value */
+#define ALPHA_V0_REGNUM 0 /* Function integer return value */
+#define ALPHA_T7_REGNUM 8 /* Return address register for OSF/1 __add* */
+#define ALPHA_S0_REGNUM 9 /* First saved register */
+#define ALPHA_GCC_FP_REGNUM 15 /* Used by gcc as frame register */
+#define ALPHA_A0_REGNUM 16 /* Loc of first arg during a subr call */
+#define ALPHA_T9_REGNUM 23 /* Return address register for OSF/1 __div* */
+#define ALPHA_RA_REGNUM 26 /* Contains return address value */
+#define ALPHA_T12_REGNUM 27 /* Contains start addr of current proc */
+#define ALPHA_GP_REGNUM 29 /* Contains the global pointer */
+#define ALPHA_SP_REGNUM 30 /* Contains address of top of stack */
+#define ALPHA_ZERO_REGNUM 31 /* Read-only register, always 0 */
+#define ALPHA_FP0_REGNUM 32 /* Floating point register 0 */
+#define ALPHA_FPA0_REGNUM 48 /* First float arg during a subr call */
+#define ALPHA_FPCR_REGNUM 63 /* Floating point control register */
+#define ALPHA_PC_REGNUM 64 /* Contains program counter */
+#define ALPHA_UNIQUE_REGNUM 66 /* PAL_rduniq value */
/* Instruction size. */
-#define ALPHA_INSN_SIZE 4
+#define ALPHA_INSN_SIZE 4
/* The alpha has two different virtual pointers for arguments and locals.
@@ -67,12 +67,12 @@ struct regcache;
The virtual local pointer is localoff bytes below the virtual frame
pointer, the value of localoff is obtained from the PDR. */
-#define ALPHA_NUM_ARG_REGS 6
+#define ALPHA_NUM_ARG_REGS 6
/* Target-dependent structure in gdbarch. */
struct alpha_gdbarch_tdep : gdbarch_tdep_base
{
- CORE_ADDR vm_min_address = 0; /* Used by alpha_heuristic_proc_start. */
+ CORE_ADDR vm_min_address = 0; /* Used by alpha_heuristic_proc_start. */
/* If PC is inside a dynamically-generated signal trampoline function
(i.e. one copied onto the user stack at run-time), return how many
@@ -88,7 +88,8 @@ struct alpha_gdbarch_tdep : gdbarch_tdep_base
look at tramp-frame.h and other simpler per-architecture
sigtramp unwinders. */
int (*pc_in_sigtramp) (struct gdbarch *gdbarch, CORE_ADDR pc,
- const char *name) = nullptr;
+ const char *name)
+ = nullptr;
/* If TYPE will be returned in memory, return true. */
int (*return_in_memory) (struct type *type) = nullptr;
@@ -98,15 +99,15 @@ struct alpha_gdbarch_tdep : gdbarch_tdep_base
int sc_regs_offset = 0;
int sc_fpregs_offset = 0;
- int jb_pc = 0; /* Offset to PC value in jump buffer.
+ int jb_pc = 0; /* Offset to PC value in jump buffer.
If htis is negative, longjmp support
will be disabled. */
- size_t jb_elt_size = 0; /* And the size of each entry in the buf. */
+ size_t jb_elt_size = 0; /* And the size of each entry in the buf. */
};
extern unsigned int alpha_read_insn (struct gdbarch *gdbarch, CORE_ADDR pc);
-extern std::vector<CORE_ADDR> alpha_software_single_step
- (struct regcache *regcache);
+extern std::vector<CORE_ADDR>
+alpha_software_single_step (struct regcache *regcache);
extern CORE_ADDR alpha_after_prologue (CORE_ADDR pc);
extern void alpha_mdebug_init_abi (struct gdbarch_info, struct gdbarch *);
@@ -114,11 +115,10 @@ extern void alpha_dwarf2_init_abi (struct gdbarch_info, struct gdbarch *);
extern void alpha_supply_int_regs (struct regcache *, int, const void *,
const void *, const void *);
-extern void alpha_fill_int_regs (const struct regcache *, int,
- void *, void *, void *);
-extern void alpha_supply_fp_regs (struct regcache *, int,
- const void *, const void *);
-extern void alpha_fill_fp_regs (const struct regcache *,
- int, void *, void *);
+extern void alpha_fill_int_regs (const struct regcache *, int, void *, void *,
+ void *);
+extern void alpha_supply_fp_regs (struct regcache *, int, const void *,
+ const void *);
+extern void alpha_fill_fp_regs (const struct regcache *, int, void *, void *);
#endif /* ALPHA_TDEP_H */
diff --git a/gdb/amd-dbgapi-target.c b/gdb/amd-dbgapi-target.c
index 5f7de52a1a5..3c036c1b492 100644
--- a/gdb/amd-dbgapi-target.c
+++ b/gdb/amd-dbgapi-target.c
@@ -43,7 +43,7 @@ make_green (const char *s)
{
cli_style_option style (nullptr, ui_file_style::GREEN);
string_file sf (true);
- gdb_printf (&sf, "%ps", styled_string (style.style(), s));
+ gdb_printf (&sf, "%ps", styled_string (style.style (), s));
return sf.release ();
}
@@ -52,8 +52,7 @@ make_green (const char *s)
amd-dbgapi library. */
static const char *amd_dbgapi_debug_module_unstyled = "amd-dbgapi";
-static const char *amd_dbgapi_lib_debug_module_unstyled
- = "amd-dbgapi-lib";
+static const char *amd_dbgapi_lib_debug_module_unstyled = "amd-dbgapi-lib";
/* Styled variants of the above. */
@@ -87,16 +86,15 @@ amd_dbgapi_lib_debug_module ()
/* Print an amd-dbgapi debug statement. */
-#define amd_dbgapi_debug_printf(fmt, ...) \
- debug_prefixed_printf_cond (debug_amd_dbgapi, \
- amd_dbgapi_debug_module (), \
+#define amd_dbgapi_debug_printf(fmt, ...) \
+ debug_prefixed_printf_cond (debug_amd_dbgapi, amd_dbgapi_debug_module (), \
fmt, ##__VA_ARGS__)
/* Print amd-dbgapi start/end debug statements. */
-#define AMD_DBGAPI_SCOPED_DEBUG_START_END(fmt, ...) \
- scoped_debug_start_end (debug_infrun, amd_dbgapi_debug_module (), \
- fmt, ##__VA_ARGS__)
+#define AMD_DBGAPI_SCOPED_DEBUG_START_END(fmt, ...) \
+ scoped_debug_start_end (debug_infrun, amd_dbgapi_debug_module (), fmt, \
+ ##__VA_ARGS__)
/* inferior_created observer token. */
@@ -108,7 +106,6 @@ get_amd_dbgapi_target_inferior_created_observer_token ()
return amd_dbgapi_target_inferior_created_observer_token;
}
-
/* Big enough to hold the size of the largest register in bytes. */
#define AMDGPU_MAX_REGISTER_SIZE 256
@@ -118,7 +115,8 @@ struct amd_dbgapi_inferior_info
{
explicit amd_dbgapi_inferior_info (inferior *inf)
: inf (inf)
- {}
+ {
+ }
/* Backlink to inferior. */
inferior *inf;
@@ -147,30 +145,21 @@ struct amd_dbgapi_inferior_info
std::list<std::pair<ptid_t, target_waitstatus>> wave_events;
};
-static amd_dbgapi_event_id_t process_event_queue
- (amd_dbgapi_process_id_t process_id = AMD_DBGAPI_PROCESS_NONE,
- amd_dbgapi_event_kind_t until_event_kind = AMD_DBGAPI_EVENT_KIND_NONE);
+static amd_dbgapi_event_id_t process_event_queue (
+ amd_dbgapi_process_id_t process_id = AMD_DBGAPI_PROCESS_NONE,
+ amd_dbgapi_event_kind_t until_event_kind = AMD_DBGAPI_EVENT_KIND_NONE);
-static const target_info amd_dbgapi_target_info = {
- "amd-dbgapi",
- N_("AMD Debugger API"),
- N_("GPU debugging using the AMD Debugger API")
-};
+static const target_info amd_dbgapi_target_info
+ = { "amd-dbgapi", N_ ("AMD Debugger API"),
+ N_ ("GPU debugging using the AMD Debugger API") };
static amd_dbgapi_log_level_t get_debug_amd_dbgapi_lib_log_level ();
struct amd_dbgapi_target final : public target_ops
{
- const target_info &
- info () const override
- {
- return amd_dbgapi_target_info;
- }
- strata
- stratum () const override
- {
- return arch_stratum;
- }
+ const target_info &info () const override { return amd_dbgapi_target_info; }
+
+ strata stratum () const override { return arch_stratum; }
void close () override;
void mourn_inferior () override;
@@ -213,6 +202,7 @@ struct amd_dbgapi_target final : public target_ops
bool stopped_by_hw_breakpoint () override;
private:
+
/* True if we must report thread events. */
bool m_report_thread_events = false;
@@ -256,37 +246,38 @@ wave_target_id_string (amd_dbgapi_wave_id_t wave_id)
= amd_dbgapi_wave_get_info (wave_id, AMD_DBGAPI_WAVE_INFO_AGENT,
sizeof (agent_id), &agent_id);
str += (status == AMD_DBGAPI_STATUS_SUCCESS
- ? string_printf (" %ld", agent_id.handle)
- : " ?");
+ ? string_printf (" %ld", agent_id.handle)
+ : " ?");
status = amd_dbgapi_wave_get_info (wave_id, AMD_DBGAPI_WAVE_INFO_QUEUE,
sizeof (queue_id), &queue_id);
str += (status == AMD_DBGAPI_STATUS_SUCCESS
- ? string_printf (":%ld", queue_id.handle)
- : ":?");
+ ? string_printf (":%ld", queue_id.handle)
+ : ":?");
status = amd_dbgapi_wave_get_info (wave_id, AMD_DBGAPI_WAVE_INFO_DISPATCH,
sizeof (dispatch_id), &dispatch_id);
str += (status == AMD_DBGAPI_STATUS_SUCCESS
- ? string_printf (":%ld", dispatch_id.handle)
- : ":?");
+ ? string_printf (":%ld", dispatch_id.handle)
+ : ":?");
str += string_printf (":%ld", wave_id.handle);
- status = amd_dbgapi_wave_get_info (wave_id,
- AMD_DBGAPI_WAVE_INFO_WORKGROUP_COORD,
- sizeof (group_ids), &group_ids);
+ status
+ = amd_dbgapi_wave_get_info (wave_id, AMD_DBGAPI_WAVE_INFO_WORKGROUP_COORD,
+ sizeof (group_ids), &group_ids);
str += (status == AMD_DBGAPI_STATUS_SUCCESS
- ? string_printf (" (%d,%d,%d)", group_ids[0], group_ids[1],
- group_ids[2])
- : " (?,?,?)");
-
- status = amd_dbgapi_wave_get_info
- (wave_id, AMD_DBGAPI_WAVE_INFO_WAVE_NUMBER_IN_WORKGROUP,
- sizeof (wave_in_group), &wave_in_group);
+ ? string_printf (" (%d,%d,%d)", group_ids[0], group_ids[1],
+ group_ids[2])
+ : " (?,?,?)");
+
+ status
+ = amd_dbgapi_wave_get_info (wave_id,
+ AMD_DBGAPI_WAVE_INFO_WAVE_NUMBER_IN_WORKGROUP,
+ sizeof (wave_in_group), &wave_in_group);
str += (status == AMD_DBGAPI_STATUS_SUCCESS
- ? string_printf ("/%d", wave_in_group)
- : "/?");
+ ? string_printf ("/%d", wave_in_group)
+ : "/?");
return str;
}
@@ -343,11 +334,9 @@ require_forward_progress (ptid_t ptid, process_stratum_target *proc_target,
if (info->forward_progress_required == require)
continue;
- amd_dbgapi_status_t status
- = amd_dbgapi_process_set_progress
- (info->process_id, (require
- ? AMD_DBGAPI_PROGRESS_NORMAL
- : AMD_DBGAPI_PROGRESS_NO_FORWARD));
+ amd_dbgapi_status_t status = amd_dbgapi_process_set_progress (
+ info->process_id, (require ? AMD_DBGAPI_PROGRESS_NORMAL
+ : AMD_DBGAPI_PROGRESS_NO_FORWARD));
gdb_assert (status == AMD_DBGAPI_STATUS_SUCCESS);
info->forward_progress_required = require;
@@ -407,28 +396,29 @@ amd_dbgapi_target_breakpoint::check_status (struct bpstat *bs)
/* Find the address the breakpoint is set at. */
auto match_breakpoint
- = [bs] (const decltype (info->breakpoint_map)::value_type &value)
- { return value.second == bs->breakpoint_at; };
- auto it
- = std::find_if (info->breakpoint_map.begin (), info->breakpoint_map.end (),
- match_breakpoint);
+ = [bs] (const decltype (info->breakpoint_map)::value_type &value) {
+ return value.second == bs->breakpoint_at;
+ };
+ auto it = std::find_if (info->breakpoint_map.begin (),
+ info->breakpoint_map.end (), match_breakpoint);
if (it == info->breakpoint_map.end ())
- error (_("Could not find breakpoint_id for breakpoint at %s"),
+ error (_ ("Could not find breakpoint_id for breakpoint at %s"),
paddress (inf->gdbarch, bs->bp_location_at->address));
amd_dbgapi_breakpoint_id_t breakpoint_id { it->first };
amd_dbgapi_breakpoint_action_t action;
- status = amd_dbgapi_report_breakpoint_hit
- (breakpoint_id,
- reinterpret_cast<amd_dbgapi_client_thread_id_t> (inferior_thread ()),
- &action);
+ status = amd_dbgapi_report_breakpoint_hit (
+ breakpoint_id,
+ reinterpret_cast<amd_dbgapi_client_thread_id_t> (inferior_thread ()),
+ &action);
if (status != AMD_DBGAPI_STATUS_SUCCESS)
- error (_("amd_dbgapi_report_breakpoint_hit failed for breakpoint %ld "
- "at %s (%s)"),
- breakpoint_id.handle, paddress (inf->gdbarch, bs->bp_location_at->address),
+ error (_ ("amd_dbgapi_report_breakpoint_hit failed for breakpoint %ld "
+ "at %s (%s)"),
+ breakpoint_id.handle,
+ paddress (inf->gdbarch, bs->bp_location_at->address),
get_status_string (status));
if (action == AMD_DBGAPI_BREAKPOINT_ACTION_RESUME)
@@ -451,13 +441,14 @@ amd_dbgapi_target_breakpoint::check_status (struct bpstat *bs)
&resume_breakpoint_id);
if (status != AMD_DBGAPI_STATUS_SUCCESS)
- error (_("amd_dbgapi_event_get_info failed (%s)"), get_status_string (status));
+ error (_ ("amd_dbgapi_event_get_info failed (%s)"),
+ get_status_string (status));
/* The debugger API guarantees that [breakpoint_hit...resume_breakpoint]
sequences cannot interleave, so this breakpoint resume event must be
for our breakpoint_id. */
if (resume_breakpoint_id != breakpoint_id)
- error (_("breakpoint resume event is not for this breakpoint. "
+ error (_ ("breakpoint resume event is not for this breakpoint. "
"Expected breakpoint_%ld, got breakpoint_%ld"),
breakpoint_id.handle, resume_breakpoint_id.handle);
@@ -509,9 +500,9 @@ amd_dbgapi_target::extra_thread_info (thread_info *tp)
target_xfer_status
amd_dbgapi_target::xfer_partial (enum target_object object, const char *annex,
- gdb_byte *readbuf, const gdb_byte *writebuf,
- ULONGEST offset, ULONGEST requested_len,
- ULONGEST *xfered_len)
+ gdb_byte *readbuf, const gdb_byte *writebuf,
+ ULONGEST offset, ULONGEST requested_len,
+ ULONGEST *xfered_len)
{
gdb::optional<scoped_restore_current_thread> maybe_restore_thread;
@@ -534,12 +525,12 @@ amd_dbgapi_target::xfer_partial (enum target_object object, const char *annex,
if (readbuf != nullptr)
status = amd_dbgapi_read_memory (process_id, wave_id, 0,
- AMD_DBGAPI_ADDRESS_SPACE_GLOBAL,
- offset, &len, readbuf);
+ AMD_DBGAPI_ADDRESS_SPACE_GLOBAL, offset,
+ &len, readbuf);
else
status = amd_dbgapi_write_memory (process_id, wave_id, 0,
- AMD_DBGAPI_ADDRESS_SPACE_GLOBAL,
- offset, &len, writebuf);
+ AMD_DBGAPI_ADDRESS_SPACE_GLOBAL, offset,
+ &len, writebuf);
if (status != AMD_DBGAPI_STATUS_SUCCESS)
return TARGET_XFER_E_IO;
@@ -560,7 +551,8 @@ amd_dbgapi_target::stopped_by_watchpoint ()
void
amd_dbgapi_target::resume (ptid_t scope_ptid, int step, enum gdb_signal signo)
{
- amd_dbgapi_debug_printf ("scope_ptid = %s", scope_ptid.to_string ().c_str ());
+ amd_dbgapi_debug_printf ("scope_ptid = %s",
+ scope_ptid.to_string ().c_str ());
/* The amd_dbgapi_exceptions_t matching SIGNO will only be used if the
thread which is the target of the signal SIGNO is a GPU thread. If so,
@@ -593,7 +585,7 @@ amd_dbgapi_target::resume (ptid_t scope_ptid, int step, enum gdb_signal signo)
exception = AMD_DBGAPI_EXCEPTION_NONE;
break;
default:
- error (_("Resuming with signal %s is not supported by this agent."),
+ error (_ ("Resuming with signal %s is not supported by this agent."),
gdb_signal_to_name (signo));
}
}
@@ -620,21 +612,22 @@ amd_dbgapi_target::resume (ptid_t scope_ptid, int step, enum gdb_signal signo)
amd_dbgapi_wave_id_t wave_id = get_amd_dbgapi_wave_id (thread->ptid);
amd_dbgapi_status_t status;
if (thread->ptid == inferior_ptid)
- status = amd_dbgapi_wave_resume (wave_id,
- (step
- ? AMD_DBGAPI_RESUME_MODE_SINGLE_STEP
+ status
+ = amd_dbgapi_wave_resume (wave_id,
+ (step ? AMD_DBGAPI_RESUME_MODE_SINGLE_STEP
: AMD_DBGAPI_RESUME_MODE_NORMAL),
- exception);
+ exception);
else
- status = amd_dbgapi_wave_resume (wave_id, AMD_DBGAPI_RESUME_MODE_NORMAL,
- AMD_DBGAPI_EXCEPTION_NONE);
+ status
+ = amd_dbgapi_wave_resume (wave_id, AMD_DBGAPI_RESUME_MODE_NORMAL,
+ AMD_DBGAPI_EXCEPTION_NONE);
if (status != AMD_DBGAPI_STATUS_SUCCESS
/* Ignore the error that wave is no longer valid as that could
indicate that the process has exited. GDB treats resuming a
thread that no longer exists as being successful. */
&& status != AMD_DBGAPI_STATUS_ERROR_INVALID_WAVE_ID)
- error (_("wave_resume for wave_%ld failed (%s)"), wave_id.handle,
+ error (_ ("wave_resume for wave_%ld failed (%s)"), wave_id.handle,
get_status_string (status));
}
}
@@ -666,48 +659,48 @@ amd_dbgapi_target::stop (ptid_t ptid)
return;
}
- auto stop_one_thread = [this] (thread_info *thread)
- {
- gdb_assert (thread != nullptr);
+ auto stop_one_thread = [this] (thread_info *thread) {
+ gdb_assert (thread != nullptr);
- amd_dbgapi_wave_id_t wave_id = get_amd_dbgapi_wave_id (thread->ptid);
- amd_dbgapi_wave_state_t state;
- amd_dbgapi_status_t status
- = amd_dbgapi_wave_get_info (wave_id, AMD_DBGAPI_WAVE_INFO_STATE,
- sizeof (state), &state);
- if (status == AMD_DBGAPI_STATUS_SUCCESS)
- {
- /* If the wave is already known to be stopped then do nothing. */
- if (state == AMD_DBGAPI_WAVE_STATE_STOP)
- return;
+ amd_dbgapi_wave_id_t wave_id = get_amd_dbgapi_wave_id (thread->ptid);
+ amd_dbgapi_wave_state_t state;
+ amd_dbgapi_status_t status
+ = amd_dbgapi_wave_get_info (wave_id, AMD_DBGAPI_WAVE_INFO_STATE,
+ sizeof (state), &state);
+ if (status == AMD_DBGAPI_STATUS_SUCCESS)
+ {
+ /* If the wave is already known to be stopped then do nothing. */
+ if (state == AMD_DBGAPI_WAVE_STATE_STOP)
+ return;
- status = amd_dbgapi_wave_stop (wave_id);
- if (status == AMD_DBGAPI_STATUS_SUCCESS)
- return;
+ status = amd_dbgapi_wave_stop (wave_id);
+ if (status == AMD_DBGAPI_STATUS_SUCCESS)
+ return;
- if (status != AMD_DBGAPI_STATUS_ERROR_INVALID_WAVE_ID)
- error (_("wave_stop for wave_%ld failed (%s)"), wave_id.handle,
- get_status_string (status));
- }
- else if (status != AMD_DBGAPI_STATUS_ERROR_INVALID_WAVE_ID)
- error (_("wave_get_info for wave_%ld failed (%s)"), wave_id.handle,
- get_status_string (status));
+ if (status != AMD_DBGAPI_STATUS_ERROR_INVALID_WAVE_ID)
+ error (_ ("wave_stop for wave_%ld failed (%s)"), wave_id.handle,
+ get_status_string (status));
+ }
+ else if (status != AMD_DBGAPI_STATUS_ERROR_INVALID_WAVE_ID)
+ error (_ ("wave_get_info for wave_%ld failed (%s)"), wave_id.handle,
+ get_status_string (status));
- /* The status is AMD_DBGAPI_STATUS_ERROR_INVALID_WAVE_ID. The wave
+ /* The status is AMD_DBGAPI_STATUS_ERROR_INVALID_WAVE_ID. The wave
could have terminated since the last time the wave list was
refreshed. */
- if (m_report_thread_events)
- {
- get_amd_dbgapi_inferior_info (thread->inf)->wave_events.emplace_back
- (thread->ptid, target_waitstatus ().set_thread_exited (0));
+ if (m_report_thread_events)
+ {
+ get_amd_dbgapi_inferior_info (thread->inf)
+ ->wave_events.emplace_back (
+ thread->ptid, target_waitstatus ().set_thread_exited (0));
- if (target_is_async_p ())
- async_event_handler_mark ();
- }
+ if (target_is_async_p ())
+ async_event_handler_mark ();
+ }
- delete_thread_silent (thread);
- };
+ delete_thread_silent (thread);
+ };
process_stratum_target *proc_target = current_inferior ()->process_target ();
@@ -751,13 +744,14 @@ struct scoped_amd_dbgapi_event_processed
{
amd_dbgapi_status_t status = amd_dbgapi_event_processed (m_event_id);
if (status != AMD_DBGAPI_STATUS_SUCCESS)
- warning (_("Failed to acknowledge amd-dbgapi event %" PRIu64),
+ warning (_ ("Failed to acknowledge amd-dbgapi event %" PRIu64),
m_event_id.handle);
}
DISABLE_COPY_AND_ASSIGN (scoped_amd_dbgapi_event_processed);
private:
+
amd_dbgapi_event_id_t m_event_id;
};
@@ -798,7 +792,8 @@ dbgapi_notifier_handler (int err, gdb_client_data client_data)
= amd_dbgapi_process_next_pending_event (info->process_id, &event_id,
&event_kind);
if (status != AMD_DBGAPI_STATUS_SUCCESS)
- error (_("next_pending_event failed (%s)"), get_status_string (status));
+ error (_ ("next_pending_event failed (%s)"),
+ get_status_string (status));
if (event_id == AMD_DBGAPI_EVENT_NONE)
return;
@@ -808,18 +803,19 @@ dbgapi_notifier_handler (int err, gdb_client_data client_data)
scoped_amd_dbgapi_event_processed mark_event_processed (event_id);
amd_dbgapi_runtime_state_t runtime_state;
- status = amd_dbgapi_event_get_info (event_id,
- AMD_DBGAPI_EVENT_INFO_RUNTIME_STATE,
- sizeof (runtime_state),
- &runtime_state);
+ status
+ = amd_dbgapi_event_get_info (event_id,
+ AMD_DBGAPI_EVENT_INFO_RUNTIME_STATE,
+ sizeof (runtime_state), &runtime_state);
if (status != AMD_DBGAPI_STATUS_SUCCESS)
- error (_("event_get_info for event_%ld failed (%s)"),
- event_id.handle, get_status_string (status));
+ error (_ ("event_get_info for event_%ld failed (%s)"), event_id.handle,
+ get_status_string (status));
switch (runtime_state)
{
case AMD_DBGAPI_RUNTIME_STATE_LOADED_SUCCESS:
- gdb_assert (info->runtime_state == AMD_DBGAPI_RUNTIME_STATE_UNLOADED);
+ gdb_assert (info->runtime_state
+ == AMD_DBGAPI_RUNTIME_STATE_UNLOADED);
info->runtime_state = runtime_state;
amd_dbgapi_debug_printf ("pushing amd-dbgapi target");
info->inf->push_target (&the_amd_dbgapi_target);
@@ -843,10 +839,11 @@ dbgapi_notifier_handler (int err, gdb_client_data client_data)
break;
case AMD_DBGAPI_RUNTIME_STATE_LOADED_ERROR_RESTRICTION:
- gdb_assert (info->runtime_state == AMD_DBGAPI_RUNTIME_STATE_UNLOADED);
+ gdb_assert (info->runtime_state
+ == AMD_DBGAPI_RUNTIME_STATE_UNLOADED);
info->runtime_state = runtime_state;
- warning (_("amd-dbgapi: unable to enable GPU debugging "
- "due to a restriction error"));
+ warning (_ ("amd-dbgapi: unable to enable GPU debugging "
+ "due to a restriction error"));
break;
}
}
@@ -911,7 +908,7 @@ amd_dbgapi_target::async (bool enable)
static ptid_t
make_gpu_ptid (ptid_t::pid_type pid, amd_dbgapi_wave_id_t wave_id)
{
- return ptid_t (pid, 1, wave_id.handle);
+ return ptid_t (pid, 1, wave_id.handle);
}
/* Process an event that was just pulled out of the amd-dbgapi library. */
@@ -928,15 +925,15 @@ process_one_event (amd_dbgapi_event_id_t event_id,
= amd_dbgapi_event_get_info (event_id, AMD_DBGAPI_EVENT_INFO_PROCESS,
sizeof (process_id), &process_id);
if (status != AMD_DBGAPI_STATUS_SUCCESS)
- error (_("event_get_info for event_%ld failed (%s)"), event_id.handle,
+ error (_ ("event_get_info for event_%ld failed (%s)"), event_id.handle,
get_status_string (status));
amd_dbgapi_os_process_id_t pid;
- status = amd_dbgapi_process_get_info (process_id,
- AMD_DBGAPI_PROCESS_INFO_OS_ID,
- sizeof (pid), &pid);
+ status
+ = amd_dbgapi_process_get_info (process_id, AMD_DBGAPI_PROCESS_INFO_OS_ID,
+ sizeof (pid), &pid);
if (status != AMD_DBGAPI_STATUS_SUCCESS)
- error (_("process_get_info for process_%ld failed (%s)"),
+ error (_ ("process_get_info for process_%ld failed (%s)"),
process_id.handle, get_status_string (status));
auto *proc_target = current_inferior ()->process_target ();
@@ -954,7 +951,7 @@ process_one_event (amd_dbgapi_event_id_t event_id,
= amd_dbgapi_event_get_info (event_id, AMD_DBGAPI_EVENT_INFO_WAVE,
sizeof (wave_id), &wave_id);
if (status != AMD_DBGAPI_STATUS_SUCCESS)
- error (_("event_get_info for event_%ld failed (%s)"),
+ error (_ ("event_get_info for event_%ld failed (%s)"),
event_id.handle, get_status_string (status));
ptid_t event_ptid = make_gpu_ptid (pid, wave_id);
@@ -1025,8 +1022,8 @@ process_one_event (amd_dbgapi_event_id_t event_id,
}
}
else
- error (_("wave_get_info for wave_%ld failed (%s)"),
- wave_id.handle, get_status_string (status));
+ error (_ ("wave_get_info for wave_%ld failed (%s)"), wave_id.handle,
+ get_status_string (status));
info->wave_events.emplace_back (event_ptid, ws);
break;
@@ -1060,17 +1057,17 @@ process_one_event (amd_dbgapi_event_id_t event_id,
{
amd_dbgapi_runtime_state_t runtime_state;
- status = amd_dbgapi_event_get_info (event_id,
- AMD_DBGAPI_EVENT_INFO_RUNTIME_STATE,
- sizeof (runtime_state),
- &runtime_state);
+ status
+ = amd_dbgapi_event_get_info (event_id,
+ AMD_DBGAPI_EVENT_INFO_RUNTIME_STATE,
+ sizeof (runtime_state), &runtime_state);
if (status != AMD_DBGAPI_STATUS_SUCCESS)
- error (_("event_get_info for event_%ld failed (%s)"),
+ error (_ ("event_get_info for event_%ld failed (%s)"),
event_id.handle, get_status_string (status));
gdb_assert (runtime_state == AMD_DBGAPI_RUNTIME_STATE_UNLOADED);
- gdb_assert
- (info->runtime_state == AMD_DBGAPI_RUNTIME_STATE_LOADED_SUCCESS);
+ gdb_assert (info->runtime_state
+ == AMD_DBGAPI_RUNTIME_STATE_LOADED_SUCCESS);
info->runtime_state = runtime_state;
@@ -1080,7 +1077,7 @@ process_one_event (amd_dbgapi_event_id_t event_id,
break;
default:
- error (_("event kind (%d) not supported"), event_kind);
+ error (_ ("event kind (%d) not supported"), event_kind);
}
}
@@ -1141,14 +1138,14 @@ process_event_queue (amd_dbgapi_process_id_t process_id,
&event_kind);
if (status != AMD_DBGAPI_STATUS_SUCCESS)
- error (_("next_pending_event failed (%s)"), get_status_string (status));
+ error (_ ("next_pending_event failed (%s)"),
+ get_status_string (status));
if (event_kind != AMD_DBGAPI_EVENT_KIND_NONE)
amd_dbgapi_debug_printf ("Pulled event from dbgapi: "
"event_id.handle = %" PRIu64 ", "
"event_kind = %s",
- event_id.handle,
- event_kind_str (event_kind));
+ event_id.handle, event_kind_str (event_kind));
if (event_id == AMD_DBGAPI_EVENT_NONE || event_kind == until_event_kind)
return event_id;
@@ -1207,7 +1204,7 @@ consume_one_event (int pid)
ptid_t
amd_dbgapi_target::wait (ptid_t ptid, struct target_waitstatus *ws,
- target_wait_flags target_options)
+ target_wait_flags target_options)
{
gdb_assert (!current_inferior ()->process_target ()->commit_resumed_state);
gdb_assert (ptid == minus_one_ptid || ptid.is_pid ());
@@ -1219,12 +1216,11 @@ amd_dbgapi_target::wait (ptid_t ptid, struct target_waitstatus *ws,
{
if (ws->kind () == TARGET_WAITKIND_EXITED
|| ws->kind () == TARGET_WAITKIND_SIGNALLED)
- {
- /* This inferior has exited so drain its dbgapi event queue. */
- while (consume_one_event (event_ptid.pid ()).first
- != minus_one_ptid)
- ;
- }
+ {
+ /* This inferior has exited so drain its dbgapi event queue. */
+ while (consume_one_event (event_ptid.pid ()).first != minus_one_ptid)
+ ;
+ }
return event_ptid;
}
@@ -1239,11 +1235,10 @@ amd_dbgapi_target::wait (ptid_t ptid, struct target_waitstatus *ws,
that we need to fetch from dbgapi. Mark the async event handler so that
amd_dbgapi_target::wait gets called again and again, until it eventually
returns minus_one_ptid. */
- auto more_events = make_scope_exit ([] ()
- {
- if (target_is_async_p ())
- async_event_handler_mark ();
- });
+ auto more_events = make_scope_exit ([] () {
+ if (target_is_async_p ())
+ async_event_handler_mark ();
+ });
auto *proc_target = current_inferior ()->process_target ();
@@ -1338,8 +1333,8 @@ attach_amd_dbgapi (inferior *inf)
if (!target_can_async_p ())
{
- warning (_("The amd-dbgapi target requires the target beneath to be "
- "asynchronous, GPU debugging is disabled"));
+ warning (_ ("The amd-dbgapi target requires the target beneath to be "
+ "asynchronous, GPU debugging is disabled"));
return;
}
@@ -1348,26 +1343,24 @@ attach_amd_dbgapi (inferior *inf)
/* Are we already attached? */
if (info->process_id != AMD_DBGAPI_PROCESS_NONE)
{
- amd_dbgapi_debug_printf
- ("already attached: process_id = %" PRIu64, info->process_id.handle);
+ amd_dbgapi_debug_printf ("already attached: process_id = %" PRIu64,
+ info->process_id.handle);
return;
}
- amd_dbgapi_status_t status
- = amd_dbgapi_process_attach
- (reinterpret_cast<amd_dbgapi_client_process_id_t> (inf),
- &info->process_id);
+ amd_dbgapi_status_t status = amd_dbgapi_process_attach (
+ reinterpret_cast<amd_dbgapi_client_process_id_t> (inf), &info->process_id);
if (status == AMD_DBGAPI_STATUS_ERROR_RESTRICTION)
{
- warning (_("amd-dbgapi: unable to enable GPU debugging due to a "
- "restriction error"));
+ warning (_ ("amd-dbgapi: unable to enable GPU debugging due to a "
+ "restriction error"));
return;
}
else if (status != AMD_DBGAPI_STATUS_SUCCESS)
{
- warning (_("amd-dbgapi: could not attach to process %d (%s), GPU "
- "debugging will not be available."), inf->pid,
- get_status_string (status));
+ warning (_ ("amd-dbgapi: could not attach to process %d (%s), GPU "
+ "debugging will not be available."),
+ inf->pid, get_status_string (status));
return;
}
@@ -1378,8 +1371,9 @@ attach_amd_dbgapi (inferior *inf)
{
amd_dbgapi_process_detach (info->process_id);
info->process_id = AMD_DBGAPI_PROCESS_NONE;
- warning (_("amd-dbgapi: could not retrieve process %d's notifier, GPU "
- "debugging will not be available."), inf->pid);
+ warning (_ ("amd-dbgapi: could not retrieve process %d's notifier, GPU "
+ "debugging will not be available."),
+ inf->pid);
return;
}
@@ -1417,8 +1411,8 @@ detach_amd_dbgapi (inferior *inf)
amd_dbgapi_status_t status = amd_dbgapi_process_detach (info->process_id);
if (status != AMD_DBGAPI_STATUS_SUCCESS)
- warning (_("amd-dbgapi: could not detach from process %d (%s)"),
- inf->pid, get_status_string (status));
+ warning (_ ("amd-dbgapi: could not detach from process %d (%s)"), inf->pid,
+ get_status_string (status));
gdb_assert (info->notifier != -1);
delete_file_handler (info->notifier);
@@ -1481,7 +1475,7 @@ amd_dbgapi_target::fetch_registers (struct regcache *regcache, int regno)
if (status == AMD_DBGAPI_STATUS_SUCCESS)
regcache->raw_supply (regno, raw);
else if (status != AMD_DBGAPI_STATUS_ERROR_REGISTER_NOT_AVAILABLE)
- warning (_("Couldn't read register %s (#%d) (%s)."),
+ warning (_ ("Couldn't read register %s (#%d) (%s)."),
gdbarch_register_name (gdbarch, regno), regno,
get_status_string (status));
}
@@ -1516,7 +1510,8 @@ amd_dbgapi_target::store_registers (struct regcache *regcache, int regno)
& AMD_DBGAPI_REGISTER_PROPERTY_INVALIDATE_VOLATILE)
{
for (size_t r = 0; r < tdep->register_properties.size (); ++r)
- if (tdep->register_properties[r] & AMD_DBGAPI_REGISTER_PROPERTY_VOLATILE)
+ if (tdep->register_properties[r]
+ & AMD_DBGAPI_REGISTER_PROPERTY_VOLATILE)
regcache->invalidate (r);
}
@@ -1527,7 +1522,7 @@ amd_dbgapi_target::store_registers (struct regcache *regcache, int regno)
raw);
if (status != AMD_DBGAPI_STATUS_SUCCESS)
- warning (_("Couldn't write register %s (#%d)."),
+ warning (_ ("Couldn't write register %s (#%d)."),
gdbarch_register_name (gdbarch, regno), regno);
}
@@ -1546,18 +1541,18 @@ amd_dbgapi_target::thread_architecture (ptid_t ptid)
amd_dbgapi_architecture_id_t architecture_id;
amd_dbgapi_status_t status;
- status = amd_dbgapi_wave_get_info (wave_id, AMD_DBGAPI_WAVE_INFO_ARCHITECTURE,
- sizeof (architecture_id),
- &architecture_id);
+ status
+ = amd_dbgapi_wave_get_info (wave_id, AMD_DBGAPI_WAVE_INFO_ARCHITECTURE,
+ sizeof (architecture_id), &architecture_id);
if (status != AMD_DBGAPI_STATUS_SUCCESS)
- error (_("Couldn't get architecture for wave_%ld"), ptid.tid ());
+ error (_ ("Couldn't get architecture for wave_%ld"), ptid.tid ());
uint32_t elf_amdgpu_machine;
- status = amd_dbgapi_architecture_get_info
- (architecture_id, AMD_DBGAPI_ARCHITECTURE_INFO_ELF_AMDGPU_MACHINE,
- sizeof (elf_amdgpu_machine), &elf_amdgpu_machine);
+ status = amd_dbgapi_architecture_get_info (
+ architecture_id, AMD_DBGAPI_ARCHITECTURE_INFO_ELF_AMDGPU_MACHINE,
+ sizeof (elf_amdgpu_machine), &elf_amdgpu_machine);
if (status != AMD_DBGAPI_STATUS_SUCCESS)
- error (_("Couldn't get elf_amdgpu_machine for architecture_%ld"),
+ error (_ ("Couldn't get elf_amdgpu_machine for architecture_%ld"),
architecture_id.handle);
struct gdbarch_info info;
@@ -1567,7 +1562,7 @@ amd_dbgapi_target::thread_architecture (ptid_t ptid)
m_cached_arch_tid = ptid.tid ();
m_cached_arch = gdbarch_find_by_info (info);
if (m_cached_arch == nullptr)
- error (_("Couldn't get elf_amdgpu_machine (%#x)"), elf_amdgpu_machine);
+ error (_ ("Couldn't get elf_amdgpu_machine (%#x)"), elf_amdgpu_machine);
return m_cached_arch;
}
@@ -1584,8 +1579,7 @@ amd_dbgapi_target::update_thread_list ()
{
for (inferior *inf : all_inferiors ())
{
- amd_dbgapi_process_id_t process_id
- = get_amd_dbgapi_process_id (inf);
+ amd_dbgapi_process_id_t process_id = get_amd_dbgapi_process_id (inf);
if (process_id == AMD_DBGAPI_PROCESS_NONE)
{
/* The inferior may not be attached yet. */
@@ -1599,7 +1593,7 @@ amd_dbgapi_target::update_thread_list ()
= amd_dbgapi_process_wave_list (process_id, &count, &wave_list,
&changed);
if (status != AMD_DBGAPI_STATUS_SUCCESS)
- error (_("amd_dbgapi_wave_list failed (%s)"),
+ error (_ ("amd_dbgapi_wave_list failed (%s)"),
get_status_string (status));
if (changed == AMD_DBGAPI_CHANGED_NO)
@@ -1630,7 +1624,7 @@ amd_dbgapi_target::update_thread_list ()
for (ptid_t::tid_type tid : threads)
{
ptid_t wave_ptid
- = make_gpu_ptid (inf->pid, amd_dbgapi_wave_id_t {tid});
+ = make_gpu_ptid (inf->pid, amd_dbgapi_wave_id_t { tid });
add_thread_silent (inf->process_target (), wave_ptid);
set_running (inf->process_target (), wave_ptid, true);
@@ -1681,8 +1675,8 @@ amd_dbgapi_inferior_pre_detach (inferior *inf)
/* get_os_pid callback. */
static amd_dbgapi_status_t
-amd_dbgapi_get_os_pid_callback
- (amd_dbgapi_client_process_id_t client_process_id, pid_t *pid)
+amd_dbgapi_get_os_pid_callback (
+ amd_dbgapi_client_process_id_t client_process_id, pid_t *pid)
{
inferior *inf = reinterpret_cast<inferior *> (client_process_id);
@@ -1696,10 +1690,10 @@ amd_dbgapi_get_os_pid_callback
/* insert_breakpoint callback. */
static amd_dbgapi_status_t
-amd_dbgapi_insert_breakpoint_callback
- (amd_dbgapi_client_process_id_t client_process_id,
- amd_dbgapi_global_address_t address,
- amd_dbgapi_breakpoint_id_t breakpoint_id)
+amd_dbgapi_insert_breakpoint_callback (
+ amd_dbgapi_client_process_id_t client_process_id,
+ amd_dbgapi_global_address_t address,
+ amd_dbgapi_breakpoint_id_t breakpoint_id)
{
inferior *inf = reinterpret_cast<inferior *> (client_process_id);
struct amd_dbgapi_inferior_info *info = get_amd_dbgapi_inferior_info (inf);
@@ -1717,8 +1711,8 @@ amd_dbgapi_insert_breakpoint_callback
if (section == nullptr || section->objfile == nullptr)
return AMD_DBGAPI_STATUS_ERROR;
- std::unique_ptr<breakpoint> bp_up
- (new amd_dbgapi_target_breakpoint (section->objfile->arch (), address));
+ std::unique_ptr<breakpoint> bp_up (
+ new amd_dbgapi_target_breakpoint (section->objfile->arch (), address));
breakpoint *bp = install_breakpoint (true, std::move (bp_up), 1);
@@ -1729,9 +1723,9 @@ amd_dbgapi_insert_breakpoint_callback
/* remove_breakpoint callback. */
static amd_dbgapi_status_t
-amd_dbgapi_remove_breakpoint_callback
- (amd_dbgapi_client_process_id_t client_process_id,
- amd_dbgapi_breakpoint_id_t breakpoint_id)
+amd_dbgapi_remove_breakpoint_callback (
+ amd_dbgapi_client_process_id_t client_process_id,
+ amd_dbgapi_breakpoint_id_t breakpoint_id)
{
inferior *inf = reinterpret_cast<inferior *> (client_process_id);
struct amd_dbgapi_inferior_info *info = get_amd_dbgapi_inferior_info (inf);
@@ -1748,14 +1742,14 @@ amd_dbgapi_remove_breakpoint_callback
/* Style for some kinds of messages. */
-static cli_style_option fatal_error_style
- ("amd_dbgapi_fatal_error", ui_file_style::RED);
-static cli_style_option warning_style
- ("amd_dbgapi_warning", ui_file_style::YELLOW);
+static cli_style_option fatal_error_style ("amd_dbgapi_fatal_error",
+ ui_file_style::RED);
+static cli_style_option warning_style ("amd_dbgapi_warning",
+ ui_file_style::YELLOW);
/* BLACK + BOLD means dark gray. */
-static cli_style_option trace_style
- ("amd_dbgapi_trace", ui_file_style::BLACK, ui_file_style::BOLD);
+static cli_style_option trace_style ("amd_dbgapi_trace", ui_file_style::BLACK,
+ ui_file_style::BOLD);
/* log_message callback. */
@@ -1776,8 +1770,10 @@ amd_dbgapi_log_message_callback (amd_dbgapi_log_level_t level,
|| level == AMD_DBGAPI_LOG_LEVEL_WARNING)
{
begin_line ();
- ui_file_style style = (level == AMD_DBGAPI_LOG_LEVEL_FATAL_ERROR
- ? fatal_error_style : warning_style).style ();
+ ui_file_style style
+ = (level == AMD_DBGAPI_LOG_LEVEL_FATAL_ERROR ? fatal_error_style
+ : warning_style)
+ .style ();
gdb_printf (gdb_stderr, "%ps\n", styled_string (style, message));
return;
}
@@ -1820,8 +1816,7 @@ struct cmd_list_element *show_debug_amd_dbgapi_lib_list;
/* Mapping from amd-dbgapi log level enum values to text. */
-static constexpr const char *debug_amd_dbgapi_lib_log_level_enums[] =
-{
+static constexpr const char *debug_amd_dbgapi_lib_log_level_enums[] = {
/* [AMD_DBGAPI_LOG_LEVEL_NONE] = */ "off",
/* [AMD_DBGAPI_LOG_LEVEL_FATAL_ERROR] = */ "error",
/* [AMD_DBGAPI_LOG_LEVEL_WARNING] = */ "warning",
@@ -1841,8 +1836,7 @@ static const char *debug_amd_dbgapi_lib_log_level
static amd_dbgapi_log_level_t
get_debug_amd_dbgapi_lib_log_level ()
{
- for (size_t pos = 0;
- debug_amd_dbgapi_lib_log_level_enums[pos] != nullptr;
+ for (size_t pos = 0; debug_amd_dbgapi_lib_log_level_enums[pos] != nullptr;
++pos)
if (debug_amd_dbgapi_lib_log_level
== debug_amd_dbgapi_lib_log_level_enums[pos])
@@ -1868,7 +1862,7 @@ show_debug_amd_dbgapi_lib_log_level (struct ui_file *file, int from_tty,
struct cmd_list_element *c,
const char *value)
{
- gdb_printf (file, _("The amd-dbgapi library log level is %s.\n"), value);
+ gdb_printf (file, _ ("The amd-dbgapi library log level is %s.\n"), value);
}
/* If the amd-dbgapi library is not attached to any process, finalize and
@@ -1888,12 +1882,12 @@ maybe_reset_amd_dbgapi ()
amd_dbgapi_status_t status = amd_dbgapi_finalize ();
if (status != AMD_DBGAPI_STATUS_SUCCESS)
- error (_("amd-dbgapi failed to finalize (%s)"),
+ error (_ ("amd-dbgapi failed to finalize (%s)"),
get_status_string (status));
status = amd_dbgapi_initialize (&dbgapi_callbacks);
if (status != AMD_DBGAPI_STATUS_SUCCESS)
- error (_("amd-dbgapi failed to initialize (%s)"),
+ error (_ ("amd-dbgapi failed to initialize (%s)"),
get_status_string (status));
}
@@ -1907,60 +1901,57 @@ _initialize_amd_dbgapi_target ()
uint32_t major, minor, patch;
amd_dbgapi_get_version (&major, &minor, &patch);
if (major != AMD_DBGAPI_VERSION_MAJOR || minor < AMD_DBGAPI_VERSION_MINOR)
- error (_("amd-dbgapi library version mismatch, got %d.%d.%d, need %d.%d+"),
- major, minor, patch, AMD_DBGAPI_VERSION_MAJOR,
- AMD_DBGAPI_VERSION_MINOR);
+ error (
+ _ ("amd-dbgapi library version mismatch, got %d.%d.%d, need %d.%d+"),
+ major, minor, patch, AMD_DBGAPI_VERSION_MAJOR, AMD_DBGAPI_VERSION_MINOR);
/* Initialize the AMD Debugger API. */
amd_dbgapi_status_t status = amd_dbgapi_initialize (&dbgapi_callbacks);
if (status != AMD_DBGAPI_STATUS_SUCCESS)
- error (_("amd-dbgapi failed to initialize (%s)"),
+ error (_ ("amd-dbgapi failed to initialize (%s)"),
get_status_string (status));
/* Set the initial log level. */
amd_dbgapi_set_log_level (get_debug_amd_dbgapi_lib_log_level ());
/* Install observers. */
- gdb::observers::inferior_created.attach
- (amd_dbgapi_target_inferior_created,
- amd_dbgapi_target_inferior_created_observer_token, "amd-dbgapi");
- gdb::observers::inferior_exit.attach (amd_dbgapi_inferior_exited, "amd-dbgapi");
- gdb::observers::inferior_pre_detach.attach (amd_dbgapi_inferior_pre_detach, "amd-dbgapi");
+ gdb::observers::inferior_created.attach (
+ amd_dbgapi_target_inferior_created,
+ amd_dbgapi_target_inferior_created_observer_token, "amd-dbgapi");
+ gdb::observers::inferior_exit.attach (amd_dbgapi_inferior_exited,
+ "amd-dbgapi");
+ gdb::observers::inferior_pre_detach.attach (amd_dbgapi_inferior_pre_detach,
+ "amd-dbgapi");
add_basic_prefix_cmd ("amd-dbgapi-lib", no_class,
- _("Generic command for setting amd-dbgapi library "
- "debugging flags."),
+ _ ("Generic command for setting amd-dbgapi library "
+ "debugging flags."),
&set_debug_amd_dbgapi_lib_list, 0, &setdebuglist);
add_show_prefix_cmd ("amd-dbgapi-lib", no_class,
- _("Generic command for showing amd-dbgapi library "
- "debugging flags."),
+ _ ("Generic command for showing amd-dbgapi library "
+ "debugging flags."),
&show_debug_amd_dbgapi_lib_list, 0, &showdebuglist);
- add_setshow_enum_cmd ("log-level", class_maintenance,
- debug_amd_dbgapi_lib_log_level_enums,
- &debug_amd_dbgapi_lib_log_level,
- _("Set the amd-dbgapi library log level."),
- _("Show the amd-dbgapi library log level."),
- _("off == no logging is enabled\n"
- "error == fatal errors are reported\n"
- "warning == fatal errors and warnings are reported\n"
- "info == fatal errors, warnings, and info "
- "messages are reported\n"
- "trace == fatal errors, warnings, info, and "
- "API tracing messages are reported\n"
- "verbose == all messages are reported"),
- set_debug_amd_dbgapi_lib_log_level,
- show_debug_amd_dbgapi_lib_log_level,
- &set_debug_amd_dbgapi_lib_list,
- &show_debug_amd_dbgapi_lib_list);
-
- add_setshow_boolean_cmd ("amd-dbgapi", class_maintenance,
- &debug_amd_dbgapi,
- _("Set debugging of amd-dbgapi target."),
- _("Show debugging of amd-dbgapi target."),
- _("\
+ add_setshow_enum_cmd (
+ "log-level", class_maintenance, debug_amd_dbgapi_lib_log_level_enums,
+ &debug_amd_dbgapi_lib_log_level,
+ _ ("Set the amd-dbgapi library log level."),
+ _ ("Show the amd-dbgapi library log level."),
+ _ ("off == no logging is enabled\n"
+ "error == fatal errors are reported\n"
+ "warning == fatal errors and warnings are reported\n"
+ "info == fatal errors, warnings, and info "
+ "messages are reported\n"
+ "trace == fatal errors, warnings, info, and "
+ "API tracing messages are reported\n"
+ "verbose == all messages are reported"),
+ set_debug_amd_dbgapi_lib_log_level, show_debug_amd_dbgapi_lib_log_level,
+ &set_debug_amd_dbgapi_lib_list, &show_debug_amd_dbgapi_lib_list);
+
+ add_setshow_boolean_cmd ("amd-dbgapi", class_maintenance, &debug_amd_dbgapi,
+ _ ("Set debugging of amd-dbgapi target."),
+ _ ("Show debugging of amd-dbgapi target."), _ ("\
When on, print debug messages relating to the amd-dbgapi target."),
- nullptr, nullptr,
- &setdebuglist, &showdebuglist);
+ nullptr, nullptr, &setdebuglist, &showdebuglist);
}
diff --git a/gdb/amd-dbgapi-target.h b/gdb/amd-dbgapi-target.h
index beff2ad0bed..170d4bd8a99 100644
--- a/gdb/amd-dbgapi-target.h
+++ b/gdb/amd-dbgapi-target.h
@@ -29,7 +29,7 @@ struct inferior;
namespace detail
{
-template <typename T>
+template<typename T>
using is_amd_dbgapi_handle
= gdb::Or<std::is_same<T, amd_dbgapi_address_class_id_t>,
std::is_same<T, amd_dbgapi_address_space_id_t>,
@@ -52,20 +52,18 @@ using is_amd_dbgapi_handle
/* Get the token of amd-dbgapi's inferior_created observer. */
const gdb::observers::token &
- get_amd_dbgapi_target_inferior_created_observer_token ();
+get_amd_dbgapi_target_inferior_created_observer_token ();
/* Comparison operators for amd-dbgapi handle types. */
-template <typename T,
- typename = gdb::Requires<detail::is_amd_dbgapi_handle<T>>>
+template<typename T, typename = gdb::Requires<detail::is_amd_dbgapi_handle<T>>>
bool
operator== (const T &lhs, const T &rhs)
{
return lhs.handle == rhs.handle;
}
-template <typename T,
- typename = gdb::Requires<detail::is_amd_dbgapi_handle<T>>>
+template<typename T, typename = gdb::Requires<detail::is_amd_dbgapi_handle<T>>>
bool
operator!= (const T &lhs, const T &rhs)
{
diff --git a/gdb/amd64-bsd-nat.c b/gdb/amd64-bsd-nat.c
index a5c416abe06..2085a093065 100644
--- a/gdb/amd64-bsd-nat.c
+++ b/gdb/amd64-bsd-nat.c
@@ -34,7 +34,6 @@
#include "x86-bsd-nat.h"
#include "inf-ptrace.h"
#include "amd64-bsd-nat.h"
-
static PTRACE_TYPE_RET
gdb_ptrace (PTRACE_TYPE_ARG1 request, ptid_t ptid, PTRACE_TYPE_ARG3 addr,
@@ -65,7 +64,7 @@ amd64bsd_fetch_inferior_registers (struct regcache *regcache, int regnum)
struct reg regs;
if (gdb_ptrace (PT_GETREGS, ptid, (PTRACE_TYPE_ARG3) &regs, 0) == -1)
- perror_with_name (_("Couldn't get registers"));
+ perror_with_name (_ ("Couldn't get registers"));
amd64_supply_native_gregset (regcache, &regs, -1);
if (regnum != -1)
@@ -77,7 +76,7 @@ amd64bsd_fetch_inferior_registers (struct regcache *regcache, int regnum)
struct fpreg fpregs;
if (gdb_ptrace (PT_GETFPREGS, ptid, (PTRACE_TYPE_ARG3) &fpregs, 0) == -1)
- perror_with_name (_("Couldn't get floating point status"));
+ perror_with_name (_ ("Couldn't get floating point status"));
amd64_supply_fxsave (regcache, -1, &fpregs);
}
@@ -97,12 +96,12 @@ amd64bsd_store_inferior_registers (struct regcache *regcache, int regnum)
struct reg regs;
if (gdb_ptrace (PT_GETREGS, ptid, (PTRACE_TYPE_ARG3) &regs, 0) == -1)
- perror_with_name (_("Couldn't get registers"));
+ perror_with_name (_ ("Couldn't get registers"));
amd64_collect_native_gregset (regcache, &regs, regnum);
if (gdb_ptrace (PT_SETREGS, ptid, (PTRACE_TYPE_ARG3) &regs, 0) == -1)
- perror_with_name (_("Couldn't write registers"));
+ perror_with_name (_ ("Couldn't write registers"));
if (regnum != -1)
return;
@@ -113,11 +112,11 @@ amd64bsd_store_inferior_registers (struct regcache *regcache, int regnum)
struct fpreg fpregs;
if (gdb_ptrace (PT_GETFPREGS, ptid, (PTRACE_TYPE_ARG3) &fpregs, 0) == -1)
- perror_with_name (_("Couldn't get floating point status"));
+ perror_with_name (_ ("Couldn't get floating point status"));
amd64_collect_fxsave (regcache, regnum, &fpregs);
if (gdb_ptrace (PT_SETFPREGS, ptid, (PTRACE_TYPE_ARG3) &fpregs, 0) == -1)
- perror_with_name (_("Couldn't write floating point status"));
+ perror_with_name (_ ("Couldn't write floating point status"));
}
}
diff --git a/gdb/amd64-bsd-nat.h b/gdb/amd64-bsd-nat.h
index 792268b6fd0..cf7f0912201 100644
--- a/gdb/amd64-bsd-nat.h
+++ b/gdb/amd64-bsd-nat.h
@@ -34,11 +34,16 @@ template<typename BaseTarget>
class amd64_bsd_nat_target : public x86bsd_nat_target<BaseTarget>
{
public:
+
void fetch_registers (struct regcache *regcache, int regnum) override
- { amd64bsd_fetch_inferior_registers (regcache, regnum); }
+ {
+ amd64bsd_fetch_inferior_registers (regcache, regnum);
+ }
void store_registers (struct regcache *regcache, int regnum) override
- { amd64bsd_store_inferior_registers (regcache, regnum); }
+ {
+ amd64bsd_store_inferior_registers (regcache, regnum);
+ }
};
#endif /* i386-bsd-nat.h */
diff --git a/gdb/amd64-darwin-tdep.c b/gdb/amd64-darwin-tdep.c
index a682cf478d5..56a989d0134 100644
--- a/gdb/amd64-darwin-tdep.c
+++ b/gdb/amd64-darwin-tdep.c
@@ -40,36 +40,29 @@
/* Offsets into the struct x86_thread_state64 where we'll find the saved regs.
From <mach/i386/thread_status.h> and amd64-tdep.h. */
-int amd64_darwin_thread_state_reg_offset[] =
-{
- 0 * 8, /* %rax */
- 1 * 8, /* %rbx */
- 2 * 8, /* %rcx */
- 3 * 8, /* %rdx */
- 5 * 8, /* %rsi */
- 4 * 8, /* %rdi */
- 6 * 8, /* %rbp */
- 7 * 8, /* %rsp */
- 8 * 8, /* %r8 ... */
- 9 * 8,
- 10 * 8,
- 11 * 8,
- 12 * 8,
- 13 * 8,
- 14 * 8,
- 15 * 8, /* ... %r15 */
- 16 * 8, /* %rip */
- 17 * 8, /* %rflags */
- 18 * 8, /* %cs */
- -1, /* %ss */
- -1, /* %ds */
- -1, /* %es */
- 19 * 8, /* %fs */
- 20 * 8 /* %gs */
+int amd64_darwin_thread_state_reg_offset[] = {
+ 0 * 8, /* %rax */
+ 1 * 8, /* %rbx */
+ 2 * 8, /* %rcx */
+ 3 * 8, /* %rdx */
+ 5 * 8, /* %rsi */
+ 4 * 8, /* %rdi */
+ 6 * 8, /* %rbp */
+ 7 * 8, /* %rsp */
+ 8 * 8, /* %r8 ... */
+ 9 * 8, 10 * 8, 11 * 8, 12 * 8, 13 * 8, 14 * 8, 15 * 8, /* ... %r15 */
+ 16 * 8, /* %rip */
+ 17 * 8, /* %rflags */
+ 18 * 8, /* %cs */
+ -1, /* %ss */
+ -1, /* %ds */
+ -1, /* %es */
+ 19 * 8, /* %fs */
+ 20 * 8 /* %gs */
};
-const int amd64_darwin_thread_state_num_regs =
- ARRAY_SIZE (amd64_darwin_thread_state_reg_offset);
+const int amd64_darwin_thread_state_num_regs
+ = ARRAY_SIZE (amd64_darwin_thread_state_reg_offset);
/* Assuming THIS_FRAME is a Darwin sigtramp routine, return the
address of the associated sigcontext structure. */
@@ -117,9 +110,10 @@ x86_darwin_init_abi_64 (struct gdbarch_info info, struct gdbarch *gdbarch)
}
void _initialize_amd64_darwin_tdep ();
+
void
_initialize_amd64_darwin_tdep ()
{
- gdbarch_register_osabi (bfd_arch_i386, bfd_mach_x86_64,
- GDB_OSABI_DARWIN, x86_darwin_init_abi_64);
+ gdbarch_register_osabi (bfd_arch_i386, bfd_mach_x86_64, GDB_OSABI_DARWIN,
+ x86_darwin_init_abi_64);
}
diff --git a/gdb/amd64-dicos-tdep.c b/gdb/amd64-dicos-tdep.c
index bf51382a95b..50f3caa426b 100644
--- a/gdb/amd64-dicos-tdep.c
+++ b/gdb/amd64-dicos-tdep.c
@@ -47,13 +47,13 @@ amd64_dicos_osabi_sniffer (bfd *abfd)
}
void _initialize_amd64_dicos_tdep ();
+
void
_initialize_amd64_dicos_tdep ()
{
gdbarch_register_osabi_sniffer (bfd_arch_i386, bfd_target_elf_flavour,
amd64_dicos_osabi_sniffer);
- gdbarch_register_osabi (bfd_arch_i386, bfd_mach_x86_64,
- GDB_OSABI_DICOS,
+ gdbarch_register_osabi (bfd_arch_i386, bfd_mach_x86_64, GDB_OSABI_DICOS,
amd64_dicos_init_abi);
}
diff --git a/gdb/amd64-fbsd-nat.c b/gdb/amd64-fbsd-nat.c
index bae267f230f..464db88e86c 100644
--- a/gdb/amd64-fbsd-nat.c
+++ b/gdb/amd64-fbsd-nat.c
@@ -39,6 +39,7 @@
class amd64_fbsd_nat_target final : public x86_fbsd_nat_target
{
public:
+
void fetch_registers (struct regcache *, int) override;
void store_registers (struct regcache *, int) override;
@@ -54,34 +55,21 @@ static size_t xsave_len;
/* This is a layout of the amd64 'struct reg' but with i386
registers. */
-static const struct regcache_map_entry amd64_fbsd32_gregmap[] =
-{
- { 8, REGCACHE_MAP_SKIP, 8 },
- { 1, I386_EDI_REGNUM, 8 },
- { 1, I386_ESI_REGNUM, 8 },
- { 1, I386_EBP_REGNUM, 8 },
- { 1, I386_EBX_REGNUM, 8 },
- { 1, I386_EDX_REGNUM, 8 },
- { 1, I386_ECX_REGNUM, 8 },
- { 1, I386_EAX_REGNUM, 8 },
- { 1, REGCACHE_MAP_SKIP, 4 }, /* trapno */
- { 1, I386_FS_REGNUM, 2 },
- { 1, I386_GS_REGNUM, 2 },
- { 1, REGCACHE_MAP_SKIP, 4 }, /* err */
- { 1, I386_ES_REGNUM, 2 },
- { 1, I386_DS_REGNUM, 2 },
- { 1, I386_EIP_REGNUM, 8 },
- { 1, I386_CS_REGNUM, 8 },
- { 1, I386_EFLAGS_REGNUM, 8 },
- { 1, I386_ESP_REGNUM, 0 },
- { 1, I386_SS_REGNUM, 8 },
- { 0 }
-};
-
-static const struct regset amd64_fbsd32_gregset =
-{
- amd64_fbsd32_gregmap, regcache_supply_regset, regcache_collect_regset
-};
+static const struct regcache_map_entry amd64_fbsd32_gregmap[]
+ = { { 8, REGCACHE_MAP_SKIP, 8 }, { 1, I386_EDI_REGNUM, 8 },
+ { 1, I386_ESI_REGNUM, 8 }, { 1, I386_EBP_REGNUM, 8 },
+ { 1, I386_EBX_REGNUM, 8 }, { 1, I386_EDX_REGNUM, 8 },
+ { 1, I386_ECX_REGNUM, 8 }, { 1, I386_EAX_REGNUM, 8 },
+ { 1, REGCACHE_MAP_SKIP, 4 }, /* trapno */
+ { 1, I386_FS_REGNUM, 2 }, { 1, I386_GS_REGNUM, 2 },
+ { 1, REGCACHE_MAP_SKIP, 4 }, /* err */
+ { 1, I386_ES_REGNUM, 2 }, { 1, I386_DS_REGNUM, 2 },
+ { 1, I386_EIP_REGNUM, 8 }, { 1, I386_CS_REGNUM, 8 },
+ { 1, I386_EFLAGS_REGNUM, 8 }, { 1, I386_ESP_REGNUM, 0 },
+ { 1, I386_SS_REGNUM, 8 }, { 0 } };
+
+static const struct regset amd64_fbsd32_gregset
+ = { amd64_fbsd32_gregmap, regcache_supply_regset, regcache_collect_regset };
/* Return the regset to use for 'struct reg' for the GDBARCH. */
@@ -119,7 +107,7 @@ amd64_fbsd_nat_target::fetch_registers (struct regcache *regcache, int regnum)
register_t base;
if (ptrace (PT_GETFSBASE, pid, (PTRACE_TYPE_ARG3) &base, 0) == -1)
- perror_with_name (_("Couldn't get segment register fs_base"));
+ perror_with_name (_ ("Couldn't get segment register fs_base"));
regcache->raw_supply (tdep->fsbase_regnum, &base);
if (regnum != -1)
@@ -132,7 +120,7 @@ amd64_fbsd_nat_target::fetch_registers (struct regcache *regcache, int regnum)
register_t base;
if (ptrace (PT_GETGSBASE, pid, (PTRACE_TYPE_ARG3) &base, 0) == -1)
- perror_with_name (_("Couldn't get segment register gs_base"));
+ perror_with_name (_ ("Couldn't get segment register gs_base"));
regcache->raw_supply (tdep->fsbase_regnum + 1, &base);
if (regnum != -1)
@@ -140,7 +128,7 @@ amd64_fbsd_nat_target::fetch_registers (struct regcache *regcache, int regnum)
}
#endif
- /* There is no amd64_fxsave_supplies or amd64_xsave_supplies.
+ /* There is no amd64_fxsave_supplies or amd64_xsave_supplies.
Instead, the earlier register sets return early if the request
was for a specific register that was already satisified to avoid
fetching the FPU/XSAVE state unnecessarily. */
@@ -151,7 +139,7 @@ amd64_fbsd_nat_target::fetch_registers (struct regcache *regcache, int regnum)
void *xstateregs = alloca (xsave_len);
if (ptrace (PT_GETXSTATE, pid, (PTRACE_TYPE_ARG3) xstateregs, 0) == -1)
- perror_with_name (_("Couldn't get extended state status"));
+ perror_with_name (_ ("Couldn't get extended state status"));
amd64_supply_xsave (regcache, regnum, xstateregs);
return;
@@ -161,7 +149,7 @@ amd64_fbsd_nat_target::fetch_registers (struct regcache *regcache, int regnum)
struct fpreg fpregs;
if (ptrace (PT_GETFPREGS, pid, (PTRACE_TYPE_ARG3) &fpregs, 0) == -1)
- perror_with_name (_("Couldn't get floating point status"));
+ perror_with_name (_ ("Couldn't get floating point status"));
amd64_supply_fxsave (regcache, regnum, &fpregs);
}
@@ -196,7 +184,7 @@ amd64_fbsd_nat_target::store_registers (struct regcache *regcache, int regnum)
regcache->raw_collect (tdep->fsbase_regnum, &base);
if (ptrace (PT_SETFSBASE, pid, (PTRACE_TYPE_ARG3) &base, 0) == -1)
- perror_with_name (_("Couldn't write segment register fs_base"));
+ perror_with_name (_ ("Couldn't write segment register fs_base"));
if (regnum != -1)
return;
}
@@ -211,13 +199,13 @@ amd64_fbsd_nat_target::store_registers (struct regcache *regcache, int regnum)
regcache->raw_collect (tdep->fsbase_regnum + 1, &base);
if (ptrace (PT_SETGSBASE, pid, (PTRACE_TYPE_ARG3) &base, 0) == -1)
- perror_with_name (_("Couldn't write segment register gs_base"));
+ perror_with_name (_ ("Couldn't write segment register gs_base"));
if (regnum != -1)
return;
}
#endif
- /* There is no amd64_fxsave_supplies or amd64_xsave_supplies.
+ /* There is no amd64_fxsave_supplies or amd64_xsave_supplies.
Instead, the earlier register sets return early if the request
was for a specific register that was already satisified to avoid
fetching the FPU/XSAVE state unnecessarily. */
@@ -228,13 +216,13 @@ amd64_fbsd_nat_target::store_registers (struct regcache *regcache, int regnum)
void *xstateregs = alloca (xsave_len);
if (ptrace (PT_GETXSTATE, pid, (PTRACE_TYPE_ARG3) xstateregs, 0) == -1)
- perror_with_name (_("Couldn't get extended state status"));
+ perror_with_name (_ ("Couldn't get extended state status"));
amd64_collect_xsave (regcache, regnum, xstateregs, 0);
- if (ptrace (PT_SETXSTATE, pid, (PTRACE_TYPE_ARG3) xstateregs,
- xsave_len) == -1)
- perror_with_name (_("Couldn't write extended state status"));
+ if (ptrace (PT_SETXSTATE, pid, (PTRACE_TYPE_ARG3) xstateregs, xsave_len)
+ == -1)
+ perror_with_name (_ ("Couldn't write extended state status"));
return;
}
#endif
@@ -242,12 +230,12 @@ amd64_fbsd_nat_target::store_registers (struct regcache *regcache, int regnum)
struct fpreg fpregs;
if (ptrace (PT_GETFPREGS, pid, (PTRACE_TYPE_ARG3) &fpregs, 0) == -1)
- perror_with_name (_("Couldn't get floating point status"));
+ perror_with_name (_ ("Couldn't get floating point status"));
amd64_collect_fxsave (regcache, regnum, &fpregs);
if (ptrace (PT_SETFPREGS, pid, (PTRACE_TYPE_ARG3) &fpregs, 0) == -1)
- perror_with_name (_("Couldn't write floating point status"));
+ perror_with_name (_ ("Couldn't write floating point status"));
}
/* Support for debugging kernel virtual memory images. */
@@ -296,7 +284,6 @@ amd64fbsd_supply_pcb (struct regcache *regcache, struct pcb *pcb)
return 1;
}
-
/* Implement the read_description method. */
@@ -310,9 +297,9 @@ amd64_fbsd_nat_target::read_description ()
struct reg regs;
int is64;
- if (ptrace (PT_GETREGS, inferior_ptid.pid (),
- (PTRACE_TYPE_ARG3) &regs, 0) == -1)
- perror_with_name (_("Couldn't get registers"));
+ if (ptrace (PT_GETREGS, inferior_ptid.pid (), (PTRACE_TYPE_ARG3) &regs, 0)
+ == -1)
+ perror_with_name (_ ("Couldn't get registers"));
is64 = (regs.r_cs == GSEL (GUCODE_SEL, SEL_UPL));
#ifdef PT_GETXSTATE_INFO
if (!xsave_probed)
@@ -320,7 +307,8 @@ amd64_fbsd_nat_target::read_description ()
struct ptrace_xstate_info info;
if (ptrace (PT_GETXSTATE_INFO, inferior_ptid.pid (),
- (PTRACE_TYPE_ARG3) &info, sizeof (info)) == 0)
+ (PTRACE_TYPE_ARG3) &info, sizeof (info))
+ == 0)
{
xsave_len = info.xsave_len;
xcr0 = info.xsave_mask;
@@ -343,6 +331,7 @@ amd64_fbsd_nat_target::read_description ()
}
void _initialize_amd64fbsd_nat ();
+
void
_initialize_amd64fbsd_nat ()
{
diff --git a/gdb/amd64-fbsd-tdep.c b/gdb/amd64-fbsd-tdep.c
index 2ddbcebe225..3e82685ab2d 100644
--- a/gdb/amd64-fbsd-tdep.c
+++ b/gdb/amd64-fbsd-tdep.c
@@ -35,105 +35,81 @@
/* The general-purpose regset consists of 22 64-bit slots, most of
which contain individual registers, but a few contain multiple
16-bit segment registers. */
-#define AMD64_FBSD_SIZEOF_GREGSET (22 * 8)
+#define AMD64_FBSD_SIZEOF_GREGSET (22 * 8)
/* The segment base register set consists of 2 64-bit registers. */
-#define AMD64_FBSD_SIZEOF_SEGBASES_REGSET (2 * 8)
+#define AMD64_FBSD_SIZEOF_SEGBASES_REGSET (2 * 8)
/* Register maps. */
-static const struct regcache_map_entry amd64_fbsd_gregmap[] =
-{
- { 1, AMD64_R15_REGNUM, 0 },
- { 1, AMD64_R14_REGNUM, 0 },
- { 1, AMD64_R13_REGNUM, 0 },
- { 1, AMD64_R12_REGNUM, 0 },
- { 1, AMD64_R11_REGNUM, 0 },
- { 1, AMD64_R10_REGNUM, 0 },
- { 1, AMD64_R9_REGNUM, 0 },
- { 1, AMD64_R8_REGNUM, 0 },
- { 1, AMD64_RDI_REGNUM, 0 },
- { 1, AMD64_RSI_REGNUM, 0 },
- { 1, AMD64_RBP_REGNUM, 0 },
- { 1, AMD64_RBX_REGNUM, 0 },
- { 1, AMD64_RDX_REGNUM, 0 },
- { 1, AMD64_RCX_REGNUM, 0 },
- { 1, AMD64_RAX_REGNUM, 0 },
- { 1, REGCACHE_MAP_SKIP, 4 }, /* trapno */
- { 1, AMD64_FS_REGNUM, 2 },
- { 1, AMD64_GS_REGNUM, 2 },
- { 1, REGCACHE_MAP_SKIP, 4 }, /* err */
- { 1, AMD64_ES_REGNUM, 2 },
- { 1, AMD64_DS_REGNUM, 2 },
- { 1, AMD64_RIP_REGNUM, 0 },
- { 1, AMD64_CS_REGNUM, 8 },
- { 1, AMD64_EFLAGS_REGNUM, 8 },
- { 1, AMD64_RSP_REGNUM, 0 },
- { 1, AMD64_SS_REGNUM, 8 },
- { 0 }
-};
-
-static const struct regcache_map_entry amd64_fbsd_segbases_regmap[] =
-{
- { 1, AMD64_FSBASE_REGNUM, 0 },
- { 1, AMD64_GSBASE_REGNUM, 0 },
- { 0 }
-};
+static const struct regcache_map_entry amd64_fbsd_gregmap[]
+ = { { 1, AMD64_R15_REGNUM, 0 }, { 1, AMD64_R14_REGNUM, 0 },
+ { 1, AMD64_R13_REGNUM, 0 }, { 1, AMD64_R12_REGNUM, 0 },
+ { 1, AMD64_R11_REGNUM, 0 }, { 1, AMD64_R10_REGNUM, 0 },
+ { 1, AMD64_R9_REGNUM, 0 }, { 1, AMD64_R8_REGNUM, 0 },
+ { 1, AMD64_RDI_REGNUM, 0 }, { 1, AMD64_RSI_REGNUM, 0 },
+ { 1, AMD64_RBP_REGNUM, 0 }, { 1, AMD64_RBX_REGNUM, 0 },
+ { 1, AMD64_RDX_REGNUM, 0 }, { 1, AMD64_RCX_REGNUM, 0 },
+ { 1, AMD64_RAX_REGNUM, 0 }, { 1, REGCACHE_MAP_SKIP, 4 }, /* trapno */
+ { 1, AMD64_FS_REGNUM, 2 }, { 1, AMD64_GS_REGNUM, 2 },
+ { 1, REGCACHE_MAP_SKIP, 4 }, /* err */
+ { 1, AMD64_ES_REGNUM, 2 }, { 1, AMD64_DS_REGNUM, 2 },
+ { 1, AMD64_RIP_REGNUM, 0 }, { 1, AMD64_CS_REGNUM, 8 },
+ { 1, AMD64_EFLAGS_REGNUM, 8 }, { 1, AMD64_RSP_REGNUM, 0 },
+ { 1, AMD64_SS_REGNUM, 8 }, { 0 } };
+
+static const struct regcache_map_entry amd64_fbsd_segbases_regmap[]
+ = { { 1, AMD64_FSBASE_REGNUM, 0 }, { 1, AMD64_GSBASE_REGNUM, 0 }, { 0 } };
/* This layout including fsbase and gsbase was adopted in FreeBSD
8.0. */
-static const struct regcache_map_entry amd64_fbsd_mcregmap[] =
-{
- { 1, REGCACHE_MAP_SKIP, 8 }, /* mc_onstack */
- { 1, AMD64_RDI_REGNUM, 0 },
- { 1, AMD64_RSI_REGNUM, 0 },
- { 1, AMD64_RDX_REGNUM, 0 },
- { 1, AMD64_RCX_REGNUM, 0 },
- { 1, AMD64_R8_REGNUM, 0 },
- { 1, AMD64_R9_REGNUM, 0 },
- { 1, AMD64_RAX_REGNUM, 0 },
- { 1, AMD64_RBX_REGNUM, 0 },
- { 1, AMD64_RBP_REGNUM, 0 },
- { 1, AMD64_R10_REGNUM, 0 },
- { 1, AMD64_R11_REGNUM, 0 },
- { 1, AMD64_R12_REGNUM, 0 },
- { 1, AMD64_R13_REGNUM, 0 },
- { 1, AMD64_R14_REGNUM, 0 },
- { 1, AMD64_R15_REGNUM, 0 },
- { 1, REGCACHE_MAP_SKIP, 4 }, /* mc_trapno */
- { 1, AMD64_FS_REGNUM, 2 },
- { 1, AMD64_GS_REGNUM, 2 },
- { 1, REGCACHE_MAP_SKIP, 8 }, /* mc_addr */
- { 1, REGCACHE_MAP_SKIP, 4 }, /* mc_flags */
- { 1, AMD64_ES_REGNUM, 2 },
- { 1, AMD64_DS_REGNUM, 2 },
- { 1, REGCACHE_MAP_SKIP, 8 }, /* mc_err */
- { 1, AMD64_RIP_REGNUM, 0 },
- { 1, AMD64_CS_REGNUM, 8 },
- { 1, AMD64_EFLAGS_REGNUM, 8 },
- { 1, AMD64_RSP_REGNUM, 0 },
- { 1, AMD64_SS_REGNUM, 8 },
- { 1, REGCACHE_MAP_SKIP, 8 }, /* mc_len */
- { 1, REGCACHE_MAP_SKIP, 8 }, /* mc_fpformat */
- { 1, REGCACHE_MAP_SKIP, 8 }, /* mc_ownedfp */
- { 64, REGCACHE_MAP_SKIP, 8 }, /* mc_fpstate */
- { 1, AMD64_FSBASE_REGNUM, 0 },
- { 1, AMD64_GSBASE_REGNUM, 0 },
- { 0 }
-};
+static const struct regcache_map_entry amd64_fbsd_mcregmap[]
+ = { { 1, REGCACHE_MAP_SKIP, 8 }, /* mc_onstack */
+ { 1, AMD64_RDI_REGNUM, 0 },
+ { 1, AMD64_RSI_REGNUM, 0 },
+ { 1, AMD64_RDX_REGNUM, 0 },
+ { 1, AMD64_RCX_REGNUM, 0 },
+ { 1, AMD64_R8_REGNUM, 0 },
+ { 1, AMD64_R9_REGNUM, 0 },
+ { 1, AMD64_RAX_REGNUM, 0 },
+ { 1, AMD64_RBX_REGNUM, 0 },
+ { 1, AMD64_RBP_REGNUM, 0 },
+ { 1, AMD64_R10_REGNUM, 0 },
+ { 1, AMD64_R11_REGNUM, 0 },
+ { 1, AMD64_R12_REGNUM, 0 },
+ { 1, AMD64_R13_REGNUM, 0 },
+ { 1, AMD64_R14_REGNUM, 0 },
+ { 1, AMD64_R15_REGNUM, 0 },
+ { 1, REGCACHE_MAP_SKIP, 4 }, /* mc_trapno */
+ { 1, AMD64_FS_REGNUM, 2 },
+ { 1, AMD64_GS_REGNUM, 2 },
+ { 1, REGCACHE_MAP_SKIP, 8 }, /* mc_addr */
+ { 1, REGCACHE_MAP_SKIP, 4 }, /* mc_flags */
+ { 1, AMD64_ES_REGNUM, 2 },
+ { 1, AMD64_DS_REGNUM, 2 },
+ { 1, REGCACHE_MAP_SKIP, 8 }, /* mc_err */
+ { 1, AMD64_RIP_REGNUM, 0 },
+ { 1, AMD64_CS_REGNUM, 8 },
+ { 1, AMD64_EFLAGS_REGNUM, 8 },
+ { 1, AMD64_RSP_REGNUM, 0 },
+ { 1, AMD64_SS_REGNUM, 8 },
+ { 1, REGCACHE_MAP_SKIP, 8 }, /* mc_len */
+ { 1, REGCACHE_MAP_SKIP, 8 }, /* mc_fpformat */
+ { 1, REGCACHE_MAP_SKIP, 8 }, /* mc_ownedfp */
+ { 64, REGCACHE_MAP_SKIP, 8 }, /* mc_fpstate */
+ { 1, AMD64_FSBASE_REGNUM, 0 },
+ { 1, AMD64_GSBASE_REGNUM, 0 },
+ { 0 } };
/* Register set definitions. */
-const struct regset amd64_fbsd_gregset =
-{
- amd64_fbsd_gregmap, regcache_supply_regset, regcache_collect_regset
-};
+const struct regset amd64_fbsd_gregset
+ = { amd64_fbsd_gregmap, regcache_supply_regset, regcache_collect_regset };
-const struct regset amd64_fbsd_segbases_regset =
-{
- amd64_fbsd_segbases_regmap, regcache_supply_regset, regcache_collect_regset
-};
+const struct regset amd64_fbsd_segbases_regset
+ = { amd64_fbsd_segbases_regmap, regcache_supply_regset,
+ regcache_collect_regset };
/* Support for signal handlers. */
@@ -161,23 +137,20 @@ const struct regset amd64_fbsd_segbases_regset =
as the floating point or XSAVE state. */
/* NB: There is an 8 byte padding hole between sf_ahu and sf_uc. */
-#define AMD64_SIGFRAME_UCONTEXT_OFFSET 16
-#define AMD64_UCONTEXT_MCONTEXT_OFFSET 16
-#define AMD64_SIZEOF_MCONTEXT_T 800
+#define AMD64_SIGFRAME_UCONTEXT_OFFSET 16
+#define AMD64_UCONTEXT_MCONTEXT_OFFSET 16
+#define AMD64_SIZEOF_MCONTEXT_T 800
/* Implement the "init" method of struct tramp_frame. */
static void
amd64_fbsd_sigframe_init (const struct tramp_frame *self,
frame_info_ptr this_frame,
- struct trad_frame_cache *this_cache,
- CORE_ADDR func)
+ struct trad_frame_cache *this_cache, CORE_ADDR func)
{
CORE_ADDR sp = get_frame_register_unsigned (this_frame, AMD64_RSP_REGNUM);
CORE_ADDR mcontext_addr
- = (sp
- + AMD64_SIGFRAME_UCONTEXT_OFFSET
- + AMD64_UCONTEXT_MCONTEXT_OFFSET);
+ = (sp + AMD64_SIGFRAME_UCONTEXT_OFFSET + AMD64_UCONTEXT_MCONTEXT_OFFSET);
trad_frame_set_reg_regmap (this_cache, amd64_fbsd_mcregmap, mcontext_addr,
AMD64_SIZEOF_MCONTEXT_T);
@@ -191,38 +164,33 @@ amd64_fbsd_sigframe_init (const struct tramp_frame *self,
trad_frame_set_id (this_cache, frame_id_build (sp, func));
}
-static const struct tramp_frame amd64_fbsd_sigframe =
-{
- SIGTRAMP_FRAME,
- 1,
- {
- {0x48, ULONGEST_MAX}, /* lea SIGF_UC(%rsp),%rdi */
- {0x8d, ULONGEST_MAX},
- {0x7c, ULONGEST_MAX},
- {0x24, ULONGEST_MAX},
- {0x10, ULONGEST_MAX},
- {0x6a, ULONGEST_MAX}, /* pushq $0 */
- {0x00, ULONGEST_MAX},
- {0x48, ULONGEST_MAX}, /* movq $SYS_sigreturn,%rax */
- {0xc7, ULONGEST_MAX},
- {0xc0, ULONGEST_MAX},
- {0xa1, ULONGEST_MAX},
- {0x01, ULONGEST_MAX},
- {0x00, ULONGEST_MAX},
- {0x00, ULONGEST_MAX},
- {0x0f, ULONGEST_MAX}, /* syscall */
- {0x05, ULONGEST_MAX},
- {TRAMP_SENTINEL_INSN, ULONGEST_MAX}
- },
- amd64_fbsd_sigframe_init
-};
+static const struct tramp_frame amd64_fbsd_sigframe
+ = { SIGTRAMP_FRAME,
+ 1,
+ { { 0x48, ULONGEST_MAX }, /* lea SIGF_UC(%rsp),%rdi */
+ { 0x8d, ULONGEST_MAX },
+ { 0x7c, ULONGEST_MAX },
+ { 0x24, ULONGEST_MAX },
+ { 0x10, ULONGEST_MAX },
+ { 0x6a, ULONGEST_MAX }, /* pushq $0 */
+ { 0x00, ULONGEST_MAX },
+ { 0x48, ULONGEST_MAX }, /* movq $SYS_sigreturn,%rax */
+ { 0xc7, ULONGEST_MAX },
+ { 0xc0, ULONGEST_MAX },
+ { 0xa1, ULONGEST_MAX },
+ { 0x01, ULONGEST_MAX },
+ { 0x00, ULONGEST_MAX },
+ { 0x00, ULONGEST_MAX },
+ { 0x0f, ULONGEST_MAX }, /* syscall */
+ { 0x05, ULONGEST_MAX },
+ { TRAMP_SENTINEL_INSN, ULONGEST_MAX } },
+ amd64_fbsd_sigframe_init };
/* Implement the core_read_description gdbarch method. */
static const struct target_desc *
amd64fbsd_core_read_description (struct gdbarch *gdbarch,
- struct target_ops *target,
- bfd *abfd)
+ struct target_ops *target, bfd *abfd)
{
return amd64_target_description (i386fbsd_core_read_xcr0 (abfd), true);
}
@@ -241,18 +209,14 @@ amd64fbsd_supply_xstateregset (const struct regset *regset,
static void
amd64fbsd_collect_xstateregset (const struct regset *regset,
- const struct regcache *regcache,
- int regnum, void *xstateregs, size_t len)
+ const struct regcache *regcache, int regnum,
+ void *xstateregs, size_t len)
{
amd64_collect_xsave (regcache, regnum, xstateregs, 1);
}
-static const struct regset amd64fbsd_xstateregset =
- {
- NULL,
- amd64fbsd_supply_xstateregset,
- amd64fbsd_collect_xstateregset
- };
+static const struct regset amd64fbsd_xstateregset
+ = { NULL, amd64fbsd_supply_xstateregset, amd64fbsd_collect_xstateregset };
/* Iterate over core file register note sections. */
@@ -271,8 +235,9 @@ amd64fbsd_iterate_over_regset_sections (struct gdbarch *gdbarch,
cb (".reg-x86-segbases", AMD64_FBSD_SIZEOF_SEGBASES_REGSET,
AMD64_FBSD_SIZEOF_SEGBASES_REGSET, &amd64_fbsd_segbases_regset,
"segment bases", cb_data);
- cb (".reg-xstate", X86_XSTATE_SIZE (tdep->xcr0), X86_XSTATE_SIZE (tdep->xcr0),
- &amd64fbsd_xstateregset, "XSAVE extended state", cb_data);
+ cb (".reg-xstate", X86_XSTATE_SIZE (tdep->xcr0),
+ X86_XSTATE_SIZE (tdep->xcr0), &amd64fbsd_xstateregset,
+ "XSAVE extended state", cb_data);
}
/* Implement the get_thread_local_address gdbarch method. */
@@ -290,7 +255,7 @@ amd64fbsd_get_thread_local_address (struct gdbarch *gdbarch, ptid_t ptid,
ULONGEST fsbase;
if (regcache->cooked_read (AMD64_FSBASE_REGNUM, &fsbase) != REG_VALID)
- error (_("Unable to fetch %%fsbase"));
+ error (_ ("Unable to fetch %%fsbase"));
CORE_ADDR dtv_addr = fsbase + gdbarch_ptr_bit (gdbarch) / 8;
return fbsd_get_thread_local_address (gdbarch, dtv_addr, lm_addr, offset);
@@ -315,15 +280,14 @@ amd64fbsd_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
tdep->xsave_xcr0_offset = I386_FBSD_XSAVE_XCR0_OFFSET;
/* Iterate over core file register note sections. */
- set_gdbarch_iterate_over_regset_sections
- (gdbarch, amd64fbsd_iterate_over_regset_sections);
+ set_gdbarch_iterate_over_regset_sections (
+ gdbarch, amd64fbsd_iterate_over_regset_sections);
- set_gdbarch_core_read_description (gdbarch,
- amd64fbsd_core_read_description);
+ set_gdbarch_core_read_description (gdbarch, amd64fbsd_core_read_description);
/* FreeBSD uses SVR4-style shared libraries. */
- set_solib_svr4_fetch_link_map_offsets
- (gdbarch, svr4_lp64_fetch_link_map_offsets);
+ set_solib_svr4_fetch_link_map_offsets (gdbarch,
+ svr4_lp64_fetch_link_map_offsets);
set_gdbarch_fetch_tls_load_module_address (gdbarch,
svr4_fetch_objfile_link_map);
@@ -332,9 +296,10 @@ amd64fbsd_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
}
void _initialize_amd64fbsd_tdep ();
+
void
_initialize_amd64fbsd_tdep ()
{
- gdbarch_register_osabi (bfd_arch_i386, bfd_mach_x86_64,
- GDB_OSABI_FREEBSD, amd64fbsd_init_abi);
+ gdbarch_register_osabi (bfd_arch_i386, bfd_mach_x86_64, GDB_OSABI_FREEBSD,
+ amd64fbsd_init_abi);
}
diff --git a/gdb/amd64-linux-nat.c b/gdb/amd64-linux-nat.c
index b5b0703879b..799d79dc9d8 100644
--- a/gdb/amd64-linux-nat.c
+++ b/gdb/amd64-linux-nat.c
@@ -42,7 +42,7 @@
/* This definition comes from prctl.h. Kernels older than 2.5.64
do not have it. */
#ifndef PTRACE_ARCH_PRCTL
-#define PTRACE_ARCH_PRCTL 30
+#define PTRACE_ARCH_PRCTL 30
#endif
struct amd64_linux_nat_target final : public x86_linux_nat_target
@@ -51,8 +51,8 @@ struct amd64_linux_nat_target final : public x86_linux_nat_target
void fetch_registers (struct regcache *, int) override;
void store_registers (struct regcache *, int) override;
- bool low_siginfo_fixup (siginfo_t *ptrace, gdb_byte *inf, int direction)
- override;
+ bool low_siginfo_fixup (siginfo_t *ptrace, gdb_byte *inf,
+ int direction) override;
};
static amd64_linux_nat_target the_amd64_linux_nat_target;
@@ -66,28 +66,24 @@ static amd64_linux_nat_target the_amd64_linux_nat_target;
little-endian we get away with that. */
/* From <sys/reg.h> on GNU/Linux i386. */
-static int amd64_linux_gregset32_reg_offset[] =
-{
- RAX * 8, RCX * 8, /* %eax, %ecx */
- RDX * 8, RBX * 8, /* %edx, %ebx */
- RSP * 8, RBP * 8, /* %esp, %ebp */
- RSI * 8, RDI * 8, /* %esi, %edi */
- RIP * 8, EFLAGS * 8, /* %eip, %eflags */
- CS * 8, SS * 8, /* %cs, %ss */
- DS * 8, ES * 8, /* %ds, %es */
- FS * 8, GS * 8, /* %fs, %gs */
- -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, /* MPX registers BND0 ... BND3. */
- -1, -1, /* MPX registers BNDCFGU, BNDSTATUS. */
- -1, -1, -1, -1, -1, -1, -1, -1, /* k0 ... k7 (AVX512) */
- -1, -1, -1, -1, -1, -1, -1, -1, /* zmm0 ... zmm7 (AVX512) */
- -1, /* PKEYS register PKRU */
- ORIG_RAX * 8 /* "orig_eax" */
+static int amd64_linux_gregset32_reg_offset[] = {
+ RAX * 8, RCX * 8, /* %eax, %ecx */
+ RDX * 8, RBX * 8, /* %edx, %ebx */
+ RSP * 8, RBP * 8, /* %esp, %ebp */
+ RSI * 8, RDI * 8, /* %esi, %edi */
+ RIP * 8, EFLAGS * 8, /* %eip, %eflags */
+ CS * 8, SS * 8, /* %cs, %ss */
+ DS * 8, ES * 8, /* %ds, %es */
+ FS * 8, GS * 8, /* %fs, %gs */
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, /* MPX registers BND0 ... BND3. */
+ -1, -1, /* MPX registers BNDCFGU, BNDSTATUS. */
+ -1, -1, -1, -1, -1, -1, -1, -1, /* k0 ... k7 (AVX512) */
+ -1, -1, -1, -1, -1, -1, -1, -1, /* zmm0 ... zmm7 (AVX512) */
+ -1, /* PKEYS register PKRU */
+ ORIG_RAX * 8 /* "orig_eax" */
};
-
/* Transfering the general-purpose registers between GDB, inferiors
and core files. */
@@ -149,7 +145,7 @@ amd64_linux_collect_native_gregset (const struct regcache *regcache,
if (regnum == -1 || regnum == I386_EAX_REGNUM)
{
- void *ptr = ((gdb_byte *) gregs
+ void *ptr = ((gdb_byte *) gregs
+ amd64_linux_gregset32_reg_offset[I386_EAX_REGNUM]);
*(int64_t *) ptr = *(int32_t *) ptr;
@@ -171,8 +167,8 @@ supply_gregset (struct regcache *regcache, const elf_gregset_t *gregsetp)
do this for all registers. */
void
-fill_gregset (const struct regcache *regcache,
- elf_gregset_t *gregsetp, int regnum)
+fill_gregset (const struct regcache *regcache, elf_gregset_t *gregsetp,
+ int regnum)
{
amd64_linux_collect_native_gregset (regcache, gregsetp, regnum);
}
@@ -193,12 +189,11 @@ supply_fpregset (struct regcache *regcache, const elf_fpregset_t *fpregsetp)
-1, do this for all registers. */
void
-fill_fpregset (const struct regcache *regcache,
- elf_fpregset_t *fpregsetp, int regnum)
+fill_fpregset (const struct regcache *regcache, elf_fpregset_t *fpregsetp,
+ int regnum)
{
amd64_collect_fxsave (regcache, regnum, fpregsetp);
}
-
/* Transferring arbitrary registers between GDB and inferior. */
@@ -222,7 +217,7 @@ amd64_linux_nat_target::fetch_registers (struct regcache *regcache, int regnum)
elf_gregset_t regs;
if (ptrace (PTRACE_GETREGS, tid, 0, (long) &regs) < 0)
- perror_with_name (_("Couldn't get registers"));
+ perror_with_name (_ ("Couldn't get registers"));
amd64_supply_native_gregset (regcache, &regs, -1);
if (regnum != -1)
@@ -246,16 +241,17 @@ amd64_linux_nat_target::fetch_registers (struct regcache *regcache, int regnum)
memset (xstateregs, 0, sizeof (xstateregs));
iov.iov_base = xstateregs;
iov.iov_len = sizeof (xstateregs);
- if (ptrace (PTRACE_GETREGSET, tid,
- (unsigned int) NT_X86_XSTATE, (long) &iov) < 0)
- perror_with_name (_("Couldn't get extended state status"));
+ if (ptrace (PTRACE_GETREGSET, tid, (unsigned int) NT_X86_XSTATE,
+ (long) &iov)
+ < 0)
+ perror_with_name (_ ("Couldn't get extended state status"));
amd64_supply_xsave (regcache, -1, xstateregs);
}
else
{
if (ptrace (PTRACE_GETFPREGS, tid, 0, (long) &fpregs) < 0)
- perror_with_name (_("Couldn't get floating point status"));
+ perror_with_name (_ ("Couldn't get floating point status"));
amd64_supply_fxsave (regcache, -1, &fpregs);
}
@@ -282,12 +278,12 @@ amd64_linux_nat_target::store_registers (struct regcache *regcache, int regnum)
elf_gregset_t regs;
if (ptrace (PTRACE_GETREGS, tid, 0, (long) &regs) < 0)
- perror_with_name (_("Couldn't get registers"));
+ perror_with_name (_ ("Couldn't get registers"));
amd64_linux_collect_native_gregset (regcache, &regs, regnum);
if (ptrace (PTRACE_SETREGS, tid, 0, (long) &regs) < 0)
- perror_with_name (_("Couldn't write registers"));
+ perror_with_name (_ ("Couldn't write registers"));
if (regnum != -1)
return;
@@ -304,44 +300,45 @@ amd64_linux_nat_target::store_registers (struct regcache *regcache, int regnum)
iov.iov_base = xstateregs;
iov.iov_len = sizeof (xstateregs);
- if (ptrace (PTRACE_GETREGSET, tid,
- (unsigned int) NT_X86_XSTATE, (long) &iov) < 0)
- perror_with_name (_("Couldn't get extended state status"));
+ if (ptrace (PTRACE_GETREGSET, tid, (unsigned int) NT_X86_XSTATE,
+ (long) &iov)
+ < 0)
+ perror_with_name (_ ("Couldn't get extended state status"));
amd64_collect_xsave (regcache, regnum, xstateregs, 0);
- if (ptrace (PTRACE_SETREGSET, tid,
- (unsigned int) NT_X86_XSTATE, (long) &iov) < 0)
- perror_with_name (_("Couldn't write extended state status"));
+ if (ptrace (PTRACE_SETREGSET, tid, (unsigned int) NT_X86_XSTATE,
+ (long) &iov)
+ < 0)
+ perror_with_name (_ ("Couldn't write extended state status"));
}
else
{
if (ptrace (PTRACE_GETFPREGS, tid, 0, (long) &fpregs) < 0)
- perror_with_name (_("Couldn't get floating point status"));
+ perror_with_name (_ ("Couldn't get floating point status"));
amd64_collect_fxsave (regcache, regnum, &fpregs);
if (ptrace (PTRACE_SETFPREGS, tid, 0, (long) &fpregs) < 0)
- perror_with_name (_("Couldn't write floating point status"));
+ perror_with_name (_ ("Couldn't write floating point status"));
}
}
}
-
/* This function is called by libthread_db as part of its handling of
a request for a thread's local storage address. */
ps_err_e
-ps_get_thread_area (struct ps_prochandle *ph,
- lwpid_t lwpid, int idx, void **base)
+ps_get_thread_area (struct ps_prochandle *ph, lwpid_t lwpid, int idx,
+ void **base)
{
if (gdbarch_bfd_arch_info (ph->thread->inf->gdbarch)->bits_per_word == 32)
{
unsigned int base_addr;
ps_err_e result;
- result = x86_linux_get_thread_area (lwpid, (void *) (long) idx,
- &base_addr);
+ result
+ = x86_linux_get_thread_area (lwpid, (void *) (long) idx, &base_addr);
if (result == PS_OK)
{
/* Extend the value to 64 bits. Here it's assumed that
@@ -352,7 +349,6 @@ ps_get_thread_area (struct ps_prochandle *ph,
}
else
{
-
/* FIXME: ezannoni-2003-07-09 see comment above about include
file order. We could be getting bogus values for these two. */
gdb_assert (FS < ELF_NGREG);
@@ -360,41 +356,40 @@ ps_get_thread_area (struct ps_prochandle *ph,
switch (idx)
{
case FS:
- {
- unsigned long fs;
- errno = 0;
- fs = ptrace (PTRACE_PEEKUSER, lwpid,
- offsetof (struct user_regs_struct, fs_base), 0);
- if (errno == 0)
- {
- *base = (void *) fs;
- return PS_OK;
- }
- }
+ {
+ unsigned long fs;
+ errno = 0;
+ fs = ptrace (PTRACE_PEEKUSER, lwpid,
+ offsetof (struct user_regs_struct, fs_base), 0);
+ if (errno == 0)
+ {
+ *base = (void *) fs;
+ return PS_OK;
+ }
+ }
break;
case GS:
- {
- unsigned long gs;
- errno = 0;
- gs = ptrace (PTRACE_PEEKUSER, lwpid,
- offsetof (struct user_regs_struct, gs_base), 0);
- if (errno == 0)
- {
- *base = (void *) gs;
- return PS_OK;
- }
- }
+ {
+ unsigned long gs;
+ errno = 0;
+ gs = ptrace (PTRACE_PEEKUSER, lwpid,
+ offsetof (struct user_regs_struct, gs_base), 0);
+ if (errno == 0)
+ {
+ *base = (void *) gs;
+ return PS_OK;
+ }
+ }
break;
- default: /* Should not happen. */
+ default: /* Should not happen. */
return PS_BADADDR;
}
}
- return PS_ERR; /* ptrace failed. */
+ return PS_ERR; /* ptrace failed. */
}
-
/* Convert a ptrace/host siginfo object, into/from the siginfo in the
layout of the inferiors' architecture. Returns true if any
@@ -403,8 +398,7 @@ ps_get_thread_area (struct ps_prochandle *ph,
INF. */
bool
-amd64_linux_nat_target::low_siginfo_fixup (siginfo_t *ptrace,
- gdb_byte *inf,
+amd64_linux_nat_target::low_siginfo_fixup (siginfo_t *ptrace, gdb_byte *inf,
int direction)
{
struct gdbarch *gdbarch = get_frame_arch (get_current_frame ());
@@ -412,8 +406,7 @@ amd64_linux_nat_target::low_siginfo_fixup (siginfo_t *ptrace,
/* Is the inferior 32-bit? If so, then do fixup the siginfo
object. */
if (gdbarch_bfd_arch_info (gdbarch)->bits_per_word == 32)
- return amd64_linux_siginfo_fixup_common (ptrace, inf, direction,
- FIXUP_32);
+ return amd64_linux_siginfo_fixup_common (ptrace, inf, direction, FIXUP_32);
/* No fixup for native x32 GDB. */
else if (gdbarch_addr_bit (gdbarch) == 32 && sizeof (void *) == 8)
return amd64_linux_siginfo_fixup_common (ptrace, inf, direction,
@@ -423,6 +416,7 @@ amd64_linux_nat_target::low_siginfo_fixup (siginfo_t *ptrace,
}
void _initialize_amd64_linux_nat ();
+
void
_initialize_amd64_linux_nat ()
{
diff --git a/gdb/amd64-linux-tdep.c b/gdb/amd64-linux-tdep.c
index e9181649ec8..f3d8c683857 100644
--- a/gdb/amd64-linux-tdep.c
+++ b/gdb/amd64-linux-tdep.c
@@ -53,74 +53,59 @@
format and GDB's register cache layout. */
/* From <sys/reg.h>. */
-int amd64_linux_gregset_reg_offset[] =
-{
- 10 * 8, /* %rax */
- 5 * 8, /* %rbx */
- 11 * 8, /* %rcx */
- 12 * 8, /* %rdx */
- 13 * 8, /* %rsi */
- 14 * 8, /* %rdi */
- 4 * 8, /* %rbp */
- 19 * 8, /* %rsp */
- 9 * 8, /* %r8 ... */
- 8 * 8,
- 7 * 8,
- 6 * 8,
- 3 * 8,
- 2 * 8,
- 1 * 8,
- 0 * 8, /* ... %r15 */
- 16 * 8, /* %rip */
- 18 * 8, /* %eflags */
- 17 * 8, /* %cs */
- 20 * 8, /* %ss */
- 23 * 8, /* %ds */
- 24 * 8, /* %es */
- 25 * 8, /* %fs */
- 26 * 8, /* %gs */
- -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, /* MPX registers BND0 ... BND3. */
- -1, -1, /* MPX registers BNDCFGU and BNDSTATUS. */
- -1, -1, -1, -1, -1, -1, -1, -1, /* xmm16 ... xmm31 (AVX512) */
- -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, /* ymm16 ... ymm31 (AVX512) */
- -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, /* k0 ... k7 (AVX512) */
- -1, -1, -1, -1, -1, -1, -1, -1, /* zmm0 ... zmm31 (AVX512) */
- -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1,
- -1, /* PKEYS register pkru */
+int amd64_linux_gregset_reg_offset[] = {
+ 10 * 8, /* %rax */
+ 5 * 8, /* %rbx */
+ 11 * 8, /* %rcx */
+ 12 * 8, /* %rdx */
+ 13 * 8, /* %rsi */
+ 14 * 8, /* %rdi */
+ 4 * 8, /* %rbp */
+ 19 * 8, /* %rsp */
+ 9 * 8, /* %r8 ... */
+ 8 * 8, 7 * 8, 6 * 8, 3 * 8, 2 * 8, 1 * 8, 0 * 8, /* ... %r15 */
+ 16 * 8, /* %rip */
+ 18 * 8, /* %eflags */
+ 17 * 8, /* %cs */
+ 20 * 8, /* %ss */
+ 23 * 8, /* %ds */
+ 24 * 8, /* %es */
+ 25 * 8, /* %fs */
+ 26 * 8, /* %gs */
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, /* MPX registers BND0 ... BND3. */
+ -1, -1, /* MPX registers BNDCFGU and BNDSTATUS. */
+ -1, -1, -1, -1, -1, -1, -1, -1, /* xmm16 ... xmm31 (AVX512) */
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, /* ymm16 ... ymm31 (AVX512) */
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, /* k0 ... k7 (AVX512) */
+ -1, -1, -1, -1, -1, -1, -1, -1, /* zmm0 ... zmm31 (AVX512) */
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, /* PKEYS register pkru */
/* End of hardware registers */
- 21 * 8, 22 * 8, /* fs_base and gs_base. */
- 15 * 8 /* "orig_rax" */
+ 21 * 8, 22 * 8, /* fs_base and gs_base. */
+ 15 * 8 /* "orig_rax" */
};
-
/* Support for signal handlers. */
-#define LINUX_SIGTRAMP_INSN0 0x48 /* mov $NNNNNNNN, %rax */
-#define LINUX_SIGTRAMP_OFFSET0 0
-#define LINUX_SIGTRAMP_INSN1 0x0f /* syscall */
-#define LINUX_SIGTRAMP_OFFSET1 7
+#define LINUX_SIGTRAMP_INSN0 0x48 /* mov $NNNNNNNN, %rax */
+#define LINUX_SIGTRAMP_OFFSET0 0
+#define LINUX_SIGTRAMP_INSN1 0x0f /* syscall */
+#define LINUX_SIGTRAMP_OFFSET1 7
-static const gdb_byte amd64_linux_sigtramp_code[] =
-{
+static const gdb_byte amd64_linux_sigtramp_code[] = {
/* mov $__NR_rt_sigreturn, %rax */
LINUX_SIGTRAMP_INSN0, 0xc7, 0xc0, 0x0f, 0x00, 0x00, 0x00,
/* syscall */
LINUX_SIGTRAMP_INSN1, 0x05
};
-static const gdb_byte amd64_x32_linux_sigtramp_code[] =
-{
+static const gdb_byte amd64_x32_linux_sigtramp_code[] = {
/* mov $__NR_rt_sigreturn, %rax. */
LINUX_SIGTRAMP_INSN0, 0xc7, 0xc0, 0x01, 0x02, 0x00, 0x40,
/* syscall */
@@ -219,11 +204,9 @@ amd64_linux_sigcontext_addr (frame_info_ptr this_frame)
at it. */
return sp + AMD64_LINUX_UCONTEXT_SIGCONTEXT_OFFSET;
}
-
static LONGEST
-amd64_linux_get_syscall_number (struct gdbarch *gdbarch,
- thread_info *thread)
+amd64_linux_get_syscall_number (struct gdbarch *gdbarch, thread_info *thread)
{
struct regcache *regcache = get_thread_regcache (thread);
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
@@ -242,50 +225,46 @@ amd64_linux_get_syscall_number (struct gdbarch *gdbarch,
return ret;
}
-
/* From <asm/sigcontext.h>. */
-static int amd64_linux_sc_reg_offset[] =
-{
- 13 * 8, /* %rax */
- 11 * 8, /* %rbx */
- 14 * 8, /* %rcx */
- 12 * 8, /* %rdx */
- 9 * 8, /* %rsi */
- 8 * 8, /* %rdi */
- 10 * 8, /* %rbp */
- 15 * 8, /* %rsp */
- 0 * 8, /* %r8 */
- 1 * 8, /* %r9 */
- 2 * 8, /* %r10 */
- 3 * 8, /* %r11 */
- 4 * 8, /* %r12 */
- 5 * 8, /* %r13 */
- 6 * 8, /* %r14 */
- 7 * 8, /* %r15 */
- 16 * 8, /* %rip */
- 17 * 8, /* %eflags */
+static int amd64_linux_sc_reg_offset[] = {
+ 13 * 8, /* %rax */
+ 11 * 8, /* %rbx */
+ 14 * 8, /* %rcx */
+ 12 * 8, /* %rdx */
+ 9 * 8, /* %rsi */
+ 8 * 8, /* %rdi */
+ 10 * 8, /* %rbp */
+ 15 * 8, /* %rsp */
+ 0 * 8, /* %r8 */
+ 1 * 8, /* %r9 */
+ 2 * 8, /* %r10 */
+ 3 * 8, /* %r11 */
+ 4 * 8, /* %r12 */
+ 5 * 8, /* %r13 */
+ 6 * 8, /* %r14 */
+ 7 * 8, /* %r15 */
+ 16 * 8, /* %rip */
+ 17 * 8, /* %eflags */
/* FIXME: kettenis/2002030531: The registers %cs, %fs and %gs are
available in `struct sigcontext'. However, they only occupy two
bytes instead of four, which makes using them here rather
difficult. Leave them out for now. */
- -1, /* %cs */
- -1, /* %ss */
- -1, /* %ds */
- -1, /* %es */
- -1, /* %fs */
- -1 /* %gs */
+ -1, /* %cs */
+ -1, /* %ss */
+ -1, /* %ds */
+ -1, /* %es */
+ -1, /* %fs */
+ -1 /* %gs */
};
static int
amd64_linux_register_reggroup_p (struct gdbarch *gdbarch, int regnum,
const struct reggroup *group)
-{
- if (regnum == AMD64_LINUX_ORIG_RAX_REGNUM
- || regnum == AMD64_FSBASE_REGNUM
+{
+ if (regnum == AMD64_LINUX_ORIG_RAX_REGNUM || regnum == AMD64_FSBASE_REGNUM
|| regnum == AMD64_GSBASE_REGNUM)
- return (group == system_reggroup
- || group == save_reggroup
+ return (group == system_reggroup || group == save_reggroup
|| group == restore_reggroup);
return i386_register_reggroup_p (gdbarch, regnum, group);
}
@@ -367,1079 +346,1080 @@ amd64_canonicalize_syscall (enum amd64_syscall syscall_number)
DIAGNOSTIC_PUSH
DIAGNOSTIC_IGNORE_SWITCH_DIFFERENT_ENUM_TYPES
- switch (syscall_number) {
- case amd64_sys_read:
- case amd64_x32_sys_read:
- return gdb_sys_read;
+ switch (syscall_number)
+ {
+ case amd64_sys_read:
+ case amd64_x32_sys_read:
+ return gdb_sys_read;
- case amd64_sys_write:
- case amd64_x32_sys_write:
- return gdb_sys_write;
+ case amd64_sys_write:
+ case amd64_x32_sys_write:
+ return gdb_sys_write;
- case amd64_sys_open:
- case amd64_x32_sys_open:
- return gdb_sys_open;
+ case amd64_sys_open:
+ case amd64_x32_sys_open:
+ return gdb_sys_open;
- case amd64_sys_close:
- case amd64_x32_sys_close:
- return gdb_sys_close;
+ case amd64_sys_close:
+ case amd64_x32_sys_close:
+ return gdb_sys_close;
- case amd64_sys_newstat:
- case amd64_x32_sys_newstat:
- return gdb_sys_newstat;
+ case amd64_sys_newstat:
+ case amd64_x32_sys_newstat:
+ return gdb_sys_newstat;
- case amd64_sys_newfstat:
- case amd64_x32_sys_newfstat:
- return gdb_sys_newfstat;
+ case amd64_sys_newfstat:
+ case amd64_x32_sys_newfstat:
+ return gdb_sys_newfstat;
- case amd64_sys_newlstat:
- case amd64_x32_sys_newlstat:
- return gdb_sys_newlstat;
+ case amd64_sys_newlstat:
+ case amd64_x32_sys_newlstat:
+ return gdb_sys_newlstat;
- case amd64_sys_poll:
- case amd64_x32_sys_poll:
- return gdb_sys_poll;
+ case amd64_sys_poll:
+ case amd64_x32_sys_poll:
+ return gdb_sys_poll;
- case amd64_sys_lseek:
- case amd64_x32_sys_lseek:
- return gdb_sys_lseek;
+ case amd64_sys_lseek:
+ case amd64_x32_sys_lseek:
+ return gdb_sys_lseek;
- case amd64_sys_mmap:
- case amd64_x32_sys_mmap:
- return gdb_sys_mmap2;
+ case amd64_sys_mmap:
+ case amd64_x32_sys_mmap:
+ return gdb_sys_mmap2;
- case amd64_sys_mprotect:
- case amd64_x32_sys_mprotect:
- return gdb_sys_mprotect;
+ case amd64_sys_mprotect:
+ case amd64_x32_sys_mprotect:
+ return gdb_sys_mprotect;
- case amd64_sys_munmap:
- case amd64_x32_sys_munmap:
- return gdb_sys_munmap;
+ case amd64_sys_munmap:
+ case amd64_x32_sys_munmap:
+ return gdb_sys_munmap;
- case amd64_sys_brk:
- case amd64_x32_sys_brk:
- return gdb_sys_brk;
+ case amd64_sys_brk:
+ case amd64_x32_sys_brk:
+ return gdb_sys_brk;
- case amd64_sys_rt_sigaction:
- case amd64_x32_sys_rt_sigaction:
- return gdb_sys_rt_sigaction;
+ case amd64_sys_rt_sigaction:
+ case amd64_x32_sys_rt_sigaction:
+ return gdb_sys_rt_sigaction;
- case amd64_sys_rt_sigprocmask:
- case amd64_x32_sys_rt_sigprocmask:
- return gdb_sys_rt_sigprocmask;
+ case amd64_sys_rt_sigprocmask:
+ case amd64_x32_sys_rt_sigprocmask:
+ return gdb_sys_rt_sigprocmask;
- case amd64_sys_rt_sigreturn:
- case amd64_x32_sys_rt_sigreturn:
- return gdb_sys_rt_sigreturn;
+ case amd64_sys_rt_sigreturn:
+ case amd64_x32_sys_rt_sigreturn:
+ return gdb_sys_rt_sigreturn;
- case amd64_sys_ioctl:
- case amd64_x32_sys_ioctl:
- return gdb_sys_ioctl;
+ case amd64_sys_ioctl:
+ case amd64_x32_sys_ioctl:
+ return gdb_sys_ioctl;
- case amd64_sys_pread64:
- case amd64_x32_sys_pread64:
- return gdb_sys_pread64;
+ case amd64_sys_pread64:
+ case amd64_x32_sys_pread64:
+ return gdb_sys_pread64;
- case amd64_sys_pwrite64:
- case amd64_x32_sys_pwrite64:
- return gdb_sys_pwrite64;
+ case amd64_sys_pwrite64:
+ case amd64_x32_sys_pwrite64:
+ return gdb_sys_pwrite64;
- case amd64_sys_readv:
- case amd64_x32_sys_readv:
- return gdb_sys_readv;
+ case amd64_sys_readv:
+ case amd64_x32_sys_readv:
+ return gdb_sys_readv;
- case amd64_sys_writev:
- case amd64_x32_sys_writev:
- return gdb_sys_writev;
+ case amd64_sys_writev:
+ case amd64_x32_sys_writev:
+ return gdb_sys_writev;
- case amd64_sys_access:
- case amd64_x32_sys_access:
- return gdb_sys_access;
+ case amd64_sys_access:
+ case amd64_x32_sys_access:
+ return gdb_sys_access;
- case amd64_sys_pipe:
- case amd64_x32_sys_pipe:
- return gdb_sys_pipe;
+ case amd64_sys_pipe:
+ case amd64_x32_sys_pipe:
+ return gdb_sys_pipe;
- case amd64_sys_pipe2:
- return gdb_sys_pipe2;
+ case amd64_sys_pipe2:
+ return gdb_sys_pipe2;
- case amd64_sys_getrandom:
- return gdb_sys_getrandom;
+ case amd64_sys_getrandom:
+ return gdb_sys_getrandom;
- case amd64_sys_select:
- case amd64_x32_sys_select:
- return gdb_sys_select;
+ case amd64_sys_select:
+ case amd64_x32_sys_select:
+ return gdb_sys_select;
- case amd64_sys_sched_yield:
- case amd64_x32_sys_sched_yield:
- return gdb_sys_sched_yield;
+ case amd64_sys_sched_yield:
+ case amd64_x32_sys_sched_yield:
+ return gdb_sys_sched_yield;
- case amd64_sys_mremap:
- case amd64_x32_sys_mremap:
- return gdb_sys_mremap;
+ case amd64_sys_mremap:
+ case amd64_x32_sys_mremap:
+ return gdb_sys_mremap;
- case amd64_sys_msync:
- case amd64_x32_sys_msync:
- return gdb_sys_msync;
+ case amd64_sys_msync:
+ case amd64_x32_sys_msync:
+ return gdb_sys_msync;
- case amd64_sys_mincore:
- case amd64_x32_sys_mincore:
- return gdb_sys_mincore;
+ case amd64_sys_mincore:
+ case amd64_x32_sys_mincore:
+ return gdb_sys_mincore;
- case amd64_sys_madvise:
- case amd64_x32_sys_madvise:
- return gdb_sys_madvise;
+ case amd64_sys_madvise:
+ case amd64_x32_sys_madvise:
+ return gdb_sys_madvise;
- case amd64_sys_shmget:
- case amd64_x32_sys_shmget:
- return gdb_sys_shmget;
+ case amd64_sys_shmget:
+ case amd64_x32_sys_shmget:
+ return gdb_sys_shmget;
- case amd64_sys_shmat:
- case amd64_x32_sys_shmat:
- return gdb_sys_shmat;
+ case amd64_sys_shmat:
+ case amd64_x32_sys_shmat:
+ return gdb_sys_shmat;
- case amd64_sys_shmctl:
- case amd64_x32_sys_shmctl:
- return gdb_sys_shmctl;
+ case amd64_sys_shmctl:
+ case amd64_x32_sys_shmctl:
+ return gdb_sys_shmctl;
- case amd64_sys_dup:
- case amd64_x32_sys_dup:
- return gdb_sys_dup;
+ case amd64_sys_dup:
+ case amd64_x32_sys_dup:
+ return gdb_sys_dup;
- case amd64_sys_dup2:
- case amd64_x32_sys_dup2:
- return gdb_sys_dup2;
+ case amd64_sys_dup2:
+ case amd64_x32_sys_dup2:
+ return gdb_sys_dup2;
- case amd64_sys_pause:
- case amd64_x32_sys_pause:
- return gdb_sys_pause;
+ case amd64_sys_pause:
+ case amd64_x32_sys_pause:
+ return gdb_sys_pause;
- case amd64_sys_nanosleep:
- case amd64_x32_sys_nanosleep:
- return gdb_sys_nanosleep;
+ case amd64_sys_nanosleep:
+ case amd64_x32_sys_nanosleep:
+ return gdb_sys_nanosleep;
- case amd64_sys_getitimer:
- case amd64_x32_sys_getitimer:
- return gdb_sys_getitimer;
+ case amd64_sys_getitimer:
+ case amd64_x32_sys_getitimer:
+ return gdb_sys_getitimer;
- case amd64_sys_alarm:
- case amd64_x32_sys_alarm:
- return gdb_sys_alarm;
+ case amd64_sys_alarm:
+ case amd64_x32_sys_alarm:
+ return gdb_sys_alarm;
- case amd64_sys_setitimer:
- case amd64_x32_sys_setitimer:
- return gdb_sys_setitimer;
+ case amd64_sys_setitimer:
+ case amd64_x32_sys_setitimer:
+ return gdb_sys_setitimer;
- case amd64_sys_getpid:
- case amd64_x32_sys_getpid:
- return gdb_sys_getpid;
+ case amd64_sys_getpid:
+ case amd64_x32_sys_getpid:
+ return gdb_sys_getpid;
- case amd64_sys_sendfile64:
- case amd64_x32_sys_sendfile64:
- return gdb_sys_sendfile64;
+ case amd64_sys_sendfile64:
+ case amd64_x32_sys_sendfile64:
+ return gdb_sys_sendfile64;
- case amd64_sys_socket:
- case amd64_x32_sys_socket:
- return gdb_sys_socket;
+ case amd64_sys_socket:
+ case amd64_x32_sys_socket:
+ return gdb_sys_socket;
- case amd64_sys_connect:
- case amd64_x32_sys_connect:
- return gdb_sys_connect;
+ case amd64_sys_connect:
+ case amd64_x32_sys_connect:
+ return gdb_sys_connect;
- case amd64_sys_accept:
- case amd64_x32_sys_accept:
- return gdb_sys_accept;
+ case amd64_sys_accept:
+ case amd64_x32_sys_accept:
+ return gdb_sys_accept;
- case amd64_sys_sendto:
- case amd64_x32_sys_sendto:
- return gdb_sys_sendto;
+ case amd64_sys_sendto:
+ case amd64_x32_sys_sendto:
+ return gdb_sys_sendto;
- case amd64_sys_recvfrom:
- case amd64_x32_sys_recvfrom:
- return gdb_sys_recvfrom;
+ case amd64_sys_recvfrom:
+ case amd64_x32_sys_recvfrom:
+ return gdb_sys_recvfrom;
- case amd64_sys_sendmsg:
- case amd64_x32_sys_sendmsg:
- return gdb_sys_sendmsg;
+ case amd64_sys_sendmsg:
+ case amd64_x32_sys_sendmsg:
+ return gdb_sys_sendmsg;
- case amd64_sys_recvmsg:
- case amd64_x32_sys_recvmsg:
- return gdb_sys_recvmsg;
+ case amd64_sys_recvmsg:
+ case amd64_x32_sys_recvmsg:
+ return gdb_sys_recvmsg;
- case amd64_sys_shutdown:
- case amd64_x32_sys_shutdown:
- return gdb_sys_shutdown;
+ case amd64_sys_shutdown:
+ case amd64_x32_sys_shutdown:
+ return gdb_sys_shutdown;
- case amd64_sys_bind:
- case amd64_x32_sys_bind:
- return gdb_sys_bind;
+ case amd64_sys_bind:
+ case amd64_x32_sys_bind:
+ return gdb_sys_bind;
- case amd64_sys_listen:
- case amd64_x32_sys_listen:
- return gdb_sys_listen;
+ case amd64_sys_listen:
+ case amd64_x32_sys_listen:
+ return gdb_sys_listen;
- case amd64_sys_getsockname:
- case amd64_x32_sys_getsockname:
- return gdb_sys_getsockname;
+ case amd64_sys_getsockname:
+ case amd64_x32_sys_getsockname:
+ return gdb_sys_getsockname;
- case amd64_sys_getpeername:
- case amd64_x32_sys_getpeername:
- return gdb_sys_getpeername;
+ case amd64_sys_getpeername:
+ case amd64_x32_sys_getpeername:
+ return gdb_sys_getpeername;
- case amd64_sys_socketpair:
- case amd64_x32_sys_socketpair:
- return gdb_sys_socketpair;
+ case amd64_sys_socketpair:
+ case amd64_x32_sys_socketpair:
+ return gdb_sys_socketpair;
- case amd64_sys_setsockopt:
- case amd64_x32_sys_setsockopt:
- return gdb_sys_setsockopt;
+ case amd64_sys_setsockopt:
+ case amd64_x32_sys_setsockopt:
+ return gdb_sys_setsockopt;
- case amd64_sys_getsockopt:
- case amd64_x32_sys_getsockopt:
- return gdb_sys_getsockopt;
+ case amd64_sys_getsockopt:
+ case amd64_x32_sys_getsockopt:
+ return gdb_sys_getsockopt;
- case amd64_sys_clone:
- case amd64_x32_sys_clone:
- return gdb_sys_clone;
+ case amd64_sys_clone:
+ case amd64_x32_sys_clone:
+ return gdb_sys_clone;
- case amd64_sys_fork:
- case amd64_x32_sys_fork:
- return gdb_sys_fork;
+ case amd64_sys_fork:
+ case amd64_x32_sys_fork:
+ return gdb_sys_fork;
- case amd64_sys_vfork:
- case amd64_x32_sys_vfork:
- return gdb_sys_vfork;
+ case amd64_sys_vfork:
+ case amd64_x32_sys_vfork:
+ return gdb_sys_vfork;
- case amd64_sys_execve:
- case amd64_x32_sys_execve:
- return gdb_sys_execve;
+ case amd64_sys_execve:
+ case amd64_x32_sys_execve:
+ return gdb_sys_execve;
- case amd64_sys_exit:
- case amd64_x32_sys_exit:
- return gdb_sys_exit;
+ case amd64_sys_exit:
+ case amd64_x32_sys_exit:
+ return gdb_sys_exit;
- case amd64_sys_wait4:
- case amd64_x32_sys_wait4:
- return gdb_sys_wait4;
+ case amd64_sys_wait4:
+ case amd64_x32_sys_wait4:
+ return gdb_sys_wait4;
- case amd64_sys_kill:
- case amd64_x32_sys_kill:
- return gdb_sys_kill;
+ case amd64_sys_kill:
+ case amd64_x32_sys_kill:
+ return gdb_sys_kill;
- case amd64_sys_uname:
- case amd64_x32_sys_uname:
- return gdb_sys_uname;
+ case amd64_sys_uname:
+ case amd64_x32_sys_uname:
+ return gdb_sys_uname;
- case amd64_sys_semget:
- case amd64_x32_sys_semget:
- return gdb_sys_semget;
+ case amd64_sys_semget:
+ case amd64_x32_sys_semget:
+ return gdb_sys_semget;
- case amd64_sys_semop:
- case amd64_x32_sys_semop:
- return gdb_sys_semop;
+ case amd64_sys_semop:
+ case amd64_x32_sys_semop:
+ return gdb_sys_semop;
- case amd64_sys_semctl:
- case amd64_x32_sys_semctl:
- return gdb_sys_semctl;
+ case amd64_sys_semctl:
+ case amd64_x32_sys_semctl:
+ return gdb_sys_semctl;
- case amd64_sys_shmdt:
- case amd64_x32_sys_shmdt:
- return gdb_sys_shmdt;
+ case amd64_sys_shmdt:
+ case amd64_x32_sys_shmdt:
+ return gdb_sys_shmdt;
- case amd64_sys_msgget:
- case amd64_x32_sys_msgget:
- return gdb_sys_msgget;
+ case amd64_sys_msgget:
+ case amd64_x32_sys_msgget:
+ return gdb_sys_msgget;
- case amd64_sys_msgsnd:
- case amd64_x32_sys_msgsnd:
- return gdb_sys_msgsnd;
+ case amd64_sys_msgsnd:
+ case amd64_x32_sys_msgsnd:
+ return gdb_sys_msgsnd;
- case amd64_sys_msgrcv:
- case amd64_x32_sys_msgrcv:
- return gdb_sys_msgrcv;
+ case amd64_sys_msgrcv:
+ case amd64_x32_sys_msgrcv:
+ return gdb_sys_msgrcv;
- case amd64_sys_msgctl:
- case amd64_x32_sys_msgctl:
- return gdb_sys_msgctl;
+ case amd64_sys_msgctl:
+ case amd64_x32_sys_msgctl:
+ return gdb_sys_msgctl;
- case amd64_sys_fcntl:
- case amd64_x32_sys_fcntl:
- return gdb_sys_fcntl;
+ case amd64_sys_fcntl:
+ case amd64_x32_sys_fcntl:
+ return gdb_sys_fcntl;
- case amd64_sys_flock:
- case amd64_x32_sys_flock:
- return gdb_sys_flock;
+ case amd64_sys_flock:
+ case amd64_x32_sys_flock:
+ return gdb_sys_flock;
- case amd64_sys_fsync:
- case amd64_x32_sys_fsync:
- return gdb_sys_fsync;
+ case amd64_sys_fsync:
+ case amd64_x32_sys_fsync:
+ return gdb_sys_fsync;
- case amd64_sys_fdatasync:
- case amd64_x32_sys_fdatasync:
- return gdb_sys_fdatasync;
+ case amd64_sys_fdatasync:
+ case amd64_x32_sys_fdatasync:
+ return gdb_sys_fdatasync;
- case amd64_sys_truncate:
- case amd64_x32_sys_truncate:
- return gdb_sys_truncate;
+ case amd64_sys_truncate:
+ case amd64_x32_sys_truncate:
+ return gdb_sys_truncate;
- case amd64_sys_ftruncate:
- case amd64_x32_sys_ftruncate:
- return gdb_sys_ftruncate;
+ case amd64_sys_ftruncate:
+ case amd64_x32_sys_ftruncate:
+ return gdb_sys_ftruncate;
- case amd64_sys_getdents:
- case amd64_x32_sys_getdents:
- return gdb_sys_getdents;
+ case amd64_sys_getdents:
+ case amd64_x32_sys_getdents:
+ return gdb_sys_getdents;
- case amd64_sys_getcwd:
- case amd64_x32_sys_getcwd:
- return gdb_sys_getcwd;
+ case amd64_sys_getcwd:
+ case amd64_x32_sys_getcwd:
+ return gdb_sys_getcwd;
- case amd64_sys_chdir:
- case amd64_x32_sys_chdir:
- return gdb_sys_chdir;
+ case amd64_sys_chdir:
+ case amd64_x32_sys_chdir:
+ return gdb_sys_chdir;
- case amd64_sys_fchdir:
- case amd64_x32_sys_fchdir:
- return gdb_sys_fchdir;
+ case amd64_sys_fchdir:
+ case amd64_x32_sys_fchdir:
+ return gdb_sys_fchdir;
- case amd64_sys_rename:
- case amd64_x32_sys_rename:
- return gdb_sys_rename;
+ case amd64_sys_rename:
+ case amd64_x32_sys_rename:
+ return gdb_sys_rename;
- case amd64_sys_mkdir:
- case amd64_x32_sys_mkdir:
- return gdb_sys_mkdir;
+ case amd64_sys_mkdir:
+ case amd64_x32_sys_mkdir:
+ return gdb_sys_mkdir;
- case amd64_sys_rmdir:
- case amd64_x32_sys_rmdir:
- return gdb_sys_rmdir;
+ case amd64_sys_rmdir:
+ case amd64_x32_sys_rmdir:
+ return gdb_sys_rmdir;
- case amd64_sys_creat:
- case amd64_x32_sys_creat:
- return gdb_sys_creat;
+ case amd64_sys_creat:
+ case amd64_x32_sys_creat:
+ return gdb_sys_creat;
- case amd64_sys_link:
- case amd64_x32_sys_link:
- return gdb_sys_link;
+ case amd64_sys_link:
+ case amd64_x32_sys_link:
+ return gdb_sys_link;
- case amd64_sys_unlink:
- case amd64_x32_sys_unlink:
- return gdb_sys_unlink;
+ case amd64_sys_unlink:
+ case amd64_x32_sys_unlink:
+ return gdb_sys_unlink;
- case amd64_sys_symlink:
- case amd64_x32_sys_symlink:
- return gdb_sys_symlink;
+ case amd64_sys_symlink:
+ case amd64_x32_sys_symlink:
+ return gdb_sys_symlink;
- case amd64_sys_readlink:
- case amd64_x32_sys_readlink:
- return gdb_sys_readlink;
+ case amd64_sys_readlink:
+ case amd64_x32_sys_readlink:
+ return gdb_sys_readlink;
- case amd64_sys_chmod:
- case amd64_x32_sys_chmod:
- return gdb_sys_chmod;
+ case amd64_sys_chmod:
+ case amd64_x32_sys_chmod:
+ return gdb_sys_chmod;
- case amd64_sys_fchmod:
- case amd64_x32_sys_fchmod:
- return gdb_sys_fchmod;
+ case amd64_sys_fchmod:
+ case amd64_x32_sys_fchmod:
+ return gdb_sys_fchmod;
- case amd64_sys_chown:
- case amd64_x32_sys_chown:
- return gdb_sys_chown;
+ case amd64_sys_chown:
+ case amd64_x32_sys_chown:
+ return gdb_sys_chown;
- case amd64_sys_fchown:
- case amd64_x32_sys_fchown:
- return gdb_sys_fchown;
+ case amd64_sys_fchown:
+ case amd64_x32_sys_fchown:
+ return gdb_sys_fchown;
- case amd64_sys_lchown:
- case amd64_x32_sys_lchown:
- return gdb_sys_lchown;
+ case amd64_sys_lchown:
+ case amd64_x32_sys_lchown:
+ return gdb_sys_lchown;
- case amd64_sys_umask:
- case amd64_x32_sys_umask:
- return gdb_sys_umask;
+ case amd64_sys_umask:
+ case amd64_x32_sys_umask:
+ return gdb_sys_umask;
- case amd64_sys_gettimeofday:
- case amd64_x32_sys_gettimeofday:
- return gdb_sys_gettimeofday;
+ case amd64_sys_gettimeofday:
+ case amd64_x32_sys_gettimeofday:
+ return gdb_sys_gettimeofday;
- case amd64_sys_getrlimit:
- case amd64_x32_sys_getrlimit:
- return gdb_sys_getrlimit;
+ case amd64_sys_getrlimit:
+ case amd64_x32_sys_getrlimit:
+ return gdb_sys_getrlimit;
- case amd64_sys_getrusage:
- case amd64_x32_sys_getrusage:
- return gdb_sys_getrusage;
+ case amd64_sys_getrusage:
+ case amd64_x32_sys_getrusage:
+ return gdb_sys_getrusage;
- case amd64_sys_sysinfo:
- case amd64_x32_sys_sysinfo:
- return gdb_sys_sysinfo;
+ case amd64_sys_sysinfo:
+ case amd64_x32_sys_sysinfo:
+ return gdb_sys_sysinfo;
- case amd64_sys_times:
- case amd64_x32_sys_times:
- return gdb_sys_times;
+ case amd64_sys_times:
+ case amd64_x32_sys_times:
+ return gdb_sys_times;
- case amd64_sys_ptrace:
- case amd64_x32_sys_ptrace:
- return gdb_sys_ptrace;
+ case amd64_sys_ptrace:
+ case amd64_x32_sys_ptrace:
+ return gdb_sys_ptrace;
- case amd64_sys_getuid:
- case amd64_x32_sys_getuid:
- return gdb_sys_getuid;
+ case amd64_sys_getuid:
+ case amd64_x32_sys_getuid:
+ return gdb_sys_getuid;
- case amd64_sys_syslog:
- case amd64_x32_sys_syslog:
- return gdb_sys_syslog;
+ case amd64_sys_syslog:
+ case amd64_x32_sys_syslog:
+ return gdb_sys_syslog;
- case amd64_sys_getgid:
- case amd64_x32_sys_getgid:
- return gdb_sys_getgid;
+ case amd64_sys_getgid:
+ case amd64_x32_sys_getgid:
+ return gdb_sys_getgid;
- case amd64_sys_setuid:
- case amd64_x32_sys_setuid:
- return gdb_sys_setuid;
+ case amd64_sys_setuid:
+ case amd64_x32_sys_setuid:
+ return gdb_sys_setuid;
- case amd64_sys_setgid:
- case amd64_x32_sys_setgid:
- return gdb_sys_setgid;
+ case amd64_sys_setgid:
+ case amd64_x32_sys_setgid:
+ return gdb_sys_setgid;
- case amd64_sys_geteuid:
- case amd64_x32_sys_geteuid:
- return gdb_sys_geteuid;
+ case amd64_sys_geteuid:
+ case amd64_x32_sys_geteuid:
+ return gdb_sys_geteuid;
- case amd64_sys_getegid:
- case amd64_x32_sys_getegid:
- return gdb_sys_getegid;
+ case amd64_sys_getegid:
+ case amd64_x32_sys_getegid:
+ return gdb_sys_getegid;
- case amd64_sys_setpgid:
- case amd64_x32_sys_setpgid:
- return gdb_sys_setpgid;
+ case amd64_sys_setpgid:
+ case amd64_x32_sys_setpgid:
+ return gdb_sys_setpgid;
- case amd64_sys_getppid:
- case amd64_x32_sys_getppid:
- return gdb_sys_getppid;
+ case amd64_sys_getppid:
+ case amd64_x32_sys_getppid:
+ return gdb_sys_getppid;
- case amd64_sys_getpgrp:
- case amd64_x32_sys_getpgrp:
- return gdb_sys_getpgrp;
+ case amd64_sys_getpgrp:
+ case amd64_x32_sys_getpgrp:
+ return gdb_sys_getpgrp;
- case amd64_sys_setsid:
- case amd64_x32_sys_setsid:
- return gdb_sys_setsid;
+ case amd64_sys_setsid:
+ case amd64_x32_sys_setsid:
+ return gdb_sys_setsid;
- case amd64_sys_setreuid:
- case amd64_x32_sys_setreuid:
- return gdb_sys_setreuid;
+ case amd64_sys_setreuid:
+ case amd64_x32_sys_setreuid:
+ return gdb_sys_setreuid;
- case amd64_sys_setregid:
- case amd64_x32_sys_setregid:
- return gdb_sys_setregid;
+ case amd64_sys_setregid:
+ case amd64_x32_sys_setregid:
+ return gdb_sys_setregid;
- case amd64_sys_getgroups:
- case amd64_x32_sys_getgroups:
- return gdb_sys_getgroups;
+ case amd64_sys_getgroups:
+ case amd64_x32_sys_getgroups:
+ return gdb_sys_getgroups;
- case amd64_sys_setgroups:
- case amd64_x32_sys_setgroups:
- return gdb_sys_setgroups;
+ case amd64_sys_setgroups:
+ case amd64_x32_sys_setgroups:
+ return gdb_sys_setgroups;
- case amd64_sys_setresuid:
- case amd64_x32_sys_setresuid:
- return gdb_sys_setresuid;
+ case amd64_sys_setresuid:
+ case amd64_x32_sys_setresuid:
+ return gdb_sys_setresuid;
- case amd64_sys_getresuid:
- case amd64_x32_sys_getresuid:
- return gdb_sys_getresuid;
+ case amd64_sys_getresuid:
+ case amd64_x32_sys_getresuid:
+ return gdb_sys_getresuid;
- case amd64_sys_setresgid:
- case amd64_x32_sys_setresgid:
- return gdb_sys_setresgid;
+ case amd64_sys_setresgid:
+ case amd64_x32_sys_setresgid:
+ return gdb_sys_setresgid;
- case amd64_sys_getresgid:
- case amd64_x32_sys_getresgid:
- return gdb_sys_getresgid;
+ case amd64_sys_getresgid:
+ case amd64_x32_sys_getresgid:
+ return gdb_sys_getresgid;
- case amd64_sys_getpgid:
- case amd64_x32_sys_getpgid:
- return gdb_sys_getpgid;
+ case amd64_sys_getpgid:
+ case amd64_x32_sys_getpgid:
+ return gdb_sys_getpgid;
- case amd64_sys_setfsuid:
- case amd64_x32_sys_setfsuid:
- return gdb_sys_setfsuid;
+ case amd64_sys_setfsuid:
+ case amd64_x32_sys_setfsuid:
+ return gdb_sys_setfsuid;
- case amd64_sys_setfsgid:
- case amd64_x32_sys_setfsgid:
- return gdb_sys_setfsgid;
+ case amd64_sys_setfsgid:
+ case amd64_x32_sys_setfsgid:
+ return gdb_sys_setfsgid;
- case amd64_sys_getsid:
- case amd64_x32_sys_getsid:
- return gdb_sys_getsid;
+ case amd64_sys_getsid:
+ case amd64_x32_sys_getsid:
+ return gdb_sys_getsid;
- case amd64_sys_capget:
- case amd64_x32_sys_capget:
- return gdb_sys_capget;
+ case amd64_sys_capget:
+ case amd64_x32_sys_capget:
+ return gdb_sys_capget;
- case amd64_sys_capset:
- case amd64_x32_sys_capset:
- return gdb_sys_capset;
+ case amd64_sys_capset:
+ case amd64_x32_sys_capset:
+ return gdb_sys_capset;
- case amd64_sys_rt_sigpending:
- case amd64_x32_sys_rt_sigpending:
- return gdb_sys_rt_sigpending;
+ case amd64_sys_rt_sigpending:
+ case amd64_x32_sys_rt_sigpending:
+ return gdb_sys_rt_sigpending;
- case amd64_sys_rt_sigtimedwait:
- case amd64_x32_sys_rt_sigtimedwait:
- return gdb_sys_rt_sigtimedwait;
+ case amd64_sys_rt_sigtimedwait:
+ case amd64_x32_sys_rt_sigtimedwait:
+ return gdb_sys_rt_sigtimedwait;
- case amd64_sys_rt_sigqueueinfo:
- case amd64_x32_sys_rt_sigqueueinfo:
- return gdb_sys_rt_sigqueueinfo;
+ case amd64_sys_rt_sigqueueinfo:
+ case amd64_x32_sys_rt_sigqueueinfo:
+ return gdb_sys_rt_sigqueueinfo;
- case amd64_sys_rt_sigsuspend:
- case amd64_x32_sys_rt_sigsuspend:
- return gdb_sys_rt_sigsuspend;
+ case amd64_sys_rt_sigsuspend:
+ case amd64_x32_sys_rt_sigsuspend:
+ return gdb_sys_rt_sigsuspend;
- case amd64_sys_sigaltstack:
- case amd64_x32_sys_sigaltstack:
- return gdb_sys_sigaltstack;
+ case amd64_sys_sigaltstack:
+ case amd64_x32_sys_sigaltstack:
+ return gdb_sys_sigaltstack;
- case amd64_sys_utime:
- case amd64_x32_sys_utime:
- return gdb_sys_utime;
+ case amd64_sys_utime:
+ case amd64_x32_sys_utime:
+ return gdb_sys_utime;
- case amd64_sys_mknod:
- case amd64_x32_sys_mknod:
- return gdb_sys_mknod;
+ case amd64_sys_mknod:
+ case amd64_x32_sys_mknod:
+ return gdb_sys_mknod;
- case amd64_sys_personality:
- case amd64_x32_sys_personality:
- return gdb_sys_personality;
+ case amd64_sys_personality:
+ case amd64_x32_sys_personality:
+ return gdb_sys_personality;
- case amd64_sys_ustat:
- case amd64_x32_sys_ustat:
- return gdb_sys_ustat;
+ case amd64_sys_ustat:
+ case amd64_x32_sys_ustat:
+ return gdb_sys_ustat;
- case amd64_sys_statfs:
- case amd64_x32_sys_statfs:
- return gdb_sys_statfs;
+ case amd64_sys_statfs:
+ case amd64_x32_sys_statfs:
+ return gdb_sys_statfs;
- case amd64_sys_fstatfs:
- case amd64_x32_sys_fstatfs:
- return gdb_sys_fstatfs;
+ case amd64_sys_fstatfs:
+ case amd64_x32_sys_fstatfs:
+ return gdb_sys_fstatfs;
- case amd64_sys_sysfs:
- case amd64_x32_sys_sysfs:
- return gdb_sys_sysfs;
+ case amd64_sys_sysfs:
+ case amd64_x32_sys_sysfs:
+ return gdb_sys_sysfs;
- case amd64_sys_getpriority:
- case amd64_x32_sys_getpriority:
- return gdb_sys_getpriority;
+ case amd64_sys_getpriority:
+ case amd64_x32_sys_getpriority:
+ return gdb_sys_getpriority;
- case amd64_sys_setpriority:
- case amd64_x32_sys_setpriority:
- return gdb_sys_setpriority;
+ case amd64_sys_setpriority:
+ case amd64_x32_sys_setpriority:
+ return gdb_sys_setpriority;
- case amd64_sys_sched_setparam:
- case amd64_x32_sys_sched_setparam:
- return gdb_sys_sched_setparam;
+ case amd64_sys_sched_setparam:
+ case amd64_x32_sys_sched_setparam:
+ return gdb_sys_sched_setparam;
- case amd64_sys_sched_getparam:
- case amd64_x32_sys_sched_getparam:
- return gdb_sys_sched_getparam;
+ case amd64_sys_sched_getparam:
+ case amd64_x32_sys_sched_getparam:
+ return gdb_sys_sched_getparam;
- case amd64_sys_sched_setscheduler:
- case amd64_x32_sys_sched_setscheduler:
- return gdb_sys_sched_setscheduler;
+ case amd64_sys_sched_setscheduler:
+ case amd64_x32_sys_sched_setscheduler:
+ return gdb_sys_sched_setscheduler;
- case amd64_sys_sched_getscheduler:
- case amd64_x32_sys_sched_getscheduler:
- return gdb_sys_sched_getscheduler;
+ case amd64_sys_sched_getscheduler:
+ case amd64_x32_sys_sched_getscheduler:
+ return gdb_sys_sched_getscheduler;
- case amd64_sys_sched_get_priority_max:
- case amd64_x32_sys_sched_get_priority_max:
- return gdb_sys_sched_get_priority_max;
+ case amd64_sys_sched_get_priority_max:
+ case amd64_x32_sys_sched_get_priority_max:
+ return gdb_sys_sched_get_priority_max;
- case amd64_sys_sched_get_priority_min:
- case amd64_x32_sys_sched_get_priority_min:
- return gdb_sys_sched_get_priority_min;
+ case amd64_sys_sched_get_priority_min:
+ case amd64_x32_sys_sched_get_priority_min:
+ return gdb_sys_sched_get_priority_min;
- case amd64_sys_sched_rr_get_interval:
- case amd64_x32_sys_sched_rr_get_interval:
- return gdb_sys_sched_rr_get_interval;
+ case amd64_sys_sched_rr_get_interval:
+ case amd64_x32_sys_sched_rr_get_interval:
+ return gdb_sys_sched_rr_get_interval;
- case amd64_sys_mlock:
- case amd64_x32_sys_mlock:
- return gdb_sys_mlock;
+ case amd64_sys_mlock:
+ case amd64_x32_sys_mlock:
+ return gdb_sys_mlock;
- case amd64_sys_munlock:
- case amd64_x32_sys_munlock:
- return gdb_sys_munlock;
+ case amd64_sys_munlock:
+ case amd64_x32_sys_munlock:
+ return gdb_sys_munlock;
- case amd64_sys_mlockall:
- case amd64_x32_sys_mlockall:
- return gdb_sys_mlockall;
+ case amd64_sys_mlockall:
+ case amd64_x32_sys_mlockall:
+ return gdb_sys_mlockall;
- case amd64_sys_munlockall:
- case amd64_x32_sys_munlockall:
- return gdb_sys_munlockall;
+ case amd64_sys_munlockall:
+ case amd64_x32_sys_munlockall:
+ return gdb_sys_munlockall;
- case amd64_sys_vhangup:
- case amd64_x32_sys_vhangup:
- return gdb_sys_vhangup;
+ case amd64_sys_vhangup:
+ case amd64_x32_sys_vhangup:
+ return gdb_sys_vhangup;
- case amd64_sys_modify_ldt:
- case amd64_x32_sys_modify_ldt:
- return gdb_sys_modify_ldt;
+ case amd64_sys_modify_ldt:
+ case amd64_x32_sys_modify_ldt:
+ return gdb_sys_modify_ldt;
- case amd64_sys_pivot_root:
- case amd64_x32_sys_pivot_root:
- return gdb_sys_pivot_root;
+ case amd64_sys_pivot_root:
+ case amd64_x32_sys_pivot_root:
+ return gdb_sys_pivot_root;
- case amd64_sys_sysctl:
- case amd64_x32_sys_sysctl:
- return gdb_sys_sysctl;
+ case amd64_sys_sysctl:
+ case amd64_x32_sys_sysctl:
+ return gdb_sys_sysctl;
- case amd64_sys_prctl:
- case amd64_x32_sys_prctl:
- return gdb_sys_prctl;
+ case amd64_sys_prctl:
+ case amd64_x32_sys_prctl:
+ return gdb_sys_prctl;
- case amd64_sys_arch_prctl:
- case amd64_x32_sys_arch_prctl:
- return gdb_sys_no_syscall; /* Note */
+ case amd64_sys_arch_prctl:
+ case amd64_x32_sys_arch_prctl:
+ return gdb_sys_no_syscall; /* Note */
- case amd64_sys_adjtimex:
- case amd64_x32_sys_adjtimex:
- return gdb_sys_adjtimex;
+ case amd64_sys_adjtimex:
+ case amd64_x32_sys_adjtimex:
+ return gdb_sys_adjtimex;
- case amd64_sys_setrlimit:
- case amd64_x32_sys_setrlimit:
- return gdb_sys_setrlimit;
+ case amd64_sys_setrlimit:
+ case amd64_x32_sys_setrlimit:
+ return gdb_sys_setrlimit;
- case amd64_sys_chroot:
- case amd64_x32_sys_chroot:
- return gdb_sys_chroot;
+ case amd64_sys_chroot:
+ case amd64_x32_sys_chroot:
+ return gdb_sys_chroot;
- case amd64_sys_sync:
- case amd64_x32_sys_sync:
- return gdb_sys_sync;
+ case amd64_sys_sync:
+ case amd64_x32_sys_sync:
+ return gdb_sys_sync;
- case amd64_sys_acct:
- case amd64_x32_sys_acct:
- return gdb_sys_acct;
+ case amd64_sys_acct:
+ case amd64_x32_sys_acct:
+ return gdb_sys_acct;
- case amd64_sys_settimeofday:
- case amd64_x32_sys_settimeofday:
- return gdb_sys_settimeofday;
+ case amd64_sys_settimeofday:
+ case amd64_x32_sys_settimeofday:
+ return gdb_sys_settimeofday;
- case amd64_sys_mount:
- case amd64_x32_sys_mount:
- return gdb_sys_mount;
+ case amd64_sys_mount:
+ case amd64_x32_sys_mount:
+ return gdb_sys_mount;
- case amd64_sys_umount:
- case amd64_x32_sys_umount:
- return gdb_sys_umount;
+ case amd64_sys_umount:
+ case amd64_x32_sys_umount:
+ return gdb_sys_umount;
- case amd64_sys_swapon:
- case amd64_x32_sys_swapon:
- return gdb_sys_swapon;
+ case amd64_sys_swapon:
+ case amd64_x32_sys_swapon:
+ return gdb_sys_swapon;
- case amd64_sys_swapoff:
- case amd64_x32_sys_swapoff:
- return gdb_sys_swapoff;
+ case amd64_sys_swapoff:
+ case amd64_x32_sys_swapoff:
+ return gdb_sys_swapoff;
- case amd64_sys_reboot:
- case amd64_x32_sys_reboot:
- return gdb_sys_reboot;
+ case amd64_sys_reboot:
+ case amd64_x32_sys_reboot:
+ return gdb_sys_reboot;
- case amd64_sys_sethostname:
- case amd64_x32_sys_sethostname:
- return gdb_sys_sethostname;
+ case amd64_sys_sethostname:
+ case amd64_x32_sys_sethostname:
+ return gdb_sys_sethostname;
- case amd64_sys_setdomainname:
- case amd64_x32_sys_setdomainname:
- return gdb_sys_setdomainname;
+ case amd64_sys_setdomainname:
+ case amd64_x32_sys_setdomainname:
+ return gdb_sys_setdomainname;
- case amd64_sys_iopl:
- case amd64_x32_sys_iopl:
- return gdb_sys_iopl;
+ case amd64_sys_iopl:
+ case amd64_x32_sys_iopl:
+ return gdb_sys_iopl;
- case amd64_sys_ioperm:
- case amd64_x32_sys_ioperm:
- return gdb_sys_ioperm;
+ case amd64_sys_ioperm:
+ case amd64_x32_sys_ioperm:
+ return gdb_sys_ioperm;
- case amd64_sys_init_module:
- case amd64_x32_sys_init_module:
- return gdb_sys_init_module;
+ case amd64_sys_init_module:
+ case amd64_x32_sys_init_module:
+ return gdb_sys_init_module;
- case amd64_sys_delete_module:
- case amd64_x32_sys_delete_module:
- return gdb_sys_delete_module;
+ case amd64_sys_delete_module:
+ case amd64_x32_sys_delete_module:
+ return gdb_sys_delete_module;
- case amd64_sys_quotactl:
- case amd64_x32_sys_quotactl:
- return gdb_sys_quotactl;
+ case amd64_sys_quotactl:
+ case amd64_x32_sys_quotactl:
+ return gdb_sys_quotactl;
- case amd64_sys_nfsservctl:
- return gdb_sys_nfsservctl;
+ case amd64_sys_nfsservctl:
+ return gdb_sys_nfsservctl;
- case amd64_sys_gettid:
- case amd64_x32_sys_gettid:
- return gdb_sys_gettid;
+ case amd64_sys_gettid:
+ case amd64_x32_sys_gettid:
+ return gdb_sys_gettid;
- case amd64_sys_readahead:
- case amd64_x32_sys_readahead:
- return gdb_sys_readahead;
+ case amd64_sys_readahead:
+ case amd64_x32_sys_readahead:
+ return gdb_sys_readahead;
- case amd64_sys_setxattr:
- case amd64_x32_sys_setxattr:
- return gdb_sys_setxattr;
+ case amd64_sys_setxattr:
+ case amd64_x32_sys_setxattr:
+ return gdb_sys_setxattr;
- case amd64_sys_lsetxattr:
- case amd64_x32_sys_lsetxattr:
- return gdb_sys_lsetxattr;
+ case amd64_sys_lsetxattr:
+ case amd64_x32_sys_lsetxattr:
+ return gdb_sys_lsetxattr;
- case amd64_sys_fsetxattr:
- case amd64_x32_sys_fsetxattr:
- return gdb_sys_fsetxattr;
+ case amd64_sys_fsetxattr:
+ case amd64_x32_sys_fsetxattr:
+ return gdb_sys_fsetxattr;
- case amd64_sys_getxattr:
- case amd64_x32_sys_getxattr:
- return gdb_sys_getxattr;
+ case amd64_sys_getxattr:
+ case amd64_x32_sys_getxattr:
+ return gdb_sys_getxattr;
- case amd64_sys_lgetxattr:
- case amd64_x32_sys_lgetxattr:
- return gdb_sys_lgetxattr;
+ case amd64_sys_lgetxattr:
+ case amd64_x32_sys_lgetxattr:
+ return gdb_sys_lgetxattr;
- case amd64_sys_fgetxattr:
- case amd64_x32_sys_fgetxattr:
- return gdb_sys_fgetxattr;
+ case amd64_sys_fgetxattr:
+ case amd64_x32_sys_fgetxattr:
+ return gdb_sys_fgetxattr;
- case amd64_sys_listxattr:
- case amd64_x32_sys_listxattr:
- return gdb_sys_listxattr;
+ case amd64_sys_listxattr:
+ case amd64_x32_sys_listxattr:
+ return gdb_sys_listxattr;
- case amd64_sys_llistxattr:
- case amd64_x32_sys_llistxattr:
- return gdb_sys_llistxattr;
+ case amd64_sys_llistxattr:
+ case amd64_x32_sys_llistxattr:
+ return gdb_sys_llistxattr;
- case amd64_sys_flistxattr:
- case amd64_x32_sys_flistxattr:
- return gdb_sys_flistxattr;
+ case amd64_sys_flistxattr:
+ case amd64_x32_sys_flistxattr:
+ return gdb_sys_flistxattr;
- case amd64_sys_removexattr:
- case amd64_x32_sys_removexattr:
- return gdb_sys_removexattr;
+ case amd64_sys_removexattr:
+ case amd64_x32_sys_removexattr:
+ return gdb_sys_removexattr;
- case amd64_sys_lremovexattr:
- case amd64_x32_sys_lremovexattr:
- return gdb_sys_lremovexattr;
+ case amd64_sys_lremovexattr:
+ case amd64_x32_sys_lremovexattr:
+ return gdb_sys_lremovexattr;
- case amd64_sys_fremovexattr:
- case amd64_x32_sys_fremovexattr:
- return gdb_sys_fremovexattr;
+ case amd64_sys_fremovexattr:
+ case amd64_x32_sys_fremovexattr:
+ return gdb_sys_fremovexattr;
- case amd64_sys_tkill:
- case amd64_x32_sys_tkill:
- return gdb_sys_tkill;
+ case amd64_sys_tkill:
+ case amd64_x32_sys_tkill:
+ return gdb_sys_tkill;
- case amd64_sys_time:
- case amd64_x32_sys_time:
- return gdb_sys_time;
+ case amd64_sys_time:
+ case amd64_x32_sys_time:
+ return gdb_sys_time;
- case amd64_sys_futex:
- case amd64_x32_sys_futex:
- return gdb_sys_futex;
+ case amd64_sys_futex:
+ case amd64_x32_sys_futex:
+ return gdb_sys_futex;
- case amd64_sys_sched_setaffinity:
- case amd64_x32_sys_sched_setaffinity:
- return gdb_sys_sched_setaffinity;
+ case amd64_sys_sched_setaffinity:
+ case amd64_x32_sys_sched_setaffinity:
+ return gdb_sys_sched_setaffinity;
- case amd64_sys_sched_getaffinity:
- case amd64_x32_sys_sched_getaffinity:
- return gdb_sys_sched_getaffinity;
+ case amd64_sys_sched_getaffinity:
+ case amd64_x32_sys_sched_getaffinity:
+ return gdb_sys_sched_getaffinity;
- case amd64_sys_io_setup:
- case amd64_x32_sys_io_setup:
- return gdb_sys_io_setup;
+ case amd64_sys_io_setup:
+ case amd64_x32_sys_io_setup:
+ return gdb_sys_io_setup;
- case amd64_sys_io_destroy:
- case amd64_x32_sys_io_destroy:
- return gdb_sys_io_destroy;
+ case amd64_sys_io_destroy:
+ case amd64_x32_sys_io_destroy:
+ return gdb_sys_io_destroy;
- case amd64_sys_io_getevents:
- case amd64_x32_sys_io_getevents:
- return gdb_sys_io_getevents;
+ case amd64_sys_io_getevents:
+ case amd64_x32_sys_io_getevents:
+ return gdb_sys_io_getevents;
- case amd64_sys_io_submit:
- case amd64_x32_sys_io_submit:
- return gdb_sys_io_submit;
+ case amd64_sys_io_submit:
+ case amd64_x32_sys_io_submit:
+ return gdb_sys_io_submit;
- case amd64_sys_io_cancel:
- case amd64_x32_sys_io_cancel:
- return gdb_sys_io_cancel;
+ case amd64_sys_io_cancel:
+ case amd64_x32_sys_io_cancel:
+ return gdb_sys_io_cancel;
- case amd64_sys_lookup_dcookie:
- case amd64_x32_sys_lookup_dcookie:
- return gdb_sys_lookup_dcookie;
+ case amd64_sys_lookup_dcookie:
+ case amd64_x32_sys_lookup_dcookie:
+ return gdb_sys_lookup_dcookie;
- case amd64_sys_epoll_create:
- case amd64_x32_sys_epoll_create:
- return gdb_sys_epoll_create;
+ case amd64_sys_epoll_create:
+ case amd64_x32_sys_epoll_create:
+ return gdb_sys_epoll_create;
- case amd64_sys_remap_file_pages:
- case amd64_x32_sys_remap_file_pages:
- return gdb_sys_remap_file_pages;
+ case amd64_sys_remap_file_pages:
+ case amd64_x32_sys_remap_file_pages:
+ return gdb_sys_remap_file_pages;
- case amd64_sys_getdents64:
- case amd64_x32_sys_getdents64:
- return gdb_sys_getdents64;
+ case amd64_sys_getdents64:
+ case amd64_x32_sys_getdents64:
+ return gdb_sys_getdents64;
- case amd64_sys_set_tid_address:
- case amd64_x32_sys_set_tid_address:
- return gdb_sys_set_tid_address;
+ case amd64_sys_set_tid_address:
+ case amd64_x32_sys_set_tid_address:
+ return gdb_sys_set_tid_address;
- case amd64_sys_restart_syscall:
- case amd64_x32_sys_restart_syscall:
- return gdb_sys_restart_syscall;
+ case amd64_sys_restart_syscall:
+ case amd64_x32_sys_restart_syscall:
+ return gdb_sys_restart_syscall;
- case amd64_sys_semtimedop:
- case amd64_x32_sys_semtimedop:
- return gdb_sys_semtimedop;
+ case amd64_sys_semtimedop:
+ case amd64_x32_sys_semtimedop:
+ return gdb_sys_semtimedop;
- case amd64_sys_fadvise64:
- case amd64_x32_sys_fadvise64:
- return gdb_sys_fadvise64;
+ case amd64_sys_fadvise64:
+ case amd64_x32_sys_fadvise64:
+ return gdb_sys_fadvise64;
- case amd64_sys_timer_create:
- case amd64_x32_sys_timer_create:
- return gdb_sys_timer_create;
+ case amd64_sys_timer_create:
+ case amd64_x32_sys_timer_create:
+ return gdb_sys_timer_create;
- case amd64_sys_timer_settime:
- case amd64_x32_sys_timer_settime:
- return gdb_sys_timer_settime;
+ case amd64_sys_timer_settime:
+ case amd64_x32_sys_timer_settime:
+ return gdb_sys_timer_settime;
- case amd64_sys_timer_gettime:
- case amd64_x32_sys_timer_gettime:
- return gdb_sys_timer_gettime;
+ case amd64_sys_timer_gettime:
+ case amd64_x32_sys_timer_gettime:
+ return gdb_sys_timer_gettime;
- case amd64_sys_timer_getoverrun:
- case amd64_x32_sys_timer_getoverrun:
- return gdb_sys_timer_getoverrun;
+ case amd64_sys_timer_getoverrun:
+ case amd64_x32_sys_timer_getoverrun:
+ return gdb_sys_timer_getoverrun;
- case amd64_sys_timer_delete:
- case amd64_x32_sys_timer_delete:
- return gdb_sys_timer_delete;
+ case amd64_sys_timer_delete:
+ case amd64_x32_sys_timer_delete:
+ return gdb_sys_timer_delete;
- case amd64_sys_clock_settime:
- case amd64_x32_sys_clock_settime:
- return gdb_sys_clock_settime;
+ case amd64_sys_clock_settime:
+ case amd64_x32_sys_clock_settime:
+ return gdb_sys_clock_settime;
- case amd64_sys_clock_gettime:
- case amd64_x32_sys_clock_gettime:
- return gdb_sys_clock_gettime;
+ case amd64_sys_clock_gettime:
+ case amd64_x32_sys_clock_gettime:
+ return gdb_sys_clock_gettime;
- case amd64_sys_clock_getres:
- case amd64_x32_sys_clock_getres:
- return gdb_sys_clock_getres;
+ case amd64_sys_clock_getres:
+ case amd64_x32_sys_clock_getres:
+ return gdb_sys_clock_getres;
- case amd64_sys_clock_nanosleep:
- case amd64_x32_sys_clock_nanosleep:
- return gdb_sys_clock_nanosleep;
+ case amd64_sys_clock_nanosleep:
+ case amd64_x32_sys_clock_nanosleep:
+ return gdb_sys_clock_nanosleep;
- case amd64_sys_exit_group:
- case amd64_x32_sys_exit_group:
- return gdb_sys_exit_group;
+ case amd64_sys_exit_group:
+ case amd64_x32_sys_exit_group:
+ return gdb_sys_exit_group;
- case amd64_sys_epoll_wait:
- case amd64_x32_sys_epoll_wait:
- return gdb_sys_epoll_wait;
+ case amd64_sys_epoll_wait:
+ case amd64_x32_sys_epoll_wait:
+ return gdb_sys_epoll_wait;
- case amd64_sys_epoll_ctl:
- case amd64_x32_sys_epoll_ctl:
- return gdb_sys_epoll_ctl;
+ case amd64_sys_epoll_ctl:
+ case amd64_x32_sys_epoll_ctl:
+ return gdb_sys_epoll_ctl;
- case amd64_sys_tgkill:
- case amd64_x32_sys_tgkill:
- return gdb_sys_tgkill;
+ case amd64_sys_tgkill:
+ case amd64_x32_sys_tgkill:
+ return gdb_sys_tgkill;
- case amd64_sys_utimes:
- case amd64_x32_sys_utimes:
- return gdb_sys_utimes;
+ case amd64_sys_utimes:
+ case amd64_x32_sys_utimes:
+ return gdb_sys_utimes;
- case amd64_sys_mbind:
- case amd64_x32_sys_mbind:
- return gdb_sys_mbind;
+ case amd64_sys_mbind:
+ case amd64_x32_sys_mbind:
+ return gdb_sys_mbind;
- case amd64_sys_set_mempolicy:
- case amd64_x32_sys_set_mempolicy:
- return gdb_sys_set_mempolicy;
+ case amd64_sys_set_mempolicy:
+ case amd64_x32_sys_set_mempolicy:
+ return gdb_sys_set_mempolicy;
- case amd64_sys_get_mempolicy:
- case amd64_x32_sys_get_mempolicy:
- return gdb_sys_get_mempolicy;
+ case amd64_sys_get_mempolicy:
+ case amd64_x32_sys_get_mempolicy:
+ return gdb_sys_get_mempolicy;
- case amd64_sys_mq_open:
- case amd64_x32_sys_mq_open:
- return gdb_sys_mq_open;
+ case amd64_sys_mq_open:
+ case amd64_x32_sys_mq_open:
+ return gdb_sys_mq_open;
- case amd64_sys_mq_unlink:
- case amd64_x32_sys_mq_unlink:
- return gdb_sys_mq_unlink;
+ case amd64_sys_mq_unlink:
+ case amd64_x32_sys_mq_unlink:
+ return gdb_sys_mq_unlink;
- case amd64_sys_mq_timedsend:
- case amd64_x32_sys_mq_timedsend:
- return gdb_sys_mq_timedsend;
+ case amd64_sys_mq_timedsend:
+ case amd64_x32_sys_mq_timedsend:
+ return gdb_sys_mq_timedsend;
- case amd64_sys_mq_timedreceive:
- case amd64_x32_sys_mq_timedreceive:
- return gdb_sys_mq_timedreceive;
+ case amd64_sys_mq_timedreceive:
+ case amd64_x32_sys_mq_timedreceive:
+ return gdb_sys_mq_timedreceive;
- case amd64_sys_mq_notify:
- case amd64_x32_sys_mq_notify:
- return gdb_sys_mq_notify;
+ case amd64_sys_mq_notify:
+ case amd64_x32_sys_mq_notify:
+ return gdb_sys_mq_notify;
- case amd64_sys_mq_getsetattr:
- case amd64_x32_sys_mq_getsetattr:
- return gdb_sys_mq_getsetattr;
+ case amd64_sys_mq_getsetattr:
+ case amd64_x32_sys_mq_getsetattr:
+ return gdb_sys_mq_getsetattr;
- case amd64_sys_kexec_load:
- case amd64_x32_sys_kexec_load:
- return gdb_sys_kexec_load;
+ case amd64_sys_kexec_load:
+ case amd64_x32_sys_kexec_load:
+ return gdb_sys_kexec_load;
- case amd64_sys_waitid:
- case amd64_x32_sys_waitid:
- return gdb_sys_waitid;
+ case amd64_sys_waitid:
+ case amd64_x32_sys_waitid:
+ return gdb_sys_waitid;
- case amd64_sys_add_key:
- case amd64_x32_sys_add_key:
- return gdb_sys_add_key;
+ case amd64_sys_add_key:
+ case amd64_x32_sys_add_key:
+ return gdb_sys_add_key;
- case amd64_sys_request_key:
- case amd64_x32_sys_request_key:
- return gdb_sys_request_key;
+ case amd64_sys_request_key:
+ case amd64_x32_sys_request_key:
+ return gdb_sys_request_key;
- case amd64_sys_keyctl:
- case amd64_x32_sys_keyctl:
- return gdb_sys_keyctl;
+ case amd64_sys_keyctl:
+ case amd64_x32_sys_keyctl:
+ return gdb_sys_keyctl;
- case amd64_sys_ioprio_set:
- case amd64_x32_sys_ioprio_set:
- return gdb_sys_ioprio_set;
+ case amd64_sys_ioprio_set:
+ case amd64_x32_sys_ioprio_set:
+ return gdb_sys_ioprio_set;
- case amd64_sys_ioprio_get:
- case amd64_x32_sys_ioprio_get:
- return gdb_sys_ioprio_get;
+ case amd64_sys_ioprio_get:
+ case amd64_x32_sys_ioprio_get:
+ return gdb_sys_ioprio_get;
- case amd64_sys_inotify_init:
- case amd64_x32_sys_inotify_init:
- return gdb_sys_inotify_init;
+ case amd64_sys_inotify_init:
+ case amd64_x32_sys_inotify_init:
+ return gdb_sys_inotify_init;
- case amd64_sys_inotify_add_watch:
- case amd64_x32_sys_inotify_add_watch:
- return gdb_sys_inotify_add_watch;
+ case amd64_sys_inotify_add_watch:
+ case amd64_x32_sys_inotify_add_watch:
+ return gdb_sys_inotify_add_watch;
- case amd64_sys_inotify_rm_watch:
- case amd64_x32_sys_inotify_rm_watch:
- return gdb_sys_inotify_rm_watch;
+ case amd64_sys_inotify_rm_watch:
+ case amd64_x32_sys_inotify_rm_watch:
+ return gdb_sys_inotify_rm_watch;
- case amd64_sys_migrate_pages:
- case amd64_x32_sys_migrate_pages:
- return gdb_sys_migrate_pages;
+ case amd64_sys_migrate_pages:
+ case amd64_x32_sys_migrate_pages:
+ return gdb_sys_migrate_pages;
- case amd64_sys_openat:
- case amd64_x32_sys_openat:
- return gdb_sys_openat;
+ case amd64_sys_openat:
+ case amd64_x32_sys_openat:
+ return gdb_sys_openat;
- case amd64_sys_mkdirat:
- case amd64_x32_sys_mkdirat:
- return gdb_sys_mkdirat;
+ case amd64_sys_mkdirat:
+ case amd64_x32_sys_mkdirat:
+ return gdb_sys_mkdirat;
- case amd64_sys_mknodat:
- case amd64_x32_sys_mknodat:
- return gdb_sys_mknodat;
+ case amd64_sys_mknodat:
+ case amd64_x32_sys_mknodat:
+ return gdb_sys_mknodat;
- case amd64_sys_fchownat:
- case amd64_x32_sys_fchownat:
- return gdb_sys_fchownat;
+ case amd64_sys_fchownat:
+ case amd64_x32_sys_fchownat:
+ return gdb_sys_fchownat;
- case amd64_sys_futimesat:
- case amd64_x32_sys_futimesat:
- return gdb_sys_futimesat;
+ case amd64_sys_futimesat:
+ case amd64_x32_sys_futimesat:
+ return gdb_sys_futimesat;
- case amd64_sys_newfstatat:
- case amd64_x32_sys_newfstatat:
- return gdb_sys_newfstatat;
+ case amd64_sys_newfstatat:
+ case amd64_x32_sys_newfstatat:
+ return gdb_sys_newfstatat;
- case amd64_sys_unlinkat:
- case amd64_x32_sys_unlinkat:
- return gdb_sys_unlinkat;
+ case amd64_sys_unlinkat:
+ case amd64_x32_sys_unlinkat:
+ return gdb_sys_unlinkat;
- case amd64_sys_renameat:
- case amd64_x32_sys_renameat:
- return gdb_sys_renameat;
+ case amd64_sys_renameat:
+ case amd64_x32_sys_renameat:
+ return gdb_sys_renameat;
- case amd64_sys_linkat:
- case amd64_x32_sys_linkat:
- return gdb_sys_linkat;
+ case amd64_sys_linkat:
+ case amd64_x32_sys_linkat:
+ return gdb_sys_linkat;
- case amd64_sys_symlinkat:
- case amd64_x32_sys_symlinkat:
- return gdb_sys_symlinkat;
+ case amd64_sys_symlinkat:
+ case amd64_x32_sys_symlinkat:
+ return gdb_sys_symlinkat;
- case amd64_sys_readlinkat:
- case amd64_x32_sys_readlinkat:
- return gdb_sys_readlinkat;
+ case amd64_sys_readlinkat:
+ case amd64_x32_sys_readlinkat:
+ return gdb_sys_readlinkat;
- case amd64_sys_fchmodat:
- case amd64_x32_sys_fchmodat:
- return gdb_sys_fchmodat;
+ case amd64_sys_fchmodat:
+ case amd64_x32_sys_fchmodat:
+ return gdb_sys_fchmodat;
- case amd64_sys_faccessat:
- case amd64_x32_sys_faccessat:
- return gdb_sys_faccessat;
+ case amd64_sys_faccessat:
+ case amd64_x32_sys_faccessat:
+ return gdb_sys_faccessat;
- case amd64_sys_pselect6:
- case amd64_x32_sys_pselect6:
- return gdb_sys_pselect6;
+ case amd64_sys_pselect6:
+ case amd64_x32_sys_pselect6:
+ return gdb_sys_pselect6;
- case amd64_sys_ppoll:
- case amd64_x32_sys_ppoll:
- return gdb_sys_ppoll;
+ case amd64_sys_ppoll:
+ case amd64_x32_sys_ppoll:
+ return gdb_sys_ppoll;
- case amd64_sys_unshare:
- case amd64_x32_sys_unshare:
- return gdb_sys_unshare;
+ case amd64_sys_unshare:
+ case amd64_x32_sys_unshare:
+ return gdb_sys_unshare;
- case amd64_sys_set_robust_list:
- case amd64_x32_sys_set_robust_list:
- return gdb_sys_set_robust_list;
+ case amd64_sys_set_robust_list:
+ case amd64_x32_sys_set_robust_list:
+ return gdb_sys_set_robust_list;
- case amd64_sys_get_robust_list:
- case amd64_x32_sys_get_robust_list:
- return gdb_sys_get_robust_list;
+ case amd64_sys_get_robust_list:
+ case amd64_x32_sys_get_robust_list:
+ return gdb_sys_get_robust_list;
- case amd64_sys_splice:
- case amd64_x32_sys_splice:
- return gdb_sys_splice;
+ case amd64_sys_splice:
+ case amd64_x32_sys_splice:
+ return gdb_sys_splice;
- case amd64_sys_tee:
- case amd64_x32_sys_tee:
- return gdb_sys_tee;
+ case amd64_sys_tee:
+ case amd64_x32_sys_tee:
+ return gdb_sys_tee;
- case amd64_sys_sync_file_range:
- case amd64_x32_sys_sync_file_range:
- return gdb_sys_sync_file_range;
+ case amd64_sys_sync_file_range:
+ case amd64_x32_sys_sync_file_range:
+ return gdb_sys_sync_file_range;
- case amd64_sys_vmsplice:
- case amd64_x32_sys_vmsplice:
- return gdb_sys_vmsplice;
+ case amd64_sys_vmsplice:
+ case amd64_x32_sys_vmsplice:
+ return gdb_sys_vmsplice;
- case amd64_sys_move_pages:
- case amd64_x32_sys_move_pages:
- return gdb_sys_move_pages;
+ case amd64_sys_move_pages:
+ case amd64_x32_sys_move_pages:
+ return gdb_sys_move_pages;
- default:
- return gdb_sys_no_syscall;
- }
+ default:
+ return gdb_sys_no_syscall;
+ }
DIAGNOSTIC_POP
}
@@ -1453,12 +1433,12 @@ amd64_canonicalize_syscall (enum amd64_syscall syscall_number)
static struct linux_record_tdep amd64_linux_record_tdep;
static struct linux_record_tdep amd64_x32_linux_record_tdep;
-#define RECORD_ARCH_GET_FS 0x1003
-#define RECORD_ARCH_GET_GS 0x1004
+#define RECORD_ARCH_GET_FS 0x1003
+#define RECORD_ARCH_GET_GS 0x1004
static int
-amd64_linux_syscall_record_common (struct regcache *regcache,
- struct linux_record_tdep *linux_record_tdep_p)
+amd64_linux_syscall_record_common (
+ struct regcache *regcache, struct linux_record_tdep *linux_record_tdep_p)
{
int ret;
ULONGEST syscall_native;
@@ -1485,11 +1465,10 @@ amd64_linux_syscall_record_common (struct regcache *regcache,
{
CORE_ADDR addr;
- regcache_raw_read_unsigned (regcache,
- linux_record_tdep_p->arg2,
+ regcache_raw_read_unsigned (regcache, linux_record_tdep_p->arg2,
&addr);
- if (record_full_arch_list_add_mem
- (addr, linux_record_tdep_p->size_ulong))
+ if (record_full_arch_list_add_mem (
+ addr, linux_record_tdep_p->size_ulong))
return -1;
}
goto record_regs;
@@ -1503,8 +1482,8 @@ amd64_linux_syscall_record_common (struct regcache *regcache,
if (syscall_gdb == gdb_sys_no_syscall)
{
gdb_printf (gdb_stderr,
- _("Process record and replay target doesn't "
- "support syscall number %s\n"),
+ _ ("Process record and replay target doesn't "
+ "support syscall number %s\n"),
pulongest (syscall_native));
return -1;
}
@@ -1516,7 +1495,7 @@ amd64_linux_syscall_record_common (struct regcache *regcache,
return ret;
}
- record_regs:
+record_regs:
/* Record the return value of the system call. */
if (record_full_arch_list_add_reg (regcache, AMD64_RCX_REGNUM))
return -1;
@@ -1540,13 +1519,12 @@ amd64_x32_linux_syscall_record (struct regcache *regcache)
&amd64_x32_linux_record_tdep);
}
-#define AMD64_LINUX_redzone 128
-#define AMD64_LINUX_xstate 512
+#define AMD64_LINUX_redzone 128
+#define AMD64_LINUX_xstate 512
#define AMD64_LINUX_frame_size 560
static int
-amd64_linux_record_signal (struct gdbarch *gdbarch,
- struct regcache *regcache,
+amd64_linux_record_signal (struct gdbarch *gdbarch, struct regcache *regcache,
enum gdb_signal signal)
{
ULONGEST rsp;
@@ -1569,8 +1547,8 @@ amd64_linux_record_signal (struct gdbarch *gdbarch,
sp -= sizeof (struct rt_sigframe); */
rsp -= AMD64_LINUX_frame_size;
if (record_full_arch_list_add_mem (rsp, AMD64_LINUX_redzone
- + AMD64_LINUX_xstate
- + AMD64_LINUX_frame_size))
+ + AMD64_LINUX_xstate
+ + AMD64_LINUX_frame_size))
return -1;
if (record_full_arch_list_add_end ())
@@ -1582,30 +1560,33 @@ amd64_linux_record_signal (struct gdbarch *gdbarch,
const target_desc *
amd64_linux_read_description (uint64_t xcr0_features_bit, bool is_x32)
{
- static target_desc *amd64_linux_tdescs \
- [2/*AVX*/][2/*MPX*/][2/*AVX512*/][2/*PKRU*/] = {};
- static target_desc *x32_linux_tdescs \
- [2/*AVX*/][2/*AVX512*/][2/*PKRU*/] = {};
+ static target_desc
+ *amd64_linux_tdescs[2 /*AVX*/][2 /*MPX*/][2 /*AVX512*/][2 /*PKRU*/]
+ = {};
+ static target_desc *x32_linux_tdescs[2 /*AVX*/][2 /*AVX512*/][2 /*PKRU*/]
+ = {};
target_desc **tdesc;
if (is_x32)
{
- tdesc = &x32_linux_tdescs[(xcr0_features_bit & X86_XSTATE_AVX) ? 1 : 0 ]
- [(xcr0_features_bit & X86_XSTATE_AVX512) ? 1 : 0]
- [(xcr0_features_bit & X86_XSTATE_PKRU) ? 1 : 0];
+ tdesc
+ = &x32_linux_tdescs[(xcr0_features_bit & X86_XSTATE_AVX) ? 1 : 0]
+ [(xcr0_features_bit & X86_XSTATE_AVX512) ? 1 : 0]
+ [(xcr0_features_bit & X86_XSTATE_PKRU) ? 1 : 0];
}
else
{
- tdesc = &amd64_linux_tdescs[(xcr0_features_bit & X86_XSTATE_AVX) ? 1 : 0]
- [(xcr0_features_bit & X86_XSTATE_MPX) ? 1 : 0]
- [(xcr0_features_bit & X86_XSTATE_AVX512) ? 1 : 0]
- [(xcr0_features_bit & X86_XSTATE_PKRU) ? 1 : 0];
+ tdesc
+ = &amd64_linux_tdescs[(xcr0_features_bit & X86_XSTATE_AVX) ? 1 : 0]
+ [(xcr0_features_bit & X86_XSTATE_MPX) ? 1 : 0]
+ [(xcr0_features_bit & X86_XSTATE_AVX512) ? 1 : 0]
+ [(xcr0_features_bit & X86_XSTATE_PKRU) ? 1 : 0];
}
if (*tdesc == NULL)
- *tdesc = amd64_create_target_description (xcr0_features_bit, is_x32,
- true, true);
+ *tdesc = amd64_create_target_description (xcr0_features_bit, is_x32, true,
+ true);
return *tdesc;
}
@@ -1614,8 +1595,7 @@ amd64_linux_read_description (uint64_t xcr0_features_bit, bool is_x32)
static const struct target_desc *
amd64_linux_core_read_description (struct gdbarch *gdbarch,
- struct target_ops *target,
- bfd *abfd)
+ struct target_ops *target, bfd *abfd)
{
/* Linux/x86-64. */
uint64_t xcr0 = i386_linux_core_read_xcr0 (abfd);
@@ -1638,18 +1618,15 @@ amd64_linux_supply_xstateregset (const struct regset *regset,
static void
amd64_linux_collect_xstateregset (const struct regset *regset,
- const struct regcache *regcache,
- int regnum, void *xstateregs, size_t len)
+ const struct regcache *regcache, int regnum,
+ void *xstateregs, size_t len)
{
amd64_collect_xsave (regcache, regnum, xstateregs, 1);
}
-static const struct regset amd64_linux_xstateregset =
- {
- NULL,
- amd64_linux_supply_xstateregset,
- amd64_linux_collect_xstateregset
- };
+static const struct regset amd64_linux_xstateregset
+ = { NULL, amd64_linux_supply_xstateregset,
+ amd64_linux_collect_xstateregset };
/* Iterate over core file register note sections. */
@@ -1663,23 +1640,24 @@ amd64_linux_iterate_over_regset_sections (struct gdbarch *gdbarch,
cb (".reg", 27 * 8, 27 * 8, &i386_gregset, NULL, cb_data);
cb (".reg2", 512, 512, &amd64_fpregset, NULL, cb_data);
- cb (".reg-xstate", X86_XSTATE_SIZE (tdep->xcr0), X86_XSTATE_SIZE (tdep->xcr0),
- &amd64_linux_xstateregset, "XSAVE extended state", cb_data);
+ cb (".reg-xstate", X86_XSTATE_SIZE (tdep->xcr0),
+ X86_XSTATE_SIZE (tdep->xcr0), &amd64_linux_xstateregset,
+ "XSAVE extended state", cb_data);
}
/* The instruction sequences used in x86_64 machines for a
disabled is-enabled probe. */
const gdb_byte amd64_dtrace_disabled_probe_sequence_1[] = {
- /* xor %rax, %rax */ 0x48, 0x33, 0xc0,
- /* nop */ 0x90,
- /* nop */ 0x90
+ /* xor %rax, %rax */ 0x48, 0x33, 0xc0,
+ /* nop */ 0x90,
+ /* nop */ 0x90
};
const gdb_byte amd64_dtrace_disabled_probe_sequence_2[] = {
- /* xor %rax, %rax */ 0x48, 0x33, 0xc0,
- /* ret */ 0xc3,
- /* nop */ 0x90
+ /* xor %rax, %rax */ 0x48, 0x33, 0xc0,
+ /* ret */ 0xc3,
+ /* nop */ 0x90
};
/* The instruction sequence used in x86_64 machines for enabling a
@@ -1710,7 +1688,7 @@ amd64_dtrace_probe_is_enabled (struct gdbarch *gdbarch, CORE_ADDR addr)
Note that ADDR is offset 3 bytes from the beginning of these
sequences. */
-
+
read_code (addr - 3, buf, 5);
return (memcmp (buf, amd64_dtrace_disabled_probe_sequence_1, 5) != 0
&& memcmp (buf, amd64_dtrace_disabled_probe_sequence_2, 5) != 0);
@@ -1744,8 +1722,7 @@ amd64_dtrace_disable_probe (struct gdbarch *gdbarch, CORE_ADDR addr)
in gdbarch.h. */
static expr::operation_up
-amd64_dtrace_parse_probe_argument (struct gdbarch *gdbarch,
- int narg)
+amd64_dtrace_parse_probe_argument (struct gdbarch *gdbarch, int narg)
{
/* DTrace probe arguments can be found on the ABI-defined places for
regular arguments at the current PC. The probe abstraction
@@ -1755,15 +1732,14 @@ amd64_dtrace_parse_probe_argument (struct gdbarch *gdbarch,
if (narg < 6)
{
- static const int arg_reg_map[6] =
- {
- AMD64_RDI_REGNUM, /* Arg 1. */
- AMD64_RSI_REGNUM, /* Arg 2. */
- AMD64_RDX_REGNUM, /* Arg 3. */
- AMD64_RCX_REGNUM, /* Arg 4. */
- AMD64_R8_REGNUM, /* Arg 5. */
- AMD64_R9_REGNUM /* Arg 6. */
- };
+ static const int arg_reg_map[6] = {
+ AMD64_RDI_REGNUM, /* Arg 1. */
+ AMD64_RSI_REGNUM, /* Arg 2. */
+ AMD64_RDX_REGNUM, /* Arg 3. */
+ AMD64_RCX_REGNUM, /* Arg 4. */
+ AMD64_R8_REGNUM, /* Arg 5. */
+ AMD64_R9_REGNUM /* Arg 6. */
+ };
int regno = arg_reg_map[narg];
const char *regname = user_reg_map_regnum_to_name (gdbarch, regno);
return make_operation<register_operation> (regname);
@@ -1771,30 +1747,31 @@ amd64_dtrace_parse_probe_argument (struct gdbarch *gdbarch,
else
{
/* Additional arguments are passed on the stack. */
- const char *regname = user_reg_map_regnum_to_name (gdbarch, AMD64_RSP_REGNUM);
+ const char *regname
+ = user_reg_map_regnum_to_name (gdbarch, AMD64_RSP_REGNUM);
/* Displacement. */
struct type *long_type = builtin_type (gdbarch)->builtin_long;
- operation_up disp = make_operation<long_const_operation> (long_type,
- narg - 6);
+ operation_up disp
+ = make_operation<long_const_operation> (long_type, narg - 6);
/* Register: SP. */
operation_up reg = make_operation<register_operation> (regname);
- operation_up add = make_operation<add_operation> (std::move (disp),
- std::move (reg));
+ operation_up add
+ = make_operation<add_operation> (std::move (disp), std::move (reg));
/* Cast to long. */
- operation_up cast = make_operation<unop_cast_operation> (std::move (add),
- long_type);
+ operation_up cast
+ = make_operation<unop_cast_operation> (std::move (add), long_type);
return make_operation<unop_ind_operation> (std::move (cast));
}
}
static void
-amd64_linux_init_abi_common(struct gdbarch_info info, struct gdbarch *gdbarch,
- int num_disp_step_buffers)
+amd64_linux_init_abi_common (struct gdbarch_info info, struct gdbarch *gdbarch,
+ int num_disp_step_buffers)
{
i386_gdbarch_tdep *tdep = gdbarch_tdep<i386_gdbarch_tdep> (gdbarch);
@@ -1814,8 +1791,7 @@ amd64_linux_init_abi_common(struct gdbarch_info info, struct gdbarch *gdbarch,
/* Functions for 'catch syscall'. */
set_xml_syscall_file_name (gdbarch, XML_SYSCALL_FILENAME_AMD64);
- set_gdbarch_get_syscall_number (gdbarch,
- amd64_linux_get_syscall_number);
+ set_gdbarch_get_syscall_number (gdbarch, amd64_linux_get_syscall_number);
/* Enable TLS support. */
set_gdbarch_fetch_tls_load_module_address (gdbarch,
@@ -1828,8 +1804,8 @@ amd64_linux_init_abi_common(struct gdbarch_info info, struct gdbarch *gdbarch,
set_gdbarch_skip_solib_resolver (gdbarch, glibc_skip_solib_resolver);
/* Iterate over core file register note sections. */
- set_gdbarch_iterate_over_regset_sections
- (gdbarch, amd64_linux_iterate_over_regset_sections);
+ set_gdbarch_iterate_over_regset_sections (
+ gdbarch, amd64_linux_iterate_over_regset_sections);
set_gdbarch_core_read_description (gdbarch,
amd64_linux_core_read_description);
@@ -1873,8 +1849,7 @@ amd64_linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
return;
valid_p = tdesc_numbered_register (feature, tdesc_data,
- AMD64_LINUX_ORIG_RAX_REGNUM,
- "orig_rax");
+ AMD64_LINUX_ORIG_RAX_REGNUM, "orig_rax");
if (!valid_p)
return;
@@ -2050,11 +2025,12 @@ amd64_linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
tdep->i386_syscall_record = amd64_linux_syscall_record;
/* GNU/Linux uses SVR4-style shared libraries. */
- set_solib_svr4_fetch_link_map_offsets
- (gdbarch, linux_lp64_fetch_link_map_offsets);
+ set_solib_svr4_fetch_link_map_offsets (gdbarch,
+ linux_lp64_fetch_link_map_offsets);
/* Register DTrace handlers. */
- set_gdbarch_dtrace_parse_probe_argument (gdbarch, amd64_dtrace_parse_probe_argument);
+ set_gdbarch_dtrace_parse_probe_argument (gdbarch,
+ amd64_dtrace_parse_probe_argument);
set_gdbarch_dtrace_probe_is_enabled (gdbarch, amd64_dtrace_probe_is_enabled);
set_gdbarch_dtrace_enable_probe (gdbarch, amd64_dtrace_enable_probe);
set_gdbarch_dtrace_disable_probe (gdbarch, amd64_dtrace_disable_probe);
@@ -2088,8 +2064,7 @@ amd64_x32_linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
return;
valid_p = tdesc_numbered_register (feature, tdesc_data,
- AMD64_LINUX_ORIG_RAX_REGNUM,
- "orig_rax");
+ AMD64_LINUX_ORIG_RAX_REGNUM, "orig_rax");
if (!valid_p)
return;
@@ -2222,7 +2197,8 @@ amd64_x32_linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
amd64_x32_linux_record_tdep.ioctl_TIOCGSOFTCAR = 0x5419;
amd64_x32_linux_record_tdep.ioctl_TIOCSSOFTCAR = 0x541A;
amd64_x32_linux_record_tdep.ioctl_FIONREAD = 0x541B;
- amd64_x32_linux_record_tdep.ioctl_TIOCINQ = amd64_x32_linux_record_tdep.ioctl_FIONREAD;
+ amd64_x32_linux_record_tdep.ioctl_TIOCINQ
+ = amd64_x32_linux_record_tdep.ioctl_FIONREAD;
amd64_x32_linux_record_tdep.ioctl_TIOCLINUX = 0x541C;
amd64_x32_linux_record_tdep.ioctl_TIOCCONS = 0x541D;
amd64_x32_linux_record_tdep.ioctl_TIOCGSERIAL = 0x541E;
@@ -2264,16 +2240,17 @@ amd64_x32_linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
tdep->i386_syscall_record = amd64_x32_linux_syscall_record;
/* GNU/Linux uses SVR4-style shared libraries. */
- set_solib_svr4_fetch_link_map_offsets
- (gdbarch, linux_ilp32_fetch_link_map_offsets);
+ set_solib_svr4_fetch_link_map_offsets (gdbarch,
+ linux_ilp32_fetch_link_map_offsets);
}
void _initialize_amd64_linux_tdep ();
+
void
_initialize_amd64_linux_tdep ()
{
- gdbarch_register_osabi (bfd_arch_i386, bfd_mach_x86_64,
- GDB_OSABI_LINUX, amd64_linux_init_abi);
- gdbarch_register_osabi (bfd_arch_i386, bfd_mach_x64_32,
- GDB_OSABI_LINUX, amd64_x32_linux_init_abi);
+ gdbarch_register_osabi (bfd_arch_i386, bfd_mach_x86_64, GDB_OSABI_LINUX,
+ amd64_linux_init_abi);
+ gdbarch_register_osabi (bfd_arch_i386, bfd_mach_x64_32, GDB_OSABI_LINUX,
+ amd64_x32_linux_init_abi);
}
diff --git a/gdb/amd64-linux-tdep.h b/gdb/amd64-linux-tdep.h
index c253ae82f6b..d93ac866c8d 100644
--- a/gdb/amd64-linux-tdep.h
+++ b/gdb/amd64-linux-tdep.h
@@ -53,7 +53,8 @@ const target_desc *amd64_linux_read_description (uint64_t xcr0_features_bit,
Used for process record/replay, these will be translated into
a gdb-canonical set of syscall ids in linux-record.c. */
-enum amd64_syscall {
+enum amd64_syscall
+{
amd64_sys_read = 0,
amd64_sys_write = 1,
amd64_sys_open = 2,
@@ -328,7 +329,8 @@ enum amd64_syscall {
Used for process record/replay, these will be translated into
a gdb-canonical set of syscall ids in linux-record.c. */
-enum amd64_x32_syscall {
+enum amd64_x32_syscall
+{
amd64_x32_syscall_bit = 0x40000000,
amd64_x32_sys_read = (amd64_x32_syscall_bit + 0),
amd64_x32_sys_write = (amd64_x32_syscall_bit + 1),
diff --git a/gdb/amd64-nat.c b/gdb/amd64-nat.c
index dfe1b5c6e34..059dff94351 100644
--- a/gdb/amd64-nat.c
+++ b/gdb/amd64-nat.c
@@ -80,13 +80,12 @@ amd64_native_gregset_supplies_p (struct gdbarch *gdbarch, int regnum)
return (amd64_native_gregset_reg_offset (gdbarch, regnum) != -1);
}
-
/* Supply register REGNUM, whose contents are stored in GREGS, to
REGCACHE. If REGNUM is -1, supply all appropriate registers. */
void
-amd64_supply_native_gregset (struct regcache *regcache,
- const void *gregs, int regnum)
+amd64_supply_native_gregset (struct regcache *regcache, const void *gregs,
+ int regnum)
{
const char *regs = (const char *) gregs;
struct gdbarch *gdbarch = regcache->arch ();
@@ -116,8 +115,8 @@ amd64_supply_native_gregset (struct regcache *regcache,
registers. */
void
-amd64_collect_native_gregset (const struct regcache *regcache,
- void *gregs, int regnum)
+amd64_collect_native_gregset (const struct regcache *regcache, void *gregs,
+ int regnum)
{
char *regs = (char *) gregs;
struct gdbarch *gdbarch = regcache->arch ();
diff --git a/gdb/amd64-netbsd-nat.c b/gdb/amd64-netbsd-nat.c
index 14a762efa62..b93a9f57c9b 100644
--- a/gdb/amd64-netbsd-nat.c
+++ b/gdb/amd64-netbsd-nat.c
@@ -34,29 +34,29 @@
little-endian we get away with that. */
/* From <machine/reg.h>. */
-static int amd64nbsd32_r_reg_offset[] =
-{
- 14 * 8, /* %eax */
- 3 * 8, /* %ecx */
- 2 * 8, /* %edx */
- 13 * 8, /* %ebx */
- 24 * 8, /* %esp */
- 12 * 8, /* %ebp */
- 1 * 8, /* %esi */
- 0 * 8, /* %edi */
- 21 * 8, /* %eip */
- 23 * 8, /* %eflags */
- 22 * 8, /* %cs */
- 25 * 8, /* %ss */
- 18 * 8, /* %ds */
- 17 * 8, /* %es */
- 16 * 8, /* %fs */
- 15 * 8 /* %gs */
+static int amd64nbsd32_r_reg_offset[] = {
+ 14 * 8, /* %eax */
+ 3 * 8, /* %ecx */
+ 2 * 8, /* %edx */
+ 13 * 8, /* %ebx */
+ 24 * 8, /* %esp */
+ 12 * 8, /* %ebp */
+ 1 * 8, /* %esi */
+ 0 * 8, /* %edi */
+ 21 * 8, /* %eip */
+ 23 * 8, /* %eflags */
+ 22 * 8, /* %cs */
+ 25 * 8, /* %ss */
+ 18 * 8, /* %ds */
+ 17 * 8, /* %es */
+ 16 * 8, /* %fs */
+ 15 * 8 /* %gs */
};
static amd64_bsd_nat_target<nbsd_nat_target> the_amd64_nbsd_nat_target;
void _initialize_amd64nbsd_nat ();
+
void
_initialize_amd64nbsd_nat ()
{
diff --git a/gdb/amd64-netbsd-tdep.c b/gdb/amd64-netbsd-tdep.c
index e5de499f1bc..c124a257f56 100644
--- a/gdb/amd64-netbsd-tdep.c
+++ b/gdb/amd64-netbsd-tdep.c
@@ -59,39 +59,32 @@ amd64nbsd_mcontext_addr (frame_info_ptr this_frame)
/* The mcontext structure lives as offset 56 in `struct ucontext'. */
return addr + 56;
}
-
+
/* NetBSD 2.0 or later. */
/* Mapping between the general-purpose registers in `struct reg'
format and GDB's register cache layout. */
/* From <machine/reg.h>. */
-int amd64nbsd_r_reg_offset[] =
-{
- 14 * 8, /* %rax */
- 13 * 8, /* %rbx */
- 3 * 8, /* %rcx */
- 2 * 8, /* %rdx */
- 1 * 8, /* %rsi */
- 0 * 8, /* %rdi */
- 12 * 8, /* %rbp */
- 24 * 8, /* %rsp */
- 4 * 8, /* %r8 .. */
- 5 * 8,
- 6 * 8,
- 7 * 8,
- 8 * 8,
- 9 * 8,
- 10 * 8,
- 11 * 8, /* ... %r15 */
- 21 * 8, /* %rip */
- 23 * 8, /* %eflags */
- 22 * 8, /* %cs */
- 25 * 8, /* %ss */
- 18 * 8, /* %ds */
- 17 * 8, /* %es */
- 16 * 8, /* %fs */
- 15 * 8 /* %gs */
+int amd64nbsd_r_reg_offset[] = {
+ 14 * 8, /* %rax */
+ 13 * 8, /* %rbx */
+ 3 * 8, /* %rcx */
+ 2 * 8, /* %rdx */
+ 1 * 8, /* %rsi */
+ 0 * 8, /* %rdi */
+ 12 * 8, /* %rbp */
+ 24 * 8, /* %rsp */
+ 4 * 8, /* %r8 .. */
+ 5 * 8, 6 * 8, 7 * 8, 8 * 8, 9 * 8, 10 * 8, 11 * 8, /* ... %r15 */
+ 21 * 8, /* %rip */
+ 23 * 8, /* %eflags */
+ 22 * 8, /* %cs */
+ 25 * 8, /* %ss */
+ 18 * 8, /* %ds */
+ 17 * 8, /* %es */
+ 16 * 8, /* %fs */
+ 15 * 8 /* %gs */
};
static void
@@ -117,17 +110,18 @@ amd64nbsd_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
tdep->sc_num_regs = ARRAY_SIZE (amd64nbsd_r_reg_offset);
/* NetBSD uses SVR4-style shared libraries. */
- set_solib_svr4_fetch_link_map_offsets
- (gdbarch, svr4_lp64_fetch_link_map_offsets);
+ set_solib_svr4_fetch_link_map_offsets (gdbarch,
+ svr4_lp64_fetch_link_map_offsets);
}
void _initialize_amd64nbsd_tdep ();
+
void
_initialize_amd64nbsd_tdep ()
{
/* The NetBSD/amd64 native dependent code makes this assumption. */
gdb_assert (ARRAY_SIZE (amd64nbsd_r_reg_offset) == AMD64_NUM_GREGS);
- gdbarch_register_osabi (bfd_arch_i386, bfd_mach_x86_64,
- GDB_OSABI_NETBSD, amd64nbsd_init_abi);
+ gdbarch_register_osabi (bfd_arch_i386, bfd_mach_x86_64, GDB_OSABI_NETBSD,
+ amd64nbsd_init_abi);
}
diff --git a/gdb/amd64-obsd-nat.c b/gdb/amd64-obsd-nat.c
index c05351473f2..be9bdfd1111 100644
--- a/gdb/amd64-obsd-nat.c
+++ b/gdb/amd64-obsd-nat.c
@@ -36,26 +36,24 @@
little-endian we get away with that. */
/* From <machine/reg.h>. */
-static int amd64obsd32_r_reg_offset[] =
-{
- 14 * 8, /* %eax */
- 3 * 8, /* %ecx */
- 2 * 8, /* %edx */
- 13 * 8, /* %ebx */
- 15 * 8, /* %esp */
- 12 * 8, /* %ebp */
- 1 * 8, /* %esi */
- 0 * 8, /* %edi */
- 16 * 8, /* %eip */
- 17 * 8, /* %eflags */
- 18 * 8, /* %cs */
- 19 * 8, /* %ss */
- 20 * 8, /* %ds */
- 21 * 8, /* %es */
- 22 * 8, /* %fs */
- 23 * 8 /* %gs */
+static int amd64obsd32_r_reg_offset[] = {
+ 14 * 8, /* %eax */
+ 3 * 8, /* %ecx */
+ 2 * 8, /* %edx */
+ 13 * 8, /* %ebx */
+ 15 * 8, /* %esp */
+ 12 * 8, /* %ebp */
+ 1 * 8, /* %esi */
+ 0 * 8, /* %edi */
+ 16 * 8, /* %eip */
+ 17 * 8, /* %eflags */
+ 18 * 8, /* %cs */
+ 19 * 8, /* %ss */
+ 20 * 8, /* %ds */
+ 21 * 8, /* %es */
+ 22 * 8, /* %fs */
+ 23 * 8 /* %gs */
};
-
/* Support for debugging kernel virtual memory images. */
@@ -129,6 +127,7 @@ amd64obsd_supply_pcb (struct regcache *regcache, struct pcb *pcb)
static amd64_bsd_nat_target<obsd_nat_target> the_amd64_obsd_nat_target;
void _initialize_amd64obsd_nat ();
+
void
_initialize_amd64obsd_nat ()
{
diff --git a/gdb/amd64-obsd-tdep.c b/gdb/amd64-obsd-tdep.c
index 624c8ce6519..f48d624be3d 100644
--- a/gdb/amd64-obsd-tdep.c
+++ b/gdb/amd64-obsd-tdep.c
@@ -49,17 +49,13 @@ amd64obsd_sigtramp_p (frame_info_ptr this_frame)
{
CORE_ADDR pc = get_frame_pc (this_frame);
CORE_ADDR start_pc = (pc & ~(amd64obsd_page_size - 1));
- const gdb_byte osigreturn[] =
- {
- 0x48, 0xc7, 0xc0,
- 0x67, 0x00, 0x00, 0x00, /* movq $SYS_sigreturn, %rax */
- 0xcd, 0x80 /* int $0x80 */
+ const gdb_byte osigreturn[] = {
+ 0x48, 0xc7, 0xc0, 0x67, 0x00, 0x00, 0x00, /* movq $SYS_sigreturn, %rax */
+ 0xcd, 0x80 /* int $0x80 */
};
- const gdb_byte sigreturn[] =
- {
- 0x48, 0xc7, 0xc0,
- 0x67, 0x00, 0x00, 0x00, /* movq $SYS_sigreturn, %rax */
- 0x0f, 0x05 /* syscall */
+ const gdb_byte sigreturn[] = {
+ 0x48, 0xc7, 0xc0, 0x67, 0x00, 0x00, 0x00, /* movq $SYS_sigreturn, %rax */
+ 0x0f, 0x05 /* syscall */
};
size_t buflen = (sizeof sigreturn) + 1;
gdb_byte *buf;
@@ -78,7 +74,7 @@ amd64obsd_sigtramp_p (frame_info_ptr this_frame)
/* If we can't read the instructions at START_PC, return zero. */
buf = (gdb_byte *) alloca ((sizeof sigreturn) + 1);
- if (!safe_frame_unwind_memory (this_frame, start_pc + 6, {buf, buflen}))
+ if (!safe_frame_unwind_memory (this_frame, start_pc + 6, { buf, buflen }))
return 0;
/* Check for sigreturn(2). Depending on how the assembler encoded
@@ -120,106 +116,85 @@ amd64obsd_sigcontext_addr (frame_info_ptr this_frame)
else
return get_frame_register_unsigned (this_frame, AMD64_RSP_REGNUM);
}
-
+
/* OpenBSD 3.5 or later. */
/* Mapping between the general-purpose registers in `struct reg'
format and GDB's register cache layout. */
/* From <machine/reg.h>. */
-int amd64obsd_r_reg_offset[] =
-{
- 14 * 8, /* %rax */
- 13 * 8, /* %rbx */
- 3 * 8, /* %rcx */
- 2 * 8, /* %rdx */
- 1 * 8, /* %rsi */
- 0 * 8, /* %rdi */
- 12 * 8, /* %rbp */
- 15 * 8, /* %rsp */
- 4 * 8, /* %r8 .. */
- 5 * 8,
- 6 * 8,
- 7 * 8,
- 8 * 8,
- 9 * 8,
- 10 * 8,
- 11 * 8, /* ... %r15 */
- 16 * 8, /* %rip */
- 17 * 8, /* %eflags */
- 18 * 8, /* %cs */
- 19 * 8, /* %ss */
- 20 * 8, /* %ds */
- 21 * 8, /* %es */
- 22 * 8, /* %fs */
- 23 * 8 /* %gs */
+int amd64obsd_r_reg_offset[] = {
+ 14 * 8, /* %rax */
+ 13 * 8, /* %rbx */
+ 3 * 8, /* %rcx */
+ 2 * 8, /* %rdx */
+ 1 * 8, /* %rsi */
+ 0 * 8, /* %rdi */
+ 12 * 8, /* %rbp */
+ 15 * 8, /* %rsp */
+ 4 * 8, /* %r8 .. */
+ 5 * 8, 6 * 8, 7 * 8, 8 * 8, 9 * 8, 10 * 8, 11 * 8, /* ... %r15 */
+ 16 * 8, /* %rip */
+ 17 * 8, /* %eflags */
+ 18 * 8, /* %cs */
+ 19 * 8, /* %ss */
+ 20 * 8, /* %ds */
+ 21 * 8, /* %es */
+ 22 * 8, /* %fs */
+ 23 * 8 /* %gs */
};
/* From <machine/signal.h>. */
-static int amd64obsd_sc_reg_offset[] =
-{
- 14 * 8, /* %rax */
- 13 * 8, /* %rbx */
- 3 * 8, /* %rcx */
- 2 * 8, /* %rdx */
- 1 * 8, /* %rsi */
- 0 * 8, /* %rdi */
- 12 * 8, /* %rbp */
- 24 * 8, /* %rsp */
- 4 * 8, /* %r8 ... */
- 5 * 8,
- 6 * 8,
- 7 * 8,
- 8 * 8,
- 9 * 8,
- 10 * 8,
- 11 * 8, /* ... %r15 */
- 21 * 8, /* %rip */
- 23 * 8, /* %eflags */
- 22 * 8, /* %cs */
- 25 * 8, /* %ss */
- 18 * 8, /* %ds */
- 17 * 8, /* %es */
- 16 * 8, /* %fs */
- 15 * 8 /* %gs */
+static int amd64obsd_sc_reg_offset[] = {
+ 14 * 8, /* %rax */
+ 13 * 8, /* %rbx */
+ 3 * 8, /* %rcx */
+ 2 * 8, /* %rdx */
+ 1 * 8, /* %rsi */
+ 0 * 8, /* %rdi */
+ 12 * 8, /* %rbp */
+ 24 * 8, /* %rsp */
+ 4 * 8, /* %r8 ... */
+ 5 * 8, 6 * 8, 7 * 8, 8 * 8, 9 * 8, 10 * 8, 11 * 8, /* ... %r15 */
+ 21 * 8, /* %rip */
+ 23 * 8, /* %eflags */
+ 22 * 8, /* %cs */
+ 25 * 8, /* %ss */
+ 18 * 8, /* %ds */
+ 17 * 8, /* %es */
+ 16 * 8, /* %fs */
+ 15 * 8 /* %gs */
};
/* From /usr/src/lib/libpthread/arch/amd64/uthread_machdep.c. */
-static int amd64obsd_uthread_reg_offset[] =
-{
- 19 * 8, /* %rax */
- 16 * 8, /* %rbx */
- 18 * 8, /* %rcx */
- 17 * 8, /* %rdx */
- 14 * 8, /* %rsi */
- 13 * 8, /* %rdi */
- 15 * 8, /* %rbp */
- -1, /* %rsp */
- 12 * 8, /* %r8 ... */
- 11 * 8,
- 10 * 8,
- 9 * 8,
- 8 * 8,
- 7 * 8,
- 6 * 8,
- 5 * 8, /* ... %r15 */
- 20 * 8, /* %rip */
- 4 * 8, /* %eflags */
- 21 * 8, /* %cs */
- -1, /* %ss */
- 3 * 8, /* %ds */
- 2 * 8, /* %es */
- 1 * 8, /* %fs */
- 0 * 8 /* %gs */
+static int amd64obsd_uthread_reg_offset[] = {
+ 19 * 8, /* %rax */
+ 16 * 8, /* %rbx */
+ 18 * 8, /* %rcx */
+ 17 * 8, /* %rdx */
+ 14 * 8, /* %rsi */
+ 13 * 8, /* %rdi */
+ 15 * 8, /* %rbp */
+ -1, /* %rsp */
+ 12 * 8, /* %r8 ... */
+ 11 * 8, 10 * 8, 9 * 8, 8 * 8, 7 * 8, 6 * 8, 5 * 8, /* ... %r15 */
+ 20 * 8, /* %rip */
+ 4 * 8, /* %eflags */
+ 21 * 8, /* %cs */
+ -1, /* %ss */
+ 3 * 8, /* %ds */
+ 2 * 8, /* %es */
+ 1 * 8, /* %fs */
+ 0 * 8 /* %gs */
};
/* Offset within the thread structure where we can find the saved
stack pointer (%esp). */
-#define AMD64OBSD_UTHREAD_RSP_OFFSET 400
+#define AMD64OBSD_UTHREAD_RSP_OFFSET 400
static void
-amd64obsd_supply_uthread (struct regcache *regcache,
- int regnum, CORE_ADDR addr)
+amd64obsd_supply_uthread (struct regcache *regcache, int regnum,
+ CORE_ADDR addr)
{
struct gdbarch *gdbarch = regcache->arch ();
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
@@ -262,8 +237,8 @@ amd64obsd_supply_uthread (struct regcache *regcache,
}
static void
-amd64obsd_collect_uthread (const struct regcache *regcache,
- int regnum, CORE_ADDR addr)
+amd64obsd_collect_uthread (const struct regcache *regcache, int regnum,
+ CORE_ADDR addr)
{
struct gdbarch *gdbarch = regcache->arch ();
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
@@ -308,6 +283,7 @@ amd64obsd_collect_uthread (const struct regcache *regcache,
}
}
}
+
/* Kernel debugging support. */
/* From <machine/frame.h>. Easy since `struct trapframe' matches
@@ -336,7 +312,7 @@ amd64obsd_trapframe_cache (frame_info_ptr this_frame, void **this_cache)
find_pc_partial_function (func, &name, NULL, NULL);
if (name && startswith (name, "Xintr"))
- addr = sp + 8; /* It's an interrupt frame. */
+ addr = sp + 8; /* It's an interrupt frame. */
else
addr = sp;
@@ -362,12 +338,12 @@ amd64obsd_trapframe_cache (frame_info_ptr this_frame, void **this_cache)
}
static void
-amd64obsd_trapframe_this_id (frame_info_ptr this_frame,
- void **this_cache, struct frame_id *this_id)
+amd64obsd_trapframe_this_id (frame_info_ptr this_frame, void **this_cache,
+ struct frame_id *this_id)
{
- struct trad_frame_cache *cache =
- amd64obsd_trapframe_cache (this_frame, this_cache);
-
+ struct trad_frame_cache *cache
+ = amd64obsd_trapframe_cache (this_frame, this_cache);
+
trad_frame_get_id (cache, this_id);
}
@@ -375,8 +351,8 @@ static struct value *
amd64obsd_trapframe_prev_register (frame_info_ptr this_frame,
void **this_cache, int regnum)
{
- struct trad_frame_cache *cache =
- amd64obsd_trapframe_cache (this_frame, this_cache);
+ struct trad_frame_cache *cache
+ = amd64obsd_trapframe_cache (this_frame, this_cache);
return trad_frame_get_register (cache, this_frame, regnum);
}
@@ -396,14 +372,14 @@ amd64obsd_trapframe_sniffer (const struct frame_unwind *self,
return 0;
find_pc_partial_function (get_frame_pc (this_frame), &name, NULL, NULL);
- return (name && ((strcmp (name, "calltrap") == 0)
- || (strcmp (name, "osyscall1") == 0)
- || (strcmp (name, "Xsyscall") == 0)
- || (startswith (name, "Xintr"))));
+ return (name
+ && ((strcmp (name, "calltrap") == 0)
+ || (strcmp (name, "osyscall1") == 0)
+ || (strcmp (name, "Xsyscall") == 0)
+ || (startswith (name, "Xintr"))));
}
-static const struct frame_unwind amd64obsd_trapframe_unwind =
-{
+static const struct frame_unwind amd64obsd_trapframe_unwind = {
/* FIXME: kettenis/20051219: This really is more like an interrupt
frame, but SIGTRAMP_FRAME would print <signal handler called>,
which really is not what we want here. */
@@ -415,7 +391,6 @@ static const struct frame_unwind amd64obsd_trapframe_unwind =
NULL,
amd64obsd_trapframe_sniffer
};
-
static void
amd64obsd_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
@@ -443,20 +418,21 @@ amd64obsd_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
bsd_uthread_set_collect_uthread (gdbarch, amd64obsd_collect_uthread);
/* OpenBSD uses SVR4-style shared libraries. */
- set_solib_svr4_fetch_link_map_offsets
- (gdbarch, svr4_lp64_fetch_link_map_offsets);
+ set_solib_svr4_fetch_link_map_offsets (gdbarch,
+ svr4_lp64_fetch_link_map_offsets);
/* Unwind kernel trap frames correctly. */
frame_unwind_prepend_unwinder (gdbarch, &amd64obsd_trapframe_unwind);
}
void _initialize_amd64obsd_tdep ();
+
void
_initialize_amd64obsd_tdep ()
{
/* The OpenBSD/amd64 native dependent code makes this assumption. */
gdb_assert (ARRAY_SIZE (amd64obsd_r_reg_offset) == AMD64_NUM_GREGS);
- gdbarch_register_osabi (bfd_arch_i386, bfd_mach_x86_64,
- GDB_OSABI_OPENBSD, amd64obsd_init_abi);
+ gdbarch_register_osabi (bfd_arch_i386, bfd_mach_x86_64, GDB_OSABI_OPENBSD,
+ amd64obsd_init_abi);
}
diff --git a/gdb/amd64-ravenscar-thread.c b/gdb/amd64-ravenscar-thread.c
index 8b147d8b320..8a87fa4a2b1 100644
--- a/gdb/amd64-ravenscar-thread.c
+++ b/gdb/amd64-ravenscar-thread.c
@@ -41,8 +41,7 @@
R15 : System.Address;
end record;
*/
-static const int register_layout[] =
-{
+static const int register_layout[] = {
/* RAX */ -1,
/* RBX */ 3 * 8,
/* RCX */ -1,
diff --git a/gdb/amd64-sol2-tdep.c b/gdb/amd64-sol2-tdep.c
index 97aecc7dd87..cb732db38bf 100644
--- a/gdb/amd64-sol2-tdep.c
+++ b/gdb/amd64-sol2-tdep.c
@@ -36,32 +36,25 @@
/* From <sys/regset.h>. */
static int amd64_sol2_gregset_reg_offset[] = {
- 14 * 8, /* %rax */
- 11 * 8, /* %rbx */
- 13 * 8, /* %rcx */
- 12 * 8, /* %rdx */
- 9 * 8, /* %rsi */
- 8 * 8, /* %rdi */
- 10 * 8, /* %rbp */
- 20 * 8, /* %rsp */
- 7 * 8, /* %r8 ... */
- 6 * 8,
- 5 * 8,
- 4 * 8,
- 3 * 8,
- 2 * 8,
- 1 * 8,
- 0 * 8, /* ... %r15 */
- 17 * 8, /* %rip */
- 19 * 8, /* %eflags */
- 18 * 8, /* %cs */
- 21 * 8, /* %ss */
- 25 * 8, /* %ds */
- 24 * 8, /* %es */
- 22 * 8, /* %fs */
- 23 * 8 /* %gs */
+ 14 * 8, /* %rax */
+ 11 * 8, /* %rbx */
+ 13 * 8, /* %rcx */
+ 12 * 8, /* %rdx */
+ 9 * 8, /* %rsi */
+ 8 * 8, /* %rdi */
+ 10 * 8, /* %rbp */
+ 20 * 8, /* %rsp */
+ 7 * 8, /* %r8 ... */
+ 6 * 8, 5 * 8, 4 * 8, 3 * 8, 2 * 8, 1 * 8, 0 * 8, /* ... %r15 */
+ 17 * 8, /* %rip */
+ 19 * 8, /* %eflags */
+ 18 * 8, /* %cs */
+ 21 * 8, /* %ss */
+ 25 * 8, /* %ds */
+ 24 * 8, /* %es */
+ 22 * 8, /* %fs */
+ 23 * 8 /* %gs */
};
-
/* Solaris doesn't have a 'struct sigcontext', but it does have a
'mcontext_t' that contains the saved set of machine registers. */
@@ -97,14 +90,15 @@ amd64_sol2_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
tdep->sc_num_regs = tdep->gregset_num_regs;
/* Solaris uses SVR4-style shared libraries. */
- set_solib_svr4_fetch_link_map_offsets
- (gdbarch, svr4_lp64_fetch_link_map_offsets);
+ set_solib_svr4_fetch_link_map_offsets (gdbarch,
+ svr4_lp64_fetch_link_map_offsets);
}
void _initialize_amd64_sol2_tdep ();
+
void
_initialize_amd64_sol2_tdep ()
{
- gdbarch_register_osabi (bfd_arch_i386, bfd_mach_x86_64,
- GDB_OSABI_SOLARIS, amd64_sol2_init_abi);
+ gdbarch_register_osabi (bfd_arch_i386, bfd_mach_x86_64, GDB_OSABI_SOLARIS,
+ amd64_sol2_init_abi);
}
diff --git a/gdb/amd64-tdep.c b/gdb/amd64-tdep.c
index 328e001f5bb..73b76eec0c5 100644
--- a/gdb/amd64-tdep.c
+++ b/gdb/amd64-tdep.c
@@ -60,110 +60,121 @@
/* Register information. */
-static const char * const amd64_register_names[] =
-{
- "rax", "rbx", "rcx", "rdx", "rsi", "rdi", "rbp", "rsp",
+static const char *const amd64_register_names[] = {
+ "rax",
+ "rbx",
+ "rcx",
+ "rdx",
+ "rsi",
+ "rdi",
+ "rbp",
+ "rsp",
/* %r8 is indeed register number 8. */
- "r8", "r9", "r10", "r11", "r12", "r13", "r14", "r15",
- "rip", "eflags", "cs", "ss", "ds", "es", "fs", "gs",
+ "r8",
+ "r9",
+ "r10",
+ "r11",
+ "r12",
+ "r13",
+ "r14",
+ "r15",
+ "rip",
+ "eflags",
+ "cs",
+ "ss",
+ "ds",
+ "es",
+ "fs",
+ "gs",
/* %st0 is register number 24. */
- "st0", "st1", "st2", "st3", "st4", "st5", "st6", "st7",
- "fctrl", "fstat", "ftag", "fiseg", "fioff", "foseg", "fooff", "fop",
+ "st0",
+ "st1",
+ "st2",
+ "st3",
+ "st4",
+ "st5",
+ "st6",
+ "st7",
+ "fctrl",
+ "fstat",
+ "ftag",
+ "fiseg",
+ "fioff",
+ "foseg",
+ "fooff",
+ "fop",
/* %xmm0 is register number 40. */
- "xmm0", "xmm1", "xmm2", "xmm3", "xmm4", "xmm5", "xmm6", "xmm7",
- "xmm8", "xmm9", "xmm10", "xmm11", "xmm12", "xmm13", "xmm14", "xmm15",
+ "xmm0",
+ "xmm1",
+ "xmm2",
+ "xmm3",
+ "xmm4",
+ "xmm5",
+ "xmm6",
+ "xmm7",
+ "xmm8",
+ "xmm9",
+ "xmm10",
+ "xmm11",
+ "xmm12",
+ "xmm13",
+ "xmm14",
+ "xmm15",
"mxcsr",
};
-static const char * const amd64_ymm_names[] =
-{
- "ymm0", "ymm1", "ymm2", "ymm3",
- "ymm4", "ymm5", "ymm6", "ymm7",
- "ymm8", "ymm9", "ymm10", "ymm11",
- "ymm12", "ymm13", "ymm14", "ymm15"
-};
+static const char *const amd64_ymm_names[]
+ = { "ymm0", "ymm1", "ymm2", "ymm3", "ymm4", "ymm5", "ymm6", "ymm7",
+ "ymm8", "ymm9", "ymm10", "ymm11", "ymm12", "ymm13", "ymm14", "ymm15" };
-static const char * const amd64_ymm_avx512_names[] =
-{
- "ymm16", "ymm17", "ymm18", "ymm19",
- "ymm20", "ymm21", "ymm22", "ymm23",
- "ymm24", "ymm25", "ymm26", "ymm27",
- "ymm28", "ymm29", "ymm30", "ymm31"
-};
+static const char *const amd64_ymm_avx512_names[]
+ = { "ymm16", "ymm17", "ymm18", "ymm19", "ymm20", "ymm21", "ymm22", "ymm23",
+ "ymm24", "ymm25", "ymm26", "ymm27", "ymm28", "ymm29", "ymm30", "ymm31" };
-static const char * const amd64_ymmh_names[] =
-{
- "ymm0h", "ymm1h", "ymm2h", "ymm3h",
- "ymm4h", "ymm5h", "ymm6h", "ymm7h",
- "ymm8h", "ymm9h", "ymm10h", "ymm11h",
- "ymm12h", "ymm13h", "ymm14h", "ymm15h"
-};
+static const char *const amd64_ymmh_names[]
+ = { "ymm0h", "ymm1h", "ymm2h", "ymm3h", "ymm4h", "ymm5h",
+ "ymm6h", "ymm7h", "ymm8h", "ymm9h", "ymm10h", "ymm11h",
+ "ymm12h", "ymm13h", "ymm14h", "ymm15h" };
-static const char * const amd64_ymmh_avx512_names[] =
-{
- "ymm16h", "ymm17h", "ymm18h", "ymm19h",
- "ymm20h", "ymm21h", "ymm22h", "ymm23h",
- "ymm24h", "ymm25h", "ymm26h", "ymm27h",
- "ymm28h", "ymm29h", "ymm30h", "ymm31h"
-};
+static const char *const amd64_ymmh_avx512_names[]
+ = { "ymm16h", "ymm17h", "ymm18h", "ymm19h", "ymm20h", "ymm21h",
+ "ymm22h", "ymm23h", "ymm24h", "ymm25h", "ymm26h", "ymm27h",
+ "ymm28h", "ymm29h", "ymm30h", "ymm31h" };
-static const char * const amd64_mpx_names[] =
-{
- "bnd0raw", "bnd1raw", "bnd2raw", "bnd3raw", "bndcfgu", "bndstatus"
-};
+static const char *const amd64_mpx_names[]
+ = { "bnd0raw", "bnd1raw", "bnd2raw", "bnd3raw", "bndcfgu", "bndstatus" };
-static const char * const amd64_k_names[] =
-{
- "k0", "k1", "k2", "k3",
- "k4", "k5", "k6", "k7"
-};
+static const char *const amd64_k_names[]
+ = { "k0", "k1", "k2", "k3", "k4", "k5", "k6", "k7" };
-static const char * const amd64_zmmh_names[] =
-{
- "zmm0h", "zmm1h", "zmm2h", "zmm3h",
- "zmm4h", "zmm5h", "zmm6h", "zmm7h",
- "zmm8h", "zmm9h", "zmm10h", "zmm11h",
- "zmm12h", "zmm13h", "zmm14h", "zmm15h",
- "zmm16h", "zmm17h", "zmm18h", "zmm19h",
- "zmm20h", "zmm21h", "zmm22h", "zmm23h",
- "zmm24h", "zmm25h", "zmm26h", "zmm27h",
- "zmm28h", "zmm29h", "zmm30h", "zmm31h"
-};
+static const char *const amd64_zmmh_names[]
+ = { "zmm0h", "zmm1h", "zmm2h", "zmm3h", "zmm4h", "zmm5h", "zmm6h",
+ "zmm7h", "zmm8h", "zmm9h", "zmm10h", "zmm11h", "zmm12h", "zmm13h",
+ "zmm14h", "zmm15h", "zmm16h", "zmm17h", "zmm18h", "zmm19h", "zmm20h",
+ "zmm21h", "zmm22h", "zmm23h", "zmm24h", "zmm25h", "zmm26h", "zmm27h",
+ "zmm28h", "zmm29h", "zmm30h", "zmm31h" };
-static const char * const amd64_zmm_names[] =
-{
- "zmm0", "zmm1", "zmm2", "zmm3",
- "zmm4", "zmm5", "zmm6", "zmm7",
- "zmm8", "zmm9", "zmm10", "zmm11",
- "zmm12", "zmm13", "zmm14", "zmm15",
- "zmm16", "zmm17", "zmm18", "zmm19",
- "zmm20", "zmm21", "zmm22", "zmm23",
- "zmm24", "zmm25", "zmm26", "zmm27",
- "zmm28", "zmm29", "zmm30", "zmm31"
-};
+static const char *const amd64_zmm_names[]
+ = { "zmm0", "zmm1", "zmm2", "zmm3", "zmm4", "zmm5", "zmm6", "zmm7",
+ "zmm8", "zmm9", "zmm10", "zmm11", "zmm12", "zmm13", "zmm14", "zmm15",
+ "zmm16", "zmm17", "zmm18", "zmm19", "zmm20", "zmm21", "zmm22", "zmm23",
+ "zmm24", "zmm25", "zmm26", "zmm27", "zmm28", "zmm29", "zmm30", "zmm31" };
-static const char * const amd64_xmm_avx512_names[] = {
- "xmm16", "xmm17", "xmm18", "xmm19",
- "xmm20", "xmm21", "xmm22", "xmm23",
- "xmm24", "xmm25", "xmm26", "xmm27",
- "xmm28", "xmm29", "xmm30", "xmm31"
-};
+static const char *const amd64_xmm_avx512_names[]
+ = { "xmm16", "xmm17", "xmm18", "xmm19", "xmm20", "xmm21", "xmm22", "xmm23",
+ "xmm24", "xmm25", "xmm26", "xmm27", "xmm28", "xmm29", "xmm30", "xmm31" };
-static const char * const amd64_pkeys_names[] = {
- "pkru"
-};
+static const char *const amd64_pkeys_names[] = { "pkru" };
/* DWARF Register Number Mapping as defined in the System V psABI,
section 3.6. */
-static int amd64_dwarf_regmap[] =
-{
+static int amd64_dwarf_regmap[] = {
/* General Purpose Registers RAX, RDX, RCX, RBX, RSI, RDI. */
- AMD64_RAX_REGNUM, AMD64_RDX_REGNUM,
- AMD64_RCX_REGNUM, AMD64_RBX_REGNUM,
+ AMD64_RAX_REGNUM, AMD64_RDX_REGNUM, AMD64_RCX_REGNUM, AMD64_RBX_REGNUM,
AMD64_RSI_REGNUM, AMD64_RDI_REGNUM,
/* Frame Pointer Register RBP. */
@@ -173,34 +184,31 @@ static int amd64_dwarf_regmap[] =
AMD64_RSP_REGNUM,
/* Extended Integer Registers 8 - 15. */
- AMD64_R8_REGNUM, /* %r8 */
- AMD64_R9_REGNUM, /* %r9 */
- AMD64_R10_REGNUM, /* %r10 */
- AMD64_R11_REGNUM, /* %r11 */
- AMD64_R12_REGNUM, /* %r12 */
- AMD64_R13_REGNUM, /* %r13 */
- AMD64_R14_REGNUM, /* %r14 */
- AMD64_R15_REGNUM, /* %r15 */
+ AMD64_R8_REGNUM, /* %r8 */
+ AMD64_R9_REGNUM, /* %r9 */
+ AMD64_R10_REGNUM, /* %r10 */
+ AMD64_R11_REGNUM, /* %r11 */
+ AMD64_R12_REGNUM, /* %r12 */
+ AMD64_R13_REGNUM, /* %r13 */
+ AMD64_R14_REGNUM, /* %r14 */
+ AMD64_R15_REGNUM, /* %r15 */
/* Return Address RA. Mapped to RIP. */
AMD64_RIP_REGNUM,
/* SSE Registers 0 - 7. */
- AMD64_XMM0_REGNUM + 0, AMD64_XMM1_REGNUM,
- AMD64_XMM0_REGNUM + 2, AMD64_XMM0_REGNUM + 3,
- AMD64_XMM0_REGNUM + 4, AMD64_XMM0_REGNUM + 5,
+ AMD64_XMM0_REGNUM + 0, AMD64_XMM1_REGNUM, AMD64_XMM0_REGNUM + 2,
+ AMD64_XMM0_REGNUM + 3, AMD64_XMM0_REGNUM + 4, AMD64_XMM0_REGNUM + 5,
AMD64_XMM0_REGNUM + 6, AMD64_XMM0_REGNUM + 7,
/* Extended SSE Registers 8 - 15. */
- AMD64_XMM0_REGNUM + 8, AMD64_XMM0_REGNUM + 9,
- AMD64_XMM0_REGNUM + 10, AMD64_XMM0_REGNUM + 11,
- AMD64_XMM0_REGNUM + 12, AMD64_XMM0_REGNUM + 13,
+ AMD64_XMM0_REGNUM + 8, AMD64_XMM0_REGNUM + 9, AMD64_XMM0_REGNUM + 10,
+ AMD64_XMM0_REGNUM + 11, AMD64_XMM0_REGNUM + 12, AMD64_XMM0_REGNUM + 13,
AMD64_XMM0_REGNUM + 14, AMD64_XMM0_REGNUM + 15,
/* Floating Point Registers 0-7. */
- AMD64_ST0_REGNUM + 0, AMD64_ST0_REGNUM + 1,
- AMD64_ST0_REGNUM + 2, AMD64_ST0_REGNUM + 3,
- AMD64_ST0_REGNUM + 4, AMD64_ST0_REGNUM + 5,
+ AMD64_ST0_REGNUM + 0, AMD64_ST0_REGNUM + 1, AMD64_ST0_REGNUM + 2,
+ AMD64_ST0_REGNUM + 3, AMD64_ST0_REGNUM + 4, AMD64_ST0_REGNUM + 5,
AMD64_ST0_REGNUM + 6, AMD64_ST0_REGNUM + 7,
/* MMX Registers 0 - 7.
@@ -213,33 +221,21 @@ static int amd64_dwarf_regmap[] =
AMD64_EFLAGS_REGNUM,
/* Selector Registers. */
- AMD64_ES_REGNUM,
- AMD64_CS_REGNUM,
- AMD64_SS_REGNUM,
- AMD64_DS_REGNUM,
- AMD64_FS_REGNUM,
- AMD64_GS_REGNUM,
- -1,
- -1,
+ AMD64_ES_REGNUM, AMD64_CS_REGNUM, AMD64_SS_REGNUM, AMD64_DS_REGNUM,
+ AMD64_FS_REGNUM, AMD64_GS_REGNUM, -1, -1,
/* Segment Base Address Registers. */
- -1,
- -1,
- -1,
- -1,
+ -1, -1, -1, -1,
/* Special Selector Registers. */
- -1,
- -1,
+ -1, -1,
/* Floating Point Control Registers. */
- AMD64_MXCSR_REGNUM,
- AMD64_FCTRL_REGNUM,
- AMD64_FSTAT_REGNUM
+ AMD64_MXCSR_REGNUM, AMD64_FCTRL_REGNUM, AMD64_FSTAT_REGNUM
};
-static const int amd64_dwarf_regmap_len =
- (sizeof (amd64_dwarf_regmap) / sizeof (amd64_dwarf_regmap[0]));
+static const int amd64_dwarf_regmap_len
+ = (sizeof (amd64_dwarf_regmap) / sizeof (amd64_dwarf_regmap[0]));
/* Convert DWARF register number REG to the appropriate register
number used by GDB. */
@@ -254,8 +250,7 @@ amd64_dwarf_reg_to_regnum (struct gdbarch *gdbarch, int reg)
if (reg >= 0 && reg < amd64_dwarf_regmap_len)
regnum = amd64_dwarf_regmap[reg];
- if (ymm0_regnum >= 0
- && i386_xmm_regnum_p (gdbarch, regnum))
+ if (ymm0_regnum >= 0 && i386_xmm_regnum_p (gdbarch, regnum))
regnum += ymm0_regnum - I387_XMM0_REGNUM (tdep);
return regnum;
@@ -263,28 +258,27 @@ amd64_dwarf_reg_to_regnum (struct gdbarch *gdbarch, int reg)
/* Map architectural register numbers to gdb register numbers. */
-static const int amd64_arch_regmap[16] =
-{
- AMD64_RAX_REGNUM, /* %rax */
- AMD64_RCX_REGNUM, /* %rcx */
- AMD64_RDX_REGNUM, /* %rdx */
- AMD64_RBX_REGNUM, /* %rbx */
- AMD64_RSP_REGNUM, /* %rsp */
- AMD64_RBP_REGNUM, /* %rbp */
- AMD64_RSI_REGNUM, /* %rsi */
- AMD64_RDI_REGNUM, /* %rdi */
- AMD64_R8_REGNUM, /* %r8 */
- AMD64_R9_REGNUM, /* %r9 */
- AMD64_R10_REGNUM, /* %r10 */
- AMD64_R11_REGNUM, /* %r11 */
- AMD64_R12_REGNUM, /* %r12 */
- AMD64_R13_REGNUM, /* %r13 */
- AMD64_R14_REGNUM, /* %r14 */
- AMD64_R15_REGNUM /* %r15 */
+static const int amd64_arch_regmap[16] = {
+ AMD64_RAX_REGNUM, /* %rax */
+ AMD64_RCX_REGNUM, /* %rcx */
+ AMD64_RDX_REGNUM, /* %rdx */
+ AMD64_RBX_REGNUM, /* %rbx */
+ AMD64_RSP_REGNUM, /* %rsp */
+ AMD64_RBP_REGNUM, /* %rbp */
+ AMD64_RSI_REGNUM, /* %rsi */
+ AMD64_RDI_REGNUM, /* %rdi */
+ AMD64_R8_REGNUM, /* %r8 */
+ AMD64_R9_REGNUM, /* %r9 */
+ AMD64_R10_REGNUM, /* %r10 */
+ AMD64_R11_REGNUM, /* %r11 */
+ AMD64_R12_REGNUM, /* %r12 */
+ AMD64_R13_REGNUM, /* %r13 */
+ AMD64_R14_REGNUM, /* %r14 */
+ AMD64_R15_REGNUM /* %r15 */
};
-static const int amd64_arch_regmap_len =
- (sizeof (amd64_arch_regmap) / sizeof (amd64_arch_regmap[0]));
+static const int amd64_arch_regmap_len
+ = (sizeof (amd64_arch_regmap) / sizeof (amd64_arch_regmap[0]));
/* Convert architectural register number REG to the appropriate register
number used by GDB. */
@@ -299,32 +293,25 @@ amd64_arch_reg_to_regnum (int reg)
/* Register names for byte pseudo-registers. */
-static const char * const amd64_byte_names[] =
-{
- "al", "bl", "cl", "dl", "sil", "dil", "bpl", "spl",
- "r8l", "r9l", "r10l", "r11l", "r12l", "r13l", "r14l", "r15l",
- "ah", "bh", "ch", "dh"
-};
+static const char *const amd64_byte_names[]
+ = { "al", "bl", "cl", "dl", "sil", "dil", "bpl",
+ "spl", "r8l", "r9l", "r10l", "r11l", "r12l", "r13l",
+ "r14l", "r15l", "ah", "bh", "ch", "dh" };
/* Number of lower byte registers. */
#define AMD64_NUM_LOWER_BYTE_REGS 16
/* Register names for word pseudo-registers. */
-static const char * const amd64_word_names[] =
-{
- "ax", "bx", "cx", "dx", "si", "di", "bp", "",
- "r8w", "r9w", "r10w", "r11w", "r12w", "r13w", "r14w", "r15w"
-};
+static const char *const amd64_word_names[]
+ = { "ax", "bx", "cx", "dx", "si", "di", "bp", "",
+ "r8w", "r9w", "r10w", "r11w", "r12w", "r13w", "r14w", "r15w" };
/* Register names for dword pseudo-registers. */
-static const char * const amd64_dword_names[] =
-{
- "eax", "ebx", "ecx", "edx", "esi", "edi", "ebp", "esp",
- "r8d", "r9d", "r10d", "r11d", "r12d", "r13d", "r14d", "r15d",
- "eip"
-};
+static const char *const amd64_dword_names[]
+ = { "eax", "ebx", "ecx", "edx", "esi", "edi", "ebp", "esp", "r8d",
+ "r9d", "r10d", "r11d", "r12d", "r13d", "r14d", "r15d", "eip" };
/* Return the name of register REGNUM. */
@@ -350,8 +337,7 @@ amd64_pseudo_register_name (struct gdbarch *gdbarch, int regnum)
static struct value *
amd64_pseudo_register_read_value (struct gdbarch *gdbarch,
- readable_regcache *regcache,
- int regnum)
+ readable_regcache *regcache, int regnum)
{
i386_gdbarch_tdep *tdep = gdbarch_tdep<i386_gdbarch_tdep> (gdbarch);
@@ -375,8 +361,8 @@ amd64_pseudo_register_read_value (struct gdbarch *gdbarch,
if (status == REG_VALID)
memcpy (buf, raw_buf + 1, 1);
else
- mark_value_bytes_unavailable (result_value, 0,
- value_type (result_value)->length ());
+ mark_value_bytes_unavailable (
+ result_value, 0, value_type (result_value)->length ());
}
else
{
@@ -385,8 +371,8 @@ amd64_pseudo_register_read_value (struct gdbarch *gdbarch,
if (status == REG_VALID)
memcpy (buf, raw_buf, 1);
else
- mark_value_bytes_unavailable (result_value, 0,
- value_type (result_value)->length ());
+ mark_value_bytes_unavailable (
+ result_value, 0, value_type (result_value)->length ());
}
}
else if (i386_dword_regnum_p (gdbarch, regnum))
@@ -410,8 +396,8 @@ amd64_pseudo_register_read_value (struct gdbarch *gdbarch,
static void
amd64_pseudo_register_write (struct gdbarch *gdbarch,
- struct regcache *regcache,
- int regnum, const gdb_byte *buf)
+ struct regcache *regcache, int regnum,
+ const gdb_byte *buf)
{
i386_gdbarch_tdep *tdep = gdbarch_tdep<i386_gdbarch_tdep> (gdbarch);
@@ -488,8 +474,6 @@ amd64_ax_pseudo_register_collect (struct gdbarch *gdbarch,
return i386_ax_pseudo_register_collect (gdbarch, ax, regnum);
}
-
-
/* Register classes as defined in the psABI. */
enum amd64_reg_class
@@ -540,15 +524,15 @@ amd64_merge_classes (enum amd64_reg_class class1, enum amd64_reg_class class2)
return AMD64_SSE;
}
-static void amd64_classify (struct type *type, enum amd64_reg_class theclass[2]);
+static void amd64_classify (struct type *type,
+ enum amd64_reg_class theclass[2]);
/* Return true if TYPE is a structure or union with unaligned fields. */
static bool
amd64_has_unaligned_fields (struct type *type)
{
- if (type->code () == TYPE_CODE_STRUCT
- || type->code () == TYPE_CODE_UNION)
+ if (type->code () == TYPE_CODE_STRUCT || type->code () == TYPE_CODE_UNION)
{
for (int i = 0; i < type->num_fields (); i++)
{
@@ -558,8 +542,7 @@ amd64_has_unaligned_fields (struct type *type)
empty structures), and bitfields (these are handled by
the caller). */
if (field_is_static (&type->field (i))
- || (TYPE_FIELD_BITSIZE (type, i) == 0
- && subtype->length () == 0)
+ || (TYPE_FIELD_BITSIZE (type, i) == 0 && subtype->length () == 0)
|| TYPE_FIELD_PACKED (type, i))
continue;
@@ -570,7 +553,7 @@ amd64_has_unaligned_fields (struct type *type)
int align = type_align (subtype);
if (align == 0)
- error (_("could not determine alignment of type"));
+ error (_ ("could not determine alignment of type"));
int bytepos = bitpos / 8;
if (bytepos % align != 0)
@@ -666,8 +649,7 @@ amd64_classify_aggregate (struct type *type, enum amd64_reg_class theclass[2])
loc_bitpos attributes, which will cause an assert to trigger within
the unaligned field check. As classes with virtual bases are not
trivially copyable, checking that first avoids this problem. */
- if (TYPE_HAS_DYNAMIC_LENGTH (type)
- || type->length () > 16
+ if (TYPE_HAS_DYNAMIC_LENGTH (type) || type->length () > 16
|| !language_pass_by_reference (type).trivially_copyable
|| amd64_has_unaligned_fields (type))
{
@@ -735,8 +717,8 @@ amd64_classify (struct type *type, enum amd64_reg_class theclass[2])
class. */
if ((code == TYPE_CODE_INT || code == TYPE_CODE_ENUM
|| code == TYPE_CODE_BOOL || code == TYPE_CODE_RANGE
- || code == TYPE_CODE_CHAR
- || code == TYPE_CODE_PTR || TYPE_IS_REFERENCE (type))
+ || code == TYPE_CODE_CHAR || code == TYPE_CODE_PTR
+ || TYPE_IS_REFERENCE (type))
&& (len == 1 || len == 2 || len == 4 || len == 8))
theclass[0] = AMD64_INTEGER;
@@ -925,27 +907,24 @@ amd64_return_value (struct gdbarch *gdbarch, struct value *function,
return RETURN_VALUE_REGISTER_CONVENTION;
}
-
static CORE_ADDR
-amd64_push_arguments (struct regcache *regcache, int nargs, struct value **args,
- CORE_ADDR sp, function_call_return_method return_method)
-{
- static int integer_regnum[] =
- {
- AMD64_RDI_REGNUM, /* %rdi */
- AMD64_RSI_REGNUM, /* %rsi */
- AMD64_RDX_REGNUM, /* %rdx */
- AMD64_RCX_REGNUM, /* %rcx */
- AMD64_R8_REGNUM, /* %r8 */
- AMD64_R9_REGNUM /* %r9 */
+amd64_push_arguments (struct regcache *regcache, int nargs,
+ struct value **args, CORE_ADDR sp,
+ function_call_return_method return_method)
+{
+ static int integer_regnum[] = {
+ AMD64_RDI_REGNUM, /* %rdi */
+ AMD64_RSI_REGNUM, /* %rsi */
+ AMD64_RDX_REGNUM, /* %rdx */
+ AMD64_RCX_REGNUM, /* %rcx */
+ AMD64_R8_REGNUM, /* %r8 */
+ AMD64_R9_REGNUM /* %r9 */
};
- static int sse_regnum[] =
- {
+ static int sse_regnum[] = {
/* %xmm0 ... %xmm7 */
- AMD64_XMM0_REGNUM + 0, AMD64_XMM1_REGNUM,
- AMD64_XMM0_REGNUM + 2, AMD64_XMM0_REGNUM + 3,
- AMD64_XMM0_REGNUM + 4, AMD64_XMM0_REGNUM + 5,
+ AMD64_XMM0_REGNUM + 0, AMD64_XMM1_REGNUM, AMD64_XMM0_REGNUM + 2,
+ AMD64_XMM0_REGNUM + 3, AMD64_XMM0_REGNUM + 4, AMD64_XMM0_REGNUM + 5,
AMD64_XMM0_REGNUM + 6, AMD64_XMM0_REGNUM + 7,
};
struct value **stack_args = XALLOCAVEC (struct value *, nargs);
@@ -957,7 +936,7 @@ amd64_push_arguments (struct regcache *regcache, int nargs, struct value **args,
int i;
/* Reserve a register for the "hidden" argument. */
-if (return_method == return_method_struct)
+ if (return_method == return_method_struct)
integer_reg++;
for (i = 0; i < nargs; i++)
@@ -1059,13 +1038,13 @@ if (return_method == return_method_struct)
containing ellipsis (...) in the declaration) %al is used as
hidden argument to specify the number of SSE registers used. */
regcache_raw_write_unsigned (regcache, AMD64_RAX_REGNUM, sse_reg);
- return sp;
+ return sp;
}
static CORE_ADDR
amd64_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
- struct regcache *regcache, CORE_ADDR bp_addr,
- int nargs, struct value **args, CORE_ADDR sp,
+ struct regcache *regcache, CORE_ADDR bp_addr, int nargs,
+ struct value **args, CORE_ADDR sp,
function_call_return_method return_method,
CORE_ADDR struct_addr)
{
@@ -1103,7 +1082,7 @@ amd64_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
return sp + 16;
}
-
+
/* Displaced instruction handling. */
/* A partially decoded instruction.
@@ -1129,8 +1108,9 @@ struct amd64_displaced_step_copy_insn_closure
: public displaced_step_copy_insn_closure
{
amd64_displaced_step_copy_insn_closure (int insn_buf_len)
- : insn_buf (insn_buf_len, 0)
- {}
+ : insn_buf (insn_buf_len, 0)
+ {
+ }
/* For rip-relative insns, saved copy of the reg we use instead of %rip. */
int tmp_used = 0;
@@ -1151,22 +1131,38 @@ struct amd64_displaced_step_copy_insn_closure
static const unsigned char onebyte_has_modrm[256] = {
/* 0 1 2 3 4 5 6 7 8 9 a b c d e f */
/* ------------------------------- */
- /* 00 */ 1,1,1,1,0,0,0,0,1,1,1,1,0,0,0,0, /* 00 */
- /* 10 */ 1,1,1,1,0,0,0,0,1,1,1,1,0,0,0,0, /* 10 */
- /* 20 */ 1,1,1,1,0,0,0,0,1,1,1,1,0,0,0,0, /* 20 */
- /* 30 */ 1,1,1,1,0,0,0,0,1,1,1,1,0,0,0,0, /* 30 */
- /* 40 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 40 */
- /* 50 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 50 */
- /* 60 */ 0,0,1,1,0,0,0,0,0,1,0,1,0,0,0,0, /* 60 */
- /* 70 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 70 */
- /* 80 */ 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, /* 80 */
- /* 90 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 90 */
- /* a0 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* a0 */
- /* b0 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* b0 */
- /* c0 */ 1,1,0,0,1,1,1,1,0,0,0,0,0,0,0,0, /* c0 */
- /* d0 */ 1,1,1,1,0,0,0,0,1,1,1,1,1,1,1,1, /* d0 */
- /* e0 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* e0 */
- /* f0 */ 0,0,0,0,0,0,1,1,0,0,0,0,0,0,1,1 /* f0 */
+ /* 00 */ 1, 1, 1, 1, 0, 0, 0, 0, 1,
+ 1, 1, 1, 0, 0, 0, 0, /* 00 */
+ /* 10 */ 1, 1, 1, 1, 0, 0, 0, 0, 1,
+ 1, 1, 1, 0, 0, 0, 0, /* 10 */
+ /* 20 */ 1, 1, 1, 1, 0, 0, 0, 0, 1,
+ 1, 1, 1, 0, 0, 0, 0, /* 20 */
+ /* 30 */ 1, 1, 1, 1, 0, 0, 0, 0, 1,
+ 1, 1, 1, 0, 0, 0, 0, /* 30 */
+ /* 40 */ 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, /* 40 */
+ /* 50 */ 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, /* 50 */
+ /* 60 */ 0, 0, 1, 1, 0, 0, 0, 0, 0,
+ 1, 0, 1, 0, 0, 0, 0, /* 60 */
+ /* 70 */ 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, /* 70 */
+ /* 80 */ 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, /* 80 */
+ /* 90 */ 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, /* 90 */
+ /* a0 */ 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, /* a0 */
+ /* b0 */ 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, /* b0 */
+ /* c0 */ 1, 1, 0, 0, 1, 1, 1, 1, 0,
+ 0, 0, 0, 0, 0, 0, 0, /* c0 */
+ /* d0 */ 1, 1, 1, 1, 0, 0, 0, 0, 1,
+ 1, 1, 1, 1, 1, 1, 1, /* d0 */
+ /* e0 */ 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, /* e0 */
+ /* f0 */ 0, 0, 0, 0, 0, 0, 1, 1, 0,
+ 0, 0, 0, 0, 0, 1, 1 /* f0 */
/* ------------------------------- */
/* 0 1 2 3 4 5 6 7 8 9 a b c d e f */
};
@@ -1174,22 +1170,38 @@ static const unsigned char onebyte_has_modrm[256] = {
static const unsigned char twobyte_has_modrm[256] = {
/* 0 1 2 3 4 5 6 7 8 9 a b c d e f */
/* ------------------------------- */
- /* 00 */ 1,1,1,1,0,0,0,0,0,0,0,0,0,1,0,1, /* 0f */
- /* 10 */ 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, /* 1f */
- /* 20 */ 1,1,1,1,1,1,1,0,1,1,1,1,1,1,1,1, /* 2f */
- /* 30 */ 0,0,0,0,0,0,0,0,1,0,1,0,0,0,0,0, /* 3f */
- /* 40 */ 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, /* 4f */
- /* 50 */ 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, /* 5f */
- /* 60 */ 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, /* 6f */
- /* 70 */ 1,1,1,1,1,1,1,0,1,1,1,1,1,1,1,1, /* 7f */
- /* 80 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 8f */
- /* 90 */ 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, /* 9f */
- /* a0 */ 0,0,0,1,1,1,1,1,0,0,0,1,1,1,1,1, /* af */
- /* b0 */ 1,1,1,1,1,1,1,1,1,0,1,1,1,1,1,1, /* bf */
- /* c0 */ 1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0, /* cf */
- /* d0 */ 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, /* df */
- /* e0 */ 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, /* ef */
- /* f0 */ 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0 /* ff */
+ /* 00 */ 1, 1, 1, 1, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 1, 0, 1, /* 0f */
+ /* 10 */ 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, /* 1f */
+ /* 20 */ 1, 1, 1, 1, 1, 1, 1, 0, 1,
+ 1, 1, 1, 1, 1, 1, 1, /* 2f */
+ /* 30 */ 0, 0, 0, 0, 0, 0, 0, 0, 1,
+ 0, 1, 0, 0, 0, 0, 0, /* 3f */
+ /* 40 */ 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, /* 4f */
+ /* 50 */ 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, /* 5f */
+ /* 60 */ 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, /* 6f */
+ /* 70 */ 1, 1, 1, 1, 1, 1, 1, 0, 1,
+ 1, 1, 1, 1, 1, 1, 1, /* 7f */
+ /* 80 */ 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, /* 8f */
+ /* 90 */ 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, /* 9f */
+ /* a0 */ 0, 0, 0, 1, 1, 1, 1, 1, 0,
+ 0, 0, 1, 1, 1, 1, 1, /* af */
+ /* b0 */ 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 0, 1, 1, 1, 1, 1, 1, /* bf */
+ /* c0 */ 1, 1, 1, 1, 1, 1, 1, 1, 0,
+ 0, 0, 0, 0, 0, 0, 0, /* cf */
+ /* d0 */ 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, /* df */
+ /* e0 */ 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, /* ef */
+ /* f0 */ 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 0 /* ff */
/* ------------------------------- */
/* 0 1 2 3 4 5 6 7 8 9 a b c d e f */
};
@@ -1296,8 +1308,10 @@ amd64_get_unused_input_int_reg (const struct amd64_insn *details)
if (have_sib)
{
- int base = SIB_BASE_FIELD (details->raw_insn[details->modrm_offset + 1]);
- int idx = SIB_INDEX_FIELD (details->raw_insn[details->modrm_offset + 1]);
+ int base
+ = SIB_BASE_FIELD (details->raw_insn[details->modrm_offset + 1]);
+ int idx
+ = SIB_INDEX_FIELD (details->raw_insn[details->modrm_offset + 1]);
used_regs_mask |= 1 << base;
used_regs_mask |= 1 << idx;
}
@@ -1316,12 +1330,12 @@ amd64_get_unused_input_int_reg (const struct amd64_insn *details)
for (i = 0; i < 8; ++i)
{
- if (! (used_regs_mask & (1 << i)))
+ if (!(used_regs_mask & (1 << i)))
return i;
}
/* We shouldn't get here. */
- internal_error (_("unable to find free reg"));
+ internal_error (_ ("unable to find free reg"));
}
}
@@ -1410,8 +1424,8 @@ amd64_get_insn_details (gdb_byte *insn, struct amd64_insn *details)
static void
fixup_riprel (struct gdbarch *gdbarch,
- amd64_displaced_step_copy_insn_closure *dsc,
- CORE_ADDR from, CORE_ADDR to, struct regcache *regs)
+ amd64_displaced_step_copy_insn_closure *dsc, CORE_ADDR from,
+ CORE_ADDR to, struct regcache *regs)
{
const struct amd64_insn *insn_details = &dsc->insn_details;
int modrm_offset = insn_details->modrm_offset;
@@ -1486,16 +1500,15 @@ fixup_displaced_copy (struct gdbarch *gdbarch,
}
displaced_step_copy_insn_closure_up
-amd64_displaced_step_copy_insn (struct gdbarch *gdbarch,
- CORE_ADDR from, CORE_ADDR to,
- struct regcache *regs)
+amd64_displaced_step_copy_insn (struct gdbarch *gdbarch, CORE_ADDR from,
+ CORE_ADDR to, struct regcache *regs)
{
int len = gdbarch_max_insn_length (gdbarch);
/* Extra space for sentinels so fixup_{riprel,displaced_copy} don't have to
continually watch for running off the end of the buffer. */
int fixup_sentinel_space = len;
- std::unique_ptr<amd64_displaced_step_copy_insn_closure> dsc
- (new amd64_displaced_step_copy_insn_closure (len + fixup_sentinel_space));
+ std::unique_ptr<amd64_displaced_step_copy_insn_closure> dsc (
+ new amd64_displaced_step_copy_insn_closure (len + fixup_sentinel_space));
gdb_byte *buf = &dsc->insn_buf[0];
struct amd64_insn *details = &dsc->insn_details;
@@ -1524,8 +1537,8 @@ amd64_displaced_step_copy_insn (struct gdbarch *gdbarch,
write_memory (to, buf, len);
- displaced_debug_printf ("copy %s->%s: %s",
- paddress (gdbarch, from), paddress (gdbarch, to),
+ displaced_debug_printf ("copy %s->%s: %s", paddress (gdbarch, from),
+ paddress (gdbarch, to),
displaced_step_dump_bytes (buf, len).c_str ());
/* This is a work around for a problem with g++ 4.8. */
@@ -1711,8 +1724,8 @@ amd64_displaced_step_fixup (struct gdbarch *gdbarch,
if (dsc->tmp_used)
{
- displaced_debug_printf ("restoring reg %d to %s",
- dsc->tmp_regno, paddress (gdbarch, dsc->tmp_save));
+ displaced_debug_printf ("restoring reg %d to %s", dsc->tmp_regno,
+ paddress (gdbarch, dsc->tmp_save));
regcache_cooked_write_unsigned (regs, dsc->tmp_regno, dsc->tmp_save);
}
@@ -1728,9 +1741,8 @@ amd64_displaced_step_fixup (struct gdbarch *gdbarch,
the displaced instruction; make it relative to the original insn.
Well, signal handler returns don't need relocation either, but we use the
value of %rip to recognize those; see below. */
- if (! amd64_absolute_jmp_p (insn_details)
- && ! amd64_absolute_call_p (insn_details)
- && ! amd64_ret_p (insn_details))
+ if (!amd64_absolute_jmp_p (insn_details)
+ && !amd64_absolute_call_p (insn_details) && !amd64_ret_p (insn_details))
{
ULONGEST orig_rip;
int insn_len;
@@ -1829,8 +1841,8 @@ append_insns (CORE_ADDR *to, ULONGEST len, const gdb_byte *buf)
}
static void
-amd64_relocate_instruction (struct gdbarch *gdbarch,
- CORE_ADDR *to, CORE_ADDR oldloc)
+amd64_relocate_instruction (struct gdbarch *gdbarch, CORE_ADDR *to,
+ CORE_ADDR oldloc)
{
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
int len = gdbarch_max_insn_length (gdbarch);
@@ -1897,8 +1909,7 @@ amd64_relocate_instruction (struct gdbarch *gdbarch,
push_buf[i++] = 0x44;
push_buf[i++] = 0x24;
push_buf[i++] = 0x04;
- store_unsigned_integer (&push_buf[i], 4, byte_order,
- ret_addr >> 32);
+ store_unsigned_integer (&push_buf[i], 4, byte_order, ret_addr >> 32);
i += 4;
}
gdb_assert (i <= sizeof (push_buf));
@@ -1948,9 +1959,8 @@ amd64_relocate_instruction (struct gdbarch *gdbarch,
append_insns (to, insn_length, buf);
}
-
/* The maximum number of saved registers. This should include %rip. */
-#define AMD64_NUM_SAVED_REGS AMD64_NUM_GREGS
+#define AMD64_NUM_SAVED_REGS AMD64_NUM_GREGS
struct amd64_frame_cache
{
@@ -2049,9 +2059,7 @@ amd64_analyze_stack_align (CORE_ADDR pc, CORE_ADDR current_pc,
/* Check caller-saved saved register. The first instruction has
to be "leaq 8(%rsp), %reg". */
- if ((buf[0] & 0xfb) == 0x48
- && buf[1] == 0x8d
- && buf[3] == 0x24
+ if ((buf[0] & 0xfb) == 0x48 && buf[1] == 0x8d && buf[3] == 0x24
&& buf[4] == 0x8)
{
/* MOD must be binary 10 and R/M must be binary 100. */
@@ -2074,8 +2082,7 @@ amd64_analyze_stack_align (CORE_ADDR pc, CORE_ADDR current_pc,
reg = 0;
if ((buf[0] & 0xf8) == 0x50)
offset = 0;
- else if ((buf[0] & 0xf6) == 0x40
- && (buf[1] & 0xf8) == 0x50)
+ else if ((buf[0] & 0xf6) == 0x40 && (buf[1] & 0xf8) == 0x50)
{
/* Check the REX.B bit. */
if ((buf[0] & 1) != 0)
@@ -2092,16 +2099,14 @@ amd64_analyze_stack_align (CORE_ADDR pc, CORE_ADDR current_pc,
offset++;
/* The next instruction has to be "leaq 16(%rsp), %reg". */
- if ((buf[offset] & 0xfb) != 0x48
- || buf[offset + 1] != 0x8d
- || buf[offset + 3] != 0x24
- || buf[offset + 4] != 0x10)
+ if ((buf[offset] & 0xfb) != 0x48 || buf[offset + 1] != 0x8d
+ || buf[offset + 3] != 0x24 || buf[offset + 4] != 0x10)
return pc;
/* MOD must be binary 10 and R/M must be binary 100. */
if ((buf[offset + 2] & 0xc7) != 0x44)
return pc;
-
+
/* REG has register number. */
r = (buf[offset + 2] >> 3) & 7;
@@ -2121,8 +2126,7 @@ amd64_analyze_stack_align (CORE_ADDR pc, CORE_ADDR current_pc,
return pc;
/* The next instruction has to be "andq $-XXX, %rsp". */
- if (buf[offset] != 0x48
- || buf[offset + 2] != 0xe4
+ if (buf[offset] != 0x48 || buf[offset + 2] != 0xe4
|| (buf[offset + 1] != 0x81 && buf[offset + 1] != 0x83))
return pc;
@@ -2133,8 +2137,7 @@ amd64_analyze_stack_align (CORE_ADDR pc, CORE_ADDR current_pc,
r = 0;
if (buf[offset] == 0xff)
offset++;
- else if ((buf[offset] & 0xf6) == 0x40
- && buf[offset + 1] == 0xff)
+ else if ((buf[offset] & 0xf6) == 0x40 && buf[offset + 1] == 0xff)
{
/* Check the REX.B bit. */
if ((buf[offset] & 0x1) != 0)
@@ -2146,8 +2149,7 @@ amd64_analyze_stack_align (CORE_ADDR pc, CORE_ADDR current_pc,
/* 8bit -8 is 0xf8. REG must be binary 110 and MOD must be binary
01. */
- if (buf[offset + 1] != 0xf8
- || (buf[offset] & 0xf8) != 0x70)
+ if (buf[offset + 1] != 0xf8 || (buf[offset] & 0xf8) != 0x70)
return pc;
/* R/M has register. */
@@ -2167,7 +2169,7 @@ amd64_analyze_stack_align (CORE_ADDR pc, CORE_ADDR current_pc,
static CORE_ADDR
amd64_x32_analyze_stack_align (CORE_ADDR pc, CORE_ADDR current_pc,
- struct amd64_frame_cache *cache)
+ struct amd64_frame_cache *cache)
{
/* There are 2 code sequences to re-align stack before the frame
gets set up:
@@ -2222,8 +2224,7 @@ amd64_x32_analyze_stack_align (CORE_ADDR pc, CORE_ADDR current_pc,
/* Check caller-saved saved register. The first instruction has
to be "leaq 8(%rsp), %reg" or "leal 8(%rsp), %reg". */
if (((buf[offset] & 0xfb) == 0x48 || (buf[offset] & 0xfb) == 0x40)
- && buf[offset + 1] == 0x8d
- && buf[offset + 3] == 0x24
+ && buf[offset + 1] == 0x8d && buf[offset + 3] == 0x24
&& buf[offset + 4] == 0x8)
{
/* MOD must be binary 10 and R/M must be binary 100. */
@@ -2244,8 +2245,7 @@ amd64_x32_analyze_stack_align (CORE_ADDR pc, CORE_ADDR current_pc,
/* Check callee-saved saved register. The first instruction
has to be "pushq %reg". */
reg = 0;
- if ((buf[offset] & 0xf6) == 0x40
- && (buf[offset + 1] & 0xf8) == 0x50)
+ if ((buf[offset] & 0xf6) == 0x40 && (buf[offset + 1] & 0xf8) == 0x50)
{
/* Check the REX.B bit. */
if ((buf[offset] & 1) != 0)
@@ -2268,15 +2268,14 @@ amd64_x32_analyze_stack_align (CORE_ADDR pc, CORE_ADDR current_pc,
/* The next instruction has to be "leaq 16(%rsp), %reg" or
"leal 16(%rsp), %reg". */
if (((buf[offset] & 0xfb) != 0x48 && (buf[offset] & 0xfb) != 0x40)
- || buf[offset + 1] != 0x8d
- || buf[offset + 3] != 0x24
+ || buf[offset + 1] != 0x8d || buf[offset + 3] != 0x24
|| buf[offset + 4] != 0x10)
return pc;
/* MOD must be binary 10 and R/M must be binary 100. */
if ((buf[offset + 2] & 0xc7) != 0x44)
return pc;
-
+
/* REG has register number. */
r = (buf[offset + 2] >> 3) & 7;
@@ -2315,8 +2314,7 @@ amd64_x32_analyze_stack_align (CORE_ADDR pc, CORE_ADDR current_pc,
r = 0;
if (buf[offset] == 0xff)
offset++;
- else if ((buf[offset] & 0xf6) == 0x40
- && buf[offset + 1] == 0xff)
+ else if ((buf[offset] & 0xf6) == 0x40 && buf[offset + 1] == 0xff)
{
/* Check the REX.B bit. */
if ((buf[offset] & 0x1) != 0)
@@ -2328,8 +2326,7 @@ amd64_x32_analyze_stack_align (CORE_ADDR pc, CORE_ADDR current_pc,
/* 8bit -8 is 0xf8. REG must be binary 110 and MOD must be binary
01. */
- if (buf[offset + 1] != 0xf8
- || (buf[offset] & 0xf8) != 0x70)
+ if (buf[offset + 1] != 0xf8 || (buf[offset] & 0xf8) != 0x70)
return pc;
/* R/M has register. */
@@ -2367,9 +2364,8 @@ amd64_x32_analyze_stack_align (CORE_ADDR pc, CORE_ADDR current_pc,
%rbp. */
static CORE_ADDR
-amd64_analyze_prologue (struct gdbarch *gdbarch,
- CORE_ADDR pc, CORE_ADDR current_pc,
- struct amd64_frame_cache *cache)
+amd64_analyze_prologue (struct gdbarch *gdbarch, CORE_ADDR pc,
+ CORE_ADDR current_pc, struct amd64_frame_cache *cache)
{
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
/* The `endbr64` instruction. */
@@ -2408,7 +2404,7 @@ amd64_analyze_prologue (struct gdbarch *gdbarch,
if (current_pc <= pc)
return current_pc;
- if (op == 0x55) /* pushq %rbp */
+ if (op == 0x55) /* pushq %rbp */
{
/* Take into account that we've executed the `pushq %rbp' that
starts this instruction sequence. */
@@ -2478,8 +2474,8 @@ amd64_skip_xmm_prologue (CORE_ADDR pc, CORE_ADDR start_pc)
start_pc_sal = find_pc_sect_line (start_pc, NULL, 0);
if (start_pc_sal.symtab == NULL
- || producer_is_gcc_ge_4 (start_pc_sal.symtab->compunit ()
- ->producer ()) < 6
+ || producer_is_gcc_ge_4 (start_pc_sal.symtab->compunit ()->producer ())
+ < 6
|| start_pc_sal.pc != start_pc || pc >= start_pc_sal.end)
return pc;
@@ -2548,22 +2544,20 @@ amd64_skip_prologue (struct gdbarch *gdbarch, CORE_ADDR start_pc)
prologue and another one after. We trust clang and newer Intel
compilers to emit usable line notes. */
if (post_prologue_pc
- && (cust != NULL
- && cust->producer () != nullptr
+ && (cust != NULL && cust->producer () != nullptr
&& (producer_is_llvm (cust->producer ())
- || producer_is_icc_ge_19 (cust->producer ()))))
- return std::max (start_pc, post_prologue_pc);
+ || producer_is_icc_ge_19 (cust->producer ()))))
+ return std::max (start_pc, post_prologue_pc);
}
amd64_init_frame_cache (&cache);
- pc = amd64_analyze_prologue (gdbarch, start_pc, 0xffffffffffffffffLL,
- &cache);
+ pc
+ = amd64_analyze_prologue (gdbarch, start_pc, 0xffffffffffffffffLL, &cache);
if (cache.frameless_p)
return start_pc;
return amd64_skip_xmm_prologue (pc, start_pc);
}
-
/* Normal frames. */
@@ -2606,8 +2600,8 @@ amd64_frame_cache_1 (frame_info_ptr this_frame,
else
{
get_frame_register (this_frame, AMD64_RSP_REGNUM, buf);
- cache->base = extract_unsigned_integer (buf, 8, byte_order)
- + cache->sp_offset;
+ cache->base
+ = extract_unsigned_integer (buf, 8, byte_order) + cache->sp_offset;
}
}
else
@@ -2661,11 +2655,9 @@ amd64_frame_cache (frame_info_ptr this_frame, void **this_cache)
}
static enum unwind_stop_reason
-amd64_frame_unwind_stop_reason (frame_info_ptr this_frame,
- void **this_cache)
+amd64_frame_unwind_stop_reason (frame_info_ptr this_frame, void **this_cache)
{
- struct amd64_frame_cache *cache =
- amd64_frame_cache (this_frame, this_cache);
+ struct amd64_frame_cache *cache = amd64_frame_cache (this_frame, this_cache);
if (!cache->base_p)
return UNWIND_UNAVAILABLE;
@@ -2681,8 +2673,7 @@ static void
amd64_frame_this_id (frame_info_ptr this_frame, void **this_cache,
struct frame_id *this_id)
{
- struct amd64_frame_cache *cache =
- amd64_frame_cache (this_frame, this_cache);
+ struct amd64_frame_cache *cache = amd64_frame_cache (this_frame, this_cache);
if (!cache->base_p)
(*this_id) = frame_id_build_unavailable_stack (cache->pc);
@@ -2700,8 +2691,7 @@ amd64_frame_prev_register (frame_info_ptr this_frame, void **this_cache,
int regnum)
{
struct gdbarch *gdbarch = get_frame_arch (this_frame);
- struct amd64_frame_cache *cache =
- amd64_frame_cache (this_frame, this_cache);
+ struct amd64_frame_cache *cache = amd64_frame_cache (this_frame, this_cache);
gdb_assert (regnum >= 0);
@@ -2715,23 +2705,20 @@ amd64_frame_prev_register (frame_info_ptr this_frame, void **this_cache,
return frame_unwind_got_register (this_frame, regnum, regnum);
}
-static const struct frame_unwind amd64_frame_unwind =
-{
- "amd64 prologue",
- NORMAL_FRAME,
- amd64_frame_unwind_stop_reason,
- amd64_frame_this_id,
- amd64_frame_prev_register,
- NULL,
- default_frame_sniffer
-};
-
+static const struct frame_unwind amd64_frame_unwind
+ = { "amd64 prologue",
+ NORMAL_FRAME,
+ amd64_frame_unwind_stop_reason,
+ amd64_frame_this_id,
+ amd64_frame_prev_register,
+ NULL,
+ default_frame_sniffer };
+
/* Generate a bytecode expression to get the value of the saved PC. */
static void
-amd64_gen_return_address (struct gdbarch *gdbarch,
- struct agent_expr *ax, struct axs_value *value,
- CORE_ADDR scope)
+amd64_gen_return_address (struct gdbarch *gdbarch, struct agent_expr *ax,
+ struct axs_value *value, CORE_ADDR scope)
{
/* The following sequence assumes the traditional use of the base
register. */
@@ -2741,7 +2728,6 @@ amd64_gen_return_address (struct gdbarch *gdbarch,
value->type = register_type (gdbarch, AMD64_RIP_REGNUM);
value->kind = axs_lvalue_memory;
}
-
/* Signal trampolines. */
@@ -2793,8 +2779,8 @@ static enum unwind_stop_reason
amd64_sigtramp_frame_unwind_stop_reason (frame_info_ptr this_frame,
void **this_cache)
{
- struct amd64_frame_cache *cache =
- amd64_sigtramp_frame_cache (this_frame, this_cache);
+ struct amd64_frame_cache *cache
+ = amd64_sigtramp_frame_cache (this_frame, this_cache);
if (!cache->base_p)
return UNWIND_UNAVAILABLE;
@@ -2803,11 +2789,11 @@ amd64_sigtramp_frame_unwind_stop_reason (frame_info_ptr this_frame,
}
static void
-amd64_sigtramp_frame_this_id (frame_info_ptr this_frame,
- void **this_cache, struct frame_id *this_id)
+amd64_sigtramp_frame_this_id (frame_info_ptr this_frame, void **this_cache,
+ struct frame_id *this_id)
{
- struct amd64_frame_cache *cache =
- amd64_sigtramp_frame_cache (this_frame, this_cache);
+ struct amd64_frame_cache *cache
+ = amd64_sigtramp_frame_cache (this_frame, this_cache);
if (!cache->base_p)
(*this_id) = frame_id_build_unavailable_stack (get_frame_pc (this_frame));
@@ -2832,8 +2818,7 @@ amd64_sigtramp_frame_prev_register (frame_info_ptr this_frame,
static int
amd64_sigtramp_frame_sniffer (const struct frame_unwind *self,
- frame_info_ptr this_frame,
- void **this_cache)
+ frame_info_ptr this_frame, void **this_cache)
{
gdbarch *arch = get_frame_arch (this_frame);
i386_gdbarch_tdep *tdep = gdbarch_tdep<i386_gdbarch_tdep> (arch);
@@ -2861,34 +2846,26 @@ amd64_sigtramp_frame_sniffer (const struct frame_unwind *self,
return 0;
}
-static const struct frame_unwind amd64_sigtramp_frame_unwind =
-{
- "amd64 sigtramp",
- SIGTRAMP_FRAME,
- amd64_sigtramp_frame_unwind_stop_reason,
- amd64_sigtramp_frame_this_id,
- amd64_sigtramp_frame_prev_register,
- NULL,
- amd64_sigtramp_frame_sniffer
-};
-
+static const struct frame_unwind amd64_sigtramp_frame_unwind
+ = { "amd64 sigtramp",
+ SIGTRAMP_FRAME,
+ amd64_sigtramp_frame_unwind_stop_reason,
+ amd64_sigtramp_frame_this_id,
+ amd64_sigtramp_frame_prev_register,
+ NULL,
+ amd64_sigtramp_frame_sniffer };
static CORE_ADDR
amd64_frame_base_address (frame_info_ptr this_frame, void **this_cache)
{
- struct amd64_frame_cache *cache =
- amd64_frame_cache (this_frame, this_cache);
+ struct amd64_frame_cache *cache = amd64_frame_cache (this_frame, this_cache);
return cache->base;
}
-static const struct frame_base amd64_frame_base =
-{
- &amd64_frame_unwind,
- amd64_frame_base_address,
- amd64_frame_base_address,
- amd64_frame_base_address
-};
+static const struct frame_base amd64_frame_base
+ = { &amd64_frame_unwind, amd64_frame_base_address, amd64_frame_base_address,
+ amd64_frame_base_address };
/* Normal frames, but in a function epilogue. */
@@ -2909,9 +2886,9 @@ amd64_stack_frame_destroyed_p (struct gdbarch *gdbarch, CORE_ADDR pc)
return 0;
if (target_read_memory (pc, &insn, 1))
- return 0; /* Can't read memory at pc. */
+ return 0; /* Can't read memory at pc. */
- if (insn != 0xc3) /* 'ret' instruction. */
+ if (insn != 0xc3) /* 'ret' instruction. */
return 0;
return 1;
@@ -2947,8 +2924,8 @@ amd64_epilogue_frame_cache (frame_info_ptr this_frame, void **this_cache)
{
/* Cache base will be %rsp plus cache->sp_offset (-8). */
get_frame_register (this_frame, AMD64_RSP_REGNUM, buf);
- cache->base = extract_unsigned_integer (buf, 8,
- byte_order) + cache->sp_offset;
+ cache->base
+ = extract_unsigned_integer (buf, 8, byte_order) + cache->sp_offset;
/* Cache pc will be the frame func. */
cache->pc = get_frame_func (this_frame);
@@ -2984,12 +2961,11 @@ amd64_epilogue_frame_unwind_stop_reason (frame_info_ptr this_frame,
}
static void
-amd64_epilogue_frame_this_id (frame_info_ptr this_frame,
- void **this_cache,
+amd64_epilogue_frame_this_id (frame_info_ptr this_frame, void **this_cache,
struct frame_id *this_id)
{
- struct amd64_frame_cache *cache = amd64_epilogue_frame_cache (this_frame,
- this_cache);
+ struct amd64_frame_cache *cache
+ = amd64_epilogue_frame_cache (this_frame, this_cache);
if (!cache->base_p)
(*this_id) = frame_id_build_unavailable_stack (cache->pc);
@@ -2997,16 +2973,14 @@ amd64_epilogue_frame_this_id (frame_info_ptr this_frame,
(*this_id) = frame_id_build (cache->base + 16, cache->pc);
}
-static const struct frame_unwind amd64_epilogue_frame_unwind =
-{
- "amd64 epilogue",
- NORMAL_FRAME,
- amd64_epilogue_frame_unwind_stop_reason,
- amd64_epilogue_frame_this_id,
- amd64_frame_prev_register,
- NULL,
- amd64_epilogue_frame_sniffer
-};
+static const struct frame_unwind amd64_epilogue_frame_unwind
+ = { "amd64 epilogue",
+ NORMAL_FRAME,
+ amd64_epilogue_frame_unwind_stop_reason,
+ amd64_epilogue_frame_this_id,
+ amd64_frame_prev_register,
+ NULL,
+ amd64_epilogue_frame_sniffer };
static struct frame_id
amd64_dummy_id (struct gdbarch *gdbarch, frame_info_ptr this_frame)
@@ -3023,9 +2997,8 @@ amd64_dummy_id (struct gdbarch *gdbarch, frame_info_ptr this_frame)
static CORE_ADDR
amd64_frame_align (struct gdbarch *gdbarch, CORE_ADDR sp)
{
- return sp & -(CORE_ADDR)16;
+ return sp & -(CORE_ADDR) 16;
}
-
/* Supply register REGNUM from the buffer specified by FPREGS and LEN
in the floating-point register set REGSET to register cache
@@ -3049,8 +3022,8 @@ amd64_supply_fpregset (const struct regset *regset, struct regcache *regcache,
static void
amd64_collect_fpregset (const struct regset *regset,
- const struct regcache *regcache,
- int regnum, void *fpregs, size_t len)
+ const struct regcache *regcache, int regnum,
+ void *fpregs, size_t len)
{
struct gdbarch *gdbarch = regcache->arch ();
const i386_gdbarch_tdep *tdep = gdbarch_tdep<i386_gdbarch_tdep> (gdbarch);
@@ -3059,11 +3032,8 @@ amd64_collect_fpregset (const struct regset *regset,
amd64_collect_fxsave (regcache, regnum, fpregs);
}
-const struct regset amd64_fpregset =
- {
- NULL, amd64_supply_fpregset, amd64_collect_fpregset
- };
-
+const struct regset amd64_fpregset
+ = { NULL, amd64_supply_fpregset, amd64_collect_fpregset };
/* Figure out where the longjmp will land. Slurp the jmp_buf out of
%rdi. We expect its value to be a pointer to the jmp_buf structure
@@ -3087,8 +3057,8 @@ amd64_get_longjmp_target (frame_info_ptr frame, CORE_ADDR *pc)
return 0;
get_frame_register (frame, AMD64_RDI_REGNUM, buf);
- jb_addr= extract_typed_address
- (buf, builtin_type (gdbarch)->builtin_data_ptr);
+ jb_addr
+ = extract_typed_address (buf, builtin_type (gdbarch)->builtin_data_ptr);
if (target_read_memory (jb_addr + jb_pc_offset, buf, len))
return 0;
@@ -3097,14 +3067,13 @@ amd64_get_longjmp_target (frame_info_ptr frame, CORE_ADDR *pc)
return 1;
}
-static const int amd64_record_regmap[] =
-{
- AMD64_RAX_REGNUM, AMD64_RCX_REGNUM, AMD64_RDX_REGNUM, AMD64_RBX_REGNUM,
- AMD64_RSP_REGNUM, AMD64_RBP_REGNUM, AMD64_RSI_REGNUM, AMD64_RDI_REGNUM,
- AMD64_R8_REGNUM, AMD64_R9_REGNUM, AMD64_R10_REGNUM, AMD64_R11_REGNUM,
- AMD64_R12_REGNUM, AMD64_R13_REGNUM, AMD64_R14_REGNUM, AMD64_R15_REGNUM,
- AMD64_RIP_REGNUM, AMD64_EFLAGS_REGNUM, AMD64_CS_REGNUM, AMD64_SS_REGNUM,
- AMD64_DS_REGNUM, AMD64_ES_REGNUM, AMD64_FS_REGNUM, AMD64_GS_REGNUM
+static const int amd64_record_regmap[] = {
+ AMD64_RAX_REGNUM, AMD64_RCX_REGNUM, AMD64_RDX_REGNUM, AMD64_RBX_REGNUM,
+ AMD64_RSP_REGNUM, AMD64_RBP_REGNUM, AMD64_RSI_REGNUM, AMD64_RDI_REGNUM,
+ AMD64_R8_REGNUM, AMD64_R9_REGNUM, AMD64_R10_REGNUM, AMD64_R11_REGNUM,
+ AMD64_R12_REGNUM, AMD64_R13_REGNUM, AMD64_R14_REGNUM, AMD64_R15_REGNUM,
+ AMD64_RIP_REGNUM, AMD64_EFLAGS_REGNUM, AMD64_CS_REGNUM, AMD64_SS_REGNUM,
+ AMD64_DS_REGNUM, AMD64_ES_REGNUM, AMD64_FS_REGNUM, AMD64_GS_REGNUM
};
/* Implement the "in_indirect_branch_thunk" gdbarch function. */
@@ -3113,8 +3082,7 @@ static bool
amd64_in_indirect_branch_thunk (struct gdbarch *gdbarch, CORE_ADDR pc)
{
return x86_in_indirect_branch_thunk (pc, amd64_register_names,
- AMD64_RAX_REGNUM,
- AMD64_RIP_REGNUM);
+ AMD64_RAX_REGNUM, AMD64_RIP_REGNUM);
}
void
@@ -3125,17 +3093,17 @@ amd64_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch,
const struct target_desc *tdesc = info.target_desc;
static const char *const stap_integer_prefixes[] = { "$", NULL };
static const char *const stap_register_prefixes[] = { "%", NULL };
- static const char *const stap_register_indirection_prefixes[] = { "(",
- NULL };
- static const char *const stap_register_indirection_suffixes[] = { ")",
- NULL };
+ static const char *const stap_register_indirection_prefixes[]
+ = { "(", NULL };
+ static const char *const stap_register_indirection_suffixes[]
+ = { ")", NULL };
/* AMD64 generally uses `fxsave' instead of `fsave' for saving its
floating-point registers. */
tdep->sizeof_fpregset = I387_SIZEOF_FXSAVE;
tdep->fpregset = &amd64_fpregset;
- if (! tdesc_has_registers (tdesc))
+ if (!tdesc_has_registers (tdesc))
tdesc = default_tdesc;
tdep->tdesc = tdesc;
@@ -3193,8 +3161,7 @@ amd64_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch,
set_gdbarch_pseudo_register_read_value (gdbarch,
amd64_pseudo_register_read_value);
- set_gdbarch_pseudo_register_write (gdbarch,
- amd64_pseudo_register_write);
+ set_gdbarch_pseudo_register_write (gdbarch, amd64_pseudo_register_write);
set_gdbarch_ax_pseudo_register_collect (gdbarch,
amd64_ax_pseudo_register_collect);
@@ -3217,10 +3184,10 @@ amd64_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch,
set_gdbarch_num_regs (gdbarch, AMD64_NUM_REGS);
/* Register numbers of various important registers. */
- set_gdbarch_sp_regnum (gdbarch, AMD64_RSP_REGNUM); /* %rsp */
- set_gdbarch_pc_regnum (gdbarch, AMD64_RIP_REGNUM); /* %rip */
+ set_gdbarch_sp_regnum (gdbarch, AMD64_RSP_REGNUM); /* %rsp */
+ set_gdbarch_pc_regnum (gdbarch, AMD64_RIP_REGNUM); /* %rip */
set_gdbarch_ps_regnum (gdbarch, AMD64_EFLAGS_REGNUM); /* %eflags */
- set_gdbarch_fp0_regnum (gdbarch, AMD64_ST0_REGNUM); /* %st(0) */
+ set_gdbarch_fp0_regnum (gdbarch, AMD64_ST0_REGNUM); /* %st(0) */
/* The "default" register numbering scheme for AMD64 is referred to
as the "DWARF Register Number Mapping" in the System V psABI.
@@ -3270,12 +3237,11 @@ amd64_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch,
/* SystemTap variables and functions. */
set_gdbarch_stap_integer_prefixes (gdbarch, stap_integer_prefixes);
set_gdbarch_stap_register_prefixes (gdbarch, stap_register_prefixes);
- set_gdbarch_stap_register_indirection_prefixes (gdbarch,
- stap_register_indirection_prefixes);
- set_gdbarch_stap_register_indirection_suffixes (gdbarch,
- stap_register_indirection_suffixes);
- set_gdbarch_stap_is_single_operand (gdbarch,
- i386_stap_is_single_operand);
+ set_gdbarch_stap_register_indirection_prefixes (
+ gdbarch, stap_register_indirection_prefixes);
+ set_gdbarch_stap_register_indirection_suffixes (
+ gdbarch, stap_register_indirection_suffixes);
+ set_gdbarch_stap_is_single_operand (gdbarch, i386_stap_is_single_operand);
set_gdbarch_stap_parse_special_token (gdbarch,
i386_stap_parse_special_token);
set_gdbarch_insn_is_call (gdbarch, amd64_insn_is_call);
@@ -3293,8 +3259,8 @@ amd64_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch,
static void
amd64_none_init_abi (gdbarch_info info, gdbarch *arch)
{
- amd64_init_abi (info, arch, amd64_target_description (X86_XSTATE_SSE_MASK,
- true));
+ amd64_init_abi (info, arch,
+ amd64_target_description (X86_XSTATE_SSE_MASK, true));
}
static struct type *
@@ -3304,10 +3270,10 @@ amd64_x32_pseudo_register_type (struct gdbarch *gdbarch, int regnum)
switch (regnum - tdep->eax_regnum)
{
- case AMD64_RBP_REGNUM: /* %ebp */
- case AMD64_RSP_REGNUM: /* %esp */
+ case AMD64_RBP_REGNUM: /* %ebp */
+ case AMD64_RSP_REGNUM: /* %esp */
return builtin_type (gdbarch)->builtin_data_ptr;
- case AMD64_RIP_REGNUM: /* %eip */
+ case AMD64_RIP_REGNUM: /* %eip */
return builtin_type (gdbarch)->builtin_func_ptr;
}
@@ -3343,24 +3309,24 @@ amd64_x32_none_init_abi (gdbarch_info info, gdbarch *arch)
const struct target_desc *
amd64_target_description (uint64_t xcr0, bool segments)
{
- static target_desc *amd64_tdescs \
- [2/*AVX*/][2/*MPX*/][2/*AVX512*/][2/*PKRU*/][2/*segments*/] = {};
+ static target_desc *amd64_tdescs[2 /*AVX*/][2 /*MPX*/][2 /*AVX512*/]
+ [2 /*PKRU*/][2 /*segments*/]
+ = {};
target_desc **tdesc;
tdesc = &amd64_tdescs[(xcr0 & X86_XSTATE_AVX) ? 1 : 0]
- [(xcr0 & X86_XSTATE_MPX) ? 1 : 0]
- [(xcr0 & X86_XSTATE_AVX512) ? 1 : 0]
- [(xcr0 & X86_XSTATE_PKRU) ? 1 : 0]
- [segments ? 1 : 0];
+ [(xcr0 & X86_XSTATE_MPX) ? 1 : 0]
+ [(xcr0 & X86_XSTATE_AVX512) ? 1 : 0]
+ [(xcr0 & X86_XSTATE_PKRU) ? 1 : 0][segments ? 1 : 0];
if (*tdesc == NULL)
- *tdesc = amd64_create_target_description (xcr0, false, false,
- segments);
+ *tdesc = amd64_create_target_description (xcr0, false, false, segments);
return *tdesc;
}
void _initialize_amd64_tdep ();
+
void
_initialize_amd64_tdep ()
{
@@ -3369,7 +3335,6 @@ _initialize_amd64_tdep ()
gdbarch_register_osabi (bfd_arch_i386, bfd_mach_x64_32, GDB_OSABI_NONE,
amd64_x32_none_init_abi);
}
-
/* The 64-bit FXSAVE format differs from the 32-bit format in the
sense that the instruction pointer and data pointer are simply
@@ -3384,16 +3349,14 @@ _initialize_amd64_tdep ()
reserved bits in *FXSAVE. */
void
-amd64_supply_fxsave (struct regcache *regcache, int regnum,
- const void *fxsave)
+amd64_supply_fxsave (struct regcache *regcache, int regnum, const void *fxsave)
{
struct gdbarch *gdbarch = regcache->arch ();
i386_gdbarch_tdep *tdep = gdbarch_tdep<i386_gdbarch_tdep> (gdbarch);
i387_supply_fxsave (regcache, regnum, fxsave);
- if (fxsave
- && gdbarch_bfd_arch_info (gdbarch)->bits_per_word == 64)
+ if (fxsave && gdbarch_bfd_arch_info (gdbarch)->bits_per_word == 64)
{
const gdb_byte *regs = (const gdb_byte *) fxsave;
@@ -3407,16 +3370,14 @@ amd64_supply_fxsave (struct regcache *regcache, int regnum,
/* Similar to amd64_supply_fxsave, but use XSAVE extended state. */
void
-amd64_supply_xsave (struct regcache *regcache, int regnum,
- const void *xsave)
+amd64_supply_xsave (struct regcache *regcache, int regnum, const void *xsave)
{
struct gdbarch *gdbarch = regcache->arch ();
i386_gdbarch_tdep *tdep = gdbarch_tdep<i386_gdbarch_tdep> (gdbarch);
i387_supply_xsave (regcache, regnum, xsave);
- if (xsave
- && gdbarch_bfd_arch_info (gdbarch)->bits_per_word == 64)
+ if (xsave && gdbarch_bfd_arch_info (gdbarch)->bits_per_word == 64)
{
const gdb_byte *regs = (const gdb_byte *) xsave;
ULONGEST clear_bv;
@@ -3463,8 +3424,8 @@ amd64_collect_fxsave (const struct regcache *regcache, int regnum,
/* Similar to amd64_collect_fxsave, but use XSAVE extended state. */
void
-amd64_collect_xsave (const struct regcache *regcache, int regnum,
- void *xsave, int gcore)
+amd64_collect_xsave (const struct regcache *regcache, int regnum, void *xsave,
+ int gcore)
{
struct gdbarch *gdbarch = regcache->arch ();
i386_gdbarch_tdep *tdep = gdbarch_tdep<i386_gdbarch_tdep> (gdbarch);
@@ -3475,10 +3436,8 @@ amd64_collect_xsave (const struct regcache *regcache, int regnum,
if (gdbarch_bfd_arch_info (gdbarch)->bits_per_word == 64)
{
if (regnum == -1 || regnum == I387_FISEG_REGNUM (tdep))
- regcache->raw_collect (I387_FISEG_REGNUM (tdep),
- regs + 12);
+ regcache->raw_collect (I387_FISEG_REGNUM (tdep), regs + 12);
if (regnum == -1 || regnum == I387_FOSEG_REGNUM (tdep))
- regcache->raw_collect (I387_FOSEG_REGNUM (tdep),
- regs + 20);
+ regcache->raw_collect (I387_FOSEG_REGNUM (tdep), regs + 20);
}
}
diff --git a/gdb/amd64-tdep.h b/gdb/amd64-tdep.h
index 929b4b8bdc5..55b4c04ccd1 100644
--- a/gdb/amd64-tdep.h
+++ b/gdb/amd64-tdep.h
@@ -32,39 +32,39 @@ struct regcache;
enum amd64_regnum
{
- AMD64_RAX_REGNUM, /* %rax */
- AMD64_RBX_REGNUM, /* %rbx */
- AMD64_RCX_REGNUM, /* %rcx */
- AMD64_RDX_REGNUM, /* %rdx */
- AMD64_RSI_REGNUM, /* %rsi */
- AMD64_RDI_REGNUM, /* %rdi */
- AMD64_RBP_REGNUM, /* %rbp */
- AMD64_RSP_REGNUM, /* %rsp */
- AMD64_R8_REGNUM, /* %r8 */
- AMD64_R9_REGNUM, /* %r9 */
- AMD64_R10_REGNUM, /* %r10 */
- AMD64_R11_REGNUM, /* %r11 */
- AMD64_R12_REGNUM, /* %r12 */
- AMD64_R13_REGNUM, /* %r13 */
- AMD64_R14_REGNUM, /* %r14 */
- AMD64_R15_REGNUM, /* %r15 */
- AMD64_RIP_REGNUM, /* %rip */
- AMD64_EFLAGS_REGNUM, /* %eflags */
- AMD64_CS_REGNUM, /* %cs */
- AMD64_SS_REGNUM, /* %ss */
- AMD64_DS_REGNUM, /* %ds */
- AMD64_ES_REGNUM, /* %es */
- AMD64_FS_REGNUM, /* %fs */
- AMD64_GS_REGNUM, /* %gs */
- AMD64_ST0_REGNUM = 24, /* %st0 */
- AMD64_ST1_REGNUM, /* %st1 */
+ AMD64_RAX_REGNUM, /* %rax */
+ AMD64_RBX_REGNUM, /* %rbx */
+ AMD64_RCX_REGNUM, /* %rcx */
+ AMD64_RDX_REGNUM, /* %rdx */
+ AMD64_RSI_REGNUM, /* %rsi */
+ AMD64_RDI_REGNUM, /* %rdi */
+ AMD64_RBP_REGNUM, /* %rbp */
+ AMD64_RSP_REGNUM, /* %rsp */
+ AMD64_R8_REGNUM, /* %r8 */
+ AMD64_R9_REGNUM, /* %r9 */
+ AMD64_R10_REGNUM, /* %r10 */
+ AMD64_R11_REGNUM, /* %r11 */
+ AMD64_R12_REGNUM, /* %r12 */
+ AMD64_R13_REGNUM, /* %r13 */
+ AMD64_R14_REGNUM, /* %r14 */
+ AMD64_R15_REGNUM, /* %r15 */
+ AMD64_RIP_REGNUM, /* %rip */
+ AMD64_EFLAGS_REGNUM, /* %eflags */
+ AMD64_CS_REGNUM, /* %cs */
+ AMD64_SS_REGNUM, /* %ss */
+ AMD64_DS_REGNUM, /* %ds */
+ AMD64_ES_REGNUM, /* %es */
+ AMD64_FS_REGNUM, /* %fs */
+ AMD64_GS_REGNUM, /* %gs */
+ AMD64_ST0_REGNUM = 24, /* %st0 */
+ AMD64_ST1_REGNUM, /* %st1 */
AMD64_FCTRL_REGNUM = AMD64_ST0_REGNUM + 8,
AMD64_FSTAT_REGNUM = AMD64_ST0_REGNUM + 9,
AMD64_FTAG_REGNUM = AMD64_ST0_REGNUM + 10,
- AMD64_XMM0_REGNUM = 40, /* %xmm0 */
- AMD64_XMM1_REGNUM, /* %xmm1 */
+ AMD64_XMM0_REGNUM = 40, /* %xmm0 */
+ AMD64_XMM1_REGNUM, /* %xmm1 */
AMD64_MXCSR_REGNUM = AMD64_XMM0_REGNUM + 16,
- AMD64_YMM0H_REGNUM, /* %ymm0h */
+ AMD64_YMM0H_REGNUM, /* %ymm0h */
AMD64_YMM15H_REGNUM = AMD64_YMM0H_REGNUM + 15,
AMD64_BND0R_REGNUM = AMD64_YMM15H_REGNUM + 1,
AMD64_BND3R_REGNUM = AMD64_BND0R_REGNUM + 3,
@@ -84,21 +84,20 @@ enum amd64_regnum
};
/* Number of general purpose registers. */
-#define AMD64_NUM_GREGS 24
+#define AMD64_NUM_GREGS 24
-#define AMD64_NUM_REGS (AMD64_GSBASE_REGNUM + 1)
+#define AMD64_NUM_REGS (AMD64_GSBASE_REGNUM + 1)
-extern displaced_step_copy_insn_closure_up amd64_displaced_step_copy_insn
- (struct gdbarch *gdbarch, CORE_ADDR from, CORE_ADDR to,
- struct regcache *regs);
-extern void amd64_displaced_step_fixup
- (struct gdbarch *gdbarch, displaced_step_copy_insn_closure *closure,
- CORE_ADDR from, CORE_ADDR to, struct regcache *regs);
+extern displaced_step_copy_insn_closure_up
+amd64_displaced_step_copy_insn (struct gdbarch *gdbarch, CORE_ADDR from,
+ CORE_ADDR to, struct regcache *regs);
+extern void amd64_displaced_step_fixup (
+ struct gdbarch *gdbarch, displaced_step_copy_insn_closure *closure,
+ CORE_ADDR from, CORE_ADDR to, struct regcache *regs);
/* Initialize the ABI for amd64. Uses DEFAULT_TDESC as fallback
tdesc, if INFO does not specify one. */
-extern void amd64_init_abi (struct gdbarch_info info,
- struct gdbarch *gdbarch,
+extern void amd64_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch,
const target_desc *default_tdesc);
/* Initialize the ABI for x32. Uses DEFAULT_TDESC as fallback tdesc,
@@ -129,9 +128,9 @@ extern void amd64_supply_xsave (struct regcache *regcache, int regnum,
extern void amd64_collect_fxsave (const struct regcache *regcache, int regnum,
void *fxsave);
/* Similar to amd64_collect_fxsave, but use XSAVE extended state. */
-extern void amd64_collect_xsave (const struct regcache *regcache,
- int regnum, void *xsave, int gcore);
-
+extern void amd64_collect_xsave (const struct regcache *regcache, int regnum,
+ void *xsave, int gcore);
+
/* Floating-point register set. */
extern const struct regset amd64_fpregset;
diff --git a/gdb/amd64-windows-nat.c b/gdb/amd64-windows-nat.c
index c99f90928f8..c1dbcf4c577 100644
--- a/gdb/amd64-windows-nat.c
+++ b/gdb/amd64-windows-nat.c
@@ -23,68 +23,40 @@
#include <windows.h>
#define context_offset(x) (offsetof (CONTEXT, x))
-const int amd64_mappings[] =
-{
- context_offset (Rax),
- context_offset (Rbx),
- context_offset (Rcx),
- context_offset (Rdx),
- context_offset (Rsi),
- context_offset (Rdi),
- context_offset (Rbp),
- context_offset (Rsp),
- context_offset (R8),
- context_offset (R9),
- context_offset (R10),
- context_offset (R11),
- context_offset (R12),
- context_offset (R13),
- context_offset (R14),
- context_offset (R15),
- context_offset (Rip),
- context_offset (EFlags),
- context_offset (SegCs),
- context_offset (SegSs),
- context_offset (SegDs),
- context_offset (SegEs),
- context_offset (SegFs),
- context_offset (SegGs),
- context_offset (FloatSave.FloatRegisters[0]),
- context_offset (FloatSave.FloatRegisters[1]),
- context_offset (FloatSave.FloatRegisters[2]),
- context_offset (FloatSave.FloatRegisters[3]),
- context_offset (FloatSave.FloatRegisters[4]),
- context_offset (FloatSave.FloatRegisters[5]),
- context_offset (FloatSave.FloatRegisters[6]),
- context_offset (FloatSave.FloatRegisters[7]),
- context_offset (FloatSave.ControlWord),
- context_offset (FloatSave.StatusWord),
- context_offset (FloatSave.TagWord),
- context_offset (FloatSave.ErrorSelector),
- context_offset (FloatSave.ErrorOffset),
- context_offset (FloatSave.DataSelector),
- context_offset (FloatSave.DataOffset),
- context_offset (FloatSave.ErrorSelector)
- /* XMM0-7 */ ,
- context_offset (Xmm0),
- context_offset (Xmm1),
- context_offset (Xmm2),
- context_offset (Xmm3),
- context_offset (Xmm4),
- context_offset (Xmm5),
- context_offset (Xmm6),
- context_offset (Xmm7),
- context_offset (Xmm8),
- context_offset (Xmm9),
- context_offset (Xmm10),
- context_offset (Xmm11),
- context_offset (Xmm12),
- context_offset (Xmm13),
- context_offset (Xmm14),
- context_offset (Xmm15),
- /* MXCSR */
- context_offset (FloatSave.MxCsr)
-};
+const int amd64_mappings[]
+ = { context_offset (Rax), context_offset (Rbx), context_offset (Rcx),
+ context_offset (Rdx), context_offset (Rsi), context_offset (Rdi),
+ context_offset (Rbp), context_offset (Rsp), context_offset (R8),
+ context_offset (R9), context_offset (R10), context_offset (R11),
+ context_offset (R12), context_offset (R13), context_offset (R14),
+ context_offset (R15), context_offset (Rip), context_offset (EFlags),
+ context_offset (SegCs), context_offset (SegSs), context_offset (SegDs),
+ context_offset (SegEs), context_offset (SegFs), context_offset (SegGs),
+ context_offset (FloatSave.FloatRegisters[0]),
+ context_offset (FloatSave.FloatRegisters[1]),
+ context_offset (FloatSave.FloatRegisters[2]),
+ context_offset (FloatSave.FloatRegisters[3]),
+ context_offset (FloatSave.FloatRegisters[4]),
+ context_offset (FloatSave.FloatRegisters[5]),
+ context_offset (FloatSave.FloatRegisters[6]),
+ context_offset (FloatSave.FloatRegisters[7]),
+ context_offset (FloatSave.ControlWord),
+ context_offset (FloatSave.StatusWord),
+ context_offset (FloatSave.TagWord),
+ context_offset (FloatSave.ErrorSelector),
+ context_offset (FloatSave.ErrorOffset),
+ context_offset (FloatSave.DataSelector),
+ context_offset (FloatSave.DataOffset),
+ context_offset (FloatSave.ErrorSelector)
+ /* XMM0-7 */,
+ context_offset (Xmm0), context_offset (Xmm1), context_offset (Xmm2),
+ context_offset (Xmm3), context_offset (Xmm4), context_offset (Xmm5),
+ context_offset (Xmm6), context_offset (Xmm7), context_offset (Xmm8),
+ context_offset (Xmm9), context_offset (Xmm10), context_offset (Xmm11),
+ context_offset (Xmm12), context_offset (Xmm13), context_offset (Xmm14),
+ context_offset (Xmm15),
+ /* MXCSR */
+ context_offset (FloatSave.MxCsr) };
#undef context_offset
/* segment_register_p_ftype implementation for amd64. */
@@ -96,6 +68,7 @@ amd64_windows_segment_register_p (int regnum)
}
void _initialize_amd64_windows_nat ();
+
void
_initialize_amd64_windows_nat ()
{
diff --git a/gdb/amd64-windows-tdep.c b/gdb/amd64-windows-tdep.c
index 411a6204a90..f581c6cfde3 100644
--- a/gdb/amd64-windows-tdep.c
+++ b/gdb/amd64-windows-tdep.c
@@ -34,18 +34,16 @@
#include <algorithm>
/* The registers used to pass integer arguments during a function call. */
-static int amd64_windows_dummy_call_integer_regs[] =
-{
- AMD64_RCX_REGNUM, /* %rcx */
- AMD64_RDX_REGNUM, /* %rdx */
- AMD64_R8_REGNUM, /* %r8 */
- AMD64_R9_REGNUM /* %r9 */
+static int amd64_windows_dummy_call_integer_regs[] = {
+ AMD64_RCX_REGNUM, /* %rcx */
+ AMD64_RDX_REGNUM, /* %rdx */
+ AMD64_R8_REGNUM, /* %r8 */
+ AMD64_R9_REGNUM /* %r9 */
};
/* This vector maps GDB's idea of a register's number into an offset into
the Windows API CONTEXT structure. */
-static int amd64_windows_gregset_reg_offset[] =
-{
+static int amd64_windows_gregset_reg_offset[] = {
120, /* Rax */
144, /* Rbx */
128, /* Rcx */
@@ -115,24 +113,22 @@ amd64_windows_passed_by_integer_register (struct type *type)
{
switch (type->code ())
{
- case TYPE_CODE_INT:
- case TYPE_CODE_ENUM:
- case TYPE_CODE_BOOL:
- case TYPE_CODE_RANGE:
- case TYPE_CODE_CHAR:
- case TYPE_CODE_PTR:
- case TYPE_CODE_REF:
- case TYPE_CODE_RVALUE_REF:
- case TYPE_CODE_STRUCT:
- case TYPE_CODE_UNION:
- case TYPE_CODE_COMPLEX:
- return (type->length () == 1
- || type->length () == 2
- || type->length () == 4
- || type->length () == 8);
-
- default:
- return 0;
+ case TYPE_CODE_INT:
+ case TYPE_CODE_ENUM:
+ case TYPE_CODE_BOOL:
+ case TYPE_CODE_RANGE:
+ case TYPE_CODE_CHAR:
+ case TYPE_CODE_PTR:
+ case TYPE_CODE_REF:
+ case TYPE_CODE_RVALUE_REF:
+ case TYPE_CODE_STRUCT:
+ case TYPE_CODE_UNION:
+ case TYPE_CODE_COMPLEX:
+ return (type->length () == 1 || type->length () == 2
+ || type->length () == 4 || type->length () == 8);
+
+ default:
+ return 0;
}
}
@@ -170,8 +166,8 @@ amd64_windows_passed_by_pointer (struct type *type)
the value of each argument. SP is value of the Stack Pointer. */
static CORE_ADDR
-amd64_windows_adjust_args_passed_by_pointer (struct value **args,
- int nargs, CORE_ADDR sp)
+amd64_windows_adjust_args_passed_by_pointer (struct value **args, int nargs,
+ CORE_ADDR sp)
{
int i;
@@ -201,8 +197,8 @@ amd64_windows_adjust_args_passed_by_pointer (struct value **args,
REGCACHE is the register cache. */
static void
-amd64_windows_store_arg_in_reg (struct regcache *regcache,
- struct value *arg, int regno)
+amd64_windows_store_arg_in_reg (struct regcache *regcache, struct value *arg,
+ int regno)
{
struct type *type = value_type (arg);
const gdb_byte *valbuf = value_contents (arg).data ();
@@ -259,21 +255,21 @@ amd64_windows_push_arguments (struct regcache *regcache, int nargs,
{
if (amd64_windows_passed_by_integer_register (type))
{
- amd64_windows_store_arg_in_reg
- (regcache, args[i],
- amd64_windows_dummy_call_integer_regs[reg_idx]);
+ amd64_windows_store_arg_in_reg (
+ regcache, args[i],
+ amd64_windows_dummy_call_integer_regs[reg_idx]);
on_stack_p = 0;
reg_idx++;
}
else if (amd64_windows_passed_by_xmm_register (type))
{
- amd64_windows_store_arg_in_reg
- (regcache, args[i], AMD64_XMM0_REGNUM + reg_idx);
+ amd64_windows_store_arg_in_reg (regcache, args[i],
+ AMD64_XMM0_REGNUM + reg_idx);
/* In case of varargs, these parameters must also be
passed via the integer registers. */
- amd64_windows_store_arg_in_reg
- (regcache, args[i],
- amd64_windows_dummy_call_integer_regs[reg_idx]);
+ amd64_windows_store_arg_in_reg (
+ regcache, args[i],
+ amd64_windows_dummy_call_integer_regs[reg_idx]);
on_stack_p = 0;
reg_idx++;
}
@@ -307,18 +303,17 @@ amd64_windows_push_arguments (struct regcache *regcache, int nargs,
/* Implement the "push_dummy_call" gdbarch method. */
static CORE_ADDR
-amd64_windows_push_dummy_call
- (struct gdbarch *gdbarch, struct value *function,
- struct regcache *regcache, CORE_ADDR bp_addr,
- int nargs, struct value **args, CORE_ADDR sp,
- function_call_return_method return_method, CORE_ADDR struct_addr)
+amd64_windows_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
+ struct regcache *regcache, CORE_ADDR bp_addr,
+ int nargs, struct value **args, CORE_ADDR sp,
+ function_call_return_method return_method,
+ CORE_ADDR struct_addr)
{
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
gdb_byte buf[8];
/* Pass arguments. */
- sp = amd64_windows_push_arguments (regcache, nargs, args, sp,
- return_method);
+ sp = amd64_windows_push_arguments (regcache, nargs, args, sp, return_method);
/* Pass "hidden" argument". */
if (return_method == return_method_struct)
@@ -355,7 +350,8 @@ amd64_windows_push_dummy_call
static enum return_value_convention
amd64_windows_return_value (struct gdbarch *gdbarch, struct value *function,
struct type *type, struct regcache *regcache,
- struct value **read_value, const gdb_byte *writebuf)
+ struct value **read_value,
+ const gdb_byte *writebuf)
{
int len = type->length ();
int regnum = -1;
@@ -364,31 +360,31 @@ amd64_windows_return_value (struct gdbarch *gdbarch, struct value *function,
store the associated register number in REGNUM. */
switch (type->code ())
{
- case TYPE_CODE_FLT:
- /* floats, and doubles are returned via XMM0. */
- if (len == 4 || len == 8)
- regnum = AMD64_XMM0_REGNUM;
- break;
- case TYPE_CODE_ARRAY:
- /* __m128, __m128i and __m128d are returned via XMM0. */
- if (type->is_vector () && len == 16)
- {
- enum type_code code = type->target_type ()->code ();
- if (code == TYPE_CODE_INT || code == TYPE_CODE_FLT)
- {
- regnum = AMD64_XMM0_REGNUM;
- break;
- }
- }
- /* fall through */
- default:
- /* All other values that are 1, 2, 4 or 8 bytes long are returned
+ case TYPE_CODE_FLT:
+ /* floats, and doubles are returned via XMM0. */
+ if (len == 4 || len == 8)
+ regnum = AMD64_XMM0_REGNUM;
+ break;
+ case TYPE_CODE_ARRAY:
+ /* __m128, __m128i and __m128d are returned via XMM0. */
+ if (type->is_vector () && len == 16)
+ {
+ enum type_code code = type->target_type ()->code ();
+ if (code == TYPE_CODE_INT || code == TYPE_CODE_FLT)
+ {
+ regnum = AMD64_XMM0_REGNUM;
+ break;
+ }
+ }
+ /* fall through */
+ default:
+ /* All other values that are 1, 2, 4 or 8 bytes long are returned
via RAX. */
- if (len == 1 || len == 2 || len == 4 || len == 8)
- regnum = AMD64_RAX_REGNUM;
- else if (len == 16 && type->code () == TYPE_CODE_INT)
- regnum = AMD64_XMM0_REGNUM;
- break;
+ if (len == 1 || len == 2 || len == 4 || len == 8)
+ regnum = AMD64_RAX_REGNUM;
+ else if (len == 16 && type->code () == TYPE_CODE_INT)
+ regnum = AMD64_XMM0_REGNUM;
+ break;
}
if (regnum < 0)
@@ -439,8 +435,7 @@ amd64_skip_main_prologue (struct gdbarch *gdbarch, CORE_ADDR pc)
call_dest = pc + 5 + extract_signed_integer (buf, 4, byte_order);
s = lookup_minimal_symbol_by_pc (call_dest);
- if (s.minsym != NULL
- && s.minsym->linkage_name () != NULL
+ if (s.minsym != NULL && s.minsym->linkage_name () != NULL
&& strcmp (s.minsym->linkage_name (), "__main") == 0)
pc += 5;
}
@@ -481,25 +476,11 @@ struct amd64_windows_frame_cache
};
/* Convert a Windows register number to gdb. */
-static const enum amd64_regnum amd64_windows_w2gdb_regnum[] =
-{
- AMD64_RAX_REGNUM,
- AMD64_RCX_REGNUM,
- AMD64_RDX_REGNUM,
- AMD64_RBX_REGNUM,
- AMD64_RSP_REGNUM,
- AMD64_RBP_REGNUM,
- AMD64_RSI_REGNUM,
- AMD64_RDI_REGNUM,
- AMD64_R8_REGNUM,
- AMD64_R9_REGNUM,
- AMD64_R10_REGNUM,
- AMD64_R11_REGNUM,
- AMD64_R12_REGNUM,
- AMD64_R13_REGNUM,
- AMD64_R14_REGNUM,
- AMD64_R15_REGNUM
-};
+static const enum amd64_regnum amd64_windows_w2gdb_regnum[]
+ = { AMD64_RAX_REGNUM, AMD64_RCX_REGNUM, AMD64_RDX_REGNUM, AMD64_RBX_REGNUM,
+ AMD64_RSP_REGNUM, AMD64_RBP_REGNUM, AMD64_RSI_REGNUM, AMD64_RDI_REGNUM,
+ AMD64_R8_REGNUM, AMD64_R9_REGNUM, AMD64_R10_REGNUM, AMD64_R11_REGNUM,
+ AMD64_R12_REGNUM, AMD64_R13_REGNUM, AMD64_R14_REGNUM, AMD64_R15_REGNUM };
/* Return TRUE iff PC is the range of the function corresponding to
CACHE. */
@@ -635,8 +616,8 @@ amd64_windows_frame_decode_epilogue (frame_info_ptr this_frame,
if (target_read_memory (pc + 1, imm16, 2) != 0)
return -1;
cache->prev_rip_addr = cur_sp;
- cache->prev_sp = cur_sp
- + extract_unsigned_integer (imm16, 4, byte_order);
+ cache->prev_sp
+ = cur_sp + extract_unsigned_integer (imm16, 4, byte_order);
return 1;
}
@@ -733,15 +714,15 @@ amd64_windows_frame_decode_insns (frame_info_ptr this_frame,
struct external_pex64_runtime_function d;
if (target_read_memory (cache->image_base + (unwind_info & ~1),
- (gdb_byte *) &d, sizeof (d)) != 0)
+ (gdb_byte *) &d, sizeof (d))
+ != 0)
return;
cache->start_rva
= extract_unsigned_integer (d.rva_BeginAddress, 4, byte_order);
cache->end_rva
= extract_unsigned_integer (d.rva_EndAddress, 4, byte_order);
- unwind_info
- = extract_unsigned_integer (d.rva_UnwindData, 4, byte_order);
+ unwind_info = extract_unsigned_integer (d.rva_UnwindData, 4, byte_order);
}
while (1)
@@ -757,13 +738,14 @@ amd64_windows_frame_decode_insns (frame_info_ptr this_frame,
/* Read and decode header. */
if (target_read_memory (cache->image_base + unwind_info,
- (gdb_byte *) &ex_ui, sizeof (ex_ui)) != 0)
+ (gdb_byte *) &ex_ui, sizeof (ex_ui))
+ != 0)
return;
frame_debug_printf ("%s: ver: %02x, plgsz: %02x, cnt: %02x, frame: %02x",
- paddress (gdbarch, unwind_info),
- ex_ui.Version_Flags, ex_ui.SizeOfPrologue,
- ex_ui.CountOfCodes, ex_ui.FrameRegisterOffset);
+ paddress (gdbarch, unwind_info), ex_ui.Version_Flags,
+ ex_ui.SizeOfPrologue, ex_ui.CountOfCodes,
+ ex_ui.FrameRegisterOffset);
/* Check version. */
if (PEX64_UWI_VERSION (ex_ui.Version_Flags) != 1
@@ -809,8 +791,9 @@ amd64_windows_frame_decode_insns (frame_info_ptr this_frame,
/* Read opcodes. */
if (codes_count != 0
&& target_read_memory (cache->image_base + unwind_info
- + sizeof (ex_ui),
- insns, codes_count * 2) != 0)
+ + sizeof (ex_ui),
+ insns, codes_count * 2)
+ != 0)
return;
end_insns = &insns[codes_count * 2];
@@ -854,8 +837,8 @@ amd64_windows_frame_decode_insns (frame_info_ptr this_frame,
break;
case UWOP_ALLOC_LARGE:
if (PEX64_UNWCODE_INFO (p[1]) == 0)
- cur_sp +=
- 8 * extract_unsigned_integer (p + 2, 2, byte_order);
+ cur_sp
+ += 8 * extract_unsigned_integer (p + 2, 2, byte_order);
else if (PEX64_UNWCODE_INFO (p[1]) == 1)
cur_sp += extract_unsigned_integer (p + 2, 4, byte_order);
else
@@ -865,28 +848,31 @@ amd64_windows_frame_decode_insns (frame_info_ptr this_frame,
cur_sp += 8 + 8 * PEX64_UNWCODE_INFO (p[1]);
break;
case UWOP_SET_FPREG:
- cur_sp = save_addr
- - PEX64_UWI_FRAMEOFF (ex_ui.FrameRegisterOffset) * 16;
+ cur_sp
+ = save_addr
+ - PEX64_UWI_FRAMEOFF (ex_ui.FrameRegisterOffset) * 16;
break;
case UWOP_SAVE_NONVOL:
reg = amd64_windows_w2gdb_regnum[PEX64_UNWCODE_INFO (p[1])];
- cache->prev_reg_addr[reg] = save_addr
- + 8 * extract_unsigned_integer (p + 2, 2, byte_order);
+ cache->prev_reg_addr[reg]
+ = save_addr
+ + 8 * extract_unsigned_integer (p + 2, 2, byte_order);
break;
case UWOP_SAVE_NONVOL_FAR:
reg = amd64_windows_w2gdb_regnum[PEX64_UNWCODE_INFO (p[1])];
- cache->prev_reg_addr[reg] = save_addr
- + 8 * extract_unsigned_integer (p + 2, 4, byte_order);
+ cache->prev_reg_addr[reg]
+ = save_addr
+ + 8 * extract_unsigned_integer (p + 2, 4, byte_order);
break;
case UWOP_SAVE_XMM128:
- cache->prev_xmm_addr[PEX64_UNWCODE_INFO (p[1])] =
- save_addr
- - 16 * extract_unsigned_integer (p + 2, 2, byte_order);
+ cache->prev_xmm_addr[PEX64_UNWCODE_INFO (p[1])]
+ = save_addr
+ - 16 * extract_unsigned_integer (p + 2, 2, byte_order);
break;
case UWOP_SAVE_XMM128_FAR:
- cache->prev_xmm_addr[PEX64_UNWCODE_INFO (p[1])] =
- save_addr
- - 16 * extract_unsigned_integer (p + 2, 4, byte_order);
+ cache->prev_xmm_addr[PEX64_UNWCODE_INFO (p[1])]
+ = save_addr
+ - 16 * extract_unsigned_integer (p + 2, 4, byte_order);
break;
case UWOP_PUSH_MACHFRAME:
if (PEX64_UNWCODE_INFO (p[1]) == 0)
@@ -959,8 +945,8 @@ amd64_windows_frame_decode_insns (frame_info_ptr this_frame,
first = 0;
/* Stay aligned on word boundary. */
- chain_vma = cache->image_base + unwind_info
- + sizeof (ex_ui) + ((codes_count + 1) & ~1) * 2;
+ chain_vma = cache->image_base + unwind_info + sizeof (ex_ui)
+ + ((codes_count + 1) & ~1) * 2;
if (target_read_memory (chain_vma, (gdb_byte *) &d, sizeof (d)) != 0)
return;
@@ -968,12 +954,12 @@ amd64_windows_frame_decode_insns (frame_info_ptr this_frame,
/* Decode begin/end. This may be different from .pdata index, as
an unwind info may be shared by several functions (in particular
if many functions have the same prolog and handler. */
- cache->start_rva =
- extract_unsigned_integer (d.rva_BeginAddress, 4, byte_order);
- cache->end_rva =
- extract_unsigned_integer (d.rva_EndAddress, 4, byte_order);
- unwind_info =
- extract_unsigned_integer (d.rva_UnwindData, 4, byte_order);
+ cache->start_rva
+ = extract_unsigned_integer (d.rva_BeginAddress, 4, byte_order);
+ cache->end_rva
+ = extract_unsigned_integer (d.rva_EndAddress, 4, byte_order);
+ unwind_info
+ = extract_unsigned_integer (d.rva_UnwindData, 4, byte_order);
frame_debug_printf ("next in chain: unwind_data=%s, start_rva=%s, "
"end_rva=%s",
@@ -1003,10 +989,8 @@ amd64_windows_frame_decode_insns (frame_info_ptr this_frame,
static int
amd64_windows_find_unwind_info (struct gdbarch *gdbarch, CORE_ADDR pc,
- CORE_ADDR *unwind_info,
- CORE_ADDR *image_base,
- CORE_ADDR *start_rva,
- CORE_ADDR *end_rva)
+ CORE_ADDR *unwind_info, CORE_ADDR *image_base,
+ CORE_ADDR *start_rva, CORE_ADDR *end_rva)
{
struct obj_section *sec;
pe_data_type *pe;
@@ -1044,7 +1028,8 @@ amd64_windows_find_unwind_info (struct gdbarch *gdbarch, CORE_ADDR pc,
CORE_ADDR sa, ea;
if (target_read_memory (base + dir->VirtualAddress + mid * sizeof (d),
- (gdb_byte *) &d, sizeof (d)) != 0)
+ (gdb_byte *) &d, sizeof (d))
+ != 0)
return -1;
sa = extract_unsigned_integer (d.rva_BeginAddress, 4, byte_order);
@@ -1058,8 +1043,8 @@ amd64_windows_find_unwind_info (struct gdbarch *gdbarch, CORE_ADDR pc,
/* Got it. */
*start_rva = sa;
*end_rva = ea;
- *unwind_info =
- extract_unsigned_integer (d.rva_UnwindData, 4, byte_order);
+ *unwind_info
+ = extract_unsigned_integer (d.rva_UnwindData, 4, byte_order);
break;
}
else
@@ -1099,8 +1084,7 @@ amd64_windows_frame_cache (frame_info_ptr this_frame, void **this_cache)
cache->pc = pc;
if (amd64_windows_find_unwind_info (gdbarch, pc, &unwind_info,
- &cache->image_base,
- &cache->start_rva,
+ &cache->image_base, &cache->start_rva,
&cache->end_rva))
return cache;
@@ -1126,16 +1110,15 @@ amd64_windows_frame_prev_register (frame_info_ptr this_frame,
void **this_cache, int regnum)
{
struct gdbarch *gdbarch = get_frame_arch (this_frame);
- struct amd64_windows_frame_cache *cache =
- amd64_windows_frame_cache (this_frame, this_cache);
+ struct amd64_windows_frame_cache *cache
+ = amd64_windows_frame_cache (this_frame, this_cache);
CORE_ADDR prev;
- frame_debug_printf ("%s for sp=%s",
- gdbarch_register_name (gdbarch, regnum),
+ frame_debug_printf ("%s for sp=%s", gdbarch_register_name (gdbarch, regnum),
paddress (gdbarch, cache->prev_sp));
if (regnum >= AMD64_XMM0_REGNUM && regnum <= AMD64_XMM0_REGNUM + 15)
- prev = cache->prev_xmm_addr[regnum - AMD64_XMM0_REGNUM];
+ prev = cache->prev_xmm_addr[regnum - AMD64_XMM0_REGNUM];
else if (regnum == AMD64_RSP_REGNUM)
{
prev = cache->prev_rsp_addr;
@@ -1169,27 +1152,25 @@ amd64_windows_frame_prev_register (frame_info_ptr this_frame,
static void
amd64_windows_frame_this_id (frame_info_ptr this_frame, void **this_cache,
- struct frame_id *this_id)
+ struct frame_id *this_id)
{
- struct amd64_windows_frame_cache *cache =
- amd64_windows_frame_cache (this_frame, this_cache);
+ struct amd64_windows_frame_cache *cache
+ = amd64_windows_frame_cache (this_frame, this_cache);
- *this_id = frame_id_build (cache->prev_sp,
- cache->image_base + cache->start_rva);
+ *this_id
+ = frame_id_build (cache->prev_sp, cache->image_base + cache->start_rva);
}
/* Windows x64 SEH unwinder. */
-static const struct frame_unwind amd64_windows_frame_unwind =
-{
- "amd64 windows",
- NORMAL_FRAME,
- default_frame_unwind_stop_reason,
- &amd64_windows_frame_this_id,
- &amd64_windows_frame_prev_register,
- NULL,
- default_frame_sniffer
-};
+static const struct frame_unwind amd64_windows_frame_unwind
+ = { "amd64 windows",
+ NORMAL_FRAME,
+ default_frame_unwind_stop_reason,
+ &amd64_windows_frame_this_id,
+ &amd64_windows_frame_prev_register,
+ NULL,
+ default_frame_sniffer };
/* Implement the "skip_prologue" gdbarch method. */
@@ -1202,8 +1183,9 @@ amd64_windows_skip_prologue (struct gdbarch *gdbarch, CORE_ADDR pc)
struct external_pex64_unwind_info ex_ui;
/* Use prologue size from unwind info. */
- if (amd64_windows_find_unwind_info (gdbarch, pc, &unwind_info,
- &image_base, &start_rva, &end_rva) == 0)
+ if (amd64_windows_find_unwind_info (gdbarch, pc, &unwind_info, &image_base,
+ &start_rva, &end_rva)
+ == 0)
{
if (unwind_info == 0)
{
@@ -1211,7 +1193,8 @@ amd64_windows_skip_prologue (struct gdbarch *gdbarch, CORE_ADDR pc)
return pc;
}
else if (target_read_memory (image_base + unwind_info,
- (gdb_byte *) &ex_ui, sizeof (ex_ui)) == 0
+ (gdb_byte *) &ex_ui, sizeof (ex_ui))
+ == 0
&& PEX64_UWI_VERSION (ex_ui.Version_Flags) == 1)
return std::max (pc, image_base + start_rva + ex_ui.SizeOfPrologue);
}
@@ -1244,22 +1227,19 @@ amd64_windows_skip_trampoline_code (frame_info_ptr frame, CORE_ADDR pc)
if (pc && read_memory_unsigned_integer (pc, 2, byte_order) == 0x25ff)
{
/* Get opcode offset and see if we can find a reference in our data. */
- ULONGEST offset
- = read_memory_unsigned_integer (pc + 2, 4, byte_order);
+ ULONGEST offset = read_memory_unsigned_integer (pc + 2, 4, byte_order);
/* Get address of function pointer at end of pc. */
CORE_ADDR indirect_addr = pc + offset + 6;
struct minimal_symbol *indsym
- = (indirect_addr
- ? lookup_minimal_symbol_by_pc (indirect_addr).minsym
- : NULL);
+ = (indirect_addr ? lookup_minimal_symbol_by_pc (indirect_addr).minsym
+ : NULL);
const char *symname = indsym ? indsym->linkage_name () : NULL;
if (symname)
{
- if (startswith (symname, "__imp_")
- || startswith (symname, "_imp_"))
+ if (startswith (symname, "__imp_") || startswith (symname, "_imp_"))
destination
= read_memory_unsigned_integer (indirect_addr, 8, byte_order);
}
@@ -1314,8 +1294,8 @@ amd64_windows_init_abi_common (gdbarch_info info, struct gdbarch *gdbarch)
tdep->sizeof_fpregset = 0;
/* Core file support. */
- set_gdbarch_core_xfer_shared_libraries
- (gdbarch, windows_core_xfer_shared_libraries);
+ set_gdbarch_core_xfer_shared_libraries (gdbarch,
+ windows_core_xfer_shared_libraries);
set_gdbarch_core_pid_to_str (gdbarch, windows_core_pid_to_str);
set_gdbarch_auto_wide_charset (gdbarch, amd64_windows_auto_wide_charset);
@@ -1375,6 +1355,7 @@ amd64_cygwin_core_osabi_sniffer (bfd *abfd)
}
void _initialize_amd64_windows_tdep ();
+
void
_initialize_amd64_windows_tdep ()
{
@@ -1389,5 +1370,4 @@ _initialize_amd64_windows_tdep ()
/* Cygwin uses elf core dumps. */
gdbarch_register_osabi_sniffer (bfd_arch_i386, bfd_target_elf_flavour,
amd64_cygwin_core_osabi_sniffer);
-
}
diff --git a/gdb/amdgpu-tdep.c b/gdb/amdgpu-tdep.c
index fc5e2438c7f..ff35eb46438 100644
--- a/gdb/amdgpu-tdep.c
+++ b/gdb/amdgpu-tdep.c
@@ -113,31 +113,32 @@ amdgpu_dwarf_reg_to_regnum (struct gdbarch *gdbarch, int dwarf_reg)
struct amd_dbgapi_register_type
{
enum class kind
- {
- INTEGER,
- FLOAT,
- DOUBLE,
- VECTOR,
- CODE_PTR,
- FLAGS,
- ENUM,
- };
+ {
+ INTEGER,
+ FLOAT,
+ DOUBLE,
+ VECTOR,
+ CODE_PTR,
+ FLAGS,
+ ENUM,
+ };
amd_dbgapi_register_type (kind kind, std::string lookup_name)
- : m_kind (kind), m_lookup_name (std::move (lookup_name))
- {}
+ : m_kind (kind),
+ m_lookup_name (std::move (lookup_name))
+ {
+ }
virtual ~amd_dbgapi_register_type () = default;
/* Return the type's kind. */
- kind kind () const
- { return m_kind; }
+ kind kind () const { return m_kind; }
/* Name to use for this type in the existing type map. */
- const std::string &lookup_name () const
- { return m_lookup_name; }
+ const std::string &lookup_name () const { return m_lookup_name; }
private:
+
enum kind m_kind;
std::string m_lookup_name;
};
@@ -147,20 +148,21 @@ using amd_dbgapi_register_type_up = std::unique_ptr<amd_dbgapi_register_type>;
struct amd_dbgapi_register_type_integer : public amd_dbgapi_register_type
{
amd_dbgapi_register_type_integer (bool is_unsigned, unsigned int bit_size)
- : amd_dbgapi_register_type
- (kind::INTEGER,
- string_printf ("%sint%d", is_unsigned ? "u" : "", bit_size)),
+ : amd_dbgapi_register_type (kind::INTEGER,
+ string_printf ("%sint%d",
+ is_unsigned ? "u" : "",
+ bit_size)),
m_is_unsigned (is_unsigned),
m_bit_size (bit_size)
- {}
+ {
+ }
- bool is_unsigned () const
- { return m_is_unsigned; }
+ bool is_unsigned () const { return m_is_unsigned; }
- unsigned int bit_size () const
- { return m_bit_size; }
+ unsigned int bit_size () const { return m_bit_size; }
private:
+
bool m_is_unsigned;
unsigned int m_bit_size;
};
@@ -169,40 +171,46 @@ struct amd_dbgapi_register_type_float : public amd_dbgapi_register_type
{
amd_dbgapi_register_type_float ()
: amd_dbgapi_register_type (kind::FLOAT, "float")
- {}
+ {
+ }
};
struct amd_dbgapi_register_type_double : public amd_dbgapi_register_type
{
amd_dbgapi_register_type_double ()
: amd_dbgapi_register_type (kind::DOUBLE, "double")
- {}
+ {
+ }
};
struct amd_dbgapi_register_type_vector : public amd_dbgapi_register_type
{
- amd_dbgapi_register_type_vector (const amd_dbgapi_register_type &element_type,
- unsigned int count)
+ amd_dbgapi_register_type_vector (
+ const amd_dbgapi_register_type &element_type, unsigned int count)
: amd_dbgapi_register_type (kind::VECTOR,
make_lookup_name (element_type, count)),
m_element_type (element_type),
m_count (count)
- {}
+ {
+ }
const amd_dbgapi_register_type &element_type () const
- { return m_element_type; }
+ {
+ return m_element_type;
+ }
- unsigned int count () const
- { return m_count; }
+ unsigned int count () const { return m_count; }
- static std::string make_lookup_name
- (const amd_dbgapi_register_type &element_type, unsigned int count)
+ static std::string
+ make_lookup_name (const amd_dbgapi_register_type &element_type,
+ unsigned int count)
{
return string_printf ("%s[%d]", element_type.lookup_name ().c_str (),
count);
}
private:
+
const amd_dbgapi_register_type &m_element_type;
unsigned int m_count;
};
@@ -211,7 +219,8 @@ struct amd_dbgapi_register_type_code_ptr : public amd_dbgapi_register_type
{
amd_dbgapi_register_type_code_ptr ()
: amd_dbgapi_register_type (kind::CODE_PTR, "void (*)()")
- {}
+ {
+ }
};
struct amd_dbgapi_register_type_flags : public amd_dbgapi_register_type
@@ -232,33 +241,31 @@ struct amd_dbgapi_register_type_flags : public amd_dbgapi_register_type
make_lookup_name (bit_size, name)),
m_bit_size (bit_size),
m_name (std::move (name))
- {}
+ {
+ }
- unsigned int bit_size () const
- { return m_bit_size; }
+ unsigned int bit_size () const { return m_bit_size; }
void add_field (std::string name, unsigned int bit_pos_start,
unsigned int bit_pos_end,
const amd_dbgapi_register_type *type)
{
- m_fields.push_back (field {std::move (name), bit_pos_start,
- bit_pos_end, type});
+ m_fields.push_back (field { std::move (name), bit_pos_start, bit_pos_end,
+ type });
}
- container_type::size_type size () const
- { return m_fields.size (); }
+ container_type::size_type size () const { return m_fields.size (); }
const field &operator[] (container_type::size_type pos) const
- { return m_fields[pos]; }
+ {
+ return m_fields[pos];
+ }
- const_iterator_type begin () const
- { return m_fields.begin (); }
+ const_iterator_type begin () const { return m_fields.begin (); }
- const_iterator_type end () const
- { return m_fields.end (); }
+ const_iterator_type end () const { return m_fields.end (); }
- const std::string &name () const
- { return m_name; }
+ const std::string &name () const { return m_name; }
static std::string make_lookup_name (int bits, gdb::string_view name)
{
@@ -268,6 +275,7 @@ struct amd_dbgapi_register_type_flags : public amd_dbgapi_register_type
}
private:
+
unsigned int m_bit_size;
container_type m_fields;
std::string m_name;
@@ -290,31 +298,30 @@ struct amd_dbgapi_register_type_enum : public amd_dbgapi_register_type
amd_dbgapi_register_type_enum (gdb::string_view name)
: amd_dbgapi_register_type (kind::ENUM, make_lookup_name (name)),
m_name (name.data (), name.length ())
- {}
+ {
+ }
- void set_bit_size (int bit_size)
- { m_bit_size = bit_size; }
+ void set_bit_size (int bit_size) { m_bit_size = bit_size; }
- unsigned int bit_size () const
- { return m_bit_size; }
+ unsigned int bit_size () const { return m_bit_size; }
void add_enumerator (std::string name, ULONGEST value)
- { m_enumerators.push_back (enumerator {std::move (name), value}); }
+ {
+ m_enumerators.push_back (enumerator { std::move (name), value });
+ }
- container_type::size_type size () const
- { return m_enumerators.size (); }
+ container_type::size_type size () const { return m_enumerators.size (); }
const enumerator &operator[] (container_type::size_type pos) const
- { return m_enumerators[pos]; }
+ {
+ return m_enumerators[pos];
+ }
- const_iterator_type begin () const
- { return m_enumerators.begin (); }
+ const_iterator_type begin () const { return m_enumerators.begin (); }
- const_iterator_type end () const
- { return m_enumerators.end (); }
+ const_iterator_type end () const { return m_enumerators.end (); }
- const std::string &name () const
- { return m_name; }
+ const std::string &name () const { return m_name; }
static std::string make_lookup_name (gdb::string_view name)
{
@@ -324,6 +331,7 @@ struct amd_dbgapi_register_type_enum : public amd_dbgapi_register_type
}
private:
+
unsigned int m_bit_size = 32;
container_type m_enumerators;
std::string m_name;
@@ -344,7 +352,7 @@ try_strtoulst (gdb::string_view s)
errno = 0;
ULONGEST value = strtoulst (s.data (), nullptr, 0);
if (errno != 0)
- error (_("Failed to parse integer."));
+ error (_ ("Failed to parse integer."));
return value;
};
@@ -358,31 +366,29 @@ static const amd_dbgapi_register_type &
parse_amd_dbgapi_register_type (gdb::string_view type_name,
amd_dbgapi_register_type_map &type_map);
-
/* parse_amd_dbgapi_register_type helper for enum types. */
static void
-parse_amd_dbgapi_register_type_enum_fields
- (amd_dbgapi_register_type_enum &enum_type, gdb::string_view fields)
+parse_amd_dbgapi_register_type_enum_fields (
+ amd_dbgapi_register_type_enum &enum_type, gdb::string_view fields)
{
compiled_regex regex (/* name */
- "^(" IDENTIFIER ")"
- WSOPT "=" WSOPT
+ "^(" IDENTIFIER ")" WSOPT "=" WSOPT
/* value */
- "([0-9]+)"
- WSOPT "(," WSOPT ")?",
+ "([0-9]+)" WSOPT "(," WSOPT ")?",
REG_EXTENDED,
- _("Error in AMDGPU enum register type regex"));
+ _ ("Error in AMDGPU enum register type regex"));
regmatch_t matches[4];
while (!fields.empty ())
{
int res = regex.exec (fields.data (), ARRAY_SIZE (matches), matches, 0);
if (res == REG_NOMATCH)
- error (_("Failed to parse enum fields"));
+ error (_ ("Failed to parse enum fields"));
- auto sv_from_match = [fields] (const regmatch_t &m)
- { return fields.substr (m.rm_so, m.rm_eo - m.rm_so); };
+ auto sv_from_match = [fields] (const regmatch_t &m) {
+ return fields.substr (m.rm_so, m.rm_eo - m.rm_so);
+ };
gdb::string_view name = sv_from_match (matches[1]);
gdb::string_view value_str = sv_from_match (matches[2]);
@@ -400,34 +406,35 @@ parse_amd_dbgapi_register_type_enum_fields
/* parse_amd_dbgapi_register_type helper for flags types. */
static void
-parse_amd_dbgapi_register_type_flags_fields
- (amd_dbgapi_register_type_flags &flags_type,
- int bits, gdb::string_view name, gdb::string_view fields,
- amd_dbgapi_register_type_map &type_map)
+parse_amd_dbgapi_register_type_flags_fields (
+ amd_dbgapi_register_type_flags &flags_type, int bits, gdb::string_view name,
+ gdb::string_view fields, amd_dbgapi_register_type_map &type_map)
{
gdb_assert (bits == 32 || bits == 64);
std::string regex_str
= string_printf (/* type */
- "^(bool|uint%d_t|enum" WS IDENTIFIER WSOPT "(\\{[^}]*})?)"
- WS
+ "^(bool|uint%d_t|enum" WS IDENTIFIER WSOPT
+ "(\\{[^}]*})?)" WS
/* name */
"(" IDENTIFIER ")" WSOPT
/* bit position */
"@([0-9]+)(-[0-9]+)?" WSOPT ";" WSOPT,
bits);
- compiled_regex regex (regex_str.c_str (), REG_EXTENDED,
- _("Error in AMDGPU register type flags fields regex"));
+ compiled_regex regex (
+ regex_str.c_str (), REG_EXTENDED,
+ _ ("Error in AMDGPU register type flags fields regex"));
regmatch_t matches[6];
while (!fields.empty ())
{
int res = regex.exec (fields.data (), ARRAY_SIZE (matches), matches, 0);
if (res == REG_NOMATCH)
- error (_("Failed to parse flags type fields string"));
+ error (_ ("Failed to parse flags type fields string"));
- auto sv_from_match = [fields] (const regmatch_t &m)
- { return fields.substr (m.rm_so, m.rm_eo - m.rm_so); };
+ auto sv_from_match = [fields] (const regmatch_t &m) {
+ return fields.substr (m.rm_so, m.rm_eo - m.rm_so);
+ };
gdb::string_view field_type_str = sv_from_match (matches[1]);
gdb::string_view field_name = sv_from_match (matches[3]);
@@ -435,19 +442,19 @@ parse_amd_dbgapi_register_type_flags_fields
ULONGEST pos_begin = try_strtoulst (pos_begin_str);
if (field_type_str == "bool")
- flags_type.add_field (gdb::to_string (field_name), pos_begin, pos_begin,
- nullptr);
+ flags_type.add_field (gdb::to_string (field_name), pos_begin,
+ pos_begin, nullptr);
else
{
if (matches[5].rm_so == -1)
- error (_("Missing end bit position"));
+ error (_ ("Missing end bit position"));
gdb::string_view pos_end_str = sv_from_match (matches[5]);
ULONGEST pos_end = try_strtoulst (pos_end_str.substr (1));
const amd_dbgapi_register_type &field_type
= parse_amd_dbgapi_register_type (field_type_str, type_map);
- flags_type.add_field (gdb::to_string (field_name), pos_begin, pos_end,
- &field_type);
+ flags_type.add_field (gdb::to_string (field_name), pos_begin,
+ pos_end, &field_type);
}
fields = fields.substr (matches[0].rm_eo);
@@ -469,7 +476,7 @@ parse_amd_dbgapi_register_type_scalar (gdb::string_view name,
&& kind != amd_dbgapi_register_type::kind::FLOAT
&& kind != amd_dbgapi_register_type::kind::DOUBLE
&& kind != amd_dbgapi_register_type::kind::CODE_PTR)
- error (_("type mismatch"));
+ error (_ ("type mismatch"));
return *it->second;
}
@@ -490,7 +497,7 @@ parse_amd_dbgapi_register_type_scalar (gdb::string_view name,
else if (name == "void (*)()")
type.reset (new amd_dbgapi_register_type_code_ptr ());
else
- error (_("unknown type %s"), name_str.c_str ());
+ error (_ ("unknown type %s"), name_str.c_str ());
auto insertion_pair = type_map.emplace (name, std::move (type));
return *insertion_pair.first->second;
@@ -507,8 +514,9 @@ parse_amd_dbgapi_register_type (gdb::string_view type_str,
amd_dbgapi_register_type_map &type_map)
{
size_t pos_open_bracket = type_str.find_last_of ('[');
- auto sv_from_match = [type_str] (const regmatch_t &m)
- { return type_str.substr (m.rm_so, m.rm_eo - m.rm_so); };
+ auto sv_from_match = [type_str] (const regmatch_t &m) {
+ return type_str.substr (m.rm_so, m.rm_eo - m.rm_so);
+ };
if (pos_open_bracket != gdb::string_view::npos)
{
@@ -522,12 +530,13 @@ parse_amd_dbgapi_register_type (gdb::string_view type_str,
gdb_assert (pos_close_bracket != gdb::string_view::npos);
gdb::string_view count_str_view
= type_str.substr (pos_open_bracket + 1,
- pos_close_bracket - pos_open_bracket);
+ pos_close_bracket - pos_open_bracket);
std::string count_str = gdb::to_string (count_str_view);
unsigned int count = std::stoul (count_str);
std::string lookup_name
- = amd_dbgapi_register_type_vector::make_lookup_name (element_type, count);
+ = amd_dbgapi_register_type_vector::make_lookup_name (element_type,
+ count);
auto existing_type_it = type_map.find (lookup_name);
if (existing_type_it != type_map.end ())
{
@@ -536,8 +545,8 @@ parse_amd_dbgapi_register_type (gdb::string_view type_str,
return *existing_type_it->second;
}
- amd_dbgapi_register_type_up type
- (new amd_dbgapi_register_type_vector (element_type, count));
+ amd_dbgapi_register_type_up type (
+ new amd_dbgapi_register_type_vector (element_type, count));
auto insertion_pair
= type_map.emplace (type->lookup_name (), std::move (type));
return *insertion_pair.first->second;
@@ -546,16 +555,16 @@ parse_amd_dbgapi_register_type (gdb::string_view type_str,
if (type_str.find ("flags32_t") == 0 || type_str.find ("flags64_t") == 0)
{
/* Split 'type_str' into 4 tokens: "(type) (name) ({ (fields) })". */
- compiled_regex regex ("^(flags32_t|flags64_t)"
- WS "(" IDENTIFIER ")" WSOPT
- "(\\{" WSOPT "(.*)})?",
+ compiled_regex regex ("^(flags32_t|flags64_t)" WS "(" IDENTIFIER
+ ")" WSOPT "(\\{" WSOPT "(.*)})?",
REG_EXTENDED,
- _("Error in AMDGPU register type regex"));
+ _ ("Error in AMDGPU register type regex"));
regmatch_t matches[5];
- int res = regex.exec (type_str.data (), ARRAY_SIZE (matches), matches, 0);
+ int res
+ = regex.exec (type_str.data (), ARRAY_SIZE (matches), matches, 0);
if (res == REG_NOMATCH)
- error (_("Failed to parse flags type string"));
+ error (_ ("Failed to parse flags type string"));
gdb::string_view flags_keyword = sv_from_match (matches[1]);
unsigned int bit_size = flags_keyword == "flags32_t" ? 32 : 64;
@@ -568,12 +577,12 @@ parse_amd_dbgapi_register_type (gdb::string_view type_str,
{
/* No braces, lookup existing type. */
if (existing_type_it == type_map.end ())
- error (_("reference to unknown type %s."),
+ error (_ ("reference to unknown type %s."),
gdb::to_string (name).c_str ());
if (existing_type_it->second->kind ()
!= amd_dbgapi_register_type::kind::FLAGS)
- error (_("type mismatch"));
+ error (_ ("type mismatch"));
return *existing_type_it->second;
}
@@ -581,34 +590,37 @@ parse_amd_dbgapi_register_type (gdb::string_view type_str,
{
/* With braces, it's a definition. */
if (existing_type_it != type_map.end ())
- error (_("re-definition of type %s."),
+ error (_ ("re-definition of type %s."),
gdb::to_string (name).c_str ());
- amd_dbgapi_register_type_flags_up flags_type
- (new amd_dbgapi_register_type_flags (bit_size, name));
+ amd_dbgapi_register_type_flags_up flags_type (
+ new amd_dbgapi_register_type_flags (bit_size, name));
gdb::string_view fields_without_braces = sv_from_match (matches[4]);
- parse_amd_dbgapi_register_type_flags_fields
- (*flags_type, bit_size, name, fields_without_braces, type_map);
+ parse_amd_dbgapi_register_type_flags_fields (*flags_type, bit_size,
+ name,
+ fields_without_braces,
+ type_map);
- auto insertion_pair
- = type_map.emplace (flags_type->lookup_name (),
- std::move (flags_type));
+ auto insertion_pair = type_map.emplace (flags_type->lookup_name (),
+ std::move (flags_type));
return *insertion_pair.first->second;
}
}
if (type_str.find ("enum") == 0)
{
- compiled_regex regex ("^enum" WS "(" IDENTIFIER ")" WSOPT "(\\{" WSOPT "([^}]*)})?",
+ compiled_regex regex ("^enum" WS "(" IDENTIFIER ")" WSOPT "(\\{" WSOPT
+ "([^}]*)})?",
REG_EXTENDED,
- _("Error in AMDGPU register type enum regex"));
+ _ ("Error in AMDGPU register type enum regex"));
/* Split 'type_name' into 3 tokens: "(name) ( { (fields) } )". */
regmatch_t matches[4];
- int res = regex.exec (type_str.data (), ARRAY_SIZE (matches), matches, 0);
+ int res
+ = regex.exec (type_str.data (), ARRAY_SIZE (matches), matches, 0);
if (res == REG_NOMATCH)
- error (_("Failed to parse flags type string"));
+ error (_ ("Failed to parse flags type string"));
gdb::string_view name = sv_from_match (matches[1]);
@@ -620,12 +632,12 @@ parse_amd_dbgapi_register_type (gdb::string_view type_str,
{
/* No braces, lookup existing type. */
if (existing_type_it == type_map.end ())
- error (_("reference to unknown type %s"),
+ error (_ ("reference to unknown type %s"),
gdb::to_string (name).c_str ());
if (existing_type_it->second->kind ()
!= amd_dbgapi_register_type::kind::ENUM)
- error (_("type mismatch"));
+ error (_ ("type mismatch"));
return *existing_type_it->second;
}
@@ -633,19 +645,18 @@ parse_amd_dbgapi_register_type (gdb::string_view type_str,
{
/* With braces, it's a definition. */
if (existing_type_it != type_map.end ())
- error (_("re-definition of type %s"),
+ error (_ ("re-definition of type %s"),
gdb::to_string (name).c_str ());
- amd_dbgapi_register_type_enum_up enum_type
- (new amd_dbgapi_register_type_enum (name));
+ amd_dbgapi_register_type_enum_up enum_type (
+ new amd_dbgapi_register_type_enum (name));
gdb::string_view fields_without_braces = sv_from_match (matches[3]);
- parse_amd_dbgapi_register_type_enum_fields
- (*enum_type, fields_without_braces);
+ parse_amd_dbgapi_register_type_enum_fields (*enum_type,
+ fields_without_braces);
- auto insertion_pair
- = type_map.emplace (enum_type->lookup_name (),
- std::move (enum_type));
+ auto insertion_pair = type_map.emplace (enum_type->lookup_name (),
+ std::move (enum_type));
return *insertion_pair.first->second;
}
}
@@ -722,12 +733,13 @@ amd_dbgapi_register_type_to_gdb_type (const amd_dbgapi_register_type &type,
else
{
struct type *field_type
- = amd_dbgapi_register_type_to_gdb_type (*field.type, gdbarch);
+ = amd_dbgapi_register_type_to_gdb_type (*field.type,
+ gdbarch);
gdb_assert (field_type != nullptr);
- append_flags_type_field
- (gdb_type, field.bit_pos_start,
- field.bit_pos_end - field.bit_pos_start + 1,
- field_type, field.name.c_str ());
+ append_flags_type_field (gdb_type, field.bit_pos_start,
+ field.bit_pos_end
+ - field.bit_pos_start + 1,
+ field_type, field.name.c_str ());
}
}
@@ -743,9 +755,8 @@ amd_dbgapi_register_type_to_gdb_type (const amd_dbgapi_register_type &type,
enum_type.name ().c_str ());
gdb_type->set_num_fields (enum_type.size ());
- gdb_type->set_fields
- ((struct field *) TYPE_ZALLOC (gdb_type, (sizeof (struct field)
- * enum_type.size ())));
+ gdb_type->set_fields ((struct field *) TYPE_ZALLOC (
+ gdb_type, (sizeof (struct field) * enum_type.size ())));
gdb_type->set_is_unsigned (true);
for (size_t i = 0; i < enum_type.size (); ++i)
@@ -779,7 +790,7 @@ amdgpu_register_type (struct gdbarch *gdbarch, int regnum)
AMD_DBGAPI_REGISTER_INFO_TYPE,
sizeof (bytes), &bytes);
if (status != AMD_DBGAPI_STATUS_SUCCESS)
- error (_("Failed to get register type from amd-dbgapi"));
+ error (_ ("Failed to get register type from amd-dbgapi"));
gdb::unique_xmalloc_ptr<char> bytes_holder (bytes);
amd_dbgapi_register_type_map type_map;
@@ -824,7 +835,8 @@ static const gdb_byte *
amdgpu_sw_breakpoint_from_kind (struct gdbarch *gdbarch, int kind, int *size)
{
*size = kind;
- return get_amdgpu_gdbarch_tdep (gdbarch)->breakpoint_instruction_bytes.get ();
+ return get_amdgpu_gdbarch_tdep (gdbarch)
+ ->breakpoint_instruction_bytes.get ();
}
struct amdgpu_frame_cache
@@ -933,8 +945,7 @@ print_insn_amdgpu (bfd_vma memaddr, struct disassemble_info *info)
auto symbolizer = [] (amd_dbgapi_symbolizer_id_t symbolizer_id,
amd_dbgapi_global_address_t address,
- char **symbol_text) -> amd_dbgapi_status_t
- {
+ char **symbol_text) -> amd_dbgapi_status_t {
gdb_disassemble_info *disasm_info
= reinterpret_cast<gdb_disassemble_info *> (symbolizer_id);
gdb_printing_disassembler *disasm
@@ -949,21 +960,20 @@ print_insn_amdgpu (bfd_vma memaddr, struct disassemble_info *info)
};
auto symbolizer_id = reinterpret_cast<amd_dbgapi_symbolizer_id_t> (di);
char *instruction_text = nullptr;
- status = amd_dbgapi_disassemble_instruction (architecture_id, memaddr,
- &instruction_size,
- buffer.data (),
- &instruction_text,
- symbolizer_id,
- symbolizer);
+ status
+ = amd_dbgapi_disassemble_instruction (architecture_id, memaddr,
+ &instruction_size, buffer.data (),
+ &instruction_text, symbolizer_id,
+ symbolizer);
if (status != AMD_DBGAPI_STATUS_SUCCESS)
{
size_t alignment;
- status = amd_dbgapi_architecture_get_info
- (architecture_id,
- AMD_DBGAPI_ARCHITECTURE_INFO_MINIMUM_INSTRUCTION_ALIGNMENT,
- sizeof (alignment), &alignment);
+ status = amd_dbgapi_architecture_get_info (
+ architecture_id,
+ AMD_DBGAPI_ARCHITECTURE_INFO_MINIMUM_INSTRUCTION_ALIGNMENT,
+ sizeof (alignment), &alignment);
if (status != AMD_DBGAPI_STATUS_SUCCESS)
- error (_("amd_dbgapi_architecture_get_info failed"));
+ error (_ ("amd_dbgapi_architecture_get_info failed"));
info->fprintf_func (di, "<illegal instruction>");
@@ -996,8 +1006,7 @@ amdgpu_skip_prologue (struct gdbarch *gdbarch, CORE_ADDR start_pc)
/* Clang always emits a line note before the prologue and another
one after. We trust clang to emit usable line notes. */
- if (post_prologue_pc != 0
- && cust != nullptr
+ if (post_prologue_pc != 0 && cust != nullptr
&& cust->producer () != nullptr
&& producer_is_llvm (cust->producer ()))
return std::max (start_pc, post_prologue_pc);
@@ -1026,8 +1035,8 @@ amdgpu_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
return arches->gdbarch;
/* Allocate space for the new architecture. */
- gdbarch_up gdbarch_u
- (gdbarch_alloc (&info, gdbarch_tdep_up (new amdgpu_gdbarch_tdep)));
+ gdbarch_up gdbarch_u (
+ gdbarch_alloc (&info, gdbarch_tdep_up (new amdgpu_gdbarch_tdep)));
gdbarch *gdbarch = gdbarch_u.get ();
amdgpu_gdbarch_tdep *tdep = gdbarch_tdep<amdgpu_gdbarch_tdep> (gdbarch);
@@ -1061,11 +1070,10 @@ amdgpu_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
&architecture_id);
if (status != AMD_DBGAPI_STATUS_SUCCESS)
{
- warning (_("Failed to get architecture from amd-dbgapi"));
+ warning (_ ("Failed to get architecture from amd-dbgapi"));
return nullptr;
}
-
/* Add register groups. */
size_t register_class_count;
amd_dbgapi_register_class_id_t *register_class_ids;
@@ -1074,7 +1082,7 @@ amdgpu_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
&register_class_ids);
if (status != AMD_DBGAPI_STATUS_SUCCESS)
{
- warning (_("Failed to get register class list from amd-dbgapi"));
+ warning (_ ("Failed to get register class list from amd-dbgapi"));
return nullptr;
}
@@ -1084,12 +1092,12 @@ amdgpu_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
for (size_t i = 0; i < register_class_count; ++i)
{
char *bytes;
- status = amd_dbgapi_architecture_register_class_get_info
- (register_class_ids[i], AMD_DBGAPI_REGISTER_CLASS_INFO_NAME,
- sizeof (bytes), &bytes);
+ status = amd_dbgapi_architecture_register_class_get_info (
+ register_class_ids[i], AMD_DBGAPI_REGISTER_CLASS_INFO_NAME,
+ sizeof (bytes), &bytes);
if (status != AMD_DBGAPI_STATUS_SUCCESS)
{
- warning (_("Failed to get register class name from amd-dbgapi"));
+ warning (_ ("Failed to get register class name from amd-dbgapi"));
return nullptr;
}
@@ -1105,24 +1113,24 @@ amdgpu_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
continue;
/* Allocate the reggroup in the gdbarch. */
- reggroup_add
- (gdbarch, reggroup_gdbarch_new (gdbarch, name.get (), USER_REGGROUP));
+ reggroup_add (gdbarch, reggroup_gdbarch_new (gdbarch, name.get (),
+ USER_REGGROUP));
}
/* Add registers. */
size_t register_count;
amd_dbgapi_register_id_t *register_ids;
- status = amd_dbgapi_architecture_register_list (architecture_id,
- &register_count,
- &register_ids);
+ status
+ = amd_dbgapi_architecture_register_list (architecture_id, &register_count,
+ &register_ids);
if (status != AMD_DBGAPI_STATUS_SUCCESS)
{
- warning (_("Failed to get register list from amd-dbgapi"));
+ warning (_ ("Failed to get register list from amd-dbgapi"));
return nullptr;
}
- gdb::unique_xmalloc_ptr<amd_dbgapi_register_id_t> register_ids_holder
- (register_ids);
+ gdb::unique_xmalloc_ptr<amd_dbgapi_register_id_t> register_ids_holder (
+ register_ids);
tdep->register_ids.insert (tdep->register_ids.end (), &register_ids[0],
&register_ids[register_count]);
@@ -1138,7 +1146,7 @@ amdgpu_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
&register_properties)
!= AMD_DBGAPI_STATUS_SUCCESS)
{
- warning (_("Failed to get register properties from amd-dbgapi"));
+ warning (_ ("Failed to get register properties from amd-dbgapi"));
return nullptr;
}
}
@@ -1179,12 +1187,12 @@ amdgpu_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
}
amd_dbgapi_register_id_t pc_register_id;
- status = amd_dbgapi_architecture_get_info
- (architecture_id, AMD_DBGAPI_ARCHITECTURE_INFO_PC_REGISTER,
- sizeof (pc_register_id), &pc_register_id);
+ status = amd_dbgapi_architecture_get_info (
+ architecture_id, AMD_DBGAPI_ARCHITECTURE_INFO_PC_REGISTER,
+ sizeof (pc_register_id), &pc_register_id);
if (status != AMD_DBGAPI_STATUS_SUCCESS)
{
- warning (_("Failed to get PC register from amd-dbgapi"));
+ warning (_ ("Failed to get PC register from amd-dbgapi"));
return nullptr;
}
@@ -1203,29 +1211,29 @@ amdgpu_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
/* Disassembly. */
set_gdbarch_print_insn (gdbarch, print_insn_amdgpu);
- /* Instructions. */
+ /* Instructions. */
amd_dbgapi_size_t max_insn_length = 0;
- status = amd_dbgapi_architecture_get_info
- (architecture_id, AMD_DBGAPI_ARCHITECTURE_INFO_LARGEST_INSTRUCTION_SIZE,
- sizeof (max_insn_length), &max_insn_length);
+ status = amd_dbgapi_architecture_get_info (
+ architecture_id, AMD_DBGAPI_ARCHITECTURE_INFO_LARGEST_INSTRUCTION_SIZE,
+ sizeof (max_insn_length), &max_insn_length);
if (status != AMD_DBGAPI_STATUS_SUCCESS)
- error (_("amd_dbgapi_architecture_get_info failed"));
+ error (_ ("amd_dbgapi_architecture_get_info failed"));
set_gdbarch_max_insn_length (gdbarch, max_insn_length);
- status = amd_dbgapi_architecture_get_info
- (architecture_id, AMD_DBGAPI_ARCHITECTURE_INFO_BREAKPOINT_INSTRUCTION_SIZE,
- sizeof (tdep->breakpoint_instruction_size),
- &tdep->breakpoint_instruction_size);
+ status = amd_dbgapi_architecture_get_info (
+ architecture_id, AMD_DBGAPI_ARCHITECTURE_INFO_BREAKPOINT_INSTRUCTION_SIZE,
+ sizeof (tdep->breakpoint_instruction_size),
+ &tdep->breakpoint_instruction_size);
if (status != AMD_DBGAPI_STATUS_SUCCESS)
- error (_("amd_dbgapi_architecture_get_info failed"));
+ error (_ ("amd_dbgapi_architecture_get_info failed"));
gdb_byte *breakpoint_instruction_bytes;
- status = amd_dbgapi_architecture_get_info
- (architecture_id, AMD_DBGAPI_ARCHITECTURE_INFO_BREAKPOINT_INSTRUCTION,
- sizeof (breakpoint_instruction_bytes), &breakpoint_instruction_bytes);
+ status = amd_dbgapi_architecture_get_info (
+ architecture_id, AMD_DBGAPI_ARCHITECTURE_INFO_BREAKPOINT_INSTRUCTION,
+ sizeof (breakpoint_instruction_bytes), &breakpoint_instruction_bytes);
if (status != AMD_DBGAPI_STATUS_SUCCESS)
- error (_("amd_dbgapi_architecture_get_info failed"));
+ error (_ ("amd_dbgapi_architecture_get_info failed"));
tdep->breakpoint_instruction_bytes.reset (breakpoint_instruction_bytes);
@@ -1235,12 +1243,12 @@ amdgpu_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
amdgpu_sw_breakpoint_from_kind);
amd_dbgapi_size_t pc_adjust;
- status = amd_dbgapi_architecture_get_info
- (architecture_id,
- AMD_DBGAPI_ARCHITECTURE_INFO_BREAKPOINT_INSTRUCTION_PC_ADJUST,
- sizeof (pc_adjust), &pc_adjust);
+ status = amd_dbgapi_architecture_get_info (
+ architecture_id,
+ AMD_DBGAPI_ARCHITECTURE_INFO_BREAKPOINT_INSTRUCTION_PC_ADJUST,
+ sizeof (pc_adjust), &pc_adjust);
if (status != AMD_DBGAPI_STATUS_SUCCESS)
- error (_("amd_dbgapi_architecture_get_info failed"));
+ error (_ ("amd_dbgapi_architecture_get_info failed"));
set_gdbarch_decr_pc_after_break (gdbarch, pc_adjust);
@@ -1255,8 +1263,7 @@ amdgpu_register_type_parse_test ()
{
/* A type that exercises flags and enums, in particular looking up an
existing enum type by name. */
- const char *flags_type_str =
- "flags32_t mode { \
+ const char *flags_type_str = "flags32_t mode { \
enum fp_round { \
NEAREST_EVEN = 0, \
PLUS_INF = 1, \
@@ -1302,27 +1309,27 @@ amdgpu_register_type_parse_test ()
/* Check the two "FP_ROUND" fields. */
auto check_fp_round_field
- = [] (const char *name, const amd_dbgapi_register_type_flags::field &field)
- {
- gdb_assert (field.name == name);
- gdb_assert (field.type->kind ()
- == amd_dbgapi_register_type::kind::ENUM);
-
- const auto &e
- = static_cast<const amd_dbgapi_register_type_enum &> (*field.type);
- gdb_assert (e.size () == 4);
- gdb_assert (e[0].name == "NEAREST_EVEN");
- gdb_assert (e[0].value == 0);
- gdb_assert (e[3].name == "ZERO");
- gdb_assert (e[3].value == 3);
- };
+ = [] (const char *name,
+ const amd_dbgapi_register_type_flags::field &field) {
+ gdb_assert (field.name == name);
+ gdb_assert (field.type->kind () == amd_dbgapi_register_type::kind::ENUM);
+
+ const auto &e
+ = static_cast<const amd_dbgapi_register_type_enum &> (*field.type);
+ gdb_assert (e.size () == 4);
+ gdb_assert (e[0].name == "NEAREST_EVEN");
+ gdb_assert (e[0].value == 0);
+ gdb_assert (e[3].name == "ZERO");
+ gdb_assert (e[3].value == 3);
+ };
check_fp_round_field ("FP_ROUND.32", f[0]);
check_fp_round_field ("FP_ROUND.64_16", f[1]);
/* Check the "CSP" field. */
gdb_assert (f[22].name == "CSP");
- gdb_assert (f[22].type->kind () == amd_dbgapi_register_type::kind::INTEGER);
+ gdb_assert (f[22].type->kind ()
+ == amd_dbgapi_register_type::kind::INTEGER);
const auto &i
= static_cast<const amd_dbgapi_register_type_integer &> (*f[22].type);
@@ -1339,7 +1346,8 @@ amdgpu_register_type_parse_test ()
gdb_assert (type.kind () == amd_dbgapi_register_type::kind::VECTOR);
- const auto &v = static_cast<const amd_dbgapi_register_type_vector &> (type);
+ const auto &v
+ = static_cast<const amd_dbgapi_register_type_vector &> (type);
gdb_assert (v.count () == 64);
const auto &et = v.element_type ();
diff --git a/gdb/amdgpu-tdep.h b/gdb/amdgpu-tdep.h
index 24081ebaf7d..703ee8ea1ab 100644
--- a/gdb/amdgpu-tdep.h
+++ b/gdb/amdgpu-tdep.h
@@ -28,8 +28,7 @@
/* Provide std::unordered_map::Hash for amd_dbgapi_register_id_t. */
struct register_id_hash
{
- size_t
- operator() (const amd_dbgapi_register_id_t &register_id) const
+ size_t operator() (const amd_dbgapi_register_id_t &register_id) const
{
return std::hash<decltype (register_id.handle)> () (register_id.handle);
}
@@ -38,9 +37,8 @@ struct register_id_hash
/* Provide std::unordered_map::Equal for amd_dbgapi_register_id_t. */
struct register_id_equal_to
{
- bool
- operator() (const amd_dbgapi_register_id_t &lhs,
- const amd_dbgapi_register_id_t &rhs) const
+ bool operator() (const amd_dbgapi_register_id_t &lhs,
+ const amd_dbgapi_register_id_t &rhs) const
{
return std::equal_to<decltype (lhs.handle)> () (lhs.handle, rhs.handle);
}
diff --git a/gdb/annotate.c b/gdb/annotate.c
index 60fe6ccd5c2..64a5ef03386 100644
--- a/gdb/annotate.c
+++ b/gdb/annotate.c
@@ -29,7 +29,6 @@
#include "source.h"
#include "objfiles.h"
#include "source-cache.h"
-
/* Prototypes for local functions. */
@@ -37,7 +36,6 @@ static void print_value_flags (struct type *);
static void breakpoint_changed (struct breakpoint *b);
-
void (*deprecated_annotate_signalled_hook) (void);
void (*deprecated_annotate_signal_hook) (void);
@@ -161,7 +159,7 @@ annotate_signal (void)
if (annotation_level > 1)
printf_unfiltered (("\n\032\032signal\n"));
}
-
+
void
annotate_breakpoints_headers (void)
{
@@ -274,7 +272,7 @@ annotate_field_end (void)
if (annotation_level == 2)
printf_unfiltered (("\n\032\032field-end\n"));
}
-
+
void
annotate_quit (void)
{
@@ -448,8 +446,7 @@ annotate_source_line (struct symtab *s, int line, int mid_statement,
return false;
annotate_source (s->fullname, line, (int) (*offsets)[line - 1],
- mid_statement, s->compunit ()->objfile ()->arch (),
- pc);
+ mid_statement, s->compunit ()->objfile ()->arch (), pc);
/* Update the current symtab and line. */
symtab_and_line sal;
@@ -464,13 +461,12 @@ annotate_source_line (struct symtab *s, int line, int mid_statement,
return false;
}
-
void
annotate_frame_begin (int level, struct gdbarch *gdbarch, CORE_ADDR pc)
{
if (annotation_level > 1)
- printf_unfiltered (("\n\032\032frame-begin %d %s\n"),
- level, paddress (gdbarch, pc));
+ printf_unfiltered (("\n\032\032frame-begin %d %s\n"), level,
+ paddress (gdbarch, pc));
}
void
@@ -563,7 +559,7 @@ annotate_frame_end (void)
if (annotation_level == 2)
printf_unfiltered (("\n\032\032frame-end\n"));
}
-
+
void
annotate_array_section_begin (int idx, struct type *elttype)
{
@@ -624,6 +620,7 @@ breakpoint_changed (struct breakpoint *b)
}
void _initialize_annotate ();
+
void
_initialize_annotate ()
{
diff --git a/gdb/annotate.h b/gdb/annotate.h
index 48fdb7a61d9..94092ced900 100644
--- a/gdb/annotate.h
+++ b/gdb/annotate.h
@@ -82,6 +82,7 @@ extern void annotate_arg_end (void);
struct annotate_arg_emitter
{
annotate_arg_emitter () { annotate_arg_begin (); }
+
~annotate_arg_emitter () { annotate_arg_end (); }
DISABLE_COPY_AND_ASSIGN (annotate_arg_emitter);
diff --git a/gdb/arc-linux-nat.c b/gdb/arc-linux-nat.c
index d0333b536d2..cd2b0f15f09 100644
--- a/gdb/arc-linux-nat.c
+++ b/gdb/arc-linux-nat.c
@@ -54,13 +54,14 @@
/* Linux starting with 4.12 supports NT_ARC_V2 note type, which adds R30,
R58 and R59 registers, which are specific to ARC HS and aren't
available in ARC 700. */
-#if defined (NT_ARC_V2) && defined (__ARCHS__)
+#if defined(NT_ARC_V2) && defined(__ARCHS__)
#define ARC_HAS_V2_REGSET
#endif
class arc_linux_nat_target final : public linux_nat_target
{
public:
+
/* Add ARC register access methods. */
void fetch_registers (struct regcache *, int) override;
void store_registers (struct regcache *, int) override;
@@ -87,7 +88,7 @@ fetch_gregs (struct regcache *regcache, int regnum)
iov.iov_len = sizeof (gdb_gregset_t);
if (ptrace (PTRACE_GETREGSET, tid, NT_PRSTATUS, (void *) &iov) < 0)
- perror_with_name (_("Couldn't get general registers"));
+ perror_with_name (_ ("Couldn't get general registers"));
else
arc_linux_supply_gregset (NULL, regcache, regnum, &regs, 0);
}
@@ -107,7 +108,7 @@ fetch_v2_regs (struct regcache *regcache, int regnum)
iov.iov_len = ARC_LINUX_SIZEOF_V2_REGSET;
if (ptrace (PTRACE_GETREGSET, tid, NT_ARC_V2, (void *) &iov) < 0)
- perror_with_name (_("Couldn't get ARC HS registers"));
+ perror_with_name (_ ("Couldn't get ARC HS registers"));
else
arc_linux_supply_v2_regset (NULL, regcache, regnum, v2_buffer, 0);
}
@@ -126,13 +127,13 @@ store_gregs (const struct regcache *regcache, int regnum)
iov.iov_len = sizeof (gdb_gregset_t);
if (ptrace (PTRACE_GETREGSET, tid, NT_PRSTATUS, (void *) &iov) < 0)
- perror_with_name (_("Couldn't get general registers"));
+ perror_with_name (_ ("Couldn't get general registers"));
else
{
arc_linux_collect_gregset (NULL, regcache, regnum, regs, 0);
if (ptrace (PTRACE_SETREGSET, tid, NT_PRSTATUS, (void *) &iov) < 0)
- perror_with_name (_("Couldn't write general registers"));
+ perror_with_name (_ ("Couldn't write general registers"));
}
}
@@ -150,13 +151,13 @@ store_v2_regs (const struct regcache *regcache, int regnum)
iov.iov_len = ARC_LINUX_SIZEOF_V2_REGSET;
if (ptrace (PTRACE_GETREGSET, tid, NT_ARC_V2, (void *) &iov) < 0)
- perror_with_name (_("Couldn't get ARC HS registers"));
+ perror_with_name (_ ("Couldn't get ARC HS registers"));
else
{
arc_linux_collect_v2_regset (NULL, regcache, regnum, v2_buffer, 0);
if (ptrace (PTRACE_SETREGSET, tid, NT_ARC_V2, (void *) &iov) < 0)
- perror_with_name (_("Couldn't write ARC HS registers"));
+ perror_with_name (_ ("Couldn't write ARC HS registers"));
}
}
#endif
@@ -167,16 +168,13 @@ store_v2_regs (const struct regcache *regcache, int regnum)
void
arc_linux_nat_target::fetch_registers (struct regcache *regcache, int regnum)
{
-
if (regnum == -1 || regnum <= ARC_LAST_REGNUM)
fetch_gregs (regcache, regnum);
#ifdef ARC_HAS_V2_REGSET
- if (regnum == -1
- || regnum == ARC_R30_REGNUM
- || regnum == ARC_R58_REGNUM
+ if (regnum == -1 || regnum == ARC_R30_REGNUM || regnum == ARC_R58_REGNUM
|| regnum == ARC_R59_REGNUM)
- fetch_v2_regs (regcache, regnum);
+ fetch_v2_regs (regcache, regnum);
#endif
}
@@ -190,9 +188,7 @@ arc_linux_nat_target::store_registers (struct regcache *regcache, int regnum)
store_gregs (regcache, regnum);
#ifdef ARC_HAS_V2_REGSET
- if (regnum == -1
- || regnum == ARC_R30_REGNUM
- || regnum == ARC_R58_REGNUM
+ if (regnum == -1 || regnum == ARC_R30_REGNUM || regnum == ARC_R58_REGNUM
|| regnum == ARC_R59_REGNUM)
store_v2_regs (regcache, regnum);
#endif
@@ -202,8 +198,8 @@ arc_linux_nat_target::store_registers (struct regcache *regcache, int regnum)
This function is exported to proc-service.c */
void
-fill_gregset (const struct regcache *regcache,
- gdb_gregset_t *gregs, int regnum)
+fill_gregset (const struct regcache *regcache, gdb_gregset_t *gregs,
+ int regnum)
{
arc_linux_collect_gregset (NULL, regcache, regnum, gregs, 0);
}
@@ -221,8 +217,8 @@ supply_gregset (struct regcache *regcache, const gdb_gregset_t *gregs)
to proc-service.c. */
void
-fill_fpregset (const struct regcache *regcache,
- gdb_fpregset_t *fpregsetp, int regnum)
+fill_fpregset (const struct regcache *regcache, gdb_fpregset_t *fpregsetp,
+ int regnum)
{
arc_linux_nat_debug_printf ("called");
}
@@ -311,6 +307,7 @@ ps_get_thread_area (struct ps_prochandle *ph, lwpid_t lwpid, int idx,
/* Suppress warning from -Wmissing-prototypes. */
void _initialize_arc_linux_nat ();
+
void
_initialize_arc_linux_nat ()
{
diff --git a/gdb/arc-linux-tdep.c b/gdb/arc-linux-tdep.c
index 947c2a3873e..41ef92d71c6 100644
--- a/gdb/arc-linux-tdep.c
+++ b/gdb/arc-linux-tdep.c
@@ -50,9 +50,8 @@
here as well. */
static const int arc_linux_sc_reg_offsets[] = {
/* R0 - R12. */
- REGOFF (22), REGOFF (21), REGOFF (20), REGOFF (19),
- REGOFF (18), REGOFF (17), REGOFF (16), REGOFF (15),
- REGOFF (14), REGOFF (13), REGOFF (12), REGOFF (11),
+ REGOFF (22), REGOFF (21), REGOFF (20), REGOFF (19), REGOFF (18), REGOFF (17),
+ REGOFF (16), REGOFF (15), REGOFF (14), REGOFF (13), REGOFF (12), REGOFF (11),
REGOFF (10),
/* R13 - R25. */
@@ -62,12 +61,12 @@ static const int arc_linux_sc_reg_offsets[] = {
ARC_OFFSET_NO_REGISTER, ARC_OFFSET_NO_REGISTER, ARC_OFFSET_NO_REGISTER,
ARC_OFFSET_NO_REGISTER,
- REGOFF (9), /* R26 (GP) */
- REGOFF (8), /* FP */
- REGOFF (23), /* SP */
- ARC_OFFSET_NO_REGISTER, /* ILINK */
- ARC_OFFSET_NO_REGISTER, /* R30 */
- REGOFF (7), /* BLINK */
+ REGOFF (9), /* R26 (GP) */
+ REGOFF (8), /* FP */
+ REGOFF (23), /* SP */
+ ARC_OFFSET_NO_REGISTER, /* ILINK */
+ ARC_OFFSET_NO_REGISTER, /* R30 */
+ REGOFF (7), /* BLINK */
/* R32 - R59. */
ARC_OFFSET_NO_REGISTER, ARC_OFFSET_NO_REGISTER, ARC_OFFSET_NO_REGISTER,
@@ -81,16 +80,16 @@ static const int arc_linux_sc_reg_offsets[] = {
ARC_OFFSET_NO_REGISTER, ARC_OFFSET_NO_REGISTER, ARC_OFFSET_NO_REGISTER,
ARC_OFFSET_NO_REGISTER,
- REGOFF (4), /* LP_COUNT */
- ARC_OFFSET_NO_REGISTER, /* RESERVED */
- ARC_OFFSET_NO_REGISTER, /* LIMM */
- ARC_OFFSET_NO_REGISTER, /* PCL */
+ REGOFF (4), /* LP_COUNT */
+ ARC_OFFSET_NO_REGISTER, /* RESERVED */
+ ARC_OFFSET_NO_REGISTER, /* LIMM */
+ ARC_OFFSET_NO_REGISTER, /* PCL */
- REGOFF (6), /* PC */
- REGOFF (5), /* STATUS32 */
- REGOFF (2), /* LP_START */
- REGOFF (3), /* LP_END */
- REGOFF (1), /* BTA */
+ REGOFF (6), /* PC */
+ REGOFF (5), /* STATUS32 */
+ REGOFF (2), /* LP_START */
+ REGOFF (3), /* LP_END */
+ REGOFF (1), /* BTA */
};
/* arc_linux_core_reg_offsets[i] is the offset in the .reg section of GDB
@@ -104,23 +103,21 @@ static const int arc_linux_sc_reg_offsets[] = {
here as well. */
static const int arc_linux_core_reg_offsets[] = {
/* R0 - R12. */
- REGOFF (22), REGOFF (21), REGOFF (20), REGOFF (19),
- REGOFF (18), REGOFF (17), REGOFF (16), REGOFF (15),
- REGOFF (14), REGOFF (13), REGOFF (12), REGOFF (11),
+ REGOFF (22), REGOFF (21), REGOFF (20), REGOFF (19), REGOFF (18), REGOFF (17),
+ REGOFF (16), REGOFF (15), REGOFF (14), REGOFF (13), REGOFF (12), REGOFF (11),
REGOFF (10),
/* R13 - R25. */
- REGOFF (37), REGOFF (36), REGOFF (35), REGOFF (34),
- REGOFF (33), REGOFF (32), REGOFF (31), REGOFF (30),
- REGOFF (29), REGOFF (28), REGOFF (27), REGOFF (26),
+ REGOFF (37), REGOFF (36), REGOFF (35), REGOFF (34), REGOFF (33), REGOFF (32),
+ REGOFF (31), REGOFF (30), REGOFF (29), REGOFF (28), REGOFF (27), REGOFF (26),
REGOFF (25),
- REGOFF (9), /* R26 (GP) */
- REGOFF (8), /* FP */
- REGOFF (23), /* SP */
- ARC_OFFSET_NO_REGISTER, /* ILINK */
- ARC_OFFSET_NO_REGISTER, /* R30 */
- REGOFF (7), /* BLINK */
+ REGOFF (9), /* R26 (GP) */
+ REGOFF (8), /* FP */
+ REGOFF (23), /* SP */
+ ARC_OFFSET_NO_REGISTER, /* ILINK */
+ ARC_OFFSET_NO_REGISTER, /* R30 */
+ REGOFF (7), /* BLINK */
/* R32 - R59. */
ARC_OFFSET_NO_REGISTER, ARC_OFFSET_NO_REGISTER, ARC_OFFSET_NO_REGISTER,
@@ -134,17 +131,17 @@ static const int arc_linux_core_reg_offsets[] = {
ARC_OFFSET_NO_REGISTER, ARC_OFFSET_NO_REGISTER, ARC_OFFSET_NO_REGISTER,
ARC_OFFSET_NO_REGISTER,
- REGOFF (4), /* LP_COUNT */
- ARC_OFFSET_NO_REGISTER, /* RESERVED */
- ARC_OFFSET_NO_REGISTER, /* LIMM */
- ARC_OFFSET_NO_REGISTER, /* PCL */
-
- REGOFF (39), /* PC */
- REGOFF (5), /* STATUS32 */
- REGOFF (2), /* LP_START */
- REGOFF (3), /* LP_END */
- REGOFF (1), /* BTA */
- REGOFF (6) /* ERET */
+ REGOFF (4), /* LP_COUNT */
+ ARC_OFFSET_NO_REGISTER, /* RESERVED */
+ ARC_OFFSET_NO_REGISTER, /* LIMM */
+ ARC_OFFSET_NO_REGISTER, /* PCL */
+
+ REGOFF (39), /* PC */
+ REGOFF (5), /* STATUS32 */
+ REGOFF (2), /* LP_START */
+ REGOFF (3), /* LP_END */
+ REGOFF (1), /* BTA */
+ REGOFF (6) /* ERET */
};
/* Is THIS_FRAME a sigtramp function - the function that returns from
@@ -164,15 +161,15 @@ arc_linux_is_sigtramp (frame_info_ptr this_frame)
struct gdbarch *gdbarch = get_frame_arch (this_frame);
CORE_ADDR pc = get_frame_pc (this_frame);
- arc_linux_debug_printf ("pc=%s", paddress(gdbarch, pc));
+ arc_linux_debug_printf ("pc=%s", paddress (gdbarch, pc));
static const gdb_byte insns_be_hs[] = {
- 0x20, 0x8a, 0x12, 0xc2, /* mov r8,nr_rt_sigreturn */
- 0x78, 0x1e /* trap_s 0 */
+ 0x20, 0x8a, 0x12, 0xc2, /* mov r8,nr_rt_sigreturn */
+ 0x78, 0x1e /* trap_s 0 */
};
static const gdb_byte insns_be_700[] = {
- 0x20, 0x8a, 0x12, 0xc2, /* mov r8,nr_rt_sigreturn */
- 0x22, 0x6f, 0x00, 0x3f /* swi */
+ 0x20, 0x8a, 0x12, 0xc2, /* mov r8,nr_rt_sigreturn */
+ 0x22, 0x6f, 0x00, 0x3f /* swi */
};
gdb_byte arc_sigtramp_insns[sizeof (insns_be_700)];
@@ -198,14 +195,14 @@ arc_linux_is_sigtramp (frame_info_ptr this_frame)
4-byte instruction or 2-byte. */
gdb_assert ((insns_sz % 2) == 0);
for (int i = 0; i < insns_sz; i += 2)
- std::swap (arc_sigtramp_insns[i], arc_sigtramp_insns[i+1]);
+ std::swap (arc_sigtramp_insns[i], arc_sigtramp_insns[i + 1]);
}
gdb_byte buf[insns_sz];
/* Read the memory at the PC. Since we are stopped, any breakpoint must
have been removed. */
- if (!safe_frame_unwind_memory (this_frame, pc, {buf, insns_sz}))
+ if (!safe_frame_unwind_memory (this_frame, pc, { buf, insns_sz }))
{
/* Failed to unwind frame. */
return FALSE;
@@ -216,7 +213,7 @@ arc_linux_is_sigtramp (frame_info_ptr this_frame)
return TRUE;
/* No - look one instruction earlier in the code... */
- if (!safe_frame_unwind_memory (this_frame, pc - 4, {buf, insns_sz}))
+ if (!safe_frame_unwind_memory (this_frame, pc - 4, { buf, insns_sz }))
{
/* Failed to unwind frame. */
return FALSE;
@@ -310,7 +307,7 @@ arc_linux_cannot_store_register (struct gdbarch *gdbarch, int regnum)
static const gdb_byte arc_linux_trap_s_be[] = { 0x78, 0x3e };
static const gdb_byte arc_linux_trap_s_le[] = { 0x3e, 0x78 };
-static const int trap_size = 2; /* Number of bytes to insert "trap". */
+static const int trap_size = 2; /* Number of bytes to insert "trap". */
/* Implement the "breakpoint_kind_from_pc" gdbarch method. */
@@ -323,14 +320,14 @@ arc_linux_breakpoint_kind_from_pc (struct gdbarch *gdbarch, CORE_ADDR *pcptr)
/* Implement the "sw_breakpoint_from_kind" gdbarch method. */
static const gdb_byte *
-arc_linux_sw_breakpoint_from_kind (struct gdbarch *gdbarch,
- int kind, int *size)
+arc_linux_sw_breakpoint_from_kind (struct gdbarch *gdbarch, int kind,
+ int *size)
{
gdb_assert (kind == trap_size);
*size = kind;
return ((gdbarch_byte_order (gdbarch) == BFD_ENDIAN_BIG)
- ? arc_linux_trap_s_be
- : arc_linux_trap_s_le);
+ ? arc_linux_trap_s_be
+ : arc_linux_trap_s_le);
}
/* Check for an atomic sequence of instructions beginning with an
@@ -358,7 +355,7 @@ arc_linux_sw_breakpoint_from_kind (struct gdbarch *gdbarch,
static std::vector<CORE_ADDR>
handle_atomic_sequence (arc_instruction insn, disassemble_info *di)
{
- const int atomic_seq_len = 24; /* Instruction sequence length. */
+ const int atomic_seq_len = 24; /* Instruction sequence length. */
std::vector<CORE_ADDR> next_pcs;
/* Sanity check. */
@@ -373,27 +370,27 @@ handle_atomic_sequence (arc_instruction insn, disassemble_info *di)
for (int insn_count = 0; insn_count < atomic_seq_len; ++insn_count)
{
- arc_insn_decode (arc_insn_get_linear_next_pc (insn),
- di, arc_delayed_print_insn, &insn);
+ arc_insn_decode (arc_insn_get_linear_next_pc (insn), di,
+ arc_delayed_print_insn, &insn);
if (insn.insn_class == BRCC)
- {
- /* If more than one conditional branch is found, this is not
+ {
+ /* If more than one conditional branch is found, this is not
the pattern we are interested in. */
- if (found_bc)
+ if (found_bc)
break;
found_bc = true;
continue;
- }
+ }
/* This is almost a happy ending. */
if (insn.insn_class == SCOND)
- {
+ {
/* SCOND should match the LLOCK's data size. */
if (insn.data_size_mode == llock_data_size_mode)
is_pattern_valid = true;
break;
- }
+ }
}
if (is_pattern_valid)
@@ -546,8 +543,8 @@ supply_register (struct regcache *regcache, int regnum, const gdb_byte *buf)
void
arc_linux_supply_gregset (const struct regset *regset,
- struct regcache *regcache,
- int regnum, const void *gregs, size_t size)
+ struct regcache *regcache, int regnum,
+ const void *gregs, size_t size)
{
gdb_static_assert (ARC_LAST_REGNUM
< ARRAY_SIZE (arc_linux_core_reg_offsets));
@@ -609,8 +606,8 @@ collect_register (const struct regcache *regcache, struct gdbarch *gdbarch,
void
arc_linux_collect_gregset (const struct regset *regset,
- const struct regcache *regcache,
- int regnum, void *gregs, size_t size)
+ const struct regcache *regcache, int regnum,
+ void *gregs, size_t size)
{
gdb_static_assert (ARC_LAST_REGNUM
< ARRAY_SIZE (arc_linux_core_reg_offsets));
@@ -680,12 +677,10 @@ arc_linux_iterate_over_regset_sections (struct gdbarch *gdbarch,
static const struct target_desc *
arc_linux_core_read_description (struct gdbarch *gdbarch,
- struct target_ops *target,
- bfd *abfd)
+ struct target_ops *target, bfd *abfd)
{
arc_arch_features features
- = arc_arch_features_create (abfd,
- gdbarch_bfd_arch_info (gdbarch)->mach);
+ = arc_arch_features_create (abfd, gdbarch_bfd_arch_info (gdbarch)->mach);
return arc_lookup_target_description (features);
}
@@ -727,8 +722,8 @@ arc_linux_init_osabi (struct gdbarch_info info, struct gdbarch *gdbarch)
set_gdbarch_software_single_step (gdbarch, arc_linux_software_single_step);
set_gdbarch_skip_trampoline_code (gdbarch, find_solib_trampoline_target);
set_gdbarch_skip_solib_resolver (gdbarch, arc_linux_skip_solib_resolver);
- set_gdbarch_iterate_over_regset_sections
- (gdbarch, arc_linux_iterate_over_regset_sections);
+ set_gdbarch_iterate_over_regset_sections (
+ gdbarch, arc_linux_iterate_over_regset_sections);
set_gdbarch_core_read_description (gdbarch, arc_linux_core_read_description);
/* GNU/Linux uses SVR4-style shared libraries, with 32-bit ints, longs
diff --git a/gdb/arc-linux-tdep.h b/gdb/arc-linux-tdep.h
index a7f510ab608..99ab1ee92f6 100644
--- a/gdb/arc-linux-tdep.h
+++ b/gdb/arc-linux-tdep.h
@@ -40,13 +40,13 @@ void arc_linux_supply_v2_regset (const struct regset *regset,
/* Writes registers from the regcache into the NT_PRSTATUS data array. */
void arc_linux_collect_gregset (const struct regset *regset,
- const struct regcache *regcache,
- int regnum, void *gregs, size_t size);
+ const struct regcache *regcache, int regnum,
+ void *gregs, size_t size);
/* Writes registers from the regcache into the NT_ARC_V2 data array. */
void arc_linux_collect_v2_regset (const struct regset *regset,
- const struct regcache *regcache,
- int regnum, void *v2_regs, size_t size);
+ const struct regcache *regcache, int regnum,
+ void *v2_regs, size_t size);
#endif /* ARC_LINUX_TDEP_H */
diff --git a/gdb/arc-newlib-tdep.c b/gdb/arc-newlib-tdep.c
index ee203a0c59f..0488341ab71 100644
--- a/gdb/arc-newlib-tdep.c
+++ b/gdb/arc-newlib-tdep.c
@@ -60,6 +60,7 @@ arc_newlib_osabi_sniffer (bfd *abfd)
}
void _initialize_arc_newlib_tdep ();
+
void
_initialize_arc_newlib_tdep ()
{
diff --git a/gdb/arc-tdep.c b/gdb/arc-tdep.c
index c232eb98432..c8e69c0ad03 100644
--- a/gdb/arc-tdep.c
+++ b/gdb/arc-tdep.c
@@ -138,165 +138,153 @@ static const char *ARC_AUX_FEATURE_NAME = "org.gnu.gdb.arc.aux";
/* ARCv1 (ARC600, ARC601, ARC700) general core registers feature set.
See also arc_update_acc_reg_names() for "accl/acch" names. */
-static struct arc_register_feature arc_v1_core_reg_feature =
-{
- ARC_CORE_FEATURE_NAME,
- {
- { ARC_R0_REGNUM + 0, { "r0" }, true },
- { ARC_R0_REGNUM + 1, { "r1" }, true },
- { ARC_R0_REGNUM + 2, { "r2" }, true },
- { ARC_R0_REGNUM + 3, { "r3" }, true },
- { ARC_R0_REGNUM + 4, { "r4" }, false },
- { ARC_R0_REGNUM + 5, { "r5" }, false },
- { ARC_R0_REGNUM + 6, { "r6" }, false },
- { ARC_R0_REGNUM + 7, { "r7" }, false },
- { ARC_R0_REGNUM + 8, { "r8" }, false },
- { ARC_R0_REGNUM + 9, { "r9" }, false },
- { ARC_R0_REGNUM + 10, { "r10" }, true },
- { ARC_R0_REGNUM + 11, { "r11" }, true },
- { ARC_R0_REGNUM + 12, { "r12" }, true },
- { ARC_R0_REGNUM + 13, { "r13" }, true },
- { ARC_R0_REGNUM + 14, { "r14" }, true },
- { ARC_R0_REGNUM + 15, { "r15" }, true },
- { ARC_R0_REGNUM + 16, { "r16" }, false },
- { ARC_R0_REGNUM + 17, { "r17" }, false },
- { ARC_R0_REGNUM + 18, { "r18" }, false },
- { ARC_R0_REGNUM + 19, { "r19" }, false },
- { ARC_R0_REGNUM + 20, { "r20" }, false },
- { ARC_R0_REGNUM + 21, { "r21" }, false },
- { ARC_R0_REGNUM + 22, { "r22" }, false },
- { ARC_R0_REGNUM + 23, { "r23" }, false },
- { ARC_R0_REGNUM + 24, { "r24" }, false },
- { ARC_R0_REGNUM + 25, { "r25" }, false },
- { ARC_R0_REGNUM + 26, { "gp" }, true },
- { ARC_R0_REGNUM + 27, { "fp" }, true },
- { ARC_R0_REGNUM + 28, { "sp" }, true },
- { ARC_R0_REGNUM + 29, { "ilink1" }, false },
- { ARC_R0_REGNUM + 30, { "ilink2" }, false },
- { ARC_R0_REGNUM + 31, { "blink" }, true },
- { ARC_R0_REGNUM + 32, { "r32" }, false },
- { ARC_R0_REGNUM + 33, { "r33" }, false },
- { ARC_R0_REGNUM + 34, { "r34" }, false },
- { ARC_R0_REGNUM + 35, { "r35" }, false },
- { ARC_R0_REGNUM + 36, { "r36" }, false },
- { ARC_R0_REGNUM + 37, { "r37" }, false },
- { ARC_R0_REGNUM + 38, { "r38" }, false },
- { ARC_R0_REGNUM + 39, { "r39" }, false },
- { ARC_R0_REGNUM + 40, { "r40" }, false },
- { ARC_R0_REGNUM + 41, { "r41" }, false },
- { ARC_R0_REGNUM + 42, { "r42" }, false },
- { ARC_R0_REGNUM + 43, { "r43" }, false },
- { ARC_R0_REGNUM + 44, { "r44" }, false },
- { ARC_R0_REGNUM + 45, { "r45" }, false },
- { ARC_R0_REGNUM + 46, { "r46" }, false },
- { ARC_R0_REGNUM + 47, { "r47" }, false },
- { ARC_R0_REGNUM + 48, { "r48" }, false },
- { ARC_R0_REGNUM + 49, { "r49" }, false },
- { ARC_R0_REGNUM + 50, { "r50" }, false },
- { ARC_R0_REGNUM + 51, { "r51" }, false },
- { ARC_R0_REGNUM + 52, { "r52" }, false },
- { ARC_R0_REGNUM + 53, { "r53" }, false },
- { ARC_R0_REGNUM + 54, { "r54" }, false },
- { ARC_R0_REGNUM + 55, { "r55" }, false },
- { ARC_R0_REGNUM + 56, { "r56" }, false },
- { ARC_R0_REGNUM + 57, { "r57" }, false },
- { ARC_R0_REGNUM + 58, { "r58", "accl" }, false },
- { ARC_R0_REGNUM + 59, { "r59", "acch" }, false },
- { ARC_R0_REGNUM + 60, { "lp_count" }, false },
- { ARC_R0_REGNUM + 61, { "reserved" }, false },
- { ARC_R0_REGNUM + 62, { "limm" }, false },
- { ARC_R0_REGNUM + 63, { "pcl" }, true }
- }
-};
+static struct arc_register_feature arc_v1_core_reg_feature
+ = { ARC_CORE_FEATURE_NAME,
+ { { ARC_R0_REGNUM + 0, { "r0" }, true },
+ { ARC_R0_REGNUM + 1, { "r1" }, true },
+ { ARC_R0_REGNUM + 2, { "r2" }, true },
+ { ARC_R0_REGNUM + 3, { "r3" }, true },
+ { ARC_R0_REGNUM + 4, { "r4" }, false },
+ { ARC_R0_REGNUM + 5, { "r5" }, false },
+ { ARC_R0_REGNUM + 6, { "r6" }, false },
+ { ARC_R0_REGNUM + 7, { "r7" }, false },
+ { ARC_R0_REGNUM + 8, { "r8" }, false },
+ { ARC_R0_REGNUM + 9, { "r9" }, false },
+ { ARC_R0_REGNUM + 10, { "r10" }, true },
+ { ARC_R0_REGNUM + 11, { "r11" }, true },
+ { ARC_R0_REGNUM + 12, { "r12" }, true },
+ { ARC_R0_REGNUM + 13, { "r13" }, true },
+ { ARC_R0_REGNUM + 14, { "r14" }, true },
+ { ARC_R0_REGNUM + 15, { "r15" }, true },
+ { ARC_R0_REGNUM + 16, { "r16" }, false },
+ { ARC_R0_REGNUM + 17, { "r17" }, false },
+ { ARC_R0_REGNUM + 18, { "r18" }, false },
+ { ARC_R0_REGNUM + 19, { "r19" }, false },
+ { ARC_R0_REGNUM + 20, { "r20" }, false },
+ { ARC_R0_REGNUM + 21, { "r21" }, false },
+ { ARC_R0_REGNUM + 22, { "r22" }, false },
+ { ARC_R0_REGNUM + 23, { "r23" }, false },
+ { ARC_R0_REGNUM + 24, { "r24" }, false },
+ { ARC_R0_REGNUM + 25, { "r25" }, false },
+ { ARC_R0_REGNUM + 26, { "gp" }, true },
+ { ARC_R0_REGNUM + 27, { "fp" }, true },
+ { ARC_R0_REGNUM + 28, { "sp" }, true },
+ { ARC_R0_REGNUM + 29, { "ilink1" }, false },
+ { ARC_R0_REGNUM + 30, { "ilink2" }, false },
+ { ARC_R0_REGNUM + 31, { "blink" }, true },
+ { ARC_R0_REGNUM + 32, { "r32" }, false },
+ { ARC_R0_REGNUM + 33, { "r33" }, false },
+ { ARC_R0_REGNUM + 34, { "r34" }, false },
+ { ARC_R0_REGNUM + 35, { "r35" }, false },
+ { ARC_R0_REGNUM + 36, { "r36" }, false },
+ { ARC_R0_REGNUM + 37, { "r37" }, false },
+ { ARC_R0_REGNUM + 38, { "r38" }, false },
+ { ARC_R0_REGNUM + 39, { "r39" }, false },
+ { ARC_R0_REGNUM + 40, { "r40" }, false },
+ { ARC_R0_REGNUM + 41, { "r41" }, false },
+ { ARC_R0_REGNUM + 42, { "r42" }, false },
+ { ARC_R0_REGNUM + 43, { "r43" }, false },
+ { ARC_R0_REGNUM + 44, { "r44" }, false },
+ { ARC_R0_REGNUM + 45, { "r45" }, false },
+ { ARC_R0_REGNUM + 46, { "r46" }, false },
+ { ARC_R0_REGNUM + 47, { "r47" }, false },
+ { ARC_R0_REGNUM + 48, { "r48" }, false },
+ { ARC_R0_REGNUM + 49, { "r49" }, false },
+ { ARC_R0_REGNUM + 50, { "r50" }, false },
+ { ARC_R0_REGNUM + 51, { "r51" }, false },
+ { ARC_R0_REGNUM + 52, { "r52" }, false },
+ { ARC_R0_REGNUM + 53, { "r53" }, false },
+ { ARC_R0_REGNUM + 54, { "r54" }, false },
+ { ARC_R0_REGNUM + 55, { "r55" }, false },
+ { ARC_R0_REGNUM + 56, { "r56" }, false },
+ { ARC_R0_REGNUM + 57, { "r57" }, false },
+ { ARC_R0_REGNUM + 58, { "r58", "accl" }, false },
+ { ARC_R0_REGNUM + 59, { "r59", "acch" }, false },
+ { ARC_R0_REGNUM + 60, { "lp_count" }, false },
+ { ARC_R0_REGNUM + 61, { "reserved" }, false },
+ { ARC_R0_REGNUM + 62, { "limm" }, false },
+ { ARC_R0_REGNUM + 63, { "pcl" }, true } } };
/* ARCv2 (ARCHS) general core registers feature set. See also
arc_update_acc_reg_names() for "accl/acch" names. */
-static struct arc_register_feature arc_v2_core_reg_feature =
-{
- ARC_CORE_FEATURE_NAME,
- {
- { ARC_R0_REGNUM + 0, { "r0" }, true },
- { ARC_R0_REGNUM + 1, { "r1" }, true },
- { ARC_R0_REGNUM + 2, { "r2" }, true },
- { ARC_R0_REGNUM + 3, { "r3" }, true },
- { ARC_R0_REGNUM + 4, { "r4" }, false },
- { ARC_R0_REGNUM + 5, { "r5" }, false },
- { ARC_R0_REGNUM + 6, { "r6" }, false },
- { ARC_R0_REGNUM + 7, { "r7" }, false },
- { ARC_R0_REGNUM + 8, { "r8" }, false },
- { ARC_R0_REGNUM + 9, { "r9" }, false },
- { ARC_R0_REGNUM + 10, { "r10" }, true },
- { ARC_R0_REGNUM + 11, { "r11" }, true },
- { ARC_R0_REGNUM + 12, { "r12" }, true },
- { ARC_R0_REGNUM + 13, { "r13" }, true },
- { ARC_R0_REGNUM + 14, { "r14" }, true },
- { ARC_R0_REGNUM + 15, { "r15" }, true },
- { ARC_R0_REGNUM + 16, { "r16" }, false },
- { ARC_R0_REGNUM + 17, { "r17" }, false },
- { ARC_R0_REGNUM + 18, { "r18" }, false },
- { ARC_R0_REGNUM + 19, { "r19" }, false },
- { ARC_R0_REGNUM + 20, { "r20" }, false },
- { ARC_R0_REGNUM + 21, { "r21" }, false },
- { ARC_R0_REGNUM + 22, { "r22" }, false },
- { ARC_R0_REGNUM + 23, { "r23" }, false },
- { ARC_R0_REGNUM + 24, { "r24" }, false },
- { ARC_R0_REGNUM + 25, { "r25" }, false },
- { ARC_R0_REGNUM + 26, { "gp" }, true },
- { ARC_R0_REGNUM + 27, { "fp" }, true },
- { ARC_R0_REGNUM + 28, { "sp" }, true },
- { ARC_R0_REGNUM + 29, { "ilink" }, false },
- { ARC_R0_REGNUM + 30, { "r30" }, true },
- { ARC_R0_REGNUM + 31, { "blink" }, true },
- { ARC_R0_REGNUM + 32, { "r32" }, false },
- { ARC_R0_REGNUM + 33, { "r33" }, false },
- { ARC_R0_REGNUM + 34, { "r34" }, false },
- { ARC_R0_REGNUM + 35, { "r35" }, false },
- { ARC_R0_REGNUM + 36, { "r36" }, false },
- { ARC_R0_REGNUM + 37, { "r37" }, false },
- { ARC_R0_REGNUM + 38, { "r38" }, false },
- { ARC_R0_REGNUM + 39, { "r39" }, false },
- { ARC_R0_REGNUM + 40, { "r40" }, false },
- { ARC_R0_REGNUM + 41, { "r41" }, false },
- { ARC_R0_REGNUM + 42, { "r42" }, false },
- { ARC_R0_REGNUM + 43, { "r43" }, false },
- { ARC_R0_REGNUM + 44, { "r44" }, false },
- { ARC_R0_REGNUM + 45, { "r45" }, false },
- { ARC_R0_REGNUM + 46, { "r46" }, false },
- { ARC_R0_REGNUM + 47, { "r47" }, false },
- { ARC_R0_REGNUM + 48, { "r48" }, false },
- { ARC_R0_REGNUM + 49, { "r49" }, false },
- { ARC_R0_REGNUM + 50, { "r50" }, false },
- { ARC_R0_REGNUM + 51, { "r51" }, false },
- { ARC_R0_REGNUM + 52, { "r52" }, false },
- { ARC_R0_REGNUM + 53, { "r53" }, false },
- { ARC_R0_REGNUM + 54, { "r54" }, false },
- { ARC_R0_REGNUM + 55, { "r55" }, false },
- { ARC_R0_REGNUM + 56, { "r56" }, false },
- { ARC_R0_REGNUM + 57, { "r57" }, false },
- { ARC_R0_REGNUM + 58, { "r58", "accl" }, false },
- { ARC_R0_REGNUM + 59, { "r59", "acch" }, false },
- { ARC_R0_REGNUM + 60, { "lp_count" }, false },
- { ARC_R0_REGNUM + 61, { "reserved" }, false },
- { ARC_R0_REGNUM + 62, { "limm" }, false },
- { ARC_R0_REGNUM + 63, { "pcl" }, true }
- }
-};
+static struct arc_register_feature arc_v2_core_reg_feature
+ = { ARC_CORE_FEATURE_NAME,
+ { { ARC_R0_REGNUM + 0, { "r0" }, true },
+ { ARC_R0_REGNUM + 1, { "r1" }, true },
+ { ARC_R0_REGNUM + 2, { "r2" }, true },
+ { ARC_R0_REGNUM + 3, { "r3" }, true },
+ { ARC_R0_REGNUM + 4, { "r4" }, false },
+ { ARC_R0_REGNUM + 5, { "r5" }, false },
+ { ARC_R0_REGNUM + 6, { "r6" }, false },
+ { ARC_R0_REGNUM + 7, { "r7" }, false },
+ { ARC_R0_REGNUM + 8, { "r8" }, false },
+ { ARC_R0_REGNUM + 9, { "r9" }, false },
+ { ARC_R0_REGNUM + 10, { "r10" }, true },
+ { ARC_R0_REGNUM + 11, { "r11" }, true },
+ { ARC_R0_REGNUM + 12, { "r12" }, true },
+ { ARC_R0_REGNUM + 13, { "r13" }, true },
+ { ARC_R0_REGNUM + 14, { "r14" }, true },
+ { ARC_R0_REGNUM + 15, { "r15" }, true },
+ { ARC_R0_REGNUM + 16, { "r16" }, false },
+ { ARC_R0_REGNUM + 17, { "r17" }, false },
+ { ARC_R0_REGNUM + 18, { "r18" }, false },
+ { ARC_R0_REGNUM + 19, { "r19" }, false },
+ { ARC_R0_REGNUM + 20, { "r20" }, false },
+ { ARC_R0_REGNUM + 21, { "r21" }, false },
+ { ARC_R0_REGNUM + 22, { "r22" }, false },
+ { ARC_R0_REGNUM + 23, { "r23" }, false },
+ { ARC_R0_REGNUM + 24, { "r24" }, false },
+ { ARC_R0_REGNUM + 25, { "r25" }, false },
+ { ARC_R0_REGNUM + 26, { "gp" }, true },
+ { ARC_R0_REGNUM + 27, { "fp" }, true },
+ { ARC_R0_REGNUM + 28, { "sp" }, true },
+ { ARC_R0_REGNUM + 29, { "ilink" }, false },
+ { ARC_R0_REGNUM + 30, { "r30" }, true },
+ { ARC_R0_REGNUM + 31, { "blink" }, true },
+ { ARC_R0_REGNUM + 32, { "r32" }, false },
+ { ARC_R0_REGNUM + 33, { "r33" }, false },
+ { ARC_R0_REGNUM + 34, { "r34" }, false },
+ { ARC_R0_REGNUM + 35, { "r35" }, false },
+ { ARC_R0_REGNUM + 36, { "r36" }, false },
+ { ARC_R0_REGNUM + 37, { "r37" }, false },
+ { ARC_R0_REGNUM + 38, { "r38" }, false },
+ { ARC_R0_REGNUM + 39, { "r39" }, false },
+ { ARC_R0_REGNUM + 40, { "r40" }, false },
+ { ARC_R0_REGNUM + 41, { "r41" }, false },
+ { ARC_R0_REGNUM + 42, { "r42" }, false },
+ { ARC_R0_REGNUM + 43, { "r43" }, false },
+ { ARC_R0_REGNUM + 44, { "r44" }, false },
+ { ARC_R0_REGNUM + 45, { "r45" }, false },
+ { ARC_R0_REGNUM + 46, { "r46" }, false },
+ { ARC_R0_REGNUM + 47, { "r47" }, false },
+ { ARC_R0_REGNUM + 48, { "r48" }, false },
+ { ARC_R0_REGNUM + 49, { "r49" }, false },
+ { ARC_R0_REGNUM + 50, { "r50" }, false },
+ { ARC_R0_REGNUM + 51, { "r51" }, false },
+ { ARC_R0_REGNUM + 52, { "r52" }, false },
+ { ARC_R0_REGNUM + 53, { "r53" }, false },
+ { ARC_R0_REGNUM + 54, { "r54" }, false },
+ { ARC_R0_REGNUM + 55, { "r55" }, false },
+ { ARC_R0_REGNUM + 56, { "r56" }, false },
+ { ARC_R0_REGNUM + 57, { "r57" }, false },
+ { ARC_R0_REGNUM + 58, { "r58", "accl" }, false },
+ { ARC_R0_REGNUM + 59, { "r59", "acch" }, false },
+ { ARC_R0_REGNUM + 60, { "lp_count" }, false },
+ { ARC_R0_REGNUM + 61, { "reserved" }, false },
+ { ARC_R0_REGNUM + 62, { "limm" }, false },
+ { ARC_R0_REGNUM + 63, { "pcl" }, true } } };
/* The common auxiliary registers feature set. The REGNUM field
must match the ARC_REGNUM enum in arc-tdep.h. */
-static const struct arc_register_feature arc_common_aux_reg_feature =
-{
- ARC_AUX_FEATURE_NAME,
- {
- { ARC_FIRST_AUX_REGNUM + 0, { "pc" }, true },
- { ARC_FIRST_AUX_REGNUM + 1, { "status32" }, true },
- { ARC_FIRST_AUX_REGNUM + 2, { "lp_start" }, false },
- { ARC_FIRST_AUX_REGNUM + 3, { "lp_end" }, false },
- { ARC_FIRST_AUX_REGNUM + 4, { "bta" }, false }
- }
-};
+static const struct arc_register_feature arc_common_aux_reg_feature
+ = { ARC_AUX_FEATURE_NAME,
+ { { ARC_FIRST_AUX_REGNUM + 0, { "pc" }, true },
+ { ARC_FIRST_AUX_REGNUM + 1, { "status32" }, true },
+ { ARC_FIRST_AUX_REGNUM + 2, { "lp_start" }, false },
+ { ARC_FIRST_AUX_REGNUM + 3, { "lp_end" }, false },
+ { ARC_FIRST_AUX_REGNUM + 4, { "bta" }, false } } };
static char *arc_disassembler_options = NULL;
@@ -324,8 +312,7 @@ arc_insn_get_operand_value (const struct arc_instruction &insn,
struct regcache *regcache = get_current_regcache ();
ULONGEST value;
regcache_cooked_read_unsigned (regcache,
- insn.operands[operand_num].value,
- &value);
+ insn.operands[operand_num].value, &value);
return value;
}
}
@@ -352,8 +339,7 @@ arc_insn_get_operand_value_signed (const struct arc_instruction &insn,
/* Value in instruction is a register number. */
struct regcache *regcache = get_current_regcache ();
LONGEST value;
- regcache_cooked_read_signed (regcache,
- insn.operands[operand_num].value,
+ regcache_cooked_read_signed (regcache, insn.operands[operand_num].value,
&value);
return value;
}
@@ -441,8 +427,7 @@ arc_insn_get_branch_target (const struct arc_instruction &insn)
}
else if (insn.insn_class == EI)
{
- gdb_printf (gdb_stderr,
- "EI_S instruction is not supported by the GDB.");
+ gdb_printf (gdb_stderr, "EI_S instruction is not supported by the GDB.");
return 0;
}
/* LEAVE_S: PC = BLINK. */
@@ -602,8 +587,7 @@ arc_write_pc (struct regcache *regcache, CORE_ADDR new_pc)
{
struct gdbarch *gdbarch = regcache->arch ();
- arc_debug_printf ("Writing PC, new value=%s",
- paddress (gdbarch, new_pc));
+ arc_debug_printf ("Writing PC, new value=%s", paddress (gdbarch, new_pc));
regcache_cooked_write_unsigned (regcache, gdbarch_pc_regnum (gdbarch),
new_pc);
@@ -650,8 +634,8 @@ arc_write_pc (struct regcache *regcache, CORE_ADDR new_pc)
virtual FP. */
static void
-arc_virtual_frame_pointer (struct gdbarch *gdbarch, CORE_ADDR pc,
- int *reg_ptr, LONGEST *offset_ptr)
+arc_virtual_frame_pointer (struct gdbarch *gdbarch, CORE_ADDR pc, int *reg_ptr,
+ LONGEST *offset_ptr)
{
*reg_ptr = gdbarch_sp_regnum (gdbarch);
*offset_ptr = 0;
@@ -780,9 +764,8 @@ arc_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
unsigned int space = align_up (len, 4);
memcpy (data, value_contents (args[i]).data (), (size_t) len);
- arc_debug_printf ("copying arg %d, val 0x%08x, len %d to mem",
- i, *((int *) value_contents (args[i]).data ()),
- len);
+ arc_debug_printf ("copying arg %d, val 0x%08x, len %d to mem", i,
+ *((int *) value_contents (args[i]).data ()), len);
data += space;
}
@@ -916,8 +899,8 @@ arc_extract_return_value (struct gdbarch *gdbarch, struct type *type,
/* Get the return value from one register. */
regcache_cooked_read_unsigned (regcache, ARC_R0_REGNUM, &val);
- store_unsigned_integer (valbuf, (int) len,
- gdbarch_byte_order (gdbarch), val);
+ store_unsigned_integer (valbuf, (int) len, gdbarch_byte_order (gdbarch),
+ val);
arc_debug_printf ("returning 0x%s", phex (val, ARC_REGISTER_SIZE));
}
@@ -935,15 +918,13 @@ arc_extract_return_value (struct gdbarch *gdbarch, struct type *type,
(int) len - ARC_REGISTER_SIZE,
gdbarch_byte_order (gdbarch), high);
- arc_debug_printf ("returning 0x%s%s",
- phex (high, ARC_REGISTER_SIZE),
+ arc_debug_printf ("returning 0x%s%s", phex (high, ARC_REGISTER_SIZE),
phex (low, ARC_REGISTER_SIZE));
}
else
- error (_("arc: extract_return_value: type length %u too large"), len);
+ error (_ ("arc: extract_return_value: type length %u too large"), len);
}
-
/* Store the return value of a function into the registers/memory used to
return it, according to the convention used by the ABI.
@@ -986,12 +967,11 @@ arc_store_return_value (struct gdbarch *gdbarch, struct type *type,
regcache_cooked_write_unsigned (regcache, ARC_R0_REGNUM, low);
regcache_cooked_write_unsigned (regcache, ARC_R1_REGNUM, high);
- arc_debug_printf ("storing 0x%s%s",
- phex (high, ARC_REGISTER_SIZE),
+ arc_debug_printf ("storing 0x%s%s", phex (high, ARC_REGISTER_SIZE),
phex (low, ARC_REGISTER_SIZE));
}
else
- error (_("arc_store_return_value: type length too large."));
+ error (_ ("arc_store_return_value: type length too large."));
}
/* Implement the "get_longjmp_target" gdbarch method. */
@@ -1005,7 +985,8 @@ arc_get_longjmp_target (frame_info_ptr frame, CORE_ADDR *pc)
arc_gdbarch_tdep *tdep = gdbarch_tdep<arc_gdbarch_tdep> (gdbarch);
int pc_offset = tdep->jb_pc * ARC_REGISTER_SIZE;
gdb_byte buf[ARC_REGISTER_SIZE];
- CORE_ADDR jb_addr = get_frame_register_unsigned (frame, ARC_FIRST_ARG_REGNUM);
+ CORE_ADDR jb_addr
+ = get_frame_register_unsigned (frame, ARC_FIRST_ARG_REGNUM);
if (target_read_memory (jb_addr + pc_offset, buf, ARC_REGISTER_SIZE))
return 0; /* Failed to read from memory. */
@@ -1052,9 +1033,8 @@ arc_return_value (struct gdbarch *gdbarch, struct value *function,
arc_extract_return_value (gdbarch, valtype, regcache, readbuf);
}
- return (is_struct_return
- ? RETURN_VALUE_STRUCT_CONVENTION
- : RETURN_VALUE_REGISTER_CONVENTION);
+ return (is_struct_return ? RETURN_VALUE_STRUCT_CONVENTION
+ : RETURN_VALUE_REGISTER_CONVENTION);
}
/* Return the base address of the frame. For ARC, the base address is the
@@ -1070,7 +1050,8 @@ arc_frame_base_address (frame_info_ptr this_frame, void **prologue_cache)
either a register or a constant. */
static pv_t
-arc_pv_get_operand (pv_t *regs, const struct arc_instruction &insn, int operand)
+arc_pv_get_operand (pv_t *regs, const struct arc_instruction &insn,
+ int operand)
{
if (insn.operands[operand].kind == ARC_OPERAND_KIND_REG)
return regs[insn.operands[operand].value];
@@ -1083,8 +1064,9 @@ arc_pv_get_operand (pv_t *regs, const struct arc_instruction &insn, int operand)
be updated. */
static bool
-arc_is_in_prologue (struct gdbarch *gdbarch, const struct arc_instruction &insn,
- pv_t *regs, struct pv_area *stack)
+arc_is_in_prologue (struct gdbarch *gdbarch,
+ const struct arc_instruction &insn, pv_t *regs,
+ struct pv_area *stack)
{
/* It might be that currently analyzed address doesn't contain an
instruction, hence INSN is not valid. It likely means that address points
@@ -1240,20 +1222,20 @@ arc_is_in_prologue (struct gdbarch *gdbarch, const struct arc_instruction &insn,
bool is_fp_saved;
if (insn.operands_count > 1)
- is_fp_saved = (insn.operands[1].value == ARC_FP_REGNUM);
+ is_fp_saved = (insn.operands[1].value == ARC_FP_REGNUM);
else
is_fp_saved = false;
bool is_blink_saved;
if (insn.operands_count > 1)
- is_blink_saved = (insn.operands[insn.operands_count - 1].value
- == ARC_BLINK_REGNUM);
+ is_blink_saved
+ = (insn.operands[insn.operands_count - 1].value == ARC_BLINK_REGNUM);
else
is_blink_saved = false;
/* Amount of bytes to be allocated to store specified registers. */
- CORE_ADDR st_size = ((regs_saved + is_fp_saved + is_blink_saved)
- * ARC_REGISTER_SIZE);
+ CORE_ADDR st_size
+ = ((regs_saved + is_fp_saved + is_blink_saved) * ARC_REGISTER_SIZE);
pv_t new_sp = pv_add_constant (regs[ARC_SP_REGNUM], -st_size);
/* Assume that if the last register (closest to new SP) can be written,
@@ -1280,8 +1262,7 @@ arc_is_in_prologue (struct gdbarch *gdbarch, const struct arc_instruction &insn,
if (is_blink_saved)
{
addr = pv_add_constant (addr, -ARC_REGISTER_SIZE);
- stack->store (addr, ARC_REGISTER_SIZE,
- regs[ARC_BLINK_REGNUM]);
+ stack->store (addr, ARC_REGISTER_SIZE, regs[ARC_BLINK_REGNUM]);
}
gdb_assert (pv_is_identical (addr, new_sp));
@@ -1439,8 +1420,9 @@ arc_analyze_prologue (struct gdbarch *gdbarch, const CORE_ADDR entrypoint,
limit will be rarely reached. */
const static int MAX_PROLOGUE_LENGTH
- = 4 * (ARC_R25_REGNUM - ARC_R13_REGNUM + 1 + 2 + 1 + 6
- + ARC_LAST_ARG_REGNUM - ARC_FIRST_ARG_REGNUM + 1);
+ = 4
+ * (ARC_R25_REGNUM - ARC_R13_REGNUM + 1 + 2 + 1 + 6 + ARC_LAST_ARG_REGNUM
+ - ARC_FIRST_ARG_REGNUM + 1);
/* Implement the "skip_prologue" gdbarch method.
@@ -1460,8 +1442,7 @@ arc_skip_prologue (struct gdbarch *gdbarch, CORE_ADDR pc)
if (find_pc_partial_function (pc, &func_name, &func_addr, NULL))
{
/* Found a function. */
- CORE_ADDR postprologue_pc
- = skip_prologue_using_sal (gdbarch, func_addr);
+ CORE_ADDR postprologue_pc = skip_prologue_using_sal (gdbarch, func_addr);
if (postprologue_pc != 0)
return std::max (pc, postprologue_pc);
@@ -1597,15 +1578,13 @@ arc_sw_breakpoint_from_kind (struct gdbarch *gdbarch, int kind, int *size)
if (kind == sizeof (arc_brk_le))
{
- return ((gdbarch_byte_order (gdbarch) == BFD_ENDIAN_BIG)
- ? arc_brk_be
- : arc_brk_le);
+ return ((gdbarch_byte_order (gdbarch) == BFD_ENDIAN_BIG) ? arc_brk_be
+ : arc_brk_le);
}
else
{
- return ((gdbarch_byte_order (gdbarch) == BFD_ENDIAN_BIG)
- ? arc_brk_s_be
- : arc_brk_s_le);
+ return ((gdbarch_byte_order (gdbarch) == BFD_ENDIAN_BIG) ? arc_brk_s_be
+ : arc_brk_s_le);
}
}
@@ -1635,7 +1614,7 @@ arc_print_frame_cache (struct gdbarch *gdbarch, const char *message,
arc_debug_printf ("saved register %s at %s %s",
gdbarch_register_name (gdbarch, i),
(addresses_known) ? "address" : "offset",
- paddress (gdbarch, cache->saved_regs[i].addr ()));
+ paddress (gdbarch, cache->saved_regs[i].addr ()));
}
}
@@ -1687,8 +1666,8 @@ arc_make_frame_cache (frame_info_ptr this_frame)
if (arc_debug)
arc_print_frame_cache (gdbarch, "after prologue", cache, false);
- CORE_ADDR unwound_fb = get_frame_register_unsigned (this_frame,
- cache->frame_base_reg);
+ CORE_ADDR unwound_fb
+ = get_frame_register_unsigned (this_frame, cache->frame_base_reg);
if (unwound_fb == 0)
return cache;
cache->prev_sp = unwound_fb + cache->frame_base_offset;
@@ -1745,8 +1724,8 @@ arc_frame_this_id (frame_info_ptr this_frame, void **this_cache,
*/
CORE_ADDR code_addr = get_frame_func (this_frame);
if (code_addr == 0)
- code_addr = get_frame_register_unsigned (this_frame,
- gdbarch_pc_regnum (gdbarch));
+ code_addr
+ = get_frame_register_unsigned (this_frame, gdbarch_pc_regnum (gdbarch));
*this_id = frame_id_build (stack_addr, code_addr);
}
@@ -1754,8 +1733,8 @@ arc_frame_this_id (frame_info_ptr this_frame, void **this_cache,
/* Implement the "prev_register" frame_unwind method. */
static struct value *
-arc_frame_prev_register (frame_info_ptr this_frame,
- void **this_cache, int regnum)
+arc_frame_prev_register (frame_info_ptr this_frame, void **this_cache,
+ int regnum)
{
if (*this_cache == NULL)
*this_cache = arc_make_frame_cache (this_frame);
@@ -1813,7 +1792,8 @@ arc_make_sigtramp_frame_cache (frame_info_ptr this_frame)
arc_gdbarch_tdep *tdep = gdbarch_tdep<arc_gdbarch_tdep> (arch);
/* Allocate new frame cache instance and space for saved register info. */
- struct arc_frame_cache *cache = FRAME_OBSTACK_ZALLOC (struct arc_frame_cache);
+ struct arc_frame_cache *cache
+ = FRAME_OBSTACK_ZALLOC (struct arc_frame_cache);
cache->saved_regs = trad_frame_alloc_saved_regs (this_frame);
/* Get the stack pointer and use it as the frame base. */
@@ -1844,8 +1824,8 @@ arc_make_sigtramp_frame_cache (frame_info_ptr this_frame)
frames. */
static void
-arc_sigtramp_frame_this_id (frame_info_ptr this_frame,
- void **this_cache, struct frame_id *this_id)
+arc_sigtramp_frame_this_id (frame_info_ptr this_frame, void **this_cache,
+ struct frame_id *this_id)
{
arc_debug_printf ("called");
@@ -1863,8 +1843,8 @@ arc_sigtramp_frame_this_id (frame_info_ptr this_frame,
/* Get a register from a signal handler frame. */
static struct value *
-arc_sigtramp_frame_prev_register (frame_info_ptr this_frame,
- void **this_cache, int regnum)
+arc_sigtramp_frame_prev_register (frame_info_ptr this_frame, void **this_cache,
+ int regnum)
{
arc_debug_printf ("regnum = %d", regnum);
@@ -1881,8 +1861,7 @@ arc_sigtramp_frame_prev_register (frame_info_ptr this_frame,
static int
arc_sigtramp_frame_sniffer (const struct frame_unwind *self,
- frame_info_ptr this_frame,
- void **this_cache)
+ frame_info_ptr this_frame, void **this_cache)
{
arc_debug_printf ("called");
@@ -1899,41 +1878,35 @@ arc_sigtramp_frame_sniffer (const struct frame_unwind *self,
the fallback unwinder, we use the default frame sniffer, which always
accepts the frame. */
-static const struct frame_unwind arc_frame_unwind = {
- "arc prologue",
- NORMAL_FRAME,
- default_frame_unwind_stop_reason,
- arc_frame_this_id,
- arc_frame_prev_register,
- NULL,
- default_frame_sniffer,
- NULL,
- NULL
-};
+static const struct frame_unwind arc_frame_unwind
+ = { "arc prologue",
+ NORMAL_FRAME,
+ default_frame_unwind_stop_reason,
+ arc_frame_this_id,
+ arc_frame_prev_register,
+ NULL,
+ default_frame_sniffer,
+ NULL,
+ NULL };
/* Structure defining the ARC signal frame unwind functions. Custom
sniffer is used, because this frame must be accepted only in the right
context. */
-static const struct frame_unwind arc_sigtramp_frame_unwind = {
- "arc sigtramp",
- SIGTRAMP_FRAME,
- default_frame_unwind_stop_reason,
- arc_sigtramp_frame_this_id,
- arc_sigtramp_frame_prev_register,
- NULL,
- arc_sigtramp_frame_sniffer,
- NULL,
- NULL
-};
-
-
-static const struct frame_base arc_normal_base = {
- &arc_frame_unwind,
- arc_frame_base_address,
- arc_frame_base_address,
- arc_frame_base_address
-};
+static const struct frame_unwind arc_sigtramp_frame_unwind
+ = { "arc sigtramp",
+ SIGTRAMP_FRAME,
+ default_frame_unwind_stop_reason,
+ arc_sigtramp_frame_this_id,
+ arc_sigtramp_frame_prev_register,
+ NULL,
+ arc_sigtramp_frame_sniffer,
+ NULL,
+ NULL };
+
+static const struct frame_base arc_normal_base
+ = { &arc_frame_unwind, arc_frame_base_address, arc_frame_base_address,
+ arc_frame_base_address };
static enum arc_isa
mach_type_to_arc_isa (const unsigned long mach)
@@ -1947,7 +1920,7 @@ mach_type_to_arc_isa (const unsigned long mach)
case bfd_mach_arc_arcv2:
return ARC_ISA_ARCV2;
default:
- internal_error (_("unknown machine id %lu"), mach);
+ internal_error (_ ("unknown machine id %lu"), mach);
}
}
@@ -1972,7 +1945,7 @@ arc_arch_features_create (const bfd *abfd, const unsigned long mach)
else if (eclass == ELFCLASS64)
reg_size = 8;
else
- internal_error (_("unknown ELF header class %d"), eclass);
+ internal_error (_ ("unknown ELF header class %d"), eclass);
}
/* MACH from a bfd_arch_info struct is used here. It should be a safe
@@ -1997,8 +1970,8 @@ find_obsolete_core_names (const struct target_desc *tdesc)
feat = tdesc_find_feature (tdesc, ARC_CORE_V2_OBSOLETE_FEATURE_NAME);
if (feat == nullptr)
- feat = tdesc_find_feature
- (tdesc, ARC_CORE_V2_REDUCED_OBSOLETE_FEATURE_NAME);
+ feat
+ = tdesc_find_feature (tdesc, ARC_CORE_V2_REDUCED_OBSOLETE_FEATURE_NAME);
return feat;
}
@@ -2024,8 +1997,8 @@ determine_core_reg_feature_set (const unsigned long mach)
case ARC_ISA_ARCV2:
return &arc_v2_core_reg_feature;
default:
- gdb_assert_not_reached
- ("Unknown machine type to determine the core feature set.");
+ gdb_assert_not_reached (
+ "Unknown machine type to determine the core feature set.");
}
}
@@ -2051,10 +2024,8 @@ determine_aux_reg_feature_set ()
static void
arc_update_acc_reg_names (const int byte_order)
{
- const char *r58_alias
- = byte_order == BFD_ENDIAN_LITTLE ? "accl" : "acch";
- const char *r59_alias
- = byte_order == BFD_ENDIAN_LITTLE ? "acch" : "accl";
+ const char *r58_alias = byte_order == BFD_ENDIAN_LITTLE ? "accl" : "acch";
+ const char *r59_alias = byte_order == BFD_ENDIAN_LITTLE ? "acch" : "accl";
/* Subscript 1 must be OK because those registers have 2 names. */
arc_v1_core_reg_feature.registers[ARC_R58_REGNUM].names[1] = r58_alias;
@@ -2089,16 +2060,16 @@ arc_check_tdesc_feature (struct tdesc_arch_data *tdesc_data,
if (!found && reg.required_p)
{
std::ostringstream reg_names;
- for (std::size_t i = 0; i < reg.names.size(); ++i)
+ for (std::size_t i = 0; i < reg.names.size (); ++i)
{
if (i == 0)
reg_names << "'" << reg.names[0] << "'";
else
reg_names << " or '" << reg.names[0] << "'";
}
- arc_print (_("Error: Cannot find required register(s) %s "
- "in feature '%s'.\n"), reg_names.str ().c_str (),
- feature->name.c_str ());
+ arc_print (_ ("Error: Cannot find required register(s) %s "
+ "in feature '%s'.\n"),
+ reg_names.str ().c_str (), feature->name.c_str ());
return false;
}
}
@@ -2122,15 +2093,16 @@ arc_check_for_hw_loops (const struct target_desc *tdesc,
return false;
bool hw_loop_p = false;
- const auto lp_start_name =
- aux_regset->registers[ARC_LP_START_REGNUM - ARC_FIRST_AUX_REGNUM].names[0];
- const auto lp_end_name =
- aux_regset->registers[ARC_LP_END_REGNUM - ARC_FIRST_AUX_REGNUM].names[0];
+ const auto lp_start_name
+ = aux_regset->registers[ARC_LP_START_REGNUM - ARC_FIRST_AUX_REGNUM]
+ .names[0];
+ const auto lp_end_name
+ = aux_regset->registers[ARC_LP_END_REGNUM - ARC_FIRST_AUX_REGNUM].names[0];
- hw_loop_p = tdesc_numbered_register (feature_aux, data,
- ARC_LP_START_REGNUM, lp_start_name);
- hw_loop_p &= tdesc_numbered_register (feature_aux, data,
- ARC_LP_END_REGNUM, lp_end_name);
+ hw_loop_p = tdesc_numbered_register (feature_aux, data, ARC_LP_START_REGNUM,
+ lp_start_name);
+ hw_loop_p &= tdesc_numbered_register (feature_aux, data, ARC_LP_END_REGNUM,
+ lp_end_name);
return hw_loop_p;
}
@@ -2151,8 +2123,7 @@ arc_tdesc_init (struct gdbarch_info info, const struct target_desc **tdesc,
if (!tdesc_has_registers (tdesc_loc))
{
arc_arch_features features
- = arc_arch_features_create (info.abfd,
- info.bfd_arch_info->mach);
+ = arc_arch_features_create (info.abfd, info.bfd_arch_info->mach);
tdesc_loc = arc_lookup_target_description (features);
}
gdb_assert (tdesc_loc != nullptr);
@@ -2172,15 +2143,17 @@ arc_tdesc_init (struct gdbarch_info info, const struct target_desc **tdesc,
if (feature_core == nullptr)
{
- arc_print (_("Error: Cannot find required feature '%s' in supplied "
- "target description.\n"), ARC_CORE_FEATURE_NAME);
+ arc_print (_ ("Error: Cannot find required feature '%s' in supplied "
+ "target description.\n"),
+ ARC_CORE_FEATURE_NAME);
return false;
}
if (feature_aux == nullptr)
{
- arc_print (_("Error: Cannot find required feature '%s' in supplied "
- "target description.\n"), ARC_AUX_FEATURE_NAME);
+ arc_print (_ ("Error: Cannot find required feature '%s' in supplied "
+ "target description.\n"),
+ ARC_AUX_FEATURE_NAME);
return false;
}
@@ -2193,12 +2166,10 @@ arc_tdesc_init (struct gdbarch_info info, const struct target_desc **tdesc,
arc_update_acc_reg_names (info.byte_order);
- bool valid_p = arc_check_tdesc_feature (tdesc_data_loc.get (),
- feature_core,
+ bool valid_p = arc_check_tdesc_feature (tdesc_data_loc.get (), feature_core,
arc_core_reg_feature);
- valid_p &= arc_check_tdesc_feature (tdesc_data_loc.get (),
- feature_aux,
+ valid_p &= arc_check_tdesc_feature (tdesc_data_loc.get (), feature_aux,
arc_aux_reg_feature);
if (!valid_p)
@@ -2288,7 +2259,7 @@ arc_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
set_gdbarch_sp_regnum (gdbarch, ARC_SP_REGNUM);
set_gdbarch_pc_regnum (gdbarch, ARC_PC_REGNUM);
set_gdbarch_ps_regnum (gdbarch, ARC_STATUS32_REGNUM);
- set_gdbarch_fp0_regnum (gdbarch, -1); /* No FPU registers. */
+ set_gdbarch_fp0_regnum (gdbarch, -1); /* No FPU registers. */
set_gdbarch_push_dummy_call (gdbarch, arc_push_dummy_call);
set_gdbarch_push_dummy_code (gdbarch, arc_push_dummy_code);
@@ -2422,8 +2393,7 @@ arc_dump_tdep (struct gdbarch *gdbarch, struct ui_file *file)
host_address_to_string (tdep->sigcontext_addr));
gdb_printf (file, "arc_dump_tdep: sc_reg_offset = <%s>\n",
host_address_to_string (tdep->sc_reg_offset));
- gdb_printf (file, "arc_dump_tdep: sc_num_regs = %d\n",
- tdep->sc_num_regs);
+ gdb_printf (file, "arc_dump_tdep: sc_num_regs = %d\n", tdep->sc_num_regs);
}
/* This command accepts single argument - address of instruction to
@@ -2447,6 +2417,7 @@ dump_arc_instruction_command (const char *args, int from_tty)
}
void _initialize_arc_tdep ();
+
void
_initialize_arc_tdep ()
{
@@ -2455,22 +2426,20 @@ _initialize_arc_tdep ()
/* Register ARC-specific commands with gdb. */
/* Add root prefix command for "maintenance print arc" commands. */
- add_basic_prefix_cmd ("arc", class_maintenance,
- _("ARC-specific maintenance commands for printing GDB "
- "internal state."),
- &maintenance_print_arc_list,
- 0, &maintenanceprintlist);
-
- add_cmd ("arc-instruction", class_maintenance,
- dump_arc_instruction_command,
- _("Dump arc_instruction structure for specified address."),
+ add_basic_prefix_cmd (
+ "arc", class_maintenance,
+ _ ("ARC-specific maintenance commands for printing GDB "
+ "internal state."),
+ &maintenance_print_arc_list, 0, &maintenanceprintlist);
+
+ add_cmd ("arc-instruction", class_maintenance, dump_arc_instruction_command,
+ _ ("Dump arc_instruction structure for specified address."),
&maintenance_print_arc_list);
/* Debug internals for ARC GDB. */
- add_setshow_boolean_cmd ("arc", class_maintenance,
- &arc_debug,
- _("Set ARC specific debugging."),
- _("Show ARC specific debugging."),
- _("When set, ARC specific debugging is enabled."),
+ add_setshow_boolean_cmd ("arc", class_maintenance, &arc_debug,
+ _ ("Set ARC specific debugging."),
+ _ ("Show ARC specific debugging."),
+ _ ("When set, ARC specific debugging is enabled."),
NULL, NULL, &setdebuglist, &showdebuglist);
}
diff --git a/gdb/arc-tdep.h b/gdb/arc-tdep.h
index edbd8c80ad5..6f47b1ca494 100644
--- a/gdb/arc-tdep.h
+++ b/gdb/arc-tdep.h
@@ -33,74 +33,74 @@
saved in function prologue. */
enum arc_regnum
- {
- /* Core registers. */
- ARC_R0_REGNUM = 0,
- ARC_R1_REGNUM = 1,
- ARC_R4_REGNUM = 4,
- ARC_R7_REGNUM = 7,
- ARC_R9_REGNUM = 9,
- ARC_R13_REGNUM = 13,
- ARC_R16_REGNUM = 16,
- ARC_R25_REGNUM = 25,
- /* Global data pointer. */
- ARC_GP_REGNUM,
- /* Frame pointer. */
- ARC_FP_REGNUM,
- /* Stack pointer. */
- ARC_SP_REGNUM,
- /* Return address from interrupt. */
- ARC_ILINK_REGNUM,
- ARC_R30_REGNUM,
- /* Return address from function. */
- ARC_BLINK_REGNUM,
- /* Accumulator registers. */
- ARC_R58_REGNUM = 58,
- ARC_R59_REGNUM,
- /* Zero-delay loop counter. */
- ARC_LP_COUNT_REGNUM = 60,
- /* Reserved register number. There should never be a register with such
+{
+ /* Core registers. */
+ ARC_R0_REGNUM = 0,
+ ARC_R1_REGNUM = 1,
+ ARC_R4_REGNUM = 4,
+ ARC_R7_REGNUM = 7,
+ ARC_R9_REGNUM = 9,
+ ARC_R13_REGNUM = 13,
+ ARC_R16_REGNUM = 16,
+ ARC_R25_REGNUM = 25,
+ /* Global data pointer. */
+ ARC_GP_REGNUM,
+ /* Frame pointer. */
+ ARC_FP_REGNUM,
+ /* Stack pointer. */
+ ARC_SP_REGNUM,
+ /* Return address from interrupt. */
+ ARC_ILINK_REGNUM,
+ ARC_R30_REGNUM,
+ /* Return address from function. */
+ ARC_BLINK_REGNUM,
+ /* Accumulator registers. */
+ ARC_R58_REGNUM = 58,
+ ARC_R59_REGNUM,
+ /* Zero-delay loop counter. */
+ ARC_LP_COUNT_REGNUM = 60,
+ /* Reserved register number. There should never be a register with such
number, this name is needed only for a sanity check in
arc_cannot_(fetch|store)_register. */
- ARC_RESERVED_REGNUM,
- /* Long-immediate value. This is not a physical register - if instruction
+ ARC_RESERVED_REGNUM,
+ /* Long-immediate value. This is not a physical register - if instruction
has register 62 as an operand, then this operand is a literal value
stored in the instruction memory right after the instruction itself.
This value is required in this enumeration as an architectural number
for instruction analysis. */
- ARC_LIMM_REGNUM,
- /* Program counter, aligned to 4-bytes, read-only. */
- ARC_PCL_REGNUM,
- ARC_LAST_CORE_REGNUM = ARC_PCL_REGNUM,
-
- /* AUX registers. */
- /* Actual program counter. */
- ARC_PC_REGNUM,
- ARC_FIRST_AUX_REGNUM = ARC_PC_REGNUM,
- /* Status register. */
- ARC_STATUS32_REGNUM,
- /* Zero-delay loop start instruction. */
- ARC_LP_START_REGNUM,
- /* Zero-delay loop next-after-last instruction. */
- ARC_LP_END_REGNUM,
- /* Branch target address. */
- ARC_BTA_REGNUM,
- /* Exception return address. */
- ARC_ERET_REGNUM,
- ARC_LAST_AUX_REGNUM = ARC_ERET_REGNUM,
- ARC_LAST_REGNUM = ARC_LAST_AUX_REGNUM,
-
- /* Additional ABI constants. */
- ARC_FIRST_ARG_REGNUM = ARC_R0_REGNUM,
- ARC_LAST_ARG_REGNUM = ARC_R7_REGNUM,
- ARC_FIRST_CALLEE_SAVED_REGNUM = ARC_R13_REGNUM,
- ARC_LAST_CALLEE_SAVED_REGNUM = ARC_R25_REGNUM,
- };
+ ARC_LIMM_REGNUM,
+ /* Program counter, aligned to 4-bytes, read-only. */
+ ARC_PCL_REGNUM,
+ ARC_LAST_CORE_REGNUM = ARC_PCL_REGNUM,
+
+ /* AUX registers. */
+ /* Actual program counter. */
+ ARC_PC_REGNUM,
+ ARC_FIRST_AUX_REGNUM = ARC_PC_REGNUM,
+ /* Status register. */
+ ARC_STATUS32_REGNUM,
+ /* Zero-delay loop start instruction. */
+ ARC_LP_START_REGNUM,
+ /* Zero-delay loop next-after-last instruction. */
+ ARC_LP_END_REGNUM,
+ /* Branch target address. */
+ ARC_BTA_REGNUM,
+ /* Exception return address. */
+ ARC_ERET_REGNUM,
+ ARC_LAST_AUX_REGNUM = ARC_ERET_REGNUM,
+ ARC_LAST_REGNUM = ARC_LAST_AUX_REGNUM,
+
+ /* Additional ABI constants. */
+ ARC_FIRST_ARG_REGNUM = ARC_R0_REGNUM,
+ ARC_LAST_ARG_REGNUM = ARC_R7_REGNUM,
+ ARC_FIRST_CALLEE_SAVED_REGNUM = ARC_R13_REGNUM,
+ ARC_LAST_CALLEE_SAVED_REGNUM = ARC_R25_REGNUM,
+};
/* Number of bytes in ARC register. All ARC registers are considered 32-bit.
Those registers, which are actually shorter has zero-on-read for extra bits.
Longer registers are represented as pairs of 32-bit registers. */
-#define ARC_REGISTER_SIZE 4
+#define ARC_REGISTER_SIZE 4
/* STATUS32 register: hardware loops disabled bit. */
#define ARC_STATUS32_L_MASK (1 << 12)
@@ -169,13 +169,13 @@ arc_mach_is_arcv2 (struct gdbarch *gdbarch)
number as "ARCv2". */
static inline bool
-arc_arch_is_hs (const struct bfd_arch_info* arch)
+arc_arch_is_hs (const struct bfd_arch_info *arch)
{
return startswith (arch->printable_name, "HS");
}
static inline bool
-arc_arch_is_em (const struct bfd_arch_info* arch)
+arc_arch_is_em (const struct bfd_arch_info *arch)
{
return startswith (arch->printable_name, "EM");
}
diff --git a/gdb/arch-utils.c b/gdb/arch-utils.c
index 617768225d3..59924ae02f2 100644
--- a/gdb/arch-utils.c
+++ b/gdb/arch-utils.c
@@ -21,7 +21,7 @@
#include "arch-utils.h"
#include "gdbcmd.h"
-#include "inferior.h" /* enum CALL_DUMMY_LOCATION et al. */
+#include "inferior.h" /* enum CALL_DUMMY_LOCATION et al. */
#include "infrun.h"
#include "regcache.h"
#include "sim-regno.h"
@@ -96,8 +96,8 @@ default_remove_non_address_bits (struct gdbarch *gdbarch, CORE_ADDR pointer)
std::string
default_memtag_to_string (struct gdbarch *gdbarch, struct value *tag)
{
- error (_("This architecture has no method to convert a memory tag to"
- " a string."));
+ error (_ ("This architecture has no method to convert a memory tag to"
+ " a string."));
}
/* See arch-utils.h */
@@ -152,8 +152,8 @@ generic_skip_solib_resolver (struct gdbarch *gdbarch, CORE_ADDR pc)
}
int
-generic_in_solib_return_trampoline (struct gdbarch *gdbarch,
- CORE_ADDR pc, const char *name)
+generic_in_solib_return_trampoline (struct gdbarch *gdbarch, CORE_ADDR pc,
+ const char *name)
{
return 0;
}
@@ -165,8 +165,7 @@ generic_stack_frame_destroyed_p (struct gdbarch *gdbarch, CORE_ADDR pc)
}
int
-default_code_of_frame_writable (struct gdbarch *gdbarch,
- frame_info_ptr frame)
+default_code_of_frame_writable (struct gdbarch *gdbarch, frame_info_ptr frame)
{
return 1;
}
@@ -256,10 +255,8 @@ cannot_register_not (struct gdbarch *gdbarch, int regnum)
cooked or raw. */
void
-legacy_virtual_frame_pointer (struct gdbarch *gdbarch,
- CORE_ADDR pc,
- int *frame_regnum,
- LONGEST *frame_offset)
+legacy_virtual_frame_pointer (struct gdbarch *gdbarch, CORE_ADDR pc,
+ int *frame_regnum, LONGEST *frame_offset)
{
/* FIXME: cagney/2002-09-13: This code is used when identifying the
frame pointer of the current PC. It is assuming that a single
@@ -267,17 +264,15 @@ legacy_virtual_frame_pointer (struct gdbarch *gdbarch,
instead generate a byte code expression as that would work better
with things like Dwarf2's CFI. */
if (gdbarch_deprecated_fp_regnum (gdbarch) >= 0
- && gdbarch_deprecated_fp_regnum (gdbarch)
- < gdbarch_num_regs (gdbarch))
+ && gdbarch_deprecated_fp_regnum (gdbarch) < gdbarch_num_regs (gdbarch))
*frame_regnum = gdbarch_deprecated_fp_regnum (gdbarch);
else if (gdbarch_sp_regnum (gdbarch) >= 0
- && gdbarch_sp_regnum (gdbarch)
- < gdbarch_num_regs (gdbarch))
+ && gdbarch_sp_regnum (gdbarch) < gdbarch_num_regs (gdbarch))
*frame_regnum = gdbarch_sp_regnum (gdbarch);
else
/* Should this be an internal error? I guess so, it is reflecting
an architectural limitation in the current design. */
- internal_error (_("No virtual frame pointer available"));
+ internal_error (_ ("No virtual frame pointer available"));
*frame_offset = 0;
}
@@ -286,8 +281,8 @@ legacy_virtual_frame_pointer (struct gdbarch *gdbarch,
If no suitable type is found, return NULL. */
const struct floatformat **
-default_floatformat_for_type (struct gdbarch *gdbarch,
- const char *name, int len)
+default_floatformat_for_type (struct gdbarch *gdbarch, const char *name,
+ int len)
{
const struct floatformat **format = NULL;
@@ -315,7 +310,7 @@ default_floatformat_for_type (struct gdbarch *gdbarch,
return format;
}
-
+
int
generic_convert_register_p (struct gdbarch *gdbarch, int regnum,
struct type *type)
@@ -337,8 +332,7 @@ generic_instruction_nullified (struct gdbarch *gdbarch,
}
int
-default_remote_register_number (struct gdbarch *gdbarch,
- int regno)
+default_remote_register_number (struct gdbarch *gdbarch, int regno)
{
return regno;
}
@@ -351,7 +345,6 @@ default_vsyscall_range (struct gdbarch *gdbarch, struct mem_range *range)
return 0;
}
-
/* Functions to manipulate the endianness of the target. */
static enum bfd_endian target_byte_order_user = BFD_ENDIAN_UNKNOWN;
@@ -359,8 +352,7 @@ static enum bfd_endian target_byte_order_user = BFD_ENDIAN_UNKNOWN;
static const char endian_big[] = "big";
static const char endian_little[] = "little";
static const char endian_auto[] = "auto";
-static const char *const endian_enum[] =
-{
+static const char *const endian_enum[] = {
endian_big,
endian_little,
endian_auto,
@@ -382,18 +374,15 @@ show_endian (struct ui_file *file, int from_tty, struct cmd_list_element *c,
{
if (target_byte_order_user == BFD_ENDIAN_UNKNOWN)
if (gdbarch_byte_order (get_current_arch ()) == BFD_ENDIAN_BIG)
- gdb_printf (file, _("The target endianness is set automatically "
- "(currently big endian).\n"));
+ gdb_printf (file, _ ("The target endianness is set automatically "
+ "(currently big endian).\n"));
else
- gdb_printf (file, _("The target endianness is set automatically "
- "(currently little endian).\n"));
+ gdb_printf (file, _ ("The target endianness is set automatically "
+ "(currently little endian).\n"));
+ else if (target_byte_order_user == BFD_ENDIAN_BIG)
+ gdb_printf (file, _ ("The target is set to big endian.\n"));
else
- if (target_byte_order_user == BFD_ENDIAN_BIG)
- gdb_printf (file,
- _("The target is set to big endian.\n"));
- else
- gdb_printf (file,
- _("The target is set to little endian.\n"));
+ gdb_printf (file, _ ("The target is set to little endian.\n"));
}
static void
@@ -404,29 +393,29 @@ set_endian (const char *ignore_args, int from_tty, struct cmd_list_element *c)
if (set_endian_string == endian_auto)
{
target_byte_order_user = BFD_ENDIAN_UNKNOWN;
- if (! gdbarch_update_p (info))
- internal_error (_("set_endian: architecture update failed"));
+ if (!gdbarch_update_p (info))
+ internal_error (_ ("set_endian: architecture update failed"));
}
else if (set_endian_string == endian_little)
{
info.byte_order = BFD_ENDIAN_LITTLE;
- if (! gdbarch_update_p (info))
+ if (!gdbarch_update_p (info))
gdb_printf (gdb_stderr,
- _("Little endian target not supported by GDB\n"));
+ _ ("Little endian target not supported by GDB\n"));
else
target_byte_order_user = BFD_ENDIAN_LITTLE;
}
else if (set_endian_string == endian_big)
{
info.byte_order = BFD_ENDIAN_BIG;
- if (! gdbarch_update_p (info))
+ if (!gdbarch_update_p (info))
gdb_printf (gdb_stderr,
- _("Big endian target not supported by GDB\n"));
+ _ ("Big endian target not supported by GDB\n"));
else
target_byte_order_user = BFD_ENDIAN_BIG;
}
else
- internal_error (_("set_endian: bad value"));
+ internal_error (_ ("set_endian: bad value"));
show_endian (gdb_stdout, from_tty, NULL, NULL);
}
@@ -485,8 +474,8 @@ choose_architecture_for_target (const struct target_desc *target_desc,
if (tdesc_compatible_p (target_desc, selected))
return from_target;
- warning (_("Selected architecture %s is not compatible "
- "with reported target architecture %s"),
+ warning (_ ("Selected architecture %s is not compatible "
+ "with reported target architecture %s"),
selected->printable_name, from_target->printable_name);
return selected;
}
@@ -509,15 +498,19 @@ choose_architecture_for_target (const struct target_desc *target_desc,
/* We have no idea which one is better. This is a bug, but not
a critical problem; warn the user. */
- warning (_("Selected architecture %s is ambiguous with "
- "reported target architecture %s"),
+ warning (_ ("Selected architecture %s is ambiguous with "
+ "reported target architecture %s"),
selected->printable_name, from_target->printable_name);
return selected;
}
/* Functions to manipulate the architecture of the target. */
-enum set_arch { set_arch_auto, set_arch_manual };
+enum set_arch
+{
+ set_arch_auto,
+ set_arch_manual
+};
static const struct bfd_arch_info *target_architecture_user;
@@ -540,21 +533,21 @@ show_architecture (struct ui_file *file, int from_tty,
struct cmd_list_element *c, const char *value)
{
if (target_architecture_user == NULL)
- gdb_printf (file, _("The target architecture is set to "
- "\"auto\" (currently \"%s\").\n"),
+ gdb_printf (file,
+ _ ("The target architecture is set to "
+ "\"auto\" (currently \"%s\").\n"),
gdbarch_bfd_arch_info (get_current_arch ())->printable_name);
else
- gdb_printf (file, _("The target architecture is set to \"%s\".\n"),
+ gdb_printf (file, _ ("The target architecture is set to \"%s\".\n"),
set_architecture_string);
}
-
/* Called if the user enters ``set architecture'' with or without an
argument. */
static void
-set_architecture (const char *ignore_args,
- int from_tty, struct cmd_list_element *c)
+set_architecture (const char *ignore_args, int from_tty,
+ struct cmd_list_element *c)
{
struct gdbarch_info info;
@@ -562,18 +555,17 @@ set_architecture (const char *ignore_args,
{
target_architecture_user = NULL;
if (!gdbarch_update_p (info))
- internal_error (_("could not select an architecture automatically"));
+ internal_error (_ ("could not select an architecture automatically"));
}
else
{
info.bfd_arch_info = bfd_scan_arch (set_architecture_string);
if (info.bfd_arch_info == NULL)
- internal_error (_("set_architecture: bfd_scan_arch failed"));
+ internal_error (_ ("set_architecture: bfd_scan_arch failed"));
if (gdbarch_update_p (info))
target_architecture_user = info.bfd_arch_info;
else
- gdb_printf (gdb_stderr,
- _("Architecture `%s' not recognized.\n"),
+ gdb_printf (gdb_stderr, _ ("Architecture `%s' not recognized.\n"),
set_architecture_string);
}
show_architecture (gdb_stdout, from_tty, NULL, NULL);
@@ -603,7 +595,7 @@ gdbarch_update_p (struct gdbarch_info info)
{
if (gdbarch_debug)
gdb_printf (gdb_stdlog, "gdbarch_update_p: "
- "Architecture not found\n");
+ "Architecture not found\n");
return 0;
}
@@ -612,7 +604,8 @@ gdbarch_update_p (struct gdbarch_info info)
if (new_gdbarch == target_gdbarch ())
{
if (gdbarch_debug)
- gdb_printf (gdb_stdlog, "gdbarch_update_p: "
+ gdb_printf (gdb_stdlog,
+ "gdbarch_update_p: "
"Architecture %s (%s) unchanged\n",
host_address_to_string (new_gdbarch),
gdbarch_bfd_arch_info (new_gdbarch)->printable_name);
@@ -621,7 +614,8 @@ gdbarch_update_p (struct gdbarch_info info)
/* It's a new architecture, swap it in. */
if (gdbarch_debug)
- gdb_printf (gdb_stdlog, "gdbarch_update_p: "
+ gdb_printf (gdb_stdlog,
+ "gdbarch_update_p: "
"New architecture %s (%s) selected\n",
host_address_to_string (new_gdbarch),
gdbarch_bfd_arch_info (new_gdbarch)->printable_name);
@@ -656,7 +650,7 @@ set_gdbarch_from_file (bfd *abfd)
gdbarch = gdbarch_find_by_info (info);
if (gdbarch == NULL)
- error (_("Architecture of file not recognized."));
+ error (_ ("Architecture of file not recognized."));
set_target_gdbarch (gdbarch);
}
@@ -688,7 +682,7 @@ void
initialize_current_architecture (void)
{
arches = gdbarch_printable_names ();
-
+
/* Find a default architecture. */
if (default_bfd_arch == NULL)
{
@@ -703,19 +697,18 @@ initialize_current_architecture (void)
}
if (chosen == NULL)
- internal_error (_("initialize_current_architecture: No arch"));
+ internal_error (_ ("initialize_current_architecture: No arch"));
default_bfd_arch = bfd_scan_arch (chosen);
if (default_bfd_arch == NULL)
- internal_error (_("initialize_current_architecture: Arch not found"));
+ internal_error (_ ("initialize_current_architecture: Arch not found"));
}
gdbarch_info info;
info.bfd_arch_info = default_bfd_arch;
/* Take several guesses at a byte order. */
- if (default_byte_order == BFD_ENDIAN_UNKNOWN
- && default_bfd_vec != NULL)
+ if (default_byte_order == BFD_ENDIAN_UNKNOWN && default_bfd_vec != NULL)
{
/* Extract BFD's default vector's byte order. */
switch (default_bfd_vec->byteorder)
@@ -735,9 +728,7 @@ initialize_current_architecture (void)
/* look for ``*el-*'' in the target name. */
const char *chp;
chp = strchr (target_name, '-');
- if (chp != NULL
- && chp - 2 >= target_name
- && startswith (chp - 2, "el"))
+ if (chp != NULL && chp - 2 >= target_name && startswith (chp - 2, "el"))
default_byte_order = BFD_ENDIAN_LITTLE;
}
if (default_byte_order == BFD_ENDIAN_UNKNOWN)
@@ -749,9 +740,9 @@ initialize_current_architecture (void)
info.byte_order = default_byte_order;
info.byte_order_for_code = info.byte_order;
- if (! gdbarch_update_p (info))
- internal_error (_("initialize_current_architecture: Selection of "
- "initial architecture failed"));
+ if (!gdbarch_update_p (info))
+ internal_error (_ ("initialize_current_architecture: Selection of "
+ "initial architecture failed"));
/* Create the ``set architecture'' command appending ``auto'' to the
list of architectures. */
@@ -760,13 +751,10 @@ initialize_current_architecture (void)
set_architecture_string = "auto";
arches.push_back (set_architecture_string);
arches.push_back (nullptr);
- set_show_commands architecture_cmds
- = add_setshow_enum_cmd ("architecture", class_support,
- arches.data (), &set_architecture_string,
- _("Set architecture of target."),
- _("Show architecture of target."), NULL,
- set_architecture, show_architecture,
- &setlist, &showlist);
+ set_show_commands architecture_cmds = add_setshow_enum_cmd (
+ "architecture", class_support, arches.data (), &set_architecture_string,
+ _ ("Set architecture of target."), _ ("Show architecture of target."),
+ NULL, set_architecture, show_architecture, &setlist, &showlist);
add_alias_cmd ("processor", architecture_cmds.set, class_support, 1,
&setlist);
}
@@ -780,19 +768,17 @@ void
gdbarch_info_fill (struct gdbarch_info *info)
{
/* "(gdb) set architecture ...". */
- if (info->bfd_arch_info == NULL
- && target_architecture_user)
+ if (info->bfd_arch_info == NULL && target_architecture_user)
info->bfd_arch_info = target_architecture_user;
/* From the file. */
- if (info->bfd_arch_info == NULL
- && info->abfd != NULL
+ if (info->bfd_arch_info == NULL && info->abfd != NULL
&& bfd_get_arch (info->abfd) != bfd_arch_unknown
&& bfd_get_arch (info->abfd) != bfd_arch_obscure)
info->bfd_arch_info = bfd_get_arch_info (info->abfd);
/* From the target. */
if (info->target_desc != NULL)
- info->bfd_arch_info = choose_architecture_for_target
- (info->target_desc, info->bfd_arch_info);
+ info->bfd_arch_info = choose_architecture_for_target (info->target_desc,
+ info->bfd_arch_info);
/* From the default. */
if (info->bfd_arch_info == NULL)
info->bfd_arch_info = default_bfd_arch;
@@ -802,11 +788,10 @@ gdbarch_info_fill (struct gdbarch_info *info)
&& target_byte_order_user != BFD_ENDIAN_UNKNOWN)
info->byte_order = target_byte_order_user;
/* From the INFO struct. */
- if (info->byte_order == BFD_ENDIAN_UNKNOWN
- && info->abfd != NULL)
- info->byte_order = (bfd_big_endian (info->abfd) ? BFD_ENDIAN_BIG
+ if (info->byte_order == BFD_ENDIAN_UNKNOWN && info->abfd != NULL)
+ info->byte_order = (bfd_big_endian (info->abfd) ? BFD_ENDIAN_BIG
: bfd_little_endian (info->abfd) ? BFD_ENDIAN_LITTLE
- : BFD_ENDIAN_UNKNOWN);
+ : BFD_ENDIAN_UNKNOWN);
/* From the default. */
if (info->byte_order == BFD_ENDIAN_UNKNOWN)
info->byte_order = default_byte_order;
@@ -822,7 +807,7 @@ gdbarch_info_fill (struct gdbarch_info *info)
if (info->osabi == GDB_OSABI_UNKNOWN && info->target_desc != NULL)
info->osabi = tdesc_osabi (info->target_desc);
- /* From the configured default. */
+ /* From the configured default. */
#ifdef GDB_OSABI_DEFAULT
if (info->osabi == GDB_OSABI_UNKNOWN)
info->osabi = GDB_OSABI_DEFAULT;
@@ -878,6 +863,7 @@ default_breakpoint_from_pc (struct gdbarch *gdbarch, CORE_ADDR *pcptr,
return gdbarch_sw_breakpoint_from_kind (gdbarch, kind, lenptr);
}
+
int
default_breakpoint_kind_from_current_state (struct gdbarch *gdbarch,
struct regcache *regcache,
@@ -886,13 +872,11 @@ default_breakpoint_kind_from_current_state (struct gdbarch *gdbarch,
return gdbarch_breakpoint_kind_from_pc (gdbarch, pcptr);
}
-
void
-default_gen_return_address (struct gdbarch *gdbarch,
- struct agent_expr *ax, struct axs_value *value,
- CORE_ADDR scope)
+default_gen_return_address (struct gdbarch *gdbarch, struct agent_expr *ax,
+ struct axs_value *value, CORE_ADDR scope)
{
- error (_("This architecture has no method to collect a return address."));
+ error (_ ("This architecture has no method to collect a return address."));
}
int
@@ -905,17 +889,20 @@ default_return_in_first_hidden_param_p (struct gdbarch *gdbarch,
return !(language_pass_by_reference (type).trivially_copyable);
}
-int default_insn_is_call (struct gdbarch *gdbarch, CORE_ADDR addr)
+int
+default_insn_is_call (struct gdbarch *gdbarch, CORE_ADDR addr)
{
return 0;
}
-int default_insn_is_ret (struct gdbarch *gdbarch, CORE_ADDR addr)
+int
+default_insn_is_ret (struct gdbarch *gdbarch, CORE_ADDR addr)
{
return 0;
}
-int default_insn_is_jump (struct gdbarch *gdbarch, CORE_ADDR addr)
+int
+default_insn_is_jump (struct gdbarch *gdbarch, CORE_ADDR addr)
{
return 0;
}
@@ -923,11 +910,11 @@ int default_insn_is_jump (struct gdbarch *gdbarch, CORE_ADDR addr)
/* See arch-utils.h. */
bool
-default_program_breakpoint_here_p (struct gdbarch *gdbarch,
- CORE_ADDR address)
+default_program_breakpoint_here_p (struct gdbarch *gdbarch, CORE_ADDR address)
{
int len;
- const gdb_byte *bpoint = gdbarch_breakpoint_from_pc (gdbarch, &address, &len);
+ const gdb_byte *bpoint
+ = gdbarch_breakpoint_from_pc (gdbarch, &address, &len);
/* Software breakpoints unsupported? */
if (bpoint == nullptr)
@@ -967,7 +954,8 @@ default_skip_permanent_breakpoint (struct regcache *regcache)
CORE_ADDR
default_infcall_mmap (CORE_ADDR size, unsigned prot)
{
- error (_("This target does not support inferior memory allocation by mmap."));
+ error (
+ _ ("This target does not support inferior memory allocation by mmap."));
}
void
@@ -983,8 +971,8 @@ std::string
default_gcc_target_options (struct gdbarch *gdbarch)
{
return string_printf ("-m%d%s", gdbarch_ptr_bit (gdbarch),
- (gdbarch_ptr_bit (gdbarch) == 64
- ? " -mcmodel=large" : ""));
+ (gdbarch_ptr_bit (gdbarch) == 64 ? " -mcmodel=large"
+ : ""));
}
/* gdbarch gnu_triplet_regexp method. */
@@ -1008,8 +996,7 @@ default_addressable_memory_unit_size (struct gdbarch *gdbarch)
void
default_guess_tracepoint_registers (struct gdbarch *gdbarch,
- struct regcache *regcache,
- CORE_ADDR addr)
+ struct regcache *regcache, CORE_ADDR addr)
{
int pc_regno = gdbarch_pc_regnum (gdbarch);
gdb_byte *regs;
@@ -1034,8 +1021,9 @@ default_print_insn (bfd_vma memaddr, disassemble_info *info)
{
disassembler_ftype disassemble_fn;
- disassemble_fn = disassembler (info->arch, info->endian == BFD_ENDIAN_BIG,
- info->mach, current_program_space->exec_bfd ());
+ disassemble_fn
+ = disassembler (info->arch, info->endian == BFD_ENDIAN_BIG, info->mach,
+ current_program_space->exec_bfd ());
gdb_assert (disassemble_fn != NULL);
return (*disassemble_fn) (memaddr, info);
@@ -1053,7 +1041,8 @@ gdbarch_skip_prologue_noexcept (gdbarch *gdbarch, CORE_ADDR pc) noexcept
new_pc = gdbarch_skip_prologue (gdbarch, pc);
}
catch (const gdb_exception &ex)
- {}
+ {
+ }
return new_pc;
}
@@ -1084,11 +1073,10 @@ default_get_pc_address_flags (frame_info_ptr frame, CORE_ADDR pc)
/* See arch-utils.h. */
void
-default_read_core_file_mappings
- (struct gdbarch *gdbarch,
- struct bfd *cbfd,
- read_core_file_mappings_pre_loop_ftype pre_loop_cb,
- read_core_file_mappings_loop_ftype loop_cb)
+default_read_core_file_mappings (
+ struct gdbarch *gdbarch, struct bfd *cbfd,
+ read_core_file_mappings_pre_loop_ftype pre_loop_cb,
+ read_core_file_mappings_loop_ftype loop_cb)
{
}
@@ -1104,11 +1092,12 @@ default_get_return_buf_addr (struct type *val_type, frame_info_ptr cur_frame)
#define GDBARCH_DEBUG 0
#endif
unsigned int gdbarch_debug = GDBARCH_DEBUG;
+
static void
show_gdbarch_debug (struct ui_file *file, int from_tty,
struct cmd_list_element *c, const char *value)
{
- gdb_printf (file, _("Architecture debugging is %s.\n"), value);
+ gdb_printf (file, _ ("Architecture debugging is %s.\n"), value);
}
static const char *
@@ -1169,10 +1158,10 @@ pstring_list (const char *const *list)
#include "gdbarch.c"
enum return_value_convention
-default_gdbarch_return_value
- (struct gdbarch *gdbarch, struct value *function, struct type *valtype,
- struct regcache *regcache, struct value **read_value,
- const gdb_byte *writebuf)
+default_gdbarch_return_value (struct gdbarch *gdbarch, struct value *function,
+ struct type *valtype, struct regcache *regcache,
+ struct value **read_value,
+ const gdb_byte *writebuf)
{
gdb_byte *readbuf = nullptr;
@@ -1182,11 +1171,12 @@ default_gdbarch_return_value
readbuf = value_contents_raw (*read_value).data ();
}
- return gdbarch->return_value (gdbarch, function, valtype, regcache,
- readbuf, writebuf);
+ return gdbarch->return_value (gdbarch, function, valtype, regcache, readbuf,
+ writebuf);
}
-obstack *gdbarch_obstack (gdbarch *arch)
+obstack *
+gdbarch_obstack (gdbarch *arch)
{
return &arch->obstack;
}
@@ -1199,7 +1189,6 @@ gdbarch_obstack_strdup (struct gdbarch *arch, const char *string)
return obstack_strdup (&arch->obstack, string);
}
-
/* Free a gdbarch struct. This should never happen in normal
operation --- once you've created a gdbarch, you keep it around.
However, if an architecture's init function encounters an error
@@ -1251,14 +1240,13 @@ gdbarch_printable_names ()
architectures. */
std::vector<const char *> arches;
- for (gdbarch_registration *rego = gdbarch_registry;
- rego != nullptr;
+ for (gdbarch_registration *rego = gdbarch_registry; rego != nullptr;
rego = rego->next)
{
const struct bfd_arch_info *ap
= bfd_lookup_arch (rego->bfd_architecture, 0);
if (ap == nullptr)
- internal_error (_("gdbarch_architecture_names: multi-arch unknown"));
+ internal_error (_ ("gdbarch_architecture_names: multi-arch unknown"));
do
{
if (rego->supports_arch_info == nullptr
@@ -1272,11 +1260,9 @@ gdbarch_printable_names ()
return arches;
}
-
void
gdbarch_register (enum bfd_architecture bfd_architecture,
- gdbarch_init_ftype *init,
- gdbarch_dump_tdep_ftype *dump_tdep,
+ gdbarch_init_ftype *init, gdbarch_dump_tdep_ftype *dump_tdep,
gdbarch_supports_arch_info_ftype *supports_arch_info)
{
struct gdbarch_registration **curr;
@@ -1286,25 +1272,22 @@ gdbarch_register (enum bfd_architecture bfd_architecture,
bfd_arch_info = bfd_lookup_arch (bfd_architecture, 0);
if (bfd_arch_info == NULL)
{
- internal_error (_("gdbarch: Attempt to register "
- "unknown architecture (%d)"),
+ internal_error (_ ("gdbarch: Attempt to register "
+ "unknown architecture (%d)"),
bfd_architecture);
}
/* Check that we haven't seen this architecture before. */
- for (curr = &gdbarch_registry;
- (*curr) != NULL;
- curr = &(*curr)->next)
+ for (curr = &gdbarch_registry; (*curr) != NULL; curr = &(*curr)->next)
{
if (bfd_architecture == (*curr)->bfd_architecture)
- internal_error (_("gdbarch: Duplicate registration "
- "of architecture (%s)"),
+ internal_error (_ ("gdbarch: Duplicate registration "
+ "of architecture (%s)"),
bfd_arch_info->printable_name);
}
/* log it */
if (gdbarch_debug)
gdb_printf (gdb_stdlog, "gdbarch_register (%s, %s)\n",
- bfd_arch_info->printable_name,
- host_address_to_string (init));
+ bfd_arch_info->printable_name, host_address_to_string (init));
/* Append it */
(*curr) = XNEW (struct gdbarch_registration);
(*curr)->bfd_architecture = bfd_architecture;
@@ -1336,7 +1319,6 @@ gdbarch_list_lookup_by_info (struct gdbarch_list *arches,
return NULL;
}
-
/* Find an architecture that matches the specified INFO. Create a new
architecture if needed. Return that new architecture. */
@@ -1356,36 +1338,31 @@ gdbarch_find_by_info (struct gdbarch_info info)
if (gdbarch_debug)
{
- gdb_printf (gdb_stdlog,
- "gdbarch_find_by_info: info.bfd_arch_info %s\n",
+ gdb_printf (gdb_stdlog, "gdbarch_find_by_info: info.bfd_arch_info %s\n",
(info.bfd_arch_info != nullptr
- ? info.bfd_arch_info->printable_name
- : "(null)"));
+ ? info.bfd_arch_info->printable_name
+ : "(null)"));
gdb_printf (gdb_stdlog,
"gdbarch_find_by_info: info.byte_order %d (%s)\n",
info.byte_order,
- (info.byte_order == BFD_ENDIAN_BIG ? "big"
+ (info.byte_order == BFD_ENDIAN_BIG ? "big"
: info.byte_order == BFD_ENDIAN_LITTLE ? "little"
- : "default"));
- gdb_printf (gdb_stdlog,
- "gdbarch_find_by_info: info.osabi %d (%s)\n",
+ : "default"));
+ gdb_printf (gdb_stdlog, "gdbarch_find_by_info: info.osabi %d (%s)\n",
info.osabi, gdbarch_osabi_name (info.osabi));
- gdb_printf (gdb_stdlog,
- "gdbarch_find_by_info: info.abfd %s\n",
+ gdb_printf (gdb_stdlog, "gdbarch_find_by_info: info.abfd %s\n",
host_address_to_string (info.abfd));
}
/* Find the tdep code that knows about this architecture. */
- for (rego = gdbarch_registry;
- rego != nullptr;
- rego = rego->next)
+ for (rego = gdbarch_registry; rego != nullptr; rego = rego->next)
if (rego->bfd_architecture == info.bfd_arch_info->arch)
break;
if (rego == nullptr)
{
if (gdbarch_debug)
gdb_printf (gdb_stdlog, "gdbarch_find_by_info: "
- "No matching architecture\n");
+ "No matching architecture\n");
return nullptr;
}
@@ -1398,7 +1375,7 @@ gdbarch_find_by_info (struct gdbarch_info info)
{
if (gdbarch_debug)
gdb_printf (gdb_stdlog, "gdbarch_find_by_info: "
- "Target rejected architecture\n");
+ "Target rejected architecture\n");
return nullptr;
}
@@ -1410,14 +1387,16 @@ gdbarch_find_by_info (struct gdbarch_info info)
struct gdbarch_list **list;
struct gdbarch_list *self;
if (gdbarch_debug)
- gdb_printf (gdb_stdlog, "gdbarch_find_by_info: "
+ gdb_printf (gdb_stdlog,
+ "gdbarch_find_by_info: "
"Previous architecture %s (%s) selected\n",
host_address_to_string (new_gdbarch),
new_gdbarch->bfd_arch_info->printable_name);
/* Find the existing arch in the list. */
for (list = &rego->arches;
(*list) != nullptr && (*list)->gdbarch != new_gdbarch;
- list = &(*list)->next);
+ list = &(*list)->next)
+ ;
/* It had better be in the list of architectures. */
gdb_assert ((*list) != nullptr && (*list)->gdbarch == new_gdbarch);
/* Unlink SELF. */
@@ -1432,7 +1411,8 @@ gdbarch_find_by_info (struct gdbarch_info info)
/* It's a new architecture. */
if (gdbarch_debug)
- gdb_printf (gdb_stdlog, "gdbarch_find_by_info: "
+ gdb_printf (gdb_stdlog,
+ "gdbarch_find_by_info: "
"New architecture %s (%s) selected\n",
host_address_to_string (new_gdbarch),
new_gdbarch->bfd_arch_info->printable_name);
@@ -1479,20 +1459,20 @@ target_gdbarch (void)
}
void _initialize_gdbarch_utils ();
+
void
_initialize_gdbarch_utils ()
{
- add_setshow_enum_cmd ("endian", class_support,
- endian_enum, &set_endian_string,
- _("Set endianness of target."),
- _("Show endianness of target."),
- NULL, set_endian, show_endian,
- &setlist, &showlist);
- add_setshow_zuinteger_cmd ("arch", class_maintenance, &gdbarch_debug, _("\
-Set architecture debugging."), _("\
-Show architecture debugging."), _("\
+ add_setshow_enum_cmd ("endian", class_support, endian_enum,
+ &set_endian_string, _ ("Set endianness of target."),
+ _ ("Show endianness of target."), NULL, set_endian,
+ show_endian, &setlist, &showlist);
+ add_setshow_zuinteger_cmd ("arch", class_maintenance, &gdbarch_debug, _ ("\
+Set architecture debugging."),
+ _ ("\
+Show architecture debugging."),
+ _ ("\
When non-zero, architecture debugging is enabled."),
- NULL,
- show_gdbarch_debug,
- &setdebuglist, &showdebuglist);
+ NULL, show_gdbarch_debug, &setdebuglist,
+ &showdebuglist);
}
diff --git a/gdb/arch-utils.h b/gdb/arch-utils.h
index 56690f0fd43..fef1979b657 100644
--- a/gdb/arch-utils.h
+++ b/gdb/arch-utils.h
@@ -28,36 +28,33 @@ struct type;
struct gdbarch_info;
struct dwarf2_frame_state;
-template <size_t bp_size, const gdb_byte *break_insn>
+template<size_t bp_size, const gdb_byte *break_insn>
struct bp_manipulation
{
- static int
- kind_from_pc (struct gdbarch *gdbarch, CORE_ADDR *pcptr)
+ static int kind_from_pc (struct gdbarch *gdbarch, CORE_ADDR *pcptr)
{
return bp_size;
}
- static const gdb_byte *
- bp_from_kind (struct gdbarch *gdbarch, int kind, int *size)
+ static const gdb_byte *bp_from_kind (struct gdbarch *gdbarch, int kind,
+ int *size)
{
*size = kind;
return break_insn;
}
};
-template <size_t bp_size,
- const gdb_byte *break_insn_little,
- const gdb_byte *break_insn_big>
+template<size_t bp_size, const gdb_byte *break_insn_little,
+ const gdb_byte *break_insn_big>
struct bp_manipulation_endian
{
- static int
- kind_from_pc (struct gdbarch *gdbarch, CORE_ADDR *pcptr)
+ static int kind_from_pc (struct gdbarch *gdbarch, CORE_ADDR *pcptr)
{
return bp_size;
}
- static const gdb_byte *
- bp_from_kind (struct gdbarch *gdbarch, int kind, int *size)
+ static const gdb_byte *bp_from_kind (struct gdbarch *gdbarch, int kind,
+ int *size)
{
*size = kind;
if (gdbarch_byte_order (gdbarch) == BFD_ENDIAN_BIG)
@@ -70,9 +67,9 @@ struct bp_manipulation_endian
#define BP_MANIPULATION(BREAK_INSN) \
bp_manipulation<sizeof (BREAK_INSN), BREAK_INSN>
-#define BP_MANIPULATION_ENDIAN(BREAK_INSN_LITTLE, BREAK_INSN_BIG) \
- bp_manipulation_endian<sizeof (BREAK_INSN_LITTLE), \
- BREAK_INSN_LITTLE, BREAK_INSN_BIG>
+#define BP_MANIPULATION_ENDIAN(BREAK_INSN_LITTLE, BREAK_INSN_BIG) \
+ bp_manipulation_endian<sizeof (BREAK_INSN_LITTLE), BREAK_INSN_LITTLE, \
+ BREAK_INSN_BIG>
/* Default implementation of gdbarch_displaced_hw_singlestep. */
extern bool default_displaced_step_hw_singlestep (struct gdbarch *);
@@ -89,7 +86,8 @@ extern int core_addr_greaterthan (CORE_ADDR lhs, CORE_ADDR rhs);
/* Identity functions on a CORE_ADDR. Just return the "addr". */
extern CORE_ADDR core_addr_identity (struct gdbarch *gdbarch, CORE_ADDR addr);
-extern gdbarch_convert_from_func_ptr_addr_ftype convert_from_func_ptr_addr_identity;
+extern gdbarch_convert_from_func_ptr_addr_ftype
+ convert_from_func_ptr_addr_identity;
/* No-op conversion of reg to regnum. */
@@ -129,8 +127,8 @@ extern gdbarch_virtual_frame_pointer_ftype legacy_virtual_frame_pointer;
/* Default implementation of gdbarch_floatformat_for_type. */
extern const struct floatformat **
- default_floatformat_for_type (struct gdbarch *gdbarch,
- const char *name, int len);
+default_floatformat_for_type (struct gdbarch *gdbarch, const char *name,
+ int len);
/* Default implementation of gdbarch_remove_non_address_bits. */
CORE_ADDR default_remove_non_address_bits (struct gdbarch *gdbarch,
@@ -145,18 +143,16 @@ bool default_tagged_address_p (struct gdbarch *gdbarch, struct value *address);
/* Default implementation of gdbarch_memtag_matches_p. */
extern bool default_memtag_matches_p (struct gdbarch *gdbarch,
- struct value *address);
+ struct value *address);
/* Default implementation of gdbarch_set_memtags. */
-bool default_set_memtags (struct gdbarch *gdbarch,
- struct value *address, size_t length,
- const gdb::byte_vector &tags,
+bool default_set_memtags (struct gdbarch *gdbarch, struct value *address,
+ size_t length, const gdb::byte_vector &tags,
memtag_type tag_type);
/* Default implementation of gdbarch_get_memtag. */
struct value *default_get_memtag (struct gdbarch *gdbarch,
- struct value *address,
- memtag_type tag_type);
+ struct value *address, memtag_type tag_type);
extern CORE_ADDR generic_skip_trampoline_code (frame_info_ptr frame,
CORE_ADDR pc);
@@ -183,8 +179,7 @@ extern int default_stabs_argument_has_addr (struct gdbarch *gdbarch,
extern int generic_instruction_nullified (struct gdbarch *gdbarch,
struct regcache *regcache);
-int default_remote_register_number (struct gdbarch *gdbarch,
- int regno);
+int default_remote_register_number (struct gdbarch *gdbarch, int regno);
/* For compatibility with older architectures, returns
(LEGACY_SIM_REGNO_IGNORE) when the register doesn't have a valid
@@ -227,9 +222,8 @@ extern const gdb_byte *default_breakpoint_from_pc (struct gdbarch *gdbarch,
CORE_ADDR *pcptr,
int *lenptr);
-extern int default_breakpoint_kind_from_current_state (struct gdbarch *gdbarch,
- struct regcache *regcache,
- CORE_ADDR *pcptr);
+extern int default_breakpoint_kind_from_current_state (
+ struct gdbarch *gdbarch, struct regcache *regcache, CORE_ADDR *pcptr);
extern void default_gen_return_address (struct gdbarch *gdbarch,
struct agent_expr *ax,
@@ -252,7 +246,8 @@ extern bool default_program_breakpoint_here_p (struct gdbarch *gdbarch,
/* Do-nothing version of vsyscall_range. Returns false. */
-extern int default_vsyscall_range (struct gdbarch *gdbarch, struct mem_range *range);
+extern int default_vsyscall_range (struct gdbarch *gdbarch,
+ struct mem_range *range);
/* Default way to advance the PC to the next instruction in order to
skip a permanent breakpoint. Increments the PC by the size of a
@@ -263,9 +258,9 @@ extern void default_skip_permanent_breakpoint (struct regcache *regcache);
/* Symbols for gdbarch_infcall_mmap; their Linux PROT_* system
definitions would be dependent on compilation host. */
-#define GDB_MMAP_PROT_READ 0x1 /* Page can be read. */
-#define GDB_MMAP_PROT_WRITE 0x2 /* Page can be written. */
-#define GDB_MMAP_PROT_EXEC 0x4 /* Page can be executed. */
+#define GDB_MMAP_PROT_READ 0x1 /* Page can be read. */
+#define GDB_MMAP_PROT_WRITE 0x2 /* Page can be written. */
+#define GDB_MMAP_PROT_EXEC 0x4 /* Page can be executed. */
extern CORE_ADDR default_infcall_mmap (CORE_ADDR size, unsigned prot);
extern void default_infcall_munmap (CORE_ADDR addr, CORE_ADDR size);
@@ -287,8 +282,7 @@ extern CORE_ADDR gdbarch_skip_prologue_noexcept (gdbarch *gdbarch,
/* Default implementation of gdbarch_in_indirect_branch_thunk that returns
false. */
-extern bool default_in_indirect_branch_thunk (gdbarch *gdbarch,
- CORE_ADDR pc);
+extern bool default_in_indirect_branch_thunk (gdbarch *gdbarch, CORE_ADDR pc);
/* Default implementation of gdbarch type_align method. */
extern ULONGEST default_type_align (struct gdbarch *gdbarch,
@@ -299,19 +293,19 @@ extern std::string default_get_pc_address_flags (frame_info_ptr frame,
CORE_ADDR pc);
/* Default implementation of gdbarch read_core_file_mappings method. */
-extern void default_read_core_file_mappings
- (struct gdbarch *gdbarch,
- struct bfd *cbfd,
- read_core_file_mappings_pre_loop_ftype pre_loop_cb,
- read_core_file_mappings_loop_ftype loop_cb);
+extern void default_read_core_file_mappings (
+ struct gdbarch *gdbarch, struct bfd *cbfd,
+ read_core_file_mappings_pre_loop_ftype pre_loop_cb,
+ read_core_file_mappings_loop_ftype loop_cb);
/* Default implementation of gdbarch default_get_return_buf_addr method. */
extern CORE_ADDR default_get_return_buf_addr (struct type *val_typegdbarch,
frame_info_ptr cur_frame);
-extern enum return_value_convention default_gdbarch_return_value
- (struct gdbarch *gdbarch, struct value *function, struct type *valtype,
- struct regcache *regcache, struct value **read_value,
- const gdb_byte *writebuf);
+extern enum return_value_convention
+default_gdbarch_return_value (struct gdbarch *gdbarch, struct value *function,
+ struct type *valtype, struct regcache *regcache,
+ struct value **read_value,
+ const gdb_byte *writebuf);
#endif /* ARCH_UTILS_H */
diff --git a/gdb/arch/aarch64-insn.c b/gdb/arch/aarch64-insn.c
index 54874df0f08..016f9d66e5c 100644
--- a/gdb/arch/aarch64-insn.c
+++ b/gdb/arch/aarch64-insn.c
@@ -47,8 +47,8 @@ decode_masked_match (uint32_t insn, uint32_t mask, uint32_t pattern)
Return 1 if the opcodes matches and is decoded, otherwise 0. */
int
-aarch64_decode_adr (CORE_ADDR addr, uint32_t insn, int *is_adrp,
- unsigned *rd, int32_t *offset)
+aarch64_decode_adr (CORE_ADDR addr, uint32_t insn, int *is_adrp, unsigned *rd,
+ int32_t *offset)
{
/* adr 0ii1 0000 iiii iiii iiii iiii iiir rrrr */
/* adrp 1ii1 0000 iiii iiii iiii iiii iiir rrrr */
@@ -71,7 +71,7 @@ aarch64_decode_adr (CORE_ADDR addr, uint32_t insn, int *is_adrp,
aarch64_debug_printf ("decode: 0x%s 0x%x %s x%u, #?",
core_addr_to_string_nz (addr), insn,
- *is_adrp ? "adrp" : "adr", *rd);
+ *is_adrp ? "adrp" : "adr", *rd);
return 1;
}
return 0;
@@ -88,8 +88,7 @@ aarch64_decode_adr (CORE_ADDR addr, uint32_t insn, int *is_adrp,
Return 1 if the opcodes matches and is decoded, otherwise 0. */
int
-aarch64_decode_b (CORE_ADDR addr, uint32_t insn, int *is_bl,
- int32_t *offset)
+aarch64_decode_b (CORE_ADDR addr, uint32_t insn, int *is_bl, int32_t *offset)
{
/* b 0001 01ii iiii iiii iiii iiii iiii iiii */
/* bl 1001 01ii iiii iiii iiii iiii iiii iiii */
@@ -190,8 +189,8 @@ aarch64_decode_cb (CORE_ADDR addr, uint32_t insn, int *is64, int *is_cbnz,
Return 1 if the opcodes matches and is decoded, otherwise 0. */
int
-aarch64_decode_tb (CORE_ADDR addr, uint32_t insn, int *is_tbnz,
- unsigned *bit, unsigned *rt, int32_t *imm)
+aarch64_decode_tb (CORE_ADDR addr, uint32_t insn, int *is_tbnz, unsigned *bit,
+ unsigned *rt, int32_t *imm)
{
/* tbz b011 0110 bbbb biii iiii iiii iiir rrrr */
/* tbnz B011 0111 bbbb biii iiii iiii iiir rrrr */
@@ -250,8 +249,7 @@ aarch64_decode_ldr_literal (CORE_ADDR addr, uint32_t insn, int *is_w,
if (aarch64_debug)
debug_printf ("decode: %s 0x%x %s %s%u, #?\n",
core_addr_to_string_nz (addr), insn,
- *is_w ? "ldrsw" : "ldr",
- *is64 ? "x" : "w", *rt);
+ *is_w ? "ldrsw" : "ldr", *is64 ? "x" : "w", *rt);
return 1;
}
@@ -335,9 +333,9 @@ aarch64_emit_load_store (uint32_t *buf, uint32_t size,
op = ENCODE (1, 1, 24);
return aarch64_emit_insn (buf, opcode | ENCODE (size, 2, 30) | op
- | ENCODE (operand.index >> 3, 12, 10)
- | ENCODE (rn.num, 5, 5)
- | ENCODE (rt.num, 5, 0));
+ | ENCODE (operand.index >> 3, 12, 10)
+ | ENCODE (rn.num, 5, 5)
+ | ENCODE (rt.num, 5, 0));
}
case MEMORY_OPERAND_POSTINDEX:
{
@@ -346,9 +344,10 @@ aarch64_emit_load_store (uint32_t *buf, uint32_t size,
op = ENCODE (0, 1, 24);
return aarch64_emit_insn (buf, opcode | ENCODE (size, 2, 30) | op
- | post_index | ENCODE (operand.index, 9, 12)
- | ENCODE (rn.num, 5, 5)
- | ENCODE (rt.num, 5, 0));
+ | post_index
+ | ENCODE (operand.index, 9, 12)
+ | ENCODE (rn.num, 5, 5)
+ | ENCODE (rt.num, 5, 0));
}
case MEMORY_OPERAND_PREINDEX:
{
@@ -357,9 +356,10 @@ aarch64_emit_load_store (uint32_t *buf, uint32_t size,
op = ENCODE (0, 1, 24);
return aarch64_emit_insn (buf, opcode | ENCODE (size, 2, 30) | op
- | pre_index | ENCODE (operand.index, 9, 12)
- | ENCODE (rn.num, 5, 5)
- | ENCODE (rt.num, 5, 0));
+ | pre_index
+ | ENCODE (operand.index, 9, 12)
+ | ENCODE (rn.num, 5, 5)
+ | ENCODE (rt.num, 5, 0));
}
default:
return 0;
diff --git a/gdb/arch/aarch64-insn.h b/gdb/arch/aarch64-insn.h
index 7560da9cc16..e80bcfd5954 100644
--- a/gdb/arch/aarch64-insn.h
+++ b/gdb/arch/aarch64-insn.h
@@ -32,15 +32,15 @@ extern bool aarch64_debug;
#define submask(x) ((1L << ((x) + 1)) - 1)
/* Extract the bitfield from OBJ starting at bit ST and ending at bit FN. */
-#define bits(obj,st,fn) (((obj) >> (st)) & submask ((fn) - (st)))
+#define bits(obj, st, fn) (((obj) >> (st)) & submask ((fn) - (st)))
/* Extract bit ST from OBJ. */
-#define bit(obj,st) (((obj) >> (st)) & 1)
+#define bit(obj, st) (((obj) >> (st)) & 1)
/* Extract the signed bitfield from OBJ starting at bit ST and ending at
bit FN. The result is sign-extended. */
-#define sbits(obj,st,fn) \
- ((long) (bits(obj,st,fn) | ((long) bit(obj,fn) * ~ submask (fn - st))))
+#define sbits(obj, st, fn) \
+ ((long) (bits (obj, st, fn) | ((long) bit (obj, fn) * ~submask (fn - st))))
/* Prologue analyzer helper macros. */
@@ -59,80 +59,80 @@ enum aarch64_opcodes
/* CBNZ s011 0101 iiii iiii iiii iiii iiir rrrr */
/* TBZ b011 0110 bbbb biii iiii iiii iiir rrrr */
/* TBNZ b011 0111 bbbb biii iiii iiii iiir rrrr */
- B = 0x14000000,
- BL = 0x80000000 | B,
- BCOND = 0x40000000 | B,
- CBZ = 0x20000000 | B,
- CBNZ = 0x21000000 | B,
- TBZ = 0x36000000 | B,
- TBNZ = 0x37000000 | B,
+ B = 0x14000000,
+ BL = 0x80000000 | B,
+ BCOND = 0x40000000 | B,
+ CBZ = 0x20000000 | B,
+ CBNZ = 0x21000000 | B,
+ TBZ = 0x36000000 | B,
+ TBNZ = 0x37000000 | B,
/* BR 1101 0110 0001 1111 0000 00rr rrr0 0000 */
/* BLR 1101 0110 0011 1111 0000 00rr rrr0 0000 */
- BR = 0xd61f0000,
- BLR = 0xd63f0000,
+ BR = 0xd61f0000,
+ BLR = 0xd63f0000,
/* RET 1101 0110 0101 1111 0000 00rr rrr0 0000 */
- RET = 0xd65f0000,
+ RET = 0xd65f0000,
/* STP s010 100o o0ii iiii irrr rrrr rrrr rrrr */
/* LDP s010 100o o1ii iiii irrr rrrr rrrr rrrr */
/* STP (SIMD&VFP) ss10 110o o0ii iiii irrr rrrr rrrr rrrr */
/* LDP (SIMD&VFP) ss10 110o o1ii iiii irrr rrrr rrrr rrrr */
- STP = 0x28000000,
- LDP = 0x28400000,
- STP_SIMD_VFP = 0x04000000 | STP,
- LDP_SIMD_VFP = 0x04000000 | LDP,
+ STP = 0x28000000,
+ LDP = 0x28400000,
+ STP_SIMD_VFP = 0x04000000 | STP,
+ LDP_SIMD_VFP = 0x04000000 | LDP,
/* STR ss11 100o 00xi iiii iiii xxrr rrrr rrrr */
/* LDR ss11 100o 01xi iiii iiii xxrr rrrr rrrr */
/* LDRSW 1011 100o 10xi iiii iiii xxrr rrrr rrrr */
- STR = 0x38000000,
- LDR = 0x00400000 | STR,
- LDRSW = 0x80800000 | STR,
+ STR = 0x38000000,
+ LDR = 0x00400000 | STR,
+ LDRSW = 0x80800000 | STR,
/* LDAXR ss00 1000 0101 1111 1111 11rr rrrr rrrr */
- LDAXR = 0x085ffc00,
+ LDAXR = 0x085ffc00,
/* STXR ss00 1000 000r rrrr 0111 11rr rrrr rrrr */
- STXR = 0x08007c00,
+ STXR = 0x08007c00,
/* STLR ss00 1000 1001 1111 1111 11rr rrrr rrrr */
- STLR = 0x089ffc00,
+ STLR = 0x089ffc00,
/* MOV s101 0010 1xxi iiii iiii iiii iiir rrrr */
/* MOVK s111 0010 1xxi iiii iiii iiii iiir rrrr */
- MOV = 0x52800000,
- MOVK = 0x20000000 | MOV,
+ MOV = 0x52800000,
+ MOVK = 0x20000000 | MOV,
/* ADD s00o ooo1 xxxx xxxx xxxx xxxx xxxx xxxx */
/* SUB s10o ooo1 xxxx xxxx xxxx xxxx xxxx xxxx */
/* SUBS s11o ooo1 xxxx xxxx xxxx xxxx xxxx xxxx */
- ADD = 0x01000000,
- SUB = 0x40000000 | ADD,
- SUBS = 0x20000000 | SUB,
+ ADD = 0x01000000,
+ SUB = 0x40000000 | ADD,
+ SUBS = 0x20000000 | SUB,
/* AND s000 1010 xx0x xxxx xxxx xxxx xxxx xxxx */
/* ORR s010 1010 xx0x xxxx xxxx xxxx xxxx xxxx */
/* ORN s010 1010 xx1x xxxx xxxx xxxx xxxx xxxx */
/* EOR s100 1010 xx0x xxxx xxxx xxxx xxxx xxxx */
- AND = 0x0a000000,
- ORR = 0x20000000 | AND,
- ORN = 0x00200000 | ORR,
- EOR = 0x40000000 | AND,
+ AND = 0x0a000000,
+ ORR = 0x20000000 | AND,
+ ORN = 0x00200000 | ORR,
+ EOR = 0x40000000 | AND,
/* LSLV s001 1010 110r rrrr 0010 00rr rrrr rrrr */
/* LSRV s001 1010 110r rrrr 0010 01rr rrrr rrrr */
/* ASRV s001 1010 110r rrrr 0010 10rr rrrr rrrr */
- LSLV = 0x1ac02000,
- LSRV = 0x00000400 | LSLV,
- ASRV = 0x00000800 | LSLV,
+ LSLV = 0x1ac02000,
+ LSRV = 0x00000400 | LSLV,
+ ASRV = 0x00000800 | LSLV,
/* SBFM s001 0011 0nii iiii iiii iirr rrrr rrrr */
- SBFM = 0x13000000,
+ SBFM = 0x13000000,
/* UBFM s101 0011 0nii iiii iiii iirr rrrr rrrr */
- UBFM = 0x40000000 | SBFM,
+ UBFM = 0x40000000 | SBFM,
/* CSINC s001 1010 100r rrrr cccc 01rr rrrr rrrr */
- CSINC = 0x9a800400,
+ CSINC = 0x9a800400,
/* MUL s001 1011 000r rrrr 0111 11rr rrrr rrrr */
- MUL = 0x1b007c00,
+ MUL = 0x1b007c00,
/* MSR (register) 1101 0101 0001 oooo oooo oooo ooor rrrr */
/* MRS 1101 0101 0011 oooo oooo oooo ooor rrrr */
- MSR = 0xd5100000,
- MRS = 0x00200000 | MSR,
+ MSR = 0xd5100000,
+ MRS = 0x00200000 | MSR,
/* HINT 1101 0101 0000 0011 0010 oooo ooo1 1111 */
- HINT = 0xd503201f,
- SEVL = (5 << 5) | HINT,
- WFE = (2 << 5) | HINT,
- NOP = (0 << 5) | HINT,
+ HINT = 0xd503201f,
+ SEVL = (5 << 5) | HINT,
+ WFE = (2 << 5) | HINT,
+ NOP = (0 << 5) | HINT,
};
/* List of useful masks. */
@@ -191,8 +191,8 @@ int aarch64_decode_b (CORE_ADDR addr, uint32_t insn, int *is_bl,
int aarch64_decode_bcond (CORE_ADDR addr, uint32_t insn, unsigned *cond,
int32_t *offset);
-int aarch64_decode_cb (CORE_ADDR addr, uint32_t insn, int *is64,
- int *is_cbnz, unsigned *rn, int32_t *offset);
+int aarch64_decode_cb (CORE_ADDR addr, uint32_t insn, int *is64, int *is_cbnz,
+ unsigned *rn, int32_t *offset);
int aarch64_decode_tb (CORE_ADDR addr, uint32_t insn, int *is_tbnz,
unsigned *bit, unsigned *rt, int32_t *imm);
@@ -221,18 +221,16 @@ struct aarch64_insn_visitor
struct aarch64_insn_data *data);
/* Visit instruction CBZ/CBNZ Rn, OFFSET. */
- void (*cb) (const int32_t offset, const int is_cbnz,
- const unsigned rn, int is64,
- struct aarch64_insn_data *data);
+ void (*cb) (const int32_t offset, const int is_cbnz, const unsigned rn,
+ int is64, struct aarch64_insn_data *data);
/* Visit instruction TBZ/TBNZ Rt, #BIT, OFFSET. */
- void (*tb) (const int32_t offset, int is_tbnz,
- const unsigned rt, unsigned bit,
- struct aarch64_insn_data *data);
+ void (*tb) (const int32_t offset, int is_tbnz, const unsigned rt,
+ unsigned bit, struct aarch64_insn_data *data);
/* Visit instruction ADR/ADRP Rd, OFFSET. */
- void (*adr) (const int32_t offset, const unsigned rd,
- const int is_adrp, struct aarch64_insn_data *data);
+ void (*adr) (const int32_t offset, const unsigned rd, const int is_adrp,
+ struct aarch64_insn_data *data);
/* Visit instruction LDR/LDRSW Rt, OFFSET. */
void (*ldr_literal) (const int32_t offset, const int is_sw,
@@ -247,7 +245,7 @@ void aarch64_relocate_instruction (uint32_t insn,
const struct aarch64_insn_visitor *visitor,
struct aarch64_insn_data *data);
-#define can_encode_int32(val, bits) \
+#define can_encode_int32(val, bits) \
(((val) >> (bits)) == 0 || ((val) >> (bits)) == -1)
/* Write a B or BL instruction into *BUF.
@@ -272,10 +270,9 @@ void aarch64_relocate_instruction (uint32_t insn,
byte-addressed but should be 4 bytes aligned. It has a limited range of
+/- 1MB (19 bits << 2). */
-#define emit_bcond(buf, cond, offset) \
- aarch64_emit_insn (buf, \
- BCOND | ENCODE ((offset) >> 2, 19, 5) \
- | ENCODE ((cond), 4, 0))
+#define emit_bcond(buf, cond, offset) \
+ aarch64_emit_insn (buf, BCOND | ENCODE ((offset) >> 2, 19, 5) \
+ | ENCODE ((cond), 4, 0))
/* Write a CBZ or CBNZ instruction into *BUF.
@@ -288,12 +285,11 @@ void aarch64_relocate_instruction (uint32_t insn,
byte-addressed but should be 4 bytes aligned. It has a limited range of
+/- 1MB (19 bits << 2). */
-#define emit_cb(buf, is_cbnz, rt, offset) \
- aarch64_emit_insn (buf, \
- ((is_cbnz) ? CBNZ : CBZ) \
- | ENCODE (rt.is64, 1, 31) /* sf */ \
- | ENCODE (offset >> 2, 19, 5) /* imm19 */ \
- | ENCODE (rt.num, 5, 0))
+#define emit_cb(buf, is_cbnz, rt, offset) \
+ aarch64_emit_insn (buf, ((is_cbnz) ? CBNZ : CBZ) \
+ | ENCODE (rt.is64, 1, 31) /* sf */ \
+ | ENCODE (offset >> 2, 19, 5) /* imm19 */ \
+ | ENCODE (rt.num, 5, 0))
/* Write a LDR instruction into *BUF.
@@ -320,10 +316,9 @@ void aarch64_relocate_instruction (uint32_t insn,
OFFSET is the immediate to add to the base address. It is limited to
0 .. 16380 range (12 bits << 2). */
-#define emit_ldrsw(buf, rt, rn, operand) \
+#define emit_ldrsw(buf, rt, rn, operand) \
aarch64_emit_load_store (buf, 3, LDRSW, rt, rn, operand)
-
/* Write a TBZ or TBNZ instruction into *BUF.
TBZ rt, #bit, #offset
@@ -336,13 +331,12 @@ void aarch64_relocate_instruction (uint32_t insn,
byte-addressed but should be 4 bytes aligned. It has a limited range of
+/- 32KB (14 bits << 2). */
-#define emit_tb(buf, is_tbnz, bit, rt, offset) \
- aarch64_emit_insn (buf, \
- ((is_tbnz) ? TBNZ: TBZ) \
- | ENCODE (bit >> 5, 1, 31) /* b5 */ \
- | ENCODE (bit, 5, 19) /* b40 */ \
- | ENCODE (offset >> 2, 14, 5) /* imm14 */ \
- | ENCODE (rt.num, 5, 0))
+#define emit_tb(buf, is_tbnz, bit, rt, offset) \
+ aarch64_emit_insn (buf, ((is_tbnz) ? TBNZ : TBZ) \
+ | ENCODE (bit >> 5, 1, 31) /* b5 */ \
+ | ENCODE (bit, 5, 19) /* b40 */ \
+ | ENCODE (offset >> 2, 14, 5) /* imm14 */ \
+ | ENCODE (rt.num, 5, 0))
/* Write a NOP instruction into *BUF. */
diff --git a/gdb/arch/aarch64-mte-linux.h b/gdb/arch/aarch64-mte-linux.h
index e862b0b4c59..38a2dbca6c7 100644
--- a/gdb/arch/aarch64-mte-linux.h
+++ b/gdb/arch/aarch64-mte-linux.h
@@ -24,7 +24,7 @@
/* Feature check for Memory Tagging Extension. */
#ifndef HWCAP2_MTE
-#define HWCAP2_MTE (1 << 18)
+#define HWCAP2_MTE (1 << 18)
#endif
/* The MTE regset consists of a single 64-bit register. */
@@ -38,8 +38,8 @@
/* Memory tagging definitions. */
#ifndef SEGV_MTEAERR
-# define SEGV_MTEAERR 8
-# define SEGV_MTESERR 9
+#define SEGV_MTEAERR 8
+#define SEGV_MTESERR 9
#endif
/* Memory tag types for AArch64. */
diff --git a/gdb/arch/aarch64.h b/gdb/arch/aarch64.h
index de4461e8be1..8dc767bf69c 100644
--- a/gdb/arch/aarch64.h
+++ b/gdb/arch/aarch64.h
@@ -38,38 +38,37 @@ struct aarch64_features
uint8_t tls = 0;
};
-inline bool operator==(const aarch64_features &lhs, const aarch64_features &rhs)
+inline bool
+operator== (const aarch64_features &lhs, const aarch64_features &rhs)
{
- return lhs.vq == rhs.vq
- && lhs.pauth == rhs.pauth
- && lhs.mte == rhs.mte
- && lhs.tls == rhs.tls;
+ return lhs.vq == rhs.vq && lhs.pauth == rhs.pauth && lhs.mte == rhs.mte
+ && lhs.tls == rhs.tls;
}
namespace std
{
- template<>
- struct hash<aarch64_features>
+template<>
+struct hash<aarch64_features>
+{
+ std::size_t operator() (const aarch64_features &features) const noexcept
{
- std::size_t operator()(const aarch64_features &features) const noexcept
- {
- std::size_t h;
-
- h = features.vq;
- h = h << 1 | features.pauth;
- h = h << 1 | features.mte;
- /* Shift by two bits for now. We may need to increase this in the future
+ std::size_t h;
+
+ h = features.vq;
+ h = h << 1 | features.pauth;
+ h = h << 1 | features.mte;
+ /* Shift by two bits for now. We may need to increase this in the future
if more TLS registers get added. */
- h = h << 2 | features.tls;
- return h;
- }
- };
-}
+ h = h << 2 | features.tls;
+ return h;
+ }
+};
+} // namespace std
/* Create the aarch64 target description. */
target_desc *
- aarch64_create_target_description (const aarch64_features &features);
+aarch64_create_target_description (const aarch64_features &features);
/* Given a pointer value POINTER and a MASK of non-address bits, remove the
non-address bits from the pointer and sign-extend the result if required.
@@ -87,23 +86,23 @@ aarch64_mask_from_pac_registers (const CORE_ADDR cmask, const CORE_ADDR dmask);
registers become pseudo registers. */
enum aarch64_regnum
{
- AARCH64_X0_REGNUM, /* First integer register. */
- AARCH64_FP_REGNUM = AARCH64_X0_REGNUM + 29, /* Frame register, if used. */
- AARCH64_LR_REGNUM = AARCH64_X0_REGNUM + 30, /* Return address. */
- AARCH64_SP_REGNUM, /* Stack pointer. */
- AARCH64_PC_REGNUM, /* Program counter. */
- AARCH64_CPSR_REGNUM, /* Current Program Status Register. */
- AARCH64_V0_REGNUM, /* First fp/vec register. */
- AARCH64_V31_REGNUM = AARCH64_V0_REGNUM + 31, /* Last fp/vec register. */
- AARCH64_SVE_Z0_REGNUM = AARCH64_V0_REGNUM, /* First SVE Z register. */
- AARCH64_SVE_Z31_REGNUM = AARCH64_V31_REGNUM, /* Last SVE Z register. */
- AARCH64_FPSR_REGNUM, /* Floating Point Status Register. */
- AARCH64_FPCR_REGNUM, /* Floating Point Control Register. */
- AARCH64_SVE_P0_REGNUM, /* First SVE predicate register. */
- AARCH64_SVE_P15_REGNUM = AARCH64_SVE_P0_REGNUM + 15, /* Last SVE predicate
+ AARCH64_X0_REGNUM, /* First integer register. */
+ AARCH64_FP_REGNUM = AARCH64_X0_REGNUM + 29, /* Frame register, if used. */
+ AARCH64_LR_REGNUM = AARCH64_X0_REGNUM + 30, /* Return address. */
+ AARCH64_SP_REGNUM, /* Stack pointer. */
+ AARCH64_PC_REGNUM, /* Program counter. */
+ AARCH64_CPSR_REGNUM, /* Current Program Status Register. */
+ AARCH64_V0_REGNUM, /* First fp/vec register. */
+ AARCH64_V31_REGNUM = AARCH64_V0_REGNUM + 31, /* Last fp/vec register. */
+ AARCH64_SVE_Z0_REGNUM = AARCH64_V0_REGNUM, /* First SVE Z register. */
+ AARCH64_SVE_Z31_REGNUM = AARCH64_V31_REGNUM, /* Last SVE Z register. */
+ AARCH64_FPSR_REGNUM, /* Floating Point Status Register. */
+ AARCH64_FPCR_REGNUM, /* Floating Point Control Register. */
+ AARCH64_SVE_P0_REGNUM, /* First SVE predicate register. */
+ AARCH64_SVE_P15_REGNUM = AARCH64_SVE_P0_REGNUM + 15, /* Last SVE predicate
register. */
- AARCH64_SVE_FFR_REGNUM, /* SVE First Fault Register. */
- AARCH64_SVE_VG_REGNUM, /* SVE Vector Granule. */
+ AARCH64_SVE_FFR_REGNUM, /* SVE First Fault Register. */
+ AARCH64_SVE_VG_REGNUM, /* SVE Vector Granule. */
/* Other useful registers. */
AARCH64_LAST_X_ARG_REGNUM = AARCH64_X0_REGNUM + 7,
@@ -113,14 +112,14 @@ enum aarch64_regnum
/* Sizes of various AArch64 registers. */
#define AARCH64_TLS_REGISTER_SIZE 8
-#define V_REGISTER_SIZE 16
+#define V_REGISTER_SIZE 16
/* PAC-related constants. */
/* Bit 55 is used to select between a kernel-space and user-space address. */
-#define VA_RANGE_SELECT_BIT_MASK 0x80000000000000ULL
+#define VA_RANGE_SELECT_BIT_MASK 0x80000000000000ULL
/* Mask with 1's in bits 55~63, used to remove the top byte of pointers
(Top Byte Ignore). */
-#define AARCH64_TOP_BITS_MASK 0xff80000000000000ULL
+#define AARCH64_TOP_BITS_MASK 0xff80000000000000ULL
/* Pseudo register base numbers. */
#define AARCH64_Q0_REGNUM 0
@@ -150,19 +149,18 @@ enum aarch64_regnum
VG : Vector Granule.
The number of 64bit chunks in an SVE Z register. */
-#define sve_vg_from_vl(vl) ((vl) / 8)
-#define sve_vl_from_vg(vg) ((vg) * 8)
+#define sve_vg_from_vl(vl) ((vl) / 8)
+#define sve_vl_from_vg(vg) ((vg) *8)
#ifndef sve_vq_from_vl
-#define sve_vq_from_vl(vl) ((vl) / 0x10)
+#define sve_vq_from_vl(vl) ((vl) / 0x10)
#endif
#ifndef sve_vl_from_vq
-#define sve_vl_from_vq(vq) ((vq) * 0x10)
+#define sve_vl_from_vq(vq) ((vq) *0x10)
#endif
-#define sve_vq_from_vg(vg) (sve_vq_from_vl (sve_vl_from_vg (vg)))
-#define sve_vg_from_vq(vq) (sve_vg_from_vl (sve_vl_from_vq (vq)))
-
+#define sve_vq_from_vg(vg) (sve_vq_from_vl (sve_vl_from_vg (vg)))
+#define sve_vg_from_vq(vq) (sve_vg_from_vl (sve_vl_from_vq (vq)))
/* Maximum supported VQ value. Increase if required. */
-#define AARCH64_MAX_SVE_VQ 16
+#define AARCH64_MAX_SVE_VQ 16
#endif /* ARCH_AARCH64_H */
diff --git a/gdb/arch/arc.c b/gdb/arch/arc.c
index 56e46d03a97..cc2c99186d4 100644
--- a/gdb/arch/arc.c
+++ b/gdb/arch/arc.c
@@ -15,7 +15,6 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
-
#include "gdbsupport/common-defs.h"
#include "arc.h"
#include <stdlib.h>
@@ -46,14 +45,14 @@ arc_create_target_description (const struct arc_arch_features &features)
/* Architecture names here must match the ones in
ARCH_INFO_STRUCT in bfd/cpu-arc.c. */
if (features.isa == ARC_ISA_ARCV1 && features.reg_size == 4)
- arch_name = "arc:ARC700";
+ arch_name = "arc:ARC700";
else if (features.isa == ARC_ISA_ARCV2 && features.reg_size == 4)
- arch_name = "arc:ARCv2";
+ arch_name = "arc:ARCv2";
else
{
- std::string msg = string_printf
- ("Cannot determine architecture: ISA=%d; bitness=%d",
- features.isa, 8 * features.reg_size);
+ std::string msg
+ = string_printf ("Cannot determine architecture: ISA=%d; bitness=%d",
+ features.isa, 8 * features.reg_size);
gdb_assert_not_reached ("%s", msg.c_str ());
}
@@ -73,8 +72,9 @@ arc_create_target_description (const struct arc_arch_features &features)
regnum = create_feature_arc_v2_aux (tdesc.get (), regnum);
break;
default:
- std::string msg = string_printf
- ("Cannot choose target description XML: %d", features.isa);
+ std::string msg
+ = string_printf ("Cannot choose target description XML: %d",
+ features.isa);
gdb_assert_not_reached ("%s", msg.c_str ());
}
@@ -86,8 +86,7 @@ arc_create_target_description (const struct arc_arch_features &features)
/* Wrapper used by std::unordered_map to generate hash for features set. */
struct arc_arch_features_hasher
{
- std::size_t
- operator() (const arc_arch_features &features) const noexcept
+ std::size_t operator() (const arc_arch_features &features) const noexcept
{
return features.hash ();
}
@@ -95,9 +94,9 @@ struct arc_arch_features_hasher
/* Cache of previously created target descriptions, indexed by the hash
of the features set used to create them. */
-static std::unordered_map<arc_arch_features,
- const target_desc_up,
- arc_arch_features_hasher> arc_tdesc_cache;
+static std::unordered_map<arc_arch_features, const target_desc_up,
+ arc_arch_features_hasher>
+ arc_tdesc_cache;
/* See arch/arc.h. */
@@ -113,7 +112,6 @@ arc_lookup_target_description (const struct arc_arch_features &features)
target_desc_up tdesc = arc_create_target_description (features);
-
/* Add to the cache, and return a pointer borrowed from the
target_desc_up. This is safe as the cache (and the pointers
contained within it) are not deleted until GDB exits. */
diff --git a/gdb/arch/arc.h b/gdb/arch/arc.h
index 38dbd0f806d..dd75a6a2333 100644
--- a/gdb/arch/arc.h
+++ b/gdb/arch/arc.h
@@ -23,15 +23,17 @@
/* Supported ARC ISAs. */
enum arc_isa
{
- ARC_ISA_ARCV1 = 1, /* a.k.a. ARCompact (ARC600, ARC700) */
- ARC_ISA_ARCV2 /* such as ARC EM and ARC HS */
+ ARC_ISA_ARCV1 = 1, /* a.k.a. ARCompact (ARC600, ARC700) */
+ ARC_ISA_ARCV2 /* such as ARC EM and ARC HS */
};
struct arc_arch_features
{
arc_arch_features (int reg_size, arc_isa isa)
- : reg_size (reg_size), isa (isa)
- {}
+ : reg_size (reg_size),
+ isa (isa)
+ {
+ }
/* Register size in bytes. Possible values are 4, and 8. A 0 indicates
an uninitialised value. */
@@ -70,18 +72,17 @@ struct arc_arch_features
The only external client of this must be the gdbserver which manipulates
the returned data. */
-target_desc_up arc_create_target_description
- (const struct arc_arch_features &features);
+target_desc_up
+arc_create_target_description (const struct arc_arch_features &features);
#else
/* Lookup the cache for a target description matching the FEATURES.
If nothing is found, then create one and return it. */
-const target_desc *arc_lookup_target_description
- (const struct arc_arch_features &features);
+const target_desc *
+arc_lookup_target_description (const struct arc_arch_features &features);
#endif /* GDBSERVER */
-
#endif /* ARCH_ARC_H */
diff --git a/gdb/arch/arm-get-next-pcs.c b/gdb/arch/arm-get-next-pcs.c
index dcbb5a5e2e6..b5485700924 100644
--- a/gdb/arch/arm-get-next-pcs.c
+++ b/gdb/arch/arm-get-next-pcs.c
@@ -28,10 +28,8 @@
void
arm_get_next_pcs_ctor (struct arm_get_next_pcs *self,
- struct arm_get_next_pcs_ops *ops,
- int byte_order,
- int byte_order_for_code,
- int has_thumb2_breakpoint,
+ struct arm_get_next_pcs_ops *ops, int byte_order,
+ int byte_order_for_code, int has_thumb2_breakpoint,
struct regcache *regcache)
{
self->ops = ops;
@@ -50,7 +48,7 @@ static std::vector<CORE_ADDR>
thumb_deal_with_atomic_sequence_raw (struct arm_get_next_pcs *self)
{
int byte_order_for_code = self->byte_order_for_code;
- CORE_ADDR breaks[2] = {CORE_ADDR_MAX, CORE_ADDR_MAX};
+ CORE_ADDR breaks[2] = { CORE_ADDR_MAX, CORE_ADDR_MAX };
CORE_ADDR pc = regcache_read_pc (self->regcache);
CORE_ADDR loc = pc;
unsigned short insn1, insn2;
@@ -84,7 +82,7 @@ thumb_deal_with_atomic_sequence_raw (struct arm_get_next_pcs *self)
instructions. */
for (insn_count = 0; insn_count < atomic_sequence_length; ++insn_count)
{
- insn1 = self->ops->read_mem_uint (loc, 2,byte_order_for_code);
+ insn1 = self->ops->read_mem_uint (loc, 2, byte_order_for_code);
loc += 2;
if (thumb_insn_size (insn1) != 4)
@@ -118,8 +116,7 @@ thumb_deal_with_atomic_sequence_raw (struct arm_get_next_pcs *self)
/* Assume that there is at most one conditional branch in the
atomic sequence. If a conditional branch is found, put a
breakpoint in its destination address. */
- if ((insn1 & 0xf800) == 0xf000
- && (insn2 & 0xd000) == 0x8000
+ if ((insn1 & 0xf800) == 0xf000 && (insn2 & 0xd000) == 0x8000
&& (insn1 & 0x0380) != 0x0380)
{
int sign, j1, j2, imm1, imm2;
@@ -166,8 +163,7 @@ thumb_deal_with_atomic_sequence_raw (struct arm_get_next_pcs *self)
/* Check for duplicated breakpoints. Check also for a breakpoint
placed (branch instruction's destination) anywhere in sequence. */
if (last_breakpoint
- && (breaks[1] == breaks[0]
- || (breaks[1] >= pc && breaks[1] < loc)))
+ && (breaks[1] == breaks[0] || (breaks[1] >= pc && breaks[1] < loc)))
last_breakpoint = 0;
std::vector<CORE_ADDR> next_pcs;
@@ -188,7 +184,7 @@ static std::vector<CORE_ADDR>
arm_deal_with_atomic_sequence_raw (struct arm_get_next_pcs *self)
{
int byte_order_for_code = self->byte_order_for_code;
- CORE_ADDR breaks[2] = {CORE_ADDR_MAX, CORE_ADDR_MAX};
+ CORE_ADDR breaks[2] = { CORE_ADDR_MAX, CORE_ADDR_MAX };
CORE_ADDR pc = regcache_read_pc (self->regcache);
CORE_ADDR loc = pc;
unsigned int insn;
@@ -248,8 +244,7 @@ arm_deal_with_atomic_sequence_raw (struct arm_get_next_pcs *self)
/* Check for duplicated breakpoints. Check also for a breakpoint
placed (branch instruction's destination) anywhere in sequence. */
if (last_breakpoint
- && (breaks[1] == breaks[0]
- || (breaks[1] >= pc && breaks[1] < loc)))
+ && (breaks[1] == breaks[0] || (breaks[1] >= pc && breaks[1] < loc)))
last_breakpoint = 0;
std::vector<CORE_ADDR> next_pcs;
@@ -269,9 +264,9 @@ thumb_get_next_pcs_raw (struct arm_get_next_pcs *self)
int byte_order = self->byte_order;
int byte_order_for_code = self->byte_order_for_code;
CORE_ADDR pc = regcache_read_pc (self->regcache);
- unsigned long pc_val = ((unsigned long) pc) + 4; /* PC after prefetch */
+ unsigned long pc_val = ((unsigned long) pc) + 4; /* PC after prefetch */
unsigned short inst1;
- CORE_ADDR nextpc = pc + 2; /* Default is next instruction. */
+ CORE_ADDR nextpc = pc + 2; /* Default is next instruction. */
ULONGEST status, itstate;
struct regcache *regcache = self->regcache;
std::vector<CORE_ADDR> next_pcs;
@@ -310,9 +305,9 @@ thumb_get_next_pcs_raw (struct arm_get_next_pcs *self)
itstate = inst1 & 0x00ff;
pc += thumb_insn_size (inst1);
- while (itstate != 0 && ! condition_true (itstate >> 4, status))
+ while (itstate != 0 && !condition_true (itstate >> 4, status))
{
- inst1 = self->ops->read_mem_uint (pc, 2,byte_order_for_code);
+ inst1 = self->ops->read_mem_uint (pc, 2, byte_order_for_code);
pc += thumb_insn_size (inst1);
itstate = thumb_advance_itstate (itstate);
}
@@ -323,15 +318,16 @@ thumb_get_next_pcs_raw (struct arm_get_next_pcs *self)
else if (itstate != 0)
{
/* We are in a conditional block. Check the condition. */
- if (! condition_true (itstate >> 4, status))
+ if (!condition_true (itstate >> 4, status))
{
/* Advance to the next executed instruction. */
pc += thumb_insn_size (inst1);
itstate = thumb_advance_itstate (itstate);
- while (itstate != 0 && ! condition_true (itstate >> 4, status))
+ while (itstate != 0 && !condition_true (itstate >> 4, status))
{
- inst1 = self->ops->read_mem_uint (pc, 2, byte_order_for_code);
+ inst1
+ = self->ops->read_mem_uint (pc, 2, byte_order_for_code);
pc += thumb_insn_size (inst1);
itstate = thumb_advance_itstate (itstate);
@@ -374,7 +370,8 @@ thumb_get_next_pcs_raw (struct arm_get_next_pcs *self)
the instruction after the IT block. */
do
{
- inst1 = self->ops->read_mem_uint (pc, 2, byte_order_for_code);
+ inst1
+ = self->ops->read_mem_uint (pc, 2, byte_order_for_code);
pc += thumb_insn_size (inst1);
itstate = thumb_advance_itstate (itstate);
}
@@ -391,7 +388,7 @@ thumb_get_next_pcs_raw (struct arm_get_next_pcs *self)
/* We are in a conditional block. Check the condition. */
int cond = itstate >> 4;
- if (! condition_true (cond, status))
+ if (!condition_true (cond, status))
{
/* Advance to the next instruction. All the 32-bit
instructions share a common prefix. */
@@ -403,7 +400,7 @@ thumb_get_next_pcs_raw (struct arm_get_next_pcs *self)
/* Otherwise, handle the instruction normally. */
}
- if ((inst1 & 0xff00) == 0xbd00) /* pop {rlist, pc} */
+ if ((inst1 & 0xff00) == 0xbd00) /* pop {rlist, pc} */
{
CORE_ADDR sp;
@@ -414,17 +411,17 @@ thumb_get_next_pcs_raw (struct arm_get_next_pcs *self)
sp = regcache_raw_get_unsigned (regcache, ARM_SP_REGNUM);
nextpc = self->ops->read_mem_uint (sp + offset, 4, byte_order);
}
- else if ((inst1 & 0xf000) == 0xd000) /* conditional branch */
+ else if ((inst1 & 0xf000) == 0xd000) /* conditional branch */
{
unsigned long cond = bits (inst1, 8, 11);
- if (cond == 0x0f) /* 0x0f = SWI */
+ if (cond == 0x0f) /* 0x0f = SWI */
{
nextpc = self->ops->syscall_next_pc (self);
}
else if (cond != 0x0f && condition_true (cond, status))
nextpc = pc_val + (sbits (inst1, 0, 7) << 1);
}
- else if ((inst1 & 0xf800) == 0xe000) /* unconditional branch */
+ else if ((inst1 & 0xf800) == 0xe000) /* unconditional branch */
{
nextpc = pc_val + (sbits (inst1, 0, 10) << 1);
}
@@ -522,7 +519,7 @@ thumb_get_next_pcs_raw (struct arm_get_next_pcs *self)
if (load_pc)
{
CORE_ADDR addr = regcache_raw_get_unsigned (regcache, rn);
- nextpc = self->ops->read_mem_uint (addr + offset, 4, byte_order);
+ nextpc = self->ops->read_mem_uint (addr + offset, 4, byte_order);
}
}
else if ((inst1 & 0xffef) == 0xea4f && (inst2 & 0xfff0) == 0x0f00)
@@ -569,8 +566,7 @@ thumb_get_next_pcs_raw (struct arm_get_next_pcs *self)
load_pc = 0;
if (load_pc)
- nextpc
- = self->ops->read_mem_uint (base, 4, byte_order);
+ nextpc = self->ops->read_mem_uint (base, 4, byte_order);
}
else if ((inst1 & 0xfff0) == 0xe8d0 && (inst2 & 0xfff0) == 0xf000)
{
@@ -579,12 +575,13 @@ thumb_get_next_pcs_raw (struct arm_get_next_pcs *self)
tbl_reg = bits (inst1, 0, 3);
if (tbl_reg == 0x0f)
- table = pc + 4; /* Regcache copy of PC isn't right yet. */
+ table = pc + 4; /* Regcache copy of PC isn't right yet. */
else
table = regcache_raw_get_unsigned (regcache, tbl_reg);
offset = regcache_raw_get_unsigned (regcache, bits (inst2, 0, 3));
- length = 2 * self->ops->read_mem_uint (table + offset, 1, byte_order);
+ length
+ = 2 * self->ops->read_mem_uint (table + offset, 1, byte_order);
nextpc = pc_val + length;
}
else if ((inst1 & 0xfff0) == 0xe8d0 && (inst2 & 0xfff0) == 0xf010)
@@ -594,23 +591,25 @@ thumb_get_next_pcs_raw (struct arm_get_next_pcs *self)
tbl_reg = bits (inst1, 0, 3);
if (tbl_reg == 0x0f)
- table = pc + 4; /* Regcache copy of PC isn't right yet. */
+ table = pc + 4; /* Regcache copy of PC isn't right yet. */
else
table = regcache_raw_get_unsigned (regcache, tbl_reg);
- offset = 2 * regcache_raw_get_unsigned (regcache, bits (inst2, 0, 3));
- length = 2 * self->ops->read_mem_uint (table + offset, 2, byte_order);
+ offset
+ = 2 * regcache_raw_get_unsigned (regcache, bits (inst2, 0, 3));
+ length
+ = 2 * self->ops->read_mem_uint (table + offset, 2, byte_order);
nextpc = pc_val + length;
}
}
- else if ((inst1 & 0xff00) == 0x4700) /* bx REG, blx REG */
+ else if ((inst1 & 0xff00) == 0x4700) /* bx REG, blx REG */
{
if (bits (inst1, 3, 6) == 0x0f)
nextpc = UNMAKE_THUMB_ADDR (pc_val);
else
nextpc = regcache_raw_get_unsigned (regcache, bits (inst1, 3, 6));
}
- else if ((inst1 & 0xff87) == 0x4687) /* mov pc, REG */
+ else if ((inst1 & 0xff87) == 0x4687) /* mov pc, REG */
{
if (bits (inst1, 3, 6) == 0x0f)
nextpc = pc_val;
@@ -661,7 +660,7 @@ arm_get_next_pcs_raw (struct arm_get_next_pcs *self)
this_instr = self->ops->read_mem_uint (pc, 4, byte_order_for_code);
status = regcache_raw_get_unsigned (regcache, ARM_PS_REGNUM);
- nextpc = (CORE_ADDR) (pc_val + 4); /* Default case */
+ nextpc = (CORE_ADDR) (pc_val + 4); /* Default case */
if (bits (this_instr, 28, 31) == INST_NV)
switch (bits (this_instr, 24, 27))
@@ -680,7 +679,7 @@ arm_get_next_pcs_raw (struct arm_get_next_pcs *self)
case 0xe:
/* Coprocessor register transfer. */
if (bits (this_instr, 12, 15) == 15)
- error (_("Invalid update to pc in instruction"));
+ error (_ ("Invalid update to pc in instruction"));
break;
}
else if (condition_true (bits (this_instr, 28, 31), status))
@@ -688,7 +687,7 @@ arm_get_next_pcs_raw (struct arm_get_next_pcs *self)
switch (bits (this_instr, 24, 27))
{
case 0x0:
- case 0x1: /* data processing */
+ case 0x1: /* data processing */
case 0x2:
case 0x3:
{
@@ -700,8 +699,8 @@ arm_get_next_pcs_raw (struct arm_get_next_pcs *self)
break;
if (bits (this_instr, 22, 25) == 0
- && bits (this_instr, 4, 7) == 9) /* multiply */
- error (_("Invalid update to pc in instruction"));
+ && bits (this_instr, 4, 7) == 9) /* multiply */
+ error (_ ("Invalid update to pc in instruction"));
/* BX <reg>, BLX <reg> */
if (bits (this_instr, 4, 27) == 0x12fff1
@@ -709,8 +708,8 @@ arm_get_next_pcs_raw (struct arm_get_next_pcs *self)
{
rn = bits (this_instr, 0, 3);
nextpc = ((rn == ARM_PC_REGNUM)
- ? (pc_val + 8)
- : regcache_raw_get_unsigned (regcache, rn));
+ ? (pc_val + 8)
+ : regcache_raw_get_unsigned (regcache, rn));
next_pcs.push_back (nextpc);
return next_pcs;
@@ -720,84 +719,84 @@ arm_get_next_pcs_raw (struct arm_get_next_pcs *self)
c = (status & FLAG_C) ? 1 : 0;
rn = bits (this_instr, 16, 19);
operand1 = ((rn == ARM_PC_REGNUM)
- ? (pc_val + 8)
- : regcache_raw_get_unsigned (regcache, rn));
+ ? (pc_val + 8)
+ : regcache_raw_get_unsigned (regcache, rn));
if (bit (this_instr, 25))
{
unsigned long immval = bits (this_instr, 0, 7);
unsigned long rotate = 2 * bits (this_instr, 8, 11);
operand2 = ((immval >> rotate) | (immval << (32 - rotate)))
- & 0xffffffff;
+ & 0xffffffff;
}
- else /* operand 2 is a shifted register. */
- operand2 = shifted_reg_val (regcache, this_instr, c,
- pc_val, status);
+ else /* operand 2 is a shifted register. */
+ operand2
+ = shifted_reg_val (regcache, this_instr, c, pc_val, status);
switch (bits (this_instr, 21, 24))
{
- case 0x0: /*and */
+ case 0x0: /*and */
result = operand1 & operand2;
break;
- case 0x1: /*eor */
+ case 0x1: /*eor */
result = operand1 ^ operand2;
break;
- case 0x2: /*sub */
+ case 0x2: /*sub */
result = operand1 - operand2;
break;
- case 0x3: /*rsb */
+ case 0x3: /*rsb */
result = operand2 - operand1;
break;
- case 0x4: /*add */
+ case 0x4: /*add */
result = operand1 + operand2;
break;
- case 0x5: /*adc */
+ case 0x5: /*adc */
result = operand1 + operand2 + c;
break;
- case 0x6: /*sbc */
+ case 0x6: /*sbc */
result = operand1 - operand2 + c;
break;
- case 0x7: /*rsc */
+ case 0x7: /*rsc */
result = operand2 - operand1 + c;
break;
case 0x8:
case 0x9:
case 0xa:
- case 0xb: /* tst, teq, cmp, cmn */
+ case 0xb: /* tst, teq, cmp, cmn */
result = (unsigned long) nextpc;
break;
- case 0xc: /*orr */
+ case 0xc: /*orr */
result = operand1 | operand2;
break;
- case 0xd: /*mov */
+ case 0xd: /*mov */
/* Always step into a function. */
result = operand2;
break;
- case 0xe: /*bic */
+ case 0xe: /*bic */
result = operand1 & ~operand2;
break;
- case 0xf: /*mvn */
+ case 0xf: /*mvn */
result = ~operand2;
break;
}
- nextpc = self->ops->addr_bits_remove (self, result);
+ nextpc = self->ops->addr_bits_remove (self, result);
break;
}
case 0x4:
- case 0x5: /* data transfer */
+ case 0x5: /* data transfer */
case 0x6:
case 0x7:
if (bits (this_instr, 25, 27) == 0x3 && bit (this_instr, 4) == 1)
@@ -817,23 +816,23 @@ arm_get_next_pcs_raw (struct arm_get_next_pcs *self)
unsigned long base;
if (bit (this_instr, 22))
- error (_("Invalid update to pc in instruction"));
+ error (_ ("Invalid update to pc in instruction"));
/* byte write to PC */
rn = bits (this_instr, 16, 19);
base = ((rn == ARM_PC_REGNUM)
- ? (pc_val + 8)
- : regcache_raw_get_unsigned (regcache, rn));
+ ? (pc_val + 8)
+ : regcache_raw_get_unsigned (regcache, rn));
if (bit (this_instr, 24))
{
/* pre-indexed */
int c = (status & FLAG_C) ? 1 : 0;
- unsigned long offset =
- (bit (this_instr, 25)
- ? shifted_reg_val (regcache, this_instr, c,
- pc_val, status)
- : bits (this_instr, 0, 11));
+ unsigned long offset
+ = (bit (this_instr, 25)
+ ? shifted_reg_val (regcache, this_instr, c,
+ pc_val, status)
+ : bits (this_instr, 0, 11));
if (bit (this_instr, 23))
base += offset;
@@ -848,7 +847,7 @@ arm_get_next_pcs_raw (struct arm_get_next_pcs *self)
break;
case 0x8:
- case 0x9: /* block transfer */
+ case 0x9: /* block transfer */
if (bit (this_instr, 20))
{
/* LDM */
@@ -866,21 +865,22 @@ arm_get_next_pcs_raw (struct arm_get_next_pcs *self)
/* up */
unsigned long reglist = bits (this_instr, 0, 14);
offset = count_one_bits_l (reglist) * 4;
- if (bit (this_instr, 24)) /* pre */
+ if (bit (this_instr, 24)) /* pre */
offset += 4;
}
else if (bit (this_instr, 24))
offset = -4;
rn_val_offset = rn_val + offset;
- nextpc = (CORE_ADDR) self->ops->read_mem_uint (rn_val_offset,
- 4, byte_order);
+ nextpc
+ = (CORE_ADDR) self->ops->read_mem_uint (rn_val_offset, 4,
+ byte_order);
}
}
break;
- case 0xb: /* branch & link */
- case 0xa: /* branch */
+ case 0xb: /* branch & link */
+ case 0xa: /* branch */
{
nextpc = BranchDest (pc, this_instr);
break;
@@ -888,16 +888,16 @@ arm_get_next_pcs_raw (struct arm_get_next_pcs *self)
case 0xc:
case 0xd:
- case 0xe: /* coproc ops */
+ case 0xe: /* coproc ops */
break;
- case 0xf: /* SWI */
+ case 0xf: /* SWI */
{
nextpc = self->ops->syscall_next_pc (self);
}
break;
default:
- error (_("Bad bit-field extraction"));
+ error (_ ("Bad bit-field extraction"));
return next_pcs;
}
}
diff --git a/gdb/arch/arm-get-next-pcs.h b/gdb/arch/arm-get-next-pcs.h
index e6bb8d83228..583046eed44 100644
--- a/gdb/arch/arm-get-next-pcs.h
+++ b/gdb/arch/arm-get-next-pcs.h
@@ -55,10 +55,8 @@ struct arm_get_next_pcs
/* Initialize arm_get_next_pcs. */
void arm_get_next_pcs_ctor (struct arm_get_next_pcs *self,
- struct arm_get_next_pcs_ops *ops,
- int byte_order,
- int byte_order_for_code,
- int has_thumb2_breakpoint,
+ struct arm_get_next_pcs_ops *ops, int byte_order,
+ int byte_order_for_code, int has_thumb2_breakpoint,
struct regcache *regcache);
/* Find the next possible PCs after the current instruction executes. */
diff --git a/gdb/arch/arm-linux.c b/gdb/arch/arm-linux.c
index bafbc523ee0..5fbf2a31d11 100644
--- a/gdb/arch/arm-linux.c
+++ b/gdb/arch/arm-linux.c
@@ -26,10 +26,8 @@
/* Calculate the offset from stack pointer of the pc register on the stack
in the case of a sigreturn or sigreturn_rt syscall. */
int
-arm_linux_sigreturn_next_pc_offset (unsigned long sp,
- unsigned long sp_data,
- unsigned long svc_number,
- int is_sigreturn)
+arm_linux_sigreturn_next_pc_offset (unsigned long sp, unsigned long sp_data,
+ unsigned long svc_number, int is_sigreturn)
{
/* Offset of R0 register. */
int r0_offset = 0;
@@ -62,8 +60,7 @@ arm_linux_sigreturn_next_pc_offset (unsigned long sp,
for arm-linux. */
CORE_ADDR
-arm_linux_get_next_pcs_fixup (struct arm_get_next_pcs *self,
- CORE_ADDR nextpc)
+arm_linux_get_next_pcs_fixup (struct arm_get_next_pcs *self, CORE_ADDR nextpc)
{
/* The Linux kernel offers some user-mode helpers in a high page. We can
not read this page (as of 2.6.23), and even if we could then we
@@ -119,7 +116,7 @@ arm_linux_get_next_pcs_fixup (struct arm_get_next_pcs *self,
}
else
{
- if (bits (insn, 24, 27) == 0xb /* BL <label> */
+ if (bits (insn, 24, 27) == 0xb /* BL <label> */
|| bits (insn, 4, 27) == 0x12fff3 /* BLX Rm */)
bl_blx_p = 1;
}
diff --git a/gdb/arch/arm-linux.h b/gdb/arch/arm-linux.h
index 8432990b88e..b38702f8f02 100644
--- a/gdb/arch/arm-linux.h
+++ b/gdb/arch/arm-linux.h
@@ -68,11 +68,10 @@
#define ARM_NEW_SIGFRAME_MAGIC 0x5ac3c35a
-int
-arm_linux_sigreturn_next_pc_offset (unsigned long sp,
- unsigned long sp_data,
- unsigned long svc_number,
- int is_sigreturn);
+int arm_linux_sigreturn_next_pc_offset (unsigned long sp,
+ unsigned long sp_data,
+ unsigned long svc_number,
+ int is_sigreturn);
struct arm_get_next_pcs;
diff --git a/gdb/arch/arm.c b/gdb/arch/arm.c
index 4720c201c53..dfff5fd66b9 100644
--- a/gdb/arch/arm.c
+++ b/gdb/arch/arm.c
@@ -88,7 +88,6 @@ condition_true (unsigned long cond, unsigned long status_reg)
return 1;
}
-
/* See arm.h. */
int
@@ -123,7 +122,7 @@ arm_instruction_changes_pc (uint32_t this_instr)
case 0xe:
/* Coprocessor register transfer. */
if (bits (this_instr, 12, 15) == 15)
- error (_("Invalid update to pc in instruction"));
+ error (_ ("Invalid update to pc in instruction"));
return 0;
default:
return 0;
@@ -194,7 +193,7 @@ arm_instruction_changes_pc (uint32_t this_instr)
return 0;
default:
- internal_error (_("bad value in switch"));
+ internal_error (_ ("bad value in switch"));
}
}
@@ -203,28 +202,27 @@ arm_instruction_changes_pc (uint32_t this_instr)
int
thumb_instruction_changes_pc (unsigned short inst)
{
- if ((inst & 0xff00) == 0xbd00) /* pop {rlist, pc} */
+ if ((inst & 0xff00) == 0xbd00) /* pop {rlist, pc} */
return 1;
- if ((inst & 0xf000) == 0xd000) /* conditional branch */
+ if ((inst & 0xf000) == 0xd000) /* conditional branch */
return 1;
- if ((inst & 0xf800) == 0xe000) /* unconditional branch */
+ if ((inst & 0xf800) == 0xe000) /* unconditional branch */
return 1;
- if ((inst & 0xff00) == 0x4700) /* bx REG, blx REG */
+ if ((inst & 0xff00) == 0x4700) /* bx REG, blx REG */
return 1;
- if ((inst & 0xff87) == 0x4687) /* mov pc, REG */
+ if ((inst & 0xff87) == 0x4687) /* mov pc, REG */
return 1;
- if ((inst & 0xf500) == 0xb100) /* CBNZ or CBZ. */
+ if ((inst & 0xf500) == 0xb100) /* CBNZ or CBZ. */
return 1;
return 0;
}
-
/* See arm.h. */
int
@@ -322,8 +320,8 @@ thumb2_instruction_changes_pc (unsigned short inst1, unsigned short inst2)
/* See arm.h. */
unsigned long
-shifted_reg_val (struct regcache *regcache, unsigned long inst,
- int carry, unsigned long pc_val, unsigned long status_reg)
+shifted_reg_val (struct regcache *regcache, unsigned long inst, int carry,
+ unsigned long pc_val, unsigned long status_reg)
{
unsigned long res, shift;
int rm = bits (inst, 0, 3);
@@ -332,35 +330,33 @@ shifted_reg_val (struct regcache *regcache, unsigned long inst,
if (bit (inst, 4))
{
int rs = bits (inst, 8, 11);
- shift = (rs == 15
- ? pc_val + 8
- : regcache_raw_get_unsigned (regcache, rs)) & 0xFF;
+ shift
+ = (rs == 15 ? pc_val + 8 : regcache_raw_get_unsigned (regcache, rs))
+ & 0xFF;
}
else
shift = bits (inst, 7, 11);
- res = (rm == ARM_PC_REGNUM
- ? (pc_val + (bit (inst, 4) ? 12 : 8))
- : regcache_raw_get_unsigned (regcache, rm));
+ res = (rm == ARM_PC_REGNUM ? (pc_val + (bit (inst, 4) ? 12 : 8))
+ : regcache_raw_get_unsigned (regcache, rm));
switch (shifttype)
{
- case 0: /* LSL */
+ case 0: /* LSL */
res = shift >= 32 ? 0 : res << shift;
break;
- case 1: /* LSR */
+ case 1: /* LSR */
res = shift >= 32 ? 0 : res >> shift;
break;
- case 2: /* ASR */
+ case 2: /* ASR */
if (shift >= 32)
shift = 31;
- res = ((res & 0x80000000L)
- ? ~((~res) >> shift) : res >> shift);
+ res = ((res & 0x80000000L) ? ~((~res) >> shift) : res >> shift);
break;
- case 3: /* ROR/RRX */
+ case 3: /* ROR/RRX */
shift &= 31;
if (shift == 0)
res = (res >> 1) | (carry ? 0x80000000L : 0);
@@ -408,7 +404,7 @@ arm_create_target_description (arm_fp_type fp_type, bool tls)
break;
default:
- error (_("Invalid Arm FP type: %d"), fp_type);
+ error (_ ("Invalid Arm FP type: %d"), fp_type);
}
if (tls)
@@ -457,7 +453,7 @@ arm_create_mprofile_target_description (arm_m_profile_type m_type)
break;
default:
- error (_("Invalid Arm M type: %d"), m_type);
+ error (_ ("Invalid Arm M type: %d"), m_type);
}
return tdesc;
diff --git a/gdb/arch/arm.h b/gdb/arch/arm.h
index c64a15600de..7f68251c03c 100644
--- a/gdb/arch/arm.h
+++ b/gdb/arch/arm.h
@@ -22,56 +22,59 @@
#include "gdbsupport/tdesc.h"
/* Prologue helper macros for ARMv8.1-m PACBTI. */
-#define IS_PAC(instruction) (instruction == 0xf3af801d)
-#define IS_PACBTI(instruction) (instruction == 0xf3af800d)
-#define IS_BTI(instruction) (instruction == 0xf3af800f)
-#define IS_PACG(instruction) ((instruction & 0xfff0f0f0) == 0xfb60f000)
-#define IS_AUT(instruction) (instruction == 0xf3af802d)
-#define IS_AUTG(instruction) ((instruction & 0xfff00ff0) == 0xfb500f00)
+#define IS_PAC(instruction) (instruction == 0xf3af801d)
+#define IS_PACBTI(instruction) (instruction == 0xf3af800d)
+#define IS_BTI(instruction) (instruction == 0xf3af800f)
+#define IS_PACG(instruction) ((instruction & 0xfff0f0f0) == 0xfb60f000)
+#define IS_AUT(instruction) (instruction == 0xf3af802d)
+#define IS_AUTG(instruction) ((instruction & 0xfff00ff0) == 0xfb500f00)
/* DWARF register numbers according to the AADWARF32 document. */
-enum arm_dwarf_regnum {
+enum arm_dwarf_regnum
+{
ARM_DWARF_RA_AUTH_CODE = 143
};
/* Register numbers of various important registers. */
-enum gdb_regnum {
- ARM_A1_REGNUM = 0, /* first integer-like argument */
- ARM_A4_REGNUM = 3, /* last integer-like argument */
+enum gdb_regnum
+{
+ ARM_A1_REGNUM = 0, /* first integer-like argument */
+ ARM_A4_REGNUM = 3, /* last integer-like argument */
ARM_AP_REGNUM = 11,
ARM_IP_REGNUM = 12,
- ARM_SP_REGNUM = 13, /* Contains address of top of stack */
- ARM_LR_REGNUM = 14, /* address to return to from a function call */
- ARM_PC_REGNUM = 15, /* Contains program counter */
+ ARM_SP_REGNUM = 13, /* Contains address of top of stack */
+ ARM_LR_REGNUM = 14, /* address to return to from a function call */
+ ARM_PC_REGNUM = 15, /* Contains program counter */
/* F0..F7 are the fp registers for the (obsolete) FPA architecture. */
- ARM_F0_REGNUM = 16, /* first floating point register */
- ARM_F3_REGNUM = 19, /* last floating point argument register */
- ARM_F7_REGNUM = 23, /* last floating point register */
- ARM_FPS_REGNUM = 24, /* floating point status register */
- ARM_PS_REGNUM = 25, /* Contains processor status */
- ARM_WR0_REGNUM, /* WMMX data registers. */
+ ARM_F0_REGNUM = 16, /* first floating point register */
+ ARM_F3_REGNUM = 19, /* last floating point argument register */
+ ARM_F7_REGNUM = 23, /* last floating point register */
+ ARM_FPS_REGNUM = 24, /* floating point status register */
+ ARM_PS_REGNUM = 25, /* Contains processor status */
+ ARM_WR0_REGNUM, /* WMMX data registers. */
ARM_WR15_REGNUM = ARM_WR0_REGNUM + 15,
- ARM_WC0_REGNUM, /* WMMX control registers. */
+ ARM_WC0_REGNUM, /* WMMX control registers. */
ARM_WCSSF_REGNUM = ARM_WC0_REGNUM + 2,
ARM_WCASF_REGNUM = ARM_WC0_REGNUM + 3,
ARM_WC7_REGNUM = ARM_WC0_REGNUM + 7,
- ARM_WCGR0_REGNUM, /* WMMX general purpose registers. */
+ ARM_WCGR0_REGNUM, /* WMMX general purpose registers. */
ARM_WCGR3_REGNUM = ARM_WCGR0_REGNUM + 3,
ARM_WCGR7_REGNUM = ARM_WCGR0_REGNUM + 7,
- ARM_D0_REGNUM, /* VFP double-precision registers. */
+ ARM_D0_REGNUM, /* VFP double-precision registers. */
ARM_D31_REGNUM = ARM_D0_REGNUM + 31,
ARM_FPSCR_REGNUM,
/* Other useful registers. */
- ARM_FP_REGNUM = 11, /* Frame register in ARM code, if used. */
- THUMB_FP_REGNUM = 7, /* Frame register in Thumb code, if used. */
+ ARM_FP_REGNUM = 11, /* Frame register in ARM code, if used. */
+ THUMB_FP_REGNUM = 7, /* Frame register in Thumb code, if used. */
ARM_LAST_ARG_REGNUM = ARM_A4_REGNUM,
ARM_LAST_FP_ARG_REGNUM = ARM_F3_REGNUM
};
/* Register count constants. */
-enum arm_register_counts {
+enum arm_register_counts
+{
/* Number of Q registers for MVE. */
ARM_MVE_NUM_Q_REGS = 8,
/* Number of argument registers. */
@@ -85,28 +88,30 @@ enum arm_register_counts {
/* Enum describing the different kinds of breakpoints. */
enum arm_breakpoint_kinds
{
- ARM_BP_KIND_THUMB = 2,
- ARM_BP_KIND_THUMB2 = 3,
- ARM_BP_KIND_ARM = 4,
+ ARM_BP_KIND_THUMB = 2,
+ ARM_BP_KIND_THUMB2 = 3,
+ ARM_BP_KIND_ARM = 4,
};
/* Supported Arm FP hardware types. */
-enum arm_fp_type {
- ARM_FP_TYPE_NONE = 0,
- ARM_FP_TYPE_VFPV2,
- ARM_FP_TYPE_VFPV3,
- ARM_FP_TYPE_IWMMXT,
- ARM_FP_TYPE_INVALID
+enum arm_fp_type
+{
+ ARM_FP_TYPE_NONE = 0,
+ ARM_FP_TYPE_VFPV2,
+ ARM_FP_TYPE_VFPV3,
+ ARM_FP_TYPE_IWMMXT,
+ ARM_FP_TYPE_INVALID
};
/* Supported M-profile Arm types. */
-enum arm_m_profile_type {
- ARM_M_TYPE_M_PROFILE,
- ARM_M_TYPE_VFP_D16,
- ARM_M_TYPE_WITH_FPA,
- ARM_M_TYPE_MVE,
- ARM_M_TYPE_SYSTEM,
- ARM_M_TYPE_INVALID
+enum arm_m_profile_type
+{
+ ARM_M_TYPE_M_PROFILE,
+ ARM_M_TYPE_VFP_D16,
+ ARM_M_TYPE_WITH_FPA,
+ ARM_M_TYPE_MVE,
+ ARM_M_TYPE_SYSTEM,
+ ARM_M_TYPE_INVALID
};
/* System control registers accessible through an addresses. */
@@ -124,39 +129,39 @@ enum system_register_address : CORE_ADDR
};
/* Instruction condition field values. */
-#define INST_EQ 0x0
-#define INST_NE 0x1
-#define INST_CS 0x2
-#define INST_CC 0x3
-#define INST_MI 0x4
-#define INST_PL 0x5
-#define INST_VS 0x6
-#define INST_VC 0x7
-#define INST_HI 0x8
-#define INST_LS 0x9
-#define INST_GE 0xa
-#define INST_LT 0xb
-#define INST_GT 0xc
-#define INST_LE 0xd
-#define INST_AL 0xe
-#define INST_NV 0xf
-
-#define FLAG_N 0x80000000
-#define FLAG_Z 0x40000000
-#define FLAG_C 0x20000000
-#define FLAG_V 0x10000000
-
-#define CPSR_T 0x20
-
-#define XPSR_T 0x01000000
+#define INST_EQ 0x0
+#define INST_NE 0x1
+#define INST_CS 0x2
+#define INST_CC 0x3
+#define INST_MI 0x4
+#define INST_PL 0x5
+#define INST_VS 0x6
+#define INST_VC 0x7
+#define INST_HI 0x8
+#define INST_LS 0x9
+#define INST_GE 0xa
+#define INST_LT 0xb
+#define INST_GT 0xc
+#define INST_LE 0xd
+#define INST_AL 0xe
+#define INST_NV 0xf
+
+#define FLAG_N 0x80000000
+#define FLAG_Z 0x40000000
+#define FLAG_C 0x20000000
+#define FLAG_V 0x10000000
+
+#define CPSR_T 0x20
+
+#define XPSR_T 0x01000000
/* Size of registers. */
-#define ARM_INT_REGISTER_SIZE 4
+#define ARM_INT_REGISTER_SIZE 4
/* IEEE extended doubles are 80 bits. DWORD aligned they use 96 bits. */
-#define ARM_FP_REGISTER_SIZE 12
-#define ARM_VFP_REGISTER_SIZE 8
-#define IWMMXT_VEC_REGISTER_SIZE 8
+#define ARM_FP_REGISTER_SIZE 12
+#define ARM_VFP_REGISTER_SIZE 8
+#define IWMMXT_VEC_REGISTER_SIZE 8
/* Size of register sets. */
@@ -169,22 +174,22 @@ enum system_register_address : CORE_ADDR
/* d0-d31,fpscr. */
#define ARM_VFP3_REGS_SIZE (32 * ARM_VFP_REGISTER_SIZE + ARM_INT_REGISTER_SIZE)
/* wR0-wR15,fpscr. */
-#define IWMMXT_REGS_SIZE (16 * IWMMXT_VEC_REGISTER_SIZE \
- + 6 * ARM_INT_REGISTER_SIZE)
+#define IWMMXT_REGS_SIZE \
+ (16 * IWMMXT_VEC_REGISTER_SIZE + 6 * ARM_INT_REGISTER_SIZE)
/* Addresses for calling Thumb functions have the bit 0 set.
Here are some macros to test, set, or clear bit 0 of addresses. */
-#define IS_THUMB_ADDR(addr) ((addr) & 1)
-#define MAKE_THUMB_ADDR(addr) ((addr) | 1)
+#define IS_THUMB_ADDR(addr) ((addr) &1)
+#define MAKE_THUMB_ADDR(addr) ((addr) | 1)
#define UNMAKE_THUMB_ADDR(addr) ((addr) & ~1)
/* Support routines for instruction parsing. */
#define submask(x) ((1L << ((x) + 1)) - 1)
-#define bits(obj,st,fn) (((obj) >> (st)) & submask ((fn) - (st)))
-#define bit(obj,st) (((obj) >> (st)) & 1)
-#define sbits(obj,st,fn) \
- ((long) (bits(obj,st,fn) | ((long) bit(obj,fn) * ~ submask (fn - st))))
-#define BranchDest(addr,instr) \
+#define bits(obj, st, fn) (((obj) >> (st)) & submask ((fn) - (st)))
+#define bit(obj, st) (((obj) >> (st)) & 1)
+#define sbits(obj, st, fn) \
+ ((long) (bits (obj, st, fn) | ((long) bit (obj, fn) * ~submask (fn - st))))
+#define BranchDest(addr, instr) \
((CORE_ADDR) (((unsigned long) (addr)) + 8 + (sbits (instr, 0, 23) << 2)))
/* Forward declaration. */
@@ -213,10 +218,8 @@ int thumb_advance_itstate (unsigned int itstate);
/* Decode shifted register value. */
-unsigned long shifted_reg_val (struct regcache *regcache,
- unsigned long inst,
- int carry,
- unsigned long pc_val,
+unsigned long shifted_reg_val (struct regcache *regcache, unsigned long inst,
+ int carry, unsigned long pc_val,
unsigned long status_reg);
/* Create an Arm target description with the given FP hardware type. */
@@ -225,6 +228,7 @@ target_desc *arm_create_target_description (arm_fp_type fp_type, bool tls);
/* Create an Arm M-profile target description with the given hardware type. */
-target_desc *arm_create_mprofile_target_description (arm_m_profile_type m_type);
+target_desc *
+arm_create_mprofile_target_description (arm_m_profile_type m_type);
#endif /* ARCH_ARM_H */
diff --git a/gdb/arch/loongarch.c b/gdb/arch/loongarch.c
index 168fcbc15df..5b2bada32de 100644
--- a/gdb/arch/loongarch.c
+++ b/gdb/arch/loongarch.c
@@ -33,7 +33,8 @@
#endif
STATIC_IN_GDB target_desc_up
-loongarch_create_target_description (const struct loongarch_gdbarch_features features)
+loongarch_create_target_description (
+ const struct loongarch_gdbarch_features features)
{
/* Now we should create a new target description. */
target_desc_up tdesc = allocate_target_description ();
@@ -80,12 +81,13 @@ struct loongarch_gdbarch_features_hasher
/* Cache of previously seen target descriptions, indexed by the feature set
that created them. */
-static std::unordered_map<loongarch_gdbarch_features,
- const target_desc_up,
- loongarch_gdbarch_features_hasher> loongarch_tdesc_cache;
+static std::unordered_map<loongarch_gdbarch_features, const target_desc_up,
+ loongarch_gdbarch_features_hasher>
+ loongarch_tdesc_cache;
const target_desc *
-loongarch_lookup_target_description (const struct loongarch_gdbarch_features features)
+loongarch_lookup_target_description (
+ const struct loongarch_gdbarch_features features)
{
/* Lookup in the cache. If we find it then return the pointer out of
the target_desc_up (which is a unique_ptr). This is safe as the
diff --git a/gdb/arch/loongarch.h b/gdb/arch/loongarch.h
index d0a63dc2ac5..c9ada1b5150 100644
--- a/gdb/arch/loongarch.h
+++ b/gdb/arch/loongarch.h
@@ -25,20 +25,22 @@
/* Register numbers of various important registers. */
enum loongarch_regnum
{
- LOONGARCH_RA_REGNUM = 1, /* Return Address. */
- LOONGARCH_SP_REGNUM = 3, /* Stack Pointer. */
- LOONGARCH_A0_REGNUM = 4, /* First Argument/Return Value. */
- LOONGARCH_A7_REGNUM = 11, /* Seventh Argument/Syscall Number. */
- LOONGARCH_FP_REGNUM = 22, /* Frame Pointer. */
- LOONGARCH_ORIG_A0_REGNUM = 32, /* Syscall's original arg0. */
- LOONGARCH_PC_REGNUM = 33, /* Program Counter. */
- LOONGARCH_BADV_REGNUM = 34, /* Bad Vaddr for Addressing Exception. */
- LOONGARCH_LINUX_NUM_GREGSET = 45, /* 32 GPR, ORIG_A0, PC, BADV, RESERVED 10. */
- LOONGARCH_ARG_REGNUM = 8, /* r4-r11: general-purpose argument registers.
+ LOONGARCH_RA_REGNUM = 1, /* Return Address. */
+ LOONGARCH_SP_REGNUM = 3, /* Stack Pointer. */
+ LOONGARCH_A0_REGNUM = 4, /* First Argument/Return Value. */
+ LOONGARCH_A7_REGNUM = 11, /* Seventh Argument/Syscall Number. */
+ LOONGARCH_FP_REGNUM = 22, /* Frame Pointer. */
+ LOONGARCH_ORIG_A0_REGNUM = 32, /* Syscall's original arg0. */
+ LOONGARCH_PC_REGNUM = 33, /* Program Counter. */
+ LOONGARCH_BADV_REGNUM = 34, /* Bad Vaddr for Addressing Exception. */
+ LOONGARCH_LINUX_NUM_GREGSET
+ = 45, /* 32 GPR, ORIG_A0, PC, BADV, RESERVED 10. */
+ LOONGARCH_ARG_REGNUM = 8, /* r4-r11: general-purpose argument registers.
f0-f7: floating-point argument registers. */
LOONGARCH_FIRST_FP_REGNUM = LOONGARCH_LINUX_NUM_GREGSET,
LOONGARCH_LINUX_NUM_FPREGSET = 32,
- LOONGARCH_FIRST_FCC_REGNUM = LOONGARCH_FIRST_FP_REGNUM + LOONGARCH_LINUX_NUM_FPREGSET,
+ LOONGARCH_FIRST_FCC_REGNUM
+ = LOONGARCH_FIRST_FP_REGNUM + LOONGARCH_LINUX_NUM_FPREGSET,
LOONGARCH_LINUX_NUM_FCC = 8,
LOONGARCH_FCSR_REGNUM = LOONGARCH_FIRST_FCC_REGNUM + LOONGARCH_LINUX_NUM_FCC,
};
@@ -98,8 +100,8 @@ struct loongarch_gdbarch_features
This is only used directly from the gdbserver where the created target
description is modified after it is return. */
-target_desc_up loongarch_create_target_description
- (const struct loongarch_gdbarch_features features);
+target_desc_up loongarch_create_target_description (
+ const struct loongarch_gdbarch_features features);
#else
@@ -110,8 +112,8 @@ target_desc_up loongarch_create_target_description
GDBARCH_LIST_LOOKUP_BY_INFO performs a pointer comparison on target
descriptions to find candidate gdbarch objects. */
-const target_desc *loongarch_lookup_target_description
- (const struct loongarch_gdbarch_features features);
+const target_desc *loongarch_lookup_target_description (
+ const struct loongarch_gdbarch_features features);
#endif /* GDBSERVER */
diff --git a/gdb/arch/ppc-linux-common.c b/gdb/arch/ppc-linux-common.c
index 93f1c2ef5d5..dd7e0bb3421 100644
--- a/gdb/arch/ppc-linux-common.c
+++ b/gdb/arch/ppc-linux-common.c
@@ -27,7 +27,7 @@
when debugging core files, which might not provide this constant. */
#ifndef PPC_FEATURE_HAS_DFP
-#define PPC_FEATURE_HAS_DFP 0x00000400
+#define PPC_FEATURE_HAS_DFP 0x00000400
#endif
bool
@@ -51,34 +51,34 @@ ppc_linux_match_description (struct ppc_linux_features features)
if (features.wordsize == 8)
{
if (features.vsx)
- tdesc = (features.htm? tdesc_powerpc_isa207_htm_vsx64l
- : features.isa207? tdesc_powerpc_isa207_vsx64l
- : features.ppr_dscr? tdesc_powerpc_isa205_ppr_dscr_vsx64l
- : features.isa205? tdesc_powerpc_isa205_vsx64l
- : tdesc_powerpc_vsx64l);
+ tdesc = (features.htm ? tdesc_powerpc_isa207_htm_vsx64l
+ : features.isa207 ? tdesc_powerpc_isa207_vsx64l
+ : features.ppr_dscr ? tdesc_powerpc_isa205_ppr_dscr_vsx64l
+ : features.isa205 ? tdesc_powerpc_isa205_vsx64l
+ : tdesc_powerpc_vsx64l);
else if (features.altivec)
- tdesc = (features.isa205? tdesc_powerpc_isa205_altivec64l
- : tdesc_powerpc_altivec64l);
+ tdesc = (features.isa205 ? tdesc_powerpc_isa205_altivec64l
+ : tdesc_powerpc_altivec64l);
else
- tdesc = (features.isa205? tdesc_powerpc_isa205_64l
- : tdesc_powerpc_64l);
+ tdesc
+ = (features.isa205 ? tdesc_powerpc_isa205_64l : tdesc_powerpc_64l);
}
else
{
gdb_assert (features.wordsize == 4);
if (features.vsx)
- tdesc = (features.htm? tdesc_powerpc_isa207_htm_vsx32l
- : features.isa207? tdesc_powerpc_isa207_vsx32l
- : features.ppr_dscr? tdesc_powerpc_isa205_ppr_dscr_vsx32l
- : features.isa205? tdesc_powerpc_isa205_vsx32l
- : tdesc_powerpc_vsx32l);
+ tdesc = (features.htm ? tdesc_powerpc_isa207_htm_vsx32l
+ : features.isa207 ? tdesc_powerpc_isa207_vsx32l
+ : features.ppr_dscr ? tdesc_powerpc_isa205_ppr_dscr_vsx32l
+ : features.isa205 ? tdesc_powerpc_isa205_vsx32l
+ : tdesc_powerpc_vsx32l);
else if (features.altivec)
- tdesc = (features.isa205? tdesc_powerpc_isa205_altivec32l
- : tdesc_powerpc_altivec32l);
+ tdesc = (features.isa205 ? tdesc_powerpc_isa205_altivec32l
+ : tdesc_powerpc_altivec32l);
else
- tdesc = (features.isa205? tdesc_powerpc_isa205_32l
- : tdesc_powerpc_32l);
+ tdesc
+ = (features.isa205 ? tdesc_powerpc_isa205_32l : tdesc_powerpc_32l);
}
gdb_assert (tdesc != NULL);
diff --git a/gdb/arch/ppc-linux-common.h b/gdb/arch/ppc-linux-common.h
index 8b9ba706f30..c2e37a0059d 100644
--- a/gdb/arch/ppc-linux-common.h
+++ b/gdb/arch/ppc-linux-common.h
@@ -33,14 +33,14 @@ struct target_desc;
#define PPC_LINUX_SIZEOF_PPRREGSET 8
#define PPC_LINUX_SIZEOF_DSCRREGSET 8
#define PPC_LINUX_SIZEOF_TARREGSET 8
-#define PPC_LINUX_SIZEOF_EBBREGSET (3*8)
-#define PPC_LINUX_SIZEOF_PMUREGSET (5*8)
-#define PPC_LINUX_SIZEOF_TM_SPRREGSET (3*8)
-#define PPC32_LINUX_SIZEOF_CGPRREGSET (48*4)
-#define PPC64_LINUX_SIZEOF_CGPRREGSET (48*8)
-#define PPC_LINUX_SIZEOF_CFPRREGSET (32*8+8)
-#define PPC_LINUX_SIZEOF_CVMXREGSET (34*16)
-#define PPC_LINUX_SIZEOF_CVSXREGSET (32*8)
+#define PPC_LINUX_SIZEOF_EBBREGSET (3 * 8)
+#define PPC_LINUX_SIZEOF_PMUREGSET (5 * 8)
+#define PPC_LINUX_SIZEOF_TM_SPRREGSET (3 * 8)
+#define PPC32_LINUX_SIZEOF_CGPRREGSET (48 * 4)
+#define PPC64_LINUX_SIZEOF_CGPRREGSET (48 * 8)
+#define PPC_LINUX_SIZEOF_CFPRREGSET (32 * 8 + 8)
+#define PPC_LINUX_SIZEOF_CVMXREGSET (34 * 16)
+#define PPC_LINUX_SIZEOF_CVSXREGSET (32 * 8)
#define PPC_LINUX_SIZEOF_CPPRREGSET 8
#define PPC_LINUX_SIZEOF_CDSCRREGSET 8
#define PPC_LINUX_SIZEOF_CTARREGSET 8
@@ -62,17 +62,11 @@ struct ppc_linux_features
/* Base value for ppc_linux_features variables. */
const struct ppc_linux_features ppc_linux_no_features = {
- 0,
- false,
- false,
- false,
- false,
- false,
- false,
+ 0, false, false, false, false, false, false,
};
/* Return a target description that matches FEATURES. */
-const struct target_desc * ppc_linux_match_description
-(struct ppc_linux_features features);
+const struct target_desc *
+ppc_linux_match_description (struct ppc_linux_features features);
#endif /* ARCH_PPC_LINUX_COMMON_H */
diff --git a/gdb/arch/riscv.c b/gdb/arch/riscv.c
index 6f6fcb081e8..dae4eea1ff1 100644
--- a/gdb/arch/riscv.c
+++ b/gdb/arch/riscv.c
@@ -88,7 +88,7 @@ riscv_create_target_description (const struct riscv_gdbarch_features features)
targets. We don't support creating vector features on native targets
(yet). */
if (features.vlen != 0)
- error (_("unable to create vector feature"));
+ error (_ ("unable to create vector feature"));
return tdesc;
}
@@ -107,9 +107,9 @@ struct riscv_gdbarch_features_hasher
/* Cache of previously seen target descriptions, indexed by the feature set
that created them. */
-static std::unordered_map<riscv_gdbarch_features,
- const target_desc_up,
- riscv_gdbarch_features_hasher> riscv_tdesc_cache;
+static std::unordered_map<riscv_gdbarch_features, const target_desc_up,
+ riscv_gdbarch_features_hasher>
+ riscv_tdesc_cache;
/* See arch/riscv.h. */
diff --git a/gdb/arch/riscv.h b/gdb/arch/riscv.h
index 54610ed6c16..0e14cd9a9c6 100644
--- a/gdb/arch/riscv.h
+++ b/gdb/arch/riscv.h
@@ -67,9 +67,8 @@ struct riscv_gdbarch_features
/* Equality operator. */
bool operator== (const struct riscv_gdbarch_features &rhs) const
{
- return (xlen == rhs.xlen && flen == rhs.flen
- && embedded == rhs.embedded && vlen == rhs.vlen
- && has_fflags_reg == rhs.has_fflags_reg
+ return (xlen == rhs.xlen && flen == rhs.flen && embedded == rhs.embedded
+ && vlen == rhs.vlen && has_fflags_reg == rhs.has_fflags_reg
&& has_frm_reg == rhs.has_frm_reg
&& has_fcsr_reg == rhs.has_fcsr_reg);
}
@@ -83,13 +82,10 @@ struct riscv_gdbarch_features
/* Used by std::unordered_map to hash feature sets. */
std::size_t hash () const noexcept
{
- std::size_t val = ((embedded ? 1 : 0) << 10
- | (has_fflags_reg ? 1 : 0) << 11
- | (has_frm_reg ? 1 : 0) << 12
- | (has_fcsr_reg ? 1 : 0) << 13
- | (xlen & 0x1f) << 5
- | (flen & 0x1f) << 0
- | (vlen & 0xfff) << 14);
+ std::size_t val
+ = ((embedded ? 1 : 0) << 10 | (has_fflags_reg ? 1 : 0) << 11
+ | (has_frm_reg ? 1 : 0) << 12 | (has_fcsr_reg ? 1 : 0) << 13
+ | (xlen & 0x1f) << 5 | (flen & 0x1f) << 0 | (vlen & 0xfff) << 14);
return val;
}
};
@@ -100,8 +96,8 @@ struct riscv_gdbarch_features
This is only used directly from the gdbserver where the created target
description is modified after it is return. */
-target_desc_up riscv_create_target_description
- (const struct riscv_gdbarch_features features);
+target_desc_up
+riscv_create_target_description (const struct riscv_gdbarch_features features);
#else
@@ -112,10 +108,9 @@ target_desc_up riscv_create_target_description
GDBARCH_LIST_LOOKUP_BY_INFO performs a pointer comparison on target
descriptions to find candidate gdbarch objects. */
-const target_desc *riscv_lookup_target_description
- (const struct riscv_gdbarch_features features);
+const target_desc *
+riscv_lookup_target_description (const struct riscv_gdbarch_features features);
#endif /* GDBSERVER */
-
#endif /* ARCH_RISCV_H */
diff --git a/gdb/arch/xtensa.h b/gdb/arch/xtensa.h
index 865ddfce83c..9bc3d4caccb 100644
--- a/gdb/arch/xtensa.h
+++ b/gdb/arch/xtensa.h
@@ -36,13 +36,13 @@ typedef struct
xtensa_elf_greg_t windowstart;
xtensa_elf_greg_t windowbase;
xtensa_elf_greg_t threadptr;
- xtensa_elf_greg_t reserved[7+48];
+ xtensa_elf_greg_t reserved[7 + 48];
xtensa_elf_greg_t ar[64];
} xtensa_elf_gregset_t;
-#define XTENSA_ELF_NGREG (sizeof (xtensa_elf_gregset_t) \
- / sizeof (xtensa_elf_greg_t))
+#define XTENSA_ELF_NGREG \
+ (sizeof (xtensa_elf_gregset_t) / sizeof (xtensa_elf_greg_t))
-#define C0_NREGS 16 /* Number of A-registers to track in call0 ABI. */
+#define C0_NREGS 16 /* Number of A-registers to track in call0 ABI. */
#endif /* ARCH_XTENSA_H */
diff --git a/gdb/arm-bsd-tdep.c b/gdb/arm-bsd-tdep.c
index 1f708c768bc..e86e7c65874 100644
--- a/gdb/arm-bsd-tdep.c
+++ b/gdb/arm-bsd-tdep.c
@@ -27,10 +27,10 @@
/* Core file support. */
/* Sizeof `struct reg' in <machine/reg.h>. */
-#define ARMBSD_SIZEOF_GREGS (17 * 4)
+#define ARMBSD_SIZEOF_GREGS (17 * 4)
/* Sizeof `struct fpreg' in <machine/reg.h. */
-#define ARMBSD_SIZEOF_FPREGS ((1 + (8 * 3)) * 4)
+#define ARMBSD_SIZEOF_FPREGS ((1 + (8 * 3)) * 4)
static int
armbsd_fpreg_offset (int regnum)
@@ -46,8 +46,7 @@ armbsd_fpreg_offset (int regnum)
REGCACHE. If REGNUM is -1, do this for all registers in REGSET. */
static void
-armbsd_supply_fpregset (const struct regset *regset,
- struct regcache *regcache,
+armbsd_supply_fpregset (const struct regset *regset, struct regcache *regcache,
int regnum, const void *fpregs, size_t len)
{
const gdb_byte *regs = (const gdb_byte *) fpregs;
@@ -67,8 +66,7 @@ armbsd_supply_fpregset (const struct regset *regset,
REGCACHE. If REGNUM is -1, do this for all registers in REGSET. */
static void
-armbsd_supply_gregset (const struct regset *regset,
- struct regcache *regcache,
+armbsd_supply_gregset (const struct regset *regset, struct regcache *regcache,
int regnum, const void *gregs, size_t len)
{
const gdb_byte *regs = (const gdb_byte *) gregs;
@@ -95,19 +93,10 @@ armbsd_supply_gregset (const struct regset *regset,
/* ARM register sets. */
-static const struct regset armbsd_gregset =
-{
- NULL,
- armbsd_supply_gregset,
- NULL,
- REGSET_VARIABLE_SIZE
-};
+static const struct regset armbsd_gregset
+ = { NULL, armbsd_supply_gregset, NULL, REGSET_VARIABLE_SIZE };
-static const struct regset armbsd_fpregset =
-{
- NULL,
- armbsd_supply_fpregset
-};
+static const struct regset armbsd_fpregset = { NULL, armbsd_supply_fpregset };
/* Iterate over supported core file register note sections. */
diff --git a/gdb/arm-fbsd-nat.c b/gdb/arm-fbsd-nat.c
index 5181281b27d..cd050d58f93 100644
--- a/gdb/arm-fbsd-nat.c
+++ b/gdb/arm-fbsd-nat.c
@@ -103,6 +103,7 @@ arm_fbsd_nat_target::read_description ()
}
void _initialize_arm_fbsd_nat ();
+
void
_initialize_arm_fbsd_nat ()
{
diff --git a/gdb/arm-fbsd-tdep.c b/gdb/arm-fbsd-tdep.c
index acafc4a8bcd..b626615a0cc 100644
--- a/gdb/arm-fbsd-tdep.c
+++ b/gdb/arm-fbsd-tdep.c
@@ -35,30 +35,24 @@
/* Register maps. */
-static const struct regcache_map_entry arm_fbsd_gregmap[] =
- {
- { 13, ARM_A1_REGNUM, 4 }, /* r0 ... r12 */
- { 1, ARM_SP_REGNUM, 4 },
- { 1, ARM_LR_REGNUM, 4 },
- { 1, ARM_PC_REGNUM, 4 },
- { 1, ARM_PS_REGNUM, 4 },
- { 0 }
- };
-
-static const struct regcache_map_entry arm_fbsd_vfpregmap[] =
- {
- { 32, ARM_D0_REGNUM, 8 }, /* d0 ... d31 */
- { 1, ARM_FPSCR_REGNUM, 4 },
- { 0 }
- };
+static const struct regcache_map_entry arm_fbsd_gregmap[]
+ = { { 13, ARM_A1_REGNUM, 4 }, /* r0 ... r12 */
+ { 1, ARM_SP_REGNUM, 4 },
+ { 1, ARM_LR_REGNUM, 4 },
+ { 1, ARM_PC_REGNUM, 4 },
+ { 1, ARM_PS_REGNUM, 4 },
+ { 0 } };
+
+static const struct regcache_map_entry arm_fbsd_vfpregmap[]
+ = { { 32, ARM_D0_REGNUM, 8 }, /* d0 ... d31 */
+ { 1, ARM_FPSCR_REGNUM, 4 },
+ { 0 } };
/* Register numbers are relative to tdep->tls_regnum. */
-static const struct regcache_map_entry arm_fbsd_tls_regmap[] =
- {
- { 1, 0, 4 }, /* tpidruro */
- { 0 }
- };
+static const struct regcache_map_entry arm_fbsd_tls_regmap[]
+ = { { 1, 0, 4 }, /* tpidruro */
+ { 0 } };
/* In a signal frame, sp points to a 'struct sigframe' which is
defined as:
@@ -97,72 +91,60 @@ static const struct regcache_map_entry arm_fbsd_tls_regmap[] =
the sigframe, otherwise it is NULL. There is no non-VFP floating
point register state saved in the signal frame. */
-#define ARM_SIGFRAME_UCONTEXT_OFFSET 64
-#define ARM_UCONTEXT_MCONTEXT_OFFSET 16
-#define ARM_MCONTEXT_VFP_PTR_OFFSET 72
+#define ARM_SIGFRAME_UCONTEXT_OFFSET 64
+#define ARM_UCONTEXT_MCONTEXT_OFFSET 16
+#define ARM_MCONTEXT_VFP_PTR_OFFSET 72
/* Implement the "init" method of struct tramp_frame. */
static void
arm_fbsd_sigframe_init (const struct tramp_frame *self,
frame_info_ptr this_frame,
- struct trad_frame_cache *this_cache,
- CORE_ADDR func)
+ struct trad_frame_cache *this_cache, CORE_ADDR func)
{
struct gdbarch *gdbarch = get_frame_arch (this_frame);
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
CORE_ADDR sp = get_frame_register_unsigned (this_frame, ARM_SP_REGNUM);
- CORE_ADDR mcontext_addr = (sp
- + ARM_SIGFRAME_UCONTEXT_OFFSET
- + ARM_UCONTEXT_MCONTEXT_OFFSET);
+ CORE_ADDR mcontext_addr
+ = (sp + ARM_SIGFRAME_UCONTEXT_OFFSET + ARM_UCONTEXT_MCONTEXT_OFFSET);
ULONGEST mcontext_vfp_addr;
trad_frame_set_reg_regmap (this_cache, arm_fbsd_gregmap, mcontext_addr,
regcache_map_entry_size (arm_fbsd_gregmap));
if (safe_read_memory_unsigned_integer (mcontext_addr
- + ARM_MCONTEXT_VFP_PTR_OFFSET, 4,
- byte_order,
- &mcontext_vfp_addr)
+ + ARM_MCONTEXT_VFP_PTR_OFFSET,
+ 4, byte_order, &mcontext_vfp_addr)
&& mcontext_vfp_addr != 0)
- trad_frame_set_reg_regmap (this_cache, arm_fbsd_vfpregmap, mcontext_vfp_addr,
+ trad_frame_set_reg_regmap (this_cache, arm_fbsd_vfpregmap,
+ mcontext_vfp_addr,
regcache_map_entry_size (arm_fbsd_vfpregmap));
trad_frame_set_id (this_cache, frame_id_build (sp, func));
}
-static const struct tramp_frame arm_fbsd_sigframe =
-{
- SIGTRAMP_FRAME,
- 4,
- {
- {0xe1a0000d, ULONGEST_MAX}, /* mov r0, sp */
- {0xe2800040, ULONGEST_MAX}, /* add r0, r0, #SIGF_UC */
- {0xe59f700c, ULONGEST_MAX}, /* ldr r7, [pc, #12] */
- {0xef0001a1, ULONGEST_MAX}, /* swi SYS_sigreturn */
- {TRAMP_SENTINEL_INSN, ULONGEST_MAX}
- },
- arm_fbsd_sigframe_init
-};
+static const struct tramp_frame arm_fbsd_sigframe
+ = { SIGTRAMP_FRAME,
+ 4,
+ { { 0xe1a0000d, ULONGEST_MAX }, /* mov r0, sp */
+ { 0xe2800040, ULONGEST_MAX }, /* add r0, r0, #SIGF_UC */
+ { 0xe59f700c, ULONGEST_MAX }, /* ldr r7, [pc, #12] */
+ { 0xef0001a1, ULONGEST_MAX }, /* swi SYS_sigreturn */
+ { TRAMP_SENTINEL_INSN, ULONGEST_MAX } },
+ arm_fbsd_sigframe_init };
/* Register set definitions. */
-const struct regset arm_fbsd_gregset =
- {
- arm_fbsd_gregmap,
- regcache_supply_regset, regcache_collect_regset
- };
+const struct regset arm_fbsd_gregset
+ = { arm_fbsd_gregmap, regcache_supply_regset, regcache_collect_regset };
-const struct regset arm_fbsd_vfpregset =
- {
- arm_fbsd_vfpregmap,
- regcache_supply_regset, regcache_collect_regset
- };
+const struct regset arm_fbsd_vfpregset
+ = { arm_fbsd_vfpregmap, regcache_supply_regset, regcache_collect_regset };
static void
arm_fbsd_supply_tls_regset (const struct regset *regset,
- struct regcache *regcache,
- int regnum, const void *buf, size_t size)
+ struct regcache *regcache, int regnum,
+ const void *buf, size_t size)
{
struct gdbarch *gdbarch = regcache->arch ();
arm_gdbarch_tdep *tdep = gdbarch_tdep<arm_gdbarch_tdep> (gdbarch);
@@ -172,8 +154,8 @@ arm_fbsd_supply_tls_regset (const struct regset *regset,
static void
arm_fbsd_collect_tls_regset (const struct regset *regset,
- const struct regcache *regcache,
- int regnum, void *buf, size_t size)
+ const struct regcache *regcache, int regnum,
+ void *buf, size_t size)
{
struct gdbarch *gdbarch = regcache->arch ();
arm_gdbarch_tdep *tdep = gdbarch_tdep<arm_gdbarch_tdep> (gdbarch);
@@ -181,11 +163,9 @@ arm_fbsd_collect_tls_regset (const struct regset *regset,
regcache->collect_regset (regset, tdep->tls_regnum, regnum, buf, size);
}
-const struct regset arm_fbsd_tls_regset =
- {
- arm_fbsd_tls_regmap,
- arm_fbsd_supply_tls_regset, arm_fbsd_collect_tls_regset
- };
+const struct regset arm_fbsd_tls_regset
+ = { arm_fbsd_tls_regmap, arm_fbsd_supply_tls_regset,
+ arm_fbsd_collect_tls_regset };
/* Implement the "iterate_over_regset_sections" gdbarch method. */
@@ -222,7 +202,8 @@ arm_fbsd_read_description_auxv (const gdb::optional<gdb::byte_vector> &auxv,
if (!auxv.has_value ()
|| target_auxv_search (*auxv, target, gdbarch, AT_FREEBSD_HWCAP,
- &arm_hwcap) != 1)
+ &arm_hwcap)
+ != 1)
return arm_read_description (ARM_FP_TYPE_NONE, tls);
if (arm_hwcap & HWCAP_VFP)
@@ -247,21 +228,20 @@ arm_fbsd_read_description_auxv (bool tls)
gdb::optional<gdb::byte_vector> auxv = target_read_auxv ();
return arm_fbsd_read_description_auxv (auxv,
current_inferior ()->top_target (),
- current_inferior ()->gdbarch,
- tls);
+ current_inferior ()->gdbarch, tls);
}
/* Implement the "core_read_description" gdbarch method. */
static const struct target_desc *
arm_fbsd_core_read_description (struct gdbarch *gdbarch,
- struct target_ops *target,
- bfd *abfd)
+ struct target_ops *target, bfd *abfd)
{
asection *tls = bfd_get_section_by_name (abfd, ".reg-aarch-tls");
gdb::optional<gdb::byte_vector> auxv = target_read_auxv_raw (target);
- return arm_fbsd_read_description_auxv (auxv, target, gdbarch, tls != nullptr);
+ return arm_fbsd_read_description_auxv (auxv, target, gdbarch,
+ tls != nullptr);
}
/* Implement the get_thread_local_address gdbarch method. */
@@ -280,7 +260,7 @@ arm_fbsd_get_thread_local_address (struct gdbarch *gdbarch, ptid_t ptid,
ULONGEST tpidruro;
if (regcache->cooked_read (tdep->tls_regnum, &tpidruro) != REG_VALID)
- error (_("Unable to fetch %%tpidruro"));
+ error (_ ("Unable to fetch %%tpidruro"));
/* %tpidruro points to the TCB whose first member is the dtv
pointer. */
@@ -303,14 +283,14 @@ arm_fbsd_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
tramp_frame_prepend_unwinder (gdbarch, &arm_fbsd_sigframe);
- set_solib_svr4_fetch_link_map_offsets
- (gdbarch, svr4_ilp32_fetch_link_map_offsets);
+ set_solib_svr4_fetch_link_map_offsets (gdbarch,
+ svr4_ilp32_fetch_link_map_offsets);
tdep->jb_pc = 24;
tdep->jb_elt_size = 4;
- set_gdbarch_iterate_over_regset_sections
- (gdbarch, arm_fbsd_iterate_over_regset_sections);
+ set_gdbarch_iterate_over_regset_sections (
+ gdbarch, arm_fbsd_iterate_over_regset_sections);
set_gdbarch_core_read_description (gdbarch, arm_fbsd_core_read_description);
if (tdep->tls_regnum > 0)
@@ -326,6 +306,7 @@ arm_fbsd_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
}
void _initialize_arm_fbsd_tdep ();
+
void
_initialize_arm_fbsd_tdep ()
{
diff --git a/gdb/arm-fbsd-tdep.h b/gdb/arm-fbsd-tdep.h
index 3478e4b6860..eca8fe0b402 100644
--- a/gdb/arm-fbsd-tdep.h
+++ b/gdb/arm-fbsd-tdep.h
@@ -24,36 +24,35 @@
/* The general-purpose regset consists of 13 R registers, plus SP, LR,
PC, and CPSR registers. */
-#define ARM_FBSD_SIZEOF_GREGSET (17 * 4)
+#define ARM_FBSD_SIZEOF_GREGSET (17 * 4)
/* The TLS regset consists of a single register. */
-#define ARM_FBSD_SIZEOF_TLSREGSET (4)
+#define ARM_FBSD_SIZEOF_TLSREGSET (4)
/* The VFP regset consists of 32 D registers plus FPSCR, and the whole
structure is padded to 64-bit alignment. */
-#define ARM_FBSD_SIZEOF_VFPREGSET (33 * 8)
+#define ARM_FBSD_SIZEOF_VFPREGSET (33 * 8)
extern const struct regset arm_fbsd_gregset;
extern const struct regset arm_fbsd_vfpregset;
extern const struct regset arm_fbsd_tls_regset;
/* Flags passed in AT_HWCAP. */
-#define HWCAP_VFP 0x00000040
-#define HWCAP_NEON 0x00001000
-#define HWCAP_VFPv3 0x00002000
-#define HWCAP_VFPD32 0x00080000
+#define HWCAP_VFP 0x00000040
+#define HWCAP_NEON 0x00001000
+#define HWCAP_VFPv3 0x00002000
+#define HWCAP_VFPD32 0x00080000
/* Lookup a target description based on the AT_HWCAP value in the auxv data
AUXV. */
extern const struct target_desc *
- arm_fbsd_read_description_auxv (const gdb::optional<gdb::byte_vector> &auxv,
- target_ops *target, gdbarch *gdbarch,
- bool tls);
+arm_fbsd_read_description_auxv (const gdb::optional<gdb::byte_vector> &auxv,
+ target_ops *target, gdbarch *gdbarch,
+ bool tls);
/* Same as the above, but read the auxv data from the current inferior. */
-extern const struct target_desc *
- arm_fbsd_read_description_auxv (bool tls);
+extern const struct target_desc *arm_fbsd_read_description_auxv (bool tls);
#endif /* ARM_FBSD_TDEP_H */
diff --git a/gdb/arm-linux-nat.c b/gdb/arm-linux-nat.c
index ef3fa008adf..cfb437df380 100644
--- a/gdb/arm-linux-nat.c
+++ b/gdb/arm-linux-nat.c
@@ -69,6 +69,7 @@
class arm_linux_nat_target final : public linux_nat_target
{
public:
+
/* Add our register access methods. */
void fetch_registers (struct regcache *, int) override;
void store_registers (struct regcache *, int) override;
@@ -76,9 +77,11 @@ public:
/* Add our hardware breakpoint and watchpoint implementation. */
int can_use_hw_breakpoint (enum bptype, int, int) override;
- int insert_hw_breakpoint (struct gdbarch *, struct bp_target_info *) override;
+ int insert_hw_breakpoint (struct gdbarch *,
+ struct bp_target_info *) override;
- int remove_hw_breakpoint (struct gdbarch *, struct bp_target_info *) override;
+ int remove_hw_breakpoint (struct gdbarch *,
+ struct bp_target_info *) override;
int region_ok_for_hw_watchpoint (CORE_ADDR, int) override;
@@ -135,7 +138,7 @@ fetch_fpregs (struct regcache *regcache)
ret = ptrace (PT_GETFPREGS, tid, 0, fp);
if (ret < 0)
- perror_with_name (_("Unable to fetch the floating point registers"));
+ perror_with_name (_ ("Unable to fetch the floating point registers"));
/* Fetch fpsr. */
regcache->raw_supply (ARM_FPS_REGNUM, fp + NWFPE_FPSR_OFFSET);
@@ -172,7 +175,7 @@ store_fpregs (const struct regcache *regcache)
ret = ptrace (PT_GETFPREGS, tid, 0, fp);
if (ret < 0)
- perror_with_name (_("Unable to fetch the floating point registers"));
+ perror_with_name (_ ("Unable to fetch the floating point registers"));
/* Store fpsr. */
if (REG_VALID == regcache->get_register_status (ARM_FPS_REGNUM))
@@ -196,7 +199,7 @@ store_fpregs (const struct regcache *regcache)
ret = ptrace (PTRACE_SETFPREGS, tid, 0, fp);
if (ret < 0)
- perror_with_name (_("Unable to store floating point registers"));
+ perror_with_name (_ ("Unable to store floating point registers"));
}
/* Fetch all general registers of the process and store into
@@ -224,7 +227,7 @@ fetch_regs (struct regcache *regcache)
ret = ptrace (PTRACE_GETREGS, tid, 0, &regs);
if (ret < 0)
- perror_with_name (_("Unable to fetch general registers"));
+ perror_with_name (_ ("Unable to fetch general registers"));
aarch32_gp_regcache_supply (regcache, (uint32_t *) regs, arm_apcs_32);
}
@@ -252,7 +255,7 @@ store_regs (const struct regcache *regcache)
ret = ptrace (PTRACE_GETREGS, tid, 0, &regs);
if (ret < 0)
- perror_with_name (_("Unable to fetch general registers"));
+ perror_with_name (_ ("Unable to fetch general registers"));
aarch32_gp_regcache_collect (regcache, (uint32_t *) regs, arm_apcs_32);
@@ -269,7 +272,7 @@ store_regs (const struct regcache *regcache)
ret = ptrace (PTRACE_SETREGS, tid, 0, &regs);
if (ret < 0)
- perror_with_name (_("Unable to store general registers"));
+ perror_with_name (_ ("Unable to store general registers"));
}
/* Fetch all WMMX registers of the process and store into
@@ -286,7 +289,7 @@ fetch_wmmx_regs (struct regcache *regcache)
ret = ptrace (PTRACE_GETWMMXREGS, tid, 0, regbuf);
if (ret < 0)
- perror_with_name (_("Unable to fetch WMMX registers"));
+ perror_with_name (_ ("Unable to fetch WMMX registers"));
for (regno = 0; regno < 16; regno++)
regcache->raw_supply (regno + ARM_WR0_REGNUM, &regbuf[regno * 8]);
@@ -311,7 +314,7 @@ store_wmmx_regs (const struct regcache *regcache)
ret = ptrace (PTRACE_GETWMMXREGS, tid, 0, regbuf);
if (ret < 0)
- perror_with_name (_("Unable to fetch WMMX registers"));
+ perror_with_name (_ ("Unable to fetch WMMX registers"));
for (regno = 0; regno < 16; regno++)
if (REG_VALID == regcache->get_register_status (regno + ARM_WR0_REGNUM))
@@ -330,7 +333,7 @@ store_wmmx_regs (const struct regcache *regcache)
ret = ptrace (PTRACE_SETWMMXREGS, tid, 0, regbuf);
if (ret < 0)
- perror_with_name (_("Unable to store WMMX registers"));
+ perror_with_name (_ ("Unable to store WMMX registers"));
}
static void
@@ -356,10 +359,9 @@ fetch_vfp_regs (struct regcache *regcache)
ret = ptrace (PTRACE_GETVFPREGS, tid, 0, regbuf);
if (ret < 0)
- perror_with_name (_("Unable to fetch VFP registers"));
+ perror_with_name (_ ("Unable to fetch VFP registers"));
- aarch32_vfp_regcache_supply (regcache, regbuf,
- tdep->vfp_register_count);
+ aarch32_vfp_regcache_supply (regcache, regbuf, tdep->vfp_register_count);
}
static void
@@ -385,10 +387,9 @@ store_vfp_regs (const struct regcache *regcache)
ret = ptrace (PTRACE_GETVFPREGS, tid, 0, regbuf);
if (ret < 0)
- perror_with_name (_("Unable to fetch VFP registers (for update)"));
+ perror_with_name (_ ("Unable to fetch VFP registers (for update)"));
- aarch32_vfp_regcache_collect (regcache, regbuf,
- tdep->vfp_register_count);
+ aarch32_vfp_regcache_collect (regcache, regbuf, tdep->vfp_register_count);
if (have_ptrace_getregset == TRIBOOL_TRUE)
{
@@ -402,7 +403,7 @@ store_vfp_regs (const struct regcache *regcache)
ret = ptrace (PTRACE_SETVFPREGS, tid, 0, regbuf);
if (ret < 0)
- perror_with_name (_("Unable to store VFP registers"));
+ perror_with_name (_ ("Unable to store VFP registers"));
}
/* Fetch registers from the child process. Fetch all registers if
@@ -431,11 +432,10 @@ arm_linux_nat_target::fetch_registers (struct regcache *regcache, int regno)
fetch_regs (regcache);
else if (regno >= ARM_F0_REGNUM && regno <= ARM_FPS_REGNUM)
fetch_fpregs (regcache);
- else if (tdep->have_wmmx_registers
- && regno >= ARM_WR0_REGNUM && regno <= ARM_WCGR7_REGNUM)
+ else if (tdep->have_wmmx_registers && regno >= ARM_WR0_REGNUM
+ && regno <= ARM_WCGR7_REGNUM)
fetch_wmmx_regs (regcache);
- else if (tdep->vfp_register_count > 0
- && regno >= ARM_D0_REGNUM
+ else if (tdep->vfp_register_count > 0 && regno >= ARM_D0_REGNUM
&& (regno < ARM_D0_REGNUM + tdep->vfp_register_count
|| regno == ARM_FPSCR_REGNUM))
fetch_vfp_regs (regcache);
@@ -468,11 +468,10 @@ arm_linux_nat_target::store_registers (struct regcache *regcache, int regno)
store_regs (regcache);
else if ((regno >= ARM_F0_REGNUM) && (regno <= ARM_FPS_REGNUM))
store_fpregs (regcache);
- else if (tdep->have_wmmx_registers
- && regno >= ARM_WR0_REGNUM && regno <= ARM_WCGR7_REGNUM)
+ else if (tdep->have_wmmx_registers && regno >= ARM_WR0_REGNUM
+ && regno <= ARM_WCGR7_REGNUM)
store_wmmx_regs (regcache);
- else if (tdep->vfp_register_count > 0
- && regno >= ARM_D0_REGNUM
+ else if (tdep->vfp_register_count > 0 && regno >= ARM_D0_REGNUM
&& (regno < ARM_D0_REGNUM + tdep->vfp_register_count
|| regno == ARM_FPSCR_REGNUM))
store_vfp_regs (regcache);
@@ -483,8 +482,8 @@ arm_linux_nat_target::store_registers (struct regcache *regcache, int regno)
thread debugging. */
void
-fill_gregset (const struct regcache *regcache,
- gdb_gregset_t *gregsetp, int regno)
+fill_gregset (const struct regcache *regcache, gdb_gregset_t *gregsetp,
+ int regno)
{
arm_linux_collect_gregset (NULL, regcache, regno, gregsetp, 0);
}
@@ -496,8 +495,8 @@ supply_gregset (struct regcache *regcache, const gdb_gregset_t *gregsetp)
}
void
-fill_fpregset (const struct regcache *regcache,
- gdb_fpregset_t *fpregsetp, int regno)
+fill_fpregset (const struct regcache *regcache, gdb_fpregset_t *fpregsetp,
+ int regno)
{
arm_linux_collect_nwfpe (NULL, regcache, regno, fpregsetp, 0);
}
@@ -514,8 +513,8 @@ supply_fpregset (struct regcache *regcache, const gdb_fpregset_t *fpregsetp)
/* Fetch the thread-local storage pointer for libthread_db. */
ps_err_e
-ps_get_thread_area (struct ps_prochandle *ph,
- lwpid_t lwpid, int idx, void **base)
+ps_get_thread_area (struct ps_prochandle *ph, lwpid_t lwpid, int idx,
+ void **base)
{
if (ptrace (PTRACE_GET_THREAD_AREA, lwpid, NULL, base) != 0)
return PS_ERR;
@@ -523,7 +522,7 @@ ps_get_thread_area (struct ps_prochandle *ph,
/* IDX is the bias from the thread pointer to the beginning of the
thread descriptor. It has to be subtracted due to implementation
quirks in libthread_db. */
- *base = (void *) ((char *)*base - idx);
+ *base = (void *) ((char *) *base - idx);
return PS_OK;
}
@@ -613,24 +612,28 @@ arm_linux_get_hwbp_cap (void)
available = 0;
else
{
- info.arch = (gdb_byte)((val >> 24) & 0xff);
- info.max_wp_length = (gdb_byte)((val >> 16) & 0xff);
- info.wp_count = (gdb_byte)((val >> 8) & 0xff);
- info.bp_count = (gdb_byte)(val & 0xff);
-
- if (info.wp_count > MAX_WPTS)
- {
- warning (_("arm-linux-gdb supports %d hardware watchpoints but target \
- supports %d"), MAX_WPTS, info.wp_count);
- info.wp_count = MAX_WPTS;
- }
-
- if (info.bp_count > MAX_BPTS)
- {
- warning (_("arm-linux-gdb supports %d hardware breakpoints but target \
- supports %d"), MAX_BPTS, info.bp_count);
- info.bp_count = MAX_BPTS;
- }
+ info.arch = (gdb_byte) ((val >> 24) & 0xff);
+ info.max_wp_length = (gdb_byte) ((val >> 16) & 0xff);
+ info.wp_count = (gdb_byte) ((val >> 8) & 0xff);
+ info.bp_count = (gdb_byte) (val & 0xff);
+
+ if (info.wp_count > MAX_WPTS)
+ {
+ warning (
+ _ ("arm-linux-gdb supports %d hardware watchpoints but target \
+ supports %d"),
+ MAX_WPTS, info.wp_count);
+ info.wp_count = MAX_WPTS;
+ }
+
+ if (info.bp_count > MAX_BPTS)
+ {
+ warning (
+ _ ("arm-linux-gdb supports %d hardware breakpoints but target \
+ supports %d"),
+ MAX_BPTS, info.bp_count);
+ info.bp_count = MAX_BPTS;
+ }
available = (info.arch != 0);
}
}
@@ -657,8 +660,7 @@ arm_linux_get_hw_watchpoint_count (void)
/* Have we got a free break-/watch-point available for use? Returns -1 if
there is not an appropriate resource available, otherwise returns 1. */
int
-arm_linux_nat_target::can_use_hw_breakpoint (enum bptype type,
- int cnt, int ot)
+arm_linux_nat_target::can_use_hw_breakpoint (enum bptype type, int cnt, int ot)
{
if (type == bp_hardware_watchpoint || type == bp_read_watchpoint
|| type == bp_access_watchpoint || type == bp_watchpoint)
@@ -744,7 +746,6 @@ struct arm_linux_process_info
pid_t pid;
/* Hardware break-/watchpoints state information. */
struct arm_linux_debug_reg_state state;
-
};
/* Per-thread arch-specific data we want to keep. */
@@ -817,12 +818,12 @@ arm_linux_nat_target::low_forget_process (pid_t pid)
while (proc != NULL)
{
if (proc->pid == pid)
- {
- *proc_link = proc->next;
+ {
+ *proc_link = proc->next;
- xfree (proc);
- return;
- }
+ xfree (proc);
+ return;
+ }
proc_link = &proc->next;
proc = *proc_link;
@@ -841,13 +842,12 @@ arm_linux_get_debug_reg_state (pid_t pid)
BYTE_ADDRESS_SELECT is the mask of bytes to trigger on; HWBP_TYPE is the
type of break-/watch-point; ENABLE indicates whether the point is enabled.
*/
-static arm_hwbp_control_t
+static arm_hwbp_control_t
arm_hwbp_control_initialize (unsigned byte_address_select,
- arm_hwbp_type hwbp_type,
- int enable)
+ arm_hwbp_type hwbp_type, int enable)
{
gdb_assert ((byte_address_select & ~0xffU) == 0);
- gdb_assert (hwbp_type != arm_hwbp_break
+ gdb_assert (hwbp_type != arm_hwbp_break
|| ((byte_address_select & 0xfU) != 0));
return (byte_address_select << 5) | (hwbp_type << 3) | (3 << 1) | enable;
@@ -896,7 +896,7 @@ arm_linux_hw_breakpoint_initialize (struct gdbarch *gdbarch,
/* Get the ARM hardware breakpoint type from the TYPE value we're
given when asked to set a watchpoint. */
-static arm_hwbp_type
+static arm_hwbp_type
arm_linux_get_hwbp_type (enum target_hw_bp_type type)
{
if (type == hw_read)
@@ -923,8 +923,8 @@ arm_linux_hw_watchpoint_initialize (CORE_ADDR addr, int len,
mask = (1 << len) - 1;
p->address = (unsigned int) addr;
- p->control = arm_hwbp_control_initialize (mask,
- arm_linux_get_hwbp_type (type), 1);
+ p->control
+ = arm_hwbp_control_initialize (mask, arm_linux_get_hwbp_type (type), 1);
}
/* Are two break-/watch-points equal? */
@@ -962,13 +962,13 @@ update_registers_callback (struct lwp_info *lwp, int watch, int index)
/* Insert the hardware breakpoint (WATCHPOINT = 0) or watchpoint (WATCHPOINT
=1) BPT for thread TID. */
static void
-arm_linux_insert_hw_breakpoint1 (const struct arm_linux_hw_breakpoint* bpt,
+arm_linux_insert_hw_breakpoint1 (const struct arm_linux_hw_breakpoint *bpt,
int watchpoint)
{
int pid;
ptid_t pid_ptid;
gdb_byte count, i;
- struct arm_linux_hw_breakpoint* bpts;
+ struct arm_linux_hw_breakpoint *bpts;
pid = inferior_ptid.pid ();
pid_ptid = ptid_t (pid);
@@ -988,12 +988,9 @@ arm_linux_insert_hw_breakpoint1 (const struct arm_linux_hw_breakpoint* bpt,
if (!arm_hwbp_control_is_enabled (bpts[i].control))
{
bpts[i] = *bpt;
- iterate_over_lwps (pid_ptid,
- [=] (struct lwp_info *info)
- {
- return update_registers_callback (info, watchpoint,
- i);
- });
+ iterate_over_lwps (pid_ptid, [=] (struct lwp_info *info) {
+ return update_registers_callback (info, watchpoint, i);
+ });
break;
}
@@ -1003,13 +1000,13 @@ arm_linux_insert_hw_breakpoint1 (const struct arm_linux_hw_breakpoint* bpt,
/* Remove the hardware breakpoint (WATCHPOINT = 0) or watchpoint
(WATCHPOINT = 1) BPT for thread TID. */
static void
-arm_linux_remove_hw_breakpoint1 (const struct arm_linux_hw_breakpoint *bpt,
+arm_linux_remove_hw_breakpoint1 (const struct arm_linux_hw_breakpoint *bpt,
int watchpoint)
{
int pid;
gdb_byte count, i;
ptid_t pid_ptid;
- struct arm_linux_hw_breakpoint* bpts;
+ struct arm_linux_hw_breakpoint *bpts;
pid = inferior_ptid.pid ();
pid_ptid = ptid_t (pid);
@@ -1029,12 +1026,9 @@ arm_linux_remove_hw_breakpoint1 (const struct arm_linux_hw_breakpoint *bpt,
if (arm_linux_hw_breakpoint_equal (bpt, bpts + i))
{
bpts[i].control = arm_hwbp_control_disable (bpts[i].control);
- iterate_over_lwps (pid_ptid,
- [=] (struct lwp_info *info)
- {
- return update_registers_callback (info, watchpoint,
- i);
- });
+ iterate_over_lwps (pid_ptid, [=] (struct lwp_info *info) {
+ return update_registers_callback (info, watchpoint, i);
+ });
break;
}
@@ -1093,7 +1087,7 @@ arm_linux_nat_target::region_ok_for_hw_watchpoint (CORE_ADDR addr, int len)
/* Test that the range [ADDR, ADDR + LEN) fits into the largest address
range covered by a watchpoint. */
- max_wp_length = (CORE_ADDR)cap->max_wp_length;
+ max_wp_length = (CORE_ADDR) cap->max_wp_length;
aligned_addr = addr & ~(max_wp_length - 1);
if (aligned_addr + max_wp_length < addr + len)
@@ -1128,8 +1122,8 @@ arm_linux_nat_target::insert_watchpoint (CORE_ADDR addr, int len,
/* Remove a hardware breakpoint. */
int
-arm_linux_nat_target::remove_watchpoint (CORE_ADDR addr,
- int len, enum target_hw_bp_type rw,
+arm_linux_nat_target::remove_watchpoint (CORE_ADDR addr, int len,
+ enum target_hw_bp_type rw,
struct expression *cond)
{
struct arm_linux_hw_breakpoint p;
@@ -1244,13 +1238,15 @@ arm_linux_nat_target::low_prepare_to_resume (struct lwp_info *lwp)
errno = 0;
if (arm_hwbp_control_is_enabled (bpts[i].control))
if (ptrace (PTRACE_SETHBPREGS, pid,
- (PTRACE_TYPE_ARG3) ((i << 1) + 1), &bpts[i].address) < 0)
- perror_with_name (_("Unexpected error setting breakpoint"));
+ (PTRACE_TYPE_ARG3) ((i << 1) + 1), &bpts[i].address)
+ < 0)
+ perror_with_name (_ ("Unexpected error setting breakpoint"));
if (bpts[i].control != 0)
if (ptrace (PTRACE_SETHBPREGS, pid,
- (PTRACE_TYPE_ARG3) ((i << 1) + 2), &bpts[i].control) < 0)
- perror_with_name (_("Unexpected error setting breakpoint"));
+ (PTRACE_TYPE_ARG3) ((i << 1) + 2), &bpts[i].control)
+ < 0)
+ perror_with_name (_ ("Unexpected error setting breakpoint"));
arm_lwp_info->bpts_changed[i] = 0;
}
@@ -1261,13 +1257,15 @@ arm_linux_nat_target::low_prepare_to_resume (struct lwp_info *lwp)
errno = 0;
if (arm_hwbp_control_is_enabled (wpts[i].control))
if (ptrace (PTRACE_SETHBPREGS, pid,
- (PTRACE_TYPE_ARG3) -((i << 1) + 1), &wpts[i].address) < 0)
- perror_with_name (_("Unexpected error setting watchpoint"));
+ (PTRACE_TYPE_ARG3) - ((i << 1) + 1), &wpts[i].address)
+ < 0)
+ perror_with_name (_ ("Unexpected error setting watchpoint"));
if (wpts[i].control != 0)
if (ptrace (PTRACE_SETHBPREGS, pid,
- (PTRACE_TYPE_ARG3) -((i << 1) + 2), &wpts[i].control) < 0)
- perror_with_name (_("Unexpected error setting watchpoint"));
+ (PTRACE_TYPE_ARG3) - ((i << 1) + 2), &wpts[i].control)
+ < 0)
+ perror_with_name (_ ("Unexpected error setting watchpoint"));
arm_lwp_info->wpts_changed[i] = 0;
}
@@ -1300,6 +1298,7 @@ arm_linux_nat_target::low_new_fork (struct lwp_info *parent, pid_t child_pid)
}
void _initialize_arm_linux_nat ();
+
void
_initialize_arm_linux_nat ()
{
diff --git a/gdb/arm-linux-tdep.c b/gdb/arm-linux-tdep.c
index 5151fa1c5c6..dd810cd87a7 100644
--- a/gdb/arm-linux-tdep.c
+++ b/gdb/arm-linux-tdep.c
@@ -64,9 +64,11 @@
of the software interrupt the kernel stops the inferior with a
SIGTRAP, and wakes the debugger. */
-static const gdb_byte arm_linux_arm_le_breakpoint[] = { 0x01, 0x00, 0x9f, 0xef };
+static const gdb_byte arm_linux_arm_le_breakpoint[]
+ = { 0x01, 0x00, 0x9f, 0xef };
-static const gdb_byte arm_linux_arm_be_breakpoint[] = { 0xef, 0x9f, 0x00, 0x01 };
+static const gdb_byte arm_linux_arm_be_breakpoint[]
+ = { 0xef, 0x9f, 0x00, 0x01 };
/* However, the EABI syscall interface (new in Nov. 2005) does not look at
the operand of the swi if old-ABI compatibility is disabled. Therefore,
@@ -74,24 +76,28 @@ static const gdb_byte arm_linux_arm_be_breakpoint[] = { 0xef, 0x9f, 0x00, 0x01 }
version 2.5.70 (May 2003), so should be a safe assumption for EABI
binaries. */
-static const gdb_byte eabi_linux_arm_le_breakpoint[] = { 0xf0, 0x01, 0xf0, 0xe7 };
+static const gdb_byte eabi_linux_arm_le_breakpoint[]
+ = { 0xf0, 0x01, 0xf0, 0xe7 };
-static const gdb_byte eabi_linux_arm_be_breakpoint[] = { 0xe7, 0xf0, 0x01, 0xf0 };
+static const gdb_byte eabi_linux_arm_be_breakpoint[]
+ = { 0xe7, 0xf0, 0x01, 0xf0 };
/* All the kernels which support Thumb support using a specific undefined
instruction for the Thumb breakpoint. */
-static const gdb_byte arm_linux_thumb_be_breakpoint[] = {0xde, 0x01};
+static const gdb_byte arm_linux_thumb_be_breakpoint[] = { 0xde, 0x01 };
-static const gdb_byte arm_linux_thumb_le_breakpoint[] = {0x01, 0xde};
+static const gdb_byte arm_linux_thumb_le_breakpoint[] = { 0x01, 0xde };
/* Because the 16-bit Thumb breakpoint is affected by Thumb-2 IT blocks,
we must use a length-appropriate breakpoint for 32-bit Thumb
instructions. See also thumb_get_next_pc. */
-static const gdb_byte arm_linux_thumb2_be_breakpoint[] = { 0xf7, 0xf0, 0xa0, 0x00 };
+static const gdb_byte arm_linux_thumb2_be_breakpoint[]
+ = { 0xf7, 0xf0, 0xa0, 0x00 };
-static const gdb_byte arm_linux_thumb2_le_breakpoint[] = { 0xf0, 0xf7, 0x00, 0xa0 };
+static const gdb_byte arm_linux_thumb2_le_breakpoint[]
+ = { 0xf0, 0xf7, 0x00, 0xa0 };
/* Description of the longjmp buffer. The buffer is treated as an array of
elements of size ARM_LINUX_JB_ELEMENT_SIZE.
@@ -104,9 +110,9 @@ static const gdb_byte arm_linux_thumb2_le_breakpoint[] = { 0xf0, 0xf7, 0x00, 0xa
SoftVFP or VFP (which implies EABI) then the PC is at offset 9 in the
buffer. This is also true for the SoftFPA model. However, for the FPA
model the PC is at offset 21 in the buffer. */
-#define ARM_LINUX_JB_ELEMENT_SIZE ARM_INT_REGISTER_SIZE
-#define ARM_LINUX_JB_PC_FPA 21
-#define ARM_LINUX_JB_PC_EABI 9
+#define ARM_LINUX_JB_ELEMENT_SIZE ARM_INT_REGISTER_SIZE
+#define ARM_LINUX_JB_PC_FPA 21
+#define ARM_LINUX_JB_PC_EABI 9
/*
Dynamic Linking on ARM GNU/Linux
@@ -235,29 +241,29 @@ static const gdb_byte arm_linux_thumb2_le_breakpoint[] = { 0xf0, 0xf7, 0x00, 0xa
include/asm-arm/unistd.h
- see __NR_sigreturn, __NR_rt_sigreturn, and __NR_SYSCALL_BASE */
-#define ARM_LINUX_SIGRETURN_INSTR 0xef900077
-#define ARM_LINUX_RT_SIGRETURN_INSTR 0xef9000ad
+#define ARM_LINUX_SIGRETURN_INSTR 0xef900077
+#define ARM_LINUX_RT_SIGRETURN_INSTR 0xef9000ad
/* For ARM EABI, the syscall number is not in the SWI instruction
(instead it is loaded into r7). We recognize the pattern that
glibc uses... alternatively, we could arrange to do this by
function name, but they are not always exported. */
-#define ARM_SET_R7_SIGRETURN 0xe3a07077
-#define ARM_SET_R7_RT_SIGRETURN 0xe3a070ad
-#define ARM_EABI_SYSCALL 0xef000000
+#define ARM_SET_R7_SIGRETURN 0xe3a07077
+#define ARM_SET_R7_RT_SIGRETURN 0xe3a070ad
+#define ARM_EABI_SYSCALL 0xef000000
/* Equivalent patterns for Thumb2. */
-#define THUMB2_SET_R7_SIGRETURN1 0xf04f
-#define THUMB2_SET_R7_SIGRETURN2 0x0777
-#define THUMB2_SET_R7_RT_SIGRETURN1 0xf04f
-#define THUMB2_SET_R7_RT_SIGRETURN2 0x07ad
-#define THUMB2_EABI_SYSCALL 0xdf00
+#define THUMB2_SET_R7_SIGRETURN1 0xf04f
+#define THUMB2_SET_R7_SIGRETURN2 0x0777
+#define THUMB2_SET_R7_RT_SIGRETURN1 0xf04f
+#define THUMB2_SET_R7_RT_SIGRETURN2 0x07ad
+#define THUMB2_EABI_SYSCALL 0xdf00
/* OABI syscall restart trampoline, used for EABI executables too
whenever OABI support has been enabled in the kernel. */
#define ARM_OABI_SYSCALL_RESTART_SYSCALL 0xef900000
-#define ARM_LDR_PC_SP_12 0xe49df00c
-#define ARM_LDR_PC_SP_4 0xe49df004
+#define ARM_LDR_PC_SP_12 0xe49df00c
+#define ARM_LDR_PC_SP_4 0xe49df004
/* Syscall number for sigreturn. */
#define ARM_SIGRETURN 119
@@ -265,7 +271,7 @@ static const gdb_byte arm_linux_thumb2_le_breakpoint[] = { 0xf0, 0xf7, 0x00, 0xa
#define ARM_RT_SIGRETURN 173
static CORE_ADDR
- arm_linux_get_next_pcs_syscall_next_pc (struct arm_get_next_pcs *self);
+arm_linux_get_next_pcs_syscall_next_pc (struct arm_get_next_pcs *self);
/* Operation function pointers for get_next_pcs. */
static struct arm_get_next_pcs_ops arm_linux_get_next_pcs_ops = {
@@ -278,8 +284,8 @@ static struct arm_get_next_pcs_ops arm_linux_get_next_pcs_ops = {
static void
arm_linux_sigtramp_cache (frame_info_ptr this_frame,
- struct trad_frame_cache *this_cache,
- CORE_ADDR func, int regs_offset)
+ struct trad_frame_cache *this_cache, CORE_ADDR func,
+ int regs_offset)
{
CORE_ADDR sp = get_frame_register_unsigned (this_frame, ARM_SP_REGNUM);
CORE_ADDR base = sp + regs_offset;
@@ -301,8 +307,7 @@ arm_linux_sigtramp_cache (frame_info_ptr this_frame,
static void
arm_linux_sigreturn_init (const struct tramp_frame *self,
frame_info_ptr this_frame,
- struct trad_frame_cache *this_cache,
- CORE_ADDR func)
+ struct trad_frame_cache *this_cache, CORE_ADDR func)
{
struct gdbarch *gdbarch = get_frame_arch (this_frame);
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
@@ -311,18 +316,16 @@ arm_linux_sigreturn_init (const struct tramp_frame *self,
if (uc_flags == ARM_NEW_SIGFRAME_MAGIC)
arm_linux_sigtramp_cache (this_frame, this_cache, func,
- ARM_UCONTEXT_SIGCONTEXT
- + ARM_SIGCONTEXT_R0);
+ ARM_UCONTEXT_SIGCONTEXT + ARM_SIGCONTEXT_R0);
else
- arm_linux_sigtramp_cache (this_frame, this_cache, func,
- ARM_SIGCONTEXT_R0);
+ arm_linux_sigtramp_cache (this_frame, this_cache, func, ARM_SIGCONTEXT_R0);
}
static void
arm_linux_rt_sigreturn_init (const struct tramp_frame *self,
- frame_info_ptr this_frame,
- struct trad_frame_cache *this_cache,
- CORE_ADDR func)
+ frame_info_ptr this_frame,
+ struct trad_frame_cache *this_cache,
+ CORE_ADDR func)
{
struct gdbarch *gdbarch = get_frame_arch (this_frame);
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
@@ -332,13 +335,11 @@ arm_linux_rt_sigreturn_init (const struct tramp_frame *self,
if (pinfo == sp + ARM_OLD_RT_SIGFRAME_SIGINFO)
arm_linux_sigtramp_cache (this_frame, this_cache, func,
ARM_OLD_RT_SIGFRAME_UCONTEXT
- + ARM_UCONTEXT_SIGCONTEXT
- + ARM_SIGCONTEXT_R0);
+ + ARM_UCONTEXT_SIGCONTEXT + ARM_SIGCONTEXT_R0);
else
arm_linux_sigtramp_cache (this_frame, this_cache, func,
ARM_NEW_RT_SIGFRAME_UCONTEXT
- + ARM_UCONTEXT_SIGCONTEXT
- + ARM_SIGCONTEXT_R0);
+ + ARM_UCONTEXT_SIGCONTEXT + ARM_SIGCONTEXT_R0);
}
static void
@@ -382,93 +383,68 @@ arm_linux_restart_syscall_init (const struct tramp_frame *self,
trad_frame_set_id (this_cache, frame_id_build (sp, func));
}
-static struct tramp_frame arm_linux_sigreturn_tramp_frame = {
- SIGTRAMP_FRAME,
- 4,
- {
- { ARM_LINUX_SIGRETURN_INSTR, ULONGEST_MAX },
- { TRAMP_SENTINEL_INSN }
- },
- arm_linux_sigreturn_init
-};
-
-static struct tramp_frame arm_linux_rt_sigreturn_tramp_frame = {
- SIGTRAMP_FRAME,
- 4,
- {
- { ARM_LINUX_RT_SIGRETURN_INSTR, ULONGEST_MAX },
- { TRAMP_SENTINEL_INSN }
- },
- arm_linux_rt_sigreturn_init
-};
-
-static struct tramp_frame arm_eabi_linux_sigreturn_tramp_frame = {
- SIGTRAMP_FRAME,
- 4,
- {
- { ARM_SET_R7_SIGRETURN, ULONGEST_MAX },
- { ARM_EABI_SYSCALL, ULONGEST_MAX },
- { TRAMP_SENTINEL_INSN }
- },
- arm_linux_sigreturn_init
-};
-
-static struct tramp_frame arm_eabi_linux_rt_sigreturn_tramp_frame = {
- SIGTRAMP_FRAME,
- 4,
- {
- { ARM_SET_R7_RT_SIGRETURN, ULONGEST_MAX },
- { ARM_EABI_SYSCALL, ULONGEST_MAX },
- { TRAMP_SENTINEL_INSN }
- },
- arm_linux_rt_sigreturn_init
-};
-
-static struct tramp_frame thumb2_eabi_linux_sigreturn_tramp_frame = {
- SIGTRAMP_FRAME,
- 2,
- {
- { THUMB2_SET_R7_SIGRETURN1, ULONGEST_MAX },
- { THUMB2_SET_R7_SIGRETURN2, ULONGEST_MAX },
- { THUMB2_EABI_SYSCALL, ULONGEST_MAX },
- { TRAMP_SENTINEL_INSN }
- },
- arm_linux_sigreturn_init
-};
-
-static struct tramp_frame thumb2_eabi_linux_rt_sigreturn_tramp_frame = {
- SIGTRAMP_FRAME,
- 2,
- {
- { THUMB2_SET_R7_RT_SIGRETURN1, ULONGEST_MAX },
- { THUMB2_SET_R7_RT_SIGRETURN2, ULONGEST_MAX },
- { THUMB2_EABI_SYSCALL, ULONGEST_MAX },
- { TRAMP_SENTINEL_INSN }
- },
- arm_linux_rt_sigreturn_init
-};
-
-static struct tramp_frame arm_linux_restart_syscall_tramp_frame = {
- NORMAL_FRAME,
- 4,
- {
- { ARM_OABI_SYSCALL_RESTART_SYSCALL, ULONGEST_MAX },
- { ARM_LDR_PC_SP_12, ULONGEST_MAX },
- { TRAMP_SENTINEL_INSN }
- },
- arm_linux_restart_syscall_init
-};
-
-static struct tramp_frame arm_kernel_linux_restart_syscall_tramp_frame = {
- NORMAL_FRAME,
- 4,
- {
- { ARM_OABI_SYSCALL_RESTART_SYSCALL, ULONGEST_MAX },
- { ARM_LDR_PC_SP_4, ULONGEST_MAX },
- { TRAMP_SENTINEL_INSN }
- },
- arm_linux_restart_syscall_init
-};
+static struct tramp_frame arm_linux_sigreturn_tramp_frame
+ = { SIGTRAMP_FRAME,
+ 4,
+ { { ARM_LINUX_SIGRETURN_INSTR, ULONGEST_MAX }, { TRAMP_SENTINEL_INSN } },
+ arm_linux_sigreturn_init };
+
+static struct tramp_frame arm_linux_rt_sigreturn_tramp_frame
+ = { SIGTRAMP_FRAME,
+ 4,
+ { { ARM_LINUX_RT_SIGRETURN_INSTR, ULONGEST_MAX },
+ { TRAMP_SENTINEL_INSN } },
+ arm_linux_rt_sigreturn_init };
+
+static struct tramp_frame arm_eabi_linux_sigreturn_tramp_frame
+ = { SIGTRAMP_FRAME,
+ 4,
+ { { ARM_SET_R7_SIGRETURN, ULONGEST_MAX },
+ { ARM_EABI_SYSCALL, ULONGEST_MAX },
+ { TRAMP_SENTINEL_INSN } },
+ arm_linux_sigreturn_init };
+
+static struct tramp_frame arm_eabi_linux_rt_sigreturn_tramp_frame
+ = { SIGTRAMP_FRAME,
+ 4,
+ { { ARM_SET_R7_RT_SIGRETURN, ULONGEST_MAX },
+ { ARM_EABI_SYSCALL, ULONGEST_MAX },
+ { TRAMP_SENTINEL_INSN } },
+ arm_linux_rt_sigreturn_init };
+
+static struct tramp_frame thumb2_eabi_linux_sigreturn_tramp_frame
+ = { SIGTRAMP_FRAME,
+ 2,
+ { { THUMB2_SET_R7_SIGRETURN1, ULONGEST_MAX },
+ { THUMB2_SET_R7_SIGRETURN2, ULONGEST_MAX },
+ { THUMB2_EABI_SYSCALL, ULONGEST_MAX },
+ { TRAMP_SENTINEL_INSN } },
+ arm_linux_sigreturn_init };
+
+static struct tramp_frame thumb2_eabi_linux_rt_sigreturn_tramp_frame
+ = { SIGTRAMP_FRAME,
+ 2,
+ { { THUMB2_SET_R7_RT_SIGRETURN1, ULONGEST_MAX },
+ { THUMB2_SET_R7_RT_SIGRETURN2, ULONGEST_MAX },
+ { THUMB2_EABI_SYSCALL, ULONGEST_MAX },
+ { TRAMP_SENTINEL_INSN } },
+ arm_linux_rt_sigreturn_init };
+
+static struct tramp_frame arm_linux_restart_syscall_tramp_frame
+ = { NORMAL_FRAME,
+ 4,
+ { { ARM_OABI_SYSCALL_RESTART_SYSCALL, ULONGEST_MAX },
+ { ARM_LDR_PC_SP_12, ULONGEST_MAX },
+ { TRAMP_SENTINEL_INSN } },
+ arm_linux_restart_syscall_init };
+
+static struct tramp_frame arm_kernel_linux_restart_syscall_tramp_frame
+ = { NORMAL_FRAME,
+ 4,
+ { { ARM_OABI_SYSCALL_RESTART_SYSCALL, ULONGEST_MAX },
+ { ARM_LDR_PC_SP_4, ULONGEST_MAX },
+ { TRAMP_SENTINEL_INSN } },
+ arm_linux_restart_syscall_init };
/* Core file and register set support. */
@@ -476,8 +452,8 @@ static struct tramp_frame arm_kernel_linux_restart_syscall_tramp_frame = {
void
arm_linux_supply_gregset (const struct regset *regset,
- struct regcache *regcache,
- int regnum, const void *gregs_buf, size_t len)
+ struct regcache *regcache, int regnum,
+ const void *gregs_buf, size_t len)
{
struct gdbarch *gdbarch = regcache->arch ();
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
@@ -494,17 +470,19 @@ arm_linux_supply_gregset (const struct regset *regset,
{
if (arm_apcs_32)
regcache->raw_supply (ARM_PS_REGNUM,
- gregs + ARM_INT_REGISTER_SIZE * ARM_CPSR_GREGNUM);
+ gregs
+ + ARM_INT_REGISTER_SIZE * ARM_CPSR_GREGNUM);
else
regcache->raw_supply (ARM_PS_REGNUM,
- gregs + ARM_INT_REGISTER_SIZE * ARM_PC_REGNUM);
+ gregs + ARM_INT_REGISTER_SIZE * ARM_PC_REGNUM);
}
if (regnum == ARM_PC_REGNUM || regnum == -1)
{
- reg_pc = extract_unsigned_integer (
- gregs + ARM_INT_REGISTER_SIZE * ARM_PC_REGNUM,
- ARM_INT_REGISTER_SIZE, byte_order);
+ reg_pc
+ = extract_unsigned_integer (gregs
+ + ARM_INT_REGISTER_SIZE * ARM_PC_REGNUM,
+ ARM_INT_REGISTER_SIZE, byte_order);
reg_pc = gdbarch_addr_bits_remove (gdbarch, reg_pc);
store_unsigned_integer (pc_buf, ARM_INT_REGISTER_SIZE, byte_order,
reg_pc);
@@ -514,25 +492,25 @@ arm_linux_supply_gregset (const struct regset *regset,
void
arm_linux_collect_gregset (const struct regset *regset,
- const struct regcache *regcache,
- int regnum, void *gregs_buf, size_t len)
+ const struct regcache *regcache, int regnum,
+ void *gregs_buf, size_t len)
{
gdb_byte *gregs = (gdb_byte *) gregs_buf;
int regno;
for (regno = ARM_A1_REGNUM; regno < ARM_PC_REGNUM; regno++)
if (regnum == -1 || regnum == regno)
- regcache->raw_collect (regno,
- gregs + ARM_INT_REGISTER_SIZE * regno);
+ regcache->raw_collect (regno, gregs + ARM_INT_REGISTER_SIZE * regno);
if (regnum == ARM_PS_REGNUM || regnum == -1)
{
if (arm_apcs_32)
regcache->raw_collect (ARM_PS_REGNUM,
- gregs + ARM_INT_REGISTER_SIZE * ARM_CPSR_GREGNUM);
+ gregs
+ + ARM_INT_REGISTER_SIZE * ARM_CPSR_GREGNUM);
else
regcache->raw_collect (ARM_PS_REGNUM,
- gregs + ARM_INT_REGISTER_SIZE * ARM_PC_REGNUM);
+ gregs + ARM_INT_REGISTER_SIZE * ARM_PC_REGNUM);
}
if (regnum == ARM_PC_REGNUM || regnum == -1)
@@ -542,10 +520,10 @@ arm_linux_collect_gregset (const struct regset *regset,
/* Support for register format used by the NWFPE FPA emulator. */
-#define typeNone 0x00
-#define typeSingle 0x01
-#define typeDouble 0x02
-#define typeExtended 0x03
+#define typeNone 0x00
+#define typeSingle 0x01
+#define typeDouble 0x02
+#define typeExtended 0x03
void
supply_nwfpe_register (struct regcache *regcache, int regno,
@@ -620,16 +598,14 @@ collect_nwfpe_register (const struct regcache *regcache, int regno,
}
void
-arm_linux_supply_nwfpe (const struct regset *regset,
- struct regcache *regcache,
+arm_linux_supply_nwfpe (const struct regset *regset, struct regcache *regcache,
int regnum, const void *regs_buf, size_t len)
{
const gdb_byte *regs = (const gdb_byte *) regs_buf;
int regno;
if (regnum == ARM_FPS_REGNUM || regnum == -1)
- regcache->raw_supply (ARM_FPS_REGNUM,
- regs + NWFPE_FPSR_OFFSET);
+ regcache->raw_supply (ARM_FPS_REGNUM, regs + NWFPE_FPSR_OFFSET);
for (regno = ARM_F0_REGNUM; regno <= ARM_F7_REGNUM; regno++)
if (regnum == -1 || regnum == regno)
@@ -638,8 +614,8 @@ arm_linux_supply_nwfpe (const struct regset *regset,
void
arm_linux_collect_nwfpe (const struct regset *regset,
- const struct regcache *regcache,
- int regnum, void *regs_buf, size_t len)
+ const struct regcache *regcache, int regnum,
+ void *regs_buf, size_t len)
{
gdb_byte *regs = (gdb_byte *) regs_buf;
int regno;
@@ -658,8 +634,7 @@ arm_linux_collect_nwfpe (const struct regset *regset,
#define ARM_LINUX_SIZEOF_VFP (32 * 8 + 4)
static void
-arm_linux_supply_vfp (const struct regset *regset,
- struct regcache *regcache,
+arm_linux_supply_vfp (const struct regset *regset, struct regcache *regcache,
int regnum, const void *regs_buf, size_t len)
{
const gdb_byte *regs = (const gdb_byte *) regs_buf;
@@ -675,8 +650,8 @@ arm_linux_supply_vfp (const struct regset *regset,
static void
arm_linux_collect_vfp (const struct regset *regset,
- const struct regcache *regcache,
- int regnum, void *regs_buf, size_t len)
+ const struct regcache *regcache, int regnum,
+ void *regs_buf, size_t len)
{
gdb_byte *regs = (gdb_byte *) regs_buf;
int regno;
@@ -689,20 +664,14 @@ arm_linux_collect_vfp (const struct regset *regset,
regcache->raw_collect (regno, regs + (regno - ARM_D0_REGNUM) * 8);
}
-static const struct regset arm_linux_gregset =
- {
- NULL, arm_linux_supply_gregset, arm_linux_collect_gregset
- };
+static const struct regset arm_linux_gregset
+ = { NULL, arm_linux_supply_gregset, arm_linux_collect_gregset };
-static const struct regset arm_linux_fpregset =
- {
- NULL, arm_linux_supply_nwfpe, arm_linux_collect_nwfpe
- };
+static const struct regset arm_linux_fpregset
+ = { NULL, arm_linux_supply_nwfpe, arm_linux_collect_nwfpe };
-static const struct regset arm_linux_vfpregset =
- {
- NULL, arm_linux_supply_vfp, arm_linux_collect_vfp
- };
+static const struct regset arm_linux_vfpregset
+ = { NULL, arm_linux_supply_vfp, arm_linux_collect_vfp };
/* Iterate over core file register note sections. */
@@ -729,8 +698,7 @@ arm_linux_iterate_over_regset_sections (struct gdbarch *gdbarch,
static const struct target_desc *
arm_linux_core_read_description (struct gdbarch *gdbarch,
- struct target_ops *target,
- bfd *abfd)
+ struct target_ops *target, bfd *abfd)
{
gdb::optional<gdb::byte_vector> auxv = target_read_auxv_raw (target);
CORE_ADDR arm_hwcap = linux_get_hwcap (auxv, target, gdbarch);
@@ -750,15 +718,14 @@ arm_linux_core_read_description (struct gdbarch *gdbarch,
return nullptr;
}
-
/* Copy the value of next pc of sigreturn and rt_sigrturn into PC,
return 1. In addition, set IS_THUMB depending on whether we
will return to ARM or Thumb code. Return 0 if it is not a
rt_sigreturn/sigreturn syscall. */
static int
arm_linux_sigreturn_return_addr (frame_info_ptr frame,
- unsigned long svc_number,
- CORE_ADDR *pc, int *is_thumb)
+ unsigned long svc_number, CORE_ADDR *pc,
+ int *is_thumb)
{
/* Is this a sigreturn or rt_sigreturn syscall? */
if (svc_number == 119 || svc_number == 173)
@@ -794,8 +761,7 @@ arm_linux_sigreturn_next_pc (struct regcache *regcache,
int is_sigreturn = 0;
CORE_ADDR cpsr;
- gdb_assert (svc_number == ARM_SIGRETURN
- || svc_number == ARM_RT_SIGRETURN);
+ gdb_assert (svc_number == ARM_SIGRETURN || svc_number == ARM_RT_SIGRETURN);
is_sigreturn = (svc_number == ARM_SIGRETURN);
regcache_cooked_read_unsigned (regcache, ARM_SP_REGNUM, &sp);
@@ -819,8 +785,7 @@ arm_linux_sigreturn_next_pc (struct regcache *regcache,
When the function fails, it should return -1. */
static LONGEST
-arm_linux_get_syscall_number (struct gdbarch *gdbarch,
- thread_info *thread)
+arm_linux_get_syscall_number (struct gdbarch *gdbarch, thread_info *thread)
{
struct regcache *regs = get_thread_regcache (thread);
@@ -840,13 +805,13 @@ arm_linux_get_syscall_number (struct gdbarch *gdbarch,
}
else
{
- enum bfd_endian byte_order_for_code =
- gdbarch_byte_order_for_code (gdbarch);
+ enum bfd_endian byte_order_for_code
+ = gdbarch_byte_order_for_code (gdbarch);
/* PC gets incremented before the syscall-stop, so read the
previous instruction. */
- unsigned long this_instr =
- read_memory_unsigned_integer (pc - 4, 4, byte_order_for_code);
+ unsigned long this_instr
+ = read_memory_unsigned_integer (pc - 4, 4, byte_order_for_code);
unsigned long svc_operand = (0x00ffffff & this_instr);
@@ -881,13 +846,13 @@ arm_linux_get_next_pcs_syscall_next_pc (struct arm_get_next_pcs *self)
else
{
struct gdbarch *gdbarch = self->regcache->arch ();
- enum bfd_endian byte_order_for_code =
- gdbarch_byte_order_for_code (gdbarch);
- unsigned long this_instr =
- read_memory_unsigned_integer (pc, 4, byte_order_for_code);
+ enum bfd_endian byte_order_for_code
+ = gdbarch_byte_order_for_code (gdbarch);
+ unsigned long this_instr
+ = read_memory_unsigned_integer (pc, 4, byte_order_for_code);
unsigned long svc_operand = (0x00ffffff & this_instr);
- if (svc_operand) /* OABI. */
+ if (svc_operand) /* OABI. */
{
svc_number = svc_operand - 0x900000;
}
@@ -903,8 +868,8 @@ arm_linux_get_next_pcs_syscall_next_pc (struct arm_get_next_pcs *self)
{
/* SIGRETURN or RT_SIGRETURN may affect the arm thumb mode, so
update IS_THUMB. */
- next_pc = arm_linux_sigreturn_next_pc (self->regcache, svc_number,
- &is_thumb);
+ next_pc
+ = arm_linux_sigreturn_next_pc (self->regcache, svc_number, &is_thumb);
}
/* Addresses for calling Thumb functions have the bit 0 set. */
@@ -914,7 +879,6 @@ arm_linux_get_next_pcs_syscall_next_pc (struct arm_get_next_pcs *self)
return next_pc;
}
-
/* Insert a single step breakpoint at the next executed instruction. */
static std::vector<CORE_ADDR>
@@ -928,12 +892,9 @@ arm_linux_software_single_step (struct regcache *regcache)
if (target_can_do_single_step () == 1)
return {};
- arm_get_next_pcs_ctor (&next_pcs_ctx,
- &arm_linux_get_next_pcs_ops,
+ arm_get_next_pcs_ctor (&next_pcs_ctx, &arm_linux_get_next_pcs_ops,
gdbarch_byte_order (gdbarch),
- gdbarch_byte_order_for_code (gdbarch),
- 1,
- regcache);
+ gdbarch_byte_order_for_code (gdbarch), 1, regcache);
std::vector<CORE_ADDR> next_pcs = arm_get_next_pcs (&next_pcs_ctx);
@@ -946,8 +907,7 @@ arm_linux_software_single_step (struct regcache *regcache)
/* Support for displaced stepping of Linux SVC instructions. */
static void
-arm_linux_cleanup_svc (struct gdbarch *gdbarch,
- struct regcache *regs,
+arm_linux_cleanup_svc (struct gdbarch *gdbarch, struct regcache *regs,
arm_displaced_step_copy_insn_closure *dsc)
{
ULONGEST apparent_pc;
@@ -961,9 +921,8 @@ arm_linux_cleanup_svc (struct gdbarch *gdbarch,
displaced_debug_printf ("PC is apparently %.8lx after SVC step %s",
(unsigned long) apparent_pc,
- (within_scratch
- ? "(within scratch space)"
- : "(outside scratch space)"));
+ (within_scratch ? "(within scratch space)"
+ : "(outside scratch space)"));
if (within_scratch)
displaced_write_reg (regs, dsc, ARM_PC_REGNUM,
@@ -983,8 +942,8 @@ arm_linux_copy_svc (struct gdbarch *gdbarch, struct regcache *regs,
frame = get_current_frame ();
- is_sigreturn = arm_linux_sigreturn_return_addr(frame, svc_number,
- &return_to, &is_thumb);
+ is_sigreturn = arm_linux_sigreturn_return_addr (frame, svc_number,
+ &return_to, &is_thumb);
if (is_sigreturn)
{
struct symtab_and_line sal;
@@ -993,11 +952,11 @@ arm_linux_copy_svc (struct gdbarch *gdbarch, struct regcache *regs,
"PC in frame = %lx",
(unsigned long) get_frame_pc (frame));
- displaced_debug_printf ("unwind pc = %lx. Setting momentary breakpoint.",
- (unsigned long) return_to);
+ displaced_debug_printf (
+ "unwind pc = %lx. Setting momentary breakpoint.",
+ (unsigned long) return_to);
- gdb_assert (inferior_thread ()->control.step_resume_breakpoint
- == NULL);
+ gdb_assert (inferior_thread ()->control.step_resume_breakpoint == NULL);
sal = find_pc_line (return_to, 0);
sal.pc = return_to;
@@ -1010,7 +969,8 @@ arm_linux_copy_svc (struct gdbarch *gdbarch, struct regcache *regs,
{
inferior_thread ()->control.step_resume_breakpoint
= set_momentary_breakpoint (gdbarch, sal, get_frame_id (frame),
- bp_step_resume).release ();
+ bp_step_resume)
+ .release ();
/* set_momentary_breakpoint invalidates FRAME. */
frame = NULL;
@@ -1020,8 +980,9 @@ arm_linux_copy_svc (struct gdbarch *gdbarch, struct regcache *regs,
insert_breakpoints ();
}
else
- displaced_debug_printf ("couldn't find previous frame to set momentary "
- "breakpoint for sigreturn/rt_sigreturn");
+ displaced_debug_printf (
+ "couldn't find previous frame to set momentary "
+ "breakpoint for sigreturn/rt_sigreturn");
}
else
displaced_debug_printf ("found SVC call");
@@ -1032,7 +993,6 @@ arm_linux_copy_svc (struct gdbarch *gdbarch, struct regcache *regs,
Cleanup: if pc lands in scratch space, pc <- insn_addr + insn_size
else leave pc alone. */
-
dsc->cleanup = &arm_linux_cleanup_svc;
/* Pretend we wrote to the PC, so cleanup doesn't set PC to the next
instruction. */
@@ -1041,7 +1001,6 @@ arm_linux_copy_svc (struct gdbarch *gdbarch, struct regcache *regs,
return 0;
}
-
/* The following two functions implement single-stepping over calls to Linux
kernel helper routines, which perform e.g. atomic operations on architecture
variants which don't support them natively.
@@ -1056,8 +1015,7 @@ arm_linux_copy_svc (struct gdbarch *gdbarch, struct regcache *regs,
would have been called from the non-displaced location). */
static void
-cleanup_kernel_helper_return (struct gdbarch *gdbarch,
- struct regcache *regs,
+cleanup_kernel_helper_return (struct gdbarch *gdbarch, struct regcache *regs,
arm_displaced_step_copy_insn_closure *dsc)
{
displaced_write_reg (regs, dsc, ARM_LR_REGNUM, dsc->tmp[0], CANNOT_WRITE_PC);
@@ -1089,7 +1047,7 @@ arm_catch_kernel_helper_return (struct gdbarch *gdbarch, CORE_ADDR from,
CANNOT_WRITE_PC);
write_memory_unsigned_integer (to + 8, 4, byte_order, from);
- dsc->modinsn[0] = 0xe59ef004; /* ldr pc, [lr, #4]. */
+ dsc->modinsn[0] = 0xe59ef004; /* ldr pc, [lr, #4]. */
}
/* Linux-specific displaced step instruction copying function. Detects when
@@ -1097,12 +1055,11 @@ arm_catch_kernel_helper_return (struct gdbarch *gdbarch, CORE_ADDR from,
handled as a special case). */
static displaced_step_copy_insn_closure_up
-arm_linux_displaced_step_copy_insn (struct gdbarch *gdbarch,
- CORE_ADDR from, CORE_ADDR to,
- struct regcache *regs)
+arm_linux_displaced_step_copy_insn (struct gdbarch *gdbarch, CORE_ADDR from,
+ CORE_ADDR to, struct regcache *regs)
{
- std::unique_ptr<arm_displaced_step_copy_insn_closure> dsc
- (new arm_displaced_step_copy_insn_closure);
+ std::unique_ptr<arm_displaced_step_copy_insn_closure> dsc (
+ new arm_displaced_step_copy_insn_closure);
/* Detect when we enter an (inaccessible by GDB) Linux kernel helper, and
stop at the return location. */
@@ -1134,9 +1091,9 @@ static int
arm_stap_is_single_operand (struct gdbarch *gdbarch, const char *s)
{
return (*s == '#' || *s == '$' || isdigit (*s) /* Literal number. */
- || *s == '[' /* Register indirection or
+ || *s == '[' /* Register indirection or
displacement. */
- || isalpha (*s)); /* Register value. */
+ || isalpha (*s)); /* Register value. */
}
/* This routine is used to parse a special token in ARM's assembly.
@@ -1194,8 +1151,8 @@ arm_stap_parse_special_token (struct gdbarch *gdbarch,
regname[len] = '\0';
if (user_reg_map_name_to_regnum (gdbarch, regname, len) == -1)
- error (_("Invalid register name `%s' on expression `%s'."),
- regname, p->saved_arg);
+ error (_ ("Invalid register name `%s' on expression `%s'."), regname,
+ p->saved_arg);
++tmp;
tmp = skip_spaces (tmp);
@@ -1222,20 +1179,19 @@ arm_stap_parse_special_token (struct gdbarch *gdbarch,
struct type *long_type = builtin_type (gdbarch)->builtin_long;
if (got_minus)
displacement = -displacement;
- operation_up disp = make_operation<long_const_operation> (long_type,
- displacement);
+ operation_up disp
+ = make_operation<long_const_operation> (long_type, displacement);
/* The register name. */
- operation_up reg
- = make_operation<register_operation> (regname);
+ operation_up reg = make_operation<register_operation> (regname);
operation_up sum
= make_operation<add_operation> (std::move (reg), std::move (disp));
/* Casting to the expected type. */
struct type *arg_ptr_type = lookup_pointer_type (p->arg_type);
- sum = make_operation<unop_cast_operation> (std::move (sum),
- arg_ptr_type);
+ sum
+ = make_operation<unop_cast_operation> (std::move (sum), arg_ptr_type);
return make_operation<unop_ind_operation> (std::move (sum));
}
@@ -1255,341 +1211,656 @@ arm_canonicalize_syscall (int syscall)
{
switch (syscall)
{
- case 0: return gdb_sys_restart_syscall;
- case 1: return gdb_sys_exit;
- case 2: return gdb_sys_fork;
- case 3: return gdb_sys_read;
- case 4: return gdb_sys_write;
- case 5: return gdb_sys_open;
- case 6: return gdb_sys_close;
- case 8: return gdb_sys_creat;
- case 9: return gdb_sys_link;
- case 10: return gdb_sys_unlink;
- case 11: return gdb_sys_execve;
- case 12: return gdb_sys_chdir;
- case 13: return gdb_sys_time;
- case 14: return gdb_sys_mknod;
- case 15: return gdb_sys_chmod;
- case 16: return gdb_sys_lchown16;
- case 19: return gdb_sys_lseek;
- case 20: return gdb_sys_getpid;
- case 21: return gdb_sys_mount;
- case 22: return gdb_sys_oldumount;
- case 23: return gdb_sys_setuid16;
- case 24: return gdb_sys_getuid16;
- case 25: return gdb_sys_stime;
- case 26: return gdb_sys_ptrace;
- case 27: return gdb_sys_alarm;
- case 29: return gdb_sys_pause;
- case 30: return gdb_sys_utime;
- case 33: return gdb_sys_access;
- case 34: return gdb_sys_nice;
- case 36: return gdb_sys_sync;
- case 37: return gdb_sys_kill;
- case 38: return gdb_sys_rename;
- case 39: return gdb_sys_mkdir;
- case 40: return gdb_sys_rmdir;
- case 41: return gdb_sys_dup;
- case 42: return gdb_sys_pipe;
- case 43: return gdb_sys_times;
- case 45: return gdb_sys_brk;
- case 46: return gdb_sys_setgid16;
- case 47: return gdb_sys_getgid16;
- case 49: return gdb_sys_geteuid16;
- case 50: return gdb_sys_getegid16;
- case 51: return gdb_sys_acct;
- case 52: return gdb_sys_umount;
- case 54: return gdb_sys_ioctl;
- case 55: return gdb_sys_fcntl;
- case 57: return gdb_sys_setpgid;
- case 60: return gdb_sys_umask;
- case 61: return gdb_sys_chroot;
- case 62: return gdb_sys_ustat;
- case 63: return gdb_sys_dup2;
- case 64: return gdb_sys_getppid;
- case 65: return gdb_sys_getpgrp;
- case 66: return gdb_sys_setsid;
- case 67: return gdb_sys_sigaction;
- case 70: return gdb_sys_setreuid16;
- case 71: return gdb_sys_setregid16;
- case 72: return gdb_sys_sigsuspend;
- case 73: return gdb_sys_sigpending;
- case 74: return gdb_sys_sethostname;
- case 75: return gdb_sys_setrlimit;
- case 76: return gdb_sys_getrlimit;
- case 77: return gdb_sys_getrusage;
- case 78: return gdb_sys_gettimeofday;
- case 79: return gdb_sys_settimeofday;
- case 80: return gdb_sys_getgroups16;
- case 81: return gdb_sys_setgroups16;
- case 82: return gdb_sys_select;
- case 83: return gdb_sys_symlink;
- case 85: return gdb_sys_readlink;
- case 86: return gdb_sys_uselib;
- case 87: return gdb_sys_swapon;
- case 88: return gdb_sys_reboot;
- case 89: return gdb_old_readdir;
- case 90: return gdb_old_mmap;
- case 91: return gdb_sys_munmap;
- case 92: return gdb_sys_truncate;
- case 93: return gdb_sys_ftruncate;
- case 94: return gdb_sys_fchmod;
- case 95: return gdb_sys_fchown16;
- case 96: return gdb_sys_getpriority;
- case 97: return gdb_sys_setpriority;
- case 99: return gdb_sys_statfs;
- case 100: return gdb_sys_fstatfs;
- case 102: return gdb_sys_socketcall;
- case 103: return gdb_sys_syslog;
- case 104: return gdb_sys_setitimer;
- case 105: return gdb_sys_getitimer;
- case 106: return gdb_sys_stat;
- case 107: return gdb_sys_lstat;
- case 108: return gdb_sys_fstat;
- case 111: return gdb_sys_vhangup;
+ case 0:
+ return gdb_sys_restart_syscall;
+ case 1:
+ return gdb_sys_exit;
+ case 2:
+ return gdb_sys_fork;
+ case 3:
+ return gdb_sys_read;
+ case 4:
+ return gdb_sys_write;
+ case 5:
+ return gdb_sys_open;
+ case 6:
+ return gdb_sys_close;
+ case 8:
+ return gdb_sys_creat;
+ case 9:
+ return gdb_sys_link;
+ case 10:
+ return gdb_sys_unlink;
+ case 11:
+ return gdb_sys_execve;
+ case 12:
+ return gdb_sys_chdir;
+ case 13:
+ return gdb_sys_time;
+ case 14:
+ return gdb_sys_mknod;
+ case 15:
+ return gdb_sys_chmod;
+ case 16:
+ return gdb_sys_lchown16;
+ case 19:
+ return gdb_sys_lseek;
+ case 20:
+ return gdb_sys_getpid;
+ case 21:
+ return gdb_sys_mount;
+ case 22:
+ return gdb_sys_oldumount;
+ case 23:
+ return gdb_sys_setuid16;
+ case 24:
+ return gdb_sys_getuid16;
+ case 25:
+ return gdb_sys_stime;
+ case 26:
+ return gdb_sys_ptrace;
+ case 27:
+ return gdb_sys_alarm;
+ case 29:
+ return gdb_sys_pause;
+ case 30:
+ return gdb_sys_utime;
+ case 33:
+ return gdb_sys_access;
+ case 34:
+ return gdb_sys_nice;
+ case 36:
+ return gdb_sys_sync;
+ case 37:
+ return gdb_sys_kill;
+ case 38:
+ return gdb_sys_rename;
+ case 39:
+ return gdb_sys_mkdir;
+ case 40:
+ return gdb_sys_rmdir;
+ case 41:
+ return gdb_sys_dup;
+ case 42:
+ return gdb_sys_pipe;
+ case 43:
+ return gdb_sys_times;
+ case 45:
+ return gdb_sys_brk;
+ case 46:
+ return gdb_sys_setgid16;
+ case 47:
+ return gdb_sys_getgid16;
+ case 49:
+ return gdb_sys_geteuid16;
+ case 50:
+ return gdb_sys_getegid16;
+ case 51:
+ return gdb_sys_acct;
+ case 52:
+ return gdb_sys_umount;
+ case 54:
+ return gdb_sys_ioctl;
+ case 55:
+ return gdb_sys_fcntl;
+ case 57:
+ return gdb_sys_setpgid;
+ case 60:
+ return gdb_sys_umask;
+ case 61:
+ return gdb_sys_chroot;
+ case 62:
+ return gdb_sys_ustat;
+ case 63:
+ return gdb_sys_dup2;
+ case 64:
+ return gdb_sys_getppid;
+ case 65:
+ return gdb_sys_getpgrp;
+ case 66:
+ return gdb_sys_setsid;
+ case 67:
+ return gdb_sys_sigaction;
+ case 70:
+ return gdb_sys_setreuid16;
+ case 71:
+ return gdb_sys_setregid16;
+ case 72:
+ return gdb_sys_sigsuspend;
+ case 73:
+ return gdb_sys_sigpending;
+ case 74:
+ return gdb_sys_sethostname;
+ case 75:
+ return gdb_sys_setrlimit;
+ case 76:
+ return gdb_sys_getrlimit;
+ case 77:
+ return gdb_sys_getrusage;
+ case 78:
+ return gdb_sys_gettimeofday;
+ case 79:
+ return gdb_sys_settimeofday;
+ case 80:
+ return gdb_sys_getgroups16;
+ case 81:
+ return gdb_sys_setgroups16;
+ case 82:
+ return gdb_sys_select;
+ case 83:
+ return gdb_sys_symlink;
+ case 85:
+ return gdb_sys_readlink;
+ case 86:
+ return gdb_sys_uselib;
+ case 87:
+ return gdb_sys_swapon;
+ case 88:
+ return gdb_sys_reboot;
+ case 89:
+ return gdb_old_readdir;
+ case 90:
+ return gdb_old_mmap;
+ case 91:
+ return gdb_sys_munmap;
+ case 92:
+ return gdb_sys_truncate;
+ case 93:
+ return gdb_sys_ftruncate;
+ case 94:
+ return gdb_sys_fchmod;
+ case 95:
+ return gdb_sys_fchown16;
+ case 96:
+ return gdb_sys_getpriority;
+ case 97:
+ return gdb_sys_setpriority;
+ case 99:
+ return gdb_sys_statfs;
+ case 100:
+ return gdb_sys_fstatfs;
+ case 102:
+ return gdb_sys_socketcall;
+ case 103:
+ return gdb_sys_syslog;
+ case 104:
+ return gdb_sys_setitimer;
+ case 105:
+ return gdb_sys_getitimer;
+ case 106:
+ return gdb_sys_stat;
+ case 107:
+ return gdb_sys_lstat;
+ case 108:
+ return gdb_sys_fstat;
+ case 111:
+ return gdb_sys_vhangup;
case 113: /* sys_syscall */
return gdb_sys_no_syscall;
- case 114: return gdb_sys_wait4;
- case 115: return gdb_sys_swapoff;
- case 116: return gdb_sys_sysinfo;
- case 117: return gdb_sys_ipc;
- case 118: return gdb_sys_fsync;
- case 119: return gdb_sys_sigreturn;
- case 120: return gdb_sys_clone;
- case 121: return gdb_sys_setdomainname;
- case 122: return gdb_sys_uname;
- case 124: return gdb_sys_adjtimex;
- case 125: return gdb_sys_mprotect;
- case 126: return gdb_sys_sigprocmask;
- case 128: return gdb_sys_init_module;
- case 129: return gdb_sys_delete_module;
- case 131: return gdb_sys_quotactl;
- case 132: return gdb_sys_getpgid;
- case 133: return gdb_sys_fchdir;
- case 134: return gdb_sys_bdflush;
- case 135: return gdb_sys_sysfs;
- case 136: return gdb_sys_personality;
- case 138: return gdb_sys_setfsuid16;
- case 139: return gdb_sys_setfsgid16;
- case 140: return gdb_sys_llseek;
- case 141: return gdb_sys_getdents;
- case 142: return gdb_sys_select;
- case 143: return gdb_sys_flock;
- case 144: return gdb_sys_msync;
- case 145: return gdb_sys_readv;
- case 146: return gdb_sys_writev;
- case 147: return gdb_sys_getsid;
- case 148: return gdb_sys_fdatasync;
- case 149: return gdb_sys_sysctl;
- case 150: return gdb_sys_mlock;
- case 151: return gdb_sys_munlock;
- case 152: return gdb_sys_mlockall;
- case 153: return gdb_sys_munlockall;
- case 154: return gdb_sys_sched_setparam;
- case 155: return gdb_sys_sched_getparam;
- case 156: return gdb_sys_sched_setscheduler;
- case 157: return gdb_sys_sched_getscheduler;
- case 158: return gdb_sys_sched_yield;
- case 159: return gdb_sys_sched_get_priority_max;
- case 160: return gdb_sys_sched_get_priority_min;
- case 161: return gdb_sys_sched_rr_get_interval;
- case 162: return gdb_sys_nanosleep;
- case 163: return gdb_sys_mremap;
- case 164: return gdb_sys_setresuid16;
- case 165: return gdb_sys_getresuid16;
- case 168: return gdb_sys_poll;
- case 169: return gdb_sys_nfsservctl;
- case 170: return gdb_sys_setresgid;
- case 171: return gdb_sys_getresgid;
- case 172: return gdb_sys_prctl;
- case 173: return gdb_sys_rt_sigreturn;
- case 174: return gdb_sys_rt_sigaction;
- case 175: return gdb_sys_rt_sigprocmask;
- case 176: return gdb_sys_rt_sigpending;
- case 177: return gdb_sys_rt_sigtimedwait;
- case 178: return gdb_sys_rt_sigqueueinfo;
- case 179: return gdb_sys_rt_sigsuspend;
- case 180: return gdb_sys_pread64;
- case 181: return gdb_sys_pwrite64;
- case 182: return gdb_sys_chown;
- case 183: return gdb_sys_getcwd;
- case 184: return gdb_sys_capget;
- case 185: return gdb_sys_capset;
- case 186: return gdb_sys_sigaltstack;
- case 187: return gdb_sys_sendfile;
- case 190: return gdb_sys_vfork;
- case 191: return gdb_sys_getrlimit;
- case 192: return gdb_sys_mmap2;
- case 193: return gdb_sys_truncate64;
- case 194: return gdb_sys_ftruncate64;
- case 195: return gdb_sys_stat64;
- case 196: return gdb_sys_lstat64;
- case 197: return gdb_sys_fstat64;
- case 198: return gdb_sys_lchown;
- case 199: return gdb_sys_getuid;
- case 200: return gdb_sys_getgid;
- case 201: return gdb_sys_geteuid;
- case 202: return gdb_sys_getegid;
- case 203: return gdb_sys_setreuid;
- case 204: return gdb_sys_setregid;
- case 205: return gdb_sys_getgroups;
- case 206: return gdb_sys_setgroups;
- case 207: return gdb_sys_fchown;
- case 208: return gdb_sys_setresuid;
- case 209: return gdb_sys_getresuid;
- case 210: return gdb_sys_setresgid;
- case 211: return gdb_sys_getresgid;
- case 212: return gdb_sys_chown;
- case 213: return gdb_sys_setuid;
- case 214: return gdb_sys_setgid;
- case 215: return gdb_sys_setfsuid;
- case 216: return gdb_sys_setfsgid;
- case 217: return gdb_sys_getdents64;
- case 218: return gdb_sys_pivot_root;
- case 219: return gdb_sys_mincore;
- case 220: return gdb_sys_madvise;
- case 221: return gdb_sys_fcntl64;
- case 224: return gdb_sys_gettid;
- case 225: return gdb_sys_readahead;
- case 226: return gdb_sys_setxattr;
- case 227: return gdb_sys_lsetxattr;
- case 228: return gdb_sys_fsetxattr;
- case 229: return gdb_sys_getxattr;
- case 230: return gdb_sys_lgetxattr;
- case 231: return gdb_sys_fgetxattr;
- case 232: return gdb_sys_listxattr;
- case 233: return gdb_sys_llistxattr;
- case 234: return gdb_sys_flistxattr;
- case 235: return gdb_sys_removexattr;
- case 236: return gdb_sys_lremovexattr;
- case 237: return gdb_sys_fremovexattr;
- case 238: return gdb_sys_tkill;
- case 239: return gdb_sys_sendfile64;
- case 240: return gdb_sys_futex;
- case 241: return gdb_sys_sched_setaffinity;
- case 242: return gdb_sys_sched_getaffinity;
- case 243: return gdb_sys_io_setup;
- case 244: return gdb_sys_io_destroy;
- case 245: return gdb_sys_io_getevents;
- case 246: return gdb_sys_io_submit;
- case 247: return gdb_sys_io_cancel;
- case 248: return gdb_sys_exit_group;
- case 249: return gdb_sys_lookup_dcookie;
- case 250: return gdb_sys_epoll_create;
- case 251: return gdb_sys_epoll_ctl;
- case 252: return gdb_sys_epoll_wait;
- case 253: return gdb_sys_remap_file_pages;
- case 256: return gdb_sys_set_tid_address;
- case 257: return gdb_sys_timer_create;
- case 258: return gdb_sys_timer_settime;
- case 259: return gdb_sys_timer_gettime;
- case 260: return gdb_sys_timer_getoverrun;
- case 261: return gdb_sys_timer_delete;
- case 262: return gdb_sys_clock_settime;
- case 263: return gdb_sys_clock_gettime;
- case 264: return gdb_sys_clock_getres;
- case 265: return gdb_sys_clock_nanosleep;
- case 266: return gdb_sys_statfs64;
- case 267: return gdb_sys_fstatfs64;
- case 268: return gdb_sys_tgkill;
- case 269: return gdb_sys_utimes;
+ case 114:
+ return gdb_sys_wait4;
+ case 115:
+ return gdb_sys_swapoff;
+ case 116:
+ return gdb_sys_sysinfo;
+ case 117:
+ return gdb_sys_ipc;
+ case 118:
+ return gdb_sys_fsync;
+ case 119:
+ return gdb_sys_sigreturn;
+ case 120:
+ return gdb_sys_clone;
+ case 121:
+ return gdb_sys_setdomainname;
+ case 122:
+ return gdb_sys_uname;
+ case 124:
+ return gdb_sys_adjtimex;
+ case 125:
+ return gdb_sys_mprotect;
+ case 126:
+ return gdb_sys_sigprocmask;
+ case 128:
+ return gdb_sys_init_module;
+ case 129:
+ return gdb_sys_delete_module;
+ case 131:
+ return gdb_sys_quotactl;
+ case 132:
+ return gdb_sys_getpgid;
+ case 133:
+ return gdb_sys_fchdir;
+ case 134:
+ return gdb_sys_bdflush;
+ case 135:
+ return gdb_sys_sysfs;
+ case 136:
+ return gdb_sys_personality;
+ case 138:
+ return gdb_sys_setfsuid16;
+ case 139:
+ return gdb_sys_setfsgid16;
+ case 140:
+ return gdb_sys_llseek;
+ case 141:
+ return gdb_sys_getdents;
+ case 142:
+ return gdb_sys_select;
+ case 143:
+ return gdb_sys_flock;
+ case 144:
+ return gdb_sys_msync;
+ case 145:
+ return gdb_sys_readv;
+ case 146:
+ return gdb_sys_writev;
+ case 147:
+ return gdb_sys_getsid;
+ case 148:
+ return gdb_sys_fdatasync;
+ case 149:
+ return gdb_sys_sysctl;
+ case 150:
+ return gdb_sys_mlock;
+ case 151:
+ return gdb_sys_munlock;
+ case 152:
+ return gdb_sys_mlockall;
+ case 153:
+ return gdb_sys_munlockall;
+ case 154:
+ return gdb_sys_sched_setparam;
+ case 155:
+ return gdb_sys_sched_getparam;
+ case 156:
+ return gdb_sys_sched_setscheduler;
+ case 157:
+ return gdb_sys_sched_getscheduler;
+ case 158:
+ return gdb_sys_sched_yield;
+ case 159:
+ return gdb_sys_sched_get_priority_max;
+ case 160:
+ return gdb_sys_sched_get_priority_min;
+ case 161:
+ return gdb_sys_sched_rr_get_interval;
+ case 162:
+ return gdb_sys_nanosleep;
+ case 163:
+ return gdb_sys_mremap;
+ case 164:
+ return gdb_sys_setresuid16;
+ case 165:
+ return gdb_sys_getresuid16;
+ case 168:
+ return gdb_sys_poll;
+ case 169:
+ return gdb_sys_nfsservctl;
+ case 170:
+ return gdb_sys_setresgid;
+ case 171:
+ return gdb_sys_getresgid;
+ case 172:
+ return gdb_sys_prctl;
+ case 173:
+ return gdb_sys_rt_sigreturn;
+ case 174:
+ return gdb_sys_rt_sigaction;
+ case 175:
+ return gdb_sys_rt_sigprocmask;
+ case 176:
+ return gdb_sys_rt_sigpending;
+ case 177:
+ return gdb_sys_rt_sigtimedwait;
+ case 178:
+ return gdb_sys_rt_sigqueueinfo;
+ case 179:
+ return gdb_sys_rt_sigsuspend;
+ case 180:
+ return gdb_sys_pread64;
+ case 181:
+ return gdb_sys_pwrite64;
+ case 182:
+ return gdb_sys_chown;
+ case 183:
+ return gdb_sys_getcwd;
+ case 184:
+ return gdb_sys_capget;
+ case 185:
+ return gdb_sys_capset;
+ case 186:
+ return gdb_sys_sigaltstack;
+ case 187:
+ return gdb_sys_sendfile;
+ case 190:
+ return gdb_sys_vfork;
+ case 191:
+ return gdb_sys_getrlimit;
+ case 192:
+ return gdb_sys_mmap2;
+ case 193:
+ return gdb_sys_truncate64;
+ case 194:
+ return gdb_sys_ftruncate64;
+ case 195:
+ return gdb_sys_stat64;
+ case 196:
+ return gdb_sys_lstat64;
+ case 197:
+ return gdb_sys_fstat64;
+ case 198:
+ return gdb_sys_lchown;
+ case 199:
+ return gdb_sys_getuid;
+ case 200:
+ return gdb_sys_getgid;
+ case 201:
+ return gdb_sys_geteuid;
+ case 202:
+ return gdb_sys_getegid;
+ case 203:
+ return gdb_sys_setreuid;
+ case 204:
+ return gdb_sys_setregid;
+ case 205:
+ return gdb_sys_getgroups;
+ case 206:
+ return gdb_sys_setgroups;
+ case 207:
+ return gdb_sys_fchown;
+ case 208:
+ return gdb_sys_setresuid;
+ case 209:
+ return gdb_sys_getresuid;
+ case 210:
+ return gdb_sys_setresgid;
+ case 211:
+ return gdb_sys_getresgid;
+ case 212:
+ return gdb_sys_chown;
+ case 213:
+ return gdb_sys_setuid;
+ case 214:
+ return gdb_sys_setgid;
+ case 215:
+ return gdb_sys_setfsuid;
+ case 216:
+ return gdb_sys_setfsgid;
+ case 217:
+ return gdb_sys_getdents64;
+ case 218:
+ return gdb_sys_pivot_root;
+ case 219:
+ return gdb_sys_mincore;
+ case 220:
+ return gdb_sys_madvise;
+ case 221:
+ return gdb_sys_fcntl64;
+ case 224:
+ return gdb_sys_gettid;
+ case 225:
+ return gdb_sys_readahead;
+ case 226:
+ return gdb_sys_setxattr;
+ case 227:
+ return gdb_sys_lsetxattr;
+ case 228:
+ return gdb_sys_fsetxattr;
+ case 229:
+ return gdb_sys_getxattr;
+ case 230:
+ return gdb_sys_lgetxattr;
+ case 231:
+ return gdb_sys_fgetxattr;
+ case 232:
+ return gdb_sys_listxattr;
+ case 233:
+ return gdb_sys_llistxattr;
+ case 234:
+ return gdb_sys_flistxattr;
+ case 235:
+ return gdb_sys_removexattr;
+ case 236:
+ return gdb_sys_lremovexattr;
+ case 237:
+ return gdb_sys_fremovexattr;
+ case 238:
+ return gdb_sys_tkill;
+ case 239:
+ return gdb_sys_sendfile64;
+ case 240:
+ return gdb_sys_futex;
+ case 241:
+ return gdb_sys_sched_setaffinity;
+ case 242:
+ return gdb_sys_sched_getaffinity;
+ case 243:
+ return gdb_sys_io_setup;
+ case 244:
+ return gdb_sys_io_destroy;
+ case 245:
+ return gdb_sys_io_getevents;
+ case 246:
+ return gdb_sys_io_submit;
+ case 247:
+ return gdb_sys_io_cancel;
+ case 248:
+ return gdb_sys_exit_group;
+ case 249:
+ return gdb_sys_lookup_dcookie;
+ case 250:
+ return gdb_sys_epoll_create;
+ case 251:
+ return gdb_sys_epoll_ctl;
+ case 252:
+ return gdb_sys_epoll_wait;
+ case 253:
+ return gdb_sys_remap_file_pages;
+ case 256:
+ return gdb_sys_set_tid_address;
+ case 257:
+ return gdb_sys_timer_create;
+ case 258:
+ return gdb_sys_timer_settime;
+ case 259:
+ return gdb_sys_timer_gettime;
+ case 260:
+ return gdb_sys_timer_getoverrun;
+ case 261:
+ return gdb_sys_timer_delete;
+ case 262:
+ return gdb_sys_clock_settime;
+ case 263:
+ return gdb_sys_clock_gettime;
+ case 264:
+ return gdb_sys_clock_getres;
+ case 265:
+ return gdb_sys_clock_nanosleep;
+ case 266:
+ return gdb_sys_statfs64;
+ case 267:
+ return gdb_sys_fstatfs64;
+ case 268:
+ return gdb_sys_tgkill;
+ case 269:
+ return gdb_sys_utimes;
/*
case 270: return gdb_sys_arm_fadvise64_64;
case 271: return gdb_sys_pciconfig_iobase;
case 272: return gdb_sys_pciconfig_read;
case 273: return gdb_sys_pciconfig_write;
*/
- case 274: return gdb_sys_mq_open;
- case 275: return gdb_sys_mq_unlink;
- case 276: return gdb_sys_mq_timedsend;
- case 277: return gdb_sys_mq_timedreceive;
- case 278: return gdb_sys_mq_notify;
- case 279: return gdb_sys_mq_getsetattr;
- case 280: return gdb_sys_waitid;
- case 281: return gdb_sys_socket;
- case 282: return gdb_sys_bind;
- case 283: return gdb_sys_connect;
- case 284: return gdb_sys_listen;
- case 285: return gdb_sys_accept;
- case 286: return gdb_sys_getsockname;
- case 287: return gdb_sys_getpeername;
- case 288: return gdb_sys_socketpair;
- case 289: /* send */ return gdb_sys_no_syscall;
- case 290: return gdb_sys_sendto;
- case 291: return gdb_sys_recv;
- case 292: return gdb_sys_recvfrom;
- case 293: return gdb_sys_shutdown;
- case 294: return gdb_sys_setsockopt;
- case 295: return gdb_sys_getsockopt;
- case 296: return gdb_sys_sendmsg;
- case 297: return gdb_sys_recvmsg;
- case 298: return gdb_sys_semop;
- case 299: return gdb_sys_semget;
- case 300: return gdb_sys_semctl;
- case 301: return gdb_sys_msgsnd;
- case 302: return gdb_sys_msgrcv;
- case 303: return gdb_sys_msgget;
- case 304: return gdb_sys_msgctl;
- case 305: return gdb_sys_shmat;
- case 306: return gdb_sys_shmdt;
- case 307: return gdb_sys_shmget;
- case 308: return gdb_sys_shmctl;
- case 309: return gdb_sys_add_key;
- case 310: return gdb_sys_request_key;
- case 311: return gdb_sys_keyctl;
- case 312: return gdb_sys_semtimedop;
- case 313: /* vserver */ return gdb_sys_no_syscall;
- case 314: return gdb_sys_ioprio_set;
- case 315: return gdb_sys_ioprio_get;
- case 316: return gdb_sys_inotify_init;
- case 317: return gdb_sys_inotify_add_watch;
- case 318: return gdb_sys_inotify_rm_watch;
- case 319: return gdb_sys_mbind;
- case 320: return gdb_sys_get_mempolicy;
- case 321: return gdb_sys_set_mempolicy;
- case 322: return gdb_sys_openat;
- case 323: return gdb_sys_mkdirat;
- case 324: return gdb_sys_mknodat;
- case 325: return gdb_sys_fchownat;
- case 326: return gdb_sys_futimesat;
- case 327: return gdb_sys_fstatat64;
- case 328: return gdb_sys_unlinkat;
- case 329: return gdb_sys_renameat;
- case 330: return gdb_sys_linkat;
- case 331: return gdb_sys_symlinkat;
- case 332: return gdb_sys_readlinkat;
- case 333: return gdb_sys_fchmodat;
- case 334: return gdb_sys_faccessat;
- case 335: return gdb_sys_pselect6;
- case 336: return gdb_sys_ppoll;
- case 337: return gdb_sys_unshare;
- case 338: return gdb_sys_set_robust_list;
- case 339: return gdb_sys_get_robust_list;
- case 340: return gdb_sys_splice;
+ case 274:
+ return gdb_sys_mq_open;
+ case 275:
+ return gdb_sys_mq_unlink;
+ case 276:
+ return gdb_sys_mq_timedsend;
+ case 277:
+ return gdb_sys_mq_timedreceive;
+ case 278:
+ return gdb_sys_mq_notify;
+ case 279:
+ return gdb_sys_mq_getsetattr;
+ case 280:
+ return gdb_sys_waitid;
+ case 281:
+ return gdb_sys_socket;
+ case 282:
+ return gdb_sys_bind;
+ case 283:
+ return gdb_sys_connect;
+ case 284:
+ return gdb_sys_listen;
+ case 285:
+ return gdb_sys_accept;
+ case 286:
+ return gdb_sys_getsockname;
+ case 287:
+ return gdb_sys_getpeername;
+ case 288:
+ return gdb_sys_socketpair;
+ case 289: /* send */
+ return gdb_sys_no_syscall;
+ case 290:
+ return gdb_sys_sendto;
+ case 291:
+ return gdb_sys_recv;
+ case 292:
+ return gdb_sys_recvfrom;
+ case 293:
+ return gdb_sys_shutdown;
+ case 294:
+ return gdb_sys_setsockopt;
+ case 295:
+ return gdb_sys_getsockopt;
+ case 296:
+ return gdb_sys_sendmsg;
+ case 297:
+ return gdb_sys_recvmsg;
+ case 298:
+ return gdb_sys_semop;
+ case 299:
+ return gdb_sys_semget;
+ case 300:
+ return gdb_sys_semctl;
+ case 301:
+ return gdb_sys_msgsnd;
+ case 302:
+ return gdb_sys_msgrcv;
+ case 303:
+ return gdb_sys_msgget;
+ case 304:
+ return gdb_sys_msgctl;
+ case 305:
+ return gdb_sys_shmat;
+ case 306:
+ return gdb_sys_shmdt;
+ case 307:
+ return gdb_sys_shmget;
+ case 308:
+ return gdb_sys_shmctl;
+ case 309:
+ return gdb_sys_add_key;
+ case 310:
+ return gdb_sys_request_key;
+ case 311:
+ return gdb_sys_keyctl;
+ case 312:
+ return gdb_sys_semtimedop;
+ case 313: /* vserver */
+ return gdb_sys_no_syscall;
+ case 314:
+ return gdb_sys_ioprio_set;
+ case 315:
+ return gdb_sys_ioprio_get;
+ case 316:
+ return gdb_sys_inotify_init;
+ case 317:
+ return gdb_sys_inotify_add_watch;
+ case 318:
+ return gdb_sys_inotify_rm_watch;
+ case 319:
+ return gdb_sys_mbind;
+ case 320:
+ return gdb_sys_get_mempolicy;
+ case 321:
+ return gdb_sys_set_mempolicy;
+ case 322:
+ return gdb_sys_openat;
+ case 323:
+ return gdb_sys_mkdirat;
+ case 324:
+ return gdb_sys_mknodat;
+ case 325:
+ return gdb_sys_fchownat;
+ case 326:
+ return gdb_sys_futimesat;
+ case 327:
+ return gdb_sys_fstatat64;
+ case 328:
+ return gdb_sys_unlinkat;
+ case 329:
+ return gdb_sys_renameat;
+ case 330:
+ return gdb_sys_linkat;
+ case 331:
+ return gdb_sys_symlinkat;
+ case 332:
+ return gdb_sys_readlinkat;
+ case 333:
+ return gdb_sys_fchmodat;
+ case 334:
+ return gdb_sys_faccessat;
+ case 335:
+ return gdb_sys_pselect6;
+ case 336:
+ return gdb_sys_ppoll;
+ case 337:
+ return gdb_sys_unshare;
+ case 338:
+ return gdb_sys_set_robust_list;
+ case 339:
+ return gdb_sys_get_robust_list;
+ case 340:
+ return gdb_sys_splice;
/*case 341: return gdb_sys_arm_sync_file_range;*/
- case 342: return gdb_sys_tee;
- case 343: return gdb_sys_vmsplice;
- case 344: return gdb_sys_move_pages;
- case 345: return gdb_sys_getcpu;
- case 346: return gdb_sys_epoll_pwait;
- case 347: return gdb_sys_kexec_load;
+ case 342:
+ return gdb_sys_tee;
+ case 343:
+ return gdb_sys_vmsplice;
+ case 344:
+ return gdb_sys_move_pages;
+ case 345:
+ return gdb_sys_getcpu;
+ case 346:
+ return gdb_sys_epoll_pwait;
+ case 347:
+ return gdb_sys_kexec_load;
/*
case 348: return gdb_sys_utimensat;
case 349: return gdb_sys_signalfd;
case 350: return gdb_sys_timerfd_create;
case 351: return gdb_sys_eventfd;
*/
- case 352: return gdb_sys_fallocate;
+ case 352:
+ return gdb_sys_fallocate;
/*
case 353: return gdb_sys_timerfd_settime;
case 354: return gdb_sys_timerfd_gettime;
case 355: return gdb_sys_signalfd4;
*/
- case 356: return gdb_sys_eventfd2;
- case 357: return gdb_sys_epoll_create1;
- case 358: return gdb_sys_dup3;
- case 359: return gdb_sys_pipe2;
- case 360: return gdb_sys_inotify_init1;
+ case 356:
+ return gdb_sys_eventfd2;
+ case 357:
+ return gdb_sys_epoll_create1;
+ case 358:
+ return gdb_sys_dup3;
+ case 359:
+ return gdb_sys_pipe2;
+ case 360:
+ return gdb_sys_inotify_init1;
/*
case 361: return gdb_sys_preadv;
case 362: return gdb_sys_pwritev;
@@ -1611,13 +1882,20 @@ arm_canonicalize_syscall (int syscall)
case 378: return gdb_sys_kcmp;
case 379: return gdb_sys_finit_module;
*/
- case 384: return gdb_sys_getrandom;
- case 983041: /* ARM_breakpoint */ return gdb_sys_no_syscall;
- case 983042: /* ARM_cacheflush */ return gdb_sys_no_syscall;
- case 983043: /* ARM_usr26 */ return gdb_sys_no_syscall;
- case 983044: /* ARM_usr32 */ return gdb_sys_no_syscall;
- case 983045: /* ARM_set_tls */ return gdb_sys_no_syscall;
- default: return gdb_sys_no_syscall;
+ case 384:
+ return gdb_sys_getrandom;
+ case 983041: /* ARM_breakpoint */
+ return gdb_sys_no_syscall;
+ case 983042: /* ARM_cacheflush */
+ return gdb_sys_no_syscall;
+ case 983043: /* ARM_usr26 */
+ return gdb_sys_no_syscall;
+ case 983044: /* ARM_usr32 */
+ return gdb_sys_no_syscall;
+ case 983045: /* ARM_set_tls */
+ return gdb_sys_no_syscall;
+ default:
+ return gdb_sys_no_syscall;
}
}
@@ -1653,22 +1931,21 @@ arm_linux_syscall_record (struct regcache *regcache, unsigned long svc_number)
if (syscall_gdb == gdb_sys_no_syscall)
{
gdb_printf (gdb_stderr,
- _("Process record and replay target doesn't "
- "support syscall number %s\n"),
+ _ ("Process record and replay target doesn't "
+ "support syscall number %s\n"),
plongest (svc_number));
return -1;
}
- if (syscall_gdb == gdb_sys_sigreturn
- || syscall_gdb == gdb_sys_rt_sigreturn)
- {
- if (arm_all_but_pc_registers_record (regcache))
- return -1;
- return 0;
- }
+ if (syscall_gdb == gdb_sys_sigreturn || syscall_gdb == gdb_sys_rt_sigreturn)
+ {
+ if (arm_all_but_pc_registers_record (regcache))
+ return -1;
+ return 0;
+ }
- ret = record_linux_system_call (syscall_gdb, regcache,
- &arm_linux_record_tdep);
+ ret
+ = record_linux_system_call (syscall_gdb, regcache, &arm_linux_record_tdep);
if (ret != 0)
return ret;
@@ -1708,15 +1985,14 @@ arm_linux_gcc_target_options (struct gdbarch *gdbarch)
}
static void
-arm_linux_init_abi (struct gdbarch_info info,
- struct gdbarch *gdbarch)
+arm_linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
{
static const char *const stap_integer_prefixes[] = { "#", "$", "", NULL };
static const char *const stap_register_prefixes[] = { "r", NULL };
- static const char *const stap_register_indirection_prefixes[] = { "[",
- NULL };
- static const char *const stap_register_indirection_suffixes[] = { "]",
- NULL };
+ static const char *const stap_register_indirection_prefixes[]
+ = { "[", NULL };
+ static const char *const stap_register_indirection_suffixes[]
+ = { "]", NULL };
arm_gdbarch_tdep *tdep = gdbarch_tdep<arm_gdbarch_tdep> (gdbarch);
linux_init_abi (info, gdbarch, 1);
@@ -1758,14 +2034,14 @@ arm_linux_init_abi (struct gdbarch_info info,
tdep->jb_pc = ARM_LINUX_JB_PC_EABI;
break;
default:
- internal_error
- (_("arm_linux_init_abi: Floating point model not supported"));
+ internal_error (
+ _ ("arm_linux_init_abi: Floating point model not supported"));
break;
}
tdep->jb_elt_size = ARM_LINUX_JB_ELEMENT_SIZE;
- set_solib_svr4_fetch_link_map_offsets
- (gdbarch, linux_ilp32_fetch_link_map_offsets);
+ set_solib_svr4_fetch_link_map_offsets (gdbarch,
+ linux_ilp32_fetch_link_map_offsets);
/* Single stepping. */
set_gdbarch_software_single_step (gdbarch, arm_linux_software_single_step);
@@ -1778,10 +2054,8 @@ arm_linux_init_abi (struct gdbarch_info info,
set_gdbarch_fetch_tls_load_module_address (gdbarch,
svr4_fetch_objfile_link_map);
- tramp_frame_prepend_unwinder (gdbarch,
- &arm_linux_sigreturn_tramp_frame);
- tramp_frame_prepend_unwinder (gdbarch,
- &arm_linux_rt_sigreturn_tramp_frame);
+ tramp_frame_prepend_unwinder (gdbarch, &arm_linux_sigreturn_tramp_frame);
+ tramp_frame_prepend_unwinder (gdbarch, &arm_linux_rt_sigreturn_tramp_frame);
tramp_frame_prepend_unwinder (gdbarch,
&arm_eabi_linux_sigreturn_tramp_frame);
tramp_frame_prepend_unwinder (gdbarch,
@@ -1796,8 +2070,8 @@ arm_linux_init_abi (struct gdbarch_info info,
&arm_kernel_linux_restart_syscall_tramp_frame);
/* Core file support. */
- set_gdbarch_iterate_over_regset_sections
- (gdbarch, arm_linux_iterate_over_regset_sections);
+ set_gdbarch_iterate_over_regset_sections (
+ gdbarch, arm_linux_iterate_over_regset_sections);
set_gdbarch_core_read_description (gdbarch, arm_linux_core_read_description);
/* Displaced stepping. */
@@ -1811,14 +2085,13 @@ arm_linux_init_abi (struct gdbarch_info info,
/* SystemTap functions. */
set_gdbarch_stap_integer_prefixes (gdbarch, stap_integer_prefixes);
set_gdbarch_stap_register_prefixes (gdbarch, stap_register_prefixes);
- set_gdbarch_stap_register_indirection_prefixes (gdbarch,
- stap_register_indirection_prefixes);
- set_gdbarch_stap_register_indirection_suffixes (gdbarch,
- stap_register_indirection_suffixes);
+ set_gdbarch_stap_register_indirection_prefixes (
+ gdbarch, stap_register_indirection_prefixes);
+ set_gdbarch_stap_register_indirection_suffixes (
+ gdbarch, stap_register_indirection_suffixes);
set_gdbarch_stap_gdb_register_prefix (gdbarch, "r");
set_gdbarch_stap_is_single_operand (gdbarch, arm_stap_is_single_operand);
- set_gdbarch_stap_parse_special_token (gdbarch,
- arm_stap_parse_special_token);
+ set_gdbarch_stap_parse_special_token (gdbarch, arm_stap_parse_special_token);
/* `catch syscall' */
set_xml_syscall_file_name (gdbarch, "syscalls/arm-linux.xml");
@@ -1851,8 +2124,7 @@ arm_linux_init_abi (struct gdbarch_info info,
arm_linux_record_tdep.size_statfs = 64;
arm_linux_record_tdep.size_statfs64 = 84;
arm_linux_record_tdep.size_sockaddr = 16;
- arm_linux_record_tdep.size_int
- = gdbarch_int_bit (gdbarch) / TARGET_CHAR_BIT;
+ arm_linux_record_tdep.size_int = gdbarch_int_bit (gdbarch) / TARGET_CHAR_BIT;
arm_linux_record_tdep.size_long
= gdbarch_long_bit (gdbarch) / TARGET_CHAR_BIT;
arm_linux_record_tdep.size_ulong
@@ -1990,6 +2262,7 @@ arm_linux_init_abi (struct gdbarch_info info,
}
void _initialize_arm_linux_tdep ();
+
void
_initialize_arm_linux_tdep ()
{
diff --git a/gdb/arm-linux-tdep.h b/gdb/arm-linux-tdep.h
index fa4f2d82402..999ccbea1dc 100644
--- a/gdb/arm-linux-tdep.h
+++ b/gdb/arm-linux-tdep.h
@@ -23,9 +23,9 @@
struct regset;
struct regcache;
-#define ARM_LINUX_SIZEOF_NWFPE (8 * ARM_FP_REGISTER_SIZE \
- + 2 * ARM_INT_REGISTER_SIZE \
- + 8 + ARM_INT_REGISTER_SIZE)
+#define ARM_LINUX_SIZEOF_NWFPE \
+ (8 * ARM_FP_REGISTER_SIZE + 2 * ARM_INT_REGISTER_SIZE + 8 \
+ + ARM_INT_REGISTER_SIZE)
/* Support for register format used by the NWFPE FPA emulator. Each
register takes three words, where either the first one, two, or
@@ -41,11 +41,11 @@ struct regcache;
#define NWFPE_INITFLAG_OFFSET (NWFPE_TAGS_OFFSET + 8)
void arm_linux_supply_gregset (const struct regset *regset,
- struct regcache *regcache,
- int regnum, const void *gregs_buf, size_t len);
+ struct regcache *regcache, int regnum,
+ const void *gregs_buf, size_t len);
void arm_linux_collect_gregset (const struct regset *regset,
- const struct regcache *regcache,
- int regnum, void *gregs_buf, size_t len);
+ const struct regcache *regcache, int regnum,
+ void *gregs_buf, size_t len);
void supply_nwfpe_register (struct regcache *regcache, int regno,
const gdb_byte *regs);
@@ -53,18 +53,18 @@ void collect_nwfpe_register (const struct regcache *regcache, int regno,
gdb_byte *regs);
void arm_linux_supply_nwfpe (const struct regset *regset,
- struct regcache *regcache,
- int regnum, const void *regs_buf, size_t len);
+ struct regcache *regcache, int regnum,
+ const void *regs_buf, size_t len);
void arm_linux_collect_nwfpe (const struct regset *regset,
- const struct regcache *regcache,
- int regnum, void *regs_buf, size_t len);
+ const struct regcache *regcache, int regnum,
+ void *regs_buf, size_t len);
/* ARM GNU/Linux HWCAP values. These are in defined in
<asm/elf.h> in current kernels. */
-#define HWCAP_VFP 64
-#define HWCAP_IWMMXT 512
-#define HWCAP_NEON 4096
-#define HWCAP_VFPv3 8192
-#define HWCAP_VFPv3D16 16384
+#define HWCAP_VFP 64
+#define HWCAP_IWMMXT 512
+#define HWCAP_NEON 4096
+#define HWCAP_VFPv3 8192
+#define HWCAP_VFPv3D16 16384
#endif /* ARM_LINUX_TDEP_H */
diff --git a/gdb/arm-netbsd-nat.c b/gdb/arm-netbsd-nat.c
index d83714a46c3..fc9f9af7fff 100644
--- a/gdb/arm-netbsd-nat.c
+++ b/gdb/arm-netbsd-nat.c
@@ -39,6 +39,7 @@
class arm_netbsd_nat_target final : public nbsd_nat_target
{
public:
+
/* Add our register access methods. */
void fetch_registers (struct regcache *, int) override;
void store_registers (struct regcache *, int) override;
@@ -56,7 +57,8 @@ arm_supply_vfpregset (struct regcache *regcache, struct fpreg *fpregset)
struct vfpreg &vfp = fpregset->fpr_vfp;
for (int regno = 0; regno <= tdep->vfp_register_count; regno++)
- regcache->raw_supply (regno + ARM_D0_REGNUM, (char *) &vfp.vfp_regs[regno]);
+ regcache->raw_supply (regno + ARM_D0_REGNUM,
+ (char *) &vfp.vfp_regs[regno]);
regcache->raw_supply (ARM_FPSCR_REGNUM, (char *) &vfp.vfp_fpscr);
}
@@ -73,7 +75,7 @@ fetch_register (struct regcache *regcache, int regno)
if (ret < 0)
{
- warning (_("unable to fetch general register"));
+ warning (_ ("unable to fetch general register"));
return;
}
arm_nbsd_supply_gregset (nullptr, regcache, regno, &inferior_registers,
@@ -93,7 +95,7 @@ fetch_fp_register (struct regcache *regcache, int regno)
if (ret < 0)
{
- warning (_("unable to fetch floating-point register"));
+ warning (_ ("unable to fetch floating-point register"));
return;
}
@@ -107,7 +109,7 @@ fetch_fp_register (struct regcache *regcache, int regno)
(char *) &vfp.vfp_regs[regno - ARM_D0_REGNUM]);
}
else
- warning (_("Invalid register number."));
+ warning (_ ("Invalid register number."));
}
static void
@@ -123,7 +125,7 @@ fetch_fp_regs (struct regcache *regcache)
if (ret < 0)
{
- warning (_("unable to fetch general registers"));
+ warning (_ ("unable to fetch general registers"));
return;
}
@@ -147,7 +149,6 @@ arm_netbsd_nat_target::fetch_registers (struct regcache *regcache, int regno)
}
}
-
static void
store_register (const struct regcache *regcache, int regno)
{
@@ -161,7 +162,7 @@ store_register (const struct regcache *regcache, int regno)
if (ret < 0)
{
- warning (_("unable to fetch general registers"));
+ warning (_ ("unable to fetch general registers"));
return;
}
@@ -184,10 +185,10 @@ store_register (const struct regcache *regcache, int regno)
unsigned pc_val;
regcache->raw_collect (ARM_PC_REGNUM, (char *) &pc_val);
-
+
pc_val = gdbarch_addr_bits_remove (gdbarch, pc_val);
- inferior_registers.r_pc ^= gdbarch_addr_bits_remove
- (gdbarch, inferior_registers.r_pc);
+ inferior_registers.r_pc
+ ^= gdbarch_addr_bits_remove (gdbarch, inferior_registers.r_pc);
inferior_registers.r_pc |= pc_val;
}
break;
@@ -203,8 +204,8 @@ store_register (const struct regcache *regcache, int regno)
regcache->raw_collect (ARM_PS_REGNUM, (char *) &psr_val);
psr_val ^= gdbarch_addr_bits_remove (gdbarch, psr_val);
- inferior_registers.r_pc = gdbarch_addr_bits_remove
- (gdbarch, inferior_registers.r_pc);
+ inferior_registers.r_pc
+ = gdbarch_addr_bits_remove (gdbarch, inferior_registers.r_pc);
inferior_registers.r_pc |= psr_val;
}
break;
@@ -218,7 +219,7 @@ store_register (const struct regcache *regcache, int regno)
(PTRACE_TYPE_ARG3) &inferior_registers, lwp);
if (ret < 0)
- warning (_("unable to write register %d to inferior"), regno);
+ warning (_ ("unable to write register %d to inferior"), regno);
}
static void
@@ -230,7 +231,6 @@ store_regs (const struct regcache *regcache)
int ret;
int regno;
-
for (regno = ARM_A1_REGNUM; regno < ARM_SP_REGNUM; regno++)
regcache->raw_collect (regno, (char *) &inferior_registers.r[regno]);
@@ -250,7 +250,7 @@ store_regs (const struct regcache *regcache)
regcache->raw_collect (ARM_PC_REGNUM, (char *) &pc_val);
regcache->raw_collect (ARM_PS_REGNUM, (char *) &psr_val);
-
+
pc_val = gdbarch_addr_bits_remove (gdbarch, pc_val);
psr_val ^= gdbarch_addr_bits_remove (gdbarch, psr_val);
@@ -261,7 +261,7 @@ store_regs (const struct regcache *regcache)
(PTRACE_TYPE_ARG3) &inferior_registers, lwp);
if (ret < 0)
- warning (_("unable to store general registers"));
+ warning (_ ("unable to store general registers"));
}
static void
@@ -275,7 +275,7 @@ store_fp_register (const struct regcache *regcache, int regno)
if (ret < 0)
{
- warning (_("unable to fetch floating-point registers"));
+ warning (_ ("unable to fetch floating-point registers"));
return;
}
@@ -289,13 +289,13 @@ store_fp_register (const struct regcache *regcache, int regno)
(char *) &vfp.vfp_regs[regno - ARM_D0_REGNUM]);
}
else
- warning (_("Invalid register number."));
+ warning (_ ("Invalid register number."));
ret = ptrace (PT_SETFPREGS, regcache->ptid ().pid (),
(PTRACE_TYPE_ARG3) &inferior_fp_registers, lwp);
if (ret < 0)
- warning (_("unable to write register %d to inferior"), regno);
+ warning (_ ("unable to write register %d to inferior"), regno);
}
static void
@@ -308,17 +308,16 @@ store_fp_regs (const struct regcache *regcache)
struct fpreg fpregs;
for (int regno = 0; regno <= tdep->vfp_register_count; regno++)
- regcache->raw_collect
- (regno + ARM_D0_REGNUM, (char *) &fpregs.fpr_vfp.vfp_regs[regno]);
+ regcache->raw_collect (regno + ARM_D0_REGNUM,
+ (char *) &fpregs.fpr_vfp.vfp_regs[regno]);
- regcache->raw_collect (ARM_FPSCR_REGNUM,
- (char *) &fpregs.fpr_vfp.vfp_fpscr);
+ regcache->raw_collect (ARM_FPSCR_REGNUM, (char *) &fpregs.fpr_vfp.vfp_fpscr);
int ret = ptrace (PT_SETFPREGS, regcache->ptid ().pid (),
(PTRACE_TYPE_ARG3) &fpregs, lwp);
if (ret < 0)
- warning (_("unable to store floating-point registers"));
+ warning (_ ("unable to store floating-point registers"));
}
void
@@ -344,18 +343,18 @@ arm_netbsd_nat_target::read_description ()
int flag;
size_t len = sizeof (flag);
- if (sysctlbyname("machdep.fpu_present", &flag, &len, NULL, 0) != 0
- || !flag)
+ if (sysctlbyname ("machdep.fpu_present", &flag, &len, NULL, 0) != 0 || !flag)
return arm_read_description (ARM_FP_TYPE_NONE, false);
- len = sizeof(flag);
- if (sysctlbyname("machdep.neon_present", &flag, &len, NULL, 0) == 0 && flag)
+ len = sizeof (flag);
+ if (sysctlbyname ("machdep.neon_present", &flag, &len, NULL, 0) == 0 && flag)
return aarch32_read_description ();
return arm_read_description (ARM_FP_TYPE_VFPV3, false);
}
void _initialize_arm_netbsd_nat ();
+
void
_initialize_arm_netbsd_nat ()
{
diff --git a/gdb/arm-netbsd-tdep.c b/gdb/arm-netbsd-tdep.c
index 526f9545230..b59f387e876 100644
--- a/gdb/arm-netbsd-tdep.c
+++ b/gdb/arm-netbsd-tdep.c
@@ -33,10 +33,12 @@
/* For compatibility with previous implementations of GDB on arm/NetBSD,
override the default little-endian breakpoint. */
-static const gdb_byte arm_nbsd_arm_le_breakpoint[] = {0x11, 0x00, 0x00, 0xe6};
-static const gdb_byte arm_nbsd_arm_be_breakpoint[] = {0xe6, 0x00, 0x00, 0x11};
-static const gdb_byte arm_nbsd_thumb_le_breakpoint[] = {0xfe, 0xde};
-static const gdb_byte arm_nbsd_thumb_be_breakpoint[] = {0xde, 0xfe};
+static const gdb_byte arm_nbsd_arm_le_breakpoint[]
+ = { 0x11, 0x00, 0x00, 0xe6 };
+static const gdb_byte arm_nbsd_arm_be_breakpoint[]
+ = { 0xe6, 0x00, 0x00, 0x11 };
+static const gdb_byte arm_nbsd_thumb_le_breakpoint[] = { 0xfe, 0xde };
+static const gdb_byte arm_nbsd_thumb_be_breakpoint[] = { 0xde, 0xfe };
/* This matches struct reg from NetBSD's sys/arch/arm/include/reg.h:
https://github.com/NetBSD/src/blob/7c13e6e6773bb171f4ed3ed53013e9d24b3c1eac/sys/arch/arm/include/reg.h#L39
@@ -51,10 +53,11 @@ struct arm_nbsd_reg
};
void
-arm_nbsd_supply_gregset (const struct regset *regset, struct regcache *regcache,
- int regnum, const void *gregs, size_t len)
+arm_nbsd_supply_gregset (const struct regset *regset,
+ struct regcache *regcache, int regnum,
+ const void *gregs, size_t len)
{
- const arm_nbsd_reg *gregset = static_cast<const arm_nbsd_reg *>(gregs);
+ const arm_nbsd_reg *gregset = static_cast<const arm_nbsd_reg *> (gregs);
gdb_assert (len >= sizeof (arm_nbsd_reg));
/* Integer registers. */
@@ -70,7 +73,8 @@ arm_nbsd_supply_gregset (const struct regset *regset, struct regcache *regcache,
if (regnum == -1 || regnum == ARM_PC_REGNUM)
{
- CORE_ADDR r_pc = gdbarch_addr_bits_remove (regcache->arch (), gregset->pc);
+ CORE_ADDR r_pc
+ = gdbarch_addr_bits_remove (regcache->arch (), gregset->pc);
regcache->raw_supply (ARM_PC_REGNUM, (char *) &r_pc);
}
@@ -84,12 +88,10 @@ arm_nbsd_supply_gregset (const struct regset *regset, struct regcache *regcache,
}
static const struct regset arm_nbsd_regset = {
- nullptr,
- arm_nbsd_supply_gregset,
+ nullptr, arm_nbsd_supply_gregset,
/* We don't need a collect function because we only use this reading registers
(via iterate_over_regset_sections and fetch_regs/fetch_register). */
- nullptr,
- 0
+ nullptr, 0
};
static void
@@ -108,8 +110,7 @@ arm_nbsd_iterate_over_regset_sections (struct gdbarch *gdbarch,
}
static void
-arm_netbsd_init_abi_common (struct gdbarch_info info,
- struct gdbarch *gdbarch)
+arm_netbsd_init_abi_common (struct gdbarch_info info, struct gdbarch *gdbarch)
{
arm_gdbarch_tdep *tdep = gdbarch_tdep<arm_gdbarch_tdep> (gdbarch);
@@ -131,21 +132,20 @@ arm_netbsd_init_abi_common (struct gdbarch_info info,
break;
default:
- internal_error (_("arm_gdbarch_init: bad byte order for float format"));
+ internal_error (_ ("arm_gdbarch_init: bad byte order for float format"));
}
tdep->jb_pc = ARM_NBSD_JB_PC;
tdep->jb_elt_size = ARM_NBSD_JB_ELEMENT_SIZE;
- set_gdbarch_iterate_over_regset_sections
- (gdbarch, arm_nbsd_iterate_over_regset_sections);
+ set_gdbarch_iterate_over_regset_sections (
+ gdbarch, arm_nbsd_iterate_over_regset_sections);
/* Single stepping. */
set_gdbarch_software_single_step (gdbarch, arm_software_single_step);
}
static void
-arm_netbsd_elf_init_abi (struct gdbarch_info info,
- struct gdbarch *gdbarch)
+arm_netbsd_elf_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
{
arm_gdbarch_tdep *tdep = gdbarch_tdep<arm_gdbarch_tdep> (gdbarch);
@@ -157,11 +157,12 @@ arm_netbsd_elf_init_abi (struct gdbarch_info info,
tdep->fp_model = ARM_FLOAT_SOFT_VFP;
/* NetBSD ELF uses SVR4-style shared libraries. */
- set_solib_svr4_fetch_link_map_offsets
- (gdbarch, svr4_ilp32_fetch_link_map_offsets);
+ set_solib_svr4_fetch_link_map_offsets (gdbarch,
+ svr4_ilp32_fetch_link_map_offsets);
}
void _initialize_arm_netbsd_tdep ();
+
void
_initialize_arm_netbsd_tdep ()
{
diff --git a/gdb/arm-netbsd-tdep.h b/gdb/arm-netbsd-tdep.h
index 6600bfde7d0..ebf4b68f0cb 100644
--- a/gdb/arm-netbsd-tdep.h
+++ b/gdb/arm-netbsd-tdep.h
@@ -20,8 +20,8 @@
#ifndef ARM_NBSD_TDEP_H
#define ARM_NBSD_TDEP_H
-void arm_nbsd_supply_gregset
- (const struct regset *regset, struct regcache *regcache,
- int regnum, const void *gregs, size_t len);
+void arm_nbsd_supply_gregset (const struct regset *regset,
+ struct regcache *regcache, int regnum,
+ const void *gregs, size_t len);
#endif
diff --git a/gdb/arm-none-tdep.c b/gdb/arm-none-tdep.c
index 8aac6f96350..ecf2c4450ff 100644
--- a/gdb/arm-none-tdep.c
+++ b/gdb/arm-none-tdep.c
@@ -48,8 +48,8 @@
static void
arm_none_supply_gregset (const struct regset *regset,
- struct regcache *regcache,
- int regnum, const void *gregs_buf, size_t len)
+ struct regcache *regcache, int regnum,
+ const void *gregs_buf, size_t len)
{
struct gdbarch *gdbarch = regcache->arch ();
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
@@ -62,12 +62,12 @@ arm_none_supply_gregset (const struct regset *regset,
if (regnum == ARM_PS_REGNUM || regnum == -1)
{
if (arm_apcs_32)
- regcache->raw_supply (ARM_PS_REGNUM,
- gregs + ARM_INT_REGISTER_SIZE
- * ARM_NONE_CPSR_GREGNUM);
+ regcache->raw_supply (ARM_PS_REGNUM, gregs
+ + ARM_INT_REGISTER_SIZE
+ * ARM_NONE_CPSR_GREGNUM);
else
regcache->raw_supply (ARM_PS_REGNUM,
- gregs + ARM_INT_REGISTER_SIZE * ARM_PC_REGNUM);
+ gregs + ARM_INT_REGISTER_SIZE * ARM_PC_REGNUM);
}
if (regnum == ARM_PC_REGNUM || regnum == -1)
@@ -75,8 +75,8 @@ arm_none_supply_gregset (const struct regset *regset,
gdb_byte pc_buf[ARM_INT_REGISTER_SIZE];
CORE_ADDR reg_pc
- = extract_unsigned_integer (gregs + ARM_INT_REGISTER_SIZE
- * ARM_PC_REGNUM,
+ = extract_unsigned_integer (gregs
+ + ARM_INT_REGISTER_SIZE * ARM_PC_REGNUM,
ARM_INT_REGISTER_SIZE, byte_order);
reg_pc = gdbarch_addr_bits_remove (gdbarch, reg_pc);
store_unsigned_integer (pc_buf, ARM_INT_REGISTER_SIZE, byte_order,
@@ -95,22 +95,21 @@ arm_none_supply_gregset (const struct regset *regset,
static void
arm_none_collect_gregset (const struct regset *regset,
- const struct regcache *regcache,
- int regnum, void *gregs_buf, size_t len)
+ const struct regcache *regcache, int regnum,
+ void *gregs_buf, size_t len)
{
gdb_byte *gregs = (gdb_byte *) gregs_buf;
for (int regno = ARM_A1_REGNUM; regno < ARM_PC_REGNUM; regno++)
if (regnum == -1 || regnum == regno)
- regcache->raw_collect (regno,
- gregs + ARM_INT_REGISTER_SIZE * regno);
+ regcache->raw_collect (regno, gregs + ARM_INT_REGISTER_SIZE * regno);
if (regnum == ARM_PS_REGNUM || regnum == -1)
{
if (arm_apcs_32)
- regcache->raw_collect (ARM_PS_REGNUM,
- gregs + ARM_INT_REGISTER_SIZE
- * ARM_NONE_CPSR_GREGNUM);
+ regcache->raw_collect (ARM_PS_REGNUM, gregs
+ + ARM_INT_REGISTER_SIZE
+ * ARM_NONE_CPSR_GREGNUM);
else
regcache->raw_collect (ARM_PS_REGNUM,
gregs + ARM_INT_REGISTER_SIZE * ARM_PC_REGNUM);
@@ -124,8 +123,7 @@ arm_none_collect_gregset (const struct regset *regset,
/* Supply VFP registers from REGS_BUF into REGCACHE. */
static void
-arm_none_supply_vfp (const struct regset *regset,
- struct regcache *regcache,
+arm_none_supply_vfp (const struct regset *regset, struct regcache *regcache,
int regnum, const void *regs_buf, size_t len)
{
const gdb_byte *regs = (const gdb_byte *) regs_buf;
@@ -142,8 +140,8 @@ arm_none_supply_vfp (const struct regset *regset,
static void
arm_none_collect_vfp (const struct regset *regset,
- const struct regcache *regcache,
- int regnum, void *regs_buf, size_t len)
+ const struct regcache *regcache, int regnum,
+ void *regs_buf, size_t len)
{
gdb_byte *regs = (gdb_byte *) regs_buf;
@@ -157,17 +155,13 @@ arm_none_collect_vfp (const struct regset *regset,
/* The general purpose register set. */
-static const struct regset arm_none_gregset =
- {
- nullptr, arm_none_supply_gregset, arm_none_collect_gregset
- };
+static const struct regset arm_none_gregset
+ = { nullptr, arm_none_supply_gregset, arm_none_collect_gregset };
/* The VFP register set. */
-static const struct regset arm_none_vfpregset =
- {
- nullptr, arm_none_supply_vfp, arm_none_collect_vfp
- };
+static const struct regset arm_none_vfpregset
+ = { nullptr, arm_none_supply_vfp, arm_none_collect_vfp };
/* Iterate over core file register note sections. */
@@ -198,16 +192,16 @@ arm_none_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
/* Iterate over registers for reading and writing bare metal ARM core
files. */
- set_gdbarch_iterate_over_regset_sections
- (gdbarch, arm_none_iterate_over_regset_sections);
+ set_gdbarch_iterate_over_regset_sections (
+ gdbarch, arm_none_iterate_over_regset_sections);
}
/* Initialize ARM bare-metal target support. */
void _initialize_arm_none_tdep ();
+
void
_initialize_arm_none_tdep ()
{
- gdbarch_register_osabi (bfd_arch_arm, 0, GDB_OSABI_NONE,
- arm_none_init_abi);
+ gdbarch_register_osabi (bfd_arch_arm, 0, GDB_OSABI_NONE, arm_none_init_abi);
}
diff --git a/gdb/arm-obsd-tdep.c b/gdb/arm-obsd-tdep.c
index 8711f754c06..3b746095cb6 100644
--- a/gdb/arm-obsd-tdep.c
+++ b/gdb/arm-obsd-tdep.c
@@ -31,8 +31,7 @@
static void
armobsd_sigframe_init (const struct tramp_frame *self,
frame_info_ptr this_frame,
- struct trad_frame_cache *cache,
- CORE_ADDR func)
+ struct trad_frame_cache *cache, CORE_ADDR func)
{
CORE_ADDR sp, sigcontext_addr, addr;
int regnum;
@@ -53,28 +52,22 @@ armobsd_sigframe_init (const struct tramp_frame *self,
trad_frame_set_id (cache, frame_id_build (sp, func));
}
-static const struct tramp_frame armobsd_sigframe =
-{
- SIGTRAMP_FRAME,
- 4,
- {
- { 0xe28d0010, ULONGEST_MAX }, /* add r0, sp, #16 */
- { 0xef000067, ULONGEST_MAX }, /* swi SYS_sigreturn */
- { 0xef000001, ULONGEST_MAX }, /* swi SYS_exit */
- { 0xeafffffc, ULONGEST_MAX }, /* b . - 8 */
- { TRAMP_SENTINEL_INSN, ULONGEST_MAX }
- },
- armobsd_sigframe_init
-};
-
+static const struct tramp_frame armobsd_sigframe
+ = { SIGTRAMP_FRAME,
+ 4,
+ { { 0xe28d0010, ULONGEST_MAX }, /* add r0, sp, #16 */
+ { 0xef000067, ULONGEST_MAX }, /* swi SYS_sigreturn */
+ { 0xef000001, ULONGEST_MAX }, /* swi SYS_exit */
+ { 0xeafffffc, ULONGEST_MAX }, /* b . - 8 */
+ { TRAMP_SENTINEL_INSN, ULONGEST_MAX } },
+ armobsd_sigframe_init };
/* Override default thumb breakpoints. */
-static const gdb_byte arm_obsd_thumb_le_breakpoint[] = {0xfe, 0xdf};
-static const gdb_byte arm_obsd_thumb_be_breakpoint[] = {0xdf, 0xfe};
+static const gdb_byte arm_obsd_thumb_le_breakpoint[] = { 0xfe, 0xdf };
+static const gdb_byte arm_obsd_thumb_be_breakpoint[] = { 0xdf, 0xfe };
static void
-armobsd_init_abi (struct gdbarch_info info,
- struct gdbarch *gdbarch)
+armobsd_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
{
arm_gdbarch_tdep *tdep = gdbarch_tdep<arm_gdbarch_tdep> (gdbarch);
@@ -84,15 +77,15 @@ armobsd_init_abi (struct gdbarch_info info,
tramp_frame_prepend_unwinder (gdbarch, &armobsd_sigframe);
/* OpenBSD/arm uses SVR4-style shared libraries. */
- set_solib_svr4_fetch_link_map_offsets
- (gdbarch, svr4_ilp32_fetch_link_map_offsets);
+ set_solib_svr4_fetch_link_map_offsets (gdbarch,
+ svr4_ilp32_fetch_link_map_offsets);
set_gdbarch_skip_solib_resolver (gdbarch, obsd_skip_solib_resolver);
tdep->jb_pc = 24;
tdep->jb_elt_size = 4;
- set_gdbarch_iterate_over_regset_sections
- (gdbarch, armbsd_iterate_over_regset_sections);
+ set_gdbarch_iterate_over_regset_sections (
+ gdbarch, armbsd_iterate_over_regset_sections);
/* OpenBSD/arm uses -fpcc-struct-return by default. */
tdep->struct_return = pcc_struct_return;
@@ -116,6 +109,7 @@ armobsd_init_abi (struct gdbarch_info info,
}
void _initialize_armobsd_tdep ();
+
void
_initialize_armobsd_tdep ()
{
diff --git a/gdb/arm-pikeos-tdep.c b/gdb/arm-pikeos-tdep.c
index 2d7e6df9cfc..9540d6c434c 100644
--- a/gdb/arm-pikeos-tdep.c
+++ b/gdb/arm-pikeos-tdep.c
@@ -55,8 +55,8 @@ arm_pikeos_osabi_sniffer (bfd *abfd)
if (storage_needed <= 0)
return GDB_OSABI_UNKNOWN;
- gdb::unique_xmalloc_ptr<asymbol *> symbol_table
- ((asymbol **) xmalloc (storage_needed));
+ gdb::unique_xmalloc_ptr<asymbol *> symbol_table ((asymbol **)
+ xmalloc (storage_needed));
number_of_symbols = bfd_canonicalize_symtab (abfd, symbol_table.get ());
if (number_of_symbols <= 0)
@@ -66,8 +66,7 @@ arm_pikeos_osabi_sniffer (bfd *abfd)
{
const char *name = bfd_asymbol_name (symbol_table.get ()[i]);
- if (strcmp (name, "_vm_stack") == 0
- || strcmp (name, "__p4_stack") == 0)
+ if (strcmp (name, "_vm_stack") == 0 || strcmp (name, "__p4_stack") == 0)
pikeos_stack_found = 1;
if (strcmp (name, "_vm_stack_size") == 0
@@ -82,6 +81,7 @@ arm_pikeos_osabi_sniffer (bfd *abfd)
}
void _initialize_arm_pikeos_tdep ();
+
void
_initialize_arm_pikeos_tdep ()
{
diff --git a/gdb/arm-tdep.c b/gdb/arm-tdep.c
index 347f3e6b307..e8f9a9967f9 100644
--- a/gdb/arm-tdep.c
+++ b/gdb/arm-tdep.c
@@ -19,7 +19,7 @@
#include "defs.h"
-#include <ctype.h> /* XXX for isupper (). */
+#include <ctype.h> /* XXX for isupper (). */
#include "frame.h"
#include "language.h"
@@ -27,7 +27,7 @@
#include "infrun.h"
#include "gdbcmd.h"
#include "gdbcore.h"
-#include "dis-asm.h" /* For register styles. */
+#include "dis-asm.h" /* For register styles. */
#include "disasm.h"
#include "regcache.h"
#include "reggroups.h"
@@ -82,19 +82,19 @@ static bool arm_debug;
MSYMBOL_SET_SPECIAL Actually sets the "special" bit.
MSYMBOL_IS_SPECIAL Tests the "special" bit in a minimal symbol. */
-#define MSYMBOL_SET_SPECIAL(msym) \
- (msym)->set_target_flag_1 (true)
+#define MSYMBOL_SET_SPECIAL(msym) (msym)->set_target_flag_1 (true)
-#define MSYMBOL_IS_SPECIAL(msym) \
- (msym)->target_flag_1 ()
+#define MSYMBOL_IS_SPECIAL(msym) (msym)->target_flag_1 ()
struct arm_mapping_symbol
{
CORE_ADDR value;
char type;
- bool operator< (const arm_mapping_symbol &other) const
- { return this->value < other.value; }
+ bool operator<(const arm_mapping_symbol &other) const
+ {
+ return this->value < other.value;
+ }
};
typedef std::vector<arm_mapping_symbol> arm_mapping_symbol_vec;
@@ -102,9 +102,10 @@ typedef std::vector<arm_mapping_symbol> arm_mapping_symbol_vec;
struct arm_per_bfd
{
explicit arm_per_bfd (size_t num_sections)
- : section_maps (new arm_mapping_symbol_vec[num_sections]),
- section_maps_sorted (new bool[num_sections] ())
- {}
+ : section_maps (new arm_mapping_symbol_vec[num_sections]),
+ section_maps_sorted (new bool[num_sections]())
+ {
+ }
DISABLE_COPY_AND_ASSIGN (arm_per_bfd);
@@ -132,41 +133,22 @@ static struct cmd_list_element *showarmcmdlist = NULL;
/* The type of floating-point to use. Keep this in sync with enum
arm_float_model, and the help string in _initialize_arm_tdep. */
-static const char *const fp_model_strings[] =
-{
- "auto",
- "softfpa",
- "fpa",
- "softvfp",
- "vfp",
- NULL
-};
+static const char *const fp_model_strings[]
+ = { "auto", "softfpa", "fpa", "softvfp", "vfp", NULL };
/* A variable that can be configured by the user. */
static enum arm_float_model arm_fp_model = ARM_FLOAT_AUTO;
static const char *current_fp_model = "auto";
/* The ABI to use. Keep this in sync with arm_abi_kind. */
-static const char *const arm_abi_strings[] =
-{
- "auto",
- "APCS",
- "AAPCS",
- NULL
-};
+static const char *const arm_abi_strings[] = { "auto", "APCS", "AAPCS", NULL };
/* A variable that can be configured by the user. */
static enum arm_abi_kind arm_abi_global = ARM_ABI_AUTO;
static const char *arm_abi_string = "auto";
/* The execution mode to assume. */
-static const char *const arm_mode_strings[] =
- {
- "auto",
- "arm",
- "thumb",
- NULL
- };
+static const char *const arm_mode_strings[] = { "auto", "arm", "thumb", NULL };
static const char *arm_fallback_mode_string = "auto";
static const char *arm_force_mode_string = "auto";
@@ -222,14 +204,14 @@ static const struct
{ "wr", 7 },
};
-static const char *const arm_register_names[] =
-{"r0", "r1", "r2", "r3", /* 0 1 2 3 */
- "r4", "r5", "r6", "r7", /* 4 5 6 7 */
- "r8", "r9", "r10", "r11", /* 8 9 10 11 */
- "r12", "sp", "lr", "pc", /* 12 13 14 15 */
- "f0", "f1", "f2", "f3", /* 16 17 18 19 */
- "f4", "f5", "f6", "f7", /* 20 21 22 23 */
- "fps", "cpsr" }; /* 24 25 */
+static const char *const arm_register_names[]
+ = { "r0", "r1", "r2", "r3", /* 0 1 2 3 */
+ "r4", "r5", "r6", "r7", /* 4 5 6 7 */
+ "r8", "r9", "r10", "r11", /* 8 9 10 11 */
+ "r12", "sp", "lr", "pc", /* 12 13 14 15 */
+ "f0", "f1", "f2", "f3", /* 16 17 18 19 */
+ "f4", "f5", "f6", "f7", /* 20 21 22 23 */
+ "fps", "cpsr" }; /* 24 25 */
/* Holds the current set of options to be passed to the disassembler. */
static char *arm_disassembler_options;
@@ -256,12 +238,11 @@ static enum register_status arm_neon_quad_read (struct gdbarch *gdbarch,
readable_regcache *regcache,
int regnum, gdb_byte *buf);
static void arm_neon_quad_write (struct gdbarch *gdbarch,
- struct regcache *regcache,
- int regnum, const gdb_byte *buf);
+ struct regcache *regcache, int regnum,
+ const gdb_byte *buf);
static CORE_ADDR
- arm_get_next_pcs_syscall_next_pc (struct arm_get_next_pcs *self);
-
+arm_get_next_pcs_syscall_next_pc (struct arm_get_next_pcs *self);
/* get_next_pcs operations. */
static struct arm_get_next_pcs_ops arm_get_next_pcs_ops = {
@@ -307,14 +288,13 @@ struct arm_prologue_cache
/* Saved register offsets. */
trad_frame_saved_reg *saved_regs;
- arm_prologue_cache() = default;
+ arm_prologue_cache () = default;
};
-
/* Reconstruct T bit in program status register from LR value. */
static inline ULONGEST
-reconstruct_t_bit(struct gdbarch *gdbarch, CORE_ADDR lr, ULONGEST psr)
+reconstruct_t_bit (struct gdbarch *gdbarch, CORE_ADDR lr, ULONGEST psr)
{
ULONGEST t_bit = arm_psr_thumb_bit (gdbarch);
if (IS_THUMB_ADDR (lr))
@@ -370,8 +350,8 @@ arm_cache_init (struct arm_prologue_cache *cache, frame_info_ptr frame)
cache->active_msp_regnum = tdep->m_profile_msp_ns_regnum;
else
{
- warning (_("Invalid state, unable to determine msp alias, assuming "
- "msp_s."));
+ warning (_ ("Invalid state, unable to determine msp alias, assuming "
+ "msp_s."));
cache->active_msp_regnum = tdep->m_profile_msp_s_regnum;
}
@@ -382,8 +362,8 @@ arm_cache_init (struct arm_prologue_cache *cache, frame_info_ptr frame)
cache->active_psp_regnum = tdep->m_profile_psp_ns_regnum;
else
{
- warning (_("Invalid state, unable to determine psp alias, assuming "
- "psp_s."));
+ warning (_ ("Invalid state, unable to determine psp alias, assuming "
+ "psp_s."));
cache->active_psp_regnum = tdep->m_profile_psp_s_regnum;
}
@@ -394,8 +374,8 @@ arm_cache_init (struct arm_prologue_cache *cache, frame_info_ptr frame)
cache->active_sp_regnum = cache->active_psp_regnum;
else
{
- warning (_("Invalid state, unable to determine sp alias, assuming "
- "msp."));
+ warning (_ ("Invalid state, unable to determine sp alias, assuming "
+ "msp."));
cache->active_sp_regnum = cache->active_msp_regnum;
}
}
@@ -413,15 +393,14 @@ arm_cache_init (struct arm_prologue_cache *cache, frame_info_ptr frame)
cache->active_sp_regnum = tdep->m_profile_psp_regnum;
else
{
- warning (_("Invalid state, unable to determine sp alias, assuming "
- "msp."));
+ warning (_ ("Invalid state, unable to determine sp alias, assuming "
+ "msp."));
cache->active_sp_regnum = tdep->m_profile_msp_regnum;
}
}
else
{
- cache->msp_s
- = get_frame_register_unsigned (frame, ARM_SP_REGNUM);
+ cache->msp_s = get_frame_register_unsigned (frame, ARM_SP_REGNUM);
cache->active_sp_regnum = ARM_SP_REGNUM;
}
@@ -446,11 +425,14 @@ arm_cache_get_sp_register (struct arm_prologue_cache *cache,
if (regnum == tdep->m_profile_psp_ns_regnum)
return cache->psp_ns;
if (regnum == tdep->m_profile_msp_regnum)
- return arm_cache_get_sp_register (cache, tdep, cache->active_msp_regnum);
+ return arm_cache_get_sp_register (cache, tdep,
+ cache->active_msp_regnum);
if (regnum == tdep->m_profile_psp_regnum)
- return arm_cache_get_sp_register (cache, tdep, cache->active_psp_regnum);
+ return arm_cache_get_sp_register (cache, tdep,
+ cache->active_psp_regnum);
if (regnum == ARM_SP_REGNUM)
- return arm_cache_get_sp_register (cache, tdep, cache->active_sp_regnum);
+ return arm_cache_get_sp_register (cache, tdep,
+ cache->active_sp_regnum);
}
else if (tdep->is_m)
{
@@ -459,7 +441,8 @@ arm_cache_get_sp_register (struct arm_prologue_cache *cache,
if (regnum == tdep->m_profile_psp_regnum)
return cache->psp_s;
if (regnum == ARM_SP_REGNUM)
- return arm_cache_get_sp_register (cache, tdep, cache->active_sp_regnum);
+ return arm_cache_get_sp_register (cache, tdep,
+ cache->active_sp_regnum);
}
else if (regnum == ARM_SP_REGNUM)
return cache->sp;
@@ -471,9 +454,11 @@ arm_cache_get_sp_register (struct arm_prologue_cache *cache,
is active. */
static CORE_ADDR
-arm_cache_get_prev_sp_value (struct arm_prologue_cache *cache, arm_gdbarch_tdep *tdep)
+arm_cache_get_prev_sp_value (struct arm_prologue_cache *cache,
+ arm_gdbarch_tdep *tdep)
{
- CORE_ADDR val = arm_cache_get_sp_register (cache, tdep, cache->active_sp_regnum);
+ CORE_ADDR val
+ = arm_cache_get_sp_register (cache, tdep, cache->active_sp_regnum);
return val;
}
@@ -560,13 +545,15 @@ arm_cache_switch_prev_sp (struct arm_prologue_cache *cache,
cache->active_sp_regnum = sp_regnum;
}
-namespace {
+namespace
+{
/* Abstract class to read ARM instructions from memory. */
class arm_instruction_reader
{
public:
+
/* Read a 4 bytes instruction from memory using the BYTE_ORDER endianness. */
virtual uint32_t read (CORE_ADDR memaddr, bfd_endian byte_order) const = 0;
};
@@ -576,6 +563,7 @@ public:
class target_arm_instruction_reader : public arm_instruction_reader
{
public:
+
uint32_t read (CORE_ADDR memaddr, bfd_endian byte_order) const override
{
return read_code_unsigned_integer (memaddr, 4, byte_order);
@@ -584,14 +572,15 @@ public:
} /* namespace */
-static CORE_ADDR arm_analyze_prologue
- (struct gdbarch *gdbarch, CORE_ADDR prologue_start, CORE_ADDR prologue_end,
- struct arm_prologue_cache *cache, const arm_instruction_reader &insn_reader);
+static CORE_ADDR
+arm_analyze_prologue (struct gdbarch *gdbarch, CORE_ADDR prologue_start,
+ CORE_ADDR prologue_end, struct arm_prologue_cache *cache,
+ const arm_instruction_reader &insn_reader);
/* Architecture version for displaced stepping. This effects the behaviour of
certain instructions, and really should not be hard-wired. */
-#define DISPLACED_STEPPING_ARCH_VERSION 5
+#define DISPLACED_STEPPING_ARCH_VERSION 5
/* See arm-tdep.h. */
@@ -662,8 +651,7 @@ arm_find_mapping_symbol (CORE_ADDR memaddr, CORE_ADDR *start)
if (data != NULL)
{
unsigned int section_idx = sec->the_bfd_section->index;
- arm_mapping_symbol_vec &map
- = data->section_maps[section_idx];
+ arm_mapping_symbol_vec &map = data->section_maps[section_idx];
/* Sort the vector on first use. */
if (!data->section_maps_sorted[section_idx])
@@ -692,8 +680,7 @@ arm_find_mapping_symbol (CORE_ADDR memaddr, CORE_ADDR *start)
if (it > map.begin ())
{
- arm_mapping_symbol_vec::const_iterator prev_it
- = it - 1;
+ arm_mapping_symbol_vec::const_iterator prev_it = it - 1;
if (start)
*start = prev_it->value + sec->addr ();
@@ -718,9 +705,9 @@ arm_pc_is_thumb (struct gdbarch *gdbarch, CORE_ADDR memaddr)
arm_gdbarch_tdep *tdep = gdbarch_tdep<arm_gdbarch_tdep> (gdbarch);
if (gdbarch_displaced_step_copy_insn_closure_by_addr_p (gdbarch))
- dsc = ((arm_displaced_step_copy_insn_closure * )
- gdbarch_displaced_step_copy_insn_closure_by_addr
- (gdbarch, current_inferior (), memaddr));
+ dsc = ((arm_displaced_step_copy_insn_closure *)
+ gdbarch_displaced_step_copy_insn_closure_by_addr (
+ gdbarch, current_inferior (), memaddr));
/* If checking the mode of displaced instruction in copy area, the mode
should be determined by instruction on the original address. */
@@ -779,18 +766,18 @@ arm_m_addr_is_lockup (CORE_ADDR addr)
{
switch (addr)
{
- /* Values for lockup state.
+ /* Values for lockup state.
For more details see "B1.5.15 Unrecoverable exception cases" in
both ARMv6-M and ARMv7-M Architecture Reference Manuals, or
see "B4.32 Lockup" in ARMv8-M Architecture Reference Manual. */
- case 0xeffffffe:
- case 0xfffffffe:
- case 0xffffffff:
- return true;
+ case 0xeffffffe:
+ case 0xfffffffe:
+ case 0xffffffff:
+ return true;
- default:
- /* Address is not lockup. */
- return false;
+ default:
+ /* Address is not lockup. */
+ return false;
}
}
@@ -916,8 +903,7 @@ skip_prologue_function (struct gdbarch *gdbarch, CORE_ADDR pc, int is_thumb)
struct bound_minimal_symbol msym;
msym = lookup_minimal_symbol_by_pc (pc);
- if (msym.minsym != NULL
- && msym.value_address () == pc
+ if (msym.minsym != NULL && msym.value_address () == pc
&& msym.minsym->linkage_name () != NULL)
{
const char *name = msym.minsym->linkage_name ();
@@ -950,9 +936,9 @@ skip_prologue_function (struct gdbarch *gdbarch, CORE_ADDR pc, int is_thumb)
if (!is_thumb
&& read_code_unsigned_integer (pc, 4, byte_order_for_code)
- == 0xe3e00a0f /* mov r0, #0xffff0fff */
+ == 0xe3e00a0f /* mov r0, #0xffff0fff */
&& read_code_unsigned_integer (pc + 4, 4, byte_order_for_code)
- == 0xe240f01f) /* sub pc, r0, #31 */
+ == 0xe240f01f) /* sub pc, r0, #31 */
return 1;
}
@@ -962,17 +948,14 @@ skip_prologue_function (struct gdbarch *gdbarch, CORE_ADDR pc, int is_thumb)
/* Extract the immediate from instruction movw/movt of encoding T. INSN1 is
the first 16-bit of instruction, and INSN2 is the second 16-bit of
instruction. */
-#define EXTRACT_MOVW_MOVT_IMM_T(insn1, insn2) \
- ((bits ((insn1), 0, 3) << 12) \
- | (bits ((insn1), 10, 10) << 11) \
- | (bits ((insn2), 12, 14) << 8) \
- | bits ((insn2), 0, 7))
+#define EXTRACT_MOVW_MOVT_IMM_T(insn1, insn2) \
+ ((bits ((insn1), 0, 3) << 12) | (bits ((insn1), 10, 10) << 11) \
+ | (bits ((insn2), 12, 14) << 8) | bits ((insn2), 0, 7))
/* Extract the immediate from instruction movw/movt of encoding A. INSN is
the 32-bit instruction. */
#define EXTRACT_MOVW_MOVT_IMM_A(insn) \
- ((bits ((insn), 16, 19) << 12) \
- | bits ((insn), 0, 11))
+ ((bits ((insn), 16, 19) << 12) | bits ((insn), 0, 11))
/* Decode immediate value; implements ThumbExpandImmediate pseudo-op. */
@@ -991,8 +974,8 @@ thumb_expand_immediate (unsigned int imm)
case 2:
return ((imm & 0xff) << 8) | ((imm & 0xff) << 24);
case 3:
- return (imm & 0xff) | ((imm & 0xff) << 8)
- | ((imm & 0xff) << 16) | ((imm & 0xff) << 24);
+ return (imm & 0xff) | ((imm & 0xff) << 8) | ((imm & 0xff) << 16)
+ | ((imm & 0xff) << 24);
}
return (0x80 | (imm & 0x7f)) << (32 - count);
@@ -1004,9 +987,9 @@ thumb_expand_immediate (unsigned int imm)
static int
thumb_instruction_restores_sp (unsigned short insn)
{
- return (insn == 0x46bd /* mov sp, r7 */
- || (insn & 0xff80) == 0xb000 /* add sp, imm */
- || (insn & 0xfe00) == 0xbc00); /* pop <registers> */
+ return (insn == 0x46bd /* mov sp, r7 */
+ || (insn & 0xff80) == 0xb000 /* add sp, imm */
+ || (insn & 0xfe00) == 0xbc00); /* pop <registers> */
}
/* Analyze a Thumb prologue, looking for a recognizable stack frame
@@ -1016,9 +999,8 @@ thumb_instruction_restores_sp (unsigned short insn)
initial breakpoint. */
static CORE_ADDR
-thumb_analyze_prologue (struct gdbarch *gdbarch,
- CORE_ADDR start, CORE_ADDR limit,
- struct arm_prologue_cache *cache)
+thumb_analyze_prologue (struct gdbarch *gdbarch, CORE_ADDR start,
+ CORE_ADDR limit, struct arm_prologue_cache *cache)
{
arm_gdbarch_tdep *tdep = gdbarch_tdep<arm_gdbarch_tdep> (gdbarch);
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
@@ -1039,7 +1021,7 @@ thumb_analyze_prologue (struct gdbarch *gdbarch,
insn = read_code_unsigned_integer (start, 2, byte_order_for_code);
- if ((insn & 0xfe00) == 0xb400) /* push { rlist } */
+ if ((insn & 0xfe00) == 0xb400) /* push { rlist } */
{
int regno;
int mask;
@@ -1055,52 +1037,51 @@ thumb_analyze_prologue (struct gdbarch *gdbarch,
for (regno = ARM_LR_REGNUM; regno >= 0; regno--)
if (mask & (1 << regno))
{
- regs[ARM_SP_REGNUM] = pv_add_constant (regs[ARM_SP_REGNUM],
- -4);
+ regs[ARM_SP_REGNUM]
+ = pv_add_constant (regs[ARM_SP_REGNUM], -4);
stack.store (regs[ARM_SP_REGNUM], 4, regs[regno]);
}
}
- else if ((insn & 0xff80) == 0xb080) /* sub sp, #imm */
+ else if ((insn & 0xff80) == 0xb080) /* sub sp, #imm */
{
- offset = (insn & 0x7f) << 2; /* get scaled offset */
- regs[ARM_SP_REGNUM] = pv_add_constant (regs[ARM_SP_REGNUM],
- -offset);
+ offset = (insn & 0x7f) << 2; /* get scaled offset */
+ regs[ARM_SP_REGNUM] = pv_add_constant (regs[ARM_SP_REGNUM], -offset);
}
else if (thumb_instruction_restores_sp (insn))
{
/* Don't scan past the epilogue. */
break;
}
- else if ((insn & 0xf800) == 0xa800) /* add Rd, sp, #imm */
- regs[bits (insn, 8, 10)] = pv_add_constant (regs[ARM_SP_REGNUM],
- (insn & 0xff) << 2);
- else if ((insn & 0xfe00) == 0x1c00 /* add Rd, Rn, #imm */
+ else if ((insn & 0xf800) == 0xa800) /* add Rd, sp, #imm */
+ regs[bits (insn, 8, 10)]
+ = pv_add_constant (regs[ARM_SP_REGNUM], (insn & 0xff) << 2);
+ else if ((insn & 0xfe00) == 0x1c00 /* add Rd, Rn, #imm */
&& pv_is_register (regs[bits (insn, 3, 5)], ARM_SP_REGNUM))
- regs[bits (insn, 0, 2)] = pv_add_constant (regs[bits (insn, 3, 5)],
- bits (insn, 6, 8));
- else if ((insn & 0xf800) == 0x3000 /* add Rd, #imm */
+ regs[bits (insn, 0, 2)]
+ = pv_add_constant (regs[bits (insn, 3, 5)], bits (insn, 6, 8));
+ else if ((insn & 0xf800) == 0x3000 /* add Rd, #imm */
&& pv_is_register (regs[bits (insn, 8, 10)], ARM_SP_REGNUM))
- regs[bits (insn, 8, 10)] = pv_add_constant (regs[bits (insn, 8, 10)],
- bits (insn, 0, 7));
- else if ((insn & 0xfe00) == 0x1800 /* add Rd, Rn, Rm */
+ regs[bits (insn, 8, 10)]
+ = pv_add_constant (regs[bits (insn, 8, 10)], bits (insn, 0, 7));
+ else if ((insn & 0xfe00) == 0x1800 /* add Rd, Rn, Rm */
&& pv_is_register (regs[bits (insn, 6, 8)], ARM_SP_REGNUM)
&& pv_is_constant (regs[bits (insn, 3, 5)]))
- regs[bits (insn, 0, 2)] = pv_add (regs[bits (insn, 3, 5)],
- regs[bits (insn, 6, 8)]);
- else if ((insn & 0xff00) == 0x4400 /* add Rd, Rm */
+ regs[bits (insn, 0, 2)]
+ = pv_add (regs[bits (insn, 3, 5)], regs[bits (insn, 6, 8)]);
+ else if ((insn & 0xff00) == 0x4400 /* add Rd, Rm */
&& pv_is_constant (regs[bits (insn, 3, 6)]))
{
int rd = (bit (insn, 7) << 3) + bits (insn, 0, 2);
int rm = bits (insn, 3, 6);
regs[rd] = pv_add (regs[rd], regs[rm]);
}
- else if ((insn & 0xff00) == 0x4600) /* mov hi, lo or mov lo, hi */
+ else if ((insn & 0xff00) == 0x4600) /* mov hi, lo or mov lo, hi */
{
int dst_reg = (insn & 0x7) + ((insn & 0x80) >> 4);
int src_reg = (insn & 0x78) >> 3;
regs[dst_reg] = regs[src_reg];
}
- else if ((insn & 0xf800) == 0x9000) /* str rd, [sp, #off] */
+ else if ((insn & 0xf800) == 0x9000) /* str rd, [sp, #off] */
{
/* Handle stores to the stack. Normally pushes are used,
but with GCC -mtpcs-frame, there may be other stores
@@ -1116,7 +1097,7 @@ thumb_analyze_prologue (struct gdbarch *gdbarch,
stack.store (addr, 4, regs[regno]);
}
- else if ((insn & 0xf800) == 0x6000) /* str rd, [rn, #off] */
+ else if ((insn & 0xf800) == 0x6000) /* str rd, [rn, #off] */
{
int rd = bits (insn, 0, 2);
int rn = bits (insn, 3, 5);
@@ -1130,31 +1111,31 @@ thumb_analyze_prologue (struct gdbarch *gdbarch,
stack.store (addr, 4, regs[rd]);
}
- else if (((insn & 0xf800) == 0x7000 /* strb Rd, [Rn, #off] */
- || (insn & 0xf800) == 0x8000) /* strh Rd, [Rn, #off] */
+ else if (((insn & 0xf800) == 0x7000 /* strb Rd, [Rn, #off] */
+ || (insn & 0xf800) == 0x8000) /* strh Rd, [Rn, #off] */
&& pv_is_register (regs[bits (insn, 3, 5)], ARM_SP_REGNUM))
/* Ignore stores of argument registers to the stack. */
;
- else if ((insn & 0xf800) == 0xc800 /* ldmia Rn!, { registers } */
+ else if ((insn & 0xf800) == 0xc800 /* ldmia Rn!, { registers } */
&& pv_is_register (regs[bits (insn, 8, 10)], ARM_SP_REGNUM))
/* Ignore block loads from the stack, potentially copying
parameters from memory. */
;
- else if ((insn & 0xf800) == 0x9800 /* ldr Rd, [Rn, #immed] */
- || ((insn & 0xf800) == 0x6800 /* ldr Rd, [sp, #immed] */
+ else if ((insn & 0xf800) == 0x9800 /* ldr Rd, [Rn, #immed] */
+ || ((insn & 0xf800) == 0x6800 /* ldr Rd, [sp, #immed] */
&& pv_is_register (regs[bits (insn, 3, 5)], ARM_SP_REGNUM)))
/* Similarly ignore single loads from the stack. */
;
- else if ((insn & 0xffc0) == 0x0000 /* lsls Rd, Rm, #0 */
- || (insn & 0xffc0) == 0x1c00) /* add Rd, Rn, #0 */
+ else if ((insn & 0xffc0) == 0x0000 /* lsls Rd, Rm, #0 */
+ || (insn & 0xffc0) == 0x1c00) /* add Rd, Rn, #0 */
/* Skip register copies, i.e. saves to another register
instead of the stack. */
;
- else if ((insn & 0xf800) == 0x2000) /* movs Rd, #imm */
+ else if ((insn & 0xf800) == 0x2000) /* movs Rd, #imm */
/* Recognize constant loads; even with small stacks these are necessary
on Thumb. */
regs[bits (insn, 8, 10)] = pv_constant (bits (insn, 0, 7));
- else if ((insn & 0xf800) == 0x4800) /* ldr Rd, [pc, #imm] */
+ else if ((insn & 0xf800) == 0x4800) /* ldr Rd, [pc, #imm] */
{
/* Constant pool loads, for the same reason. */
unsigned int constant;
@@ -1168,8 +1149,8 @@ thumb_analyze_prologue (struct gdbarch *gdbarch,
{
unsigned short inst2;
- inst2 = read_code_unsigned_integer (start + 2, 2,
- byte_order_for_code);
+ inst2
+ = read_code_unsigned_integer (start + 2, 2, byte_order_for_code);
uint32_t whole_insn = (insn << 16) | inst2;
if ((insn & 0xf800) == 0xf000 && (inst2 & 0xe800) == 0xe800)
@@ -1198,7 +1179,7 @@ thumb_analyze_prologue (struct gdbarch *gdbarch,
break;
}
- else if ((insn & 0xffd0) == 0xe900 /* stmdb Rn{!},
+ else if ((insn & 0xffd0) == 0xe900 /* stmdb Rn{!},
{ registers } */
&& pv_is_register (regs[bits (insn, 0, 3)], ARM_SP_REGNUM))
{
@@ -1221,8 +1202,7 @@ thumb_analyze_prologue (struct gdbarch *gdbarch,
}
/* vstmdb Rn{!}, { D-registers } (aka vpush). */
- else if ((insn & 0xff20) == 0xed20
- && (inst2 & 0x0f00) == 0x0b00
+ else if ((insn & 0xff20) == 0xed20 && (inst2 & 0x0f00) == 0x0b00
&& pv_is_register (regs[bits (insn, 0, 3)], ARM_SP_REGNUM))
{
/* Address SP points to. */
@@ -1241,15 +1221,15 @@ thumb_analyze_prologue (struct gdbarch *gdbarch,
for (; number > 0; number--)
{
addr = pv_add_constant (addr, -8);
- stack.store (addr, 8, pv_register (ARM_D0_REGNUM
- + vd + number, 0));
+ stack.store (addr, 8,
+ pv_register (ARM_D0_REGNUM + vd + number, 0));
}
/* Writeback SP to account for the saved registers. */
regs[bits (insn, 0, 3)] = addr;
}
- else if ((insn & 0xff50) == 0xe940 /* strd Rt, Rt2,
+ else if ((insn & 0xff50) == 0xe940 /* strd Rt, Rt2,
[Rn, #+/-imm]{!} */
&& pv_is_register (regs[bits (insn, 0, 3)], ARM_SP_REGNUM))
{
@@ -1267,14 +1247,13 @@ thumb_analyze_prologue (struct gdbarch *gdbarch,
break;
stack.store (addr, 4, regs[regno1]);
- stack.store (pv_add_constant (addr, 4),
- 4, regs[regno2]);
+ stack.store (pv_add_constant (addr, 4), 4, regs[regno2]);
if (insn & 0x0020)
regs[bits (insn, 0, 3)] = addr;
}
- else if ((insn & 0xfff0) == 0xf8c0 /* str Rt,[Rn,+/-#imm]{!} */
+ else if ((insn & 0xfff0) == 0xf8c0 /* str Rt,[Rn,+/-#imm]{!} */
&& (inst2 & 0x0c00) == 0x0c00
&& pv_is_register (regs[bits (insn, 0, 3)], ARM_SP_REGNUM))
{
@@ -1296,7 +1275,7 @@ thumb_analyze_prologue (struct gdbarch *gdbarch,
regs[bits (insn, 0, 3)] = addr;
}
- else if ((insn & 0xfff0) == 0xf8c0 /* str.w Rt,[Rn,#imm] */
+ else if ((insn & 0xfff0) == 0xf8c0 /* str.w Rt,[Rn,#imm] */
&& pv_is_register (regs[bits (insn, 0, 3)], ARM_SP_REGNUM))
{
int regno = bits (inst2, 12, 15);
@@ -1311,18 +1290,18 @@ thumb_analyze_prologue (struct gdbarch *gdbarch,
stack.store (addr, 4, regs[regno]);
}
- else if ((insn & 0xffd0) == 0xf880 /* str{bh}.w Rt,[Rn,#imm] */
+ else if ((insn & 0xffd0) == 0xf880 /* str{bh}.w Rt,[Rn,#imm] */
&& pv_is_register (regs[bits (insn, 0, 3)], ARM_SP_REGNUM))
/* Ignore stores of argument registers to the stack. */
;
- else if ((insn & 0xffd0) == 0xf800 /* str{bh} Rt,[Rn,#+/-imm] */
+ else if ((insn & 0xffd0) == 0xf800 /* str{bh} Rt,[Rn,#+/-imm] */
&& (inst2 & 0x0d00) == 0x0c00
&& pv_is_register (regs[bits (insn, 0, 3)], ARM_SP_REGNUM))
/* Ignore stores of argument registers to the stack. */
;
- else if ((insn & 0xffd0) == 0xe890 /* ldmia Rn[!],
+ else if ((insn & 0xffd0) == 0xe890 /* ldmia Rn[!],
{ registers } */
&& (inst2 & 0x8000) == 0x0000
&& pv_is_register (regs[bits (insn, 0, 3)], ARM_SP_REGNUM))
@@ -1330,88 +1309,87 @@ thumb_analyze_prologue (struct gdbarch *gdbarch,
parameters from memory. */
;
- else if ((insn & 0xff70) == 0xe950 /* ldrd Rt, Rt2,
+ else if ((insn & 0xff70) == 0xe950 /* ldrd Rt, Rt2,
[Rn, #+/-imm] */
&& pv_is_register (regs[bits (insn, 0, 3)], ARM_SP_REGNUM))
/* Similarly ignore dual loads from the stack. */
;
- else if ((insn & 0xfff0) == 0xf850 /* ldr Rt,[Rn,#+/-imm] */
+ else if ((insn & 0xfff0) == 0xf850 /* ldr Rt,[Rn,#+/-imm] */
&& (inst2 & 0x0d00) == 0x0c00
&& pv_is_register (regs[bits (insn, 0, 3)], ARM_SP_REGNUM))
/* Similarly ignore single loads from the stack. */
;
- else if ((insn & 0xfff0) == 0xf8d0 /* ldr.w Rt,[Rn,#imm] */
+ else if ((insn & 0xfff0) == 0xf8d0 /* ldr.w Rt,[Rn,#imm] */
&& pv_is_register (regs[bits (insn, 0, 3)], ARM_SP_REGNUM))
/* Similarly ignore single loads from the stack. */
;
- else if ((insn & 0xfbf0) == 0xf100 /* add.w Rd, Rn, #imm */
+ else if ((insn & 0xfbf0) == 0xf100 /* add.w Rd, Rn, #imm */
&& (inst2 & 0x8000) == 0x0000)
{
- unsigned int imm = ((bits (insn, 10, 10) << 11)
- | (bits (inst2, 12, 14) << 8)
- | bits (inst2, 0, 7));
+ unsigned int imm
+ = ((bits (insn, 10, 10) << 11) | (bits (inst2, 12, 14) << 8)
+ | bits (inst2, 0, 7));
regs[bits (inst2, 8, 11)]
= pv_add_constant (regs[bits (insn, 0, 3)],
thumb_expand_immediate (imm));
}
- else if ((insn & 0xfbf0) == 0xf200 /* addw Rd, Rn, #imm */
+ else if ((insn & 0xfbf0) == 0xf200 /* addw Rd, Rn, #imm */
&& (inst2 & 0x8000) == 0x0000)
{
- unsigned int imm = ((bits (insn, 10, 10) << 11)
- | (bits (inst2, 12, 14) << 8)
- | bits (inst2, 0, 7));
+ unsigned int imm
+ = ((bits (insn, 10, 10) << 11) | (bits (inst2, 12, 14) << 8)
+ | bits (inst2, 0, 7));
regs[bits (inst2, 8, 11)]
= pv_add_constant (regs[bits (insn, 0, 3)], imm);
}
- else if ((insn & 0xfbf0) == 0xf1a0 /* sub.w Rd, Rn, #imm */
+ else if ((insn & 0xfbf0) == 0xf1a0 /* sub.w Rd, Rn, #imm */
&& (inst2 & 0x8000) == 0x0000)
{
- unsigned int imm = ((bits (insn, 10, 10) << 11)
- | (bits (inst2, 12, 14) << 8)
- | bits (inst2, 0, 7));
+ unsigned int imm
+ = ((bits (insn, 10, 10) << 11) | (bits (inst2, 12, 14) << 8)
+ | bits (inst2, 0, 7));
regs[bits (inst2, 8, 11)]
= pv_add_constant (regs[bits (insn, 0, 3)],
- - (CORE_ADDR) thumb_expand_immediate (imm));
+ -(CORE_ADDR) thumb_expand_immediate (imm));
}
- else if ((insn & 0xfbf0) == 0xf2a0 /* subw Rd, Rn, #imm */
+ else if ((insn & 0xfbf0) == 0xf2a0 /* subw Rd, Rn, #imm */
&& (inst2 & 0x8000) == 0x0000)
{
- unsigned int imm = ((bits (insn, 10, 10) << 11)
- | (bits (inst2, 12, 14) << 8)
- | bits (inst2, 0, 7));
+ unsigned int imm
+ = ((bits (insn, 10, 10) << 11) | (bits (inst2, 12, 14) << 8)
+ | bits (inst2, 0, 7));
regs[bits (inst2, 8, 11)]
- = pv_add_constant (regs[bits (insn, 0, 3)], - (CORE_ADDR) imm);
+ = pv_add_constant (regs[bits (insn, 0, 3)], -(CORE_ADDR) imm);
}
- else if ((insn & 0xfbff) == 0xf04f) /* mov.w Rd, #const */
+ else if ((insn & 0xfbff) == 0xf04f) /* mov.w Rd, #const */
{
- unsigned int imm = ((bits (insn, 10, 10) << 11)
- | (bits (inst2, 12, 14) << 8)
- | bits (inst2, 0, 7));
+ unsigned int imm
+ = ((bits (insn, 10, 10) << 11) | (bits (inst2, 12, 14) << 8)
+ | bits (inst2, 0, 7));
regs[bits (inst2, 8, 11)]
= pv_constant (thumb_expand_immediate (imm));
}
- else if ((insn & 0xfbf0) == 0xf240) /* movw Rd, #const */
+ else if ((insn & 0xfbf0) == 0xf240) /* movw Rd, #const */
{
- unsigned int imm
- = EXTRACT_MOVW_MOVT_IMM_T (insn, inst2);
+ unsigned int imm = EXTRACT_MOVW_MOVT_IMM_T (insn, inst2);
regs[bits (inst2, 8, 11)] = pv_constant (imm);
}
- else if (insn == 0xea5f /* mov.w Rd,Rm */
+ else if (insn == 0xea5f /* mov.w Rd,Rm */
&& (inst2 & 0xf0f0) == 0)
{
int dst_reg = (inst2 & 0x0f00) >> 8;
@@ -1419,7 +1397,7 @@ thumb_analyze_prologue (struct gdbarch *gdbarch,
regs[dst_reg] = regs[src_reg];
}
- else if ((insn & 0xff7f) == 0xf85f) /* ldr.w Rt,<label> */
+ else if ((insn & 0xff7f) == 0xf85f) /* ldr.w Rt,<label> */
{
/* Constant pool loads. */
unsigned int constant;
@@ -1435,7 +1413,7 @@ thumb_analyze_prologue (struct gdbarch *gdbarch,
regs[bits (inst2, 12, 15)] = pv_constant (constant);
}
- else if ((insn & 0xff7f) == 0xe95f) /* ldrd Rt,Rt2,<label> */
+ else if ((insn & 0xff7f) == 0xe95f) /* ldrd Rt,Rt2,<label> */
{
/* Constant pool loads. */
unsigned int constant;
@@ -1504,7 +1482,7 @@ thumb_analyze_prologue (struct gdbarch *gdbarch,
arm_debug_printf ("Found pacbti instruction at %s",
paddress (gdbarch, start));
arm_debug_printf ("RA is %s",
- *ra_signed_state? "signed" : "not signed");
+ *ra_signed_state ? "signed" : "not signed");
cache->ra_signed_state = ra_signed_state;
}
@@ -1525,8 +1503,7 @@ thumb_analyze_prologue (struct gdbarch *gdbarch,
start += 2;
}
- arm_debug_printf ("Prologue scan stopped at %s",
- paddress (gdbarch, start));
+ arm_debug_printf ("Prologue scan stopped at %s", paddress (gdbarch, start));
if (unrecognized_pc == 0)
unrecognized_pc = start;
@@ -1558,13 +1535,12 @@ thumb_analyze_prologue (struct gdbarch *gdbarch,
{
cache->saved_regs[i].set_addr (offset);
if (i == ARM_SP_REGNUM)
- arm_cache_set_active_sp_value(cache, tdep, offset);
+ arm_cache_set_active_sp_value (cache, tdep, offset);
}
return unrecognized_pc;
}
-
/* Try to analyze the instructions starting from PC, which load symbol
__stack_chk_guard. Return the address of instruction after loading this
symbol, set the dest register number to *BASEREG, and set the size of
@@ -1572,8 +1548,8 @@ thumb_analyze_prologue (struct gdbarch *gdbarch,
not recognized. */
static CORE_ADDR
-arm_analyze_load_stack_chk_guard(CORE_ADDR pc, struct gdbarch *gdbarch,
- unsigned int *destreg, int *offset)
+arm_analyze_load_stack_chk_guard (CORE_ADDR pc, struct gdbarch *gdbarch,
+ unsigned int *destreg, int *offset)
{
enum bfd_endian byte_order_for_code = gdbarch_byte_order_for_code (gdbarch);
int is_thumb = arm_pc_is_thumb (gdbarch, pc);
@@ -1590,8 +1566,8 @@ arm_analyze_load_stack_chk_guard(CORE_ADDR pc, struct gdbarch *gdbarch,
*destreg = bits (insn1, 8, 10);
*offset = 2;
address = (pc & 0xfffffffc) + 4 + (bits (insn1, 0, 7) << 2);
- address = read_memory_unsigned_integer (address, 4,
- byte_order_for_code);
+ address
+ = read_memory_unsigned_integer (address, 4, byte_order_for_code);
}
else if ((insn1 & 0xfbf0) == 0xf240) /* movw Rd, #const */
{
@@ -1600,10 +1576,8 @@ arm_analyze_load_stack_chk_guard(CORE_ADDR pc, struct gdbarch *gdbarch,
low = EXTRACT_MOVW_MOVT_IMM_T (insn1, insn2);
- insn1
- = read_code_unsigned_integer (pc + 4, 2, byte_order_for_code);
- insn2
- = read_code_unsigned_integer (pc + 6, 2, byte_order_for_code);
+ insn1 = read_code_unsigned_integer (pc + 4, 2, byte_order_for_code);
+ insn2 = read_code_unsigned_integer (pc + 6, 2, byte_order_for_code);
/* movt Rd, #const */
if ((insn1 & 0xfbc0) == 0xf2c0)
@@ -1623,8 +1597,8 @@ arm_analyze_load_stack_chk_guard(CORE_ADDR pc, struct gdbarch *gdbarch,
if ((insn & 0x0e5f0000) == 0x041f0000) /* ldr Rd, [PC, #immed] */
{
address = bits (insn, 0, 11) + pc + 8;
- address = read_memory_unsigned_integer (address, 4,
- byte_order_for_code);
+ address
+ = read_memory_unsigned_integer (address, 4, byte_order_for_code);
*destreg = bits (insn, 12, 15);
*offset = 4;
@@ -1633,8 +1607,7 @@ arm_analyze_load_stack_chk_guard(CORE_ADDR pc, struct gdbarch *gdbarch,
{
low = EXTRACT_MOVW_MOVT_IMM_A (insn);
- insn
- = read_code_unsigned_integer (pc + 4, 4, byte_order_for_code);
+ insn = read_code_unsigned_integer (pc + 4, 4, byte_order_for_code);
if ((insn & 0x0ff00000) == 0x03400000) /* movt Rd, #const */
{
@@ -1680,7 +1653,7 @@ arm_analyze_load_stack_chk_guard(CORE_ADDR pc, struct gdbarch *gdbarch,
stripped, as the 'fingerprint' of a stack protector cdoe sequence. */
static CORE_ADDR
-arm_skip_stack_protector(CORE_ADDR pc, struct gdbarch *gdbarch)
+arm_skip_stack_protector (CORE_ADDR pc, struct gdbarch *gdbarch)
{
enum bfd_endian byte_order_for_code = gdbarch_byte_order_for_code (gdbarch);
unsigned int basereg;
@@ -1690,8 +1663,7 @@ arm_skip_stack_protector(CORE_ADDR pc, struct gdbarch *gdbarch)
CORE_ADDR addr;
/* Try to parse the instructions in Step 1. */
- addr = arm_analyze_load_stack_chk_guard (pc, gdbarch,
- &basereg, &offset);
+ addr = arm_analyze_load_stack_chk_guard (pc, gdbarch, &basereg, &offset);
if (!addr)
return pc;
@@ -1699,8 +1671,9 @@ arm_skip_stack_protector(CORE_ADDR pc, struct gdbarch *gdbarch)
/* ADDR must correspond to a symbol whose name is __stack_chk_guard.
Otherwise, this sequence cannot be for stack protector. */
if (stack_chk_guard.minsym == NULL
- || !startswith (stack_chk_guard.minsym->linkage_name (), "__stack_chk_guard"))
- return pc;
+ || !startswith (stack_chk_guard.minsym->linkage_name (),
+ "__stack_chk_guard"))
+ return pc;
if (is_thumb)
{
@@ -1715,8 +1688,8 @@ arm_skip_stack_protector(CORE_ADDR pc, struct gdbarch *gdbarch)
return pc;
destreg = bits (insn, 0, 2);
- insn = read_code_unsigned_integer (pc + offset + 2, 2,
- byte_order_for_code);
+ insn
+ = read_code_unsigned_integer (pc + offset + 2, 2, byte_order_for_code);
/* Step 3: str Rd, [Rn, #immed], encoding T1. */
if ((insn & 0xf800) != 0x6000)
return pc;
@@ -1736,8 +1709,8 @@ arm_skip_stack_protector(CORE_ADDR pc, struct gdbarch *gdbarch)
return pc;
destreg = bits (insn, 12, 15);
/* Step 3: str Rd, [Rn, #immed], encoding A1. */
- insn = read_code_unsigned_integer (pc + offset + 4,
- 4, byte_order_for_code);
+ insn
+ = read_code_unsigned_integer (pc + offset + 4, 4, byte_order_for_code);
if ((insn & 0x0e500000) != 0x04000000)
return pc;
if (bits (insn, 12, 15) != destreg)
@@ -1784,7 +1757,6 @@ arm_skip_prologue (struct gdbarch *gdbarch, CORE_ADDR pc)
post_prologue_pc
= arm_skip_stack_protector (post_prologue_pc, gdbarch);
-
/* GCC always emits a line note before the prologue and another
one after, even if the two are at the same address or on the
same line. Take advantage of this so that we do not need to
@@ -1792,8 +1764,7 @@ arm_skip_prologue (struct gdbarch *gdbarch, CORE_ADDR pc)
will have producer information for most binaries; if it is
missing (e.g. for -gstabs), assuming the GNU tools. */
if (post_prologue_pc
- && (cust == NULL
- || cust->producer () == NULL
+ && (cust == NULL || cust->producer () == NULL
|| startswith (cust->producer (), "GNU ")
|| producer_is_llvm (cust->producer ())))
return post_prologue_pc;
@@ -1835,8 +1806,7 @@ arm_skip_prologue (struct gdbarch *gdbarch, CORE_ADDR pc)
/* Like arm_scan_prologue, stop no later than pc + 64. */
limit_pc = skip_prologue_using_sal (gdbarch, pc);
if (limit_pc == 0)
- limit_pc = pc + 64; /* Magic. */
-
+ limit_pc = pc + 64; /* Magic. */
/* Check if this is Thumb code. */
if (arm_pc_is_thumb (gdbarch, pc))
@@ -1912,7 +1882,7 @@ arm_instruction_restores_sp (unsigned int insn)
|| (insn & 0x0fff0000) == 0x08bd0000
/* POP (LDMIA). */
|| (insn & 0x0fff0000) == 0x049d0000)
- /* POP of a single register. */
+ /* POP of a single register. */
return 1;
}
@@ -1950,9 +1920,8 @@ arm_expand_immediate (uint32_t imm)
the end of the prologue). */
static CORE_ADDR
-arm_analyze_prologue (struct gdbarch *gdbarch,
- CORE_ADDR prologue_start, CORE_ADDR prologue_end,
- struct arm_prologue_cache *cache,
+arm_analyze_prologue (struct gdbarch *gdbarch, CORE_ADDR prologue_start,
+ CORE_ADDR prologue_end, struct arm_prologue_cache *cache,
const arm_instruction_reader &insn_reader)
{
enum bfd_endian byte_order_for_code = gdbarch_byte_order_for_code (gdbarch);
@@ -1976,18 +1945,16 @@ arm_analyze_prologue (struct gdbarch *gdbarch,
regs[regno] = pv_register (regno, 0);
pv_area stack (ARM_SP_REGNUM, gdbarch_addr_bit (gdbarch));
- for (current_pc = prologue_start;
- current_pc < prologue_end;
- current_pc += 4)
+ for (current_pc = prologue_start; current_pc < prologue_end; current_pc += 4)
{
uint32_t insn = insn_reader.read (current_pc, byte_order_for_code);
- if (insn == 0xe1a0c00d) /* mov ip, sp */
+ if (insn == 0xe1a0c00d) /* mov ip, sp */
{
regs[ARM_IP_REGNUM] = regs[ARM_SP_REGNUM];
continue;
}
- else if ((insn & 0xfff00000) == 0xe2800000 /* add Rd, Rn, #n */
+ else if ((insn & 0xfff00000) == 0xe2800000 /* add Rd, Rn, #n */
&& pv_is_register (regs[bits (insn, 16, 19)], ARM_SP_REGNUM))
{
uint32_t imm = arm_expand_immediate (insn & 0xfff);
@@ -1995,7 +1962,7 @@ arm_analyze_prologue (struct gdbarch *gdbarch,
regs[rd] = pv_add_constant (regs[bits (insn, 16, 19)], imm);
continue;
}
- else if ((insn & 0xfff00000) == 0xe2400000 /* sub Rd, Rn, #n */
+ else if ((insn & 0xfff00000) == 0xe2400000 /* sub Rd, Rn, #n */
&& pv_is_register (regs[bits (insn, 16, 19)], ARM_SP_REGNUM))
{
uint32_t imm = arm_expand_immediate (insn & 0xfff);
@@ -2003,14 +1970,13 @@ arm_analyze_prologue (struct gdbarch *gdbarch,
regs[rd] = pv_add_constant (regs[bits (insn, 16, 19)], -imm);
continue;
}
- else if ((insn & 0xffff0fff) == 0xe52d0004) /* str Rd,
+ else if ((insn & 0xffff0fff) == 0xe52d0004) /* str Rd,
[sp, #-4]! */
{
if (stack.store_would_trash (regs[ARM_SP_REGNUM]))
break;
regs[ARM_SP_REGNUM] = pv_add_constant (regs[ARM_SP_REGNUM], -4);
- stack.store (regs[ARM_SP_REGNUM], 4,
- regs[bits (insn, 12, 15)]);
+ stack.store (regs[ARM_SP_REGNUM], 4, regs[bits (insn, 12, 15)]);
continue;
}
else if ((insn & 0xffff0000) == 0xe92d0000)
@@ -2032,38 +1998,38 @@ arm_analyze_prologue (struct gdbarch *gdbarch,
stack.store (regs[ARM_SP_REGNUM], 4, regs[regno]);
}
}
- else if ((insn & 0xffff0000) == 0xe54b0000 /* strb rx,[r11,#-n] */
- || (insn & 0xffff00f0) == 0xe14b00b0 /* strh rx,[r11,#-n] */
- || (insn & 0xffffc000) == 0xe50b0000) /* str rx,[r11,#-n] */
+ else if ((insn & 0xffff0000) == 0xe54b0000 /* strb rx,[r11,#-n] */
+ || (insn & 0xffff00f0) == 0xe14b00b0 /* strh rx,[r11,#-n] */
+ || (insn & 0xffffc000) == 0xe50b0000) /* str rx,[r11,#-n] */
{
/* No need to add this to saved_regs -- it's just an arg reg. */
continue;
}
- else if ((insn & 0xffff0000) == 0xe5cd0000 /* strb rx,[sp,#n] */
- || (insn & 0xffff00f0) == 0xe1cd00b0 /* strh rx,[sp,#n] */
- || (insn & 0xffffc000) == 0xe58d0000) /* str rx,[sp,#n] */
+ else if ((insn & 0xffff0000) == 0xe5cd0000 /* strb rx,[sp,#n] */
+ || (insn & 0xffff00f0) == 0xe1cd00b0 /* strh rx,[sp,#n] */
+ || (insn & 0xffffc000) == 0xe58d0000) /* str rx,[sp,#n] */
{
/* No need to add this to saved_regs -- it's just an arg reg. */
continue;
}
- else if ((insn & 0xfff00000) == 0xe8800000 /* stm Rn,
+ else if ((insn & 0xfff00000) == 0xe8800000 /* stm Rn,
{ registers } */
&& pv_is_register (regs[bits (insn, 16, 19)], ARM_SP_REGNUM))
{
/* No need to add this to saved_regs -- it's just arg regs. */
continue;
}
- else if ((insn & 0xfffff000) == 0xe24cb000) /* sub fp, ip #n */
+ else if ((insn & 0xfffff000) == 0xe24cb000) /* sub fp, ip #n */
{
uint32_t imm = arm_expand_immediate (insn & 0xfff);
regs[ARM_FP_REGNUM] = pv_add_constant (regs[ARM_IP_REGNUM], -imm);
}
- else if ((insn & 0xfffff000) == 0xe24dd000) /* sub sp, sp #n */
+ else if ((insn & 0xfffff000) == 0xe24dd000) /* sub sp, sp #n */
{
- uint32_t imm = arm_expand_immediate(insn & 0xfff);
+ uint32_t imm = arm_expand_immediate (insn & 0xfff);
regs[ARM_SP_REGNUM] = pv_add_constant (regs[ARM_SP_REGNUM], -imm);
}
- else if ((insn & 0xffff7fff) == 0xed6d0103 /* stfe f?,
+ else if ((insn & 0xffff7fff) == 0xed6d0103 /* stfe f?,
[sp, -#c]! */
&& tdep->have_fpa_registers)
{
@@ -2074,7 +2040,7 @@ arm_analyze_prologue (struct gdbarch *gdbarch,
regno = ARM_F0_REGNUM + ((insn >> 12) & 0x07);
stack.store (regs[ARM_SP_REGNUM], 12, regs[regno]);
}
- else if ((insn & 0xffbf0fff) == 0xec2d0200 /* sfmfd f0, 4,
+ else if ((insn & 0xffbf0fff) == 0xec2d0200 /* sfmfd f0, 4,
[sp!] */
&& tdep->have_fpa_registers)
{
@@ -2084,16 +2050,16 @@ arm_analyze_prologue (struct gdbarch *gdbarch,
if (stack.store_would_trash (regs[ARM_SP_REGNUM]))
break;
- if ((insn & 0x800) == 0x800) /* N0 is set */
+ if ((insn & 0x800) == 0x800) /* N0 is set */
{
- if ((insn & 0x40000) == 0x40000) /* N1 is set */
+ if ((insn & 0x40000) == 0x40000) /* N1 is set */
n_saved_fp_regs = 3;
else
n_saved_fp_regs = 1;
}
else
{
- if ((insn & 0x40000) == 0x40000) /* N1 is set */
+ if ((insn & 0x40000) == 0x40000) /* N1 is set */
n_saved_fp_regs = 2;
else
n_saved_fp_regs = 4;
@@ -2104,8 +2070,7 @@ arm_analyze_prologue (struct gdbarch *gdbarch,
for (; fp_start_reg < fp_bound_reg; fp_start_reg++)
{
regs[ARM_SP_REGNUM] = pv_add_constant (regs[ARM_SP_REGNUM], -12);
- stack.store (regs[ARM_SP_REGNUM], 12,
- regs[fp_start_reg++]);
+ stack.store (regs[ARM_SP_REGNUM], 12, regs[fp_start_reg++]);
}
}
else if ((insn & 0xff000000) == 0xeb000000 && cache == NULL) /* bl */
@@ -2121,7 +2086,7 @@ arm_analyze_prologue (struct gdbarch *gdbarch,
break;
}
else if ((insn & 0xf0000000) != 0xe0000000)
- break; /* Condition not true, exit early. */
+ break; /* Condition not true, exit early. */
else if (arm_instruction_changes_pc (insn))
/* Don't scan past anything that might change control flow. */
break;
@@ -2130,7 +2095,7 @@ arm_analyze_prologue (struct gdbarch *gdbarch,
/* Don't scan past the epilogue. */
break;
}
- else if ((insn & 0xfe500000) == 0xe8100000 /* ldm */
+ else if ((insn & 0xfe500000) == 0xe8100000 /* ldm */
&& pv_is_register (regs[bits (insn, 16, 19)], ARM_SP_REGNUM))
/* Ignore block loads from the stack, potentially copying
parameters from memory. */
@@ -2189,7 +2154,7 @@ arm_analyze_prologue (struct gdbarch *gdbarch,
{
cache->saved_regs[regno].set_addr (offset);
if (regno == ARM_SP_REGNUM)
- arm_cache_set_active_sp_value(cache, tdep, offset);
+ arm_cache_set_active_sp_value (cache, tdep, offset);
}
}
@@ -2200,8 +2165,7 @@ arm_analyze_prologue (struct gdbarch *gdbarch,
}
static void
-arm_scan_prologue (frame_info_ptr this_frame,
- struct arm_prologue_cache *cache)
+arm_scan_prologue (frame_info_ptr this_frame, struct arm_prologue_cache *cache)
{
struct gdbarch *gdbarch = get_frame_arch (this_frame);
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
@@ -2260,7 +2224,7 @@ arm_scan_prologue (frame_info_ptr this_frame,
if (prologue_end > prologue_start + 64)
{
- prologue_end = prologue_start + 64; /* See above. */
+ prologue_end = prologue_start + 64; /* See above. */
}
}
else
@@ -2283,9 +2247,9 @@ arm_scan_prologue (frame_info_ptr this_frame,
return;
else
{
- prologue_start = gdbarch_addr_bits_remove
- (gdbarch, return_value) - 8;
- prologue_end = prologue_start + 64; /* See above. */
+ prologue_start
+ = gdbarch_addr_bits_remove (gdbarch, return_value) - 8;
+ prologue_end = prologue_start + 64; /* See above. */
}
}
@@ -2312,8 +2276,8 @@ arm_make_prologue_cache (frame_info_ptr this_frame)
if (unwound_fp == 0)
return cache;
- arm_gdbarch_tdep *tdep =
- gdbarch_tdep<arm_gdbarch_tdep> (get_frame_arch (this_frame));
+ arm_gdbarch_tdep *tdep
+ = gdbarch_tdep<arm_gdbarch_tdep> (get_frame_arch (this_frame));
prev_sp = unwound_fp + cache->framesize;
arm_cache_set_active_sp_value (cache, tdep, prev_sp);
@@ -2322,8 +2286,8 @@ arm_make_prologue_cache (frame_info_ptr this_frame)
determined by arm_scan_prologue. */
for (reg = 0; reg < gdbarch_num_regs (get_frame_arch (this_frame)); reg++)
if (cache->saved_regs[reg].is_addr ())
- cache->saved_regs[reg].set_addr (cache->saved_regs[reg].addr () +
- prev_sp);
+ cache->saved_regs[reg].set_addr (cache->saved_regs[reg].addr ()
+ + prev_sp);
return cache;
}
@@ -2331,8 +2295,7 @@ arm_make_prologue_cache (frame_info_ptr this_frame)
/* Implementation of the stop_reason hook for arm_prologue frames. */
static enum unwind_stop_reason
-arm_prologue_unwind_stop_reason (frame_info_ptr this_frame,
- void **this_cache)
+arm_prologue_unwind_stop_reason (frame_info_ptr this_frame, void **this_cache)
{
struct arm_prologue_cache *cache;
CORE_ADDR pc;
@@ -2359,8 +2322,7 @@ arm_prologue_unwind_stop_reason (frame_info_ptr this_frame,
and the caller's SP when we were called. */
static void
-arm_prologue_this_id (frame_info_ptr this_frame,
- void **this_cache,
+arm_prologue_this_id (frame_info_ptr this_frame, void **this_cache,
struct frame_id *this_id)
{
struct arm_prologue_cache *cache;
@@ -2387,8 +2349,7 @@ arm_prologue_this_id (frame_info_ptr this_frame,
}
static struct value *
-arm_prologue_prev_register (frame_info_ptr this_frame,
- void **this_cache,
+arm_prologue_prev_register (frame_info_ptr this_frame, void **this_cache,
int prev_regnum)
{
struct gdbarch *gdbarch = get_frame_arch (this_frame);
@@ -2425,7 +2386,8 @@ arm_prologue_prev_register (frame_info_ptr this_frame,
The value was already reconstructed into PREV_SP. */
if (prev_regnum == ARM_SP_REGNUM)
return frame_unwind_got_constant (this_frame, prev_regnum,
- arm_cache_get_prev_sp_value (cache, tdep));
+ arm_cache_get_prev_sp_value (cache,
+ tdep));
/* The value might be one of the alternative SP, if so, use the
value already constructed. */
@@ -2446,7 +2408,8 @@ arm_prologue_prev_register (frame_info_ptr this_frame,
if (prev_regnum == ARM_PS_REGNUM)
{
ULONGEST cpsr = get_frame_register_unsigned (this_frame, prev_regnum);
- CORE_ADDR lr = frame_unwind_register_unsigned (this_frame, ARM_LR_REGNUM);
+ CORE_ADDR lr
+ = frame_unwind_register_unsigned (this_frame, ARM_LR_REGNUM);
cpsr = reconstruct_t_bit (gdbarch, lr, cpsr);
return frame_unwind_got_constant (this_frame, prev_regnum, cpsr);
@@ -2456,15 +2419,13 @@ arm_prologue_prev_register (frame_info_ptr this_frame,
prev_regnum);
}
-static frame_unwind arm_prologue_unwind = {
- "arm prologue",
- NORMAL_FRAME,
- arm_prologue_unwind_stop_reason,
- arm_prologue_this_id,
- arm_prologue_prev_register,
- NULL,
- default_frame_sniffer
-};
+static frame_unwind arm_prologue_unwind = { "arm prologue",
+ NORMAL_FRAME,
+ arm_prologue_unwind_stop_reason,
+ arm_prologue_this_id,
+ arm_prologue_prev_register,
+ NULL,
+ default_frame_sniffer };
/* Maintain a list of ARM exception table entries per objfile, similar to the
list of mapping symbols. We only cache entries for standard ARM-defined
@@ -2476,7 +2437,7 @@ struct arm_exidx_entry
CORE_ADDR addr;
gdb_byte *entry;
- bool operator< (const arm_exidx_entry &other) const
+ bool operator<(const arm_exidx_entry &other) const
{
return addr < other.addr;
}
@@ -2522,7 +2483,7 @@ arm_obj_section_from_vma (struct objfile *objfile, bfd_vma vma)
The extracted and normalized instructions are stored for later
retrieval by the arm_find_exidx_entry routine. */
-
+
static void
arm_exidx_new_objfile (struct objfile *objfile)
{
@@ -2536,8 +2497,8 @@ arm_exidx_new_objfile (struct objfile *objfile)
return;
/* Read contents of exception table and index. */
- exidx = bfd_get_section_by_name (objfile->obfd.get (),
- ELF_STRING_ARM_unwind);
+ exidx
+ = bfd_get_section_by_name (objfile->obfd.get (), ELF_STRING_ARM_unwind);
gdb::byte_vector exidx_data;
if (exidx)
{
@@ -2572,8 +2533,8 @@ arm_exidx_new_objfile (struct objfile *objfile)
{
struct arm_exidx_entry new_exidx_entry;
bfd_vma idx = bfd_h_get_32 (objfile->obfd, exidx_data.data () + i * 8);
- bfd_vma val = bfd_h_get_32 (objfile->obfd,
- exidx_data.data () + i * 8 + 4);
+ bfd_vma val
+ = bfd_h_get_32 (objfile->obfd, exidx_data.data () + i * 8 + 4);
bfd_vma addr = 0, word = 0;
int n_bytes = 0, n_words = 0;
struct obj_section *sec;
@@ -2640,21 +2601,18 @@ arm_exidx_new_objfile (struct objfile *objfile)
pers_sec = arm_obj_section_from_vma (objfile, pers);
if (pers_sec)
{
- static const char *personality[] =
- {
- "__gcc_personality_v0",
- "__gxx_personality_v0",
- "__gcj_personality_v0",
- "__gnu_objc_personality_v0",
- NULL
- };
+ static const char *personality[]
+ = { "__gcc_personality_v0", "__gxx_personality_v0",
+ "__gcj_personality_v0",
+ "__gnu_objc_personality_v0", NULL };
CORE_ADDR pc = pers + pers_sec->offset ();
int k;
for (k = 0; personality[k]; k++)
- if (lookup_minimal_symbol_by_pc_name
- (pc, personality[k], objfile))
+ if (lookup_minimal_symbol_by_pc_name (pc,
+ personality[k],
+ objfile))
{
gnu_personality = 1;
break;
@@ -2667,9 +2625,9 @@ arm_exidx_new_objfile (struct objfile *objfile)
if (gnu_personality
&& addr + 4 <= extab_vma + extab_data.size ())
{
- word = bfd_h_get_32 (objfile->obfd,
- (extab_data.data ()
- + addr - extab_vma));
+ word
+ = bfd_h_get_32 (objfile->obfd, (extab_data.data ()
+ + addr - extab_vma));
addr += 4;
n_bytes = 3;
n_words = ((word >> 24) & 0xff);
@@ -2716,8 +2674,8 @@ arm_exidx_new_objfile (struct objfile *objfile)
appear in order of increasing addresses. */
new_exidx_entry.addr = idx;
new_exidx_entry.entry = entry;
- data->section_maps[sec->the_bfd_section->index].push_back
- (new_exidx_entry);
+ data->section_maps[sec->the_bfd_section->index].push_back (
+ new_exidx_entry);
}
}
@@ -3138,12 +3096,12 @@ arm_exidx_unwind_sniffer (const struct frame_unwind *self,
&& (insn & 0x0f000000) == 0x0f000000 /* svc */)
exc_valid = 1;
}
-
+
/* Bail out if we don't know that exception information is valid. */
if (!exc_valid)
return 0;
- /* The ARM exception index does not mark the *end* of the region
+ /* The ARM exception index does not mark the *end* of the region
covered by the entry, and some functions will not have any entry.
To correctly recognize the end of the covered region, the linker
should have inserted dummy records with a CANTUNWIND marker.
@@ -3169,15 +3127,13 @@ arm_exidx_unwind_sniffer (const struct frame_unwind *self,
return 1;
}
-struct frame_unwind arm_exidx_unwind = {
- "arm exidx",
- NORMAL_FRAME,
- default_frame_unwind_stop_reason,
- arm_prologue_this_id,
- arm_prologue_prev_register,
- NULL,
- arm_exidx_unwind_sniffer
-};
+struct frame_unwind arm_exidx_unwind = { "arm exidx",
+ NORMAL_FRAME,
+ default_frame_unwind_stop_reason,
+ arm_prologue_this_id,
+ arm_prologue_prev_register,
+ NULL,
+ arm_exidx_unwind_sniffer };
static struct arm_prologue_cache *
arm_make_epilogue_frame_cache (frame_info_ptr this_frame)
@@ -3203,7 +3159,8 @@ arm_make_epilogue_frame_cache (frame_info_ptr this_frame)
for (reg = 0; reg < gdbarch_num_regs (get_frame_arch (this_frame)); reg++)
if (cache->saved_regs[reg].is_addr ())
cache->saved_regs[reg].set_addr (cache->saved_regs[reg].addr ()
- + arm_cache_get_prev_sp_value (cache, tdep));
+ + arm_cache_get_prev_sp_value (cache,
+ tdep));
return cache;
}
@@ -3212,8 +3169,7 @@ arm_make_epilogue_frame_cache (frame_info_ptr this_frame)
'struct frame_uwnind' for epilogue unwinder. */
static void
-arm_epilogue_frame_this_id (frame_info_ptr this_frame,
- void **this_cache,
+arm_epilogue_frame_this_id (frame_info_ptr this_frame, void **this_cache,
struct frame_id *this_id)
{
struct arm_prologue_cache *cache;
@@ -3240,8 +3196,8 @@ arm_epilogue_frame_this_id (frame_info_ptr this_frame,
'struct frame_uwnind' for epilogue unwinder. */
static struct value *
-arm_epilogue_frame_prev_register (frame_info_ptr this_frame,
- void **this_cache, int regnum)
+arm_epilogue_frame_prev_register (frame_info_ptr this_frame, void **this_cache,
+ int regnum)
{
if (*this_cache == NULL)
*this_cache = arm_make_epilogue_frame_cache (this_frame);
@@ -3278,8 +3234,7 @@ arm_epilogue_frame_sniffer (const struct frame_unwind *self,
/* Frame unwinder from epilogue. */
-static const struct frame_unwind arm_epilogue_frame_unwind =
-{
+static const struct frame_unwind arm_epilogue_frame_unwind = {
"arm epilogue",
NORMAL_FRAME,
default_frame_unwind_stop_reason,
@@ -3332,7 +3287,7 @@ arm_skip_bx_reg (frame_info_ptr frame, CORE_ADDR pc)
uint16_t insn
= extract_unsigned_integer (buf, 2, byte_order_for_code);
- if ((insn & 0xff80) == 0x4700) /* bx <Rm> */
+ if ((insn & 0xff80) == 0x4700) /* bx <Rm> */
{
CORE_ADDR dest
= get_frame_register_unsigned (frame, bits (insn, 3, 6));
@@ -3367,8 +3322,7 @@ arm_make_stub_cache (frame_info_ptr this_frame)
/* Our frame ID for a stub frame is the current SP and LR. */
static void
-arm_stub_this_id (frame_info_ptr this_frame,
- void **this_cache,
+arm_stub_this_id (frame_info_ptr this_frame, void **this_cache,
struct frame_id *this_id)
{
struct arm_prologue_cache *cache;
@@ -3385,8 +3339,7 @@ arm_stub_this_id (frame_info_ptr this_frame,
static int
arm_stub_unwind_sniffer (const struct frame_unwind *self,
- frame_info_ptr this_frame,
- void **this_prologue_cache)
+ frame_info_ptr this_frame, void **this_prologue_cache)
{
CORE_ADDR addr_in_block;
gdb_byte dummy[4];
@@ -3408,15 +3361,13 @@ arm_stub_unwind_sniffer (const struct frame_unwind *self,
return 0;
}
-struct frame_unwind arm_stub_unwind = {
- "arm stub",
- NORMAL_FRAME,
- default_frame_unwind_stop_reason,
- arm_stub_this_id,
- arm_prologue_prev_register,
- NULL,
- arm_stub_unwind_sniffer
-};
+struct frame_unwind arm_stub_unwind = { "arm stub",
+ NORMAL_FRAME,
+ default_frame_unwind_stop_reason,
+ arm_stub_this_id,
+ arm_prologue_prev_register,
+ NULL,
+ arm_stub_unwind_sniffer };
/* Put here the code to store, into CACHE->saved_regs, the addresses
of the saved registers of frame described by THIS_FRAME. CACHE is
@@ -3454,7 +3405,7 @@ arm_m_exception_cache (frame_info_ptr this_frame)
If we hit lockup magic PC in the other frame, it is
just a sentinel at the top of stack: do not warn then. */
if (frame_relative_level (this_frame) == 0)
- warning (_("ARM M in lockup state, stack unwinding terminated."));
+ warning (_ ("ARM M in lockup state, stack unwinding terminated."));
/* Terminate any further stack unwinding. */
arm_cache_set_active_sp_value (cache, tdep, 0);
@@ -3481,16 +3432,18 @@ arm_m_exception_cache (frame_info_ptr this_frame)
/* FNC_RETURN is only valid for targets with Security Extension. */
if (!tdep->have_sec_ext)
{
- error (_("While unwinding an exception frame, found unexpected Link "
- "Register value %s that requires the security extension, "
- "but the extension was not found or is disabled. This "
- "should not happen and may be caused by corrupt data or a "
- "bug in GDB."), phex (lr, ARM_INT_REGISTER_SIZE));
+ error (
+ _ ("While unwinding an exception frame, found unexpected Link "
+ "Register value %s that requires the security extension, "
+ "but the extension was not found or is disabled. This "
+ "should not happen and may be caused by corrupt data or a "
+ "bug in GDB."),
+ phex (lr, ARM_INT_REGISTER_SIZE));
}
if (!arm_unwind_secure_frames)
{
- warning (_("Non-secure to secure stack unwinding disabled."));
+ warning (_ ("Non-secure to secure stack unwinding disabled."));
/* Terminate any further stack unwinding. */
arm_cache_set_active_sp_value (cache, tdep, 0);
@@ -3555,7 +3508,7 @@ arm_m_exception_cache (frame_info_ptr this_frame)
if (secure_stack_used && !exception_domain_is_secure
&& !arm_unwind_secure_frames)
{
- warning (_("Non-secure to secure stack unwinding disabled."));
+ warning (_ ("Non-secure to secure stack unwinding disabled."));
/* Terminate any further stack unwinding. */
arm_cache_set_active_sp_value (cache, tdep, 0);
@@ -3656,7 +3609,8 @@ arm_m_exception_cache (frame_info_ptr this_frame)
/* With the Security extension, the hardware saves R4..R11 too. */
if (tdep->have_sec_ext && secure_stack_used
- && (!default_callee_register_stacking || !exception_domain_is_secure))
+ && (!default_callee_register_stacking
+ || !exception_domain_is_secure))
{
/* Read R4..R11 from the integer callee registers. */
cache->saved_regs[4].set_addr (unwound_sp + 0x08);
@@ -3697,10 +3651,10 @@ arm_m_exception_cache (frame_info_ptr this_frame)
/* Read FPCCR register. */
if (!safe_read_memory_unsigned_integer (FPCCR, ARM_INT_REGISTER_SIZE,
- byte_order, &fpccr))
+ byte_order, &fpccr))
{
- warning (_("Could not fetch required FPCCR content. Further "
- "unwinding is impossible."));
+ warning (_ ("Could not fetch required FPCCR content. Further "
+ "unwinding is impossible."));
arm_cache_set_active_sp_value (cache, tdep, 0);
return cache;
}
@@ -3709,8 +3663,9 @@ arm_m_exception_cache (frame_info_ptr this_frame)
if (!safe_read_memory_unsigned_integer (FPCAR, ARM_INT_REGISTER_SIZE,
byte_order, &fpcar))
{
- warning (_("Could not fetch FPCAR content. Further unwinding of "
- "FP register values will be unreliable."));
+ warning (
+ _ ("Could not fetch FPCAR content. Further unwinding of "
+ "FP register values will be unreliable."));
fpcar = 0;
}
@@ -3725,11 +3680,11 @@ arm_m_exception_cache (frame_info_ptr this_frame)
active for the current frame or for another frame.
See "Lazy context save of FP state", in B1.5.7, also ARM AN298,
supported by Cortex-M4F architecture for details. */
- bool fpcar_points_to_this_frame = ((unwound_sp + sp_r0_offset + 0x20)
- == (fpcar & ~0x7));
- bool read_fp_regs_from_stack = (!(fpccr_aspen && fpccr_lspen
- && fpccr_lspact
- && fpcar_points_to_this_frame));
+ bool fpcar_points_to_this_frame
+ = ((unwound_sp + sp_r0_offset + 0x20) == (fpcar & ~0x7));
+ bool read_fp_regs_from_stack
+ = (!(fpccr_aspen && fpccr_lspen && fpccr_lspact
+ && fpcar_points_to_this_frame));
/* Extended stack frame type used. */
if (read_fp_regs_from_stack)
@@ -3779,12 +3734,12 @@ arm_m_exception_cache (frame_info_ptr this_frame)
aligner between the top of the 32-byte stack frame and the
previous context's stack pointer. */
ULONGEST xpsr;
- if (!safe_read_memory_unsigned_integer (cache->saved_regs[ARM_PS_REGNUM]
- .addr (), ARM_INT_REGISTER_SIZE,
- byte_order, &xpsr))
+ if (!safe_read_memory_unsigned_integer (
+ cache->saved_regs[ARM_PS_REGNUM].addr (), ARM_INT_REGISTER_SIZE,
+ byte_order, &xpsr))
{
- warning (_("Could not fetch required XPSR content. Further "
- "unwinding is impossible."));
+ warning (_ ("Could not fetch required XPSR content. Further "
+ "unwinding is impossible."));
arm_cache_set_active_sp_value (cache, tdep, 0);
return cache;
}
@@ -3798,11 +3753,11 @@ arm_m_exception_cache (frame_info_ptr this_frame)
return cache;
}
- internal_error (_("While unwinding an exception frame, "
- "found unexpected Link Register value "
- "%s. This should not happen and may "
- "be caused by corrupt data or a bug in"
- " GDB."),
+ internal_error (_ ("While unwinding an exception frame, "
+ "found unexpected Link Register value "
+ "%s. This should not happen and may "
+ "be caused by corrupt data or a bug in"
+ " GDB."),
phex (lr, ARM_INT_REGISTER_SIZE));
}
@@ -3831,8 +3786,7 @@ arm_m_exception_frame_unwind_stop_reason (frame_info_ptr this_frame,
'struct frame_uwnind'. */
static void
-arm_m_exception_this_id (frame_info_ptr this_frame,
- void **this_cache,
+arm_m_exception_this_id (frame_info_ptr this_frame, void **this_cache,
struct frame_id *this_id)
{
struct arm_prologue_cache *cache;
@@ -3852,8 +3806,7 @@ arm_m_exception_this_id (frame_info_ptr this_frame,
'struct frame_uwnind'. */
static struct value *
-arm_m_exception_prev_register (frame_info_ptr this_frame,
- void **this_cache,
+arm_m_exception_prev_register (frame_info_ptr this_frame, void **this_cache,
int prev_regnum)
{
struct arm_prologue_cache *cache;
@@ -3868,17 +3821,18 @@ arm_m_exception_prev_register (frame_info_ptr this_frame,
= gdbarch_tdep<arm_gdbarch_tdep> (get_frame_arch (this_frame));
if (prev_regnum == ARM_SP_REGNUM)
return frame_unwind_got_constant (this_frame, prev_regnum,
- arm_cache_get_prev_sp_value (cache, tdep));
+ arm_cache_get_prev_sp_value (cache,
+ tdep));
/* If we are asked to unwind the PC, strip the saved T bit. */
if (prev_regnum == ARM_PC_REGNUM)
{
- struct value *value = trad_frame_get_prev_register (this_frame,
- cache->saved_regs,
- prev_regnum);
+ struct value *value
+ = trad_frame_get_prev_register (this_frame, cache->saved_regs,
+ prev_regnum);
CORE_ADDR pc = value_as_address (value);
return frame_unwind_got_constant (this_frame, prev_regnum,
- UNMAKE_THUMB_ADDR (pc));
+ UNMAKE_THUMB_ADDR (pc));
}
/* The value might be one of the alternative SP, if so, use the
@@ -3895,9 +3849,9 @@ arm_m_exception_prev_register (frame_info_ptr this_frame,
if (prev_regnum == ARM_PS_REGNUM)
{
struct gdbarch *gdbarch = get_frame_arch (this_frame);
- struct value *value = trad_frame_get_prev_register (this_frame,
- cache->saved_regs,
- ARM_PC_REGNUM);
+ struct value *value
+ = trad_frame_get_prev_register (this_frame, cache->saved_regs,
+ ARM_PC_REGNUM);
CORE_ADDR pc = value_as_address (value);
value = trad_frame_get_prev_register (this_frame, cache->saved_regs,
ARM_PS_REGNUM);
@@ -3933,16 +3887,14 @@ arm_m_exception_unwind_sniffer (const struct frame_unwind *self,
/* Frame unwinder for M-profile exceptions (EXC_RETURN on stack),
lockup and secure/nonsecure interstate function calls (FNC_RETURN). */
-struct frame_unwind arm_m_exception_unwind =
-{
- "arm m exception lockup sec_fnc",
- SIGTRAMP_FRAME,
- arm_m_exception_frame_unwind_stop_reason,
- arm_m_exception_this_id,
- arm_m_exception_prev_register,
- NULL,
- arm_m_exception_unwind_sniffer
-};
+struct frame_unwind arm_m_exception_unwind
+ = { "arm m exception lockup sec_fnc",
+ SIGTRAMP_FRAME,
+ arm_m_exception_frame_unwind_stop_reason,
+ arm_m_exception_this_id,
+ arm_m_exception_prev_register,
+ NULL,
+ arm_m_exception_unwind_sniffer };
static CORE_ADDR
arm_normal_frame_base (frame_info_ptr this_frame, void **this_cache)
@@ -3958,12 +3910,9 @@ arm_normal_frame_base (frame_info_ptr this_frame, void **this_cache)
return arm_cache_get_prev_sp_value (cache, tdep) - cache->framesize;
}
-struct frame_base arm_normal_base = {
- &arm_prologue_unwind,
- arm_normal_frame_base,
- arm_normal_frame_base,
- arm_normal_frame_base
-};
+struct frame_base arm_normal_base
+ = { &arm_prologue_unwind, arm_normal_frame_base, arm_normal_frame_base,
+ arm_normal_frame_base };
struct arm_dwarf2_prev_register_cache
{
@@ -3981,26 +3930,24 @@ static struct value *
arm_dwarf2_prev_register (frame_info_ptr this_frame, void **this_cache,
int regnum)
{
- struct gdbarch * gdbarch = get_frame_arch (this_frame);
+ struct gdbarch *gdbarch = get_frame_arch (this_frame);
arm_gdbarch_tdep *tdep = gdbarch_tdep<arm_gdbarch_tdep> (gdbarch);
CORE_ADDR lr;
ULONGEST cpsr;
arm_dwarf2_prev_register_cache *cache
- = ((arm_dwarf2_prev_register_cache *)
- dwarf2_frame_get_fn_data (this_frame, this_cache,
- arm_dwarf2_prev_register));
+ = ((arm_dwarf2_prev_register_cache *) dwarf2_frame_get_fn_data (
+ this_frame, this_cache, arm_dwarf2_prev_register));
if (!cache)
{
const unsigned int size = sizeof (struct arm_dwarf2_prev_register_cache);
- cache = ((arm_dwarf2_prev_register_cache *)
- dwarf2_frame_allocate_fn_data (this_frame, this_cache,
- arm_dwarf2_prev_register, size));
+ cache
+ = ((arm_dwarf2_prev_register_cache *) dwarf2_frame_allocate_fn_data (
+ this_frame, this_cache, arm_dwarf2_prev_register, size));
if (tdep->have_sec_ext)
{
- cache->sp
- = get_frame_register_unsigned (this_frame, ARM_SP_REGNUM);
+ cache->sp = get_frame_register_unsigned (this_frame, ARM_SP_REGNUM);
cache->msp_s
= get_frame_register_unsigned (this_frame,
@@ -4017,8 +3964,7 @@ arm_dwarf2_prev_register (frame_info_ptr this_frame, void **this_cache,
}
else if (tdep->is_m)
{
- cache->sp
- = get_frame_register_unsigned (this_frame, ARM_SP_REGNUM);
+ cache->sp = get_frame_register_unsigned (this_frame, ARM_SP_REGNUM);
cache->msp
= get_frame_register_unsigned (this_frame,
@@ -4067,29 +4013,30 @@ arm_dwarf2_prev_register (frame_info_ptr this_frame, void **this_cache,
if (tdep->have_sec_ext)
{
- bool is_msp = (regnum == tdep->m_profile_msp_regnum)
- && (cache->msp_s == cache->sp || cache->msp_ns == cache->sp);
+ bool is_msp
+ = (regnum == tdep->m_profile_msp_regnum)
+ && (cache->msp_s == cache->sp || cache->msp_ns == cache->sp);
bool is_msp_s = (regnum == tdep->m_profile_msp_s_regnum)
- && (cache->msp_s == cache->sp);
+ && (cache->msp_s == cache->sp);
bool is_msp_ns = (regnum == tdep->m_profile_msp_ns_regnum)
- && (cache->msp_ns == cache->sp);
- bool is_psp = (regnum == tdep->m_profile_psp_regnum)
- && (cache->psp_s == cache->sp || cache->psp_ns == cache->sp);
+ && (cache->msp_ns == cache->sp);
+ bool is_psp
+ = (regnum == tdep->m_profile_psp_regnum)
+ && (cache->psp_s == cache->sp || cache->psp_ns == cache->sp);
bool is_psp_s = (regnum == tdep->m_profile_psp_s_regnum)
- && (cache->psp_s == cache->sp);
+ && (cache->psp_s == cache->sp);
bool is_psp_ns = (regnum == tdep->m_profile_psp_ns_regnum)
- && (cache->psp_ns == cache->sp);
-
- override_with_sp_value = is_msp || is_msp_s || is_msp_ns
- || is_psp || is_psp_s || is_psp_ns;
+ && (cache->psp_ns == cache->sp);
+ override_with_sp_value = is_msp || is_msp_s || is_msp_ns || is_psp
+ || is_psp_s || is_psp_ns;
}
else if (tdep->is_m)
{
bool is_msp = (regnum == tdep->m_profile_msp_regnum)
- && (cache->sp == cache->msp);
+ && (cache->sp == cache->msp);
bool is_psp = (regnum == tdep->m_profile_psp_regnum)
- && (cache->sp == cache->psp);
+ && (cache->sp == cache->psp);
override_with_sp_value = is_msp || is_psp;
}
@@ -4110,7 +4057,7 @@ arm_dwarf2_prev_register (frame_info_ptr this_frame, void **this_cache,
return frame_unwind_got_constant (this_frame, regnum, val);
}
- internal_error (_("Unexpected register %d"), regnum);
+ internal_error (_ ("Unexpected register %d"), regnum);
}
/* Implement the stack_frame_destroyed_p gdbarch method. */
@@ -4154,16 +4101,16 @@ thumb_stack_frame_destroyed_p (struct gdbarch *gdbarch, CORE_ADDR pc)
scan_pc += 2;
insn = extract_unsigned_integer (buf, 2, byte_order_for_code);
- if ((insn & 0xff80) == 0x4700) /* bx <Rm> */
+ if ((insn & 0xff80) == 0x4700) /* bx <Rm> */
found_return = 1;
- else if (insn == 0x46f7) /* mov pc, lr */
+ else if (insn == 0x46f7) /* mov pc, lr */
found_return = 1;
else if (thumb_instruction_restores_sp (insn))
{
- if ((insn & 0xff00) == 0xbd00) /* pop <registers, PC> */
+ if ((insn & 0xff00) == 0xbd00) /* pop <registers, PC> */
found_return = 1;
}
- else if (thumb_insn_size (insn) == 4) /* 32-bit Thumb-2 instruction */
+ else if (thumb_insn_size (insn) == 4) /* 32-bit Thumb-2 instruction */
{
if (target_read_memory (scan_pc, buf, 2))
break;
@@ -4171,18 +4118,18 @@ thumb_stack_frame_destroyed_p (struct gdbarch *gdbarch, CORE_ADDR pc)
scan_pc += 2;
insn2 = extract_unsigned_integer (buf, 2, byte_order_for_code);
- if (insn == 0xe8bd) /* ldm.w sp!, <registers> */
+ if (insn == 0xe8bd) /* ldm.w sp!, <registers> */
{
- if (insn2 & 0x8000) /* <registers> include PC. */
+ if (insn2 & 0x8000) /* <registers> include PC. */
found_return = 1;
}
- else if (insn == 0xf85d /* ldr.w <Rt>, [sp], #4 */
+ else if (insn == 0xf85d /* ldr.w <Rt>, [sp], #4 */
&& (insn2 & 0x0fff) == 0x0b04)
{
if ((insn2 & 0xf000) == 0xf000) /* <Rt> is PC. */
found_return = 1;
}
- else if ((insn & 0xffbf) == 0xecbd /* vldm sp!, <list> */
+ else if ((insn & 0xffbf) == 0xecbd /* vldm sp!, <list> */
&& (insn2 & 0x0e00) == 0x0a00)
;
else
@@ -4211,12 +4158,12 @@ thumb_stack_frame_destroyed_p (struct gdbarch *gdbarch, CORE_ADDR pc)
if (thumb_instruction_restores_sp (insn2))
found_stack_adjust = 1;
- else if (insn == 0xe8bd) /* ldm.w sp!, <registers> */
+ else if (insn == 0xe8bd) /* ldm.w sp!, <registers> */
found_stack_adjust = 1;
- else if (insn == 0xf85d /* ldr.w <Rt>, [sp], #4 */
+ else if (insn == 0xf85d /* ldr.w <Rt>, [sp], #4 */
&& (insn2 & 0x0fff) == 0x0b04)
found_stack_adjust = 1;
- else if ((insn & 0xffbf) == 0xecbd /* vldm sp!, <list> */
+ else if ((insn & 0xffbf) == 0xecbd /* vldm sp!, <list> */
&& (insn2 & 0x0e00) == 0x0a00)
found_stack_adjust = 1;
@@ -4250,8 +4197,7 @@ arm_stack_frame_destroyed_p_1 (struct gdbarch *gdbarch, CORE_ADDR pc)
else if ((insn & 0x0ffffff0) == 0x01a0f000)
/* MOV PC. */
found_return = 1;
- else if ((insn & 0x0fff0000) == 0x08bd0000
- && (insn & 0x0000c000) != 0)
+ else if ((insn & 0x0fff0000) == 0x08bd0000 && (insn & 0x0000c000) != 0)
/* POP (LDMIA), including PC or LR. */
found_return = 1;
}
@@ -4365,8 +4311,7 @@ arm_vfp_cprc_unit_length (enum arm_vfp_cprc_base_type b)
case VFP_CPRC_VEC128:
return 16;
default:
- internal_error (_("Invalid VFP CPRC type: %d."),
- (int) b);
+ internal_error (_ ("Invalid VFP CPRC type: %d."), (int) b);
}
}
@@ -4387,8 +4332,7 @@ arm_vfp_cprc_reg_char (enum arm_vfp_cprc_base_type b)
case VFP_CPRC_VEC128:
return 'q';
default:
- internal_error (_("Invalid VFP CPRC type: %d."),
- (int) b);
+ internal_error (_ ("Invalid VFP CPRC type: %d."), (int) b);
}
}
@@ -4491,8 +4435,7 @@ arm_vfp_cprc_sub_candidate (struct type *t,
int count;
unsigned unitlen;
- count = arm_vfp_cprc_sub_candidate (t->target_type (),
- base_type);
+ count = arm_vfp_cprc_sub_candidate (t->target_type (), base_type);
if (count == -1)
return -1;
if (t->length () == 0)
@@ -4519,8 +4462,8 @@ arm_vfp_cprc_sub_candidate (struct type *t,
int sub_count = 0;
if (!field_is_static (&t->field (i)))
- sub_count = arm_vfp_cprc_sub_candidate (t->field (i).type (),
- base_type);
+ sub_count
+ = arm_vfp_cprc_sub_candidate (t->field (i).type (), base_type);
if (sub_count == -1)
return -1;
count += sub_count;
@@ -4545,8 +4488,8 @@ arm_vfp_cprc_sub_candidate (struct type *t,
int i;
for (i = 0; i < t->num_fields (); i++)
{
- int sub_count = arm_vfp_cprc_sub_candidate (t->field (i).type (),
- base_type);
+ int sub_count
+ = arm_vfp_cprc_sub_candidate (t->field (i).type (), base_type);
if (sub_count == -1)
return -1;
count = (count > sub_count ? count : sub_count);
@@ -4686,8 +4629,8 @@ arm_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
align = type_align (arg_type);
/* Round alignment up to a whole number of words. */
- align = (align + ARM_INT_REGISTER_SIZE - 1)
- & ~(ARM_INT_REGISTER_SIZE - 1);
+ align
+ = (align + ARM_INT_REGISTER_SIZE - 1) & ~(ARM_INT_REGISTER_SIZE - 1);
/* Different ABIs have different maximum alignments. */
if (tdep->arm_abi == ARM_ABI_APCS)
{
@@ -4743,8 +4686,8 @@ arm_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
val + i * unit_length);
else
{
- xsnprintf (name_buf, sizeof (name_buf), "%c%d",
- reg_char, reg_scaled + i);
+ xsnprintf (name_buf, sizeof (name_buf), "%c%d", reg_char,
+ reg_scaled + i);
regnum = user_reg_map_name_to_regnum (gdbarch, name_buf,
strlen (name_buf));
regcache->cooked_write (regnum, val + i * unit_length);
@@ -4766,19 +4709,16 @@ arm_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
si = push_stack_item (si, val, ARM_INT_REGISTER_SIZE);
nstack += ARM_INT_REGISTER_SIZE;
}
-
+
/* Doubleword aligned quantities must go in even register pairs. */
- if (may_use_core_reg
- && argreg <= ARM_LAST_ARG_REGNUM
- && align > ARM_INT_REGISTER_SIZE
- && argreg & 1)
+ if (may_use_core_reg && argreg <= ARM_LAST_ARG_REGNUM
+ && align > ARM_INT_REGISTER_SIZE && argreg & 1)
argreg++;
/* If the argument is a pointer to a function, and it is a
Thumb function, create a LOCAL copy of the value and set
the THUMB bit in it. */
- if (TYPE_CODE_PTR == typecode
- && target_type != NULL
+ if (TYPE_CODE_PTR == typecode && target_type != NULL
&& TYPE_CODE_FUNC == check_typedef (target_type)->code ())
{
CORE_ADDR regval = extract_unsigned_integer (val, len, byte_order);
@@ -4796,8 +4736,8 @@ arm_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
registers and stack. */
while (len > 0)
{
- int partial_len = len < ARM_INT_REGISTER_SIZE
- ? len : ARM_INT_REGISTER_SIZE;
+ int partial_len
+ = len < ARM_INT_REGISTER_SIZE ? len : ARM_INT_REGISTER_SIZE;
CORE_ADDR regval
= extract_unsigned_integer (val, partial_len, byte_order);
@@ -4827,7 +4767,7 @@ arm_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
si = push_stack_item (si, buf, ARM_INT_REGISTER_SIZE);
nstack += ARM_INT_REGISTER_SIZE;
}
-
+
len -= partial_len;
val += partial_len;
}
@@ -4850,7 +4790,6 @@ arm_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
return sp;
}
-
/* Always align the frame to an 8-byte boundary. This is required on
some platforms and harmless on the rest. */
@@ -4858,7 +4797,7 @@ static CORE_ADDR
arm_frame_align (struct gdbarch *gdbarch, CORE_ADDR sp)
{
/* Align the stack to eight bytes. */
- return sp & ~ (CORE_ADDR) 7;
+ return sp & ~(CORE_ADDR) 7;
}
static void
@@ -4888,14 +4827,14 @@ arm_print_float_info (struct gdbarch *gdbarch, struct ui_file *file,
type = (status >> 24) & 127;
if (status & (1 << 31))
- gdb_printf (file, _("Hardware FPU type %d\n"), type);
+ gdb_printf (file, _ ("Hardware FPU type %d\n"), type);
else
- gdb_printf (file, _("Software FPU type %d\n"), type);
+ gdb_printf (file, _ ("Software FPU type %d\n"), type);
/* i18n: [floating point unit] mask */
- gdb_puts (_("mask: "), file);
+ gdb_puts (_ ("mask: "), file);
print_fpu_flags (file, status >> 16);
/* i18n: [floating point unit] flags */
- gdb_puts (_("flags: "), file);
+ gdb_puts (_ ("flags: "), file);
print_fpu_flags (file, status);
}
@@ -4906,9 +4845,8 @@ arm_ext_type (struct gdbarch *gdbarch)
arm_gdbarch_tdep *tdep = gdbarch_tdep<arm_gdbarch_tdep> (gdbarch);
if (!tdep->arm_ext_type)
- tdep->arm_ext_type
- = arch_float_type (gdbarch, -1, "builtin_type_arm_ext",
- floatformats_arm_ext);
+ tdep->arm_ext_type = arch_float_type (gdbarch, -1, "builtin_type_arm_ext",
+ floatformats_arm_ext);
return tdep->arm_ext_type;
}
@@ -4997,8 +4935,7 @@ is_q_pseudo (struct gdbarch *gdbarch, int regnum)
/* Q pseudo registers are available for both NEON (Q0~Q15) and
MVE (Q0~Q7) features. */
- if (tdep->have_q_pseudos
- && regnum >= tdep->q_pseudo_base
+ if (tdep->have_q_pseudos && regnum >= tdep->q_pseudo_base
&& regnum < (tdep->q_pseudo_base + tdep->q_pseudo_count))
return true;
@@ -5016,8 +4953,7 @@ is_s_pseudo (struct gdbarch *gdbarch, int regnum)
{
arm_gdbarch_tdep *tdep = gdbarch_tdep<arm_gdbarch_tdep> (gdbarch);
- if (tdep->have_s_pseudos
- && regnum >= tdep->s_pseudo_base
+ if (tdep->have_s_pseudos && regnum >= tdep->s_pseudo_base
&& regnum < (tdep->s_pseudo_base + tdep->s_pseudo_count))
return true;
@@ -5035,8 +4971,7 @@ is_mve_pseudo (struct gdbarch *gdbarch, int regnum)
{
arm_gdbarch_tdep *tdep = gdbarch_tdep<arm_gdbarch_tdep> (gdbarch);
- if (tdep->have_mve
- && regnum >= tdep->mve_pseudo_base
+ if (tdep->have_mve && regnum >= tdep->mve_pseudo_base
&& regnum < tdep->mve_pseudo_base + tdep->mve_pseudo_count)
return true;
@@ -5054,8 +4989,7 @@ is_pacbti_pseudo (struct gdbarch *gdbarch, int regnum)
{
arm_gdbarch_tdep *tdep = gdbarch_tdep<arm_gdbarch_tdep> (gdbarch);
- if (tdep->have_pacbti
- && regnum >= tdep->pacbti_pseudo_base
+ if (tdep->have_pacbti && regnum >= tdep->pacbti_pseudo_base
&& regnum < tdep->pacbti_pseudo_base + tdep->pacbti_pseudo_count)
return true;
@@ -5090,8 +5024,7 @@ arm_register_type (struct gdbarch *gdbarch, int regnum)
struct type *t = tdesc_register_type (gdbarch, regnum);
if (regnum >= ARM_D0_REGNUM && regnum < ARM_D0_REGNUM + 32
- && t->code () == TYPE_CODE_FLT
- && tdep->have_neon)
+ && t->code () == TYPE_CODE_FLT && tdep->have_neon)
return arm_neon_double_type (gdbarch);
else
return t;
@@ -5217,7 +5150,7 @@ arm_register_sim_regno (struct gdbarch *gdbarch, int regnum)
return SIM_ARM_FPS_REGNUM + reg;
reg -= NUM_SREGS;
- internal_error (_("Bad REGNUM %d"), regnum);
+ internal_error (_ ("Bad REGNUM %d"), regnum);
}
static const unsigned char op_lit0 = DW_OP_lit0;
@@ -5258,8 +5191,8 @@ arm_dwarf2_frame_init_reg (struct gdbarch *gdbarch, int regnum,
NULL if an error occurs. BUF is freed. */
static gdb_byte *
-extend_buffer_earlier (gdb_byte *buf, CORE_ADDR endaddr,
- int old_len, int new_len)
+extend_buffer_earlier (gdb_byte *buf, CORE_ADDR endaddr, int old_len,
+ int new_len)
{
gdb_byte *new_buf;
int bytes_to_read = new_len - old_len;
@@ -5371,7 +5304,7 @@ arm_adjust_breakpoint_address (struct gdbarch *gdbarch, CORE_ADDR bpaddr)
buf_len = IT_SCAN_THRESHOLD;
definite = 0;
- for (i = 0; i < buf_len - sizeof (buf) && ! definite; i += 2)
+ for (i = 0; i < buf_len - sizeof (buf) && !definite; i += 2)
{
unsigned short inst1 = extract_unsigned_integer (&buf[i], 2, order);
if (thumb_insn_size (inst1) == 2)
@@ -5386,10 +5319,10 @@ arm_adjust_breakpoint_address (struct gdbarch *gdbarch, CORE_ADDR bpaddr)
enough from BPADDR that we could not miss an IT instruction
affecting BPADDR. If ! DEFINITE, give up - start from a
known boundary. */
- if (! definite)
+ if (!definite)
{
- buf = extend_buffer_earlier (buf, bpaddr, buf_len,
- bpaddr - boundary);
+ buf
+ = extend_buffer_earlier (buf, bpaddr, buf_len, bpaddr - boundary);
if (buf == NULL)
return bpaddr;
buf_len = bpaddr - boundary;
@@ -5464,7 +5397,7 @@ arm_adjust_breakpoint_address (struct gdbarch *gdbarch, CORE_ADDR bpaddr)
instruction had been executed unmodified in its original location. */
/* NOP instruction (mov r0, r0). */
-#define ARM_NOP 0xe1a00000
+#define ARM_NOP 0xe1a00000
#define THUMB_NOP 0x4600
/* Helper for register reads for displaced stepping. In particular, this
@@ -5491,16 +5424,15 @@ displaced_read_reg (regcache *regs, arm_displaced_step_copy_insn_closure *dsc,
else
from += 4;
- displaced_debug_printf ("read pc value %.8lx",
- (unsigned long) from);
+ displaced_debug_printf ("read pc value %.8lx", (unsigned long) from);
return (ULONGEST) from;
}
else
{
regcache_cooked_read_unsigned (regs, regno, &ret);
- displaced_debug_printf ("read r%d value %.8lx",
- regno, (unsigned long) ret);
+ displaced_debug_printf ("read r%d value %.8lx", regno,
+ (unsigned long) ret);
return ret;
}
@@ -5557,7 +5489,7 @@ bx_write_pc (struct regcache *regs, ULONGEST val)
{
/* Unpredictable behaviour. Try to do something sensible (switch to ARM
mode, align dest to 4 bytes). */
- warning (_("Single-stepping BX to non-word-aligned ARM instruction."));
+ warning (_ ("Single-stepping BX to non-word-aligned ARM instruction."));
regcache_cooked_write_unsigned (regs, ARM_PS_REGNUM, ps & ~t_bit);
regcache_cooked_write_unsigned (regs, ARM_PC_REGNUM, val & 0xfffffffc);
}
@@ -5618,20 +5550,20 @@ displaced_write_reg (regcache *regs, arm_displaced_step_copy_insn_closure *dsc,
break;
case CANNOT_WRITE_PC:
- warning (_("Instruction wrote to PC in an unexpected way when "
- "single-stepping"));
+ warning (_ ("Instruction wrote to PC in an unexpected way when "
+ "single-stepping"));
break;
default:
- internal_error (_("Invalid argument to displaced_write_reg"));
+ internal_error (_ ("Invalid argument to displaced_write_reg"));
}
dsc->wrote_to_pc = 1;
}
else
{
- displaced_debug_printf ("writing r%d value %.8lx",
- regno, (unsigned long) val);
+ displaced_debug_printf ("writing r%d value %.8lx", regno,
+ (unsigned long) val);
regcache_cooked_write_unsigned (regs, regno, val);
}
}
@@ -5689,7 +5621,8 @@ thumb_copy_unmodified_32bit (struct gdbarch *gdbarch, uint16_t insn1,
arm_displaced_step_copy_insn_closure *dsc)
{
displaced_debug_printf ("copying insn %.4x %.4x, opcode/class '%s' "
- "unmodified", insn1, insn2, iname);
+ "unmodified",
+ insn1, insn2, iname);
dsc->modinsn[0] = insn1;
dsc->modinsn[1] = insn2;
@@ -5744,7 +5677,8 @@ install_preload (struct gdbarch *gdbarch, struct regcache *regs,
}
static int
-arm_copy_preload (struct gdbarch *gdbarch, uint32_t insn, struct regcache *regs,
+arm_copy_preload (struct gdbarch *gdbarch, uint32_t insn,
+ struct regcache *regs,
arm_displaced_step_copy_insn_closure *dsc)
{
unsigned int rn = bits (insn, 16, 19);
@@ -5810,9 +5744,9 @@ thumb2_copy_preload (struct gdbarch *gdbarch, uint16_t insn1, uint16_t insn2,
/* Preload instructions with register offset. */
static void
-install_preload_reg(struct gdbarch *gdbarch, struct regcache *regs,
- arm_displaced_step_copy_insn_closure *dsc, unsigned int rn,
- unsigned int rm)
+install_preload_reg (struct gdbarch *gdbarch, struct regcache *regs,
+ arm_displaced_step_copy_insn_closure *dsc,
+ unsigned int rn, unsigned int rm)
{
ULONGEST rn_val, rm_val;
@@ -5841,12 +5775,10 @@ arm_copy_preload_reg (struct gdbarch *gdbarch, uint32_t insn,
unsigned int rn = bits (insn, 16, 19);
unsigned int rm = bits (insn, 0, 3);
-
if (!insn_references_pc (insn, 0x000f000ful))
return arm_copy_unmodified (gdbarch, insn, "preload reg", dsc);
- displaced_debug_printf ("copying preload insn %.8lx",
- (unsigned long) insn);
+ displaced_debug_printf ("copying preload insn %.8lx", (unsigned long) insn);
dsc->modinsn[0] = (insn & 0xfff0fff0) | 0x1;
@@ -5857,8 +5789,7 @@ arm_copy_preload_reg (struct gdbarch *gdbarch, uint32_t insn,
/* Copy/cleanup coprocessor load and store instructions. */
static void
-cleanup_copro_load_store (struct gdbarch *gdbarch,
- struct regcache *regs,
+cleanup_copro_load_store (struct gdbarch *gdbarch, struct regcache *regs,
arm_displaced_step_copy_insn_closure *dsc)
{
ULONGEST rn_val = displaced_read_reg (regs, dsc, 0);
@@ -5950,8 +5881,8 @@ cleanup_branch (struct gdbarch *gdbarch, struct regcache *regs,
{
uint32_t status = displaced_read_reg (regs, dsc, ARM_PS_REGNUM);
int branch_taken = condition_true (dsc->u.branch.cond, status);
- enum pc_write_style write_pc = dsc->u.branch.exchange
- ? BX_WRITE_PC : BRANCH_WRITE_PC;
+ enum pc_write_style write_pc
+ = dsc->u.branch.exchange ? BX_WRITE_PC : BRANCH_WRITE_PC;
if (!branch_taken)
return;
@@ -5977,8 +5908,8 @@ cleanup_branch (struct gdbarch *gdbarch, struct regcache *regs,
static void
install_b_bl_blx (struct gdbarch *gdbarch, struct regcache *regs,
- arm_displaced_step_copy_insn_closure *dsc,
- unsigned int cond, int exchange, int link, long offset)
+ arm_displaced_step_copy_insn_closure *dsc, unsigned int cond,
+ int exchange, int link, long offset)
{
/* Implement "BL<cond> <label>" as:
@@ -6004,9 +5935,10 @@ install_b_bl_blx (struct gdbarch *gdbarch, struct regcache *regs,
dsc->cleanup = &cleanup_branch;
}
+
static int
-arm_copy_b_bl_blx (struct gdbarch *gdbarch, uint32_t insn,
- regcache *regs, arm_displaced_step_copy_insn_closure *dsc)
+arm_copy_b_bl_blx (struct gdbarch *gdbarch, uint32_t insn, regcache *regs,
+ arm_displaced_step_copy_insn_closure *dsc)
{
unsigned int cond = bits (insn, 28, 31);
int exchange = (cond == 0xf);
@@ -6014,7 +5946,9 @@ arm_copy_b_bl_blx (struct gdbarch *gdbarch, uint32_t insn,
long offset;
displaced_debug_printf ("copying %s immediate insn %.8lx",
- (exchange) ? "blx" : (link) ? "bl" : "b",
+ (exchange) ? "blx"
+ : (link) ? "bl"
+ : "b",
(unsigned long) insn);
if (exchange)
/* For BLX, set bit 0 of the destination. The cleanup_branch function will
@@ -6033,8 +5967,8 @@ arm_copy_b_bl_blx (struct gdbarch *gdbarch, uint32_t insn,
}
static int
-thumb2_copy_b_bl_blx (struct gdbarch *gdbarch, uint16_t insn1,
- uint16_t insn2, struct regcache *regs,
+thumb2_copy_b_bl_blx (struct gdbarch *gdbarch, uint16_t insn1, uint16_t insn2,
+ struct regcache *regs,
arm_displaced_step_copy_insn_closure *dsc)
{
int link = bit (insn2, 14);
@@ -6052,18 +5986,14 @@ thumb2_copy_b_bl_blx (struct gdbarch *gdbarch, uint16_t insn1,
offset = (bits (insn2, 0, 10) << 1);
if (bit (insn2, 12)) /* Encoding T4 */
{
- offset |= (bits (insn1, 0, 9) << 12)
- | (i2 << 22)
- | (i1 << 23)
- | (s << 24);
+ offset |= (bits (insn1, 0, 9) << 12) | (i2 << 22) | (i1 << 23)
+ | (s << 24);
cond = INST_AL;
}
else /* Encoding T3 */
{
- offset |= (bits (insn1, 0, 5) << 12)
- | (j1 << 18)
- | (j2 << 19)
- | (s << 20);
+ offset |= (bits (insn1, 0, 5) << 12) | (j1 << 18) | (j2 << 19)
+ | (s << 20);
cond = bits (insn1, 6, 9);
}
}
@@ -6071,13 +6001,13 @@ thumb2_copy_b_bl_blx (struct gdbarch *gdbarch, uint16_t insn1,
{
offset = (bits (insn1, 0, 9) << 12);
offset |= ((i2 << 22) | (i1 << 23) | (s << 24));
- offset |= exchange ?
- (bits (insn2, 1, 10) << 2) : (bits (insn2, 0, 10) << 1);
+ offset
+ |= exchange ? (bits (insn2, 1, 10) << 2) : (bits (insn2, 0, 10) << 1);
}
displaced_debug_printf ("copying %s insn %.4x %.4x with offset %.8lx",
- link ? (exchange) ? "blx" : "bl" : "b",
- insn1, insn2, offset);
+ link ? (exchange) ? "blx" : "bl" : "b", insn1, insn2,
+ offset);
dsc->modinsn[0] = THUMB_NOP;
@@ -6107,8 +6037,8 @@ thumb_copy_b (struct gdbarch *gdbarch, uint16_t insn,
cond = INST_AL;
}
- displaced_debug_printf ("copying b immediate insn %.4x with offset %d",
- insn, offset);
+ displaced_debug_printf ("copying b immediate insn %.4x with offset %d", insn,
+ offset);
dsc->u.branch.cond = cond;
dsc->u.branch.link = 0;
@@ -6148,8 +6078,8 @@ install_bx_blx_reg (struct gdbarch *gdbarch, struct regcache *regs,
}
static int
-arm_copy_bx_blx_reg (struct gdbarch *gdbarch, uint32_t insn,
- regcache *regs, arm_displaced_step_copy_insn_closure *dsc)
+arm_copy_bx_blx_reg (struct gdbarch *gdbarch, uint32_t insn, regcache *regs,
+ arm_displaced_step_copy_insn_closure *dsc)
{
unsigned int cond = bits (insn, 28, 31);
/* BX: x12xxx1x
@@ -6182,12 +6112,11 @@ thumb_copy_bx_blx_reg (struct gdbarch *gdbarch, uint16_t insn,
return 0;
}
-
/* Copy/cleanup arithmetic/logic instruction with immediate RHS. */
static void
-cleanup_alu_imm (struct gdbarch *gdbarch,
- regcache *regs, arm_displaced_step_copy_insn_closure *dsc)
+cleanup_alu_imm (struct gdbarch *gdbarch, regcache *regs,
+ arm_displaced_step_copy_insn_closure *dsc)
{
ULONGEST rd_val = displaced_read_reg (regs, dsc, 0);
displaced_write_reg (regs, dsc, 0, dsc->tmp[0], CANNOT_WRITE_PC);
@@ -6196,7 +6125,8 @@ cleanup_alu_imm (struct gdbarch *gdbarch,
}
static int
-arm_copy_alu_imm (struct gdbarch *gdbarch, uint32_t insn, struct regcache *regs,
+arm_copy_alu_imm (struct gdbarch *gdbarch, uint32_t insn,
+ struct regcache *regs,
arm_displaced_step_copy_insn_closure *dsc)
{
unsigned int rn = bits (insn, 16, 19);
@@ -6209,8 +6139,7 @@ arm_copy_alu_imm (struct gdbarch *gdbarch, uint32_t insn, struct regcache *regs,
return arm_copy_unmodified (gdbarch, insn, "ALU immediate", dsc);
displaced_debug_printf ("copying immediate %s insn %.8lx",
- is_mov ? "move" : "ALU",
- (unsigned long) insn);
+ is_mov ? "move" : "ALU", (unsigned long) insn);
/* Instruction is of form:
@@ -6243,16 +6172,16 @@ arm_copy_alu_imm (struct gdbarch *gdbarch, uint32_t insn, struct regcache *regs,
}
static int
-thumb2_copy_alu_imm (struct gdbarch *gdbarch, uint16_t insn1,
- uint16_t insn2, struct regcache *regs,
+thumb2_copy_alu_imm (struct gdbarch *gdbarch, uint16_t insn1, uint16_t insn2,
+ struct regcache *regs,
arm_displaced_step_copy_insn_closure *dsc)
{
unsigned int op = bits (insn1, 5, 8);
unsigned int rn, rm, rd;
ULONGEST rd_val, rn_val;
- rn = bits (insn1, 0, 3); /* Rn */
- rm = bits (insn2, 0, 3); /* Rm */
+ rn = bits (insn1, 0, 3); /* Rn */
+ rm = bits (insn2, 0, 3); /* Rm */
rd = bits (insn2, 8, 11); /* Rd */
/* This routine is only called for instruction MOV. */
@@ -6295,8 +6224,8 @@ thumb2_copy_alu_imm (struct gdbarch *gdbarch, uint16_t insn1,
/* Copy/cleanup arithmetic/logic insns with register RHS. */
static void
-cleanup_alu_reg (struct gdbarch *gdbarch,
- regcache *regs, arm_displaced_step_copy_insn_closure *dsc)
+cleanup_alu_reg (struct gdbarch *gdbarch, regcache *regs,
+ arm_displaced_step_copy_insn_closure *dsc)
{
ULONGEST rd_val;
int i;
@@ -6311,8 +6240,8 @@ cleanup_alu_reg (struct gdbarch *gdbarch,
static void
install_alu_reg (struct gdbarch *gdbarch, struct regcache *regs,
- arm_displaced_step_copy_insn_closure *dsc,
- unsigned int rd, unsigned int rn, unsigned int rm)
+ arm_displaced_step_copy_insn_closure *dsc, unsigned int rd,
+ unsigned int rn, unsigned int rm)
{
ULONGEST rd_val, rn_val, rm_val;
@@ -6343,7 +6272,8 @@ install_alu_reg (struct gdbarch *gdbarch, struct regcache *regs,
}
static int
-arm_copy_alu_reg (struct gdbarch *gdbarch, uint32_t insn, struct regcache *regs,
+arm_copy_alu_reg (struct gdbarch *gdbarch, uint32_t insn,
+ struct regcache *regs,
arm_displaced_step_copy_insn_closure *dsc)
{
unsigned int op = bits (insn, 21, 24);
@@ -6352,16 +6282,16 @@ arm_copy_alu_reg (struct gdbarch *gdbarch, uint32_t insn, struct regcache *regs,
if (!insn_references_pc (insn, 0x000ff00ful))
return arm_copy_unmodified (gdbarch, insn, "ALU reg", dsc);
- displaced_debug_printf ("copying reg %s insn %.8lx",
- is_mov ? "move" : "ALU", (unsigned long) insn);
+ displaced_debug_printf ("copying reg %s insn %.8lx", is_mov ? "move" : "ALU",
+ (unsigned long) insn);
if (is_mov)
dsc->modinsn[0] = (insn & 0xfff00ff0) | 0x2;
else
dsc->modinsn[0] = (insn & 0xfff00ff0) | 0x10002;
- install_alu_reg (gdbarch, regs, dsc, bits (insn, 12, 15), bits (insn, 16, 19),
- bits (insn, 0, 3));
+ install_alu_reg (gdbarch, regs, dsc, bits (insn, 12, 15),
+ bits (insn, 16, 19), bits (insn, 0, 3));
return 0;
}
@@ -6390,8 +6320,7 @@ thumb_copy_alu_reg (struct gdbarch *gdbarch, uint16_t insn,
/* Cleanup/copy arithmetic/logic insns with shifted register RHS. */
static void
-cleanup_alu_shifted_reg (struct gdbarch *gdbarch,
- struct regcache *regs,
+cleanup_alu_shifted_reg (struct gdbarch *gdbarch, struct regcache *regs,
arm_displaced_step_copy_insn_closure *dsc)
{
ULONGEST rd_val = displaced_read_reg (regs, dsc, 0);
@@ -6454,8 +6383,7 @@ arm_copy_alu_shifted_reg (struct gdbarch *gdbarch, uint32_t insn,
return arm_copy_unmodified (gdbarch, insn, "ALU shifted reg", dsc);
displaced_debug_printf ("copying shifted reg %s insn %.8lx",
- is_mov ? "move" : "ALU",
- (unsigned long) insn);
+ is_mov ? "move" : "ALU", (unsigned long) insn);
rn = bits (insn, 16, 19);
rm = bits (insn, 0, 3);
@@ -6528,15 +6456,16 @@ cleanup_store (struct gdbarch *gdbarch, struct regcache *regs,
static int
arm_copy_extra_ld_st (struct gdbarch *gdbarch, uint32_t insn, int unprivileged,
- regcache *regs, arm_displaced_step_copy_insn_closure *dsc)
+ regcache *regs,
+ arm_displaced_step_copy_insn_closure *dsc)
{
unsigned int op1 = bits (insn, 20, 24);
unsigned int op2 = bits (insn, 5, 6);
unsigned int rt = bits (insn, 12, 15);
unsigned int rn = bits (insn, 16, 19);
unsigned int rm = bits (insn, 0, 3);
- char load[12] = {0, 1, 0, 1, 1, 1, 1, 1, 0, 1, 0, 1};
- char bytesize[12] = {2, 2, 2, 2, 8, 1, 8, 1, 8, 2, 8, 2};
+ char load[12] = { 0, 1, 0, 1, 1, 1, 1, 1, 0, 1, 0, 1 };
+ char bytesize[12] = { 2, 2, 2, 2, 8, 1, 8, 1, 8, 2, 8, 2 };
int immed = (op1 & 0x4) != 0;
int opcode;
ULONGEST rt_val, rt_val2 = 0, rn_val, rm_val = 0;
@@ -6551,7 +6480,7 @@ arm_copy_extra_ld_st (struct gdbarch *gdbarch, uint32_t insn, int unprivileged,
opcode = ((op2 << 2) | (op1 & 0x1) | ((op1 & 0x4) >> 1)) - 4;
if (opcode < 0)
- internal_error (_("copy_extra_ld_st: instruction decode error"));
+ internal_error (_ ("copy_extra_ld_st: instruction decode error"));
dsc->tmp[0] = displaced_read_reg (regs, dsc, 0);
dsc->tmp[1] = displaced_read_reg (regs, dsc, 1);
@@ -6601,8 +6530,8 @@ arm_copy_extra_ld_st (struct gdbarch *gdbarch, uint32_t insn, int unprivileged,
static void
install_load_store (struct gdbarch *gdbarch, struct regcache *regs,
arm_displaced_step_copy_insn_closure *dsc, int load,
- int immed, int writeback, int size, int usermode,
- int rt, int rm, int rn)
+ int immed, int writeback, int size, int usermode, int rt,
+ int rm, int rn)
{
ULONGEST rt_val, rn_val, rm_val = 0;
@@ -6652,7 +6581,6 @@ install_load_store (struct gdbarch *gdbarch, struct regcache *regs,
dsc->cleanup = load ? &cleanup_load : &cleanup_store;
}
-
static int
thumb2_copy_load_literal (struct gdbarch *gdbarch, uint16_t insn1,
uint16_t insn2, struct regcache *regs,
@@ -6678,7 +6606,6 @@ thumb2_copy_load_literal (struct gdbarch *gdbarch, uint16_t insn1,
Cleanup: rt <- r0, r0 <- tmp[0], r2 <- tmp[1], r3 <- tmp[2]. */
-
dsc->tmp[0] = displaced_read_reg (regs, dsc, 0);
dsc->tmp[2] = displaced_read_reg (regs, dsc, 2);
dsc->tmp[3] = displaced_read_reg (regs, dsc, 3);
@@ -6715,19 +6642,18 @@ thumb2_copy_load_reg_imm (struct gdbarch *gdbarch, uint16_t insn1,
{
unsigned int rt = bits (insn2, 12, 15);
unsigned int rn = bits (insn1, 0, 3);
- unsigned int rm = bits (insn2, 0, 3); /* Only valid if !immed. */
+ unsigned int rm = bits (insn2, 0, 3); /* Only valid if !immed. */
/* In LDR (register), there is also a register Rm, which is not allowed to
be PC, so we don't have to check it. */
if (rt != ARM_PC_REGNUM && rn != ARM_PC_REGNUM)
- return thumb_copy_unmodified_32bit (gdbarch, insn1, insn2, "load",
- dsc);
+ return thumb_copy_unmodified_32bit (gdbarch, insn1, insn2, "load", dsc);
- displaced_debug_printf ("copying ldr r%d [r%d] insn %.4x%.4x",
- rt, rn, insn1, insn2);
+ displaced_debug_printf ("copying ldr r%d [r%d] insn %.4x%.4x", rt, rn, insn1,
+ insn2);
- install_load_store (gdbarch, regs, dsc, 1, immed, writeback, 4,
- 0, rt, rm, rn);
+ install_load_store (gdbarch, regs, dsc, 1, immed, writeback, 4, 0, rt, rm,
+ rn);
dsc->u.ldst.restore_r4 = 0;
@@ -6753,7 +6679,6 @@ thumb2_copy_load_reg_imm (struct gdbarch *gdbarch, uint16_t insn1,
return 0;
}
-
static int
arm_copy_ldr_str_ldrb_strb (struct gdbarch *gdbarch, uint32_t insn,
struct regcache *regs,
@@ -6764,7 +6689,7 @@ arm_copy_ldr_str_ldrb_strb (struct gdbarch *gdbarch, uint32_t insn,
int writeback = (bit (insn, 24) == 0 || bit (insn, 21) != 0);
unsigned int rt = bits (insn, 12, 15);
unsigned int rn = bits (insn, 16, 19);
- unsigned int rm = bits (insn, 0, 3); /* Only valid if !immed. */
+ unsigned int rm = bits (insn, 0, 3); /* Only valid if !immed. */
if (!insn_references_pc (insn, 0x000ff00ful))
return arm_copy_unmodified (gdbarch, insn, "load/store", dsc);
@@ -6772,9 +6697,7 @@ arm_copy_ldr_str_ldrb_strb (struct gdbarch *gdbarch, uint32_t insn,
displaced_debug_printf ("copying %s%s r%d [r%d] insn %.8lx",
load ? (size == 1 ? "ldrb" : "ldr")
: (size == 1 ? "strb" : "str"),
- usermode ? "t" : "",
- rt, rn,
- (unsigned long) insn);
+ usermode ? "t" : "", rt, rn, (unsigned long) insn);
install_load_store (gdbarch, regs, dsc, load, immed, writeback, size,
usermode, rt, rm, rn);
@@ -6798,11 +6721,11 @@ arm_copy_ldr_str_ldrb_strb (struct gdbarch *gdbarch, uint32_t insn,
{
/* We need to use r4 as scratch. Make sure it's restored afterwards. */
dsc->u.ldst.restore_r4 = 1;
- dsc->modinsn[0] = 0xe92d8000; /* push {pc} */
- dsc->modinsn[1] = 0xe8bd0010; /* pop {r4} */
- dsc->modinsn[2] = 0xe044400f; /* sub r4, r4, pc. */
- dsc->modinsn[3] = 0xe2844008; /* add r4, r4, #8. */
- dsc->modinsn[4] = 0xe0800004; /* add r0, r0, r4. */
+ dsc->modinsn[0] = 0xe92d8000; /* push {pc} */
+ dsc->modinsn[1] = 0xe8bd0010; /* pop {r4} */
+ dsc->modinsn[2] = 0xe044400f; /* sub r4, r4, pc. */
+ dsc->modinsn[3] = 0xe2844008; /* add r4, r4, #8. */
+ dsc->modinsn[4] = 0xe0800004; /* add r0, r0, r4. */
/* As above. */
if (immed)
@@ -6848,8 +6771,8 @@ cleanup_block_load_all (struct gdbarch *gdbarch, struct regcache *regs,
uint32_t regmask = dsc->u.block.regmask;
int regno = inc ? 0 : 15;
CORE_ADDR xfer_addr = dsc->u.block.xfer_addr;
- int exception_return = dsc->u.block.load && dsc->u.block.user
- && (regmask & 0x8000) != 0;
+ int exception_return
+ = dsc->u.block.load && dsc->u.block.user && (regmask & 0x8000) != 0;
uint32_t status = displaced_read_reg (regs, dsc, ARM_PS_REGNUM);
int do_transfer = condition_true (dsc->u.block.cond, status);
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
@@ -6860,7 +6783,7 @@ cleanup_block_load_all (struct gdbarch *gdbarch, struct regcache *regs,
/* If the instruction is ldm rN, {...pc}^, I don't think there's anything
sensible we can do here. Complain loudly. */
if (exception_return)
- error (_("Cannot single-step exception return"));
+ error (_ ("Cannot single-step exception return"));
/* We don't handle any stores here for now. */
gdb_assert (dsc->u.block.load != 0);
@@ -6904,8 +6827,8 @@ cleanup_block_store_pc (struct gdbarch *gdbarch, struct regcache *regs,
{
uint32_t status = displaced_read_reg (regs, dsc, ARM_PS_REGNUM);
int store_executed = condition_true (dsc->u.block.cond, status);
- CORE_ADDR pc_stored_at, transferred_regs
- = count_one_bits (dsc->u.block.regmask);
+ CORE_ADDR pc_stored_at,
+ transferred_regs = count_one_bits (dsc->u.block.regmask);
CORE_ADDR stm_insn_addr;
uint32_t pc_val;
long offset;
@@ -6920,14 +6843,14 @@ cleanup_block_store_pc (struct gdbarch *gdbarch, struct regcache *regs,
pc_stored_at = dsc->u.block.xfer_addr + 4 * transferred_regs;
if (dsc->u.block.before)
- pc_stored_at += 4;
+ pc_stored_at += 4;
}
else
{
pc_stored_at = dsc->u.block.xfer_addr;
if (dsc->u.block.before)
- pc_stored_at -= 4;
+ pc_stored_at -= 4;
}
pc_val = read_memory_unsigned_integer (pc_stored_at, 4, byte_order);
@@ -6949,8 +6872,7 @@ cleanup_block_store_pc (struct gdbarch *gdbarch, struct regcache *regs,
must undo that here. */
static void
-cleanup_block_load_pc (struct gdbarch *gdbarch,
- struct regcache *regs,
+cleanup_block_load_pc (struct gdbarch *gdbarch, struct regcache *regs,
arm_displaced_step_copy_insn_closure *dsc)
{
uint32_t status = displaced_read_reg (regs, dsc, ARM_PS_REGNUM);
@@ -6983,7 +6905,8 @@ cleanup_block_load_pc (struct gdbarch *gdbarch,
}
else
displaced_debug_printf ("LDM: register r%d already in the right "
- "place", write_reg);
+ "place",
+ write_reg);
clobbered &= ~(1 << write_reg);
@@ -7043,8 +6966,8 @@ arm_copy_block_xfer (struct gdbarch *gdbarch, uint32_t insn,
if (rn == ARM_PC_REGNUM)
{
- warning (_("displaced: Unpredictable LDM or STM with "
- "base register r15"));
+ warning (_ ("displaced: Unpredictable LDM or STM with "
+ "base register r15"));
return arm_copy_unmodified (gdbarch, insn, "unpredictable ldm/stm", dsc);
}
@@ -7137,8 +7060,8 @@ arm_copy_block_xfer (struct gdbarch *gdbarch, uint32_t insn,
}
static int
-thumb2_copy_block_xfer (struct gdbarch *gdbarch, uint16_t insn1, uint16_t insn2,
- struct regcache *regs,
+thumb2_copy_block_xfer (struct gdbarch *gdbarch, uint16_t insn1,
+ uint16_t insn2, struct regcache *regs,
arm_displaced_step_copy_insn_closure *dsc)
{
int rn = bits (insn1, 0, 3);
@@ -7152,14 +7075,14 @@ thumb2_copy_block_xfer (struct gdbarch *gdbarch, uint16_t insn1, uint16_t insn2,
if (rn == ARM_PC_REGNUM)
{
- warning (_("displaced: Unpredictable LDM or STM with "
- "base register r15"));
+ warning (_ ("displaced: Unpredictable LDM or STM with "
+ "base register r15"));
return thumb_copy_unmodified_32bit (gdbarch, insn1, insn2,
"unpredictable ldm/stm", dsc);
}
- displaced_debug_printf ("copying block transfer insn %.4x%.4x",
- insn1, insn2);
+ displaced_debug_printf ("copying block transfer insn %.4x%.4x", insn1,
+ insn2);
/* Clear bit 13, since it should be always zero. */
dsc->u.block.regmask = (insn2 & 0xdfff);
@@ -7263,12 +7186,9 @@ arm_software_single_step (struct regcache *regcache)
struct gdbarch *gdbarch = regcache->arch ();
struct arm_get_next_pcs next_pcs_ctx;
- arm_get_next_pcs_ctor (&next_pcs_ctx,
- &arm_get_next_pcs_ops,
+ arm_get_next_pcs_ctor (&next_pcs_ctx, &arm_get_next_pcs_ops,
gdbarch_byte_order (gdbarch),
- gdbarch_byte_order_for_code (gdbarch),
- 0,
- regcache);
+ gdbarch_byte_order_for_code (gdbarch), 0, regcache);
std::vector<CORE_ADDR> next_pcs = arm_get_next_pcs (&next_pcs_ctx);
@@ -7293,7 +7213,6 @@ cleanup_svc (struct gdbarch *gdbarch, struct regcache *regs,
displaced_write_reg (regs, dsc, ARM_PC_REGNUM, resume_addr, BRANCH_WRITE_PC);
}
-
/* Common copy routine for svc instruction. */
static int
@@ -7319,12 +7238,10 @@ install_svc (struct gdbarch *gdbarch, struct regcache *regs,
}
static int
-arm_copy_svc (struct gdbarch *gdbarch, uint32_t insn,
- regcache *regs, arm_displaced_step_copy_insn_closure *dsc)
+arm_copy_svc (struct gdbarch *gdbarch, uint32_t insn, regcache *regs,
+ arm_displaced_step_copy_insn_closure *dsc)
{
-
- displaced_debug_printf ("copying svc insn %.8lx",
- (unsigned long) insn);
+ displaced_debug_printf ("copying svc insn %.8lx", (unsigned long) insn);
dsc->modinsn[0] = insn;
@@ -7332,10 +7249,9 @@ arm_copy_svc (struct gdbarch *gdbarch, uint32_t insn,
}
static int
-thumb_copy_svc (struct gdbarch *gdbarch, uint16_t insn,
- regcache *regs, arm_displaced_step_copy_insn_closure *dsc)
+thumb_copy_svc (struct gdbarch *gdbarch, uint16_t insn, regcache *regs,
+ arm_displaced_step_copy_insn_closure *dsc)
{
-
displaced_debug_printf ("copying svc insn %.4x", insn);
dsc->modinsn[0] = insn;
@@ -7358,10 +7274,10 @@ arm_copy_undef (struct gdbarch *gdbarch, uint32_t insn,
}
static int
-thumb_32bit_copy_undef (struct gdbarch *gdbarch, uint16_t insn1, uint16_t insn2,
+thumb_32bit_copy_undef (struct gdbarch *gdbarch, uint16_t insn1,
+ uint16_t insn2,
arm_displaced_step_copy_insn_closure *dsc)
{
-
displaced_debug_printf ("copying undefined insn %.4x %.4x",
(unsigned short) insn1, (unsigned short) insn2);
@@ -7409,24 +7325,29 @@ arm_decode_misc_memhint_neon (struct gdbarch *gdbarch, uint32_t insn,
else if ((op1 & 0x77) == 0x41)
return arm_copy_unmodified (gdbarch, insn, "unallocated mem hint", dsc);
else if ((op1 & 0x77) == 0x45)
- return arm_copy_preload (gdbarch, insn, regs, dsc); /* pli. */
+ return arm_copy_preload (gdbarch, insn, regs, dsc); /* pli. */
else if ((op1 & 0x77) == 0x51)
{
if (rn != 0xf)
- return arm_copy_preload (gdbarch, insn, regs, dsc); /* pld/pldw. */
+ return arm_copy_preload (gdbarch, insn, regs, dsc); /* pld/pldw. */
else
return arm_copy_unpred (gdbarch, insn, dsc);
}
else if ((op1 & 0x77) == 0x55)
- return arm_copy_preload (gdbarch, insn, regs, dsc); /* pld/pldw. */
+ return arm_copy_preload (gdbarch, insn, regs, dsc); /* pld/pldw. */
else if (op1 == 0x57)
switch (op2)
{
- case 0x1: return arm_copy_unmodified (gdbarch, insn, "clrex", dsc);
- case 0x4: return arm_copy_unmodified (gdbarch, insn, "dsb", dsc);
- case 0x5: return arm_copy_unmodified (gdbarch, insn, "dmb", dsc);
- case 0x6: return arm_copy_unmodified (gdbarch, insn, "isb", dsc);
- default: return arm_copy_unpred (gdbarch, insn, dsc);
+ case 0x1:
+ return arm_copy_unmodified (gdbarch, insn, "clrex", dsc);
+ case 0x4:
+ return arm_copy_unmodified (gdbarch, insn, "dsb", dsc);
+ case 0x5:
+ return arm_copy_unmodified (gdbarch, insn, "dmb", dsc);
+ case 0x6:
+ return arm_copy_unmodified (gdbarch, insn, "isb", dsc);
+ default:
+ return arm_copy_unpred (gdbarch, insn, dsc);
}
else if ((op1 & 0x63) == 0x43)
return arm_copy_unpred (gdbarch, insn, dsc);
@@ -7434,19 +7355,24 @@ arm_decode_misc_memhint_neon (struct gdbarch *gdbarch, uint32_t insn,
switch (op1 & ~0x80)
{
case 0x61:
- return arm_copy_unmodified (gdbarch, insn, "unallocated mem hint", dsc);
+ return arm_copy_unmodified (gdbarch, insn, "unallocated mem hint",
+ dsc);
case 0x65:
- return arm_copy_preload_reg (gdbarch, insn, regs, dsc); /* pli reg. */
- case 0x71: case 0x75:
+ return arm_copy_preload_reg (gdbarch, insn, regs, dsc); /* pli reg. */
+ case 0x71:
+ case 0x75:
/* pld/pldw reg. */
return arm_copy_preload_reg (gdbarch, insn, regs, dsc);
- case 0x63: case 0x67: case 0x73: case 0x77:
+ case 0x63:
+ case 0x67:
+ case 0x73:
+ case 0x77:
return arm_copy_unpred (gdbarch, insn, dsc);
default:
return arm_copy_undef (gdbarch, insn, dsc);
}
else
- return arm_copy_undef (gdbarch, insn, dsc); /* Probably unreachable. */
+ return arm_copy_undef (gdbarch, insn, dsc); /* Probably unreachable. */
}
static int
@@ -7457,79 +7383,96 @@ arm_decode_unconditional (struct gdbarch *gdbarch, uint32_t insn,
if (bit (insn, 27) == 0)
return arm_decode_misc_memhint_neon (gdbarch, insn, regs, dsc);
/* Switch on bits: 0bxxxxx321xxx0xxxxxxxxxxxxxxxxxxxx. */
- else switch (((insn & 0x7000000) >> 23) | ((insn & 0x100000) >> 20))
- {
- case 0x0: case 0x2:
- return arm_copy_unmodified (gdbarch, insn, "srs", dsc);
-
- case 0x1: case 0x3:
- return arm_copy_unmodified (gdbarch, insn, "rfe", dsc);
-
- case 0x4: case 0x5: case 0x6: case 0x7:
- return arm_copy_b_bl_blx (gdbarch, insn, regs, dsc);
-
- case 0x8:
- switch ((insn & 0xe00000) >> 21)
- {
- case 0x1: case 0x3: case 0x4: case 0x5: case 0x6: case 0x7:
- /* stc/stc2. */
- return arm_copy_copro_load_store (gdbarch, insn, regs, dsc);
+ else
+ switch (((insn & 0x7000000) >> 23) | ((insn & 0x100000) >> 20))
+ {
+ case 0x0:
+ case 0x2:
+ return arm_copy_unmodified (gdbarch, insn, "srs", dsc);
- case 0x2:
- return arm_copy_unmodified (gdbarch, insn, "mcrr/mcrr2", dsc);
+ case 0x1:
+ case 0x3:
+ return arm_copy_unmodified (gdbarch, insn, "rfe", dsc);
- default:
- return arm_copy_undef (gdbarch, insn, dsc);
- }
+ case 0x4:
+ case 0x5:
+ case 0x6:
+ case 0x7:
+ return arm_copy_b_bl_blx (gdbarch, insn, regs, dsc);
- case 0x9:
- {
- int rn_f = (bits (insn, 16, 19) == 0xf);
+ case 0x8:
switch ((insn & 0xe00000) >> 21)
{
- case 0x1: case 0x3:
- /* ldc/ldc2 imm (undefined for rn == pc). */
- return rn_f ? arm_copy_undef (gdbarch, insn, dsc)
- : arm_copy_copro_load_store (gdbarch, insn, regs, dsc);
+ case 0x1:
+ case 0x3:
+ case 0x4:
+ case 0x5:
+ case 0x6:
+ case 0x7:
+ /* stc/stc2. */
+ return arm_copy_copro_load_store (gdbarch, insn, regs, dsc);
case 0x2:
- return arm_copy_unmodified (gdbarch, insn, "mrrc/mrrc2", dsc);
-
- case 0x4: case 0x5: case 0x6: case 0x7:
- /* ldc/ldc2 lit (undefined for rn != pc). */
- return rn_f ? arm_copy_copro_load_store (gdbarch, insn, regs, dsc)
- : arm_copy_undef (gdbarch, insn, dsc);
+ return arm_copy_unmodified (gdbarch, insn, "mcrr/mcrr2", dsc);
default:
return arm_copy_undef (gdbarch, insn, dsc);
}
- }
- case 0xa:
- return arm_copy_unmodified (gdbarch, insn, "stc/stc2", dsc);
+ case 0x9:
+ {
+ int rn_f = (bits (insn, 16, 19) == 0xf);
+ switch ((insn & 0xe00000) >> 21)
+ {
+ case 0x1:
+ case 0x3:
+ /* ldc/ldc2 imm (undefined for rn == pc). */
+ return rn_f
+ ? arm_copy_undef (gdbarch, insn, dsc)
+ : arm_copy_copro_load_store (gdbarch, insn, regs, dsc);
- case 0xb:
- if (bits (insn, 16, 19) == 0xf)
- /* ldc/ldc2 lit. */
- return arm_copy_copro_load_store (gdbarch, insn, regs, dsc);
- else
- return arm_copy_undef (gdbarch, insn, dsc);
+ case 0x2:
+ return arm_copy_unmodified (gdbarch, insn, "mrrc/mrrc2", dsc);
- case 0xc:
- if (bit (insn, 4))
- return arm_copy_unmodified (gdbarch, insn, "mcr/mcr2", dsc);
- else
- return arm_copy_unmodified (gdbarch, insn, "cdp/cdp2", dsc);
+ case 0x4:
+ case 0x5:
+ case 0x6:
+ case 0x7:
+ /* ldc/ldc2 lit (undefined for rn != pc). */
+ return rn_f
+ ? arm_copy_copro_load_store (gdbarch, insn, regs, dsc)
+ : arm_copy_undef (gdbarch, insn, dsc);
- case 0xd:
- if (bit (insn, 4))
- return arm_copy_unmodified (gdbarch, insn, "mrc/mrc2", dsc);
- else
- return arm_copy_unmodified (gdbarch, insn, "cdp/cdp2", dsc);
+ default:
+ return arm_copy_undef (gdbarch, insn, dsc);
+ }
+ }
- default:
- return arm_copy_undef (gdbarch, insn, dsc);
- }
+ case 0xa:
+ return arm_copy_unmodified (gdbarch, insn, "stc/stc2", dsc);
+
+ case 0xb:
+ if (bits (insn, 16, 19) == 0xf)
+ /* ldc/ldc2 lit. */
+ return arm_copy_copro_load_store (gdbarch, insn, regs, dsc);
+ else
+ return arm_copy_undef (gdbarch, insn, dsc);
+
+ case 0xc:
+ if (bit (insn, 4))
+ return arm_copy_unmodified (gdbarch, insn, "mcr/mcr2", dsc);
+ else
+ return arm_copy_unmodified (gdbarch, insn, "cdp/cdp2", dsc);
+
+ case 0xd:
+ if (bit (insn, 4))
+ return arm_copy_unmodified (gdbarch, insn, "mrc/mrc2", dsc);
+ else
+ return arm_copy_unmodified (gdbarch, insn, "cdp/cdp2", dsc);
+
+ default:
+ return arm_copy_undef (gdbarch, insn, dsc);
+ }
}
/* Decode miscellaneous instructions in dp/misc encoding space. */
@@ -7548,7 +7491,7 @@ arm_decode_miscellaneous (struct gdbarch *gdbarch, uint32_t insn,
return arm_copy_unmodified (gdbarch, insn, "mrs/msr", dsc);
case 0x1:
- if (op == 0x1) /* bx. */
+ if (op == 0x1) /* bx. */
return arm_copy_bx_blx_reg (gdbarch, insn, regs, dsc);
else if (op == 0x3)
return arm_copy_unmodified (gdbarch, insn, "clz", dsc);
@@ -7564,8 +7507,8 @@ arm_decode_miscellaneous (struct gdbarch *gdbarch, uint32_t insn,
case 0x3:
if (op == 0x1)
- return arm_copy_bx_blx_reg (gdbarch, insn,
- regs, dsc); /* blx register. */
+ return arm_copy_bx_blx_reg (gdbarch, insn, regs,
+ dsc); /* blx register. */
else
return arm_copy_undef (gdbarch, insn, dsc);
@@ -7599,7 +7542,8 @@ arm_decode_dp_misc (struct gdbarch *gdbarch, uint32_t insn,
case 0x14:
return arm_copy_unmodified (gdbarch, insn, "movt", dsc);
- case 0x12: case 0x16:
+ case 0x12:
+ case 0x16:
return arm_copy_unmodified (gdbarch, insn, "msr imm", dsc);
default:
@@ -7642,26 +7586,22 @@ arm_decode_ld_st_word_ubyte (struct gdbarch *gdbarch, uint32_t insn,
if ((!a && (op1 & 0x05) == 0x00 && (op1 & 0x17) != 0x02)
|| (a && (op1 & 0x05) == 0x00 && (op1 & 0x17) != 0x02 && !b))
return arm_copy_ldr_str_ldrb_strb (gdbarch, insn, regs, dsc, 0, 4, 0);
- else if ((!a && (op1 & 0x17) == 0x02)
- || (a && (op1 & 0x17) == 0x02 && !b))
+ else if ((!a && (op1 & 0x17) == 0x02) || (a && (op1 & 0x17) == 0x02 && !b))
return arm_copy_ldr_str_ldrb_strb (gdbarch, insn, regs, dsc, 0, 4, 1);
else if ((!a && (op1 & 0x05) == 0x01 && (op1 & 0x17) != 0x03)
- || (a && (op1 & 0x05) == 0x01 && (op1 & 0x17) != 0x03 && !b))
+ || (a && (op1 & 0x05) == 0x01 && (op1 & 0x17) != 0x03 && !b))
return arm_copy_ldr_str_ldrb_strb (gdbarch, insn, regs, dsc, 1, 4, 0);
- else if ((!a && (op1 & 0x17) == 0x03)
- || (a && (op1 & 0x17) == 0x03 && !b))
+ else if ((!a && (op1 & 0x17) == 0x03) || (a && (op1 & 0x17) == 0x03 && !b))
return arm_copy_ldr_str_ldrb_strb (gdbarch, insn, regs, dsc, 1, 4, 1);
else if ((!a && (op1 & 0x05) == 0x04 && (op1 & 0x17) != 0x06)
- || (a && (op1 & 0x05) == 0x04 && (op1 & 0x17) != 0x06 && !b))
+ || (a && (op1 & 0x05) == 0x04 && (op1 & 0x17) != 0x06 && !b))
return arm_copy_ldr_str_ldrb_strb (gdbarch, insn, regs, dsc, 0, 1, 0);
- else if ((!a && (op1 & 0x17) == 0x06)
- || (a && (op1 & 0x17) == 0x06 && !b))
+ else if ((!a && (op1 & 0x17) == 0x06) || (a && (op1 & 0x17) == 0x06 && !b))
return arm_copy_ldr_str_ldrb_strb (gdbarch, insn, regs, dsc, 0, 1, 1);
else if ((!a && (op1 & 0x05) == 0x05 && (op1 & 0x17) != 0x07)
|| (a && (op1 & 0x05) == 0x05 && (op1 & 0x17) != 0x07 && !b))
return arm_copy_ldr_str_ldrb_strb (gdbarch, insn, regs, dsc, 1, 1, 0);
- else if ((!a && (op1 & 0x17) == 0x07)
- || (a && (op1 & 0x17) == 0x07 && !b))
+ else if ((!a && (op1 & 0x17) == 0x07) || (a && (op1 & 0x17) == 0x07 && !b))
return arm_copy_ldr_str_ldrb_strb (gdbarch, insn, regs, dsc, 1, 1, 1);
/* Should be unreachable. */
@@ -7674,37 +7614,53 @@ arm_decode_media (struct gdbarch *gdbarch, uint32_t insn,
{
switch (bits (insn, 20, 24))
{
- case 0x00: case 0x01: case 0x02: case 0x03:
- return arm_copy_unmodified (gdbarch, insn, "parallel add/sub signed", dsc);
-
- case 0x04: case 0x05: case 0x06: case 0x07:
- return arm_copy_unmodified (gdbarch, insn, "parallel add/sub unsigned", dsc);
-
- case 0x08: case 0x09: case 0x0a: case 0x0b:
- case 0x0c: case 0x0d: case 0x0e: case 0x0f:
+ case 0x00:
+ case 0x01:
+ case 0x02:
+ case 0x03:
+ return arm_copy_unmodified (gdbarch, insn, "parallel add/sub signed",
+ dsc);
+
+ case 0x04:
+ case 0x05:
+ case 0x06:
+ case 0x07:
+ return arm_copy_unmodified (gdbarch, insn, "parallel add/sub unsigned",
+ dsc);
+
+ case 0x08:
+ case 0x09:
+ case 0x0a:
+ case 0x0b:
+ case 0x0c:
+ case 0x0d:
+ case 0x0e:
+ case 0x0f:
return arm_copy_unmodified (gdbarch, insn,
- "decode/pack/unpack/saturate/reverse", dsc);
+ "decode/pack/unpack/saturate/reverse", dsc);
case 0x18:
- if (bits (insn, 5, 7) == 0) /* op2. */
- {
+ if (bits (insn, 5, 7) == 0) /* op2. */
+ {
if (bits (insn, 12, 15) == 0xf)
return arm_copy_unmodified (gdbarch, insn, "usad8", dsc);
else
return arm_copy_unmodified (gdbarch, insn, "usada8", dsc);
}
else
- return arm_copy_undef (gdbarch, insn, dsc);
+ return arm_copy_undef (gdbarch, insn, dsc);
- case 0x1a: case 0x1b:
- if (bits (insn, 5, 6) == 0x2) /* op2[1:0]. */
+ case 0x1a:
+ case 0x1b:
+ if (bits (insn, 5, 6) == 0x2) /* op2[1:0]. */
return arm_copy_unmodified (gdbarch, insn, "sbfx", dsc);
else
return arm_copy_undef (gdbarch, insn, dsc);
- case 0x1c: case 0x1d:
- if (bits (insn, 5, 6) == 0x0) /* op2[1:0]. */
- {
+ case 0x1c:
+ case 0x1d:
+ if (bits (insn, 5, 6) == 0x0) /* op2[1:0]. */
+ {
if (bits (insn, 0, 3) == 0xf)
return arm_copy_unmodified (gdbarch, insn, "bfc", dsc);
else
@@ -7713,8 +7669,9 @@ arm_decode_media (struct gdbarch *gdbarch, uint32_t insn,
else
return arm_copy_undef (gdbarch, insn, dsc);
- case 0x1e: case 0x1f:
- if (bits (insn, 5, 6) == 0x2) /* op2[1:0]. */
+ case 0x1e:
+ case 0x1f:
+ if (bits (insn, 5, 6) == 0x2) /* op2[1:0]. */
return arm_copy_unmodified (gdbarch, insn, "ubfx", dsc);
else
return arm_copy_undef (gdbarch, insn, dsc);
@@ -7744,19 +7701,34 @@ arm_decode_ext_reg_ld_st (struct gdbarch *gdbarch, uint32_t insn,
switch (opcode)
{
- case 0x04: case 0x05: /* VFP/Neon mrrc/mcrr. */
+ case 0x04:
+ case 0x05: /* VFP/Neon mrrc/mcrr. */
return arm_copy_unmodified (gdbarch, insn, "vfp/neon mrrc/mcrr", dsc);
- case 0x08: case 0x0a: case 0x0c: case 0x0e:
- case 0x12: case 0x16:
+ case 0x08:
+ case 0x0a:
+ case 0x0c:
+ case 0x0e:
+ case 0x12:
+ case 0x16:
return arm_copy_unmodified (gdbarch, insn, "vfp/neon vstm/vpush", dsc);
- case 0x09: case 0x0b: case 0x0d: case 0x0f:
- case 0x13: case 0x17:
+ case 0x09:
+ case 0x0b:
+ case 0x0d:
+ case 0x0f:
+ case 0x13:
+ case 0x17:
return arm_copy_unmodified (gdbarch, insn, "vfp/neon vldm/vpop", dsc);
- case 0x10: case 0x14: case 0x18: case 0x1c: /* vstr. */
- case 0x11: case 0x15: case 0x19: case 0x1d: /* vldr. */
+ case 0x10:
+ case 0x14:
+ case 0x18:
+ case 0x1c: /* vstr. */
+ case 0x11:
+ case 0x15:
+ case 0x19:
+ case 0x1d: /* vldr. */
/* Note: no writeback for these instructions. Bit 25 will always be
zero though (via caller), so the following works OK. */
return arm_copy_copro_load_store (gdbarch, insn, regs, dsc);
@@ -7770,7 +7742,7 @@ arm_decode_ext_reg_ld_st (struct gdbarch *gdbarch, uint32_t insn,
static int
thumb2_decode_dp_shift_reg (struct gdbarch *gdbarch, uint16_t insn1,
- uint16_t insn2, struct regcache *regs,
+ uint16_t insn2, struct regcache *regs,
arm_displaced_step_copy_insn_closure *dsc)
{
/* PC is only allowed to be used in instruction MOV. */
@@ -7785,39 +7757,50 @@ thumb2_decode_dp_shift_reg (struct gdbarch *gdbarch, uint16_t insn1,
"dp (shift reg)", dsc);
}
-
/* Decode extension register load/store. Exactly the same as
arm_decode_ext_reg_ld_st. */
static int
thumb2_decode_ext_reg_ld_st (struct gdbarch *gdbarch, uint16_t insn1,
- uint16_t insn2, struct regcache *regs,
+ uint16_t insn2, struct regcache *regs,
arm_displaced_step_copy_insn_closure *dsc)
{
unsigned int opcode = bits (insn1, 4, 8);
switch (opcode)
{
- case 0x04: case 0x05:
+ case 0x04:
+ case 0x05:
return thumb_copy_unmodified_32bit (gdbarch, insn1, insn2,
"vfp/neon vmov", dsc);
- case 0x08: case 0x0c: /* 01x00 */
- case 0x0a: case 0x0e: /* 01x10 */
- case 0x12: case 0x16: /* 10x10 */
+ case 0x08:
+ case 0x0c: /* 01x00 */
+ case 0x0a:
+ case 0x0e: /* 01x10 */
+ case 0x12:
+ case 0x16: /* 10x10 */
return thumb_copy_unmodified_32bit (gdbarch, insn1, insn2,
"vfp/neon vstm/vpush", dsc);
- case 0x09: case 0x0d: /* 01x01 */
- case 0x0b: case 0x0f: /* 01x11 */
- case 0x13: case 0x17: /* 10x11 */
+ case 0x09:
+ case 0x0d: /* 01x01 */
+ case 0x0b:
+ case 0x0f: /* 01x11 */
+ case 0x13:
+ case 0x17: /* 10x11 */
return thumb_copy_unmodified_32bit (gdbarch, insn1, insn2,
"vfp/neon vldm/vpop", dsc);
- case 0x10: case 0x14: case 0x18: case 0x1c: /* vstr. */
- return thumb_copy_unmodified_32bit (gdbarch, insn1, insn2,
- "vstr", dsc);
- case 0x11: case 0x15: case 0x19: case 0x1d: /* vldr. */
+ case 0x10:
+ case 0x14:
+ case 0x18:
+ case 0x1c: /* vstr. */
+ return thumb_copy_unmodified_32bit (gdbarch, insn1, insn2, "vstr", dsc);
+ case 0x11:
+ case 0x15:
+ case 0x19:
+ case 0x1d: /* vldr. */
return thumb2_copy_copro_load_store (gdbarch, insn1, insn2, regs, dsc);
}
@@ -7826,8 +7809,8 @@ thumb2_decode_ext_reg_ld_st (struct gdbarch *gdbarch, uint16_t insn1,
}
static int
-arm_decode_svc_copro (struct gdbarch *gdbarch, uint32_t insn,
- regcache *regs, arm_displaced_step_copy_insn_closure *dsc)
+arm_decode_svc_copro (struct gdbarch *gdbarch, uint32_t insn, regcache *regs,
+ arm_displaced_step_copy_insn_closure *dsc)
{
unsigned int op1 = bits (insn, 20, 25);
int op = bit (insn, 4);
@@ -7867,7 +7850,7 @@ arm_decode_svc_copro (struct gdbarch *gdbarch, uint32_t insn,
else if ((op1 & 0x30) == 0x30)
return arm_copy_svc (gdbarch, insn, regs, dsc);
else
- return arm_copy_undef (gdbarch, insn, dsc); /* Possibly unreachable. */
+ return arm_copy_undef (gdbarch, insn, dsc); /* Possibly unreachable. */
}
static int
@@ -7883,14 +7866,13 @@ thumb2_decode_svc_copro (struct gdbarch *gdbarch, uint16_t insn1,
if (bit_9 == 0)
{
if (bit_5_8 == 2)
- return thumb_copy_unmodified_32bit (gdbarch, insn1, insn2,
- "neon 64bit xfer/mrrc/mrrc2/mcrr/mcrr2",
- dsc);
+ return thumb_copy_unmodified_32bit (
+ gdbarch, insn1, insn2, "neon 64bit xfer/mrrc/mrrc2/mcrr/mcrr2", dsc);
else if (bit_5_8 == 0) /* UNDEFINED. */
return thumb_32bit_copy_undef (gdbarch, insn1, insn2, dsc);
else
{
- /*coproc is 101x. SIMD/VFP, ext registers load/store. */
+ /*coproc is 101x. SIMD/VFP, ext registers load/store. */
if ((coproc & 0xe) == 0xa)
return thumb2_decode_ext_reg_ld_st (gdbarch, insn1, insn2, regs,
dsc);
@@ -7934,7 +7916,6 @@ thumb_copy_pc_relative_16bit (struct gdbarch *gdbarch, struct regcache *regs,
arm_displaced_step_copy_insn_closure *dsc,
int rd, unsigned int imm)
{
-
/* Encoding T2: ADDS Rd, #imm */
dsc->modinsn[0] = (0x3000 | (rd << 8) | imm);
@@ -7951,8 +7932,8 @@ thumb_decode_pc_relative_16bit (struct gdbarch *gdbarch, uint16_t insn,
unsigned int rd = bits (insn, 8, 10);
unsigned int imm8 = bits (insn, 0, 7);
- displaced_debug_printf ("copying thumb adr r%d, #%d insn %.4x",
- rd, imm8, insn);
+ displaced_debug_printf ("copying thumb adr r%d, #%d insn %.4x", rd, imm8,
+ insn);
return thumb_copy_pc_relative_16bit (gdbarch, regs, dsc, rd, imm8);
}
@@ -7970,8 +7951,8 @@ thumb_copy_pc_relative_32bit (struct gdbarch *gdbarch, uint16_t insn1,
unsigned int imm_3_8 = insn2 & 0x70ff;
unsigned int imm_i = insn1 & 0x0400; /* Clear all bits except bit 10. */
- displaced_debug_printf ("copying thumb adr r%d, #%d:%d insn %.4x%.4x",
- rd, imm_i, imm_3_8, insn1, insn2);
+ displaced_debug_printf ("copying thumb adr r%d, #%d:%d insn %.4x%.4x", rd,
+ imm_i, imm_3_8, insn1, insn2);
if (bit (insn1, 7)) /* Encoding T2 */
{
@@ -8060,14 +8041,14 @@ thumb_copy_cbnz_cbz (struct gdbarch *gdbarch, uint16_t insn1,
dsc->u.branch.dest = from + 4 + imm5;
}
else
- dsc->u.branch.dest = from + 2;
+ dsc->u.branch.dest = from + 2;
dsc->u.branch.link = 0;
dsc->u.branch.exchange = 0;
displaced_debug_printf ("copying %s [r%d = 0x%x] insn %.4x to %.8lx",
- non_zero ? "cbnz" : "cbz",
- rn, rn_val, insn1, dsc->u.branch.dest);
+ non_zero ? "cbnz" : "cbz", rn, rn_val, insn1,
+ dsc->u.branch.dest);
dsc->modinsn[0] = THUMB_NOP;
@@ -8105,9 +8086,8 @@ thumb2_copy_table_branch (struct gdbarch *gdbarch, uint16_t insn1,
}
displaced_debug_printf ("%s base 0x%x offset 0x%x offset 0x%x",
- is_tbh ? "tbh" : "tbb",
- (unsigned int) rn_val, (unsigned int) rm_val,
- (unsigned int) halfwords);
+ is_tbh ? "tbh" : "tbb", (unsigned int) rn_val,
+ (unsigned int) rm_val, (unsigned int) halfwords);
dsc->u.branch.cond = INST_AL;
dsc->u.branch.link = 0;
@@ -8133,7 +8113,6 @@ cleanup_pop_pc_16bit_all (struct gdbarch *gdbarch, struct regcache *regs,
/* r8 <- tmp[0] */
displaced_write_reg (regs, dsc, 8, dsc->tmp[0], CANNOT_WRITE_PC);
-
}
static int
@@ -8172,8 +8151,8 @@ thumb_copy_pop_pc_16bit (struct gdbarch *gdbarch, uint16_t insn1,
dsc->tmp[0] = displaced_read_reg (regs, dsc, 8);
dsc->modinsn[0] = (insn1 & 0xfeff); /* POP {r0,r1,...,r6, r7} */
- dsc->modinsn[1] = 0x46b8; /* MOV r8, r7 */
- dsc->modinsn[2] = 0xbc80; /* POP {r7} */
+ dsc->modinsn[1] = 0x46b8; /* MOV r8, r7 */
+ dsc->modinsn[2] = 0xbc80; /* POP {r7} */
dsc->numinsns = 3;
dsc->cleanup = &cleanup_pop_pc_16bit_all;
@@ -8218,17 +8197,18 @@ thumb_process_displaced_16bit_insn (struct gdbarch *gdbarch, uint16_t insn1,
switch (op_bit_12_15)
{
/* Shift (imme), add, subtract, move and compare. */
- case 0: case 1: case 2: case 3:
+ case 0:
+ case 1:
+ case 2:
+ case 3:
err = thumb_copy_unmodified_16bit (gdbarch, insn1,
- "shift/add/sub/mov/cmp",
- dsc);
+ "shift/add/sub/mov/cmp", dsc);
break;
case 4:
switch (op_bit_10_11)
{
case 0: /* Data-processing */
- err = thumb_copy_unmodified_16bit (gdbarch, insn1,
- "data-processing",
+ err = thumb_copy_unmodified_16bit (gdbarch, insn1, "data-processing",
dsc);
break;
case 1: /* Special data instructions and branch and exchange. */
@@ -8236,18 +8216,23 @@ thumb_process_displaced_16bit_insn (struct gdbarch *gdbarch, uint16_t insn1,
unsigned short op = bits (insn1, 7, 9);
if (op == 6 || op == 7) /* BX or BLX */
err = thumb_copy_bx_blx_reg (gdbarch, insn1, regs, dsc);
- else if (bits (insn1, 6, 7) != 0) /* ADD/MOV/CMP high registers. */
+ else if (bits (insn1, 6, 7)
+ != 0) /* ADD/MOV/CMP high registers. */
err = thumb_copy_alu_reg (gdbarch, insn1, regs, dsc);
else
- err = thumb_copy_unmodified_16bit (gdbarch, insn1, "special data",
- dsc);
+ err = thumb_copy_unmodified_16bit (gdbarch, insn1,
+ "special data", dsc);
}
break;
default: /* LDR (literal) */
err = thumb_copy_16bit_ldr_literal (gdbarch, insn1, regs, dsc);
}
break;
- case 5: case 6: case 7: case 8: case 9: /* Load/Store single data item */
+ case 5:
+ case 6:
+ case 7:
+ case 8:
+ case 9: /* Load/Store single data item */
err = thumb_copy_unmodified_16bit (gdbarch, insn1, "ldr/str", dsc);
break;
case 10:
@@ -8260,10 +8245,14 @@ thumb_process_displaced_16bit_insn (struct gdbarch *gdbarch, uint16_t insn1,
{
switch (bits (insn1, 8, 11))
{
- case 1: case 3: case 9: case 11: /* CBNZ, CBZ */
+ case 1:
+ case 3:
+ case 9:
+ case 11: /* CBNZ, CBZ */
err = thumb_copy_cbnz_cbz (gdbarch, insn1, regs, dsc);
break;
- case 12: case 13: /* POP */
+ case 12:
+ case 13: /* POP */
if (bit (insn1, 8)) /* PC is in register list. */
err = thumb_copy_pop_pc_16bit (gdbarch, insn1, regs, dsc);
else
@@ -8274,8 +8263,8 @@ thumb_process_displaced_16bit_insn (struct gdbarch *gdbarch, uint16_t insn1,
/* If-Then makes up to four following instructions conditional.
IT instruction itself is not conditional, so handle it as a
common unmodified instruction. */
- err = thumb_copy_unmodified_16bit (gdbarch, insn1, "If-Then",
- dsc);
+ err
+ = thumb_copy_unmodified_16bit (gdbarch, insn1, "If-Then", dsc);
else
err = thumb_copy_unmodified_16bit (gdbarch, insn1, "hints", dsc);
break;
@@ -8304,13 +8293,13 @@ thumb_process_displaced_16bit_insn (struct gdbarch *gdbarch, uint16_t insn1,
}
if (err)
- internal_error (_("thumb_process_displaced_16bit_insn: Instruction decode error"));
+ internal_error (
+ _ ("thumb_process_displaced_16bit_insn: Instruction decode error"));
}
static int
-decode_thumb_32bit_ld_mem_hints (struct gdbarch *gdbarch,
- uint16_t insn1, uint16_t insn2,
- struct regcache *regs,
+decode_thumb_32bit_ld_mem_hints (struct gdbarch *gdbarch, uint16_t insn1,
+ uint16_t insn2, struct regcache *regs,
arm_displaced_step_copy_insn_closure *dsc)
{
int rt = bits (insn2, 12, 15);
@@ -8319,7 +8308,7 @@ decode_thumb_32bit_ld_mem_hints (struct gdbarch *gdbarch,
switch (bits (insn1, 5, 6))
{
- case 0: /* Load byte and memory hints */
+ case 0: /* Load byte and memory hints */
if (rt == 0xf) /* PLD/PLI */
{
if (rn == 0xf)
@@ -8341,7 +8330,7 @@ decode_thumb_32bit_ld_mem_hints (struct gdbarch *gdbarch,
}
break;
- case 1: /* Load halfword and memory hints. */
+ case 1: /* Load halfword and memory hints. */
if (rt == 0xf) /* PLD{W} and Unalloc memory hint. */
return thumb_copy_unmodified_32bit (gdbarch, insn1, insn2,
"pld/unalloc memhint", dsc);
@@ -8360,10 +8349,11 @@ decode_thumb_32bit_ld_mem_hints (struct gdbarch *gdbarch,
int insn2_bit_8_11 = bits (insn2, 8, 11);
if (rn == 0xf)
- return thumb2_copy_load_literal (gdbarch, insn1, insn2, regs, dsc, 4);
+ return thumb2_copy_load_literal (gdbarch, insn1, insn2, regs, dsc,
+ 4);
else if (op1 == 0x1) /* Encoding T3 */
- return thumb2_copy_load_reg_imm (gdbarch, insn1, insn2, regs, dsc,
- 0, 1);
+ return thumb2_copy_load_reg_imm (gdbarch, insn1, insn2, regs, dsc, 0,
+ 1);
else /* op1 == 0x0 */
{
if (insn2_bit_8_11 == 0xc || (insn2_bit_8_11 & 0x9) == 0x9)
@@ -8413,19 +8403,23 @@ thumb_process_displaced_32bit_insn (struct gdbarch *gdbarch, uint16_t insn1,
else
/* PC is not allowed to use in load/store {dual, exclusive}
instructions. */
- err = thumb_copy_unmodified_32bit (gdbarch, insn1, insn2,
- "load/store dual/ex", dsc);
+ err
+ = thumb_copy_unmodified_32bit (gdbarch, insn1, insn2,
+ "load/store dual/ex", dsc);
}
else /* load/store multiple */
{
switch (bits (insn1, 7, 8))
{
- case 0: case 3: /* SRS, RFE */
+ case 0:
+ case 3: /* SRS, RFE */
err = thumb_copy_unmodified_32bit (gdbarch, insn1, insn2,
"srs/rfe", dsc);
break;
- case 1: case 2: /* LDM/STM/PUSH/POP */
- err = thumb2_copy_block_xfer (gdbarch, insn1, insn2, regs, dsc);
+ case 1:
+ case 2: /* LDM/STM/PUSH/POP */
+ err = thumb2_copy_block_xfer (gdbarch, insn1, insn2, regs,
+ dsc);
break;
}
}
@@ -8433,20 +8427,20 @@ thumb_process_displaced_32bit_insn (struct gdbarch *gdbarch, uint16_t insn1,
case 1:
/* Data-processing (shift register). */
- err = thumb2_decode_dp_shift_reg (gdbarch, insn1, insn2, regs,
- dsc);
+ err
+ = thumb2_decode_dp_shift_reg (gdbarch, insn1, insn2, regs, dsc);
break;
default: /* Coprocessor instructions. */
err = thumb2_decode_svc_copro (gdbarch, insn1, insn2, regs, dsc);
break;
}
- break;
+ break;
}
- case 2: /* op1 = 2 */
+ case 2: /* op1 = 2 */
if (op) /* Branch and misc control. */
{
- if (bit (insn2, 14) /* BLX/BL */
- || bit (insn2, 12) /* Unconditional branch */
+ if (bit (insn2, 14) /* BLX/BL */
+ || bit (insn2, 12) /* Unconditional branch */
|| (bits (insn1, 7, 9) != 0x7)) /* Conditional branch */
err = thumb2_copy_b_bl_blx (gdbarch, insn1, insn2, regs, dsc);
else
@@ -8467,8 +8461,8 @@ thumb_process_displaced_32bit_insn (struct gdbarch *gdbarch, uint16_t insn1,
"dp/pb", dsc);
}
else /* Data processing (modified immediate) */
- err = thumb_copy_unmodified_32bit (gdbarch, insn1, insn2,
- "dp/mi", dsc);
+ err = thumb_copy_unmodified_32bit (gdbarch, insn1, insn2, "dp/mi",
+ dsc);
}
break;
case 3: /* op1 = 3 */
@@ -8476,8 +8470,8 @@ thumb_process_displaced_32bit_insn (struct gdbarch *gdbarch, uint16_t insn1,
{
case 0:
if (bit (insn1, 4))
- err = decode_thumb_32bit_ld_mem_hints (gdbarch, insn1, insn2,
- regs, dsc);
+ err = decode_thumb_32bit_ld_mem_hints (gdbarch, insn1, insn2, regs,
+ dsc);
else /* NEON Load/Store and Store single data item */
err = thumb_copy_unmodified_32bit (gdbarch, insn1, insn2,
"neon elt/struct load/store",
@@ -8486,7 +8480,8 @@ thumb_process_displaced_32bit_insn (struct gdbarch *gdbarch, uint16_t insn1,
case 1: /* op1 = 3, bits (9, 10) == 1 */
switch (bits (insn1, 7, 8))
{
- case 0: case 1: /* Data processing (register) */
+ case 0:
+ case 1: /* Data processing (register) */
err = thumb_copy_unmodified_32bit (gdbarch, insn1, insn2,
"dp(reg)", dsc);
break;
@@ -8510,8 +8505,8 @@ thumb_process_displaced_32bit_insn (struct gdbarch *gdbarch, uint16_t insn1,
}
if (err)
- internal_error (_("thumb_process_displaced_32bit_insn: Instruction decode error"));
-
+ internal_error (
+ _ ("thumb_process_displaced_32bit_insn: Instruction decode error"));
}
static void
@@ -8520,11 +8515,10 @@ thumb_process_displaced_insn (struct gdbarch *gdbarch, CORE_ADDR from,
arm_displaced_step_copy_insn_closure *dsc)
{
enum bfd_endian byte_order_for_code = gdbarch_byte_order_for_code (gdbarch);
- uint16_t insn1
- = read_memory_unsigned_integer (from, 2, byte_order_for_code);
+ uint16_t insn1 = read_memory_unsigned_integer (from, 2, byte_order_for_code);
- displaced_debug_printf ("process thumb insn %.4x at %.8lx",
- insn1, (unsigned long) from);
+ displaced_debug_printf ("process thumb insn %.4x at %.8lx", insn1,
+ (unsigned long) from);
dsc->is_thumb = 1;
dsc->insn_size = thumb_insn_size (insn1);
@@ -8561,36 +8555,49 @@ arm_process_displaced_insn (struct gdbarch *gdbarch, CORE_ADDR from,
dsc->is_thumb = 0;
dsc->insn_size = 4;
insn = read_memory_unsigned_integer (from, 4, byte_order_for_code);
- displaced_debug_printf ("stepping insn %.8lx at %.8lx",
- (unsigned long) insn, (unsigned long) from);
+ displaced_debug_printf ("stepping insn %.8lx at %.8lx", (unsigned long) insn,
+ (unsigned long) from);
if ((insn & 0xf0000000) == 0xf0000000)
err = arm_decode_unconditional (gdbarch, insn, regs, dsc);
- else switch (((insn & 0x10) >> 4) | ((insn & 0xe000000) >> 24))
- {
- case 0x0: case 0x1: case 0x2: case 0x3:
- err = arm_decode_dp_misc (gdbarch, insn, regs, dsc);
- break;
+ else
+ switch (((insn & 0x10) >> 4) | ((insn & 0xe000000) >> 24))
+ {
+ case 0x0:
+ case 0x1:
+ case 0x2:
+ case 0x3:
+ err = arm_decode_dp_misc (gdbarch, insn, regs, dsc);
+ break;
- case 0x4: case 0x5: case 0x6:
- err = arm_decode_ld_st_word_ubyte (gdbarch, insn, regs, dsc);
- break;
+ case 0x4:
+ case 0x5:
+ case 0x6:
+ err = arm_decode_ld_st_word_ubyte (gdbarch, insn, regs, dsc);
+ break;
- case 0x7:
- err = arm_decode_media (gdbarch, insn, dsc);
- break;
+ case 0x7:
+ err = arm_decode_media (gdbarch, insn, dsc);
+ break;
- case 0x8: case 0x9: case 0xa: case 0xb:
- err = arm_decode_b_bl_ldmstm (gdbarch, insn, regs, dsc);
- break;
+ case 0x8:
+ case 0x9:
+ case 0xa:
+ case 0xb:
+ err = arm_decode_b_bl_ldmstm (gdbarch, insn, regs, dsc);
+ break;
- case 0xc: case 0xd: case 0xe: case 0xf:
- err = arm_decode_svc_copro (gdbarch, insn, regs, dsc);
- break;
- }
+ case 0xc:
+ case 0xd:
+ case 0xe:
+ case 0xf:
+ err = arm_decode_svc_copro (gdbarch, insn, regs, dsc);
+ break;
+ }
if (err)
- internal_error (_("arm_process_displaced_insn: Instruction decode error"));
+ internal_error (
+ _ ("arm_process_displaced_insn: Instruction decode error"));
}
/* Actually set up the scratch space for a displaced instruction. */
@@ -8603,7 +8610,7 @@ arm_displaced_init_closure (struct gdbarch *gdbarch, CORE_ADDR from,
arm_gdbarch_tdep *tdep = gdbarch_tdep<arm_gdbarch_tdep> (gdbarch);
unsigned int i, len, offset;
enum bfd_endian byte_order_for_code = gdbarch_byte_order_for_code (gdbarch);
- int size = dsc->is_thumb? 2 : 4;
+ int size = dsc->is_thumb ? 2 : 4;
const gdb_byte *bkp_insn;
offset = 0;
@@ -8611,15 +8618,14 @@ arm_displaced_init_closure (struct gdbarch *gdbarch, CORE_ADDR from,
for (i = 0; i < dsc->numinsns; i++)
{
if (size == 4)
- displaced_debug_printf ("writing insn %.8lx at %.8lx",
- dsc->modinsn[i], (unsigned long) to + offset);
+ displaced_debug_printf ("writing insn %.8lx at %.8lx", dsc->modinsn[i],
+ (unsigned long) to + offset);
else if (size == 2)
displaced_debug_printf ("writing insn %.4x at %.8lx",
(unsigned short) dsc->modinsn[i],
(unsigned long) to + offset);
- write_memory_unsigned_integer (to + offset, size,
- byte_order_for_code,
+ write_memory_unsigned_integer (to + offset, size, byte_order_for_code,
dsc->modinsn[i]);
offset += size;
}
@@ -8649,8 +8655,7 @@ arm_displaced_init_closure (struct gdbarch *gdbarch, CORE_ADDR from,
void
arm_displaced_step_fixup (struct gdbarch *gdbarch,
struct displaced_step_copy_insn_closure *dsc_,
- CORE_ADDR from, CORE_ADDR to,
- struct regcache *regs)
+ CORE_ADDR from, CORE_ADDR to, struct regcache *regs)
{
arm_displaced_step_copy_insn_closure *dsc
= (arm_displaced_step_copy_insn_closure *) dsc_;
@@ -8661,7 +8666,6 @@ arm_displaced_step_fixup (struct gdbarch *gdbarch,
if (!dsc->wrote_to_pc)
regcache_cooked_write_unsigned (regs, ARM_PC_REGNUM,
dsc->insn_addr + dsc->insn_size);
-
}
#include "bfd-in2.h"
@@ -8696,7 +8700,7 @@ gdb_print_insn_arm (bfd_vma memaddr, disassemble_info *info)
csym.native = &ce;
csym.symbol.the_bfd = &fake_bfd;
csym.symbol.name = "fake";
- asym = (asymbol *) & csym;
+ asym = (asymbol *) &csym;
}
memaddr = UNMAKE_THUMB_ADDR (memaddr);
@@ -8748,10 +8752,22 @@ gdb_print_insn_arm (bfd_vma memaddr, disassemble_info *info)
instruction to force a trap. This can be handled by by the
abi-specific code during establishment of the gdbarch vector. */
-#define ARM_LE_BREAKPOINT {0xFE,0xDE,0xFF,0xE7}
-#define ARM_BE_BREAKPOINT {0xE7,0xFF,0xDE,0xFE}
-#define THUMB_LE_BREAKPOINT {0xbe,0xbe}
-#define THUMB_BE_BREAKPOINT {0xbe,0xbe}
+#define ARM_LE_BREAKPOINT \
+ { \
+ 0xFE, 0xDE, 0xFF, 0xE7 \
+ }
+#define ARM_BE_BREAKPOINT \
+ { \
+ 0xE7, 0xFF, 0xDE, 0xFE \
+ }
+#define THUMB_LE_BREAKPOINT \
+ { \
+ 0xbe, 0xbe \
+ }
+#define THUMB_BE_BREAKPOINT \
+ { \
+ 0xbe, 0xbe \
+ }
static const gdb_byte arm_default_arm_le_breakpoint[] = ARM_LE_BREAKPOINT;
static const gdb_byte arm_default_arm_be_breakpoint[] = ARM_BE_BREAKPOINT;
@@ -8790,7 +8806,6 @@ arm_breakpoint_kind_from_pc (struct gdbarch *gdbarch, CORE_ADDR *pcptr)
}
else
return ARM_BP_KIND_ARM;
-
}
/* Implement the sw_breakpoint_from_kind gdbarch method. */
@@ -8830,11 +8845,9 @@ arm_breakpoint_kind_from_current_state (struct gdbarch *gdbarch,
{
struct arm_get_next_pcs next_pcs_ctx;
- arm_get_next_pcs_ctor (&next_pcs_ctx,
- &arm_get_next_pcs_ops,
+ arm_get_next_pcs_ctor (&next_pcs_ctx, &arm_get_next_pcs_ops,
gdbarch_byte_order (gdbarch),
- gdbarch_byte_order_for_code (gdbarch),
- 0,
+ gdbarch_byte_order_for_code (gdbarch), 0,
regcache);
std::vector<CORE_ADDR> next_pcs = arm_get_next_pcs (&next_pcs_ctx);
@@ -8884,8 +8897,8 @@ arm_extract_return_value (struct type *type, struct regcache *regs,
bfd_byte tmpbuf[ARM_FP_REGISTER_SIZE];
regs->cooked_read (ARM_F0_REGNUM, tmpbuf);
- target_float_convert (tmpbuf, arm_ext_type (gdbarch),
- valbuf, type);
+ target_float_convert (tmpbuf, arm_ext_type (gdbarch), valbuf,
+ type);
}
break;
@@ -8901,17 +8914,14 @@ arm_extract_return_value (struct type *type, struct regcache *regs,
break;
default:
- internal_error (_("arm_extract_return_value: "
- "Floating point model not supported"));
+ internal_error (_ ("arm_extract_return_value: "
+ "Floating point model not supported"));
break;
}
}
- else if (type->code () == TYPE_CODE_INT
- || type->code () == TYPE_CODE_CHAR
- || type->code () == TYPE_CODE_BOOL
- || type->code () == TYPE_CODE_PTR
- || TYPE_IS_REFERENCE (type)
- || type->code () == TYPE_CODE_ENUM
+ else if (type->code () == TYPE_CODE_INT || type->code () == TYPE_CODE_CHAR
+ || type->code () == TYPE_CODE_BOOL || type->code () == TYPE_CODE_PTR
+ || TYPE_IS_REFERENCE (type) || type->code () == TYPE_CODE_ENUM
|| is_fixed_point_type (type))
{
/* If the type is a plain integer, then the access is
@@ -8926,9 +8936,10 @@ arm_extract_return_value (struct type *type, struct regcache *regs,
/* By using store_unsigned_integer we avoid having to do
anything special for small big-endian values. */
regcache_cooked_read_unsigned (regs, regno++, &tmp);
- store_unsigned_integer (valbuf,
+ store_unsigned_integer (valbuf,
(len > ARM_INT_REGISTER_SIZE
- ? ARM_INT_REGISTER_SIZE : len),
+ ? ARM_INT_REGISTER_SIZE
+ : len),
byte_order, tmp);
len -= ARM_INT_REGISTER_SIZE;
valbuf += ARM_INT_REGISTER_SIZE;
@@ -8954,7 +8965,6 @@ arm_extract_return_value (struct type *type, struct regcache *regs,
}
}
-
/* Will a function return an aggregate type in memory or in a
register? Return 0 if an aggregate type can be returned in a
register, 1 if it must be returned in memory. */
@@ -9111,17 +9121,14 @@ arm_store_return_value (struct type *type, struct regcache *regs,
break;
default:
- internal_error (_("arm_store_return_value: Floating "
- "point model not supported"));
+ internal_error (_ ("arm_store_return_value: Floating "
+ "point model not supported"));
break;
}
}
- else if (type->code () == TYPE_CODE_INT
- || type->code () == TYPE_CODE_CHAR
- || type->code () == TYPE_CODE_BOOL
- || type->code () == TYPE_CODE_PTR
- || TYPE_IS_REFERENCE (type)
- || type->code () == TYPE_CODE_ENUM)
+ else if (type->code () == TYPE_CODE_INT || type->code () == TYPE_CODE_CHAR
+ || type->code () == TYPE_CODE_BOOL || type->code () == TYPE_CODE_PTR
+ || TYPE_IS_REFERENCE (type) || type->code () == TYPE_CODE_ENUM)
{
if (type->length () <= 4)
{
@@ -9130,7 +9137,8 @@ arm_store_return_value (struct type *type, struct regcache *regs,
bfd_byte tmpbuf[ARM_INT_REGISTER_SIZE];
LONGEST val = unpack_long (type, valbuf);
- store_signed_integer (tmpbuf, ARM_INT_REGISTER_SIZE, byte_order, val);
+ store_signed_integer (tmpbuf, ARM_INT_REGISTER_SIZE, byte_order,
+ val);
regs->cooked_write (ARM_A1_REGNUM, tmpbuf);
}
else
@@ -9169,7 +9177,6 @@ arm_store_return_value (struct type *type, struct regcache *regs,
}
}
-
/* Handle function return values. */
static enum return_value_convention
@@ -9276,7 +9283,6 @@ arm_return_value (struct gdbarch *gdbarch, struct value *function,
return RETURN_VALUE_REGISTER_CONVENTION;
}
-
static int
arm_get_longjmp_target (frame_info_ptr frame, CORE_ADDR *pc)
{
@@ -9285,7 +9291,7 @@ arm_get_longjmp_target (frame_info_ptr frame, CORE_ADDR *pc)
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
CORE_ADDR jb_addr;
gdb_byte buf[ARM_INT_REGISTER_SIZE];
-
+
jb_addr = get_frame_register_unsigned (frame, ARM_A1_REGNUM);
if (target_read_memory (jb_addr + tdep->jb_pc * tdep->jb_elt_size, buf,
@@ -9295,6 +9301,7 @@ arm_get_longjmp_target (frame_info_ptr frame, CORE_ADDR *pc)
*pc = extract_unsigned_integer (buf, ARM_INT_REGISTER_SIZE, byte_order);
return 1;
}
+
/* A call to cmse secure entry function "foo" at "a" is modified by
GNU ld as "b".
a) bl xxxx <foo>
@@ -9327,7 +9334,7 @@ arm_skip_cmse_entry (CORE_ADDR pc, const char *name, struct objfile *objfile)
xsnprintf (target_name, target_len, "%s%s", "__acle_se_", name);
struct bound_minimal_symbol minsym
- = lookup_minimal_symbol (target_name, NULL, objfile);
+ = lookup_minimal_symbol (target_name, NULL, objfile);
if (minsym.minsym != nullptr)
return minsym.value_address ();
@@ -9340,8 +9347,7 @@ arm_skip_cmse_entry (CORE_ADDR pc, const char *name, struct objfile *objfile)
static bool
arm_is_sgstubs_section (struct obj_section *sec)
{
- return (sec != nullptr
- && sec->the_bfd_section != nullptr
+ return (sec != nullptr && sec->the_bfd_section != nullptr
&& sec->the_bfd_section->name != nullptr
&& streq (sec->the_bfd_section->name, ".gnu.sgstubs"));
}
@@ -9373,15 +9379,13 @@ arm_skip_stub (frame_info_ptr frame, CORE_ADDR pc)
_call_via_xx, where x is the register name. The possible names
are r0-r9, sl, fp, ip, sp, and lr. ARM RealView has similar
functions, named __ARM_call_via_r[0-7]. */
- if (startswith (name, "_call_via_")
- || startswith (name, "__ARM_call_via_"))
+ if (startswith (name, "_call_via_") || startswith (name, "__ARM_call_via_"))
{
/* Use the name suffix to determine which register contains the
target PC. */
- static const char *table[15] =
- {"r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7",
- "r8", "r9", "sl", "fp", "ip", "sp", "lr"
- };
+ static const char *table[15]
+ = { "r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7",
+ "r8", "r9", "sl", "fp", "ip", "sp", "lr" };
int regno;
int offset = strlen (name) - 2;
@@ -9396,9 +9400,11 @@ arm_skip_stub (frame_info_ptr frame, CORE_ADDR pc)
namelen = strlen (name);
if (name[0] == '_' && name[1] == '_'
&& ((namelen > 2 + strlen ("_from_thumb")
- && startswith (name + namelen - strlen ("_from_thumb"), "_from_thumb"))
+ && startswith (name + namelen - strlen ("_from_thumb"),
+ "_from_thumb"))
|| (namelen > 2 + strlen ("_from_arm")
- && startswith (name + namelen - strlen ("_from_arm"), "_from_arm"))))
+ && startswith (name + namelen - strlen ("_from_arm"),
+ "_from_arm"))))
{
char *target_name;
int target_len = namelen - 2;
@@ -9430,7 +9436,7 @@ arm_skip_stub (frame_info_ptr frame, CORE_ADDR pc)
if (arm_is_sgstubs_section (section))
return arm_skip_cmse_entry (pc, name, section->objfile);
- return 0; /* not a stub */
+ return 0; /* not a stub */
}
static void
@@ -9443,12 +9449,11 @@ arm_update_current_architecture (void)
/* Update the architecture. */
gdbarch_info info;
if (!gdbarch_update_p (info))
- internal_error (_("could not update architecture"));
+ internal_error (_ ("could not update architecture"));
}
static void
-set_fp_model_sfunc (const char *args, int from_tty,
- struct cmd_list_element *c)
+set_fp_model_sfunc (const char *args, int from_tty, struct cmd_list_element *c)
{
int fp_model;
@@ -9460,15 +9465,14 @@ set_fp_model_sfunc (const char *args, int from_tty,
}
if (fp_model == ARM_FLOAT_LAST)
- internal_error (_("Invalid fp model accepted: %s."),
- current_fp_model);
+ internal_error (_ ("Invalid fp model accepted: %s."), current_fp_model);
arm_update_current_architecture ();
}
static void
-show_fp_model (struct ui_file *file, int from_tty,
- struct cmd_list_element *c, const char *value)
+show_fp_model (struct ui_file *file, int from_tty, struct cmd_list_element *c,
+ const char *value)
{
if (arm_fp_model == ARM_FLOAT_AUTO
&& gdbarch_bfd_arch_info (target_gdbarch ())->arch == bfd_arch_arm)
@@ -9476,19 +9480,18 @@ show_fp_model (struct ui_file *file, int from_tty,
arm_gdbarch_tdep *tdep
= gdbarch_tdep<arm_gdbarch_tdep> (target_gdbarch ());
- gdb_printf (file, _("\
+ gdb_printf (file, _ ("\
The current ARM floating point model is \"auto\" (currently \"%s\").\n"),
fp_model_strings[tdep->fp_model]);
}
else
- gdb_printf (file, _("\
+ gdb_printf (file, _ ("\
The current ARM floating point model is \"%s\".\n"),
fp_model_strings[arm_fp_model]);
}
static void
-arm_set_abi (const char *args, int from_tty,
- struct cmd_list_element *c)
+arm_set_abi (const char *args, int from_tty, struct cmd_list_element *c)
{
int arm_abi;
@@ -9500,15 +9503,14 @@ arm_set_abi (const char *args, int from_tty,
}
if (arm_abi == ARM_ABI_LAST)
- internal_error (_("Invalid ABI accepted: %s."),
- arm_abi_string);
+ internal_error (_ ("Invalid ABI accepted: %s."), arm_abi_string);
arm_update_current_architecture ();
}
static void
-arm_show_abi (struct ui_file *file, int from_tty,
- struct cmd_list_element *c, const char *value)
+arm_show_abi (struct ui_file *file, int from_tty, struct cmd_list_element *c,
+ const char *value)
{
if (arm_abi_global == ARM_ABI_AUTO
&& gdbarch_bfd_arch_info (target_gdbarch ())->arch == bfd_arch_arm)
@@ -9516,13 +9518,12 @@ arm_show_abi (struct ui_file *file, int from_tty,
arm_gdbarch_tdep *tdep
= gdbarch_tdep<arm_gdbarch_tdep> (target_gdbarch ());
- gdb_printf (file, _("\
+ gdb_printf (file, _ ("\
The current ARM ABI is \"auto\" (currently \"%s\").\n"),
arm_abi_strings[tdep->arm_abi]);
}
else
- gdb_printf (file, _("The current ARM ABI is \"%s\".\n"),
- arm_abi_string);
+ gdb_printf (file, _ ("The current ARM ABI is \"%s\".\n"), arm_abi_string);
}
static void
@@ -9530,8 +9531,8 @@ arm_show_fallback_mode (struct ui_file *file, int from_tty,
struct cmd_list_element *c, const char *value)
{
gdb_printf (file,
- _("The current execution mode assumed "
- "(when symbols are unavailable) is \"%s\".\n"),
+ _ ("The current execution mode assumed "
+ "(when symbols are unavailable) is \"%s\".\n"),
arm_fallback_mode_string);
}
@@ -9540,18 +9541,19 @@ arm_show_force_mode (struct ui_file *file, int from_tty,
struct cmd_list_element *c, const char *value)
{
gdb_printf (file,
- _("The current execution mode assumed "
- "(even when symbols are available) is \"%s\".\n"),
+ _ ("The current execution mode assumed "
+ "(even when symbols are available) is \"%s\".\n"),
arm_force_mode_string);
}
static void
arm_show_unwind_secure_frames (struct ui_file *file, int from_tty,
- struct cmd_list_element *c, const char *value)
+ struct cmd_list_element *c, const char *value)
{
- gdb_printf (file,
- _("Usage of non-secure to secure exception stack unwinding is %s.\n"),
- arm_unwind_secure_frames ? "on" : "off");
+ gdb_printf (
+ file,
+ _ ("Usage of non-secure to secure exception stack unwinding is %s.\n"),
+ arm_unwind_secure_frames ? "on" : "off");
}
/* If the user changes the register disassembly style used for info
@@ -9580,15 +9582,15 @@ show_disassembly_style_sfunc (struct ui_file *file, int from_tty,
const char *opt;
FOR_EACH_DISASSEMBLER_OPTION (opt, options)
- if (startswith (opt, "reg-names-"))
- {
- style = &opt[strlen ("reg-names-")];
- len = strcspn (style, ",");
- }
+ if (startswith (opt, "reg-names-"))
+ {
+ style = &opt[strlen ("reg-names-")];
+ len = strcspn (style, ",");
+ }
gdb_printf (file, "The disassembly style is \"%.*s\".\n", len, style);
}
-
+
/* Return the ARM register name corresponding to register I. */
static const char *
arm_register_name (struct gdbarch *gdbarch, int i)
@@ -9598,8 +9600,8 @@ arm_register_name (struct gdbarch *gdbarch, int i)
if (is_s_pseudo (gdbarch, i))
{
static const char *const s_pseudo_names[] = {
- "s0", "s1", "s2", "s3", "s4", "s5", "s6", "s7",
- "s8", "s9", "s10", "s11", "s12", "s13", "s14", "s15",
+ "s0", "s1", "s2", "s3", "s4", "s5", "s6", "s7",
+ "s8", "s9", "s10", "s11", "s12", "s13", "s14", "s15",
"s16", "s17", "s18", "s19", "s20", "s21", "s22", "s23",
"s24", "s25", "s26", "s27", "s28", "s29", "s30", "s31",
};
@@ -9610,7 +9612,7 @@ arm_register_name (struct gdbarch *gdbarch, int i)
if (is_q_pseudo (gdbarch, i))
{
static const char *const q_pseudo_names[] = {
- "q0", "q1", "q2", "q3", "q4", "q5", "q6", "q7",
+ "q0", "q1", "q2", "q3", "q4", "q5", "q6", "q7",
"q8", "q9", "q10", "q11", "q12", "q13", "q14", "q15",
};
@@ -9639,11 +9641,8 @@ arm_register_name (struct gdbarch *gdbarch, int i)
static int
coff_sym_is_thumb (int val)
{
- return (val == C_THUMBEXT
- || val == C_THUMBSTAT
- || val == C_THUMBEXTFUNC
- || val == C_THUMBSTATFUNC
- || val == C_THUMBLABEL);
+ return (val == C_THUMBEXT || val == C_THUMBSTAT || val == C_THUMBEXTFUNC
+ || val == C_THUMBSTATFUNC || val == C_THUMBLABEL);
}
/* arm_coff_make_msymbol_special()
@@ -9652,9 +9651,9 @@ coff_sym_is_thumb (int val)
These functions test whether the COFF or ELF symbol corresponds to
an address in thumb code, and set a "special" bit in a minimal
symbol to indicate that it does. */
-
+
static void
-arm_elf_make_msymbol_special(asymbol *sym, struct minimal_symbol *msym)
+arm_elf_make_msymbol_special (asymbol *sym, struct minimal_symbol *msym)
{
elf_symbol_type *elfsym = (elf_symbol_type *) sym;
@@ -9664,7 +9663,7 @@ arm_elf_make_msymbol_special(asymbol *sym, struct minimal_symbol *msym)
}
static void
-arm_coff_make_msymbol_special(int val, struct minimal_symbol *msym)
+arm_coff_make_msymbol_special (int val, struct minimal_symbol *msym)
{
if (coff_sym_is_thumb (val))
MSYMBOL_SET_SPECIAL (msym);
@@ -9709,11 +9708,9 @@ arm_write_pc (struct regcache *regcache, CORE_ADDR pc)
regcache_cooked_read_unsigned (regcache, ARM_PS_REGNUM, &val);
t_bit = arm_psr_thumb_bit (gdbarch);
if (arm_pc_is_thumb (gdbarch, pc))
- regcache_cooked_write_unsigned (regcache, ARM_PS_REGNUM,
- val | t_bit);
+ regcache_cooked_write_unsigned (regcache, ARM_PS_REGNUM, val | t_bit);
else
- regcache_cooked_write_unsigned (regcache, ARM_PS_REGNUM,
- val & ~t_bit);
+ regcache_cooked_write_unsigned (regcache, ARM_PS_REGNUM, val & ~t_bit);
}
}
@@ -9734,8 +9731,8 @@ arm_neon_quad_read (struct gdbarch *gdbarch, readable_regcache *regcache,
enum register_status status;
xsnprintf (name_buf, sizeof (name_buf), "d%d", regnum << 1);
- double_regnum = user_reg_map_name_to_regnum (gdbarch, name_buf,
- strlen (name_buf));
+ double_regnum
+ = user_reg_map_name_to_regnum (gdbarch, name_buf, strlen (name_buf));
/* d0 is always the least significant half of q0. */
if (gdbarch_byte_order (gdbarch) == BFD_ENDIAN_BIG)
@@ -9805,8 +9802,8 @@ arm_pseudo_read (struct gdbarch *gdbarch, readable_regcache *regcache,
offset = (regnum & 1) ? 4 : 0;
xsnprintf (name_buf, sizeof (name_buf), "d%d", regnum >> 1);
- double_regnum = user_reg_map_name_to_regnum (gdbarch, name_buf,
- strlen (name_buf));
+ double_regnum
+ = user_reg_map_name_to_regnum (gdbarch, name_buf, strlen (name_buf));
status = regcache->raw_read (double_regnum, reg_buf);
if (status == REG_VALID)
@@ -9830,8 +9827,8 @@ arm_neon_quad_write (struct gdbarch *gdbarch, struct regcache *regcache,
int offset, double_regnum;
xsnprintf (name_buf, sizeof (name_buf), "d%d", regnum << 1);
- double_regnum = user_reg_map_name_to_regnum (gdbarch, name_buf,
- strlen (name_buf));
+ double_regnum
+ = user_reg_map_name_to_regnum (gdbarch, name_buf, strlen (name_buf));
/* d0 is always the least significant half of q0. */
if (gdbarch_byte_order (gdbarch) == BFD_ENDIAN_BIG)
@@ -9871,8 +9868,8 @@ arm_pseudo_write (struct gdbarch *gdbarch, struct regcache *regcache,
if (is_q_pseudo (gdbarch, regnum))
{
/* Quad-precision register. */
- arm_neon_quad_write (gdbarch, regcache,
- regnum - tdep->q_pseudo_base, buf);
+ arm_neon_quad_write (gdbarch, regcache, regnum - tdep->q_pseudo_base,
+ buf);
}
else if (is_mve_pseudo (gdbarch, regnum))
arm_mve_pseudo_write (gdbarch, regcache, regnum, buf);
@@ -9889,8 +9886,8 @@ arm_pseudo_write (struct gdbarch *gdbarch, struct regcache *regcache,
offset = (regnum & 1) ? 4 : 0;
xsnprintf (name_buf, sizeof (name_buf), "d%d", regnum >> 1);
- double_regnum = user_reg_map_name_to_regnum (gdbarch, name_buf,
- strlen (name_buf));
+ double_regnum
+ = user_reg_map_name_to_regnum (gdbarch, name_buf, strlen (name_buf));
regcache->raw_read (double_regnum, reg_buf);
memcpy (reg_buf + offset, buf, 4);
@@ -9904,7 +9901,7 @@ value_of_arm_user_reg (frame_info_ptr frame, const void *baton)
const int *reg_p = (const int *) baton;
return value_of_register (*reg_p, frame);
}
-
+
static enum gdb_osabi
arm_elf_osabi_sniffer (bfd *abfd)
{
@@ -9933,10 +9930,8 @@ arm_register_reggroup_p (struct gdbarch *gdbarch, int regnum,
this, FPS register belongs to save_regroup, restore_reggroup, and
all_reggroup, of course. */
if (regnum == ARM_FPS_REGNUM)
- return (group == float_reggroup
- || group == save_reggroup
- || group == restore_reggroup
- || group == all_reggroup);
+ return (group == float_reggroup || group == save_reggroup
+ || group == restore_reggroup || group == all_reggroup);
else
return default_register_reggroup_p (gdbarch, regnum, group);
}
@@ -9968,8 +9963,7 @@ arm_register_g_packet_guesses (struct gdbarch *gdbarch)
/* The regular M-profile layout. */
tdesc = arm_read_mprofile_description (ARM_M_TYPE_M_PROFILE);
- register_remote_g_packet_guess (gdbarch, ARM_CORE_REGS_SIZE,
- tdesc);
+ register_remote_g_packet_guess (gdbarch, ARM_CORE_REGS_SIZE, tdesc);
/* M-profile plus M4F VFP. */
tdesc = arm_read_mprofile_description (ARM_M_TYPE_VFP_D16);
@@ -9978,13 +9972,15 @@ arm_register_g_packet_guesses (struct gdbarch *gdbarch)
tdesc);
/* M-profile plus MVE. */
tdesc = arm_read_mprofile_description (ARM_M_TYPE_MVE);
- register_remote_g_packet_guess (gdbarch, ARM_CORE_REGS_SIZE
- + ARM_VFP2_REGS_SIZE
- + ARM_INT_REGISTER_SIZE, tdesc);
+ register_remote_g_packet_guess (gdbarch,
+ ARM_CORE_REGS_SIZE + ARM_VFP2_REGS_SIZE
+ + ARM_INT_REGISTER_SIZE,
+ tdesc);
/* M-profile system (stack pointers). */
tdesc = arm_read_mprofile_description (ARM_M_TYPE_SYSTEM);
- register_remote_g_packet_guess (gdbarch, 2 * ARM_INT_REGISTER_SIZE, tdesc);
+ register_remote_g_packet_guess (gdbarch, 2 * ARM_INT_REGISTER_SIZE,
+ tdesc);
}
/* Otherwise we don't have a useful guess. */
@@ -10156,7 +10152,7 @@ arm_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
default:
/* Leave it as "auto". */
- warning (_("unknown ARM EABI version 0x%x"), eabi_ver);
+ warning (_ ("unknown ARM EABI version 0x%x"), eabi_ver);
break;
}
@@ -10258,12 +10254,10 @@ arm_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
const struct tdesc_feature *feature;
int valid_p;
- feature = tdesc_find_feature (tdesc,
- "org.gnu.gdb.arm.core");
+ feature = tdesc_find_feature (tdesc, "org.gnu.gdb.arm.core");
if (feature == NULL)
{
- feature = tdesc_find_feature (tdesc,
- "org.gnu.gdb.arm.m-profile");
+ feature = tdesc_find_feature (tdesc, "org.gnu.gdb.arm.m-profile");
if (feature == NULL)
return NULL;
else
@@ -10277,14 +10271,11 @@ arm_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
valid_p &= tdesc_numbered_register (feature, tdesc_data.get (), i,
arm_register_names[i]);
valid_p &= tdesc_numbered_register_choices (feature, tdesc_data.get (),
- ARM_SP_REGNUM,
- arm_sp_names);
+ ARM_SP_REGNUM, arm_sp_names);
valid_p &= tdesc_numbered_register_choices (feature, tdesc_data.get (),
- ARM_LR_REGNUM,
- arm_lr_names);
+ ARM_LR_REGNUM, arm_lr_names);
valid_p &= tdesc_numbered_register_choices (feature, tdesc_data.get (),
- ARM_PC_REGNUM,
- arm_pc_names);
+ ARM_PC_REGNUM, arm_pc_names);
if (is_m)
valid_p &= tdesc_numbered_register (feature, tdesc_data.get (),
ARM_PS_REGNUM, "xpsr");
@@ -10297,8 +10288,7 @@ arm_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
if (is_m)
{
- feature = tdesc_find_feature (tdesc,
- "org.gnu.gdb.arm.m-system");
+ feature = tdesc_find_feature (tdesc, "org.gnu.gdb.arm.m-system");
if (feature != nullptr)
{
/* MSP */
@@ -10306,7 +10296,8 @@ arm_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
register_count, "msp");
if (!valid_p)
{
- warning (_("M-profile m-system feature is missing required register msp."));
+ warning (_ ("M-profile m-system feature is missing required "
+ "register msp."));
return nullptr;
}
have_m_profile_msp = true;
@@ -10317,15 +10308,15 @@ arm_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
register_count, "psp");
if (!valid_p)
{
- warning (_("M-profile m-system feature is missing required register psp."));
+ warning (_ ("M-profile m-system feature is missing required "
+ "register psp."));
return nullptr;
}
m_profile_psp_regnum = register_count++;
}
}
- feature = tdesc_find_feature (tdesc,
- "org.gnu.gdb.arm.fpa");
+ feature = tdesc_find_feature (tdesc, "org.gnu.gdb.arm.fpa");
if (feature != NULL)
{
valid_p = 1;
@@ -10338,15 +10329,14 @@ arm_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
else
have_fpa_registers = false;
- feature = tdesc_find_feature (tdesc,
- "org.gnu.gdb.xscale.iwmmxt");
+ feature = tdesc_find_feature (tdesc, "org.gnu.gdb.xscale.iwmmxt");
if (feature != NULL)
{
static const char *const iwmmxt_names[] = {
- "wR0", "wR1", "wR2", "wR3", "wR4", "wR5", "wR6", "wR7",
- "wR8", "wR9", "wR10", "wR11", "wR12", "wR13", "wR14", "wR15",
- "wCID", "wCon", "wCSSF", "wCASF", "", "", "", "",
- "wCGR0", "wCGR1", "wCGR2", "wCGR3", "", "", "", "",
+ "wR0", "wR1", "wR2", "wR3", "wR4", "wR5", "wR6", "wR7",
+ "wR8", "wR9", "wR10", "wR11", "wR12", "wR13", "wR14", "wR15",
+ "wCID", "wCon", "wCSSF", "wCASF", "", "", "", "",
+ "wCGR0", "wCGR1", "wCGR2", "wCGR3", "", "", "", "",
};
valid_p = 1;
@@ -10375,13 +10365,12 @@ arm_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
/* If we have a VFP unit, check whether the single precision registers
are present. If not, then we will synthesize them as pseudo
registers. */
- feature = tdesc_find_feature (tdesc,
- "org.gnu.gdb.arm.vfp");
+ feature = tdesc_find_feature (tdesc, "org.gnu.gdb.arm.vfp");
if (feature != NULL)
{
static const char *const vfp_double_names[] = {
- "d0", "d1", "d2", "d3", "d4", "d5", "d6", "d7",
- "d8", "d9", "d10", "d11", "d12", "d13", "d14", "d15",
+ "d0", "d1", "d2", "d3", "d4", "d5", "d6", "d7",
+ "d8", "d9", "d10", "d11", "d12", "d13", "d14", "d15",
"d16", "d17", "d18", "d19", "d20", "d21", "d22", "d23",
"d24", "d25", "d26", "d27", "d28", "d29", "d30", "d31",
};
@@ -10416,8 +10405,7 @@ arm_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
/* If we have VFP, also check for NEON. The architecture allows
NEON without VFP (integer vector operations only), but GDB
does not support that. */
- feature = tdesc_find_feature (tdesc,
- "org.gnu.gdb.arm.neon");
+ feature = tdesc_find_feature (tdesc, "org.gnu.gdb.arm.neon");
if (feature != NULL)
{
/* NEON requires 32 double-precision registers. */
@@ -10450,7 +10438,8 @@ arm_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
if (is_m)
{
/* Do we have the MVE feature? */
- feature = tdesc_find_feature (tdesc,"org.gnu.gdb.arm.m-profile-mve");
+ feature
+ = tdesc_find_feature (tdesc, "org.gnu.gdb.arm.m-profile-mve");
if (feature != nullptr)
{
@@ -10459,7 +10448,8 @@ arm_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
register_count, "vpr");
if (!valid_p)
{
- warning (_("MVE feature is missing required register vpr."));
+ warning (
+ _ ("MVE feature is missing required register vpr."));
return nullptr;
}
@@ -10480,8 +10470,8 @@ arm_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
}
/* Do we have the ARMv8.1-m PACBTI feature? */
- feature = tdesc_find_feature (tdesc,
- "org.gnu.gdb.arm.m-profile-pacbti");
+ feature
+ = tdesc_find_feature (tdesc, "org.gnu.gdb.arm.m-profile-pacbti");
if (feature != nullptr)
{
/* By advertising this feature, the target acknowledges the
@@ -10496,54 +10486,56 @@ arm_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
}
/* Do we have the Security extension? */
- feature = tdesc_find_feature (tdesc,
- "org.gnu.gdb.arm.secext");
+ feature = tdesc_find_feature (tdesc, "org.gnu.gdb.arm.secext");
if (feature != nullptr)
{
/* Secure/Non-secure stack pointers. */
/* MSP_NS */
valid_p &= tdesc_numbered_register (feature, tdesc_data.get (),
- register_count, "msp_ns");
+ register_count, "msp_ns");
if (!valid_p)
{
- warning (_("M-profile secext feature is missing required register msp_ns."));
+ warning (_ ("M-profile secext feature is missing required "
+ "register msp_ns."));
return nullptr;
}
m_profile_msp_ns_regnum = register_count++;
/* PSP_NS */
valid_p &= tdesc_numbered_register (feature, tdesc_data.get (),
- register_count, "psp_ns");
+ register_count, "psp_ns");
if (!valid_p)
{
- warning (_("M-profile secext feature is missing required register psp_ns."));
+ warning (_ ("M-profile secext feature is missing required "
+ "register psp_ns."));
return nullptr;
}
m_profile_psp_ns_regnum = register_count++;
/* MSP_S */
valid_p &= tdesc_numbered_register (feature, tdesc_data.get (),
- register_count, "msp_s");
+ register_count, "msp_s");
if (!valid_p)
{
- warning (_("M-profile secext feature is missing required register msp_s."));
+ warning (_ ("M-profile secext feature is missing required "
+ "register msp_s."));
return nullptr;
}
m_profile_msp_s_regnum = register_count++;
/* PSP_S */
valid_p &= tdesc_numbered_register (feature, tdesc_data.get (),
- register_count, "psp_s");
+ register_count, "psp_s");
if (!valid_p)
{
- warning (_("M-profile secext feature is missing required register psp_s."));
+ warning (_ ("M-profile secext feature is missing required "
+ "register psp_s."));
return nullptr;
}
m_profile_psp_s_regnum = register_count++;
have_sec_ext = true;
}
-
}
}
@@ -10594,8 +10586,7 @@ arm_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
tdep->have_sec_ext = have_sec_ext;
tdep->have_fpa_registers = have_fpa_registers;
tdep->have_wmmx_registers = have_wmmx_registers;
- gdb_assert (vfp_register_count == 0
- || vfp_register_count == 16
+ gdb_assert (vfp_register_count == 0 || vfp_register_count == 16
|| vfp_register_count == 32);
tdep->vfp_register_count = vfp_register_count;
tdep->have_s_pseudos = have_s_pseudos;
@@ -10646,7 +10637,7 @@ arm_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
break;
default:
- internal_error (_("arm_gdbarch_init: bad byte order for float format"));
+ internal_error (_ ("arm_gdbarch_init: bad byte order for float format"));
}
/* On ARM targets char defaults to unsigned. */
@@ -10668,7 +10659,7 @@ arm_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
/* This should be low enough for everything. */
tdep->lowest_pc = 0x20;
- tdep->jb_pc = -1; /* Longjump support not enabled by default. */
+ tdep->jb_pc = -1; /* Longjump support not enabled by default. */
/* The default, for both APCS and AAPCS, is to return small
structures in registers. */
@@ -10702,8 +10693,8 @@ arm_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
/* Breakpoint manipulation. */
set_gdbarch_breakpoint_kind_from_pc (gdbarch, arm_breakpoint_kind_from_pc);
set_gdbarch_sw_breakpoint_from_kind (gdbarch, arm_sw_breakpoint_from_kind);
- set_gdbarch_breakpoint_kind_from_current_state (gdbarch,
- arm_breakpoint_kind_from_current_state);
+ set_gdbarch_breakpoint_kind_from_current_state (
+ gdbarch, arm_breakpoint_kind_from_current_state);
/* Information about registers, etc. */
set_gdbarch_sp_regnum (gdbarch, ARM_SP_REGNUM);
@@ -10780,10 +10771,10 @@ arm_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
set_gdbarch_float_format (gdbarch, floatformats_ieee_single);
if (tdep->fp_model == ARM_FLOAT_SOFT_FPA || tdep->fp_model == ARM_FLOAT_FPA)
{
- set_gdbarch_double_format
- (gdbarch, floatformats_ieee_double_littlebyte_bigword);
- set_gdbarch_long_double_format
- (gdbarch, floatformats_ieee_double_littlebyte_bigword);
+ set_gdbarch_double_format (gdbarch,
+ floatformats_ieee_double_littlebyte_bigword);
+ set_gdbarch_long_double_format (
+ gdbarch, floatformats_ieee_double_littlebyte_bigword);
}
else
{
@@ -10859,11 +10850,12 @@ arm_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
names which are used by the current architecture - it's simpler,
and does no harm, since nothing ever lists user registers. */
for (i = 0; i < ARRAY_SIZE (arm_register_aliases); i++)
- user_reg_add (gdbarch, arm_register_aliases[i].name,
- value_of_arm_user_reg, &arm_register_aliases[i].regnum);
+ user_reg_add (gdbarch, arm_register_aliases[i].name, value_of_arm_user_reg,
+ &arm_register_aliases[i].regnum);
set_gdbarch_disassembler_options (gdbarch, &arm_disassembler_options);
- set_gdbarch_valid_disassembler_options (gdbarch, disassembler_options_arm ());
+ set_gdbarch_valid_disassembler_options (gdbarch,
+ disassembler_options_arm ());
set_gdbarch_gnu_triplet_regexp (gdbarch, arm_gnu_triplet_regexp);
@@ -10878,58 +10870,58 @@ arm_dump_tdep (struct gdbarch *gdbarch, struct ui_file *file)
if (tdep == NULL)
return;
- gdb_printf (file, _("arm_dump_tdep: fp_model = %i\n"),
+ gdb_printf (file, _ ("arm_dump_tdep: fp_model = %i\n"),
(int) tdep->fp_model);
- gdb_printf (file, _("arm_dump_tdep: have_fpa_registers = %i\n"),
+ gdb_printf (file, _ ("arm_dump_tdep: have_fpa_registers = %i\n"),
(int) tdep->have_fpa_registers);
- gdb_printf (file, _("arm_dump_tdep: have_wmmx_registers = %i\n"),
+ gdb_printf (file, _ ("arm_dump_tdep: have_wmmx_registers = %i\n"),
(int) tdep->have_wmmx_registers);
- gdb_printf (file, _("arm_dump_tdep: vfp_register_count = %i\n"),
+ gdb_printf (file, _ ("arm_dump_tdep: vfp_register_count = %i\n"),
(int) tdep->vfp_register_count);
- gdb_printf (file, _("arm_dump_tdep: have_s_pseudos = %s\n"),
- tdep->have_s_pseudos? "true" : "false");
- gdb_printf (file, _("arm_dump_tdep: s_pseudo_base = %i\n"),
+ gdb_printf (file, _ ("arm_dump_tdep: have_s_pseudos = %s\n"),
+ tdep->have_s_pseudos ? "true" : "false");
+ gdb_printf (file, _ ("arm_dump_tdep: s_pseudo_base = %i\n"),
(int) tdep->s_pseudo_base);
- gdb_printf (file, _("arm_dump_tdep: s_pseudo_count = %i\n"),
+ gdb_printf (file, _ ("arm_dump_tdep: s_pseudo_count = %i\n"),
(int) tdep->s_pseudo_count);
- gdb_printf (file, _("arm_dump_tdep: have_q_pseudos = %s\n"),
- tdep->have_q_pseudos? "true" : "false");
- gdb_printf (file, _("arm_dump_tdep: q_pseudo_base = %i\n"),
+ gdb_printf (file, _ ("arm_dump_tdep: have_q_pseudos = %s\n"),
+ tdep->have_q_pseudos ? "true" : "false");
+ gdb_printf (file, _ ("arm_dump_tdep: q_pseudo_base = %i\n"),
(int) tdep->q_pseudo_base);
- gdb_printf (file, _("arm_dump_tdep: q_pseudo_count = %i\n"),
+ gdb_printf (file, _ ("arm_dump_tdep: q_pseudo_count = %i\n"),
(int) tdep->q_pseudo_count);
- gdb_printf (file, _("arm_dump_tdep: have_neon = %i\n"),
+ gdb_printf (file, _ ("arm_dump_tdep: have_neon = %i\n"),
(int) tdep->have_neon);
- gdb_printf (file, _("arm_dump_tdep: have_mve = %s\n"),
- tdep->have_mve? "yes" : "no");
- gdb_printf (file, _("arm_dump_tdep: mve_vpr_regnum = %i\n"),
+ gdb_printf (file, _ ("arm_dump_tdep: have_mve = %s\n"),
+ tdep->have_mve ? "yes" : "no");
+ gdb_printf (file, _ ("arm_dump_tdep: mve_vpr_regnum = %i\n"),
tdep->mve_vpr_regnum);
- gdb_printf (file, _("arm_dump_tdep: mve_pseudo_base = %i\n"),
+ gdb_printf (file, _ ("arm_dump_tdep: mve_pseudo_base = %i\n"),
tdep->mve_pseudo_base);
- gdb_printf (file, _("arm_dump_tdep: mve_pseudo_count = %i\n"),
+ gdb_printf (file, _ ("arm_dump_tdep: mve_pseudo_count = %i\n"),
tdep->mve_pseudo_count);
- gdb_printf (file, _("arm_dump_tdep: m_profile_msp_regnum = %i\n"),
+ gdb_printf (file, _ ("arm_dump_tdep: m_profile_msp_regnum = %i\n"),
tdep->m_profile_msp_regnum);
- gdb_printf (file, _("arm_dump_tdep: m_profile_psp_regnum = %i\n"),
+ gdb_printf (file, _ ("arm_dump_tdep: m_profile_psp_regnum = %i\n"),
tdep->m_profile_psp_regnum);
- gdb_printf (file, _("arm_dump_tdep: m_profile_msp_ns_regnum = %i\n"),
+ gdb_printf (file, _ ("arm_dump_tdep: m_profile_msp_ns_regnum = %i\n"),
tdep->m_profile_msp_ns_regnum);
- gdb_printf (file, _("arm_dump_tdep: m_profile_psp_ns_regnum = %i\n"),
+ gdb_printf (file, _ ("arm_dump_tdep: m_profile_psp_ns_regnum = %i\n"),
tdep->m_profile_psp_ns_regnum);
- gdb_printf (file, _("arm_dump_tdep: m_profile_msp_s_regnum = %i\n"),
+ gdb_printf (file, _ ("arm_dump_tdep: m_profile_msp_s_regnum = %i\n"),
tdep->m_profile_msp_s_regnum);
- gdb_printf (file, _("arm_dump_tdep: m_profile_psp_s_regnum = %i\n"),
+ gdb_printf (file, _ ("arm_dump_tdep: m_profile_psp_s_regnum = %i\n"),
tdep->m_profile_psp_s_regnum);
- gdb_printf (file, _("arm_dump_tdep: Lowest pc = 0x%lx\n"),
+ gdb_printf (file, _ ("arm_dump_tdep: Lowest pc = 0x%lx\n"),
(unsigned long) tdep->lowest_pc);
- gdb_printf (file, _("arm_dump_tdep: have_pacbti = %s\n"),
- tdep->have_pacbti? "yes" : "no");
- gdb_printf (file, _("arm_dump_tdep: pacbti_pseudo_base = %i\n"),
+ gdb_printf (file, _ ("arm_dump_tdep: have_pacbti = %s\n"),
+ tdep->have_pacbti ? "yes" : "no");
+ gdb_printf (file, _ ("arm_dump_tdep: pacbti_pseudo_base = %i\n"),
tdep->pacbti_pseudo_base);
- gdb_printf (file, _("arm_dump_tdep: pacbti_pseudo_count = %i\n"),
+ gdb_printf (file, _ ("arm_dump_tdep: pacbti_pseudo_count = %i\n"),
tdep->pacbti_pseudo_count);
- gdb_printf (file, _("arm_dump_tdep: is_m = %s\n"),
- tdep->is_m? "yes" : "no");
+ gdb_printf (file, _ ("arm_dump_tdep: is_m = %s\n"),
+ tdep->is_m ? "yes" : "no");
}
#if GDB_SELF_TEST
@@ -10937,10 +10929,11 @@ namespace selftests
{
static void arm_record_test (void);
static void arm_analyze_prologue_test ();
-}
+} // namespace selftests
#endif
void _initialize_arm_tdep ();
+
void
_initialize_arm_tdep ()
{
@@ -10955,16 +10948,14 @@ _initialize_arm_tdep ()
gdb::observers::new_objfile.attach (arm_exidx_new_objfile, "arm-tdep");
/* Register an ELF OS ABI sniffer for ARM binaries. */
- gdbarch_register_osabi_sniffer (bfd_arch_arm,
- bfd_target_elf_flavour,
+ gdbarch_register_osabi_sniffer (bfd_arch_arm, bfd_target_elf_flavour,
arm_elf_osabi_sniffer);
/* Add root prefix command for all "set arm"/"show arm" commands. */
add_setshow_prefix_cmd ("arm", no_class,
- _("Various ARM-specific commands."),
- _("Various ARM-specific commands."),
- &setarmcmdlist, &showarmcmdlist,
- &setlist, &showlist);
+ _ ("Various ARM-specific commands."),
+ _ ("Various ARM-specific commands."), &setarmcmdlist,
+ &showarmcmdlist, &setlist, &showlist);
arm_disassembler_options = xstrdup ("reg-names-std");
const disasm_options_t *disasm_options
@@ -10975,8 +10966,8 @@ _initialize_arm_tdep ()
num_disassembly_styles++;
/* Initialize the array that will be passed to add_setshow_enum_cmd(). */
- valid_disassembly_styles = XNEWVEC (const char *,
- num_disassembly_styles + 1);
+ valid_disassembly_styles
+ = XNEWVEC (const char *, num_disassembly_styles + 1);
for (i = j = 0; disasm_options->name[i] != NULL; i++)
if (startswith (disasm_options->name[i], "reg-names-"))
{
@@ -10994,133 +10985,125 @@ _initialize_arm_tdep ()
valid_disassembly_styles[num_disassembly_styles] = NULL;
/* Create the help text. */
- std::string helptext = string_printf ("%s%s%s",
- _("The valid values are:\n"),
- regdesc,
- _("The default is \"std\"."));
-
- add_setshow_enum_cmd("disassembler", no_class,
- valid_disassembly_styles, &disassembly_style,
- _("Set the disassembly style."),
- _("Show the disassembly style."),
- helptext.c_str (),
- set_disassembly_style_sfunc,
- show_disassembly_style_sfunc,
- &setarmcmdlist, &showarmcmdlist);
+ std::string helptext
+ = string_printf ("%s%s%s", _ ("The valid values are:\n"), regdesc,
+ _ ("The default is \"std\"."));
+
+ add_setshow_enum_cmd ("disassembler", no_class, valid_disassembly_styles,
+ &disassembly_style, _ ("Set the disassembly style."),
+ _ ("Show the disassembly style."), helptext.c_str (),
+ set_disassembly_style_sfunc,
+ show_disassembly_style_sfunc, &setarmcmdlist,
+ &showarmcmdlist);
add_setshow_boolean_cmd ("apcs32", no_class, &arm_apcs_32,
- _("Set usage of ARM 32-bit mode."),
- _("Show usage of ARM 32-bit mode."),
- _("When off, a 26-bit PC will be used."),
- NULL,
+ _ ("Set usage of ARM 32-bit mode."),
+ _ ("Show usage of ARM 32-bit mode."),
+ _ ("When off, a 26-bit PC will be used."), NULL,
NULL, /* FIXME: i18n: Usage of ARM 32-bit
mode is %s. */
&setarmcmdlist, &showarmcmdlist);
/* Add a command to allow the user to force the FPU model. */
add_setshow_enum_cmd ("fpu", no_class, fp_model_strings, &current_fp_model,
- _("Set the floating point type."),
- _("Show the floating point type."),
- _("auto - Determine the FP typefrom the OS-ABI.\n\
+ _ ("Set the floating point type."),
+ _ ("Show the floating point type."),
+ _ ("auto - Determine the FP typefrom the OS-ABI.\n\
softfpa - Software FP, mixed-endian doubles on little-endian ARMs.\n\
fpa - FPA co-processor (GCC compiled).\n\
softvfp - Software FP with pure-endian doubles.\n\
vfp - VFP co-processor."),
- set_fp_model_sfunc, show_fp_model,
- &setarmcmdlist, &showarmcmdlist);
+ set_fp_model_sfunc, show_fp_model, &setarmcmdlist,
+ &showarmcmdlist);
/* Add a command to allow the user to force the ABI. */
add_setshow_enum_cmd ("abi", class_support, arm_abi_strings, &arm_abi_string,
- _("Set the ABI."),
- _("Show the ABI."),
- NULL, arm_set_abi, arm_show_abi,
- &setarmcmdlist, &showarmcmdlist);
+ _ ("Set the ABI."), _ ("Show the ABI."), NULL,
+ arm_set_abi, arm_show_abi, &setarmcmdlist,
+ &showarmcmdlist);
/* Add two commands to allow the user to force the assumed
execution mode. */
- add_setshow_enum_cmd ("fallback-mode", class_support,
- arm_mode_strings, &arm_fallback_mode_string,
- _("Set the mode assumed when symbols are unavailable."),
- _("Show the mode assumed when symbols are unavailable."),
- NULL, NULL, arm_show_fallback_mode,
- &setarmcmdlist, &showarmcmdlist);
- add_setshow_enum_cmd ("force-mode", class_support,
- arm_mode_strings, &arm_force_mode_string,
- _("Set the mode assumed even when symbols are available."),
- _("Show the mode assumed even when symbols are available."),
- NULL, NULL, arm_show_force_mode,
- &setarmcmdlist, &showarmcmdlist);
+ add_setshow_enum_cmd (
+ "fallback-mode", class_support, arm_mode_strings,
+ &arm_fallback_mode_string,
+ _ ("Set the mode assumed when symbols are unavailable."),
+ _ ("Show the mode assumed when symbols are unavailable."), NULL, NULL,
+ arm_show_fallback_mode, &setarmcmdlist, &showarmcmdlist);
+ add_setshow_enum_cmd (
+ "force-mode", class_support, arm_mode_strings, &arm_force_mode_string,
+ _ ("Set the mode assumed even when symbols are available."),
+ _ ("Show the mode assumed even when symbols are available."), NULL, NULL,
+ arm_show_force_mode, &setarmcmdlist, &showarmcmdlist);
/* Add a command to stop triggering security exceptions when
unwinding exception stacks. */
- add_setshow_boolean_cmd ("unwind-secure-frames", no_class, &arm_unwind_secure_frames,
- _("Set usage of non-secure to secure exception stack unwinding."),
- _("Show usage of non-secure to secure exception stack unwinding."),
- _("When on, the debugger can trigger memory access traps."),
- NULL, arm_show_unwind_secure_frames,
- &setarmcmdlist, &showarmcmdlist);
+ add_setshow_boolean_cmd (
+ "unwind-secure-frames", no_class, &arm_unwind_secure_frames,
+ _ ("Set usage of non-secure to secure exception stack unwinding."),
+ _ ("Show usage of non-secure to secure exception stack unwinding."),
+ _ ("When on, the debugger can trigger memory access traps."), NULL,
+ arm_show_unwind_secure_frames, &setarmcmdlist, &showarmcmdlist);
/* Debugging flag. */
add_setshow_boolean_cmd ("arm", class_maintenance, &arm_debug,
- _("Set ARM debugging."),
- _("Show ARM debugging."),
- _("When on, arm-specific debugging is enabled."),
+ _ ("Set ARM debugging."), _ ("Show ARM debugging."),
+ _ ("When on, arm-specific debugging is enabled."),
NULL,
NULL, /* FIXME: i18n: "ARM debugging is %s. */
&setdebuglist, &showdebuglist);
#if GDB_SELF_TEST
selftests::register_test ("arm-record", selftests::arm_record_test);
- selftests::register_test ("arm_analyze_prologue", selftests::arm_analyze_prologue_test);
+ selftests::register_test ("arm_analyze_prologue",
+ selftests::arm_analyze_prologue_test);
#endif
-
}
/* ARM-reversible process record data structures. */
-#define ARM_INSN_SIZE_BYTES 4
+#define ARM_INSN_SIZE_BYTES 4
#define THUMB_INSN_SIZE_BYTES 2
#define THUMB2_INSN_SIZE_BYTES 4
-
/* Position of the bit within a 32-bit ARM instruction
that defines whether the instruction is a load or store. */
#define INSN_S_L_BIT_NUM 20
-#define REG_ALLOC(REGS, LENGTH, RECORD_BUF) \
- do \
- { \
- unsigned int reg_len = LENGTH; \
- if (reg_len) \
- { \
- REGS = XNEWVEC (uint32_t, reg_len); \
- memcpy(&REGS[0], &RECORD_BUF[0], sizeof(uint32_t)*LENGTH); \
- } \
- } \
- while (0)
-
-#define MEM_ALLOC(MEMS, LENGTH, RECORD_BUF) \
- do \
- { \
- unsigned int mem_len = LENGTH; \
- if (mem_len) \
- { \
- MEMS = XNEWVEC (struct arm_mem_r, mem_len); \
- memcpy(&MEMS->len, &RECORD_BUF[0], \
- sizeof(struct arm_mem_r) * LENGTH); \
- } \
- } \
- while (0)
+#define REG_ALLOC(REGS, LENGTH, RECORD_BUF) \
+ do \
+ { \
+ unsigned int reg_len = LENGTH; \
+ if (reg_len) \
+ { \
+ REGS = XNEWVEC (uint32_t, reg_len); \
+ memcpy (&REGS[0], &RECORD_BUF[0], sizeof (uint32_t) * LENGTH); \
+ } \
+ } \
+ while (0)
+
+#define MEM_ALLOC(MEMS, LENGTH, RECORD_BUF) \
+ do \
+ { \
+ unsigned int mem_len = LENGTH; \
+ if (mem_len) \
+ { \
+ MEMS = XNEWVEC (struct arm_mem_r, mem_len); \
+ memcpy (&MEMS->len, &RECORD_BUF[0], \
+ sizeof (struct arm_mem_r) * LENGTH); \
+ } \
+ } \
+ while (0)
/* Checks whether insn is already recorded or yet to be decoded. (boolean expression). */
#define INSN_RECORDED(ARM_RECORD) \
- (0 != (ARM_RECORD)->reg_rec_count || 0 != (ARM_RECORD)->mem_rec_count)
+ (0 != (ARM_RECORD)->reg_rec_count || 0 != (ARM_RECORD)->mem_rec_count)
/* ARM memory record structure. */
struct arm_mem_r
{
- uint32_t len; /* Record length. */
- uint32_t addr; /* Memory address. */
+ uint32_t len; /* Record length. */
+ uint32_t addr; /* Memory address. */
};
/* ARM instruction record contains opcode of current insn
@@ -11132,24 +11115,23 @@ struct arm_insn_decode_record
{
struct gdbarch *gdbarch;
struct regcache *regcache;
- CORE_ADDR this_addr; /* Address of the insn being decoded. */
- uint32_t arm_insn; /* Should accommodate thumb. */
- uint32_t cond; /* Condition code. */
- uint32_t opcode; /* Insn opcode. */
- uint32_t decode; /* Insn decode bits. */
- uint32_t mem_rec_count; /* No of mem records. */
- uint32_t reg_rec_count; /* No of reg records. */
- uint32_t *arm_regs; /* Registers to be saved for this record. */
- struct arm_mem_r *arm_mems; /* Memory to be saved for this record. */
+ CORE_ADDR this_addr; /* Address of the insn being decoded. */
+ uint32_t arm_insn; /* Should accommodate thumb. */
+ uint32_t cond; /* Condition code. */
+ uint32_t opcode; /* Insn opcode. */
+ uint32_t decode; /* Insn decode bits. */
+ uint32_t mem_rec_count; /* No of mem records. */
+ uint32_t reg_rec_count; /* No of reg records. */
+ uint32_t *arm_regs; /* Registers to be saved for this record. */
+ struct arm_mem_r *arm_mems; /* Memory to be saved for this record. */
};
-
/* Checks ARM SBZ and SBO mandatory fields. */
static int
sbo_sbz (uint32_t insn, uint32_t bit_num, uint32_t len, uint32_t sbo)
{
- uint32_t ones = bits (insn, bit_num - 1, (bit_num -1) + (len - 1));
+ uint32_t ones = bits (insn, bit_num - 1, (bit_num - 1) + (len - 1));
if (!len)
return 1;
@@ -11176,28 +11158,26 @@ enum arm_record_result
enum arm_record_strx_t
{
- ARM_RECORD_STRH=1,
+ ARM_RECORD_STRH = 1,
ARM_RECORD_STRD
};
enum record_type_t
{
- ARM_RECORD=1,
+ ARM_RECORD = 1,
THUMB_RECORD,
THUMB2_RECORD
};
-
static int
-arm_record_strx (arm_insn_decode_record *arm_insn_r, uint32_t *record_buf,
+arm_record_strx (arm_insn_decode_record *arm_insn_r, uint32_t *record_buf,
uint32_t *record_buf_mem, arm_record_strx_t str_type)
{
-
struct regcache *reg_cache = arm_insn_r->regcache;
- ULONGEST u_regval[2]= {0};
+ ULONGEST u_regval[2] = { 0 };
uint32_t reg_src1 = 0, reg_src2 = 0;
- uint32_t immed_high = 0, immed_low = 0,offset_8 = 0, tgt_mem_addr = 0;
+ uint32_t immed_high = 0, immed_low = 0, offset_8 = 0, tgt_mem_addr = 0;
arm_insn_r->opcode = bits (arm_insn_r->arm_insn, 21, 24);
arm_insn_r->decode = bits (arm_insn_r->arm_insn, 4, 7);
@@ -11208,8 +11188,7 @@ arm_record_strx (arm_insn_decode_record *arm_insn_r, uint32_t *record_buf,
immed_low = bits (arm_insn_r->arm_insn, 0, 3);
immed_high = bits (arm_insn_r->arm_insn, 8, 11);
reg_src1 = bits (arm_insn_r->arm_insn, 16, 19);
- regcache_raw_read_unsigned (reg_cache, reg_src1,
- &u_regval[0]);
+ regcache_raw_read_unsigned (reg_cache, reg_src1, &u_regval[0]);
if (ARM_PC_REGNUM == reg_src1)
{
/* If R15 was used as Rn, hence current PC+8. */
@@ -11279,7 +11258,7 @@ arm_record_strx (arm_insn_decode_record *arm_insn_r, uint32_t *record_buf,
}
}
else if (11 == arm_insn_r->opcode || 15 == arm_insn_r->opcode
- || 2 == arm_insn_r->opcode || 6 == arm_insn_r->opcode)
+ || 2 == arm_insn_r->opcode || 6 == arm_insn_r->opcode)
{
/* 3) Store, immediate pre-indexed. */
/* 5) Store, immediate post-indexed. */
@@ -11359,14 +11338,14 @@ arm_record_strx (arm_insn_decode_record *arm_insn_r, uint32_t *record_buf,
static int
arm_record_extension_space (arm_insn_decode_record *arm_insn_r)
{
- int ret = 0; /* Return value: -1:record failure ; 0:success */
+ int ret = 0; /* Return value: -1:record failure ; 0:success */
uint32_t opcode1 = 0, opcode2 = 0, insn_op1 = 0;
uint32_t record_buf[8], record_buf_mem[8];
uint32_t reg_src1 = 0;
struct regcache *reg_cache = arm_insn_r->regcache;
ULONGEST u_regval = 0;
- gdb_assert (!INSN_RECORDED(arm_insn_r));
+ gdb_assert (!INSN_RECORDED (arm_insn_r));
/* Handle unconditional insn extension space. */
opcode1 = bits (arm_insn_r->arm_insn, 20, 27);
@@ -11385,7 +11364,6 @@ arm_record_extension_space (arm_insn_decode_record *arm_insn_r)
/* STC2, LDC2, MCR2, MRC2, CDP2: <TBD>, co-processor insn. */
}
-
opcode1 = bits (arm_insn_r->arm_insn, 25, 27);
if (3 == opcode1 && bit (arm_insn_r->arm_insn, 4))
{
@@ -11400,7 +11378,7 @@ arm_record_extension_space (arm_insn_decode_record *arm_insn_r)
/* Handle arithmetic insn extension space. */
if (!opcode1 && 9 == opcode2 && 1 != arm_insn_r->cond
- && !INSN_RECORDED(arm_insn_r))
+ && !INSN_RECORDED (arm_insn_r))
{
/* Handle MLA(S) and MUL(S). */
if (in_inclusive_range (insn_op1, 0U, 3U))
@@ -11426,9 +11404,9 @@ arm_record_extension_space (arm_insn_decode_record *arm_insn_r)
/* Handle control insn extension space. */
if (!opcode1 && 2 == opcode2 && !bit (arm_insn_r->arm_insn, 20)
- && 1 != arm_insn_r->cond && !INSN_RECORDED(arm_insn_r))
+ && 1 != arm_insn_r->cond && !INSN_RECORDED (arm_insn_r))
{
- if (!bit (arm_insn_r->arm_insn,25))
+ if (!bit (arm_insn_r->arm_insn, 25))
{
if (!bits (arm_insn_r->arm_insn, 4, 7))
{
@@ -11490,11 +11468,10 @@ arm_record_extension_space (arm_insn_decode_record *arm_insn_r)
/* Save SPSR also;how? */
return -1;
}
- else if(8 == bits (arm_insn_r->arm_insn, 4, 7)
- || 10 == bits (arm_insn_r->arm_insn, 4, 7)
- || 12 == bits (arm_insn_r->arm_insn, 4, 7)
- || 14 == bits (arm_insn_r->arm_insn, 4, 7)
- )
+ else if (8 == bits (arm_insn_r->arm_insn, 4, 7)
+ || 10 == bits (arm_insn_r->arm_insn, 4, 7)
+ || 12 == bits (arm_insn_r->arm_insn, 4, 7)
+ || 14 == bits (arm_insn_r->arm_insn, 4, 7))
{
if (0 == insn_op1 || 1 == insn_op1)
{
@@ -11544,9 +11521,9 @@ arm_record_extension_space (arm_insn_decode_record *arm_insn_r)
/* Handle load/store insn extension space. */
- if (!opcode1 && bit (arm_insn_r->arm_insn, 7)
+ if (!opcode1 && bit (arm_insn_r->arm_insn, 7)
&& bit (arm_insn_r->arm_insn, 4) && 1 != arm_insn_r->cond
- && !INSN_RECORDED(arm_insn_r))
+ && !INSN_RECORDED (arm_insn_r))
{
/* SWP/SWPB. */
if (0 == insn_op1)
@@ -11574,8 +11551,8 @@ arm_record_extension_space (arm_insn_decode_record *arm_insn_r)
else if (1 == insn_op1 && !bit (arm_insn_r->arm_insn, 20))
{
/* STRH. */
- arm_record_strx(arm_insn_r, &record_buf[0], &record_buf_mem[0],
- ARM_RECORD_STRH);
+ arm_record_strx (arm_insn_r, &record_buf[0], &record_buf_mem[0],
+ ARM_RECORD_STRH);
}
else if (2 == insn_op1 && !bit (arm_insn_r->arm_insn, 20))
{
@@ -11587,8 +11564,8 @@ arm_record_extension_space (arm_insn_decode_record *arm_insn_r)
else if (3 == insn_op1 && !bit (arm_insn_r->arm_insn, 20))
{
/* STRD. */
- arm_record_strx(arm_insn_r, &record_buf[0], &record_buf_mem[0],
- ARM_RECORD_STRD);
+ arm_record_strx (arm_insn_r, &record_buf[0], &record_buf_mem[0],
+ ARM_RECORD_STRD);
}
else if (bit (arm_insn_r->arm_insn, 20) && insn_op1 <= 3)
{
@@ -11596,12 +11573,11 @@ arm_record_extension_space (arm_insn_decode_record *arm_insn_r)
record_buf[0] = bits (arm_insn_r->arm_insn, 12, 15);
arm_insn_r->reg_rec_count = 1;
}
-
}
opcode1 = bits (arm_insn_r->arm_insn, 23, 27);
if (24 == opcode1 && bit (arm_insn_r->arm_insn, 21)
- && !INSN_RECORDED(arm_insn_r))
+ && !INSN_RECORDED (arm_insn_r))
{
ret = -1;
/* Handle coprocessor insn extension space. */
@@ -11624,7 +11600,7 @@ arm_record_data_proc_misc_ld_str (arm_insn_decode_record *arm_insn_r)
{
struct regcache *reg_cache = arm_insn_r->regcache;
uint32_t record_buf[8], record_buf_mem[8];
- ULONGEST u_regval[2] = {0};
+ ULONGEST u_regval[2] = { 0 };
uint32_t reg_src1 = 0;
uint32_t opcode1 = 0;
@@ -11724,7 +11700,7 @@ arm_record_data_proc_misc_ld_str (arm_insn_decode_record *arm_insn_r)
arm_insn_r->reg_rec_count = 3;
}
}
- else if (9 == arm_insn_r->decode && opcode1 > 0x10)
+ else if (9 == arm_insn_r->decode && opcode1 > 0x10)
{
/* Synchronization primitives */
@@ -11922,8 +11898,7 @@ arm_record_data_proc_imm (arm_insn_decode_record *arm_insn_r)
if ((9 == arm_insn_r->opcode || 11 == arm_insn_r->opcode)
&& 2 == bits (arm_insn_r->arm_insn, 20, 21)
- && sbo_sbz (arm_insn_r->arm_insn, 13, 4, 1)
- )
+ && sbo_sbz (arm_insn_r->arm_insn, 13, 4, 1))
{
/* Handle MSR insn. */
if (9 == arm_insn_r->opcode)
@@ -12045,7 +12020,7 @@ arm_record_ld_st_imm_offset (arm_insn_decode_record *arm_insn_r)
{
struct regcache *reg_cache = arm_insn_r->regcache;
- uint32_t reg_base , reg_dest;
+ uint32_t reg_base, reg_dest;
uint32_t offset_12, tgt_mem_addr;
uint32_t record_buf[8], record_buf_mem[8];
unsigned char wback;
@@ -12176,7 +12151,7 @@ arm_record_ld_st_reg_offset (arm_insn_decode_record *arm_insn_r)
}
else
{
- if (! bits (arm_insn_r->arm_insn, 4, 11))
+ if (!bits (arm_insn_r->arm_insn, 4, 11))
{
/* Store insn, register offset and register pre-indexed,
register post-indexed. */
@@ -12184,15 +12159,13 @@ arm_record_ld_st_reg_offset (arm_insn_decode_record *arm_insn_r)
reg_src1 = bits (arm_insn_r->arm_insn, 0, 3);
/* Get Rn. */
reg_src2 = bits (arm_insn_r->arm_insn, 16, 19);
- regcache_raw_read_unsigned (reg_cache, reg_src1
- , &u_regval[0]);
- regcache_raw_read_unsigned (reg_cache, reg_src2
- , &u_regval[1]);
+ regcache_raw_read_unsigned (reg_cache, reg_src1, &u_regval[0]);
+ regcache_raw_read_unsigned (reg_cache, reg_src2, &u_regval[1]);
if (15 == reg_src2)
{
/* If R15 was used as Rn, hence current PC+8. */
/* Pre-indexed mode doesnt reach here ; illegal insn. */
- u_regval[0] = u_regval[0] + 8;
+ u_regval[0] = u_regval[0] + 8;
}
/* Calculate target store address, Rn +/- Rm, register offset. */
/* U == 1. */
@@ -12207,38 +12180,38 @@ arm_record_ld_st_reg_offset (arm_insn_decode_record *arm_insn_r)
switch (arm_insn_r->opcode)
{
- /* STR. */
- case 8:
- case 12:
- /* STR. */
- case 9:
- case 13:
- /* STRT. */
- case 1:
- case 5:
- /* STR. */
- case 0:
- case 4:
- record_buf_mem[0] = 4;
+ /* STR. */
+ case 8:
+ case 12:
+ /* STR. */
+ case 9:
+ case 13:
+ /* STRT. */
+ case 1:
+ case 5:
+ /* STR. */
+ case 0:
+ case 4:
+ record_buf_mem[0] = 4;
break;
- /* STRB. */
- case 10:
- case 14:
- /* STRB. */
- case 11:
- case 15:
- /* STRBT. */
- case 3:
- case 7:
- /* STRB. */
- case 2:
- case 6:
- record_buf_mem[0] = 1;
+ /* STRB. */
+ case 10:
+ case 14:
+ /* STRB. */
+ case 11:
+ case 15:
+ /* STRBT. */
+ case 3:
+ case 7:
+ /* STRB. */
+ case 2:
+ case 6:
+ record_buf_mem[0] = 1;
break;
- default:
- gdb_assert_not_reached ("no decoding pattern found");
+ default:
+ gdb_assert_not_reached ("no decoding pattern found");
break;
}
record_buf_mem[1] = tgt_mem_addr;
@@ -12249,8 +12222,7 @@ arm_record_ld_st_reg_offset (arm_insn_decode_record *arm_insn_r)
|| 0 == arm_insn_r->opcode || 2 == arm_insn_r->opcode
|| 4 == arm_insn_r->opcode || 6 == arm_insn_r->opcode
|| 1 == arm_insn_r->opcode || 3 == arm_insn_r->opcode
- || 5 == arm_insn_r->opcode || 7 == arm_insn_r->opcode
- )
+ || 5 == arm_insn_r->opcode || 7 == arm_insn_r->opcode)
{
/* Rn is going to be changed in pre-indexed mode and
post-indexed mode as well. */
@@ -12274,53 +12246,53 @@ arm_record_ld_st_reg_offset (arm_insn_decode_record *arm_insn_r)
/* Offset_12 used as shift. */
switch (offset_12)
{
- case 0:
- /* Offset_12 used as index. */
- offset_12 = u_regval[0] << shift_imm;
+ case 0:
+ /* Offset_12 used as index. */
+ offset_12 = u_regval[0] << shift_imm;
break;
- case 1:
- offset_12 = (!shift_imm)?0:u_regval[0] >> shift_imm;
+ case 1:
+ offset_12 = (!shift_imm) ? 0 : u_regval[0] >> shift_imm;
break;
- case 2:
- if (!shift_imm)
- {
- if (bit (u_regval[0], 31))
- {
- offset_12 = 0xFFFFFFFF;
- }
- else
- {
- offset_12 = 0;
- }
- }
- else
- {
- /* This is arithmetic shift. */
- offset_12 = s_word >> shift_imm;
- }
- break;
+ case 2:
+ if (!shift_imm)
+ {
+ if (bit (u_regval[0], 31))
+ {
+ offset_12 = 0xFFFFFFFF;
+ }
+ else
+ {
+ offset_12 = 0;
+ }
+ }
+ else
+ {
+ /* This is arithmetic shift. */
+ offset_12 = s_word >> shift_imm;
+ }
+ break;
- case 3:
- if (!shift_imm)
- {
- regcache_raw_read_unsigned (reg_cache, ARM_PS_REGNUM,
- &u_regval[1]);
- /* Get C flag value and shift it by 31. */
- offset_12 = (((bit (u_regval[1], 29)) << 31) \
- | (u_regval[0]) >> 1);
- }
- else
- {
- offset_12 = (u_regval[0] >> shift_imm) \
- | (u_regval[0] <<
- (sizeof(uint32_t) - shift_imm));
- }
+ case 3:
+ if (!shift_imm)
+ {
+ regcache_raw_read_unsigned (reg_cache, ARM_PS_REGNUM,
+ &u_regval[1]);
+ /* Get C flag value and shift it by 31. */
+ offset_12
+ = (((bit (u_regval[1], 29)) << 31) | (u_regval[0]) >> 1);
+ }
+ else
+ {
+ offset_12
+ = (u_regval[0] >> shift_imm)
+ | (u_regval[0] << (sizeof (uint32_t) - shift_imm));
+ }
break;
- default:
- gdb_assert_not_reached ("no decoding pattern found");
+ default:
+ gdb_assert_not_reached ("no decoding pattern found");
break;
}
@@ -12337,38 +12309,38 @@ arm_record_ld_st_reg_offset (arm_insn_decode_record *arm_insn_r)
switch (arm_insn_r->opcode)
{
- /* STR. */
- case 8:
- case 12:
- /* STR. */
- case 9:
- case 13:
- /* STRT. */
- case 1:
- case 5:
- /* STR. */
- case 0:
- case 4:
- record_buf_mem[0] = 4;
+ /* STR. */
+ case 8:
+ case 12:
+ /* STR. */
+ case 9:
+ case 13:
+ /* STRT. */
+ case 1:
+ case 5:
+ /* STR. */
+ case 0:
+ case 4:
+ record_buf_mem[0] = 4;
break;
- /* STRB. */
- case 10:
- case 14:
- /* STRB. */
- case 11:
- case 15:
- /* STRBT. */
- case 3:
- case 7:
- /* STRB. */
- case 2:
- case 6:
- record_buf_mem[0] = 1;
+ /* STRB. */
+ case 10:
+ case 14:
+ /* STRB. */
+ case 11:
+ case 15:
+ /* STRBT. */
+ case 3:
+ case 7:
+ /* STRB. */
+ case 2:
+ case 6:
+ record_buf_mem[0] = 1;
break;
- default:
- gdb_assert_not_reached ("no decoding pattern found");
+ default:
+ gdb_assert_not_reached ("no decoding pattern found");
break;
}
record_buf_mem[1] = tgt_mem_addr;
@@ -12379,8 +12351,7 @@ arm_record_ld_st_reg_offset (arm_insn_decode_record *arm_insn_r)
|| 0 == arm_insn_r->opcode || 2 == arm_insn_r->opcode
|| 4 == arm_insn_r->opcode || 6 == arm_insn_r->opcode
|| 1 == arm_insn_r->opcode || 3 == arm_insn_r->opcode
- || 5 == arm_insn_r->opcode || 7 == arm_insn_r->opcode
- )
+ || 5 == arm_insn_r->opcode || 7 == arm_insn_r->opcode)
{
/* Rn is going to be changed in register scaled pre-indexed
mode,and scaled post indexed mode. */
@@ -12431,7 +12402,6 @@ arm_record_ld_st_multiple (arm_insn_decode_record *arm_insn_r)
register_count++;
}
-
/* If wback is true, also save the base register, which is going to be
written to. */
if (wback)
@@ -12444,7 +12414,7 @@ arm_record_ld_st_multiple (arm_insn_decode_record *arm_insn_r)
{
/* STM (STMIA, STMEA), STMDA (STMED), STMDB (STMFD) and STMIB (STMFA). */
- addr_mode = bits (arm_insn_r->arm_insn, 23, 24);
+ addr_mode = bits (arm_insn_r->arm_insn, 23, 24);
regcache_raw_read_unsigned (reg_cache, reg_base, &u_regval);
@@ -12458,26 +12428,26 @@ arm_record_ld_st_multiple (arm_insn_decode_record *arm_insn_r)
switch (addr_mode)
{
- /* STMDA (STMED): Decrement after. */
- case 0:
- record_buf_mem[1] = (uint32_t) u_regval
- - register_count * ARM_INT_REGISTER_SIZE + 4;
+ /* STMDA (STMED): Decrement after. */
+ case 0:
+ record_buf_mem[1]
+ = (uint32_t) u_regval - register_count * ARM_INT_REGISTER_SIZE + 4;
break;
- /* STM (STMIA, STMEA): Increment after. */
- case 1:
+ /* STM (STMIA, STMEA): Increment after. */
+ case 1:
record_buf_mem[1] = (uint32_t) u_regval;
break;
- /* STMDB (STMFD): Decrement before. */
- case 2:
- record_buf_mem[1] = (uint32_t) u_regval
- - register_count * ARM_INT_REGISTER_SIZE;
+ /* STMDB (STMFD): Decrement before. */
+ case 2:
+ record_buf_mem[1]
+ = (uint32_t) u_regval - register_count * ARM_INT_REGISTER_SIZE;
break;
- /* STMIB (STMFA): Increment before. */
- case 3:
+ /* STMIB (STMFA): Increment before. */
+ case 3:
record_buf_mem[1] = (uint32_t) u_regval + ARM_INT_REGISTER_SIZE;
break;
- default:
- gdb_assert_not_reached ("no decoding pattern found");
+ default:
+ gdb_assert_not_reached ("no decoding pattern found");
break;
}
@@ -12521,8 +12491,9 @@ static int
arm_record_unsupported_insn (arm_insn_decode_record *arm_insn_r)
{
gdb_printf (gdb_stderr,
- _("Process record does not support instruction "
- "0x%0x at address %s.\n"),arm_insn_r->arm_insn,
+ _ ("Process record does not support instruction "
+ "0x%0x at address %s.\n"),
+ arm_insn_r->arm_insn,
paddress (arm_insn_r->gdbarch, arm_insn_r->this_addr));
return -1;
@@ -12587,8 +12558,8 @@ arm_record_vdata_transfer_insn (arm_insn_decode_record *arm_insn_r)
/* Handle VMOV instruction. */
if (!(bits_a & 0x04))
{
- record_buf[0] = (reg_v | (bit (arm_insn_r->arm_insn, 7) << 4))
- + ARM_D0_REGNUM;
+ record_buf[0]
+ = (reg_v | (bit (arm_insn_r->arm_insn, 7) << 4)) + ARM_D0_REGNUM;
arm_insn_r->reg_rec_count = 1;
}
/* Handle VDUP instruction. */
@@ -12739,7 +12710,7 @@ arm_record_exreg_ld_st_insn (arm_insn_decode_record *arm_insn_r)
be divided by 2, according to the ARM Architecture Reference
Manual. If the instruction loads memory to S register, divide by
2 as well because two S registers are mapped to D register. */
- reg_count = reg_count / 2;
+ reg_count = reg_count / 2;
if (single_reg && bit_d)
{
/* Increase the register count if S register list starts from
@@ -12816,7 +12787,15 @@ arm_record_vfp_data_proc_insn (arm_insn_decode_record *arm_insn_r)
{
uint32_t opc1, opc2, opc3, dp_op_sz, bit_d, reg_vd;
uint32_t record_buf[4];
- enum insn_types {INSN_T0, INSN_T1, INSN_T2, INSN_T3, INSN_INV};
+
+ enum insn_types
+ {
+ INSN_T0,
+ INSN_T1,
+ INSN_T2,
+ INSN_T3,
+ INSN_INV
+ };
enum insn_types curr_insn_type = INSN_INV;
reg_vd = bits (arm_insn_r->arm_insn, 12, 15);
@@ -12921,7 +12900,7 @@ arm_record_vfp_data_proc_insn (arm_insn_decode_record *arm_insn_r)
}
/* Handle VNEG and VABS. */
else if ((opc2 == 0x01 && opc3 == 0x01)
- || (opc2 == 0x00 && opc3 == 0x03))
+ || (opc2 == 0x00 && opc3 == 0x03))
{
if (!bit (arm_insn_r->arm_insn, 11))
{
@@ -12988,33 +12967,33 @@ arm_record_vfp_data_proc_insn (arm_insn_decode_record *arm_insn_r)
switch (curr_insn_type)
{
- case INSN_T0:
- reg_vd = reg_vd | (bit_d << 4);
- record_buf[0] = reg_vd + ARM_D0_REGNUM;
- record_buf[1] = reg_vd + ARM_D0_REGNUM + 1;
- arm_insn_r->reg_rec_count = 2;
- break;
+ case INSN_T0:
+ reg_vd = reg_vd | (bit_d << 4);
+ record_buf[0] = reg_vd + ARM_D0_REGNUM;
+ record_buf[1] = reg_vd + ARM_D0_REGNUM + 1;
+ arm_insn_r->reg_rec_count = 2;
+ break;
- case INSN_T1:
- reg_vd = reg_vd | (bit_d << 4);
- record_buf[0] = reg_vd + ARM_D0_REGNUM;
- arm_insn_r->reg_rec_count = 1;
- break;
+ case INSN_T1:
+ reg_vd = reg_vd | (bit_d << 4);
+ record_buf[0] = reg_vd + ARM_D0_REGNUM;
+ arm_insn_r->reg_rec_count = 1;
+ break;
- case INSN_T2:
- reg_vd = (reg_vd << 1) | bit_d;
- record_buf[0] = reg_vd + ARM_D0_REGNUM;
- arm_insn_r->reg_rec_count = 1;
- break;
+ case INSN_T2:
+ reg_vd = (reg_vd << 1) | bit_d;
+ record_buf[0] = reg_vd + ARM_D0_REGNUM;
+ arm_insn_r->reg_rec_count = 1;
+ break;
- case INSN_T3:
- record_buf[0] = ARM_FPSCR_REGNUM;
- arm_insn_r->reg_rec_count = 1;
- break;
+ case INSN_T3:
+ record_buf[0] = ARM_FPSCR_REGNUM;
+ arm_insn_r->reg_rec_count = 1;
+ break;
- default:
- gdb_assert_not_reached ("no decoding pattern found");
- break;
+ default:
+ gdb_assert_not_reached ("no decoding pattern found");
+ break;
}
REG_ALLOC (arm_insn_r->arm_regs, arm_insn_r->reg_rec_count, record_buf);
@@ -13070,7 +13049,7 @@ arm_record_asimd_vfp_coproc (arm_insn_decode_record *arm_insn_r)
REG_ALLOC (arm_insn_r->arm_regs, arm_insn_r->reg_rec_count, reg_t);
return 0;
- }
+ }
}
return arm_record_unsupported_insn (arm_insn_r);
}
@@ -13100,7 +13079,7 @@ arm_record_coproc_data_proc (arm_insn_decode_record *arm_insn_r)
svc_operand = (0x00ffffff & arm_insn_r->arm_insn);
- if (svc_operand) /* OABI. */
+ if (svc_operand) /* OABI. */
svc_number = svc_operand - 0x900000;
else /* EABI. */
regcache_raw_read_unsigned (reg_cache, 7, &svc_number);
@@ -13109,7 +13088,7 @@ arm_record_coproc_data_proc (arm_insn_decode_record *arm_insn_r)
}
else
{
- gdb_printf (gdb_stderr, _("no syscall record support\n"));
+ gdb_printf (gdb_stderr, _ ("no syscall record support\n"));
return -1;
}
}
@@ -13225,7 +13204,6 @@ thumb_record_shift_add_sub (arm_insn_decode_record *thumb_insn_r)
return 0;
}
-
/* Handling opcode 001 insns. */
static int
@@ -13250,13 +13228,13 @@ thumb_record_add_sub_cmp_mov (arm_insn_decode_record *thumb_insn_r)
static int
thumb_record_ld_st_reg_offset (arm_insn_decode_record *thumb_insn_r)
{
- struct regcache *reg_cache = thumb_insn_r->regcache;
+ struct regcache *reg_cache = thumb_insn_r->regcache;
uint32_t record_buf[8], record_buf_mem[8];
uint32_t reg_src1 = 0, reg_src2 = 0;
uint32_t opcode1 = 0, opcode2 = 0, opcode3 = 0;
- ULONGEST u_regval[2] = {0};
+ ULONGEST u_regval[2] = { 0 };
opcode1 = bits (thumb_insn_r->arm_insn, 10, 12);
@@ -13268,7 +13246,7 @@ thumb_record_ld_st_reg_offset (arm_insn_decode_record *thumb_insn_r)
if (in_inclusive_range (opB, 4U, 7U))
{
/* LDR(2), LDRB(2) , LDRH(2), LDRSB, LDRSH. */
- reg_src1 = bits (thumb_insn_r->arm_insn,0, 2);
+ reg_src1 = bits (thumb_insn_r->arm_insn, 0, 2);
record_buf[0] = reg_src1;
thumb_insn_r->reg_rec_count = 1;
}
@@ -13280,11 +13258,11 @@ thumb_record_ld_st_reg_offset (arm_insn_decode_record *thumb_insn_r)
regcache_raw_read_unsigned (reg_cache, reg_src1, &u_regval[0]);
regcache_raw_read_unsigned (reg_cache, reg_src2, &u_regval[1]);
if (0 == opB)
- record_buf_mem[0] = 4; /* STR (2). */
+ record_buf_mem[0] = 4; /* STR (2). */
else if (2 == opB)
- record_buf_mem[0] = 1; /* STRB (2). */
+ record_buf_mem[0] = 1; /* STRB (2). */
else if (1 == opB)
- record_buf_mem[0] = 2; /* STRH (2). */
+ record_buf_mem[0] = 2; /* STRH (2). */
record_buf_mem[1] = u_regval[0] + u_regval[1];
thumb_insn_r->mem_rec_count = 1;
}
@@ -13371,7 +13349,7 @@ thumb_record_ld_st_imm_offset (arm_insn_decode_record *thumb_insn_r)
}
REG_ALLOC (thumb_insn_r->arm_regs, thumb_insn_r->reg_rec_count, record_buf);
- MEM_ALLOC (thumb_insn_r->arm_mems, thumb_insn_r->mem_rec_count,
+ MEM_ALLOC (thumb_insn_r->arm_mems, thumb_insn_r->mem_rec_count,
record_buf_mem);
return 0;
@@ -13496,8 +13474,9 @@ thumb_record_misc (arm_insn_decode_record *thumb_insn_r)
register_count++;
register_bits = register_bits >> 1;
}
- start_address = u_regval - \
- (4 * (bit (thumb_insn_r->arm_insn, 8) + register_count));
+ start_address
+ = u_regval
+ - (4 * (bit (thumb_insn_r->arm_insn, 8) + register_count));
thumb_insn_r->mem_rec_count = register_count;
while (register_count)
{
@@ -13542,8 +13521,8 @@ thumb_record_misc (arm_insn_decode_record *thumb_insn_r)
thumb_insn_r->reg_rec_count = 2;
/* We need to save SPSR value, which is not yet done. */
gdb_printf (gdb_stderr,
- _("Process record does not support instruction "
- "0x%0x at address %s.\n"),
+ _ ("Process record does not support instruction "
+ "0x%0x at address %s.\n"),
thumb_insn_r->arm_insn,
paddress (thumb_insn_r->gdbarch,
thumb_insn_r->this_addr));
@@ -13570,10 +13549,11 @@ static int
thumb_record_ldm_stm_swi (arm_insn_decode_record *thumb_insn_r)
{
arm_gdbarch_tdep *tdep
- = gdbarch_tdep<arm_gdbarch_tdep> (thumb_insn_r->gdbarch);
+ = gdbarch_tdep<arm_gdbarch_tdep> (thumb_insn_r->gdbarch);
struct regcache *reg_cache = thumb_insn_r->regcache;
- uint32_t ret = 0; /* function return value: -1:record failure ; 0:success */
+ uint32_t ret
+ = 0; /* function return value: -1:record failure ; 0:success */
uint32_t reg_src1 = 0;
uint32_t opcode1 = 0, opcode2 = 0, register_bits = 0, register_count = 0;
uint32_t index = 0, start_address = 0;
@@ -13586,7 +13566,6 @@ thumb_record_ldm_stm_swi (arm_insn_decode_record *thumb_insn_r)
if (1 == opcode2)
{
-
/* LDMIA. */
register_bits = bits (thumb_insn_r->arm_insn, 0, 7);
/* Get Rn. */
@@ -13626,17 +13605,17 @@ thumb_record_ldm_stm_swi (arm_insn_decode_record *thumb_insn_r)
}
else if (0x1F == opcode1)
{
- /* Handle arm syscall insn. */
- if (tdep->arm_syscall_record != NULL)
- {
- regcache_raw_read_unsigned (reg_cache, 7, &u_regval);
- ret = tdep->arm_syscall_record (reg_cache, u_regval);
- }
- else
- {
- gdb_printf (gdb_stderr, _("no syscall record support\n"));
- return -1;
- }
+ /* Handle arm syscall insn. */
+ if (tdep->arm_syscall_record != NULL)
+ {
+ regcache_raw_read_unsigned (reg_cache, 7, &u_regval);
+ ret = tdep->arm_syscall_record (reg_cache, u_regval);
+ }
+ else
+ {
+ gdb_printf (gdb_stderr, _ ("no syscall record support\n"));
+ return -1;
+ }
}
/* B (1), conditional branch is automatically taken care in process_record,
@@ -13678,7 +13657,7 @@ thumb_record_branch (arm_insn_decode_record *thumb_insn_r)
REG_ALLOC (thumb_insn_r->arm_regs, thumb_insn_r->reg_rec_count, record_buf);
- return 0;
+ return 0;
}
/* Handler for thumb2 load/store multiple instructions. */
@@ -13769,9 +13748,9 @@ thumb2_record_ld_st_multiple (arm_insn_decode_record *thumb2_insn_r)
}
MEM_ALLOC (thumb2_insn_r->arm_mems, thumb2_insn_r->mem_rec_count,
- record_buf_mem);
+ record_buf_mem);
REG_ALLOC (thumb2_insn_r->arm_regs, thumb2_insn_r->reg_rec_count,
- record_buf);
+ record_buf);
return ARM_RECORD_SUCCESS;
}
@@ -13797,7 +13776,7 @@ thumb2_record_ld_st_dual_ex_tbb (arm_insn_decode_record *thumb2_insn_r)
if (bit (thumb2_insn_r->arm_insn, INSN_S_L_BIT_NUM))
{
- if(!(1 == op1 && 1 == op2 && (0 == op3 || 1 == op3)))
+ if (!(1 == op1 && 1 == op2 && (0 == op3 || 1 == op3)))
{
reg_dest1 = bits (thumb2_insn_r->arm_insn, 12, 15);
record_buf[0] = reg_dest1;
@@ -13846,7 +13825,7 @@ thumb2_record_ld_st_dual_ex_tbb (arm_insn_decode_record *thumb2_insn_r)
else if (5 == op3)
{
/* Handle STREXH. */
- record_buf_mem[0] = 2 ;
+ record_buf_mem[0] = 2;
thumb2_insn_r->mem_rec_count = 1;
}
else if (7 == op3)
@@ -13886,9 +13865,9 @@ thumb2_record_ld_st_dual_ex_tbb (arm_insn_decode_record *thumb2_insn_r)
}
REG_ALLOC (thumb2_insn_r->arm_regs, thumb2_insn_r->reg_rec_count,
- record_buf);
+ record_buf);
MEM_ALLOC (thumb2_insn_r->arm_mems, thumb2_insn_r->mem_rec_count,
- record_buf_mem);
+ record_buf_mem);
return ARM_RECORD_SUCCESS;
}
@@ -13917,7 +13896,7 @@ thumb2_record_data_proc_sreg_mimm (arm_insn_decode_record *thumb2_insn_r)
}
REG_ALLOC (thumb2_insn_r->arm_regs, thumb2_insn_r->reg_rec_count,
- record_buf);
+ record_buf);
return ARM_RECORD_SUCCESS;
}
@@ -13937,7 +13916,7 @@ thumb2_record_ps_dest_generic (arm_insn_decode_record *thumb2_insn_r)
thumb2_insn_r->reg_rec_count = 2;
REG_ALLOC (thumb2_insn_r->arm_regs, thumb2_insn_r->reg_rec_count,
- record_buf);
+ record_buf);
return ARM_RECORD_SUCCESS;
}
@@ -13964,7 +13943,7 @@ thumb2_record_branch_misc_cntrl (arm_insn_decode_record *thumb2_insn_r)
}
else
{
- arm_record_unsupported_insn(thumb2_insn_r);
+ arm_record_unsupported_insn (thumb2_insn_r);
return -1;
}
}
@@ -13977,7 +13956,7 @@ thumb2_record_branch_misc_cntrl (arm_insn_decode_record *thumb2_insn_r)
}
REG_ALLOC (thumb2_insn_r->arm_regs, thumb2_insn_r->reg_rec_count,
- record_buf);
+ record_buf);
return ARM_RECORD_SUCCESS;
}
@@ -14038,25 +14017,25 @@ thumb2_record_str_single_data (arm_insn_decode_record *thumb2_insn_r)
switch (op1)
{
- /* Store byte instructions. */
- case 4:
- case 0:
- record_buf_mem[0] = 1;
- break;
- /* Store half word instructions. */
- case 1:
- case 5:
- record_buf_mem[0] = 2;
- break;
- /* Store word instructions. */
- case 2:
- case 6:
- record_buf_mem[0] = 4;
- break;
+ /* Store byte instructions. */
+ case 4:
+ case 0:
+ record_buf_mem[0] = 1;
+ break;
+ /* Store half word instructions. */
+ case 1:
+ case 5:
+ record_buf_mem[0] = 2;
+ break;
+ /* Store word instructions. */
+ case 2:
+ case 6:
+ record_buf_mem[0] = 4;
+ break;
- default:
- gdb_assert_not_reached ("no decoding pattern found");
- break;
+ default:
+ gdb_assert_not_reached ("no decoding pattern found");
+ break;
}
record_buf_mem[1] = address;
@@ -14065,9 +14044,9 @@ thumb2_record_str_single_data (arm_insn_decode_record *thumb2_insn_r)
thumb2_insn_r->reg_rec_count = 1;
REG_ALLOC (thumb2_insn_r->arm_regs, thumb2_insn_r->reg_rec_count,
- record_buf);
+ record_buf);
MEM_ALLOC (thumb2_insn_r->arm_mems, thumb2_insn_r->mem_rec_count,
- record_buf_mem);
+ record_buf_mem);
return ARM_RECORD_SUCCESS;
}
@@ -14090,7 +14069,7 @@ thumb2_record_ld_mem_hints (arm_insn_decode_record *thumb2_insn_r)
thumb2_insn_r->reg_rec_count = 3;
REG_ALLOC (thumb2_insn_r->arm_regs, thumb2_insn_r->reg_rec_count,
- record_buf);
+ record_buf);
return ARM_RECORD_SUCCESS;
}
@@ -14109,7 +14088,7 @@ thumb2_record_ld_word (arm_insn_decode_record *thumb2_insn_r)
thumb2_insn_r->reg_rec_count = 2;
REG_ALLOC (thumb2_insn_r->arm_regs, thumb2_insn_r->reg_rec_count,
- record_buf);
+ record_buf);
return ARM_RECORD_SUCCESS;
}
@@ -14146,7 +14125,7 @@ thumb2_record_lmul_lmla_div (arm_insn_decode_record *thumb2_insn_r)
return ARM_RECORD_FAILURE;
REG_ALLOC (thumb2_insn_r->arm_regs, thumb2_insn_r->reg_rec_count,
- record_buf);
+ record_buf);
return ARM_RECORD_SUCCESS;
}
@@ -14231,7 +14210,8 @@ thumb2_record_asimd_struct_ld_st (arm_insn_decode_record *thumb2_insn_r)
for (loop_t = 0; loop_t < 2; loop_t++)
{
record_buf_mem[index_m++] = f_ebytes;
- record_buf_mem[index_m++] = address + (loop_t * f_ebytes);
+ record_buf_mem[index_m++]
+ = address + (loop_t * f_ebytes);
thumb2_insn_r->mem_rec_count += 1;
}
address = address + (2 * f_ebytes);
@@ -14245,7 +14225,8 @@ thumb2_record_asimd_struct_ld_st (arm_insn_decode_record *thumb2_insn_r)
for (loop_t = 0; loop_t < 3; loop_t++)
{
record_buf_mem[index_m++] = f_ebytes;
- record_buf_mem[index_m++] = address + (loop_t * f_ebytes);
+ record_buf_mem[index_m++]
+ = address + (loop_t * f_ebytes);
thumb2_insn_r->mem_rec_count += 1;
}
address = address + (3 * f_ebytes);
@@ -14259,7 +14240,8 @@ thumb2_record_asimd_struct_ld_st (arm_insn_decode_record *thumb2_insn_r)
for (loop_t = 0; loop_t < 4; loop_t++)
{
record_buf_mem[index_m++] = f_ebytes;
- record_buf_mem[index_m++] = address + (loop_t * f_ebytes);
+ record_buf_mem[index_m++]
+ = address + (loop_t * f_ebytes);
thumb2_insn_r->mem_rec_count += 1;
}
address = address + (4 * f_ebytes);
@@ -14343,9 +14325,9 @@ thumb2_record_asimd_struct_ld_st (arm_insn_decode_record *thumb2_insn_r)
}
REG_ALLOC (thumb2_insn_r->arm_regs, thumb2_insn_r->reg_rec_count,
- record_buf);
+ record_buf);
MEM_ALLOC (thumb2_insn_r->arm_mems, thumb2_insn_r->mem_rec_count,
- record_buf_mem);
+ record_buf_mem);
return 0;
}
@@ -14362,7 +14344,7 @@ thumb2_record_decode_insn_handler (arm_insn_decode_record *thumb2_insn_r)
if (op1 == 0x01)
{
- if (!(op2 & 0x64 ))
+ if (!(op2 & 0x64))
{
/* Load/store multiple instruction. */
return thumb2_record_ld_st_multiple (thumb2_insn_r);
@@ -14403,7 +14385,7 @@ thumb2_record_decode_insn_handler (arm_insn_decode_record *thumb2_insn_r)
}
else if (op1 == 0x03)
{
- if (!(op2 & 0x71 ))
+ if (!(op2 & 0x71))
{
/* Store single data item. */
return thumb2_record_str_single_data (thumb2_insn_r);
@@ -14448,29 +14430,33 @@ thumb2_record_decode_insn_handler (arm_insn_decode_record *thumb2_insn_r)
/* Co-processor instructions. */
return thumb2_record_coproc_insn (thumb2_insn_r);
}
- }
+ }
return -1;
}
-namespace {
+namespace
+{
/* Abstract instruction reader. */
class abstract_instruction_reader
{
public:
+
/* Read one instruction of size LEN from address MEMADDR and using
BYTE_ORDER endianness. */
virtual ULONGEST read (CORE_ADDR memaddr, const size_t len,
- enum bfd_endian byte_order) = 0;
+ enum bfd_endian byte_order)
+ = 0;
};
/* Instruction reader from real target. */
class instruction_reader : public abstract_instruction_reader
{
- public:
+public:
+
ULONGEST read (CORE_ADDR memaddr, const size_t len,
enum bfd_endian byte_order) override
{
@@ -14480,46 +14466,43 @@ class instruction_reader : public abstract_instruction_reader
} // namespace
-typedef int (*sti_arm_hdl_fp_t) (arm_insn_decode_record*);
+typedef int (*sti_arm_hdl_fp_t) (arm_insn_decode_record *);
/* Decode arm/thumb insn depending on condition cods and opcodes; and
dispatch it. */
static int
decode_insn (abstract_instruction_reader &reader,
- arm_insn_decode_record *arm_record,
- record_type_t record_type, uint32_t insn_size)
+ arm_insn_decode_record *arm_record, record_type_t record_type,
+ uint32_t insn_size)
{
-
/* (Starting from numerical 0); bits 25, 26, 27 decodes type of arm
instruction. */
- static const sti_arm_hdl_fp_t arm_handle_insn[8] =
- {
- arm_record_data_proc_misc_ld_str, /* 000. */
- arm_record_data_proc_imm, /* 001. */
- arm_record_ld_st_imm_offset, /* 010. */
- arm_record_ld_st_reg_offset, /* 011. */
- arm_record_ld_st_multiple, /* 100. */
- arm_record_b_bl, /* 101. */
- arm_record_asimd_vfp_coproc, /* 110. */
- arm_record_coproc_data_proc /* 111. */
+ static const sti_arm_hdl_fp_t arm_handle_insn[8] = {
+ arm_record_data_proc_misc_ld_str, /* 000. */
+ arm_record_data_proc_imm, /* 001. */
+ arm_record_ld_st_imm_offset, /* 010. */
+ arm_record_ld_st_reg_offset, /* 011. */
+ arm_record_ld_st_multiple, /* 100. */
+ arm_record_b_bl, /* 101. */
+ arm_record_asimd_vfp_coproc, /* 110. */
+ arm_record_coproc_data_proc /* 111. */
};
/* (Starting from numerical 0); bits 13,14,15 decodes type of thumb
instruction. */
- static const sti_arm_hdl_fp_t thumb_handle_insn[8] =
- { \
- thumb_record_shift_add_sub, /* 000. */
- thumb_record_add_sub_cmp_mov, /* 001. */
- thumb_record_ld_st_reg_offset, /* 010. */
- thumb_record_ld_st_imm_offset, /* 011. */
- thumb_record_ld_st_stack, /* 100. */
- thumb_record_misc, /* 101. */
- thumb_record_ldm_stm_swi, /* 110. */
- thumb_record_branch /* 111. */
+ static const sti_arm_hdl_fp_t thumb_handle_insn[8] = {
+ thumb_record_shift_add_sub, /* 000. */
+ thumb_record_add_sub_cmp_mov, /* 001. */
+ thumb_record_ld_st_reg_offset, /* 010. */
+ thumb_record_ld_st_imm_offset, /* 011. */
+ thumb_record_ld_st_stack, /* 100. */
+ thumb_record_misc, /* 101. */
+ thumb_record_ldm_stm_swi, /* 110. */
+ thumb_record_branch /* 111. */
};
- uint32_t ret = 0; /* return value: negative:failure 0:success. */
+ uint32_t ret = 0; /* return value: negative:failure 0:success. */
uint32_t insn_id = 0;
enum bfd_endian code_endian
= gdbarch_byte_order_for_code (arm_record->gdbarch);
@@ -14537,7 +14520,7 @@ decode_insn (abstract_instruction_reader &reader,
{
/* If this insn has fallen into extension space
then we need not decode it anymore. */
- ret = arm_handle_insn[insn_id] (arm_record);
+ ret = arm_handle_insn[insn_id](arm_record);
}
if (ret != ARM_RECORD_SUCCESS)
{
@@ -14550,7 +14533,7 @@ decode_insn (abstract_instruction_reader &reader,
/* As thumb does not have condition codes, we set negative. */
arm_record->cond = -1;
insn_id = bits (arm_record->arm_insn, 13, 15);
- ret = thumb_handle_insn[insn_id] (arm_record);
+ ret = thumb_handle_insn[insn_id](arm_record);
if (ret != ARM_RECORD_SUCCESS)
{
arm_record_unsupported_insn (arm_record);
@@ -14584,7 +14567,8 @@ decode_insn (abstract_instruction_reader &reader,
}
#if GDB_SELF_TEST
-namespace selftests {
+namespace selftests
+{
/* Instruction reader class for selftests.
@@ -14597,10 +14581,13 @@ template<typename T>
class instruction_reader_selftest : public abstract_instruction_reader
{
public:
+
template<size_t SIZE>
instruction_reader_selftest (const T (&insns)[SIZE])
- : m_insns (insns), m_insns_size (SIZE)
- {}
+ : m_insns (insns),
+ m_insns_size (SIZE)
+ {
+ }
ULONGEST read (CORE_ADDR memaddr, const size_t length,
enum bfd_endian byte_order) override
@@ -14613,6 +14600,7 @@ public:
}
private:
+
const T *m_insns;
const size_t m_insns_size;
};
@@ -14644,8 +14632,8 @@ arm_record_test (void)
};
instruction_reader_selftest<uint16_t> reader (insns);
- int ret = decode_insn (reader, &arm_record, THUMB_RECORD,
- THUMB_INSN_SIZE_BYTES);
+ int ret
+ = decode_insn (reader, &arm_record, THUMB_RECORD, THUMB_INSN_SIZE_BYTES);
SELF_CHECK (ret == 0);
SELF_CHECK (arm_record.mem_rec_count == 0);
@@ -14653,8 +14641,8 @@ arm_record_test (void)
SELF_CHECK (arm_record.arm_regs[0] == 3);
arm_record.this_addr += 2;
- ret = decode_insn (reader, &arm_record, THUMB_RECORD,
- THUMB_INSN_SIZE_BYTES);
+ ret
+ = decode_insn (reader, &arm_record, THUMB_RECORD, THUMB_INSN_SIZE_BYTES);
SELF_CHECK (ret == 0);
SELF_CHECK (arm_record.mem_rec_count == 0);
@@ -14701,8 +14689,8 @@ arm_record_test (void)
};
instruction_reader_selftest<uint32_t> reader (insns);
- int ret = decode_insn (reader, &arm_record, ARM_RECORD,
- ARM_INSN_SIZE_BYTES);
+ int ret
+ = decode_insn (reader, &arm_record, ARM_RECORD, ARM_INSN_SIZE_BYTES);
SELF_CHECK (ret == 0);
}
@@ -14713,9 +14701,11 @@ arm_record_test (void)
class test_arm_instruction_reader : public arm_instruction_reader
{
public:
+
explicit test_arm_instruction_reader (gdb::array_view<const uint32_t> insns)
: m_insns (insns)
- {}
+ {
+ }
uint32_t read (CORE_ADDR memaddr, enum bfd_endian byte_order) const override
{
@@ -14726,13 +14716,14 @@ public:
}
private:
+
const gdb::array_view<const uint32_t> m_insns;
};
static void
arm_analyze_prologue_test ()
{
- for (bfd_endian endianness : {BFD_ENDIAN_LITTLE, BFD_ENDIAN_BIG})
+ for (bfd_endian endianness : { BFD_ENDIAN_LITTLE, BFD_ENDIAN_BIG })
{
struct gdbarch_info info;
info.byte_order = endianness;
@@ -14747,17 +14738,18 @@ arm_analyze_prologue_test ()
which resulted in a 32-bit shift of a 32-bit value, caught by
UBSan. */
const uint32_t insns[] = {
- 0xe92d4ff0, /* push {r4, r5, r6, r7, r8, r9, sl, fp, lr} */
- 0xe1a05000, /* mov r5, r0 */
- 0xe5903020, /* ldr r3, [r0, #32] */
- 0xe24dd044, /* sub sp, sp, #68 ; 0x44 */
+ 0xe92d4ff0, /* push {r4, r5, r6, r7, r8, r9, sl, fp, lr} */
+ 0xe1a05000, /* mov r5, r0 */
+ 0xe5903020, /* ldr r3, [r0, #32] */
+ 0xe24dd044, /* sub sp, sp, #68 ; 0x44 */
};
test_arm_instruction_reader mem_reader (insns);
arm_prologue_cache cache;
arm_cache_init (&cache, gdbarch);
- arm_analyze_prologue (gdbarch, 0, sizeof (insns) - 1, &cache, mem_reader);
+ arm_analyze_prologue (gdbarch, 0, sizeof (insns) - 1, &cache,
+ mem_reader);
}
}
@@ -14766,14 +14758,13 @@ arm_analyze_prologue_test ()
/* Cleans up local record registers and memory allocations. */
-static void
+static void
deallocate_reg_mem (arm_insn_decode_record *record)
{
xfree (record->arm_regs);
- xfree (record->arm_mems);
+ xfree (record->arm_mems);
}
-
/* Parse the current instruction and record the values of the registers and
memory that will be changed in current instruction to record_arch_list".
Return -1 if something is wrong. */
@@ -14782,9 +14773,8 @@ int
arm_process_record (struct gdbarch *gdbarch, struct regcache *regcache,
CORE_ADDR insn_addr)
{
-
uint32_t no_of_rec = 0;
- uint32_t ret = 0; /* return value: -1:record failure ; 0:success */
+ uint32_t ret = 0; /* return value: -1:record failure ; 0:success */
ULONGEST t_bit = 0, insn_id = 0;
ULONGEST u_regval = 0;
@@ -14796,10 +14786,10 @@ arm_process_record (struct gdbarch *gdbarch, struct regcache *regcache,
arm_record.this_addr = insn_addr;
arm_record.gdbarch = gdbarch;
-
if (record_debug > 1)
{
- gdb_printf (gdb_stdlog, "Process record: arm_process_record "
+ gdb_printf (gdb_stdlog,
+ "Process record: arm_process_record "
"addr = %s\n",
paddress (gdbarch, arm_record.this_addr));
}
@@ -14807,15 +14797,13 @@ arm_process_record (struct gdbarch *gdbarch, struct regcache *regcache,
instruction_reader reader;
enum bfd_endian code_endian
= gdbarch_byte_order_for_code (arm_record.gdbarch);
- arm_record.arm_insn
- = reader.read (arm_record.this_addr, 2, code_endian);
+ arm_record.arm_insn = reader.read (arm_record.this_addr, 2, code_endian);
/* Check the insn, whether it is thumb or arm one. */
t_bit = arm_psr_thumb_bit (arm_record.gdbarch);
regcache_raw_read_unsigned (arm_record.regcache, ARM_PS_REGNUM, &u_regval);
-
if (!(u_regval & t_bit))
{
/* We are decoding arm insn. */
@@ -14844,21 +14832,23 @@ arm_process_record (struct gdbarch *gdbarch, struct regcache *regcache,
record_full_arch_list_add_reg (arm_record.regcache, ARM_PC_REGNUM);
if (arm_record.arm_regs)
{
- for (no_of_rec = 0; no_of_rec < arm_record.reg_rec_count; no_of_rec++)
+ for (no_of_rec = 0; no_of_rec < arm_record.reg_rec_count;
+ no_of_rec++)
{
- if (record_full_arch_list_add_reg
- (arm_record.regcache , arm_record.arm_regs[no_of_rec]))
+ if (record_full_arch_list_add_reg (
+ arm_record.regcache, arm_record.arm_regs[no_of_rec]))
ret = -1;
}
}
/* Record memories. */
if (arm_record.arm_mems)
{
- for (no_of_rec = 0; no_of_rec < arm_record.mem_rec_count; no_of_rec++)
+ for (no_of_rec = 0; no_of_rec < arm_record.mem_rec_count;
+ no_of_rec++)
{
- if (record_full_arch_list_add_mem
- ((CORE_ADDR)arm_record.arm_mems[no_of_rec].addr,
- arm_record.arm_mems[no_of_rec].len))
+ if (record_full_arch_list_add_mem (
+ (CORE_ADDR) arm_record.arm_mems[no_of_rec].addr,
+ arm_record.arm_mems[no_of_rec].len))
ret = -1;
}
}
@@ -14867,7 +14857,6 @@ arm_process_record (struct gdbarch *gdbarch, struct regcache *regcache,
ret = -1;
}
-
deallocate_reg_mem (&arm_record);
return ret;
diff --git a/gdb/arm-tdep.h b/gdb/arm-tdep.h
index a8d21c44ba4..bb842d89733 100644
--- a/gdb/arm-tdep.h
+++ b/gdb/arm-tdep.h
@@ -43,11 +43,9 @@ extern bool arm_apcs_32;
(and called PS for processor status) so the status bits can be cleared
from the PC (register 15). For 32 bit ARM code, a copy of CPSR is placed
in PS. */
-#define NUM_FREGS 8 /* Number of floating point registers. */
-#define NUM_SREGS 2 /* Number of status registers. */
-#define NUM_GREGS 16 /* Number of general purpose registers. */
-
-
+#define NUM_FREGS 8 /* Number of floating point registers. */
+#define NUM_SREGS 2 /* Number of status registers. */
+#define NUM_GREGS 16 /* Number of general purpose registers. */
/* Type of floating-point code in use by inferior. There are really 3 models
that are traditionally supported (plus the endianness issue), but gcc can
@@ -61,12 +59,12 @@ extern bool arm_apcs_32;
enum arm_float_model
{
- ARM_FLOAT_AUTO, /* Automatic detection. Do not set in tdep. */
- ARM_FLOAT_SOFT_FPA, /* Traditional soft-float (mixed-endian on LE ARM). */
- ARM_FLOAT_FPA, /* FPA co-processor. GCC calling convention. */
- ARM_FLOAT_SOFT_VFP, /* Soft-float with pure-endian doubles. */
- ARM_FLOAT_VFP, /* Full VFP calling convention. */
- ARM_FLOAT_LAST /* Keep at end. */
+ ARM_FLOAT_AUTO, /* Automatic detection. Do not set in tdep. */
+ ARM_FLOAT_SOFT_FPA, /* Traditional soft-float (mixed-endian on LE ARM). */
+ ARM_FLOAT_FPA, /* FPA co-processor. GCC calling convention. */
+ ARM_FLOAT_SOFT_VFP, /* Soft-float with pure-endian doubles. */
+ ARM_FLOAT_VFP, /* Full VFP calling convention. */
+ ARM_FLOAT_LAST /* Keep at end. */
};
/* ABI used by the inferior. */
@@ -82,8 +80,8 @@ enum arm_abi_kind
enum struct_return
{
- pcc_struct_return, /* Return "short" structures in memory. */
- reg_struct_return /* Return "short" structures in registers. */
+ pcc_struct_return, /* Return "short" structures in memory. */
+ reg_struct_return /* Return "short" structures in registers. */
};
/* Target-dependent structure in gdbarch. */
@@ -91,60 +89,74 @@ struct arm_gdbarch_tdep : gdbarch_tdep_base
{
/* The ABI for this architecture. It should never be set to
ARM_ABI_AUTO. */
- enum arm_abi_kind arm_abi {};
+ enum arm_abi_kind arm_abi
+ {
+ };
- enum arm_float_model fp_model {}; /* Floating point calling conventions. */
+ enum arm_float_model fp_model
+ {
+ }; /* Floating point calling conventions. */
- bool have_fpa_registers = false; /* Does the target report the FPA registers? */
- bool have_wmmx_registers = false; /* Does the target report the WMMX registers? */
+ bool have_fpa_registers
+ = false; /* Does the target report the FPA registers? */
+ bool have_wmmx_registers
+ = false; /* Does the target report the WMMX registers? */
/* The number of VFP registers reported by the target. It is zero
if VFP registers are not supported. */
int vfp_register_count = 0;
- bool have_s_pseudos = false; /* Are we synthesizing the single precision
+ bool have_s_pseudos = false; /* Are we synthesizing the single precision
VFP registers? */
- int s_pseudo_base = 0; /* Register number for the first S pseudo
+ int s_pseudo_base = 0; /* Register number for the first S pseudo
register. */
- int s_pseudo_count = 0; /* Number of S pseudo registers. */
- bool have_q_pseudos = false; /* Are we synthesizing the quad precision
+ int s_pseudo_count = 0; /* Number of S pseudo registers. */
+ bool have_q_pseudos = false; /* Are we synthesizing the quad precision
Q (NEON or MVE) registers? Requires
have_s_pseudos. */
- int q_pseudo_base = 0; /* Register number for the first quad
+ int q_pseudo_base = 0; /* Register number for the first quad
precision pseudo register. */
- int q_pseudo_count = 0; /* Number of quad precision pseudo
+ int q_pseudo_count = 0; /* Number of quad precision pseudo
registers. */
- bool have_neon = false; /* Do we have a NEON unit? */
+ bool have_neon = false; /* Do we have a NEON unit? */
- bool have_mve = false; /* Do we have a MVE extension? */
- int mve_vpr_regnum = 0; /* MVE VPR register number. */
- int mve_pseudo_base = 0; /* Number of the first MVE pseudo register. */
- int mve_pseudo_count = 0; /* Total number of MVE pseudo registers. */
+ bool have_mve = false; /* Do we have a MVE extension? */
+ int mve_vpr_regnum = 0; /* MVE VPR register number. */
+ int mve_pseudo_base = 0; /* Number of the first MVE pseudo register. */
+ int mve_pseudo_count = 0; /* Total number of MVE pseudo registers. */
- bool have_pacbti = false; /* True if we have the ARMv8.1-m PACBTI
+ bool have_pacbti = false; /* True if we have the ARMv8.1-m PACBTI
extensions. */
- int pacbti_pseudo_base = 0; /* Number of the first PACBTI pseudo
+ int pacbti_pseudo_base = 0; /* Number of the first PACBTI pseudo
register. */
- int pacbti_pseudo_count = 0; /* Total number of PACBTI pseudo registers. */
+ int pacbti_pseudo_count = 0; /* Total number of PACBTI pseudo registers. */
- int m_profile_msp_regnum = ARM_SP_REGNUM; /* M-profile MSP register number. */
- int m_profile_psp_regnum = ARM_SP_REGNUM; /* M-profile PSP register number. */
+ int m_profile_msp_regnum
+ = ARM_SP_REGNUM; /* M-profile MSP register number. */
+ int m_profile_psp_regnum
+ = ARM_SP_REGNUM; /* M-profile PSP register number. */
/* Secure and Non-secure stack pointers with security extension. */
- int m_profile_msp_ns_regnum = ARM_SP_REGNUM; /* M-profile MSP_NS register number. */
- int m_profile_psp_ns_regnum = ARM_SP_REGNUM; /* M-profile PSP_NS register number. */
- int m_profile_msp_s_regnum = ARM_SP_REGNUM; /* M-profile MSP_S register number. */
- int m_profile_psp_s_regnum = ARM_SP_REGNUM; /* M-profile PSP_S register number. */
-
- int tls_regnum = 0; /* Number of the tpidruro register. */
-
- bool is_m = false; /* Does the target follow the "M" profile. */
- bool have_sec_ext = false; /* Do we have security extensions? */
- CORE_ADDR lowest_pc = 0; /* Lowest address at which instructions
+ int m_profile_msp_ns_regnum
+ = ARM_SP_REGNUM; /* M-profile MSP_NS register number. */
+ int m_profile_psp_ns_regnum
+ = ARM_SP_REGNUM; /* M-profile PSP_NS register number. */
+ int m_profile_msp_s_regnum
+ = ARM_SP_REGNUM; /* M-profile MSP_S register number. */
+ int m_profile_psp_s_regnum
+ = ARM_SP_REGNUM; /* M-profile PSP_S register number. */
+
+ int tls_regnum = 0; /* Number of the tpidruro register. */
+
+ bool is_m = false; /* Does the target follow the "M" profile. */
+ bool have_sec_ext = false; /* Do we have security extensions? */
+ CORE_ADDR lowest_pc = 0; /* Lowest address at which instructions
will appear. */
- const gdb_byte *arm_breakpoint = nullptr; /* Breakpoint pattern for an ARM insn. */
- int arm_breakpoint_size = 0; /* And its size. */
- const gdb_byte *thumb_breakpoint = nullptr; /* Breakpoint pattern for a Thumb insn. */
- int thumb_breakpoint_size = 0; /* And its size. */
+ const gdb_byte *arm_breakpoint
+ = nullptr; /* Breakpoint pattern for an ARM insn. */
+ int arm_breakpoint_size = 0; /* And its size. */
+ const gdb_byte *thumb_breakpoint
+ = nullptr; /* Breakpoint pattern for a Thumb insn. */
+ int thumb_breakpoint_size = 0; /* And its size. */
/* If the Thumb breakpoint is an undefined instruction (which is
affected by IT blocks) rather than a BKPT instruction (which is
@@ -153,32 +165,35 @@ struct arm_gdbarch_tdep : gdbarch_tdep_base
const gdb_byte *thumb2_breakpoint = nullptr;
int thumb2_breakpoint_size = 0;
- int jb_pc = 0; /* Offset to PC value in jump buffer.
+ int jb_pc = 0; /* Offset to PC value in jump buffer.
If this is negative, longjmp support
will be disabled. */
- size_t jb_elt_size = 0; /* And the size of each entry in the buf. */
+ size_t jb_elt_size = 0; /* And the size of each entry in the buf. */
/* Convention for returning structures. */
- enum struct_return struct_return {};
+ enum struct_return struct_return
+ {
+ };
/* ISA-specific data types. */
struct type *arm_ext_type = nullptr;
struct type *neon_double_type = nullptr;
struct type *neon_quad_type = nullptr;
- /* syscall record. */
+ /* syscall record. */
int (*arm_syscall_record) (struct regcache *regcache,
- unsigned long svc_number) = nullptr;
+ unsigned long svc_number)
+ = nullptr;
};
/* Structures used for displaced stepping. */
/* The maximum number of temporaries available for displaced instructions. */
-#define DISPLACED_TEMPS 16
+#define DISPLACED_TEMPS 16
/* The maximum number of modified instructions generated for one single-stepped
instruction, including the breakpoint (usually at the end of the instruction
sequence) and any scratch words, etc. */
-#define ARM_DISPLACED_MODIFIED_INSNS 8
+#define ARM_DISPLACED_MODIFIED_INSNS 8
struct arm_displaced_step_copy_insn_closure
: public displaced_step_copy_insn_closure
@@ -186,13 +201,14 @@ struct arm_displaced_step_copy_insn_closure
ULONGEST tmp[DISPLACED_TEMPS];
int rd;
int wrote_to_pc;
+
union
{
struct
{
int xfersize;
int rn; /* Writeback register. */
- unsigned int immed : 1; /* Offset is immediate. */
+ unsigned int immed : 1; /* Offset is immediate. */
unsigned int writeback : 1; /* Perform base-register writeback. */
unsigned int restore_r4 : 1; /* Used r4 as scratch. */
} ldst;
@@ -264,20 +280,20 @@ enum pc_write_style
};
extern void
- arm_process_displaced_insn (struct gdbarch *gdbarch, CORE_ADDR from,
- CORE_ADDR to, struct regcache *regs,
- arm_displaced_step_copy_insn_closure *dsc);
+arm_process_displaced_insn (struct gdbarch *gdbarch, CORE_ADDR from,
+ CORE_ADDR to, struct regcache *regs,
+ arm_displaced_step_copy_insn_closure *dsc);
extern void
- arm_displaced_init_closure (struct gdbarch *gdbarch, CORE_ADDR from,
- CORE_ADDR to,
- arm_displaced_step_copy_insn_closure *dsc);
-extern ULONGEST
- displaced_read_reg (regcache *regs, arm_displaced_step_copy_insn_closure *dsc,
- int regno);
-extern void
- displaced_write_reg (struct regcache *regs,
- arm_displaced_step_copy_insn_closure *dsc, int regno,
- ULONGEST val, enum pc_write_style write_pc);
+arm_displaced_init_closure (struct gdbarch *gdbarch, CORE_ADDR from,
+ CORE_ADDR to,
+ arm_displaced_step_copy_insn_closure *dsc);
+extern ULONGEST displaced_read_reg (regcache *regs,
+ arm_displaced_step_copy_insn_closure *dsc,
+ int regno);
+extern void displaced_write_reg (struct regcache *regs,
+ arm_displaced_step_copy_insn_closure *dsc,
+ int regno, ULONGEST val,
+ enum pc_write_style write_pc);
CORE_ADDR arm_skip_stub (frame_info_ptr, CORE_ADDR);
@@ -305,18 +321,16 @@ extern int arm_psr_thumb_bit (struct gdbarch *);
instruction? */
extern int arm_pc_is_thumb (struct gdbarch *, CORE_ADDR);
-extern int arm_process_record (struct gdbarch *gdbarch,
+extern int arm_process_record (struct gdbarch *gdbarch,
struct regcache *regcache, CORE_ADDR addr);
/* Functions exported from arm-bsd-tdep.h. */
/* Return the appropriate register set for the core section identified
by SECT_NAME and SECT_SIZE. */
-extern void
- armbsd_iterate_over_regset_sections (struct gdbarch *gdbarch,
- iterate_over_regset_sections_cb *cb,
- void *cb_data,
- const struct regcache *regcache);
+extern void armbsd_iterate_over_regset_sections (
+ struct gdbarch *gdbarch, iterate_over_regset_sections_cb *cb, void *cb_data,
+ const struct regcache *regcache);
/* Get the correct Arm target description with given FP hardware type. */
const target_desc *arm_read_description (arm_fp_type fp_type, bool tls);
diff --git a/gdb/arm-wince-tdep.c b/gdb/arm-wince-tdep.c
index b8bb5e5b6a8..784a06672ce 100644
--- a/gdb/arm-wince-tdep.c
+++ b/gdb/arm-wince-tdep.c
@@ -32,8 +32,8 @@ static const gdb_byte arm_wince_le_breakpoint[] = { 0x10, 0x00, 0x00, 0xe6 };
static const gdb_byte arm_wince_thumb_le_breakpoint[] = { 0xfe, 0xdf };
/* Description of the longjmp buffer. */
-#define ARM_WINCE_JB_ELEMENT_SIZE ARM_INT_REGISTER_SIZE
-#define ARM_WINCE_JB_PC 10
+#define ARM_WINCE_JB_ELEMENT_SIZE ARM_INT_REGISTER_SIZE
+#define ARM_WINCE_JB_PC 10
static CORE_ADDR
arm_pe_skip_trampoline_code (frame_info_ptr frame, CORE_ADDR pc)
@@ -96,15 +96,13 @@ arm_wince_skip_main_prologue (struct gdbarch *gdbarch, CORE_ADDR pc)
/* bl offset <__gccmain> */
if ((this_instr & 0xfff00000) == 0xeb000000)
{
-#define sign_extend(V, N) \
- (((long) (V) ^ (1L << ((N) - 1))) - (1L << ((N) - 1)))
+#define sign_extend(V, N) (((long) (V) ^ (1L << ((N) -1))) - (1L << ((N) -1)))
long offset = sign_extend (this_instr & 0x000fffff, 23) << 2;
CORE_ADDR call_dest = (pc + 8 + offset) & 0xffffffffU;
struct bound_minimal_symbol s = lookup_minimal_symbol_by_pc (call_dest);
- if (s.minsym != NULL
- && s.minsym->linkage_name () != NULL
+ if (s.minsym != NULL && s.minsym->linkage_name () != NULL
&& strcmp (s.minsym->linkage_name (), "__gccmain") == 0)
pc += 4;
}
@@ -155,6 +153,7 @@ arm_wince_osabi_sniffer (bfd *abfd)
}
void _initialize_arm_wince_tdep ();
+
void
_initialize_arm_wince_tdep ()
{
diff --git a/gdb/async-event.c b/gdb/async-event.c
index a190e77f329..f7edab504ef 100644
--- a/gdb/async-event.c
+++ b/gdb/async-event.c
@@ -85,8 +85,7 @@ static struct
/* Pointer to last in handler list. */
async_signal_handler *last_handler;
-}
-sighandler_list;
+} sighandler_list;
/* All the async_event_handlers gdb is interested in are kept onto
this list. */
@@ -97,9 +96,7 @@ static struct
/* Pointer to last in handler list. */
async_event_handler *last_handler;
-}
-async_event_handler_list;
-
+} async_event_handler_list;
/* This event is signalled whenever an asynchronous handler needs to
defer an action to the event loop. */
@@ -123,8 +120,6 @@ initialize_async_signal_handlers (void)
async_signals_handler, NULL, "async-signals");
}
-
-
/* Create an asynchronous handler, allocating memory for it.
Return a pointer to the newly created handler.
This pointer will be used to invoke the handler by
@@ -132,9 +127,8 @@ initialize_async_signal_handlers (void)
PROC is the function to call with CLIENT_DATA argument
whenever the handler is invoked. */
async_signal_handler *
-create_async_signal_handler (sig_handler_func * proc,
- gdb_client_data client_data,
- const char *name)
+create_async_signal_handler (sig_handler_func *proc,
+ gdb_client_data client_data, const char *name)
{
async_signal_handler *async_handler_ptr;
@@ -239,7 +233,7 @@ invoke_async_signal_handlers (void)
/* Delete an asynchronous handler (ASYNC_HANDLER_PTR).
Free the space allocated for it. */
void
-delete_async_signal_handler (async_signal_handler ** async_handler_ptr)
+delete_async_signal_handler (async_signal_handler **async_handler_ptr)
{
async_signal_handler *prev_ptr;
@@ -267,8 +261,7 @@ delete_async_signal_handler (async_signal_handler ** async_handler_ptr)
async_event_handler *
create_async_event_handler (async_event_handler_func *proc,
- gdb_client_data client_data,
- const char *name)
+ gdb_client_data client_data, const char *name)
{
async_event_handler *h;
@@ -295,8 +288,7 @@ mark_async_event_handler (async_event_handler *async_handler_ptr)
{
event_loop_debug_printf ("marking async event handler `%s` "
"(previous state was %d)",
- async_handler_ptr->name,
- async_handler_ptr->ready);
+ async_handler_ptr->name, async_handler_ptr->ready);
async_handler_ptr->ready = 1;
}
diff --git a/gdb/async-event.h b/gdb/async-event.h
index 2ff896960a2..c73a033173c 100644
--- a/gdb/async-event.h
+++ b/gdb/async-event.h
@@ -36,9 +36,8 @@ typedef void (sig_handler_func) (gdb_client_data);
typedef void (async_event_handler_func) (gdb_client_data);
extern struct async_signal_handler *
- create_async_signal_handler (sig_handler_func *proc,
- gdb_client_data client_data,
- const char *name);
+create_async_signal_handler (sig_handler_func *proc,
+ gdb_client_data client_data, const char *name);
extern void delete_async_signal_handler (struct async_signal_handler **);
/* Call the handler from HANDLER the next time through the event
@@ -48,7 +47,7 @@ extern void mark_async_signal_handler (struct async_signal_handler *handler);
/* Returns true if HANDLER is marked ready. */
extern int
- async_signal_handler_is_marked (struct async_signal_handler *handler);
+async_signal_handler_is_marked (struct async_signal_handler *handler);
/* Mark HANDLER as NOT ready. */
@@ -65,14 +64,13 @@ extern void clear_async_signal_handler (struct async_signal_handler *handler);
handler. */
extern struct async_event_handler *
- create_async_event_handler (async_event_handler_func *proc,
- gdb_client_data client_data,
- const char *name);
+create_async_event_handler (async_event_handler_func *proc,
+ gdb_client_data client_data, const char *name);
/* Remove the event source pointed by HANDLER_PTR created by
CREATE_ASYNC_EVENT_HANDLER from the event loop, and release it. */
extern void
- delete_async_event_handler (struct async_event_handler **handler_ptr);
+delete_async_event_handler (struct async_event_handler **handler_ptr);
/* Call the handler from HANDLER the next time through the event
loop. */
diff --git a/gdb/auto-load.c b/gdb/auto-load.c
index fdd2fc5051f..ef775be23ce 100644
--- a/gdb/auto-load.c
+++ b/gdb/auto-load.c
@@ -54,15 +54,15 @@
/* The section to look in for the name of a separate debug file. */
#define DEBUGLINK_SECTION_NAME ".gnu_debuglink"
-static void maybe_print_unsupported_script_warning
- (struct auto_load_pspace_info *, struct objfile *objfile,
- const struct extension_language_defn *language,
- const char *section_name, unsigned offset);
+static void maybe_print_unsupported_script_warning (
+ struct auto_load_pspace_info *, struct objfile *objfile,
+ const struct extension_language_defn *language, const char *section_name,
+ unsigned offset);
-static void maybe_print_script_not_found_warning
- (struct auto_load_pspace_info *, struct objfile *objfile,
- const struct extension_language_defn *language,
- const char *section_name, unsigned offset);
+static void maybe_print_script_not_found_warning (
+ struct auto_load_pspace_info *, struct objfile *objfile,
+ const struct extension_language_defn *language, const char *section_name,
+ unsigned offset);
/* See auto-load.h. */
@@ -74,8 +74,9 @@ static void
show_debug_auto_load (struct ui_file *file, int from_tty,
struct cmd_list_element *c, const char *value)
{
- gdb_printf (file, _("Debugging output for files "
- "of 'set auto-load ...' is %s.\n"),
+ gdb_printf (file,
+ _ ("Debugging output for files "
+ "of 'set auto-load ...' is %s.\n"),
value);
}
@@ -92,8 +93,9 @@ static void
show_auto_load_gdb_scripts (struct ui_file *file, int from_tty,
struct cmd_list_element *c, const char *value)
{
- gdb_printf (file, _("Auto-loading of canned sequences of commands "
- "scripts is %s.\n"),
+ gdb_printf (file,
+ _ ("Auto-loading of canned sequences of commands "
+ "scripts is %s.\n"),
value);
}
@@ -132,8 +134,9 @@ static void
show_auto_load_local_gdbinit (struct ui_file *file, int from_tty,
struct cmd_list_element *c, const char *value)
{
- gdb_printf (file, _("Auto-loading of .gdbinit script from current "
- "directory is %s.\n"),
+ gdb_printf (file,
+ _ ("Auto-loading of .gdbinit script from current "
+ "directory is %s.\n"),
value);
}
@@ -158,8 +161,9 @@ static void
show_auto_load_dir (struct ui_file *file, int from_tty,
struct cmd_list_element *c, const char *value)
{
- gdb_printf (file, _("List of directories from which to load "
- "auto-loaded scripts is %s.\n"),
+ gdb_printf (file,
+ _ ("List of directories from which to load "
+ "auto-loaded scripts is %s.\n"),
value);
}
@@ -188,7 +192,7 @@ auto_load_expand_dir_vars (const char *string)
std::vector<gdb::unique_xmalloc_ptr<char>> dir_vec
= dirnames_to_char_ptr_vec (s);
- xfree(s);
+ xfree (s);
return dir_vec;
}
@@ -221,8 +225,7 @@ auto_load_safe_path_vec_update (void)
if (debug_auto_load)
{
if (strcmp (in_vec.get (), original.get ()) == 0)
- auto_load_debug_printf ("Using directory \"%s\".",
- in_vec.get ());
+ auto_load_debug_printf ("Using directory \"%s\".", in_vec.get ());
else
auto_load_debug_printf ("Resolved directory \"%s\" as \"%s\".",
original.get (), in_vec.get ());
@@ -250,8 +253,8 @@ auto_load_gdb_datadir_changed (void)
/* "set" command for the auto_load_safe_path configuration variable. */
static void
-set_auto_load_safe_path (const char *args,
- int from_tty, struct cmd_list_element *c)
+set_auto_load_safe_path (const char *args, int from_tty,
+ struct cmd_list_element *c)
{
/* Setting the variable to "" resets it to the compile time defaults. */
if (auto_load_safe_path.empty ())
@@ -273,13 +276,15 @@ show_auto_load_safe_path (struct ui_file *file, int from_tty,
permit any location do not hide those. */
for (cs = value; *cs && (*cs == DIRNAME_SEPARATOR || IS_DIR_SEPARATOR (*cs));
- cs++);
+ cs++)
+ ;
if (*cs == 0)
- gdb_printf (file, _("Auto-load files are safe to load from any "
- "directory.\n"));
+ gdb_printf (file, _ ("Auto-load files are safe to load from any "
+ "directory.\n"));
else
- gdb_printf (file, _("List of directories from which it is safe to "
- "auto-load files is %s.\n"),
+ gdb_printf (file,
+ _ ("List of directories from which it is safe to "
+ "auto-load files is %s.\n"),
value);
}
@@ -290,7 +295,7 @@ static void
add_auto_load_safe_path (const char *args, int from_tty)
{
if (args == NULL || *args == 0)
- error (_("\
+ error (_ ("\
Directory argument required.\n\
Use 'set auto-load safe-path /' for disabling the auto-load safe-path security.\
"));
@@ -308,7 +313,7 @@ static void
add_auto_load_dir (const char *args, int from_tty)
{
if (args == NULL || *args == 0)
- error (_("Directory argument required."));
+ error (_ ("Directory argument required."));
auto_load_dir = string_printf ("%s%c%s", auto_load_dir.c_str (),
DIRNAME_SEPARATOR, args);
@@ -323,8 +328,8 @@ filename_is_in_pattern_1 (char *filename, char *pattern)
size_t pattern_len = strlen (pattern);
size_t filename_len = strlen (filename);
- auto_load_debug_printf ("Matching file \"%s\" to pattern \"%s\"",
- filename, pattern);
+ auto_load_debug_printf ("Matching file \"%s\" to pattern \"%s\"", filename,
+ pattern);
/* Trim trailing slashes ("/") from PATTERN. Even for "d:\" paths as
trailing slashes are trimmed also from FILENAME it still matches
@@ -355,7 +360,8 @@ filename_is_in_pattern_1 (char *filename, char *pattern)
return 0;
}
- if (gdb_filename_fnmatch (pattern, filename, FNM_FILE_NAME | FNM_NOESCAPE)
+ if (gdb_filename_fnmatch (pattern, filename,
+ FNM_FILE_NAME | FNM_NOESCAPE)
== 0)
{
auto_load_debug_printf ("Matched - file \"%s\" to pattern \"%s\".",
@@ -364,7 +370,8 @@ filename_is_in_pattern_1 (char *filename, char *pattern)
}
/* Trim trailing FILENAME component. */
- while (filename_len > 0 && !IS_DIR_SEPARATOR (filename[filename_len - 1]))
+ while (filename_len > 0
+ && !IS_DIR_SEPARATOR (filename[filename_len - 1]))
filename_len--;
}
}
@@ -392,8 +399,8 @@ filename_is_in_pattern (const char *filename, const char *pattern)
*FILENAME_REALP may be updated by gdb_realpath of FILENAME. */
static int
-filename_is_in_auto_load_safe_path_vec (const char *filename,
- gdb::unique_xmalloc_ptr<char> *filename_realp)
+filename_is_in_auto_load_safe_path_vec (
+ const char *filename, gdb::unique_xmalloc_ptr<char> *filename_realp)
{
const char *pattern = NULL;
@@ -403,13 +410,14 @@ filename_is_in_auto_load_safe_path_vec (const char *filename,
pattern = p.get ();
break;
}
-
+
if (pattern == NULL)
{
if (*filename_realp == NULL)
{
*filename_realp = gdb_realpath (filename);
- if (debug_auto_load && strcmp (filename_realp->get (), filename) != 0)
+ if (debug_auto_load
+ && strcmp (filename_realp->get (), filename) != 0)
auto_load_debug_printf ("Resolved file \"%s\" as \"%s\".",
filename, filename_realp->get ());
}
@@ -448,8 +456,8 @@ file_is_auto_load_safe (const char *filename)
if (filename_is_in_auto_load_safe_path_vec (filename, &filename_real))
return true;
- warning (_("File \"%ps\" auto-loading has been declined by your "
- "`auto-load safe-path' set to \"%s\"."),
+ warning (_ ("File \"%ps\" auto-loading has been declined by your "
+ "`auto-load safe-path' set to \"%s\"."),
styled_string (file_name_style.style (), filename_real.get ()),
auto_load_safe_path.c_str ());
@@ -462,8 +470,7 @@ file_is_auto_load_safe (const char *filename)
{
/* The user doesn't have an existing home directory config file,
so we should suggest a suitable path for them to use. */
- std::string config_dir_file
- = get_standard_config_filename (GDBINIT);
+ std::string config_dir_file = get_standard_config_filename (GDBINIT);
if (!config_dir_file.empty ())
home_config = config_dir_file;
else
@@ -476,7 +483,7 @@ file_is_auto_load_safe (const char *filename)
}
}
- gdb_printf (_("\
+ gdb_printf (_ ("\
To enable execution of this file add\n\
\tadd-auto-load-safe-path %s\n\
line to your configuration file \"%ps\".\n\
@@ -486,11 +493,11 @@ line to your configuration file \"%ps\".\n\
For more information about this security protection see the\n\
\"Auto-loading safe path\" section in the GDB manual. E.g., run from the shell:\n\
\tinfo \"(gdb)Auto-loading safe path\"\n"),
- filename_real.get (),
- styled_string (file_name_style.style (),
- home_config.c_str ()),
- styled_string (file_name_style.style (),
- home_config.c_str ()));
+ filename_real.get (),
+ styled_string (file_name_style.style (),
+ home_config.c_str ()),
+ styled_string (file_name_style.style (),
+ home_config.c_str ()));
advice_printed = true;
}
@@ -537,7 +544,7 @@ struct loaded_script
/* Per-program-space data key. */
static const registry<program_space>::key<auto_load_pspace_info>
- auto_load_pspace_data;
+ auto_load_pspace_data;
/* Get the current autoload data. If none is found yet, add it now. This
function always returns a valid object. */
@@ -585,16 +592,10 @@ init_loaded_scripts_info (struct auto_load_pspace_info *pspace_info)
Space for each entry is obtained with one malloc so we can free them
easily. */
- pspace_info->loaded_script_files.reset
- (htab_create (31,
- hash_loaded_script_entry,
- eq_loaded_script_entry,
- xfree));
- pspace_info->loaded_script_texts.reset
- (htab_create (31,
- hash_loaded_script_entry,
- eq_loaded_script_entry,
- xfree));
+ pspace_info->loaded_script_files.reset (
+ htab_create (31, hash_loaded_script_entry, eq_loaded_script_entry, xfree));
+ pspace_info->loaded_script_texts.reset (
+ htab_create (31, hash_loaded_script_entry, eq_loaded_script_entry, xfree));
pspace_info->unsupported_script_warning_printed = false;
pspace_info->script_not_found_warning_printed = false;
@@ -642,11 +643,10 @@ maybe_add_script_file (struct auto_load_pspace_info *pspace_info, bool loaded,
char *p;
/* Allocate all space in one chunk so it's easier to free. */
- *slot = ((struct loaded_script *)
- xmalloc (sizeof (**slot)
- + strlen (name) + 1
- + (full_path != NULL ? (strlen (full_path) + 1) : 0)));
- p = ((char*) *slot) + sizeof (**slot);
+ *slot = ((struct loaded_script *) xmalloc (
+ sizeof (**slot) + strlen (name) + 1
+ + (full_path != NULL ? (strlen (full_path) + 1) : 0)));
+ p = ((char *) *slot) + sizeof (**slot);
strcpy (p, name);
(*slot)->name = p;
if (full_path != NULL)
@@ -671,8 +671,8 @@ maybe_add_script_file (struct auto_load_pspace_info *pspace_info, bool loaded,
The result is true if the script was already in the hash table. */
static bool
-maybe_add_script_text (struct auto_load_pspace_info *pspace_info,
- bool loaded, const char *name,
+maybe_add_script_text (struct auto_load_pspace_info *pspace_info, bool loaded,
+ const char *name,
const struct extension_language_defn *language)
{
struct htab *htab = pspace_info->loaded_script_texts.get ();
@@ -690,9 +690,9 @@ maybe_add_script_text (struct auto_load_pspace_info *pspace_info,
char *p;
/* Allocate all space in one chunk so it's easier to free. */
- *slot = ((struct loaded_script *)
- xmalloc (sizeof (**slot) + strlen (name) + 1));
- p = ((char*) *slot) + sizeof (**slot);
+ *slot = ((struct loaded_script *) xmalloc (sizeof (**slot)
+ + strlen (name) + 1));
+ p = ((char *) *slot) + sizeof (**slot);
strcpy (p, name);
(*slot)->name = p;
(*slot)->full_path = NULL;
@@ -746,14 +746,14 @@ auto_load_objfile_script_1 (struct objfile *objfile, const char *realname,
std::vector<gdb::unique_xmalloc_ptr<char>> vec
= auto_load_expand_dir_vars (auto_load_dir.c_str ());
- auto_load_debug_printf
- ("Searching 'set auto-load scripts-directory' path \"%s\".",
- auto_load_dir.c_str ());
+ auto_load_debug_printf (
+ "Searching 'set auto-load scripts-directory' path \"%s\".",
+ auto_load_dir.c_str ());
/* Convert Windows file name from c:/dir/file to /c/dir/file. */
if (HAS_DRIVE_SPEC (debugfile))
- filename = (std::string("\\") + debugfile[0]
- + STRIP_DRIVE_SPEC (debugfile));
+ filename
+ = (std::string ("\\") + debugfile[0] + STRIP_DRIVE_SPEC (debugfile));
for (const gdb::unique_xmalloc_ptr<char> &dir : vec)
{
@@ -766,9 +766,8 @@ auto_load_objfile_script_1 (struct objfile *objfile, const char *realname,
auto_load_debug_printf ("Attempted file \"%ps\" %s.",
styled_string (file_name_style.style (),
debugfile),
- (input != nullptr
- ? "exists"
- : "does not exist"));
+ (input != nullptr ? "exists"
+ : "does not exist"));
if (input != NULL)
break;
@@ -779,9 +778,9 @@ auto_load_objfile_script_1 (struct objfile *objfile, const char *realname,
{
struct auto_load_pspace_info *pspace_info;
- auto_load_debug_printf
- ("Loading %s script \"%s\" by extension for objfile \"%s\".",
- ext_lang_name (language), debugfile, objfile_name (objfile));
+ auto_load_debug_printf (
+ "Loading %s script \"%s\" by extension for objfile \"%s\".",
+ ext_lang_name (language), debugfile, objfile_name (objfile));
bool is_safe = file_is_auto_load_safe (debugfile);
@@ -841,8 +840,8 @@ auto_load_objfile_script (struct objfile *objfile,
len -= lexe;
realname.get ()[len] = '\0';
- auto_load_debug_printf
- ("Stripped .exe suffix, retrying with \"%s\".", realname.get ());
+ auto_load_debug_printf ("Stripped .exe suffix, retrying with \"%s\".",
+ realname.get ());
auto_load_objfile_script_1 (objfile, realname.get (), language);
return;
@@ -857,8 +856,8 @@ auto_load_objfile_script (struct objfile *objfile,
if (parent != nullptr)
{
unsigned long crc32;
- gdb::unique_xmalloc_ptr<char> debuglink
- (bfd_get_debug_link_info (parent->obfd.get (), &crc32));
+ gdb::unique_xmalloc_ptr<char> debuglink (
+ bfd_get_debug_link_info (parent->obfd.get (), &crc32));
if (debuglink.get () != nullptr
&& strcmp (debuglink.get (), lbasename (realname.get ())) != 0)
@@ -874,12 +873,12 @@ auto_load_objfile_script (struct objfile *objfile,
p_realname.replace (last + 1, std::string::npos,
debuglink.get ());
- auto_load_debug_printf
- ("Debug filename mismatch, retrying with \"%s\".",
- p_realname.c_str ());
+ auto_load_debug_printf (
+ "Debug filename mismatch, retrying with \"%s\".",
+ p_realname.c_str ());
- auto_load_objfile_script_1 (objfile,
- p_realname.c_str (), language);
+ auto_load_objfile_script_1 (objfile, p_realname.c_str (),
+ language);
}
}
}
@@ -917,15 +916,15 @@ source_script_file (struct auto_load_pspace_info *pspace_info,
return;
}
- gdb::optional<open_script> opened = find_and_open_script (file,
- 1 /*search_path*/);
+ gdb::optional<open_script> opened
+ = find_and_open_script (file, 1 /*search_path*/);
if (opened)
{
- auto_load_debug_printf
- ("Loading %s script \"%s\" from section \"%s\" of objfile \"%s\".",
- ext_lang_name (language), opened->full_path.get (),
- section_name, objfile_name (objfile));
+ auto_load_debug_printf (
+ "Loading %s script \"%s\" from section \"%s\" of objfile \"%s\".",
+ ext_lang_name (language), opened->full_path.get (), section_name,
+ objfile_name (objfile));
if (!file_is_auto_load_safe (opened->full_path.get ()))
opened.reset ();
@@ -946,7 +945,7 @@ source_script_file (struct auto_load_pspace_info *pspace_info,
bool in_hash_table
= maybe_add_script_file (pspace_info, bool (opened), file,
- (opened ? opened->full_path.get (): NULL),
+ (opened ? opened->full_path.get () : NULL),
language);
/* If this file is not currently loaded, load it. */
@@ -994,7 +993,7 @@ execute_script_contents (struct auto_load_pspace_info *pspace_info,
if (name == NULL)
{
/* We don't throw an error, the program is still debuggable. */
- warning (_("\
+ warning (_ ("\
Missing/bad script name in entry at offset %u in section %s\n\
of file %ps."),
offset, section_name,
@@ -1022,9 +1021,9 @@ of file %ps."),
return;
}
- auto_load_debug_printf
- ("Loading %s script \"%s\" from section \"%s\" of objfile \"%s\".",
- ext_lang_name (language), name, section_name, objfile_name (objfile));
+ auto_load_debug_printf (
+ "Loading %s script \"%s\" from section \"%s\" of objfile \"%s\".",
+ ext_lang_name (language), name, section_name, objfile_name (objfile));
bool is_safe = file_is_auto_load_safe (objfile_name (objfile));
@@ -1075,7 +1074,7 @@ source_section_scripts (struct objfile *objfile, const char *section_name,
language = get_ext_lang_defn (EXT_LANG_GUILE);
break;
default:
- warning (_("Invalid entry in %s section"), section_name);
+ warning (_ ("Invalid entry in %s section"), section_name);
/* We could try various heuristics to find the next valid entry,
but it's safer to just punt. */
return;
@@ -1086,7 +1085,7 @@ source_section_scripts (struct objfile *objfile, const char *section_name,
++p;
if (p == end)
{
- warning (_("Non-nul-terminated entry in %s at offset %u"),
+ warning (_ ("Non-nul-terminated entry in %s at offset %u"),
section_name, offset);
/* Don't load/execute it. */
break;
@@ -1098,12 +1097,12 @@ source_section_scripts (struct objfile *objfile, const char *section_name,
case SECTION_SCRIPT_ID_SCHEME_FILE:
if (p == entry)
{
- warning (_("Empty entry in %s at offset %u"),
- section_name, offset);
+ warning (_ ("Empty entry in %s at offset %u"), section_name,
+ offset);
continue;
}
- source_script_file (pspace_info, objfile, language,
- section_name, offset, entry);
+ source_script_file (pspace_info, objfile, language, section_name,
+ offset, entry);
break;
case SECTION_SCRIPT_ID_PYTHON_TEXT:
case SECTION_SCRIPT_ID_SCHEME_TEXT:
@@ -1129,8 +1128,7 @@ auto_load_section_scripts (struct objfile *objfile, const char *section_name)
return;
if (!bfd_get_full_section_contents (abfd, scripts_sect, &data))
- warning (_("Couldn't read %s section of %ps"),
- section_name,
+ warning (_ ("Couldn't read %s section of %ps"), section_name,
styled_string (file_name_style.style (),
bfd_get_filename (abfd)));
else
@@ -1152,8 +1150,7 @@ load_auto_scripts_for_objfile (struct objfile *objfile)
This is to handle sequencing of operations during gdb startup.
Also return immediately if OBJFILE was not created from a file
on the local filesystem. */
- if (!global_auto_load
- || (objfile->flags & OBJF_NOT_FILENAME) != 0
+ if (!global_auto_load || (objfile->flags & OBJF_NOT_FILENAME) != 0
|| is_target_filename (objfile->original_name))
return;
@@ -1190,8 +1187,10 @@ struct collect_matching_scripts_data
{
collect_matching_scripts_data (std::vector<loaded_script *> *scripts_p_,
const extension_language_defn *language_)
- : scripts_p (scripts_p_), language (language_)
- {}
+ : scripts_p (scripts_p_),
+ language (language_)
+ {
+ }
std::vector<loaded_script *> *scripts_p;
const struct extension_language_defn *language;
@@ -1279,7 +1278,7 @@ auto_load_info_scripts (const char *pattern, int from_tty,
char *re_err = re_comp (pattern);
if (re_err)
- error (_("Invalid regexp: %s"), re_err);
+ error (_ ("Invalid regexp: %s"), re_err);
}
else
{
@@ -1358,13 +1357,13 @@ static void
info_auto_load_local_gdbinit (const char *args, int from_tty)
{
if (auto_load_local_gdbinit_pathname == NULL)
- gdb_printf (_("Local .gdbinit file was not found.\n"));
+ gdb_printf (_ ("Local .gdbinit file was not found.\n"));
else if (auto_load_local_gdbinit_loaded)
- gdb_printf (_("Local .gdbinit file \"%ps\" has been loaded.\n"),
+ gdb_printf (_ ("Local .gdbinit file \"%ps\" has been loaded.\n"),
styled_string (file_name_style.style (),
auto_load_local_gdbinit_pathname));
else
- gdb_printf (_("Local .gdbinit file \"%ps\" has not been loaded.\n"),
+ gdb_printf (_ ("Local .gdbinit file \"%ps\" has not been loaded.\n"),
styled_string (file_name_style.style (),
auto_load_local_gdbinit_pathname));
}
@@ -1374,14 +1373,14 @@ info_auto_load_local_gdbinit (const char *args, int from_tty)
of OBJFILE. */
static void
-maybe_print_unsupported_script_warning
- (struct auto_load_pspace_info *pspace_info,
- struct objfile *objfile, const struct extension_language_defn *language,
- const char *section_name, unsigned offset)
+maybe_print_unsupported_script_warning (
+ struct auto_load_pspace_info *pspace_info, struct objfile *objfile,
+ const struct extension_language_defn *language, const char *section_name,
+ unsigned offset)
{
if (!pspace_info->unsupported_script_warning_printed)
{
- warning (_("\
+ warning (_ ("\
Unsupported auto-load script at offset %u in section %s\n\
of file %ps.\n\
Use `info auto-load %s-scripts [REGEXP]' to list them."),
@@ -1398,14 +1397,14 @@ Use `info auto-load %s-scripts [REGEXP]' to list them."),
of PSPACE_INFO. */
static void
-maybe_print_script_not_found_warning
- (struct auto_load_pspace_info *pspace_info,
- struct objfile *objfile, const struct extension_language_defn *language,
- const char *section_name, unsigned offset)
+maybe_print_script_not_found_warning (
+ struct auto_load_pspace_info *pspace_info, struct objfile *objfile,
+ const struct extension_language_defn *language, const char *section_name,
+ unsigned offset)
{
if (!pspace_info->script_not_found_warning_printed)
{
- warning (_("\
+ warning (_ ("\
Missing auto-load script at offset %u in section %s\n\
of file %ps.\n\
Use `info auto-load %s-scripts [REGEXP]' to list them."),
@@ -1432,12 +1431,13 @@ set_auto_load_cmd (const char *args, int from_tty)
while (length > 0 && (args[length - 1] == ' ' || args[length - 1] == '\t'))
length--;
- if (length == 0 || (strncmp (args, "off", length) != 0
- && strncmp (args, "0", length) != 0
- && strncmp (args, "no", length) != 0
- && strncmp (args, "disable", length) != 0))
- error (_("Valid is only global 'set auto-load no'; "
- "otherwise check the auto-load sub-commands."));
+ if (length == 0
+ || (strncmp (args, "off", length) != 0
+ && strncmp (args, "0", length) != 0
+ && strncmp (args, "no", length) != 0
+ && strncmp (args, "disable", length) != 0))
+ error (_ ("Valid is only global 'set auto-load no'; "
+ "otherwise check the auto-load sub-commands."));
for (list = *auto_load_set_cmdlist_get (); list != NULL; list = list->next)
if (list->var->type () == var_boolean)
@@ -1455,11 +1455,11 @@ auto_load_set_cmdlist_get (void)
static struct cmd_list_element *retval;
if (retval == NULL)
- add_prefix_cmd ("auto-load", class_maintenance, set_auto_load_cmd, _("\
+ add_prefix_cmd ("auto-load", class_maintenance, set_auto_load_cmd, _ ("\
Auto-loading specific settings.\n\
Configure various auto-load-specific variables such as\n\
automatic loading of Python scripts."),
- &retval, 1/*allow-unknown*/, &setlist);
+ &retval, 1 /*allow-unknown*/, &setlist);
return &retval;
}
@@ -1472,11 +1472,11 @@ auto_load_show_cmdlist_get (void)
static struct cmd_list_element *retval;
if (retval == NULL)
- add_show_prefix_cmd ("auto-load", class_maintenance, _("\
+ add_show_prefix_cmd ("auto-load", class_maintenance, _ ("\
Show auto-loading specific settings.\n\
Show configuration of various auto-load-specific variables such as\n\
automatic loading of Python scripts."),
- &retval, 0/*allow-unknown*/, &showlist);
+ &retval, 0 /*allow-unknown*/, &showlist);
return &retval;
}
@@ -1514,11 +1514,11 @@ auto_load_info_cmdlist_get (void)
static struct cmd_list_element *retval;
if (retval == NULL)
- add_prefix_cmd ("auto-load", class_info, info_auto_load_cmd, _("\
+ add_prefix_cmd ("auto-load", class_info, info_auto_load_cmd, _ ("\
Print current status of auto-loaded files.\n\
Print whether various files like Python scripts or .gdbinit files have been\n\
found and/or loaded."),
- &retval, 0/*allow-unknown*/, &infolist);
+ &retval, 0 /*allow-unknown*/, &infolist);
return &retval;
}
@@ -1528,6 +1528,7 @@ found and/or loaded."),
gdb::observers::token auto_load_new_objfile_observer_token;
void _initialize_auto_load ();
+
void
_initialize_auto_load ()
{
@@ -1537,13 +1538,14 @@ _initialize_auto_load ()
const char *suffix;
gdb::observers::new_objfile.attach (auto_load_new_objfile,
- auto_load_new_objfile_observer_token,
- "auto-load");
+ auto_load_new_objfile_observer_token,
+ "auto-load");
add_setshow_boolean_cmd ("gdb-scripts", class_support,
- &auto_load_gdb_scripts, _("\
-Enable or disable auto-loading of canned sequences of commands scripts."), _("\
+ &auto_load_gdb_scripts, _ ("\
+Enable or disable auto-loading of canned sequences of commands scripts."),
+ _ ("\
Show whether auto-loading of canned sequences of commands scripts is enabled."),
- _("\
+ _ ("\
If enabled, canned sequences of commands are loaded when the debugger reads\n\
an executable or shared library.\n\
This option has security implications for untrusted inferiors."),
@@ -1552,15 +1554,16 @@ This option has security implications for untrusted inferiors."),
auto_load_show_cmdlist_get ());
add_cmd ("gdb-scripts", class_info, info_auto_load_gdb_scripts,
- _("Print the list of automatically loaded sequences of commands.\n\
+ _ ("Print the list of automatically loaded sequences of commands.\n\
Usage: info auto-load gdb-scripts [REGEXP]"),
auto_load_info_cmdlist_get ());
add_setshow_boolean_cmd ("local-gdbinit", class_support,
- &auto_load_local_gdbinit, _("\
-Enable or disable auto-loading of .gdbinit script in current directory."), _("\
+ &auto_load_local_gdbinit, _ ("\
+Enable or disable auto-loading of .gdbinit script in current directory."),
+ _ ("\
Show whether auto-loading .gdbinit script in current directory is enabled."),
- _("\
+ _ ("\
If enabled, canned sequences of commands are loaded when debugger starts\n\
from .gdbinit file in current directory. Such files are deprecated,\n\
use a script associated with inferior executable file instead.\n\
@@ -1569,34 +1572,32 @@ This option has security implications for untrusted inferiors."),
auto_load_set_cmdlist_get (),
auto_load_show_cmdlist_get ());
- add_cmd ("local-gdbinit", class_info, info_auto_load_local_gdbinit,
- _("Print whether current directory .gdbinit file has been loaded.\n\
+ add_cmd (
+ "local-gdbinit", class_info, info_auto_load_local_gdbinit,
+ _ ("Print whether current directory .gdbinit file has been loaded.\n\
Usage: info auto-load local-gdbinit"),
- auto_load_info_cmdlist_get ());
+ auto_load_info_cmdlist_get ());
suffix = ext_lang_auto_load_suffix (get_ext_lang_defn (EXT_LANG_GDB));
- gdb_name_help
- = xstrprintf (_("\
+ gdb_name_help = xstrprintf (_ ("\
GDB scripts: OBJFILE%s\n"),
- suffix);
+ suffix);
python_name_help = NULL;
#ifdef HAVE_PYTHON
suffix = ext_lang_auto_load_suffix (get_ext_lang_defn (EXT_LANG_PYTHON));
- python_name_help
- = xstrprintf (_("\
+ python_name_help = xstrprintf (_ ("\
Python scripts: OBJFILE%s\n"),
- suffix);
+ suffix);
#endif
guile_name_help = NULL;
#ifdef HAVE_GUILE
suffix = ext_lang_auto_load_suffix (get_ext_lang_defn (EXT_LANG_GUILE));
- guile_name_help
- = xstrprintf (_("\
+ guile_name_help = xstrprintf (_ ("\
Guile scripts: OBJFILE%s\n"),
- suffix);
+ suffix);
#endif
scripts_directory_help
- = xstrprintf (_("\
+ = xstrprintf (_ ("\
Automatically loaded scripts are located in one of the directories listed\n\
by this option.\n\
\n\
@@ -1613,8 +1614,9 @@ option."),
guile_name_help.get () ? guile_name_help.get () : "");
add_setshow_optional_filename_cmd ("scripts-directory", class_support,
- &auto_load_dir, _("\
-Set the list of directories from which to load auto-loaded scripts."), _("\
+ &auto_load_dir, _ ("\
+Set the list of directories from which to load auto-loaded scripts."),
+ _ ("\
Show the list of directories from which to load auto-loaded scripts."),
scripts_directory_help.get (),
set_auto_load_dir, show_auto_load_dir,
@@ -1622,9 +1624,11 @@ Show the list of directories from which to load auto-loaded scripts."),
auto_load_show_cmdlist_get ());
auto_load_safe_path_vec_update ();
add_setshow_optional_filename_cmd ("safe-path", class_support,
- &auto_load_safe_path, _("\
-Set the list of files and directories that are safe for auto-loading."), _("\
-Show the list of files and directories that are safe for auto-loading."), _("\
+ &auto_load_safe_path, _ ("\
+Set the list of files and directories that are safe for auto-loading."),
+ _ ("\
+Show the list of files and directories that are safe for auto-loading."),
+ _ ("\
Various files loaded automatically for the 'set auto-load ...' options must\n\
be located in one of the directories listed by this option. Warning will be\n\
printed and file will not be used otherwise.\n\
@@ -1642,30 +1646,33 @@ This option has security implications for untrusted inferiors."),
gdb::observers::gdb_datadir_changed.attach (auto_load_gdb_datadir_changed,
"auto-load");
- cmd = add_cmd ("add-auto-load-safe-path", class_support,
- add_auto_load_safe_path,
- _("Add entries to the list of directories from which it is safe "
- "to auto-load files.\n\
+ cmd = add_cmd (
+ "add-auto-load-safe-path", class_support, add_auto_load_safe_path,
+ _ ("Add entries to the list of directories from which it is safe "
+ "to auto-load files.\n\
See the commands 'set auto-load safe-path' and 'show auto-load safe-path' to\n\
access the current full list setting."),
- &cmdlist);
+ &cmdlist);
set_cmd_completer (cmd, filename_completer);
- cmd = add_cmd ("add-auto-load-scripts-directory", class_support,
- add_auto_load_dir,
- _("Add entries to the list of directories from which to load "
- "auto-loaded scripts.\n\
+ cmd
+ = add_cmd ("add-auto-load-scripts-directory", class_support,
+ add_auto_load_dir,
+ _ ("Add entries to the list of directories from which to load "
+ "auto-loaded scripts.\n\
See the commands 'set auto-load scripts-directory' and\n\
'show auto-load scripts-directory' to access the current full list setting."),
- &cmdlist);
+ &cmdlist);
set_cmd_completer (cmd, filename_completer);
- add_setshow_boolean_cmd ("auto-load", class_maintenance,
- &debug_auto_load, _("\
-Set auto-load verifications debugging."), _("\
-Show auto-load verifications debugging."), _("\
+ add_setshow_boolean_cmd ("auto-load", class_maintenance, &debug_auto_load,
+ _ ("\
+Set auto-load verifications debugging."),
+ _ ("\
+Show auto-load verifications debugging."),
+ _ ("\
When non-zero, debugging output for files of 'set auto-load ...'\n\
is displayed."),
- NULL, show_debug_auto_load,
- &setdebuglist, &showdebuglist);
+ NULL, show_debug_auto_load, &setdebuglist,
+ &showdebuglist);
}
diff --git a/gdb/auto-load.h b/gdb/auto-load.h
index 8db904e9098..e0241d04816 100644
--- a/gdb/auto-load.h
+++ b/gdb/auto-load.h
@@ -25,8 +25,10 @@ struct program_space;
struct auto_load_pspace_info;
struct extension_language_defn;
-namespace gdb {
-namespace observers {
+namespace gdb
+{
+namespace observers
+{
struct token;
} /* namespace observers */
} /* namespace gdb */
@@ -51,7 +53,7 @@ extern bool auto_load_local_gdbinit_loaded;
extern gdb::observers::token auto_load_new_objfile_observer_token;
extern struct auto_load_pspace_info *
- get_auto_load_pspace_data_for_loading (struct program_space *pspace);
+get_auto_load_pspace_data_for_loading (struct program_space *pspace);
extern void auto_load_objfile_script (struct objfile *objfile,
const struct extension_language_defn *);
extern void load_auto_scripts_for_objfile (struct objfile *objfile);
@@ -75,7 +77,7 @@ extern bool file_is_auto_load_safe (const char *filename);
/* Return true if auto-loading gdb scripts is enabled. */
-extern bool auto_load_gdb_scripts_enabled
- (const struct extension_language_defn *extlang);
+extern bool
+auto_load_gdb_scripts_enabled (const struct extension_language_defn *extlang);
#endif /* AUTO_LOAD_H */
diff --git a/gdb/auxv.c b/gdb/auxv.c
index 812b2807554..de22b8ce571 100644
--- a/gdb/auxv.c
+++ b/gdb/auxv.c
@@ -34,17 +34,13 @@
#include <unistd.h>
#include <fcntl.h>
-
/* Implement the to_xfer_partial target_ops method. This function
handles access via /proc/PID/auxv, which is a common method for
native targets. */
static enum target_xfer_status
-procfs_xfer_auxv (gdb_byte *readbuf,
- const gdb_byte *writebuf,
- ULONGEST offset,
- ULONGEST len,
- ULONGEST *xfered_len)
+procfs_xfer_auxv (gdb_byte *readbuf, const gdb_byte *writebuf, ULONGEST offset,
+ ULONGEST len, ULONGEST *xfered_len)
{
ssize_t l;
@@ -76,9 +72,7 @@ procfs_xfer_auxv (gdb_byte *readbuf,
/* This function handles access via ld.so's symbol `_dl_auxv'. */
static enum target_xfer_status
-ld_so_xfer_auxv (gdb_byte *readbuf,
- const gdb_byte *writebuf,
- ULONGEST offset,
+ld_so_xfer_auxv (gdb_byte *readbuf, const gdb_byte *writebuf, ULONGEST offset,
ULONGEST len, ULONGEST *xfered_len)
{
struct bound_minimal_symbol msym;
@@ -151,8 +145,8 @@ ld_so_xfer_auxv (gdb_byte *readbuf,
if (offset >= auxv_pair_size)
{
- if (target_read_memory (data_address - auxv_pair_size, ptr_buf,
- ptr_size) != 0)
+ if (target_read_memory (data_address - auxv_pair_size, ptr_buf, ptr_size)
+ != 0)
return TARGET_XFER_E_IO;
if (extract_typed_address (ptr_buf, ptr_type) == AT_NULL)
@@ -216,18 +210,15 @@ ld_so_xfer_auxv (gdb_byte *readbuf,
TARGET_OBJECT_AUXV. It handles access to AUXV. */
enum target_xfer_status
-memory_xfer_auxv (struct target_ops *ops,
- enum target_object object,
- const char *annex,
- gdb_byte *readbuf,
- const gdb_byte *writebuf,
- ULONGEST offset,
- ULONGEST len, ULONGEST *xfered_len)
+memory_xfer_auxv (struct target_ops *ops, enum target_object object,
+ const char *annex, gdb_byte *readbuf,
+ const gdb_byte *writebuf, ULONGEST offset, ULONGEST len,
+ ULONGEST *xfered_len)
{
gdb_assert (object == TARGET_OBJECT_AUXV);
gdb_assert (readbuf || writebuf);
- /* ld_so_xfer_auxv is the only function safe for virtual
+ /* ld_so_xfer_auxv is the only function safe for virtual
executables being executed by valgrind's memcheck. Using
ld_so_xfer_auxv during inferior startup is problematic, because
ld.so symbol tables have not yet been relocated. So GDB uses
@@ -324,7 +315,6 @@ parse_auxv (target_ops *ops, gdbarch *gdbarch, const gdb_byte **readptr,
return ops->auxv_parse (readptr, endptr, typep, valp);
}
-
/* Auxiliary Vector information structure. This is used by GDB
for caching purposes for each inferior. This helps reduce the
overhead of transfering data from a remote target to the local host. */
@@ -391,16 +381,16 @@ target_auxv_search (const gdb::byte_vector &auxv, target_ops *ops,
while (1)
switch (parse_auxv (ops, gdbarch, &ptr, data + len, &type, &val))
{
- case 1: /* Here's an entry, check it. */
+ case 1: /* Here's an entry, check it. */
if (type == match)
{
*valp = val;
return 1;
}
break;
- case 0: /* End of the vector. */
+ case 0: /* End of the vector. */
return 0;
- default: /* Bogosity. */
+ default: /* Bogosity. */
return -1;
}
}
@@ -426,8 +416,7 @@ fprint_auxv_entry (struct ui_file *file, const char *name,
const char *description, enum auxv_format format,
CORE_ADDR type, CORE_ADDR val)
{
- gdb_printf (file, ("%-4s %-20s %-30s "),
- plongest (type), name, description);
+ gdb_printf (file, ("%-4s %-20s %-30s "), plongest (type), name, description);
switch (format)
{
case AUXV_FORMAT_DEC:
@@ -443,8 +432,8 @@ fprint_auxv_entry (struct ui_file *file, const char *name,
get_user_print_options (&opts);
if (opts.addressprint)
gdb_printf (file, ("%s "), paddress (target_gdbarch (), val));
- val_print_string (builtin_type (target_gdbarch ())->builtin_char,
- NULL, val, -1, file, &opts);
+ val_print_string (builtin_type (target_gdbarch ())->builtin_char, NULL,
+ val, -1, file, &opts);
gdb_printf (file, ("\n"));
}
break;
@@ -464,92 +453,99 @@ default_print_auxv_entry (struct gdbarch *gdbarch, struct ui_file *file,
switch (type)
{
#define TAG(tag, text, kind) \
- case tag: name = #tag; description = text; format = kind; break
- TAG (AT_NULL, _("End of vector"), AUXV_FORMAT_HEX);
- TAG (AT_IGNORE, _("Entry should be ignored"), AUXV_FORMAT_HEX);
- TAG (AT_EXECFD, _("File descriptor of program"), AUXV_FORMAT_DEC);
- TAG (AT_PHDR, _("Program headers for program"), AUXV_FORMAT_HEX);
- TAG (AT_PHENT, _("Size of program header entry"), AUXV_FORMAT_DEC);
- TAG (AT_PHNUM, _("Number of program headers"), AUXV_FORMAT_DEC);
- TAG (AT_PAGESZ, _("System page size"), AUXV_FORMAT_DEC);
- TAG (AT_BASE, _("Base address of interpreter"), AUXV_FORMAT_HEX);
- TAG (AT_FLAGS, _("Flags"), AUXV_FORMAT_HEX);
- TAG (AT_ENTRY, _("Entry point of program"), AUXV_FORMAT_HEX);
- TAG (AT_NOTELF, _("Program is not ELF"), AUXV_FORMAT_DEC);
- TAG (AT_UID, _("Real user ID"), AUXV_FORMAT_DEC);
- TAG (AT_EUID, _("Effective user ID"), AUXV_FORMAT_DEC);
- TAG (AT_GID, _("Real group ID"), AUXV_FORMAT_DEC);
- TAG (AT_EGID, _("Effective group ID"), AUXV_FORMAT_DEC);
- TAG (AT_CLKTCK, _("Frequency of times()"), AUXV_FORMAT_DEC);
- TAG (AT_PLATFORM, _("String identifying platform"), AUXV_FORMAT_STR);
- TAG (AT_HWCAP, _("Machine-dependent CPU capability hints"),
+ case tag: \
+ name = #tag; \
+ description = text; \
+ format = kind; \
+ break
+ TAG (AT_NULL, _ ("End of vector"), AUXV_FORMAT_HEX);
+ TAG (AT_IGNORE, _ ("Entry should be ignored"), AUXV_FORMAT_HEX);
+ TAG (AT_EXECFD, _ ("File descriptor of program"), AUXV_FORMAT_DEC);
+ TAG (AT_PHDR, _ ("Program headers for program"), AUXV_FORMAT_HEX);
+ TAG (AT_PHENT, _ ("Size of program header entry"), AUXV_FORMAT_DEC);
+ TAG (AT_PHNUM, _ ("Number of program headers"), AUXV_FORMAT_DEC);
+ TAG (AT_PAGESZ, _ ("System page size"), AUXV_FORMAT_DEC);
+ TAG (AT_BASE, _ ("Base address of interpreter"), AUXV_FORMAT_HEX);
+ TAG (AT_FLAGS, _ ("Flags"), AUXV_FORMAT_HEX);
+ TAG (AT_ENTRY, _ ("Entry point of program"), AUXV_FORMAT_HEX);
+ TAG (AT_NOTELF, _ ("Program is not ELF"), AUXV_FORMAT_DEC);
+ TAG (AT_UID, _ ("Real user ID"), AUXV_FORMAT_DEC);
+ TAG (AT_EUID, _ ("Effective user ID"), AUXV_FORMAT_DEC);
+ TAG (AT_GID, _ ("Real group ID"), AUXV_FORMAT_DEC);
+ TAG (AT_EGID, _ ("Effective group ID"), AUXV_FORMAT_DEC);
+ TAG (AT_CLKTCK, _ ("Frequency of times()"), AUXV_FORMAT_DEC);
+ TAG (AT_PLATFORM, _ ("String identifying platform"), AUXV_FORMAT_STR);
+ TAG (AT_HWCAP, _ ("Machine-dependent CPU capability hints"),
AUXV_FORMAT_HEX);
- TAG (AT_FPUCW, _("Used FPU control word"), AUXV_FORMAT_DEC);
- TAG (AT_DCACHEBSIZE, _("Data cache block size"), AUXV_FORMAT_DEC);
- TAG (AT_ICACHEBSIZE, _("Instruction cache block size"), AUXV_FORMAT_DEC);
- TAG (AT_UCACHEBSIZE, _("Unified cache block size"), AUXV_FORMAT_DEC);
- TAG (AT_IGNOREPPC, _("Entry should be ignored"), AUXV_FORMAT_DEC);
- TAG (AT_BASE_PLATFORM, _("String identifying base platform"),
+ TAG (AT_FPUCW, _ ("Used FPU control word"), AUXV_FORMAT_DEC);
+ TAG (AT_DCACHEBSIZE, _ ("Data cache block size"), AUXV_FORMAT_DEC);
+ TAG (AT_ICACHEBSIZE, _ ("Instruction cache block size"),
+ AUXV_FORMAT_DEC);
+ TAG (AT_UCACHEBSIZE, _ ("Unified cache block size"), AUXV_FORMAT_DEC);
+ TAG (AT_IGNOREPPC, _ ("Entry should be ignored"), AUXV_FORMAT_DEC);
+ TAG (AT_BASE_PLATFORM, _ ("String identifying base platform"),
AUXV_FORMAT_STR);
- TAG (AT_RANDOM, _("Address of 16 random bytes"), AUXV_FORMAT_HEX);
- TAG (AT_HWCAP2, _("Extension of AT_HWCAP"), AUXV_FORMAT_HEX);
- TAG (AT_EXECFN, _("File name of executable"), AUXV_FORMAT_STR);
- TAG (AT_SECURE, _("Boolean, was exec setuid-like?"), AUXV_FORMAT_DEC);
- TAG (AT_SYSINFO, _("Special system info/entry points"), AUXV_FORMAT_HEX);
- TAG (AT_SYSINFO_EHDR, _("System-supplied DSO's ELF header"),
+ TAG (AT_RANDOM, _ ("Address of 16 random bytes"), AUXV_FORMAT_HEX);
+ TAG (AT_HWCAP2, _ ("Extension of AT_HWCAP"), AUXV_FORMAT_HEX);
+ TAG (AT_EXECFN, _ ("File name of executable"), AUXV_FORMAT_STR);
+ TAG (AT_SECURE, _ ("Boolean, was exec setuid-like?"), AUXV_FORMAT_DEC);
+ TAG (AT_SYSINFO, _ ("Special system info/entry points"),
+ AUXV_FORMAT_HEX);
+ TAG (AT_SYSINFO_EHDR, _ ("System-supplied DSO's ELF header"),
+ AUXV_FORMAT_HEX);
+ TAG (AT_L1I_CACHESHAPE, _ ("L1 Instruction cache information"),
AUXV_FORMAT_HEX);
- TAG (AT_L1I_CACHESHAPE, _("L1 Instruction cache information"),
+ TAG (AT_L1I_CACHESIZE, _ ("L1 Instruction cache size"), AUXV_FORMAT_HEX);
+ TAG (AT_L1I_CACHEGEOMETRY, _ ("L1 Instruction cache geometry"),
AUXV_FORMAT_HEX);
- TAG (AT_L1I_CACHESIZE, _("L1 Instruction cache size"), AUXV_FORMAT_HEX);
- TAG (AT_L1I_CACHEGEOMETRY, _("L1 Instruction cache geometry"),
+ TAG (AT_L1D_CACHESHAPE, _ ("L1 Data cache information"),
AUXV_FORMAT_HEX);
- TAG (AT_L1D_CACHESHAPE, _("L1 Data cache information"), AUXV_FORMAT_HEX);
- TAG (AT_L1D_CACHESIZE, _("L1 Data cache size"), AUXV_FORMAT_HEX);
- TAG (AT_L1D_CACHEGEOMETRY, _("L1 Data cache geometry"),
+ TAG (AT_L1D_CACHESIZE, _ ("L1 Data cache size"), AUXV_FORMAT_HEX);
+ TAG (AT_L1D_CACHEGEOMETRY, _ ("L1 Data cache geometry"),
AUXV_FORMAT_HEX);
- TAG (AT_L2_CACHESHAPE, _("L2 cache information"), AUXV_FORMAT_HEX);
- TAG (AT_L2_CACHESIZE, _("L2 cache size"), AUXV_FORMAT_HEX);
- TAG (AT_L2_CACHEGEOMETRY, _("L2 cache geometry"), AUXV_FORMAT_HEX);
- TAG (AT_L3_CACHESHAPE, _("L3 cache information"), AUXV_FORMAT_HEX);
- TAG (AT_L3_CACHESIZE, _("L3 cache size"), AUXV_FORMAT_HEX);
- TAG (AT_L3_CACHEGEOMETRY, _("L3 cache geometry"), AUXV_FORMAT_HEX);
- TAG (AT_MINSIGSTKSZ, _("Minimum stack size for signal delivery"),
+ TAG (AT_L2_CACHESHAPE, _ ("L2 cache information"), AUXV_FORMAT_HEX);
+ TAG (AT_L2_CACHESIZE, _ ("L2 cache size"), AUXV_FORMAT_HEX);
+ TAG (AT_L2_CACHEGEOMETRY, _ ("L2 cache geometry"), AUXV_FORMAT_HEX);
+ TAG (AT_L3_CACHESHAPE, _ ("L3 cache information"), AUXV_FORMAT_HEX);
+ TAG (AT_L3_CACHESIZE, _ ("L3 cache size"), AUXV_FORMAT_HEX);
+ TAG (AT_L3_CACHEGEOMETRY, _ ("L3 cache geometry"), AUXV_FORMAT_HEX);
+ TAG (AT_MINSIGSTKSZ, _ ("Minimum stack size for signal delivery"),
AUXV_FORMAT_HEX);
- TAG (AT_SUN_UID, _("Effective user ID"), AUXV_FORMAT_DEC);
- TAG (AT_SUN_RUID, _("Real user ID"), AUXV_FORMAT_DEC);
- TAG (AT_SUN_GID, _("Effective group ID"), AUXV_FORMAT_DEC);
- TAG (AT_SUN_RGID, _("Real group ID"), AUXV_FORMAT_DEC);
- TAG (AT_SUN_LDELF, _("Dynamic linker's ELF header"), AUXV_FORMAT_HEX);
- TAG (AT_SUN_LDSHDR, _("Dynamic linker's section headers"),
+ TAG (AT_SUN_UID, _ ("Effective user ID"), AUXV_FORMAT_DEC);
+ TAG (AT_SUN_RUID, _ ("Real user ID"), AUXV_FORMAT_DEC);
+ TAG (AT_SUN_GID, _ ("Effective group ID"), AUXV_FORMAT_DEC);
+ TAG (AT_SUN_RGID, _ ("Real group ID"), AUXV_FORMAT_DEC);
+ TAG (AT_SUN_LDELF, _ ("Dynamic linker's ELF header"), AUXV_FORMAT_HEX);
+ TAG (AT_SUN_LDSHDR, _ ("Dynamic linker's section headers"),
AUXV_FORMAT_HEX);
- TAG (AT_SUN_LDNAME, _("String giving name of dynamic linker"),
+ TAG (AT_SUN_LDNAME, _ ("String giving name of dynamic linker"),
AUXV_FORMAT_STR);
- TAG (AT_SUN_LPAGESZ, _("Large pagesize"), AUXV_FORMAT_DEC);
- TAG (AT_SUN_PLATFORM, _("Platform name string"), AUXV_FORMAT_STR);
- TAG (AT_SUN_CAP_HW1, _("Machine-dependent CPU capability hints"),
+ TAG (AT_SUN_LPAGESZ, _ ("Large pagesize"), AUXV_FORMAT_DEC);
+ TAG (AT_SUN_PLATFORM, _ ("Platform name string"), AUXV_FORMAT_STR);
+ TAG (AT_SUN_CAP_HW1, _ ("Machine-dependent CPU capability hints"),
AUXV_FORMAT_HEX);
- TAG (AT_SUN_IFLUSH, _("Should flush icache?"), AUXV_FORMAT_DEC);
- TAG (AT_SUN_CPU, _("CPU name string"), AUXV_FORMAT_STR);
- TAG (AT_SUN_EMUL_ENTRY, _("COFF entry point address"), AUXV_FORMAT_HEX);
- TAG (AT_SUN_EMUL_EXECFD, _("COFF executable file descriptor"),
+ TAG (AT_SUN_IFLUSH, _ ("Should flush icache?"), AUXV_FORMAT_DEC);
+ TAG (AT_SUN_CPU, _ ("CPU name string"), AUXV_FORMAT_STR);
+ TAG (AT_SUN_EMUL_ENTRY, _ ("COFF entry point address"), AUXV_FORMAT_HEX);
+ TAG (AT_SUN_EMUL_EXECFD, _ ("COFF executable file descriptor"),
AUXV_FORMAT_DEC);
- TAG (AT_SUN_EXECNAME,
- _("Canonicalized file name given to execve"), AUXV_FORMAT_STR);
- TAG (AT_SUN_MMU, _("String for name of MMU module"), AUXV_FORMAT_STR);
- TAG (AT_SUN_LDDATA, _("Dynamic linker's data segment address"),
+ TAG (AT_SUN_EXECNAME, _ ("Canonicalized file name given to execve"),
+ AUXV_FORMAT_STR);
+ TAG (AT_SUN_MMU, _ ("String for name of MMU module"), AUXV_FORMAT_STR);
+ TAG (AT_SUN_LDDATA, _ ("Dynamic linker's data segment address"),
+ AUXV_FORMAT_HEX);
+ TAG (AT_SUN_AUXFLAGS, _ ("AF_SUN_ flags passed from the kernel"),
AUXV_FORMAT_HEX);
- TAG (AT_SUN_AUXFLAGS,
- _("AF_SUN_ flags passed from the kernel"), AUXV_FORMAT_HEX);
- TAG (AT_SUN_EMULATOR, _("Name of emulation binary for runtime linker"),
+ TAG (AT_SUN_EMULATOR, _ ("Name of emulation binary for runtime linker"),
AUXV_FORMAT_STR);
- TAG (AT_SUN_BRANDNAME, _("Name of brand library"), AUXV_FORMAT_STR);
- TAG (AT_SUN_BRAND_AUX1, _("Aux vector for brand modules 1"),
+ TAG (AT_SUN_BRANDNAME, _ ("Name of brand library"), AUXV_FORMAT_STR);
+ TAG (AT_SUN_BRAND_AUX1, _ ("Aux vector for brand modules 1"),
AUXV_FORMAT_HEX);
- TAG (AT_SUN_BRAND_AUX2, _("Aux vector for brand modules 2"),
+ TAG (AT_SUN_BRAND_AUX2, _ ("Aux vector for brand modules 2"),
AUXV_FORMAT_HEX);
- TAG (AT_SUN_BRAND_AUX3, _("Aux vector for brand modules 3"),
+ TAG (AT_SUN_BRAND_AUX3, _ ("Aux vector for brand modules 3"),
AUXV_FORMAT_HEX);
- TAG (AT_SUN_CAP_HW2, _("Machine-dependent CPU capability hints 2"),
+ TAG (AT_SUN_CAP_HW2, _ ("Machine-dependent CPU capability hints 2"),
AUXV_FORMAT_HEX);
}
@@ -574,8 +570,9 @@ fprint_target_auxv (struct ui_file *file)
size_t len = auxv->size ();
while (parse_auxv (current_inferior ()->top_target (),
- current_inferior ()->gdbarch,
- &ptr, data + len, &type, &val) > 0)
+ current_inferior ()->gdbarch, &ptr, data + len, &type,
+ &val)
+ > 0)
{
gdbarch_print_auxv_entry (gdbarch, file, type, val);
++ents;
@@ -589,25 +586,26 @@ fprint_target_auxv (struct ui_file *file)
static void
info_auxv_command (const char *cmd, int from_tty)
{
- if (! target_has_stack ())
- error (_("The program has no auxiliary information now."));
+ if (!target_has_stack ())
+ error (_ ("The program has no auxiliary information now."));
else
{
int ents = fprint_target_auxv (gdb_stdout);
if (ents < 0)
- error (_("No auxiliary vector found, or failed reading it."));
+ error (_ ("No auxiliary vector found, or failed reading it."));
else if (ents == 0)
- error (_("Auxiliary vector is empty."));
+ error (_ ("Auxiliary vector is empty."));
}
}
void _initialize_auxv ();
+
void
_initialize_auxv ()
{
add_info ("auxv", info_auxv_command,
- _("Display the inferior's auxiliary vector.\n\
+ _ ("Display the inferior's auxiliary vector.\n\
This is information provided by the operating system at program startup."));
/* Observers used to invalidate the auxv cache when needed. */
diff --git a/gdb/auxv.h b/gdb/auxv.h
index 2441b6c02ab..60d3cf3f45f 100644
--- a/gdb/auxv.h
+++ b/gdb/auxv.h
@@ -31,7 +31,8 @@
Return 0 if *READPTR is already at the end of the buffer.
Return -1 if there is insufficient buffer for a whole entry.
Return 1 if an entry was read into *TYPEP and *VALP. */
-extern int default_auxv_parse (struct target_ops *ops, const gdb_byte **readptr,
+extern int default_auxv_parse (struct target_ops *ops,
+ const gdb_byte **readptr,
const gdb_byte *endptr, CORE_ADDR *typep,
CORE_ADDR *valp);
@@ -62,9 +63,9 @@ extern gdb::optional<gdb::byte_vector> target_read_auxv_raw (target_ops *ops);
an error getting the information. On success, return 1 after
storing the entry's value field in *VALP. */
-extern int target_auxv_search (const gdb::byte_vector &auxv,
- target_ops *ops, gdbarch *gdbarch,
- CORE_ADDR match, CORE_ADDR *valp);
+extern int target_auxv_search (const gdb::byte_vector &auxv, target_ops *ops,
+ gdbarch *gdbarch, CORE_ADDR match,
+ CORE_ADDR *valp);
/* Same as the above, but read the auxv data from the current inferior. Use
the current inferior's top target and arch to parse auxv entries. */
@@ -72,7 +73,12 @@ extern int target_auxv_search (const gdb::byte_vector &auxv,
extern int target_auxv_search (CORE_ADDR match, CORE_ADDR *valp);
/* Print a description of a single AUXV entry on the specified file. */
-enum auxv_format { AUXV_FORMAT_DEC, AUXV_FORMAT_HEX, AUXV_FORMAT_STR };
+enum auxv_format
+{
+ AUXV_FORMAT_DEC,
+ AUXV_FORMAT_HEX,
+ AUXV_FORMAT_STR
+};
extern void fprint_auxv_entry (struct ui_file *file, const char *name,
const char *description,
@@ -87,5 +93,4 @@ extern void default_print_auxv_entry (struct gdbarch *gdbarch,
extern target_xfer_partial_ftype memory_xfer_auxv;
-
#endif
diff --git a/gdb/avr-tdep.c b/gdb/avr-tdep.c
index fa76a3d24da..911cf453d8e 100644
--- a/gdb/avr-tdep.c
+++ b/gdb/avr-tdep.c
@@ -78,10 +78,9 @@
space. */
#define AVR_TYPE_ADDRESS_CLASS_FLASH TYPE_ADDRESS_CLASS_1
-#define AVR_TYPE_INSTANCE_FLAG_ADDRESS_CLASS_FLASH \
+#define AVR_TYPE_INSTANCE_FLAG_ADDRESS_CLASS_FLASH \
TYPE_INSTANCE_FLAG_ADDRESS_CLASS_1
-
enum
{
AVR_REG_W = 24,
@@ -101,9 +100,9 @@ enum
AVR_PSEUDO_PC_REGNUM = 35,
AVR_NUM_PSEUDO_REGS = 1,
- AVR_PC_REG_INDEX = 35, /* index into array of registers */
+ AVR_PC_REG_INDEX = 35, /* index into array of registers */
- AVR_MAX_PROLOGUE_SIZE = 64, /* bytes */
+ AVR_MAX_PROLOGUE_SIZE = 64, /* bytes */
/* Count of pushed registers. From r2 to r17 (inclusively), r28, r29 */
AVR_MAX_PUSHES = 18,
@@ -111,12 +110,12 @@ enum
/* Number of the last pushed register. r17 for current avr-gcc */
AVR_LAST_PUSHED_REGNUM = 17,
- AVR_ARG1_REGNUM = 24, /* Single byte argument */
- AVR_ARGN_REGNUM = 25, /* Multi byte argments */
- AVR_LAST_ARG_REGNUM = 8, /* Last argument register */
+ AVR_ARG1_REGNUM = 24, /* Single byte argument */
+ AVR_ARGN_REGNUM = 25, /* Multi byte argments */
+ AVR_LAST_ARG_REGNUM = 8, /* Last argument register */
- AVR_RET1_REGNUM = 24, /* Single byte return value */
- AVR_RETN_REGNUM = 25, /* Multi byte return value */
+ AVR_RET1_REGNUM = 24, /* Single byte return value */
+ AVR_RETN_REGNUM = 25, /* Multi byte return value */
/* FIXME: TRoth/2002-01-??: Can we shift all these memory masks left 8
bits? Do these have to match the bfd vma values? It sure would make
@@ -140,14 +139,14 @@ enum
to the address and letting the remote target handle the low-level
details of actually accessing the eeprom. */
- AVR_IMEM_START = 0x00000000, /* INSN memory */
- AVR_SMEM_START = 0x00800000, /* SRAM memory */
+ AVR_IMEM_START = 0x00000000, /* INSN memory */
+ AVR_SMEM_START = 0x00800000, /* SRAM memory */
#if 1
/* No eeprom mask defined */
- AVR_MEM_MASK = 0x00f00000, /* mask to determine memory space */
+ AVR_MEM_MASK = 0x00f00000, /* mask to determine memory space */
#else
- AVR_EMEM_START = 0x00810000, /* EEPROM memory */
- AVR_MEM_MASK = 0x00ff0000, /* mask to determine memory space */
+ AVR_EMEM_START = 0x00810000, /* EEPROM memory */
+ AVR_MEM_MASK = 0x00ff0000, /* mask to determine memory space */
#endif
};
@@ -156,13 +155,14 @@ enum
NORMAL and CALL are the typical types (the -mcall-prologues gcc option
causes the generation of the CALL type prologues). */
-enum {
- AVR_PROLOGUE_NONE, /* No prologue */
- AVR_PROLOGUE_NORMAL,
- AVR_PROLOGUE_CALL, /* -mcall-prologues */
- AVR_PROLOGUE_MAIN,
- AVR_PROLOGUE_INTR, /* interrupt handler */
- AVR_PROLOGUE_SIG, /* signal handler */
+enum
+{
+ AVR_PROLOGUE_NONE, /* No prologue */
+ AVR_PROLOGUE_NORMAL,
+ AVR_PROLOGUE_CALL, /* -mcall-prologues */
+ AVR_PROLOGUE_MAIN,
+ AVR_PROLOGUE_INTR, /* interrupt handler */
+ AVR_PROLOGUE_SIG, /* signal handler */
};
/* Any function with a frame looks like this
@@ -208,14 +208,11 @@ struct avr_gdbarch_tdep : gdbarch_tdep_base
static const char *
avr_register_name (struct gdbarch *gdbarch, int regnum)
{
- static const char * const register_names[] = {
- "r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7",
- "r8", "r9", "r10", "r11", "r12", "r13", "r14", "r15",
- "r16", "r17", "r18", "r19", "r20", "r21", "r22", "r23",
- "r24", "r25", "r26", "r27", "r28", "r29", "r30", "r31",
- "SREG", "SP", "PC2",
- "pc"
- };
+ static const char *const register_names[]
+ = { "r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7", "r8",
+ "r9", "r10", "r11", "r12", "r13", "r14", "r15", "r16", "r17",
+ "r18", "r19", "r20", "r21", "r22", "r23", "r24", "r25", "r26",
+ "r27", "r28", "r29", "r30", "r31", "SREG", "SP", "PC2", "pc" };
gdb_static_assert (ARRAY_SIZE (register_names)
== (AVR_NUM_REGS + AVR_NUM_PSEUDO_REGS));
return register_names[regnum];
@@ -256,7 +253,7 @@ avr_make_iaddr (CORE_ADDR x)
static CORE_ADDR
avr_convert_iaddr_to_raw (CORE_ADDR x)
{
- return ((x) & 0xffffffff);
+ return ((x) &0xffffffff);
}
/* SRAM address checks and convertions. */
@@ -274,7 +271,7 @@ avr_make_saddr (CORE_ADDR x)
static CORE_ADDR
avr_convert_saddr_to_raw (CORE_ADDR x)
{
- return ((x) & 0xffffffff);
+ return ((x) &0xffffffff);
}
/* EEPROM address checks and convertions. I don't know if these will ever
@@ -304,8 +301,8 @@ avr_convert_saddr_to_raw (CORE_ADDR x)
/* Convert from address to pointer and vice-versa. */
static void
-avr_address_to_pointer (struct gdbarch *gdbarch,
- struct type *type, gdb_byte *buf, CORE_ADDR addr)
+avr_address_to_pointer (struct gdbarch *gdbarch, struct type *type,
+ gdb_byte *buf, CORE_ADDR addr)
{
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
@@ -334,12 +331,11 @@ avr_address_to_pointer (struct gdbarch *gdbarch,
}
static CORE_ADDR
-avr_pointer_to_address (struct gdbarch *gdbarch,
- struct type *type, const gdb_byte *buf)
+avr_pointer_to_address (struct gdbarch *gdbarch, struct type *type,
+ const gdb_byte *buf)
{
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
- CORE_ADDR addr
- = extract_unsigned_integer (buf, type->length (), byte_order);
+ CORE_ADDR addr = extract_unsigned_integer (buf, type->length (), byte_order);
/* Is it a data address in flash? */
if (AVR_TYPE_ADDRESS_CLASS_FLASH (type))
@@ -361,8 +357,8 @@ avr_pointer_to_address (struct gdbarch *gdbarch,
}
static CORE_ADDR
-avr_integer_to_address (struct gdbarch *gdbarch,
- struct type *type, const gdb_byte *buf)
+avr_integer_to_address (struct gdbarch *gdbarch, struct type *type,
+ const gdb_byte *buf)
{
ULONGEST addr = unpack_long (type, buf);
@@ -405,7 +401,7 @@ avr_pseudo_register_read (struct gdbarch *gdbarch, readable_regcache *regcache,
store_unsigned_integer (buf, 4, gdbarch_byte_order (gdbarch), val);
return status;
default:
- internal_error (_("invalid regnum"));
+ internal_error (_ ("invalid regnum"));
}
}
@@ -423,7 +419,7 @@ avr_pseudo_register_write (struct gdbarch *gdbarch, struct regcache *regcache,
regcache_raw_write_unsigned (regcache, AVR_PC_REGNUM, val);
break;
default:
- internal_error (_("invalid regnum"));
+ internal_error (_ ("invalid regnum"));
}
}
@@ -555,8 +551,8 @@ avr_scan_prologue (struct gdbarch *gdbarch, CORE_ADDR pc_beg, CORE_ADDR pc_end,
{
CORE_ADDR locals;
static const unsigned char img[] = {
- 0xde, 0xbf, /* out __SP_H__,r29 */
- 0xcd, 0xbf /* out __SP_L__,r28 */
+ 0xde, 0xbf, /* out __SP_H__,r29 */
+ 0xcd, 0xbf /* out __SP_L__,r28 */
};
insn = extract_unsigned_integer (&prologue[vpc], 2, byte_order);
@@ -583,7 +579,7 @@ avr_scan_prologue (struct gdbarch *gdbarch, CORE_ADDR pc_beg, CORE_ADDR pc_end,
/* Scanning `-mcall-prologues' prologue
Classic prologue is 10 bytes, mega prologue is a 12 bytes long */
- while (1) /* Using a while to avoid many goto's */
+ while (1) /* Using a while to avoid many goto's */
{
int loc_size;
int body_addr;
@@ -638,7 +634,7 @@ avr_scan_prologue (struct gdbarch *gdbarch, CORE_ADDR pc_beg, CORE_ADDR pc_end,
/* Destination address */
i += pc_beg + 10;
- if (body_addr != (pc_beg + 10)/2)
+ if (body_addr != (pc_beg + 10) / 2)
break;
pc_offset += 2;
@@ -652,7 +648,7 @@ avr_scan_prologue (struct gdbarch *gdbarch, CORE_ADDR pc_beg, CORE_ADDR pc_end,
/* Convert address to byte addressable mode */
i *= 2;
- if (body_addr != (pc_beg + 12)/2)
+ if (body_addr != (pc_beg + 12) / 2)
break;
pc_offset += 4;
@@ -666,7 +662,7 @@ avr_scan_prologue (struct gdbarch *gdbarch, CORE_ADDR pc_beg, CORE_ADDR pc_end,
if (num_pushes > AVR_MAX_PUSHES)
{
- gdb_printf (gdb_stderr, _("Num pushes too large: %d\n"),
+ gdb_printf (gdb_stderr, _ ("Num pushes too large: %d\n"),
num_pushes);
num_pushes = 0;
}
@@ -682,7 +678,7 @@ avr_scan_prologue (struct gdbarch *gdbarch, CORE_ADDR pc_beg, CORE_ADDR pc_end,
i = 0;
for (from = AVR_LAST_PUSHED_REGNUM + 1 - (num_pushes - 2);
from <= AVR_LAST_PUSHED_REGNUM; ++from)
- info->saved_regs [from].set_addr (++i);
+ info->saved_regs[from].set_addr (++i);
}
info->size = loc_size + num_pushes;
info->prologue_type = AVR_PROLOGUE_CALL;
@@ -698,15 +694,14 @@ avr_scan_prologue (struct gdbarch *gdbarch, CORE_ADDR pc_beg, CORE_ADDR pc_end,
if (1)
{
static const unsigned char img[] = {
- 0x78, 0x94, /* sei */
- 0x1f, 0x92, /* push r1 */
- 0x0f, 0x92, /* push r0 */
- 0x0f, 0xb6, /* in r0,0x3f SREG */
- 0x0f, 0x92, /* push r0 */
- 0x11, 0x24 /* clr r1 */
+ 0x78, 0x94, /* sei */
+ 0x1f, 0x92, /* push r1 */
+ 0x0f, 0x92, /* push r0 */
+ 0x0f, 0xb6, /* in r0,0x3f SREG */
+ 0x0f, 0x92, /* push r0 */
+ 0x11, 0x24 /* clr r1 */
};
- if (len >= sizeof (img)
- && memcmp (prologue, img, sizeof (img)) == 0)
+ if (len >= sizeof (img) && memcmp (prologue, img, sizeof (img)) == 0)
{
info->prologue_type = AVR_PROLOGUE_INTR;
vpc += sizeof (img);
@@ -733,7 +728,7 @@ avr_scan_prologue (struct gdbarch *gdbarch, CORE_ADDR pc_beg, CORE_ADDR pc_end,
for (; vpc < len; vpc += 2)
{
insn = extract_unsigned_integer (&prologue[vpc], 2, byte_order);
- if ((insn & 0xfe0f) == 0x920f) /* push rXX */
+ if ((insn & 0xfe0f) == 0x920f) /* push rXX */
{
/* Bits 4-9 contain a mask for registers R0-R32. */
int regno = (insn & 0x1f0) >> 4;
@@ -752,12 +747,12 @@ avr_scan_prologue (struct gdbarch *gdbarch, CORE_ADDR pc_beg, CORE_ADDR pc_end,
while (scan_stage == 1 && vpc < len)
{
insn = extract_unsigned_integer (&prologue[vpc], 2, byte_order);
- if (insn == 0xd000) /* rcall .+0 */
+ if (insn == 0xd000) /* rcall .+0 */
{
info->size += tdep->call_length;
vpc += 2;
}
- else if (insn == 0x920f || insn == 0x921f) /* push r0 or push r1 */
+ else if (insn == 0x920f || insn == 0x921f) /* push r0 or push r1 */
{
info->size += 1;
vpc += 2;
@@ -774,8 +769,8 @@ avr_scan_prologue (struct gdbarch *gdbarch, CORE_ADDR pc_beg, CORE_ADDR pc_end,
if (scan_stage == 1 && vpc < len)
{
static const unsigned char img[] = {
- 0xcd, 0xb7, /* in r28,__SP_L__ */
- 0xde, 0xb7 /* in r29,__SP_H__ */
+ 0xcd, 0xb7, /* in r28,__SP_L__ */
+ 0xde, 0xb7 /* in r29,__SP_H__ */
};
if (vpc + sizeof (img) < len
@@ -800,30 +795,30 @@ avr_scan_prologue (struct gdbarch *gdbarch, CORE_ADDR pc_beg, CORE_ADDR pc_end,
{
int locals_size = 0;
static const unsigned char img[] = {
- 0x0f, 0xb6, /* in r0,0x3f */
- 0xf8, 0x94, /* cli */
- 0xde, 0xbf, /* out 0x3e,r29 ; SPH */
- 0x0f, 0xbe, /* out 0x3f,r0 ; SREG */
- 0xcd, 0xbf /* out 0x3d,r28 ; SPL */
+ 0x0f, 0xb6, /* in r0,0x3f */
+ 0xf8, 0x94, /* cli */
+ 0xde, 0xbf, /* out 0x3e,r29 ; SPH */
+ 0x0f, 0xbe, /* out 0x3f,r0 ; SREG */
+ 0xcd, 0xbf /* out 0x3d,r28 ; SPL */
};
static const unsigned char img_sig[] = {
- 0xde, 0xbf, /* out 0x3e,r29 ; SPH */
- 0xcd, 0xbf /* out 0x3d,r28 ; SPL */
+ 0xde, 0xbf, /* out 0x3e,r29 ; SPH */
+ 0xcd, 0xbf /* out 0x3d,r28 ; SPL */
};
static const unsigned char img_int[] = {
- 0xf8, 0x94, /* cli */
- 0xde, 0xbf, /* out 0x3e,r29 ; SPH */
- 0x78, 0x94, /* sei */
- 0xcd, 0xbf /* out 0x3d,r28 ; SPL */
+ 0xf8, 0x94, /* cli */
+ 0xde, 0xbf, /* out 0x3e,r29 ; SPH */
+ 0x78, 0x94, /* sei */
+ 0xcd, 0xbf /* out 0x3d,r28 ; SPL */
};
insn = extract_unsigned_integer (&prologue[vpc], 2, byte_order);
- if ((insn & 0xff30) == 0x9720) /* sbiw r28,XXX */
+ if ((insn & 0xff30) == 0x9720) /* sbiw r28,XXX */
{
locals_size = (insn & 0xf) | ((insn & 0xc0) >> 2);
vpc += 2;
}
- else if ((insn & 0xf0f0) == 0x50c0) /* subi r28,lo8(XX) */
+ else if ((insn & 0xf0f0) == 0x50c0) /* subi r28,lo8(XX) */
{
locals_size = (insn & 0xf) | ((insn & 0xf00) >> 4);
vpc += 2;
@@ -843,7 +838,7 @@ avr_scan_prologue (struct gdbarch *gdbarch, CORE_ADDR pc_beg, CORE_ADDR pc_end,
{
vpc += sizeof (img_sig);
}
- else if (vpc + sizeof (img_int) < len
+ else if (vpc + sizeof (img_int) < len
&& memcmp (prologue + vpc, img_int, sizeof (img_int)) == 0)
{
vpc += sizeof (img_int);
@@ -866,14 +861,14 @@ avr_scan_prologue (struct gdbarch *gdbarch, CORE_ADDR pc_beg, CORE_ADDR pc_end,
for (; vpc < len; vpc += 2)
{
insn = extract_unsigned_integer (&prologue[vpc], 2, byte_order);
- if ((insn & 0xff00) == 0x0100) /* movw rXX, rYY */
+ if ((insn & 0xff00) == 0x0100) /* movw rXX, rYY */
continue;
else if ((insn & 0xfc00) == 0x2c00) /* mov rXX, rYY */
continue;
else
- break;
+ break;
}
-
+
return pc_beg + vpc;
}
@@ -894,17 +889,17 @@ avr_skip_prologue (struct gdbarch *gdbarch, CORE_ADDR pc)
{
CORE_ADDR prologue_end = pc;
- struct avr_unwind_cache info = {0};
+ struct avr_unwind_cache info = { 0 };
trad_frame_saved_reg saved_regs[AVR_NUM_REGS];
info.saved_regs = saved_regs;
-
+
/* Need to run the prologue scanner to figure out if the function has a
prologue and possibly skip over moving arguments passed via registers
to other registers. */
-
+
prologue_end = avr_scan_prologue (gdbarch, func_addr, func_end, &info);
-
+
if (info.prologue_type != AVR_PROLOGUE_NONE)
return prologue_end;
}
@@ -920,7 +915,7 @@ avr_skip_prologue (struct gdbarch *gdbarch, CORE_ADDR pc)
it as a NOP. Thus, it should be ok. Since the avr is currently a remote
only target, this shouldn't be a problem (I hope). TRoth/2003-05-14 */
-constexpr gdb_byte avr_break_insn [] = { 0x98, 0x95 };
+constexpr gdb_byte avr_break_insn[] = { 0x98, 0x95 };
typedef BP_MANIPULATION (avr_break_insn) avr_breakpoint;
@@ -971,7 +966,6 @@ avr_return_value (struct gdbarch *gdbarch, struct value *function,
return RETURN_VALUE_REGISTER_CONVENTION;
}
-
/* Put here the code to store, into fi->saved_regs, the addresses of
the saved registers of frame described by FRAME_INFO. This
includes special registers such as pc and fp saved in special ways
@@ -979,8 +973,7 @@ avr_return_value (struct gdbarch *gdbarch, struct value *function,
for it IS the sp for the next frame. */
static struct avr_unwind_cache *
-avr_frame_unwind_cache (frame_info_ptr this_frame,
- void **this_prologue_cache)
+avr_frame_unwind_cache (frame_info_ptr this_frame, void **this_prologue_cache)
{
CORE_ADDR start_pc, current_pc;
ULONGEST prev_sp;
@@ -1002,13 +995,13 @@ avr_frame_unwind_cache (frame_info_ptr this_frame,
start_pc = get_frame_func (this_frame);
current_pc = get_frame_pc (this_frame);
if ((start_pc > 0) && (start_pc <= current_pc))
- avr_scan_prologue (get_frame_arch (this_frame),
- start_pc, current_pc, info);
+ avr_scan_prologue (get_frame_arch (this_frame), start_pc, current_pc,
+ info);
if ((info->prologue_type != AVR_PROLOGUE_NONE)
&& (info->prologue_type != AVR_PROLOGUE_MAIN))
{
- ULONGEST high_base; /* High byte of FP */
+ ULONGEST high_base; /* High byte of FP */
/* The SP was moved to the FP. This indicates that a new frame
was created. Get THIS frame's FP value by unwinding it from
@@ -1016,11 +1009,11 @@ avr_frame_unwind_cache (frame_info_ptr this_frame,
this_base = get_frame_register_unsigned (this_frame, AVR_FP_REGNUM);
high_base = get_frame_register_unsigned (this_frame, AVR_FP_REGNUM + 1);
this_base += (high_base << 8);
-
+
/* The FP points at the last saved register. Adjust the FP back
to before the first saved register giving the SP. */
- prev_sp = this_base + info->size;
- }
+ prev_sp = this_base + info->size;
+ }
else
{
/* Assume that the FP is this frame's SP but with that pushed
@@ -1052,8 +1045,8 @@ avr_frame_unwind_cache (frame_info_ptr this_frame,
/* The previous frame's SP needed to be computed. Save the computed
value. */
avr_gdbarch_tdep *tdep = gdbarch_tdep<avr_gdbarch_tdep> (gdbarch);
- info->saved_regs[AVR_SP_REGNUM].set_value (info->prev_sp
- - 1 + tdep->call_length);
+ info->saved_regs[AVR_SP_REGNUM].set_value (info->prev_sp - 1
+ + tdep->call_length);
return info;
}
@@ -1082,8 +1075,7 @@ avr_unwind_sp (struct gdbarch *gdbarch, frame_info_ptr next_frame)
frame. This will be used to create a new GDB frame struct. */
static void
-avr_frame_this_id (frame_info_ptr this_frame,
- void **this_prologue_cache,
+avr_frame_this_id (frame_info_ptr this_frame, void **this_prologue_cache,
struct frame_id *this_id)
{
struct avr_unwind_cache *info
@@ -1107,8 +1099,8 @@ avr_frame_this_id (frame_info_ptr this_frame,
}
static struct value *
-avr_frame_prev_register (frame_info_ptr this_frame,
- void **this_prologue_cache, int regnum)
+avr_frame_prev_register (frame_info_ptr this_frame, void **this_prologue_cache,
+ int regnum)
{
struct avr_unwind_cache *info
= avr_frame_unwind_cache (this_frame, this_prologue_cache);
@@ -1135,8 +1127,8 @@ avr_frame_prev_register (frame_info_ptr this_frame,
struct gdbarch *gdbarch = get_frame_arch (this_frame);
avr_gdbarch_tdep *tdep = gdbarch_tdep<avr_gdbarch_tdep> (gdbarch);
- read_memory (info->saved_regs[AVR_PC_REGNUM].addr (),
- buf, tdep->call_length);
+ read_memory (info->saved_regs[AVR_PC_REGNUM].addr (), buf,
+ tdep->call_length);
/* Extract the PC read from memory as a big-endian. */
pc = 0;
@@ -1155,15 +1147,14 @@ avr_frame_prev_register (frame_info_ptr this_frame,
return trad_frame_get_prev_register (this_frame, info->saved_regs, regnum);
}
-static const struct frame_unwind avr_frame_unwind = {
- "avr prologue",
- NORMAL_FRAME,
- default_frame_unwind_stop_reason,
- avr_frame_this_id,
- avr_frame_prev_register,
- NULL,
- default_frame_sniffer
-};
+static const struct frame_unwind avr_frame_unwind
+ = { "avr prologue",
+ NORMAL_FRAME,
+ default_frame_unwind_stop_reason,
+ avr_frame_this_id,
+ avr_frame_prev_register,
+ NULL,
+ default_frame_sniffer };
static CORE_ADDR
avr_frame_base_address (frame_info_ptr this_frame, void **this_cache)
@@ -1174,12 +1165,9 @@ avr_frame_base_address (frame_info_ptr this_frame, void **this_cache)
return info->base;
}
-static const struct frame_base avr_frame_base = {
- &avr_frame_unwind,
- avr_frame_base_address,
- avr_frame_base_address,
- avr_frame_base_address
-};
+static const struct frame_base avr_frame_base
+ = { &avr_frame_unwind, avr_frame_base_address, avr_frame_base_address,
+ avr_frame_base_address };
/* Assuming THIS_FRAME is a dummy, return the frame ID of that dummy
frame. The frame ID's base needs to match the TOS value saved by
@@ -1268,8 +1256,8 @@ pop_stack_item (struct avr_stack_item *si)
static CORE_ADDR
avr_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
- struct regcache *regcache, CORE_ADDR bp_addr,
- int nargs, struct value **args, CORE_ADDR sp,
+ struct regcache *regcache, CORE_ADDR bp_addr, int nargs,
+ struct value **args, CORE_ADDR sp,
function_call_return_method return_method,
CORE_ADDR struct_addr)
{
@@ -1283,10 +1271,9 @@ avr_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
if (return_method == return_method_struct)
{
- regcache_cooked_write_unsigned
- (regcache, regnum--, (struct_addr >> 8) & 0xff);
- regcache_cooked_write_unsigned
- (regcache, regnum--, struct_addr & 0xff);
+ regcache_cooked_write_unsigned (regcache, regnum--,
+ (struct_addr >> 8) & 0xff);
+ regcache_cooked_write_unsigned (regcache, regnum--, struct_addr & 0xff);
/* SP being post decremented, we need to reserve one byte so that the
return address won't overwrite the result (or vice-versa). */
if (sp == struct_addr)
@@ -1318,8 +1305,8 @@ avr_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
/* Write MSB of argument into register and subsequent bytes in
decreasing register numbers. */
for (j = 0; j < len; j++)
- regcache_cooked_write_unsigned
- (regcache, regnum--, contents[len - j - 1]);
+ regcache_cooked_write_unsigned (regcache, regnum--,
+ contents[len - j - 1]);
}
/* No registers available, push the args onto the stack. */
else
@@ -1393,7 +1380,7 @@ avr_address_class_type_flags (int byte_size, int dwarf2_addr_class)
Convert a type_instance_flag_value to an address space qualifier. */
-static const char*
+static const char *
avr_address_class_type_flags_to_name (struct gdbarch *gdbarch,
type_instance_flags type_flags)
{
@@ -1409,7 +1396,7 @@ avr_address_class_type_flags_to_name (struct gdbarch *gdbarch,
static bool
avr_address_class_name_to_type_flags (struct gdbarch *gdbarch,
- const char* name,
+ const char *name,
type_instance_flags *type_flags_ptr)
{
if (strcmp (name, "flash") == 0)
@@ -1468,13 +1455,13 @@ avr_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
gdbarch *gdbarch
= gdbarch_alloc (&info, gdbarch_tdep_up (new avr_gdbarch_tdep));
avr_gdbarch_tdep *tdep = gdbarch_tdep<avr_gdbarch_tdep> (gdbarch);
-
+
tdep->call_length = call_length;
/* Create a type for PC. We can't use builtin types here, as they may not
be defined. */
- tdep->void_type = arch_type (gdbarch, TYPE_CODE_VOID, TARGET_CHAR_BIT,
- "void");
+ tdep->void_type
+ = arch_type (gdbarch, TYPE_CODE_VOID, TARGET_CHAR_BIT, "void");
tdep->func_void_type = make_function_type (tdep->void_type, NULL);
tdep->pc_type = arch_pointer_type (gdbarch, 4 * TARGET_CHAR_BIT, NULL,
tdep->func_void_type);
@@ -1537,10 +1524,10 @@ avr_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
set_gdbarch_unwind_sp (gdbarch, avr_unwind_sp);
set_gdbarch_address_class_type_flags (gdbarch, avr_address_class_type_flags);
- set_gdbarch_address_class_name_to_type_flags
- (gdbarch, avr_address_class_name_to_type_flags);
- set_gdbarch_address_class_type_flags_to_name
- (gdbarch, avr_address_class_type_flags_to_name);
+ set_gdbarch_address_class_name_to_type_flags (
+ gdbarch, avr_address_class_name_to_type_flags);
+ set_gdbarch_address_class_type_flags_to_name (
+ gdbarch, avr_address_class_type_flags_to_name);
return gdbarch;
}
@@ -1567,14 +1554,13 @@ avr_io_reg_read_command (const char *args, int from_tty)
/* Find out how many io registers the target has. */
gdb::optional<gdb::byte_vector> buf
- = target_read_alloc (current_inferior ()->top_target (),
- TARGET_OBJECT_AVR, "avr.io_reg");
+ = target_read_alloc (current_inferior ()->top_target (), TARGET_OBJECT_AVR,
+ "avr.io_reg");
if (!buf)
{
- gdb_printf (gdb_stderr,
- _("ERR: info io_registers NOT supported "
- "by current target\n"));
+ gdb_printf (gdb_stderr, _ ("ERR: info io_registers NOT supported "
+ "by current target\n"));
return;
}
@@ -1582,12 +1568,11 @@ avr_io_reg_read_command (const char *args, int from_tty)
if (sscanf (bufstr, "%x", &nreg) != 1)
{
- gdb_printf (gdb_stderr,
- _("Error fetching number of io registers\n"));
+ gdb_printf (gdb_stderr, _ ("Error fetching number of io registers\n"));
return;
}
- gdb_printf (_("Target has %u io registers:\n\n"), nreg);
+ gdb_printf (_ ("Target has %u io registers:\n\n"), nreg);
/* only fetch up to 8 registers at a time to keep the buffer small */
int step = 8;
@@ -1596,8 +1581,8 @@ avr_io_reg_read_command (const char *args, int from_tty)
{
/* how many registers this round? */
int j = step;
- if ((i+j) >= nreg)
- j = nreg - i; /* last block is less than 8 registers */
+ if ((i + j) >= nreg)
+ j = nreg - i; /* last block is less than 8 registers */
snprintf (query, sizeof (query) - 1, "avr.io_reg:%x,%x", i, j);
buf = target_read_alloc (current_inferior ()->top_target (),
@@ -1605,8 +1590,7 @@ avr_io_reg_read_command (const char *args, int from_tty)
if (!buf)
{
- gdb_printf (gdb_stderr,
- _("ERR: error reading avr.io_reg:%x,%x\n"),
+ gdb_printf (gdb_stderr, _ ("ERR: error reading avr.io_reg:%x,%x\n"),
i, j);
return;
}
@@ -1619,7 +1603,7 @@ avr_io_reg_read_command (const char *args, int from_tty)
gdb_printf ("[%02x] %-15s : %02x\n", k, query, val);
while ((*p != ';') && (*p != '\0'))
p++;
- p++; /* skip over ';' */
+ p++; /* skip over ';' */
if (*p == '\0')
break;
}
@@ -1628,6 +1612,7 @@ avr_io_reg_read_command (const char *args, int from_tty)
}
void _initialize_avr_tdep ();
+
void
_initialize_avr_tdep ()
{
@@ -1641,5 +1626,5 @@ _initialize_avr_tdep ()
io_registers' to signify it is not available on other platforms. */
add_info ("io_registers", avr_io_reg_read_command,
- _("Query remote AVR target for I/O space register values."));
+ _ ("Query remote AVR target for I/O space register values."));
}
diff --git a/gdb/ax-gdb.c b/gdb/ax-gdb.c
index fc214e7dfe1..e28365e9cb5 100644
--- a/gdb/ax-gdb.c
+++ b/gdb/ax-gdb.c
@@ -64,8 +64,6 @@
strings.
Remember, "GBD" stands for "Great Britain, Dammit!" So be careful. */
-
-
/* Prototypes for local functions. */
@@ -80,7 +78,6 @@ static void gen_extend (struct agent_expr *, struct type *);
static void gen_fetch (struct agent_expr *, struct type *);
static void gen_left_shift (struct agent_expr *, int);
-
static void gen_frame_args_address (struct agent_expr *);
static void gen_frame_locals_address (struct agent_expr *);
static void gen_offset (struct agent_expr *ax, int offset);
@@ -88,26 +85,24 @@ static void gen_sym_offset (struct agent_expr *, struct symbol *);
static void gen_var_ref (struct agent_expr *ax, struct axs_value *value,
struct symbol *var);
-
-static void gen_int_literal (struct agent_expr *ax,
- struct axs_value *value,
+static void gen_int_literal (struct agent_expr *ax, struct axs_value *value,
LONGEST k, struct type *type);
static void gen_usual_unary (struct agent_expr *ax, struct axs_value *value);
static int type_wider_than (struct type *type1, struct type *type2);
static struct type *max_type (struct type *type1, struct type *type2);
-static void gen_conversion (struct agent_expr *ax,
- struct type *from, struct type *to);
+static void gen_conversion (struct agent_expr *ax, struct type *from,
+ struct type *to);
static int is_nontrivial_conversion (struct type *from, struct type *to);
static void gen_usual_arithmetic (struct agent_expr *ax,
struct axs_value *value1,
struct axs_value *value2);
static void gen_integral_promotions (struct agent_expr *ax,
struct axs_value *value);
-static void gen_cast (struct agent_expr *ax,
- struct axs_value *value, struct type *type);
-static void gen_scale (struct agent_expr *ax,
- enum agent_op op, struct type *type);
+static void gen_cast (struct agent_expr *ax, struct axs_value *value,
+ struct type *type);
+static void gen_scale (struct agent_expr *ax, enum agent_op op,
+ struct type *type);
static void gen_ptradd (struct agent_expr *ax, struct axs_value *value,
struct axs_value *value1, struct axs_value *value2);
static void gen_ptrsub (struct agent_expr *ax, struct axs_value *value,
@@ -115,13 +110,10 @@ static void gen_ptrsub (struct agent_expr *ax, struct axs_value *value,
static void gen_ptrdiff (struct agent_expr *ax, struct axs_value *value,
struct axs_value *value1, struct axs_value *value2,
struct type *result_type);
-static void gen_binop (struct agent_expr *ax,
- struct axs_value *value,
- struct axs_value *value1,
- struct axs_value *value2,
- enum agent_op op,
- enum agent_op op_unsigned, int may_carry,
- const char *name);
+static void gen_binop (struct agent_expr *ax, struct axs_value *value,
+ struct axs_value *value1, struct axs_value *value2,
+ enum agent_op op, enum agent_op op_unsigned,
+ int may_carry, const char *name);
static void gen_logical_not (struct agent_expr *ax, struct axs_value *value,
struct type *result_type);
static void gen_complement (struct agent_expr *ax, struct axs_value *value);
@@ -130,28 +122,23 @@ static void gen_address_of (struct axs_value *);
static void gen_bitfield_ref (struct agent_expr *ax, struct axs_value *value,
struct type *type, int start, int end);
static void gen_primitive_field (struct agent_expr *ax,
- struct axs_value *value,
- int offset, int fieldno, struct type *type);
+ struct axs_value *value, int offset,
+ int fieldno, struct type *type);
static int gen_struct_ref_recursive (struct agent_expr *ax,
struct axs_value *value,
const char *field, int offset,
struct type *type);
-static void gen_struct_ref (struct agent_expr *ax,
- struct axs_value *value,
- const char *field,
- const char *operator_name,
+static void gen_struct_ref (struct agent_expr *ax, struct axs_value *value,
+ const char *field, const char *operator_name,
const char *operand_name);
static void gen_static_field (struct agent_expr *ax, struct axs_value *value,
struct type *type, int fieldno);
-static void gen_expr_binop_rest (struct expression *exp,
- enum exp_opcode op,
+static void gen_expr_binop_rest (struct expression *exp, enum exp_opcode op,
struct agent_expr *ax,
struct axs_value *value,
struct axs_value *value1,
struct axs_value *value2);
-
-
/* Generating bytecode from GDB expressions: general assumptions */
/* Here are a few general assumptions made throughout the code; if you
@@ -194,14 +181,12 @@ static void gen_expr_binop_rest (struct expression *exp,
extend after add, because it could overflow; if nothing is
extended, then you end up producing extends whenever you change
sizes), and this is simpler.) */
-
/* Scan for all static fields in the given class, including any base
classes, and generate tracing bytecodes for each. */
static void
-gen_trace_static_fields (struct agent_expr *ax,
- struct type *type)
+gen_trace_static_fields (struct agent_expr *ax, struct type *type)
{
int i, nbases = TYPE_N_BASECLASSES (type);
struct axs_value value;
@@ -253,8 +238,7 @@ static void
gen_traced_pop (struct agent_expr *ax, struct axs_value *value)
{
int string_trace = 0;
- if (ax->trace_string
- && value->type->code () == TYPE_CODE_PTR
+ if (ax->trace_string && value->type->code () == TYPE_CODE_PTR
&& c_textual_element_type (check_typedef (value->type->target_type ()),
's'))
string_trace = 1;
@@ -304,7 +288,7 @@ gen_traced_pop (struct agent_expr *ax, struct axs_value *value)
larger than will fit in a stack, so just mark it for
collection and be done with it. */
ax_reg_mask (ax, value->u.reg);
-
+
/* But if the register points to a string, assume the value
will fit on the stack and push it anyway. */
if (string_trace)
@@ -325,8 +309,6 @@ gen_traced_pop (struct agent_expr *ax, struct axs_value *value)
|| value->type->code () == TYPE_CODE_UNION))
gen_trace_static_fields (ax, value->type);
}
-
-
/* Generating bytecode from GDB expressions: helper functions */
@@ -340,7 +322,6 @@ gen_sign_extend (struct agent_expr *ax, struct type *type)
ax_ext (ax, type->length () * TARGET_CHAR_BIT);
}
-
/* Assume the lower bits of the top of the stack hold a value of type
TYPE, and the upper bits are garbage. Sign-extend or truncate as
needed. */
@@ -353,7 +334,6 @@ gen_extend (struct agent_expr *ax, struct type *type)
((type->is_unsigned () ? ax_zero_ext : ax_ext) (ax, bits));
}
-
/* Assume that the top of the stack contains a value of type "pointer
to TYPE"; generate code to fetch its value. Note that TYPE is the
target type, not the pointer type. */
@@ -400,7 +380,7 @@ gen_fetch (struct agent_expr *ax, struct type *type)
implementing something we should be (this code's fault).
In any case, it's a bug the user shouldn't see. */
default:
- internal_error (_("gen_fetch: strange size"));
+ internal_error (_ ("gen_fetch: strange size"));
}
gen_sign_extend (ax, type);
@@ -410,12 +390,10 @@ gen_fetch (struct agent_expr *ax, struct type *type)
/* Our caller requested us to dereference a pointer from an unsupported
type. Error out and give callers a chance to handle the failure
gracefully. */
- error (_("gen_fetch: Unsupported type code `%s'."),
- type->name ());
+ error (_ ("gen_fetch: Unsupported type code `%s'."), type->name ());
}
}
-
/* Generate code to left shift the top of the stack by DISTANCE bits, or
right shift it by -DISTANCE bits if DISTANCE < 0. This generates
unsigned (logical) right shifts. */
@@ -433,8 +411,6 @@ gen_left_shift (struct agent_expr *ax, int distance)
ax_simple (ax, aop_rsh_unsigned);
}
}
-
-
/* Generating bytecode from GDB expressions: symbol references */
@@ -446,13 +422,12 @@ gen_frame_args_address (struct agent_expr *ax)
int frame_reg;
LONGEST frame_offset;
- gdbarch_virtual_frame_pointer (ax->gdbarch,
- ax->scope, &frame_reg, &frame_offset);
+ gdbarch_virtual_frame_pointer (ax->gdbarch, ax->scope, &frame_reg,
+ &frame_offset);
ax_reg (ax, frame_reg);
gen_offset (ax, frame_offset);
}
-
/* Generate code to push the base address of the locals portion of the
top stack frame. */
static void
@@ -461,13 +436,12 @@ gen_frame_locals_address (struct agent_expr *ax)
int frame_reg;
LONGEST frame_offset;
- gdbarch_virtual_frame_pointer (ax->gdbarch,
- ax->scope, &frame_reg, &frame_offset);
+ gdbarch_virtual_frame_pointer (ax->gdbarch, ax->scope, &frame_reg,
+ &frame_offset);
ax_reg (ax, frame_reg);
gen_offset (ax, frame_offset);
}
-
/* Generate code to add OFFSET to the top of the stack. Try to
generate short and readable code. We use this for getting to
variables on the stack, and structure members. If we were
@@ -491,7 +465,6 @@ gen_offset (struct agent_expr *ax, int offset)
}
}
-
/* In many cases, a symbol's value is the offset from some other
address (stack frame, base register, etc.) Generate code to add
VAR's value to the top of the stack. */
@@ -501,12 +474,12 @@ gen_sym_offset (struct agent_expr *ax, struct symbol *var)
gen_offset (ax, var->value_longest ());
}
-
/* Generate code for a variable reference to AX. The variable is the
symbol VAR. Set VALUE to describe the result. */
static void
-gen_var_ref (struct agent_expr *ax, struct axs_value *value, struct symbol *var)
+gen_var_ref (struct agent_expr *ax, struct axs_value *value,
+ struct symbol *var)
{
/* Dereference any typedefs. */
value->type = check_typedef (var->type ());
@@ -521,19 +494,19 @@ gen_var_ref (struct agent_expr *ax, struct axs_value *value, struct symbol *var)
/* I'm imitating the code in read_var_value. */
switch (var->aclass ())
{
- case LOC_CONST: /* A constant, like an enum value. */
+ case LOC_CONST: /* A constant, like an enum value. */
ax_const_l (ax, (LONGEST) var->value_longest ());
value->kind = axs_rvalue;
break;
- case LOC_LABEL: /* A goto label, being used as a value. */
+ case LOC_LABEL: /* A goto label, being used as a value. */
ax_const_l (ax, (LONGEST) var->value_address ());
value->kind = axs_rvalue;
break;
case LOC_CONST_BYTES:
- internal_error (_("gen_var_ref: LOC_CONST_BYTES "
- "symbols are not supported"));
+ internal_error (_ ("gen_var_ref: LOC_CONST_BYTES "
+ "symbols are not supported"));
/* Variable at a fixed location in memory. Easy. */
case LOC_STATIC:
@@ -542,13 +515,13 @@ gen_var_ref (struct agent_expr *ax, struct axs_value *value, struct symbol *var)
value->kind = axs_lvalue_memory;
break;
- case LOC_ARG: /* var lives in argument area of frame */
+ case LOC_ARG: /* var lives in argument area of frame */
gen_frame_args_address (ax);
gen_sym_offset (ax, var);
value->kind = axs_lvalue_memory;
break;
- case LOC_REF_ARG: /* As above, but the frame slot really
+ case LOC_REF_ARG: /* As above, but the frame slot really
holds the address of the variable. */
gen_frame_args_address (ax);
gen_sym_offset (ax, var);
@@ -557,15 +530,14 @@ gen_var_ref (struct agent_expr *ax, struct axs_value *value, struct symbol *var)
value->kind = axs_lvalue_memory;
break;
- case LOC_LOCAL: /* var lives in locals area of frame */
+ case LOC_LOCAL: /* var lives in locals area of frame */
gen_frame_locals_address (ax);
gen_sym_offset (ax, var);
value->kind = axs_lvalue_memory;
break;
case LOC_TYPEDEF:
- error (_("Cannot compute value of typedef `%s'."),
- var->print_name ());
+ error (_ ("Cannot compute value of typedef `%s'."), var->print_name ());
break;
case LOC_BLOCK:
@@ -598,7 +570,7 @@ gen_var_ref (struct agent_expr *ax, struct axs_value *value, struct symbol *var)
= lookup_minimal_symbol (var->linkage_name (), NULL, NULL);
if (!msym.minsym)
- error (_("Couldn't resolve symbol `%s'."), var->print_name ());
+ error (_ ("Couldn't resolve symbol `%s'."), var->print_name ());
/* Push the address of the variable. */
ax_const_l (ax, msym.value_address ());
@@ -616,7 +588,7 @@ gen_var_ref (struct agent_expr *ax, struct axs_value *value, struct symbol *var)
break;
default:
- error (_("Cannot find value of botched symbol `%s'."),
+ error (_ ("Cannot find value of botched symbol `%s'."),
var->print_name ());
break;
}
@@ -627,8 +599,8 @@ gen_var_ref (struct agent_expr *ax, struct axs_value *value, struct symbol *var)
the result. */
static void
-gen_msym_var_ref (agent_expr *ax, axs_value *value,
- minimal_symbol *msymbol, objfile *objf)
+gen_msym_var_ref (agent_expr *ax, axs_value *value, minimal_symbol *msymbol,
+ objfile *objf)
{
CORE_ADDR address;
type *t = find_minsym_type_and_address (msymbol, objf, &address);
@@ -638,9 +610,6 @@ gen_msym_var_ref (agent_expr *ax, axs_value *value,
value->kind = axs_lvalue_memory;
}
-
-
-
/* Generating bytecode from GDB expressions: literals */
static void
@@ -651,8 +620,6 @@ gen_int_literal (struct agent_expr *ax, struct axs_value *value, LONGEST k,
value->kind = axs_rvalue;
value->type = check_typedef (type);
}
-
-
/* Generating bytecode from GDB expressions: unary conversions, casts */
@@ -669,7 +636,7 @@ require_rvalue (struct agent_expr *ax, struct axs_value *value)
|| value->type->code () == TYPE_CODE_STRUCT
|| value->type->code () == TYPE_CODE_UNION
|| value->type->code () == TYPE_CODE_FUNC)
- error (_("Value not scalar: cannot be an rvalue."));
+ error (_ ("Value not scalar: cannot be an rvalue."));
switch (value->kind)
{
@@ -696,7 +663,6 @@ require_rvalue (struct agent_expr *ax, struct axs_value *value)
value->kind = axs_rvalue;
}
-
/* Assume the top of the stack is described by VALUE, and perform the
usual unary conversions. This is motivated by ANSI 6.2.2, but of
course GDB expressions are not ANSI; they're the mishmash union of
@@ -726,7 +692,7 @@ gen_usual_unary (struct agent_expr *ax, struct axs_value *value)
/* Functions get converted to a pointer to the function. */
case TYPE_CODE_FUNC:
value->type = lookup_pointer_type (value->type);
- value->kind = axs_rvalue; /* Should always be true, but just in case. */
+ value->kind = axs_rvalue; /* Should always be true, but just in case. */
break;
/* Arrays get converted to a pointer to their first element, and
@@ -753,19 +719,16 @@ gen_usual_unary (struct agent_expr *ax, struct axs_value *value)
require_rvalue (ax, value);
}
-
/* Return non-zero iff the type TYPE1 is considered "wider" than the
type TYPE2, according to the rules described in gen_usual_arithmetic. */
static int
type_wider_than (struct type *type1, struct type *type2)
{
return (type1->length () > type2->length ()
- || (type1->length () == type2->length ()
- && type1->is_unsigned ()
+ || (type1->length () == type2->length () && type1->is_unsigned ()
&& !type2->is_unsigned ()));
}
-
/* Return the "wider" of the two types TYPE1 and TYPE2. */
static struct type *
max_type (struct type *type1, struct type *type2)
@@ -773,7 +736,6 @@ max_type (struct type *type1, struct type *type2)
return type_wider_than (type1, type2) ? type1 : type2;
}
-
/* Generate code to convert a scalar value of type FROM to type TO. */
static void
gen_conversion (struct agent_expr *ax, struct type *from, struct type *to)
@@ -802,7 +764,6 @@ gen_conversion (struct agent_expr *ax, struct type *from, struct type *to)
}
}
-
/* Return non-zero iff the type FROM will require any bytecodes to be
emitted to be converted to the type TO. */
static int
@@ -822,7 +783,6 @@ is_nontrivial_conversion (struct type *from, struct type *to)
return nontrivial;
}
-
/* Generate code to perform the "usual arithmetic conversions" (ANSI C
6.2.1.5) for the two operands of an arithmetic operator. This
effectively finds a "least upper bound" type for the two arguments,
@@ -861,7 +821,6 @@ gen_usual_arithmetic (struct agent_expr *ax, struct axs_value *value1,
}
}
-
/* Generate code to perform the integral promotions (ANSI 6.2.1.1) on
the value on the top of the stack, as described by VALUE. Assume
the value has integral type. */
@@ -882,7 +841,6 @@ gen_integral_promotions (struct agent_expr *ax, struct axs_value *value)
}
}
-
/* Generate code for a cast to TYPE. */
static void
gen_cast (struct agent_expr *ax, struct axs_value *value, struct type *type)
@@ -906,7 +864,7 @@ gen_cast (struct agent_expr *ax, struct axs_value *value, struct type *type)
case TYPE_CODE_STRUCT:
case TYPE_CODE_UNION:
case TYPE_CODE_FUNC:
- error (_("Invalid type cast: intended type must be scalar."));
+ error (_ ("Invalid type cast: intended type must be scalar."));
case TYPE_CODE_ENUM:
case TYPE_CODE_BOOL:
@@ -929,13 +887,11 @@ gen_cast (struct agent_expr *ax, struct axs_value *value, struct type *type)
break;
default:
- error (_("Casts to requested type are not yet implemented."));
+ error (_ ("Casts to requested type are not yet implemented."));
}
value->type = type;
}
-
-
/* Generating bytecode from GDB expressions: arithmetic */
@@ -953,7 +909,6 @@ gen_scale (struct agent_expr *ax, enum agent_op op, struct type *type)
}
}
-
/* Generate code for pointer arithmetic PTR + INT. */
static void
gen_ptradd (struct agent_expr *ax, struct axs_value *value,
@@ -964,12 +919,11 @@ gen_ptradd (struct agent_expr *ax, struct axs_value *value,
gen_scale (ax, aop_mul, value1->type);
ax_simple (ax, aop_add);
- gen_extend (ax, value1->type); /* Catch overflow. */
+ gen_extend (ax, value1->type); /* Catch overflow. */
value->type = value1->type;
value->kind = axs_rvalue;
}
-
/* Generate code for pointer arithmetic PTR - INT. */
static void
gen_ptrsub (struct agent_expr *ax, struct axs_value *value,
@@ -980,12 +934,11 @@ gen_ptrsub (struct agent_expr *ax, struct axs_value *value,
gen_scale (ax, aop_mul, value1->type);
ax_simple (ax, aop_sub);
- gen_extend (ax, value1->type); /* Catch overflow. */
+ gen_extend (ax, value1->type); /* Catch overflow. */
value->type = value1->type;
value->kind = axs_rvalue;
}
-
/* Generate code for pointer arithmetic PTR - PTR. */
static void
gen_ptrdiff (struct agent_expr *ax, struct axs_value *value,
@@ -997,7 +950,7 @@ gen_ptrdiff (struct agent_expr *ax, struct axs_value *value,
if (value1->type->target_type ()->length ()
!= value2->type->target_type ()->length ())
- error (_("\
+ error (_ ("\
First argument of `-' is a pointer, but second argument is neither\n\
an integer nor a pointer of the same type."));
@@ -1012,11 +965,11 @@ gen_equal (struct agent_expr *ax, struct axs_value *value,
struct axs_value *value1, struct axs_value *value2,
struct type *result_type)
{
- if (value1->type->is_pointer_or_reference () || value2->type->is_pointer_or_reference ())
+ if (value1->type->is_pointer_or_reference ()
+ || value2->type->is_pointer_or_reference ())
ax_simple (ax, aop_equal);
else
- gen_binop (ax, value, value1, value2,
- aop_equal, aop_equal, 0, "equal");
+ gen_binop (ax, value, value1, value2, aop_equal, aop_equal, 0, "equal");
value->type = result_type;
value->kind = axs_rvalue;
}
@@ -1026,11 +979,12 @@ gen_less (struct agent_expr *ax, struct axs_value *value,
struct axs_value *value1, struct axs_value *value2,
struct type *result_type)
{
- if (value1->type->is_pointer_or_reference () || value2->type->is_pointer_or_reference ())
+ if (value1->type->is_pointer_or_reference ()
+ || value2->type->is_pointer_or_reference ())
ax_simple (ax, aop_less_unsigned);
else
- gen_binop (ax, value, value1, value2,
- aop_less_signed, aop_less_unsigned, 0, "less than");
+ gen_binop (ax, value, value1, value2, aop_less_signed, aop_less_unsigned,
+ 0, "less than");
value->type = result_type;
value->kind = axs_rvalue;
}
@@ -1044,46 +998,42 @@ gen_less (struct agent_expr *ax, struct axs_value *value,
static void
gen_binop (struct agent_expr *ax, struct axs_value *value,
struct axs_value *value1, struct axs_value *value2,
- enum agent_op op, enum agent_op op_unsigned,
- int may_carry, const char *name)
+ enum agent_op op, enum agent_op op_unsigned, int may_carry,
+ const char *name)
{
/* We only handle INT op INT. */
if ((value1->type->code () != TYPE_CODE_INT)
|| (value2->type->code () != TYPE_CODE_INT))
- error (_("Invalid combination of types in %s."), name);
+ error (_ ("Invalid combination of types in %s."), name);
ax_simple (ax, value1->type->is_unsigned () ? op_unsigned : op);
if (may_carry)
- gen_extend (ax, value1->type); /* catch overflow */
+ gen_extend (ax, value1->type); /* catch overflow */
value->type = value1->type;
value->kind = axs_rvalue;
}
-
static void
gen_logical_not (struct agent_expr *ax, struct axs_value *value,
struct type *result_type)
{
if (value->type->code () != TYPE_CODE_INT
&& value->type->code () != TYPE_CODE_PTR)
- error (_("Invalid type of operand to `!'."));
+ error (_ ("Invalid type of operand to `!'."));
ax_simple (ax, aop_log_not);
value->type = result_type;
}
-
static void
gen_complement (struct agent_expr *ax, struct axs_value *value)
{
if (value->type->code () != TYPE_CODE_INT)
- error (_("Invalid type of operand to `~'."));
+ error (_ ("Invalid type of operand to `~'."));
ax_simple (ax, aop_bit_not);
gen_extend (ax, value->type);
}
-
-
/* Generating bytecode from GDB expressions: * & . -> @ sizeof */
@@ -1094,7 +1044,7 @@ gen_deref (struct axs_value *value)
/* The caller should check the type, because several operators use
this, and we don't know what error message to generate. */
if (!value->type->is_pointer_or_reference ())
- internal_error (_("gen_deref: expected a pointer"));
+ internal_error (_ ("gen_deref: expected a pointer"));
/* We've got an rvalue now, which is a pointer. We want to yield an
lvalue, whose address is exactly that pointer. So we don't
@@ -1103,12 +1053,11 @@ gen_deref (struct axs_value *value)
to the consumer to actually dereference it. */
value->type = check_typedef (value->type->target_type ());
if (value->type->code () == TYPE_CODE_VOID)
- error (_("Attempt to dereference a generic pointer."));
- value->kind = ((value->type->code () == TYPE_CODE_FUNC)
- ? axs_rvalue : axs_lvalue_memory);
+ error (_ ("Attempt to dereference a generic pointer."));
+ value->kind = ((value->type->code () == TYPE_CODE_FUNC) ? axs_rvalue
+ : axs_lvalue_memory);
}
-
/* Produce the address of the lvalue on the top of the stack. */
static void
gen_address_of (struct axs_value *value)
@@ -1124,10 +1073,10 @@ gen_address_of (struct axs_value *value)
switch (value->kind)
{
case axs_rvalue:
- error (_("Operand of `&' is an rvalue, which has no address."));
+ error (_ ("Operand of `&' is an rvalue, which has no address."));
case axs_lvalue_register:
- error (_("Operand of `&' is in a register, and has no address."));
+ error (_ ("Operand of `&' is in a register, and has no address."));
case axs_lvalue_memory:
value->kind = axs_rvalue;
@@ -1145,8 +1094,8 @@ gen_bitfield_ref (struct agent_expr *ax, struct axs_value *value,
struct type *type, int start, int end)
{
/* Note that ops[i] fetches 8 << i bits. */
- static enum agent_op ops[]
- = {aop_ref8, aop_ref16, aop_ref32, aop_ref64};
+ static enum agent_op ops[] = { aop_ref8, aop_ref16, aop_ref32, aop_ref64 };
+
static int num_ops = (sizeof (ops) / sizeof (ops[0]));
/* We don't want to touch any byte that the bitfield doesn't
@@ -1178,9 +1127,8 @@ gen_bitfield_ref (struct agent_expr *ax, struct axs_value *value,
/* The first and one-after-last bits in the field, but rounded down
and up to byte boundaries. */
int bound_start = (start / TARGET_CHAR_BIT) * TARGET_CHAR_BIT;
- int bound_end = (((end + TARGET_CHAR_BIT - 1)
- / TARGET_CHAR_BIT)
- * TARGET_CHAR_BIT);
+ int bound_end
+ = (((end + TARGET_CHAR_BIT - 1) / TARGET_CHAR_BIT) * TARGET_CHAR_BIT);
/* current bit offset within the structure */
int offset;
@@ -1197,7 +1145,7 @@ gen_bitfield_ref (struct agent_expr *ax, struct axs_value *value,
/* Can we fetch the number of bits requested at all? */
if ((end - start) > ((1 << num_ops) * 8))
- internal_error (_("gen_bitfield_ref: bitfield too wide"));
+ internal_error (_ ("gen_bitfield_ref: bitfield too wide"));
/* Note that we know here that we only need to try each opcode once.
That may not be true on machines with weird byte sizes. */
@@ -1218,7 +1166,7 @@ gen_bitfield_ref (struct agent_expr *ax, struct axs_value *value,
int last_frag = (offset + op_size == bound_end);
if (!last_frag)
- ax_simple (ax, aop_dup); /* keep a copy of the address */
+ ax_simple (ax, aop_dup); /* keep a copy of the address */
/* Add the offset. */
gen_offset (ax, offset / TARGET_CHAR_BIT);
@@ -1304,16 +1252,16 @@ gen_primitive_field (struct agent_expr *ax, struct axs_value *value,
{
/* Is this a bitfield? */
if (TYPE_FIELD_PACKED (type, fieldno))
- gen_bitfield_ref (ax, value, type->field (fieldno).type (),
- (offset * TARGET_CHAR_BIT
- + type->field (fieldno).loc_bitpos ()),
- (offset * TARGET_CHAR_BIT
- + type->field (fieldno).loc_bitpos ()
- + TYPE_FIELD_BITSIZE (type, fieldno)));
+ gen_bitfield_ref (
+ ax, value, type->field (fieldno).type (),
+ (offset * TARGET_CHAR_BIT + type->field (fieldno).loc_bitpos ()),
+ (offset * TARGET_CHAR_BIT + type->field (fieldno).loc_bitpos ()
+ + TYPE_FIELD_BITSIZE (type, fieldno)));
else
{
- gen_offset (ax, offset
- + type->field (fieldno).loc_bitpos () / TARGET_CHAR_BIT);
+ gen_offset (ax,
+ offset
+ + type->field (fieldno).loc_bitpos () / TARGET_CHAR_BIT);
value->kind = axs_lvalue_memory;
value->type = type->field (fieldno).type ();
}
@@ -1347,8 +1295,8 @@ gen_struct_ref_recursive (struct agent_expr *ax, struct axs_value *value,
{
gen_static_field (ax, value, type, i);
if (value->optimized_out)
- error (_("static field `%s' has been "
- "optimized out, cannot use"),
+ error (_ ("static field `%s' has been "
+ "optimized out, cannot use"),
field);
return 1;
}
@@ -1368,10 +1316,9 @@ gen_struct_ref_recursive (struct agent_expr *ax, struct axs_value *value,
{
struct type *basetype = check_typedef (TYPE_BASECLASS (type, i));
- rslt = gen_struct_ref_recursive (ax, value, field,
- offset + TYPE_BASECLASS_BITPOS (type, i)
- / TARGET_CHAR_BIT,
- basetype);
+ rslt = gen_struct_ref_recursive (
+ ax, value, field,
+ offset + TYPE_BASECLASS_BITPOS (type, i) / TARGET_CHAR_BIT, basetype);
if (rslt)
return 1;
}
@@ -1404,30 +1351,29 @@ gen_struct_ref (struct agent_expr *ax, struct axs_value *value,
type = check_typedef (value->type);
/* This must yield a structure or a union. */
- if (type->code () != TYPE_CODE_STRUCT
- && type->code () != TYPE_CODE_UNION)
- error (_("The left operand of `%s' is not a %s."),
- operator_name, operand_name);
+ if (type->code () != TYPE_CODE_STRUCT && type->code () != TYPE_CODE_UNION)
+ error (_ ("The left operand of `%s' is not a %s."), operator_name,
+ operand_name);
/* And it must be in memory; we don't deal with structure rvalues,
or structures living in registers. */
if (value->kind != axs_lvalue_memory)
- error (_("Structure does not live in memory."));
+ error (_ ("Structure does not live in memory."));
/* Search through fields and base classes recursively. */
found = gen_struct_ref_recursive (ax, value, field, 0, type);
-
+
if (!found)
- error (_("Couldn't find member named `%s' in struct/union/class `%s'"),
+ error (_ ("Couldn't find member named `%s' in struct/union/class `%s'"),
field, type->name ());
}
-static int
-gen_namespace_elt (struct agent_expr *ax, struct axs_value *value,
- const struct type *curtype, const char *name);
-static int
-gen_maybe_namespace_elt (struct agent_expr *ax, struct axs_value *value,
- const struct type *curtype, const char *name);
+static int gen_namespace_elt (struct agent_expr *ax, struct axs_value *value,
+ const struct type *curtype, const char *name);
+static int gen_maybe_namespace_elt (struct agent_expr *ax,
+ struct axs_value *value,
+ const struct type *curtype,
+ const char *name);
static void
gen_static_field (struct agent_expr *ax, struct axs_value *value,
@@ -1448,7 +1394,7 @@ gen_static_field (struct agent_expr *ax, struct axs_value *value,
if (sym)
{
gen_var_ref (ax, value, sym);
-
+
/* Don't error if the value was optimized out, we may be
scanning all static fields and just want to pass over this
and continue with the rest. */
@@ -1469,9 +1415,8 @@ gen_struct_elt_for_reference (struct agent_expr *ax, struct axs_value *value,
struct type *t = type;
int i;
- if (t->code () != TYPE_CODE_STRUCT
- && t->code () != TYPE_CODE_UNION)
- internal_error (_("non-aggregate type to gen_struct_elt_for_reference"));
+ if (t->code () != TYPE_CODE_STRUCT && t->code () != TYPE_CODE_UNION)
+ internal_error (_ ("non-aggregate type to gen_struct_elt_for_reference"));
for (i = t->num_fields () - 1; i >= TYPE_N_BASECLASSES (t); i--)
{
@@ -1483,17 +1428,17 @@ gen_struct_elt_for_reference (struct agent_expr *ax, struct axs_value *value,
{
gen_static_field (ax, value, t, i);
if (value->optimized_out)
- error (_("static field `%s' has been "
- "optimized out, cannot use"),
+ error (_ ("static field `%s' has been "
+ "optimized out, cannot use"),
fieldname);
return 1;
}
if (TYPE_FIELD_PACKED (t, i))
- error (_("pointers to bitfield members not allowed"));
+ error (_ ("pointers to bitfield members not allowed"));
- /* FIXME we need a way to do "want_address" equivalent */
+ /* FIXME we need a way to do "want_address" equivalent */
- error (_("Cannot reference non-static field \"%s\""), fieldname);
+ error (_ ("Cannot reference non-static field \"%s\""), fieldname);
}
}
@@ -1513,8 +1458,8 @@ gen_namespace_elt (struct agent_expr *ax, struct axs_value *value,
int found = gen_maybe_namespace_elt (ax, value, curtype, name);
if (!found)
- error (_("No symbol \"%s\" in namespace \"%s\"."),
- name, curtype->name ());
+ error (_ ("No symbol \"%s\" in namespace \"%s\"."), name,
+ curtype->name ());
return found;
}
@@ -1533,8 +1478,7 @@ gen_maybe_namespace_elt (struct agent_expr *ax, struct axs_value *value,
struct block_symbol sym;
sym = cp_lookup_symbol_namespace (namespace_name, name,
- block_for_pc (ax->scope),
- VAR_DOMAIN);
+ block_for_pc (ax->scope), VAR_DOMAIN);
if (sym.symbol == NULL)
return 0;
@@ -1542,13 +1486,12 @@ gen_maybe_namespace_elt (struct agent_expr *ax, struct axs_value *value,
gen_var_ref (ax, value, sym.symbol);
if (value->optimized_out)
- error (_("`%s' has been optimized out, cannot use"),
+ error (_ ("`%s' has been optimized out, cannot use"),
sym.symbol->print_name ());
return 1;
}
-
static int
gen_aggregate_elt_ref (struct agent_expr *ax, struct axs_value *value,
struct type *type, const char *field)
@@ -1563,22 +1506,18 @@ gen_aggregate_elt_ref (struct agent_expr *ax, struct axs_value *value,
return gen_namespace_elt (ax, value, type, field);
break;
default:
- internal_error (_("non-aggregate type in gen_aggregate_elt_ref"));
+ internal_error (_ ("non-aggregate type in gen_aggregate_elt_ref"));
}
return 0;
}
-
-
namespace expr
{
void
-operation::generate_ax (struct expression *exp,
- struct agent_expr *ax,
- struct axs_value *value,
- struct type *cast_type)
+operation::generate_ax (struct expression *exp, struct agent_expr *ax,
+ struct axs_value *value, struct type *cast_type)
{
if (constant_p ())
{
@@ -1596,8 +1535,7 @@ operation::generate_ax (struct expression *exp,
}
void
-scope_operation::do_generate_ax (struct expression *exp,
- struct agent_expr *ax,
+scope_operation::do_generate_ax (struct expression *exp, struct agent_expr *ax,
struct axs_value *value,
struct type *cast_type)
{
@@ -1605,7 +1543,7 @@ scope_operation::do_generate_ax (struct expression *exp,
const std::string &name = std::get<1> (m_storage);
int found = gen_aggregate_elt_ref (ax, value, type, name.c_str ());
if (!found)
- error (_("There is no field named %s"), name.c_str ());
+ error (_ ("There is no field named %s"), name.c_str ());
}
void
@@ -1647,11 +1585,11 @@ register_operation::do_generate_ax (struct expression *exp,
reg = user_reg_map_name_to_regnum (ax->gdbarch, name, len);
if (reg == -1)
- internal_error (_("Register $%s not available"), name);
+ internal_error (_ ("Register $%s not available"), name);
/* No support for tracing user registers yet. */
if (reg >= gdbarch_num_cooked_regs (ax->gdbarch))
- error (_("'%s' is a user-register; "
- "GDB cannot yet trace user-register contents."),
+ error (_ ("'%s' is a user-register; "
+ "GDB cannot yet trace user-register contents."),
name);
value->kind = axs_lvalue_register;
value->u.reg = reg;
@@ -1678,9 +1616,10 @@ internalvar_operation::do_generate_ax (struct expression *exp,
value->kind = axs_rvalue;
value->type = builtin_type (ax->gdbarch)->builtin_long_long;
}
- else if (! compile_internalvar_to_ax (var, ax, value))
- error (_("$%s is not a trace state variable; GDB agent "
- "expressions cannot use convenience variables."), name);
+ else if (!compile_internalvar_to_ax (var, ax, value))
+ error (_ ("$%s is not a trace state variable; GDB agent "
+ "expressions cannot use convenience variables."),
+ name);
}
void
@@ -1735,36 +1674,34 @@ repeat_operation::do_generate_ax (struct expression *exp,
here. */
std::get<0> (m_storage)->generate_ax (exp, ax, &value1);
if (value1.kind != axs_lvalue_memory)
- error (_("Left operand of `@' must be an object in memory."));
+ error (_ ("Left operand of `@' must be an object in memory."));
/* Evaluate the length; it had better be a constant. */
if (!std::get<1> (m_storage)->constant_p ())
- error (_("Right operand of `@' must be a "
- "constant, in agent expressions."));
+ error (_ ("Right operand of `@' must be a "
+ "constant, in agent expressions."));
struct value *v
= std::get<1> (m_storage)->evaluate (nullptr, exp,
EVAL_AVOID_SIDE_EFFECTS);
if (value_type (v)->code () != TYPE_CODE_INT)
- error (_("Right operand of `@' must be an integer."));
+ error (_ ("Right operand of `@' must be an integer."));
int length = value_as_long (v);
if (length <= 0)
- error (_("Right operand of `@' must be positive."));
+ error (_ ("Right operand of `@' must be positive."));
/* The top of the stack is already the address of the object, so
all we need to do is frob the type of the lvalue. */
/* FIXME-type-allocation: need a way to free this type when we are
done with it. */
- struct type *array
- = lookup_array_range_type (value1.type, 0, length - 1);
+ struct type *array = lookup_array_range_type (value1.type, 0, length - 1);
value->kind = axs_lvalue_memory;
value->type = array;
}
void
-comma_operation::do_generate_ax (struct expression *exp,
- struct agent_expr *ax,
+comma_operation::do_generate_ax (struct expression *exp, struct agent_expr *ax,
struct axs_value *value,
struct type *cast_type)
{
@@ -1828,7 +1765,7 @@ unop_extract_operation::do_generate_ax (struct expression *exp,
struct type *to_type = get_type ();
if (!is_scalar_type (to_type))
- error (_("can't generate agent expression to extract non-scalar type"));
+ error (_ ("can't generate agent expression to extract non-scalar type"));
if (to_type->is_unsigned ())
gen_extend (ax, to_type);
@@ -1892,13 +1829,12 @@ op_this_operation::do_generate_ax (struct expression *exp,
sym = lookup_language_this (lang, b).symbol;
if (!sym)
- error (_("no `%s' found"), lang->name_of_this ());
+ error (_ ("no `%s' found"), lang->name_of_this ());
gen_var_ref (ax, value, sym);
if (value->optimized_out)
- error (_("`%s' has been optimized out, cannot use"),
- sym->print_name ());
+ error (_ ("`%s' has been optimized out, cannot use"), sym->print_name ());
}
void
@@ -1909,7 +1845,7 @@ assign_operation::do_generate_ax (struct expression *exp,
{
operation *subop = std::get<0> (m_storage).get ();
if (subop->opcode () != OP_INTERNALVAR)
- error (_("May only assign to trace state variables"));
+ error (_ ("May only assign to trace state variables"));
internalvar_operation *ivarop
= gdb::checked_static_cast<internalvar_operation *> (subop);
@@ -1926,8 +1862,9 @@ assign_operation::do_generate_ax (struct expression *exp,
ax_tsv (ax, aop_tracev, tsv->number);
}
else
- error (_("$%s is not a trace state variable, "
- "may not assign to it"), name);
+ error (_ ("$%s is not a trace state variable, "
+ "may not assign to it"),
+ name);
}
void
@@ -1938,7 +1875,7 @@ assign_modify_operation::do_generate_ax (struct expression *exp,
{
operation *subop = std::get<1> (m_storage).get ();
if (subop->opcode () != OP_INTERNALVAR)
- error (_("May only assign to trace state variables"));
+ error (_ ("May only assign to trace state variables"));
internalvar_operation *ivarop
= gdb::checked_static_cast<internalvar_operation *> (subop);
@@ -1959,16 +1896,17 @@ assign_modify_operation::do_generate_ax (struct expression *exp,
value1.type = builtin_type (ax->gdbarch)->builtin_long_long;
/* Now do right half of expression. */
std::get<2> (m_storage)->generate_ax (exp, ax, &value2);
- gen_expr_binop_rest (exp, std::get<0> (m_storage), ax,
- value, &value1, &value2);
+ gen_expr_binop_rest (exp, std::get<0> (m_storage), ax, value, &value1,
+ &value2);
/* We have a result of the binary op, set the tsv. */
ax_tsv (ax, aop_setv, tsv->number);
if (ax->tracing)
ax_tsv (ax, aop_tracev, tsv->number);
}
else
- error (_("$%s is not a trace state variable, "
- "may not assign to it"), name);
+ error (_ ("$%s is not a trace state variable, "
+ "may not assign to it"),
+ name);
}
void
@@ -1992,7 +1930,7 @@ var_value_operation::do_generate_ax (struct expression *exp,
gen_var_ref (ax, value, std::get<0> (m_storage).symbol);
if (value->optimized_out)
- error (_("`%s' has been optimized out, cannot use"),
+ error (_ ("`%s' has been optimized out, cannot use"),
std::get<0> (m_storage).symbol->print_name ());
if (value->type->code () == TYPE_CODE_ERROR)
@@ -2059,15 +1997,14 @@ logical_or_operation::do_generate_ax (struct expression *exp,
value->type = builtin_type (ax->gdbarch)->builtin_int;
}
-}
+} // namespace expr
/* This handles the middle-to-right-side of code generation for binary
expressions, which is shared between regular binary operations and
assign-modify (+= and friends) expressions. */
static void
-gen_expr_binop_rest (struct expression *exp,
- enum exp_opcode op,
+gen_expr_binop_rest (struct expression *exp, enum exp_opcode op,
struct agent_expr *ax, struct axs_value *value,
struct axs_value *value1, struct axs_value *value2)
{
@@ -2089,41 +2026,39 @@ gen_expr_binop_rest (struct expression *exp,
&& value2->type->code () == TYPE_CODE_INT)
gen_ptradd (ax, value, value1, value2);
else
- gen_binop (ax, value, value1, value2,
- aop_add, aop_add, 1, "addition");
+ gen_binop (ax, value, value1, value2, aop_add, aop_add, 1, "addition");
break;
case BINOP_SUB:
if (value1->type->is_pointer_or_reference ()
&& value2->type->code () == TYPE_CODE_INT)
- gen_ptrsub (ax,value, value1, value2);
+ gen_ptrsub (ax, value, value1, value2);
else if (value1->type->is_pointer_or_reference ()
&& value2->type->is_pointer_or_reference ())
/* FIXME --- result type should be ptrdiff_t */
gen_ptrdiff (ax, value, value1, value2,
builtin_type (ax->gdbarch)->builtin_long);
else
- gen_binop (ax, value, value1, value2,
- aop_sub, aop_sub, 1, "subtraction");
+ gen_binop (ax, value, value1, value2, aop_sub, aop_sub, 1,
+ "subtraction");
break;
case BINOP_MUL:
- gen_binop (ax, value, value1, value2,
- aop_mul, aop_mul, 1, "multiplication");
+ gen_binop (ax, value, value1, value2, aop_mul, aop_mul, 1,
+ "multiplication");
break;
case BINOP_DIV:
- gen_binop (ax, value, value1, value2,
- aop_div_signed, aop_div_unsigned, 1, "division");
+ gen_binop (ax, value, value1, value2, aop_div_signed, aop_div_unsigned,
+ 1, "division");
break;
case BINOP_REM:
- gen_binop (ax, value, value1, value2,
- aop_rem_signed, aop_rem_unsigned, 1, "remainder");
+ gen_binop (ax, value, value1, value2, aop_rem_signed, aop_rem_unsigned,
+ 1, "remainder");
break;
case BINOP_LSH:
- gen_binop (ax, value, value1, value2,
- aop_lsh, aop_lsh, 1, "left shift");
+ gen_binop (ax, value, value1, value2, aop_lsh, aop_lsh, 1, "left shift");
break;
case BINOP_RSH:
- gen_binop (ax, value, value1, value2,
- aop_rsh_signed, aop_rsh_unsigned, 1, "right shift");
+ gen_binop (ax, value, value1, value2, aop_rsh_signed, aop_rsh_unsigned,
+ 1, "right shift");
break;
case BINOP_SUBSCRIPT:
{
@@ -2131,8 +2066,8 @@ gen_expr_binop_rest (struct expression *exp,
if (binop_types_user_defined_p (op, value1->type, value2->type))
{
- error (_("cannot subscript requested type: "
- "cannot call user defined functions"));
+ error (_ ("cannot subscript requested type: "
+ "cannot call user defined functions"));
}
else
{
@@ -2144,34 +2079,34 @@ gen_expr_binop_rest (struct expression *exp,
&& type->code () != TYPE_CODE_PTR)
{
if (type->name ())
- error (_("cannot subscript something of type `%s'"),
+ error (_ ("cannot subscript something of type `%s'"),
type->name ());
else
- error (_("cannot subscript requested type"));
+ error (_ ("cannot subscript requested type"));
}
}
if (!is_integral_type (value2->type))
- error (_("Argument to arithmetic operation "
- "not a number or boolean."));
+ error (_ ("Argument to arithmetic operation "
+ "not a number or boolean."));
gen_ptradd (ax, value, value1, value2);
gen_deref (value);
break;
}
case BINOP_BITWISE_AND:
- gen_binop (ax, value, value1, value2,
- aop_bit_and, aop_bit_and, 0, "bitwise and");
+ gen_binop (ax, value, value1, value2, aop_bit_and, aop_bit_and, 0,
+ "bitwise and");
break;
case BINOP_BITWISE_IOR:
- gen_binop (ax, value, value1, value2,
- aop_bit_or, aop_bit_or, 0, "bitwise or");
+ gen_binop (ax, value, value1, value2, aop_bit_or, aop_bit_or, 0,
+ "bitwise or");
break;
-
+
case BINOP_BITWISE_XOR:
- gen_binop (ax, value, value1, value2,
- aop_bit_xor, aop_bit_xor, 0, "bitwise exclusive-or");
+ gen_binop (ax, value, value1, value2, aop_bit_xor, aop_bit_xor, 0,
+ "bitwise exclusive-or");
break;
case BINOP_EQUAL:
@@ -2206,15 +2141,14 @@ gen_expr_binop_rest (struct expression *exp,
default:
/* We should only list operators in the outer case statement
that we actually handle in the inner case statement. */
- internal_error (_("gen_expr: op case sets don't match"));
+ internal_error (_ ("gen_expr: op case sets don't match"));
}
}
/* A helper function that emits a binop based on two operations. */
void
-gen_expr_binop (struct expression *exp,
- enum exp_opcode op,
+gen_expr_binop (struct expression *exp, enum exp_opcode op,
expr::operation *lhs, expr::operation *rhs,
struct agent_expr *ax, struct axs_value *value)
{
@@ -2230,31 +2164,27 @@ gen_expr_binop (struct expression *exp,
member name. */
void
-gen_expr_structop (struct expression *exp,
- enum exp_opcode op,
- expr::operation *lhs,
- const char *name,
+gen_expr_structop (struct expression *exp, enum exp_opcode op,
+ expr::operation *lhs, const char *name,
struct agent_expr *ax, struct axs_value *value)
{
lhs->generate_ax (exp, ax, value);
if (op == STRUCTOP_STRUCT)
gen_struct_ref (ax, value, name, ".", "structure or union");
else if (op == STRUCTOP_PTR)
- gen_struct_ref (ax, value, name, "->",
- "pointer to a structure or union");
+ gen_struct_ref (ax, value, name, "->", "pointer to a structure or union");
else
/* If this `if' chain doesn't handle it, then the case list
shouldn't mention it, and we shouldn't be here. */
- internal_error (_("gen_expr: unhandled struct case"));
+ internal_error (_ ("gen_expr: unhandled struct case"));
}
/* A helper function that emits a unary operation. */
void
-gen_expr_unop (struct expression *exp,
- enum exp_opcode op,
- expr::operation *lhs,
- struct agent_expr *ax, struct axs_value *value)
+gen_expr_unop (struct expression *exp, enum exp_opcode op,
+ expr::operation *lhs, struct agent_expr *ax,
+ struct axs_value *value)
{
struct axs_value value1, value2;
@@ -2263,7 +2193,7 @@ gen_expr_unop (struct expression *exp,
case UNOP_NEG:
gen_int_literal (ax, &value1, 0,
builtin_type (ax->gdbarch)->builtin_int);
- gen_usual_unary (ax, &value1); /* shouldn't do much */
+ gen_usual_unary (ax, &value1); /* shouldn't do much */
lhs->generate_ax (exp, ax, &value2);
gen_usual_unary (ax, &value2);
gen_usual_arithmetic (ax, &value1, &value2);
@@ -2279,7 +2209,7 @@ gen_expr_unop (struct expression *exp,
case UNOP_LOGICAL_NOT:
lhs->generate_ax (exp, ax, value);
gen_usual_unary (ax, value);
- gen_logical_not (ax, value, builtin_type (ax->gdbarch)->builtin_int);
+ gen_logical_not (ax, value, builtin_type (ax->gdbarch)->builtin_int);
break;
case UNOP_COMPLEMENT:
@@ -2293,7 +2223,7 @@ gen_expr_unop (struct expression *exp,
lhs->generate_ax (exp, ax, value);
gen_usual_unary (ax, value);
if (!value->type->is_pointer_or_reference ())
- error (_("Argument of unary `*' is not a pointer."));
+ error (_ ("Argument of unary `*' is not a pointer."));
gen_deref (value);
break;
@@ -2307,8 +2237,6 @@ gen_expr_unop (struct expression *exp,
}
}
-
-
/* Given a single variable and a scope, generate bytecodes to trace
its value. This is for use in situations where we have only a
variable's name, and no parsed expression; for instance, when the
@@ -2348,8 +2276,7 @@ gen_trace_for_var (CORE_ADDR scope, struct gdbarch *gdbarch,
registers it relies upon. */
agent_expr_up
-gen_trace_for_expr (CORE_ADDR scope, struct expression *expr,
- int trace_string)
+gen_trace_for_expr (CORE_ADDR scope, struct expression *expr, int trace_string)
{
agent_expr_up ax (new agent_expr (expr->gdbarch, scope));
struct axs_value value;
@@ -2419,10 +2346,9 @@ gen_trace_for_return_address (CORE_ADDR scope, struct gdbarch *gdbarch,
bytecode. */
agent_expr_up
-gen_printf (CORE_ADDR scope, struct gdbarch *gdbarch,
- CORE_ADDR function, LONGEST channel,
- const char *format, int fmtlen,
- int nargs, struct expression **exprs)
+gen_printf (CORE_ADDR scope, struct gdbarch *gdbarch, CORE_ADDR function,
+ LONGEST channel, const char *format, int fmtlen, int nargs,
+ struct expression **exprs)
{
agent_expr_up ax (new agent_expr (gdbarch, scope));
struct axs_value value;
@@ -2472,8 +2398,8 @@ agent_eval_command_one (const char *exp, int eval, CORE_ADDR pc)
arg = exp;
if (!eval && strcmp (arg, "$_ret") == 0)
{
- agent = gen_trace_for_return_address (pc, get_current_arch (),
- trace_string);
+ agent
+ = gen_trace_for_return_address (pc, get_current_arch (), trace_string);
}
else
{
@@ -2505,10 +2431,10 @@ maint_agent_command_1 (const char *exp, int eval)
another command, change the error message; the user shouldn't
have to know anything about agent expressions. */
if (overlay_debugging)
- error (_("GDB can't do agent expression translation with overlays."));
+ error (_ ("GDB can't do agent expression translation with overlays."));
if (exp == 0)
- error_no_arg (_("expression to translate"));
+ error_no_arg (_ ("expression to translate"));
if (check_for_argument (&exp, "-at", sizeof ("-at") - 1))
{
@@ -2516,9 +2442,8 @@ maint_agent_command_1 (const char *exp, int eval)
location_spec_up locspec
= new_linespec_location_spec (&exp, symbol_name_match_type::WILD);
- decode_line_full (locspec.get (), DECODE_LINE_FUNFIRSTLINE, NULL,
- NULL, 0, &canonical,
- NULL, NULL);
+ decode_line_full (locspec.get (), DECODE_LINE_FUNFIRSTLINE, NULL, NULL,
+ 0, &canonical, NULL, NULL);
exp = skip_spaces (exp);
if (exp[0] == ',')
{
@@ -2557,7 +2482,7 @@ maint_agent_eval_command (const char *exp, int from_tty)
static void
maint_agent_printf_command (const char *cmdrest, int from_tty)
{
- frame_info_ptr fi = get_current_frame (); /* need current scope */
+ frame_info_ptr fi = get_current_frame (); /* need current scope */
const char *format_start, *format_end;
/* We don't deal with overlay debugging at the moment. We need to
@@ -2565,15 +2490,15 @@ maint_agent_printf_command (const char *cmdrest, int from_tty)
another command, change the error message; the user shouldn't
have to know anything about agent expressions. */
if (overlay_debugging)
- error (_("GDB can't do agent expression translation with overlays."));
+ error (_ ("GDB can't do agent expression translation with overlays."));
if (cmdrest == 0)
- error_no_arg (_("expression to translate"));
+ error_no_arg (_ ("expression to translate"));
cmdrest = skip_spaces (cmdrest);
if (*cmdrest++ != '"')
- error (_("Must start with a format string."));
+ error (_ ("Must start with a format string."));
format_start = cmdrest;
@@ -2582,12 +2507,12 @@ maint_agent_printf_command (const char *cmdrest, int from_tty)
format_end = cmdrest;
if (*cmdrest++ != '"')
- error (_("Bad format string, non-terminated '\"'."));
-
+ error (_ ("Bad format string, non-terminated '\"'."));
+
cmdrest = skip_spaces (cmdrest);
if (*cmdrest != ',' && *cmdrest != 0)
- error (_("Invalid argument syntax"));
+ error (_ ("Invalid argument syntax"));
if (*cmdrest == ',')
cmdrest++;
@@ -2607,11 +2532,9 @@ maint_agent_printf_command (const char *cmdrest, int from_tty)
/* else complain? */
}
-
- agent_expr_up agent = gen_printf (get_frame_pc (fi), get_current_arch (),
- 0, 0,
- format_start, format_end - format_start,
- argvec.size (), argvec.data ());
+ agent_expr_up agent
+ = gen_printf (get_frame_pc (fi), get_current_arch (), 0, 0, format_start,
+ format_end - format_start, argvec.size (), argvec.data ());
ax_reqs (agent.get ());
ax_print (gdb_stdout, agent.get ());
@@ -2624,19 +2547,18 @@ maint_agent_printf_command (const char *cmdrest, int from_tty)
/* Initialization code. */
void _initialize_ax_gdb ();
+
void
_initialize_ax_gdb ()
{
- add_cmd ("agent", class_maintenance, maint_agent_command,
- _("\
+ add_cmd ("agent", class_maintenance, maint_agent_command, _ ("\
Translate an expression into remote agent bytecode for tracing.\n\
Usage: maint agent [-at LOCATION,] EXPRESSION\n\
If -at is given, generate remote agent bytecode for this location.\n\
If not, generate remote agent bytecode for current frame pc address."),
&maintenancelist);
- add_cmd ("agent-eval", class_maintenance, maint_agent_eval_command,
- _("\
+ add_cmd ("agent-eval", class_maintenance, maint_agent_eval_command, _ ("\
Translate an expression into remote agent bytecode for evaluation.\n\
Usage: maint agent-eval [-at LOCATION,] EXPRESSION\n\
If -at is given, generate remote agent bytecode for this location.\n\
@@ -2644,7 +2566,7 @@ If not, generate remote agent bytecode for current frame pc address."),
&maintenancelist);
add_cmd ("agent-printf", class_maintenance, maint_agent_printf_command,
- _("Translate an expression into remote "
- "agent bytecode for evaluation and display the bytecodes."),
+ _ ("Translate an expression into remote "
+ "agent bytecode for evaluation and display the bytecodes."),
&maintenancelist);
}
diff --git a/gdb/ax-gdb.h b/gdb/ax-gdb.h
index 46584286c1f..3192d4ddac3 100644
--- a/gdb/ax-gdb.h
+++ b/gdb/ax-gdb.h
@@ -19,7 +19,7 @@
#ifndef AX_GDB_H
#define AX_GDB_H
-#include "ax.h" /* For agent_expr_up. */
+#include "ax.h" /* For agent_expr_up. */
struct expression;
@@ -48,52 +48,49 @@ struct expression;
this is all static analysis of the expression, i.e. analysis which
doesn't depend on the contents of memory and registers. */
-
/* Different kinds of agent expression static values. */
enum axs_lvalue_kind
- {
- /* We generated code to compute the subexpression's value.
+{
+ /* We generated code to compute the subexpression's value.
Constants and arithmetic operators yield this. */
- axs_rvalue,
+ axs_rvalue,
- /* We generated code to yield the subexpression's value's address on
+ /* We generated code to yield the subexpression's value's address on
the top of the stack. If the caller needs an rvalue, it should
call require_rvalue to produce the rvalue from this address. */
- axs_lvalue_memory,
+ axs_lvalue_memory,
- /* We didn't generate any code, and the stack is undisturbed,
+ /* We didn't generate any code, and the stack is undisturbed,
because the subexpression's value lives in a register; u.reg is
the register number. If the caller needs an rvalue, it should
call require_rvalue to produce the rvalue from this register
number. */
- axs_lvalue_register
- };
+ axs_lvalue_register
+};
/* Structure describing what we got from a subexpression. Think of
this as parallel to value.h's enum lval_type, except that we're
describing a value which will exist when the expression is
evaluated in the future, not a value we have in our hand. */
struct axs_value
- {
- enum axs_lvalue_kind kind; /* see above */
+{
+ enum axs_lvalue_kind kind; /* see above */
- /* The type of the subexpression. Even if lvalue == axs_lvalue_memory,
+ /* The type of the subexpression. Even if lvalue == axs_lvalue_memory,
this is the type of the value itself; the value on the stack is a
"pointer to" an object of this type. */
- struct type *type;
+ struct type *type;
- /* If nonzero, this is a variable which does not actually exist in
+ /* If nonzero, this is a variable which does not actually exist in
the program. */
- char optimized_out;
+ char optimized_out;
- union
- {
- /* if kind == axs_lvalue_register, this is the register number */
- int reg;
- }
- u;
- };
-
+ union
+ {
+ /* if kind == axs_lvalue_register, this is the register number */
+ int reg;
+ } u;
+};
/* Translating GDB expressions into agent expressions. */
@@ -102,14 +99,12 @@ struct axs_value
record the value of all memory touched by the expression, and leave
no values on the stack. The caller can then use the ax_reqs
function to discover which registers the expression uses. */
-extern agent_expr_up gen_trace_for_expr (CORE_ADDR, struct expression *,
- int);
+extern agent_expr_up gen_trace_for_expr (CORE_ADDR, struct expression *, int);
extern agent_expr_up gen_trace_for_var (CORE_ADDR, struct gdbarch *,
struct symbol *, int);
-extern agent_expr_up gen_trace_for_return_address (CORE_ADDR,
- struct gdbarch *,
+extern agent_expr_up gen_trace_for_return_address (CORE_ADDR, struct gdbarch *,
int);
extern agent_expr_up gen_eval_for_expr (CORE_ADDR, struct expression *);
@@ -119,8 +114,8 @@ extern void gen_expr (struct expression *exp, union exp_element **pc,
extern void require_rvalue (struct agent_expr *ax, struct axs_value *value);
-extern agent_expr_up gen_printf (CORE_ADDR, struct gdbarch *,
- CORE_ADDR, LONGEST, const char *, int,
- int, struct expression **);
+extern agent_expr_up gen_printf (CORE_ADDR, struct gdbarch *, CORE_ADDR,
+ LONGEST, const char *, int, int,
+ struct expression **);
#endif /* AX_GDB_H */
diff --git a/gdb/ax-general.c b/gdb/ax-general.c
index e43e7732260..730a76aeb42 100644
--- a/gdb/ax-general.c
+++ b/gdb/ax-general.c
@@ -35,13 +35,13 @@ static void append_const (struct agent_expr *x, LONGEST val, int n);
static LONGEST read_const (struct agent_expr *x, int o, int n);
static void generic_ext (struct agent_expr *x, enum agent_op op, int n);
-
+
/* Functions for building expressions. */
agent_expr::agent_expr (struct gdbarch *gdbarch, CORE_ADDR scope)
{
this->len = 0;
- this->size = 1; /* Change this to a larger value once
+ this->size = 1; /* Change this to a larger value once
reallocation code is tested. */
this->buf = (unsigned char *) xmalloc (this->size);
@@ -76,7 +76,6 @@ grow_expr (struct agent_expr *x, int n)
}
}
-
/* Append the low N bytes of VAL as an N-byte integer to the
expression X, in big-endian order. */
static void
@@ -93,7 +92,6 @@ append_const (struct agent_expr *x, LONGEST val, int n)
x->len += n;
}
-
/* Extract an N-byte big-endian unsigned integer from expression X at
offset O. */
static LONGEST
@@ -104,7 +102,7 @@ read_const (struct agent_expr *x, int o, int n)
/* Make sure we're not reading off the end of the expression. */
if (o + n > x->len)
- error (_("GDB bug: ax-general.c (read_const): incomplete constant"));
+ error (_ ("GDB bug: ax-general.c (read_const): incomplete constant"));
for (i = 0; i < n; i++)
accum = (accum << 8) | x->buf[o + i];
@@ -135,12 +133,11 @@ void
ax_pick (struct agent_expr *x, int depth)
{
if (depth < 0 || depth > 255)
- error (_("GDB bug: ax-general.c (ax_pick): stack depth out of range"));
+ error (_ ("GDB bug: ax-general.c (ax_pick): stack depth out of range"));
ax_simple (x, aop_pick);
append_const (x, 1, depth);
}
-
/* Append a sign-extension or zero-extension instruction to EXPR, to
extend an N-bit value. */
static void
@@ -148,18 +145,17 @@ generic_ext (struct agent_expr *x, enum agent_op op, int n)
{
/* N must fit in a byte. */
if (n < 0 || n > 255)
- error (_("GDB bug: ax-general.c (generic_ext): bit count out of range"));
+ error (_ ("GDB bug: ax-general.c (generic_ext): bit count out of range"));
/* That had better be enough range. */
if (sizeof (LONGEST) * 8 > 255)
- error (_("GDB bug: ax-general.c (generic_ext): "
- "opcode has inadequate range"));
+ error (_ ("GDB bug: ax-general.c (generic_ext): "
+ "opcode has inadequate range"));
grow_expr (x, 2);
x->buf[x->len++] = op;
x->buf[x->len++] = n;
}
-
/* Append a sign-extension instruction to EXPR, to extend an N-bit value. */
void
ax_ext (struct agent_expr *x, int n)
@@ -167,7 +163,6 @@ ax_ext (struct agent_expr *x, int n)
generic_ext (x, aop_ext, n);
}
-
/* Append a zero-extension instruction to EXPR, to extend an N-bit value. */
void
ax_zero_ext (struct agent_expr *x, int n)
@@ -175,22 +170,20 @@ ax_zero_ext (struct agent_expr *x, int n)
generic_ext (x, aop_zero_ext, n);
}
-
/* Append a trace_quick instruction to EXPR, to record N bytes. */
void
ax_trace_quick (struct agent_expr *x, int n)
{
/* N must fit in a byte. */
if (n < 0 || n > 255)
- error (_("GDB bug: ax-general.c (ax_trace_quick): "
- "size out of range for trace_quick"));
+ error (_ ("GDB bug: ax-general.c (ax_trace_quick): "
+ "size out of range for trace_quick"));
grow_expr (x, 2);
x->buf[x->len++] = aop_trace_quick;
x->buf[x->len++] = n;
}
-
/* Append a goto op to EXPR. OP is the actual op (must be aop_goto or
aop_if_goto). We assume we don't know the target offset yet,
because it's probably a forward branch, so we leave space in EXPR
@@ -218,20 +211,19 @@ ax_label (struct agent_expr *x, int patch, int target)
/* Make sure the value is in range. Don't accept 0xffff as an
offset; that's our magic sentinel value for unpatched branches. */
if (target < 0 || target >= 0xffff)
- error (_("GDB bug: ax-general.c (ax_label): label target out of range"));
+ error (_ ("GDB bug: ax-general.c (ax_label): label target out of range"));
x->buf[patch] = (target >> 8) & 0xff;
x->buf[patch + 1] = target & 0xff;
}
-
/* Assemble code to push a constant on the stack. */
void
ax_const_l (struct agent_expr *x, LONGEST l)
{
static enum agent_op ops[]
- =
- {aop_const8, aop_const16, aop_const32, aop_const64};
+ = { aop_const8, aop_const16, aop_const32, aop_const64 };
+
int size;
int op;
@@ -259,16 +251,14 @@ ax_const_l (struct agent_expr *x, LONGEST l)
ax_ext (x, size);
}
-
void
ax_const_d (struct agent_expr *x, LONGEST d)
{
/* FIXME: floating-point support not present yet. */
- error (_("GDB bug: ax-general.c (ax_const_d): "
- "floating point not supported yet"));
+ error (_ ("GDB bug: ax-general.c (ax_const_d): "
+ "floating point not supported yet"));
}
-
/* Assemble code to push the value of register number REG on the
stack. */
void
@@ -278,11 +268,11 @@ ax_reg (struct agent_expr *x, int reg)
{
/* This is a pseudo-register. */
if (!gdbarch_ax_pseudo_register_push_stack_p (x->gdbarch))
- error (_("'%s' is a pseudo-register; "
- "GDB cannot yet trace its contents."),
+ error (_ ("'%s' is a pseudo-register; "
+ "GDB cannot yet trace its contents."),
user_reg_map_regnum_to_name (x->gdbarch, reg));
if (gdbarch_ax_pseudo_register_push_stack (x->gdbarch, x, reg))
- error (_("Trace '%s' failed."),
+ error (_ ("Trace '%s' failed."),
user_reg_map_regnum_to_name (x->gdbarch, reg));
}
else
@@ -292,12 +282,12 @@ ax_reg (struct agent_expr *x, int reg)
/* Make sure the register number is in range. */
if (reg < 0 || reg > 0xffff)
- error (_("GDB bug: ax-general.c (ax_reg): "
- "register number out of range"));
+ error (_ ("GDB bug: ax-general.c (ax_reg): "
+ "register number out of range"));
grow_expr (x, 3);
x->buf[x->len] = aop_reg;
x->buf[x->len + 1] = (reg >> 8) & 0xff;
- x->buf[x->len + 2] = (reg) & 0xff;
+ x->buf[x->len + 2] = (reg) &0xff;
x->len += 3;
}
}
@@ -309,13 +299,14 @@ ax_tsv (struct agent_expr *x, enum agent_op op, int num)
{
/* Make sure the tsv number is in range. */
if (num < 0 || num > 0xffff)
- internal_error (_("ax-general.c (ax_tsv): variable "
- "number is %d, out of range"), num);
+ internal_error (_ ("ax-general.c (ax_tsv): variable "
+ "number is %d, out of range"),
+ num);
grow_expr (x, 3);
x->buf[x->len] = op;
x->buf[x->len + 1] = (num >> 8) & 0xff;
- x->buf[x->len + 2] = (num) & 0xff;
+ x->buf[x->len + 2] = (num) &0xff;
x->len += 3;
}
@@ -331,8 +322,9 @@ ax_string (struct agent_expr *x, const char *str, int slen)
/* Make sure the string length is reasonable. */
if (slen < 0 || slen > 0xffff)
- internal_error (_("ax-general.c (ax_string): string "
- "length is %d, out of allowed range"), slen);
+ internal_error (_ ("ax-general.c (ax_string): string "
+ "length is %d, out of allowed range"),
+ slen);
grow_expr (x, 2 + slen + 1);
x->buf[x->len++] = ((slen + 1) >> 8) & 0xff;
@@ -341,55 +333,51 @@ ax_string (struct agent_expr *x, const char *str, int slen)
x->buf[x->len++] = str[i];
x->buf[x->len++] = '\0';
}
-
-
/* Functions for disassembling agent expressions, and otherwise
debugging the expression compiler. */
-struct aop_map aop_map[] =
-{
- {0, 0, 0, 0, 0}
+struct aop_map aop_map[] = { { 0, 0, 0, 0, 0 }
#define DEFOP(NAME, SIZE, DATA_SIZE, CONSUMED, PRODUCED, VALUE) \
- , { # NAME, SIZE, DATA_SIZE, CONSUMED, PRODUCED }
+ , \
+ { \
+#NAME, SIZE, DATA_SIZE, CONSUMED, PRODUCED \
+ }
#include "gdbsupport/ax.def"
#undef DEFOP
};
-
/* Disassemble the expression EXPR, writing to F. */
void
ax_print (struct ui_file *f, struct agent_expr *x)
{
int i;
- gdb_printf (f, _("Scope: %s\n"), paddress (x->gdbarch, x->scope));
- gdb_printf (f, _("Reg mask:"));
+ gdb_printf (f, _ ("Scope: %s\n"), paddress (x->gdbarch, x->scope));
+ gdb_printf (f, _ ("Reg mask:"));
for (i = 0; i < x->reg_mask_len; ++i)
- gdb_printf (f, _(" %02x"), x->reg_mask[i]);
- gdb_printf (f, _("\n"));
+ gdb_printf (f, _ (" %02x"), x->reg_mask[i]);
+ gdb_printf (f, _ ("\n"));
/* Check the size of the name array against the number of entries in
the enum, to catch additions that people didn't sync. */
- if ((sizeof (aop_map) / sizeof (aop_map[0]))
- != aop_last)
- error (_("GDB bug: ax-general.c (ax_print): opcode map out of sync"));
+ if ((sizeof (aop_map) / sizeof (aop_map[0])) != aop_last)
+ error (_ ("GDB bug: ax-general.c (ax_print): opcode map out of sync"));
for (i = 0; i < x->len;)
{
enum agent_op op = (enum agent_op) x->buf[i];
- if (op >= (sizeof (aop_map) / sizeof (aop_map[0]))
- || !aop_map[op].name)
+ if (op >= (sizeof (aop_map) / sizeof (aop_map[0])) || !aop_map[op].name)
{
- gdb_printf (f, _("%3d <bad opcode %02x>\n"), i, op);
+ gdb_printf (f, _ ("%3d <bad opcode %02x>\n"), i, op);
i++;
continue;
}
if (i + 1 + aop_map[op].op_size > x->len)
{
- gdb_printf (f, _("%3d <incomplete opcode %s>\n"),
- i, aop_map[op].name);
+ gdb_printf (f, _ ("%3d <incomplete opcode %s>\n"), i,
+ aop_map[op].name);
break;
}
@@ -410,8 +398,7 @@ ax_print (struct ui_file *f, struct agent_expr *x)
nargs = x->buf[i++];
slen = x->buf[i++];
slen = slen * 256 + x->buf[i++];
- gdb_printf (f, _(" \"%s\", %d args"),
- &(x->buf[i]), nargs);
+ gdb_printf (f, _ (" \"%s\", %d args"), &(x->buf[i]), nargs);
i += slen - 1;
}
gdb_printf (f, "\n");
@@ -427,11 +414,11 @@ ax_reg_mask (struct agent_expr *ax, int reg)
{
/* This is a pseudo-register. */
if (!gdbarch_ax_pseudo_register_collect_p (ax->gdbarch))
- error (_("'%s' is a pseudo-register; "
- "GDB cannot yet trace its contents."),
+ error (_ ("'%s' is a pseudo-register; "
+ "GDB cannot yet trace its contents."),
user_reg_map_regnum_to_name (ax->gdbarch, reg));
if (gdbarch_ax_pseudo_register_collect (ax->gdbarch, ax, reg))
- error (_("Trace '%s' failed."),
+ error (_ ("Trace '%s' failed."),
user_reg_map_regnum_to_name (ax->gdbarch, reg));
}
else
@@ -539,8 +526,7 @@ ax_reqs (struct agent_expr *ax)
/* For jump instructions, check that the target is a valid
offset. If it is, record the fact that that location is a
jump target, and record the height we expect there. */
- if (aop_goto == op - aop_map
- || aop_if_goto == op - aop_map)
+ if (aop_goto == op - aop_map || aop_if_goto == op - aop_map)
{
int target = read_const (ax, i + 1, 2);
if (target < 0 || target >= ax->len)
@@ -567,8 +553,7 @@ ax_reqs (struct agent_expr *ax)
/* For unconditional jumps with a successor, check that the
successor is a target, and pick up its stack height. */
- if (aop_goto == op - aop_map
- && i + 3 < ax->len)
+ if (aop_goto == op - aop_map && i + 3 < ax->len)
{
if (!targets[i + 3])
{
diff --git a/gdb/ax.h b/gdb/ax.h
index 9c47a8d0b63..c5eb635c3e1 100644
--- a/gdb/ax.h
+++ b/gdb/ax.h
@@ -46,76 +46,75 @@
is independent of symbolic information. This means the agent can
evaluate them on the fly without reference to data only available
to the host GDB. */
-
/* Different kinds of flaws an agent expression might have, as
detected by ax_reqs. */
enum agent_flaws
- {
- agent_flaw_none = 0, /* code is good */
+{
+ agent_flaw_none = 0, /* code is good */
- /* There is an invalid instruction in the stream. */
- agent_flaw_bad_instruction,
+ /* There is an invalid instruction in the stream. */
+ agent_flaw_bad_instruction,
- /* There is an incomplete instruction at the end of the expression. */
- agent_flaw_incomplete_instruction,
+ /* There is an incomplete instruction at the end of the expression. */
+ agent_flaw_incomplete_instruction,
- /* ax_reqs was unable to prove that every jump target is to a
+ /* ax_reqs was unable to prove that every jump target is to a
valid offset. Valid offsets are within the bounds of the
expression, and to a valid instruction boundary. */
- agent_flaw_bad_jump,
+ agent_flaw_bad_jump,
- /* ax_reqs was unable to prove to its satisfaction that, for each
+ /* ax_reqs was unable to prove to its satisfaction that, for each
jump target location, the stack will have the same height whether
that location is reached via a jump or by straight execution. */
- agent_flaw_height_mismatch,
+ agent_flaw_height_mismatch,
- /* ax_reqs was unable to prove that every instruction following
+ /* ax_reqs was unable to prove that every instruction following
an unconditional jump was the target of some other jump. */
- agent_flaw_hole
- };
+ agent_flaw_hole
+};
/* Agent expression data structures. */
/* A buffer containing a agent expression. */
struct agent_expr
- {
- /* Construct an empty agent expression. */
- explicit agent_expr (struct gdbarch *gdbarch, CORE_ADDR scope);
+{
+ /* Construct an empty agent expression. */
+ explicit agent_expr (struct gdbarch *gdbarch, CORE_ADDR scope);
- ~agent_expr ();
+ ~agent_expr ();
- /* The bytes of the expression. */
- unsigned char *buf;
+ /* The bytes of the expression. */
+ unsigned char *buf;
- /* The number of bytecode in the expression. */
- int len;
+ /* The number of bytecode in the expression. */
+ int len;
- /* Allocated space available currently. */
- int size;
+ /* Allocated space available currently. */
+ int size;
- /* The target architecture assumed to be in effect. */
- struct gdbarch *gdbarch;
+ /* The target architecture assumed to be in effect. */
+ struct gdbarch *gdbarch;
- /* The address to which the expression applies. */
- CORE_ADDR scope;
+ /* The address to which the expression applies. */
+ CORE_ADDR scope;
- /* If the following is not equal to agent_flaw_none, the rest of the
+ /* If the following is not equal to agent_flaw_none, the rest of the
information in this structure is suspect. */
- enum agent_flaws flaw;
+ enum agent_flaws flaw;
- /* Number of elements left on stack at end; may be negative if expr
+ /* Number of elements left on stack at end; may be negative if expr
only consumes elements. */
- int final_height;
+ int final_height;
- /* Maximum and minimum stack height, relative to initial height. */
- int max_height, min_height;
+ /* Maximum and minimum stack height, relative to initial height. */
+ int max_height, min_height;
- /* Largest `ref' or `const' opcode used, in bits. Zero means the
+ /* Largest `ref' or `const' opcode used, in bits. Zero means the
expression has no such instructions. */
- int max_data_size;
+ int max_data_size;
- /* Bit vector of registers needed. Register R is needed iff
+ /* Bit vector of registers needed. Register R is needed iff
reg_mask[R / 8] & (1 << (R % 8))
@@ -132,10 +131,10 @@ struct agent_expr
compiler sets the mask bit and skips generating a bytecode whose
result is going to be discarded anyway.
*/
- int reg_mask_len;
- unsigned char *reg_mask;
+ int reg_mask_len;
+ unsigned char *reg_mask;
- /* For the data tracing facility, we need to insert `trace' bytecodes
+ /* For the data tracing facility, we need to insert `trace' bytecodes
before each data fetch; this records all the memory that the
expression touches in the course of evaluation, so that memory will
be available when the user later tries to evaluate the expression
@@ -144,14 +143,14 @@ struct agent_expr
Setting the flag 'tracing' to non-zero enables the code that
emits the trace bytecodes at the appropriate points. */
- unsigned int tracing : 1;
+ unsigned int tracing : 1;
- /* This indicates that pointers to chars should get an added
+ /* This indicates that pointers to chars should get an added
tracenz bytecode to record nonzero bytes, up to a length that
is the value of trace_string. */
- int trace_string;
- };
+ int trace_string;
+};
/* An agent_expr owning pointer. */
typedef std::unique_ptr<agent_expr> agent_expr_up;
@@ -159,15 +158,14 @@ typedef std::unique_ptr<agent_expr> agent_expr_up;
/* The actual values of the various bytecode operations. */
enum agent_op
- {
-#define DEFOP(NAME, SIZE, DATA_SIZE, CONSUMED, PRODUCED, VALUE) \
- aop_ ## NAME = VALUE,
+{
+
+#define DEFOP(NAME, SIZE, DATA_SIZE, CONSUMED, PRODUCED, VALUE) \
+ aop_##NAME = VALUE,
#include "gdbsupport/ax.def"
#undef DEFOP
- aop_last
- };
-
-
+ aop_last
+};
/* Functions for building expressions. */
@@ -223,23 +221,21 @@ extern void ax_tsv (struct agent_expr *expr, enum agent_op op, int num);
/* Append a string to the bytecode stream. */
extern void ax_string (struct agent_expr *x, const char *str, int slen);
-
/* Functions for printing out expressions, and otherwise debugging
things. */
/* Disassemble the expression EXPR, writing to F. */
-extern void ax_print (struct ui_file *f, struct agent_expr * EXPR);
+extern void ax_print (struct ui_file *f, struct agent_expr *EXPR);
/* An entry in the opcode map. */
struct aop_map
- {
-
- /* The name of the opcode. Null means that this entry is not a
+{
+ /* The name of the opcode. Null means that this entry is not a
valid opcode --- a hole in the opcode space. */
- const char *name;
+ const char *name;
- /* All opcodes take no operands from the bytecode stream, or take
+ /* All opcodes take no operands from the bytecode stream, or take
unsigned integers of various sizes. If this is a positive number
n, then the opcode is followed by an n-byte operand, which should
be printed as an unsigned integer. If this is zero, then the
@@ -248,15 +244,15 @@ struct aop_map
If we get more complicated opcodes in the future, don't add other
magic values of this; that's a crock. Add an `enum encoding'
field to this, or something like that. */
- int op_size;
+ int op_size;
- /* The size of the data operated upon, in bits, for bytecodes that
+ /* The size of the data operated upon, in bits, for bytecodes that
care about that (ref and const). Zero for all others. */
- int data_size;
+ int data_size;
- /* Number of stack elements consumed, and number produced. */
- int consumed, produced;
- };
+ /* Number of stack elements consumed, and number produced. */
+ int consumed, produced;
+};
/* Map of the bytecodes, indexed by bytecode number. */
extern struct aop_map aop_map[];
diff --git a/gdb/bcache.c b/gdb/bcache.c
index a12a86c7c87..db3ecc16e65 100644
--- a/gdb/bcache.c
+++ b/gdb/bcache.c
@@ -25,7 +25,8 @@
#include <algorithm>
-namespace gdb {
+namespace gdb
+{
/* The type used to hold a single bcache string. The user data is
stored in d.data. Since it can be any type, it needs to have the
@@ -49,11 +50,9 @@ struct bstring
{
char data[1];
double dummy;
- }
- d;
+ } d;
};
-
/* Growing the bcache's hash table. */
/* If the average chain length grows beyond this, then we want to
@@ -68,12 +67,11 @@ bcache::expand_hash_table ()
so we roughly double the table size each time. After we fall off
the end of this table, we just double. Don't laugh --- there have
been executables sighted with a gigabyte of debug info. */
- static const unsigned long sizes[] = {
- 1021, 2053, 4099, 8191, 16381, 32771,
- 65537, 131071, 262144, 524287, 1048573, 2097143,
- 4194301, 8388617, 16777213, 33554467, 67108859, 134217757,
- 268435459, 536870923, 1073741827, 2147483659UL
- };
+ static const unsigned long sizes[]
+ = { 1021, 2053, 4099, 8191, 16381, 32771,
+ 65537, 131071, 262144, 524287, 1048573, 2097143,
+ 4194301, 8388617, 16777213, 33554467, 67108859, 134217757,
+ 268435459, 536870923, 1073741827, 2147483659UL };
unsigned int new_num_buckets;
struct bstring **new_buckets;
unsigned int i;
@@ -126,7 +124,6 @@ bcache::expand_hash_table ()
m_num_buckets = new_num_buckets;
}
-
/* Looking up things in the bcache. */
/* The number of bytes needed to allocate a struct bstring whose data
@@ -179,8 +176,7 @@ bcache::insert (const void *addr, int length, bool *added)
{
if (s->half_hash == half_hash)
{
- if (s->length == length
- && this->compare (&s->d.data, addr, length))
+ if (s->length == length && this->compare (&s->d.data, addr, length))
return &s->d.data;
else
m_half_hash_miss_count++;
@@ -190,8 +186,7 @@ bcache::insert (const void *addr, int length, bool *added)
/* The user's string isn't in the list. Insert it after *ps. */
{
struct bstring *newobj
- = (struct bstring *) obstack_alloc (&m_cache,
- BSTRING_SIZE (length));
+ = (struct bstring *) obstack_alloc (&m_cache, BSTRING_SIZE (length));
memcpy (&newobj->d.data, addr, length);
newobj->length = length;
@@ -209,7 +204,6 @@ bcache::insert (const void *addr, int length, bool *added)
return &newobj->d.data;
}
}
-
/* See bcache.h. */
@@ -236,8 +230,6 @@ bcache::~bcache ()
xfree (m_bucket);
}
-
-
/* Printing statistics. */
static void
@@ -245,12 +237,11 @@ print_percentage (int portion, int total)
{
if (total == 0)
/* i18n: Like "Percentage of duplicates, by count: (not applicable)". */
- gdb_printf (_("(not applicable)\n"));
+ gdb_printf (_ ("(not applicable)\n"));
else
gdb_printf ("%3d%%\n", (int) (portion * 100.0 / total));
}
-
/* Print statistics on BCACHE's memory usage and efficacity at
eliminating duplication. NAME should describe the kind of data
BCACHE holds. Statistics are printed using `gdb_printf' and
@@ -283,7 +274,7 @@ bcache::print_statistics (const char *type)
if (s)
{
occupied_buckets++;
-
+
while (s)
{
gdb_assert (b < m_num_buckets);
@@ -325,58 +316,54 @@ bcache::print_statistics (const char *type)
xfree (entry_size);
}
- gdb_printf (_(" M_Cached '%s' statistics:\n"), type);
- gdb_printf (_(" Total object count: %ld\n"), m_total_count);
- gdb_printf (_(" Unique object count: %lu\n"), m_unique_count);
- gdb_printf (_(" Percentage of duplicates, by count: "));
+ gdb_printf (_ (" M_Cached '%s' statistics:\n"), type);
+ gdb_printf (_ (" Total object count: %ld\n"), m_total_count);
+ gdb_printf (_ (" Unique object count: %lu\n"), m_unique_count);
+ gdb_printf (_ (" Percentage of duplicates, by count: "));
print_percentage (m_total_count - m_unique_count, m_total_count);
gdb_printf ("\n");
- gdb_printf (_(" Total object size: %ld\n"), m_total_size);
- gdb_printf (_(" Unique object size: %ld\n"), m_unique_size);
- gdb_printf (_(" Percentage of duplicates, by size: "));
+ gdb_printf (_ (" Total object size: %ld\n"), m_total_size);
+ gdb_printf (_ (" Unique object size: %ld\n"), m_unique_size);
+ gdb_printf (_ (" Percentage of duplicates, by size: "));
print_percentage (m_total_size - m_unique_size, m_total_size);
gdb_printf ("\n");
- gdb_printf (_(" Max entry size: %d\n"), max_entry_size);
- gdb_printf (_(" Average entry size: "));
+ gdb_printf (_ (" Max entry size: %d\n"), max_entry_size);
+ gdb_printf (_ (" Average entry size: "));
if (m_unique_count > 0)
gdb_printf ("%ld\n", m_unique_size / m_unique_count);
else
/* i18n: "Average entry size: (not applicable)". */
- gdb_printf (_("(not applicable)\n"));
- gdb_printf (_(" Median entry size: %d\n"), median_entry_size);
+ gdb_printf (_ ("(not applicable)\n"));
+ gdb_printf (_ (" Median entry size: %d\n"), median_entry_size);
gdb_printf ("\n");
- gdb_printf (_(" \
+ gdb_printf (_ (" \
Total memory used by bcache, including overhead: %ld\n"),
m_structure_size);
- gdb_printf (_(" Percentage memory overhead: "));
+ gdb_printf (_ (" Percentage memory overhead: "));
print_percentage (m_structure_size - m_unique_size, m_unique_size);
- gdb_printf (_(" Net memory savings: "));
+ gdb_printf (_ (" Net memory savings: "));
print_percentage (m_total_size - m_structure_size, m_total_size);
gdb_printf ("\n");
- gdb_printf (_(" Hash table size: %3d\n"),
- m_num_buckets);
- gdb_printf (_(" Hash table expands: %lu\n"),
- m_expand_count);
- gdb_printf (_(" Hash table hashes: %lu\n"),
+ gdb_printf (_ (" Hash table size: %3d\n"), m_num_buckets);
+ gdb_printf (_ (" Hash table expands: %lu\n"), m_expand_count);
+ gdb_printf (_ (" Hash table hashes: %lu\n"),
m_total_count + m_expand_hash_count);
- gdb_printf (_(" Half hash misses: %lu\n"),
+ gdb_printf (_ (" Half hash misses: %lu\n"),
m_half_hash_miss_count);
- gdb_printf (_(" Hash table population: "));
+ gdb_printf (_ (" Hash table population: "));
print_percentage (occupied_buckets, m_num_buckets);
- gdb_printf (_(" Median hash chain length: %3d\n"),
- median_chain_length);
- gdb_printf (_(" Average hash chain length: "));
+ gdb_printf (_ (" Median hash chain length: %3d\n"), median_chain_length);
+ gdb_printf (_ (" Average hash chain length: "));
if (m_num_buckets > 0)
gdb_printf ("%3lu\n", m_unique_count / m_num_buckets);
else
/* i18n: "Average hash chain length: (not applicable)". */
- gdb_printf (_("(not applicable)\n"));
- gdb_printf (_(" Maximum hash chain length: %3d\n"),
- max_chain_length);
+ gdb_printf (_ ("(not applicable)\n"));
+ gdb_printf (_ (" Maximum hash chain length: %3d\n"), max_chain_length);
gdb_printf ("\n");
}
diff --git a/gdb/bcache.h b/gdb/bcache.h
index d3bebd11713..0e4d73d4870 100644
--- a/gdb/bcache.h
+++ b/gdb/bcache.h
@@ -136,7 +136,8 @@
*/
-namespace gdb {
+namespace gdb
+{
struct bstring;
@@ -174,7 +175,9 @@ protected:
private:
/* All the bstrings are allocated here. */
- struct obstack m_cache {};
+ struct obstack m_cache
+ {
+ };
/* How many hash buckets we're using. */
unsigned int m_num_buckets = 0;
@@ -184,11 +187,12 @@ private:
struct bstring **m_bucket = nullptr;
/* Statistics. */
- unsigned long m_unique_count = 0; /* number of unique strings */
- long m_total_count = 0; /* total number of strings cached, including dups */
- long m_unique_size = 0; /* size of unique strings, in bytes */
- long m_total_size = 0; /* total number of bytes cached, including dups */
- long m_structure_size = 0; /* total size of bcache, including infrastructure */
+ unsigned long m_unique_count = 0; /* number of unique strings */
+ long m_total_count = 0; /* total number of strings cached, including dups */
+ long m_unique_size = 0; /* size of unique strings, in bytes */
+ long m_total_size = 0; /* total number of bytes cached, including dups */
+ long m_structure_size
+ = 0; /* total size of bcache, including infrastructure */
/* Number of times that the hash table is expanded and hence
re-built, and the corresponding number of times that a string is
[re]hashed as part of entering it into the expanded table. The
diff --git a/gdb/bfd-target.c b/gdb/bfd-target.c
index 6b8a839b286..7f5176304a3 100644
--- a/gdb/bfd-target.c
+++ b/gdb/bfd-target.c
@@ -25,34 +25,30 @@
/* A target that wraps a BFD. */
-static const target_info target_bfd_target_info = {
- "bfd",
- N_("BFD backed target"),
- N_("You should never see this")
-};
+static const target_info target_bfd_target_info
+ = { "bfd", N_ ("BFD backed target"), N_ ("You should never see this") };
class target_bfd : public target_ops
{
public:
+
explicit target_bfd (const gdb_bfd_ref_ptr &bfd);
- const target_info &info () const override
- { return target_bfd_target_info; }
+ const target_info &info () const override { return target_bfd_target_info; }
strata stratum () const override { return file_stratum; }
void close () override;
- target_xfer_status
- xfer_partial (target_object object,
- const char *annex, gdb_byte *readbuf,
- const gdb_byte *writebuf,
- ULONGEST offset, ULONGEST len,
- ULONGEST *xfered_len) override;
+ target_xfer_status xfer_partial (target_object object, const char *annex,
+ gdb_byte *readbuf, const gdb_byte *writebuf,
+ ULONGEST offset, ULONGEST len,
+ ULONGEST *xfered_len) override;
const target_section_table *get_section_table () override;
private:
+
/* The BFD we're wrapping. */
gdb_bfd_ref_ptr m_bfd;
@@ -63,19 +59,16 @@ private:
};
target_xfer_status
-target_bfd::xfer_partial (target_object object,
- const char *annex, gdb_byte *readbuf,
- const gdb_byte *writebuf,
- ULONGEST offset, ULONGEST len,
- ULONGEST *xfered_len)
+target_bfd::xfer_partial (target_object object, const char *annex,
+ gdb_byte *readbuf, const gdb_byte *writebuf,
+ ULONGEST offset, ULONGEST len, ULONGEST *xfered_len)
{
switch (object)
{
case TARGET_OBJECT_MEMORY:
{
- return section_table_xfer_memory_partial (readbuf, writebuf,
- offset, len, xfered_len,
- m_table);
+ return section_table_xfer_memory_partial (readbuf, writebuf, offset,
+ len, xfered_len, m_table);
}
default:
return TARGET_XFER_E_IO;
diff --git a/gdb/bfin-linux-tdep.c b/gdb/bfin-linux-tdep.c
index 83228de3105..cc1c68579f4 100644
--- a/gdb/bfin-linux-tdep.c
+++ b/gdb/bfin-linux-tdep.c
@@ -31,64 +31,63 @@
/* From <asm/sigcontext.h>. */
-#define SIGCONTEXT_OFFSET 168
-
-static const int bfin_linux_sigcontext_reg_offset[BFIN_NUM_REGS] =
-{
- 0 * 4, /* %r0 */
- 1 * 4, /* %r1 */
- 2 * 4, /* %r2 */
- 3 * 4, /* %r3 */
- 4 * 4, /* %r4 */
- 5 * 4, /* %r5 */
- 6 * 4, /* %r6 */
- 7 * 4, /* %r7 */
- 8 * 4, /* %p0 */
- 9 * 4, /* %p1 */
- 10 * 4, /* %p2 */
- 11 * 4, /* %p3 */
- 12 * 4, /* %p4 */
- 13 * 4, /* %p5 */
- 14 * 4, /* %sp */
- 23 * 4, /* %fp */
- 24 * 4, /* %i0 */
- 25 * 4, /* %i1 */
- 26 * 4, /* %i2 */
- 27 * 4, /* %i3 */
- 28 * 4, /* %m0 */
- 29 * 4, /* %m1 */
- 30 * 4, /* %m2 */
- 31 * 4, /* %m3 */
- 36 * 4, /* %b0 */
- 37 * 4, /* %b1 */
- 38 * 4, /* %b2 */
- 39 * 4, /* %b3 */
- 32 * 4, /* %l0 */
- 33 * 4, /* %l1 */
- 34 * 4, /* %l2 */
- 35 * 4, /* %l3 */
- 17 * 4, /* %a0x */
- 15 * 4, /* %a0w */
- 18 * 4, /* %a1x */
- 16 * 4, /* %a1w */
- 19 * 4, /* %astat */
- 20 * 4, /* %rets */
- 40 * 4, /* %lc0 */
- 42 * 4, /* %lt0 */
- 44 * 4, /* %lb0 */
- 41 * 4, /* %lc1 */
- 43 * 4, /* %lt1 */
- 45 * 4, /* %lb1 */
- -1, /* %cycles */
- -1, /* %cycles2 */
- -1, /* %usp */
- 46 * 4, /* %seqstat */
- -1, /* syscfg */
- 21 * 4, /* %reti */
- 22 * 4, /* %retx */
- -1, /* %retn */
- -1, /* %rete */
- 21 * 4, /* %pc */
+#define SIGCONTEXT_OFFSET 168
+
+static const int bfin_linux_sigcontext_reg_offset[BFIN_NUM_REGS] = {
+ 0 * 4, /* %r0 */
+ 1 * 4, /* %r1 */
+ 2 * 4, /* %r2 */
+ 3 * 4, /* %r3 */
+ 4 * 4, /* %r4 */
+ 5 * 4, /* %r5 */
+ 6 * 4, /* %r6 */
+ 7 * 4, /* %r7 */
+ 8 * 4, /* %p0 */
+ 9 * 4, /* %p1 */
+ 10 * 4, /* %p2 */
+ 11 * 4, /* %p3 */
+ 12 * 4, /* %p4 */
+ 13 * 4, /* %p5 */
+ 14 * 4, /* %sp */
+ 23 * 4, /* %fp */
+ 24 * 4, /* %i0 */
+ 25 * 4, /* %i1 */
+ 26 * 4, /* %i2 */
+ 27 * 4, /* %i3 */
+ 28 * 4, /* %m0 */
+ 29 * 4, /* %m1 */
+ 30 * 4, /* %m2 */
+ 31 * 4, /* %m3 */
+ 36 * 4, /* %b0 */
+ 37 * 4, /* %b1 */
+ 38 * 4, /* %b2 */
+ 39 * 4, /* %b3 */
+ 32 * 4, /* %l0 */
+ 33 * 4, /* %l1 */
+ 34 * 4, /* %l2 */
+ 35 * 4, /* %l3 */
+ 17 * 4, /* %a0x */
+ 15 * 4, /* %a0w */
+ 18 * 4, /* %a1x */
+ 16 * 4, /* %a1w */
+ 19 * 4, /* %astat */
+ 20 * 4, /* %rets */
+ 40 * 4, /* %lc0 */
+ 42 * 4, /* %lt0 */
+ 44 * 4, /* %lb0 */
+ 41 * 4, /* %lc1 */
+ 43 * 4, /* %lt1 */
+ 45 * 4, /* %lb1 */
+ -1, /* %cycles */
+ -1, /* %cycles2 */
+ -1, /* %usp */
+ 46 * 4, /* %seqstat */
+ -1, /* syscfg */
+ 21 * 4, /* %reti */
+ 22 * 4, /* %retx */
+ -1, /* %retn */
+ -1, /* %rete */
+ 21 * 4, /* %pc */
};
/* Signal trampolines. */
@@ -96,8 +95,7 @@ static const int bfin_linux_sigcontext_reg_offset[BFIN_NUM_REGS] =
static void
bfin_linux_sigframe_init (const struct tramp_frame *self,
frame_info_ptr this_frame,
- struct trad_frame_cache *this_cache,
- CORE_ADDR func)
+ struct trad_frame_cache *this_cache, CORE_ADDR func)
{
CORE_ADDR sp = get_frame_sp (this_frame);
CORE_ADDR pc = get_frame_pc (this_frame);
@@ -114,12 +112,11 @@ bfin_linux_sigframe_init (const struct tramp_frame *self,
trad_frame_set_id (this_cache, frame_id_build (sp + 8, pc));
}
-static const struct tramp_frame bfin_linux_sigframe =
-{
+static const struct tramp_frame bfin_linux_sigframe = {
SIGTRAMP_FRAME,
4,
{
- { 0x00ADE128, 0xffffffff }, /* P0 = __NR_rt_sigreturn; */
+ { 0x00ADE128, 0xffffffff }, /* P0 = __NR_rt_sigreturn; */
{ 0x00A0, 0xffff }, /* EXCPT 0; */
{ TRAMP_SENTINEL_INSN, ULONGEST_MAX },
},
@@ -127,8 +124,7 @@ static const struct tramp_frame bfin_linux_sigframe =
};
static LONGEST
-bfin_linux_get_syscall_number (struct gdbarch *gdbarch,
- thread_info *thread)
+bfin_linux_get_syscall_number (struct gdbarch *gdbarch, thread_info *thread)
{
struct regcache *regcache = get_thread_regcache (thread);
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
@@ -157,11 +153,11 @@ bfin_linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
/* Functions for 'catch syscall'. */
set_xml_syscall_file_name (gdbarch, "syscalls/bfin-linux.xml");
- set_gdbarch_get_syscall_number (gdbarch,
- bfin_linux_get_syscall_number);
+ set_gdbarch_get_syscall_number (gdbarch, bfin_linux_get_syscall_number);
}
void _initialize_bfin_linux_tdep ();
+
void
_initialize_bfin_linux_tdep ()
{
diff --git a/gdb/bfin-tdep.c b/gdb/bfin-tdep.c
index 4d84407cc45..f98739f9154 100644
--- a/gdb/bfin-tdep.c
+++ b/gdb/bfin-tdep.c
@@ -41,106 +41,103 @@
#include "bfin-tdep.h"
/* Macros used by prologue functions. */
-#define P_LINKAGE 0xE800
-#define P_MINUS_SP1 0x0140
-#define P_MINUS_SP2 0x05C0
-#define P_MINUS_SP3 0x0540
-#define P_MINUS_SP4 0x04C0
-#define P_SP_PLUS 0x6C06
-#define P_P2_LOW 0xE10A
-#define P_P2_HIGH 0XE14A
-#define P_SP_EQ_SP_PLUS_P2 0X5BB2
-#define P_SP_EQ_P2_PLUS_SP 0x5B96
-#define P_MINUS_MINUS_SP_EQ_RETS 0x0167
+#define P_LINKAGE 0xE800
+#define P_MINUS_SP1 0x0140
+#define P_MINUS_SP2 0x05C0
+#define P_MINUS_SP3 0x0540
+#define P_MINUS_SP4 0x04C0
+#define P_SP_PLUS 0x6C06
+#define P_P2_LOW 0xE10A
+#define P_P2_HIGH 0XE14A
+#define P_SP_EQ_SP_PLUS_P2 0X5BB2
+#define P_SP_EQ_P2_PLUS_SP 0x5B96
+#define P_MINUS_MINUS_SP_EQ_RETS 0x0167
/* Macros used for program flow control. */
/* 16 bit instruction, max */
-#define P_16_BIT_INSR_MAX 0xBFFF
+#define P_16_BIT_INSR_MAX 0xBFFF
/* 32 bit instruction, min */
-#define P_32_BIT_INSR_MIN 0xC000
+#define P_32_BIT_INSR_MIN 0xC000
/* 32 bit instruction, max */
-#define P_32_BIT_INSR_MAX 0xE801
+#define P_32_BIT_INSR_MAX 0xE801
/* jump (preg), 16-bit, min */
-#define P_JUMP_PREG_MIN 0x0050
+#define P_JUMP_PREG_MIN 0x0050
/* jump (preg), 16-bit, max */
-#define P_JUMP_PREG_MAX 0x0057
+#define P_JUMP_PREG_MAX 0x0057
/* jump (pc+preg), 16-bit, min */
-#define P_JUMP_PC_PLUS_PREG_MIN 0x0080
+#define P_JUMP_PC_PLUS_PREG_MIN 0x0080
/* jump (pc+preg), 16-bit, max */
-#define P_JUMP_PC_PLUS_PREG_MAX 0x0087
+#define P_JUMP_PC_PLUS_PREG_MAX 0x0087
/* jump.s pcrel13m2, 16-bit, min */
-#define P_JUMP_S_MIN 0x2000
+#define P_JUMP_S_MIN 0x2000
/* jump.s pcrel13m2, 16-bit, max */
-#define P_JUMP_S_MAX 0x2FFF
+#define P_JUMP_S_MAX 0x2FFF
/* jump.l pcrel25m2, 32-bit, min */
-#define P_JUMP_L_MIN 0xE200
+#define P_JUMP_L_MIN 0xE200
/* jump.l pcrel25m2, 32-bit, max */
-#define P_JUMP_L_MAX 0xE2FF
+#define P_JUMP_L_MAX 0xE2FF
/* conditional jump pcrel11m2, 16-bit, min */
-#define P_IF_CC_JUMP_MIN 0x1800
+#define P_IF_CC_JUMP_MIN 0x1800
/* conditional jump pcrel11m2, 16-bit, max */
-#define P_IF_CC_JUMP_MAX 0x1BFF
+#define P_IF_CC_JUMP_MAX 0x1BFF
/* conditional jump(bp) pcrel11m2, 16-bit, min */
-#define P_IF_CC_JUMP_BP_MIN 0x1C00
+#define P_IF_CC_JUMP_BP_MIN 0x1C00
/* conditional jump(bp) pcrel11m2, 16-bit, max */
-#define P_IF_CC_JUMP_BP_MAX 0x1FFF
+#define P_IF_CC_JUMP_BP_MAX 0x1FFF
/* conditional !jump pcrel11m2, 16-bit, min */
-#define P_IF_NOT_CC_JUMP_MIN 0x1000
+#define P_IF_NOT_CC_JUMP_MIN 0x1000
/* conditional !jump pcrel11m2, 16-bit, max */
-#define P_IF_NOT_CC_JUMP_MAX 0x13FF
+#define P_IF_NOT_CC_JUMP_MAX 0x13FF
/* conditional jump(bp) pcrel11m2, 16-bit, min */
-#define P_IF_NOT_CC_JUMP_BP_MIN 0x1400
+#define P_IF_NOT_CC_JUMP_BP_MIN 0x1400
/* conditional jump(bp) pcrel11m2, 16-bit, max */
-#define P_IF_NOT_CC_JUMP_BP_MAX 0x17FF
+#define P_IF_NOT_CC_JUMP_BP_MAX 0x17FF
/* call (preg), 16-bit, min */
-#define P_CALL_PREG_MIN 0x0060
+#define P_CALL_PREG_MIN 0x0060
/* call (preg), 16-bit, max */
-#define P_CALL_PREG_MAX 0x0067
+#define P_CALL_PREG_MAX 0x0067
/* call (pc+preg), 16-bit, min */
-#define P_CALL_PC_PLUS_PREG_MIN 0x0070
+#define P_CALL_PC_PLUS_PREG_MIN 0x0070
/* call (pc+preg), 16-bit, max */
-#define P_CALL_PC_PLUS_PREG_MAX 0x0077
+#define P_CALL_PC_PLUS_PREG_MAX 0x0077
/* call pcrel25m2, 32-bit, min */
-#define P_CALL_MIN 0xE300
+#define P_CALL_MIN 0xE300
/* call pcrel25m2, 32-bit, max */
-#define P_CALL_MAX 0xE3FF
+#define P_CALL_MAX 0xE3FF
/* RTS */
-#define P_RTS 0x0010
+#define P_RTS 0x0010
/* MNOP */
-#define P_MNOP 0xC803
+#define P_MNOP 0xC803
/* EXCPT, 16-bit, min */
-#define P_EXCPT_MIN 0x00A0
+#define P_EXCPT_MIN 0x00A0
/* EXCPT, 16-bit, max */
-#define P_EXCPT_MAX 0x00AF
+#define P_EXCPT_MAX 0x00AF
/* multi instruction mask 1, 16-bit */
-#define P_BIT_MULTI_INS_1 0xC000
+#define P_BIT_MULTI_INS_1 0xC000
/* multi instruction mask 2, 16-bit */
-#define P_BIT_MULTI_INS_2 0x0800
+#define P_BIT_MULTI_INS_2 0x0800
/* The maximum bytes we search to skip the prologue. */
-#define UPPER_LIMIT 40
+#define UPPER_LIMIT 40
/* ASTAT bits */
-#define ASTAT_CC_POS 5
-#define ASTAT_CC (1 << ASTAT_CC_POS)
+#define ASTAT_CC_POS 5
+#define ASTAT_CC (1 << ASTAT_CC_POS)
/* Initial value: Register names used in BFIN's ISA documentation. */
-static const char * const bfin_register_name_strings[] =
-{
- "r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7",
- "p0", "p1", "p2", "p3", "p4", "p5", "sp", "fp",
- "i0", "i1", "i2", "i3", "m0", "m1", "m2", "m3",
- "b0", "b1", "b2", "b3", "l0", "l1", "l2", "l3",
- "a0x", "a0w", "a1x", "a1w", "astat", "rets",
- "lc0", "lt0", "lb0", "lc1", "lt1", "lb1", "cycles", "cycles2",
- "usp", "seqstat", "syscfg", "reti", "retx", "retn", "rete",
- "pc", "cc",
+static const char *const bfin_register_name_strings[] = {
+ "r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7",
+ "p0", "p1", "p2", "p3", "p4", "p5", "sp", "fp",
+ "i0", "i1", "i2", "i3", "m0", "m1", "m2", "m3",
+ "b0", "b1", "b2", "b3", "l0", "l1", "l2", "l3",
+ "a0x", "a0w", "a1x", "a1w", "astat", "rets", "lc0", "lt0",
+ "lb0", "lc1", "lt1", "lb1", "cycles", "cycles2", "usp", "seqstat",
+ "syscfg", "reti", "retx", "retn", "rete", "pc", "cc",
};
#define NUM_BFIN_REGNAMES ARRAY_SIZE (bfin_register_name_strings)
-
/* In this diagram successive memory locations increase downwards or the
stack grows upwards with negative indices. (PUSH analogy for stack.)
@@ -185,64 +182,29 @@ static const char * const bfin_register_name_strings[] =
FP has the topmost frame.
FP + 4 has the previous FP and so on. */
-
/* Map from DWARF2 register number to GDB register number. */
-static const int map_gcc_gdb[] =
-{
- BFIN_R0_REGNUM,
- BFIN_R1_REGNUM,
- BFIN_R2_REGNUM,
- BFIN_R3_REGNUM,
- BFIN_R4_REGNUM,
- BFIN_R5_REGNUM,
- BFIN_R6_REGNUM,
- BFIN_R7_REGNUM,
- BFIN_P0_REGNUM,
- BFIN_P1_REGNUM,
- BFIN_P2_REGNUM,
- BFIN_P3_REGNUM,
- BFIN_P4_REGNUM,
- BFIN_P5_REGNUM,
- BFIN_SP_REGNUM,
- BFIN_FP_REGNUM,
- BFIN_I0_REGNUM,
- BFIN_I1_REGNUM,
- BFIN_I2_REGNUM,
- BFIN_I3_REGNUM,
- BFIN_B0_REGNUM,
- BFIN_B1_REGNUM,
- BFIN_B2_REGNUM,
- BFIN_B3_REGNUM,
- BFIN_L0_REGNUM,
- BFIN_L1_REGNUM,
- BFIN_L2_REGNUM,
- BFIN_L3_REGNUM,
- BFIN_M0_REGNUM,
- BFIN_M1_REGNUM,
- BFIN_M2_REGNUM,
- BFIN_M3_REGNUM,
- BFIN_A0_DOT_X_REGNUM,
- BFIN_A1_DOT_X_REGNUM,
- BFIN_CC_REGNUM,
- BFIN_RETS_REGNUM,
- BFIN_RETI_REGNUM,
- BFIN_RETX_REGNUM,
- BFIN_RETN_REGNUM,
- BFIN_RETE_REGNUM,
- BFIN_ASTAT_REGNUM,
- BFIN_SEQSTAT_REGNUM,
- BFIN_USP_REGNUM,
- BFIN_LT0_REGNUM,
- BFIN_LT1_REGNUM,
- BFIN_LC0_REGNUM,
- BFIN_LC1_REGNUM,
- BFIN_LB0_REGNUM,
- BFIN_LB1_REGNUM
-};
+static const int map_gcc_gdb[]
+ = { BFIN_R0_REGNUM, BFIN_R1_REGNUM, BFIN_R2_REGNUM,
+ BFIN_R3_REGNUM, BFIN_R4_REGNUM, BFIN_R5_REGNUM,
+ BFIN_R6_REGNUM, BFIN_R7_REGNUM, BFIN_P0_REGNUM,
+ BFIN_P1_REGNUM, BFIN_P2_REGNUM, BFIN_P3_REGNUM,
+ BFIN_P4_REGNUM, BFIN_P5_REGNUM, BFIN_SP_REGNUM,
+ BFIN_FP_REGNUM, BFIN_I0_REGNUM, BFIN_I1_REGNUM,
+ BFIN_I2_REGNUM, BFIN_I3_REGNUM, BFIN_B0_REGNUM,
+ BFIN_B1_REGNUM, BFIN_B2_REGNUM, BFIN_B3_REGNUM,
+ BFIN_L0_REGNUM, BFIN_L1_REGNUM, BFIN_L2_REGNUM,
+ BFIN_L3_REGNUM, BFIN_M0_REGNUM, BFIN_M1_REGNUM,
+ BFIN_M2_REGNUM, BFIN_M3_REGNUM, BFIN_A0_DOT_X_REGNUM,
+ BFIN_A1_DOT_X_REGNUM, BFIN_CC_REGNUM, BFIN_RETS_REGNUM,
+ BFIN_RETI_REGNUM, BFIN_RETX_REGNUM, BFIN_RETN_REGNUM,
+ BFIN_RETE_REGNUM, BFIN_ASTAT_REGNUM, BFIN_SEQSTAT_REGNUM,
+ BFIN_USP_REGNUM, BFIN_LT0_REGNUM, BFIN_LT1_REGNUM,
+ BFIN_LC0_REGNUM, BFIN_LC1_REGNUM, BFIN_LB0_REGNUM,
+ BFIN_LB1_REGNUM };
/* Big enough to hold the size of the largest register in bytes. */
-#define BFIN_MAX_REGISTER_SIZE 4
+#define BFIN_MAX_REGISTER_SIZE 4
struct bfin_frame_cache
{
@@ -313,15 +275,15 @@ bfin_frame_cache (frame_info_ptr this_frame, void **this_cache)
if (cache->saved_regs[i] != -1)
cache->saved_regs[i] += cache->base;
- cache->pc = get_frame_func (this_frame) ;
+ cache->pc = get_frame_func (this_frame);
if (cache->pc == 0 || cache->pc == get_frame_pc (this_frame))
{
/* Either there is no prologue (frameless function) or we are at
the start of a function. In short we do not have a frame.
PC is stored in rets register. FP points to previous frame. */
- cache->saved_regs[BFIN_PC_REGNUM] =
- get_frame_register_unsigned (this_frame, BFIN_RETS_REGNUM);
+ cache->saved_regs[BFIN_PC_REGNUM]
+ = get_frame_register_unsigned (this_frame, BFIN_RETS_REGNUM);
cache->frameless_pc_value = 1;
cache->base = get_frame_register_unsigned (this_frame, BFIN_FP_REGNUM);
cache->saved_regs[BFIN_FP_REGNUM] = cache->base;
@@ -340,8 +302,7 @@ bfin_frame_cache (frame_info_ptr this_frame, void **this_cache)
}
static void
-bfin_frame_this_id (frame_info_ptr this_frame,
- void **this_cache,
+bfin_frame_this_id (frame_info_ptr this_frame, void **this_cache,
struct frame_id *this_id)
{
struct bfin_frame_cache *cache = bfin_frame_cache (this_frame, this_cache);
@@ -355,8 +316,7 @@ bfin_frame_this_id (frame_info_ptr this_frame,
}
static struct value *
-bfin_frame_prev_register (frame_info_ptr this_frame,
- void **this_cache,
+bfin_frame_prev_register (frame_info_ptr this_frame, void **this_cache,
int regnum)
{
struct gdbarch *gdbarch = get_frame_arch (this_frame);
@@ -372,16 +332,14 @@ bfin_frame_prev_register (frame_info_ptr this_frame,
return frame_unwind_got_register (this_frame, regnum, regnum);
}
-static const struct frame_unwind bfin_frame_unwind =
-{
- "bfin prologue",
- NORMAL_FRAME,
- default_frame_unwind_stop_reason,
- bfin_frame_this_id,
- bfin_frame_prev_register,
- NULL,
- default_frame_sniffer
-};
+static const struct frame_unwind bfin_frame_unwind
+ = { "bfin prologue",
+ NORMAL_FRAME,
+ default_frame_unwind_stop_reason,
+ bfin_frame_this_id,
+ bfin_frame_prev_register,
+ NULL,
+ default_frame_sniffer };
/* Check for "[--SP] = <reg>;" insns. These are appear in function
prologues to save misc registers onto the stack. */
@@ -391,8 +349,8 @@ is_minus_minus_sp (int op)
{
op &= 0xFFC0;
- if ((op == P_MINUS_SP1) || (op == P_MINUS_SP2)
- || (op == P_MINUS_SP3) || (op == P_MINUS_SP4))
+ if ((op == P_MINUS_SP1) || (op == P_MINUS_SP2) || (op == P_MINUS_SP3)
+ || (op == P_MINUS_SP4))
return 1;
return 0;
@@ -451,8 +409,8 @@ bfin_skip_prologue (struct gdbarch *gdbarch, CORE_ADDR pc)
}
else if (pc - orig_pc >= UPPER_LIMIT)
{
- warning (_("Function Prologue not recognised; "
- "pc will point to ENTRY_POINT of the function"));
+ warning (_ ("Function Prologue not recognised; "
+ "pc will point to ENTRY_POINT of the function"));
pc = orig_pc + 2;
done = 1;
}
@@ -463,7 +421,7 @@ bfin_skip_prologue (struct gdbarch *gdbarch, CORE_ADDR pc)
}
}
- /* TODO:
+ /* TODO:
Dwarf2 uses entry point value AFTER some register initializations.
We should perhaps skip such asssignments as well (R6 = R1, ...). */
@@ -492,13 +450,9 @@ bfin_register_type (struct gdbarch *gdbarch, int regnum)
}
static CORE_ADDR
-bfin_push_dummy_call (struct gdbarch *gdbarch,
- struct value *function,
- struct regcache *regcache,
- CORE_ADDR bp_addr,
- int nargs,
- struct value **args,
- CORE_ADDR sp,
+bfin_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
+ struct regcache *regcache, CORE_ADDR bp_addr, int nargs,
+ struct value **args, CORE_ADDR sp,
function_call_return_method return_method,
CORE_ADDR struct_addr)
{
@@ -593,8 +547,8 @@ bfin_breakpoint_kind_from_pc (struct gdbarch *gdbarch, CORE_ADDR *pcptr)
static const gdb_byte *
bfin_sw_breakpoint_from_kind (struct gdbarch *gdbarch, int kind, int *size)
{
- static unsigned char bfin_breakpoint[] = {0xa1, 0x00, 0x00, 0x00};
- static unsigned char bfin_sim_breakpoint[] = {0x25, 0x00, 0x00, 0x00};
+ static unsigned char bfin_breakpoint[] = { 0xa1, 0x00, 0x00, 0x00 };
+ static unsigned char bfin_sim_breakpoint[] = { 0x25, 0x00, 0x00, 0x00 };
*size = kind;
@@ -605,8 +559,7 @@ bfin_sw_breakpoint_from_kind (struct gdbarch *gdbarch, int kind, int *size)
}
static void
-bfin_extract_return_value (struct type *type,
- struct regcache *regs,
+bfin_extract_return_value (struct type *type, struct regcache *regs,
gdb_byte *dst)
{
struct gdbarch *gdbarch = regs->arch ();
@@ -631,8 +584,7 @@ bfin_extract_return_value (struct type *type,
TYPE, given in virtual format. */
static void
-bfin_store_return_value (struct type *type,
- struct regcache *regs,
+bfin_store_return_value (struct type *type, struct regcache *regs,
const gdb_byte *src)
{
const bfd_byte *valbuf = src;
@@ -661,12 +613,9 @@ bfin_store_return_value (struct type *type,
from WRITEBUF into REGCACHE. */
static enum return_value_convention
-bfin_return_value (struct gdbarch *gdbarch,
- struct value *function,
- struct type *type,
- struct regcache *regcache,
- gdb_byte *readbuf,
- const gdb_byte *writebuf)
+bfin_return_value (struct gdbarch *gdbarch, struct value *function,
+ struct type *type, struct regcache *regcache,
+ gdb_byte *readbuf, const gdb_byte *writebuf)
{
if (type->length () > 8)
return RETURN_VALUE_STRUCT_CONVENTION;
@@ -689,14 +638,15 @@ bfin_register_name (struct gdbarch *gdbarch, int i)
}
static enum register_status
-bfin_pseudo_register_read (struct gdbarch *gdbarch, readable_regcache *regcache,
- int regnum, gdb_byte *buffer)
+bfin_pseudo_register_read (struct gdbarch *gdbarch,
+ readable_regcache *regcache, int regnum,
+ gdb_byte *buffer)
{
gdb_byte buf[BFIN_MAX_REGISTER_SIZE];
enum register_status status;
if (regnum != BFIN_CC_REGNUM)
- internal_error (_("invalid register number %d"), regnum);
+ internal_error (_ ("invalid register number %d"), regnum);
/* Extract the CC bit from the ASTAT register. */
status = regcache->raw_read (BFIN_ASTAT_REGNUM, buf);
@@ -715,7 +665,7 @@ bfin_pseudo_register_write (struct gdbarch *gdbarch, struct regcache *regcache,
gdb_byte buf[BFIN_MAX_REGISTER_SIZE];
if (regnum != BFIN_CC_REGNUM)
- internal_error (_("invalid register number %d"), regnum);
+ internal_error (_ ("invalid register number %d"), regnum);
/* Overlay the CC bit in the ASTAT register. */
regcache->raw_read (BFIN_ASTAT_REGNUM, buf);
@@ -747,13 +697,9 @@ bfin_frame_args_address (frame_info_ptr this_frame, void **this_cache)
return cache->base + 8;
}
-static const struct frame_base bfin_frame_base =
-{
- &bfin_frame_unwind,
- bfin_frame_base_address,
- bfin_frame_local_address,
- bfin_frame_args_address
-};
+static const struct frame_base bfin_frame_base
+ = { &bfin_frame_unwind, bfin_frame_base_address, bfin_frame_local_address,
+ bfin_frame_args_address };
static CORE_ADDR
bfin_frame_align (struct gdbarch *gdbarch, CORE_ADDR address)
@@ -784,8 +730,7 @@ bfin_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
/* If there is already a candidate, use it. */
- for (arches = gdbarch_list_lookup_by_info (arches, &info);
- arches != NULL;
+ for (arches = gdbarch_list_lookup_by_info (arches, &info); arches != NULL;
arches = gdbarch_list_lookup_by_info (arches->next, &info))
{
bfin_gdbarch_tdep *tdep
@@ -837,6 +782,7 @@ bfin_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
}
void _initialize_bfin_tdep ();
+
void
_initialize_bfin_tdep ()
{
diff --git a/gdb/bfin-tdep.h b/gdb/bfin-tdep.h
index a987e97f7f4..3700355aa4f 100644
--- a/gdb/bfin-tdep.h
+++ b/gdb/bfin-tdep.h
@@ -24,7 +24,8 @@
#include "gdbarch.h"
-enum gdb_regnum {
+enum gdb_regnum
+{
/* Core Registers */
BFIN_R0_REGNUM = 0,
BFIN_R1_REGNUM,
@@ -86,6 +87,7 @@ enum gdb_regnum {
/* Pseudo Registers managed locally. */
BFIN_CC_REGNUM
};
+
#define BFIN_NUM_REGS (BFIN_PC_REGNUM + 1)
#define BFIN_NUM_PSEUDO_REGS (1)
@@ -99,7 +101,9 @@ enum bfin_abi
struct bfin_gdbarch_tdep : gdbarch_tdep_base
{
/* Which ABI is in use? */
- enum bfin_abi bfin_abi {};
+ enum bfin_abi bfin_abi
+ {
+ };
};
/* Return the Blackfin ABI associated with GDBARCH. */
diff --git a/gdb/block.c b/gdb/block.c
index 167cb08e0bb..96ac2220423 100644
--- a/gdb/block.c
+++ b/gdb/block.c
@@ -68,8 +68,7 @@ block_gdbarch (const struct block *block)
/* See block.h. */
bool
-contained_in (const struct block *a, const struct block *b,
- bool allow_nested)
+contained_in (const struct block *a, const struct block *b, bool allow_nested)
{
if (!a || !b)
return false;
@@ -89,7 +88,6 @@ contained_in (const struct block *a, const struct block *b,
return false;
}
-
/* Return the symbol for the function which contains a specified
lexical block, described by a struct block BL. The return value
will not be an inlined function; the containing function will be
@@ -240,11 +238,10 @@ call_site_for_pc (struct gdbarch *gdbarch, CORE_ADDR pc)
/* DW_TAG_gnu_call_site will be missing just if GCC could not determine
the call target. */
throw_error (NO_ENTRY_VALUE_ERROR,
- _("DW_OP_entry_value resolving cannot find "
- "DW_TAG_call_site %s in %s"),
+ _ ("DW_OP_entry_value resolving cannot find "
+ "DW_TAG_call_site %s in %s"),
paddress (gdbarch, pc),
- (msym.minsym == NULL ? "???"
- : msym.minsym->print_name ()));
+ (msym.minsym == NULL ? "???" : msym.minsym->print_name ()));
}
return cs;
@@ -257,8 +254,8 @@ call_site_for_pc (struct gdbarch *gdbarch, CORE_ADDR pc)
const struct blockvector *
blockvector_for_pc (CORE_ADDR pc, const struct block **pblock)
{
- return blockvector_for_pc_sect (pc, find_pc_mapped_section (pc),
- pblock, NULL);
+ return blockvector_for_pc_sect (pc, find_pc_mapped_section (pc), pblock,
+ NULL);
}
/* Return the innermost lexical block containing the specified pc value
@@ -335,8 +332,7 @@ block_using (const struct block *block)
has to be allocated correctly.) */
void
-block_set_using (struct block *block,
- struct using_direct *using_decl,
+block_set_using (struct block *block, struct using_direct *using_decl,
struct obstack *obstack)
{
block_initialize_namespace (block, obstack);
@@ -452,8 +448,6 @@ get_block_compunit_symtab (const struct block *block)
return gb->compunit_symtab;
}
-
-
/* Initialize a block iterator, either to iterate over a single block,
or, for static and global blocks, all the included symtabs as
well. */
@@ -541,7 +535,7 @@ block_iterator_step (struct block_iterator *iterator, int first)
/* Iteration is complete. */
if (cust == NULL)
- return NULL;
+ return NULL;
block = cust->blockvector ()->block (iterator->which);
sym = mdict_iterator_first (block->multidict (),
@@ -592,8 +586,7 @@ block_iterator_next (struct block_iterator *iterator)
static struct symbol *
block_iter_match_step (struct block_iterator *iterator,
- const lookup_name_info &name,
- int first)
+ const lookup_name_info &name, int first)
{
struct symbol *sym;
@@ -609,7 +602,7 @@ block_iter_match_step (struct block_iterator *iterator,
/* Iteration is complete. */
if (cust == NULL)
- return NULL;
+ return NULL;
block = cust->blockvector ()->block (iterator->which);
sym = mdict_iter_match_first (block->multidict (), name,
@@ -662,8 +655,7 @@ block_iter_match_next (const lookup_name_info &name,
bool
best_symbol (struct symbol *a, const domain_enum domain)
{
- return (a->domain () == domain
- && a->aclass () != LOC_UNRESOLVED);
+ return (a->domain () == domain && a->aclass () != LOC_UNRESOLVED);
}
/* See block.h. */
@@ -726,8 +718,7 @@ block_lookup_symbol (const struct block *block, const char *name,
STRUCT vs VAR domain symbols. So if a matching symbol is found,
make sure there is no "better" matching symbol, i.e., one with
exactly the same domain. PR 16253. */
- if (symbol_matches_domain (sym->language (),
- sym->domain (), domain))
+ if (symbol_matches_domain (sym->language (), sym->domain (), domain))
other = better_symbol (other, sym, domain);
}
return other;
@@ -747,8 +738,7 @@ block_lookup_symbol (const struct block *block, const char *name,
ALL_BLOCK_SYMBOLS_WITH_NAME (block, lookup_name, iter, sym)
{
- if (symbol_matches_domain (sym->language (),
- sym->domain (), domain))
+ if (symbol_matches_domain (sym->language (), sym->domain (), domain))
{
sym_found = sym;
if (!sym->is_argument ())
@@ -757,7 +747,7 @@ block_lookup_symbol (const struct block *block, const char *name,
}
}
}
- return (sym_found); /* Will be NULL if not found. */
+ return (sym_found); /* Will be NULL if not found. */
}
}
@@ -779,8 +769,7 @@ block_lookup_symbol_primary (const struct block *block, const char *name,
other = NULL;
for (sym = mdict_iter_match_first (block->multidict (), lookup_name,
&mdict_iter);
- sym != NULL;
- sym = mdict_iter_match_next (lookup_name, &mdict_iter))
+ sym != NULL; sym = mdict_iter_match_next (lookup_name, &mdict_iter))
{
/* With the fix for PR gcc/debug/91507, we get for:
...
@@ -878,16 +867,14 @@ make_blockranges (struct objfile *objfile,
const std::vector<blockrange> &rangevec)
{
struct blockranges *blr;
- size_t n = rangevec.size();
+ size_t n = rangevec.size ();
- blr = (struct blockranges *)
- obstack_alloc (&objfile->objfile_obstack,
- sizeof (struct blockranges)
- + (n - 1) * sizeof (struct blockrange));
+ blr = (struct blockranges *) obstack_alloc (
+ &objfile->objfile_obstack,
+ sizeof (struct blockranges) + (n - 1) * sizeof (struct blockrange));
blr->nranges = n;
for (int i = 0; i < n; i++)
blr->range[i] = rangevec[i];
return blr;
}
-
diff --git a/gdb/block.h b/gdb/block.h
index 379359f07be..7239bc2edc6 100644
--- a/gdb/block.h
+++ b/gdb/block.h
@@ -46,20 +46,16 @@ struct blockrange
}
/* Return this blockrange's start address. */
- CORE_ADDR start () const
- { return m_start; }
+ CORE_ADDR start () const { return m_start; }
/* Set this blockrange's start address. */
- void set_start (CORE_ADDR start)
- { m_start = start; }
+ void set_start (CORE_ADDR start) { m_start = start; }
/* Return this blockrange's end address. */
- CORE_ADDR end () const
- { return m_end; }
+ CORE_ADDR end () const { return m_end; }
/* Set this blockrange's end address. */
- void set_end (CORE_ADDR end)
- { m_end = end; }
+ void set_end (CORE_ADDR end) { m_end = end; }
/* Lowest address in this range. */
@@ -108,52 +104,43 @@ struct blockranges
struct block
{
/* Return this block's start address. */
- CORE_ADDR start () const
- { return m_start; }
+ CORE_ADDR start () const { return m_start; }
/* Set this block's start address. */
- void set_start (CORE_ADDR start)
- { m_start = start; }
+ void set_start (CORE_ADDR start) { m_start = start; }
/* Return this block's end address. */
- CORE_ADDR end () const
- { return m_end; }
+ CORE_ADDR end () const { return m_end; }
/* Set this block's end address. */
- void set_end (CORE_ADDR end)
- { m_end = end; }
+ void set_end (CORE_ADDR end) { m_end = end; }
/* Return this block's function symbol. */
- symbol *function () const
- { return m_function; }
+ symbol *function () const { return m_function; }
/* Set this block's function symbol. */
- void set_function (symbol *function)
- { m_function = function; }
+ void set_function (symbol *function) { m_function = function; }
/* Return this block's superblock. */
- const block *superblock () const
- { return m_superblock; }
+ const block *superblock () const { return m_superblock; }
/* Set this block's superblock. */
- void set_superblock (const block *superblock)
- { m_superblock = superblock; }
+ void set_superblock (const block *superblock) { m_superblock = superblock; }
/* Return this block's multidict. */
- multidictionary *multidict () const
- { return m_multidict; }
+ multidictionary *multidict () const { return m_multidict; }
/* Set this block's multidict. */
- void set_multidict (multidictionary *multidict)
- { m_multidict = multidict; }
+ void set_multidict (multidictionary *multidict) { m_multidict = multidict; }
/* Return this block's namespace info. */
- block_namespace_info *namespace_info () const
- { return m_namespace_info; }
+ block_namespace_info *namespace_info () const { return m_namespace_info; }
/* Set this block's namespace info. */
void set_namespace_info (block_namespace_info *namespace_info)
- { m_namespace_info = namespace_info; }
+ {
+ m_namespace_info = namespace_info;
+ }
/* Return a view on this block's ranges. */
gdb::array_view<blockrange> ranges ()
@@ -174,12 +161,10 @@ struct block
}
/* Set this block's ranges array. */
- void set_ranges (blockranges *ranges)
- { m_ranges = ranges; }
+ void set_ranges (blockranges *ranges) { m_ranges = ranges; }
/* Return true if all addresses within this block are contiguous. */
- bool is_contiguous () const
- { return this->ranges ().size () <= 1; }
+ bool is_contiguous () const { return this->ranges ().size () <= 1; }
/* Return the "entry PC" of this block.
@@ -268,57 +253,52 @@ struct blockvector
}
/* Return the block at index I. */
- struct block *block (size_t i)
- { return this->blocks ()[i]; }
+ struct block *block (size_t i) { return this->blocks ()[i]; }
/* Const version of the above. */
- const struct block *block (size_t i) const
- { return this->blocks ()[i]; }
+ const struct block *block (size_t i) const { return this->blocks ()[i]; }
/* Set the block at index I. */
- void set_block (int i, struct block *block)
- { m_blocks[i] = block; }
+ void set_block (int i, struct block *block) { m_blocks[i] = block; }
/* Set the number of blocks of this blockvector.
The storage of blocks is done using a flexible array member, so the number
of blocks set here must agree with what was effectively allocated. */
- void set_num_blocks (int num_blocks)
- { m_num_blocks = num_blocks; }
+ void set_num_blocks (int num_blocks) { m_num_blocks = num_blocks; }
/* Return the number of blocks in this blockvector. */
- int num_blocks () const
- { return m_num_blocks; }
+ int num_blocks () const { return m_num_blocks; }
/* Return the global block of this blockvector. */
- struct block *global_block ()
- { return this->block (GLOBAL_BLOCK); }
+ struct block *global_block () { return this->block (GLOBAL_BLOCK); }
/* Const version of the above. */
const struct block *global_block () const
- { return this->block (GLOBAL_BLOCK); }
+ {
+ return this->block (GLOBAL_BLOCK);
+ }
/* Return the static block of this blockvector. */
- struct block *static_block ()
- { return this->block (STATIC_BLOCK); }
+ struct block *static_block () { return this->block (STATIC_BLOCK); }
/* Const version of the above. */
const struct block *static_block () const
- { return this->block (STATIC_BLOCK); }
+ {
+ return this->block (STATIC_BLOCK);
+ }
/* Return the address -> block map of this blockvector. */
- addrmap *map ()
- { return m_map; }
+ addrmap *map () { return m_map; }
/* Const version of the above. */
- const addrmap *map () const
- { return m_map; }
+ const addrmap *map () const { return m_map; }
/* Set this blockvector's address -> block map. */
- void set_map (addrmap *map)
- { m_map = map; }
+ void set_map (addrmap *map) { m_map = map; }
private:
+
/* An address map mapping addresses to blocks in this blockvector.
This pointer is zero if the blocks' start and end addresses are
enough. */
@@ -356,13 +336,14 @@ extern bool contained_in (const struct block *a, const struct block *b,
bool allow_nested = false);
extern const struct blockvector *blockvector_for_pc (CORE_ADDR,
- const struct block **);
+ const struct block **);
extern const struct blockvector *
- blockvector_for_pc_sect (CORE_ADDR, struct obj_section *,
- const struct block **, struct compunit_symtab *);
+blockvector_for_pc_sect (CORE_ADDR, struct obj_section *,
+ const struct block **, struct compunit_symtab *);
-extern int blockvector_contains_pc (const struct blockvector *bv, CORE_ADDR pc);
+extern int blockvector_contains_pc (const struct blockvector *bv,
+ CORE_ADDR pc);
extern struct call_site *call_site_for_pc (struct gdbarch *gdbarch,
CORE_ADDR pc);
@@ -465,8 +446,8 @@ extern struct symbol *block_iter_match_first (const struct block *block,
iteration. And don't call it unless ITERATOR was created by a
previous call to block_iter_match_first with the same NAME. */
-extern struct symbol *block_iter_match_next
- (const lookup_name_info &name, struct block_iterator *iterator);
+extern struct symbol *block_iter_match_next (const lookup_name_info &name,
+ struct block_iterator *iterator);
/* Return true if symbol A is the best match possible for DOMAIN. */
@@ -531,9 +512,8 @@ extern int block_find_non_opaque_type_preferred (struct symbol *sym,
order. ITER helps keep track of the iteration, and must be a
struct block_iterator. SYM points to the current symbol. */
-#define ALL_BLOCK_SYMBOLS(block, iter, sym) \
- for ((sym) = block_iterator_first ((block), &(iter)); \
- (sym); \
+#define ALL_BLOCK_SYMBOLS(block, iter, sym) \
+ for ((sym) = block_iterator_first ((block), &(iter)); (sym); \
(sym) = block_iterator_next (&(iter)))
/* Macro to loop through all symbols in BLOCK with a name that matches
@@ -541,10 +521,9 @@ extern int block_find_non_opaque_type_preferred (struct symbol *sym,
iteration, and must be a struct block_iterator. SYM points to the
current symbol. */
-#define ALL_BLOCK_SYMBOLS_WITH_NAME(block, name, iter, sym) \
- for ((sym) = block_iter_match_first ((block), (name), &(iter)); \
- (sym) != NULL; \
- (sym) = block_iter_match_next ((name), &(iter)))
+#define ALL_BLOCK_SYMBOLS_WITH_NAME(block, name, iter, sym) \
+ for ((sym) = block_iter_match_first ((block), (name), &(iter)); \
+ (sym) != NULL; (sym) = block_iter_match_next ((name), &(iter)))
/* Given a vector of pairs, allocate and build an obstack allocated
blockranges struct for a block. */
diff --git a/gdb/blockframe.c b/gdb/blockframe.c
index 071254824b0..0ee31df60a0 100644
--- a/gdb/blockframe.c
+++ b/gdb/blockframe.c
@@ -127,7 +127,6 @@ get_frame_function (frame_info_ptr frame)
return bl->function ();
}
-
/* Return the function containing pc value PC in section SECTION.
Returns 0 if function is not known. */
@@ -232,8 +231,7 @@ find_pc_partial_function_sym (CORE_ADDR pc,
mapped_pc = overlay_mapped_address (pc, section);
- if (mapped_pc >= cache_pc_function_low
- && mapped_pc < cache_pc_function_high
+ if (mapped_pc >= cache_pc_function_low && mapped_pc < cache_pc_function_high
&& section == cache_pc_function_section)
goto return_cached_value;
@@ -254,8 +252,7 @@ find_pc_partial_function_sym (CORE_ADDR pc,
f = find_pc_sect_function (mapped_pc, section);
if (f != NULL
&& (msymbol.minsym == NULL
- || (f->value_block ()->entry_pc ()
- >= msymbol.value_address ())))
+ || (f->value_block ()->entry_pc () >= msymbol.value_address ())))
{
const struct block *b = f->value_block ();
@@ -298,7 +295,6 @@ find_pc_partial_function_sym (CORE_ADDR pc,
gdb_assert (found);
}
-
goto return_cached_value;
}
}
@@ -332,7 +328,7 @@ find_pc_partial_function_sym (CORE_ADDR pc,
cache_pc_function_high = minimal_symbol_upper_bound (msymbol);
cache_pc_function_block = nullptr;
- return_cached_value:
+return_cached_value:
if (address)
{
@@ -354,8 +350,9 @@ find_pc_partial_function_sym (CORE_ADDR pc,
the overlay), we must actually convert (high - 1) and
then add one to that. */
- *endaddr = 1 + overlay_unmapped_address (cache_pc_function_high - 1,
- section);
+ *endaddr
+ = 1
+ + overlay_unmapped_address (cache_pc_function_high - 1, section);
}
else
*endaddr = cache_pc_function_high;
@@ -380,7 +377,6 @@ find_pc_partial_function (CORE_ADDR pc, const char **name, CORE_ADDR *address,
return r;
}
-
/* See symtab.h. */
bool
@@ -410,7 +406,8 @@ find_function_entry_range_from_pc (CORE_ADDR pc, const char **name,
/* It's an internal error if we exit the above loop without finding
the range. */
- internal_error (_("Entry block not found in find_function_entry_range_from_pc"));
+ internal_error (
+ _ ("Entry block not found in find_function_entry_range_from_pc"));
}
return status;
@@ -445,8 +442,7 @@ find_gnu_ifunc_target_type (CORE_ADDR resolver_funaddr)
is the type of the pointed-to function. */
if (resolver_ret_type->code () == TYPE_CODE_PTR)
{
- struct type *resolved_type
- = resolver_ret_type->target_type ();
+ struct type *resolved_type = resolver_ret_type->target_type ();
if (check_typedef (resolved_type)->code () == TYPE_CODE_FUNC)
return resolved_type;
}
diff --git a/gdb/bpf-tdep.c b/gdb/bpf-tdep.c
index 97a6d75a68b..4e8d12e97ca 100644
--- a/gdb/bpf-tdep.c
+++ b/gdb/bpf-tdep.c
@@ -36,12 +36,11 @@
#include "remote.h"
#include "gdbarch.h"
-
/* eBPF registers. */
enum bpf_regnum
{
- BPF_R0_REGNUM, /* return value */
+ BPF_R0_REGNUM, /* return value */
BPF_R1_REGNUM,
BPF_R2_REGNUM,
BPF_R3_REGNUM,
@@ -51,18 +50,17 @@ enum bpf_regnum
BPF_R7_REGNUM,
BPF_R8_REGNUM,
BPF_R9_REGNUM,
- BPF_R10_REGNUM, /* sp */
+ BPF_R10_REGNUM, /* sp */
BPF_PC_REGNUM,
};
-#define BPF_NUM_REGS (BPF_PC_REGNUM + 1)
+#define BPF_NUM_REGS (BPF_PC_REGNUM + 1)
/* Target-dependent structure in gdbarch. */
struct bpf_gdbarch_tdep : gdbarch_tdep_base
{
};
-
/* Internal debugging facilities. */
/* When this is set to non-zero debugging information will be
@@ -73,20 +71,17 @@ static unsigned int bpf_debug_flag = 0;
/* The show callback for 'show debug bpf'. */
static void
-show_bpf_debug (struct ui_file *file, int from_tty,
- struct cmd_list_element *c, const char *value)
+show_bpf_debug (struct ui_file *file, int from_tty, struct cmd_list_element *c,
+ const char *value)
{
- gdb_printf (file, _("Debugging of BPF is %s.\n"), value);
+ gdb_printf (file, _ ("Debugging of BPF is %s.\n"), value);
}
-
/* BPF registers. */
-static const char *bpf_register_names[] =
-{
- "r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7",
- "r8", "r9", "r10", "pc"
-};
+static const char *bpf_register_names[] = { "r0", "r1", "r2", "r3",
+ "r4", "r5", "r6", "r7",
+ "r8", "r9", "r10", "pc" };
/* Return the name of register REGNUM. */
@@ -128,21 +123,18 @@ bpf_gdb_print_insn (bfd_vma memaddr, disassemble_info *info)
return default_print_insn (memaddr, info);
}
-
/* Return PC of first real instruction of the function starting at
START_PC. */
static CORE_ADDR
bpf_skip_prologue (struct gdbarch *gdbarch, CORE_ADDR start_pc)
{
- gdb_printf (gdb_stdlog,
- "Skipping prologue: start_pc=%s\n",
+ gdb_printf (gdb_stdlog, "Skipping prologue: start_pc=%s\n",
paddress (gdbarch, start_pc));
/* XXX: to be completed. */
return start_pc + 0;
}
-
/* Frame unwinder.
XXX it is not clear how to unwind in eBPF, since the stack is not
@@ -154,8 +146,7 @@ bpf_skip_prologue (struct gdbarch *gdbarch, CORE_ADDR start_pc)
/* Given THIS_FRAME, return its ID. */
static void
-bpf_frame_this_id (frame_info_ptr this_frame,
- void **this_prologue_cache,
+bpf_frame_this_id (frame_info_ptr this_frame, void **this_prologue_cache,
struct frame_id *this_id)
{
/* Note that THIS_ID defaults to the outermost frame if we don't set
@@ -165,8 +156,7 @@ bpf_frame_this_id (frame_info_ptr this_frame,
/* Return the reason why we can't unwind past THIS_FRAME. */
static enum unwind_stop_reason
-bpf_frame_unwind_stop_reason (frame_info_ptr this_frame,
- void **this_cache)
+bpf_frame_unwind_stop_reason (frame_info_ptr this_frame, void **this_cache)
{
return UNWIND_OUTERMOST;
}
@@ -174,26 +164,23 @@ bpf_frame_unwind_stop_reason (frame_info_ptr this_frame,
/* Ask THIS_FRAME to unwind its register. */
static struct value *
-bpf_frame_prev_register (frame_info_ptr this_frame,
- void **this_prologue_cache, int regnum)
+bpf_frame_prev_register (frame_info_ptr this_frame, void **this_prologue_cache,
+ int regnum)
{
return frame_unwind_got_register (this_frame, regnum, regnum);
}
/* Frame unwinder machinery for BPF. */
-static const struct frame_unwind bpf_frame_unwind =
-{
- "bpf prologue",
- NORMAL_FRAME,
- bpf_frame_unwind_stop_reason,
- bpf_frame_this_id,
- bpf_frame_prev_register,
- NULL,
- default_frame_sniffer
-};
+static const struct frame_unwind bpf_frame_unwind
+ = { "bpf prologue",
+ NORMAL_FRAME,
+ bpf_frame_unwind_stop_reason,
+ bpf_frame_this_id,
+ bpf_frame_prev_register,
+ NULL,
+ default_frame_sniffer };
-
/* Breakpoints. */
/* Enum describing the different kinds of breakpoints. We currently
@@ -219,7 +206,7 @@ static const gdb_byte *
bpf_sw_breakpoint_from_kind (struct gdbarch *gdbarch, int kind, int *size)
{
static unsigned char brkpt_insn[]
- = {0x8c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
+ = { 0x8c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
switch (kind)
{
@@ -231,14 +218,13 @@ bpf_sw_breakpoint_from_kind (struct gdbarch *gdbarch, int kind, int *size)
}
}
-
/* Assuming THIS_FRAME is a dummy frame, return its frame ID. */
static struct frame_id
bpf_dummy_id (struct gdbarch *gdbarch, frame_info_ptr this_frame)
{
- CORE_ADDR sp = get_frame_register_unsigned (this_frame,
- gdbarch_sp_regnum (gdbarch));
+ CORE_ADDR sp
+ = get_frame_register_unsigned (this_frame, gdbarch_sp_regnum (gdbarch));
return frame_id_build (sp, get_frame_pc (this_frame));
}
@@ -246,8 +232,8 @@ bpf_dummy_id (struct gdbarch *gdbarch, frame_info_ptr this_frame)
static CORE_ADDR
bpf_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
- struct regcache *regcache, CORE_ADDR bp_addr,
- int nargs, struct value **args, CORE_ADDR sp,
+ struct regcache *regcache, CORE_ADDR bp_addr, int nargs,
+ struct value **args, CORE_ADDR sp,
function_call_return_method return_method,
CORE_ADDR struct_addr)
{
@@ -307,7 +293,6 @@ bpf_return_value (struct gdbarch *gdbarch, struct value *function,
return RETURN_VALUE_REGISTER_CONVENTION;
}
-
/* Initialize the current architecture based on INFO. If possible, re-use an
architecture from ARCHES, which is a list of architectures already created
during this debugging session. */
@@ -370,18 +355,17 @@ bpf_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
}
void _initialize_bpf_tdep ();
+
void
_initialize_bpf_tdep ()
{
gdbarch_register (bfd_arch_bpf, bpf_gdbarch_init);
/* Add commands 'set/show debug bpf'. */
- add_setshow_zuinteger_cmd ("bpf", class_maintenance,
- &bpf_debug_flag,
- _("Set BPF debugging."),
- _("Show BPF debugging."),
- _("Enables BPF specific debugging output."),
- NULL,
- &show_bpf_debug,
- &setdebuglist, &showdebuglist);
+ add_setshow_zuinteger_cmd ("bpf", class_maintenance, &bpf_debug_flag,
+ _ ("Set BPF debugging."),
+ _ ("Show BPF debugging."),
+ _ ("Enables BPF specific debugging output."),
+ NULL, &show_bpf_debug, &setdebuglist,
+ &showdebuglist);
}
diff --git a/gdb/break-catch-exec.c b/gdb/break-catch-exec.c
index 6cd498517af..b701d580aac 100644
--- a/gdb/break-catch-exec.c
+++ b/gdb/break-catch-exec.c
@@ -45,8 +45,7 @@ struct exec_catchpoint : public catchpoint
int remove_location (struct bp_location *,
enum remove_bp_reason reason) override;
int breakpoint_hit (const struct bp_location *bl,
- const address_space *aspace,
- CORE_ADDR bp_addr,
+ const address_space *aspace, CORE_ADDR bp_addr,
const target_waitstatus &ws) override;
enum print_stop_action print_it (const bpstat *bs) const override;
bool print_one (bp_location **) const override;
@@ -140,7 +139,7 @@ exec_catchpoint::print_one (bp_location **last_loc) const
void
exec_catchpoint::print_mention () const
{
- gdb_printf (_("Catchpoint %d (exec)"), number);
+ gdb_printf (_ ("Catchpoint %d (exec)"), number);
}
/* Implement the "print_recreate" method for exec catchpoints. */
@@ -206,21 +205,19 @@ catch_exec_command_1 (const char *arg, int from_tty,
cond_string = ep_parse_optional_if_clause (&arg);
if ((*arg != '\0') && !isspace (*arg))
- error (_("Junk at end of arguments."));
+ error (_ ("Junk at end of arguments."));
- std::unique_ptr<exec_catchpoint> c
- (new exec_catchpoint (gdbarch, temp, cond_string));
+ std::unique_ptr<exec_catchpoint> c (new exec_catchpoint (gdbarch, temp,
+ cond_string));
install_breakpoint (0, std::move (c), 1);
}
void _initialize_break_catch_exec ();
+
void
_initialize_break_catch_exec ()
{
- add_catch_command ("exec", _("Catch calls to exec."),
- catch_exec_command_1,
- NULL,
- CATCH_PERMANENT,
- CATCH_TEMPORARY);
+ add_catch_command ("exec", _ ("Catch calls to exec."), catch_exec_command_1,
+ NULL, CATCH_PERMANENT, CATCH_TEMPORARY);
}
diff --git a/gdb/break-catch-fork.c b/gdb/break-catch-fork.c
index 1b1dace99d1..95c05f49cca 100644
--- a/gdb/break-catch-fork.c
+++ b/gdb/break-catch-fork.c
@@ -34,8 +34,8 @@
struct fork_catchpoint : public catchpoint
{
- fork_catchpoint (struct gdbarch *gdbarch, bool temp,
- const char *cond_string, bool is_vfork_)
+ fork_catchpoint (struct gdbarch *gdbarch, bool temp, const char *cond_string,
+ bool is_vfork_)
: catchpoint (gdbarch, temp, cond_string),
is_vfork (is_vfork_)
{
@@ -45,8 +45,7 @@ struct fork_catchpoint : public catchpoint
int remove_location (struct bp_location *,
enum remove_bp_reason reason) override;
int breakpoint_hit (const struct bp_location *bl,
- const address_space *aspace,
- CORE_ADDR bp_addr,
+ const address_space *aspace, CORE_ADDR bp_addr,
const target_waitstatus &ws) override;
enum print_stop_action print_it (const bpstat *bs) const override;
bool print_one (bp_location **) const override;
@@ -93,9 +92,8 @@ fork_catchpoint::breakpoint_hit (const struct bp_location *bl,
CORE_ADDR bp_addr,
const target_waitstatus &ws)
{
- if (ws.kind () != (is_vfork
- ? TARGET_WAITKIND_VFORKED
- : TARGET_WAITKIND_FORKED))
+ if (ws.kind ()
+ != (is_vfork ? TARGET_WAITKIND_VFORKED : TARGET_WAITKIND_FORKED))
return 0;
forked_inferior_pid = ws.child_ptid ();
@@ -118,9 +116,8 @@ fork_catchpoint::print_it (const bpstat *bs) const
if (uiout->is_mi_like_p ())
{
uiout->field_string ("reason",
- async_reason_lookup (is_vfork
- ? EXEC_ASYNC_VFORK
- : EXEC_ASYNC_FORK));
+ async_reason_lookup (is_vfork ? EXEC_ASYNC_VFORK
+ : EXEC_ASYNC_FORK));
uiout->field_string ("disp", bpdisp_text (disposition));
}
uiout->field_signed ("bkptno", number);
@@ -169,8 +166,7 @@ fork_catchpoint::print_one (bp_location **last_loc) const
void
fork_catchpoint::print_mention () const
{
- gdb_printf (_("Catchpoint %d (%s)"), number,
- is_vfork ? "vfork" : "fork");
+ gdb_printf (_ ("Catchpoint %d (%s)"), number, is_vfork ? "vfork" : "fork");
}
/* Implement the "print_recreate" method for fork catchpoints. */
@@ -183,20 +179,22 @@ fork_catchpoint::print_recreate (struct ui_file *fp) const
}
static void
-create_fork_vfork_event_catchpoint (struct gdbarch *gdbarch,
- bool temp, const char *cond_string,
- bool is_vfork)
+create_fork_vfork_event_catchpoint (struct gdbarch *gdbarch, bool temp,
+ const char *cond_string, bool is_vfork)
{
- std::unique_ptr<fork_catchpoint> c
- (new fork_catchpoint (gdbarch, temp, cond_string, is_vfork));
+ std::unique_ptr<fork_catchpoint> c (new fork_catchpoint (gdbarch, temp,
+ cond_string,
+ is_vfork));
install_breakpoint (0, std::move (c), 1);
}
enum catch_fork_kind
{
- catch_fork_temporary, catch_vfork_temporary,
- catch_fork_permanent, catch_vfork_permanent
+ catch_fork_temporary,
+ catch_vfork_temporary,
+ catch_fork_permanent,
+ catch_vfork_permanent
};
static void
@@ -223,7 +221,7 @@ catch_fork_command_1 (const char *arg, int from_tty,
cond_string = ep_parse_optional_if_clause (&arg);
if ((*arg != '\0') && !isspace (*arg))
- error (_("Junk at end of arguments."));
+ error (_ ("Junk at end of arguments."));
/* If this target supports it, create a fork or vfork catchpoint
and enable reporting of such events. */
@@ -238,23 +236,21 @@ catch_fork_command_1 (const char *arg, int from_tty,
create_fork_vfork_event_catchpoint (gdbarch, temp, cond_string, true);
break;
default:
- error (_("unsupported or unknown fork kind; cannot catch it"));
+ error (_ ("unsupported or unknown fork kind; cannot catch it"));
break;
}
}
void _initialize_break_catch_fork ();
+
void
_initialize_break_catch_fork ()
{
- add_catch_command ("fork", _("Catch calls to fork."),
- catch_fork_command_1,
- NULL,
- (void *) (uintptr_t) catch_fork_permanent,
+ add_catch_command ("fork", _ ("Catch calls to fork."), catch_fork_command_1,
+ NULL, (void *) (uintptr_t) catch_fork_permanent,
(void *) (uintptr_t) catch_fork_temporary);
- add_catch_command ("vfork", _("Catch calls to vfork."),
- catch_fork_command_1,
- NULL,
+ add_catch_command ("vfork", _ ("Catch calls to vfork."),
+ catch_fork_command_1, NULL,
(void *) (uintptr_t) catch_vfork_permanent,
(void *) (uintptr_t) catch_vfork_temporary);
}
diff --git a/gdb/break-catch-load.c b/gdb/break-catch-load.c
index d8dab0bd091..5998825b5cb 100644
--- a/gdb/break-catch-load.c
+++ b/gdb/break-catch-load.c
@@ -36,14 +36,13 @@
struct solib_catchpoint : public catchpoint
{
solib_catchpoint (struct gdbarch *gdbarch, bool temp,
- const char *cond_string,
- bool is_load_, const char *arg)
+ const char *cond_string, bool is_load_, const char *arg)
: catchpoint (gdbarch, temp, cond_string),
is_load (is_load_),
regex (arg == nullptr ? nullptr : make_unique_xstrdup (arg)),
compiled (arg == nullptr
- ? nullptr
- : new compiled_regex (arg, REG_NOSUB, _("Invalid regexp")))
+ ? nullptr
+ : new compiled_regex (arg, REG_NOSUB, _ ("Invalid regexp")))
{
}
@@ -51,8 +50,7 @@ struct solib_catchpoint : public catchpoint
int remove_location (struct bp_location *,
enum remove_bp_reason reason) override;
int breakpoint_hit (const struct bp_location *bl,
- const address_space *aspace,
- CORE_ADDR bp_addr,
+ const address_space *aspace, CORE_ADDR bp_addr,
const target_waitstatus &ws) override;
void check_status (struct bpstat *bs) override;
enum print_stop_action print_it (const bpstat *bs) const override;
@@ -119,8 +117,7 @@ solib_catchpoint::check_status (struct bpstat *bs)
{
for (so_list *iter : current_program_space->added_solibs)
{
- if (!regex
- || compiled->exec (iter->so_name, 0, NULL, 0) == 0)
+ if (!regex || compiled->exec (iter->so_name, 0, NULL, 0) == 0)
return;
}
}
@@ -128,8 +125,7 @@ solib_catchpoint::check_status (struct bpstat *bs)
{
for (const std::string &iter : current_program_space->deleted_solibs)
{
- if (!regex
- || compiled->exec (iter.c_str (), 0, NULL, 0) == 0)
+ if (!regex || compiled->exec (iter.c_str (), 0, NULL, 0) == 0)
return;
}
}
@@ -179,18 +175,17 @@ solib_catchpoint::print_one (bp_location **locs) const
if (is_load)
{
if (regex)
- msg = string_printf (_("load of library matching %s"),
- regex.get ());
+ msg = string_printf (_ ("load of library matching %s"), regex.get ());
else
- msg = _("load of library");
+ msg = _ ("load of library");
}
else
{
if (regex)
- msg = string_printf (_("unload of library matching %s"),
- regex.get ());
+ msg
+ = string_printf (_ ("unload of library matching %s"), regex.get ());
else
- msg = _("unload of library");
+ msg = _ ("unload of library");
}
uiout->field_string ("what", msg);
@@ -203,15 +198,13 @@ solib_catchpoint::print_one (bp_location **locs) const
void
solib_catchpoint::print_mention () const
{
- gdb_printf (_("Catchpoint %d (%s)"), number,
- is_load ? "load" : "unload");
+ gdb_printf (_ ("Catchpoint %d (%s)"), number, is_load ? "load" : "unload");
}
void
solib_catchpoint::print_recreate (struct ui_file *fp) const
{
- gdb_printf (fp, "%s %s",
- disposition == disp_del ? "tcatch" : "catch",
+ gdb_printf (fp, "%s %s", disposition == disp_del ? "tcatch" : "catch",
is_load ? "load" : "unload");
if (regex)
gdb_printf (fp, " %s", regex.get ());
@@ -221,7 +214,8 @@ solib_catchpoint::print_recreate (struct ui_file *fp) const
/* See breakpoint.h. */
void
-add_solib_catchpoint (const char *arg, bool is_load, bool is_temp, bool enabled)
+add_solib_catchpoint (const char *arg, bool is_load, bool is_temp,
+ bool enabled)
{
struct gdbarch *gdbarch = get_current_arch ();
@@ -232,8 +226,8 @@ add_solib_catchpoint (const char *arg, bool is_load, bool is_temp, bool enabled)
arg = nullptr;
std::unique_ptr<solib_catchpoint> c (new solib_catchpoint (gdbarch, is_temp,
- nullptr,
- is_load, arg));
+ nullptr, is_load,
+ arg));
c->enable_state = enabled ? bp_enabled : bp_disabled;
@@ -268,21 +262,18 @@ catch_unload_command_1 (const char *arg, int from_tty,
}
void _initialize_break_catch_load ();
+
void
_initialize_break_catch_load ()
{
- add_catch_command ("load", _("Catch loads of shared libraries.\n\
+ add_catch_command ("load", _ ("Catch loads of shared libraries.\n\
Usage: catch load [REGEX]\n\
If REGEX is given, only stop for libraries matching the regular expression."),
- catch_load_command_1,
- NULL,
- CATCH_PERMANENT,
+ catch_load_command_1, NULL, CATCH_PERMANENT,
CATCH_TEMPORARY);
- add_catch_command ("unload", _("Catch unloads of shared libraries.\n\
+ add_catch_command ("unload", _ ("Catch unloads of shared libraries.\n\
Usage: catch unload [REGEX]\n\
If REGEX is given, only stop for libraries matching the regular expression."),
- catch_unload_command_1,
- NULL,
- CATCH_PERMANENT,
+ catch_unload_command_1, NULL, CATCH_PERMANENT,
CATCH_TEMPORARY);
}
diff --git a/gdb/break-catch-sig.c b/gdb/break-catch-sig.c
index 8c1fcbd69ee..09a91f52010 100644
--- a/gdb/break-catch-sig.c
+++ b/gdb/break-catch-sig.c
@@ -41,8 +41,7 @@
struct signal_catchpoint : public catchpoint
{
signal_catchpoint (struct gdbarch *gdbarch, bool temp,
- std::vector<gdb_signal> &&sigs,
- bool catch_all_)
+ std::vector<gdb_signal> &&sigs, bool catch_all_)
: catchpoint (gdbarch, temp, nullptr),
signals_to_be_caught (std::move (sigs)),
catch_all (catch_all_)
@@ -53,8 +52,7 @@ struct signal_catchpoint : public catchpoint
int remove_location (struct bp_location *,
enum remove_bp_reason reason) override;
int breakpoint_hit (const struct bp_location *bl,
- const address_space *aspace,
- CORE_ADDR bp_addr,
+ const address_space *aspace, CORE_ADDR bp_addr,
const target_waitstatus &ws) override;
enum print_stop_action print_it (const bpstat *bs) const override;
bool print_one (bp_location **) const override;
@@ -80,8 +78,6 @@ struct signal_catchpoint : public catchpoint
static unsigned int signal_catch_counts[GDB_SIGNAL_LAST];
-
-
/* A convenience wrapper for gdb_signal_to_name that returns the
integer value if the name is not known. */
@@ -96,8 +92,6 @@ signal_to_name_or_int (enum gdb_signal sig)
return result;
}
-
-
/* Implement the "insert_location" method for signal catchpoints. */
int
@@ -205,7 +199,7 @@ signal_catchpoint::print_it (const bpstat *bs) const
annotate_catchpoint (number);
maybe_print_thread_hit_breakpoint (uiout);
- gdb_printf (_("Catchpoint %d (signal %s), "), number, signal_name);
+ gdb_printf (_ ("Catchpoint %d (signal %s), "), number, signal_name);
return PRINT_SRC_AND_LOC;
}
@@ -269,9 +263,9 @@ signal_catchpoint::print_mention () const
if (!signals_to_be_caught.empty ())
{
if (signals_to_be_caught.size () > 1)
- gdb_printf (_("Catchpoint %d (signals"), number);
+ gdb_printf (_ ("Catchpoint %d (signals"), number);
else
- gdb_printf (_("Catchpoint %d (signal"), number);
+ gdb_printf (_ ("Catchpoint %d (signal"), number);
for (gdb_signal iter : signals_to_be_caught)
{
@@ -282,9 +276,9 @@ signal_catchpoint::print_mention () const
gdb_printf (")");
}
else if (catch_all)
- gdb_printf (_("Catchpoint %d (any signal)"), number);
+ gdb_printf (_ ("Catchpoint %d (any signal)"), number);
else
- gdb_printf (_("Catchpoint %d (standard signals)"), number);
+ gdb_printf (_ ("Catchpoint %d (standard signals)"), number);
}
/* Implement the "print_recreate" method for signal catchpoints. */
@@ -325,13 +319,12 @@ create_signal_catchpoint (int tempflag, std::vector<gdb_signal> &&filter,
{
struct gdbarch *gdbarch = get_current_arch ();
- std::unique_ptr<signal_catchpoint> c
- (new signal_catchpoint (gdbarch, tempflag, std::move (filter), catch_all));
+ std::unique_ptr<signal_catchpoint> c (
+ new signal_catchpoint (gdbarch, tempflag, std::move (filter), catch_all));
install_breakpoint (0, std::move (c), 1);
}
-
/* Splits the argument using space as delimiter. Returns a filter
list, which is empty if no filtering is required. */
@@ -356,7 +349,7 @@ catch_signal_split_args (const char *arg, bool *catch_all)
{
arg = skip_spaces (arg);
if (*arg != '\0' || !first)
- error (_("'all' cannot be caught with other signals"));
+ error (_ ("'all' cannot be caught with other signals"));
*catch_all = true;
gdb_assert (result.empty ());
return result;
@@ -372,7 +365,7 @@ catch_signal_split_args (const char *arg, bool *catch_all)
{
signal_number = gdb_signal_from_name (one_arg.c_str ());
if (signal_number == GDB_SIGNAL_UNKNOWN)
- error (_("Unknown signal name '%s'."), one_arg.c_str ());
+ error (_ ("Unknown signal name '%s'."), one_arg.c_str ());
}
result.push_back (signal_number);
@@ -409,10 +402,11 @@ catch_signal_command (const char *arg, int from_tty,
}
void _initialize_break_catch_sig ();
+
void
_initialize_break_catch_sig ()
{
- add_catch_command ("signal", _("\
+ add_catch_command ("signal", _ ("\
Catch signals by their names and/or numbers.\n\
Usage: catch signal [[NAME|NUMBER] [NAME|NUMBER]...|all]\n\
Arguments say which signals to catch. If no arguments\n\
@@ -420,8 +414,6 @@ are given, every \"normal\" signal will be caught.\n\
The argument \"all\" means to also catch signals used by GDB.\n\
Arguments, if given, should be one or more signal names\n\
(if your system supports that), or signal numbers."),
- catch_signal_command,
- signal_completer,
- CATCH_PERMANENT,
+ catch_signal_command, signal_completer, CATCH_PERMANENT,
CATCH_TEMPORARY);
}
diff --git a/gdb/break-catch-syscall.c b/gdb/break-catch-syscall.c
index d73f6616c97..bcf8f5f6175 100644
--- a/gdb/break-catch-syscall.c
+++ b/gdb/break-catch-syscall.c
@@ -48,8 +48,7 @@ struct syscall_catchpoint : public catchpoint
int remove_location (struct bp_location *,
enum remove_bp_reason reason) override;
int breakpoint_hit (const struct bp_location *bl,
- const address_space *aspace,
- CORE_ADDR bp_addr,
+ const address_space *aspace, CORE_ADDR bp_addr,
const target_waitstatus &ws) override;
enum print_stop_action print_it (const bpstat *bs) const override;
bool print_one (bp_location **) const override;
@@ -212,10 +211,11 @@ syscall_catchpoint::print_it (const bpstat *bs) const
uiout->text ("Catchpoint ");
if (uiout->is_mi_like_p ())
{
- uiout->field_string ("reason",
- async_reason_lookup (last.kind () == TARGET_WAITKIND_SYSCALL_ENTRY
- ? EXEC_ASYNC_SYSCALL_ENTRY
- : EXEC_ASYNC_SYSCALL_RETURN));
+ uiout->field_string (
+ "reason",
+ async_reason_lookup (last.kind () == TARGET_WAITKIND_SYSCALL_ENTRY
+ ? EXEC_ASYNC_SYSCALL_ENTRY
+ : EXEC_ASYNC_SYSCALL_RETURN));
uiout->field_string ("disp", bpdisp_text (b->disposition));
}
print_num_locno (bs, uiout);
@@ -298,9 +298,9 @@ syscall_catchpoint::print_mention () const
if (!syscalls_to_be_caught.empty ())
{
if (syscalls_to_be_caught.size () > 1)
- gdb_printf (_("Catchpoint %d (syscalls"), number);
+ gdb_printf (_ ("Catchpoint %d (syscalls"), number);
else
- gdb_printf (_("Catchpoint %d (syscall"), number);
+ gdb_printf (_ ("Catchpoint %d (syscall"), number);
for (int iter : syscalls_to_be_caught)
{
@@ -315,7 +315,7 @@ syscall_catchpoint::print_mention () const
gdb_printf (")");
}
else
- gdb_printf (_("Catchpoint %d (any syscall)"), number);
+ gdb_printf (_ ("Catchpoint %d (any syscall)"), number);
}
/* Implement the "print_recreate" method for syscall catchpoints. */
@@ -354,8 +354,8 @@ create_syscall_event_catchpoint (int tempflag, std::vector<int> &&filter)
{
struct gdbarch *gdbarch = get_current_arch ();
- std::unique_ptr<syscall_catchpoint> c
- (new syscall_catchpoint (gdbarch, tempflag, std::move (filter)));
+ std::unique_ptr<syscall_catchpoint> c (
+ new syscall_catchpoint (gdbarch, tempflag, std::move (filter)));
install_breakpoint (0, std::move (c), 1);
}
@@ -388,12 +388,11 @@ catch_syscall_split_args (const char *arg)
if (*endptr == '\0')
{
if (syscall_number < 0)
- error (_("Unknown syscall number '%d'."), syscall_number);
+ error (_ ("Unknown syscall number '%d'."), syscall_number);
get_syscall_by_number (gdbarch, syscall_number, &s);
result.push_back (s.number);
}
- else if (startswith (cur_name, "g:")
- || startswith (cur_name, "group:"))
+ else if (startswith (cur_name, "g:") || startswith (cur_name, "group:"))
{
/* We have a syscall group. Let's expand it into a syscall
list before inserting. */
@@ -403,7 +402,7 @@ catch_syscall_split_args (const char *arg)
group_name = strchr (cur_name, ':') + 1;
if (!get_syscalls_by_group (gdbarch, group_name, &result))
- error (_("Unknown syscall group '%s'."), group_name);
+ error (_ ("Unknown syscall group '%s'."), group_name);
}
else
{
@@ -413,7 +412,7 @@ catch_syscall_split_args (const char *arg)
/* Here we have to issue an error instead of a warning,
because GDB cannot do anything useful if there's no
syscall number to be caught. */
- error (_("Unknown syscall name '%s'."), cur_name);
+ error (_ ("Unknown syscall name '%s'."), cur_name);
}
}
@@ -423,7 +422,7 @@ catch_syscall_split_args (const char *arg)
/* Implement the "catch syscall" command. */
static void
-catch_syscall_command_1 (const char *arg, int from_tty,
+catch_syscall_command_1 (const char *arg, int from_tty,
struct cmd_list_element *command)
{
int tempflag;
@@ -433,7 +432,7 @@ catch_syscall_command_1 (const char *arg, int from_tty,
/* Checking if the feature if supported. */
if (gdbarch_get_syscall_number_p (gdbarch) == 0)
- error (_("The feature 'catch syscall' is not supported on \
+ error (_ ("The feature 'catch syscall' is not supported on \
this architecture yet."));
tempflag = command->context () == CATCH_TEMPORARY;
@@ -458,14 +457,12 @@ this architecture yet."));
create_syscall_event_catchpoint (tempflag, std::move (filter));
}
-
/* Returns 0 if 'bp' is NOT a syscall catchpoint,
non-zero otherwise. */
static int
is_syscall_catchpoint_enabled (struct breakpoint *bp)
{
- if (syscall_catchpoint_p (bp)
- && bp->enable_state != bp_disabled
+ if (syscall_catchpoint_p (bp) && bp->enable_state != bp_disabled
&& bp->enable_state != bp_call_disabled)
return 1;
else
@@ -487,7 +484,6 @@ catch_syscall_enabled (void)
static bool
catching_syscall_number_1 (struct breakpoint *b, int syscall_number)
{
-
if (is_syscall_catchpoint_enabled (b))
{
struct syscall_catchpoint *c = (struct syscall_catchpoint *) b;
@@ -519,8 +515,8 @@ catching_syscall_number (int syscall_number)
static void
catch_syscall_completer (struct cmd_list_element *cmd,
- completion_tracker &tracker,
- const char *text, const char *word)
+ completion_tracker &tracker, const char *text,
+ const char *word)
{
struct gdbarch *gdbarch = get_current_arch ();
gdb::unique_xmalloc_ptr<const char *> group_list;
@@ -542,8 +538,8 @@ catch_syscall_completer (struct cmd_list_element *cmd,
else
{
/* Complete with both, syscall names and groups. */
- gdb::unique_xmalloc_ptr<const char *> syscall_list
- (get_syscall_names (gdbarch));
+ gdb::unique_xmalloc_ptr<const char *> syscall_list (
+ get_syscall_names (gdbarch));
group_list.reset (get_syscall_group_names (gdbarch));
const char **group_ptr = group_list.get ();
@@ -577,20 +573,19 @@ clear_syscall_counts (struct inferior *inf)
}
void _initialize_break_catch_syscall ();
+
void
_initialize_break_catch_syscall ()
{
gdb::observers::inferior_exit.attach (clear_syscall_counts,
"break-catch-syscall");
- add_catch_command ("syscall", _("\
+ add_catch_command ("syscall", _ ("\
Catch system calls by their names, groups and/or numbers.\n\
Arguments say which system calls to catch. If no arguments are given,\n\
every system call will be caught. Arguments, if given, should be one\n\
or more system call names (if your system supports that), system call\n\
groups or system call numbers."),
- catch_syscall_command_1,
- catch_syscall_completer,
- CATCH_PERMANENT,
- CATCH_TEMPORARY);
+ catch_syscall_command_1, catch_syscall_completer,
+ CATCH_PERMANENT, CATCH_TEMPORARY);
}
diff --git a/gdb/break-catch-throw.c b/gdb/break-catch-throw.c
index ab7899e2b9c..da0111dc941 100644
--- a/gdb/break-catch-throw.c
+++ b/gdb/break-catch-throw.c
@@ -56,12 +56,10 @@ struct exception_names
/* Names of the probe points and functions on which to break. This is
indexed by exception_event_kind. */
-static const struct exception_names exception_functions[] =
-{
- { "-probe-stap libstdcxx:throw", "__cxa_throw" },
- { "-probe-stap libstdcxx:rethrow", "__cxa_rethrow" },
- { "-probe-stap libstdcxx:catch", "__cxa_begin_catch" }
-};
+static const struct exception_names exception_functions[]
+ = { { "-probe-stap libstdcxx:throw", "__cxa_throw" },
+ { "-probe-stap libstdcxx:rethrow", "__cxa_rethrow" },
+ { "-probe-stap libstdcxx:catch", "__cxa_begin_catch" } };
/* The type of an exception catchpoint. Unlike most catchpoints, this
one is implemented with code breakpoints, so it inherits struct
@@ -69,17 +67,17 @@ static const struct exception_names exception_functions[] =
struct exception_catchpoint : public code_breakpoint
{
- exception_catchpoint (struct gdbarch *gdbarch,
- bool temp, const char *cond_string_,
+ exception_catchpoint (struct gdbarch *gdbarch, bool temp,
+ const char *cond_string_,
enum exception_event_kind kind_,
std::string &&except_rx)
: code_breakpoint (gdbarch, bp_catchpoint, temp, cond_string_),
kind (kind_),
exception_rx (std::move (except_rx)),
pattern (exception_rx.empty ()
- ? nullptr
- : new compiled_regex (exception_rx.c_str (), REG_NOSUB,
- _("invalid type-matching regexp")))
+ ? nullptr
+ : new compiled_regex (exception_rx.c_str (), REG_NOSUB,
+ _ ("invalid type-matching regexp")))
{
pspace = current_program_space;
re_set ();
@@ -96,10 +94,7 @@ struct exception_catchpoint : public code_breakpoint
/* FIXME this is temporary - until ordinary breakpoints have been
converted. */
- int resources_needed (const struct bp_location *) override
- {
- return 1;
- }
+ int resources_needed (const struct bp_location *) override { return 1; }
/* The kind of exception catchpoint. */
@@ -124,8 +119,6 @@ is_exception_catchpoint (breakpoint *bp)
return dynamic_cast<exception_catchpoint *> (bp) != nullptr;
}
-
-
/* A helper function that fetches exception probe arguments. This
fills in *ARG0 (if non-NULL) and *ARG1 (which must be non-NULL).
It will throw an exception on any kind of failure. */
@@ -133,35 +126,34 @@ is_exception_catchpoint (breakpoint *bp)
static void
fetch_probe_arguments (struct value **arg0, struct value **arg1)
{
- frame_info_ptr frame = get_selected_frame (_("No frame selected"));
+ frame_info_ptr frame = get_selected_frame (_ ("No frame selected"));
CORE_ADDR pc = get_frame_pc (frame);
struct bound_probe pc_probe;
unsigned n_args;
pc_probe = find_probe_by_pc (pc);
if (pc_probe.prob == NULL)
- error (_("did not find exception probe (does libstdcxx have SDT probes?)"));
+ error (
+ _ ("did not find exception probe (does libstdcxx have SDT probes?)"));
if (pc_probe.prob->get_provider () != "libstdcxx"
|| (pc_probe.prob->get_name () != "catch"
&& pc_probe.prob->get_name () != "throw"
&& pc_probe.prob->get_name () != "rethrow"))
- error (_("not stopped at a C++ exception catchpoint"));
+ error (_ ("not stopped at a C++ exception catchpoint"));
n_args = pc_probe.prob->get_argument_count (get_frame_arch (frame));
if (n_args < 2)
- error (_("C++ exception catchpoint has too few arguments"));
+ error (_ ("C++ exception catchpoint has too few arguments"));
if (arg0 != NULL)
*arg0 = pc_probe.prob->evaluate_argument (0, frame);
*arg1 = pc_probe.prob->evaluate_argument (1, frame);
if ((arg0 != NULL && *arg0 == NULL) || *arg1 == NULL)
- error (_("error computing probe argument at c++ exception catchpoint"));
+ error (_ ("error computing probe argument at c++ exception catchpoint"));
}
-
-
/* Implement the 'check_status' method. */
void
@@ -188,9 +180,7 @@ exception_catchpoint::check_status (struct bpstat *bs)
type_name = cplus_typename_from_type_info (typeinfo_arg);
canon = cp_canonicalize_string (type_name.c_str ());
- name = (canon != nullptr
- ? canon.get ()
- : type_name.c_str ());
+ name = (canon != nullptr ? canon.get () : type_name.c_str ());
}
catch (const gdb_exception_error &e)
{
@@ -225,9 +215,8 @@ exception_catchpoint::re_set ()
catchpoint mode. */
try
{
- location_spec_up locspec
- = (new_explicit_location_spec_function
- (exception_functions[kind].function));
+ location_spec_up locspec = (new_explicit_location_spec_function (
+ exception_functions[kind].function));
sals = this->decode_location_spec (locspec.get (), filter_pspace);
}
catch (const gdb_exception_error &ex)
@@ -252,12 +241,12 @@ exception_catchpoint::print_it (const bpstat *bs) const
maybe_print_thread_hit_breakpoint (uiout);
bp_temp = disposition == disp_del;
- uiout->text (bp_temp ? "Temporary catchpoint "
- : "Catchpoint ");
+ uiout->text (bp_temp ? "Temporary catchpoint " : "Catchpoint ");
print_num_locno (bs, uiout);
- uiout->text ((kind == EX_EVENT_THROW ? " (exception thrown), "
- : (kind == EX_EVENT_CATCH ? " (exception caught), "
- : " (exception rethrown), ")));
+ uiout->text ((kind == EX_EVENT_THROW
+ ? " (exception thrown), "
+ : (kind == EX_EVENT_CATCH ? " (exception caught), "
+ : " (exception rethrown), ")));
if (uiout->is_mi_like_p ())
{
uiout->field_string ("reason",
@@ -310,7 +299,7 @@ exception_catchpoint::print_one_detail (struct ui_out *uiout) const
{
if (!exception_rx.empty ())
{
- uiout->text (_("\tmatching: "));
+ uiout->text (_ ("\tmatching: "));
uiout->field_string ("regexp", exception_rx);
uiout->text ("\n");
}
@@ -324,11 +313,12 @@ exception_catchpoint::print_mention () const
bp_temp = disposition == disp_del;
uiout->message ("%s %d %s",
- (bp_temp ? _("Temporary catchpoint ") : _("Catchpoint")),
+ (bp_temp ? _ ("Temporary catchpoint ") : _ ("Catchpoint")),
number,
(kind == EX_EVENT_THROW
- ? _("(throw)") : (kind == EX_EVENT_CATCH
- ? _("(catch)") : _("(rethrow)"))));
+ ? _ ("(throw)")
+ : (kind == EX_EVENT_CATCH ? _ ("(catch)")
+ : _ ("(rethrow)"))));
}
/* Implement the "print_recreate" method for throw and catch
@@ -372,9 +362,8 @@ handle_gnu_v3_exceptions (int tempflag, std::string &&except_rx,
{
struct gdbarch *gdbarch = get_current_arch ();
- std::unique_ptr<exception_catchpoint> cp
- (new exception_catchpoint (gdbarch, tempflag, cond_string,
- ex_event, std::move (except_rx)));
+ std::unique_ptr<exception_catchpoint> cp (new exception_catchpoint (
+ gdbarch, tempflag, cond_string, ex_event, std::move (except_rx)));
install_breakpoint (0, std::move (cp), 1);
}
@@ -421,8 +410,8 @@ extract_exception_regexp (const char **string)
/* See breakpoint.h. */
void
-catch_exception_event (enum exception_event_kind ex_event,
- const char *arg, bool tempflag, int from_tty)
+catch_exception_event (enum exception_event_kind ex_event, const char *arg,
+ bool tempflag, int from_tty)
{
const char *cond_string = NULL;
@@ -435,12 +424,11 @@ catch_exception_event (enum exception_event_kind ex_event,
cond_string = ep_parse_optional_if_clause (&arg);
if ((*arg != '\0') && !isspace (*arg))
- error (_("Junk at end of arguments."));
+ error (_ ("Junk at end of arguments."));
- if (ex_event != EX_EVENT_THROW
- && ex_event != EX_EVENT_CATCH
+ if (ex_event != EX_EVENT_THROW && ex_event != EX_EVENT_CATCH
&& ex_event != EX_EVENT_RETHROW)
- error (_("Unsupported or unknown exception event; cannot catch it"));
+ error (_ ("Unsupported or unknown exception event; cannot catch it"));
handle_gnu_v3_exceptions (tempflag, std::move (except_rx), cond_string,
ex_event, from_tty);
@@ -479,8 +467,6 @@ catch_rethrow_command (const char *arg, int from_tty,
catch_exception_event (EX_EVENT_RETHROW, arg, tempflag, from_tty);
}
-
-
/* Implement the 'make_value' method for the $_exception
internalvar. */
@@ -501,36 +487,28 @@ compute_exception (struct gdbarch *argc, struct internalvar *var, void *ignore)
/* Implementation of the '$_exception' variable. */
-static const struct internalvar_funcs exception_funcs =
-{
+static const struct internalvar_funcs exception_funcs = {
compute_exception,
NULL,
};
-
-
void _initialize_break_catch_throw ();
+
void
_initialize_break_catch_throw ()
{
/* Add catch and tcatch sub-commands. */
- add_catch_command ("catch", _("\
+ add_catch_command ("catch", _ ("\
Catch an exception, when caught."),
- catch_catch_command,
- NULL,
- CATCH_PERMANENT,
+ catch_catch_command, NULL, CATCH_PERMANENT,
CATCH_TEMPORARY);
- add_catch_command ("throw", _("\
+ add_catch_command ("throw", _ ("\
Catch an exception, when thrown."),
- catch_throw_command,
- NULL,
- CATCH_PERMANENT,
+ catch_throw_command, NULL, CATCH_PERMANENT,
CATCH_TEMPORARY);
- add_catch_command ("rethrow", _("\
+ add_catch_command ("rethrow", _ ("\
Catch an exception, when rethrown."),
- catch_rethrow_command,
- NULL,
- CATCH_PERMANENT,
+ catch_rethrow_command, NULL, CATCH_PERMANENT,
CATCH_TEMPORARY);
create_internalvar_type_lazy ("_exception", &exception_funcs, NULL);
diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c
index 1c7ae58a23b..215eaf0d73f 100644
--- a/gdb/breakpoint.c
+++ b/gdb/breakpoint.c
@@ -88,20 +88,17 @@ static void map_breakpoint_numbers (const char *,
gdb::function_view<void (breakpoint *)>);
static void
- create_sals_from_location_spec_default (location_spec *locspec,
- linespec_result *canonical);
+create_sals_from_location_spec_default (location_spec *locspec,
+ linespec_result *canonical);
-static void create_breakpoints_sal (struct gdbarch *,
- struct linespec_result *,
- gdb::unique_xmalloc_ptr<char>,
+static void create_breakpoints_sal (struct gdbarch *, struct linespec_result *,
gdb::unique_xmalloc_ptr<char>,
- enum bptype,
- enum bpdisp, int, int,
- int,
- int, int, int, unsigned);
+ gdb::unique_xmalloc_ptr<char>, enum bptype,
+ enum bpdisp, int, int, int, int, int, int,
+ unsigned);
-static int can_use_hardware_watchpoint
- (const std::vector<value_ref_ptr> &vals);
+static int
+can_use_hardware_watchpoint (const std::vector<value_ref_ptr> &vals);
static void mention (const breakpoint *);
@@ -110,9 +107,8 @@ static breakpoint *add_to_breakpoint_chain (std::unique_ptr<breakpoint> &&b);
static breakpoint *add_to_breakpoint_chain (std::unique_ptr<breakpoint> &&b);
static struct breakpoint *
- momentary_breakpoint_from_master (struct breakpoint *orig,
- enum bptype type,
- int loc_enabled, int thread);
+momentary_breakpoint_from_master (struct breakpoint *orig, enum bptype type,
+ int loc_enabled, int thread);
static void breakpoint_adjustment_warning (CORE_ADDR, CORE_ADDR, int, bool);
@@ -128,9 +124,8 @@ static bool breakpoint_locations_match (const struct bp_location *loc1,
const struct bp_location *loc2,
bool sw_hw_bps_match = false);
-static bool breakpoint_location_address_match (struct bp_location *bl,
- const struct address_space *aspace,
- CORE_ADDR addr);
+static bool breakpoint_location_address_match (
+ struct bp_location *bl, const struct address_space *aspace, CORE_ADDR addr);
static bool breakpoint_location_address_range_overlap (struct bp_location *,
const address_space *,
@@ -154,10 +149,9 @@ static void enable_breakpoint_disp (struct breakpoint *, enum bpdisp,
static void decref_bp_location (struct bp_location **loc);
-static std::vector<symtab_and_line> bkpt_probe_decode_location_spec
- (struct breakpoint *b,
- location_spec *locspec,
- struct program_space *search_pspace);
+static std::vector<symtab_and_line>
+bkpt_probe_decode_location_spec (struct breakpoint *b, location_spec *locspec,
+ struct program_space *search_pspace);
static bool bl_address_is_meaningful (bp_location *loc);
@@ -215,29 +209,25 @@ static bool is_masked_watchpoint (const struct breakpoint *b);
static bool strace_marker_p (struct breakpoint *b);
-static void bkpt_probe_create_sals_from_location_spec
- (location_spec *locspec,
- struct linespec_result *canonical);
-static void tracepoint_probe_create_sals_from_location_spec
- (location_spec *locspec,
- struct linespec_result *canonical);
+static void
+bkpt_probe_create_sals_from_location_spec (location_spec *locspec,
+ struct linespec_result *canonical);
+static void tracepoint_probe_create_sals_from_location_spec (
+ location_spec *locspec, struct linespec_result *canonical);
-const struct breakpoint_ops code_breakpoint_ops =
-{
+const struct breakpoint_ops code_breakpoint_ops = {
create_sals_from_location_spec_default,
create_breakpoints_sal,
};
/* Breakpoints set on probes. */
-static const struct breakpoint_ops bkpt_probe_breakpoint_ops =
-{
+static const struct breakpoint_ops bkpt_probe_breakpoint_ops = {
bkpt_probe_create_sals_from_location_spec,
create_breakpoints_sal,
};
/* Tracepoints set on probes. */
-static const struct breakpoint_ops tracepoint_probe_breakpoint_ops =
-{
+static const struct breakpoint_ops tracepoint_probe_breakpoint_ops = {
tracepoint_probe_create_sals_from_location_spec,
create_breakpoints_sal,
};
@@ -245,17 +235,11 @@ static const struct breakpoint_ops tracepoint_probe_breakpoint_ops =
/* Implementation of abstract dtors. These must exist to satisfy the
linker. */
-breakpoint::~breakpoint ()
-{
-}
+breakpoint::~breakpoint () {}
-code_breakpoint::~code_breakpoint ()
-{
-}
+code_breakpoint::~code_breakpoint () {}
-catchpoint::~catchpoint ()
-{
-}
+catchpoint::~catchpoint () {}
/* The structure to be used in regular breakpoints. */
struct ordinary_breakpoint : public code_breakpoint
@@ -274,8 +258,8 @@ struct ordinary_breakpoint : public code_breakpoint
breakpoints", but not "info breakpoints". */
struct internal_breakpoint : public code_breakpoint
{
- internal_breakpoint (struct gdbarch *gdbarch,
- enum bptype type, CORE_ADDR address)
+ internal_breakpoint (struct gdbarch *gdbarch, enum bptype type,
+ CORE_ADDR address)
: code_breakpoint (gdbarch, type)
{
symtab_and_line sal;
@@ -304,8 +288,7 @@ struct momentary_breakpoint : public code_breakpoint
{
momentary_breakpoint (struct gdbarch *gdbarch_, enum bptype bptype,
program_space *pspace_,
- const struct frame_id &frame_id_,
- int thread_)
+ const struct frame_id &frame_id_, int thread_)
: code_breakpoint (gdbarch_, bptype)
{
/* If FRAME_ID is valid, it should be a real frame, not an inlined
@@ -335,8 +318,7 @@ struct dprintf_breakpoint : public ordinary_breakpoint
void re_set () override;
int breakpoint_hit (const struct bp_location *bl,
- const address_space *aspace,
- CORE_ADDR bp_addr,
+ const address_space *aspace, CORE_ADDR bp_addr,
const target_waitstatus &ws) override;
void print_recreate (struct ui_file *fp) const override;
void after_condition_true (struct bpstat *bs) override;
@@ -346,8 +328,7 @@ struct dprintf_breakpoint : public ordinary_breakpoint
struct ranged_breakpoint : public ordinary_breakpoint
{
explicit ranged_breakpoint (struct gdbarch *gdbarch,
- const symtab_and_line &sal_start,
- int length,
+ const symtab_and_line &sal_start, int length,
location_spec_up start_locspec,
location_spec_up end_locspec)
: ordinary_breakpoint (gdbarch, bp_hardware_breakpoint)
@@ -362,8 +343,7 @@ struct ranged_breakpoint : public ordinary_breakpoint
}
int breakpoint_hit (const struct bp_location *bl,
- const address_space *aspace,
- CORE_ADDR bp_addr,
+ const address_space *aspace, CORE_ADDR bp_addr,
const target_waitstatus &ws) override;
int resources_needed (const struct bp_location *) override;
enum print_stop_action print_it (const bpstat *bs) const override;
@@ -378,9 +358,9 @@ struct static_marker_tracepoint : public tracepoint
{
using tracepoint::tracepoint;
- std::vector<symtab_and_line> decode_location_spec
- (struct location_spec *locspec,
- struct program_space *search_pspace) override;
+ std::vector<symtab_and_line>
+ decode_location_spec (struct location_spec *locspec,
+ struct program_space *search_pspace) override;
};
/* The style in which to perform a dynamic printf. This is a user
@@ -393,12 +373,8 @@ struct static_marker_tracepoint : public tracepoint
static const char dprintf_style_gdb[] = "gdb";
static const char dprintf_style_call[] = "call";
static const char dprintf_style_agent[] = "agent";
-static const char *const dprintf_style_enums[] = {
- dprintf_style_gdb,
- dprintf_style_call,
- dprintf_style_agent,
- NULL
-};
+static const char *const dprintf_style_enums[]
+ = { dprintf_style_gdb, dprintf_style_call, dprintf_style_agent, NULL };
static const char *dprintf_style = dprintf_style_gdb;
/* The function to use for dynamic printf if the preferred style is to
@@ -439,7 +415,7 @@ bpdisp_text (enum bpdisp disp)
/* NOTE: the following values are a part of MI protocol and
represent values of 'disp' field returned when inferior stops at
a breakpoint. */
- static const char * const bpdisps[] = {"del", "dstp", "dis", "keep"};
+ static const char *const bpdisps[] = { "del", "dstp", "dis", "keep" };
return bpdisps[(int) disp];
}
@@ -451,12 +427,11 @@ static int can_use_hw_watchpoints;
static void
show_can_use_hw_watchpoints (struct ui_file *file, int from_tty,
- struct cmd_list_element *c,
- const char *value)
+ struct cmd_list_element *c, const char *value)
{
gdb_printf (file,
- _("Debugger's willingness to use "
- "watchpoint hardware is %s.\n"),
+ _ ("Debugger's willingness to use "
+ "watchpoint hardware is %s.\n"),
value);
}
@@ -465,14 +440,14 @@ show_can_use_hw_watchpoints (struct ui_file *file, int from_tty,
for unrecognized breakpoint locations.
If AUTO_BOOLEAN_AUTO, gdb will query when breakpoints are unrecognized. */
static enum auto_boolean pending_break_support;
+
static void
show_pending_break_support (struct ui_file *file, int from_tty,
- struct cmd_list_element *c,
- const char *value)
+ struct cmd_list_element *c, const char *value)
{
gdb_printf (file,
- _("Debugger's behavior regarding "
- "pending breakpoints is %s.\n"),
+ _ ("Debugger's behavior regarding "
+ "pending breakpoints is %s.\n"),
value);
}
@@ -481,13 +456,13 @@ show_pending_break_support (struct ui_file *file, int from_tty,
If false, gdb will warn about such breakpoints, but won't automatically
use hardware breakpoints. */
static bool automatic_hardware_breakpoints;
+
static void
show_automatic_hardware_breakpoints (struct ui_file *file, int from_tty,
struct cmd_list_element *c,
const char *value)
{
- gdb_printf (file,
- _("Automatic usage of hardware breakpoints is %s.\n"),
+ gdb_printf (file, _ ("Automatic usage of hardware breakpoints is %s.\n"),
value);
}
@@ -502,10 +477,9 @@ static bool always_inserted_mode = false;
static void
show_always_inserted_mode (struct ui_file *file, int from_tty,
- struct cmd_list_element *c, const char *value)
+ struct cmd_list_element *c, const char *value)
{
- gdb_printf (file, _("Always inserted breakpoint mode is %s.\n"),
- value);
+ gdb_printf (file, _ ("Always inserted breakpoint mode is %s.\n"), value);
}
/* See breakpoint.h. */
@@ -549,12 +523,9 @@ static const char condition_evaluation_both[] = "host or target";
static const char condition_evaluation_auto[] = "auto";
static const char condition_evaluation_host[] = "host";
static const char condition_evaluation_target[] = "target";
-static const char *const condition_evaluation_enums[] = {
- condition_evaluation_auto,
- condition_evaluation_host,
- condition_evaluation_target,
- NULL
-};
+static const char *const condition_evaluation_enums[]
+ = { condition_evaluation_auto, condition_evaluation_host,
+ condition_evaluation_target, NULL };
/* Global that holds the current mode for breakpoint condition evaluation. */
static const char *condition_evaluation_mode_1 = condition_evaluation_auto;
@@ -614,10 +585,8 @@ bool target_exact_watchpoints = false;
ALL_BREAKPOINTS_SAFE does so even if the statement deletes the
current breakpoint. */
-#define ALL_BREAKPOINTS_SAFE(B,TMP) \
- for (B = breakpoint_chain; \
- B ? (TMP=B->next, 1): 0; \
- B = TMP)
+#define ALL_BREAKPOINTS_SAFE(B, TMP) \
+ for (B = breakpoint_chain; B ? (TMP = B->next, 1) : 0; B = TMP)
/* Chains of all breakpoints defined. */
@@ -670,26 +639,29 @@ struct bp_locations_at_addr_range
struct compare
{
bool operator() (const bp_location *loc, CORE_ADDR addr_) const
- { return loc->address < addr_; }
+ {
+ return loc->address < addr_;
+ }
bool operator() (CORE_ADDR addr_, const bp_location *loc) const
- { return addr_ < loc->address; }
+ {
+ return addr_ < loc->address;
+ }
};
- auto it_pair = std::equal_range (bp_locations.begin (), bp_locations.end (),
- addr, compare ());
+ auto it_pair = std::equal_range (bp_locations.begin (),
+ bp_locations.end (), addr, compare ());
m_begin = it_pair.first;
m_end = it_pair.second;
}
- iterator begin () const
- { return m_begin; }
+ iterator begin () const { return m_begin; }
- iterator end () const
- { return m_end; }
+ iterator end () const { return m_end; }
private:
+
iterator m_begin;
iterator m_end;
};
@@ -803,7 +775,6 @@ clear_breakpoint_hit_counts (void)
b->hit_count = 0;
}
-
/* Return the breakpoint with the specified number, or NULL
if the number does not refer to an existing breakpoint. */
@@ -813,7 +784,7 @@ get_breakpoint (int num)
for (breakpoint *b : all_breakpoints ())
if (b->number == num)
return b;
-
+
return nullptr;
}
@@ -830,8 +801,6 @@ has_multiple_locations (int num)
return false;
}
-
-
/* Mark locations as "conditions have changed" in case the target supports
evaluating conditions on its side. */
@@ -887,8 +856,8 @@ set_condition_evaluation_mode (const char *args, int from_tty,
&& !target_supports_evaluation_of_breakpoint_conditions ())
{
condition_evaluation_mode_1 = condition_evaluation_mode;
- warning (_("Target does not support breakpoint condition evaluation.\n"
- "Using host evaluation mode instead."));
+ warning (_ ("Target does not support breakpoint condition evaluation.\n"
+ "Using host evaluation mode instead."));
return;
}
@@ -942,12 +911,11 @@ show_condition_evaluation_mode (struct ui_file *file, int from_tty,
{
if (condition_evaluation_mode == condition_evaluation_auto)
gdb_printf (file,
- _("Breakpoint condition evaluation "
- "mode is %s (currently %s).\n"),
- value,
- breakpoint_condition_evaluation_mode ());
+ _ ("Breakpoint condition evaluation "
+ "mode is %s (currently %s).\n"),
+ value, breakpoint_condition_evaluation_mode ());
else
- gdb_printf (file, _("Breakpoint condition evaluation mode is %s.\n"),
+ gdb_printf (file, _ ("Breakpoint condition evaluation mode is %s.\n"),
value);
}
@@ -971,8 +939,8 @@ set_breakpoint_location_condition (const char *cond_string, bp_location *loc,
{
loc->cond = std::move (new_exp);
if (loc->disabled_by_cond && loc->enabled)
- gdb_printf (_("Breakpoint %d's condition is now valid at "
- "location %d, enabling.\n"),
+ gdb_printf (_ ("Breakpoint %d's condition is now valid at "
+ "location %d, enabling.\n"),
bp_num, loc_num);
loc->disabled_by_cond = false;
@@ -987,23 +955,25 @@ set_breakpoint_location_condition (const char *cond_string, bp_location *loc,
time using the "break ... if ..." command, and non-zero if
already defined. */
if (bp_num != 0)
- warning (_("failed to validate condition at location %d.%d, "
- "disabling:\n %s"), bp_num, loc_num, e.what ());
+ warning (_ ("failed to validate condition at location %d.%d, "
+ "disabling:\n %s"),
+ bp_num, loc_num, e.what ());
else
- warning (_("failed to validate condition at location %d, "
- "disabling:\n %s"), loc_num, e.what ());
+ warning (_ ("failed to validate condition at location %d, "
+ "disabling:\n %s"),
+ loc_num, e.what ());
}
loc->disabled_by_cond = true;
}
if (has_junk)
- error (_("Garbage '%s' follows condition"), cond_string);
+ error (_ ("Garbage '%s' follows condition"), cond_string);
}
void
-set_breakpoint_condition (struct breakpoint *b, const char *exp,
- int from_tty, bool force)
+set_breakpoint_condition (struct breakpoint *b, const char *exp, int from_tty,
+ bool force)
{
if (*exp == 0)
{
@@ -1018,8 +988,8 @@ set_breakpoint_condition (struct breakpoint *b, const char *exp,
{
loc->cond.reset ();
if (loc->disabled_by_cond && loc->enabled)
- gdb_printf (_("Breakpoint %d's condition is now valid at "
- "location %d, enabling.\n"),
+ gdb_printf (_ ("Breakpoint %d's condition is now valid at "
+ "location %d, enabling.\n"),
b->number, loc_num);
loc->disabled_by_cond = false;
loc_num++;
@@ -1031,7 +1001,7 @@ set_breakpoint_condition (struct breakpoint *b, const char *exp,
}
if (from_tty)
- gdb_printf (_("Breakpoint %d now unconditional.\n"), b->number);
+ gdb_printf (_ ("Breakpoint %d now unconditional.\n"), b->number);
}
else
{
@@ -1041,7 +1011,7 @@ set_breakpoint_condition (struct breakpoint *b, const char *exp,
const char *arg = exp;
expression_up new_exp = parse_exp_1 (&arg, 0, 0, 0, &tracker);
if (*arg != 0)
- error (_("Junk at end of expression"));
+ error (_ ("Junk at end of expression"));
watchpoint *w = gdb::checked_static_cast<watchpoint *> (b);
w->cond_exp = std::move (new_exp);
w->cond_exp_valid_block = tracker.block ();
@@ -1061,10 +1031,10 @@ set_breakpoint_condition (struct breakpoint *b, const char *exp,
try
{
const char *arg = exp;
- parse_exp_1 (&arg, loc->address,
- block_for_pc (loc->address), 0);
+ parse_exp_1 (&arg, loc->address, block_for_pc (loc->address),
+ 0);
if (*arg != 0)
- error (_("Junk at end of expression"));
+ error (_ ("Junk at end of expression"));
break;
}
catch (const gdb_exception_error &e)
@@ -1099,8 +1069,7 @@ set_breakpoint_condition (struct breakpoint *b, const char *exp,
/* See breakpoint.h. */
void
-set_breakpoint_condition (int bpnum, const char *exp, int from_tty,
- bool force)
+set_breakpoint_condition (int bpnum, const char *exp, int from_tty, bool force)
{
for (breakpoint *b : all_breakpoints ())
if (b->number == bpnum)
@@ -1113,8 +1082,8 @@ set_breakpoint_condition (int bpnum, const char *exp, int from_tty,
if (extlang != NULL)
{
- error (_("Only one stop condition allowed. There is currently"
- " a %s stop condition defined for this breakpoint."),
+ error (_ ("Only one stop condition allowed. There is currently"
+ " a %s stop condition defined for this breakpoint."),
ext_lang_capitalized_name (extlang));
}
set_breakpoint_condition (b, exp, from_tty, force);
@@ -1125,7 +1094,7 @@ set_breakpoint_condition (int bpnum, const char *exp, int from_tty,
return;
}
- error (_("No breakpoint number %d."), bpnum);
+ error (_ ("No breakpoint number %d."), bpnum);
}
/* The options for the "condition" command. */
@@ -1141,7 +1110,7 @@ static const gdb::option::option_def condition_command_option_defs[] = {
gdb::option::flag_option_def<condition_command_opts> {
"force",
[] (condition_command_opts *opts) { return &opts->force_condition; },
- N_("Set the condition even if it is invalid for all current locations."),
+ N_ ("Set the condition even if it is invalid for all current locations."),
},
};
@@ -1152,21 +1121,20 @@ static const gdb::option::option_def condition_command_option_defs[] = {
static inline gdb::option::option_def_group
make_condition_command_options_def_group (condition_command_opts *cc_opts)
{
- return {{condition_command_option_defs}, cc_opts};
+ return { { condition_command_option_defs }, cc_opts };
}
/* Completion for the "condition" command. */
static void
-condition_completer (struct cmd_list_element *cmd,
- completion_tracker &tracker,
+condition_completer (struct cmd_list_element *cmd, completion_tracker &tracker,
const char *text, const char * /*word*/)
{
bool has_no_arguments = (*text == '\0');
condition_command_opts cc_opts;
const auto group = make_condition_command_options_def_group (&cc_opts);
- if (gdb::option::complete_options
- (tracker, &text, gdb::option::PROCESS_OPTIONS_UNKNOWN_IS_ERROR, group))
+ if (gdb::option::complete_options (
+ tracker, &text, gdb::option::PROCESS_OPTIONS_UNKNOWN_IS_ERROR, group))
return;
text = skip_spaces (text);
@@ -1224,19 +1192,20 @@ condition_command (const char *arg, int from_tty)
int bnum;
if (arg == 0)
- error_no_arg (_("breakpoint number"));
+ error_no_arg (_ ("breakpoint number"));
p = arg;
/* Check if the "-force" flag was passed. */
condition_command_opts cc_opts;
const auto group = make_condition_command_options_def_group (&cc_opts);
- gdb::option::process_options
- (&p, gdb::option::PROCESS_OPTIONS_UNKNOWN_IS_ERROR, group);
+ gdb::option::process_options (&p,
+ gdb::option::PROCESS_OPTIONS_UNKNOWN_IS_ERROR,
+ group);
bnum = get_number (&p);
if (bnum == 0)
- error (_("Bad breakpoint argument: '%s'"), arg);
+ error (_ ("Bad breakpoint argument: '%s'"), arg);
set_breakpoint_condition (bnum, p, from_tty, cc_opts.force_condition);
}
@@ -1253,8 +1222,8 @@ check_no_tracepoint_commands (struct command_line *commands)
for (c = commands; c; c = c->next)
{
if (c->control_type == while_stepping_control)
- error (_("The 'while-stepping' command can "
- "only be used for tracepoints"));
+ error (_ ("The 'while-stepping' command can "
+ "only be used for tracepoints"));
check_no_tracepoint_commands (c->body_list_0.get ());
check_no_tracepoint_commands (c->body_list_1.get ());
@@ -1263,10 +1232,10 @@ check_no_tracepoint_commands (struct command_line *commands)
lines and also empty lines. So, we only need to check for
command directly. */
if (strstr (c->line, "collect ") == c->line)
- error (_("The 'collect' command can only be used for tracepoints"));
+ error (_ ("The 'collect' command can only be used for tracepoints"));
if (strstr (c->line, "teval ") == c->line)
- error (_("The 'teval' command can only be used for tracepoints"));
+ error (_ ("The 'teval' command can only be used for tracepoints"));
}
}
@@ -1282,8 +1251,7 @@ struct longjmp_breakpoint : public momentary_breakpoint
static bool
is_tracepoint_type (bptype type)
{
- return (type == bp_tracepoint
- || type == bp_fast_tracepoint
+ return (type == bp_tracepoint || type == bp_fast_tracepoint
|| type == bp_static_tracepoint
|| type == bp_static_marker_tracepoint);
}
@@ -1301,8 +1269,7 @@ is_tracepoint (const struct breakpoint *b)
template<typename... Arg>
static std::unique_ptr<code_breakpoint>
-new_breakpoint_from_type (struct gdbarch *gdbarch, bptype type,
- Arg&&... args)
+new_breakpoint_from_type (struct gdbarch *gdbarch, bptype type, Arg &&...args)
{
code_breakpoint *b;
@@ -1310,15 +1277,13 @@ new_breakpoint_from_type (struct gdbarch *gdbarch, bptype type,
{
case bp_breakpoint:
case bp_hardware_breakpoint:
- b = new ordinary_breakpoint (gdbarch, type,
- std::forward<Arg> (args)...);
+ b = new ordinary_breakpoint (gdbarch, type, std::forward<Arg> (args)...);
break;
case bp_fast_tracepoint:
case bp_static_tracepoint:
case bp_tracepoint:
- b = new tracepoint (gdbarch, type,
- std::forward<Arg> (args)...);
+ b = new tracepoint (gdbarch, type, std::forward<Arg> (args)...);
break;
case bp_static_marker_tracepoint:
@@ -1327,8 +1292,7 @@ new_breakpoint_from_type (struct gdbarch *gdbarch, bptype type,
break;
case bp_dprintf:
- b = new dprintf_breakpoint (gdbarch, type,
- std::forward<Arg> (args)...);
+ b = new dprintf_breakpoint (gdbarch, type, std::forward<Arg> (args)...);
break;
default:
@@ -1372,16 +1336,16 @@ validate_commands_for_breakpoint (struct breakpoint *b,
if (c->control_type == while_stepping_control)
{
if (b->type == bp_fast_tracepoint)
- error (_("The 'while-stepping' command "
- "cannot be used for fast tracepoint"));
+ error (_ ("The 'while-stepping' command "
+ "cannot be used for fast tracepoint"));
else if (b->type == bp_static_tracepoint
|| b->type == bp_static_marker_tracepoint)
- error (_("The 'while-stepping' command "
- "cannot be used for static tracepoint"));
+ error (_ ("The 'while-stepping' command "
+ "cannot be used for static tracepoint"));
if (while_stepping)
- error (_("The 'while-stepping' command "
- "can be used only once"));
+ error (_ ("The 'while-stepping' command "
+ "can be used only once"));
else
while_stepping = c;
}
@@ -1397,7 +1361,7 @@ validate_commands_for_breakpoint (struct breakpoint *b,
for (; c2; c2 = c2->next)
{
if (c2->control_type == while_stepping_control)
- error (_("The 'while-stepping' command cannot be nested"));
+ error (_ ("The 'while-stepping' command cannot be nested"));
}
}
}
@@ -1431,8 +1395,7 @@ static_tracepoints_here (CORE_ADDR addr)
validate that only allowed commands are included. */
void
-breakpoint_set_commands (struct breakpoint *b,
- counted_command_line &&commands)
+breakpoint_set_commands (struct breakpoint *b, counted_command_line &&commands)
{
validate_commands_for_breakpoint (b, commands.get ());
@@ -1512,43 +1475,39 @@ commands_command_1 (const char *arg, int from_tty,
}
arg = new_arg.c_str ();
- map_breakpoint_numbers
- (arg, [&] (breakpoint *b)
- {
- if (!cmd_read)
- {
- gdb_assert (cmd == NULL);
- if (control != NULL)
- cmd = control->body_list_0;
- else
- {
- std::string str
- = string_printf (_("Type commands for breakpoint(s) "
- "%s, one per line."),
- arg);
-
- auto do_validate = [=] (const char *line)
- {
- validate_actionline (line, b);
- };
- gdb::function_view<void (const char *)> validator;
- if (is_tracepoint (b))
- validator = do_validate;
-
- cmd = read_command_lines (str.c_str (), from_tty, 1, validator);
- }
- cmd_read = true;
- }
-
- /* If a breakpoint was on the list more than once, we don't need to
+ map_breakpoint_numbers (arg, [&] (breakpoint *b) {
+ if (!cmd_read)
+ {
+ gdb_assert (cmd == NULL);
+ if (control != NULL)
+ cmd = control->body_list_0;
+ else
+ {
+ std::string str
+ = string_printf (_ ("Type commands for breakpoint(s) "
+ "%s, one per line."),
+ arg);
+
+ auto do_validate
+ = [=] (const char *line) { validate_actionline (line, b); };
+ gdb::function_view<void (const char *)> validator;
+ if (is_tracepoint (b))
+ validator = do_validate;
+
+ cmd = read_command_lines (str.c_str (), from_tty, 1, validator);
+ }
+ cmd_read = true;
+ }
+
+ /* If a breakpoint was on the list more than once, we don't need to
do anything. */
- if (b->commands != cmd)
- {
- validate_commands_for_breakpoint (b, cmd.get ());
- b->commands = cmd;
- gdb::observers::breakpoint_modified.notify (b);
- }
- });
+ if (b->commands != cmd)
+ {
+ validate_commands_for_breakpoint (b, cmd.get ());
+ b->commands = cmd;
+ gdb::observers::breakpoint_modified.notify (b);
+ }
+ });
}
static void
@@ -1594,9 +1553,8 @@ bp_location_has_shadow (struct bp_location *bl)
static void
one_breakpoint_xfer_memory (gdb_byte *readbuf, gdb_byte *writebuf,
- const gdb_byte *writebuf_org,
- ULONGEST memaddr, LONGEST len,
- struct bp_target_info *target_info,
+ const gdb_byte *writebuf_org, ULONGEST memaddr,
+ LONGEST len, struct bp_target_info *target_info,
struct gdbarch *gdbarch)
{
/* Now do full processing of the found relevant range of elements. */
@@ -1698,8 +1656,8 @@ one_breakpoint_xfer_memory (gdb_byte *readbuf, gdb_byte *writebuf,
void
breakpoint_xfer_memory (gdb_byte *readbuf, gdb_byte *writebuf,
- const gdb_byte *writebuf_org,
- ULONGEST memaddr, LONGEST len)
+ const gdb_byte *writebuf_org, ULONGEST memaddr,
+ LONGEST len)
{
/* Left boundary, right boundary and median element of our binary
search. */
@@ -1761,7 +1719,7 @@ breakpoint_xfer_memory (gdb_byte *readbuf, gdb_byte *writebuf,
/* bp_location array has BL->OWNER always non-NULL. */
if (bl->owner->type == bp_none)
- warning (_("reading through apparently deleted breakpoint #%d?"),
+ warning (_ ("reading through apparently deleted breakpoint #%d?"),
bl->owner->number);
/* Performance optimization: any further element can no longer affect BUF
@@ -1776,8 +1734,8 @@ breakpoint_xfer_memory (gdb_byte *readbuf, gdb_byte *writebuf,
if (!bp_location_has_shadow (bl))
continue;
- one_breakpoint_xfer_memory (readbuf, writebuf, writebuf_org,
- memaddr, len, &bl->target_info, bl->gdbarch);
+ one_breakpoint_xfer_memory (readbuf, writebuf, writebuf_org, memaddr,
+ len, &bl->target_info, bl->gdbarch);
}
}
@@ -1786,8 +1744,7 @@ breakpoint_xfer_memory (gdb_byte *readbuf, gdb_byte *writebuf,
bool
is_breakpoint (const struct breakpoint *bpt)
{
- return (bpt->type == bp_breakpoint
- || bpt->type == bp_hardware_breakpoint
+ return (bpt->type == bp_breakpoint || bpt->type == bp_hardware_breakpoint
|| bpt->type == bp_dprintf);
}
@@ -1806,8 +1763,7 @@ is_hardware_watchpoint (const struct breakpoint *bpt)
bool
is_watchpoint (const struct breakpoint *bpt)
{
- return (is_hardware_watchpoint (bpt)
- || bpt->type == bp_watchpoint);
+ return (is_hardware_watchpoint (bpt) || bpt->type == bp_watchpoint);
}
/* Returns true if the current thread and its running state are safe
@@ -1849,7 +1805,8 @@ watchpoint_del_at_next_stop (struct watchpoint *w)
watchpoint W. */
static struct value *
-extract_bitfield_from_watchpoint_value (struct watchpoint *w, struct value *val)
+extract_bitfield_from_watchpoint_value (struct watchpoint *w,
+ struct value *val)
{
struct value *bit_val;
@@ -1858,12 +1815,9 @@ extract_bitfield_from_watchpoint_value (struct watchpoint *w, struct value *val)
bit_val = allocate_value (value_type (val));
- unpack_value_bitfield (bit_val,
- w->val_bitpos,
- w->val_bitsize,
+ unpack_value_bitfield (bit_val, w->val_bitpos, w->val_bitsize,
value_contents_for_printing (val).data (),
- value_offset (val),
- val);
+ value_offset (val), val);
return bit_val;
}
@@ -1873,8 +1827,7 @@ extract_bitfield_from_watchpoint_value (struct watchpoint *w, struct value *val)
stops. */
static void
-add_dummy_location (struct breakpoint *b,
- struct program_space *pspace)
+add_dummy_location (struct breakpoint *b, struct program_space *pspace)
{
gdb_assert (b->loc == NULL);
@@ -1989,9 +1942,8 @@ update_watchpoint (struct watchpoint *b, bool reparse)
const char *s;
b->exp.reset ();
- s = (b->exp_string_reparse
- ? b->exp_string_reparse.get ()
- : b->exp_string.get ());
+ s = (b->exp_string_reparse ? b->exp_string_reparse.get ()
+ : b->exp_string.get ());
b->exp = parse_exp_1 (&s, 0, b->exp_valid_block, 0);
/* If the meaning of expression itself changed, the old value is
no longer relevant. We don't want to report a watchpoint hit
@@ -2027,8 +1979,8 @@ update_watchpoint (struct watchpoint *b, bool reparse)
if (b->works_in_software_mode ())
b->type = bp_watchpoint;
else
- error (_("Can't set read/access watchpoint when "
- "hardware watchpoints are disabled."));
+ error (_ ("Can't set read/access watchpoint when "
+ "hardware watchpoints are disabled."));
}
}
else if (within_current_scope && b->exp)
@@ -2068,7 +2020,7 @@ update_watchpoint (struct watchpoint *b, bool reparse)
still lazy, that means an error occurred reading it;
watch it anyway in case it becomes readable. */
if (VALUE_LVAL (v) == lval_memory
- && (v == val_chain[0] || ! value_lazy (v)))
+ && (v == val_chain[0] || !value_lazy (v)))
{
struct type *vtype = check_typedef (value_type (v));
@@ -2093,7 +2045,7 @@ update_watchpoint (struct watchpoint *b, bool reparse)
}
else if (v == result && b->val_bitsize != 0)
{
- /* If VAL_BITSIZE != 0 then RESULT is actually a bitfield
+ /* If VAL_BITSIZE != 0 then RESULT is actually a bitfield
lvalue whose bit parameters are saved in the fields
VAL_BITPOS and VAL_BITSIZE. */
bitpos = b->val_bitpos;
@@ -2140,87 +2092,87 @@ update_watchpoint (struct watchpoint *b, bool reparse)
an ordinary watchpoint depending on the hardware support and
free hardware slots. Recheck the number of free hardware slots
as the value chain may have changed. */
- {
- int reg_cnt;
- enum bp_loc_type loc_type;
+ {
+ int reg_cnt;
+ enum bp_loc_type loc_type;
- reg_cnt = can_use_hardware_watchpoint (val_chain);
+ reg_cnt = can_use_hardware_watchpoint (val_chain);
- if (reg_cnt)
- {
- int i, target_resources_ok, other_type_used;
- enum bptype type;
+ if (reg_cnt)
+ {
+ int i, target_resources_ok, other_type_used;
+ enum bptype type;
- /* Use an exact watchpoint when there's only one memory region to be
+ /* Use an exact watchpoint when there's only one memory region to be
watched, and only one debug register is needed to watch it. */
- b->exact = target_exact_watchpoints && reg_cnt == 1;
+ b->exact = target_exact_watchpoints && reg_cnt == 1;
- /* We need to determine how many resources are already
+ /* We need to determine how many resources are already
used for all other hardware watchpoints plus this one
to see if we still have enough resources to also fit
this watchpoint in as well. */
- /* If this is a software watchpoint, we try to turn it
+ /* If this is a software watchpoint, we try to turn it
to a hardware one -- count resources as if B was of
hardware watchpoint type. */
- type = b->type;
- if (type == bp_watchpoint)
- type = bp_hardware_watchpoint;
+ type = b->type;
+ if (type == bp_watchpoint)
+ type = bp_hardware_watchpoint;
- /* This watchpoint may or may not have been placed on
+ /* This watchpoint may or may not have been placed on
the list yet at this point (it won't be in the list
if we're trying to create it for the first time,
through watch_command), so always account for it
manually. */
- /* Count resources used by all watchpoints except B. */
- i = hw_watchpoint_used_count_others (b, type, &other_type_used);
+ /* Count resources used by all watchpoints except B. */
+ i = hw_watchpoint_used_count_others (b, type, &other_type_used);
- /* Add in the resources needed for B. */
- i += hw_watchpoint_use_count (b);
+ /* Add in the resources needed for B. */
+ i += hw_watchpoint_use_count (b);
- target_resources_ok
- = target_can_use_hardware_watchpoint (type, i, other_type_used);
- if (target_resources_ok <= 0)
- {
- bool sw_mode = b->works_in_software_mode ();
+ target_resources_ok
+ = target_can_use_hardware_watchpoint (type, i, other_type_used);
+ if (target_resources_ok <= 0)
+ {
+ bool sw_mode = b->works_in_software_mode ();
- if (target_resources_ok == 0 && !sw_mode)
- error (_("Target does not support this type of "
- "hardware watchpoint."));
- else if (target_resources_ok < 0 && !sw_mode)
- error (_("There are not enough available hardware "
- "resources for this watchpoint."));
+ if (target_resources_ok == 0 && !sw_mode)
+ error (_ ("Target does not support this type of "
+ "hardware watchpoint."));
+ else if (target_resources_ok < 0 && !sw_mode)
+ error (_ ("There are not enough available hardware "
+ "resources for this watchpoint."));
- /* Downgrade to software watchpoint. */
- b->type = bp_watchpoint;
- }
- else
- {
- /* If this was a software watchpoint, we've just
+ /* Downgrade to software watchpoint. */
+ b->type = bp_watchpoint;
+ }
+ else
+ {
+ /* If this was a software watchpoint, we've just
found we have enough resources to turn it to a
hardware watchpoint. Otherwise, this is a
nop. */
- b->type = type;
- }
- }
- else if (!b->works_in_software_mode ())
- {
- if (!can_use_hw_watchpoints)
- error (_("Can't set read/access watchpoint when "
- "hardware watchpoints are disabled."));
- else
- error (_("Expression cannot be implemented with "
- "read/access watchpoint."));
- }
- else
- b->type = bp_watchpoint;
+ b->type = type;
+ }
+ }
+ else if (!b->works_in_software_mode ())
+ {
+ if (!can_use_hw_watchpoints)
+ error (_ ("Can't set read/access watchpoint when "
+ "hardware watchpoints are disabled."));
+ else
+ error (_ ("Expression cannot be implemented with "
+ "read/access watchpoint."));
+ }
+ else
+ b->type = bp_watchpoint;
- loc_type = (b->type == bp_watchpoint? bp_loc_software_watchpoint
- : bp_loc_hardware_watchpoint);
- for (bp_location *bl : b->locations ())
- bl->loc_type = loc_type;
- }
+ loc_type = (b->type == bp_watchpoint ? bp_loc_software_watchpoint
+ : bp_loc_hardware_watchpoint);
+ for (bp_location *bl : b->locations ())
+ bl->loc_type = loc_type;
+ }
/* If a software watchpoint is not watching any memory, then the
above left it without any location set up. But,
@@ -2231,7 +2183,7 @@ update_watchpoint (struct watchpoint *b, bool reparse)
}
else if (!within_current_scope)
{
- gdb_printf (_("\
+ gdb_printf (_ ("\
Watchpoint %d deleted because the program has left the block\n\
in which its expression is valid.\n"),
b->number);
@@ -2254,8 +2206,8 @@ should_be_inserted (struct bp_location *bl)
if (bl->owner->disposition == disp_del_at_next_stop)
return false;
- if (!bl->enabled || bl->disabled_by_cond
- || bl->shlib_disabled || bl->duplicate)
+ if (!bl->enabled || bl->disabled_by_cond || bl->shlib_disabled
+ || bl->duplicate)
return false;
if (user_breakpoint_p (bl->owner) && bl->pspace->executing_startup)
@@ -2278,8 +2230,7 @@ should_be_inserted (struct bp_location *bl)
a breakpoint. */
if ((bl->loc_type == bp_loc_software_breakpoint
|| bl->loc_type == bp_loc_hardware_breakpoint)
- && stepping_past_instruction_at (bl->pspace->aspace,
- bl->address)
+ && stepping_past_instruction_at (bl->pspace->aspace, bl->address)
/* The single-step breakpoint may be inserted at the location
we're trying to step if the instruction branches to itself.
However, the instruction won't be executed at all and it may
@@ -2396,8 +2347,8 @@ build_target_condition_list (struct bp_location *bl)
case we already freed the condition bytecodes (see
force_breakpoint_reinsertion). We just
need to parse the condition to bytecodes again. */
- loc->cond_bytecode = parse_cond_to_aexpr (bl->address,
- loc->cond.get ());
+ loc->cond_bytecode
+ = parse_cond_to_aexpr (bl->address, loc->cond.get ());
}
/* If we have a NULL bytecode expression, it means something
@@ -2420,7 +2371,8 @@ build_target_condition_list (struct bp_location *bl)
{
for (bp_location *loc : loc_range)
{
- if (is_breakpoint (loc->owner) && loc->pspace->num == bl->pspace->num)
+ if (is_breakpoint (loc->owner)
+ && loc->pspace->num == bl->pspace->num)
{
/* Only go as far as the first NULL bytecode is
located. */
@@ -2439,11 +2391,9 @@ build_target_condition_list (struct bp_location *bl)
anyway, as it's simpler, and doesn't really make a practical
difference. */
for (bp_location *loc : loc_range)
- if (loc->cond
- && is_breakpoint (loc->owner)
+ if (loc->cond && is_breakpoint (loc->owner)
&& loc->pspace->num == bl->pspace->num
- && loc->owner->enable_state == bp_enabled
- && loc->enabled
+ && loc->owner->enable_state == bp_enabled && loc->enabled
&& !loc->disabled_by_cond)
{
/* Add the condition to the vector. This will be used later
@@ -2475,7 +2425,7 @@ parse_cmd_to_aexpr (CORE_ADDR scope, char *cmd)
cmdrest = skip_spaces (cmdrest);
if (*cmdrest++ != '"')
- error (_("No format string following the location"));
+ error (_ ("No format string following the location"));
format_start = cmdrest;
@@ -2484,12 +2434,12 @@ parse_cmd_to_aexpr (CORE_ADDR scope, char *cmd)
format_end = cmdrest;
if (*cmdrest++ != '"')
- error (_("Bad format string, non-terminated '\"'."));
-
+ error (_ ("Bad format string, non-terminated '\"'."));
+
cmdrest = skip_spaces (cmdrest);
if (!(*cmdrest == ',' || *cmdrest == '\0'))
- error (_("Invalid argument syntax"));
+ error (_ ("Invalid argument syntax"));
if (*cmdrest == ',')
cmdrest++;
@@ -2516,9 +2466,9 @@ parse_cmd_to_aexpr (CORE_ADDR scope, char *cmd)
that may show up. */
try
{
- aexpr = gen_printf (scope, gdbarch, 0, 0,
- format_start, format_end - format_start,
- argvec.size (), argvec.data ());
+ aexpr = gen_printf (scope, gdbarch, 0, 0, format_start,
+ format_end - format_start, argvec.size (),
+ argvec.data ());
}
catch (const gdb_exception_error &ex)
{
@@ -2558,8 +2508,7 @@ build_target_command_list (struct bp_location *bl)
make the breakpoint not be reported to the core, and we'd lose
control. */
for (bp_location *loc : loc_range)
- if (is_breakpoint (loc->owner)
- && loc->pspace->num == bl->pspace->num
+ if (is_breakpoint (loc->owner) && loc->pspace->num == bl->pspace->num
&& loc->owner->type != bp_dprintf)
return;
@@ -2598,8 +2547,7 @@ build_target_command_list (struct bp_location *bl)
if (null_command_or_parse_error)
{
for (bp_location *loc : loc_range)
- if (is_breakpoint (loc->owner)
- && loc->pspace->num == bl->pspace->num)
+ if (is_breakpoint (loc->owner) && loc->pspace->num == bl->pspace->num)
{
/* Only go as far as the first NULL bytecode is
located. */
@@ -2619,12 +2567,9 @@ build_target_command_list (struct bp_location *bl)
support targets-side commands with dprintf, but it doesn't hurt
to be pedantically correct in case that changes. */
for (bp_location *loc : loc_range)
- if (breakpoint_locations_match (bl, loc)
- && loc->owner->extra_string
- && is_breakpoint (loc->owner)
- && loc->pspace->num == bl->pspace->num
- && loc->owner->enable_state == bp_enabled
- && loc->enabled
+ if (breakpoint_locations_match (bl, loc) && loc->owner->extra_string
+ && is_breakpoint (loc->owner) && loc->pspace->num == bl->pspace->num
+ && loc->owner->enable_state == bp_enabled && loc->enabled
&& !loc->disabled_by_cond)
{
/* Add the command to the vector. This will be used later
@@ -2653,8 +2598,8 @@ breakpoint_kind (const struct bp_location *bl, CORE_ADDR *addr)
regcache = get_thread_regcache (thr);
- return gdbarch_breakpoint_kind_from_current_state (bl->gdbarch,
- regcache, addr);
+ return gdbarch_breakpoint_kind_from_current_state (bl->gdbarch, regcache,
+ addr);
}
else
return gdbarch_breakpoint_kind_from_pc (bl->gdbarch, addr);
@@ -2692,10 +2637,8 @@ rethrow_on_target_close_error (const gdb_exception &e)
NOTE drow/2003-09-09: This routine could be broken down to an
object-style method for each breakpoint or catchpoint type. */
static int
-insert_bp_location (struct bp_location *bl,
- struct ui_file *tmp_error_stream,
- int *disabled_breaks,
- int *hw_breakpoint_error,
+insert_bp_location (struct bp_location *bl, struct ui_file *tmp_error_stream,
+ int *disabled_breaks, int *hw_breakpoint_error,
int *hw_bp_error_explained_already)
{
gdb_exception bp_excpt;
@@ -2742,11 +2685,10 @@ insert_bp_location (struct bp_location *bl,
if (mr != nullptr && mr->attrib.mode != MEM_RW)
{
gdb_printf (tmp_error_stream,
- _("Cannot insert breakpoint %d.\n"
- "Cannot set software breakpoint "
- "at read-only address %s\n"),
- bl->owner->number,
- paddress (bl->gdbarch, bl->address));
+ _ ("Cannot insert breakpoint %d.\n"
+ "Cannot set software breakpoint "
+ "at read-only address %s\n"),
+ bl->owner->number, paddress (bl->gdbarch, bl->address));
return 1;
}
}
@@ -2755,8 +2697,7 @@ insert_bp_location (struct bp_location *bl,
|| bl->loc_type == bp_loc_hardware_breakpoint)
{
/* First check to see if we have to handle an overlay. */
- if (overlay_debugging == ovly_off
- || bl->section == NULL
+ if (overlay_debugging == ovly_off || bl->section == NULL
|| !(section_is_overlay (bl->section)))
{
/* No overlay handling: just set the breakpoint. */
@@ -2766,7 +2707,7 @@ insert_bp_location (struct bp_location *bl,
val = bl->owner->insert_location (bl);
if (val)
- bp_excpt = gdb_exception {RETURN_ERROR, GENERIC_ERROR};
+ bp_excpt = gdb_exception { RETURN_ERROR, GENERIC_ERROR };
}
catch (gdb_exception &e)
{
@@ -2784,12 +2725,13 @@ insert_bp_location (struct bp_location *bl,
so we must try to set a breakpoint at the LMA.
This will not work for a hardware breakpoint. */
if (bl->loc_type == bp_loc_hardware_breakpoint)
- warning (_("hardware breakpoint %d not supported in overlay!"),
- bl->owner->number);
+ warning (
+ _ ("hardware breakpoint %d not supported in overlay!"),
+ bl->owner->number);
else
{
- CORE_ADDR addr = overlay_unmapped_address (bl->address,
- bl->section);
+ CORE_ADDR addr
+ = overlay_unmapped_address (bl->address, bl->section);
/* Set a software (trap) breakpoint at the LMA. */
bl->overlay_target_info = bl->target_info;
bl->overlay_target_info.reqstd_address = addr;
@@ -2802,11 +2744,12 @@ insert_bp_location (struct bp_location *bl,
bl->overlay_target_info.kind
= breakpoint_kind (bl, &addr);
bl->overlay_target_info.placed_address = addr;
- val = target_insert_breakpoint (bl->gdbarch,
- &bl->overlay_target_info);
+ val
+ = target_insert_breakpoint (bl->gdbarch,
+ &bl->overlay_target_info);
if (val)
bp_excpt
- = gdb_exception {RETURN_ERROR, GENERIC_ERROR};
+ = gdb_exception { RETURN_ERROR, GENERIC_ERROR };
}
catch (gdb_exception &e)
{
@@ -2831,7 +2774,7 @@ insert_bp_location (struct bp_location *bl,
val = bl->owner->insert_location (bl);
if (val)
- bp_excpt = gdb_exception {RETURN_ERROR, GENERIC_ERROR};
+ bp_excpt = gdb_exception { RETURN_ERROR, GENERIC_ERROR };
}
catch (gdb_exception &e)
{
@@ -2873,16 +2816,15 @@ insert_bp_location (struct bp_location *bl,
gdb::observers::breakpoint_modified.notify (bl->owner);
if (!*disabled_breaks)
{
- gdb_printf (tmp_error_stream,
- "Cannot insert breakpoint %d.\n",
+ gdb_printf (tmp_error_stream,
+ "Cannot insert breakpoint %d.\n",
bl->owner->number);
- gdb_printf (tmp_error_stream,
- "Temporarily disabling shared "
- "library breakpoints:\n");
+ gdb_printf (tmp_error_stream, "Temporarily disabling shared "
+ "library breakpoints:\n");
}
*disabled_breaks = 1;
- gdb_printf (tmp_error_stream,
- "breakpoint #%d\n", bl->owner->number);
+ gdb_printf (tmp_error_stream, "breakpoint #%d\n",
+ bl->owner->number);
return 0;
}
else
@@ -2896,16 +2838,15 @@ insert_bp_location (struct bp_location *bl,
bl->owner->number,
bp_excpt.message ? ":" : ".\n");
if (bp_excpt.message != NULL)
- gdb_printf (tmp_error_stream, "%s.\n",
- bp_excpt.what ());
+ gdb_printf (tmp_error_stream, "%s.\n", bp_excpt.what ());
}
else
{
if (bp_excpt.message == NULL)
{
std::string message
- = memory_error_message (TARGET_XFER_E_IO,
- bl->gdbarch, bl->address);
+ = memory_error_message (TARGET_XFER_E_IO, bl->gdbarch,
+ bl->address);
gdb_printf (tmp_error_stream,
"Cannot insert breakpoint %d.\n"
@@ -2916,12 +2857,10 @@ insert_bp_location (struct bp_location *bl,
{
gdb_printf (tmp_error_stream,
"Cannot insert breakpoint %d: %s\n",
- bl->owner->number,
- bp_excpt.what ());
+ bl->owner->number, bp_excpt.what ());
}
}
return 1;
-
}
}
else
@@ -2947,8 +2886,7 @@ insert_bp_location (struct bp_location *bl,
hw_access location that would be considered a duplicate
of this one. */
for (bp_location *loc : all_bp_locations ())
- if (loc != bl
- && loc->watchpoint_type == hw_access
+ if (loc != bl && loc->watchpoint_type == hw_access
&& watchpoint_locations_match (bl, loc))
{
bl->duplicate = 1;
@@ -2983,11 +2921,12 @@ insert_bp_location (struct bp_location *bl,
bl->owner->enable_state = bp_disabled;
if (val == 1)
- warning (_("\
+ warning (_ ("\
Error inserting catchpoint %d: Your system does not support this type\n\
-of catchpoint."), bl->owner->number);
+of catchpoint."),
+ bl->owner->number);
else
- warning (_("Error inserting catchpoint %d."), bl->owner->number);
+ warning (_ ("Error inserting catchpoint %d."), bl->owner->number);
}
bl->inserted = (val == 0);
@@ -3109,7 +3048,7 @@ update_inserted_breakpoint_locations (void)
continue;
val = insert_bp_location (bl, &tmp_error_stream, &disabled_breaks,
- &hw_breakpoint_error, &hw_bp_details_reported);
+ &hw_breakpoint_error, &hw_bp_details_reported);
if (val)
error_flag = val;
}
@@ -3163,7 +3102,8 @@ insert_breakpoint_locations (void)
continue;
val = insert_bp_location (bl, &tmp_error_stream, &disabled_breaks,
- &hw_breakpoint_error, &hw_bp_error_explained_already);
+ &hw_breakpoint_error,
+ &hw_bp_error_explained_already);
if (val)
error_flag = val;
}
@@ -3182,7 +3122,7 @@ insert_breakpoint_locations (void)
if (bpt->disposition == disp_del_at_next_stop)
continue;
-
+
for (bp_location *loc : bpt->locations ())
if (!loc->inserted && should_be_inserted (loc))
{
@@ -3246,13 +3186,13 @@ remove_threaded_breakpoints (struct thread_info *tp, int silent)
{
b->disposition = disp_del_at_next_stop;
- gdb_printf (_("\
+ gdb_printf (_ ("\
Thread-specific breakpoint %d deleted - thread %s no longer in the thread list.\n"),
b->number, print_thread_id (tp));
/* Hide it from the user. */
b->number = 0;
- }
+ }
}
}
@@ -3300,11 +3240,12 @@ set_breakpoint_number (int internal, struct breakpoint *b)
/* Create a TYPE breakpoint on ADDRESS from an object file with GDBARCH. */
static struct breakpoint *
-create_internal_breakpoint (struct gdbarch *gdbarch,
- CORE_ADDR address, enum bptype type)
+create_internal_breakpoint (struct gdbarch *gdbarch, CORE_ADDR address,
+ enum bptype type)
{
- std::unique_ptr<internal_breakpoint> b
- (new internal_breakpoint (gdbarch, type, address));
+ std::unique_ptr<internal_breakpoint> b (new internal_breakpoint (gdbarch,
+ type,
+ address));
b->number = internal_breakpoint_number--;
@@ -3316,14 +3257,16 @@ create_internal_breakpoint (struct gdbarch *gdbarch,
static struct breakpoint *
create_internal_breakpoint (struct gdbarch *gdbarch,
- struct bound_minimal_symbol &msym, enum bptype type)
+ struct bound_minimal_symbol &msym,
+ enum bptype type)
{
CORE_ADDR address;
address = msym.value_address ();
- address = gdbarch_convert_from_func_ptr_addr
- (gdbarch, address, current_inferior ()->top_target ());
+ address
+ = gdbarch_convert_from_func_ptr_addr (gdbarch, address,
+ current_inferior ()->top_target ());
/* Note that we're not using gdbarch_addr_bits_remove here, because that's
related to addresses in $pc. We're getting the address from the
@@ -3338,11 +3281,9 @@ create_internal_breakpoint (struct gdbarch *gdbarch,
return create_internal_breakpoint (gdbarch, address, type);
}
-static const char *const longjmp_names[] =
- {
- "longjmp", "_longjmp", "siglongjmp", "_siglongjmp"
- };
-#define NUM_LONGJMP_NAMES ARRAY_SIZE(longjmp_names)
+static const char *const longjmp_names[]
+ = { "longjmp", "_longjmp", "siglongjmp", "_siglongjmp" };
+#define NUM_LONGJMP_NAMES ARRAY_SIZE (longjmp_names)
/* Per-objfile data private to breakpoint.c. */
struct breakpoint_objfile_data
@@ -3443,10 +3384,10 @@ create_overlay_event_breakpoint (void)
overlay_events_enabled = 1;
}
else
- {
- b->enable_state = bp_disabled;
- overlay_events_enabled = 0;
- }
+ {
+ b->enable_state = bp_disabled;
+ overlay_events_enabled = 0;
+ }
}
}
@@ -3604,8 +3545,9 @@ create_std_terminate_master_breakpoint (void)
struct bound_minimal_symbol m;
m = lookup_minimal_symbol (func_name, NULL, objfile);
- if (m.minsym == NULL || (m.minsym->type () != mst_text
- && m.minsym->type () != mst_file_text))
+ if (m.minsym == NULL
+ || (m.minsym->type () != mst_text
+ && m.minsym->type () != mst_file_text))
{
/* Prevent future lookups in this objfile. */
bp_objfile_data->terminate_msym.minsym = &msym_not_found;
@@ -3806,8 +3748,8 @@ update_breakpoints_after_exec (void)
/* Longjmp and longjmp-resume breakpoints are also meaningless
after an exec. */
if (b->type == bp_longjmp || b->type == bp_longjmp_resume
- || b->type == bp_longjmp_call_dummy
- || b->type == bp_exception || b->type == bp_exception_resume)
+ || b->type == bp_longjmp_call_dummy || b->type == bp_exception
+ || b->type == bp_exception_resume)
{
delete_breakpoint (b);
continue;
@@ -3872,7 +3814,7 @@ detach_breakpoints (ptid_t ptid)
struct inferior *inf = current_inferior ();
if (ptid.pid () == inferior_ptid.pid ())
- error (_("Cannot detach breakpoints of inferior_ptid"));
+ error (_ ("Cannot detach breakpoints of inferior_ptid"));
/* Set inferior_ptid; remove_breakpoint_1 uses this global. */
inferior_ptid = ptid;
@@ -3924,8 +3866,7 @@ remove_breakpoint_1 (struct bp_location *bl, enum remove_bp_reason reason)
bp_hardware_breakpoint. */
/* First check to see if we have to handle an overlay. */
- if (overlay_debugging == ovly_off
- || bl->section == NULL
+ if (overlay_debugging == ovly_off || bl->section == NULL
|| !(section_is_overlay (bl->section)))
{
/* No overlay handling: just remove the breakpoint. */
@@ -3948,8 +3889,7 @@ remove_breakpoint_1 (struct bp_location *bl, enum remove_bp_reason reason)
implemented using a mechanism that is not dependent on
being able to modify the target's memory, and as such
they should always be removed. */
- if (bl->shlib_disabled
- && bl->target_info.shadow_len != 0
+ if (bl->shlib_disabled && bl->target_info.shadow_len != 0
&& !memory_validate_breakpoint (bl->gdbarch, &bl->target_info))
val = 0;
else
@@ -3960,20 +3900,19 @@ remove_breakpoint_1 (struct bp_location *bl, enum remove_bp_reason reason)
/* This breakpoint is in an overlay section.
Did we set a breakpoint at the LMA? */
if (!overlay_events_enabled)
- {
- /* Yes -- overlay event support is not active, so we
+ {
+ /* Yes -- overlay event support is not active, so we
should have set a breakpoint at the LMA. Remove it.
*/
- /* Ignore any failures: if the LMA is in ROM, we will
+ /* Ignore any failures: if the LMA is in ROM, we will
have already warned when we failed to insert it. */
- if (bl->loc_type == bp_loc_hardware_breakpoint)
- target_remove_hw_breakpoint (bl->gdbarch,
- &bl->overlay_target_info);
- else
- target_remove_breakpoint (bl->gdbarch,
- &bl->overlay_target_info,
- reason);
- }
+ if (bl->loc_type == bp_loc_hardware_breakpoint)
+ target_remove_hw_breakpoint (bl->gdbarch,
+ &bl->overlay_target_info);
+ else
+ target_remove_breakpoint (bl->gdbarch,
+ &bl->overlay_target_info, reason);
+ }
/* Did we set a breakpoint at the VMA?
If so, we will have marked the breakpoint 'inserted'. */
if (bl->inserted)
@@ -4027,11 +3966,10 @@ remove_breakpoint_1 (struct bp_location *bl, enum remove_bp_reason reason)
/* Failure to remove any of the hardware watchpoints comes here. */
if (reason == REMOVE_BREAKPOINT && bl->inserted)
- warning (_("Could not remove hardware watchpoint %d."),
+ warning (_ ("Could not remove hardware watchpoint %d."),
bl->owner->number);
}
- else if (bl->owner->type == bp_catchpoint
- && breakpoint_enabled (bl->owner)
+ else if (bl->owner->type == bp_catchpoint && breakpoint_enabled (bl->owner)
&& !bl->duplicate)
{
val = bl->owner->remove_location (bl, reason);
@@ -4081,8 +4019,6 @@ mark_breakpoints_out (void)
generic_mourn_inferior) and when a run begins (by
init_wait_for_inferior). */
-
-
void
breakpoint_init_inferior (enum inf_context context)
{
@@ -4207,14 +4143,12 @@ breakpoint_here_p (const address_space *aspace, CORE_ADDR pc)
continue;
/* ALL_BP_LOCATIONS bp_location has BL->OWNER always non-NULL. */
- if ((breakpoint_enabled (bl->owner)
- || bl->permanent)
+ if ((breakpoint_enabled (bl->owner) || bl->permanent)
&& breakpoint_location_address_match (bl, aspace, pc))
{
- if (overlay_debugging
- && section_is_overlay (bl->section)
+ if (overlay_debugging && section_is_overlay (bl->section)
&& !section_is_mapped (bl->section))
- continue; /* unmapped overlay -- can't be a match */
+ continue; /* unmapped overlay -- can't be a match */
else if (bl->permanent)
return permanent_breakpoint_here;
else
@@ -4228,8 +4162,8 @@ breakpoint_here_p (const address_space *aspace, CORE_ADDR pc)
/* See breakpoint.h. */
int
-breakpoint_in_range_p (const address_space *aspace,
- CORE_ADDR addr, ULONGEST len)
+breakpoint_in_range_p (const address_space *aspace, CORE_ADDR addr,
+ ULONGEST len)
{
for (bp_location *bl : all_bp_locations ())
{
@@ -4237,13 +4171,10 @@ breakpoint_in_range_p (const address_space *aspace,
&& bl->loc_type != bp_loc_hardware_breakpoint)
continue;
- if ((breakpoint_enabled (bl->owner)
- || bl->permanent)
- && breakpoint_location_address_range_overlap (bl, aspace,
- addr, len))
+ if ((breakpoint_enabled (bl->owner) || bl->permanent)
+ && breakpoint_location_address_range_overlap (bl, aspace, addr, len))
{
- if (overlay_debugging
- && section_is_overlay (bl->section)
+ if (overlay_debugging && section_is_overlay (bl->section)
&& !section_is_mapped (bl->section))
{
/* Unmapped overlay -- can't be a match. */
@@ -4276,12 +4207,11 @@ bp_location_inserted_here_p (const struct bp_location *bl,
const address_space *aspace, CORE_ADDR pc)
{
if (bl->inserted
- && breakpoint_address_match (bl->pspace->aspace, bl->address,
- aspace, pc))
+ && breakpoint_address_match (bl->pspace->aspace, bl->address, aspace,
+ pc))
{
/* An unmapped overlay can't be a match. */
- return !(overlay_debugging
- && section_is_overlay (bl->section)
+ return !(overlay_debugging && section_is_overlay (bl->section)
&& !section_is_mapped (bl->section));
}
return false;
@@ -4308,8 +4238,7 @@ breakpoint_inserted_here_p (const address_space *aspace, CORE_ADDR pc)
inserted at PC. */
int
-software_breakpoint_inserted_here_p (const address_space *aspace,
- CORE_ADDR pc)
+software_breakpoint_inserted_here_p (const address_space *aspace, CORE_ADDR pc)
{
for (bp_location *bl : all_bp_locations_at_addr (pc))
{
@@ -4326,8 +4255,7 @@ software_breakpoint_inserted_here_p (const address_space *aspace,
/* See breakpoint.h. */
int
-hardware_breakpoint_inserted_here_p (const address_space *aspace,
- CORE_ADDR pc)
+hardware_breakpoint_inserted_here_p (const address_space *aspace, CORE_ADDR pc)
{
for (bp_location *bl : all_bp_locations_at_addr (pc))
{
@@ -4487,7 +4415,7 @@ bpstat_num (bpstat **bsp, int *num)
struct breakpoint *b;
if ((*bsp) == NULL)
- return 0; /* No more breakpoint values */
+ return 0; /* No more breakpoint values */
/* We assume we'll never have several bpstats that correspond to a
single breakpoint -- otherwise, this function might return the
@@ -4495,9 +4423,9 @@ bpstat_num (bpstat **bsp, int *num)
b = (*bsp)->breakpoint_at;
*bsp = (*bsp)->next;
if (b == NULL)
- return -1; /* breakpoint that's been deleted since */
+ return -1; /* breakpoint that's been deleted since */
- *num = b->number; /* We have its number */
+ *num = b->number; /* We have its number */
return 1;
}
@@ -4515,8 +4443,7 @@ bpstat_locno (const bpstat *bs)
{
const bp_location *bl_i;
- for (bl_i = b->loc;
- bl_i != bl && bl_i->next != nullptr;
+ for (bl_i = b->loc; bl_i != bl && bl_i->next != nullptr;
bl_i = bl_i->next)
locno++;
@@ -4524,8 +4451,9 @@ bpstat_locno (const bpstat *bs)
locno++;
else
{
- warning (_("location number not found for breakpoint %d address %s."),
- b->number, paddress (bl->gdbarch, bl->address));
+ warning (
+ _ ("location number not found for breakpoint %d address %s."),
+ b->number, paddress (bl->gdbarch, bl->address));
locno = 0;
}
}
@@ -4541,7 +4469,7 @@ print_num_locno (const bpstat *bs, struct ui_out *uiout)
struct breakpoint *b = bs->breakpoint_at;
if (b == nullptr)
- uiout->text (_("deleted breakpoint"));
+ uiout->text (_ ("deleted breakpoint"));
else
{
uiout->field_signed ("bkptno", b->number);
@@ -4776,7 +4704,7 @@ static void
watchpoint_value_print (struct value *val, struct ui_file *stream)
{
if (val == NULL)
- fprintf_styled (stream, metadata_style.style (), _("<unreadable>"));
+ fprintf_styled (stream, metadata_style.style (), _ ("<unreadable>"));
else
{
struct value_print_options opts;
@@ -4852,7 +4780,7 @@ print_bp_stop_message (bpstat *bs)
break;
default:
- internal_error (_("print_bp_stop_message: unrecognized enum value"));
+ internal_error (_ ("print_bp_stop_message: unrecognized enum value"));
break;
}
}
@@ -4868,10 +4796,10 @@ print_solib_event (bool is_catchpoint)
if (!is_catchpoint)
{
if (any_added || any_deleted)
- current_uiout->text (_("Stopped due to shared library event:\n"));
+ current_uiout->text (_ ("Stopped due to shared library event:\n"));
else
- current_uiout->text (_("Stopped due to shared library event (no "
- "libraries added or removed)\n"));
+ current_uiout->text (_ ("Stopped due to shared library event (no "
+ "libraries added or removed)\n"));
}
if (current_uiout->is_mi_like_p ())
@@ -4880,9 +4808,10 @@ print_solib_event (bool is_catchpoint)
if (any_deleted)
{
- current_uiout->text (_(" Inferior unloaded "));
+ current_uiout->text (_ (" Inferior unloaded "));
ui_out_emit_list list_emitter (current_uiout, "removed");
- for (int ix = 0; ix < current_program_space->deleted_solibs.size (); ix++)
+ for (int ix = 0; ix < current_program_space->deleted_solibs.size ();
+ ix++)
{
const std::string &name = current_program_space->deleted_solibs[ix];
@@ -4895,7 +4824,7 @@ print_solib_event (bool is_catchpoint)
if (any_added)
{
- current_uiout->text (_(" Inferior loaded "));
+ current_uiout->text (_ (" Inferior loaded "));
ui_out_emit_list list_emitter (current_uiout, "added");
bool first = true;
for (so_list *iter : current_program_space->added_solibs)
@@ -4942,8 +4871,7 @@ bpstat_print (bpstat *bs, target_waitkind kind)
for (; bs; bs = bs->next)
{
val = print_bp_stop_message (bs);
- if (val == PRINT_SRC_ONLY
- || val == PRINT_SRC_AND_LOC
+ if (val == PRINT_SRC_ONLY || val == PRINT_SRC_AND_LOC
|| val == PRINT_NOTHING)
return val;
}
@@ -4995,7 +4923,7 @@ bpstat::bpstat ()
print_it (print_it_normal)
{
}
-
+
/* The target has stopped with waitstatus WS. Check if any hardware
watchpoints have triggered, according to the target. */
@@ -5059,9 +4987,9 @@ watchpoints_triggered (const target_waitstatus &ws)
}
}
/* Exact match not required. Within range is sufficient. */
- else if (target_watchpoint_addr_within_range
- (current_inferior ()->top_target (), addr, loc->address,
- loc->length))
+ else if (target_watchpoint_addr_within_range (
+ current_inferior ()->top_target (), addr, loc->address,
+ loc->length))
{
w->watchpoint_triggered = watch_triggered_yes;
break;
@@ -5074,19 +5002,19 @@ watchpoints_triggered (const target_waitstatus &ws)
/* Possible return values for watchpoint_check. */
enum wp_check_result
- {
- /* The watchpoint has been deleted. */
- WP_DELETED = 1,
+{
+ /* The watchpoint has been deleted. */
+ WP_DELETED = 1,
- /* The value has changed. */
- WP_VALUE_CHANGED = 2,
+ /* The value has changed. */
+ WP_VALUE_CHANGED = 2,
- /* The value has not changed. */
- WP_VALUE_NOT_CHANGED = 3,
+ /* The value has not changed. */
+ WP_VALUE_NOT_CHANGED = 3,
- /* Ignore this watchpoint, no matter if the value changed or not. */
- WP_IGNORE = 4,
- };
+ /* Ignore this watchpoint, no matter if the value changed or not. */
+ WP_IGNORE = 4,
+};
#define BP_TEMPFLAG 1
#define BP_HARDWAREFLAG 2
@@ -5170,8 +5098,8 @@ watchpoint_check (bpstat *bs)
return WP_VALUE_CHANGED;
mark = value_mark ();
- fetch_subexp_value (b->exp.get (), b->exp->op.get (), &new_val,
- NULL, NULL, false);
+ fetch_subexp_value (b->exp.get (), b->exp->op.get (), &new_val, NULL,
+ NULL, false);
if (b->val_bitsize != 0)
new_val = extract_bitfield_from_watchpoint_value (b, new_val);
@@ -5181,8 +5109,8 @@ watchpoint_check (bpstat *bs)
the address of the array instead of its contents. This is
not what we want. */
if ((b->val != NULL) != (new_val != NULL)
- || (b->val != NULL && !value_equal_contents (b->val.get (),
- new_val)))
+ || (b->val != NULL
+ && !value_equal_contents (b->val.get (), new_val)))
{
bs->old_val = b->val;
b->val = release_value (new_val);
@@ -5215,17 +5143,17 @@ watchpoint_check (bpstat *bs)
here. */
SWITCH_THRU_ALL_UIS ()
- {
- struct ui_out *uiout = current_uiout;
-
- if (uiout->is_mi_like_p ())
- uiout->field_string
- ("reason", async_reason_lookup (EXEC_ASYNC_WATCHPOINT_SCOPE));
- uiout->message ("\nWatchpoint %pF deleted because the program has "
- "left the block in\n"
- "which its expression is valid.\n",
- signed_field ("wpnum", b->number));
- }
+ {
+ struct ui_out *uiout = current_uiout;
+
+ if (uiout->is_mi_like_p ())
+ uiout->field_string (
+ "reason", async_reason_lookup (EXEC_ASYNC_WATCHPOINT_SCOPE));
+ uiout->message ("\nWatchpoint %pF deleted because the program has "
+ "left the block in\n"
+ "which its expression is valid.\n",
+ signed_field ("wpnum", b->number));
+ }
/* Make sure the watchpoint's commands aren't executed. */
b->commands = NULL;
@@ -5267,65 +5195,64 @@ bpstat_check_watchpoint (bpstat *bs)
b = (struct watchpoint *) bs->breakpoint_at;
gdb_assert (b != NULL);
- {
- bool must_check_value = false;
+ {
+ bool must_check_value = false;
- if (b->type == bp_watchpoint)
- /* For a software watchpoint, we must always check the
+ if (b->type == bp_watchpoint)
+ /* For a software watchpoint, we must always check the
watched value. */
- must_check_value = true;
- else if (b->watchpoint_triggered == watch_triggered_yes)
- /* We have a hardware watchpoint (read, write, or access)
+ must_check_value = true;
+ else if (b->watchpoint_triggered == watch_triggered_yes)
+ /* We have a hardware watchpoint (read, write, or access)
and the target earlier reported an address watched by
this watchpoint. */
- must_check_value = true;
- else if (b->watchpoint_triggered == watch_triggered_unknown
- && b->type == bp_hardware_watchpoint)
- /* We were stopped by a hardware watchpoint, but the target could
+ must_check_value = true;
+ else if (b->watchpoint_triggered == watch_triggered_unknown
+ && b->type == bp_hardware_watchpoint)
+ /* We were stopped by a hardware watchpoint, but the target could
not report the data address. We must check the watchpoint's
value. Access and read watchpoints are out of luck; without
a data address, we can't figure it out. */
- must_check_value = true;
+ must_check_value = true;
- if (must_check_value)
- {
- wp_check_result e;
+ if (must_check_value)
+ {
+ wp_check_result e;
- try
- {
- e = watchpoint_check (bs);
- }
- catch (const gdb_exception &ex)
- {
- exception_fprintf (gdb_stderr, ex,
- "Error evaluating expression "
- "for watchpoint %d\n",
- b->number);
+ try
+ {
+ e = watchpoint_check (bs);
+ }
+ catch (const gdb_exception &ex)
+ {
+ exception_fprintf (gdb_stderr, ex,
+ "Error evaluating expression "
+ "for watchpoint %d\n",
+ b->number);
- SWITCH_THRU_ALL_UIS ()
- {
- gdb_printf (_("Watchpoint %d deleted.\n"),
- b->number);
- }
- watchpoint_del_at_next_stop (b);
- e = WP_DELETED;
+ SWITCH_THRU_ALL_UIS ()
+ {
+ gdb_printf (_ ("Watchpoint %d deleted.\n"), b->number);
}
+ watchpoint_del_at_next_stop (b);
+ e = WP_DELETED;
+ }
- switch (e)
- {
- case WP_DELETED:
- /* We've already printed what needs to be printed. */
- bs->print_it = print_it_done;
- /* Stop. */
- break;
- case WP_IGNORE:
- bs->print_it = print_it_noop;
- bs->stop = false;
- break;
- case WP_VALUE_CHANGED:
- if (b->type == bp_read_watchpoint)
- {
- /* There are two cases to consider here:
+ switch (e)
+ {
+ case WP_DELETED:
+ /* We've already printed what needs to be printed. */
+ bs->print_it = print_it_done;
+ /* Stop. */
+ break;
+ case WP_IGNORE:
+ bs->print_it = print_it_noop;
+ bs->stop = false;
+ break;
+ case WP_VALUE_CHANGED:
+ if (b->type == bp_read_watchpoint)
+ {
+ /* There are two cases to consider here:
1. We're watching the triggered memory for reads.
In that case, trust the target, and always report
@@ -5359,64 +5286,62 @@ bpstat_check_watchpoint (bpstat *bs)
it for a read), but it's much better than
nothing. */
- int other_write_watchpoint = 0;
+ int other_write_watchpoint = 0;
- if (bl->watchpoint_type == hw_read)
- {
- for (breakpoint *other_b : all_breakpoints ())
- if (other_b->type == bp_hardware_watchpoint
- || other_b->type == bp_access_watchpoint)
- {
- struct watchpoint *other_w =
- (struct watchpoint *) other_b;
-
- if (other_w->watchpoint_triggered
- == watch_triggered_yes)
- {
- other_write_watchpoint = 1;
- break;
- }
- }
- }
+ if (bl->watchpoint_type == hw_read)
+ {
+ for (breakpoint *other_b : all_breakpoints ())
+ if (other_b->type == bp_hardware_watchpoint
+ || other_b->type == bp_access_watchpoint)
+ {
+ struct watchpoint *other_w
+ = (struct watchpoint *) other_b;
- if (other_write_watchpoint
- || bl->watchpoint_type == hw_access)
- {
- /* We're watching the same memory for writes,
+ if (other_w->watchpoint_triggered
+ == watch_triggered_yes)
+ {
+ other_write_watchpoint = 1;
+ break;
+ }
+ }
+ }
+
+ if (other_write_watchpoint || bl->watchpoint_type == hw_access)
+ {
+ /* We're watching the same memory for writes,
and the value changed since the last time we
updated it, so this trap must be for a write.
Ignore it. */
- bs->print_it = print_it_noop;
- bs->stop = false;
- }
- }
- break;
- case WP_VALUE_NOT_CHANGED:
- if (b->type == bp_hardware_watchpoint
- || b->type == bp_watchpoint)
- {
- /* Don't stop: write watchpoints shouldn't fire if
+ bs->print_it = print_it_noop;
+ bs->stop = false;
+ }
+ }
+ break;
+ case WP_VALUE_NOT_CHANGED:
+ if (b->type == bp_hardware_watchpoint || b->type == bp_watchpoint)
+ {
+ /* Don't stop: write watchpoints shouldn't fire if
the value hasn't changed. */
- bs->print_it = print_it_noop;
- bs->stop = false;
- }
- /* Stop. */
- break;
- default:
- /* Can't happen. */
- break;
- }
- }
- else /* !must_check_value */
- {
- /* This is a case where some watchpoint(s) triggered, but
+ bs->print_it = print_it_noop;
+ bs->stop = false;
+ }
+ /* Stop. */
+ break;
+ default:
+ /* Can't happen. */
+ break;
+ }
+ }
+ else /* !must_check_value */
+ {
+ /* This is a case where some watchpoint(s) triggered, but
not at the address of this watchpoint, or else no
watchpoint triggered after all. So don't print
anything for this watchpoint. */
- bs->print_it = print_it_noop;
- bs->stop = false;
- }
- }
+ bs->print_it = print_it_noop;
+ bs->stop = false;
+ }
+ }
}
/* For breakpoints that are currently marked as telling gdb to stop,
@@ -5444,8 +5369,8 @@ bpstat_check_breakpoint_conditions (bpstat *bs, thread_info *thread)
gdb_assert (b != NULL);
infrun_debug_printf ("thread = %s, breakpoint %d.%d",
- thread->ptid.to_string ().c_str (),
- b->number, find_loc_num_by_location (bl));
+ thread->ptid.to_string ().c_str (), b->number,
+ find_loc_num_by_location (bl));
/* Even if the target evaluated the condition on its end and notified GDB, we
need to do so again since GDB does not know if we stopped due to a
@@ -5454,9 +5379,10 @@ bpstat_check_breakpoint_conditions (bpstat *bs, thread_info *thread)
if (frame_id_p (b->frame_id)
&& b->frame_id != get_stack_frame_id (get_current_frame ()))
{
- infrun_debug_printf ("incorrect frame %s not %s, not stopping",
- get_stack_frame_id (get_current_frame ()).to_string ().c_str (),
- b->frame_id.to_string ().c_str ());
+ infrun_debug_printf (
+ "incorrect frame %s not %s, not stopping",
+ get_stack_frame_id (get_current_frame ()).to_string ().c_str (),
+ b->frame_id.to_string ().c_str ());
bs->stop = false;
return;
}
@@ -5488,7 +5414,7 @@ bpstat_check_breakpoint_conditions (bpstat *bs, thread_info *thread)
if (cond != nullptr && b->disposition != disp_del_at_next_stop)
{
bool within_current_scope = true;
- struct watchpoint * w;
+ struct watchpoint *w;
/* We use scoped_value_mark because it could be a long time
before we return to the command level and call
@@ -5547,8 +5473,8 @@ bpstat_check_breakpoint_conditions (bpstat *bs, thread_info *thread)
}
else
{
- warning (_("Watchpoint condition cannot be tested "
- "in the current scope"));
+ warning (_ ("Watchpoint condition cannot be tested "
+ "in the current scope"));
/* If we failed to set the right context for this
watchpoint, unconditionally report it. */
}
@@ -5563,8 +5489,7 @@ bpstat_check_breakpoint_conditions (bpstat *bs, thread_info *thread)
}
else if (b->ignore_count > 0)
{
- infrun_debug_printf ("ignore count %d, not stopping",
- b->ignore_count);
+ infrun_debug_printf ("ignore count %d, not stopping", b->ignore_count);
b->ignore_count--;
bs->stop = false;
/* Increase the hit count even though we don't stop. */
@@ -5623,7 +5548,7 @@ build_bpstat_chain (const address_space *aspace, CORE_ADDR bp_addr,
/* Come here if it's a watchpoint, or if the break address
matches. */
- bpstat *bs = new bpstat (bl, &bs_link); /* Alloc a bpstat to
+ bpstat *bs = new bpstat (bl, &bs_link); /* Alloc a bpstat to
explain stop. */
/* Assume we stop. Should we find a watchpoint that is not
@@ -5638,7 +5563,8 @@ build_bpstat_chain (const address_space *aspace, CORE_ADDR bp_addr,
iteration. */
if (b->type == bp_watchpoint_scope && b->related_breakpoint != b)
{
- struct watchpoint *w = (struct watchpoint *) b->related_breakpoint;
+ struct watchpoint *w
+ = (struct watchpoint *) b->related_breakpoint;
w->watchpoint_triggered = watch_triggered_yes;
}
@@ -5669,9 +5595,8 @@ build_bpstat_chain (const address_space *aspace, CORE_ADDR bp_addr,
/* See breakpoint.h. */
bpstat *
-bpstat_stop_status (const address_space *aspace,
- CORE_ADDR bp_addr, thread_info *thread,
- const target_waitstatus &ws,
+bpstat_stop_status (const address_space *aspace, CORE_ADDR bp_addr,
+ thread_info *thread, const target_waitstatus &ws,
bpstat *stop_chain)
{
struct breakpoint *b = NULL;
@@ -5736,13 +5661,12 @@ bpstat_stop_status (const address_space *aspace,
if (b->silent)
bs->print = false;
bs->commands = b->commands;
- if (command_line_is_silent (bs->commands
- ? bs->commands.get () : NULL))
+ if (command_line_is_silent (bs->commands ? bs->commands.get ()
+ : NULL))
bs->print = false;
b->after_condition_true (bs);
}
-
}
/* Print nothing for this entry if we don't stop or don't
@@ -5756,10 +5680,9 @@ bpstat_stop_status (const address_space *aspace,
watching may have. Don't bother if we're stopping; this will get
done later. */
need_remove_insert = 0;
- if (! bpstat_causes_stop (bs_head))
+ if (!bpstat_causes_stop (bs_head))
for (bs = bs_head; bs != NULL; bs = bs->next)
- if (!bs->stop
- && bs->breakpoint_at
+ if (!bs->stop && bs->breakpoint_at
&& is_hardware_watchpoint (bs->breakpoint_at))
{
struct watchpoint *w = (struct watchpoint *) bs->breakpoint_at;
@@ -5945,7 +5868,8 @@ bpstat_what (bpstat *bs_head)
/* Some catchpoints are implemented with breakpoints.
For those, we need to step over the breakpoint. */
if (bs->bp_location_at->loc_type == bp_loc_software_breakpoint
- || bs->bp_location_at->loc_type == bp_loc_hardware_breakpoint)
+ || bs->bp_location_at->loc_type
+ == bp_loc_hardware_breakpoint)
this_action = BPSTAT_WHAT_SINGLE;
}
break;
@@ -5971,7 +5895,7 @@ bpstat_what (bpstat *bs_head)
/* Tracepoint hits should not be reported back to GDB, and
if one got through somehow, it should have been filtered
out already. */
- internal_error (_("bpstat_what: tracepoint encountered"));
+ internal_error (_ ("bpstat_what: tracepoint encountered"));
break;
case bp_gnu_ifunc_resolver:
/* Step over it (and insert bp_gnu_ifunc_resolver_return). */
@@ -5991,7 +5915,8 @@ bpstat_what (bpstat *bs_head)
break;
default:
- internal_error (_("bpstat_what: unhandled bptype %d"), (int) bptype);
+ internal_error (_ ("bpstat_what: unhandled bptype %d"),
+ (int) bptype);
}
retval.main_action = std::max (retval.main_action, this_action);
@@ -6050,8 +5975,6 @@ bpstat_causes_stop (bpstat *bs)
return false;
}
-
-
/* Compute a number of spaces suitable to indent the next line
so it starts at the position corresponding to the table column
named COL_NAME in the currently active table of UIOUT. */
@@ -6136,8 +6059,7 @@ bp_location_condition_evaluator (const struct bp_location *bl)
/* Print the LOC location out of the list of B->LOC locations. */
static void
-print_breakpoint_location (const breakpoint *b,
- struct bp_location *loc)
+print_breakpoint_location (const breakpoint *b, struct bp_location *loc)
{
struct ui_out *uiout = current_uiout;
@@ -6171,15 +6093,14 @@ print_breakpoint_location (const breakpoint *b,
if (uiout->is_mi_like_p ())
uiout->field_string ("fullname", symtab_to_fullname (loc->symtab));
-
+
uiout->field_signed ("line", loc->line_number);
}
else if (loc)
{
string_file stb;
- print_address_symbolic (loc->gdbarch, loc->address, &stb,
- demangle, "");
+ print_address_symbolic (loc->gdbarch, loc->address, &stb, demangle, "");
uiout->field_stream ("at", stb);
}
else
@@ -6213,52 +6134,51 @@ static const char *
bptype_string (enum bptype type)
{
struct ep_type_description
- {
- enum bptype type;
- const char *description;
- };
- static struct ep_type_description bptypes[] =
{
- {bp_none, "?deleted?"},
- {bp_breakpoint, "breakpoint"},
- {bp_hardware_breakpoint, "hw breakpoint"},
- {bp_single_step, "sw single-step"},
- {bp_until, "until"},
- {bp_finish, "finish"},
- {bp_watchpoint, "watchpoint"},
- {bp_hardware_watchpoint, "hw watchpoint"},
- {bp_read_watchpoint, "read watchpoint"},
- {bp_access_watchpoint, "acc watchpoint"},
- {bp_longjmp, "longjmp"},
- {bp_longjmp_resume, "longjmp resume"},
- {bp_longjmp_call_dummy, "longjmp for call dummy"},
- {bp_exception, "exception"},
- {bp_exception_resume, "exception resume"},
- {bp_step_resume, "step resume"},
- {bp_hp_step_resume, "high-priority step resume"},
- {bp_watchpoint_scope, "watchpoint scope"},
- {bp_call_dummy, "call dummy"},
- {bp_std_terminate, "std::terminate"},
- {bp_shlib_event, "shlib events"},
- {bp_thread_event, "thread events"},
- {bp_overlay_event, "overlay events"},
- {bp_longjmp_master, "longjmp master"},
- {bp_std_terminate_master, "std::terminate master"},
- {bp_exception_master, "exception master"},
- {bp_catchpoint, "catchpoint"},
- {bp_tracepoint, "tracepoint"},
- {bp_fast_tracepoint, "fast tracepoint"},
- {bp_static_tracepoint, "static tracepoint"},
- {bp_static_marker_tracepoint, "static marker tracepoint"},
- {bp_dprintf, "dprintf"},
- {bp_jit_event, "jit events"},
- {bp_gnu_ifunc_resolver, "STT_GNU_IFUNC resolver"},
- {bp_gnu_ifunc_resolver_return, "STT_GNU_IFUNC resolver return"},
+ enum bptype type;
+ const char *description;
+ };
+ static struct ep_type_description bptypes[] = {
+ { bp_none, "?deleted?" },
+ { bp_breakpoint, "breakpoint" },
+ { bp_hardware_breakpoint, "hw breakpoint" },
+ { bp_single_step, "sw single-step" },
+ { bp_until, "until" },
+ { bp_finish, "finish" },
+ { bp_watchpoint, "watchpoint" },
+ { bp_hardware_watchpoint, "hw watchpoint" },
+ { bp_read_watchpoint, "read watchpoint" },
+ { bp_access_watchpoint, "acc watchpoint" },
+ { bp_longjmp, "longjmp" },
+ { bp_longjmp_resume, "longjmp resume" },
+ { bp_longjmp_call_dummy, "longjmp for call dummy" },
+ { bp_exception, "exception" },
+ { bp_exception_resume, "exception resume" },
+ { bp_step_resume, "step resume" },
+ { bp_hp_step_resume, "high-priority step resume" },
+ { bp_watchpoint_scope, "watchpoint scope" },
+ { bp_call_dummy, "call dummy" },
+ { bp_std_terminate, "std::terminate" },
+ { bp_shlib_event, "shlib events" },
+ { bp_thread_event, "thread events" },
+ { bp_overlay_event, "overlay events" },
+ { bp_longjmp_master, "longjmp master" },
+ { bp_std_terminate_master, "std::terminate master" },
+ { bp_exception_master, "exception master" },
+ { bp_catchpoint, "catchpoint" },
+ { bp_tracepoint, "tracepoint" },
+ { bp_fast_tracepoint, "fast tracepoint" },
+ { bp_static_tracepoint, "static tracepoint" },
+ { bp_static_marker_tracepoint, "static marker tracepoint" },
+ { bp_dprintf, "dprintf" },
+ { bp_jit_event, "jit events" },
+ { bp_gnu_ifunc_resolver, "STT_GNU_IFUNC resolver" },
+ { bp_gnu_ifunc_resolver_return, "STT_GNU_IFUNC resolver return" },
};
if (((int) type >= (sizeof (bptypes) / sizeof (bptypes[0])))
|| ((int) type != bptypes[(int) type].type))
- internal_error (_("bptypes table does not describe type #%d."),
+ internal_error (_ ("bptypes table does not describe type #%d."),
(int) type);
return bptypes[(int) type].description;
@@ -6268,10 +6188,8 @@ bptype_string (enum bptype type)
For CLI, prefix the list with the string 'inf'. */
static void
-output_thread_groups (struct ui_out *uiout,
- const char *field_name,
- const std::vector<int> &inf_nums,
- int mi_only)
+output_thread_groups (struct ui_out *uiout, const char *field_name,
+ const std::vector<int> &inf_nums, int mi_only)
{
int is_mi = uiout->is_mi_like_p ();
@@ -6297,7 +6215,7 @@ output_thread_groups (struct ui_out *uiout,
uiout->text (" inf ");
else
uiout->text (", ");
-
+
uiout->text (plongest (inf_nums[i]));
}
}
@@ -6315,10 +6233,8 @@ bool fix_breakpoint_script_output_globally = false;
print_one method did something; false otherwise. */
static bool
-print_one_breakpoint_location (struct breakpoint *b,
- struct bp_location *loc,
- int loc_number,
- struct bp_location **last_loc,
+print_one_breakpoint_location (struct breakpoint *b, struct bp_location *loc,
+ int loc_number, struct bp_location **last_loc,
int allflag, bool raw_loc)
{
struct command_line *l;
@@ -6334,10 +6250,10 @@ print_one_breakpoint_location (struct breakpoint *b,
gdb_assert (!loc || loc_number != 0);
/* See comment in print_one_breakpoint concerning treatment of
breakpoints with single disabled location. */
- if (loc == NULL
- && (b->loc != NULL
- && (b->loc->next != NULL
- || !b->loc->enabled || b->loc->disabled_by_cond)))
+ if (loc == NULL
+ && (b->loc != NULL
+ && (b->loc->next != NULL || !b->loc->enabled
+ || b->loc->disabled_by_cond)))
header_of_multiple = true;
if (loc == NULL)
loc = b->loc;
@@ -6374,29 +6290,28 @@ print_one_breakpoint_location (struct breakpoint *b,
footnote below the table. For MI, simply display a "N"
without a footnote. On the CLI, for enabled locations whose
breakpoint is disabled, display "y-". */
- auto get_enable_state = [uiout, loc] () -> const char *
- {
- if (uiout->is_mi_like_p ())
- {
- if (loc->disabled_by_cond)
- return "N";
- else if (!loc->enabled)
- return "n";
- else
- return "y";
- }
- else
- {
- if (loc->disabled_by_cond)
- return "N*";
- else if (!loc->enabled)
- return "n";
- else if (!breakpoint_enabled (loc->owner))
- return "y-";
- else
- return "y";
- }
- };
+ auto get_enable_state = [uiout, loc] () -> const char * {
+ if (uiout->is_mi_like_p ())
+ {
+ if (loc->disabled_by_cond)
+ return "N";
+ else if (!loc->enabled)
+ return "n";
+ else
+ return "y";
+ }
+ else
+ {
+ if (loc->disabled_by_cond)
+ return "N*";
+ else if (!loc->enabled)
+ return "n";
+ else if (!breakpoint_enabled (loc->owner))
+ return "y-";
+ else
+ return "y";
+ }
+ };
uiout->field_string ("enabled", get_enable_state ());
}
else
@@ -6433,8 +6348,7 @@ print_one_breakpoint_location (struct breakpoint *b,
uiout->field_string ("addr", "<PENDING>",
metadata_style.style ());
else
- uiout->field_core_addr ("addr",
- loc->gdbarch, loc->address);
+ uiout->field_core_addr ("addr", loc->gdbarch, loc->address);
}
annotate_field (5);
if (!header_of_multiple)
@@ -6455,15 +6369,14 @@ print_one_breakpoint_location (struct breakpoint *b,
inf_nums.push_back (inf->num);
}
- /* For backward compatibility, don't display inferiors in CLI unless
+ /* For backward compatibility, don't display inferiors in CLI unless
there are several. Always display for MI. */
- if (allflag
- || (!gdbarch_has_global_breakpoints (target_gdbarch ())
- && (program_spaces.size () > 1
- || number_of_inferiors () > 1)
- /* LOC is for existing B, it cannot be in
+ if (allflag
+ || (!gdbarch_has_global_breakpoints (target_gdbarch ())
+ && (program_spaces.size () > 1 || number_of_inferiors () > 1)
+ /* LOC is for existing B, it cannot be in
moribund_locations and thus having NULL OWNER. */
- && loc->owner->type != bp_catchpoint))
+ && loc->owner->type != bp_catchpoint))
mi_only = 0;
output_thread_groups (uiout, "thread-groups", inf_nums, mi_only);
}
@@ -6494,11 +6407,10 @@ print_one_breakpoint_location (struct breakpoint *b,
uiout->text ("\tstop only in stack frame at ");
/* FIXME: cagney/2002-12-01: Shouldn't be poking around inside
the frame ID. */
- uiout->field_core_addr ("frame",
- b->gdbarch, b->frame_id.stack_addr);
+ uiout->field_core_addr ("frame", b->gdbarch, b->frame_id.stack_addr);
uiout->text ("\n");
}
-
+
if (!part_of_multiple && b->cond_string)
{
annotate_field (7);
@@ -6512,7 +6424,7 @@ print_one_breakpoint_location (struct breakpoint *b,
evaluation. If GDB is doing the evaluation, don't print anything. */
if (is_breakpoint (b)
&& breakpoint_condition_evaluation_mode ()
- == condition_evaluation_target)
+ == condition_evaluation_target)
{
uiout->message (" (%pF evals)",
string_field ("evaluated-by",
@@ -6610,9 +6522,8 @@ print_one_breakpoint_location (struct breakpoint *b,
{
annotate_field (9);
- bool use_fixed_output =
- (uiout->test_flags (fix_breakpoint_script_output)
- || fix_breakpoint_script_output_globally);
+ bool use_fixed_output = (uiout->test_flags (fix_breakpoint_script_output)
+ || fix_breakpoint_script_output_globally);
gdb::optional<ui_out_emit_tuple> tuple_emitter;
gdb::optional<ui_out_emit_list> list_emitter;
@@ -6644,8 +6555,7 @@ print_one_breakpoint_location (struct breakpoint *b,
annotate_field (11);
if (uiout->is_mi_like_p ())
- uiout->field_string ("installed",
- loc->inserted ? "y" : "n");
+ uiout->field_string ("installed", loc->inserted ? "y" : "n");
else
{
if (loc->inserted)
@@ -6681,8 +6591,7 @@ print_one_breakpoint_location (struct breakpoint *b,
bool fix_multi_location_breakpoint_output_globally = false;
static void
-print_one_breakpoint (struct breakpoint *b,
- struct bp_location **last_loc,
+print_one_breakpoint (struct breakpoint *b, struct bp_location **last_loc,
int allflag)
{
struct ui_out *uiout = current_uiout;
@@ -6690,9 +6599,10 @@ print_one_breakpoint (struct breakpoint *b,
= (uiout->test_flags (fix_multi_location_breakpoint_output)
|| fix_multi_location_breakpoint_output_globally);
- gdb::optional<ui_out_emit_tuple> bkpt_tuple_emitter (gdb::in_place, uiout, "bkpt");
- bool printed = print_one_breakpoint_location (b, NULL, 0, last_loc,
- allflag, false);
+ gdb::optional<ui_out_emit_tuple> bkpt_tuple_emitter (gdb::in_place, uiout,
+ "bkpt");
+ bool printed
+ = print_one_breakpoint_location (b, NULL, 0, last_loc, allflag, false);
/* The mi2 broken format: the main breakpoint tuple ends here, the locations
are outside. */
@@ -6720,9 +6630,9 @@ print_one_breakpoint (struct breakpoint *b,
&& (!is_catchpoint (b) || is_exception_catchpoint (b)
|| is_ada_exception_catchpoint (b))
&& (allflag
- || (b->loc && (b->loc->next
- || !b->loc->enabled
- || b->loc->disabled_by_cond))))
+ || (b->loc
+ && (b->loc->next || !b->loc->enabled
+ || b->loc->disabled_by_cond))))
{
gdb::optional<ui_out_emit_list> locations_list;
@@ -6736,8 +6646,8 @@ print_one_breakpoint (struct breakpoint *b,
for (bp_location *loc : b->locations ())
{
ui_out_emit_tuple loc_tuple_emitter (uiout, NULL);
- print_one_breakpoint_location (b, loc, n, last_loc,
- allflag, allflag);
+ print_one_breakpoint_location (b, loc, n, last_loc, allflag,
+ allflag);
n++;
}
}
@@ -6851,8 +6761,7 @@ breakpoint_1 (const char *bp_num_list, bool show_internal,
}
{
- ui_out_emit_table table_emitter (uiout,
- opts.addressprint ? 6 : 5,
+ ui_out_emit_table table_emitter (uiout, opts.addressprint ? 6 : 5,
nr_printable_breakpoints,
"BreakpointTable");
@@ -6863,7 +6772,8 @@ breakpoint_1 (const char *bp_num_list, bool show_internal,
uiout->table_header (7, ui_left, "number", "Num"); /* 1 */
if (nr_printable_breakpoints > 0)
annotate_field (1);
- uiout->table_header (print_type_col_width, ui_left, "type", "Type"); /* 2 */
+ uiout->table_header (print_type_col_width, ui_left, "type",
+ "Type"); /* 2 */
if (nr_printable_breakpoints > 0)
annotate_field (2);
uiout->table_header (4, ui_left, "disp", "Disp"); /* 3 */
@@ -6898,12 +6808,12 @@ breakpoint_1 (const char *bp_num_list, bool show_internal,
if (bp_num_list != NULL && *bp_num_list != '\0')
{
- if (show_internal) /* maintenance info breakpoint */
+ if (show_internal) /* maintenance info breakpoint */
{
if (parse_and_eval_long (bp_num_list) != b->number)
continue;
}
- else /* all others */
+ else /* all others */
{
if (!number_is_in_list (bp_num_list, b->number))
continue;
@@ -6940,8 +6850,8 @@ breakpoint_1 (const char *bp_num_list, bool show_internal,
set_next_address (last_loc->gdbarch, last_loc->address);
if (has_disabled_by_cond_location && !uiout->is_mi_like_p ())
- uiout->message (_("(*): Breakpoint condition is invalid at this "
- "location.\n"));
+ uiout->message (_ ("(*): Breakpoint condition is invalid at this "
+ "location.\n"));
}
/* FIXME? Should this be moved up so that it is only called when
@@ -6971,7 +6881,7 @@ default_collect_info (void)
uiout->field_string ("default-collect", default_collect);
uiout->text (" \n");
}
-
+
static void
info_breakpoints_command (const char *args, int from_tty)
{
@@ -7004,14 +6914,12 @@ maintenance_info_breakpoints (const char *args, int from_tty)
}
static bool
-breakpoint_has_pc (struct breakpoint *b,
- struct program_space *pspace,
+breakpoint_has_pc (struct breakpoint *b, struct program_space *pspace,
CORE_ADDR pc, struct obj_section *section)
{
for (bp_location *bl : b->locations ())
{
- if (bl->pspace == pspace
- && bl->address == pc
+ if (bl->pspace == pspace && bl->address == pc
&& (!overlay_debugging || bl->section == section))
return true;
}
@@ -7028,17 +6936,18 @@ describe_other_breakpoints (struct gdbarch *gdbarch,
int others = 0;
for (breakpoint *b : all_breakpoints ())
- others += (user_breakpoint_p (b)
- && breakpoint_has_pc (b, pspace, pc, section));
+ others
+ += (user_breakpoint_p (b) && breakpoint_has_pc (b, pspace, pc, section));
if (others > 0)
{
if (others == 1)
- gdb_printf (_("Note: breakpoint "));
+ gdb_printf (_ ("Note: breakpoint "));
else /* if (others == ???) */
- gdb_printf (_("Note: breakpoints "));
+ gdb_printf (_ ("Note: breakpoints "));
for (breakpoint *b : all_breakpoints ())
- if (user_breakpoint_p (b) && breakpoint_has_pc (b, pspace, pc, section))
+ if (user_breakpoint_p (b)
+ && breakpoint_has_pc (b, pspace, pc, section))
{
others--;
gdb_printf ("%d", b->number);
@@ -7049,17 +6958,15 @@ describe_other_breakpoints (struct gdbarch *gdbarch,
gdb_printf ("%s%s ",
((b->enable_state == bp_disabled
|| b->enable_state == bp_call_disabled)
- ? " (disabled)"
- : ""),
- (others > 1) ? ","
- : ((others == 1) ? " and" : ""));
+ ? " (disabled)"
+ : ""),
+ (others > 1) ? "," : ((others == 1) ? " and" : ""));
}
- current_uiout->message (_("also set at pc %ps.\n"),
+ current_uiout->message (_ ("also set at pc %ps.\n"),
styled_string (address_style.style (),
paddress (gdbarch, pc)));
}
}
-
/* Return true iff it is meaningful to use the address member of LOC.
For some breakpoint types, the locations' address members are
@@ -7099,12 +7006,11 @@ watchpoint_locations_match (const struct bp_location *loc1,
true, not giving a chance for GDB to check the condition of the
other watchpoint. */
if ((w1->cond_exp
- && target_can_accel_watchpoint_condition (loc1->address,
- loc1->length,
+ && target_can_accel_watchpoint_condition (loc1->address, loc1->length,
loc1->watchpoint_type,
w1->cond_exp.get ()))
|| (w2->cond_exp
- && target_can_accel_watchpoint_condition (loc2->address,
+ && target_can_accel_watchpoint_condition (loc2->address,
loc2->length,
loc2->watchpoint_type,
w2->cond_exp.get ())))
@@ -7118,8 +7024,7 @@ watchpoint_locations_match (const struct bp_location *loc1,
become hw_access locations later. */
return (loc1->owner->type == loc2->owner->type
&& loc1->pspace->aspace == loc2->pspace->aspace
- && loc1->address == loc2->address
- && loc1->length == loc2->length);
+ && loc1->address == loc2->address && loc1->length == loc2->length);
}
/* See breakpoint.h. */
@@ -7139,8 +7044,7 @@ breakpoint_address_match (const address_space *aspace1, CORE_ADDR addr1,
space doesn't really matter. */
static bool
-breakpoint_address_match_range (const address_space *aspace1,
- CORE_ADDR addr1,
+breakpoint_address_match_range (const address_space *aspace1, CORE_ADDR addr1,
int len1, const address_space *aspace2,
CORE_ADDR addr2)
{
@@ -7156,15 +7060,13 @@ breakpoint_address_match_range (const address_space *aspace1,
static bool
breakpoint_location_address_match (struct bp_location *bl,
- const address_space *aspace,
- CORE_ADDR addr)
+ const address_space *aspace, CORE_ADDR addr)
{
- return (breakpoint_address_match (bl->pspace->aspace, bl->address,
- aspace, addr)
- || (bl->length
- && breakpoint_address_match_range (bl->pspace->aspace,
- bl->address, bl->length,
- aspace, addr)));
+ return (
+ breakpoint_address_match (bl->pspace->aspace, bl->address, aspace, addr)
+ || (bl->length
+ && breakpoint_address_match_range (bl->pspace->aspace, bl->address,
+ bl->length, aspace, addr)));
}
/* Returns true if the [ADDR,ADDR+LEN) range in ASPACE overlaps
@@ -7237,7 +7139,7 @@ breakpoint_locations_match (const struct bp_location *loc1,
breakpoints. Keep this in sync with
bp_location_is_less_than. */
return (breakpoint_address_match (loc1->pspace->aspace, loc1->address,
- loc2->pspace->aspace, loc2->address)
+ loc2->pspace->aspace, loc2->address)
&& (loc1->loc_type == loc2->loc_type || sw_hw_bps_match)
&& loc1->length == loc2->length);
}
@@ -7254,10 +7156,10 @@ breakpoint_adjustment_warning (CORE_ADDR from_addr, CORE_ADDR to_addr,
strcpy (astr1, hex_string_custom ((unsigned long) from_addr, 8));
strcpy (astr2, hex_string_custom ((unsigned long) to_addr, 8));
if (have_bnum)
- warning (_("Breakpoint %d address previously adjusted from %s to %s."),
+ warning (_ ("Breakpoint %d address previously adjusted from %s to %s."),
bnum, astr1, astr2);
else
- warning (_("Breakpoint address adjusted from %s to %s."), astr1, astr2);
+ warning (_ ("Breakpoint address adjusted from %s to %s."), astr1, astr2);
}
/* Adjust a breakpoint's address to account for architectural
@@ -7266,16 +7168,13 @@ breakpoint_adjustment_warning (CORE_ADDR from_addr, CORE_ADDR to_addr,
targets, this function is simply the identity function. */
static CORE_ADDR
-adjust_breakpoint_address (struct gdbarch *gdbarch,
- CORE_ADDR bpaddr, enum bptype bptype,
- struct program_space *pspace)
+adjust_breakpoint_address (struct gdbarch *gdbarch, CORE_ADDR bpaddr,
+ enum bptype bptype, struct program_space *pspace)
{
gdb_assert (pspace != nullptr);
- if (bptype == bp_watchpoint
- || bptype == bp_hardware_watchpoint
- || bptype == bp_read_watchpoint
- || bptype == bp_access_watchpoint
+ if (bptype == bp_watchpoint || bptype == bp_hardware_watchpoint
+ || bptype == bp_read_watchpoint || bptype == bp_access_watchpoint
|| bptype == bp_catchpoint)
{
/* Watchpoints and the various bp_catch_* eventpoints should not
@@ -7368,7 +7267,7 @@ bp_location_from_bp_type (bptype type)
case bp_static_marker_tracepoint:
return bp_loc_other;
default:
- internal_error (_("unknown breakpoint type"));
+ internal_error (_ ("unknown breakpoint type"));
}
}
@@ -7390,8 +7289,7 @@ bp_location::bp_location (breakpoint *owner, bp_loc_type type)
}
bp_location::bp_location (breakpoint *owner)
- : bp_location::bp_location (owner,
- bp_location_from_bp_type (owner->type))
+ : bp_location::bp_location (owner, bp_location_from_bp_type (owner->type))
{
}
@@ -7450,8 +7348,8 @@ set_breakpoint_location_function (struct bp_location *loc)
function_name = loc->msymbol->linkage_name ();
- if (b->type == bp_breakpoint && b->loc == loc
- && loc->next == NULL && b->related_breakpoint == b)
+ if (b->type == bp_breakpoint && b->loc == loc && loc->next == NULL
+ && b->related_breakpoint == b)
{
/* Create only the whole new breakpoint of this type but do not
mess more complicated breakpoints with multiple locations. */
@@ -7496,10 +7394,10 @@ set_longjmp_breakpoint (struct thread_info *tp, struct frame_id frame)
clones of those and enable them for the requested thread. */
for (breakpoint *b : all_breakpoints_safe ())
if (b->pspace == current_program_space
- && (b->type == bp_longjmp_master
- || b->type == bp_exception_master))
+ && (b->type == bp_longjmp_master || b->type == bp_exception_master))
{
- enum bptype type = b->type == bp_longjmp_master ? bp_longjmp : bp_exception;
+ enum bptype type
+ = b->type == bp_longjmp_master ? bp_longjmp : bp_exception;
/* longjmp_breakpoint_ops ensures INITIATING_FRAME is cleared again
after their removal. */
momentary_breakpoint_from_master (b, type, 1, thread);
@@ -7546,8 +7444,8 @@ set_longjmp_breakpoint_for_call_dummy (void)
{
int thread = inferior_thread ()->global_num;
breakpoint *new_b
- = momentary_breakpoint_from_master (b, bp_longjmp_call_dummy,
- 1, thread);
+ = momentary_breakpoint_from_master (b, bp_longjmp_call_dummy, 1,
+ thread);
/* Link NEW_B into the chain of RETVAL breakpoints. */
@@ -7614,7 +7512,7 @@ check_longjmp_breakpoint_for_call_dummy (struct thread_info *tp)
original dummy frame, hence frame_id_inner can't be used. See
the comments on frame_id_inner for more details. */
bool unwind_finished_unexpectedly = false;
- for (frame_info_ptr fi = get_current_frame (); fi != nullptr; )
+ for (frame_info_ptr fi = get_current_frame (); fi != nullptr;)
{
frame_info_ptr prev = get_prev_frame (fi);
if (prev == nullptr)
@@ -7707,10 +7605,10 @@ create_thread_event_breakpoint (struct gdbarch *gdbarch, CORE_ADDR address)
}
struct lang_and_radix
- {
- enum language lang;
- int radix;
- };
+{
+ enum language lang;
+ int radix;
+};
/* Create a breakpoint for JIT code registration and unregistration. */
@@ -7726,8 +7624,7 @@ void
remove_jit_event_breakpoints (void)
{
for (breakpoint *b : all_breakpoints_safe ())
- if (b->type == bp_jit_event
- && b->loc->pspace == current_program_space)
+ if (b->type == bp_jit_event && b->loc->pspace == current_program_space)
delete_breakpoint (b);
}
@@ -7735,8 +7632,7 @@ void
remove_solib_event_breakpoints (void)
{
for (breakpoint *b : all_breakpoints_safe ())
- if (b->type == bp_shlib_event
- && b->loc->pspace == current_program_space)
+ if (b->type == bp_shlib_event && b->loc->pspace == current_program_space)
delete_breakpoint (b);
}
@@ -7746,8 +7642,7 @@ void
remove_solib_event_breakpoints_at_next_stop (void)
{
for (breakpoint *b : all_breakpoints_safe ())
- if (b->type == bp_shlib_event
- && b->loc->pspace == current_program_space)
+ if (b->type == bp_shlib_event && b->loc->pspace == current_program_space)
b->disposition = disp_del_at_next_stop;
}
@@ -7775,7 +7670,8 @@ create_solib_event_breakpoint (struct gdbarch *gdbarch, CORE_ADDR address)
/* See breakpoint.h. */
struct breakpoint *
-create_and_insert_solib_event_breakpoint (struct gdbarch *gdbarch, CORE_ADDR address)
+create_and_insert_solib_event_breakpoint (struct gdbarch *gdbarch,
+ CORE_ADDR address)
{
struct breakpoint *b;
@@ -7806,14 +7702,10 @@ disable_breakpoints_in_shlibs (void)
becomes enabled, or the duplicate is removed, gdb will try to
insert all breakpoints. If we don't set shlib_disabled here,
we'll try to insert those breakpoints and fail. */
- if (((b->type == bp_breakpoint)
- || (b->type == bp_jit_event)
- || (b->type == bp_hardware_breakpoint)
- || (is_tracepoint (b)))
- && loc->pspace == current_program_space
- && !loc->shlib_disabled
- && solib_name_from_address (loc->pspace, loc->address)
- )
+ if (((b->type == bp_breakpoint) || (b->type == bp_jit_event)
+ || (b->type == bp_hardware_breakpoint) || (is_tracepoint (b)))
+ && loc->pspace == current_program_space && !loc->shlib_disabled
+ && solib_name_from_address (loc->pspace, loc->address))
{
loc->shlib_disabled = 1;
}
@@ -7834,10 +7726,8 @@ disable_breakpoints_in_unloaded_shlib (struct so_list *solib)
/* ALL_BP_LOCATIONS bp_location has LOC->OWNER always non-NULL. */
struct breakpoint *b = loc->owner;
- if (solib->pspace == loc->pspace
- && !loc->shlib_disabled
- && (((b->type == bp_breakpoint
- || b->type == bp_jit_event
+ if (solib->pspace == loc->pspace && !loc->shlib_disabled
+ && (((b->type == bp_breakpoint || b->type == bp_jit_event
|| b->type == bp_hardware_breakpoint)
&& (loc->loc_type == bp_loc_hardware_breakpoint
|| loc->loc_type == bp_loc_software_breakpoint))
@@ -7856,8 +7746,8 @@ disable_breakpoints_in_unloaded_shlib (struct so_list *solib)
if (!disabled_shlib_breaks)
{
target_terminal::ours_for_output ();
- warning (_("Temporarily disabling breakpoints "
- "for unloaded shared library \"%s\""),
+ warning (_ ("Temporarily disabling breakpoints "
+ "for unloaded shared library \"%s\""),
solib->so_name);
}
disabled_shlib_breaks = true;
@@ -7944,9 +7834,8 @@ breakpoint::breakpoint (struct gdbarch *gdbarch_, enum bptype bptype,
gdbarch (gdbarch_),
language (current_language->la_language),
input_radix (::input_radix),
- cond_string (cond_string_ != nullptr
- ? make_unique_xstrdup (cond_string_)
- : nullptr),
+ cond_string (cond_string_ != nullptr ? make_unique_xstrdup (cond_string_)
+ : nullptr),
related_breakpoint (this)
{
}
@@ -7963,7 +7852,8 @@ catchpoint::catchpoint (struct gdbarch *gdbarch, bool temp,
}
breakpoint *
-install_breakpoint (int internal, std::unique_ptr<breakpoint> &&arg, int update_gll)
+install_breakpoint (int internal, std::unique_ptr<breakpoint> &&arg,
+ int update_gll)
{
breakpoint *b = add_to_breakpoint_chain (std::move (arg));
set_breakpoint_number (internal, b);
@@ -8023,8 +7913,8 @@ hw_watchpoint_use_count (struct breakpoint *b)
types _not_ TYPE. */
static int
-hw_watchpoint_used_count_others (struct breakpoint *except,
- enum bptype type, int *other_type_used)
+hw_watchpoint_used_count_others (struct breakpoint *except, enum bptype type,
+ int *other_type_used)
{
int i = 0;
@@ -8086,11 +7976,10 @@ enable_breakpoints_after_startup (void)
template<typename... Arg>
static momentary_breakpoint *
new_momentary_breakpoint (struct gdbarch *gdbarch, enum bptype type,
- Arg&&... args)
+ Arg &&...args)
{
if (type == bp_longjmp || type == bp_exception)
- return new longjmp_breakpoint (gdbarch, type,
- std::forward<Arg> (args)...);
+ return new longjmp_breakpoint (gdbarch, type, std::forward<Arg> (args)...);
else
return new momentary_breakpoint (gdbarch, type,
std::forward<Arg> (args)...);
@@ -8108,9 +7997,8 @@ set_momentary_breakpoint (struct gdbarch *gdbarch, struct symtab_and_line sal,
tail-called one. */
gdb_assert (!frame_id_artificial_p (frame_id));
- std::unique_ptr<momentary_breakpoint> b
- (new_momentary_breakpoint (gdbarch, type, sal.pspace, frame_id,
- inferior_thread ()->global_num));
+ std::unique_ptr<momentary_breakpoint> b (new_momentary_breakpoint (
+ gdbarch, type, sal.pspace, frame_id, inferior_thread ()->global_num));
b->add_location (sal);
@@ -8126,14 +8014,11 @@ set_momentary_breakpoint (struct gdbarch *gdbarch, struct symtab_and_line sal,
breakpoint_ops, and will set enabled to LOC_ENABLED. */
static struct breakpoint *
-momentary_breakpoint_from_master (struct breakpoint *orig,
- enum bptype type,
- int loc_enabled,
- int thread)
-{
- std::unique_ptr<breakpoint> copy
- (new_momentary_breakpoint (orig->gdbarch, type, orig->pspace,
- orig->frame_id, thread));
+momentary_breakpoint_from_master (struct breakpoint *orig, enum bptype type,
+ int loc_enabled, int thread)
+{
+ std::unique_ptr<breakpoint> copy (new_momentary_breakpoint (
+ orig->gdbarch, type, orig->pspace, orig->frame_id, thread));
copy->loc = copy->allocate_location ();
set_breakpoint_location_function (copy->loc);
@@ -8162,8 +8047,7 @@ clone_momentary_breakpoint (struct breakpoint *orig)
if (orig == NULL)
return NULL;
- return momentary_breakpoint_from_master (orig, orig->type, 0,
- orig->thread);
+ return momentary_breakpoint_from_master (orig, orig->type, 0, orig->thread);
}
breakpoint_up
@@ -8179,7 +8063,6 @@ set_momentary_breakpoint_at_pc (struct gdbarch *gdbarch, CORE_ADDR pc,
return set_momentary_breakpoint (gdbarch, sal, null_frame_id, type);
}
-
/* Tell the user we have just set a breakpoint B. */
@@ -8189,7 +8072,6 @@ mention (const breakpoint *b)
b->print_mention ();
current_uiout->text ("\n");
}
-
static bool bp_loc_is_permanent (struct bp_location *loc);
@@ -8237,9 +8119,9 @@ handle_automatic_hardware_breakpoints (bp_location *bl)
bl->loc_type = new_type;
if (!said)
{
- gdb_printf (_("Note: automatically using "
- "hardware breakpoints for "
- "read-only addresses.\n"));
+ gdb_printf (_ ("Note: automatically using "
+ "hardware breakpoints for "
+ "read-only addresses.\n"));
said = true;
}
}
@@ -8263,9 +8145,8 @@ code_breakpoint::add_location (const symtab_and_line &sal)
breakpoint may cause target_read_memory() to be called and we do
not want its scan of the location chain to find a breakpoint and
location that's only been partially initialized. */
- adjusted_address = adjust_breakpoint_address (loc_gdbarch,
- sal.pc, type,
- sal.pspace);
+ adjusted_address
+ = adjust_breakpoint_address (loc_gdbarch, sal.pc, type, sal.pspace);
/* Sort the locations by their ADDRESS. */
new_loc = allocate_location ();
@@ -8309,7 +8190,6 @@ code_breakpoint::add_location (const symtab_and_line &sal)
return new_loc;
}
-
/* Return true if LOC is pointing to a permanent breakpoint,
return false otherwise. */
@@ -8353,24 +8233,22 @@ update_dprintf_command_list (struct breakpoint *b)
dprintf_args = skip_spaces (dprintf_args);
if (*dprintf_args != '"')
- error (_("Bad format string, missing '\"'."));
+ error (_ ("Bad format string, missing '\"'."));
if (strcmp (dprintf_style, dprintf_style_gdb) == 0)
printf_line = xstrprintf ("printf %s", dprintf_args);
else if (strcmp (dprintf_style, dprintf_style_call) == 0)
{
if (dprintf_function.empty ())
- error (_("No function supplied for dprintf call"));
+ error (_ ("No function supplied for dprintf call"));
if (!dprintf_channel.empty ())
- printf_line = xstrprintf ("call (void) %s (%s,%s)",
- dprintf_function.c_str (),
- dprintf_channel.c_str (),
- dprintf_args);
+ printf_line
+ = xstrprintf ("call (void) %s (%s,%s)", dprintf_function.c_str (),
+ dprintf_channel.c_str (), dprintf_args);
else
printf_line = xstrprintf ("call (void) %s (%s)",
- dprintf_function.c_str (),
- dprintf_args);
+ dprintf_function.c_str (), dprintf_args);
}
else if (strcmp (dprintf_style, dprintf_style_agent) == 0)
{
@@ -8378,12 +8256,13 @@ update_dprintf_command_list (struct breakpoint *b)
printf_line = xstrprintf ("agent-printf %s", dprintf_args);
else
{
- warning (_("Target cannot run dprintf commands, falling back to GDB printf"));
+ warning (_ (
+ "Target cannot run dprintf commands, falling back to GDB printf"));
printf_line = xstrprintf ("printf %s", dprintf_args);
}
}
else
- internal_error (_("Invalid dprintf style."));
+ internal_error (_ ("Invalid dprintf style."));
gdb_assert (printf_line != NULL);
@@ -8403,19 +8282,17 @@ update_dprintf_commands (const char *args, int from_tty,
{
for (breakpoint *b : all_breakpoints ())
if (b->type == bp_dprintf)
- update_dprintf_command_list (b);
+ update_dprintf_command_list (b);
}
-code_breakpoint::code_breakpoint (struct gdbarch *gdbarch_,
- enum bptype type_,
+code_breakpoint::code_breakpoint (struct gdbarch *gdbarch_, enum bptype type_,
gdb::array_view<const symtab_and_line> sals,
location_spec_up &&locspec_,
gdb::unique_xmalloc_ptr<char> filter_,
gdb::unique_xmalloc_ptr<char> cond_string_,
gdb::unique_xmalloc_ptr<char> extra_string_,
- enum bpdisp disposition_,
- int thread_, int task_, int ignore_count_,
- int from_tty,
+ enum bpdisp disposition_, int thread_,
+ int task_, int ignore_count_, int from_tty,
int enabled_, unsigned flags,
int display_canonical_)
: breakpoint (gdbarch_, type_)
@@ -8427,13 +8304,13 @@ code_breakpoint::code_breakpoint (struct gdbarch *gdbarch_,
int target_resources_ok;
i = hw_breakpoint_used_count ();
- target_resources_ok =
- target_can_use_hardware_watchpoint (bp_hardware_breakpoint,
- i + 1, 0);
+ target_resources_ok
+ = target_can_use_hardware_watchpoint (bp_hardware_breakpoint, i + 1,
+ 0);
if (target_resources_ok == 0)
- error (_("No hardware breakpoint support in the target."));
+ error (_ ("No hardware breakpoint support in the target."));
else if (target_resources_ok < 0)
- error (_("Hardware breakpoints used exceeds limit."));
+ error (_ ("Hardware breakpoints used exceeds limit."));
}
gdb_assert (!sals.empty ());
@@ -8447,8 +8324,7 @@ code_breakpoint::code_breakpoint (struct gdbarch *gdbarch_,
enable_state = enabled_ ? bp_enabled : bp_disabled;
disposition = disposition_;
- if (type == bp_static_tracepoint
- || type == bp_static_marker_tracepoint)
+ if (type == bp_static_tracepoint || type == bp_static_marker_tracepoint)
{
auto *t = gdb::checked_static_cast<struct tracepoint *> (this);
struct static_tracepoint_marker marker;
@@ -8466,18 +8342,19 @@ code_breakpoint::code_breakpoint (struct gdbarch *gdbarch_,
t->static_trace_marker_id.assign (p, endp - p);
- gdb_printf (_("Probed static tracepoint marker \"%s\"\n"),
+ gdb_printf (_ ("Probed static tracepoint marker \"%s\"\n"),
t->static_trace_marker_id.c_str ());
}
else if (target_static_tracepoint_marker_at (sals[0].pc, &marker))
{
t->static_trace_marker_id = std::move (marker.str_id);
- gdb_printf (_("Probed static tracepoint marker \"%s\"\n"),
+ gdb_printf (_ ("Probed static tracepoint marker \"%s\"\n"),
t->static_trace_marker_id.c_str ());
}
else
- warning (_("Couldn't determine the static tracepoint marker to probe"));
+ warning (
+ _ ("Couldn't determine the static tracepoint marker to probe"));
}
for (const auto &sal : sals)
@@ -8488,8 +8365,8 @@ code_breakpoint::code_breakpoint (struct gdbarch *gdbarch_,
if (loc_gdbarch == nullptr)
loc_gdbarch = gdbarch;
- describe_other_breakpoints (loc_gdbarch,
- sal.pspace, sal.pc, sal.section, thread);
+ describe_other_breakpoints (loc_gdbarch, sal.pspace, sal.pc,
+ sal.section, thread);
}
bp_location *new_loc = add_location (sal);
@@ -8507,10 +8384,10 @@ code_breakpoint::code_breakpoint (struct gdbarch *gdbarch_,
if (extra_string != nullptr)
update_dprintf_command_list (this);
else
- error (_("Format string required"));
+ error (_ ("Format string required"));
}
else if (extra_string != nullptr)
- error (_("Garbage '%s' at end of command"), extra_string.get ());
+ error (_ ("Garbage '%s' at end of command"), extra_string.get ());
}
/* The order of the locations is now stable. Set the location
@@ -8519,8 +8396,8 @@ code_breakpoint::code_breakpoint (struct gdbarch *gdbarch_,
for (bp_location *bl : locations ())
{
if (cond_string != nullptr)
- set_breakpoint_location_condition (cond_string.get (), bl,
- number, loc_num);
+ set_breakpoint_location_condition (cond_string.get (), bl, number,
+ loc_num);
++loc_num;
}
@@ -8540,24 +8417,15 @@ create_breakpoint_sal (struct gdbarch *gdbarch,
gdb::unique_xmalloc_ptr<char> filter,
gdb::unique_xmalloc_ptr<char> cond_string,
gdb::unique_xmalloc_ptr<char> extra_string,
- enum bptype type, enum bpdisp disposition,
- int thread, int task, int ignore_count,
- int from_tty,
- int enabled, int internal, unsigned flags,
- int display_canonical)
+ enum bptype type, enum bpdisp disposition, int thread,
+ int task, int ignore_count, int from_tty, int enabled,
+ int internal, unsigned flags, int display_canonical)
{
std::unique_ptr<code_breakpoint> b
- = new_breakpoint_from_type (gdbarch,
- type,
- sals,
- std::move (locspec),
- std::move (filter),
- std::move (cond_string),
- std::move (extra_string),
- disposition,
- thread, task, ignore_count,
- from_tty,
- enabled, flags,
+ = new_breakpoint_from_type (gdbarch, type, sals, std::move (locspec),
+ std::move (filter), std::move (cond_string),
+ std::move (extra_string), disposition, thread,
+ task, ignore_count, from_tty, enabled, flags,
display_canonical);
install_breakpoint (internal, std::move (b), 0);
@@ -8583,10 +8451,9 @@ create_breakpoints_sal (struct gdbarch *gdbarch,
struct linespec_result *canonical,
gdb::unique_xmalloc_ptr<char> cond_string,
gdb::unique_xmalloc_ptr<char> extra_string,
- enum bptype type, enum bpdisp disposition,
- int thread, int task, int ignore_count,
- int from_tty,
- int enabled, int internal, unsigned flags)
+ enum bptype type, enum bpdisp disposition, int thread,
+ int task, int ignore_count, int from_tty, int enabled,
+ int internal, unsigned flags)
{
if (canonical->pre_expanded)
gdb_assert (canonical->lsals.size () == 1);
@@ -8596,19 +8463,16 @@ create_breakpoints_sal (struct gdbarch *gdbarch,
/* Note that 'location' can be NULL in the case of a plain
'break', without arguments. */
location_spec_up locspec
- = (canonical->locspec != nullptr
- ? canonical->locspec->clone ()
- : nullptr);
- gdb::unique_xmalloc_ptr<char> filter_string
- (lsal.canonical != NULL ? xstrdup (lsal.canonical) : NULL);
-
- create_breakpoint_sal (gdbarch, lsal.sals,
- std::move (locspec),
+ = (canonical->locspec != nullptr ? canonical->locspec->clone ()
+ : nullptr);
+ gdb::unique_xmalloc_ptr<char> filter_string (lsal.canonical != NULL
+ ? xstrdup (lsal.canonical)
+ : NULL);
+
+ create_breakpoint_sal (gdbarch, lsal.sals, std::move (locspec),
std::move (filter_string),
- std::move (cond_string),
- std::move (extra_string),
- type, disposition,
- thread, task, ignore_count,
+ std::move (cond_string), std::move (extra_string),
+ type, disposition, thread, task, ignore_count,
from_tty, enabled, internal, flags,
canonical->special_display);
}
@@ -8657,14 +8521,14 @@ parse_breakpoint_sals (location_spec *locspec,
sal.explicit_pc = 1;
struct linespec_sals lsal;
- lsal.sals = {sal};
+ lsal.sals = { sal };
lsal.canonical = NULL;
canonical->lsals.push_back (std::move (lsal));
return;
}
else
- error (_("No default breakpoint address now."));
+ error (_ ("No default breakpoint address now."));
}
}
@@ -8684,29 +8548,26 @@ parse_breakpoint_sals (location_spec *locspec,
spec = as_linespec_location_spec (locspec)->spec_string;
if (!cursal.symtab
- || (spec != NULL
- && strchr ("+-", spec[0]) != NULL
+ || (spec != NULL && strchr ("+-", spec[0]) != NULL
&& spec[1] != '['))
{
decode_line_full (locspec, DECODE_LINE_FUNFIRSTLINE, NULL,
get_last_displayed_symtab (),
- get_last_displayed_line (),
- canonical, NULL, NULL);
+ get_last_displayed_line (), canonical, NULL, NULL);
return;
}
}
- decode_line_full (locspec, DECODE_LINE_FUNFIRSTLINE, NULL,
- cursal.symtab, cursal.line, canonical, NULL, NULL);
+ decode_line_full (locspec, DECODE_LINE_FUNFIRSTLINE, NULL, cursal.symtab,
+ cursal.line, canonical, NULL, NULL);
}
-
/* Convert each SAL into a real PC. Verify that the PC can be
inserted as a breakpoint. If it can't throw an error. */
static void
breakpoint_sals_to_pc (std::vector<symtab_and_line> &sals)
-{
+{
for (auto &sal : sals)
resolve_sal_pc (&sal);
}
@@ -8733,7 +8594,7 @@ check_fast_tracepoint_sals (struct gdbarch *gdbarch,
sarch = gdbarch;
std::string msg;
if (!gdbarch_fast_tracepoint_valid_at (sarch, sal.pc, &msg))
- error (_("May not have a fast tracepoint at %s%s"),
+ error (_ ("May not have a fast tracepoint at %s%s"),
paddress (sarch, sal.pc), msg.c_str ());
}
}
@@ -8804,12 +8665,12 @@ find_condition_and_thread (const char *tok, CORE_ADDR pc,
struct thread_info *thr;
if (*thread != -1)
- error(_("You can specify only one thread."));
+ error (_ ("You can specify only one thread."));
tok = end_tok + 1;
thr = parse_thread_id (tok, &tmptok);
if (tok == tmptok)
- error (_("Junk after thread keyword."));
+ error (_ ("Junk after thread keyword."));
*thread = thr->global_num;
tok = tmptok;
}
@@ -8818,14 +8679,14 @@ find_condition_and_thread (const char *tok, CORE_ADDR pc,
char *tmptok;
if (*task != 0)
- error(_("You can specify only one task."));
+ error (_ ("You can specify only one task."));
tok = end_tok + 1;
*task = strtol (tok, &tmptok, 0);
if (tok == tmptok)
- error (_("Junk after task keyword."));
+ error (_ ("Junk after task keyword."));
if (!valid_task_id (*task))
- error (_("Unknown task %d."), *task);
+ error (_ ("Unknown task %d."), *task);
tok = tmptok;
}
else if (rest)
@@ -8834,7 +8695,7 @@ find_condition_and_thread (const char *tok, CORE_ADDR pc,
return;
}
else
- error (_("Junk at end of arguments."));
+ error (_ ("Junk at end of arguments."));
}
}
@@ -8901,7 +8762,7 @@ decode_static_tracepoint_spec (const char **arg_p)
std::vector<static_tracepoint_marker> markers
= target_static_tracepoint_markers_by_strid (marker_str.c_str ());
if (markers.empty ())
- error (_("No known static tracepoint marker named %s"),
+ error (_ ("No known static tracepoint marker named %s"),
marker_str.c_str ());
std::vector<symtab_and_line> sals;
@@ -8912,7 +8773,7 @@ decode_static_tracepoint_spec (const char **arg_p)
symtab_and_line sal = find_pc_line (marker.address, 0);
sal.pc = marker.address;
sals.push_back (sal);
- }
+ }
*arg_p = endp;
return sals;
@@ -8948,25 +8809,21 @@ breakpoint_ops_for_location_spec (const location_spec *locspec,
bool is_tracepoint)
{
if (locspec != nullptr)
- return (breakpoint_ops_for_location_spec_type
- (locspec->type (), is_tracepoint));
+ return (breakpoint_ops_for_location_spec_type (locspec->type (),
+ is_tracepoint));
return &code_breakpoint_ops;
}
/* See breakpoint.h. */
int
-create_breakpoint (struct gdbarch *gdbarch,
- location_spec *locspec,
- const char *cond_string,
- int thread, const char *extra_string,
- bool force_condition, int parse_extra,
- int tempflag, enum bptype type_wanted,
- int ignore_count,
- enum auto_boolean pending_break_support,
- const struct breakpoint_ops *ops,
- int from_tty, int enabled, int internal,
- unsigned flags)
+create_breakpoint (struct gdbarch *gdbarch, location_spec *locspec,
+ const char *cond_string, int thread,
+ const char *extra_string, bool force_condition,
+ int parse_extra, int tempflag, enum bptype type_wanted,
+ int ignore_count, enum auto_boolean pending_break_support,
+ const struct breakpoint_ops *ops, int from_tty, int enabled,
+ int internal, unsigned flags)
{
struct linespec_result canonical;
bool pending = false;
@@ -8999,9 +8856,10 @@ create_breakpoint (struct gdbarch *gdbarch,
/* If pending breakpoint support is auto query and the user
selects no, then simply return the error code. */
- if (pending_break_support == AUTO_BOOLEAN_AUTO
- && !nquery (_("Make %s pending on future shared library load? "),
- bptype_string (type_wanted)))
+ if (
+ pending_break_support == AUTO_BOOLEAN_AUTO
+ && !nquery (_ ("Make %s pending on future shared library load? "),
+ bptype_string (type_wanted)))
return 0;
/* At this point, either the user was queried about setting
@@ -9047,16 +8905,16 @@ create_breakpoint (struct gdbarch *gdbarch,
const linespec_sals &lsal = canonical.lsals[0];
- find_condition_and_thread_for_sals (lsal.sals, extra_string,
- &cond, &thread, &task, &rest);
+ find_condition_and_thread_for_sals (lsal.sals, extra_string, &cond,
+ &thread, &task, &rest);
cond_string_copy = std::move (cond);
extra_string_copy = std::move (rest);
}
else
{
- if (type_wanted != bp_dprintf
- && extra_string != NULL && *extra_string != '\0')
- error (_("Garbage '%s' at end of location"), extra_string);
+ if (type_wanted != bp_dprintf && extra_string != NULL
+ && *extra_string != '\0')
+ error (_ ("Garbage '%s' at end of location"), extra_string);
/* Check the validity of the condition. We should error out
if the condition is invalid at all of the locations and
@@ -9095,16 +8953,15 @@ create_breakpoint (struct gdbarch *gdbarch,
ops->create_breakpoints_sal (gdbarch, &canonical,
std::move (cond_string_copy),
- std::move (extra_string_copy),
- type_wanted,
+ std::move (extra_string_copy), type_wanted,
tempflag ? disp_del : disp_donttouch,
- thread, task, ignore_count,
- from_tty, enabled, internal, flags);
+ thread, task, ignore_count, from_tty,
+ enabled, internal, flags);
}
else
{
- std::unique_ptr <breakpoint> b = new_breakpoint_from_type (gdbarch,
- type_wanted);
+ std::unique_ptr<breakpoint> b
+ = new_breakpoint_from_type (gdbarch, type_wanted);
b->locspec = locspec->clone ();
if (parse_extra)
@@ -9112,31 +8969,30 @@ create_breakpoint (struct gdbarch *gdbarch,
else
{
/* Create a private copy of condition string. */
- b->cond_string.reset (cond_string != NULL
- ? xstrdup (cond_string)
- : NULL);
+ b->cond_string.reset (cond_string != NULL ? xstrdup (cond_string)
+ : NULL);
b->thread = thread;
}
/* Create a private copy of any extra string. */
- b->extra_string.reset (extra_string != NULL
- ? xstrdup (extra_string)
- : NULL);
+ b->extra_string.reset (extra_string != NULL ? xstrdup (extra_string)
+ : NULL);
b->ignore_count = ignore_count;
b->disposition = tempflag ? disp_del : disp_donttouch;
b->condition_not_parsed = 1;
b->enable_state = enabled ? bp_enabled : bp_disabled;
if ((type_wanted != bp_breakpoint
- && type_wanted != bp_hardware_breakpoint) || thread != -1)
+ && type_wanted != bp_hardware_breakpoint)
+ || thread != -1)
b->pspace = current_program_space;
install_breakpoint (internal, std::move (b), 0);
}
-
+
if (canonical.lsals.size () > 1)
{
- warning (_("Multiple breakpoints were set.\nUse the "
- "\"delete\" command to delete unwanted breakpoints."));
+ warning (_ ("Multiple breakpoints were set.\nUse the "
+ "\"delete\" command to delete unwanted breakpoints."));
prev_breakpoint_count = prev_bkpt_count;
}
@@ -9156,26 +9012,18 @@ static void
break_command_1 (const char *arg, int flag, int from_tty)
{
int tempflag = flag & BP_TEMPFLAG;
- enum bptype type_wanted = (flag & BP_HARDWAREFLAG
- ? bp_hardware_breakpoint
- : bp_breakpoint);
+ enum bptype type_wanted
+ = (flag & BP_HARDWAREFLAG ? bp_hardware_breakpoint : bp_breakpoint);
location_spec_up locspec = string_to_location_spec (&arg, current_language);
const struct breakpoint_ops *ops
= breakpoint_ops_for_location_spec (locspec.get (),
false /* is_tracepoint */);
- create_breakpoint (get_current_arch (),
- locspec.get (),
- NULL, 0, arg, false, 1 /* parse arg */,
- tempflag, type_wanted,
- 0 /* Ignore count */,
- pending_break_support,
- ops,
- from_tty,
- 1 /* enabled */,
- 0 /* internal */,
- 0);
+ create_breakpoint (get_current_arch (), locspec.get (), NULL, 0, arg, false,
+ 1 /* parse arg */, tempflag, type_wanted,
+ 0 /* Ignore count */, pending_break_support, ops,
+ from_tty, 1 /* enabled */, 0 /* internal */, 0);
}
/* Helper function for break_command_1 and disassemble_command. */
@@ -9188,8 +9036,8 @@ resolve_sal_pc (struct symtab_and_line *sal)
if (sal->pc == 0 && sal->symtab != NULL)
{
if (!find_line_pc (sal->symtab, sal->line, &pc))
- error (_("No line %d in file \"%s\"."),
- sal->line, symtab_to_filename_for_display (sal->symtab));
+ error (_ ("No line %d in file \"%s\"."), sal->line,
+ symtab_to_filename_for_display (sal->symtab));
sal->pc = pc;
/* If this SAL corresponds to a breakpoint inserted using a line
@@ -9204,8 +9052,7 @@ resolve_sal_pc (struct symtab_and_line *sal)
const struct block *b;
struct symbol *sym;
- bv = blockvector_for_pc_sect (sal->pc, 0, &b,
- sal->symtab->compunit ());
+ bv = blockvector_for_pc_sect (sal->pc, 0, &b, sal->symtab->compunit ());
if (bv != NULL)
{
sym = block_linkage_function (b);
@@ -9222,7 +9069,8 @@ resolve_sal_pc (struct symtab_and_line *sal)
scoped_restore_current_pspace_and_thread restore_pspace_thread;
switch_to_program_space_and_thread (sal->pspace);
- bound_minimal_symbol msym = lookup_minimal_symbol_by_pc (sal->pc);
+ bound_minimal_symbol msym
+ = lookup_minimal_symbol_by_pc (sal->pc);
if (msym.minsym)
sal->section = msym.obj_section ();
}
@@ -9269,7 +9117,7 @@ dprintf_command (const char *arg, int from_tty)
if (arg != NULL)
{
if (arg[0] != ',' || arg[1] == '\0')
- error (_("Format string required"));
+ error (_ ("Format string required"));
else
{
/* Skip the comma. */
@@ -9277,23 +9125,16 @@ dprintf_command (const char *arg, int from_tty)
}
}
- create_breakpoint (get_current_arch (),
- locspec.get (),
- NULL, 0, arg, false, 1 /* parse arg */,
- 0, bp_dprintf,
- 0 /* Ignore count */,
- pending_break_support,
- &code_breakpoint_ops,
- from_tty,
- 1 /* enabled */,
- 0 /* internal */,
- 0);
+ create_breakpoint (get_current_arch (), locspec.get (), NULL, 0, arg, false,
+ 1 /* parse arg */, 0, bp_dprintf, 0 /* Ignore count */,
+ pending_break_support, &code_breakpoint_ops, from_tty,
+ 1 /* enabled */, 0 /* internal */, 0);
}
static void
agent_printf_command (const char *arg, int from_tty)
{
- error (_("May only run agent-printf on the target"));
+ error (_ ("May only run agent-printf on the target"));
}
/* Implement the "breakpoint_hit" method for ranged breakpoints. */
@@ -9304,8 +9145,7 @@ ranged_breakpoint::breakpoint_hit (const struct bp_location *bl,
CORE_ADDR bp_addr,
const target_waitstatus &ws)
{
- if (ws.kind () != TARGET_WAITKIND_STOPPED
- || ws.sig () != GDB_SIGNAL_TRAP)
+ if (ws.kind () != TARGET_WAITKIND_STOPPED || ws.sig () != GDB_SIGNAL_TRAP)
return 0;
return breakpoint_address_match_range (bl->pspace->aspace, bl->address,
@@ -9344,7 +9184,7 @@ ranged_breakpoint::print_it (const bpstat *bs) const
if (uiout->is_mi_like_p ())
{
uiout->field_string ("reason",
- async_reason_lookup (EXEC_ASYNC_BREAKPOINT_HIT));
+ async_reason_lookup (EXEC_ASYNC_BREAKPOINT_HIT));
uiout->field_string ("disp", bpdisp_text (disposition));
}
print_num_locno (bs, uiout);
@@ -9393,8 +9233,7 @@ ranged_breakpoint::print_one_detail (struct ui_out *uiout) const
address_end = address_start + bl->length - 1;
uiout->text ("\taddress range: ");
- stb.printf ("[%s, %s]",
- print_core_address (bl->gdbarch, address_start),
+ stb.printf ("[%s, %s]", print_core_address (bl->gdbarch, address_start),
print_core_address (bl->gdbarch, address_end));
uiout->field_stream ("addr", stb);
uiout->text ("\n");
@@ -9411,7 +9250,7 @@ ranged_breakpoint::print_mention () const
gdb_assert (bl);
gdb_assert (type == bp_hardware_breakpoint);
- uiout->message (_("Hardware assisted ranged breakpoint %d from %s to %s."),
+ uiout->message (_ ("Hardware assisted ranged breakpoint %d from %s to %s."),
number, paddress (bl->gdbarch, bl->address),
paddress (bl->gdbarch, bl->address + bl->length - 1));
}
@@ -9421,8 +9260,7 @@ ranged_breakpoint::print_mention () const
void
ranged_breakpoint::print_recreate (struct ui_file *fp) const
{
- gdb_printf (fp, "break-range %s, %s",
- locspec->to_string (),
+ gdb_printf (fp, "break-range %s, %s", locspec->to_string (),
locspec_range_end->to_string ());
print_recreate_thread (fp);
}
@@ -9448,7 +9286,7 @@ find_breakpoint_range_end (struct symtab_and_line sal)
ret = find_line_pc_range (sal, &start, &end);
if (!ret)
- error (_("Could not find location of the end of the range."));
+ error (_ ("Could not find location of the end of the range."));
/* find_line_pc_range returns the start of the next line. */
end--;
@@ -9469,18 +9307,18 @@ break_range_command (const char *arg, int from_tty)
/* We don't support software ranged breakpoints. */
if (target_ranged_break_num_registers () < 0)
- error (_("This target does not support hardware ranged breakpoints."));
+ error (_ ("This target does not support hardware ranged breakpoints."));
bp_count = hw_breakpoint_used_count ();
bp_count += target_ranged_break_num_registers ();
- can_use_bp = target_can_use_hardware_watchpoint (bp_hardware_breakpoint,
- bp_count, 0);
+ can_use_bp
+ = target_can_use_hardware_watchpoint (bp_hardware_breakpoint, bp_count, 0);
if (can_use_bp < 0)
- error (_("Hardware breakpoints used exceeds limit."));
+ error (_ ("Hardware breakpoints used exceeds limit."));
arg = skip_spaces (arg);
if (arg == NULL || arg[0] == '\0')
- error(_("No address range specified."));
+ error (_ ("No address range specified."));
arg_start = arg;
location_spec_up start_locspec
@@ -9488,20 +9326,19 @@ break_range_command (const char *arg, int from_tty)
parse_breakpoint_sals (start_locspec.get (), &canonical_start);
if (arg[0] != ',')
- error (_("Too few arguments."));
+ error (_ ("Too few arguments."));
else if (canonical_start.lsals.empty ())
- error (_("Could not find location of the beginning of the range."));
+ error (_ ("Could not find location of the beginning of the range."));
const linespec_sals &lsal_start = canonical_start.lsals[0];
- if (canonical_start.lsals.size () > 1
- || lsal_start.sals.size () != 1)
- error (_("Cannot create a ranged breakpoint with multiple locations."));
+ if (canonical_start.lsals.size () > 1 || lsal_start.sals.size () != 1)
+ error (_ ("Cannot create a ranged breakpoint with multiple locations."));
const symtab_and_line &sal_start = lsal_start.sals[0];
std::string addr_string_start (arg_start, arg - arg_start);
- arg++; /* Skip the comma. */
+ arg++; /* Skip the comma. */
arg = skip_spaces (arg);
/* Parse the end location specification. */
@@ -9517,27 +9354,26 @@ break_range_command (const char *arg, int from_tty)
location_spec_up end_locspec
= string_to_location_spec (&arg, current_language);
decode_line_full (end_locspec.get (), DECODE_LINE_FUNFIRSTLINE, NULL,
- sal_start.symtab, sal_start.line,
- &canonical_end, NULL, NULL);
+ sal_start.symtab, sal_start.line, &canonical_end, NULL,
+ NULL);
if (canonical_end.lsals.empty ())
- error (_("Could not find location of the end of the range."));
+ error (_ ("Could not find location of the end of the range."));
const linespec_sals &lsal_end = canonical_end.lsals[0];
- if (canonical_end.lsals.size () > 1
- || lsal_end.sals.size () != 1)
- error (_("Cannot create a ranged breakpoint with multiple locations."));
+ if (canonical_end.lsals.size () > 1 || lsal_end.sals.size () != 1)
+ error (_ ("Cannot create a ranged breakpoint with multiple locations."));
const symtab_and_line &sal_end = lsal_end.sals[0];
end = find_breakpoint_range_end (sal_end);
if (sal_start.pc > end)
- error (_("Invalid address range, end precedes start."));
+ error (_ ("Invalid address range, end precedes start."));
length = end - sal_start.pc + 1;
if (length < 0)
/* Length overflowed. */
- error (_("Address range too large."));
+ error (_ ("Address range too large."));
else if (length == 1)
{
/* This range is simple enough to be handled by
@@ -9549,11 +9385,9 @@ break_range_command (const char *arg, int from_tty)
/* Now set up the breakpoint and install it. */
- std::unique_ptr<breakpoint> br
- (new ranged_breakpoint (get_current_arch (),
- sal_start, length,
- std::move (start_locspec),
- std::move (end_locspec)));
+ std::unique_ptr<breakpoint> br (new ranged_breakpoint (
+ get_current_arch (), sal_start, length, std::move (start_locspec),
+ std::move (end_locspec)));
install_breakpoint (false, std::move (br), true);
}
@@ -9638,8 +9472,7 @@ watchpoint::breakpoint_hit (const struct bp_location *bl,
in the code (not from a breakpoint) when a hardware watchpoint has
been defined. Also skip watchpoints which we know did not trigger
(did not match the data address). */
- if (is_hardware_watchpoint (b)
- && watchpoint_triggered == watch_triggered_no)
+ if (is_hardware_watchpoint (b) && watchpoint_triggered == watch_triggered_no)
return 0;
return 1;
@@ -9659,7 +9492,7 @@ watchpoint::check_status (bpstat *bs)
int
watchpoint::resources_needed (const struct bp_location *bl)
{
- int length = exact? 1 : bl->length;
+ int length = exact ? 1 : bl->length;
return target_region_ok_for_hw_watchpoint (bl->address, length);
}
@@ -9696,8 +9529,8 @@ watchpoint::print_it (const bpstat *bs) const
case bp_watchpoint:
case bp_hardware_watchpoint:
if (uiout->is_mi_like_p ())
- uiout->field_string
- ("reason", async_reason_lookup (EXEC_ASYNC_WATCHPOINT_TRIGGER));
+ uiout->field_string (
+ "reason", async_reason_lookup (EXEC_ASYNC_WATCHPOINT_TRIGGER));
mention (b);
tuple_emitter.emplace (uiout, "value");
uiout->text ("\nOld value = ");
@@ -9713,8 +9546,8 @@ watchpoint::print_it (const bpstat *bs) const
case bp_read_watchpoint:
if (uiout->is_mi_like_p ())
- uiout->field_string
- ("reason", async_reason_lookup (EXEC_ASYNC_READ_WATCHPOINT_TRIGGER));
+ uiout->field_string (
+ "reason", async_reason_lookup (EXEC_ASYNC_READ_WATCHPOINT_TRIGGER));
mention (b);
tuple_emitter.emplace (uiout, "value");
uiout->text ("\nValue = ");
@@ -9728,9 +9561,9 @@ watchpoint::print_it (const bpstat *bs) const
if (bs->old_val != NULL)
{
if (uiout->is_mi_like_p ())
- uiout->field_string
- ("reason",
- async_reason_lookup (EXEC_ASYNC_ACCESS_WATCHPOINT_TRIGGER));
+ uiout->field_string (
+ "reason",
+ async_reason_lookup (EXEC_ASYNC_ACCESS_WATCHPOINT_TRIGGER));
mention (b);
tuple_emitter.emplace (uiout, "value");
uiout->text ("\nOld value = ");
@@ -9742,9 +9575,9 @@ watchpoint::print_it (const bpstat *bs) const
{
mention (b);
if (uiout->is_mi_like_p ())
- uiout->field_string
- ("reason",
- async_reason_lookup (EXEC_ASYNC_ACCESS_WATCHPOINT_TRIGGER));
+ uiout->field_string (
+ "reason",
+ async_reason_lookup (EXEC_ASYNC_ACCESS_WATCHPOINT_TRIGGER));
tuple_emitter.emplace (uiout, "value");
uiout->text ("\nValue = ");
}
@@ -9787,7 +9620,7 @@ watchpoint::print_mention () const
tuple_name = "hw-awpt";
break;
default:
- internal_error (_("Invalid hardware watchpoint type."));
+ internal_error (_ ("Invalid hardware watchpoint type."));
}
ui_out_emit_tuple tuple_emitter (uiout, tuple_name);
@@ -9814,7 +9647,7 @@ watchpoint::print_recreate (struct ui_file *fp) const
gdb_printf (fp, "awatch");
break;
default:
- internal_error (_("Invalid watchpoint type."));
+ internal_error (_ ("Invalid watchpoint type."));
}
gdb_printf (fp, " %s", exp_string.get ());
@@ -9905,28 +9738,28 @@ masked_watchpoint::print_it (const bpstat *bs) const
{
case bp_hardware_watchpoint:
if (uiout->is_mi_like_p ())
- uiout->field_string
- ("reason", async_reason_lookup (EXEC_ASYNC_WATCHPOINT_TRIGGER));
+ uiout->field_string (
+ "reason", async_reason_lookup (EXEC_ASYNC_WATCHPOINT_TRIGGER));
break;
case bp_read_watchpoint:
if (uiout->is_mi_like_p ())
- uiout->field_string
- ("reason", async_reason_lookup (EXEC_ASYNC_READ_WATCHPOINT_TRIGGER));
+ uiout->field_string (
+ "reason", async_reason_lookup (EXEC_ASYNC_READ_WATCHPOINT_TRIGGER));
break;
case bp_access_watchpoint:
if (uiout->is_mi_like_p ())
- uiout->field_string
- ("reason",
- async_reason_lookup (EXEC_ASYNC_ACCESS_WATCHPOINT_TRIGGER));
+ uiout->field_string (
+ "reason",
+ async_reason_lookup (EXEC_ASYNC_ACCESS_WATCHPOINT_TRIGGER));
break;
default:
- internal_error (_("Invalid hardware watchpoint type."));
+ internal_error (_ ("Invalid hardware watchpoint type."));
}
mention (b);
- uiout->text (_("\n\
+ uiout->text (_ ("\n\
Check the underlying instruction at PC for the memory\n\
address and value which triggered this watchpoint.\n"));
uiout->text ("\n");
@@ -9973,7 +9806,7 @@ masked_watchpoint::print_mention () const
tuple_name = "hw-awpt";
break;
default:
- internal_error (_("Invalid hardware watchpoint type."));
+ internal_error (_ ("Invalid hardware watchpoint type."));
}
ui_out_emit_tuple tuple_emitter (uiout, tuple_name);
@@ -10000,7 +9833,7 @@ masked_watchpoint::print_recreate (struct ui_file *fp) const
gdb_printf (fp, "awatch");
break;
default:
- internal_error (_("Invalid hardware watchpoint type."));
+ internal_error (_ ("Invalid hardware watchpoint type."));
}
gdb_printf (fp, " %s mask 0x%s", exp_string.get (),
@@ -10084,7 +9917,7 @@ watch_command_1 (const char *arg, int accessflag, int from_tty,
const char *endp;
if (thread != -1)
- error(_("You can specify only one thread."));
+ error (_ ("You can specify only one thread."));
/* Extract the thread ID from the next token. */
thr = parse_thread_id (value_start, &endp);
@@ -10100,13 +9933,13 @@ watch_command_1 (const char *arg, int accessflag, int from_tty,
char *tmp;
if (task != 0)
- error(_("You can specify only one task."));
+ error (_ ("You can specify only one task."));
task = strtol (value_start, &tmp, 0);
if (tmp == value_start)
- error (_("Junk after task keyword."));
+ error (_ ("Junk after task keyword."));
if (!valid_task_id (task))
- error (_("Unknown task %d."), task);
+ error (_ ("Unknown task %d."), task);
}
else if (toklen == 4 && startswith (tok, "mask"))
{
@@ -10116,7 +9949,7 @@ watch_command_1 (const char *arg, int accessflag, int from_tty,
struct value *mask_value;
if (use_mask)
- error(_("You can specify only one mask."));
+ error (_ ("You can specify only one mask."));
use_mask = just_location = true;
@@ -10158,7 +9991,7 @@ watch_command_1 (const char *arg, int accessflag, int from_tty,
len = exp_end - exp_start;
while (len > 0 && isspace (exp_start[len - 1]))
len--;
- error (_("Cannot watch constant value `%.*s'."), len, exp_start);
+ error (_ ("Cannot watch constant value `%.*s'."), len, exp_start);
}
exp_valid_block = tracker.block ();
@@ -10184,12 +10017,13 @@ watch_command_1 (const char *arg, int accessflag, int from_tty,
if (use_mask)
{
- ret = target_masked_watch_num_registers (value_as_address (val.get ()),
- mask);
+ ret
+ = target_masked_watch_num_registers (value_as_address (val.get ()),
+ mask);
if (ret == -1)
- error (_("This target does not support masked watchpoints."));
+ error (_ ("This target does not support masked watchpoints."));
else if (ret == -2)
- error (_("Invalid mask or memory region."));
+ error (_ ("Invalid mask or memory region."));
}
}
else if (val_as_value != NULL)
@@ -10212,7 +10046,7 @@ watch_command_1 (const char *arg, int accessflag, int from_tty,
cond_end = tok;
}
if (*tok)
- error (_("Junk at end of command."));
+ error (_ ("Junk at end of command."));
frame_info_ptr wp_frame = block_innermost_frame (exp_valid_block);
@@ -10251,11 +10085,10 @@ watch_command_1 (const char *arg, int accessflag, int from_tty,
/* Set the address at which we will stop. */
scope_breakpoint->loc->gdbarch = caller_arch;
scope_breakpoint->loc->requested_address = caller_pc;
- scope_breakpoint->loc->address
- = adjust_breakpoint_address (scope_breakpoint->loc->gdbarch,
- scope_breakpoint->loc->requested_address,
- scope_breakpoint->type,
- current_program_space);
+ scope_breakpoint->loc->address = adjust_breakpoint_address (
+ scope_breakpoint->loc->gdbarch,
+ scope_breakpoint->loc->requested_address, scope_breakpoint->type,
+ current_program_space);
}
}
@@ -10409,8 +10242,9 @@ can_use_hardware_watchpoint (const std::vector<value_ref_ptr> &vals)
int num_regs;
len = (target_exact_watchpoints
- && is_scalar_type_recursive (vtype))?
- 1 : value_type (v)->length ();
+ && is_scalar_type_recursive (vtype))
+ ? 1
+ : value_type (v)->length ();
num_regs = target_region_ok_for_hw_watchpoint (vaddr, len);
if (!num_regs)
@@ -10422,9 +10256,9 @@ can_use_hardware_watchpoint (const std::vector<value_ref_ptr> &vals)
}
else if (VALUE_LVAL (v) != not_lval
&& deprecated_value_modifiable (v) == 0)
- return 0; /* These are values from the history (e.g., $1). */
+ return 0; /* These are values from the history (e.g., $1). */
else if (VALUE_LVAL (v) == lval_register)
- return 0; /* Cannot watch a register with a HW watchpoint. */
+ return 0; /* Cannot watch a register with a HW watchpoint. */
}
/* The expression itself looks suitable for using a hardware
@@ -10462,7 +10296,7 @@ static const gdb::option::option_def watch_option_defs[] = {
gdb::option::flag_option_def<watch_options> {
"location",
[] (watch_options *opt) { return &opt->location; },
- N_("\
+ N_ ("\
This evaluates EXPRESSION and watches the memory to which is refers.\n\
-l can be used as a short form of -location."),
},
@@ -10474,7 +10308,7 @@ This evaluates EXPRESSION and watches the memory to which is refers.\n\
static gdb::option::option_def_group
make_watch_options_def_group (watch_options *opts)
{
- return {{watch_option_defs}, opts};
+ return { { watch_option_defs }, opts };
}
/* A helper function that looks for the "-location" argument and then
@@ -10485,8 +10319,8 @@ watch_maybe_just_location (const char *arg, int accessflag, int from_tty)
{
watch_options opts;
auto grp = make_watch_options_def_group (&opts);
- gdb::option::process_options
- (&arg, gdb::option::PROCESS_OPTIONS_UNKNOWN_IS_OPERAND, grp);
+ gdb::option::process_options (
+ &arg, gdb::option::PROCESS_OPTIONS_UNKNOWN_IS_OPERAND, grp);
if (arg != nullptr && *arg == '\0')
arg = nullptr;
@@ -10496,12 +10330,13 @@ watch_maybe_just_location (const char *arg, int accessflag, int from_tty)
/* Command completion for 'watch', 'awatch', and 'rwatch' commands. */
static void
watch_command_completer (struct cmd_list_element *ignore,
- completion_tracker &tracker,
- const char *text, const char * /*word*/)
+ completion_tracker &tracker, const char *text,
+ const char * /*word*/)
{
const auto group = make_watch_options_def_group (nullptr);
- if (gdb::option::complete_options
- (tracker, &text, gdb::option::PROCESS_OPTIONS_UNKNOWN_IS_OPERAND, group))
+ if (gdb::option::complete_options (
+ tracker, &text, gdb::option::PROCESS_OPTIONS_UNKNOWN_IS_OPERAND,
+ group))
return;
const char *word = advance_to_expression_complete_word_point (tracker, text);
@@ -10537,7 +10372,6 @@ awatch_command (const char *arg, int from_tty)
{
watch_maybe_just_location (arg, hw_access, from_tty);
}
-
/* Data for the FSM that manages the until(location)/advance commands
in infcmd.c. Here because it uses the mechanisms of
@@ -10572,8 +10406,7 @@ bool
until_break_fsm::should_stop (struct thread_info *tp)
{
for (const breakpoint_up &bp : breakpoints)
- if (bpstat_find_breakpoint (tp->control.stop_bpstat,
- bp.get ()) != NULL)
+ if (bpstat_find_breakpoint (tp->control.stop_bpstat, bp.get ()) != NULL)
{
set_finished ();
break;
@@ -10621,17 +10454,17 @@ until_break_command (const char *arg, int from_tty, int anywhere)
std::vector<symtab_and_line> sals
= (last_displayed_sal_is_valid ()
- ? decode_line_1 (locspec.get (), DECODE_LINE_FUNFIRSTLINE, NULL,
- get_last_displayed_symtab (),
- get_last_displayed_line ())
- : decode_line_1 (locspec.get (), DECODE_LINE_FUNFIRSTLINE,
- NULL, NULL, 0));
+ ? decode_line_1 (locspec.get (), DECODE_LINE_FUNFIRSTLINE, NULL,
+ get_last_displayed_symtab (),
+ get_last_displayed_line ())
+ : decode_line_1 (locspec.get (), DECODE_LINE_FUNFIRSTLINE, NULL, NULL,
+ 0));
if (sals.empty ())
- error (_("Couldn't get information on specified line."));
+ error (_ ("Couldn't get information on specified line."));
if (*arg)
- error (_("Junk at end of arguments."));
+ error (_ ("Junk at end of arguments."));
tp = inferior_thread ();
thread = tp->global_num;
@@ -10663,8 +10496,8 @@ until_break_command (const char *arg, int from_tty, int anywhere)
caller_gdbarch = frame_unwind_caller_arch (frame);
breakpoint_up caller_breakpoint
- = set_momentary_breakpoint (caller_gdbarch, sal2,
- caller_frame_id, bp_until);
+ = set_momentary_breakpoint (caller_gdbarch, sal2, caller_frame_id,
+ bp_until);
breakpoints.emplace_back (std::move (caller_breakpoint));
set_longjmp_breakpoint (tp, stack_frame_id);
@@ -10685,15 +10518,13 @@ until_break_command (const char *arg, int from_tty, int anywhere)
resolve_sal_pc (&sal);
breakpoint_up location_breakpoint
- = set_momentary_breakpoint (frame_gdbarch, sal,
- stop_frame_id, bp_until);
+ = set_momentary_breakpoint (frame_gdbarch, sal, stop_frame_id,
+ bp_until);
breakpoints.emplace_back (std::move (location_breakpoint));
}
- tp->set_thread_fsm
- (std::unique_ptr<thread_fsm>
- (new until_break_fsm (command_interp (), tp->global_num,
- std::move (breakpoints))));
+ tp->set_thread_fsm (std::unique_ptr<thread_fsm> (new until_break_fsm (
+ command_interp (), tp->global_num, std::move (breakpoints))));
if (lj_deleter)
lj_deleter->release ();
@@ -10701,8 +10532,6 @@ until_break_command (const char *arg, int from_tty, int anywhere)
proceed (-1, GDB_SIGNAL_DEFAULT);
}
-
-
/* Compare two breakpoints and return a strcmp-like result. */
static int
@@ -10736,9 +10565,8 @@ clear_command (const char *arg, int from_tty)
if (arg)
{
decoded_sals
- = decode_line_with_current_source (arg,
- (DECODE_LINE_FUNFIRSTLINE
- | DECODE_LINE_LIST_MODE));
+ = decode_line_with_current_source (arg, (DECODE_LINE_FUNFIRSTLINE
+ | DECODE_LINE_LIST_MODE));
default_match = 0;
sals = decoded_sals;
}
@@ -10749,7 +10577,7 @@ clear_command (const char *arg, int from_tty)
codepoint is not valid, this will set all the fields to 0. */
last_sal = get_last_displayed_sal ();
if (last_sal.symtab == 0)
- error (_("No source file specified."));
+ error (_ ("No source file specified."));
default_match = 1;
sals = last_sal;
@@ -10794,8 +10622,8 @@ clear_command (const char *arg, int from_tty)
0 0 line
1 0 <can't happen> */
- sal_fullname = (sal.symtab == NULL
- ? NULL : symtab_to_fullname (sal.symtab));
+ sal_fullname
+ = (sal.symtab == NULL ? NULL : symtab_to_fullname (sal.symtab));
/* Find all matching breakpoints and add them to 'found'. */
for (breakpoint *b : all_breakpoints ())
@@ -10809,8 +10637,7 @@ clear_command (const char *arg, int from_tty)
{
/* If the user specified file:line, don't allow a PC
match. This matches historical gdb behavior. */
- int pc_match = (!sal.explicit_line
- && sal.pc
+ int pc_match = (!sal.explicit_line && sal.pc
&& (loc->pspace == sal.pspace)
&& (loc->address == sal.pc)
&& (!section_is_overlay (loc->section)
@@ -10818,12 +10645,12 @@ clear_command (const char *arg, int from_tty)
int line_match = 0;
if ((default_match || sal.explicit_line)
- && loc->symtab != NULL
- && sal_fullname != NULL
+ && loc->symtab != NULL && sal_fullname != NULL
&& sal.pspace == loc->pspace
&& loc->line_number == sal.line
&& filename_cmp (symtab_to_fullname (loc->symtab),
- sal_fullname) == 0)
+ sal_fullname)
+ == 0)
line_match = 1;
if (pc_match || line_match)
@@ -10843,32 +10670,31 @@ clear_command (const char *arg, int from_tty)
if (found.empty ())
{
if (arg)
- error (_("No breakpoint at %s."), arg);
+ error (_ ("No breakpoint at %s."), arg);
else
- error (_("No breakpoint at this line."));
+ error (_ ("No breakpoint at this line."));
}
/* Remove duplicates from the vec. */
std::sort (found.begin (), found.end (),
- [] (const breakpoint *bp_a, const breakpoint *bp_b)
- {
- return compare_breakpoints (bp_a, bp_b) < 0;
- });
- found.erase (std::unique (found.begin (), found.end (),
- [] (const breakpoint *bp_a, const breakpoint *bp_b)
- {
- return compare_breakpoints (bp_a, bp_b) == 0;
- }),
+ [] (const breakpoint *bp_a, const breakpoint *bp_b) {
+ return compare_breakpoints (bp_a, bp_b) < 0;
+ });
+ found.erase (std::unique (
+ found.begin (), found.end (),
+ [] (const breakpoint *bp_a, const breakpoint *bp_b) {
+ return compare_breakpoints (bp_a, bp_b) == 0;
+ }),
found.end ());
if (found.size () > 1)
- from_tty = 1; /* Always report if deleted more than one. */
+ from_tty = 1; /* Always report if deleted more than one. */
if (from_tty)
{
if (found.size () == 1)
- gdb_printf (_("Deleted breakpoint "));
+ gdb_printf (_ ("Deleted breakpoint "));
else
- gdb_printf (_("Deleted breakpoints "));
+ gdb_printf (_ ("Deleted breakpoints "));
}
for (breakpoint *iter : found)
@@ -10880,7 +10706,7 @@ clear_command (const char *arg, int from_tty)
if (from_tty)
gdb_putc ('\n');
}
-
+
/* Delete breakpoint in BS if they are `delete' breakpoints and
all breakpoints that are marked for deletion, whether hit or not.
This is called after any breakpoint is hit, or after errors. */
@@ -10889,8 +10715,7 @@ void
breakpoint_auto_delete (bpstat *bs)
{
for (; bs; bs = bs->next)
- if (bs->breakpoint_at
- && bs->breakpoint_at->disposition == disp_del
+ if (bs->breakpoint_at && bs->breakpoint_at->disposition == disp_del
&& bs->stop)
delete_breakpoint (bs->breakpoint_at);
@@ -10930,8 +10755,7 @@ bp_location_is_less_than (const bp_location *a, const bp_location *b)
/* Likewise, for range-breakpoints, sort by length. */
if (a->loc_type == bp_loc_hardware_breakpoint
- && b->loc_type == bp_loc_hardware_breakpoint
- && a->length < b->length)
+ && b->loc_type == bp_loc_hardware_breakpoint && a->length < b->length)
return true;
/* Make the internal GDB representation stable across GDB runs
@@ -10992,9 +10816,8 @@ download_tracepoint_locations (void)
struct tracepoint *t;
bool bp_location_downloaded = false;
- if ((b->type == bp_fast_tracepoint
- ? !may_insert_fast_tracepoints
- : !may_insert_tracepoints))
+ if ((b->type == bp_fast_tracepoint ? !may_insert_fast_tracepoints
+ : !may_insert_tracepoints))
continue;
if (can_download_tracepoint == TRIBOOL_UNKNOWN)
@@ -11084,8 +10907,7 @@ force_breakpoint_reinsertion (struct bp_location *bl)
update the conditions on the target's side. */
for (bp_location *loc : all_bp_locations_at_addr (address))
{
- if (!is_breakpoint (loc->owner)
- || pspace_num != loc->pspace->num)
+ if (!is_breakpoint (loc->owner) || pspace_num != loc->pspace->num)
continue;
/* Flag the location appropriately. We use a different state to
@@ -11143,7 +10965,7 @@ update_global_location_list (enum ugll_insert_mode insert_mode)
depends on location type. */
for (bp_location *loc : bp_locations)
if (!loc->inserted && should_be_inserted (loc))
- handle_automatic_hardware_breakpoints (loc);
+ handle_automatic_hardware_breakpoints (loc);
std::sort (bp_locations.begin (), bp_locations.end (),
bp_location_is_less_than);
@@ -11253,7 +11075,8 @@ update_global_location_list (enum ugll_insert_mode insert_mode)
supported, but the latter are. */
if (is_hardware_watchpoint (old_loc->owner))
{
- gdb_assert (is_hardware_watchpoint (loc2->owner));
+ gdb_assert (
+ is_hardware_watchpoint (loc2->owner));
loc2->watchpoint_type = old_loc->watchpoint_type;
}
@@ -11283,8 +11106,8 @@ update_global_location_list (enum ugll_insert_mode insert_mode)
Note that at this point, old_loc->owner is still
valid, as delete_breakpoint frees the breakpoint
only after calling us. */
- gdb_printf (_("warning: Error removing "
- "breakpoint %d\n"),
+ gdb_printf (_ ("warning: Error removing "
+ "breakpoint %d\n"),
old_loc->owner->number);
}
removed = true;
@@ -11424,7 +11247,6 @@ update_global_location_list (enum ugll_insert_mode insert_mode)
continue;
}
-
/* This and the above ensure the invariant that the first location
is not duplicated, and is the inserted one.
All following are marked as duplicated, and are not inserted. */
@@ -11474,7 +11296,6 @@ breakpoint_retire_moribund (void)
static void
update_global_location_list_nothrow (enum ugll_insert_mode insert_mode)
{
-
try
{
update_global_location_list (insert_mode);
@@ -11528,18 +11349,16 @@ code_breakpoint::say_where () const
a condition or dprintf arguments. */
if (extra_string == NULL)
{
- gdb_printf (_(" (%s) pending."), locspec->to_string ());
+ gdb_printf (_ (" (%s) pending."), locspec->to_string ());
}
else if (type == bp_dprintf)
{
- gdb_printf (_(" (%s,%s) pending."),
- locspec->to_string (),
+ gdb_printf (_ (" (%s,%s) pending."), locspec->to_string (),
extra_string.get ());
}
else
{
- gdb_printf (_(" (%s %s) pending."),
- locspec->to_string (),
+ gdb_printf (_ (" (%s %s) pending."), locspec->to_string (),
extra_string.get ());
}
}
@@ -11548,8 +11367,7 @@ code_breakpoint::say_where () const
if (opts.addressprint || loc->symtab == NULL)
gdb_printf (" at %ps",
styled_string (address_style.style (),
- paddress (loc->gdbarch,
- loc->address)));
+ paddress (loc->gdbarch, loc->address)));
if (loc->symtab != NULL)
{
/* If there is a single location, we can print the location
@@ -11559,8 +11377,7 @@ code_breakpoint::say_where () const
const char *filename
= symtab_to_filename_for_display (loc->symtab);
gdb_printf (": file %ps, line %d.",
- styled_string (file_name_style.style (),
- filename),
+ styled_string (file_name_style.style (), filename),
loc->line_number);
}
else
@@ -11583,7 +11400,8 @@ code_breakpoint::say_where () const
/* See breakpoint.h. */
-bp_location_range breakpoint::locations () const
+bp_location_range
+breakpoint::locations () const
{
return bp_location_range (this->loc);
}
@@ -11612,8 +11430,7 @@ breakpoint::remove_location (struct bp_location *bl,
int
breakpoint::breakpoint_hit (const struct bp_location *bl,
- const address_space *aspace,
- CORE_ADDR bp_addr,
+ const address_space *aspace, CORE_ADDR bp_addr,
const target_waitstatus &ws)
{
internal_error_pure_virtual_called ();
@@ -11705,17 +11522,15 @@ code_breakpoint::breakpoint_hit (const struct bp_location *bl,
CORE_ADDR bp_addr,
const target_waitstatus &ws)
{
- if (ws.kind () != TARGET_WAITKIND_STOPPED
- || ws.sig () != GDB_SIGNAL_TRAP)
+ if (ws.kind () != TARGET_WAITKIND_STOPPED || ws.sig () != GDB_SIGNAL_TRAP)
return 0;
- if (!breakpoint_address_match (bl->pspace->aspace, bl->address,
- aspace, bp_addr))
+ if (!breakpoint_address_match (bl->pspace->aspace, bl->address, aspace,
+ bp_addr))
return 0;
- if (overlay_debugging /* unmapped overlay section */
- && section_is_overlay (bl->section)
- && !section_is_mapped (bl->section))
+ if (overlay_debugging /* unmapped overlay section */
+ && section_is_overlay (bl->section) && !section_is_mapped (bl->section))
return 0;
return 1;
@@ -11758,9 +11573,8 @@ ordinary_breakpoint::print_it (const bpstat *bs) const
bp_temp = disposition == disp_del;
if (bl->address != bl->requested_address)
- breakpoint_adjustment_warning (bl->requested_address,
- bl->address,
- number, true);
+ breakpoint_adjustment_warning (bl->requested_address, bl->address, number,
+ true);
annotate_breakpoint (number);
maybe_print_thread_hit_breakpoint (uiout);
@@ -11792,18 +11606,18 @@ ordinary_breakpoint::print_mention () const
case bp_breakpoint:
case bp_gnu_ifunc_resolver:
if (disposition == disp_del)
- gdb_printf (_("Temporary breakpoint"));
+ gdb_printf (_ ("Temporary breakpoint"));
else
- gdb_printf (_("Breakpoint"));
- gdb_printf (_(" %d"), number);
+ gdb_printf (_ ("Breakpoint"));
+ gdb_printf (_ (" %d"), number);
if (type == bp_gnu_ifunc_resolver)
- gdb_printf (_(" at gnu-indirect-function resolver"));
+ gdb_printf (_ (" at gnu-indirect-function resolver"));
break;
case bp_hardware_breakpoint:
- gdb_printf (_("Hardware assisted breakpoint %d"), number);
+ gdb_printf (_ ("Hardware assisted breakpoint %d"), number);
break;
case bp_dprintf:
- gdb_printf (_("Dprintf %d"), number);
+ gdb_printf (_ ("Dprintf %d"), number);
break;
}
@@ -11817,13 +11631,12 @@ ordinary_breakpoint::print_recreate (struct ui_file *fp) const
gdb_printf (fp, "tbreak");
else if (type == bp_breakpoint)
gdb_printf (fp, "break");
- else if (type == bp_hardware_breakpoint
- && disposition == disp_del)
+ else if (type == bp_hardware_breakpoint && disposition == disp_del)
gdb_printf (fp, "thbreak");
else if (type == bp_hardware_breakpoint)
gdb_printf (fp, "hbreak");
else
- internal_error (_("unhandled breakpoint type %d"), (int) type);
+ internal_error (_ ("unhandled breakpoint type %d"), (int) type);
gdb_printf (fp, " %s", locspec->to_string ());
@@ -11844,9 +11657,8 @@ code_breakpoint::decode_location_spec (location_spec *locspec,
struct linespec_result canonical;
- decode_line_full (locspec, DECODE_LINE_FUNFIRSTLINE, search_pspace,
- NULL, 0, &canonical, multiple_symbols_all,
- filter.get ());
+ decode_line_full (locspec, DECODE_LINE_FUNFIRSTLINE, search_pspace, NULL, 0,
+ &canonical, multiple_symbols_all, filter.get ());
/* We should get 0 or 1 resulting SALs. */
gdb_assert (canonical.lsals.size () < 2);
@@ -11917,29 +11729,29 @@ internal_breakpoint::print_it (const bpstat *bs) const
case bp_thread_event:
/* Not sure how we will get here.
GDB should not stop for these breakpoints. */
- gdb_printf (_("Thread Event Breakpoint: gdb should not stop!\n"));
+ gdb_printf (_ ("Thread Event Breakpoint: gdb should not stop!\n"));
break;
case bp_overlay_event:
/* By analogy with the thread event, GDB should not stop for these. */
- gdb_printf (_("Overlay Event Breakpoint: gdb should not stop!\n"));
+ gdb_printf (_ ("Overlay Event Breakpoint: gdb should not stop!\n"));
break;
case bp_longjmp_master:
/* These should never be enabled. */
- gdb_printf (_("Longjmp Master Breakpoint: gdb should not stop!\n"));
+ gdb_printf (_ ("Longjmp Master Breakpoint: gdb should not stop!\n"));
break;
case bp_std_terminate_master:
/* These should never be enabled. */
- gdb_printf (_("std::terminate Master Breakpoint: "
- "gdb should not stop!\n"));
+ gdb_printf (_ ("std::terminate Master Breakpoint: "
+ "gdb should not stop!\n"));
break;
case bp_exception_master:
/* These should never be enabled. */
- gdb_printf (_("Exception Master Breakpoint: "
- "gdb should not stop!\n"));
+ gdb_printf (_ ("Exception Master Breakpoint: "
+ "gdb should not stop!\n"));
break;
}
@@ -12007,14 +11819,13 @@ bkpt_probe_create_sals_from_location_spec (location_spec *locspec,
}
static std::vector<symtab_and_line>
-bkpt_probe_decode_location_spec (struct breakpoint *b,
- location_spec *locspec,
+bkpt_probe_decode_location_spec (struct breakpoint *b, location_spec *locspec,
program_space *search_pspace)
{
std::vector<symtab_and_line> sals
= parse_probes (locspec, search_pspace, NULL);
if (sals.empty ())
- error (_("probe not found"));
+ error (_ ("probe not found"));
return sals;
}
@@ -12051,20 +11862,20 @@ tracepoint::print_mention () const
switch (type)
{
case bp_tracepoint:
- gdb_printf (_("Tracepoint"));
- gdb_printf (_(" %d"), number);
+ gdb_printf (_ ("Tracepoint"));
+ gdb_printf (_ (" %d"), number);
break;
case bp_fast_tracepoint:
- gdb_printf (_("Fast tracepoint"));
- gdb_printf (_(" %d"), number);
+ gdb_printf (_ ("Fast tracepoint"));
+ gdb_printf (_ (" %d"), number);
break;
case bp_static_tracepoint:
case bp_static_marker_tracepoint:
- gdb_printf (_("Static tracepoint"));
- gdb_printf (_(" %d"), number);
+ gdb_printf (_ ("Static tracepoint"));
+ gdb_printf (_ (" %d"), number);
break;
default:
- internal_error (_("unhandled tracepoint type %d"), (int) type);
+ internal_error (_ ("unhandled tracepoint type %d"), (int) type);
}
say_where ();
@@ -12075,13 +11886,12 @@ tracepoint::print_recreate (struct ui_file *fp) const
{
if (type == bp_fast_tracepoint)
gdb_printf (fp, "ftrace");
- else if (type == bp_static_tracepoint
- || type == bp_static_marker_tracepoint)
+ else if (type == bp_static_tracepoint || type == bp_static_marker_tracepoint)
gdb_printf (fp, "strace");
else if (type == bp_tracepoint)
gdb_printf (fp, "trace");
else
- internal_error (_("unhandled tracepoint type %d"), (int) type);
+ internal_error (_ ("unhandled tracepoint type %d"), (int) type);
gdb_printf (fp, " %s", locspec->to_string ());
print_recreate_thread (fp);
@@ -12093,9 +11903,8 @@ tracepoint::print_recreate (struct ui_file *fp) const
/* Virtual table for tracepoints on static probes. */
static void
-tracepoint_probe_create_sals_from_location_spec
- (location_spec *locspec,
- struct linespec_result *canonical)
+tracepoint_probe_create_sals_from_location_spec (
+ location_spec *locspec, struct linespec_result *canonical)
{
/* We use the same method for breakpoint on probes. */
bkpt_probe_create_sals_from_location_spec (locspec, canonical);
@@ -12162,8 +11971,8 @@ dprintf_breakpoint::after_condition_true (struct bpstat *bs)
markers (`-m'). */
static void
-strace_marker_create_sals_from_location_spec (location_spec *locspec,
- struct linespec_result *canonical)
+strace_marker_create_sals_from_location_spec (
+ location_spec *locspec, struct linespec_result *canonical)
{
struct linespec_sals lsal;
const char *arg_start, *arg;
@@ -12181,16 +11990,12 @@ strace_marker_create_sals_from_location_spec (location_spec *locspec,
}
static void
-strace_marker_create_breakpoints_sal (struct gdbarch *gdbarch,
- struct linespec_result *canonical,
- gdb::unique_xmalloc_ptr<char> cond_string,
- gdb::unique_xmalloc_ptr<char> extra_string,
- enum bptype type_wanted,
- enum bpdisp disposition,
- int thread,
- int task, int ignore_count,
- int from_tty, int enabled,
- int internal, unsigned flags)
+strace_marker_create_breakpoints_sal (
+ struct gdbarch *gdbarch, struct linespec_result *canonical,
+ gdb::unique_xmalloc_ptr<char> cond_string,
+ gdb::unique_xmalloc_ptr<char> extra_string, enum bptype type_wanted,
+ enum bpdisp disposition, int thread, int task, int ignore_count,
+ int from_tty, int enabled, int internal, unsigned flags)
{
const linespec_sals &lsal = canonical->lsals[0];
@@ -12205,18 +12010,11 @@ strace_marker_create_breakpoints_sal (struct gdbarch *gdbarch,
{
location_spec_up locspec = canonical->locspec->clone ();
- std::unique_ptr<tracepoint> tp
- (new tracepoint (gdbarch,
- type_wanted,
- lsal.sals[i],
- std::move (locspec),
- NULL,
- std::move (cond_string),
- std::move (extra_string),
- disposition,
- thread, task, ignore_count,
- from_tty, enabled, flags,
- canonical->special_display));
+ std::unique_ptr<tracepoint> tp (new tracepoint (
+ gdbarch, type_wanted, lsal.sals[i], std::move (locspec), NULL,
+ std::move (cond_string), std::move (extra_string), disposition, thread,
+ task, ignore_count, from_tty, enabled, flags,
+ canonical->special_display));
/* Given that its possible to have multiple markers with
the same string id, if the user is creating a static
@@ -12244,12 +12042,11 @@ static_marker_tracepoint::decode_location_spec (location_spec *locspec,
return sals;
}
else
- error (_("marker %s not found"), static_trace_marker_id.c_str ());
+ error (_ ("marker %s not found"), static_trace_marker_id.c_str ());
}
/* Static tracepoints with marker (`-m'). */
-static struct breakpoint_ops strace_marker_breakpoint_ops =
-{
+static struct breakpoint_ops strace_marker_breakpoint_ops = {
strace_marker_create_sals_from_location_spec,
strace_marker_create_breakpoints_sal,
};
@@ -12305,7 +12102,8 @@ delete_breakpoint (struct breakpoint *bpt)
/* Unlink bpt from the bpt->related_breakpoint ring. */
for (related = bpt; related->related_breakpoint != bpt;
- related = related->related_breakpoint);
+ related = related->related_breakpoint)
+ ;
related->related_breakpoint = bpt->related_breakpoint;
bpt->related_breakpoint = bpt;
}
@@ -12357,8 +12155,8 @@ delete_breakpoint (struct breakpoint *bpt)
for each of B and its related breakpoints. */
static void
-iterate_over_related_breakpoints (struct breakpoint *b,
- gdb::function_view<void (breakpoint *)> function)
+iterate_over_related_breakpoints (
+ struct breakpoint *b, gdb::function_view<void (breakpoint *)> function)
{
struct breakpoint *related;
@@ -12409,17 +12207,15 @@ delete_command (const char *arg, int from_tty)
/* Ask user only if there are some breakpoints to delete. */
if (!from_tty
- || (breaks_to_delete && query (_("Delete all breakpoints? "))))
+ || (breaks_to_delete && query (_ ("Delete all breakpoints? "))))
for (breakpoint *b : all_breakpoints_safe ())
if (user_breakpoint_p (b))
delete_breakpoint (b);
}
else
- map_breakpoint_numbers
- (arg, [&] (breakpoint *br)
- {
- iterate_over_related_breakpoints (br, delete_breakpoint);
- });
+ map_breakpoint_numbers (arg, [&] (breakpoint *br) {
+ iterate_over_related_breakpoints (br, delete_breakpoint);
+ });
}
/* Return true if all locations of B bound to PSPACE are pending. If
@@ -12430,9 +12226,7 @@ static bool
all_locations_are_pending (struct breakpoint *b, struct program_space *pspace)
{
for (bp_location *loc : b->locations ())
- if ((pspace == NULL
- || loc->pspace == pspace)
- && !loc->shlib_disabled
+ if ((pspace == NULL || loc->pspace == pspace) && !loc->shlib_disabled
&& !loc->pspace->executing_startup)
return false;
return true;
@@ -12517,9 +12311,10 @@ update_static_tracepoint (struct breakpoint *b, struct symtab_and_line sal)
if (target_static_tracepoint_marker_at (pc, &marker))
{
if (tp->static_trace_marker_id != marker.str_id)
- warning (_("static tracepoint %d changed probed marker from %s to %s"),
- b->number, tp->static_trace_marker_id.c_str (),
- marker.str_id.c_str ());
+ warning (
+ _ ("static tracepoint %d changed probed marker from %s to %s"),
+ b->number, tp->static_trace_marker_id.c_str (),
+ marker.str_id.c_str ());
tp->static_trace_marker_id = std::move (marker.str_id);
@@ -12528,14 +12323,12 @@ update_static_tracepoint (struct breakpoint *b, struct symtab_and_line sal)
/* Old marker wasn't found on target at lineno. Try looking it up
by string ID. */
- if (!sal.explicit_pc
- && sal.line != 0
- && sal.symtab != NULL
+ if (!sal.explicit_pc && sal.line != 0 && sal.symtab != NULL
&& !tp->static_trace_marker_id.empty ())
{
std::vector<static_tracepoint_marker> markers
- = target_static_tracepoint_markers_by_strid
- (tp->static_trace_marker_id.c_str ());
+ = target_static_tracepoint_markers_by_strid (
+ tp->static_trace_marker_id.c_str ());
if (!markers.empty ())
{
@@ -12547,8 +12340,8 @@ update_static_tracepoint (struct breakpoint *b, struct symtab_and_line sal)
tp->static_trace_marker_id = std::move (tpmarker->str_id);
- warning (_("marker for static tracepoint %d (%s) not "
- "found at previous line number"),
+ warning (_ ("marker for static tracepoint %d (%s) not "
+ "found at previous line number"),
b->number, tp->static_trace_marker_id.c_str ());
symtab_and_line sal2 = find_pc_line (tpmarker->address, 0);
@@ -12578,8 +12371,8 @@ update_static_tracepoint (struct breakpoint *b, struct symtab_and_line sal)
b->loc->line_number = sal2.line;
b->loc->symtab = sym != NULL ? sal2.symtab : NULL;
- std::unique_ptr<explicit_location_spec> els
- (new explicit_location_spec ());
+ std::unique_ptr<explicit_location_spec> els (
+ new explicit_location_spec ());
els->source_filename
= xstrdup (symtab_to_filename_for_display (sal2.symtab));
els->line_offset.offset = b->loc->line_number;
@@ -12682,8 +12475,8 @@ update_breakpoint_locations (code_breakpoint *b,
location. */
b->enable_state = bp_disabled;
gdb_printf (gdb_stderr,
- _("Could not reset ranged breakpoint %d: "
- "multiple locations found\n"),
+ _ ("Could not reset ranged breakpoint %d: "
+ "multiple locations found\n"),
b->number);
return;
}
@@ -12716,9 +12509,8 @@ update_breakpoint_locations (code_breakpoint *b,
s = b->cond_string.get ();
try
{
- new_loc->cond = parse_exp_1 (&s, sal.pc,
- block_for_pc (sal.pc),
- 0);
+ new_loc->cond
+ = parse_exp_1 (&s, sal.pc, block_for_pc (sal.pc), 0);
}
catch (const gdb_exception_error &e)
{
@@ -12773,7 +12565,8 @@ update_breakpoint_locations (code_breakpoint *b,
for (bp_location *l : b->locations ())
if (l->function_name
&& strcmp (e->function_name.get (),
- l->function_name.get ()) == 0)
+ l->function_name.get ())
+ == 0)
{
l->enabled = e->enabled;
l->disabled_by_cond = e->disabled_by_cond;
@@ -12817,8 +12610,7 @@ code_breakpoint::location_spec_to_sals (location_spec *locspec,
errors. */
if (e.error == NOT_FOUND_ERROR
&& (condition_not_parsed
- || (loc != NULL
- && search_pspace != NULL
+ || (loc != NULL && search_pspace != NULL
&& loc->pspace != search_pspace)
|| (loc && loc->shlib_disabled)
|| (loc && loc->pspace->executing_startup)
@@ -12884,17 +12676,16 @@ code_breakpoint::re_set_default ()
std::vector<symtab_and_line> expanded, expanded_end;
int found;
- std::vector<symtab_and_line> sals = location_spec_to_sals (locspec.get (),
- filter_pspace,
- &found);
+ std::vector<symtab_and_line> sals
+ = location_spec_to_sals (locspec.get (), filter_pspace, &found);
if (found)
expanded = std::move (sals);
if (locspec_range_end != nullptr)
{
std::vector<symtab_and_line> sals_end
- = location_spec_to_sals (locspec_range_end.get (),
- filter_pspace, &found);
+ = location_spec_to_sals (locspec_range_end.get (), filter_pspace,
+ &found);
if (found)
expanded_end = std::move (sals_end);
}
@@ -12977,7 +12768,7 @@ breakpoint_re_set (void)
/* Now we can insert. */
update_global_location_list (UGLL_MAY_INSERT);
}
-
+
/* Reset the thread number of this breakpoint:
- If the breakpoint is for all threads, leave it as-is.
@@ -13013,7 +12804,7 @@ set_ignore_count (int bptnum, int count, int from_tty)
if (is_tracepoint (b))
{
if (from_tty && count != 0)
- gdb_printf (_("Ignore count ignored for tracepoint %d."),
+ gdb_printf (_ ("Ignore count ignored for tracepoint %d."),
bptnum);
return;
}
@@ -13022,22 +12813,22 @@ set_ignore_count (int bptnum, int count, int from_tty)
if (from_tty)
{
if (count == 0)
- gdb_printf (_("Will stop next time "
- "breakpoint %d is reached."),
+ gdb_printf (_ ("Will stop next time "
+ "breakpoint %d is reached."),
bptnum);
else if (count == 1)
- gdb_printf (_("Will ignore next crossing of breakpoint %d."),
+ gdb_printf (_ ("Will ignore next crossing of breakpoint %d."),
bptnum);
else
- gdb_printf (_("Will ignore next %d "
- "crossings of breakpoint %d."),
+ gdb_printf (_ ("Will ignore next %d "
+ "crossings of breakpoint %d."),
count, bptnum);
}
gdb::observers::breakpoint_modified.notify (b);
return;
}
- error (_("No breakpoint number %d."), bptnum);
+ error (_ ("No breakpoint number %d."), bptnum);
}
/* Command to set ignore-count of breakpoint N to COUNT. */
@@ -13049,21 +12840,19 @@ ignore_command (const char *args, int from_tty)
int num;
if (p == 0)
- error_no_arg (_("a breakpoint number"));
+ error_no_arg (_ ("a breakpoint number"));
num = get_number (&p);
if (num == 0)
- error (_("bad breakpoint number: '%s'"), args);
+ error (_ ("bad breakpoint number: '%s'"), args);
if (*p == 0)
- error (_("Second argument (specified ignore-count) is missing."));
+ error (_ ("Second argument (specified ignore-count) is missing."));
- set_ignore_count (num,
- longest_to_int (value_as_long (parse_and_eval (p))),
+ set_ignore_count (num, longest_to_int (value_as_long (parse_and_eval (p))),
from_tty);
if (from_tty)
gdb_printf ("\n");
}
-
/* Call FUNCTION on each of the breakpoints with numbers in the range
defined by BP_NUM_RANGE (an inclusive range). */
@@ -13074,7 +12863,7 @@ map_breakpoint_number_range (std::pair<int, int> bp_num_range,
{
if (bp_num_range.first == 0)
{
- warning (_("bad breakpoint number at or near '%d'"),
+ warning (_ ("bad breakpoint number at or near '%d'"),
bp_num_range.first);
}
else
@@ -13091,7 +12880,7 @@ map_breakpoint_number_range (std::pair<int, int> bp_num_range,
break;
}
if (!match)
- gdb_printf (_("No breakpoint number %d.\n"), i);
+ gdb_printf (_ ("No breakpoint number %d.\n"), i);
}
}
}
@@ -13104,7 +12893,7 @@ map_breakpoint_numbers (const char *args,
gdb::function_view<void (breakpoint *)> function)
{
if (args == NULL || *args == '\0')
- error_no_arg (_("one or more breakpoint numbers"));
+ error_no_arg (_ ("one or more breakpoint numbers"));
number_or_range_parser parser (args);
@@ -13124,17 +12913,17 @@ find_location_by_number (int bp_num, int loc_num)
breakpoint *b = get_breakpoint (bp_num);
if (!b || b->number != bp_num)
- error (_("Bad breakpoint number '%d'"), bp_num);
-
+ error (_ ("Bad breakpoint number '%d'"), bp_num);
+
if (loc_num == 0)
- error (_("Bad breakpoint location number '%d'"), loc_num);
+ error (_ ("Bad breakpoint location number '%d'"), loc_num);
int n = 0;
for (bp_location *loc : b->locations ())
if (++n == loc_num)
return loc;
- error (_("Bad breakpoint location number '%d'"), loc_num);
+ error (_ ("Bad breakpoint location number '%d'"), loc_num);
}
/* Modes of operation for extract_bp_num. */
@@ -13154,20 +12943,20 @@ enum class extract_bp_kind
string. This always returns a positive integer. */
static int
-extract_bp_num (extract_bp_kind kind, const char *start,
- int trailer, const char **end_out = NULL)
+extract_bp_num (extract_bp_kind kind, const char *start, int trailer,
+ const char **end_out = NULL)
{
const char *end = start;
int num = get_number_trailer (&end, trailer);
if (num < 0)
error (kind == extract_bp_kind::bp
- ? _("Negative breakpoint number '%.*s'")
- : _("Negative breakpoint location number '%.*s'"),
+ ? _ ("Negative breakpoint number '%.*s'")
+ : _ ("Negative breakpoint location number '%.*s'"),
int (end - start), start);
if (num == 0)
error (kind == extract_bp_kind::bp
- ? _("Bad breakpoint number '%.*s'")
- : _("Bad breakpoint location number '%.*s'"),
+ ? _ ("Bad breakpoint number '%.*s'")
+ : _ ("Bad breakpoint location number '%.*s'"),
int (end - start), start);
if (end_out != NULL)
@@ -13181,8 +12970,7 @@ extract_bp_num (extract_bp_kind kind, const char *start,
are always positive integers. */
static std::pair<int, int>
-extract_bp_or_bp_range (extract_bp_kind kind,
- const std::string &arg,
+extract_bp_or_bp_range (extract_bp_kind kind, const std::string &arg,
std::string::size_type arg_offset)
{
std::pair<int, int> range;
@@ -13193,8 +12981,8 @@ extract_bp_or_bp_range (extract_bp_kind kind,
/* bp_loc is a range (x-z). */
if (arg.length () == dash + 1)
error (kind == extract_bp_kind::bp
- ? _("Bad breakpoint number at or near: '%s'")
- : _("Bad breakpoint location number at or near: '%s'"),
+ ? _ ("Bad breakpoint number at or near: '%s'")
+ : _ ("Bad breakpoint location number at or near: '%s'"),
bp_loc);
const char *end;
@@ -13205,8 +12993,8 @@ extract_bp_or_bp_range (extract_bp_kind kind,
if (range.first > range.second)
error (kind == extract_bp_kind::bp
- ? _("Inverted breakpoint range at '%.*s'")
- : _("Inverted breakpoint location range at '%.*s'"),
+ ? _ ("Inverted breakpoint range at '%.*s'")
+ : _ ("Inverted breakpoint location range at '%.*s'"),
int (end - start_first), start_first);
}
else
@@ -13243,14 +13031,14 @@ extract_bp_number_and_location (const std::string &arg,
/* Handle 'x.y' and 'x.y-z' cases. */
if (arg.length () == dot + 1 || dot == 0)
- error (_("Bad breakpoint number at or near: '%s'"), arg.c_str ());
+ error (_ ("Bad breakpoint number at or near: '%s'"), arg.c_str ());
bp_num_range.first
= extract_bp_num (extract_bp_kind::bp, arg.c_str (), '.');
bp_num_range.second = bp_num_range.first;
- bp_loc_range = extract_bp_or_bp_range (extract_bp_kind::loc,
- arg, dot + 1);
+ bp_loc_range
+ = extract_bp_or_bp_range (extract_bp_kind::loc, arg, dot + 1);
}
else
{
@@ -13272,8 +13060,9 @@ enable_disable_bp_num_loc (int bp_num, int loc_num, bool enable)
if (loc != NULL)
{
if (loc->disabled_by_cond && enable)
- error (_("Breakpoint %d's condition is invalid at location %d, "
- "cannot enable."), bp_num, loc_num);
+ error (_ ("Breakpoint %d's condition is invalid at location %d, "
+ "cannot enable."),
+ bp_num, loc_num);
if (loc->enabled != enable)
{
@@ -13317,19 +13106,20 @@ void
enable_disable_bp_location (bp_location *loc, bool enable)
{
if (loc == nullptr)
- error (_("Breakpoint location is invalid."));
+ error (_ ("Breakpoint location is invalid."));
if (loc->owner == nullptr)
- error (_("Breakpoint location does not have an owner breakpoint."));
+ error (_ ("Breakpoint location does not have an owner breakpoint."));
if (loc->disabled_by_cond && enable)
{
int loc_num = find_loc_num_by_location (loc);
if (loc_num == -1)
- error (_("Breakpoint location LOC_NUM could not be found."));
+ error (_ ("Breakpoint location LOC_NUM could not be found."));
else
- error (_("Breakpoint %d's condition is invalid at location %d, "
- "cannot enable."), loc->owner->number, loc_num);
+ error (_ ("Breakpoint %d's condition is invalid at location %d, "
+ "cannot enable."),
+ loc->owner->number, loc_num);
}
if (loc->enabled != enable)
@@ -13430,16 +13220,15 @@ enable_disable_command (const char *args, int from_tty, bool enable)
/* Handle breakpoint ids with formats 'x' or 'x-z'
or 'y.1' where y has only one code location. */
map_breakpoint_number_range (bp_num_range,
- enable
- ? enable_breakpoint
- : disable_breakpoint);
+ enable ? enable_breakpoint
+ : disable_breakpoint);
}
else
{
/* Handle breakpoint ids with formats 'x.y' or
'x.y-z'. */
- enable_disable_breakpoint_location_range
- (bp_num_range.first, bp_loc_range, enable);
+ enable_disable_breakpoint_location_range (bp_num_range.first,
+ bp_loc_range, enable);
}
num = extract_arg (&args);
}
@@ -13467,13 +13256,13 @@ enable_breakpoint_disp (struct breakpoint *bpt, enum bpdisp disposition,
{
int i;
i = hw_breakpoint_used_count ();
- target_resources_ok =
- target_can_use_hardware_watchpoint (bp_hardware_breakpoint,
- i + 1, 0);
+ target_resources_ok
+ = target_can_use_hardware_watchpoint (bp_hardware_breakpoint, i + 1,
+ 0);
if (target_resources_ok == 0)
- error (_("No hardware breakpoint support in the target."));
+ error (_ ("No hardware breakpoint support in the target."));
else if (target_resources_ok < 0)
- error (_("Hardware breakpoints used exceeds limit."));
+ error (_ ("Hardware breakpoints used exceeds limit."));
}
if (is_watchpoint (bpt))
@@ -13492,8 +13281,8 @@ enable_breakpoint_disp (struct breakpoint *bpt, enum bpdisp disposition,
catch (const gdb_exception &e)
{
bpt->enable_state = orig_enable_state;
- exception_fprintf (gdb_stderr, e, _("Cannot enable watchpoint %d: "),
- bpt->number);
+ exception_fprintf (gdb_stderr, e,
+ _ ("Cannot enable watchpoint %d: "), bpt->number);
return;
}
}
@@ -13517,7 +13306,6 @@ enable_breakpoint_disp (struct breakpoint *bpt, enum bpdisp disposition,
gdb::observers::breakpoint_modified.notify (bpt);
}
-
void
enable_breakpoint (struct breakpoint *bpt)
{
@@ -13538,15 +13326,11 @@ enable_command (const char *args, int from_tty)
static void
enable_once_command (const char *args, int from_tty)
{
- map_breakpoint_numbers
- (args, [&] (breakpoint *b)
- {
- iterate_over_related_breakpoints
- (b, [&] (breakpoint *bpt)
- {
- enable_breakpoint_disp (bpt, disp_disable, 1);
- });
- });
+ map_breakpoint_numbers (args, [&] (breakpoint *b) {
+ iterate_over_related_breakpoints (b, [&] (breakpoint *bpt) {
+ enable_breakpoint_disp (bpt, disp_disable, 1);
+ });
+ });
}
static void
@@ -13555,35 +13339,27 @@ enable_count_command (const char *args, int from_tty)
int count;
if (args == NULL)
- error_no_arg (_("hit count"));
+ error_no_arg (_ ("hit count"));
count = get_number (&args);
- map_breakpoint_numbers
- (args, [&] (breakpoint *b)
- {
- iterate_over_related_breakpoints
- (b, [&] (breakpoint *bpt)
- {
- enable_breakpoint_disp (bpt, disp_disable, count);
- });
- });
+ map_breakpoint_numbers (args, [&] (breakpoint *b) {
+ iterate_over_related_breakpoints (b, [&] (breakpoint *bpt) {
+ enable_breakpoint_disp (bpt, disp_disable, count);
+ });
+ });
}
static void
enable_delete_command (const char *args, int from_tty)
{
- map_breakpoint_numbers
- (args, [&] (breakpoint *b)
- {
- iterate_over_related_breakpoints
- (b, [&] (breakpoint *bpt)
- {
- enable_breakpoint_disp (bpt, disp_del, 1);
- });
- });
+ map_breakpoint_numbers (args, [&] (breakpoint *b) {
+ iterate_over_related_breakpoints (b, [&] (breakpoint *bpt) {
+ enable_breakpoint_disp (bpt, disp_del, 1);
+ });
+ });
}
-
+
/* Invalidate last known value of any hardware watchpoint if
the memory which that value represents has been written to by
GDB itself. */
@@ -13594,8 +13370,7 @@ invalidate_bp_value_on_memory_change (struct inferior *inferior,
const bfd_byte *data)
{
for (breakpoint *bp : all_breakpoints ())
- if (bp->enable_state == bp_enabled
- && bp->type == bp_hardware_watchpoint)
+ if (bp->enable_state == bp_enabled && bp->type == bp_hardware_watchpoint)
{
struct watchpoint *wp = (struct watchpoint *) bp;
@@ -13617,8 +13392,7 @@ invalidate_bp_value_on_memory_change (struct inferior *inferior,
void
insert_single_step_breakpoint (struct gdbarch *gdbarch,
- const address_space *aspace,
- CORE_ADDR next_pc)
+ const address_space *aspace, CORE_ADDR next_pc)
{
struct thread_info *tp = inferior_thread ();
struct symtab_and_line sal;
@@ -13626,11 +13400,9 @@ insert_single_step_breakpoint (struct gdbarch *gdbarch,
if (tp->control.single_step_breakpoints == NULL)
{
- std::unique_ptr<breakpoint> b
- (new momentary_breakpoint (gdbarch, bp_single_step,
- current_program_space,
- null_frame_id,
- tp->global_num));
+ std::unique_ptr<breakpoint> b (new momentary_breakpoint (
+ gdbarch, bp_single_step, current_program_space, null_frame_id,
+ tp->global_num));
tp->control.single_step_breakpoints
= add_to_breakpoint_chain (std::move (b));
@@ -13641,9 +13413,8 @@ insert_single_step_breakpoint (struct gdbarch *gdbarch,
sal.section = find_pc_overlay (pc);
sal.explicit_pc = 1;
- auto *ss_bp
- = (gdb::checked_static_cast<momentary_breakpoint *>
- (tp->control.single_step_breakpoints));
+ auto *ss_bp = (gdb::checked_static_cast<momentary_breakpoint *> (
+ tp->control.single_step_breakpoints));
ss_bp->add_location (sal);
update_global_location_list (UGLL_INSERT);
@@ -13681,8 +13452,7 @@ breakpoint_has_location_inserted_here (struct breakpoint *bp,
CORE_ADDR pc)
{
for (bp_location *loc : bp->locations ())
- if (loc->inserted
- && breakpoint_location_address_match (loc, aspace, pc))
+ if (loc->inserted && breakpoint_location_address_match (loc, aspace, pc))
return 1;
return 0;
@@ -13717,39 +13487,27 @@ set_tracepoint_count (int num)
static void
trace_command (const char *arg, int from_tty)
{
- location_spec_up locspec = string_to_location_spec (&arg,
- current_language);
- const struct breakpoint_ops *ops = breakpoint_ops_for_location_spec
- (locspec.get (), true /* is_tracepoint */);
-
- create_breakpoint (get_current_arch (),
- locspec.get (),
- NULL, 0, arg, false, 1 /* parse arg */,
- 0 /* tempflag */,
- bp_tracepoint /* type_wanted */,
- 0 /* Ignore count */,
- pending_break_support,
- ops,
- from_tty,
- 1 /* enabled */,
+ location_spec_up locspec = string_to_location_spec (&arg, current_language);
+ const struct breakpoint_ops *ops
+ = breakpoint_ops_for_location_spec (locspec.get (),
+ true /* is_tracepoint */);
+
+ create_breakpoint (get_current_arch (), locspec.get (), NULL, 0, arg, false,
+ 1 /* parse arg */, 0 /* tempflag */,
+ bp_tracepoint /* type_wanted */, 0 /* Ignore count */,
+ pending_break_support, ops, from_tty, 1 /* enabled */,
0 /* internal */, 0);
}
static void
ftrace_command (const char *arg, int from_tty)
{
- location_spec_up locspec = string_to_location_spec (&arg,
- current_language);
- create_breakpoint (get_current_arch (),
- locspec.get (),
- NULL, 0, arg, false, 1 /* parse arg */,
- 0 /* tempflag */,
+ location_spec_up locspec = string_to_location_spec (&arg, current_language);
+ create_breakpoint (get_current_arch (), locspec.get (), NULL, 0, arg, false,
+ 1 /* parse arg */, 0 /* tempflag */,
bp_fast_tracepoint /* type_wanted */,
- 0 /* Ignore count */,
- pending_break_support,
- &code_breakpoint_ops,
- from_tty,
- 1 /* enabled */,
+ 0 /* Ignore count */, pending_break_support,
+ &code_breakpoint_ops, from_tty, 1 /* enabled */,
0 /* internal */, 0);
}
@@ -13767,8 +13525,8 @@ strace_command (const char *arg, int from_tty)
if (arg && startswith (arg, "-m") && isspace (arg[2]))
{
ops = &strace_marker_breakpoint_ops;
- locspec = new_linespec_location_spec (&arg,
- symbol_name_match_type::FULL);
+ locspec
+ = new_linespec_location_spec (&arg, symbol_name_match_type::FULL);
type = bp_static_marker_tracepoint;
}
else
@@ -13778,16 +13536,10 @@ strace_command (const char *arg, int from_tty)
type = bp_static_tracepoint;
}
- create_breakpoint (get_current_arch (),
- locspec.get (),
- NULL, 0, arg, false, 1 /* parse arg */,
- 0 /* tempflag */,
- type /* type_wanted */,
- 0 /* Ignore count */,
- pending_break_support,
- ops,
- from_tty,
- 1 /* enabled */,
+ create_breakpoint (get_current_arch (), locspec.get (), NULL, 0, arg, false,
+ 1 /* parse arg */, 0 /* tempflag */,
+ type /* type_wanted */, 0 /* Ignore count */,
+ pending_break_support, ops, from_tty, 1 /* enabled */,
0 /* internal */, 0);
}
@@ -13816,7 +13568,7 @@ read_uploaded_action (std::string &buffer)
equivalent GDB tracepoint. This is not a reliable process, since
the target does not necessarily have all the information used when
the tracepoint was originally defined. */
-
+
struct tracepoint *
create_tracepoint_from_upload (struct uploaded_tp *utp)
{
@@ -13832,8 +13584,8 @@ create_tracepoint_from_upload (struct uploaded_tp *utp)
address. Since there is no way to confirm that the address
means the same thing as when the trace was started, warn the
user. */
- warning (_("Uploaded tracepoint %d has no "
- "source location, using raw address"),
+ warning (_ ("Uploaded tracepoint %d has no "
+ "source location, using raw address"),
utp->number);
xsnprintf (small_buf, sizeof (small_buf), "*%s", hex_string (utp->addr));
addr_str = small_buf;
@@ -13841,26 +13593,20 @@ create_tracepoint_from_upload (struct uploaded_tp *utp)
/* There's not much we can do with a sequence of bytecodes. */
if (utp->cond && !utp->cond_string)
- warning (_("Uploaded tracepoint %d condition "
- "has no source form, ignoring it"),
+ warning (_ ("Uploaded tracepoint %d condition "
+ "has no source form, ignoring it"),
utp->number);
- location_spec_up locspec = string_to_location_spec (&addr_str,
- current_language);
- if (!create_breakpoint (get_current_arch (),
- locspec.get (),
+ location_spec_up locspec
+ = string_to_location_spec (&addr_str, current_language);
+ if (!create_breakpoint (get_current_arch (), locspec.get (),
utp->cond_string.get (), -1, addr_str,
false /* force_condition */,
- 0 /* parse cond/thread */,
- 0 /* tempflag */,
- utp->type /* type_wanted */,
- 0 /* Ignore count */,
- pending_break_support,
- &code_breakpoint_ops,
- 0 /* from_tty */,
- utp->enabled /* enabled */,
- 0 /* internal */,
- CREATE_BREAKPOINT_FLAGS_INSERTED))
+ 0 /* parse cond/thread */, 0 /* tempflag */,
+ utp->type /* type_wanted */, 0 /* Ignore count */,
+ pending_break_support, &code_breakpoint_ops,
+ 0 /* from_tty */, utp->enabled /* enabled */,
+ 0 /* internal */, CREATE_BREAKPOINT_FLAGS_INSERTED))
return NULL;
/* Get the tracepoint we just created. */
@@ -13890,10 +13636,9 @@ create_tracepoint_from_upload (struct uploaded_tp *utp)
breakpoint_set_commands (tp, std::move (cmd_list));
}
- else if (!utp->actions.empty ()
- || !utp->step_actions.empty ())
- warning (_("Uploaded tracepoint %d actions "
- "have no source form, ignoring them"),
+ else if (!utp->actions.empty () || !utp->step_actions.empty ())
+ warning (_ ("Uploaded tracepoint %d actions "
+ "have no source form, ignoring them"),
utp->number);
/* Copy any status information that might be available. */
@@ -13902,7 +13647,7 @@ create_tracepoint_from_upload (struct uploaded_tp *utp)
return tp;
}
-
+
/* Print information on tracepoint number TPNUM_EXP, or all if
omitted. */
@@ -13964,7 +13709,7 @@ delete_trace_command (const char *arg, int from_tty)
/* Ask user only if there are some breakpoints to delete. */
if (!from_tty
- || (breaks_to_delete && query (_("Delete all tracepoints? "))))
+ || (breaks_to_delete && query (_ ("Delete all tracepoints? "))))
{
for (breakpoint *b : all_breakpoints_safe ())
if (is_tracepoint (b) && user_breakpoint_p (b))
@@ -13972,11 +13717,9 @@ delete_trace_command (const char *arg, int from_tty)
}
}
else
- map_breakpoint_numbers
- (arg, [&] (breakpoint *br)
- {
- iterate_over_related_breakpoints (br, delete_breakpoint);
- });
+ map_breakpoint_numbers (arg, [&] (breakpoint *br) {
+ iterate_over_related_breakpoints (br, delete_breakpoint);
+ });
}
/* Helper function for trace_pass_command. */
@@ -13987,8 +13730,8 @@ trace_pass_set_count (struct tracepoint *tp, int count, int from_tty)
tp->pass_count = count;
gdb::observers::breakpoint_modified.notify (tp);
if (from_tty)
- gdb_printf (_("Setting tracepoint %d's passcount to %d\n"),
- tp->number, count);
+ gdb_printf (_ ("Setting tracepoint %d's passcount to %d\n"), tp->number,
+ count);
}
/* Set passcount for tracepoint.
@@ -14004,17 +13747,17 @@ trace_pass_command (const char *args, int from_tty)
ULONGEST count;
if (args == 0 || *args == 0)
- error (_("passcount command requires an "
- "argument (count + optional TP num)"));
+ error (_ ("passcount command requires an "
+ "argument (count + optional TP num)"));
- count = strtoulst (args, &args, 10); /* Count comes first, then TP num. */
+ count = strtoulst (args, &args, 10); /* Count comes first, then TP num. */
args = skip_spaces (args);
if (*args && strncasecmp (args, "all", 3) == 0)
{
- args += 3; /* Skip special argument "all". */
+ args += 3; /* Skip special argument "all". */
if (*args)
- error (_("Junk at end of arguments."));
+ error (_ ("Junk at end of arguments."));
for (breakpoint *b : all_tracepoints ())
{
@@ -14074,8 +13817,7 @@ get_tracepoint_by_number_on_target (int num)
(tracepoint_count) is returned. */
struct tracepoint *
-get_tracepoint_by_number (const char **arg,
- number_or_range_parser *parser)
+get_tracepoint_by_number (const char **arg, number_or_range_parser *parser)
{
int tpnum;
const char *instring = arg == NULL ? NULL : *arg;
@@ -14085,7 +13827,7 @@ get_tracepoint_by_number (const char **arg,
gdb_assert (!parser->finished ());
tpnum = parser->get_number ();
}
- else if (arg == NULL || *arg == NULL || ! **arg)
+ else if (arg == NULL || *arg == NULL || !**arg)
tpnum = tracepoint_count;
else
tpnum = get_number (arg);
@@ -14093,10 +13835,9 @@ get_tracepoint_by_number (const char **arg,
if (tpnum <= 0)
{
if (instring && *instring)
- gdb_printf (_("bad tracepoint number at or near '%s'\n"),
- instring);
+ gdb_printf (_ ("bad tracepoint number at or near '%s'\n"), instring);
else
- gdb_printf (_("No previous tracepoint\n"));
+ gdb_printf (_ ("No previous tracepoint\n"));
return NULL;
}
@@ -14133,7 +13874,7 @@ save_breakpoints (const char *filename, int from_tty,
int extra_trace_bits = 0;
if (filename == 0 || *filename == 0)
- error (_("Argument required (file name in which to save)"));
+ error (_ ("Argument required (file name in which to save)"));
/* See if we have anything to save. */
for (breakpoint *tp : all_breakpoints ())
@@ -14159,7 +13900,7 @@ save_breakpoints (const char *filename, int from_tty,
if (!any)
{
- warning (_("Nothing to save."));
+ warning (_ ("Nothing to save."));
return;
}
@@ -14168,7 +13909,7 @@ save_breakpoints (const char *filename, int from_tty,
stdio_file fp;
if (!fp.open (expanded_filename.get (), "w"))
- error (_("Unable to open file '%s' for saving (%s)"),
+ error (_ ("Unable to open file '%s' for saving (%s)"),
expanded_filename.get (), safe_strerror (errno));
if (extra_trace_bits)
@@ -14230,7 +13971,7 @@ save_breakpoints (const char *filename, int from_tty,
fp.printf ("set default-collect %s\n", default_collect.c_str ());
if (from_tty)
- gdb_printf (_("Saved to file '%s'.\n"), expanded_filename.get ());
+ gdb_printf (_ ("Saved to file '%s'.\n"), expanded_filename.get ());
}
/* The `save breakpoints' command. */
@@ -14249,12 +13990,11 @@ save_tracepoints_command (const char *args, int from_tty)
save_breakpoints (args, from_tty, is_tracepoint);
}
-
/* This help string is used to consolidate all the help string for specifying
locations used by several commands. */
#define LOCATION_SPEC_HELP_STRING \
-"Linespecs are colon-separated lists of location parameters, such as\n\
+ "Linespecs are colon-separated lists of location parameters, such as\n\
source filename, function name, label name, and line number.\n\
Example: To specify the start of a label named \"the_top\" in the\n\
function \"fact\" in the file \"factorial.c\", use\n\
@@ -14283,7 +14023,7 @@ specified name as a complete fully-qualified name instead."
command. */
#define BREAK_ARGS_HELP(command) \
-command" [PROBE_MODIFIER] [LOCATION] [thread THREADNUM]\n\
+ command " [PROBE_MODIFIER] [LOCATION] [thread THREADNUM]\n\
\t[-force-condition] [if CONDITION]\n\
PROBE_MODIFIER shall be present if the command is to be placed in a\n\
probe point. Accepted values are `-probe' (for a generic, automatically\n\
@@ -14314,21 +14054,17 @@ static struct cmd_list_element *tcatch_cmdlist;
void
add_catch_command (const char *name, const char *docstring,
- cmd_func_ftype *func,
- completer_ftype *completer,
- void *user_data_catch,
- void *user_data_tcatch)
+ cmd_func_ftype *func, completer_ftype *completer,
+ void *user_data_catch, void *user_data_tcatch)
{
struct cmd_list_element *command;
- command = add_cmd (name, class_breakpoint, docstring,
- &catch_cmdlist);
+ command = add_cmd (name, class_breakpoint, docstring, &catch_cmdlist);
command->func = func;
command->set_context (user_data_catch);
set_cmd_completer (command, completer);
- command = add_cmd (name, class_breakpoint, docstring,
- &tcatch_cmdlist);
+ command = add_cmd (name, class_breakpoint, docstring, &tcatch_cmdlist);
command->func = func;
command->set_context (user_data_tcatch);
set_cmd_completer (command, completer);
@@ -14387,6 +14123,7 @@ static struct cmd_list_element *enablebreaklist = NULL;
cmd_list_element *commands_cmd_element = nullptr;
void _initialize_breakpoint ();
+
void
_initialize_breakpoint ()
{
@@ -14406,12 +14143,12 @@ _initialize_breakpoint ()
tracepoint_count = 0;
- add_com ("ignore", class_breakpoint, ignore_command, _("\
+ add_com ("ignore", class_breakpoint, ignore_command, _ ("\
Set ignore-count of breakpoint number N to COUNT.\n\
Usage is `ignore N COUNT'."));
- commands_cmd_element = add_com ("commands", class_breakpoint,
- commands_command, _("\
+ commands_cmd_element
+ = add_com ("commands", class_breakpoint, commands_command, _ ("\
Set commands to be executed when the given breakpoints are hit.\n\
Give a space-separated breakpoint list as argument after \"commands\".\n\
A list element can be a breakpoint number (e.g. `5') or a range of numbers\n\
@@ -14424,45 +14161,43 @@ then no output is printed when it is hit, except what the commands print."));
const auto cc_opts = make_condition_command_options_def_group (nullptr);
static std::string condition_command_help
- = gdb::option::build_help (_("\
+ = gdb::option::build_help (_ ("\
Specify breakpoint number N to break only if COND is true.\n\
Usage is `condition [OPTION] N COND', where N is an integer and COND\n\
is an expression to be evaluated whenever breakpoint N is reached.\n\
\n\
Options:\n\
-%OPTIONS%"), cc_opts);
+%OPTIONS%"),
+ cc_opts);
c = add_com ("condition", class_breakpoint, condition_command,
condition_command_help.c_str ());
set_cmd_completer_handle_brkchars (c, condition_completer);
- c = add_com ("tbreak", class_breakpoint, tbreak_command, _("\
+ c = add_com ("tbreak", class_breakpoint, tbreak_command, _ ("\
Set a temporary breakpoint.\n\
Like \"break\" except the breakpoint is only temporary,\n\
so it will be deleted when hit. Equivalent to \"break\" followed\n\
by using \"enable delete\" on the breakpoint number.\n\
-\n"
-BREAK_ARGS_HELP ("tbreak")));
+\n" BREAK_ARGS_HELP ("tbreak")));
set_cmd_completer (c, location_completer);
- c = add_com ("hbreak", class_breakpoint, hbreak_command, _("\
+ c = add_com ("hbreak", class_breakpoint, hbreak_command, _ ("\
Set a hardware assisted breakpoint.\n\
Like \"break\" except the breakpoint requires hardware support,\n\
some target hardware may not have this support.\n\
-\n"
-BREAK_ARGS_HELP ("hbreak")));
+\n" BREAK_ARGS_HELP ("hbreak")));
set_cmd_completer (c, location_completer);
- c = add_com ("thbreak", class_breakpoint, thbreak_command, _("\
+ c = add_com ("thbreak", class_breakpoint, thbreak_command, _ ("\
Set a temporary hardware assisted breakpoint.\n\
Like \"hbreak\" except the breakpoint is only temporary,\n\
so it will be deleted when hit.\n\
-\n"
-BREAK_ARGS_HELP ("thbreak")));
+\n" BREAK_ARGS_HELP ("thbreak")));
set_cmd_completer (c, location_completer);
cmd_list_element *enable_cmd
- = add_prefix_cmd ("enable", class_breakpoint, enable_command, _("\
+ = add_prefix_cmd ("enable", class_breakpoint, enable_command, _ ("\
Enable all or some breakpoints.\n\
Usage: enable [BREAKPOINTNUM]...\n\
Give breakpoint numbers (separated by spaces) as arguments.\n\
@@ -14473,46 +14208,46 @@ With a subcommand you can enable temporarily."),
add_com_alias ("en", enable_cmd, class_breakpoint, 1);
- add_prefix_cmd ("breakpoints", class_breakpoint, enable_command, _("\
+ add_prefix_cmd ("breakpoints", class_breakpoint, enable_command, _ ("\
Enable all or some breakpoints.\n\
Usage: enable breakpoints [BREAKPOINTNUM]...\n\
Give breakpoint numbers (separated by spaces) as arguments.\n\
This is used to cancel the effect of the \"disable\" command.\n\
May be abbreviated to simply \"enable\"."),
- &enablebreaklist, 1, &enablelist);
+ &enablebreaklist, 1, &enablelist);
- add_cmd ("once", no_class, enable_once_command, _("\
+ add_cmd ("once", no_class, enable_once_command, _ ("\
Enable some breakpoints for one hit.\n\
Usage: enable breakpoints once BREAKPOINTNUM...\n\
If a breakpoint is hit while enabled in this fashion, it becomes disabled."),
&enablebreaklist);
- add_cmd ("delete", no_class, enable_delete_command, _("\
+ add_cmd ("delete", no_class, enable_delete_command, _ ("\
Enable some breakpoints and delete when hit.\n\
Usage: enable breakpoints delete BREAKPOINTNUM...\n\
If a breakpoint is hit while enabled in this fashion, it is deleted."),
&enablebreaklist);
- add_cmd ("count", no_class, enable_count_command, _("\
+ add_cmd ("count", no_class, enable_count_command, _ ("\
Enable some breakpoints for COUNT hits.\n\
Usage: enable breakpoints count COUNT BREAKPOINTNUM...\n\
If a breakpoint is hit while enabled in this fashion,\n\
the count is decremented; when it reaches zero, the breakpoint is disabled."),
&enablebreaklist);
- add_cmd ("delete", no_class, enable_delete_command, _("\
+ add_cmd ("delete", no_class, enable_delete_command, _ ("\
Enable some breakpoints and delete when hit.\n\
Usage: enable delete BREAKPOINTNUM...\n\
If a breakpoint is hit while enabled in this fashion, it is deleted."),
&enablelist);
- add_cmd ("once", no_class, enable_once_command, _("\
+ add_cmd ("once", no_class, enable_once_command, _ ("\
Enable some breakpoints for one hit.\n\
Usage: enable once BREAKPOINTNUM...\n\
If a breakpoint is hit while enabled in this fashion, it becomes disabled."),
&enablelist);
- add_cmd ("count", no_class, enable_count_command, _("\
+ add_cmd ("count", no_class, enable_count_command, _ ("\
Enable some breakpoints for COUNT hits.\n\
Usage: enable count COUNT BREAKPOINTNUM...\n\
If a breakpoint is hit while enabled in this fashion,\n\
@@ -14520,7 +14255,7 @@ the count is decremented; when it reaches zero, the breakpoint is disabled."),
&enablelist);
cmd_list_element *disable_cmd
- = add_prefix_cmd ("disable", class_breakpoint, disable_command, _("\
+ = add_prefix_cmd ("disable", class_breakpoint, disable_command, _ ("\
Disable all or some breakpoints.\n\
Usage: disable [BREAKPOINTNUM]...\n\
Arguments are breakpoint numbers with spaces in between.\n\
@@ -14530,7 +14265,7 @@ A disabled breakpoint is not forgotten, but has no effect until re-enabled."),
add_com_alias ("dis", disable_cmd, class_breakpoint, 1);
add_com_alias ("disa", disable_cmd, class_breakpoint, 1);
- add_cmd ("breakpoints", class_breakpoint, disable_command, _("\
+ add_cmd ("breakpoints", class_breakpoint, disable_command, _ ("\
Disable all or some breakpoints.\n\
Usage: disable breakpoints [BREAKPOINTNUM]...\n\
Arguments are breakpoint numbers with spaces in between.\n\
@@ -14540,7 +14275,7 @@ This command may be abbreviated \"disable\"."),
&disablelist);
cmd_list_element *delete_cmd
- = add_prefix_cmd ("delete", class_breakpoint, delete_command, _("\
+ = add_prefix_cmd ("delete", class_breakpoint, delete_command, _ ("\
Delete all or some breakpoints.\n\
Usage: delete [BREAKPOINTNUM]...\n\
Arguments are breakpoint numbers with spaces in between.\n\
@@ -14551,7 +14286,7 @@ Also a prefix command for deletion of other GDB objects."),
add_com_alias ("d", delete_cmd, class_breakpoint, 1);
add_com_alias ("del", delete_cmd, class_breakpoint, 1);
- add_cmd ("breakpoints", class_breakpoint, delete_command, _("\
+ add_cmd ("breakpoints", class_breakpoint, delete_command, _ ("\
Delete all or some breakpoints or auto-display expressions.\n\
Usage: delete breakpoints [BREAKPOINTNUM]...\n\
Arguments are breakpoint numbers with spaces in between.\n\
@@ -14560,20 +14295,20 @@ This command may be abbreviated \"delete\"."),
&deletelist);
cmd_list_element *clear_cmd
- = add_com ("clear", class_breakpoint, clear_command, _("\
+ = add_com ("clear", class_breakpoint, clear_command,
+ _ ("\
Clear breakpoint at specified location.\n\
Argument may be a linespec, explicit, or address location as described below.\n\
\n\
With no argument, clears all breakpoints in the line that the selected frame\n\
is executing in.\n"
-"\n" LOCATION_SPEC_HELP_STRING "\n\n\
+ "\n" LOCATION_SPEC_HELP_STRING "\n\n\
See also the \"delete\" command which clears breakpoints by number."));
add_com_alias ("cl", clear_cmd, class_breakpoint, 1);
cmd_list_element *break_cmd
- = add_com ("break", class_breakpoint, break_command, _("\
-Set breakpoint at specified location.\n"
-BREAK_ARGS_HELP ("break")));
+ = add_com ("break", class_breakpoint, break_command, _ ("\
+Set breakpoint at specified location.\n" BREAK_ARGS_HELP ("break")));
set_cmd_completer (break_cmd, location_completer);
add_com_alias ("b", break_cmd, class_run, 1);
@@ -14582,7 +14317,7 @@ BREAK_ARGS_HELP ("break")));
add_com_alias ("brea", break_cmd, class_run, 1);
cmd_list_element *info_breakpoints_cmd
- = add_info ("breakpoints", info_breakpoints_command, _("\
+ = add_info ("breakpoints", info_breakpoints_command, _ ("\
Status of specified breakpoints (all user-settable breakpoints if no argument).\n\
The \"Type\" column indicates one of:\n\
\tbreakpoint - normal breakpoint\n\
@@ -14600,7 +14335,8 @@ breakpoint set."));
add_info_alias ("b", info_breakpoints_cmd, 1);
- add_cmd ("breakpoints", class_maintenance, maintenance_info_breakpoints, _("\
+ add_cmd ("breakpoints", class_maintenance, maintenance_info_breakpoints,
+ _ ("\
Status of all breakpoints, or breakpoint number NUMBER.\n\
The \"Type\" column indicates one of:\n\
\tbreakpoint - normal breakpoint\n\
@@ -14621,19 +14357,17 @@ Convenience variable \"$bpnum\" contains the number of the last\n\
breakpoint set."),
&maintenanceinfolist);
- add_basic_prefix_cmd ("catch", class_breakpoint, _("\
+ add_basic_prefix_cmd ("catch", class_breakpoint, _ ("\
Set catchpoints to catch events."),
- &catch_cmdlist,
- 0/*allow-unknown*/, &cmdlist);
+ &catch_cmdlist, 0 /*allow-unknown*/, &cmdlist);
- add_basic_prefix_cmd ("tcatch", class_breakpoint, _("\
+ add_basic_prefix_cmd ("tcatch", class_breakpoint, _ ("\
Set temporary catchpoints to catch events."),
- &tcatch_cmdlist,
- 0/*allow-unknown*/, &cmdlist);
+ &tcatch_cmdlist, 0 /*allow-unknown*/, &cmdlist);
const auto opts = make_watch_options_def_group (nullptr);
- static const std::string watch_help = gdb::option::build_help (_("\
+ static const std::string watch_help = gdb::option::build_help (_ ("\
Set a watchpoint for EXPRESSION.\n\
Usage: watch [-location] EXPRESSION\n\
\n\
@@ -14641,12 +14375,12 @@ Options:\n\
%OPTIONS%\n\
\n\
A watchpoint stops execution of your program whenever the value of\n\
-an expression changes."), opts);
- c = add_com ("watch", class_breakpoint, watch_command,
- watch_help.c_str ());
+an expression changes."),
+ opts);
+ c = add_com ("watch", class_breakpoint, watch_command, watch_help.c_str ());
set_cmd_completer_handle_brkchars (c, watch_command_completer);
- static const std::string rwatch_help = gdb::option::build_help (_("\
+ static const std::string rwatch_help = gdb::option::build_help (_ ("\
Set a read watchpoint for EXPRESSION.\n\
Usage: rwatch [-location] EXPRESSION\n\
\n\
@@ -14654,12 +14388,13 @@ Options:\n\
%OPTIONS%\n\
\n\
A read watchpoint stops execution of your program whenever the value of\n\
-an expression is read."), opts);
+an expression is read."),
+ opts);
c = add_com ("rwatch", class_breakpoint, rwatch_command,
rwatch_help.c_str ());
set_cmd_completer_handle_brkchars (c, watch_command_completer);
- static const std::string awatch_help = gdb::option::build_help (_("\
+ static const std::string awatch_help = gdb::option::build_help (_ ("\
Set an access watchpoint for EXPRESSION.\n\
Usage: awatch [-location] EXPRESSION\n\
\n\
@@ -14667,37 +14402,38 @@ Options:\n\
%OPTIONS%\n\
\n\
An access watchpoint stops execution of your program whenever the value\n\
-of an expression is either read or written."), opts);
+of an expression is either read or written."),
+ opts);
c = add_com ("awatch", class_breakpoint, awatch_command,
awatch_help.c_str ());
set_cmd_completer_handle_brkchars (c, watch_command_completer);
- add_info ("watchpoints", info_watchpoints_command, _("\
+ add_info ("watchpoints", info_watchpoints_command, _ ("\
Status of specified watchpoints (all watchpoints if no argument)."));
/* XXX: cagney/2005-02-23: This should be a boolean, and should
respond to changes - contrary to the description. */
add_setshow_zinteger_cmd ("can-use-hw-watchpoints", class_support,
- &can_use_hw_watchpoints, _("\
-Set debugger's willingness to use watchpoint hardware."), _("\
-Show debugger's willingness to use watchpoint hardware."), _("\
+ &can_use_hw_watchpoints, _ ("\
+Set debugger's willingness to use watchpoint hardware."),
+ _ ("\
+Show debugger's willingness to use watchpoint hardware."),
+ _ ("\
If zero, gdb will not use hardware for new watchpoints, even if\n\
such is available. (However, any hardware watchpoints that were\n\
created before setting this to nonzero, will continue to use watchpoint\n\
hardware.)"),
- NULL,
- show_can_use_hw_watchpoints,
- &setlist, &showlist);
+ NULL, show_can_use_hw_watchpoints, &setlist,
+ &showlist);
can_use_hw_watchpoints = 1;
/* Tracepoint manipulation commands. */
cmd_list_element *trace_cmd
- = add_com ("trace", class_breakpoint, trace_command, _("\
+ = add_com ("trace", class_breakpoint, trace_command, _ ("\
Set a tracepoint at specified location.\n\
-\n"
-BREAK_ARGS_HELP ("trace") "\n\
+\n" BREAK_ARGS_HELP ("trace") "\n\
Do \"help tracepoints\" for info on other tracepoint commands."));
set_cmd_completer (trace_cmd, location_completer);
@@ -14706,14 +14442,13 @@ Do \"help tracepoints\" for info on other tracepoint commands."));
add_com_alias ("tra", trace_cmd, class_breakpoint, 1);
add_com_alias ("trac", trace_cmd, class_breakpoint, 1);
- c = add_com ("ftrace", class_breakpoint, ftrace_command, _("\
+ c = add_com ("ftrace", class_breakpoint, ftrace_command, _ ("\
Set a fast tracepoint at specified location.\n\
-\n"
-BREAK_ARGS_HELP ("ftrace") "\n\
+\n" BREAK_ARGS_HELP ("ftrace") "\n\
Do \"help tracepoints\" for info on other tracepoint commands."));
set_cmd_completer (c, location_completer);
- c = add_com ("strace", class_breakpoint, strace_command, _("\
+ c = add_com ("strace", class_breakpoint, strace_command, _ ("\
Set a static tracepoint at location or marker.\n\
\n\
strace [LOCATION] [if CONDITION]\n\
@@ -14736,7 +14471,7 @@ Do \"help tracepoints\" for info on other tracepoint commands."));
set_cmd_completer (c, location_completer);
cmd_list_element *info_tracepoints_cmd
- = add_info ("tracepoints", info_tracepoints_command, _("\
+ = add_info ("tracepoints", info_tracepoints_command, _ ("\
Status of specified tracepoints (all tracepoints if no argument).\n\
Convenience variable \"$tpnum\" contains the number of the\n\
last tracepoint set."));
@@ -14744,39 +14479,38 @@ last tracepoint set."));
add_info_alias ("tp", info_tracepoints_cmd, 1);
cmd_list_element *delete_tracepoints_cmd
- = add_cmd ("tracepoints", class_trace, delete_trace_command, _("\
+ = add_cmd ("tracepoints", class_trace, delete_trace_command, _ ("\
Delete specified tracepoints.\n\
Arguments are tracepoint numbers, separated by spaces.\n\
No argument means delete all tracepoints."),
- &deletelist);
+ &deletelist);
add_alias_cmd ("tr", delete_tracepoints_cmd, class_trace, 1, &deletelist);
- c = add_cmd ("tracepoints", class_trace, disable_trace_command, _("\
+ c = add_cmd ("tracepoints", class_trace, disable_trace_command, _ ("\
Disable specified tracepoints.\n\
Arguments are tracepoint numbers, separated by spaces.\n\
No argument means disable all tracepoints."),
- &disablelist);
+ &disablelist);
deprecate_cmd (c, "disable");
- c = add_cmd ("tracepoints", class_trace, enable_trace_command, _("\
+ c = add_cmd ("tracepoints", class_trace, enable_trace_command, _ ("\
Enable specified tracepoints.\n\
Arguments are tracepoint numbers, separated by spaces.\n\
No argument means enable all tracepoints."),
- &enablelist);
+ &enablelist);
deprecate_cmd (c, "enable");
- add_com ("passcount", class_trace, trace_pass_command, _("\
+ add_com ("passcount", class_trace, trace_pass_command, _ ("\
Set the passcount for a tracepoint.\n\
The trace will end when the tracepoint has been passed 'count' times.\n\
Usage: passcount COUNT TPNUM, where TPNUM may also be \"all\";\n\
if TPNUM is omitted, passcount refers to the last tracepoint defined."));
add_basic_prefix_cmd ("save", class_breakpoint,
- _("Save breakpoint definitions as a script."),
- &save_cmdlist,
- 0/*allow-unknown*/, &cmdlist);
+ _ ("Save breakpoint definitions as a script."),
+ &save_cmdlist, 0 /*allow-unknown*/, &cmdlist);
- c = add_cmd ("breakpoints", class_breakpoint, save_breakpoints_command, _("\
+ c = add_cmd ("breakpoints", class_breakpoint, save_breakpoints_command, _ ("\
Save current breakpoint definitions as a script.\n\
This includes all types of breakpoints (breakpoints, watchpoints,\n\
catchpoints, tracepoints). Use the 'source' command in another debug\n\
@@ -14785,7 +14519,7 @@ session to restore them."),
set_cmd_completer (c, filename_completer);
cmd_list_element *save_tracepoints_cmd
- = add_cmd ("tracepoints", class_trace, save_tracepoints_command, _("\
+ = add_cmd ("tracepoints", class_trace, save_tracepoints_command, _ ("\
Save current tracepoint definitions as a script.\n\
Use the 'source' command in another debug session to restore them."),
&save_cmdlist);
@@ -14794,64 +14528,66 @@ Use the 'source' command in another debug session to restore them."),
c = add_com_alias ("save-tracepoints", save_tracepoints_cmd, class_trace, 0);
deprecate_cmd (c, "save tracepoints");
- add_setshow_prefix_cmd ("breakpoint", class_maintenance,
- _("\
+ add_setshow_prefix_cmd ("breakpoint", class_maintenance, _ ("\
Breakpoint specific settings.\n\
Configure various breakpoint-specific variables such as\n\
pending breakpoint behavior."),
- _("\
+ _ ("\
Breakpoint specific settings.\n\
Configure various breakpoint-specific variables such as\n\
pending breakpoint behavior."),
&breakpoint_set_cmdlist, &breakpoint_show_cmdlist,
&setlist, &showlist);
- add_setshow_auto_boolean_cmd ("pending", no_class,
- &pending_break_support, _("\
-Set debugger's behavior regarding pending breakpoints."), _("\
-Show debugger's behavior regarding pending breakpoints."), _("\
+ add_setshow_auto_boolean_cmd ("pending", no_class, &pending_break_support,
+ _ ("\
+Set debugger's behavior regarding pending breakpoints."),
+ _ ("\
+Show debugger's behavior regarding pending breakpoints."),
+ _ ("\
If on, an unrecognized breakpoint location will cause gdb to create a\n\
pending breakpoint. If off, an unrecognized breakpoint location results in\n\
an error. If auto, an unrecognized breakpoint location results in a\n\
user-query to see if a pending breakpoint should be created."),
- NULL,
- show_pending_break_support,
+ NULL, show_pending_break_support,
&breakpoint_set_cmdlist,
&breakpoint_show_cmdlist);
pending_break_support = AUTO_BOOLEAN_AUTO;
add_setshow_boolean_cmd ("auto-hw", no_class,
- &automatic_hardware_breakpoints, _("\
-Set automatic usage of hardware breakpoints."), _("\
-Show automatic usage of hardware breakpoints."), _("\
+ &automatic_hardware_breakpoints, _ ("\
+Set automatic usage of hardware breakpoints."),
+ _ ("\
+Show automatic usage of hardware breakpoints."),
+ _ ("\
If set, the debugger will automatically use hardware breakpoints for\n\
breakpoints set with \"break\" but falling in read-only memory. If not set,\n\
a warning will be emitted for such breakpoints."),
- NULL,
- show_automatic_hardware_breakpoints,
- &breakpoint_set_cmdlist,
- &breakpoint_show_cmdlist);
+ NULL, show_automatic_hardware_breakpoints,
+ &breakpoint_set_cmdlist, &breakpoint_show_cmdlist);
add_setshow_boolean_cmd ("always-inserted", class_support,
- &always_inserted_mode, _("\
-Set mode for inserting breakpoints."), _("\
-Show mode for inserting breakpoints."), _("\
+ &always_inserted_mode, _ ("\
+Set mode for inserting breakpoints."),
+ _ ("\
+Show mode for inserting breakpoints."),
+ _ ("\
When this mode is on, breakpoints are inserted immediately as soon as\n\
they're created, kept inserted even when execution stops, and removed\n\
only when the user deletes them. When this mode is off (the default),\n\
breakpoints are inserted only when execution continues, and removed\n\
when execution stops."),
- NULL,
- &show_always_inserted_mode,
- &breakpoint_set_cmdlist,
- &breakpoint_show_cmdlist);
+ NULL, &show_always_inserted_mode,
+ &breakpoint_set_cmdlist, &breakpoint_show_cmdlist);
add_setshow_enum_cmd ("condition-evaluation", class_breakpoint,
condition_evaluation_enums,
- &condition_evaluation_mode_1, _("\
-Set mode of breakpoint condition evaluation."), _("\
-Show mode of breakpoint condition evaluation."), _("\
+ &condition_evaluation_mode_1, _ ("\
+Set mode of breakpoint condition evaluation."),
+ _ ("\
+Show mode of breakpoint condition evaluation."),
+ _ ("\
When this is set to \"host\", breakpoint conditions will be\n\
evaluated on the host's side by GDB. When it is set to \"target\",\n\
breakpoint conditions will be downloaded to the target (if the target\n\
@@ -14859,12 +14595,11 @@ supports such feature) and conditions will be evaluated on the target's side.\n\
If this is set to \"auto\" (default), this will be automatically set to\n\
\"target\" if it supports condition evaluation, otherwise it will\n\
be set to \"host\"."),
- &set_condition_evaluation_mode,
- &show_condition_evaluation_mode,
- &breakpoint_set_cmdlist,
- &breakpoint_show_cmdlist);
+ &set_condition_evaluation_mode,
+ &show_condition_evaluation_mode,
+ &breakpoint_set_cmdlist, &breakpoint_show_cmdlist);
- add_com ("break-range", class_breakpoint, break_range_command, _("\
+ add_com ("break-range", class_breakpoint, break_range_command, _ ("\
Set a breakpoint for an address range.\n\
break-range START-LOCATION, END-LOCATION\n\
where START-LOCATION and END-LOCATION can be one of the following:\n\
@@ -14880,51 +14615,55 @@ The breakpoint will stop execution of the inferior whenever it executes\n\
an instruction at any address within the [START-LOCATION, END-LOCATION]\n\
range (including START-LOCATION and END-LOCATION)."));
- c = add_com ("dprintf", class_breakpoint, dprintf_command, _("\
+ c = add_com ("dprintf", class_breakpoint, dprintf_command,
+ _ ("\
Set a dynamic printf at specified location.\n\
dprintf location,format string,arg1,arg2,...\n\
location may be a linespec, explicit, or address location.\n"
-"\n" LOCATION_SPEC_HELP_STRING));
+ "\n" LOCATION_SPEC_HELP_STRING));
set_cmd_completer (c, location_completer);
- add_setshow_enum_cmd ("dprintf-style", class_support,
- dprintf_style_enums, &dprintf_style, _("\
-Set the style of usage for dynamic printf."), _("\
-Show the style of usage for dynamic printf."), _("\
+ add_setshow_enum_cmd ("dprintf-style", class_support, dprintf_style_enums,
+ &dprintf_style, _ ("\
+Set the style of usage for dynamic printf."),
+ _ ("\
+Show the style of usage for dynamic printf."),
+ _ ("\
This setting chooses how GDB will do a dynamic printf.\n\
If the value is \"gdb\", then the printing is done by GDB to its own\n\
console, as with the \"printf\" command.\n\
If the value is \"call\", the print is done by calling a function in your\n\
program; by default printf(), but you can choose a different function or\n\
output stream by setting dprintf-function and dprintf-channel."),
- update_dprintf_commands, NULL,
- &setlist, &showlist);
-
- add_setshow_string_cmd ("dprintf-function", class_support,
- &dprintf_function, _("\
-Set the function to use for dynamic printf."), _("\
-Show the function to use for dynamic printf."), NULL,
- update_dprintf_commands, NULL,
- &setlist, &showlist);
-
- add_setshow_string_cmd ("dprintf-channel", class_support,
- &dprintf_channel, _("\
-Set the channel to use for dynamic printf."), _("\
-Show the channel to use for dynamic printf."), NULL,
- update_dprintf_commands, NULL,
- &setlist, &showlist);
+ update_dprintf_commands, NULL, &setlist, &showlist);
+
+ add_setshow_string_cmd ("dprintf-function", class_support, &dprintf_function,
+ _ ("\
+Set the function to use for dynamic printf."),
+ _ ("\
+Show the function to use for dynamic printf."),
+ NULL, update_dprintf_commands, NULL, &setlist,
+ &showlist);
+
+ add_setshow_string_cmd ("dprintf-channel", class_support, &dprintf_channel,
+ _ ("\
+Set the channel to use for dynamic printf."),
+ _ ("\
+Show the channel to use for dynamic printf."),
+ NULL, update_dprintf_commands, NULL, &setlist,
+ &showlist);
add_setshow_boolean_cmd ("disconnected-dprintf", no_class,
- &disconnected_dprintf, _("\
-Set whether dprintf continues after GDB disconnects."), _("\
-Show whether dprintf continues after GDB disconnects."), _("\
+ &disconnected_dprintf, _ ("\
+Set whether dprintf continues after GDB disconnects."),
+ _ ("\
+Show whether dprintf continues after GDB disconnects."),
+ _ ("\
Use this to let dprintf commands continue to hit and produce output\n\
even if GDB disconnects or detaches from the target."),
- NULL,
- NULL,
- &setlist, &showlist);
+ NULL, NULL, &setlist, &showlist);
- add_com ("agent-printf", class_vars, agent_printf_command, _("\
+ add_com ("agent-printf", class_vars, agent_printf_command, _ ("\
Target agent only formatted printing, like the C \"printf\" function.\n\
Usage: agent-printf \"format string\", ARG1, ARG2, ARG3, ..., ARGN\n\
This supports most C printf format specifications, like %s, %d, etc.\n\
diff --git a/gdb/breakpoint.h b/gdb/breakpoint.h
index 352e8468537..97cd8b72b2d 100644
--- a/gdb/breakpoint.h
+++ b/gdb/breakpoint.h
@@ -16,7 +16,7 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
-#if !defined (BREAKPOINT_H)
+#if !defined(BREAKPOINT_H)
#define BREAKPOINT_H 1
#include "frame.h"
@@ -75,48 +75,47 @@ enum remove_bp_reason
size arrays that should be independent of the target
architecture. */
-#define BREAKPOINT_MAX 16
-
+#define BREAKPOINT_MAX 16
/* Type of breakpoint. */
enum bptype
- {
- bp_none = 0, /* Eventpoint has been deleted */
- bp_breakpoint, /* Normal breakpoint */
- bp_hardware_breakpoint, /* Hardware assisted breakpoint */
- bp_single_step, /* Software single-step */
- bp_until, /* used by until command */
- bp_finish, /* used by finish command */
- bp_watchpoint, /* Watchpoint */
- bp_hardware_watchpoint, /* Hardware assisted watchpoint */
- bp_read_watchpoint, /* read watchpoint, (hardware assisted) */
- bp_access_watchpoint, /* access watchpoint, (hardware assisted) */
- bp_longjmp, /* secret breakpoint to find longjmp() */
- bp_longjmp_resume, /* secret breakpoint to escape longjmp() */
-
- /* Breakpoint placed to the same location(s) like bp_longjmp but used to
+{
+ bp_none = 0, /* Eventpoint has been deleted */
+ bp_breakpoint, /* Normal breakpoint */
+ bp_hardware_breakpoint, /* Hardware assisted breakpoint */
+ bp_single_step, /* Software single-step */
+ bp_until, /* used by until command */
+ bp_finish, /* used by finish command */
+ bp_watchpoint, /* Watchpoint */
+ bp_hardware_watchpoint, /* Hardware assisted watchpoint */
+ bp_read_watchpoint, /* read watchpoint, (hardware assisted) */
+ bp_access_watchpoint, /* access watchpoint, (hardware assisted) */
+ bp_longjmp, /* secret breakpoint to find longjmp() */
+ bp_longjmp_resume, /* secret breakpoint to escape longjmp() */
+
+ /* Breakpoint placed to the same location(s) like bp_longjmp but used to
protect against stale DUMMY_FRAME. Multiple bp_longjmp_call_dummy and
one bp_call_dummy are chained together by related_breakpoint for each
DUMMY_FRAME. */
- bp_longjmp_call_dummy,
+ bp_longjmp_call_dummy,
- /* An internal breakpoint that is installed on the unwinder's
+ /* An internal breakpoint that is installed on the unwinder's
debug hook. */
- bp_exception,
- /* An internal breakpoint that is set at the point where an
+ bp_exception,
+ /* An internal breakpoint that is set at the point where an
exception will land. */
- bp_exception_resume,
+ bp_exception_resume,
- /* Used by wait_for_inferior for stepping over subroutine calls,
+ /* Used by wait_for_inferior for stepping over subroutine calls,
and for skipping prologues. */
- bp_step_resume,
+ bp_step_resume,
- /* Used by wait_for_inferior for stepping over signal
+ /* Used by wait_for_inferior for stepping over signal
handlers. */
- bp_hp_step_resume,
+ bp_hp_step_resume,
- /* Used to detect when a watchpoint expression has gone out of
+ /* Used to detect when a watchpoint expression has gone out of
scope. These breakpoints are usually not visible to the user.
This breakpoint has some interesting properties:
@@ -128,17 +127,17 @@ enum bptype
associated with when hit.
3) It can never be disabled. */
- bp_watchpoint_scope,
+ bp_watchpoint_scope,
- /* The breakpoint at the end of a call dummy. See bp_longjmp_call_dummy it
+ /* The breakpoint at the end of a call dummy. See bp_longjmp_call_dummy it
is chained with by related_breakpoint. */
- bp_call_dummy,
+ bp_call_dummy,
- /* A breakpoint set on std::terminate, that is used to catch
+ /* A breakpoint set on std::terminate, that is used to catch
otherwise uncaught exceptions thrown during an inferior call. */
- bp_std_terminate,
+ bp_std_terminate,
- /* Some dynamic linkers (HP, maybe Solaris) can arrange for special
+ /* Some dynamic linkers (HP, maybe Solaris) can arrange for special
code in the inferior to run when significant events occur in the
dynamic linker (for example a library is loaded or unloaded).
@@ -146,9 +145,9 @@ enum bptype
when these significant events occur. GDB can then re-examine
the dynamic linker's data structures to discover any newly loaded
dynamic libraries. */
- bp_shlib_event,
+ bp_shlib_event,
- /* Some multi-threaded systems can arrange for a location in the
+ /* Some multi-threaded systems can arrange for a location in the
inferior to be executed when certain thread-related events occur
(such as thread creation or thread death).
@@ -156,70 +155,70 @@ enum bptype
control when these events occur. GDB can then update its thread
lists etc. */
- bp_thread_event,
+ bp_thread_event,
- /* On the same principal, an overlay manager can arrange to call a
+ /* On the same principal, an overlay manager can arrange to call a
magic location in the inferior whenever there is an interesting
change in overlay status. GDB can update its overlay tables
and fiddle with breakpoints in overlays when this breakpoint
is hit. */
- bp_overlay_event,
+ bp_overlay_event,
- /* Master copies of longjmp breakpoints. These are always installed
+ /* Master copies of longjmp breakpoints. These are always installed
as soon as an objfile containing longjmp is loaded, but they are
always disabled. While necessary, temporary clones of bp_longjmp
type will be created and enabled. */
- bp_longjmp_master,
+ bp_longjmp_master,
- /* Master copies of std::terminate breakpoints. */
- bp_std_terminate_master,
+ /* Master copies of std::terminate breakpoints. */
+ bp_std_terminate_master,
- /* Like bp_longjmp_master, but for exceptions. */
- bp_exception_master,
+ /* Like bp_longjmp_master, but for exceptions. */
+ bp_exception_master,
- bp_catchpoint,
+ bp_catchpoint,
- bp_tracepoint,
- bp_fast_tracepoint,
- bp_static_tracepoint,
- /* Like bp_static_tracepoint but for static markers. */
- bp_static_marker_tracepoint,
+ bp_tracepoint,
+ bp_fast_tracepoint,
+ bp_static_tracepoint,
+ /* Like bp_static_tracepoint but for static markers. */
+ bp_static_marker_tracepoint,
- /* A dynamic printf stops at the given location, does a formatted
+ /* A dynamic printf stops at the given location, does a formatted
print, then automatically continues. (Although this is sort of
like a macro packaging up standard breakpoint functionality,
GDB doesn't have a way to construct types of breakpoint from
elements of behavior.) */
- bp_dprintf,
+ bp_dprintf,
- /* Event for JIT compiled code generation or deletion. */
- bp_jit_event,
+ /* Event for JIT compiled code generation or deletion. */
+ bp_jit_event,
- /* Breakpoint is placed at the STT_GNU_IFUNC resolver. When hit GDB
+ /* Breakpoint is placed at the STT_GNU_IFUNC resolver. When hit GDB
inserts new bp_gnu_ifunc_resolver_return at the caller.
bp_gnu_ifunc_resolver is still being kept here as a different thread
may still hit it before bp_gnu_ifunc_resolver_return is hit by the
original thread. */
- bp_gnu_ifunc_resolver,
+ bp_gnu_ifunc_resolver,
- /* On its hit GDB now know the resolved address of the target
+ /* On its hit GDB now know the resolved address of the target
STT_GNU_IFUNC function. Associated bp_gnu_ifunc_resolver can be
deleted now and the breakpoint moved to the target function entry
point. */
- bp_gnu_ifunc_resolver_return,
- };
+ bp_gnu_ifunc_resolver_return,
+};
/* States of enablement of breakpoint. */
enum enable_state
- {
- bp_disabled, /* The eventpoint is inactive, and cannot
+{
+ bp_disabled, /* The eventpoint is inactive, and cannot
trigger. */
- bp_enabled, /* The eventpoint is active, and can
+ bp_enabled, /* The eventpoint is active, and can
trigger. */
- bp_call_disabled, /* The eventpoint has been disabled while a
+ bp_call_disabled, /* The eventpoint has been disabled while a
call into the inferior is "in flight",
because some eventpoints interfere with
the implementation of a call on some
@@ -227,29 +226,28 @@ enum enable_state
automatically enabled and reset when the
call "lands" (either completes, or stops
at another eventpoint). */
- };
-
+};
/* Disposition of breakpoint. Ie: what to do after hitting it. */
enum bpdisp
- {
- disp_del, /* Delete it */
- disp_del_at_next_stop, /* Delete at next stop,
+{
+ disp_del, /* Delete it */
+ disp_del_at_next_stop, /* Delete at next stop,
whether hit or not */
- disp_disable, /* Disable it */
- disp_donttouch /* Leave it alone */
- };
+ disp_disable, /* Disable it */
+ disp_donttouch /* Leave it alone */
+};
/* Status of breakpoint conditions used when synchronizing
conditions with the target. */
enum condition_status
- {
- condition_unchanged = 0,
- condition_modified,
- condition_updated
- };
+{
+ condition_unchanged = 0,
+ condition_modified,
+ condition_updated
+};
/* Information used by targets to insert and remove breakpoints. */
@@ -317,12 +315,13 @@ enum bp_loc_type
bp_loc_hardware_breakpoint,
bp_loc_software_watchpoint,
bp_loc_hardware_watchpoint,
- bp_loc_other /* Miscellaneous... */
+ bp_loc_other /* Miscellaneous... */
};
class bp_location : public refcounted_object
{
public:
+
bp_location () = default;
/* Construct a bp_location with the type inferred from OWNER's
@@ -392,7 +391,7 @@ public:
/* Is this particular location enabled. */
bool enabled = false;
-
+
/* Is this particular location disabled because the condition
expression is invalid at this location. For a location to be
reported as enabled, the ENABLED field above has to be true *and*
@@ -519,10 +518,7 @@ public:
/* A policy class for bp_location reference counting. */
struct bp_location_ref_policy
{
- static void incref (bp_location *loc)
- {
- loc->incref ();
- }
+ static void incref (bp_location *loc) { loc->incref (); }
static void decref (bp_location *loc)
{
@@ -534,8 +530,7 @@ struct bp_location_ref_policy
};
/* A gdb::ref_ptr that has been specialized for bp_location. */
-typedef gdb::ref_ptr<bp_location, bp_location_ref_policy>
- bp_location_ref_ptr;
+typedef gdb::ref_ptr<bp_location, bp_location_ref_policy> bp_location_ref_ptr;
/* The possible return values for print_bpstat, print_it_normal,
print_it_done, print_it_noop. */
@@ -580,12 +575,11 @@ struct breakpoint_ops
`strace_marker_create_breakpoints_sal'.
This function is called inside `create_breakpoint'. */
- void (*create_breakpoints_sal) (struct gdbarch *,
- struct linespec_result *,
+ void (*create_breakpoints_sal) (struct gdbarch *, struct linespec_result *,
gdb::unique_xmalloc_ptr<char>,
- gdb::unique_xmalloc_ptr<char>,
- enum bptype, enum bpdisp, int, int,
- int, int, int, int, unsigned);
+ gdb::unique_xmalloc_ptr<char>, enum bptype,
+ enum bpdisp, int, int, int, int, int, int,
+ unsigned);
};
enum watchpoint_triggered
@@ -598,7 +592,7 @@ enum watchpoint_triggered
watch_triggered_unknown,
/* This hardware watchpoint definitely did trigger. */
- watch_triggered_yes
+ watch_triggered_yes
};
/* Some targets (e.g., embedded PowerPC) need two debug registers to set
@@ -622,8 +616,8 @@ using bp_location_range = next_range<bp_location>;
struct breakpoint
{
- breakpoint (struct gdbarch *gdbarch_, enum bptype bptype,
- bool temp = true, const char *cond_string = nullptr);
+ breakpoint (struct gdbarch *gdbarch_, enum bptype bptype, bool temp = true,
+ const char *cond_string = nullptr);
DISABLE_COPY_AND_ASSIGN (breakpoint);
@@ -636,8 +630,7 @@ struct breakpoint
(e.g., an executable or DSO was loaded, or the inferior just
started). */
virtual void re_set ()
- {
- /* Nothing to re-set. */
+ { /* Nothing to re-set. */
}
/* Insert the breakpoint or watchpoint or activate the catchpoint.
@@ -659,16 +652,14 @@ struct breakpoint
which the inferior stopped, and WS is the target_waitstatus
describing the event. */
virtual int breakpoint_hit (const struct bp_location *bl,
- const address_space *aspace,
- CORE_ADDR bp_addr,
+ const address_space *aspace, CORE_ADDR bp_addr,
const target_waitstatus &ws);
/* Check internal conditions of the breakpoint referred to by BS.
If we should not stop for this breakpoint, set BS->stop to
false. */
virtual void check_status (struct bpstat *bs)
- {
- /* Always stop. */
+ { /* Always stop. */
}
/* Tell how many hardware resources (debug registers) are needed
@@ -683,10 +674,7 @@ struct breakpoint
/* Display information about this breakpoint, for "info
breakpoints". Returns false if this method should use the
default behavior. */
- virtual bool print_one (bp_location **) const
- {
- return false;
- }
+ virtual bool print_one (bp_location **) const { return false; }
/* Display extra information about this breakpoint, below the normal
breakpoint description in "info breakpoints".
@@ -701,8 +689,7 @@ struct breakpoint
*/
virtual void print_one_detail (struct ui_out *) const
- {
- /* Nothing. */
+ { /* Nothing. */
}
/* Display information about this breakpoint after setting it
@@ -714,10 +701,7 @@ struct breakpoint
/* Return true if this breakpoint explains a signal. See
bpstat_explains_signal. */
- virtual bool explains_signal (enum gdb_signal)
- {
- return true;
- }
+ virtual bool explains_signal (enum gdb_signal) { return true; }
/* Called after evaluating the breakpoint's condition,
and only if it evaluated true. */
@@ -856,10 +840,8 @@ struct code_breakpoint : public breakpoint
gdb::unique_xmalloc_ptr<char> filter,
gdb::unique_xmalloc_ptr<char> cond_string,
gdb::unique_xmalloc_ptr<char> extra_string,
- enum bpdisp disposition,
- int thread, int task, int ignore_count,
- int from_tty,
- int enabled, unsigned flags,
+ enum bpdisp disposition, int thread, int task,
+ int ignore_count, int from_tty, int enabled, unsigned flags,
int display_canonical);
~code_breakpoint () override = 0;
@@ -872,8 +854,7 @@ struct code_breakpoint : public breakpoint
int remove_location (struct bp_location *,
enum remove_bp_reason reason) override;
int breakpoint_hit (const struct bp_location *bl,
- const address_space *aspace,
- CORE_ADDR bp_addr,
+ const address_space *aspace, CORE_ADDR bp_addr,
const target_waitstatus &ws) override;
protected:
@@ -884,9 +865,9 @@ protected:
is restricted to just that program space.
This function is called inside `location_spec_to_sals'. */
- virtual std::vector<symtab_and_line> decode_location_spec
- (location_spec *locspec,
- struct program_space *search_pspace);
+ virtual std::vector<symtab_and_line>
+ decode_location_spec (location_spec *locspec,
+ struct program_space *search_pspace);
/* Helper method that does the basic work of re_set. */
void re_set_default ();
@@ -894,10 +875,9 @@ protected:
/* Find the SaL locations corresponding to the given LOCATION.
On return, FOUND will be 1 if any SaL was found, zero otherwise. */
- std::vector<symtab_and_line> location_spec_to_sals
- (location_spec *locspec,
- struct program_space *search_pspace,
- int *found);
+ std::vector<symtab_and_line>
+ location_spec_to_sals (location_spec *locspec,
+ struct program_space *search_pspace, int *found);
/* Helper for breakpoint and tracepoint breakpoint->mention
callbacks. */
@@ -916,8 +896,7 @@ struct watchpoint : public breakpoint
int remove_location (struct bp_location *,
enum remove_bp_reason reason) override;
int breakpoint_hit (const struct bp_location *bl,
- const address_space *aspace,
- CORE_ADDR bp_addr,
+ const address_space *aspace, CORE_ADDR bp_addr,
const target_waitstatus &ws) override;
void check_status (struct bpstat *bs) override;
int resources_needed (const struct bp_location *) override;
@@ -1051,7 +1030,6 @@ struct catchpoint : public breakpoint
~catchpoint () override = 0;
};
-
/* The following stuff is an abstract data type "bpstat" ("breakpoint
status"). This provides the ability to determine whether we have
stopped at a breakpoint, and what we should do about it. */
@@ -1068,8 +1046,8 @@ extern bpstat *bpstat_copy (bpstat *);
BP_ADDR, and WS. Returns the head of the bpstat chain. */
extern bpstat *build_bpstat_chain (const address_space *aspace,
- CORE_ADDR bp_addr,
- const target_waitstatus &ws);
+ CORE_ADDR bp_addr,
+ const target_waitstatus &ws);
/* Get a bpstat associated with having just stopped at address
BP_ADDR in thread PTID. STOP_CHAIN may be supplied as a previously
@@ -1096,10 +1074,10 @@ extern bpstat *build_bpstat_chain (const address_space *aspace,
*/
-extern bpstat *bpstat_stop_status (const address_space *aspace,
- CORE_ADDR pc, thread_info *thread,
- const target_waitstatus &ws,
- bpstat *stop_chain = nullptr);
+extern bpstat *bpstat_stop_status (const address_space *aspace, CORE_ADDR pc,
+ thread_info *thread,
+ const target_waitstatus &ws,
+ bpstat *stop_chain = nullptr);
/* Like bpstat_stop_status, but clears all watchpoints'
watchpoint_triggered flag. Unlike with bpstat_stop_status, there's
@@ -1111,8 +1089,6 @@ extern bpstat *bpstat_stop_status_nowatch (const address_space *aspace,
CORE_ADDR bp_addr,
thread_info *thread,
const target_waitstatus &ws);
-
-
/* This bpstat_what stuff tells wait_for_inferior what to do with a
breakpoint (a challenging task).
@@ -1131,83 +1107,83 @@ extern bpstat *bpstat_stop_status_nowatch (const address_space *aspace,
the step_resume breakpoint). */
enum bpstat_what_main_action
- {
- /* Perform various other tests; that is, this bpstat does not
+{
+ /* Perform various other tests; that is, this bpstat does not
say to perform any action (e.g. failed watchpoint and nothing
else). */
- BPSTAT_WHAT_KEEP_CHECKING,
+ BPSTAT_WHAT_KEEP_CHECKING,
- /* Remove breakpoints, single step once, then put them back in and
+ /* Remove breakpoints, single step once, then put them back in and
go back to what we were doing. It's possible that this should
be removed from the main_action and put into a separate field,
to more cleanly handle
BPSTAT_WHAT_CLEAR_LONGJMP_RESUME_SINGLE. */
- BPSTAT_WHAT_SINGLE,
+ BPSTAT_WHAT_SINGLE,
- /* Set longjmp_resume breakpoint, remove all other breakpoints,
+ /* Set longjmp_resume breakpoint, remove all other breakpoints,
and continue. The "remove all other breakpoints" part is
required if we are also stepping over another breakpoint as
well as doing the longjmp handling. */
- BPSTAT_WHAT_SET_LONGJMP_RESUME,
+ BPSTAT_WHAT_SET_LONGJMP_RESUME,
- /* Clear longjmp_resume breakpoint, then handle as
+ /* Clear longjmp_resume breakpoint, then handle as
BPSTAT_WHAT_KEEP_CHECKING. */
- BPSTAT_WHAT_CLEAR_LONGJMP_RESUME,
+ BPSTAT_WHAT_CLEAR_LONGJMP_RESUME,
- /* Clear step resume breakpoint, and keep checking. */
- BPSTAT_WHAT_STEP_RESUME,
+ /* Clear step resume breakpoint, and keep checking. */
+ BPSTAT_WHAT_STEP_RESUME,
- /* Rather than distinguish between noisy and silent stops here, it
+ /* Rather than distinguish between noisy and silent stops here, it
might be cleaner to have bpstat_print make that decision (also
taking into account stop_print_frame and source_only). But the
implications are a bit scary (interaction with auto-displays,
etc.), so I won't try it. */
- /* Stop silently. */
- BPSTAT_WHAT_STOP_SILENT,
+ /* Stop silently. */
+ BPSTAT_WHAT_STOP_SILENT,
- /* Stop and print. */
- BPSTAT_WHAT_STOP_NOISY,
+ /* Stop and print. */
+ BPSTAT_WHAT_STOP_NOISY,
- /* Clear step resume breakpoint, and keep checking. High-priority
+ /* Clear step resume breakpoint, and keep checking. High-priority
step-resume breakpoints are used when even if there's a user
breakpoint at the current PC when we set the step-resume
breakpoint, we don't want to re-handle any breakpoint other
than the step-resume when it's hit; instead we want to move
past the breakpoint. This is used in the case of skipping
signal handlers. */
- BPSTAT_WHAT_HP_STEP_RESUME,
- };
+ BPSTAT_WHAT_HP_STEP_RESUME,
+};
/* An enum indicating the kind of "stack dummy" stop. This is a bit
of a misnomer because only one kind of truly a stack dummy. */
enum stop_stack_kind
- {
- /* We didn't stop at a stack dummy breakpoint. */
- STOP_NONE = 0,
+{
+ /* We didn't stop at a stack dummy breakpoint. */
+ STOP_NONE = 0,
- /* Stopped at a stack dummy. */
- STOP_STACK_DUMMY,
+ /* Stopped at a stack dummy. */
+ STOP_STACK_DUMMY,
- /* Stopped at std::terminate. */
- STOP_STD_TERMINATE
- };
+ /* Stopped at std::terminate. */
+ STOP_STD_TERMINATE
+};
struct bpstat_what
- {
- enum bpstat_what_main_action main_action;
+{
+ enum bpstat_what_main_action main_action;
- /* Did we hit a call dummy breakpoint? This only goes with a
+ /* Did we hit a call dummy breakpoint? This only goes with a
main_action of BPSTAT_WHAT_STOP_SILENT or
BPSTAT_WHAT_STOP_NOISY (the concept of continuing from a call
dummy without popping the frame is not a useful one). */
- enum stop_stack_kind call_dummy;
+ enum stop_stack_kind call_dummy;
- /* Used for BPSTAT_WHAT_SET_LONGJMP_RESUME and
+ /* Used for BPSTAT_WHAT_SET_LONGJMP_RESUME and
BPSTAT_WHAT_CLEAR_LONGJMP_RESUME. True if we are handling a
longjmp, false if we are handling an exception. */
- bool is_longjmp;
- };
+ bool is_longjmp;
+};
/* Tell what to do about this bpstat. */
struct bpstat_what bpstat_what (bpstat *);
@@ -1275,34 +1251,34 @@ extern void bpstat_clear_actions (void);
/* Values used to tell the printing routine how to behave for this
bpstat. */
enum bp_print_how
- {
- /* This is used when we want to do a normal printing of the reason
+{
+ /* This is used when we want to do a normal printing of the reason
for stopping. The output will depend on the type of eventpoint
we are dealing with. This is the default value, most commonly
used. */
- print_it_normal,
- /* This is used when nothing should be printed for this bpstat
+ print_it_normal,
+ /* This is used when nothing should be printed for this bpstat
entry. */
- print_it_noop,
- /* This is used when everything which needs to be printed has
+ print_it_noop,
+ /* This is used when everything which needs to be printed has
already been printed. But we still want to print the frame. */
- print_it_done
- };
+ print_it_done
+};
struct bpstat
- {
- bpstat ();
- bpstat (struct bp_location *bl, bpstat ***bs_link_pointer);
+{
+ bpstat ();
+ bpstat (struct bp_location *bl, bpstat ***bs_link_pointer);
- bpstat (const bpstat &);
- bpstat &operator= (const bpstat &) = delete;
+ bpstat (const bpstat &);
+ bpstat &operator= (const bpstat &) = delete;
- /* Linked list because there can be more than one breakpoint at
+ /* Linked list because there can be more than one breakpoint at
the same place, and a bpstat reflects the fact that all have
been hit. */
- bpstat *next;
+ bpstat *next;
- /* Location that caused the stop. Locations are refcounted, so
+ /* Location that caused the stop. Locations are refcounted, so
this will never be NULL. Note that this location may end up
detached from a breakpoint, but that does not necessary mean
that the struct breakpoint is gone. E.g., consider a
@@ -1317,48 +1293,47 @@ struct bpstat
What this means is that we should not (in most cases) follow
the `bpstat->bp_location->owner' link, but instead use the
`breakpoint_at' field below. */
- bp_location_ref_ptr bp_location_at;
+ bp_location_ref_ptr bp_location_at;
- /* Breakpoint that caused the stop. This is nullified if the
+ /* Breakpoint that caused the stop. This is nullified if the
breakpoint ends up being deleted. See comments on
`bp_location_at' above for why do we need this field instead of
following the location's owner. */
- struct breakpoint *breakpoint_at;
+ struct breakpoint *breakpoint_at;
- /* The associated command list. */
- counted_command_line commands;
+ /* The associated command list. */
+ counted_command_line commands;
- /* Old value associated with a watchpoint. */
- value_ref_ptr old_val;
+ /* Old value associated with a watchpoint. */
+ value_ref_ptr old_val;
- /* True if this breakpoint tells us to print the frame. */
- bool print;
+ /* True if this breakpoint tells us to print the frame. */
+ bool print;
- /* True if this breakpoint tells us to stop. */
- bool stop;
+ /* True if this breakpoint tells us to stop. */
+ bool stop;
- /* Tell bpstat_print and print_bp_stop_message how to print stuff
+ /* Tell bpstat_print and print_bp_stop_message how to print stuff
associated with this element of the bpstat chain. */
- enum bp_print_how print_it;
- };
+ enum bp_print_how print_it;
+};
enum inf_context
- {
- inf_starting,
- inf_running,
- inf_exited,
- inf_execd
- };
+{
+ inf_starting,
+ inf_running,
+ inf_exited,
+ inf_execd
+};
/* The possible return values for breakpoint_here_p.
We guarantee that zero always means "no breakpoint here". */
enum breakpoint_here
- {
- no_breakpoint_here = 0,
- ordinary_breakpoint_here,
- permanent_breakpoint_here
- };
-
+{
+ no_breakpoint_here = 0,
+ ordinary_breakpoint_here,
+ permanent_breakpoint_here
+};
/* Prototypes for breakpoint-related functions. */
@@ -1367,13 +1342,12 @@ extern enum breakpoint_here breakpoint_here_p (const address_space *,
/* Return true if an enabled breakpoint exists in the range defined by
ADDR and LEN, in ASPACE. */
-extern int breakpoint_in_range_p (const address_space *aspace,
- CORE_ADDR addr, ULONGEST len);
+extern int breakpoint_in_range_p (const address_space *aspace, CORE_ADDR addr,
+ ULONGEST len);
extern int moribund_breakpoint_here_p (const address_space *, CORE_ADDR);
-extern int breakpoint_inserted_here_p (const address_space *,
- CORE_ADDR);
+extern int breakpoint_inserted_here_p (const address_space *, CORE_ADDR);
extern int software_breakpoint_inserted_here_p (const address_space *,
CORE_ADDR);
@@ -1412,11 +1386,11 @@ extern void until_break_command (const char *, int, int);
/* Initialize a struct bp_location. */
-extern void update_breakpoint_locations
- (code_breakpoint *b,
- struct program_space *filter_pspace,
- gdb::array_view<const symtab_and_line> sals,
- gdb::array_view<const symtab_and_line> sals_end);
+extern void
+update_breakpoint_locations (code_breakpoint *b,
+ struct program_space *filter_pspace,
+ gdb::array_view<const symtab_and_line> sals,
+ gdb::array_view<const symtab_and_line> sals_end);
extern void breakpoint_re_set (void);
@@ -1426,19 +1400,18 @@ extern void delete_breakpoint (struct breakpoint *);
struct breakpoint_deleter
{
- void operator() (struct breakpoint *b) const
- {
- delete_breakpoint (b);
- }
+ void operator() (struct breakpoint *b) const { delete_breakpoint (b); }
};
typedef std::unique_ptr<struct breakpoint, breakpoint_deleter> breakpoint_up;
-extern breakpoint_up set_momentary_breakpoint
- (struct gdbarch *, struct symtab_and_line, struct frame_id, enum bptype);
+extern breakpoint_up set_momentary_breakpoint (struct gdbarch *,
+ struct symtab_and_line,
+ struct frame_id, enum bptype);
-extern breakpoint_up set_momentary_breakpoint_at_pc
- (struct gdbarch *, CORE_ADDR pc, enum bptype type);
+extern breakpoint_up set_momentary_breakpoint_at_pc (struct gdbarch *,
+ CORE_ADDR pc,
+ enum bptype type);
extern struct breakpoint *clone_momentary_breakpoint (struct breakpoint *bpkt);
@@ -1473,12 +1446,10 @@ extern const struct breakpoint_ops code_breakpoint_ops;
lists, and pass some additional user data to the command
function. */
-extern void
- add_catch_command (const char *name, const char *docstring,
- cmd_func_ftype *func,
- completer_ftype *completer,
- void *user_data_catch,
- void *user_data_tcatch);
+extern void add_catch_command (const char *name, const char *docstring,
+ cmd_func_ftype *func,
+ completer_ftype *completer,
+ void *user_data_catch, void *user_data_tcatch);
/* Add breakpoint B on the breakpoint list, and notify the user, the
target and breakpoint_created observers of its existence. If
@@ -1488,8 +1459,9 @@ extern void
Takes ownership of B, and returns a non-owning reference to it. */
-extern breakpoint *install_breakpoint
- (int internal, std::unique_ptr<breakpoint> &&b, int update_gll);
+extern breakpoint *install_breakpoint (int internal,
+ std::unique_ptr<breakpoint> &&b,
+ int update_gll);
/* Returns the breakpoint ops appropriate for use with with LOCSPEC
and according to IS_TRACEPOINT. Use this to ensure, for example,
@@ -1497,18 +1469,19 @@ extern breakpoint *install_breakpoint
location specs. If LOCSPEC is NULL, returns
code_breakpoint_ops. */
-extern const struct breakpoint_ops *breakpoint_ops_for_location_spec
- (const location_spec *locspec, bool is_tracepoint);
+extern const struct breakpoint_ops *
+breakpoint_ops_for_location_spec (const location_spec *locspec,
+ bool is_tracepoint);
/* Flags that can be passed down to create_breakpoint, etc., to affect
breakpoint creation in several ways. */
enum breakpoint_create_flags
- {
- /* We're adding a breakpoint to our tables that is already
+{
+ /* We're adding a breakpoint to our tables that is already
inserted in the target. */
- CREATE_BREAKPOINT_FLAGS_INSERTED = 1 << 0
- };
+ CREATE_BREAKPOINT_FLAGS_INSERTED = 1 << 0
+};
/* Set a breakpoint. This function is shared between CLI and MI
functions for setting a breakpoint at LOCSPEC.
@@ -1537,16 +1510,12 @@ enum breakpoint_create_flags
extern int create_breakpoint (struct gdbarch *gdbarch,
struct location_spec *locspec,
const char *cond_string, int thread,
- const char *extra_string,
- bool force_condition,
- int parse_extra,
- int tempflag, enum bptype wanted_type,
- int ignore_count,
+ const char *extra_string, bool force_condition,
+ int parse_extra, int tempflag,
+ enum bptype wanted_type, int ignore_count,
enum auto_boolean pending_break_support,
- const struct breakpoint_ops *ops,
- int from_tty,
- int enabled,
- int internal, unsigned flags);
+ const struct breakpoint_ops *ops, int from_tty,
+ int enabled, int internal, unsigned flags);
extern void insert_breakpoints (void);
@@ -1646,8 +1615,8 @@ extern void enable_breakpoints_after_startup (void);
/* For script interpreters that need to define breakpoint commands
after they've already read the commands into a struct
command_line. */
-extern enum command_control_type commands_from_control_command
- (const char *arg, struct command_line *cmd);
+extern enum command_control_type
+commands_from_control_command (const char *arg, struct command_line *cmd);
extern void clear_breakpoint_hit_counts (void);
@@ -1668,7 +1637,7 @@ extern void disable_breakpoint (struct breakpoint *);
extern void enable_breakpoint (struct breakpoint *);
-extern void breakpoint_set_commands (struct breakpoint *b,
+extern void breakpoint_set_commands (struct breakpoint *b,
counted_command_line &&commands);
extern void breakpoint_set_silent (struct breakpoint *b, int silent);
@@ -1690,8 +1659,9 @@ extern struct breakpoint *create_solib_event_breakpoint (struct gdbarch *,
space, and immediately try to insert it. Returns a pointer to the
breakpoint on success. Deletes the new breakpoint and returns NULL
if inserting the breakpoint fails. */
-extern struct breakpoint *create_and_insert_solib_event_breakpoint
- (struct gdbarch *gdbarch, CORE_ADDR address);
+extern struct breakpoint *
+create_and_insert_solib_event_breakpoint (struct gdbarch *gdbarch,
+ CORE_ADDR address);
extern struct breakpoint *create_thread_event_breakpoint (struct gdbarch *,
CORE_ADDR);
@@ -1725,8 +1695,7 @@ extern void add_solib_catchpoint (const char *arg, bool is_load, bool is_temp,
new location to the set of potential addresses the next instruction
is at. */
extern void insert_single_step_breakpoint (struct gdbarch *,
- const address_space *,
- CORE_ADDR);
+ const address_space *, CORE_ADDR);
/* Insert all software single step breakpoints for the current frame.
Return true if any software single step breakpoints are inserted,
@@ -1778,8 +1747,8 @@ extern void set_breakpoint_condition (struct breakpoint *b, const char *exp,
Also raise an error if the breakpoint already has stop conditions.
If FORCE, define the condition even if it is invalid in
all of the breakpoint locations. */
-extern void set_breakpoint_condition (int bpnum, const char *exp,
- int from_tty, bool force);
+extern void set_breakpoint_condition (int bpnum, const char *exp, int from_tty,
+ bool force);
/* Checks if we are catching syscalls or not.
Returns 0 if not, greater than 0 if we are. */
@@ -1797,8 +1766,7 @@ extern struct tracepoint *get_tracepoint_by_number_on_target (int num);
/* Find a tracepoint by parsing a number in the supplied string. */
extern struct tracepoint *
- get_tracepoint_by_number (const char **arg,
- number_or_range_parser *parser);
+get_tracepoint_by_number (const char **arg, number_or_range_parser *parser);
/* Return true if B is of tracepoint kind. */
@@ -1846,8 +1814,7 @@ breakpoint_safe_range all_breakpoints_safe ();
struct tracepoint_filter
{
- bool operator() (breakpoint *b)
- { return is_tracepoint (b); }
+ bool operator() (breakpoint *b) { return is_tracepoint (b); }
};
/* Breakpoint linked list iterator, filtering to only keep tracepoints. */
diff --git a/gdb/bsd-kvm.c b/gdb/bsd-kvm.c
index 49041ef99bf..3d3b37cd75d 100644
--- a/gdb/bsd-kvm.c
+++ b/gdb/bsd-kvm.c
@@ -28,7 +28,7 @@
#include "process-stratum-target.h"
#include "value.h"
#include "gdbcore.h"
-#include "inferior.h" /* for get_exec_file */
+#include "inferior.h" /* for get_exec_file */
#include "gdbthread.h"
#include "gdbsupport/pathstuff.h"
#include "gdbsupport/gdb_tilde_expand.h"
@@ -59,7 +59,7 @@ static struct pcb *bsd_kvm_paddr;
/* Pointer to architecture-specific function that reconstructs the
register state from PCB and supplies it to REGCACHE. */
-static int (*bsd_kvm_supply_pcb)(struct regcache *regcache, struct pcb *pcb);
+static int (*bsd_kvm_supply_pcb) (struct regcache *regcache, struct pcb *pcb);
/* This is the ptid we use while we're connected to kvm. The kvm
target currently doesn't export any view of the running processes,
@@ -68,27 +68,24 @@ static ptid_t bsd_kvm_ptid;
/* The libkvm target. */
-static const target_info bsd_kvm_target_info = {
- "kvm",
- N_("Kernel memory interface"),
- N_("Use a kernel virtual memory image as a target.\n\
-Optionally specify the filename of a core dump.")
-};
+static const target_info bsd_kvm_target_info
+ = { "kvm", N_ ("Kernel memory interface"),
+ N_ ("Use a kernel virtual memory image as a target.\n\
+Optionally specify the filename of a core dump.") };
class bsd_kvm_target final : public process_stratum_target
{
public:
+
bsd_kvm_target () = default;
- const target_info &info () const override
- { return bsd_kvm_target_info; }
+ const target_info &info () const override { return bsd_kvm_target_info; }
void close () override;
void fetch_registers (struct regcache *, int) override;
enum target_xfer_status xfer_partial (enum target_object object,
- const char *annex,
- gdb_byte *readbuf,
+ const char *annex, gdb_byte *readbuf,
const gdb_byte *writebuf,
ULONGEST offset, ULONGEST len,
ULONGEST *xfered_len) override;
@@ -98,7 +95,9 @@ public:
std::string pid_to_str (ptid_t) override;
bool has_memory () override { return true; }
+
bool has_stack () override { return true; }
+
bool has_registers () override { return true; }
};
@@ -148,7 +147,7 @@ bsd_kvm_target::close ()
if (core_kd)
{
if (kvm_close (core_kd) == -1)
- warning (("%s"), kvm_geterr(core_kd));
+ warning (("%s"), kvm_geterr (core_kd));
core_kd = NULL;
}
@@ -158,8 +157,8 @@ bsd_kvm_target::close ()
}
static LONGEST
-bsd_kvm_xfer_memory (CORE_ADDR addr, ULONGEST len,
- gdb_byte *readbuf, const gdb_byte *writebuf)
+bsd_kvm_xfer_memory (CORE_ADDR addr, ULONGEST len, gdb_byte *readbuf,
+ const gdb_byte *writebuf)
{
ssize_t nbytes = len;
@@ -171,10 +170,10 @@ bsd_kvm_xfer_memory (CORE_ADDR addr, ULONGEST len,
}
enum target_xfer_status
-bsd_kvm_target::xfer_partial (enum target_object object,
- const char *annex, gdb_byte *readbuf,
- const gdb_byte *writebuf,
- ULONGEST offset, ULONGEST len, ULONGEST *xfered_len)
+bsd_kvm_target::xfer_partial (enum target_object object, const char *annex,
+ gdb_byte *readbuf, const gdb_byte *writebuf,
+ ULONGEST offset, ULONGEST len,
+ ULONGEST *xfered_len)
{
switch (object)
{
@@ -202,10 +201,10 @@ void
bsd_kvm_target::files_info ()
{
if (bsd_kvm_corefile != _PATH_MEM)
- gdb_printf (_("\tUsing the kernel crash dump %s.\n"),
+ gdb_printf (_ ("\tUsing the kernel crash dump %s.\n"),
bsd_kvm_corefile.c_str ());
else
- gdb_printf (_("\tUsing the currently running kernel.\n"));
+ gdb_printf (_ ("\tUsing the currently running kernel.\n"));
}
/* Fetch process control block at address PADDR. */
@@ -298,9 +297,8 @@ bsd_kvm_target::fetch_registers (struct regcache *regcache, int regnum)
#endif
/* i18n: PCB == "Process Control Block". */
- error (_("Cannot find a valid PCB"));
+ error (_ ("Cannot find a valid PCB"));
}
-
/* Kernel memory interface commands. */
struct cmd_list_element *bsd_kvm_cmdlist;
@@ -319,10 +317,10 @@ bsd_kvm_proc_cmd (const char *arg, int fromtty)
CORE_ADDR addr;
if (arg == NULL)
- error_no_arg (_("proc address"));
+ error_no_arg (_ ("proc address"));
if (core_kd == NULL)
- error (_("No kernel memory image."));
+ error (_ ("No kernel memory image."));
addr = parse_and_eval_address (arg);
#ifdef HAVE_STRUCT_LWP
@@ -347,12 +345,12 @@ bsd_kvm_pcb_cmd (const char *arg, int fromtty)
{
if (arg == NULL)
/* i18n: PCB == "Process Control Block". */
- error_no_arg (_("pcb address"));
+ error_no_arg (_ ("pcb address"));
if (core_kd == NULL)
- error (_("No kernel memory image."));
+ error (_ ("No kernel memory image."));
- bsd_kvm_paddr = (struct pcb *)(u_long) parse_and_eval_address (arg);
+ bsd_kvm_paddr = (struct pcb *) (u_long) parse_and_eval_address (arg);
target_fetch_registers (get_current_regcache (), -1);
@@ -377,24 +375,24 @@ bsd_kvm_target::pid_to_str (ptid_t ptid)
block interpreter. */
void
-bsd_kvm_add_target (int (*supply_pcb)(struct regcache *, struct pcb *))
+bsd_kvm_add_target (int (*supply_pcb) (struct regcache *, struct pcb *))
{
gdb_assert (bsd_kvm_supply_pcb == NULL);
bsd_kvm_supply_pcb = supply_pcb;
add_target (bsd_kvm_target_info, bsd_kvm_target_open);
-
- add_prefix_cmd ("kvm", class_obscure, bsd_kvm_cmd, _("\
+
+ add_prefix_cmd ("kvm", class_obscure, bsd_kvm_cmd, _ ("\
Generic command for manipulating the kernel memory interface."),
&bsd_kvm_cmdlist, 0, &cmdlist);
#ifndef HAVE_STRUCT_THREAD_TD_PCB
add_cmd ("proc", class_obscure, bsd_kvm_proc_cmd,
- _("Set current context from proc address"), &bsd_kvm_cmdlist);
+ _ ("Set current context from proc address"), &bsd_kvm_cmdlist);
#endif
add_cmd ("pcb", class_obscure, bsd_kvm_pcb_cmd,
/* i18n: PCB == "Process Control Block". */
- _("Set current context from pcb address"), &bsd_kvm_cmdlist);
+ _ ("Set current context from pcb address"), &bsd_kvm_cmdlist);
/* Some notes on the ptid usage on this target.
diff --git a/gdb/bsd-kvm.h b/gdb/bsd-kvm.h
index 5e96275bebb..4379cb27f30 100644
--- a/gdb/bsd-kvm.h
+++ b/gdb/bsd-kvm.h
@@ -27,7 +27,7 @@ struct regcache;
register CUPPLY_PCB as the architecture-specific process control
block interpreter. */
-extern void
- bsd_kvm_add_target (int (*supply_pcb)(struct regcache *, struct pcb *));
+extern void bsd_kvm_add_target (int (*supply_pcb) (struct regcache *,
+ struct pcb *));
#endif /* bsd-kvm.h */
diff --git a/gdb/bsd-uthread.c b/gdb/bsd-uthread.c
index 8b08de8075f..aaa3c614a8f 100644
--- a/gdb/bsd-uthread.c
+++ b/gdb/bsd-uthread.c
@@ -33,16 +33,13 @@
#include "bsd-uthread.h"
-static const target_info bsd_uthread_target_info = {
- "bsd-uthreads",
- N_("BSD user-level threads"),
- N_("BSD user-level threads")
-};
+static const target_info bsd_uthread_target_info
+ = { "bsd-uthreads", N_ ("BSD user-level threads"),
+ N_ ("BSD user-level threads") };
struct bsd_uthread_target final : public target_ops
{
- const target_info &info () const override
- { return bsd_uthread_target_info; }
+ const target_info &info () const override { return bsd_uthread_target_info; }
strata stratum () const override { return thread_stratum; }
@@ -66,17 +63,16 @@ struct bsd_uthread_target final : public target_ops
};
static bsd_uthread_target bsd_uthread_ops;
-
/* Architecture-specific operations. */
struct bsd_uthread_ops
{
/* Supply registers for an inactive thread to a register cache. */
- void (*supply_uthread)(struct regcache *, int, CORE_ADDR) = nullptr;
+ void (*supply_uthread) (struct regcache *, int, CORE_ADDR) = nullptr;
/* Collect registers for an inactive thread from a register cache. */
- void (*collect_uthread)(const struct regcache *, int, CORE_ADDR) = nullptr;
+ void (*collect_uthread) (const struct regcache *, int, CORE_ADDR) = nullptr;
};
/* Per-architecture data key. */
@@ -96,8 +92,8 @@ get_bsd_uthread (struct gdbarch *gdbarch)
void
bsd_uthread_set_supply_uthread (struct gdbarch *gdbarch,
- void (*supply_uthread) (struct regcache *,
- int, CORE_ADDR))
+ void (*supply_uthread) (struct regcache *, int,
+ CORE_ADDR))
{
struct bsd_uthread_ops *ops = get_bsd_uthread (gdbarch);
@@ -108,9 +104,9 @@ bsd_uthread_set_supply_uthread (struct gdbarch *gdbarch,
architecture GDBARCH to SUPPLY_UTHREAD. */
void
-bsd_uthread_set_collect_uthread (struct gdbarch *gdbarch,
- void (*collect_uthread) (const struct regcache *,
- int, CORE_ADDR))
+bsd_uthread_set_collect_uthread (
+ struct gdbarch *gdbarch,
+ void (*collect_uthread) (const struct regcache *, int, CORE_ADDR))
{
struct bsd_uthread_ops *ops = get_bsd_uthread (gdbarch);
@@ -118,7 +114,7 @@ bsd_uthread_set_collect_uthread (struct gdbarch *gdbarch,
}
/* Magic number to help recognize a valid thread structure. */
-#define BSD_UTHREAD_PTHREAD_MAGIC 0xd09ba115
+#define BSD_UTHREAD_PTHREAD_MAGIC 0xd09ba115
/* Check whether the thread structure at ADDR is valid. */
@@ -129,12 +125,12 @@ bsd_uthread_check_magic (CORE_ADDR addr)
ULONGEST magic = read_memory_unsigned_integer (addr, 4, byte_order);
if (magic != BSD_UTHREAD_PTHREAD_MAGIC)
- error (_("Bad magic"));
+ error (_ ("Bad magic"));
}
/* Thread states. */
-#define BSD_UTHREAD_PS_RUNNING 0
-#define BSD_UTHREAD_PS_DEAD 18
+#define BSD_UTHREAD_PS_RUNNING 0
+#define BSD_UTHREAD_PS_DEAD 18
/* Address of the pointer to the thread structure for the running
thread. */
@@ -205,28 +201,28 @@ bsd_uthread_activate (struct objfile *objfile)
if (!ops->supply_uthread)
return 0;
- bsd_uthread_thread_run_addr =
- bsd_uthread_lookup_address ("_thread_run", objfile);
+ bsd_uthread_thread_run_addr
+ = bsd_uthread_lookup_address ("_thread_run", objfile);
if (bsd_uthread_thread_run_addr == 0)
return 0;
- bsd_uthread_thread_list_addr =
- bsd_uthread_lookup_address ("_thread_list", objfile);
+ bsd_uthread_thread_list_addr
+ = bsd_uthread_lookup_address ("_thread_list", objfile);
if (bsd_uthread_thread_list_addr == 0)
return 0;
- bsd_uthread_thread_state_offset =
- bsd_uthread_lookup_offset ("_thread_state_offset", objfile);
+ bsd_uthread_thread_state_offset
+ = bsd_uthread_lookup_offset ("_thread_state_offset", objfile);
if (bsd_uthread_thread_state_offset == 0)
return 0;
- bsd_uthread_thread_next_offset =
- bsd_uthread_lookup_offset ("_thread_next_offset", objfile);
+ bsd_uthread_thread_next_offset
+ = bsd_uthread_lookup_offset ("_thread_next_offset", objfile);
if (bsd_uthread_thread_next_offset == 0)
return 0;
- bsd_uthread_thread_ctx_offset =
- bsd_uthread_lookup_offset ("_thread_ctx_offset", objfile);
+ bsd_uthread_thread_ctx_offset
+ = bsd_uthread_lookup_offset ("_thread_ctx_offset", objfile);
current_inferior ()->push_target (&bsd_uthread_ops);
bsd_uthread_active = 1;
@@ -266,17 +262,15 @@ bsd_uthread_inferior_created (inferior *inf)
}
/* Likely candidates for the threads library. */
-static const char * const bsd_uthread_solib_names[] =
-{
- "/usr/lib/libc_r.so", /* FreeBSD */
- "/usr/lib/libpthread.so", /* OpenBSD */
- NULL
-};
+static const char *const bsd_uthread_solib_names[]
+ = { "/usr/lib/libc_r.so", /* FreeBSD */
+ "/usr/lib/libpthread.so", /* OpenBSD */
+ NULL };
static void
bsd_uthread_solib_loaded (struct so_list *so)
{
- const char * const *names = bsd_uthread_solib_names;
+ const char *const *names = bsd_uthread_solib_names;
for (names = bsd_uthread_solib_names; *names; names++)
{
@@ -410,8 +404,8 @@ bsd_uthread_target::wait (ptid_t ptid, struct target_waitstatus *status,
/* If INFERIOR_PTID doesn't have a tid member yet, and we now have a
ptid with tid set, then ptid is still the initial thread of
the process. Notify GDB core about it. */
- if (inferior_ptid.tid () == 0
- && ptid.tid () != 0 && !in_thread_list (beneath, ptid))
+ if (inferior_ptid.tid () == 0 && ptid.tid () != 0
+ && !in_thread_list (beneath, ptid))
thread_change_ptid (beneath, inferior_ptid, ptid);
/* Don't let the core see a ptid without a corresponding thread. */
@@ -483,29 +477,11 @@ bsd_uthread_target::update_thread_list ()
}
/* Possible states a thread can be in. */
-static const char * const bsd_uthread_state[] =
-{
- "RUNNING",
- "SIGTHREAD",
- "MUTEX_WAIT",
- "COND_WAIT",
- "FDLR_WAIT",
- "FDLW_WAIT",
- "FDR_WAIT",
- "FDW_WAIT",
- "FILE_WAIT",
- "POLL_WAIT",
- "SELECT_WAIT",
- "SLEEP_WAIT",
- "WAIT_WAIT",
- "SIGSUSPEND",
- "SIGWAIT",
- "SPINBLOCK",
- "JOIN",
- "SUSPENDED",
- "DEAD",
- "DEADLOCK"
-};
+static const char *const bsd_uthread_state[]
+ = { "RUNNING", "SIGTHREAD", "MUTEX_WAIT", "COND_WAIT", "FDLR_WAIT",
+ "FDLW_WAIT", "FDR_WAIT", "FDW_WAIT", "FILE_WAIT", "POLL_WAIT",
+ "SELECT_WAIT", "SLEEP_WAIT", "WAIT_WAIT", "SIGSUSPEND", "SIGWAIT",
+ "SPINBLOCK", "JOIN", "SUSPENDED", "DEAD", "DEADLOCK" };
/* Return a string describing th state of the thread specified by
INFO. */
@@ -533,14 +509,14 @@ std::string
bsd_uthread_target::pid_to_str (ptid_t ptid)
{
if (ptid.tid () != 0)
- return string_printf ("process %d, thread 0x%s",
- ptid.pid (),
+ return string_printf ("process %d, thread 0x%s", ptid.pid (),
phex_nz (ptid.tid (), sizeof (ULONGEST)));
return normal_pid_to_str (ptid);
}
void _initialize_bsd_uthread ();
+
void
_initialize_bsd_uthread ()
{
diff --git a/gdb/bsd-uthread.h b/gdb/bsd-uthread.h
index 168a5e041ab..89f26ec4de9 100644
--- a/gdb/bsd-uthread.h
+++ b/gdb/bsd-uthread.h
@@ -23,16 +23,15 @@
/* Set the function that supplies registers for an inactive thread for
architecture GDBARCH to SUPPLY_UTHREAD. */
-extern void bsd_uthread_set_supply_uthread (struct gdbarch *gdbarch,
- void (*supply_uthread) (struct regcache *,
- int, CORE_ADDR));
-
+extern void bsd_uthread_set_supply_uthread (
+ struct gdbarch *gdbarch,
+ void (*supply_uthread) (struct regcache *, int, CORE_ADDR));
/* Set the function that collects registers for an inactive thread for
architecture GDBARCH to SUPPLY_UTHREAD. */
-extern void bsd_uthread_set_collect_uthread (struct gdbarch *gdbarch,
- void (*collect_uthread) (const struct regcache *,
- int, CORE_ADDR));
+extern void bsd_uthread_set_collect_uthread (
+ struct gdbarch *gdbarch,
+ void (*collect_uthread) (const struct regcache *, int, CORE_ADDR));
#endif /* bsd-uthread.h */
diff --git a/gdb/bt-utils.c b/gdb/bt-utils.c
index 68c3f081675..ba4a6dd9865 100644
--- a/gdb/bt-utils.c
+++ b/gdb/bt-utils.c
@@ -36,7 +36,7 @@ gdb_internal_backtrace_set_cmd (const char *args, int from_tty,
if (c->var->get<bool> ())
{
c->var->set<bool> (false);
- error (_("support for this feature is not compiled into GDB"));
+ error (_ ("support for this feature is not compiled into GDB"));
}
#endif
}
@@ -54,8 +54,7 @@ libbacktrace_error (void *data, const char *errmsg, int errnum)
if (errnum < 0)
return;
- const auto sig_write = [] (const char *msg) -> void
- {
+ const auto sig_write = [] (const char *msg) -> void {
gdb_stderr->write_async_safe (msg, strlen (msg));
};
@@ -75,11 +74,10 @@ libbacktrace_error (void *data, const char *errmsg, int errnum)
/* Callback used by libbacktrace to print a single stack frame. */
static int
-libbacktrace_print (void *data, uintptr_t pc, const char *filename,
- int lineno, const char *function)
+libbacktrace_print (void *data, uintptr_t pc, const char *filename, int lineno,
+ const char *function)
{
- const auto sig_write = [] (const char *msg) -> void
- {
+ const auto sig_write = [] (const char *msg) -> void {
gdb_stderr->write_async_safe (msg, strlen (msg));
};
@@ -129,8 +127,7 @@ gdb_internal_backtrace_1 ()
static void
gdb_internal_backtrace_1 ()
{
- const auto sig_write = [] (const char *msg) -> void
- {
+ const auto sig_write = [] (const char *msg) -> void {
gdb_stderr->write_async_safe (msg, strlen (msg));
};
@@ -140,7 +137,7 @@ gdb_internal_backtrace_1 ()
backtrace_symbols_fd (buffer, frames, gdb_stderr->fd ());
if (frames == ARRAY_SIZE (buffer))
- sig_write (_("Backtrace might be incomplete.\n"));
+ sig_write (_ ("Backtrace might be incomplete.\n"));
}
#else
@@ -157,17 +154,16 @@ gdb_internal_backtrace ()
return;
#ifdef GDB_PRINT_INTERNAL_BACKTRACE
- const auto sig_write = [] (const char *msg) -> void
- {
+ const auto sig_write = [] (const char *msg) -> void {
gdb_stderr->write_async_safe (msg, strlen (msg));
};
- sig_write (_("----- Backtrace -----\n"));
+ sig_write (_ ("----- Backtrace -----\n"));
if (gdb_stderr->fd () > -1)
gdb_internal_backtrace_1 ();
else
- sig_write (_("Backtrace unavailable\n"));
+ sig_write (_ ("Backtrace unavailable\n"));
sig_write ("---------------------\n");
#endif
diff --git a/gdb/bt-utils.h b/gdb/bt-utils.h
index ba887927979..000946f9f66 100644
--- a/gdb/bt-utils.h
+++ b/gdb/bt-utils.h
@@ -22,20 +22,19 @@
#define BT_UTILS_H
#ifdef HAVE_LIBBACKTRACE
-# include "backtrace.h"
-# include "backtrace-supported.h"
-# if BACKTRACE_SUPPORTED && (! BACKTRACE_USES_MALLOC)
-# define GDB_PRINT_INTERNAL_BACKTRACE
-# define GDB_PRINT_INTERNAL_BACKTRACE_USING_LIBBACKTRACE
-# endif
+#include "backtrace.h"
+#include "backtrace-supported.h"
+#if BACKTRACE_SUPPORTED && (!BACKTRACE_USES_MALLOC)
+#define GDB_PRINT_INTERNAL_BACKTRACE
+#define GDB_PRINT_INTERNAL_BACKTRACE_USING_LIBBACKTRACE
+#endif
#endif
-#if defined HAVE_EXECINFO_H \
- && defined HAVE_EXECINFO_BACKTRACE \
+#if defined HAVE_EXECINFO_H && defined HAVE_EXECINFO_BACKTRACE \
&& !defined GDB_PRINT_INTERNAL_BACKTRACE_USING_LIBBACKTRACE
-# include <execinfo.h>
-# define GDB_PRINT_INTERNAL_BACKTRACE
-# define GDB_PRINT_INTERNAL_BACKTRACE_USING_EXECINFO
+#include <execinfo.h>
+#define GDB_PRINT_INTERNAL_BACKTRACE
+#define GDB_PRINT_INTERNAL_BACKTRACE_USING_EXECINFO
#endif
/* Define GDB_PRINT_INTERNAL_BACKTRACE_INIT_ON. This is a boolean value
@@ -46,9 +45,9 @@
but if backtrace printing is not supported then this has the value
false. */
#ifdef GDB_PRINT_INTERNAL_BACKTRACE
-# define GDB_PRINT_INTERNAL_BACKTRACE_INIT_ON true
+#define GDB_PRINT_INTERNAL_BACKTRACE_INIT_ON true
#else
-# define GDB_PRINT_INTERNAL_BACKTRACE_INIT_ON false
+#define GDB_PRINT_INTERNAL_BACKTRACE_INIT_ON false
#endif
/* Print a backtrace of the current GDB process to the current
diff --git a/gdb/btrace.c b/gdb/btrace.c
index 38d3882c154..ee3da1685e1 100644
--- a/gdb/btrace.c
+++ b/gdb/btrace.c
@@ -58,13 +58,12 @@ static void btrace_add_pc (struct thread_info *tp);
/* Print a record debug message. Use do ... while (0) to avoid ambiguities
when used in if statements. */
-#define DEBUG(msg, args...) \
- do \
- { \
- if (record_debug != 0) \
- gdb_printf (gdb_stdlog, \
- "[btrace] " msg "\n", ##args); \
- } \
+#define DEBUG(msg, args...) \
+ do \
+ { \
+ if (record_debug != 0) \
+ gdb_printf (gdb_stdlog, "[btrace] " msg "\n", ##args); \
+ } \
while (0)
#define DEBUG_FTRACE(msg, args...) DEBUG ("[ftrace] " msg, ##args)
@@ -137,14 +136,14 @@ ftrace_debug (const struct btrace_function *bfun, const char *prefix)
ibegin = bfun->insn_offset;
iend = ibegin + bfun->insn.size ();
- DEBUG_FTRACE ("%s: fun = %s, file = %s, level = %d, insn = [%u; %u)",
- prefix, fun, file, level, ibegin, iend);
+ DEBUG_FTRACE ("%s: fun = %s, file = %s, level = %d, insn = [%u; %u)", prefix,
+ fun, file, level, ibegin, iend);
}
/* Return the number of instructions in a given function call segment. */
static unsigned int
-ftrace_call_num_insn (const struct btrace_function* bfun)
+ftrace_call_num_insn (const struct btrace_function *bfun)
{
if (bfun == NULL)
return 0;
@@ -235,8 +234,7 @@ ftrace_function_switched (const struct btrace_function *bfun,
static struct btrace_function *
ftrace_new_function (struct btrace_thread_info *btinfo,
- struct minimal_symbol *mfun,
- struct symbol *fun)
+ struct minimal_symbol *mfun, struct symbol *fun)
{
int level;
unsigned int number, insn_offset;
@@ -311,8 +309,7 @@ ftrace_fixup_caller (struct btrace_thread_info *btinfo,
static struct btrace_function *
ftrace_new_call (struct btrace_thread_info *btinfo,
- struct minimal_symbol *mfun,
- struct symbol *fun)
+ struct minimal_symbol *mfun, struct symbol *fun)
{
const unsigned int length = btinfo->functions.size ();
struct btrace_function *bfun = ftrace_new_function (btinfo, mfun, fun);
@@ -331,8 +328,7 @@ ftrace_new_call (struct btrace_thread_info *btinfo,
static struct btrace_function *
ftrace_new_tailcall (struct btrace_thread_info *btinfo,
- struct minimal_symbol *mfun,
- struct symbol *fun)
+ struct minimal_symbol *mfun, struct symbol *fun)
{
const unsigned int length = btinfo->functions.size ();
struct btrace_function *bfun = ftrace_new_function (btinfo, mfun, fun);
@@ -366,8 +362,7 @@ ftrace_get_caller (struct btrace_thread_info *btinfo,
static struct btrace_function *
ftrace_find_caller (struct btrace_thread_info *btinfo,
- struct btrace_function *bfun,
- struct minimal_symbol *mfun,
+ struct btrace_function *bfun, struct minimal_symbol *mfun,
struct symbol *fun)
{
for (; bfun != NULL; bfun = ftrace_find_call_by_number (btinfo, bfun->up))
@@ -414,8 +409,7 @@ ftrace_find_call (struct btrace_thread_info *btinfo,
static struct btrace_function *
ftrace_new_return (struct btrace_thread_info *btinfo,
- struct minimal_symbol *mfun,
- struct symbol *fun)
+ struct minimal_symbol *mfun, struct symbol *fun)
{
struct btrace_function *prev, *bfun, *caller;
@@ -496,8 +490,7 @@ ftrace_new_return (struct btrace_thread_info *btinfo,
static struct btrace_function *
ftrace_new_switch (struct btrace_thread_info *btinfo,
- struct minimal_symbol *mfun,
- struct symbol *fun)
+ struct minimal_symbol *mfun, struct symbol *fun)
{
struct btrace_function *prev, *bfun;
@@ -752,14 +745,14 @@ ftrace_compute_global_level_offset (struct btrace_thread_info *btinfo)
if (btinfo->functions.empty ())
return;
- unsigned int length = btinfo->functions.size() - 1;
+ unsigned int length = btinfo->functions.size () - 1;
for (unsigned int i = 0; i < length; ++i)
level = std::min (level, btinfo->functions[i].level);
/* The last function segment contains the current instruction, which is not
really part of the trace. If it contains just this one instruction, we
ignore the segment. */
- struct btrace_function *last = &btinfo->functions.back();
+ struct btrace_function *last = &btinfo->functions.back ();
if (last->insn.size () != 1)
level = std::min (level, last->level);
@@ -840,8 +833,8 @@ ftrace_connect_bfun (struct btrace_thread_info *btinfo,
prev = ftrace_find_call_by_number (btinfo, prev->up);
ftrace_fixup_caller (btinfo, next, prev, prev_flags);
- for (; prev != NULL; prev = ftrace_find_call_by_number (btinfo,
- prev->up))
+ for (; prev != NULL;
+ prev = ftrace_find_call_by_number (btinfo, prev->up))
{
/* At the end of PREV's back trace, continue with CALLER. */
if (prev->up == 0)
@@ -1052,7 +1045,7 @@ btrace_compute_ftrace_bts (struct thread_info *tp,
const struct btrace_data_bts *btrace,
std::vector<unsigned int> &gaps)
{
- /* We may end up doing target calls that require the current thread to be TP,
+ /* We may end up doing target calls that require the current thread to be TP,
for example reading memory through gdb_insn_length. Make sure TP is the
current thread. */
scoped_restore_current_thread restore_thread;
@@ -1093,9 +1086,9 @@ btrace_compute_ftrace_bts (struct thread_info *tp,
/* Indicate the gap in the trace. */
bfun = ftrace_new_gap (btinfo, BDE_BTS_OVERFLOW, gaps);
- warning (_("Recorded trace may be corrupted at instruction "
- "%u (pc = %s)."), bfun->insn_offset - 1,
- core_addr_to_string_nz (pc));
+ warning (_ ("Recorded trace may be corrupted at instruction "
+ "%u (pc = %s)."),
+ bfun->insn_offset - 1, core_addr_to_string_nz (pc));
break;
}
@@ -1134,9 +1127,9 @@ btrace_compute_ftrace_bts (struct thread_info *tp,
not at the beginning. */
bfun = ftrace_new_gap (btinfo, BDE_BTS_INSN_SIZE, gaps);
- warning (_("Recorded trace may be incomplete at instruction %u "
- "(pc = %s)."), bfun->insn_offset - 1,
- core_addr_to_string_nz (pc));
+ warning (_ ("Recorded trace may be incomplete at instruction %u "
+ "(pc = %s)."),
+ bfun->insn_offset - 1, core_addr_to_string_nz (pc));
break;
}
@@ -1160,7 +1153,7 @@ btrace_compute_ftrace_bts (struct thread_info *tp,
btinfo->level = -level;
}
-#if defined (HAVE_LIBIPT)
+#if defined(HAVE_LIBIPT)
static enum btrace_insn_class
pt_reclassify_insn (enum pt_insn_class iclass)
@@ -1199,9 +1192,8 @@ pt_btrace_insn_flags (const struct pt_insn &insn)
static btrace_insn
pt_btrace_insn (const struct pt_insn &insn)
{
- return {(CORE_ADDR) insn.ip, (gdb_byte) insn.size,
- pt_reclassify_insn (insn.iclass),
- pt_btrace_insn_flags (insn)};
+ return { (CORE_ADDR) insn.ip, (gdb_byte) insn.size,
+ pt_reclassify_insn (insn.iclass), pt_btrace_insn_flags (insn) };
}
/* Handle instruction decode events (libipt-v2). */
@@ -1211,7 +1203,7 @@ handle_pt_insn_events (struct btrace_thread_info *btinfo,
struct pt_insn_decoder *decoder,
std::vector<unsigned int> &gaps, int status)
{
-#if defined (HAVE_PT_INSN_EVENT)
+#if defined(HAVE_PT_INSN_EVENT)
while (status & pts_event_pending)
{
struct btrace_function *bfun;
@@ -1231,14 +1223,18 @@ handle_pt_insn_events (struct btrace_thread_info *btinfo,
if (event.status_update != 0)
break;
- if (event.variant.enabled.resumed == 0 && !btinfo->functions.empty ())
+ if (event.variant.enabled.resumed == 0
+ && !btinfo->functions.empty ())
{
bfun = ftrace_new_gap (btinfo, BDE_PT_DISABLED, gaps);
pt_insn_get_offset (decoder, &offset);
- warning (_("Non-contiguous trace at instruction %u (offset = 0x%"
- PRIx64 ")."), bfun->insn_offset - 1, offset);
+ warning (
+ _ (
+ "Non-contiguous trace at instruction %u (offset = 0x%" PRIx64
+ ")."),
+ bfun->insn_offset - 1, offset);
}
break;
@@ -1248,7 +1244,7 @@ handle_pt_insn_events (struct btrace_thread_info *btinfo,
pt_insn_get_offset (decoder, &offset);
- warning (_("Overflow at instruction %u (offset = 0x%" PRIx64 ")."),
+ warning (_ ("Overflow at instruction %u (offset = 0x%" PRIx64 ")."),
bfun->insn_offset - 1, offset);
break;
@@ -1267,7 +1263,7 @@ handle_pt_insn_event_flags (struct btrace_thread_info *btinfo,
const struct pt_insn &insn,
std::vector<unsigned int> &gaps)
{
-#if defined (HAVE_STRUCT_PT_INSN_ENABLED)
+#if defined(HAVE_STRUCT_PT_INSN_ENABLED)
/* Tracing is disabled and re-enabled each time we enter the kernel. Most
times, we continue from the same instruction we stopped before. This is
indicated via the RESUMED instruction flag. The ENABLED instruction flag
@@ -1282,13 +1278,13 @@ handle_pt_insn_event_flags (struct btrace_thread_info *btinfo,
pt_insn_get_offset (decoder, &offset);
- warning (_("Non-contiguous trace at instruction %u (offset = 0x%" PRIx64
- ", pc = 0x%" PRIx64 ")."), bfun->insn_offset - 1, offset,
- insn.ip);
+ warning (_ ("Non-contiguous trace at instruction %u (offset = 0x%" PRIx64
+ ", pc = 0x%" PRIx64 ")."),
+ bfun->insn_offset - 1, offset, insn.ip);
}
#endif /* defined (HAVE_STRUCT_PT_INSN_ENABLED) */
-#if defined (HAVE_STRUCT_PT_INSN_RESYNCED)
+#if defined(HAVE_STRUCT_PT_INSN_RESYNCED)
/* Indicate trace overflows. */
if (insn.resynced)
{
@@ -1299,8 +1295,9 @@ handle_pt_insn_event_flags (struct btrace_thread_info *btinfo,
pt_insn_get_offset (decoder, &offset);
- warning (_("Overflow at instruction %u (offset = 0x%" PRIx64 ", pc = 0x%"
- PRIx64 ")."), bfun->insn_offset - 1, offset, insn.ip);
+ warning (_ ("Overflow at instruction %u (offset = 0x%" PRIx64
+ ", pc = 0x%" PRIx64 ")."),
+ bfun->insn_offset - 1, offset, insn.ip);
}
#endif /* defined (HAVE_STRUCT_PT_INSN_RESYNCED) */
}
@@ -1309,8 +1306,7 @@ handle_pt_insn_event_flags (struct btrace_thread_info *btinfo,
static void
ftrace_add_pt (struct btrace_thread_info *btinfo,
- struct pt_insn_decoder *decoder,
- int *plevel,
+ struct pt_insn_decoder *decoder, int *plevel,
std::vector<unsigned int> &gaps)
{
struct btrace_function *bfun;
@@ -1325,8 +1321,9 @@ ftrace_add_pt (struct btrace_thread_info *btinfo,
if (status < 0)
{
if (status != -pte_eos)
- warning (_("Failed to synchronize onto the Intel Processor "
- "Trace stream: %s."), pt_errstr (pt_errcode (status)));
+ warning (_ ("Failed to synchronize onto the Intel Processor "
+ "Trace stream: %s."),
+ pt_errstr (pt_errcode (status)));
break;
}
@@ -1337,7 +1334,7 @@ ftrace_add_pt (struct btrace_thread_info *btinfo,
if (status < 0)
break;
- status = pt_insn_next (decoder, &insn, sizeof(insn));
+ status = pt_insn_next (decoder, &insn, sizeof (insn));
if (status < 0)
break;
@@ -1360,9 +1357,10 @@ ftrace_add_pt (struct btrace_thread_info *btinfo,
pt_insn_get_offset (decoder, &offset);
- warning (_("Decode error (%d) at instruction %u (offset = 0x%" PRIx64
- ", pc = 0x%" PRIx64 "): %s."), status, bfun->insn_offset - 1,
- offset, insn.ip, pt_errstr (pt_errcode (status)));
+ warning (_ ("Decode error (%d) at instruction %u (offset = 0x%" PRIx64
+ ", pc = 0x%" PRIx64 "): %s."),
+ status, bfun->insn_offset - 1, offset, insn.ip,
+ pt_errstr (pt_errcode (status)));
}
}
@@ -1408,8 +1406,9 @@ pt_translate_cpu_vendor (enum btrace_cpu_vendor vendor)
/* Finalize the function branch trace after decode. */
-static void btrace_finalize_ftrace_pt (struct pt_insn_decoder *decoder,
- struct thread_info *tp, int level)
+static void
+btrace_finalize_ftrace_pt (struct pt_insn_decoder *decoder,
+ struct thread_info *tp, int level)
{
pt_insn_free_decoder (decoder);
@@ -1433,7 +1432,7 @@ btrace_compute_ftrace_pt (struct thread_info *tp,
const struct btrace_data_pt *btrace,
std::vector<unsigned int> &gaps)
{
- /* We may end up doing target calls that require the current thread to be TP,
+ /* We may end up doing target calls that require the current thread to be TP,
for example reading memory through btrace_pt_readmem_callback. Make sure
TP is the current thread. */
scoped_restore_current_thread restore_thread;
@@ -1453,41 +1452,43 @@ btrace_compute_ftrace_pt (struct thread_info *tp,
else
level = -btinfo->level;
- pt_config_init(&config);
+ pt_config_init (&config);
config.begin = btrace->data;
config.end = btrace->data + btrace->size;
/* We treat an unknown vendor as 'no errata'. */
if (btrace->config.cpu.vendor != CV_UNKNOWN)
{
- config.cpu.vendor
- = pt_translate_cpu_vendor (btrace->config.cpu.vendor);
+ config.cpu.vendor = pt_translate_cpu_vendor (btrace->config.cpu.vendor);
config.cpu.family = btrace->config.cpu.family;
config.cpu.model = btrace->config.cpu.model;
config.cpu.stepping = btrace->config.cpu.stepping;
errcode = pt_cpu_errata (&config.errata, &config.cpu);
if (errcode < 0)
- error (_("Failed to configure the Intel Processor Trace "
- "decoder: %s."), pt_errstr (pt_errcode (errcode)));
+ error (_ ("Failed to configure the Intel Processor Trace "
+ "decoder: %s."),
+ pt_errstr (pt_errcode (errcode)));
}
decoder = pt_insn_alloc_decoder (&config);
if (decoder == NULL)
- error (_("Failed to allocate the Intel Processor Trace decoder."));
+ error (_ ("Failed to allocate the Intel Processor Trace decoder."));
try
{
struct pt_image *image;
- image = pt_insn_get_image(decoder);
+ image = pt_insn_get_image (decoder);
if (image == NULL)
- error (_("Failed to configure the Intel Processor Trace decoder."));
+ error (_ ("Failed to configure the Intel Processor Trace decoder."));
- errcode = pt_image_set_callback(image, btrace_pt_readmem_callback, NULL);
+ errcode
+ = pt_image_set_callback (image, btrace_pt_readmem_callback, NULL);
if (errcode < 0)
- error (_("Failed to configure the Intel Processor Trace decoder: "
- "%s."), pt_errstr (pt_errcode (errcode)));
+ error (_ ("Failed to configure the Intel Processor Trace decoder: "
+ "%s."),
+ pt_errstr (pt_errcode (errcode)));
ftrace_add_pt (btinfo, decoder, &level, gaps);
}
@@ -1512,7 +1513,7 @@ btrace_compute_ftrace_pt (struct thread_info *tp,
const struct btrace_data_pt *btrace,
std::vector<unsigned int> &gaps)
{
- internal_error (_("Unexpected branch trace format."));
+ internal_error (_ ("Unexpected branch trace format."));
}
#endif /* defined (HAVE_LIBIPT) */
@@ -1523,8 +1524,7 @@ btrace_compute_ftrace_pt (struct thread_info *tp,
format. */
static void
-btrace_compute_ftrace_1 (struct thread_info *tp,
- struct btrace_data *btrace,
+btrace_compute_ftrace_1 (struct thread_info *tp, struct btrace_data *btrace,
const struct btrace_cpu *cpu,
std::vector<unsigned int> &gaps)
{
@@ -1548,11 +1548,12 @@ btrace_compute_ftrace_1 (struct thread_info *tp,
return;
}
- internal_error (_("Unknown branch trace format."));
+ internal_error (_ ("Unknown branch trace format."));
}
static void
-btrace_finalize_ftrace (struct thread_info *tp, std::vector<unsigned int> &gaps)
+btrace_finalize_ftrace (struct thread_info *tp,
+ std::vector<unsigned int> &gaps)
{
if (!gaps.empty ())
{
@@ -1607,12 +1608,12 @@ void
btrace_enable (struct thread_info *tp, const struct btrace_config *conf)
{
if (tp->btrace.target != NULL)
- error (_("Recording already enabled on thread %s (%s)."),
+ error (_ ("Recording already enabled on thread %s (%s)."),
print_thread_id (tp), target_pid_to_str (tp->ptid).c_str ());
-#if !defined (HAVE_LIBIPT)
+#if !defined(HAVE_LIBIPT)
if (conf->format == BTRACE_FORMAT_PT)
- error (_("Intel Processor Trace support was disabled at compile time."));
+ error (_ ("Intel Processor Trace support was disabled at compile time."));
#endif /* !defined (HAVE_LIBIPT) */
DEBUG ("enable thread %s (%s)", print_thread_id (tp),
@@ -1621,7 +1622,7 @@ btrace_enable (struct thread_info *tp, const struct btrace_config *conf)
tp->btrace.target = target_enable_btrace (tp, conf);
if (tp->btrace.target == NULL)
- error (_("Failed to enable recording on thread %s (%s)."),
+ error (_ ("Failed to enable recording on thread %s (%s)."),
print_thread_id (tp), target_pid_to_str (tp->ptid).c_str ());
/* We need to undo the enable in case of errors. */
@@ -1636,8 +1637,7 @@ btrace_enable (struct thread_info *tp, const struct btrace_config *conf)
This is not relevant for BTRACE_FORMAT_PT since the trace will already
start at the PC at which tracing was enabled. */
- if (conf->format != BTRACE_FORMAT_PT
- && can_access_registers_thread (tp))
+ if (conf->format != BTRACE_FORMAT_PT && can_access_registers_thread (tp))
btrace_add_pc (tp);
}
catch (const gdb_exception &exception)
@@ -1667,7 +1667,7 @@ btrace_disable (struct thread_info *tp)
struct btrace_thread_info *btp = &tp->btrace;
if (btp->target == NULL)
- error (_("Recording not enabled on thread %s (%s)."),
+ error (_ ("Recording not enabled on thread %s (%s)."),
print_thread_id (tp), target_pid_to_str (tp->ptid).c_str ());
DEBUG ("disable thread %s (%s)", print_thread_id (tp),
@@ -1749,8 +1749,8 @@ btrace_stitch_bts (struct btrace_data_bts *btrace, struct thread_info *tp)
with a bad block. This should not occur in practice. */
if (first_new_block->end < last_insn.pc)
{
- warning (_("Error while trying to read delta trace. Falling back to "
- "a full read."));
+ warning (_ ("Error while trying to read delta trace. Falling back to "
+ "a full read."));
return -1;
}
@@ -1808,7 +1808,7 @@ btrace_stitch_trace (struct btrace_data *btrace, struct thread_info *tp)
return -1;
}
- internal_error (_("Unknown branch trace format."));
+ internal_error (_ ("Unknown branch trace format."));
}
/* Clear the branch trace histories in BTINFO. */
@@ -1840,7 +1840,7 @@ btrace_maint_clear (struct btrace_thread_info *btinfo)
btinfo->maint.variant.bts.packet_history.end = 0;
break;
-#if defined (HAVE_LIBIPT)
+#if defined(HAVE_LIBIPT)
case BTRACE_FORMAT_PT:
delete btinfo->maint.variant.pt.packets;
@@ -1863,28 +1863,28 @@ btrace_decode_error (enum btrace_format format, int errcode)
switch (errcode)
{
case BDE_BTS_OVERFLOW:
- return _("instruction overflow");
+ return _ ("instruction overflow");
case BDE_BTS_INSN_SIZE:
- return _("unknown instruction");
+ return _ ("unknown instruction");
default:
break;
}
break;
-#if defined (HAVE_LIBIPT)
+#if defined(HAVE_LIBIPT)
case BTRACE_FORMAT_PT:
switch (errcode)
{
case BDE_PT_USER_QUIT:
- return _("trace decode cancelled");
+ return _ ("trace decode cancelled");
case BDE_PT_DISABLED:
- return _("disabled");
+ return _ ("disabled");
case BDE_PT_OVERFLOW:
- return _("overflow");
+ return _ ("overflow");
default:
if (errcode < 0)
@@ -1898,7 +1898,7 @@ btrace_decode_error (enum btrace_format format, int errcode)
break;
}
- return _("unknown");
+ return _ ("unknown");
}
/* See btrace.h. */
@@ -1966,7 +1966,7 @@ btrace_fetch (struct thread_info *tp, const struct btrace_cpu *cpu)
/* If we were not able to read the branch trace, signal an error. */
if (errcode != 0)
- error (_("Failed to read branch trace."));
+ error (_ ("Failed to read branch trace."));
/* Compute the trace, provided we have any. */
if (!btrace.empty ())
@@ -2017,7 +2017,7 @@ btrace_free_objfile (struct objfile *objfile)
btrace_clear (tp);
}
-#if defined (HAVE_LIBEXPAT)
+#if defined(HAVE_LIBEXPAT)
/* Check the btrace document version. */
@@ -2031,15 +2031,14 @@ check_xml_btrace_version (struct gdb_xml_parser *parser,
= (const char *) xml_find_attribute (attributes, "version")->value.get ();
if (strcmp (version, "1.0") != 0)
- gdb_xml_error (parser, _("Unsupported btrace version: \"%s\""), version);
+ gdb_xml_error (parser, _ ("Unsupported btrace version: \"%s\""), version);
}
/* Parse a btrace "block" xml record. */
static void
parse_xml_btrace_block (struct gdb_xml_parser *parser,
- const struct gdb_xml_element *element,
- void *user_data,
+ const struct gdb_xml_element *element, void *user_data,
std::vector<gdb_xml_value> &attributes)
{
struct btrace_data *btrace;
@@ -2058,7 +2057,7 @@ parse_xml_btrace_block (struct gdb_xml_parser *parser,
break;
default:
- gdb_xml_error (parser, _("Btrace format error."));
+ gdb_xml_error (parser, _ ("Btrace format error."));
}
begin = (ULONGEST *) xml_find_attribute (attributes, "begin")->value.get ();
@@ -2077,7 +2076,7 @@ parse_xml_raw (struct gdb_xml_parser *parser, const char *body_text,
len = strlen (body_text);
if (len % 2 != 0)
- gdb_xml_error (parser, _("Bad raw data size."));
+ gdb_xml_error (parser, _ ("Bad raw data size."));
size = len / 2;
@@ -2093,7 +2092,7 @@ parse_xml_raw (struct gdb_xml_parser *parser, const char *body_text,
lo = *body_text++;
if (hi == 0 || lo == 0)
- gdb_xml_error (parser, _("Bad hex encoding."));
+ gdb_xml_error (parser, _ ("Bad hex encoding."));
*bin++ = fromhex (hi) * 16 + fromhex (lo);
len -= 2;
@@ -2115,12 +2114,11 @@ parse_xml_btrace_pt_config_cpu (struct gdb_xml_parser *parser,
const char *vendor;
ULONGEST *family, *model, *stepping;
- vendor =
- (const char *) xml_find_attribute (attributes, "vendor")->value.get ();
+ vendor
+ = (const char *) xml_find_attribute (attributes, "vendor")->value.get ();
family
= (ULONGEST *) xml_find_attribute (attributes, "family")->value.get ();
- model
- = (ULONGEST *) xml_find_attribute (attributes, "model")->value.get ();
+ model = (ULONGEST *) xml_find_attribute (attributes, "model")->value.get ();
stepping
= (ULONGEST *) xml_find_attribute (attributes, "stepping")->value.get ();
@@ -2152,8 +2150,7 @@ parse_xml_btrace_pt_raw (struct gdb_xml_parser *parser,
static void
parse_xml_btrace_pt (struct gdb_xml_parser *parser,
- const struct gdb_xml_element *element,
- void *user_data,
+ const struct gdb_xml_element *element, void *user_data,
std::vector<gdb_xml_value> &attributes)
{
struct btrace_data *btrace;
@@ -2165,51 +2162,46 @@ parse_xml_btrace_pt (struct gdb_xml_parser *parser,
btrace->variant.pt.size = 0;
}
-static const struct gdb_xml_attribute block_attributes[] = {
- { "begin", GDB_XML_AF_NONE, gdb_xml_parse_attr_ulongest, NULL },
- { "end", GDB_XML_AF_NONE, gdb_xml_parse_attr_ulongest, NULL },
- { NULL, GDB_XML_AF_NONE, NULL, NULL }
-};
-
-static const struct gdb_xml_attribute btrace_pt_config_cpu_attributes[] = {
- { "vendor", GDB_XML_AF_NONE, NULL, NULL },
- { "family", GDB_XML_AF_NONE, gdb_xml_parse_attr_ulongest, NULL },
- { "model", GDB_XML_AF_NONE, gdb_xml_parse_attr_ulongest, NULL },
- { "stepping", GDB_XML_AF_NONE, gdb_xml_parse_attr_ulongest, NULL },
- { NULL, GDB_XML_AF_NONE, NULL, NULL }
-};
-
-static const struct gdb_xml_element btrace_pt_config_children[] = {
- { "cpu", btrace_pt_config_cpu_attributes, NULL, GDB_XML_EF_OPTIONAL,
- parse_xml_btrace_pt_config_cpu, NULL },
- { NULL, NULL, NULL, GDB_XML_EF_NONE, NULL, NULL }
-};
-
-static const struct gdb_xml_element btrace_pt_children[] = {
- { "pt-config", NULL, btrace_pt_config_children, GDB_XML_EF_OPTIONAL, NULL,
- NULL },
- { "raw", NULL, NULL, GDB_XML_EF_OPTIONAL, NULL, parse_xml_btrace_pt_raw },
- { NULL, NULL, NULL, GDB_XML_EF_NONE, NULL, NULL }
-};
-
-static const struct gdb_xml_attribute btrace_attributes[] = {
- { "version", GDB_XML_AF_NONE, NULL, NULL },
- { NULL, GDB_XML_AF_NONE, NULL, NULL }
-};
-
-static const struct gdb_xml_element btrace_children[] = {
- { "block", block_attributes, NULL,
- GDB_XML_EF_REPEATABLE | GDB_XML_EF_OPTIONAL, parse_xml_btrace_block, NULL },
- { "pt", NULL, btrace_pt_children, GDB_XML_EF_OPTIONAL, parse_xml_btrace_pt,
- NULL },
- { NULL, NULL, NULL, GDB_XML_EF_NONE, NULL, NULL }
-};
-
-static const struct gdb_xml_element btrace_elements[] = {
- { "btrace", btrace_attributes, btrace_children, GDB_XML_EF_NONE,
- check_xml_btrace_version, NULL },
- { NULL, NULL, NULL, GDB_XML_EF_NONE, NULL, NULL }
-};
+static const struct gdb_xml_attribute block_attributes[]
+ = { { "begin", GDB_XML_AF_NONE, gdb_xml_parse_attr_ulongest, NULL },
+ { "end", GDB_XML_AF_NONE, gdb_xml_parse_attr_ulongest, NULL },
+ { NULL, GDB_XML_AF_NONE, NULL, NULL } };
+
+static const struct gdb_xml_attribute btrace_pt_config_cpu_attributes[]
+ = { { "vendor", GDB_XML_AF_NONE, NULL, NULL },
+ { "family", GDB_XML_AF_NONE, gdb_xml_parse_attr_ulongest, NULL },
+ { "model", GDB_XML_AF_NONE, gdb_xml_parse_attr_ulongest, NULL },
+ { "stepping", GDB_XML_AF_NONE, gdb_xml_parse_attr_ulongest, NULL },
+ { NULL, GDB_XML_AF_NONE, NULL, NULL } };
+
+static const struct gdb_xml_element btrace_pt_config_children[]
+ = { { "cpu", btrace_pt_config_cpu_attributes, NULL, GDB_XML_EF_OPTIONAL,
+ parse_xml_btrace_pt_config_cpu, NULL },
+ { NULL, NULL, NULL, GDB_XML_EF_NONE, NULL, NULL } };
+
+static const struct gdb_xml_element btrace_pt_children[]
+ = { { "pt-config", NULL, btrace_pt_config_children, GDB_XML_EF_OPTIONAL,
+ NULL, NULL },
+ { "raw", NULL, NULL, GDB_XML_EF_OPTIONAL, NULL,
+ parse_xml_btrace_pt_raw },
+ { NULL, NULL, NULL, GDB_XML_EF_NONE, NULL, NULL } };
+
+static const struct gdb_xml_attribute btrace_attributes[]
+ = { { "version", GDB_XML_AF_NONE, NULL, NULL },
+ { NULL, GDB_XML_AF_NONE, NULL, NULL } };
+
+static const struct gdb_xml_element btrace_children[]
+ = { { "block", block_attributes, NULL,
+ GDB_XML_EF_REPEATABLE | GDB_XML_EF_OPTIONAL, parse_xml_btrace_block,
+ NULL },
+ { "pt", NULL, btrace_pt_children, GDB_XML_EF_OPTIONAL,
+ parse_xml_btrace_pt, NULL },
+ { NULL, NULL, NULL, GDB_XML_EF_NONE, NULL, NULL } };
+
+static const struct gdb_xml_element btrace_elements[]
+ = { { "btrace", btrace_attributes, btrace_children, GDB_XML_EF_NONE,
+ check_xml_btrace_version, NULL },
+ { NULL, NULL, NULL, GDB_XML_EF_NONE, NULL, NULL } };
#endif /* defined (HAVE_LIBEXPAT) */
@@ -2218,37 +2210,37 @@ static const struct gdb_xml_element btrace_elements[] = {
void
parse_xml_btrace (struct btrace_data *btrace, const char *buffer)
{
-#if defined (HAVE_LIBEXPAT)
+#if defined(HAVE_LIBEXPAT)
int errcode;
btrace_data result;
result.format = BTRACE_FORMAT_NONE;
- errcode = gdb_xml_parse_quick (_("btrace"), "btrace.dtd", btrace_elements,
+ errcode = gdb_xml_parse_quick (_ ("btrace"), "btrace.dtd", btrace_elements,
buffer, &result);
if (errcode != 0)
- error (_("Error parsing branch trace."));
+ error (_ ("Error parsing branch trace."));
/* Keep parse results. */
*btrace = std::move (result);
-#else /* !defined (HAVE_LIBEXPAT) */
+#else /* !defined (HAVE_LIBEXPAT) */
- error (_("Cannot process branch trace. XML support was disabled at "
- "compile time."));
+ error (_ ("Cannot process branch trace. XML support was disabled at "
+ "compile time."));
-#endif /* !defined (HAVE_LIBEXPAT) */
+#endif /* !defined (HAVE_LIBEXPAT) */
}
-#if defined (HAVE_LIBEXPAT)
+#if defined(HAVE_LIBEXPAT)
/* Parse a btrace-conf "bts" xml record. */
static void
parse_xml_btrace_conf_bts (struct gdb_xml_parser *parser,
- const struct gdb_xml_element *element,
- void *user_data,
- std::vector<gdb_xml_value> &attributes)
+ const struct gdb_xml_element *element,
+ void *user_data,
+ std::vector<gdb_xml_value> &attributes)
{
struct btrace_config *conf;
struct gdb_xml_value *size;
@@ -2282,34 +2274,29 @@ parse_xml_btrace_conf_pt (struct gdb_xml_parser *parser,
conf->pt.size = (unsigned int) *(ULONGEST *) size->value.get ();
}
-static const struct gdb_xml_attribute btrace_conf_pt_attributes[] = {
- { "size", GDB_XML_AF_OPTIONAL, gdb_xml_parse_attr_ulongest, NULL },
- { NULL, GDB_XML_AF_NONE, NULL, NULL }
-};
+static const struct gdb_xml_attribute btrace_conf_pt_attributes[]
+ = { { "size", GDB_XML_AF_OPTIONAL, gdb_xml_parse_attr_ulongest, NULL },
+ { NULL, GDB_XML_AF_NONE, NULL, NULL } };
-static const struct gdb_xml_attribute btrace_conf_bts_attributes[] = {
- { "size", GDB_XML_AF_OPTIONAL, gdb_xml_parse_attr_ulongest, NULL },
- { NULL, GDB_XML_AF_NONE, NULL, NULL }
-};
+static const struct gdb_xml_attribute btrace_conf_bts_attributes[]
+ = { { "size", GDB_XML_AF_OPTIONAL, gdb_xml_parse_attr_ulongest, NULL },
+ { NULL, GDB_XML_AF_NONE, NULL, NULL } };
-static const struct gdb_xml_element btrace_conf_children[] = {
- { "bts", btrace_conf_bts_attributes, NULL, GDB_XML_EF_OPTIONAL,
- parse_xml_btrace_conf_bts, NULL },
- { "pt", btrace_conf_pt_attributes, NULL, GDB_XML_EF_OPTIONAL,
- parse_xml_btrace_conf_pt, NULL },
- { NULL, NULL, NULL, GDB_XML_EF_NONE, NULL, NULL }
-};
+static const struct gdb_xml_element btrace_conf_children[]
+ = { { "bts", btrace_conf_bts_attributes, NULL, GDB_XML_EF_OPTIONAL,
+ parse_xml_btrace_conf_bts, NULL },
+ { "pt", btrace_conf_pt_attributes, NULL, GDB_XML_EF_OPTIONAL,
+ parse_xml_btrace_conf_pt, NULL },
+ { NULL, NULL, NULL, GDB_XML_EF_NONE, NULL, NULL } };
-static const struct gdb_xml_attribute btrace_conf_attributes[] = {
- { "version", GDB_XML_AF_NONE, NULL, NULL },
- { NULL, GDB_XML_AF_NONE, NULL, NULL }
-};
+static const struct gdb_xml_attribute btrace_conf_attributes[]
+ = { { "version", GDB_XML_AF_NONE, NULL, NULL },
+ { NULL, GDB_XML_AF_NONE, NULL, NULL } };
-static const struct gdb_xml_element btrace_conf_elements[] = {
- { "btrace-conf", btrace_conf_attributes, btrace_conf_children,
- GDB_XML_EF_NONE, NULL, NULL },
- { NULL, NULL, NULL, GDB_XML_EF_NONE, NULL, NULL }
-};
+static const struct gdb_xml_element btrace_conf_elements[]
+ = { { "btrace-conf", btrace_conf_attributes, btrace_conf_children,
+ GDB_XML_EF_NONE, NULL, NULL },
+ { NULL, NULL, NULL, GDB_XML_EF_NONE, NULL, NULL } };
#endif /* defined (HAVE_LIBEXPAT) */
@@ -2318,20 +2305,20 @@ static const struct gdb_xml_element btrace_conf_elements[] = {
void
parse_xml_btrace_conf (struct btrace_config *conf, const char *xml)
{
-#if defined (HAVE_LIBEXPAT)
+#if defined(HAVE_LIBEXPAT)
int errcode;
- errcode = gdb_xml_parse_quick (_("btrace-conf"), "btrace-conf.dtd",
+ errcode = gdb_xml_parse_quick (_ ("btrace-conf"), "btrace-conf.dtd",
btrace_conf_elements, xml, conf);
if (errcode != 0)
- error (_("Error parsing branch trace configuration."));
+ error (_ ("Error parsing branch trace configuration."));
-#else /* !defined (HAVE_LIBEXPAT) */
+#else /* !defined (HAVE_LIBEXPAT) */
- error (_("Cannot process the branch trace configuration. XML support "
- "was disabled at compile time."));
+ error (_ ("Cannot process the branch trace configuration. XML support "
+ "was disabled at compile time."));
-#endif /* !defined (HAVE_LIBEXPAT) */
+#endif /* !defined (HAVE_LIBEXPAT) */
}
/* See btrace.h. */
@@ -2380,7 +2367,7 @@ btrace_insn_begin (struct btrace_insn_iterator *it,
const struct btrace_thread_info *btinfo)
{
if (btinfo->functions.empty ())
- error (_("No trace."));
+ error (_ ("No trace."));
it->btinfo = btinfo;
it->call_index = 0;
@@ -2397,7 +2384,7 @@ btrace_insn_end (struct btrace_insn_iterator *it,
unsigned int length;
if (btinfo->functions.empty ())
- error (_("No trace."));
+ error (_ ("No trace."));
bfun = &btinfo->functions.back ();
length = bfun->insn.size ();
@@ -2578,7 +2565,7 @@ btrace_find_insn_by_number (struct btrace_insn_iterator *it,
unsigned int upper, lower;
if (btinfo->functions.empty ())
- return 0;
+ return 0;
lower = 0;
bfun = &btinfo->functions[lower];
@@ -2669,7 +2656,7 @@ btrace_call_begin (struct btrace_call_iterator *it,
const struct btrace_thread_info *btinfo)
{
if (btinfo->functions.empty ())
- error (_("No trace."));
+ error (_ ("No trace."));
it->btinfo = btinfo;
it->index = 0;
@@ -2682,7 +2669,7 @@ btrace_call_end (struct btrace_call_iterator *it,
const struct btrace_thread_info *btinfo)
{
if (btinfo->functions.empty ())
- error (_("No trace."));
+ error (_ ("No trace."));
it->btinfo = btinfo;
it->index = btinfo->functions.size ();
@@ -2741,7 +2728,7 @@ btrace_call_prev (struct btrace_call_iterator *it, unsigned int stride)
function segment contains only one instruction (i.e. the current
instruction) it is not actually part of the trace. To be able to step
over this instruction, we need at least one more function segment. */
- if ((it->index == length) && (length > 1))
+ if ((it->index == length) && (length > 1))
{
if (btrace_ends_with_single_insn (it->btinfo))
it->index = length - 2;
@@ -2842,7 +2829,7 @@ btrace_is_empty (struct thread_info *tp)
return btrace_insn_cmp (&begin, &end) == 0;
}
-#if defined (HAVE_LIBIPT)
+#if defined(HAVE_LIBIPT)
/* Print a single packet. */
@@ -2868,38 +2855,32 @@ pt_print_packet (const struct pt_packet *packet)
break;
case ppt_tip:
- gdb_printf (("tip %u: 0x%" PRIx64 ""),
- packet->payload.ip.ipc,
+ gdb_printf (("tip %u: 0x%" PRIx64 ""), packet->payload.ip.ipc,
packet->payload.ip.ip);
break;
case ppt_tip_pge:
- gdb_printf (("tip.pge %u: 0x%" PRIx64 ""),
- packet->payload.ip.ipc,
+ gdb_printf (("tip.pge %u: 0x%" PRIx64 ""), packet->payload.ip.ipc,
packet->payload.ip.ip);
break;
case ppt_tip_pgd:
- gdb_printf (("tip.pgd %u: 0x%" PRIx64 ""),
- packet->payload.ip.ipc,
+ gdb_printf (("tip.pgd %u: 0x%" PRIx64 ""), packet->payload.ip.ipc,
packet->payload.ip.ip);
break;
case ppt_fup:
- gdb_printf (("fup %u: 0x%" PRIx64 ""),
- packet->payload.ip.ipc,
+ gdb_printf (("fup %u: 0x%" PRIx64 ""), packet->payload.ip.ipc,
packet->payload.ip.ip);
break;
case ppt_tnt_8:
- gdb_printf (("tnt-8 %u: 0x%" PRIx64 ""),
- packet->payload.tnt.bit_size,
+ gdb_printf (("tnt-8 %u: 0x%" PRIx64 ""), packet->payload.tnt.bit_size,
packet->payload.tnt.payload);
break;
case ppt_tnt_64:
- gdb_printf (("tnt-64 %u: 0x%" PRIx64 ""),
- packet->payload.tnt.bit_size,
+ gdb_printf (("tnt-64 %u: 0x%" PRIx64 ""), packet->payload.tnt.bit_size,
packet->payload.tnt.payload);
break;
@@ -2925,18 +2906,14 @@ pt_print_packet (const struct pt_packet *packet)
case pt_mol_exec:
gdb_printf (("mode.exec%s%s"),
- packet->payload.mode.bits.exec.csl
- ? (" cs.l") : (""),
- packet->payload.mode.bits.exec.csd
- ? (" cs.d") : (""));
+ packet->payload.mode.bits.exec.csl ? (" cs.l") : (""),
+ packet->payload.mode.bits.exec.csd ? (" cs.d") : (""));
break;
case pt_mol_tsx:
gdb_printf (("mode.tsx%s%s"),
- packet->payload.mode.bits.tsx.intx
- ? (" intx") : (""),
- packet->payload.mode.bits.tsx.abrt
- ? (" abrt") : (""));
+ packet->payload.mode.bits.tsx.intx ? (" intx") : (""),
+ packet->payload.mode.bits.tsx.abrt ? (" abrt") : (""));
break;
}
break;
@@ -2995,8 +2972,8 @@ btrace_maint_decode_pt (struct btrace_maint_info *maint,
{
pt_pkt_get_offset (decoder, &packet.offset);
- errcode = pt_pkt_next (decoder, &packet.packet,
- sizeof(packet.packet));
+ errcode
+ = pt_pkt_next (decoder, &packet.packet, sizeof (packet.packet));
if (errcode < 0)
break;
@@ -3013,13 +2990,14 @@ btrace_maint_decode_pt (struct btrace_maint_info *maint,
packet.errcode = pt_errcode (errcode);
maint->variant.pt.packets->push_back (packet);
- warning (_("Error at trace offset 0x%" PRIx64 ": %s."),
- packet.offset, pt_errstr (packet.errcode));
+ warning (_ ("Error at trace offset 0x%" PRIx64 ": %s."), packet.offset,
+ pt_errstr (packet.errcode));
}
if (errcode != -pte_eos)
- warning (_("Failed to synchronize onto the Intel Processor Trace "
- "stream: %s."), pt_errstr (pt_errcode (errcode)));
+ warning (_ ("Failed to synchronize onto the Intel Processor Trace "
+ "stream: %s."),
+ pt_errstr (pt_errcode (errcode)));
}
/* Update the packet history in BTINFO. */
@@ -3039,7 +3017,7 @@ btrace_maint_update_pt_packets (struct btrace_thread_info *btinfo)
if (pt->size == 0)
return;
- memset (&config, 0, sizeof(config));
+ memset (&config, 0, sizeof (config));
config.size = sizeof (config);
config.begin = pt->data;
@@ -3059,13 +3037,14 @@ btrace_maint_update_pt_packets (struct btrace_thread_info *btinfo)
errcode = pt_cpu_errata (&config.errata, &config.cpu);
if (errcode < 0)
- error (_("Failed to configure the Intel Processor Trace "
- "decoder: %s."), pt_errstr (pt_errcode (errcode)));
+ error (_ ("Failed to configure the Intel Processor Trace "
+ "decoder: %s."),
+ pt_errstr (pt_errcode (errcode)));
}
decoder = pt_pkt_alloc_decoder (&config);
if (decoder == NULL)
- error (_("Failed to allocate the Intel Processor Trace decoder."));
+ error (_ ("Failed to allocate the Intel Processor Trace decoder."));
try
{
@@ -3110,7 +3089,7 @@ btrace_maint_update_packets (struct btrace_thread_info *btinfo,
*to = btinfo->maint.variant.bts.packet_history.end;
break;
-#if defined (HAVE_LIBIPT)
+#if defined(HAVE_LIBIPT)
case BTRACE_FORMAT_PT:
if (btinfo->maint.variant.pt.packets == nullptr)
btinfo->maint.variant.pt.packets = new std::vector<btrace_pt_packet>;
@@ -3159,7 +3138,7 @@ btrace_maint_print_packets (struct btrace_thread_info *btinfo,
}
break;
-#if defined (HAVE_LIBIPT)
+#if defined(HAVE_LIBIPT)
case BTRACE_FORMAT_PT:
{
const std::vector<btrace_pt_packet> &packets
@@ -3202,11 +3181,11 @@ get_uint (const char **arg)
pos = skip_spaces (begin);
if (!isdigit (*pos))
- error (_("Expected positive number, got: %s."), pos);
+ error (_ ("Expected positive number, got: %s."), pos);
number = strtoul (pos, &end, 10);
if (number > UINT_MAX)
- error (_("Number too big."));
+ error (_ ("Number too big."));
*arg += (end - begin);
@@ -3221,7 +3200,7 @@ get_context_size (const char **arg)
const char *pos = skip_spaces (*arg);
if (!isdigit (*pos))
- error (_("Expected positive number, got: %s."), pos);
+ error (_ ("Expected positive number, got: %s."), pos);
char *end;
long result = strtol (pos, &end, 10);
@@ -3235,7 +3214,7 @@ static void
no_chunk (const char *arg)
{
if (*arg != 0)
- error (_("Junk after argument: %s."), arg);
+ error (_ ("Junk after argument: %s."), arg);
}
/* The "maintenance btrace packet-history" command. */
@@ -3248,7 +3227,7 @@ maint_btrace_packet_history_cmd (const char *arg, int from_tty)
thread_info *tp = find_thread_ptid (current_inferior (), inferior_ptid);
if (tp == NULL)
- error (_("No thread."));
+ error (_ ("No thread."));
size = 10;
btinfo = &tp->btrace;
@@ -3256,7 +3235,7 @@ maint_btrace_packet_history_cmd (const char *arg, int from_tty)
btrace_maint_update_packets (btinfo, &begin, &end, &from, &to);
if (begin == end)
{
- gdb_printf (_("No trace.\n"));
+ gdb_printf (_ ("No trace.\n"));
return;
}
@@ -3280,7 +3259,7 @@ maint_btrace_packet_history_cmd (const char *arg, int from_tty)
{
from = get_uint (&arg);
if (end <= from)
- error (_("'%u' is out of range."), from);
+ error (_ ("'%u' is out of range."), from);
arg = skip_spaces (arg);
if (*arg == ',')
@@ -3348,10 +3327,10 @@ static void
maint_btrace_clear_packet_history_cmd (const char *args, int from_tty)
{
if (args != NULL && *args != 0)
- error (_("Invalid argument."));
+ error (_ ("Invalid argument."));
if (inferior_ptid == null_ptid)
- error (_("No thread."));
+ error (_ ("No thread."));
thread_info *tp = inferior_thread ();
btrace_thread_info *btinfo = &tp->btrace;
@@ -3367,10 +3346,10 @@ static void
maint_btrace_clear_cmd (const char *args, int from_tty)
{
if (args != NULL && *args != 0)
- error (_("Invalid argument."));
+ error (_ ("Invalid argument."));
if (inferior_ptid == null_ptid)
- error (_("No thread."));
+ error (_ ("No thread."));
thread_info *tp = inferior_thread ();
btrace_clear (tp);
@@ -3385,10 +3364,10 @@ maint_info_btrace_cmd (const char *args, int from_tty)
const struct btrace_config *conf;
if (args != NULL && *args != 0)
- error (_("Invalid argument."));
+ error (_ ("Invalid argument."));
if (inferior_ptid == null_ptid)
- error (_("No thread."));
+ error (_ ("No thread."));
thread_info *tp = inferior_thread ();
@@ -3396,10 +3375,9 @@ maint_info_btrace_cmd (const char *args, int from_tty)
conf = btrace_conf (btinfo);
if (conf == NULL)
- error (_("No btrace configuration."));
+ error (_ ("No btrace configuration."));
- gdb_printf (_("Format: %s.\n"),
- btrace_format_string (conf->format));
+ gdb_printf (_ ("Format: %s.\n"), btrace_format_string (conf->format));
switch (conf->format)
{
@@ -3407,24 +3385,24 @@ maint_info_btrace_cmd (const char *args, int from_tty)
break;
case BTRACE_FORMAT_BTS:
- gdb_printf (_("Number of packets: %zu.\n"),
+ gdb_printf (_ ("Number of packets: %zu.\n"),
btinfo->data.variant.bts.blocks->size ());
break;
-#if defined (HAVE_LIBIPT)
+#if defined(HAVE_LIBIPT)
case BTRACE_FORMAT_PT:
{
struct pt_version version;
version = pt_library_version ();
- gdb_printf (_("Version: %u.%u.%u%s.\n"), version.major,
- version.minor, version.build,
- version.ext != NULL ? version.ext : "");
+ gdb_printf (_ ("Version: %u.%u.%u%s.\n"), version.major, version.minor,
+ version.build, version.ext != NULL ? version.ext : "");
btrace_maint_update_pt_packets (btinfo);
- gdb_printf (_("Number of packets: %zu.\n"),
+ gdb_printf (_ ("Number of packets: %zu.\n"),
((btinfo->maint.variant.pt.packets == nullptr)
- ? 0 : btinfo->maint.variant.pt.packets->size ()));
+ ? 0
+ : btinfo->maint.variant.pt.packets->size ()));
}
break;
#endif /* defined (HAVE_LIBIPT) */
@@ -3434,54 +3412,55 @@ maint_info_btrace_cmd (const char *args, int from_tty)
/* The "maint show btrace pt skip-pad" show value function. */
static void
-show_maint_btrace_pt_skip_pad (struct ui_file *file, int from_tty,
- struct cmd_list_element *c,
- const char *value)
+show_maint_btrace_pt_skip_pad (struct ui_file *file, int from_tty,
+ struct cmd_list_element *c, const char *value)
{
- gdb_printf (file, _("Skip PAD packets is %s.\n"), value);
+ gdb_printf (file, _ ("Skip PAD packets is %s.\n"), value);
}
-
/* Initialize btrace maintenance commands. */
void _initialize_btrace ();
+
void
_initialize_btrace ()
{
add_cmd ("btrace", class_maintenance, maint_info_btrace_cmd,
- _("Info about branch tracing data."), &maintenanceinfolist);
+ _ ("Info about branch tracing data."), &maintenanceinfolist);
add_basic_prefix_cmd ("btrace", class_maintenance,
- _("Branch tracing maintenance commands."),
+ _ ("Branch tracing maintenance commands."),
&maint_btrace_cmdlist, 0, &maintenancelist);
add_setshow_prefix_cmd ("btrace", class_maintenance,
- _("Set branch tracing specific variables."),
- _("Show branch tracing specific variables."),
+ _ ("Set branch tracing specific variables."),
+ _ ("Show branch tracing specific variables."),
&maint_btrace_set_cmdlist,
- &maint_btrace_show_cmdlist,
- &maintenance_set_cmdlist,
+ &maint_btrace_show_cmdlist, &maintenance_set_cmdlist,
&maintenance_show_cmdlist);
add_setshow_prefix_cmd ("pt", class_maintenance,
- _("Set Intel Processor Trace specific variables."),
- _("Show Intel Processor Trace specific variables."),
+ _ ("Set Intel Processor Trace specific variables."),
+ _ ("Show Intel Processor Trace specific variables."),
&maint_btrace_pt_set_cmdlist,
&maint_btrace_pt_show_cmdlist,
&maint_btrace_set_cmdlist,
&maint_btrace_show_cmdlist);
add_setshow_boolean_cmd ("skip-pad", class_maintenance,
- &maint_btrace_pt_skip_pad, _("\
-Set whether PAD packets should be skipped in the btrace packet history."), _("\
-Show whether PAD packets should be skipped in the btrace packet history."),_("\
+ &maint_btrace_pt_skip_pad, _ ("\
+Set whether PAD packets should be skipped in the btrace packet history."),
+ _ ("\
+Show whether PAD packets should be skipped in the btrace packet history."),
+ _ ("\
When enabled, PAD packets are ignored in the btrace packet history."),
NULL, show_maint_btrace_pt_skip_pad,
&maint_btrace_pt_set_cmdlist,
&maint_btrace_pt_show_cmdlist);
- add_cmd ("packet-history", class_maintenance, maint_btrace_packet_history_cmd,
- _("Print the raw branch tracing data.\n\
+ add_cmd ("packet-history", class_maintenance,
+ maint_btrace_packet_history_cmd,
+ _ ("Print the raw branch tracing data.\n\
With no argument, print ten more packets after the previous ten-line print.\n\
With '-' as argument print ten packets before a previous ten-line print.\n\
One argument specifies the starting packet of a ten-line print.\n\
@@ -3493,14 +3472,13 @@ first."),
add_cmd ("clear-packet-history", class_maintenance,
maint_btrace_clear_packet_history_cmd,
- _("Clears the branch tracing packet history.\n\
+ _ ("Clears the branch tracing packet history.\n\
Discards the raw branch tracing data but not the execution history data."),
&maint_btrace_cmdlist);
add_cmd ("clear", class_maintenance, maint_btrace_clear_cmd,
- _("Clears the branch tracing data.\n\
+ _ ("Clears the branch tracing data.\n\
Discards the raw branch tracing data and the execution history data.\n\
The next 'record' command will fetch the branch tracing data anew."),
&maint_btrace_cmdlist);
-
}
diff --git a/gdb/btrace.h b/gdb/btrace.h
index 0ec84113217..9cd9d70bf5c 100644
--- a/gdb/btrace.h
+++ b/gdb/btrace.h
@@ -30,8 +30,8 @@
#include "target/waitstatus.h" /* For enum target_stop_reason. */
#include "gdbsupport/enum-flags.h"
-#if defined (HAVE_LIBIPT)
-# include <intel-pt.h>
+#if defined(HAVE_LIBIPT)
+#include <intel-pt.h>
#endif
#include <vector>
@@ -61,6 +61,7 @@ enum btrace_insn_flag
/* The instruction has been executed speculatively. */
BTRACE_INSN_FLAG_SPECULATIVE = (1 << 0)
};
+
DEF_ENUM_FLAGS_TYPE (enum btrace_insn_flag, btrace_insn_flags);
/* A branch trace instruction.
@@ -93,6 +94,7 @@ enum btrace_function_flag
if bfun_up_links_to_ret is clear. */
BFUN_UP_LINKS_TO_TAILCALL = (1 << 1)
};
+
DEF_ENUM_FLAGS_TYPE (enum btrace_function_flag, btrace_function_flags);
/* Decode errors for the BTS recording format. */
@@ -133,7 +135,10 @@ struct btrace_function
{
btrace_function (struct minimal_symbol *msym_, struct symbol *sym_,
unsigned int number_, unsigned int insn_offset_, int level_)
- : msym (msym_), sym (sym_), insn_offset (insn_offset_), number (number_),
+ : msym (msym_),
+ sym (sym_),
+ insn_offset (insn_offset_),
+ number (number_),
level (level_)
{
}
@@ -248,9 +253,10 @@ enum btrace_thread_flag : unsigned
/* The thread is to be stopped. */
BTHR_STOP = (1 << 4)
};
+
DEF_ENUM_FLAGS_TYPE (enum btrace_thread_flag, btrace_thread_flags);
-#if defined (HAVE_LIBIPT)
+#if defined(HAVE_LIBIPT)
/* A packet. */
struct btrace_pt_packet
{
@@ -292,7 +298,7 @@ struct btrace_maint_info
struct btrace_maint_packet_history packet_history;
} bts;
-#if defined (HAVE_LIBIPT)
+#if defined(HAVE_LIBIPT)
/* BTRACE.DATA.FORMAT == BTRACE_FORMAT_PT */
struct
{
@@ -366,7 +372,7 @@ extern void btrace_enable (struct thread_info *tp,
/* Get the branch trace configuration for a thread.
Return NULL if branch tracing is not enabled for that thread. */
extern const struct btrace_config *
- btrace_conf (const struct btrace_thread_info *);
+btrace_conf (const struct btrace_thread_info *);
/* Disable branch tracing for a thread.
This will also delete the current branch trace data. */
@@ -380,12 +386,12 @@ extern void btrace_teardown (struct thread_info *);
/* Return a human readable error string for the given ERRCODE in FORMAT.
The pointer will never be NULL and must not be freed. */
-extern const char *btrace_decode_error (enum btrace_format format, int errcode);
+extern const char *btrace_decode_error (enum btrace_format format,
+ int errcode);
/* Fetch the branch trace for a single thread. If CPU is not NULL, assume
CPU for trace decode. */
-extern void btrace_fetch (struct thread_info *,
- const struct btrace_cpu *cpu);
+extern void btrace_fetch (struct thread_info *, const struct btrace_cpu *cpu);
/* Clear the branch trace for a single thread. */
extern void btrace_clear (struct thread_info *);
@@ -397,13 +403,14 @@ extern void btrace_free_objfile (struct objfile *);
extern void parse_xml_btrace (struct btrace_data *data, const char *xml);
/* Parse a branch trace configuration xml document XML into CONF. */
-extern void parse_xml_btrace_conf (struct btrace_config *conf, const char *xml);
+extern void parse_xml_btrace_conf (struct btrace_config *conf,
+ const char *xml);
/* Dereference a branch trace instruction iterator. Return a pointer to the
instruction the iterator points to.
May return NULL if the iterator points to a gap in the trace. */
extern const struct btrace_insn *
- btrace_insn_get (const struct btrace_insn_iterator *);
+btrace_insn_get (const struct btrace_insn_iterator *);
/* Return the error code for a branch trace instruction iterator. Returns zero
if there is no error, i.e. the instruction is valid. */
@@ -448,7 +455,7 @@ extern int btrace_find_insn_by_number (struct btrace_insn_iterator *,
function the iterator points to or NULL if the iterator points past
the end of the branch trace. */
extern const struct btrace_function *
- btrace_call_get (const struct btrace_call_iterator *);
+btrace_call_get (const struct btrace_call_iterator *);
/* Return the function number for a branch trace call iterator.
Returns one past the maximum function number for the end iterator.
diff --git a/gdb/build-id.c b/gdb/build-id.c
index 00250c20ae9..9a2fde12e18 100644
--- a/gdb/build-id.c
+++ b/gdb/build-id.c
@@ -60,11 +60,11 @@ build_id_verify (bfd *abfd, size_t check_len, const bfd_byte *check)
found = build_id_bfd_get (abfd);
if (found == NULL)
- warning (_("File \"%s\" has no build-id, file skipped"),
+ warning (_ ("File \"%s\" has no build-id, file skipped"),
bfd_get_filename (abfd));
else if (found->size != check_len
|| memcmp (found->data, check, found->size) != 0)
- warning (_("File \"%s\" has a different build-id, file skipped"),
+ warning (_ ("File \"%s\" has a different build-id, file skipped"),
bfd_get_filename (abfd));
else
retval = 1;
@@ -82,7 +82,7 @@ build_id_to_debug_bfd_1 (const std::string &link, size_t build_id_len,
{
if (separate_debug_file_debug)
{
- gdb_printf (gdb_stdlog, _(" Trying %s..."), link.c_str ());
+ gdb_printf (gdb_stdlog, _ (" Trying %s..."), link.c_str ());
gdb_flush (gdb_stdlog);
}
@@ -100,8 +100,7 @@ build_id_to_debug_bfd_1 (const std::string &link, size_t build_id_len,
if (filename == NULL)
{
if (separate_debug_file_debug)
- gdb_printf (gdb_stdlog,
- _(" no, unable to compute real path\n"));
+ gdb_printf (gdb_stdlog, _ (" no, unable to compute real path\n"));
return {};
}
@@ -112,21 +111,21 @@ build_id_to_debug_bfd_1 (const std::string &link, size_t build_id_len,
if (debug_bfd == NULL)
{
if (separate_debug_file_debug)
- gdb_printf (gdb_stdlog, _(" no, unable to open.\n"));
+ gdb_printf (gdb_stdlog, _ (" no, unable to open.\n"));
return {};
}
- if (!build_id_verify (debug_bfd.get(), build_id_len, build_id))
+ if (!build_id_verify (debug_bfd.get (), build_id_len, build_id))
{
if (separate_debug_file_debug)
- gdb_printf (gdb_stdlog, _(" no, build-id does not match.\n"));
+ gdb_printf (gdb_stdlog, _ (" no, build-id does not match.\n"));
return {};
}
if (separate_debug_file_debug)
- gdb_printf (gdb_stdlog, _(" yes!\n"));
+ gdb_printf (gdb_stdlog, _ (" yes!\n"));
return debug_bfd;
}
@@ -218,19 +217,22 @@ find_separate_debug_file_by_buildid (struct objfile *objfile,
{
if (separate_debug_file_debug)
gdb_printf (gdb_stdlog,
- _("\nLooking for separate debug info (build-id) for "
- "%s\n"), objfile_name (objfile));
+ _ ("\nLooking for separate debug info (build-id) for "
+ "%s\n"),
+ objfile_name (objfile));
gdb_bfd_ref_ptr abfd (build_id_to_debug_bfd (build_id->size,
build_id->data));
/* Prevent looping on a stripped .debug file. */
if (abfd != NULL
&& filename_cmp (bfd_get_filename (abfd.get ()),
- objfile_name (objfile)) == 0)
+ objfile_name (objfile))
+ == 0)
{
std::string msg
- = string_printf (_("\"%s\": separate debug info file has no "
- "debug info"), bfd_get_filename (abfd.get ()));
+ = string_printf (_ ("\"%s\": separate debug info file has no "
+ "debug info"),
+ bfd_get_filename (abfd.get ()));
if (separate_debug_file_debug)
gdb_printf (gdb_stdlog, "%s", msg.c_str ());
warnings_vector->emplace_back (std::move (msg));
diff --git a/gdb/build-id.h b/gdb/build-id.h
index 191720ddf28..3173408ee75 100644
--- a/gdb/build-id.h
+++ b/gdb/build-id.h
@@ -30,9 +30,8 @@ extern const struct bfd_build_id *build_id_bfd_get (bfd *abfd);
/* Return true if ABFD has NT_GNU_BUILD_ID matching the CHECK value.
Otherwise, issue a warning and return false. */
-extern int build_id_verify (bfd *abfd,
- size_t check_len, const bfd_byte *check);
-
+extern int build_id_verify (bfd *abfd, size_t check_len,
+ const bfd_byte *check);
/* Find and open a BFD for a debuginfo file given a build-id. If no BFD
can be found, return NULL. */
@@ -57,8 +56,8 @@ extern gdb_bfd_ref_ptr build_id_to_exec_bfd (size_t build_id_len,
however, if GDB fails to find suitable debug information using any
approach, then any warnings will be printed. */
-extern std::string find_separate_debug_file_by_buildid
- (struct objfile *objfile, std::vector<std::string> *warnings_vector);
+extern std::string find_separate_debug_file_by_buildid (
+ struct objfile *objfile, std::vector<std::string> *warnings_vector);
/* Return an hex-string representation of BUILD_ID. */
diff --git a/gdb/buildsym-legacy.c b/gdb/buildsym-legacy.c
index cb733e7101b..8fd4b899faa 100644
--- a/gdb/buildsym-legacy.c
+++ b/gdb/buildsym-legacy.c
@@ -37,8 +37,6 @@ record_producer (const char *producer)
buildsym_compunit->record_producer (producer);
}
-
-
/* See buildsym.h. */
void
@@ -196,8 +194,8 @@ pop_context ()
struct block *
finish_block (struct symbol *symbol, struct pending_block *old_blocks,
- const struct dynamic_prop *static_link,
- CORE_ADDR start, CORE_ADDR end)
+ const struct dynamic_prop *static_link, CORE_ADDR start,
+ CORE_ADDR end)
{
gdb_assert (buildsym_compunit != nullptr);
return buildsym_compunit->finish_block (symbol, old_blocks, static_link,
diff --git a/gdb/buildsym-legacy.h b/gdb/buildsym-legacy.h
index 3d705a8beed..a04a3d0399f 100644
--- a/gdb/buildsym-legacy.h
+++ b/gdb/buildsym-legacy.h
@@ -59,8 +59,7 @@ public:
extern struct block *finish_block (struct symbol *symbol,
struct pending_block *old_blocks,
const struct dynamic_prop *static_link,
- CORE_ADDR start,
- CORE_ADDR end);
+ CORE_ADDR start, CORE_ADDR end);
extern void start_subfile (const char *name);
diff --git a/gdb/buildsym.c b/gdb/buildsym.c
index 8dbb327f0eb..b478e976a2c 100644
--- a/gdb/buildsym.c
+++ b/gdb/buildsym.c
@@ -26,10 +26,10 @@
#include "objfiles.h"
#include "gdbtypes.h"
#include "complaints.h"
-#include "expression.h" /* For "enum exp_opcode" used by... */
-#include "filenames.h" /* For DOSish file names. */
+#include "expression.h" /* For "enum exp_opcode" used by... */
+#include "filenames.h" /* For DOSish file names. */
#include "macrotab.h"
-#include "demangle.h" /* Needed by SYMBOL_INIT_DEMANGLED_NAME. */
+#include "demangle.h" /* Needed by SYMBOL_INIT_DEMANGLED_NAME. */
#include "block.h"
#include "cp-support.h"
#include "dictionary.h"
@@ -44,14 +44,13 @@
This is used at the end to make the blockvector. */
struct pending_block
- {
- struct pending_block *next;
- struct block *block;
- };
+{
+ struct pending_block *next;
+ struct block *block;
+};
buildsym_compunit::buildsym_compunit (struct objfile *objfile_,
- const char *name,
- const char *comp_dir_,
+ const char *name, const char *comp_dir_,
const char *name_for_id,
enum language language_,
CORE_ADDR last_addr)
@@ -84,9 +83,7 @@ buildsym_compunit::~buildsym_compunit ()
if (m_pending_macros != nullptr)
free_macro_table (m_pending_macros);
- for (subfile = m_subfiles;
- subfile != NULL;
- subfile = nextsub)
+ for (subfile = m_subfiles; subfile != NULL; subfile = nextsub)
{
nextsub = subfile->next;
delete subfile;
@@ -111,9 +108,9 @@ struct macro_table *
buildsym_compunit::get_macro_table ()
{
if (m_pending_macros == nullptr)
- m_pending_macros = new_macro_table (&m_objfile->per_bfd->storage_obstack,
- &m_objfile->per_bfd->string_cache,
- m_compunit_symtab);
+ m_pending_macros
+ = new_macro_table (&m_objfile->per_bfd->storage_obstack,
+ &m_objfile->per_bfd->string_cache, m_compunit_symtab);
return m_pending_macros;
}
@@ -197,13 +194,10 @@ buildsym_compunit::record_pending_block (struct block *block,
file). Put the block on the list of pending blocks. */
struct block *
-buildsym_compunit::finish_block_internal
- (struct symbol *symbol,
- struct pending **listhead,
- struct pending_block *old_blocks,
- const struct dynamic_prop *static_link,
- CORE_ADDR start, CORE_ADDR end,
- int is_global, int expandable)
+buildsym_compunit::finish_block_internal (
+ struct symbol *symbol, struct pending **listhead,
+ struct pending_block *old_blocks, const struct dynamic_prop *static_link,
+ CORE_ADDR start, CORE_ADDR end, int is_global, int expandable)
{
struct gdbarch *gdbarch = m_objfile->arch ();
struct pending *next, *next1;
@@ -211,27 +205,25 @@ buildsym_compunit::finish_block_internal
struct pending_block *pblock;
struct pending_block *opblock;
- block = (is_global
- ? allocate_global_block (&m_objfile->objfile_obstack)
- : allocate_block (&m_objfile->objfile_obstack));
+ block = (is_global ? allocate_global_block (&m_objfile->objfile_obstack)
+ : allocate_block (&m_objfile->objfile_obstack));
if (symbol)
{
- block->set_multidict
- (mdict_create_linear (&m_objfile->objfile_obstack, *listhead));
+ block->set_multidict (mdict_create_linear (&m_objfile->objfile_obstack,
+ *listhead));
}
else
{
if (expandable)
{
- block->set_multidict
- (mdict_create_hashed_expandable (m_language));
+ block->set_multidict (mdict_create_hashed_expandable (m_language));
mdict_add_pending (block->multidict (), *listhead);
}
else
{
- block->set_multidict
- (mdict_create_hashed (&m_objfile->objfile_obstack, *listhead));
+ block->set_multidict (
+ mdict_create_hashed (&m_objfile->objfile_obstack, *listhead));
}
}
@@ -266,9 +258,8 @@ buildsym_compunit::finish_block_internal
if (nparams > 0)
{
ftype->set_num_fields (nparams);
- ftype->set_fields
- ((struct field *)
- TYPE_ALLOC (ftype, nparams * sizeof (struct field)));
+ ftype->set_fields ((struct field *) TYPE_ALLOC (
+ ftype, nparams * sizeof (struct field)));
iparams = 0;
/* Here we want to directly access the dictionary, because
@@ -310,14 +301,14 @@ buildsym_compunit::finish_block_internal
{
if (symbol)
{
- complaint (_("block end address less than block "
- "start address in %s (patched it)"),
+ complaint (_ ("block end address less than block "
+ "start address in %s (patched it)"),
symbol->print_name ());
}
else
{
- complaint (_("block end address %s less than block "
- "start address %s (patched it)"),
+ complaint (_ ("block end address %s less than block "
+ "start address %s (patched it)"),
paddress (gdbarch, block->end ()),
paddress (gdbarch, block->start ()));
}
@@ -329,8 +320,7 @@ buildsym_compunit::finish_block_internal
start of this scope that don't have superblocks yet. */
opblock = NULL;
- for (pblock = m_pending_blocks;
- pblock && pblock != old_blocks;
+ for (pblock = m_pending_blocks; pblock && pblock != old_blocks;
pblock = pblock->next)
{
if (pblock->block->superblock () == NULL)
@@ -348,13 +338,13 @@ buildsym_compunit::finish_block_internal
{
if (symbol)
{
- complaint (_("inner block not inside outer block in %s"),
+ complaint (_ ("inner block not inside outer block in %s"),
symbol->print_name ());
}
else
{
- complaint (_("inner block (%s-%s) not "
- "inside outer block (%s-%s)"),
+ complaint (_ ("inner block (%s-%s) not "
+ "inside outer block (%s-%s)"),
paddress (gdbarch, pblock->block->start ()),
paddress (gdbarch, pblock->block->end ()),
paddress (gdbarch, block->start ()),
@@ -373,9 +363,8 @@ buildsym_compunit::finish_block_internal
}
block_set_using (block,
- (is_global
- ? m_global_using_directives
- : m_local_using_directives),
+ (is_global ? m_global_using_directives
+ : m_local_using_directives),
&m_objfile->objfile_obstack);
if (is_global)
m_global_using_directives = NULL;
@@ -393,8 +382,8 @@ buildsym_compunit::finish_block (struct symbol *symbol,
const struct dynamic_prop *static_link,
CORE_ADDR start, CORE_ADDR end)
{
- return finish_block_internal (symbol, &m_local_symbols,
- old_blocks, static_link, start, end, 0, 0);
+ return finish_block_internal (symbol, &m_local_symbols, old_blocks,
+ static_link, start, end, 0, 0);
}
/* Record that the range of addresses from START to END_INCLUSIVE
@@ -406,8 +395,7 @@ buildsym_compunit::finish_block (struct symbol *symbol,
already provided by BLOCK_START and BLOCK_END, then we create an
address map for the block. */
void
-buildsym_compunit::record_block_range (struct block *block,
- CORE_ADDR start,
+buildsym_compunit::record_block_range (struct block *block, CORE_ADDR start,
CORE_ADDR end_inclusive)
{
/* If this is any different from the range recorded in the block's
@@ -415,8 +403,7 @@ buildsym_compunit::record_block_range (struct block *block,
become interesting. Note that even if this block doesn't have
any "interesting" ranges, some later block might, so we still
need to record this block in the addrmap. */
- if (start != block->start ()
- || end_inclusive + 1 != block->end ())
+ if (start != block->start () || end_inclusive + 1 != block->end ())
m_pending_addrmap_interesting = true;
m_pending_addrmap.set_empty (start, end_inclusive, block);
@@ -435,10 +422,9 @@ buildsym_compunit::make_blockvector ()
{
}
- blockvector = (struct blockvector *)
- obstack_alloc (&m_objfile->objfile_obstack,
- (sizeof (struct blockvector)
- + (i - 1) * sizeof (struct block *)));
+ blockvector = (struct blockvector *) obstack_alloc (
+ &m_objfile->objfile_obstack,
+ (sizeof (struct blockvector) + (i - 1) * sizeof (struct block *)));
/* Copy the blocks into the blockvector. This is done in reverse
order, which happens to put the blocks into the proper order
@@ -455,9 +441,9 @@ buildsym_compunit::make_blockvector ()
/* If we needed an address map for this symtab, record it in the
blockvector. */
if (m_pending_addrmap_interesting)
- blockvector->set_map
- (new (&m_objfile->objfile_obstack) addrmap_fixed
- (&m_objfile->objfile_obstack, &m_pending_addrmap));
+ blockvector->set_map (new (&m_objfile->objfile_obstack)
+ addrmap_fixed (&m_objfile->objfile_obstack,
+ &m_pending_addrmap));
else
blockvector->set_map (nullptr);
@@ -474,10 +460,9 @@ buildsym_compunit::make_blockvector ()
if (blockvector->block (i - 1)->start ()
> blockvector->block (i)->start ())
{
- CORE_ADDR start
- = blockvector->block (i)->start ();
+ CORE_ADDR start = blockvector->block (i)->start ();
- complaint (_("block at %s out of order"),
+ complaint (_ ("block at %s out of order"),
hex_string ((LONGEST) start));
}
}
@@ -493,13 +478,15 @@ buildsym_compunit::start_subfile (const char *name, const char *name_for_id)
{
/* See if this subfile is already registered. */
- symtab_create_debug_printf ("name = %s, name_for_id = %s", name, name_for_id);
+ symtab_create_debug_printf ("name = %s, name_for_id = %s", name,
+ name_for_id);
for (subfile *subfile = m_subfiles; subfile; subfile = subfile->next)
if (FILENAME_CMP (subfile->name_for_id.c_str (), name_for_id) == 0)
{
- symtab_create_debug_printf ("found existing symtab with name_for_id %s",
- subfile->name_for_id.c_str ());
+ symtab_create_debug_printf (
+ "found existing symtab with name_for_id %s",
+ subfile->name_for_id.c_str ());
m_current_subfile = subfile;
return;
}
@@ -535,7 +522,8 @@ buildsym_compunit::start_subfile (const char *name, const char *name_for_id)
if (!subfile->name.empty ())
{
struct subfile *s;
- language sublang = deduce_language_from_filename (subfile->name.c_str ());
+ language sublang
+ = deduce_language_from_filename (subfile->name.c_str ());
if (sublang == language_cplus || sublang == language_fortran)
for (s = m_subfiles; s != NULL; s = s->next)
@@ -544,8 +532,7 @@ buildsym_compunit::start_subfile (const char *name, const char *name_for_id)
}
/* And patch up this file if necessary. */
- if (subfile->language == language_c
- && m_subfiles != nullptr
+ if (subfile->language == language_c && m_subfiles != nullptr
&& (m_subfiles->language == language_cplus
|| m_subfiles->language == language_fortran))
subfile->language = m_subfiles->language;
@@ -571,9 +558,7 @@ void
buildsym_compunit::patch_subfile_names (struct subfile *subfile,
const char *name)
{
- if (subfile != NULL
- && m_comp_dir.empty ()
- && !subfile->name.empty ()
+ if (subfile != NULL && m_comp_dir.empty () && !subfile->name.empty ()
&& IS_DIR_SEPARATOR (subfile->name.back ()))
{
m_comp_dir = std::move (subfile->name);
@@ -594,14 +579,13 @@ buildsym_compunit::patch_subfile_names (struct subfile *subfile,
subfile->language
= deduce_language_from_filename (subfile->name.c_str ());
- if (subfile->language == language_unknown
- && subfile->next != NULL)
+ if (subfile->language == language_unknown && subfile->next != NULL)
{
subfile->language = subfile->next->language;
}
}
}
-
+
/* Handle the N_BINCL and N_EINCL symbol types that act like N_SOL for
switching source files (different subfiles, as we call them) within
one object file, but using a stack rather than in an arbitrary
@@ -623,7 +607,7 @@ buildsym_compunit::pop_subfile ()
m_subfile_stack.pop_back ();
return name;
}
-
+
/* Add a linetable entry for line number LINE and address PC to the
line vector for SUBFILE. */
@@ -674,7 +658,6 @@ buildsym_compunit::record_line (struct subfile *subfile, int line,
e.prologue_end = (flags & LEF_PROLOGUE_END) != 0;
}
-
/* Subroutine of end_compunit_symtab to simplify it. Look for a subfile that
matches the main source file's basename. If there is only one, and
if the main source file doesn't have any symbol or line number
@@ -696,8 +679,7 @@ buildsym_compunit::watch_main_source_file_lossage ()
/* If the main source file doesn't have any line number or symbol
info, look for an alias in another subfile. */
- if (mainsub->line_vector_entries.empty ()
- && mainsub->symtab == NULL)
+ if (mainsub->line_vector_entries.empty () && mainsub->symtab == NULL)
{
const char *mainbase = lbasename (mainsub->name.c_str ());
int nr_matches = 0;
@@ -706,9 +688,7 @@ buildsym_compunit::watch_main_source_file_lossage ()
struct subfile *prev_mainsub_alias = NULL;
prevsub = NULL;
- for (subfile = m_subfiles;
- subfile != NULL;
- subfile = subfile->next)
+ for (subfile = m_subfiles; subfile != NULL; subfile = subfile->next)
{
if (subfile == mainsub)
continue;
@@ -774,8 +754,8 @@ buildsym_compunit::end_compunit_symtab_get_static_block (CORE_ADDR end_addr,
struct context_stack cstk = pop_context ();
/* Make a block for the local symbols within. */
- finish_block (cstk.name, cstk.old_blocks, NULL,
- cstk.start_addr, end_addr);
+ finish_block (cstk.name, cstk.old_blocks, NULL, cstk.start_addr,
+ end_addr);
if (!m_context_stack.empty ())
{
@@ -784,7 +764,7 @@ buildsym_compunit::end_compunit_symtab_get_static_block (CORE_ADDR end_addr,
same. FIXME: Find out why it is happening. This is not
believed to happen in most cases (even for coffread.c);
it used to be an abort(). */
- complaint (_("Context stack not empty in end_compunit_symtab"));
+ complaint (_ ("Context stack not empty in end_compunit_symtab"));
m_context_stack.clear ();
}
}
@@ -805,10 +785,9 @@ buildsym_compunit::end_compunit_symtab_get_static_block (CORE_ADDR end_addr,
same start address must remain in the original order to preserve
inline function caller/callee relationships. */
std::stable_sort (barray.begin (), barray.end (),
- [] (const block *a, const block *b)
- {
- return a->start () > b->start ();
- });
+ [] (const block *a, const block *b) {
+ return a->start () > b->start ();
+ });
int i = 0;
for (pb = m_pending_blocks; pb != NULL; pb = pb->next)
@@ -828,13 +807,9 @@ buildsym_compunit::end_compunit_symtab_get_static_block (CORE_ADDR end_addr,
cleanup_undefined_stabs_types (m_objfile);
finish_global_stabs (m_objfile);
- if (!required
- && m_pending_blocks == NULL
- && m_file_symbols == NULL
- && m_global_symbols == NULL
- && !m_have_line_numbers
- && m_pending_macros == NULL
- && m_global_using_directives == NULL)
+ if (!required && m_pending_blocks == NULL && m_file_symbols == NULL
+ && m_global_symbols == NULL && !m_have_line_numbers
+ && m_pending_macros == NULL && m_global_using_directives == NULL)
{
/* Ignore symtabs that have no functions with real debugging info. */
return NULL;
@@ -843,8 +818,8 @@ buildsym_compunit::end_compunit_symtab_get_static_block (CORE_ADDR end_addr,
{
/* Define the STATIC_BLOCK. */
return finish_block_internal (NULL, get_file_symbols (), NULL, NULL,
- m_last_source_start_addr,
- end_addr, 0, expandable);
+ m_last_source_start_addr, end_addr, 0,
+ expandable);
}
}
@@ -854,8 +829,8 @@ buildsym_compunit::end_compunit_symtab_get_static_block (CORE_ADDR end_addr,
arguments. */
struct compunit_symtab *
-buildsym_compunit::end_compunit_symtab_with_blockvector
- (struct block *static_block, int expandable)
+buildsym_compunit::end_compunit_symtab_with_blockvector (
+ struct block *static_block, int expandable)
{
struct compunit_symtab *cu = m_compunit_symtab;
struct blockvector *blockvector;
@@ -869,8 +844,7 @@ buildsym_compunit::end_compunit_symtab_with_blockvector
/* Create the GLOBAL_BLOCK and build the blockvector. */
finish_block_internal (NULL, get_global_symbols (), NULL, NULL,
- m_last_source_start_addr, end_addr,
- 1, expandable);
+ m_last_source_start_addr, end_addr, 1, expandable);
blockvector = make_blockvector ();
/* Read the line table if it has to be read separately.
@@ -886,22 +860,18 @@ buildsym_compunit::end_compunit_symtab_with_blockvector
/* Now create the symtab objects proper, if not already done,
one for each subfile. */
- for (subfile = m_subfiles;
- subfile != NULL;
- subfile = subfile->next)
+ for (subfile = m_subfiles; subfile != NULL; subfile = subfile->next)
{
if (!subfile->line_vector_entries.empty ())
{
const auto lte_is_less_than
= [] (const linetable_entry &ln1,
- const linetable_entry &ln2) -> bool
- {
- if (ln1.pc == ln2.pc
- && ((ln1.line == 0) != (ln2.line == 0)))
- return ln1.line == 0;
+ const linetable_entry &ln2) -> bool {
+ if (ln1.pc == ln2.pc && ((ln1.line == 0) != (ln2.line == 0)))
+ return ln1.line == 0;
- return (ln1.pc < ln2.pc);
- };
+ return (ln1.pc < ln2.pc);
+ };
/* Like the pending blocks, the line table may be scrambled in
reordered executables. Sort it if OBJF_REORDERED is true. It
@@ -927,12 +897,12 @@ buildsym_compunit::end_compunit_symtab_with_blockvector
{
/* Reallocate the line table on the objfile obstack. */
size_t n_entries = subfile->line_vector_entries.size ();
- size_t entry_array_size = n_entries * sizeof (struct linetable_entry);
+ size_t entry_array_size
+ = n_entries * sizeof (struct linetable_entry);
int linetablesize = sizeof (struct linetable) + entry_array_size;
- symtab->set_linetable
- (XOBNEWVAR (&m_objfile->objfile_obstack, struct linetable,
- linetablesize));
+ symtab->set_linetable (XOBNEWVAR (&m_objfile->objfile_obstack,
+ struct linetable, linetablesize));
symtab->linetable ()->nitems = n_entries;
memcpy (symtab->linetable ()->item,
@@ -994,7 +964,7 @@ buildsym_compunit::end_compunit_symtab_with_blockvector
static symbol lists. */
if (block->function () != nullptr
&& block->function ()->symtab () == nullptr)
- block->function ()->set_symtab (symtab);
+ block->function ()->set_symtab (symtab);
/* Note that we only want to fix up symbols from the local
blocks, not blocks coming from included symtabs. That is why
@@ -1017,8 +987,8 @@ buildsym_compunit::end_compunit_symtab_with_blockvector
expandable. */
struct compunit_symtab *
-buildsym_compunit::end_compunit_symtab_from_static_block
- (struct block *static_block, int expandable)
+buildsym_compunit::end_compunit_symtab_from_static_block (
+ struct block *static_block, int expandable)
{
struct compunit_symtab *cu;
@@ -1086,8 +1056,7 @@ buildsym_compunit::end_expandable_symtab (CORE_ADDR end_addr)
don't have one. */
static void
-set_missing_symtab (struct pending *pending_list,
- struct compunit_symtab *cu)
+set_missing_symtab (struct pending *pending_list, struct compunit_symtab *cu)
{
struct pending *pending;
int i;
@@ -1113,13 +1082,13 @@ buildsym_compunit::augment_type_symtab ()
struct blockvector *blockvector = cust->blockvector ();
if (!m_context_stack.empty ())
- complaint (_("Context stack not empty in augment_type_symtab"));
+ complaint (_ ("Context stack not empty in augment_type_symtab"));
if (m_pending_blocks != NULL)
- complaint (_("Blocks in a type symtab"));
+ complaint (_ ("Blocks in a type symtab"));
if (m_pending_macros != NULL)
- complaint (_("Macro in a type symtab"));
+ complaint (_ ("Macro in a type symtab"));
if (m_have_line_numbers)
- complaint (_("Line numbers recorded in a type symtab"));
+ complaint (_ ("Line numbers recorded in a type symtab"));
if (m_file_symbols != NULL)
{
diff --git a/gdb/buildsym.h b/gdb/buildsym.h
index 42fcd1fdb97..7befdb565fb 100644
--- a/gdb/buildsym.h
+++ b/gdb/buildsym.h
@@ -16,7 +16,7 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
-#if !defined (BUILDSYM_H)
+#if !defined(BUILDSYM_H)
#define BUILDSYM_H 1
#include "gdbsupport/gdb_obstack.h"
@@ -75,51 +75,50 @@ using subfile_up = std::unique_ptr<subfile>;
#define PENDINGSIZE 100
struct pending
- {
- struct pending *next;
- int nsyms;
- struct symbol *symbol[PENDINGSIZE];
- };
+{
+ struct pending *next;
+ int nsyms;
+ struct symbol *symbol[PENDINGSIZE];
+};
/* Stack representing unclosed lexical contexts (that will become
blocks, eventually). */
struct context_stack
- {
- /* Outer locals at the time we entered */
+{
+ /* Outer locals at the time we entered */
- struct pending *locals;
+ struct pending *locals;
- /* Pending using directives at the time we entered. */
+ /* Pending using directives at the time we entered. */
- struct using_direct *local_using_directives;
+ struct using_direct *local_using_directives;
- /* Pointer into blocklist as of entry */
+ /* Pointer into blocklist as of entry */
- struct pending_block *old_blocks;
+ struct pending_block *old_blocks;
- /* Name of function, if any, defining context */
+ /* Name of function, if any, defining context */
- struct symbol *name;
+ struct symbol *name;
- /* Expression that computes the frame base of the lexically enclosing
+ /* Expression that computes the frame base of the lexically enclosing
function, if any. NULL otherwise. */
- struct dynamic_prop *static_link;
+ struct dynamic_prop *static_link;
- /* PC where this context starts */
+ /* PC where this context starts */
- CORE_ADDR start_addr;
+ CORE_ADDR start_addr;
- /* Temp slot for exception handling. */
+ /* Temp slot for exception handling. */
- CORE_ADDR end_addr;
+ CORE_ADDR end_addr;
- /* For error-checking matching push/pop */
+ /* For error-checking matching push/pop */
- int depth;
-
- };
+ int depth;
+};
/* Flags associated with a linetable entry. */
@@ -132,8 +131,8 @@ enum linetable_entry_flag : unsigned
instruction past a function prologue. */
LEF_PROLOGUE_END = 1 << 2,
};
-DEF_ENUM_FLAGS_TYPE (enum linetable_entry_flag, linetable_entry_flags);
+DEF_ENUM_FLAGS_TYPE (enum linetable_entry_flag, linetable_entry_flags);
/* Buildsym's counterpart to struct compunit_symtab. */
@@ -158,7 +157,8 @@ struct buildsym_compunit
const char *comp_dir_, enum language language_,
CORE_ADDR last_addr)
: buildsym_compunit (objfile_, name, comp_dir_, name, language_, last_addr)
- {}
+ {
+ }
/* Reopen an existing compunit_symtab so that additional symbols can
be added to it. Arguments are as for the main constructor. CUST
@@ -186,10 +186,7 @@ struct buildsym_compunit
m_last_source_file.reset (new_name);
}
- const char *get_last_source_file ()
- {
- return m_last_source_file.get ();
- }
+ const char *get_last_source_file () { return m_last_source_file.get (); }
struct macro_table *get_macro_table ();
@@ -213,8 +210,8 @@ struct buildsym_compunit
const struct dynamic_prop *static_link,
CORE_ADDR start, CORE_ADDR end);
- void record_block_range (struct block *block,
- CORE_ADDR start, CORE_ADDR end_inclusive);
+ void record_block_range (struct block *block, CORE_ADDR start,
+ CORE_ADDR end_inclusive);
/* Start recording information about source code that comes from a source
file. This sets the current subfile, creating it if necessary.
@@ -228,10 +225,7 @@ struct buildsym_compunit
/* Same as above, but passes NAME for NAME_FOR_ID. */
- void start_subfile (const char *name)
- {
- return start_subfile (name, name);
- }
+ void start_subfile (const char *name) { return start_subfile (name, name); }
void patch_subfile_names (struct subfile *subfile, const char *name);
@@ -242,20 +236,14 @@ struct buildsym_compunit
void record_line (struct subfile *subfile, int line, CORE_ADDR pc,
linetable_entry_flags flags);
- struct compunit_symtab *get_compunit_symtab ()
- {
- return m_compunit_symtab;
- }
+ struct compunit_symtab *get_compunit_symtab () { return m_compunit_symtab; }
void set_last_source_start_addr (CORE_ADDR addr)
{
m_last_source_start_addr = addr;
}
- CORE_ADDR get_last_source_start_addr ()
- {
- return m_last_source_start_addr;
- }
+ CORE_ADDR get_last_source_start_addr () { return m_last_source_start_addr; }
struct using_direct **get_local_using_directives ()
{
@@ -272,10 +260,7 @@ struct buildsym_compunit
return &m_global_using_directives;
}
- bool outermost_context_p () const
- {
- return m_context_stack.empty ();
- }
+ bool outermost_context_p () const { return m_context_stack.empty (); }
struct context_stack *get_current_context_stack ()
{
@@ -284,50 +269,31 @@ struct buildsym_compunit
return &m_context_stack.back ();
}
- int get_context_stack_depth () const
- {
- return m_context_stack.size ();
- }
+ int get_context_stack_depth () const { return m_context_stack.size (); }
- struct subfile *get_current_subfile ()
- {
- return m_current_subfile;
- }
+ struct subfile *get_current_subfile () { return m_current_subfile; }
- struct pending **get_local_symbols ()
- {
- return &m_local_symbols;
- }
+ struct pending **get_local_symbols () { return &m_local_symbols; }
- struct pending **get_file_symbols ()
- {
- return &m_file_symbols;
- }
+ struct pending **get_file_symbols () { return &m_file_symbols; }
- struct pending **get_global_symbols ()
- {
- return &m_global_symbols;
- }
+ struct pending **get_global_symbols () { return &m_global_symbols; }
- void record_debugformat (const char *format)
- {
- m_debugformat = format;
- }
+ void record_debugformat (const char *format) { m_debugformat = format; }
- void record_producer (const char *producer)
- {
- m_producer = producer;
- }
+ void record_producer (const char *producer) { m_producer = producer; }
struct context_stack *push_context (int desc, CORE_ADDR valu);
struct context_stack pop_context ();
- struct block *end_compunit_symtab_get_static_block
- (CORE_ADDR end_addr, int expandable, int required);
+ struct block *end_compunit_symtab_get_static_block (CORE_ADDR end_addr,
+ int expandable,
+ int required);
- struct compunit_symtab *end_compunit_symtab_from_static_block
- (struct block *static_block, int expandable);
+ struct compunit_symtab *
+ end_compunit_symtab_from_static_block (struct block *static_block,
+ int expandable);
struct compunit_symtab *end_compunit_symtab (CORE_ADDR end_addr);
@@ -337,7 +303,8 @@ struct buildsym_compunit
private:
- void record_pending_block (struct block *block, struct pending_block *opblock);
+ void record_pending_block (struct block *block,
+ struct pending_block *opblock);
struct block *finish_block_internal (struct symbol *symbol,
struct pending **listhead,
@@ -350,8 +317,9 @@ private:
void watch_main_source_file_lossage ();
- struct compunit_symtab *end_compunit_symtab_with_blockvector
- (struct block *static_block, int expandable);
+ struct compunit_symtab *
+ end_compunit_symtab_with_blockvector (struct block *static_block,
+ int expandable);
/* The objfile we're reading debug info from. */
struct objfile *m_objfile;
@@ -445,12 +413,10 @@ private:
struct pending *m_local_symbols = nullptr;
};
-
-
extern void add_symbol_to_list (struct symbol *symbol,
struct pending **listhead);
-extern struct symbol *find_symbol_in_list (struct pending *list,
- char *name, int length);
+extern struct symbol *find_symbol_in_list (struct pending *list, char *name,
+ int length);
#endif /* defined (BUILDSYM_H) */
diff --git a/gdb/c-exp.h b/gdb/c-exp.h
index 20eeaca9a89..113a1c6dd15 100644
--- a/gdb/c-exp.h
+++ b/gdb/c-exp.h
@@ -28,21 +28,17 @@ extern struct value *eval_op_objc_selector (struct type *expect_type,
enum noside noside,
const char *sel);
extern struct value *opencl_value_cast (struct type *type, struct value *arg);
-extern struct value *eval_opencl_assign (struct type *expect_type,
- struct expression *exp,
- enum noside noside,
- enum exp_opcode op,
- struct value *arg1,
- struct value *arg2);
+extern struct value *
+eval_opencl_assign (struct type *expect_type, struct expression *exp,
+ enum noside noside, enum exp_opcode op, struct value *arg1,
+ struct value *arg2);
extern struct value *opencl_relop (struct type *expect_type,
- struct expression *exp,
- enum noside noside, enum exp_opcode op,
- struct value *arg1, struct value *arg2);
-extern struct value *opencl_logical_not (struct type *expect_type,
- struct expression *exp,
- enum noside noside,
- enum exp_opcode op,
- struct value *arg);
+ struct expression *exp, enum noside noside,
+ enum exp_opcode op, struct value *arg1,
+ struct value *arg2);
+extern struct value *
+opencl_logical_not (struct type *expect_type, struct expression *exp,
+ enum noside noside, enum exp_opcode op, struct value *arg);
namespace expr
{
@@ -55,50 +51,42 @@ public:
using tuple_holding_operation::tuple_holding_operation;
- value *evaluate (struct type *expect_type,
- struct expression *exp,
+ value *evaluate (struct type *expect_type, struct expression *exp,
enum noside noside) override;
- enum exp_opcode opcode () const override
- { return OP_STRING; }
+ enum exp_opcode opcode () const override { return OP_STRING; }
};
-class objc_nsstring_operation
- : public tuple_holding_operation<std::string>
+class objc_nsstring_operation : public tuple_holding_operation<std::string>
{
public:
using tuple_holding_operation::tuple_holding_operation;
- value *evaluate (struct type *expect_type,
- struct expression *exp,
+ value *evaluate (struct type *expect_type, struct expression *exp,
enum noside noside) override
{
const std::string &str = std::get<0> (m_storage);
return value_nsstring (exp->gdbarch, str.c_str (), str.size () + 1);
}
- enum exp_opcode opcode () const override
- { return OP_OBJC_NSSTRING; }
+ enum exp_opcode opcode () const override { return OP_OBJC_NSSTRING; }
};
-class objc_selector_operation
- : public tuple_holding_operation<std::string>
+class objc_selector_operation : public tuple_holding_operation<std::string>
{
public:
using tuple_holding_operation::tuple_holding_operation;
- value *evaluate (struct type *expect_type,
- struct expression *exp,
+ value *evaluate (struct type *expect_type, struct expression *exp,
enum noside noside) override
{
return eval_op_objc_selector (expect_type, exp, noside,
std::get<0> (m_storage).c_str ());
}
- enum exp_opcode opcode () const override
- { return OP_OBJC_SELECTOR; }
+ enum exp_opcode opcode () const override { return OP_OBJC_SELECTOR; }
};
/* An Objective C message call. */
@@ -110,93 +98,76 @@ public:
using tuple_holding_operation::tuple_holding_operation;
- value *evaluate (struct type *expect_type,
- struct expression *exp,
+ value *evaluate (struct type *expect_type, struct expression *exp,
enum noside noside) override;
- enum exp_opcode opcode () const override
- { return OP_OBJC_MSGCALL; }
+ enum exp_opcode opcode () const override { return OP_OBJC_MSGCALL; }
};
-using opencl_cast_type_operation = cxx_cast_operation<UNOP_CAST_TYPE,
- opencl_value_cast>;
+using opencl_cast_type_operation
+ = cxx_cast_operation<UNOP_CAST_TYPE, opencl_value_cast>;
/* Binary operations, as needed for OpenCL. */
template<enum exp_opcode OP, binary_ftype FUNC,
typename BASE = maybe_constant_operation<operation_up, operation_up>>
-class opencl_binop_operation
- : public BASE
+class opencl_binop_operation : public BASE
{
public:
using BASE::BASE;
- value *evaluate (struct type *expect_type,
- struct expression *exp,
+ value *evaluate (struct type *expect_type, struct expression *exp,
enum noside noside) override
{
value *lhs
= std::get<0> (this->m_storage)->evaluate (nullptr, exp, noside);
- value *rhs
- = std::get<1> (this->m_storage)->evaluate (value_type (lhs), exp,
- noside);
+ value *rhs = std::get<1> (this->m_storage)
+ ->evaluate (value_type (lhs), exp, noside);
return FUNC (expect_type, exp, noside, OP, lhs, rhs);
}
- enum exp_opcode opcode () const override
- { return OP; }
+ enum exp_opcode opcode () const override { return OP; }
};
-using opencl_assign_operation = opencl_binop_operation<BINOP_ASSIGN,
- eval_opencl_assign,
- assign_operation>;
-using opencl_equal_operation = opencl_binop_operation<BINOP_EQUAL,
- opencl_relop>;
-using opencl_notequal_operation = opencl_binop_operation<BINOP_NOTEQUAL,
- opencl_relop>;
-using opencl_less_operation = opencl_binop_operation<BINOP_LESS,
- opencl_relop>;
-using opencl_gtr_operation = opencl_binop_operation<BINOP_GTR,
- opencl_relop>;
-using opencl_geq_operation = opencl_binop_operation<BINOP_GEQ,
- opencl_relop>;
-using opencl_leq_operation = opencl_binop_operation<BINOP_LEQ,
- opencl_relop>;
-
-using opencl_not_operation = unop_operation<UNOP_LOGICAL_NOT,
- opencl_logical_not>;
+using opencl_assign_operation
+ = opencl_binop_operation<BINOP_ASSIGN, eval_opencl_assign, assign_operation>;
+using opencl_equal_operation
+ = opencl_binop_operation<BINOP_EQUAL, opencl_relop>;
+using opencl_notequal_operation
+ = opencl_binop_operation<BINOP_NOTEQUAL, opencl_relop>;
+using opencl_less_operation = opencl_binop_operation<BINOP_LESS, opencl_relop>;
+using opencl_gtr_operation = opencl_binop_operation<BINOP_GTR, opencl_relop>;
+using opencl_geq_operation = opencl_binop_operation<BINOP_GEQ, opencl_relop>;
+using opencl_leq_operation = opencl_binop_operation<BINOP_LEQ, opencl_relop>;
+
+using opencl_not_operation
+ = unop_operation<UNOP_LOGICAL_NOT, opencl_logical_not>;
/* STRUCTOP_STRUCT implementation for OpenCL. */
-class opencl_structop_operation
- : public structop_base_operation
+class opencl_structop_operation : public structop_base_operation
{
public:
using structop_base_operation::structop_base_operation;
- value *evaluate (struct type *expect_type,
- struct expression *exp,
+ value *evaluate (struct type *expect_type, struct expression *exp,
enum noside noside) override;
- enum exp_opcode opcode () const override
- { return STRUCTOP_STRUCT; }
+ enum exp_opcode opcode () const override { return STRUCTOP_STRUCT; }
};
/* This handles the "&&" and "||" operations for OpenCL. */
class opencl_logical_binop_operation
- : public tuple_holding_operation<enum exp_opcode,
- operation_up, operation_up>
+ : public tuple_holding_operation<enum exp_opcode, operation_up, operation_up>
{
public:
using tuple_holding_operation::tuple_holding_operation;
- value *evaluate (struct type *expect_type,
- struct expression *exp,
+ value *evaluate (struct type *expect_type, struct expression *exp,
enum noside noside) override;
- enum exp_opcode opcode () const override
- { return std::get<0> (m_storage); }
+ enum exp_opcode opcode () const override { return std::get<0> (m_storage); }
};
/* The ?: ternary operator for OpenCL. */
@@ -207,14 +178,12 @@ public:
using tuple_holding_operation::tuple_holding_operation;
- value *evaluate (struct type *expect_type,
- struct expression *exp,
+ value *evaluate (struct type *expect_type, struct expression *exp,
enum noside noside) override;
- enum exp_opcode opcode () const override
- { return TERNOP_COND; }
+ enum exp_opcode opcode () const override { return TERNOP_COND; }
};
-}/* namespace expr */
+} /* namespace expr */
#endif /* C_EXP_H */
diff --git a/gdb/c-lang.c b/gdb/c-lang.c
index a6d912a7be7..b13fff80ae0 100644
--- a/gdb/c-lang.c
+++ b/gdb/c-lang.c
@@ -63,7 +63,7 @@ charset_for_string_type (c_string_type str_type, struct gdbarch *gdbarch)
else
return "UTF-32LE";
}
- internal_error (_("unhandled c_string_type"));
+ internal_error (_ ("unhandled c_string_type"));
}
/* Classify ELTTYPE according to what kind of character it is. Return
@@ -131,7 +131,7 @@ classify_type (struct type *elttype, struct gdbarch *gdbarch,
/* Punt. */
result = C_CHAR;
- done:
+done:
if (encoding)
*encoding = charset_for_string_type (result, gdbarch);
@@ -143,8 +143,8 @@ classify_type (struct type *elttype, struct gdbarch *gdbarch,
for printing characters and strings is language specific. */
void
-language_defn::emitchar (int c, struct type *type,
- struct ui_file *stream, int quoter) const
+language_defn::emitchar (int c, struct type *type, struct ui_file *stream,
+ int quoter) const
{
const char *encoding;
@@ -156,7 +156,7 @@ language_defn::emitchar (int c, struct type *type,
void
language_defn::printchar (int c, struct type *type,
- struct ui_file * stream) const
+ struct ui_file *stream) const
{
c_string_type str_type;
@@ -198,8 +198,7 @@ language_defn::printstr (struct ui_file *stream, struct type *type,
const char *type_encoding;
const char *encoding;
- str_type = (classify_type (type, type->arch (), &type_encoding)
- & ~C_CHAR);
+ str_type = (classify_type (type, type->arch (), &type_encoding) & ~C_CHAR);
switch (str_type)
{
case C_STRING:
@@ -240,16 +239,14 @@ language_defn::printstr (struct ui_file *stream, struct type *type,
void
c_get_string (struct value *value, gdb::unique_xmalloc_ptr<gdb_byte> *buffer,
- int *length, struct type **char_type,
- const char **charset)
+ int *length, struct type **char_type, const char **charset)
{
int err, width;
unsigned int fetchlimit;
struct type *type = check_typedef (value_type (value));
struct type *element_type = type->target_type ();
int req_length = *length;
- enum bfd_endian byte_order
- = type_byte_order (type);
+ enum bfd_endian byte_order = type_byte_order (type);
if (element_type == NULL)
goto error;
@@ -263,8 +260,8 @@ c_get_string (struct value *value, gdb::unique_xmalloc_ptr<gdb_byte> *buffer,
{
LONGEST low_bound, high_bound;
- get_discrete_bounds (type->field (0).type (),
- &low_bound, &high_bound);
+ get_discrete_bounds (type->field (0).type (), &low_bound,
+ &high_bound);
fetchlimit = high_bound - low_bound + 1;
}
else
@@ -276,7 +273,7 @@ c_get_string (struct value *value, gdb::unique_xmalloc_ptr<gdb_byte> *buffer,
/* We work only with arrays and pointers. */
goto error;
- if (! c_textual_element_type (element_type, 0))
+ if (!c_textual_element_type (element_type, 0))
goto error;
classify_type (element_type, element_type->arch (), charset);
width = element_type->length ();
@@ -294,25 +291,24 @@ c_get_string (struct value *value, gdb::unique_xmalloc_ptr<gdb_byte> *buffer,
C struct hack. So, only do this if either no length was
specified, or the length is within the existing bounds. This
avoids running off the end of the value's contents. */
- if ((VALUE_LVAL (value) == not_lval
- || VALUE_LVAL (value) == lval_internalvar
+ if ((VALUE_LVAL (value) == not_lval || VALUE_LVAL (value) == lval_internalvar
|| type->code () == TYPE_CODE_ARRAY)
- && fetchlimit != UINT_MAX
- && (*length < 0 || *length <= fetchlimit))
+ && fetchlimit != UINT_MAX && (*length < 0 || *length <= fetchlimit))
{
int i;
const gdb_byte *contents = value_contents (value).data ();
/* If a length is specified, use that. */
if (*length >= 0)
- i = *length;
+ i = *length;
else
/* Otherwise, look for a null character. */
for (i = 0; i < fetchlimit; i++)
- if (extract_unsigned_integer (contents + i * width,
- width, byte_order) == 0)
+ if (extract_unsigned_integer (contents + i * width, width,
+ byte_order)
+ == 0)
break;
-
+
/* I is now either a user-defined length, the number of non-null
characters, or FETCHLIMIT. */
*length = i * width;
@@ -329,8 +325,8 @@ c_get_string (struct value *value, gdb::unique_xmalloc_ptr<gdb_byte> *buffer,
if (type->code () == TYPE_CODE_ARRAY)
{
if (VALUE_LVAL (value) != lval_memory)
- error (_("Attempt to take address of value "
- "not located in memory."));
+ error (_ ("Attempt to take address of value "
+ "not located in memory."));
addr = value_address (value);
}
else
@@ -351,8 +347,8 @@ c_get_string (struct value *value, gdb::unique_xmalloc_ptr<gdb_byte> *buffer,
if (*length > 0)
fetchlimit = UINT_MAX;
- err = target_read_string (addr, *length, width, fetchlimit,
- buffer, length);
+ err = target_read_string (addr, *length, width, fetchlimit, buffer,
+ length);
if (err != 0)
memory_error (TARGET_XFER_E_IO, addr);
}
@@ -364,34 +360,34 @@ c_get_string (struct value *value, gdb::unique_xmalloc_ptr<gdb_byte> *buffer,
if (req_length == -1)
/* If the last character is null, subtract it from LENGTH. */
if (*length > 0
- && extract_unsigned_integer (buffer->get () + *length - width,
- width, byte_order) == 0)
+ && extract_unsigned_integer (buffer->get () + *length - width, width,
+ byte_order)
+ == 0)
*length -= width;
-
+
/* The read_string function will return the number of bytes read.
If length returned from read_string was > 0, return the number of
characters read by dividing the number of bytes by width. */
if (*length != 0)
- *length = *length / width;
+ *length = *length / width;
*char_type = element_type;
return;
- error:
+error:
{
std::string type_str = type_to_string (type);
if (!type_str.empty ())
{
- error (_("Trying to read string with inappropriate type `%s'."),
+ error (_ ("Trying to read string with inappropriate type `%s'."),
type_str.c_str ());
}
else
- error (_("Trying to read string with inappropriate type."));
+ error (_ ("Trying to read string with inappropriate type."));
}
}
-
/* Evaluating C and C++ expressions. */
/* Convert a UCN. The digits of the UCN start at P and extend no
@@ -417,8 +413,8 @@ convert_ucn (const char *p, const char *limit, const char *dest_charset,
result >>= 8;
}
- convert_between_encodings ("UTF-32BE", dest_charset, data,
- 4, 4, output, translit_none);
+ convert_between_encodings ("UTF-32BE", dest_charset, data, 4, 4, output,
+ translit_none);
return p;
}
@@ -443,14 +439,13 @@ emit_numeric_character (struct type *type, unsigned long value,
pointer to just after the final digit of the escape sequence. */
static const char *
-convert_octal (struct type *type, const char *p,
- const char *limit, struct obstack *output)
+convert_octal (struct type *type, const char *p, const char *limit,
+ struct obstack *output)
{
int i;
unsigned long value = 0;
- for (i = 0;
- i < 3 && p < limit && ISDIGIT (*p) && *p != '8' && *p != '9';
+ for (i = 0; i < 3 && p < limit && ISDIGIT (*p) && *p != '8' && *p != '9';
++i)
{
value = 8 * value + fromhex (*p);
@@ -468,8 +463,8 @@ convert_octal (struct type *type, const char *p,
just after the final digit of the escape sequence. */
static const char *
-convert_hex (struct type *type, const char *p,
- const char *limit, struct obstack *output)
+convert_hex (struct type *type, const char *p, const char *limit,
+ struct obstack *output)
{
unsigned long value = 0;
@@ -484,12 +479,14 @@ convert_hex (struct type *type, const char *p,
return p;
}
-#define ADVANCE \
- do { \
- ++p; \
- if (p == limit) \
- error (_("Malformed escape sequence")); \
- } while (0)
+#define ADVANCE \
+ do \
+ { \
+ ++p; \
+ if (p == limit) \
+ error (_ ("Malformed escape sequence")); \
+ } \
+ while (0)
/* Convert an escape sequence to a target format. TYPE is the target
character type to use, and DEST_CHARSET is the name of the target
@@ -499,8 +496,8 @@ convert_hex (struct type *type, const char *p,
character of the escape sequence. */
static const char *
-convert_escape (struct type *type, const char *dest_charset,
- const char *p, const char *limit, struct obstack *output)
+convert_escape (struct type *type, const char *dest_charset, const char *p,
+ const char *limit, struct obstack *output)
{
/* Skip the backslash. */
ADVANCE;
@@ -515,7 +512,7 @@ convert_escape (struct type *type, const char *dest_charset,
case 'x':
ADVANCE;
if (!ISXDIGIT (*p))
- error (_("\\x used with no following hex digits."));
+ error (_ ("\\x used with no following hex digits."));
p = convert_hex (type, p, limit, output);
break;
@@ -537,7 +534,7 @@ convert_escape (struct type *type, const char *dest_charset,
ADVANCE;
if (!ISXDIGIT (*p))
- error (_("\\u used with no following hex digits"));
+ error (_ ("\\u used with no following hex digits"));
p = convert_ucn (p, limit, dest_charset, output, length);
}
}
@@ -582,8 +579,7 @@ namespace expr
{
value *
-c_string_operation::evaluate (struct type *expect_type,
- struct expression *exp,
+c_string_operation::evaluate (struct type *expect_type, struct expression *exp,
enum noside noside)
{
struct type *type;
@@ -599,8 +595,7 @@ c_string_operation::evaluate (struct type *expect_type,
switch (dest_type & ~C_CHAR)
{
case C_STRING:
- type = language_string_char_type (exp->language_defn,
- exp->gdbarch);
+ type = language_string_char_type (exp->language_defn, exp->gdbarch);
break;
case C_WIDE_STRING:
type = lookup_typename (exp->language_defn, "wchar_t", NULL, 0);
@@ -612,7 +607,7 @@ c_string_operation::evaluate (struct type *expect_type,
type = lookup_typename (exp->language_defn, "char32_t", NULL, 0);
break;
default:
- internal_error (_("unhandled c_string_type"));
+ internal_error (_ ("unhandled c_string_type"));
}
/* Ensure TYPE_LENGTH is valid for TYPE. */
@@ -623,8 +618,7 @@ c_string_operation::evaluate (struct type *expect_type,
caller to cast. */
if (expect_type && expect_type->code () == TYPE_CODE_ARRAY)
{
- struct type *element_type
- = check_typedef (expect_type->target_type ());
+ struct type *element_type = check_typedef (expect_type->target_type ());
if (element_type->code () == TYPE_CODE_INT
|| element_type->code () == TYPE_CODE_CHAR)
@@ -637,16 +631,16 @@ c_string_operation::evaluate (struct type *expect_type,
dest_charset = charset_for_string_type (dest_type, exp->gdbarch);
for (const std::string &item : std::get<1> (m_storage))
- parse_one_string (&output, item.c_str (), item.size (),
- dest_charset, type);
+ parse_one_string (&output, item.c_str (), item.size (), dest_charset,
+ type);
if ((dest_type & C_CHAR) != 0)
{
LONGEST value;
if (obstack_object_size (&output) != type->length ())
- error (_("Could not convert character "
- "constant to target character set"));
+ error (_ ("Could not convert character "
+ "constant to target character set"));
value = unpack_long (type, (gdb_byte *) obstack_base (&output));
result = value_from_longest (type, value);
}
@@ -663,15 +657,15 @@ c_string_operation::evaluate (struct type *expect_type,
LONGEST low_bound, high_bound;
int element_size = type->length ();
- if (!get_discrete_bounds (expect_type->index_type (),
- &low_bound, &high_bound))
+ if (!get_discrete_bounds (expect_type->index_type (), &low_bound,
+ &high_bound))
{
low_bound = 0;
high_bound = (expect_type->length () / element_size) - 1;
}
if (obstack_object_size (&output) / element_size
> (high_bound - low_bound + 1))
- error (_("Too many array elements"));
+ error (_ ("Too many array elements"));
result = allocate_value (expect_type);
memcpy (value_contents_raw (result).data (), obstack_base (&output),
@@ -679,15 +673,13 @@ c_string_operation::evaluate (struct type *expect_type,
}
else
result = value_cstring ((const char *) obstack_base (&output),
- obstack_object_size (&output),
- type);
+ obstack_object_size (&output), type);
}
return result;
}
} /* namespace expr */
-
/* See c-lang.h. */
bool
@@ -706,8 +698,7 @@ c_is_string_type_p (struct type *type)
{
/* See if target type looks like a string. */
struct type *array_target_type = type->target_type ();
- return (type->length () > 0
- && array_target_type->length () > 0
+ return (type->length () > 0 && array_target_type->length () > 0
&& c_textual_element_type (array_target_type, 0));
}
case TYPE_CODE_STRING:
@@ -724,33 +715,24 @@ c_is_string_type_p (struct type *type)
return false;
}
-
-
/* See c-lang.h. */
gdb::unique_xmalloc_ptr<char>
c_canonicalize_name (const char *name)
{
- if (strchr (name, ' ') != nullptr
- || streq (name, "signed")
+ if (strchr (name, ' ') != nullptr || streq (name, "signed")
|| streq (name, "unsigned"))
return cp_canonicalize_string (name);
return nullptr;
}
-
-
void
-c_language_arch_info (struct gdbarch *gdbarch,
- struct language_arch_info *lai)
+c_language_arch_info (struct gdbarch *gdbarch, struct language_arch_info *lai)
{
const struct builtin_type *builtin = builtin_type (gdbarch);
/* Helper function to allow shorter lines below. */
- auto add = [&] (struct type * t)
- {
- lai->add_primitive_type (t);
- };
+ auto add = [&] (struct type *t) { lai->add_primitive_type (t); };
add (builtin->builtin_int);
add (builtin->builtin_long);
@@ -782,19 +764,19 @@ c_language_arch_info (struct gdbarch *gdbarch,
class c_language : public language_defn
{
public:
+
c_language ()
: language_defn (language_c)
- { /* Nothing. */ }
+ { /* Nothing. */
+ }
/* See language.h. */
- const char *name () const override
- { return "c"; }
+ const char *name () const override { return "c"; }
/* See language.h. */
- const char *natural_name () const override
- { return "C"; }
+ const char *natural_name () const override { return "C"; }
/* See language.h. */
@@ -818,8 +800,7 @@ public:
}
/* See language.h. */
- std::string compute_program (compile_instance *inst,
- const char *input,
+ std::string compute_program (compile_instance *inst, const char *input,
struct gdbarch *gdbarch,
const struct block *expr_block,
CORE_ADDR expr_pc) const override
@@ -829,10 +810,7 @@ public:
/* See language.h. */
- bool can_print_type_offsets () const override
- {
- return true;
- }
+ bool can_print_type_offsets () const override { return true; }
/* See language.h. */
@@ -845,13 +823,14 @@ public:
/* See language.h. */
- bool store_sym_names_in_linkage_form_p () const override
- { return true; }
+ bool store_sym_names_in_linkage_form_p () const override { return true; }
/* See language.h. */
enum macro_expansion macro_expansion () const override
- { return macro_expansion_c; }
+ {
+ return macro_expansion_c;
+ }
};
/* Single instance of the C language class. */
@@ -863,23 +842,22 @@ static c_language c_language_defn;
class cplus_language : public language_defn
{
public:
+
cplus_language ()
: language_defn (language_cplus)
- { /* Nothing. */ }
+ { /* Nothing. */
+ }
/* See language.h. */
- const char *name () const override
- { return "c++"; }
+ const char *name () const override { return "c++"; }
/* See language.h. */
- const char *natural_name () const override
- { return "C++"; }
+ const char *natural_name () const override { return "C++"; }
/* See language.h */
- const char *get_digit_separator () const override
- { return "\'"; }
+ const char *get_digit_separator () const override { return "\'"; }
/* See language.h. */
@@ -892,8 +870,8 @@ public:
/* See language.h. */
- struct language_pass_by_ref_info pass_by_reference_info
- (struct type *type) const override
+ struct language_pass_by_ref_info
+ pass_by_reference_info (struct type *type) const override
{
return cp_pass_by_reference (type);
}
@@ -905,10 +883,7 @@ public:
const struct builtin_type *builtin = builtin_type (gdbarch);
/* Helper function to allow shorter lines below. */
- auto add = [&] (struct type * t)
- {
- lai->add_primitive_type (t);
- };
+ auto add = [&] (struct type *t) { lai->add_primitive_type (t); };
add (builtin->builtin_int);
add (builtin->builtin_long);
@@ -952,8 +927,7 @@ public:
}
/* See language.h. */
- std::string compute_program (compile_instance *inst,
- const char *input,
+ std::string compute_program (compile_instance *inst, const char *input,
struct gdbarch *gdbarch,
const struct block *expr_block,
CORE_ADDR expr_pc) const override
@@ -968,9 +942,9 @@ public:
}
/* See language.h. */
- bool sniff_from_mangled_name
- (const char *mangled,
- gdb::unique_xmalloc_ptr<char> *demangled) const override
+ bool sniff_from_mangled_name (
+ const char *mangled,
+ gdb::unique_xmalloc_ptr<char> *demangled) const override
{
*demangled = gdb_demangle (mangled, DMGL_PARAMS | DMGL_ANSI);
return *demangled != NULL;
@@ -986,10 +960,7 @@ public:
/* See language.h. */
- bool can_print_type_offsets () const override
- {
- return true;
- }
+ bool can_print_type_offsets () const override { return true; }
/* See language.h. */
@@ -1002,8 +973,7 @@ public:
/* See language.h. */
- CORE_ADDR skip_trampoline (frame_info_ptr fi,
- CORE_ADDR pc) const override
+ CORE_ADDR skip_trampoline (frame_info_ptr fi, CORE_ADDR pc) const override
{
return cplus_skip_trampoline (fi, pc);
}
@@ -1017,34 +987,37 @@ public:
/* See language.h. */
- struct block_symbol lookup_symbol_nonlocal
- (const char *name, const struct block *block,
- const domain_enum domain) const override
+ struct block_symbol
+ lookup_symbol_nonlocal (const char *name, const struct block *block,
+ const domain_enum domain) const override
{
return cp_lookup_symbol_nonlocal (this, name, block, domain);
}
/* See language.h. */
- const char *name_of_this () const override
- { return "this"; }
+ const char *name_of_this () const override { return "this"; }
/* See language.h. */
enum macro_expansion macro_expansion () const override
- { return macro_expansion_c; }
+ {
+ return macro_expansion_c;
+ }
/* See language.h. */
const struct lang_varobj_ops *varobj_ops () const override
- { return &cplus_varobj_ops; }
+ {
+ return &cplus_varobj_ops;
+ }
protected:
/* See language.h. */
- symbol_name_matcher_ftype *get_symbol_name_matcher_inner
- (const lookup_name_info &lookup_name) const override
+ symbol_name_matcher_ftype *get_symbol_name_matcher_inner (
+ const lookup_name_info &lookup_name) const override
{
return cp_get_symbol_name_matcher (lookup_name);
}
@@ -1059,26 +1032,25 @@ static cplus_language cplus_language_defn;
class asm_language : public language_defn
{
public:
+
asm_language ()
: language_defn (language_asm)
- { /* Nothing. */ }
+ { /* Nothing. */
+ }
/* See language.h. */
- const char *name () const override
- { return "asm"; }
+ const char *name () const override { return "asm"; }
/* See language.h. */
- const char *natural_name () const override
- { return "Assembly"; }
+ const char *natural_name () const override { return "Assembly"; }
/* See language.h. */
const std::vector<const char *> &filename_extensions () const override
{
- static const std::vector<const char *> extensions
- = { ".s", ".sx", ".S" };
+ static const std::vector<const char *> extensions = { ".s", ".sx", ".S" };
return extensions;
}
@@ -1093,10 +1065,7 @@ public:
/* See language.h. */
- bool can_print_type_offsets () const override
- {
- return true;
- }
+ bool can_print_type_offsets () const override { return true; }
/* See language.h. */
@@ -1109,13 +1078,14 @@ public:
/* See language.h. */
- bool store_sym_names_in_linkage_form_p () const override
- { return true; }
+ bool store_sym_names_in_linkage_form_p () const override { return true; }
/* See language.h. */
enum macro_expansion macro_expansion () const override
- { return macro_expansion_c; }
+ {
+ return macro_expansion_c;
+ }
};
/* The single instance of the ASM language class. */
@@ -1129,19 +1099,19 @@ static asm_language asm_language_defn;
class minimal_language : public language_defn
{
public:
+
minimal_language ()
: language_defn (language_minimal)
- { /* Nothing. */ }
+ { /* Nothing. */
+ }
/* See language.h. */
- const char *name () const override
- { return "minimal"; }
+ const char *name () const override { return "minimal"; }
/* See language.h. */
- const char *natural_name () const override
- { return "Minimal"; }
+ const char *natural_name () const override { return "Minimal"; }
/* See language.h. */
void language_arch_info (struct gdbarch *gdbarch,
@@ -1152,10 +1122,7 @@ public:
/* See language.h. */
- bool can_print_type_offsets () const override
- {
- return true;
- }
+ bool can_print_type_offsets () const override { return true; }
/* See language.h. */
@@ -1168,13 +1135,14 @@ public:
/* See language.h. */
- bool store_sym_names_in_linkage_form_p () const override
- { return true; }
+ bool store_sym_names_in_linkage_form_p () const override { return true; }
/* See language.h. */
enum macro_expansion macro_expansion () const override
- { return macro_expansion_c; }
+ {
+ return macro_expansion_c;
+ }
};
/* The single instance of the minimal language class. */
diff --git a/gdb/c-lang.h b/gdb/c-lang.h
index 1d6b90cca19..77ab980666b 100644
--- a/gdb/c-lang.h
+++ b/gdb/c-lang.h
@@ -17,8 +17,7 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
-
-#if !defined (C_LANG_H)
+#if !defined(C_LANG_H)
#define C_LANG_H 1
struct ui_file;
@@ -32,31 +31,30 @@ struct compile_instance;
#include "macroexp.h"
#include "gdbsupport/enum-flags.h"
-
/* The various kinds of C string and character. Note that these
values are chosen so that they may be or'd together in certain
ways. */
enum c_string_type_values : unsigned
- {
- /* An ordinary string: "value". */
- C_STRING = 0,
- /* A wide string: L"value". */
- C_WIDE_STRING = 1,
- /* A 16-bit Unicode string: u"value". */
- C_STRING_16 = 2,
- /* A 32-bit Unicode string: U"value". */
- C_STRING_32 = 3,
- /* An ordinary char: 'v'. This can also be or'd with one of the
+{
+ /* An ordinary string: "value". */
+ C_STRING = 0,
+ /* A wide string: L"value". */
+ C_WIDE_STRING = 1,
+ /* A 16-bit Unicode string: u"value". */
+ C_STRING_16 = 2,
+ /* A 32-bit Unicode string: U"value". */
+ C_STRING_32 = 3,
+ /* An ordinary char: 'v'. This can also be or'd with one of the
above to form the corresponding CHAR value from a STRING
value. */
- C_CHAR = 4,
- /* A wide char: L'v'. */
- C_WIDE_CHAR = 5,
- /* A 16-bit Unicode char: u'v'. */
- C_CHAR_16 = 6,
- /* A 32-bit Unicode char: U'v'. */
- C_CHAR_32 = 7
- };
+ C_CHAR = 4,
+ /* A wide char: L'v'. */
+ C_WIDE_CHAR = 5,
+ /* A 16-bit Unicode char: u'v'. */
+ C_CHAR_16 = 6,
+ /* A 32-bit Unicode char: U'v'. */
+ C_CHAR_32 = 7
+};
DEF_ENUM_FLAGS_TYPE (enum c_string_type_values, c_string_type);
@@ -72,16 +70,12 @@ extern int c_parse_escape (const char **, struct obstack *);
C-like language. The other parameters are like
type_language_defn::print_type's. */
-extern void c_print_type (struct type *type,
- const char *varstring,
- struct ui_file *stream,
- int show, int level,
+extern void c_print_type (struct type *type, const char *varstring,
+ struct ui_file *stream, int show, int level,
enum language language,
const struct type_print_options *flags);
-extern void c_print_typedef (struct type *,
- struct symbol *,
- struct ui_file *);
+extern void c_print_typedef (struct type *, struct symbol *, struct ui_file *);
/* Implement la_value_print_inner for the C family of languages. */
@@ -100,16 +94,15 @@ extern void c_language_arch_info (struct gdbarch *gdbarch,
/* These are in c-typeprint.c: */
-extern void c_type_print_base (struct type *, struct ui_file *,
- int, int, const struct type_print_options *);
+extern void c_type_print_base (struct type *, struct ui_file *, int, int,
+ const struct type_print_options *);
/* These are in cp-valprint.c */
extern void cp_print_class_member (const gdb_byte *, struct type *,
struct ui_file *, const char *);
-extern void cp_print_value_fields (struct value *,
- struct ui_file *, int,
+extern void cp_print_value_fields (struct value *, struct ui_file *, int,
const struct value_print_options *,
struct type **, int);
diff --git a/gdb/c-typeprint.c b/gdb/c-typeprint.c
index dca96231117..93b3f1b3d13 100644
--- a/gdb/c-typeprint.c
+++ b/gdb/c-typeprint.c
@@ -18,7 +18,7 @@
#include "defs.h"
#include "gdbsupport/gdb_obstack.h"
-#include "bfd.h" /* Binary File Description. */
+#include "bfd.h" /* Binary File Description. */
#include "symtab.h"
#include "gdbtypes.h"
#include "expression.h"
@@ -44,27 +44,22 @@ enum access_specifier
};
static void c_type_print_varspec_suffix (struct type *, struct ui_file *, int,
- int, int,
- enum language,
+ int, int, enum language,
const struct type_print_options *);
-static void c_type_print_varspec_prefix (struct type *,
- struct ui_file *,
- int, int, int,
- enum language,
+static void c_type_print_varspec_prefix (struct type *, struct ui_file *, int,
+ int, int, enum language,
const struct type_print_options *,
struct print_offset_data *);
/* Print "const", "volatile", or address space modifiers. */
-static void c_type_print_modifier (struct type *,
- struct ui_file *,
- int, int, enum language);
+static void c_type_print_modifier (struct type *, struct ui_file *, int, int,
+ enum language);
static void c_type_print_base_1 (struct type *type, struct ui_file *stream,
int show, int level, enum language language,
const struct type_print_options *flags,
struct print_offset_data *podata);
-
/* A callback function for cp_canonicalize_string_full that uses
typedef_hash_table::find_typedef. */
@@ -72,8 +67,8 @@ static void c_type_print_base_1 (struct type *type, struct ui_file *stream,
static const char *
find_typedef_for_canonicalize (struct type *t, void *data)
{
- return typedef_hash_table::find_typedef
- ((const struct type_print_options *) data, t);
+ return typedef_hash_table::find_typedef (
+ (const struct type_print_options *) data, t);
}
/* Print NAME on STREAM. If the 'raw' field of FLAGS is not set,
@@ -87,24 +82,18 @@ print_name_maybe_canonical (const char *name,
gdb::unique_xmalloc_ptr<char> s;
if (!flags->raw)
- s = cp_canonicalize_string_full (name,
- find_typedef_for_canonicalize,
+ s = cp_canonicalize_string_full (name, find_typedef_for_canonicalize,
(void *) flags);
gdb_puts (s != nullptr ? s.get () : name, stream);
}
-
-
/* Helper function for c_print_type. */
static void
-c_print_type_1 (struct type *type,
- const char *varstring,
- struct ui_file *stream,
- int show, int level,
- enum language language,
- const struct type_print_options *flags,
+c_print_type_1 (struct type *type, const char *varstring,
+ struct ui_file *stream, int show, int level,
+ enum language language, const struct type_print_options *flags,
struct print_offset_data *podata)
{
enum type_code code;
@@ -133,10 +122,8 @@ c_print_type_1 (struct type *type,
|| ((show > 0 || type->name () == 0)
&& (code == TYPE_CODE_PTR || code == TYPE_CODE_FUNC
|| code == TYPE_CODE_METHOD
- || (code == TYPE_CODE_ARRAY
- && !type->is_vector ())
- || code == TYPE_CODE_MEMBERPTR
- || code == TYPE_CODE_METHODPTR
+ || (code == TYPE_CODE_ARRAY && !type->is_vector ())
+ || code == TYPE_CODE_MEMBERPTR || code == TYPE_CODE_METHODPTR
|| TYPE_IS_REFERENCE (type))))
gdb_puts (" ", stream);
need_post_space = (varstring != NULL && strcmp (varstring, "") != 0);
@@ -156,8 +143,7 @@ c_print_type_1 (struct type *type,
if (local_name == NULL)
{
demangled_args = strchr (varstring, '(') != NULL;
- c_type_print_varspec_suffix (type, stream, show,
- 0, demangled_args,
+ c_type_print_varspec_suffix (type, stream, show, 0, demangled_args,
language, flags);
}
}
@@ -166,11 +152,8 @@ c_print_type_1 (struct type *type,
/* See c-lang.h. */
void
-c_print_type (struct type *type,
- const char *varstring,
- struct ui_file *stream,
- int show, int level,
- enum language language,
+c_print_type (struct type *type, const char *varstring, struct ui_file *stream,
+ int show, int level, enum language language,
const struct type_print_options *flags)
{
struct print_offset_data podata (flags);
@@ -184,16 +167,15 @@ c_print_type (struct type *type,
which to print. */
void
-c_print_typedef (struct type *type,
- struct symbol *new_symbol,
+c_print_typedef (struct type *type, struct symbol *new_symbol,
struct ui_file *stream)
{
type = check_typedef (type);
gdb_printf (stream, "typedef ");
type_print (type, "", stream, -1);
if ((new_symbol->type ())->name () == 0
- || strcmp ((new_symbol->type ())->name (),
- new_symbol->linkage_name ()) != 0
+ || strcmp ((new_symbol->type ())->name (), new_symbol->linkage_name ())
+ != 0
|| new_symbol->type ()->code () == TYPE_CODE_TYPEDEF)
gdb_printf (stream, " %s", new_symbol->print_name ());
gdb_printf (stream, ";");
@@ -225,8 +207,7 @@ c_print_typedef (struct type *type,
possible to the form that they appear in the source code. */
static void
-cp_type_print_derivation_info (struct ui_file *stream,
- struct type *type,
+cp_type_print_derivation_info (struct ui_file *stream, struct type *type,
const struct type_print_options *flags)
{
const char *name;
@@ -238,8 +219,9 @@ cp_type_print_derivation_info (struct ui_file *stream,
gdb_puts (i == 0 ? ": " : ", ", stream);
gdb_printf (stream, "%s%s ",
BASETYPE_VIA_PUBLIC (type, i)
- ? "public" : (TYPE_FIELD_PROTECTED (type, i)
- ? "protected" : "private"),
+ ? "public"
+ : (TYPE_FIELD_PROTECTED (type, i) ? "protected"
+ : "private"),
BASETYPE_VIA_VIRTUAL (type, i) ? " virtual" : "");
name = TYPE_BASECLASS (type, i)->name ();
if (name)
@@ -258,8 +240,7 @@ cp_type_print_derivation_info (struct ui_file *stream,
static void
cp_type_print_method_args (struct type *mtype, const char *prefix,
const char *varstring, int staticp,
- struct ui_file *stream,
- enum language language,
+ struct ui_file *stream, enum language language,
const struct type_print_options *flags)
{
struct field *args = mtype->fields ();
@@ -267,10 +248,8 @@ cp_type_print_method_args (struct type *mtype, const char *prefix,
int varargs = mtype->has_varargs ();
int i;
- fprintf_symbol (stream, prefix,
- language_cplus, DMGL_ANSI);
- fprintf_symbol (stream, varstring,
- language_cplus, DMGL_ANSI);
+ fprintf_symbol (stream, prefix, language_cplus, DMGL_ANSI);
+ fprintf_symbol (stream, varstring, language_cplus, DMGL_ANSI);
gdb_puts ("(", stream);
int printed_args = 0;
@@ -331,16 +310,14 @@ cp_type_print_method_args (struct type *mtype, const char *prefix,
gdb_printf (stream, " volatile");
if (TYPE_RESTRICT (domain))
- gdb_printf (stream, (language == language_cplus
- ? " __restrict__"
- : " restrict"));
+ gdb_printf (stream, (language == language_cplus ? " __restrict__"
+ : " restrict"));
if (TYPE_ATOMIC (domain))
gdb_printf (stream, " _Atomic");
}
}
-
/* Print any asterisks or open-parentheses needed before the
variable name (to describe its type).
@@ -354,10 +331,8 @@ cp_type_print_method_args (struct type *mtype, const char *prefix,
name. */
static void
-c_type_print_varspec_prefix (struct type *type,
- struct ui_file *stream,
- int show, int passed_a_ptr,
- int need_post_space,
+c_type_print_varspec_prefix (struct type *type, struct ui_file *stream,
+ int show, int passed_a_ptr, int need_post_space,
enum language language,
const struct type_print_options *flags,
struct print_offset_data *podata)
@@ -375,71 +350,63 @@ c_type_print_varspec_prefix (struct type *type,
switch (type->code ())
{
case TYPE_CODE_PTR:
- c_type_print_varspec_prefix (type->target_type (),
- stream, show, 1, 1, language, flags,
- podata);
+ c_type_print_varspec_prefix (type->target_type (), stream, show, 1, 1,
+ language, flags, podata);
gdb_printf (stream, "*");
c_type_print_modifier (type, stream, 1, need_post_space, language);
break;
case TYPE_CODE_MEMBERPTR:
- c_type_print_varspec_prefix (type->target_type (),
- stream, show, 0, 0, language, flags, podata);
+ c_type_print_varspec_prefix (type->target_type (), stream, show, 0, 0,
+ language, flags, podata);
name = TYPE_SELF_TYPE (type)->name ();
if (name)
print_name_maybe_canonical (name, flags, stream);
else
- c_type_print_base_1 (TYPE_SELF_TYPE (type),
- stream, -1, passed_a_ptr, language, flags,
- podata);
+ c_type_print_base_1 (TYPE_SELF_TYPE (type), stream, -1, passed_a_ptr,
+ language, flags, podata);
gdb_printf (stream, "::*");
break;
case TYPE_CODE_METHODPTR:
- c_type_print_varspec_prefix (type->target_type (),
- stream, show, 0, 0, language, flags,
- podata);
+ c_type_print_varspec_prefix (type->target_type (), stream, show, 0, 0,
+ language, flags, podata);
gdb_printf (stream, "(");
name = TYPE_SELF_TYPE (type)->name ();
if (name)
print_name_maybe_canonical (name, flags, stream);
else
- c_type_print_base_1 (TYPE_SELF_TYPE (type),
- stream, -1, passed_a_ptr, language, flags,
- podata);
+ c_type_print_base_1 (TYPE_SELF_TYPE (type), stream, -1, passed_a_ptr,
+ language, flags, podata);
gdb_printf (stream, "::*");
break;
case TYPE_CODE_REF:
case TYPE_CODE_RVALUE_REF:
- c_type_print_varspec_prefix (type->target_type (),
- stream, show, 1, 0, language, flags,
- podata);
+ c_type_print_varspec_prefix (type->target_type (), stream, show, 1, 0,
+ language, flags, podata);
gdb_printf (stream, type->code () == TYPE_CODE_REF ? "&" : "&&");
c_type_print_modifier (type, stream, 1, need_post_space, language);
break;
case TYPE_CODE_METHOD:
case TYPE_CODE_FUNC:
- c_type_print_varspec_prefix (type->target_type (),
- stream, show, 0, 0, language, flags,
- podata);
+ c_type_print_varspec_prefix (type->target_type (), stream, show, 0, 0,
+ language, flags, podata);
if (passed_a_ptr)
gdb_printf (stream, "(");
break;
case TYPE_CODE_ARRAY:
- c_type_print_varspec_prefix (type->target_type (),
- stream, show, 0, need_post_space,
- language, flags, podata);
+ c_type_print_varspec_prefix (type->target_type (), stream, show, 0,
+ need_post_space, language, flags, podata);
if (passed_a_ptr)
gdb_printf (stream, "(");
break;
case TYPE_CODE_TYPEDEF:
- c_type_print_varspec_prefix (type->target_type (),
- stream, show, passed_a_ptr, 0,
- language, flags, podata);
+ c_type_print_varspec_prefix (type->target_type (), stream, show,
+ passed_a_ptr, 0, language, flags, podata);
break;
case TYPE_CODE_UNDEF:
@@ -464,7 +431,7 @@ c_type_print_varspec_prefix (struct type *type,
gcc -Wall will reveal any types that haven't been handled. */
break;
default:
- error (_("type not handled in c_type_print_varspec_prefix()"));
+ error (_ ("type not handled in c_type_print_varspec_prefix()"));
break;
}
}
@@ -507,9 +474,8 @@ c_type_print_modifier (struct type *type, struct ui_file *stream,
{
if (did_print_modifier || need_pre_space)
gdb_printf (stream, " ");
- gdb_printf (stream, (language == language_cplus
- ? "__restrict__"
- : "restrict"));
+ gdb_printf (stream,
+ (language == language_cplus ? "__restrict__" : "restrict"));
did_print_modifier = 1;
}
@@ -536,7 +502,6 @@ c_type_print_modifier (struct type *type, struct ui_file *stream,
gdb_printf (stream, " ");
}
-
/* Print out the arguments of TYPE, which should have TYPE_CODE_METHOD
or TYPE_CODE_FUNC, to STREAM. Artificial arguments, such as "this"
in non-static methods, are displayed if LINKAGE_NAME is zero. If
@@ -547,8 +512,8 @@ c_type_print_modifier (struct type *type, struct ui_file *stream,
evil since this code is used by the C and C++. */
void
-c_type_print_args (struct type *type, struct ui_file *stream,
- int linkage_name, enum language language,
+c_type_print_args (struct type *type, struct ui_file *stream, int linkage_name,
+ enum language language,
const struct type_print_options *flags)
{
int i;
@@ -624,14 +589,13 @@ is_type_conversion_operator (struct type *type, int i, int j)
return 0;
name += 8;
- if (! strchr (" \t\f\n\r", *name))
+ if (!strchr (" \t\f\n\r", *name))
return 0;
while (strchr (" \t\f\n\r", *name))
name++;
- if (!('a' <= *name && *name <= 'z')
- && !('A' <= *name && *name <= 'Z')
+ if (!('a' <= *name && *name <= 'z') && !('A' <= *name && *name <= 'Z')
&& *name != '_')
/* If this doesn't look like the start of an identifier, then it
isn't a type conversion operator. */
@@ -646,10 +610,8 @@ is_type_conversion_operator (struct type *type, int i, int j)
return 1;
/* Is that really the end of the name? */
- if (('a' <= *name && *name <= 'z')
- || ('A' <= *name && *name <= 'Z')
- || ('0' <= *name && *name <= '9')
- || *name == '_')
+ if (('a' <= *name && *name <= 'z') || ('A' <= *name && *name <= 'Z')
+ || ('0' <= *name && *name <= '9') || *name == '_')
/* No, so the identifier following "operator" must be a type name,
and this is a type conversion operator. */
return 1;
@@ -671,13 +633,13 @@ is_type_conversion_operator (struct type *type, int i, int j)
static const char *
remove_qualifiers (const char *qid)
{
- int quoted = 0; /* Zero if we're not in quotes;
+ int quoted = 0; /* Zero if we're not in quotes;
'"' if we're in a double-quoted string;
'\'' if we're in a single-quoted string. */
- int depth = 0; /* Number of unclosed parens we've seen. */
+ int depth = 0; /* Number of unclosed parens we've seen. */
char *parenstack = (char *) alloca (strlen (qid));
const char *scan;
- const char *last = 0; /* The character after the rightmost
+ const char *last = 0; /* The character after the rightmost
`::' token we've seen so far. */
for (scan = qid; *scan; scan++)
@@ -748,10 +710,8 @@ remove_qualifiers (const char *qid)
Args work like c_type_print_varspec_prefix. */
static void
-c_type_print_varspec_suffix (struct type *type,
- struct ui_file *stream,
- int show, int passed_a_ptr,
- int demangled_args,
+c_type_print_varspec_suffix (struct type *type, struct ui_file *stream,
+ int show, int passed_a_ptr, int demangled_args,
enum language language,
const struct type_print_options *flags)
{
@@ -773,38 +733,37 @@ c_type_print_varspec_suffix (struct type *type,
if (passed_a_ptr)
gdb_printf (stream, ")");
- gdb_printf (stream, (is_vector ?
- " __attribute__ ((vector_size(" : "["));
+ gdb_printf (stream,
+ (is_vector ? " __attribute__ ((vector_size(" : "["));
/* Bounds are not yet resolved, print a bounds placeholder instead. */
if (type->bounds ()->high.kind () == PROP_LOCEXPR
|| type->bounds ()->high.kind () == PROP_LOCLIST)
gdb_printf (stream, "variable length");
else if (get_array_bounds (type, &low_bound, &high_bound))
- gdb_printf (stream, "%s",
- plongest (high_bound - low_bound + 1));
+ gdb_printf (stream, "%s", plongest (high_bound - low_bound + 1));
gdb_printf (stream, (is_vector ? ")))" : "]"));
- c_type_print_varspec_suffix (type->target_type (), stream,
- show, 0, 0, language, flags);
+ c_type_print_varspec_suffix (type->target_type (), stream, show, 0, 0,
+ language, flags);
}
break;
case TYPE_CODE_MEMBERPTR:
- c_type_print_varspec_suffix (type->target_type (), stream,
- show, 0, 0, language, flags);
+ c_type_print_varspec_suffix (type->target_type (), stream, show, 0, 0,
+ language, flags);
break;
case TYPE_CODE_METHODPTR:
gdb_printf (stream, ")");
- c_type_print_varspec_suffix (type->target_type (), stream,
- show, 0, 0, language, flags);
+ c_type_print_varspec_suffix (type->target_type (), stream, show, 0, 0,
+ language, flags);
break;
case TYPE_CODE_PTR:
case TYPE_CODE_REF:
case TYPE_CODE_RVALUE_REF:
- c_type_print_varspec_suffix (type->target_type (), stream,
- show, 1, 0, language, flags);
+ c_type_print_varspec_suffix (type->target_type (), stream, show, 1, 0,
+ language, flags);
break;
case TYPE_CODE_METHOD:
@@ -813,13 +772,13 @@ c_type_print_varspec_suffix (struct type *type,
gdb_printf (stream, ")");
if (!demangled_args)
c_type_print_args (type, stream, 0, language, flags);
- c_type_print_varspec_suffix (type->target_type (), stream,
- show, passed_a_ptr, 0, language, flags);
+ c_type_print_varspec_suffix (type->target_type (), stream, show,
+ passed_a_ptr, 0, language, flags);
break;
case TYPE_CODE_TYPEDEF:
- c_type_print_varspec_suffix (type->target_type (), stream,
- show, passed_a_ptr, 0, language, flags);
+ c_type_print_varspec_suffix (type->target_type (), stream, show,
+ passed_a_ptr, 0, language, flags);
break;
case TYPE_CODE_UNDEF:
@@ -845,7 +804,7 @@ c_type_print_varspec_suffix (struct type *type,
considered. */
break;
default:
- error (_("type not handled in c_type_print_varspec_suffix()"));
+ error (_ ("type not handled in c_type_print_varspec_suffix()"));
break;
}
}
@@ -883,7 +842,7 @@ c_type_print_template_args (const struct type_print_options *flags,
if (first)
{
stream->wrap_here (4);
- gdb_printf (stream, _("[with %s = "), sym->linkage_name ());
+ gdb_printf (stream, _ ("[with %s = "), sym->linkage_name ());
first = 0;
}
else
@@ -897,7 +856,7 @@ c_type_print_template_args (const struct type_print_options *flags,
}
if (!first)
- gdb_puts (_("] "), stream);
+ gdb_puts (_ ("] "), stream);
}
/* Use 'print_spaces', but take into consideration the
@@ -905,8 +864,8 @@ c_type_print_template_args (const struct type_print_options *flags,
will be printed. */
static void
-print_spaces_filtered_with_print_options
- (int level, struct ui_file *stream, const struct type_print_options *flags)
+print_spaces_filtered_with_print_options (
+ int level, struct ui_file *stream, const struct type_print_options *flags)
{
if (!flags->print_offsets)
print_spaces (level, stream);
@@ -919,8 +878,8 @@ print_spaces_filtered_with_print_options
static enum access_specifier
output_access_specifier (struct ui_file *stream,
- enum access_specifier last_access,
- int level, bool is_protected, bool is_private,
+ enum access_specifier last_access, int level,
+ bool is_protected, bool is_private,
const struct type_print_options *flags)
{
if (is_protected)
@@ -969,8 +928,7 @@ need_access_label_p (struct type *type)
QUIT;
for (int j = 0; j < TYPE_NFN_FIELDS (type); j++)
for (int i = 0; i < TYPE_FN_FIELDLIST_LENGTH (type, j); i++)
- if (!TYPE_FN_FIELD_PRIVATE (TYPE_FN_FIELDLIST1 (type,
- j), i))
+ if (!TYPE_FN_FIELD_PRIVATE (TYPE_FN_FIELDLIST1 (type, j), i))
return true;
QUIT;
for (int i = 0; i < TYPE_TYPEDEF_FIELD_COUNT (type); ++i)
@@ -988,11 +946,8 @@ need_access_label_p (struct type *type)
{
QUIT;
for (int i = 0; i < TYPE_FN_FIELDLIST_LENGTH (type, j); i++)
- if (TYPE_FN_FIELD_PROTECTED (TYPE_FN_FIELDLIST1 (type,
- j), i)
- || TYPE_FN_FIELD_PRIVATE (TYPE_FN_FIELDLIST1 (type,
- j),
- i))
+ if (TYPE_FN_FIELD_PROTECTED (TYPE_FN_FIELDLIST1 (type, j), i)
+ || TYPE_FN_FIELD_PRIVATE (TYPE_FN_FIELDLIST1 (type, j), i))
return true;
}
QUIT;
@@ -1010,10 +965,8 @@ need_access_label_p (struct type *type)
applicable. */
static void
-c_print_type_no_offsets (struct type *type,
- const char *varstring,
- struct ui_file *stream,
- int show, int level,
+c_print_type_no_offsets (struct type *type, const char *varstring,
+ struct ui_file *stream, int show, int level,
enum language language,
struct type_print_options *flags,
struct print_offset_data *podata)
@@ -1033,8 +986,7 @@ c_print_type_no_offsets (struct type *type,
static void
c_type_print_base_struct_union (struct type *type, struct ui_file *stream,
- int show, int level,
- enum language language,
+ int show, int level, enum language language,
const struct type_print_options *flags,
struct print_offset_data *podata)
{
@@ -1065,8 +1017,7 @@ c_type_print_base_struct_union (struct type *type, struct ui_file *stream,
spurious "{unnamed struct}"/"{unnamed union}"/"{unnamed
enum}" tag for unnamed struct/union/enum's, which we don't
want to print. */
- if (type->name () != NULL
- && !startswith (type->name (), "{unnamed"))
+ if (type->name () != NULL && !startswith (type->name (), "{unnamed"))
{
/* When printing the tag name, we are still effectively
printing in the outer context, hence the use of FLAGS
@@ -1118,10 +1069,10 @@ c_type_print_base_struct_union (struct type *type, struct ui_file *stream,
{
print_spaces_filtered_with_print_options (level + 4, stream, flags);
if (type->is_stub ())
- gdb_printf (stream, _("%p[<incomplete type>%p]\n"),
+ gdb_printf (stream, _ ("%p[<incomplete type>%p]\n"),
metadata_style.style ().ptr (), nullptr);
else
- gdb_printf (stream, _("%p[<no data fields>%p]\n"),
+ gdb_printf (stream, _ ("%p[<no data fields>%p]\n"),
metadata_style.style ().ptr (), nullptr);
}
@@ -1158,10 +1109,11 @@ c_type_print_base_struct_union (struct type *type, struct ui_file *stream,
if (need_access_label)
{
- section_type = output_access_specifier
- (stream, section_type, level,
- TYPE_FIELD_PROTECTED (type, i),
- TYPE_FIELD_PRIVATE (type, i), flags);
+ section_type
+ = output_access_specifier (stream, section_type, level,
+ TYPE_FIELD_PROTECTED (type, i),
+ TYPE_FIELD_PRIVATE (type, i),
+ flags);
}
bool is_static = field_is_static (&type->field (i));
@@ -1200,10 +1152,9 @@ c_type_print_base_struct_union (struct type *type, struct ui_file *stream,
- type->field (i).type ()->length () * TARGET_CHAR_BIT;
}
- c_print_type_1 (type->field (i).type (),
- type->field (i).name (),
- stream, newshow, level + 4,
- language, &local_flags, &local_podata);
+ c_print_type_1 (type->field (i).type (), type->field (i).name (),
+ stream, newshow, level + 4, language, &local_flags,
+ &local_podata);
if (!is_static && TYPE_FIELD_PACKED (type, i))
{
@@ -1212,8 +1163,7 @@ c_type_print_base_struct_union (struct type *type, struct ui_file *stream,
unnamed fields. This would lead to misleading
results if the compiler does not put out fields
for such things (I don't know what it does). */
- gdb_printf (stream, " : %d",
- TYPE_FIELD_BITSIZE (type, i));
+ gdb_printf (stream, " : %d", TYPE_FIELD_BITSIZE (type, i));
}
gdb_printf (stream, ";\n");
}
@@ -1245,29 +1195,28 @@ c_type_print_base_struct_union (struct type *type, struct ui_file *stream,
int j, len2 = TYPE_FN_FIELDLIST_LENGTH (type, i);
const char *method_name = TYPE_FN_FIELDLIST_NAME (type, i);
const char *name = type->name ();
- int is_constructor = name && strcmp (method_name,
- name) == 0;
+ int is_constructor = name && strcmp (method_name, name) == 0;
for (j = 0; j < len2; j++)
{
const char *mangled_name;
gdb::unique_xmalloc_ptr<char> mangled_name_holder;
const char *physname = TYPE_FN_FIELD_PHYSNAME (f, j);
- int is_full_physname_constructor =
- TYPE_FN_FIELD_CONSTRUCTOR (f, j)
- || is_constructor_name (physname)
- || is_destructor_name (physname)
- || method_name[0] == '~';
+ int is_full_physname_constructor
+ = TYPE_FN_FIELD_CONSTRUCTOR (f, j)
+ || is_constructor_name (physname)
+ || is_destructor_name (physname) || method_name[0] == '~';
/* Do not print out artificial methods. */
if (TYPE_FN_FIELD_ARTIFICIAL (f, j))
continue;
QUIT;
- section_type = output_access_specifier
- (stream, section_type, level,
- TYPE_FN_FIELD_PROTECTED (f, j),
- TYPE_FN_FIELD_PRIVATE (f, j), flags);
+ section_type
+ = output_access_specifier (stream, section_type, level,
+ TYPE_FN_FIELD_PROTECTED (f, j),
+ TYPE_FN_FIELD_PRIVATE (f, j),
+ flags);
print_spaces_filtered_with_print_options (level + 4, stream,
flags);
@@ -1278,21 +1227,20 @@ c_type_print_base_struct_union (struct type *type, struct ui_file *stream,
if (TYPE_FN_FIELD_TYPE (f, j)->target_type () == 0)
{
/* Keep GDB from crashing here. */
- gdb_printf (stream,
- _("%p[<undefined type>%p] %s;\n"),
+ gdb_printf (stream, _ ("%p[<undefined type>%p] %s;\n"),
metadata_style.style ().ptr (), nullptr,
TYPE_FN_FIELD_PHYSNAME (f, j));
break;
}
- else if (!is_constructor /* Constructors don't
+ else if (!is_constructor /* Constructors don't
have declared
types. */
- && !is_full_physname_constructor /* " " */
+ && !is_full_physname_constructor /* " " */
&& !is_type_conversion_operator (type, i, j))
{
- c_print_type_no_offsets
- (TYPE_FN_FIELD_TYPE (f, j)->target_type (),
- "", stream, -1, 0, language, &local_flags, podata);
+ c_print_type_no_offsets (
+ TYPE_FN_FIELD_TYPE (f, j)->target_type (), "", stream, -1,
+ 0, language, &local_flags, podata);
gdb_puts (" ", stream);
}
@@ -1306,8 +1254,7 @@ c_type_print_base_struct_union (struct type *type, struct ui_file *stream,
mangled_name = TYPE_FN_FIELD_PHYSNAME (f, j);
gdb::unique_xmalloc_ptr<char> demangled_name
- = gdb_demangle (mangled_name,
- DMGL_ANSI | DMGL_PARAMS);
+ = gdb_demangle (mangled_name, DMGL_ANSI | DMGL_PARAMS);
if (demangled_name == NULL)
{
/* In some cases (for instance with the HP
@@ -1320,16 +1267,13 @@ c_type_print_base_struct_union (struct type *type, struct ui_file *stream,
int staticp = TYPE_FN_FIELD_STATIC_P (f, j);
struct type *mtype = TYPE_FN_FIELD_TYPE (f, j);
- cp_type_print_method_args (mtype,
- "",
- method_name,
- staticp,
- stream, language,
+ cp_type_print_method_args (mtype, "", method_name,
+ staticp, stream, language,
&local_flags);
}
else
fprintf_styled (stream, metadata_style.style (),
- _("<badly mangled name '%s'>"),
+ _ ("<badly mangled name '%s'>"),
mangled_name);
}
else
@@ -1371,8 +1315,8 @@ c_type_print_base_struct_union (struct type *type, struct ui_file *stream,
print_spaces_filtered_with_print_options (level + 4, stream,
flags);
c_print_type_no_offsets (TYPE_NESTED_TYPES_FIELD_TYPE (type, i),
- "", stream, show, level + 4,
- language, &semi_local_flags, podata);
+ "", stream, show, level + 4, language,
+ &semi_local_flags, podata);
gdb_printf (stream, ";\n");
}
}
@@ -1395,10 +1339,10 @@ c_type_print_base_struct_union (struct type *type, struct ui_file *stream,
if (need_access_label)
{
- section_type = output_access_specifier
- (stream, section_type, level,
- TYPE_TYPEDEF_FIELD_PROTECTED (type, i),
- TYPE_TYPEDEF_FIELD_PRIVATE (type, i), flags);
+ section_type = output_access_specifier (
+ stream, section_type, level,
+ TYPE_TYPEDEF_FIELD_PROTECTED (type, i),
+ TYPE_TYPEDEF_FIELD_PRIVATE (type, i), flags);
}
print_spaces_filtered_with_print_options (level + 4, stream,
flags);
@@ -1409,8 +1353,8 @@ c_type_print_base_struct_union (struct type *type, struct ui_file *stream,
typedefs but not local typedefs. */
c_print_type_no_offsets (target,
TYPE_TYPEDEF_FIELD_NAME (type, i),
- stream, show - 1, level + 4,
- language, &semi_local_flags, podata);
+ stream, show - 1, level + 4, language,
+ &semi_local_flags, podata);
gdb_printf (stream, ";\n");
}
}
@@ -1448,9 +1392,8 @@ c_type_print_base_struct_union (struct type *type, struct ui_file *stream,
We increase it for some recursive calls. */
static void
-c_type_print_base_1 (struct type *type, struct ui_file *stream,
- int show, int level,
- enum language language,
+c_type_print_base_1 (struct type *type, struct ui_file *stream, int show,
+ int level, enum language language,
const struct type_print_options *flags,
struct print_offset_data *podata)
{
@@ -1461,15 +1404,14 @@ c_type_print_base_1 (struct type *type, struct ui_file *stream,
if (type == NULL)
{
- fputs_styled (_("<type unknown>"), metadata_style.style (), stream);
+ fputs_styled (_ ("<type unknown>"), metadata_style.style (), stream);
return;
}
/* When SHOW is zero or less, and there is a valid type name, then
always just print the type name directly from the type. */
- if (show <= 0
- && type->name () != NULL)
+ if (show <= 0 && type->name () != NULL)
{
c_type_print_modifier (type, stream, 0, 1, language);
@@ -1508,7 +1450,7 @@ c_type_print_base_1 (struct type *type, struct ui_file *stream,
gdb_assert (type->name () == NULL);
gdb_assert (type->target_type () == NULL);
fprintf_styled (stream, metadata_style.style (),
- _("<unnamed typedef>"));
+ _ ("<unnamed typedef>"));
break;
case TYPE_CODE_FUNC:
@@ -1516,8 +1458,8 @@ c_type_print_base_1 (struct type *type, struct ui_file *stream,
if (type->target_type () == NULL)
type_print_unknown_return_type (stream);
else
- c_type_print_base_1 (type->target_type (),
- stream, show, level, language, flags, podata);
+ c_type_print_base_1 (type->target_type (), stream, show, level,
+ language, flags, podata);
break;
case TYPE_CODE_ARRAY:
case TYPE_CODE_PTR:
@@ -1525,14 +1467,14 @@ c_type_print_base_1 (struct type *type, struct ui_file *stream,
case TYPE_CODE_REF:
case TYPE_CODE_RVALUE_REF:
case TYPE_CODE_METHODPTR:
- c_type_print_base_1 (type->target_type (),
- stream, show, level, language, flags, podata);
+ c_type_print_base_1 (type->target_type (), stream, show, level, language,
+ flags, podata);
break;
case TYPE_CODE_STRUCT:
case TYPE_CODE_UNION:
- c_type_print_base_struct_union (type, stream, show, level,
- language, flags, podata);
+ c_type_print_base_struct_union (type, stream, show, level, language,
+ flags, podata);
break;
case TYPE_CODE_ENUM:
@@ -1545,8 +1487,7 @@ c_type_print_base_1 (struct type *type, struct ui_file *stream,
"{unnamed struct}"/"{unnamed union}"/"{unnamed enum}"
tag for unnamed struct/union/enum's, which we don't
want to print. */
- if (type->name () != NULL
- && !startswith (type->name (), "{unnamed"))
+ if (type->name () != NULL && !startswith (type->name (), "{unnamed"))
{
print_name_maybe_canonical (type->name (), flags, stream);
if (show > 0)
@@ -1619,15 +1560,13 @@ c_type_print_base_1 (struct type *type, struct ui_file *stream,
if (type->num_fields () == 0)
{
if (type->is_stub ())
- gdb_printf (stream,
- _("%*s%p[<incomplete type>%p]\n"),
- level + 4, "",
- metadata_style.style ().ptr (), nullptr);
+ gdb_printf (stream, _ ("%*s%p[<incomplete type>%p]\n"),
+ level + 4, "", metadata_style.style ().ptr (),
+ nullptr);
else
- gdb_printf (stream,
- _("%*s%p[<no data fields>%p]\n"),
- level + 4, "",
- metadata_style.style ().ptr (), nullptr);
+ gdb_printf (stream, _ ("%*s%p[<no data fields>%p]\n"),
+ level + 4, "", metadata_style.style ().ptr (),
+ nullptr);
}
len = type->num_fields ();
for (i = 0; i < len; i++)
@@ -1637,17 +1576,15 @@ c_type_print_base_1 (struct type *type, struct ui_file *stream,
/* We pass "show" here and not "show - 1" to get enum types
printed. There's no other way to see them. */
c_print_type_1 (type->field (i).type (),
- type->field (i).name (),
- stream, show, level + 4,
- language, &local_flags, podata);
+ type->field (i).name (), stream, show,
+ level + 4, language, &local_flags, podata);
gdb_printf (stream, " @%s",
plongest (type->field (i).loc_bitpos ()));
if (TYPE_FIELD_BITSIZE (type, i) > 1)
{
gdb_printf (stream, "-%s",
plongest (type->field (i).loc_bitpos ()
- + TYPE_FIELD_BITSIZE (type, i)
- - 1));
+ + TYPE_FIELD_BITSIZE (type, i) - 1));
}
gdb_printf (stream, ";\n");
}
@@ -1661,7 +1598,7 @@ c_type_print_base_1 (struct type *type, struct ui_file *stream,
break;
case TYPE_CODE_UNDEF:
- gdb_printf (stream, _("struct <unknown>"));
+ gdb_printf (stream, _ ("struct <unknown>"));
break;
case TYPE_CODE_ERROR:
@@ -1670,7 +1607,7 @@ c_type_print_base_1 (struct type *type, struct ui_file *stream,
case TYPE_CODE_RANGE:
/* This should not occur. */
- fprintf_styled (stream, metadata_style.style (), _("<range type>"));
+ fprintf_styled (stream, metadata_style.style (), _ ("<range type>"));
break;
case TYPE_CODE_FIXED_POINT:
@@ -1697,7 +1634,7 @@ c_type_print_base_1 (struct type *type, struct ui_file *stream,
/* At least for dump_symtab, it is important that this not
be an error (). */
fprintf_styled (stream, metadata_style.style (),
- _("<invalid type code %d>"), type->code ());
+ _ ("<invalid type code %d>"), type->code ());
}
break;
}
@@ -1706,9 +1643,8 @@ c_type_print_base_1 (struct type *type, struct ui_file *stream,
/* See c_type_print_base_1. */
void
-c_type_print_base (struct type *type, struct ui_file *stream,
- int show, int level,
- const struct type_print_options *flags)
+c_type_print_base (struct type *type, struct ui_file *stream, int show,
+ int level, const struct type_print_options *flags)
{
struct print_offset_data podata (flags);
diff --git a/gdb/c-valprint.c b/gdb/c-valprint.c
index 69aa91d1ec3..1090b763b68 100644
--- a/gdb/c-valprint.c
+++ b/gdb/c-valprint.c
@@ -28,7 +28,6 @@
#include "cp-abi.h"
#include "target.h"
#include "objfiles.h"
-
/* A helper for c_textual_element_type. This checks the name of the
typedef. This is bogus but it isn't apparent that the compiler
@@ -37,8 +36,7 @@
static int
textual_name (const char *name)
{
- return (!strcmp (name, "wchar_t")
- || !strcmp (name, "char16_t")
+ return (!strcmp (name, "wchar_t") || !strcmp (name, "char16_t")
|| !strcmp (name, "char32_t"));
}
@@ -97,8 +95,7 @@ c_textual_element_type (struct type *type, char format)
{
/* Print this as a string if we can manage it. For now, no wide
character support. */
- if (true_type->code () == TYPE_CODE_INT
- && true_type->length () == 1)
+ if (true_type->code () == TYPE_CODE_INT && true_type->length () == 1)
return 1;
}
else
@@ -106,8 +103,7 @@ c_textual_element_type (struct type *type, char format)
/* If a one-byte TYPE_CODE_INT is missing the not-a-character
flag, then we treat it as text; otherwise, we assume it's
being used as data. */
- if (true_type->code () == TYPE_CODE_INT
- && true_type->length () == 1
+ if (true_type->code () == TYPE_CODE_INT && true_type->length () == 1
&& !TYPE_NOTTEXT (true_type))
return 1;
}
@@ -117,17 +113,8 @@ c_textual_element_type (struct type *type, char format)
/* Decorations for C. */
-static const struct generic_val_print_decorations c_decorations =
-{
- "",
- " + ",
- "i",
- "true",
- "false",
- "void",
- "{",
- "}"
-};
+static const struct generic_val_print_decorations c_decorations
+ = { "", " + ", "i", "true", "false", "void", "{", "}" };
/* Print a pointer based on the type of its target.
@@ -154,8 +141,8 @@ print_unpacked_pointer (struct type *type, struct type *elttype,
}
if (options->symbol_print)
- want_space = print_address_demangle (options, gdbarch, address, stream,
- demangle);
+ want_space
+ = print_address_demangle (options, gdbarch, address, stream, demangle);
else if (options->addressprint)
{
gdb_puts (paddress (gdbarch, address), stream);
@@ -170,18 +157,18 @@ print_unpacked_pointer (struct type *type, struct type *elttype,
{
if (want_space)
gdb_puts (" ", stream);
- val_print_string (unresolved_elttype, NULL, address, -1, stream, options);
+ val_print_string (unresolved_elttype, NULL, address, -1, stream,
+ options);
}
else if (cp_is_vtbl_member (type))
{
/* Print vtbl's nicely. */
CORE_ADDR vt_address = unpack_pointer (type, valaddr + embedded_offset);
- struct bound_minimal_symbol msymbol =
- lookup_minimal_symbol_by_pc (vt_address);
+ struct bound_minimal_symbol msymbol
+ = lookup_minimal_symbol_by_pc (vt_address);
/* If 'symbol_print' is set, we did the work above. */
- if (!options->symbol_print
- && (msymbol.minsym != NULL)
+ if (!options->symbol_print && (msymbol.minsym != NULL)
&& (vt_address == msymbol.value_address ()))
{
if (want_space)
@@ -204,8 +191,8 @@ print_unpacked_pointer (struct type *type, struct type *elttype,
if (msymbol.minsym != NULL)
{
const char *search_name = msymbol.minsym->search_name ();
- wsym = lookup_symbol_search_name (search_name, NULL,
- VAR_DOMAIN).symbol;
+ wsym = lookup_symbol_search_name (search_name, NULL, VAR_DOMAIN)
+ .symbol;
}
if (wsym)
@@ -231,8 +218,7 @@ print_unpacked_pointer (struct type *type, struct type *elttype,
/* c_value_print helper for TYPE_CODE_ARRAY. */
static void
-c_value_print_array (struct value *val,
- struct ui_file *stream, int recurse,
+c_value_print_array (struct value *val, struct ui_file *stream, int recurse,
const struct value_print_options *options)
{
struct type *type = check_typedef (value_type (val));
@@ -248,15 +234,14 @@ c_value_print_array (struct value *val,
enum bfd_endian byte_order = type_byte_order (type);
if (!get_array_bounds (type, &low_bound, &high_bound))
- error (_("Could not determine the array high bound"));
+ error (_ ("Could not determine the array high bound"));
eltlen = elttype->length ();
len = high_bound - low_bound + 1;
/* Print arrays of textual chars with a string syntax, as
long as the entire array is valid. */
- if (c_textual_element_type (unresolved_elttype,
- options->format)
+ if (c_textual_element_type (unresolved_elttype, options->format)
&& value_bytes_available (val, 0, type->length ())
&& !value_bits_any_optimized_out (val, 0,
TARGET_CHAR_BIT * type->length ()))
@@ -271,10 +256,10 @@ c_value_print_array (struct value *val,
unsigned int temp_len;
for (temp_len = 0;
- (temp_len < len
- && temp_len < print_max_chars
+ (temp_len < len && temp_len < print_max_chars
&& extract_unsigned_integer (valaddr + temp_len * eltlen,
- eltlen, byte_order) != 0);
+ eltlen, byte_order)
+ != 0);
++temp_len)
;
@@ -306,8 +291,7 @@ c_value_print_array (struct value *val,
if (cp_is_vtbl_ptr_type (elttype))
{
i = 1;
- gdb_printf (stream, _("%d vtable entries"),
- len - 1);
+ gdb_printf (stream, _ ("%d vtable entries"), len - 1);
}
value_print_array_elements (val, stream, recurse, options, i);
gdb_printf (stream, "}");
@@ -316,8 +300,8 @@ c_value_print_array (struct value *val,
else
{
/* Array of unspecified length: treat like pointer to first elt. */
- print_unpacked_pointer (type, elttype, unresolved_elttype, valaddr,
- 0, address, stream, recurse, options);
+ print_unpacked_pointer (type, elttype, unresolved_elttype, valaddr, 0,
+ address, stream, recurse, options);
}
}
@@ -352,8 +336,8 @@ c_value_print_ptr (struct value *val, struct ui_file *stream, int recurse,
struct type *elttype = check_typedef (unresolved_elttype);
CORE_ADDR addr = unpack_pointer (type, valaddr);
- print_unpacked_pointer (type, elttype, unresolved_elttype, valaddr,
- 0, addr, stream, recurse, options);
+ print_unpacked_pointer (type, elttype, unresolved_elttype, valaddr, 0,
+ addr, stream, recurse, options);
}
}
@@ -394,8 +378,8 @@ c_value_print_int (struct value *val, struct ui_file *stream,
{
struct value_print_options opts = *options;
- opts.format = (options->format ? options->format
- : options->output_format);
+ opts.format
+ = (options->format ? options->format : options->output_format);
value_print_scalar_formatted (val, &opts, 0, stream);
}
else
@@ -467,9 +451,8 @@ c_value_print_inner (struct value *val, struct ui_file *stream, int recurse,
}
}
-
void
-c_value_print (struct value *val, struct ui_file *stream,
+c_value_print (struct value *val, struct ui_file *stream,
const struct value_print_options *options)
{
struct type *type, *real_type;
@@ -499,8 +482,7 @@ c_value_print (struct value *val, struct ui_file *stream,
if (original_type->code () == TYPE_CODE_PTR
&& original_type->name () == NULL
&& original_type->target_type ()->name () != NULL
- && (strcmp (original_type->target_type ()->name (),
- "char") == 0
+ && (strcmp (original_type->target_type ()->name (), "char") == 0
|| textual_name (original_type->target_type ()->name ())))
{
/* Print nothing. */
@@ -522,8 +504,8 @@ c_value_print (struct value *val, struct ui_file *stream,
if (value_entirely_available (val))
{
- real_type = value_rtti_indirect_type (val, &full, &top,
- &using_enc);
+ real_type
+ = value_rtti_indirect_type (val, &full, &top, &using_enc);
if (real_type)
{
/* RTTI entry found. */
@@ -564,8 +546,7 @@ c_value_print (struct value *val, struct ui_file *stream,
if (real_type)
{
/* We have RTTI information, so use it. */
- val = value_full_object (val, real_type,
- full, top, using_enc);
+ val = value_full_object (val, real_type, full, top, using_enc);
/* In a destructor we might see a real type that is a
superclass of the object's type. In this case it is
better to leave the object as-is. */
@@ -573,15 +554,13 @@ c_value_print (struct value *val, struct ui_file *stream,
&& (real_type->length ()
< value_enclosing_type (val)->length ())))
val = value_cast (real_type, val);
- gdb_printf (stream, "(%s%s) ",
- real_type->name (),
- full ? "" : _(" [incomplete object]"));
+ gdb_printf (stream, "(%s%s) ", real_type->name (),
+ full ? "" : _ (" [incomplete object]"));
}
else if (type != check_typedef (value_enclosing_type (val)))
{
/* No RTTI information, so let's do our best. */
- gdb_printf (stream, "(%s ?) ",
- value_enclosing_type (val)->name ());
+ gdb_printf (stream, "(%s ?) ", value_enclosing_type (val)->name ());
val = value_cast (value_enclosing_type (val), val);
}
}
diff --git a/gdb/c-varobj.c b/gdb/c-varobj.c
index a6b3306d22b..588aa11aff5 100644
--- a/gdb/c-varobj.c
+++ b/gdb/c-varobj.c
@@ -24,8 +24,8 @@
static void cplus_class_num_children (struct type *type, int children[3]);
/* The names of varobjs representing anonymous structs or unions. */
-#define ANONYMOUS_STRUCT_NAME _("<anonymous struct>")
-#define ANONYMOUS_UNION_NAME _("<anonymous union>")
+#define ANONYMOUS_STRUCT_NAME _ ("<anonymous struct>")
+#define ANONYMOUS_UNION_NAME _ ("<anonymous union>")
/* Does CHILD represent a child with no name? This happens when
the child is an anonymous struct or union and it has no field name
@@ -62,10 +62,8 @@ varobj_is_anonymous_child (const struct varobj *child)
in this function. */
static void
-adjust_value_for_child_access (struct value **value,
- struct type **type,
- int *was_ptr,
- int lookup_actual_type)
+adjust_value_for_child_access (struct value **value, struct type **type,
+ int *was_ptr, int lookup_actual_type)
{
gdb_assert (type && *type);
@@ -73,7 +71,7 @@ adjust_value_for_child_access (struct value **value,
*was_ptr = 0;
*type = check_typedef (*type);
-
+
/* The type of value stored in varobj, that is passed
to us, is already supposed to be
reference-stripped. */
@@ -91,7 +89,6 @@ adjust_value_for_child_access (struct value **value,
{
if (value && *value)
{
-
try
{
*value = value_ind (*value);
@@ -142,8 +139,7 @@ c_is_path_expr_parent (const struct varobj *var)
type = varobj_get_gdb_type (var);
/* Anonymous unions and structs are also not path_expr parents. */
- if ((type->code () == TYPE_CODE_STRUCT
- || type->code () == TYPE_CODE_UNION)
+ if ((type->code () == TYPE_CODE_STRUCT || type->code () == TYPE_CODE_UNION)
&& type->name () == NULL)
{
const struct varobj *parent = var->parent;
@@ -278,10 +274,10 @@ value_struct_element_index (struct value *value, int type_index)
information cannot be determined, set *CNAME, *CVALUE, or *CTYPE
to empty. */
-static void
-c_describe_child (const struct varobj *parent, int index,
- std::string *cname, struct value **cvalue,
- struct type **ctype, std::string *cfull_expression)
+static void
+c_describe_child (const struct varobj *parent, int index, std::string *cname,
+ struct value **cvalue, struct type **ctype,
+ std::string *cfull_expression)
{
struct value *value = parent->value.get ();
struct type *type = varobj_get_value_type (parent);
@@ -306,13 +302,12 @@ c_describe_child (const struct varobj *parent, int index,
{
case TYPE_CODE_ARRAY:
if (cname)
- *cname = int_string (index + type->bounds ()->low.const_val (),
- 10, 1, 0, 0);
+ *cname = int_string (index + type->bounds ()->low.const_val (), 10, 1,
+ 0, 0);
if (cvalue && value)
{
- int real_index
- = index + type->bounds ()->low.const_val ();
+ int real_index = index + type->bounds ()->low.const_val ();
try
{
@@ -327,10 +322,9 @@ c_describe_child (const struct varobj *parent, int index,
*ctype = get_target_type (type);
if (cfull_expression)
- *cfull_expression = string_printf
- ("(%s)[%s]", parent_expression.c_str (),
- int_string (index + type->bounds ()->low.const_val (),
- 10, 1, 0, 0));
+ *cfull_expression = string_printf (
+ "(%s)[%s]", parent_expression.c_str (),
+ int_string (index + type->bounds ()->low.const_val (), 10, 1, 0, 0));
break;
@@ -346,8 +340,7 @@ c_describe_child (const struct varobj *parent, int index,
{
if (cname)
{
- if (type->field (index).type ()->code ()
- == TYPE_CODE_STRUCT)
+ if (type->field (index).type ()->code () == TYPE_CODE_STRUCT)
*cname = ANONYMOUS_STRUCT_NAME;
else
*cname = ANONYMOUS_UNION_NAME;
@@ -365,9 +358,9 @@ c_describe_child (const struct varobj *parent, int index,
{
const char *join = was_ptr ? "->" : ".";
- *cfull_expression = string_printf ("(%s)%s%s",
- parent_expression.c_str (),
- join, field_name);
+ *cfull_expression
+ = string_printf ("(%s)%s%s", parent_expression.c_str (),
+ join, field_name);
}
}
@@ -406,7 +399,8 @@ c_describe_child (const struct varobj *parent, int index,
*ctype = type->target_type ();
if (cfull_expression)
- *cfull_expression = string_printf ("*(%s)", parent_expression.c_str ());
+ *cfull_expression
+ = string_printf ("*(%s)", parent_expression.c_str ());
break;
default:
@@ -433,8 +427,7 @@ c_path_expr_of_child (const struct varobj *child)
{
std::string path_expr;
- c_describe_child (child->parent, child->index, NULL, NULL, NULL,
- &path_expr);
+ c_describe_child (child->parent, child->index, NULL, NULL, NULL, &path_expr);
return path_expr;
}
@@ -514,7 +507,7 @@ c_value_of_variable (const struct varobj *var,
gdb_assert (varobj_value_is_changeable_p (var));
gdb_assert (!value_lazy (var->value.get ()));
-
+
/* If the specified format is the current one,
we can reuse print_value. */
if (format == var->format)
@@ -526,28 +519,28 @@ c_value_of_variable (const struct varobj *var,
}
}
}
-
/* varobj operations for c. */
-const struct lang_varobj_ops c_varobj_ops =
-{
- c_number_of_children,
- c_name_of_variable,
- c_name_of_child,
- c_path_expr_of_child,
- c_value_of_child,
- c_type_of_child,
- c_value_of_variable,
- varobj_default_value_is_changeable_p,
- NULL, /* value_has_mutated */
- c_is_path_expr_parent /* is_path_expr_parent */
+const struct lang_varobj_ops c_varobj_ops = {
+ c_number_of_children,
+ c_name_of_variable,
+ c_name_of_child,
+ c_path_expr_of_child,
+ c_value_of_child,
+ c_type_of_child,
+ c_value_of_variable,
+ varobj_default_value_is_changeable_p,
+ NULL, /* value_has_mutated */
+ c_is_path_expr_parent /* is_path_expr_parent */
};
/* A little convenience enum for dealing with C++. */
enum vsections
{
- v_public = 0, v_private, v_protected
+ v_public = 0,
+ v_private,
+ v_protected
};
/* C++ */
@@ -669,12 +662,17 @@ cplus_name_of_variable (const struct varobj *parent)
return c_name_of_variable (parent);
}
-enum accessibility { private_field, protected_field, public_field };
+enum accessibility
+{
+ private_field,
+ protected_field,
+ public_field
+};
/* Check if field INDEX of TYPE has the specified accessibility.
Return 0 if so and 1 otherwise. */
-static int
+static int
match_accessibility (struct type *type, int index, enum accessibility acc)
{
if (acc == private_field && TYPE_FIELD_PRIVATE (type, index))
@@ -690,8 +688,8 @@ match_accessibility (struct type *type, int index, enum accessibility acc)
static void
cplus_describe_child (const struct varobj *parent, int index,
- std::string *cname, struct value **cvalue, struct type **ctype,
- std::string *cfull_expression)
+ std::string *cname, struct value **cvalue,
+ struct type **ctype, std::string *cfull_expression)
{
struct value *value;
struct type *type;
@@ -723,8 +721,7 @@ cplus_describe_child (const struct varobj *parent, int index,
adjust_value_for_child_access (&value, &type, &was_ptr, lookup_actual_type);
- if (type->code () == TYPE_CODE_STRUCT
- || type->code () == TYPE_CODE_UNION)
+ if (type->code () == TYPE_CODE_STRUCT || type->code () == TYPE_CODE_UNION)
{
const char *join = was_ptr ? "->" : ".";
@@ -754,8 +751,8 @@ cplus_describe_child (const struct varobj *parent, int index,
|| TYPE_FIELD_ARTIFICIAL (type, type_index))
; /* ignore vptr */
else if (match_accessibility (type, type_index, acc))
- --index;
- ++type_index;
+ --index;
+ ++type_index;
}
--type_index;
@@ -825,11 +822,9 @@ cplus_describe_child (const struct varobj *parent, int index,
as a constructor, if it exists. Therefore, we must
indicate that the name is a class name by using the
'class' keyword. See PR mi/11912 */
- *cfull_expression = string_printf ("(%s(class %s%s) %s)",
- ptr,
+ *cfull_expression = string_printf ("(%s(class %s%s) %s)", ptr,
type->field (index).name (),
- ptr,
- parent_expression);
+ ptr, parent_expression);
}
}
else
@@ -849,11 +844,11 @@ cplus_describe_child (const struct varobj *parent, int index,
{
case 0:
if (children[v_public] > 0)
- access = "public";
+ access = "public";
else if (children[v_private] > 0)
- access = "private";
- else
- access = "protected";
+ access = "private";
+ else
+ access = "protected";
break;
case 1:
if (children[v_public] > 0)
@@ -864,7 +859,7 @@ cplus_describe_child (const struct varobj *parent, int index,
access = "protected";
}
else if (children[v_private] > 0)
- access = "protected";
+ access = "protected";
break;
case 2:
/* Must be protected. */
@@ -885,7 +880,7 @@ cplus_describe_child (const struct varobj *parent, int index,
else
{
c_describe_child (parent, index, cname, cvalue, ctype, cfull_expression);
- }
+ }
}
static std::string
@@ -902,7 +897,7 @@ cplus_path_expr_of_child (const struct varobj *child)
{
std::string path_expr;
- cplus_describe_child (child->parent, child->index, NULL, NULL, NULL,
+ cplus_describe_child (child->parent, child->index, NULL, NULL, NULL,
&path_expr);
return path_expr;
}
@@ -929,7 +924,6 @@ static std::string
cplus_value_of_variable (const struct varobj *var,
enum varobj_display_formats format)
{
-
/* If we have one of our special types, don't print out
any value. */
if (CPLUS_FAKE_CHILD (var))
@@ -937,22 +931,18 @@ cplus_value_of_variable (const struct varobj *var,
return c_value_of_variable (var, format);
}
-
/* varobj operations for c++. */
-const struct lang_varobj_ops cplus_varobj_ops =
-{
- cplus_number_of_children,
- cplus_name_of_variable,
- cplus_name_of_child,
- cplus_path_expr_of_child,
- cplus_value_of_child,
- cplus_type_of_child,
- cplus_value_of_variable,
- varobj_default_value_is_changeable_p,
- NULL, /* value_has_mutated */
- c_is_path_expr_parent /* is_path_expr_parent */
+const struct lang_varobj_ops cplus_varobj_ops = {
+ cplus_number_of_children,
+ cplus_name_of_variable,
+ cplus_name_of_child,
+ cplus_path_expr_of_child,
+ cplus_value_of_child,
+ cplus_type_of_child,
+ cplus_value_of_variable,
+ varobj_default_value_is_changeable_p,
+ NULL, /* value_has_mutated */
+ c_is_path_expr_parent /* is_path_expr_parent */
};
-
-
diff --git a/gdb/charset-list.h b/gdb/charset-list.h
index a4751e05271..4bb58e17f2a 100644
--- a/gdb/charset-list.h
+++ b/gdb/charset-list.h
@@ -28,1168 +28,222 @@
.. and then removing the final backslash. It would be nice to
separate narrow and wide character sets, but there is no good way
to do that. */
-#define DEFAULT_CHARSET_NAMES \
-"auto", \
-"437", \
-"500", \
-"500V1", \
-"850", \
-"851", \
-"852", \
-"855", \
-"856", \
-"857", \
-"860", \
-"861", \
-"862", \
-"863", \
-"864", \
-"865", \
-"866", \
-"866NAV", \
-"869", \
-"874", \
-"904", \
-"1026", \
-"1046", \
-"1047", \
-"8859_1", \
-"8859_2", \
-"8859_3", \
-"8859_4", \
-"8859_5", \
-"8859_6", \
-"8859_7", \
-"8859_8", \
-"8859_9", \
-"10646-1:1993", \
-"ANSI_X3.4-1968", \
-"ANSI_X3.4-1986", \
-"ANSI_X3.4", \
-"ANSI_X3.110-1983", \
-"ANSI_X3.110", \
-"ARABIC", \
-"ARABIC7", \
-"ARMSCII-8", \
-"ASCII", \
-"ASMO-708", \
-"ASMO_449", \
-"BALTIC", \
-"BIG-5", \
-"BIG-FIVE", \
-"BIG5-HKSCS", \
-"BIG5", \
-"BIG5HKSCS", \
-"BIGFIVE", \
-"BRF", \
-"BS_4730", \
-"CA", \
-"CN-BIG5", \
-"CN-GB", \
-"CN", \
-"CP-AR", \
-"CP-GR", \
-"CP-HU", \
-"CP037", \
-"CP038", \
-"CP273", \
-"CP274", \
-"CP275", \
-"CP278", \
-"CP280", \
-"CP281", \
-"CP282", \
-"CP284", \
-"CP285", \
-"CP290", \
-"CP297", \
-"CP367", \
-"CP420", \
-"CP423", \
-"CP424", \
-"CP437", \
-"CP500", \
-"CP737", \
-"CP775", \
-"CP803", \
-"CP813", \
-"CP819", \
-"CP850", \
-"CP851", \
-"CP852", \
-"CP855", \
-"CP856", \
-"CP857", \
-"CP860", \
-"CP861", \
-"CP862", \
-"CP863", \
-"CP864", \
-"CP865", \
-"CP866", \
-"CP866NAV", \
-"CP868", \
-"CP869", \
-"CP870", \
-"CP871", \
-"CP874", \
-"CP875", \
-"CP880", \
-"CP891", \
-"CP901", \
-"CP902", \
-"CP903", \
-"CP904", \
-"CP905", \
-"CP912", \
-"CP915", \
-"CP916", \
-"CP918", \
-"CP920", \
-"CP921", \
-"CP922", \
-"CP930", \
-"CP932", \
-"CP933", \
-"CP935", \
-"CP936", \
-"CP937", \
-"CP939", \
-"CP949", \
-"CP950", \
-"CP1004", \
-"CP1008", \
-"CP1025", \
-"CP1026", \
-"CP1046", \
-"CP1047", \
-"CP1070", \
-"CP1079", \
-"CP1081", \
-"CP1084", \
-"CP1089", \
-"CP1097", \
-"CP1112", \
-"CP1122", \
-"CP1123", \
-"CP1124", \
-"CP1125", \
-"CP1129", \
-"CP1130", \
-"CP1132", \
-"CP1133", \
-"CP1137", \
-"CP1140", \
-"CP1141", \
-"CP1142", \
-"CP1143", \
-"CP1144", \
-"CP1145", \
-"CP1146", \
-"CP1147", \
-"CP1148", \
-"CP1149", \
-"CP1153", \
-"CP1154", \
-"CP1155", \
-"CP1156", \
-"CP1157", \
-"CP1158", \
-"CP1160", \
-"CP1161", \
-"CP1162", \
-"CP1163", \
-"CP1164", \
-"CP1166", \
-"CP1167", \
-"CP1250", \
-"CP1251", \
-"CP1252", \
-"CP1253", \
-"CP1254", \
-"CP1255", \
-"CP1256", \
-"CP1257", \
-"CP1258", \
-"CP1282", \
-"CP1361", \
-"CP1364", \
-"CP1371", \
-"CP1388", \
-"CP1390", \
-"CP1399", \
-"CP4517", \
-"CP4899", \
-"CP4909", \
-"CP4971", \
-"CP5347", \
-"CP9030", \
-"CP9066", \
-"CP9448", \
-"CP10007", \
-"CP12712", \
-"CP16804", \
-"CPIBM861", \
-"CSA7-1", \
-"CSA7-2", \
-"CSASCII", \
-"CSA_T500-1983", \
-"CSA_T500", \
-"CSA_Z243.4-1985-1", \
-"CSA_Z243.4-1985-2", \
-"CSA_Z243.419851", \
-"CSA_Z243.419852", \
-"CSDECMCS", \
-"CSEBCDICATDE", \
-"CSEBCDICATDEA", \
-"CSEBCDICCAFR", \
-"CSEBCDICDKNO", \
-"CSEBCDICDKNOA", \
-"CSEBCDICES", \
-"CSEBCDICESA", \
-"CSEBCDICESS", \
-"CSEBCDICFISE", \
-"CSEBCDICFISEA", \
-"CSEBCDICFR", \
-"CSEBCDICIT", \
-"CSEBCDICPT", \
-"CSEBCDICUK", \
-"CSEBCDICUS", \
-"CSEUCKR", \
-"CSEUCPKDFMTJAPANESE", \
-"CSGB2312", \
-"CSHPROMAN8", \
-"CSIBM037", \
-"CSIBM038", \
-"CSIBM273", \
-"CSIBM274", \
-"CSIBM275", \
-"CSIBM277", \
-"CSIBM278", \
-"CSIBM280", \
-"CSIBM281", \
-"CSIBM284", \
-"CSIBM285", \
-"CSIBM290", \
-"CSIBM297", \
-"CSIBM420", \
-"CSIBM423", \
-"CSIBM424", \
-"CSIBM500", \
-"CSIBM803", \
-"CSIBM851", \
-"CSIBM855", \
-"CSIBM856", \
-"CSIBM857", \
-"CSIBM860", \
-"CSIBM863", \
-"CSIBM864", \
-"CSIBM865", \
-"CSIBM866", \
-"CSIBM868", \
-"CSIBM869", \
-"CSIBM870", \
-"CSIBM871", \
-"CSIBM880", \
-"CSIBM891", \
-"CSIBM901", \
-"CSIBM902", \
-"CSIBM903", \
-"CSIBM904", \
-"CSIBM905", \
-"CSIBM918", \
-"CSIBM921", \
-"CSIBM922", \
-"CSIBM930", \
-"CSIBM932", \
-"CSIBM933", \
-"CSIBM935", \
-"CSIBM937", \
-"CSIBM939", \
-"CSIBM943", \
-"CSIBM1008", \
-"CSIBM1025", \
-"CSIBM1026", \
-"CSIBM1097", \
-"CSIBM1112", \
-"CSIBM1122", \
-"CSIBM1123", \
-"CSIBM1124", \
-"CSIBM1129", \
-"CSIBM1130", \
-"CSIBM1132", \
-"CSIBM1133", \
-"CSIBM1137", \
-"CSIBM1140", \
-"CSIBM1141", \
-"CSIBM1142", \
-"CSIBM1143", \
-"CSIBM1144", \
-"CSIBM1145", \
-"CSIBM1146", \
-"CSIBM1147", \
-"CSIBM1148", \
-"CSIBM1149", \
-"CSIBM1153", \
-"CSIBM1154", \
-"CSIBM1155", \
-"CSIBM1156", \
-"CSIBM1157", \
-"CSIBM1158", \
-"CSIBM1160", \
-"CSIBM1161", \
-"CSIBM1163", \
-"CSIBM1164", \
-"CSIBM1166", \
-"CSIBM1167", \
-"CSIBM1364", \
-"CSIBM1371", \
-"CSIBM1388", \
-"CSIBM1390", \
-"CSIBM1399", \
-"CSIBM4517", \
-"CSIBM4899", \
-"CSIBM4909", \
-"CSIBM4971", \
-"CSIBM5347", \
-"CSIBM9030", \
-"CSIBM9066", \
-"CSIBM9448", \
-"CSIBM12712", \
-"CSIBM16804", \
-"CSIBM11621162", \
-"CSISO4UNITEDKINGDOM", \
-"CSISO10SWEDISH", \
-"CSISO11SWEDISHFORNAMES", \
-"CSISO14JISC6220RO", \
-"CSISO15ITALIAN", \
-"CSISO16PORTUGESE", \
-"CSISO17SPANISH", \
-"CSISO18GREEK7OLD", \
-"CSISO19LATINGREEK", \
-"CSISO21GERMAN", \
-"CSISO25FRENCH", \
-"CSISO27LATINGREEK1", \
-"CSISO49INIS", \
-"CSISO50INIS8", \
-"CSISO51INISCYRILLIC", \
-"CSISO58GB1988", \
-"CSISO60DANISHNORWEGIAN", \
-"CSISO60NORWEGIAN1", \
-"CSISO61NORWEGIAN2", \
-"CSISO69FRENCH", \
-"CSISO84PORTUGUESE2", \
-"CSISO85SPANISH2", \
-"CSISO86HUNGARIAN", \
-"CSISO88GREEK7", \
-"CSISO89ASMO449", \
-"CSISO90", \
-"CSISO92JISC62991984B", \
-"CSISO99NAPLPS", \
-"CSISO103T618BIT", \
-"CSISO111ECMACYRILLIC", \
-"CSISO121CANADIAN1", \
-"CSISO122CANADIAN2", \
-"CSISO139CSN369103", \
-"CSISO141JUSIB1002", \
-"CSISO143IECP271", \
-"CSISO150", \
-"CSISO150GREEKCCITT", \
-"CSISO151CUBA", \
-"CSISO153GOST1976874", \
-"CSISO646DANISH", \
-"CSISO2022CN", \
-"CSISO2022JP", \
-"CSISO2022JP2", \
-"CSISO2022KR", \
-"CSISO2033", \
-"CSISO5427CYRILLIC", \
-"CSISO5427CYRILLIC1981", \
-"CSISO5428GREEK", \
-"CSISO10367BOX", \
-"CSISOLATIN1", \
-"CSISOLATIN2", \
-"CSISOLATIN3", \
-"CSISOLATIN4", \
-"CSISOLATIN5", \
-"CSISOLATIN6", \
-"CSISOLATINARABIC", \
-"CSISOLATINCYRILLIC", \
-"CSISOLATINGREEK", \
-"CSISOLATINHEBREW", \
-"CSKOI8R", \
-"CSKSC5636", \
-"CSMACINTOSH", \
-"CSNATSDANO", \
-"CSNATSSEFI", \
-"CSN_369103", \
-"CSPC8CODEPAGE437", \
-"CSPC775BALTIC", \
-"CSPC850MULTILINGUAL", \
-"CSPC862LATINHEBREW", \
-"CSPCP852", \
-"CSSHIFTJIS", \
-"CSUCS4", \
-"CSUNICODE", \
-"CSWINDOWS31J", \
-"CUBA", \
-"CWI-2", \
-"CWI", \
-"CYRILLIC", \
-"DE", \
-"DEC-MCS", \
-"DEC", \
-"DECMCS", \
-"DIN_66003", \
-"DK", \
-"DS2089", \
-"DS_2089", \
-"E13B", \
-"EBCDIC-AT-DE-A", \
-"EBCDIC-AT-DE", \
-"EBCDIC-BE", \
-"EBCDIC-BR", \
-"EBCDIC-CA-FR", \
-"EBCDIC-CP-AR1", \
-"EBCDIC-CP-AR2", \
-"EBCDIC-CP-BE", \
-"EBCDIC-CP-CA", \
-"EBCDIC-CP-CH", \
-"EBCDIC-CP-DK", \
-"EBCDIC-CP-ES", \
-"EBCDIC-CP-FI", \
-"EBCDIC-CP-FR", \
-"EBCDIC-CP-GB", \
-"EBCDIC-CP-GR", \
-"EBCDIC-CP-HE", \
-"EBCDIC-CP-IS", \
-"EBCDIC-CP-IT", \
-"EBCDIC-CP-NL", \
-"EBCDIC-CP-NO", \
-"EBCDIC-CP-ROECE", \
-"EBCDIC-CP-SE", \
-"EBCDIC-CP-TR", \
-"EBCDIC-CP-US", \
-"EBCDIC-CP-WT", \
-"EBCDIC-CP-YU", \
-"EBCDIC-CYRILLIC", \
-"EBCDIC-DK-NO-A", \
-"EBCDIC-DK-NO", \
-"EBCDIC-ES-A", \
-"EBCDIC-ES-S", \
-"EBCDIC-ES", \
-"EBCDIC-FI-SE-A", \
-"EBCDIC-FI-SE", \
-"EBCDIC-FR", \
-"EBCDIC-GREEK", \
-"EBCDIC-INT", \
-"EBCDIC-INT1", \
-"EBCDIC-IS-FRISS", \
-"EBCDIC-IT", \
-"EBCDIC-JP-E", \
-"EBCDIC-JP-KANA", \
-"EBCDIC-PT", \
-"EBCDIC-UK", \
-"EBCDIC-US", \
-"EBCDICATDE", \
-"EBCDICATDEA", \
-"EBCDICCAFR", \
-"EBCDICDKNO", \
-"EBCDICDKNOA", \
-"EBCDICES", \
-"EBCDICESA", \
-"EBCDICESS", \
-"EBCDICFISE", \
-"EBCDICFISEA", \
-"EBCDICFR", \
-"EBCDICISFRISS", \
-"EBCDICIT", \
-"EBCDICPT", \
-"EBCDICUK", \
-"EBCDICUS", \
-"ECMA-114", \
-"ECMA-118", \
-"ECMA-128", \
-"ECMA-CYRILLIC", \
-"ECMACYRILLIC", \
-"ELOT_928", \
-"ES", \
-"ES2", \
-"EUC-CN", \
-"EUC-JISX0213", \
-"EUC-JP-MS", \
-"EUC-JP", \
-"EUC-KR", \
-"EUC-TW", \
-"EUCCN", \
-"EUCJP-MS", \
-"EUCJP-OPEN", \
-"EUCJP-WIN", \
-"EUCJP", \
-"EUCKR", \
-"EUCTW", \
-"FI", \
-"FR", \
-"GB", \
-"GB2312", \
-"GB13000", \
-"GB18030", \
-"GBK", \
-"GB_1988-80", \
-"GB_198880", \
-"GEORGIAN-ACADEMY", \
-"GEORGIAN-PS", \
-"GOST_19768-74", \
-"GOST_19768", \
-"GOST_1976874", \
-"GREEK-CCITT", \
-"GREEK", \
-"GREEK7-OLD", \
-"GREEK7", \
-"GREEK7OLD", \
-"GREEK8", \
-"GREEKCCITT", \
-"HEBREW", \
-"HP-GREEK8", \
-"HP-ROMAN8", \
-"HP-ROMAN9", \
-"HP-THAI8", \
-"HP-TURKISH8", \
-"HPGREEK8", \
-"HPROMAN8", \
-"HPROMAN9", \
-"HPTHAI8", \
-"HPTURKISH8", \
-"HU", \
-"IBM-803", \
-"IBM-856", \
-"IBM-901", \
-"IBM-902", \
-"IBM-921", \
-"IBM-922", \
-"IBM-930", \
-"IBM-932", \
-"IBM-933", \
-"IBM-935", \
-"IBM-937", \
-"IBM-939", \
-"IBM-943", \
-"IBM-1008", \
-"IBM-1025", \
-"IBM-1046", \
-"IBM-1047", \
-"IBM-1097", \
-"IBM-1112", \
-"IBM-1122", \
-"IBM-1123", \
-"IBM-1124", \
-"IBM-1129", \
-"IBM-1130", \
-"IBM-1132", \
-"IBM-1133", \
-"IBM-1137", \
-"IBM-1140", \
-"IBM-1141", \
-"IBM-1142", \
-"IBM-1143", \
-"IBM-1144", \
-"IBM-1145", \
-"IBM-1146", \
-"IBM-1147", \
-"IBM-1148", \
-"IBM-1149", \
-"IBM-1153", \
-"IBM-1154", \
-"IBM-1155", \
-"IBM-1156", \
-"IBM-1157", \
-"IBM-1158", \
-"IBM-1160", \
-"IBM-1161", \
-"IBM-1162", \
-"IBM-1163", \
-"IBM-1164", \
-"IBM-1166", \
-"IBM-1167", \
-"IBM-1364", \
-"IBM-1371", \
-"IBM-1388", \
-"IBM-1390", \
-"IBM-1399", \
-"IBM-4517", \
-"IBM-4899", \
-"IBM-4909", \
-"IBM-4971", \
-"IBM-5347", \
-"IBM-9030", \
-"IBM-9066", \
-"IBM-9448", \
-"IBM-12712", \
-"IBM-16804", \
-"IBM037", \
-"IBM038", \
-"IBM256", \
-"IBM273", \
-"IBM274", \
-"IBM275", \
-"IBM277", \
-"IBM278", \
-"IBM280", \
-"IBM281", \
-"IBM284", \
-"IBM285", \
-"IBM290", \
-"IBM297", \
-"IBM367", \
-"IBM420", \
-"IBM423", \
-"IBM424", \
-"IBM437", \
-"IBM500", \
-"IBM775", \
-"IBM803", \
-"IBM813", \
-"IBM819", \
-"IBM848", \
-"IBM850", \
-"IBM851", \
-"IBM852", \
-"IBM855", \
-"IBM856", \
-"IBM857", \
-"IBM860", \
-"IBM861", \
-"IBM862", \
-"IBM863", \
-"IBM864", \
-"IBM865", \
-"IBM866", \
-"IBM866NAV", \
-"IBM868", \
-"IBM869", \
-"IBM870", \
-"IBM871", \
-"IBM874", \
-"IBM875", \
-"IBM880", \
-"IBM891", \
-"IBM901", \
-"IBM902", \
-"IBM903", \
-"IBM904", \
-"IBM905", \
-"IBM912", \
-"IBM915", \
-"IBM916", \
-"IBM918", \
-"IBM920", \
-"IBM921", \
-"IBM922", \
-"IBM930", \
-"IBM932", \
-"IBM933", \
-"IBM935", \
-"IBM937", \
-"IBM939", \
-"IBM943", \
-"IBM1004", \
-"IBM1008", \
-"IBM1025", \
-"IBM1026", \
-"IBM1046", \
-"IBM1047", \
-"IBM1089", \
-"IBM1097", \
-"IBM1112", \
-"IBM1122", \
-"IBM1123", \
-"IBM1124", \
-"IBM1129", \
-"IBM1130", \
-"IBM1132", \
-"IBM1133", \
-"IBM1137", \
-"IBM1140", \
-"IBM1141", \
-"IBM1142", \
-"IBM1143", \
-"IBM1144", \
-"IBM1145", \
-"IBM1146", \
-"IBM1147", \
-"IBM1148", \
-"IBM1149", \
-"IBM1153", \
-"IBM1154", \
-"IBM1155", \
-"IBM1156", \
-"IBM1157", \
-"IBM1158", \
-"IBM1160", \
-"IBM1161", \
-"IBM1162", \
-"IBM1163", \
-"IBM1164", \
-"IBM1166", \
-"IBM1167", \
-"IBM1364", \
-"IBM1371", \
-"IBM1388", \
-"IBM1390", \
-"IBM1399", \
-"IBM4517", \
-"IBM4899", \
-"IBM4909", \
-"IBM4971", \
-"IBM5347", \
-"IBM9030", \
-"IBM9066", \
-"IBM9448", \
-"IBM12712", \
-"IBM16804", \
-"IEC_P27-1", \
-"IEC_P271", \
-"INIS-8", \
-"INIS-CYRILLIC", \
-"INIS", \
-"INIS8", \
-"INISCYRILLIC", \
-"ISIRI-3342", \
-"ISIRI3342", \
-"ISO-2022-CN-EXT", \
-"ISO-2022-CN", \
-"ISO-2022-JP-2", \
-"ISO-2022-JP-3", \
-"ISO-2022-JP", \
-"ISO-2022-KR", \
-"ISO-8859-1", \
-"ISO-8859-2", \
-"ISO-8859-3", \
-"ISO-8859-4", \
-"ISO-8859-5", \
-"ISO-8859-6", \
-"ISO-8859-7", \
-"ISO-8859-8", \
-"ISO-8859-9", \
-"ISO-8859-9E", \
-"ISO-8859-10", \
-"ISO-8859-11", \
-"ISO-8859-13", \
-"ISO-8859-14", \
-"ISO-8859-15", \
-"ISO-8859-16", \
-"ISO-10646", \
-"ISO-CELTIC", \
-"ISO-IR-4", \
-"ISO-IR-6", \
-"ISO-IR-8-1", \
-"ISO-IR-9-1", \
-"ISO-IR-10", \
-"ISO-IR-11", \
-"ISO-IR-14", \
-"ISO-IR-15", \
-"ISO-IR-16", \
-"ISO-IR-17", \
-"ISO-IR-18", \
-"ISO-IR-19", \
-"ISO-IR-21", \
-"ISO-IR-25", \
-"ISO-IR-27", \
-"ISO-IR-37", \
-"ISO-IR-49", \
-"ISO-IR-50", \
-"ISO-IR-51", \
-"ISO-IR-54", \
-"ISO-IR-55", \
-"ISO-IR-57", \
-"ISO-IR-60", \
-"ISO-IR-61", \
-"ISO-IR-69", \
-"ISO-IR-84", \
-"ISO-IR-85", \
-"ISO-IR-86", \
-"ISO-IR-88", \
-"ISO-IR-89", \
-"ISO-IR-90", \
-"ISO-IR-92", \
-"ISO-IR-98", \
-"ISO-IR-99", \
-"ISO-IR-100", \
-"ISO-IR-101", \
-"ISO-IR-103", \
-"ISO-IR-109", \
-"ISO-IR-110", \
-"ISO-IR-111", \
-"ISO-IR-121", \
-"ISO-IR-122", \
-"ISO-IR-126", \
-"ISO-IR-127", \
-"ISO-IR-138", \
-"ISO-IR-139", \
-"ISO-IR-141", \
-"ISO-IR-143", \
-"ISO-IR-144", \
-"ISO-IR-148", \
-"ISO-IR-150", \
-"ISO-IR-151", \
-"ISO-IR-153", \
-"ISO-IR-155", \
-"ISO-IR-156", \
-"ISO-IR-157", \
-"ISO-IR-166", \
-"ISO-IR-179", \
-"ISO-IR-193", \
-"ISO-IR-197", \
-"ISO-IR-199", \
-"ISO-IR-203", \
-"ISO-IR-209", \
-"ISO-IR-226", \
-"ISO646-CA", \
-"ISO646-CA2", \
-"ISO646-CN", \
-"ISO646-CU", \
-"ISO646-DE", \
-"ISO646-DK", \
-"ISO646-ES", \
-"ISO646-ES2", \
-"ISO646-FI", \
-"ISO646-FR", \
-"ISO646-FR1", \
-"ISO646-GB", \
-"ISO646-HU", \
-"ISO646-IT", \
-"ISO646-JP-OCR-B", \
-"ISO646-JP", \
-"ISO646-KR", \
-"ISO646-NO", \
-"ISO646-NO2", \
-"ISO646-PT", \
-"ISO646-PT2", \
-"ISO646-SE", \
-"ISO646-SE2", \
-"ISO646-US", \
-"ISO646-YU", \
-"ISO2022CN", \
-"ISO2022CNEXT", \
-"ISO2022JP", \
-"ISO2022JP2", \
-"ISO2022KR", \
-"ISO6937", \
-"ISO8859-1", \
-"ISO8859-2", \
-"ISO8859-3", \
-"ISO8859-4", \
-"ISO8859-5", \
-"ISO8859-6", \
-"ISO8859-7", \
-"ISO8859-8", \
-"ISO8859-9", \
-"ISO8859-9E", \
-"ISO8859-10", \
-"ISO8859-11", \
-"ISO8859-13", \
-"ISO8859-14", \
-"ISO8859-15", \
-"ISO8859-16", \
-"ISO11548-1", \
-"ISO88591", \
-"ISO88592", \
-"ISO88593", \
-"ISO88594", \
-"ISO88595", \
-"ISO88596", \
-"ISO88597", \
-"ISO88598", \
-"ISO88599", \
-"ISO88599E", \
-"ISO885910", \
-"ISO885911", \
-"ISO885913", \
-"ISO885914", \
-"ISO885915", \
-"ISO885916", \
-"ISO_646.IRV:1991", \
-"ISO_2033-1983", \
-"ISO_2033", \
-"ISO_5427-EXT", \
-"ISO_5427", \
-"ISO_5427:1981", \
-"ISO_5427EXT", \
-"ISO_5428", \
-"ISO_5428:1980", \
-"ISO_6937-2", \
-"ISO_6937-2:1983", \
-"ISO_6937", \
-"ISO_6937:1992", \
-"ISO_8859-1", \
-"ISO_8859-1:1987", \
-"ISO_8859-2", \
-"ISO_8859-2:1987", \
-"ISO_8859-3", \
-"ISO_8859-3:1988", \
-"ISO_8859-4", \
-"ISO_8859-4:1988", \
-"ISO_8859-5", \
-"ISO_8859-5:1988", \
-"ISO_8859-6", \
-"ISO_8859-6:1987", \
-"ISO_8859-7", \
-"ISO_8859-7:1987", \
-"ISO_8859-7:2003", \
-"ISO_8859-8", \
-"ISO_8859-8:1988", \
-"ISO_8859-9", \
-"ISO_8859-9:1989", \
-"ISO_8859-9E", \
-"ISO_8859-10", \
-"ISO_8859-10:1992", \
-"ISO_8859-14", \
-"ISO_8859-14:1998", \
-"ISO_8859-15", \
-"ISO_8859-15:1998", \
-"ISO_8859-16", \
-"ISO_8859-16:2001", \
-"ISO_9036", \
-"ISO_10367-BOX", \
-"ISO_10367BOX", \
-"ISO_11548-1", \
-"ISO_69372", \
-"IT", \
-"JIS_C6220-1969-RO", \
-"JIS_C6229-1984-B", \
-"JIS_C62201969RO", \
-"JIS_C62291984B", \
-"JOHAB", \
-"JP-OCR-B", \
-"JP", \
-"JS", \
-"JUS_I.B1.002", \
-"KOI-7", \
-"KOI-8", \
-"KOI8-R", \
-"KOI8-RU", \
-"KOI8-T", \
-"KOI8-U", \
-"KOI8", \
-"KOI8R", \
-"KOI8U", \
-"KSC5636", \
-"L1", \
-"L2", \
-"L3", \
-"L4", \
-"L5", \
-"L6", \
-"L7", \
-"L8", \
-"L10", \
-"LATIN-9", \
-"LATIN-GREEK-1", \
-"LATIN-GREEK", \
-"LATIN1", \
-"LATIN2", \
-"LATIN3", \
-"LATIN4", \
-"LATIN5", \
-"LATIN6", \
-"LATIN7", \
-"LATIN8", \
-"LATIN10", \
-"LATINGREEK", \
-"LATINGREEK1", \
-"MAC-CENTRALEUROPE", \
-"MAC-CYRILLIC", \
-"MAC-IS", \
-"MAC-SAMI", \
-"MAC-UK", \
-"MAC", \
-"MACCYRILLIC", \
-"MACINTOSH", \
-"MACIS", \
-"MACUK", \
-"MACUKRAINIAN", \
-"MIK", \
-"MS-ANSI", \
-"MS-ARAB", \
-"MS-CYRL", \
-"MS-EE", \
-"MS-GREEK", \
-"MS-HEBR", \
-"MS-MAC-CYRILLIC", \
-"MS-TURK", \
-"MS932", \
-"MS936", \
-"MSCP949", \
-"MSCP1361", \
-"MSMACCYRILLIC", \
-"MSZ_7795.3", \
-"MS_KANJI", \
-"NAPLPS", \
-"NATS-DANO", \
-"NATS-SEFI", \
-"NATSDANO", \
-"NATSSEFI", \
-"NC_NC0010", \
-"NC_NC00-10", \
-"NC_NC00-10:81", \
-"NF_Z_62-010", \
-"NF_Z_62-010_(1973)", \
-"NF_Z_62-010_1973", \
-"NF_Z_62010", \
-"NF_Z_62010_1973", \
-"NO", \
-"NO2", \
-"NS_4551-1", \
-"NS_4551-2", \
-"NS_45511", \
-"NS_45512", \
-"OS2LATIN1", \
-"OSF00010001", \
-"OSF00010002", \
-"OSF00010003", \
-"OSF00010004", \
-"OSF00010005", \
-"OSF00010006", \
-"OSF00010007", \
-"OSF00010008", \
-"OSF00010009", \
-"OSF0001000A", \
-"OSF00010020", \
-"OSF00010100", \
-"OSF00010101", \
-"OSF00010102", \
-"OSF00010104", \
-"OSF00010105", \
-"OSF00010106", \
-"OSF00030010", \
-"OSF0004000A", \
-"OSF0005000A", \
-"OSF05010001", \
-"OSF100201A4", \
-"OSF100201A8", \
-"OSF100201B5", \
-"OSF100201F4", \
-"OSF100203B5", \
-"OSF1002011C", \
-"OSF1002011D", \
-"OSF1002035D", \
-"OSF1002035E", \
-"OSF1002035F", \
-"OSF1002036B", \
-"OSF1002037B", \
-"OSF10010001", \
-"OSF10010004", \
-"OSF10010006", \
-"OSF10020025", \
-"OSF10020111", \
-"OSF10020115", \
-"OSF10020116", \
-"OSF10020118", \
-"OSF10020122", \
-"OSF10020129", \
-"OSF10020352", \
-"OSF10020354", \
-"OSF10020357", \
-"OSF10020359", \
-"OSF10020360", \
-"OSF10020364", \
-"OSF10020365", \
-"OSF10020366", \
-"OSF10020367", \
-"OSF10020370", \
-"OSF10020387", \
-"OSF10020388", \
-"OSF10020396", \
-"OSF10020402", \
-"OSF10020417", \
-"PT", \
-"PT2", \
-"PT154", \
-"R8", \
-"R9", \
-"RK1048", \
-"ROMAN8", \
-"ROMAN9", \
-"RUSCII", \
-"SE", \
-"SE2", \
-"SEN_850200_B", \
-"SEN_850200_C", \
-"SHIFT-JIS", \
-"SHIFT_JIS", \
-"SHIFT_JISX0213", \
-"SJIS-OPEN", \
-"SJIS-WIN", \
-"SJIS", \
-"SS636127", \
-"STRK1048-2002", \
-"ST_SEV_358-88", \
-"T.61-8BIT", \
-"T.61", \
-"T.618BIT", \
-"TCVN-5712", \
-"TCVN", \
-"TCVN5712-1", \
-"TCVN5712-1:1993", \
-"THAI8", \
-"TIS-620", \
-"TIS620-0", \
-"TIS620.2529-1", \
-"TIS620.2533-0", \
-"TIS620", \
-"TS-5881", \
-"TSCII", \
-"TURKISH8", \
-"UCS-2", \
-"UCS-2BE", \
-"UCS-2LE", \
-"UCS-4", \
-"UCS-4BE", \
-"UCS-4LE", \
-"UCS2", \
-"UCS4", \
-"UHC", \
-"UJIS", \
-"UK", \
-"UNICODE", \
-"UNICODEBIG", \
-"UNICODELITTLE", \
-"US-ASCII", \
-"US", \
-"UTF-7", \
-"UTF-8", \
-"UTF-16", \
-"UTF-16BE", \
-"UTF-16LE", \
-"UTF-32", \
-"UTF-32BE", \
-"UTF-32LE", \
-"UTF7", \
-"UTF8", \
-"UTF16", \
-"UTF16BE", \
-"UTF16LE", \
-"UTF32", \
-"UTF32BE", \
-"UTF32LE", \
-"VISCII", \
-"WCHAR_T", \
-"WIN-SAMI-2", \
-"WINBALTRIM", \
-"WINDOWS-31J", \
-"WINDOWS-874", \
-"WINDOWS-936", \
-"WINDOWS-1250", \
-"WINDOWS-1251", \
-"WINDOWS-1252", \
-"WINDOWS-1253", \
-"WINDOWS-1254", \
-"WINDOWS-1255", \
-"WINDOWS-1256", \
-"WINDOWS-1257", \
-"WINDOWS-1258", \
-"WINSAMI2", \
-"WS2", \
-"YU",
+#define DEFAULT_CHARSET_NAMES \
+ "auto", "437", "500", "500V1", "850", "851", "852", "855", "856", "857", \
+ "860", "861", "862", "863", "864", "865", "866", "866NAV", "869", "874", \
+ "904", "1026", "1046", "1047", "8859_1", "8859_2", "8859_3", "8859_4", \
+ "8859_5", "8859_6", "8859_7", "8859_8", "8859_9", "10646-1:1993", \
+ "ANSI_X3.4-1968", "ANSI_X3.4-1986", "ANSI_X3.4", "ANSI_X3.110-1983", \
+ "ANSI_X3.110", "ARABIC", "ARABIC7", "ARMSCII-8", "ASCII", "ASMO-708", \
+ "ASMO_449", "BALTIC", "BIG-5", "BIG-FIVE", "BIG5-HKSCS", "BIG5", \
+ "BIG5HKSCS", "BIGFIVE", "BRF", "BS_4730", "CA", "CN-BIG5", "CN-GB", "CN", \
+ "CP-AR", "CP-GR", "CP-HU", "CP037", "CP038", "CP273", "CP274", "CP275", \
+ "CP278", "CP280", "CP281", "CP282", "CP284", "CP285", "CP290", "CP297", \
+ "CP367", "CP420", "CP423", "CP424", "CP437", "CP500", "CP737", "CP775", \
+ "CP803", "CP813", "CP819", "CP850", "CP851", "CP852", "CP855", "CP856", \
+ "CP857", "CP860", "CP861", "CP862", "CP863", "CP864", "CP865", "CP866", \
+ "CP866NAV", "CP868", "CP869", "CP870", "CP871", "CP874", "CP875", \
+ "CP880", "CP891", "CP901", "CP902", "CP903", "CP904", "CP905", "CP912", \
+ "CP915", "CP916", "CP918", "CP920", "CP921", "CP922", "CP930", "CP932", \
+ "CP933", "CP935", "CP936", "CP937", "CP939", "CP949", "CP950", "CP1004", \
+ "CP1008", "CP1025", "CP1026", "CP1046", "CP1047", "CP1070", "CP1079", \
+ "CP1081", "CP1084", "CP1089", "CP1097", "CP1112", "CP1122", "CP1123", \
+ "CP1124", "CP1125", "CP1129", "CP1130", "CP1132", "CP1133", "CP1137", \
+ "CP1140", "CP1141", "CP1142", "CP1143", "CP1144", "CP1145", "CP1146", \
+ "CP1147", "CP1148", "CP1149", "CP1153", "CP1154", "CP1155", "CP1156", \
+ "CP1157", "CP1158", "CP1160", "CP1161", "CP1162", "CP1163", "CP1164", \
+ "CP1166", "CP1167", "CP1250", "CP1251", "CP1252", "CP1253", "CP1254", \
+ "CP1255", "CP1256", "CP1257", "CP1258", "CP1282", "CP1361", "CP1364", \
+ "CP1371", "CP1388", "CP1390", "CP1399", "CP4517", "CP4899", "CP4909", \
+ "CP4971", "CP5347", "CP9030", "CP9066", "CP9448", "CP10007", "CP12712", \
+ "CP16804", "CPIBM861", "CSA7-1", "CSA7-2", "CSASCII", "CSA_T500-1983", \
+ "CSA_T500", "CSA_Z243.4-1985-1", "CSA_Z243.4-1985-2", "CSA_Z243.419851", \
+ "CSA_Z243.419852", "CSDECMCS", "CSEBCDICATDE", "CSEBCDICATDEA", \
+ "CSEBCDICCAFR", "CSEBCDICDKNO", "CSEBCDICDKNOA", "CSEBCDICES", \
+ "CSEBCDICESA", "CSEBCDICESS", "CSEBCDICFISE", "CSEBCDICFISEA", \
+ "CSEBCDICFR", "CSEBCDICIT", "CSEBCDICPT", "CSEBCDICUK", "CSEBCDICUS", \
+ "CSEUCKR", "CSEUCPKDFMTJAPANESE", "CSGB2312", "CSHPROMAN8", "CSIBM037", \
+ "CSIBM038", "CSIBM273", "CSIBM274", "CSIBM275", "CSIBM277", "CSIBM278", \
+ "CSIBM280", "CSIBM281", "CSIBM284", "CSIBM285", "CSIBM290", "CSIBM297", \
+ "CSIBM420", "CSIBM423", "CSIBM424", "CSIBM500", "CSIBM803", "CSIBM851", \
+ "CSIBM855", "CSIBM856", "CSIBM857", "CSIBM860", "CSIBM863", "CSIBM864", \
+ "CSIBM865", "CSIBM866", "CSIBM868", "CSIBM869", "CSIBM870", "CSIBM871", \
+ "CSIBM880", "CSIBM891", "CSIBM901", "CSIBM902", "CSIBM903", "CSIBM904", \
+ "CSIBM905", "CSIBM918", "CSIBM921", "CSIBM922", "CSIBM930", "CSIBM932", \
+ "CSIBM933", "CSIBM935", "CSIBM937", "CSIBM939", "CSIBM943", "CSIBM1008", \
+ "CSIBM1025", "CSIBM1026", "CSIBM1097", "CSIBM1112", "CSIBM1122", \
+ "CSIBM1123", "CSIBM1124", "CSIBM1129", "CSIBM1130", "CSIBM1132", \
+ "CSIBM1133", "CSIBM1137", "CSIBM1140", "CSIBM1141", "CSIBM1142", \
+ "CSIBM1143", "CSIBM1144", "CSIBM1145", "CSIBM1146", "CSIBM1147", \
+ "CSIBM1148", "CSIBM1149", "CSIBM1153", "CSIBM1154", "CSIBM1155", \
+ "CSIBM1156", "CSIBM1157", "CSIBM1158", "CSIBM1160", "CSIBM1161", \
+ "CSIBM1163", "CSIBM1164", "CSIBM1166", "CSIBM1167", "CSIBM1364", \
+ "CSIBM1371", "CSIBM1388", "CSIBM1390", "CSIBM1399", "CSIBM4517", \
+ "CSIBM4899", "CSIBM4909", "CSIBM4971", "CSIBM5347", "CSIBM9030", \
+ "CSIBM9066", "CSIBM9448", "CSIBM12712", "CSIBM16804", "CSIBM11621162", \
+ "CSISO4UNITEDKINGDOM", "CSISO10SWEDISH", "CSISO11SWEDISHFORNAMES", \
+ "CSISO14JISC6220RO", "CSISO15ITALIAN", "CSISO16PORTUGESE", \
+ "CSISO17SPANISH", "CSISO18GREEK7OLD", "CSISO19LATINGREEK", \
+ "CSISO21GERMAN", "CSISO25FRENCH", "CSISO27LATINGREEK1", "CSISO49INIS", \
+ "CSISO50INIS8", "CSISO51INISCYRILLIC", "CSISO58GB1988", \
+ "CSISO60DANISHNORWEGIAN", "CSISO60NORWEGIAN1", "CSISO61NORWEGIAN2", \
+ "CSISO69FRENCH", "CSISO84PORTUGUESE2", "CSISO85SPANISH2", \
+ "CSISO86HUNGARIAN", "CSISO88GREEK7", "CSISO89ASMO449", "CSISO90", \
+ "CSISO92JISC62991984B", "CSISO99NAPLPS", "CSISO103T618BIT", \
+ "CSISO111ECMACYRILLIC", "CSISO121CANADIAN1", "CSISO122CANADIAN2", \
+ "CSISO139CSN369103", "CSISO141JUSIB1002", "CSISO143IECP271", "CSISO150", \
+ "CSISO150GREEKCCITT", "CSISO151CUBA", "CSISO153GOST1976874", \
+ "CSISO646DANISH", "CSISO2022CN", "CSISO2022JP", "CSISO2022JP2", \
+ "CSISO2022KR", "CSISO2033", "CSISO5427CYRILLIC", "CSISO5427CYRILLIC1981", \
+ "CSISO5428GREEK", "CSISO10367BOX", "CSISOLATIN1", "CSISOLATIN2", \
+ "CSISOLATIN3", "CSISOLATIN4", "CSISOLATIN5", "CSISOLATIN6", \
+ "CSISOLATINARABIC", "CSISOLATINCYRILLIC", "CSISOLATINGREEK", \
+ "CSISOLATINHEBREW", "CSKOI8R", "CSKSC5636", "CSMACINTOSH", "CSNATSDANO", \
+ "CSNATSSEFI", "CSN_369103", "CSPC8CODEPAGE437", "CSPC775BALTIC", \
+ "CSPC850MULTILINGUAL", "CSPC862LATINHEBREW", "CSPCP852", "CSSHIFTJIS", \
+ "CSUCS4", "CSUNICODE", "CSWINDOWS31J", "CUBA", "CWI-2", "CWI", \
+ "CYRILLIC", "DE", "DEC-MCS", "DEC", "DECMCS", "DIN_66003", "DK", \
+ "DS2089", "DS_2089", "E13B", "EBCDIC-AT-DE-A", "EBCDIC-AT-DE", \
+ "EBCDIC-BE", "EBCDIC-BR", "EBCDIC-CA-FR", "EBCDIC-CP-AR1", \
+ "EBCDIC-CP-AR2", "EBCDIC-CP-BE", "EBCDIC-CP-CA", "EBCDIC-CP-CH", \
+ "EBCDIC-CP-DK", "EBCDIC-CP-ES", "EBCDIC-CP-FI", "EBCDIC-CP-FR", \
+ "EBCDIC-CP-GB", "EBCDIC-CP-GR", "EBCDIC-CP-HE", "EBCDIC-CP-IS", \
+ "EBCDIC-CP-IT", "EBCDIC-CP-NL", "EBCDIC-CP-NO", "EBCDIC-CP-ROECE", \
+ "EBCDIC-CP-SE", "EBCDIC-CP-TR", "EBCDIC-CP-US", "EBCDIC-CP-WT", \
+ "EBCDIC-CP-YU", "EBCDIC-CYRILLIC", "EBCDIC-DK-NO-A", "EBCDIC-DK-NO", \
+ "EBCDIC-ES-A", "EBCDIC-ES-S", "EBCDIC-ES", "EBCDIC-FI-SE-A", \
+ "EBCDIC-FI-SE", "EBCDIC-FR", "EBCDIC-GREEK", "EBCDIC-INT", "EBCDIC-INT1", \
+ "EBCDIC-IS-FRISS", "EBCDIC-IT", "EBCDIC-JP-E", "EBCDIC-JP-KANA", \
+ "EBCDIC-PT", "EBCDIC-UK", "EBCDIC-US", "EBCDICATDE", "EBCDICATDEA", \
+ "EBCDICCAFR", "EBCDICDKNO", "EBCDICDKNOA", "EBCDICES", "EBCDICESA", \
+ "EBCDICESS", "EBCDICFISE", "EBCDICFISEA", "EBCDICFR", "EBCDICISFRISS", \
+ "EBCDICIT", "EBCDICPT", "EBCDICUK", "EBCDICUS", "ECMA-114", "ECMA-118", \
+ "ECMA-128", "ECMA-CYRILLIC", "ECMACYRILLIC", "ELOT_928", "ES", "ES2", \
+ "EUC-CN", "EUC-JISX0213", "EUC-JP-MS", "EUC-JP", "EUC-KR", "EUC-TW", \
+ "EUCCN", "EUCJP-MS", "EUCJP-OPEN", "EUCJP-WIN", "EUCJP", "EUCKR", \
+ "EUCTW", "FI", "FR", "GB", "GB2312", "GB13000", "GB18030", "GBK", \
+ "GB_1988-80", "GB_198880", "GEORGIAN-ACADEMY", "GEORGIAN-PS", \
+ "GOST_19768-74", "GOST_19768", "GOST_1976874", "GREEK-CCITT", "GREEK", \
+ "GREEK7-OLD", "GREEK7", "GREEK7OLD", "GREEK8", "GREEKCCITT", "HEBREW", \
+ "HP-GREEK8", "HP-ROMAN8", "HP-ROMAN9", "HP-THAI8", "HP-TURKISH8", \
+ "HPGREEK8", "HPROMAN8", "HPROMAN9", "HPTHAI8", "HPTURKISH8", "HU", \
+ "IBM-803", "IBM-856", "IBM-901", "IBM-902", "IBM-921", "IBM-922", \
+ "IBM-930", "IBM-932", "IBM-933", "IBM-935", "IBM-937", "IBM-939", \
+ "IBM-943", "IBM-1008", "IBM-1025", "IBM-1046", "IBM-1047", "IBM-1097", \
+ "IBM-1112", "IBM-1122", "IBM-1123", "IBM-1124", "IBM-1129", "IBM-1130", \
+ "IBM-1132", "IBM-1133", "IBM-1137", "IBM-1140", "IBM-1141", "IBM-1142", \
+ "IBM-1143", "IBM-1144", "IBM-1145", "IBM-1146", "IBM-1147", "IBM-1148", \
+ "IBM-1149", "IBM-1153", "IBM-1154", "IBM-1155", "IBM-1156", "IBM-1157", \
+ "IBM-1158", "IBM-1160", "IBM-1161", "IBM-1162", "IBM-1163", "IBM-1164", \
+ "IBM-1166", "IBM-1167", "IBM-1364", "IBM-1371", "IBM-1388", "IBM-1390", \
+ "IBM-1399", "IBM-4517", "IBM-4899", "IBM-4909", "IBM-4971", "IBM-5347", \
+ "IBM-9030", "IBM-9066", "IBM-9448", "IBM-12712", "IBM-16804", "IBM037", \
+ "IBM038", "IBM256", "IBM273", "IBM274", "IBM275", "IBM277", "IBM278", \
+ "IBM280", "IBM281", "IBM284", "IBM285", "IBM290", "IBM297", "IBM367", \
+ "IBM420", "IBM423", "IBM424", "IBM437", "IBM500", "IBM775", "IBM803", \
+ "IBM813", "IBM819", "IBM848", "IBM850", "IBM851", "IBM852", "IBM855", \
+ "IBM856", "IBM857", "IBM860", "IBM861", "IBM862", "IBM863", "IBM864", \
+ "IBM865", "IBM866", "IBM866NAV", "IBM868", "IBM869", "IBM870", "IBM871", \
+ "IBM874", "IBM875", "IBM880", "IBM891", "IBM901", "IBM902", "IBM903", \
+ "IBM904", "IBM905", "IBM912", "IBM915", "IBM916", "IBM918", "IBM920", \
+ "IBM921", "IBM922", "IBM930", "IBM932", "IBM933", "IBM935", "IBM937", \
+ "IBM939", "IBM943", "IBM1004", "IBM1008", "IBM1025", "IBM1026", \
+ "IBM1046", "IBM1047", "IBM1089", "IBM1097", "IBM1112", "IBM1122", \
+ "IBM1123", "IBM1124", "IBM1129", "IBM1130", "IBM1132", "IBM1133", \
+ "IBM1137", "IBM1140", "IBM1141", "IBM1142", "IBM1143", "IBM1144", \
+ "IBM1145", "IBM1146", "IBM1147", "IBM1148", "IBM1149", "IBM1153", \
+ "IBM1154", "IBM1155", "IBM1156", "IBM1157", "IBM1158", "IBM1160", \
+ "IBM1161", "IBM1162", "IBM1163", "IBM1164", "IBM1166", "IBM1167", \
+ "IBM1364", "IBM1371", "IBM1388", "IBM1390", "IBM1399", "IBM4517", \
+ "IBM4899", "IBM4909", "IBM4971", "IBM5347", "IBM9030", "IBM9066", \
+ "IBM9448", "IBM12712", "IBM16804", "IEC_P27-1", "IEC_P271", "INIS-8", \
+ "INIS-CYRILLIC", "INIS", "INIS8", "INISCYRILLIC", "ISIRI-3342", \
+ "ISIRI3342", "ISO-2022-CN-EXT", "ISO-2022-CN", "ISO-2022-JP-2", \
+ "ISO-2022-JP-3", "ISO-2022-JP", "ISO-2022-KR", "ISO-8859-1", \
+ "ISO-8859-2", "ISO-8859-3", "ISO-8859-4", "ISO-8859-5", "ISO-8859-6", \
+ "ISO-8859-7", "ISO-8859-8", "ISO-8859-9", "ISO-8859-9E", "ISO-8859-10", \
+ "ISO-8859-11", "ISO-8859-13", "ISO-8859-14", "ISO-8859-15", \
+ "ISO-8859-16", "ISO-10646", "ISO-CELTIC", "ISO-IR-4", "ISO-IR-6", \
+ "ISO-IR-8-1", "ISO-IR-9-1", "ISO-IR-10", "ISO-IR-11", "ISO-IR-14", \
+ "ISO-IR-15", "ISO-IR-16", "ISO-IR-17", "ISO-IR-18", "ISO-IR-19", \
+ "ISO-IR-21", "ISO-IR-25", "ISO-IR-27", "ISO-IR-37", "ISO-IR-49", \
+ "ISO-IR-50", "ISO-IR-51", "ISO-IR-54", "ISO-IR-55", "ISO-IR-57", \
+ "ISO-IR-60", "ISO-IR-61", "ISO-IR-69", "ISO-IR-84", "ISO-IR-85", \
+ "ISO-IR-86", "ISO-IR-88", "ISO-IR-89", "ISO-IR-90", "ISO-IR-92", \
+ "ISO-IR-98", "ISO-IR-99", "ISO-IR-100", "ISO-IR-101", "ISO-IR-103", \
+ "ISO-IR-109", "ISO-IR-110", "ISO-IR-111", "ISO-IR-121", "ISO-IR-122", \
+ "ISO-IR-126", "ISO-IR-127", "ISO-IR-138", "ISO-IR-139", "ISO-IR-141", \
+ "ISO-IR-143", "ISO-IR-144", "ISO-IR-148", "ISO-IR-150", "ISO-IR-151", \
+ "ISO-IR-153", "ISO-IR-155", "ISO-IR-156", "ISO-IR-157", "ISO-IR-166", \
+ "ISO-IR-179", "ISO-IR-193", "ISO-IR-197", "ISO-IR-199", "ISO-IR-203", \
+ "ISO-IR-209", "ISO-IR-226", "ISO646-CA", "ISO646-CA2", "ISO646-CN", \
+ "ISO646-CU", "ISO646-DE", "ISO646-DK", "ISO646-ES", "ISO646-ES2", \
+ "ISO646-FI", "ISO646-FR", "ISO646-FR1", "ISO646-GB", "ISO646-HU", \
+ "ISO646-IT", "ISO646-JP-OCR-B", "ISO646-JP", "ISO646-KR", "ISO646-NO", \
+ "ISO646-NO2", "ISO646-PT", "ISO646-PT2", "ISO646-SE", "ISO646-SE2", \
+ "ISO646-US", "ISO646-YU", "ISO2022CN", "ISO2022CNEXT", "ISO2022JP", \
+ "ISO2022JP2", "ISO2022KR", "ISO6937", "ISO8859-1", "ISO8859-2", \
+ "ISO8859-3", "ISO8859-4", "ISO8859-5", "ISO8859-6", "ISO8859-7", \
+ "ISO8859-8", "ISO8859-9", "ISO8859-9E", "ISO8859-10", "ISO8859-11", \
+ "ISO8859-13", "ISO8859-14", "ISO8859-15", "ISO8859-16", "ISO11548-1", \
+ "ISO88591", "ISO88592", "ISO88593", "ISO88594", "ISO88595", "ISO88596", \
+ "ISO88597", "ISO88598", "ISO88599", "ISO88599E", "ISO885910", \
+ "ISO885911", "ISO885913", "ISO885914", "ISO885915", "ISO885916", \
+ "ISO_646.IRV:1991", "ISO_2033-1983", "ISO_2033", "ISO_5427-EXT", \
+ "ISO_5427", "ISO_5427:1981", "ISO_5427EXT", "ISO_5428", "ISO_5428:1980", \
+ "ISO_6937-2", "ISO_6937-2:1983", "ISO_6937", "ISO_6937:1992", \
+ "ISO_8859-1", "ISO_8859-1:1987", "ISO_8859-2", "ISO_8859-2:1987", \
+ "ISO_8859-3", "ISO_8859-3:1988", "ISO_8859-4", "ISO_8859-4:1988", \
+ "ISO_8859-5", "ISO_8859-5:1988", "ISO_8859-6", "ISO_8859-6:1987", \
+ "ISO_8859-7", "ISO_8859-7:1987", "ISO_8859-7:2003", "ISO_8859-8", \
+ "ISO_8859-8:1988", "ISO_8859-9", "ISO_8859-9:1989", "ISO_8859-9E", \
+ "ISO_8859-10", "ISO_8859-10:1992", "ISO_8859-14", "ISO_8859-14:1998", \
+ "ISO_8859-15", "ISO_8859-15:1998", "ISO_8859-16", "ISO_8859-16:2001", \
+ "ISO_9036", "ISO_10367-BOX", "ISO_10367BOX", "ISO_11548-1", "ISO_69372", \
+ "IT", "JIS_C6220-1969-RO", "JIS_C6229-1984-B", "JIS_C62201969RO", \
+ "JIS_C62291984B", "JOHAB", "JP-OCR-B", "JP", "JS", "JUS_I.B1.002", \
+ "KOI-7", "KOI-8", "KOI8-R", "KOI8-RU", "KOI8-T", "KOI8-U", "KOI8", \
+ "KOI8R", "KOI8U", "KSC5636", "L1", "L2", "L3", "L4", "L5", "L6", "L7", \
+ "L8", "L10", "LATIN-9", "LATIN-GREEK-1", "LATIN-GREEK", "LATIN1", \
+ "LATIN2", "LATIN3", "LATIN4", "LATIN5", "LATIN6", "LATIN7", "LATIN8", \
+ "LATIN10", "LATINGREEK", "LATINGREEK1", "MAC-CENTRALEUROPE", \
+ "MAC-CYRILLIC", "MAC-IS", "MAC-SAMI", "MAC-UK", "MAC", "MACCYRILLIC", \
+ "MACINTOSH", "MACIS", "MACUK", "MACUKRAINIAN", "MIK", "MS-ANSI", \
+ "MS-ARAB", "MS-CYRL", "MS-EE", "MS-GREEK", "MS-HEBR", "MS-MAC-CYRILLIC", \
+ "MS-TURK", "MS932", "MS936", "MSCP949", "MSCP1361", "MSMACCYRILLIC", \
+ "MSZ_7795.3", "MS_KANJI", "NAPLPS", "NATS-DANO", "NATS-SEFI", "NATSDANO", \
+ "NATSSEFI", "NC_NC0010", "NC_NC00-10", "NC_NC00-10:81", "NF_Z_62-010", \
+ "NF_Z_62-010_(1973)", "NF_Z_62-010_1973", "NF_Z_62010", \
+ "NF_Z_62010_1973", "NO", "NO2", "NS_4551-1", "NS_4551-2", "NS_45511", \
+ "NS_45512", "OS2LATIN1", "OSF00010001", "OSF00010002", "OSF00010003", \
+ "OSF00010004", "OSF00010005", "OSF00010006", "OSF00010007", \
+ "OSF00010008", "OSF00010009", "OSF0001000A", "OSF00010020", \
+ "OSF00010100", "OSF00010101", "OSF00010102", "OSF00010104", \
+ "OSF00010105", "OSF00010106", "OSF00030010", "OSF0004000A", \
+ "OSF0005000A", "OSF05010001", "OSF100201A4", "OSF100201A8", \
+ "OSF100201B5", "OSF100201F4", "OSF100203B5", "OSF1002011C", \
+ "OSF1002011D", "OSF1002035D", "OSF1002035E", "OSF1002035F", \
+ "OSF1002036B", "OSF1002037B", "OSF10010001", "OSF10010004", \
+ "OSF10010006", "OSF10020025", "OSF10020111", "OSF10020115", \
+ "OSF10020116", "OSF10020118", "OSF10020122", "OSF10020129", \
+ "OSF10020352", "OSF10020354", "OSF10020357", "OSF10020359", \
+ "OSF10020360", "OSF10020364", "OSF10020365", "OSF10020366", \
+ "OSF10020367", "OSF10020370", "OSF10020387", "OSF10020388", \
+ "OSF10020396", "OSF10020402", "OSF10020417", "PT", "PT2", "PT154", "R8", \
+ "R9", "RK1048", "ROMAN8", "ROMAN9", "RUSCII", "SE", "SE2", \
+ "SEN_850200_B", "SEN_850200_C", "SHIFT-JIS", "SHIFT_JIS", \
+ "SHIFT_JISX0213", "SJIS-OPEN", "SJIS-WIN", "SJIS", "SS636127", \
+ "STRK1048-2002", "ST_SEV_358-88", "T.61-8BIT", "T.61", "T.618BIT", \
+ "TCVN-5712", "TCVN", "TCVN5712-1", "TCVN5712-1:1993", "THAI8", "TIS-620", \
+ "TIS620-0", "TIS620.2529-1", "TIS620.2533-0", "TIS620", "TS-5881", \
+ "TSCII", "TURKISH8", "UCS-2", "UCS-2BE", "UCS-2LE", "UCS-4", "UCS-4BE", \
+ "UCS-4LE", "UCS2", "UCS4", "UHC", "UJIS", "UK", "UNICODE", "UNICODEBIG", \
+ "UNICODELITTLE", "US-ASCII", "US", "UTF-7", "UTF-8", "UTF-16", \
+ "UTF-16BE", "UTF-16LE", "UTF-32", "UTF-32BE", "UTF-32LE", "UTF7", "UTF8", \
+ "UTF16", "UTF16BE", "UTF16LE", "UTF32", "UTF32BE", "UTF32LE", "VISCII", \
+ "WCHAR_T", "WIN-SAMI-2", "WINBALTRIM", "WINDOWS-31J", "WINDOWS-874", \
+ "WINDOWS-936", "WINDOWS-1250", "WINDOWS-1251", "WINDOWS-1252", \
+ "WINDOWS-1253", "WINDOWS-1254", "WINDOWS-1255", "WINDOWS-1256", \
+ "WINDOWS-1257", "WINDOWS-1258", "WINSAMI2", "WS2", "YU",
#endif /* CHARSET_LIST_H */
diff --git a/gdb/charset.c b/gdb/charset.c
index bce6050c97f..652cfb10d7d 100644
--- a/gdb/charset.c
+++ b/gdb/charset.c
@@ -31,7 +31,7 @@
#ifdef USE_WIN32API
#include <windows.h>
#endif
-
+
/* How GDB's character set support works
GDB has three global settings:
@@ -69,7 +69,6 @@
GDB simply requires a capable iconv function. Users on platforms
without a suitable iconv can use the GNU iconv library. */
-
#ifdef PHONY_ICONV
/* Provide a phony iconv that does as little as possible. Also,
@@ -77,14 +76,14 @@
#undef GDB_DEFAULT_HOST_CHARSET
#ifdef USE_WIN32API
-# define GDB_DEFAULT_HOST_CHARSET "CP1252"
+#define GDB_DEFAULT_HOST_CHARSET "CP1252"
#else
-# define GDB_DEFAULT_HOST_CHARSET "ISO-8859-1"
+#define GDB_DEFAULT_HOST_CHARSET "ISO-8859-1"
#endif
-#define GDB_DEFAULT_TARGET_CHARSET GDB_DEFAULT_HOST_CHARSET
+#define GDB_DEFAULT_TARGET_CHARSET GDB_DEFAULT_HOST_CHARSET
#define GDB_DEFAULT_TARGET_WIDE_CHARSET "UTF-32"
#undef DEFAULT_CHARSET_NAMES
-#define DEFAULT_CHARSET_NAMES GDB_DEFAULT_HOST_CHARSET ,
+#define DEFAULT_CHARSET_NAMES GDB_DEFAULT_HOST_CHARSET,
#undef iconv_t
#define iconv_t int
@@ -138,7 +137,7 @@ phony_iconv (iconv_t utf_flag, const char **inbuf, size_t *inbytesleft,
while (*inbytesleft >= 4)
{
unsigned long c
- = extract_unsigned_integer ((const gdb_byte *)*inbuf, 4, endian);
+ = extract_unsigned_integer ((const gdb_byte *) *inbuf, 4, endian);
if (c >= 256)
{
@@ -212,10 +211,8 @@ gdb_iconv (iconv_t utf_flag, ICONV_CONST char **inbuf, size_t *inbytesleft,
#endif /* PHONY_ICONV */
-
/* The global lists of character sets and translations. */
-
#ifndef GDB_DEFAULT_TARGET_CHARSET
#define GDB_DEFAULT_TARGET_CHARSET "ISO-8859-1"
#endif
@@ -226,60 +223,53 @@ gdb_iconv (iconv_t utf_flag, ICONV_CONST char **inbuf, size_t *inbytesleft,
static const char *auto_host_charset_name = GDB_DEFAULT_HOST_CHARSET;
static const char *host_charset_name = "auto";
+
static void
show_host_charset_name (struct ui_file *file, int from_tty,
- struct cmd_list_element *c,
- const char *value)
+ struct cmd_list_element *c, const char *value)
{
if (!strcmp (value, "auto"))
gdb_printf (file,
- _("The host character set is \"auto; currently %s\".\n"),
+ _ ("The host character set is \"auto; currently %s\".\n"),
auto_host_charset_name);
else
- gdb_printf (file, _("The host character set is \"%s\".\n"), value);
+ gdb_printf (file, _ ("The host character set is \"%s\".\n"), value);
}
static const char *target_charset_name = "auto";
+
static void
show_target_charset_name (struct ui_file *file, int from_tty,
struct cmd_list_element *c, const char *value)
{
if (!strcmp (value, "auto"))
gdb_printf (file,
- _("The target character set is \"auto; "
- "currently %s\".\n"),
+ _ ("The target character set is \"auto; "
+ "currently %s\".\n"),
gdbarch_auto_charset (get_current_arch ()));
else
- gdb_printf (file, _("The target character set is \"%s\".\n"),
- value);
+ gdb_printf (file, _ ("The target character set is \"%s\".\n"), value);
}
static const char *target_wide_charset_name = "auto";
+
static void
-show_target_wide_charset_name (struct ui_file *file,
- int from_tty,
- struct cmd_list_element *c,
- const char *value)
+show_target_wide_charset_name (struct ui_file *file, int from_tty,
+ struct cmd_list_element *c, const char *value)
{
if (!strcmp (value, "auto"))
gdb_printf (file,
- _("The target wide character set is \"auto; "
- "currently %s\".\n"),
+ _ ("The target wide character set is \"auto; "
+ "currently %s\".\n"),
gdbarch_auto_wide_charset (get_current_arch ()));
else
- gdb_printf (file, _("The target wide character set is \"%s\".\n"),
- value);
+ gdb_printf (file, _ ("The target wide character set is \"%s\".\n"), value);
}
-static const char * const default_charset_names[] =
-{
- DEFAULT_CHARSET_NAMES
- 0
-};
+static const char *const default_charset_names[] = { DEFAULT_CHARSET_NAMES 0 };
-static const char * const *charset_enum;
+static const char *const *charset_enum;
-
/* If the target wide character set has big- or little-endian
variants, these are the corresponding names. */
static const char *target_wide_charset_be_name;
@@ -318,8 +308,7 @@ set_be_le_names (struct gdbarch *gdbarch)
{
if (strncmp (target_wide, charset_enum[i], len))
continue;
- if ((charset_enum[i][len] == 'B'
- || charset_enum[i][len] == 'L')
+ if ((charset_enum[i][len] == 'B' || charset_enum[i][len] == 'L')
&& charset_enum[i][len + 1] == 'E'
&& charset_enum[i][len + 2] == '\0')
{
@@ -329,7 +318,7 @@ set_be_le_names (struct gdbarch *gdbarch)
target_wide_charset_le_name = charset_enum[i];
}
}
-# endif /* PHONY_ICONV */
+#endif /* PHONY_ICONV */
}
/* 'Set charset', 'set host-charset', 'set target-charset', 'set
@@ -348,13 +337,13 @@ validate (struct gdbarch *gdbarch)
desc = iconv_open (target_wide_cset, host_cset);
if (desc == (iconv_t) -1)
- error (_("Cannot convert between character sets `%s' and `%s'"),
+ error (_ ("Cannot convert between character sets `%s' and `%s'"),
target_wide_cset, host_cset);
iconv_close (desc);
desc = iconv_open (target_cset, host_cset);
if (desc == (iconv_t) -1)
- error (_("Cannot convert between character sets `%s' and `%s'"),
+ error (_ ("Cannot convert between character sets `%s' and `%s'"),
target_cset, host_cset);
iconv_close (desc);
@@ -364,7 +353,7 @@ validate (struct gdbarch *gdbarch)
/* This is the sfunc for the 'set charset' command. */
static void
-set_charset_sfunc (const char *charset, int from_tty,
+set_charset_sfunc (const char *charset, int from_tty,
struct cmd_list_element *c)
{
/* CAREFUL: set the target charset here as well. */
@@ -399,17 +388,14 @@ set_target_wide_charset_sfunc (const char *charset, int from_tty,
/* sfunc for the 'show charset' command. */
static void
-show_charset (struct ui_file *file, int from_tty,
- struct cmd_list_element *c,
+show_charset (struct ui_file *file, int from_tty, struct cmd_list_element *c,
const char *name)
{
show_host_charset_name (file, from_tty, c, host_charset_name);
show_target_charset_name (file, from_tty, c, target_charset_name);
- show_target_wide_charset_name (file, from_tty, c,
- target_wide_charset_name);
+ show_target_wide_charset_name (file, from_tty, c, target_wide_charset_name);
}
-
/* Accessor functions. */
const char *
@@ -451,7 +437,6 @@ target_wide_charset (struct gdbarch *gdbarch)
return target_wide_charset_name;
}
-
/* Host character set management. For the time being, we assume that
the host character set is some superset of ASCII. */
@@ -463,7 +448,6 @@ host_letter_to_control_character (char c)
return c & 0237;
}
-
/* Public character management functions. */
class iconv_wrapper
@@ -474,13 +458,10 @@ public:
{
m_desc = iconv_open (to, from);
if (m_desc == (iconv_t) -1)
- perror_with_name (_("Converting character sets"));
+ perror_with_name (_ ("Converting character sets"));
}
- ~iconv_wrapper ()
- {
- iconv_close (m_desc);
- }
+ ~iconv_wrapper () { iconv_close (m_desc); }
size_t convert (ICONV_CONST char **inp, size_t *inleft, char **outp,
size_t *outleft)
@@ -545,8 +526,9 @@ convert_between_encodings (const char *from, const char *to,
/* Invalid input sequence. */
if (translit == translit_none)
- error (_("Could not convert character "
- "to `%s' character set"), to);
+ error (_ ("Could not convert character "
+ "to `%s' character set"),
+ to);
/* We emit escape sequence for the bytes, skip them,
and try again. */
@@ -576,26 +558,24 @@ convert_between_encodings (const char *from, const char *to,
break;
default:
- perror_with_name (_("Internal error while "
- "converting character sets"));
+ perror_with_name (_ ("Internal error while "
+ "converting character sets"));
}
}
}
}
-
-
/* Create a new iterator. */
-wchar_iterator::wchar_iterator (const gdb_byte *input, size_t bytes,
+wchar_iterator::wchar_iterator (const gdb_byte *input, size_t bytes,
const char *charset, size_t width)
-: m_input (input),
- m_bytes (bytes),
- m_width (width),
- m_out (1)
+ : m_input (input),
+ m_bytes (bytes),
+ m_width (width),
+ m_out (1)
{
m_desc = iconv_open (INTERMEDIATE_ENCODING, charset);
if (m_desc == (iconv_t) -1)
- perror_with_name (_("Converting character sets"));
+ perror_with_name (_ ("Converting character sets"));
}
wchar_iterator::~wchar_iterator ()
@@ -606,8 +586,7 @@ wchar_iterator::~wchar_iterator ()
int
wchar_iterator::iterate (enum wchar_iterate_result *out_result,
- gdb_wchar_t **out_chars,
- const gdb_byte **ptr,
+ gdb_wchar_t **out_chars, const gdb_byte **ptr,
size_t *len)
{
size_t out_request;
@@ -639,7 +618,7 @@ wchar_iterator::iterate (enum wchar_iterate_result *out_result,
converted a character; if so, return it. */
if (out_avail < out_request * sizeof (gdb_wchar_t))
break;
-
+
/* Otherwise skip the first invalid character, and let
the caller know about it. */
*out_result = wchar_iterate_invalid;
@@ -671,8 +650,8 @@ wchar_iterator::iterate (enum wchar_iterate_result *out_result,
return 0;
default:
- perror_with_name (_("Internal error while "
- "converting character sets"));
+ perror_with_name (_ ("Internal error while "
+ "converting character sets"));
}
}
@@ -732,7 +711,7 @@ find_charset_names (void)
So, configure may see libiconvlist but not iconvlist. But, calling
iconvlist is the right thing to do and will work. Hence we do a
check here but unconditionally call iconvlist below. */
-#if defined (HAVE_ICONVLIST) || defined (HAVE_LIBICONVLIST)
+#if defined(HAVE_ICONVLIST) || defined(HAVE_LIBICONVLIST)
/* A helper function that adds some character sets to the vector of
all character sets. This is a callback function for iconvlist. */
@@ -768,14 +747,9 @@ ignore_line_p (const char *line)
{
/* This table is used to filter the output. If this text appears
anywhere in the line, it is ignored (strstr is used). */
- static const char * const ignore_lines[] =
- {
- "The following",
- "not necessarily",
- "the FROM and TO",
- "listed with several",
- NULL
- };
+ static const char *const ignore_lines[]
+ = { "The following", "not necessarily", "the FROM and TO",
+ "listed with several", NULL };
int i;
for (i = 0; ignore_lines[i] != NULL; ++i)
@@ -808,10 +782,10 @@ find_charset_names (void)
#ifdef ICONV_BIN
{
- std::string iconv_dir = relocate_gdb_directory (ICONV_BIN,
- ICONV_BIN_RELOCATABLE);
+ std::string iconv_dir
+ = relocate_gdb_directory (ICONV_BIN, ICONV_BIN_RELOCATABLE);
iconv_program
- = concat (iconv_dir.c_str(), SLASH_STRING, "iconv", (char *) NULL);
+ = concat (iconv_dir.c_str (), SLASH_STRING, "iconv", (char *) NULL);
}
#else
iconv_program = xstrdup ("iconv");
@@ -824,9 +798,8 @@ find_charset_names (void)
flags |= PEX_SEARCH;
#endif
/* Note that we simply ignore errors here. */
- if (!pex_run_in_environment (child, flags,
- args[0], const_cast<char **> (args),
- iconv_env.envp (),
+ if (!pex_run_in_environment (child, flags, args[0],
+ const_cast<char **> (args), iconv_env.envp (),
NULL, NULL, &err))
{
FILE *in = pex_read_output (child, 0);
@@ -876,7 +849,7 @@ find_charset_names (void)
;
start = p;
/* Find the next space, comma, or end-of-line. */
- for ( ; *p && *p != ' ' && *p != ','; ++p)
+ for (; *p && *p != ' ' && *p != ','; ++p)
;
/* Ignore an empty result. */
if (p == start)
@@ -892,10 +865,9 @@ find_charset_names (void)
}
}
- if (pex_get_status (child, 1, &status)
- && WIFEXITED (status) && !WEXITSTATUS (status))
+ if (pex_get_status (child, 1, &status) && WIFEXITED (status)
+ && !WEXITSTATUS (status))
fail = 0;
-
}
xfree (iconv_program);
@@ -928,7 +900,6 @@ default_auto_wide_charset (void)
return GDB_DEFAULT_TARGET_WIDE_CHARSET;
}
-
#ifdef USE_INTERMEDIATE_ENCODING_FUNCTION
/* Macro used for UTF or UCS endianness suffix. */
#if WORDS_BIGENDIAN
@@ -956,8 +927,8 @@ intermediate_encoding (void)
if (stored_result)
return stored_result;
- result = xstrprintf ("UTF-%d%s", (int) (sizeof (gdb_wchar_t) * 8),
- ENDIAN_SUFFIX);
+ result
+ = xstrprintf ("UTF-%d%s", (int) (sizeof (gdb_wchar_t) * 8), ENDIAN_SUFFIX);
/* Check that the name is supported by iconv_open. */
desc = iconv_open (result.get (), host_charset ());
if (desc != (iconv_t) -1)
@@ -967,8 +938,7 @@ intermediate_encoding (void)
return stored_result;
}
/* Second try, with UCS-2 type. */
- result = xstrprintf ("UCS-%d%s", (int) sizeof (gdb_wchar_t),
- ENDIAN_SUFFIX);
+ result = xstrprintf ("UCS-%d%s", (int) sizeof (gdb_wchar_t), ENDIAN_SUFFIX);
/* Check that the name is supported by iconv_open. */
desc = iconv_open (result.get (), host_charset ());
if (desc != (iconv_t) -1)
@@ -978,12 +948,13 @@ intermediate_encoding (void)
return stored_result;
}
/* No valid charset found, generate error here. */
- error (_("Unable to find a valid charset for string conversions"));
+ error (_ ("Unable to find a valid charset for string conversions"));
}
#endif /* USE_INTERMEDIATE_ENCODING_FUNCTION */
void _initialize_charset ();
+
void
_initialize_charset ()
{
@@ -992,7 +963,7 @@ _initialize_charset ()
find_charset_names ();
if (charsets.charsets.size () > 1)
- charset_enum = (const char * const *) charsets.charsets.data ();
+ charset_enum = (const char *const *) charsets.charsets.data ();
else
charset_enum = default_charset_names;
@@ -1008,13 +979,13 @@ _initialize_charset ()
if (!strcmp (auto_host_charset_name, "646") || !*auto_host_charset_name)
auto_host_charset_name = "ASCII";
auto_target_charset_name = auto_host_charset_name;
-#elif defined (USE_WIN32API)
+#elif defined(USE_WIN32API)
{
/* "CP" + x<=5 digits + paranoia. */
static char w32_host_default_charset[16];
snprintf (w32_host_default_charset, sizeof w32_host_default_charset,
- "CP%d", GetACP());
+ "CP%d", GetACP ());
auto_host_charset_name = w32_host_default_charset;
auto_target_charset_name = auto_host_charset_name;
}
@@ -1024,10 +995,12 @@ _initialize_charset ()
/* Recall that the first element is always "auto". */
host_charset_name = charset_enum[0];
gdb_assert (strcmp (host_charset_name, "auto") == 0);
- add_setshow_enum_cmd ("charset", class_support,
- charset_enum, &host_charset_name, _("\
-Set the host and target character sets."), _("\
-Show the host and target character sets."), _("\
+ add_setshow_enum_cmd ("charset", class_support, charset_enum,
+ &host_charset_name, _ ("\
+Set the host and target character sets."),
+ _ ("\
+Show the host and target character sets."),
+ _ ("\
The `host character set' is the one used by the system GDB is running on.\n\
The `target character set' is the one used by the program being debugged.\n\
You may only use supersets of ASCII for your host character set; GDB does\n\
@@ -1036,45 +1009,46 @@ To see a list of the character sets GDB supports, type `set charset <TAB>'."),
/* Note that the sfunc below needs to set
target_charset_name, because the 'set
charset' command sets two variables. */
- set_charset_sfunc,
- show_charset,
- &setlist, &showlist);
-
- add_setshow_enum_cmd ("host-charset", class_support,
- charset_enum, &host_charset_name, _("\
-Set the host character set."), _("\
-Show the host character set."), _("\
+ set_charset_sfunc, show_charset, &setlist, &showlist);
+
+ add_setshow_enum_cmd ("host-charset", class_support, charset_enum,
+ &host_charset_name, _ ("\
+Set the host character set."),
+ _ ("\
+Show the host character set."),
+ _ ("\
The `host character set' is the one used by the system GDB is running on.\n\
You may only use supersets of ASCII for your host character set; GDB does\n\
not support any others.\n\
To see a list of the character sets GDB supports, type `set host-charset <TAB>'."),
- set_host_charset_sfunc,
- show_host_charset_name,
+ set_host_charset_sfunc, show_host_charset_name,
&setlist, &showlist);
/* Recall that the first element is always "auto". */
target_charset_name = charset_enum[0];
gdb_assert (strcmp (target_charset_name, "auto") == 0);
- add_setshow_enum_cmd ("target-charset", class_support,
- charset_enum, &target_charset_name, _("\
-Set the target character set."), _("\
-Show the target character set."), _("\
+ add_setshow_enum_cmd ("target-charset", class_support, charset_enum,
+ &target_charset_name, _ ("\
+Set the target character set."),
+ _ ("\
+Show the target character set."),
+ _ ("\
The `target character set' is the one used by the program being debugged.\n\
GDB translates characters and strings between the host and target\n\
character sets as needed.\n\
To see a list of the character sets GDB supports, type `set target-charset'<TAB>"),
- set_target_charset_sfunc,
- show_target_charset_name,
+ set_target_charset_sfunc, show_target_charset_name,
&setlist, &showlist);
/* Recall that the first element is always "auto". */
target_wide_charset_name = charset_enum[0];
gdb_assert (strcmp (target_wide_charset_name, "auto") == 0);
- add_setshow_enum_cmd ("target-wide-charset", class_support,
- charset_enum, &target_wide_charset_name,
- _("\
-Set the target wide character set."), _("\
-Show the target wide character set."), _("\
+ add_setshow_enum_cmd ("target-wide-charset", class_support, charset_enum,
+ &target_wide_charset_name, _ ("\
+Set the target wide character set."),
+ _ ("\
+Show the target wide character set."),
+ _ ("\
The `target wide character set' is the one used by the program being debugged.\
\nIn particular it is the encoding used by `wchar_t'.\n\
GDB translates characters and strings between the host and target\n\
@@ -1082,6 +1056,5 @@ character sets as needed.\n\
To see a list of the character sets GDB supports, type\n\
`set target-wide-charset'<TAB>"),
set_target_wide_charset_sfunc,
- show_target_wide_charset_name,
- &setlist, &showlist);
+ show_target_wide_charset_name, &setlist, &showlist);
}
diff --git a/gdb/charset.h b/gdb/charset.h
index 52194547b0c..64aa5be9365 100644
--- a/gdb/charset.h
+++ b/gdb/charset.h
@@ -41,12 +41,12 @@ const char *target_wide_charset (struct gdbarch *gdbarch);
/* These values are used to specify the type of transliteration done
by convert_between_encodings. */
enum transliterations
- {
- /* Error on failure to convert. */
- translit_none,
- /* Transliterate to host char. */
- translit_char
- };
+{
+ /* Error on failure to convert. */
+ translit_none,
+ /* Transliterate to host char. */
+ translit_char
+};
/* Convert between two encodings.
@@ -64,29 +64,27 @@ enum transliterations
TRANSLIT specifies how invalid conversions should be handled. */
void convert_between_encodings (const char *from, const char *to,
- const gdb_byte *bytes,
- unsigned int num_bytes,
+ const gdb_byte *bytes, unsigned int num_bytes,
int width, struct obstack *output,
enum transliterations translit);
-
/* These values are used by wchar_iterate to report errors. */
enum wchar_iterate_result
- {
- /* Ordinary return. */
- wchar_iterate_ok,
- /* Invalid input sequence. */
- wchar_iterate_invalid,
- /* Incomplete input sequence at the end of the input. */
- wchar_iterate_incomplete,
- /* EOF. */
- wchar_iterate_eof
- };
+{
+ /* Ordinary return. */
+ wchar_iterate_ok,
+ /* Invalid input sequence. */
+ wchar_iterate_invalid,
+ /* Incomplete input sequence at the end of the input. */
+ wchar_iterate_incomplete,
+ /* EOF. */
+ wchar_iterate_eof
+};
/* An iterator that returns host wchar_t's from a target string. */
class wchar_iterator
{
- public:
+public:
/* Create a new character iterator which returns wchar_t's. INPUT is
the input buffer. BYTES is the number of bytes in the input
@@ -126,7 +124,7 @@ class wchar_iterator
int iterate (enum wchar_iterate_result *out_result, gdb_wchar_t **out_chars,
const gdb_byte **ptr, size_t *len);
- private:
+private:
/* The underlying iconv descriptor. */
#ifdef PHONY_ICONV
@@ -147,8 +145,6 @@ class wchar_iterator
gdb::def_vector<gdb_wchar_t> m_out;
};
-
-
/* GDB needs to know a few details of its execution character set.
This knowledge is isolated here and in charset.c. */
diff --git a/gdb/cli-out.c b/gdb/cli-out.c
index fdfd0f7f0cf..9755bfc0664 100644
--- a/gdb/cli-out.c
+++ b/gdb/cli-out.c
@@ -73,8 +73,7 @@ cli_ui_out::do_table_header (int width, ui_align alignment,
if (m_suppress_output)
return;
- do_field_string (0, width, alignment, 0, col_hdr.c_str (),
- ui_file_style ());
+ do_field_string (0, width, alignment, 0, col_hdr.c_str (), ui_file_style ());
}
/* Mark beginning of a list */
@@ -126,8 +125,7 @@ cli_ui_out::do_field_skip (int fldno, int width, ui_align alignment,
if (m_suppress_output)
return;
- do_field_string (fldno, width, alignment, fldname, "",
- ui_file_style ());
+ do_field_string (fldno, width, alignment, fldname, "", ui_file_style ());
}
/* other specific cli_field_* end up here so alignment and field
@@ -219,8 +217,8 @@ cli_ui_out::do_text (const char *string)
}
void
-cli_ui_out::do_message (const ui_file_style &style,
- const char *format, va_list args)
+cli_ui_out::do_message (const ui_file_style &style, const char *format,
+ va_list args)
{
if (m_suppress_output)
return;
@@ -294,8 +292,7 @@ cli_ui_out::do_progress_start ()
*/
void
-cli_ui_out::do_progress_notify (const std::string &msg,
- const char *unit,
+cli_ui_out::do_progress_notify (const std::string &msg, const char *unit,
double howmuch, double total)
{
int chars_per_line = get_chars_per_line ();
@@ -307,8 +304,7 @@ cli_ui_out::do_progress_notify (const std::string &msg,
if (info.state == progress_update::START)
{
- if (stream->isatty ()
- && current_ui->input_interactive_p ()
+ if (stream->isatty () && current_ui->input_interactive_p ()
&& chars_per_line >= MIN_CHARS_PER_LINE)
{
gdb_printf (stream, "%s\n", msg.c_str ());
@@ -327,9 +323,8 @@ cli_ui_out::do_progress_notify (const std::string &msg,
if (total > 0 && howmuch >= 0 && howmuch <= 1.0)
{
- std::string progress = string_printf (" %3.f%% (%.2f %s)",
- howmuch * 100, total,
- unit);
+ std::string progress
+ = string_printf (" %3.f%% (%.2f %s)", howmuch * 100, total, unit);
int width = chars_per_line - progress.size () - 4;
int max = width * howmuch;
@@ -348,8 +343,8 @@ cli_ui_out::do_progress_notify (const std::string &msg,
else
{
using namespace std::chrono;
- milliseconds diff = duration_cast<milliseconds>
- (steady_clock::now () - info.last_update);
+ milliseconds diff = duration_cast<milliseconds> (steady_clock::now ()
+ - info.last_update);
/* Advance the progress indicator at a rate of 1 tick every
every 0.5 seconds. */
@@ -360,8 +355,7 @@ cli_ui_out::do_progress_notify (const std::string &msg,
gdb_printf (stream, "\r[");
for (int i = 0; i < width; ++i)
{
- if (i == info.pos % width
- || i == (info.pos + 1) % width
+ if (i == info.pos % width || i == (info.pos + 1) % width
|| i == (info.pos + 2) % width)
gdb_printf (stream, "#");
else
@@ -387,8 +381,7 @@ cli_ui_out::clear_current_line ()
struct ui_file *stream = m_streams.back ();
int chars_per_line = get_chars_per_line ();
- if (!stream->isatty ()
- || !current_ui->input_interactive_p ()
+ if (!stream->isatty () || !current_ui->input_interactive_p ()
|| chars_per_line < MIN_CHARS_PER_LINE)
return;
@@ -427,17 +420,15 @@ cli_ui_out::field_separator ()
/* Constructor for cli_ui_out. */
cli_ui_out::cli_ui_out (ui_file *stream, ui_out_flags flags)
-: ui_out (flags),
- m_suppress_output (false)
+ : ui_out (flags),
+ m_suppress_output (false)
{
gdb_assert (stream != NULL);
m_streams.push_back (stream);
}
-cli_ui_out::~cli_ui_out ()
-{
-}
+cli_ui_out::~cli_ui_out () {}
ui_file *
cli_ui_out::set_stream (struct ui_file *stream)
diff --git a/gdb/cli-out.h b/gdb/cli-out.h
index 0729834cbc6..db84669945b 100644
--- a/gdb/cli-out.h
+++ b/gdb/cli-out.h
@@ -51,34 +51,31 @@ protected:
virtual void do_field_signed (int fldno, int width, ui_align align,
const char *fldname, LONGEST value) override;
virtual void do_field_unsigned (int fldno, int width, ui_align align,
- const char *fldname, ULONGEST value)
- override;
+ const char *fldname,
+ ULONGEST value) override;
virtual void do_field_skip (int fldno, int width, ui_align align,
const char *fldname) override;
virtual void do_field_string (int fldno, int width, ui_align align,
- const char *fldname,
- const char *string,
+ const char *fldname, const char *string,
const ui_file_style &style) override;
virtual void do_field_fmt (int fldno, int width, ui_align align,
const char *fldname, const ui_file_style &style,
- const char *format, va_list args)
- override ATTRIBUTE_PRINTF (7, 0);
+ const char *format, va_list args) override
+ ATTRIBUTE_PRINTF (7, 0);
virtual void do_spaces (int numspaces) override;
virtual void do_text (const char *string) override;
- virtual void do_message (const ui_file_style &style,
- const char *format, va_list args) override
- ATTRIBUTE_PRINTF (3,0);
+ virtual void do_message (const ui_file_style &style, const char *format,
+ va_list args) override ATTRIBUTE_PRINTF (3, 0);
virtual void do_wrap_hint (int indent) override;
virtual void do_flush () override;
virtual void do_redirect (struct ui_file *outstream) override;
virtual void do_progress_start () override;
- virtual void do_progress_notify (const std::string &, const char *,
- double, double) override;
+ virtual void do_progress_notify (const std::string &, const char *, double,
+ double) override;
virtual void do_progress_end () override;
- bool suppress_output ()
- { return m_suppress_output; }
+ bool suppress_output () { return m_suppress_output; }
private:
@@ -98,8 +95,10 @@ private:
std::chrono::steady_clock::time_point last_update;
cli_progress_info ()
- : pos (0), state (progress_update::START)
- {}
+ : pos (0),
+ state (progress_update::START)
+ {
+ }
};
/* Stack of progress info. */
diff --git a/gdb/cli/cli-cmds.c b/gdb/cli/cli-cmds.c
index 6c0d780face..6f3a2b189c1 100644
--- a/gdb/cli/cli-cmds.c
+++ b/gdb/cli/cli-cmds.c
@@ -21,17 +21,17 @@
#include "arch-utils.h"
#include "readline/tilde.h"
#include "completer.h"
-#include "target.h" /* For baud_rate, remote_debug and remote_timeout. */
-#include "gdbsupport/gdb_wait.h" /* For shell escape implementation. */
+#include "target.h" /* For baud_rate, remote_debug and remote_timeout. */
+#include "gdbsupport/gdb_wait.h" /* For shell escape implementation. */
#include "gdbcmd.h"
-#include "gdbsupport/gdb_regex.h" /* Used by apropos_command. */
+#include "gdbsupport/gdb_regex.h" /* Used by apropos_command. */
#include "gdb_vfork.h"
#include "linespec.h"
#include "expression.h"
#include "frame.h"
#include "value.h"
#include "language.h"
-#include "filenames.h" /* For DOSish file names. */
+#include "filenames.h" /* For DOSish file names. */
#include "objfiles.h"
#include "source.h"
#include "disasm.h"
@@ -57,7 +57,7 @@
#include "gdbsupport/gdb_tilde_expand.h"
#ifdef TUI
-#include "tui/tui.h" /* For tui_active et.al. */
+#include "tui/tui.h" /* For tui_active et.al. */
#endif
#include <fcntl.h>
@@ -74,7 +74,6 @@ static void ambiguous_line_spec (gdb::array_view<const symtab_and_line> sals,
static void filter_sals (std::vector<symtab_and_line> &);
-
/* See cli-cmds.h. */
unsigned int max_user_call_depth = 1024;
@@ -176,22 +175,17 @@ struct cmd_list_element *showsourcelist;
int source_verbose = 0;
bool trace_commands = false;
-
+
/* 'script-extension' option support. */
static const char script_ext_off[] = "off";
static const char script_ext_soft[] = "soft";
static const char script_ext_strict[] = "strict";
-static const char *const script_ext_enums[] = {
- script_ext_off,
- script_ext_soft,
- script_ext_strict,
- NULL
-};
+static const char *const script_ext_enums[]
+ = { script_ext_off, script_ext_soft, script_ext_strict, NULL };
static const char *script_ext_mode = script_ext_soft;
-
/* User-controllable flag to suppress event notification on CLI. */
@@ -203,7 +197,7 @@ static bool user_wants_cli_suppress_notification = false;
void
error_no_arg (const char *why)
{
- error (_("Argument required (%s)."), why);
+ error (_ ("Argument required (%s)."), why);
}
/* This implements the "info" prefix command. Normally such commands
@@ -220,29 +214,29 @@ info_command (const char *arg, int from_tty)
/* See cli/cli-cmds.h. */
void
-with_command_1 (const char *set_cmd_prefix,
- cmd_list_element *setlist, const char *args, int from_tty)
+with_command_1 (const char *set_cmd_prefix, cmd_list_element *setlist,
+ const char *args, int from_tty)
{
if (args == nullptr)
- error (_("Missing arguments."));
+ error (_ ("Missing arguments."));
const char *delim = strstr (args, "--");
const char *nested_cmd = nullptr;
if (delim == args)
- error (_("Missing setting before '--' delimiter"));
+ error (_ ("Missing setting before '--' delimiter"));
if (delim == nullptr || *skip_spaces (&delim[2]) == '\0')
nested_cmd = repeat_previous ();
- cmd_list_element *set_cmd = lookup_cmd (&args, setlist, set_cmd_prefix,
- nullptr,
- /*allow_unknown=*/ 0,
- /*ignore_help_classes=*/ 1);
+ cmd_list_element *set_cmd
+ = lookup_cmd (&args, setlist, set_cmd_prefix, nullptr,
+ /*allow_unknown=*/0,
+ /*ignore_help_classes=*/1);
gdb_assert (set_cmd != nullptr);
if (!set_cmd->var.has_value ())
- error (_("Cannot use this setting with the \"with\" command"));
+ error (_ ("Cannot use this setting with the \"with\" command"));
std::string temp_value
= (delim == nullptr ? args : std::string (args, delim - args));
@@ -274,7 +268,7 @@ with_command_1 (const char *set_cmd_prefix,
}
catch (const gdb_exception &ex2)
{
- warning (_("Couldn't restore setting: %s"), ex2.what ());
+ warning (_ ("Couldn't restore setting: %s"), ex2.what ());
}
throw;
@@ -288,8 +282,7 @@ with_command_1 (const char *set_cmd_prefix,
void
with_command_completer_1 (const char *set_cmd_prefix,
- completion_tracker &tracker,
- const char *text)
+ completion_tracker &tracker, const char *text)
{
tracker.set_use_custom_word_point (true);
@@ -297,9 +290,7 @@ with_command_completer_1 (const char *set_cmd_prefix,
/* If we're still not past the "--" delimiter, complete the "with"
command as if it was a "set" command. */
- if (delim == text
- || delim == nullptr
- || !isspace (delim[-1])
+ if (delim == text || delim == nullptr || !isspace (delim[-1])
|| !(isspace (delim[2]) || delim[2] == '\0'))
{
std::string new_text = std::string (set_cmd_prefix) + text;
@@ -326,10 +317,10 @@ with_command (const char *args, int from_tty)
static void
with_command_completer (struct cmd_list_element *ignore,
- completion_tracker &tracker,
- const char *text, const char * /*word*/)
+ completion_tracker &tracker, const char *text,
+ const char * /*word*/)
{
- with_command_completer_1 ("set ", tracker, text);
+ with_command_completer_1 ("set ", tracker, text);
}
/* Look up the contents of TEXT as a command usable with default args.
@@ -346,13 +337,13 @@ lookup_cmd_for_default_args (const char **text,
struct cmd_list_element *lcmd;
if (*text == nullptr || skip_spaces (*text) == nullptr)
- error (_("ALIAS missing."));
+ error (_ ("ALIAS missing."));
/* We first use lookup_cmd to verify TEXT unambiguously identifies
a command. */
lcmd = lookup_cmd (text, cmdlist, "", NULL,
- /*allow_unknown=*/ 0,
- /*ignore_help_classes=*/ 1);
+ /*allow_unknown=*/0,
+ /*ignore_help_classes=*/1);
/* Note that we accept default args for prefix commands,
as a prefix command can also be a valid usable
@@ -369,9 +360,8 @@ lookup_cmd_for_default_args (const char **text,
has specified an alias, and find the possible prefix_cmd
of cmd. */
struct cmd_list_element *alias, *cmd;
- lookup_cmd_composition
- (std::string (orig_text, *text - orig_text).c_str (),
- &alias, prefix_cmd, &cmd);
+ lookup_cmd_composition (std::string (orig_text, *text - orig_text).c_str (),
+ &alias, prefix_cmd, &cmd);
gdb_assert (cmd != nullptr);
gdb_assert (cmd == lcmd);
if (alias != nullptr)
@@ -388,7 +378,6 @@ help_command (const char *command, int from_tty)
{
help_cmd (command, gdb_stdout);
}
-
/* Note: The "complete" command is used by Emacs to implement completion.
[Is that why this function writes output with *_unfiltered?] */
@@ -404,8 +393,8 @@ complete_command (const char *arg, int from_tty)
be able to handle this. */
if (!current_uiout->is_mi_like_p ())
{
- printf_unfiltered (_("max-completions is zero,"
- " completion is disabled.\n"));
+ printf_unfiltered (_ ("max-completions is zero,"
+ " completion is disabled.\n"));
}
return;
}
@@ -423,15 +412,15 @@ complete_command (const char *arg, int from_tty)
std::string arg_prefix (arg, word - arg);
if (result.number_matches == 1)
- printf_unfiltered ("%s%s\n", arg_prefix.c_str (), result.match_list[0]);
+ printf_unfiltered ("%s%s\n", arg_prefix.c_str (),
+ result.match_list[0]);
else
{
result.sort_match_list ();
for (size_t i = 0; i < result.number_matches; i++)
{
- printf_unfiltered ("%s%s",
- arg_prefix.c_str (),
+ printf_unfiltered ("%s%s", arg_prefix.c_str (),
result.match_list[i + 1]);
if (quote_char)
printf_unfiltered ("%c", quote_char);
@@ -443,8 +432,7 @@ complete_command (const char *arg, int from_tty)
{
/* ARG_PREFIX and WORD are included in the output so that emacs
will include the message in the output. */
- printf_unfiltered (_("%s%s %s\n"),
- arg_prefix.c_str (), word,
+ printf_unfiltered (_ ("%s%s %s\n"), arg_prefix.c_str (), word,
get_max_completions_reached_message ());
}
}
@@ -486,7 +474,7 @@ quit_command (const char *args, int from_tty)
}
if (!quit_confirm ())
- error (_("Not confirmed."));
+ error (_ ("Not confirmed."));
try
{
@@ -510,23 +498,21 @@ static void
pwd_command (const char *args, int from_tty)
{
if (args)
- error (_("The \"pwd\" command does not take an argument: %s"), args);
+ error (_ ("The \"pwd\" command does not take an argument: %s"), args);
gdb::unique_xmalloc_ptr<char> cwd (getcwd (NULL, 0));
if (cwd == NULL)
- error (_("Error finding name of working directory: %s"),
+ error (_ ("Error finding name of working directory: %s"),
safe_strerror (errno));
if (strcmp (cwd.get (), current_directory) != 0)
- gdb_printf (_("Working directory %ps\n (canonically %ps).\n"),
- styled_string (file_name_style.style (),
- current_directory),
+ gdb_printf (_ ("Working directory %ps\n (canonically %ps).\n"),
+ styled_string (file_name_style.style (), current_directory),
styled_string (file_name_style.style (), cwd.get ()));
else
- gdb_printf (_("Working directory %ps.\n"),
- styled_string (file_name_style.style (),
- current_directory));
+ gdb_printf (_ ("Working directory %ps.\n"),
+ styled_string (file_name_style.style (), current_directory));
}
void
@@ -541,8 +527,8 @@ cd_command (const char *dir, int from_tty)
repeat might be useful but is more likely to be a mistake. */
dont_repeat ();
- gdb::unique_xmalloc_ptr<char> dir_holder
- (tilde_expand (dir != NULL ? dir : "~"));
+ gdb::unique_xmalloc_ptr<char> dir_holder (tilde_expand (dir != NULL ? dir
+ : "~"));
dir = dir_holder.get ();
if (chdir (dir) < 0)
@@ -561,11 +547,11 @@ cd_command (const char *dir, int from_tty)
{
/* Remove the trailing slash unless this is a root directory
(including a drive letter on non-Unix systems). */
- if (!(len == 1) /* "/" */
+ if (!(len == 1) /* "/" */
#ifdef HAVE_DOS_BASED_FILE_SYSTEM
&& !(len == 3 && dir[1] == ':') /* "d:/" */
#endif
- )
+ )
len--;
}
@@ -578,8 +564,8 @@ cd_command (const char *dir, int from_tty)
else
{
if (IS_DIR_SEPARATOR (current_directory[strlen (current_directory) - 1]))
- current_directory = concat (current_directory, dir_holder.get (),
- (char *) NULL);
+ current_directory
+ = concat (current_directory, dir_holder.get (), (char *) NULL);
else
current_directory = concat (current_directory, SLASH_STRING,
dir_holder.get (), (char *) NULL);
@@ -632,15 +618,14 @@ cd_command (const char *dir, int from_tty)
if (from_tty)
pwd_command ((char *) 0, 1);
}
-
+
/* Show the current value of the 'script-extension' option. */
static void
show_script_ext_mode (struct ui_file *file, int from_tty,
- struct cmd_list_element *c, const char *value)
+ struct cmd_list_element *c, const char *value)
{
- gdb_printf (file,
- _("Script filename extension recognition is \"%s\".\n"),
+ gdb_printf (file, _ ("Script filename extension recognition is \"%s\".\n"),
value);
}
@@ -668,8 +653,8 @@ find_and_open_script (const char *script_file, int search_path)
/* Search for and open 'file' on the search path used for source
files. Put the full location in *FULL_PATHP. */
gdb::unique_xmalloc_ptr<char> full_path;
- fd = openp (source_path.c_str (), search_flags,
- file.get (), O_RDONLY, &full_path);
+ fd = openp (source_path.c_str (), search_flags, file.get (), O_RDONLY,
+ &full_path);
if (fd == -1)
return opened;
@@ -708,8 +693,7 @@ source_script_from_stream (FILE *stream, const char *file,
{
if (ext_lang_present_p (extlang))
{
- script_sourcer_func *sourcer
- = ext_lang_script_sourcer (extlang);
+ script_sourcer_func *sourcer = ext_lang_script_sourcer (extlang);
gdb_assert (sourcer != NULL);
sourcer (extlang, stream, file_to_open);
@@ -736,9 +720,8 @@ source_script_from_stream (FILE *stream, const char *file,
static void
source_script_with_search (const char *file, int from_tty, int search_path)
{
-
if (file == NULL || *file == 0)
- error (_("source command requires file name of file to source."));
+ error (_ ("source command requires file name of file to source."));
gdb::optional<open_script> opened = find_and_open_script (file, search_path);
if (!opened)
@@ -831,7 +814,6 @@ source_command (const char *args, int from_tty)
source_script_with_search (file, from_tty, search_path);
}
-
static void
echo_command (const char *text, int from_tty)
{
@@ -890,14 +872,14 @@ exit_status_set_internal_vars (int exit_status)
else if (WIFSIGNALED (exit_status))
set_internalvar_integer (var_signal, WTERMSIG (exit_status));
else
- warning (_("unexpected shell command exit status %d"), exit_status);
+ warning (_ ("unexpected shell command exit status %d"), exit_status);
}
static void
shell_escape (const char *arg, int from_tty)
{
-#if defined(CANT_FORK) || \
- (!defined(HAVE_WORKING_VFORK) && !defined(HAVE_WORKING_FORK))
+#if defined(CANT_FORK) \
+ || (!defined(HAVE_WORKING_VFORK) && !defined(HAVE_WORKING_FORK))
/* If ARG is NULL, they want an inferior shell, but `system' just
reports if the shell is available when passed a NULL arg. */
int rc = system (arg ? arg : "");
@@ -916,7 +898,7 @@ shell_escape (const char *arg, int from_tty)
chdir (current_directory);
#endif
exit_status_set_internal_vars (rc);
-#else /* Can fork. */
+#else /* Can fork. */
int status, pid;
if ((pid = vfork ()) == 0)
@@ -941,7 +923,7 @@ shell_escape (const char *arg, int from_tty)
if (pid != -1)
waitpid (pid, &status, 0);
else
- error (_("Fork failed"));
+ error (_ ("Fork failed"));
exit_status_set_internal_vars (status);
#endif /* Can fork. */
}
@@ -974,7 +956,7 @@ edit_command (const char *arg, int from_tty)
if (arg == 0)
{
if (sal.symtab == 0)
- error (_("No default source file yet."));
+ error (_ ("No default source file yet."));
sal.line += get_lines_to_list () / 2;
}
else
@@ -983,15 +965,14 @@ edit_command (const char *arg, int from_tty)
/* Now should only be one argument -- decode it in SAL. */
arg1 = arg;
- location_spec_up locspec = string_to_location_spec (&arg1,
- current_language);
+ location_spec_up locspec
+ = string_to_location_spec (&arg1, current_language);
if (*arg1)
- error (_("Junk at end of line specification."));
+ error (_ ("Junk at end of line specification."));
- std::vector<symtab_and_line> sals = decode_line_1 (locspec.get (),
- DECODE_LINE_LIST_MODE,
- NULL, NULL, 0);
+ std::vector<symtab_and_line> sals
+ = decode_line_1 (locspec.get (), DECODE_LINE_LIST_MODE, NULL, NULL, 0);
filter_sals (sals);
if (sals.empty ())
@@ -1001,8 +982,7 @@ edit_command (const char *arg, int from_tty)
}
if (sals.size () > 1)
{
- ambiguous_line_spec (sals,
- _("Specified line is ambiguous:\n"));
+ ambiguous_line_spec (sals, _ ("Specified line is ambiguous:\n"));
return;
}
@@ -1017,29 +997,25 @@ edit_command (const char *arg, int from_tty)
struct gdbarch *gdbarch;
if (sal.symtab == 0)
- error (_("No source file for address %s."),
+ error (_ ("No source file for address %s."),
paddress (get_current_arch (), sal.pc));
gdbarch = sal.symtab->compunit ()->objfile ()->arch ();
sym = find_pc_function (sal.pc);
if (sym)
- gdb_printf ("%s is in %s (%s:%d).\n",
- paddress (gdbarch, sal.pc),
+ gdb_printf ("%s is in %s (%s:%d).\n", paddress (gdbarch, sal.pc),
sym->print_name (),
- symtab_to_filename_for_display (sal.symtab),
- sal.line);
+ symtab_to_filename_for_display (sal.symtab), sal.line);
else
- gdb_printf ("%s is at %s:%d.\n",
- paddress (gdbarch, sal.pc),
- symtab_to_filename_for_display (sal.symtab),
- sal.line);
+ gdb_printf ("%s is at %s:%d.\n", paddress (gdbarch, sal.pc),
+ symtab_to_filename_for_display (sal.symtab), sal.line);
}
/* If what was given does not imply a symtab, it must be an
undebuggable symbol which means no source code. */
if (sal.symtab == 0)
- error (_("No line number known for %s."), arg);
+ error (_ ("No line number known for %s."), arg);
}
if ((editor = getenv ("EDITOR")) == NULL)
@@ -1068,7 +1044,7 @@ static const gdb::option::option_def pipe_cmd_option_defs[] = {
"d",
[] (pipe_cmd_opts *opts) { return &opts->delimiter; },
nullptr,
- N_("Indicates to use the specified delimiter string to separate\n\
+ N_ ("Indicates to use the specified delimiter string to separate\n\
COMMAND from SHELL_COMMAND, in alternative to |. This is useful in\n\
case COMMAND contains a | character."),
},
@@ -1081,7 +1057,7 @@ case COMMAND contains a | character."),
static inline gdb::option::option_def_group
make_pipe_cmd_options_def_group (pipe_cmd_opts *opts)
{
- return {{pipe_cmd_option_defs}, opts};
+ return { { pipe_cmd_option_defs }, opts };
}
/* Implementation of the "pipe" command. */
@@ -1092,8 +1068,8 @@ pipe_command (const char *arg, int from_tty)
pipe_cmd_opts opts;
auto grp = make_pipe_cmd_options_def_group (&opts);
- gdb::option::process_options
- (&arg, gdb::option::PROCESS_OPTIONS_UNKNOWN_IS_OPERAND, grp);
+ gdb::option::process_options (
+ &arg, gdb::option::PROCESS_OPTIONS_UNKNOWN_IS_OPERAND, grp);
const char *delim = "|";
if (!opts.delimiter.empty ())
@@ -1101,12 +1077,12 @@ pipe_command (const char *arg, int from_tty)
const char *command = arg;
if (command == nullptr)
- error (_("Missing COMMAND"));
+ error (_ ("Missing COMMAND"));
arg = strstr (arg, delim);
if (arg == nullptr)
- error (_("Missing delimiter before SHELL_COMMAND"));
+ error (_ ("Missing delimiter before SHELL_COMMAND"));
std::string gdb_cmd (command, arg - command);
@@ -1117,12 +1093,12 @@ pipe_command (const char *arg, int from_tty)
const char *shell_command = skip_spaces (arg);
if (*shell_command == '\0')
- error (_("Missing SHELL_COMMAND"));
+ error (_ ("Missing SHELL_COMMAND"));
FILE *to_shell_command = popen (shell_command, "w");
if (to_shell_command == nullptr)
- error (_("Error launching \"%s\""), shell_command);
+ error (_ ("Error launching \"%s\""), shell_command);
try
{
@@ -1139,7 +1115,7 @@ pipe_command (const char *arg, int from_tty)
int exit_status = pclose (to_shell_command);
if (exit_status < 0)
- error (_("shell command \"%s\" failed: %s"), shell_command,
+ error (_ ("shell command \"%s\" failed: %s"), shell_command,
safe_strerror (errno));
exit_status_set_internal_vars (exit_status);
}
@@ -1148,15 +1124,15 @@ pipe_command (const char *arg, int from_tty)
static void
pipe_command_completer (struct cmd_list_element *ignore,
- completion_tracker &tracker,
- const char *text, const char *word_ignored)
+ completion_tracker &tracker, const char *text,
+ const char *word_ignored)
{
pipe_cmd_opts opts;
const char *org_text = text;
auto grp = make_pipe_cmd_options_def_group (&opts);
- if (gdb::option::complete_options
- (tracker, &text, gdb::option::PROCESS_OPTIONS_UNKNOWN_IS_OPERAND, grp))
+ if (gdb::option::complete_options (
+ tracker, &text, gdb::option::PROCESS_OPTIONS_UNKNOWN_IS_OPERAND, grp))
return;
const char *delimiter = "|";
@@ -1210,8 +1186,8 @@ list_command (const char *arg, int from_tty)
should list only one line, list the preceding line,
instead of the exact line we've just shown after e.g.,
stopping for a breakpoint. */
- if (arg != NULL && arg[0] == '-'
- && get_lines_to_list () == 1 && first > 1)
+ if (arg != NULL && arg[0] == '-' && get_lines_to_list () == 1
+ && first > 1)
first -= 1;
print_source_lines (cursal.symtab, source_lines_range (first), 0);
@@ -1219,15 +1195,15 @@ list_command (const char *arg, int from_tty)
/* "l" or "l +" lists next ten lines. */
else if (arg == NULL || arg[0] == '+')
- print_source_lines (cursal.symtab,
- source_lines_range (cursal.line), 0);
+ print_source_lines (cursal.symtab, source_lines_range (cursal.line),
+ 0);
/* "l -" lists previous ten lines, the ones before the ten just
listed. */
else if (arg[0] == '-')
{
if (get_first_line_listed () == 1)
- error (_("Already at the start of %s."),
+ error (_ ("Already at the start of %s."),
symtab_to_filename_for_display (cursal.symtab));
source_lines_range range (get_first_line_listed (),
source_lines_range::BACKWARD);
@@ -1244,7 +1220,7 @@ list_command (const char *arg, int from_tty)
set DUMMY_BEG or DUMMY_END to record that fact. */
if (!have_full_symbols () && !have_partial_symbols ())
- error (_("No symbol table is loaded. Use the \"file\" command."));
+ error (_ ("No symbol table is loaded. Use the \"file\" command."));
std::vector<symtab_and_line> sals;
symtab_and_line sal, sal_end;
@@ -1263,10 +1239,10 @@ list_command (const char *arg, int from_tty)
a location spec condition, and so the string_to_location_spec
call stopped parsing. */
if (arg1 == arg)
- error (_("Junk at end of line specification."));
+ error (_ ("Junk at end of line specification."));
- sals = decode_line_1 (locspec.get (), DECODE_LINE_LIST_MODE,
- NULL, NULL, 0);
+ sals
+ = decode_line_1 (locspec.get (), DECODE_LINE_LIST_MODE, NULL, NULL, 0);
filter_sals (sals);
if (sals.empty ())
{
@@ -1279,7 +1255,8 @@ list_command (const char *arg, int from_tty)
/* Record whether the BEG arg is all digits. */
- for (p = arg; p != arg1 && *p >= '0' && *p <= '9'; p++);
+ for (p = arg; p != arg1 && *p >= '0' && *p <= '9'; p++)
+ ;
linenum_beg = (p == arg1);
/* Save the range of the first argument, in case we need to let the
@@ -1294,9 +1271,9 @@ list_command (const char *arg, int from_tty)
no_end = 0;
if (sals.size () > 1)
{
- ambiguous_line_spec (sals,
- _("Specified first line '%.*s' is ambiguous:\n"),
- (int) beg_len, beg);
+ ambiguous_line_spec (
+ sals, _ ("Specified first line '%.*s' is ambiguous:\n"),
+ (int) beg_len, beg);
return;
}
arg1++;
@@ -1314,23 +1291,23 @@ list_command (const char *arg, int from_tty)
= string_to_location_spec (&arg1, current_language);
if (*arg1)
- error (_("Junk at end of line specification."));
+ error (_ ("Junk at end of line specification."));
std::vector<symtab_and_line> sals_end
= (dummy_beg
- ? decode_line_1 (locspec.get (), DECODE_LINE_LIST_MODE,
- NULL, NULL, 0)
- : decode_line_1 (locspec.get (), DECODE_LINE_LIST_MODE,
- NULL, sal.symtab, sal.line));
+ ? decode_line_1 (locspec.get (), DECODE_LINE_LIST_MODE, NULL,
+ NULL, 0)
+ : decode_line_1 (locspec.get (), DECODE_LINE_LIST_MODE, NULL,
+ sal.symtab, sal.line));
filter_sals (sals_end);
if (sals_end.empty ())
return;
if (sals_end.size () > 1)
{
- ambiguous_line_spec (sals_end,
- _("Specified last line '%s' is ambiguous:\n"),
- end_arg);
+ ambiguous_line_spec (
+ sals_end, _ ("Specified last line '%s' is ambiguous:\n"),
+ end_arg);
return;
}
sal_end = sals_end[0];
@@ -1338,13 +1315,12 @@ list_command (const char *arg, int from_tty)
}
if (*arg1)
- error (_("Junk at end of line specification."));
+ error (_ ("Junk at end of line specification."));
- if (!no_end && !dummy_beg && !dummy_end
- && sal.symtab != sal_end.symtab)
- error (_("Specified first and last lines are in different files."));
+ if (!no_end && !dummy_beg && !dummy_end && sal.symtab != sal_end.symtab)
+ error (_ ("Specified first and last lines are in different files."));
if (dummy_beg && dummy_end)
- error (_("Two empty args do not say what lines to list."));
+ error (_ ("Two empty args do not say what lines to list."));
/* If line was specified by address,
first print exactly which line, and which file.
@@ -1356,19 +1332,17 @@ list_command (const char *arg, int from_tty)
struct gdbarch *gdbarch;
if (sal.symtab == 0)
- error (_("No source file for address %s."),
+ error (_ ("No source file for address %s."),
paddress (get_current_arch (), sal.pc));
gdbarch = sal.symtab->compunit ()->objfile ()->arch ();
sym = find_pc_function (sal.pc);
if (sym)
- gdb_printf ("%s is in %s (%s:%d).\n",
- paddress (gdbarch, sal.pc),
+ gdb_printf ("%s is in %s (%s:%d).\n", paddress (gdbarch, sal.pc),
sym->print_name (),
symtab_to_filename_for_display (sal.symtab), sal.line);
else
- gdb_printf ("%s is at %s:%d.\n",
- paddress (gdbarch, sal.pc),
+ gdb_printf ("%s is at %s:%d.\n", paddress (gdbarch, sal.pc),
symtab_to_filename_for_display (sal.symtab), sal.line);
}
@@ -1377,7 +1351,7 @@ list_command (const char *arg, int from_tty)
source code. */
if (!linenum_beg && sal.symtab == 0)
- error (_("No line number known for %s."), arg);
+ error (_ ("No line number known for %s."), arg);
/* If this command is repeated with RET,
turn it into the no-arg variant. */
@@ -1386,7 +1360,7 @@ list_command (const char *arg, int from_tty)
set_repeat_arguments ("");
if (dummy_beg && sal_end.symtab == 0)
- error (_("No default source file yet. Do \"help list\"."));
+ error (_ ("No default source file yet. Do \"help list\"."));
if (dummy_beg)
{
source_lines_range range (sal_end.line + 1,
@@ -1394,7 +1368,7 @@ list_command (const char *arg, int from_tty)
print_source_lines (sal_end.symtab, range, 0);
}
else if (sal.symtab == 0)
- error (_("No default source file yet. Do \"help list\"."));
+ error (_ ("No default source file yet. Do \"help list\"."));
else if (no_end)
{
for (int i = 0; i < sals.size (); i++)
@@ -1412,8 +1386,7 @@ list_command (const char *arg, int from_tty)
print_source_lines (sal.symtab, source_lines_range (sal.line), 0);
else
print_source_lines (sal.symtab,
- source_lines_range (sal.line, (sal_end.line + 1)),
- 0);
+ source_lines_range (sal.line, (sal_end.line + 1)), 0);
}
/* Subroutine of disassemble_command to simplify it.
@@ -1426,9 +1399,8 @@ list_command (const char *arg, int from_tty)
MIXED is non-zero to print source with the assembler. */
static void
-print_disassembly (struct gdbarch *gdbarch, const char *name,
- CORE_ADDR low, CORE_ADDR high,
- const struct block *block,
+print_disassembly (struct gdbarch *gdbarch, const char *name, CORE_ADDR low,
+ CORE_ADDR high, const struct block *block,
gdb_disassembly_flags flags)
{
#if defined(TUI)
@@ -1437,14 +1409,14 @@ print_disassembly (struct gdbarch *gdbarch, const char *name,
else
#endif
{
- gdb_printf (_("Dump of assembler code "));
+ gdb_printf (_ ("Dump of assembler code "));
if (name != NULL)
- gdb_printf (_("for function %ps:\n"),
+ gdb_printf (_ ("for function %ps:\n"),
styled_string (function_name_style.style (), name));
if (block == nullptr || block->is_contiguous ())
{
if (name == NULL)
- gdb_printf (_("from %ps to %ps:\n"),
+ gdb_printf (_ ("from %ps to %ps:\n"),
styled_string (address_style.style (),
paddress (gdbarch, low)),
styled_string (address_style.style (),
@@ -1460,16 +1432,16 @@ print_disassembly (struct gdbarch *gdbarch, const char *name,
CORE_ADDR range_low = range.start ();
CORE_ADDR range_high = range.end ();
- gdb_printf (_("Address range %ps to %ps:\n"),
+ gdb_printf (_ ("Address range %ps to %ps:\n"),
styled_string (address_style.style (),
paddress (gdbarch, range_low)),
styled_string (address_style.style (),
paddress (gdbarch, range_high)));
- gdb_disassembly (gdbarch, current_uiout, flags, -1,
- range_low, range_high);
+ gdb_disassembly (gdbarch, current_uiout, flags, -1, range_low,
+ range_high);
}
}
- gdb_printf (_("End of assembler dump.\n"));
+ gdb_printf (_ ("End of assembler dump.\n"));
}
}
@@ -1485,11 +1457,11 @@ disassemble_current_function (gdb_disassembly_flags flags)
const char *name;
const struct block *block;
- frame = get_selected_frame (_("No frame selected."));
+ frame = get_selected_frame (_ ("No frame selected."));
gdbarch = get_frame_arch (frame);
pc = get_frame_address_in_block (frame);
if (find_pc_partial_function (pc, &name, &low, &high, &block) == 0)
- error (_("No function contains program counter for selected frame."));
+ error (_ ("No function contains program counter for selected frame."));
#if defined(TUI)
/* NOTE: cagney/2003-02-13 The `tui_active' was previously
`tui_version'. */
@@ -1550,9 +1522,9 @@ disassemble_command (const char *arg, int from_tty)
++p;
if (*p == '\0')
- error (_("Missing modifier."));
+ error (_ ("Missing modifier."));
- while (*p && ! isspace (*p))
+ while (*p && !isspace (*p))
{
switch (*p++)
{
@@ -1569,7 +1541,7 @@ disassemble_command (const char *arg, int from_tty)
flags |= DISASSEMBLY_SOURCE;
break;
default:
- error (_("Invalid disassembly modifier."));
+ error (_ ("Invalid disassembly modifier."));
}
}
@@ -1578,9 +1550,9 @@ disassemble_command (const char *arg, int from_tty)
if ((flags & (DISASSEMBLY_SOURCE_DEPRECATED | DISASSEMBLY_SOURCE))
== (DISASSEMBLY_SOURCE_DEPRECATED | DISASSEMBLY_SOURCE))
- error (_("Cannot specify both /m and /s."));
+ error (_ ("Cannot specify both /m and /s."));
- if (! p || ! *p)
+ if (!p || !*p)
{
flags |= DISASSEMBLY_OMIT_FNAME;
disassemble_current_function (flags);
@@ -1594,7 +1566,7 @@ disassemble_command (const char *arg, int from_tty)
{
/* One argument. */
if (!find_pc_partial_function_sym (pc, &symbol, &low, &high, &block))
- error (_("No function contains specified address."));
+ error (_ ("No function contains specified address."));
if (asm_demangle)
name = symbol->print_name ();
@@ -1654,7 +1626,7 @@ show_user (const char *args, int from_tty)
c = lookup_cmd (&comname, cmdlist, "", NULL, 0, 1);
if (!cli_user_command_p (c))
- error (_("Not a user command."));
+ error (_ ("Not a user command."));
show_user_1 (c, "", args, gdb_stdout);
}
else
@@ -1683,8 +1655,7 @@ has_user_subcmd (struct cmd_list_element *command)
if (command->is_prefix ())
for (struct cmd_list_element *subcommand = *command->subcommands;
- subcommand != nullptr;
- subcommand = subcommand->next)
+ subcommand != nullptr; subcommand = subcommand->next)
if (has_user_subcmd (subcommand))
return true;
@@ -1694,9 +1665,8 @@ has_user_subcmd (struct cmd_list_element *command)
/* Implement completer for the 'show user' command. */
static void
-show_user_completer (cmd_list_element *,
- completion_tracker &tracker, const char *text,
- const char *word)
+show_user_completer (cmd_list_element *, completion_tracker &tracker,
+ const char *text, const char *word)
{
struct cmd_list_element *cmd_group = cmdlist;
@@ -1731,8 +1701,8 @@ show_user_completer (cmd_list_element *,
if (has_user_subcmd (c))
{
if (strncmp (c->name, word, wordlen) == 0)
- tracker.add_completion
- (gdb::unique_xmalloc_ptr<char> (xstrdup (c->name)));
+ tracker.add_completion (
+ gdb::unique_xmalloc_ptr<char> (xstrdup (c->name)));
}
}
@@ -1745,10 +1715,9 @@ apropos_command (const char *arg, int from_tty)
bool verbose = arg && check_for_argument (&arg, "-v", 2);
if (arg == NULL || *arg == '\0')
- error (_("REGEXP string is empty"));
+ error (_ ("REGEXP string is empty"));
- compiled_regex pattern (arg, REG_ICASE,
- _("Error in regular expression"));
+ compiled_regex pattern (arg, REG_ICASE, _ ("Error in regular expression"));
apropos_cmd (gdb_stdout, cmdlist, verbose, pattern, "");
}
@@ -1766,7 +1735,7 @@ static const gdb::option::option_def alias_option_defs[] = {
gdb::option::flag_option_def<alias_opts> {
"a",
[] (alias_opts *opts) { return &opts->abbrev_flag; },
- N_("Specify that ALIAS is an abbreviation of COMMAND.\n\
+ N_ ("Specify that ALIAS is an abbreviation of COMMAND.\n\
Abbreviations are not used in command completion."),
},
@@ -1778,22 +1747,22 @@ Abbreviations are not used in command completion."),
static gdb::option::option_def_group
make_alias_options_def_group (alias_opts *a_opts)
{
- return {{alias_option_defs}, a_opts};
+ return { { alias_option_defs }, a_opts };
}
/* Completer for the "alias_command". */
static void
alias_command_completer (struct cmd_list_element *ignore,
- completion_tracker &tracker,
- const char *text, const char *word)
+ completion_tracker &tracker, const char *text,
+ const char *word)
{
const auto grp = make_alias_options_def_group (nullptr);
tracker.set_use_custom_word_point (true);
- if (gdb::option::complete_options
- (tracker, &text, gdb::option::PROCESS_OPTIONS_UNKNOWN_IS_ERROR, grp))
+ if (gdb::option::complete_options (
+ tracker, &text, gdb::option::PROCESS_OPTIONS_UNKNOWN_IS_ERROR, grp))
return;
const char *delim = strchr (text, '=');
@@ -1801,9 +1770,7 @@ alias_command_completer (struct cmd_list_element *ignore,
/* If we're past the "=" delimiter, complete the
"alias ALIAS = COMMAND [DEFAULT-ARGS...]" as if the user is
typing COMMAND DEFAULT-ARGS... */
- if (delim != text
- && delim != nullptr
- && isspace (delim[-1])
+ if (delim != text && delim != nullptr && isspace (delim[-1])
&& (isspace (delim[1]) || delim[1] == '\0'))
{
std::string new_text = std::string (delim + 1);
@@ -1860,13 +1827,13 @@ validate_aliased_command (const char *command)
{
std::string default_args;
cmd_list_element *c
- = lookup_cmd_1 (& command, cmdlist, NULL, &default_args, 1);
+ = lookup_cmd_1 (&command, cmdlist, NULL, &default_args, 1);
if (c == NULL || c == (struct cmd_list_element *) -1)
- error (_("Invalid command to alias to: %s"), command);
+ error (_ ("Invalid command to alias to: %s"), command);
if (!default_args.empty ())
- error (_("Cannot define an alias of an alias that has default args"));
+ error (_ ("Cannot define an alias of an alias that has default args"));
return c;
}
@@ -1876,7 +1843,7 @@ validate_aliased_command (const char *command)
static void
alias_usage_error (void)
{
- error (_("Usage: alias [-a] [--] ALIAS = COMMAND [DEFAULT-ARGS...]"));
+ error (_ ("Usage: alias [-a] [--] ALIAS = COMMAND [DEFAULT-ARGS...]"));
}
/* Make an alias of an existing command. */
@@ -1887,8 +1854,9 @@ alias_command (const char *args, int from_tty)
alias_opts a_opts;
auto grp = make_alias_options_def_group (&a_opts);
- gdb::option::process_options
- (&args, gdb::option::PROCESS_OPTIONS_UNKNOWN_IS_ERROR, grp);
+ gdb::option::process_options (&args,
+ gdb::option::PROCESS_OPTIONS_UNKNOWN_IS_ERROR,
+ grp);
int i, alias_argc, command_argc;
const char *equals;
@@ -1906,10 +1874,9 @@ alias_command (const char *args, int from_tty)
struct cmd_list_element *c_command_prefix;
lookup_cmd_for_default_args (&default_args, &c_command_prefix);
- std::string command_argv_str (equals + 1,
- default_args == nullptr
- ? strlen (equals + 1)
- : default_args - equals - 1);
+ std::string command_argv_str (equals + 1, default_args == nullptr
+ ? strlen (equals + 1)
+ : default_args - equals - 1);
gdb_argv command_argv (command_argv_str.c_str ());
char **alias_argv = built_alias_argv.get ();
@@ -1920,12 +1887,12 @@ alias_command (const char *args, int from_tty)
for (i = 0; alias_argv[i] != NULL; ++i)
{
- if (! valid_user_defined_cmd_name_p (alias_argv[i]))
+ if (!valid_user_defined_cmd_name_p (alias_argv[i]))
{
if (i == 0)
- error (_("Invalid command name: %s"), alias_argv[i]);
+ error (_ ("Invalid command name: %s"), alias_argv[i]);
else
- error (_("Invalid command element name: %s"), alias_argv[i]);
+ error (_ ("Invalid command element name: %s"), alias_argv[i]);
}
}
@@ -1948,25 +1915,22 @@ alias_command (const char *args, int from_tty)
if (lookup_cmd_composition (alias, &alias_cmd, &prefix_cmd, &cmd))
{
- const char *alias_name = alias_argv[alias_argc-1];
+ const char *alias_name = alias_argv[alias_argc - 1];
/* If we found an existing ALIAS_CMD, check that the prefix differ or
the name differ. */
- if (alias_cmd != nullptr
- && alias_cmd->prefix == prefix_cmd
+ if (alias_cmd != nullptr && alias_cmd->prefix == prefix_cmd
&& strcmp (alias_name, alias_cmd->name) == 0)
- error (_("Alias already exists: %s"), alias);
+ error (_ ("Alias already exists: %s"), alias);
/* Check ALIAS differs from the found CMD. */
- if (cmd->prefix == prefix_cmd
- && strcmp (alias_name, cmd->name) == 0)
- error (_("Alias %s is the name of an existing command"), alias);
+ if (cmd->prefix == prefix_cmd && strcmp (alias_name, cmd->name) == 0)
+ error (_ ("Alias %s is the name of an existing command"), alias);
}
}
-
struct cmd_list_element *alias_cmd;
/* If ALIAS is one word, it is an alias for the entire COMMAND.
@@ -1990,7 +1954,7 @@ alias_command (const char *args, int from_tty)
struct cmd_list_element *c_alias, *c_command;
if (alias_argc != command_argc)
- error (_("Mismatched command length between ALIAS and COMMAND."));
+ error (_ ("Mismatched command length between ALIAS and COMMAND."));
/* Create copies of ALIAS and COMMAND without the last word,
and use that to verify the leading elements give the same
@@ -2002,14 +1966,14 @@ alias_command (const char *args, int from_tty)
alias_prefix = alias_prefix_string.c_str ();
command_prefix = command_prefix_string.c_str ();
- c_command = lookup_cmd_1 (& command_prefix, cmdlist, NULL, NULL, 1);
+ c_command = lookup_cmd_1 (&command_prefix, cmdlist, NULL, NULL, 1);
/* We've already tried to look up COMMAND. */
gdb_assert (c_command != NULL
&& c_command != (struct cmd_list_element *) -1);
gdb_assert (c_command->is_prefix ());
- c_alias = lookup_cmd_1 (& alias_prefix, cmdlist, NULL, NULL, 1);
+ c_alias = lookup_cmd_1 (&alias_prefix, cmdlist, NULL, NULL, 1);
if (c_alias != c_command)
- error (_("ALIAS and COMMAND prefixes do not match."));
+ error (_ ("ALIAS and COMMAND prefixes do not match."));
/* add_cmd requires *we* allocate space for name, hence the xstrdup. */
alias_cmd = add_alias_cmd (xstrdup (alias_argv[alias_argc - 1]),
@@ -2026,7 +1990,7 @@ alias_command (const char *args, int from_tty)
alias_cmd->default_args = default_args;
}
}
-
+
/* Print the file / line number / symbol name of the location
specified by SAL. */
@@ -2039,9 +2003,9 @@ print_sal_location (const symtab_and_line &sal)
const char *sym_name = NULL;
if (sal.symbol != NULL)
sym_name = sal.symbol->print_name ();
- gdb_printf (_("file: \"%s\", line number: %d, symbol: \"%s\"\n"),
- symtab_to_filename_for_display (sal.symtab),
- sal.line, sym_name != NULL ? sym_name : "???");
+ gdb_printf (_ ("file: \"%s\", line number: %d, symbol: \"%s\"\n"),
+ symtab_to_filename_for_display (sal.symtab), sal.line,
+ sym_name != NULL ? sym_name : "???");
}
/* Print a list of files and line numbers which a user may choose from
@@ -2108,41 +2072,42 @@ filter_sals (std::vector<symtab_and_line> &sals)
{
/* Remove SALs that do not match. */
auto from = std::remove_if (sals.begin (), sals.end (),
- [&] (const symtab_and_line &sal)
- { return (sal.pspace != current_program_space || sal.symtab == NULL); });
+ [&] (const symtab_and_line &sal) {
+ return (sal.pspace != current_program_space || sal.symtab == NULL);
+ });
/* Remove dups. */
std::sort (sals.begin (), from,
- [] (const symtab_and_line &sala, const symtab_and_line &salb)
- { return cmp_symtabs (sala, salb) < 0; });
+ [] (const symtab_and_line &sala, const symtab_and_line &salb) {
+ return cmp_symtabs (sala, salb) < 0;
+ });
from = std::unique (sals.begin (), from,
[&] (const symtab_and_line &sala,
- const symtab_and_line &salb)
- { return cmp_symtabs (sala, salb) == 0; });
+ const symtab_and_line &salb) {
+ return cmp_symtabs (sala, salb) == 0;
+ });
sals.erase (from, sals.end ());
}
static void
show_info_verbose (struct ui_file *file, int from_tty,
- struct cmd_list_element *c,
- const char *value)
+ struct cmd_list_element *c, const char *value)
{
if (info_verbose)
gdb_printf (file,
- _("Verbose printing of informational messages is %s.\n"),
+ _ ("Verbose printing of informational messages is %s.\n"),
value);
else
- gdb_printf (file, _("Verbosity is %s.\n"), value);
+ gdb_printf (file, _ ("Verbosity is %s.\n"), value);
}
static void
show_history_expansion_p (struct ui_file *file, int from_tty,
struct cmd_list_element *c, const char *value)
{
- gdb_printf (file, _("History expansion on command input is %s.\n"),
- value);
+ gdb_printf (file, _ ("History expansion on command input is %s.\n"), value);
}
static void
@@ -2150,7 +2115,7 @@ show_max_user_call_depth (struct ui_file *file, int from_tty,
struct cmd_list_element *c, const char *value)
{
gdb_printf (file,
- _("The max call depth for user-defined commands is %s.\n"),
+ _ ("The max call depth for user-defined commands is %s.\n"),
value);
}
@@ -2160,8 +2125,10 @@ static void
show_suppress_cli_notifications (ui_file *file, int from_tty,
cmd_list_element *c, const char *value)
{
- gdb_printf (file, _("Suppression of printing CLI notifications "
- "is %s.\n"), value);
+ gdb_printf (file,
+ _ ("Suppression of printing CLI notifications "
+ "is %s.\n"),
+ value);
}
/* Implement 'set suppress-cli-notifications'. */
@@ -2172,8 +2139,7 @@ set_suppress_cli_notifications (const char *args, int from_tty,
{
cli_suppress_notification.user_selected_context
= user_wants_cli_suppress_notification;
- cli_suppress_notification.normal_stop
- = user_wants_cli_suppress_notification;
+ cli_suppress_notification.normal_stop = user_wants_cli_suppress_notification;
}
/* Returns the cmd_list_element in SHOWLIST corresponding to the first
@@ -2182,26 +2148,26 @@ set_suppress_cli_notifications (const char *args, int from_tty,
FNNAME is used in the error message. */
static cmd_list_element *
-setting_cmd (const char *fnname, struct cmd_list_element *showlist,
- int argc, struct value **argv)
+setting_cmd (const char *fnname, struct cmd_list_element *showlist, int argc,
+ struct value **argv)
{
if (argc == 0)
- error (_("You must provide an argument to %s"), fnname);
+ error (_ ("You must provide an argument to %s"), fnname);
if (argc != 1)
- error (_("You can only provide one argument to %s"), fnname);
+ error (_ ("You can only provide one argument to %s"), fnname);
struct type *type0 = check_typedef (value_type (argv[0]));
- if (type0->code () != TYPE_CODE_ARRAY
- && type0->code () != TYPE_CODE_STRING)
- error (_("First argument of %s must be a string."), fnname);
+ if (type0->code () != TYPE_CODE_ARRAY && type0->code () != TYPE_CODE_STRING)
+ error (_ ("First argument of %s must be a string."), fnname);
const char *a0 = (const char *) value_contents (argv[0]).data ();
cmd_list_element *cmd = lookup_cmd (&a0, showlist, "", NULL, -1, 0);
if (cmd == nullptr || cmd->type != show_cmd)
- error (_("First argument of %s must be a "
- "valid setting of the 'show' command."), fnname);
+ error (_ ("First argument of %s must be a "
+ "valid setting of the 'show' command."),
+ fnname);
return cmd;
}
@@ -2217,15 +2183,13 @@ value_from_setting (const setting &var, struct gdbarch *gdbarch)
case var_integer:
case var_pinteger:
{
- LONGEST value
- = (var.type () == var_uinteger
- ? static_cast<LONGEST> (var.get<unsigned int> ())
- : static_cast<LONGEST> (var.get<int> ()));
+ LONGEST value = (var.type () == var_uinteger
+ ? static_cast<LONGEST> (var.get<unsigned int> ())
+ : static_cast<LONGEST> (var.get<int> ()));
if (var.extra_literals () != nullptr)
for (const literal_def *l = var.extra_literals ();
- l->literal != nullptr;
- l++)
+ l->literal != nullptr; l++)
if (value == l->use)
{
if (l->val.has_value ())
@@ -2236,13 +2200,12 @@ value_from_setting (const setting &var, struct gdbarch *gdbarch)
}
if (var.type () == var_uinteger)
- return
- value_from_ulongest (builtin_type (gdbarch)->builtin_unsigned_int,
- static_cast<unsigned int> (value));
+ return value_from_ulongest (
+ builtin_type (gdbarch)->builtin_unsigned_int,
+ static_cast<unsigned int> (value));
else
- return
- value_from_longest (builtin_type (gdbarch)->builtin_int,
- static_cast<int> (value));
+ return value_from_longest (builtin_type (gdbarch)->builtin_int,
+ static_cast<int> (value));
}
case var_boolean:
return value_from_longest (builtin_type (gdbarch)->builtin_int,
@@ -2265,8 +2228,7 @@ value_from_setting (const setting &var, struct gdbarch *gdbarch)
default:
gdb_assert_not_reached ("invalid var_auto_boolean");
}
- return value_from_longest (builtin_type (gdbarch)->builtin_int,
- val);
+ return value_from_longest (builtin_type (gdbarch)->builtin_int, val);
}
case var_string:
case var_string_noescape:
@@ -2292,8 +2254,7 @@ value_from_setting (const setting &var, struct gdbarch *gdbarch)
return value_cstring (value, len,
builtin_type (gdbarch)->builtin_char);
else
- return value_cstring ("", 1,
- builtin_type (gdbarch)->builtin_char);
+ return value_cstring ("", 1, builtin_type (gdbarch)->builtin_char);
}
default:
gdb_assert_not_reached ("bad var_type");
@@ -2304,8 +2265,8 @@ value_from_setting (const setting &var, struct gdbarch *gdbarch)
static struct value *
gdb_setting_internal_fn (struct gdbarch *gdbarch,
- const struct language_defn *language,
- void *cookie, int argc, struct value **argv)
+ const struct language_defn *language, void *cookie,
+ int argc, struct value **argv)
{
cmd_list_element *show_cmd
= setting_cmd ("$_gdb_setting", showlist, argc, argv);
@@ -2323,7 +2284,8 @@ gdb_maint_setting_internal_fn (struct gdbarch *gdbarch,
void *cookie, int argc, struct value **argv)
{
cmd_list_element *show_cmd
- = setting_cmd ("$_gdb_maint_setting", maintenance_show_cmdlist, argc, argv);
+ = setting_cmd ("$_gdb_maint_setting", maintenance_show_cmdlist, argc,
+ argv);
gdb_assert (show_cmd->var.has_value ());
@@ -2377,8 +2339,7 @@ str_value_from_setting (const setting &var, struct gdbarch *gdbarch)
return value_cstring (value, len,
builtin_type (gdbarch)->builtin_char);
else
- return value_cstring ("", 1,
- builtin_type (gdbarch)->builtin_char);
+ return value_cstring ("", 1, builtin_type (gdbarch)->builtin_char);
}
default:
gdb_assert_not_reached ("bad var_type");
@@ -2400,7 +2361,6 @@ gdb_setting_str_internal_fn (struct gdbarch *gdbarch,
return str_value_from_setting (*show_cmd->var, gdbarch);
}
-
/* Implementation of the convenience function $_gdb_maint_setting_str. */
static struct value *
@@ -2418,6 +2378,7 @@ gdb_maint_setting_str_internal_fn (struct gdbarch *gdbarch,
}
void _initialize_cli_cmds ();
+
void
_initialize_cli_cmds ()
{
@@ -2426,27 +2387,28 @@ _initialize_cli_cmds ()
/* Define the classes of commands.
They will appear in the help list in alphabetical order. */
- add_cmd ("internals", class_maintenance, _("\
+ add_cmd ("internals", class_maintenance, _ ("\
Maintenance commands.\n\
Some gdb commands are provided just for use by gdb maintainers.\n\
These commands are subject to frequent change, and may not be as\n\
well documented as user commands."),
&cmdlist);
- add_cmd ("obscure", class_obscure, _("Obscure features."), &cmdlist);
+ add_cmd ("obscure", class_obscure, _ ("Obscure features."), &cmdlist);
add_cmd ("aliases", class_alias,
- _("User-defined aliases of other commands."), &cmdlist);
- add_cmd ("user-defined", class_user, _("\
+ _ ("User-defined aliases of other commands."), &cmdlist);
+ add_cmd ("user-defined", class_user, _ ("\
User-defined commands.\n\
The commands in this class are those defined by the user.\n\
-Use the \"define\" command to define a command."), &cmdlist);
- add_cmd ("support", class_support, _("Support facilities."), &cmdlist);
- add_cmd ("status", class_info, _("Status inquiries."), &cmdlist);
- add_cmd ("files", class_files, _("Specifying and examining files."),
+Use the \"define\" command to define a command."),
+ &cmdlist);
+ add_cmd ("support", class_support, _ ("Support facilities."), &cmdlist);
+ add_cmd ("status", class_info, _ ("Status inquiries."), &cmdlist);
+ add_cmd ("files", class_files, _ ("Specifying and examining files."),
&cmdlist);
add_cmd ("breakpoints", class_breakpoint,
- _("Making program stop at certain points."), &cmdlist);
- add_cmd ("data", class_vars, _("Examining data."), &cmdlist);
- add_cmd ("stack", class_stack, _("\
+ _ ("Making program stop at certain points."), &cmdlist);
+ add_cmd ("data", class_vars, _ ("Examining data."), &cmdlist);
+ add_cmd ("stack", class_stack, _ ("\
Examining the stack.\n\
The stack is made up of stack frames. Gdb assigns numbers to stack frames\n\
counting from zero for the innermost (currently executing) frame.\n\n\
@@ -2457,27 +2419,29 @@ The commands below can be used to select other frames by number or address."),
&cmdlist);
#ifdef TUI
add_cmd ("text-user-interface", class_tui,
- _("TUI is the GDB text based interface.\n\
+ _ ("TUI is the GDB text based interface.\n\
In TUI mode, GDB can display several text windows showing\n\
-the source file, the processor registers, the program disassembly, ..."), &cmdlist);
+the source file, the processor registers, the program disassembly, ..."),
+ &cmdlist);
#endif
- add_cmd ("running", class_run, _("Running the program."), &cmdlist);
+ add_cmd ("running", class_run, _ ("Running the program."), &cmdlist);
/* Define general commands. */
- add_com ("pwd", class_files, pwd_command, _("\
+ add_com ("pwd", class_files, pwd_command, _ ("\
Print working directory.\n\
This is used for your program as well."));
- c = add_cmd ("cd", class_files, cd_command, _("\
+ c = add_cmd ("cd", class_files, cd_command, _ ("\
Set working directory to DIR for debugger.\n\
The debugger's current working directory specifies where scripts and other\n\
files that can be loaded by GDB are located.\n\
In order to change the inferior's current working directory, the recommended\n\
-way is to use the \"set cwd\" command."), &cmdlist);
+way is to use the \"set cwd\" command."),
+ &cmdlist);
set_cmd_completer (c, filename_completer);
- add_com ("echo", class_support, echo_command, _("\
+ add_com ("echo", class_support, echo_command, _ ("\
Print a constant string. Give string as argument.\n\
C escape sequences may be used in the argument.\n\
No newline is added at the end of the argument;\n\
@@ -2486,72 +2450,70 @@ Since leading and trailing whitespace are ignored in command arguments,\n\
if you want to print some you must use \"\\\" before leading whitespace\n\
to be printed or after trailing whitespace."));
- add_setshow_enum_cmd ("script-extension", class_support,
- script_ext_enums, &script_ext_mode, _("\
-Set mode for script filename extension recognition."), _("\
-Show mode for script filename extension recognition."), _("\
+ add_setshow_enum_cmd ("script-extension", class_support, script_ext_enums,
+ &script_ext_mode, _ ("\
+Set mode for script filename extension recognition."),
+ _ ("\
+Show mode for script filename extension recognition."),
+ _ ("\
off == no filename extension recognition (all sourced files are GDB scripts)\n\
soft == evaluate script according to filename extension, fallback to GDB script"
- "\n\
-strict == evaluate script according to filename extension, error if not supported"
- ),
- NULL,
- show_script_ext_mode,
- &setlist, &showlist);
+ "\n\
+strict == evaluate script according to filename extension, error if not supported"),
+ NULL, show_script_ext_mode, &setlist, &showlist);
cmd_list_element *quit_cmd
- = add_com ("quit", class_support, quit_command, _("\
+ = add_com ("quit", class_support, quit_command, _ ("\
Exit gdb.\n\
Usage: quit [EXPR] or exit [EXPR]\n\
The optional expression EXPR, if present, is evaluated and the result\n\
used as GDB's exit code. The default is zero."));
- cmd_list_element *help_cmd
- = add_com ("help", class_support, help_command,
- _("Print list of commands."));
+ cmd_list_element *help_cmd = add_com ("help", class_support, help_command,
+ _ ("Print list of commands."));
set_cmd_completer (help_cmd, command_completer);
add_com_alias ("q", quit_cmd, class_support, 1);
add_com_alias ("exit", quit_cmd, class_support, 1);
add_com_alias ("h", help_cmd, class_support, 1);
- add_setshow_boolean_cmd ("verbose", class_support, &info_verbose, _("\
-Set verbosity."), _("\
-Show verbosity."), NULL,
- set_verbose,
- show_info_verbose,
- &setlist, &showlist);
-
- add_setshow_prefix_cmd
- ("history", class_support,
- _("Generic command for setting command history parameters."),
- _("Generic command for showing command history parameters."),
- &sethistlist, &showhistlist, &setlist, &showlist);
-
- add_setshow_boolean_cmd ("expansion", no_class, &history_expansion_p, _("\
-Set history expansion on command input."), _("\
-Show history expansion on command input."), _("\
+ add_setshow_boolean_cmd ("verbose", class_support, &info_verbose, _ ("\
+Set verbosity."),
+ _ ("\
+Show verbosity."),
+ NULL, set_verbose, show_info_verbose, &setlist,
+ &showlist);
+
+ add_setshow_prefix_cmd (
+ "history", class_support,
+ _ ("Generic command for setting command history parameters."),
+ _ ("Generic command for showing command history parameters."),
+ &sethistlist, &showhistlist, &setlist, &showlist);
+
+ add_setshow_boolean_cmd ("expansion", no_class, &history_expansion_p, _ ("\
+Set history expansion on command input."),
+ _ ("\
+Show history expansion on command input."),
+ _ ("\
Without an argument, history expansion is enabled."),
- NULL,
- show_history_expansion_p,
- &sethistlist, &showhistlist);
+ NULL, show_history_expansion_p, &sethistlist,
+ &showhistlist);
cmd_list_element *info_cmd
- = add_prefix_cmd ("info", class_info, info_command, _("\
+ = add_prefix_cmd ("info", class_info, info_command, _ ("\
Generic command for showing things about the program being debugged."),
&infolist, 0, &cmdlist);
add_com_alias ("i", info_cmd, class_info, 1);
add_com_alias ("inf", info_cmd, class_info, 1);
add_com ("complete", class_obscure, complete_command,
- _("List the completions for the rest of the line as a command."));
+ _ ("List the completions for the rest of the line as a command."));
- c = add_show_prefix_cmd ("show", class_info, _("\
+ c = add_show_prefix_cmd ("show", class_info, _ ("\
Generic command for showing things about the debugger."),
&showlist, 0, &cmdlist);
/* Another way to get at the same thing. */
add_alias_cmd ("set", c, class_info, 0, &infolist);
- cmd_list_element *with_cmd
- = add_com ("with", class_vars, with_command, _("\
+ cmd_list_element *with_cmd = add_com ("with", class_vars, with_command, _ ("\
Temporarily set SETTING to VALUE, run COMMAND, and restore SETTING.\n\
Usage: with SETTING [VALUE] [-- COMMAND]\n\
Usage: w SETTING [VALUE] [-- COMMAND]\n\
@@ -2568,7 +2530,7 @@ abbreviations for commands and/or values. E.g.:\n\
set_cmd_completer_handle_brkchars (with_cmd, with_command_completer);
add_com_alias ("w", with_cmd, class_vars, 1);
- add_internal_function ("_gdb_setting_str", _("\
+ add_internal_function ("_gdb_setting_str", _ ("\
$_gdb_setting_str - returns the value of a GDB setting as a string.\n\
Usage: $_gdb_setting_str (setting)\n\
\n\
@@ -2578,7 +2540,7 @@ Some integer settings accept an unlimited value, returned\n\
as \"unlimited\"."),
gdb_setting_str_internal_fn, NULL);
- add_internal_function ("_gdb_setting", _("\
+ add_internal_function ("_gdb_setting", _ ("\
$_gdb_setting - returns the value of a GDB setting.\n\
Usage: $_gdb_setting (setting)\n\
auto-boolean values are \"off\", \"on\", \"auto\".\n\
@@ -2587,7 +2549,7 @@ Some integer settings accept an unlimited value, returned\n\
as 0 or -1 depending on the setting."),
gdb_setting_internal_fn, NULL);
- add_internal_function ("_gdb_maint_setting_str", _("\
+ add_internal_function ("_gdb_maint_setting_str", _ ("\
$_gdb_maint_setting_str - returns the value of a GDB maintenance setting as a string.\n\
Usage: $_gdb_maint_setting_str (setting)\n\
\n\
@@ -2597,7 +2559,7 @@ Some integer settings accept an unlimited value, returned\n\
as \"unlimited\"."),
gdb_maint_setting_str_internal_fn, NULL);
- add_internal_function ("_gdb_maint_setting", _("\
+ add_internal_function ("_gdb_maint_setting", _ ("\
$_gdb_maint_setting - returns the value of a GDB maintenance setting.\n\
Usage: $_gdb_maint_setting (setting)\n\
auto-boolean values are \"off\", \"on\", \"auto\".\n\
@@ -2606,33 +2568,32 @@ Some integer settings accept an unlimited value, returned\n\
as 0 or -1 depending on the setting."),
gdb_maint_setting_internal_fn, NULL);
- add_cmd ("commands", no_set_class, show_commands, _("\
+ add_cmd ("commands", no_set_class, show_commands, _ ("\
Show the history of commands you typed.\n\
You can supply a command number to start with, or a `+' to start after\n\
the previous command number shown."),
&showlist);
add_cmd ("version", no_set_class, show_version,
- _("Show what version of GDB this is."), &showlist);
+ _ ("Show what version of GDB this is."), &showlist);
add_cmd ("configuration", no_set_class, show_configuration,
- _("Show how GDB was configured at build time."), &showlist);
+ _ ("Show how GDB was configured at build time."), &showlist);
- add_setshow_prefix_cmd ("debug", no_class,
- _("Generic command for setting gdb debugging flags."),
- _("Generic command for showing gdb debugging flags."),
- &setdebuglist, &showdebuglist,
- &setlist, &showlist);
+ add_setshow_prefix_cmd (
+ "debug", no_class, _ ("Generic command for setting gdb debugging flags."),
+ _ ("Generic command for showing gdb debugging flags."), &setdebuglist,
+ &showdebuglist, &setlist, &showlist);
cmd_list_element *shell_cmd
- = add_com ("shell", class_support, shell_command, _("\
+ = add_com ("shell", class_support, shell_command, _ ("\
Execute the rest of the line as a shell command.\n\
With no arguments, run an inferior shell."));
set_cmd_completer (shell_cmd, filename_completer);
add_com_alias ("!", shell_cmd, class_support, 0);
- c = add_com ("edit", class_files, edit_command, _("\
+ c = add_com ("edit", class_files, edit_command, _ ("\
Edit specified file or function.\n\
With no argument, edits file containing most recent line listed.\n\
Editing targets can be specified in these ways:\n\
@@ -2645,7 +2606,7 @@ Uses EDITOR environment variable contents as editor (or ex as default)."));
c->completer = location_completer;
cmd_list_element *pipe_cmd
- = add_com ("pipe", class_support, pipe_command, _("\
+ = add_com ("pipe", class_support, pipe_command, _ ("\
Send the output of a gdb command to a shell command.\n\
Usage: | [COMMAND] | SHELL_COMMAND\n\
Usage: | -d DELIM COMMAND DELIM SHELL_COMMAND\n\
@@ -2664,7 +2625,7 @@ and send its output to SHELL_COMMAND."));
add_com_alias ("|", pipe_cmd, class_support, 0);
cmd_list_element *list_cmd
- = add_com ("list", class_files, list_command, _("\
+ = add_com ("list", class_files, list_command, _ ("\
List specified function or line.\n\
With no argument, lists ten more lines after or around previous listing.\n\
\"list -\" lists the ten lines before a previous ten-line listing.\n\
@@ -2685,7 +2646,7 @@ can be shown using \"show listsize\"."));
add_com_alias ("l", list_cmd, class_files, 1);
- c = add_com ("disassemble", class_vars, disassemble_command, _("\
+ c = add_com ("disassemble", class_vars, disassemble_command, _ ("\
Disassemble a specified section of memory.\n\
Usage: disassemble[/m|/r|/s] START [, END]\n\
Default is the function surrounding the pc of the selected frame.\n\
@@ -2713,40 +2674,40 @@ So, for example, if you want to disassemble function bar in file foo.c\n\
you must type \"disassemble 'foo.c'::bar\" and not \"disassemble foo.c:bar\"."));
set_cmd_completer (c, location_completer);
- c = add_com ("make", class_support, make_command, _("\
+ c = add_com ("make", class_support, make_command, _ ("\
Run the ``make'' program using the rest of the line as arguments."));
set_cmd_completer (c, filename_completer);
- c = add_cmd ("user", no_class, show_user, _("\
+ c = add_cmd ("user", no_class, show_user, _ ("\
Show definitions of non-python/scheme user defined commands.\n\
Argument is the name of the user defined command.\n\
-With no argument, show definitions of all user defined commands."), &showlist);
+With no argument, show definitions of all user defined commands."),
+ &showlist);
set_cmd_completer (c, show_user_completer);
- add_com ("apropos", class_support, apropos_command, _("\
+ add_com ("apropos", class_support, apropos_command, _ ("\
Search for commands matching a REGEXP.\n\
Usage: apropos [-v] REGEXP\n\
Flag -v indicates to produce a verbose output, showing full documentation\n\
of the matching commands."));
add_setshow_uinteger_cmd ("max-user-call-depth", no_class,
- &max_user_call_depth, _("\
-Set the max call depth for non-python/scheme user-defined commands."), _("\
-Show the max call depth for non-python/scheme user-defined commands."), NULL,
- NULL,
- show_max_user_call_depth,
- &setlist, &showlist);
-
- add_setshow_boolean_cmd ("trace-commands", no_class, &trace_commands, _("\
-Set tracing of GDB CLI commands."), _("\
-Show state of GDB CLI command tracing."), _("\
+ &max_user_call_depth, _ ("\
+Set the max call depth for non-python/scheme user-defined commands."),
+ _ ("\
+Show the max call depth for non-python/scheme user-defined commands."),
+ NULL, NULL, show_max_user_call_depth, &setlist,
+ &showlist);
+
+ add_setshow_boolean_cmd ("trace-commands", no_class, &trace_commands, _ ("\
+Set tracing of GDB CLI commands."),
+ _ ("\
+Show state of GDB CLI command tracing."),
+ _ ("\
When 'on', each command is displayed as it is executed."),
- NULL,
- NULL,
- &setlist, &showlist);
+ NULL, NULL, &setlist, &showlist);
const auto alias_opts = make_alias_options_def_group (nullptr);
- static std::string alias_help
- = gdb::option::build_help (_("\
+ static std::string alias_help = gdb::option::build_help (_ ("\
Define a new command that is an alias of an existing command.\n\
Usage: alias [-a] [--] ALIAS = COMMAND [DEFAULT-ARGS...]\n\
ALIAS is the name of the alias command to create.\n\
@@ -2768,26 +2729,25 @@ Make \"btf\" an alias of \"backtrace -full -past-entry -past-main\" :\n\
alias btf = backtrace -full -past-entry -past-main\n\
Make \"wLapPeu\" an alias of 2 nested \"with\":\n\
alias wLapPeu = with language pascal -- with print elements unlimited --"),
- alias_opts);
+ alias_opts);
- c = add_com ("alias", class_support, alias_command,
- alias_help.c_str ());
+ c = add_com ("alias", class_support, alias_command, alias_help.c_str ());
set_cmd_completer_handle_brkchars (c, alias_command_completer);
add_setshow_boolean_cmd ("suppress-cli-notifications", no_class,
- &user_wants_cli_suppress_notification,
- _("\
-Set whether printing notifications on CLI is suppressed."), _("\
-Show whether printing notifications on CLI is suppressed."), _("\
+ &user_wants_cli_suppress_notification, _ ("\
+Set whether printing notifications on CLI is suppressed."),
+ _ ("\
+Show whether printing notifications on CLI is suppressed."),
+ _ ("\
When on, printing notifications (such as inferior/thread switch)\n\
on CLI is suppressed."),
set_suppress_cli_notifications,
- show_suppress_cli_notifications,
- &setlist,
+ show_suppress_cli_notifications, &setlist,
&showlist);
- const char *source_help_text = xstrprintf (_("\
+ const char *source_help_text = xstrprintf (_ ("\
Read commands from a file named FILE.\n\
\n\
Usage: source [-s] [-v] FILE\n\
@@ -2796,8 +2756,10 @@ Usage: source [-s] [-v] FILE\n\
-v: each command in FILE is echoed as it is executed.\n\
\n\
Note that the file \"%s\" is read automatically in this way\n\
-when GDB is started."), GDBINIT).release ();
- c = add_cmd ("source", class_support, source_command,
- source_help_text, &cmdlist);
+when GDB is started."),
+ GDBINIT)
+ .release ();
+ c = add_cmd ("source", class_support, source_command, source_help_text,
+ &cmdlist);
set_cmd_completer (c, filename_completer);
}
diff --git a/gdb/cli/cli-cmds.h b/gdb/cli/cli-cmds.h
index 429574426ac..5df3278c080 100644
--- a/gdb/cli/cli-cmds.h
+++ b/gdb/cli/cli-cmds.h
@@ -179,8 +179,8 @@ struct open_script
}
};
-extern gdb::optional<open_script>
- find_and_open_script (const char *file, int search_path);
+extern gdb::optional<open_script> find_and_open_script (const char *file,
+ int search_path);
/* Command tracing state. */
@@ -192,8 +192,8 @@ extern bool trace_commands;
prefix: i.e., "set " or "maintenance set ". SETLIST is the command
element for the same "set" command prefix. */
extern void with_command_1 (const char *set_cmd_prefix,
- cmd_list_element *setlist,
- const char *args, int from_tty);
+ cmd_list_element *setlist, const char *args,
+ int from_tty);
/* Common code for the completers of the "with" and "maintenance with"
commands. SET_CMD_PREFIX is the spelling of the corresponding
diff --git a/gdb/cli/cli-decode.c b/gdb/cli/cli-decode.c
index 2a4f9b45ab1..20d469c33f9 100644
--- a/gdb/cli/cli-decode.c
+++ b/gdb/cli/cli-decode.c
@@ -30,20 +30,18 @@
static void undef_cmd_error (const char *, const char *);
-static cmd_list_element::aliases_list_type delete_cmd
- (const char *name, cmd_list_element **list, cmd_list_element **prehook,
- cmd_list_element **prehookee, cmd_list_element **posthook,
- cmd_list_element **posthookee);
+static cmd_list_element::aliases_list_type
+delete_cmd (const char *name, cmd_list_element **list,
+ cmd_list_element **prehook, cmd_list_element **prehookee,
+ cmd_list_element **posthook, cmd_list_element **posthookee);
-static struct cmd_list_element *find_cmd (const char *command,
- int len,
+static struct cmd_list_element *find_cmd (const char *command, int len,
struct cmd_list_element *clist,
int ignore_help_classes,
int *nfound);
static void help_cmd_list (struct cmd_list_element *list,
- enum command_class theclass,
- bool recurse,
+ enum command_class theclass, bool recurse,
struct ui_file *stream);
static void help_all (struct ui_file *stream);
@@ -85,9 +83,8 @@ lookup_cmd_with_subcommands (cmd_list_element **subcommands,
return NULL;
}
-static void
-print_help_for_command (const cmd_list_element &c,
- bool recurse, struct ui_file *stream);
+static void print_help_for_command (const cmd_list_element &c, bool recurse,
+ struct ui_file *stream);
static void
do_simple_func (const char *args, int from_tty, cmd_list_element *c)
@@ -96,7 +93,8 @@ do_simple_func (const char *args, int from_tty, cmd_list_element *c)
}
static void
-set_cmd_simple_func (struct cmd_list_element *cmd, cmd_simple_func_ftype *simple_func)
+set_cmd_simple_func (struct cmd_list_element *cmd,
+ cmd_simple_func_ftype *simple_func)
{
if (simple_func == NULL)
cmd->func = NULL;
@@ -107,7 +105,8 @@ set_cmd_simple_func (struct cmd_list_element *cmd, cmd_simple_func_ftype *simple
}
int
-cmd_simple_func_eq (struct cmd_list_element *cmd, cmd_simple_func_ftype *simple_func)
+cmd_simple_func_eq (struct cmd_list_element *cmd,
+ cmd_simple_func_ftype *simple_func)
{
return (cmd->func == do_simple_func
&& cmd->function.simple_func == simple_func);
@@ -178,11 +177,11 @@ cmd_list_element::command_components () const
of *LIST). */
static struct cmd_list_element *
-do_add_cmd (const char *name, enum command_class theclass,
- const char *doc, struct cmd_list_element **list)
+do_add_cmd (const char *name, enum command_class theclass, const char *doc,
+ struct cmd_list_element **list)
{
- struct cmd_list_element *c = new struct cmd_list_element (name, theclass,
- doc);
+ struct cmd_list_element *c
+ = new struct cmd_list_element (name, theclass, doc);
/* Turn each alias of the old command into an alias of the new
command. */
@@ -225,13 +224,12 @@ do_add_cmd (const char *name, enum command_class theclass,
cmd_list_element *prefixcmd = lookup_cmd_with_subcommands (list, cmdlist);
c->prefix = prefixcmd;
-
return c;
}
struct cmd_list_element *
-add_cmd (const char *name, enum command_class theclass,
- const char *doc, struct cmd_list_element **list)
+add_cmd (const char *name, enum command_class theclass, const char *doc,
+ struct cmd_list_element **list)
{
cmd_list_element *result = do_add_cmd (name, theclass, doc, list);
result->func = NULL;
@@ -241,8 +239,8 @@ add_cmd (const char *name, enum command_class theclass,
struct cmd_list_element *
add_cmd (const char *name, enum command_class theclass,
- cmd_simple_func_ftype *fun,
- const char *doc, struct cmd_list_element **list)
+ cmd_simple_func_ftype *fun, const char *doc,
+ struct cmd_list_element **list)
{
cmd_list_element *result = do_add_cmd (name, theclass, doc, list);
set_cmd_simple_func (result, fun);
@@ -265,7 +263,6 @@ add_cmd_suppress_notification (const char *name, enum command_class theclass,
return element;
}
-
/* Deprecates a command CMD.
REPLACEMENT is the name of the command which should be used in
place of this command, or NULL if no such command exists.
@@ -347,7 +344,6 @@ update_prefix_field_of_prefixed_commands (struct cmd_list_element *c)
}
}
-
/* Like add_cmd but adds an element for a command prefix: a name that
should be followed by a subcommand to be looked up in another
command list. SUBCOMMANDS should be the address of the variable
@@ -355,9 +351,9 @@ update_prefix_field_of_prefixed_commands (struct cmd_list_element *c)
struct cmd_list_element *
add_prefix_cmd (const char *name, enum command_class theclass,
- cmd_simple_func_ftype *fun,
- const char *doc, struct cmd_list_element **subcommands,
- int allow_unknown, struct cmd_list_element **list)
+ cmd_simple_func_ftype *fun, const char *doc,
+ struct cmd_list_element **subcommands, int allow_unknown,
+ struct cmd_list_element **list)
{
struct cmd_list_element *c = add_cmd (name, theclass, fun, doc, list);
@@ -381,8 +377,8 @@ do_prefix_cmd (const char *args, int from_tty, struct cmd_list_element *c)
while (c->is_alias ())
c = c->alias_target;
- help_list (*c->subcommands, c->prefixname ().c_str (),
- all_commands, gdb_stdout);
+ help_list (*c->subcommands, c->prefixname ().c_str (), all_commands,
+ gdb_stdout);
}
/* See command.h. */
@@ -392,9 +388,9 @@ add_basic_prefix_cmd (const char *name, enum command_class theclass,
const char *doc, struct cmd_list_element **subcommands,
int allow_unknown, struct cmd_list_element **list)
{
- struct cmd_list_element *cmd = add_prefix_cmd (name, theclass, nullptr,
- doc, subcommands,
- allow_unknown, list);
+ struct cmd_list_element *cmd
+ = add_prefix_cmd (name, theclass, nullptr, doc, subcommands, allow_unknown,
+ list);
cmd->func = do_prefix_cmd;
return cmd;
}
@@ -415,9 +411,9 @@ add_show_prefix_cmd (const char *name, enum command_class theclass,
const char *doc, struct cmd_list_element **subcommands,
int allow_unknown, struct cmd_list_element **list)
{
- struct cmd_list_element *cmd = add_prefix_cmd (name, theclass, nullptr,
- doc, subcommands,
- allow_unknown, list);
+ struct cmd_list_element *cmd
+ = add_prefix_cmd (name, theclass, nullptr, doc, subcommands, allow_unknown,
+ list);
cmd->func = do_show_prefix_cmd;
return cmd;
}
@@ -435,11 +431,9 @@ add_setshow_prefix_cmd (const char *name, command_class theclass,
set_show_commands cmds;
cmds.set = add_basic_prefix_cmd (name, theclass, set_doc,
- set_subcommands_list, 0,
- set_list);
+ set_subcommands_list, 0, set_list);
cmds.show = add_show_prefix_cmd (name, theclass, show_doc,
- show_subcommands_list, 0,
- show_list);
+ show_subcommands_list, 0, show_list);
return cmds;
}
@@ -448,16 +442,14 @@ add_setshow_prefix_cmd (const char *name, command_class theclass,
new command list element. */
struct cmd_list_element *
-add_prefix_cmd_suppress_notification
- (const char *name, enum command_class theclass,
- cmd_simple_func_ftype *fun,
- const char *doc, struct cmd_list_element **subcommands,
- int allow_unknown, struct cmd_list_element **list,
- bool *suppress_notification)
+add_prefix_cmd_suppress_notification (
+ const char *name, enum command_class theclass, cmd_simple_func_ftype *fun,
+ const char *doc, struct cmd_list_element **subcommands, int allow_unknown,
+ struct cmd_list_element **list, bool *suppress_notification)
{
struct cmd_list_element *element
- = add_prefix_cmd (name, theclass, fun, doc, subcommands,
- allow_unknown, list);
+ = add_prefix_cmd (name, theclass, fun, doc, subcommands, allow_unknown,
+ list);
element->suppress_notification = suppress_notification;
return element;
}
@@ -503,13 +495,10 @@ empty_func (const char *args, int from_tty, cmd_list_element *c)
DOC is the documentation string. */
static struct cmd_list_element *
-add_set_or_show_cmd (const char *name,
- enum cmd_types type,
- enum command_class theclass,
- var_types var_type,
+add_set_or_show_cmd (const char *name, enum cmd_types type,
+ enum command_class theclass, var_types var_type,
const literal_def *extra_literals,
- const setting::erased_args &arg,
- const char *doc,
+ const setting::erased_args &arg, const char *doc,
struct cmd_list_element **list)
{
struct cmd_list_element *c = add_cmd (name, theclass, doc, list);
@@ -536,17 +525,12 @@ add_set_or_show_cmd (const char *name,
Return the newly created set and show commands. */
static set_show_commands
-add_setshow_cmd_full_erased (const char *name,
- enum command_class theclass,
- var_types var_type,
- const literal_def *extra_literals,
- const setting::erased_args &args,
- const char *set_doc, const char *show_doc,
- const char *help_doc,
- cmd_func_ftype *set_func,
- show_value_ftype *show_func,
- struct cmd_list_element **set_list,
- struct cmd_list_element **show_list)
+add_setshow_cmd_full_erased (
+ const char *name, enum command_class theclass, var_types var_type,
+ const literal_def *extra_literals, const setting::erased_args &args,
+ const char *set_doc, const char *show_doc, const char *help_doc,
+ cmd_func_ftype *set_func, show_value_ftype *show_func,
+ struct cmd_list_element **set_list, struct cmd_list_element **show_list)
{
struct cmd_list_element *set;
struct cmd_list_element *show;
@@ -563,47 +547,42 @@ add_setshow_cmd_full_erased (const char *name,
full_set_doc = make_unique_xstrdup (set_doc);
full_show_doc = make_unique_xstrdup (show_doc);
}
- set = add_set_or_show_cmd (name, set_cmd, theclass, var_type,
- extra_literals, args,
- full_set_doc.release (), set_list);
+ set = add_set_or_show_cmd (name, set_cmd, theclass, var_type, extra_literals,
+ args, full_set_doc.release (), set_list);
set->doc_allocated = 1;
if (set_func != NULL)
set->func = set_func;
- show = add_set_or_show_cmd (name, show_cmd, theclass, var_type,
- extra_literals, args,
- full_show_doc.release (), show_list);
+ show
+ = add_set_or_show_cmd (name, show_cmd, theclass, var_type, extra_literals,
+ args, full_show_doc.release (), show_list);
show->doc_allocated = 1;
show->show_value_func = show_func;
/* Disable the default symbol completer. Doesn't make much sense
for the "show" command to complete on anything. */
set_cmd_completer (show, nullptr);
- return {set, show};
+ return { set, show };
}
/* Completes on integer commands that support extra literals. */
static void
integer_literals_completer (struct cmd_list_element *c,
- completion_tracker &tracker,
- const char *text, const char *word)
+ completion_tracker &tracker, const char *text,
+ const char *word)
{
const literal_def *extra_literals = c->var->extra_literals ();
if (*text == '\0')
{
tracker.add_completion (make_unique_xstrdup ("NUMBER"));
- for (const literal_def *l = extra_literals;
- l->literal != nullptr;
- l++)
+ for (const literal_def *l = extra_literals; l->literal != nullptr; l++)
tracker.add_completion (make_unique_xstrdup (l->literal));
}
else
- for (const literal_def *l = extra_literals;
- l->literal != nullptr;
- l++)
+ for (const literal_def *l = extra_literals; l->literal != nullptr; l++)
if (startswith (l->literal, text))
tracker.add_completion (make_unique_xstrdup (l->literal));
}
@@ -624,32 +603,22 @@ integer_literals_completer (struct cmd_list_element *c,
template<typename T>
static set_show_commands
-add_setshow_cmd_full (const char *name,
- enum command_class theclass,
+add_setshow_cmd_full (const char *name, enum command_class theclass,
var_types var_type, T *var,
- const literal_def *extra_literals,
- const char *set_doc, const char *show_doc,
- const char *help_doc,
+ const literal_def *extra_literals, const char *set_doc,
+ const char *show_doc, const char *help_doc,
typename setting_func_types<T>::set set_setting_func,
typename setting_func_types<T>::get get_setting_func,
- cmd_func_ftype *set_func,
- show_value_ftype *show_func,
+ cmd_func_ftype *set_func, show_value_ftype *show_func,
struct cmd_list_element **set_list,
struct cmd_list_element **show_list)
{
auto erased_args
- = setting::erase_args (var_type, var,
- set_setting_func, get_setting_func);
- auto cmds = add_setshow_cmd_full_erased (name,
- theclass,
- var_type, extra_literals,
- erased_args,
- set_doc, show_doc,
- help_doc,
- set_func,
- show_func,
- set_list,
- show_list);
+ = setting::erase_args (var_type, var, set_setting_func, get_setting_func);
+ auto cmds
+ = add_setshow_cmd_full_erased (name, theclass, var_type, extra_literals,
+ erased_args, set_doc, show_doc, help_doc,
+ set_func, show_func, set_list, show_list);
if (extra_literals != nullptr)
set_cmd_completer (cmds.set, integer_literals_completer);
@@ -661,22 +630,19 @@ add_setshow_cmd_full (const char *name,
template<typename T>
static set_show_commands
-add_setshow_cmd_full (const char *name,
- enum command_class theclass,
- var_types var_type, T *var,
- const char *set_doc, const char *show_doc,
- const char *help_doc,
+add_setshow_cmd_full (const char *name, enum command_class theclass,
+ var_types var_type, T *var, const char *set_doc,
+ const char *show_doc, const char *help_doc,
typename setting_func_types<T>::set set_setting_func,
typename setting_func_types<T>::get get_setting_func,
- cmd_func_ftype *set_func,
- show_value_ftype *show_func,
+ cmd_func_ftype *set_func, show_value_ftype *show_func,
struct cmd_list_element **set_list,
struct cmd_list_element **show_list)
{
- return add_setshow_cmd_full (name, theclass, var_type, var, nullptr,
- set_doc, show_doc, help_doc,
- set_setting_func, get_setting_func,
- set_func, show_func, set_list, show_list);
+ return add_setshow_cmd_full (name, theclass, var_type, var, nullptr, set_doc,
+ show_doc, help_doc, set_setting_func,
+ get_setting_func, set_func, show_func, set_list,
+ show_list);
}
/* Add element named NAME to command list LIST (the list for set or
@@ -685,14 +651,10 @@ add_setshow_cmd_full (const char *name,
which will contain the matching string (from ENUMLIST). */
set_show_commands
-add_setshow_enum_cmd (const char *name,
- enum command_class theclass,
- const char *const *enumlist,
- const char **var,
- const char *set_doc,
- const char *show_doc,
- const char *help_doc,
- cmd_func_ftype *set_func,
+add_setshow_enum_cmd (const char *name, enum command_class theclass,
+ const char *const *enumlist, const char **var,
+ const char *set_doc, const char *show_doc,
+ const char *help_doc, cmd_func_ftype *set_func,
show_value_ftype *show_func,
struct cmd_list_element **set_list,
struct cmd_list_element **show_list)
@@ -700,7 +662,7 @@ add_setshow_enum_cmd (const char *name,
/* We require *VAR to be initialized before this call, and
furthermore it must be == to one of the values in ENUMLIST. */
gdb_assert (var != nullptr && *var != nullptr);
- for (int i = 0; ; ++i)
+ for (int i = 0;; ++i)
{
gdb_assert (enumlist[i] != nullptr);
if (*var == enumlist[i])
@@ -708,10 +670,10 @@ add_setshow_enum_cmd (const char *name,
}
set_show_commands commands
- = add_setshow_cmd_full<const char *> (name, theclass, var_enum, var,
- set_doc, show_doc, help_doc,
- nullptr, nullptr, set_func,
- show_func, set_list, show_list);
+ = add_setshow_cmd_full<const char *> (name, theclass, var_enum, var,
+ set_doc, show_doc, help_doc, nullptr,
+ nullptr, set_func, show_func,
+ set_list, show_list);
commands.set->enums = enumlist;
return commands;
}
@@ -725,15 +687,14 @@ add_setshow_enum_cmd (const char *name, command_class theclass,
const char *show_doc, const char *help_doc,
setting_func_types<const char *>::set set_func,
setting_func_types<const char *>::get get_func,
- show_value_ftype *show_func,
- cmd_list_element **set_list,
+ show_value_ftype *show_func, cmd_list_element **set_list,
cmd_list_element **show_list)
{
- auto cmds = add_setshow_cmd_full<const char *> (name, theclass, var_enum,
- nullptr, set_doc, show_doc,
- help_doc, set_func, get_func,
- nullptr, show_func, set_list,
- show_list);
+ auto cmds
+ = add_setshow_cmd_full<const char *> (name, theclass, var_enum, nullptr,
+ set_doc, show_doc, help_doc,
+ set_func, get_func, nullptr,
+ show_func, set_list, show_list);
cmds.set->enums = enumlist;
@@ -741,7 +702,7 @@ add_setshow_enum_cmd (const char *name, command_class theclass,
}
/* See cli-decode.h. */
-const char * const auto_boolean_enums[] = { "on", "off", "auto", NULL };
+const char *const auto_boolean_enums[] = { "on", "off", "auto", NULL };
/* Add an auto-boolean command named NAME to both the set and show
command list lists. THECLASS is as in add_cmd. VAR is address of the
@@ -749,21 +710,17 @@ const char * const auto_boolean_enums[] = { "on", "off", "auto", NULL };
string. FUNC is the corresponding callback. */
set_show_commands
-add_setshow_auto_boolean_cmd (const char *name,
- enum command_class theclass,
- enum auto_boolean *var,
- const char *set_doc, const char *show_doc,
- const char *help_doc,
+add_setshow_auto_boolean_cmd (const char *name, enum command_class theclass,
+ enum auto_boolean *var, const char *set_doc,
+ const char *show_doc, const char *help_doc,
cmd_func_ftype *set_func,
show_value_ftype *show_func,
struct cmd_list_element **set_list,
struct cmd_list_element **show_list)
{
- set_show_commands commands
- = add_setshow_cmd_full<enum auto_boolean> (name, theclass, var_auto_boolean,
- var, set_doc, show_doc, help_doc,
- nullptr, nullptr, set_func,
- show_func, set_list, show_list);
+ set_show_commands commands = add_setshow_cmd_full<enum auto_boolean> (
+ name, theclass, var_auto_boolean, var, set_doc, show_doc, help_doc,
+ nullptr, nullptr, set_func, show_func, set_list, show_list);
commands.set->enums = auto_boolean_enums;
@@ -774,22 +731,17 @@ add_setshow_auto_boolean_cmd (const char *name,
to a global storage buffer. */
set_show_commands
-add_setshow_auto_boolean_cmd (const char *name, command_class theclass,
- const char *set_doc, const char *show_doc,
- const char *help_doc,
- setting_func_types<enum auto_boolean>::set set_func,
- setting_func_types<enum auto_boolean>::get get_func,
- show_value_ftype *show_func,
- cmd_list_element **set_list,
- cmd_list_element **show_list)
-{
- auto cmds = add_setshow_cmd_full<enum auto_boolean> (name, theclass,
- var_auto_boolean,
- nullptr, set_doc,
- show_doc, help_doc,
- set_func, get_func,
- nullptr, show_func,
- set_list, show_list);
+add_setshow_auto_boolean_cmd (
+ const char *name, command_class theclass, const char *set_doc,
+ const char *show_doc, const char *help_doc,
+ setting_func_types<enum auto_boolean>::set set_func,
+ setting_func_types<enum auto_boolean>::get get_func,
+ show_value_ftype *show_func, cmd_list_element **set_list,
+ cmd_list_element **show_list)
+{
+ auto cmds = add_setshow_cmd_full<enum auto_boolean> (
+ name, theclass, var_auto_boolean, nullptr, set_doc, show_doc, help_doc,
+ set_func, get_func, nullptr, show_func, set_list, show_list);
cmds.set->enums = auto_boolean_enums;
@@ -797,7 +749,7 @@ add_setshow_auto_boolean_cmd (const char *name, command_class theclass,
}
/* See cli-decode.h. */
-const char * const boolean_enums[] = { "on", "off", NULL };
+const char *const boolean_enums[] = { "on", "off", NULL };
/* Add element named NAME to both the set and show command LISTs (the
list for set/show or some sublist thereof). THECLASS is as in
@@ -806,19 +758,17 @@ const char * const boolean_enums[] = { "on", "off", NULL };
Returns the new command element. */
set_show_commands
-add_setshow_boolean_cmd (const char *name, enum command_class theclass, bool *var,
- const char *set_doc, const char *show_doc,
- const char *help_doc,
- cmd_func_ftype *set_func,
+add_setshow_boolean_cmd (const char *name, enum command_class theclass,
+ bool *var, const char *set_doc, const char *show_doc,
+ const char *help_doc, cmd_func_ftype *set_func,
show_value_ftype *show_func,
struct cmd_list_element **set_list,
struct cmd_list_element **show_list)
{
set_show_commands commands
- = add_setshow_cmd_full<bool> (name, theclass, var_boolean, var,
- set_doc, show_doc, help_doc,
- nullptr, nullptr, set_func, show_func,
- set_list, show_list);
+ = add_setshow_cmd_full<bool> (name, theclass, var_boolean, var, set_doc,
+ show_doc, help_doc, nullptr, nullptr,
+ set_func, show_func, set_list, show_list);
commands.set->enums = boolean_enums;
@@ -853,9 +803,8 @@ add_setshow_boolean_cmd (const char *name, command_class theclass,
set_show_commands
add_setshow_filename_cmd (const char *name, enum command_class theclass,
- std::string *var,
- const char *set_doc, const char *show_doc,
- const char *help_doc,
+ std::string *var, const char *set_doc,
+ const char *show_doc, const char *help_doc,
cmd_func_ftype *set_func,
show_value_ftype *show_func,
struct cmd_list_element **set_list,
@@ -863,9 +812,9 @@ add_setshow_filename_cmd (const char *name, enum command_class theclass,
{
set_show_commands commands
= add_setshow_cmd_full<std::string> (name, theclass, var_filename, var,
- set_doc, show_doc, help_doc,
- nullptr, nullptr, set_func,
- show_func, set_list, show_list);
+ set_doc, show_doc, help_doc, nullptr,
+ nullptr, set_func, show_func,
+ set_list, show_list);
set_cmd_completer (commands.set, filename_completer);
@@ -885,11 +834,11 @@ add_setshow_filename_cmd (const char *name, command_class theclass,
cmd_list_element **set_list,
cmd_list_element **show_list)
{
- auto cmds = add_setshow_cmd_full<std::string> (name, theclass, var_filename,
- nullptr, set_doc, show_doc,
- help_doc, set_func, get_func,
- nullptr, show_func, set_list,
- show_list);
+ auto cmds
+ = add_setshow_cmd_full<std::string> (name, theclass, var_filename, nullptr,
+ set_doc, show_doc, help_doc, set_func,
+ get_func, nullptr, show_func,
+ set_list, show_list);
set_cmd_completer (cmds.set, filename_completer);
@@ -901,19 +850,17 @@ add_setshow_filename_cmd (const char *name, command_class theclass,
set_show_commands
add_setshow_string_cmd (const char *name, enum command_class theclass,
- std::string *var,
- const char *set_doc, const char *show_doc,
- const char *help_doc,
- cmd_func_ftype *set_func,
- show_value_ftype *show_func,
+ std::string *var, const char *set_doc,
+ const char *show_doc, const char *help_doc,
+ cmd_func_ftype *set_func, show_value_ftype *show_func,
struct cmd_list_element **set_list,
struct cmd_list_element **show_list)
{
set_show_commands commands
= add_setshow_cmd_full<std::string> (name, theclass, var_string, var,
- set_doc, show_doc, help_doc,
- nullptr, nullptr, set_func,
- show_func, set_list, show_list);
+ set_doc, show_doc, help_doc, nullptr,
+ nullptr, set_func, show_func,
+ set_list, show_list);
/* Disable the default symbol completer. */
set_cmd_completer (commands.set, nullptr);
@@ -934,11 +881,11 @@ add_setshow_string_cmd (const char *name, command_class theclass,
cmd_list_element **set_list,
cmd_list_element **show_list)
{
- auto cmds = add_setshow_cmd_full<std::string> (name, theclass, var_string,
- nullptr, set_doc, show_doc,
- help_doc, set_func, get_func,
- nullptr, show_func, set_list,
- show_list);
+ auto cmds
+ = add_setshow_cmd_full<std::string> (name, theclass, var_string, nullptr,
+ set_doc, show_doc, help_doc, set_func,
+ get_func, nullptr, show_func,
+ set_list, show_list);
/* Disable the default symbol completer. */
set_cmd_completer (cmds.set, nullptr);
@@ -951,9 +898,8 @@ add_setshow_string_cmd (const char *name, command_class theclass,
set_show_commands
add_setshow_string_noescape_cmd (const char *name, enum command_class theclass,
- std::string *var,
- const char *set_doc, const char *show_doc,
- const char *help_doc,
+ std::string *var, const char *set_doc,
+ const char *show_doc, const char *help_doc,
cmd_func_ftype *set_func,
show_value_ftype *show_func,
struct cmd_list_element **set_list,
@@ -984,12 +930,11 @@ add_setshow_string_noescape_cmd (const char *name, command_class theclass,
cmd_list_element **set_list,
cmd_list_element **show_list)
{
- auto cmds = add_setshow_cmd_full<std::string> (name, theclass,
- var_string_noescape, nullptr,
- set_doc, show_doc, help_doc,
- set_func, get_func,
- nullptr, show_func, set_list,
- show_list);
+ auto cmds
+ = add_setshow_cmd_full<std::string> (name, theclass, var_string_noescape,
+ nullptr, set_doc, show_doc, help_doc,
+ set_func, get_func, nullptr,
+ show_func, set_list, show_list);
/* Disable the default symbol completer. */
set_cmd_completer (cmds.set, nullptr);
@@ -1001,14 +946,11 @@ add_setshow_string_noescape_cmd (const char *name, command_class theclass,
list for set/show or some sublist thereof). */
set_show_commands
-add_setshow_optional_filename_cmd (const char *name, enum command_class theclass,
- std::string *var,
- const char *set_doc, const char *show_doc,
- const char *help_doc,
- cmd_func_ftype *set_func,
- show_value_ftype *show_func,
- struct cmd_list_element **set_list,
- struct cmd_list_element **show_list)
+add_setshow_optional_filename_cmd (
+ const char *name, enum command_class theclass, std::string *var,
+ const char *set_doc, const char *show_doc, const char *help_doc,
+ cmd_func_ftype *set_func, show_value_ftype *show_func,
+ struct cmd_list_element **set_list, struct cmd_list_element **show_list)
{
set_show_commands commands
= add_setshow_cmd_full<std::string> (name, theclass, var_optional_filename,
@@ -1025,20 +967,18 @@ add_setshow_optional_filename_cmd (const char *name, enum command_class theclass
to a global storage buffer. */
set_show_commands
-add_setshow_optional_filename_cmd (const char *name, command_class theclass,
- const char *set_doc, const char *show_doc,
- const char *help_doc,
- setting_func_types<std::string>::set set_func,
- setting_func_types<std::string>::get get_func,
- show_value_ftype *show_func,
- cmd_list_element **set_list,
- cmd_list_element **show_list)
-{
- auto cmds =
- add_setshow_cmd_full<std::string> (name, theclass, var_optional_filename,
- nullptr, set_doc, show_doc, help_doc,
- set_func, get_func, nullptr, show_func,
- set_list,show_list);
+add_setshow_optional_filename_cmd (
+ const char *name, command_class theclass, const char *set_doc,
+ const char *show_doc, const char *help_doc,
+ setting_func_types<std::string>::set set_func,
+ setting_func_types<std::string>::get get_func, show_value_ftype *show_func,
+ cmd_list_element **set_list, cmd_list_element **show_list)
+{
+ auto cmds
+ = add_setshow_cmd_full<std::string> (name, theclass, var_optional_filename,
+ nullptr, set_doc, show_doc, help_doc,
+ set_func, get_func, nullptr,
+ show_func, set_list, show_list);
set_cmd_completer (cmds.set, filename_completer);
@@ -1055,17 +995,16 @@ set_show_commands
add_setshow_integer_cmd (const char *name, enum command_class theclass,
int *var, const literal_def *extra_literals,
const char *set_doc, const char *show_doc,
- const char *help_doc,
- cmd_func_ftype *set_func,
+ const char *help_doc, cmd_func_ftype *set_func,
show_value_ftype *show_func,
struct cmd_list_element **set_list,
struct cmd_list_element **show_list)
{
set_show_commands commands
= add_setshow_cmd_full<int> (name, theclass, var_integer, var,
- extra_literals, set_doc, show_doc,
- help_doc, nullptr, nullptr, set_func,
- show_func, set_list, show_list);
+ extra_literals, set_doc, show_doc, help_doc,
+ nullptr, nullptr, set_func, show_func,
+ set_list, show_list);
return commands;
}
@@ -1073,15 +1012,12 @@ add_setshow_integer_cmd (const char *name, enum command_class theclass,
to a global storage buffer. */
set_show_commands
-add_setshow_integer_cmd (const char *name, command_class theclass,
- const literal_def *extra_literals,
- const char *set_doc, const char *show_doc,
- const char *help_doc,
- setting_func_types<int>::set set_func,
- setting_func_types<int>::get get_func,
- show_value_ftype *show_func,
- cmd_list_element **set_list,
- cmd_list_element **show_list)
+add_setshow_integer_cmd (
+ const char *name, command_class theclass, const literal_def *extra_literals,
+ const char *set_doc, const char *show_doc, const char *help_doc,
+ setting_func_types<int>::set set_func, setting_func_types<int>::get get_func,
+ show_value_ftype *show_func, cmd_list_element **set_list,
+ cmd_list_element **show_list)
{
auto cmds = add_setshow_cmd_full<int> (name, theclass, var_integer, nullptr,
extra_literals, set_doc, show_doc,
@@ -1091,30 +1027,24 @@ add_setshow_integer_cmd (const char *name, command_class theclass,
}
/* Accept `unlimited' or 0, translated internally to INT_MAX. */
-const literal_def integer_unlimited_literals[] =
- {
- { "unlimited", INT_MAX, 0 },
- { nullptr }
- };
+const literal_def integer_unlimited_literals[]
+ = { { "unlimited", INT_MAX, 0 }, { nullptr } };
/* Same as above but using `integer_unlimited_literals', with a pointer
to a global storage buffer. */
set_show_commands
add_setshow_integer_cmd (const char *name, enum command_class theclass,
- int *var,
- const char *set_doc, const char *show_doc,
- const char *help_doc,
- cmd_func_ftype *set_func,
+ int *var, const char *set_doc, const char *show_doc,
+ const char *help_doc, cmd_func_ftype *set_func,
show_value_ftype *show_func,
struct cmd_list_element **set_list,
struct cmd_list_element **show_list)
{
set_show_commands commands
= add_setshow_cmd_full<int> (name, theclass, var_integer, var,
- integer_unlimited_literals,
- set_doc, show_doc, help_doc,
- nullptr, nullptr, set_func,
+ integer_unlimited_literals, set_doc, show_doc,
+ help_doc, nullptr, nullptr, set_func,
show_func, set_list, show_list);
return commands;
}
@@ -1132,11 +1062,11 @@ add_setshow_integer_cmd (const char *name, command_class theclass,
cmd_list_element **set_list,
cmd_list_element **show_list)
{
- auto cmds = add_setshow_cmd_full<int> (name, theclass, var_integer, nullptr,
- integer_unlimited_literals,
- set_doc, show_doc, help_doc, set_func,
- get_func, nullptr, show_func, set_list,
- show_list);
+ auto cmds
+ = add_setshow_cmd_full<int> (name, theclass, var_integer, nullptr,
+ integer_unlimited_literals, set_doc, show_doc,
+ help_doc, set_func, get_func, nullptr,
+ show_func, set_list, show_list);
return cmds;
}
@@ -1149,17 +1079,16 @@ set_show_commands
add_setshow_pinteger_cmd (const char *name, enum command_class theclass,
int *var, const literal_def *extra_literals,
const char *set_doc, const char *show_doc,
- const char *help_doc,
- cmd_func_ftype *set_func,
+ const char *help_doc, cmd_func_ftype *set_func,
show_value_ftype *show_func,
struct cmd_list_element **set_list,
struct cmd_list_element **show_list)
{
set_show_commands commands
= add_setshow_cmd_full<int> (name, theclass, var_pinteger, var,
- extra_literals, set_doc, show_doc,
- help_doc, nullptr, nullptr, set_func,
- show_func, set_list, show_list);
+ extra_literals, set_doc, show_doc, help_doc,
+ nullptr, nullptr, set_func, show_func,
+ set_list, show_list);
return commands;
}
@@ -1167,15 +1096,12 @@ add_setshow_pinteger_cmd (const char *name, enum command_class theclass,
to a global storage buffer. */
set_show_commands
-add_setshow_pinteger_cmd (const char *name, command_class theclass,
- const literal_def *extra_literals,
- const char *set_doc, const char *show_doc,
- const char *help_doc,
- setting_func_types<int>::set set_func,
- setting_func_types<int>::get get_func,
- show_value_ftype *show_func,
- cmd_list_element **set_list,
- cmd_list_element **show_list)
+add_setshow_pinteger_cmd (
+ const char *name, command_class theclass, const literal_def *extra_literals,
+ const char *set_doc, const char *show_doc, const char *help_doc,
+ setting_func_types<int>::set set_func, setting_func_types<int>::get get_func,
+ show_value_ftype *show_func, cmd_list_element **set_list,
+ cmd_list_element **show_list)
{
auto cmds = add_setshow_cmd_full<int> (name, theclass, var_pinteger, nullptr,
extra_literals, set_doc, show_doc,
@@ -1193,8 +1119,7 @@ set_show_commands
add_setshow_uinteger_cmd (const char *name, enum command_class theclass,
unsigned int *var, const literal_def *extra_literals,
const char *set_doc, const char *show_doc,
- const char *help_doc,
- cmd_func_ftype *set_func,
+ const char *help_doc, cmd_func_ftype *set_func,
show_value_ftype *show_func,
struct cmd_list_element **set_list,
struct cmd_list_element **show_list)
@@ -1211,40 +1136,30 @@ add_setshow_uinteger_cmd (const char *name, enum command_class theclass,
to a global storage buffer. */
set_show_commands
-add_setshow_uinteger_cmd (const char *name, command_class theclass,
- const literal_def *extra_literals,
- const char *set_doc, const char *show_doc,
- const char *help_doc,
- setting_func_types<unsigned int>::set set_func,
- setting_func_types<unsigned int>::get get_func,
- show_value_ftype *show_func,
- cmd_list_element **set_list,
- cmd_list_element **show_list)
-{
- auto cmds = add_setshow_cmd_full<unsigned int> (name, theclass, var_uinteger,
- nullptr, extra_literals,
- set_doc, show_doc, help_doc,
- set_func, get_func, nullptr,
- show_func, set_list,
- show_list);
+add_setshow_uinteger_cmd (
+ const char *name, command_class theclass, const literal_def *extra_literals,
+ const char *set_doc, const char *show_doc, const char *help_doc,
+ setting_func_types<unsigned int>::set set_func,
+ setting_func_types<unsigned int>::get get_func, show_value_ftype *show_func,
+ cmd_list_element **set_list, cmd_list_element **show_list)
+{
+ auto cmds = add_setshow_cmd_full<unsigned int> (
+ name, theclass, var_uinteger, nullptr, extra_literals, set_doc, show_doc,
+ help_doc, set_func, get_func, nullptr, show_func, set_list, show_list);
return cmds;
}
/* Accept `unlimited' or 0, translated internally to UINT_MAX. */
-const literal_def uinteger_unlimited_literals[] =
- {
- { "unlimited", UINT_MAX, 0 },
- { nullptr }
- };
+const literal_def uinteger_unlimited_literals[]
+ = { { "unlimited", UINT_MAX, 0 }, { nullptr } };
/* Same as above but using `uinteger_unlimited_literals', with a pointer
to a global storage buffer. */
set_show_commands
add_setshow_uinteger_cmd (const char *name, enum command_class theclass,
- unsigned int *var,
- const char *set_doc, const char *show_doc,
- const char *help_doc,
+ unsigned int *var, const char *set_doc,
+ const char *show_doc, const char *help_doc,
cmd_func_ftype *set_func,
show_value_ftype *show_func,
struct cmd_list_element **set_list,
@@ -1252,10 +1167,10 @@ add_setshow_uinteger_cmd (const char *name, enum command_class theclass,
{
set_show_commands commands
= add_setshow_cmd_full<unsigned int> (name, theclass, var_uinteger, var,
- uinteger_unlimited_literals,
- set_doc, show_doc, help_doc, nullptr,
- nullptr, set_func, show_func,
- set_list, show_list);
+ uinteger_unlimited_literals, set_doc,
+ show_doc, help_doc, nullptr, nullptr,
+ set_func, show_func, set_list,
+ show_list);
return commands;
}
@@ -1272,13 +1187,12 @@ add_setshow_uinteger_cmd (const char *name, command_class theclass,
cmd_list_element **set_list,
cmd_list_element **show_list)
{
- auto cmds = add_setshow_cmd_full<unsigned int> (name, theclass, var_uinteger,
- nullptr,
- uinteger_unlimited_literals,
- set_doc, show_doc, help_doc,
- set_func, get_func, nullptr,
- show_func, set_list,
- show_list);
+ auto cmds
+ = add_setshow_cmd_full<unsigned int> (name, theclass, var_uinteger,
+ nullptr, uinteger_unlimited_literals,
+ set_doc, show_doc, help_doc,
+ set_func, get_func, nullptr,
+ show_func, set_list, show_list);
return cmds;
}
@@ -1289,18 +1203,15 @@ add_setshow_uinteger_cmd (const char *name, command_class theclass,
set_show_commands
add_setshow_zinteger_cmd (const char *name, enum command_class theclass,
- int *var,
- const char *set_doc, const char *show_doc,
- const char *help_doc,
- cmd_func_ftype *set_func,
+ int *var, const char *set_doc, const char *show_doc,
+ const char *help_doc, cmd_func_ftype *set_func,
show_value_ftype *show_func,
struct cmd_list_element **set_list,
struct cmd_list_element **show_list)
{
- return add_setshow_cmd_full<int> (name, theclass, var_integer, var,
- set_doc, show_doc, help_doc,
- nullptr, nullptr, set_func,
- show_func, set_list, show_list);
+ return add_setshow_cmd_full<int> (name, theclass, var_integer, var, set_doc,
+ show_doc, help_doc, nullptr, nullptr,
+ set_func, show_func, set_list, show_list);
}
/* Same as above but using a getter and a setter function instead of a pointer
@@ -1323,33 +1234,24 @@ add_setshow_zinteger_cmd (const char *name, command_class theclass,
}
/* Accept `unlimited' or -1, using -1 internally. */
-const literal_def pinteger_unlimited_literals[] =
- {
- { "unlimited", -1, -1 },
- { nullptr }
- };
+const literal_def pinteger_unlimited_literals[]
+ = { { "unlimited", -1, -1 }, { nullptr } };
/* Same as above but using `pinteger_unlimited_literals', with a pointer
to a global storage buffer. */
set_show_commands
-add_setshow_zuinteger_unlimited_cmd (const char *name,
- enum command_class theclass,
- int *var,
- const char *set_doc,
- const char *show_doc,
- const char *help_doc,
- cmd_func_ftype *set_func,
- show_value_ftype *show_func,
- struct cmd_list_element **set_list,
- struct cmd_list_element **show_list)
+add_setshow_zuinteger_unlimited_cmd (
+ const char *name, enum command_class theclass, int *var, const char *set_doc,
+ const char *show_doc, const char *help_doc, cmd_func_ftype *set_func,
+ show_value_ftype *show_func, struct cmd_list_element **set_list,
+ struct cmd_list_element **show_list)
{
set_show_commands commands
= add_setshow_cmd_full<int> (name, theclass, var_pinteger, var,
- pinteger_unlimited_literals,
- set_doc, show_doc, help_doc, nullptr,
- nullptr, set_func, show_func, set_list,
- show_list);
+ pinteger_unlimited_literals, set_doc,
+ show_doc, help_doc, nullptr, nullptr,
+ set_func, show_func, set_list, show_list);
return commands;
}
@@ -1368,10 +1270,9 @@ add_setshow_zuinteger_unlimited_cmd (const char *name, command_class theclass,
{
auto cmds
= add_setshow_cmd_full<int> (name, theclass, var_pinteger, nullptr,
- pinteger_unlimited_literals,
- set_doc, show_doc, help_doc, set_func,
- get_func, nullptr, show_func, set_list,
- show_list);
+ pinteger_unlimited_literals, set_doc,
+ show_doc, help_doc, set_func, get_func,
+ nullptr, show_func, set_list, show_list);
return cmds;
}
@@ -1382,16 +1283,15 @@ add_setshow_zuinteger_unlimited_cmd (const char *name, command_class theclass,
set_show_commands
add_setshow_zuinteger_cmd (const char *name, enum command_class theclass,
- unsigned int *var,
- const char *set_doc, const char *show_doc,
- const char *help_doc,
+ unsigned int *var, const char *set_doc,
+ const char *show_doc, const char *help_doc,
cmd_func_ftype *set_func,
show_value_ftype *show_func,
struct cmd_list_element **set_list,
struct cmd_list_element **show_list)
{
- return add_setshow_cmd_full<unsigned int> (name, theclass, var_uinteger,
- var, set_doc, show_doc, help_doc,
+ return add_setshow_cmd_full<unsigned int> (name, theclass, var_uinteger, var,
+ set_doc, show_doc, help_doc,
nullptr, nullptr, set_func,
show_func, set_list, show_list);
}
@@ -1479,7 +1379,7 @@ delete_cmd (const char *name, struct cmd_list_element **list,
return aliases;
}
-
+
/* Shorthands to the commands above. */
/* Add an element to the list of info subcommands. */
@@ -1502,8 +1402,7 @@ add_info_alias (const char *name, cmd_list_element *target, int abbrev_flag)
struct cmd_list_element *
add_com (const char *name, enum command_class theclass,
- cmd_simple_func_ftype *fun,
- const char *doc)
+ cmd_simple_func_ftype *fun, const char *doc)
{
return add_cmd (name, theclass, fun, doc, &cmdlist);
}
@@ -1527,8 +1426,8 @@ add_com_suppress_notification (const char *name, enum command_class theclass,
cmd_simple_func_ftype *fun, const char *doc,
bool *suppress_notification)
{
- return add_cmd_suppress_notification (name, theclass, fun, doc,
- &cmdlist, suppress_notification);
+ return add_cmd_suppress_notification (name, theclass, fun, doc, &cmdlist,
+ suppress_notification);
}
/* Print the prefix of C followed by name of C in title style. */
@@ -1536,11 +1435,10 @@ add_com_suppress_notification (const char *name, enum command_class theclass,
static void
fput_command_name_styled (const cmd_list_element &c, struct ui_file *stream)
{
- std::string prefixname
- = c.prefix == nullptr ? "" : c.prefix->prefixname ();
+ std::string prefixname = c.prefix == nullptr ? "" : c.prefix->prefixname ();
- fprintf_styled (stream, title_style.style (), "%s%s",
- prefixname.c_str (), c.name);
+ fprintf_styled (stream, title_style.style (), "%s%s", prefixname.c_str (),
+ c.name);
}
/* True if ALIAS has a user-defined documentation. */
@@ -1578,8 +1476,7 @@ fput_aliases_definition_styled (const cmd_list_element &cmd,
struct ui_file *stream)
{
for (const cmd_list_element &alias : cmd.aliases)
- if (!alias.cmd_deprecated
- && !user_documented_alias (alias)
+ if (!alias.cmd_deprecated && !user_documented_alias (alias)
&& !alias.default_args.empty ())
fput_alias_definition_styled (alias, stream);
}
@@ -1591,18 +1488,16 @@ fput_aliases_definition_styled (const cmd_list_element &cmd,
*/
static void
-fput_command_names_styled (const cmd_list_element &c,
- bool always_fput_c_name, const char *postfix,
- struct ui_file *stream)
+fput_command_names_styled (const cmd_list_element &c, bool always_fput_c_name,
+ const char *postfix, struct ui_file *stream)
{
/* First, check if we are going to print something. That is, either if
ALWAYS_FPUT_C_NAME is true or if there exists at least one non-deprecated
alias not documented specifically by the user. */
- auto print_alias = [] (const cmd_list_element &alias)
- {
- return !alias.cmd_deprecated && !user_documented_alias (alias);
- };
+ auto print_alias = [] (const cmd_list_element &alias) {
+ return !alias.cmd_deprecated && !user_documented_alias (alias);
+ };
bool print_something = always_fput_c_name;
if (!print_something)
@@ -1647,8 +1542,7 @@ print_doc_of_command (const cmd_list_element &c, const char *prefix,
if (verbose)
gdb_puts ("\n", stream);
- fput_command_names_styled (c, true,
- verbose ? "" : " -- ", stream);
+ fput_command_names_styled (c, true, verbose ? "" : " -- ", stream);
if (verbose)
{
gdb_puts ("\n", stream);
@@ -1672,15 +1566,14 @@ print_doc_of_command (const cmd_list_element &c, const char *prefix,
the first line.
*/
void
-apropos_cmd (struct ui_file *stream,
- struct cmd_list_element *commandlist,
+apropos_cmd (struct ui_file *stream, struct cmd_list_element *commandlist,
bool verbose, compiled_regex &regex, const char *prefix)
{
struct cmd_list_element *c;
int returnvalue;
/* Walk through the commands. */
- for (c=commandlist;c;c=c->next)
+ for (c = commandlist; c; c = c->next)
{
if (c->is_alias () && !user_documented_alias (*c))
{
@@ -1704,7 +1597,8 @@ apropos_cmd (struct ui_file *stream,
for (const cmd_list_element &alias : c->aliases)
{
name_len = strlen (alias.name);
- returnvalue = regex.search (alias.name, name_len, 0, name_len, NULL);
+ returnvalue
+ = regex.search (alias.name, name_len, 0, name_len, NULL);
if (returnvalue >= 0)
{
print_doc_of_command (*c, prefix, verbose, regex, stream);
@@ -1806,24 +1700,21 @@ help_cmd (const char *command, struct ui_file *stream)
/* If this is a prefix command, print it's subcommands. */
if (c->is_prefix ())
- help_list (*c->subcommands, c->prefixname ().c_str (),
- all_commands, stream);
+ help_list (*c->subcommands, c->prefixname ().c_str (), all_commands,
+ stream);
/* If this is a class name, print all of the commands in the class. */
if (c->is_command_class_help ())
help_list (cmdlist, "", c->theclass, stream);
if (c->hook_pre || c->hook_post)
- gdb_printf (stream,
- "\nThis command has a hook (or hooks) defined:\n");
+ gdb_printf (stream, "\nThis command has a hook (or hooks) defined:\n");
if (c->hook_pre)
- gdb_printf (stream,
- "\tThis command is run after : %s (pre hook)\n",
+ gdb_printf (stream, "\tThis command is run after : %s (pre hook)\n",
c->hook_pre->name);
if (c->hook_post)
- gdb_printf (stream,
- "\tThis command is run before : %s (post hook)\n",
+ gdb_printf (stream, "\tThis command is run before : %s (post hook)\n",
c->hook_post->name);
}
@@ -1890,7 +1781,8 @@ Type \"help all\" for the list of all commands.");
stream->wrap_here (0);
gdb_puts ("documentation.\n", stream);
gdb_puts ("Type \"apropos word\" to search "
- "for commands related to \"word\".\n", stream);
+ "for commands related to \"word\".\n",
+ stream);
gdb_puts ("Type \"apropos -v word\" for full documentation", stream);
stream->wrap_here (0);
gdb_puts (" of commands related to \"word\".\n", stream);
@@ -1937,14 +1829,12 @@ help_all (struct ui_file *stream)
print_help_for_command (*c, true, stream);
}
}
-
}
/* See cli-decode.h. */
void
-print_doc_line (struct ui_file *stream, const char *str,
- bool for_value_prefix)
+print_doc_line (struct ui_file *stream, const char *str, bool for_value_prefix)
{
static char *line_buffer = 0;
static int line_size;
@@ -1986,8 +1876,8 @@ print_doc_line (struct ui_file *stream, const char *str,
If RECURSE is non-zero, also print one-line descriptions
of all prefixed subcommands. */
static void
-print_help_for_command (const cmd_list_element &c,
- bool recurse, struct ui_file *stream)
+print_help_for_command (const cmd_list_element &c, bool recurse,
+ struct ui_file *stream)
{
fput_command_names_styled (c, true, " -- ", stream);
print_doc_line (stream, c.doc, false);
@@ -1996,9 +1886,7 @@ print_help_for_command (const cmd_list_element &c,
fput_alias_definition_styled (c, stream);
fput_aliases_definition_styled (c, stream);
- if (recurse
- && c.is_prefix ()
- && c.abbrev_flag == 0)
+ if (recurse && c.is_prefix () && c.abbrev_flag == 0)
/* Subcommands of a prefix command typically have 'all_commands'
as class. If we pass CLASS to recursive invocation,
most often we won't see anything. */
@@ -2058,15 +1946,13 @@ help_cmd_list (struct cmd_list_element *list, enum command_class theclass,
/* If we show the class_alias and C is an alias, do not recurse,
as this would show the (possibly very long) not very useful
list of sub-commands of the aliased command. */
- print_help_for_command
- (*c,
- recurse && (theclass != class_alias || !c->is_alias ()),
- stream);
+ print_help_for_command (
+ *c, recurse && (theclass != class_alias || !c->is_alias ()),
+ stream);
continue;
}
- if (recurse
- && (theclass == class_user || theclass == class_alias)
+ if (recurse && (theclass == class_user || theclass == class_alias)
&& c->is_prefix ())
{
/* User-defined commands or aliases may be subcommands. */
@@ -2078,7 +1964,6 @@ help_cmd_list (struct cmd_list_element *list, enum command_class theclass,
THECLASS or because C is a help class. */
}
}
-
/* Search the input clist for 'command'. Return the command if
found (or NULL if not), and return the number of commands
@@ -2194,7 +2079,6 @@ lookup_cmd_1 (const char **text, struct cmd_list_element *clist,
/* *text and p now bracket the first command word to lookup (and
it's length is len). We copy this into a local temporary. */
-
command = (char *) alloca (len + 1);
memcpy (command, *text, len);
command[len] = '\0';
@@ -2216,7 +2100,7 @@ lookup_cmd_1 (const char **text, struct cmd_list_element *clist,
*result_list = 0;
if (default_args != nullptr)
*default_args = std::string ();
- return CMD_LIST_AMBIGUOUS; /* Ambiguous. */
+ return CMD_LIST_AMBIGUOUS; /* Ambiguous. */
}
/* We've matched something on this list. Move text pointer forward. */
@@ -2235,7 +2119,6 @@ lookup_cmd_1 (const char **text, struct cmd_list_element *clist,
if (found->deprecated_warn_user && !lookup_for_completion_p)
deprecated_cmd_warning (line, clist);
-
/* Return the default_args of the alias, not the default_args
of the command it is pointing to. */
if (default_args != nullptr)
@@ -2296,12 +2179,8 @@ lookup_cmd_1 (const char **text, struct cmd_list_element *clist,
static void
undef_cmd_error (const char *cmdtype, const char *q)
{
- error (_("Undefined %scommand: \"%s\". Try \"help%s%.*s\"."),
- cmdtype,
- q,
- *cmdtype ? " " : "",
- (int) strlen (cmdtype) - 1,
- cmdtype);
+ error (_ ("Undefined %scommand: \"%s\". Try \"help%s%.*s\"."), cmdtype, q,
+ *cmdtype ? " " : "", (int) strlen (cmdtype) - 1, cmdtype);
}
/* Look up the contents of *LINE as a command in the command list LIST.
@@ -2325,9 +2204,8 @@ undef_cmd_error (const char *cmdtype, const char *q)
struct cmd_list_element *
lookup_cmd (const char **line, struct cmd_list_element *list,
- const char *cmdtype,
- std::string *default_args,
- int allow_unknown, int ignore_help_classes)
+ const char *cmdtype, std::string *default_args, int allow_unknown,
+ int ignore_help_classes)
{
struct cmd_list_element *last_list = 0;
struct cmd_list_element *c;
@@ -2336,7 +2214,7 @@ lookup_cmd (const char **line, struct cmd_list_element *list,
would be wrong for complete_command. Jim Kingdon */
if (!*line)
- error (_("Lack of needed %scommand"), cmdtype);
+ error (_ ("Lack of needed %scommand"), cmdtype);
c = lookup_cmd_1 (line, list, &last_list, default_args, ignore_help_classes);
@@ -2359,19 +2237,19 @@ lookup_cmd (const char **line, struct cmd_list_element *list,
{
/* Ambigous. Local values should be off subcommands or called
values. */
- int local_allow_unknown = (last_list ? last_list->allow_unknown :
- allow_unknown);
+ int local_allow_unknown
+ = (last_list ? last_list->allow_unknown : allow_unknown);
std::string local_cmdtype
= last_list ? last_list->prefixname () : cmdtype;
- struct cmd_list_element *local_list =
- (last_list ? *(last_list->subcommands) : list);
+ struct cmd_list_element *local_list
+ = (last_list ? *(last_list->subcommands) : list);
if (local_allow_unknown < 0)
{
if (last_list)
- return last_list; /* Found something. */
+ return last_list; /* Found something. */
else
- return 0; /* Found nothing. */
+ return 0; /* Found nothing. */
}
else
{
@@ -2379,9 +2257,8 @@ lookup_cmd (const char **line, struct cmd_list_element *list,
int amb_len;
char ambbuf[100];
- for (amb_len = 0;
- ((*line)[amb_len] && (*line)[amb_len] != ' '
- && (*line)[amb_len] != '\t');
+ for (amb_len = 0; ((*line)[amb_len] && (*line)[amb_len] != ' '
+ && (*line)[amb_len] != '\t');
amb_len++)
;
@@ -2402,14 +2279,14 @@ lookup_cmd (const char **line, struct cmd_list_element *list,
break;
}
}
- error (_("Ambiguous %scommand \"%s\": %s."),
- local_cmdtype.c_str (), *line, ambbuf);
+ error (_ ("Ambiguous %scommand \"%s\": %s."), local_cmdtype.c_str (),
+ *line, ambbuf);
}
}
else
{
if (c->type == set_cmd && **line != '\0' && !isspace (**line))
- error (_("Argument must be preceded by space."));
+ error (_ ("Argument must be preceded by space."));
/* We've got something. It may still not be what the caller
wants (if this command *needs* a subcommand). */
@@ -2428,13 +2305,12 @@ lookup_cmd (const char **line, struct cmd_list_element *list,
/* See command.h. */
struct cmd_list_element *
-lookup_cmd_exact (const char *name,
- struct cmd_list_element *list,
+lookup_cmd_exact (const char *name, struct cmd_list_element *list,
bool ignore_help_classes)
{
const char *tem = name;
- struct cmd_list_element *cmd = lookup_cmd (&tem, list, "", NULL, -1,
- ignore_help_classes);
+ struct cmd_list_element *cmd
+ = lookup_cmd (&tem, list, "", NULL, -1, ignore_help_classes);
if (cmd != nullptr && strcmp (name, cmd->name) != 0)
cmd = nullptr;
return cmd;
@@ -2504,23 +2380,21 @@ deprecated_cmd_warning (const char *text, struct cmd_list_element *list)
tmp_alias_str += std::string (alias->name);
if (cmd->cmd_deprecated)
- gdb_printf (_("Warning: command '%ps' (%ps) is deprecated.\n"),
- styled_string (title_style.style (),
- tmp_cmd_str.c_str ()),
+ gdb_printf (_ ("Warning: command '%ps' (%ps) is deprecated.\n"),
+ styled_string (title_style.style (), tmp_cmd_str.c_str ()),
styled_string (title_style.style (),
tmp_alias_str.c_str ()));
else
- gdb_printf (_("Warning: '%ps', an alias for the command '%ps', "
- "is deprecated.\n"),
+ gdb_printf (_ ("Warning: '%ps', an alias for the command '%ps', "
+ "is deprecated.\n"),
styled_string (title_style.style (),
tmp_alias_str.c_str ()),
styled_string (title_style.style (),
tmp_cmd_str.c_str ()));
}
else
- gdb_printf (_("Warning: command '%ps' is deprecated.\n"),
- styled_string (title_style.style (),
- tmp_cmd_str.c_str ()));
+ gdb_printf (_ ("Warning: command '%ps' is deprecated.\n"),
+ styled_string (title_style.style (), tmp_cmd_str.c_str ()));
/* Now display a second line indicating what the user should use instead.
If it is only the alias that is deprecated, we want to indicate the
@@ -2531,11 +2405,10 @@ deprecated_cmd_warning (const char *text, struct cmd_list_element *list)
else
replacement = cmd->replacement;
if (replacement != nullptr)
- gdb_printf (_("Use '%ps'.\n\n"),
- styled_string (title_style.style (),
- replacement));
+ gdb_printf (_ ("Use '%ps'.\n\n"),
+ styled_string (title_style.style (), replacement));
else
- gdb_printf (_("No alternative known.\n\n"));
+ gdb_printf (_ ("No alternative known.\n\n"));
/* We've warned you, now we'll keep quiet. */
if (alias != nullptr)
@@ -2559,8 +2432,7 @@ deprecated_cmd_warning (const char *text, struct cmd_list_element *list)
*/
static int
-lookup_cmd_composition_1 (const char *text,
- struct cmd_list_element **alias,
+lookup_cmd_composition_1 (const char *text, struct cmd_list_element **alias,
struct cmd_list_element **prefix_cmd,
struct cmd_list_element **cmd,
struct cmd_list_element *cur_list)
@@ -2633,8 +2505,7 @@ lookup_cmd_composition_1 (const char *text,
*/
int
-lookup_cmd_composition (const char *text,
- struct cmd_list_element **alias,
+lookup_cmd_composition (const char *text, struct cmd_list_element **alias,
struct cmd_list_element **prefix_cmd,
struct cmd_list_element **cmd)
{
@@ -2653,9 +2524,8 @@ lookup_cmd_composition (const char *text,
void
complete_on_cmdlist (struct cmd_list_element *list,
- completion_tracker &tracker,
- const char *text, const char *word,
- int ignore_help_classes)
+ completion_tracker &tracker, const char *text,
+ const char *word, int ignore_help_classes)
{
struct cmd_list_element *ptr;
int textlen = strlen (text);
@@ -2671,8 +2541,7 @@ complete_on_cmdlist (struct cmd_list_element *list,
bool got_matches = false;
for (ptr = list; ptr; ptr = ptr->next)
- if (!strncmp (ptr->name, text, textlen)
- && !ptr->abbrev_flag
+ if (!strncmp (ptr->name, text, textlen) && !ptr->abbrev_flag
&& (!ignore_help_classes || !ptr->is_command_class_help ()
|| ptr->is_prefix ()))
{
@@ -2685,8 +2554,8 @@ complete_on_cmdlist (struct cmd_list_element *list,
}
}
- tracker.add_completion
- (make_completion_match_str (ptr->name, text, word));
+ tracker.add_completion (make_completion_match_str (ptr->name, text,
+ word));
got_matches = true;
}
@@ -2710,8 +2579,7 @@ complete_on_cmdlist (struct cmd_list_element *list,
"oobar"; if WORD is "baz/foo", return "baz/foobar". */
void
-complete_on_enum (completion_tracker &tracker,
- const char *const *enumlist,
+complete_on_enum (completion_tracker &tracker, const char *const *enumlist,
const char *text, const char *word)
{
int textlen = strlen (text);
@@ -2737,7 +2605,7 @@ cmd_func (struct cmd_list_element *cmd, const char *args, int from_tty)
cmd->func (args, from_tty, cmd);
}
else
- error (_("Invalid command"));
+ error (_ ("Invalid command"));
}
int
diff --git a/gdb/cli/cli-decode.h b/gdb/cli/cli-decode.h
index 013ffc8fd4c..69cf9ccd5ba 100644
--- a/gdb/cli/cli-decode.h
+++ b/gdb/cli/cli-decode.h
@@ -41,7 +41,6 @@ enum cmd_types
/* This structure records one command'd definition. */
-
struct cmd_list_element
{
cmd_list_element (const char *name_, enum command_class theclass_,
@@ -87,18 +86,15 @@ struct cmd_list_element
std::vector<std::string> command_components () const;
/* Return true if this command is an alias of another command. */
- bool is_alias () const
- { return this->alias_target != nullptr; }
+ bool is_alias () const { return this->alias_target != nullptr; }
/* Return true if this command is a prefix command. */
- bool is_prefix () const
- { return this->subcommands != nullptr; }
+ bool is_prefix () const { return this->subcommands != nullptr; }
/* Return true if this command is a "command class help" command. For
instance, a "stack" dummy command is registered so that one can do
"help stack" and show help for all commands of the "stack" class. */
- bool is_command_class_help () const
- { return this->func == nullptr; }
+ bool is_command_class_help () const { return this->func == nullptr; }
void set_context (void *context)
{
@@ -106,8 +102,7 @@ struct cmd_list_element
m_context = context;
}
- void *context () const
- { return m_context; }
+ void *context () const { return m_context; }
/* Points to next command in this list. */
struct cmd_list_element *next = nullptr;
@@ -177,14 +172,13 @@ struct cmd_list_element
/* The command's real callback. At present func() bounces through
to one of the below. */
union
- {
- /* Most commands don't need the cmd_list_element parameter passed to FUNC.
+ {
+ /* Most commands don't need the cmd_list_element parameter passed to FUNC.
They therefore register a command of this type, which doesn't have the
cmd_list_element parameter. do_simple_func is installed as FUNC, and
acts as a shim between the two. */
- cmd_simple_func_ftype *simple_func;
- }
- function;
+ cmd_simple_func_ftype *simple_func;
+ } function;
/* Documentation of this command (or help topic).
First line is brief documentation; remaining lines form, with it,
@@ -255,8 +249,7 @@ struct cmd_list_element
struct cmd_list_element *alias_target = nullptr;
/* Node to link aliases on an alias list. */
- using aliases_list_node_type
- = intrusive_list_node<cmd_list_element>;
+ using aliases_list_node_type = intrusive_list_node<cmd_list_element>;
aliases_list_node_type aliases_list_node;
/* Linked list of all aliases of this command. */
@@ -274,6 +267,7 @@ struct cmd_list_element
bool *suppress_notification = nullptr;
private:
+
/* Local state (context) for this command. This can be anything. */
void *m_context = nullptr;
};
@@ -301,10 +295,10 @@ extern void print_doc_line (struct ui_file *stream, const char *str,
bool for_value_prefix);
/* The enums of boolean commands. */
-extern const char * const boolean_enums[];
+extern const char *const boolean_enums[];
/* The enums of auto-boolean commands. */
-extern const char * const auto_boolean_enums[];
+extern const char *const auto_boolean_enums[];
/* Verify whether a given cmd_list_element is a user-defined command.
Return 1 if it is user-defined. Return 0 otherwise. */
diff --git a/gdb/cli/cli-dump.c b/gdb/cli/cli-dump.c
index a8811c4b4d7..88242420d33 100644
--- a/gdb/cli/cli-dump.c
+++ b/gdb/cli/cli-dump.c
@@ -51,7 +51,6 @@ scan_expression (const char **cmd, const char *def)
}
}
-
static gdb::unique_xmalloc_ptr<char>
scan_filename (const char **cmd, const char *defname)
{
@@ -63,7 +62,7 @@ scan_filename (const char **cmd, const char *defname)
if ((*cmd) == NULL)
{
if (defname == NULL)
- error (_("Missing filename."));
+ error (_ ("Missing filename."));
filename.reset (xstrdup (defname));
}
else
@@ -86,11 +85,11 @@ bfd_openr_or_error (const char *filename, const char *target)
{
gdb_bfd_ref_ptr ibfd (gdb_bfd_openr (filename, target));
if (ibfd == NULL)
- error (_("Failed to open %s: %s."), filename,
+ error (_ ("Failed to open %s: %s."), filename,
bfd_errmsg (bfd_get_error ()));
if (!bfd_check_format (ibfd.get (), bfd_object))
- error (_("'%s' is not a recognized file format."), filename);
+ error (_ ("'%s' is not a recognized file format."), filename);
return ibfd;
}
@@ -100,21 +99,21 @@ bfd_openw_or_error (const char *filename, const char *target, const char *mode)
{
gdb_bfd_ref_ptr obfd;
- if (*mode == 'w') /* Write: create new file */
+ if (*mode == 'w') /* Write: create new file */
{
obfd = gdb_bfd_openw (filename, target);
if (obfd == NULL)
- error (_("Failed to open %s: %s."), filename,
+ error (_ ("Failed to open %s: %s."), filename,
bfd_errmsg (bfd_get_error ()));
if (!bfd_set_format (obfd.get (), bfd_object))
- error (_("bfd_openw_or_error: %s."), bfd_errmsg (bfd_get_error ()));
+ error (_ ("bfd_openw_or_error: %s."), bfd_errmsg (bfd_get_error ()));
}
- else if (*mode == 'a') /* Append to existing file. */
- { /* FIXME -- doesn't work... */
- error (_("bfd_openw does not work with append."));
+ else if (*mode == 'a') /* Append to existing file. */
+ { /* FIXME -- doesn't work... */
+ error (_ ("bfd_openw does not work with append."));
}
else
- error (_("bfd_openw_or_error: unknown mode %s."), mode);
+ error (_ ("bfd_openw_or_error: unknown mode %s."), mode);
return obfd;
}
@@ -129,8 +128,8 @@ static struct cmd_list_element *binary_dump_cmdlist;
static struct cmd_list_element *binary_append_cmdlist;
static void
-dump_binary_file (const char *filename, const char *mode,
- const bfd_byte *buf, ULONGEST len)
+dump_binary_file (const char *filename, const char *mode, const bfd_byte *buf,
+ ULONGEST len)
{
int status;
@@ -144,9 +143,8 @@ dump_binary_file (const char *filename, const char *mode,
}
static void
-dump_bfd_file (const char *filename, const char *mode,
- const char *target, CORE_ADDR vaddr,
- const bfd_byte *buf, ULONGEST len)
+dump_bfd_file (const char *filename, const char *mode, const char *target,
+ CORE_ADDR vaddr, const bfd_byte *buf, ULONGEST len)
{
asection *osection;
@@ -158,12 +156,13 @@ dump_bfd_file (const char *filename, const char *mode,
bfd_set_section_flags (osection, (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD));
osection->entsize = 0;
if (!bfd_set_section_contents (obfd.get (), osection, buf, 0, len))
- warning (_("writing dump file '%s' (%s)"), filename,
+ warning (_ ("writing dump file '%s' (%s)"), filename,
bfd_errmsg (bfd_get_error ()));
}
static void
-dump_memory_to_file (const char *cmd, const char *mode, const char *file_format)
+dump_memory_to_file (const char *cmd, const char *mode,
+ const char *file_format)
{
CORE_ADDR lo;
CORE_ADDR hi;
@@ -175,25 +174,25 @@ dump_memory_to_file (const char *cmd, const char *mode, const char *file_format)
/* Find the low address. */
if (cmd == NULL || *cmd == '\0')
- error (_("Missing start address."));
+ error (_ ("Missing start address."));
gdb::unique_xmalloc_ptr<char> lo_exp = scan_expression (&cmd, NULL);
/* Find the second address - rest of line. */
if (cmd == NULL || *cmd == '\0')
- error (_("Missing stop address."));
+ error (_ ("Missing stop address."));
hi_exp = cmd;
lo = parse_and_eval_address (lo_exp.get ());
hi = parse_and_eval_address (hi_exp);
if (hi <= lo)
- error (_("Invalid memory address range (start >= end)."));
+ error (_ ("Invalid memory address range (start >= end)."));
count = hi - lo;
/* FIXME: Should use read_memory_partial() and a magic blocking
value. */
gdb::byte_vector buf (count);
read_memory (lo, buf.data (), count);
-
+
/* Have everything. Open/write the data. */
if (file_format == NULL || strcmp (file_format, "binary") == 0)
dump_binary_file (filename.get (), mode, buf.data (), count);
@@ -217,10 +216,10 @@ dump_value_to_file (const char *cmd, const char *mode, const char *file_format)
/* Find the value. */
if (cmd == NULL || *cmd == '\0')
- error (_("No value to %s."), *mode == 'a' ? "append" : "dump");
+ error (_ ("No value to %s."), *mode == 'a' ? "append" : "dump");
val = parse_and_eval (cmd);
if (val == NULL)
- error (_("Invalid expression."));
+ error (_ ("Invalid expression."));
/* Have everything. Open/write the data. */
if (file_format == NULL || strcmp (file_format, "binary") == 0)
@@ -237,11 +236,11 @@ dump_value_to_file (const char *cmd, const char *mode, const char *file_format)
else
{
vaddr = 0;
- warning (_("value is not an lval: address assumed to be zero"));
+ warning (_ ("value is not an lval: address assumed to be zero"));
}
dump_bfd_file (filename.get (), mode, file_format, vaddr,
- value_contents (val).data (),
+ value_contents (val).data (),
value_type (val)->length ());
}
}
@@ -348,7 +347,7 @@ add_dump_command (const char *name,
struct dump_context *d;
c = add_cmd (name, all_commands, descr, &dump_cmdlist);
- c->completer = filename_completer;
+ c->completer = filename_completer;
d = XNEW (struct dump_context);
d->func = func;
d->mode = FOPEN_WB;
@@ -356,7 +355,7 @@ add_dump_command (const char *name,
c->func = call_dump_func;
c = add_cmd (name, all_commands, descr, &append_cmdlist);
- c->completer = filename_completer;
+ c->completer = filename_completer;
d = XNEW (struct dump_context);
d->func = func;
d->mode = FOPEN_AB;
@@ -365,26 +364,20 @@ add_dump_command (const char *name,
/* Replace "Dump " at start of docstring with "Append " (borrowed
from [deleted] deprecated_add_show_from_set). */
- if ( c->doc[0] == 'W'
- && c->doc[1] == 'r'
- && c->doc[2] == 'i'
- && c->doc[3] == 't'
- && c->doc[4] == 'e'
- && c->doc[5] == ' ')
- c->doc = concat ("Append ", c->doc + 6, (char *)NULL);
+ if (c->doc[0] == 'W' && c->doc[1] == 'r' && c->doc[2] == 'i'
+ && c->doc[3] == 't' && c->doc[4] == 'e' && c->doc[5] == ' ')
+ c->doc = concat ("Append ", c->doc + 6, (char *) NULL);
}
/* Selectively loads the sections into memory. */
static void
-restore_one_section (bfd *ibfd, asection *isec,
- CORE_ADDR load_offset,
- CORE_ADDR load_start,
- CORE_ADDR load_end)
+restore_one_section (bfd *ibfd, asection *isec, CORE_ADDR load_offset,
+ CORE_ADDR load_start, CORE_ADDR load_end)
{
- bfd_vma sec_start = bfd_section_vma (isec);
+ bfd_vma sec_start = bfd_section_vma (isec);
bfd_size_type size = bfd_section_size (isec);
- bfd_vma sec_end = sec_start + size;
+ bfd_vma sec_end = sec_start + size;
bfd_size_type sec_offset = 0;
bfd_size_type sec_load_count = size;
int ret;
@@ -394,12 +387,10 @@ restore_one_section (bfd *ibfd, asection *isec,
return;
/* Does the section overlap with the desired restore range? */
- if (sec_end <= load_start
- || (load_end > 0 && sec_start >= load_end))
+ if (sec_end <= load_start || (load_end > 0 && sec_start >= load_end))
{
/* No, no useable data in this section. */
- gdb_printf (_("skipping section %s...\n"),
- bfd_section_name (isec));
+ gdb_printf (_ ("skipping section %s...\n"), bfd_section_name (isec));
return;
}
@@ -416,22 +407,19 @@ restore_one_section (bfd *ibfd, asection *isec,
/* Get the data. */
gdb::byte_vector buf (size);
if (!bfd_get_section_contents (ibfd, isec, buf.data (), 0, size))
- error (_("Failed to read bfd file %s: '%s'."), bfd_get_filename (ibfd),
+ error (_ ("Failed to read bfd file %s: '%s'."), bfd_get_filename (ibfd),
bfd_errmsg (bfd_get_error ()));
- gdb_printf ("Restoring section %s (0x%lx to 0x%lx)",
- bfd_section_name (isec),
- (unsigned long) sec_start,
- (unsigned long) sec_end);
+ gdb_printf ("Restoring section %s (0x%lx to 0x%lx)", bfd_section_name (isec),
+ (unsigned long) sec_start, (unsigned long) sec_end);
if (load_offset != 0 || load_start != 0 || load_end != 0)
gdb_printf (" into memory (%s to %s)\n",
- paddress (target_gdbarch (),
- (unsigned long) sec_start
- + sec_offset + load_offset),
- paddress (target_gdbarch (),
- (unsigned long) sec_start + sec_offset
- + load_offset + sec_load_count));
+ paddress (target_gdbarch (), (unsigned long) sec_start
+ + sec_offset + load_offset),
+ paddress (target_gdbarch (), (unsigned long) sec_start
+ + sec_offset + load_offset
+ + sec_load_count));
else
gdb_puts ("\n");
@@ -439,7 +427,7 @@ restore_one_section (bfd *ibfd, asection *isec,
ret = target_write_memory (sec_start + sec_offset + load_offset,
&buf[sec_offset], sec_load_count);
if (ret != 0)
- warning (_("restore: memory write failed (%s)."), safe_strerror (ret));
+ warning (_ ("restore: memory write failed (%s)."), safe_strerror (ret));
}
static void
@@ -451,7 +439,7 @@ restore_binary_file (const char *filename, CORE_ADDR load_offset,
long len;
if (file == NULL)
- error (_("Failed to open %s: %s"), filename, safe_strerror (errno));
+ error (_ ("Failed to open %s: %s"), filename, safe_strerror (errno));
/* Get the file size for reading. */
if (fseek (file.get (), 0, SEEK_END) == 0)
@@ -464,7 +452,7 @@ restore_binary_file (const char *filename, CORE_ADDR load_offset,
perror_with_name (filename);
if (len <= load_start)
- error (_("Start address is greater than length of binary file %s."),
+ error (_ ("Start address is greater than length of binary file %s."),
filename);
/* Chop off "len" if it exceeds the requested load_end addr. */
@@ -474,11 +462,9 @@ restore_binary_file (const char *filename, CORE_ADDR load_offset,
if (load_start > 0)
len -= load_start;
- gdb_printf
- ("Restoring binary file %s into memory (0x%lx to 0x%lx)\n",
- filename,
- (unsigned long) (load_start + load_offset),
- (unsigned long) (load_start + load_offset + len));
+ gdb_printf ("Restoring binary file %s into memory (0x%lx to 0x%lx)\n",
+ filename, (unsigned long) (load_start + load_offset),
+ (unsigned long) (load_start + load_offset + len));
/* Now set the file pos to the requested load start pos. */
if (fseek (file.get (), load_start, SEEK_SET) != 0)
@@ -492,7 +478,7 @@ restore_binary_file (const char *filename, CORE_ADDR load_offset,
/* Now write the buffer into target memory. */
len = target_write_memory (load_start + load_offset, buf.data (), len);
if (len != 0)
- warning (_("restore: memory write failed (%s)."), safe_strerror (len));
+ warning (_ ("restore: memory write failed (%s)."), safe_strerror (len));
}
static void
@@ -504,8 +490,8 @@ restore_command (const char *args, int from_tty)
noprocess ();
CORE_ADDR load_offset = 0;
- CORE_ADDR load_start = 0;
- CORE_ADDR load_end = 0;
+ CORE_ADDR load_start = 0;
+ CORE_ADDR load_end = 0;
/* Parse the input arguments. First is filename (required). */
gdb::unique_xmalloc_ptr<char> filename = scan_filename (&args, NULL);
@@ -524,19 +510,19 @@ restore_command (const char *args, int from_tty)
if (args != NULL && *args != '\0')
load_offset
= (binary_flag
- ? parse_and_eval_address (scan_expression (&args, NULL).get ())
- : parse_and_eval_long (scan_expression (&args, NULL).get ()));
+ ? parse_and_eval_address (scan_expression (&args, NULL).get ())
+ : parse_and_eval_long (scan_expression (&args, NULL).get ()));
if (args != NULL && *args != '\0')
{
/* Parse start address (optional). */
- load_start =
- parse_and_eval_long (scan_expression (&args, NULL).get ());
+ load_start
+ = parse_and_eval_long (scan_expression (&args, NULL).get ());
if (args != NULL && *args != '\0')
{
/* Parse end address (optional). */
load_end = parse_and_eval_long (args);
if (load_end <= load_start)
- error (_("Start must be less than end."));
+ error (_ ("Start must be less than end."));
}
}
}
@@ -544,13 +530,11 @@ restore_command (const char *args, int from_tty)
if (info_verbose)
gdb_printf ("Restore file %s offset 0x%lx start 0x%lx end 0x%lx\n",
filename.get (), (unsigned long) load_offset,
- (unsigned long) load_start,
- (unsigned long) load_end);
+ (unsigned long) load_start, (unsigned long) load_end);
if (binary_flag)
{
- restore_binary_file (filename.get (), load_offset, load_start,
- load_end);
+ restore_binary_file (filename.get (), load_offset, load_start, load_end);
}
else
{
@@ -565,21 +549,18 @@ restore_command (const char *args, int from_tty)
}
void _initialize_cli_dump ();
+
void
_initialize_cli_dump ()
{
struct cmd_list_element *c;
add_basic_prefix_cmd ("dump", class_vars,
- _("Dump target code/data to a local file."),
- &dump_cmdlist,
- 0/*allow-unknown*/,
- &cmdlist);
+ _ ("Dump target code/data to a local file."),
+ &dump_cmdlist, 0 /*allow-unknown*/, &cmdlist);
add_basic_prefix_cmd ("append", class_vars,
- _("Append target code/data to a local file."),
- &append_cmdlist,
- 0/*allow-unknown*/,
- &cmdlist);
+ _ ("Append target code/data to a local file."),
+ &append_cmdlist, 0 /*allow-unknown*/, &cmdlist);
add_dump_command ("memory", dump_memory_command, "\
Write contents of memory to a raw binary file.\n\
@@ -592,114 +573,104 @@ Arguments are FILE EXPRESSION. Writes the value of EXPRESSION to\n\
the specified FILE in raw target ordered bytes.");
add_basic_prefix_cmd ("srec", all_commands,
- _("Write target code/data to an srec file."),
- &srec_cmdlist,
- 0 /*allow-unknown*/,
- &dump_cmdlist);
+ _ ("Write target code/data to an srec file."),
+ &srec_cmdlist, 0 /*allow-unknown*/, &dump_cmdlist);
add_basic_prefix_cmd ("ihex", all_commands,
- _("Write target code/data to an intel hex file."),
- &ihex_cmdlist,
- 0 /*allow-unknown*/,
- &dump_cmdlist);
+ _ ("Write target code/data to an intel hex file."),
+ &ihex_cmdlist, 0 /*allow-unknown*/, &dump_cmdlist);
add_basic_prefix_cmd ("verilog", all_commands,
- _("Write target code/data to a verilog hex file."),
- &verilog_cmdlist,
- 0 /*allow-unknown*/,
- &dump_cmdlist);
+ _ ("Write target code/data to a verilog hex file."),
+ &verilog_cmdlist, 0 /*allow-unknown*/, &dump_cmdlist);
add_basic_prefix_cmd ("tekhex", all_commands,
- _("Write target code/data to a tekhex file."),
- &tekhex_cmdlist,
- 0 /*allow-unknown*/,
- &dump_cmdlist);
+ _ ("Write target code/data to a tekhex file."),
+ &tekhex_cmdlist, 0 /*allow-unknown*/, &dump_cmdlist);
add_basic_prefix_cmd ("binary", all_commands,
- _("Write target code/data to a raw binary file."),
- &binary_dump_cmdlist,
- 0 /*allow-unknown*/,
+ _ ("Write target code/data to a raw binary file."),
+ &binary_dump_cmdlist, 0 /*allow-unknown*/,
&dump_cmdlist);
add_basic_prefix_cmd ("binary", all_commands,
- _("Append target code/data to a raw binary file."),
- &binary_append_cmdlist,
- 0 /*allow-unknown*/,
+ _ ("Append target code/data to a raw binary file."),
+ &binary_append_cmdlist, 0 /*allow-unknown*/,
&append_cmdlist);
- add_cmd ("memory", all_commands, dump_srec_memory, _("\
+ add_cmd ("memory", all_commands, dump_srec_memory, _ ("\
Write contents of memory to an srec file.\n\
Arguments are FILE START STOP. Writes the contents of memory\n\
within the range [START .. STOP) to the specified FILE in srec format."),
&srec_cmdlist);
- add_cmd ("value", all_commands, dump_srec_value, _("\
+ add_cmd ("value", all_commands, dump_srec_value, _ ("\
Write the value of an expression to an srec file.\n\
Arguments are FILE EXPRESSION. Writes the value of EXPRESSION\n\
to the specified FILE in srec format."),
&srec_cmdlist);
- add_cmd ("memory", all_commands, dump_ihex_memory, _("\
+ add_cmd ("memory", all_commands, dump_ihex_memory, _ ("\
Write contents of memory to an ihex file.\n\
Arguments are FILE START STOP. Writes the contents of memory within\n\
the range [START .. STOP) to the specified FILE in intel hex format."),
&ihex_cmdlist);
- add_cmd ("value", all_commands, dump_ihex_value, _("\
+ add_cmd ("value", all_commands, dump_ihex_value, _ ("\
Write the value of an expression to an ihex file.\n\
Arguments are FILE EXPRESSION. Writes the value of EXPRESSION\n\
to the specified FILE in intel hex format."),
&ihex_cmdlist);
- add_cmd ("memory", all_commands, dump_verilog_memory, _("\
+ add_cmd ("memory", all_commands, dump_verilog_memory, _ ("\
Write contents of memory to a verilog hex file.\n\
Arguments are FILE START STOP. Writes the contents of memory within\n\
the range [START .. STOP) to the specified FILE in verilog hex format."),
&verilog_cmdlist);
- add_cmd ("value", all_commands, dump_verilog_value, _("\
+ add_cmd ("value", all_commands, dump_verilog_value, _ ("\
Write the value of an expression to a verilog hex file.\n\
Arguments are FILE EXPRESSION. Writes the value of EXPRESSION\n\
to the specified FILE in verilog hex format."),
&verilog_cmdlist);
- add_cmd ("memory", all_commands, dump_tekhex_memory, _("\
+ add_cmd ("memory", all_commands, dump_tekhex_memory, _ ("\
Write contents of memory to a tekhex file.\n\
Arguments are FILE START STOP. Writes the contents of memory\n\
within the range [START .. STOP) to the specified FILE in tekhex format."),
&tekhex_cmdlist);
- add_cmd ("value", all_commands, dump_tekhex_value, _("\
+ add_cmd ("value", all_commands, dump_tekhex_value, _ ("\
Write the value of an expression to a tekhex file.\n\
Arguments are FILE EXPRESSION. Writes the value of EXPRESSION\n\
to the specified FILE in tekhex format."),
&tekhex_cmdlist);
- add_cmd ("memory", all_commands, dump_binary_memory, _("\
+ add_cmd ("memory", all_commands, dump_binary_memory, _ ("\
Write contents of memory to a raw binary file.\n\
Arguments are FILE START STOP. Writes the contents of memory\n\
within the range [START .. STOP) to the specified FILE in binary format."),
&binary_dump_cmdlist);
- add_cmd ("value", all_commands, dump_binary_value, _("\
+ add_cmd ("value", all_commands, dump_binary_value, _ ("\
Write the value of an expression to a raw binary file.\n\
Arguments are FILE EXPRESSION. Writes the value of EXPRESSION\n\
to the specified FILE in raw target ordered bytes."),
&binary_dump_cmdlist);
- add_cmd ("memory", all_commands, append_binary_memory, _("\
+ add_cmd ("memory", all_commands, append_binary_memory, _ ("\
Append contents of memory to a raw binary file.\n\
Arguments are FILE START STOP. Writes the contents of memory within the\n\
range [START .. STOP) to the specified FILE in raw target ordered bytes."),
&binary_append_cmdlist);
- add_cmd ("value", all_commands, append_binary_value, _("\
+ add_cmd ("value", all_commands, append_binary_value, _ ("\
Append the value of an expression to a raw binary file.\n\
Arguments are FILE EXPRESSION. Writes the value of EXPRESSION\n\
to the specified FILE in raw target ordered bytes."),
&binary_append_cmdlist);
- c = add_com ("restore", class_vars, restore_command, _("\
+ c = add_com ("restore", class_vars, restore_command, _ ("\
Restore the contents of FILE to target memory.\n\
Arguments are FILE OFFSET START END where all except FILE are optional.\n\
OFFSET will be added to the base address of the file (default zero).\n\
diff --git a/gdb/cli/cli-interp.c b/gdb/cli/cli-interp.c
index 99410147a6c..ab779e12417 100644
--- a/gdb/cli/cli-interp.c
+++ b/gdb/cli/cli-interp.c
@@ -23,7 +23,7 @@
#include "event-top.h"
#include "ui-out.h"
#include "cli-out.h"
-#include "top.h" /* for "execute_command" */
+#include "top.h" /* for "execute_command" */
#include "infrun.h"
#include "observable.h"
#include "gdbthread.h"
@@ -32,16 +32,17 @@
cli_interp_base::cli_interp_base (const char *name)
: interp (name)
-{}
+{
+}
-cli_interp_base::~cli_interp_base ()
-{}
+cli_interp_base::~cli_interp_base () {}
/* The console interpreter. */
class cli_interp final : public cli_interp_base
{
- public:
+public:
+
explicit cli_interp (const char *name);
~cli_interp () = default;
@@ -124,16 +125,16 @@ cli_base_on_normal_stop (struct bpstat *bs, int print_frame)
return;
SWITCH_THRU_ALL_UIS ()
- {
- struct interp *interp = top_level_interpreter ();
- cli_interp_base *cli = as_cli_interp_base (interp);
- if (cli == nullptr)
- continue;
-
- thread_info *thread = inferior_thread ();
- if (should_print_stop_to_console (interp, thread))
- print_stop_event (cli->interp_ui_out ());
- }
+ {
+ struct interp *interp = top_level_interpreter ();
+ cli_interp_base *cli = as_cli_interp_base (interp);
+ if (cli == nullptr)
+ continue;
+
+ thread_info *thread = inferior_thread ();
+ if (should_print_stop_to_console (interp, thread))
+ print_stop_event (cli->interp_ui_out ());
+ }
}
/* Observer for the signal_received notification. */
@@ -142,13 +143,13 @@ static void
cli_base_on_signal_received (enum gdb_signal siggnal)
{
SWITCH_THRU_ALL_UIS ()
- {
- cli_interp_base *cli = as_cli_interp_base (top_level_interpreter ());
- if (cli == nullptr)
- continue;
+ {
+ cli_interp_base *cli = as_cli_interp_base (top_level_interpreter ());
+ if (cli == nullptr)
+ continue;
- print_signal_received_reason (cli->interp_ui_out (), siggnal);
- }
+ print_signal_received_reason (cli->interp_ui_out (), siggnal);
+ }
}
/* Observer for the end_stepping_range notification. */
@@ -157,13 +158,13 @@ static void
cli_base_on_end_stepping_range ()
{
SWITCH_THRU_ALL_UIS ()
- {
- cli_interp_base *cli = as_cli_interp_base (top_level_interpreter ());
- if (cli == nullptr)
- continue;
+ {
+ cli_interp_base *cli = as_cli_interp_base (top_level_interpreter ());
+ if (cli == nullptr)
+ continue;
- print_end_stepping_range_reason (cli->interp_ui_out ());
- }
+ print_end_stepping_range_reason (cli->interp_ui_out ());
+ }
}
/* Observer for the signalled notification. */
@@ -172,13 +173,13 @@ static void
cli_base_on_signal_exited (enum gdb_signal siggnal)
{
SWITCH_THRU_ALL_UIS ()
- {
- cli_interp_base *cli = as_cli_interp_base (top_level_interpreter ());
- if (cli == nullptr)
- continue;
+ {
+ cli_interp_base *cli = as_cli_interp_base (top_level_interpreter ());
+ if (cli == nullptr)
+ continue;
- print_signal_exited_reason (cli->interp_ui_out (), siggnal);
- }
+ print_signal_exited_reason (cli->interp_ui_out (), siggnal);
+ }
}
/* Observer for the exited notification. */
@@ -187,13 +188,13 @@ static void
cli_base_on_exited (int exitstatus)
{
SWITCH_THRU_ALL_UIS ()
- {
- cli_interp_base *cli = as_cli_interp_base (top_level_interpreter ());
- if (cli == nullptr)
- continue;
+ {
+ cli_interp_base *cli = as_cli_interp_base (top_level_interpreter ());
+ if (cli == nullptr)
+ continue;
- print_exited_reason (cli->interp_ui_out (), exitstatus);
- }
+ print_exited_reason (cli->interp_ui_out (), exitstatus);
+ }
}
/* Observer for the no_history notification. */
@@ -202,13 +203,13 @@ static void
cli_base_on_no_history ()
{
SWITCH_THRU_ALL_UIS ()
- {
- cli_interp_base *cli = as_cli_interp_base (top_level_interpreter ());
- if (cli == nullptr)
- continue;
+ {
+ cli_interp_base *cli = as_cli_interp_base (top_level_interpreter ());
+ if (cli == nullptr)
+ continue;
- print_no_history_reason (cli->interp_ui_out ());
- }
+ print_no_history_reason (cli->interp_ui_out ());
+ }
}
/* Observer for the sync_execution_done notification. */
@@ -247,18 +248,18 @@ cli_base_on_user_selected_context_changed (user_selected_what selection)
thread_info *tp = inferior_ptid != null_ptid ? inferior_thread () : nullptr;
SWITCH_THRU_ALL_UIS ()
- {
- cli_interp_base *cli = as_cli_interp_base (top_level_interpreter ());
- if (cli == nullptr)
- continue;
-
- if (selection & USER_SELECTED_INFERIOR)
- print_selected_inferior (cli->interp_ui_out ());
-
- if (tp != nullptr
- && ((selection & (USER_SELECTED_THREAD | USER_SELECTED_FRAME))))
- print_selected_thread_frame (cli->interp_ui_out (), selection);
- }
+ {
+ cli_interp_base *cli = as_cli_interp_base (top_level_interpreter ());
+ if (cli == nullptr)
+ continue;
+
+ if (selection & USER_SELECTED_INFERIOR)
+ print_selected_inferior (cli->interp_ui_out ());
+
+ if (tp != nullptr
+ && ((selection & (USER_SELECTED_THREAD | USER_SELECTED_FRAME))))
+ print_selected_thread_frame (cli->interp_ui_out (), selection);
+ }
}
/* pre_command_loop implementation. */
@@ -320,11 +321,14 @@ cli_interp::exec (const char *command_str)
It is important that it gets reset everytime, since the user
could set gdb to use a different interpreter. */
ui_file *old_stream = m_cli_uiout->set_stream (gdb_stdout);
- SCOPE_EXIT { m_cli_uiout->set_stream (old_stream); };
+ SCOPE_EXIT
+ {
+ m_cli_uiout->set_stream (old_stream);
+ };
/* Save and override the global ``struct ui_out'' builder. */
- scoped_restore saved_uiout = make_scoped_restore (&current_uiout,
- m_cli_uiout.get ());
+ scoped_restore saved_uiout
+ = make_scoped_restore (&current_uiout, m_cli_uiout.get ());
try
{
@@ -374,16 +378,16 @@ cli_interp_base::set_logging (ui_file_up logfile, bool logging_redirect,
ui_file *new_stderr = logfile_p;
if (!logging_redirect)
{
- m_saved_output->stdout_holder.reset
- (new tee_file (gdb_stdout, logfile_p));
+ m_saved_output->stdout_holder.reset (new tee_file (gdb_stdout,
+ logfile_p));
new_stdout = m_saved_output->stdout_holder.get ();
- m_saved_output->stderr_holder.reset
- (new tee_file (gdb_stderr, logfile_p));
+ m_saved_output->stderr_holder.reset (new tee_file (gdb_stderr,
+ logfile_p));
new_stderr = m_saved_output->stderr_holder.get ();
}
- m_saved_output->stdlog_holder.reset
- (new timestamped_file (debug_redirect ? logfile_p : new_stderr));
+ m_saved_output->stdlog_holder.reset (
+ new timestamped_file (debug_redirect ? logfile_p : new_stderr));
gdb_stdout = new_stdout;
gdb_stdlog = m_saved_output->stdlog_holder.get ();
@@ -414,6 +418,7 @@ cli_interp_factory (const char *name)
/* Standard gdb initialization hook. */
void _initialize_cli_interp ();
+
void
_initialize_cli_interp ()
{
@@ -429,11 +434,12 @@ _initialize_cli_interp ()
gdb::observers::signal_exited.attach (cli_base_on_signal_exited,
"cli-interp-base");
gdb::observers::exited.attach (cli_base_on_exited, "cli-interp-base");
- gdb::observers::no_history.attach (cli_base_on_no_history, "cli-interp-base");
+ gdb::observers::no_history.attach (cli_base_on_no_history,
+ "cli-interp-base");
gdb::observers::sync_execution_done.attach (cli_base_on_sync_execution_done,
"cli-interp-base");
gdb::observers::command_error.attach (cli_base_on_command_error,
"cli-interp-base");
- gdb::observers::user_selected_context_changed.attach
- (cli_base_on_user_selected_context_changed, "cli-interp-base");
+ gdb::observers::user_selected_context_changed.attach (
+ cli_base_on_user_selected_context_changed, "cli-interp-base");
}
diff --git a/gdb/cli/cli-interp.h b/gdb/cli/cli-interp.h
index 5ed998f58bd..e24810246da 100644
--- a/gdb/cli/cli-interp.h
+++ b/gdb/cli/cli-interp.h
@@ -25,6 +25,7 @@
class cli_interp_base : public interp
{
public:
+
explicit cli_interp_base (const char *name);
virtual ~cli_interp_base () = 0;
@@ -34,6 +35,7 @@ public:
bool supports_command_editing () override;
private:
+
struct saved_output_files
{
/* Saved gdb_stdout, gdb_stderr, etc. */
diff --git a/gdb/cli/cli-logging.c b/gdb/cli/cli-logging.c
index a74e43034e8..a346dc612f7 100644
--- a/gdb/cli/cli-logging.c
+++ b/gdb/cli/cli-logging.c
@@ -27,11 +27,12 @@
static std::string saved_filename;
static std::string logging_filename = "gdb.txt";
+
static void
show_logging_filename (struct ui_file *file, int from_tty,
struct cmd_list_element *c, const char *value)
{
- gdb_printf (file, _("The current logfile is \"%ps\".\n"),
+ gdb_printf (file, _ ("The current logfile is \"%ps\".\n"),
styled_string (file_name_style.style (), value));
}
@@ -41,13 +42,14 @@ static void
maybe_warn_already_logging ()
{
if (!saved_filename.empty ())
- warning (_("Currently logging to %s. Turn the logging off and on to "
- "make the new setting effective."), saved_filename.c_str ());
+ warning (_ ("Currently logging to %s. Turn the logging off and on to "
+ "make the new setting effective."),
+ saved_filename.c_str ());
}
static void
-set_logging_overwrite (const char *args,
- int from_tty, struct cmd_list_element *c)
+set_logging_overwrite (const char *args, int from_tty,
+ struct cmd_list_element *c)
{
maybe_warn_already_logging ();
}
@@ -57,9 +59,9 @@ show_logging_overwrite (struct ui_file *file, int from_tty,
struct cmd_list_element *c, const char *value)
{
if (logging_overwrite)
- gdb_printf (file, _("on: Logging overwrites the log file.\n"));
+ gdb_printf (file, _ ("on: Logging overwrites the log file.\n"));
else
- gdb_printf (file, _("off: Logging appends to the log file.\n"));
+ gdb_printf (file, _ ("off: Logging appends to the log file.\n"));
}
/* Value as configured by the user. */
@@ -67,8 +69,8 @@ static bool logging_redirect;
static bool debug_redirect;
static void
-set_logging_redirect (const char *args,
- int from_tty, struct cmd_list_element *c)
+set_logging_redirect (const char *args, int from_tty,
+ struct cmd_list_element *c)
{
maybe_warn_already_logging ();
}
@@ -78,23 +80,22 @@ show_logging_redirect (struct ui_file *file, int from_tty,
struct cmd_list_element *c, const char *value)
{
if (logging_redirect)
- gdb_printf (file, _("on: Output will go only to the log file.\n"));
+ gdb_printf (file, _ ("on: Output will go only to the log file.\n"));
else
- gdb_printf
- (file,
- _("off: Output will go to both the screen and the log file.\n"));
+ gdb_printf (
+ file, _ ("off: Output will go to both the screen and the log file.\n"));
}
static void
show_logging_debug_redirect (struct ui_file *file, int from_tty,
- struct cmd_list_element *c, const char *value)
+ struct cmd_list_element *c, const char *value)
{
if (debug_redirect)
- gdb_printf (file, _("on: Debug output will go only to the log file.\n"));
+ gdb_printf (file, _ ("on: Debug output will go only to the log file.\n"));
else
- gdb_printf
- (file,
- _("off: Debug output will go to both the screen and the log file.\n"));
+ gdb_printf (
+ file,
+ _ ("off: Debug output will go to both the screen and the log file.\n"));
}
/* If we've pushed output files, close them and pop them. */
@@ -114,24 +115,21 @@ handle_redirections (int from_tty)
{
if (!saved_filename.empty ())
{
- gdb_printf ("Already logging to %s.\n",
- saved_filename.c_str ());
+ gdb_printf ("Already logging to %s.\n", saved_filename.c_str ());
return;
}
stdio_file_up log (new no_terminal_escape_file ());
if (!log->open (logging_filename.c_str (), logging_overwrite ? "w" : "a"))
- perror_with_name (_("set logging"));
+ perror_with_name (_ ("set logging"));
/* Redirects everything to gdb_stdout while this is running. */
if (from_tty)
{
if (!logging_redirect)
- gdb_printf ("Copying output to %s.\n",
- logging_filename.c_str ());
+ gdb_printf ("Copying output to %s.\n", logging_filename.c_str ());
else
- gdb_printf ("Redirecting output to %s.\n",
- logging_filename.c_str ());
+ gdb_printf ("Redirecting output to %s.\n", logging_filename.c_str ());
if (!debug_redirect)
gdb_printf ("Copying debug output to %s.\n",
@@ -168,7 +166,7 @@ set_logging_on (const char *args, int from_tty)
handle_redirections (from_tty);
}
-static void
+static void
set_logging_off (const char *args, int from_tty)
{
if (saved_filename.empty ())
@@ -176,16 +174,15 @@ set_logging_off (const char *args, int from_tty)
pop_output_files ();
if (from_tty)
- gdb_printf ("Done logging to %s.\n",
- saved_filename.c_str ());
+ gdb_printf ("Done logging to %s.\n", saved_filename.c_str ());
saved_filename.clear ();
}
static bool logging_enabled;
static void
-set_logging_enabled (const char *args,
- int from_tty, struct cmd_list_element *c)
+set_logging_enabled (const char *args, int from_tty,
+ struct cmd_list_element *c)
{
if (logging_enabled)
set_logging_on (args, from_tty);
@@ -195,74 +192,77 @@ set_logging_enabled (const char *args,
static void
show_logging_enabled (struct ui_file *file, int from_tty,
- struct cmd_list_element *c, const char *value)
+ struct cmd_list_element *c, const char *value)
{
if (logging_enabled)
- gdb_printf (file, _("on: Logging is enabled.\n"));
+ gdb_printf (file, _ ("on: Logging is enabled.\n"));
else
- gdb_printf (file, _("off: Logging is disabled.\n"));
+ gdb_printf (file, _ ("off: Logging is disabled.\n"));
}
void _initialize_cli_logging ();
+
void
_initialize_cli_logging ()
{
static struct cmd_list_element *set_logging_cmdlist, *show_logging_cmdlist;
/* Set/show logging. */
- add_setshow_prefix_cmd ("logging", class_support,
- _("Set logging options."),
- _("Show logging options."),
- &set_logging_cmdlist, &show_logging_cmdlist,
- &setlist, &showlist);
+ add_setshow_prefix_cmd ("logging", class_support, _ ("Set logging options."),
+ _ ("Show logging options."), &set_logging_cmdlist,
+ &show_logging_cmdlist, &setlist, &showlist);
/* Set/show logging overwrite. */
- add_setshow_boolean_cmd ("overwrite", class_support, &logging_overwrite, _("\
-Set whether logging overwrites or appends to the log file."), _("\
-Show whether logging overwrites or appends to the log file."), _("\
+ add_setshow_boolean_cmd ("overwrite", class_support, &logging_overwrite,
+ _ ("\
+Set whether logging overwrites or appends to the log file."),
+ _ ("\
+Show whether logging overwrites or appends to the log file."),
+ _ ("\
If set, logging overwrites the log file."),
- set_logging_overwrite,
- show_logging_overwrite,
+ set_logging_overwrite, show_logging_overwrite,
&set_logging_cmdlist, &show_logging_cmdlist);
/* Set/show logging redirect. */
- add_setshow_boolean_cmd ("redirect", class_support, &logging_redirect, _("\
-Set the logging output mode."), _("\
-Show the logging output mode."), _("\
+ add_setshow_boolean_cmd ("redirect", class_support, &logging_redirect, _ ("\
+Set the logging output mode."),
+ _ ("\
+Show the logging output mode."),
+ _ ("\
If redirect is off, output will go to both the screen and the log file.\n\
If redirect is on, output will go only to the log file."),
- set_logging_redirect,
- show_logging_redirect,
+ set_logging_redirect, show_logging_redirect,
&set_logging_cmdlist, &show_logging_cmdlist);
/* Set/show logging debugredirect. */
- add_setshow_boolean_cmd ("debugredirect", class_support,
- &debug_redirect, _("\
-Set the logging debug output mode."), _("\
-Show the logging debug output mode."), _("\
+ add_setshow_boolean_cmd ("debugredirect", class_support, &debug_redirect,
+ _ ("\
+Set the logging debug output mode."),
+ _ ("\
+Show the logging debug output mode."),
+ _ ("\
If debug redirect is off, debug will go to both the screen and the log file.\n\
If debug redirect is on, debug will go only to the log file."),
- set_logging_redirect,
- show_logging_debug_redirect,
+ set_logging_redirect, show_logging_debug_redirect,
&set_logging_cmdlist, &show_logging_cmdlist);
/* Set/show logging file. */
- add_setshow_filename_cmd ("file", class_support, &logging_filename, _("\
-Set the current logfile."), _("\
-Show the current logfile."), _("\
+ add_setshow_filename_cmd ("file", class_support, &logging_filename, _ ("\
+Set the current logfile."),
+ _ ("\
+Show the current logfile."),
+ _ ("\
The logfile is used when directing GDB's output."),
- NULL,
- show_logging_filename,
- &set_logging_cmdlist, &show_logging_cmdlist);
+ NULL, show_logging_filename, &set_logging_cmdlist,
+ &show_logging_cmdlist);
/* Set/show logging enabled. */
set_show_commands setshow_logging_enabled_cmds
= add_setshow_boolean_cmd ("enabled", class_support, &logging_enabled,
- _("Enable logging."),
- _("Show whether logging is enabled."),
- _("When on, enable logging."),
- set_logging_enabled,
- show_logging_enabled,
+ _ ("Enable logging."),
+ _ ("Show whether logging is enabled."),
+ _ ("When on, enable logging."),
+ set_logging_enabled, show_logging_enabled,
&set_logging_cmdlist, &show_logging_cmdlist);
/* Set logging on, deprecated alias. */
diff --git a/gdb/cli/cli-option.c b/gdb/cli/cli-option.c
index 9b303b1304e..039dc0a55ff 100644
--- a/gdb/cli/cli-option.c
+++ b/gdb/cli/cli-option.c
@@ -25,8 +25,10 @@
#include "command.h"
#include <vector>
-namespace gdb {
-namespace option {
+namespace gdb
+{
+namespace option
+{
/* An option's value. Which field is active depends on the option's
type. */
@@ -151,16 +153,16 @@ find_end_options_delimiter (const char *args)
static void
complete_on_options (gdb::array_view<const option_def_group> options_group,
- completion_tracker &tracker,
- const char *text, const char *word)
+ completion_tracker &tracker, const char *text,
+ const char *word)
{
size_t textlen = strlen (text);
for (const auto &grp : options_group)
for (const auto &opt : grp.options)
if (strncmp (opt.name, text, textlen) == 0)
{
- tracker.add_completion
- (make_completion_match_str (opt.name, text, word));
+ tracker.add_completion (make_completion_match_str (opt.name, text,
+ word));
}
}
@@ -179,8 +181,7 @@ complete_on_all_options (completion_tracker &tracker,
static gdb::optional<option_def_and_value>
parse_option (gdb::array_view<const option_def_group> options_group,
- process_options_mode mode,
- bool have_delimiter,
+ process_options_mode mode, bool have_delimiter,
const char **args,
parse_option_completion_info *completion = nullptr)
{
@@ -189,7 +190,7 @@ parse_option (gdb::array_view<const option_def_group> options_group,
else if (**args != '-')
{
if (have_delimiter)
- error (_("Unrecognized option at: %s"), *args);
+ error (_ ("Unrecognized option at: %s"), *args);
return {};
}
else if (check_for_argument (args, "--"))
@@ -213,13 +214,12 @@ parse_option (gdb::array_view<const option_def_group> options_group,
{
if (completion != nullptr && arg[len] == '\0')
{
- complete_on_options (options_group,
- completion->tracker,
+ complete_on_options (options_group, completion->tracker,
arg, completion->word);
return {};
}
- error (_("Ambiguous option at: -%s"), arg);
+ error (_ ("Ambiguous option at: -%s"), arg);
}
match = &o;
@@ -235,15 +235,15 @@ parse_option (gdb::array_view<const option_def_group> options_group,
if (match == nullptr)
{
if (have_delimiter || mode != PROCESS_OPTIONS_UNKNOWN_IS_OPERAND)
- error (_("Unrecognized option at: %s"), *args);
+ error (_ ("Unrecognized option at: %s"), *args);
return {};
}
if (completion != nullptr && arg[len] == '\0')
{
- complete_on_options (options_group, completion->tracker,
- arg, completion->word);
+ complete_on_options (options_group, completion->tracker, arg,
+ completion->word);
return {};
}
@@ -260,7 +260,7 @@ parse_option (gdb::array_view<const option_def_group> options_group,
{
option_value val;
val.boolean = true;
- return option_def_and_value {*match, match_ctx, val};
+ return option_def_and_value { *match, match_ctx, val };
}
const char *val_str = *args;
@@ -272,11 +272,11 @@ parse_option (gdb::array_view<const option_def_group> options_group,
if (mode == PROCESS_OPTIONS_REQUIRE_DELIMITER)
{
- complete_on_enum (completion->tracker,
- boolean_enums, val_str, val_str);
+ complete_on_enum (completion->tracker, boolean_enums, val_str,
+ val_str);
complete_on_all_options (completion->tracker, options_group);
}
- return option_def_and_value {*match, match_ctx};
+ return option_def_and_value { *match, match_ctx };
}
else if (**args == '-')
{
@@ -306,20 +306,20 @@ parse_option (gdb::array_view<const option_def_group> options_group,
{
if (*end == '\0')
{
- complete_on_enum (completion->tracker,
- boolean_enums, val_str, val_str);
- return option_def_and_value {*match, match_ctx};
+ complete_on_enum (completion->tracker, boolean_enums,
+ val_str, val_str);
+ return option_def_and_value { *match, match_ctx };
}
}
if (have_delimiter)
- error (_("Value given for `-%s' is not a boolean: %.*s"),
+ error (_ ("Value given for `-%s' is not a boolean: %.*s"),
match->name, (int) (end - val_str), val_str);
/* The user didn't separate options from operands
using "--", so treat this unrecognized value as the
start of the operands. This makes "frame apply all
-past-main CMD" work. */
- return option_def_and_value {*match, match_ctx};
+ return option_def_and_value { *match, match_ctx };
}
else if (completion != nullptr && **args == '\0')
{
@@ -339,11 +339,8 @@ parse_option (gdb::array_view<const option_def_group> options_group,
"p -object 1[TAB]" -> "p -object 1" (i.e., nothing happens).
*/
static const char *const all_boolean_enums[] = {
- "on", "off",
- "yes", "no",
- "enable", "disable",
- "0", "1",
- nullptr,
+ "on", "off", "yes", "no", "enable",
+ "disable", "0", "1", nullptr,
};
complete_on_enum (completion->tracker, all_boolean_enums,
val_str, val_str);
@@ -353,7 +350,7 @@ parse_option (gdb::array_view<const option_def_group> options_group,
option_value val;
val.boolean = res;
- return option_def_and_value {*match, match_ctx, val};
+ return option_def_and_value { *match, match_ctx, val };
}
case var_uinteger:
case var_integer:
@@ -367,25 +364,23 @@ parse_option (gdb::array_view<const option_def_group> options_group,
so that readline doesn't do a partial match. */
if (**args == '\0')
{
- completion->tracker.add_completion
- (make_unique_xstrdup ("NUMBER"));
+ completion->tracker.add_completion (
+ make_unique_xstrdup ("NUMBER"));
for (const literal_def *l = match->extra_literals;
- l->literal != nullptr;
- l++)
- completion->tracker.add_completion
- (make_unique_xstrdup (l->literal));
+ l->literal != nullptr; l++)
+ completion->tracker.add_completion (
+ make_unique_xstrdup (l->literal));
return {};
}
else
{
bool completions = false;
for (const literal_def *l = match->extra_literals;
- l->literal != nullptr;
- l++)
+ l->literal != nullptr; l++)
if (startswith (l->literal, *args))
{
- completion->tracker.add_completion
- (make_unique_xstrdup (l->literal));
+ completion->tracker.add_completion (
+ make_unique_xstrdup (l->literal));
completions = true;
}
if (completions)
@@ -393,15 +388,14 @@ parse_option (gdb::array_view<const option_def_group> options_group,
}
}
- LONGEST v = parse_cli_var_integer (match->type,
- match->extra_literals,
+ LONGEST v = parse_cli_var_integer (match->type, match->extra_literals,
args, false);
option_value val;
if (match->type == var_uinteger)
val.uinteger = v;
else
val.integer = v;
- return option_def_and_value {*match, match_ctx, val};
+ return option_def_and_value { *match, match_ctx, val };
}
case var_enum:
{
@@ -410,8 +404,8 @@ parse_option (gdb::array_view<const option_def_group> options_group,
const char *after_arg = skip_to_space (*args);
if (*after_arg == '\0')
{
- complete_on_enum (completion->tracker,
- match->enums, *args, *args);
+ complete_on_enum (completion->tracker, match->enums, *args,
+ *args);
if (completion->tracker.have_completions ())
return {};
@@ -432,7 +426,7 @@ parse_option (gdb::array_view<const option_def_group> options_group,
option_value val;
val.enumeration = parse_cli_var_enum (args, match->enums);
- return option_def_and_value {*match, match_ctx, val};
+ return option_def_and_value { *match, match_ctx, val };
}
case var_string:
{
@@ -440,17 +434,17 @@ parse_option (gdb::array_view<const option_def_group> options_group,
{
/* Treat e.g., "maint test-options -string --" as if there
was no argument after "-string". */
- error (_("-%s requires an argument"), match->name);
+ error (_ ("-%s requires an argument"), match->name);
}
const char *arg_start = *args;
std::string str = extract_string_maybe_quoted (args);
if (*args == arg_start)
- error (_("-%s requires an argument"), match->name);
+ error (_ ("-%s requires an argument"), match->name);
option_value val;
val.string = new std::string (std::move (str));
- return option_def_and_value {*match, match_ctx, val};
+ return option_def_and_value { *match, match_ctx, val };
}
default:
@@ -464,8 +458,7 @@ parse_option (gdb::array_view<const option_def_group> options_group,
/* See cli-option.h. */
bool
-complete_options (completion_tracker &tracker,
- const char **args,
+complete_options (completion_tracker &tracker, const char **args,
process_options_mode mode,
gdb::array_view<const option_def_group> options_group)
{
@@ -478,7 +471,7 @@ complete_options (completion_tracker &tracker,
if (text[0] == '-' && (!have_delimiter || *delimiter == '\0'))
{
- parse_option_completion_info completion_info {nullptr, tracker};
+ parse_option_completion_info completion_info { nullptr, tracker };
while (1)
{
@@ -497,16 +490,15 @@ complete_options (completion_tracker &tracker,
else if (**args == '-')
{
gdb::optional<option_def_and_value> ov
- = parse_option (options_group, mode, have_delimiter,
- args, &completion_info);
+ = parse_option (options_group, mode, have_delimiter, args,
+ &completion_info);
if (!ov && !tracker.have_completions ())
{
tracker.advance_custom_word_point_by (*args - text);
return mode == PROCESS_OPTIONS_REQUIRE_DELIMITER;
}
- if (ov
- && ov->option.type == var_boolean
+ if (ov && ov->option.type == var_boolean
&& !ov->value.has_value ())
{
/* Looked like a boolean option, but we failed to
@@ -529,13 +521,10 @@ complete_options (completion_tracker &tracker,
(gdb) frame apply all -limit 10[TAB]
we don't try to complete on command names. */
- if (ov
- && !tracker.have_completions ()
- && **args == '\0'
+ if (ov && !tracker.have_completions () && **args == '\0'
&& *args > text && !isspace ((*args)[-1]))
{
- tracker.advance_custom_word_point_by
- (*args - text);
+ tracker.advance_custom_word_point_by (*args - text);
return true;
}
@@ -546,16 +535,15 @@ complete_options (completion_tracker &tracker,
}
else
{
- tracker.advance_custom_word_point_by
- (completion_info.word - text);
+ tracker.advance_custom_word_point_by (completion_info.word
+ - text);
/* If the command requires a delimiter, but we haven't
seen one, then return true, so that the caller
doesn't try to complete on whatever follows options,
which for these commands should only be done if
there's a delimiter. */
- if (mode == PROCESS_OPTIONS_REQUIRE_DELIMITER
- && !have_delimiter)
+ if (mode == PROCESS_OPTIONS_REQUIRE_DELIMITER && !have_delimiter)
{
/* If we reached the end of the input string, then
offer all options, since that's all the user can
@@ -570,8 +558,8 @@ complete_options (completion_tracker &tracker,
if (tracker.have_completions ())
{
- tracker.advance_custom_word_point_by
- (completion_info.word - text);
+ tracker.advance_custom_word_point_by (completion_info.word
+ - text);
return true;
}
}
@@ -624,8 +612,7 @@ save_option_value_in_ctx (gdb::optional<option_def_and_value> &ov)
/* See cli-option.h. */
bool
-process_options (const char **args,
- process_options_mode mode,
+process_options (const char **args, process_options_mode mode,
gdb::array_view<const option_def_group> options_group)
{
if (*args == nullptr)
@@ -681,8 +668,7 @@ get_val_type_str (const option_def &opt, std::string &buffer)
buffer = "NUMBER";
if (opt.extra_literals != nullptr)
for (const literal_def *l = opt.extra_literals;
- l->literal != nullptr;
- l++)
+ l->literal != nullptr; l++)
{
buffer += '|';
buffer += l->literal;
@@ -791,8 +777,7 @@ build_help (const char *help_tmpl,
/* See cli-option.h. */
void
-add_setshow_cmds_for_options (command_class cmd_class,
- void *data,
+add_setshow_cmds_for_options (command_class cmd_class, void *data,
gdb::array_view<const option_def> options,
struct cmd_list_element **set_list,
struct cmd_list_element **show_list)
@@ -804,48 +789,39 @@ add_setshow_cmds_for_options (command_class cmd_class,
add_setshow_boolean_cmd (option.name, cmd_class,
option.var_address.boolean (option, data),
option.set_doc, option.show_doc,
- option.help_doc,
- nullptr, option.show_cmd_cb,
- set_list, show_list);
+ option.help_doc, nullptr,
+ option.show_cmd_cb, set_list, show_list);
}
else if (option.type == var_uinteger)
{
add_setshow_uinteger_cmd (option.name, cmd_class,
option.var_address.uinteger (option, data),
- option.extra_literals,
- option.set_doc, option.show_doc,
- option.help_doc,
- nullptr, option.show_cmd_cb,
- set_list, show_list);
+ option.extra_literals, option.set_doc,
+ option.show_doc, option.help_doc, nullptr,
+ option.show_cmd_cb, set_list, show_list);
}
else if (option.type == var_integer)
{
add_setshow_integer_cmd (option.name, cmd_class,
option.var_address.integer (option, data),
- option.extra_literals,
- option.set_doc, option.show_doc,
- option.help_doc,
- nullptr, option.show_cmd_cb,
- set_list, show_list);
+ option.extra_literals, option.set_doc,
+ option.show_doc, option.help_doc, nullptr,
+ option.show_cmd_cb, set_list, show_list);
}
else if (option.type == var_pinteger)
{
add_setshow_pinteger_cmd (option.name, cmd_class,
option.var_address.integer (option, data),
- option.extra_literals,
- option.set_doc, option.show_doc,
- option.help_doc,
- nullptr, option.show_cmd_cb,
- set_list, show_list);
+ option.extra_literals, option.set_doc,
+ option.show_doc, option.help_doc, nullptr,
+ option.show_cmd_cb, set_list, show_list);
}
else if (option.type == var_enum)
{
- add_setshow_enum_cmd (option.name, cmd_class,
- option.enums,
+ add_setshow_enum_cmd (option.name, cmd_class, option.enums,
option.var_address.enumeration (option, data),
option.set_doc, option.show_doc,
- option.help_doc,
- nullptr, option.show_cmd_cb,
+ option.help_doc, nullptr, option.show_cmd_cb,
set_list, show_list);
}
else if (option.type == var_string)
@@ -853,8 +829,7 @@ add_setshow_cmds_for_options (command_class cmd_class,
add_setshow_string_cmd (option.name, cmd_class,
option.var_address.string (option, data),
option.set_doc, option.show_doc,
- option.help_doc,
- nullptr, option.show_cmd_cb,
+ option.help_doc, nullptr, option.show_cmd_cb,
set_list, show_list);
}
else
diff --git a/gdb/cli/cli-option.h b/gdb/cli/cli-option.h
index 7b015b89f47..c67b6d2e6c7 100644
--- a/gdb/cli/cli-option.h
+++ b/gdb/cli/cli-option.h
@@ -26,8 +26,10 @@
#include <string>
#include "command.h"
-namespace gdb {
-namespace option {
+namespace gdb
+{
+namespace option
+{
/* A type-erased option definition. The actual type of the option is
stored in the TYPE field. Client code cannot define objects of
@@ -38,7 +40,9 @@ struct option_def
{
/* The ctor is protected because you're supposed to construct using
one of bool_option_def, etc. below. */
+
protected:
+
typedef void *(erased_get_var_address_ftype) ();
/* Construct an option. NAME_ is the option's name. VAR_TYPE_
@@ -47,22 +51,25 @@ protected:
SHOW_CMD_CB_ is a pointer to callback for the "show" command that
is installed for this option. SET_DOC_, SHOW_DOC_, HELP_DOC_ are
used to create the option's "set/show" commands. */
- constexpr option_def (const char *name_,
- var_types var_type_,
+ constexpr option_def (const char *name_, var_types var_type_,
const literal_def *extra_literals_,
erased_get_var_address_ftype *erased_get_var_address_,
- show_value_ftype *show_cmd_cb_,
- const char *set_doc_,
- const char *show_doc_,
- const char *help_doc_)
- : name (name_), type (var_type_), extra_literals (extra_literals_),
+ show_value_ftype *show_cmd_cb_, const char *set_doc_,
+ const char *show_doc_, const char *help_doc_)
+ : name (name_),
+ type (var_type_),
+ extra_literals (extra_literals_),
erased_get_var_address (erased_get_var_address_),
var_address {},
show_cmd_cb (show_cmd_cb_),
- set_doc (set_doc_), show_doc (show_doc_), help_doc (help_doc_)
- {}
+ set_doc (set_doc_),
+ show_doc (show_doc_),
+ help_doc (help_doc_)
+ {
+ }
public:
+
/* The option's name. */
const char *name;
@@ -85,14 +92,13 @@ public:
object that groups the option variables from which the callback
returns the address of some member. */
union
- {
- bool *(*boolean) (const option_def &, void *ctx);
- unsigned int *(*uinteger) (const option_def &, void *ctx);
- int *(*integer) (const option_def &, void *ctx);
- const char **(*enumeration) (const option_def &, void *ctx);
- std::string *(*string) (const option_def &, void *ctx);
- }
- var_address;
+ {
+ bool *(*boolean) (const option_def &, void *ctx);
+ unsigned int *(*uinteger) (const option_def &, void *ctx);
+ int *(*integer) (const option_def &, void *ctx);
+ const char **(*enumeration) (const option_def &, void *ctx);
+ std::string *(*string) (const option_def &, void *ctx);
+ } var_address;
/* Pointer to null terminated list of enumerated values (like argv).
Only used by var_enum options. */
@@ -116,10 +122,7 @@ public:
/* Convenience method that returns THIS as an option_def. Useful
when you're putting an option_def subclass in an option_def
array_view. */
- const option_def &def () const
- {
- return *this;
- }
+ const option_def &def () const { return *this; }
};
namespace detail
@@ -160,14 +163,12 @@ struct boolean_option_def : option_def
{
boolean_option_def (const char *long_option_,
bool *(*get_var_address_cb_) (Context *),
- show_value_ftype *show_cmd_cb_,
- const char *set_doc_,
+ show_value_ftype *show_cmd_cb_, const char *set_doc_,
const char *show_doc_ = nullptr,
const char *help_doc_ = nullptr)
: option_def (long_option_, var_boolean, nullptr,
(erased_get_var_address_ftype *) get_var_address_cb_,
- show_cmd_cb_,
- set_doc_, show_doc_, help_doc_)
+ show_cmd_cb_, set_doc_, show_doc_, help_doc_)
{
var_address.boolean = detail::get_var_address<bool, Context>;
}
@@ -181,23 +182,18 @@ template<typename Context = bool>
struct flag_option_def : boolean_option_def<Context>
{
flag_option_def (const char *long_option_,
- bool *(*var_address_cb_) (Context *),
- const char *set_doc_,
- const char *help_doc_ = nullptr)
- : boolean_option_def<Context> (long_option_,
- var_address_cb_,
- NULL,
+ bool *(*var_address_cb_) (Context *), const char *set_doc_,
+ const char *help_doc_ = nullptr)
+ : boolean_option_def<Context> (long_option_, var_address_cb_, NULL,
set_doc_, NULL, help_doc_)
{
this->have_argument = false;
}
- flag_option_def (const char *long_option_,
- const char *set_doc_,
- const char *help_doc_ = nullptr)
+ flag_option_def (const char *long_option_, const char *set_doc_,
+ const char *help_doc_ = nullptr)
: boolean_option_def<Context> (long_option_,
- gdb::option::detail::return_self,
- NULL,
+ gdb::option::detail::return_self, NULL,
set_doc_, nullptr, help_doc_)
{
this->have_argument = false;
@@ -212,27 +208,25 @@ struct uinteger_option_def : option_def
uinteger_option_def (const char *long_option_,
unsigned int *(*get_var_address_cb_) (Context *),
const literal_def *extra_literals_,
- show_value_ftype *show_cmd_cb_,
- const char *set_doc_,
+ show_value_ftype *show_cmd_cb_, const char *set_doc_,
const char *show_doc_ = nullptr,
const char *help_doc_ = nullptr)
: option_def (long_option_, var_uinteger, extra_literals_,
(erased_get_var_address_ftype *) get_var_address_cb_,
- show_cmd_cb_,
- set_doc_, show_doc_, help_doc_)
+ show_cmd_cb_, set_doc_, show_doc_, help_doc_)
{
var_address.uinteger = detail::get_var_address<unsigned int, Context>;
}
uinteger_option_def (const char *long_option_,
unsigned int *(*get_var_address_cb_) (Context *),
- show_value_ftype *show_cmd_cb_,
- const char *set_doc_,
+ show_value_ftype *show_cmd_cb_, const char *set_doc_,
const char *show_doc_ = nullptr,
const char *help_doc_ = nullptr)
: uinteger_option_def (long_option_, get_var_address_cb_, nullptr,
show_cmd_cb_, set_doc_, show_doc_, help_doc_)
- { /* Nothing. */ }
+ { /* Nothing. */
+ }
};
/* A var_pinteger command line option. */
@@ -243,27 +237,25 @@ struct pinteger_option_def : option_def
pinteger_option_def (const char *long_option_,
int *(*get_var_address_cb_) (Context *),
const literal_def *extra_literals_,
- show_value_ftype *show_cmd_cb_,
- const char *set_doc_,
+ show_value_ftype *show_cmd_cb_, const char *set_doc_,
const char *show_doc_ = nullptr,
const char *help_doc_ = nullptr)
: option_def (long_option_, var_pinteger, extra_literals_,
(erased_get_var_address_ftype *) get_var_address_cb_,
- show_cmd_cb_,
- set_doc_, show_doc_, help_doc_)
+ show_cmd_cb_, set_doc_, show_doc_, help_doc_)
{
var_address.integer = detail::get_var_address<int, Context>;
}
pinteger_option_def (const char *long_option_,
int *(*get_var_address_cb_) (Context *),
- show_value_ftype *show_cmd_cb_,
- const char *set_doc_,
+ show_value_ftype *show_cmd_cb_, const char *set_doc_,
const char *show_doc_ = nullptr,
const char *help_doc_ = nullptr)
: pinteger_option_def (long_option_, get_var_address_cb_, nullptr,
show_cmd_cb_, set_doc_, show_doc_, help_doc_)
- { /* Nothing. */ }
+ { /* Nothing. */
+ }
};
/* An var_enum command line option. */
@@ -271,17 +263,14 @@ struct pinteger_option_def : option_def
template<typename Context>
struct enum_option_def : option_def
{
- enum_option_def (const char *long_option_,
- const char *const *enumlist,
+ enum_option_def (const char *long_option_, const char *const *enumlist,
const char **(*get_var_address_cb_) (Context *),
- show_value_ftype *show_cmd_cb_,
- const char *set_doc_,
+ show_value_ftype *show_cmd_cb_, const char *set_doc_,
const char *show_doc_ = nullptr,
const char *help_doc_ = nullptr)
: option_def (long_option_, var_enum, nullptr,
(erased_get_var_address_ftype *) get_var_address_cb_,
- show_cmd_cb_,
- set_doc_, show_doc_, help_doc_)
+ show_cmd_cb_, set_doc_, show_doc_, help_doc_)
{
var_address.enumeration = detail::get_var_address<const char *, Context>;
this->enums = enumlist;
@@ -295,14 +284,12 @@ struct string_option_def : option_def
{
string_option_def (const char *long_option_,
std::string *(*get_var_address_cb_) (Context *),
- show_value_ftype *show_cmd_cb_,
- const char *set_doc_,
+ show_value_ftype *show_cmd_cb_, const char *set_doc_,
const char *show_doc_ = nullptr,
const char *help_doc_ = nullptr)
: option_def (long_option_, var_string, nullptr,
(erased_get_var_address_ftype *) get_var_address_cb_,
- show_cmd_cb_,
- set_doc_, show_doc_, help_doc_)
+ show_cmd_cb_, set_doc_, show_doc_, help_doc_)
{
var_address.enumeration = detail::get_var_address<const char *, Context>;
}
@@ -341,40 +328,39 @@ enum process_options_mode
if the string has been fully parsed and there are no operands to
handle by the caller. Return false if options were parsed, and
*ARGS now points at the first operand. */
-extern bool process_options
- (const char **args,
- process_options_mode mode,
- gdb::array_view<const option_def_group> options_group);
+extern bool
+process_options (const char **args, process_options_mode mode,
+ gdb::array_view<const option_def_group> options_group);
/* Complete ARGS on options listed by OPTIONS_GROUP. Returns true if
the string has been fully parsed and there are no operands to
handle by the caller. Return false if options were parsed, and
*ARGS now points at the first operand. */
-extern bool complete_options
- (completion_tracker &tracker,
- const char **args,
- process_options_mode mode,
- gdb::array_view<const option_def_group> options_group);
+extern bool
+complete_options (completion_tracker &tracker, const char **args,
+ process_options_mode mode,
+ gdb::array_view<const option_def_group> options_group);
/* Complete on all options listed by OPTIONS_GROUP. */
-extern void
- complete_on_all_options (completion_tracker &tracker,
- gdb::array_view<const option_def_group> options_group);
+extern void complete_on_all_options (
+ completion_tracker &tracker,
+ gdb::array_view<const option_def_group> options_group);
/* Return a string with the result of replacing %OPTIONS% in HELP_TMLP
with an auto-generated "help" string fragment for all the options
in OPTIONS_GROUP. */
-extern std::string build_help
- (const char *help_tmpl,
- gdb::array_view<const option_def_group> options_group);
+extern std::string
+build_help (const char *help_tmpl,
+ gdb::array_view<const option_def_group> options_group);
/* Install set/show commands for options defined in OPTIONS. DATA is
a pointer to the structure that holds the data associated with the
OPTIONS array. */
-extern void add_setshow_cmds_for_options (command_class cmd_class, void *data,
- gdb::array_view<const option_def> options,
- struct cmd_list_element **set_list,
- struct cmd_list_element **show_list);
+extern void
+add_setshow_cmds_for_options (command_class cmd_class, void *data,
+ gdb::array_view<const option_def> options,
+ struct cmd_list_element **set_list,
+ struct cmd_list_element **show_list);
} /* namespace option */
} /* namespace gdb */
diff --git a/gdb/cli/cli-script.c b/gdb/cli/cli-script.c
index 92005ba8c38..363657ce007 100644
--- a/gdb/cli/cli-script.c
+++ b/gdb/cli/cli-script.c
@@ -42,17 +42,15 @@
/* Prototypes for local functions. */
-static enum command_control_type
-recurse_read_control_structure
- (read_next_line_ftype read_next_line_func,
- struct command_line *current_cmd,
- gdb::function_view<void (const char *)> validator);
+static enum command_control_type recurse_read_control_structure (
+ read_next_line_ftype read_next_line_func, struct command_line *current_cmd,
+ gdb::function_view<void (const char *)> validator);
static void do_define_command (const char *comname, int from_tty,
const counted_command_line *commands);
static void do_document_command (const char *comname, int from_tty,
- const counted_command_line *commands);
+ const counted_command_line *commands);
static const char *read_next_line (std::string &buffer);
@@ -82,6 +80,7 @@ static cmd_list_element *document_cmd_element = nullptr;
class user_args
{
public:
+
/* Save the command line and store the locations of arguments passed
to the user defined function. */
explicit user_args (const char *line);
@@ -91,11 +90,12 @@ public:
std::string insert_args (const char *line) const;
private:
+
/* Disable copy/assignment. (Since the elements of A point inside
COMMAND, copying would need to reconstruct the A vector in the
new copy.) */
- user_args (const user_args &) =delete;
- user_args &operator= (const user_args &) =delete;
+ user_args (const user_args &) = delete;
+ user_args &operator= (const user_args &) = delete;
/* It is necessary to store a copy of the command line to ensure
that the arguments are not overwritten before they are used. */
@@ -122,13 +122,9 @@ struct scoped_user_args_level
}
/* Pop the current user arguments from the stack. */
- ~scoped_user_args_level ()
- {
- user_args_stack.pop_back ();
- }
+ ~scoped_user_args_level () { user_args_stack.pop_back (); }
};
-
/* Return non-zero if TYPE is a multi-line command (i.e., is terminated
by "end"). */
@@ -161,13 +157,13 @@ build_command_line (enum command_control_type type, const char *args)
if (args == NULL || *args == '\0')
{
if (type == if_control)
- error (_("if command requires an argument."));
+ error (_ ("if command requires an argument."));
else if (type == while_control)
- error (_("while command requires an argument."));
+ error (_ ("while command requires an argument."));
else if (type == define_control)
- error (_("define command requires an argument."));
+ error (_ ("define command requires an argument."));
else if (type == document_control)
- error (_("document command requires an argument."));
+ error (_ ("document command requires an argument."));
}
gdb_assert (args != NULL);
@@ -188,7 +184,7 @@ get_command_line (enum command_control_type type, const char *arg)
if (recurse_read_control_structure (read_next_line, cmd.get (), 0)
== invalid_control)
{
- warning (_("Error reading in canned sequence of commands."));
+ warning (_ ("Error reading in canned sequence of commands."));
return NULL;
}
@@ -347,7 +343,7 @@ print_command_lines (struct ui_out *uiout, struct command_line *cmd,
/* Ignore illegal command type and try next. */
list = list->next;
- } /* while (list) */
+ } /* while (list) */
}
/* Handle pre-post hooks. */
@@ -361,10 +357,7 @@ public:
{
}
- ~scoped_restore_hook_in ()
- {
- m_cmd->hook_in = 0;
- }
+ ~scoped_restore_hook_in () { m_cmd->hook_in = 0; }
scoped_restore_hook_in (const scoped_restore_hook_in &) = delete;
scoped_restore_hook_in &operator= (const scoped_restore_hook_in &) = delete;
@@ -407,11 +400,11 @@ execute_control_commands (struct command_line *cmdlines, int from_tty)
while (cmdlines)
{
- enum command_control_type ret = execute_control_command (cmdlines,
- from_tty);
+ enum command_control_type ret
+ = execute_control_command (cmdlines, from_tty);
if (ret != simple_control && ret != break_control)
{
- warning (_("Error executing canned sequence of commands."));
+ warning (_ ("Error executing canned sequence of commands."));
break;
}
cmdlines = cmdlines->next;
@@ -426,10 +419,8 @@ execute_control_commands_to_string (struct command_line *commands,
{
std::string result;
- execute_fn_to_string (result, [&] ()
- {
- execute_control_commands (commands, from_tty);
- }, false);
+ execute_fn_to_string (
+ result, [&] () { execute_control_commands (commands, from_tty); }, false);
return result;
}
@@ -450,7 +441,7 @@ execute_user_command (struct cmd_list_element *c, const char *args)
scoped_user_args_level push_user_args (args);
if (user_args_stack.size () > max_user_call_depth)
- error (_("Max user call depth exceeded -- command aborted."));
+ error (_ ("Max user call depth exceeded -- command aborted."));
/* Set the instream to nullptr, indicating execution of a
user-defined function. */
@@ -481,6 +472,7 @@ reset_command_nest_depth (void)
are dealt with directly. Therefore we can use these functions
to determine whether the command has been printed already or not. */
ATTRIBUTE_PRINTF (1, 2)
+
void
print_command_trace (const char *fmt, ...)
{
@@ -495,7 +487,7 @@ print_command_trace (const char *fmt, ...)
if (!source_verbose && !trace_commands)
return;
- for (i=0; i < command_nest_depth; i++)
+ for (i = 0; i < command_nest_depth; i++)
gdb_printf ("+");
va_list args;
@@ -580,7 +572,8 @@ execute_control_command_1 (struct command_line *cmd, int from_tty)
while (current)
{
scoped_restore save_nesting
- = make_scoped_restore (&command_nest_depth, command_nest_depth + 1);
+ = make_scoped_restore (&command_nest_depth,
+ command_nest_depth + 1);
ret = execute_control_command_1 (current, from_tty);
/* If we got an error, or a "break" command, then stop
@@ -636,7 +629,8 @@ execute_control_command_1 (struct command_line *cmd, int from_tty)
while (current)
{
scoped_restore save_nesting
- = make_scoped_restore (&command_nest_depth, command_nest_depth + 1);
+ = make_scoped_restore (&command_nest_depth,
+ command_nest_depth + 1);
ret = execute_control_command_1 (current, from_tty);
/* If we got an error, get out. */
@@ -686,7 +680,7 @@ execute_control_command_1 (struct command_line *cmd, int from_tty)
}
default:
- warning (_("Invalid control type in canned commands structure."));
+ warning (_ ("Invalid control type in canned commands structure."));
break;
}
@@ -718,7 +712,6 @@ execute_control_command_untraced (struct command_line *cmd)
return execute_control_command (cmd);
}
-
/* "while" command support. Executes a body of statements while the
loop condition is nonzero. */
@@ -824,8 +817,7 @@ locate_arg (const char *p)
{
while ((p = strchr (p, '$')))
{
- if (startswith (p, "$arg")
- && (isdigit (p[4]) || p[4] == 'c'))
+ if (startswith (p, "$arg") && (isdigit (p[4]) || p[4] == 'c'))
return p;
p++;
}
@@ -874,7 +866,7 @@ user_args::insert_args (const char *line) const
if ((i == 0 && tmp == p + 4) || errno != 0)
line = p + 4;
else if (i >= m_args.size ())
- error (_("Missing argument %ld in user function."), i);
+ error (_ ("Missing argument %ld in user function."), i);
else
{
new_line.append (m_args[i].data (), m_args[i].length ());
@@ -888,7 +880,6 @@ user_args::insert_args (const char *line) const
return new_line;
}
-
/* Read next line from stdin. Passed to read_command_line_1 and
recurse_read_control_structure whenever we need to read commands
from stdin. */
@@ -902,11 +893,10 @@ read_next_line (std::string &buffer)
int from_tty = ui->instream == ui->stdin_stream;
if (control_level >= 254)
- error (_("Control nesting too deep!"));
+ error (_ ("Control nesting too deep!"));
/* Set a prompt based on the nesting of the control commands. */
- if (from_tty
- || (ui->instream == 0 && deprecated_readline_hook != NULL))
+ if (from_tty || (ui->instream == 0 && deprecated_readline_hook != NULL))
{
for (i = 0; i < control_level; i++)
control_prompt[i] = ' ';
@@ -928,7 +918,7 @@ line_first_arg (const char *p)
{
const char *first_arg = p + find_command_name_length (p);
- return skip_spaces (first_arg);
+ return skip_spaces (first_arg);
}
/* Process one input line. If the command is an "end", return such an
@@ -940,8 +930,7 @@ line_first_arg (const char *p)
Otherwise, only "end" is recognized. */
static enum misc_command_type
-process_next_line (const char *p, command_line_up *command,
- int parse_commands,
+process_next_line (const char *p, command_line_up *command, int parse_commands,
gdb::function_view<void (const char *)> validator)
{
@@ -1048,8 +1037,9 @@ process_next_line (const char *p, command_line_up *command,
if (!parse_commands || not_handled)
{
/* A normal command. */
- *command = command_line_up (new command_line (simple_control,
- savestring (p, p_end - p)));
+ *command
+ = command_line_up (new command_line (simple_control,
+ savestring (p, p_end - p)));
}
if (validator)
@@ -1064,9 +1054,9 @@ process_next_line (const char *p, command_line_up *command,
obtain lines of the command. */
static enum command_control_type
-recurse_read_control_structure (read_next_line_ftype read_next_line_func,
- struct command_line *current_cmd,
- gdb::function_view<void (const char *)> validator)
+recurse_read_control_structure (
+ read_next_line_ftype read_next_line_func, struct command_line *current_cmd,
+ gdb::function_view<void (const char *)> validator)
{
enum misc_command_type val;
enum command_control_type ret;
@@ -1078,7 +1068,7 @@ recurse_read_control_structure (read_next_line_ftype read_next_line_func,
/* Sanity checks. */
if (current_cmd->control_type == simple_control)
- error (_("Recursed on a simple control type."));
+ error (_ ("Recursed on a simple control type."));
/* Read lines from the input stream and build control structures. */
while (1)
@@ -1087,11 +1077,12 @@ recurse_read_control_structure (read_next_line_ftype read_next_line_func,
std::string buffer;
next = nullptr;
- val = process_next_line (read_next_line_func (buffer), &next,
- current_cmd->control_type != python_control
+ val
+ = process_next_line (read_next_line_func (buffer), &next,
+ current_cmd->control_type != python_control
&& current_cmd->control_type != guile_control
&& current_cmd->control_type != compile_control,
- validator);
+ validator);
/* Just skip blanks and comments. */
if (val == nop_command)
@@ -1138,8 +1129,8 @@ recurse_read_control_structure (read_next_line_ftype read_next_line_func,
else
{
child_tail = next.get ();
- *current_body = counted_command_line (next.release (),
- command_lines_deleter ());
+ *current_body
+ = counted_command_line (next.release (), command_lines_deleter ());
}
/* If the latest line is another control structure, then recurse
@@ -1148,8 +1139,7 @@ recurse_read_control_structure (read_next_line_ftype read_next_line_func,
{
control_level++;
ret = recurse_read_control_structure (read_next_line_func,
- child_tail,
- validator);
+ child_tail, validator);
control_level--;
if (ret != simple_control)
@@ -1189,19 +1179,16 @@ read_command_lines (const char *prompt_arg, int from_tty, int parse_commands,
printf_unfiltered ("%s\n%s\n", prompt_arg, END_MESSAGE);
}
-
/* Reading commands assumes the CLI behavior, so temporarily
override the current interpreter with CLI. */
counted_command_line head (nullptr, command_lines_deleter ());
if (current_interp_named_p (INTERP_CONSOLE))
- head = read_command_lines_1 (read_next_line, parse_commands,
- validator);
+ head = read_command_lines_1 (read_next_line, parse_commands, validator);
else
{
scoped_restore_interp interp_restorer (INTERP_CONSOLE);
- head = read_command_lines_1 (read_next_line, parse_commands,
- validator);
+ head = read_command_lines_1 (read_next_line, parse_commands, validator);
}
if (from_tty && current_ui->input_interactive_p ()
@@ -1234,8 +1221,8 @@ read_command_lines_1 (read_next_line_ftype read_next_line_func,
dont_repeat ();
std::string buffer;
- val = process_next_line (read_next_line_func (buffer), &next, parse_commands,
- validator);
+ val = process_next_line (read_next_line_func (buffer), &next,
+ parse_commands, validator);
/* Ignore blank lines or comments. */
if (val == nop_command)
@@ -1256,8 +1243,8 @@ read_command_lines_1 (read_next_line_ftype read_next_line_func,
if (multi_line_command_p (next->control_type))
{
control_level++;
- ret = recurse_read_control_structure (read_next_line_func, next.get (),
- validator);
+ ret = recurse_read_control_structure (read_next_line_func,
+ next.get (), validator);
control_level--;
if (ret == invalid_control)
@@ -1273,8 +1260,8 @@ read_command_lines_1 (read_next_line_ftype read_next_line_func,
else
{
tail = next.get ();
- head = counted_command_line (next.release (),
- command_lines_deleter ());
+ head
+ = counted_command_line (next.release (), command_lines_deleter ());
}
}
@@ -1302,7 +1289,7 @@ free_command_lines (struct command_line **lptr)
}
*lptr = NULL;
}
-
+
/* Validate that *COMNAME is a valid name for a command. Return the
containing command list, in case it starts with a prefix command.
The prefix must already exist. *COMNAME is advanced to point after
@@ -1316,7 +1303,7 @@ validate_comname (const char **comname)
const char *p, *last_word;
if (*comname == 0)
- error_no_arg (_("name of command to define"));
+ error_no_arg (_ ("name of command to define"));
/* Find the last word of the argument. */
p = *comname + strlen (*comname);
@@ -1337,7 +1324,7 @@ validate_comname (const char **comname)
c = lookup_cmd (&tem, cmdlist, "", NULL, 0, 1);
if (!c->is_prefix ())
- error (_("\"%s\" is not a prefix command."), prefix.c_str ());
+ error (_ ("\"%s\" is not a prefix command."), prefix.c_str ());
list = c->subcommands;
*comname = last_word;
@@ -1347,7 +1334,7 @@ validate_comname (const char **comname)
while (*p)
{
if (!valid_cmd_char_p (*p))
- error (_("Junk in argument list: \"%s\""), p);
+ error (_ ("Junk in argument list: \"%s\""), p);
p++;
}
@@ -1371,20 +1358,20 @@ do_define_command (const char *comname, int from_tty,
const counted_command_line *commands)
{
enum cmd_hook_type
- {
- CMD_NO_HOOK = 0,
- CMD_PRE_HOOK,
- CMD_POST_HOOK
- };
+ {
+ CMD_NO_HOOK = 0,
+ CMD_PRE_HOOK,
+ CMD_POST_HOOK
+ };
struct cmd_list_element *c, *newc, *hookc = 0, **list;
const char *comfull;
- int hook_type = CMD_NO_HOOK;
- int hook_name_size = 0;
-
-#define HOOK_STRING "hook-"
-#define HOOK_LEN 5
+ int hook_type = CMD_NO_HOOK;
+ int hook_name_size = 0;
+
+#define HOOK_STRING "hook-"
+#define HOOK_LEN 5
#define HOOK_POST_STRING "hookpost-"
-#define HOOK_POST_LEN 9
+#define HOOK_POST_LEN 9
comfull = comname;
list = validate_comname (&comname);
@@ -1402,15 +1389,16 @@ do_define_command (const char *comname, int from_tty,
if ok to redefine the command. */
if (c->is_prefix ())
q = (c->user_commands.get () == nullptr
- || query (_("Keeping subcommands of prefix command \"%s\".\n"
- "Redefine command \"%s\"? "), c->name, c->name));
+ || query (_ ("Keeping subcommands of prefix command \"%s\".\n"
+ "Redefine command \"%s\"? "),
+ c->name, c->name));
else
- q = query (_("Redefine command \"%s\"? "), c->name);
+ q = query (_ ("Redefine command \"%s\"? "), c->name);
}
else
- q = query (_("Really redefine built-in command \"%s\"? "), c->name);
+ q = query (_ ("Really redefine built-in command \"%s\"? "), c->name);
if (!q)
- error (_("Command \"%s\" not redefined."), c->name);
+ error (_ ("Command \"%s\" not redefined."), c->name);
}
/* If this new command is a hook, then mark the command which it
@@ -1419,12 +1407,12 @@ do_define_command (const char *comname, int from_tty,
if (!strncmp (comname, HOOK_STRING, HOOK_LEN))
{
- hook_type = CMD_PRE_HOOK;
- hook_name_size = HOOK_LEN;
+ hook_type = CMD_PRE_HOOK;
+ hook_name_size = HOOK_LEN;
}
else if (!strncmp (comname, HOOK_POST_STRING, HOOK_POST_LEN))
{
- hook_type = CMD_POST_HOOK;
+ hook_type = CMD_POST_HOOK;
hook_name_size = HOOK_POST_LEN;
}
@@ -1435,11 +1423,11 @@ do_define_command (const char *comname, int from_tty,
/* ignore_help_classes = */ false);
if (!hookc && commands == nullptr)
{
- warning (_("Your new `%s' command does not "
- "hook any existing command."),
+ warning (_ ("Your new `%s' command does not "
+ "hook any existing command."),
comfull);
- if (!query (_("Proceed? ")))
- error (_("Not confirmed."));
+ if (!query (_ ("Proceed? ")))
+ error (_ ("Not confirmed."));
}
}
@@ -1461,7 +1449,9 @@ do_define_command (const char *comname, int from_tty,
newc = add_cmd (comname, class_user, user_defined_command,
(c != nullptr && c->theclass == class_user)
- ? c->doc : xstrdup ("User-defined."), list);
+ ? c->doc
+ : xstrdup ("User-defined."),
+ list);
newc->user_commands = std::move (cmds);
/* If we define or re-define a command that was previously defined
@@ -1472,7 +1462,7 @@ do_define_command (const char *comname, int from_tty,
/* allow_unknown: see explanation in equivalent logic in
define_prefix_command (). */
newc->allow_unknown = newc->user_commands.get () != nullptr;
- }
+ }
}
/* If this new command is a hook, then mark both commands as being
@@ -1482,17 +1472,17 @@ do_define_command (const char *comname, int from_tty,
switch (hook_type)
{
case CMD_PRE_HOOK:
- hookc->hook_pre = newc; /* Target gets hooked. */
+ hookc->hook_pre = newc; /* Target gets hooked. */
newc->hookee_pre = hookc; /* We are marked as hooking target cmd. */
break;
case CMD_POST_HOOK:
- hookc->hook_post = newc; /* Target gets hooked. */
+ hookc->hook_post = newc; /* Target gets hooked. */
newc->hookee_post = hookc; /* We are marked as hooking
target cmd. */
break;
default:
/* Should never come here as hookc would be 0. */
- internal_error (_("bad switch"));
+ internal_error (_ ("bad switch"));
}
}
}
@@ -1509,7 +1499,7 @@ define_command (const char *comname, int from_tty)
command and the commands are provided. */
static void
do_document_command (const char *comname, int from_tty,
- const counted_command_line *commands)
+ const counted_command_line *commands)
{
struct cmd_list_element *alias, *prefix_cmd, *c;
const char *comfull;
@@ -1519,15 +1509,15 @@ do_document_command (const char *comname, int from_tty,
lookup_cmd_composition (comfull, &alias, &prefix_cmd, &c);
if (c == nullptr)
- error (_("Undefined command: \"%s\"."), comfull);
+ error (_ ("Undefined command: \"%s\"."), comfull);
if (c->theclass != class_user
&& (alias == nullptr || alias->theclass != class_alias))
{
if (alias == nullptr)
- error (_("Command \"%s\" is built-in."), comfull);
+ error (_ ("Command \"%s\" is built-in."), comfull);
else
- error (_("Alias \"%s\" is built-in."), comfull);
+ error (_ ("Alias \"%s\" is built-in."), comfull);
}
/* If we found an alias of class_alias, the user is documenting this
@@ -1540,7 +1530,7 @@ do_document_command (const char *comname, int from_tty,
if (commands == nullptr)
{
std::string prompt
- = string_printf ("Type documentation for \"%s\".", comfull);
+ = string_printf ("Type documentation for \"%s\".", comfull);
doclines = read_command_lines (prompt.c_str (), from_tty, 0, 0);
}
else
@@ -1592,7 +1582,7 @@ define_prefix_command (const char *comname, int from_tty)
c = lookup_cmd_exact (comname, *list);
if (c != nullptr && c->theclass != class_user)
- error (_("Command \"%s\" is built-in."), comfull);
+ error (_ ("Command \"%s\" is built-in."), comfull);
if (c != nullptr && c->is_prefix ())
{
@@ -1610,7 +1600,7 @@ define_prefix_command (const char *comname, int from_tty)
/* Allocate the c->subcommands, which marks the command as a prefix
command. */
- c->subcommands = new struct cmd_list_element*;
+ c->subcommands = new struct cmd_list_element *;
*(c->subcommands) = nullptr;
/* If the prefix command C is not a command, then it must be followed
by known subcommands. Otherwise, if C is also a normal command,
@@ -1619,14 +1609,13 @@ define_prefix_command (const char *comname, int from_tty)
c->allow_unknown = c->user_commands.get () != nullptr;
}
-
/* Used to implement source_command. */
void
script_from_file (FILE *stream, const char *file)
{
if (stream == NULL)
- internal_error (_("called with NULL file pointer!"));
+ internal_error (_ ("called with NULL file pointer!"));
scoped_restore restore_line_number
= make_scoped_restore (&source_line_number, 0);
@@ -1644,10 +1633,8 @@ script_from_file (FILE *stream, const char *file)
{
/* Re-throw the error, but with the file name information
prepended. */
- throw_error (e.error,
- _("%s:%d: Error in sourced command file:\n%s"),
- source_file_name.c_str (), source_line_number,
- e.what ());
+ throw_error (e.error, _ ("%s:%d: Error in sourced command file:\n%s"),
+ source_file_name.c_str (), source_line_number, e.what ());
}
}
@@ -1665,8 +1652,7 @@ show_user_1 (struct cmd_list_element *c, const char *prefix, const char *name,
gdb_printf (stream, "User %scommand \"",
c->is_prefix () ? "prefix" : "");
- fprintf_styled (stream, title_style.style (), "%s%s",
- prefix, name);
+ fprintf_styled (stream, title_style.style (), "%s%s", prefix, name);
gdb_printf (stream, "\":\n");
if (cmdlines)
{
@@ -1683,10 +1669,10 @@ show_user_1 (struct cmd_list_element *c, const char *prefix, const char *name,
if (c->theclass == class_user || c->is_prefix ())
show_user_1 (c, prefixname.c_str (), c->name, gdb_stdout);
}
-
}
void _initialize_cli_script ();
+
void
_initialize_cli_script ()
{
@@ -1695,13 +1681,13 @@ _initialize_cli_script ()
/* "document", "define" and "define-prefix" use command_completer,
as this helps the user to either type the command name and/or
its prefixes. */
- document_cmd_element = add_com ("document", class_support, document_command,
- _("\
+ document_cmd_element
+ = add_com ("document", class_support, document_command, _ ("\
Document a user-defined command or user-defined alias.\n\
Give command or alias name as argument. Give documentation on following lines.\n\
End with a line of just \"end\"."));
set_cmd_completer (document_cmd_element, command_completer);
- define_cmd_element = add_com ("define", class_support, define_command, _("\
+ define_cmd_element = add_com ("define", class_support, define_command, _ ("\
Define a new command name. Command name is argument.\n\
Definition appears on following lines, one command per line.\n\
End with a line of just \"end\".\n\
@@ -1710,21 +1696,20 @@ Commands defined in this way may accept an unlimited number of arguments\n\
accessed via $arg0 .. $argN. $argc tells how many arguments have\n\
been passed."));
set_cmd_completer (define_cmd_element, command_completer);
- c = add_com ("define-prefix", class_support, define_prefix_command,
- _("\
+ c = add_com ("define-prefix", class_support, define_prefix_command, _ ("\
Define or mark a command as a user-defined prefix command.\n\
User defined prefix commands can be used as prefix commands for\n\
other user defined commands.\n\
If the command already exists, it is changed to a prefix command."));
set_cmd_completer (c, command_completer);
- while_cmd_element = add_com ("while", class_support, while_command, _("\
+ while_cmd_element = add_com ("while", class_support, while_command, _ ("\
Execute nested commands WHILE the conditional expression is non zero.\n\
The conditional expression must follow the word `while' and must in turn be\n\
followed by a new line. The nested commands must be entered one per line,\n\
and should be terminated by the word `end'."));
- if_cmd_element = add_com ("if", class_support, if_command, _("\
+ if_cmd_element = add_com ("if", class_support, if_command, _ ("\
Execute nested commands once IF the conditional expression is non zero.\n\
The conditional expression must follow the word `if' and must in turn be\n\
followed by a new line. The nested commands must be entered one per line,\n\
diff --git a/gdb/cli/cli-script.h b/gdb/cli/cli-script.h
index da7307bbf8d..547fa262f56 100644
--- a/gdb/cli/cli-script.h
+++ b/gdb/cli/cli-script.h
@@ -86,16 +86,16 @@ struct command_line
struct command_line *next = nullptr;
char *line;
enum command_control_type control_type;
+
union
+ {
+ struct
{
- struct
- {
- enum compile_i_scope_types scope;
- void *scope_data;
- }
- compile;
- }
- control_u;
+ enum compile_i_scope_types scope;
+ void *scope_data;
+ } compile;
+ } control_u;
+
/* * For composite commands, the nested lists of commands. For
example, for "if" command this will contain the then branch and
the else branch, if that is available. */
@@ -106,10 +106,7 @@ private:
friend void free_command_lines (struct command_line **);
- ~command_line ()
- {
- xfree (line);
- }
+ ~command_line () { xfree (line); }
};
/* Prototype for a function to call to get one more input line.
@@ -118,22 +115,21 @@ private:
in the passed-in buffer, and return a pointer to it. Otherwise, it can
simply ignore it. */
-using read_next_line_ftype = gdb::function_view<const char * (std::string &)>;
-
-extern counted_command_line read_command_lines
- (const char *, int, int, gdb::function_view<void (const char *)>);
-extern counted_command_line read_command_lines_1
- (read_next_line_ftype, int, gdb::function_view<void (const char *)>);
+using read_next_line_ftype = gdb::function_view<const char *(std::string &)>;
+extern counted_command_line
+read_command_lines (const char *, int, int,
+ gdb::function_view<void (const char *)>);
+extern counted_command_line
+read_command_lines_1 (read_next_line_ftype, int,
+ gdb::function_view<void (const char *)>);
/* Exported to cli/cli-cmds.c */
extern void script_from_file (FILE *stream, const char *file);
-extern void show_user_1 (struct cmd_list_element *c,
- const char *prefix,
- const char *name,
- struct ui_file *stream);
+extern void show_user_1 (struct cmd_list_element *c, const char *prefix,
+ const char *name, struct ui_file *stream);
/* Execute the commands in CMDLINES. */
@@ -144,27 +140,28 @@ extern void execute_control_commands (struct command_line *cmdlines,
the returned string, do not display it to the screen. BATCH_FLAG
will be temporarily set to true. */
-extern std::string execute_control_commands_to_string
- (struct command_line *commands, int from_tty);
+extern std::string
+execute_control_commands_to_string (struct command_line *commands,
+ int from_tty);
/* Exported to gdb/breakpoint.c */
extern enum command_control_type
- execute_control_command (struct command_line *cmd,
- int from_tty = 0);
+execute_control_command (struct command_line *cmd, int from_tty = 0);
extern enum command_control_type
- execute_control_command_untraced (struct command_line *cmd);
+execute_control_command_untraced (struct command_line *cmd);
extern counted_command_line get_command_line (enum command_control_type,
const char *);
-extern void print_command_lines (struct ui_out *,
- struct command_line *, unsigned int);
+extern void print_command_lines (struct ui_out *, struct command_line *,
+ unsigned int);
/* Exported to gdb/infrun.c */
-extern void execute_user_command (struct cmd_list_element *c, const char *args);
+extern void execute_user_command (struct cmd_list_element *c,
+ const char *args);
/* If we're in a user-defined command, replace any $argc/$argN
reference found in LINE with the arguments that were passed to the
@@ -174,8 +171,7 @@ extern std::string insert_user_defined_cmd_args (const char *line);
/* Exported to top.c */
-extern void print_command_trace (const char *cmd, ...)
- ATTRIBUTE_PRINTF (1, 2);
+extern void print_command_trace (const char *cmd, ...) ATTRIBUTE_PRINTF (1, 2);
/* Exported to event-top.c */
diff --git a/gdb/cli/cli-setshow.c b/gdb/cli/cli-setshow.c
index dad3e606620..cd4ffa123ea 100644
--- a/gdb/cli/cli-setshow.c
+++ b/gdb/cli/cli-setshow.c
@@ -40,7 +40,6 @@ notify_command_param_changed_p (bool param_changed, struct cmd_list_element *c)
return c->theclass != class_maintenance && c->theclass != class_obscure;
}
-
static enum auto_boolean
parse_auto_binary_operation (const char *arg)
{
@@ -67,7 +66,7 @@ parse_auto_binary_operation (const char *arg)
|| (length > 1 && strncmp (arg, "-1", length) == 0))
return AUTO_BOOLEAN_AUTO;
}
- error (_("\"on\", \"off\" or \"auto\" expected."));
+ error (_ ("\"on\", \"off\" or \"auto\" expected."));
return AUTO_BOOLEAN_AUTO; /* Pacify GCC. */
}
@@ -82,8 +81,7 @@ parse_cli_boolean_value (const char **arg)
/* Note that "o" is ambiguous. */
if ((length == 2 && strncmp (*arg, "on", length) == 0)
- || strncmp (*arg, "1", length) == 0
- || strncmp (*arg, "yes", length) == 0
+ || strncmp (*arg, "1", length) == 0 || strncmp (*arg, "yes", length) == 0
|| strncmp (*arg, "enable", length) == 0)
{
*arg = skip_spaces (*arg + length);
@@ -116,12 +114,9 @@ parse_cli_boolean_value (const char *arg)
return b;
}
-
void
-deprecated_show_value_hack (struct ui_file *ignore_file,
- int ignore_from_tty,
- struct cmd_list_element *c,
- const char *value)
+deprecated_show_value_hack (struct ui_file *ignore_file, int ignore_from_tty,
+ struct cmd_list_element *c, const char *value)
{
/* If there's no command or value, don't try to print it out. */
if (c == NULL || value == NULL)
@@ -164,9 +159,7 @@ get_literal_val (LONGEST &val, const literal_def *extra_literals,
size_t len = p - *arg;
if (len > 0 && extra_literals != nullptr)
- for (const literal_def *l = extra_literals;
- l->literal != nullptr;
- l++)
+ for (const literal_def *l = extra_literals; l->literal != nullptr; l++)
if (strncmp (l->literal, *arg, len) == 0)
{
*arg += len;
@@ -179,8 +172,8 @@ get_literal_val (LONGEST &val, const literal_def *extra_literals,
{
const char *after = skip_spaces (*arg);
if (*after != '\0')
- error (_("Junk after \"%.*s\": %s"),
- (int) len, unl_start, after);
+ error (_ ("Junk after \"%.*s\": %s"), (int) len, unl_start,
+ after);
}
val = l->use;
@@ -201,14 +194,13 @@ parse_cli_var_integer (var_types var_type, const literal_def *extra_literals,
if (*arg == nullptr || **arg == '\0')
{
if (extra_literals == nullptr)
- error_no_arg (_("integer to set it to"));
+ error_no_arg (_ ("integer to set it to"));
else
{
std::string buffer = "";
size_t count = 0;
- for (const literal_def *l = extra_literals;
- l->literal != nullptr;
+ for (const literal_def *l = extra_literals; l->literal != nullptr;
l++, count++)
{
if (count != 0)
@@ -216,13 +208,14 @@ parse_cli_var_integer (var_types var_type, const literal_def *extra_literals,
buffer = buffer + '"' + l->literal + '"';
}
if (count > 1)
- error_no_arg
- (string_printf (_("integer to set it to, or one of: %s"),
- buffer.c_str ()).c_str ());
+ error_no_arg (
+ string_printf (_ ("integer to set it to, or one of: %s"),
+ buffer.c_str ())
+ .c_str ());
else
- error_no_arg
- (string_printf (_("integer to set it to, or %s"),
- buffer.c_str ()).c_str ());
+ error_no_arg (string_printf (_ ("integer to set it to, or %s"),
+ buffer.c_str ())
+ .c_str ());
}
}
@@ -236,8 +229,7 @@ parse_cli_var_integer (var_types var_type, const literal_def *extra_literals,
enum tribool allowed = TRIBOOL_UNKNOWN;
if (extra_literals != nullptr)
{
- for (const literal_def *l = extra_literals;
- l->literal != nullptr;
+ for (const literal_def *l = extra_literals; l->literal != nullptr;
l++)
if (l->val.has_value () && val == *l->val)
{
@@ -259,7 +251,7 @@ parse_cli_var_integer (var_types var_type, const literal_def *extra_literals,
allowed = TRIBOOL_FALSE;
}
if (allowed == TRIBOOL_FALSE)
- error (_("integer %s out of range"), plongest (val));
+ error (_ ("integer %s out of range"), plongest (val));
}
return val;
@@ -282,7 +274,7 @@ parse_cli_var_enum (const char **args, const char *const *enums)
msg += ", ";
msg += enums[i];
}
- error (_("Requires an argument. Valid arguments are %s."),
+ error (_ ("Requires an argument. Valid arguments are %s."),
msg.c_str ());
}
@@ -308,10 +300,10 @@ parse_cli_var_enum (const char **args, const char *const *enums)
}
if (nmatches == 0)
- error (_("Undefined item: \"%.*s\"."), (int) len, *args);
+ error (_ ("Undefined item: \"%.*s\"."), (int) len, *args);
if (nmatches > 1)
- error (_("Ambiguous item \"%.*s\"."), (int) len, *args);
+ error (_ ("Ambiguous item \"%.*s\"."), (int) len, *args);
*args += len;
return match;
@@ -362,7 +354,7 @@ do_set_command (const char *arg, int from_tty, struct cmd_list_element *c)
break;
ch = parse_escape (get_current_arch (), &p);
if (ch == 0)
- break; /* C loses */
+ break; /* C loses */
else if (ch > 0)
*q++ = ch;
}
@@ -385,7 +377,7 @@ do_set_command (const char *arg, int from_tty, struct cmd_list_element *c)
break;
case var_filename:
if (*arg == '\0')
- error_no_arg (_("filename to set it to."));
+ error_no_arg (_ ("filename to set it to."));
/* FALLTHROUGH */
case var_optional_filename:
{
@@ -406,8 +398,7 @@ do_set_command (const char *arg, int from_tty, struct cmd_list_element *c)
else
val = xstrdup ("");
- option_changed
- = c->var->set<std::string> (std::string (val));
+ option_changed = c->var->set<std::string> (std::string (val));
xfree (val);
}
break;
@@ -416,20 +407,18 @@ do_set_command (const char *arg, int from_tty, struct cmd_list_element *c)
int val = parse_cli_boolean_value (arg);
if (val < 0)
- error (_("\"on\" or \"off\" expected."));
+ error (_ ("\"on\" or \"off\" expected."));
option_changed = c->var->set<bool> (val);
}
break;
case var_auto_boolean:
- option_changed = c->var->set<enum auto_boolean> (parse_auto_binary_operation (arg));
+ option_changed
+ = c->var->set<enum auto_boolean> (parse_auto_binary_operation (arg));
break;
case var_uinteger:
- option_changed
- = c->var->set<unsigned int> (parse_cli_var_integer (c->var->type (),
- c->var->
- extra_literals (),
- &arg, true));
+ option_changed = c->var->set<unsigned int> (parse_cli_var_integer (
+ c->var->type (), c->var->extra_literals (), &arg, true));
break;
case var_integer:
case var_pinteger:
@@ -446,13 +435,13 @@ do_set_command (const char *arg, int from_tty, struct cmd_list_element *c)
int len = end_arg - arg;
const char *after = skip_spaces (end_arg);
if (*after != '\0')
- error (_("Junk after item \"%.*s\": %s"), len, arg, after);
+ error (_ ("Junk after item \"%.*s\": %s"), len, arg, after);
option_changed = c->var->set<const char *> (match);
}
break;
default:
- error (_("gdb internal error: bad var_type in do_setshow_command"));
+ error (_ ("gdb internal error: bad var_type in do_setshow_command"));
}
c->func (NULL, from_tty, c);
@@ -521,12 +510,12 @@ do_set_command (const char *arg, int from_tty, struct cmd_list_element *c)
case var_string_noescape:
case var_filename:
case var_optional_filename:
- gdb::observers::command_param_changed.notify
- (name, c->var->get<std::string> ().c_str ());
+ gdb::observers::command_param_changed.notify (
+ name, c->var->get<std::string> ().c_str ());
break;
case var_enum:
- gdb::observers::command_param_changed.notify
- (name, c->var->get<const char *> ());
+ gdb::observers::command_param_changed.notify (
+ name, c->var->get<const char *> ());
break;
case var_boolean:
{
@@ -620,13 +609,12 @@ get_setshow_command_value_string (const setting &var)
bool printed = false;
const LONGEST value
= (var.type () == var_uinteger
- ? static_cast<LONGEST> (var.get<unsigned int> ())
- : static_cast<LONGEST> (var.get<int> ()));
+ ? static_cast<LONGEST> (var.get<unsigned int> ())
+ : static_cast<LONGEST> (var.get<int> ()));
if (var.extra_literals () != nullptr)
for (const literal_def *l = var.extra_literals ();
- l->literal != nullptr;
- l++)
+ l->literal != nullptr; l++)
if (value == l->use)
{
stb.puts (l->literal);
@@ -649,7 +637,6 @@ get_setshow_command_value_string (const setting &var)
return stb.release ();
}
-
/* Do a "show" command. ARG is NULL if no argument, or the
text of the argument, and FROM_TTY is nonzero if this command is
being entered directly by the user (i.e. these are just like any
@@ -713,8 +700,9 @@ cmd_show_list (struct cmd_list_element *list, int from_tty)
{
/* If we find a prefix, output it (with "show " skipped). */
std::string prefixname = list->prefix->prefixname ();
- prefixname = (!list->prefix->is_prefix () ? ""
- : strstr (prefixname.c_str (), "show ") + 5);
+ prefixname = (!list->prefix->is_prefix ()
+ ? ""
+ : strstr (prefixname.c_str (), "show ") + 5);
uiout->text (prefixname);
}
uiout->field_string ("name", list->name);
@@ -726,5 +714,3 @@ cmd_show_list (struct cmd_list_element *list, int from_tty)
}
}
}
-
-
diff --git a/gdb/cli/cli-setshow.h b/gdb/cli/cli-setshow.h
index bc70ea6dcbe..92e4c3e3a61 100644
--- a/gdb/cli/cli-setshow.h
+++ b/gdb/cli/cli-setshow.h
@@ -40,15 +40,13 @@ extern int parse_cli_boolean_value (const char **arg);
would parse "-obj --" as part of the expression as well. */
extern LONGEST parse_cli_var_integer (var_types var_type,
const literal_def *extra_literals,
- const char **arg,
- bool expression);
+ const char **arg, bool expression);
/* Parse ARG, an option to a var_enum variable. ENUM is a
null-terminated array of possible values. Either returns the parsed
value on success or throws an error. ARG is advanced past the
parsed value. */
-const char *parse_cli_var_enum (const char **args,
- const char *const *enums);
+const char *parse_cli_var_enum (const char **args, const char *const *enums);
extern void do_set_command (const char *arg, int from_tty,
struct cmd_list_element *c);
diff --git a/gdb/cli/cli-style.c b/gdb/cli/cli-style.c
index cd510b440db..bf323c014a0 100644
--- a/gdb/cli/cli-style.c
+++ b/gdb/cli/cli-style.c
@@ -27,7 +27,7 @@
/* True if styling is enabled. */
-#if defined (__MSDOS__)
+#if defined(__MSDOS__)
bool cli_styling = false;
#else
bool cli_styling = true;
@@ -44,27 +44,14 @@ bool source_styling = true;
bool disassembler_styling = true;
/* Name of colors; must correspond to ui_file_style::basic_color. */
-static const char * const cli_colors[] = {
- "none",
- "black",
- "red",
- "green",
- "yellow",
- "blue",
- "magenta",
- "cyan",
- "white",
- nullptr
-};
+static const char *const cli_colors[]
+ = { "none", "black", "red", "green", "yellow",
+ "blue", "magenta", "cyan", "white", nullptr };
/* Names of intensities; must correspond to
ui_file_style::intensity. */
-static const char * const cli_intensities[] = {
- "normal",
- "bold",
- "dim",
- nullptr
-};
+static const char *const cli_intensities[]
+ = { "normal", "bold", "dim", nullptr };
/* See cli-style.h. */
@@ -199,14 +186,13 @@ cli_style_option::do_set_value (const char *ignore, int from_tty,
The style for which WHAT is shown is retrieved from CMD context. */
static void
-do_show (const char *what, struct ui_file *file,
- struct cmd_list_element *cmd,
+do_show (const char *what, struct ui_file *file, struct cmd_list_element *cmd,
const char *value)
{
cli_style_option *cso = (cli_style_option *) cmd->context ();
- gdb_puts (_("The "), file);
- fprintf_styled (file, cso->style (), _("\"%s\" style"), cso->name ());
- gdb_printf (file, _(" %s is: %s\n"), what, value);
+ gdb_puts (_ ("The "), file);
+ fprintf_styled (file, cso->style (), _ ("\"%s\" style"), cso->name ());
+ gdb_printf (file, _ (" %s is: %s\n"), what, value);
}
/* See cli-style.h. */
@@ -216,7 +202,7 @@ cli_style_option::do_show_foreground (struct ui_file *file, int from_tty,
struct cmd_list_element *cmd,
const char *value)
{
- do_show (_("foreground color"), file, cmd, value);
+ do_show (_ ("foreground color"), file, cmd, value);
}
/* See cli-style.h. */
@@ -226,7 +212,7 @@ cli_style_option::do_show_background (struct ui_file *file, int from_tty,
struct cmd_list_element *cmd,
const char *value)
{
- do_show (_("background color"), file, cmd, value);
+ do_show (_ ("background color"), file, cmd, value);
}
/* See cli-style.h. */
@@ -236,7 +222,7 @@ cli_style_option::do_show_intensity (struct ui_file *file, int from_tty,
struct cmd_list_element *cmd,
const char *value)
{
- do_show (_("display intensity"), file, cmd, value);
+ do_show (_ ("display intensity"), file, cmd, value);
}
/* See cli-style.h. */
@@ -254,41 +240,31 @@ cli_style_option::add_setshow_commands (enum command_class theclass,
set_show_commands commands;
- commands = add_setshow_enum_cmd
- ("foreground", theclass, cli_colors,
- &m_foreground,
- _("Set the foreground color for this property."),
- _("Show the foreground color for this property."),
- nullptr,
- do_set_value,
- do_show_foreground,
- &m_set_list, &m_show_list);
+ commands
+ = add_setshow_enum_cmd ("foreground", theclass, cli_colors, &m_foreground,
+ _ ("Set the foreground color for this property."),
+ _ ("Show the foreground color for this property."),
+ nullptr, do_set_value, do_show_foreground,
+ &m_set_list, &m_show_list);
commands.set->set_context (this);
commands.show->set_context (this);
- commands = add_setshow_enum_cmd
- ("background", theclass, cli_colors,
- &m_background,
- _("Set the background color for this property."),
- _("Show the background color for this property."),
- nullptr,
- do_set_value,
- do_show_background,
- &m_set_list, &m_show_list);
+ commands
+ = add_setshow_enum_cmd ("background", theclass, cli_colors, &m_background,
+ _ ("Set the background color for this property."),
+ _ ("Show the background color for this property."),
+ nullptr, do_set_value, do_show_background,
+ &m_set_list, &m_show_list);
commands.set->set_context (this);
commands.show->set_context (this);
if (!skip_intensity)
{
- commands = add_setshow_enum_cmd
- ("intensity", theclass, cli_intensities,
- &m_intensity,
- _("Set the display intensity for this property."),
- _("Show the display intensity for this property."),
- nullptr,
- do_set_value,
- do_show_intensity,
- &m_set_list, &m_show_list);
+ commands = add_setshow_enum_cmd (
+ "intensity", theclass, cli_intensities, &m_intensity,
+ _ ("Set the display intensity for this property."),
+ _ ("Show the display intensity for this property."), nullptr,
+ do_set_value, do_show_intensity, &m_set_list, &m_show_list);
commands.set->set_context (this);
commands.show->set_context (this);
}
@@ -308,7 +284,7 @@ static cmd_list_element *style_disasm_set_list;
static cmd_list_element *style_disasm_show_list;
static void
-set_style_enabled (const char *args, int from_tty, struct cmd_list_element *c)
+set_style_enabled (const char *args, int from_tty, struct cmd_list_element *c)
{
g_source_cache.clear ();
gdb::observers::styling_changed.notify ();
@@ -319,9 +295,9 @@ show_style_enabled (struct ui_file *file, int from_tty,
struct cmd_list_element *c, const char *value)
{
if (cli_styling)
- gdb_printf (file, _("CLI output styling is enabled.\n"));
+ gdb_printf (file, _ ("CLI output styling is enabled.\n"));
else
- gdb_printf (file, _("CLI output styling is disabled.\n"));
+ gdb_printf (file, _ ("CLI output styling is disabled.\n"));
}
static void
@@ -329,9 +305,9 @@ show_style_sources (struct ui_file *file, int from_tty,
struct cmd_list_element *c, const char *value)
{
if (source_styling)
- gdb_printf (file, _("Source code styling is enabled.\n"));
+ gdb_printf (file, _ ("Source code styling is enabled.\n"));
else
- gdb_printf (file, _("Source code styling is disabled.\n"));
+ gdb_printf (file, _ ("Source code styling is disabled.\n"));
}
/* Implement 'show style disassembler'. */
@@ -341,102 +317,107 @@ show_style_disassembler (struct ui_file *file, int from_tty,
struct cmd_list_element *c, const char *value)
{
if (disassembler_styling)
- gdb_printf (file, _("Disassembler output styling is enabled.\n"));
+ gdb_printf (file, _ ("Disassembler output styling is enabled.\n"));
else
- gdb_printf (file, _("Disassembler output styling is disabled.\n"));
+ gdb_printf (file, _ ("Disassembler output styling is disabled.\n"));
}
void _initialize_cli_style ();
+
void
_initialize_cli_style ()
{
- add_setshow_prefix_cmd ("style", no_class,
- _("\
+ add_setshow_prefix_cmd ("style", no_class, _ ("\
Style-specific settings.\n\
Configure various style-related variables, such as colors"),
- _("\
+ _ ("\
Style-specific settings.\n\
Configure various style-related variables, such as colors"),
- &style_set_list, &style_show_list,
- &setlist, &showlist);
-
- add_setshow_boolean_cmd ("enabled", no_class, &cli_styling, _("\
-Set whether CLI styling is enabled."), _("\
-Show whether CLI is enabled."), _("\
+ &style_set_list, &style_show_list, &setlist,
+ &showlist);
+
+ add_setshow_boolean_cmd ("enabled", no_class, &cli_styling, _ ("\
+Set whether CLI styling is enabled."),
+ _ ("\
+Show whether CLI is enabled."),
+ _ ("\
If enabled, output to the terminal is styled."),
set_style_enabled, show_style_enabled,
&style_set_list, &style_show_list);
- add_setshow_boolean_cmd ("sources", no_class, &source_styling, _("\
-Set whether source code styling is enabled."), _("\
-Show whether source code styling is enabled."), _("\
+ add_setshow_boolean_cmd (
+ "sources", no_class, &source_styling, _ ("\
+Set whether source code styling is enabled."),
+ _ ("\
+Show whether source code styling is enabled."),
+ _ (
+ "\
If enabled, source code is styled.\n"
#ifdef HAVE_SOURCE_HIGHLIGHT
-"Note that source styling only works if styling in general is enabled,\n\
+ "Note that source styling only works if styling in general is enabled,\n\
see \"show style enabled\"."
#else
-"Source highlighting may be disabled in this installation of gdb, because\n\
+ "Source highlighting may be disabled in this installation of gdb, because\n\
it was not linked against GNU Source Highlight. However, it might still be\n\
available if the appropriate extension is available at runtime."
#endif
- ), set_style_enabled, show_style_sources,
- &style_set_list, &style_show_list);
+ ),
+ set_style_enabled, show_style_sources, &style_set_list, &style_show_list);
- add_setshow_prefix_cmd ("disassembler", no_class,
- _("\
+ add_setshow_prefix_cmd ("disassembler", no_class, _ ("\
Style-specific settings for the disassembler.\n\
Configure various disassembler style-related variables."),
- _("\
+ _ ("\
Style-specific settings for the disassembler.\n\
Configure various disassembler style-related variables."),
&style_disasm_set_list, &style_disasm_show_list,
&style_set_list, &style_show_list);
- add_setshow_boolean_cmd ("enabled", no_class, &disassembler_styling, _("\
-Set whether disassembler output styling is enabled."), _("\
-Show whether disassembler output styling is enabled."), _("\
+ add_setshow_boolean_cmd ("enabled", no_class, &disassembler_styling, _ ("\
+Set whether disassembler output styling is enabled."),
+ _ ("\
+Show whether disassembler output styling is enabled."),
+ _ ("\
If enabled, disassembler output is styled. Disassembler highlighting\n\
requires the Python Pygments library, if this library is not available\n\
-then disassembler highlighting will not be possible."
- ), set_style_enabled, show_style_disassembler,
+then disassembler highlighting will not be possible."),
+ set_style_enabled, show_style_disassembler,
&style_disasm_set_list, &style_disasm_show_list);
- file_name_style.add_setshow_commands (no_class, _("\
+ file_name_style.add_setshow_commands (no_class, _ ("\
Filename display styling.\n\
Configure filename colors and display intensity."),
&style_set_list, &style_show_list,
false);
set_show_commands function_prefix_cmds
- = function_name_style.add_setshow_commands (no_class, _("\
+ = function_name_style.add_setshow_commands (no_class, _ ("\
Function name display styling.\n\
Configure function name colors and display intensity"),
&style_set_list,
- &style_show_list,
- false);
+ &style_show_list, false);
- variable_name_style.add_setshow_commands (no_class, _("\
+ variable_name_style.add_setshow_commands (no_class, _ ("\
Variable name display styling.\n\
Configure variable name colors and display intensity"),
&style_set_list, &style_show_list,
false);
set_show_commands address_prefix_cmds
- = address_style.add_setshow_commands (no_class, _("\
+ = address_style.add_setshow_commands (no_class, _ ("\
Address display styling.\n\
Configure address colors and display intensity"),
&style_set_list, &style_show_list,
false);
- title_style.add_setshow_commands (no_class, _("\
+ title_style.add_setshow_commands (no_class, _ ("\
Title display styling.\n\
Configure title colors and display intensity\n\
Some commands (such as \"apropos -v REGEXP\") use the title style to improve\n\
readability."),
- &style_set_list, &style_show_list,
- false);
+ &style_set_list, &style_show_list, false);
- highlight_style.add_setshow_commands (no_class, _("\
+ highlight_style.add_setshow_commands (no_class, _ ("\
Highlight display styling.\n\
Configure highlight colors and display intensity\n\
Some commands use the highlight style to draw the attention to a part\n\
@@ -444,7 +425,7 @@ of their output."),
&style_set_list, &style_show_list,
false);
- metadata_style.add_setshow_commands (no_class, _("\
+ metadata_style.add_setshow_commands (no_class, _ ("\
Metadata display styling.\n\
Configure metadata colors and display intensity\n\
The \"metadata\" style is used when GDB displays information about\n\
@@ -452,7 +433,7 @@ your data, for example \"<unavailable>\""),
&style_set_list, &style_show_list,
false);
- tui_border_style.add_setshow_commands (no_class, _("\
+ tui_border_style.add_setshow_commands (no_class, _ ("\
TUI border display styling.\n\
Configure TUI border colors\n\
The \"tui-border\" style is used when GDB displays the border of a\n\
@@ -460,22 +441,21 @@ TUI window that does not have the focus."),
&style_set_list, &style_show_list,
true);
- tui_active_border_style.add_setshow_commands (no_class, _("\
+ tui_active_border_style.add_setshow_commands (no_class, _ ("\
TUI active border display styling.\n\
Configure TUI active border colors\n\
The \"tui-active-border\" style is used when GDB displays the border of a\n\
TUI window that does have the focus."),
&style_set_list,
- &style_show_list,
- true);
+ &style_show_list, true);
- version_style.add_setshow_commands (no_class, _("\
+ version_style.add_setshow_commands (no_class, _ ("\
Version string display styling.\n\
Configure colors used to display the GDB version string."),
&style_set_list, &style_show_list,
false);
- disasm_mnemonic_style.add_setshow_commands (no_class, _("\
+ disasm_mnemonic_style.add_setshow_commands (no_class, _ ("\
Disassembler mnemonic display styling.\n\
Configure the colors and display intensity for instruction mnemonics\n\
in the disassembler output. The \"disassembler mnemonic\" style is\n\
@@ -486,10 +466,9 @@ This style will only be used for targets that support libopcodes based\n\
disassembler styling. When Python Pygments based styling is used\n\
then this style has no effect."),
&style_disasm_set_list,
- &style_disasm_show_list,
- false);
+ &style_disasm_show_list, false);
- disasm_register_style.add_setshow_commands (no_class, _("\
+ disasm_register_style.add_setshow_commands (no_class, _ ("\
Disassembler register display styling.\n\
Configure the colors and display intensity for registers in the\n\
disassembler output.\n\
@@ -498,10 +477,9 @@ This style will only be used for targets that support libopcodes based\n\
disassembler styling. When Python Pygments based styling is used\n\
then this style has no effect."),
&style_disasm_set_list,
- &style_disasm_show_list,
- false);
+ &style_disasm_show_list, false);
- disasm_immediate_style.add_setshow_commands (no_class, _("\
+ disasm_immediate_style.add_setshow_commands (no_class, _ ("\
Disassembler immediate display styling.\n\
Configure the colors and display intensity for immediates in the\n\
disassembler output. The \"disassembler immediate\" style is used for\n\
@@ -512,10 +490,9 @@ This style will only be used for targets that support libopcodes based\n\
disassembler styling. When Python Pygments based styling is used\n\
then this style has no effect."),
&style_disasm_set_list,
- &style_disasm_show_list,
- false);
+ &style_disasm_show_list, false);
- disasm_comment_style.add_setshow_commands (no_class, _("\
+ disasm_comment_style.add_setshow_commands (no_class, _ ("\
Disassembler comment display styling.\n\
Configure the colors and display intensity for comments in the\n\
disassembler output. The \"disassembler comment\" style is used for\n\
@@ -527,8 +504,7 @@ This style will only be used for targets that support libopcodes based\n\
disassembler styling. When Python Pygments based styling is used\n\
then this style has no effect."),
&style_disasm_set_list,
- &style_disasm_show_list,
- false);
+ &style_disasm_show_list, false);
/* Setup 'disassembler address' style and 'disassembler symbol' style,
these are aliases for 'address' and 'function' styles respectively. */
diff --git a/gdb/cli/cli-utils.c b/gdb/cli/cli-utils.c
index 81c3c728dc6..98f7d2cf2ca 100644
--- a/gdb/cli/cli-utils.c
+++ b/gdb/cli/cli-utils.c
@@ -28,21 +28,21 @@
ULONGEST
get_ulongest (const char **pp, int trailer)
{
- LONGEST retval = 0; /* default */
+ LONGEST retval = 0; /* default */
const char *p = *pp;
if (*p == '$')
{
value *val = value_from_history_ref (p, &p);
- if (val != NULL) /* Value history reference */
+ if (val != NULL) /* Value history reference */
{
if (value_type (val)->code () == TYPE_CODE_INT)
retval = value_as_long (val);
else
- error (_("History value must have integer type."));
+ error (_ ("History value must have integer type."));
}
- else /* Convenience variable */
+ else /* Convenience variable */
{
/* Internal variable. Make a copy of the name, so we can
null-terminate it to pass to lookup_internalvar(). */
@@ -51,8 +51,8 @@ get_ulongest (const char **pp, int trailer)
p++;
std::string varname (start, p - start);
if (!get_internalvar_integer (lookup_internalvar (varname.c_str ()),
- &retval))
- error (_("Convenience variable $%s does not have integer value."),
+ &retval))
+ error (_ ("Convenience variable $%s does not have integer value."),
varname.c_str ());
}
}
@@ -63,13 +63,13 @@ get_ulongest (const char **pp, int trailer)
if (p == end)
{
/* There is no number here. (e.g. "cond a == b"). */
- error (_("Expected integer at: %s"), p);
+ error (_ ("Expected integer at: %s"), p);
}
p = end;
}
if (!(isspace (*p) || *p == '\0' || *p == trailer))
- error (_("Trailing junk at: %s"), p);
+ error (_ ("Trailing junk at: %s"), p);
p = skip_spaces (p);
*pp = p;
return retval;
@@ -80,7 +80,7 @@ get_ulongest (const char **pp, int trailer)
int
get_number_trailer (const char **pp, int trailer)
{
- int retval = 0; /* default */
+ int retval = 0; /* default */
const char *p = *pp;
bool negative = false;
@@ -94,17 +94,17 @@ get_number_trailer (const char **pp, int trailer)
{
struct value *val = value_from_history_ref (p, &p);
- if (val) /* Value history reference */
+ if (val) /* Value history reference */
{
if (value_type (val)->code () == TYPE_CODE_INT)
retval = value_as_long (val);
else
{
- gdb_printf (_("History value must have integer type.\n"));
+ gdb_printf (_ ("History value must have integer type.\n"));
retval = 0;
}
}
- else /* Convenience variable */
+ else /* Convenience variable */
{
/* Internal variable. Make a copy of the name, so we can
null-terminate it to pass to lookup_internalvar(). */
@@ -122,8 +122,8 @@ get_number_trailer (const char **pp, int trailer)
retval = (int) longest_val;
else
{
- gdb_printf (_("Convenience variable must "
- "have integer value.\n"));
+ gdb_printf (_ ("Convenience variable must "
+ "have integer value.\n"));
retval = 0;
}
}
@@ -137,7 +137,7 @@ get_number_trailer (const char **pp, int trailer)
/* There is no number here. (e.g. "cond a == b"). */
{
/* Skip non-numeric token. */
- while (*p && !isspace((int) *p))
+ while (*p && !isspace ((int) *p))
++p;
/* Return zero, which caller must interpret as error. */
retval = 0;
@@ -185,19 +185,18 @@ report_unrecognized_option_error (const char *command, const char *args)
{
std::string option = extract_arg (&args);
- error (_("Unrecognized option '%s' to %s command. "
- "Try \"help %s\"."), option.c_str (),
- command, command);
+ error (_ ("Unrecognized option '%s' to %s command. "
+ "Try \"help %s\"."),
+ option.c_str (), command, command);
}
/* See documentation in cli-utils.h. */
const char *
-info_print_args_help (const char *prefix,
- const char *entity_kind,
+info_print_args_help (const char *prefix, const char *entity_kind,
bool document_n_flag)
{
- return xstrprintf (_("\
+ return xstrprintf (_ ("\
%sIf NAMEREGEXP is provided, only prints the %s whose name\n\
matches NAMEREGEXP.\n\
If -t TYPEREGEXP is provided, only prints the %s whose type\n\
@@ -207,9 +206,11 @@ By default, the command might produce headers and/or messages indicating\n\
why no %s can be printed.\n\
The flag -q disables the production of these headers and messages.%s"),
prefix, entity_kind, entity_kind, entity_kind,
- (document_n_flag ? _("\n\
+ (document_n_flag ? _ ("\n\
By default, the command will include non-debug symbols in the output;\n\
-these can be excluded using the -n flag.") : "")).release ();
+these can be excluded using the -n flag.")
+ : ""))
+ .release ();
}
/* See documentation in cli-utils.h. */
@@ -264,8 +265,7 @@ number_or_range_parser::get_number ()
string as well. */
if (m_cur_tok[0] == '-'
&& !(isspace (m_cur_tok[-1])
- && (isalpha (m_cur_tok[1])
- || m_cur_tok[1] == '-'
+ && (isalpha (m_cur_tok[1]) || m_cur_tok[1] == '-'
|| m_cur_tok[1] == '\0')))
{
const char **temp;
@@ -279,7 +279,7 @@ number_or_range_parser::get_number ()
m_end_value = ::get_number (temp);
if (m_end_value < m_last_retval)
{
- error (_("inverted range"));
+ error (_ ("inverted range"));
}
else if (m_end_value == m_last_retval)
{
@@ -295,13 +295,13 @@ number_or_range_parser::get_number ()
else
{
if (isdigit (*(m_cur_tok + 1)))
- error (_("negative value"));
+ error (_ ("negative value"));
if (*(m_cur_tok + 1) == '$')
{
/* Convenience variable. */
m_last_retval = ::get_number (&m_cur_tok);
if (m_last_retval < 0)
- error (_("negative value"));
+ error (_ ("negative value"));
}
}
return m_last_retval;
@@ -330,8 +330,7 @@ number_or_range_parser::finished () const
or we are not in a range and not in front of an integer, negative
integer, convenience var or negative convenience var. */
return (m_cur_tok == NULL || *m_cur_tok == '\0'
- || (!m_in_range
- && !(isdigit (*m_cur_tok) || *m_cur_tok == '$')
+ || (!m_in_range && !(isdigit (*m_cur_tok) || *m_cur_tok == '$')
&& !(*m_cur_tok == '-'
&& (isdigit (m_cur_tok[1]) || m_cur_tok[1] == '$'))));
}
@@ -353,13 +352,13 @@ number_is_in_list (const char *list, int number)
number_or_range_parser parser (list);
if (parser.finished ())
- error (_("Arguments must be numbers or '$' variables."));
+ error (_ ("Arguments must be numbers or '$' variables."));
while (!parser.finished ())
{
int gotnum = parser.get_number ();
if (gotnum == 0)
- error (_("Arguments must be numbers or '$' variables."));
+ error (_ ("Arguments must be numbers or '$' variables."));
if (gotnum == number)
return 1;
}
@@ -436,6 +435,5 @@ void
validate_flags_qcs (const char *which_command, qcs_flags *flags)
{
if (flags->cont && flags->silent)
- error (_("%s: -c and -s are mutually exclusive"), which_command);
+ error (_ ("%s: -c and -s are mutually exclusive"), which_command);
}
-
diff --git a/gdb/cli/cli-utils.h b/gdb/cli/cli-utils.h
index 6a209aee38f..8d98195a4d4 100644
--- a/gdb/cli/cli-utils.h
+++ b/gdb/cli/cli-utils.h
@@ -53,14 +53,12 @@ extern ULONGEST get_ulongest (const char **pp, int trailer = '\0');
extern void report_unrecognized_option_error (const char *command,
const char *args);
-
/* Builds the help string for a command documented by PREFIX,
followed by the extract_info_print_args help for ENTITY_KIND. If
DOCUMENT_N_FLAG is true then help text describing the -n flag is also
included. */
-const char *info_print_args_help (const char *prefix,
- const char *entity_kind,
+const char *info_print_args_help (const char *prefix, const char *entity_kind,
bool document_n_flag);
/* Parse a number or a range.
@@ -72,6 +70,7 @@ const char *info_print_args_help (const char *prefix,
class number_or_range_parser
{
public:
+
/* Default construction. Must call init before calling
get_next. */
number_or_range_parser () {}
@@ -95,24 +94,20 @@ public:
/* Setup internal state such that get_next() returns numbers in the
START_VALUE to END_VALUE range. END_PTR is where the string is
advanced to when get_next() returns END_VALUE. */
- void setup_range (int start_value, int end_value,
- const char *end_ptr);
+ void setup_range (int start_value, int end_value, const char *end_ptr);
/* Returns true if parsing has completed. */
bool finished () const;
/* Return the string being parsed. When parsing has finished, this
points past the last parsed token. */
- const char *cur_tok () const
- { return m_cur_tok; }
+ const char *cur_tok () const { return m_cur_tok; }
/* True when parsing a range. */
- bool in_range () const
- { return m_in_range; }
+ bool in_range () const { return m_in_range; }
/* When parsing a range, the final value in the range. */
- int end_value () const
- { return m_end_value; }
+ int end_value () const { return m_end_value; }
/* When parsing a range, skip past the final token in the range. */
void skip_range ()
@@ -123,6 +118,7 @@ public:
}
private:
+
/* No need for these. They are intentionally not defined anywhere. */
number_or_range_parser (const number_or_range_parser &);
number_or_range_parser &operator= (const number_or_range_parser &);
@@ -200,8 +196,7 @@ check_for_argument (const char **str, const char *arg)
static inline int
check_for_argument (char **str, const char *arg, int arg_len)
{
- return check_for_argument (const_cast<const char **> (str),
- arg, arg_len);
+ return check_for_argument (const_cast<const char **> (str), arg, arg_len);
}
static inline int
diff --git a/gdb/coff-pe-read.c b/gdb/coff-pe-read.c
index 2b89e8a3542..b353a144f72 100644
--- a/gdb/coff-pe-read.c
+++ b/gdb/coff-pe-read.c
@@ -48,24 +48,24 @@ static unsigned int debug_coff_pe_read;
struct read_pe_section_data
{
- CORE_ADDR vma_offset; /* Offset to loaded address of section. */
- unsigned long rva_start; /* Start offset within the pe. */
- unsigned long rva_end; /* End offset within the pe. */
- enum minimal_symbol_type ms_type; /* Type to assign symbols in
+ CORE_ADDR vma_offset; /* Offset to loaded address of section. */
+ unsigned long rva_start; /* Start offset within the pe. */
+ unsigned long rva_end; /* End offset within the pe. */
+ enum minimal_symbol_type ms_type; /* Type to assign symbols in
section. */
- unsigned int index; /* BFD section number. */
- std::string section_name; /* Recorded section name. */
+ unsigned int index; /* BFD section number. */
+ std::string section_name; /* Recorded section name. */
};
#define IMAGE_SCN_CNT_CODE 0x20
#define IMAGE_SCN_CNT_INITIALIZED_DATA 0x40
#define IMAGE_SCN_CNT_UNINITIALIZED_DATA 0x80
-#define PE_SECTION_INDEX_TEXT 0
-#define PE_SECTION_INDEX_DATA 1
-#define PE_SECTION_INDEX_BSS 2
-#define PE_SECTION_TABLE_SIZE 3
+#define PE_SECTION_INDEX_TEXT 0
+#define PE_SECTION_INDEX_DATA 1
+#define PE_SECTION_INDEX_BSS 2
+#define PE_SECTION_TABLE_SIZE 3
#define PE_SECTION_INDEX_INVALID -1
-
+
/* Get the index of the named section in our own array, which contains
text, data and bss in that order. Return PE_SECTION_INDEX_INVALID
if passed an unrecognised section name. */
@@ -108,7 +108,6 @@ get_pe_section_index (const char *section_name,
return PE_SECTION_INDEX_INVALID;
}
-
/* Create a minimal symbol entry for an exported symbol.
SYM_NAME contains the exported name or NULL if exported by ordinal,
FUNC_RVA contains the Relative Virtual Address of the symbol,
@@ -119,10 +118,8 @@ get_pe_section_index (const char *section_name,
OBJFILE is the objfile struct of DLL_NAME. */
static void
-add_pe_exported_sym (minimal_symbol_reader &reader,
- const char *sym_name,
- unsigned long func_rva,
- int ordinal,
+add_pe_exported_sym (minimal_symbol_reader &reader, const char *sym_name,
+ unsigned long func_rva, int ordinal,
const struct read_pe_section_data *section_data,
const char *dll_name, struct objfile *objfile)
{
@@ -143,10 +140,10 @@ add_pe_exported_sym (minimal_symbol_reader &reader,
= string_printf ("%s!%s", dll_name, bare_name.c_str ());
if ((section_data->ms_type == mst_unknown) && debug_coff_pe_read)
- gdb_printf (gdb_stdlog , _("Unknown section type for \"%s\""
- " for entry \"%s\" in dll \"%s\"\n"),
- section_data->section_name.c_str (), sym_name,
- dll_name);
+ gdb_printf (gdb_stdlog,
+ _ ("Unknown section type for \"%s\""
+ " for entry \"%s\" in dll \"%s\"\n"),
+ section_data->section_name.c_str (), sym_name, dll_name);
reader.record_with_info (qualified_name.c_str (), vma, section_data->ms_type,
section_data->index);
@@ -155,8 +152,10 @@ add_pe_exported_sym (minimal_symbol_reader &reader,
reader.record_with_info (bare_name.c_str (), vma, section_data->ms_type,
section_data->index);
if (debug_coff_pe_read > 1)
- gdb_printf (gdb_stdlog, _("Adding exported symbol \"%s\""
- " in dll \"%s\"\n"), sym_name, dll_name);
+ gdb_printf (gdb_stdlog,
+ _ ("Adding exported symbol \"%s\""
+ " in dll \"%s\"\n"),
+ sym_name, dll_name);
}
/* Create a minimal symbol entry for an exported forward symbol.
@@ -169,8 +168,8 @@ add_pe_exported_sym (minimal_symbol_reader &reader,
OBJFILE is the objfile struct of DLL_NAME. */
static int
-add_pe_forwarded_sym (minimal_symbol_reader &reader,
- const char *sym_name, const char *forward_dll_name,
+add_pe_forwarded_sym (minimal_symbol_reader &reader, const char *sym_name,
+ const char *forward_dll_name,
const char *forward_func_name, int ordinal,
const char *dll_name, struct objfile *objfile)
{
@@ -180,9 +179,8 @@ add_pe_forwarded_sym (minimal_symbol_reader &reader,
int forward_dll_name_len = strlen (forward_dll_name);
short section;
- std::string forward_qualified_name = string_printf ("%s!%s",
- forward_dll_name,
- forward_func_name);
+ std::string forward_qualified_name
+ = string_printf ("%s!%s", forward_dll_name, forward_func_name);
msymbol = lookup_bound_minimal_symbol (forward_qualified_name.c_str ());
@@ -198,16 +196,17 @@ add_pe_forwarded_sym (minimal_symbol_reader &reader,
if (!msymbol.minsym)
{
if (debug_coff_pe_read)
- gdb_printf (gdb_stdlog, _("Unable to find function \"%s\" in"
- " dll \"%s\", forward of \"%s\" in dll \"%s\"\n"),
- forward_func_name, forward_dll_name, sym_name,
- dll_name);
+ gdb_printf (gdb_stdlog,
+ _ ("Unable to find function \"%s\" in"
+ " dll \"%s\", forward of \"%s\" in dll \"%s\"\n"),
+ forward_func_name, forward_dll_name, sym_name, dll_name);
return 0;
}
if (debug_coff_pe_read > 1)
- gdb_printf (gdb_stdlog, _("Adding forwarded exported symbol"
- " \"%s\" in dll \"%s\", pointing to \"%s\"\n"),
+ gdb_printf (gdb_stdlog,
+ _ ("Adding forwarded exported symbol"
+ " \"%s\" in dll \"%s\", pointing to \"%s\"\n"),
sym_name, dll_name, forward_qualified_name.c_str ());
vma = msymbol.value_address ();
@@ -238,7 +237,7 @@ add_pe_forwarded_sym (minimal_symbol_reader &reader,
section);
/* Enter the plain name as well, which might not be unique. */
- reader.record_with_info (bare_name.c_str(), vma - baseaddr, msymtype,
+ reader.record_with_info (bare_name.c_str (), vma - baseaddr, msymtype,
section);
return 1;
@@ -254,7 +253,7 @@ read_pe_truncate_name (char *dll_name)
if (last_point != NULL)
*last_point = '\0';
}
-
+
/* Low-level support functions, direct from the ld module pe-dll.c. */
static unsigned int
pe_get16 (bfd *abfd, int where)
@@ -291,14 +290,13 @@ pe_as32 (void *ptr)
return b[0] + (b[1] << 8) + (b[2] << 16) + (b[3] << 24);
}
-
+
/* Read the (non-debug) export symbol table from a portable
executable. Code originally lifted from the ld function
pe_implied_import_dll in pe-dll.c. */
void
-read_pe_exported_syms (minimal_symbol_reader &reader,
- struct objfile *objfile)
+read_pe_exported_syms (minimal_symbol_reader &reader, struct objfile *objfile)
{
bfd *dll = objfile->obfd.get ();
unsigned long nbnormal, nbforward;
@@ -314,10 +312,10 @@ read_pe_exported_syms (minimal_symbol_reader &reader,
char const *target = bfd_get_target (objfile->obfd.get ());
- std::vector<struct read_pe_section_data> section_data
- (PE_SECTION_TABLE_SIZE);
+ std::vector<struct read_pe_section_data> section_data (
+ PE_SECTION_TABLE_SIZE);
- for (i=0; i < PE_SECTION_TABLE_SIZE; i++)
+ for (i = 0; i < PE_SECTION_TABLE_SIZE; i++)
{
section_data[i].vma_offset = 0;
section_data[i].rva_start = 1;
@@ -330,14 +328,14 @@ read_pe_exported_syms (minimal_symbol_reader &reader,
section_data[PE_SECTION_INDEX_BSS].ms_type = mst_bss;
section_data[PE_SECTION_INDEX_BSS].section_name = ".bss";
- is_pe64 = (strcmp (target, "pe-x86-64") == 0
- || strcmp (target, "pei-x86-64") == 0
- || strcmp (target, "pe-aarch64") == 0
- || strcmp (target, "pei-aarch64") == 0);
- is_pe32 = (strcmp (target, "pe-i386") == 0
- || strcmp (target, "pei-i386") == 0
- || strcmp (target, "pe-arm-wince-little") == 0
- || strcmp (target, "pei-arm-wince-little") == 0);
+ is_pe64
+ = (strcmp (target, "pe-x86-64") == 0 || strcmp (target, "pei-x86-64") == 0
+ || strcmp (target, "pe-aarch64") == 0
+ || strcmp (target, "pei-aarch64") == 0);
+ is_pe32
+ = (strcmp (target, "pe-i386") == 0 || strcmp (target, "pei-i386") == 0
+ || strcmp (target, "pe-arm-wince-little") == 0
+ || strcmp (target, "pei-arm-wince-little") == 0);
if (!is_pe32 && !is_pe64)
{
/* This is not a recognized PE format file. Abort now, because
@@ -354,7 +352,7 @@ read_pe_exported_syms (minimal_symbol_reader &reader,
else
num_entries = pe_get32 (dll, opthdr_ofs + 92);
- if (num_entries < 1) /* No exports. */
+ if (num_entries < 1) /* No exports. */
return;
if (is_pe64)
{
@@ -367,8 +365,8 @@ read_pe_exported_syms (minimal_symbol_reader &reader,
export_opthdrsize = pe_get32 (dll, opthdr_ofs + 100);
}
nsections = pe_get16 (dll, pe_header_offset + 4 + 2);
- secptr = (pe_header_offset + 4 + 20 +
- pe_get16 (dll, pe_header_offset + 4 + 16));
+ secptr
+ = (pe_header_offset + 4 + 20 + pe_get16 (dll, pe_header_offset + 4 + 16));
expptr = 0;
export_size = 0;
@@ -390,13 +388,15 @@ read_pe_exported_syms (minimal_symbol_reader &reader,
if (strcmp (sname, ".edata") != 0)
{
if (debug_coff_pe_read)
- gdb_printf (gdb_stdlog, _("Export RVA for dll "
- "\"%s\" is in section \"%s\"\n"),
+ gdb_printf (gdb_stdlog,
+ _ ("Export RVA for dll "
+ "\"%s\" is in section \"%s\"\n"),
bfd_get_filename (dll), sname);
}
else if (export_opthdrrva != vaddr && debug_coff_pe_read)
- gdb_printf (gdb_stdlog, _("Wrong value of export RVA"
- " for dll \"%s\": 0x%lx instead of 0x%lx\n"),
+ gdb_printf (gdb_stdlog,
+ _ ("Wrong value of export RVA"
+ " for dll \"%s\": 0x%lx instead of 0x%lx\n"),
bfd_get_filename (dll), export_opthdrrva, vaddr);
expptr = fptr + (export_opthdrrva - vaddr);
break;
@@ -501,8 +501,10 @@ read_pe_exported_syms (minimal_symbol_reader &reader,
read_pe_truncate_name (dll_name);
if (debug_coff_pe_read)
- gdb_printf (gdb_stdlog, _("DLL \"%s\" has %ld export entries,"
- " base=%ld\n"), dll_name, nexp, ordbase);
+ gdb_printf (gdb_stdlog,
+ _ ("DLL \"%s\" has %ld export entries,"
+ " base=%ld\n"),
+ dll_name, nexp, ordbase);
nbforward = 0;
nbnormal = 0;
/* Iterate through the list of symbols. */
@@ -514,11 +516,9 @@ read_pe_exported_syms (minimal_symbol_reader &reader,
unsigned long ordinal = pe_as16 (erva + ordinals + i * 2);
-
/* Pointer to the function address vector. */
/* This is relative to ordinal value. */
- unsigned long func_rva = pe_as32 (erva + exp_funcbase +
- ordinal * 4);
+ unsigned long func_rva = pe_as32 (erva + exp_funcbase + ordinal * 4);
/* Find this symbol's section in our own array. */
int sectix = 0;
@@ -543,8 +543,9 @@ read_pe_exported_syms (minimal_symbol_reader &reader,
forward_func_name = sep + 1;
}
if (add_pe_forwarded_sym (reader, funcname, forward_dll_name,
- forward_func_name, ordinal,
- dll_name, objfile) != 0)
+ forward_func_name, ordinal, dll_name,
+ objfile)
+ != 0)
++nbforward;
continue;
}
@@ -574,16 +575,18 @@ read_pe_exported_syms (minimal_symbol_reader &reader,
++nbnormal;
}
else if (debug_coff_pe_read)
- gdb_printf (gdb_stdlog, _("Export name \"%s\" ord. %lu,"
- " RVA 0x%lx in dll \"%s\" not handled\n"),
+ gdb_printf (gdb_stdlog,
+ _ ("Export name \"%s\" ord. %lu,"
+ " RVA 0x%lx in dll \"%s\" not handled\n"),
funcname, ordinal, func_rva, dll_name);
}
}
if (debug_coff_pe_read)
- gdb_printf (gdb_stdlog, _("Finished reading \"%s\", exports %ld,"
- " forwards %ld, total %ld/%ld.\n"), dll_name, nbnormal,
- nbforward, nbnormal + nbforward, nexp);
+ gdb_printf (gdb_stdlog,
+ _ ("Finished reading \"%s\", exports %ld,"
+ " forwards %ld, total %ld/%ld.\n"),
+ dll_name, nbnormal, nbforward, nbnormal + nbforward, nexp);
}
/* Extract from ABFD the offset of the .text section.
@@ -611,14 +614,14 @@ pe_text_section_offset (struct bfd *abfd)
target = bfd_get_target (abfd);
- is_pe64 = (strcmp (target, "pe-x86-64") == 0
- || strcmp (target, "pei-x86-64") == 0
- || strcmp (target, "pe-aarch64") == 0
- || strcmp (target, "pei-aarch64") == 0);
- is_pe32 = (strcmp (target, "pe-i386") == 0
- || strcmp (target, "pei-i386") == 0
- || strcmp (target, "pe-arm-wince-little") == 0
- || strcmp (target, "pei-arm-wince-little") == 0);
+ is_pe64
+ = (strcmp (target, "pe-x86-64") == 0 || strcmp (target, "pei-x86-64") == 0
+ || strcmp (target, "pe-aarch64") == 0
+ || strcmp (target, "pei-aarch64") == 0);
+ is_pe32
+ = (strcmp (target, "pe-i386") == 0 || strcmp (target, "pei-i386") == 0
+ || strcmp (target, "pe-arm-wince-little") == 0
+ || strcmp (target, "pei-arm-wince-little") == 0);
if (!is_pe32 && !is_pe64)
{
@@ -631,8 +634,8 @@ pe_text_section_offset (struct bfd *abfd)
/* Get pe_header, optional header and numbers of sections. */
pe_header_offset = pe_get32 (abfd, 0x3c);
nsections = pe_get16 (abfd, pe_header_offset + 4 + 2);
- secptr = (pe_header_offset + 4 + 20 +
- pe_get16 (abfd, pe_header_offset + 4 + 16));
+ secptr
+ = (pe_header_offset + 4 + 20 + pe_get16 (abfd, pe_header_offset + 4 + 16));
/* Get the rva and size of the export section. */
for (i = 0; i < nsections; i++)
@@ -657,21 +660,20 @@ static void
show_debug_coff_pe_read (struct ui_file *file, int from_tty,
struct cmd_list_element *c, const char *value)
{
- gdb_printf (file, _("Coff PE read debugging is %s.\n"), value);
+ gdb_printf (file, _ ("Coff PE read debugging is %s.\n"), value);
}
/* Adds "Set/show debug coff_pe_read" commands. */
void _initialize_coff_pe_read ();
+
void
_initialize_coff_pe_read ()
{
- add_setshow_zuinteger_cmd ("coff-pe-read", class_maintenance,
- &debug_coff_pe_read,
- _("Set coff PE read debugging."),
- _("Show coff PE read debugging."),
- _("When set, debugging messages for coff reading "
- "of exported symbols are displayed."),
- NULL, show_debug_coff_pe_read,
- &setdebuglist, &showdebuglist);
+ add_setshow_zuinteger_cmd (
+ "coff-pe-read", class_maintenance, &debug_coff_pe_read,
+ _ ("Set coff PE read debugging."), _ ("Show coff PE read debugging."),
+ _ ("When set, debugging messages for coff reading "
+ "of exported symbols are displayed."),
+ NULL, show_debug_coff_pe_read, &setdebuglist, &showdebuglist);
}
diff --git a/gdb/coff-pe-read.h b/gdb/coff-pe-read.h
index 96cffde2f00..3b537316133 100644
--- a/gdb/coff-pe-read.h
+++ b/gdb/coff-pe-read.h
@@ -19,7 +19,7 @@
Contributed by Raoul M. Gough (RaoulGough@yahoo.co.uk). */
-#if !defined (COFF_PE_READ_H)
+#if !defined(COFF_PE_READ_H)
#define COFF_PE_READ_H
class minimal_symbol_reader;
diff --git a/gdb/coffread.c b/gdb/coffread.c
index 65d7828e933..7481d411392 100644
--- a/gdb/coffread.c
+++ b/gdb/coffread.c
@@ -27,8 +27,8 @@
#include "gdbsupport/gdb_obstack.h"
#include <ctype.h>
-#include "coff/internal.h" /* Internal format of COFF symbols in BFD */
-#include "libcoff.h" /* FIXME secret internal data from BFD */
+#include "coff/internal.h" /* Internal format of COFF symbols in BFD */
+#include "libcoff.h" /* FIXME secret internal data from BFD */
#include "objfiles.h"
#include "buildsym-legacy.h"
#include "stabsread.h"
@@ -48,32 +48,31 @@
static struct objfile *coffread_objfile;
struct coff_symfile_info
- {
- file_ptr min_lineno_offset = 0; /* Where in file lowest line#s are. */
- file_ptr max_lineno_offset = 0; /* 1+last byte of line#s in file. */
-
- CORE_ADDR textaddr = 0; /* Addr of .text section. */
- unsigned int textsize = 0; /* Size of .text section. */
- std::vector<asection *> *stabsects; /* .stab sections. */
- asection *stabstrsect = nullptr; /* Section pointer for .stab section. */
- char *stabstrdata = nullptr;
- };
+{
+ file_ptr min_lineno_offset = 0; /* Where in file lowest line#s are. */
+ file_ptr max_lineno_offset = 0; /* 1+last byte of line#s in file. */
+
+ CORE_ADDR textaddr = 0; /* Addr of .text section. */
+ unsigned int textsize = 0; /* Size of .text section. */
+ std::vector<asection *> *stabsects; /* .stab sections. */
+ asection *stabstrsect = nullptr; /* Section pointer for .stab section. */
+ char *stabstrdata = nullptr;
+};
/* Key for COFF-associated data. */
static const registry<objfile>::key<coff_symfile_info> coff_objfile_data_key;
/* Translate an external name string into a user-visible name. */
-#define EXTERNAL_NAME(string, abfd) \
- (string[0] == bfd_get_symbol_leading_char (abfd) \
- ? string + 1 : string)
+#define EXTERNAL_NAME(string, abfd) \
+ (string[0] == bfd_get_symbol_leading_char (abfd) ? string + 1 : string)
/* To be an sdb debug type, type must have at least a basic or primary
derived type. Using this rather than checking against T_NULL is
said to prevent core dumps if we try to operate on Michael Bloom
dbx-in-coff file. */
-#define SDB_TYPE(type) (BTYPE(type) | (type & N_TMASK))
+#define SDB_TYPE(type) (BTYPE (type) | (type & N_TMASK))
/* Core address of start and end of text of current source file.
This comes from a ".text" symbol where x_nlinno > 0. */
@@ -87,7 +86,6 @@ static CORE_ADDR current_source_end_addr;
static bfd *nlist_bfd_global;
static int nlist_nsyms_global;
-
/* Pointers to scratch storage, used for reading raw symbols and
auxents. */
@@ -105,10 +103,10 @@ static unsigned local_n_btshft;
static unsigned local_n_tmask;
static unsigned local_n_tshift;
-#define N_BTMASK local_n_btmask
-#define N_BTSHFT local_n_btshft
-#define N_TMASK local_n_tmask
-#define N_TSHIFT local_n_tshift
+#define N_BTMASK local_n_btmask
+#define N_BTSHFT local_n_btshft
+#define N_TMASK local_n_tmask
+#define N_TSHIFT local_n_tshift
/* Local variables that hold the sizes in the file of various COFF
structures. (We only need to know this to read them from the file
@@ -131,16 +129,16 @@ static struct symbol *opaque_type_chain[HASHSIZE];
/* Simplified internal version of coff symbol table information. */
struct coff_symbol
- {
- char *c_name;
- int c_symnum; /* Symbol number of this entry. */
- int c_naux; /* 0 if syment only, 1 if syment +
+{
+ char *c_name;
+ int c_symnum; /* Symbol number of this entry. */
+ int c_naux; /* 0 if syment only, 1 if syment +
auxent, etc. */
- CORE_ADDR c_value;
- int c_sclass;
- int c_secnum;
- unsigned int c_type;
- };
+ CORE_ADDR c_value;
+ int c_sclass;
+ int c_secnum;
+ unsigned int c_type;
+};
/* Vector of types defined so far, indexed by their type numbers. */
@@ -163,25 +161,20 @@ static char *stringtab = NULL;
extern void stabsread_clear_cache (void);
-static struct type *coff_read_struct_type (int, int, int,
- struct objfile *);
+static struct type *coff_read_struct_type (int, int, int, struct objfile *);
-static struct type *decode_base_type (struct coff_symbol *,
- unsigned int,
+static struct type *decode_base_type (struct coff_symbol *, unsigned int,
union internal_auxent *,
struct objfile *);
static struct type *decode_type (struct coff_symbol *, unsigned int,
- union internal_auxent *,
- struct objfile *);
+ union internal_auxent *, struct objfile *);
-static struct type *decode_function_type (struct coff_symbol *,
- unsigned int,
+static struct type *decode_function_type (struct coff_symbol *, unsigned int,
union internal_auxent *,
struct objfile *);
-static struct type *coff_read_enum_type (int, int, int,
- struct objfile *);
+static struct type *coff_read_enum_type (int, int, int, struct objfile *);
static struct symbol *process_coff_symbol (struct coff_symbol *,
union internal_auxent *,
@@ -191,7 +184,8 @@ static void patch_opaque_types (struct symtab *);
static void enter_linenos (file_ptr, int, int, struct objfile *);
-static int init_lineno (bfd *, file_ptr, file_ptr, gdb::unique_xmalloc_ptr<char> *);
+static int init_lineno (bfd *, file_ptr, file_ptr,
+ gdb::unique_xmalloc_ptr<char> *);
static char *getsymname (struct internal_syment *);
@@ -199,12 +193,11 @@ static const char *coff_getfilename (union internal_auxent *);
static int init_stringtab (bfd *, file_ptr, gdb::unique_xmalloc_ptr<char> *);
-static void read_one_sym (struct coff_symbol *,
- struct internal_syment *,
+static void read_one_sym (struct coff_symbol *, struct internal_syment *,
union internal_auxent *);
-static void coff_symtab_read (minimal_symbol_reader &,
- file_ptr, unsigned int, struct objfile *);
+static void coff_symtab_read (minimal_symbol_reader &, file_ptr, unsigned int,
+ struct objfile *);
/* We are called once per section from coff_symfile_read. We
need to examine each section we are passed, check to see
@@ -255,10 +248,10 @@ coff_locate_sections (bfd *abfd, asection *sectp, void *csip)
static int cs_to_section (struct coff_symbol *, struct objfile *);
struct coff_find_targ_sec_arg
- {
- int targ_index;
- asection **resultp;
- };
+{
+ int targ_index;
+ asection **resultp;
+};
static void
find_targ_sec (bfd *abfd, asection *sect, void *obj)
@@ -270,7 +263,7 @@ find_targ_sec (bfd *abfd, asection *sect, void *obj)
}
/* Return the bfd_section that CS points to. */
-static struct bfd_section*
+static struct bfd_section *
cs_to_bfd_section (struct coff_symbol *cs, struct objfile *objfile)
{
asection *sect = NULL;
@@ -327,14 +320,15 @@ coff_lookup_type (int index)
int old_vector_length = type_vector_length;
type_vector_length *= 2;
- if (index /* is still */ >= type_vector_length)
+ if (index /* is still */ >= type_vector_length)
type_vector_length = index * 2;
- type_vector = (struct type **)
- xrealloc ((char *) type_vector,
- type_vector_length * sizeof (struct type *));
+ type_vector = (struct type **) xrealloc ((char *) type_vector,
+ type_vector_length
+ * sizeof (struct type *));
memset (&type_vector[old_vector_length], 0,
- (type_vector_length - old_vector_length) * sizeof (struct type *));
+ (type_vector_length - old_vector_length)
+ * sizeof (struct type *));
}
return &type_vector[index];
}
@@ -359,7 +353,7 @@ coff_alloc_type (int index)
}
return type;
}
-
+
/* Start a new symtab for a new source file.
This is called when a COFF ".file" symbol is seen;
it indicates the start of data for one original source file. */
@@ -368,15 +362,15 @@ static void
coff_start_compunit_symtab (struct objfile *objfile, const char *name)
{
within_function = 0;
- start_compunit_symtab (objfile,
- name,
- /* We never know the directory name for COFF. */
- NULL,
- /* The start address is irrelevant, since we call
+ start_compunit_symtab (
+ objfile, name,
+ /* We never know the directory name for COFF. */
+ NULL,
+ /* The start address is irrelevant, since we call
set_last_source_start_addr in coff_end_compunit_symtab. */
- 0,
- /* Let buildsym.c deduce the language for this symtab. */
- language_unknown);
+ 0,
+ /* Let buildsym.c deduce the language for this symtab. */
+ language_unknown);
record_debugformat ("COFF");
}
@@ -409,14 +403,13 @@ coff_end_compunit_symtab (struct objfile *objfile)
/* Reinitialize for beginning of new file. */
set_last_source_file (NULL);
}
-
+
/* The linker sometimes generates some non-function symbols inside
functions referencing variables imported from another DLL.
Return nonzero if the given symbol corresponds to one of them. */
static int
-is_import_fixup_symbol (struct coff_symbol *cs,
- enum minimal_symbol_type type)
+is_import_fixup_symbol (struct coff_symbol *cs, enum minimal_symbol_type type)
{
/* The following is a bit of a heuristic using the characteristics
of these fixup symbols, but should work well in practice... */
@@ -433,7 +426,7 @@ is_import_fixup_symbol (struct coff_symbol *cs,
/* The name must start with "__fu<digits>__". */
if (!startswith (cs->c_name, "__fu"))
return 0;
- if (! isdigit (cs->c_name[4]))
+ if (!isdigit (cs->c_name[4]))
return 0;
for (i = 5; cs->c_name[i] != '\0' && isdigit (cs->c_name[i]); i++)
/* Nothing, just incrementing index past all digits. */;
@@ -444,10 +437,9 @@ is_import_fixup_symbol (struct coff_symbol *cs,
}
static struct minimal_symbol *
-record_minimal_symbol (minimal_symbol_reader &reader,
- struct coff_symbol *cs, CORE_ADDR address,
- enum minimal_symbol_type type, int section,
- struct objfile *objfile)
+record_minimal_symbol (minimal_symbol_reader &reader, struct coff_symbol *cs,
+ CORE_ADDR address, enum minimal_symbol_type type,
+ int section, struct objfile *objfile)
{
/* We don't want TDESC entry points in the minimal symbol table. */
if (cs->c_name[0] == '@')
@@ -465,7 +457,7 @@ record_minimal_symbol (minimal_symbol_reader &reader,
return reader.record_full (cs->c_name, true, address, type, section);
}
-
+
/* coff_symfile_init ()
is the coff-specific initialization routine for reading symbols.
It is passed a struct objfile which contains, among other things,
@@ -524,7 +516,6 @@ find_linenos (bfd *abfd, struct bfd_section *asect, void *vpinfo)
info->max_lineno_offset = maxoff;
}
-
/* A helper function for coff_symfile_read that reads minimal
symbols. It may also read other forms of symbol as well. */
@@ -619,19 +610,19 @@ coff_symfile_read (struct objfile *objfile, symfile_add_flags symfile_flags)
file_ptr symtab_offset;
file_ptr stringtab_offset;
unsigned int stabstrsize;
-
+
info = coff_objfile_data_key.get (objfile);
- symfile_bfd = abfd; /* Kludge for swap routines. */
+ symfile_bfd = abfd; /* Kludge for swap routines. */
std::vector<asection *> stabsects;
scoped_restore restore_stabsects
= make_scoped_restore (&info->stabsects, &stabsects);
-/* WARNING WILL ROBINSON! ACCESSING BFD-PRIVATE DATA HERE! FIXME! */
- num_symbols = bfd_get_symcount (abfd); /* How many syms */
- symtab_offset = cdata->sym_filepos; /* Symbol table file offset */
- stringtab_offset = symtab_offset + /* String table file offset */
- num_symbols * cdata->local_symesz;
+ /* WARNING WILL ROBINSON! ACCESSING BFD-PRIVATE DATA HERE! FIXME! */
+ num_symbols = bfd_get_symcount (abfd); /* How many syms */
+ symtab_offset = cdata->sym_filepos; /* Symbol table file offset */
+ stringtab_offset = symtab_offset + /* String table file offset */
+ num_symbols * cdata->local_symesz;
/* Set a few file-statics that give us specific information about
the particular COFF file format we're reading. */
@@ -655,9 +646,8 @@ coff_symfile_read (struct objfile *objfile, symfile_add_flags symfile_flags)
from the section address, rather than as absolute addresses.
FIXME: We should use BFD to read the symbol table, and thus avoid
this problem. */
- pe_file =
- startswith (bfd_get_target (objfile->obfd.get ()), "pe")
- || startswith (bfd_get_target (objfile->obfd.get ()), "epoc-pe");
+ pe_file = startswith (bfd_get_target (objfile->obfd.get ()), "pe")
+ || startswith (bfd_get_target (objfile->obfd.get ()), "epoc-pe");
/* End of warning. */
@@ -689,7 +679,7 @@ coff_symfile_read (struct objfile *objfile, symfile_add_flags symfile_flags)
info->max_lineno_offset - info->min_lineno_offset,
&linetab_storage);
if (val < 0)
- error (_("\"%s\": error reading line numbers."), filename);
+ error (_ ("\"%s\": error reading line numbers."), filename);
}
/* Now read the string table, all at once. */
@@ -698,19 +688,19 @@ coff_symfile_read (struct objfile *objfile, symfile_add_flags symfile_flags)
gdb::unique_xmalloc_ptr<char> stringtab_storage;
val = init_stringtab (abfd, stringtab_offset, &stringtab_storage);
if (val < 0)
- error (_("\"%s\": can't get string table"), filename);
+ error (_ ("\"%s\": can't get string table"), filename);
coff_read_minsyms (symtab_offset, num_symbols, objfile);
if (!(objfile->flags & OBJF_READNEVER))
bfd_map_over_sections (abfd, coff_locate_sections, (void *) info);
- if (!info->stabsects->empty())
+ if (!info->stabsects->empty ())
{
if (!info->stabstrsect)
{
- error (_("The debugging information in `%s' is corrupted.\nThe "
- "file has a `.stabs' section, but no `.stabstr' section."),
+ error (_ ("The debugging information in `%s' is corrupted.\nThe "
+ "file has a `.stabs' section, but no `.stabstr' section."),
filename);
}
@@ -720,10 +710,9 @@ coff_symfile_read (struct objfile *objfile, symfile_add_flags symfile_flags)
stabstrsize = bfd_section_size (info->stabstrsect);
- coffstab_build_psymtabs (objfile,
- info->textaddr, info->textsize,
- *info->stabsects,
- info->stabstrsect->filepos, stabstrsize);
+ coffstab_build_psymtabs (objfile, info->textaddr, info->textsize,
+ *info->stabsects, info->stabstrsect->filepos,
+ stabstrsize);
}
if (dwarf2_has_info (objfile, NULL))
{
@@ -774,7 +763,6 @@ coff_symfile_finish (struct objfile *objfile)
/* Let stabs reader clean up. */
stabsread_clear_cache ();
}
-
/* Given pointers to a symbol table in coff style exec file,
analyze them and create struct symtab's describing the symbols.
@@ -782,9 +770,8 @@ coff_symfile_finish (struct objfile *objfile)
We read them one at a time using read_one_sym (). */
static void
-coff_symtab_read (minimal_symbol_reader &reader,
- file_ptr symtab_offset, unsigned int nsyms,
- struct objfile *objfile)
+coff_symtab_read (minimal_symbol_reader &reader, file_ptr symtab_offset,
+ unsigned int nsyms, struct objfile *objfile)
{
struct gdbarch *gdbarch = objfile->arch ();
struct context_stack *newobj = nullptr;
@@ -839,7 +826,7 @@ coff_symtab_read (minimal_symbol_reader &reader,
set_last_source_file (NULL);
memset (opaque_type_chain, 0, sizeof opaque_type_chain);
- if (type_vector) /* Get rid of previous one. */
+ if (type_vector) /* Get rid of previous one. */
xfree (type_vector);
type_vector_length = INITIAL_TYPE_VECTOR_LENGTH;
type_vector = XCNEWVEC (struct type *, type_vector_length);
@@ -849,7 +836,7 @@ coff_symtab_read (minimal_symbol_reader &reader,
symnum = 0;
while (symnum < nsyms)
{
- QUIT; /* Make this command interruptable. */
+ QUIT; /* Make this command interruptable. */
read_one_sym (cs, &main_sym, &main_aux);
@@ -885,8 +872,8 @@ coff_symtab_read (minimal_symbol_reader &reader,
tmpaddr = cs->c_value;
/* Don't record unresolved symbols. */
if (!(cs->c_secnum <= 0 && cs->c_value == 0))
- record_minimal_symbol (reader, cs, tmpaddr, mst_text,
- section, objfile);
+ record_minimal_symbol (reader, cs, tmpaddr, mst_text, section,
+ objfile);
fcn_line_ptr = main_aux.x_sym.x_fcnary.x_fcn.x_lnnoptr;
fcn_start_addr = tmpaddr;
@@ -905,8 +892,7 @@ coff_symtab_read (minimal_symbol_reader &reader,
case C_LINE:
case C_ALIAS:
case C_HIDDEN:
- complaint (_("Bad n_sclass for symbol %s"),
- cs->c_name);
+ complaint (_ ("Bad n_sclass for symbol %s"), cs->c_name);
break;
case C_FILE:
@@ -960,8 +946,7 @@ coff_symtab_read (minimal_symbol_reader &reader,
/* Flush rest of '.' symbols. */
break;
}
- else if (!SDB_TYPE (cs->c_type)
- && cs->c_name[0] == 'L'
+ else if (!SDB_TYPE (cs->c_type) && cs->c_name[0] == 'L'
&& (startswith (cs->c_name, "LI%")
|| startswith (cs->c_name, "LF%")
|| startswith (cs->c_name, "LC%")
@@ -1015,49 +1000,49 @@ coff_symtab_read (minimal_symbol_reader &reader,
sec = cs_to_section (cs, objfile);
tmpaddr = cs->c_value;
/* Statics in a PE file also get relocated. */
- if (cs->c_sclass == C_EXT
- || cs->c_sclass == C_THUMBEXTFUNC
+ if (cs->c_sclass == C_EXT || cs->c_sclass == C_THUMBEXTFUNC
|| cs->c_sclass == C_THUMBEXT
|| (pe_file && (cs->c_sclass == C_STAT)))
offset = objfile->section_offsets[sec];
if (bfd_section->flags & SEC_CODE)
{
- ms_type =
- cs->c_sclass == C_EXT || cs->c_sclass == C_THUMBEXTFUNC
- || cs->c_sclass == C_THUMBEXT ?
- mst_text : mst_file_text;
+ ms_type = cs->c_sclass == C_EXT
+ || cs->c_sclass == C_THUMBEXTFUNC
+ || cs->c_sclass == C_THUMBEXT
+ ? mst_text
+ : mst_file_text;
tmpaddr = gdbarch_addr_bits_remove (gdbarch, tmpaddr);
}
else if (bfd_section->flags & SEC_ALLOC
&& bfd_section->flags & SEC_LOAD)
{
- ms_type =
- cs->c_sclass == C_EXT || cs->c_sclass == C_THUMBEXT
- ? mst_data : mst_file_data;
+ ms_type
+ = cs->c_sclass == C_EXT || cs->c_sclass == C_THUMBEXT
+ ? mst_data
+ : mst_file_data;
}
else if (bfd_section->flags & SEC_ALLOC)
{
- ms_type =
- cs->c_sclass == C_EXT || cs->c_sclass == C_THUMBEXT
- ? mst_bss : mst_file_bss;
+ ms_type
+ = cs->c_sclass == C_EXT || cs->c_sclass == C_THUMBEXT
+ ? mst_bss
+ : mst_file_bss;
}
else
ms_type = mst_unknown;
}
- msym = record_minimal_symbol (reader, cs, tmpaddr, ms_type,
- sec, objfile);
+ msym = record_minimal_symbol (reader, cs, tmpaddr, ms_type, sec,
+ objfile);
if (msym)
- gdbarch_coff_make_msymbol_special (gdbarch,
- cs->c_sclass, msym);
+ gdbarch_coff_make_msymbol_special (gdbarch, cs->c_sclass, msym);
if (SDB_TYPE (cs->c_type))
{
struct symbol *sym;
- sym = process_coff_symbol
- (cs, &main_aux, objfile);
+ sym = process_coff_symbol (cs, &main_aux, objfile);
sym->set_value_longest (tmpaddr + offset);
sym->set_section_index (sec);
}
@@ -1074,7 +1059,7 @@ coff_symtab_read (minimal_symbol_reader &reader,
/* main_aux.x_sym.x_misc.x_lnsz.x_lnno
contains line number of '{' }. */
if (cs->c_naux != 1)
- complaint (_("`.bf' symbol %d has no aux entry"),
+ complaint (_ ("`.bf' symbol %d has no aux entry"),
cs->c_symnum);
fcn_first_line = main_aux.x_sym.x_misc.x_lnsz.x_lnno;
fcn_first_line_addr = cs->c_value;
@@ -1085,23 +1070,22 @@ coff_symtab_read (minimal_symbol_reader &reader,
depth = 0;
newobj = push_context (depth, fcn_start_addr);
fcn_cs_saved.c_name = getsymname (&fcn_sym_saved);
- newobj->name =
- process_coff_symbol (&fcn_cs_saved,
- &fcn_aux_saved, objfile);
+ newobj->name
+ = process_coff_symbol (&fcn_cs_saved, &fcn_aux_saved, objfile);
}
else if (strcmp (cs->c_name, ".ef") == 0)
{
if (!within_function)
- error (_("Bad coff function information."));
+ error (_ ("Bad coff function information."));
/* The value of .ef is the address of epilogue code;
not useful for gdb. */
/* { main_aux.x_sym.x_misc.x_lnsz.x_lnno
contains number of lines to '}' */
if (outermost_context_p ())
- { /* We attempted to pop an empty context stack. */
- complaint (_("`.ef' symbol without matching `.bf' "
- "symbol ignored starting at symnum %d"),
+ { /* We attempted to pop an empty context stack. */
+ complaint (_ ("`.ef' symbol without matching `.bf' "
+ "symbol ignored starting at symnum %d"),
cs->c_symnum);
within_function = 0;
break;
@@ -1111,15 +1095,15 @@ coff_symtab_read (minimal_symbol_reader &reader,
/* Stack must be empty now. */
if (!outermost_context_p () || newobj == NULL)
{
- complaint (_("Unmatched .ef symbol(s) ignored "
- "starting at symnum %d"),
+ complaint (_ ("Unmatched .ef symbol(s) ignored "
+ "starting at symnum %d"),
cs->c_symnum);
within_function = 0;
break;
}
if (cs->c_naux != 1)
{
- complaint (_("`.ef' symbol %d has no aux entry"),
+ complaint (_ ("`.ef' symbol %d has no aux entry"),
cs->c_symnum);
fcn_last_line = 0x7FFFFFFF;
}
@@ -1139,14 +1123,13 @@ coff_symtab_read (minimal_symbol_reader &reader,
gdbarch_addr_bits_remove (gdbarch,
fcn_first_line_addr));
else
- enter_linenos (fcn_line_ptr, fcn_first_line,
- fcn_last_line, objfile);
+ enter_linenos (fcn_line_ptr, fcn_first_line, fcn_last_line,
+ objfile);
- finish_block (cstk.name, cstk.old_blocks,
- NULL, cstk.start_addr,
+ finish_block (cstk.name, cstk.old_blocks, NULL, cstk.start_addr,
fcn_cs_saved.c_value
- + fcn_aux_saved.x_sym.x_misc.x_fsize
- + objfile->text_section_offset ());
+ + fcn_aux_saved.x_sym.x_misc.x_fsize
+ + objfile->text_section_offset ());
within_function = 0;
}
break;
@@ -1161,9 +1144,9 @@ coff_symtab_read (minimal_symbol_reader &reader,
else if (strcmp (cs->c_name, ".eb") == 0)
{
if (outermost_context_p ())
- { /* We attempted to pop an empty context stack. */
- complaint (_("`.eb' symbol without matching `.bb' "
- "symbol ignored starting at symnum %d"),
+ { /* We attempted to pop an empty context stack. */
+ complaint (_ ("`.eb' symbol without matching `.bb' "
+ "symbol ignored starting at symnum %d"),
cs->c_symnum);
break;
}
@@ -1171,8 +1154,8 @@ coff_symtab_read (minimal_symbol_reader &reader,
struct context_stack cstk = pop_context ();
if (depth-- != cstk.depth)
{
- complaint (_("Mismatched .eb symbol ignored "
- "starting at symnum %d"),
+ complaint (_ ("Mismatched .eb symbol ignored "
+ "starting at symnum %d"),
symnum);
break;
}
@@ -1180,8 +1163,8 @@ coff_symtab_read (minimal_symbol_reader &reader,
{
tmpaddr = cs->c_value + objfile->text_section_offset ();
/* Make a block for the local symbols within. */
- finish_block (0, cstk.old_blocks, NULL,
- cstk.start_addr, tmpaddr);
+ finish_block (0, cstk.old_blocks, NULL, cstk.start_addr,
+ tmpaddr);
}
/* Now pop locals of block just finished. */
*get_local_symbols () = cstk.locals;
@@ -1209,7 +1192,7 @@ coff_symtab_read (minimal_symbol_reader &reader,
coffread_objfile = NULL;
}
-
+
/* Routines for reading headers and symbols from executable. */
/* Read the next symbol, swap it, and return it in both
@@ -1218,8 +1201,7 @@ coff_symtab_read (minimal_symbol_reader &reader,
auxents. */
static void
-read_one_sym (struct coff_symbol *cs,
- struct internal_syment *sym,
+read_one_sym (struct coff_symbol *cs, struct internal_syment *sym,
union internal_auxent *aux)
{
int i;
@@ -1228,16 +1210,16 @@ read_one_sym (struct coff_symbol *cs,
cs->c_symnum = symnum;
bytes = bfd_bread (temp_sym, local_symesz, nlist_bfd_global);
if (bytes != local_symesz)
- error (_("%s: error reading symbols"), objfile_name (coffread_objfile));
+ error (_ ("%s: error reading symbols"), objfile_name (coffread_objfile));
bfd_coff_swap_sym_in (symfile_bfd, temp_sym, (char *) sym);
cs->c_naux = sym->n_numaux & 0xff;
if (cs->c_naux >= 1)
{
- bytes = bfd_bread (temp_aux, local_auxesz, nlist_bfd_global);
+ bytes = bfd_bread (temp_aux, local_auxesz, nlist_bfd_global);
if (bytes != local_auxesz)
- error (_("%s: error reading symbols"), objfile_name (coffread_objfile));
- bfd_coff_swap_aux_in (symfile_bfd, temp_aux,
- sym->n_type, sym->n_sclass,
+ error (_ ("%s: error reading symbols"),
+ objfile_name (coffread_objfile));
+ bfd_coff_swap_aux_in (symfile_bfd, temp_aux, sym->n_type, sym->n_sclass,
0, cs->c_naux, (char *) aux);
/* If more than one aux entry, read past it (only the first aux
is important). */
@@ -1245,7 +1227,7 @@ read_one_sym (struct coff_symbol *cs,
{
bytes = bfd_bread (temp_aux, local_auxesz, nlist_bfd_global);
if (bytes != local_auxesz)
- error (_("%s: error reading symbols"),
+ error (_ ("%s: error reading symbols"),
objfile_name (coffread_objfile));
}
}
@@ -1292,11 +1274,12 @@ read_one_sym (struct coff_symbol *cs,
}
}
}
-
+
/* Support for string table handling. */
static int
-init_stringtab (bfd *abfd, file_ptr offset, gdb::unique_xmalloc_ptr<char> *storage)
+init_stringtab (bfd *abfd, file_ptr offset,
+ gdb::unique_xmalloc_ptr<char> *storage)
{
long length;
int val;
@@ -1323,11 +1306,11 @@ init_stringtab (bfd *abfd, file_ptr offset, gdb::unique_xmalloc_ptr<char> *stora
/* This is in target format (probably not very useful, and not
currently used), not host format. */
memcpy (stringtab, lengthbuf, sizeof lengthbuf);
- if (length == sizeof length) /* Empty table -- just the count. */
+ if (length == sizeof length) /* Empty table -- just the count. */
return 0;
- val = bfd_bread (stringtab + sizeof lengthbuf,
- length - sizeof lengthbuf, abfd);
+ val = bfd_bread (stringtab + sizeof lengthbuf, length - sizeof lengthbuf,
+ abfd);
if (val != length - sizeof lengthbuf || stringtab[length - 1] != '\0')
return -1;
@@ -1368,7 +1351,7 @@ coff_getfilename (union internal_auxent *aux_entry)
if (aux_entry->x_file.x_n.x_n.x_zeroes == 0)
{
if (strlen (stringtab + aux_entry->x_file.x_n.x_n.x_offset) >= BUFSIZ)
- internal_error (_("coff file name too long"));
+ internal_error (_ ("coff file name too long"));
strcpy (buffer, stringtab + aux_entry->x_file.x_n.x_n.x_offset);
}
else
@@ -1384,7 +1367,7 @@ coff_getfilename (union internal_auxent *aux_entry)
result = lbasename (result);
return (result);
}
-
+
/* Support for line number handling. */
/* Read in all the line numbers for fast lookups later. Leave them in
@@ -1420,13 +1403,13 @@ init_lineno (bfd *abfd, file_ptr offset, file_ptr size,
return 0;
}
-#if !defined (L_LNNO32)
+#if !defined(L_LNNO32)
#define L_LNNO32(lp) ((lp)->l_lnno)
#endif
static void
-enter_linenos (file_ptr file_offset, int first_line,
- int last_line, struct objfile *objfile)
+enter_linenos (file_ptr file_offset, int first_line, int last_line,
+ struct objfile *objfile)
{
struct gdbarch *gdbarch = objfile->arch ();
char *rawptr;
@@ -1436,11 +1419,11 @@ enter_linenos (file_ptr file_offset, int first_line,
return;
if (file_offset < linetab_offset)
{
- complaint (_("Line number pointer %s lower than start of line numbers"),
+ complaint (_ ("Line number pointer %s lower than start of line numbers"),
plongest (file_offset));
- if (file_offset > linetab_size) /* Too big to be an offset? */
+ if (file_offset > linetab_size) /* Too big to be an offset? */
return;
- file_offset += linetab_offset; /* Try reading at that linetab
+ file_offset += linetab_offset; /* Try reading at that linetab
offset. */
}
@@ -1464,15 +1447,14 @@ enter_linenos (file_ptr file_offset, int first_line,
{
CORE_ADDR addr = lptr.l_addr.l_paddr;
addr += objfile->text_section_offset ();
- record_line (get_current_subfile (),
- first_line + L_LNNO32 (&lptr),
+ record_line (get_current_subfile (), first_line + L_LNNO32 (&lptr),
gdbarch_addr_bits_remove (gdbarch, addr));
}
else
break;
}
}
-
+
static void
patch_type (struct type *type, struct type *real_type)
{
@@ -1550,24 +1532,22 @@ patch_opaque_types (struct symtab *s)
}
}
}
-
+
static int
coff_reg_to_regnum (struct symbol *sym, struct gdbarch *gdbarch)
{
return gdbarch_sdb_reg_to_regnum (gdbarch, sym->value_longest ());
}
-static const struct symbol_register_ops coff_register_funcs = {
- coff_reg_to_regnum
-};
+static const struct symbol_register_ops coff_register_funcs
+ = { coff_reg_to_regnum };
/* The "aclass" index for computed COFF symbols. */
static int coff_register_index;
static struct symbol *
-process_coff_symbol (struct coff_symbol *cs,
- union internal_auxent *aux,
+process_coff_symbol (struct coff_symbol *cs, union internal_auxent *aux,
struct objfile *objfile)
{
struct symbol *sym = new (&objfile->objfile_obstack) symbol;
@@ -1586,11 +1566,10 @@ process_coff_symbol (struct coff_symbol *cs,
if (ISFCN (cs->c_type))
{
- sym->set_value_longest
- (sym->value_longest () + objfile->text_section_offset ());
- sym->set_type
- (lookup_function_type (decode_function_type (cs, cs->c_type,
- aux, objfile)));
+ sym->set_value_longest (sym->value_longest ()
+ + objfile->text_section_offset ());
+ sym->set_type (lookup_function_type (
+ decode_function_type (cs, cs->c_type, aux, objfile)));
sym->set_aclass_index (LOC_BLOCK);
if (cs->c_sclass == C_STAT || cs->c_sclass == C_THUMBSTAT
@@ -1617,8 +1596,9 @@ process_coff_symbol (struct coff_symbol *cs,
case C_THUMBEXTFUNC:
case C_EXT:
sym->set_aclass_index (LOC_STATIC);
- sym->set_value_address ((CORE_ADDR) cs->c_value
- + objfile->section_offsets[SECT_OFF_TEXT (objfile)]);
+ sym->set_value_address (
+ (CORE_ADDR) cs->c_value
+ + objfile->section_offsets[SECT_OFF_TEXT (objfile)]);
add_symbol_to_list (sym, get_global_symbols ());
break;
@@ -1626,8 +1606,9 @@ process_coff_symbol (struct coff_symbol *cs,
case C_THUMBSTATFUNC:
case C_STAT:
sym->set_aclass_index (LOC_STATIC);
- sym->set_value_address ((CORE_ADDR) cs->c_value
- + objfile->section_offsets[SECT_OFF_TEXT (objfile)]);
+ sym->set_value_address (
+ (CORE_ADDR) cs->c_value
+ + objfile->section_offsets[SECT_OFF_TEXT (objfile)]);
if (within_function)
{
/* Static symbol of local scope. */
@@ -1640,7 +1621,7 @@ process_coff_symbol (struct coff_symbol *cs,
}
break;
-#ifdef C_GLBLREG /* AMD coff */
+#ifdef C_GLBLREG /* AMD coff */
case C_GLBLREG:
#endif
case C_REG:
@@ -1708,8 +1689,7 @@ process_coff_symbol (struct coff_symbol *cs,
coff_lookup_type. */
if (sym->type ()->code () == TYPE_CODE_PTR
&& sym->type ()->target_type ()->length () == 0
- && sym->type ()->target_type ()->code ()
- != TYPE_CODE_UNDEF)
+ && sym->type ()->target_type ()->code () != TYPE_CODE_UNDEF)
{
int i = hashname (sym->linkage_name ());
@@ -1729,8 +1709,7 @@ process_coff_symbol (struct coff_symbol *cs,
names for anonymous enums, structures, and unions, like
"~0fake" or ".0fake". Thanks, but no thanks... */
if (sym->type ()->name () == 0)
- if (sym->linkage_name () != NULL
- && *sym->linkage_name () != '~'
+ if (sym->linkage_name () != NULL && *sym->linkage_name () != '~'
&& *sym->linkage_name () != '.')
sym->type ()->set_name (xstrdup (sym->linkage_name ()));
@@ -1743,7 +1722,7 @@ process_coff_symbol (struct coff_symbol *cs,
}
return sym;
}
-
+
/* Decode a coff type specifier; return the type that is meant. */
static struct type *
@@ -1787,10 +1766,8 @@ decode_type (struct coff_symbol *cs, unsigned int c_type,
base_type = decode_type (cs, new_c_type, aux, objfile);
index_type = objfile_type (objfile)->builtin_int;
- range_type
- = create_static_range_type (NULL, index_type, 0, n - 1);
- type =
- create_array_type (NULL, base_type, range_type);
+ range_type = create_static_range_type (NULL, index_type, 0, n - 1);
+ type = create_array_type (NULL, base_type, range_type);
}
return type;
}
@@ -1803,17 +1780,15 @@ decode_type (struct coff_symbol *cs, unsigned int c_type,
structs, and generates negative x_tagndx fields. */
if (cs->c_naux > 0 && aux->x_sym.x_tagndx.l != 0)
{
- if (cs->c_sclass != C_STRTAG
- && cs->c_sclass != C_UNTAG
- && cs->c_sclass != C_ENTAG
- && aux->x_sym.x_tagndx.l >= 0)
+ if (cs->c_sclass != C_STRTAG && cs->c_sclass != C_UNTAG
+ && cs->c_sclass != C_ENTAG && aux->x_sym.x_tagndx.l >= 0)
{
type = coff_alloc_type (aux->x_sym.x_tagndx.l);
return type;
}
else
{
- complaint (_("Symbol table entry for %s has bad tagndx value"),
+ complaint (_ ("Symbol table entry for %s has bad tagndx value"),
cs->c_name);
/* And fall through to decode_base_type... */
}
@@ -1826,25 +1801,21 @@ decode_type (struct coff_symbol *cs, unsigned int c_type,
return the type that the function returns. */
static struct type *
-decode_function_type (struct coff_symbol *cs,
- unsigned int c_type,
- union internal_auxent *aux,
- struct objfile *objfile)
+decode_function_type (struct coff_symbol *cs, unsigned int c_type,
+ union internal_auxent *aux, struct objfile *objfile)
{
if (aux->x_sym.x_tagndx.l == 0)
- cs->c_naux = 0; /* auxent refers to function, not base
+ cs->c_naux = 0; /* auxent refers to function, not base
type. */
return decode_type (cs, DECREF (c_type), aux, objfile);
}
-
+
/* Basic C types. */
static struct type *
-decode_base_type (struct coff_symbol *cs,
- unsigned int c_type,
- union internal_auxent *aux,
- struct objfile *objfile)
+decode_base_type (struct coff_symbol *cs, unsigned int c_type,
+ union internal_auxent *aux, struct objfile *objfile)
{
struct gdbarch *gdbarch = objfile->arch ();
struct type *type;
@@ -1872,8 +1843,7 @@ decode_base_type (struct coff_symbol *cs,
case T_LONG:
if (cs->c_sclass == C_FIELD
- && aux->x_sym.x_misc.x_lnsz.x_size
- > gdbarch_long_bit (gdbarch))
+ && aux->x_sym.x_misc.x_lnsz.x_size > gdbarch_long_bit (gdbarch))
return objfile_type (objfile)->builtin_long_long;
else
return objfile_type (objfile)->builtin_long;
@@ -1964,16 +1934,15 @@ decode_base_type (struct coff_symbol *cs,
case T_ULONG:
if (cs->c_sclass == C_FIELD
- && aux->x_sym.x_misc.x_lnsz.x_size
- > gdbarch_long_bit (gdbarch))
+ && aux->x_sym.x_misc.x_lnsz.x_size > gdbarch_long_bit (gdbarch))
return objfile_type (objfile)->builtin_unsigned_long_long;
else
return objfile_type (objfile)->builtin_unsigned_long;
}
- complaint (_("Unexpected type for symbol %s"), cs->c_name);
+ complaint (_ ("Unexpected type for symbol %s"), cs->c_name);
return objfile_type (objfile)->builtin_void;
}
-
+
/* This page contains subroutines of read_type. */
/* Read the description of a structure (or union type) and return an
@@ -1984,10 +1953,10 @@ coff_read_struct_type (int index, int length, int lastsym,
struct objfile *objfile)
{
struct nextfield
- {
- struct nextfield *next;
- struct field field;
- };
+ {
+ struct nextfield *next;
+ struct field field;
+ };
struct type *type;
struct nextfield *list = 0;
@@ -2057,8 +2026,8 @@ coff_read_struct_type (int index, int length, int lastsym,
/* Now create the vector of fields, and record how big it is. */
type->set_num_fields (nfields);
- type->set_fields
- ((struct field *) TYPE_ALLOC (type, sizeof (struct field) * nfields));
+ type->set_fields ((struct field *) TYPE_ALLOC (type, sizeof (struct field)
+ * nfields));
/* Copy the saved-up fields into the field vector. */
@@ -2067,7 +2036,7 @@ coff_read_struct_type (int index, int length, int lastsym,
return type;
}
-
+
/* Read a definition of an enumeration type,
and create and return a suitable type object.
Also defines the symbols that represent the values of the type. */
@@ -2137,8 +2106,8 @@ coff_read_enum_type (int index, int length, int lastsym,
type->set_length (gdbarch_int_bit (gdbarch) / TARGET_CHAR_BIT);
type->set_code (TYPE_CODE_ENUM);
type->set_num_fields (nsyms);
- type->set_fields
- ((struct field *) TYPE_ALLOC (type, sizeof (struct field) * nsyms));
+ type->set_fields ((struct field *) TYPE_ALLOC (type, sizeof (struct field)
+ * nsyms));
/* Find the symbols for the values and put them into the type.
The symbols can be found in the symlist that we put them on
@@ -2177,28 +2146,28 @@ coff_read_enum_type (int index, int length, int lastsym,
/* Register our ability to parse symbols for coff BFD files. */
-static const struct sym_fns coff_sym_fns =
-{
- coff_new_init, /* sym_new_init: init anything gbl to
+static const struct sym_fns coff_sym_fns = {
+ coff_new_init, /* sym_new_init: init anything gbl to
entire symtab */
- coff_symfile_init, /* sym_init: read initial info, setup
+ coff_symfile_init, /* sym_init: read initial info, setup
for sym_read() */
- coff_symfile_read, /* sym_read: read a symbol file into
+ coff_symfile_read, /* sym_read: read a symbol file into
symtab */
- coff_symfile_finish, /* sym_finish: finished with file,
+ coff_symfile_finish, /* sym_finish: finished with file,
cleanup */
- default_symfile_offsets, /* sym_offsets: xlate external to
+ default_symfile_offsets, /* sym_offsets: xlate external to
internal form */
- default_symfile_segments, /* sym_segments: Get segment
+ default_symfile_segments, /* sym_segments: Get segment
information from a file */
- NULL, /* sym_read_linetable */
+ NULL, /* sym_read_linetable */
- default_symfile_relocate, /* sym_relocate: Relocate a debug
+ default_symfile_relocate, /* sym_relocate: Relocate a debug
section. */
- NULL, /* sym_probe_fns */
+ NULL, /* sym_probe_fns */
};
void _initialize_coffread ();
+
void
_initialize_coffread ()
{
diff --git a/gdb/command.h b/gdb/command.h
index e9c9f160e1f..1188e364759 100644
--- a/gdb/command.h
+++ b/gdb/command.h
@@ -15,7 +15,7 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
-#if !defined (COMMAND_H)
+#if !defined(COMMAND_H)
#define COMMAND_H 1
#include "gdbsupport/gdb_vecs.h"
@@ -51,20 +51,20 @@ enum command_class
/* Classes of commands */
no_class = -1,
- class_run = 0, /* running */
- class_vars, /* data */
- class_stack, /* stack */
- class_files, /* files */
- class_support, /* support */
- class_info, /* status */
- class_breakpoint, /* breakpoints */
- class_trace, /* tracepoints */
- class_alias, /* aliases */
+ class_run = 0, /* running */
+ class_vars, /* data */
+ class_stack, /* stack */
+ class_files, /* files */
+ class_support, /* support */
+ class_info, /* status */
+ class_breakpoint, /* breakpoints */
+ class_trace, /* tracepoints */
+ class_alias, /* aliases */
class_bookmark,
class_obscure, /* obscure */
class_maintenance, /* internals */
- class_tui, /* text-user-interface */
- class_user, /* user-defined */
+ class_tui, /* text-user-interface */
+ class_user, /* user-defined */
/* Used for "show" commands that have no corresponding "set" command. */
no_set_class
@@ -72,47 +72,47 @@ enum command_class
/* Types of "set" or "show" command. */
enum var_types
- {
- /* "on" or "off". *VAR is a bool which is true for on,
+{
+ /* "on" or "off". *VAR is a bool which is true for on,
false for off. */
- var_boolean,
+ var_boolean,
- /* "on" / "true" / "enable" or "off" / "false" / "disable" or
+ /* "on" / "true" / "enable" or "off" / "false" / "disable" or
"auto. *VAR is an ``enum auto_boolean''. NOTE: In general a
custom show command will need to be implemented - one that for
"auto" prints both the "auto" and the current auto-selected
value. */
- var_auto_boolean,
+ var_auto_boolean,
- /* Unsigned Integer. *VAR is an unsigned int. In the Guile and Python
+ /* Unsigned Integer. *VAR is an unsigned int. In the Guile and Python
APIs 0 means unlimited, which is stored in *VAR as UINT_MAX. */
- var_uinteger,
+ var_uinteger,
- /* Like var_uinteger but signed. *VAR is an int. In the Guile and
+ /* Like var_uinteger but signed. *VAR is an int. In the Guile and
Python APIs 0 means unlimited, which is stored in *VAR as INT_MAX. */
- var_integer,
+ var_integer,
- /* Like var_integer but negative numbers are not allowed,
+ /* Like var_integer but negative numbers are not allowed,
except for special values. *VAR is an int. */
- var_pinteger,
+ var_pinteger,
- /* String which the user enters with escapes (e.g. the user types
+ /* String which the user enters with escapes (e.g. the user types
\n and it is a real newline in the stored string).
*VAR is a std::string, "" if the string is empty. */
- var_string,
- /* String which stores what the user types verbatim.
+ var_string,
+ /* String which stores what the user types verbatim.
*VAR is std::string, "" if the string is empty. */
- var_string_noescape,
- /* String which stores a filename. (*VAR) is a std::string,
+ var_string_noescape,
+ /* String which stores a filename. (*VAR) is a std::string,
"" if the string was empty. */
- var_optional_filename,
- /* String which stores a filename. (*VAR) is a std::string. */
- var_filename,
- /* Enumerated type. Can only have one of the specified values.
+ var_optional_filename,
+ /* String which stores a filename. (*VAR) is a std::string. */
+ var_filename,
+ /* Enumerated type. Can only have one of the specified values.
*VAR is a char pointer to the name of the element that we
find. */
- var_enum
- };
+ var_enum
+};
/* A structure describing an extra literal accepted and shown in place
of a number. */
@@ -141,7 +141,8 @@ bool var_type_uses (var_types var_type) = delete;
/* Return true if a setting of type T is backed by a bool variable. */
template<>
-inline bool var_type_uses<bool> (var_types t)
+inline bool
+var_type_uses<bool> (var_types t)
{
return t == var_boolean;
};
@@ -149,7 +150,8 @@ inline bool var_type_uses<bool> (var_types t)
/* Return true if a setting of type T is backed by a auto_boolean variable.
*/
template<>
-inline bool var_type_uses<enum auto_boolean> (var_types t)
+inline bool
+var_type_uses<enum auto_boolean> (var_types t)
{
return t == var_auto_boolean;
}
@@ -157,21 +159,24 @@ inline bool var_type_uses<enum auto_boolean> (var_types t)
/* Return true if a setting of type T is backed by an unsigned int variable.
*/
template<>
-inline bool var_type_uses<unsigned int> (var_types t)
+inline bool
+var_type_uses<unsigned int> (var_types t)
{
return t == var_uinteger;
}
/* Return true if a setting of type T is backed by an int variable. */
template<>
-inline bool var_type_uses<int> (var_types t)
+inline bool
+var_type_uses<int> (var_types t)
{
return t == var_integer || t == var_pinteger;
}
/* Return true if a setting of type T is backed by a std::string variable. */
template<>
-inline bool var_type_uses<std::string> (var_types t)
+inline bool
+var_type_uses<std::string> (var_types t)
{
return (t == var_string || t == var_string_noescape
|| t == var_optional_filename || t == var_filename);
@@ -180,12 +185,14 @@ inline bool var_type_uses<std::string> (var_types t)
/* Return true if a setting of type T is backed by a const char * variable.
*/
template<>
-inline bool var_type_uses<const char *> (var_types t)
+inline bool
+var_type_uses<const char *> (var_types t)
{
return t == var_enum;
}
-template<bool is_scalar, typename T> struct setting_func_types_1;
+template<bool is_scalar, typename T>
+struct setting_func_types_1;
template<typename T>
struct setting_func_types_1<true, T>
@@ -206,7 +213,8 @@ struct setting_func_types_1<false, T>
template<typename T>
struct setting_func_types
{
- using type = typename setting_func_types_1<std::is_scalar<T>::value, T>::type;
+ using type =
+ typename setting_func_types_1<std::is_scalar<T>::value, T>::type;
using set = typename setting_func_types_1<std::is_scalar<T>::value, T>::set;
using get = typename setting_func_types_1<std::is_scalar<T>::value, T>::get;
};
@@ -226,7 +234,9 @@ struct setting
template<typename T>
setting (var_types var_type, T *var,
const literal_def *extra_literals = nullptr)
- : m_var_type (var_type), m_var (var), m_extra_literals (extra_literals)
+ : m_var_type (var_type),
+ m_var (var),
+ m_extra_literals (extra_literals)
{
gdb_assert (var != nullptr);
gdb_assert (var_type_uses<T> (var_type));
@@ -244,25 +254,22 @@ struct setting
};
template<typename T>
- static erased_args erase_args (var_types var_type,
- T *var,
- typename setting_func_types<T>::set set_setting_func,
- typename setting_func_types<T>::get get_setting_func)
+ static erased_args
+ erase_args (var_types var_type, T *var,
+ typename setting_func_types<T>::set set_setting_func,
+ typename setting_func_types<T>::get get_setting_func)
{
gdb_assert (var_type_uses<T> (var_type));
- /* The getter and the setter must be both provided or both omitted. */
- gdb_assert
- ((set_setting_func == nullptr) == (get_setting_func == nullptr));
+ /* The getter and the setter must be both provided or both omitted. */
+ gdb_assert ((set_setting_func == nullptr)
+ == (get_setting_func == nullptr));
- /* The caller must provide a pointer to a variable or get/set functions, but
+ /* The caller must provide a pointer to a variable or get/set functions, but
not both. */
gdb_assert ((set_setting_func == nullptr) != (var == nullptr));
- return {
- var,
- reinterpret_cast<erased_func> (set_setting_func),
- reinterpret_cast<erased_func> (get_setting_func)
- };
+ return { var, reinterpret_cast<erased_func> (set_setting_func),
+ reinterpret_cast<erased_func> (get_setting_func) };
}
/* Create a setting backed by pre-validated type-erased args and using
@@ -282,8 +289,7 @@ struct setting
Type T must match the var type VAR_TYPE (see VAR_TYPE_USES). */
template<typename T>
- setting (var_types var_type,
- typename setting_func_types<T>::set setter,
+ setting (var_types var_type, typename setting_func_types<T>::set setter,
typename setting_func_types<T>::get getter)
: m_var_type (var_type)
{
@@ -300,12 +306,10 @@ struct setting
}
/* Access the type of the current setting. */
- var_types type () const
- { return m_var_type; }
+ var_types type () const { return m_var_type; }
/* Access any extra literals accepted. */
- const literal_def *extra_literals () const
- { return m_extra_literals; }
+ const literal_def *extra_literals () const { return m_extra_literals; }
/* Return the current value.
@@ -319,7 +323,8 @@ struct setting
if (m_var == nullptr)
{
gdb_assert (m_getter != nullptr);
- auto getter = reinterpret_cast<typename setting_func_types<T>::get> (m_getter);
+ auto getter
+ = reinterpret_cast<typename setting_func_types<T>::get> (m_getter);
return getter ();
}
else
@@ -349,7 +354,8 @@ struct setting
if (m_var == nullptr)
{
gdb_assert (m_setter != nullptr);
- auto setter = reinterpret_cast<typename setting_func_types<T>::set> (m_setter);
+ auto setter
+ = reinterpret_cast<typename setting_func_types<T>::set> (m_setter);
setter (v);
}
else
@@ -359,6 +365,7 @@ struct setting
}
private:
+
/* The type of the variable M_VAR is pointing to, or that M_GETTER / M_SETTER
get or set. */
var_types m_var_type;
@@ -435,66 +442,55 @@ extern struct cmd_list_element *add_cmd (const char *, enum command_class,
const char *,
struct cmd_list_element **);
-extern struct cmd_list_element *add_cmd_suppress_notification
- (const char *name, enum command_class theclass,
- cmd_simple_func_ftype *fun, const char *doc,
- struct cmd_list_element **list,
- bool *suppress_notification);
+extern struct cmd_list_element *
+add_cmd_suppress_notification (const char *name, enum command_class theclass,
+ cmd_simple_func_ftype *fun, const char *doc,
+ struct cmd_list_element **list,
+ bool *suppress_notification);
extern struct cmd_list_element *add_alias_cmd (const char *,
cmd_list_element *,
enum command_class, int,
struct cmd_list_element **);
-
-extern struct cmd_list_element *add_prefix_cmd (const char *, enum command_class,
- cmd_simple_func_ftype *fun,
- const char *,
- struct cmd_list_element **,
- int,
- struct cmd_list_element **);
+extern struct cmd_list_element *
+add_prefix_cmd (const char *, enum command_class, cmd_simple_func_ftype *fun,
+ const char *, struct cmd_list_element **, int,
+ struct cmd_list_element **);
/* Like add_prefix_cmd, but sets the callback to a function that
simply calls help_list. */
-extern struct cmd_list_element *add_basic_prefix_cmd
- (const char *, enum command_class, const char *, struct cmd_list_element **,
- int, struct cmd_list_element **);
+extern struct cmd_list_element *
+add_basic_prefix_cmd (const char *, enum command_class, const char *,
+ struct cmd_list_element **, int,
+ struct cmd_list_element **);
/* Like add_prefix_cmd, but useful for "show" prefixes. This sets the
callback to a function that simply calls cmd_show_list. */
-extern struct cmd_list_element *add_show_prefix_cmd
- (const char *, enum command_class, const char *, struct cmd_list_element **,
- int, struct cmd_list_element **);
+extern struct cmd_list_element *
+add_show_prefix_cmd (const char *, enum command_class, const char *,
+ struct cmd_list_element **, int,
+ struct cmd_list_element **);
/* Add matching set and show commands using add_basic_prefix_cmd and
add_show_prefix_cmd. */
-extern set_show_commands add_setshow_prefix_cmd
- (const char *name, command_class theclass, const char *set_doc,
- const char *show_doc,
- cmd_list_element **set_subcommands_list,
- cmd_list_element **show_subcommands_list,
- cmd_list_element **set_list,
- cmd_list_element **show_list);
-
-extern struct cmd_list_element *add_prefix_cmd_suppress_notification
- (const char *name, enum command_class theclass,
- cmd_simple_func_ftype *fun,
- const char *doc, struct cmd_list_element **subcommands,
- int allow_unknown,
- struct cmd_list_element **list,
- bool *suppress_notification);
-
-extern struct cmd_list_element *add_abbrev_prefix_cmd (const char *,
- enum command_class,
- cmd_simple_func_ftype *fun,
- const char *,
- struct cmd_list_element
- **, int,
- struct cmd_list_element
- **);
+extern set_show_commands add_setshow_prefix_cmd (
+ const char *name, command_class theclass, const char *set_doc,
+ const char *show_doc, cmd_list_element **set_subcommands_list,
+ cmd_list_element **show_subcommands_list, cmd_list_element **set_list,
+ cmd_list_element **show_list);
+
+extern struct cmd_list_element *add_prefix_cmd_suppress_notification (
+ const char *name, enum command_class theclass, cmd_simple_func_ftype *fun,
+ const char *doc, struct cmd_list_element **subcommands, int allow_unknown,
+ struct cmd_list_element **list, bool *suppress_notification);
+
+extern struct cmd_list_element *add_abbrev_prefix_cmd (
+ const char *, enum command_class, cmd_simple_func_ftype *fun, const char *,
+ struct cmd_list_element **, int, struct cmd_list_element **);
typedef void cmd_func_ftype (const char *args, int from_tty,
cmd_list_element *c);
@@ -509,25 +505,27 @@ typedef void cmd_func_ftype (const char *args, int from_tty,
we want to complete to "foobar". If WORD is "oo", return "oobar";
if WORD is "baz/foo", return "baz/foobar". */
typedef void completer_ftype (struct cmd_list_element *,
- completion_tracker &tracker,
- const char *text, const char *word);
+ completion_tracker &tracker, const char *text,
+ const char *word);
/* Same, but for set_cmd_completer_handle_brkchars. */
typedef void completer_handle_brkchars_ftype (struct cmd_list_element *,
completion_tracker &tracker,
- const char *text, const char *word);
+ const char *text,
+ const char *word);
extern void set_cmd_completer (struct cmd_list_element *, completer_ftype *);
/* Set the completer_handle_brkchars callback. */
-extern void set_cmd_completer_handle_brkchars (struct cmd_list_element *,
- completer_handle_brkchars_ftype *);
+extern void
+set_cmd_completer_handle_brkchars (struct cmd_list_element *,
+ completer_handle_brkchars_ftype *);
/* HACK: cagney/2002-02-23: Code, mostly in tracepoints.c, grubs
around in cmd objects to test the value of the commands sfunc(). */
extern int cmd_simple_func_eq (struct cmd_list_element *cmd,
- cmd_simple_func_ftype *cfun);
+ cmd_simple_func_ftype *cfun);
/* Execute CMD's pre/post hook. Throw an error if the command fails.
If already executing this pre/post hook, or there is no pre/post
@@ -540,9 +538,8 @@ extern void execute_cmd_post_hook (struct cmd_list_element *cmd);
extern struct cmd_list_element *lookup_cmd (const char **,
struct cmd_list_element *,
- const char *,
- std::string *,
- int, int);
+ const char *, std::string *, int,
+ int);
/* This routine takes a line of TEXT and a CLIST in which to start the
lookup. When it returns it will have incremented the text pointer past
@@ -587,10 +584,10 @@ extern struct cmd_list_element *lookup_cmd (const char **,
When LOOKUP_FOR_COMPLETION_P is true the completion is being requested
for the completion engine, no warnings should be printed. */
-extern struct cmd_list_element *lookup_cmd_1
- (const char **text, struct cmd_list_element *clist,
- struct cmd_list_element **result_list, std::string *default_args,
- int ignore_help_classes, bool lookup_for_completion_p = false);
+extern struct cmd_list_element *
+lookup_cmd_1 (const char **text, struct cmd_list_element *clist,
+ struct cmd_list_element **result_list, std::string *default_args,
+ int ignore_help_classes, bool lookup_for_completion_p = false);
/* Look up the command called NAME in the command list LIST.
@@ -606,13 +603,12 @@ extern struct cmd_list_element *lookup_cmd_1
If found, return the struct cmd_list_element for that command,
otherwise return NULLPTR. */
-extern struct cmd_list_element *lookup_cmd_exact
- (const char *name,
- struct cmd_list_element *list,
- bool ignore_help_classes = true);
+extern struct cmd_list_element *
+lookup_cmd_exact (const char *name, struct cmd_list_element *list,
+ bool ignore_help_classes = true);
extern struct cmd_list_element *deprecate_cmd (struct cmd_list_element *,
- const char * );
+ const char *);
extern void deprecated_cmd_warning (const char *, struct cmd_list_element *);
@@ -630,26 +626,24 @@ extern cmd_list_element *add_com_alias (const char *name,
command_class theclass,
int abbrev_flag);
-extern struct cmd_list_element *add_com_suppress_notification
- (const char *name, enum command_class theclass,
- cmd_simple_func_ftype *fun, const char *doc,
- bool *supress_notification);
+extern struct cmd_list_element *
+add_com_suppress_notification (const char *name, enum command_class theclass,
+ cmd_simple_func_ftype *fun, const char *doc,
+ bool *supress_notification);
-extern struct cmd_list_element *add_info (const char *,
- cmd_simple_func_ftype *fun,
- const char *);
+extern struct cmd_list_element *
+add_info (const char *, cmd_simple_func_ftype *fun, const char *);
-extern cmd_list_element *add_info_alias (const char *name,
- cmd_list_element *target,
- int abbrev_flag);
+extern cmd_list_element *
+add_info_alias (const char *name, cmd_list_element *target, int abbrev_flag);
extern void complete_on_cmdlist (struct cmd_list_element *,
- completion_tracker &tracker,
- const char *, const char *, int);
+ completion_tracker &tracker, const char *,
+ const char *, int);
extern void complete_on_enum (completion_tracker &tracker,
- const char *const *enumlist,
- const char *, const char *);
+ const char *const *enumlist, const char *,
+ const char *);
/* Functions that implement commands about CLI commands. */
@@ -659,8 +653,7 @@ extern void help_list (struct cmd_list_element *, const char *,
/* Method for show a set/show variable's VALUE on FILE. If this
method isn't supplied deprecated_show_value_hack() is called (which
is not good). */
-typedef void (show_value_ftype) (struct ui_file *file,
- int from_tty,
+typedef void (show_value_ftype) (struct ui_file *file, int from_tty,
struct cmd_list_element *cmd,
const char *value);
/* NOTE: i18n: This function is not i18n friendly. Callers should
@@ -672,207 +665,201 @@ extern const literal_def integer_unlimited_literals[];
extern const literal_def uinteger_unlimited_literals[];
extern const literal_def pinteger_unlimited_literals[];
-extern set_show_commands add_setshow_enum_cmd
- (const char *name, command_class theclass, const char *const *enumlist,
- const char **var, const char *set_doc, const char *show_doc,
- const char *help_doc, cmd_func_ftype *set_func,
- show_value_ftype *show_func, cmd_list_element **set_list,
- cmd_list_element **show_list);
-
-extern set_show_commands add_setshow_enum_cmd
- (const char *name, command_class theclass, const char *const *enumlist,
- const char *set_doc, const char *show_doc,
- const char *help_doc, setting_func_types<const char *>::set set_func,
- setting_func_types<const char *>::get get_func, show_value_ftype *show_func,
- cmd_list_element **set_list, cmd_list_element **show_list);
-
-extern set_show_commands add_setshow_auto_boolean_cmd
- (const char *name, command_class theclass, auto_boolean *var,
- const char *set_doc, const char *show_doc, const char *help_doc,
- cmd_func_ftype *set_func, show_value_ftype *show_func,
- cmd_list_element **set_list, cmd_list_element **show_list);
-
-extern set_show_commands add_setshow_auto_boolean_cmd
- (const char *name, command_class theclass, const char *set_doc,
- const char *show_doc, const char *help_doc,
- setting_func_types<enum auto_boolean>::set set_func,
- setting_func_types<enum auto_boolean>::get get_func,
- show_value_ftype *show_func, cmd_list_element **set_list,
- cmd_list_element **show_list);
-
-extern set_show_commands add_setshow_boolean_cmd
- (const char *name, command_class theclass, bool *var, const char *set_doc,
- const char *show_doc, const char *help_doc, cmd_func_ftype *set_func,
- show_value_ftype *show_func, cmd_list_element **set_list,
- cmd_list_element **show_list);
-
-extern set_show_commands add_setshow_boolean_cmd
- (const char *name, command_class theclass, const char *set_doc,
- const char *show_doc, const char *help_doc,
- setting_func_types<bool>::set set_func,
- setting_func_types<bool>::get get_func, show_value_ftype *show_func,
- cmd_list_element **set_list, cmd_list_element **show_list);
-
-extern set_show_commands add_setshow_filename_cmd
- (const char *name, command_class theclass, std::string *var, const char *set_doc,
- const char *show_doc, const char *help_doc, cmd_func_ftype *set_func,
- show_value_ftype *show_func, cmd_list_element **set_list,
- cmd_list_element **show_list);
-
-extern set_show_commands add_setshow_filename_cmd
- (const char *name, command_class theclass, const char *set_doc,
- const char *show_doc, const char *help_doc,
- setting_func_types<std::string>::set set_func,
- setting_func_types<std::string>::get get_func, show_value_ftype *show_func,
- cmd_list_element **set_list, cmd_list_element **show_list);
-
-extern set_show_commands add_setshow_string_cmd
- (const char *name, command_class theclass, std::string *var, const char *set_doc,
- const char *show_doc, const char *help_doc, cmd_func_ftype *set_func,
- show_value_ftype *show_func, cmd_list_element **set_list,
- cmd_list_element **show_list);
-
-extern set_show_commands add_setshow_string_cmd
- (const char *name, command_class theclass, const char *set_doc,
- const char *show_doc, const char *help_doc,
- setting_func_types<std::string>::set set_func,
- setting_func_types<std::string>::get get_func,
- show_value_ftype *show_func, cmd_list_element **set_list,
- cmd_list_element **show_list);
-
-extern set_show_commands add_setshow_string_noescape_cmd
- (const char *name, command_class theclass, std::string *var, const char *set_doc,
- const char *show_doc, const char *help_doc, cmd_func_ftype *set_func,
- show_value_ftype *show_func, cmd_list_element **set_list,
- cmd_list_element **show_list);
-
-extern set_show_commands add_setshow_string_noescape_cmd
- (const char *name, command_class theclass, const char *set_doc,
- const char *show_doc, const char *help_doc,
- setting_func_types<std::string>::set set_func,
- setting_func_types<std::string>::get get_func, show_value_ftype *show_func,
- cmd_list_element **set_list, cmd_list_element **show_list);
-
-extern set_show_commands add_setshow_optional_filename_cmd
- (const char *name, command_class theclass, std::string *var, const char *set_doc,
- const char *show_doc, const char *help_doc, cmd_func_ftype *set_func,
- show_value_ftype *show_func, cmd_list_element **set_list,
- cmd_list_element **show_list);
-
-extern set_show_commands add_setshow_optional_filename_cmd
- (const char *name, command_class theclass, const char *set_doc,
- const char *show_doc, const char *help_doc,
- setting_func_types<std::string>::set set_func,
- setting_func_types<std::string>::get get_func,
- show_value_ftype *show_func, cmd_list_element **set_list,
- cmd_list_element **show_list);
-
-extern set_show_commands add_setshow_integer_cmd
- (const char *name, command_class theclass, int *var,
- const literal_def *extra_literals, const char *set_doc,
- const char *show_doc, const char *help_doc, cmd_func_ftype *set_func,
- show_value_ftype *show_func, cmd_list_element **set_list,
- cmd_list_element **show_list);
-
-extern set_show_commands add_setshow_integer_cmd
- (const char *name, command_class theclass, const literal_def *extra_literals,
- const char *set_doc, const char *show_doc, const char *help_doc,
- setting_func_types<int>::set set_func,
- setting_func_types<int>::get get_func, show_value_ftype *show_func,
- cmd_list_element **set_list, cmd_list_element **show_list);
-
-extern set_show_commands add_setshow_integer_cmd
- (const char *name, command_class theclass, int *var, const char *set_doc,
- const char *show_doc, const char *help_doc, cmd_func_ftype *set_func,
- show_value_ftype *show_func, cmd_list_element **set_list,
- cmd_list_element **show_list);
-
-extern set_show_commands add_setshow_integer_cmd
- (const char *name, command_class theclass, const char *set_doc,
- const char *show_doc, const char *help_doc,
- setting_func_types<int>::set set_func,
- setting_func_types<int>::get get_func, show_value_ftype *show_func,
- cmd_list_element **set_list, cmd_list_element **show_list);
-
-extern set_show_commands add_setshow_pinteger_cmd
- (const char *name, command_class theclass, int *var,
- const literal_def *extra_literals, const char *set_doc,
- const char *show_doc, const char *help_doc, cmd_func_ftype *set_func,
- show_value_ftype *show_func, cmd_list_element **set_list,
- cmd_list_element **show_list);
-
-extern set_show_commands add_setshow_pinteger_cmd
- (const char *name, command_class theclass, const literal_def *extra_literals,
- const char *set_doc, const char *show_doc, const char *help_doc,
- setting_func_types<int>::set set_func,
- setting_func_types<int>::get get_func, show_value_ftype *show_func,
- cmd_list_element **set_list, cmd_list_element **show_list);
-
-extern set_show_commands add_setshow_uinteger_cmd
- (const char *name, command_class theclass, unsigned int *var,
- const literal_def *extra_literals,
- const char *set_doc, const char *show_doc, const char *help_doc,
- cmd_func_ftype *set_func, show_value_ftype *show_func,
- cmd_list_element **set_list, cmd_list_element **show_list);
-
-extern set_show_commands add_setshow_uinteger_cmd
- (const char *name, command_class theclass, const literal_def *extra_literals,
- const char *set_doc, const char *show_doc, const char *help_doc,
- setting_func_types<unsigned int>::set set_func,
- setting_func_types<unsigned int>::get get_func, show_value_ftype *show_func,
- cmd_list_element **set_list, cmd_list_element **show_list);
-
-extern set_show_commands add_setshow_uinteger_cmd
- (const char *name, command_class theclass, unsigned int *var,
- const char *set_doc, const char *show_doc, const char *help_doc,
- cmd_func_ftype *set_func, show_value_ftype *show_func,
- cmd_list_element **set_list, cmd_list_element **show_list);
-
-extern set_show_commands add_setshow_uinteger_cmd
- (const char *name, command_class theclass, const char *set_doc,
- const char *show_doc, const char *help_doc,
- setting_func_types<unsigned int>::set set_func,
- setting_func_types<unsigned int>::get get_func, show_value_ftype *show_func,
- cmd_list_element **set_list, cmd_list_element **show_list);
-
-extern set_show_commands add_setshow_zinteger_cmd
- (const char *name, command_class theclass, int *var, const char *set_doc,
- const char *show_doc, const char *help_doc, cmd_func_ftype *set_func,
- show_value_ftype *show_func, cmd_list_element **set_list,
- cmd_list_element **show_list);
-
-extern set_show_commands add_setshow_zinteger_cmd
- (const char *name, command_class theclass, const char *set_doc,
- const char *show_doc, const char *help_doc,
- setting_func_types<int>::set set_func,
- setting_func_types<int>::get get_func, show_value_ftype *show_func,
- cmd_list_element **set_list, cmd_list_element **show_list);
-
-extern set_show_commands add_setshow_zuinteger_cmd
- (const char *name, command_class theclass, unsigned int *var,
- const char *set_doc, const char *show_doc, const char *help_doc,
- cmd_func_ftype *set_func, show_value_ftype *show_func,
- cmd_list_element **set_list, cmd_list_element **show_list);
-
-extern set_show_commands add_setshow_zuinteger_cmd
- (const char *name, command_class theclass, const char *set_doc,
- const char *show_doc, const char *help_doc,
- setting_func_types<unsigned int>::set set_func,
- setting_func_types<unsigned int>::get get_func, show_value_ftype *show_func,
- cmd_list_element **set_list, cmd_list_element **show_list);
-
-extern set_show_commands add_setshow_zuinteger_unlimited_cmd
- (const char *name, command_class theclass, int *var, const char *set_doc,
- const char *show_doc, const char *help_doc, cmd_func_ftype *set_func,
- show_value_ftype *show_func, cmd_list_element **set_list,
- cmd_list_element **show_list);
-
-extern set_show_commands add_setshow_zuinteger_unlimited_cmd
- (const char *name, command_class theclass, const char *set_doc,
- const char *show_doc, const char *help_doc,
- setting_func_types<int>::set set_func, setting_func_types<int>::get get_func,
- show_value_ftype *show_func, cmd_list_element **set_list,
- cmd_list_element **show_list);
+extern set_show_commands add_setshow_enum_cmd (
+ const char *name, command_class theclass, const char *const *enumlist,
+ const char **var, const char *set_doc, const char *show_doc,
+ const char *help_doc, cmd_func_ftype *set_func, show_value_ftype *show_func,
+ cmd_list_element **set_list, cmd_list_element **show_list);
+
+extern set_show_commands add_setshow_enum_cmd (
+ const char *name, command_class theclass, const char *const *enumlist,
+ const char *set_doc, const char *show_doc, const char *help_doc,
+ setting_func_types<const char *>::set set_func,
+ setting_func_types<const char *>::get get_func, show_value_ftype *show_func,
+ cmd_list_element **set_list, cmd_list_element **show_list);
+
+extern set_show_commands add_setshow_auto_boolean_cmd (
+ const char *name, command_class theclass, auto_boolean *var,
+ const char *set_doc, const char *show_doc, const char *help_doc,
+ cmd_func_ftype *set_func, show_value_ftype *show_func,
+ cmd_list_element **set_list, cmd_list_element **show_list);
+
+extern set_show_commands add_setshow_auto_boolean_cmd (
+ const char *name, command_class theclass, const char *set_doc,
+ const char *show_doc, const char *help_doc,
+ setting_func_types<enum auto_boolean>::set set_func,
+ setting_func_types<enum auto_boolean>::get get_func,
+ show_value_ftype *show_func, cmd_list_element **set_list,
+ cmd_list_element **show_list);
+
+extern set_show_commands add_setshow_boolean_cmd (
+ const char *name, command_class theclass, bool *var, const char *set_doc,
+ const char *show_doc, const char *help_doc, cmd_func_ftype *set_func,
+ show_value_ftype *show_func, cmd_list_element **set_list,
+ cmd_list_element **show_list);
+
+extern set_show_commands add_setshow_boolean_cmd (
+ const char *name, command_class theclass, const char *set_doc,
+ const char *show_doc, const char *help_doc,
+ setting_func_types<bool>::set set_func,
+ setting_func_types<bool>::get get_func, show_value_ftype *show_func,
+ cmd_list_element **set_list, cmd_list_element **show_list);
+
+extern set_show_commands add_setshow_filename_cmd (
+ const char *name, command_class theclass, std::string *var,
+ const char *set_doc, const char *show_doc, const char *help_doc,
+ cmd_func_ftype *set_func, show_value_ftype *show_func,
+ cmd_list_element **set_list, cmd_list_element **show_list);
+
+extern set_show_commands add_setshow_filename_cmd (
+ const char *name, command_class theclass, const char *set_doc,
+ const char *show_doc, const char *help_doc,
+ setting_func_types<std::string>::set set_func,
+ setting_func_types<std::string>::get get_func, show_value_ftype *show_func,
+ cmd_list_element **set_list, cmd_list_element **show_list);
+
+extern set_show_commands add_setshow_string_cmd (
+ const char *name, command_class theclass, std::string *var,
+ const char *set_doc, const char *show_doc, const char *help_doc,
+ cmd_func_ftype *set_func, show_value_ftype *show_func,
+ cmd_list_element **set_list, cmd_list_element **show_list);
+
+extern set_show_commands add_setshow_string_cmd (
+ const char *name, command_class theclass, const char *set_doc,
+ const char *show_doc, const char *help_doc,
+ setting_func_types<std::string>::set set_func,
+ setting_func_types<std::string>::get get_func, show_value_ftype *show_func,
+ cmd_list_element **set_list, cmd_list_element **show_list);
+
+extern set_show_commands add_setshow_string_noescape_cmd (
+ const char *name, command_class theclass, std::string *var,
+ const char *set_doc, const char *show_doc, const char *help_doc,
+ cmd_func_ftype *set_func, show_value_ftype *show_func,
+ cmd_list_element **set_list, cmd_list_element **show_list);
+
+extern set_show_commands add_setshow_string_noescape_cmd (
+ const char *name, command_class theclass, const char *set_doc,
+ const char *show_doc, const char *help_doc,
+ setting_func_types<std::string>::set set_func,
+ setting_func_types<std::string>::get get_func, show_value_ftype *show_func,
+ cmd_list_element **set_list, cmd_list_element **show_list);
+
+extern set_show_commands add_setshow_optional_filename_cmd (
+ const char *name, command_class theclass, std::string *var,
+ const char *set_doc, const char *show_doc, const char *help_doc,
+ cmd_func_ftype *set_func, show_value_ftype *show_func,
+ cmd_list_element **set_list, cmd_list_element **show_list);
+
+extern set_show_commands add_setshow_optional_filename_cmd (
+ const char *name, command_class theclass, const char *set_doc,
+ const char *show_doc, const char *help_doc,
+ setting_func_types<std::string>::set set_func,
+ setting_func_types<std::string>::get get_func, show_value_ftype *show_func,
+ cmd_list_element **set_list, cmd_list_element **show_list);
+
+extern set_show_commands add_setshow_integer_cmd (
+ const char *name, command_class theclass, int *var,
+ const literal_def *extra_literals, const char *set_doc, const char *show_doc,
+ const char *help_doc, cmd_func_ftype *set_func, show_value_ftype *show_func,
+ cmd_list_element **set_list, cmd_list_element **show_list);
+
+extern set_show_commands add_setshow_integer_cmd (
+ const char *name, command_class theclass, const literal_def *extra_literals,
+ const char *set_doc, const char *show_doc, const char *help_doc,
+ setting_func_types<int>::set set_func, setting_func_types<int>::get get_func,
+ show_value_ftype *show_func, cmd_list_element **set_list,
+ cmd_list_element **show_list);
+
+extern set_show_commands add_setshow_integer_cmd (
+ const char *name, command_class theclass, int *var, const char *set_doc,
+ const char *show_doc, const char *help_doc, cmd_func_ftype *set_func,
+ show_value_ftype *show_func, cmd_list_element **set_list,
+ cmd_list_element **show_list);
+
+extern set_show_commands add_setshow_integer_cmd (
+ const char *name, command_class theclass, const char *set_doc,
+ const char *show_doc, const char *help_doc,
+ setting_func_types<int>::set set_func, setting_func_types<int>::get get_func,
+ show_value_ftype *show_func, cmd_list_element **set_list,
+ cmd_list_element **show_list);
+
+extern set_show_commands add_setshow_pinteger_cmd (
+ const char *name, command_class theclass, int *var,
+ const literal_def *extra_literals, const char *set_doc, const char *show_doc,
+ const char *help_doc, cmd_func_ftype *set_func, show_value_ftype *show_func,
+ cmd_list_element **set_list, cmd_list_element **show_list);
+
+extern set_show_commands add_setshow_pinteger_cmd (
+ const char *name, command_class theclass, const literal_def *extra_literals,
+ const char *set_doc, const char *show_doc, const char *help_doc,
+ setting_func_types<int>::set set_func, setting_func_types<int>::get get_func,
+ show_value_ftype *show_func, cmd_list_element **set_list,
+ cmd_list_element **show_list);
+
+extern set_show_commands add_setshow_uinteger_cmd (
+ const char *name, command_class theclass, unsigned int *var,
+ const literal_def *extra_literals, const char *set_doc, const char *show_doc,
+ const char *help_doc, cmd_func_ftype *set_func, show_value_ftype *show_func,
+ cmd_list_element **set_list, cmd_list_element **show_list);
+
+extern set_show_commands add_setshow_uinteger_cmd (
+ const char *name, command_class theclass, const literal_def *extra_literals,
+ const char *set_doc, const char *show_doc, const char *help_doc,
+ setting_func_types<unsigned int>::set set_func,
+ setting_func_types<unsigned int>::get get_func, show_value_ftype *show_func,
+ cmd_list_element **set_list, cmd_list_element **show_list);
+
+extern set_show_commands add_setshow_uinteger_cmd (
+ const char *name, command_class theclass, unsigned int *var,
+ const char *set_doc, const char *show_doc, const char *help_doc,
+ cmd_func_ftype *set_func, show_value_ftype *show_func,
+ cmd_list_element **set_list, cmd_list_element **show_list);
+
+extern set_show_commands add_setshow_uinteger_cmd (
+ const char *name, command_class theclass, const char *set_doc,
+ const char *show_doc, const char *help_doc,
+ setting_func_types<unsigned int>::set set_func,
+ setting_func_types<unsigned int>::get get_func, show_value_ftype *show_func,
+ cmd_list_element **set_list, cmd_list_element **show_list);
+
+extern set_show_commands add_setshow_zinteger_cmd (
+ const char *name, command_class theclass, int *var, const char *set_doc,
+ const char *show_doc, const char *help_doc, cmd_func_ftype *set_func,
+ show_value_ftype *show_func, cmd_list_element **set_list,
+ cmd_list_element **show_list);
+
+extern set_show_commands add_setshow_zinteger_cmd (
+ const char *name, command_class theclass, const char *set_doc,
+ const char *show_doc, const char *help_doc,
+ setting_func_types<int>::set set_func, setting_func_types<int>::get get_func,
+ show_value_ftype *show_func, cmd_list_element **set_list,
+ cmd_list_element **show_list);
+
+extern set_show_commands add_setshow_zuinteger_cmd (
+ const char *name, command_class theclass, unsigned int *var,
+ const char *set_doc, const char *show_doc, const char *help_doc,
+ cmd_func_ftype *set_func, show_value_ftype *show_func,
+ cmd_list_element **set_list, cmd_list_element **show_list);
+
+extern set_show_commands add_setshow_zuinteger_cmd (
+ const char *name, command_class theclass, const char *set_doc,
+ const char *show_doc, const char *help_doc,
+ setting_func_types<unsigned int>::set set_func,
+ setting_func_types<unsigned int>::get get_func, show_value_ftype *show_func,
+ cmd_list_element **set_list, cmd_list_element **show_list);
+
+extern set_show_commands add_setshow_zuinteger_unlimited_cmd (
+ const char *name, command_class theclass, int *var, const char *set_doc,
+ const char *show_doc, const char *help_doc, cmd_func_ftype *set_func,
+ show_value_ftype *show_func, cmd_list_element **set_list,
+ cmd_list_element **show_list);
+
+extern set_show_commands add_setshow_zuinteger_unlimited_cmd (
+ const char *name, command_class theclass, const char *set_doc,
+ const char *show_doc, const char *help_doc,
+ setting_func_types<int>::set set_func, setting_func_types<int>::get get_func,
+ show_value_ftype *show_func, cmd_list_element **set_list,
+ cmd_list_element **show_list);
/* Do a "show" command for each thing on a command list. */
@@ -883,7 +870,6 @@ extern void cmd_show_list (struct cmd_list_element *, int);
extern void error_no_arg (const char *) ATTRIBUTE_NORETURN;
-
/* Command line saving and repetition.
Each input line executed is saved to possibly be repeated either
when the user types an empty line, or be repeated by a command
@@ -936,7 +922,7 @@ extern void save_command_line (const char *cmd);
extern void not_just_help_class_command (const char *, int);
/* Call the command function. */
-extern void cmd_func (struct cmd_list_element *cmd,
- const char *args, int from_tty);
+extern void cmd_func (struct cmd_list_element *cmd, const char *args,
+ int from_tty);
#endif /* !defined (COMMAND_H) */
diff --git a/gdb/compile/compile-c-support.c b/gdb/compile/compile-c-support.c
index f9b32205b7a..9cd0428deaa 100644
--- a/gdb/compile/compile-c-support.c
+++ b/gdb/compile/compile-c-support.c
@@ -53,7 +53,7 @@ c_get_mode_for_size (int size)
mode = "DI";
break;
default:
- internal_error (_("Invalid GCC mode size %d."), size);
+ internal_error (_ ("Invalid GCC mode size %d."), size);
}
return mode;
@@ -67,12 +67,10 @@ c_get_range_decl_name (const struct dynamic_prop *prop)
return string_printf ("__gdb_prop_%s", host_address_to_string (prop));
}
-
-
/* Load the plug-in library FE_LIBCC and return the initialization function
FE_CONTEXT. */
-template <typename FUNCTYPE>
+template<typename FUNCTYPE>
FUNCTYPE *
load_libcompile (const char *fe_libcc, const char *fe_context)
{
@@ -84,7 +82,7 @@ load_libcompile (const char *fe_libcc, const char *fe_context)
func = (FUNCTYPE *) gdb_dlsym (handle, fe_context);
if (func == NULL)
- error (_("could not find symbol %s in library %s"), fe_context, fe_libcc);
+ error (_ ("could not find symbol %s in library %s"), fe_context, fe_libcc);
/* Leave the library open. */
handle.release ();
@@ -97,8 +95,8 @@ load_libcompile (const char *fe_libcc, const char *fe_context)
base compile plug-in version we support. API_VERSION is the
API version supported. */
-template <typename INSTTYPE, typename FUNCTYPE, typename CTXTYPE,
- typename BASE_VERSION_TYPE, typename API_VERSION_TYPE>
+template<typename INSTTYPE, typename FUNCTYPE, typename CTXTYPE,
+ typename BASE_VERSION_TYPE, typename API_VERSION_TYPE>
std::unique_ptr<compile_instance>
get_compile_context (const char *fe_libcc, const char *fe_context,
BASE_VERSION_TYPE base_version,
@@ -115,8 +113,9 @@ get_compile_context (const char *fe_libcc, const char *fe_context,
context = (*func) (base_version, api_version);
if (context == NULL)
- error (_("The loaded version of GCC does not support the required version "
- "of the API."));
+ error (
+ _ ("The loaded version of GCC does not support the required version "
+ "of the API."));
return std::unique_ptr<compile_instance> (new INSTTYPE (context));
}
@@ -126,11 +125,12 @@ get_compile_context (const char *fe_libcc, const char *fe_context,
std::unique_ptr<compile_instance>
c_get_compile_context ()
{
- return get_compile_context
- <compile_c_instance, gcc_c_fe_context_function, gcc_c_context,
- gcc_base_api_version, gcc_c_api_version>
- (STRINGIFY (GCC_C_FE_LIBCC), STRINGIFY (GCC_C_FE_CONTEXT),
- GCC_FE_VERSION_0, GCC_C_FE_VERSION_0);
+ return get_compile_context<compile_c_instance, gcc_c_fe_context_function,
+ gcc_c_context, gcc_base_api_version,
+ gcc_c_api_version> (STRINGIFY (GCC_C_FE_LIBCC),
+ STRINGIFY (GCC_C_FE_CONTEXT),
+ GCC_FE_VERSION_0,
+ GCC_C_FE_VERSION_0);
}
/* A C++-language implementation of get_compile_context. */
@@ -138,21 +138,18 @@ c_get_compile_context ()
std::unique_ptr<compile_instance>
cplus_get_compile_context ()
{
- return get_compile_context
- <compile_cplus_instance, gcc_cp_fe_context_function, gcc_cp_context,
- gcc_base_api_version, gcc_cp_api_version>
- (STRINGIFY (GCC_CP_FE_LIBCC), STRINGIFY (GCC_CP_FE_CONTEXT),
- GCC_FE_VERSION_0, GCC_CP_FE_VERSION_0);
+ return get_compile_context<compile_cplus_instance,
+ gcc_cp_fe_context_function, gcc_cp_context,
+ gcc_base_api_version, gcc_cp_api_version> (
+ STRINGIFY (GCC_CP_FE_LIBCC), STRINGIFY (GCC_CP_FE_CONTEXT),
+ GCC_FE_VERSION_0, GCC_CP_FE_VERSION_0);
}
-
-
/* Write one macro definition. */
static void
print_one_macro (const char *name, const struct macro_definition *macro,
- struct macro_source_file *source, int line,
- ui_file *file)
+ struct macro_source_file *source, int line, ui_file *file)
{
/* Don't print command-line defines. They will be supplied another
way. */
@@ -200,11 +197,9 @@ write_macro_definitions (const struct block *block, CORE_ADDR pc,
macro_for_each_in_scope (scope->file, scope->line,
[&] (const char *name,
const macro_definition *macro,
- macro_source_file *source,
- int line)
- {
- print_one_macro (name, macro, source, line, file);
- });
+ macro_source_file *source, int line) {
+ print_one_macro (name, macro, source, line, file);
+ });
}
}
@@ -218,8 +213,7 @@ generate_register_struct (struct ui_file *stream, struct gdbarch *gdbarch,
int i;
int seen = 0;
- gdb_puts ("struct " COMPILE_I_SIMPLE_REGISTER_STRUCT_TAG " {\n",
- stream);
+ gdb_puts ("struct " COMPILE_I_SIMPLE_REGISTER_STRUCT_TAG " {\n", stream);
if (!registers_used.empty ())
for (i = 0; i < gdbarch_num_regs (gdbarch); ++i)
@@ -245,14 +239,12 @@ generate_register_struct (struct ui_file *stream, struct gdbarch *gdbarch,
switch (regtype->code ())
{
case TYPE_CODE_PTR:
- gdb_printf (stream, "__gdb_uintptr %s",
- regname.c_str ());
+ gdb_printf (stream, "__gdb_uintptr %s", regname.c_str ());
break;
case TYPE_CODE_INT:
{
- const char *mode
- = c_get_mode_for_size (regtype->length ());
+ const char *mode = c_get_mode_for_size (regtype->length ());
if (mode != NULL)
{
@@ -261,8 +253,7 @@ generate_register_struct (struct ui_file *stream, struct gdbarch *gdbarch,
gdb_printf (stream,
"int %s"
" __attribute__ ((__mode__(__%s__)))",
- regname.c_str (),
- mode);
+ regname.c_str (), mode);
break;
}
}
@@ -274,16 +265,14 @@ generate_register_struct (struct ui_file *stream, struct gdbarch *gdbarch,
" unsigned char %s[%s]"
" __attribute__((__aligned__("
"__BIGGEST_ALIGNMENT__)))",
- regname.c_str (),
- pulongest (regtype->length ()));
+ regname.c_str (), pulongest (regtype->length ()));
}
gdb_puts (";\n", stream);
}
}
if (!seen)
- gdb_puts (" char " COMPILE_I_SIMPLE_REGISTER_DUMMY ";\n",
- stream);
+ gdb_puts (" char " COMPILE_I_SIMPLE_REGISTER_DUMMY ";\n", stream);
gdb_puts ("};\n\n", stream);
}
@@ -304,8 +293,7 @@ struct c_push_user_expression
struct pop_user_expression_nop
{
void pop_user_expression (struct ui_file *buf)
- {
- /* Nothing to do. */
+ { /* Nothing to do. */
}
};
@@ -320,13 +308,9 @@ struct c_add_code_header
switch (type)
{
case COMPILE_I_SIMPLE_SCOPE:
- gdb_puts ("void "
- GCC_FE_WRAPPER_FUNCTION
- " (struct "
- COMPILE_I_SIMPLE_REGISTER_STRUCT_TAG
- " *"
- COMPILE_I_SIMPLE_REGISTER_ARG_NAME
- ") {\n",
+ gdb_puts ("void " GCC_FE_WRAPPER_FUNCTION
+ " (struct " COMPILE_I_SIMPLE_REGISTER_STRUCT_TAG
+ " *" COMPILE_I_SIMPLE_REGISTER_ARG_NAME ") {\n",
buf);
break;
@@ -334,16 +318,10 @@ struct c_add_code_header
case COMPILE_I_PRINT_VALUE_SCOPE:
/* <string.h> is needed for a memcpy call below. */
gdb_puts ("#include <string.h>\n"
- "void "
- GCC_FE_WRAPPER_FUNCTION
- " (struct "
- COMPILE_I_SIMPLE_REGISTER_STRUCT_TAG
- " *"
- COMPILE_I_SIMPLE_REGISTER_ARG_NAME
- ", "
- COMPILE_I_PRINT_OUT_ARG_TYPE
- " "
- COMPILE_I_PRINT_OUT_ARG
+ "void " GCC_FE_WRAPPER_FUNCTION
+ " (struct " COMPILE_I_SIMPLE_REGISTER_STRUCT_TAG
+ " *" COMPILE_I_SIMPLE_REGISTER_ARG_NAME
+ ", " COMPILE_I_PRINT_OUT_ARG_TYPE " " COMPILE_I_PRINT_OUT_ARG
") {\n",
buf);
break;
@@ -396,12 +374,11 @@ struct c_add_input
gdb_printf (buf,
"__auto_type " COMPILE_I_EXPR_VAL " = %s;\n"
"typeof (%s) *" COMPILE_I_EXPR_PTR_TYPE ";\n"
- "memcpy (" COMPILE_I_PRINT_OUT_ARG ", %s"
- COMPILE_I_EXPR_VAL ",\n"
- "sizeof (*" COMPILE_I_EXPR_PTR_TYPE "));\n"
- , input, input,
- (type == COMPILE_I_PRINT_ADDRESS_SCOPE
- ? "&" : ""));
+ "memcpy (" COMPILE_I_PRINT_OUT_ARG
+ ", %s" COMPILE_I_EXPR_VAL ",\n"
+ "sizeof (*" COMPILE_I_EXPR_PTR_TYPE "));\n",
+ input, input,
+ (type == COMPILE_I_PRINT_ADDRESS_SCOPE ? "&" : ""));
break;
default:
@@ -441,44 +418,33 @@ struct cplus_add_code_header
{
void add_code_header (enum compile_i_scope_types type, struct ui_file *buf)
{
- switch (type)
- {
- case COMPILE_I_SIMPLE_SCOPE:
- gdb_puts ("void "
- GCC_FE_WRAPPER_FUNCTION
- " (struct "
- COMPILE_I_SIMPLE_REGISTER_STRUCT_TAG
- " *"
- COMPILE_I_SIMPLE_REGISTER_ARG_NAME
- ") {\n",
- buf);
- break;
+ switch (type)
+ {
+ case COMPILE_I_SIMPLE_SCOPE:
+ gdb_puts ("void " GCC_FE_WRAPPER_FUNCTION
+ " (struct " COMPILE_I_SIMPLE_REGISTER_STRUCT_TAG
+ " *" COMPILE_I_SIMPLE_REGISTER_ARG_NAME ") {\n",
+ buf);
+ break;
- case COMPILE_I_PRINT_ADDRESS_SCOPE:
- case COMPILE_I_PRINT_VALUE_SCOPE:
- gdb_puts (
- "#include <cstring>\n"
- "#include <bits/move.h>\n"
- "void "
- GCC_FE_WRAPPER_FUNCTION
- " (struct "
- COMPILE_I_SIMPLE_REGISTER_STRUCT_TAG
- " *"
- COMPILE_I_SIMPLE_REGISTER_ARG_NAME
- ", "
- COMPILE_I_PRINT_OUT_ARG_TYPE
- " "
- COMPILE_I_PRINT_OUT_ARG
- ") {\n",
- buf);
- break;
+ case COMPILE_I_PRINT_ADDRESS_SCOPE:
+ case COMPILE_I_PRINT_VALUE_SCOPE:
+ gdb_puts ("#include <cstring>\n"
+ "#include <bits/move.h>\n"
+ "void " GCC_FE_WRAPPER_FUNCTION
+ " (struct " COMPILE_I_SIMPLE_REGISTER_STRUCT_TAG
+ " *" COMPILE_I_SIMPLE_REGISTER_ARG_NAME
+ ", " COMPILE_I_PRINT_OUT_ARG_TYPE " " COMPILE_I_PRINT_OUT_ARG
+ ") {\n",
+ buf);
+ break;
- case COMPILE_I_RAW_SCOPE:
- break;
+ case COMPILE_I_RAW_SCOPE:
+ break;
- default:
- gdb_assert_not_reached ("Unknown compiler scope reached.");
- }
+ default:
+ gdb_assert_not_reached ("Unknown compiler scope reached.");
+ }
}
};
@@ -494,21 +460,21 @@ struct cplus_add_input
{
case COMPILE_I_PRINT_VALUE_SCOPE:
case COMPILE_I_PRINT_ADDRESS_SCOPE:
- gdb_printf
- (buf,
- /* "auto" strips ref- and cv- qualifiers, so we need to also strip
+ gdb_printf (
+ buf,
+ /* "auto" strips ref- and cv- qualifiers, so we need to also strip
those from COMPILE_I_EXPR_PTR_TYPE. */
- "auto " COMPILE_I_EXPR_VAL " = %s;\n"
- "typedef "
- "std::add_pointer<std::remove_cv<decltype (%s)>::type>::type "
- " __gdb_expr_ptr;\n"
- "__gdb_expr_ptr " COMPILE_I_EXPR_PTR_TYPE ";\n"
- "std::memcpy (" COMPILE_I_PRINT_OUT_ARG ", %s ("
- COMPILE_I_EXPR_VAL "),\n"
- "\tsizeof (*" COMPILE_I_EXPR_PTR_TYPE "));\n"
- ,input, input,
- (type == COMPILE_I_PRINT_ADDRESS_SCOPE
- ? "__builtin_addressof" : ""));
+ "auto " COMPILE_I_EXPR_VAL " = %s;\n"
+ "typedef "
+ "std::add_pointer<std::remove_cv<decltype (%s)>::type>::type "
+ " __gdb_expr_ptr;\n"
+ "__gdb_expr_ptr " COMPILE_I_EXPR_PTR_TYPE ";\n"
+ "std::memcpy (" COMPILE_I_PRINT_OUT_ARG ", %s (" COMPILE_I_EXPR_VAL
+ "),\n"
+ "\tsizeof (*" COMPILE_I_EXPR_PTR_TYPE "));\n",
+ input, input,
+ (type == COMPILE_I_PRINT_ADDRESS_SCOPE ? "__builtin_addressof"
+ : ""));
break;
default:
@@ -532,20 +498,22 @@ struct cplus_add_input
AddInputPolicy adds the actual user code. */
-template <class CompileInstanceType, class PushUserExpressionPolicy,
- class PopUserExpressionPolicy, class AddCodeHeaderPolicy,
- class AddCodeFooterPolicy, class AddInputPolicy>
-class compile_program
- : private PushUserExpressionPolicy, private PopUserExpressionPolicy,
- private AddCodeHeaderPolicy, private AddCodeFooterPolicy,
- private AddInputPolicy
+template<class CompileInstanceType, class PushUserExpressionPolicy,
+ class PopUserExpressionPolicy, class AddCodeHeaderPolicy,
+ class AddCodeFooterPolicy, class AddInputPolicy>
+class compile_program : private PushUserExpressionPolicy,
+ private PopUserExpressionPolicy,
+ private AddCodeHeaderPolicy,
+ private AddCodeFooterPolicy,
+ private AddInputPolicy
{
public:
/* Construct a compile_program using the compiler instance INST
using the architecture given by GDBARCH. */
compile_program (CompileInstanceType *inst, struct gdbarch *gdbarch)
- : m_instance (inst), m_arch (gdbarch)
+ : m_instance (inst),
+ m_arch (gdbarch)
{
}
@@ -650,23 +618,21 @@ private:
/* The types used for C and C++ program computations. */
-typedef compile_program<compile_c_instance,
- c_push_user_expression, pop_user_expression_nop,
- c_add_code_header, c_add_code_footer,
- c_add_input> c_compile_program;
+typedef compile_program<compile_c_instance, c_push_user_expression,
+ pop_user_expression_nop, c_add_code_header,
+ c_add_code_footer, c_add_input>
+ c_compile_program;
-typedef compile_program<compile_cplus_instance,
- cplus_push_user_expression, cplus_pop_user_expression,
- cplus_add_code_header, c_add_code_footer,
- cplus_add_input> cplus_compile_program;
+typedef compile_program<compile_cplus_instance, cplus_push_user_expression,
+ cplus_pop_user_expression, cplus_add_code_header,
+ c_add_code_footer, cplus_add_input>
+ cplus_compile_program;
/* The compute_program method for C. */
std::string
-c_compute_program (compile_instance *inst,
- const char *input,
- struct gdbarch *gdbarch,
- const struct block *expr_block,
+c_compute_program (compile_instance *inst, const char *input,
+ struct gdbarch *gdbarch, const struct block *expr_block,
CORE_ADDR expr_pc)
{
compile_c_instance *c_inst = static_cast<compile_c_instance *> (inst);
@@ -678,10 +644,8 @@ c_compute_program (compile_instance *inst,
/* The compute_program method for C++. */
std::string
-cplus_compute_program (compile_instance *inst,
- const char *input,
- struct gdbarch *gdbarch,
- const struct block *expr_block,
+cplus_compute_program (compile_instance *inst, const char *input,
+ struct gdbarch *gdbarch, const struct block *expr_block,
CORE_ADDR expr_pc)
{
compile_cplus_instance *cplus_inst
diff --git a/gdb/compile/compile-c-symbols.c b/gdb/compile/compile-c-symbols.c
index 00ac4523f86..cbf06b9da60 100644
--- a/gdb/compile/compile-c-symbols.c
+++ b/gdb/compile/compile-c-symbols.c
@@ -17,7 +17,6 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
-
#include "defs.h"
#include "compile-internal.h"
#include "compile-c.h"
@@ -31,16 +30,14 @@
#include "gdbtypes.h"
#include "dwarf2/loc.h"
-
-
/* Compute the name of the pointer representing a local symbol's
address. */
gdb::unique_xmalloc_ptr<char>
c_symbol_substitution_name (struct symbol *sym)
{
- return gdb::unique_xmalloc_ptr<char>
- (concat ("__", sym->natural_name (), "_ptr", (char *) NULL));
+ return gdb::unique_xmalloc_ptr<char> (concat ("__", sym->natural_name (),
+ "_ptr", (char *) NULL));
}
/* Convert a given symbol, SYM, to the compiler's representation.
@@ -51,10 +48,8 @@ c_symbol_substitution_name (struct symbol *sym)
scope.) */
static void
-convert_one_symbol (compile_c_instance *context,
- struct block_symbol sym,
- int is_global,
- int is_local)
+convert_one_symbol (compile_c_instance *context, struct block_symbol sym,
+ int is_global, int is_local)
{
gcc_type sym_type;
const char *filename = sym.symbol->symtab ()->filename;
@@ -70,8 +65,8 @@ convert_one_symbol (compile_c_instance *context,
if (sym.symbol->domain () == STRUCT_DOMAIN)
{
/* Binding a tag, so we don't need to build a decl. */
- context->plugin ().tagbind (sym.symbol->natural_name (),
- sym_type, filename, line);
+ context->plugin ().tagbind (sym.symbol->natural_name (), sym_type,
+ filename, line);
}
else
{
@@ -104,37 +99,37 @@ convert_one_symbol (compile_c_instance *context,
/* Already handled by convert_enum. */
return;
}
- context->plugin ().build_constant
- (sym_type, sym.symbol->natural_name (),
- sym.symbol->value_longest (),
- filename, line);
+ context->plugin ().build_constant (sym_type,
+ sym.symbol->natural_name (),
+ sym.symbol->value_longest (),
+ filename, line);
return;
case LOC_CONST_BYTES:
- error (_("Unsupported LOC_CONST_BYTES for symbol \"%s\"."),
+ error (_ ("Unsupported LOC_CONST_BYTES for symbol \"%s\"."),
sym.symbol->print_name ());
case LOC_UNDEF:
- internal_error (_("LOC_UNDEF found for \"%s\"."),
+ internal_error (_ ("LOC_UNDEF found for \"%s\"."),
sym.symbol->print_name ());
case LOC_COMMON_BLOCK:
- error (_("Fortran common block is unsupported for compilation "
- "evaluaton of symbol \"%s\"."),
+ error (_ ("Fortran common block is unsupported for compilation "
+ "evaluaton of symbol \"%s\"."),
sym.symbol->print_name ());
case LOC_OPTIMIZED_OUT:
- error (_("Symbol \"%s\" cannot be used for compilation evaluation "
- "as it is optimized out."),
+ error (_ ("Symbol \"%s\" cannot be used for compilation evaluation "
+ "as it is optimized out."),
sym.symbol->print_name ());
case LOC_COMPUTED:
if (is_local)
goto substitution;
/* Probably TLS here. */
- warning (_("Symbol \"%s\" is thread-local and currently can only "
- "be referenced from the current thread in "
- "compiled code."),
+ warning (_ ("Symbol \"%s\" is thread-local and currently can only "
+ "be referenced from the current thread in "
+ "compiled code."),
sym.symbol->print_name ());
/* FALLTHROUGH */
case LOC_UNRESOLVED:
@@ -150,15 +145,15 @@ convert_one_symbol (compile_c_instance *context,
{
frame = get_selected_frame (NULL);
if (frame == NULL)
- error (_("Symbol \"%s\" cannot be used because "
- "there is no selected frame"),
+ error (_ ("Symbol \"%s\" cannot be used because "
+ "there is no selected frame"),
sym.symbol->print_name ());
}
val = read_var_value (sym.symbol, sym.block, frame);
if (VALUE_LVAL (val) != lval_memory)
- error (_("Symbol \"%s\" cannot be used for compilation "
- "evaluation as its address has not been found."),
+ error (_ ("Symbol \"%s\" cannot be used for compilation "
+ "evaluation as its address has not been found."),
sym.symbol->print_name ());
kind = GCC_C_SYMBOL_VARIABLE;
@@ -166,7 +161,6 @@ convert_one_symbol (compile_c_instance *context,
}
break;
-
case LOC_REGISTER:
case LOC_ARG:
case LOC_REF_ARG:
@@ -185,19 +179,15 @@ convert_one_symbol (compile_c_instance *context,
case LOC_FINAL_VALUE:
default:
gdb_assert_not_reached ("Unreachable case in convert_one_symbol.");
-
}
/* Don't emit local variable decls for a raw expression. */
- if (context->scope () != COMPILE_I_RAW_SCOPE
- || symbol_name == NULL)
+ if (context->scope () != COMPILE_I_RAW_SCOPE || symbol_name == NULL)
{
- decl = context->plugin ().build_decl
- (sym.symbol->natural_name (),
- kind,
- sym_type,
- symbol_name.get (), addr,
- filename, line);
+ decl
+ = context->plugin ().build_decl (sym.symbol->natural_name (), kind,
+ sym_type, symbol_name.get (),
+ addr, filename, line);
context->plugin ().bind (decl, is_global);
}
@@ -249,8 +239,7 @@ convert_symbol_sym (compile_c_instance *context, const char *identifier,
}
if (compile_debug)
- gdb_printf (gdb_stdlog,
- "gcc_convert_symbol \"%s\": local symbol\n",
+ gdb_printf (gdb_stdlog, "gcc_convert_symbol \"%s\": local symbol\n",
identifier);
convert_one_symbol (context, sym, 0, is_local_symbol);
}
@@ -308,22 +297,18 @@ convert_symbol_bmsym (compile_c_instance *context,
}
sym_type = context->convert_type (type);
- decl = context->plugin ().build_decl (msym->natural_name (),
- kind, sym_type, NULL, addr,
- NULL, 0);
+ decl = context->plugin ().build_decl (msym->natural_name (), kind, sym_type,
+ NULL, addr, NULL, 0);
context->plugin ().bind (decl, 1 /* is_global */);
}
/* See compile-internal.h. */
void
-gcc_convert_symbol (void *datum,
- struct gcc_c_context *gcc_context,
- enum gcc_c_oracle_request request,
- const char *identifier)
+gcc_convert_symbol (void *datum, struct gcc_c_context *gcc_context,
+ enum gcc_c_oracle_request request, const char *identifier)
{
- compile_c_instance *context
- = static_cast<compile_c_instance *> (datum);
+ compile_c_instance *context = static_cast<compile_c_instance *> (datum);
domain_enum domain;
int found = 0;
@@ -385,8 +370,7 @@ gcc_address
gcc_symbol_address (void *datum, struct gcc_c_context *gcc_context,
const char *identifier)
{
- compile_c_instance *context
- = static_cast<compile_c_instance *> (datum);
+ compile_c_instance *context = static_cast<compile_c_instance *> (datum);
gcc_address result = 0;
int found = 0;
@@ -401,8 +385,7 @@ gcc_symbol_address (void *datum, struct gcc_c_context *gcc_context,
if (sym != NULL && sym->aclass () == LOC_BLOCK)
{
if (compile_debug)
- gdb_printf (gdb_stdlog,
- "gcc_symbol_address \"%s\": full symbol\n",
+ gdb_printf (gdb_stdlog, "gcc_symbol_address \"%s\": full symbol\n",
identifier);
result = sym->value_block ()->entry_pc ();
if (sym->type ()->is_gnu_ifunc ())
@@ -435,14 +418,10 @@ gcc_symbol_address (void *datum, struct gcc_c_context *gcc_context,
}
if (compile_debug && !found)
- gdb_printf (gdb_stdlog,
- "gcc_symbol_address \"%s\": failed\n",
- identifier);
+ gdb_printf (gdb_stdlog, "gcc_symbol_address \"%s\": failed\n", identifier);
return result;
}
-
-
/* A hash function for symbol names. */
static hashval_t
@@ -484,13 +463,9 @@ symbol_seen (htab_t hashtab, struct symbol *sym)
/* Generate C code to compute the length of a VLA. */
static void
-generate_vla_size (compile_instance *compiler,
- string_file *stream,
- struct gdbarch *gdbarch,
- std::vector<bool> &registers_used,
- CORE_ADDR pc,
- struct type *type,
- struct symbol *sym)
+generate_vla_size (compile_instance *compiler, string_file *stream,
+ struct gdbarch *gdbarch, std::vector<bool> &registers_used,
+ CORE_ADDR pc, struct type *type, struct symbol *sym)
{
type = check_typedef (type);
@@ -507,9 +482,8 @@ generate_vla_size (compile_instance *compiler,
const struct dynamic_prop *prop = &type->bounds ()->high;
std::string name = c_get_range_decl_name (prop);
- dwarf2_compile_property_to_c (stream, name.c_str (),
- gdbarch, registers_used,
- prop, pc, sym);
+ dwarf2_compile_property_to_c (stream, name.c_str (), gdbarch,
+ registers_used, prop, pc, sym);
}
}
break;
@@ -539,13 +513,10 @@ generate_vla_size (compile_instance *compiler,
static void
generate_c_for_for_one_variable (compile_instance *compiler,
- string_file *stream,
- struct gdbarch *gdbarch,
+ string_file *stream, struct gdbarch *gdbarch,
std::vector<bool> &registers_used,
- CORE_ADDR pc,
- struct symbol *sym)
+ CORE_ADDR pc, struct symbol *sym)
{
-
try
{
if (is_dynamic_type (sym->type ()))
@@ -554,8 +525,8 @@ generate_c_for_for_one_variable (compile_instance *compiler,
occurs in the middle. */
string_file local_file;
- generate_vla_size (compiler, &local_file, gdbarch, registers_used, pc,
- sym->type (), sym);
+ generate_vla_size (compiler, &local_file, gdbarch, registers_used,
+ pc, sym->type (), sym);
stream->write (local_file.c_str (), local_file.size ());
}
@@ -568,11 +539,9 @@ generate_c_for_for_one_variable (compile_instance *compiler,
occurs in the middle. */
string_file local_file;
- SYMBOL_COMPUTED_OPS (sym)->generate_c_location (sym, &local_file,
- gdbarch,
- registers_used,
- pc,
- generated_name.get ());
+ SYMBOL_COMPUTED_OPS (sym)->generate_c_location (
+ sym, &local_file, gdbarch, registers_used, pc,
+ generated_name.get ());
stream->write (local_file.c_str (), local_file.size ());
}
else
@@ -584,7 +553,7 @@ generate_c_for_for_one_variable (compile_instance *compiler,
case LOC_REF_ARG:
case LOC_REGPARM_ADDR:
case LOC_LOCAL:
- error (_("Local symbol unhandled when generating C code."));
+ error (_ ("Local symbol unhandled when generating C code."));
case LOC_COMPUTED:
gdb_assert_not_reached ("LOC_COMPUTED variable "
@@ -610,8 +579,7 @@ std::vector<bool>
generate_c_for_variable_locations (compile_instance *compiler,
string_file *stream,
struct gdbarch *gdbarch,
- const struct block *block,
- CORE_ADDR pc)
+ const struct block *block, CORE_ADDR pc)
{
const struct block *static_block = block_static_block (block);
@@ -634,8 +602,7 @@ generate_c_for_variable_locations (compile_instance *compiler,
/* Iterate over symbols in this block, generating code to
compute the location of each local variable. */
- for (sym = block_iterator_first (block, &iter);
- sym != NULL;
+ for (sym = block_iterator_first (block, &iter); sym != NULL;
sym = block_iterator_next (&iter))
{
if (!symbol_seen (symhash.get (), sym))
diff --git a/gdb/compile/compile-c-types.c b/gdb/compile/compile-c-types.c
index 68903c27a97..b6bf0ef84a4 100644
--- a/gdb/compile/compile-c-types.c
+++ b/gdb/compile/compile-c-types.c
@@ -17,7 +17,6 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
-
#include "defs.h"
#include "gdbtypes.h"
#include "compile-internal.h"
@@ -45,11 +44,11 @@ convert_array (compile_c_instance *context, struct type *type)
element_type = context->convert_type (type->target_type ());
if (range->bounds ()->low.kind () != PROP_CONST)
- return context->plugin ().error (_("array type with non-constant"
- " lower bound is not supported"));
+ return context->plugin ().error (_ ("array type with non-constant"
+ " lower bound is not supported"));
if (range->bounds ()->low.const_val () != 0)
- return context->plugin ().error (_("cannot convert array type with "
- "non-zero lower bound to C"));
+ return context->plugin ().error (_ ("cannot convert array type with "
+ "non-zero lower bound to C"));
if (range->bounds ()->high.kind () == PROP_LOCEXPR
|| range->bounds ()->high.kind () == PROP_LOCLIST)
@@ -57,8 +56,8 @@ convert_array (compile_c_instance *context, struct type *type)
gcc_type result;
if (type->is_vector ())
- return context->plugin ().error (_("variably-sized vector type"
- " is not supported"));
+ return context->plugin ().error (_ ("variably-sized vector type"
+ " is not supported"));
std::string upper_bound
= c_get_range_decl_name (&range->bounds ()->high);
@@ -111,10 +110,8 @@ convert_struct_or_union (compile_c_instance *context, struct type *type)
field_type = context->convert_type (type->field (i).type ());
if (bitsize == 0)
bitsize = 8 * type->field (i).type ()->length ();
- context->plugin ().build_add_field (result,
- type->field (i).name (),
- field_type,
- bitsize,
+ context->plugin ().build_add_field (result, type->field (i).name (),
+ field_type, bitsize,
type->field (i).loc_bitpos ());
}
@@ -130,14 +127,14 @@ convert_enum (compile_c_instance *context, struct type *type)
gcc_type int_type, result;
int i;
- int_type = context->plugin ().int_type_v0 (type->is_unsigned (),
- type->length ());
+ int_type
+ = context->plugin ().int_type_v0 (type->is_unsigned (), type->length ());
result = context->plugin ().build_enum_type (int_type);
for (i = 0; i < type->num_fields (); ++i)
{
- context->plugin ().build_add_enum_constant
- (result, type->field (i).name (), type->field (i).loc_enumval ());
+ context->plugin ().build_add_enum_constant (
+ result, type->field (i).name (), type->field (i).loc_enumval ());
}
context->plugin ().finish_enum_type (result);
@@ -168,7 +165,7 @@ convert_func (compile_c_instance *context, struct type *type)
target_type = objfile_type (type->objfile_owner ())->builtin_int;
else
target_type = builtin_type (type->arch_owner ())->builtin_int;
- warning (_("function has unknown return type; assuming int"));
+ warning (_ ("function has unknown return type; assuming int"));
}
/* This approach means we can't make self-referential function
@@ -181,8 +178,8 @@ convert_func (compile_c_instance *context, struct type *type)
for (i = 0; i < type->num_fields (); ++i)
array.elements[i] = context->convert_type (type->field (i).type ());
- result = context->plugin ().build_function_type (return_type,
- &array, is_varargs);
+ result
+ = context->plugin ().build_function_type (return_type, &array, is_varargs);
return result;
}
@@ -200,8 +197,7 @@ convert_int (compile_c_instance *context, struct type *type)
return context->plugin ().char_type ();
}
return context->plugin ().int_type (type->is_unsigned (),
- type->length (),
- type->name ());
+ type->length (), type->name ());
}
else
return context->plugin ().int_type_v0 (type->is_unsigned (),
@@ -214,8 +210,7 @@ static gcc_type
convert_float (compile_c_instance *context, struct type *type)
{
if (context->plugin ().version () >= GCC_C_FE_VERSION_1)
- return context->plugin ().float_type (type->length (),
- type->name ());
+ return context->plugin ().float_type (type->length (), type->name ());
else
return context->plugin ().float_type_v0 (type->length ());
}
@@ -278,9 +273,10 @@ convert_type_basic (compile_c_instance *context, struct type *type)
{
/* If we are converting a qualified type, first convert the
unqualified type and then apply the qualifiers. */
- if ((type->instance_flags () & (TYPE_INSTANCE_FLAG_CONST
- | TYPE_INSTANCE_FLAG_VOLATILE
- | TYPE_INSTANCE_FLAG_RESTRICT)) != 0)
+ if ((type->instance_flags ()
+ & (TYPE_INSTANCE_FLAG_CONST | TYPE_INSTANCE_FLAG_VOLATILE
+ | TYPE_INSTANCE_FLAG_RESTRICT))
+ != 0)
return convert_qualified (context, type);
switch (type->code ())
@@ -327,22 +323,23 @@ convert_type_basic (compile_c_instance *context, struct type *type)
fallback = objfile_type (type->objfile_owner ())->builtin_int;
else
fallback = builtin_type (type->arch_owner ())->builtin_int;
- warning (_("variable has unknown type; assuming int"));
+ warning (_ ("variable has unknown type; assuming int"));
return convert_int (context, fallback);
}
}
- return context->plugin ().error (_("cannot convert gdb type to gcc type"));
+ return context->plugin ().error (_ ("cannot convert gdb type to gcc type"));
}
/* Default compile flags for C. */
-const char *compile_c_instance::m_default_cflags = "-std=gnu11"
- /* Otherwise the .o file may need
+const char *compile_c_instance::m_default_cflags
+ = "-std=gnu11"
+ /* Otherwise the .o file may need
"_Unwind_Resume" and
"__gcc_personality_v0". */
- " -fno-exceptions"
- " -Wno-implicit-function-declaration";
+ " -fno-exceptions"
+ " -Wno-implicit-function-declaration";
/* See compile-c.h. */
@@ -362,32 +359,44 @@ compile_c_instance::convert_type (struct type *type)
return result;
}
-
-
/* C plug-in wrapper. */
-#define FORWARD(OP,...) m_context->c_ops->OP(m_context, ##__VA_ARGS__)
-#define GCC_METHOD0(R, N) \
+#define FORWARD(OP, ...) m_context->c_ops->OP (m_context, ##__VA_ARGS__)
+#define GCC_METHOD0(R, N) \
R gcc_c_plugin::N () const \
- { return FORWARD (N); }
-#define GCC_METHOD1(R, N, A) \
+ { \
+ return FORWARD (N); \
+ }
+#define GCC_METHOD1(R, N, A) \
R gcc_c_plugin::N (A a) const \
- { return FORWARD (N, a); }
-#define GCC_METHOD2(R, N, A, B) \
+ { \
+ return FORWARD (N, a); \
+ }
+#define GCC_METHOD2(R, N, A, B) \
R gcc_c_plugin::N (A a, B b) const \
- { return FORWARD (N, a, b); }
-#define GCC_METHOD3(R, N, A, B, C) \
- R gcc_c_plugin::N (A a, B b, C c) const \
- { return FORWARD (N, a, b, c); }
-#define GCC_METHOD4(R, N, A, B, C, D) \
+ { \
+ return FORWARD (N, a, b); \
+ }
+#define GCC_METHOD3(R, N, A, B, C) \
+ R gcc_c_plugin::N (A a, B b, C c) const \
+ { \
+ return FORWARD (N, a, b, c); \
+ }
+#define GCC_METHOD4(R, N, A, B, C, D) \
R gcc_c_plugin::N (A a, B b, C c, D d) const \
- { return FORWARD (N, a, b, c, d); }
-#define GCC_METHOD5(R, N, A, B, C, D, E) \
+ { \
+ return FORWARD (N, a, b, c, d); \
+ }
+#define GCC_METHOD5(R, N, A, B, C, D, E) \
R gcc_c_plugin::N (A a, B b, C c, D d, E e) const \
- { return FORWARD (N, a, b, c, d, e); }
-#define GCC_METHOD7(R, N, A, B, C, D, E, F, G) \
+ { \
+ return FORWARD (N, a, b, c, d, e); \
+ }
+#define GCC_METHOD7(R, N, A, B, C, D, E, F, G) \
R gcc_c_plugin::N (A a, B b, C c, D d, E e, F f, G g) const \
- { return FORWARD (N, a, b, c, d, e, f, g); }
+ { \
+ return FORWARD (N, a, b, c, d, e, f, g); \
+ }
#include "gcc-c-fe.def"
diff --git a/gdb/compile/compile-c.h b/gdb/compile/compile-c.h
index f0477742c44..8ad80f96a1f 100644
--- a/gdb/compile/compile-c.h
+++ b/gdb/compile/compile-c.h
@@ -39,6 +39,7 @@ extern gcc_c_symbol_address_function gcc_symbol_address;
class compile_c_instance : public compile_instance
{
public:
+
explicit compile_c_instance (struct gcc_c_context *gcc_c)
: compile_instance (&gcc_c->base, m_default_cflags),
m_plugin (gcc_c)
@@ -55,6 +56,7 @@ public:
gcc_c_plugin &plugin () { return m_plugin; }
private:
+
/* Default compiler flags for C. */
static const char *m_default_cflags;
@@ -67,13 +69,9 @@ private:
register number, where each element indicates if the corresponding
register is needed to compute a local variable. */
-extern std::vector<bool>
- generate_c_for_variable_locations
- (compile_instance *compiler,
- string_file *stream,
- struct gdbarch *gdbarch,
- const struct block *block,
- CORE_ADDR pc);
+extern std::vector<bool> generate_c_for_variable_locations (
+ compile_instance *compiler, string_file *stream, struct gdbarch *gdbarch,
+ const struct block *block, CORE_ADDR pc);
/* Get the GCC mode attribute value for a given type size. */
@@ -91,6 +89,6 @@ extern std::string c_get_range_decl_name (const struct dynamic_prop *prop);
address. */
extern gdb::unique_xmalloc_ptr<char>
- c_symbol_substitution_name (struct symbol *sym);
+c_symbol_substitution_name (struct symbol *sym);
#endif /* COMPILE_COMPILE_C_H */
diff --git a/gdb/compile/compile-cplus-symbols.c b/gdb/compile/compile-cplus-symbols.c
index 2df68b7dd32..b440adaa9b6 100644
--- a/gdb/compile/compile-cplus-symbols.c
+++ b/gdb/compile/compile-cplus-symbols.c
@@ -17,7 +17,6 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
-
#include "defs.h"
#include "compile-internal.h"
#include "compile-cplus.h"
@@ -43,8 +42,8 @@
scope.) */
static void
-convert_one_symbol (compile_cplus_instance *instance,
- struct block_symbol sym, bool is_global, bool is_local)
+convert_one_symbol (compile_cplus_instance *instance, struct block_symbol sym,
+ bool is_global, bool is_local)
{
/* Squash compiler warning. */
gcc_type sym_type = 0;
@@ -75,7 +74,7 @@ convert_one_symbol (compile_cplus_instance *instance,
case LOC_TYPEDEF:
if (sym.symbol->type ()->code () == TYPE_CODE_TYPEDEF)
kind = GCC_CP_SYMBOL_TYPEDEF;
- else if (sym.symbol->type ()->code () == TYPE_CODE_NAMESPACE)
+ else if (sym.symbol->type ()->code () == TYPE_CODE_NAMESPACE)
return;
break;
@@ -87,7 +86,7 @@ convert_one_symbol (compile_cplus_instance *instance,
case LOC_BLOCK:
{
kind = GCC_CP_SYMBOL_FUNCTION;
- addr = sym.symbol->value_block()->start ();
+ addr = sym.symbol->value_block ()->start ();
if (is_global && sym.symbol->type ()->is_gnu_ifunc ())
addr = gnu_ifunc_resolve_addr (target_gdbarch (), addr);
}
@@ -99,36 +98,37 @@ convert_one_symbol (compile_cplus_instance *instance,
/* Already handled by convert_enum. */
return;
}
- instance->plugin ().build_constant
- (sym_type, sym.symbol->natural_name (),
- sym.symbol->value_longest (), filename, line);
+ instance->plugin ().build_constant (sym_type,
+ sym.symbol->natural_name (),
+ sym.symbol->value_longest (),
+ filename, line);
return;
case LOC_CONST_BYTES:
- error (_("Unsupported LOC_CONST_BYTES for symbol \"%s\"."),
+ error (_ ("Unsupported LOC_CONST_BYTES for symbol \"%s\"."),
sym.symbol->print_name ());
case LOC_UNDEF:
- internal_error (_("LOC_UNDEF found for \"%s\"."),
+ internal_error (_ ("LOC_UNDEF found for \"%s\"."),
sym.symbol->print_name ());
case LOC_COMMON_BLOCK:
- error (_("Fortran common block is unsupported for compilation "
- "evaluaton of symbol \"%s\"."),
+ error (_ ("Fortran common block is unsupported for compilation "
+ "evaluaton of symbol \"%s\"."),
sym.symbol->print_name ());
case LOC_OPTIMIZED_OUT:
- error (_("Symbol \"%s\" cannot be used for compilation evaluation "
- "as it is optimized out."),
+ error (_ ("Symbol \"%s\" cannot be used for compilation evaluation "
+ "as it is optimized out."),
sym.symbol->print_name ());
case LOC_COMPUTED:
if (is_local)
goto substitution;
/* Probably TLS here. */
- warning (_("Symbol \"%s\" is thread-local and currently can only "
- "be referenced from the current thread in "
- "compiled code."),
+ warning (_ ("Symbol \"%s\" is thread-local and currently can only "
+ "be referenced from the current thread in "
+ "compiled code."),
sym.symbol->print_name ());
/* FALLTHROUGH */
case LOC_UNRESOLVED:
@@ -144,15 +144,15 @@ convert_one_symbol (compile_cplus_instance *instance,
{
frame = get_selected_frame (nullptr);
if (frame == nullptr)
- error (_("Symbol \"%s\" cannot be used because "
- "there is no selected frame"),
+ error (_ ("Symbol \"%s\" cannot be used because "
+ "there is no selected frame"),
sym.symbol->print_name ());
}
val = read_var_value (sym.symbol, sym.block, frame);
if (VALUE_LVAL (val) != lval_memory)
- error (_("Symbol \"%s\" cannot be used for compilation "
- "evaluation as its address has not been found."),
+ error (_ ("Symbol \"%s\" cannot be used for compilation "
+ "evaluation as its address has not been found."),
sym.symbol->print_name ());
kind = GCC_CP_SYMBOL_VARIABLE;
@@ -160,7 +160,6 @@ convert_one_symbol (compile_cplus_instance *instance,
}
break;
-
case LOC_REGISTER:
case LOC_ARG:
case LOC_REF_ARG:
@@ -203,13 +202,15 @@ convert_one_symbol (compile_cplus_instance *instance,
/* Get the `raw' name of the symbol. */
if (name.empty () && sym.symbol->natural_name () != nullptr)
- name = compile_cplus_instance::decl_name
- (sym.symbol->natural_name ()).get ();
+ name
+ = compile_cplus_instance::decl_name (sym.symbol->natural_name ())
+ .get ();
/* Define the decl. */
- instance->plugin ().build_decl
- ("variable", name.c_str (), kind.raw (), sym_type,
- symbol_name.get (), addr, filename, line);
+ instance->plugin ().build_decl ("variable", name.c_str (),
+ kind.raw (), sym_type,
+ symbol_name.get (), addr, filename,
+ line);
/* Pop scope for non-local symbols. */
if (!is_local)
@@ -223,9 +224,8 @@ convert_one_symbol (compile_cplus_instance *instance,
itself, and DOMAIN is the domain which was searched. */
static void
-convert_symbol_sym (compile_cplus_instance *instance,
- const char *identifier, struct block_symbol sym,
- domain_enum domain)
+convert_symbol_sym (compile_cplus_instance *instance, const char *identifier,
+ struct block_symbol sym, domain_enum domain)
{
/* If we found a symbol and it is not in the static or global
scope, then we should first convert any static or global scope
@@ -241,7 +241,8 @@ convert_symbol_sym (compile_cplus_instance *instance,
const struct block *static_block = block_static_block (sym.block);
/* STATIC_BLOCK is NULL if FOUND_BLOCK is the global block. */
- bool is_local_symbol = (sym.block != static_block && static_block != nullptr);
+ bool is_local_symbol
+ = (sym.block != static_block && static_block != nullptr);
if (is_local_symbol)
{
struct block_symbol global_sym;
@@ -261,8 +262,7 @@ convert_symbol_sym (compile_cplus_instance *instance,
}
if (compile_debug)
- gdb_printf (gdb_stdlog,
- "gcc_convert_symbol \"%s\": local symbol\n",
+ gdb_printf (gdb_stdlog, "gcc_convert_symbol \"%s\": local symbol\n",
identifier);
convert_one_symbol (instance, sym, false, is_local_symbol);
}
@@ -322,23 +322,20 @@ convert_symbol_bmsym (compile_cplus_instance *instance,
sym_type = instance->convert_type (type);
instance->plugin ().push_namespace ("");
- instance->plugin ().build_decl
- ("minsym", msym->natural_name (), kind.raw (), sym_type, nullptr, addr,
- nullptr, 0);
+ instance->plugin ().build_decl ("minsym", msym->natural_name (), kind.raw (),
+ sym_type, nullptr, addr, nullptr, 0);
instance->plugin ().pop_binding_level ("");
}
/* See compile-cplus.h. */
void
-gcc_cplus_convert_symbol (void *datum,
- struct gcc_cp_context *gcc_context,
+gcc_cplus_convert_symbol (void *datum, struct gcc_cp_context *gcc_context,
enum gcc_cp_oracle_request request,
const char *identifier)
{
if (compile_debug)
- gdb_printf (gdb_stdlog,
- "got oracle request for \"%s\"\n", identifier);
+ gdb_printf (gdb_stdlog, "got oracle request for \"%s\"\n", identifier);
bool found = false;
compile_cplus_instance *instance = (compile_cplus_instance *) datum;
@@ -363,8 +360,8 @@ gcc_cplus_convert_symbol (void *datum,
all non-variable symbols for which we have debug info. */
symbol_searcher searcher;
- searcher.find_all_symbols (identifier, current_language,
- ALL_DOMAIN, nullptr, nullptr);
+ searcher.find_all_symbols (identifier, current_language, ALL_DOMAIN,
+ nullptr, nullptr);
/* Convert any found symbols. */
for (const auto &it : searcher.matching_symbols ())
@@ -406,8 +403,7 @@ gcc_cplus_convert_symbol (void *datum,
gdb_printf (gdb_stdlog, "found type for %s\n", identifier);
else
{
- gdb_printf (gdb_stdlog, "did not find type for %s\n",
- identifier);
+ gdb_printf (gdb_stdlog, "did not find type for %s\n", identifier);
}
}
@@ -425,8 +421,8 @@ gcc_cplus_symbol_address (void *datum, struct gcc_cp_context *gcc_context,
int found = 0;
if (compile_debug)
- gdb_printf (gdb_stdlog,
- "got oracle request for address of %s\n", identifier);
+ gdb_printf (gdb_stdlog, "got oracle request for address of %s\n",
+ identifier);
/* We can't allow exceptions to escape out of this callback. Safest
is to simply emit a gcc error. */
@@ -438,8 +434,7 @@ gcc_cplus_symbol_address (void *datum, struct gcc_cp_context *gcc_context,
if (sym != nullptr && sym->aclass () == LOC_BLOCK)
{
if (compile_debug)
- gdb_printf (gdb_stdlog,
- "gcc_symbol_address \"%s\": full symbol\n",
+ gdb_printf (gdb_stdlog, "gcc_symbol_address \"%s\": full symbol\n",
identifier);
result = sym->value_block ()->start ();
if (sym->type ()->is_gnu_ifunc ())
@@ -472,17 +467,14 @@ gcc_cplus_symbol_address (void *datum, struct gcc_cp_context *gcc_context,
}
if (compile_debug && !found)
- gdb_printf (gdb_stdlog,
- "gcc_symbol_address \"%s\": failed\n",
- identifier);
+ gdb_printf (gdb_stdlog, "gcc_symbol_address \"%s\": failed\n", identifier);
if (compile_debug)
{
if (found)
gdb_printf (gdb_stdlog, "found address for %s!\n", identifier);
else
- gdb_printf (gdb_stdlog,
- "did not find address for %s\n", identifier);
+ gdb_printf (gdb_stdlog, "did not find address for %s\n", identifier);
}
return result;
diff --git a/gdb/compile/compile-cplus-types.c b/gdb/compile/compile-cplus-types.c
index 55661156b86..670e182d943 100644
--- a/gdb/compile/compile-cplus-types.c
+++ b/gdb/compile/compile-cplus-types.c
@@ -17,7 +17,6 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
-
#include "defs.h"
#include "gdbsupport/preprocessor.h"
#include "gdbtypes.h"
@@ -109,11 +108,11 @@ get_method_access_flag (const struct type *type, int fni, int num)
static void __attribute__ ((used))
debug_print_scope (const compile_scope &scope)
{
- for (const auto &comp: scope)
+ for (const auto &comp : scope)
{
const char *symbol = (comp.bsymbol.symbol != nullptr
- ? comp.bsymbol.symbol->natural_name ()
- : "<none>");
+ ? comp.bsymbol.symbol->natural_name ()
+ : "<none>");
printf_unfiltered ("\tname = %s, symbol = %s\n", comp.name.c_str (),
symbol);
@@ -157,7 +156,7 @@ type_name_to_scope (const char *type_name, const struct block *block)
if (bsymbol.symbol != nullptr)
{
- scope_component comp = {s, bsymbol};
+ scope_component comp = { s, bsymbol };
scope.push_back (comp);
@@ -178,7 +177,7 @@ type_name_to_scope (const char *type_name, const struct block *block)
/* This shouldn't happen since we are not attempting to
loop over user input. This name is generated by GDB
from debug info. */
- internal_error (_("malformed TYPE_NAME during parsing"));
+ internal_error (_ ("malformed TYPE_NAME during parsing"));
}
}
}
@@ -266,25 +265,24 @@ compile_cplus_instance::enter_scope (compile_scope &&new_scope)
/* Push all other namespaces. Note that we do not push the last
scope_component -- that's the actual type we are converting. */
- std::for_each
- (m_scopes.back ().begin (), m_scopes.back ().end () - 1,
- [this] (const scope_component &comp)
- {
- gdb_assert (comp.bsymbol.symbol->type ()->code ()
- == TYPE_CODE_NAMESPACE);
-
- const char *ns = (comp.name == CP_ANONYMOUS_NAMESPACE_STR ? nullptr
- : comp.name.c_str ());
-
- this->plugin ().push_namespace (ns);
- });
+ std::for_each (m_scopes.back ().begin (), m_scopes.back ().end () - 1,
+ [this] (const scope_component &comp) {
+ gdb_assert (comp.bsymbol.symbol->type ()->code ()
+ == TYPE_CODE_NAMESPACE);
+
+ const char *ns
+ = (comp.name == CP_ANONYMOUS_NAMESPACE_STR ? nullptr
+ : comp.name.c_str ());
+
+ this->plugin ().push_namespace (ns);
+ });
}
else
{
if (debug_compile_cplus_scopes)
{
gdb_printf (gdb_stdlog, "staying in current scope -- "
- "scopes are identical\n");
+ "scopes are identical\n");
}
}
}
@@ -309,13 +307,12 @@ compile_cplus_instance::leave_scope ()
}
/* Pop namespaces. */
- std::for_each
- (current.begin (),current.end () - 1,
- [this] (const scope_component &comp) {
- gdb_assert (comp.bsymbol.symbol->type ()->code ()
- == TYPE_CODE_NAMESPACE);
- this->plugin ().pop_binding_level (comp.name.c_str ());
- });
+ std::for_each (current.begin (), current.end () - 1,
+ [this] (const scope_component &comp) {
+ gdb_assert (comp.bsymbol.symbol->type ()->code ()
+ == TYPE_CODE_NAMESPACE);
+ this->plugin ().pop_binding_level (comp.name.c_str ());
+ });
/* Pop global namespace. */
plugin ().pop_binding_level ("");
@@ -323,8 +320,7 @@ compile_cplus_instance::leave_scope ()
else
{
if (debug_compile_cplus_scopes)
- gdb_printf (gdb_stdlog,
- "identical scopes -- not leaving scope\n");
+ gdb_printf (gdb_stdlog, "identical scopes -- not leaving scope\n");
}
}
@@ -381,10 +377,8 @@ compile_cplus_instance::new_scope (const char *type_name, struct type *type)
else
{
scope_component comp
- = {
- decl_name (type->name ()).get (),
- lookup_symbol (type->name (), block (), VAR_DOMAIN, nullptr)
- };
+ = { decl_name (type->name ()).get (),
+ lookup_symbol (type->name (), block (), VAR_DOMAIN, nullptr) };
scope.push_back (comp);
}
}
@@ -397,8 +391,8 @@ compile_cplus_instance::new_scope (const char *type_name, struct type *type)
/* See description in compile-cplus.h. */
gcc_type
-compile_cplus_instance::convert_reference_base
- (gcc_type base, enum gcc_cp_ref_qualifiers rquals)
+compile_cplus_instance::convert_reference_base (
+ gcc_type base, enum gcc_cp_ref_qualifiers rquals)
{
return this->plugin ().build_reference_type (base, rquals);
}
@@ -430,7 +424,7 @@ compile_cplus_convert_reference (compile_cplus_instance *instance,
/* See description in compile-cplus.h. */
gcc_type
-compile_cplus_instance::convert_pointer_base(gcc_type target)
+compile_cplus_instance::convert_pointer_base (gcc_type target)
{
return plugin ().build_pointer_type (target);
}
@@ -457,16 +451,16 @@ compile_cplus_convert_array (compile_cplus_instance *instance,
if (range->bounds ()->low.kind () != PROP_CONST)
{
- const char *s = _("array type with non-constant"
- " lower bound is not supported");
+ const char *s = _ ("array type with non-constant"
+ " lower bound is not supported");
return instance->plugin ().error (s);
}
if (range->bounds ()->low.const_val () != 0)
{
- const char *s = _("cannot convert array type with "
- "non-zero lower bound to C");
+ const char *s = _ ("cannot convert array type with "
+ "non-zero lower bound to C");
return instance->plugin ().error (s);
}
@@ -476,7 +470,7 @@ compile_cplus_convert_array (compile_cplus_instance *instance,
{
if (type->is_vector ())
{
- const char *s = _("variably-sized vector type is not supported");
+ const char *s = _ ("variably-sized vector type is not supported");
return instance->plugin ().error (s);
}
@@ -484,7 +478,7 @@ compile_cplus_convert_array (compile_cplus_instance *instance,
std::string upper_bound
= c_get_range_decl_name (&range->bounds ()->high);
return instance->plugin ().build_vla_array_type (element_type,
- upper_bound.c_str ());
+ upper_bound.c_str ());
}
else
{
@@ -530,7 +524,7 @@ compile_cplus_convert_typedef (compile_cplus_instance *instance,
instance->plugin ().build_decl ("typedef", name.get (),
GCC_CP_SYMBOL_TYPEDEF | nested_access,
- typedef_type, 0, 0, nullptr, 0);
+ typedef_type, 0, 0, nullptr, 0);
/* Completed this scope. */
instance->leave_scope ();
@@ -555,7 +549,8 @@ compile_cplus_convert_type_defns (compile_cplus_instance *instance,
accessibility = GCC_CP_ACCESS_PRIVATE;
else
accessibility = GCC_CP_ACCESS_PUBLIC;
- instance->convert_type (TYPE_TYPEDEF_FIELD_TYPE (type, i), accessibility);
+ instance->convert_type (TYPE_TYPEDEF_FIELD_TYPE (type, i),
+ accessibility);
}
/* Convert nested types. */
@@ -576,23 +571,21 @@ compile_cplus_convert_type_defns (compile_cplus_instance *instance,
with gcc_type COMP_TYPE. */
static void
-compile_cplus_convert_struct_or_union_members
- (compile_cplus_instance *instance, struct type *type, gcc_type comp_type)
+compile_cplus_convert_struct_or_union_members (
+ compile_cplus_instance *instance, struct type *type, gcc_type comp_type)
{
for (int i = TYPE_N_BASECLASSES (type); i < type->num_fields (); ++i)
{
const char *field_name = type->field (i).name ();
- if (TYPE_FIELD_IGNORE (type, i)
- || TYPE_FIELD_ARTIFICIAL (type, i))
+ if (TYPE_FIELD_IGNORE (type, i) || TYPE_FIELD_ARTIFICIAL (type, i))
continue;
/* GDB records unnamed/anonymous fields with empty string names. */
if (*field_name == '\0')
field_name = nullptr;
- gcc_type field_type
- = instance->convert_type (type->field (i).type ());
+ gcc_type field_type = instance->convert_type (type->field (i).type ());
if (field_is_static (&type->field (i)))
{
@@ -604,10 +597,10 @@ compile_cplus_convert_struct_or_union_members
{
physaddr = type->field (i).loc_physaddr ();
- instance->plugin ().build_decl
- ("field physaddr", field_name,
- (GCC_CP_SYMBOL_VARIABLE | get_field_access_flag (type, i)),
- field_type, nullptr, physaddr, nullptr, 0);
+ instance->plugin ().build_decl (
+ "field physaddr", field_name,
+ (GCC_CP_SYMBOL_VARIABLE | get_field_access_flag (type, i)),
+ field_type, nullptr, physaddr, nullptr, 0);
}
break;
@@ -615,8 +608,8 @@ compile_cplus_convert_struct_or_union_members
{
const char *physname = type->field (i).loc_physname ();
struct block_symbol sym
- = lookup_symbol (physname, instance->block (),
- VAR_DOMAIN, nullptr);
+ = lookup_symbol (physname, instance->block (), VAR_DOMAIN,
+ nullptr);
if (sym.symbol == nullptr)
{
@@ -628,30 +621,29 @@ compile_cplus_convert_struct_or_union_members
unsigned int line = sym.symbol->line ();
physaddr = sym.symbol->value_address ();
- instance->plugin ().build_decl
- ("field physname", field_name,
- (GCC_CP_SYMBOL_VARIABLE| get_field_access_flag (type, i)),
- field_type, nullptr, physaddr, filename, line);
+ instance->plugin ().build_decl (
+ "field physname", field_name,
+ (GCC_CP_SYMBOL_VARIABLE | get_field_access_flag (type, i)),
+ field_type, nullptr, physaddr, filename, line);
}
break;
default:
- gdb_assert_not_reached
- ("unexpected static field location kind");
+ gdb_assert_not_reached ("unexpected static field location kind");
}
}
else
{
unsigned long bitsize = TYPE_FIELD_BITSIZE (type, i);
- enum gcc_cp_symbol_kind field_flags = GCC_CP_SYMBOL_FIELD
- | get_field_access_flag (type, i);
+ enum gcc_cp_symbol_kind field_flags
+ = GCC_CP_SYMBOL_FIELD | get_field_access_flag (type, i);
if (bitsize == 0)
bitsize = 8 * type->field (i).type ()->length ();
- instance->plugin ().build_field
- (field_name, field_type, field_flags, bitsize,
- type->field (i).loc_bitpos ());
+ instance->plugin ().build_field (field_name, field_type, field_flags,
+ bitsize,
+ type->field (i).loc_bitpos ());
}
}
}
@@ -665,7 +657,8 @@ compile_cplus_convert_method (compile_cplus_instance *instance,
{
/* Get the actual function type of the method, the corresponding class's
type and corresponding qualifier flags. */
- gcc_type func_type = compile_cplus_convert_func (instance, method_type, true);
+ gcc_type func_type
+ = compile_cplus_convert_func (instance, method_type, true);
gcc_type class_type = instance->convert_type (parent_type);
gcc_cp_qualifiers_flags quals = 0;
@@ -679,8 +672,8 @@ compile_cplus_convert_method (compile_cplus_instance *instance,
/* Not yet implemented. */
gcc_cp_ref_qualifiers_flags rquals = GCC_CP_REF_QUAL_NONE;
- return instance->plugin ().build_method_type
- (class_type, func_type, quals.raw (), rquals.raw ());
+ return instance->plugin ().build_method_type (class_type, func_type,
+ quals.raw (), rquals.raw ());
}
/* Convert a member or method pointer represented by TYPE. */
@@ -695,20 +688,18 @@ compile_cplus_convert_memberptr (compile_cplus_instance *instance,
return GCC_TYPE_NONE;
gcc_type class_type = instance->convert_type (containing_class);
- gcc_type member_type
- = instance->convert_type (type->target_type ());
+ gcc_type member_type = instance->convert_type (type->target_type ());
- return instance->plugin ().build_pointer_to_member_type
- (class_type, member_type);
+ return instance->plugin ().build_pointer_to_member_type (class_type,
+ member_type);
}
/* Convert all methods defined in TYPE, which should be a class/struct/union
with gcc_type CLASS_TYPE. */
static void
-compile_cplus_convert_struct_or_union_methods (compile_cplus_instance *instance,
- struct type *type,
- gcc_type class_type)
+compile_cplus_convert_struct_or_union_methods (
+ compile_cplus_instance *instance, struct type *type, gcc_type class_type)
{
for (int i = 0; i < TYPE_NFN_FIELDS (type); ++i)
{
@@ -736,16 +727,16 @@ compile_cplus_convert_struct_or_union_methods (compile_cplus_instance *instance,
{
/* This is beyond hacky, and is really only a workaround for
detecting pure virtual methods. */
- method_type = compile_cplus_convert_method
- (instance, type, TYPE_FN_FIELD_TYPE (methods, j));
-
- instance->plugin ().build_decl
- ("pure virtual method", overloaded_name.get (),
- (sym_kind
- | get_method_access_flag (type, i, j)
- | GCC_CP_FLAG_VIRTUAL_FUNCTION
- | GCC_CP_FLAG_PURE_VIRTUAL_FUNCTION).raw (),
- method_type, nullptr, 0, nullptr, 0);
+ method_type = compile_cplus_convert_method (
+ instance, type, TYPE_FN_FIELD_TYPE (methods, j));
+
+ instance->plugin ().build_decl (
+ "pure virtual method", overloaded_name.get (),
+ (sym_kind | get_method_access_flag (type, i, j)
+ | GCC_CP_FLAG_VIRTUAL_FUNCTION
+ | GCC_CP_FLAG_PURE_VIRTUAL_FUNCTION)
+ .raw (),
+ method_type, nullptr, 0, nullptr, 0);
continue;
}
@@ -757,37 +748,39 @@ compile_cplus_convert_struct_or_union_methods (compile_cplus_instance *instance,
In this case, all we can hope to do is issue a warning
to the user letting him know. If the user has not actually
requested using this method, things should still work. */
- warning (_("Method %s appears to be optimized out.\n"
- "All references to this method will be undefined."),
- TYPE_FN_FIELD_PHYSNAME (methods, j));
+ warning (_ ("Method %s appears to be optimized out.\n"
+ "All references to this method will be undefined."),
+ TYPE_FN_FIELD_PHYSNAME (methods, j));
continue;
}
const char *filename = sym.symbol->symtab ()->filename;
unsigned int line = sym.symbol->line ();
- CORE_ADDR address = sym.symbol->value_block()->start ();
+ CORE_ADDR address = sym.symbol->value_block ()->start ();
const char *kind;
if (TYPE_FN_FIELD_STATIC_P (methods, j))
{
kind = "static method";
- method_type = compile_cplus_convert_func
- (instance, TYPE_FN_FIELD_TYPE (methods, j), true);
+ method_type
+ = compile_cplus_convert_func (instance,
+ TYPE_FN_FIELD_TYPE (methods, j),
+ true);
}
else
{
kind = "method";
- method_type = (compile_cplus_convert_method
- (instance, type, TYPE_FN_FIELD_TYPE (methods, j)));
+ method_type = (compile_cplus_convert_method (
+ instance, type, TYPE_FN_FIELD_TYPE (methods, j)));
}
if (TYPE_FN_FIELD_VIRTUAL_P (methods, j))
sym_kind |= GCC_CP_FLAG_VIRTUAL_FUNCTION;
- instance->plugin ().build_decl
- (kind, overloaded_name.get (),
- (sym_kind | get_method_access_flag (type, i, j)).raw (),
- method_type, nullptr, address, filename, line);
+ instance->plugin ().build_decl (
+ kind, overloaded_name.get (),
+ (sym_kind | get_method_access_flag (type, i, j)).raw (),
+ method_type, nullptr, address, filename, line);
}
}
}
@@ -829,19 +822,20 @@ compile_cplus_convert_struct_or_union (compile_cplus_instance *instance,
{
const char *what = type->is_declared_class () ? "class" : "struct";
- resuld = instance->plugin ().build_decl
- (what, name.get (), (GCC_CP_SYMBOL_CLASS | nested_access
- | (type->is_declared_class ()
- ? GCC_CP_FLAG_CLASS_NOFLAG
- : GCC_CP_FLAG_CLASS_IS_STRUCT)),
- 0, nullptr, 0, filename, line);
+ resuld = instance->plugin ().build_decl (
+ what, name.get (),
+ (GCC_CP_SYMBOL_CLASS | nested_access
+ | (type->is_declared_class () ? GCC_CP_FLAG_CLASS_NOFLAG
+ : GCC_CP_FLAG_CLASS_IS_STRUCT)),
+ 0, nullptr, 0, filename, line);
}
else
{
gdb_assert (type->code () == TYPE_CODE_UNION);
- resuld = instance->plugin ().build_decl
- ("union", name.get (), GCC_CP_SYMBOL_UNION | nested_access,
- 0, nullptr, 0, filename, line);
+ resuld
+ = instance->plugin ().build_decl ("union", name.get (),
+ GCC_CP_SYMBOL_UNION | nested_access,
+ 0, nullptr, 0, filename, line);
}
gcc_type result;
@@ -851,7 +845,10 @@ compile_cplus_convert_struct_or_union (compile_cplus_instance *instance,
std::vector<gcc_type> elements (num_baseclasses);
std::vector<enum gcc_cp_symbol_kind> flags (num_baseclasses);
- struct gcc_vbase_array bases {};
+ struct gcc_vbase_array bases
+ {
+ };
+
bases.elements = elements.data ();
bases.flags = flags.data ();
bases.n_elements = num_baseclasses;
@@ -860,22 +857,22 @@ compile_cplus_convert_struct_or_union (compile_cplus_instance *instance,
{
struct type *base_type = TYPE_BASECLASS (type, i);
- bases.flags[i] = (GCC_CP_SYMBOL_BASECLASS
- | get_field_access_flag (type, i)
- | (BASETYPE_VIA_VIRTUAL (type, i)
- ? GCC_CP_FLAG_BASECLASS_VIRTUAL
- : GCC_CP_FLAG_BASECLASS_NOFLAG));
+ bases.flags[i]
+ = (GCC_CP_SYMBOL_BASECLASS | get_field_access_flag (type, i)
+ | (BASETYPE_VIA_VIRTUAL (type, i)
+ ? GCC_CP_FLAG_BASECLASS_VIRTUAL
+ : GCC_CP_FLAG_BASECLASS_NOFLAG));
bases.elements[i] = instance->convert_type (base_type);
}
- result = instance->plugin ().start_class_type
- (name.get (), resuld, &bases, filename, line);
+ result = instance->plugin ().start_class_type (name.get (), resuld,
+ &bases, filename, line);
}
else
{
gdb_assert (type->code () == TYPE_CODE_UNION);
- result = instance->plugin ().start_class_type
- (name.get (), resuld, nullptr, filename, line);
+ result = instance->plugin ().start_class_type (name.get (), resuld,
+ nullptr, filename, line);
}
instance->insert_type (type, result);
@@ -902,7 +899,8 @@ compile_cplus_convert_struct_or_union (compile_cplus_instance *instance,
accessibility of this type.*/
static gcc_type
-compile_cplus_convert_enum (compile_cplus_instance *instance, struct type *type,
+compile_cplus_convert_enum (compile_cplus_instance *instance,
+ struct type *type,
enum gcc_cp_symbol_kind nested_access)
{
bool scoped_enum_p = false;
@@ -924,15 +922,13 @@ compile_cplus_convert_enum (compile_cplus_instance *instance, struct type *type,
instance->enter_scope (std::move (scope));
gcc_type int_type
- = instance->plugin ().get_int_type (type->is_unsigned (),
- type->length (), nullptr);
- gcc_type result
- = instance->plugin ().start_enum_type (name.get (), int_type,
- GCC_CP_SYMBOL_ENUM | nested_access
- | (scoped_enum_p
- ? GCC_CP_FLAG_ENUM_SCOPED
- : GCC_CP_FLAG_ENUM_NOFLAG),
- nullptr, 0);
+ = instance->plugin ().get_int_type (type->is_unsigned (), type->length (),
+ nullptr);
+ gcc_type result = instance->plugin ().start_enum_type (
+ name.get (), int_type,
+ GCC_CP_SYMBOL_ENUM | nested_access
+ | (scoped_enum_p ? GCC_CP_FLAG_ENUM_SCOPED : GCC_CP_FLAG_ENUM_NOFLAG),
+ nullptr, 0);
for (int i = 0; i < type->num_fields (); ++i)
{
gdb::unique_xmalloc_ptr<char> fname
@@ -973,7 +969,7 @@ compile_cplus_convert_func (compile_cplus_instance *instance,
target_type = objfile_type (type->objfile_owner ())->builtin_int;
else
target_type = builtin_type (type->arch_owner ())->builtin_int;
- warning (_("function has unknown return type; assuming int"));
+ warning (_ ("function has unknown return type; assuming int"));
}
/* This approach means we can't make self-referential function
@@ -999,8 +995,9 @@ compile_cplus_convert_func (compile_cplus_instance *instance,
/* We omit setting the argument types to `void' to be a little flexible
with some minsyms like printf (compile-cplus.exp has examples). */
- gcc_type result = instance->plugin ().build_function_type
- (return_type, &array, is_varargs);
+ gcc_type result
+ = instance->plugin ().build_function_type (return_type, &array,
+ is_varargs);
return result;
}
@@ -1015,8 +1012,8 @@ compile_cplus_convert_int (compile_cplus_instance *instance, struct type *type)
return instance->plugin ().get_char_type ();
}
- return instance->plugin ().get_int_type
- (type->is_unsigned (), type->length (), type->name ());
+ return instance->plugin ().get_int_type (type->is_unsigned (),
+ type->length (), type->name ());
}
/* Convert a floating-point type to its gcc representation. */
@@ -1025,14 +1022,14 @@ static gcc_type
compile_cplus_convert_float (compile_cplus_instance *instance,
struct type *type)
{
- return instance->plugin ().get_float_type
- (type->length (), type->name ());
+ return instance->plugin ().get_float_type (type->length (), type->name ());
}
/* Convert the 'void' type to its gcc representation. */
static gcc_type
-compile_cplus_convert_void (compile_cplus_instance *instance, struct type *type)
+compile_cplus_convert_void (compile_cplus_instance *instance,
+ struct type *type)
{
return instance->plugin ().get_void_type ();
}
@@ -1040,7 +1037,8 @@ compile_cplus_convert_void (compile_cplus_instance *instance, struct type *type)
/* Convert a boolean type to its gcc representation. */
static gcc_type
-compile_cplus_convert_bool (compile_cplus_instance *instance, struct type *type)
+compile_cplus_convert_bool (compile_cplus_instance *instance,
+ struct type *type)
{
return instance->plugin ().get_bool_type ();
}
@@ -1123,15 +1121,15 @@ compile_cplus_convert_namespace (compile_cplus_instance *instance,
accessibility of this type. */
static gcc_type
-convert_type_cplus_basic (compile_cplus_instance *instance,
- struct type *type,
+convert_type_cplus_basic (compile_cplus_instance *instance, struct type *type,
enum gcc_cp_symbol_kind nested_access)
{
/* If we are converting a qualified type, first convert the
unqualified type and then apply the qualifiers. */
- if ((type->instance_flags () & (TYPE_INSTANCE_FLAG_CONST
- | TYPE_INSTANCE_FLAG_VOLATILE
- | TYPE_INSTANCE_FLAG_RESTRICT)) != 0)
+ if ((type->instance_flags ()
+ & (TYPE_INSTANCE_FLAG_CONST | TYPE_INSTANCE_FLAG_VOLATILE
+ | TYPE_INSTANCE_FLAG_RESTRICT))
+ != 0)
return compile_cplus_convert_qualified (instance, type);
switch (type->code ())
@@ -1148,8 +1146,8 @@ convert_type_cplus_basic (compile_cplus_instance *instance,
case TYPE_CODE_STRUCT:
case TYPE_CODE_UNION:
- return
- compile_cplus_convert_struct_or_union (instance, type, nested_access);
+ return compile_cplus_convert_struct_or_union (instance, type,
+ nested_access);
case TYPE_CODE_ENUM:
return compile_cplus_convert_enum (instance, type, nested_access);
@@ -1158,8 +1156,8 @@ convert_type_cplus_basic (compile_cplus_instance *instance,
return compile_cplus_convert_func (instance, type, false);
case TYPE_CODE_METHOD:
- return
- compile_cplus_convert_method (instance, TYPE_SELF_TYPE (type), type);
+ return compile_cplus_convert_method (instance, TYPE_SELF_TYPE (type),
+ type);
case TYPE_CODE_MEMBERPTR:
case TYPE_CODE_METHODPTR:
@@ -1191,8 +1189,7 @@ convert_type_cplus_basic (compile_cplus_instance *instance,
break;
}
- std::string s = string_printf (_("unhandled TYPE_CODE %d"),
- type->code ());
+ std::string s = string_printf (_ ("unhandled TYPE_CODE %d"), type->code ());
return instance->plugin ().error (s.c_str ());
}
@@ -1215,19 +1212,17 @@ compile_cplus_instance::convert_type (struct type *type,
}
void
-compile_cplus_instance::gcc_cplus_enter_scope
- (void *datum, struct gcc_cp_context *gcc_context)
+compile_cplus_instance::gcc_cplus_enter_scope (
+ void *datum, struct gcc_cp_context *gcc_context)
{
}
void
-compile_cplus_instance::gcc_cplus_leave_scope
- (void *datum, struct gcc_cp_context *gcc_context)
+compile_cplus_instance::gcc_cplus_leave_scope (
+ void *datum, struct gcc_cp_context *gcc_context)
{
}
-
-
/* Plug-in forwards. */
/* C++ plug-in wrapper. */
@@ -1255,13 +1250,13 @@ compile_cplus_debug_output ()
{
}
-template <typename T>
+template<typename T>
static void
compile_cplus_debug_output_1 (const T *arg)
{
}
-template <typename T, typename... Targs>
+template<typename T, typename... Targs>
static void
compile_cplus_debug_output (T arg, Targs... Args)
{
@@ -1270,77 +1265,77 @@ compile_cplus_debug_output (T arg, Targs... Args)
compile_cplus_debug_output (Args...);
}
-#define FORWARD(OP,...) m_context->cp_ops->OP(m_context, ##__VA_ARGS__)
-#define OUTPUT_DEBUG_RESULT(R) \
- if (debug_compile_cplus_types) \
- { \
- gdb_puts (": ", gdb_stdlog); \
- compile_cplus_debug_output (R); \
- gdb_putc ('\n', gdb_stdlog); \
- } \
-
-#define GCC_METHOD0(R, N) \
- R gcc_cp_plugin::N () const \
- { \
- if (debug_compile_cplus_types) \
+#define FORWARD(OP, ...) m_context->cp_ops->OP (m_context, ##__VA_ARGS__)
+#define OUTPUT_DEBUG_RESULT(R) \
+ if (debug_compile_cplus_types) \
+ { \
+ gdb_puts (": ", gdb_stdlog); \
+ compile_cplus_debug_output (R); \
+ gdb_putc ('\n', gdb_stdlog); \
+ }
+
+#define GCC_METHOD0(R, N) \
+ R gcc_cp_plugin::N () const \
+ { \
+ if (debug_compile_cplus_types) \
compile_cplus_debug_output (STRINGIFY (N)); \
- auto result = FORWARD (N); \
- OUTPUT_DEBUG_RESULT (result); \
- return result; \
+ auto result = FORWARD (N); \
+ OUTPUT_DEBUG_RESULT (result); \
+ return result; \
}
-#define GCC_METHOD1(R, N, A) \
- R gcc_cp_plugin::N (A a) const \
- { \
- if (debug_compile_cplus_types) \
- compile_cplus_debug_output (STRINGIFY (N), a); \
- auto result = FORWARD (N, a); \
- OUTPUT_DEBUG_RESULT (result); \
- return result; \
+#define GCC_METHOD1(R, N, A) \
+ R gcc_cp_plugin::N (A a) const \
+ { \
+ if (debug_compile_cplus_types) \
+ compile_cplus_debug_output (STRINGIFY (N), a); \
+ auto result = FORWARD (N, a); \
+ OUTPUT_DEBUG_RESULT (result); \
+ return result; \
}
-#define GCC_METHOD2(R, N, A, B) \
- R gcc_cp_plugin::N (A a, B b) const \
- { \
- if (debug_compile_cplus_types) \
- compile_cplus_debug_output (STRINGIFY (N), a, b); \
- auto result = FORWARD (N, a, b); \
- OUTPUT_DEBUG_RESULT (result); \
- return result; \
+#define GCC_METHOD2(R, N, A, B) \
+ R gcc_cp_plugin::N (A a, B b) const \
+ { \
+ if (debug_compile_cplus_types) \
+ compile_cplus_debug_output (STRINGIFY (N), a, b); \
+ auto result = FORWARD (N, a, b); \
+ OUTPUT_DEBUG_RESULT (result); \
+ return result; \
}
-#define GCC_METHOD3(R, N, A, B, C) \
- R gcc_cp_plugin::N (A a, B b, C c) const \
- { \
- if (debug_compile_cplus_types) \
- compile_cplus_debug_output (STRINGIFY (N), a, b, c); \
- auto result = FORWARD (N, a, b, c); \
- OUTPUT_DEBUG_RESULT (result); \
- return result; \
+#define GCC_METHOD3(R, N, A, B, C) \
+ R gcc_cp_plugin::N (A a, B b, C c) const \
+ { \
+ if (debug_compile_cplus_types) \
+ compile_cplus_debug_output (STRINGIFY (N), a, b, c); \
+ auto result = FORWARD (N, a, b, c); \
+ OUTPUT_DEBUG_RESULT (result); \
+ return result; \
}
-#define GCC_METHOD4(R, N, A, B, C, D) \
- R gcc_cp_plugin::N (A a, B b, C c, D d) const \
- { \
- if (debug_compile_cplus_types) \
- compile_cplus_debug_output (STRINGIFY (N), a, b, c, d); \
- auto result = FORWARD (N, a, b, c, d); \
- OUTPUT_DEBUG_RESULT (result); \
- return result; \
+#define GCC_METHOD4(R, N, A, B, C, D) \
+ R gcc_cp_plugin::N (A a, B b, C c, D d) const \
+ { \
+ if (debug_compile_cplus_types) \
+ compile_cplus_debug_output (STRINGIFY (N), a, b, c, d); \
+ auto result = FORWARD (N, a, b, c, d); \
+ OUTPUT_DEBUG_RESULT (result); \
+ return result; \
}
-#define GCC_METHOD5(R, N, A, B, C, D, E) \
- R gcc_cp_plugin::N (A a, B b, C c, D d, E e) const \
- { \
- if (debug_compile_cplus_types) \
- compile_cplus_debug_output (STRINGIFY (N), a, b, c, d, e); \
- auto result = FORWARD (N, a, b, c, d, e); \
- OUTPUT_DEBUG_RESULT (result); \
- return result; \
+#define GCC_METHOD5(R, N, A, B, C, D, E) \
+ R gcc_cp_plugin::N (A a, B b, C c, D d, E e) const \
+ { \
+ if (debug_compile_cplus_types) \
+ compile_cplus_debug_output (STRINGIFY (N), a, b, c, d, e); \
+ auto result = FORWARD (N, a, b, c, d, e); \
+ OUTPUT_DEBUG_RESULT (result); \
+ return result; \
}
-#define GCC_METHOD7(R, N, A, B, C, D, E, F, G) \
- R gcc_cp_plugin::N (A a, B b, C c, D d, E e, F f, G g) const \
- { \
- if (debug_compile_cplus_types) \
- compile_cplus_debug_output (STRINGIFY (N), a, b, c, d, e, f, g); \
- auto result = FORWARD (N, a, b, c, d, e, f, g); \
- OUTPUT_DEBUG_RESULT (result); \
- return result; \
+#define GCC_METHOD7(R, N, A, B, C, D, E, F, G) \
+ R gcc_cp_plugin::N (A a, B b, C c, D d, E e, F f, G g) const \
+ { \
+ if (debug_compile_cplus_types) \
+ compile_cplus_debug_output (STRINGIFY (N), a, b, c, d, e, f, g); \
+ auto result = FORWARD (N, a, b, c, d, e, f, g); \
+ OUTPUT_DEBUG_RESULT (result); \
+ return result; \
}
#include "gcc-cp-fe.def"
@@ -1364,14 +1359,15 @@ gcc_cp_plugin::build_decl (const char *debug_decltype, const char *name,
if (debug_compile_cplus_types)
gdb_printf (gdb_stdlog, "<%s> ", debug_decltype);
- return build_decl (name, sym_kind, sym_type, substitution_name,
- address, filename, line_number);
+ return build_decl (name, sym_kind, sym_type, substitution_name, address,
+ filename, line_number);
}
gcc_type
gcc_cp_plugin::start_class_type (const char *debug_name, gcc_decl typedecl,
const struct gcc_vbase_array *base_classes,
- const char *filename, unsigned int line_number)
+ const char *filename,
+ unsigned int line_number)
{
if (debug_compile_cplus_types)
gdb_printf (gdb_stdlog, "<%s> ", debug_name);
@@ -1399,28 +1395,27 @@ gcc_cp_plugin::pop_binding_level (const char *debug_name)
}
void _initialize_compile_cplus_types ();
+
void
_initialize_compile_cplus_types ()
{
add_setshow_boolean_cmd ("compile-cplus-types", no_class,
- &debug_compile_cplus_types, _("\
-Set debugging of C++ compile type conversion."), _("\
-Show debugging of C++ compile type conversion."), _("\
+ &debug_compile_cplus_types, _ ("\
+Set debugging of C++ compile type conversion."),
+ _ ("\
+Show debugging of C++ compile type conversion."),
+ _ ("\
When enabled debugging messages are printed during C++ type conversion for\n\
the compile commands."),
- nullptr,
- nullptr,
- &setdebuglist,
- &showdebuglist);
+ nullptr, nullptr, &setdebuglist, &showdebuglist);
add_setshow_boolean_cmd ("compile-cplus-scopes", no_class,
- &debug_compile_cplus_scopes, _("\
-Set debugging of C++ compile scopes."), _("\
-Show debugging of C++ compile scopes."), _("\
+ &debug_compile_cplus_scopes, _ ("\
+Set debugging of C++ compile scopes."),
+ _ ("\
+Show debugging of C++ compile scopes."),
+ _ ("\
When enabled debugging messages are printed about definition scopes during\n\
C++ type conversion for the compile commands."),
- nullptr,
- nullptr,
- &setdebuglist,
- &showdebuglist);
+ nullptr, nullptr, &setdebuglist, &showdebuglist);
}
diff --git a/gdb/compile/compile-cplus.h b/gdb/compile/compile-cplus.h
index 91f2e13e0bb..5e495a16d5b 100644
--- a/gdb/compile/compile-cplus.h
+++ b/gdb/compile/compile-cplus.h
@@ -50,7 +50,6 @@ struct scope_component
bool operator== (const scope_component &lhs, const scope_component &rhs);
bool operator!= (const scope_component &lhs, const scope_component &rhs);
-
/* A single compiler scope used to define a type.
A compile_scope is a list of scope_components, where all leading
@@ -71,16 +70,14 @@ public:
using std::vector<scope_component>::operator[];
compile_scope ()
- : m_nested_type (GCC_TYPE_NONE), m_pushed (false)
+ : m_nested_type (GCC_TYPE_NONE),
+ m_pushed (false)
{
}
/* Return the gcc_type of the type if it is a nested definition.
Returns GCC_TYPE_NONE if this type was not nested. */
- gcc_type nested_type ()
- {
- return m_nested_type;
- }
+ gcc_type nested_type () { return m_nested_type; }
private:
@@ -131,8 +128,7 @@ public:
: compile_instance (&gcc_cp->base, m_default_cflags),
m_plugin (gcc_cp)
{
- m_plugin.set_callbacks (gcc_cplus_convert_symbol,
- gcc_cplus_symbol_address,
+ m_plugin.set_callbacks (gcc_cplus_convert_symbol, gcc_cplus_symbol_address,
gcc_cplus_enter_scope, gcc_cplus_leave_scope,
this);
}
@@ -144,9 +140,9 @@ public:
type). GCC_CP_ACCESS_NONE is the default nested access.
The new GCC type is returned. */
- gcc_type convert_type
- (struct type *type,
- enum gcc_cp_symbol_kind nested_access = GCC_CP_ACCESS_NONE);
+ gcc_type convert_type (struct type *type,
+ enum gcc_cp_symbol_kind nested_access
+ = GCC_CP_ACCESS_NONE);
/* Return a handle for the GCC plug-in. */
gcc_cp_plugin &plugin () { return m_plugin; }
diff --git a/gdb/compile/compile-internal.h b/gdb/compile/compile-internal.h
index ecf7c11c120..625f665b038 100644
--- a/gdb/compile/compile-internal.h
+++ b/gdb/compile/compile-internal.h
@@ -60,21 +60,23 @@ extern int compile_register_name_demangle (struct gdbarch *gdbarch,
class compile_file_names
{
public:
+
compile_file_names (std::string source_file, std::string object_file)
- : m_source_file (source_file), m_object_file (object_file)
- {}
+ : m_source_file (source_file),
+ m_object_file (object_file)
+ {
+ }
/* Provide read-only views only. Return 'const char *' instead of
std::string to avoid having to use c_str() everywhere in client
code. */
- const char *source_file () const
- { return m_source_file.c_str (); }
+ const char *source_file () const { return m_source_file.c_str (); }
- const char *object_file () const
- { return m_object_file.c_str (); }
+ const char *object_file () const { return m_object_file.c_str (); }
private:
+
/* Storage for the file names. */
std::string m_source_file;
std::string m_object_file;
diff --git a/gdb/compile/compile-loc2c.c b/gdb/compile/compile-loc2c.c
index 517cf89b9d2..81f708cec5c 100644
--- a/gdb/compile/compile-loc2c.c
+++ b/gdb/compile/compile-loc2c.c
@@ -34,8 +34,6 @@
#include "value.h"
#include "gdbarch.h"
-
-
/* Information about a given instruction. */
struct insn_info
@@ -80,7 +78,7 @@ compute_stack_depth_worker (int start, int *need_tempvar,
enum bfd_endian byte_order, unsigned int addr_size,
const gdb_byte *op_ptr, const gdb_byte *op_end)
{
- const gdb_byte * const base = op_ptr;
+ const gdb_byte *const base = op_ptr;
int stack_depth;
op_ptr += start;
@@ -89,23 +87,23 @@ compute_stack_depth_worker (int start, int *need_tempvar,
while (op_ptr < op_end)
{
- enum dwarf_location_atom op = (enum dwarf_location_atom) *op_ptr;
+ enum dwarf_location_atom op = (enum dwarf_location_atom) * op_ptr;
uint64_t reg;
int64_t offset;
int ndx = op_ptr - base;
-#define SET_CHECK_DEPTH(WHERE) \
- if ((*info)[WHERE].visited) \
- { \
- if ((*info)[WHERE].depth != stack_depth) \
- error (_("inconsistent stack depths")); \
- } \
- else \
- { \
- /* Stack depth not set, so set it. */ \
- (*info)[WHERE].visited = 1; \
- (*info)[WHERE].depth = stack_depth; \
- }
+#define SET_CHECK_DEPTH(WHERE) \
+ if ((*info)[WHERE].visited) \
+ { \
+ if ((*info)[WHERE].depth != stack_depth) \
+ error (_ ("inconsistent stack depths")); \
+ } \
+ else \
+ { \
+ /* Stack depth not set, so set it. */ \
+ (*info)[WHERE].visited = 1; \
+ (*info)[WHERE].depth = stack_depth; \
+ }
SET_CHECK_DEPTH (ndx);
@@ -361,7 +359,7 @@ compute_stack_depth_worker (int start, int *need_tempvar,
break;
default:
- error (_("unhandled DWARF op: %s"), get_DW_OP_name (op));
+ error (_ ("unhandled DWARF op: %s"), get_DW_OP_name (op));
}
}
@@ -388,9 +386,8 @@ compute_stack_depth_worker (int start, int *need_tempvar,
static int
compute_stack_depth (enum bfd_endian byte_order, unsigned int addr_size,
- int *need_tempvar, int *is_tls,
- const gdb_byte *op_ptr, const gdb_byte *op_end,
- int initial_depth,
+ int *need_tempvar, int *is_tls, const gdb_byte *op_ptr,
+ const gdb_byte *op_end, int initial_depth,
std::vector<struct insn_info> *info)
{
std::vector<int> to_do;
@@ -407,9 +404,8 @@ compute_stack_depth (enum bfd_endian byte_order, unsigned int addr_size,
int ndx = to_do.back ();
to_do.pop_back ();
- compute_stack_depth_worker (ndx, need_tempvar, info, &to_do,
- byte_order, addr_size,
- op_ptr, op_end);
+ compute_stack_depth_worker (ndx, need_tempvar, info, &to_do, byte_order,
+ addr_size, op_ptr, op_end);
}
stack_depth = 0;
@@ -425,8 +421,6 @@ compute_stack_depth (enum bfd_endian byte_order, unsigned int addr_size,
return stack_depth + 1;
}
-
-
#define GCC_UINTPTR "__gdb_uintptr"
#define GCC_INTPTR "__gdb_intptr"
@@ -435,8 +429,7 @@ compute_stack_depth (enum bfd_endian byte_order, unsigned int addr_size,
static void
push (int indent, string_file *stream, ULONGEST l)
{
- gdb_printf (stream,
- "%*s__gdb_stack[++__gdb_tos] = (" GCC_UINTPTR ") %s;\n",
+ gdb_printf (stream, "%*s__gdb_stack[++__gdb_tos] = (" GCC_UINTPTR ") %s;\n",
indent, "", hex_string (l));
}
@@ -516,7 +509,7 @@ note_register (int regnum, std::vector<bool> &registers_used)
compile it. We would need a gdbarch method to handle this
situation. */
if (regnum >= registers_used.size ())
- error (_("Expression uses \"cooked\" register and cannot be compiled."));
+ error (_ ("Expression uses \"cooked\" register and cannot be compiled."));
registers_used[regnum] = true;
}
@@ -544,8 +537,8 @@ pushf_register_address (int indent, string_file *stream,
static void
pushf_register (int indent, string_file *stream,
- std::vector<bool> &registers_used,
- struct gdbarch *gdbarch, int regnum, uint64_t offset)
+ std::vector<bool> &registers_used, struct gdbarch *gdbarch,
+ int regnum, uint64_t offset)
{
std::string regname = compile_register_name_mangled (gdbarch, regnum);
@@ -590,14 +583,12 @@ pushf_register (int indent, string_file *stream,
static void
do_compile_dwarf_expr_to_c (int indent, string_file *stream,
- const char *type_name,
- const char *result_name,
+ const char *type_name, const char *result_name,
struct symbol *sym, CORE_ADDR pc,
struct gdbarch *arch,
std::vector<bool> &registers_used,
- unsigned int addr_size,
- const gdb_byte *op_ptr, const gdb_byte *op_end,
- CORE_ADDR *initial,
+ unsigned int addr_size, const gdb_byte *op_ptr,
+ const gdb_byte *op_end, CORE_ADDR *initial,
dwarf2_per_cu_data *per_cu,
dwarf2_per_objfile *per_objfile)
{
@@ -606,7 +597,7 @@ do_compile_dwarf_expr_to_c (int indent, string_file *stream,
static unsigned int scope;
enum bfd_endian byte_order = gdbarch_byte_order (arch);
- const gdb_byte * const base = op_ptr;
+ const gdb_byte *const base = op_ptr;
int need_tempvar = 0;
int is_tls = 0;
std::vector<struct insn_info> info;
@@ -614,15 +605,14 @@ do_compile_dwarf_expr_to_c (int indent, string_file *stream,
++scope;
- gdb_printf (stream, "%*s__attribute__ ((unused)) %s %s;\n",
- indent, "", type_name, result_name);
+ gdb_printf (stream, "%*s__attribute__ ((unused)) %s %s;\n", indent, "",
+ type_name, result_name);
gdb_printf (stream, "%*s{\n", indent, "");
indent += 2;
- stack_depth = compute_stack_depth (byte_order, addr_size,
- &need_tempvar, &is_tls,
- op_ptr, op_end, initial != NULL,
- &info);
+ stack_depth
+ = compute_stack_depth (byte_order, addr_size, &need_tempvar, &is_tls,
+ op_ptr, op_end, initial != NULL, &info);
/* This is a hack until we can add a feature to glibc to let us
properly generate code for TLS. You might think we could emit
@@ -637,30 +627,29 @@ do_compile_dwarf_expr_to_c (int indent, string_file *stream,
struct value *val;
if (frame == NULL)
- error (_("Symbol \"%s\" cannot be used because "
- "there is no selected frame"),
+ error (_ ("Symbol \"%s\" cannot be used because "
+ "there is no selected frame"),
sym->print_name ());
val = read_var_value (sym, NULL, frame);
if (VALUE_LVAL (val) != lval_memory)
- error (_("Symbol \"%s\" cannot be used for compilation evaluation "
- "as its address has not been found."),
+ error (_ ("Symbol \"%s\" cannot be used for compilation evaluation "
+ "as its address has not been found."),
sym->print_name ());
- warning (_("Symbol \"%s\" is thread-local and currently can only "
- "be referenced from the current thread in "
- "compiled code."),
+ warning (_ ("Symbol \"%s\" is thread-local and currently can only "
+ "be referenced from the current thread in "
+ "compiled code."),
sym->print_name ());
- gdb_printf (stream, "%*s%s = %s;\n",
- indent, "", result_name,
+ gdb_printf (stream, "%*s%s = %s;\n", indent, "", result_name,
core_addr_to_string (value_address (val)));
gdb_printf (stream, "%*s}\n", indent - 2, "");
return;
}
- gdb_printf (stream, "%*s" GCC_UINTPTR " __gdb_stack[%d];\n",
- indent, "", stack_depth);
+ gdb_printf (stream, "%*s" GCC_UINTPTR " __gdb_stack[%d];\n", indent, "",
+ stack_depth);
if (need_tempvar)
gdb_printf (stream, "%*s" GCC_UINTPTR " __gdb_tmp;\n", indent, "");
@@ -671,7 +660,7 @@ do_compile_dwarf_expr_to_c (int indent, string_file *stream,
while (op_ptr < op_end)
{
- enum dwarf_location_atom op = (enum dwarf_location_atom) *op_ptr;
+ enum dwarf_location_atom op = (enum dwarf_location_atom) * op_ptr;
uint64_t uoffset, reg;
int64_t offset;
@@ -821,9 +810,9 @@ do_compile_dwarf_expr_to_c (int indent, string_file *stream,
case DW_OP_reg30:
case DW_OP_reg31:
dwarf_expr_require_composition (op_ptr, op_end, "DW_OP_regx");
- pushf_register_address (indent, stream, registers_used, arch,
- dwarf_reg_to_regnum_or_error
- (arch, op - DW_OP_reg0));
+ pushf_register_address (
+ indent, stream, registers_used, arch,
+ dwarf_reg_to_regnum_or_error (arch, op - DW_OP_reg0));
break;
case DW_OP_regx:
@@ -890,15 +879,15 @@ do_compile_dwarf_expr_to_c (int indent, string_file *stream,
b = block_for_pc (pc);
if (!b)
- error (_("No block found for address"));
+ error (_ ("No block found for address"));
framefunc = block_linkage_function (b);
if (!framefunc)
- error (_("No function found for block"));
+ error (_ ("No function found for block"));
- func_get_frame_base_dwarf_block (framefunc, pc,
- &datastart, &datalen);
+ func_get_frame_base_dwarf_block (framefunc, pc, &datastart,
+ &datalen);
op_ptr = safe_read_sleb128 (op_ptr, op_end, &offset);
@@ -907,12 +896,11 @@ do_compile_dwarf_expr_to_c (int indent, string_file *stream,
xsnprintf (fb_name, sizeof (fb_name), "__frame_base_%ld",
(long) (op_ptr - base));
- do_compile_dwarf_expr_to_c (indent, stream,
- GCC_UINTPTR, fb_name,
- sym, pc,
- arch, registers_used, addr_size,
- datastart, datastart + datalen,
- NULL, per_cu, per_objfile);
+ do_compile_dwarf_expr_to_c (indent, stream, GCC_UINTPTR, fb_name,
+ sym, pc, arch, registers_used,
+ addr_size, datastart,
+ datastart + datalen, NULL, per_cu,
+ per_objfile);
pushf (indent, stream, "%s + %s", fb_name, hex_string (offset));
}
@@ -933,15 +921,15 @@ do_compile_dwarf_expr_to_c (int indent, string_file *stream,
break;
case DW_OP_swap:
- gdb_printf (stream,
- "%*s__gdb_tmp = __gdb_stack[__gdb_tos - 1];\n",
+ gdb_printf (stream, "%*s__gdb_tmp = __gdb_stack[__gdb_tos - 1];\n",
indent, "");
gdb_printf (stream,
"%*s__gdb_stack[__gdb_tos - 1] = "
"__gdb_stack[__gdb_tos];\n",
indent, "");
- gdb_printf (stream, ("%*s__gdb_stack[__gdb_tos] = "
- "__gdb_tmp;\n"),
+ gdb_printf (stream,
+ ("%*s__gdb_stack[__gdb_tos] = "
+ "__gdb_tmp;\n"),
indent, "");
break;
@@ -950,8 +938,9 @@ do_compile_dwarf_expr_to_c (int indent, string_file *stream,
break;
case DW_OP_rot:
- gdb_printf (stream, ("%*s__gdb_tmp = "
- "__gdb_stack[__gdb_tos];\n"),
+ gdb_printf (stream,
+ ("%*s__gdb_tmp = "
+ "__gdb_stack[__gdb_tos];\n"),
indent, "");
gdb_printf (stream,
"%*s__gdb_stack[__gdb_tos] = "
@@ -961,7 +950,8 @@ do_compile_dwarf_expr_to_c (int indent, string_file *stream,
"%*s__gdb_stack[__gdb_tos - 1] = "
"__gdb_stack[__gdb_tos -2];\n",
indent, "");
- gdb_printf (stream, "%*s__gdb_stack[__gdb_tos - 2] = "
+ gdb_printf (stream,
+ "%*s__gdb_stack[__gdb_tos - 2] = "
"__gdb_tmp;\n",
indent, "");
break;
@@ -979,8 +969,8 @@ do_compile_dwarf_expr_to_c (int indent, string_file *stream,
mode = c_get_mode_for_size (size);
if (mode == NULL)
- error (_("Unsupported size %d in %s"),
- size, get_DW_OP_name (op));
+ error (_ ("Unsupported size %d in %s"), size,
+ get_DW_OP_name (op));
/* Cast to a pointer of the desired type, then
dereference. */
@@ -1013,9 +1003,10 @@ do_compile_dwarf_expr_to_c (int indent, string_file *stream,
break;
case DW_OP_div:
- binary (indent, stream, ("((" GCC_INTPTR
- ") __gdb_stack[__gdb_tos-1]) / (("
- GCC_INTPTR ") __gdb_stack[__gdb_tos])"));
+ binary (indent, stream,
+ ("((" GCC_INTPTR
+ ") __gdb_stack[__gdb_tos-1]) / ((" GCC_INTPTR
+ ") __gdb_stack[__gdb_tos])"));
break;
case DW_OP_shra:
@@ -1024,10 +1015,10 @@ do_compile_dwarf_expr_to_c (int indent, string_file *stream,
"__gdb_stack[__gdb_tos]");
break;
-#define BINARY(OP) \
- binary (indent, stream, "%s", "__gdb_stack[__gdb_tos-1] " #OP \
- " __gdb_stack[__gdb_tos]"); \
- break
+#define BINARY(OP) \
+ binary (indent, stream, "%s", \
+ "__gdb_stack[__gdb_tos-1] " #OP " __gdb_stack[__gdb_tos]"); \
+ break
case DW_OP_and:
BINARY (&);
@@ -1049,12 +1040,11 @@ do_compile_dwarf_expr_to_c (int indent, string_file *stream,
BINARY (^);
#undef BINARY
-#define COMPARE(OP) \
- binary (indent, stream, \
- "(((" GCC_INTPTR ") __gdb_stack[__gdb_tos-1]) " #OP \
- " ((" GCC_INTPTR \
- ") __gdb_stack[__gdb_tos]))"); \
- break
+#define COMPARE(OP) \
+ binary (indent, stream, \
+ "(((" GCC_INTPTR ") __gdb_stack[__gdb_tos-1]) " #OP \
+ " ((" GCC_INTPTR ") __gdb_stack[__gdb_tos]))"); \
+ break
case DW_OP_le:
COMPARE (<=);
@@ -1077,8 +1067,7 @@ do_compile_dwarf_expr_to_c (int indent, string_file *stream,
LONGEST off;
const gdb_byte *cfa_start, *cfa_end;
- if (dwarf2_fetch_cfa_info (arch, pc, per_cu,
- &regnum, &off,
+ if (dwarf2_fetch_cfa_info (arch, pc, per_cu, &regnum, &off,
&text_offset, &cfa_start, &cfa_end))
{
/* Register. */
@@ -1092,15 +1081,14 @@ do_compile_dwarf_expr_to_c (int indent, string_file *stream,
/* Generate a unique-enough name, in case the CFA is
computed multiple times in this expression. */
- xsnprintf (cfa_name, sizeof (cfa_name),
- "__cfa_%ld", (long) (op_ptr - base));
-
- do_compile_dwarf_expr_to_c (indent, stream,
- GCC_UINTPTR, cfa_name,
- sym, pc, arch, registers_used,
- addr_size,
- cfa_start, cfa_end,
- &text_offset, per_cu, per_objfile);
+ xsnprintf (cfa_name, sizeof (cfa_name), "__cfa_%ld",
+ (long) (op_ptr - base));
+
+ do_compile_dwarf_expr_to_c (indent, stream, GCC_UINTPTR,
+ cfa_name, sym, pc, arch,
+ registers_used, addr_size,
+ cfa_start, cfa_end, &text_offset,
+ per_cu, per_objfile);
pushf (indent, stream, "%s", cfa_name);
}
}
@@ -1130,12 +1118,12 @@ do_compile_dwarf_expr_to_c (int indent, string_file *stream,
break;
default:
- error (_("unhandled DWARF op: %s"), get_DW_OP_name (op));
+ error (_ ("unhandled DWARF op: %s"), get_DW_OP_name (op));
}
}
- gdb_printf (stream, "%*s%s = __gdb_stack[__gdb_tos];\n",
- indent, "", result_name);
+ gdb_printf (stream, "%*s%s = __gdb_stack[__gdb_tos];\n", indent, "",
+ result_name);
gdb_printf (stream, "%*s}\n", indent - 2, "");
}
@@ -1146,9 +1134,8 @@ compile_dwarf_expr_to_c (string_file *stream, const char *result_name,
struct symbol *sym, CORE_ADDR pc,
struct gdbarch *arch,
std::vector<bool> &registers_used,
- unsigned int addr_size,
- const gdb_byte *op_ptr, const gdb_byte *op_end,
- dwarf2_per_cu_data *per_cu,
+ unsigned int addr_size, const gdb_byte *op_ptr,
+ const gdb_byte *op_end, dwarf2_per_cu_data *per_cu,
dwarf2_per_objfile *per_objfile)
{
do_compile_dwarf_expr_to_c (2, stream, GCC_UINTPTR, result_name, sym, pc,
@@ -1159,19 +1146,15 @@ compile_dwarf_expr_to_c (string_file *stream, const char *result_name,
/* See compile.h. */
void
-compile_dwarf_bounds_to_c (string_file *stream,
- const char *result_name,
- const struct dynamic_prop *prop,
- struct symbol *sym, CORE_ADDR pc,
- struct gdbarch *arch,
+compile_dwarf_bounds_to_c (string_file *stream, const char *result_name,
+ const struct dynamic_prop *prop, struct symbol *sym,
+ CORE_ADDR pc, struct gdbarch *arch,
std::vector<bool> &registers_used,
- unsigned int addr_size,
- const gdb_byte *op_ptr, const gdb_byte *op_end,
- dwarf2_per_cu_data *per_cu,
+ unsigned int addr_size, const gdb_byte *op_ptr,
+ const gdb_byte *op_end, dwarf2_per_cu_data *per_cu,
dwarf2_per_objfile *per_objfile)
{
- do_compile_dwarf_expr_to_c (2, stream, "unsigned long ", result_name,
- sym, pc, arch, registers_used,
- addr_size, op_ptr, op_end, NULL, per_cu,
- per_objfile);
+ do_compile_dwarf_expr_to_c (2, stream, "unsigned long ", result_name, sym,
+ pc, arch, registers_used, addr_size, op_ptr,
+ op_end, NULL, per_cu, per_objfile);
}
diff --git a/gdb/compile/compile-object-load.c b/gdb/compile/compile-object-load.c
index 83b97f13105..345cbe2d23b 100644
--- a/gdb/compile/compile-object-load.c
+++ b/gdb/compile/compile-object-load.c
@@ -98,7 +98,6 @@ private:
/* Maximum of alignments of all sections matching LAST_PROT.
This value is always at least 1. This value is always a power of 2. */
CORE_ADDR m_last_max_alignment = -1;
-
};
/* See setup_sections_data. */
@@ -128,17 +127,14 @@ setup_sections_data::setup_one_section (asection *sect)
if (compile_debug)
gdb_printf (gdb_stdlog,
"module \"%s\" section \"%s\" size %s prot %u\n",
- bfd_get_filename (m_bfd),
- bfd_section_name (sect),
- paddress (target_gdbarch (),
- bfd_section_size (sect)),
+ bfd_get_filename (m_bfd), bfd_section_name (sect),
+ paddress (target_gdbarch (), bfd_section_size (sect)),
prot);
}
else
prot = -1;
- if (sect == NULL
- || (m_last_prot != prot && bfd_section_size (sect) != 0))
+ if (sect == NULL || (m_last_prot != prot && bfd_section_size (sect) != 0))
{
CORE_ADDR addr;
asection *sect_iter;
@@ -149,18 +145,16 @@ setup_sections_data::setup_one_section (asection *sect)
m_last_prot);
munmap_list.add (addr, m_last_size);
if (compile_debug)
- gdb_printf (gdb_stdlog,
- "allocated %s bytes at %s prot %u\n",
+ gdb_printf (gdb_stdlog, "allocated %s bytes at %s prot %u\n",
paddress (target_gdbarch (), m_last_size),
- paddress (target_gdbarch (), addr),
- m_last_prot);
+ paddress (target_gdbarch (), addr), m_last_prot);
}
else
addr = 0;
if ((addr & (m_last_max_alignment - 1)) != 0)
- error (_("Inferior compiled module address %s "
- "is not aligned to BFD required %s."),
+ error (_ ("Inferior compiled module address %s "
+ "is not aligned to BFD required %s."),
paddress (target_gdbarch (), addr),
paddress (target_gdbarch (), m_last_max_alignment));
@@ -200,7 +194,7 @@ link_callbacks_multiple_definition (struct bfd_link_info *link_info,
if (link_info->allow_multiple_definition)
return;
- warning (_("Compiled module \"%s\": multiple symbol definitions: %s"),
+ warning (_ ("Compiled module \"%s\": multiple symbol definitions: %s"),
bfd_get_filename (abfd), h->root.string);
}
@@ -211,20 +205,20 @@ link_callbacks_warning (struct bfd_link_info *link_info, const char *xwarning,
const char *symbol, bfd *abfd, asection *section,
bfd_vma address)
{
- warning (_("Compiled module \"%s\" section \"%s\": warning: %s"),
- bfd_get_filename (abfd), bfd_section_name (section),
- xwarning);
+ warning (_ ("Compiled module \"%s\" section \"%s\": warning: %s"),
+ bfd_get_filename (abfd), bfd_section_name (section), xwarning);
}
/* Helper for link_callbacks callbacks vector. */
static void
link_callbacks_undefined_symbol (struct bfd_link_info *link_info,
- const char *name, bfd *abfd, asection *section,
- bfd_vma address, bfd_boolean is_fatal)
+ const char *name, bfd *abfd,
+ asection *section, bfd_vma address,
+ bfd_boolean is_fatal)
{
- warning (_("Cannot resolve relocation to \"%s\" "
- "from compiled module \"%s\" section \"%s\"."),
+ warning (_ ("Cannot resolve relocation to \"%s\" "
+ "from compiled module \"%s\" section \"%s\"."),
name, bfd_get_filename (abfd), bfd_section_name (section));
}
@@ -246,23 +240,21 @@ link_callbacks_reloc_dangerous (struct bfd_link_info *link_info,
const char *message, bfd *abfd,
asection *section, bfd_vma address)
{
- warning (_("Compiled module \"%s\" section \"%s\": dangerous "
- "relocation: %s\n"),
- bfd_get_filename (abfd), bfd_section_name (section),
- message);
+ warning (_ ("Compiled module \"%s\" section \"%s\": dangerous "
+ "relocation: %s\n"),
+ bfd_get_filename (abfd), bfd_section_name (section), message);
}
/* Helper for link_callbacks callbacks vector. */
static void
link_callbacks_unattached_reloc (struct bfd_link_info *link_info,
- const char *name, bfd *abfd, asection *section,
- bfd_vma address)
+ const char *name, bfd *abfd,
+ asection *section, bfd_vma address)
{
- warning (_("Compiled module \"%s\" section \"%s\": unattached "
- "relocation: %s\n"),
- bfd_get_filename (abfd), bfd_section_name (section),
- name);
+ warning (_ ("Compiled module \"%s\" section \"%s\": unattached "
+ "relocation: %s\n"),
+ bfd_get_filename (abfd), bfd_section_name (section), name);
}
/* Helper for link_callbacks callbacks vector. */
@@ -279,30 +271,29 @@ link_callbacks_einfo (const char *fmt, ...)
std::string str = string_vprintf (fmt, ap);
va_end (ap);
- warning (_("Compile module: warning: %s"), str.c_str ());
+ warning (_ ("Compile module: warning: %s"), str.c_str ());
}
/* Helper for bfd_get_relocated_section_contents.
Only these symbols are set by bfd_simple_get_relocated_section_contents
but bfd/ seems to use even the NULL ones without checking them first. */
-static const struct bfd_link_callbacks link_callbacks =
-{
- NULL, /* add_archive_element */
+static const struct bfd_link_callbacks link_callbacks = {
+ NULL, /* add_archive_element */
link_callbacks_multiple_definition, /* multiple_definition */
- NULL, /* multiple_common */
- NULL, /* add_to_set */
- NULL, /* constructor */
- link_callbacks_warning, /* warning */
- link_callbacks_undefined_symbol, /* undefined_symbol */
- link_callbacks_reloc_overflow, /* reloc_overflow */
- link_callbacks_reloc_dangerous, /* reloc_dangerous */
- link_callbacks_unattached_reloc, /* unattached_reloc */
- NULL, /* notice */
- link_callbacks_einfo, /* einfo */
- NULL, /* info */
- NULL, /* minfo */
- NULL, /* override_segment_assignment */
+ NULL, /* multiple_common */
+ NULL, /* add_to_set */
+ NULL, /* constructor */
+ link_callbacks_warning, /* warning */
+ link_callbacks_undefined_symbol, /* undefined_symbol */
+ link_callbacks_reloc_overflow, /* reloc_overflow */
+ link_callbacks_reloc_dangerous, /* reloc_dangerous */
+ link_callbacks_unattached_reloc, /* unattached_reloc */
+ NULL, /* notice */
+ link_callbacks_einfo, /* einfo */
+ NULL, /* info */
+ NULL, /* minfo */
+ NULL, /* override_segment_assignment */
};
struct link_hash_table_cleanup_data
@@ -367,25 +358,26 @@ copy_sections (bfd *abfd, asection *sect, void *data)
link_order.size = bfd_section_size (sect);
link_order.u.indirect.section = sect;
- gdb::unique_xmalloc_ptr<gdb_byte> sect_data
- ((bfd_byte *) xmalloc (bfd_section_size (sect)));
+ gdb::unique_xmalloc_ptr<gdb_byte> sect_data (
+ (bfd_byte *) xmalloc (bfd_section_size (sect)));
- sect_data_got = bfd_get_relocated_section_contents (abfd, &link_info,
- &link_order,
- sect_data.get (),
- FALSE, symbol_table);
+ sect_data_got
+ = bfd_get_relocated_section_contents (abfd, &link_info, &link_order,
+ sect_data.get (), FALSE,
+ symbol_table);
if (sect_data_got == NULL)
- error (_("Cannot map compiled module \"%s\" section \"%s\": %s"),
+ error (_ ("Cannot map compiled module \"%s\" section \"%s\": %s"),
bfd_get_filename (abfd), bfd_section_name (sect),
bfd_errmsg (bfd_get_error ()));
gdb_assert (sect_data_got == sect_data.get ());
inferior_addr = bfd_section_vma (sect);
- if (0 != target_write_memory (inferior_addr, sect_data.get (),
- bfd_section_size (sect)))
- error (_("Cannot write compiled module \"%s\" section \"%s\" "
- "to inferior memory range %s-%s."),
+ if (0
+ != target_write_memory (inferior_addr, sect_data.get (),
+ bfd_section_size (sect)))
+ error (_ ("Cannot write compiled module \"%s\" section \"%s\" "
+ "to inferior memory range %s-%s."),
bfd_get_filename (abfd), bfd_section_name (sect),
paddress (target_gdbarch (), inferior_addr),
paddress (target_gdbarch (),
@@ -433,8 +425,7 @@ get_out_value_type (struct symbol *func_sym, struct objfile *objfile,
block = bv->block (block_loop);
if (block->function () != NULL)
continue;
- gdb_val_sym = block_lookup_symbol (block,
- COMPILE_I_EXPR_VAL,
+ gdb_val_sym = block_lookup_symbol (block, COMPILE_I_EXPR_VAL,
symbol_name_match_type::SEARCH_NAME,
VAR_DOMAIN);
if (gdb_val_sym == NULL)
@@ -455,36 +446,36 @@ get_out_value_type (struct symbol *func_sym, struct objfile *objfile,
break;
}
if (block_loop == nblocks)
- error (_("No \"%s\" symbol found"), COMPILE_I_EXPR_VAL);
+ error (_ ("No \"%s\" symbol found"), COMPILE_I_EXPR_VAL);
gdb_type = gdb_val_sym->type ();
gdb_type = check_typedef (gdb_type);
- gdb_ptr_type_sym = block_lookup_symbol (block, COMPILE_I_EXPR_PTR_TYPE,
- symbol_name_match_type::SEARCH_NAME,
- VAR_DOMAIN);
+ gdb_ptr_type_sym
+ = block_lookup_symbol (block, COMPILE_I_EXPR_PTR_TYPE,
+ symbol_name_match_type::SEARCH_NAME, VAR_DOMAIN);
if (gdb_ptr_type_sym == NULL)
- error (_("No \"%s\" symbol found"), COMPILE_I_EXPR_PTR_TYPE);
+ error (_ ("No \"%s\" symbol found"), COMPILE_I_EXPR_PTR_TYPE);
gdb_ptr_type = gdb_ptr_type_sym->type ();
gdb_ptr_type = check_typedef (gdb_ptr_type);
if (gdb_ptr_type->code () != TYPE_CODE_PTR)
- error (_("Type of \"%s\" is not a pointer"), COMPILE_I_EXPR_PTR_TYPE);
+ error (_ ("Type of \"%s\" is not a pointer"), COMPILE_I_EXPR_PTR_TYPE);
gdb_type_from_ptr = check_typedef (gdb_ptr_type->target_type ());
if (types_deeply_equal (gdb_type, gdb_type_from_ptr))
{
if (scope != COMPILE_I_PRINT_ADDRESS_SCOPE)
- error (_("Expected address scope in compiled module \"%s\"."),
+ error (_ ("Expected address scope in compiled module \"%s\"."),
objfile_name (objfile));
return gdb_type;
}
if (gdb_type->code () != TYPE_CODE_PTR)
- error (_("Invalid type code %d of symbol \"%s\" "
- "in compiled module \"%s\"."),
+ error (_ ("Invalid type code %d of symbol \"%s\" "
+ "in compiled module \"%s\"."),
gdb_type_from_ptr->code (), COMPILE_I_EXPR_VAL,
objfile_name (objfile));
-
+
retval = gdb_type_from_ptr;
switch (gdb_type_from_ptr->code ())
{
@@ -494,15 +485,14 @@ get_out_value_type (struct symbol *func_sym, struct objfile *objfile,
case TYPE_CODE_FUNC:
break;
default:
- error (_("Invalid type code %d of symbol \"%s\" "
- "in compiled module \"%s\"."),
+ error (_ ("Invalid type code %d of symbol \"%s\" "
+ "in compiled module \"%s\"."),
gdb_type_from_ptr->code (), COMPILE_I_EXPR_PTR_TYPE,
objfile_name (objfile));
}
- if (!types_deeply_equal (gdb_type_from_ptr,
- gdb_type->target_type ()))
- error (_("Referenced types do not match for symbols \"%s\" and \"%s\" "
- "in compiled module \"%s\"."),
+ if (!types_deeply_equal (gdb_type_from_ptr, gdb_type->target_type ()))
+ error (_ ("Referenced types do not match for symbols \"%s\" and \"%s\" "
+ "in compiled module \"%s\"."),
COMPILE_I_EXPR_PTR_TYPE, COMPILE_I_EXPR_VAL,
objfile_name (objfile));
if (scope == COMPILE_I_PRINT_ADDRESS_SCOPE)
@@ -525,15 +515,15 @@ get_regs_type (struct symbol *func_sym, struct objfile *objfile)
regsp_type = check_typedef (func_type->field (0).type ());
if (regsp_type->code () != TYPE_CODE_PTR)
- error (_("Invalid type code %d of first parameter of function \"%s\" "
- "in compiled module \"%s\"."),
+ error (_ ("Invalid type code %d of first parameter of function \"%s\" "
+ "in compiled module \"%s\"."),
regsp_type->code (), GCC_FE_WRAPPER_FUNCTION,
objfile_name (objfile));
regs_type = check_typedef (regsp_type->target_type ());
if (regs_type->code () != TYPE_CODE_STRUCT)
- error (_("Invalid type code %d of dereferenced first parameter "
- "of function \"%s\" in compiled module \"%s\"."),
+ error (_ ("Invalid type code %d of dereferenced first parameter "
+ "of function \"%s\" in compiled module \"%s\"."),
regs_type->code (), GCC_FE_WRAPPER_FUNCTION,
objfile_name (objfile));
@@ -566,28 +556,28 @@ store_regs (struct type *regs_type, CORE_ADDR regs_base)
continue;
if ((reg_bitpos % 8) != 0 || reg_bitsize != 0)
- error (_("Invalid register \"%s\" position %s bits or size %s bits"),
+ error (_ ("Invalid register \"%s\" position %s bits or size %s bits"),
reg_name, pulongest (reg_bitpos), pulongest (reg_bitsize));
reg_offset = reg_bitpos / 8;
if (reg_type->code () != TYPE_CODE_INT
&& reg_type->code () != TYPE_CODE_PTR)
- error (_("Invalid register \"%s\" type code %d"), reg_name,
+ error (_ ("Invalid register \"%s\" type code %d"), reg_name,
reg_type->code ());
regnum = compile_register_name_demangle (gdbarch, reg_name);
regval = value_from_register (reg_type, regnum, get_current_frame ());
if (value_optimized_out (regval))
- error (_("Register \"%s\" is optimized out."), reg_name);
+ error (_ ("Register \"%s\" is optimized out."), reg_name);
if (!value_entirely_available (regval))
- error (_("Register \"%s\" is not available."), reg_name);
+ error (_ ("Register \"%s\" is not available."), reg_name);
inferior_addr = regs_base + reg_offset;
- if (0 != target_write_memory (inferior_addr,
- value_contents (regval).data (),
- reg_size))
- error (_("Cannot write register \"%s\" to inferior memory at %s."),
+ if (0
+ != target_write_memory (inferior_addr,
+ value_contents (regval).data (), reg_size))
+ error (_ ("Cannot write register \"%s\" to inferior memory at %s."),
reg_name, paddress (gdbarch, inferior_addr));
}
}
@@ -615,21 +605,20 @@ compile_object_load (const compile_file_names &file_names,
int expect_parameters;
struct type *expect_return_type;
- gdb::unique_xmalloc_ptr<char> filename
- (tilde_expand (file_names.object_file ()));
+ gdb::unique_xmalloc_ptr<char> filename (
+ tilde_expand (file_names.object_file ()));
gdb_bfd_ref_ptr abfd (gdb_bfd_open (filename.get (), gnutarget));
if (abfd == NULL)
- error (_("\"%s\": could not open as compiled module: %s"),
- filename.get (), bfd_errmsg (bfd_get_error ()));
+ error (_ ("\"%s\": could not open as compiled module: %s"),
+ filename.get (), bfd_errmsg (bfd_get_error ()));
if (!bfd_check_format_matches (abfd.get (), bfd_object, &matching))
- error (_("\"%s\": not in loadable format: %s"),
- filename.get (),
+ error (_ ("\"%s\": not in loadable format: %s"), filename.get (),
gdb_bfd_errmsg (bfd_get_error (), matching).c_str ());
if ((bfd_get_file_flags (abfd.get ()) & (EXEC_P | DYNAMIC)) != 0)
- error (_("\"%s\": not in object format."), filename.get ());
+ error (_ ("\"%s\": not in object format."), filename.get ());
struct setup_sections_data setup_sections_data (abfd.get ());
for (asection *sect = abfd->sections; sect != nullptr; sect = sect->next)
@@ -638,27 +627,26 @@ compile_object_load (const compile_file_names &file_names,
storage_needed = bfd_get_symtab_upper_bound (abfd.get ());
if (storage_needed < 0)
- error (_("Cannot read symbols of compiled module \"%s\": %s"),
+ error (_ ("Cannot read symbols of compiled module \"%s\": %s"),
filename.get (), bfd_errmsg (bfd_get_error ()));
/* SYMFILE_VERBOSE is not passed even if FROM_TTY, user is not interested in
"Reading symbols from ..." message for automatically generated file. */
- objfile_up objfile_holder (symbol_file_add_from_bfd (abfd,
- filename.get (),
+ objfile_up objfile_holder (symbol_file_add_from_bfd (abfd, filename.get (),
0, NULL, 0, NULL));
objfile = objfile_holder.get ();
- func_sym = lookup_global_symbol_from_objfile (objfile,
- GLOBAL_BLOCK,
- GCC_FE_WRAPPER_FUNCTION,
- VAR_DOMAIN).symbol;
+ func_sym
+ = lookup_global_symbol_from_objfile (objfile, GLOBAL_BLOCK,
+ GCC_FE_WRAPPER_FUNCTION, VAR_DOMAIN)
+ .symbol;
if (func_sym == NULL)
- error (_("Cannot find function \"%s\" in compiled module \"%s\"."),
+ error (_ ("Cannot find function \"%s\" in compiled module \"%s\"."),
GCC_FE_WRAPPER_FUNCTION, objfile_name (objfile));
func_type = func_sym->type ();
if (func_type->code () != TYPE_CODE_FUNC)
- error (_("Invalid type code %d of function \"%s\" in compiled "
- "module \"%s\"."),
+ error (_ ("Invalid type code %d of function \"%s\" in compiled "
+ "module \"%s\"."),
func_type->code (), GCC_FE_WRAPPER_FUNCTION,
objfile_name (objfile));
@@ -678,26 +666,26 @@ compile_object_load (const compile_file_names &file_names,
expect_return_type = builtin_type (target_gdbarch ())->builtin_void;
break;
default:
- internal_error (_("invalid scope %d"), scope);
+ internal_error (_ ("invalid scope %d"), scope);
}
if (func_type->num_fields () != expect_parameters)
- error (_("Invalid %d parameters of function \"%s\" in compiled "
- "module \"%s\"."),
+ error (_ ("Invalid %d parameters of function \"%s\" in compiled "
+ "module \"%s\"."),
func_type->num_fields (), GCC_FE_WRAPPER_FUNCTION,
objfile_name (objfile));
if (!types_deeply_equal (expect_return_type, func_type->target_type ()))
- error (_("Invalid return type of function \"%s\" in compiled "
- "module \"%s\"."),
+ error (_ ("Invalid return type of function \"%s\" in compiled "
+ "module \"%s\"."),
GCC_FE_WRAPPER_FUNCTION, objfile_name (objfile));
/* The memory may be later needed
by bfd_generic_get_relocated_section_contents
called from default_symfile_relocate. */
- symbol_table = (asymbol **) obstack_alloc (&objfile->objfile_obstack,
- storage_needed);
+ symbol_table
+ = (asymbol **) obstack_alloc (&objfile->objfile_obstack, storage_needed);
number_of_symbols = bfd_canonicalize_symtab (abfd.get (), symbol_table);
if (number_of_symbols < 0)
- error (_("Cannot parse symbols of compiled module \"%s\": %s"),
+ error (_ ("Cannot parse symbols of compiled module \"%s\": %s"),
filename.get (), bfd_errmsg (bfd_get_error ()));
missing_symbols = 0;
@@ -712,8 +700,7 @@ compile_object_load (const compile_file_names &file_names,
if (strcmp (sym->name, "_GLOBAL_OFFSET_TABLE_") == 0)
{
if (compile_debug)
- gdb_printf (gdb_stdlog,
- "ELF symbol \"%s\" relocated to zero\n",
+ gdb_printf (gdb_stdlog, "ELF symbol \"%s\" relocated to zero\n",
sym->name);
/* It seems to be a GCC bug, with -mcmodel=large there should be no
@@ -732,40 +719,40 @@ compile_object_load (const compile_file_names &file_names,
with the SEC_ALLOC flag set. In the unlikely case that
we still do not have a section identified, fall back to using
the "*ABS*" section. */
- asection *toc_fallback = bfd_get_section_by_name(abfd.get(), ".toc");
+ asection *toc_fallback
+ = bfd_get_section_by_name (abfd.get (), ".toc");
if (toc_fallback == NULL)
{
for (asection *tsect = abfd->sections; tsect != nullptr;
tsect = tsect->next)
- {
- if (bfd_section_flags (tsect) & SEC_ALLOC)
- {
- toc_fallback = tsect;
- break;
- }
- }
+ {
+ if (bfd_section_flags (tsect) & SEC_ALLOC)
+ {
+ toc_fallback = tsect;
+ break;
+ }
+ }
}
if (toc_fallback == NULL)
/* If we've gotten here, we have not found a section usable
as a backup for the .toc section. In this case, use the
absolute (*ABS*) section. */
- toc_fallback = bfd_abs_section_ptr;
+ toc_fallback = bfd_abs_section_ptr;
sym->section = toc_fallback;
sym->value = 0x8000;
- bfd_set_gp_value(abfd.get(), toc_fallback->vma);
+ bfd_set_gp_value (abfd.get (), toc_fallback->vma);
if (compile_debug)
- gdb_printf (gdb_stdlog,
- "Connectiong ELF symbol \"%s\" to the .toc section (%s)\n",
- sym->name,
- paddress (target_gdbarch (), sym->value));
+ gdb_printf (
+ gdb_stdlog,
+ "Connectiong ELF symbol \"%s\" to the .toc section (%s)\n",
+ sym->name, paddress (target_gdbarch (), sym->value));
continue;
}
bmsym = lookup_minimal_symbol (sym->name, NULL, NULL);
- switch (bmsym.minsym == NULL
- ? mst_unknown : bmsym.minsym->type ())
+ switch (bmsym.minsym == NULL ? mst_unknown : bmsym.minsym->type ())
{
case mst_text:
case mst_bss:
@@ -774,8 +761,7 @@ compile_object_load (const compile_file_names &file_names,
if (compile_debug)
gdb_printf (gdb_stdlog,
"ELF mst_text symbol \"%s\" relocated to %s\n",
- sym->name,
- paddress (target_gdbarch (), sym->value));
+ sym->name, paddress (target_gdbarch (), sym->value));
break;
case mst_text_gnu_ifunc:
sym->value = gnu_ifunc_resolve_addr (target_gdbarch (),
@@ -784,18 +770,17 @@ compile_object_load (const compile_file_names &file_names,
gdb_printf (gdb_stdlog,
"ELF mst_text_gnu_ifunc symbol \"%s\" "
"relocated to %s\n",
- sym->name,
- paddress (target_gdbarch (), sym->value));
+ sym->name, paddress (target_gdbarch (), sym->value));
break;
default:
- warning (_("Could not find symbol \"%s\" "
- "for compiled module \"%s\"."),
+ warning (_ ("Could not find symbol \"%s\" "
+ "for compiled module \"%s\"."),
sym->name, filename.get ());
missing_symbols++;
}
}
if (missing_symbols)
- error (_("%ld symbols were missing, cannot continue."), missing_symbols);
+ error (_ ("%ld symbols were missing, cannot continue."), missing_symbols);
bfd_map_over_sections (abfd.get (), copy_sections, symbol_table);
@@ -805,16 +790,14 @@ compile_object_load (const compile_file_names &file_names,
else
{
/* Use read-only non-executable memory protection. */
- regs_addr = gdbarch_infcall_mmap (target_gdbarch (),
- regs_type->length (),
- GDB_MMAP_PROT_READ);
+ regs_addr
+ = gdbarch_infcall_mmap (target_gdbarch (), regs_type->length (),
+ GDB_MMAP_PROT_READ);
gdb_assert (regs_addr != 0);
setup_sections_data.munmap_list.add (regs_addr, regs_type->length ());
if (compile_debug)
- gdb_printf (gdb_stdlog,
- "allocated %s bytes at %s for registers\n",
- paddress (target_gdbarch (),
- regs_type->length ()),
+ gdb_printf (gdb_stdlog, "allocated %s bytes at %s for registers\n",
+ paddress (target_gdbarch (), regs_type->length ()),
paddress (target_gdbarch (), regs_addr));
store_regs (regs_type, regs_addr);
}
@@ -826,18 +809,15 @@ compile_object_load (const compile_file_names &file_names,
if (out_value_type == NULL)
return NULL;
check_typedef (out_value_type);
- out_value_addr = gdbarch_infcall_mmap (target_gdbarch (),
- out_value_type->length (),
- (GDB_MMAP_PROT_READ
- | GDB_MMAP_PROT_WRITE));
+ out_value_addr
+ = gdbarch_infcall_mmap (target_gdbarch (), out_value_type->length (),
+ (GDB_MMAP_PROT_READ | GDB_MMAP_PROT_WRITE));
gdb_assert (out_value_addr != 0);
setup_sections_data.munmap_list.add (out_value_addr,
out_value_type->length ());
if (compile_debug)
- gdb_printf (gdb_stdlog,
- "allocated %s bytes at %s for printed value\n",
- paddress (target_gdbarch (),
- out_value_type->length ()),
+ gdb_printf (gdb_stdlog, "allocated %s bytes at %s for printed value\n",
+ paddress (target_gdbarch (), out_value_type->length ()),
paddress (target_gdbarch (), out_value_addr));
}
diff --git a/gdb/compile/compile-object-load.h b/gdb/compile/compile-object-load.h
index a959f83a9fc..f4df6d801cc 100644
--- a/gdb/compile/compile-object-load.h
+++ b/gdb/compile/compile-object-load.h
@@ -90,8 +90,8 @@ struct compile_module
/* A unique pointer for a compile_module. */
typedef std::unique_ptr<compile_module> compile_module_up;
-extern compile_module_up compile_object_load
- (const compile_file_names &fnames,
- enum compile_i_scope_types scope, void *scope_data);
+extern compile_module_up compile_object_load (const compile_file_names &fnames,
+ enum compile_i_scope_types scope,
+ void *scope_data);
#endif /* COMPILE_COMPILE_OBJECT_LOAD_H */
diff --git a/gdb/compile/compile-object-run.c b/gdb/compile/compile-object-run.c
index abdea4d371f..c0164c91e3d 100644
--- a/gdb/compile/compile-object-run.c
+++ b/gdb/compile/compile-object-run.c
@@ -52,6 +52,7 @@ struct do_module_cleanup
discarded. */
static dummy_frame_dtor_ftype do_module_cleanup;
+
static void
do_module_cleanup (void *arg, int registers_valid)
{
@@ -70,8 +71,8 @@ do_module_cleanup (void *arg, int registers_valid)
struct type *ptr_type
= lookup_pointer_type (data->module->out_value_type);
- addr_value = value_from_pointer (ptr_type,
- data->module->out_value_addr);
+ addr_value
+ = value_from_pointer (ptr_type, data->module->out_value_addr);
/* SCOPE_DATA would be stale unless EXECUTEDP != NULL. */
compile_print_value (value_ind (addr_value),
@@ -142,28 +143,29 @@ compile_object_run (compile_module_up &&module)
gdb_assert (func_type->code () == TYPE_CODE_FUNC);
func_val = value_from_pointer (lookup_pointer_type (func_type),
- func_sym->value_block ()->entry_pc ());
+ func_sym->value_block ()->entry_pc ());
vargs = XALLOCAVEC (struct value *, func_type->num_fields ());
if (func_type->num_fields () >= 1)
{
gdb_assert (regs_addr != 0);
- vargs[current_arg] = value_from_pointer
- (func_type->field (current_arg).type (), regs_addr);
+ vargs[current_arg]
+ = value_from_pointer (func_type->field (current_arg).type (),
+ regs_addr);
++current_arg;
}
if (func_type->num_fields () >= 2)
{
gdb_assert (data->module->out_value_addr != 0);
- vargs[current_arg] = value_from_pointer
- (func_type->field (current_arg).type (),
- data->module->out_value_addr);
+ vargs[current_arg]
+ = value_from_pointer (func_type->field (current_arg).type (),
+ data->module->out_value_addr);
++current_arg;
}
gdb_assert (current_arg == func_type->num_fields ());
auto args = gdb::make_array_view (vargs, func_type->num_fields ());
- call_function_by_hand_dummy (func_val, NULL, args,
- do_module_cleanup, data);
+ call_function_by_hand_dummy (func_val, NULL, args, do_module_cleanup,
+ data);
}
catch (const gdb_exception_error &ex)
{
diff --git a/gdb/compile/compile.c b/gdb/compile/compile.c
index c07686c32e0..5a0f6d72f88 100644
--- a/gdb/compile/compile.c
+++ b/gdb/compile/compile.c
@@ -46,8 +46,6 @@
#include "gdbsupport/scoped_ignore_signal.h"
#include "gdbsupport/buildargv.h"
-
-
/* Initial filename for temporary files. */
#define TMP_PREFIX "/tmp/gdbobj-"
@@ -144,10 +142,11 @@ del_symbol_error (void *a)
compile_instance::compile_instance (struct gcc_base_context *gcc_fe,
const char *options)
- : m_gcc_fe (gcc_fe), m_gcc_target_options (options),
+ : m_gcc_fe (gcc_fe),
+ m_gcc_target_options (options),
m_type_map (htab_create_alloc (10, hash_type_map_instance,
- eq_type_map_instance,
- xfree, xcalloc, xfree)),
+ eq_type_map_instance, xfree, xcalloc,
+ xfree)),
m_symbol_err_map (htab_create_alloc (10, hash_symbol_error,
eq_symbol_error, del_symbol_error,
xcalloc, xfree))
@@ -188,7 +187,8 @@ compile_instance::insert_type (struct type *type, gcc_type gcc_type)
/* The type might have already been inserted in order to handle
recursive types. */
if (add != NULL && add->gcc_type_handle != gcc_type)
- error (_("Unexpected type id from GCC, check you use recent enough GCC."));
+ error (
+ _ ("Unexpected type id from GCC, check you use recent enough GCC."));
if (add == NULL)
{
@@ -237,7 +237,7 @@ compile_instance::error_symbol_once (const struct symbol *sym)
gdb::unique_xmalloc_ptr<char> message (err->message);
err->message = NULL;
- error (_("%s"), message.get ());
+ error (_ ("%s"), message.get ());
}
/* Implement "show debug compile". */
@@ -246,11 +246,9 @@ static void
show_compile_debug (struct ui_file *file, int from_tty,
struct cmd_list_element *c, const char *value)
{
- gdb_printf (file, _("Compile debugging is %s.\n"), value);
+ gdb_printf (file, _ ("Compile debugging is %s.\n"), value);
}
-
-
/* Options for the compile command. */
struct compile_options
@@ -259,15 +257,14 @@ struct compile_options
bool raw = false;
};
-using compile_flag_option_def
- = gdb::option::flag_option_def<compile_options>;
+using compile_flag_option_def = gdb::option::flag_option_def<compile_options>;
static const gdb::option::option_def compile_command_option_defs[] = {
compile_flag_option_def {
"raw",
[] (compile_options *opts) { return &opts->raw; },
- N_("Suppress automatic 'void _gdb_expr () { CODE }' wrapping."),
+ N_ ("Suppress automatic 'void _gdb_expr () { CODE }' wrapping."),
},
};
@@ -278,7 +275,7 @@ static const gdb::option::option_def compile_command_option_defs[] = {
static gdb::option::option_def_group
make_compile_options_def_group (compile_options *opts)
{
- return {{compile_command_option_defs}, opts};
+ return { { compile_command_option_defs }, opts };
}
/* Handle the input from the 'compile file' command. The "compile
@@ -296,9 +293,9 @@ compile_file_command (const char *args, int from_tty)
const gdb::option::option_def_group group
= make_compile_options_def_group (&options);
- gdb::option::process_options
- (&args, gdb::option::PROCESS_OPTIONS_UNKNOWN_IS_ERROR,
- group);
+ gdb::option::process_options (&args,
+ gdb::option::PROCESS_OPTIONS_UNKNOWN_IS_ERROR,
+ group);
enum compile_i_scope_types scope
= options.raw ? COMPILE_I_RAW_SCOPE : COMPILE_I_SIMPLE_SCOPE;
@@ -307,7 +304,7 @@ compile_file_command (const char *args, int from_tty)
/* After processing options, check whether we have a filename. */
if (args == nullptr || args[0] == '\0')
- error (_("You must provide a filename for this command."));
+ error (_ ("You must provide a filename for this command."));
args = skip_spaces (args);
std::string abspath = gdb_abspath (args);
@@ -319,13 +316,13 @@ compile_file_command (const char *args, int from_tty)
static void
compile_file_command_completer (struct cmd_list_element *ignore,
- completion_tracker &tracker,
- const char *text, const char *word)
+ completion_tracker &tracker, const char *text,
+ const char *word)
{
const gdb::option::option_def_group group
= make_compile_options_def_group (nullptr);
- if (gdb::option::complete_options
- (tracker, &text, gdb::option::PROCESS_OPTIONS_UNKNOWN_IS_ERROR, group))
+ if (gdb::option::complete_options (
+ tracker, &text, gdb::option::PROCESS_OPTIONS_UNKNOWN_IS_ERROR, group))
return;
word = advance_to_filename_complete_word_point (tracker, text);
@@ -346,8 +343,9 @@ compile_code_command (const char *args, int from_tty)
const gdb::option::option_def_group group
= make_compile_options_def_group (&options);
- gdb::option::process_options
- (&args, gdb::option::PROCESS_OPTIONS_UNKNOWN_IS_ERROR, group);
+ gdb::option::process_options (&args,
+ gdb::option::PROCESS_OPTIONS_UNKNOWN_IS_ERROR,
+ group);
enum compile_i_scope_types scope
= options.raw ? COMPILE_I_RAW_SCOPE : COMPILE_I_SIMPLE_SCOPE;
@@ -367,13 +365,13 @@ compile_code_command (const char *args, int from_tty)
static void
compile_code_command_completer (struct cmd_list_element *ignore,
- completion_tracker &tracker,
- const char *text, const char *word)
+ completion_tracker &tracker, const char *text,
+ const char *word)
{
const gdb::option::option_def_group group
= make_compile_options_def_group (nullptr);
- if (gdb::option::complete_options
- (tracker, &text, gdb::option::PROCESS_OPTIONS_UNKNOWN_IS_ERROR, group))
+ if (gdb::option::complete_options (
+ tracker, &text, gdb::option::PROCESS_OPTIONS_UNKNOWN_IS_ERROR, group))
return;
word = advance_to_expression_complete_word_point (tracker, text);
@@ -406,8 +404,9 @@ compile_print_command (const char *arg, int from_tty)
get_user_print_options (&print_opts);
/* Override global settings with explicit options, if any. */
auto group = make_value_print_options_def_group (&print_opts);
- gdb::option::process_options
- (&arg, gdb::option::PROCESS_OPTIONS_REQUIRE_DELIMITER, group);
+ gdb::option::process_options (&arg,
+ gdb::option::PROCESS_OPTIONS_REQUIRE_DELIMITER,
+ group);
print_command_parse_format (&arg, "compile print", &print_opts);
@@ -440,7 +439,7 @@ do_rmdir (void *arg)
zap = concat ("rm -rf ", dir, (char *) NULL);
wstat = system (zap);
if (wstat == -1 || !WIFEXITED (wstat) || WEXITSTATUS (wstat) != 0)
- warning (_("Could not remove temporary directory %s"), dir);
+ warning (_ ("Could not remove temporary directory %s"), dir);
XDELETEVEC (zap);
}
@@ -462,7 +461,7 @@ get_compile_file_tempdir (void)
#undef TEMPLATE
tempdir_name = mkdtemp (tname);
if (tempdir_name == NULL)
- perror_with_name (_("Could not make temporary directory"));
+ perror_with_name (_ ("Could not make temporary directory"));
tempdir_name = xstrdup (tempdir_name);
make_final_cleanup (do_rmdir, tempdir_name);
@@ -479,10 +478,10 @@ get_new_file_names ()
++seq;
- return compile_file_names (string_printf ("%s%sout%d.c",
- dir, SLASH_STRING, seq),
- string_printf ("%s%sout%d.o",
- dir, SLASH_STRING, seq));
+ return compile_file_names (string_printf ("%s%sout%d.c", dir, SLASH_STRING,
+ seq),
+ string_printf ("%s%sout%d.o", dir, SLASH_STRING,
+ seq));
}
/* Get the block and PC at which to evaluate an expression. */
@@ -543,8 +542,9 @@ static void
show_compile_args (struct ui_file *file, int from_tty,
struct cmd_list_element *c, const char *value)
{
- gdb_printf (file, _("Compile command command-line arguments "
- "are \"%s\".\n"),
+ gdb_printf (file,
+ _ ("Compile command command-line arguments "
+ "are \"%s\".\n"),
value);
}
@@ -557,7 +557,7 @@ static void
show_compile_gcc (struct ui_file *file, int from_tty,
struct cmd_list_element *c, const char *value)
{
- gdb_printf (file, _("Compile command GCC driver filename is \"%s\".\n"),
+ gdb_printf (file, _ ("Compile command GCC driver filename is \"%s\".\n"),
value);
}
@@ -678,8 +678,8 @@ compile_to_object (struct command_line *cmd, const char *cmd_string,
std::string triplet_rx;
if (!target_has_execution ())
- error (_("The program must be running for the compile command to "\
- "work."));
+ error (_ ("The program must be running for the compile command to "
+ "work."));
expr_block = get_expr_block_and_pc (&trash_pc);
expr_pc = get_frame_address_in_block (get_selected_frame (NULL));
@@ -688,7 +688,7 @@ compile_to_object (struct command_line *cmd, const char *cmd_string,
std::unique_ptr<compile_instance> compiler
= current_language->get_compile_instance ();
if (compiler == nullptr)
- error (_("No compiler support for language %s."),
+ error (_ ("No compiler support for language %s."),
current_language->name ());
compiler->set_print_callback (print_callback, NULL);
compiler->set_scope (scope);
@@ -715,7 +715,7 @@ compile_to_object (struct command_line *cmd, const char *cmd_string,
else if (cmd_string != NULL)
input = cmd_string;
else
- error (_("Neither a simple expression, or a multi-line specified."));
+ error (_ ("Neither a simple expression, or a multi-line specified."));
std::string code
= current_language->compute_program (compiler.get (), input, gdbarch,
@@ -728,8 +728,8 @@ compile_to_object (struct command_line *cmd, const char *cmd_string,
if (!compile_gcc.empty ())
{
if (compiler->version () < GCC_FE_VERSION_1)
- error (_("Command 'set compile-gcc' requires GCC version 6 or higher "
- "(libcc1 interface version 1 or higher)"));
+ error (_ ("Command 'set compile-gcc' requires GCC version 6 or higher "
+ "(libcc1 interface version 1 or higher)"));
compiler->set_driver_filename (compile_gcc.c_str ());
}
@@ -762,8 +762,8 @@ compile_to_object (struct command_line *cmd, const char *cmd_string,
gdb_printf (gdb_stdlog, "Passing %d compiler options:\n", argc);
for (argi = 0; argi < argc; argi++)
- gdb_printf (gdb_stdlog, "Compiler option %d: <%s>\n",
- argi, argv[argi]);
+ gdb_printf (gdb_stdlog, "Compiler option %d: <%s>\n", argi,
+ argv[argi]);
}
compile_file_names fnames = get_new_file_names ();
@@ -773,12 +773,12 @@ compile_to_object (struct command_line *cmd, const char *cmd_string,
{
gdb_file_up src = gdb_fopen_cloexec (fnames.source_file (), "w");
if (src == NULL)
- perror_with_name (_("Could not open source file for writing"));
+ perror_with_name (_ ("Could not open source file for writing"));
source_remover.emplace (fnames.source_file ());
if (fputs (code.c_str (), src.get ()) == EOF)
- perror_with_name (_("Could not write to source file"));
+ perror_with_name (_ ("Could not write to source file"));
}
if (compile_debug)
@@ -793,7 +793,7 @@ compile_to_object (struct command_line *cmd, const char *cmd_string,
compiler->set_source_file (fnames.source_file ());
ok = compiler->compile (fnames.object_file (), compile_debug);
if (!ok)
- error (_("Compilation failed."));
+ error (_ ("Compilation failed."));
if (compile_debug)
gdb_printf (gdb_stdlog, "object file produced: %s\n\n",
@@ -825,13 +825,13 @@ eval_compile_command (struct command_line *cmd, const char *cmd_string,
gdb::unlinker object_remover (fnames.object_file ());
gdb::unlinker source_remover (fnames.source_file ());
- compile_module_up compile_module = compile_object_load (fnames, scope,
- scope_data);
+ compile_module_up compile_module
+ = compile_object_load (fnames, scope, scope_data);
if (compile_module == NULL)
{
gdb_assert (scope == COMPILE_I_PRINT_ADDRESS_SCOPE);
- eval_compile_command (cmd, cmd_string,
- COMPILE_I_PRINT_VALUE_SCOPE, scope_data);
+ eval_compile_command (cmd, cmd_string, COMPILE_I_PRINT_VALUE_SCOPE,
+ scope_data);
return;
}
@@ -855,31 +855,31 @@ compile_register_name_mangled (struct gdbarch *gdbarch, int regnum)
/* See compile/compile-internal.h. */
int
-compile_register_name_demangle (struct gdbarch *gdbarch,
- const char *regname)
+compile_register_name_demangle (struct gdbarch *gdbarch, const char *regname)
{
int regnum;
if (regname[0] != '_' || regname[1] != '_')
- error (_("Invalid register name \"%s\"."), regname);
+ error (_ ("Invalid register name \"%s\"."), regname);
regname += 2;
for (regnum = 0; regnum < gdbarch_num_regs (gdbarch); regnum++)
if (strcmp (regname, gdbarch_register_name (gdbarch, regnum)) == 0)
return regnum;
- error (_("Cannot find gdbarch register \"%s\"."), regname);
+ error (_ ("Cannot find gdbarch register \"%s\"."), regname);
}
/* Forwards to the plug-in. */
-#define FORWARD(OP,...) (m_gcc_fe->ops->OP (m_gcc_fe, ##__VA_ARGS__))
+#define FORWARD(OP, ...) (m_gcc_fe->ops->OP (m_gcc_fe, ##__VA_ARGS__))
/* See compile-internal.h. */
void
-compile_instance::set_print_callback
- (void (*print_function) (void *, const char *), void *datum)
+compile_instance::set_print_callback (void (*print_function) (void *,
+ const char *),
+ void *datum)
{
FORWARD (set_print_callback, print_function, datum);
}
@@ -956,21 +956,22 @@ compile_instance::compile (const char *filename, int verbose_level)
cmd_list_element *compile_cmd_element = nullptr;
void _initialize_compile ();
+
void
_initialize_compile ()
{
struct cmd_list_element *c = NULL;
- compile_cmd_element = add_prefix_cmd ("compile", class_obscure,
- compile_command, _("\
+ compile_cmd_element
+ = add_prefix_cmd ("compile", class_obscure, compile_command, _ ("\
Command to compile source code and inject it into the inferior."),
- &compile_command_list, 1, &cmdlist);
+ &compile_command_list, 1, &cmdlist);
add_com_alias ("expression", compile_cmd_element, class_obscure, 0);
const auto compile_opts = make_compile_options_def_group (nullptr);
static const std::string compile_code_help
- = gdb::option::build_help (_("\
+ = gdb::option::build_help (_ ("\
Compile, inject, and execute code.\n\
\n\
Usage: compile code [OPTION]... [CODE]\n\
@@ -989,12 +990,11 @@ indicate the end of the expression."),
compile_opts);
c = add_cmd ("code", class_obscure, compile_code_command,
- compile_code_help.c_str (),
- &compile_command_list);
+ compile_code_help.c_str (), &compile_command_list);
set_cmd_completer_handle_brkchars (c, compile_code_command_completer);
-static const std::string compile_file_help
- = gdb::option::build_help (_("\
+ static const std::string compile_file_help
+ = gdb::option::build_help (_ ("\
Evaluate a file containing source code.\n\
\n\
Usage: compile file [OPTION].. [FILENAME]\n\
@@ -1004,14 +1004,13 @@ Options:\n\
compile_opts);
c = add_cmd ("file", class_obscure, compile_file_command,
- compile_file_help.c_str (),
- &compile_command_list);
+ compile_file_help.c_str (), &compile_command_list);
set_cmd_completer_handle_brkchars (c, compile_file_command_completer);
const auto compile_print_opts = make_value_print_options_def_group (nullptr);
static const std::string compile_print_help
- = gdb::option::build_help (_("\
+ = gdb::option::build_help (_ ("\
Evaluate EXPR by using the compiler and print result.\n\
\n\
Usage: compile print [[OPTION]... --] [/FMT] [EXPR]\n\
@@ -1037,38 +1036,37 @@ but no count or size letter (see \"x\" command)."),
compile_print_opts);
c = add_cmd ("print", class_obscure, compile_print_command,
- compile_print_help.c_str (),
- &compile_command_list);
+ compile_print_help.c_str (), &compile_command_list);
set_cmd_completer_handle_brkchars (c, print_command_completer);
- add_setshow_boolean_cmd ("compile", class_maintenance, &compile_debug, _("\
-Set compile command debugging."), _("\
-Show compile command debugging."), _("\
+ add_setshow_boolean_cmd ("compile", class_maintenance, &compile_debug, _ ("\
+Set compile command debugging."),
+ _ ("\
+Show compile command debugging."),
+ _ ("\
When on, compile command debugging is enabled."),
- NULL, show_compile_debug,
- &setdebuglist, &showdebuglist);
-
- add_setshow_string_cmd ("compile-args", class_support,
- &compile_args,
- _("Set compile command GCC command-line arguments."),
- _("Show compile command GCC command-line arguments."),
- _("\
+ NULL, show_compile_debug, &setdebuglist,
+ &showdebuglist);
+
+ add_setshow_string_cmd (
+ "compile-args", class_support, &compile_args,
+ _ ("Set compile command GCC command-line arguments."),
+ _ ("Show compile command GCC command-line arguments."), _ ("\
Use options like -I (include file directory) or ABI settings.\n\
String quoting is parsed like in shell, for example:\n\
-mno-align-double \"-I/dir with a space/include\""),
- set_compile_args, show_compile_args, &setlist, &showlist);
-
+ set_compile_args, show_compile_args, &setlist, &showlist);
/* Initialize compile_args_argv. */
set_compile_args (compile_args.c_str (), 0, NULL);
add_setshow_optional_filename_cmd ("compile-gcc", class_support,
&compile_gcc,
- _("Set compile command "
- "GCC driver filename."),
- _("Show compile command "
- "GCC driver filename."),
- _("\
+ _ ("Set compile command "
+ "GCC driver filename."),
+ _ ("Show compile command "
+ "GCC driver filename."),
+ _ ("\
It should be absolute filename of the gcc executable.\n\
If empty the default target triplet will be searched in $PATH."),
NULL, show_compile_gcc, &setlist,
diff --git a/gdb/compile/compile.h b/gdb/compile/compile.h
index a3b6a18fe20..54dc7692557 100644
--- a/gdb/compile/compile.h
+++ b/gdb/compile/compile.h
@@ -33,12 +33,10 @@ struct dynamic_prop;
class compile_instance
{
public:
+
compile_instance (struct gcc_base_context *gcc_fe, const char *options);
- virtual ~compile_instance ()
- {
- m_gcc_fe->ops->destroy (m_gcc_fe);
- }
+ virtual ~compile_instance () { m_gcc_fe->ops->destroy (m_gcc_fe); }
/* Returns the GCC options to be passed during compilation. */
const std::string &gcc_target_options () const
@@ -96,28 +94,16 @@ public:
bool compile (const char *filename, int verbose_level = -1);
/* Set the scope type for this compile. */
- void set_scope (enum compile_i_scope_types scope)
- {
- m_scope = scope;
- }
+ void set_scope (enum compile_i_scope_types scope) { m_scope = scope; }
/* Return the scope type. */
- enum compile_i_scope_types scope () const
- {
- return m_scope;
- }
+ enum compile_i_scope_types scope () const { return m_scope; }
/* Set the block to be used for symbol searches. */
- void set_block (const struct block *block)
- {
- m_block = block;
- }
+ void set_block (const struct block *block) { m_block = block; }
/* Return the search block. */
- const struct block *block () const
- {
- return m_block;
- }
+ const struct block *block () const { return m_block; }
protected:
@@ -175,17 +161,11 @@ extern void eval_compile_command (struct command_line *cmd,
PER_OBJFILE is the per-objfile object also used for looking up various other
things. */
-extern void compile_dwarf_expr_to_c (string_file *stream,
- const char *result_name,
- struct symbol *sym,
- CORE_ADDR pc,
- struct gdbarch *arch,
- std::vector<bool> &registers_used,
- unsigned int addr_size,
- const gdb_byte *op_ptr,
- const gdb_byte *op_end,
- dwarf2_per_cu_data *per_cu,
- dwarf2_per_objfile *per_objfile);
+extern void compile_dwarf_expr_to_c (
+ string_file *stream, const char *result_name, struct symbol *sym,
+ CORE_ADDR pc, struct gdbarch *arch, std::vector<bool> &registers_used,
+ unsigned int addr_size, const gdb_byte *op_ptr, const gdb_byte *op_end,
+ dwarf2_per_cu_data *per_cu, dwarf2_per_objfile *per_objfile);
/* Compile a DWARF bounds expression to C, suitable for use by the
compiler.
@@ -214,17 +194,12 @@ extern void compile_dwarf_expr_to_c (string_file *stream,
PER_OBJFILE is the per-objfile object also used for looking up various other
things. */
-extern void compile_dwarf_bounds_to_c (string_file *stream,
- const char *result_name,
- const struct dynamic_prop *prop,
- struct symbol *sym, CORE_ADDR pc,
- struct gdbarch *arch,
- std::vector<bool> &registers_used,
- unsigned int addr_size,
- const gdb_byte *op_ptr,
- const gdb_byte *op_end,
- dwarf2_per_cu_data *per_cu,
- dwarf2_per_objfile *per_objfile);
+extern void compile_dwarf_bounds_to_c (
+ string_file *stream, const char *result_name,
+ const struct dynamic_prop *prop, struct symbol *sym, CORE_ADDR pc,
+ struct gdbarch *arch, std::vector<bool> &registers_used,
+ unsigned int addr_size, const gdb_byte *op_ptr, const gdb_byte *op_end,
+ dwarf2_per_cu_data *per_cu, dwarf2_per_objfile *per_objfile);
extern void compile_print_value (struct value *val, void *data_voidp);
diff --git a/gdb/compile/gcc-c-plugin.h b/gdb/compile/gcc-c-plugin.h
index 7595197007b..f151d4caaf2 100644
--- a/gdb/compile/gcc-c-plugin.h
+++ b/gdb/compile/gcc-c-plugin.h
@@ -38,8 +38,8 @@ public:
gcc_c_symbol_address_function *address_oracle,
void *datum)
{
- m_context->c_ops->set_callbacks (m_context, binding_oracle,
- address_oracle, datum);
+ m_context->c_ops->set_callbacks (m_context, binding_oracle, address_oracle,
+ datum);
}
/* Returns the interface version of the compiler plug-in. */
@@ -64,6 +64,7 @@ public:
#undef GCC_METHOD7
private:
+
/* The GCC C context. */
struct gcc_c_context *m_context;
};
diff --git a/gdb/complaints.c b/gdb/complaints.c
index 302f107b519..b198a5c6cfe 100644
--- a/gdb/complaints.c
+++ b/gdb/complaints.c
@@ -60,7 +60,7 @@ complaint_internal (const char *fmt, ...)
(*deprecated_warning_hook) (fmt, args);
else
{
- gdb_puts (_("During symbol reading: "), gdb_stderr);
+ gdb_puts (_ ("During symbol reading: "), gdb_stderr);
gdb_vprintf (gdb_stderr, fmt, args);
gdb_puts ("\n", gdb_stderr);
}
@@ -111,7 +111,7 @@ complaint_interceptor::~complaint_interceptor ()
if (m_saved_warning_hook)
wrap_warning_hook (m_saved_warning_hook, str.c_str ());
else
- gdb_printf (gdb_stderr, _("During symbol reading: %s\n"),
+ gdb_printf (gdb_stderr, _ ("During symbol reading: %s\n"),
str.c_str ());
}
@@ -134,13 +134,15 @@ static void
complaints_show_value (struct ui_file *file, int from_tty,
struct cmd_list_element *cmd, const char *value)
{
- gdb_printf (file, _("Max number of complaints about incorrect"
- " symbols is %s.\n"),
+ gdb_printf (file,
+ _ ("Max number of complaints about incorrect"
+ " symbols is %s.\n"),
value);
}
#if GDB_SELF_TEST
-namespace selftests {
+namespace selftests
+{
/* Entry point for complaints unit tests. */
@@ -151,25 +153,29 @@ test_complaints ()
scoped_restore reset_counters = make_scoped_restore (&counters, tmp);
scoped_restore reset_stop_whining = make_scoped_restore (&stop_whining, 2);
-#define CHECK_COMPLAINT(STR, CNT) \
- do \
- { \
- std::string output; \
- execute_fn_to_string (output, []() { complaint (STR); }, false); \
- std::string expected \
- = _("During symbol reading: ") + std::string (STR "\n"); \
- SELF_CHECK (output == expected); \
- SELF_CHECK (counters[STR] == CNT); \
- } while (0)
-
-#define CHECK_COMPLAINT_SILENT(STR, CNT) \
- do \
- { \
- std::string output; \
- execute_fn_to_string (output, []() { complaint (STR); }, false); \
- SELF_CHECK (output.empty ()); \
- SELF_CHECK (counters[STR] == CNT); \
- } while (0)
+#define CHECK_COMPLAINT(STR, CNT) \
+ do \
+ { \
+ std::string output; \
+ execute_fn_to_string ( \
+ output, [] () { complaint (STR); }, false); \
+ std::string expected \
+ = _ ("During symbol reading: ") + std::string (STR "\n"); \
+ SELF_CHECK (output == expected); \
+ SELF_CHECK (counters[STR] == CNT); \
+ } \
+ while (0)
+
+#define CHECK_COMPLAINT_SILENT(STR, CNT) \
+ do \
+ { \
+ std::string output; \
+ execute_fn_to_string ( \
+ output, [] () { complaint (STR); }, false); \
+ SELF_CHECK (output.empty ()); \
+ SELF_CHECK (counters[STR] == CNT); \
+ } \
+ while (0)
CHECK_COMPLAINT ("maintenance complaint 0", 1);
CHECK_COMPLAINT ("maintenance complaint 0", 2);
@@ -182,20 +188,20 @@ test_complaints ()
#undef CHECK_COMPLAINT_SILENT
}
-
} // namespace selftests
#endif /* GDB_SELF_TEST */
void _initialize_complaints ();
+
void
_initialize_complaints ()
{
- add_setshow_zinteger_cmd ("complaints", class_support,
- &stop_whining, _("\
-Set max number of complaints about incorrect symbols."), _("\
-Show max number of complaints about incorrect symbols."), NULL,
- NULL, complaints_show_value,
- &setlist, &showlist);
+ add_setshow_zinteger_cmd ("complaints", class_support, &stop_whining, _ ("\
+Set max number of complaints about incorrect symbols."),
+ _ ("\
+Show max number of complaints about incorrect symbols."),
+ NULL, NULL, complaints_show_value, &setlist,
+ &showlist);
#if GDB_SELF_TEST
selftests::register_test ("complaints", selftests::test_complaints);
diff --git a/gdb/complaints.h b/gdb/complaints.h
index e9e846684ac..0b0461d09d3 100644
--- a/gdb/complaints.h
+++ b/gdb/complaints.h
@@ -17,15 +17,13 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
-
-#if !defined (COMPLAINTS_H)
+#if !defined(COMPLAINTS_H)
#define COMPLAINTS_H
#include <unordered_set>
/* Helper for complaint. */
-extern void complaint_internal (const char *fmt, ...)
- ATTRIBUTE_PRINTF (1, 2);
+extern void complaint_internal (const char *fmt, ...) ATTRIBUTE_PRINTF (1, 2);
/* This controls whether complaints are emitted. */
@@ -44,12 +42,12 @@ have_complaint ()
avoid computing complaint's arguments when complaints are disabled.
Running FMT via gettext [i.e., _(FMT)] can be quite expensive, for
example. */
-#define complaint(FMT, ...) \
- do \
- { \
- if (have_complaint ()) \
- complaint_internal (FMT, ##__VA_ARGS__); \
- } \
+#define complaint(FMT, ...) \
+ do \
+ { \
+ if (have_complaint ()) \
+ complaint_internal (FMT, ##__VA_ARGS__); \
+ } \
while (0)
/* Clear out / initialize all complaint counters that have ever been
@@ -79,12 +77,11 @@ private:
/* The saved value of deprecated_warning_hook. */
void (*m_saved_warning_hook) (const char *, va_list)
- ATTRIBUTE_FPTR_PRINTF (1,0);
+ ATTRIBUTE_FPTR_PRINTF (1, 0);
/* A helper function that is used by the 'complaint' implementation
to issue a complaint. */
- static void issue_complaint (const char *, va_list)
- ATTRIBUTE_PRINTF (1, 0);
+ static void issue_complaint (const char *, va_list) ATTRIBUTE_PRINTF (1, 0);
/* This object. Used by the static callback function. */
static complaint_interceptor *g_complaint_interceptor;
diff --git a/gdb/completer.c b/gdb/completer.c
index 91a29daee36..ef9e3749fcb 100644
--- a/gdb/completer.c
+++ b/gdb/completer.c
@@ -20,7 +20,7 @@
#include "symtab.h"
#include "gdbtypes.h"
#include "expression.h"
-#include "filenames.h" /* For DOSish file names. */
+#include "filenames.h" /* For DOSish file names. */
#include "language.h"
#include "gdbsupport/gdb_signals.h"
#include "target.h"
@@ -50,6 +50,7 @@
class completion_tracker::completion_hash_entry
{
public:
+
/* Constructor. */
completion_hash_entry (gdb::unique_xmalloc_ptr<char> name,
gdb::unique_xmalloc_ptr<char> lcd)
@@ -63,18 +64,12 @@ public:
string will only be valid while this hash entry is still valid as the
string continues to be owned by this hash entry and will be released
when this entry is deleted. */
- char *get_lcd () const
- {
- return m_lcd.get ();
- }
+ char *get_lcd () const { return m_lcd.get (); }
/* Get, and release the name field from this hash entry. This can only
be called once, after which the name field is no longer valid. This
should be used to pass ownership of the name to someone else. */
- char *release_name ()
- {
- return m_name.release ();
- }
+ char *release_name () { return m_name.release (); }
/* Return true of the name in this hash entry is STR. */
bool is_name_eq (const char *str) const
@@ -83,10 +78,7 @@ public:
}
/* Return the hash value based on the name of the entry. */
- hashval_t hash_name () const
- {
- return htab_hash_string (m_name.get ());
- }
+ hashval_t hash_name () const { return htab_hash_string (m_name.get ()); }
private:
@@ -122,20 +114,20 @@ static gdb_completer_state current_completion;
enum explicit_location_match_type
{
- /* The filename of a source file. */
- MATCH_SOURCE,
+ /* The filename of a source file. */
+ MATCH_SOURCE,
- /* The name of a function or method. */
- MATCH_FUNCTION,
+ /* The name of a function or method. */
+ MATCH_FUNCTION,
- /* The fully-qualified name of a function or method. */
- MATCH_QUALIFIED,
+ /* The fully-qualified name of a function or method. */
+ MATCH_QUALIFIED,
- /* A line number. */
- MATCH_LINE,
+ /* A line number. */
+ MATCH_LINE,
- /* The name of a label. */
- MATCH_LABEL
+ /* The name of a label. */
+ MATCH_LABEL
};
/* Prototypes for local functions. */
@@ -159,8 +151,8 @@ enum explicit_location_match_type
readline library sees one in any of the current completion strings,
it thinks that the string needs to be quoted and automatically
supplies a leading quote. */
-static const char gdb_completer_command_word_break_characters[] =
-" \t\n!@#$%^&*()+=|~`}{[]\"';:?/><,";
+static const char gdb_completer_command_word_break_characters[]
+ = " \t\n!@#$%^&*()+=|~`}{[]\"';:?/><,";
/* When completing on file names, we remove from the list of word
break characters any characters that are commonly used in file
@@ -179,7 +171,7 @@ static const char gdb_completer_file_name_break_characters[] =
we can't include '"' because the gdb C parser treats such quoted
sequences as strings. */
static const char gdb_completer_quote_characters[] = "'";
-
+
/* Accessor for some completer data that may interest other files. */
const char *
@@ -192,8 +184,7 @@ get_gdb_completer_quote_characters (void)
symbols but don't want to complete on anything else either. */
void
-noop_completer (struct cmd_list_element *ignore,
- completion_tracker &tracker,
+noop_completer (struct cmd_list_element *ignore, completion_tracker &tracker,
const char *text, const char *prefix)
{
}
@@ -202,16 +193,16 @@ noop_completer (struct cmd_list_element *ignore,
void
filename_completer (struct cmd_list_element *ignore,
- completion_tracker &tracker,
- const char *text, const char *word)
+ completion_tracker &tracker, const char *text,
+ const char *word)
{
int subsequent_name;
subsequent_name = 0;
while (1)
{
- gdb::unique_xmalloc_ptr<char> p_rl
- (rl_filename_completion_function (text, subsequent_name));
+ gdb::unique_xmalloc_ptr<char> p_rl (
+ rl_filename_completion_function (text, subsequent_name));
if (p_rl == NULL)
break;
/* We need to set subsequent_name to a non-zero value before the
@@ -225,8 +216,8 @@ filename_completer (struct cmd_list_element *ignore,
if (p[strlen (p) - 1] == '~')
continue;
- tracker.add_completion
- (make_completion_match_str (std::move (p_rl), text, word));
+ tracker.add_completion (make_completion_match_str (std::move (p_rl),
+ text, word));
}
#if 0
/* There is no way to do this just long enough to affect quote
@@ -246,8 +237,8 @@ filename_completer_handle_brkchars (struct cmd_list_element *ignore,
completion_tracker &tracker,
const char *text, const char *word)
{
- set_rl_completer_word_break_characters
- (gdb_completer_file_name_break_characters);
+ set_rl_completer_word_break_characters (
+ gdb_completer_file_name_break_characters);
}
/* Find the bounds of the current word for completion purposes, and
@@ -272,9 +263,8 @@ struct gdb_rl_completion_word_info
};
static const char *
-gdb_rl_find_completion_word (struct gdb_rl_completion_word_info *info,
- int *qc, int *dp,
- const char *line_buffer)
+gdb_rl_find_completion_word (struct gdb_rl_completion_word_info *info, int *qc,
+ int *dp, const char *line_buffer)
{
int scan, end, delimiter, pass_next, isbrk;
char quote_char;
@@ -303,9 +293,7 @@ gdb_rl_find_completion_word (struct gdb_rl_completion_word_info *info,
/* We have a list of characters which can be used in pairs to
quote substrings for the completer. Try to find the start of
an unclosed quoted substring. */
- for (scan = pass_next = 0;
- scan < end;
- scan++)
+ for (scan = pass_next = 0; scan < end; scan++)
{
if (pass_next)
{
@@ -473,8 +461,8 @@ complete_nested_command_line (completion_tracker &tracker, const char *text)
size_t save_custom_word_point = tracker.custom_word_point ();
int quote_char = '\0';
- const char *word = completion_find_completion_word (tracker, text,
- &quote_char);
+ const char *word
+ = completion_find_completion_word (tracker, text, &quote_char);
if (tracker.use_custom_word_point ())
{
@@ -501,8 +489,8 @@ complete_nested_command_line (completion_tracker &tracker, const char *text)
etc. */
static void
-complete_files_symbols (completion_tracker &tracker,
- const char *text, const char *word)
+complete_files_symbols (completion_tracker &tracker, const char *text,
+ const char *word)
{
completion_list fn_list;
const char *p;
@@ -533,7 +521,7 @@ complete_files_symbols (completion_tracker &tracker,
if (*p == quote_found)
quote_found = 0;
else
- break; /* Hit the end of text. */
+ break; /* Hit the end of text. */
}
#if HAVE_DOS_BASED_FILE_SYSTEM
/* If we have a DOS-style absolute file name at the beginning of
@@ -563,9 +551,7 @@ complete_files_symbols (completion_tracker &tracker,
strncpy (file_to_match, text, colon - text);
file_to_match[colon - text] = '\0';
/* Remove trailing colons and quotes from the file name. */
- for (s = file_to_match + (colon - text);
- s > file_to_match;
- s--)
+ for (s = file_to_match + (colon - text); s > file_to_match; s--)
if (*s == ':' || *s == quote_char)
*s = '\0';
}
@@ -574,11 +560,9 @@ complete_files_symbols (completion_tracker &tracker,
symbols as well as on files. */
if (colon)
{
- collect_file_symbol_completion_matches (tracker,
- complete_symbol_mode::EXPRESSION,
- symbol_name_match_type::EXPRESSION,
- symbol_start, word,
- file_to_match);
+ collect_file_symbol_completion_matches (
+ tracker, complete_symbol_mode::EXPRESSION,
+ symbol_name_match_type::EXPRESSION, symbol_start, word, file_to_match);
xfree (file_to_match);
}
else
@@ -591,8 +575,7 @@ complete_files_symbols (completion_tracker &tracker,
symbol_start, word);
/* If text includes characters which cannot appear in a file
name, they cannot be asking for completion on files. */
- if (strcspn (text,
- gdb_completer_file_name_break_characters) == text_len)
+ if (strcspn (text, gdb_completer_file_name_break_characters) == text_len)
fn_list = make_source_files_completion_list (text, text);
}
@@ -613,7 +596,7 @@ complete_files_symbols (completion_tracker &tracker,
completion, because rl_complete will prepend "/foo/" to each
candidate completion. The loop below removes that leading
part. */
- for (const auto &fn_up: fn_list)
+ for (const auto &fn_up : fn_list)
{
char *fn = fn_up.get ();
memmove (fn, fn + (word - text), strlen (fn) + 1 - (word - text));
@@ -642,9 +625,7 @@ complete_source_filenames (const char *text)
/* If text includes characters which cannot appear in a file name,
the user cannot be asking for completion on files. */
- if (strcspn (text,
- gdb_completer_file_name_break_characters)
- == text_len)
+ if (strcspn (text, gdb_completer_file_name_break_characters) == text_len)
return make_source_files_completion_list (text, text);
return {};
@@ -674,25 +655,13 @@ complete_address_and_linespec_locations (completion_tracker &tracker,
/* The explicit location options. Note that indexes into this array
must match the explicit_location_match_type enumerators. */
-static const char *const explicit_options[] =
- {
- "-source",
- "-function",
- "-qualified",
- "-line",
- "-label",
- NULL
- };
+static const char *const explicit_options[]
+ = { "-source", "-function", "-qualified", "-line", "-label", NULL };
/* The probe modifier options. These can appear before a location in
breakpoint commands. */
-static const char *const probe_options[] =
- {
- "-probe",
- "-probe-stap",
- "-probe-dtrace",
- NULL
- };
+static const char *const probe_options[]
+ = { "-probe", "-probe-stap", "-probe-dtrace", NULL };
/* Returns STRING if not NULL, the empty string otherwise. */
@@ -754,8 +723,7 @@ collect_explicit_location_matches (completion_tracker &tracker,
linespec_complete_label (tracker, language,
explicit_loc->source_filename,
explicit_loc->function_name,
- explicit_loc->func_name_match_type,
- label);
+ explicit_loc->func_name_match_type, label);
}
break;
@@ -813,8 +781,8 @@ collect_explicit_location_matches (completion_tracker &tracker,
matched. Otherwise, return -1. */
static int
-skip_keyword (completion_tracker &tracker,
- const char * const *keywords, const char **text_p)
+skip_keyword (completion_tracker &tracker, const char *const *keywords,
+ const char **text_p)
{
const char *text = *text_p;
const char *after = skip_to_space (text);
@@ -854,8 +822,7 @@ skip_keyword (completion_tracker &tracker,
static void
complete_explicit_location_spec (completion_tracker &tracker,
- location_spec *locspec,
- const char *text,
+ location_spec *locspec, const char *text,
const language_defn *language,
const char *quoted_arg_start,
const char *quoted_arg_end)
@@ -925,8 +892,8 @@ complete_explicit_location_spec (completion_tracker &tracker,
void
location_completer (struct cmd_list_element *ignore,
- completion_tracker &tracker,
- const char *text, const char * /* word */)
+ completion_tracker &tracker, const char *text,
+ const char * /* word */)
{
int found_probe_option = -1;
@@ -991,7 +958,6 @@ location_completer (struct cmd_list_element *ignore,
current_language,
completion_info.quoted_arg_start,
completion_info.quoted_arg_end);
-
}
}
/* This is an address or linespec location. */
@@ -1047,8 +1013,7 @@ location_completer (struct cmd_list_element *ignore,
static void
location_completer_handle_brkchars (struct cmd_list_element *ignore,
completion_tracker &tracker,
- const char *text,
- const char *word_ignored)
+ const char *text, const char *word_ignored)
{
tracker.set_use_custom_word_point (true);
@@ -1058,8 +1023,8 @@ location_completer_handle_brkchars (struct cmd_list_element *ignore,
/* See completer.h. */
void
-complete_expression (completion_tracker &tracker,
- const char *text, const char *word)
+complete_expression (completion_tracker &tracker, const char *text,
+ const char *word)
{
expression_up exp;
std::unique_ptr<expr_completion_base> expr_completer;
@@ -1090,8 +1055,8 @@ complete_expression (completion_tracker &tracker,
void
expression_completer (struct cmd_list_element *ignore,
- completion_tracker &tracker,
- const char *text, const char *word)
+ completion_tracker &tracker, const char *text,
+ const char *word)
{
complete_expression (tracker, text, word);
}
@@ -1107,13 +1072,12 @@ set_rl_completer_word_break_characters (const char *break_chars)
/* Complete on symbols. */
void
-symbol_completer (struct cmd_list_element *ignore,
- completion_tracker &tracker,
+symbol_completer (struct cmd_list_element *ignore, completion_tracker &tracker,
const char *text, const char *word)
{
collect_symbol_completion_matches (tracker, complete_symbol_mode::EXPRESSION,
- symbol_name_match_type::EXPRESSION,
- text, word);
+ symbol_name_match_type::EXPRESSION, text,
+ word);
}
/* Here are some useful test cases for completion. FIXME: These
@@ -1192,8 +1156,7 @@ complete_line_internal_normal_command (completion_tracker &tracker,
file name by starting at `word' and going backwards. */
for (p = word;
p > command
- && strchr (gdb_completer_file_name_break_characters,
- p[-1]) == NULL;
+ && strchr (gdb_completer_file_name_break_characters, p[-1]) == NULL;
p--)
;
}
@@ -1207,8 +1170,7 @@ complete_line_internal_normal_command (completion_tracker &tracker,
else
{
brkchars_fn
- = (completer_handle_brkchars_func_for_completer
- (c->completer));
+ = (completer_handle_brkchars_func_for_completer (c->completer));
}
brkchars_fn (c, tracker, p, word);
@@ -1230,8 +1192,7 @@ complete_line_internal_normal_command (completion_tracker &tracker,
See complete_line_internal_reason for description of REASON. */
static void
-complete_line_internal_1 (completion_tracker &tracker,
- const char *text,
+complete_line_internal_1 (completion_tracker &tracker, const char *text,
const char *line_buffer, int point,
complete_line_internal_reason reason)
{
@@ -1249,8 +1210,8 @@ complete_line_internal_1 (completion_tracker &tracker,
then we will switch to the special word break set for command
strings, which leaves out the '-' and '.' character used in some
commands. */
- set_rl_completer_word_break_characters
- (current_language->word_break_characters ());
+ set_rl_completer_word_break_characters (
+ current_language->word_break_characters ());
/* Decide whether to complete on a list of gdb commands or on
symbols. */
@@ -1337,8 +1298,8 @@ complete_line_internal_1 (completion_tracker &tracker,
}
/* Ensure that readline does the right thing with respect to
inserting quotes. */
- set_rl_completer_word_break_characters
- (gdb_completer_command_word_break_characters);
+ set_rl_completer_word_break_characters (
+ gdb_completer_command_word_break_characters);
}
}
else
@@ -1364,8 +1325,8 @@ complete_line_internal_1 (completion_tracker &tracker,
/* Ensure that readline does the right thing
with respect to inserting quotes. */
- set_rl_completer_word_break_characters
- (gdb_completer_command_word_break_characters);
+ set_rl_completer_word_break_characters (
+ gdb_completer_command_word_break_characters);
}
else if (reason == handle_help)
;
@@ -1373,16 +1334,15 @@ complete_line_internal_1 (completion_tracker &tracker,
{
if (reason != handle_brkchars)
complete_on_enum (tracker, c->enums, p, word);
- set_rl_completer_word_break_characters
- (gdb_completer_command_word_break_characters);
+ set_rl_completer_word_break_characters (
+ gdb_completer_command_word_break_characters);
}
else
{
/* It is a normal command; what comes after it is
completed by the command's completer function. */
- complete_line_internal_normal_command (tracker,
- tmp_command, word, p,
- reason, c);
+ complete_line_internal_normal_command (tracker, tmp_command,
+ word, p, reason, c);
}
}
else
@@ -1412,8 +1372,8 @@ complete_line_internal_1 (completion_tracker &tracker,
/* Ensure that readline does the right thing
with respect to inserting quotes. */
- set_rl_completer_word_break_characters
- (gdb_completer_command_word_break_characters);
+ set_rl_completer_word_break_characters (
+ gdb_completer_command_word_break_characters);
}
}
else if (reason == handle_help)
@@ -1435,9 +1395,8 @@ complete_line_internal_1 (completion_tracker &tracker,
else
{
/* It is a normal command. */
- complete_line_internal_normal_command (tracker,
- tmp_command, word, p,
- reason, c);
+ complete_line_internal_normal_command (tracker, tmp_command,
+ word, p, reason, c);
}
}
}
@@ -1447,8 +1406,7 @@ complete_line_internal_1 (completion_tracker &tracker,
MAX_COMPLETIONS_REACHED_ERROR. */
static void
-complete_line_internal (completion_tracker &tracker,
- const char *text,
+complete_line_internal (completion_tracker &tracker, const char *text,
const char *line_buffer, int point,
complete_line_internal_reason reason)
{
@@ -1495,32 +1453,25 @@ completion_tracker::discard_completions ()
key to our hash is just a single string, while the values we store in
the hash are a struct containing multiple strings. */
static auto entry_eq_func
- = [] (const void *first, const void *second) -> int
- {
- /* The FIRST argument is the entry already in the hash table, and
+ = [] (const void *first, const void *second) -> int {
+ /* The FIRST argument is the entry already in the hash table, and
the SECOND argument is the new item being inserted. */
- const completion_hash_entry *entry
- = (const completion_hash_entry *) first;
- const char *name_str = (const char *) second;
+ const completion_hash_entry *entry = (const completion_hash_entry *) first;
+ const char *name_str = (const char *) second;
- return entry->is_name_eq (name_str);
- };
+ return entry->is_name_eq (name_str);
+ };
/* Callback used by the hash table to compute the hash value for an
existing entry. This is needed when expanding the hash table. */
- static auto entry_hash_func
- = [] (const void *arg) -> hashval_t
- {
- const completion_hash_entry *entry
- = (const completion_hash_entry *) arg;
- return entry->hash_name ();
- };
+ static auto entry_hash_func = [] (const void *arg) -> hashval_t {
+ const completion_hash_entry *entry = (const completion_hash_entry *) arg;
+ return entry->hash_name ();
+ };
- m_entries_hash.reset
- (htab_create_alloc (INITIAL_COMPLETION_HTAB_SIZE,
- entry_hash_func, entry_eq_func,
- htab_delete_entry<completion_hash_entry>,
- xcalloc, xfree));
+ m_entries_hash.reset (htab_create_alloc (
+ INITIAL_COMPLETION_HTAB_SIZE, entry_hash_func, entry_eq_func,
+ htab_delete_entry<completion_hash_entry>, xcalloc, xfree));
}
/* See completer.h. */
@@ -1533,10 +1484,9 @@ completion_tracker::~completion_tracker ()
/* See completer.h. */
bool
-completion_tracker::maybe_add_completion
- (gdb::unique_xmalloc_ptr<char> name,
- completion_match_for_lcd *match_for_lcd,
- const char *text, const char *word)
+completion_tracker::maybe_add_completion (
+ gdb::unique_xmalloc_ptr<char> name, completion_match_for_lcd *match_for_lcd,
+ const char *text, const char *word)
{
void **slot;
@@ -1547,8 +1497,8 @@ completion_tracker::maybe_add_completion
return false;
hashval_t hash = htab_hash_string (name.get ());
- slot = htab_find_slot_with_hash (m_entries_hash.get (), name.get (),
- hash, INSERT);
+ slot = htab_find_slot_with_hash (m_entries_hash.get (), name.get (), hash,
+ INSERT);
if (*slot == HTAB_EMPTY_ENTRY)
{
const char *match_for_lcd_str = NULL;
@@ -1581,7 +1531,8 @@ completion_tracker::add_completion (gdb::unique_xmalloc_ptr<char> name,
const char *text, const char *word)
{
if (!maybe_add_completion (std::move (name), match_for_lcd, text, word))
- throw_error (MAX_COMPLETIONS_REACHED_ERROR, _("Max completions reached."));
+ throw_error (MAX_COMPLETIONS_REACHED_ERROR,
+ _ ("Max completions reached."));
}
/* See completer.h. */
@@ -1612,8 +1563,8 @@ completion_tracker::remove_completion (const char *name)
caller to xstrdup that string if desired. */
static char *
-make_completion_match_str_1 (const char *match_name,
- const char *text, const char *word)
+make_completion_match_str_1 (const char *match_name, const char *text,
+ const char *word)
{
char *newobj;
@@ -1643,8 +1594,8 @@ make_completion_match_str_1 (const char *match_name,
/* See completer.h. */
gdb::unique_xmalloc_ptr<char>
-make_completion_match_str (const char *match_name,
- const char *text, const char *word)
+make_completion_match_str (const char *match_name, const char *text,
+ const char *word)
{
char *newobj = make_completion_match_str_1 (match_name, text, word);
if (newobj == NULL)
@@ -1682,8 +1633,8 @@ complete (const char *line, char const **word, int *quote_char)
try
{
- *word = completion_find_completion_word (tracker_handle_brkchars,
- line, quote_char);
+ *word = completion_find_completion_word (tracker_handle_brkchars, line,
+ quote_char);
/* Completers that provide a custom word point in the
handle_brkchars phase also compute their completions then.
@@ -1693,7 +1644,8 @@ complete (const char *line, char const **word, int *quote_char)
tracker = &tracker_handle_brkchars;
else
{
- complete_line (tracker_handle_completions, *word, line, strlen (line));
+ complete_line (tracker_handle_completions, *word, line,
+ strlen (line));
tracker = &tracker_handle_completions;
}
}
@@ -1705,7 +1657,6 @@ complete (const char *line, char const **word, int *quote_char)
return tracker->build_completion_result (*word, *word - line, strlen (line));
}
-
/* Generate completions all at once. Does nothing if max_completions
is 0. If max_completions is non-negative, this will collect at
most max_completions strings.
@@ -1719,8 +1670,8 @@ complete (const char *line, char const **word, int *quote_char)
should pretend that the line ends at POINT. */
void
-complete_line (completion_tracker &tracker,
- const char *text, const char *line_buffer, int point)
+complete_line (completion_tracker &tracker, const char *text,
+ const char *line_buffer, int point)
{
if (max_completions == 0)
return;
@@ -1731,12 +1682,11 @@ complete_line (completion_tracker &tracker,
/* Complete on command names. Used by "help". */
void
-command_completer (struct cmd_list_element *ignore,
- completion_tracker &tracker,
- const char *text, const char *word)
+command_completer (struct cmd_list_element *ignore,
+ completion_tracker &tracker, const char *text,
+ const char *word)
{
- complete_line_internal (tracker, word, text,
- strlen (text), handle_help);
+ complete_line_internal (tracker, word, text, strlen (text), handle_help);
}
/* The corresponding completer_handle_brkchars implementation. */
@@ -1746,15 +1696,14 @@ command_completer_handle_brkchars (struct cmd_list_element *ignore,
completion_tracker &tracker,
const char *text, const char *word)
{
- set_rl_completer_word_break_characters
- (gdb_completer_command_word_break_characters);
+ set_rl_completer_word_break_characters (
+ gdb_completer_command_word_break_characters);
}
/* Complete on signals. */
void
-signal_completer (struct cmd_list_element *ignore,
- completion_tracker &tracker,
+signal_completer (struct cmd_list_element *ignore, completion_tracker &tracker,
const char *text, const char *word)
{
size_t len = strlen (word);
@@ -1782,34 +1731,33 @@ signal_completer (struct cmd_list_element *ignore,
completer should complete on. */
enum reg_completer_target
- {
- complete_register_names = 0x1,
- complete_reggroup_names = 0x2
- };
+{
+ complete_register_names = 0x1,
+ complete_reggroup_names = 0x2
+};
+
DEF_ENUM_FLAGS_TYPE (enum reg_completer_target, reg_completer_targets);
/* Complete register names and/or reggroup names based on the value passed
in TARGETS. At least one bit in TARGETS must be set. */
static void
-reg_or_group_completer_1 (completion_tracker &tracker,
- const char *text, const char *word,
- reg_completer_targets targets)
+reg_or_group_completer_1 (completion_tracker &tracker, const char *text,
+ const char *word, reg_completer_targets targets)
{
size_t len = strlen (word);
struct gdbarch *gdbarch;
const char *name;
- gdb_assert ((targets & (complete_register_names
- | complete_reggroup_names)) != 0);
+ gdb_assert ((targets & (complete_register_names | complete_reggroup_names))
+ != 0);
gdbarch = get_current_arch ();
if ((targets & complete_register_names) != 0)
{
int i;
- for (i = 0;
- (name = user_reg_map_regnum_to_name (gdbarch, i)) != NULL;
+ for (i = 0; (name = user_reg_map_regnum_to_name (gdbarch, i)) != NULL;
i++)
{
if (*name != '\0' && strncmp (word, name, len) == 0)
@@ -1832,8 +1780,8 @@ reg_or_group_completer_1 (completion_tracker &tracker,
void
reg_or_group_completer (struct cmd_list_element *ignore,
- completion_tracker &tracker,
- const char *text, const char *word)
+ completion_tracker &tracker, const char *text,
+ const char *word)
{
reg_or_group_completer_1 (tracker, text, word,
(complete_register_names
@@ -1844,11 +1792,10 @@ reg_or_group_completer (struct cmd_list_element *ignore,
void
reggroup_completer (struct cmd_list_element *ignore,
- completion_tracker &tracker,
- const char *text, const char *word)
+ completion_tracker &tracker, const char *text,
+ const char *word)
{
- reg_or_group_completer_1 (tracker, text, word,
- complete_reggroup_names);
+ reg_or_group_completer_1 (tracker, text, word, complete_reggroup_names);
}
/* The default completer_handle_brkchars implementation. */
@@ -1858,8 +1805,8 @@ default_completer_handle_brkchars (struct cmd_list_element *ignore,
completion_tracker &tracker,
const char *text, const char *word)
{
- set_rl_completer_word_break_characters
- (current_language->word_break_characters ());
+ set_rl_completer_word_break_characters (
+ current_language->word_break_characters ());
}
/* See definition in completer.h. */
@@ -1889,7 +1836,8 @@ static char gdb_custom_word_point_brkchars[2];
/* Since rl_basic_quote_characters is not completer-specific, we save
its original value here, in order to be able to restore it in
gdb_rl_attempted_completion_function. */
-static const char *gdb_org_rl_basic_quote_characters = rl_basic_quote_characters;
+static const char *gdb_org_rl_basic_quote_characters
+ = rl_basic_quote_characters;
/* Get the list of chars that are considered as word breaks
for the current command. */
@@ -1904,8 +1852,8 @@ gdb_completion_word_break_characters_throw ()
completion_tracker &tracker = *current_completion.tracker;
- complete_line_internal (tracker, NULL, rl_line_buffer,
- rl_point, handle_brkchars);
+ complete_line_internal (tracker, NULL, rl_line_buffer, rl_point,
+ handle_brkchars);
if (tracker.use_custom_word_point ())
{
@@ -2001,9 +1949,8 @@ completion_tracker::recompute_lcd_visitor (completion_hash_entry *entry)
size_t i;
const char *new_match = entry->get_lcd ();
- for (i = 0;
- (new_match[i] != '\0'
- && new_match[i] == m_lowest_common_denominator[i]);
+ for (i = 0; (new_match[i] != '\0'
+ && new_match[i] == m_lowest_common_denominator[i]);
i++)
;
if (m_lowest_common_denominator[i] != new_match[i])
@@ -2030,14 +1977,12 @@ completion_tracker::recompute_lowest_common_denominator ()
m_lowest_common_denominator_max_length + 1);
/* Callback used to visit each entry in the m_entries_hash. */
- auto visitor_func
- = [] (void **slot, void *info) -> int
- {
- completion_tracker *obj = (completion_tracker *) info;
- completion_hash_entry *entry = (completion_hash_entry *) *slot;
- obj->recompute_lcd_visitor (entry);
- return 1;
- };
+ auto visitor_func = [] (void **slot, void *info) -> int {
+ completion_tracker *obj = (completion_tracker *) info;
+ completion_hash_entry *entry = (completion_hash_entry *) *slot;
+ obj->recompute_lcd_visitor (entry);
+ return 1;
+ };
htab_traverse (m_entries_hash.get (), visitor_func, this);
m_lowest_common_denominator_valid = true;
@@ -2079,8 +2024,7 @@ completion_tracker::advance_custom_word_point_by (int len)
*/
static char *
-expand_preserving_ws (const char *orig, size_t orig_len,
- const char *lcd)
+expand_preserving_ws (const char *orig, size_t orig_len, const char *lcd)
{
const char *p_orig = orig;
const char *orig_end = orig + orig_len;
@@ -2119,8 +2063,8 @@ expand_preserving_ws (const char *orig, size_t orig_len,
/* See completer.h. */
completion_result
-completion_tracker::build_completion_result (const char *text,
- int start, int end)
+completion_tracker::build_completion_result (const char *text, int start,
+ int end)
{
size_t element_count = htab_elements (m_entries_hash.get ());
@@ -2134,8 +2078,7 @@ completion_tracker::build_completion_result (const char *text,
recompute_lowest_common_denominator ();
match_list[0]
- = expand_preserving_ws (text, end - start,
- m_lowest_common_denominator);
+ = expand_preserving_ws (text, end - start, m_lowest_common_denominator);
if (m_lowest_common_denominator_unique)
{
@@ -2144,8 +2087,8 @@ completion_tracker::build_completion_result (const char *text,
completion. */
char buf[2] = { (char) quote_char () };
- match_list[0] = reconcat (match_list[0], match_list[0],
- buf, (char *) NULL);
+ match_list[0]
+ = reconcat (match_list[0], match_list[0], buf, (char *) NULL);
match_list[1] = NULL;
/* If the tracker wants to, or we already have a space at the
@@ -2154,8 +2097,7 @@ completion_tracker::build_completion_result (const char *text,
char *match = match_list[0];
bool completion_suppress_append
= (suppress_append_ws ()
- || (match[0] != '\0'
- && match[strlen (match) - 1] == ' '));
+ || (match[0] != '\0' && match[strlen (match) - 1] == ' '));
return completion_result (match_list, 1, completion_suppress_append);
}
@@ -2167,7 +2109,8 @@ completion_tracker::build_completion_result (const char *text,
list_builder (char **ml)
: match_list (ml),
index (1)
- { /* Nothing. */ }
+ { /* Nothing. */
+ }
/* The list we are filling. */
char **match_list;
@@ -2175,20 +2118,19 @@ completion_tracker::build_completion_result (const char *text,
/* The next index in the list to write to. */
int index;
};
+
list_builder builder (match_list);
/* Visit each entry in m_entries_hash and add it to the completion
list, updating the builder state object. */
- auto func
- = [] (void **slot, void *info) -> int
- {
- completion_hash_entry *entry = (completion_hash_entry *) *slot;
- list_builder *state = (list_builder *) info;
+ auto func = [] (void **slot, void *info) -> int {
+ completion_hash_entry *entry = (completion_hash_entry *) *slot;
+ list_builder *state = (list_builder *) info;
- state->match_list[state->index] = entry->release_name ();
- state->index++;
- return 1;
- };
+ state->match_list[state->index] = entry->release_name ();
+ state->index++;
+ return 1;
+ };
/* Build the completion list and add a null at the end. */
htab_traverse_noresize (m_entries_hash.get (), func, &builder);
@@ -2201,9 +2143,11 @@ completion_tracker::build_completion_result (const char *text,
/* See completer.h */
completion_result::completion_result ()
- : match_list (NULL), number_matches (0),
+ : match_list (NULL),
+ number_matches (0),
completion_suppress_append (false)
-{}
+{
+}
/* See completer.h */
@@ -2213,7 +2157,8 @@ completion_result::completion_result (char **match_list_,
: match_list (match_list_),
number_matches (number_matches_),
completion_suppress_append (completion_suppress_append_)
-{}
+{
+}
/* See completer.h */
@@ -2251,8 +2196,7 @@ completion_result::sort_match_list ()
{
/* Element 0 is special (it's the common prefix), leave it
be. */
- std::sort (&match_list[1],
- &match_list[number_matches + 1],
+ std::sort (&match_list[1], &match_list[number_matches + 1],
compare_cstrings);
}
}
@@ -2295,7 +2239,8 @@ completion_result::reset_match_list ()
Returns NULL if there are no completions. */
static char **
-gdb_rl_attempted_completion_function_throw (const char *text, int start, int end)
+gdb_rl_attempted_completion_function_throw (const char *text, int start,
+ int end)
{
/* Completers that provide a custom word point in the
handle_brkchars phase also compute their completions then.
@@ -2308,8 +2253,8 @@ gdb_rl_attempted_completion_function_throw (const char *text, int start, int end
delete current_completion.tracker;
current_completion.tracker = new completion_tracker ();
- complete_line (*current_completion.tracker, text,
- rl_line_buffer, rl_point);
+ complete_line (*current_completion.tracker, text, rl_line_buffer,
+ rl_point);
}
completion_tracker &tracker = *current_completion.tracker;
@@ -2414,9 +2359,9 @@ skip_quoted (const char *str)
const char *
get_max_completions_reached_message (void)
{
- return _("*** List may be truncated, max-completions reached. ***");
+ return _ ("*** List may be truncated, max-completions reached. ***");
}
-
+
/* GDB replacement for rl_display_match_list.
Readline doesn't provide a clean interface for TUI(curses).
A hack previously used was to send readline's rl_outstream through a pipe
@@ -2434,12 +2379,12 @@ get_max_completions_reached_message (void)
/* Not supported here. */
#undef VISIBLE_STATS
-#if defined (HANDLE_MULTIBYTE)
-#define MB_INVALIDCH(x) ((x) == (size_t)-1 || (x) == (size_t)-2)
-#define MB_NULLWCH(x) ((x) == 0)
+#if defined(HANDLE_MULTIBYTE)
+#define MB_INVALIDCH(x) ((x) == (size_t) -1 || (x) == (size_t) -2)
+#define MB_NULLWCH(x) ((x) == 0)
#endif
-#define ELLIPSIS_LEN 3
+#define ELLIPSIS_LEN 3
/* gdb version of readline/complete.c:get_y_or_n.
'y' -> returns 1, and 'n' -> returns 0.
@@ -2532,12 +2477,12 @@ gdb_printable_part (char *pathname)
{
char *temp, *x;
- if (rl_filename_completion_desired == 0) /* don't need to do anything */
+ if (rl_filename_completion_desired == 0) /* don't need to do anything */
return (pathname);
temp = strrchr (pathname, '/');
-#if defined (__MSDOS__)
- if (temp == 0 && ISALPHA ((unsigned char)pathname[0]) && pathname[1] == ':')
+#if defined(__MSDOS__)
+ if (temp == 0 && ISALPHA ((unsigned char) pathname[0]) && pathname[1] == ':')
temp = pathname + 1;
#endif
@@ -2565,7 +2510,7 @@ static int
gdb_fnwidth (const char *string)
{
int width, pos;
-#if defined (HANDLE_MULTIBYTE)
+#if defined(HANDLE_MULTIBYTE)
mbstate_t ps;
int left, w;
size_t clen;
@@ -2585,7 +2530,7 @@ gdb_fnwidth (const char *string)
}
else
{
-#if defined (HANDLE_MULTIBYTE)
+#if defined(HANDLE_MULTIBYTE)
clen = mbrtowc (&wc, string + pos, left - pos, &ps);
if (MB_INVALIDCH (clen))
{
@@ -2621,7 +2566,7 @@ gdb_fnprint (const char *to_print, int prefix_bytes,
{
int printed_len, w;
const char *s;
-#if defined (HANDLE_MULTIBYTE)
+#if defined(HANDLE_MULTIBYTE)
mbstate_t ps;
const char *end;
size_t tlen;
@@ -2658,7 +2603,7 @@ gdb_fnprint (const char *to_print, int prefix_bytes,
displayer->putch (displayer, UNCTRL (*s));
printed_len += 2;
s++;
-#if defined (HANDLE_MULTIBYTE)
+#if defined(HANDLE_MULTIBYTE)
memset (&ps, 0, sizeof (mbstate_t));
#endif
}
@@ -2668,13 +2613,13 @@ gdb_fnprint (const char *to_print, int prefix_bytes,
displayer->putch (displayer, '?');
printed_len += 2;
s++;
-#if defined (HANDLE_MULTIBYTE)
+#if defined(HANDLE_MULTIBYTE)
memset (&ps, 0, sizeof (mbstate_t));
#endif
}
else
{
-#if defined (HANDLE_MULTIBYTE)
+#if defined(HANDLE_MULTIBYTE)
tlen = mbrtowc (&wc, s, end - s, &ps);
if (MB_INVALIDCH (tlen))
{
@@ -2721,10 +2666,11 @@ gdb_print_filename (char *to_print, char *full_pathname, int prefix_bytes,
extension_char = 0;
printed_len = gdb_fnprint (to_print, prefix_bytes, displayer);
-#if defined (VISIBLE_STATS)
- if (rl_filename_completion_desired && (rl_visible_stats || _rl_complete_mark_directories))
+#if defined(VISIBLE_STATS)
+ if (rl_filename_completion_desired
+ && (rl_visible_stats || _rl_complete_mark_directories))
#else
- if (rl_filename_completion_desired && _rl_complete_mark_directories)
+ if (rl_filename_completion_desired && _rl_complete_mark_directories)
#endif
{
/* If to_print != full_pathname, to_print is the basename of the
@@ -2746,9 +2692,9 @@ gdb_print_filename (char *to_print, char *full_pathname, int prefix_bytes,
else if (full_pathname[0] != '/')
dn = full_pathname;
else if (full_pathname[1] == 0)
- dn = "//"; /* restore trailing slash to `//' */
+ dn = "//"; /* restore trailing slash to `//' */
else if (full_pathname[1] == '/' && full_pathname[2] == 0)
- dn = "/"; /* don't turn /// into // */
+ dn = "/"; /* don't turn /// into // */
else
dn = full_pathname;
s = tilde_expand (dn);
@@ -2757,7 +2703,7 @@ gdb_print_filename (char *to_print, char *full_pathname, int prefix_bytes,
slen = strlen (s);
tlen = strlen (to_print);
- new_full_pathname = (char *)xmalloc (slen + tlen + 2);
+ new_full_pathname = (char *) xmalloc (slen + tlen + 2);
strcpy (new_full_pathname, s);
if (s[slen - 1] == '/')
slen--;
@@ -2766,12 +2712,12 @@ gdb_print_filename (char *to_print, char *full_pathname, int prefix_bytes,
new_full_pathname[slen] = '/';
strcpy (new_full_pathname + slen + 1, to_print);
-#if defined (VISIBLE_STATS)
+#if defined(VISIBLE_STATS)
if (rl_visible_stats)
extension_char = stat_char (new_full_pathname);
else
#endif
- if (gdb_path_isdir (new_full_pathname))
+ if (gdb_path_isdir (new_full_pathname))
extension_char = '/';
xfree (new_full_pathname);
@@ -2780,13 +2726,13 @@ gdb_print_filename (char *to_print, char *full_pathname, int prefix_bytes,
else
{
s = tilde_expand (full_pathname);
-#if defined (VISIBLE_STATS)
+#if defined(VISIBLE_STATS)
if (rl_visible_stats)
extension_char = stat_char (s);
else
#endif
if (gdb_path_isdir (s))
- extension_char = '/';
+ extension_char = '/';
}
xfree (s);
@@ -2838,7 +2784,8 @@ gdb_display_match_list_1 (char **matches, int len, int max,
common_length = temp ? gdb_fnwidth (temp) : gdb_fnwidth (t);
sind = temp ? strlen (temp) : strlen (t);
- if (common_length > _rl_completion_prefix_display_length && common_length > ELLIPSIS_LEN)
+ if (common_length > _rl_completion_prefix_display_length
+ && common_length > ELLIPSIS_LEN)
max -= common_length - ELLIPSIS_LEN;
else
common_length = sind = 0;
@@ -2869,7 +2816,8 @@ gdb_display_match_list_1 (char **matches, int len, int max,
/* Sort the items if they are not already sorted. */
if (rl_ignore_completion_duplicates == 0 && rl_sort_completion_matches)
- qsort (matches + 1, len, sizeof (char *), (QSFUNC *)_rl_qsort_string_compare);
+ qsort (matches + 1, len, sizeof (char *),
+ (QSFUNC *) _rl_qsort_string_compare);
displayer->crlf (displayer);
@@ -2886,8 +2834,8 @@ gdb_display_match_list_1 (char **matches, int len, int max,
else
{
temp = gdb_printable_part (matches[l]);
- printed_len = gdb_print_filename (temp, matches[l], sind,
- displayer);
+ printed_len
+ = gdb_print_filename (temp, matches[l], sind, displayer);
if (j + 1 < limit)
for (k = 0; k < max - printed_len; k++)
@@ -2897,7 +2845,8 @@ gdb_display_match_list_1 (char **matches, int len, int max,
}
displayer->crlf (displayer);
lines++;
- if (page_completions && lines >= (displayer->height - 1) && i < count)
+ if (page_completions && lines >= (displayer->height - 1)
+ && i < count)
{
lines = gdb_display_match_list_pager (lines, displayer);
if (lines < 0)
@@ -2913,7 +2862,7 @@ gdb_display_match_list_1 (char **matches, int len, int max,
temp = gdb_printable_part (matches[i]);
printed_len = gdb_print_filename (temp, matches[i], sind, displayer);
/* Have we reached the end of this line? */
- if (matches[i+1])
+ if (matches[i + 1])
{
if (i && (limit > 1) && (i % limit) == 0)
{
@@ -2964,8 +2913,8 @@ gdb_display_match_list (char **matches, int len, int max,
displayer->crlf (displayer);
- xsnprintf (msg, sizeof (msg),
- "Display all %d possibilities? (y or n)", len);
+ xsnprintf (msg, sizeof (msg), "Display all %d possibilities? (y or n)",
+ len);
displayer->puts (displayer, msg);
displayer->flush (displayer);
@@ -2992,13 +2941,16 @@ gdb_display_match_list (char **matches, int len, int max,
}
void _initialize_completer ();
+
void
_initialize_completer ()
{
add_setshow_zuinteger_unlimited_cmd ("max-completions", no_class,
- &max_completions, _("\
-Set maximum number of completion candidates."), _("\
-Show maximum number of completion candidates."), _("\
+ &max_completions, _ ("\
+Set maximum number of completion candidates."),
+ _ ("\
+Show maximum number of completion candidates."),
+ _ ("\
Use this to limit the number of candidates considered\n\
during completion. Specifying \"unlimited\" or -1\n\
disables limiting. Note that setting either no limit or\n\
diff --git a/gdb/completer.h b/gdb/completer.h
index 8b4ad8ec4d4..de41381c922 100644
--- a/gdb/completer.h
+++ b/gdb/completer.h
@@ -14,7 +14,7 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
-#if !defined (COMPLETER_H)
+#if !defined(COMPLETER_H)
#define COMPLETER_H 1
#include "gdbsupport/gdb-hashtab.h"
@@ -80,21 +80,19 @@ typedef std::vector<gdb::unique_xmalloc_ptr<char>> completion_list;
class completion_match
{
public:
+
/* Get the completion match result. See m_match/m_storage's
descriptions. */
- const char *match ()
- { return m_match; }
+ const char *match () { return m_match; }
/* Set the completion match result. See m_match/m_storage's
descriptions. */
- void set_match (const char *match)
- { m_match = match; }
+ void set_match (const char *match) { m_match = match; }
/* Get temporary storage for generating a match result, dynamically.
The built string is only good until the next clear() call. I.e.,
good until the next symbol comparison. */
- std::string &storage ()
- { return m_storage; }
+ std::string &storage () { return m_storage; }
/* Prepare for another completion matching sequence. */
void clear ()
@@ -104,6 +102,7 @@ public:
}
private:
+
/* The completion match result. This can either be a pointer into
M_STORAGE string, or it can be a pointer into the some other
string that outlives the completion matching sequence (usually, a
@@ -135,17 +134,18 @@ private:
class completion_match_for_lcd
{
public:
+
/* Get the resulting LCD, after a successful match. */
- const char *match ()
- { return m_match; }
+ const char *match () { return m_match; }
/* Set the match for LCD. See m_match's description. */
- void set_match (const char *match)
- { m_match = match; }
+ void set_match (const char *match) { m_match = match; }
/* Mark the range between [BEGIN, END) as ignored. */
void mark_ignored_range (const char *begin, const char *end)
- { m_ignored_ranges.emplace_back (begin, end); }
+ {
+ m_ignored_ranges.emplace_back (begin, end);
+ }
/* Get the resulting LCD, after a successful match. If there are
ignored ranges, then this builds a new string with the ignored
@@ -180,6 +180,7 @@ public:
}
private:
+
/* The completion match result for LCD. This is usually either a
pointer into to a substring within a symbol's name, or to the
storage of the pairing completion_match object. */
@@ -252,10 +253,12 @@ struct completion_result
void sort_match_list ();
private:
+
/* Destroy the match list array and its contents. */
void reset_match_list ();
public:
+
/* (There's no point in making these fields private, since the whole
point of this wrapper is to build data in the layout expected by
readline. Making them private would require adding getters for
@@ -311,6 +314,7 @@ public:
class completion_tracker
{
public:
+
completion_tracker ();
~completion_tracker ();
@@ -334,8 +338,7 @@ public:
/* Set the quote char to be appended after a unique completion is
added to the input line. Set to '\0' to clear. See
m_quote_char's description. */
- void set_quote_char (int quote_char)
- { m_quote_char = quote_char; }
+ void set_quote_char (int quote_char) { m_quote_char = quote_char; }
/* The quote char to be appended after a unique completion is added
to the input line. Returns '\0' if no quote char has been set.
@@ -347,32 +350,32 @@ public:
handle_brkchars phase. Such completers must also compute their
completions then. */
void set_use_custom_word_point (bool enable)
- { m_use_custom_word_point = enable; }
+ {
+ m_use_custom_word_point = enable;
+ }
/* Whether the current completer computes a custom word point. */
- bool use_custom_word_point () const
- { return m_use_custom_word_point; }
+ bool use_custom_word_point () const { return m_use_custom_word_point; }
/* The custom word point. */
- int custom_word_point () const
- { return m_custom_word_point; }
+ int custom_word_point () const { return m_custom_word_point; }
/* Set the custom word point to POINT. */
- void set_custom_word_point (int point)
- { m_custom_word_point = point; }
+ void set_custom_word_point (int point) { m_custom_word_point = point; }
/* Advance the custom word point by LEN. */
void advance_custom_word_point_by (int len);
/* Whether to tell readline to skip appending a whitespace after the
completion. See m_suppress_append_ws. */
- bool suppress_append_ws () const
- { return m_suppress_append_ws; }
+ bool suppress_append_ws () const { return m_suppress_append_ws; }
/* Set whether to tell readline to skip appending a whitespace after
the completion. See m_suppress_append_ws. */
void set_suppress_append_ws (bool suppress)
- { m_suppress_append_ws = suppress; }
+ {
+ m_suppress_append_ws = suppress;
+ }
/* Return true if we only have one completion, and it matches
exactly the completion word. I.e., completing results in what we
@@ -394,7 +397,9 @@ public:
/* True if we have any completion match recorded. */
bool have_completions () const
- { return htab_elements (m_entries_hash.get ()) > 0; }
+ {
+ return htab_elements (m_entries_hash.get ()) > 0;
+ }
/* Discard the current completion match list and the current
LCD. */
@@ -403,8 +408,8 @@ public:
/* Build a completion_result containing the list of completion
matches to hand over to readline. The parameters are as in
rl_attempted_completion_function. */
- completion_result build_completion_result (const char *text,
- int start, int end);
+ completion_result build_completion_result (const char *text, int start,
+ int end);
private:
@@ -502,32 +507,30 @@ private:
TEXT/WORD. For a description of TEXT/WORD see completer_ftype. */
extern gdb::unique_xmalloc_ptr<char>
- make_completion_match_str (const char *match_name,
- const char *text, const char *word);
+make_completion_match_str (const char *match_name, const char *text,
+ const char *word);
/* Like above, but takes ownership of MATCH_NAME (i.e., can
reuse/return it). */
extern gdb::unique_xmalloc_ptr<char>
- make_completion_match_str (gdb::unique_xmalloc_ptr<char> &&match_name,
- const char *text, const char *word);
+make_completion_match_str (gdb::unique_xmalloc_ptr<char> &&match_name,
+ const char *text, const char *word);
extern void gdb_display_match_list (char **matches, int len, int max,
const struct match_list_displayer *);
extern const char *get_max_completions_reached_message (void);
-extern void complete_line (completion_tracker &tracker,
- const char *text,
- const char *line_buffer,
- int point);
+extern void complete_line (completion_tracker &tracker, const char *text,
+ const char *line_buffer, int point);
/* Complete LINE and return completion results. For completion purposes,
cursor position is assumed to be at the end of LINE. WORD is set to
the end of word to complete. QUOTE_CHAR is set to the opening quote
character if we found an unclosed quoted substring, '\0' otherwise. */
-extern completion_result
- complete (const char *line, char const **word, int *quote_char);
+extern completion_result complete (const char *line, char const **word,
+ int *quote_char);
/* Find the bounds of the word in TEXT for completion purposes, and
return a pointer to the end of the word. Calls the completion
@@ -535,62 +538,63 @@ extern completion_result
the right work break characters for the command in TEXT.
QUOTE_CHAR, if non-null, is set to the opening quote character if
we found an unclosed quoted substring, '\0' otherwise. */
-extern const char *completion_find_completion_word (completion_tracker &tracker,
- const char *text,
- int *quote_char);
-
+extern const char *
+completion_find_completion_word (completion_tracker &tracker, const char *text,
+ int *quote_char);
/* Assuming TEXT is an expression in the current language, find the
completion word point for TEXT, emulating the algorithm readline
uses to find the word point, using the current language's word
break characters. */
-const char *advance_to_expression_complete_word_point
- (completion_tracker &tracker, const char *text);
+const char *
+advance_to_expression_complete_word_point (completion_tracker &tracker,
+ const char *text);
/* Assuming TEXT is an filename, find the completion word point for
TEXT, emulating the algorithm readline uses to find the word
point. */
-extern const char *advance_to_filename_complete_word_point
- (completion_tracker &tracker, const char *text);
+extern const char *
+advance_to_filename_complete_word_point (completion_tracker &tracker,
+ const char *text);
extern char **gdb_rl_attempted_completion_function (const char *text,
int start, int end);
extern void noop_completer (struct cmd_list_element *,
- completion_tracker &tracker,
- const char *, const char *);
+ completion_tracker &tracker, const char *,
+ const char *);
extern void filename_completer (struct cmd_list_element *,
- completion_tracker &tracker,
- const char *, const char *);
+ completion_tracker &tracker, const char *,
+ const char *);
extern void expression_completer (struct cmd_list_element *,
- completion_tracker &tracker,
- const char *, const char *);
+ completion_tracker &tracker, const char *,
+ const char *);
extern void location_completer (struct cmd_list_element *,
- completion_tracker &tracker,
- const char *, const char *);
+ completion_tracker &tracker, const char *,
+ const char *);
extern void symbol_completer (struct cmd_list_element *,
- completion_tracker &tracker,
- const char *, const char *);
+ completion_tracker &tracker, const char *,
+ const char *);
extern void command_completer (struct cmd_list_element *,
- completion_tracker &tracker,
- const char *, const char *);
+ completion_tracker &tracker, const char *,
+ const char *);
extern void signal_completer (struct cmd_list_element *,
- completion_tracker &tracker,
- const char *, const char *);
+ completion_tracker &tracker, const char *,
+ const char *);
extern void reg_or_group_completer (struct cmd_list_element *,
- completion_tracker &tracker,
- const char *, const char *);
+ completion_tracker &tracker, const char *,
+ const char *);
extern void reggroup_completer (struct cmd_list_element *,
- completion_tracker &tracker,
- const char *, const char *);
+ completion_tracker &tracker, const char *,
+ const char *);
extern const char *get_gdb_completer_quote_characters (void);
@@ -609,7 +613,7 @@ extern void set_rl_completer_word_break_characters (const char *break_chars);
calculation is done (e.g., for Python functions). */
extern completer_handle_brkchars_ftype *
- completer_handle_brkchars_func_for_completer (completer_ftype *fn);
+completer_handle_brkchars_func_for_completer (completer_ftype *fn);
/* Exported to linespec.c */
@@ -620,8 +624,8 @@ extern completion_list complete_source_filenames (const char *text);
/* Complete on expressions. Often this means completing on symbol
names, but some language parsers also have support for completing
field names. */
-extern void complete_expression (completion_tracker &tracker,
- const char *text, const char *word);
+extern void complete_expression (completion_tracker &tracker, const char *text,
+ const char *word);
/* Called by custom word point completers that want to recurse into
the completion machinery to complete a command. Used to complete
diff --git a/gdb/config/nm-linux.h b/gdb/config/nm-linux.h
index 7d838bdccfe..6c5b6bffd62 100644
--- a/gdb/config/nm-linux.h
+++ b/gdb/config/nm-linux.h
@@ -23,7 +23,7 @@
/* Use elf_gregset_t and elf_fpregset_t, rather than
gregset_t and fpregset_t. */
-#define GDB_GREGSET_T elf_gregset_t
+#define GDB_GREGSET_T elf_gregset_t
#define GDB_FPREGSET_T elf_fpregset_t
#endif /* CONFIG_NM_LINUX_H */
diff --git a/gdb/copying.c b/gdb/copying.c
index a66a55b73ea..8841913e47b 100644
--- a/gdb/copying.c
+++ b/gdb/copying.c
@@ -16,589 +16,985 @@ show_copying_command (const char *ignore, int from_tty)
gdb_printf (" GNU GENERAL PUBLIC LICENSE\n");
gdb_printf (" Version 3, 29 June 2007\n");
gdb_printf ("\n");
- gdb_printf (" Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>\n");
- gdb_printf (" Everyone is permitted to copy and distribute verbatim copies\n");
+ gdb_printf (
+ " Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>\n");
+ gdb_printf (
+ " Everyone is permitted to copy and distribute verbatim copies\n");
gdb_printf (" of this license document, but changing it is not allowed.\n");
gdb_printf ("\n");
gdb_printf (" Preamble\n");
gdb_printf ("\n");
- gdb_printf (" The GNU General Public License is a free, copyleft license for\n");
+ gdb_printf (
+ " The GNU General Public License is a free, copyleft license for\n");
gdb_printf ("software and other kinds of works.\n");
gdb_printf ("\n");
- gdb_printf (" The licenses for most software and other practical works are designed\n");
- gdb_printf ("to take away your freedom to share and change the works. By contrast,\n");
- gdb_printf ("the GNU General Public License is intended to guarantee your freedom to\n");
- gdb_printf ("share and change all versions of a program--to make sure it remains free\n");
- gdb_printf ("software for all its users. We, the Free Software Foundation, use the\n");
- gdb_printf ("GNU General Public License for most of our software; it applies also to\n");
- gdb_printf ("any other work released this way by its authors. You can apply it to\n");
+ gdb_printf (" The licenses for most software and other practical works are "
+ "designed\n");
+ gdb_printf ("to take away your freedom to share and change the works. By "
+ "contrast,\n");
+ gdb_printf ("the GNU General Public License is intended to guarantee your "
+ "freedom to\n");
+ gdb_printf ("share and change all versions of a program--to make sure it "
+ "remains free\n");
+ gdb_printf ("software for all its users. We, the Free Software Foundation, "
+ "use the\n");
+ gdb_printf ("GNU General Public License for most of our software; it "
+ "applies also to\n");
+ gdb_printf (
+ "any other work released this way by its authors. You can apply it to\n");
gdb_printf ("your programs, too.\n");
gdb_printf ("\n");
- gdb_printf (" When we speak of free software, we are referring to freedom, not\n");
- gdb_printf ("price. Our General Public Licenses are designed to make sure that you\n");
- gdb_printf ("have the freedom to distribute copies of free software (and charge for\n");
- gdb_printf ("them if you wish), that you receive source code or can get it if you\n");
- gdb_printf ("want it, that you can change the software or use pieces of it in new\n");
+ gdb_printf (
+ " When we speak of free software, we are referring to freedom, not\n");
+ gdb_printf ("price. Our General Public Licenses are designed to make sure "
+ "that you\n");
+ gdb_printf ("have the freedom to distribute copies of free software (and "
+ "charge for\n");
+ gdb_printf (
+ "them if you wish), that you receive source code or can get it if you\n");
+ gdb_printf (
+ "want it, that you can change the software or use pieces of it in new\n");
gdb_printf ("free programs, and that you know you can do these things.\n");
gdb_printf ("\n");
- gdb_printf (" To protect your rights, we need to prevent others from denying you\n");
- gdb_printf ("these rights or asking you to surrender the rights. Therefore, you have\n");
- gdb_printf ("certain responsibilities if you distribute copies of the software, or if\n");
- gdb_printf ("you modify it: responsibilities to respect the freedom of others.\n");
- gdb_printf ("\n");
- gdb_printf (" For example, if you distribute copies of such a program, whether\n");
- gdb_printf ("gratis or for a fee, you must pass on to the recipients the same\n");
- gdb_printf ("freedoms that you received. You must make sure that they, too, receive\n");
- gdb_printf ("or can get the source code. And you must show them these terms so they\n");
+ gdb_printf (
+ " To protect your rights, we need to prevent others from denying you\n");
+ gdb_printf ("these rights or asking you to surrender the rights. "
+ "Therefore, you have\n");
+ gdb_printf ("certain responsibilities if you distribute copies of the "
+ "software, or if\n");
+ gdb_printf (
+ "you modify it: responsibilities to respect the freedom of others.\n");
+ gdb_printf ("\n");
+ gdb_printf (
+ " For example, if you distribute copies of such a program, whether\n");
+ gdb_printf (
+ "gratis or for a fee, you must pass on to the recipients the same\n");
+ gdb_printf ("freedoms that you received. You must make sure that they, "
+ "too, receive\n");
+ gdb_printf ("or can get the source code. And you must show them these "
+ "terms so they\n");
gdb_printf ("know their rights.\n");
gdb_printf ("\n");
- gdb_printf (" Developers that use the GNU GPL protect your rights with two steps:\n");
- gdb_printf ("(1) assert copyright on the software, and (2) offer you this License\n");
- gdb_printf ("giving you legal permission to copy, distribute and/or modify it.\n");
- gdb_printf ("\n");
- gdb_printf (" For the developers' and authors' protection, the GPL clearly explains\n");
- gdb_printf ("that there is no warranty for this free software. For both users' and\n");
- gdb_printf ("authors' sake, the GPL requires that modified versions be marked as\n");
- gdb_printf ("changed, so that their problems will not be attributed erroneously to\n");
+ gdb_printf (
+ " Developers that use the GNU GPL protect your rights with two steps:\n");
+ gdb_printf (
+ "(1) assert copyright on the software, and (2) offer you this License\n");
+ gdb_printf (
+ "giving you legal permission to copy, distribute and/or modify it.\n");
+ gdb_printf ("\n");
+ gdb_printf (" For the developers' and authors' protection, the GPL clearly "
+ "explains\n");
+ gdb_printf ("that there is no warranty for this free software. For both "
+ "users' and\n");
+ gdb_printf (
+ "authors' sake, the GPL requires that modified versions be marked as\n");
+ gdb_printf (
+ "changed, so that their problems will not be attributed erroneously to\n");
gdb_printf ("authors of previous versions.\n");
gdb_printf ("\n");
- gdb_printf (" Some devices are designed to deny users access to install or run\n");
- gdb_printf ("modified versions of the software inside them, although the manufacturer\n");
- gdb_printf ("can do so. This is fundamentally incompatible with the aim of\n");
- gdb_printf ("protecting users' freedom to change the software. The systematic\n");
- gdb_printf ("pattern of such abuse occurs in the area of products for individuals to\n");
- gdb_printf ("use, which is precisely where it is most unacceptable. Therefore, we\n");
- gdb_printf ("have designed this version of the GPL to prohibit the practice for those\n");
- gdb_printf ("products. If such problems arise substantially in other domains, we\n");
- gdb_printf ("stand ready to extend this provision to those domains in future versions\n");
+ gdb_printf (
+ " Some devices are designed to deny users access to install or run\n");
+ gdb_printf ("modified versions of the software inside them, although the "
+ "manufacturer\n");
+ gdb_printf (
+ "can do so. This is fundamentally incompatible with the aim of\n");
+ gdb_printf (
+ "protecting users' freedom to change the software. The systematic\n");
+ gdb_printf ("pattern of such abuse occurs in the area of products for "
+ "individuals to\n");
+ gdb_printf (
+ "use, which is precisely where it is most unacceptable. Therefore, we\n");
+ gdb_printf ("have designed this version of the GPL to prohibit the practice "
+ "for those\n");
+ gdb_printf (
+ "products. If such problems arise substantially in other domains, we\n");
+ gdb_printf ("stand ready to extend this provision to those domains in "
+ "future versions\n");
gdb_printf ("of the GPL, as needed to protect the freedom of users.\n");
gdb_printf ("\n");
- gdb_printf (" Finally, every program is threatened constantly by software patents.\n");
- gdb_printf ("States should not allow patents to restrict development and use of\n");
- gdb_printf ("software on general-purpose computers, but in those that do, we wish to\n");
- gdb_printf ("avoid the special danger that patents applied to a free program could\n");
- gdb_printf ("make it effectively proprietary. To prevent this, the GPL assures that\n");
+ gdb_printf (" Finally, every program is threatened constantly by software "
+ "patents.\n");
+ gdb_printf (
+ "States should not allow patents to restrict development and use of\n");
+ gdb_printf ("software on general-purpose computers, but in those that do, "
+ "we wish to\n");
+ gdb_printf (
+ "avoid the special danger that patents applied to a free program could\n");
+ gdb_printf ("make it effectively proprietary. To prevent this, the GPL "
+ "assures that\n");
gdb_printf ("patents cannot be used to render the program non-free.\n");
gdb_printf ("\n");
- gdb_printf (" The precise terms and conditions for copying, distribution and\n");
+ gdb_printf (
+ " The precise terms and conditions for copying, distribution and\n");
gdb_printf ("modification follow.\n");
gdb_printf ("\n");
gdb_printf (" TERMS AND CONDITIONS\n");
gdb_printf ("\n");
gdb_printf (" 0. Definitions.\n");
gdb_printf ("\n");
- gdb_printf (" \"This License\" refers to version 3 of the GNU General Public License.\n");
+ gdb_printf (" \"This License\" refers to version 3 of the GNU General "
+ "Public License.\n");
gdb_printf ("\n");
- gdb_printf (" \"Copyright\" also means copyright-like laws that apply to other kinds of\n");
+ gdb_printf (" \"Copyright\" also means copyright-like laws that apply to "
+ "other kinds of\n");
gdb_printf ("works, such as semiconductor masks.\n");
gdb_printf ("\n");
- gdb_printf (" \"The Program\" refers to any copyrightable work licensed under this\n");
- gdb_printf ("License. Each licensee is addressed as \"you\". \"Licensees\" and\n");
+ gdb_printf (" \"The Program\" refers to any copyrightable work licensed "
+ "under this\n");
+ gdb_printf (
+ "License. Each licensee is addressed as \"you\". \"Licensees\" and\n");
gdb_printf ("\"recipients\" may be individuals or organizations.\n");
gdb_printf ("\n");
- gdb_printf (" To \"modify\" a work means to copy from or adapt all or part of the work\n");
- gdb_printf ("in a fashion requiring copyright permission, other than the making of an\n");
- gdb_printf ("exact copy. The resulting work is called a \"modified version\" of the\n");
+ gdb_printf (" To \"modify\" a work means to copy from or adapt all or part "
+ "of the work\n");
+ gdb_printf ("in a fashion requiring copyright permission, other than the "
+ "making of an\n");
+ gdb_printf ("exact copy. The resulting work is called a \"modified "
+ "version\" of the\n");
gdb_printf ("earlier work or a work \"based on\" the earlier work.\n");
gdb_printf ("\n");
- gdb_printf (" A \"covered work\" means either the unmodified Program or a work based\n");
+ gdb_printf (" A \"covered work\" means either the unmodified Program or a "
+ "work based\n");
gdb_printf ("on the Program.\n");
gdb_printf ("\n");
- gdb_printf (" To \"propagate\" a work means to do anything with it that, without\n");
- gdb_printf ("permission, would make you directly or secondarily liable for\n");
- gdb_printf ("infringement under applicable copyright law, except executing it on a\n");
- gdb_printf ("computer or modifying a private copy. Propagation includes copying,\n");
- gdb_printf ("distribution (with or without modification), making available to the\n");
+ gdb_printf (
+ " To \"propagate\" a work means to do anything with it that, without\n");
+ gdb_printf (
+ "permission, would make you directly or secondarily liable for\n");
+ gdb_printf (
+ "infringement under applicable copyright law, except executing it on a\n");
+ gdb_printf (
+ "computer or modifying a private copy. Propagation includes copying,\n");
+ gdb_printf (
+ "distribution (with or without modification), making available to the\n");
gdb_printf ("public, and in some countries other activities as well.\n");
gdb_printf ("\n");
- gdb_printf (" To \"convey\" a work means any kind of propagation that enables other\n");
- gdb_printf ("parties to make or receive copies. Mere interaction with a user through\n");
- gdb_printf ("a computer network, with no transfer of a copy, is not conveying.\n");
- gdb_printf ("\n");
- gdb_printf (" An interactive user interface displays \"Appropriate Legal Notices\"\n");
- gdb_printf ("to the extent that it includes a convenient and prominently visible\n");
- gdb_printf ("feature that (1) displays an appropriate copyright notice, and (2)\n");
- gdb_printf ("tells the user that there is no warranty for the work (except to the\n");
- gdb_printf ("extent that warranties are provided), that licensees may convey the\n");
- gdb_printf ("work under this License, and how to view a copy of this License. If\n");
- gdb_printf ("the interface presents a list of user commands or options, such as a\n");
+ gdb_printf (" To \"convey\" a work means any kind of propagation that "
+ "enables other\n");
+ gdb_printf ("parties to make or receive copies. Mere interaction with a "
+ "user through\n");
+ gdb_printf (
+ "a computer network, with no transfer of a copy, is not conveying.\n");
+ gdb_printf ("\n");
+ gdb_printf (" An interactive user interface displays \"Appropriate Legal "
+ "Notices\"\n");
+ gdb_printf (
+ "to the extent that it includes a convenient and prominently visible\n");
+ gdb_printf (
+ "feature that (1) displays an appropriate copyright notice, and (2)\n");
+ gdb_printf (
+ "tells the user that there is no warranty for the work (except to the\n");
+ gdb_printf (
+ "extent that warranties are provided), that licensees may convey the\n");
+ gdb_printf (
+ "work under this License, and how to view a copy of this License. If\n");
+ gdb_printf (
+ "the interface presents a list of user commands or options, such as a\n");
gdb_printf ("menu, a prominent item in the list meets this criterion.\n");
gdb_printf ("\n");
gdb_printf (" 1. Source Code.\n");
gdb_printf ("\n");
- gdb_printf (" The \"source code\" for a work means the preferred form of the work\n");
- gdb_printf ("for making modifications to it. \"Object code\" means any non-source\n");
+ gdb_printf (
+ " The \"source code\" for a work means the preferred form of the work\n");
+ gdb_printf (
+ "for making modifications to it. \"Object code\" means any non-source\n");
gdb_printf ("form of a work.\n");
gdb_printf ("\n");
- gdb_printf (" A \"Standard Interface\" means an interface that either is an official\n");
- gdb_printf ("standard defined by a recognized standards body, or, in the case of\n");
- gdb_printf ("interfaces specified for a particular programming language, one that\n");
+ gdb_printf (" A \"Standard Interface\" means an interface that either is "
+ "an official\n");
+ gdb_printf (
+ "standard defined by a recognized standards body, or, in the case of\n");
+ gdb_printf (
+ "interfaces specified for a particular programming language, one that\n");
gdb_printf ("is widely used among developers working in that language.\n");
gdb_printf ("\n");
- gdb_printf (" The \"System Libraries\" of an executable work include anything, other\n");
- gdb_printf ("than the work as a whole, that (a) is included in the normal form of\n");
- gdb_printf ("packaging a Major Component, but which is not part of that Major\n");
- gdb_printf ("Component, and (b) serves only to enable use of the work with that\n");
- gdb_printf ("Major Component, or to implement a Standard Interface for which an\n");
- gdb_printf ("implementation is available to the public in source code form. A\n");
- gdb_printf ("\"Major Component\", in this context, means a major essential component\n");
- gdb_printf ("(kernel, window system, and so on) of the specific operating system\n");
- gdb_printf ("(if any) on which the executable work runs, or a compiler used to\n");
- gdb_printf ("produce the work, or an object code interpreter used to run it.\n");
- gdb_printf ("\n");
- gdb_printf (" The \"Corresponding Source\" for a work in object code form means all\n");
- gdb_printf ("the source code needed to generate, install, and (for an executable\n");
- gdb_printf ("work) run the object code and to modify the work, including scripts to\n");
- gdb_printf ("control those activities. However, it does not include the work's\n");
- gdb_printf ("System Libraries, or general-purpose tools or generally available free\n");
- gdb_printf ("programs which are used unmodified in performing those activities but\n");
- gdb_printf ("which are not part of the work. For example, Corresponding Source\n");
- gdb_printf ("includes interface definition files associated with source files for\n");
- gdb_printf ("the work, and the source code for shared libraries and dynamically\n");
- gdb_printf ("linked subprograms that the work is specifically designed to require,\n");
- gdb_printf ("such as by intimate data communication or control flow between those\n");
+ gdb_printf (" The \"System Libraries\" of an executable work include "
+ "anything, other\n");
+ gdb_printf (
+ "than the work as a whole, that (a) is included in the normal form of\n");
+ gdb_printf (
+ "packaging a Major Component, but which is not part of that Major\n");
+ gdb_printf (
+ "Component, and (b) serves only to enable use of the work with that\n");
+ gdb_printf (
+ "Major Component, or to implement a Standard Interface for which an\n");
+ gdb_printf (
+ "implementation is available to the public in source code form. A\n");
+ gdb_printf ("\"Major Component\", in this context, means a major essential "
+ "component\n");
+ gdb_printf (
+ "(kernel, window system, and so on) of the specific operating system\n");
+ gdb_printf (
+ "(if any) on which the executable work runs, or a compiler used to\n");
+ gdb_printf (
+ "produce the work, or an object code interpreter used to run it.\n");
+ gdb_printf ("\n");
+ gdb_printf (" The \"Corresponding Source\" for a work in object code form "
+ "means all\n");
+ gdb_printf (
+ "the source code needed to generate, install, and (for an executable\n");
+ gdb_printf ("work) run the object code and to modify the work, including "
+ "scripts to\n");
+ gdb_printf (
+ "control those activities. However, it does not include the work's\n");
+ gdb_printf ("System Libraries, or general-purpose tools or generally "
+ "available free\n");
+ gdb_printf (
+ "programs which are used unmodified in performing those activities but\n");
+ gdb_printf (
+ "which are not part of the work. For example, Corresponding Source\n");
+ gdb_printf (
+ "includes interface definition files associated with source files for\n");
+ gdb_printf (
+ "the work, and the source code for shared libraries and dynamically\n");
+ gdb_printf (
+ "linked subprograms that the work is specifically designed to require,\n");
+ gdb_printf (
+ "such as by intimate data communication or control flow between those\n");
gdb_printf ("subprograms and other parts of the work.\n");
gdb_printf ("\n");
- gdb_printf (" The Corresponding Source need not include anything that users\n");
- gdb_printf ("can regenerate automatically from other parts of the Corresponding\n");
+ gdb_printf (
+ " The Corresponding Source need not include anything that users\n");
+ gdb_printf (
+ "can regenerate automatically from other parts of the Corresponding\n");
gdb_printf ("Source.\n");
gdb_printf ("\n");
- gdb_printf (" The Corresponding Source for a work in source code form is that\n");
+ gdb_printf (
+ " The Corresponding Source for a work in source code form is that\n");
gdb_printf ("same work.\n");
gdb_printf ("\n");
gdb_printf (" 2. Basic Permissions.\n");
gdb_printf ("\n");
- gdb_printf (" All rights granted under this License are granted for the term of\n");
- gdb_printf ("copyright on the Program, and are irrevocable provided the stated\n");
- gdb_printf ("conditions are met. This License explicitly affirms your unlimited\n");
- gdb_printf ("permission to run the unmodified Program. The output from running a\n");
- gdb_printf ("covered work is covered by this License only if the output, given its\n");
- gdb_printf ("content, constitutes a covered work. This License acknowledges your\n");
- gdb_printf ("rights of fair use or other equivalent, as provided by copyright law.\n");
- gdb_printf ("\n");
- gdb_printf (" You may make, run and propagate covered works that you do not\n");
- gdb_printf ("convey, without conditions so long as your license otherwise remains\n");
- gdb_printf ("in force. You may convey covered works to others for the sole purpose\n");
- gdb_printf ("of having them make modifications exclusively for you, or provide you\n");
- gdb_printf ("with facilities for running those works, provided that you comply with\n");
- gdb_printf ("the terms of this License in conveying all material for which you do\n");
- gdb_printf ("not control copyright. Those thus making or running the covered works\n");
- gdb_printf ("for you must do so exclusively on your behalf, under your direction\n");
- gdb_printf ("and control, on terms that prohibit them from making any copies of\n");
- gdb_printf ("your copyrighted material outside their relationship with you.\n");
- gdb_printf ("\n");
- gdb_printf (" Conveying under any other circumstances is permitted solely under\n");
- gdb_printf ("the conditions stated below. Sublicensing is not allowed; section 10\n");
+ gdb_printf (
+ " All rights granted under this License are granted for the term of\n");
+ gdb_printf (
+ "copyright on the Program, and are irrevocable provided the stated\n");
+ gdb_printf (
+ "conditions are met. This License explicitly affirms your unlimited\n");
+ gdb_printf (
+ "permission to run the unmodified Program. The output from running a\n");
+ gdb_printf (
+ "covered work is covered by this License only if the output, given its\n");
+ gdb_printf (
+ "content, constitutes a covered work. This License acknowledges your\n");
+ gdb_printf (
+ "rights of fair use or other equivalent, as provided by copyright law.\n");
+ gdb_printf ("\n");
+ gdb_printf (
+ " You may make, run and propagate covered works that you do not\n");
+ gdb_printf (
+ "convey, without conditions so long as your license otherwise remains\n");
+ gdb_printf ("in force. You may convey covered works to others for the sole "
+ "purpose\n");
+ gdb_printf (
+ "of having them make modifications exclusively for you, or provide you\n");
+ gdb_printf ("with facilities for running those works, provided that you "
+ "comply with\n");
+ gdb_printf (
+ "the terms of this License in conveying all material for which you do\n");
+ gdb_printf ("not control copyright. Those thus making or running the "
+ "covered works\n");
+ gdb_printf (
+ "for you must do so exclusively on your behalf, under your direction\n");
+ gdb_printf (
+ "and control, on terms that prohibit them from making any copies of\n");
+ gdb_printf (
+ "your copyrighted material outside their relationship with you.\n");
+ gdb_printf ("\n");
+ gdb_printf (
+ " Conveying under any other circumstances is permitted solely under\n");
+ gdb_printf (
+ "the conditions stated below. Sublicensing is not allowed; section 10\n");
gdb_printf ("makes it unnecessary.\n");
gdb_printf ("\n");
- gdb_printf (" 3. Protecting Users' Legal Rights From Anti-Circumvention Law.\n");
- gdb_printf ("\n");
- gdb_printf (" No covered work shall be deemed part of an effective technological\n");
- gdb_printf ("measure under any applicable law fulfilling obligations under article\n");
- gdb_printf ("11 of the WIPO copyright treaty adopted on 20 December 1996, or\n");
- gdb_printf ("similar laws prohibiting or restricting circumvention of such\n");
+ gdb_printf (
+ " 3. Protecting Users' Legal Rights From Anti-Circumvention Law.\n");
+ gdb_printf ("\n");
+ gdb_printf (
+ " No covered work shall be deemed part of an effective technological\n");
+ gdb_printf (
+ "measure under any applicable law fulfilling obligations under article\n");
+ gdb_printf (
+ "11 of the WIPO copyright treaty adopted on 20 December 1996, or\n");
+ gdb_printf (
+ "similar laws prohibiting or restricting circumvention of such\n");
gdb_printf ("measures.\n");
gdb_printf ("\n");
- gdb_printf (" When you convey a covered work, you waive any legal power to forbid\n");
- gdb_printf ("circumvention of technological measures to the extent such circumvention\n");
- gdb_printf ("is effected by exercising rights under this License with respect to\n");
- gdb_printf ("the covered work, and you disclaim any intention to limit operation or\n");
- gdb_printf ("modification of the work as a means of enforcing, against the work's\n");
- gdb_printf ("users, your or third parties' legal rights to forbid circumvention of\n");
+ gdb_printf (
+ " When you convey a covered work, you waive any legal power to forbid\n");
+ gdb_printf ("circumvention of technological measures to the extent such "
+ "circumvention\n");
+ gdb_printf (
+ "is effected by exercising rights under this License with respect to\n");
+ gdb_printf ("the covered work, and you disclaim any intention to limit "
+ "operation or\n");
+ gdb_printf (
+ "modification of the work as a means of enforcing, against the work's\n");
+ gdb_printf (
+ "users, your or third parties' legal rights to forbid circumvention of\n");
gdb_printf ("technological measures.\n");
gdb_printf ("\n");
gdb_printf (" 4. Conveying Verbatim Copies.\n");
gdb_printf ("\n");
- gdb_printf (" You may convey verbatim copies of the Program's source code as you\n");
- gdb_printf ("receive it, in any medium, provided that you conspicuously and\n");
- gdb_printf ("appropriately publish on each copy an appropriate copyright notice;\n");
+ gdb_printf (
+ " You may convey verbatim copies of the Program's source code as you\n");
+ gdb_printf (
+ "receive it, in any medium, provided that you conspicuously and\n");
+ gdb_printf (
+ "appropriately publish on each copy an appropriate copyright notice;\n");
gdb_printf ("keep intact all notices stating that this License and any\n");
- gdb_printf ("non-permissive terms added in accord with section 7 apply to the code;\n");
- gdb_printf ("keep intact all notices of the absence of any warranty; and give all\n");
+ gdb_printf ("non-permissive terms added in accord with section 7 apply to "
+ "the code;\n");
+ gdb_printf (
+ "keep intact all notices of the absence of any warranty; and give all\n");
gdb_printf ("recipients a copy of this License along with the Program.\n");
gdb_printf ("\n");
- gdb_printf (" You may charge any price or no price for each copy that you convey,\n");
+ gdb_printf (
+ " You may charge any price or no price for each copy that you convey,\n");
gdb_printf ("and you may offer support or warranty protection for a fee.\n");
gdb_printf ("\n");
gdb_printf (" 5. Conveying Modified Source Versions.\n");
gdb_printf ("\n");
- gdb_printf (" You may convey a work based on the Program, or the modifications to\n");
- gdb_printf ("produce it from the Program, in the form of source code under the\n");
- gdb_printf ("terms of section 4, provided that you also meet all of these conditions:\n");
+ gdb_printf (
+ " You may convey a work based on the Program, or the modifications to\n");
+ gdb_printf (
+ "produce it from the Program, in the form of source code under the\n");
+ gdb_printf ("terms of section 4, provided that you also meet all of these "
+ "conditions:\n");
gdb_printf ("\n");
- gdb_printf (" a) The work must carry prominent notices stating that you modified\n");
+ gdb_printf (" a) The work must carry prominent notices stating that you "
+ "modified\n");
gdb_printf (" it, and giving a relevant date.\n");
gdb_printf ("\n");
- gdb_printf (" b) The work must carry prominent notices stating that it is\n");
- gdb_printf (" released under this License and any conditions added under section\n");
- gdb_printf (" 7. This requirement modifies the requirement in section 4 to\n");
+ gdb_printf (
+ " b) The work must carry prominent notices stating that it is\n");
+ gdb_printf (" released under this License and any conditions added under "
+ "section\n");
+ gdb_printf (
+ " 7. This requirement modifies the requirement in section 4 to\n");
gdb_printf (" \"keep intact all notices\".\n");
gdb_printf ("\n");
- gdb_printf (" c) You must license the entire work, as a whole, under this\n");
- gdb_printf (" License to anyone who comes into possession of a copy. This\n");
- gdb_printf (" License will therefore apply, along with any applicable section 7\n");
- gdb_printf (" additional terms, to the whole of the work, and all its parts,\n");
- gdb_printf (" regardless of how they are packaged. This License gives no\n");
- gdb_printf (" permission to license the work in any other way, but it does not\n");
- gdb_printf (" invalidate such permission if you have separately received it.\n");
- gdb_printf ("\n");
- gdb_printf (" d) If the work has interactive user interfaces, each must display\n");
- gdb_printf (" Appropriate Legal Notices; however, if the Program has interactive\n");
- gdb_printf (" interfaces that do not display Appropriate Legal Notices, your\n");
+ gdb_printf (
+ " c) You must license the entire work, as a whole, under this\n");
+ gdb_printf (
+ " License to anyone who comes into possession of a copy. This\n");
+ gdb_printf (
+ " License will therefore apply, along with any applicable section 7\n");
+ gdb_printf (
+ " additional terms, to the whole of the work, and all its parts,\n");
+ gdb_printf (
+ " regardless of how they are packaged. This License gives no\n");
+ gdb_printf (
+ " permission to license the work in any other way, but it does not\n");
+ gdb_printf (
+ " invalidate such permission if you have separately received it.\n");
+ gdb_printf ("\n");
+ gdb_printf (
+ " d) If the work has interactive user interfaces, each must display\n");
+ gdb_printf (" Appropriate Legal Notices; however, if the Program has "
+ "interactive\n");
+ gdb_printf (
+ " interfaces that do not display Appropriate Legal Notices, your\n");
gdb_printf (" work need not make them do so.\n");
gdb_printf ("\n");
- gdb_printf (" A compilation of a covered work with other separate and independent\n");
- gdb_printf ("works, which are not by their nature extensions of the covered work,\n");
- gdb_printf ("and which are not combined with it such as to form a larger program,\n");
- gdb_printf ("in or on a volume of a storage or distribution medium, is called an\n");
- gdb_printf ("\"aggregate\" if the compilation and its resulting copyright are not\n");
- gdb_printf ("used to limit the access or legal rights of the compilation's users\n");
- gdb_printf ("beyond what the individual works permit. Inclusion of a covered work\n");
- gdb_printf ("in an aggregate does not cause this License to apply to the other\n");
+ gdb_printf (
+ " A compilation of a covered work with other separate and independent\n");
+ gdb_printf (
+ "works, which are not by their nature extensions of the covered work,\n");
+ gdb_printf (
+ "and which are not combined with it such as to form a larger program,\n");
+ gdb_printf (
+ "in or on a volume of a storage or distribution medium, is called an\n");
+ gdb_printf (
+ "\"aggregate\" if the compilation and its resulting copyright are not\n");
+ gdb_printf (
+ "used to limit the access or legal rights of the compilation's users\n");
+ gdb_printf (
+ "beyond what the individual works permit. Inclusion of a covered work\n");
+ gdb_printf (
+ "in an aggregate does not cause this License to apply to the other\n");
gdb_printf ("parts of the aggregate.\n");
gdb_printf ("\n");
gdb_printf (" 6. Conveying Non-Source Forms.\n");
gdb_printf ("\n");
- gdb_printf (" You may convey a covered work in object code form under the terms\n");
+ gdb_printf (
+ " You may convey a covered work in object code form under the terms\n");
gdb_printf ("of sections 4 and 5, provided that you also convey the\n");
- gdb_printf ("machine-readable Corresponding Source under the terms of this License,\n");
+ gdb_printf ("machine-readable Corresponding Source under the terms of this "
+ "License,\n");
gdb_printf ("in one of these ways:\n");
gdb_printf ("\n");
- gdb_printf (" a) Convey the object code in, or embodied in, a physical product\n");
- gdb_printf (" (including a physical distribution medium), accompanied by the\n");
+ gdb_printf (
+ " a) Convey the object code in, or embodied in, a physical product\n");
+ gdb_printf (
+ " (including a physical distribution medium), accompanied by the\n");
gdb_printf (" Corresponding Source fixed on a durable physical medium\n");
gdb_printf (" customarily used for software interchange.\n");
gdb_printf ("\n");
- gdb_printf (" b) Convey the object code in, or embodied in, a physical product\n");
- gdb_printf (" (including a physical distribution medium), accompanied by a\n");
- gdb_printf (" written offer, valid for at least three years and valid for as\n");
- gdb_printf (" long as you offer spare parts or customer support for that product\n");
- gdb_printf (" model, to give anyone who possesses the object code either (1) a\n");
- gdb_printf (" copy of the Corresponding Source for all the software in the\n");
- gdb_printf (" product that is covered by this License, on a durable physical\n");
- gdb_printf (" medium customarily used for software interchange, for a price no\n");
- gdb_printf (" more than your reasonable cost of physically performing this\n");
+ gdb_printf (
+ " b) Convey the object code in, or embodied in, a physical product\n");
+ gdb_printf (
+ " (including a physical distribution medium), accompanied by a\n");
+ gdb_printf (
+ " written offer, valid for at least three years and valid for as\n");
+ gdb_printf (" long as you offer spare parts or customer support for that "
+ "product\n");
+ gdb_printf (
+ " model, to give anyone who possesses the object code either (1) a\n");
+ gdb_printf (
+ " copy of the Corresponding Source for all the software in the\n");
+ gdb_printf (
+ " product that is covered by this License, on a durable physical\n");
+ gdb_printf (
+ " medium customarily used for software interchange, for a price no\n");
+ gdb_printf (
+ " more than your reasonable cost of physically performing this\n");
gdb_printf (" conveying of source, or (2) access to copy the\n");
- gdb_printf (" Corresponding Source from a network server at no charge.\n");
- gdb_printf ("\n");
- gdb_printf (" c) Convey individual copies of the object code with a copy of the\n");
- gdb_printf (" written offer to provide the Corresponding Source. This\n");
- gdb_printf (" alternative is allowed only occasionally and noncommercially, and\n");
- gdb_printf (" only if you received the object code with such an offer, in accord\n");
+ gdb_printf (
+ " Corresponding Source from a network server at no charge.\n");
+ gdb_printf ("\n");
+ gdb_printf (
+ " c) Convey individual copies of the object code with a copy of the\n");
+ gdb_printf (
+ " written offer to provide the Corresponding Source. This\n");
+ gdb_printf (
+ " alternative is allowed only occasionally and noncommercially, and\n");
+ gdb_printf (" only if you received the object code with such an offer, "
+ "in accord\n");
gdb_printf (" with subsection 6b.\n");
gdb_printf ("\n");
- gdb_printf (" d) Convey the object code by offering access from a designated\n");
- gdb_printf (" place (gratis or for a charge), and offer equivalent access to the\n");
- gdb_printf (" Corresponding Source in the same way through the same place at no\n");
- gdb_printf (" further charge. You need not require recipients to copy the\n");
- gdb_printf (" Corresponding Source along with the object code. If the place to\n");
- gdb_printf (" copy the object code is a network server, the Corresponding Source\n");
- gdb_printf (" may be on a different server (operated by you or a third party)\n");
- gdb_printf (" that supports equivalent copying facilities, provided you maintain\n");
- gdb_printf (" clear directions next to the object code saying where to find the\n");
- gdb_printf (" Corresponding Source. Regardless of what server hosts the\n");
- gdb_printf (" Corresponding Source, you remain obligated to ensure that it is\n");
- gdb_printf (" available for as long as needed to satisfy these requirements.\n");
- gdb_printf ("\n");
- gdb_printf (" e) Convey the object code using peer-to-peer transmission, provided\n");
- gdb_printf (" you inform other peers where the object code and Corresponding\n");
- gdb_printf (" Source of the work are being offered to the general public at no\n");
+ gdb_printf (
+ " d) Convey the object code by offering access from a designated\n");
+ gdb_printf (" place (gratis or for a charge), and offer equivalent "
+ "access to the\n");
+ gdb_printf (
+ " Corresponding Source in the same way through the same place at no\n");
+ gdb_printf (
+ " further charge. You need not require recipients to copy the\n");
+ gdb_printf (
+ " Corresponding Source along with the object code. If the place to\n");
+ gdb_printf (" copy the object code is a network server, the "
+ "Corresponding Source\n");
+ gdb_printf (
+ " may be on a different server (operated by you or a third party)\n");
+ gdb_printf (" that supports equivalent copying facilities, provided you "
+ "maintain\n");
+ gdb_printf (
+ " clear directions next to the object code saying where to find the\n");
+ gdb_printf (
+ " Corresponding Source. Regardless of what server hosts the\n");
+ gdb_printf (
+ " Corresponding Source, you remain obligated to ensure that it is\n");
+ gdb_printf (
+ " available for as long as needed to satisfy these requirements.\n");
+ gdb_printf ("\n");
+ gdb_printf (" e) Convey the object code using peer-to-peer transmission, "
+ "provided\n");
+ gdb_printf (
+ " you inform other peers where the object code and Corresponding\n");
+ gdb_printf (
+ " Source of the work are being offered to the general public at no\n");
gdb_printf (" charge under subsection 6d.\n");
gdb_printf ("\n");
- gdb_printf (" A separable portion of the object code, whose source code is excluded\n");
- gdb_printf ("from the Corresponding Source as a System Library, need not be\n");
+ gdb_printf (" A separable portion of the object code, whose source code is "
+ "excluded\n");
+ gdb_printf (
+ "from the Corresponding Source as a System Library, need not be\n");
gdb_printf ("included in conveying the object code work.\n");
gdb_printf ("\n");
- gdb_printf (" A \"User Product\" is either (1) a \"consumer product\", which means any\n");
- gdb_printf ("tangible personal property which is normally used for personal, family,\n");
- gdb_printf ("or household purposes, or (2) anything designed or sold for incorporation\n");
- gdb_printf ("into a dwelling. In determining whether a product is a consumer product,\n");
- gdb_printf ("doubtful cases shall be resolved in favor of coverage. For a particular\n");
- gdb_printf ("product received by a particular user, \"normally used\" refers to a\n");
- gdb_printf ("typical or common use of that class of product, regardless of the status\n");
- gdb_printf ("of the particular user or of the way in which the particular user\n");
- gdb_printf ("actually uses, or expects or is expected to use, the product. A product\n");
- gdb_printf ("is a consumer product regardless of whether the product has substantial\n");
- gdb_printf ("commercial, industrial or non-consumer uses, unless such uses represent\n");
+ gdb_printf (" A \"User Product\" is either (1) a \"consumer product\", "
+ "which means any\n");
+ gdb_printf ("tangible personal property which is normally used for "
+ "personal, family,\n");
+ gdb_printf ("or household purposes, or (2) anything designed or sold for "
+ "incorporation\n");
+ gdb_printf ("into a dwelling. In determining whether a product is a "
+ "consumer product,\n");
+ gdb_printf ("doubtful cases shall be resolved in favor of coverage. For a "
+ "particular\n");
+ gdb_printf (
+ "product received by a particular user, \"normally used\" refers to a\n");
+ gdb_printf ("typical or common use of that class of product, regardless of "
+ "the status\n");
+ gdb_printf (
+ "of the particular user or of the way in which the particular user\n");
+ gdb_printf ("actually uses, or expects or is expected to use, the product. "
+ "A product\n");
+ gdb_printf ("is a consumer product regardless of whether the product has "
+ "substantial\n");
+ gdb_printf ("commercial, industrial or non-consumer uses, unless such uses "
+ "represent\n");
gdb_printf ("the only significant mode of use of the product.\n");
gdb_printf ("\n");
- gdb_printf (" \"Installation Information\" for a User Product means any methods,\n");
- gdb_printf ("procedures, authorization keys, or other information required to install\n");
- gdb_printf ("and execute modified versions of a covered work in that User Product from\n");
- gdb_printf ("a modified version of its Corresponding Source. The information must\n");
- gdb_printf ("suffice to ensure that the continued functioning of the modified object\n");
- gdb_printf ("code is in no case prevented or interfered with solely because\n");
+ gdb_printf (
+ " \"Installation Information\" for a User Product means any methods,\n");
+ gdb_printf ("procedures, authorization keys, or other information required "
+ "to install\n");
+ gdb_printf ("and execute modified versions of a covered work in that User "
+ "Product from\n");
+ gdb_printf (
+ "a modified version of its Corresponding Source. The information must\n");
+ gdb_printf ("suffice to ensure that the continued functioning of the "
+ "modified object\n");
+ gdb_printf (
+ "code is in no case prevented or interfered with solely because\n");
gdb_printf ("modification has been made.\n");
gdb_printf ("\n");
- gdb_printf (" If you convey an object code work under this section in, or with, or\n");
- gdb_printf ("specifically for use in, a User Product, and the conveying occurs as\n");
- gdb_printf ("part of a transaction in which the right of possession and use of the\n");
- gdb_printf ("User Product is transferred to the recipient in perpetuity or for a\n");
- gdb_printf ("fixed term (regardless of how the transaction is characterized), the\n");
- gdb_printf ("Corresponding Source conveyed under this section must be accompanied\n");
- gdb_printf ("by the Installation Information. But this requirement does not apply\n");
- gdb_printf ("if neither you nor any third party retains the ability to install\n");
- gdb_printf ("modified object code on the User Product (for example, the work has\n");
+ gdb_printf (" If you convey an object code work under this section in, or "
+ "with, or\n");
+ gdb_printf (
+ "specifically for use in, a User Product, and the conveying occurs as\n");
+ gdb_printf (
+ "part of a transaction in which the right of possession and use of the\n");
+ gdb_printf (
+ "User Product is transferred to the recipient in perpetuity or for a\n");
+ gdb_printf (
+ "fixed term (regardless of how the transaction is characterized), the\n");
+ gdb_printf (
+ "Corresponding Source conveyed under this section must be accompanied\n");
+ gdb_printf (
+ "by the Installation Information. But this requirement does not apply\n");
+ gdb_printf (
+ "if neither you nor any third party retains the ability to install\n");
+ gdb_printf (
+ "modified object code on the User Product (for example, the work has\n");
gdb_printf ("been installed in ROM).\n");
gdb_printf ("\n");
- gdb_printf (" The requirement to provide Installation Information does not include a\n");
- gdb_printf ("requirement to continue to provide support service, warranty, or updates\n");
- gdb_printf ("for a work that has been modified or installed by the recipient, or for\n");
- gdb_printf ("the User Product in which it has been modified or installed. Access to a\n");
- gdb_printf ("network may be denied when the modification itself materially and\n");
- gdb_printf ("adversely affects the operation of the network or violates the rules and\n");
+ gdb_printf (" The requirement to provide Installation Information does not "
+ "include a\n");
+ gdb_printf ("requirement to continue to provide support service, warranty, "
+ "or updates\n");
+ gdb_printf ("for a work that has been modified or installed by the "
+ "recipient, or for\n");
+ gdb_printf ("the User Product in which it has been modified or installed. "
+ "Access to a\n");
+ gdb_printf (
+ "network may be denied when the modification itself materially and\n");
+ gdb_printf ("adversely affects the operation of the network or violates the "
+ "rules and\n");
gdb_printf ("protocols for communication across the network.\n");
gdb_printf ("\n");
- gdb_printf (" Corresponding Source conveyed, and Installation Information provided,\n");
- gdb_printf ("in accord with this section must be in a format that is publicly\n");
- gdb_printf ("documented (and with an implementation available to the public in\n");
- gdb_printf ("source code form), and must require no special password or key for\n");
+ gdb_printf (" Corresponding Source conveyed, and Installation Information "
+ "provided,\n");
+ gdb_printf (
+ "in accord with this section must be in a format that is publicly\n");
+ gdb_printf (
+ "documented (and with an implementation available to the public in\n");
+ gdb_printf (
+ "source code form), and must require no special password or key for\n");
gdb_printf ("unpacking, reading or copying.\n");
gdb_printf ("\n");
gdb_printf (" 7. Additional Terms.\n");
gdb_printf ("\n");
- gdb_printf (" \"Additional permissions\" are terms that supplement the terms of this\n");
- gdb_printf ("License by making exceptions from one or more of its conditions.\n");
- gdb_printf ("Additional permissions that are applicable to the entire Program shall\n");
- gdb_printf ("be treated as though they were included in this License, to the extent\n");
- gdb_printf ("that they are valid under applicable law. If additional permissions\n");
- gdb_printf ("apply only to part of the Program, that part may be used separately\n");
- gdb_printf ("under those permissions, but the entire Program remains governed by\n");
+ gdb_printf (" \"Additional permissions\" are terms that supplement the "
+ "terms of this\n");
+ gdb_printf (
+ "License by making exceptions from one or more of its conditions.\n");
+ gdb_printf ("Additional permissions that are applicable to the entire "
+ "Program shall\n");
+ gdb_printf ("be treated as though they were included in this License, to "
+ "the extent\n");
+ gdb_printf (
+ "that they are valid under applicable law. If additional permissions\n");
+ gdb_printf (
+ "apply only to part of the Program, that part may be used separately\n");
+ gdb_printf (
+ "under those permissions, but the entire Program remains governed by\n");
gdb_printf ("this License without regard to the additional permissions.\n");
gdb_printf ("\n");
- gdb_printf (" When you convey a copy of a covered work, you may at your option\n");
- gdb_printf ("remove any additional permissions from that copy, or from any part of\n");
- gdb_printf ("it. (Additional permissions may be written to require their own\n");
- gdb_printf ("removal in certain cases when you modify the work.) You may place\n");
- gdb_printf ("additional permissions on material, added by you to a covered work,\n");
- gdb_printf ("for which you have or can give appropriate copyright permission.\n");
- gdb_printf ("\n");
- gdb_printf (" Notwithstanding any other provision of this License, for material you\n");
- gdb_printf ("add to a covered work, you may (if authorized by the copyright holders of\n");
- gdb_printf ("that material) supplement the terms of this License with terms:\n");
- gdb_printf ("\n");
- gdb_printf (" a) Disclaiming warranty or limiting liability differently from the\n");
+ gdb_printf (
+ " When you convey a copy of a covered work, you may at your option\n");
+ gdb_printf (
+ "remove any additional permissions from that copy, or from any part of\n");
+ gdb_printf (
+ "it. (Additional permissions may be written to require their own\n");
+ gdb_printf (
+ "removal in certain cases when you modify the work.) You may place\n");
+ gdb_printf (
+ "additional permissions on material, added by you to a covered work,\n");
+ gdb_printf (
+ "for which you have or can give appropriate copyright permission.\n");
+ gdb_printf ("\n");
+ gdb_printf (" Notwithstanding any other provision of this License, for "
+ "material you\n");
+ gdb_printf ("add to a covered work, you may (if authorized by the copyright "
+ "holders of\n");
+ gdb_printf (
+ "that material) supplement the terms of this License with terms:\n");
+ gdb_printf ("\n");
+ gdb_printf (" a) Disclaiming warranty or limiting liability differently "
+ "from the\n");
gdb_printf (" terms of sections 15 and 16 of this License; or\n");
gdb_printf ("\n");
- gdb_printf (" b) Requiring preservation of specified reasonable legal notices or\n");
- gdb_printf (" author attributions in that material or in the Appropriate Legal\n");
+ gdb_printf (" b) Requiring preservation of specified reasonable legal "
+ "notices or\n");
+ gdb_printf (
+ " author attributions in that material or in the Appropriate Legal\n");
gdb_printf (" Notices displayed by works containing it; or\n");
gdb_printf ("\n");
- gdb_printf (" c) Prohibiting misrepresentation of the origin of that material, or\n");
- gdb_printf (" requiring that modified versions of such material be marked in\n");
- gdb_printf (" reasonable ways as different from the original version; or\n");
+ gdb_printf (" c) Prohibiting misrepresentation of the origin of that "
+ "material, or\n");
+ gdb_printf (
+ " requiring that modified versions of such material be marked in\n");
+ gdb_printf (
+ " reasonable ways as different from the original version; or\n");
gdb_printf ("\n");
- gdb_printf (" d) Limiting the use for publicity purposes of names of licensors or\n");
+ gdb_printf (" d) Limiting the use for publicity purposes of names of "
+ "licensors or\n");
gdb_printf (" authors of the material; or\n");
gdb_printf ("\n");
- gdb_printf (" e) Declining to grant rights under trademark law for use of some\n");
+ gdb_printf (
+ " e) Declining to grant rights under trademark law for use of some\n");
gdb_printf (" trade names, trademarks, or service marks; or\n");
gdb_printf ("\n");
- gdb_printf (" f) Requiring indemnification of licensors and authors of that\n");
- gdb_printf (" material by anyone who conveys the material (or modified versions of\n");
- gdb_printf (" it) with contractual assumptions of liability to the recipient, for\n");
- gdb_printf (" any liability that these contractual assumptions directly impose on\n");
+ gdb_printf (
+ " f) Requiring indemnification of licensors and authors of that\n");
+ gdb_printf (" material by anyone who conveys the material (or modified "
+ "versions of\n");
+ gdb_printf (" it) with contractual assumptions of liability to the "
+ "recipient, for\n");
+ gdb_printf (" any liability that these contractual assumptions directly "
+ "impose on\n");
gdb_printf (" those licensors and authors.\n");
gdb_printf ("\n");
- gdb_printf (" All other non-permissive additional terms are considered \"further\n");
- gdb_printf ("restrictions\" within the meaning of section 10. If the Program as you\n");
- gdb_printf ("received it, or any part of it, contains a notice stating that it is\n");
- gdb_printf ("governed by this License along with a term that is a further\n");
- gdb_printf ("restriction, you may remove that term. If a license document contains\n");
- gdb_printf ("a further restriction but permits relicensing or conveying under this\n");
- gdb_printf ("License, you may add to a covered work material governed by the terms\n");
- gdb_printf ("of that license document, provided that the further restriction does\n");
+ gdb_printf (
+ " All other non-permissive additional terms are considered \"further\n");
+ gdb_printf ("restrictions\" within the meaning of section 10. If the "
+ "Program as you\n");
+ gdb_printf (
+ "received it, or any part of it, contains a notice stating that it is\n");
+ gdb_printf (
+ "governed by this License along with a term that is a further\n");
+ gdb_printf ("restriction, you may remove that term. If a license document "
+ "contains\n");
+ gdb_printf (
+ "a further restriction but permits relicensing or conveying under this\n");
+ gdb_printf (
+ "License, you may add to a covered work material governed by the terms\n");
+ gdb_printf (
+ "of that license document, provided that the further restriction does\n");
gdb_printf ("not survive such relicensing or conveying.\n");
gdb_printf ("\n");
- gdb_printf (" If you add terms to a covered work in accord with this section, you\n");
- gdb_printf ("must place, in the relevant source files, a statement of the\n");
- gdb_printf ("additional terms that apply to those files, or a notice indicating\n");
+ gdb_printf (
+ " If you add terms to a covered work in accord with this section, you\n");
+ gdb_printf (
+ "must place, in the relevant source files, a statement of the\n");
+ gdb_printf (
+ "additional terms that apply to those files, or a notice indicating\n");
gdb_printf ("where to find the applicable terms.\n");
gdb_printf ("\n");
- gdb_printf (" Additional terms, permissive or non-permissive, may be stated in the\n");
- gdb_printf ("form of a separately written license, or stated as exceptions;\n");
+ gdb_printf (" Additional terms, permissive or non-permissive, may be "
+ "stated in the\n");
+ gdb_printf (
+ "form of a separately written license, or stated as exceptions;\n");
gdb_printf ("the above requirements apply either way.\n");
gdb_printf ("\n");
gdb_printf (" 8. Termination.\n");
gdb_printf ("\n");
- gdb_printf (" You may not propagate or modify a covered work except as expressly\n");
- gdb_printf ("provided under this License. Any attempt otherwise to propagate or\n");
- gdb_printf ("modify it is void, and will automatically terminate your rights under\n");
- gdb_printf ("this License (including any patent licenses granted under the third\n");
+ gdb_printf (
+ " You may not propagate or modify a covered work except as expressly\n");
+ gdb_printf (
+ "provided under this License. Any attempt otherwise to propagate or\n");
+ gdb_printf (
+ "modify it is void, and will automatically terminate your rights under\n");
+ gdb_printf (
+ "this License (including any patent licenses granted under the third\n");
gdb_printf ("paragraph of section 11).\n");
gdb_printf ("\n");
- gdb_printf (" However, if you cease all violation of this License, then your\n");
- gdb_printf ("license from a particular copyright holder is reinstated (a)\n");
- gdb_printf ("provisionally, unless and until the copyright holder explicitly and\n");
- gdb_printf ("finally terminates your license, and (b) permanently, if the copyright\n");
- gdb_printf ("holder fails to notify you of the violation by some reasonable means\n");
+ gdb_printf (
+ " However, if you cease all violation of this License, then your\n");
+ gdb_printf (
+ "license from a particular copyright holder is reinstated (a)\n");
+ gdb_printf (
+ "provisionally, unless and until the copyright holder explicitly and\n");
+ gdb_printf ("finally terminates your license, and (b) permanently, if the "
+ "copyright\n");
+ gdb_printf (
+ "holder fails to notify you of the violation by some reasonable means\n");
gdb_printf ("prior to 60 days after the cessation.\n");
gdb_printf ("\n");
- gdb_printf (" Moreover, your license from a particular copyright holder is\n");
- gdb_printf ("reinstated permanently if the copyright holder notifies you of the\n");
- gdb_printf ("violation by some reasonable means, this is the first time you have\n");
- gdb_printf ("received notice of violation of this License (for any work) from that\n");
- gdb_printf ("copyright holder, and you cure the violation prior to 30 days after\n");
+ gdb_printf (
+ " Moreover, your license from a particular copyright holder is\n");
+ gdb_printf (
+ "reinstated permanently if the copyright holder notifies you of the\n");
+ gdb_printf (
+ "violation by some reasonable means, this is the first time you have\n");
+ gdb_printf (
+ "received notice of violation of this License (for any work) from that\n");
+ gdb_printf (
+ "copyright holder, and you cure the violation prior to 30 days after\n");
gdb_printf ("your receipt of the notice.\n");
gdb_printf ("\n");
- gdb_printf (" Termination of your rights under this section does not terminate the\n");
- gdb_printf ("licenses of parties who have received copies or rights from you under\n");
- gdb_printf ("this License. If your rights have been terminated and not permanently\n");
- gdb_printf ("reinstated, you do not qualify to receive new licenses for the same\n");
+ gdb_printf (" Termination of your rights under this section does not "
+ "terminate the\n");
+ gdb_printf (
+ "licenses of parties who have received copies or rights from you under\n");
+ gdb_printf ("this License. If your rights have been terminated and not "
+ "permanently\n");
+ gdb_printf (
+ "reinstated, you do not qualify to receive new licenses for the same\n");
gdb_printf ("material under section 10.\n");
gdb_printf ("\n");
gdb_printf (" 9. Acceptance Not Required for Having Copies.\n");
gdb_printf ("\n");
- gdb_printf (" You are not required to accept this License in order to receive or\n");
- gdb_printf ("run a copy of the Program. Ancillary propagation of a covered work\n");
- gdb_printf ("occurring solely as a consequence of using peer-to-peer transmission\n");
- gdb_printf ("to receive a copy likewise does not require acceptance. However,\n");
- gdb_printf ("nothing other than this License grants you permission to propagate or\n");
- gdb_printf ("modify any covered work. These actions infringe copyright if you do\n");
- gdb_printf ("not accept this License. Therefore, by modifying or propagating a\n");
- gdb_printf ("covered work, you indicate your acceptance of this License to do so.\n");
+ gdb_printf (
+ " You are not required to accept this License in order to receive or\n");
+ gdb_printf (
+ "run a copy of the Program. Ancillary propagation of a covered work\n");
+ gdb_printf (
+ "occurring solely as a consequence of using peer-to-peer transmission\n");
+ gdb_printf (
+ "to receive a copy likewise does not require acceptance. However,\n");
+ gdb_printf (
+ "nothing other than this License grants you permission to propagate or\n");
+ gdb_printf (
+ "modify any covered work. These actions infringe copyright if you do\n");
+ gdb_printf (
+ "not accept this License. Therefore, by modifying or propagating a\n");
+ gdb_printf (
+ "covered work, you indicate your acceptance of this License to do so.\n");
gdb_printf ("\n");
gdb_printf (" 10. Automatic Licensing of Downstream Recipients.\n");
gdb_printf ("\n");
- gdb_printf (" Each time you convey a covered work, the recipient automatically\n");
- gdb_printf ("receives a license from the original licensors, to run, modify and\n");
- gdb_printf ("propagate that work, subject to this License. You are not responsible\n");
- gdb_printf ("for enforcing compliance by third parties with this License.\n");
- gdb_printf ("\n");
- gdb_printf (" An \"entity transaction\" is a transaction transferring control of an\n");
- gdb_printf ("organization, or substantially all assets of one, or subdividing an\n");
- gdb_printf ("organization, or merging organizations. If propagation of a covered\n");
+ gdb_printf (
+ " Each time you convey a covered work, the recipient automatically\n");
+ gdb_printf (
+ "receives a license from the original licensors, to run, modify and\n");
+ gdb_printf ("propagate that work, subject to this License. You are not "
+ "responsible\n");
+ gdb_printf (
+ "for enforcing compliance by third parties with this License.\n");
+ gdb_printf ("\n");
+ gdb_printf (" An \"entity transaction\" is a transaction transferring "
+ "control of an\n");
+ gdb_printf (
+ "organization, or substantially all assets of one, or subdividing an\n");
+ gdb_printf (
+ "organization, or merging organizations. If propagation of a covered\n");
gdb_printf ("work results from an entity transaction, each party to that\n");
- gdb_printf ("transaction who receives a copy of the work also receives whatever\n");
- gdb_printf ("licenses to the work the party's predecessor in interest had or could\n");
- gdb_printf ("give under the previous paragraph, plus a right to possession of the\n");
- gdb_printf ("Corresponding Source of the work from the predecessor in interest, if\n");
- gdb_printf ("the predecessor has it or can get it with reasonable efforts.\n");
- gdb_printf ("\n");
- gdb_printf (" You may not impose any further restrictions on the exercise of the\n");
- gdb_printf ("rights granted or affirmed under this License. For example, you may\n");
- gdb_printf ("not impose a license fee, royalty, or other charge for exercise of\n");
- gdb_printf ("rights granted under this License, and you may not initiate litigation\n");
- gdb_printf ("(including a cross-claim or counterclaim in a lawsuit) alleging that\n");
- gdb_printf ("any patent claim is infringed by making, using, selling, offering for\n");
+ gdb_printf (
+ "transaction who receives a copy of the work also receives whatever\n");
+ gdb_printf (
+ "licenses to the work the party's predecessor in interest had or could\n");
+ gdb_printf (
+ "give under the previous paragraph, plus a right to possession of the\n");
+ gdb_printf (
+ "Corresponding Source of the work from the predecessor in interest, if\n");
+ gdb_printf (
+ "the predecessor has it or can get it with reasonable efforts.\n");
+ gdb_printf ("\n");
+ gdb_printf (
+ " You may not impose any further restrictions on the exercise of the\n");
+ gdb_printf (
+ "rights granted or affirmed under this License. For example, you may\n");
+ gdb_printf (
+ "not impose a license fee, royalty, or other charge for exercise of\n");
+ gdb_printf ("rights granted under this License, and you may not initiate "
+ "litigation\n");
+ gdb_printf (
+ "(including a cross-claim or counterclaim in a lawsuit) alleging that\n");
+ gdb_printf (
+ "any patent claim is infringed by making, using, selling, offering for\n");
gdb_printf ("sale, or importing the Program or any portion of it.\n");
gdb_printf ("\n");
gdb_printf (" 11. Patents.\n");
gdb_printf ("\n");
- gdb_printf (" A \"contributor\" is a copyright holder who authorizes use under this\n");
- gdb_printf ("License of the Program or a work on which the Program is based. The\n");
- gdb_printf ("work thus licensed is called the contributor's \"contributor version\".\n");
- gdb_printf ("\n");
- gdb_printf (" A contributor's \"essential patent claims\" are all patent claims\n");
- gdb_printf ("owned or controlled by the contributor, whether already acquired or\n");
- gdb_printf ("hereafter acquired, that would be infringed by some manner, permitted\n");
- gdb_printf ("by this License, of making, using, or selling its contributor version,\n");
+ gdb_printf (" A \"contributor\" is a copyright holder who authorizes use "
+ "under this\n");
+ gdb_printf (
+ "License of the Program or a work on which the Program is based. The\n");
+ gdb_printf ("work thus licensed is called the contributor's \"contributor "
+ "version\".\n");
+ gdb_printf ("\n");
+ gdb_printf (
+ " A contributor's \"essential patent claims\" are all patent claims\n");
+ gdb_printf (
+ "owned or controlled by the contributor, whether already acquired or\n");
+ gdb_printf (
+ "hereafter acquired, that would be infringed by some manner, permitted\n");
+ gdb_printf ("by this License, of making, using, or selling its contributor "
+ "version,\n");
gdb_printf ("but do not include claims that would be infringed only as a\n");
- gdb_printf ("consequence of further modification of the contributor version. For\n");
- gdb_printf ("purposes of this definition, \"control\" includes the right to grant\n");
- gdb_printf ("patent sublicenses in a manner consistent with the requirements of\n");
+ gdb_printf (
+ "consequence of further modification of the contributor version. For\n");
+ gdb_printf (
+ "purposes of this definition, \"control\" includes the right to grant\n");
+ gdb_printf (
+ "patent sublicenses in a manner consistent with the requirements of\n");
gdb_printf ("this License.\n");
gdb_printf ("\n");
- gdb_printf (" Each contributor grants you a non-exclusive, worldwide, royalty-free\n");
- gdb_printf ("patent license under the contributor's essential patent claims, to\n");
- gdb_printf ("make, use, sell, offer for sale, import and otherwise run, modify and\n");
+ gdb_printf (" Each contributor grants you a non-exclusive, worldwide, "
+ "royalty-free\n");
+ gdb_printf (
+ "patent license under the contributor's essential patent claims, to\n");
+ gdb_printf (
+ "make, use, sell, offer for sale, import and otherwise run, modify and\n");
gdb_printf ("propagate the contents of its contributor version.\n");
gdb_printf ("\n");
- gdb_printf (" In the following three paragraphs, a \"patent license\" is any express\n");
- gdb_printf ("agreement or commitment, however denominated, not to enforce a patent\n");
- gdb_printf ("(such as an express permission to practice a patent or covenant not to\n");
- gdb_printf ("sue for patent infringement). To \"grant\" such a patent license to a\n");
- gdb_printf ("party means to make such an agreement or commitment not to enforce a\n");
+ gdb_printf (" In the following three paragraphs, a \"patent license\" is "
+ "any express\n");
+ gdb_printf (
+ "agreement or commitment, however denominated, not to enforce a patent\n");
+ gdb_printf ("(such as an express permission to practice a patent or "
+ "covenant not to\n");
+ gdb_printf ("sue for patent infringement). To \"grant\" such a patent "
+ "license to a\n");
+ gdb_printf (
+ "party means to make such an agreement or commitment not to enforce a\n");
gdb_printf ("patent against the party.\n");
gdb_printf ("\n");
- gdb_printf (" If you convey a covered work, knowingly relying on a patent license,\n");
- gdb_printf ("and the Corresponding Source of the work is not available for anyone\n");
- gdb_printf ("to copy, free of charge and under the terms of this License, through a\n");
- gdb_printf ("publicly available network server or other readily accessible means,\n");
- gdb_printf ("then you must either (1) cause the Corresponding Source to be so\n");
- gdb_printf ("available, or (2) arrange to deprive yourself of the benefit of the\n");
- gdb_printf ("patent license for this particular work, or (3) arrange, in a manner\n");
- gdb_printf ("consistent with the requirements of this License, to extend the patent\n");
- gdb_printf ("license to downstream recipients. \"Knowingly relying\" means you have\n");
- gdb_printf ("actual knowledge that, but for the patent license, your conveying the\n");
- gdb_printf ("covered work in a country, or your recipient's use of the covered work\n");
- gdb_printf ("in a country, would infringe one or more identifiable patents in that\n");
+ gdb_printf (" If you convey a covered work, knowingly relying on a patent "
+ "license,\n");
+ gdb_printf (
+ "and the Corresponding Source of the work is not available for anyone\n");
+ gdb_printf ("to copy, free of charge and under the terms of this License, "
+ "through a\n");
+ gdb_printf (
+ "publicly available network server or other readily accessible means,\n");
+ gdb_printf (
+ "then you must either (1) cause the Corresponding Source to be so\n");
+ gdb_printf (
+ "available, or (2) arrange to deprive yourself of the benefit of the\n");
+ gdb_printf (
+ "patent license for this particular work, or (3) arrange, in a manner\n");
+ gdb_printf ("consistent with the requirements of this License, to extend "
+ "the patent\n");
+ gdb_printf ("license to downstream recipients. \"Knowingly relying\" means "
+ "you have\n");
+ gdb_printf (
+ "actual knowledge that, but for the patent license, your conveying the\n");
+ gdb_printf ("covered work in a country, or your recipient's use of the "
+ "covered work\n");
+ gdb_printf (
+ "in a country, would infringe one or more identifiable patents in that\n");
gdb_printf ("country that you have reason to believe are valid.\n");
gdb_printf ("\n");
- gdb_printf (" If, pursuant to or in connection with a single transaction or\n");
- gdb_printf ("arrangement, you convey, or propagate by procuring conveyance of, a\n");
- gdb_printf ("covered work, and grant a patent license to some of the parties\n");
- gdb_printf ("receiving the covered work authorizing them to use, propagate, modify\n");
- gdb_printf ("or convey a specific copy of the covered work, then the patent license\n");
- gdb_printf ("you grant is automatically extended to all recipients of the covered\n");
+ gdb_printf (
+ " If, pursuant to or in connection with a single transaction or\n");
+ gdb_printf (
+ "arrangement, you convey, or propagate by procuring conveyance of, a\n");
+ gdb_printf (
+ "covered work, and grant a patent license to some of the parties\n");
+ gdb_printf (
+ "receiving the covered work authorizing them to use, propagate, modify\n");
+ gdb_printf ("or convey a specific copy of the covered work, then the patent "
+ "license\n");
+ gdb_printf (
+ "you grant is automatically extended to all recipients of the covered\n");
gdb_printf ("work and works based on it.\n");
gdb_printf ("\n");
- gdb_printf (" A patent license is \"discriminatory\" if it does not include within\n");
+ gdb_printf (" A patent license is \"discriminatory\" if it does not "
+ "include within\n");
gdb_printf ("the scope of its coverage, prohibits the exercise of, or is\n");
- gdb_printf ("conditioned on the non-exercise of one or more of the rights that are\n");
- gdb_printf ("specifically granted under this License. You may not convey a covered\n");
- gdb_printf ("work if you are a party to an arrangement with a third party that is\n");
- gdb_printf ("in the business of distributing software, under which you make payment\n");
- gdb_printf ("to the third party based on the extent of your activity of conveying\n");
- gdb_printf ("the work, and under which the third party grants, to any of the\n");
- gdb_printf ("parties who would receive the covered work from you, a discriminatory\n");
- gdb_printf ("patent license (a) in connection with copies of the covered work\n");
- gdb_printf ("conveyed by you (or copies made from those copies), or (b) primarily\n");
- gdb_printf ("for and in connection with specific products or compilations that\n");
- gdb_printf ("contain the covered work, unless you entered into that arrangement,\n");
+ gdb_printf (
+ "conditioned on the non-exercise of one or more of the rights that are\n");
+ gdb_printf ("specifically granted under this License. You may not convey a "
+ "covered\n");
+ gdb_printf (
+ "work if you are a party to an arrangement with a third party that is\n");
+ gdb_printf ("in the business of distributing software, under which you make "
+ "payment\n");
+ gdb_printf (
+ "to the third party based on the extent of your activity of conveying\n");
+ gdb_printf (
+ "the work, and under which the third party grants, to any of the\n");
+ gdb_printf (
+ "parties who would receive the covered work from you, a discriminatory\n");
+ gdb_printf (
+ "patent license (a) in connection with copies of the covered work\n");
+ gdb_printf (
+ "conveyed by you (or copies made from those copies), or (b) primarily\n");
+ gdb_printf (
+ "for and in connection with specific products or compilations that\n");
+ gdb_printf (
+ "contain the covered work, unless you entered into that arrangement,\n");
gdb_printf ("or that patent license was granted, prior to 28 March 2007.\n");
gdb_printf ("\n");
- gdb_printf (" Nothing in this License shall be construed as excluding or limiting\n");
- gdb_printf ("any implied license or other defenses to infringement that may\n");
+ gdb_printf (
+ " Nothing in this License shall be construed as excluding or limiting\n");
+ gdb_printf (
+ "any implied license or other defenses to infringement that may\n");
gdb_printf ("otherwise be available to you under applicable patent law.\n");
gdb_printf ("\n");
gdb_printf (" 12. No Surrender of Others' Freedom.\n");
gdb_printf ("\n");
- gdb_printf (" If conditions are imposed on you (whether by court order, agreement or\n");
- gdb_printf ("otherwise) that contradict the conditions of this License, they do not\n");
- gdb_printf ("excuse you from the conditions of this License. If you cannot convey a\n");
- gdb_printf ("covered work so as to satisfy simultaneously your obligations under this\n");
- gdb_printf ("License and any other pertinent obligations, then as a consequence you may\n");
- gdb_printf ("not convey it at all. For example, if you agree to terms that obligate you\n");
- gdb_printf ("to collect a royalty for further conveying from those to whom you convey\n");
- gdb_printf ("the Program, the only way you could satisfy both those terms and this\n");
- gdb_printf ("License would be to refrain entirely from conveying the Program.\n");
+ gdb_printf (" If conditions are imposed on you (whether by court order, "
+ "agreement or\n");
+ gdb_printf ("otherwise) that contradict the conditions of this License, "
+ "they do not\n");
+ gdb_printf ("excuse you from the conditions of this License. If you cannot "
+ "convey a\n");
+ gdb_printf ("covered work so as to satisfy simultaneously your obligations "
+ "under this\n");
+ gdb_printf ("License and any other pertinent obligations, then as a "
+ "consequence you may\n");
+ gdb_printf ("not convey it at all. For example, if you agree to terms that "
+ "obligate you\n");
+ gdb_printf ("to collect a royalty for further conveying from those to whom "
+ "you convey\n");
+ gdb_printf (
+ "the Program, the only way you could satisfy both those terms and this\n");
+ gdb_printf (
+ "License would be to refrain entirely from conveying the Program.\n");
gdb_printf ("\n");
gdb_printf (" 13. Use with the GNU Affero General Public License.\n");
gdb_printf ("\n");
- gdb_printf (" Notwithstanding any other provision of this License, you have\n");
- gdb_printf ("permission to link or combine any covered work with a work licensed\n");
- gdb_printf ("under version 3 of the GNU Affero General Public License into a single\n");
- gdb_printf ("combined work, and to convey the resulting work. The terms of this\n");
- gdb_printf ("License will continue to apply to the part which is the covered work,\n");
- gdb_printf ("but the special requirements of the GNU Affero General Public License,\n");
- gdb_printf ("section 13, concerning interaction through a network will apply to the\n");
+ gdb_printf (
+ " Notwithstanding any other provision of this License, you have\n");
+ gdb_printf (
+ "permission to link or combine any covered work with a work licensed\n");
+ gdb_printf ("under version 3 of the GNU Affero General Public License into "
+ "a single\n");
+ gdb_printf (
+ "combined work, and to convey the resulting work. The terms of this\n");
+ gdb_printf (
+ "License will continue to apply to the part which is the covered work,\n");
+ gdb_printf ("but the special requirements of the GNU Affero General Public "
+ "License,\n");
+ gdb_printf ("section 13, concerning interaction through a network will "
+ "apply to the\n");
gdb_printf ("combination as such.\n");
gdb_printf ("\n");
gdb_printf (" 14. Revised Versions of this License.\n");
gdb_printf ("\n");
- gdb_printf (" The Free Software Foundation may publish revised and/or new versions of\n");
- gdb_printf ("the GNU General Public License from time to time. Such new versions will\n");
- gdb_printf ("be similar in spirit to the present version, but may differ in detail to\n");
+ gdb_printf (" The Free Software Foundation may publish revised and/or new "
+ "versions of\n");
+ gdb_printf ("the GNU General Public License from time to time. Such new "
+ "versions will\n");
+ gdb_printf ("be similar in spirit to the present version, but may differ in "
+ "detail to\n");
gdb_printf ("address new problems or concerns.\n");
gdb_printf ("\n");
- gdb_printf (" Each version is given a distinguishing version number. If the\n");
- gdb_printf ("Program specifies that a certain numbered version of the GNU General\n");
- gdb_printf ("Public License \"or any later version\" applies to it, you have the\n");
- gdb_printf ("option of following the terms and conditions either of that numbered\n");
- gdb_printf ("version or of any later version published by the Free Software\n");
- gdb_printf ("Foundation. If the Program does not specify a version number of the\n");
- gdb_printf ("GNU General Public License, you may choose any version ever published\n");
+ gdb_printf (
+ " Each version is given a distinguishing version number. If the\n");
+ gdb_printf (
+ "Program specifies that a certain numbered version of the GNU General\n");
+ gdb_printf (
+ "Public License \"or any later version\" applies to it, you have the\n");
+ gdb_printf (
+ "option of following the terms and conditions either of that numbered\n");
+ gdb_printf (
+ "version or of any later version published by the Free Software\n");
+ gdb_printf (
+ "Foundation. If the Program does not specify a version number of the\n");
+ gdb_printf (
+ "GNU General Public License, you may choose any version ever published\n");
gdb_printf ("by the Free Software Foundation.\n");
gdb_printf ("\n");
- gdb_printf (" If the Program specifies that a proxy can decide which future\n");
- gdb_printf ("versions of the GNU General Public License can be used, that proxy's\n");
- gdb_printf ("public statement of acceptance of a version permanently authorizes you\n");
+ gdb_printf (
+ " If the Program specifies that a proxy can decide which future\n");
+ gdb_printf (
+ "versions of the GNU General Public License can be used, that proxy's\n");
+ gdb_printf ("public statement of acceptance of a version permanently "
+ "authorizes you\n");
gdb_printf ("to choose that version for the Program.\n");
gdb_printf ("\n");
- gdb_printf (" Later license versions may give you additional or different\n");
- gdb_printf ("permissions. However, no additional obligations are imposed on any\n");
- gdb_printf ("author or copyright holder as a result of your choosing to follow a\n");
+ gdb_printf (
+ " Later license versions may give you additional or different\n");
+ gdb_printf (
+ "permissions. However, no additional obligations are imposed on any\n");
+ gdb_printf (
+ "author or copyright holder as a result of your choosing to follow a\n");
gdb_printf ("later version.\n");
gdb_printf ("\n");
}
@@ -608,52 +1004,71 @@ show_warranty_command (const char *ignore, int from_tty)
{
gdb_printf (" 15. Disclaimer of Warranty.\n");
gdb_printf ("\n");
- gdb_printf (" THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY\n");
- gdb_printf ("APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT\n");
- gdb_printf ("HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM \"AS IS\" WITHOUT WARRANTY\n");
- gdb_printf ("OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,\n");
- gdb_printf ("THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR\n");
- gdb_printf ("PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM\n");
- gdb_printf ("IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF\n");
+ gdb_printf (
+ " THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY\n");
+ gdb_printf ("APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE "
+ "COPYRIGHT\n");
+ gdb_printf ("HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM \"AS IS\" "
+ "WITHOUT WARRANTY\n");
+ gdb_printf ("OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT "
+ "LIMITED TO,\n");
+ gdb_printf ("THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A "
+ "PARTICULAR\n");
+ gdb_printf ("PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF "
+ "THE PROGRAM\n");
+ gdb_printf ("IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME "
+ "THE COST OF\n");
gdb_printf ("ALL NECESSARY SERVICING, REPAIR OR CORRECTION.\n");
gdb_printf ("\n");
gdb_printf (" 16. Limitation of Liability.\n");
gdb_printf ("\n");
- gdb_printf (" IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING\n");
- gdb_printf ("WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS\n");
- gdb_printf ("THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY\n");
- gdb_printf ("GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE\n");
- gdb_printf ("USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF\n");
- gdb_printf ("DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD\n");
- gdb_printf ("PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),\n");
- gdb_printf ("EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF\n");
+ gdb_printf (" IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO "
+ "IN WRITING\n");
+ gdb_printf ("WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES "
+ "AND/OR CONVEYS\n");
+ gdb_printf ("THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, "
+ "INCLUDING ANY\n");
+ gdb_printf ("GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING "
+ "OUT OF THE\n");
+ gdb_printf ("USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED "
+ "TO LOSS OF\n");
+ gdb_printf ("DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY "
+ "YOU OR THIRD\n");
+ gdb_printf ("PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER "
+ "PROGRAMS),\n");
+ gdb_printf ("EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE "
+ "POSSIBILITY OF\n");
gdb_printf ("SUCH DAMAGES.\n");
gdb_printf ("\n");
gdb_printf (" 17. Interpretation of Sections 15 and 16.\n");
gdb_printf ("\n");
- gdb_printf (" If the disclaimer of warranty and limitation of liability provided\n");
- gdb_printf ("above cannot be given local legal effect according to their terms,\n");
- gdb_printf ("reviewing courts shall apply local law that most closely approximates\n");
- gdb_printf ("an absolute waiver of all civil liability in connection with the\n");
- gdb_printf ("Program, unless a warranty or assumption of liability accompanies a\n");
+ gdb_printf (
+ " If the disclaimer of warranty and limitation of liability provided\n");
+ gdb_printf (
+ "above cannot be given local legal effect according to their terms,\n");
+ gdb_printf (
+ "reviewing courts shall apply local law that most closely approximates\n");
+ gdb_printf (
+ "an absolute waiver of all civil liability in connection with the\n");
+ gdb_printf (
+ "Program, unless a warranty or assumption of liability accompanies a\n");
gdb_printf ("copy of the Program in return for a fee.\n");
gdb_printf ("\n");
}
void _initialize_copying ();
+
void
_initialize_copying ()
{
add_cmd ("copying", no_set_class, show_copying_command,
- _("Conditions for redistributing copies of GDB."),
- &showlist);
+ _ ("Conditions for redistributing copies of GDB."), &showlist);
add_cmd ("warranty", no_set_class, show_warranty_command,
- _("Various kinds of warranty you do not have."),
- &showlist);
+ _ ("Various kinds of warranty you do not have."), &showlist);
/* For old-timers, allow "info copying", etc. */
add_info ("copying", show_copying_command,
- _("Conditions for redistributing copies of GDB."));
+ _ ("Conditions for redistributing copies of GDB."));
add_info ("warranty", show_warranty_command,
- _("Various kinds of warranty you do not have."));
+ _ ("Various kinds of warranty you do not have."));
}
diff --git a/gdb/corefile.c b/gdb/corefile.c
index 5cb559000b8..6ab46b3077c 100644
--- a/gdb/corefile.c
+++ b/gdb/corefile.c
@@ -45,12 +45,10 @@
typedef void (*hook_type) (const char *);
-hook_type deprecated_exec_file_display_hook; /* The original hook. */
-static hook_type *exec_file_extra_hooks; /* Array of additional
+hook_type deprecated_exec_file_display_hook; /* The original hook. */
+static hook_type *exec_file_extra_hooks; /* Array of additional
hooks. */
-static int exec_file_hook_count = 0; /* Size of array. */
-
-
+static int exec_file_hook_count = 0; /* Size of array. */
/* If there are two or more functions that wish to hook into
exec_file_command, this function will call all of the hook
@@ -91,9 +89,9 @@ specify_exec_file_hook (void (*hook) (const char *))
Yes, it's inefficient to grow it by one each time but since
this is hardly ever called it's not a big deal. */
exec_file_hook_count++;
- new_array = (hook_type *)
- xrealloc (exec_file_extra_hooks,
- exec_file_hook_count * sizeof (hook_type));
+ new_array
+ = (hook_type *) xrealloc (exec_file_extra_hooks,
+ exec_file_hook_count * sizeof (hook_type));
exec_file_extra_hooks = new_array;
exec_file_extra_hooks[exec_file_hook_count - 1] = hook;
}
@@ -115,8 +113,7 @@ reopen_exec_file (void)
std::string filename = bfd_get_filename (current_program_space->exec_bfd ());
res = stat (filename.c_str (), &st);
- if (res == 0
- && current_program_space->ebfd_mtime
+ if (res == 0 && current_program_space->ebfd_mtime
&& current_program_space->ebfd_mtime != st.st_mtime)
exec_file_attach (filename.c_str (), 0);
else
@@ -125,7 +122,7 @@ reopen_exec_file (void)
exits. */
bfd_cache_close_all ();
}
-
+
/* If we have both a core file and an exec file,
print a warning if they don't go together. */
@@ -136,10 +133,10 @@ validate_files (void)
{
if (!core_file_matches_executable_p (core_bfd,
current_program_space->exec_bfd ()))
- warning (_("core file may not match specified executable file."));
+ warning (_ ("core file may not match specified executable file."));
else if (bfd_get_mtime (current_program_space->exec_bfd ())
> bfd_get_mtime (core_bfd))
- warning (_("exec file is newer than core file."));
+ warning (_ ("exec file is newer than core file."));
}
}
@@ -153,29 +150,27 @@ get_exec_file (int err)
if (!err)
return NULL;
- error (_("No executable file specified.\n\
+ error (_ ("No executable file specified.\n\
Use the \"file\" or \"exec-file\" command."));
}
-
std::string
-memory_error_message (enum target_xfer_status err,
- struct gdbarch *gdbarch, CORE_ADDR memaddr)
+memory_error_message (enum target_xfer_status err, struct gdbarch *gdbarch,
+ CORE_ADDR memaddr)
{
switch (err)
{
case TARGET_XFER_E_IO:
/* Actually, address between memaddr and memaddr + len was out of
bounds. */
- return string_printf (_("Cannot access memory at address %s"),
+ return string_printf (_ ("Cannot access memory at address %s"),
paddress (gdbarch, memaddr));
case TARGET_XFER_UNAVAILABLE:
- return string_printf (_("Memory at address %s unavailable."),
+ return string_printf (_ ("Memory at address %s unavailable."),
paddress (gdbarch, memaddr));
default:
internal_error ("unhandled target_xfer_status: %s (%s)",
- target_xfer_status_to_string (err),
- plongest (err));
+ target_xfer_status_to_string (err), plongest (err));
}
}
@@ -217,10 +212,10 @@ read_memory_object (enum target_object object, CORE_ADDR memaddr,
enum target_xfer_status status;
ULONGEST xfered_len;
- status = target_xfer_partial (current_inferior ()->top_target (), object,
- NULL, myaddr + xfered, NULL,
- memaddr + xfered, len - xfered,
- &xfered_len);
+ status
+ = target_xfer_partial (current_inferior ()->top_target (), object,
+ NULL, myaddr + xfered, NULL, memaddr + xfered,
+ len - xfered, &xfered_len);
if (status != TARGET_XFER_OK)
memory_error (status == TARGET_XFER_EOF ? TARGET_XFER_E_IO : status,
@@ -260,9 +255,8 @@ read_code (CORE_ADDR memaddr, gdb_byte *myaddr, ssize_t len)
if successful. */
int
-safe_read_memory_integer (CORE_ADDR memaddr, int len,
- enum bfd_endian byte_order,
- LONGEST *return_value)
+safe_read_memory_integer (CORE_ADDR memaddr, int len,
+ enum bfd_endian byte_order, LONGEST *return_value)
{
gdb_byte buf[sizeof (LONGEST)];
@@ -292,8 +286,7 @@ safe_read_memory_unsigned_integer (CORE_ADDR memaddr, int len,
}
LONGEST
-read_memory_integer (CORE_ADDR memaddr, int len,
- enum bfd_endian byte_order)
+read_memory_integer (CORE_ADDR memaddr, int len, enum bfd_endian byte_order)
{
gdb_byte buf[sizeof (LONGEST)];
@@ -312,8 +305,7 @@ read_memory_unsigned_integer (CORE_ADDR memaddr, int len,
}
LONGEST
-read_code_integer (CORE_ADDR memaddr, int len,
- enum bfd_endian byte_order)
+read_code_integer (CORE_ADDR memaddr, int len, enum bfd_endian byte_order)
{
gdb_byte buf[sizeof (LONGEST)];
@@ -343,8 +335,7 @@ read_memory_typed_address (CORE_ADDR addr, struct type *type)
/* See gdbcore.h. */
void
-write_memory (CORE_ADDR memaddr,
- const bfd_byte *myaddr, ssize_t len)
+write_memory (CORE_ADDR memaddr, const bfd_byte *myaddr, ssize_t len)
{
int status;
@@ -360,15 +351,15 @@ write_memory_with_notification (CORE_ADDR memaddr, const bfd_byte *myaddr,
ssize_t len)
{
write_memory (memaddr, myaddr, len);
- gdb::observers::memory_changed.notify (current_inferior (), memaddr, len, myaddr);
+ gdb::observers::memory_changed.notify (current_inferior (), memaddr, len,
+ myaddr);
}
/* Store VALUE at ADDR in the inferior as a LEN-byte unsigned
integer. */
void
-write_memory_unsigned_integer (CORE_ADDR addr, int len,
- enum bfd_endian byte_order,
- ULONGEST value)
+write_memory_unsigned_integer (CORE_ADDR addr, int len,
+ enum bfd_endian byte_order, ULONGEST value)
{
gdb_byte *buf = (gdb_byte *) alloca (len);
@@ -379,29 +370,27 @@ write_memory_unsigned_integer (CORE_ADDR addr, int len,
/* Store VALUE at ADDR in the inferior as a LEN-byte signed
integer. */
void
-write_memory_signed_integer (CORE_ADDR addr, int len,
- enum bfd_endian byte_order,
- LONGEST value)
+write_memory_signed_integer (CORE_ADDR addr, int len,
+ enum bfd_endian byte_order, LONGEST value)
{
gdb_byte *buf = (gdb_byte *) alloca (len);
store_signed_integer (buf, len, byte_order, value);
write_memory (addr, buf, len);
}
-
+
/* The current default bfd target. Points to storage allocated for
gnutarget_string. */
const char *gnutarget;
/* Same thing, except it is "auto" not NULL for the default case. */
static std::string gnutarget_string;
+
static void
show_gnutarget_string (struct ui_file *file, int from_tty,
- struct cmd_list_element *c,
- const char *value)
+ struct cmd_list_element *c, const char *value)
{
- gdb_printf (file,
- _("The current BFD target is \"%s\".\n"), value);
+ gdb_printf (file, _ ("The current BFD target is \"%s\".\n"), value);
}
static void
@@ -423,8 +412,8 @@ set_gnutarget_command (const char *ignore, int from_tty,
static void
complete_set_gnutarget (struct cmd_list_element *cmd,
- completion_tracker &tracker,
- const char *text, const char *word)
+ completion_tracker &tracker, const char *text,
+ const char *word)
{
static const char **bfd_targets;
@@ -453,27 +442,27 @@ set_gnutarget (const char *newtarget)
}
void _initialize_core ();
+
void
_initialize_core ()
{
cmd_list_element *core_file_cmd
- = add_cmd ("core-file", class_files, core_file_command, _("\
+ = add_cmd ("core-file", class_files, core_file_command, _ ("\
Use FILE as core dump for examining memory and registers.\n\
Usage: core-file FILE\n\
No arg means have no core file. This command has been superseded by the\n\
-`target core' and `detach' commands."), &cmdlist);
+`target core' and `detach' commands."),
+ &cmdlist);
set_cmd_completer (core_file_cmd, filename_completer);
-
- set_show_commands set_show_gnutarget
- = add_setshow_string_noescape_cmd ("gnutarget", class_files,
- &gnutarget_string, _("\
-Set the current BFD target."), _("\
-Show the current BFD target."), _("\
+ set_show_commands set_show_gnutarget = add_setshow_string_noescape_cmd (
+ "gnutarget", class_files, &gnutarget_string, _ ("\
+Set the current BFD target."),
+ _ ("\
+Show the current BFD target."),
+ _ ("\
Use `set gnutarget auto' to specify automatic detection."),
- set_gnutarget_command,
- show_gnutarget_string,
- &setlist, &showlist);
+ set_gnutarget_command, show_gnutarget_string, &setlist, &showlist);
set_cmd_completer (set_show_gnutarget.set, complete_set_gnutarget);
add_alias_cmd ("g", set_show_gnutarget.set, class_files, 1, &setlist);
diff --git a/gdb/corelow.c b/gdb/corelow.c
index db489b4280e..2681389f1cd 100644
--- a/gdb/corelow.c
+++ b/gdb/corelow.c
@@ -21,7 +21,7 @@
#include "arch-utils.h"
#include <signal.h>
#include <fcntl.h>
-#include "frame.h" /* required by inferior.h */
+#include "frame.h" /* required by inferior.h */
#include "inferior.h"
#include "infrun.h"
#include "symtab.h"
@@ -60,28 +60,24 @@
/* The core file target. */
-static const target_info core_target_info = {
- "core",
- N_("Local core dump file"),
- N_("Use a core file as a target.\n\
-Specify the filename of the core file.")
-};
+static const target_info core_target_info
+ = { "core", N_ ("Local core dump file"), N_ ("Use a core file as a target.\n\
+Specify the filename of the core file.") };
class core_target final : public process_stratum_target
{
public:
+
core_target ();
- const target_info &info () const override
- { return core_target_info; }
+ const target_info &info () const override { return core_target_info; }
void close () override;
void detach (inferior *, int) override;
void fetch_registers (struct regcache *, int) override;
enum target_xfer_status xfer_partial (enum target_object object,
- const char *annex,
- gdb_byte *readbuf,
+ const char *annex, gdb_byte *readbuf,
const gdb_byte *writebuf,
ULONGEST offset, ULONGEST len,
ULONGEST *xfered_len) override;
@@ -95,9 +91,11 @@ public:
const char *thread_name (struct thread_info *) override;
bool has_all_memory () override { return true; }
+
bool has_memory () override;
bool has_stack () override;
bool has_registers () override;
+
bool has_execution (inferior *inf) override { return false; }
bool info_proc (const char *, enum info_proc_what) override;
@@ -106,24 +104,19 @@ public:
/* Core file implementation of fetch_memtags. Fetch the memory tags from
core file notes. */
- bool fetch_memtags (CORE_ADDR address, size_t len,
- gdb::byte_vector &tags, int type) override;
+ bool fetch_memtags (CORE_ADDR address, size_t len, gdb::byte_vector &tags,
+ int type) override;
/* A few helpers. */
/* Getter, see variable definition. */
- struct gdbarch *core_gdbarch ()
- {
- return m_core_gdbarch;
- }
+ struct gdbarch *core_gdbarch () { return m_core_gdbarch; }
/* See definition. */
void get_core_register_section (struct regcache *regcache,
const struct regset *regset,
- const char *name,
- int section_min_size,
- const char *human_name,
- bool required);
+ const char *name, int section_min_size,
+ const char *human_name, bool required);
/* See definition. */
void info_proc_mappings (struct gdbarch *gdbarch);
@@ -185,7 +178,7 @@ core_target::core_target ()
if (!m_core_gdbarch
|| !gdbarch_iterate_over_regset_sections_p (m_core_gdbarch))
- error (_("\"%s\": Core file format not supported"),
+ error (_ ("\"%s\": Core file format not supported"),
bfd_get_filename (core_bfd));
/* Find the data section */
@@ -216,55 +209,52 @@ core_target::build_file_mappings ()
/* See linux_read_core_file_mappings() in linux-tdep.c for an example
read_core_file_mappings method. */
- gdbarch_read_core_file_mappings (m_core_gdbarch, core_bfd,
+ gdbarch_read_core_file_mappings (
+ m_core_gdbarch, core_bfd,
/* After determining the number of mappings, read_core_file_mappings
will invoke this lambda. */
- [&] (ULONGEST)
- {
- },
+ [&] (ULONGEST) {},
/* read_core_file_mappings will invoke this lambda for each mapping
that it finds. */
[&] (int num, ULONGEST start, ULONGEST end, ULONGEST file_ofs,
- const char *filename, const bfd_build_id *build_id)
- {
- /* Architecture-specific read_core_mapping methods are expected to
+ const char *filename, const bfd_build_id *build_id) {
+ /* Architecture-specific read_core_mapping methods are expected to
weed out non-file-backed mappings. */
- gdb_assert (filename != nullptr);
+ gdb_assert (filename != nullptr);
- struct bfd *bfd = bfd_map[filename];
- if (bfd == nullptr)
- {
- /* Use exec_file_find() to do sysroot expansion. It'll
+ struct bfd *bfd = bfd_map[filename];
+ if (bfd == nullptr)
+ {
+ /* Use exec_file_find() to do sysroot expansion. It'll
also strip the potential sysroot "target:" prefix. If
there is no sysroot, an equivalent (possibly more
canonical) pathname will be provided. */
- gdb::unique_xmalloc_ptr<char> expanded_fname
- = exec_file_find (filename, NULL);
-
- if (expanded_fname == nullptr && build_id != nullptr)
- debuginfod_exec_query (build_id->data, build_id->size,
- filename, &expanded_fname);
-
- if (expanded_fname == nullptr)
- {
- m_core_unavailable_mappings.emplace_back (start, end - start);
- /* Print just one warning per path. */
- if (unavailable_paths.insert (filename).second)
- warning (_("Can't open file %s during file-backed mapping "
- "note processing"),
- filename);
- return;
- }
-
- bfd = bfd_map[filename] = bfd_openr (expanded_fname.get (),
- "binary");
-
- if (bfd == nullptr || !bfd_check_format (bfd, bfd_object))
- {
- m_core_unavailable_mappings.emplace_back (start, end - start);
- /* If we get here, there's a good chance that it's due to
+ gdb::unique_xmalloc_ptr<char> expanded_fname
+ = exec_file_find (filename, NULL);
+
+ if (expanded_fname == nullptr && build_id != nullptr)
+ debuginfod_exec_query (build_id->data, build_id->size, filename,
+ &expanded_fname);
+
+ if (expanded_fname == nullptr)
+ {
+ m_core_unavailable_mappings.emplace_back (start, end - start);
+ /* Print just one warning per path. */
+ if (unavailable_paths.insert (filename).second)
+ warning (_ ("Can't open file %s during file-backed mapping "
+ "note processing"),
+ filename);
+ return;
+ }
+
+ bfd = bfd_map[filename] = bfd_openr (expanded_fname.get (), "binary");
+
+ if (bfd == nullptr || !bfd_check_format (bfd, bfd_object))
+ {
+ m_core_unavailable_mappings.emplace_back (start, end - start);
+ /* If we get here, there's a good chance that it's due to
an internal error. We issue a warning instead of an
internal error because of the possibility that the
file was removed in between checking for its
@@ -273,45 +263,45 @@ core_target::build_file_mappings ()
Output both the path from the core file note along
with its expansion to make debugging this problem
easier. */
- warning (_("Can't open file %s which was expanded to %s "
- "during file-backed mapping note processing"),
- filename, expanded_fname.get ());
- if (bfd != nullptr)
- bfd_close (bfd);
- return;
- }
- /* Ensure that the bfd will be closed when core_bfd is closed.
+ warning (_ ("Can't open file %s which was expanded to %s "
+ "during file-backed mapping note processing"),
+ filename, expanded_fname.get ());
+ if (bfd != nullptr)
+ bfd_close (bfd);
+ return;
+ }
+ /* Ensure that the bfd will be closed when core_bfd is closed.
This can be checked before/after a core file detach via
"maint info bfds". */
- gdb_bfd_record_inclusion (core_bfd, bfd);
- }
+ gdb_bfd_record_inclusion (core_bfd, bfd);
+ }
- /* Make new BFD section. All sections have the same name,
+ /* Make new BFD section. All sections have the same name,
which is permitted by bfd_make_section_anyway(). */
- asection *sec = bfd_make_section_anyway (bfd, "load");
- if (sec == nullptr)
- error (_("Can't make section"));
- sec->filepos = file_ofs;
- bfd_set_section_flags (sec, SEC_READONLY | SEC_HAS_CONTENTS);
- bfd_set_section_size (sec, end - start);
- bfd_set_section_vma (sec, start);
- bfd_set_section_lma (sec, start);
- bfd_set_section_alignment (sec, 2);
-
- /* Set target_section fields. */
- m_core_file_mappings.emplace_back (start, end, sec);
-
- /* If this is a bfd of a shared library, record its soname
+ asection *sec = bfd_make_section_anyway (bfd, "load");
+ if (sec == nullptr)
+ error (_ ("Can't make section"));
+ sec->filepos = file_ofs;
+ bfd_set_section_flags (sec, SEC_READONLY | SEC_HAS_CONTENTS);
+ bfd_set_section_size (sec, end - start);
+ bfd_set_section_vma (sec, start);
+ bfd_set_section_lma (sec, start);
+ bfd_set_section_alignment (sec, 2);
+
+ /* Set target_section fields. */
+ m_core_file_mappings.emplace_back (start, end, sec);
+
+ /* If this is a bfd of a shared library, record its soname
and build id. */
- if (build_id != nullptr)
- {
- gdb::unique_xmalloc_ptr<char> soname
- = gdb_bfd_read_elf_soname (bfd->filename);
- if (soname != nullptr)
- set_cbfd_soname_build_id (current_program_space->cbfd,
- soname.get (), build_id);
- }
- });
+ if (build_id != nullptr)
+ {
+ gdb::unique_xmalloc_ptr<char> soname
+ = gdb_bfd_read_elf_soname (bfd->filename);
+ if (soname != nullptr)
+ set_cbfd_soname_build_id (current_program_space->cbfd, soname.get (),
+ build_id);
+ }
+ });
normalize_mem_ranges (&m_core_unavailable_mappings);
}
@@ -324,7 +314,7 @@ core_target::clear_core ()
{
if (core_bfd)
{
- switch_to_no_thread (); /* Avoid confusion from thread
+ switch_to_no_thread (); /* Avoid confusion from thread
stuff. */
exit_inferior_silent (current_inferior ());
@@ -384,11 +374,11 @@ add_to_thread_list (asection *asect, asection *reg_sect)
thread_info *thr = add_thread (inf->process_target (), ptid);
-/* Warning, Will Robinson, looking at BFD private data! */
+ /* Warning, Will Robinson, looking at BFD private data! */
if (reg_sect != NULL
- && asect->filepos == reg_sect->filepos) /* Did we find .reg? */
- switch_to_thread (thr); /* Yes, make it current. */
+ && asect->filepos == reg_sect->filepos) /* Did we find .reg? */
+ switch_to_thread (thr); /* Yes, make it current. */
}
/* Issue a message saying we have no core to debug, if FROM_TTY. */
@@ -397,7 +387,7 @@ static void
maybe_say_no_core_file_now (int from_tty)
{
if (from_tty)
- gdb_printf (_("No core file now.\n"));
+ gdb_printf (_ ("No core file now.\n"));
}
/* Backward compatibility with old way of specifying core files. */
@@ -405,7 +395,7 @@ maybe_say_no_core_file_now (int from_tty)
void
core_file_command (const char *filename, int from_tty)
{
- dont_repeat (); /* Either way, seems bogus. */
+ dont_repeat (); /* Either way, seems bogus. */
if (filename == NULL)
{
@@ -446,7 +436,7 @@ locate_exec_from_corefile_build_id (bfd *abfd, int from_tty)
execbfd = gdb_bfd_open (execpath.get (), gnutarget);
if (execbfd == nullptr)
- warning (_("\"%s\" from debuginfod cannot be opened as bfd: %s"),
+ warning (_ ("\"%s\" from debuginfod cannot be opened as bfd: %s"),
execpath.get (),
gdb_bfd_errmsg (bfd_get_error (), nullptr).c_str ());
else if (!build_id_verify (execbfd.get (), build_id->size,
@@ -477,15 +467,14 @@ core_target_open (const char *arg, int from_tty)
if (!arg)
{
if (core_bfd)
- error (_("No core file specified. (Use `detach' "
- "to stop debugging a core file.)"));
+ error (_ ("No core file specified. (Use `detach' "
+ "to stop debugging a core file.)"));
else
- error (_("No core file specified."));
+ error (_ ("No core file specified."));
}
gdb::unique_xmalloc_ptr<char> filename (tilde_expand (arg));
- if (strlen (filename.get ()) != 0
- && !IS_ABSOLUTE_PATH (filename.get ()))
+ if (strlen (filename.get ()) != 0 && !IS_ABSOLUTE_PATH (filename.get ()))
filename = make_unique_xstrdup (gdb_abspath (filename.get ()).c_str ());
flags = O_BINARY | O_LARGEFILE;
@@ -509,8 +498,8 @@ core_target_open (const char *arg, int from_tty)
/* FIXME: should be checking for errors from bfd_close (for one
thing, on error it does not free all the storage associated
with the bfd). */
- error (_("\"%s\" is not a core dump: %s"),
- filename.get (), bfd_errmsg (bfd_get_error ()));
+ error (_ ("\"%s\" is not a core dump: %s"), filename.get (),
+ bfd_errmsg (bfd_get_error ()));
}
current_program_space->cbfd = std::move (temp_bfd);
@@ -588,7 +577,7 @@ core_target_open (const char *arg, int from_tty)
p = bfd_core_file_failing_command (core_bfd);
if (p)
- gdb_printf (_("Core was generated by `%s'.\n"), p);
+ gdb_printf (_ ("Core was generated by `%s'.\n"), p);
/* Clearing any previous state of convenience variables. */
clear_exit_convenience_vars ();
@@ -604,22 +593,21 @@ core_target_open (const char *arg, int from_tty)
implementation for that gdbarch, as a fallback measure,
assume the host signal mapping. It'll be correct for native
cores, but most likely incorrect for cross-cores. */
- enum gdb_signal sig = (core_gdbarch != NULL
- && gdbarch_gdb_signal_from_target_p (core_gdbarch)
- ? gdbarch_gdb_signal_from_target (core_gdbarch,
- siggy)
- : gdb_signal_from_host (siggy));
+ enum gdb_signal sig
+ = (core_gdbarch != NULL
+ && gdbarch_gdb_signal_from_target_p (core_gdbarch)
+ ? gdbarch_gdb_signal_from_target (core_gdbarch, siggy)
+ : gdb_signal_from_host (siggy));
- gdb_printf (_("Program terminated with signal %s, %s"),
+ gdb_printf (_ ("Program terminated with signal %s, %s"),
gdb_signal_to_name (sig), gdb_signal_to_string (sig));
if (gdbarch_report_signal_info_p (core_gdbarch))
gdbarch_report_signal_info (core_gdbarch, current_uiout, sig);
- gdb_printf (_(".\n"));
+ gdb_printf (_ (".\n"));
/* Set the value of the internal variable $_exitsignal,
which holds the signal uncaught by the inferior. */
- set_internalvar_integer (lookup_internalvar ("_exitsignal"),
- siggy);
+ set_internalvar_integer (lookup_internalvar ("_exitsignal"), siggy);
}
/* Fetch all registers from core file. */
@@ -683,10 +671,8 @@ core_target::detach (inferior *inf, int from_tty)
void
core_target::get_core_register_section (struct regcache *regcache,
const struct regset *regset,
- const char *name,
- int section_min_size,
- const char *human_name,
- bool required)
+ const char *name, int section_min_size,
+ const char *human_name, bool required)
{
gdb_assert (regset != nullptr);
@@ -697,24 +683,23 @@ core_target::get_core_register_section (struct regcache *regcache,
thread_section_name section_name (name, regcache->ptid ());
section = bfd_get_section_by_name (core_bfd, section_name.c_str ());
- if (! section)
+ if (!section)
{
if (required)
- warning (_("Couldn't find %s registers in core file."),
- human_name);
+ warning (_ ("Couldn't find %s registers in core file."), human_name);
return;
}
size = bfd_section_size (section);
if (size < section_min_size)
{
- warning (_("Section `%s' in core file too small."),
+ warning (_ ("Section `%s' in core file too small."),
section_name.c_str ());
return;
}
if (size != section_min_size && !variable_size_section)
{
- warning (_("Unexpected size of section `%s' in core file."),
+ warning (_ ("Unexpected size of section `%s' in core file."),
section_name.c_str ());
}
@@ -722,8 +707,9 @@ core_target::get_core_register_section (struct regcache *regcache,
if (!bfd_get_section_contents (core_bfd, section, contents.data (),
(file_ptr) 0, size))
{
- warning (_("Couldn't read %s registers from `%s' section in core file."),
- human_name, section_name.c_str ());
+ warning (
+ _ ("Couldn't read %s registers from `%s' section in core file."),
+ human_name, section_name.c_str ());
return;
}
@@ -741,8 +727,8 @@ struct get_core_registers_cb_data
register note section. */
static void
-get_core_registers_cb (const char *sect_name, int supply_size, int collect_size,
- const struct regset *regset,
+get_core_registers_cb (const char *sect_name, int supply_size,
+ int collect_size, const struct regset *regset,
const char *human_name, void *cb_data)
{
gdb_assert (regset != nullptr);
@@ -790,8 +776,7 @@ core_target::fetch_registers (struct regcache *regcache, int regno)
struct gdbarch *gdbarch = regcache->arch ();
get_core_registers_cb_data data = { this, regcache };
- gdbarch_iterate_over_regset_sections (gdbarch,
- get_core_registers_cb,
+ gdbarch_iterate_over_regset_sections (gdbarch, get_core_registers_cb,
(void *) &data, NULL);
/* Mark all registers not found in the core as unavailable. */
@@ -805,7 +790,7 @@ core_target::files_info ()
{
print_section_info (&m_core_section_table, core_bfd);
}
-
+
/* Helper method for core_target::xfer_partial. */
enum target_xfer_status
@@ -816,10 +801,9 @@ core_target::xfer_memory_via_mappings (gdb_byte *readbuf,
{
enum target_xfer_status xfer_status;
- xfer_status = (section_table_xfer_memory_partial
- (readbuf, writebuf,
- offset, len, xfered_len,
- m_core_file_mappings));
+ xfer_status
+ = (section_table_xfer_memory_partial (readbuf, writebuf, offset, len,
+ xfered_len, m_core_file_mappings));
if (xfer_status == TARGET_XFER_OK || m_core_unavailable_mappings.empty ())
return xfer_status;
@@ -842,13 +826,10 @@ core_target::xfer_memory_via_mappings (gdb_byte *readbuf,
if (!address_in_mem_range (memend, &mr))
len = mr.start + mr.length - memaddr;
- xfer_status = this->beneath ()->xfer_partial (TARGET_OBJECT_MEMORY,
- NULL,
- readbuf,
- writebuf,
- offset,
- len,
- xfered_len);
+ xfer_status
+ = this->beneath ()->xfer_partial (TARGET_OBJECT_MEMORY, NULL,
+ readbuf, writebuf, offset, len,
+ xfered_len);
break;
}
}
@@ -870,15 +851,14 @@ core_target::xfer_partial (enum target_object object, const char *annex,
/* Try accessing memory contents from core file data,
restricting consideration to those sections for which
the BFD section flag SEC_HAS_CONTENTS is set. */
- auto has_contents_cb = [] (const struct target_section *s)
- {
- return ((s->the_bfd_section->flags & SEC_HAS_CONTENTS) != 0);
- };
- xfer_status = section_table_xfer_memory_partial
- (readbuf, writebuf,
- offset, len, xfered_len,
- m_core_section_table,
- has_contents_cb);
+ auto has_contents_cb = [] (const struct target_section *s) {
+ return ((s->the_bfd_section->flags & SEC_HAS_CONTENTS) != 0);
+ };
+ xfer_status
+ = section_table_xfer_memory_partial (readbuf, writebuf, offset, len,
+ xfered_len,
+ m_core_section_table,
+ has_contents_cb);
if (xfer_status == TARGET_XFER_OK)
return TARGET_XFER_OK;
@@ -897,23 +877,22 @@ core_target::xfer_partial (enum target_object object, const char *annex,
len, xfered_len);
}
else
- xfer_status = this->beneath ()->xfer_partial (object, annex, readbuf,
- writebuf, offset, len,
- xfered_len);
+ xfer_status
+ = this->beneath ()->xfer_partial (object, annex, readbuf, writebuf,
+ offset, len, xfered_len);
if (xfer_status == TARGET_XFER_OK)
return TARGET_XFER_OK;
/* Finally, attempt to access data in core file sections with
no contents. These will typically read as all zero. */
- auto no_contents_cb = [&] (const struct target_section *s)
- {
- return !has_contents_cb (s);
- };
- xfer_status = section_table_xfer_memory_partial
- (readbuf, writebuf,
- offset, len, xfered_len,
- m_core_section_table,
- no_contents_cb);
+ auto no_contents_cb = [&] (const struct target_section *s) {
+ return !has_contents_cb (s);
+ };
+ xfer_status
+ = section_table_xfer_memory_partial (readbuf, writebuf, offset, len,
+ xfered_len,
+ m_core_section_table,
+ no_contents_cb);
return xfer_status;
}
@@ -942,7 +921,7 @@ core_target::xfer_partial (enum target_object object, const char *annex,
if (!bfd_get_section_contents (core_bfd, section, readbuf,
(file_ptr) offset, size))
{
- warning (_("Couldn't read NT_AUXV note in core file."));
+ warning (_ ("Couldn't read NT_AUXV note in core file."));
return TARGET_XFER_E_IO;
}
@@ -977,13 +956,12 @@ core_target::xfer_partial (enum target_object object, const char *annex,
if (!bfd_get_section_contents (core_bfd, section, readbuf,
(file_ptr) offset, size))
{
- warning (_("Couldn't read StackGhost cookie in core file."));
+ warning (_ ("Couldn't read StackGhost cookie in core file."));
return TARGET_XFER_E_IO;
}
*xfered_len = (ULONGEST) size;
return TARGET_XFER_OK;
-
}
return TARGET_XFER_E_IO;
@@ -995,9 +973,9 @@ core_target::xfer_partial (enum target_object object, const char *annex,
return TARGET_XFER_E_IO;
else
{
- *xfered_len = gdbarch_core_xfer_shared_libraries (m_core_gdbarch,
- readbuf,
- offset, len);
+ *xfered_len
+ = gdbarch_core_xfer_shared_libraries (m_core_gdbarch, readbuf,
+ offset, len);
if (*xfered_len == 0)
return TARGET_XFER_EOF;
@@ -1034,8 +1012,8 @@ core_target::xfer_partial (enum target_object object, const char *annex,
if (m_core_gdbarch != nullptr
&& gdbarch_core_xfer_siginfo_p (m_core_gdbarch))
{
- LONGEST l = gdbarch_core_xfer_siginfo (m_core_gdbarch, readbuf,
- offset, len);
+ LONGEST l = gdbarch_core_xfer_siginfo (m_core_gdbarch, readbuf,
+ offset, len);
if (l >= 0)
{
@@ -1050,14 +1028,11 @@ core_target::xfer_partial (enum target_object object, const char *annex,
return TARGET_XFER_E_IO;
default:
- return this->beneath ()->xfer_partial (object, annex, readbuf,
- writebuf, offset, len,
- xfered_len);
+ return this->beneath ()->xfer_partial (object, annex, readbuf, writebuf,
+ offset, len, xfered_len);
}
}
-
-
/* Okay, let's be honest: threads gleaned from a core file aren't
exactly lively, are they? On the other hand, if we don't claim
that each & every one is alive, then we don't get any of them
@@ -1121,8 +1096,7 @@ core_target::pid_to_str (ptid_t ptid)
/* The preferred way is to have a gdbarch/OS specific
implementation. */
- if (m_core_gdbarch != nullptr
- && gdbarch_core_pid_to_str_p (m_core_gdbarch))
+ if (m_core_gdbarch != nullptr && gdbarch_core_pid_to_str_p (m_core_gdbarch))
return gdbarch_core_pid_to_str (m_core_gdbarch, ptid);
/* Otherwise, if we don't have one, we'll just fallback to
@@ -1146,8 +1120,7 @@ core_target::pid_to_str (ptid_t ptid)
const char *
core_target::thread_name (struct thread_info *thr)
{
- if (m_core_gdbarch != nullptr
- && gdbarch_core_thread_name_p (m_core_gdbarch))
+ if (m_core_gdbarch != nullptr && gdbarch_core_thread_name_p (m_core_gdbarch))
return gdbarch_core_thread_name (m_core_gdbarch, thr);
return NULL;
}
@@ -1206,35 +1179,36 @@ core_target::fetch_memtags (CORE_ADDR address, size_t len,
/* Make sure we have a way to decode the memory tag notes. */
if (!gdbarch_decode_memtag_section_p (gdbarch))
- error (_("gdbarch_decode_memtag_section not implemented for this "
- "architecture."));
+ error (_ ("gdbarch_decode_memtag_section not implemented for this "
+ "architecture."));
memtag_section_info info;
info.memtag_section = nullptr;
- while (get_next_core_memtag_section (core_bfd, info.memtag_section,
- address, info))
- {
- size_t adjusted_length
- = (address + len < info.end_address) ? len : (info.end_address - address);
+ while (get_next_core_memtag_section (core_bfd, info.memtag_section, address,
+ info))
+ {
+ size_t adjusted_length = (address + len < info.end_address)
+ ? len
+ : (info.end_address - address);
- /* Decode the memory tag note and return the tags. */
- gdb::byte_vector tags_read
- = gdbarch_decode_memtag_section (gdbarch, info.memtag_section, type,
- address, adjusted_length);
+ /* Decode the memory tag note and return the tags. */
+ gdb::byte_vector tags_read
+ = gdbarch_decode_memtag_section (gdbarch, info.memtag_section, type,
+ address, adjusted_length);
- /* Transfer over the tags that have been read. */
- tags.insert (tags.end (), tags_read.begin (), tags_read.end ());
+ /* Transfer over the tags that have been read. */
+ tags.insert (tags.end (), tags_read.begin (), tags_read.end ());
- /* ADDRESS + LEN may cross the boundaries of a particular memory tag
+ /* ADDRESS + LEN may cross the boundaries of a particular memory tag
segment. Check if we need to fetch tags from a different section. */
- if (!tags_read.empty () && (address + len) < info.end_address)
- return true;
+ if (!tags_read.empty () && (address + len) < info.end_address)
+ return true;
- /* There are more tags to fetch. Update ADDRESS and LEN. */
- len -= (info.end_address - address);
- address = info.end_address;
- }
+ /* There are more tags to fetch. Update ADDRESS and LEN. */
+ len -= (info.end_address - address);
+ address = info.end_address;
+ }
return false;
}
@@ -1256,19 +1230,15 @@ core_target::info_proc_mappings (struct gdbarch *gdbarch)
{
if (!m_core_file_mappings.empty ())
{
- gdb_printf (_("Mapped address spaces:\n\n"));
+ gdb_printf (_ ("Mapped address spaces:\n\n"));
if (gdbarch_addr_bit (gdbarch) == 32)
{
- gdb_printf ("\t%10s %10s %10s %10s %s\n",
- "Start Addr",
- " End Addr",
+ gdb_printf ("\t%10s %10s %10s %10s %s\n", "Start Addr", " End Addr",
" Size", " Offset", "objfile");
}
else
{
- gdb_printf (" %18s %18s %10s %10s %s\n",
- "Start Addr",
- " End Addr",
+ gdb_printf (" %18s %18s %10s %10s %s\n", "Start Addr", " End Addr",
" Size", " Offset", "objfile");
}
}
@@ -1281,19 +1251,13 @@ core_target::info_proc_mappings (struct gdbarch *gdbarch)
const char *filename = bfd_get_filename (tsp.the_bfd_section->owner);
if (gdbarch_addr_bit (gdbarch) == 32)
- gdb_printf ("\t%10s %10s %10s %10s %s\n",
- paddress (gdbarch, start),
- paddress (gdbarch, end),
- hex_string (end - start),
- hex_string (file_ofs),
- filename);
+ gdb_printf ("\t%10s %10s %10s %10s %s\n", paddress (gdbarch, start),
+ paddress (gdbarch, end), hex_string (end - start),
+ hex_string (file_ofs), filename);
else
- gdb_printf (" %18s %18s %10s %10s %s\n",
- paddress (gdbarch, start),
- paddress (gdbarch, end),
- hex_string (end - start),
- hex_string (file_ofs),
- filename);
+ gdb_printf (" %18s %18s %10s %10s %s\n", paddress (gdbarch, start),
+ paddress (gdbarch, end), hex_string (end - start),
+ hex_string (file_ofs), filename);
}
}
@@ -1317,12 +1281,13 @@ maintenance_print_core_file_backed_mappings (const char *args, int from_tty)
}
void _initialize_corelow ();
+
void
_initialize_corelow ()
{
add_target (core_target_info, core_target_open, filename_completer);
add_cmd ("core-file-backed-mappings", class_maintenance,
maintenance_print_core_file_backed_mappings,
- _("Print core file's file-backed mappings."),
+ _ ("Print core file's file-backed mappings."),
&maintenanceprintlist);
}
diff --git a/gdb/cp-abi.c b/gdb/cp-abi.c
index 87a3b5c0a96..5437abaf075 100644
--- a/gdb/cp-abi.c
+++ b/gdb/cp-abi.c
@@ -37,7 +37,7 @@ enum ctor_kinds
is_constructor_name (const char *name)
{
if ((current_cp_abi.is_constructor_name) == NULL)
- error (_("ABI doesn't define required function is_constructor_name"));
+ error (_ ("ABI doesn't define required function is_constructor_name"));
return (*current_cp_abi.is_constructor_name) (name);
}
@@ -45,7 +45,7 @@ enum dtor_kinds
is_destructor_name (const char *name)
{
if ((current_cp_abi.is_destructor_name) == NULL)
- error (_("ABI doesn't define required function is_destructor_name"));
+ error (_ ("ABI doesn't define required function is_destructor_name"));
return (*current_cp_abi.is_destructor_name) (name);
}
@@ -53,7 +53,7 @@ int
is_vtable_name (const char *name)
{
if ((current_cp_abi.is_vtable_name) == NULL)
- error (_("ABI doesn't define required function is_vtable_name"));
+ error (_ ("ABI doesn't define required function is_vtable_name"));
return (*current_cp_abi.is_vtable_name) (name);
}
@@ -61,7 +61,7 @@ int
is_operator_name (const char *name)
{
if ((current_cp_abi.is_operator_name) == NULL)
- error (_("ABI doesn't define required function is_operator_name"));
+ error (_ ("ABI doesn't define required function is_operator_name"));
return (*current_cp_abi.is_operator_name) (name);
}
@@ -77,8 +77,7 @@ baseclass_offset (struct type *type, int index, const gdb_byte *valaddr,
try
{
res = (*current_cp_abi.baseclass_offset) (type, index, valaddr,
- embedded_offset,
- address, val);
+ embedded_offset, address, val);
}
catch (const gdb_exception_error &ex)
{
@@ -86,27 +85,24 @@ baseclass_offset (struct type *type, int index, const gdb_byte *valaddr,
throw;
throw_error (NOT_AVAILABLE_ERROR,
- _("Cannot determine virtual baseclass offset "
- "of incomplete object"));
+ _ ("Cannot determine virtual baseclass offset "
+ "of incomplete object"));
}
return res;
}
struct value *
-value_virtual_fn_field (struct value **arg1p,
- struct fn_field *f, int j,
+value_virtual_fn_field (struct value **arg1p, struct fn_field *f, int j,
struct type *type, int offset)
{
if ((current_cp_abi.virtual_fn_field) == NULL)
return NULL;
- return (*current_cp_abi.virtual_fn_field) (arg1p, f, j,
- type, offset);
+ return (*current_cp_abi.virtual_fn_field) (arg1p, f, j, type, offset);
}
struct type *
-value_rtti_type (struct value *v, int *full,
- LONGEST *top, int *using_enc)
+value_rtti_type (struct value *v, int *full, LONGEST *top, int *using_enc)
{
struct type *ret = NULL;
@@ -126,12 +122,11 @@ value_rtti_type (struct value *v, int *full,
}
void
-cplus_print_method_ptr (const gdb_byte *contents,
- struct type *type,
+cplus_print_method_ptr (const gdb_byte *contents, struct type *type,
struct ui_file *stream)
{
if (current_cp_abi.print_method_ptr == NULL)
- error (_("GDB does not support pointers to methods on this target"));
+ error (_ ("GDB does not support pointers to methods on this target"));
(*current_cp_abi.print_method_ptr) (contents, type, stream);
}
@@ -139,22 +134,21 @@ int
cplus_method_ptr_size (struct type *to_type)
{
if (current_cp_abi.method_ptr_size == NULL)
- error (_("GDB does not support pointers to methods on this target"));
+ error (_ ("GDB does not support pointers to methods on this target"));
return (*current_cp_abi.method_ptr_size) (to_type);
}
void
-cplus_make_method_ptr (struct type *type, gdb_byte *contents,
- CORE_ADDR value, int is_virtual)
+cplus_make_method_ptr (struct type *type, gdb_byte *contents, CORE_ADDR value,
+ int is_virtual)
{
if (current_cp_abi.make_method_ptr == NULL)
- error (_("GDB does not support pointers to methods on this target"));
+ error (_ ("GDB does not support pointers to methods on this target"));
(*current_cp_abi.make_method_ptr) (type, contents, value, is_virtual);
}
CORE_ADDR
-cplus_skip_trampoline (frame_info_ptr frame,
- CORE_ADDR stop_pc)
+cplus_skip_trampoline (frame_info_ptr frame, CORE_ADDR stop_pc)
{
if (current_cp_abi.skip_trampoline == NULL)
return 0;
@@ -162,11 +156,10 @@ cplus_skip_trampoline (frame_info_ptr frame,
}
struct value *
-cplus_method_ptr_to_value (struct value **this_p,
- struct value *method_ptr)
+cplus_method_ptr_to_value (struct value **this_p, struct value *method_ptr)
{
if (current_cp_abi.method_ptr_to_value == NULL)
- error (_("GDB does not support pointers to methods on this target"));
+ error (_ ("GDB does not support pointers to methods on this target"));
return (*current_cp_abi.method_ptr_to_value) (this_p, method_ptr);
}
@@ -176,7 +169,7 @@ void
cplus_print_vtable (struct value *value)
{
if (current_cp_abi.print_vtable == NULL)
- error (_("GDB cannot print the vtable on this target"));
+ error (_ ("GDB cannot print the vtable on this target"));
(*current_cp_abi.print_vtable) (value);
}
@@ -186,7 +179,7 @@ struct value *
cplus_typeid (struct value *value)
{
if (current_cp_abi.get_typeid == NULL)
- error (_("GDB cannot find the typeid on this target"));
+ error (_ ("GDB cannot find the typeid on this target"));
return (*current_cp_abi.get_typeid) (value);
}
@@ -196,7 +189,7 @@ struct type *
cplus_typeid_type (struct gdbarch *gdbarch)
{
if (current_cp_abi.get_typeid_type == NULL)
- error (_("GDB cannot find the type for 'typeid' on this target"));
+ error (_ ("GDB cannot find the type for 'typeid' on this target"));
return (*current_cp_abi.get_typeid_type) (gdbarch);
}
@@ -206,7 +199,8 @@ struct type *
cplus_type_from_type_info (struct value *value)
{
if (current_cp_abi.get_type_from_type_info == NULL)
- error (_("GDB cannot find the type from a std::type_info on this target"));
+ error (
+ _ ("GDB cannot find the type from a std::type_info on this target"));
return (*current_cp_abi.get_type_from_type_info) (value);
}
@@ -216,8 +210,8 @@ std::string
cplus_typename_from_type_info (struct value *value)
{
if (current_cp_abi.get_typename_from_type_info == NULL)
- error (_("GDB cannot find the type name "
- "from a std::type_info on this target"));
+ error (_ ("GDB cannot find the type name "
+ "from a std::type_info on this target"));
return (*current_cp_abi.get_typename_from_type_info) (value);
}
@@ -252,8 +246,8 @@ int
register_cp_abi (struct cp_abi_ops *abi)
{
if (num_cp_abis == CP_ABI_MAX)
- internal_error (_("Too many C++ ABIs, please increase "
- "CP_ABI_MAX in cp-abi.c"));
+ internal_error (_ ("Too many C++ ABIs, please increase "
+ "CP_ABI_MAX in cp-abi.c"));
cp_abis[num_cp_abis++] = abi;
@@ -268,8 +262,8 @@ set_cp_abi_as_auto_default (const char *short_name)
struct cp_abi_ops *abi = find_cp_abi (short_name);
if (abi == NULL)
- internal_error (_("Cannot find C++ ABI \"%s\" to set it as auto default."),
- short_name);
+ internal_error (
+ _ ("Cannot find C++ ABI \"%s\" to set it as auto default."), short_name);
xfree ((char *) auto_cp_abi.longname);
xfree ((char *) auto_cp_abi.doc);
@@ -277,10 +271,11 @@ set_cp_abi_as_auto_default (const char *short_name)
auto_cp_abi = *abi;
auto_cp_abi.shortname = "auto";
- auto_cp_abi.longname = xstrprintf ("currently \"%s\"",
- abi->shortname).release ();
- auto_cp_abi.doc = xstrprintf ("Automatically selected; currently \"%s\"",
- abi->shortname).release ();
+ auto_cp_abi.longname
+ = xstrprintf ("currently \"%s\"", abi->shortname).release ();
+ auto_cp_abi.doc
+ = xstrprintf ("Automatically selected; currently \"%s\"", abi->shortname)
+ .release ();
/* Since we copy the current ABI into current_cp_abi instead of
using a pointer, if auto is currently the default, we need to
@@ -345,14 +340,13 @@ set_cp_abi_cmd (const char *args, int from_tty)
}
if (!switch_to_cp_abi (args))
- error (_("Could not find \"%s\" in ABI list"), args);
+ error (_ ("Could not find \"%s\" in ABI list"), args);
}
/* A completion function for "set cp-abi". */
static void
-cp_abi_completer (struct cmd_list_element *ignore,
- completion_tracker &tracker,
+cp_abi_completer (struct cmd_list_element *ignore, completion_tracker &tracker,
const char *text, const char *word)
{
static const char **cp_abi_names;
@@ -386,6 +380,7 @@ show_cp_abi_cmd (const char *args, int from_tty)
}
void _initialize_cp_abi ();
+
void
_initialize_cp_abi ()
{
@@ -394,13 +389,12 @@ _initialize_cp_abi ()
register_cp_abi (&auto_cp_abi);
switch_to_cp_abi ("auto");
- c = add_cmd ("cp-abi", class_obscure, set_cp_abi_cmd, _("\
+ c = add_cmd ("cp-abi", class_obscure, set_cp_abi_cmd, _ ("\
Set the ABI used for inspecting C++ objects.\n\
\"set cp-abi\" with no arguments will list the available ABIs."),
&setlist);
set_cmd_completer (c, cp_abi_completer);
add_cmd ("cp-abi", class_obscure, show_cp_abi_cmd,
- _("Show the ABI used for inspecting C++ objects."),
- &showlist);
+ _ ("Show the ABI used for inspecting C++ objects."), &showlist);
}
diff --git a/gdb/cp-abi.h b/gdb/cp-abi.h
index 383746244a7..5682fd46cfa 100644
--- a/gdb/cp-abi.h
+++ b/gdb/cp-abi.h
@@ -34,10 +34,10 @@ class frame_info_ptr;
certainly be cleaner to carry this information explicitly in GDB's
data structures than to derive it from the mangled name. */
-
/* Kinds of constructors. All these values are guaranteed to be
non-zero. */
-enum ctor_kinds {
+enum ctor_kinds
+{
/* Initialize a complete object, including virtual bases, using
memory provided by caller. */
@@ -55,10 +55,10 @@ enum ctor_kinds {
of constructor it is. */
extern enum ctor_kinds is_constructor_name (const char *name);
-
/* Kinds of destructors. All these values are guaranteed to be
non-zero. */
-enum dtor_kinds {
+enum dtor_kinds
+{
/* A destructor which finalizes the entire object, and then calls
`delete' on its storage. */
@@ -72,22 +72,19 @@ enum dtor_kinds {
object. */
base_object_dtor
};
-
+
/* Return non-zero iff NAME is the mangled name of a destructor.
Actually, return an `enum dtor_kind' value describing what *kind*
of destructor it is. */
extern enum dtor_kinds is_destructor_name (const char *name);
-
/* Return non-zero iff NAME is the mangled name of a vtable. */
extern int is_vtable_name (const char *name);
-
/* Return non-zero iff NAME is the un-mangled name of an operator,
perhaps scoped within some class. */
extern int is_operator_name (const char *name);
-
/* Return an object's virtual function as a value.
VALUEP is a pointer to a pointer to a value, holding the object
@@ -105,11 +102,8 @@ extern int is_operator_name (const char *name);
this is the type containing F. OFFSET is the offset of that base
type within *VALUEP. */
extern struct value *value_virtual_fn_field (struct value **valuep,
- struct fn_field *f,
- int j,
- struct type *type,
- int offset);
-
+ struct fn_field *f, int j,
+ struct type *type, int offset);
/* Try to find the run-time type of VALUE, using C++ run-time type
information. Return the run-time type, or zero if we can't figure
@@ -134,9 +128,8 @@ extern struct value *value_virtual_fn_field (struct value **valuep,
FULL, TOP, and USING_ENC can each be zero, in which case we don't
provide the corresponding piece of information. */
-extern struct type *value_rtti_type (struct value *value,
- int *full, LONGEST *top,
- int *using_enc);
+extern struct type *value_rtti_type (struct value *value, int *full,
+ LONGEST *top, int *using_enc);
/* Compute the offset of the baseclass which is the INDEXth baseclass
of class TYPE, for value at VALADDR (in host) at ADDRESS (in
@@ -144,17 +137,14 @@ extern struct type *value_rtti_type (struct value *value,
contents of VAL. The result is the offset of the baseclass value
relative to (the address of)(ARG) + OFFSET. */
-extern int baseclass_offset (struct type *type,
- int index, const gdb_byte *valaddr,
- LONGEST embedded_offset,
- CORE_ADDR address,
- const struct value *val);
+extern int baseclass_offset (struct type *type, int index,
+ const gdb_byte *valaddr, LONGEST embedded_offset,
+ CORE_ADDR address, const struct value *val);
/* Describe the target of a pointer to method. CONTENTS is the byte
pattern representing the pointer to method. TYPE is the pointer to
method type. STREAM is the stream to print it to. */
-void cplus_print_method_ptr (const gdb_byte *contents,
- struct type *type,
+void cplus_print_method_ptr (const gdb_byte *contents, struct type *type,
struct ui_file *stream);
/* Return the size of a pointer to member function of type
@@ -204,14 +194,13 @@ extern std::string cplus_typename_from_type_info (struct value *value);
address of the routine we are thunking to and continue to there
instead. */
-CORE_ADDR cplus_skip_trampoline (frame_info_ptr frame,
- CORE_ADDR stop_pc);
+CORE_ADDR cplus_skip_trampoline (frame_info_ptr frame, CORE_ADDR stop_pc);
/* Return a struct that provides pass-by-reference information
about the given TYPE. */
-extern struct language_pass_by_ref_info cp_pass_by_reference
- (struct type *type);
+extern struct language_pass_by_ref_info
+cp_pass_by_reference (struct type *type);
struct cp_abi_ops
{
@@ -225,23 +214,18 @@ struct cp_abi_ops
enum dtor_kinds (*is_destructor_name) (const char *name);
int (*is_vtable_name) (const char *name);
int (*is_operator_name) (const char *name);
- struct value *(*virtual_fn_field) (struct value **arg1p,
- struct fn_field * f,
- int j, struct type * type,
- int offset);
- struct type *(*rtti_type) (struct value *v, int *full,
- LONGEST *top, int *using_enc);
+ struct value *(*virtual_fn_field) (struct value **arg1p, struct fn_field *f,
+ int j, struct type *type, int offset);
+ struct type *(*rtti_type) (struct value *v, int *full, LONGEST *top,
+ int *using_enc);
int (*baseclass_offset) (struct type *type, int index,
const bfd_byte *valaddr, LONGEST embedded_offset,
CORE_ADDR address, const struct value *val);
- void (*print_method_ptr) (const gdb_byte *contents,
- struct type *type,
+ void (*print_method_ptr) (const gdb_byte *contents, struct type *type,
struct ui_file *stream);
int (*method_ptr_size) (struct type *);
- void (*make_method_ptr) (struct type *, gdb_byte *,
- CORE_ADDR, int);
- struct value * (*method_ptr_to_value) (struct value **,
- struct value *);
+ void (*make_method_ptr) (struct type *, gdb_byte *, CORE_ADDR, int);
+ struct value *(*method_ptr_to_value) (struct value **, struct value *);
void (*print_vtable) (struct value *);
struct value *(*get_typeid) (struct value *value);
struct type *(*get_typeid_type) (struct gdbarch *gdbarch);
@@ -251,7 +235,6 @@ struct cp_abi_ops
struct language_pass_by_ref_info (*pass_by_reference) (struct type *type);
};
-
extern int register_cp_abi (struct cp_abi_ops *abi);
extern void set_cp_abi_as_auto_default (const char *short_name);
diff --git a/gdb/cp-namespace.c b/gdb/cp-namespace.c
index b1c54c57da6..830696ad75f 100644
--- a/gdb/cp-namespace.c
+++ b/gdb/cp-namespace.c
@@ -35,13 +35,10 @@
#include <map>
#include <string>
-static struct block_symbol
- cp_lookup_nested_symbol_1 (struct type *container_type,
- const char *nested_name,
- const char *concatenated_name,
- const struct block *block,
- const domain_enum domain,
- int basic_lookup, int is_in_anonymous);
+static struct block_symbol cp_lookup_nested_symbol_1 (
+ struct type *container_type, const char *nested_name,
+ const char *concatenated_name, const struct block *block,
+ const domain_enum domain, int basic_lookup, int is_in_anonymous);
static struct type *cp_lookup_transparent_type_loop (const char *name,
const char *scope,
@@ -76,10 +73,11 @@ cp_scan_for_anonymous_namespaces (struct buildsym_compunit *compunit,
== CP_ANONYMOUS_NAMESPACE_LEN)
&& strncmp (name + previous_component,
CP_ANONYMOUS_NAMESPACE_STR,
- CP_ANONYMOUS_NAMESPACE_LEN) == 0)
+ CP_ANONYMOUS_NAMESPACE_LEN)
+ == 0)
{
- int dest_len = (previous_component == 0
- ? 0 : previous_component - 2);
+ int dest_len
+ = (previous_component == 0 ? 0 : previous_component - 2);
int src_len = next_component;
char *dest = (char *) alloca (dest_len + 1);
@@ -99,14 +97,14 @@ cp_scan_for_anonymous_namespaces (struct buildsym_compunit *compunit,
to 0, this way it is always considered valid. */
std::vector<const char *> excludes;
add_using_directive (compunit->get_local_using_directives (),
- dest, src, NULL, NULL, excludes, 0,
- 1, &objfile->objfile_obstack);
+ dest, src, NULL, NULL, excludes, 0, 1,
+ &objfile->objfile_obstack);
}
/* The "+ 2" is for the "::". */
previous_component = next_component + 2;
- next_component = (previous_component
- + cp_find_first_component (name
- + previous_component));
+ next_component
+ = (previous_component
+ + cp_find_first_component (name + previous_component));
}
}
}
@@ -117,8 +115,7 @@ cp_scan_for_anonymous_namespaces (struct buildsym_compunit *compunit,
int
cp_is_in_anonymous (const char *symbol_name)
{
- return (strstr (symbol_name, CP_ANONYMOUS_NAMESPACE_STR)
- != NULL);
+ return (strstr (symbol_name, CP_ANONYMOUS_NAMESPACE_STR) != NULL);
}
/* Look up NAME in DOMAIN in BLOCK's static block and in global blocks.
@@ -145,9 +142,9 @@ cp_basic_lookup_symbol (const char *name, const struct block *block,
if (global_block != NULL)
{
- sym.symbol = lookup_symbol_in_block (name,
- symbol_name_match_type::FULL,
- global_block, domain);
+ sym.symbol
+ = lookup_symbol_in_block (name, symbol_name_match_type::FULL,
+ global_block, domain);
sym.block = global_block;
}
}
@@ -168,9 +165,9 @@ cp_basic_lookup_symbol (const char *name, const struct block *block,
if so then also search for NAME in that class. */
static struct block_symbol
-cp_lookup_bare_symbol (const struct language_defn *langdef,
- const char *name, const struct block *block,
- const domain_enum domain, int search)
+cp_lookup_bare_symbol (const struct language_defn *langdef, const char *name,
+ const struct block *block, const domain_enum domain,
+ int search)
{
struct block_symbol sym;
@@ -222,7 +219,6 @@ cp_lookup_bare_symbol (const struct language_defn *langdef,
if (lang_this.symbol == NULL)
return {};
-
type = check_typedef (lang_this.symbol->type ()->target_type ());
/* If TYPE_NAME is NULL, abandon trying to find this symbol.
This can happen for lambda functions compiled with clang++,
@@ -247,11 +243,9 @@ cp_lookup_bare_symbol (const struct language_defn *langdef,
may be no text after the last "::". */
static struct block_symbol
-cp_search_static_and_baseclasses (const char *name,
- const struct block *block,
+cp_search_static_and_baseclasses (const char *name, const struct block *block,
const domain_enum domain,
- unsigned int prefix_len,
- int is_in_anonymous)
+ unsigned int prefix_len, int is_in_anonymous)
{
/* Check for malformed input. */
if (prefix_len + 2 > strlen (name) || name[prefix_len + 1] != ':')
@@ -270,8 +264,8 @@ cp_search_static_and_baseclasses (const char *name,
VAR_DOMAIN. This works for classes too because of
symbol_matches_domain (which should be replaced with something
else, but it's what we have today). */
- block_symbol scope_sym = lookup_symbol_in_static_block (scope.c_str (),
- block, VAR_DOMAIN);
+ block_symbol scope_sym
+ = lookup_symbol_in_static_block (scope.c_str (), block, VAR_DOMAIN);
if (scope_sym.symbol == NULL)
scope_sym = lookup_global_symbol (scope.c_str (), block, VAR_DOMAIN);
if (scope_sym.symbol == NULL)
@@ -284,14 +278,14 @@ cp_search_static_and_baseclasses (const char *name,
if ((scope_type->code () == TYPE_CODE_FUNC
|| scope_type->code () == TYPE_CODE_METHOD)
&& domain == VAR_DOMAIN)
- return lookup_symbol (nested, scope_sym.symbol->value_block (),
- VAR_DOMAIN, NULL);
+ return lookup_symbol (nested, scope_sym.symbol->value_block (), VAR_DOMAIN,
+ NULL);
/* Look for a symbol named NESTED in this class/namespace.
The caller is assumed to have already have done a basic lookup of NAME.
So we pass zero for BASIC_LOOKUP to cp_lookup_nested_symbol_1 here. */
- return cp_lookup_nested_symbol_1 (scope_type, nested, name,
- block, domain, 0, is_in_anonymous);
+ return cp_lookup_nested_symbol_1 (scope_type, nested, name, block, domain, 0,
+ is_in_anonymous);
}
/* Look up NAME in the C++ namespace NAMESPACE. Other arguments are
@@ -377,15 +371,11 @@ cp_lookup_symbol_in_namespace (const char *the_namespace, const char *name,
pass 0 for it. Internally we pass 1 when recursing. */
static void
-cp_lookup_symbol_via_imports (const char *scope,
- const char *name,
- const struct block *block,
- const domain_enum domain,
- const int search_scope_first,
- const int declaration_only,
- const int search_parents,
- std::map<std::string,
- struct block_symbol>& found_symbols)
+cp_lookup_symbol_via_imports (
+ const char *scope, const char *name, const struct block *block,
+ const domain_enum domain, const int search_scope_first,
+ const int declaration_only, const int search_parents,
+ std::map<std::string, struct block_symbol> &found_symbols)
{
struct using_direct *current;
struct block_symbol sym = {};
@@ -400,8 +390,7 @@ cp_lookup_symbol_via_imports (const char *scope,
/* First, try to find the symbol in the given namespace if requested. */
if (search_scope_first)
{
- sym = cp_lookup_symbol_in_namespace (scope, name,
- block, domain, 1);
+ sym = cp_lookup_symbol_in_namespace (scope, name, block, domain, 1);
if (sym.symbol != nullptr)
found_symbols[sym.symbol->m_name] = sym;
}
@@ -413,9 +402,7 @@ cp_lookup_symbol_via_imports (const char *scope,
/* Go through the using directives. If any of them add new names to
the namespace we're searching in, see if we can find a match by
applying them. */
- for (current = block_using (block);
- current != NULL;
- current = current->next)
+ for (current = block_using (block); current != NULL; current = current->next)
{
const char **excludep;
@@ -424,12 +411,11 @@ cp_lookup_symbol_via_imports (const char *scope,
if (!current->valid_line (boundary_sal.line))
continue;
len = strlen (current->import_dest);
- directive_match = (search_parents
- ? (startswith (scope, current->import_dest)
- && (len == 0
- || scope[len] == ':'
- || scope[len] == '\0'))
- : strcmp (scope, current->import_dest) == 0);
+ directive_match
+ = (search_parents
+ ? (startswith (scope, current->import_dest)
+ && (len == 0 || scope[len] == ':' || scope[len] == '\0'))
+ : strcmp (scope, current->import_dest) == 0);
/* If the import destination is the current scope or one of its
ancestors then it is applicable. */
@@ -446,11 +432,12 @@ cp_lookup_symbol_via_imports (const char *scope,
current->import_src as NAMESPACE to direct the search
towards the imported namespace. */
if (current->declaration
- && strcmp (name, current->alias
- ? current->alias : current->declaration) == 0)
+ && strcmp (name, current->alias ? current->alias
+ : current->declaration)
+ == 0)
sym = cp_lookup_symbol_in_namespace (current->import_src,
- current->declaration,
- block, domain, 1);
+ current->declaration, block,
+ domain, 1);
/* If this is a DECLARATION_ONLY search or a symbol was found
or this import statement was an import declaration, the
@@ -470,14 +457,12 @@ cp_lookup_symbol_via_imports (const char *scope,
if (*excludep)
continue;
- if (current->alias != NULL
- && strcmp (name, current->alias) == 0)
+ if (current->alias != NULL && strcmp (name, current->alias) == 0)
/* If the import is creating an alias and the alias matches
the sought name. Pass current->import_src as the NAME to
direct the search towards the aliased namespace. */
{
- sym = cp_lookup_symbol_in_namespace (scope,
- current->import_src,
+ sym = cp_lookup_symbol_in_namespace (scope, current->import_src,
block, domain, 1);
found_symbols[sym.symbol->m_name] = sym;
}
@@ -486,11 +471,9 @@ cp_lookup_symbol_via_imports (const char *scope,
/* If this import statement creates no alias, pass
current->inner as NAMESPACE to direct the search
towards the imported namespace. */
- cp_lookup_symbol_via_imports (current->import_src, name,
- block, domain, 1, 0, 0,
- found_symbols);
+ cp_lookup_symbol_via_imports (current->import_src, name, block,
+ domain, 1, 0, 0, found_symbols);
}
-
}
}
}
@@ -498,8 +481,7 @@ cp_lookup_symbol_via_imports (const char *scope,
/* Wrapper for the actual cp_lookup_symbol_via_imports. This wrapper sets
search_scope_first correctly and handles errors if needed. */
static struct block_symbol
-cp_lookup_symbol_via_imports (const char *scope,
- const char *name,
+cp_lookup_symbol_via_imports (const char *scope, const char *name,
const struct block *block,
const domain_enum domain,
const int declaration_only,
@@ -507,9 +489,9 @@ cp_lookup_symbol_via_imports (const char *scope,
{
std::map<std::string, struct block_symbol> found_symbols;
- cp_lookup_symbol_via_imports(scope, name, block, domain, 0,
- declaration_only, search_parents,
- found_symbols);
+ cp_lookup_symbol_via_imports (scope, name, block, domain, 0,
+ declaration_only, search_parents,
+ found_symbols);
if (found_symbols.size () > 1)
{
@@ -523,10 +505,10 @@ cp_lookup_symbol_via_imports (const char *scope,
error_str += " and ";
error_str += itr->second.symbol->print_name ();
}
- error (_("%s"), error_str.c_str ());
+ error (_ ("%s"), error_str.c_str ());
}
- if (found_symbols.size() == 1)
+ if (found_symbols.size () == 1)
return found_symbols.cbegin ()->second;
else
return {};
@@ -535,8 +517,7 @@ cp_lookup_symbol_via_imports (const char *scope,
/* Helper function that searches an array of symbols for one named NAME. */
static struct symbol *
-search_symbol_list (const char *name, int num,
- struct symbol **syms)
+search_symbol_list (const char *name, int num, struct symbol **syms)
{
int i;
@@ -555,34 +536,32 @@ search_symbol_list (const char *name, int num,
search through imported directives using cp_lookup_symbol_via_imports. */
struct block_symbol
-cp_lookup_symbol_imports_or_template (const char *scope,
- const char *name,
+cp_lookup_symbol_imports_or_template (const char *scope, const char *name,
const struct block *block,
const domain_enum domain)
{
struct symbol *function = block->function ();
- symbol_lookup_debug_printf
- ("cp_lookup_symbol_imports_or_template (%s, %s, %s, %s)",
- scope, name, host_address_to_string (block), domain_name (domain));
+ symbol_lookup_debug_printf (
+ "cp_lookup_symbol_imports_or_template (%s, %s, %s, %s)", scope, name,
+ host_address_to_string (block), domain_name (domain));
if (function != NULL && function->language () == language_cplus)
{
/* Search the function's template parameters. */
if (function->is_cplus_template_function ())
{
- struct template_symbol *templ
- = (struct template_symbol *) function;
- struct symbol *sym = search_symbol_list (name,
- templ->n_template_arguments,
- templ->template_arguments);
+ struct template_symbol *templ = (struct template_symbol *) function;
+ struct symbol *sym
+ = search_symbol_list (name, templ->n_template_arguments,
+ templ->template_arguments);
if (sym != NULL)
{
- symbol_lookup_debug_printf
- ("cp_lookup_symbol_imports_or_template (...) = %s",
- host_address_to_string (sym));
- return (struct block_symbol) {sym, block};
+ symbol_lookup_debug_printf (
+ "cp_lookup_symbol_imports_or_template (...) = %s",
+ host_address_to_string (sym));
+ return (struct block_symbol) { sym, block };
}
}
@@ -606,24 +585,22 @@ cp_lookup_symbol_imports_or_template (const char *scope,
else
{
name_copy.erase (prefix_len);
- context = lookup_typename (lang,
- name_copy.c_str (),
- parent, 1);
+ context
+ = lookup_typename (lang, name_copy.c_str (), parent, 1);
}
if (context == NULL)
break;
- sym
- = search_symbol_list (name,
- TYPE_N_TEMPLATE_ARGUMENTS (context),
- TYPE_TEMPLATE_ARGUMENTS (context));
+ sym = search_symbol_list (name,
+ TYPE_N_TEMPLATE_ARGUMENTS (context),
+ TYPE_TEMPLATE_ARGUMENTS (context));
if (sym != NULL)
{
- symbol_lookup_debug_printf
- ("cp_lookup_symbol_imports_or_template (...) = %s",
- host_address_to_string (sym));
- return (struct block_symbol) {sym, parent};
+ symbol_lookup_debug_printf (
+ "cp_lookup_symbol_imports_or_template (...) = %s",
+ host_address_to_string (sym));
+ return (struct block_symbol) { sym, parent };
}
}
}
@@ -631,9 +608,10 @@ cp_lookup_symbol_imports_or_template (const char *scope,
struct block_symbol result
= cp_lookup_symbol_via_imports (scope, name, block, domain, 1, 1);
- symbol_lookup_debug_printf ("cp_lookup_symbol_imports_or_template (...) = %s\n",
- result.symbol != nullptr
- ? host_address_to_string (result.symbol) : "NULL");
+ symbol_lookup_debug_printf (
+ "cp_lookup_symbol_imports_or_template (...) = %s\n",
+ result.symbol != nullptr ? host_address_to_string (result.symbol)
+ : "NULL");
return result;
}
@@ -666,8 +644,7 @@ cp_lookup_symbol_via_all_imports (const char *scope, const char *name,
being evaluated. */
struct block_symbol
-cp_lookup_symbol_namespace (const char *scope,
- const char *name,
+cp_lookup_symbol_namespace (const char *scope, const char *name,
const struct block *block,
const domain_enum domain)
{
@@ -686,7 +663,8 @@ cp_lookup_symbol_namespace (const char *scope,
symbol_lookup_debug_printf ("cp_lookup_symbol_namespace (...) = %s",
sym.symbol != NULL
- ? host_address_to_string (sym.symbol) : "NULL");
+ ? host_address_to_string (sym.symbol)
+ : "NULL");
return sym;
}
@@ -706,12 +684,9 @@ cp_lookup_symbol_namespace (const char *scope,
"x". */
static struct block_symbol
-lookup_namespace_scope (const struct language_defn *langdef,
- const char *name,
- const struct block *block,
- const domain_enum domain,
- const char *scope,
- int scope_len)
+lookup_namespace_scope (const struct language_defn *langdef, const char *name,
+ const struct block *block, const domain_enum domain,
+ const char *scope, int scope_len)
{
char *the_namespace;
@@ -729,8 +704,8 @@ lookup_namespace_scope (const struct language_defn *langdef,
new_scope_len += 2;
}
new_scope_len += cp_find_first_component (scope + new_scope_len);
- sym = lookup_namespace_scope (langdef, name, block, domain,
- scope, new_scope_len);
+ sym = lookup_namespace_scope (langdef, name, block, domain, scope,
+ new_scope_len);
if (sym.symbol != NULL)
return sym;
}
@@ -752,8 +727,7 @@ lookup_namespace_scope (const struct language_defn *langdef,
the_namespace = (char *) alloca (scope_len + 1);
strncpy (the_namespace, scope, scope_len);
the_namespace[scope_len] = '\0';
- return cp_lookup_symbol_in_namespace (the_namespace, name,
- block, domain, 1);
+ return cp_lookup_symbol_in_namespace (the_namespace, name, block, domain, 1);
}
/* The C++-specific version of name lookup for static and global
@@ -764,16 +738,15 @@ lookup_namespace_scope (const struct language_defn *langdef,
struct block_symbol
cp_lookup_symbol_nonlocal (const struct language_defn *langdef,
- const char *name,
- const struct block *block,
+ const char *name, const struct block *block,
const domain_enum domain)
{
struct block_symbol sym;
const char *scope = block_scope (block);
- symbol_lookup_debug_printf
- ("cp_lookup_symbol_non_local (%s, %s (scope %s), %s)",
- name, host_address_to_string (block), scope, domain_name (domain));
+ symbol_lookup_debug_printf (
+ "cp_lookup_symbol_non_local (%s, %s (scope %s), %s)", name,
+ host_address_to_string (block), scope, domain_name (domain));
/* First, try to find the symbol in the given namespace, and all
containing namespaces. */
@@ -785,8 +758,8 @@ cp_lookup_symbol_nonlocal (const struct language_defn *langdef,
symbol_lookup_debug_printf ("cp_lookup_symbol_nonlocal (...) = %s",
(sym.symbol != NULL
- ? host_address_to_string (sym.symbol)
- : "NULL"));
+ ? host_address_to_string (sym.symbol)
+ : "NULL"));
return sym;
}
@@ -841,8 +814,8 @@ find_symbol_in_baseclass (struct type *parent_type, const char *name,
std::string concatenated_name = std::string (base_name) + "::" + name;
sym = cp_lookup_nested_symbol_1 (base_type, name,
- concatenated_name.c_str (),
- block, domain, 1, is_in_anonymous);
+ concatenated_name.c_str (), block,
+ domain, 1, is_in_anonymous);
if (sym.symbol != NULL)
break;
}
@@ -866,8 +839,7 @@ static struct block_symbol
cp_lookup_nested_symbol_1 (struct type *container_type,
const char *nested_name,
const char *concatenated_name,
- const struct block *block,
- const domain_enum domain,
+ const struct block *block, const domain_enum domain,
int basic_lookup, int is_in_anonymous)
{
struct block_symbol sym;
@@ -928,10 +900,8 @@ cp_lookup_nested_symbol_1 (struct type *container_type,
Return NULL if there is no such nested symbol. */
struct block_symbol
-cp_lookup_nested_symbol (struct type *parent_type,
- const char *nested_name,
- const struct block *block,
- const domain_enum domain)
+cp_lookup_nested_symbol (struct type *parent_type, const char *nested_name,
+ const struct block *block, const domain_enum domain)
{
/* type_name_or_error provides better error reporting using the
original type. */
@@ -968,30 +938,30 @@ cp_lookup_nested_symbol (struct type *parent_type,
size = strlen (parent_name) + 2 + strlen (nested_name) + 1;
concatenated_name = (char *) alloca (size);
- xsnprintf (concatenated_name, size, "%s::%s",
- parent_name, nested_name);
+ xsnprintf (concatenated_name, size, "%s::%s", parent_name,
+ nested_name);
is_in_anonymous = cp_is_in_anonymous (concatenated_name);
sym = cp_lookup_nested_symbol_1 (parent_type, nested_name,
- concatenated_name, block, domain,
- 1, is_in_anonymous);
+ concatenated_name, block, domain, 1,
+ is_in_anonymous);
symbol_lookup_debug_printf ("cp_lookup_nested_symbol (...) = %s",
(sym.symbol != NULL
- ? host_address_to_string (sym.symbol)
- : "NULL"));
+ ? host_address_to_string (sym.symbol)
+ : "NULL"));
return sym;
}
case TYPE_CODE_FUNC:
case TYPE_CODE_METHOD:
- symbol_lookup_debug_printf
- ("cp_lookup_nested_symbol (...) = NULL (func/method)");
+ symbol_lookup_debug_printf (
+ "cp_lookup_nested_symbol (...) = NULL (func/method)");
return {};
default:
- internal_error (_("cp_lookup_nested_symbol called "
- "on a non-aggregate type."));
+ internal_error (_ ("cp_lookup_nested_symbol called "
+ "on a non-aggregate type."));
}
}
@@ -1038,8 +1008,7 @@ cp_lookup_transparent_type (const char *name)
must be the index of the start of a component of SCOPE. */
static struct type *
-cp_lookup_transparent_type_loop (const char *name,
- const char *scope,
+cp_lookup_transparent_type_loop (const char *name, const char *scope,
int length)
{
int scope_length = length + cp_find_first_component (scope + length);
@@ -1050,8 +1019,7 @@ cp_lookup_transparent_type_loop (const char *name,
if (scope[scope_length] == ':')
{
struct type *retval
- = cp_lookup_transparent_type_loop (name, scope,
- scope_length + 2);
+ = cp_lookup_transparent_type_loop (name, scope, scope_length + 2);
if (retval != NULL)
return retval;
@@ -1071,18 +1039,18 @@ cp_lookup_transparent_type_loop (const char *name,
static void
maintenance_cplus_namespace (const char *args, int from_tty)
{
- gdb_printf (_("The `maint namespace' command was removed.\n"));
+ gdb_printf (_ ("The `maint namespace' command was removed.\n"));
}
void _initialize_cp_namespace ();
+
void
_initialize_cp_namespace ()
{
struct cmd_list_element *cmd;
- cmd = add_cmd ("namespace", class_maintenance,
- maintenance_cplus_namespace,
- _("Deprecated placeholder for removed functionality."),
+ cmd = add_cmd ("namespace", class_maintenance, maintenance_cplus_namespace,
+ _ ("Deprecated placeholder for removed functionality."),
&maint_cplus_cmd_list);
deprecate_cmd (cmd, NULL);
}
diff --git a/gdb/cp-support.c b/gdb/cp-support.c
index 6a96f9f213e..638a4c41149 100644
--- a/gdb/cp-support.c
+++ b/gdb/cp-support.c
@@ -60,27 +60,26 @@ static void overload_list_add_symbol (struct symbol *sym,
const char *oload_name,
std::vector<symbol *> *overload_list);
-static void add_symbol_overload_list_using
- (const char *func_name, const char *the_namespace,
- std::vector<symbol *> *overload_list);
+static void
+add_symbol_overload_list_using (const char *func_name,
+ const char *the_namespace,
+ std::vector<symbol *> *overload_list);
-static void add_symbol_overload_list_qualified
- (const char *func_name,
- std::vector<symbol *> *overload_list);
+static void
+add_symbol_overload_list_qualified (const char *func_name,
+ std::vector<symbol *> *overload_list);
/* The list of "maint cplus" commands. */
struct cmd_list_element *maint_cplus_cmd_list = NULL;
-static void
- replace_typedefs (struct demangle_parse_info *info,
- struct demangle_component *ret_comp,
- canonicalization_ftype *finder,
- void *data);
+static void replace_typedefs (struct demangle_parse_info *info,
+ struct demangle_component *ret_comp,
+ canonicalization_ftype *finder, void *data);
static struct demangle_component *
- gdb_cplus_demangle_v3_components (const char *mangled,
- int options, void **mem);
+gdb_cplus_demangle_v3_components (const char *mangled, int options,
+ void **mem);
/* A convenience function to copy STRING into OBSTACK, returning a pointer
to the newly allocated string and saving the number of bytes saved in LEN.
@@ -88,8 +87,7 @@ static struct demangle_component *
It does not copy the terminating '\0' byte! */
static char *
-copy_string_to_obstack (struct obstack *obstack, const char *string,
- long *len)
+copy_string_to_obstack (struct obstack *obstack, const char *string, long *len)
{
*len = strlen (string);
return (char *) obstack_copy (obstack, string, *len);
@@ -134,8 +132,7 @@ cp_already_canonical (const char *string)
static int
inspect_type (struct demangle_parse_info *info,
struct demangle_component *ret_comp,
- canonicalization_ftype *finder,
- void *data)
+ canonicalization_ftype *finder, void *data)
{
char *name;
struct symbol *sym;
@@ -200,8 +197,7 @@ inspect_type (struct demangle_parse_info *info,
If the symbol is typedef and its type name is the same
as the symbol's name, e.g., "typedef struct foo foo;". */
- if (type->name () != nullptr
- && strcmp (type->name (), name) == 0)
+ if (type->name () != nullptr && strcmp (type->name (), name) == 0)
return 0;
is_anon = (type->name () == NULL
@@ -214,8 +210,7 @@ inspect_type (struct demangle_parse_info *info,
/* Find the last typedef for the type. */
while (last->target_type () != NULL
- && (last->target_type ()->code ()
- == TYPE_CODE_TYPEDEF))
+ && (last->target_type ()->code () == TYPE_CODE_TYPEDEF))
last = last->target_type ();
/* If there is only one typedef for this anonymous type,
@@ -238,7 +233,8 @@ inspect_type (struct demangle_parse_info *info,
the type symbol's language to expand a C++ typedef
the C++ way even if the current language is C. */
const language_defn *lang = language_def (sym->language ());
- lang->print_type (type, "", &buf, -1, 0, &type_print_raw_options);
+ lang->print_type (type, "", &buf, -1, 0,
+ &type_print_raw_options);
}
/* If type_print threw an exception, there is little point
in continuing, so just bow out gracefully. */
@@ -280,7 +276,8 @@ inspect_type (struct demangle_parse_info *info,
if (canon != nullptr)
{
/* Copy the canonicalization into the obstack. */
- name = copy_string_to_obstack (&info->obstack, canon.get (), &len);
+ name = copy_string_to_obstack (&info->obstack, canon.get (),
+ &len);
}
ret_comp->u.s_name.s = name;
@@ -302,12 +299,10 @@ inspect_type (struct demangle_parse_info *info,
plus template arguments' name with typedefs replaced. */
static bool
-replace_typedefs_template (struct demangle_parse_info *info,
- string_file &buf,
+replace_typedefs_template (struct demangle_parse_info *info, string_file &buf,
struct demangle_component *tmpl,
struct demangle_component *repl,
- canonicalization_ftype *finder,
- void *data)
+ canonicalization_ftype *finder, void *data)
{
demangle_component *tmpl_arglist = d_right (tmpl);
@@ -337,8 +332,7 @@ replace_typedefs_template (struct demangle_parse_info *info,
static void
replace_typedefs_qualified_name (struct demangle_parse_info *info,
struct demangle_component *ret_comp,
- canonicalization_ftype *finder,
- void *data)
+ canonicalization_ftype *finder, void *data)
{
string_file buf;
struct demangle_component *comp = ret_comp;
@@ -355,9 +349,8 @@ replace_typedefs_qualified_name (struct demangle_parse_info *info,
/* Convert 'template + replaced template argument list' to a
string and replace the top DEMANGLE_COMPONENT_QUAL_NAME
node. */
- if (!replace_typedefs_template (info, buf,
- d_left (comp), d_left (ret_comp),
- finder, data))
+ if (!replace_typedefs_template (info, buf, d_left (comp),
+ d_left (ret_comp), finder, data))
return;
buf.clear ();
@@ -458,7 +451,6 @@ replace_typedefs_qualified_name (struct demangle_parse_info *info,
replace_typedefs (info, comp, finder, data);
}
-
/* A function to check const and volatile qualifiers for argument types.
"Parameter declarations that differ only in the presence
@@ -482,8 +474,7 @@ check_cv_qualifiers (struct demangle_component *ret_comp)
static void
replace_typedefs (struct demangle_parse_info *info,
struct demangle_component *ret_comp,
- canonicalization_ftype *finder,
- void *data)
+ canonicalization_ftype *finder, void *data)
{
if (ret_comp)
{
@@ -503,8 +494,8 @@ replace_typedefs (struct demangle_parse_info *info,
sym = NULL;
try
{
- sym = lookup_symbol (local_name.get (), 0,
- VAR_DOMAIN, 0).symbol;
+ sym = lookup_symbol (local_name.get (), 0, VAR_DOMAIN, 0)
+ .symbol;
}
catch (const gdb_exception &except)
{
@@ -581,8 +572,7 @@ replace_typedefs (struct demangle_parse_info *info,
gdb::unique_xmalloc_ptr<char>
cp_canonicalize_string_full (const char *string,
- canonicalization_ftype *finder,
- void *data)
+ canonicalization_ftype *finder, void *data)
{
unsigned int estimated_len;
std::unique_ptr<demangle_parse_info> info;
@@ -595,8 +585,8 @@ cp_canonicalize_string_full (const char *string,
replace_typedefs (info.get (), info->tree, finder, data);
/* Convert the tree back into a string. */
- gdb::unique_xmalloc_ptr<char> us = cp_comp_to_string (info->tree,
- estimated_len);
+ gdb::unique_xmalloc_ptr<char> us
+ = cp_comp_to_string (info->tree, estimated_len);
gdb_assert (us);
/* Finally, compare the original string with the computed
@@ -642,7 +632,7 @@ cp_canonicalize_string (const char *string)
if (!us)
{
- warning (_("internal error: string \"%s\" failed to be canonicalized"),
+ warning (_ ("internal error: string \"%s\" failed to be canonicalized"),
string);
return nullptr;
}
@@ -660,8 +650,7 @@ cp_canonicalize_string (const char *string)
OPTIONS will be passed to the demangler. */
static std::unique_ptr<demangle_parse_info>
-mangled_name_to_comp (const char *mangled_name, int options,
- void **memory,
+mangled_name_to_comp (const char *mangled_name, int options, void **memory,
gdb::unique_xmalloc_ptr<char> *demangled_p)
{
/* If it looks like a v3 mangled name, then try to go directly
@@ -670,8 +659,7 @@ mangled_name_to_comp (const char *mangled_name, int options,
{
struct demangle_component *ret;
- ret = gdb_cplus_demangle_v3_components (mangled_name,
- options, memory);
+ ret = gdb_cplus_demangle_v3_components (mangled_name, options, memory);
if (ret)
{
std::unique_ptr<demangle_parse_info> info (new demangle_parse_info);
@@ -683,11 +671,11 @@ mangled_name_to_comp (const char *mangled_name, int options,
/* If it doesn't, or if that failed, then try to demangle the
name. */
- gdb::unique_xmalloc_ptr<char> demangled_name = gdb_demangle (mangled_name,
- options);
+ gdb::unique_xmalloc_ptr<char> demangled_name
+ = gdb_demangle (mangled_name, options);
if (demangled_name == NULL)
- return NULL;
-
+ return NULL;
+
/* If we could demangle the name, parse it to build the component
tree. */
std::unique_ptr<demangle_parse_info> info
@@ -712,8 +700,7 @@ cp_class_name_from_physname (const char *physname)
std::unique_ptr<demangle_parse_info> info;
int done;
- info = mangled_name_to_comp (physname, DMGL_ANSI,
- &storage, &demangled_name);
+ info = mangled_name_to_comp (physname, DMGL_ANSI, &storage, &demangled_name);
if (info == NULL)
return NULL;
@@ -858,8 +845,7 @@ method_name_from_physname (const char *physname)
struct demangle_component *ret_comp;
std::unique_ptr<demangle_parse_info> info;
- info = mangled_name_to_comp (physname, DMGL_ANSI,
- &storage, &demangled_name);
+ info = mangled_name_to_comp (physname, DMGL_ANSI, &storage, &demangled_name);
if (info == NULL)
return NULL;
@@ -1017,7 +1003,6 @@ cp_remove_params_if_any (const char *demangled_name, bool completion_mode)
overlapping functionality; can we combine them? Also, do they
handle all the above considerations correctly? */
-
/* This returns the length of first component of NAME, which should be
the demangled name of a C++ variable/function/method/etc.
Specifically, it returns the index of the first colon forming the
@@ -1114,11 +1099,10 @@ cp_find_first_component_aux (const char *name, int permissive)
break;
case 'o':
/* Operator names can screw up the recursion. */
- if (operator_possible
- && startswith (name + index, CP_OPERATOR_STR))
+ if (operator_possible && startswith (name + index, CP_OPERATOR_STR))
{
index += CP_OPERATOR_LEN;
- while (ISSPACE(name[index]))
+ while (ISSPACE (name[index]))
++index;
switch (name[index])
{
@@ -1209,8 +1193,7 @@ cp_entire_prefix_len (const char *name)
OVERLOAD_LIST. */
static void
-overload_list_add_symbol (struct symbol *sym,
- const char *oload_name,
+overload_list_add_symbol (struct symbol *sym, const char *oload_name,
std::vector<symbol *> *overload_list)
{
/* If there is no type information, we can't do anything, so
@@ -1240,8 +1223,7 @@ overload_list_add_symbol (struct symbol *sym,
are named FUNC_NAME and are visible within NAMESPACE. */
struct std::vector<symbol *>
-make_symbol_overload_list (const char *func_name,
- const char *the_namespace)
+make_symbol_overload_list (const char *func_name, const char *the_namespace)
{
const char *name;
std::vector<symbol *> overload_list;
@@ -1254,8 +1236,8 @@ make_symbol_overload_list (const char *func_name,
name = func_name;
else
{
- char *concatenated_name
- = (char *) alloca (strlen (the_namespace) + 2 + strlen (func_name) + 1);
+ char *concatenated_name = (char *) alloca (strlen (the_namespace) + 2
+ + strlen (func_name) + 1);
strcpy (concatenated_name, the_namespace);
strcat (concatenated_name, "::");
strcat (concatenated_name, func_name);
@@ -1264,15 +1246,16 @@ make_symbol_overload_list (const char *func_name,
add_symbol_overload_list_qualified (name, &overload_list);
return overload_list;
+
}
/* Add all symbols with a name matching NAME in BLOCK to the overload
list. */
static void
-add_symbol_overload_list_block (const char *name,
- const struct block *block,
+add_symbol_overload_list_block (const char *name, const struct block *block,
std::vector<symbol *> *overload_list)
+
{
struct block_iterator iter;
struct symbol *sym;
@@ -1297,8 +1280,8 @@ add_symbol_overload_list_namespace (const char *func_name,
name = func_name;
else
{
- char *concatenated_name
- = (char *) alloca (strlen (the_namespace) + 2 + strlen (func_name) + 1);
+ char *concatenated_name = (char *) alloca (strlen (the_namespace) + 2
+ + strlen (func_name) + 1);
strcpy (concatenated_name, the_namespace);
strcat (concatenated_name, "::");
@@ -1315,7 +1298,6 @@ add_symbol_overload_list_namespace (const char *func_name,
block = block_global_block (block);
if (block)
add_symbol_overload_list_block (name, block, overload_list);
-
}
/* Search the namespace of the given type and namespace of and public
@@ -1330,8 +1312,7 @@ add_symbol_overload_list_adl_namespace (struct type *type,
const char *type_name;
int i, prefix_len;
- while (type->is_pointer_or_reference ()
- || type->code () == TYPE_CODE_ARRAY
+ while (type->is_pointer_or_reference () || type->code () == TYPE_CODE_ARRAY
|| type->code () == TYPE_CODE_TYPEDEF)
{
if (type->code () == TYPE_CODE_TYPEDEF)
@@ -1363,8 +1344,7 @@ add_symbol_overload_list_adl_namespace (struct type *type,
{
if (BASETYPE_VIA_PUBLIC (type, i))
add_symbol_overload_list_adl_namespace (TYPE_BASECLASS (type, i),
- func_name,
- overload_list);
+ func_name, overload_list);
}
}
@@ -1398,12 +1378,10 @@ add_symbol_overload_list_using (const char *func_name,
look in the appropriate namespaces for new functions to match
on. */
- for (block = get_selected_block (0);
- block != NULL;
+ for (block = get_selected_block (0); block != NULL;
block = block->superblock ())
- for (current = block_using (block);
- current != NULL;
- current = current->next)
+ for (current = block_using (block); current != NULL;
+ current = current->next)
{
/* Prevent recursive calls. */
if (current->searched)
@@ -1421,15 +1399,13 @@ add_symbol_overload_list_using (const char *func_name,
scoped_restore reset_directive_searched
= make_scoped_restore (&current->searched, 1);
- add_symbol_overload_list_using (func_name,
- current->import_src,
+ add_symbol_overload_list_using (func_name, current->import_src,
overload_list);
}
}
/* Now, add names for this namespace. */
- add_symbol_overload_list_namespace (func_name, the_namespace,
- overload_list);
+ add_symbol_overload_list_namespace (func_name, the_namespace, overload_list);
}
/* This does the bulk of the work of finding overloaded symbols.
@@ -1451,8 +1427,7 @@ add_symbol_overload_list_qualified (const char *func_name,
/* Search upwards from currently selected frame (so that we can
complete on local vars. */
- for (const block *b = get_selected_block (0);
- b != nullptr;
+ for (const block *b = get_selected_block (0); b != nullptr;
b = b->superblock ())
add_symbol_overload_list_block (func_name, b, overload_list);
@@ -1464,27 +1439,27 @@ add_symbol_overload_list_qualified (const char *func_name,
const block *block = get_selected_block (0);
struct objfile *current_objfile = block ? block_objfile (block) : nullptr;
- gdbarch_iterate_over_objfiles_in_search_order
- (current_objfile ? current_objfile->arch () : target_gdbarch (),
- [func_name, surrounding_static_block, &overload_list]
- (struct objfile *obj)
- {
- for (compunit_symtab *cust : obj->compunits ())
- {
- QUIT;
- const struct block *b = cust->blockvector ()->global_block ();
- add_symbol_overload_list_block (func_name, b, overload_list);
-
- b = cust->blockvector ()->static_block ();
- /* Don't do this block twice. */
- if (b == surrounding_static_block)
- continue;
-
- add_symbol_overload_list_block (func_name, b, overload_list);
- }
-
- return 0;
- }, current_objfile);
+ gdbarch_iterate_over_objfiles_in_search_order (
+ current_objfile ? current_objfile->arch () : target_gdbarch (),
+ [func_name, surrounding_static_block,
+ &overload_list] (struct objfile *obj) {
+ for (compunit_symtab *cust : obj->compunits ())
+ {
+ QUIT;
+ const struct block *b = cust->blockvector ()->global_block ();
+ add_symbol_overload_list_block (func_name, b, overload_list);
+
+ b = cust->blockvector ()->static_block ();
+ /* Don't do this block twice. */
+ if (b == surrounding_static_block)
+ continue;
+
+ add_symbol_overload_list_block (func_name, b, overload_list);
+ }
+
+ return 0;
+ },
+ current_objfile);
}
/* Lookup the rtti type for a class name. */
@@ -1492,8 +1467,8 @@ add_symbol_overload_list_qualified (const char *func_name,
struct type *
cp_lookup_rtti_type (const char *name, const struct block *block)
{
- struct symbol * rtti_sym;
- struct type * rtti_type;
+ struct symbol *rtti_sym;
+ struct type *rtti_type;
/* Use VAR_DOMAIN here as NAME may be a typedef. PR 18141, 18417.
Classes "live" in both STRUCT_DOMAIN and VAR_DOMAIN. */
@@ -1501,13 +1476,13 @@ cp_lookup_rtti_type (const char *name, const struct block *block)
if (rtti_sym == NULL)
{
- warning (_("RTTI symbol not found for class '%s'"), name);
+ warning (_ ("RTTI symbol not found for class '%s'"), name);
return NULL;
}
if (rtti_sym->aclass () != LOC_TYPEDEF)
{
- warning (_("RTTI symbol for class '%s' is not a type"), name);
+ warning (_ ("RTTI symbol for class '%s' is not a type"), name);
return NULL;
}
@@ -1522,10 +1497,10 @@ cp_lookup_rtti_type (const char *name, const struct block *block)
symbols for namespaces with the same name as the struct.
This warning is an indication of a bug in the lookup order
or a bug in the way that the symbol tables are populated. */
- warning (_("RTTI symbol for class '%s' is a namespace"), name);
+ warning (_ ("RTTI symbol for class '%s' is a namespace"), name);
return NULL;
default:
- warning (_("RTTI symbol for class '%s' has bad type"), name);
+ warning (_ ("RTTI symbol for class '%s' has bad type"), name);
return NULL;
}
@@ -1574,8 +1549,8 @@ report_failed_demangle (const char *name, bool core_dump_allowed,
if (!error_reported)
{
std::string short_msg
- = string_printf (_("unable to demangle '%s' "
- "(demangler failed with signal %d)"),
+ = string_printf (_ ("unable to demangle '%s' "
+ "(demangler failed with signal %d)"),
name, crash_signal);
std::string long_msg
@@ -1587,8 +1562,7 @@ report_failed_demangle (const char *name, bool core_dump_allowed,
begin_line ();
if (core_dump_allowed)
- gdb_printf (gdb_stderr,
- _("%s\nAttempting to dump core.\n"),
+ gdb_printf (gdb_stderr, _ ("%s\nAttempting to dump core.\n"),
long_msg.c_str ());
else
warn_cant_dump_core (long_msg.c_str ());
@@ -1610,10 +1584,9 @@ gdb_demangle (const char *name, int options)
int crash_signal = 0;
#ifdef HAVE_WORKING_FORK
- scoped_segv_handler_restore restore_segv
- (catch_demangler_crashes
- ? gdb_demangle_signal_handler
- : nullptr);
+ scoped_segv_handler_restore restore_segv (catch_demangler_crashes
+ ? gdb_demangle_signal_handler
+ : nullptr);
bool core_dump_allowed = gdb_demangle_attempt_core_dump;
SIGJMP_BUF jmp_buf;
@@ -1654,11 +1627,10 @@ gdb_demangle (const char *name, int options)
we might be in a background thread. Instead, arrange for
the reporting to happen on the main thread. */
std::string copy = name;
- run_on_main_thread ([=] ()
- {
- report_failed_demangle (copy.c_str (), core_dump_allowed,
- crash_signal);
- });
+ run_on_main_thread ([=] () {
+ report_failed_demangle (copy.c_str (), core_dump_allowed,
+ crash_signal);
+ });
result = NULL;
}
@@ -1671,21 +1643,18 @@ gdb_demangle (const char *name, int options)
/* See cp-support.h. */
char *
-gdb_cplus_demangle_print (int options,
- struct demangle_component *tree,
- int estimated_length,
- size_t *p_allocated_size)
+gdb_cplus_demangle_print (int options, struct demangle_component *tree,
+ int estimated_length, size_t *p_allocated_size)
{
- return cplus_demangle_print (options | DMGL_VERBOSE, tree,
- estimated_length, p_allocated_size);
+ return cplus_demangle_print (options | DMGL_VERBOSE, tree, estimated_length,
+ p_allocated_size);
}
/* A wrapper for cplus_demangle_v3_components that forces
DMGL_VERBOSE. */
static struct demangle_component *
-gdb_cplus_demangle_v3_components (const char *mangled,
- int options, void **mem)
+gdb_cplus_demangle_v3_components (const char *mangled, int options, void **mem)
{
return cplus_demangle_v3_components (mangled, options | DMGL_VERBOSE, mem);
}
@@ -1713,15 +1682,13 @@ cp_search_name_hash (const char *search_name)
break;
/* Ignore ABI tags such as "[abi:cxx11]. */
- if (*string == '['
- && startswith (string + 1, "abi:")
+ if (*string == '[' && startswith (string + 1, "abi:")
&& string[5] != ':')
break;
/* Ignore template parameter lists. */
- if (string[0] == '<'
- && string[1] != '(' && string[1] != '<' && string[1] != '='
- && string[1] != ' ' && string[1] != '\0')
+ if (string[0] == '<' && string[1] != '(' && string[1] != '<'
+ && string[1] != '=' && string[1] != ' ' && string[1] != '\0')
break;
hash = SYMBOL_HASH_NEXT (hash, *string);
@@ -1765,8 +1732,7 @@ cp_search_name_hash (const char *search_name)
static bool
cp_symbol_name_matches_1 (const char *symbol_search_name,
- const char *lookup_name,
- size_t lookup_name_len,
+ const char *lookup_name, size_t lookup_name_len,
strncmp_iw_mode mode,
completion_match_result *comp_match_res)
{
@@ -1776,8 +1742,9 @@ cp_symbol_name_matches_1 (const char *symbol_search_name,
while (true)
{
- if (strncmp_iw_with_mode (sname, lookup_name, lookup_name_len,
- mode, language_cplus, match_for_lcd, true) == 0)
+ if (strncmp_iw_with_mode (sname, lookup_name, lookup_name_len, mode,
+ language_cplus, match_for_lcd, true)
+ == 0)
{
if (comp_match_res != NULL)
{
@@ -1829,13 +1796,13 @@ cp_fq_symbol_name_matches (const char *symbol_search_name,
const std::string &name = lookup_name.cplus ().lookup_name ();
completion_match_for_lcd *match_for_lcd
= (comp_match_res != NULL ? &comp_match_res->match_for_lcd : NULL);
- strncmp_iw_mode mode = (lookup_name.completion_mode ()
- ? strncmp_iw_mode::NORMAL
- : strncmp_iw_mode::MATCH_PARAMS);
+ strncmp_iw_mode mode
+ = (lookup_name.completion_mode () ? strncmp_iw_mode::NORMAL
+ : strncmp_iw_mode::MATCH_PARAMS);
- if (strncmp_iw_with_mode (symbol_search_name,
- name.c_str (), name.size (),
- mode, language_cplus, match_for_lcd) == 0)
+ if (strncmp_iw_with_mode (symbol_search_name, name.c_str (), name.size (),
+ mode, language_cplus, match_for_lcd)
+ == 0)
{
if (comp_match_res != NULL)
comp_match_res->set_match (symbol_search_name);
@@ -1856,13 +1823,12 @@ cp_symbol_name_matches (const char *symbol_search_name,
/* Get the demangled name. */
const std::string &name = lookup_name.cplus ().lookup_name ();
- strncmp_iw_mode mode = (lookup_name.completion_mode ()
- ? strncmp_iw_mode::NORMAL
- : strncmp_iw_mode::MATCH_PARAMS);
+ strncmp_iw_mode mode
+ = (lookup_name.completion_mode () ? strncmp_iw_mode::NORMAL
+ : strncmp_iw_mode::MATCH_PARAMS);
- return cp_symbol_name_matches_1 (symbol_search_name,
- name.c_str (), name.size (),
- mode, comp_match_res);
+ return cp_symbol_name_matches_1 (symbol_search_name, name.c_str (),
+ name.size (), mode, comp_match_res);
}
/* See cp-support.h. */
@@ -1885,46 +1851,45 @@ cp_get_symbol_name_matcher (const lookup_name_info &lookup_name)
#if GDB_SELF_TEST
-namespace selftests {
+namespace selftests
+{
static void
test_cp_symbol_name_matches ()
{
-#define CHECK_MATCH(SYMBOL, INPUT) \
- SELF_CHECK (cp_symbol_name_matches_1 (SYMBOL, \
- INPUT, sizeof (INPUT) - 1, \
- strncmp_iw_mode::MATCH_PARAMS, \
- NULL))
-
-#define CHECK_NOT_MATCH(SYMBOL, INPUT) \
- SELF_CHECK (!cp_symbol_name_matches_1 (SYMBOL, \
- INPUT, sizeof (INPUT) - 1, \
- strncmp_iw_mode::MATCH_PARAMS, \
+#define CHECK_MATCH(SYMBOL, INPUT) \
+ SELF_CHECK (cp_symbol_name_matches_1 (SYMBOL, INPUT, sizeof (INPUT) - 1, \
+ strncmp_iw_mode::MATCH_PARAMS, NULL))
+
+#define CHECK_NOT_MATCH(SYMBOL, INPUT) \
+ SELF_CHECK (!cp_symbol_name_matches_1 (SYMBOL, INPUT, sizeof (INPUT) - 1, \
+ strncmp_iw_mode::MATCH_PARAMS, \
NULL))
/* Like CHECK_MATCH, and also check that INPUT (and all substrings
that start at index 0) completes to SYMBOL. */
-#define CHECK_MATCH_C(SYMBOL, INPUT) \
- do \
- { \
- CHECK_MATCH (SYMBOL, INPUT); \
- for (size_t i = 0; i < sizeof (INPUT) - 1; i++) \
- SELF_CHECK (cp_symbol_name_matches_1 (SYMBOL, INPUT, i, \
- strncmp_iw_mode::NORMAL, \
- NULL)); \
- } while (0)
+#define CHECK_MATCH_C(SYMBOL, INPUT) \
+ do \
+ { \
+ CHECK_MATCH (SYMBOL, INPUT); \
+ for (size_t i = 0; i < sizeof (INPUT) - 1; i++) \
+ SELF_CHECK (cp_symbol_name_matches_1 (SYMBOL, INPUT, i, \
+ strncmp_iw_mode::NORMAL, \
+ NULL)); \
+ } \
+ while (0)
/* Like CHECK_NOT_MATCH, and also check that INPUT does NOT complete
to SYMBOL. */
-#define CHECK_NOT_MATCH_C(SYMBOL, INPUT) \
- do \
- { \
- CHECK_NOT_MATCH (SYMBOL, INPUT); \
- SELF_CHECK (!cp_symbol_name_matches_1 (SYMBOL, INPUT, \
- sizeof (INPUT) - 1, \
- strncmp_iw_mode::NORMAL, \
- NULL)); \
- } while (0)
+#define CHECK_NOT_MATCH_C(SYMBOL, INPUT) \
+ do \
+ { \
+ CHECK_NOT_MATCH (SYMBOL, INPUT); \
+ SELF_CHECK (!cp_symbol_name_matches_1 (SYMBOL, INPUT, \
+ sizeof (INPUT) - 1, \
+ strncmp_iw_mode::NORMAL, NULL)); \
+ } \
+ while (0)
/* Lookup name without parens matches all overloads. */
CHECK_MATCH_C ("function()", "function");
@@ -2069,7 +2034,8 @@ test_cp_symbol_name_matches ()
CHECK_MATCH_C ("function[abi:foo][abi:bar]()", "function[abi:foo]");
CHECK_MATCH_C ("function[abi:foo][abi:bar](int)", "function[abi:foo]");
CHECK_MATCH_C ("function[abi:foo][abi:bar]()", "function[abi:foo] ()");
- CHECK_NOT_MATCH_C ("function[abi:foo][abi:bar]()", "function[abi:foo] (int)");
+ CHECK_NOT_MATCH_C ("function[abi:foo][abi:bar]()",
+ "function[abi:foo] (int)");
CHECK_MATCH_C ("function [abi:foo][abi:bar] ( )", "function [abi:foo]");
@@ -2097,21 +2063,19 @@ quote (const char *str)
location information in case ithe check fails. */
static void
-check_remove_params (const char *file, int line,
- const char *name, const char *expected,
- bool completion_mode)
+check_remove_params (const char *file, int line, const char *name,
+ const char *expected, bool completion_mode)
{
gdb::unique_xmalloc_ptr<char> result
= cp_remove_params_if_any (name, completion_mode);
if ((expected == NULL) != (result == NULL)
- || (expected != NULL
- && strcmp (result.get (), expected) != 0))
+ || (expected != NULL && strcmp (result.get (), expected) != 0))
{
- error (_("%s:%d: make-paramless self-test failed: (completion=%d) "
- "\"%s\" -> %s, expected %s"),
- file, line, completion_mode, name,
- quote (result.get ()).c_str (), quote (expected).c_str ());
+ error (_ ("%s:%d: make-paramless self-test failed: (completion=%d) "
+ "\"%s\" -> %s, expected %s"),
+ file, line, completion_mode, name, quote (result.get ()).c_str (),
+ quote (expected).c_str ());
}
}
@@ -2122,42 +2086,38 @@ test_cp_remove_params ()
{
/* Check that removing parameter info out of NAME produces EXPECTED.
Checks both normal and completion modes. */
-#define CHECK(NAME, EXPECTED) \
- do \
- { \
- check_remove_params (__FILE__, __LINE__, NAME, EXPECTED, false); \
- check_remove_params (__FILE__, __LINE__, NAME, EXPECTED, true); \
- } \
+#define CHECK(NAME, EXPECTED) \
+ do \
+ { \
+ check_remove_params (__FILE__, __LINE__, NAME, EXPECTED, false); \
+ check_remove_params (__FILE__, __LINE__, NAME, EXPECTED, true); \
+ } \
while (0)
/* Similar, but used when NAME is incomplete -- i.e., is has
unbalanced parentheses. In this case, looking for the exact name
should fail / return empty. */
-#define CHECK_INCOMPL(NAME, EXPECTED) \
- do \
- { \
- check_remove_params (__FILE__, __LINE__, NAME, NULL, false); \
- check_remove_params (__FILE__, __LINE__, NAME, EXPECTED, true); \
- } \
+#define CHECK_INCOMPL(NAME, EXPECTED) \
+ do \
+ { \
+ check_remove_params (__FILE__, __LINE__, NAME, NULL, false); \
+ check_remove_params (__FILE__, __LINE__, NAME, EXPECTED, true); \
+ } \
while (0)
CHECK ("function()", "function");
CHECK_INCOMPL ("function(", "function");
CHECK ("function() const", "function");
- CHECK ("(anonymous namespace)::A::B::C",
- "(anonymous namespace)::A::B::C");
+ CHECK ("(anonymous namespace)::A::B::C", "(anonymous namespace)::A::B::C");
- CHECK ("A::(anonymous namespace)",
- "A::(anonymous namespace)");
+ CHECK ("A::(anonymous namespace)", "A::(anonymous namespace)");
CHECK_INCOMPL ("A::(anonymou", "A");
- CHECK ("A::foo<int>()",
- "A::foo<int>");
+ CHECK ("A::foo<int>()", "A::foo<int>");
- CHECK_INCOMPL ("A::foo<int>(",
- "A::foo<int>");
+ CHECK_INCOMPL ("A::foo<int>(", "A::foo<int>");
CHECK ("A::foo<(anonymous namespace)::B>::func(int)",
"A::foo<(anonymous namespace)::B>::func");
@@ -2174,8 +2134,7 @@ test_cp_remove_params ()
CHECK ("A::foo<(anonymous namespace)::B>",
"A::foo<(anonymous namespace)::B>");
- CHECK_INCOMPL ("A::foo<(anonymous namespace)::B",
- "A::foo");
+ CHECK_INCOMPL ("A::foo<(anonymous namespace)::B", "A::foo");
/* Shouldn't this parse? Looks like a bug in
cp_demangled_name_to_comp. See PR c++/22411. */
@@ -2183,12 +2142,10 @@ test_cp_remove_params ()
CHECK ("A::foo<void(int)>::func(int)",
"A::foo<void(int)>::func");
#else
- CHECK_INCOMPL ("A::foo<void(int)>::func(int)",
- "A::foo");
+ CHECK_INCOMPL ("A::foo<void(int)>::func(int)", "A::foo");
#endif
- CHECK_INCOMPL ("A::foo<void(int",
- "A::foo");
+ CHECK_INCOMPL ("A::foo<void(int", "A::foo");
#undef CHECK
#undef CHECK_INCOMPL
@@ -2205,8 +2162,8 @@ test_cp_remove_params ()
static void
first_component_command (const char *arg, int from_tty)
{
- int len;
- char *prefix;
+ int len;
+ char *prefix;
if (!arg)
return;
@@ -2236,10 +2193,10 @@ info_vtbl_command (const char *arg, int from_tty)
const char *
find_toplevel_char (const char *s, char c)
{
- int quoted = 0; /* zero if we're not in quotes;
+ int quoted = 0; /* zero if we're not in quotes;
'"' if we're in a double-quoted string;
'\'' if we're in a single-quoted string. */
- int depth = 0; /* Number of unclosed parens we've seen. */
+ int depth = 0; /* Number of unclosed parens we've seen. */
const char *scan;
for (scan = s; *scan; scan++)
@@ -2251,7 +2208,7 @@ find_toplevel_char (const char *s, char c)
else if (*scan == '\\' && *(scan + 1))
scan++;
}
- else if (*scan == c && ! quoted && depth == 0)
+ else if (*scan == c && !quoted && depth == 0)
return scan;
else if (*scan == '"' || *scan == '\'')
quoted = *scan;
@@ -2306,39 +2263,37 @@ find_toplevel_char (const char *s, char c)
}
void _initialize_cp_support ();
+
void
_initialize_cp_support ()
{
cmd_list_element *maintenance_cplus
= add_basic_prefix_cmd ("cplus", class_maintenance,
- _("C++ maintenance commands."),
- &maint_cplus_cmd_list,
- 0, &maintenancelist);
+ _ ("C++ maintenance commands."),
+ &maint_cplus_cmd_list, 0, &maintenancelist);
add_alias_cmd ("cp", maintenance_cplus, class_maintenance, 1,
&maintenancelist);
- add_cmd ("first_component",
- class_maintenance,
- first_component_command,
- _("Print the first class/namespace component of NAME."),
+ add_cmd ("first_component", class_maintenance, first_component_command,
+ _ ("Print the first class/namespace component of NAME."),
&maint_cplus_cmd_list);
add_info ("vtbl", info_vtbl_command,
- _("Show the virtual function table for a C++ object.\n\
+ _ ("Show the virtual function table for a C++ object.\n\
Usage: info vtbl EXPRESSION\n\
Evaluate EXPRESSION and display the virtual function table for the\n\
resulting object."));
#ifdef HAVE_WORKING_FORK
add_setshow_boolean_cmd ("catch-demangler-crashes", class_maintenance,
- &catch_demangler_crashes, _("\
-Set whether to attempt to catch demangler crashes."), _("\
-Show whether to attempt to catch demangler crashes."), _("\
+ &catch_demangler_crashes, _ ("\
+Set whether to attempt to catch demangler crashes."),
+ _ ("\
+Show whether to attempt to catch demangler crashes."),
+ _ ("\
If enabled GDB will attempt to catch demangler crashes and\n\
display the offending symbol."),
- NULL,
- NULL,
- &maintenance_set_cmdlist,
+ NULL, NULL, &maintenance_set_cmdlist,
&maintenance_show_cmdlist);
gdb_demangle_attempt_core_dump = can_dump_core (LIMIT_CUR);
diff --git a/gdb/cp-support.h b/gdb/cp-support.h
index d12f1d4ce05..248454c282e 100644
--- a/gdb/cp-support.h
+++ b/gdb/cp-support.h
@@ -74,19 +74,19 @@ struct demangle_parse_info
struct obstack obstack;
};
-
/* Functions from cp-support.c. */
-extern gdb::unique_xmalloc_ptr<char> cp_canonicalize_string
- (const char *string);
+extern gdb::unique_xmalloc_ptr<char>
+cp_canonicalize_string (const char *string);
-extern gdb::unique_xmalloc_ptr<char> cp_canonicalize_string_no_typedefs
- (const char *string);
+extern gdb::unique_xmalloc_ptr<char>
+cp_canonicalize_string_no_typedefs (const char *string);
typedef const char *(canonicalization_ftype) (struct type *, void *);
-extern gdb::unique_xmalloc_ptr<char> cp_canonicalize_string_full
- (const char *string, canonicalization_ftype *finder, void *data);
+extern gdb::unique_xmalloc_ptr<char>
+cp_canonicalize_string_full (const char *string,
+ canonicalization_ftype *finder, void *data);
extern char *cp_class_name_from_physname (const char *physname);
@@ -98,24 +98,24 @@ extern unsigned int cp_entire_prefix_len (const char *name);
extern gdb::unique_xmalloc_ptr<char> cp_func_name (const char *full_name);
-extern gdb::unique_xmalloc_ptr<char> cp_remove_params
- (const char *demanged_name);
+extern gdb::unique_xmalloc_ptr<char>
+cp_remove_params (const char *demanged_name);
/* DEMANGLED_NAME is the name of a function, (optionally) including
parameters and (optionally) a return type. Return the name of the
function without parameters or return type, or NULL if we can not
parse the name. If COMPLETION_MODE is true, then tolerate a
non-existing or unbalanced parameter list. */
-extern gdb::unique_xmalloc_ptr<char> cp_remove_params_if_any
- (const char *demangled_name, bool completion_mode);
+extern gdb::unique_xmalloc_ptr<char>
+cp_remove_params_if_any (const char *demangled_name, bool completion_mode);
extern std::vector<symbol *> make_symbol_overload_list (const char *,
const char *);
-extern void add_symbol_overload_list_adl
- (gdb::array_view<type *> arg_types,
- const char *func_name,
- std::vector<symbol *> *overload_list);
+extern void
+add_symbol_overload_list_adl (gdb::array_view<type *> arg_types,
+ const char *func_name,
+ std::vector<symbol *> *overload_list);
extern struct type *cp_lookup_rtti_type (const char *name,
const struct block *block);
@@ -128,8 +128,8 @@ extern struct type *cp_lookup_rtti_type (const char *name,
extern unsigned int cp_search_name_hash (const char *search_name);
/* Implement the "get_symbol_name_matcher" language_defn method for C++. */
-extern symbol_name_matcher_ftype *cp_get_symbol_name_matcher
- (const lookup_name_info &lookup_name);
+extern symbol_name_matcher_ftype *
+cp_get_symbol_name_matcher (const lookup_name_info &lookup_name);
/* Functions/variables from cp-namespace.c. */
@@ -139,29 +139,25 @@ extern void cp_scan_for_anonymous_namespaces (struct buildsym_compunit *,
const struct symbol *symbol,
struct objfile *objfile);
-extern struct block_symbol cp_lookup_symbol_nonlocal
- (const struct language_defn *langdef,
- const char *name,
- const struct block *block,
- const domain_enum domain);
-
extern struct block_symbol
- cp_lookup_symbol_namespace (const char *the_namespace,
- const char *name,
- const struct block *block,
- const domain_enum domain);
+cp_lookup_symbol_nonlocal (const struct language_defn *langdef,
+ const char *name, const struct block *block,
+ const domain_enum domain);
-extern struct block_symbol cp_lookup_symbol_imports_or_template
- (const char *scope,
- const char *name,
- const struct block *block,
- const domain_enum domain);
+extern struct block_symbol
+cp_lookup_symbol_namespace (const char *the_namespace, const char *name,
+ const struct block *block,
+ const domain_enum domain);
extern struct block_symbol
- cp_lookup_nested_symbol (struct type *parent_type,
- const char *nested_name,
- const struct block *block,
- const domain_enum domain);
+cp_lookup_symbol_imports_or_template (const char *scope, const char *name,
+ const struct block *block,
+ const domain_enum domain);
+
+extern struct block_symbol cp_lookup_nested_symbol (struct type *parent_type,
+ const char *nested_name,
+ const struct block *block,
+ const domain_enum domain);
struct type *cp_lookup_transparent_type (const char *name);
@@ -172,14 +168,14 @@ struct type *cp_find_type_baseclass_by_name (struct type *parent_type,
/* Functions from cp-name-parser.y. */
-extern std::unique_ptr<demangle_parse_info> cp_demangled_name_to_comp
- (const char *demangled_name, std::string *errmsg);
+extern std::unique_ptr<demangle_parse_info>
+cp_demangled_name_to_comp (const char *demangled_name, std::string *errmsg);
/* Convert RESULT to a string. ESTIMATED_LEN is used only as a guide
to the length of the result. */
-extern gdb::unique_xmalloc_ptr<char> cp_comp_to_string
- (struct demangle_component *result, int estimated_len);
+extern gdb::unique_xmalloc_ptr<char>
+cp_comp_to_string (struct demangle_component *result, int estimated_len);
extern void cp_merge_demangle_parse_infos (struct demangle_parse_info *,
struct demangle_component *,
diff --git a/gdb/cp-valprint.c b/gdb/cp-valprint.c
index ca73882a0ce..1370c7a8925 100644
--- a/gdb/cp-valprint.c
+++ b/gdb/cp-valprint.c
@@ -49,11 +49,10 @@ static void cp_print_static_field (struct type *, struct value *,
struct ui_file *, int,
const struct value_print_options *);
-static void cp_print_value (struct value *, struct ui_file *,
- int, const struct value_print_options *,
+static void cp_print_value (struct value *, struct ui_file *, int,
+ const struct value_print_options *,
struct type **);
-
/* GCC versions after 2.4.5 use this. */
const char vtbl_ptr_name[] = "__vtbl_ptr_type";
@@ -82,19 +81,19 @@ cp_is_vtbl_member (struct type *type)
if (type->code () == TYPE_CODE_ARRAY)
{
type = type->target_type ();
- if (type->code () == TYPE_CODE_STRUCT /* if not using thunks */
- || type->code () == TYPE_CODE_PTR) /* if using thunks */
+ if (type->code () == TYPE_CODE_STRUCT /* if not using thunks */
+ || type->code () == TYPE_CODE_PTR) /* if using thunks */
{
/* Virtual functions tables are full of pointers
to virtual functions. */
return cp_is_vtbl_ptr_type (type);
}
}
- else if (type->code () == TYPE_CODE_STRUCT) /* if not using thunks */
+ else if (type->code () == TYPE_CODE_STRUCT) /* if not using thunks */
{
return cp_is_vtbl_ptr_type (type);
}
- else if (type->code () == TYPE_CODE_PTR) /* if using thunks */
+ else if (type->code () == TYPE_CODE_PTR) /* if using thunks */
{
/* The type name of the thunk pointer is NULL when using
dwarf2. We could test for a pointer to a function, but
@@ -120,10 +119,9 @@ cp_is_vtbl_member (struct type *type)
or zero if called from top level. */
void
-cp_print_value_fields (struct value *val, struct ui_file *stream,
- int recurse, const struct value_print_options *options,
- struct type **dont_print_vb,
- int dont_print_statmem)
+cp_print_value_fields (struct value *val, struct ui_file *stream, int recurse,
+ const struct value_print_options *options,
+ struct type **dont_print_vb, int dont_print_statmem)
{
int i, len, n_baseclasses;
int fields_seen = 0;
@@ -139,8 +137,7 @@ cp_print_value_fields (struct value *val, struct ui_file *stream,
if (obstack_object_size (&dont_print_statmem_obstack) > 0)
{
obstack_free (&dont_print_statmem_obstack, NULL);
- obstack_begin (&dont_print_statmem_obstack,
- 32 * sizeof (CORE_ADDR));
+ obstack_begin (&dont_print_statmem_obstack, 32 * sizeof (CORE_ADDR));
}
if (obstack_object_size (&dont_print_stat_array_obstack) > 0)
{
@@ -174,13 +171,13 @@ cp_print_value_fields (struct value *val, struct ui_file *stream,
if (dont_print_statmem == 0)
{
- statmem_obstack_initial_size =
- obstack_object_size (&dont_print_statmem_obstack);
+ statmem_obstack_initial_size
+ = obstack_object_size (&dont_print_statmem_obstack);
if (last_set_recurse != recurse)
{
- stat_array_obstack_initial_size =
- obstack_object_size (&dont_print_stat_array_obstack);
+ stat_array_obstack_initial_size
+ = obstack_object_size (&dont_print_stat_array_obstack);
last_set_recurse = recurse;
}
@@ -230,8 +227,7 @@ cp_print_value_fields (struct value *val, struct ui_file *stream,
if (field_is_static (&type->field (i)))
{
gdb_puts ("static ", stream);
- fprintf_symbol (stream,
- type->field (i).name (),
+ fprintf_symbol (stream, type->field (i).name (),
current_language->la_language,
DMGL_PARAMS | DMGL_ANSI);
}
@@ -270,11 +266,11 @@ cp_print_value_fields (struct value *val, struct ui_file *stream,
fputs_styled ("<optimized out or zero length>",
metadata_style.style (), stream);
}
- else if (value_bits_synthetic_pointer
- (val, type->field (i).loc_bitpos (),
- TYPE_FIELD_BITSIZE (type, i)))
+ else if (value_bits_synthetic_pointer (
+ val, type->field (i).loc_bitpos (),
+ TYPE_FIELD_BITSIZE (type, i)))
{
- fputs_styled (_("<synthetic pointer>"),
+ fputs_styled (_ ("<synthetic pointer>"),
metadata_style.style (), stream);
}
else
@@ -284,8 +280,8 @@ cp_print_value_fields (struct value *val, struct ui_file *stream,
v = value_field_bitfield (type, i, valaddr,
value_embedded_offset (val), val);
- common_val_print (v, stream, recurse + 1,
- opts, current_language);
+ common_val_print (v, stream, recurse + 1, opts,
+ current_language);
}
}
else
@@ -301,14 +297,13 @@ cp_print_value_fields (struct value *val, struct ui_file *stream,
{
struct value *v = value_static_field (type, i);
- cp_print_static_field (type->field (i).type (),
- v, stream, recurse + 1,
- opts);
+ cp_print_static_field (type->field (i).type (), v,
+ stream, recurse + 1, opts);
}
catch (const gdb_exception_error &ex)
{
fprintf_styled (stream, metadata_style.style (),
- _("<error reading variable: %s>"),
+ _ ("<error reading variable: %s>"),
ex.what ());
}
}
@@ -322,9 +317,9 @@ cp_print_value_fields (struct value *val, struct ui_file *stream,
CORE_ADDR addr;
i_offset += value_embedded_offset (val);
- addr = extract_typed_address (valaddr + i_offset, i_type);
- print_function_pointer_address (opts,
- type->arch (),
+ addr
+ = extract_typed_address (valaddr + i_offset, i_type);
+ print_function_pointer_address (opts, type->arch (),
addr, stream);
}
}
@@ -341,8 +336,8 @@ cp_print_value_fields (struct value *val, struct ui_file *stream,
if (dont_print_statmem == 0)
{
- size_t obstack_final_size =
- obstack_object_size (&dont_print_statmem_obstack);
+ size_t obstack_final_size
+ = obstack_object_size (&dont_print_statmem_obstack);
if (obstack_final_size > statmem_obstack_initial_size)
{
@@ -354,18 +349,17 @@ cp_print_value_fields (struct value *val, struct ui_file *stream,
if (last_set_recurse != recurse)
{
- obstack_final_size =
- obstack_object_size (&dont_print_stat_array_obstack);
+ obstack_final_size
+ = obstack_object_size (&dont_print_stat_array_obstack);
if (obstack_final_size > stat_array_obstack_initial_size)
{
- void *free_to_ptr =
- (char *) obstack_next_free (&dont_print_stat_array_obstack)
- - (obstack_final_size
- - stat_array_obstack_initial_size);
+ void *free_to_ptr
+ = (char *)
+ obstack_next_free (&dont_print_stat_array_obstack)
+ - (obstack_final_size - stat_array_obstack_initial_size);
- obstack_free (&dont_print_stat_array_obstack,
- free_to_ptr);
+ obstack_free (&dont_print_stat_array_obstack, free_to_ptr);
}
last_set_recurse = -1;
}
@@ -376,7 +370,7 @@ cp_print_value_fields (struct value *val, struct ui_file *stream,
gdb_printf (stream, "\n");
print_spaces (2 * recurse, stream);
}
- } /* if there are data fields */
+ } /* if there are data fields */
gdb_printf (stream, "}");
}
@@ -385,8 +379,8 @@ cp_print_value_fields (struct value *val, struct ui_file *stream,
virtual baseclasses. */
static void
-cp_print_value (struct value *val, struct ui_file *stream,
- int recurse, const struct value_print_options *options,
+cp_print_value (struct value *val, struct ui_file *stream, int recurse,
+ const struct value_print_options *options,
struct type **dont_print_vb)
{
struct type *type = check_typedef (value_type (val));
@@ -419,8 +413,8 @@ cp_print_value (struct value *val, struct ui_file *stream,
struct type **first_dont_print
= (struct type **) obstack_base (&dont_print_vb_obstack);
- int j = (struct type **)
- obstack_next_free (&dont_print_vb_obstack) - first_dont_print;
+ int j = (struct type **) obstack_next_free (&dont_print_vb_obstack)
+ - first_dont_print;
while (--j >= 0)
if (baseclass == first_dont_print[j])
@@ -431,9 +425,9 @@ cp_print_value (struct value *val, struct ui_file *stream,
try
{
- boffset = baseclass_offset (type, i, valaddr,
- value_embedded_offset (val),
- address, val);
+ boffset
+ = baseclass_offset (type, i, valaddr, value_embedded_offset (val),
+ address, val);
}
catch (const gdb_exception_error &ex)
{
@@ -456,11 +450,12 @@ cp_print_value (struct value *val, struct ui_file *stream,
gdb::byte_vector buf (baseclass->length ());
if (target_read_memory (address + boffset, buf.data (),
- baseclass->length ()) != 0)
+ baseclass->length ())
+ != 0)
skip = 1;
- base_val = value_from_contents_and_address (baseclass,
- buf.data (),
- address + boffset);
+ base_val
+ = value_from_contents_and_address (baseclass, buf.data (),
+ address + boffset);
baseclass = value_type (base_val);
boffset = 0;
}
@@ -498,8 +493,8 @@ cp_print_value (struct value *val, struct ui_file *stream,
if (!val_print_check_max_depth (stream, recurse, options,
current_language))
{
- struct value *baseclass_val = value_primitive_field (val, 0,
- i, type);
+ struct value *baseclass_val
+ = value_primitive_field (val, 0, i, type);
/* Attempt to run an extension language pretty-printer on the
baseclass if possible. */
@@ -510,16 +505,14 @@ cp_print_value (struct value *val, struct ui_file *stream,
current_language);
if (!result)
- cp_print_value_fields (baseclass_val, stream, recurse, options,
- ((struct type **)
- obstack_base (&dont_print_vb_obstack)),
- 0);
+ cp_print_value_fields (
+ baseclass_val, stream, recurse, options,
+ ((struct type **) obstack_base (&dont_print_vb_obstack)), 0);
}
}
gdb_puts (", ", stream);
- flush_it:
- ;
+ flush_it:;
}
if (dont_print_vb == 0)
@@ -542,10 +535,8 @@ cp_print_value (struct value *val, struct ui_file *stream,
have the same meanings as in c_val_print. */
static void
-cp_print_static_field (struct type *type,
- struct value *val,
- struct ui_file *stream,
- int recurse,
+cp_print_static_field (struct type *type, struct value *val,
+ struct ui_file *stream, int recurse,
const struct value_print_options *options)
{
struct value_print_options opts;
@@ -566,14 +557,14 @@ cp_print_static_field (struct type *type,
first_dont_print
= (CORE_ADDR *) obstack_base (&dont_print_statmem_obstack);
i = obstack_object_size (&dont_print_statmem_obstack)
- / sizeof (CORE_ADDR);
+ / sizeof (CORE_ADDR);
while (--i >= 0)
{
if (addr == first_dont_print[i])
{
- fputs_styled (_("<same as static member of an already"
- " seen type>"),
+ fputs_styled (_ ("<same as static member of an already"
+ " seen type>"),
metadata_style.style (), stream);
return;
}
@@ -594,21 +585,20 @@ cp_print_static_field (struct type *type,
first_dont_print
= (struct type **) obstack_base (&dont_print_stat_array_obstack);
i = obstack_object_size (&dont_print_stat_array_obstack)
- / sizeof (struct type *);
+ / sizeof (struct type *);
while (--i >= 0)
{
if (target_type == first_dont_print[i])
{
- fputs_styled (_("<same as static member of an already"
- " seen type>"),
+ fputs_styled (_ ("<same as static member of an already"
+ " seen type>"),
metadata_style.style (), stream);
return;
}
}
- obstack_grow (&dont_print_stat_array_obstack,
- (char *) &target_type,
+ obstack_grow (&dont_print_stat_array_obstack, (char *) &target_type,
sizeof (struct type *));
}
@@ -623,8 +613,7 @@ cp_print_static_field (struct type *type,
start of some field, set *SELF to NULL. */
static void
-cp_find_class_member (struct type **self_p, int *fieldno,
- LONGEST offset)
+cp_find_class_member (struct type **self_p, int *fieldno, LONGEST offset)
{
struct type *self;
unsigned int i;
@@ -678,9 +667,7 @@ cp_print_class_member (const gdb_byte *valaddr, struct type *type,
LONGEST val;
int fieldno;
- val = extract_signed_integer (valaddr,
- type->length (),
- byte_order);
+ val = extract_signed_integer (valaddr, type->length (), byte_order);
/* Pointers to data members are usually byte offsets into an object.
Because a data member can have offset zero, and a NULL pointer to
@@ -769,19 +756,19 @@ test_print_fields (gdbarch *arch)
string_file out;
struct value_print_options opts;
get_no_prettyformat_print_options (&opts);
- cp_print_value_fields(val, &out, 0, &opts, NULL, 0);
+ cp_print_value_fields (val, &out, 0, &opts, NULL, 0);
SELF_CHECK (out.string () == "{A = false, B = 5, C = true}");
- out.clear();
+ out.clear ();
opts.format = 'x';
- cp_print_value_fields(val, &out, 0, &opts, NULL, 0);
+ cp_print_value_fields (val, &out, 0, &opts, NULL, 0);
SELF_CHECK (out.string () == "{A = 0x0, B = 0x5, C = 0x1}");
}
#endif
-
void _initialize_cp_valprint ();
+
void
_initialize_cp_valprint ()
{
@@ -789,10 +776,7 @@ _initialize_cp_valprint ()
selftests::register_test_foreach_arch ("print-fields", test_print_fields);
#endif
- obstack_begin (&dont_print_stat_array_obstack,
- 32 * sizeof (struct type *));
- obstack_begin (&dont_print_statmem_obstack,
- 32 * sizeof (CORE_ADDR));
- obstack_begin (&dont_print_vb_obstack,
- 32 * sizeof (struct type *));
+ obstack_begin (&dont_print_stat_array_obstack, 32 * sizeof (struct type *));
+ obstack_begin (&dont_print_statmem_obstack, 32 * sizeof (CORE_ADDR));
+ obstack_begin (&dont_print_vb_obstack, 32 * sizeof (struct type *));
}
diff --git a/gdb/cris-linux-tdep.c b/gdb/cris-linux-tdep.c
index f5b74752d11..e6fe2ac74fa 100644
--- a/gdb/cris-linux-tdep.c
+++ b/gdb/cris-linux-tdep.c
@@ -44,10 +44,10 @@ cris_linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
set_solib_svr4_fetch_link_map_offsets (gdbarch,
linux_ilp32_fetch_link_map_offsets);
-
}
void _initialize_cris_linux_tdep ();
+
void
_initialize_cris_linux_tdep ()
{
diff --git a/gdb/cris-tdep.c b/gdb/cris-tdep.c
index edf4e74715c..7e902a07496 100644
--- a/gdb/cris-tdep.c
+++ b/gdb/cris-tdep.c
@@ -41,7 +41,7 @@
#include "objfiles.h"
-#include "solib.h" /* Support for shared libraries. */
+#include "solib.h" /* Support for shared libraries. */
#include "solib-svr4.h"
#include "dis-asm.h"
@@ -51,15 +51,15 @@ enum cris_num_regs
{
/* There are no floating point registers. Used in gdbserver low-linux.c. */
NUM_FREGS = 0,
-
+
/* There are 16 general registers. */
NUM_GENREGS = 16,
-
+
/* There are 16 special registers. */
NUM_SPECREGS = 16,
/* CRISv32 has a pseudo PC register, not noted here. */
-
+
/* CRISv32 has 16 support registers. */
NUM_SUPPREGS = 16
};
@@ -83,46 +83,46 @@ enum cris_regnums
CRIS versions. The frame pointer is always in R8. */
CRIS_FP_REGNUM = 8,
/* ABI related registers. */
- STR_REGNUM = 9,
- RET_REGNUM = 10,
+ STR_REGNUM = 9,
+ RET_REGNUM = 10,
ARG1_REGNUM = 10,
ARG2_REGNUM = 11,
ARG3_REGNUM = 12,
ARG4_REGNUM = 13,
-
+
/* Registers which happen to be common. */
- VR_REGNUM = 17,
- MOF_REGNUM = 23,
- SRP_REGNUM = 27,
+ VR_REGNUM = 17,
+ MOF_REGNUM = 23,
+ SRP_REGNUM = 27,
/* CRISv10 et al. specific registers. */
- P0_REGNUM = 16,
- P4_REGNUM = 20,
- CCR_REGNUM = 21,
- P8_REGNUM = 24,
- IBR_REGNUM = 25,
- IRP_REGNUM = 26,
- BAR_REGNUM = 28,
+ P0_REGNUM = 16,
+ P4_REGNUM = 20,
+ CCR_REGNUM = 21,
+ P8_REGNUM = 24,
+ IBR_REGNUM = 25,
+ IRP_REGNUM = 26,
+ BAR_REGNUM = 28,
DCCR_REGNUM = 29,
- BRP_REGNUM = 30,
- USP_REGNUM = 31,
+ BRP_REGNUM = 30,
+ USP_REGNUM = 31,
/* CRISv32 specific registers. */
- ACR_REGNUM = 15,
- BZ_REGNUM = 16,
- PID_REGNUM = 18,
- SRS_REGNUM = 19,
- WZ_REGNUM = 20,
- EXS_REGNUM = 21,
- EDA_REGNUM = 22,
- DZ_REGNUM = 24,
- EBP_REGNUM = 25,
- ERP_REGNUM = 26,
- NRP_REGNUM = 28,
- CCS_REGNUM = 29,
- CRISV32USP_REGNUM = 30, /* Shares name but not number with CRISv10. */
- SPC_REGNUM = 31,
- CRISV32PC_REGNUM = 32, /* Shares name but not number with CRISv10. */
+ ACR_REGNUM = 15,
+ BZ_REGNUM = 16,
+ PID_REGNUM = 18,
+ SRS_REGNUM = 19,
+ WZ_REGNUM = 20,
+ EXS_REGNUM = 21,
+ EDA_REGNUM = 22,
+ DZ_REGNUM = 24,
+ EBP_REGNUM = 25,
+ ERP_REGNUM = 26,
+ NRP_REGNUM = 28,
+ CCS_REGNUM = 29,
+ CRISV32USP_REGNUM = 30, /* Shares name but not number with CRISv10. */
+ SPC_REGNUM = 31,
+ CRISV32PC_REGNUM = 32, /* Shares name but not number with CRISv10. */
S0_REGNUM = 33,
S1_REGNUM = 34,
@@ -153,11 +153,8 @@ static bool usr_cmd_cris_version_valid = false;
static const char cris_mode_normal[] = "normal";
static const char cris_mode_guru[] = "guru";
-static const char *const cris_modes[] = {
- cris_mode_normal,
- cris_mode_guru,
- 0
-};
+static const char *const cris_modes[]
+ = { cris_mode_normal, cris_mode_guru, 0 };
/* CRIS mode, set via the user command 'set cris-mode'. Affects
type of break instruction among other things. */
@@ -168,25 +165,23 @@ static bool usr_cmd_cris_dwarf2_cfi = true;
/* Sigtramp identification code copied from i386-linux-tdep.c. */
-#define SIGTRAMP_INSN0 0x9c5f /* movu.w 0xXX, $r9 */
-#define SIGTRAMP_OFFSET0 0
-#define SIGTRAMP_INSN1 0xe93d /* break 13 */
-#define SIGTRAMP_OFFSET1 4
+#define SIGTRAMP_INSN0 0x9c5f /* movu.w 0xXX, $r9 */
+#define SIGTRAMP_OFFSET0 0
+#define SIGTRAMP_INSN1 0xe93d /* break 13 */
+#define SIGTRAMP_OFFSET1 4
-static const unsigned short sigtramp_code[] =
-{
- SIGTRAMP_INSN0, 0x0077, /* movu.w $0x77, $r9 */
- SIGTRAMP_INSN1 /* break 13 */
+static const unsigned short sigtramp_code[] = {
+ SIGTRAMP_INSN0, 0x0077, /* movu.w $0x77, $r9 */
+ SIGTRAMP_INSN1 /* break 13 */
};
#define SIGTRAMP_LEN (sizeof sigtramp_code)
/* Note: same length as normal sigtramp code. */
-static const unsigned short rt_sigtramp_code[] =
-{
- SIGTRAMP_INSN0, 0x00ad, /* movu.w $0xad, $r9 */
- SIGTRAMP_INSN1 /* break 13 */
+static const unsigned short rt_sigtramp_code[] = {
+ SIGTRAMP_INSN0, 0x00ad, /* movu.w $0xad, $r9 */
+ SIGTRAMP_INSN1 /* break 13 */
};
/* If PC is in a sigtramp routine, return the address of the start of
@@ -281,7 +276,7 @@ cris_sigcontext_addr (frame_info_ptr this_frame)
return (sp + 156);
}
- error (_("Couldn't recognize signal trampoline."));
+ error (_ ("Couldn't recognize signal trampoline."));
return 0;
}
@@ -309,8 +304,7 @@ struct cris_unwind_cache
};
static struct cris_unwind_cache *
-cris_sigtramp_frame_unwind_cache (frame_info_ptr this_frame,
- void **this_cache)
+cris_sigtramp_frame_unwind_cache (frame_info_ptr this_frame, void **this_cache)
{
struct gdbarch *gdbarch = get_frame_arch (this_frame);
cris_gdbarch_tdep *tdep = gdbarch_tdep<cris_gdbarch_tdep> (gdbarch);
@@ -341,14 +335,14 @@ cris_sigtramp_frame_unwind_cache (frame_info_ptr this_frame,
info->base = extract_unsigned_integer (buf, 4, byte_order);
addr = cris_sigcontext_addr (this_frame);
-
+
/* Layout of the sigcontext struct:
struct sigcontext {
struct pt_regs regs;
unsigned long oldmask;
unsigned long usp;
}; */
-
+
if (tdep->cris_version == 10)
{
/* R0 to R13 are stored in reverse order at offset (2 * 4) in
@@ -397,7 +391,7 @@ cris_sigtramp_frame_unwind_cache (frame_info_ptr this_frame,
info->saved_regs[gdbarch_sp_regnum (gdbarch)].set_addr (addr + (25 * 4));
}
-
+
return info;
}
@@ -405,8 +399,8 @@ static void
cris_sigtramp_frame_this_id (frame_info_ptr this_frame, void **this_cache,
struct frame_id *this_id)
{
- struct cris_unwind_cache *cache =
- cris_sigtramp_frame_unwind_cache (this_frame, this_cache);
+ struct cris_unwind_cache *cache
+ = cris_sigtramp_frame_unwind_cache (this_frame, this_cache);
(*this_id) = frame_id_build (cache->base, get_frame_pc (this_frame));
}
@@ -414,6 +408,7 @@ cris_sigtramp_frame_this_id (frame_info_ptr this_frame, void **this_cache,
static struct value *cris_frame_prev_register (frame_info_ptr this_frame,
void **this_cache, int regnum);
+
static struct value *
cris_sigtramp_frame_prev_register (frame_info_ptr this_frame,
void **this_cache, int regnum)
@@ -425,26 +420,22 @@ cris_sigtramp_frame_prev_register (frame_info_ptr this_frame,
static int
cris_sigtramp_frame_sniffer (const struct frame_unwind *self,
- frame_info_ptr this_frame,
- void **this_cache)
+ frame_info_ptr this_frame, void **this_cache)
{
- if (cris_sigtramp_start (this_frame)
- || cris_rt_sigtramp_start (this_frame))
+ if (cris_sigtramp_start (this_frame) || cris_rt_sigtramp_start (this_frame))
return 1;
return 0;
}
-static const struct frame_unwind cris_sigtramp_frame_unwind =
-{
- "cris sigtramp",
- SIGTRAMP_FRAME,
- default_frame_unwind_stop_reason,
- cris_sigtramp_frame_this_id,
- cris_sigtramp_frame_prev_register,
- NULL,
- cris_sigtramp_frame_sniffer
-};
+static const struct frame_unwind cris_sigtramp_frame_unwind
+ = { "cris sigtramp",
+ SIGTRAMP_FRAME,
+ default_frame_unwind_stop_reason,
+ cris_sigtramp_frame_this_id,
+ cris_sigtramp_frame_prev_register,
+ NULL,
+ cris_sigtramp_frame_sniffer };
static int
crisv32_single_step_through_delay (struct gdbarch *gdbarch,
@@ -471,21 +462,20 @@ crisv32_single_step_through_delay (struct gdbarch *gdbarch,
/* The instruction environment needed to find single-step breakpoints. */
-typedef
-struct instruction_environment
+typedef struct instruction_environment
{
unsigned long reg[NUM_GENREGS];
unsigned long preg[NUM_SPECREGS];
unsigned long branch_break_address;
unsigned long delay_slot_pc;
unsigned long prefix_value;
- int branch_found;
- int prefix_found;
- int invalid;
- int slot_needed;
- int delay_slot_pc_active;
- int xflag_found;
- int disable_interrupt;
+ int branch_found;
+ int prefix_found;
+ int invalid;
+ int slot_needed;
+ int delay_slot_pc_active;
+ int xflag_found;
+ int disable_interrupt;
enum bfd_endian byte_order;
} inst_env_type;
@@ -494,8 +484,8 @@ struct instruction_environment
/* Instruction sizes. */
enum cris_instruction_sizes
{
- INST_BYTE_SIZE = 0,
- INST_WORD_SIZE = 1,
+ INST_BYTE_SIZE = 0,
+ INST_WORD_SIZE = 1,
INST_DWORD_SIZE = 2
};
@@ -504,13 +494,13 @@ enum cris_addressing_modes
{
REGISTER_MODE = 1,
INDIRECT_MODE = 2,
- AUTOINC_MODE = 3
+ AUTOINC_MODE = 3
};
/* Prefix addressing modes. */
enum cris_prefix_addressing_modes
{
- PREFIX_INDEX_MODE = 2,
+ PREFIX_INDEX_MODE = 2,
PREFIX_ASSIGN_MODE = 3,
/* Handle immediate byte offset addressing mode prefix format. */
@@ -521,14 +511,14 @@ enum cris_prefix_addressing_modes
enum cris_opcode_masks
{
BRANCH_SIGNED_SHORT_OFFSET_MASK = 0x1,
- SIGNED_EXTEND_BIT_MASK = 0x2,
- SIGNED_BYTE_MASK = 0x80,
- SIGNED_BYTE_EXTEND_MASK = 0xFFFFFF00,
- SIGNED_WORD_MASK = 0x8000,
- SIGNED_WORD_EXTEND_MASK = 0xFFFF0000,
- SIGNED_DWORD_MASK = 0x80000000,
- SIGNED_QUICK_VALUE_MASK = 0x20,
- SIGNED_QUICK_VALUE_EXTEND_MASK = 0xFFFFFFC0
+ SIGNED_EXTEND_BIT_MASK = 0x2,
+ SIGNED_BYTE_MASK = 0x80,
+ SIGNED_BYTE_EXTEND_MASK = 0xFFFFFF00,
+ SIGNED_WORD_MASK = 0x8000,
+ SIGNED_WORD_EXTEND_MASK = 0xFFFF0000,
+ SIGNED_DWORD_MASK = 0x80000000,
+ SIGNED_QUICK_VALUE_MASK = 0x20,
+ SIGNED_QUICK_VALUE_EXTEND_MASK = 0xFFFFFFC0
};
/* Functions for opcodes. The general form of the ETRAX 16-bit instruction:
@@ -538,7 +528,7 @@ enum cris_opcode_masks
5 - 4 Size
3 - 0 Operand1 */
-static int
+static int
cris_get_operand2 (unsigned short insn)
{
return ((insn & 0xF000) >> 12);
@@ -597,26 +587,26 @@ cris_get_asr_shift_steps (unsigned long value)
static int
cris_get_clear_size (unsigned short insn)
{
- return ((insn) & 0xC000);
+ return ((insn) &0xC000);
}
static int
cris_is_signed_extend_bit_on (unsigned short insn)
{
- return (((insn) & 0x20) == 0x20);
+ return (((insn) &0x20) == 0x20);
}
static int
cris_is_xflag_bit_on (unsigned short insn)
{
- return (((insn) & 0x1000) == 0x1000);
+ return (((insn) &0x1000) == 0x1000);
}
static void
cris_set_size_to_dword (unsigned short *insn)
{
- *insn &= 0xFFCF;
- *insn |= 0x20;
+ *insn &= 0xFFCF;
+ *insn |= 0x20;
}
static signed char
@@ -635,20 +625,19 @@ static struct gdbarch *cris_gdbarch_init (struct gdbarch_info,
static void cris_dump_tdep (struct gdbarch *, struct ui_file *);
-static void set_cris_version (const char *ignore_args, int from_tty,
+static void set_cris_version (const char *ignore_args, int from_tty,
struct cmd_list_element *c);
-static void set_cris_mode (const char *ignore_args, int from_tty,
+static void set_cris_mode (const char *ignore_args, int from_tty,
struct cmd_list_element *c);
-static void set_cris_dwarf2_cfi (const char *ignore_args, int from_tty,
+static void set_cris_dwarf2_cfi (const char *ignore_args, int from_tty,
struct cmd_list_element *c);
-static CORE_ADDR cris_scan_prologue (CORE_ADDR pc,
- frame_info_ptr this_frame,
+static CORE_ADDR cris_scan_prologue (CORE_ADDR pc, frame_info_ptr this_frame,
struct cris_unwind_cache *info);
-static CORE_ADDR crisv32_scan_prologue (CORE_ADDR pc,
+static CORE_ADDR crisv32_scan_prologue (CORE_ADDR pc,
frame_info_ptr this_frame,
struct cris_unwind_cache *info);
@@ -692,8 +681,7 @@ pop_stack_item (struct cris_stack_item *si)
for it IS the sp for the next frame. */
static struct cris_unwind_cache *
-cris_frame_unwind_cache (frame_info_ptr this_frame,
- void **this_prologue_cache)
+cris_frame_unwind_cache (frame_info_ptr this_frame, void **this_prologue_cache)
{
struct gdbarch *gdbarch = get_frame_arch (this_frame);
cris_gdbarch_tdep *tdep = gdbarch_tdep<cris_gdbarch_tdep> (gdbarch);
@@ -729,8 +717,7 @@ cris_frame_unwind_cache (frame_info_ptr this_frame,
frame. This will be used to create a new GDB frame struct. */
static void
-cris_frame_this_id (frame_info_ptr this_frame,
- void **this_prologue_cache,
+cris_frame_this_id (frame_info_ptr this_frame, void **this_prologue_cache,
struct frame_id *this_id)
{
struct cris_unwind_cache *info
@@ -772,10 +759,8 @@ cris_frame_align (struct gdbarch *gdbarch, CORE_ADDR sp)
}
static CORE_ADDR
-cris_push_dummy_code (struct gdbarch *gdbarch,
- CORE_ADDR sp, CORE_ADDR funaddr,
- struct value **args, int nargs,
- struct type *value_type,
+cris_push_dummy_code (struct gdbarch *gdbarch, CORE_ADDR sp, CORE_ADDR funaddr,
+ struct value **args, int nargs, struct type *value_type,
CORE_ADDR *real_pc, CORE_ADDR *bp_addr,
struct regcache *regcache)
{
@@ -790,8 +775,8 @@ cris_push_dummy_code (struct gdbarch *gdbarch,
static CORE_ADDR
cris_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
- struct regcache *regcache, CORE_ADDR bp_addr,
- int nargs, struct value **args, CORE_ADDR sp,
+ struct regcache *regcache, CORE_ADDR bp_addr, int nargs,
+ struct value **args, CORE_ADDR sp,
function_call_return_method return_method,
CORE_ADDR struct_addr)
{
@@ -820,13 +805,13 @@ cris_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
const gdb_byte *val;
int reg_demand;
int i;
-
+
len = value_type (args[argnum])->length ();
val = value_contents (args[argnum]).data ();
-
+
/* How may registers worth of storage do we need for this argument? */
reg_demand = (len / 4) + (len % 4 != 0 ? 1 : 0);
-
+
if (len <= (2 * 4) && (argreg + reg_demand - 1 <= ARG4_REGNUM))
{
/* Data passed by value. Fits in available register(s). */
@@ -881,7 +866,7 @@ cris_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
{
/* Data passed by value. No available registers. Put it on
the stack. */
- si = push_stack_item (si, val, len);
+ si = push_stack_item (si, val, len);
}
}
@@ -900,16 +885,14 @@ cris_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
return sp;
}
-static const struct frame_unwind cris_frame_unwind =
-{
- "cris prologue",
- NORMAL_FRAME,
- default_frame_unwind_stop_reason,
- cris_frame_this_id,
- cris_frame_prev_register,
- NULL,
- default_frame_sniffer
-};
+static const struct frame_unwind cris_frame_unwind
+ = { "cris prologue",
+ NORMAL_FRAME,
+ default_frame_unwind_stop_reason,
+ cris_frame_this_id,
+ cris_frame_prev_register,
+ NULL,
+ default_frame_sniffer };
static CORE_ADDR
cris_frame_base_address (frame_info_ptr this_frame, void **this_cache)
@@ -919,13 +902,9 @@ cris_frame_base_address (frame_info_ptr this_frame, void **this_cache)
return info->base;
}
-static const struct frame_base cris_frame_base =
-{
- &cris_frame_unwind,
- cris_frame_base_address,
- cris_frame_base_address,
- cris_frame_base_address
-};
+static const struct frame_base cris_frame_base
+ = { &cris_frame_unwind, cris_frame_base_address, cris_frame_base_address,
+ cris_frame_base_address };
/* Frames information. The definition of the struct frame_info is
@@ -1003,7 +982,7 @@ static const struct frame_base cris_frame_base =
the entire prologue is examined (0) or just enough instructions to
determine that it is a prologue (1). */
-static CORE_ADDR
+static CORE_ADDR
cris_scan_prologue (CORE_ADDR pc, frame_info_ptr this_frame,
struct cris_unwind_cache *info)
{
@@ -1014,17 +993,17 @@ cris_scan_prologue (CORE_ADDR pc, frame_info_ptr this_frame,
unsigned short insn;
/* Next instruction, lookahead. */
- unsigned short insn_next;
+ unsigned short insn_next;
int regno;
/* Number of byte on stack used for local variables and movem. */
- int val;
+ int val;
/* Highest register number in a movem. */
int regsave;
/* move.d r<source_register>,rS */
- short source_register;
+ short source_register;
/* Scan limit. */
int limit;
@@ -1097,7 +1076,7 @@ cris_scan_prologue (CORE_ADDR pc, frame_info_ptr this_frame,
info->sp_offset += cris_get_quick_value (insn);
}
}
- else if (cris_get_mode (insn) == 0x0002
+ else if (cris_get_mode (insn) == 0x0002
&& cris_get_opcode (insn) == 0x000F
&& cris_get_size (insn) == 0x0003
&& cris_get_operand1 (insn) == gdbarch_sp_regnum (gdbarch))
@@ -1122,8 +1101,7 @@ cris_scan_prologue (CORE_ADDR pc, frame_info_ptr this_frame,
if (cris_get_mode (insn_next) == PREFIX_ASSIGN_MODE
&& cris_get_opcode (insn_next) == 0x000F
&& cris_get_size (insn_next) == 0x0003
- && cris_get_operand1 (insn_next) == gdbarch_sp_regnum
- (gdbarch))
+ && cris_get_operand1 (insn_next) == gdbarch_sp_regnum (gdbarch))
{
regsave = cris_get_operand2 (insn_next);
}
@@ -1155,11 +1133,11 @@ cris_scan_prologue (CORE_ADDR pc, frame_info_ptr this_frame,
break;
}
}
- else if (cris_get_operand2 (insn) == CRIS_FP_REGNUM
+ else if (cris_get_operand2 (insn) == CRIS_FP_REGNUM
/* The size is a fixed-size. */
- && ((insn & 0x0F00) >> 8) == 0x0001
+ && ((insn & 0x0F00) >> 8) == 0x0001
/* A negative offset. */
- && (cris_get_signed_offset (insn) < 0))
+ && (cris_get_signed_offset (insn) < 0))
{
/* move.S rZ,[r8-U] (?) */
insn_next = read_memory_unsigned_integer (pc, 2, byte_order);
@@ -1179,11 +1157,11 @@ cris_scan_prologue (CORE_ADDR pc, frame_info_ptr this_frame,
break;
}
}
- else if (cris_get_operand2 (insn) == CRIS_FP_REGNUM
+ else if (cris_get_operand2 (insn) == CRIS_FP_REGNUM
/* The size is a fixed-size. */
- && ((insn & 0x0F00) >> 8) == 0x0001
+ && ((insn & 0x0F00) >> 8) == 0x0001
/* A positive offset. */
- && (cris_get_signed_offset (insn) > 0))
+ && (cris_get_signed_offset (insn) > 0))
{
/* move.S [r8+U],rZ (?) */
insn_next = read_memory_unsigned_integer (pc, 2, byte_order);
@@ -1232,14 +1210,14 @@ cris_scan_prologue (CORE_ADDR pc, frame_info_ptr this_frame,
this_base = get_frame_register_unsigned (this_frame, CRIS_FP_REGNUM);
info->base = this_base;
info->saved_regs[CRIS_FP_REGNUM].set_addr (info->base);
-
+
/* The FP points at the last saved register. Adjust the FP back
to before the first saved register giving the SP. */
info->prev_sp = info->base + info->r8_offset;
}
else
{
- ULONGEST this_base;
+ ULONGEST this_base;
/* Assume that the FP is this frame's SP but with that pushed
stack space added back. */
this_base = get_frame_register_unsigned (this_frame,
@@ -1247,7 +1225,7 @@ cris_scan_prologue (CORE_ADDR pc, frame_info_ptr this_frame,
info->base = this_base;
info->prev_sp = info->base + info->size;
}
-
+
/* Calculate the addresses for the saved registers on the stack. */
/* FIXME: The address calculation should really be done on the fly while
we're analyzing the prologue (we only hold one regsave value as it is
@@ -1280,15 +1258,14 @@ cris_scan_prologue (CORE_ADDR pc, frame_info_ptr this_frame,
}
/* The PC is found in SRP (the actual register or located on the stack). */
- info->saved_regs[gdbarch_pc_regnum (gdbarch)]
- = info->saved_regs[SRP_REGNUM];
+ info->saved_regs[gdbarch_pc_regnum (gdbarch)] = info->saved_regs[SRP_REGNUM];
return pc;
}
-static CORE_ADDR
+static CORE_ADDR
crisv32_scan_prologue (CORE_ADDR pc, frame_info_ptr this_frame,
- struct cris_unwind_cache *info)
+ struct cris_unwind_cache *info)
{
struct gdbarch *gdbarch = get_frame_arch (this_frame);
ULONGEST this_base;
@@ -1313,14 +1290,13 @@ crisv32_scan_prologue (CORE_ADDR pc, frame_info_ptr this_frame,
}
/* The SP is assumed to be unaltered. */
- this_base = get_frame_register_unsigned (this_frame,
- gdbarch_sp_regnum (gdbarch));
+ this_base
+ = get_frame_register_unsigned (this_frame, gdbarch_sp_regnum (gdbarch));
info->base = this_base;
info->prev_sp = this_base;
-
+
/* The PC is assumed to be found in SRP. */
- info->saved_regs[gdbarch_pc_regnum (gdbarch)]
- = info->saved_regs[SRP_REGNUM];
+ info->saved_regs[gdbarch_pc_regnum (gdbarch)] = info->saved_regs[SRP_REGNUM];
return pc;
}
@@ -1338,7 +1314,7 @@ cris_skip_prologue (struct gdbarch *gdbarch, CORE_ADDR pc)
CORE_ADDR func_addr, func_end;
struct symtab_and_line sal;
CORE_ADDR pc_after_prologue;
-
+
/* If we have line debugging information, then the end of the prologue
should the first assembly instruction of the first source line. */
if (find_pc_partial_function (pc, NULL, &func_addr, &func_end))
@@ -1370,8 +1346,8 @@ static const gdb_byte *
cris_sw_breakpoint_from_kind (struct gdbarch *gdbarch, int kind, int *size)
{
cris_gdbarch_tdep *tdep = gdbarch_tdep<cris_gdbarch_tdep> (gdbarch);
- static unsigned char break8_insn[] = {0x38, 0xe9};
- static unsigned char break15_insn[] = {0x3f, 0xe9};
+ static unsigned char break8_insn[] = { 0x38, 0xe9 };
+ static unsigned char break15_insn[] = { 0x3f, 0xe9 };
*size = kind;
@@ -1390,7 +1366,7 @@ cris_spec_reg_applicable (struct gdbarch *gdbarch,
{
cris_gdbarch_tdep *tdep = gdbarch_tdep<cris_gdbarch_tdep> (gdbarch);
unsigned int version = tdep->cris_version;
-
+
switch (spec_reg.applicable_version)
{
case cris_ver_version_all:
@@ -1432,7 +1408,7 @@ cris_register_size (struct gdbarch *gdbarch, int regno)
{
int i;
int spec_regno;
-
+
if (regno >= 0 && regno < NUM_GENREGS)
{
/* General registers (R0 - R15) are 32 bits. */
@@ -1443,10 +1419,10 @@ cris_register_size (struct gdbarch *gdbarch, int regno)
/* Special register (R16 - R31). cris_spec_regs is zero-based.
Adjust regno accordingly. */
spec_regno = regno - NUM_GENREGS;
-
+
for (i = 0; cris_spec_regs[i].name != NULL; i++)
{
- if (cris_spec_regs[i].number == spec_regno
+ if (cris_spec_regs[i].number == spec_regno
&& cris_spec_reg_applicable (gdbarch, cris_spec_regs[i]))
/* Go with the first applicable register. */
return cris_spec_regs[i].reg_size;
@@ -1462,7 +1438,6 @@ cris_register_size (struct gdbarch *gdbarch, int regno)
return 4;
}
-
return -1;
}
@@ -1487,23 +1462,22 @@ cris_cannot_store_register (struct gdbarch *gdbarch, int regno)
2. Those that are read-only (depends on the processor mode).
3. Those registers to which a write has no effect. */
- if (regno < 0
- || regno >= gdbarch_num_regs (gdbarch)
+ if (regno < 0 || regno >= gdbarch_num_regs (gdbarch)
|| cris_register_size (gdbarch, regno) == 0)
/* Not implemented. */
return 1;
- else if (regno == VR_REGNUM)
+ else if (regno == VR_REGNUM)
/* Read-only. */
return 1;
- else if (regno == P0_REGNUM || regno == P4_REGNUM || regno == P8_REGNUM)
+ else if (regno == P0_REGNUM || regno == P4_REGNUM || regno == P8_REGNUM)
/* Writing has no effect. */
return 1;
/* IBR, BAR, BRP and IRP are read-only in user mode. Let the debug
agent decide whether they are writable. */
-
+
return 0;
}
@@ -1528,23 +1502,22 @@ crisv32_cannot_store_register (struct gdbarch *gdbarch, int regno)
2. Those that are read-only (depends on the processor mode).
3. Those registers to which a write has no effect. */
- if (regno < 0
- || regno >= gdbarch_num_regs (gdbarch)
+ if (regno < 0 || regno >= gdbarch_num_regs (gdbarch)
|| cris_register_size (gdbarch, regno) == 0)
/* Not implemented. */
return 1;
- else if (regno == VR_REGNUM)
+ else if (regno == VR_REGNUM)
/* Read-only. */
return 1;
- else if (regno == BZ_REGNUM || regno == WZ_REGNUM || regno == DZ_REGNUM)
+ else if (regno == BZ_REGNUM || regno == WZ_REGNUM || regno == DZ_REGNUM)
/* Writing has no effect. */
return 1;
/* Many special registers are read-only in user mode. Let the debug
agent decide whether they are writable. */
-
+
return 0;
}
@@ -1556,20 +1529,19 @@ cris_register_type (struct gdbarch *gdbarch, int regno)
{
if (regno == gdbarch_pc_regnum (gdbarch))
return builtin_type (gdbarch)->builtin_func_ptr;
- else if (regno == gdbarch_sp_regnum (gdbarch)
- || regno == CRIS_FP_REGNUM)
+ else if (regno == gdbarch_sp_regnum (gdbarch) || regno == CRIS_FP_REGNUM)
return builtin_type (gdbarch)->builtin_data_ptr;
else if ((regno >= 0 && regno < gdbarch_sp_regnum (gdbarch))
|| (regno >= MOF_REGNUM && regno <= USP_REGNUM))
/* Note: R8 taken care of previous clause. */
return builtin_type (gdbarch)->builtin_uint32;
else if (regno >= P4_REGNUM && regno <= CCR_REGNUM)
- return builtin_type (gdbarch)->builtin_uint16;
+ return builtin_type (gdbarch)->builtin_uint16;
else if (regno >= P0_REGNUM && regno <= VR_REGNUM)
- return builtin_type (gdbarch)->builtin_uint8;
+ return builtin_type (gdbarch)->builtin_uint8;
else
- /* Invalid (unimplemented) register. */
- return builtin_type (gdbarch)->builtin_int0;
+ /* Invalid (unimplemented) register. */
+ return builtin_type (gdbarch)->builtin_int0;
}
static struct type *
@@ -1577,8 +1549,7 @@ crisv32_register_type (struct gdbarch *gdbarch, int regno)
{
if (regno == gdbarch_pc_regnum (gdbarch))
return builtin_type (gdbarch)->builtin_func_ptr;
- else if (regno == gdbarch_sp_regnum (gdbarch)
- || regno == CRIS_FP_REGNUM)
+ else if (regno == gdbarch_sp_regnum (gdbarch) || regno == CRIS_FP_REGNUM)
return builtin_type (gdbarch)->builtin_data_ptr;
else if ((regno >= 0 && regno <= ACR_REGNUM)
|| (regno >= EXS_REGNUM && regno <= SPC_REGNUM)
@@ -1587,14 +1558,14 @@ crisv32_register_type (struct gdbarch *gdbarch, int regno)
/* Note: R8 and SP taken care of by previous clause. */
return builtin_type (gdbarch)->builtin_uint32;
else if (regno == WZ_REGNUM)
- return builtin_type (gdbarch)->builtin_uint16;
+ return builtin_type (gdbarch)->builtin_uint16;
else if (regno == BZ_REGNUM || regno == VR_REGNUM || regno == SRS_REGNUM)
- return builtin_type (gdbarch)->builtin_uint8;
+ return builtin_type (gdbarch)->builtin_uint8;
else
{
/* Invalid (unimplemented) register. Should not happen as there are
no unimplemented CRISv32 registers. */
- warning (_("crisv32_register_type: unknown regno %d"), regno);
+ warning (_ ("crisv32_register_type: unknown regno %d"), regno);
return builtin_type (gdbarch)->builtin_int0;
}
}
@@ -1612,7 +1583,7 @@ cris_store_return_value (struct type *type, struct regcache *regcache,
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
ULONGEST val;
int len = type->length ();
-
+
if (len <= 4)
{
/* Put the return value in R10. */
@@ -1628,7 +1599,7 @@ cris_store_return_value (struct type *type, struct regcache *regcache,
regcache_cooked_write_unsigned (regcache, ARG2_REGNUM, val);
}
else
- error (_("cris_store_return_value: type length too large."));
+ error (_ ("cris_store_return_value: type length too large."));
}
/* Return the name of register regno as a string. Return NULL for an
@@ -1643,12 +1614,12 @@ cris_special_register_name (struct gdbarch *gdbarch, int regno)
/* Special register (R16 - R31). cris_spec_regs is zero-based.
Adjust regno accordingly. */
spec_regno = regno - NUM_GENREGS;
-
+
/* Assume nothing about the layout of the cris_spec_regs struct
when searching. */
for (i = 0; cris_spec_regs[i].name != NULL; i++)
{
- if (cris_spec_regs[i].number == spec_regno
+ if (cris_spec_regs[i].number == spec_regno
&& cris_spec_reg_applicable (gdbarch, cris_spec_regs[i]))
/* Go with the first applicable register. */
return cris_spec_regs[i].name;
@@ -1660,11 +1631,9 @@ cris_special_register_name (struct gdbarch *gdbarch, int regno)
static const char *
cris_register_name (struct gdbarch *gdbarch, int regno)
{
- static const char *cris_genreg_names[] =
- { "r0", "r1", "r2", "r3", \
- "r4", "r5", "r6", "r7", \
- "r8", "r9", "r10", "r11", \
- "r12", "r13", "sp", "pc" };
+ static const char *cris_genreg_names[]
+ = { "r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7",
+ "r8", "r9", "r10", "r11", "r12", "r13", "sp", "pc" };
if (regno < NUM_GENREGS)
{
@@ -1686,19 +1655,13 @@ cris_register_name (struct gdbarch *gdbarch, int regno)
static const char *
crisv32_register_name (struct gdbarch *gdbarch, int regno)
{
- static const char *crisv32_genreg_names[] =
- { "r0", "r1", "r2", "r3", \
- "r4", "r5", "r6", "r7", \
- "r8", "r9", "r10", "r11", \
- "r12", "r13", "sp", "acr"
- };
+ static const char *crisv32_genreg_names[]
+ = { "r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7",
+ "r8", "r9", "r10", "r11", "r12", "r13", "sp", "acr" };
- static const char *crisv32_sreg_names[] =
- { "s0", "s1", "s2", "s3", \
- "s4", "s5", "s6", "s7", \
- "s8", "s9", "s10", "s11", \
- "s12", "s13", "s14", "s15"
- };
+ static const char *crisv32_sreg_names[]
+ = { "s0", "s1", "s2", "s3", "s4", "s5", "s6", "s7",
+ "s8", "s9", "s10", "s11", "s12", "s13", "s14", "s15" };
if (regno >= 0 && regno < NUM_GENREGS)
{
@@ -1733,16 +1696,9 @@ cris_dwarf2_reg_to_regnum (struct gdbarch *gdbarch, int reg)
/* We need to re-map a couple of registers (SRP is 16 in Dwarf-2 register
numbering, MOF is 18).
Adapted from gcc/config/cris/cris.h. */
- static int cris_dwarf_regmap[] = {
- 0, 1, 2, 3,
- 4, 5, 6, 7,
- 8, 9, 10, 11,
- 12, 13, 14, 15,
- 27, -1, -1, -1,
- -1, -1, -1, 23,
- -1, -1, -1, 27,
- -1, -1, -1, -1
- };
+ static int cris_dwarf_regmap[]
+ = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
+ 27, -1, -1, -1, -1, -1, -1, 23, -1, -1, -1, 27, -1, -1, -1, -1 };
int regnum = -1;
if (reg >= 0 && reg < ARRAY_SIZE (cris_dwarf_regmap))
@@ -1781,7 +1737,7 @@ cris_extract_return_value (struct type *type, struct regcache *regcache,
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
ULONGEST val;
int len = type->length ();
-
+
if (len <= 4)
{
/* Get the return value from R10. */
@@ -1797,7 +1753,7 @@ cris_extract_return_value (struct type *type, struct regcache *regcache,
store_unsigned_integer (valbuf + 4, len - 4, byte_order, val);
}
else
- error (_("cris_extract_return_value: type length too large"));
+ error (_ ("cris_extract_return_value: type length too large"));
}
/* Handle the CRIS return value convention. */
@@ -1807,8 +1763,7 @@ cris_return_value (struct gdbarch *gdbarch, struct value *function,
struct type *type, struct regcache *regcache,
gdb_byte *readbuf, const gdb_byte *writebuf)
{
- if (type->code () == TYPE_CODE_STRUCT
- || type->code () == TYPE_CODE_UNION
+ if (type->code () == TYPE_CODE_STRUCT || type->code () == TYPE_CODE_UNION
|| type->length () > 8)
/* Structs, unions, and anything larger than 8 bytes (2 registers)
goes on the stack. */
@@ -1826,8 +1781,7 @@ cris_return_value (struct gdbarch *gdbarch, struct value *function,
instruction. It stems from cris_constraint, found in cris-dis.c. */
static int
-constraint (unsigned int insn, const char *inst_args,
- inst_env_type *inst_env)
+constraint (unsigned int insn, const char *inst_args, inst_env_type *inst_env)
{
int retval = 0;
int tmp, i;
@@ -1835,13 +1789,13 @@ constraint (unsigned int insn, const char *inst_args,
const gdb_byte *s = (const gdb_byte *) inst_args;
for (; *s; s++)
- switch (*s)
+ switch (*s)
{
case 'm':
if ((insn & 0x30) == 0x30)
return -1;
break;
-
+
case 'S':
/* A prefix operand. */
if (inst_env->prefix_found)
@@ -1861,7 +1815,7 @@ constraint (unsigned int insn, const char *inst_args,
retval = (((insn >> 0xC) & 0xF) == (insn & 0xF));
if (!retval)
return -1;
- else
+ else
retval += 4;
break;
@@ -1889,7 +1843,7 @@ constraint (unsigned int insn, const char *inst_args,
break;
}
}
-
+
if (cris_spec_regs[i].name == NULL)
return -1;
break;
@@ -1903,7 +1857,7 @@ static int
number_of_bits (unsigned int value)
{
int number_of_bits = 0;
-
+
while (value != 0)
{
number_of_bits += 1;
@@ -1925,7 +1879,7 @@ find_cris_op (unsigned short insn, inst_env_type *inst_env)
for (i = 0; cris_opcodes[i].name != NULL; i++)
{
- if (((cris_opcodes[i].match & insn) == cris_opcodes[i].match)
+ if (((cris_opcodes[i].match & insn) == cris_opcodes[i].match)
&& ((cris_opcodes[i].lose & insn) == 0)
/* Only CRISv10 instructions, please. */
&& (cris_opcodes[i].applicable_version != cris_ver_v32p))
@@ -1933,8 +1887,8 @@ find_cris_op (unsigned short insn, inst_env_type *inst_env)
level_of_match = constraint (insn, cris_opcodes[i].args, inst_env);
if (level_of_match >= 0)
{
- level_of_match +=
- number_of_bits (cris_opcodes[i].match | cris_opcodes[i].lose);
+ level_of_match += number_of_bits (cris_opcodes[i].match
+ | cris_opcodes[i].lose);
if (level_of_match > max_level_of_match)
{
max_matched = i;
@@ -1966,14 +1920,14 @@ find_step_target (struct regcache *regcache, inst_env_type *inst_env)
/* Create a local register image and set the initial state. */
for (i = 0; i < NUM_GENREGS; i++)
{
- inst_env->reg[i] =
- (unsigned long) regcache_raw_get_unsigned (regcache, i);
+ inst_env->reg[i]
+ = (unsigned long) regcache_raw_get_unsigned (regcache, i);
}
offset = NUM_GENREGS;
for (i = 0; i < NUM_SPECREGS; i++)
{
- inst_env->preg[i] =
- (unsigned long) regcache_raw_get_unsigned (regcache, offset + i);
+ inst_env->preg[i]
+ = (unsigned long) regcache_raw_get_unsigned (regcache, offset + i);
}
inst_env->branch_found = 0;
inst_env->slot_needed = 0;
@@ -1988,8 +1942,8 @@ find_step_target (struct regcache *regcache, inst_env_type *inst_env)
do
{
/* Read an instruction from the client. */
- insn = read_memory_unsigned_integer
- (inst_env->reg[gdbarch_pc_regnum (gdbarch)], 2, byte_order);
+ insn = read_memory_unsigned_integer (
+ inst_env->reg[gdbarch_pc_regnum (gdbarch)], 2, byte_order);
/* If the instruction is not in a delay slot the new content of the
PC is [PC] + 2. If the instruction is in a delay slot it is not
@@ -2003,8 +1957,7 @@ find_step_target (struct regcache *regcache, inst_env_type *inst_env)
else
{
inst_env->delay_slot_pc_active = 0;
- inst_env->reg[gdbarch_pc_regnum (gdbarch)]
- = inst_env->delay_slot_pc;
+ inst_env->reg[gdbarch_pc_regnum (gdbarch)] = inst_env->delay_slot_pc;
}
/* Analyse the present instruction. */
i = find_cris_op (insn, inst_env);
@@ -2016,9 +1969,10 @@ find_step_target (struct regcache *regcache, inst_env_type *inst_env)
{
cris_gdb_func (gdbarch, cris_opcodes[i].op, insn, inst_env);
}
- } while (!inst_env->invalid
- && (inst_env->prefix_found || inst_env->xflag_found
- || inst_env->slot_needed));
+ }
+ while (!inst_env->invalid
+ && (inst_env->prefix_found || inst_env->xflag_found
+ || inst_env->slot_needed));
return i;
}
@@ -2040,7 +1994,7 @@ cris_software_single_step (struct regcache *regcache)
{
/* Could not find a target. Things are likely to go downhill
from here. */
- warning (_("CRIS software single step could not find a step target."));
+ warning (_ ("CRIS software single step could not find a step target."));
}
else
{
@@ -2050,11 +2004,11 @@ cris_software_single_step (struct regcache *regcache)
= (CORE_ADDR) inst_env.reg[gdbarch_pc_regnum (gdbarch)];
next_pcs.push_back (next_pc);
- if (inst_env.branch_found
+ if (inst_env.branch_found
&& (CORE_ADDR) inst_env.branch_break_address != next_pc)
{
CORE_ADDR branch_target_address
- = (CORE_ADDR) inst_env.branch_break_address;
+ = (CORE_ADDR) inst_env.branch_break_address;
next_pcs.push_back (branch_target_address);
}
@@ -2073,9 +2027,9 @@ quick_mode_bdap_prefix (unsigned short inst, inst_env_type *inst_env)
if (inst_env->slot_needed || inst_env->prefix_found)
{
inst_env->invalid = 1;
- return;
+ return;
}
-
+
inst_env->prefix_value = inst_env->reg[cris_get_operand2 (inst)];
inst_env->prefix_value += cris_get_bdap_quick_offset (inst);
@@ -2089,7 +2043,7 @@ quick_mode_bdap_prefix (unsigned short inst, inst_env_type *inst_env)
from the size of the operation. The PC is always kept aligned on even
word addresses. */
-static void
+static void
process_autoincrement (int size, unsigned short inst, inst_env_type *inst_env)
{
if (size == INST_BYTE_SIZE)
@@ -2134,7 +2088,7 @@ bdap_prefix (unsigned short inst, inst_env_type *inst_env)
if (inst_env->slot_needed || inst_env->prefix_found)
{
inst_env->invalid = 1;
- return;
+ return;
}
/* The calculation of prefix_value used to be after process_autoincrement,
@@ -2144,15 +2098,15 @@ bdap_prefix (unsigned short inst, inst_env_type *inst_env)
inst_env->prefix_value = inst_env->reg[cris_get_operand2 (inst)];
/* The offset is an indirection of the contents of the operand1 register. */
- inst_env->prefix_value +=
- get_data_from_address (&inst, inst_env->reg[cris_get_operand1 (inst)],
- inst_env->byte_order);
-
+ inst_env->prefix_value
+ += get_data_from_address (&inst, inst_env->reg[cris_get_operand1 (inst)],
+ inst_env->byte_order);
+
if (cris_get_mode (inst) == AUTOINC_MODE)
{
- process_autoincrement (cris_get_size (inst), inst, inst_env);
+ process_autoincrement (cris_get_size (inst), inst, inst_env);
}
-
+
/* A prefix doesn't change the xflag_found. But the rest of the flags
need updating. */
inst_env->slot_needed = 0;
@@ -2171,14 +2125,14 @@ biap_prefix (unsigned short inst, inst_env_type *inst_env)
inst_env->invalid = 1;
return;
}
-
+
inst_env->prefix_value = inst_env->reg[cris_get_operand1 (inst)];
/* The offset is the operand2 value shifted the size of the instruction
to the left. */
- inst_env->prefix_value +=
- inst_env->reg[cris_get_operand2 (inst)] << cris_get_size (inst);
-
+ inst_env->prefix_value += inst_env->reg[cris_get_operand2 (inst)]
+ << cris_get_size (inst);
+
/* If the PC is operand1 (base) the address used is the address after
the main instruction, i.e. address + 2 (the PC is already compensated
for the prefix operation). */
@@ -2196,10 +2150,9 @@ biap_prefix (unsigned short inst, inst_env_type *inst_env)
/* Calculates the prefix value for the double indirect addressing mode. */
-static void
+static void
dip_prefix (unsigned short inst, inst_env_type *inst_env)
{
-
CORE_ADDR address;
/* It's invalid to be in a delay slot. */
@@ -2208,13 +2161,13 @@ dip_prefix (unsigned short inst, inst_env_type *inst_env)
inst_env->invalid = 1;
return;
}
-
+
/* The prefix value is one dereference of the contents of the operand1
register. */
address = (CORE_ADDR) inst_env->reg[cris_get_operand1 (inst)];
inst_env->prefix_value
= read_memory_unsigned_integer (address, 4, inst_env->byte_order);
-
+
/* Check if the mode is autoincrement. */
if (cris_get_mode (inst) == AUTOINC_MODE)
{
@@ -2233,7 +2186,6 @@ dip_prefix (unsigned short inst, inst_env_type *inst_env)
static void
eight_bit_offset_branch_op (unsigned short inst, inst_env_type *inst_env)
{
-
short offset;
/* If we have a prefix or are in a delay slot it's bad. */
@@ -2242,7 +2194,7 @@ eight_bit_offset_branch_op (unsigned short inst, inst_env_type *inst_env)
inst_env->invalid = 1;
return;
}
-
+
/* We have a branch, find out where the branch will land. */
offset = cris_get_branch_short_offset (inst);
@@ -2251,11 +2203,11 @@ eight_bit_offset_branch_op (unsigned short inst, inst_env_type *inst_env)
{
offset |= 0xFF00;
}
-
+
/* The offset ends with the sign bit, set it to zero. The address
should always be word aligned. */
offset &= ~BRANCH_SIGNED_SHORT_OFFSET_MASK;
-
+
inst_env->branch_found = 1;
inst_env->branch_break_address = inst_env->reg[REG_PC] + offset;
@@ -2267,7 +2219,7 @@ eight_bit_offset_branch_op (unsigned short inst, inst_env_type *inst_env)
/* Finds the destination for a branch with 16-bits offset. */
-static void
+static void
sixteen_bit_offset_branch_op (unsigned short inst, inst_env_type *inst_env)
{
short offset;
@@ -2280,8 +2232,8 @@ sixteen_bit_offset_branch_op (unsigned short inst, inst_env_type *inst_env)
}
/* We have a branch, find out the offset for the branch. */
- offset = read_memory_integer (inst_env->reg[REG_PC], 2,
- inst_env->byte_order);
+ offset
+ = read_memory_integer (inst_env->reg[REG_PC], 2, inst_env->byte_order);
/* The instruction is one word longer than normal, so add one word
to the PC. */
@@ -2290,7 +2242,6 @@ sixteen_bit_offset_branch_op (unsigned short inst, inst_env_type *inst_env)
inst_env->branch_found = 1;
inst_env->branch_break_address = inst_env->reg[REG_PC] + offset;
-
inst_env->slot_needed = 1;
inst_env->prefix_found = 0;
inst_env->xflag_found = 0;
@@ -2299,12 +2250,11 @@ sixteen_bit_offset_branch_op (unsigned short inst, inst_env_type *inst_env)
/* Handles the ABS instruction. */
-static void
+static void
abs_op (unsigned short inst, inst_env_type *inst_env)
{
-
long value;
-
+
/* ABS can't have a prefix, so it's bad if it does. */
if (inst_env->prefix_found)
{
@@ -2315,7 +2265,6 @@ abs_op (unsigned short inst, inst_env_type *inst_env)
/* Check if the operation affects the PC. */
if (cris_get_operand2 (inst) == REG_PC)
{
-
/* It's invalid to change to the PC if we are in a delay slot. */
if (inst_env->slot_needed)
{
@@ -2341,7 +2290,7 @@ abs_op (unsigned short inst, inst_env_type *inst_env)
/* Handles the ADDI instruction. */
-static void
+static void
addi_op (unsigned short inst, inst_env_type *inst_env)
{
/* It's invalid to have the PC as base register. And ADDI can't have
@@ -2360,7 +2309,7 @@ addi_op (unsigned short inst, inst_env_type *inst_env)
/* Handles the ASR instruction. */
-static void
+static void
asr_op (unsigned short inst, inst_env_type *inst_env)
{
int shift_steps;
@@ -2427,7 +2376,7 @@ asr_op (unsigned short inst, inst_env_type *inst_env)
}
value = value >> shift_steps;
value |= signed_extend_mask;
- inst_env->reg[REG_PC] = value;
+ inst_env->reg[REG_PC] = value;
}
}
inst_env->slot_needed = 0;
@@ -2438,14 +2387,13 @@ asr_op (unsigned short inst, inst_env_type *inst_env)
/* Handles the ASRQ instruction. */
-static void
+static void
asrq_op (unsigned short inst, inst_env_type *inst_env)
{
-
int shift_steps;
unsigned long value;
unsigned long signed_extend_mask = 0;
-
+
/* ASRQ can't have a prefix, so check that it doesn't. */
if (inst_env->prefix_found)
{
@@ -2456,7 +2404,6 @@ asrq_op (unsigned short inst, inst_env_type *inst_env)
/* Check if the PC is the target register. */
if (cris_get_operand2 (inst) == REG_PC)
{
-
/* It's invalid to change the PC in a delay slot. */
if (inst_env->slot_needed)
{
@@ -2475,7 +2422,7 @@ asrq_op (unsigned short inst, inst_env_type *inst_env)
}
value = value >> shift_steps;
value |= signed_extend_mask;
- inst_env->reg[REG_PC] = value;
+ inst_env->reg[REG_PC] = value;
}
inst_env->slot_needed = 0;
inst_env->prefix_found = 0;
@@ -2485,7 +2432,7 @@ asrq_op (unsigned short inst, inst_env_type *inst_env)
/* Handles the AX, EI and SETF instruction. */
-static void
+static void
ax_ei_setf_op (unsigned short inst, inst_env_type *inst_env)
{
if (inst_env->prefix_found)
@@ -2511,7 +2458,7 @@ ax_ei_setf_op (unsigned short inst, inst_env_type *inst_env)
register. Note that check_assign assumes that the caller has checked that
there is a prefix to this instruction. The mode check depends on this. */
-static void
+static void
check_assign (unsigned short inst, inst_env_type *inst_env)
{
/* Check if it's an assign addressing mode. */
@@ -2524,7 +2471,7 @@ check_assign (unsigned short inst, inst_env_type *inst_env)
/* Handles the 2-operand BOUND instruction. */
-static void
+static void
two_operand_bound_op (unsigned short inst, inst_env_type *inst_env)
{
/* It's invalid to have the PC as the index operand. */
@@ -2557,7 +2504,7 @@ two_operand_bound_op (unsigned short inst, inst_env_type *inst_env)
/* Handles the 3-operand BOUND instruction. */
-static void
+static void
three_operand_bound_op (unsigned short inst, inst_env_type *inst_env)
{
/* It's an error if we haven't got a prefix. And it's also an error
@@ -2575,7 +2522,7 @@ three_operand_bound_op (unsigned short inst, inst_env_type *inst_env)
/* Clears the status flags in inst_env. */
-static void
+static void
btst_nop_op (unsigned short inst, inst_env_type *inst_env)
{
/* It's an error if we have got a prefix. */
@@ -2593,7 +2540,7 @@ btst_nop_op (unsigned short inst, inst_env_type *inst_env)
/* Clears the status flags in inst_env. */
-static void
+static void
clearf_di_op (unsigned short inst, inst_env_type *inst_env)
{
/* It's an error if we have got a prefix. */
@@ -2611,7 +2558,7 @@ clearf_di_op (unsigned short inst, inst_env_type *inst_env)
/* Handles the CLEAR instruction if it's in register mode. */
-static void
+static void
reg_mode_clear_op (unsigned short inst, inst_env_type *inst_env)
{
/* Check if the target is the PC. */
@@ -2661,13 +2608,12 @@ reg_mode_test_op (unsigned short inst, inst_env_type *inst_env)
inst_env->prefix_found = 0;
inst_env->xflag_found = 0;
inst_env->disable_interrupt = 0;
-
}
/* Handles the CLEAR and TEST instruction if the instruction isn't
in register mode. */
-static void
+static void
none_reg_mode_clear_test_op (unsigned short inst, inst_env_type *inst_env)
{
/* Check if we are in a prefix mode. */
@@ -2692,7 +2638,7 @@ none_reg_mode_clear_test_op (unsigned short inst, inst_env_type *inst_env)
/* Checks that the PC isn't the destination register or the instructions has
a prefix. */
-static void
+static void
dstep_logshift_mstep_neg_not_op (unsigned short inst, inst_env_type *inst_env)
{
/* It's invalid to have the PC as the destination. The instruction can't
@@ -2749,7 +2695,7 @@ scc_op (unsigned short inst, inst_env_type *inst_env)
/* Handles the register mode JUMP instruction. */
-static void
+static void
reg_mode_jump_op (unsigned short inst, inst_env_type *inst_env)
{
/* It's invalid to do a JUMP in a delay slot. The mode is register, so
@@ -2759,7 +2705,7 @@ reg_mode_jump_op (unsigned short inst, inst_env_type *inst_env)
inst_env->invalid = 1;
return;
}
-
+
/* Just change the PC. */
inst_env->reg[REG_PC] = inst_env->reg[cris_get_operand1 (inst)];
inst_env->slot_needed = 0;
@@ -2789,16 +2735,16 @@ none_reg_mode_jump_op (unsigned short inst, inst_env_type *inst_env)
check_assign (inst, inst_env);
/* Get the new value for the PC. */
- newpc =
- read_memory_unsigned_integer ((CORE_ADDR) inst_env->prefix_value,
- 4, inst_env->byte_order);
+ newpc
+ = read_memory_unsigned_integer ((CORE_ADDR) inst_env->prefix_value,
+ 4, inst_env->byte_order);
}
else
{
/* Get the new value for the PC. */
address = (CORE_ADDR) inst_env->reg[cris_get_operand1 (inst)];
- newpc = read_memory_unsigned_integer (address,
- 4, inst_env->byte_order);
+ newpc
+ = read_memory_unsigned_integer (address, 4, inst_env->byte_order);
/* Check if we should increment a register. */
if (cris_get_mode (inst) == AUTOINC_MODE)
@@ -2816,7 +2762,7 @@ none_reg_mode_jump_op (unsigned short inst, inst_env_type *inst_env)
/* Handles moves to special registers (aka P-register) for all modes. */
-static void
+static void
move_to_preg_op (struct gdbarch *gdbarch, unsigned short inst,
inst_env_type *inst_env)
{
@@ -2872,7 +2818,7 @@ move_to_preg_op (struct gdbarch *gdbarch, unsigned short inst,
/* Handles moves from special registers (aka P-register) for all modes
except register. */
-static void
+static void
none_reg_mode_move_from_preg_op (struct gdbarch *gdbarch, unsigned short inst,
inst_env_type *inst_env)
{
@@ -2889,7 +2835,7 @@ none_reg_mode_move_from_preg_op (struct gdbarch *gdbarch, unsigned short inst,
check_assign (inst, inst_env);
}
}
- }
+ }
/* The instruction doesn't have a prefix, the only case left that we
are interested in is the autoincrement mode. */
else if (cris_get_mode (inst) == AUTOINC_MODE)
@@ -2903,7 +2849,7 @@ none_reg_mode_move_from_preg_op (struct gdbarch *gdbarch, unsigned short inst,
inst_env->invalid = 1;
return;
}
-
+
/* The increment depends on the size of the special register. */
if (cris_register_size (gdbarch, cris_get_operand2 (inst)) == 1)
{
@@ -2928,7 +2874,7 @@ none_reg_mode_move_from_preg_op (struct gdbarch *gdbarch, unsigned short inst,
/* Handles moves from special registers (aka P-register) when the mode
is register. */
-static void
+static void
reg_mode_move_from_preg_op (unsigned short inst, inst_env_type *inst_env)
{
/* Register mode move from special register can't have a prefix. */
@@ -2963,7 +2909,7 @@ reg_mode_move_from_preg_op (unsigned short inst, inst_env_type *inst_env)
/* Handles the MOVEM from memory to general register instruction. */
-static void
+static void
move_mem_to_reg_movem_op (unsigned short inst, inst_env_type *inst_env)
{
if (inst_env->prefix_found)
@@ -2972,13 +2918,13 @@ move_mem_to_reg_movem_op (unsigned short inst, inst_env_type *inst_env)
MOVEM instruction going to change the PC? */
if (cris_get_operand2 (inst) >= REG_PC)
{
- inst_env->reg[REG_PC] =
- read_memory_unsigned_integer (inst_env->prefix_value,
- 4, inst_env->byte_order);
+ inst_env->reg[REG_PC]
+ = read_memory_unsigned_integer (inst_env->prefix_value, 4,
+ inst_env->byte_order);
}
/* The assign value is the value after the increment. Normally, the
assign value is the value before the increment. */
- if ((cris_get_operand1 (inst) == REG_PC)
+ if ((cris_get_operand1 (inst) == REG_PC)
&& (cris_get_mode (inst) == PREFIX_ASSIGN_MODE))
{
inst_env->reg[REG_PC] = inst_env->prefix_value;
@@ -2996,9 +2942,8 @@ move_mem_to_reg_movem_op (unsigned short inst, inst_env_type *inst_env)
inst_env->invalid = 1;
return;
}
- inst_env->reg[REG_PC] =
- read_memory_unsigned_integer (inst_env->reg[cris_get_operand1 (inst)],
- 4, inst_env->byte_order);
+ inst_env->reg[REG_PC] = read_memory_unsigned_integer (
+ inst_env->reg[cris_get_operand1 (inst)], 4, inst_env->byte_order);
}
/* The increment is not depending on the size, instead it's depending
on the number of registers loaded from memory. */
@@ -3011,7 +2956,7 @@ move_mem_to_reg_movem_op (unsigned short inst, inst_env_type *inst_env)
inst_env->invalid = 1;
return;
}
- inst_env->reg[REG_PC] += 4 * (cris_get_operand2 (inst) + 1);
+ inst_env->reg[REG_PC] += 4 * (cris_get_operand2 (inst) + 1);
}
}
inst_env->slot_needed = 0;
@@ -3022,7 +2967,7 @@ move_mem_to_reg_movem_op (unsigned short inst, inst_env_type *inst_env)
/* Handles the MOVEM to memory from general register instruction. */
-static void
+static void
move_reg_to_mem_movem_op (unsigned short inst, inst_env_type *inst_env)
{
if (inst_env->prefix_found)
@@ -3062,7 +3007,7 @@ move_reg_to_mem_movem_op (unsigned short inst, inst_env_type *inst_env)
/* Handles the instructions that's not yet implemented, by setting
inst_env->invalid to true. */
-static void
+static void
not_implemented_op (unsigned short inst, inst_env_type *inst_env)
{
inst_env->invalid = 1;
@@ -3070,7 +3015,7 @@ not_implemented_op (unsigned short inst, inst_env_type *inst_env)
/* Handles the XOR instruction. */
-static void
+static void
xor_op (unsigned short inst, inst_env_type *inst_env)
{
/* XOR can't have a prefix. */
@@ -3099,7 +3044,7 @@ xor_op (unsigned short inst, inst_env_type *inst_env)
/* Handles the MULS instruction. */
-static void
+static void
muls_op (unsigned short inst, inst_env_type *inst_env)
{
/* MULS/U can't have a prefix. */
@@ -3123,7 +3068,7 @@ muls_op (unsigned short inst, inst_env_type *inst_env)
/* Handles the MULU instruction. */
-static void
+static void
mulu_op (unsigned short inst, inst_env_type *inst_env)
{
/* MULS/U can't have a prefix. */
@@ -3148,17 +3093,17 @@ mulu_op (unsigned short inst, inst_env_type *inst_env)
/* Calculate the result of the instruction for ADD, SUB, CMP AND, OR and MOVE.
The MOVE instruction is the move from source to register. */
-static void
-add_sub_cmp_and_or_move_action (unsigned short inst, inst_env_type *inst_env,
+static void
+add_sub_cmp_and_or_move_action (unsigned short inst, inst_env_type *inst_env,
unsigned long source1, unsigned long source2)
{
unsigned long pc_mask;
unsigned long operation_mask;
-
+
/* Find out how many bits the operation should apply to. */
if (cris_get_size (inst) == INST_BYTE_SIZE)
{
- pc_mask = 0xFFFFFF00;
+ pc_mask = 0xFFFFFF00;
operation_mask = 0xFF;
}
else if (cris_get_size (inst) == INST_WORD_SIZE)
@@ -3186,26 +3131,26 @@ add_sub_cmp_and_or_move_action (unsigned short inst, inst_env_type *inst_env,
the different actions. */
switch (cris_get_opcode (inst) & 7)
{
- case 0: /* add */
+ case 0: /* add */
source1 += source2;
break;
- case 1: /* move */
+ case 1: /* move */
source1 = source2;
break;
- case 2: /* subtract */
+ case 2: /* subtract */
source1 -= source2;
break;
- case 3: /* compare */
+ case 3: /* compare */
break;
- case 4: /* and */
+ case 4: /* and */
source1 &= source2;
break;
- case 5: /* or */
+ case 5: /* or */
source1 |= source2;
break;
@@ -3223,14 +3168,13 @@ add_sub_cmp_and_or_move_action (unsigned short inst, inst_env_type *inst_env,
/* Calculate the new breakpoint address. */
inst_env->reg[REG_PC] &= pc_mask;
inst_env->reg[REG_PC] |= source1;
-
}
/* Extends the value from either byte or word size to a dword. If the mode
is zero extend then the value is extended with zero. If instead the mode
is signed extend the sign bit of the value is taken into consideration. */
-static unsigned long
+static unsigned long
do_sign_or_zero_extend (unsigned long value, unsigned short *inst)
{
/* The size can be either byte or word, check which one it is.
@@ -3246,7 +3190,7 @@ do_sign_or_zero_extend (unsigned long value, unsigned short *inst)
if (cris_is_signed_extend_bit_on (*inst) && (value & SIGNED_WORD_MASK))
{
value |= SIGNED_WORD_EXTEND_MASK;
- }
+ }
}
else
{
@@ -3268,7 +3212,7 @@ do_sign_or_zero_extend (unsigned long value, unsigned short *inst)
/* Handles the register mode for the ADD, SUB, CMP, AND, OR and MOVE
instruction. The MOVE instruction is the move from source to register. */
-static void
+static void
reg_mode_add_sub_cmp_and_or_move_op (unsigned short inst,
inst_env_type *inst_env)
{
@@ -3291,7 +3235,7 @@ reg_mode_add_sub_cmp_and_or_move_op (unsigned short inst,
return;
}
/* The instruction has the PC as its target register. */
- operand1 = inst_env->reg[cris_get_operand1 (inst)];
+ operand1 = inst_env->reg[cris_get_operand1 (inst)];
operand2 = inst_env->reg[REG_PC];
/* Check if it's a extend, signed or zero instruction. */
@@ -3301,7 +3245,7 @@ reg_mode_add_sub_cmp_and_or_move_op (unsigned short inst,
}
/* Calculate the PC value after the instruction, i.e. where the
breakpoint should be. The order of the udw_operands is vital. */
- add_sub_cmp_and_or_move_action (inst, inst_env, operand2, operand1);
+ add_sub_cmp_and_or_move_action (inst, inst_env, operand2, operand1);
}
inst_env->slot_needed = 0;
inst_env->prefix_found = 0;
@@ -3313,7 +3257,7 @@ reg_mode_add_sub_cmp_and_or_move_op (unsigned short inst,
the size of the operation. If the instruction is a zero or signed
extend instruction, the size field is changed in instruction. */
-static unsigned long
+static unsigned long
get_data_from_address (unsigned short *inst, CORE_ADDR address,
enum bfd_endian byte_order)
{
@@ -3342,8 +3286,8 @@ get_data_from_address (unsigned short *inst, CORE_ADDR address,
/* Handles the assign addresing mode for the ADD, SUB, CMP, AND, OR and MOVE
instructions. The MOVE instruction is the move from source to register. */
-static void
-handle_prefix_assign_mode_for_aritm_op (unsigned short inst,
+static void
+handle_prefix_assign_mode_for_aritm_op (unsigned short inst,
inst_env_type *inst_env)
{
unsigned long operand2;
@@ -3372,8 +3316,8 @@ handle_prefix_assign_mode_for_aritm_op (unsigned short inst,
OR instructions. Note that for this to work as expected, the calling
function must have made sure that there is a prefix to this instruction. */
-static void
-three_operand_add_sub_cmp_and_or_op (unsigned short inst,
+static void
+three_operand_add_sub_cmp_and_or_op (unsigned short inst,
inst_env_type *inst_env)
{
unsigned long operand2;
@@ -3401,8 +3345,8 @@ three_operand_add_sub_cmp_and_or_op (unsigned short inst,
/* Handles the index addresing mode for the ADD, SUB, CMP, AND, OR and MOVE
instructions. The MOVE instruction is the move from source to register. */
-static void
-handle_prefix_index_mode_for_aritm_op (unsigned short inst,
+static void
+handle_prefix_index_mode_for_aritm_op (unsigned short inst,
inst_env_type *inst_env)
{
if (cris_get_operand1 (inst) != cris_get_operand2 (inst))
@@ -3429,8 +3373,8 @@ handle_prefix_index_mode_for_aritm_op (unsigned short inst,
CMP, AND OR and MOVE instruction. The MOVE instruction is the move from
source to register. */
-static void
-handle_inc_and_index_mode_for_aritm_op (unsigned short inst,
+static void
+handle_inc_and_index_mode_for_aritm_op (unsigned short inst,
inst_env_type *inst_env)
{
unsigned long operand1;
@@ -3453,7 +3397,7 @@ handle_inc_and_index_mode_for_aritm_op (unsigned short inst,
/* Calculate the PC value after the instruction, i.e. where the
breakpoint should be. The order of the udw_operands is vital. */
- add_sub_cmp_and_or_move_action (inst, inst_env, operand2, operand3);
+ add_sub_cmp_and_or_move_action (inst, inst_env, operand2, operand3);
}
/* If this is an autoincrement addressing mode, check if the increment
changes the PC. */
@@ -3470,7 +3414,7 @@ handle_inc_and_index_mode_for_aritm_op (unsigned short inst,
size &= ~SIGNED_EXTEND_BIT_MASK;
}
process_autoincrement (size, inst, inst_env);
- }
+ }
inst_env->slot_needed = 0;
inst_env->prefix_found = 0;
inst_env->xflag_found = 0;
@@ -3480,8 +3424,8 @@ handle_inc_and_index_mode_for_aritm_op (unsigned short inst,
/* Handles the two-operand addressing mode, all modes except register, for
the ADD, SUB CMP, AND and OR instruction. */
-static void
-none_reg_mode_add_sub_cmp_and_or_move_op (unsigned short inst,
+static void
+none_reg_mode_add_sub_cmp_and_or_move_op (unsigned short inst,
inst_env_type *inst_env)
{
if (inst_env->prefix_found)
@@ -3509,7 +3453,7 @@ none_reg_mode_add_sub_cmp_and_or_move_op (unsigned short inst,
/* Handles the quick addressing mode for the ADD and SUB instruction. */
-static void
+static void
quick_mode_add_sub_op (unsigned short inst, inst_env_type *inst_env)
{
unsigned long operand1;
@@ -3549,7 +3493,7 @@ quick_mode_add_sub_op (unsigned short inst, inst_env_type *inst_env)
/* Handles the quick addressing mode for the CMP, AND and OR instruction. */
-static void
+static void
quick_mode_and_cmp_move_or_op (unsigned short inst, inst_env_type *inst_env)
{
unsigned long operand1;
@@ -3763,18 +3707,18 @@ typedef cris_elf_greg_t crisv32_elf_gregset_t[CRISV32_ELF_NGREG];
/* Unpack a cris_elf_gregset_t into GDB's register cache. */
-static void
+static void
cris_supply_gregset (const struct regset *regset, struct regcache *regcache,
int regnum, const void *gregs, size_t len)
{
struct gdbarch *gdbarch = regcache->arch ();
cris_gdbarch_tdep *tdep = gdbarch_tdep<cris_gdbarch_tdep> (gdbarch);
int i;
- const cris_elf_greg_t *regp = static_cast<const cris_elf_greg_t *>(gregs);
+ const cris_elf_greg_t *regp = static_cast<const cris_elf_greg_t *> (gregs);
if (len != sizeof (cris_elf_gregset_t)
&& len != sizeof (crisv32_elf_gregset_t))
- warning (_("wrong size gregset struct in core file"));
+ warning (_ ("wrong size gregset struct in core file"));
gdb_assert (len >= sizeof (crisv32_elf_gregset_t));
/* The kernel dumps all 32 registers as unsigned longs, but supply_register
@@ -3782,7 +3726,7 @@ cris_supply_gregset (const struct regset *regset, struct regcache *regcache,
for (i = 0; i < NUM_GENREGS + NUM_SPECREGS; i++)
{
if (regnum == -1 || regnum == i)
- regcache->raw_supply (i, (char *)&regp[i]);
+ regcache->raw_supply (i, (char *) &regp[i]);
}
if (tdep->cris_version == 32 && (regnum == -1 || regnum == ERP_REGNUM))
@@ -3791,43 +3735,42 @@ cris_supply_gregset (const struct regset *regset, struct regcache *regcache,
/* FIXME: If ERP is in a delay slot at this point then the PC will
be wrong. Issue a warning to alert the user. */
regcache->raw_supply (gdbarch_pc_regnum (gdbarch),
- (char *)&regp[ERP_REGNUM]);
+ (char *) &regp[ERP_REGNUM]);
- if (*(char *)&regp[ERP_REGNUM] & 0x1)
+ if (*(char *) &regp[ERP_REGNUM] & 0x1)
gdb_printf (gdb_stderr, "Warning: PC in delay slot\n");
}
}
static const struct regset cris_regset = {
- nullptr,
- cris_supply_gregset,
+ nullptr, cris_supply_gregset,
/* We don't need a collect function because we only use this for core files
(via iterate_over_regset_sections). */
- nullptr,
- REGSET_VARIABLE_SIZE
+ nullptr, REGSET_VARIABLE_SIZE
};
-static void cris_iterate_over_regset_sections (struct gdbarch *gdbarch,
- iterate_over_regset_sections_cb *cb,
- void *cb_data,
- const struct regcache *regcache)
+static void
+cris_iterate_over_regset_sections (struct gdbarch *gdbarch,
+ iterate_over_regset_sections_cb *cb,
+ void *cb_data,
+ const struct regcache *regcache)
{
cb (".reg", sizeof (crisv32_elf_gregset_t), sizeof (crisv32_elf_gregset_t),
&cris_regset, NULL, cb_data);
}
void _initialize_cris_tdep ();
+
void
_initialize_cris_tdep ()
{
gdbarch_register (bfd_arch_cris, cris_gdbarch_init, cris_dump_tdep);
-
+
/* CRIS-specific user-commands. */
add_setshow_zuinteger_cmd ("cris-version", class_support,
&usr_cmd_cris_version,
- _("Set the current CRIS version."),
- _("Show the current CRIS version."),
- _("\
+ _ ("Set the current CRIS version."),
+ _ ("Show the current CRIS version."), _ ("\
Set to 10 for CRISv10 or 32 for CRISv32 if autodetection fails.\n\
Defaults to 10. "),
set_cris_version,
@@ -3835,22 +3778,20 @@ Defaults to 10. "),
is %s. */
&setlist, &showlist);
- add_setshow_enum_cmd ("cris-mode", class_support,
- cris_modes, &usr_cmd_cris_mode,
- _("Set the current CRIS mode."),
- _("Show the current CRIS mode."),
- _("\
+ add_setshow_enum_cmd ("cris-mode", class_support, cris_modes,
+ &usr_cmd_cris_mode, _ ("Set the current CRIS mode."),
+ _ ("Show the current CRIS mode."), _ ("\
Set to CRIS_MODE_GURU when debugging in guru mode.\n\
Makes GDB use the NRP register instead of the ERP register in certain cases."),
set_cris_mode,
NULL, /* FIXME: i18n: Current CRIS version is %s. */
&setlist, &showlist);
-
+
add_setshow_boolean_cmd ("cris-dwarf2-cfi", class_support,
&usr_cmd_cris_dwarf2_cfi,
- _("Set the usage of Dwarf-2 CFI for CRIS."),
- _("Show the usage of Dwarf-2 CFI for CRIS."),
- _("Set this to \"off\" if using gcc-cris < R59."),
+ _ ("Set the usage of Dwarf-2 CFI for CRIS."),
+ _ ("Show the usage of Dwarf-2 CFI for CRIS."),
+ _ ("Set this to \"off\" if using gcc-cris < R59."),
set_cris_dwarf2_cfi,
NULL, /* FIXME: i18n: Usage of Dwarf-2 CFI
for CRIS is %d. */
@@ -3875,20 +3816,20 @@ cris_dump_tdep (struct gdbarch *gdbarch, struct ui_file *file)
}
static void
-set_cris_version (const char *ignore_args, int from_tty,
+set_cris_version (const char *ignore_args, int from_tty,
struct cmd_list_element *c)
{
struct gdbarch_info info;
usr_cmd_cris_version_valid = 1;
-
+
/* Update the current architecture, if needed. */
if (!gdbarch_update_p (info))
- internal_error (_("cris_gdbarch_update: failed to update architecture."));
+ internal_error (_ ("cris_gdbarch_update: failed to update architecture."));
}
static void
-set_cris_mode (const char *ignore_args, int from_tty,
+set_cris_mode (const char *ignore_args, int from_tty,
struct cmd_list_element *c)
{
struct gdbarch_info info;
@@ -3899,14 +3840,14 @@ set_cris_mode (const char *ignore_args, int from_tty,
}
static void
-set_cris_dwarf2_cfi (const char *ignore_args, int from_tty,
+set_cris_dwarf2_cfi (const char *ignore_args, int from_tty,
struct cmd_list_element *c)
{
struct gdbarch_info info;
/* Update the current architecture, if needed. */
if (!gdbarch_update_p (info))
- internal_error (_("cris_gdbarch_update: failed to update architecture."));
+ internal_error (_ ("cris_gdbarch_update: failed to update architecture."));
}
static struct gdbarch *
@@ -3916,7 +3857,7 @@ cris_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
if (usr_cmd_cris_version_valid)
{
- /* Trust the user's CRIS version setting. */
+ /* Trust the user's CRIS version setting. */
cris_version = usr_cmd_cris_version;
}
else if (info.abfd && bfd_get_mach (info.abfd) == bfd_mach_cris_v32)
@@ -3931,10 +3872,9 @@ cris_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
/* Make the current settings visible to the user. */
usr_cmd_cris_version = cris_version;
-
+
/* Find a candidate among the list of pre-declared architectures. */
- for (arches = gdbarch_list_lookup_by_info (arches, &info);
- arches != NULL;
+ for (arches = gdbarch_list_lookup_by_info (arches, &info); arches != NULL;
arches = gdbarch_list_lookup_by_info (arches->next, &info))
{
cris_gdbarch_tdep *tdep
@@ -3958,7 +3898,7 @@ cris_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
set_gdbarch_return_value (gdbarch, cris_return_value);
set_gdbarch_sp_regnum (gdbarch, 14);
-
+
/* Length of ordinary registers used in push_word and a few other
places. register_size() is the real way to know how big a
register is. */
@@ -3984,7 +3924,7 @@ cris_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
return 0;
case 10:
- case 11:
+ case 11:
/* CRIS v10 and v11, a.k.a. ETRAX 100LX. In addition to ETRAX 100,
P7 (32 bits), and P15 (32 bits) have been implemented. */
set_gdbarch_pc_regnum (gdbarch, 15);
@@ -4008,15 +3948,15 @@ cris_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
set_gdbarch_num_regs (gdbarch, 32 + 1 + 16);
set_gdbarch_register_name (gdbarch, crisv32_register_name);
- set_gdbarch_cannot_store_register
- (gdbarch, crisv32_cannot_store_register);
- set_gdbarch_cannot_fetch_register
- (gdbarch, crisv32_cannot_fetch_register);
+ set_gdbarch_cannot_store_register (gdbarch,
+ crisv32_cannot_store_register);
+ set_gdbarch_cannot_fetch_register (gdbarch,
+ crisv32_cannot_fetch_register);
set_gdbarch_have_nonsteppable_watchpoint (gdbarch, 1);
- set_gdbarch_single_step_through_delay
- (gdbarch, crisv32_single_step_through_delay);
+ set_gdbarch_single_step_through_delay (
+ gdbarch, crisv32_single_step_through_delay);
break;
@@ -4031,14 +3971,15 @@ cris_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
set_gdbarch_push_dummy_call (gdbarch, cris_push_dummy_call);
set_gdbarch_frame_align (gdbarch, cris_frame_align);
set_gdbarch_skip_prologue (gdbarch, cris_skip_prologue);
-
+
/* The stack grows downward. */
set_gdbarch_inner_than (gdbarch, core_addr_lessthan);
set_gdbarch_breakpoint_kind_from_pc (gdbarch, cris_breakpoint_kind_from_pc);
set_gdbarch_sw_breakpoint_from_kind (gdbarch, cris_sw_breakpoint_from_kind);
- set_gdbarch_iterate_over_regset_sections (gdbarch, cris_iterate_over_regset_sections);
-
+ set_gdbarch_iterate_over_regset_sections (gdbarch,
+ cris_iterate_over_regset_sections);
+
if (tdep->cris_dwarf2_cfi == 1)
{
/* Hook in the Dwarf-2 frame sniffer. */
diff --git a/gdb/csky-linux-tdep.c b/gdb/csky-linux-tdep.c
index b34e2082bfc..8b660cc2c53 100644
--- a/gdb/csky-linux-tdep.c
+++ b/gdb/csky-linux-tdep.c
@@ -33,45 +33,36 @@
/* Functions, definitions, and data structures for C-Sky core file debug. */
/* General regset pc, r1, r0, psr, r2-r31 for CK810. */
-#define SIZEOF_CSKY_GREGSET 34*4
+#define SIZEOF_CSKY_GREGSET 34 * 4
/* Float regset fesr fsr fr0-fr31 for CK810. */
-#define SIZEOF_CSKY_FREGSET 34*4
+#define SIZEOF_CSKY_FREGSET 34 * 4
/* Float regset vr0~vr15 fr15~fr31, reserved for CK810 when kernel 4.x. */
-#define SIZEOF_CSKY_FREGSET_K4X 400
+#define SIZEOF_CSKY_FREGSET_K4X 400
/* Offset mapping table from core_section to regcache of general
registers for ck810. */
-static const int csky_gregset_offset[] =
-{
- 72, 1, 0, 89, 2, /* pc, r1, r0, psr, r2. */
- 3, 4, 5, 6, 7, /* r3 ~ r32. */
- 8, 9, 10, 11, 12,
- 13, 14, 15, 16, 17,
- 18, 19, 20, 21, 22,
- 23, 24, 25, 26, 27,
- 28, 29, 30, 31
-};
+static const int csky_gregset_offset[]
+ = { 72, 1, 0, 89, 2, /* pc, r1, r0, psr, r2. */
+ 3, 4, 5, 6, 7, /* r3 ~ r32. */
+ 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19,
+ 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31 };
/* Offset mapping table from core_section to regcache of float
registers for ck810. */
-static const int csky_fregset_offset[] =
-{
- 122, 123, 40, 41, 42, /* fcr, fesr, fr0 ~ fr2. */
- 43, 44, 45, 46, 47, /* fr3 ~ fr15. */
- 48, 49, 50, 51, 52,
- 53, 54, 55
-};
+static const int csky_fregset_offset[]
+ = { 122, 123, 40, 41, 42, /* fcr, fesr, fr0 ~ fr2. */
+ 43, 44, 45, 46, 47, /* fr3 ~ fr15. */
+ 48, 49, 50, 51, 52, 53, 54, 55 };
/* Implement the supply_regset hook for GP registers in core files. */
static void
-csky_supply_gregset (const struct regset *regset,
- struct regcache *regcache, int regnum,
- const void *regs, size_t len)
+csky_supply_gregset (const struct regset *regset, struct regcache *regcache,
+ int regnum, const void *regs, size_t len)
{
int i, gregset_num;
- const gdb_byte *gregs = (const gdb_byte *) regs ;
+ const gdb_byte *gregs = (const gdb_byte *) regs;
gdb_assert (len >= SIZEOF_CSKY_GREGSET);
gregset_num = ARRAY_SIZE (csky_gregset_offset);
@@ -88,11 +79,11 @@ csky_supply_gregset (const struct regset *regset,
static void
csky_collect_gregset (const struct regset *regset,
- const struct regcache *regcache,
- int regnum, void *gregs_buf, size_t len)
+ const struct regcache *regcache, int regnum,
+ void *gregs_buf, size_t len)
{
int regno, gregset_num;
- gdb_byte *gregs = (gdb_byte *) gregs_buf ;
+ gdb_byte *gregs = (gdb_byte *) gregs_buf;
gdb_assert (len >= SIZEOF_CSKY_GREGSET);
gregset_num = ARRAY_SIZE (csky_gregset_offset);
@@ -101,17 +92,15 @@ csky_collect_gregset (const struct regset *regset,
{
if ((regnum == csky_gregset_offset[regno] || regnum == -1)
&& csky_gregset_offset[regno] != -1)
- regcache->raw_collect (regno,
- gregs + 4 + csky_gregset_offset[regno]);
+ regcache->raw_collect (regno, gregs + 4 + csky_gregset_offset[regno]);
}
}
/* Implement the supply_regset hook for FP registers in core files. */
static void
-csky_supply_fregset (const struct regset *regset,
- struct regcache *regcache, int regnum,
- const void *regs, size_t len)
+csky_supply_fregset (const struct regset *regset, struct regcache *regcache,
+ int regnum, const void *regs, size_t len)
{
int i;
int offset = 0;
@@ -150,10 +139,10 @@ csky_supply_fregset (const struct regset *regset,
In addition, for fr0~fr15, each FRx is the lower 64 bits of the
corresponding VRx. So fr0~fr15 and vr0~vr15 regisetrs use the same
offset. */
- int fcr_regno[] = {122, 123, 121}; /* fcr, fesr, fid. */
+ int fcr_regno[] = { 122, 123, 121 }; /* fcr, fesr, fid. */
/* Supply vr0~vr15. */
- for (i = 0; i < 16; i ++)
+ for (i = 0; i < 16; i++)
{
if (*gdbarch_register_name (gdbarch, (CSKY_VR0_REGNUM + i)) != '\0')
{
@@ -162,7 +151,7 @@ csky_supply_fregset (const struct regset *regset,
}
}
/* Supply fr0~fr15. */
- for (i = 0; i < 16; i ++)
+ for (i = 0; i < 16; i++)
{
if (*gdbarch_register_name (gdbarch, (CSKY_FR0_REGNUM + i)) != '\0')
{
@@ -171,7 +160,7 @@ csky_supply_fregset (const struct regset *regset,
}
}
/* Supply fr16~fr31. */
- for (i = 0; i < 16; i ++)
+ for (i = 0; i < 16; i++)
{
if (*gdbarch_register_name (gdbarch, (CSKY_FR16_REGNUM + i)) != '\0')
{
@@ -179,8 +168,8 @@ csky_supply_fregset (const struct regset *regset,
regcache->raw_supply (CSKY_FR16_REGNUM + i, fregs + offset);
}
}
- /* Supply fcr, fesr, fid. */
- for (i = 0; i < 3; i ++)
+ /* Supply fcr, fesr, fid. */
+ for (i = 0; i < 3; i++)
{
if (*gdbarch_register_name (gdbarch, fcr_regno[i]) != '\0')
{
@@ -191,8 +180,9 @@ csky_supply_fregset (const struct regset *regset,
}
else
{
- warning (_("Unknow size %s of section .reg2, can not get value"
- " of float registers."), pulongest (len));
+ warning (_ ("Unknow size %s of section .reg2, can not get value"
+ " of float registers."),
+ pulongest (len));
}
}
@@ -200,12 +190,12 @@ csky_supply_fregset (const struct regset *regset,
static void
csky_collect_fregset (const struct regset *regset,
- const struct regcache *regcache,
- int regnum, void *fregs_buf, size_t len)
+ const struct regcache *regcache, int regnum,
+ void *fregs_buf, size_t len)
{
int regno;
struct gdbarch *gdbarch = regcache->arch ();
- gdb_byte *fregs = (gdb_byte *) fregs_buf ;
+ gdb_byte *fregs = (gdb_byte *) fregs_buf;
int fregset_num = ARRAY_SIZE (csky_fregset_offset);
int offset = 0;
@@ -215,7 +205,7 @@ csky_collect_fregset (const struct regset *regset,
for (regno = 0; regno < fregset_num; regno++)
{
if ((regnum == csky_fregset_offset[regno] || regnum == -1)
- && csky_fregset_offset[regno] != -1)
+ && csky_fregset_offset[regno] != -1)
{
offset += register_size (gdbarch, csky_fregset_offset[regno]);
regcache->raw_collect (regno, fregs + offset);
@@ -240,59 +230,52 @@ csky_collect_fregset (const struct regset *regset,
corresponding VRx. So fr0~fr15 and vr0~vr15 regisetrs use the same$
offset. */
int i = 0;
- int fcr_regno[] = {122, 123, 121}; /* fcr, fesr, fid. */
+ int fcr_regno[] = { 122, 123, 121 }; /* fcr, fesr, fid. */
/* Supply vr0~vr15. */
- for (i = 0; i < 16; i ++)
+ for (i = 0; i < 16; i++)
{
if (*gdbarch_register_name (gdbarch, (CSKY_VR0_REGNUM + i)) != '\0')
{
offset = 16 * i;
- regcache ->raw_collect (CSKY_VR0_REGNUM + i, fregs + offset);
+ regcache->raw_collect (CSKY_VR0_REGNUM + i, fregs + offset);
}
}
/* Supply fr16~fr31. */
- for (i = 0; i < 16; i ++)
+ for (i = 0; i < 16; i++)
{
if (*gdbarch_register_name (gdbarch, (CSKY_FR16_REGNUM + i)) != '\0')
{
offset = (16 * 16) + (8 * i);
- regcache ->raw_collect (CSKY_FR16_REGNUM + i, fregs + offset);
+ regcache->raw_collect (CSKY_FR16_REGNUM + i, fregs + offset);
}
}
/* Supply fcr, fesr, fid. */
- for (i = 0; i < 3; i ++)
+ for (i = 0; i < 3; i++)
{
if (*gdbarch_register_name (gdbarch, fcr_regno[i]) != '\0')
{
offset = (16 * 16) + (16 * 8) + (4 * i);
- regcache ->raw_collect (fcr_regno[i], fregs + offset);
+ regcache->raw_collect (fcr_regno[i], fregs + offset);
}
}
}
else
{
- warning (_("Unknow size %s of section .reg2, will not set value"
- " of float registers."), pulongest (len));
+ warning (_ ("Unknow size %s of section .reg2, will not set value"
+ " of float registers."),
+ pulongest (len));
}
}
-static const struct regset csky_regset_general =
-{
- NULL,
- csky_supply_gregset,
- csky_collect_gregset
-};
+static const struct regset csky_regset_general
+ = { NULL, csky_supply_gregset, csky_collect_gregset };
-static const struct regset csky_regset_float =
-{
- NULL,
- csky_supply_fregset,
- csky_collect_fregset,
- /* Allow .reg2 to have a different size, and the size of .reg2 should
+static const struct regset csky_regset_float
+ = { NULL, csky_supply_fregset, csky_collect_fregset,
+ /* Allow .reg2 to have a different size, and the size of .reg2 should
always be bigger than SIZEOF_CSKY_FREGSET. */
- 1
-};
+ 1 };
/* Iterate over core file register note sections. */
@@ -318,13 +301,12 @@ csky_linux_rt_sigreturn_init (const struct tramp_frame *self,
CORE_ADDR sp = get_frame_register_unsigned (this_frame, 14);
CORE_ADDR base = sp + CSKY_SIGINFO_OFFSET + CSKY_SIGINFO_SIZE
- + CSKY_UCONTEXT_SIGCONTEXT
- + CSKY_SIGCONTEXT_SC_USP
+ + CSKY_UCONTEXT_SIGCONTEXT + CSKY_SIGCONTEXT_SC_USP
+ CSKY_SIGCONTEXT_SC_A0;
/* Set addrs of R0 ~ R13. */
for (i = 0; i < 14; i++)
- trad_frame_set_reg_addr (this_cache, i, base + i * 4);
+ trad_frame_set_reg_addr (this_cache, i, base + i * 4);
/* Set addrs of SP(R14) and R15. */
trad_frame_set_reg_addr (this_cache, 14, base - 4);
@@ -332,7 +314,7 @@ csky_linux_rt_sigreturn_init (const struct tramp_frame *self,
/* Set addrs of R16 ~ R31. */
for (i = 15; i < 31; i++)
- trad_frame_set_reg_addr (this_cache, i, base + i * 4);
+ trad_frame_set_reg_addr (this_cache, i, base + i * 4);
/* Set addrs of PSR and PC. */
trad_frame_set_reg_addr (this_cache, 89, base + 4 * 33);
@@ -341,17 +323,13 @@ csky_linux_rt_sigreturn_init (const struct tramp_frame *self,
trad_frame_set_id (this_cache, frame_id_build (sp, func));
}
-static struct tramp_frame
-csky_linux_rt_sigreturn_tramp_frame = {
- SIGTRAMP_FRAME,
- 4,
- {
- { CSKY_MOVI_R7_173, ULONGEST_MAX },
- { CSKY_TRAP_0, ULONGEST_MAX },
- { TRAMP_SENTINEL_INSN }
- },
- csky_linux_rt_sigreturn_init
-};
+static struct tramp_frame csky_linux_rt_sigreturn_tramp_frame
+ = { SIGTRAMP_FRAME,
+ 4,
+ { { CSKY_MOVI_R7_173, ULONGEST_MAX },
+ { CSKY_TRAP_0, ULONGEST_MAX },
+ { TRAMP_SENTINEL_INSN } },
+ csky_linux_rt_sigreturn_init };
static void
csky_linux_rt_sigreturn_init_pt_regs (const struct tramp_frame *self,
@@ -363,8 +341,7 @@ csky_linux_rt_sigreturn_init_pt_regs (const struct tramp_frame *self,
CORE_ADDR sp = get_frame_register_unsigned (this_frame, CSKY_SP_REGNUM);
CORE_ADDR base = sp + CSKY_SIGINFO_OFFSET + CSKY_SIGINFO_SIZE
- + CSKY_UCONTEXT_SIGCONTEXT
- + CSKY_SIGCONTEXT_PT_REGS_TLS;
+ + CSKY_UCONTEXT_SIGCONTEXT + CSKY_SIGCONTEXT_PT_REGS_TLS;
/* LR */
trad_frame_set_reg_addr (this_cache, CSKY_R15_REGNUM, base);
@@ -385,18 +362,13 @@ csky_linux_rt_sigreturn_init_pt_regs (const struct tramp_frame *self,
trad_frame_set_id (this_cache, frame_id_build (sp, func));
}
-
-static struct tramp_frame
-csky_linux_rt_sigreturn_tramp_frame_kernel_4x = {
- SIGTRAMP_FRAME,
- 4,
- {
- { CSKY_MOVI_R7_139, ULONGEST_MAX },
- { CSKY_TRAP_0, ULONGEST_MAX },
- { TRAMP_SENTINEL_INSN }
- },
- csky_linux_rt_sigreturn_init_pt_regs
-};
+static struct tramp_frame csky_linux_rt_sigreturn_tramp_frame_kernel_4x
+ = { SIGTRAMP_FRAME,
+ 4,
+ { { CSKY_MOVI_R7_139, ULONGEST_MAX },
+ { CSKY_TRAP_0, ULONGEST_MAX },
+ { TRAMP_SENTINEL_INSN } },
+ csky_linux_rt_sigreturn_init_pt_regs };
/* Hook function for gdbarch_register_osabi. */
@@ -421,13 +393,13 @@ csky_linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
/* Append tramp frame unwinder for SIGNAL. */
- tramp_frame_prepend_unwinder (gdbarch,
- &csky_linux_rt_sigreturn_tramp_frame);
- tramp_frame_prepend_unwinder (gdbarch,
- &csky_linux_rt_sigreturn_tramp_frame_kernel_4x);
+ tramp_frame_prepend_unwinder (gdbarch, &csky_linux_rt_sigreturn_tramp_frame);
+ tramp_frame_prepend_unwinder (
+ gdbarch, &csky_linux_rt_sigreturn_tramp_frame_kernel_4x);
}
void _initialize_csky_linux_tdep ();
+
void
_initialize_csky_linux_tdep ()
{
diff --git a/gdb/csky-tdep.c b/gdb/csky-tdep.c
index df9520fe37d..3d37186148c 100644
--- a/gdb/csky-tdep.c
+++ b/gdb/csky-tdep.c
@@ -68,47 +68,46 @@ static const reggroup *vr_reggroup;
static const reggroup *mmu_reggroup;
static const reggroup *prof_reggroup;
-static const char *csky_supported_tdesc_feature_names[] = {
- (const char *)"org.gnu.csky.abiv2.gpr",
- (const char *)"org.gnu.csky.abiv2.fpu",
- (const char *)"org.gnu.csky.abiv2.cr",
- (const char *)"org.gnu.csky.abiv2.fvcr",
- (const char *)"org.gnu.csky.abiv2.mmu",
- (const char *)"org.gnu.csky.abiv2.tee",
- (const char *)"org.gnu.csky.abiv2.fpu2",
- (const char *)"org.gnu.csky.abiv2.bank0",
- (const char *)"org.gnu.csky.abiv2.bank1",
- (const char *)"org.gnu.csky.abiv2.bank2",
- (const char *)"org.gnu.csky.abiv2.bank3",
- (const char *)"org.gnu.csky.abiv2.bank4",
- (const char *)"org.gnu.csky.abiv2.bank5",
- (const char *)"org.gnu.csky.abiv2.bank6",
- (const char *)"org.gnu.csky.abiv2.bank7",
- (const char *)"org.gnu.csky.abiv2.bank8",
- (const char *)"org.gnu.csky.abiv2.bank9",
- (const char *)"org.gnu.csky.abiv2.bank10",
- (const char *)"org.gnu.csky.abiv2.bank11",
- (const char *)"org.gnu.csky.abiv2.bank12",
- (const char *)"org.gnu.csky.abiv2.bank13",
- (const char *)"org.gnu.csky.abiv2.bank14",
- (const char *)"org.gnu.csky.abiv2.bank15",
- (const char *)"org.gnu.csky.abiv2.bank16",
- (const char *)"org.gnu.csky.abiv2.bank17",
- (const char *)"org.gnu.csky.abiv2.bank18",
- (const char *)"org.gnu.csky.abiv2.bank19",
- (const char *)"org.gnu.csky.abiv2.bank20",
- (const char *)"org.gnu.csky.abiv2.bank21",
- (const char *)"org.gnu.csky.abiv2.bank22",
- (const char *)"org.gnu.csky.abiv2.bank23",
- (const char *)"org.gnu.csky.abiv2.bank24",
- (const char *)"org.gnu.csky.abiv2.bank25",
- (const char *)"org.gnu.csky.abiv2.bank26",
- (const char *)"org.gnu.csky.abiv2.bank27",
- (const char *)"org.gnu.csky.abiv2.bank28",
- (const char *)"org.gnu.csky.abiv2.bank29",
- (const char *)"org.gnu.csky.abiv2.bank30",
- (const char *)"org.gnu.csky.abiv2.bank31"
-};
+static const char *csky_supported_tdesc_feature_names[]
+ = { (const char *) "org.gnu.csky.abiv2.gpr",
+ (const char *) "org.gnu.csky.abiv2.fpu",
+ (const char *) "org.gnu.csky.abiv2.cr",
+ (const char *) "org.gnu.csky.abiv2.fvcr",
+ (const char *) "org.gnu.csky.abiv2.mmu",
+ (const char *) "org.gnu.csky.abiv2.tee",
+ (const char *) "org.gnu.csky.abiv2.fpu2",
+ (const char *) "org.gnu.csky.abiv2.bank0",
+ (const char *) "org.gnu.csky.abiv2.bank1",
+ (const char *) "org.gnu.csky.abiv2.bank2",
+ (const char *) "org.gnu.csky.abiv2.bank3",
+ (const char *) "org.gnu.csky.abiv2.bank4",
+ (const char *) "org.gnu.csky.abiv2.bank5",
+ (const char *) "org.gnu.csky.abiv2.bank6",
+ (const char *) "org.gnu.csky.abiv2.bank7",
+ (const char *) "org.gnu.csky.abiv2.bank8",
+ (const char *) "org.gnu.csky.abiv2.bank9",
+ (const char *) "org.gnu.csky.abiv2.bank10",
+ (const char *) "org.gnu.csky.abiv2.bank11",
+ (const char *) "org.gnu.csky.abiv2.bank12",
+ (const char *) "org.gnu.csky.abiv2.bank13",
+ (const char *) "org.gnu.csky.abiv2.bank14",
+ (const char *) "org.gnu.csky.abiv2.bank15",
+ (const char *) "org.gnu.csky.abiv2.bank16",
+ (const char *) "org.gnu.csky.abiv2.bank17",
+ (const char *) "org.gnu.csky.abiv2.bank18",
+ (const char *) "org.gnu.csky.abiv2.bank19",
+ (const char *) "org.gnu.csky.abiv2.bank20",
+ (const char *) "org.gnu.csky.abiv2.bank21",
+ (const char *) "org.gnu.csky.abiv2.bank22",
+ (const char *) "org.gnu.csky.abiv2.bank23",
+ (const char *) "org.gnu.csky.abiv2.bank24",
+ (const char *) "org.gnu.csky.abiv2.bank25",
+ (const char *) "org.gnu.csky.abiv2.bank26",
+ (const char *) "org.gnu.csky.abiv2.bank27",
+ (const char *) "org.gnu.csky.abiv2.bank28",
+ (const char *) "org.gnu.csky.abiv2.bank29",
+ (const char *) "org.gnu.csky.abiv2.bank30",
+ (const char *) "org.gnu.csky.abiv2.bank31" };
struct csky_supported_tdesc_register
{
@@ -116,263 +115,217 @@ struct csky_supported_tdesc_register
int num;
};
-static const struct csky_supported_tdesc_register csky_supported_gpr_regs[] = {
- {"r0", 0},
- {"r1", 1},
- {"r2", 2},
- {"r3", 3},
- {"r4", 4},
- {"r5", 5},
- {"r6", 6},
- {"r7", 7},
- {"r8", 8},
- {"r9", 9},
- {"r10", 10},
- {"r11", 11},
- {"r12", 12},
- {"r13", 13},
- {"r14", 14},
- {"r15", 15},
- {"r16", 16},
- {"r17", 17},
- {"r18", 18},
- {"r19", 19},
- {"r20", 20},
- {"r21", 21},
- {"r22", 22},
- {"r23", 23},
- {"r24", 24},
- {"r25", 25},
- {"r26", 26},
- {"r27", 27},
- {"r28", 28},
- {"r28", 28},
- {"r29", 29},
- {"r30", 30},
- {"r31", 31},
- {"hi", CSKY_HI_REGNUM},
- {"lo", CSKY_LO_REGNUM},
- {"pc", CSKY_PC_REGNUM}
-};
+static const struct csky_supported_tdesc_register csky_supported_gpr_regs[]
+ = { { "r0", 0 },
+ { "r1", 1 },
+ { "r2", 2 },
+ { "r3", 3 },
+ { "r4", 4 },
+ { "r5", 5 },
+ { "r6", 6 },
+ { "r7", 7 },
+ { "r8", 8 },
+ { "r9", 9 },
+ { "r10", 10 },
+ { "r11", 11 },
+ { "r12", 12 },
+ { "r13", 13 },
+ { "r14", 14 },
+ { "r15", 15 },
+ { "r16", 16 },
+ { "r17", 17 },
+ { "r18", 18 },
+ { "r19", 19 },
+ { "r20", 20 },
+ { "r21", 21 },
+ { "r22", 22 },
+ { "r23", 23 },
+ { "r24", 24 },
+ { "r25", 25 },
+ { "r26", 26 },
+ { "r27", 27 },
+ { "r28", 28 },
+ { "r28", 28 },
+ { "r29", 29 },
+ { "r30", 30 },
+ { "r31", 31 },
+ { "hi", CSKY_HI_REGNUM },
+ { "lo", CSKY_LO_REGNUM },
+ { "pc", CSKY_PC_REGNUM } };
static const struct csky_supported_tdesc_register csky_supported_fpu_regs[] = {
/* fr0~fr15. */
- {"fr0", CSKY_FR0_REGNUM + 0},
- {"fr1", CSKY_FR0_REGNUM + 1},
- {"fr2", CSKY_FR0_REGNUM + 2},
- {"fr3", CSKY_FR0_REGNUM + 3},
- {"fr4", CSKY_FR0_REGNUM + 4},
- {"fr5", CSKY_FR0_REGNUM + 5},
- {"fr6", CSKY_FR0_REGNUM + 6},
- {"fr7", CSKY_FR0_REGNUM + 7},
- {"fr8", CSKY_FR0_REGNUM + 8},
- {"fr9", CSKY_FR0_REGNUM + 9},
- {"fr10", CSKY_FR0_REGNUM + 10},
- {"fr11", CSKY_FR0_REGNUM + 11},
- {"fr12", CSKY_FR0_REGNUM + 12},
- {"fr13", CSKY_FR0_REGNUM + 13},
- {"fr14", CSKY_FR0_REGNUM + 14},
- {"fr15", CSKY_FR0_REGNUM + 15},
+ { "fr0", CSKY_FR0_REGNUM + 0 },
+ { "fr1", CSKY_FR0_REGNUM + 1 },
+ { "fr2", CSKY_FR0_REGNUM + 2 },
+ { "fr3", CSKY_FR0_REGNUM + 3 },
+ { "fr4", CSKY_FR0_REGNUM + 4 },
+ { "fr5", CSKY_FR0_REGNUM + 5 },
+ { "fr6", CSKY_FR0_REGNUM + 6 },
+ { "fr7", CSKY_FR0_REGNUM + 7 },
+ { "fr8", CSKY_FR0_REGNUM + 8 },
+ { "fr9", CSKY_FR0_REGNUM + 9 },
+ { "fr10", CSKY_FR0_REGNUM + 10 },
+ { "fr11", CSKY_FR0_REGNUM + 11 },
+ { "fr12", CSKY_FR0_REGNUM + 12 },
+ { "fr13", CSKY_FR0_REGNUM + 13 },
+ { "fr14", CSKY_FR0_REGNUM + 14 },
+ { "fr15", CSKY_FR0_REGNUM + 15 },
/* fr16~fr31. */
- {"fr16", CSKY_FR16_REGNUM + 0},
- {"fr17", CSKY_FR16_REGNUM + 1},
- {"fr18", CSKY_FR16_REGNUM + 2},
- {"fr19", CSKY_FR16_REGNUM + 3},
- {"fr20", CSKY_FR16_REGNUM + 4},
- {"fr21", CSKY_FR16_REGNUM + 5},
- {"fr22", CSKY_FR16_REGNUM + 6},
- {"fr23", CSKY_FR16_REGNUM + 7},
- {"fr24", CSKY_FR16_REGNUM + 8},
- {"fr25", CSKY_FR16_REGNUM + 9},
- {"fr26", CSKY_FR16_REGNUM + 10},
- {"fr27", CSKY_FR16_REGNUM + 11},
- {"fr28", CSKY_FR16_REGNUM + 12},
- {"fr29", CSKY_FR16_REGNUM + 13},
- {"fr30", CSKY_FR16_REGNUM + 14},
- {"fr31", CSKY_FR16_REGNUM + 15},
+ { "fr16", CSKY_FR16_REGNUM + 0 },
+ { "fr17", CSKY_FR16_REGNUM + 1 },
+ { "fr18", CSKY_FR16_REGNUM + 2 },
+ { "fr19", CSKY_FR16_REGNUM + 3 },
+ { "fr20", CSKY_FR16_REGNUM + 4 },
+ { "fr21", CSKY_FR16_REGNUM + 5 },
+ { "fr22", CSKY_FR16_REGNUM + 6 },
+ { "fr23", CSKY_FR16_REGNUM + 7 },
+ { "fr24", CSKY_FR16_REGNUM + 8 },
+ { "fr25", CSKY_FR16_REGNUM + 9 },
+ { "fr26", CSKY_FR16_REGNUM + 10 },
+ { "fr27", CSKY_FR16_REGNUM + 11 },
+ { "fr28", CSKY_FR16_REGNUM + 12 },
+ { "fr29", CSKY_FR16_REGNUM + 13 },
+ { "fr30", CSKY_FR16_REGNUM + 14 },
+ { "fr31", CSKY_FR16_REGNUM + 15 },
/* vr0~vr15. */
- {"vr0", CSKY_VR0_REGNUM + 0},
- {"vr1", CSKY_VR0_REGNUM + 1},
- {"vr2", CSKY_VR0_REGNUM + 2},
- {"vr3", CSKY_VR0_REGNUM + 3},
- {"vr4", CSKY_VR0_REGNUM + 4},
- {"vr5", CSKY_VR0_REGNUM + 5},
- {"vr6", CSKY_VR0_REGNUM + 6},
- {"vr7", CSKY_VR0_REGNUM + 7},
- {"vr8", CSKY_VR0_REGNUM + 8},
- {"vr9", CSKY_VR0_REGNUM + 9},
- {"vr10", CSKY_VR0_REGNUM + 10},
- {"vr11", CSKY_VR0_REGNUM + 11},
- {"vr12", CSKY_VR0_REGNUM + 12},
- {"vr13", CSKY_VR0_REGNUM + 13},
- {"vr14", CSKY_VR0_REGNUM + 14},
- {"vr15", CSKY_VR0_REGNUM + 15},
+ { "vr0", CSKY_VR0_REGNUM + 0 },
+ { "vr1", CSKY_VR0_REGNUM + 1 },
+ { "vr2", CSKY_VR0_REGNUM + 2 },
+ { "vr3", CSKY_VR0_REGNUM + 3 },
+ { "vr4", CSKY_VR0_REGNUM + 4 },
+ { "vr5", CSKY_VR0_REGNUM + 5 },
+ { "vr6", CSKY_VR0_REGNUM + 6 },
+ { "vr7", CSKY_VR0_REGNUM + 7 },
+ { "vr8", CSKY_VR0_REGNUM + 8 },
+ { "vr9", CSKY_VR0_REGNUM + 9 },
+ { "vr10", CSKY_VR0_REGNUM + 10 },
+ { "vr11", CSKY_VR0_REGNUM + 11 },
+ { "vr12", CSKY_VR0_REGNUM + 12 },
+ { "vr13", CSKY_VR0_REGNUM + 13 },
+ { "vr14", CSKY_VR0_REGNUM + 14 },
+ { "vr15", CSKY_VR0_REGNUM + 15 },
/* fpu control registers. */
- {"fcr", CSKY_FCR_REGNUM + 0},
- {"fid", CSKY_FCR_REGNUM + 1},
- {"fesr", CSKY_FCR_REGNUM + 2},
+ { "fcr", CSKY_FCR_REGNUM + 0 },
+ { "fid", CSKY_FCR_REGNUM + 1 },
+ { "fesr", CSKY_FCR_REGNUM + 2 },
};
static const struct csky_supported_tdesc_register csky_supported_ar_regs[] = {
- {"ar0", CSKY_AR0_REGNUM + 0},
- {"ar1", CSKY_AR0_REGNUM + 1},
- {"ar2", CSKY_AR0_REGNUM + 2},
- {"ar3", CSKY_AR0_REGNUM + 3},
- {"ar4", CSKY_AR0_REGNUM + 4},
- {"ar5", CSKY_AR0_REGNUM + 5},
- {"ar6", CSKY_AR0_REGNUM + 6},
- {"ar7", CSKY_AR0_REGNUM + 7},
- {"ar8", CSKY_AR0_REGNUM + 8},
- {"ar9", CSKY_AR0_REGNUM + 9},
- {"ar10", CSKY_AR0_REGNUM + 10},
- {"ar11", CSKY_AR0_REGNUM + 11},
- {"ar12", CSKY_AR0_REGNUM + 12},
- {"ar13", CSKY_AR0_REGNUM + 13},
- {"ar14", CSKY_AR0_REGNUM + 14},
- {"ar15", CSKY_AR0_REGNUM + 15},
-};
-
-static const struct csky_supported_tdesc_register csky_supported_bank0_regs[] = {
- {"cr0", CSKY_CR0_REGNUM + 0},
- {"cr1", CSKY_CR0_REGNUM + 1},
- {"cr2", CSKY_CR0_REGNUM + 2},
- {"cr3", CSKY_CR0_REGNUM + 3},
- {"cr4", CSKY_CR0_REGNUM + 4},
- {"cr5", CSKY_CR0_REGNUM + 5},
- {"cr6", CSKY_CR0_REGNUM + 6},
- {"cr7", CSKY_CR0_REGNUM + 7},
- {"cr8", CSKY_CR0_REGNUM + 8},
- {"cr9", CSKY_CR0_REGNUM + 9},
- {"cr10", CSKY_CR0_REGNUM + 10},
- {"cr11", CSKY_CR0_REGNUM + 11},
- {"cr12", CSKY_CR0_REGNUM + 12},
- {"cr13", CSKY_CR0_REGNUM + 13},
- {"cr14", CSKY_CR0_REGNUM + 14},
- {"cr15", CSKY_CR0_REGNUM + 15},
- {"cr16", CSKY_CR0_REGNUM + 16},
- {"cr17", CSKY_CR0_REGNUM + 17},
- {"cr18", CSKY_CR0_REGNUM + 18},
- {"cr19", CSKY_CR0_REGNUM + 19},
- {"cr20", CSKY_CR0_REGNUM + 20},
- {"cr21", CSKY_CR0_REGNUM + 21},
- {"cr22", CSKY_CR0_REGNUM + 22},
- {"cr23", CSKY_CR0_REGNUM + 23},
- {"cr24", CSKY_CR0_REGNUM + 24},
- {"cr25", CSKY_CR0_REGNUM + 25},
- {"cr26", CSKY_CR0_REGNUM + 26},
- {"cr27", CSKY_CR0_REGNUM + 27},
- {"cr28", CSKY_CR0_REGNUM + 28},
- {"cr29", CSKY_CR0_REGNUM + 29},
- {"cr30", CSKY_CR0_REGNUM + 30},
- {"cr31", CSKY_CR0_REGNUM + 31}
-};
-
-static const struct csky_supported_tdesc_register csky_supported_mmu_regs[] = {
- {"mcr0", 128},
- {"mcr2", 129},
- {"mcr3", 130},
- {"mcr4", 131},
- {"mcr6", 132},
- {"mcr8", 133},
- {"mcr29", 134},
- {"mcr30", 135},
- {"mcr31", 136}
-};
-
-static const struct csky_supported_tdesc_register csky_supported_bank15_regs[] = {
- {"cp15cp1", 253},
- {"cp15cp5", 254},
- {"cp15cp7", 255},
- {"cp15cp9", 256},
- {"cp15cp10", 257},
- {"cp15cp11", 258},
- {"cp15cp12", 259},
- {"cp15cp13", 260},
- {"cp15cp14", 261},
- {"cp15cp15", 262},
- {"cp15cp16", 263},
- {"cp15cp17", 264},
- {"cp15cp18", 265},
- {"cp15cp19", 266},
- {"cp15cp20", 267},
- {"cp15cp21", 268},
- {"cp15cp22", 269},
- {"cp15cp23", 270},
- {"cp15cp24", 271},
- {"cp15cp25", 272},
- {"cp15cp26", 273},
- {"cp15cp27", 274},
- {"cp15cp28", 275},
+ { "ar0", CSKY_AR0_REGNUM + 0 }, { "ar1", CSKY_AR0_REGNUM + 1 },
+ { "ar2", CSKY_AR0_REGNUM + 2 }, { "ar3", CSKY_AR0_REGNUM + 3 },
+ { "ar4", CSKY_AR0_REGNUM + 4 }, { "ar5", CSKY_AR0_REGNUM + 5 },
+ { "ar6", CSKY_AR0_REGNUM + 6 }, { "ar7", CSKY_AR0_REGNUM + 7 },
+ { "ar8", CSKY_AR0_REGNUM + 8 }, { "ar9", CSKY_AR0_REGNUM + 9 },
+ { "ar10", CSKY_AR0_REGNUM + 10 }, { "ar11", CSKY_AR0_REGNUM + 11 },
+ { "ar12", CSKY_AR0_REGNUM + 12 }, { "ar13", CSKY_AR0_REGNUM + 13 },
+ { "ar14", CSKY_AR0_REGNUM + 14 }, { "ar15", CSKY_AR0_REGNUM + 15 },
};
-static const struct csky_supported_tdesc_register csky_supported_alias_regs[] = {
- /* Alias register names for Bank0. */
- {"psr", CSKY_CR0_REGNUM + 0},
- {"vbr", CSKY_CR0_REGNUM + 1},
- {"epsr", CSKY_CR0_REGNUM + 2},
- {"fpsr", CSKY_CR0_REGNUM + 3},
- {"epc", CSKY_CR0_REGNUM + 4},
- {"fpc", CSKY_CR0_REGNUM + 5},
- {"ss0", CSKY_CR0_REGNUM + 6},
- {"ss1", CSKY_CR0_REGNUM + 7},
- {"ss2", CSKY_CR0_REGNUM + 8},
- {"ss3", CSKY_CR0_REGNUM + 9},
- {"ss4", CSKY_CR0_REGNUM + 10},
- {"gcr", CSKY_CR0_REGNUM + 11},
- {"gsr", CSKY_CR0_REGNUM + 12},
- {"cpuid", CSKY_CR0_REGNUM + 13},
- {"ccr", CSKY_CR0_REGNUM + 18},
- {"capr", CSKY_CR0_REGNUM + 19},
- {"pacr", CSKY_CR0_REGNUM + 20},
- {"prsr", CSKY_CR0_REGNUM + 21},
- {"chr", CSKY_CR0_REGNUM + 31},
- /* Alias register names for MMU. */
- {"mir", 128},
- {"mel0", 129},
- {"mel1", 130},
- {"meh", 131},
- {"mpr", 132},
- {"mcir", 133},
- {"mpgd", 134},
- {"msa0", 135},
- {"msa1", 136},
- /* Alias register names for Bank1. */
- {"ebr", 190},
- {"errlc", 195},
- {"erraddr", 196},
- {"errsts", 197},
- {"errinj", 198},
- {"usp", 203},
- {"int_sp", 204},
- {"itcmcr", 211},
- {"dtcmcr", 212},
- {"cindex", 215},
- {"cdata0", 216},
- {"cdata1", 217},
- {"cdata2", 218},
- {"cins", 220},
- /* Alias register names for Bank3. */
- {"sepsr", 221},
- {"t_wssr", 221},
- {"sevbr", 222},
- {"t_wrcr", 222},
- {"seepsr", 223},
- {"seepc", 225},
- {"nsssp", 227},
- {"t_usp", 228},
- {"dcr", 229},
- {"t_pcr", 230},
-};
+static const struct csky_supported_tdesc_register csky_supported_bank0_regs[]
+ = { { "cr0", CSKY_CR0_REGNUM + 0 }, { "cr1", CSKY_CR0_REGNUM + 1 },
+ { "cr2", CSKY_CR0_REGNUM + 2 }, { "cr3", CSKY_CR0_REGNUM + 3 },
+ { "cr4", CSKY_CR0_REGNUM + 4 }, { "cr5", CSKY_CR0_REGNUM + 5 },
+ { "cr6", CSKY_CR0_REGNUM + 6 }, { "cr7", CSKY_CR0_REGNUM + 7 },
+ { "cr8", CSKY_CR0_REGNUM + 8 }, { "cr9", CSKY_CR0_REGNUM + 9 },
+ { "cr10", CSKY_CR0_REGNUM + 10 }, { "cr11", CSKY_CR0_REGNUM + 11 },
+ { "cr12", CSKY_CR0_REGNUM + 12 }, { "cr13", CSKY_CR0_REGNUM + 13 },
+ { "cr14", CSKY_CR0_REGNUM + 14 }, { "cr15", CSKY_CR0_REGNUM + 15 },
+ { "cr16", CSKY_CR0_REGNUM + 16 }, { "cr17", CSKY_CR0_REGNUM + 17 },
+ { "cr18", CSKY_CR0_REGNUM + 18 }, { "cr19", CSKY_CR0_REGNUM + 19 },
+ { "cr20", CSKY_CR0_REGNUM + 20 }, { "cr21", CSKY_CR0_REGNUM + 21 },
+ { "cr22", CSKY_CR0_REGNUM + 22 }, { "cr23", CSKY_CR0_REGNUM + 23 },
+ { "cr24", CSKY_CR0_REGNUM + 24 }, { "cr25", CSKY_CR0_REGNUM + 25 },
+ { "cr26", CSKY_CR0_REGNUM + 26 }, { "cr27", CSKY_CR0_REGNUM + 27 },
+ { "cr28", CSKY_CR0_REGNUM + 28 }, { "cr29", CSKY_CR0_REGNUM + 29 },
+ { "cr30", CSKY_CR0_REGNUM + 30 }, { "cr31", CSKY_CR0_REGNUM + 31 } };
+
+static const struct csky_supported_tdesc_register csky_supported_mmu_regs[]
+ = { { "mcr0", 128 }, { "mcr2", 129 }, { "mcr3", 130 },
+ { "mcr4", 131 }, { "mcr6", 132 }, { "mcr8", 133 },
+ { "mcr29", 134 }, { "mcr30", 135 }, { "mcr31", 136 } };
+
+static const struct csky_supported_tdesc_register csky_supported_bank15_regs[]
+ = {
+ { "cp15cp1", 253 }, { "cp15cp5", 254 }, { "cp15cp7", 255 },
+ { "cp15cp9", 256 }, { "cp15cp10", 257 }, { "cp15cp11", 258 },
+ { "cp15cp12", 259 }, { "cp15cp13", 260 }, { "cp15cp14", 261 },
+ { "cp15cp15", 262 }, { "cp15cp16", 263 }, { "cp15cp17", 264 },
+ { "cp15cp18", 265 }, { "cp15cp19", 266 }, { "cp15cp20", 267 },
+ { "cp15cp21", 268 }, { "cp15cp22", 269 }, { "cp15cp23", 270 },
+ { "cp15cp24", 271 }, { "cp15cp25", 272 }, { "cp15cp26", 273 },
+ { "cp15cp27", 274 }, { "cp15cp28", 275 },
+ };
+
+static const struct csky_supported_tdesc_register csky_supported_alias_regs[]
+ = {
+ /* Alias register names for Bank0. */
+ { "psr", CSKY_CR0_REGNUM + 0 },
+ { "vbr", CSKY_CR0_REGNUM + 1 },
+ { "epsr", CSKY_CR0_REGNUM + 2 },
+ { "fpsr", CSKY_CR0_REGNUM + 3 },
+ { "epc", CSKY_CR0_REGNUM + 4 },
+ { "fpc", CSKY_CR0_REGNUM + 5 },
+ { "ss0", CSKY_CR0_REGNUM + 6 },
+ { "ss1", CSKY_CR0_REGNUM + 7 },
+ { "ss2", CSKY_CR0_REGNUM + 8 },
+ { "ss3", CSKY_CR0_REGNUM + 9 },
+ { "ss4", CSKY_CR0_REGNUM + 10 },
+ { "gcr", CSKY_CR0_REGNUM + 11 },
+ { "gsr", CSKY_CR0_REGNUM + 12 },
+ { "cpuid", CSKY_CR0_REGNUM + 13 },
+ { "ccr", CSKY_CR0_REGNUM + 18 },
+ { "capr", CSKY_CR0_REGNUM + 19 },
+ { "pacr", CSKY_CR0_REGNUM + 20 },
+ { "prsr", CSKY_CR0_REGNUM + 21 },
+ { "chr", CSKY_CR0_REGNUM + 31 },
+ /* Alias register names for MMU. */
+ { "mir", 128 },
+ { "mel0", 129 },
+ { "mel1", 130 },
+ { "meh", 131 },
+ { "mpr", 132 },
+ { "mcir", 133 },
+ { "mpgd", 134 },
+ { "msa0", 135 },
+ { "msa1", 136 },
+ /* Alias register names for Bank1. */
+ { "ebr", 190 },
+ { "errlc", 195 },
+ { "erraddr", 196 },
+ { "errsts", 197 },
+ { "errinj", 198 },
+ { "usp", 203 },
+ { "int_sp", 204 },
+ { "itcmcr", 211 },
+ { "dtcmcr", 212 },
+ { "cindex", 215 },
+ { "cdata0", 216 },
+ { "cdata1", 217 },
+ { "cdata2", 218 },
+ { "cins", 220 },
+ /* Alias register names for Bank3. */
+ { "sepsr", 221 },
+ { "t_wssr", 221 },
+ { "sevbr", 222 },
+ { "t_wrcr", 222 },
+ { "seepsr", 223 },
+ { "seepc", 225 },
+ { "nsssp", 227 },
+ { "t_usp", 228 },
+ { "dcr", 229 },
+ { "t_pcr", 230 },
+ };
/* Functions declaration. */
-static const char *
-csky_pseudo_register_name (struct gdbarch *gdbarch, int regno);
+static const char *csky_pseudo_register_name (struct gdbarch *gdbarch,
+ int regno);
/* Get csky supported registers's count for tdesc xml. */
static int
-csky_get_supported_tdesc_registers_count()
+csky_get_supported_tdesc_registers_count ()
{
int count = 0;
count += ARRAY_SIZE (csky_supported_gpr_regs);
@@ -429,65 +382,65 @@ csky_get_supported_register_by_index (int index)
remain = index % 32;
switch (multi)
{
- case 0: /* Bank1. */
- {
- sprintf (tdesc_reg.name, "cp1cr%d", remain);
- tdesc_reg.num = 189 + remain;
- }
- break;
- case 1: /* Bank2. */
- {
- sprintf (tdesc_reg.name, "cp2cr%d", remain);
- tdesc_reg.num = 276 + remain;
- }
- break;
- case 2: /* Bank3. */
- {
- sprintf (tdesc_reg.name, "cp3cr%d", remain);
- tdesc_reg.num = 221 + remain;
- }
- break;
- case 3: /* Bank4. */
- case 4: /* Bank5. */
- case 5: /* Bank6. */
- case 6: /* Bank7. */
- case 7: /* Bank8. */
- case 8: /* Bank9. */
- case 9: /* Bank10. */
- case 10: /* Bank11. */
- case 11: /* Bank12. */
- case 12: /* Bank13. */
- case 13: /* Bank14. */
- {
- /* Regitsers in Bank4~14 have continuous regno with start 308. */
- sprintf (tdesc_reg.name, "cp%dcr%d", (multi + 1), remain);
- tdesc_reg.num = 308 + ((multi - 3) * 32) + remain;
- }
- break;
- case 14: /* Bank16. */
- case 15: /* Bank17. */
- case 16: /* Bank18. */
- case 17: /* Bank19. */
- case 18: /* Bank20. */
- case 19: /* Bank21. */
- case 20: /* Bank22. */
- case 21: /* Bank23. */
- case 22: /* Bank24. */
- case 23: /* Bank25. */
- case 24: /* Bank26. */
- case 25: /* Bank27. */
- case 26: /* Bank28. */
- case 27: /* Bank29. */
- case 28: /* Bank30. */
- case 29: /* Bank31. */
- {
- /* Regitsers in Bank16~31 have continuous regno with start 660. */
- sprintf (tdesc_reg.name, "cp%dcr%d", (multi + 2), remain);
- tdesc_reg.num = 660 + ((multi - 14) * 32) + remain;
- }
- break;
- default:
- return NULL;
+ case 0: /* Bank1. */
+ {
+ sprintf (tdesc_reg.name, "cp1cr%d", remain);
+ tdesc_reg.num = 189 + remain;
+ }
+ break;
+ case 1: /* Bank2. */
+ {
+ sprintf (tdesc_reg.name, "cp2cr%d", remain);
+ tdesc_reg.num = 276 + remain;
+ }
+ break;
+ case 2: /* Bank3. */
+ {
+ sprintf (tdesc_reg.name, "cp3cr%d", remain);
+ tdesc_reg.num = 221 + remain;
+ }
+ break;
+ case 3: /* Bank4. */
+ case 4: /* Bank5. */
+ case 5: /* Bank6. */
+ case 6: /* Bank7. */
+ case 7: /* Bank8. */
+ case 8: /* Bank9. */
+ case 9: /* Bank10. */
+ case 10: /* Bank11. */
+ case 11: /* Bank12. */
+ case 12: /* Bank13. */
+ case 13: /* Bank14. */
+ {
+ /* Regitsers in Bank4~14 have continuous regno with start 308. */
+ sprintf (tdesc_reg.name, "cp%dcr%d", (multi + 1), remain);
+ tdesc_reg.num = 308 + ((multi - 3) * 32) + remain;
+ }
+ break;
+ case 14: /* Bank16. */
+ case 15: /* Bank17. */
+ case 16: /* Bank18. */
+ case 17: /* Bank19. */
+ case 18: /* Bank20. */
+ case 19: /* Bank21. */
+ case 20: /* Bank22. */
+ case 21: /* Bank23. */
+ case 22: /* Bank24. */
+ case 23: /* Bank25. */
+ case 24: /* Bank26. */
+ case 25: /* Bank27. */
+ case 26: /* Bank28. */
+ case 27: /* Bank29. */
+ case 28: /* Bank30. */
+ case 29: /* Bank31. */
+ {
+ /* Regitsers in Bank16~31 have continuous regno with start 660. */
+ sprintf (tdesc_reg.name, "cp%dcr%d", (multi + 2), remain);
+ tdesc_reg.num = 660 + ((multi - 14) * 32) + remain;
+ }
+ break;
+ default:
+ return NULL;
}
return &tdesc_reg;
}
@@ -497,8 +450,8 @@ csky_get_supported_register_by_index (int index)
static void
print_savedreg_msg (int regno, int offsets[], bool print_continuing)
{
- gdb_printf (gdb_stdlog, "csky: r%d saved at offset 0x%x\n",
- regno, offsets[regno]);
+ gdb_printf (gdb_stdlog, "csky: r%d saved at offset 0x%x\n", regno,
+ offsets[regno]);
if (print_continuing)
gdb_printf (gdb_stdlog, "csky: continuing\n");
}
@@ -587,72 +540,68 @@ csky_write_pc (regcache *regcache, CORE_ADDR val)
/* C-Sky ABI register names. */
-static const char * const csky_register_names[] =
-{
+static const char *const csky_register_names[] = {
/* General registers 0 - 31. */
- "r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7",
- "r8", "r9", "r10", "r11", "r12", "r13", "r14", "r15",
- "r16", "r17", "r18", "r19", "r20", "r21", "r22", "r23",
- "r24", "r25", "r26", "r27", "r28", "r29", "r30", "r31",
+ "r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7", "r8", "r9", "r10", "r11",
+ "r12", "r13", "r14", "r15", "r16", "r17", "r18", "r19", "r20", "r21", "r22",
+ "r23", "r24", "r25", "r26", "r27", "r28", "r29", "r30", "r31",
/* DSP hilo registers 36 and 37. */
- "", "", "", "", "hi", "lo", "", "",
+ "", "", "", "", "hi", "lo", "", "",
/* FPU/VPU general registers 40 - 71. */
- "fr0", "fr1", "fr2", "fr3", "fr4", "fr5", "fr6", "fr7",
- "fr8", "fr9", "fr10", "fr11", "fr12", "fr13", "fr14", "fr15",
- "vr0", "vr1", "vr2", "vr3", "vr4", "vr5", "vr6", "vr7",
- "vr8", "vr9", "vr10", "vr11", "vr12", "vr13", "vr14", "vr15",
+ "fr0", "fr1", "fr2", "fr3", "fr4", "fr5", "fr6", "fr7", "fr8", "fr9", "fr10",
+ "fr11", "fr12", "fr13", "fr14", "fr15", "vr0", "vr1", "vr2", "vr3", "vr4",
+ "vr5", "vr6", "vr7", "vr8", "vr9", "vr10", "vr11", "vr12", "vr13", "vr14",
+ "vr15",
/* Program counter 72. */
"pc",
/* Optional registers (ar) 73 - 88. */
- "ar0", "ar1", "ar2", "ar3", "ar4", "ar5", "ar6", "ar7",
- "ar8", "ar9", "ar10", "ar11", "ar12", "ar13", "ar14", "ar15",
+ "ar0", "ar1", "ar2", "ar3", "ar4", "ar5", "ar6", "ar7", "ar8", "ar9", "ar10",
+ "ar11", "ar12", "ar13", "ar14", "ar15",
/* Control registers (cr) 89 - 119. */
- "psr", "vbr", "epsr", "fpsr", "epc", "fpc", "ss0", "ss1",
- "ss2", "ss3", "ss4", "gcr", "gsr", "cr13", "cr14", "cr15",
- "cr16", "cr17", "cr18", "cr19", "cr20", "cr21", "cr22", "cr23",
- "cr24", "cr25", "cr26", "cr27", "cr28", "cr29", "cr30", "cr31",
+ "psr", "vbr", "epsr", "fpsr", "epc", "fpc", "ss0", "ss1", "ss2", "ss3",
+ "ss4", "gcr", "gsr", "cr13", "cr14", "cr15", "cr16", "cr17", "cr18", "cr19",
+ "cr20", "cr21", "cr22", "cr23", "cr24", "cr25", "cr26", "cr27", "cr28",
+ "cr29", "cr30", "cr31",
/* FPU/VPU control registers 121 ~ 123. */
/* User sp 127. */
"fid", "fcr", "fesr", "", "", "", "usp",
/* MMU control registers: 128 - 136. */
- "mcr0", "mcr2", "mcr3", "mcr4", "mcr6", "mcr8", "mcr29", "mcr30",
- "mcr31", "", "", "",
+ "mcr0", "mcr2", "mcr3", "mcr4", "mcr6", "mcr8", "mcr29", "mcr30", "mcr31",
+ "", "", "",
/* Profiling control registers 140 - 143. */
/* Profiling software general registers 144 - 157. */
- "profcr0", "profcr1", "profcr2", "profcr3", "profsgr0", "profsgr1",
- "profsgr2", "profsgr3", "profsgr4", "profsgr5", "profsgr6", "profsgr7",
- "profsgr8", "profsgr9", "profsgr10","profsgr11","profsgr12", "profsgr13",
- "", "",
+ "profcr0", "profcr1", "profcr2", "profcr3", "profsgr0", "profsgr1",
+ "profsgr2", "profsgr3", "profsgr4", "profsgr5", "profsgr6", "profsgr7",
+ "profsgr8", "profsgr9", "profsgr10", "profsgr11", "profsgr12", "profsgr13",
+ "", "",
/* Profiling architecture general registers 160 - 174. */
"profagr0", "profagr1", "profagr2", "profagr3", "profagr4", "profagr5",
- "profagr6", "profagr7", "profagr8", "profagr9", "profagr10","profagr11",
- "profagr12","profagr13","profagr14", "",
+ "profagr6", "profagr7", "profagr8", "profagr9", "profagr10", "profagr11",
+ "profagr12", "profagr13", "profagr14", "",
/* Profiling extension general registers 176 - 188. */
"profxgr0", "profxgr1", "profxgr2", "profxgr3", "profxgr4", "profxgr5",
- "profxgr6", "profxgr7", "profxgr8", "profxgr9", "profxgr10","profxgr11",
+ "profxgr6", "profxgr7", "profxgr8", "profxgr9", "profxgr10", "profxgr11",
"profxgr12",
/* Control registers in bank1. */
- "", "", "", "", "", "", "", "",
- "", "", "", "", "", "", "", "",
- "cp1cr16", "cp1cr17", "cp1cr18", "cp1cr19", "cp1cr20", "", "", "",
- "", "", "", "", "", "", "", "",
+ "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "cp1cr16",
+ "cp1cr17", "cp1cr18", "cp1cr19", "cp1cr20", "", "", "", "", "", "", "", "",
+ "", "", "",
/* Control registers in bank3 (ICE). */
- "sepsr", "sevbr", "seepsr", "", "seepc", "", "nsssp", "seusp",
- "sedcr", "", "", "", "", "", "", "",
- "", "", "", "", "", "", "", "",
- "", "", "", "", "", "", "", ""
+ "sepsr", "sevbr", "seepsr", "", "seepc", "", "nsssp", "seusp", "sedcr", "",
+ "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
+ "", "", ""
};
/* Implement the register_name gdbarch method. */
@@ -701,8 +650,7 @@ static struct type *
csky_register_type (struct gdbarch *gdbarch, int reg_nr)
{
int num_regs = gdbarch_num_regs (gdbarch);
- csky_gdbarch_tdep *tdep
- = gdbarch_tdep<csky_gdbarch_tdep> (gdbarch);
+ csky_gdbarch_tdep *tdep = gdbarch_tdep<csky_gdbarch_tdep> (gdbarch);
if (tdep->fv_pseudo_registers_count)
{
@@ -723,11 +671,11 @@ csky_register_type (struct gdbarch *gdbarch, int reg_nr)
{
struct type *tdesc_t = tdesc_register_type (gdbarch, reg_nr);
if (tdesc_t)
- return tdesc_t;
+ return tdesc_t;
}
/* PC, EPC, FPC is a text pointer. */
- if ((reg_nr == CSKY_PC_REGNUM) || (reg_nr == CSKY_EPC_REGNUM)
+ if ((reg_nr == CSKY_PC_REGNUM) || (reg_nr == CSKY_EPC_REGNUM)
|| (reg_nr == CSKY_FPC_REGNUM))
return builtin_type (gdbarch)->builtin_func_ptr;
@@ -736,9 +684,9 @@ csky_register_type (struct gdbarch *gdbarch, int reg_nr)
return builtin_type (gdbarch)->builtin_data_ptr;
/* Float register has 64 bits, and only in ck810. */
- if ((reg_nr >=CSKY_FR0_REGNUM) && (reg_nr <= CSKY_FR0_REGNUM + 15))
- return arch_float_type (gdbarch, 64, "builtin_type_csky_ext",
- floatformats_ieee_double);
+ if ((reg_nr >= CSKY_FR0_REGNUM) && (reg_nr <= CSKY_FR0_REGNUM + 15))
+ return arch_float_type (gdbarch, 64, "builtin_type_csky_ext",
+ floatformats_ieee_double);
/* Profiling general register has 48 bits, we use 64bit. */
if ((reg_nr >= CSKY_PROFGR_REGNUM) && (reg_nr <= CSKY_PROFGR_REGNUM + 44))
@@ -757,8 +705,10 @@ csky_register_type (struct gdbarch *gdbarch, int reg_nr)
struct csky_stack_item
{
csky_stack_item (int len_, const gdb_byte *data_)
- : len (len_), data (data_)
- {}
+ : len (len_),
+ data (data_)
+ {
+ }
int len;
const gdb_byte *data;
@@ -768,8 +718,8 @@ struct csky_stack_item
static CORE_ADDR
csky_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
- struct regcache *regcache, CORE_ADDR bp_addr,
- int nargs, struct value **args, CORE_ADDR sp,
+ struct regcache *regcache, CORE_ADDR bp_addr, int nargs,
+ struct value **args, CORE_ADDR sp,
function_call_return_method return_method,
CORE_ADDR struct_addr)
{
@@ -789,8 +739,7 @@ csky_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
{
if (csky_debug)
{
- gdb_printf (gdb_stdlog,
- "csky: struct return in %s = %s\n",
+ gdb_printf (gdb_stdlog, "csky: struct return in %s = %s\n",
gdbarch_register_name (gdbarch, argreg),
paddress (gdbarch, struct_addr));
}
@@ -817,8 +766,7 @@ csky_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
the arguments will always be stored in the low address. */
if (len < 4)
{
- CORE_ADDR regval
- = extract_unsigned_integer (val, len, byte_order);
+ CORE_ADDR regval = extract_unsigned_integer (val, len, byte_order);
regcache_cooked_write_unsigned (regcache, argreg, regval);
argreg++;
}
@@ -831,14 +779,12 @@ csky_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
{
/* The argument is passed in an argument register. */
CORE_ADDR regval
- = extract_unsigned_integer (val, partial_len,
- byte_order);
+ = extract_unsigned_integer (val, partial_len, byte_order);
if (byte_order == BFD_ENDIAN_BIG)
regval <<= (4 - partial_len) * 8;
/* Put regval into register in REGCACHE. */
- regcache_cooked_write_unsigned (regcache, argreg,
- regval);
+ regcache_cooked_write_unsigned (regcache, argreg, regval);
argreg++;
}
else
@@ -889,12 +835,12 @@ csky_return_value (struct gdbarch *gdbarch, struct value *function,
/* By using store_unsigned_integer we avoid having to do
anything special for small big-endian values. */
regcache->cooked_read (ret_regnum, &tmp);
- store_unsigned_integer (readbuf, (len > 4 ? 4 : len),
- byte_order, tmp);
+ store_unsigned_integer (readbuf, (len > 4 ? 4 : len), byte_order,
+ tmp);
if (len > 4)
{
regcache->cooked_read (ret_regnum + 1, &tmp);
- store_unsigned_integer (readbuf + 4, 4, byte_order, tmp);
+ store_unsigned_integer (readbuf + 4, 4, byte_order, tmp);
}
}
if (writebuf != NULL)
@@ -904,12 +850,11 @@ csky_return_value (struct gdbarch *gdbarch, struct value *function,
regcache_cooked_write_unsigned (regcache, ret_regnum, regval);
if (len > 4)
{
- regval = extract_unsigned_integer ((gdb_byte *) writebuf + 4,
- 4, byte_order);
+ regval = extract_unsigned_integer ((gdb_byte *) writebuf + 4, 4,
+ byte_order);
regcache_cooked_write_unsigned (regcache, ret_regnum + 1,
regval);
}
-
}
return RETURN_VALUE_REGISTER_CONVENTION;
}
@@ -951,13 +896,10 @@ struct csky_unwind_cache
after the function prologue. */
static CORE_ADDR
-csky_analyze_prologue (struct gdbarch *gdbarch,
- CORE_ADDR start_pc,
- CORE_ADDR limit_pc,
- CORE_ADDR end_pc,
+csky_analyze_prologue (struct gdbarch *gdbarch, CORE_ADDR start_pc,
+ CORE_ADDR limit_pc, CORE_ADDR end_pc,
frame_info_ptr this_frame,
- struct csky_unwind_cache *this_cache,
- lr_type_t lr_type)
+ struct csky_unwind_cache *this_cache, lr_type_t lr_type)
{
CORE_ADDR addr;
unsigned int insn, rn;
@@ -982,8 +924,8 @@ csky_analyze_prologue (struct gdbarch *gdbarch,
{
gdb_printf (gdb_stdlog,
"csky: Scanning prologue: start_pc = 0x%x,"
- "limit_pc = 0x%x\n", (unsigned int) start_pc,
- (unsigned int) limit_pc);
+ "limit_pc = 0x%x\n",
+ (unsigned int) start_pc, (unsigned int) limit_pc);
}
/* Default to 16 bit instruction. */
@@ -1004,8 +946,7 @@ csky_analyze_prologue (struct gdbarch *gdbarch,
int offset = CSKY_32_SUBI_IMM (insn);
if (csky_debug)
{
- gdb_printf (gdb_stdlog,
- "csky: got subi sp,%d; continuing\n",
+ gdb_printf (gdb_stdlog, "csky: got subi sp,%d; continuing\n",
offset);
}
stacksize += offset;
@@ -1030,15 +971,12 @@ csky_analyze_prologue (struct gdbarch *gdbarch,
reg_count = CSKY_32_STM_SIZE (insn);
if (csky_debug)
{
- gdb_printf (gdb_stdlog,
- "csky: got stm r%d-r%d,(sp)\n",
- start_register,
- start_register + reg_count);
+ gdb_printf (gdb_stdlog, "csky: got stm r%d-r%d,(sp)\n",
+ start_register, start_register + reg_count);
}
for (rn = start_register, offset = 0;
- rn <= start_register + reg_count;
- rn++, offset += 4)
+ rn <= start_register + reg_count; rn++, offset += 4)
{
register_offsets[rn] = stacksize - offset;
if (csky_debug)
@@ -1046,8 +984,7 @@ csky_analyze_prologue (struct gdbarch *gdbarch,
gdb_printf (gdb_stdlog,
"csky: r%d saved at 0x%x"
" (offset %d)\n",
- rn, register_offsets[rn],
- offset);
+ rn, register_offsets[rn], offset);
}
}
if (csky_debug)
@@ -1089,7 +1026,7 @@ csky_analyze_prologue (struct gdbarch *gdbarch,
int offset;
/* CSKY_EPSR_REGNUM. */
- rn = CSKY_NUM_GREGS;
+ rn = CSKY_NUM_GREGS;
offset = CSKY_16_STWx0_OFFSET (insn2);
register_offsets[rn] = stacksize - offset;
if (csky_debug)
@@ -1107,7 +1044,7 @@ csky_analyze_prologue (struct gdbarch *gdbarch,
int offset;
/* CSKY_EPSR_REGNUM. */
- rn = CSKY_NUM_GREGS;
+ rn = CSKY_NUM_GREGS;
offset = CSKY_32_ST_OFFSET (insn2);
register_offsets[rn] = framesize - offset;
if (csky_debug)
@@ -1126,13 +1063,12 @@ csky_analyze_prologue (struct gdbarch *gdbarch,
if (insn_len == 2)
{
int stw_regnum = (insn2 >> 5) & 0x7;
- if (CSKY_16_IS_STWx0 (insn2) && (mfcr_regnum
- == stw_regnum))
+ if (CSKY_16_IS_STWx0 (insn2) && (mfcr_regnum == stw_regnum))
{
int offset;
/* CSKY_FPSR_REGNUM. */
- rn = CSKY_NUM_GREGS + 1;
+ rn = CSKY_NUM_GREGS + 1;
offset = CSKY_16_STWx0_OFFSET (insn2);
register_offsets[rn] = stacksize - offset;
if (csky_debug)
@@ -1150,7 +1086,7 @@ csky_analyze_prologue (struct gdbarch *gdbarch,
int offset;
/* CSKY_FPSR_REGNUM. */
- rn = CSKY_NUM_GREGS + 1;
+ rn = CSKY_NUM_GREGS + 1;
offset = CSKY_32_ST_OFFSET (insn2);
register_offsets[rn] = framesize - offset;
if (csky_debug)
@@ -1174,7 +1110,7 @@ csky_analyze_prologue (struct gdbarch *gdbarch,
int offset;
/* CSKY_EPC_REGNUM. */
- rn = CSKY_NUM_GREGS + 2;
+ rn = CSKY_NUM_GREGS + 2;
offset = CSKY_16_STWx0_OFFSET (insn2);
register_offsets[rn] = stacksize - offset;
if (csky_debug)
@@ -1192,7 +1128,7 @@ csky_analyze_prologue (struct gdbarch *gdbarch,
int offset;
/* CSKY_EPC_REGNUM. */
- rn = CSKY_NUM_GREGS + 2;
+ rn = CSKY_NUM_GREGS + 2;
offset = CSKY_32_ST_OFFSET (insn2);
register_offsets[rn] = framesize - offset;
if (csky_debug)
@@ -1216,7 +1152,7 @@ csky_analyze_prologue (struct gdbarch *gdbarch,
int offset;
/* CSKY_FPC_REGNUM. */
- rn = CSKY_NUM_GREGS + 3;
+ rn = CSKY_NUM_GREGS + 3;
offset = CSKY_16_STWx0_OFFSET (insn2);
register_offsets[rn] = stacksize - offset;
if (csky_debug)
@@ -1234,7 +1170,7 @@ csky_analyze_prologue (struct gdbarch *gdbarch,
int offset;
/* CSKY_FPC_REGNUM. */
- rn = CSKY_NUM_GREGS + 3;
+ rn = CSKY_NUM_GREGS + 3;
offset = CSKY_32_ST_OFFSET (insn2);
register_offsets[rn] = framesize - offset;
if (csky_debug)
@@ -1267,15 +1203,15 @@ csky_analyze_prologue (struct gdbarch *gdbarch,
}
for (rn = 16; rn <= 16 + num - 1; rn++)
{
- register_offsets[rn] = stacksize - tmp;
- if (csky_debug)
- {
- gdb_printf (gdb_stdlog,
- "csky: r%d saved at 0x%x"
- " (offset %d)\n", rn,
- register_offsets[rn], tmp);
- }
- tmp += 4;
+ register_offsets[rn] = stacksize - tmp;
+ if (csky_debug)
+ {
+ gdb_printf (gdb_stdlog,
+ "csky: r%d saved at 0x%x"
+ " (offset %d)\n",
+ rn, register_offsets[rn], tmp);
+ }
+ tmp += 4;
}
}
if (CSKY_32_IS_PUSH_R15 (insn))
@@ -1298,15 +1234,15 @@ csky_analyze_prologue (struct gdbarch *gdbarch,
}
for (rn = 4; rn <= 4 + num - 1; rn++)
{
- register_offsets[rn] = stacksize - tmp;
- if (csky_debug)
- {
- gdb_printf (gdb_stdlog,
- "csky: r%d saved at 0x%x"
- " (offset %d)\n", rn,
- register_offsets[rn], tmp);
- }
- tmp += 4;
+ register_offsets[rn] = stacksize - tmp;
+ if (csky_debug)
+ {
+ gdb_printf (gdb_stdlog,
+ "csky: r%d saved at 0x%x"
+ " (offset %d)\n",
+ rn, register_offsets[rn], tmp);
+ }
+ tmp += 4;
}
}
@@ -1324,19 +1260,18 @@ csky_analyze_prologue (struct gdbarch *gdbarch,
if (csky_debug)
{
- gdb_printf (gdb_stdlog,
- "csky: looking at large frame\n");
+ gdb_printf (gdb_stdlog, "csky: looking at large frame\n");
}
if (CSKY_32_IS_LRW4 (insn))
{
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
- int literal_addr = (addr + ((insn & 0xffff) << 2))
- & 0xfffffffc;
+ int literal_addr
+ = (addr + ((insn & 0xffff) << 2)) & 0xfffffffc;
adjust = read_memory_unsigned_integer (literal_addr, 4,
byte_order);
}
else if (CSKY_32_IS_MOVI4 (insn))
- adjust = (insn & 0xffff);
+ adjust = (insn & 0xffff);
else if (CSKY_32_IS_MOVIH4 (insn))
adjust = (insn & 0xffff) << 16;
else
@@ -1347,8 +1282,8 @@ csky_analyze_prologue (struct gdbarch *gdbarch,
if (csky_debug)
{
- gdb_printf (gdb_stdlog,
- "csky: base stacksize=0x%x\n", adjust);
+ gdb_printf (gdb_stdlog, "csky: base stacksize=0x%x\n",
+ adjust);
/* May have zero or more insns which modify r4. */
gdb_printf (gdb_stdlog,
@@ -1365,8 +1300,7 @@ csky_analyze_prologue (struct gdbarch *gdbarch,
adjust += imm;
if (csky_debug)
{
- gdb_printf (gdb_stdlog,
- "csky: addi r4,%d\n", imm);
+ gdb_printf (gdb_stdlog, "csky: addi r4,%d\n", imm);
}
}
else if (CSKY_32_IS_SUBI4 (insn2))
@@ -1375,8 +1309,7 @@ csky_analyze_prologue (struct gdbarch *gdbarch,
adjust -= imm;
if (csky_debug)
{
- gdb_printf (gdb_stdlog,
- "csky: subi r4,%d\n", imm);
+ gdb_printf (gdb_stdlog, "csky: subi r4,%d\n", imm);
}
}
else if (CSKY_32_IS_NOR4 (insn2))
@@ -1384,8 +1317,7 @@ csky_analyze_prologue (struct gdbarch *gdbarch,
adjust = ~adjust;
if (csky_debug)
{
- gdb_printf (gdb_stdlog,
- "csky: nor r4,r4,r4\n");
+ gdb_printf (gdb_stdlog, "csky: nor r4,r4,r4\n");
}
}
else if (CSKY_32_IS_ROTLI4 (insn2))
@@ -1396,8 +1328,8 @@ csky_analyze_prologue (struct gdbarch *gdbarch,
adjust |= temp;
if (csky_debug)
{
- gdb_printf (gdb_stdlog,
- "csky: rotli r4,r4,%d\n", imm);
+ gdb_printf (gdb_stdlog, "csky: rotli r4,r4,%d\n",
+ imm);
}
}
else if (CSKY_32_IS_LISI4 (insn2))
@@ -1406,8 +1338,8 @@ csky_analyze_prologue (struct gdbarch *gdbarch,
adjust <<= imm;
if (csky_debug)
{
- gdb_printf (gdb_stdlog,
- "csky: lsli r4,r4,%d\n", imm);
+ gdb_printf (gdb_stdlog, "csky: lsli r4,r4,%d\n",
+ imm);
}
}
else if (CSKY_32_IS_BSETI4 (insn2))
@@ -1416,8 +1348,8 @@ csky_analyze_prologue (struct gdbarch *gdbarch,
adjust |= (1 << imm);
if (csky_debug)
{
- gdb_printf (gdb_stdlog,
- "csky: bseti r4,r4 %d\n", imm);
+ gdb_printf (gdb_stdlog, "csky: bseti r4,r4 %d\n",
+ imm);
}
}
else if (CSKY_32_IS_BCLRI4 (insn2))
@@ -1426,8 +1358,8 @@ csky_analyze_prologue (struct gdbarch *gdbarch,
adjust &= ~(1 << imm);
if (csky_debug)
{
- gdb_printf (gdb_stdlog,
- "csky: bclri r4,r4 %d\n", imm);
+ gdb_printf (gdb_stdlog, "csky: bclri r4,r4 %d\n",
+ imm);
}
}
else if (CSKY_32_IS_IXH4 (insn2))
@@ -1435,8 +1367,7 @@ csky_analyze_prologue (struct gdbarch *gdbarch,
adjust *= 3;
if (csky_debug)
{
- gdb_printf (gdb_stdlog,
- "csky: ixh r4,r4,r4\n");
+ gdb_printf (gdb_stdlog, "csky: ixh r4,r4,r4\n");
}
}
else if (CSKY_32_IS_IXW4 (insn2))
@@ -1444,8 +1375,7 @@ csky_analyze_prologue (struct gdbarch *gdbarch,
adjust *= 5;
if (csky_debug)
{
- gdb_printf (gdb_stdlog,
- "csky: ixw r4,r4,r4\n");
+ gdb_printf (gdb_stdlog, "csky: ixw r4,r4,r4\n");
}
}
else if (CSKY_16_IS_ADDI4 (insn2))
@@ -1454,8 +1384,7 @@ csky_analyze_prologue (struct gdbarch *gdbarch,
adjust += imm;
if (csky_debug)
{
- gdb_printf (gdb_stdlog,
- "csky: addi r4,%d\n", imm);
+ gdb_printf (gdb_stdlog, "csky: addi r4,%d\n", imm);
}
}
else if (CSKY_16_IS_SUBI4 (insn2))
@@ -1464,8 +1393,7 @@ csky_analyze_prologue (struct gdbarch *gdbarch,
adjust -= imm;
if (csky_debug)
{
- gdb_printf (gdb_stdlog,
- "csky: subi r4,%d\n", imm);
+ gdb_printf (gdb_stdlog, "csky: subi r4,%d\n", imm);
}
}
else if (CSKY_16_IS_NOR4 (insn2))
@@ -1473,8 +1401,7 @@ csky_analyze_prologue (struct gdbarch *gdbarch,
adjust = ~adjust;
if (csky_debug)
{
- gdb_printf (gdb_stdlog,
- "csky: nor r4,r4\n");
+ gdb_printf (gdb_stdlog, "csky: nor r4,r4\n");
}
}
else if (CSKY_16_IS_BSETI4 (insn2))
@@ -1483,8 +1410,7 @@ csky_analyze_prologue (struct gdbarch *gdbarch,
adjust |= (1 << imm);
if (csky_debug)
{
- gdb_printf (gdb_stdlog,
- "csky: bseti r4, %d\n", imm);
+ gdb_printf (gdb_stdlog, "csky: bseti r4, %d\n", imm);
}
}
else if (CSKY_16_IS_BCLRI4 (insn2))
@@ -1493,8 +1419,7 @@ csky_analyze_prologue (struct gdbarch *gdbarch,
adjust &= ~(1 << imm);
if (csky_debug)
{
- gdb_printf (gdb_stdlog,
- "csky: bclri r4, %d\n", imm);
+ gdb_printf (gdb_stdlog, "csky: bclri r4, %d\n", imm);
}
}
else if (CSKY_16_IS_LSLI4 (insn2))
@@ -1503,19 +1428,19 @@ csky_analyze_prologue (struct gdbarch *gdbarch,
adjust <<= imm;
if (csky_debug)
{
- gdb_printf (gdb_stdlog,
- "csky: lsli r4,r4, %d\n", imm);
+ gdb_printf (gdb_stdlog, "csky: lsli r4,r4, %d\n",
+ imm);
}
}
offset += insn_len;
- insn_len = csky_get_insn (gdbarch, addr + offset, &insn2);
+ insn_len = csky_get_insn (gdbarch, addr + offset, &insn2);
};
if (csky_debug)
{
gdb_printf (gdb_stdlog, "csky: done looking for"
- " r4 adjusters\n");
+ " r4 adjusters\n");
}
/* If the next insn adjusts the stack pointer, we keep
@@ -1529,12 +1454,12 @@ csky_analyze_prologue (struct gdbarch *gdbarch,
{
gdb_printf (gdb_stdlog,
"csky: found stack adjustment of"
- " 0x%x bytes.\n", adjust);
+ " 0x%x bytes.\n",
+ adjust);
gdb_printf (gdb_stdlog,
"csky: skipping to new address %s\n",
core_addr_to_string_nz (addr));
- gdb_printf (gdb_stdlog,
- "csky: continuing\n");
+ gdb_printf (gdb_stdlog, "csky: continuing\n");
}
continue;
}
@@ -1560,8 +1485,7 @@ csky_analyze_prologue (struct gdbarch *gdbarch,
int offset = CSKY_16_SUBI_IMM (insn);
if (csky_debug)
{
- gdb_printf (gdb_stdlog,
- "csky: got subi r0,%d; continuing\n",
+ gdb_printf (gdb_stdlog, "csky: got subi r0,%d; continuing\n",
offset);
}
stacksize += offset;
@@ -1598,7 +1522,7 @@ csky_analyze_prologue (struct gdbarch *gdbarch,
if (csky_debug)
print_savedreg_msg (15, register_offsets, false);
offset += 4;
- }
+ }
if (CSKY_16_PUSH_LIST1 (insn))
{
int num = CSKY_16_PUSH_LIST1 (insn);
@@ -1613,15 +1537,15 @@ csky_analyze_prologue (struct gdbarch *gdbarch,
}
for (rn = 4; rn <= 4 + num - 1; rn++)
{
- register_offsets[rn] = stacksize - tmp;
- if (csky_debug)
- {
- gdb_printf (gdb_stdlog,
- "csky: r%d saved at 0x%x"
- " (offset %d)\n", rn,
- register_offsets[rn], offset);
- }
- tmp += 4;
+ register_offsets[rn] = stacksize - tmp;
+ if (csky_debug)
+ {
+ gdb_printf (gdb_stdlog,
+ "csky: r%d saved at 0x%x"
+ " (offset %d)\n",
+ rn, register_offsets[rn], offset);
+ }
+ tmp += 4;
}
}
@@ -1637,27 +1561,26 @@ csky_analyze_prologue (struct gdbarch *gdbarch,
if (csky_debug)
{
- gdb_printf (gdb_stdlog,
- "csky: looking at large frame\n");
+ gdb_printf (gdb_stdlog, "csky: looking at large frame\n");
}
if (CSKY_16_IS_LRW4 (insn))
{
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
int offset = ((insn & 0x300) >> 3) | (insn & 0x1f);
- int literal_addr = (addr + ( offset << 2)) & 0xfffffffc;
+ int literal_addr = (addr + (offset << 2)) & 0xfffffffc;
adjust = read_memory_unsigned_integer (literal_addr, 4,
byte_order);
}
else
{
/* CSKY_16_IS_MOVI4 (insn). */
- adjust = (insn & 0xff);
+ adjust = (insn & 0xff);
}
if (csky_debug)
{
- gdb_printf (gdb_stdlog,
- "csky: base stacksize=0x%x\n", adjust);
+ gdb_printf (gdb_stdlog, "csky: base stacksize=0x%x\n",
+ adjust);
}
/* May have zero or more instructions which modify r4. */
@@ -1676,8 +1599,7 @@ csky_analyze_prologue (struct gdbarch *gdbarch,
adjust += imm;
if (csky_debug)
{
- gdb_printf (gdb_stdlog,
- "csky: addi r4,%d\n", imm);
+ gdb_printf (gdb_stdlog, "csky: addi r4,%d\n", imm);
}
}
else if (CSKY_32_IS_SUBI4 (insn2))
@@ -1686,8 +1608,7 @@ csky_analyze_prologue (struct gdbarch *gdbarch,
adjust -= imm;
if (csky_debug)
{
- gdb_printf (gdb_stdlog,
- "csky: subi r4,%d\n", imm);
+ gdb_printf (gdb_stdlog, "csky: subi r4,%d\n", imm);
}
}
else if (CSKY_32_IS_NOR4 (insn2))
@@ -1695,8 +1616,7 @@ csky_analyze_prologue (struct gdbarch *gdbarch,
adjust = ~adjust;
if (csky_debug)
{
- gdb_printf (gdb_stdlog,
- "csky: nor r4,r4,r4\n");
+ gdb_printf (gdb_stdlog, "csky: nor r4,r4,r4\n");
}
}
else if (CSKY_32_IS_ROTLI4 (insn2))
@@ -1707,8 +1627,8 @@ csky_analyze_prologue (struct gdbarch *gdbarch,
adjust |= temp;
if (csky_debug)
{
- gdb_printf (gdb_stdlog,
- "csky: rotli r4,r4,%d\n", imm);
+ gdb_printf (gdb_stdlog, "csky: rotli r4,r4,%d\n",
+ imm);
}
}
else if (CSKY_32_IS_LISI4 (insn2))
@@ -1717,8 +1637,8 @@ csky_analyze_prologue (struct gdbarch *gdbarch,
adjust <<= imm;
if (csky_debug)
{
- gdb_printf (gdb_stdlog,
- "csky: lsli r4,r4,%d\n", imm);
+ gdb_printf (gdb_stdlog, "csky: lsli r4,r4,%d\n",
+ imm);
}
}
else if (CSKY_32_IS_BSETI4 (insn2))
@@ -1727,8 +1647,8 @@ csky_analyze_prologue (struct gdbarch *gdbarch,
adjust |= (1 << imm);
if (csky_debug)
{
- gdb_printf (gdb_stdlog,
- "csky: bseti r4,r4 %d\n", imm);
+ gdb_printf (gdb_stdlog, "csky: bseti r4,r4 %d\n",
+ imm);
}
}
else if (CSKY_32_IS_BCLRI4 (insn2))
@@ -1737,8 +1657,8 @@ csky_analyze_prologue (struct gdbarch *gdbarch,
adjust &= ~(1 << imm);
if (csky_debug)
{
- gdb_printf (gdb_stdlog,
- "csky: bclri r4,r4 %d\n", imm);
+ gdb_printf (gdb_stdlog, "csky: bclri r4,r4 %d\n",
+ imm);
}
}
else if (CSKY_32_IS_IXH4 (insn2))
@@ -1746,8 +1666,7 @@ csky_analyze_prologue (struct gdbarch *gdbarch,
adjust *= 3;
if (csky_debug)
{
- gdb_printf (gdb_stdlog,
- "csky: ixh r4,r4,r4\n");
+ gdb_printf (gdb_stdlog, "csky: ixh r4,r4,r4\n");
}
}
else if (CSKY_32_IS_IXW4 (insn2))
@@ -1755,8 +1674,7 @@ csky_analyze_prologue (struct gdbarch *gdbarch,
adjust *= 5;
if (csky_debug)
{
- gdb_printf (gdb_stdlog,
- "csky: ixw r4,r4,r4\n");
+ gdb_printf (gdb_stdlog, "csky: ixw r4,r4,r4\n");
}
}
else if (CSKY_16_IS_ADDI4 (insn2))
@@ -1765,8 +1683,7 @@ csky_analyze_prologue (struct gdbarch *gdbarch,
adjust += imm;
if (csky_debug)
{
- gdb_printf (gdb_stdlog,
- "csky: addi r4,%d\n", imm);
+ gdb_printf (gdb_stdlog, "csky: addi r4,%d\n", imm);
}
}
else if (CSKY_16_IS_SUBI4 (insn2))
@@ -1775,8 +1692,7 @@ csky_analyze_prologue (struct gdbarch *gdbarch,
adjust -= imm;
if (csky_debug)
{
- gdb_printf (gdb_stdlog,
- "csky: subi r4,%d\n", imm);
+ gdb_printf (gdb_stdlog, "csky: subi r4,%d\n", imm);
}
}
else if (CSKY_16_IS_NOR4 (insn2))
@@ -1784,8 +1700,7 @@ csky_analyze_prologue (struct gdbarch *gdbarch,
adjust = ~adjust;
if (csky_debug)
{
- gdb_printf (gdb_stdlog,
- "csky: nor r4,r4\n");
+ gdb_printf (gdb_stdlog, "csky: nor r4,r4\n");
}
}
else if (CSKY_16_IS_BSETI4 (insn2))
@@ -1794,8 +1709,7 @@ csky_analyze_prologue (struct gdbarch *gdbarch,
adjust |= (1 << imm);
if (csky_debug)
{
- gdb_printf (gdb_stdlog,
- "csky: bseti r4, %d\n", imm);
+ gdb_printf (gdb_stdlog, "csky: bseti r4, %d\n", imm);
}
}
else if (CSKY_16_IS_BCLRI4 (insn2))
@@ -1804,8 +1718,7 @@ csky_analyze_prologue (struct gdbarch *gdbarch,
adjust &= ~(1 << imm);
if (csky_debug)
{
- gdb_printf (gdb_stdlog,
- "csky: bclri r4, %d\n", imm);
+ gdb_printf (gdb_stdlog, "csky: bclri r4, %d\n", imm);
}
}
else if (CSKY_16_IS_LSLI4 (insn2))
@@ -1814,8 +1727,8 @@ csky_analyze_prologue (struct gdbarch *gdbarch,
adjust <<= imm;
if (csky_debug)
{
- gdb_printf (gdb_stdlog,
- "csky: lsli r4,r4, %d\n", imm);
+ gdb_printf (gdb_stdlog, "csky: lsli r4,r4, %d\n",
+ imm);
}
}
@@ -1826,7 +1739,7 @@ csky_analyze_prologue (struct gdbarch *gdbarch,
if (csky_debug)
{
gdb_printf (gdb_stdlog, "csky: "
- "done looking for r4 adjusters\n");
+ "done looking for r4 adjusters\n");
}
/* If the next instruction adjusts the stack pointer, we keep
@@ -1838,10 +1751,13 @@ csky_analyze_prologue (struct gdbarch *gdbarch,
stacksize += adjust;
if (csky_debug)
{
- gdb_printf (gdb_stdlog, "csky: "
+ gdb_printf (gdb_stdlog,
+ "csky: "
"found stack adjustment of 0x%x"
- " bytes.\n", adjust);
- gdb_printf (gdb_stdlog, "csky: "
+ " bytes.\n",
+ adjust);
+ gdb_printf (gdb_stdlog,
+ "csky: "
"skipping to new address %s\n",
core_addr_to_string_nz (addr));
gdb_printf (gdb_stdlog, "csky: continuing\n");
@@ -1854,7 +1770,7 @@ csky_analyze_prologue (struct gdbarch *gdbarch,
if (csky_debug)
{
gdb_printf (gdb_stdlog, "csky: no subu sp,r4; "
- "NOT altering stacksize.\n");
+ "NOT altering stacksize.\n");
}
break;
}
@@ -1864,7 +1780,7 @@ csky_analyze_prologue (struct gdbarch *gdbarch,
if (csky_debug)
{
gdb_printf (gdb_stdlog, "csky: insn is not a prologue"
- " insn -- ending scan\n");
+ " insn -- ending scan\n");
}
break;
}
@@ -1878,15 +1794,15 @@ csky_analyze_prologue (struct gdbarch *gdbarch,
if (is_fp_saved)
{
this_cache->framereg = CSKY_FP_REGNUM;
- unwound_fp = get_frame_register_unsigned (this_frame,
- this_cache->framereg);
+ unwound_fp
+ = get_frame_register_unsigned (this_frame, this_cache->framereg);
this_cache->prev_sp = unwound_fp + adjust_fp;
}
else
{
this_cache->framereg = CSKY_SP_REGNUM;
- unwound_fp = get_frame_register_unsigned (this_frame,
- this_cache->framereg);
+ unwound_fp
+ = get_frame_register_unsigned (this_frame, this_cache->framereg);
this_cache->prev_sp = unwound_fp + stacksize;
}
@@ -1902,12 +1818,13 @@ csky_analyze_prologue (struct gdbarch *gdbarch,
{
CORE_ADDR rn_value = read_memory_unsigned_integer (
this_cache->saved_regs[rn].addr (), 4, byte_order);
- gdb_printf (gdb_stdlog, "Saved register %s "
- "stored at 0x%08lx, value=0x%08lx\n",
- csky_register_names[rn],
- (unsigned long)
- this_cache->saved_regs[rn].addr (),
- (unsigned long) rn_value);
+ gdb_printf (
+ gdb_stdlog,
+ "Saved register %s "
+ "stored at 0x%08lx, value=0x%08lx\n",
+ csky_register_names[rn],
+ (unsigned long) this_cache->saved_regs[rn].addr (),
+ (unsigned long) rn_value);
}
}
}
@@ -1988,8 +1905,8 @@ csky_skip_prologue (struct gdbarch *gdbarch, CORE_ADDR pc)
func_end = pc + default_search_limit;
/* Find the end of prologue. Default lr_type. */
- return csky_analyze_prologue (gdbarch, pc, func_end, func_end,
- NULL, NULL, LR_TYPE_R15);
+ return csky_analyze_prologue (gdbarch, pc, func_end, func_end, NULL, NULL,
+ LR_TYPE_R15);
}
/* Implement the breakpoint_kind_from_pc gdbarch method. */
@@ -2024,8 +1941,8 @@ csky_sw_breakpoint_from_kind (struct gdbarch *gdbarch, int kind, int *size)
/* Determine link register type. */
static lr_type_t
-csky_analyze_lr_type (struct gdbarch *gdbarch,
- CORE_ADDR start_pc, CORE_ADDR end_pc)
+csky_analyze_lr_type (struct gdbarch *gdbarch, CORE_ADDR start_pc,
+ CORE_ADDR end_pc)
{
CORE_ADDR addr;
unsigned int insn, insn_len;
@@ -2054,7 +1971,7 @@ csky_analyze_lr_type (struct gdbarch *gdbarch,
return LR_TYPE_R15;
}
}
- return LR_TYPE_R15;
+ return LR_TYPE_R15;
}
/* Heuristic unwinder. */
@@ -2082,8 +1999,8 @@ csky_frame_unwind_cache (frame_info_ptr this_frame)
prev_pc = get_frame_pc (this_frame);
block_addr = get_frame_address_in_block (this_frame);
- if (find_pc_partial_function (block_addr, NULL, &prologue_start,
- &func_end) == 0)
+ if (find_pc_partial_function (block_addr, NULL, &prologue_start, &func_end)
+ == 0)
/* We couldn't find a function containing block_addr, so bail out
and hope for the best. */
return cache;
@@ -2108,8 +2025,8 @@ csky_frame_unwind_cache (frame_info_ptr this_frame)
prologue_end = std::min (func_end, prev_pc);
/* Analyze the function prologue. */
- csky_analyze_prologue (gdbarch, prologue_start, prologue_end,
- func_end, this_frame, cache, lr_type);
+ csky_analyze_prologue (gdbarch, prologue_start, prologue_end, func_end,
+ this_frame, cache, lr_type);
/* gdbarch_sp_regnum contains the value and not the address. */
cache->saved_regs[sp_regnum].set_value (cache->prev_sp);
@@ -2119,8 +2036,8 @@ csky_frame_unwind_cache (frame_info_ptr this_frame)
/* Implement the this_id function for the normal unwinder. */
static void
-csky_frame_this_id (frame_info_ptr this_frame,
- void **this_prologue_cache, struct frame_id *this_id)
+csky_frame_this_id (frame_info_ptr this_frame, void **this_prologue_cache,
+ struct frame_id *this_id)
{
struct csky_unwind_cache *cache;
struct frame_id id;
@@ -2149,32 +2066,29 @@ csky_frame_prev_register (frame_info_ptr this_frame,
*this_prologue_cache = csky_frame_unwind_cache (this_frame);
cache = (struct csky_unwind_cache *) *this_prologue_cache;
- return trad_frame_get_prev_register (this_frame, cache->saved_regs,
- regnum);
+ return trad_frame_get_prev_register (this_frame, cache->saved_regs, regnum);
}
/* Data structures for the normal prologue-analysis-based
unwinder. */
-static const struct frame_unwind csky_unwind_cache = {
- "cski prologue",
- NORMAL_FRAME,
- default_frame_unwind_stop_reason,
- csky_frame_this_id,
- csky_frame_prev_register,
- NULL,
- default_frame_sniffer,
- NULL,
- NULL
-};
+static const struct frame_unwind csky_unwind_cache
+ = { "cski prologue",
+ NORMAL_FRAME,
+ default_frame_unwind_stop_reason,
+ csky_frame_this_id,
+ csky_frame_prev_register,
+ NULL,
+ default_frame_sniffer,
+ NULL,
+ NULL };
static CORE_ADDR
csky_check_long_branch (frame_info_ptr frame, CORE_ADDR pc)
{
gdb_byte buf[8];
struct gdbarch *gdbarch = get_frame_arch (frame);
- enum bfd_endian byte_order_for_code
- = gdbarch_byte_order_for_code (gdbarch);
+ enum bfd_endian byte_order_for_code = gdbarch_byte_order_for_code (gdbarch);
if (target_read_memory (pc, buf, 8) == 0)
{
@@ -2195,7 +2109,7 @@ csky_check_long_branch (frame_info_ptr frame, CORE_ADDR pc)
if ((data0 == CSKY_LRW_T1_PC_8) && (data1 == CSKY_JMP_T1_VS_NOP))
{
if (target_read_memory (pc + 8, buf, 4) == 0)
- return extract_unsigned_integer (buf, 4, byte_order_for_code);
+ return extract_unsigned_integer (buf, 4, byte_order_for_code);
}
return 0;
@@ -2218,8 +2132,7 @@ csky_stub_unwind_sniffer (const struct frame_unwind *self,
addr_in_block = get_frame_address_in_block (this_frame);
pc = get_frame_pc (this_frame);
- if (in_plt_section (addr_in_block)
- || target_read_memory (pc, dummy, 4) != 0)
+ if (in_plt_section (addr_in_block) || target_read_memory (pc, dummy, 4) != 0)
return 1;
/* Find the starting address and name of the function containing the PC. */
@@ -2249,9 +2162,8 @@ csky_make_stub_cache (frame_info_ptr this_frame)
}
static void
-csky_stub_this_id (frame_info_ptr this_frame,
- void **this_cache,
- struct frame_id *this_id)
+csky_stub_this_id (frame_info_ptr this_frame, void **this_cache,
+ struct frame_id *this_id)
{
struct csky_unwind_cache *cache;
@@ -2264,9 +2176,8 @@ csky_stub_this_id (frame_info_ptr this_frame,
}
static struct value *
-csky_stub_prev_register (frame_info_ptr this_frame,
- void **this_cache,
- int prev_regnum)
+csky_stub_prev_register (frame_info_ptr this_frame, void **this_cache,
+ int prev_regnum)
{
struct csky_unwind_cache *cache;
@@ -2290,15 +2201,13 @@ csky_stub_prev_register (frame_info_ptr this_frame,
prev_regnum);
}
-static frame_unwind csky_stub_unwind = {
- "csky stub",
- NORMAL_FRAME,
- default_frame_unwind_stop_reason,
- csky_stub_this_id,
- csky_stub_prev_register,
- NULL,
- csky_stub_unwind_sniffer
-};
+static frame_unwind csky_stub_unwind = { "csky stub",
+ NORMAL_FRAME,
+ default_frame_unwind_stop_reason,
+ csky_stub_this_id,
+ csky_stub_prev_register,
+ NULL,
+ csky_stub_unwind_sniffer };
/* Implement the this_base, this_locals, and this_args hooks
for the normal unwinder. */
@@ -2315,12 +2224,9 @@ csky_frame_base_address (frame_info_ptr this_frame, void **this_cache)
return cache->prev_sp - cache->framesize;
}
-static const struct frame_base csky_frame_base = {
- &csky_unwind_cache,
- csky_frame_base_address,
- csky_frame_base_address,
- csky_frame_base_address
-};
+static const struct frame_base csky_frame_base
+ = { &csky_unwind_cache, csky_frame_base_address, csky_frame_base_address,
+ csky_frame_base_address };
/* Initialize register access method. */
@@ -2378,22 +2284,18 @@ csky_register_reggroup_p (struct gdbarch *gdbarch, int regnum,
return raw_p;
if ((((regnum >= CSKY_R0_REGNUM) && (regnum <= CSKY_R0_REGNUM + 31))
- || (regnum == CSKY_PC_REGNUM)
- || (regnum == CSKY_EPC_REGNUM)
- || (regnum == CSKY_CR0_REGNUM)
- || (regnum == CSKY_EPSR_REGNUM))
+ || (regnum == CSKY_PC_REGNUM) || (regnum == CSKY_EPC_REGNUM)
+ || (regnum == CSKY_CR0_REGNUM) || (regnum == CSKY_EPSR_REGNUM))
&& (reggroup == general_reggroup))
return 1;
if (((regnum == CSKY_PC_REGNUM)
- || ((regnum >= CSKY_CR0_REGNUM)
- && (regnum <= CSKY_CR0_REGNUM + 30)))
+ || ((regnum >= CSKY_CR0_REGNUM) && (regnum <= CSKY_CR0_REGNUM + 30)))
&& (reggroup == cr_reggroup))
return 2;
if ((((regnum >= CSKY_VR0_REGNUM) && (regnum <= CSKY_VR0_REGNUM + 15))
- || ((regnum >= CSKY_FCR_REGNUM)
- && (regnum <= CSKY_FCR_REGNUM + 2)))
+ || ((regnum >= CSKY_FCR_REGNUM) && (regnum <= CSKY_FCR_REGNUM + 2)))
&& (reggroup == vr_reggroup))
return 3;
@@ -2401,8 +2303,7 @@ csky_register_reggroup_p (struct gdbarch *gdbarch, int regnum,
&& (reggroup == mmu_reggroup))
return 4;
- if (((regnum >= CSKY_PROFCR_REGNUM)
- && (regnum <= CSKY_PROFCR_REGNUM + 48))
+ if (((regnum >= CSKY_PROFCR_REGNUM) && (regnum <= CSKY_PROFCR_REGNUM + 48))
&& (reggroup == prof_reggroup))
return 5;
@@ -2414,7 +2315,7 @@ csky_register_reggroup_p (struct gdbarch *gdbarch, int regnum,
if (tdesc_has_registers (gdbarch_target_desc (gdbarch)))
{
if (tdesc_register_in_reggroup_p (gdbarch, regnum, reggroup) > 0)
- return 7;
+ return 7;
}
return 0;
@@ -2440,9 +2341,9 @@ csky_dwarf_reg_to_regnum (struct gdbarch *gdbarch, int dw_reg)
char name_buf[4];
xsnprintf (name_buf, sizeof (name_buf), "s%d",
- dw_reg - FV_PSEUDO_REGNO_FIRST);
+ dw_reg - FV_PSEUDO_REGNO_FIRST);
return user_reg_map_name_to_regnum (gdbarch, name_buf,
- strlen (name_buf));
+ strlen (name_buf));
}
/* Others, unknown. */
@@ -2454,14 +2355,11 @@ csky_dwarf_reg_to_regnum (struct gdbarch *gdbarch, int dw_reg)
static int
csky_essential_reg_check (const struct csky_supported_tdesc_register *reg)
{
- if ((strcmp (reg->name , "pc") == 0)
- && (reg->num == CSKY_PC_REGNUM))
+ if ((strcmp (reg->name, "pc") == 0) && (reg->num == CSKY_PC_REGNUM))
return CSKY_TDESC_REGS_PC_NUMBERED;
- else if ((strcmp (reg->name , "r14") == 0)
- && (reg->num == CSKY_SP_REGNUM))
+ else if ((strcmp (reg->name, "r14") == 0) && (reg->num == CSKY_SP_REGNUM))
return CSKY_TDESC_REGS_SP_NUMBERED;
- else if ((strcmp (reg->name , "r15") == 0)
- && (reg->num == CSKY_LR_REGNUM))
+ else if ((strcmp (reg->name, "r15") == 0) && (reg->num == CSKY_LR_REGNUM))
return CSKY_TDESC_REGS_LR_NUMBERED;
else
return 0;
@@ -2470,13 +2368,14 @@ csky_essential_reg_check (const struct csky_supported_tdesc_register *reg)
/* Check whether xml has discribled the fr0~fr15 regs. */
static int
-csky_fr0_fr15_reg_check (const struct csky_supported_tdesc_register *reg) {
+csky_fr0_fr15_reg_check (const struct csky_supported_tdesc_register *reg)
+{
int i = 0;
for (i = 0; i < 16; i++)
{
if ((strcmp (reg->name, csky_supported_fpu_regs[i].name) == 0)
- && (csky_supported_fpu_regs[i].num == reg->num))
- return (1 << i);
+ && (csky_supported_fpu_regs[i].num == reg->num))
+ return (1 << i);
}
return 0;
@@ -2485,13 +2384,14 @@ csky_fr0_fr15_reg_check (const struct csky_supported_tdesc_register *reg) {
/* Check whether xml has discribled the fr16~fr31 regs. */
static int
-csky_fr16_fr31_reg_check (const struct csky_supported_tdesc_register *reg) {
+csky_fr16_fr31_reg_check (const struct csky_supported_tdesc_register *reg)
+{
int i = 0;
for (i = 0; i < 16; i++)
{
if ((strcmp (reg->name, csky_supported_fpu_regs[i + 16].name) == 0)
- && (csky_supported_fpu_regs[i + 16].num == reg->num))
- return (1 << i);
+ && (csky_supported_fpu_regs[i + 16].num == reg->num))
+ return (1 << i);
}
return 0;
@@ -2500,13 +2400,14 @@ csky_fr16_fr31_reg_check (const struct csky_supported_tdesc_register *reg) {
/* Check whether xml has discribled the vr0~vr15 regs. */
static int
-csky_vr0_vr15_reg_check (const struct csky_supported_tdesc_register *reg) {
+csky_vr0_vr15_reg_check (const struct csky_supported_tdesc_register *reg)
+{
int i = 0;
for (i = 0; i < 16; i++)
{
if ((strcmp (reg->name, csky_supported_fpu_regs[i + 32].name) == 0)
- && (csky_supported_fpu_regs[i + 32].num == reg->num))
- return (1 << i);
+ && (csky_supported_fpu_regs[i + 32].num == reg->num))
+ return (1 << i);
}
return 0;
@@ -2518,41 +2419,39 @@ static const char *
csky_pseudo_register_name (struct gdbarch *gdbarch, int regno)
{
int num_regs = gdbarch_num_regs (gdbarch);
- csky_gdbarch_tdep *tdep
- = gdbarch_tdep<csky_gdbarch_tdep> (gdbarch);
+ csky_gdbarch_tdep *tdep = gdbarch_tdep<csky_gdbarch_tdep> (gdbarch);
regno -= num_regs;
if (tdep->fv_pseudo_registers_count)
{
static const char *const fv_pseudo_names[] = {
- "s0", "s1", "s2", "s3", "s4", "s5", "s6", "s7",
- "s8", "s9", "s10", "s11", "s12", "s13", "s14", "s15",
- "s16", "s17", "s18", "s19", "s20", "s21", "s22", "s23",
- "s24", "s25", "s26", "s27", "s28", "s29", "s30", "s31",
- "s32", "s33", "s34", "s35", "s36", "s37", "s38", "s39",
- "s40", "s41", "s42", "s43", "s44", "s45", "s46", "s47",
- "s48", "s49", "s50", "s51", "s52", "s53", "s54", "s55",
- "s56", "s57", "s58", "s59", "s60", "s61", "s62", "s63",
- "s64", "s65", "s66", "s67", "s68", "s69", "s70", "s71",
- "s72", "s73", "s74", "s75", "s76", "s77", "s78", "s79",
- "s80", "s81", "s82", "s83", "s84", "s85", "s86", "s87",
- "s88", "s89", "s90", "s91", "s92", "s93", "s94", "s95",
- "s96", "s97", "s98", "s99", "s100", "s101", "s102", "s103",
- "s104", "s105", "s106", "s107", "s108", "s109", "s110", "s111",
- "s112", "s113", "s114", "s115", "s116", "s117", "s118", "s119",
- "s120", "s121", "s122", "s123", "s124", "s125", "s126", "s127",
+ "s0", "s1", "s2", "s3", "s4", "s5", "s6", "s7", "s8",
+ "s9", "s10", "s11", "s12", "s13", "s14", "s15", "s16", "s17",
+ "s18", "s19", "s20", "s21", "s22", "s23", "s24", "s25", "s26",
+ "s27", "s28", "s29", "s30", "s31", "s32", "s33", "s34", "s35",
+ "s36", "s37", "s38", "s39", "s40", "s41", "s42", "s43", "s44",
+ "s45", "s46", "s47", "s48", "s49", "s50", "s51", "s52", "s53",
+ "s54", "s55", "s56", "s57", "s58", "s59", "s60", "s61", "s62",
+ "s63", "s64", "s65", "s66", "s67", "s68", "s69", "s70", "s71",
+ "s72", "s73", "s74", "s75", "s76", "s77", "s78", "s79", "s80",
+ "s81", "s82", "s83", "s84", "s85", "s86", "s87", "s88", "s89",
+ "s90", "s91", "s92", "s93", "s94", "s95", "s96", "s97", "s98",
+ "s99", "s100", "s101", "s102", "s103", "s104", "s105", "s106", "s107",
+ "s108", "s109", "s110", "s111", "s112", "s113", "s114", "s115", "s116",
+ "s117", "s118", "s119", "s120", "s121", "s122", "s123", "s124", "s125",
+ "s126", "s127",
};
if (regno < tdep->fv_pseudo_registers_count)
- {
- if ((regno < 64) && ((regno % 4) >= 2) && !tdep->has_vr0)
- return "";
- else if ((regno >= 64) && ((regno % 4) >= 2))
- return "";
- else
- return fv_pseudo_names[regno];
- }
+ {
+ if ((regno < 64) && ((regno % 4) >= 2) && !tdep->has_vr0)
+ return "";
+ else if ((regno >= 64) && ((regno % 4) >= 2))
+ return "";
+ else
+ return fv_pseudo_names[regno];
+ }
}
return "";
@@ -2562,12 +2461,11 @@ csky_pseudo_register_name (struct gdbarch *gdbarch, int regno)
static enum register_status
csky_pseudo_register_read (struct gdbarch *gdbarch,
- struct readable_regcache *regcache,
- int regnum, gdb_byte *buf)
+ struct readable_regcache *regcache, int regnum,
+ gdb_byte *buf)
{
int num_regs = gdbarch_num_regs (gdbarch);
- csky_gdbarch_tdep *tdep
- = gdbarch_tdep<csky_gdbarch_tdep> (gdbarch);
+ csky_gdbarch_tdep *tdep = gdbarch_tdep<csky_gdbarch_tdep> (gdbarch);
regnum -= num_regs;
@@ -2580,31 +2478,31 @@ csky_pseudo_register_read (struct gdbarch *gdbarch,
/* Ensure getting s0~s63 from vrx if tdep->has_vr0 is ture. */
if (tdep->has_vr0)
- {
- if (regnum < 64)
- {
- gdb_regnum = CSKY_VR0_REGNUM + (regnum / 4);
- offset = (regnum % 4) * 4;
- }
- else
- {
- gdb_regnum = CSKY_FR16_REGNUM + ((regnum - 64) / 4);
- if ((regnum % 4) >= 2)
- return REG_UNAVAILABLE;
- offset = (regnum % 2) * 4;
- }
- }
+ {
+ if (regnum < 64)
+ {
+ gdb_regnum = CSKY_VR0_REGNUM + (regnum / 4);
+ offset = (regnum % 4) * 4;
+ }
+ else
+ {
+ gdb_regnum = CSKY_FR16_REGNUM + ((regnum - 64) / 4);
+ if ((regnum % 4) >= 2)
+ return REG_UNAVAILABLE;
+ offset = (regnum % 2) * 4;
+ }
+ }
else
- {
- gdb_regnum = CSKY_FR0_REGNUM + (regnum / 4);
- if ((regnum % 4) >= 2)
- return REG_UNAVAILABLE;
- offset = (regnum % 2) * 4;
- }
+ {
+ gdb_regnum = CSKY_FR0_REGNUM + (regnum / 4);
+ if ((regnum % 4) >= 2)
+ return REG_UNAVAILABLE;
+ offset = (regnum % 2) * 4;
+ }
status = regcache->raw_read (gdb_regnum, reg_buf);
if (status == REG_VALID)
- memcpy (buf, reg_buf + offset, 4);
+ memcpy (buf, reg_buf + offset, 4);
return status;
}
@@ -2615,11 +2513,10 @@ csky_pseudo_register_read (struct gdbarch *gdbarch,
static void
csky_pseudo_register_write (struct gdbarch *gdbarch, struct regcache *regcache,
- int regnum, const gdb_byte *buf)
+ int regnum, const gdb_byte *buf)
{
int num_regs = gdbarch_num_regs (gdbarch);
- csky_gdbarch_tdep *tdep
- = gdbarch_tdep<csky_gdbarch_tdep> (gdbarch);
+ csky_gdbarch_tdep *tdep = gdbarch_tdep<csky_gdbarch_tdep> (gdbarch);
regnum -= num_regs;
@@ -2630,27 +2527,27 @@ csky_pseudo_register_write (struct gdbarch *gdbarch, struct regcache *regcache,
int offset = 0;
if (tdep->has_vr0)
- {
- if (regnum < 64)
- {
- gdb_regnum = CSKY_VR0_REGNUM + (regnum / 4);
- offset = (regnum % 4) * 4;
- }
- else
- {
- gdb_regnum = CSKY_FR16_REGNUM + ((regnum - 64) / 4);
- if ((regnum % 4) >= 2)
- return;
- offset = (regnum % 2) * 4;
- }
- }
+ {
+ if (regnum < 64)
+ {
+ gdb_regnum = CSKY_VR0_REGNUM + (regnum / 4);
+ offset = (regnum % 4) * 4;
+ }
+ else
+ {
+ gdb_regnum = CSKY_FR16_REGNUM + ((regnum - 64) / 4);
+ if ((regnum % 4) >= 2)
+ return;
+ offset = (regnum % 2) * 4;
+ }
+ }
else
- {
- gdb_regnum = CSKY_FR0_REGNUM + (regnum / 4);
- if ((regnum % 4) >= 2)
- return;
- offset = (regnum % 2) * 4;
- }
+ {
+ gdb_regnum = CSKY_FR0_REGNUM + (regnum / 4);
+ if ((regnum % 4) >= 2)
+ return;
+ offset = (regnum % 2) * 4;
+ }
regcache->raw_read (gdb_regnum, reg_buf);
memcpy (reg_buf + offset, buf, 4);
@@ -2688,71 +2585,72 @@ csky_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
int numbered = 0;
int index = 0;
int i = 0;
- int feature_names_count = ARRAY_SIZE (csky_supported_tdesc_feature_names);
+ int feature_names_count
+ = ARRAY_SIZE (csky_supported_tdesc_feature_names);
int support_tdesc_regs_count
- = csky_get_supported_tdesc_registers_count();
+ = csky_get_supported_tdesc_registers_count ();
const struct csky_supported_tdesc_register *tdesc_reg;
const struct tdesc_feature *feature;
tdesc_data = tdesc_data_alloc ();
- for (index = 0; index < feature_names_count; index ++)
- {
- feature = tdesc_find_feature (info.target_desc,
- csky_supported_tdesc_feature_names[index]);
- if (feature != NULL)
- {
- for (i = 0; i < support_tdesc_regs_count; i++)
- {
- tdesc_reg = csky_get_supported_register_by_index (i);
- if (!tdesc_reg)
- break;
- numbered = tdesc_numbered_register (feature, tdesc_data.get(),
- tdesc_reg->num,
- tdesc_reg->name);
- if (numbered) {
- valid_p |= csky_essential_reg_check (tdesc_reg);
- has_fr0 |= csky_fr0_fr15_reg_check (tdesc_reg);
- has_fr16 |= csky_fr16_fr31_reg_check (tdesc_reg);
- has_vr0 |= csky_vr0_vr15_reg_check (tdesc_reg);
- if (num_regs < tdesc_reg->num)
- num_regs = tdesc_reg->num;
- }
- }
- }
- }
+ for (index = 0; index < feature_names_count; index++)
+ {
+ feature
+ = tdesc_find_feature (info.target_desc,
+ csky_supported_tdesc_feature_names[index]);
+ if (feature != NULL)
+ {
+ for (i = 0; i < support_tdesc_regs_count; i++)
+ {
+ tdesc_reg = csky_get_supported_register_by_index (i);
+ if (!tdesc_reg)
+ break;
+ numbered
+ = tdesc_numbered_register (feature, tdesc_data.get (),
+ tdesc_reg->num,
+ tdesc_reg->name);
+ if (numbered)
+ {
+ valid_p |= csky_essential_reg_check (tdesc_reg);
+ has_fr0 |= csky_fr0_fr15_reg_check (tdesc_reg);
+ has_fr16 |= csky_fr16_fr31_reg_check (tdesc_reg);
+ has_vr0 |= csky_vr0_vr15_reg_check (tdesc_reg);
+ if (num_regs < tdesc_reg->num)
+ num_regs = tdesc_reg->num;
+ }
+ }
+ }
+ }
if (valid_p != CSKY_TDESC_REGS_ESSENTIAL_VALUE)
- return NULL;
+ return NULL;
}
/* When the type of bfd file is srec(or any files are not elf),
the E_FLAGS will be not credible. */
- if (info.abfd != NULL && bfd_get_flavour (info.abfd) == bfd_target_elf_flavour)
+ if (info.abfd != NULL
+ && bfd_get_flavour (info.abfd) == bfd_target_elf_flavour)
{
/* Get FPU, VDSP build options. */
- fpu_abi = bfd_elf_get_obj_attr_int (info.abfd,
- OBJ_ATTR_PROC,
- Tag_CSKY_FPU_ABI);
- vdsp_version = bfd_elf_get_obj_attr_int (info.abfd,
- OBJ_ATTR_PROC,
- Tag_CSKY_VDSP_VERSION);
- fpu_hardfp = bfd_elf_get_obj_attr_int (info.abfd,
- OBJ_ATTR_PROC,
- Tag_CSKY_FPU_HARDFP);
+ fpu_abi = bfd_elf_get_obj_attr_int (info.abfd, OBJ_ATTR_PROC,
+ Tag_CSKY_FPU_ABI);
+ vdsp_version = bfd_elf_get_obj_attr_int (info.abfd, OBJ_ATTR_PROC,
+ Tag_CSKY_VDSP_VERSION);
+ fpu_hardfp = bfd_elf_get_obj_attr_int (info.abfd, OBJ_ATTR_PROC,
+ Tag_CSKY_FPU_HARDFP);
}
/* Find a candidate among the list of pre-declared architectures. */
- for (arches = gdbarch_list_lookup_by_info (arches, &info);
- arches != NULL;
+ for (arches = gdbarch_list_lookup_by_info (arches, &info); arches != NULL;
arches = gdbarch_list_lookup_by_info (arches->next, &info))
{
csky_gdbarch_tdep *tdep
= gdbarch_tdep<csky_gdbarch_tdep> (arches->gdbarch);
if (fpu_abi != tdep->fpu_abi)
- continue;
+ continue;
if (vdsp_version != tdep->vdsp_version)
- continue;
+ continue;
if (fpu_hardfp != tdep->fpu_hardfp)
- continue;
+ continue;
/* Found a match. */
return arches->gdbarch;
@@ -2771,28 +2669,28 @@ csky_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
if (tdesc_data != NULL)
{
if ((has_vr0 == CSKY_FULL16_ONEHOT_VALUE)
- && (has_fr16 == CSKY_FULL16_ONEHOT_VALUE))
- {
- tdep->has_vr0 = 1;
- tdep->fv_pseudo_registers_count = 128;
- }
+ && (has_fr16 == CSKY_FULL16_ONEHOT_VALUE))
+ {
+ tdep->has_vr0 = 1;
+ tdep->fv_pseudo_registers_count = 128;
+ }
else if ((has_vr0 == CSKY_FULL16_ONEHOT_VALUE)
- && (has_fr16 != CSKY_FULL16_ONEHOT_VALUE))
- {
- tdep->has_vr0 = 1;
- tdep->fv_pseudo_registers_count = 64;
- }
+ && (has_fr16 != CSKY_FULL16_ONEHOT_VALUE))
+ {
+ tdep->has_vr0 = 1;
+ tdep->fv_pseudo_registers_count = 64;
+ }
else if ((has_fr0 == CSKY_FULL16_ONEHOT_VALUE)
- && (has_vr0 != CSKY_FULL16_ONEHOT_VALUE))
- {
- tdep->has_vr0 = 0;
- tdep->fv_pseudo_registers_count = 64;
- }
+ && (has_vr0 != CSKY_FULL16_ONEHOT_VALUE))
+ {
+ tdep->has_vr0 = 0;
+ tdep->fv_pseudo_registers_count = 64;
+ }
else
- {
- tdep->has_vr0 = 0;
- tdep->fv_pseudo_registers_count = 0;
- }
+ {
+ tdep->has_vr0 = 0;
+ tdep->fv_pseudo_registers_count = 0;
+ }
}
else
{
@@ -2859,18 +2757,14 @@ csky_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
set_gdbarch_num_regs (gdbarch, (num_regs + 1));
tdesc_use_registers (gdbarch, info.target_desc, std::move (tdesc_data));
set_gdbarch_register_type (gdbarch, csky_register_type);
- set_gdbarch_register_reggroup_p (gdbarch,
- csky_register_reggroup_p);
+ set_gdbarch_register_reggroup_p (gdbarch, csky_register_reggroup_p);
}
if (tdep->fv_pseudo_registers_count)
{
- set_gdbarch_num_pseudo_regs (gdbarch,
- tdep->fv_pseudo_registers_count);
- set_gdbarch_pseudo_register_read (gdbarch,
- csky_pseudo_register_read);
- set_gdbarch_pseudo_register_write (gdbarch,
- csky_pseudo_register_write);
+ set_gdbarch_num_pseudo_regs (gdbarch, tdep->fv_pseudo_registers_count);
+ set_gdbarch_pseudo_register_read (gdbarch, csky_pseudo_register_read);
+ set_gdbarch_pseudo_register_write (gdbarch, csky_pseudo_register_write);
set_tdesc_pseudo_register_name (gdbarch, csky_pseudo_register_name);
}
@@ -2878,20 +2772,18 @@ csky_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
}
void _initialize_csky_tdep ();
+
void
_initialize_csky_tdep ()
{
-
gdbarch_register (bfd_arch_csky, csky_gdbarch_init);
csky_init_reggroup ();
/* Allow debugging this file's internals. */
add_setshow_boolean_cmd ("csky", class_maintenance, &csky_debug,
- _("Set C-Sky debugging."),
- _("Show C-Sky debugging."),
- _("When on, C-Sky specific debugging is enabled."),
- NULL,
- NULL,
- &setdebuglist, &showdebuglist);
+ _ ("Set C-Sky debugging."),
+ _ ("Show C-Sky debugging."),
+ _ ("When on, C-Sky specific debugging is enabled."),
+ NULL, NULL, &setdebuglist, &showdebuglist);
}
diff --git a/gdb/csky-tdep.h b/gdb/csky-tdep.h
index b7715dec347..1208a637a35 100644
--- a/gdb/csky-tdep.h
+++ b/gdb/csky-tdep.h
@@ -103,17 +103,17 @@ enum csky_regnum
#define CSKY_CRBANK_NUM_REGS 32
/* Tdesc registers essential check. */
-#define CSKY_TDESC_REGS_PC_NUMBERED (1 << 0)
-#define CSKY_TDESC_REGS_SP_NUMBERED (1 << 1)
-#define CSKY_TDESC_REGS_LR_NUMBERED (1 << 2)
-#define CSKY_TDESC_REGS_ESSENTIAL_VALUE (7)
+#define CSKY_TDESC_REGS_PC_NUMBERED (1 << 0)
+#define CSKY_TDESC_REGS_SP_NUMBERED (1 << 1)
+#define CSKY_TDESC_REGS_LR_NUMBERED (1 << 2)
+#define CSKY_TDESC_REGS_ESSENTIAL_VALUE (7)
/* For fr0~fr15, fr16~fr31, vr0~vr15 check. */
-#define CSKY_FULL16_ONEHOT_VALUE 0xffff
+#define CSKY_FULL16_ONEHOT_VALUE 0xffff
/* Define for CSKY FV pseudo regs for dwarf regs. */
-#define FV_PSEUDO_REGNO_FIRST 74
-#define FV_PSEUDO_REGNO_LAST 201
+#define FV_PSEUDO_REGNO_FIRST 74
+#define FV_PSEUDO_REGNO_LAST 201
/* Number of processor registers w/o ICE registers. */
#define CSKY_NUM_REGS (CSKY_MAX_REGS - CSKY_CRBANK_NUM_REGS)
@@ -251,7 +251,7 @@ enum csky_regnum
#define CSKY_32_IS_PUSH(insn) ((insn & 0xfffffe00) == 0xebe00000)
#define CSKY_32_IS_PUSH_R29(insn) ((insn & 0x100) == 0x100)
#define CSKY_32_IS_PUSH_R15(insn) ((insn & 0x10) == 0x10)
-#define CSKY_32_PUSH_LIST1(insn) (insn & 0xf) /* r4 - r11. */
+#define CSKY_32_PUSH_LIST1(insn) (insn & 0xf) /* r4 - r11. */
#define CSKY_32_PUSH_LIST2(insn) ((insn & 0xe0) >> 5) /* r16 - r17. */
/* pop32. */
@@ -285,7 +285,7 @@ enum csky_regnum
/* subu sp, r4. */
#define CSKY_16_IS_SUBU4(x) ((x) == 0x6392)
-#define CSKY_16_IS_R4_ADJUSTER(x) \
+#define CSKY_16_IS_R4_ADJUSTER(x) \
(CSKY_16_IS_ADDI4 (x) || CSKY_16_IS_SUBI4 (x) || CSKY_16_IS_BSETI4 (x) \
|| CSKY_16_IS_BCLRI4 (x) || CSKY_16_IS_NOR4 (x) || CSKY_16_IS_LSLI4 (x))
@@ -319,12 +319,12 @@ enum csky_regnum
/* subu32 sp, sp, r4. */
#define CSKY_32_IS_SUBU4(x) ((x) == 0xc48e008e)
-#define CSKY_32_IS_R4_ADJUSTER(x) \
+#define CSKY_32_IS_R4_ADJUSTER(x) \
(CSKY_32_IS_ADDI4 (x) || CSKY_32_IS_SUBI4 (x) || CSKY_32_IS_ROTLI4 (x) \
- || CSKY_32_IS_IXH4 (x) || CSKY_32_IS_IXW4 (x) || CSKY_32_IS_NOR4 (x) \
+ || CSKY_32_IS_IXH4 (x) || CSKY_32_IS_IXW4 (x) || CSKY_32_IS_NOR4 (x) \
|| CSKY_32_IS_BSETI4 (x) || CSKY_32_IS_BCLRI4 (x) || CSKY_32_IS_LISI4 (x))
-#define CSKY_IS_R4_ADJUSTER(x) \
+#define CSKY_IS_R4_ADJUSTER(x) \
(CSKY_32_IS_R4_ADJUSTER (x) || CSKY_16_IS_R4_ADJUSTER (x))
#define CSKY_IS_SUBU4(x) (CSKY_32_IS_SUBU4 (x) || CSKY_16_IS_SUBU4 (x))
@@ -347,9 +347,9 @@ enum csky_regnum
#define CSKY_16_IS_BR(insn) ((insn & 0xfc00) == 0x0400)
#define CSKY_32_IS_BR(insn) ((insn & 0xffff0000) == 0xe8000000)
-#define CSKY_16_IS_MOV_FP_SP(insn) (insn == 0x6e3b) /* mov r8, r14. */
+#define CSKY_16_IS_MOV_FP_SP(insn) (insn == 0x6e3b) /* mov r8, r14. */
#define CSKY_32_IS_MOV_FP_SP(insn) (insn == 0xc40e4828) /* mov r8, r14. */
-#define CSKY_16_IS_MOV_SP_FP(insn) (insn == 0x6fa3) /* mov r14, r8. */
+#define CSKY_16_IS_MOV_SP_FP(insn) (insn == 0x6fa3) /* mov r14, r8. */
#define CSKY_32_INSN_MASK 0xc000
#define CSKY_BKPT_INSN 0x0
#define CSKY_NUM_GREGS 32
@@ -380,14 +380,14 @@ enum csky_regnum
#define CSKY_TRAP_0 0x2020c000
/* Sizeof (tls) */
-#define CSKY_SIGCONTEXT_PT_REGS_TLS 4
+#define CSKY_SIGCONTEXT_PT_REGS_TLS 4
/* Macro for kernel 4.x */
#define CSKY_MOVI_R7_139 0x008bea07
/* Macro for check long branch. */
-#define CSKY_JMPI_PC_4 0x1eac0
-#define CSKY_LRW_T1_PC_8 0x2ea8d
-#define CSKY_JMP_T1_VS_NOP 0x6c037834
+#define CSKY_JMPI_PC_4 0x1eac0
+#define CSKY_LRW_T1_PC_8 0x2ea8d
+#define CSKY_JMP_T1_VS_NOP 0x6c037834
#endif
diff --git a/gdb/ctfread.c b/gdb/ctfread.c
index 69906c9cb2e..947983da252 100644
--- a/gdb/ctfread.c
+++ b/gdb/ctfread.c
@@ -91,7 +91,11 @@ static const registry<objfile>::key<htab, htab_deleter> ctf_tid_key;
struct ctf_fp_info
{
- explicit ctf_fp_info (ctf_dict_t *cfp) : fp (cfp) {}
+ explicit ctf_fp_info (ctf_dict_t *cfp)
+ : fp (cfp)
+ {
+ }
+
~ctf_fp_info ();
ctf_dict_t *fp;
};
@@ -124,10 +128,8 @@ struct ctf_context
/* A partial symtab, specialized for this module. */
struct ctf_psymtab : public standard_psymtab
{
- ctf_psymtab (const char *filename,
- psymtab_storage *partial_symtabs,
- objfile_per_bfd_storage *objfile_per_bfd,
- CORE_ADDR addr)
+ ctf_psymtab (const char *filename, psymtab_storage *partial_symtabs,
+ objfile_per_bfd_storage *objfile_per_bfd, CORE_ADDR addr)
: standard_psymtab (filename, partial_symtabs, objfile_per_bfd, addr)
{
}
@@ -144,7 +146,9 @@ struct ctf_psymtab : public standard_psymtab
struct ctf_nextfield
{
- struct field field {};
+ struct field field
+ {
+ };
};
struct ctf_field_info
@@ -217,8 +221,7 @@ struct ctf_tid_and_type
static hashval_t
tid_and_type_hash (const void *item)
{
- const struct ctf_tid_and_type *ids
- = (const struct ctf_tid_and_type *) item;
+ const struct ctf_tid_and_type *ids = (const struct ctf_tid_and_type *) item;
return ids->tid;
}
@@ -246,9 +249,8 @@ set_tid_type (struct objfile *of, ctf_id_t tid, struct type *typ)
htab = ctf_tid_key.get (of);
if (htab == NULL)
{
- htab = htab_create_alloc (1, tid_and_type_hash,
- tid_and_type_eq,
- NULL, xcalloc, xfree);
+ htab = htab_create_alloc (1, tid_and_type_hash, tid_and_type_eq, NULL,
+ xcalloc, xfree);
ctf_tid_key.set (of, htab);
}
@@ -310,8 +312,7 @@ get_bitsize (ctf_dict_t *fp, ctf_id_t tid, uint32_t kind)
{
ctf_encoding_t cet;
- if ((kind == CTF_K_INTEGER || kind == CTF_K_ENUM
- || kind == CTF_K_FLOAT)
+ if ((kind == CTF_K_INTEGER || kind == CTF_K_ENUM || kind == CTF_K_FLOAT)
&& ctf_type_reference (fp, tid) != CTF_ERR
&& ctf_type_encoding (fp, tid, &cet) != CTF_ERR)
return cet.cte_bits;
@@ -347,8 +348,8 @@ attach_fields_to_type (struct ctf_field_info *fip, struct type *type)
/* Record the field count, allocate space for the array of fields. */
type->set_num_fields (nfields);
- type->set_fields
- ((struct field *) TYPE_ZALLOC (type, sizeof (struct field) * nfields));
+ type->set_fields ((struct field *) TYPE_ZALLOC (type, sizeof (struct field)
+ * nfields));
/* Copy the saved-up fields into the field vector. */
for (int i = 0; i < nfields; ++i)
@@ -363,9 +364,7 @@ attach_fields_to_type (struct ctf_field_info *fip, struct type *type)
it to guess the correct format if necessary. */
static struct type *
-ctf_init_float_type (struct objfile *objfile,
- int bits,
- const char *name,
+ctf_init_float_type (struct objfile *objfile, int bits, const char *name,
const char *name_hint)
{
struct gdbarch *gdbarch = objfile->arch ();
@@ -386,9 +385,7 @@ ctf_init_float_type (struct objfile *objfile,
and ARG contains the ctf_field_info. */
static int
-ctf_add_member_cb (const char *name,
- ctf_id_t tid,
- unsigned long offset,
+ctf_add_member_cb (const char *name, ctf_id_t tid, unsigned long offset,
void *arg)
{
struct ctf_field_info *fip = (struct ctf_field_info *) arg;
@@ -408,7 +405,7 @@ ctf_add_member_cb (const char *name,
t = read_type_record (ccp, tid);
if (t == nullptr)
{
- complaint (_("ctf_add_member_cb: %s has NO type (%ld)"), name, tid);
+ complaint (_ ("ctf_add_member_cb: %s has NO type (%ld)"), name, tid);
t = objfile_type (ccp->of)->builtin_error;
set_tid_type (ccp->of, tid, t);
}
@@ -488,35 +485,35 @@ new_symbol (struct ctf_context *ccp, struct type *type, ctf_id_t tid)
uint32_t kind = ctf_type_kind (fp, tid);
switch (kind)
{
- case CTF_K_STRUCT:
- case CTF_K_UNION:
- case CTF_K_ENUM:
- sym->set_aclass_index (LOC_TYPEDEF);
- sym->set_domain (STRUCT_DOMAIN);
- break;
- case CTF_K_FUNCTION:
- sym->set_aclass_index (LOC_STATIC);
- set_symbol_address (objfile, sym, sym->linkage_name ());
- break;
- case CTF_K_CONST:
- if (sym->type ()->code () == TYPE_CODE_VOID)
- sym->set_type (objfile_type (objfile)->builtin_int);
- break;
- case CTF_K_TYPEDEF:
- case CTF_K_INTEGER:
- case CTF_K_FLOAT:
- sym->set_aclass_index (LOC_TYPEDEF);
- sym->set_domain (VAR_DOMAIN);
- break;
- case CTF_K_POINTER:
- break;
- case CTF_K_VOLATILE:
- case CTF_K_RESTRICT:
- break;
- case CTF_K_SLICE:
- case CTF_K_ARRAY:
- case CTF_K_UNKNOWN:
- break;
+ case CTF_K_STRUCT:
+ case CTF_K_UNION:
+ case CTF_K_ENUM:
+ sym->set_aclass_index (LOC_TYPEDEF);
+ sym->set_domain (STRUCT_DOMAIN);
+ break;
+ case CTF_K_FUNCTION:
+ sym->set_aclass_index (LOC_STATIC);
+ set_symbol_address (objfile, sym, sym->linkage_name ());
+ break;
+ case CTF_K_CONST:
+ if (sym->type ()->code () == TYPE_CODE_VOID)
+ sym->set_type (objfile_type (objfile)->builtin_int);
+ break;
+ case CTF_K_TYPEDEF:
+ case CTF_K_INTEGER:
+ case CTF_K_FLOAT:
+ sym->set_aclass_index (LOC_TYPEDEF);
+ sym->set_domain (VAR_DOMAIN);
+ break;
+ case CTF_K_POINTER:
+ break;
+ case CTF_K_VOLATILE:
+ case CTF_K_RESTRICT:
+ break;
+ case CTF_K_SLICE:
+ case CTF_K_ARRAY:
+ case CTF_K_UNKNOWN:
+ break;
}
add_symbol_to_list (sym, ccp->builder->get_file_symbols ());
@@ -540,7 +537,7 @@ read_base_type (struct ctf_context *ccp, ctf_id_t tid)
if (ctf_type_encoding (fp, tid, &cet))
{
- complaint (_("ctf_type_encoding read_base_type failed - %s"),
+ complaint (_ ("ctf_type_encoding read_base_type failed - %s"),
ctf_errmsg (ctf_errno (fp)));
return nullptr;
}
@@ -550,7 +547,7 @@ read_base_type (struct ctf_context *ccp, ctf_id_t tid)
{
name = ctf_type_aname (fp, tid);
if (name == nullptr)
- complaint (_("ctf_type_aname read_base_type failed - %s"),
+ complaint (_ ("ctf_type_aname read_base_type failed - %s"),
ctf_errmsg (ctf_errno (fp)));
}
@@ -566,8 +563,8 @@ read_base_type (struct ctf_context *ccp, ctf_id_t tid)
if (ischar)
type = init_character_type (of, TARGET_CHAR_BIT, !issigned, name);
else if (isbool)
- type = init_boolean_type (of, gdbarch_int_bit (gdbarch),
- !issigned, name);
+ type
+ = init_boolean_type (of, gdbarch_int_bit (gdbarch), !issigned, name);
else
{
int bits;
@@ -582,8 +579,8 @@ read_base_type (struct ctf_context *ccp, ctf_id_t tid)
{
uint32_t isflt;
isflt = !((cet.cte_format & CTF_FP_IMAGRY) == CTF_FP_IMAGRY
- || (cet.cte_format & CTF_FP_DIMAGRY) == CTF_FP_DIMAGRY
- || (cet.cte_format & CTF_FP_LDIMAGRY) == CTF_FP_LDIMAGRY);
+ || (cet.cte_format & CTF_FP_DIMAGRY) == CTF_FP_DIMAGRY
+ || (cet.cte_format & CTF_FP_LDIMAGRY) == CTF_FP_LDIMAGRY);
if (isflt)
type = ctf_init_float_type (of, cet.cte_bits, name, name);
else
@@ -595,7 +592,7 @@ read_base_type (struct ctf_context *ccp, ctf_id_t tid)
}
else
{
- complaint (_("read_base_type: unsupported base kind (%d)"), kind);
+ complaint (_ ("read_base_type: unsupported base kind (%d)"), kind);
type = init_type (of, TYPE_CODE_ERROR, cet.cte_bits, name);
}
@@ -651,15 +648,14 @@ read_structure_type (struct ctf_context *ccp, ctf_id_t tid)
and create the symbol for it. */
static void
-process_struct_members (struct ctf_context *ccp,
- ctf_id_t tid,
+process_struct_members (struct ctf_context *ccp, ctf_id_t tid,
struct type *type)
{
struct ctf_field_info fi;
fi.cur_context = ccp;
if (ctf_member_iter (ccp->fp, tid, ctf_add_member_cb, &fi) == CTF_ERR)
- complaint (_("ctf_member_iter process_struct_members failed - %s"),
+ complaint (_ ("ctf_member_iter process_struct_members failed - %s"),
ctf_errmsg (ctf_errno (ccp->fp)));
/* Attach fields to the type. */
@@ -694,7 +690,7 @@ read_func_kind_type (struct ctf_context *ccp, ctf_id_t tid)
if (ctf_func_type_info (fp, tid, &cfi) < 0)
{
const char *fname = ctf_type_name_raw (fp, tid);
- error (_("Error getting function type info: %s"),
+ error (_ ("Error getting function type info: %s"),
fname == nullptr ? "noname" : fname);
}
rettype = fetch_tid_type (ccp, cfi.ctc_return);
@@ -713,8 +709,8 @@ read_func_kind_type (struct ctf_context *ccp, ctf_id_t tid)
if (ctf_func_type_args (fp, tid, argc, argv.data ()) == CTF_ERR)
return nullptr;
- type->set_fields
- ((struct field *) TYPE_ZALLOC (type, argc * sizeof (struct field)));
+ type->set_fields ((struct field *)
+ TYPE_ZALLOC (type, argc * sizeof (struct field)));
struct type *void_type = objfile_type (of)->builtin_void;
/* If failed to find the argument type, fill it with void_type. */
for (int iparam = 0; iparam < argc; iparam++)
@@ -766,7 +762,7 @@ process_enum_type (struct ctf_context *ccp, ctf_id_t tid)
fi.cur_context = ccp;
fi.ptype = type;
if (ctf_enum_iter (ccp->fp, tid, ctf_add_enum_member_cb, &fi) == CTF_ERR)
- complaint (_("ctf_enum_iter process_enum_type failed - %s"),
+ complaint (_ ("ctf_enum_iter process_enum_type failed - %s"),
ctf_errmsg (ctf_errno (ccp->fp)));
/* Attach fields to the type. */
@@ -778,11 +774,8 @@ process_enum_type (struct ctf_context *ccp, ctf_id_t tid)
/* Add given cv-qualifiers CNST+VOLTL to the BASE_TYPE of array TID. */
static struct type *
-add_array_cv_type (struct ctf_context *ccp,
- ctf_id_t tid,
- struct type *base_type,
- int cnst,
- int voltl)
+add_array_cv_type (struct ctf_context *ccp, ctf_id_t tid,
+ struct type *base_type, int cnst, int voltl)
{
struct type *el_type, *inner_array;
@@ -816,7 +809,7 @@ read_array_type (struct ctf_context *ccp, ctf_id_t tid)
if (ctf_array_info (fp, tid, &ar) == CTF_ERR)
{
- complaint (_("ctf_array_info read_array_type failed - %s"),
+ complaint (_ ("ctf_array_info read_array_type failed - %s"),
ctf_errmsg (ctf_errno (fp)));
return nullptr;
}
@@ -831,7 +824,7 @@ read_array_type (struct ctf_context *ccp, ctf_id_t tid)
range_type = create_static_range_type (NULL, idx_type, 0, ar.ctr_nelems - 1);
type = create_array_type (NULL, element_type, range_type);
- if (ar.ctr_nelems <= 1) /* Check if undefined upper bound. */
+ if (ar.ctr_nelems <= 1) /* Check if undefined upper bound. */
{
range_type->bounds ()->high.set_undefined ();
type->set_length (0);
@@ -859,7 +852,7 @@ read_const_type (struct ctf_context *ccp, ctf_id_t tid, ctf_id_t btid)
base_type = read_type_record (ccp, btid);
if (base_type == nullptr)
{
- complaint (_("read_const_type: NULL base type (%ld)"), btid);
+ complaint (_ ("read_const_type: NULL base type (%ld)"), btid);
base_type = objfile_type (objfile)->builtin_error;
}
}
@@ -883,7 +876,7 @@ read_volatile_type (struct ctf_context *ccp, ctf_id_t tid, ctf_id_t btid)
base_type = read_type_record (ccp, btid);
if (base_type == nullptr)
{
- complaint (_("read_volatile_type: NULL base type (%ld)"), btid);
+ complaint (_ ("read_volatile_type: NULL base type (%ld)"), btid);
base_type = objfile_type (objfile)->builtin_error;
}
}
@@ -909,7 +902,7 @@ read_restrict_type (struct ctf_context *ccp, ctf_id_t tid, ctf_id_t btid)
base_type = read_type_record (ccp, btid);
if (base_type == nullptr)
{
- complaint (_("read_restrict_type: NULL base type (%ld)"), btid);
+ complaint (_ ("read_restrict_type: NULL base type (%ld)"), btid);
base_type = objfile_type (objfile)->builtin_error;
}
}
@@ -921,8 +914,8 @@ read_restrict_type (struct ctf_context *ccp, ctf_id_t tid, ctf_id_t btid)
/* Read TID of kind CTF_K_TYPEDEF with its NAME and base type BTID. */
static struct type *
-read_typedef_type (struct ctf_context *ccp, ctf_id_t tid,
- ctf_id_t btid, const char *name)
+read_typedef_type (struct ctf_context *ccp, ctf_id_t tid, ctf_id_t btid,
+ const char *name)
{
struct objfile *objfile = ccp->of;
struct type *this_type, *target_type;
@@ -955,7 +948,7 @@ read_pointer_type (struct ctf_context *ccp, ctf_id_t tid, ctf_id_t btid)
target_type = read_type_record (ccp, btid);
if (target_type == nullptr)
{
- complaint (_("read_pointer_type: NULL target type (%ld)"), btid);
+ complaint (_ ("read_pointer_type: NULL target type (%ld)"), btid);
target_type = objfile_type (ccp->of)->builtin_error;
}
}
@@ -1007,53 +1000,53 @@ read_type_record (struct ctf_context *ccp, ctf_id_t tid)
kind = ctf_type_kind (fp, tid);
switch (kind)
{
- case CTF_K_STRUCT:
- case CTF_K_UNION:
- type = read_structure_type (ccp, tid);
- break;
- case CTF_K_ENUM:
- type = read_enum_type (ccp, tid);
- break;
- case CTF_K_FUNCTION:
- type = read_func_kind_type (ccp, tid);
- break;
- case CTF_K_CONST:
- btid = ctf_type_reference (fp, tid);
- type = read_const_type (ccp, tid, btid);
- break;
- case CTF_K_TYPEDEF:
- {
- const char *name = ctf_type_name_raw (fp, tid);
- btid = ctf_type_reference (fp, tid);
- type = read_typedef_type (ccp, tid, btid, name);
- }
- break;
- case CTF_K_VOLATILE:
- btid = ctf_type_reference (fp, tid);
- type = read_volatile_type (ccp, tid, btid);
- break;
- case CTF_K_RESTRICT:
+ case CTF_K_STRUCT:
+ case CTF_K_UNION:
+ type = read_structure_type (ccp, tid);
+ break;
+ case CTF_K_ENUM:
+ type = read_enum_type (ccp, tid);
+ break;
+ case CTF_K_FUNCTION:
+ type = read_func_kind_type (ccp, tid);
+ break;
+ case CTF_K_CONST:
+ btid = ctf_type_reference (fp, tid);
+ type = read_const_type (ccp, tid, btid);
+ break;
+ case CTF_K_TYPEDEF:
+ {
+ const char *name = ctf_type_name_raw (fp, tid);
btid = ctf_type_reference (fp, tid);
- type = read_restrict_type (ccp, tid, btid);
- break;
- case CTF_K_POINTER:
- btid = ctf_type_reference (fp, tid);
- type = read_pointer_type (ccp, tid, btid);
- break;
- case CTF_K_INTEGER:
- case CTF_K_FLOAT:
- type = read_base_type (ccp, tid);
- break;
- case CTF_K_ARRAY:
- type = read_array_type (ccp, tid);
- break;
- case CTF_K_FORWARD:
- type = read_forward_type (ccp, tid);
- break;
- case CTF_K_UNKNOWN:
- break;
- default:
- break;
+ type = read_typedef_type (ccp, tid, btid, name);
+ }
+ break;
+ case CTF_K_VOLATILE:
+ btid = ctf_type_reference (fp, tid);
+ type = read_volatile_type (ccp, tid, btid);
+ break;
+ case CTF_K_RESTRICT:
+ btid = ctf_type_reference (fp, tid);
+ type = read_restrict_type (ccp, tid, btid);
+ break;
+ case CTF_K_POINTER:
+ btid = ctf_type_reference (fp, tid);
+ type = read_pointer_type (ccp, tid, btid);
+ break;
+ case CTF_K_INTEGER:
+ case CTF_K_FLOAT:
+ type = read_base_type (ccp, tid);
+ break;
+ case CTF_K_ARRAY:
+ type = read_array_type (ccp, tid);
+ break;
+ case CTF_K_FORWARD:
+ type = read_forward_type (ccp, tid);
+ break;
+ case CTF_K_UNKNOWN:
+ break;
+ default:
+ break;
}
return type;
@@ -1077,48 +1070,48 @@ ctf_add_type_cb (ctf_id_t tid, void *arg)
kind = ctf_type_kind (ccp->fp, tid);
switch (kind)
{
- case CTF_K_STRUCT:
- case CTF_K_UNION:
- process_structure_type (ccp, tid);
- break;
- case CTF_K_ENUM:
- process_enum_type (ccp, tid);
- break;
- case CTF_K_FUNCTION:
- type = read_func_kind_type (ccp, tid);
- new_symbol (ccp, type, tid);
- break;
- case CTF_K_INTEGER:
- case CTF_K_FLOAT:
- process_base_type (ccp, tid);
- break;
- case CTF_K_TYPEDEF:
- new_symbol (ccp, read_type_record (ccp, tid), tid);
- break;
- case CTF_K_CONST:
- type = read_const_type (ccp, tid, btid);
- new_symbol (ccp, type, tid);
- break;
- case CTF_K_VOLATILE:
- type = read_volatile_type (ccp, tid, btid);
- new_symbol (ccp, type, tid);
- break;
- case CTF_K_RESTRICT:
- type = read_restrict_type (ccp, tid, btid);
- new_symbol (ccp, type, tid);
- break;
- case CTF_K_POINTER:
- type = read_pointer_type (ccp, tid, btid);
- new_symbol (ccp, type, tid);
- break;
- case CTF_K_ARRAY:
- type = read_array_type (ccp, tid);
- new_symbol (ccp, type, tid);
- break;
- case CTF_K_UNKNOWN:
- break;
- default:
- break;
+ case CTF_K_STRUCT:
+ case CTF_K_UNION:
+ process_structure_type (ccp, tid);
+ break;
+ case CTF_K_ENUM:
+ process_enum_type (ccp, tid);
+ break;
+ case CTF_K_FUNCTION:
+ type = read_func_kind_type (ccp, tid);
+ new_symbol (ccp, type, tid);
+ break;
+ case CTF_K_INTEGER:
+ case CTF_K_FLOAT:
+ process_base_type (ccp, tid);
+ break;
+ case CTF_K_TYPEDEF:
+ new_symbol (ccp, read_type_record (ccp, tid), tid);
+ break;
+ case CTF_K_CONST:
+ type = read_const_type (ccp, tid, btid);
+ new_symbol (ccp, type, tid);
+ break;
+ case CTF_K_VOLATILE:
+ type = read_volatile_type (ccp, tid, btid);
+ new_symbol (ccp, type, tid);
+ break;
+ case CTF_K_RESTRICT:
+ type = read_restrict_type (ccp, tid, btid);
+ new_symbol (ccp, type, tid);
+ break;
+ case CTF_K_POINTER:
+ type = read_pointer_type (ccp, tid, btid);
+ new_symbol (ccp, type, tid);
+ break;
+ case CTF_K_ARRAY:
+ type = read_array_type (ccp, tid);
+ new_symbol (ccp, type, tid);
+ break;
+ case CTF_K_UNKNOWN:
+ break;
+ default:
+ break;
}
return 0;
@@ -1139,44 +1132,44 @@ ctf_add_var_cb (const char *name, ctf_id_t id, void *arg)
kind = ctf_type_kind (ccp->fp, id);
switch (kind)
{
- case CTF_K_FUNCTION:
- if (name != nullptr && strcmp (name, "main") == 0)
- set_objfile_main_name (ccp->of, name, language_c);
- break;
- case CTF_K_INTEGER:
- case CTF_K_FLOAT:
- case CTF_K_VOLATILE:
- case CTF_K_RESTRICT:
- case CTF_K_TYPEDEF:
- case CTF_K_CONST:
- case CTF_K_POINTER:
- case CTF_K_ARRAY:
- if (type != nullptr)
- {
- sym = new_symbol (ccp, type, id);
- if (sym != nullptr)
- sym->compute_and_set_names (name, false, ccp->of->per_bfd);
- }
- break;
- case CTF_K_STRUCT:
- case CTF_K_UNION:
- case CTF_K_ENUM:
- if (type == nullptr)
- {
- complaint (_("ctf_add_var_cb: %s has NO type (%ld)"), name, id);
- type = objfile_type (ccp->of)->builtin_error;
- }
- sym = new (&ccp->of->objfile_obstack) symbol;
- OBJSTAT (ccp->of, n_syms++);
- sym->set_type (type);
- sym->set_domain (VAR_DOMAIN);
- sym->set_aclass_index (LOC_OPTIMIZED_OUT);
- sym->compute_and_set_names (name, false, ccp->of->per_bfd);
- add_symbol_to_list (sym, ccp->builder->get_file_symbols ());
- break;
- default:
- complaint (_("ctf_add_var_cb: kind unsupported (%d)"), kind);
- break;
+ case CTF_K_FUNCTION:
+ if (name != nullptr && strcmp (name, "main") == 0)
+ set_objfile_main_name (ccp->of, name, language_c);
+ break;
+ case CTF_K_INTEGER:
+ case CTF_K_FLOAT:
+ case CTF_K_VOLATILE:
+ case CTF_K_RESTRICT:
+ case CTF_K_TYPEDEF:
+ case CTF_K_CONST:
+ case CTF_K_POINTER:
+ case CTF_K_ARRAY:
+ if (type != nullptr)
+ {
+ sym = new_symbol (ccp, type, id);
+ if (sym != nullptr)
+ sym->compute_and_set_names (name, false, ccp->of->per_bfd);
+ }
+ break;
+ case CTF_K_STRUCT:
+ case CTF_K_UNION:
+ case CTF_K_ENUM:
+ if (type == nullptr)
+ {
+ complaint (_ ("ctf_add_var_cb: %s has NO type (%ld)"), name, id);
+ type = objfile_type (ccp->of)->builtin_error;
+ }
+ sym = new (&ccp->of->objfile_obstack) symbol;
+ OBJSTAT (ccp->of, n_syms++);
+ sym->set_type (type);
+ sym->set_domain (VAR_DOMAIN);
+ sym->set_aclass_index (LOC_OPTIMIZED_OUT);
+ sym->compute_and_set_names (name, false, ccp->of->per_bfd);
+ add_symbol_to_list (sym, ccp->builder->get_file_symbols ());
+ break;
+ default:
+ complaint (_ ("ctf_add_var_cb: kind unsupported (%d)"), kind);
+ break;
}
if (sym != nullptr)
@@ -1245,15 +1238,14 @@ get_objfile_text_range (struct objfile *of, int *tsize)
/* Start a symtab for OBJFILE in CTF format. */
static void
-ctf_start_compunit_symtab (ctf_psymtab *pst,
- struct objfile *of, CORE_ADDR text_offset)
+ctf_start_compunit_symtab (ctf_psymtab *pst, struct objfile *of,
+ CORE_ADDR text_offset)
{
struct ctf_context *ccp;
ccp = &pst->context;
- ccp->builder = new buildsym_compunit
- (of, pst->filename, nullptr,
- language_c, text_offset);
+ ccp->builder = new buildsym_compunit (of, pst->filename, nullptr, language_c,
+ text_offset);
ccp->builder->record_debugformat ("ctf");
}
@@ -1261,8 +1253,7 @@ ctf_start_compunit_symtab (ctf_psymtab *pst,
END_ADDR is the end address of the file's text. */
static struct compunit_symtab *
-ctf_end_compunit_symtab (ctf_psymtab *pst,
- CORE_ADDR end_addr)
+ctf_end_compunit_symtab (ctf_psymtab *pst, CORE_ADDR end_addr)
{
struct ctf_context *ccp;
@@ -1285,13 +1276,12 @@ ctf_psymtab_add_enums (struct ctf_context *ccp, ctf_id_t tid)
while ((ename = ctf_enum_next (ccp->fp, tid, &i, &val)) != nullptr)
{
- ccp->pst->add_psymbol (ename, true,
- VAR_DOMAIN, LOC_CONST, -1,
- psymbol_placement::GLOBAL,
- 0, language_c, ccp->partial_symtabs, ccp->of);
+ ccp->pst->add_psymbol (ename, true, VAR_DOMAIN, LOC_CONST, -1,
+ psymbol_placement::GLOBAL, 0, language_c,
+ ccp->partial_symtabs, ccp->of);
}
if (ctf_errno (ccp->fp) != ECTF_NEXT_END)
- complaint (_("ctf_enum_next ctf_psymtab_add_enums failed - %s"),
+ complaint (_ ("ctf_enum_next ctf_psymtab_add_enums failed - %s"),
ctf_errmsg (ctf_errno (ccp->fp)));
}
@@ -1313,14 +1303,14 @@ ctf_psymtab_add_stt_entries (ctf_dict_t *cfp, ctf_psymtab *pst,
domain_enum tdomain;
switch (kind)
{
- case CTF_K_STRUCT:
- case CTF_K_UNION:
- case CTF_K_ENUM:
- tdomain = STRUCT_DOMAIN;
- break;
- default:
- tdomain = VAR_DOMAIN;
- break;
+ case CTF_K_STRUCT:
+ case CTF_K_UNION:
+ case CTF_K_ENUM:
+ tdomain = STRUCT_DOMAIN;
+ break;
+ default:
+ tdomain = VAR_DOMAIN;
+ break;
}
if (kind == CTF_K_FUNCTION)
@@ -1330,18 +1320,16 @@ ctf_psymtab_add_stt_entries (ctf_dict_t *cfp, ctf_psymtab *pst,
else
aclass = LOC_TYPEDEF;
- pst->add_psymbol (tname, true,
- tdomain, aclass, -1,
- psymbol_placement::GLOBAL,
- 0, language_c, pst->context.partial_symtabs, of);
+ pst->add_psymbol (tname, true, tdomain, aclass, -1,
+ psymbol_placement::GLOBAL, 0, language_c,
+ pst->context.partial_symtabs, of);
}
}
/* Add entries in data objects section to psymtab. */
static void
-ctf_psymtab_add_stt_obj (ctf_dict_t *cfp, ctf_psymtab *pst,
- struct objfile *of)
+ctf_psymtab_add_stt_obj (ctf_dict_t *cfp, ctf_psymtab *pst, struct objfile *of)
{
ctf_psymtab_add_stt_entries (cfp, pst, of, 0);
}
@@ -1368,13 +1356,12 @@ ctf_psymtab::expand_psymtab (struct objfile *objfile)
/* Iterate over entries in data types section. */
if (ctf_type_iter (ccp->fp, ctf_add_type_cb, ccp) == CTF_ERR)
- complaint (_("ctf_type_iter psymtab_to_symtab failed - %s"),
+ complaint (_ ("ctf_type_iter psymtab_to_symtab failed - %s"),
ctf_errmsg (ctf_errno (ccp->fp)));
-
/* Iterate over entries in variable info section. */
if (ctf_variable_iter (ccp->fp, ctf_add_var_cb, ccp) == CTF_ERR)
- complaint (_("ctf_variable_iter psymtab_to_symtab failed - %s"),
+ complaint (_ ("ctf_variable_iter psymtab_to_symtab failed - %s"),
ctf_errmsg (ctf_errno (ccp->fp)));
/* Add entries in data objects and function info sections. */
@@ -1391,17 +1378,17 @@ void
ctf_psymtab::read_symtab (struct objfile *objfile)
{
if (readin)
- warning (_("bug: psymtab for %s is already read in."), filename);
+ warning (_ ("bug: psymtab for %s is already read in."), filename);
else
{
if (info_verbose)
{
- gdb_printf (_("Reading in CTF data for %s..."), filename);
+ gdb_printf (_ ("Reading in CTF data for %s..."), filename);
gdb_flush (gdb_stdout);
}
/* Start a symtab. */
- CORE_ADDR offset; /* Start of text segment. */
+ CORE_ADDR offset; /* Start of text segment. */
int tsize;
offset = get_objfile_text_range (objfile, &tsize);
@@ -1414,7 +1401,7 @@ ctf_psymtab::read_symtab (struct objfile *objfile)
/* Finish up the debug error message. */
if (info_verbose)
- gdb_printf (_("done.\n"));
+ gdb_printf (_ ("done.\n"));
}
}
@@ -1431,9 +1418,7 @@ ctf_psymtab::read_symtab (struct objfile *objfile)
objfile_obstack. */
static ctf_psymtab *
-create_partial_symtab (const char *name,
- ctf_archive_t *arc,
- ctf_dict_t *cfp,
+create_partial_symtab (const char *name, ctf_archive_t *arc, ctf_dict_t *cfp,
psymtab_storage *partial_symtabs,
struct objfile *objfile)
{
@@ -1467,49 +1452,48 @@ ctf_psymtab_type_cb (ctf_id_t tid, void *arg)
kind = ctf_type_kind (ccp->fp, tid);
switch (kind)
{
- case CTF_K_ENUM:
- ctf_psymtab_add_enums (ccp, tid);
- /* FALL THROUGH */
- case CTF_K_STRUCT:
- case CTF_K_UNION:
- domain = STRUCT_DOMAIN;
- aclass = LOC_TYPEDEF;
- break;
- case CTF_K_FUNCTION:
- case CTF_K_FORWARD:
- domain = VAR_DOMAIN;
- aclass = LOC_STATIC;
- section = SECT_OFF_TEXT (ccp->of);
- break;
- case CTF_K_CONST:
- domain = VAR_DOMAIN;
- aclass = LOC_STATIC;
- break;
- case CTF_K_TYPEDEF:
- case CTF_K_POINTER:
- case CTF_K_VOLATILE:
- case CTF_K_RESTRICT:
- domain = VAR_DOMAIN;
- aclass = LOC_TYPEDEF;
- break;
- case CTF_K_INTEGER:
- case CTF_K_FLOAT:
- domain = VAR_DOMAIN;
- aclass = LOC_TYPEDEF;
- break;
- case CTF_K_ARRAY:
- case CTF_K_UNKNOWN:
- return 0;
+ case CTF_K_ENUM:
+ ctf_psymtab_add_enums (ccp, tid);
+ /* FALL THROUGH */
+ case CTF_K_STRUCT:
+ case CTF_K_UNION:
+ domain = STRUCT_DOMAIN;
+ aclass = LOC_TYPEDEF;
+ break;
+ case CTF_K_FUNCTION:
+ case CTF_K_FORWARD:
+ domain = VAR_DOMAIN;
+ aclass = LOC_STATIC;
+ section = SECT_OFF_TEXT (ccp->of);
+ break;
+ case CTF_K_CONST:
+ domain = VAR_DOMAIN;
+ aclass = LOC_STATIC;
+ break;
+ case CTF_K_TYPEDEF:
+ case CTF_K_POINTER:
+ case CTF_K_VOLATILE:
+ case CTF_K_RESTRICT:
+ domain = VAR_DOMAIN;
+ aclass = LOC_TYPEDEF;
+ break;
+ case CTF_K_INTEGER:
+ case CTF_K_FLOAT:
+ domain = VAR_DOMAIN;
+ aclass = LOC_TYPEDEF;
+ break;
+ case CTF_K_ARRAY:
+ case CTF_K_UNKNOWN:
+ return 0;
}
const char *name = ctf_type_name_raw (ccp->fp, tid);
if (name == nullptr || strlen (name) == 0)
return 0;
- ccp->pst->add_psymbol (name, false,
- domain, aclass, section,
- psymbol_placement::STATIC,
- 0, language_c, ccp->partial_symtabs, ccp->of);
+ ccp->pst->add_psymbol (name, false, domain, aclass, section,
+ psymbol_placement::STATIC, 0, language_c,
+ ccp->partial_symtabs, ccp->of);
return 0;
}
@@ -1521,10 +1505,9 @@ ctf_psymtab_var_cb (const char *name, ctf_id_t id, void *arg)
{
struct ctf_context *ccp = (struct ctf_context *) arg;
- ccp->pst->add_psymbol (name, true,
- VAR_DOMAIN, LOC_STATIC, -1,
- psymbol_placement::GLOBAL,
- 0, language_c, ccp->partial_symtabs, ccp->of);
+ ccp->pst->add_psymbol (name, true, VAR_DOMAIN, LOC_STATIC, -1,
+ psymbol_placement::GLOBAL, 0, language_c,
+ ccp->partial_symtabs, ccp->of);
return 0;
}
@@ -1544,19 +1527,19 @@ scan_partial_symbols (ctf_dict_t *cfp, psymtab_storage *partial_symtabs,
isparent = true;
}
- ctf_psymtab *pst = create_partial_symtab (fname, tup->arc, cfp,
- partial_symtabs, of);
+ ctf_psymtab *pst
+ = create_partial_symtab (fname, tup->arc, cfp, partial_symtabs, of);
struct ctf_context *ccx = &pst->context;
if (isparent == false)
ccx->pst = pst;
if (ctf_type_iter (cfp, ctf_psymtab_type_cb, ccx) == CTF_ERR)
- complaint (_("ctf_type_iter scan_partial_symbols failed - %s"),
+ complaint (_ ("ctf_type_iter scan_partial_symbols failed - %s"),
ctf_errmsg (ctf_errno (cfp)));
if (ctf_variable_iter (cfp, ctf_psymtab_var_cb, ccx) == CTF_ERR)
- complaint (_("ctf_variable_iter scan_partial_symbols failed - %s"),
+ complaint (_ ("ctf_variable_iter scan_partial_symbols failed - %s"),
ctf_errmsg (ctf_errno (cfp)));
/* Scan CTF object and function sections which correspond to each
@@ -1581,7 +1564,7 @@ build_ctf_archive_member (ctf_dict_t *ctf, const char *name, void *arg)
if (info_verbose)
{
- gdb_printf (_("Scanning archive member %s..."), name);
+ gdb_printf (_ ("Scanning archive member %s..."), name);
gdb_flush (gdb_stdout);
}
@@ -1604,13 +1587,13 @@ elfctf_build_psymtabs (struct objfile *of)
ctf_archive_t *arc = ctf_bfdopen (abfd, &err);
if (arc == nullptr)
- error (_("ctf_bfdopen failed on %s - %s"),
- bfd_get_filename (abfd), ctf_errmsg (err));
+ error (_ ("ctf_bfdopen failed on %s - %s"), bfd_get_filename (abfd),
+ ctf_errmsg (err));
ctf_dict_t *fp = ctf_dict_open (arc, NULL, &err);
if (fp == nullptr)
- error (_("ctf_dict_open failed on %s - %s"),
- bfd_get_filename (abfd), ctf_errmsg (err));
+ error (_ ("ctf_dict_open failed on %s - %s"), bfd_get_filename (abfd),
+ ctf_errmsg (err));
ctf_dict_key.emplace (of, fp);
pcu.fp = fp;
@@ -1622,7 +1605,7 @@ elfctf_build_psymtabs (struct objfile *of)
pcu.psf = psf;
if (ctf_archive_iter (arc, build_ctf_archive_member, &pcu) < 0)
- error (_("ctf_archive_iter failed in input file %s: - %s"),
+ error (_ ("ctf_archive_iter failed in input file %s: - %s"),
bfd_get_filename (abfd), ctf_errmsg (err));
}
diff --git a/gdb/d-lang.c b/gdb/d-lang.c
index 8286c5be646..0e5f79022c1 100644
--- a/gdb/d-lang.c
+++ b/gdb/d-lang.c
@@ -62,19 +62,19 @@ d_demangle (const char *symbol, int options)
class d_language : public language_defn
{
public:
+
d_language ()
: language_defn (language_d)
- { /* Nothing. */ }
+ { /* Nothing. */
+ }
/* See language.h. */
- const char *name () const override
- { return "d"; }
+ const char *name () const override { return "d"; }
/* See language.h. */
- const char *natural_name () const override
- { return "D"; }
+ const char *natural_name () const override { return "D"; }
/* See language.h. */
@@ -91,10 +91,7 @@ public:
const struct builtin_d_type *builtin = builtin_d_type (gdbarch);
/* Helper function to allow shorter lines below. */
- auto add = [&] (struct type * t)
- {
- lai->add_primitive_type (t);
- };
+ auto add = [&] (struct type *t) { lai->add_primitive_type (t); };
add (builtin->builtin_void);
add (builtin->builtin_bool);
@@ -126,9 +123,9 @@ public:
}
/* See language.h. */
- bool sniff_from_mangled_name
- (const char *mangled,
- gdb::unique_xmalloc_ptr<char> *demangled) const override
+ bool sniff_from_mangled_name (
+ const char *mangled,
+ gdb::unique_xmalloc_ptr<char> *demangled) const override
{
*demangled = d_demangle (mangled, 0);
return *demangled != NULL;
@@ -144,10 +141,7 @@ public:
/* See language.h. */
- bool can_print_type_offsets () const override
- {
- return true;
- }
+ bool can_print_type_offsets () const override { return true; }
/* See language.h. */
@@ -160,33 +154,29 @@ public:
/* See language.h. */
- void value_print_inner
- (struct value *val, struct ui_file *stream, int recurse,
- const struct value_print_options *options) const override
+ void
+ value_print_inner (struct value *val, struct ui_file *stream, int recurse,
+ const struct value_print_options *options) const override
{
return d_value_print_inner (val, stream, recurse, options);
}
/* See language.h. */
- struct block_symbol lookup_symbol_nonlocal
- (const char *name, const struct block *block,
- const domain_enum domain) const override
+ struct block_symbol
+ lookup_symbol_nonlocal (const char *name, const struct block *block,
+ const domain_enum domain) const override
{
return d_lookup_symbol_nonlocal (this, name, block, domain);
}
/* See language.h. */
- int parser (struct parser_state *ps) const override
- {
- return d_parse (ps);
- }
+ int parser (struct parser_state *ps) const override { return d_parse (ps); }
/* See language.h. */
- const char *name_of_this () const override
- { return "this"; }
+ const char *name_of_this () const override { return "this"; }
};
/* Single instance of the D language class. */
@@ -203,56 +193,46 @@ build_d_types (struct gdbarch *gdbarch)
/* Basic types. */
builtin_d_type->builtin_void
= arch_type (gdbarch, TYPE_CODE_VOID, TARGET_CHAR_BIT, "void");
- builtin_d_type->builtin_bool
- = arch_boolean_type (gdbarch, 8, 1, "bool");
- builtin_d_type->builtin_byte
- = arch_integer_type (gdbarch, 8, 0, "byte");
- builtin_d_type->builtin_ubyte
- = arch_integer_type (gdbarch, 8, 1, "ubyte");
- builtin_d_type->builtin_short
- = arch_integer_type (gdbarch, 16, 0, "short");
+ builtin_d_type->builtin_bool = arch_boolean_type (gdbarch, 8, 1, "bool");
+ builtin_d_type->builtin_byte = arch_integer_type (gdbarch, 8, 0, "byte");
+ builtin_d_type->builtin_ubyte = arch_integer_type (gdbarch, 8, 1, "ubyte");
+ builtin_d_type->builtin_short = arch_integer_type (gdbarch, 16, 0, "short");
builtin_d_type->builtin_ushort
= arch_integer_type (gdbarch, 16, 1, "ushort");
- builtin_d_type->builtin_int
- = arch_integer_type (gdbarch, 32, 0, "int");
- builtin_d_type->builtin_uint
- = arch_integer_type (gdbarch, 32, 1, "uint");
- builtin_d_type->builtin_long
- = arch_integer_type (gdbarch, 64, 0, "long");
- builtin_d_type->builtin_ulong
- = arch_integer_type (gdbarch, 64, 1, "ulong");
- builtin_d_type->builtin_cent
- = arch_integer_type (gdbarch, 128, 0, "cent");
- builtin_d_type->builtin_ucent
- = arch_integer_type (gdbarch, 128, 1, "ucent");
+ builtin_d_type->builtin_int = arch_integer_type (gdbarch, 32, 0, "int");
+ builtin_d_type->builtin_uint = arch_integer_type (gdbarch, 32, 1, "uint");
+ builtin_d_type->builtin_long = arch_integer_type (gdbarch, 64, 0, "long");
+ builtin_d_type->builtin_ulong = arch_integer_type (gdbarch, 64, 1, "ulong");
+ builtin_d_type->builtin_cent = arch_integer_type (gdbarch, 128, 0, "cent");
+ builtin_d_type->builtin_ucent = arch_integer_type (gdbarch, 128, 1, "ucent");
builtin_d_type->builtin_float
- = arch_float_type (gdbarch, gdbarch_float_bit (gdbarch),
- "float", gdbarch_float_format (gdbarch));
+ = arch_float_type (gdbarch, gdbarch_float_bit (gdbarch), "float",
+ gdbarch_float_format (gdbarch));
builtin_d_type->builtin_double
- = arch_float_type (gdbarch, gdbarch_double_bit (gdbarch),
- "double", gdbarch_double_format (gdbarch));
+ = arch_float_type (gdbarch, gdbarch_double_bit (gdbarch), "double",
+ gdbarch_double_format (gdbarch));
builtin_d_type->builtin_real
- = arch_float_type (gdbarch, gdbarch_long_double_bit (gdbarch),
- "real", gdbarch_long_double_format (gdbarch));
+ = arch_float_type (gdbarch, gdbarch_long_double_bit (gdbarch), "real",
+ gdbarch_long_double_format (gdbarch));
- builtin_d_type->builtin_byte->set_instance_flags
- (builtin_d_type->builtin_byte->instance_flags ()
- | TYPE_INSTANCE_FLAG_NOTTEXT);
+ builtin_d_type->builtin_byte->set_instance_flags (
+ builtin_d_type->builtin_byte->instance_flags ()
+ | TYPE_INSTANCE_FLAG_NOTTEXT);
- builtin_d_type->builtin_ubyte->set_instance_flags
- (builtin_d_type->builtin_ubyte->instance_flags ()
- | TYPE_INSTANCE_FLAG_NOTTEXT);
+ builtin_d_type->builtin_ubyte->set_instance_flags (
+ builtin_d_type->builtin_ubyte->instance_flags ()
+ | TYPE_INSTANCE_FLAG_NOTTEXT);
/* Imaginary and complex types. */
builtin_d_type->builtin_ifloat
- = arch_float_type (gdbarch, gdbarch_float_bit (gdbarch),
- "ifloat", gdbarch_float_format (gdbarch));
+ = arch_float_type (gdbarch, gdbarch_float_bit (gdbarch), "ifloat",
+ gdbarch_float_format (gdbarch));
builtin_d_type->builtin_idouble
- = arch_float_type (gdbarch, gdbarch_double_bit (gdbarch),
- "idouble", gdbarch_double_format (gdbarch));
+ = arch_float_type (gdbarch, gdbarch_double_bit (gdbarch), "idouble",
+ gdbarch_double_format (gdbarch));
builtin_d_type->builtin_ireal
- = arch_float_type (gdbarch, gdbarch_long_double_bit (gdbarch),
- "ireal", gdbarch_long_double_format (gdbarch));
+ = arch_float_type (gdbarch, gdbarch_long_double_bit (gdbarch), "ireal",
+ gdbarch_long_double_format (gdbarch));
builtin_d_type->builtin_cfloat
= init_complex_type ("cfloat", builtin_d_type->builtin_float);
builtin_d_type->builtin_cdouble
@@ -261,8 +241,7 @@ build_d_types (struct gdbarch *gdbarch)
= init_complex_type ("creal", builtin_d_type->builtin_real);
/* Character types. */
- builtin_d_type->builtin_char
- = arch_character_type (gdbarch, 8, 1, "char");
+ builtin_d_type->builtin_char = arch_character_type (gdbarch, 8, 1, "char");
builtin_d_type->builtin_wchar
= arch_character_type (gdbarch, 16, 1, "wchar");
builtin_d_type->builtin_dchar
diff --git a/gdb/d-lang.h b/gdb/d-lang.h
index f47f5df5a73..766ec3cb4a0 100644
--- a/gdb/d-lang.h
+++ b/gdb/d-lang.h
@@ -17,7 +17,7 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
-#if !defined (D_LANG_H)
+#if !defined(D_LANG_H)
#define D_LANG_H 1
#include "symtab.h"
@@ -69,18 +69,17 @@ extern const struct builtin_d_type *builtin_d_type (struct gdbarch *);
/* Defined in d-namespace.c */
-extern struct block_symbol d_lookup_symbol_nonlocal (const struct language_defn *,
- const char *,
- const struct block *,
- const domain_enum);
+extern struct block_symbol
+d_lookup_symbol_nonlocal (const struct language_defn *, const char *,
+ const struct block *, const domain_enum);
extern struct block_symbol d_lookup_nested_symbol (struct type *, const char *,
const struct block *);
/* Implement la_value_print_inner for D. */
-extern void d_value_print_inner (struct value *val,
- struct ui_file *stream, int recurse,
+extern void d_value_print_inner (struct value *val, struct ui_file *stream,
+ int recurse,
const struct value_print_options *options);
#endif /* !defined (D_LANG_H) */
diff --git a/gdb/d-namespace.c b/gdb/d-namespace.c
index b6184034d5d..03c440ae557 100644
--- a/gdb/d-namespace.c
+++ b/gdb/d-namespace.c
@@ -75,9 +75,9 @@ d_entire_prefix_len (const char *name)
symbol. Other arguments are as in d_lookup_symbol_nonlocal. */
static struct block_symbol
-d_lookup_symbol (const struct language_defn *langdef,
- const char *name, const struct block *block,
- const domain_enum domain, int search)
+d_lookup_symbol (const struct language_defn *langdef, const char *name,
+ const struct block *block, const domain_enum domain,
+ int search)
{
struct block_symbol sym;
@@ -151,8 +151,8 @@ d_lookup_symbol (const struct language_defn *langdef,
return {};
/* Look for a symbol named NESTED in this class. */
- sym = d_lookup_nested_symbol (class_sym.symbol->type (),
- nested.c_str (), block);
+ sym = d_lookup_nested_symbol (class_sym.symbol->type (), nested.c_str (),
+ block);
}
return sym;
@@ -164,8 +164,8 @@ d_lookup_symbol (const struct language_defn *langdef,
static struct block_symbol
d_lookup_symbol_in_module (const char *module, const char *name,
- const struct block *block,
- const domain_enum domain, int search)
+ const struct block *block, const domain_enum domain,
+ int search)
{
char *concatenated_name = NULL;
@@ -195,10 +195,9 @@ d_lookup_symbol_in_module (const char *module, const char *name,
and if that call fails, then the first call looks for "x". */
static struct block_symbol
-lookup_module_scope (const struct language_defn *langdef,
- const char *name, const struct block *block,
- const domain_enum domain, const char *scope,
- int scope_len)
+lookup_module_scope (const struct language_defn *langdef, const char *name,
+ const struct block *block, const domain_enum domain,
+ const char *scope, int scope_len)
{
char *module;
@@ -216,8 +215,8 @@ lookup_module_scope (const struct language_defn *langdef,
new_scope_len++;
}
new_scope_len += d_find_first_component (scope + new_scope_len);
- sym = lookup_module_scope (langdef, name, block, domain,
- scope, new_scope_len);
+ sym = lookup_module_scope (langdef, name, block, domain, scope,
+ new_scope_len);
if (sym.symbol != NULL)
return sym;
}
@@ -236,8 +235,7 @@ lookup_module_scope (const struct language_defn *langdef,
module = (char *) alloca (scope_len + 1);
strncpy (module, scope, scope_len);
module[scope_len] = '\0';
- return d_lookup_symbol_in_module (module, name,
- block, domain, 1);
+ return d_lookup_symbol_in_module (module, name, block, domain, 1);
}
/* Search through the base classes of PARENT_TYPE for a symbol named
@@ -259,8 +257,7 @@ find_symbol_in_baseclass (struct type *parent_type, const char *name,
continue;
/* Search this particular base class. */
- sym = d_lookup_symbol_in_module (base_name, name, block,
- VAR_DOMAIN, 0);
+ sym = d_lookup_symbol_in_module (base_name, name, block, VAR_DOMAIN, 0);
if (sym.symbol != NULL)
break;
@@ -298,8 +295,7 @@ find_symbol_in_baseclass (struct type *parent_type, const char *name,
given by BLOCK. Return NULL if there is no such nested type. */
struct block_symbol
-d_lookup_nested_symbol (struct type *parent_type,
- const char *nested_name,
+d_lookup_nested_symbol (struct type *parent_type, const char *nested_name,
const struct block *block)
{
/* type_name_no_tag_required provides better error reporting using the
@@ -314,36 +310,35 @@ d_lookup_nested_symbol (struct type *parent_type,
case TYPE_CODE_UNION:
case TYPE_CODE_ENUM:
case TYPE_CODE_MODULE:
- {
- int size;
- const char *parent_name = type_name_or_error (saved_parent_type);
- struct block_symbol sym
- = d_lookup_symbol_in_module (parent_name, nested_name,
- block, VAR_DOMAIN, 0);
- char *concatenated_name;
+ {
+ int size;
+ const char *parent_name = type_name_or_error (saved_parent_type);
+ struct block_symbol sym
+ = d_lookup_symbol_in_module (parent_name, nested_name, block,
+ VAR_DOMAIN, 0);
+ char *concatenated_name;
- if (sym.symbol != NULL)
- return sym;
+ if (sym.symbol != NULL)
+ return sym;
- /* Now search all static file-level symbols. We have to do this
+ /* Now search all static file-level symbols. We have to do this
for things like typedefs in the class. We do not try to
guess any imported module as even the fully specified
module search is already not D compliant and more assumptions
could make it too magic. */
- size = strlen (parent_name) + strlen (nested_name) + 2;
- concatenated_name = (char *) alloca (size);
+ size = strlen (parent_name) + strlen (nested_name) + 2;
+ concatenated_name = (char *) alloca (size);
- xsnprintf (concatenated_name, size, "%s.%s",
- parent_name, nested_name);
+ xsnprintf (concatenated_name, size, "%s.%s", parent_name, nested_name);
- sym = lookup_static_symbol (concatenated_name, VAR_DOMAIN);
- if (sym.symbol != NULL)
- return sym;
+ sym = lookup_static_symbol (concatenated_name, VAR_DOMAIN);
+ if (sym.symbol != NULL)
+ return sym;
- /* If no matching symbols were found, try searching any
+ /* If no matching symbols were found, try searching any
base classes. */
- return find_symbol_in_baseclass (parent_type, nested_name, block);
- }
+ return find_symbol_in_baseclass (parent_type, nested_name, block);
+ }
case TYPE_CODE_FUNC:
case TYPE_CODE_METHOD:
@@ -359,8 +354,7 @@ d_lookup_nested_symbol (struct type *parent_type,
static struct block_symbol
d_lookup_symbol_imports (const char *scope, const char *name,
- const struct block *block,
- const domain_enum domain)
+ const struct block *block, const domain_enum domain)
{
struct using_direct *current;
struct block_symbol sym;
@@ -375,9 +369,7 @@ d_lookup_symbol_imports (const char *scope, const char *name,
the module we're searching in, see if we can find a match by
applying them. */
- for (current = block_using (block);
- current != NULL;
- current = current->next)
+ for (current = block_using (block); current != NULL; current = current->next)
{
const char **excludep;
@@ -395,11 +387,12 @@ d_lookup_symbol_imports (const char *scope, const char *name,
current->import_src as MODULE to direct the search towards
the imported module. */
if (current->declaration
- && strcmp (name, current->alias
- ? current->alias : current->declaration) == 0)
+ && strcmp (name, current->alias ? current->alias
+ : current->declaration)
+ == 0)
sym = d_lookup_symbol_in_module (current->import_src,
- current->declaration,
- block, domain, 1);
+ current->declaration, block,
+ domain, 1);
/* If a symbol was found or this import statement was an import
declaration, the search of this import is complete. */
@@ -453,8 +446,8 @@ d_lookup_symbol_imports (const char *scope, const char *name,
/* If this import statement creates no alias, pass
current->import_src as MODULE to direct the search
towards the imported module. */
- sym = d_lookup_symbol_in_module (current->import_src,
- name, block, domain, 1);
+ sym = d_lookup_symbol_in_module (current->import_src, name,
+ block, domain, 1);
}
if (sym.symbol != NULL)
@@ -471,14 +464,12 @@ d_lookup_symbol_imports (const char *scope, const char *name,
static struct block_symbol
d_lookup_symbol_module (const char *scope, const char *name,
- const struct block *block,
- const domain_enum domain)
+ const struct block *block, const domain_enum domain)
{
struct block_symbol sym;
/* First, try to find the symbol in the given module. */
- sym = d_lookup_symbol_in_module (scope, name,
- block, domain, 1);
+ sym = d_lookup_symbol_in_module (scope, name, block, domain, 1);
if (sym.symbol != NULL)
return sym;
@@ -506,8 +497,7 @@ d_lookup_symbol_module (const char *scope, const char *name,
struct block_symbol
d_lookup_symbol_nonlocal (const struct language_defn *langdef,
- const char *name,
- const struct block *block,
+ const char *name, const struct block *block,
const domain_enum domain)
{
struct block_symbol sym;
@@ -519,4 +509,3 @@ d_lookup_symbol_nonlocal (const struct language_defn *langdef,
return d_lookup_symbol_module (scope, name, block, domain);
}
-
diff --git a/gdb/d-valprint.c b/gdb/d-valprint.c
index 18697545ce8..cb90289ecba 100644
--- a/gdb/d-valprint.c
+++ b/gdb/d-valprint.c
@@ -28,9 +28,8 @@
TYPE is a dynamic array, non-zero otherwise. */
static int
-dynamic_array_type (struct type *type,
- LONGEST embedded_offset, CORE_ADDR address,
- struct ui_file *stream, int recurse,
+dynamic_array_type (struct type *type, LONGEST embedded_offset,
+ CORE_ADDR address, struct ui_file *stream, int recurse,
struct value *val,
const struct value_print_options *options)
{
@@ -38,8 +37,7 @@ dynamic_array_type (struct type *type,
&& type->field (0).type ()->code () == TYPE_CODE_INT
&& strcmp (type->field (0).name (), "length") == 0
&& strcmp (type->field (1).name (), "ptr") == 0
- && !value_bits_any_optimized_out (val,
- TARGET_CHAR_BIT * embedded_offset,
+ && !value_bits_any_optimized_out (val, TARGET_CHAR_BIT * embedded_offset,
TARGET_CHAR_BIT * type->length ()))
{
CORE_ADDR addr;
@@ -54,9 +52,9 @@ dynamic_array_type (struct type *type,
ptr_type = type->field (1).type ();
elttype = check_typedef (ptr_type->target_type ());
- addr = unpack_pointer (ptr_type,
- valaddr + type->field (1).loc_bitpos () / 8
- + embedded_offset);
+ addr
+ = unpack_pointer (ptr_type, valaddr + type->field (1).loc_bitpos () / 8
+ + embedded_offset);
true_type = check_typedef (elttype);
true_type = lookup_array_range_type (true_type, 0, length - 1);
@@ -80,15 +78,15 @@ d_value_print_inner (struct value *val, struct ui_file *stream, int recurse,
struct type *type = check_typedef (value_type (val));
switch (type->code ())
{
- case TYPE_CODE_STRUCT:
- ret = dynamic_array_type (type, value_embedded_offset (val),
- value_address (val),
- stream, recurse, val, options);
- if (ret == 0)
- break;
- /* Fall through. */
- default:
- c_value_print_inner (val, stream, recurse, options);
+ case TYPE_CODE_STRUCT:
+ ret = dynamic_array_type (type, value_embedded_offset (val),
+ value_address (val), stream, recurse, val,
+ options);
+ if (ret == 0)
break;
+ /* Fall through. */
+ default:
+ c_value_print_inner (val, stream, recurse, options);
+ break;
}
}
diff --git a/gdb/darwin-nat-info.c b/gdb/darwin-nat-info.c
index d4dba555b6a..43694e617d0 100644
--- a/gdb/darwin-nat-info.c
+++ b/gdb/darwin-nat-info.c
@@ -48,18 +48,21 @@
#include <mach/mach_init.h>
#include <mach/mach_vm.h>
-#define CHECK_ARGS(what, args) do { \
- if ((NULL == args) || ((args[0] != '0') && (args[1] != 'x'))) \
- error(_("%s must be specified with 0x..."), what); \
-} while (0)
+#define CHECK_ARGS(what, args) \
+ do \
+ { \
+ if ((NULL == args) || ((args[0] != '0') && (args[1] != 'x'))) \
+ error (_ ("%s must be specified with 0x..."), what); \
+ } \
+ while (0)
#define PRINT_FIELD(structure, field) \
- gdb_printf(_(#field":\t%#lx\n"), (unsigned long) (structure)->field)
+ gdb_printf (_ (#field ":\t%#lx\n"), (unsigned long) (structure)->field)
-#define PRINT_TV_FIELD(structure, field) \
- gdb_printf(_(#field":\t%u.%06u sec\n"), \
- (unsigned) (structure)->field.seconds, \
- (unsigned) (structure)->field.microseconds)
+#define PRINT_TV_FIELD(structure, field) \
+ gdb_printf (_ (#field ":\t%u.%06u sec\n"), \
+ (unsigned) (structure)->field.seconds, \
+ (unsigned) (structure)->field.microseconds)
#define task_self mach_task_self
#define task_by_unix_pid task_for_pid
@@ -83,24 +86,23 @@ info_mach_tasks_command (const char *args, int from_tty)
sysctl (sysControl, 3, procInfo, &length, NULL, 0);
count = (length / sizeof (struct kinfo_proc));
- gdb_printf (_("%d processes:\n"), count);
+ gdb_printf (_ ("%d processes:\n"), count);
for (index = 0; index < count; ++index)
{
kern_return_t result;
mach_port_t taskPort;
- result =
- task_by_unix_pid (mach_task_self (), procInfo[index].kp_proc.p_pid,
- &taskPort);
+ result = task_by_unix_pid (mach_task_self (),
+ procInfo[index].kp_proc.p_pid, &taskPort);
if (KERN_SUCCESS == result)
{
- gdb_printf (_(" %s is %d has task %#x\n"),
+ gdb_printf (_ (" %s is %d has task %#x\n"),
procInfo[index].kp_proc.p_comm,
procInfo[index].kp_proc.p_pid, taskPort);
}
else
{
- gdb_printf (_(" %s is %d unknown task port\n"),
+ gdb_printf (_ (" %s is %d unknown task port\n"),
procInfo[index].kp_proc.p_comm,
procInfo[index].kp_proc.p_pid);
}
@@ -118,7 +120,7 @@ get_task_from_args (const char *args)
if (args == NULL || *args == 0)
{
if (inferior_ptid == null_ptid)
- gdb_printf (_("No inferior running\n"));
+ gdb_printf (_ ("No inferior running\n"));
darwin_inferior *priv = get_darwin_inferior (current_inferior ());
@@ -129,7 +131,7 @@ get_task_from_args (const char *args)
task = strtoul (args, &eptr, 0);
if (*eptr)
{
- gdb_printf (_("cannot parse task id '%s'\n"), args);
+ gdb_printf (_ ("cannot parse task id '%s'\n"), args);
return TASK_NULL;
}
return task;
@@ -153,11 +155,10 @@ info_mach_task_command (const char *args, int from_tty)
if (task == TASK_NULL)
return;
- gdb_printf (_("TASK_BASIC_INFO for 0x%x:\n"), task);
+ gdb_printf (_ ("TASK_BASIC_INFO for 0x%x:\n"), task);
info_count = TASK_BASIC_INFO_COUNT;
- result = task_info (task,
- TASK_BASIC_INFO,
- (task_info_t) & task_info_data.basic, &info_count);
+ result = task_info (task, TASK_BASIC_INFO,
+ (task_info_t) &task_info_data.basic, &info_count);
MACH_CHECK_ERROR (result);
PRINT_FIELD (&task_info_data.basic, suspend_count);
@@ -165,11 +166,10 @@ info_mach_task_command (const char *args, int from_tty)
PRINT_FIELD (&task_info_data.basic, resident_size);
PRINT_TV_FIELD (&task_info_data.basic, user_time);
PRINT_TV_FIELD (&task_info_data.basic, system_time);
- gdb_printf (_("\nTASK_EVENTS_INFO:\n"));
+ gdb_printf (_ ("\nTASK_EVENTS_INFO:\n"));
info_count = TASK_EVENTS_INFO_COUNT;
- result = task_info (task,
- TASK_EVENTS_INFO,
- (task_info_t) & task_info_data.events, &info_count);
+ result = task_info (task, TASK_EVENTS_INFO,
+ (task_info_t) &task_info_data.events, &info_count);
MACH_CHECK_ERROR (result);
PRINT_FIELD (&task_info_data.events, faults);
@@ -181,12 +181,10 @@ info_mach_task_command (const char *args, int from_tty)
PRINT_FIELD (&task_info_data.events, cow_faults);
PRINT_FIELD (&task_info_data.events, messages_sent);
PRINT_FIELD (&task_info_data.events, messages_received);
- gdb_printf (_("\nTASK_THREAD_TIMES_INFO:\n"));
+ gdb_printf (_ ("\nTASK_THREAD_TIMES_INFO:\n"));
info_count = TASK_THREAD_TIMES_INFO_COUNT;
- result = task_info (task,
- TASK_THREAD_TIMES_INFO,
- (task_info_t) & task_info_data.thread_times,
- &info_count);
+ result = task_info (task, TASK_THREAD_TIMES_INFO,
+ (task_info_t) &task_info_data.thread_times, &info_count);
MACH_CHECK_ERROR (result);
PRINT_TV_FIELD (&task_info_data.thread_times, user_time);
PRINT_TV_FIELD (&task_info_data.thread_times, system_time);
@@ -211,68 +209,68 @@ info_mach_ports_command (const char *args, int from_tty)
gdb_assert (name_count == type_count);
- gdb_printf (_("Ports for task 0x%x:\n"), task);
- gdb_printf (_("port type\n"));
+ gdb_printf (_ ("Ports for task 0x%x:\n"), task);
+ gdb_printf (_ ("port type\n"));
for (index = 0; index < name_count; ++index)
{
mach_port_t port = names[index];
unsigned int j;
+
struct type_descr
{
mach_port_type_t type;
const char *name;
mach_port_right_t right;
};
- static struct type_descr descrs[] =
- {
- {MACH_PORT_TYPE_SEND, "send", MACH_PORT_RIGHT_SEND},
- {MACH_PORT_TYPE_SEND_ONCE, "send-once", MACH_PORT_RIGHT_SEND_ONCE},
- {MACH_PORT_TYPE_RECEIVE, "receive", MACH_PORT_RIGHT_RECEIVE},
- {MACH_PORT_TYPE_PORT_SET, "port-set", MACH_PORT_RIGHT_PORT_SET},
- {MACH_PORT_TYPE_DEAD_NAME, "dead", MACH_PORT_RIGHT_DEAD_NAME}
- };
-
- gdb_printf (_("%04x: %08x "), port, types[index]);
- for (j = 0; j < sizeof(descrs) / sizeof(*descrs); j++)
+ static struct type_descr descrs[]
+ = { { MACH_PORT_TYPE_SEND, "send", MACH_PORT_RIGHT_SEND },
+ { MACH_PORT_TYPE_SEND_ONCE, "send-once",
+ MACH_PORT_RIGHT_SEND_ONCE },
+ { MACH_PORT_TYPE_RECEIVE, "receive", MACH_PORT_RIGHT_RECEIVE },
+ { MACH_PORT_TYPE_PORT_SET, "port-set", MACH_PORT_RIGHT_PORT_SET },
+ { MACH_PORT_TYPE_DEAD_NAME, "dead", MACH_PORT_RIGHT_DEAD_NAME } };
+
+ gdb_printf (_ ("%04x: %08x "), port, types[index]);
+ for (j = 0; j < sizeof (descrs) / sizeof (*descrs); j++)
if (types[index] & descrs[j].type)
{
mach_port_urefs_t ref;
kern_return_t ret;
- gdb_printf (_(" %s("), descrs[j].name);
+ gdb_printf (_ (" %s("), descrs[j].name);
ret = mach_port_get_refs (task, port, descrs[j].right, &ref);
if (ret != KERN_SUCCESS)
- gdb_printf (_("??"));
+ gdb_printf (_ ("??"));
else
- gdb_printf (_("%u"), ref);
- gdb_printf (_(" refs)"));
+ gdb_printf (_ ("%u"), ref);
+ gdb_printf (_ (" refs)"));
}
-
+
if (task == task_self ())
{
- if (port == task_self())
- gdb_printf (_(" gdb-task"));
+ if (port == task_self ())
+ gdb_printf (_ (" gdb-task"));
else if (port == darwin_host_self)
- gdb_printf (_(" host-self"));
+ gdb_printf (_ (" host-self"));
else if (port == darwin_ex_port)
- gdb_printf (_(" gdb-exception"));
+ gdb_printf (_ (" gdb-exception"));
else if (port == darwin_port_set)
- gdb_printf (_(" gdb-port_set"));
+ gdb_printf (_ (" gdb-port_set"));
else if (inferior_ptid != null_ptid)
{
struct inferior *inf = current_inferior ();
darwin_inferior *priv = get_darwin_inferior (inf);
if (port == priv->task)
- gdb_printf (_(" inferior-task"));
+ gdb_printf (_ (" inferior-task"));
else if (port == priv->notify_port)
- gdb_printf (_(" inferior-notify"));
+ gdb_printf (_ (" inferior-notify"));
else
{
for (int k = 0; k < priv->exception_info.count; k++)
if (port == priv->exception_info.ports[k])
{
- gdb_printf (_(" inferior-excp-port"));
+ gdb_printf (_ (" inferior-excp-port"));
break;
}
@@ -280,16 +278,15 @@ info_mach_ports_command (const char *args, int from_tty)
{
if (port == t->gdb_port)
{
- gdb_printf (_(" inferior-thread for 0x%x"),
+ gdb_printf (_ (" inferior-thread for 0x%x"),
priv->task);
break;
}
}
-
}
}
}
- gdb_printf (_("\n"));
+ gdb_printf (_ ("\n"));
}
vm_deallocate (task_self (), (vm_address_t) names,
@@ -298,7 +295,6 @@ info_mach_ports_command (const char *args, int from_tty)
(type_count * sizeof (mach_port_type_t)));
}
-
static void
darwin_debug_port_info (task_t task, mach_port_t port)
{
@@ -306,22 +302,22 @@ darwin_debug_port_info (task_t task, mach_port_t port)
mach_port_status_t status;
mach_msg_type_number_t len = sizeof (status);
- kret = mach_port_get_attributes
- (task, port, MACH_PORT_RECEIVE_STATUS, (mach_port_info_t)&status, &len);
+ kret = mach_port_get_attributes (task, port, MACH_PORT_RECEIVE_STATUS,
+ (mach_port_info_t) &status, &len);
MACH_CHECK_ERROR (kret);
- gdb_printf (_("Port 0x%lx in task 0x%lx:\n"), (unsigned long) port,
+ gdb_printf (_ ("Port 0x%lx in task 0x%lx:\n"), (unsigned long) port,
(unsigned long) task);
- gdb_printf (_(" port set: 0x%x\n"), status.mps_pset);
- gdb_printf (_(" seqno: 0x%x\n"), status.mps_seqno);
- gdb_printf (_(" mscount: 0x%x\n"), status.mps_mscount);
- gdb_printf (_(" qlimit: 0x%x\n"), status.mps_qlimit);
- gdb_printf (_(" msgcount: 0x%x\n"), status.mps_msgcount);
- gdb_printf (_(" sorights: 0x%x\n"), status.mps_sorights);
- gdb_printf (_(" srights: 0x%x\n"), status.mps_srights);
- gdb_printf (_(" pdrequest: 0x%x\n"), status.mps_pdrequest);
- gdb_printf (_(" nsrequest: 0x%x\n"), status.mps_nsrequest);
- gdb_printf (_(" flags: 0x%x\n"), status.mps_flags);
+ gdb_printf (_ (" port set: 0x%x\n"), status.mps_pset);
+ gdb_printf (_ (" seqno: 0x%x\n"), status.mps_seqno);
+ gdb_printf (_ (" mscount: 0x%x\n"), status.mps_mscount);
+ gdb_printf (_ (" qlimit: 0x%x\n"), status.mps_qlimit);
+ gdb_printf (_ (" msgcount: 0x%x\n"), status.mps_msgcount);
+ gdb_printf (_ (" sorights: 0x%x\n"), status.mps_sorights);
+ gdb_printf (_ (" srights: 0x%x\n"), status.mps_srights);
+ gdb_printf (_ (" pdrequest: 0x%x\n"), status.mps_pdrequest);
+ gdb_printf (_ (" nsrequest: 0x%x\n"), status.mps_nsrequest);
+ gdb_printf (_ (" flags: 0x%x\n"), status.mps_flags);
}
static void
@@ -330,7 +326,7 @@ info_mach_port_command (const char *args, int from_tty)
task_t task;
mach_port_t port;
- CHECK_ARGS (_("Task and port"), args);
+ CHECK_ARGS (_ ("Task and port"), args);
sscanf (args, "0x%x 0x%x", &task, &port);
darwin_debug_port_info (task, port);
@@ -352,10 +348,10 @@ info_mach_threads_command (const char *args, int from_tty)
result = task_threads (task, &threads, &thread_count);
MACH_CHECK_ERROR (result);
- gdb_printf (_("Threads in task %#x:\n"), task);
+ gdb_printf (_ ("Threads in task %#x:\n"), task);
for (i = 0; i < thread_count; ++i)
{
- gdb_printf (_(" %#x\n"), threads[i]);
+ gdb_printf (_ (" %#x\n"), threads[i]);
mach_port_deallocate (task_self (), threads[i]);
}
@@ -375,15 +371,13 @@ info_mach_thread_command (const char *args, int from_tty)
kern_return_t result;
unsigned int info_count;
- CHECK_ARGS (_("Thread"), args);
+ CHECK_ARGS (_ ("Thread"), args);
sscanf (args, "0x%x", &thread);
- gdb_printf (_("THREAD_BASIC_INFO\n"));
+ gdb_printf (_ ("THREAD_BASIC_INFO\n"));
info_count = THREAD_BASIC_INFO_COUNT;
- result = thread_info (thread,
- THREAD_BASIC_INFO,
- (thread_info_t) & thread_info_data.basic,
- &info_count);
+ result = thread_info (thread, THREAD_BASIC_INFO,
+ (thread_info_t) &thread_info_data.basic, &info_count);
MACH_CHECK_ERROR (result);
#if 0
@@ -429,13 +423,13 @@ unparse_inheritance (vm_inherit_t i)
switch (i)
{
case VM_INHERIT_SHARE:
- return _("share");
+ return _ ("share");
case VM_INHERIT_COPY:
- return _("copy ");
+ return _ ("copy ");
case VM_INHERIT_NONE:
- return _("none ");
+ return _ ("none ");
default:
- return _("??? ");
+ return _ ("??? ");
}
}
@@ -445,21 +439,21 @@ unparse_share_mode (unsigned char p)
switch (p)
{
case SM_COW:
- return _("cow");
+ return _ ("cow");
case SM_PRIVATE:
- return _("private");
+ return _ ("private");
case SM_EMPTY:
- return _("empty");
+ return _ ("empty");
case SM_SHARED:
- return _("shared");
+ return _ ("shared");
case SM_TRUESHARED:
- return _("true-shrd");
+ return _ ("true-shrd");
case SM_PRIVATE_ALIASED:
- return _("prv-alias");
+ return _ ("prv-alias");
case SM_SHARED_ALIASED:
- return _("shr-alias");
+ return _ ("shr-alias");
default:
- return _("???");
+ return _ ("???");
}
}
@@ -469,39 +463,39 @@ unparse_user_tag (unsigned int tag)
switch (tag)
{
case 0:
- return _("default");
+ return _ ("default");
case VM_MEMORY_MALLOC:
- return _("malloc");
+ return _ ("malloc");
case VM_MEMORY_MALLOC_SMALL:
- return _("malloc_small");
+ return _ ("malloc_small");
case VM_MEMORY_MALLOC_LARGE:
- return _("malloc_large");
+ return _ ("malloc_large");
case VM_MEMORY_MALLOC_HUGE:
- return _("malloc_huge");
+ return _ ("malloc_huge");
case VM_MEMORY_SBRK:
- return _("sbrk");
+ return _ ("sbrk");
case VM_MEMORY_REALLOC:
- return _("realloc");
+ return _ ("realloc");
case VM_MEMORY_MALLOC_TINY:
- return _("malloc_tiny");
+ return _ ("malloc_tiny");
case VM_MEMORY_ANALYSIS_TOOL:
- return _("analysis_tool");
+ return _ ("analysis_tool");
case VM_MEMORY_MACH_MSG:
- return _("mach_msg");
+ return _ ("mach_msg");
case VM_MEMORY_IOKIT:
- return _("iokit");
+ return _ ("iokit");
case VM_MEMORY_STACK:
- return _("stack");
+ return _ ("stack");
case VM_MEMORY_GUARD:
- return _("guard");
+ return _ ("guard");
case VM_MEMORY_SHARED_PMAP:
- return _("shared_pmap");
+ return _ ("shared_pmap");
case VM_MEMORY_DYLIB:
- return _("dylib");
+ return _ ("dylib");
case VM_MEMORY_APPKIT:
- return _("appkit");
+ return _ ("appkit");
case VM_MEMORY_FOUNDATION:
- return _("foundation");
+ return _ ("foundation");
default:
return NULL;
}
@@ -526,7 +520,7 @@ darwin_debug_regions (task_t task, mach_vm_address_t address, int max)
(vm_region_info_t) &info, &count, &object_name);
if (kret != KERN_SUCCESS)
{
- gdb_printf (_("No memory regions."));
+ gdb_printf (_ ("No memory regions."));
return;
}
memcpy (&prev_info, &info, sizeof (vm_region_basic_info_data_64_t));
@@ -548,9 +542,9 @@ darwin_debug_regions (task_t task, mach_vm_address_t address, int max)
if (!done)
{
count = VM_REGION_BASIC_INFO_COUNT_64;
- kret =
- mach_vm_region (task, &address, &size, VM_REGION_BASIC_INFO_64,
- (vm_region_info_t) &info, &count, &object_name);
+ kret
+ = mach_vm_region (task, &address, &size, VM_REGION_BASIC_INFO_64,
+ (vm_region_info_t) &info, &count, &object_name);
if (kret != KERN_SUCCESS)
{
size = 0;
@@ -570,19 +564,19 @@ darwin_debug_regions (task_t task, mach_vm_address_t address, int max)
if (print)
{
- gdb_printf (_("%s-%s %s/%s %s %s %s"),
+ gdb_printf (_ ("%s-%s %s/%s %s %s %s"),
paddress (target_gdbarch (), prev_address),
paddress (target_gdbarch (), prev_address + prev_size),
unparse_protection (prev_info.protection),
unparse_protection (prev_info.max_protection),
unparse_inheritance (prev_info.inheritance),
- prev_info.shared ? _("shrd") : _("priv"),
- prev_info.reserved ? _("reserved") : _("not-rsvd"));
+ prev_info.shared ? _ ("shrd") : _ ("priv"),
+ prev_info.reserved ? _ ("reserved") : _ ("not-rsvd"));
if (nsubregions > 1)
- gdb_printf (_(" (%d sub-rgn)"), nsubregions);
+ gdb_printf (_ (" (%d sub-rgn)"), nsubregions);
- gdb_printf (_("\n"));
+ gdb_printf (_ ("\n"));
prev_address = address;
prev_size = size;
@@ -667,7 +661,7 @@ darwin_debug_regions_recurse (task_t task)
unparse_share_mode (r_info.share_mode));
uiout->field_signed ("depth", r_depth);
uiout->field_string ("submap",
- r_info.is_submap ? _("sm ") : _("obj"));
+ r_info.is_submap ? _ ("sm ") : _ ("obj"));
tag = unparse_user_tag (r_info.user_tag);
if (tag)
uiout->field_string ("tag", tag);
@@ -684,7 +678,6 @@ darwin_debug_regions_recurse (task_t task)
}
}
-
static void
darwin_debug_region (task_t task, mach_vm_address_t address)
{
@@ -699,7 +692,7 @@ info_mach_regions_command (const char *args, int from_tty)
task = get_task_from_args (args);
if (task == TASK_NULL)
return;
-
+
darwin_debug_regions (task, 0, -1);
}
@@ -711,7 +704,7 @@ info_mach_regions_recurse_command (const char *args, int from_tty)
task = get_task_from_args (args);
if (task == TASK_NULL)
return;
-
+
darwin_debug_regions_recurse (task);
}
@@ -731,7 +724,7 @@ info_mach_region_command (const char *exp, int from_tty)
address = value_as_address (val);
if (inferior_ptid == null_ptid)
- error (_("Inferior not available"));
+ error (_ ("Inferior not available"));
inf = current_inferior ();
darwin_inferior *priv = get_darwin_inferior (inf);
@@ -743,48 +736,48 @@ disp_exception (const darwin_exception_info *info)
{
int i;
- gdb_printf (_("%d exceptions:\n"), info->count);
+ gdb_printf (_ ("%d exceptions:\n"), info->count);
for (i = 0; i < info->count; i++)
{
exception_mask_t mask = info->masks[i];
- gdb_printf (_("port 0x%04x, behavior: "), info->ports[i]);
+ gdb_printf (_ ("port 0x%04x, behavior: "), info->ports[i]);
switch (info->behaviors[i])
{
case EXCEPTION_DEFAULT:
- gdb_printf (_("default"));
+ gdb_printf (_ ("default"));
break;
case EXCEPTION_STATE:
- gdb_printf (_("state"));
+ gdb_printf (_ ("state"));
break;
case EXCEPTION_STATE_IDENTITY:
- gdb_printf (_("state-identity"));
+ gdb_printf (_ ("state-identity"));
break;
default:
- gdb_printf (_("0x%x"), info->behaviors[i]);
+ gdb_printf (_ ("0x%x"), info->behaviors[i]);
}
- gdb_printf (_(", masks:"));
+ gdb_printf (_ (", masks:"));
if (mask & EXC_MASK_BAD_ACCESS)
- gdb_printf (_(" BAD_ACCESS"));
+ gdb_printf (_ (" BAD_ACCESS"));
if (mask & EXC_MASK_BAD_INSTRUCTION)
- gdb_printf (_(" BAD_INSTRUCTION"));
+ gdb_printf (_ (" BAD_INSTRUCTION"));
if (mask & EXC_MASK_ARITHMETIC)
- gdb_printf (_(" ARITHMETIC"));
+ gdb_printf (_ (" ARITHMETIC"));
if (mask & EXC_MASK_EMULATION)
- gdb_printf (_(" EMULATION"));
+ gdb_printf (_ (" EMULATION"));
if (mask & EXC_MASK_SOFTWARE)
- gdb_printf (_(" SOFTWARE"));
+ gdb_printf (_ (" SOFTWARE"));
if (mask & EXC_MASK_BREAKPOINT)
- gdb_printf (_(" BREAKPOINT"));
+ gdb_printf (_ (" BREAKPOINT"));
if (mask & EXC_MASK_SYSCALL)
- gdb_printf (_(" SYSCALL"));
+ gdb_printf (_ (" SYSCALL"));
if (mask & EXC_MASK_MACH_SYSCALL)
- gdb_printf (_(" MACH_SYSCALL"));
+ gdb_printf (_ (" MACH_SYSCALL"));
if (mask & EXC_MASK_RPC_ALERT)
- gdb_printf (_(" RPC_ALERT"));
+ gdb_printf (_ (" RPC_ALERT"));
if (mask & EXC_MASK_CRASH)
- gdb_printf (_(" CRASH"));
- gdb_printf (_("\n"));
+ gdb_printf (_ (" CRASH"));
+ gdb_printf (_ ("\n"));
}
}
@@ -801,7 +794,7 @@ info_mach_exceptions_command (const char *args, int from_tty)
if (strcmp (args, "saved") == 0)
{
if (inferior_ptid == null_ptid)
- gdb_printf (_("No inferior running\n"));
+ gdb_printf (_ ("No inferior running\n"));
darwin_inferior *priv = get_darwin_inferior (current_inferior ());
@@ -811,57 +804,58 @@ info_mach_exceptions_command (const char *args, int from_tty)
else if (strcmp (args, "host") == 0)
{
/* FIXME: This needs a privileged host port! */
- kret = host_get_exception_ports
- (darwin_host_self, EXC_MASK_ALL, info.masks,
- &info.count, info.ports, info.behaviors, info.flavors);
+ kret = host_get_exception_ports (darwin_host_self, EXC_MASK_ALL,
+ info.masks, &info.count, info.ports,
+ info.behaviors, info.flavors);
MACH_CHECK_ERROR (kret);
disp_exception (&info);
}
else
- error (_("Parameter is saved, host or none"));
+ error (_ ("Parameter is saved, host or none"));
}
else
{
struct inferior *inf;
if (inferior_ptid == null_ptid)
- gdb_printf (_("No inferior running\n"));
+ gdb_printf (_ ("No inferior running\n"));
inf = current_inferior ();
-
+
darwin_inferior *priv = get_darwin_inferior (inf);
- kret = task_get_exception_ports
- (priv->task, EXC_MASK_ALL, info.masks,
- &info.count, info.ports, info.behaviors, info.flavors);
+ kret = task_get_exception_ports (priv->task, EXC_MASK_ALL, info.masks,
+ &info.count, info.ports, info.behaviors,
+ info.flavors);
MACH_CHECK_ERROR (kret);
disp_exception (&info);
}
}
void _initialize_darwin_info_commands ();
+
void
_initialize_darwin_info_commands ()
{
add_info ("mach-tasks", info_mach_tasks_command,
- _("Get list of tasks in system."));
+ _ ("Get list of tasks in system."));
add_info ("mach-ports", info_mach_ports_command,
- _("Get list of ports in a task."));
+ _ ("Get list of ports in a task."));
add_info ("mach-port", info_mach_port_command,
- _("Get info on a specific port."));
+ _ ("Get info on a specific port."));
add_info ("mach-task", info_mach_task_command,
- _("Get info on a specific task."));
+ _ ("Get info on a specific task."));
add_info ("mach-threads", info_mach_threads_command,
- _("Get list of threads in a task."));
+ _ ("Get list of threads in a task."));
add_info ("mach-thread", info_mach_thread_command,
- _("Get info on a specific thread."));
+ _ ("Get info on a specific thread."));
add_info ("mach-regions", info_mach_regions_command,
- _("Get information on all mach region for the task."));
+ _ ("Get information on all mach region for the task."));
add_info ("mach-regions-rec", info_mach_regions_recurse_command,
- _("Get information on all mach sub region for the task."));
+ _ ("Get information on all mach sub region for the task."));
add_info ("mach-region", info_mach_region_command,
- _("Get information on mach region at given address."));
+ _ ("Get information on mach region at given address."));
add_info ("mach-exceptions", info_mach_exceptions_command,
- _("Disp mach exceptions."));
+ _ ("Disp mach exceptions."));
}
diff --git a/gdb/darwin-nat.c b/gdb/darwin-nat.c
index f272f0d36a7..d1fc0fae0c2 100644
--- a/gdb/darwin-nat.c
+++ b/gdb/darwin-nat.c
@@ -85,9 +85,8 @@
Some Mach documentation is available for Apple xnu source package or
from the web. */
-
#define PTRACE(CMD, PID, ADDR, SIG) \
- darwin_ptrace(#CMD, CMD, (PID), (ADDR), (SIG))
+ darwin_ptrace (#CMD, CMD, (PID), (ADDR), (SIG))
static void darwin_ptrace_me (void);
@@ -126,7 +125,7 @@ static struct inferior *darwin_inf_fake_stop;
static const char *copied_shell;
#define PAGE_TRUNC(x) ((x) & ~(mach_page_size - 1))
-#define PAGE_ROUND(x) PAGE_TRUNC((x) + mach_page_size - 1)
+#define PAGE_ROUND(x) PAGE_TRUNC ((x) + mach_page_size - 1)
/* This controls output of inferior debugging. */
static unsigned int darwin_debug_flag = 0;
@@ -137,25 +136,25 @@ static unsigned int darwin_debug_flag = 0;
Once gdb is built, you must codesign it with any system-trusted signing
authority. See taskgated(8) for details. */
static const unsigned char info_plist[]
-__attribute__ ((section ("__TEXT,__info_plist"),used)) =
- "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
- "<!DOCTYPE plist PUBLIC \"-//Apple Computer//DTD PLIST 1.0//EN\""
- " \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">\n"
- "<plist version=\"1.0\">\n"
- "<dict>\n"
- " <key>CFBundleIdentifier</key>\n"
- " <string>org.gnu.gdb</string>\n"
- " <key>CFBundleName</key>\n"
- " <string>gdb</string>\n"
- " <key>CFBundleVersion</key>\n"
- " <string>1.0</string>\n"
- " <key>SecTaskAccess</key>\n"
- " <array>\n"
- " <string>allowed</string>\n"
- " <string>debug</string>\n"
- " </array>\n"
- "</dict>\n"
- "</plist>\n";
+ __attribute__ ((section ("__TEXT,__info_plist"), used))
+ = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
+ "<!DOCTYPE plist PUBLIC \"-//Apple Computer//DTD PLIST 1.0//EN\""
+ " \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">\n"
+ "<plist version=\"1.0\">\n"
+ "<dict>\n"
+ " <key>CFBundleIdentifier</key>\n"
+ " <string>org.gnu.gdb</string>\n"
+ " <key>CFBundleName</key>\n"
+ " <string>gdb</string>\n"
+ " <key>CFBundleVersion</key>\n"
+ " <string>1.0</string>\n"
+ " <key>SecTaskAccess</key>\n"
+ " <array>\n"
+ " <string>allowed</string>\n"
+ " <string>debug</string>\n"
+ " </array>\n"
+ "</dict>\n"
+ "</plist>\n";
static void inferior_debug (int level, const char *fmt, ...)
ATTRIBUTE_PRINTF (2, 3);
@@ -169,22 +168,22 @@ inferior_debug (int level, const char *fmt, ...)
return;
va_start (ap, fmt);
- gdb_printf (gdb_stdlog, _("[%d inferior]: "), getpid ());
+ gdb_printf (gdb_stdlog, _ ("[%d inferior]: "), getpid ());
gdb_vprintf (gdb_stdlog, fmt, ap);
va_end (ap);
}
void
-mach_check_error (kern_return_t ret, const char *file,
- unsigned int line, const char *func)
+mach_check_error (kern_return_t ret, const char *file, unsigned int line,
+ const char *func)
{
if (ret == KERN_SUCCESS)
return;
if (func == NULL)
- func = _("[UNKNOWN]");
+ func = _ ("[UNKNOWN]");
- warning (_("Mach error at \"%s:%u\" in function \"%s\": %s (0x%lx)"),
- file, line, func, mach_error_string (ret), (unsigned long) ret);
+ warning (_ ("Mach error at \"%s:%u\" in function \"%s\": %s (0x%lx)"), file,
+ line, func, mach_error_string (ret), (unsigned long) ret);
}
static const char *
@@ -215,7 +214,7 @@ unparse_exception_type (unsigned int i)
case EXC_CRASH:
return "EXC_CRASH";
default:
- snprintf (unknown_exception_buf, 32, _("unknown (%d)"), i);
+ snprintf (unknown_exception_buf, 32, _ ("unknown (%d)"), i);
return unknown_exception_buf;
}
}
@@ -230,8 +229,7 @@ unparse_exception_type (unsigned int i)
return zero in that case. */
static int
-darwin_ptrace (const char *name,
- int request, int pid, caddr_t arg3, int arg4)
+darwin_ptrace (const char *name, int request, int pid, caddr_t arg3, int arg4)
{
int ret;
@@ -240,18 +238,18 @@ darwin_ptrace (const char *name,
if (ret == -1 && errno == 0)
ret = 0;
- inferior_debug (4, _("ptrace (%s, %d, 0x%lx, %d): %d (%s)\n"),
- name, pid, (unsigned long) arg3, arg4, ret,
- (ret != 0) ? safe_strerror (errno) : _("no error"));
+ inferior_debug (4, _ ("ptrace (%s, %d, 0x%lx, %d): %d (%s)\n"), name, pid,
+ (unsigned long) arg3, arg4, ret,
+ (ret != 0) ? safe_strerror (errno) : _ ("no error"));
return ret;
}
static int
cmp_thread_t (const void *l, const void *r)
{
- thread_t tl = *(const thread_t *)l;
- thread_t tr = *(const thread_t *)r;
- return (int)(tl - tr);
+ thread_t tl = *(const thread_t *) l;
+ thread_t tr = *(const thread_t *) r;
+ return (int) (tl - tr);
}
void
@@ -317,9 +315,9 @@ darwin_nat_target::check_new_threads (inferior *inf)
= (old_ix < old_nbr) ? darwin_inf->threads[old_ix] : NULL;
thread_t old_id = old != NULL ? old->gdb_port : THREAD_NULL;
- inferior_debug
- (12, _(" new_ix:%d/%d, old_ix:%d/%d, new_id:0x%x old_id:0x%x\n"),
- new_ix, new_nbr, old_ix, old_nbr, new_id, old_id);
+ inferior_debug (
+ 12, _ (" new_ix:%d/%d, old_ix:%d/%d, new_id:0x%x old_id:0x%x\n"),
+ new_ix, new_nbr, old_ix, old_nbr, new_id, old_id);
if (old_id == new_id)
{
@@ -459,20 +457,13 @@ darwin_resume_inferior (struct inferior *inf)
static void
darwin_dump_message (mach_msg_header_t *hdr, int disp_body)
{
- gdb_printf (gdb_stdlog,
- _("message header:\n"));
- gdb_printf (gdb_stdlog,
- _(" bits: 0x%x\n"), hdr->msgh_bits);
- gdb_printf (gdb_stdlog,
- _(" size: 0x%x\n"), hdr->msgh_size);
- gdb_printf (gdb_stdlog,
- _(" remote-port: 0x%x\n"), hdr->msgh_remote_port);
- gdb_printf (gdb_stdlog,
- _(" local-port: 0x%x\n"), hdr->msgh_local_port);
- gdb_printf (gdb_stdlog,
- _(" reserved: 0x%x\n"), hdr->msgh_reserved);
- gdb_printf (gdb_stdlog,
- _(" id: 0x%x\n"), hdr->msgh_id);
+ gdb_printf (gdb_stdlog, _ ("message header:\n"));
+ gdb_printf (gdb_stdlog, _ (" bits: 0x%x\n"), hdr->msgh_bits);
+ gdb_printf (gdb_stdlog, _ (" size: 0x%x\n"), hdr->msgh_size);
+ gdb_printf (gdb_stdlog, _ (" remote-port: 0x%x\n"), hdr->msgh_remote_port);
+ gdb_printf (gdb_stdlog, _ (" local-port: 0x%x\n"), hdr->msgh_local_port);
+ gdb_printf (gdb_stdlog, _ (" reserved: 0x%x\n"), hdr->msgh_reserved);
+ gdb_printf (gdb_stdlog, _ (" id: 0x%x\n"), hdr->msgh_id);
if (disp_body)
{
@@ -481,18 +472,17 @@ darwin_dump_message (mach_msg_header_t *hdr, int disp_body)
int size;
int i;
- data = (unsigned char *)(hdr + 1);
+ data = (unsigned char *) (hdr + 1);
size = hdr->msgh_size - sizeof (mach_msg_header_t);
if (hdr->msgh_bits & MACH_MSGH_BITS_COMPLEX)
{
- mach_msg_body_t *bod = (mach_msg_body_t*)data;
- mach_msg_port_descriptor_t *desc =
- (mach_msg_port_descriptor_t *)(bod + 1);
+ mach_msg_body_t *bod = (mach_msg_body_t *) data;
+ mach_msg_port_descriptor_t *desc
+ = (mach_msg_port_descriptor_t *) (bod + 1);
int k;
NDR_record_t *ndr;
- gdb_printf (gdb_stdlog,
- _("body: descriptor_count=%u\n"),
+ gdb_printf (gdb_stdlog, _ ("body: descriptor_count=%u\n"),
bod->msgh_descriptor_count);
data += sizeof (mach_msg_body_t);
size -= sizeof (mach_msg_body_t);
@@ -500,37 +490,35 @@ darwin_dump_message (mach_msg_header_t *hdr, int disp_body)
switch (desc[k].type)
{
case MACH_MSG_PORT_DESCRIPTOR:
- gdb_printf
- (gdb_stdlog,
- _(" descr %d: type=%u (port) name=0x%x, dispo=%d\n"),
- k, desc[k].type, desc[k].name, desc[k].disposition);
+ gdb_printf (
+ gdb_stdlog,
+ _ (" descr %d: type=%u (port) name=0x%x, dispo=%d\n"), k,
+ desc[k].type, desc[k].name, desc[k].disposition);
break;
default:
- gdb_printf (gdb_stdlog,
- _(" descr %d: type=%u\n"),
- k, desc[k].type);
+ gdb_printf (gdb_stdlog, _ (" descr %d: type=%u\n"), k,
+ desc[k].type);
break;
}
data += bod->msgh_descriptor_count
- * sizeof (mach_msg_port_descriptor_t);
+ * sizeof (mach_msg_port_descriptor_t);
size -= bod->msgh_descriptor_count
- * sizeof (mach_msg_port_descriptor_t);
- ndr = (NDR_record_t *)(desc + bod->msgh_descriptor_count);
- gdb_printf
- (gdb_stdlog,
- _("NDR: mig=%02x if=%02x encod=%02x "
- "int=%02x char=%02x float=%02x\n"),
- ndr->mig_vers, ndr->if_vers, ndr->mig_encoding,
- ndr->int_rep, ndr->char_rep, ndr->float_rep);
+ * sizeof (mach_msg_port_descriptor_t);
+ ndr = (NDR_record_t *) (desc + bod->msgh_descriptor_count);
+ gdb_printf (gdb_stdlog,
+ _ ("NDR: mig=%02x if=%02x encod=%02x "
+ "int=%02x char=%02x float=%02x\n"),
+ ndr->mig_vers, ndr->if_vers, ndr->mig_encoding,
+ ndr->int_rep, ndr->char_rep, ndr->float_rep);
data += sizeof (NDR_record_t);
size -= sizeof (NDR_record_t);
}
- gdb_printf (gdb_stdlog, _(" data:"));
- ldata = (const unsigned int *)data;
+ gdb_printf (gdb_stdlog, _ (" data:"));
+ ldata = (const unsigned int *) data;
for (i = 0; i < size / sizeof (unsigned int); i++)
gdb_printf (gdb_stdlog, " %08x", ldata[i]);
- gdb_printf (gdb_stdlog, _("\n"));
+ gdb_printf (gdb_stdlog, _ ("\n"));
}
}
@@ -563,11 +551,10 @@ darwin_find_new_inferior (task_t task_port, thread_t thread_port)
darwin_deallocate_exception_ports (priv);
/* No need to remove dead_name notification, but still... */
- kret = mach_port_request_notification (gdb_task, priv->task,
- MACH_NOTIFY_DEAD_NAME, 0,
- MACH_PORT_NULL,
- MACH_MSG_TYPE_MAKE_SEND_ONCE,
- &prev);
+ kret
+ = mach_port_request_notification (gdb_task, priv->task,
+ MACH_NOTIFY_DEAD_NAME, 0, MACH_PORT_NULL,
+ MACH_MSG_TYPE_MAKE_SEND_ONCE, &prev);
if (kret != KERN_INVALID_ARGUMENT)
MACH_CHECK_ERROR (kret);
@@ -587,8 +574,7 @@ darwin_find_new_inferior (task_t task_port, thread_t thread_port)
static int
darwin_check_message_ndr (NDR_record_t *ndr)
{
- if (ndr->mig_vers != NDR_PROTOCOL_2_0
- || ndr->if_vers != NDR_PROTOCOL_2_0
+ if (ndr->mig_vers != NDR_PROTOCOL_2_0 || ndr->if_vers != NDR_PROTOCOL_2_0
|| ndr->mig_encoding != NDR_record.mig_encoding
|| ndr->int_rep != NDR_record.int_rep
|| ndr->char_rep != NDR_record.char_rep
@@ -604,8 +590,8 @@ darwin_nat_target::decode_exception_message (mach_msg_header_t *hdr,
inferior **pinf,
darwin_thread_t **pthread)
{
- mach_msg_body_t *bod = (mach_msg_body_t*)(hdr + 1);
- mach_msg_port_descriptor_t *desc = (mach_msg_port_descriptor_t *)(bod + 1);
+ mach_msg_body_t *bod = (mach_msg_body_t *) (hdr + 1);
+ mach_msg_port_descriptor_t *desc = (mach_msg_port_descriptor_t *) (bod + 1);
NDR_record_t *ndr;
integer_t *data;
struct inferior *inf;
@@ -634,12 +620,12 @@ darwin_nat_target::decode_exception_message (mach_msg_header_t *hdr,
return -1;
/* Check data representation. */
- ndr = (NDR_record_t *)(desc + 2);
+ ndr = (NDR_record_t *) (desc + 2);
if (darwin_check_message_ndr (ndr) != 0)
return -1;
/* Ok, the hard work. */
- data = (integer_t *)(ndr + 1);
+ data = (integer_t *) (ndr + 1);
task_port = desc[1].name;
thread_port = desc[0].name;
@@ -678,9 +664,9 @@ darwin_nat_target::decode_exception_message (mach_msg_header_t *hdr,
FIXME: should the exception port be restored ? */
mig_reply_error_t reply;
- inferior_debug
- (4, _("darwin_decode_exception_message: unknown task 0x%x\n"),
- task_port);
+ inferior_debug (
+ 4, _ ("darwin_decode_exception_message: unknown task 0x%x\n"),
+ task_port);
/* Free thread port (we don't know it). */
kret = mach_port_deallocate (mach_task_self (), thread_port);
@@ -689,9 +675,8 @@ darwin_nat_target::decode_exception_message (mach_msg_header_t *hdr,
darwin_encode_reply (&reply, hdr, KERN_SUCCESS);
kret = mach_msg (&reply.Head, MACH_SEND_MSG | MACH_SEND_INTERRUPT,
- reply.Head.msgh_size, 0,
- MACH_PORT_NULL, MACH_MSG_TIMEOUT_NONE,
- MACH_PORT_NULL);
+ reply.Head.msgh_size, 0, MACH_PORT_NULL,
+ MACH_MSG_TIMEOUT_NONE, MACH_PORT_NULL);
MACH_CHECK_ERROR (kret);
return 0;
@@ -723,10 +708,10 @@ darwin_nat_target::decode_exception_message (mach_msg_header_t *hdr,
thread->event.ex_type = data[0];
thread->event.data_count = data[1];
- if (hdr->msgh_size < (sizeof (*hdr) + sizeof (*bod) + 2 * sizeof (*desc)
- + sizeof (*ndr) + 2 * sizeof (integer_t)
- + data[1] * sizeof (integer_t)))
- return -1;
+ if (hdr->msgh_size
+ < (sizeof (*hdr) + sizeof (*bod) + 2 * sizeof (*desc) + sizeof (*ndr)
+ + 2 * sizeof (integer_t) + data[1] * sizeof (integer_t)))
+ return -1;
for (i = 0; i < data[1]; i++)
thread->event.ex_data[i] = data[2 + i];
@@ -740,8 +725,8 @@ darwin_nat_target::decode_exception_message (mach_msg_header_t *hdr,
static int
darwin_decode_notify_message (mach_msg_header_t *hdr, struct inferior **pinf)
{
- NDR_record_t *ndr = (NDR_record_t *)(hdr + 1);
- integer_t *data = (integer_t *)(ndr + 1);
+ NDR_record_t *ndr = (NDR_record_t *) (hdr + 1);
+ integer_t *data = (integer_t *) (ndr + 1);
struct inferior *inf;
task_t task_port;
@@ -800,9 +785,8 @@ darwin_send_reply (struct inferior *inf, darwin_thread_t *thread)
darwin_encode_reply (&reply, &thread->event.header, KERN_SUCCESS);
kret = mach_msg (&reply.Head, MACH_SEND_MSG | MACH_SEND_INTERRUPT,
- reply.Head.msgh_size, 0,
- MACH_PORT_NULL, MACH_MSG_TIMEOUT_NONE,
- MACH_PORT_NULL);
+ reply.Head.msgh_size, 0, MACH_PORT_NULL,
+ MACH_MSG_TIMEOUT_NONE, MACH_PORT_NULL);
MACH_CHECK_ERROR (kret);
priv->pending_messages--;
@@ -823,12 +807,12 @@ darwin_pthread_kill (darwin_thread_t *thread, int nsignal)
}
static void
-darwin_resume_thread (struct inferior *inf, darwin_thread_t *thread,
- int step, int nsignal)
+darwin_resume_thread (struct inferior *inf, darwin_thread_t *thread, int step,
+ int nsignal)
{
- inferior_debug
- (3, _("darwin_resume_thread: state=%d, thread=0x%x, step=%d nsignal=%d\n"),
- thread->msg_state, thread->gdb_port, step, nsignal);
+ inferior_debug (
+ 3, _ ("darwin_resume_thread: state=%d, thread=0x%x, step=%d nsignal=%d\n"),
+ thread->msg_state, thread->gdb_port, step, nsignal);
switch (thread->msg_state)
{
@@ -840,20 +824,20 @@ darwin_resume_thread (struct inferior *inf, darwin_thread_t *thread,
int res = PTRACE (PT_THUPDATE, inf->pid,
(caddr_t) (uintptr_t) thread->gdb_port, nsignal);
if (res < 0)
- inferior_debug (1, _("ptrace THUP: res=%d\n"), res);
+ inferior_debug (1, _ ("ptrace THUP: res=%d\n"), res);
}
else if (nsignal)
{
/* Note: ptrace is allowed only if the process is stopped.
Directly send the signal to the thread. */
int res = darwin_pthread_kill (thread, nsignal);
- inferior_debug (4, _("darwin_resume_thread: kill 0x%x %d: %d\n"),
+ inferior_debug (4, _ ("darwin_resume_thread: kill 0x%x %d: %d\n"),
thread->gdb_port, nsignal, res);
thread->signaled = 1;
}
/* Set or reset single step. */
- inferior_debug (4, _("darwin_set_sstep (thread=0x%x, enable=%d)\n"),
+ inferior_debug (4, _ ("darwin_set_sstep (thread=0x%x, enable=%d)\n"),
thread->gdb_port, step);
darwin_set_sstep (thread->gdb_port, step);
thread->single_step = step;
@@ -916,9 +900,8 @@ darwin_nat_target::resume (ptid_t ptid, int step, enum gdb_signal signal)
{
int nsignal;
- inferior_debug
- (2, _("darwin_resume: ptid=%s, step=%d, signal=%d\n"),
- ptid.to_string ().c_str (), step, signal);
+ inferior_debug (2, _ ("darwin_resume: ptid=%s, step=%d, signal=%d\n"),
+ ptid.to_string ().c_str (), step, signal);
if (signal == GDB_SIGNAL_0)
nsignal = 0;
@@ -970,8 +953,7 @@ darwin_nat_target::resume (ptid_t ptid, int step, enum gdb_signal signal)
ptid_t
darwin_nat_target::decode_message (mach_msg_header_t *hdr,
- darwin_thread_t **pthread,
- inferior **pinf,
+ darwin_thread_t **pthread, inferior **pinf,
target_waitstatus *status)
{
darwin_thread_t *thread;
@@ -988,7 +970,7 @@ darwin_nat_target::decode_message (mach_msg_header_t *hdr,
if (res < 0)
{
/* Should not happen... */
- warning (_("darwin_wait: ill-formatted message (id=0x%x)\n"),
+ warning (_ ("darwin_wait: ill-formatted message (id=0x%x)\n"),
hdr->msgh_id);
/* FIXME: send a failure reply? */
status->set_ignore ();
@@ -1008,7 +990,7 @@ darwin_nat_target::decode_message (mach_msg_header_t *hdr,
thread->msg_state = DARWIN_MESSAGE;
- inferior_debug (4, _("darwin_wait: thread=0x%x, got %s\n"),
+ inferior_debug (4, _ ("darwin_wait: thread=0x%x, got %s\n"),
thread->gdb_port,
unparse_exception_type (thread->event.ex_type));
@@ -1029,9 +1011,9 @@ darwin_nat_target::decode_message (mach_msg_header_t *hdr,
case EXC_SOFTWARE:
if (thread->event.ex_data[0] == EXC_SOFT_SIGNAL)
{
- status->set_stopped
- (gdb_signal_from_host (thread->event.ex_data[1]));
- inferior_debug (5, _(" (signal %d: %s)\n"),
+ status->set_stopped (
+ gdb_signal_from_host (thread->event.ex_data[1]));
+ inferior_debug (5, _ (" (signal %d: %s)\n"),
thread->event.ex_data[1],
gdb_signal_to_name (status->sig ()));
@@ -1071,9 +1053,9 @@ darwin_nat_target::decode_message (mach_msg_header_t *hdr,
if (res < 0)
{
/* Should not happen... */
- warning
- (_("darwin_wait: ill-formatted message (id=0x%x, res=%d)\n"),
- hdr->msgh_id, res);
+ warning (
+ _ ("darwin_wait: ill-formatted message (id=0x%x, res=%d)\n"),
+ hdr->msgh_id, res);
}
*pinf = NULL;
@@ -1097,38 +1079,43 @@ darwin_nat_target::decode_message (mach_msg_header_t *hdr,
res_pid = wait4 (inf->pid, &wstatus, 0, NULL);
if (res_pid < 0 || res_pid != inf->pid)
{
- warning (_("wait4: res=%d: %s\n"),
- res_pid, safe_strerror (errno));
+ warning (_ ("wait4: res=%d: %s\n"), res_pid,
+ safe_strerror (errno));
status->set_ignore ();
return minus_one_ptid;
}
if (WIFEXITED (wstatus))
{
status->set_exited (WEXITSTATUS (wstatus));
- inferior_debug (4, _("darwin_wait: pid=%d exit, status=0x%x\n"),
- res_pid, wstatus);
+ inferior_debug (
+ 4, _ ("darwin_wait: pid=%d exit, status=0x%x\n"), res_pid,
+ wstatus);
}
else if (WIFSTOPPED (wstatus))
{
/* Ignore stopped state, it will be handled by the next
exception. */
status->set_ignore ();
- inferior_debug (4, _("darwin_wait: pid %d received WIFSTOPPED\n"),
- res_pid);
+ inferior_debug (
+ 4, _ ("darwin_wait: pid %d received WIFSTOPPED\n"),
+ res_pid);
return minus_one_ptid;
}
else if (WIFSIGNALED (wstatus))
{
- status->set_signalled
- (gdb_signal_from_host (WTERMSIG (wstatus)));
- inferior_debug (4, _("darwin_wait: pid=%d received signal %d\n"),
- res_pid, status->sig());
+ status->set_signalled (
+ gdb_signal_from_host (WTERMSIG (wstatus)));
+ inferior_debug (
+ 4, _ ("darwin_wait: pid=%d received signal %d\n"), res_pid,
+ status->sig ());
}
else
{
status->set_ignore ();
- warning (_("Unexpected wait status after MACH_NOTIFY_DEAD_NAME "
- "notification: 0x%x"), wstatus);
+ warning (
+ _ ("Unexpected wait status after MACH_NOTIFY_DEAD_NAME "
+ "notification: 0x%x"),
+ wstatus);
return minus_one_ptid;
}
@@ -1136,7 +1123,7 @@ darwin_nat_target::decode_message (mach_msg_header_t *hdr,
}
else
{
- inferior_debug (4, _("darwin_wait: pid=%d\n"), inf->pid);
+ inferior_debug (4, _ ("darwin_wait: pid=%d\n"), inf->pid);
status->set_exited (0 /* Don't know. */);
return ptid_t (inf->pid, 0, 0);
}
@@ -1144,7 +1131,7 @@ darwin_nat_target::decode_message (mach_msg_header_t *hdr,
}
/* Unknown message. */
- warning (_("darwin: got unknown message, id: 0x%x"), hdr->msgh_id);
+ warning (_ ("darwin: got unknown message, id: 0x%x"), hdr->msgh_id);
status->set_ignore ();
return minus_one_ptid;
}
@@ -1183,18 +1170,19 @@ ptid_t
darwin_nat_target::wait_1 (ptid_t ptid, struct target_waitstatus *status)
{
kern_return_t kret;
+
union
{
mach_msg_header_t hdr;
char data[0x100];
} msgin;
+
mach_msg_header_t *hdr = &msgin.hdr;
ptid_t res;
darwin_thread_t *thread;
- inferior_debug
- (2, _("darwin_wait: waiting for a message ptid=%s\n"),
- ptid.to_string ().c_str ());
+ inferior_debug (2, _ ("darwin_wait: waiting for a message ptid=%s\n"),
+ ptid.to_string ().c_str ());
/* Handle fake stop events at first. */
if (darwin_inf_fake_stop != NULL)
@@ -1215,8 +1203,9 @@ darwin_nat_target::wait_1 (ptid_t ptid, struct target_waitstatus *status)
/* set_sigint_trap (); */
/* Wait for a message. */
- kret = mach_msg (&msgin.hdr, MACH_RCV_MSG | MACH_RCV_INTERRUPT, 0,
- sizeof (msgin.data), darwin_port_set, 0, MACH_PORT_NULL);
+ kret
+ = mach_msg (&msgin.hdr, MACH_RCV_MSG | MACH_RCV_INTERRUPT, 0,
+ sizeof (msgin.data), darwin_port_set, 0, MACH_PORT_NULL);
/* clear_sigint_trap (); */
@@ -1228,7 +1217,7 @@ darwin_nat_target::wait_1 (ptid_t ptid, struct target_waitstatus *status)
if (kret != MACH_MSG_SUCCESS)
{
- inferior_debug (5, _("mach_msg: ret=0x%x\n"), kret);
+ inferior_debug (5, _ ("mach_msg: ret=0x%x\n"), kret);
status->set_spurious ();
return minus_one_ptid;
}
@@ -1261,16 +1250,16 @@ darwin_nat_target::wait_1 (ptid_t ptid, struct target_waitstatus *status)
struct target_waitstatus status2;
ptid_t ptid2;
- kret = mach_msg (&msgin.hdr,
- MACH_RCV_MSG | MACH_RCV_TIMEOUT, 0,
- sizeof (msgin.data), darwin_port_set, 1, MACH_PORT_NULL);
+ kret
+ = mach_msg (&msgin.hdr, MACH_RCV_MSG | MACH_RCV_TIMEOUT, 0,
+ sizeof (msgin.data), darwin_port_set, 1, MACH_PORT_NULL);
if (kret == MACH_RCV_TIMED_OUT)
break;
if (kret != MACH_MSG_SUCCESS)
{
- inferior_debug
- (5, _("darwin_wait: mach_msg(pending) ret=0x%x\n"), kret);
+ inferior_debug (5, _ ("darwin_wait: mach_msg(pending) ret=0x%x\n"),
+ kret);
break;
}
@@ -1292,12 +1281,12 @@ darwin_nat_target::wait_1 (ptid_t ptid, struct target_waitstatus *status)
thread->msg_state = DARWIN_RUNNING;
}
else
- inferior_debug
- (3, _("darwin_wait: thread 0x%x hit a non-gdb breakpoint\n"),
- thread->gdb_port);
+ inferior_debug (
+ 3, _ ("darwin_wait: thread 0x%x hit a non-gdb breakpoint\n"),
+ thread->gdb_port);
}
else
- inferior_debug (3, _("darwin_wait: unhandled pending message\n"));
+ inferior_debug (3, _ ("darwin_wait: unhandled pending message\n"));
}
return res;
}
@@ -1348,19 +1337,17 @@ darwin_nat_target::mourn_inferior ()
darwin_deallocate_threads (inf);
/* Remove notify_port from darwin_port_set. */
- kret = mach_port_move_member (gdb_task,
- priv->notify_port, MACH_PORT_NULL);
+ kret = mach_port_move_member (gdb_task, priv->notify_port, MACH_PORT_NULL);
MACH_CHECK_ERROR (kret);
/* Remove task port dead_name notification. */
- kret = mach_port_request_notification (gdb_task, priv->task,
- MACH_NOTIFY_DEAD_NAME, 0,
- MACH_PORT_NULL,
- MACH_MSG_TYPE_MAKE_SEND_ONCE,
- &prev);
+ kret
+ = mach_port_request_notification (gdb_task, priv->task,
+ MACH_NOTIFY_DEAD_NAME, 0, MACH_PORT_NULL,
+ MACH_MSG_TYPE_MAKE_SEND_ONCE, &prev);
/* This can fail if the task is dead. */
- inferior_debug (4, "task=0x%x, prev=0x%x, notify_port=0x%x\n",
- priv->task, prev, priv->notify_port);
+ inferior_debug (4, "task=0x%x, prev=0x%x, notify_port=0x%x\n", priv->task,
+ prev, priv->notify_port);
if (kret == KERN_SUCCESS)
{
@@ -1415,7 +1402,7 @@ darwin_nat_target::stop_inferior (inferior *inf)
res = ::kill (inf->pid, SIGSTOP);
if (res != 0)
- warning (_("cannot kill: %s"), safe_strerror (errno));
+ warning (_ ("cannot kill: %s"), safe_strerror (errno));
/* Wait until the process is really stopped. */
while (1)
@@ -1432,13 +1419,15 @@ darwin_save_exception_ports (darwin_inferior *inf)
{
kern_return_t kret;
- inf->exception_info.count =
- sizeof (inf->exception_info.ports) / sizeof (inf->exception_info.ports[0]);
+ inf->exception_info.count = sizeof (inf->exception_info.ports)
+ / sizeof (inf->exception_info.ports[0]);
- kret = task_get_exception_ports
- (inf->task, EXC_MASK_ALL, inf->exception_info.masks,
- &inf->exception_info.count, inf->exception_info.ports,
- inf->exception_info.behaviors, inf->exception_info.flavors);
+ kret = task_get_exception_ports (inf->task, EXC_MASK_ALL,
+ inf->exception_info.masks,
+ &inf->exception_info.count,
+ inf->exception_info.ports,
+ inf->exception_info.behaviors,
+ inf->exception_info.flavors);
return kret;
}
@@ -1450,9 +1439,10 @@ darwin_restore_exception_ports (darwin_inferior *inf)
for (i = 0; i < inf->exception_info.count; i++)
{
- kret = task_set_exception_ports
- (inf->task, inf->exception_info.masks[i], inf->exception_info.ports[i],
- inf->exception_info.behaviors[i], inf->exception_info.flavors[i]);
+ kret = task_set_exception_ports (inf->task, inf->exception_info.masks[i],
+ inf->exception_info.ports[i],
+ inf->exception_info.behaviors[i],
+ inf->exception_info.flavors[i]);
if (kret != KERN_SUCCESS)
return kret;
}
@@ -1485,8 +1475,8 @@ darwin_setup_exceptions (struct inferior *inf)
kret = darwin_save_exception_ports (priv);
if (kret != KERN_SUCCESS)
- error (_("Unable to save exception ports, task_get_exception_ports"
- "returned: %d"),
+ error (_ ("Unable to save exception ports, task_get_exception_ports"
+ "returned: %d"),
kret);
/* Set exception port. */
@@ -1497,8 +1487,8 @@ darwin_setup_exceptions (struct inferior *inf)
kret = task_set_exception_ports (priv->task, mask, darwin_ex_port,
EXCEPTION_DEFAULT, THREAD_STATE_NONE);
if (kret != KERN_SUCCESS)
- error (_("Unable to set exception ports, task_set_exception_ports"
- "returned: %d"),
+ error (_ ("Unable to set exception ports, task_set_exception_ports"
+ "returned: %d"),
kret);
}
@@ -1548,7 +1538,7 @@ darwin_nat_target::kill ()
ptid = wait_1 (ptid_t (inf->pid), &wstatus);
}
else if (errno != ESRCH)
- warning (_("Failed to kill inferior: kill (%d, 9) returned [%s]"),
+ warning (_ ("Failed to kill inferior: kill (%d, 9) returned [%s]"),
inf->pid, safe_strerror (errno));
target_mourn_inferior (ptid_t (inf->pid));
@@ -1561,22 +1551,22 @@ darwin_setup_request_notification (struct inferior *inf)
kern_return_t kret;
mach_port_t prev_not;
- kret = mach_port_request_notification (gdb_task, priv->task,
- MACH_NOTIFY_DEAD_NAME, 0,
- priv->notify_port,
- MACH_MSG_TYPE_MAKE_SEND_ONCE,
- &prev_not);
+ kret
+ = mach_port_request_notification (gdb_task, priv->task,
+ MACH_NOTIFY_DEAD_NAME, 0,
+ priv->notify_port,
+ MACH_MSG_TYPE_MAKE_SEND_ONCE, &prev_not);
if (kret != KERN_SUCCESS)
- error (_("Termination notification request failed, "
- "mach_port_request_notification\n"
- "returned: %d"),
+ error (_ ("Termination notification request failed, "
+ "mach_port_request_notification\n"
+ "returned: %d"),
kret);
if (prev_not != MACH_PORT_NULL)
{
/* This is unexpected, as there should not be any previously
registered notification request. But this is not a fatal
issue, so just emit a warning. */
- warning (_("\
+ warning (_ ("\
A task termination request was registered before the debugger registered\n\
its own. This is unexpected, but should otherwise not have any actual\n\
impact on the debugging session."));
@@ -1604,14 +1594,14 @@ darwin_attach_pid (struct inferior *inf)
waitpid (inf->pid, &status, 0);
}
- error
- (_("Unable to find Mach task port for process-id %d: %s (0x%lx).\n"
+ error (
+ _ ("Unable to find Mach task port for process-id %d: %s (0x%lx).\n"
" (please check gdb is codesigned - see taskgated(8))"),
- inf->pid, mach_error_string (kret), (unsigned long) kret);
+ inf->pid, mach_error_string (kret), (unsigned long) kret);
}
- inferior_debug (2, _("inferior task: 0x%x, pid: %d\n"),
- priv->task, inf->pid);
+ inferior_debug (2, _ ("inferior task: 0x%x, pid: %d\n"), priv->task,
+ inf->pid);
if (darwin_ex_port == MACH_PORT_NULL)
{
@@ -1619,32 +1609,33 @@ darwin_attach_pid (struct inferior *inf)
kret = mach_port_allocate (gdb_task, MACH_PORT_RIGHT_RECEIVE,
&darwin_ex_port);
if (kret != KERN_SUCCESS)
- error (_("Unable to create exception port, mach_port_allocate "
- "returned: %d"),
+ error (_ ("Unable to create exception port, mach_port_allocate "
+ "returned: %d"),
kret);
- kret = mach_port_insert_right (gdb_task, darwin_ex_port,
- darwin_ex_port,
- MACH_MSG_TYPE_MAKE_SEND);
+ kret
+ = mach_port_insert_right (gdb_task, darwin_ex_port, darwin_ex_port,
+ MACH_MSG_TYPE_MAKE_SEND);
if (kret != KERN_SUCCESS)
- error (_("Unable to create exception port, mach_port_insert_right "
- "returned: %d"),
- kret);
+ error (
+ _ ("Unable to create exception port, mach_port_insert_right "
+ "returned: %d"),
+ kret);
/* Create a port set and put ex_port in it. */
kret = mach_port_allocate (gdb_task, MACH_PORT_RIGHT_PORT_SET,
&darwin_port_set);
if (kret != KERN_SUCCESS)
- error (_("Unable to create port set, mach_port_allocate "
- "returned: %d"),
+ error (_ ("Unable to create port set, mach_port_allocate "
+ "returned: %d"),
kret);
kret = mach_port_move_member (gdb_task, darwin_ex_port,
darwin_port_set);
if (kret != KERN_SUCCESS)
- error (_("Unable to move exception port into new port set, "
- "mach_port_move_member\n"
- "returned: %d"),
+ error (_ ("Unable to move exception port into new port set, "
+ "mach_port_move_member\n"
+ "returned: %d"),
kret);
}
@@ -1652,16 +1643,16 @@ darwin_attach_pid (struct inferior *inf)
kret = mach_port_allocate (gdb_task, MACH_PORT_RIGHT_RECEIVE,
&priv->notify_port);
if (kret != KERN_SUCCESS)
- error (_("Unable to create notification port, mach_port_allocate "
- "returned: %d"),
+ error (_ ("Unable to create notification port, mach_port_allocate "
+ "returned: %d"),
kret);
- kret = mach_port_move_member (gdb_task,
- priv->notify_port, darwin_port_set);
+ kret
+ = mach_port_move_member (gdb_task, priv->notify_port, darwin_port_set);
if (kret != KERN_SUCCESS)
- error (_("Unable to move notification port into new port set, "
- "mach_port_move_member\n"
- "returned: %d"),
+ error (_ ("Unable to move notification port into new port set, "
+ "mach_port_move_member\n"
+ "returned: %d"),
kret);
darwin_setup_request_notification (inf);
@@ -1731,7 +1722,7 @@ darwin_ptrace_me (void)
/* Wait until gdb is ready. */
res = read (ptrace_fds[0], &c, 1);
if (res != 0)
- trace_start_error (_("unable to read from pipe, read returned: %d"), res);
+ trace_start_error (_ ("unable to read from pipe, read returned: %d"), res);
if (close (ptrace_fds[0]) < 0)
trace_start_error_with_name ("close");
@@ -1757,7 +1748,7 @@ darwin_pre_ptrace (void)
{
ptrace_fds[0] = -1;
ptrace_fds[1] = -1;
- error (_("unable to create a pipe: %s"), safe_strerror (errno));
+ error (_ ("unable to create a pipe: %s"), safe_strerror (errno));
}
mark_fd_no_cloexec (ptrace_fds[0]);
@@ -1784,7 +1775,7 @@ darwin_nat_target::ptrace_him (int pid)
}
static void
-darwin_execvp (const char *file, char * const argv[], char * const env[])
+darwin_execvp (const char *file, char *const argv[], char *const env[])
{
posix_spawnattr_t attr;
short ps_flags = 0;
@@ -1793,8 +1784,7 @@ darwin_execvp (const char *file, char * const argv[], char * const env[])
res = posix_spawnattr_init (&attr);
if (res != 0)
{
- gdb_printf
- (gdb_stderr, "Cannot initialize attribute for posix_spawn\n");
+ gdb_printf (gdb_stderr, "Cannot initialize attribute for posix_spawn\n");
return;
}
@@ -1845,31 +1835,32 @@ copy_shell_to_cache (const char *shell, const std::string &new_name)
{
scoped_fd from_fd = gdb_open_cloexec (shell, O_RDONLY, 0);
if (from_fd.get () < 0)
- error (_("Could not open shell (%s) for reading: %s"),
- shell, safe_strerror (errno));
+ error (_ ("Could not open shell (%s) for reading: %s"), shell,
+ safe_strerror (errno));
std::string new_dir = ldirname (new_name.c_str ());
if (!mkdir_recursive (new_dir.c_str ()))
- error (_("Could not make cache directory \"%s\": %s"),
- new_dir.c_str (), safe_strerror (errno));
+ error (_ ("Could not make cache directory \"%s\": %s"), new_dir.c_str (),
+ safe_strerror (errno));
gdb::char_vector temp_name = make_temp_filename (new_name);
scoped_fd to_fd = gdb_mkostemp_cloexec (&temp_name[0]);
gdb::unlinker unlink_file_on_error (temp_name.data ());
if (to_fd.get () < 0)
- error (_("Could not open temporary file \"%s\" for writing: %s"),
+ error (_ ("Could not open temporary file \"%s\" for writing: %s"),
temp_name.data (), safe_strerror (errno));
if (fcopyfile (from_fd.get (), to_fd.get (), nullptr,
- COPYFILE_STAT | COPYFILE_DATA) != 0)
- error (_("Could not copy shell to cache as \"%s\": %s"),
+ COPYFILE_STAT | COPYFILE_DATA)
+ != 0)
+ error (_ ("Could not copy shell to cache as \"%s\": %s"),
temp_name.data (), safe_strerror (errno));
/* Be sure that the caching is atomic so that we don't get bad
results from multiple copies of gdb running at the same time. */
if (rename (temp_name.data (), new_name.c_str ()) != 0)
- error (_("Could not rename shell cache file to \"%s\": %s"),
+ error (_ ("Could not rename shell cache file to \"%s\": %s"),
new_name.c_str (), safe_strerror (errno));
unlink_file_on_error.keep ();
@@ -1898,7 +1889,7 @@ maybe_cache_shell ()
const char *shell = get_shell ();
if (!IS_ABSOLUTE_PATH (shell))
{
- warning (_("This version of macOS has System Integrity Protection.\n\
+ warning (_ ("This version of macOS has System Integrity Protection.\n\
Normally gdb would try to work around this by caching a copy of your shell,\n\
but because your shell (%s) is not an absolute path, this is being skipped."),
shell);
@@ -1908,7 +1899,7 @@ but because your shell (%s) is not an absolute path, this is being skipped."),
struct stat sb;
if (stat (shell, &sb) < 0)
{
- warning (_("This version of macOS has System Integrity Protection.\n\
+ warning (_ ("This version of macOS has System Integrity Protection.\n\
Normally gdb would try to work around this by caching a copy of your shell,\n\
but because gdb could not stat your shell (%s), this is being skipped.\n\
The error was: %s"),
@@ -1934,22 +1925,24 @@ The error was: %s"),
}
catch (const gdb_exception_error &ex)
{
- warning (_("This version of macOS has System Integrity Protection.\n\
+ warning (
+ _ ("This version of macOS has System Integrity Protection.\n\
Because `startup-with-shell' is enabled, gdb tried to work around SIP by\n\
caching a copy of your shell. However, this failed:\n\
%s\n\
If you correct the problem, gdb will automatically try again the next time\n\
you \"run\". To prevent these attempts, you can use:\n\
set startup-with-shell off"),
- ex.what ());
+ ex.what ());
return false;
}
- gdb_printf (_("Note: this version of macOS has System Integrity Protection.\n\
+ gdb_printf (
+ _ ("Note: this version of macOS has System Integrity Protection.\n\
Because `startup-with-shell' is enabled, gdb has worked around this by\n\
caching a copy of your shell. The shell used by \"run\" is now:\n\
%s\n"),
- new_name.c_str ());
+ new_name.c_str ());
}
/* We need to make sure that the new name has the correct lifetime. */
@@ -1963,8 +1956,8 @@ caching a copy of your shell. The shell used by \"run\" is now:\n\
void
darwin_nat_target::create_inferior (const char *exec_file,
- const std::string &allargs,
- char **env, int from_tty)
+ const std::string &allargs, char **env,
+ int from_tty)
{
gdb::optional<scoped_restore_tmpl<bool>> restore_startup_with_shell;
darwin_nat_target *the_target = this;
@@ -1973,21 +1966,17 @@ darwin_nat_target::create_inferior (const char *exec_file,
{
if (!maybe_cache_shell ())
{
- warning (_("startup-with-shell is now temporarily disabled"));
+ warning (_ ("startup-with-shell is now temporarily disabled"));
restore_startup_with_shell.emplace (&startup_with_shell, 0);
}
}
/* Do the hard work. */
- fork_inferior (exec_file, allargs, env, darwin_ptrace_me,
- [the_target] (int pid)
- {
- the_target->ptrace_him (pid);
- },
- darwin_pre_ptrace, copied_shell,
- darwin_execvp);
+ fork_inferior (
+ exec_file, allargs, env, darwin_ptrace_me,
+ [the_target] (int pid) { the_target->ptrace_him (pid); },
+ darwin_pre_ptrace, copied_shell, darwin_execvp);
}
-
/* Set things up such that the next call to darwin_wait will immediately
return a fake stop event for inferior INF.
@@ -2026,14 +2015,14 @@ darwin_nat_target::attach (const char *args, int from_tty)
pid = parse_pid_to_attach (args);
- if (pid == getpid ()) /* Trying to masturbate? */
- error (_("I refuse to debug myself!"));
+ if (pid == getpid ()) /* Trying to masturbate? */
+ error (_ ("I refuse to debug myself!"));
target_announce_attach (from_tty, pid);
if (pid == 0 || ::kill (pid, 0) < 0)
- error (_("Can't attach to process %d: %s (%d)"),
- pid, safe_strerror (errno), errno);
+ error (_ ("Can't attach to process %d: %s (%d)"), pid,
+ safe_strerror (errno), errno);
inf = current_inferior ();
inferior_appeared (inf, pid);
@@ -2083,8 +2072,8 @@ darwin_nat_target::detach (inferior *inf, int from_tty)
{
res = PTRACE (PT_DETACH, inf->pid, 0, 0);
if (res != 0)
- warning (_("Unable to detach from process-id %d: %s (%d)"),
- inf->pid, safe_strerror (errno), errno);
+ warning (_ ("Unable to detach from process-id %d: %s (%d)"), inf->pid,
+ safe_strerror (errno), errno);
}
darwin_reply_to_all_pending_messages (inf);
@@ -2104,8 +2093,7 @@ darwin_nat_target::pid_to_str (ptid_t ptid)
long tid = ptid.tid ();
if (tid != 0)
- return string_printf (_("Thread 0x%lx of process %u"),
- tid, ptid.pid ());
+ return string_printf (_ ("Thread 0x%lx of process %u"), tid, ptid.pid ());
return normal_pid_to_str (ptid);
}
@@ -2123,14 +2111,13 @@ darwin_nat_target::thread_alive (ptid_t ptid)
Return 0 on failure; number of bytes read / written otherwise. */
static int
-darwin_read_write_inferior (task_t task, CORE_ADDR addr,
- gdb_byte *rdaddr, const gdb_byte *wraddr,
- ULONGEST length)
+darwin_read_write_inferior (task_t task, CORE_ADDR addr, gdb_byte *rdaddr,
+ const gdb_byte *wraddr, ULONGEST length)
{
kern_return_t kret;
mach_vm_size_t res_length = 0;
- inferior_debug (8, _("darwin_read_write_inferior(task=0x%x, %s, len=%s)\n"),
+ inferior_debug (8, _ ("darwin_read_write_inferior(task=0x%x, %s, len=%s)\n"),
task, core_addr_to_string (addr), pulongest (length));
/* First read. */
@@ -2146,9 +2133,9 @@ darwin_read_write_inferior (task_t task, CORE_ADDR addr,
(mach_vm_address_t) rdaddr, &count);
if (kret != KERN_SUCCESS)
{
- inferior_debug
- (1, _("darwin_read_write_inferior: mach_vm_read failed at %s: %s"),
- core_addr_to_string (addr), mach_error_string (kret));
+ inferior_debug (
+ 1, _ ("darwin_read_write_inferior: mach_vm_read failed at %s: %s"),
+ core_addr_to_string (addr), mach_error_string (kret));
return 0;
}
return count;
@@ -2161,8 +2148,8 @@ darwin_read_write_inferior (task_t task, CORE_ADDR addr,
{
mach_vm_address_t offset = addr & (mach_page_size - 1);
mach_vm_address_t region_address = (mach_vm_address_t) (addr - offset);
- mach_vm_size_t aligned_length =
- (mach_vm_size_t) PAGE_ROUND (offset + length);
+ mach_vm_size_t aligned_length
+ = (mach_vm_size_t) PAGE_ROUND (offset + length);
vm_region_submap_short_info_data_64_t info;
mach_msg_type_number_t count = VM_REGION_SUBMAP_SHORT_INFO_COUNT_64;
natural_t region_depth = 1000;
@@ -2171,33 +2158,34 @@ darwin_read_write_inferior (task_t task, CORE_ADDR addr,
mach_vm_size_t write_length;
/* Read page protection. */
- kret = mach_vm_region_recurse
- (task, &region_start, &region_length, &region_depth,
- (vm_region_recurse_info_t) &info, &count);
+ kret = mach_vm_region_recurse (task, &region_start, &region_length,
+ &region_depth,
+ (vm_region_recurse_info_t) &info, &count);
if (kret != KERN_SUCCESS)
{
- inferior_debug (1, _("darwin_read_write_inferior: "
- "mach_vm_region_recurse failed at %s: %s\n"),
+ inferior_debug (1,
+ _ ("darwin_read_write_inferior: "
+ "mach_vm_region_recurse failed at %s: %s\n"),
core_addr_to_string (region_address),
mach_error_string (kret));
return res_length;
}
- inferior_debug
- (9, _("darwin_read_write_inferior: "
- "mach_vm_region_recurse addr=%s, start=%s, len=%s\n"),
- core_addr_to_string (region_address),
- core_addr_to_string (region_start),
- core_addr_to_string (region_length));
+ inferior_debug (9,
+ _ ("darwin_read_write_inferior: "
+ "mach_vm_region_recurse addr=%s, start=%s, len=%s\n"),
+ core_addr_to_string (region_address),
+ core_addr_to_string (region_start),
+ core_addr_to_string (region_length));
/* Check for holes in memory. */
if (region_start > region_address)
{
- warning (_("No memory at %s (vs %s+0x%x). Nothing written"),
+ warning (_ ("No memory at %s (vs %s+0x%x). Nothing written"),
core_addr_to_string (region_address),
core_addr_to_string (region_start),
- (unsigned)region_length);
+ (unsigned) region_length);
return res_length;
}
@@ -2211,8 +2199,8 @@ darwin_read_write_inferior (task_t task, CORE_ADDR addr,
{
vm_prot_t prot = VM_PROT_READ | VM_PROT_WRITE;
- kret = mach_vm_protect (task, region_address, region_length,
- FALSE, prot);
+ kret = mach_vm_protect (task, region_address, region_length, FALSE,
+ prot);
if (kret != KERN_SUCCESS)
{
prot |= VM_PROT_COPY;
@@ -2221,9 +2209,9 @@ darwin_read_write_inferior (task_t task, CORE_ADDR addr,
}
if (kret != KERN_SUCCESS)
{
- warning (_("darwin_read_write_inferior: "
- "mach_vm_protect failed at %s "
- "(len=0x%lx, prot=0x%x): %s"),
+ warning (_ ("darwin_read_write_inferior: "
+ "mach_vm_protect failed at %s "
+ "(len=0x%lx, prot=0x%x): %s"),
core_addr_to_string (region_address),
(unsigned long) region_length, (unsigned) prot,
mach_error_string (kret));
@@ -2240,7 +2228,7 @@ darwin_read_write_inferior (task_t task, CORE_ADDR addr,
kret = mach_vm_write (task, addr, (vm_offset_t) wraddr, write_length);
if (kret != KERN_SUCCESS)
{
- warning (_("darwin_read_write_inferior: mach_vm_write failed: %s"),
+ warning (_ ("darwin_read_write_inferior: mach_vm_write failed: %s"),
mach_error_string (kret));
return res_length;
}
@@ -2248,13 +2236,13 @@ darwin_read_write_inferior (task_t task, CORE_ADDR addr,
/* Restore page rights. */
if (!(info.protection & VM_PROT_WRITE))
{
- kret = mach_vm_protect (task, region_address, region_length,
- FALSE, info.protection);
+ kret = mach_vm_protect (task, region_address, region_length, FALSE,
+ info.protection);
if (kret != KERN_SUCCESS)
{
- warning (_("darwin_read_write_inferior: "
- "mach_vm_protect restore failed at %s "
- "(len=0x%lx): %s"),
+ warning (_ ("darwin_read_write_inferior: "
+ "mach_vm_protect restore failed at %s "
+ "(len=0x%lx): %s"),
core_addr_to_string (region_address),
(unsigned long) region_length,
mach_error_string (kret));
@@ -2287,8 +2275,8 @@ darwin_read_dyld_info (task_t task, CORE_ADDR addr, gdb_byte *rdaddr,
if (addr != 0 || length > sizeof (mach_vm_address_t))
return TARGET_XFER_EOF;
- kret = task_info (task, TASK_DYLD_INFO,
- (task_info_t) &task_dyld_info, &count);
+ kret
+ = task_info (task, TASK_DYLD_INFO, (task_info_t) &task_dyld_info, &count);
MACH_CHECK_ERROR (kret);
if (kret != KERN_SUCCESS)
return TARGET_XFER_E_IO;
@@ -2300,8 +2288,6 @@ darwin_read_dyld_info (task_t task, CORE_ADDR addr, gdb_byte *rdaddr,
}
#endif
-
-
enum target_xfer_status
darwin_nat_target::xfer_partial (enum target_object object, const char *annex,
gdb_byte *readbuf, const gdb_byte *writebuf,
@@ -2311,18 +2297,18 @@ darwin_nat_target::xfer_partial (enum target_object object, const char *annex,
struct inferior *inf = current_inferior ();
darwin_inferior *priv = get_darwin_inferior (inf);
- inferior_debug
- (8, _("darwin_xfer_partial(%s, %s, rbuf=%s, wbuf=%s) pid=%u\n"),
- core_addr_to_string (offset), pulongest (len),
- host_address_to_string (readbuf), host_address_to_string (writebuf),
- inf->pid);
+ inferior_debug (8,
+ _ ("darwin_xfer_partial(%s, %s, rbuf=%s, wbuf=%s) pid=%u\n"),
+ core_addr_to_string (offset), pulongest (len),
+ host_address_to_string (readbuf),
+ host_address_to_string (writebuf), inf->pid);
switch (object)
{
case TARGET_OBJECT_MEMORY:
{
- int l = darwin_read_write_inferior (priv->task, offset,
- readbuf, writebuf, len);
+ int l = darwin_read_write_inferior (priv->task, offset, readbuf,
+ writebuf, len);
if (l == 0)
return TARGET_XFER_EOF;
@@ -2346,7 +2332,6 @@ darwin_nat_target::xfer_partial (enum target_object object, const char *annex,
default:
return TARGET_XFER_E_IO;
}
-
}
static void
@@ -2408,8 +2393,8 @@ darwin_nat_target::get_ada_task_ptid (long lwp, ULONGEST thread)
/* Maybe the port was never extract. Do it now. */
/* First get inferior port names. */
- kret = mach_port_names (priv->task, &names, &names_count, &types,
- &types_count);
+ kret
+ = mach_port_names (priv->task, &names, &names_count, &types, &types_count);
MACH_CHECK_ERROR (kret);
if (kret != KERN_SUCCESS)
return null_ptid;
@@ -2425,8 +2410,8 @@ darwin_nat_target::get_ada_task_ptid (long lwp, ULONGEST thread)
/* We just need to know the corresponding name in gdb name space.
So extract and deallocate the right. */
kret = mach_port_extract_right (priv->task, names[i],
- MACH_MSG_TYPE_COPY_SEND,
- &local_name, &local_type);
+ MACH_MSG_TYPE_COPY_SEND, &local_name,
+ &local_type);
if (kret != KERN_SUCCESS)
continue;
mach_port_deallocate (gdb_task, local_name);
@@ -2458,6 +2443,7 @@ darwin_nat_target::supports_multi_process ()
}
void _initialize_darwin_nat ();
+
void
_initialize_darwin_nat ()
{
@@ -2474,22 +2460,23 @@ _initialize_darwin_nat ()
MACH_CHECK_ERROR (kret);
}
- inferior_debug (2, _("GDB task: 0x%lx, pid: %d\n"),
+ inferior_debug (2, _ ("GDB task: 0x%lx, pid: %d\n"),
(unsigned long) mach_task_self (), getpid ());
- add_setshow_zuinteger_cmd ("darwin", class_obscure,
- &darwin_debug_flag, _("\
-Set if printing inferior communication debugging statements."), _("\
-Show if printing inferior communication debugging statements."), NULL,
- NULL, NULL,
- &setdebuglist, &showdebuglist);
+ add_setshow_zuinteger_cmd ("darwin", class_obscure, &darwin_debug_flag, _ ("\
+Set if printing inferior communication debugging statements."),
+ _ ("\
+Show if printing inferior communication debugging statements."),
+ NULL, NULL, NULL, &setdebuglist, &showdebuglist);
add_setshow_boolean_cmd ("mach-exceptions", class_support,
- &enable_mach_exceptions, _("\
-Set if mach exceptions are caught."), _("\
-Show if mach exceptions are caught."), _("\
+ &enable_mach_exceptions, _ ("\
+Set if mach exceptions are caught."),
+ _ ("\
+Show if mach exceptions are caught."),
+ _ ("\
When this mode is on, all low level exceptions are reported before being\n\
reported by the kernel."),
- &set_enable_mach_exceptions, NULL,
- &setlist, &showlist);
+ &set_enable_mach_exceptions, NULL, &setlist,
+ &showlist);
}
diff --git a/gdb/darwin-nat.h b/gdb/darwin-nat.h
index 4dd8078fe31..a6a46b09620 100644
--- a/gdb/darwin-nat.h
+++ b/gdb/darwin-nat.h
@@ -70,7 +70,9 @@ struct darwin_thread_info : public private_thread_info
bool signaled = false;
/* The last exception received. */
- struct darwin_exception_msg event {};
+ struct darwin_exception_msg event
+ {
+ };
};
typedef struct darwin_thread_info darwin_thread_t;
@@ -78,8 +80,7 @@ typedef struct darwin_thread_info darwin_thread_t;
class darwin_nat_target : public inf_child_target
{
- void create_inferior (const char *exec_file,
- const std::string &allargs,
+ void create_inferior (const char *exec_file, const std::string &allargs,
char **env, int from_tty) override;
void attach (const char *, int) override;
@@ -94,7 +95,7 @@ class darwin_nat_target : public inf_child_target
void interrupt () override;
- void resume (ptid_t, int , enum gdb_signal) override;
+ void resume (ptid_t, int, enum gdb_signal) override;
bool thread_alive (ptid_t ptid) override;
@@ -103,8 +104,7 @@ class darwin_nat_target : public inf_child_target
const char *pid_to_exec_file (int pid) override;
enum target_xfer_status xfer_partial (enum target_object object,
- const char *annex,
- gdb_byte *readbuf,
+ const char *annex, gdb_byte *readbuf,
const gdb_byte *writebuf,
ULONGEST offset, ULONGEST len,
ULONGEST *xfered_len) override;
@@ -114,15 +114,13 @@ class darwin_nat_target : public inf_child_target
ptid_t get_ada_task_ptid (long lwp, ULONGEST thread) override;
private:
+
ptid_t wait_1 (ptid_t, struct target_waitstatus *);
void check_new_threads (inferior *inf);
- int decode_exception_message (mach_msg_header_t *hdr,
- inferior **pinf,
+ int decode_exception_message (mach_msg_header_t *hdr, inferior **pinf,
darwin_thread_t **pthread);
- ptid_t decode_message (mach_msg_header_t *hdr,
- darwin_thread_t **pthread,
- inferior **pinf,
- target_waitstatus *status);
+ ptid_t decode_message (mach_msg_header_t *hdr, darwin_thread_t **pthread,
+ inferior **pinf, target_waitstatus *status);
void stop_inferior (inferior *inf);
void init_thread_list (inferior *inf);
void ptrace_him (int pid);
diff --git a/gdb/dbxread.c b/gdb/dbxread.c
index 36e744fa61f..ce7c7d16a02 100644
--- a/gdb/dbxread.c
+++ b/gdb/dbxread.c
@@ -37,8 +37,8 @@
#include "symtab.h"
#include "breakpoint.h"
#include "target.h"
-#include "gdbcore.h" /* for bfd stuff */
-#include "libaout.h" /* FIXME Secret internal BFD stuff for a.out */
+#include "gdbcore.h" /* for bfd stuff */
+#include "libaout.h" /* FIXME Secret internal BFD stuff for a.out */
#include "filenames.h"
#include "objfiles.h"
#include "buildsym-legacy.h"
@@ -52,9 +52,8 @@
#include "psympriv.h"
#include "block.h"
#include "aout/aout64.h"
-#include "aout/stab_gnu.h" /* We always use GNU stabs, not
+#include "aout/stab_gnu.h" /* We always use GNU stabs, not
native, now. */
-
/* Key for dbx-associated data. */
@@ -64,42 +63,41 @@ const registry<objfile>::key<dbx_symfile_info> dbx_objfile_data_key;
of the psymtab. */
struct symloc
- {
- /* Offset within the file symbol table of first local symbol for this
+{
+ /* Offset within the file symbol table of first local symbol for this
file. */
- int ldsymoff;
+ int ldsymoff;
- /* Length (in bytes) of the section of the symbol table devoted to
+ /* Length (in bytes) of the section of the symbol table devoted to
this file's symbols (actually, the section bracketed may contain
more than just this file's symbols). If ldsymlen is 0, the only
reason for this thing's existence is the dependency list. Nothing
else will happen when it is read in. */
- int ldsymlen;
+ int ldsymlen;
- /* The size of each symbol in the symbol file (in external form). */
+ /* The size of each symbol in the symbol file (in external form). */
- int symbol_size;
+ int symbol_size;
- /* Further information needed to locate the symbols if they are in
+ /* Further information needed to locate the symbols if they are in
an ELF file. */
- int symbol_offset;
- int string_offset;
- int file_string_offset;
- enum language pst_language;
- };
-
-#define LDSYMOFF(p) (((struct symloc *)((p)->read_symtab_private))->ldsymoff)
-#define LDSYMLEN(p) (((struct symloc *)((p)->read_symtab_private))->ldsymlen)
-#define SYMLOC(p) ((struct symloc *)((p)->read_symtab_private))
-#define SYMBOL_SIZE(p) (SYMLOC(p)->symbol_size)
-#define SYMBOL_OFFSET(p) (SYMLOC(p)->symbol_offset)
-#define STRING_OFFSET(p) (SYMLOC(p)->string_offset)
-#define FILE_STRING_OFFSET(p) (SYMLOC(p)->file_string_offset)
-#define PST_LANGUAGE(p) (SYMLOC(p)->pst_language)
-
+ int symbol_offset;
+ int string_offset;
+ int file_string_offset;
+ enum language pst_language;
+};
+
+#define LDSYMOFF(p) (((struct symloc *) ((p)->read_symtab_private))->ldsymoff)
+#define LDSYMLEN(p) (((struct symloc *) ((p)->read_symtab_private))->ldsymlen)
+#define SYMLOC(p) ((struct symloc *) ((p)->read_symtab_private))
+#define SYMBOL_SIZE(p) (SYMLOC (p)->symbol_size)
+#define SYMBOL_OFFSET(p) (SYMLOC (p)->symbol_offset)
+#define STRING_OFFSET(p) (SYMLOC (p)->string_offset)
+#define FILE_STRING_OFFSET(p) (SYMLOC (p)->file_string_offset)
+#define PST_LANGUAGE(p) (SYMLOC (p)->pst_language)
/* The objfile we are currently reading. */
@@ -150,7 +148,6 @@ static int symfile_relocatable = 0;
static unsigned char processing_acc_compilation;
-
/* The lowest text address we have yet encountered. This is needed
because in an a.out file, there is no header field which tells us
what address the program is actually going to be loaded at, so we
@@ -169,20 +166,20 @@ static int has_line_numbers;
static void
unknown_symtype_complaint (const char *arg1)
{
- complaint (_("unknown symbol type %s"), arg1);
+ complaint (_ ("unknown symbol type %s"), arg1);
}
static void
lbrac_mismatch_complaint (int arg1)
{
- complaint (_("N_LBRAC/N_RBRAC symbol mismatch at symtab pos %d"), arg1);
+ complaint (_ ("N_LBRAC/N_RBRAC symbol mismatch at symtab pos %d"), arg1);
}
static void
repeated_header_complaint (const char *arg1, int arg2)
{
- complaint (_("\"repeated\" header file %s not "
- "previously seen, at symtab pos %d"),
+ complaint (_ ("\"repeated\" header file %s not "
+ "previously seen, at symtab pos %d"),
arg1, arg2);
}
@@ -196,7 +193,7 @@ repeated_header_complaint (const char *arg1, int arg2)
table, in some cases. */
static void
-find_text_range (bfd * sym_bfd, struct objfile *objfile)
+find_text_range (bfd *sym_bfd, struct objfile *objfile)
{
asection *sec;
int found_any = 0;
@@ -226,13 +223,11 @@ find_text_range (bfd * sym_bfd, struct objfile *objfile)
}
if (!found_any)
- error (_("Can't find any code sections in symbol file"));
+ error (_ ("Can't find any code sections in symbol file"));
DBX_TEXT_ADDR (objfile) = start;
DBX_TEXT_SIZE (objfile) = end - start;
}
-
-
/* During initial symbol readin, we need to have a structure to keep
track of which psymtabs have which bincls in them. This structure
@@ -241,17 +236,16 @@ find_text_range (bfd * sym_bfd, struct objfile *objfile)
struct header_file_location
{
- header_file_location (const char *name_, int instance_,
- legacy_psymtab *pst_)
+ header_file_location (const char *name_, int instance_, legacy_psymtab *pst_)
: name (name_),
instance (instance_),
pst (pst_)
{
}
- const char *name; /* Name of header file */
- int instance; /* See above */
- legacy_psymtab *pst; /* Partial symtab that has the
+ const char *name; /* Name of header file */
+ int instance; /* See above */
+ legacy_psymtab *pst; /* Partial symtab that has the
BINCL/EINCL defs for this file. */
};
@@ -262,16 +256,14 @@ static std::vector<struct header_file_location> *bincl_list;
static void read_ofile_symtab (struct objfile *, legacy_psymtab *);
-static void dbx_read_symtab (legacy_psymtab *self,
- struct objfile *objfile);
+static void dbx_read_symtab (legacy_psymtab *self, struct objfile *objfile);
static void dbx_expand_psymtab (legacy_psymtab *, struct objfile *);
static void read_dbx_symtab (minimal_symbol_reader &, psymtab_storage *,
struct objfile *);
-static legacy_psymtab *find_corresponding_bincl_psymtab (const char *,
- int);
+static legacy_psymtab *find_corresponding_bincl_psymtab (const char *, int);
static const char *dbx_next_symbol_text (struct objfile *);
@@ -285,9 +277,8 @@ static void dbx_symfile_read (struct objfile *, symfile_add_flags);
static void dbx_symfile_finish (struct objfile *);
-static void record_minimal_symbol (minimal_symbol_reader &,
- const char *, CORE_ADDR, int,
- struct objfile *);
+static void record_minimal_symbol (minimal_symbol_reader &, const char *,
+ CORE_ADDR, int, struct objfile *);
static void add_new_header_file (const char *, int);
@@ -331,7 +322,8 @@ add_this_object_header_file (int i)
n_allocated_this_object_header_files *= 2;
this_object_header_files
= (int *) xrealloc ((char *) this_object_header_files,
- n_allocated_this_object_header_files * sizeof (int));
+ n_allocated_this_object_header_files
+ * sizeof (int));
}
this_object_header_files[n_this_object_header_files++] = i;
@@ -383,8 +375,9 @@ add_new_header_file (const char *name, int instance)
if (i == 0)
{
N_ALLOCATED_HEADER_FILES (dbxread_objfile) = 10;
- HEADER_FILES (dbxread_objfile) = (struct header_file *)
- xmalloc (10 * sizeof (struct header_file));
+ HEADER_FILES (dbxread_objfile)
+ = (struct header_file *) xmalloc (10
+ * sizeof (struct header_file));
}
else
{
@@ -425,11 +418,10 @@ explicit_lookup_type (int real_filenum, int index)
return &f->vector[index];
}
#endif
-
+
static void
-record_minimal_symbol (minimal_symbol_reader &reader,
- const char *name, CORE_ADDR address, int type,
- struct objfile *objfile)
+record_minimal_symbol (minimal_symbol_reader &reader, const char *name,
+ CORE_ADDR address, int type, struct objfile *objfile)
{
enum minimal_symbol_type ms_type;
int section;
@@ -486,7 +478,8 @@ record_minimal_symbol (minimal_symbol_reader &reader,
{
const char *tempstring = name;
- if (tempstring[0] == bfd_get_symbol_leading_char (objfile->obfd.get ()))
+ if (tempstring[0]
+ == bfd_get_symbol_leading_char (objfile->obfd.get ()))
++tempstring;
if (is_vtable_name (tempstring))
ms_type = mst_data;
@@ -509,7 +502,7 @@ record_minimal_symbol (minimal_symbol_reader &reader,
reader.record_with_info (name, address, ms_type, section);
}
-
+
/* Scan and build partial symbols for a symbol file.
We have been initialized by a call to dbx_symfile_init, which
put all the relevant info into a "struct dbx_symfile_info",
@@ -564,7 +557,6 @@ dbx_new_init (struct objfile *ignore)
init_header_files ();
}
-
/* dbx_symfile_init ()
is the dbx-specific initialization routine for reading symbols.
It is passed a struct objfile which contains, among other things,
@@ -578,7 +570,7 @@ dbx_new_init (struct objfile *ignore)
be called unless this is an a.out (or very similar) file.
FIXME, there should be a cleaner peephole into the BFD environment here. */
-#define DBX_STRINGTAB_SIZE_SIZE sizeof(long) /* FIXME */
+#define DBX_STRINGTAB_SIZE_SIZE sizeof (long) /* FIXME */
static void
dbx_symfile_init (struct objfile *objfile)
@@ -597,14 +589,14 @@ dbx_symfile_init (struct objfile *objfile)
DBX_BSS_SECTION (objfile) = bfd_get_section_by_name (sym_bfd, ".bss");
/* FIXME POKING INSIDE BFD DATA STRUCTURES. */
-#define STRING_TABLE_OFFSET (sym_bfd->origin + obj_str_filepos (sym_bfd))
-#define SYMBOL_TABLE_OFFSET (sym_bfd->origin + obj_sym_filepos (sym_bfd))
+#define STRING_TABLE_OFFSET (sym_bfd->origin + obj_str_filepos (sym_bfd))
+#define SYMBOL_TABLE_OFFSET (sym_bfd->origin + obj_sym_filepos (sym_bfd))
/* FIXME POKING INSIDE BFD DATA STRUCTURES. */
text_sect = bfd_get_section_by_name (sym_bfd, ".text");
if (!text_sect)
- error (_("Can't find .text section in symbol file"));
+ error (_ ("Can't find .text section in symbol file"));
DBX_TEXT_ADDR (objfile) = bfd_section_vma (text_sect);
DBX_TEXT_SIZE (objfile) = bfd_section_size (text_sect);
@@ -666,12 +658,12 @@ dbx_symfile_init (struct objfile *objfile)
if (DBX_STRINGTAB_SIZE (objfile) < sizeof (size_temp)
|| DBX_STRINGTAB_SIZE (objfile) > bfd_get_size (sym_bfd))
- error (_("ridiculous string table size (%d bytes)."),
+ error (_ ("ridiculous string table size (%d bytes)."),
DBX_STRINGTAB_SIZE (objfile));
- DBX_STRINGTAB (objfile) =
- (char *) obstack_alloc (&objfile->objfile_obstack,
- DBX_STRINGTAB_SIZE (objfile));
+ DBX_STRINGTAB (objfile)
+ = (char *) obstack_alloc (&objfile->objfile_obstack,
+ DBX_STRINGTAB_SIZE (objfile));
OBJSTAT (objfile, sz_strtab += DBX_STRINGTAB_SIZE (objfile));
/* Now read in the string table in one big gulp. */
@@ -680,8 +672,7 @@ dbx_symfile_init (struct objfile *objfile)
if (val < 0)
perror_with_name (name);
val = bfd_bread (DBX_STRINGTAB (objfile),
- DBX_STRINGTAB_SIZE (objfile),
- sym_bfd);
+ DBX_STRINGTAB_SIZE (objfile), sym_bfd);
if (val != DBX_STRINGTAB_SIZE (objfile))
perror_with_name (name);
}
@@ -715,8 +706,6 @@ dbx_symfile_info::~dbx_symfile_info ()
}
}
-
-
/* Buffer for reading the symbol table entries. */
static struct external_nlist symbuf[4096];
static int symbuf_idx;
@@ -793,7 +782,7 @@ fill_symbuf (bfd *sym_bfd)
if (nbytes < 0)
perror_with_name (bfd_get_filename (sym_bfd));
else if (nbytes == 0)
- error (_("Premature end of file reading symbol table"));
+ error (_ ("Premature end of file reading symbol table"));
symbuf_end = nbytes / symbol_size;
symbuf_idx = 0;
symbuf_left -= nbytes;
@@ -812,16 +801,16 @@ stabs_seek (int sym_offset)
bfd_seek (symfile_bfd, sym_offset, SEEK_CUR);
}
-#define INTERNALIZE_SYMBOL(intern, extern, abfd) \
- { \
- (intern).n_strx = bfd_h_get_32 (abfd, (extern)->e_strx); \
- (intern).n_type = bfd_h_get_8 (abfd, (extern)->e_type); \
- (intern).n_other = 0; \
- (intern).n_desc = bfd_h_get_16 (abfd, (extern)->e_desc); \
- if (bfd_get_sign_extend_vma (abfd)) \
- (intern).n_value = bfd_h_get_signed_32 (abfd, (extern)->e_value); \
- else \
- (intern).n_value = bfd_h_get_32 (abfd, (extern)->e_value); \
+#define INTERNALIZE_SYMBOL(intern, extern, abfd) \
+ { \
+ (intern).n_strx = bfd_h_get_32 (abfd, (extern)->e_strx); \
+ (intern).n_type = bfd_h_get_8 (abfd, (extern)->e_type); \
+ (intern).n_other = 0; \
+ (intern).n_desc = bfd_h_get_16 (abfd, (extern)->e_desc); \
+ if (bfd_get_sign_extend_vma (abfd)) \
+ (intern).n_value = bfd_h_get_signed_32 (abfd, (extern)->e_value); \
+ else \
+ (intern).n_value = bfd_h_get_32 (abfd, (extern)->e_value); \
}
/* Invariant: The symbol pointed to by symbuf_idx is the first one
@@ -849,7 +838,6 @@ dbx_next_symbol_text (struct objfile *objfile)
return nlist.n_strx + stringtab_global + file_string_table_offset;
}
-
/* Given a name, value pair, find the corresponding
bincl in the list. Return the partial symtab associated
@@ -859,8 +847,7 @@ static legacy_psymtab *
find_corresponding_bincl_psymtab (const char *name, int instance)
{
for (const header_file_location &bincl : *bincl_list)
- if (bincl.instance == instance
- && strcmp (name, bincl.name) == 0)
+ if (bincl.instance == instance && strcmp (name, bincl.name) == 0)
return bincl.pst;
repeated_header_complaint (name, symnum);
@@ -876,17 +863,15 @@ set_namestring (struct objfile *objfile, const struct internal_nlist *nlist)
{
const char *namestring;
- if (nlist->n_strx + file_string_table_offset
- >= DBX_STRINGTAB_SIZE (objfile)
+ if (nlist->n_strx + file_string_table_offset >= DBX_STRINGTAB_SIZE (objfile)
|| nlist->n_strx + file_string_table_offset < nlist->n_strx)
{
- complaint (_("bad string table offset in symbol %d"),
- symnum);
+ complaint (_ ("bad string table offset in symbol %d"), symnum);
namestring = "<bad string table offset>";
- }
+ }
else
- namestring = (nlist->n_strx + file_string_table_offset
- + DBX_STRINGTAB (objfile));
+ namestring
+ = (nlist->n_strx + file_string_table_offset + DBX_STRINGTAB (objfile));
return namestring;
}
@@ -938,8 +923,8 @@ find_stab_function (const char *namestring, const char *filename,
static void
function_outside_compilation_unit_complaint (const char *arg1)
{
- complaint (_("function `%s' appears to be defined "
- "outside of all compilation units"),
+ complaint (_ ("function `%s' appears to be defined "
+ "outside of all compilation units"),
arg1);
}
@@ -948,11 +933,10 @@ function_outside_compilation_unit_complaint (const char *arg1)
static void
read_dbx_symtab (minimal_symbol_reader &reader,
- psymtab_storage *partial_symtabs,
- struct objfile *objfile)
+ psymtab_storage *partial_symtabs, struct objfile *objfile)
{
struct gdbarch *gdbarch = objfile->arch ();
- struct external_nlist *bufp = 0; /* =0 avoids gcc -Wall glitch. */
+ struct external_nlist *bufp = 0; /* =0 avoids gcc -Wall glitch. */
struct internal_nlist nlist;
CORE_ADDR text_addr;
int text_size;
@@ -993,14 +977,13 @@ read_dbx_symtab (minimal_symbol_reader &reader,
includes_allocated = 30;
includes_used = 0;
- psymtab_include_list = (const char **) alloca (includes_allocated *
- sizeof (const char *));
+ psymtab_include_list
+ = (const char **) alloca (includes_allocated * sizeof (const char *));
dependencies_allocated = 30;
dependencies_used = 0;
- dependency_list =
- (legacy_psymtab **) alloca (dependencies_allocated *
- sizeof (legacy_psymtab *));
+ dependency_list = (legacy_psymtab **) alloca (dependencies_allocated
+ * sizeof (legacy_psymtab *));
/* Init bincl list */
std::vector<struct header_file_location> bincl_storage;
@@ -1011,7 +994,7 @@ read_dbx_symtab (minimal_symbol_reader &reader,
lowest_text_address = (CORE_ADDR) -1;
- symfile_bfd = objfile->obfd.get (); /* For next_text_symbol. */
+ symfile_bfd = objfile->obfd.get (); /* For next_text_symbol. */
abfd = objfile->obfd.get ();
symbuf_end = symbuf_idx = 0;
next_symbol_text_func = dbx_next_symbol_text;
@@ -1051,7 +1034,7 @@ read_dbx_symtab (minimal_symbol_reader &reader,
for (symnum = 0; symnum < DBX_SYMCOUNT (objfile); symnum++)
{
/* Get the symbol for this run and pull out some info. */
- QUIT; /* Allow this to be interruptable. */
+ QUIT; /* Allow this to be interruptable. */
if (symbuf_idx == symbuf_end)
fill_symbuf (abfd);
bufp = &symbuf[symbuf_idx++];
@@ -1096,15 +1079,15 @@ read_dbx_symtab (minimal_symbol_reader &reader,
case N_BSS:
case N_BSS | N_EXT:
case N_NBBSS | N_EXT:
- case N_SETV | N_EXT: /* FIXME, is this in BSS? */
+ case N_SETV | N_EXT: /* FIXME, is this in BSS? */
goto record_it;
case N_ABS | N_EXT:
- record_it:
+ record_it:
namestring = set_namestring (objfile, &nlist);
record_minimal_symbol (reader, namestring, nlist.n_value,
- nlist.n_type, objfile); /* Always */
+ nlist.n_type, objfile); /* Always */
continue;
/* Standard, local, non-debugger, symbols. */
@@ -1125,16 +1108,18 @@ read_dbx_symtab (minimal_symbol_reader &reader,
|| (namestring[(nsl = strlen (namestring)) - 1] == 'o'
&& namestring[nsl - 2] == '.'))
{
- if (past_first_source_file && pst
+ if (past_first_source_file
+ && pst
/* The gould NP1 uses low values for .o and -l symbols
which are not the address. */
&& nlist.n_value >= pst->raw_text_low ())
{
- dbx_end_psymtab (objfile, partial_symtabs,
- pst, psymtab_include_list,
- includes_used, symnum * symbol_size,
+ dbx_end_psymtab (objfile, partial_symtabs, pst,
+ psymtab_include_list, includes_used,
+ symnum * symbol_size,
nlist.n_value > pst->raw_text_high ()
- ? nlist.n_value : pst->raw_text_high (),
+ ? nlist.n_value
+ : pst->raw_text_high (),
dependency_list, dependencies_used,
textlow_not_set);
pst = (legacy_psymtab *) 0;
@@ -1174,10 +1159,10 @@ read_dbx_symtab (minimal_symbol_reader &reader,
set_namestring(). */
past_first_source_file = 1;
file_string_table_offset = next_file_string_table_offset;
- next_file_string_table_offset =
- file_string_table_offset + nlist.n_value;
+ next_file_string_table_offset
+ = file_string_table_offset + nlist.n_value;
if (next_file_string_table_offset < file_string_table_offset)
- error (_("string table offset backs up at %d"), symnum);
+ error (_ ("string table offset backs up at %d"), symnum);
/* FIXME -- replace error() with complaint. */
continue;
}
@@ -1241,16 +1226,17 @@ read_dbx_symtab (minimal_symbol_reader &reader,
past_first_source_file = 1;
if (prev_so_symnum != symnum - 1)
- { /* Here if prev stab wasn't N_SO. */
+ { /* Here if prev stab wasn't N_SO. */
first_so_symnum = symnum;
if (pst)
{
- dbx_end_psymtab (objfile, partial_symtabs,
- pst, psymtab_include_list,
- includes_used, symnum * symbol_size,
+ dbx_end_psymtab (objfile, partial_symtabs, pst,
+ psymtab_include_list, includes_used,
+ symnum * symbol_size,
(valu > pst->raw_text_high ()
- ? valu : pst->raw_text_high ()),
+ ? valu
+ : pst->raw_text_high ()),
dependency_list, dependencies_used,
prev_textlow_not_set);
pst = (legacy_psymtab *) 0;
@@ -1281,7 +1267,7 @@ read_dbx_symtab (minimal_symbol_reader &reader,
/* Save the directory name SOs locally, then save it into
the psymtab when it's created below. */
dirname_nso = namestring;
- continue;
+ continue;
}
/* Some other compilers (C++ ones in particular) emit useless
@@ -1290,9 +1276,8 @@ read_dbx_symtab (minimal_symbol_reader &reader,
if (!pst)
{
- pst = start_psymtab (partial_symtabs, objfile,
- namestring, valu,
- first_so_symnum * symbol_size);
+ pst = start_psymtab (partial_symtabs, objfile, namestring,
+ valu, first_so_symnum * symbol_size);
pst->dirname = dirname_nso;
dirname_nso = NULL;
}
@@ -1323,8 +1308,8 @@ read_dbx_symtab (minimal_symbol_reader &reader,
{
/* FIXME: we should not get here without a PST to work on.
Attempt to recover. */
- complaint (_("N_BINCL %s not in entries for "
- "any file, at symtab pos %d"),
+ complaint (_ ("N_BINCL %s not in entries for "
+ "any file, at symtab pos %d"),
namestring, symnum);
continue;
}
@@ -1384,181 +1369,180 @@ read_dbx_symtab (minimal_symbol_reader &reader,
{
const char **orig = psymtab_include_list;
- psymtab_include_list = (const char **)
- alloca ((includes_allocated *= 2) * sizeof (const char *));
+ psymtab_include_list
+ = (const char **) alloca ((includes_allocated *= 2)
+ * sizeof (const char *));
memcpy (psymtab_include_list, orig,
includes_used * sizeof (const char *));
}
continue;
}
- case N_LSYM: /* Typedef or automatic variable. */
- case N_STSYM: /* Data seg var -- static. */
- case N_LCSYM: /* BSS " */
- case N_ROSYM: /* Read-only data seg var -- static. */
- case N_NBSTS: /* Gould nobase. */
- case N_NBLCS: /* symbols. */
+ case N_LSYM: /* Typedef or automatic variable. */
+ case N_STSYM: /* Data seg var -- static. */
+ case N_LCSYM: /* BSS " */
+ case N_ROSYM: /* Read-only data seg var -- static. */
+ case N_NBSTS: /* Gould nobase. */
+ case N_NBLCS: /* symbols. */
case N_FUN:
- case N_GSYM: /* Global (extern) variable; can be
+ case N_GSYM: /* Global (extern) variable; can be
data or bss (sigh FIXME). */
/* Following may probably be ignored; I'll leave them here
for now (until I do Pascal and Modula 2 extensions). */
- case N_PC: /* I may or may not need this; I
+ case N_PC: /* I may or may not need this; I
suspect not. */
- case N_M2C: /* I suspect that I can ignore this here. */
- case N_SCOPE: /* Same. */
- {
- const char *p;
+ case N_M2C: /* I suspect that I can ignore this here. */
+ case N_SCOPE: /* Same. */
+ {
+ const char *p;
- namestring = set_namestring (objfile, &nlist);
+ namestring = set_namestring (objfile, &nlist);
- /* See if this is an end of function stab. */
- if (pst && nlist.n_type == N_FUN && *namestring == '\000')
- {
- CORE_ADDR valu;
+ /* See if this is an end of function stab. */
+ if (pst && nlist.n_type == N_FUN && *namestring == '\000')
+ {
+ CORE_ADDR valu;
- /* It's value is the size (in bytes) of the function for
+ /* It's value is the size (in bytes) of the function for
function relative stabs, or the address of the function's
end for old style stabs. */
- valu = nlist.n_value + last_function_start;
- if (pst->raw_text_high () == 0 || valu > pst->raw_text_high ())
- pst->set_text_high (valu);
- break;
- }
+ valu = nlist.n_value + last_function_start;
+ if (pst->raw_text_high () == 0 || valu > pst->raw_text_high ())
+ pst->set_text_high (valu);
+ break;
+ }
- p = (char *) strchr (namestring, ':');
- if (!p)
- continue; /* Not a debugging symbol. */
+ p = (char *) strchr (namestring, ':');
+ if (!p)
+ continue; /* Not a debugging symbol. */
- sym_len = 0;
- sym_name = NULL; /* pacify "gcc -Werror" */
- if (psymtab_language == language_cplus)
- {
- std::string name (namestring, p - namestring);
- gdb::unique_xmalloc_ptr<char> new_name
- = cp_canonicalize_string (name.c_str ());
- if (new_name != nullptr)
- {
- sym_len = strlen (new_name.get ());
- sym_name = obstack_strdup (&objfile->objfile_obstack,
- new_name.get ());
- }
- }
- else if (psymtab_language == language_c)
- {
- std::string name (namestring, p - namestring);
- gdb::unique_xmalloc_ptr<char> new_name
- = c_canonicalize_name (name.c_str ());
- if (new_name != nullptr)
- {
- sym_len = strlen (new_name.get ());
- sym_name = obstack_strdup (&objfile->objfile_obstack,
- new_name.get ());
- }
- }
+ sym_len = 0;
+ sym_name = NULL; /* pacify "gcc -Werror" */
+ if (psymtab_language == language_cplus)
+ {
+ std::string name (namestring, p - namestring);
+ gdb::unique_xmalloc_ptr<char> new_name
+ = cp_canonicalize_string (name.c_str ());
+ if (new_name != nullptr)
+ {
+ sym_len = strlen (new_name.get ());
+ sym_name = obstack_strdup (&objfile->objfile_obstack,
+ new_name.get ());
+ }
+ }
+ else if (psymtab_language == language_c)
+ {
+ std::string name (namestring, p - namestring);
+ gdb::unique_xmalloc_ptr<char> new_name
+ = c_canonicalize_name (name.c_str ());
+ if (new_name != nullptr)
+ {
+ sym_len = strlen (new_name.get ());
+ sym_name = obstack_strdup (&objfile->objfile_obstack,
+ new_name.get ());
+ }
+ }
- if (sym_len == 0)
- {
- sym_name = namestring;
- sym_len = p - namestring;
- }
+ if (sym_len == 0)
+ {
+ sym_name = namestring;
+ sym_len = p - namestring;
+ }
- /* Main processing section for debugging symbols which
+ /* Main processing section for debugging symbols which
the initial read through the symbol tables needs to worry
about. If we reach this point, the symbol which we are
considering is definitely one we are interested in.
p must also contain the (valid) index into the namestring
which indicates the debugging type symbol. */
- switch (p[1])
- {
- case 'S':
- if (pst != nullptr)
- pst->add_psymbol (gdb::string_view (sym_name, sym_len), true,
- VAR_DOMAIN, LOC_STATIC,
- data_sect_index,
- psymbol_placement::STATIC,
- nlist.n_value, psymtab_language,
- partial_symtabs, objfile);
- else
- complaint (_("static `%*s' appears to be defined "
- "outside of all compilation units"),
- sym_len, sym_name);
- continue;
+ switch (p[1])
+ {
+ case 'S':
+ if (pst != nullptr)
+ pst->add_psymbol (gdb::string_view (sym_name, sym_len), true,
+ VAR_DOMAIN, LOC_STATIC, data_sect_index,
+ psymbol_placement::STATIC, nlist.n_value,
+ psymtab_language, partial_symtabs,
+ objfile);
+ else
+ complaint (_ ("static `%*s' appears to be defined "
+ "outside of all compilation units"),
+ sym_len, sym_name);
+ continue;
- case 'G':
- /* The addresses in these entries are reported to be
+ case 'G':
+ /* The addresses in these entries are reported to be
wrong. See the code that reads 'G's for symtabs. */
- if (pst != nullptr)
- pst->add_psymbol (gdb::string_view (sym_name, sym_len), true,
- VAR_DOMAIN, LOC_STATIC,
- data_sect_index,
- psymbol_placement::GLOBAL,
- nlist.n_value, psymtab_language,
- partial_symtabs, objfile);
- else
- complaint (_("global `%*s' appears to be defined "
- "outside of all compilation units"),
- sym_len, sym_name);
- continue;
+ if (pst != nullptr)
+ pst->add_psymbol (gdb::string_view (sym_name, sym_len), true,
+ VAR_DOMAIN, LOC_STATIC, data_sect_index,
+ psymbol_placement::GLOBAL, nlist.n_value,
+ psymtab_language, partial_symtabs,
+ objfile);
+ else
+ complaint (_ ("global `%*s' appears to be defined "
+ "outside of all compilation units"),
+ sym_len, sym_name);
+ continue;
- case 'T':
- /* When a 'T' entry is defining an anonymous enum, it
+ case 'T':
+ /* When a 'T' entry is defining an anonymous enum, it
may have a name which is the empty string, or a
single space. Since they're not really defining a
symbol, those shouldn't go in the partial symbol
table. We do pick up the elements of such enums at
'check_enum:', below. */
- if (p >= namestring + 2
- || (p == namestring + 1
- && namestring[0] != ' '))
- {
- if (pst != nullptr)
- pst->add_psymbol (gdb::string_view (sym_name, sym_len),
- true, STRUCT_DOMAIN, LOC_TYPEDEF, -1,
- psymbol_placement::STATIC,
- 0, psymtab_language,
- partial_symtabs, objfile);
- else
- complaint (_("enum, struct, or union `%*s' appears "
- "to be defined outside of all "
- "compilation units"),
- sym_len, sym_name);
- if (p[2] == 't')
- {
- /* Also a typedef with the same name. */
- if (pst != nullptr)
- pst->add_psymbol (gdb::string_view (sym_name, sym_len),
- true, VAR_DOMAIN, LOC_TYPEDEF, -1,
- psymbol_placement::STATIC,
- 0, psymtab_language,
- partial_symtabs, objfile);
- else
- complaint (_("typedef `%*s' appears to be defined "
- "outside of all compilation units"),
- sym_len, sym_name);
- p += 1;
- }
- }
- goto check_enum;
+ if (p >= namestring + 2
+ || (p == namestring + 1 && namestring[0] != ' '))
+ {
+ if (pst != nullptr)
+ pst->add_psymbol (gdb::string_view (sym_name, sym_len),
+ true, STRUCT_DOMAIN, LOC_TYPEDEF, -1,
+ psymbol_placement::STATIC, 0,
+ psymtab_language, partial_symtabs,
+ objfile);
+ else
+ complaint (_ ("enum, struct, or union `%*s' appears "
+ "to be defined outside of all "
+ "compilation units"),
+ sym_len, sym_name);
+ if (p[2] == 't')
+ {
+ /* Also a typedef with the same name. */
+ if (pst != nullptr)
+ pst->add_psymbol (gdb::string_view (sym_name,
+ sym_len),
+ true, VAR_DOMAIN, LOC_TYPEDEF, -1,
+ psymbol_placement::STATIC, 0,
+ psymtab_language, partial_symtabs,
+ objfile);
+ else
+ complaint (_ ("typedef `%*s' appears to be defined "
+ "outside of all compilation units"),
+ sym_len, sym_name);
+ p += 1;
+ }
+ }
+ goto check_enum;
- case 't':
- if (p != namestring) /* a name is there, not just :T... */
- {
- if (pst != nullptr)
- pst->add_psymbol (gdb::string_view (sym_name, sym_len),
- true, VAR_DOMAIN, LOC_TYPEDEF, -1,
- psymbol_placement::STATIC,
- 0, psymtab_language,
- partial_symtabs, objfile);
- else
- complaint (_("typename `%*s' appears to be defined "
- "outside of all compilation units"),
- sym_len, sym_name);
- }
- check_enum:
- /* If this is an enumerated type, we need to
+ case 't':
+ if (p != namestring) /* a name is there, not just :T... */
+ {
+ if (pst != nullptr)
+ pst->add_psymbol (gdb::string_view (sym_name, sym_len),
+ true, VAR_DOMAIN, LOC_TYPEDEF, -1,
+ psymbol_placement::STATIC, 0,
+ psymtab_language, partial_symtabs,
+ objfile);
+ else
+ complaint (_ ("typename `%*s' appears to be defined "
+ "outside of all compilation units"),
+ sym_len, sym_name);
+ }
+ check_enum:
+ /* If this is an enumerated type, we need to
add all the enum constants to the partial symbol
table. This does not cover enums without names, e.g.
"enum {a, b} c;" in C, but fortunately those are
@@ -1567,243 +1551,244 @@ read_dbx_symtab (minimal_symbol_reader &reader,
to solve this problem, the compiler needs to put out the
enum in a nameless type. GCC2 does this. */
- /* We are looking for something of the form
+ /* We are looking for something of the form
<name> ":" ("t" | "T") [<number> "="] "e"
{<constant> ":" <value> ","} ";". */
- /* Skip over the colon and the 't' or 'T'. */
- p += 2;
- /* This type may be given a number. Also, numbers can come
+ /* Skip over the colon and the 't' or 'T'. */
+ p += 2;
+ /* This type may be given a number. Also, numbers can come
in pairs like (0,26). Skip over it. */
- while ((*p >= '0' && *p <= '9')
- || *p == '(' || *p == ',' || *p == ')'
- || *p == '=')
- p++;
+ while ((*p >= '0' && *p <= '9') || *p == '(' || *p == ','
+ || *p == ')' || *p == '=')
+ p++;
- if (*p++ == 'e')
- {
- /* The aix4 compiler emits extra crud before the members. */
- if (*p == '-')
- {
- /* Skip over the type (?). */
- while (*p != ':')
+ if (*p++ == 'e')
+ {
+ /* The aix4 compiler emits extra crud before the members. */
+ if (*p == '-')
+ {
+ /* Skip over the type (?). */
+ while (*p != ':')
+ p++;
+
+ /* Skip over the colon. */
p++;
+ }
- /* Skip over the colon. */
- p++;
- }
-
- /* We have found an enumerated type. */
- /* According to comments in read_enum_type
+ /* We have found an enumerated type. */
+ /* According to comments in read_enum_type
a comma could end it instead of a semicolon.
I don't know where that happens.
Accept either. */
- while (*p && *p != ';' && *p != ',')
- {
- const char *q;
+ while (*p && *p != ';' && *p != ',')
+ {
+ const char *q;
- /* Check for and handle cretinous dbx symbol name
+ /* Check for and handle cretinous dbx symbol name
continuation! */
- if (*p == '\\' || (*p == '?' && p[1] == '\0'))
- p = next_symbol_text (objfile);
+ if (*p == '\\' || (*p == '?' && p[1] == '\0'))
+ p = next_symbol_text (objfile);
- /* Point to the character after the name
+ /* Point to the character after the name
of the enum constant. */
- for (q = p; *q && *q != ':'; q++)
- ;
- /* Note that the value doesn't matter for
+ for (q = p; *q && *q != ':'; q++)
+ ;
+ /* Note that the value doesn't matter for
enum constants in psymtabs, just in symtabs. */
- if (pst != nullptr)
- pst->add_psymbol (gdb::string_view (p, q - p), true,
- VAR_DOMAIN, LOC_CONST, -1,
- psymbol_placement::STATIC, 0,
- psymtab_language,
- partial_symtabs, objfile);
- else
- complaint (_("enum constant `%*s' appears to be defined "
- "outside of all compilation units"),
- ((int) (q - p)), p);
- /* Point past the name. */
- p = q;
- /* Skip over the value. */
- while (*p && *p != ',')
- p++;
- /* Advance past the comma. */
- if (*p)
- p++;
- }
- }
- continue;
+ if (pst != nullptr)
+ pst->add_psymbol (gdb::string_view (p, q - p), true,
+ VAR_DOMAIN, LOC_CONST, -1,
+ psymbol_placement::STATIC, 0,
+ psymtab_language, partial_symtabs,
+ objfile);
+ else
+ complaint (
+ _ ("enum constant `%*s' appears to be defined "
+ "outside of all compilation units"),
+ ((int) (q - p)), p);
+ /* Point past the name. */
+ p = q;
+ /* Skip over the value. */
+ while (*p && *p != ',')
+ p++;
+ /* Advance past the comma. */
+ if (*p)
+ p++;
+ }
+ }
+ continue;
- case 'c':
- /* Constant, e.g. from "const" in Pascal. */
- if (pst != nullptr)
- pst->add_psymbol (gdb::string_view (sym_name, sym_len), true,
- VAR_DOMAIN, LOC_CONST, -1,
- psymbol_placement::STATIC, 0,
- psymtab_language,
- partial_symtabs, objfile);
- else
- complaint (_("constant `%*s' appears to be defined "
- "outside of all compilation units"),
- sym_len, sym_name);
+ case 'c':
+ /* Constant, e.g. from "const" in Pascal. */
+ if (pst != nullptr)
+ pst->add_psymbol (gdb::string_view (sym_name, sym_len), true,
+ VAR_DOMAIN, LOC_CONST, -1,
+ psymbol_placement::STATIC, 0,
+ psymtab_language, partial_symtabs,
+ objfile);
+ else
+ complaint (_ ("constant `%*s' appears to be defined "
+ "outside of all compilation units"),
+ sym_len, sym_name);
- continue;
+ continue;
- case 'f':
- if (! pst)
- {
- std::string name (namestring, (p - namestring));
- function_outside_compilation_unit_complaint (name.c_str ());
- }
- /* Kludges for ELF/STABS with Sun ACC. */
- last_function_name = namestring;
- /* Do not fix textlow==0 for .o or NLM files, as 0 is a legit
+ case 'f':
+ if (!pst)
+ {
+ std::string name (namestring, (p - namestring));
+ function_outside_compilation_unit_complaint (
+ name.c_str ());
+ }
+ /* Kludges for ELF/STABS with Sun ACC. */
+ last_function_name = namestring;
+ /* Do not fix textlow==0 for .o or NLM files, as 0 is a legit
value for the bottom of the text seg in those cases. */
- if (nlist.n_value == 0
- && gdbarch_sofun_address_maybe_missing (gdbarch))
- {
- struct bound_minimal_symbol minsym
- = find_stab_function (namestring,
- pst ? pst->filename : NULL,
- objfile);
- if (minsym.minsym != NULL)
- nlist.n_value = minsym.minsym->value_raw_address ();
- }
- if (pst && textlow_not_set
- && gdbarch_sofun_address_maybe_missing (gdbarch))
- {
- pst->set_text_low (nlist.n_value);
- textlow_not_set = 0;
- }
- /* End kludge. */
+ if (nlist.n_value == 0
+ && gdbarch_sofun_address_maybe_missing (gdbarch))
+ {
+ struct bound_minimal_symbol minsym
+ = find_stab_function (namestring,
+ pst ? pst->filename : NULL,
+ objfile);
+ if (minsym.minsym != NULL)
+ nlist.n_value = minsym.minsym->value_raw_address ();
+ }
+ if (pst && textlow_not_set
+ && gdbarch_sofun_address_maybe_missing (gdbarch))
+ {
+ pst->set_text_low (nlist.n_value);
+ textlow_not_set = 0;
+ }
+ /* End kludge. */
- /* Keep track of the start of the last function so we
+ /* Keep track of the start of the last function so we
can handle end of function symbols. */
- last_function_start = nlist.n_value;
+ last_function_start = nlist.n_value;
- /* In reordered executables this function may lie outside
+ /* In reordered executables this function may lie outside
the bounds created by N_SO symbols. If that's the case
use the address of this function as the low bound for
the partial symbol table. */
- if (pst
- && (textlow_not_set
- || (nlist.n_value < pst->raw_text_low ()
- && (nlist.n_value != 0))))
- {
- pst->set_text_low (nlist.n_value);
- textlow_not_set = 0;
- }
- if (pst != nullptr)
- pst->add_psymbol (gdb::string_view (sym_name, sym_len), true,
- VAR_DOMAIN, LOC_BLOCK,
- SECT_OFF_TEXT (objfile),
- psymbol_placement::STATIC,
- nlist.n_value, psymtab_language,
- partial_symtabs, objfile);
- continue;
+ if (pst
+ && (textlow_not_set
+ || (nlist.n_value < pst->raw_text_low ()
+ && (nlist.n_value != 0))))
+ {
+ pst->set_text_low (nlist.n_value);
+ textlow_not_set = 0;
+ }
+ if (pst != nullptr)
+ pst->add_psymbol (gdb::string_view (sym_name, sym_len), true,
+ VAR_DOMAIN, LOC_BLOCK,
+ SECT_OFF_TEXT (objfile),
+ psymbol_placement::STATIC, nlist.n_value,
+ psymtab_language, partial_symtabs,
+ objfile);
+ continue;
- /* Global functions were ignored here, but now they
+ /* Global functions were ignored here, but now they
are put into the global psymtab like one would expect.
They're also in the minimal symbol table. */
- case 'F':
- if (! pst)
- {
- std::string name (namestring, (p - namestring));
- function_outside_compilation_unit_complaint (name.c_str ());
- }
- /* Kludges for ELF/STABS with Sun ACC. */
- last_function_name = namestring;
- /* Do not fix textlow==0 for .o or NLM files, as 0 is a legit
+ case 'F':
+ if (!pst)
+ {
+ std::string name (namestring, (p - namestring));
+ function_outside_compilation_unit_complaint (
+ name.c_str ());
+ }
+ /* Kludges for ELF/STABS with Sun ACC. */
+ last_function_name = namestring;
+ /* Do not fix textlow==0 for .o or NLM files, as 0 is a legit
value for the bottom of the text seg in those cases. */
- if (nlist.n_value == 0
- && gdbarch_sofun_address_maybe_missing (gdbarch))
- {
- struct bound_minimal_symbol minsym
- = find_stab_function (namestring,
- pst ? pst->filename : NULL,
- objfile);
- if (minsym.minsym != NULL)
- nlist.n_value = minsym.minsym->value_raw_address ();
- }
- if (pst && textlow_not_set
- && gdbarch_sofun_address_maybe_missing (gdbarch))
- {
- pst->set_text_low (nlist.n_value);
- textlow_not_set = 0;
- }
- /* End kludge. */
+ if (nlist.n_value == 0
+ && gdbarch_sofun_address_maybe_missing (gdbarch))
+ {
+ struct bound_minimal_symbol minsym
+ = find_stab_function (namestring,
+ pst ? pst->filename : NULL,
+ objfile);
+ if (minsym.minsym != NULL)
+ nlist.n_value = minsym.minsym->value_raw_address ();
+ }
+ if (pst && textlow_not_set
+ && gdbarch_sofun_address_maybe_missing (gdbarch))
+ {
+ pst->set_text_low (nlist.n_value);
+ textlow_not_set = 0;
+ }
+ /* End kludge. */
- /* Keep track of the start of the last function so we
+ /* Keep track of the start of the last function so we
can handle end of function symbols. */
- last_function_start = nlist.n_value;
+ last_function_start = nlist.n_value;
- /* In reordered executables this function may lie outside
+ /* In reordered executables this function may lie outside
the bounds created by N_SO symbols. If that's the case
use the address of this function as the low bound for
the partial symbol table. */
- if (pst
- && (textlow_not_set
- || (nlist.n_value < pst->raw_text_low ()
- && (nlist.n_value != 0))))
- {
- pst->set_text_low (nlist.n_value);
- textlow_not_set = 0;
- }
- if (pst != nullptr)
- pst->add_psymbol (gdb::string_view (sym_name, sym_len), true,
- VAR_DOMAIN, LOC_BLOCK,
- SECT_OFF_TEXT (objfile),
- psymbol_placement::GLOBAL,
- nlist.n_value, psymtab_language,
- partial_symtabs, objfile);
- continue;
+ if (pst
+ && (textlow_not_set
+ || (nlist.n_value < pst->raw_text_low ()
+ && (nlist.n_value != 0))))
+ {
+ pst->set_text_low (nlist.n_value);
+ textlow_not_set = 0;
+ }
+ if (pst != nullptr)
+ pst->add_psymbol (gdb::string_view (sym_name, sym_len), true,
+ VAR_DOMAIN, LOC_BLOCK,
+ SECT_OFF_TEXT (objfile),
+ psymbol_placement::GLOBAL, nlist.n_value,
+ psymtab_language, partial_symtabs,
+ objfile);
+ continue;
- /* Two things show up here (hopefully); static symbols of
+ /* Two things show up here (hopefully); static symbols of
local scope (static used inside braces) or extensions
of structure symbols. We can ignore both. */
- case 'V':
- case '(':
- case '0':
- case '1':
- case '2':
- case '3':
- case '4':
- case '5':
- case '6':
- case '7':
- case '8':
- case '9':
- case '-':
- case '#': /* For symbol identification (used in live ranges). */
- continue;
+ case 'V':
+ case '(':
+ case '0':
+ case '1':
+ case '2':
+ case '3':
+ case '4':
+ case '5':
+ case '6':
+ case '7':
+ case '8':
+ case '9':
+ case '-':
+ case '#': /* For symbol identification (used in live ranges). */
+ continue;
- case ':':
- /* It is a C++ nested symbol. We don't need to record it
+ case ':':
+ /* It is a C++ nested symbol. We don't need to record it
(I don't think); if we try to look up foo::bar::baz,
then symbols for the symtab containing foo should get
read in, I think. */
- /* Someone says sun cc puts out symbols like
+ /* Someone says sun cc puts out symbols like
/foo/baz/maclib::/usr/local/bin/maclib,
which would get here with a symbol type of ':'. */
- continue;
+ continue;
- default:
- /* Unexpected symbol descriptor. The second and subsequent stabs
+ default:
+ /* Unexpected symbol descriptor. The second and subsequent stabs
of a continued stab can show up here. The question is
whether they ever can mimic a normal stab--it would be
nice if not, since we certainly don't want to spend the
time searching to the end of every string looking for
a backslash. */
- complaint (_("unknown symbol descriptor `%c'"),
- p[1]);
+ complaint (_ ("unknown symbol descriptor `%c'"), p[1]);
- /* Ignore it; perhaps it is an extension that we don't
+ /* Ignore it; perhaps it is an extension that we don't
know about. */
- continue;
- }
- }
+ continue;
+ }
+ }
case N_EXCL:
@@ -1812,8 +1797,8 @@ read_dbx_symtab (minimal_symbol_reader &reader,
/* Find the corresponding bincl and mark that psymtab on the
psymtab dependency list. */
{
- legacy_psymtab *needed_pst =
- find_corresponding_bincl_psymtab (namestring, nlist.n_value);
+ legacy_psymtab *needed_pst
+ = find_corresponding_bincl_psymtab (namestring, nlist.n_value);
/* If this include file was defined earlier in this file,
leave it alone. */
@@ -1841,19 +1826,15 @@ read_dbx_symtab (minimal_symbol_reader &reader,
{
legacy_psymtab **orig = dependency_list;
- dependency_list =
- (legacy_psymtab **)
+ dependency_list = (legacy_psymtab **)
alloca ((dependencies_allocated *= 2)
* sizeof (legacy_psymtab *));
memcpy (dependency_list, orig,
- (dependencies_used
- * sizeof (legacy_psymtab *)));
+ (dependencies_used * sizeof (legacy_psymtab *)));
#ifdef DEBUG_INFO
- gdb_printf (gdb_stderr,
- "Had to reallocate "
- "dependency list.\n");
- gdb_printf (gdb_stderr,
- "New dependencies allocated: %d\n",
+ gdb_printf (gdb_stderr, "Had to reallocate "
+ "dependency list.\n");
+ gdb_printf (gdb_stderr, "New dependencies allocated: %d\n",
dependencies_allocated);
#endif
}
@@ -1870,9 +1851,9 @@ read_dbx_symtab (minimal_symbol_reader &reader,
{
dbx_end_psymtab (objfile, partial_symtabs, pst,
psymtab_include_list, includes_used,
- symnum * symbol_size,
- (CORE_ADDR) 0, dependency_list,
- dependencies_used, textlow_not_set);
+ symnum * symbol_size, (CORE_ADDR) 0,
+ dependency_list, dependencies_used,
+ textlow_not_set);
pst = (legacy_psymtab *) 0;
includes_used = 0;
dependencies_used = 0;
@@ -1888,12 +1869,12 @@ read_dbx_symtab (minimal_symbol_reader &reader,
case N_EINCL:
case N_DSLINE:
case N_BSLINE:
- case N_SSYM: /* Claim: Structure or union element.
+ case N_SSYM: /* Claim: Structure or union element.
Hopefully, I can ignore this. */
- case N_ENTRY: /* Alternate entry point; can ignore. */
- case N_MAIN: /* Can definitely ignore this. */
- case N_CATCH: /* These are GNU C++ extensions */
- case N_EHDECL: /* that can safely be ignored here. */
+ case N_ENTRY: /* Alternate entry point; can ignore. */
+ case N_MAIN: /* Can definitely ignore this. */
+ case N_CATCH: /* These are GNU C++ extensions */
+ case N_EHDECL: /* that can safely be ignored here. */
case N_LENG:
case N_BCOMM:
case N_ECOMM:
@@ -1905,11 +1886,11 @@ read_dbx_symtab (minimal_symbol_reader &reader,
case N_BNSYM:
case N_ENSYM:
case N_LBRAC:
- case N_NSYMS: /* Ultrix 4.0: symbol count */
- case N_DEFD: /* GNU Modula-2 */
- case N_ALIAS: /* SunPro F77: alias name, ignore for now. */
+ case N_NSYMS: /* Ultrix 4.0: symbol count */
+ case N_DEFD: /* GNU Modula-2 */
+ case N_ALIAS: /* SunPro F77: alias name, ignore for now. */
- case N_OBJ: /* Useless types from Solaris. */
+ case N_OBJ: /* Useless types from Solaris. */
case N_OPT:
case N_PATCH:
/* These symbols aren't interesting; don't worry about them. */
@@ -1928,17 +1909,16 @@ read_dbx_symtab (minimal_symbol_reader &reader,
{
/* Don't set high text address of PST lower than it already
is. */
- CORE_ADDR text_end =
- (lowest_text_address == (CORE_ADDR) -1
- ? text_addr
- : lowest_text_address)
- + text_size;
-
- dbx_end_psymtab (objfile, partial_symtabs,
- pst, psymtab_include_list, includes_used,
- symnum * symbol_size,
+ CORE_ADDR text_end
+ = (lowest_text_address == (CORE_ADDR) -1 ? text_addr
+ : lowest_text_address)
+ + text_size;
+
+ dbx_end_psymtab (objfile, partial_symtabs, pst, psymtab_include_list,
+ includes_used, symnum * symbol_size,
(text_end > pst->raw_text_high ()
- ? text_end : pst->raw_text_high ()),
+ ? text_end
+ : pst->raw_text_high ()),
dependency_list, dependencies_used, textlow_not_set);
}
}
@@ -1957,8 +1937,8 @@ start_psymtab (psymtab_storage *partial_symtabs, struct objfile *objfile,
legacy_psymtab *result = new legacy_psymtab (filename, partial_symtabs,
objfile->per_bfd, textlow);
- result->read_symtab_private =
- XOBNEW (&objfile->objfile_obstack, struct symloc);
+ result->read_symtab_private
+ = XOBNEW (&objfile->objfile_obstack, struct symloc);
LDSYMOFF (result) = ldsymoff;
result->legacy_read_symtab = dbx_read_symtab;
result->legacy_expand_psymtab = dbx_expand_psymtab;
@@ -1981,12 +1961,10 @@ start_psymtab (psymtab_storage *partial_symtabs, struct objfile *objfile,
legacy_psymtab *
dbx_end_psymtab (struct objfile *objfile, psymtab_storage *partial_symtabs,
- legacy_psymtab *pst,
- const char **include_list, int num_includes,
- int capping_symbol_offset, CORE_ADDR capping_text,
- legacy_psymtab **dependency_list,
- int number_dependencies,
- int textlow_not_set)
+ legacy_psymtab *pst, const char **include_list,
+ int num_includes, int capping_symbol_offset,
+ CORE_ADDR capping_text, legacy_psymtab **dependency_list,
+ int number_dependencies, int textlow_not_set)
{
int i;
struct gdbarch *gdbarch = objfile->arch ();
@@ -2077,18 +2055,17 @@ dbx_end_psymtab (struct objfile *objfile, psymtab_storage *partial_symtabs,
for (i = 0; i < num_includes; i++)
{
- legacy_psymtab *subpst =
- new legacy_psymtab (include_list[i], partial_symtabs, objfile->per_bfd);
+ legacy_psymtab *subpst
+ = new legacy_psymtab (include_list[i], partial_symtabs,
+ objfile->per_bfd);
- subpst->read_symtab_private =
- XOBNEW (&objfile->objfile_obstack, struct symloc);
- LDSYMOFF (subpst) =
- LDSYMLEN (subpst) = 0;
+ subpst->read_symtab_private
+ = XOBNEW (&objfile->objfile_obstack, struct symloc);
+ LDSYMOFF (subpst) = LDSYMLEN (subpst) = 0;
/* We could save slight bits of space by only making one of these,
shared by the entire set of include files. FIXME-someday. */
- subpst->dependencies =
- partial_symtabs->allocate_dependencies (1);
+ subpst->dependencies = partial_symtabs->allocate_dependencies (1);
subpst->dependencies[0] = pst;
subpst->number_of_dependencies = 1;
@@ -2096,9 +2073,7 @@ dbx_end_psymtab (struct objfile *objfile, psymtab_storage *partial_symtabs,
subpst->legacy_expand_psymtab = pst->legacy_expand_psymtab;
}
- if (num_includes == 0
- && number_dependencies == 0
- && pst->empty ()
+ if (num_includes == 0 && number_dependencies == 0 && pst->empty ()
&& has_line_numbers == 0)
{
/* Throw away this psymtab, it's empty. */
@@ -2115,7 +2090,7 @@ dbx_end_psymtab (struct objfile *objfile, psymtab_storage *partial_symtabs,
}
return pst;
}
-
+
static void
dbx_expand_psymtab (legacy_psymtab *pst, struct objfile *objfile)
{
@@ -2124,7 +2099,7 @@ dbx_expand_psymtab (legacy_psymtab *pst, struct objfile *objfile)
/* Read in all partial symtabs on which this one is dependent. */
pst->expand_dependencies (objfile);
- if (LDSYMLEN (pst)) /* Otherwise it's a dummy. */
+ if (LDSYMLEN (pst)) /* Otherwise it's a dummy. */
{
/* Init stuff necessary for reading in symbols */
stabsread_init ();
@@ -2184,10 +2159,10 @@ read_ofile_symtab (struct objfile *objfile, legacy_psymtab *pst)
unsigned char type;
unsigned max_symnum;
bfd *abfd;
- int sym_offset; /* Offset to start of symbols to read */
- int sym_size; /* Size of symbols to read */
- CORE_ADDR text_offset; /* Start of text segment for symbols */
- int text_size; /* Size of text segment for symbols */
+ int sym_offset; /* Offset to start of symbols to read */
+ int sym_size; /* Size of symbols to read */
+ CORE_ADDR text_offset; /* Start of text segment for symbols */
+ int text_size; /* Size of text segment for symbols */
sym_offset = LDSYMOFF (pst);
sym_size = LDSYMLEN (pst);
@@ -2201,7 +2176,8 @@ read_ofile_symtab (struct objfile *objfile, legacy_psymtab *pst)
set_last_source_file (NULL);
abfd = objfile->obfd.get ();
- symfile_bfd = objfile->obfd.get (); /* Implicit param to next_text_symbol. */
+ symfile_bfd
+ = objfile->obfd.get (); /* Implicit param to next_text_symbol. */
symbuf_end = symbuf_idx = 0;
symbuf_read = 0;
symbuf_left = sym_offset + sym_size;
@@ -2250,15 +2226,13 @@ read_ofile_symtab (struct objfile *objfile, legacy_psymtab *pst)
fill_symbuf (abfd);
bufp = &symbuf[symbuf_idx];
if (bfd_h_get_8 (abfd, bufp->e_type) != N_SO)
- error (_("First symbol in segment of executable not a source symbol"));
+ error (_ ("First symbol in segment of executable not a source symbol"));
max_symnum = sym_size / symbol_size;
- for (symnum = 0;
- symnum < max_symnum;
- symnum++)
+ for (symnum = 0; symnum < max_symnum; symnum++)
{
- QUIT; /* Allow this to be interruptable. */
+ QUIT; /* Allow this to be interruptable. */
if (symbuf_idx == symbuf_end)
fill_symbuf (abfd);
bufp = &symbuf[symbuf_idx++];
@@ -2274,7 +2248,7 @@ read_ofile_symtab (struct objfile *objfile, legacy_psymtab *pst)
if (sizeof (nlist.n_value) > 4
/* We are a 64-bit debugger debugging a 32-bit program. */
&& (type == N_LSYM || type == N_PSYM))
- /* We have to be careful with the n_value in the case of N_LSYM
+ /* We have to be careful with the n_value in the case of N_LSYM
and N_PSYM entries, because they are signed offsets from frame
pointer, but we actually read them as unsigned 32-bit values.
This is not a problem for 32-bit debuggers, for which negative
@@ -2284,9 +2258,8 @@ read_ofile_symtab (struct objfile *objfile, legacy_psymtab *pst)
or we'll end up interpreting negative values as very large
positive offsets. */
nlist.n_value = (nlist.n_value ^ 0x80000000) - 0x80000000;
- process_one_symbol (type, nlist.n_desc, nlist.n_value,
- namestring, section_offsets, objfile,
- PST_LANGUAGE (pst));
+ process_one_symbol (type, nlist.n_desc, nlist.n_value, namestring,
+ section_offsets, objfile, PST_LANGUAGE (pst));
}
/* We skip checking for a new .o or -l file; that should never
happen in this routine. */
@@ -2337,15 +2310,13 @@ read_ofile_symtab (struct objfile *objfile, legacy_psymtab *pst)
dbxread_objfile = NULL;
}
-
/* Record the namespace that the function defined by SYMBOL was
defined in, if necessary. BLOCK is the associated block; use
OBSTACK for allocation. */
static void
-cp_set_block_scope (const struct symbol *symbol,
- struct block *block,
+cp_set_block_scope (const struct symbol *symbol, struct block *block,
struct obstack *obstack)
{
if (symbol->demangled_name () != NULL)
@@ -2461,8 +2432,7 @@ process_one_symbol (int type, int desc, CORE_ADDR valu, const char *name,
cstk = pop_context ();
/* Make a block for the local symbols within. */
- block = finish_block (cstk.name,
- cstk.old_blocks, NULL,
+ block = finish_block (cstk.name, cstk.old_blocks, NULL,
cstk.start_addr, cstk.start_addr + valu);
/* For C++, set the block's scope. */
@@ -2525,8 +2495,8 @@ process_one_symbol (int type, int desc, CORE_ADDR valu, const char *name,
2000 would output N_LSYM entries after N_LBRAC
entries. As a consequence, these symbols are simply
discarded. Complain if this is the case. */
- complaint (_("misplaced N_LBRAC entry; discarding local "
- "symbols which have no enclosing block"));
+ complaint (_ ("misplaced N_LBRAC entry; discarding local "
+ "symbols which have no enclosing block"));
}
*get_local_symbols () = cstk.locals;
@@ -2545,12 +2515,11 @@ process_one_symbol (int type, int desc, CORE_ADDR valu, const char *name,
??? Which compilers? Is this ever harmful?. */
if (cstk.start_addr > valu)
{
- complaint (_("block start larger than block end"));
+ complaint (_ ("block start larger than block end"));
cstk.start_addr = valu;
}
/* Make a block for the local symbols within. */
- finish_block (0, cstk.old_blocks, NULL,
- cstk.start_addr, valu);
+ finish_block (0, cstk.old_blocks, NULL, cstk.start_addr, valu);
}
}
else
@@ -2591,7 +2560,7 @@ process_one_symbol (int type, int desc, CORE_ADDR valu, const char *name,
if (previous_stab_code == (unsigned char) N_SO)
{
patch_subfile_names (get_current_subfile (), name);
- break; /* Ignore repeated SOs. */
+ break; /* Ignore repeated SOs. */
}
end_compunit_symtab (valu);
end_stabs ();
@@ -2658,8 +2627,8 @@ process_one_symbol (int type, int desc, CORE_ADDR valu, const char *name,
if (within_function && sline_found_in_function == 0)
{
- CORE_ADDR addr = processing_gcc_compilation == 2 ?
- last_function_start : valu;
+ CORE_ADDR addr
+ = processing_gcc_compilation == 2 ? last_function_start : valu;
record_line (get_current_subfile (), desc,
gdbarch_addr_bits_remove (gdbarch, addr));
@@ -2682,9 +2651,9 @@ process_one_symbol (int type, int desc, CORE_ADDR valu, const char *name,
offset added to their value; then we process symbol
definitions in the name. */
- case N_STSYM: /* Static symbol in data segment. */
- case N_LCSYM: /* Static symbol in BSS segment. */
- case N_ROSYM: /* Static symbol in read-only data segment. */
+ case N_STSYM: /* Static symbol in data segment. */
+ case N_LCSYM: /* Static symbol in BSS segment. */
+ case N_ROSYM: /* Static symbol in read-only data segment. */
/* HORRID HACK DEPT. However, it's Sun's furgin' fault.
Solaris 2's stabs-in-elf makes *most* symbols relative but
leaves a few absolute (at least for Solaris 2.1 and version
@@ -2731,29 +2700,29 @@ process_one_symbol (int type, int desc, CORE_ADDR valu, const char *name,
case N_ROSYM:
goto case_N_ROSYM;
default:
- internal_error (_("failed internal consistency check"));
+ internal_error (_ ("failed internal consistency check"));
}
}
- case_N_STSYM: /* Static symbol in data segment. */
- case N_DSLINE: /* Source line number, data segment. */
+ case_N_STSYM: /* Static symbol in data segment. */
+ case N_DSLINE: /* Source line number, data segment. */
section_index = SECT_OFF_DATA (objfile);
valu += section_offsets[SECT_OFF_DATA (objfile)];
goto define_a_symbol;
- case_N_LCSYM: /* Static symbol in BSS segment. */
- case N_BSLINE: /* Source line number, BSS segment. */
+ case_N_LCSYM: /* Static symbol in BSS segment. */
+ case N_BSLINE: /* Source line number, BSS segment. */
/* N_BROWS: overlaps with N_BSLINE. */
section_index = SECT_OFF_BSS (objfile);
valu += section_offsets[SECT_OFF_BSS (objfile)];
goto define_a_symbol;
- case_N_ROSYM: /* Static symbol in read-only data segment. */
+ case_N_ROSYM: /* Static symbol in read-only data segment. */
section_index = SECT_OFF_RODATA (objfile);
valu += section_offsets[SECT_OFF_RODATA (objfile)];
goto define_a_symbol;
- case N_ENTRY: /* Alternate entry point. */
+ case N_ENTRY: /* Alternate entry point. */
/* Relocate for dynamic loading. */
section_index = SECT_OFF_TEXT (objfile);
valu += section_offsets[SECT_OFF_TEXT (objfile)];
@@ -2763,14 +2732,14 @@ process_one_symbol (int type, int desc, CORE_ADDR valu, const char *name,
Handle them in a "default" way, but complain to people who
care. */
default:
- case N_CATCH: /* Exception handler catcher. */
- case N_EHDECL: /* Exception handler name. */
- case N_PC: /* Global symbol in Pascal. */
- case N_M2C: /* Modula-2 compilation unit. */
+ case N_CATCH: /* Exception handler catcher. */
+ case N_EHDECL: /* Exception handler name. */
+ case N_PC: /* Global symbol in Pascal. */
+ case N_M2C: /* Modula-2 compilation unit. */
/* N_MOD2: overlaps with N_EHDECL. */
- case N_SCOPE: /* Modula-2 scope information. */
- case N_ECOML: /* End common (local name). */
- case N_NBTEXT: /* Gould Non-Base-Register symbols??? */
+ case N_SCOPE: /* Modula-2 scope information. */
+ case N_ECOML: /* End common (local name). */
+ case N_NBTEXT: /* Gould Non-Base-Register symbols??? */
case N_NBDATA:
case N_NBBSS:
case N_NBSTS:
@@ -2781,15 +2750,15 @@ process_one_symbol (int type, int desc, CORE_ADDR valu, const char *name,
define_a_symbol:
/* These symbol types don't need the address field relocated,
since it is either unused, or is absolute. */
- case N_GSYM: /* Global variable. */
- case N_NSYMS: /* Number of symbols (Ultrix). */
- case N_NOMAP: /* No map? (Ultrix). */
- case N_RSYM: /* Register variable. */
- case N_DEFD: /* Modula-2 GNU module dependency. */
- case N_SSYM: /* Struct or union element. */
- case N_LSYM: /* Local symbol in stack. */
- case N_PSYM: /* Parameter variable. */
- case N_LENG: /* Length of preceding symbol type. */
+ case N_GSYM: /* Global variable. */
+ case N_NSYMS: /* Number of symbols (Ultrix). */
+ case N_NOMAP: /* No map? (Ultrix). */
+ case N_RSYM: /* Register variable. */
+ case N_DEFD: /* Modula-2 GNU module dependency. */
+ case N_SSYM: /* Struct or union element. */
+ case N_LSYM: /* Local symbol in stack. */
+ case N_PSYM: /* Parameter variable. */
+ case N_LENG: /* Length of preceding symbol type. */
if (name)
{
int deftype;
@@ -2824,7 +2793,7 @@ process_one_symbol (int type, int desc, CORE_ADDR valu, const char *name,
if (get_context_stack_depth () > 1)
{
- complaint (_("unmatched N_LBRAC before symtab pos %d"),
+ complaint (_ ("unmatched N_LBRAC before symtab pos %d"),
symnum);
break;
}
@@ -2835,8 +2804,7 @@ process_one_symbol (int type, int desc, CORE_ADDR valu, const char *name,
cstk = pop_context ();
/* Make a block for the local symbols within. */
- block = finish_block (cstk.name,
- cstk.old_blocks, NULL,
+ block = finish_block (cstk.name, cstk.old_blocks, NULL,
cstk.start_addr, valu);
/* For C++, set the block's scope. */
@@ -2853,8 +2821,8 @@ process_one_symbol (int type, int desc, CORE_ADDR valu, const char *name,
default:
{
- struct symbol *sym = define_symbol (valu, name, desc, type,
- objfile);
+ struct symbol *sym
+ = define_symbol (valu, name, desc, type, objfile);
if (sym != nullptr)
sym->set_section_index (section_index);
}
@@ -2866,7 +2834,7 @@ process_one_symbol (int type, int desc, CORE_ADDR valu, const char *name,
/* We use N_OPT to carry the gcc2_compiled flag. Sun uses it
for a bunch of other flags, too. Someday we may parse their
flags; for now we ignore theirs and hope they'll ignore ours. */
- case N_OPT: /* Solaris 2: Compiler options. */
+ case N_OPT: /* Solaris 2: Compiler options. */
if (name)
{
if (strcmp (name, GCC2_COMPILED_FLAG_SYMBOL) == 0)
@@ -2878,7 +2846,7 @@ process_one_symbol (int type, int desc, CORE_ADDR valu, const char *name,
}
break;
- case N_MAIN: /* Name of main routine. */
+ case N_MAIN: /* Name of main routine. */
/* FIXME: If one has a symbol file with N_MAIN and then replaces
it with a symbol file with "main" and without N_MAIN. I'm
not sure exactly what rule to follow but probably something
@@ -2892,13 +2860,13 @@ process_one_symbol (int type, int desc, CORE_ADDR valu, const char *name,
break;
/* The following symbol types can be ignored. */
- case N_OBJ: /* Solaris 2: Object file dir and name. */
- case N_PATCH: /* Solaris 2: Patch Run Time Checker. */
+ case N_OBJ: /* Solaris 2: Object file dir and name. */
+ case N_PATCH: /* Solaris 2: Patch Run Time Checker. */
/* N_UNDF: Solaris 2: File separator mark. */
/* N_UNDF: -- we will never encounter it, since we only process
one file's symbols at once. */
- case N_ENDM: /* Solaris 2: End of module. */
- case N_ALIAS: /* SunPro F77: alias name, ignore for now. */
+ case N_ENDM: /* Solaris 2: End of module. */
+ case N_ALIAS: /* SunPro F77: alias name, ignore for now. */
break;
}
@@ -2931,7 +2899,7 @@ process_one_symbol (int type, int desc, CORE_ADDR valu, const char *name,
previous_stab_code = type;
}
-
+
/* FIXME: The only difference between this and elfstab_build_psymtabs
is the call to install_minimal_symbols for elf, and the support for
split sections. If the differences are really that small, the code
@@ -2956,8 +2924,8 @@ process_one_symbol (int type, int desc, CORE_ADDR valu, const char *name,
adjusted for coff details. */
void
-coffstab_build_psymtabs (struct objfile *objfile,
- CORE_ADDR textaddr, unsigned int textsize,
+coffstab_build_psymtabs (struct objfile *objfile, CORE_ADDR textaddr,
+ unsigned int textsize,
const std::vector<asection *> &stabsects,
file_ptr stabstroffset, unsigned int stabstrsize)
{
@@ -2972,14 +2940,14 @@ coffstab_build_psymtabs (struct objfile *objfile,
DBX_TEXT_ADDR (objfile) = textaddr;
DBX_TEXT_SIZE (objfile) = textsize;
-#define COFF_STABS_SYMBOL_SIZE 12 /* XXX FIXME XXX */
+#define COFF_STABS_SYMBOL_SIZE 12 /* XXX FIXME XXX */
DBX_SYMBOL_SIZE (objfile) = COFF_STABS_SYMBOL_SIZE;
DBX_STRINGTAB_SIZE (objfile) = stabstrsize;
if (stabstrsize > bfd_get_size (sym_bfd))
- error (_("ridiculous string table size: %d bytes"), stabstrsize);
- DBX_STRINGTAB (objfile) = (char *)
- obstack_alloc (&objfile->objfile_obstack, stabstrsize + 1);
+ error (_ ("ridiculous string table size: %d bytes"), stabstrsize);
+ DBX_STRINGTAB (objfile)
+ = (char *) obstack_alloc (&objfile->objfile_obstack, stabstrsize + 1);
OBJSTAT (objfile, sz_strtab += stabstrsize + 1);
/* Now read in the string table in one big gulp. */
@@ -3000,8 +2968,7 @@ coffstab_build_psymtabs (struct objfile *objfile,
/* In a coff file, we've already installed the minimal symbols that came
from the coff (non-stab) symbol table, so always act like an
incremental load here. */
- scoped_restore save_symbuf_sections
- = make_scoped_restore (&symbuf_sections);
+ scoped_restore save_symbuf_sections = make_scoped_restore (&symbuf_sections);
if (stabsects.size () == 1)
{
stabsize = bfd_section_size (stabsects[0]);
@@ -3027,7 +2994,7 @@ coffstab_build_psymtabs (struct objfile *objfile,
dbx_symfile_read (objfile, 0);
}
-
+
/* Scan and build partial symbols for an ELF symbol file.
This ELF file has already been processed to get its minimal symbols.
@@ -3061,7 +3028,7 @@ elfstab_build_psymtabs (struct objfile *objfile, asection *stabsect,
want this. */
find_text_range (sym_bfd, objfile);
-#define ELF_STABS_SYMBOL_SIZE 12 /* XXX FIXME XXX */
+#define ELF_STABS_SYMBOL_SIZE 12 /* XXX FIXME XXX */
DBX_SYMBOL_SIZE (objfile) = ELF_STABS_SYMBOL_SIZE;
DBX_SYMCOUNT (objfile)
= bfd_section_size (stabsect) / DBX_SYMBOL_SIZE (objfile);
@@ -3070,9 +3037,9 @@ elfstab_build_psymtabs (struct objfile *objfile, asection *stabsect,
DBX_STAB_SECTION (objfile) = stabsect;
if (stabstrsize > bfd_get_size (sym_bfd))
- error (_("ridiculous string table size: %d bytes"), stabstrsize);
- DBX_STRINGTAB (objfile) = (char *)
- obstack_alloc (&objfile->objfile_obstack, stabstrsize + 1);
+ error (_ ("ridiculous string table size: %d bytes"), stabstrsize);
+ DBX_STRINGTAB (objfile)
+ = (char *) obstack_alloc (&objfile->objfile_obstack, stabstrsize + 1);
OBJSTAT (objfile, sz_strtab += stabstrsize + 1);
/* Now read in the string table in one big gulp. */
@@ -3108,7 +3075,7 @@ elfstab_build_psymtabs (struct objfile *objfile, asection *stabsect,
case it does, it will install them itself. */
dbx_symfile_read (objfile, 0);
}
-
+
/* Scan and build partial symbols for a file with special sections for stabs
and stabstrings. The file has already been processed to get its minimal
symbols, and any other symbols that might be necessary to resolve GSYMs.
@@ -3143,40 +3110,40 @@ stabsect_build_psymtabs (struct objfile *objfile, char *stab_name,
return;
if (!stabstrsect)
- error (_("stabsect_build_psymtabs: Found stabs (%s), "
- "but not string section (%s)"),
+ error (_ ("stabsect_build_psymtabs: Found stabs (%s), "
+ "but not string section (%s)"),
stab_name, stabstr_name);
dbx_objfile_data_key.emplace (objfile);
text_sect = bfd_get_section_by_name (sym_bfd, text_name);
if (!text_sect)
- error (_("Can't find %s section in symbol file"), text_name);
+ error (_ ("Can't find %s section in symbol file"), text_name);
DBX_TEXT_ADDR (objfile) = bfd_section_vma (text_sect);
DBX_TEXT_SIZE (objfile) = bfd_section_size (text_sect);
DBX_SYMBOL_SIZE (objfile) = sizeof (struct external_nlist);
- DBX_SYMCOUNT (objfile) = bfd_section_size (stabsect)
- / DBX_SYMBOL_SIZE (objfile);
+ DBX_SYMCOUNT (objfile)
+ = bfd_section_size (stabsect) / DBX_SYMBOL_SIZE (objfile);
DBX_STRINGTAB_SIZE (objfile) = bfd_section_size (stabstrsect);
- DBX_SYMTAB_OFFSET (objfile) = stabsect->filepos; /* XXX - FIXME: POKING
+ DBX_SYMTAB_OFFSET (objfile) = stabsect->filepos; /* XXX - FIXME: POKING
INSIDE BFD DATA
STRUCTURES */
if (DBX_STRINGTAB_SIZE (objfile) > bfd_get_size (sym_bfd))
- error (_("ridiculous string table size: %d bytes"),
+ error (_ ("ridiculous string table size: %d bytes"),
DBX_STRINGTAB_SIZE (objfile));
- DBX_STRINGTAB (objfile) = (char *)
- obstack_alloc (&objfile->objfile_obstack,
- DBX_STRINGTAB_SIZE (objfile) + 1);
+ DBX_STRINGTAB (objfile)
+ = (char *) obstack_alloc (&objfile->objfile_obstack,
+ DBX_STRINGTAB_SIZE (objfile) + 1);
OBJSTAT (objfile, sz_strtab += DBX_STRINGTAB_SIZE (objfile) + 1);
/* Now read in the string table in one big gulp. */
- val = bfd_get_section_contents (sym_bfd, /* bfd */
- stabstrsect, /* bfd section */
+ val = bfd_get_section_contents (sym_bfd, /* bfd */
+ stabstrsect, /* bfd section */
DBX_STRINGTAB (objfile), /* input buffer */
- 0, /* offset into section */
+ 0, /* offset into section */
DBX_STRINGTAB_SIZE (objfile)); /* amount to
read */
@@ -3192,21 +3159,21 @@ stabsect_build_psymtabs (struct objfile *objfile, char *stab_name,
processing_acc_compilation = 1;
dbx_symfile_read (objfile, 0);
}
-
-static const struct sym_fns aout_sym_fns =
-{
- dbx_new_init, /* init anything gbl to entire symtab */
- dbx_symfile_init, /* read initial info, setup for sym_read() */
- dbx_symfile_read, /* read a symbol file into symtab */
- dbx_symfile_finish, /* finished with file, cleanup */
- default_symfile_offsets, /* parse user's offsets to internal form */
- default_symfile_segments, /* Get segment information from a file. */
+
+static const struct sym_fns aout_sym_fns = {
+ dbx_new_init, /* init anything gbl to entire symtab */
+ dbx_symfile_init, /* read initial info, setup for sym_read() */
+ dbx_symfile_read, /* read a symbol file into symtab */
+ dbx_symfile_finish, /* finished with file, cleanup */
+ default_symfile_offsets, /* parse user's offsets to internal form */
+ default_symfile_segments, /* Get segment information from a file. */
NULL,
- default_symfile_relocate, /* Relocate a debug section. */
- NULL, /* sym_probe_fns */
+ default_symfile_relocate, /* Relocate a debug section. */
+ NULL, /* sym_probe_fns */
};
void _initialize_dbxread ();
+
void
_initialize_dbxread ()
{
diff --git a/gdb/dcache.c b/gdb/dcache.c
index c075625cb63..53ccb5f6a48 100644
--- a/gdb/dcache.c
+++ b/gdb/dcache.c
@@ -86,9 +86,9 @@ static unsigned dcache_line_size = DCACHE_DEFAULT_LINE_SIZE;
/* Each cache block holds LINE_SIZE bytes of data
starting at a multiple-of-LINE_SIZE address. */
-#define LINE_SIZE_MASK(dcache) ((dcache->line_size - 1))
-#define XFORM(dcache, x) ((x) & LINE_SIZE_MASK (dcache))
-#define MASK(dcache, x) ((x) & ~LINE_SIZE_MASK (dcache))
+#define LINE_SIZE_MASK(dcache) ((dcache->line_size - 1))
+#define XFORM(dcache, x) ((x) &LINE_SIZE_MASK (dcache))
+#define MASK(dcache, x) ((x) & ~LINE_SIZE_MASK (dcache))
struct dcache_block
{
@@ -96,9 +96,9 @@ struct dcache_block
struct dcache_block *prev;
struct dcache_block *next;
- CORE_ADDR addr; /* address of data */
- int refs; /* # hits */
- gdb_byte data[1]; /* line_size bytes at given address */
+ CORE_ADDR addr; /* address of data */
+ int refs; /* # hits */
+ gdb_byte data[1]; /* line_size bytes at given address */
};
struct dcache_struct
@@ -112,7 +112,7 @@ struct dcache_struct
/* The number of in-use lines in the cache. */
int size;
- CORE_ADDR line_size; /* current line_size. */
+ CORE_ADDR line_size; /* current line_size. */
/* The ptid of last inferior to use cache or null_ptid. */
ptid_t ptid;
@@ -136,7 +136,7 @@ static void
show_dcache_enabled_p (struct ui_file *file, int from_tty,
struct cmd_list_element *c, const char *value)
{
- gdb_printf (file, _("Deprecated remotecache flag is %s.\n"), value);
+ gdb_printf (file, _ ("Deprecated remotecache flag is %s.\n"), value);
}
/* Add BLOCK to circular block list BLIST, behind the block at *BLIST.
@@ -229,7 +229,6 @@ dcache_free (DCACHE *dcache)
xfree (dcache);
}
-
/* BLOCK_FUNC function for dcache_invalidate.
This doesn't remove the block from the oldest list on purpose.
dcache_invalidate will do it later. */
@@ -290,8 +289,8 @@ dcache_hit (DCACHE *dcache, CORE_ADDR addr)
{
struct dcache_block *db;
- splay_tree_node node = splay_tree_lookup (dcache->tree,
- (splay_tree_key) MASK (dcache, addr));
+ splay_tree_node node
+ = splay_tree_lookup (dcache->tree, (splay_tree_key) MASK (dcache, addr));
if (!node)
return NULL;
@@ -317,7 +316,7 @@ dcache_read_line (DCACHE *dcache, struct dcache_block *db)
len = dcache->line_size;
memaddr = db->addr;
- myaddr = db->data;
+ myaddr = db->data;
while (len > 0)
{
@@ -333,8 +332,8 @@ dcache_read_line (DCACHE *dcache, struct dcache_block *db)
if (region->attrib.mode == MEM_WO)
{
memaddr += reg_len;
- myaddr += reg_len;
- len -= reg_len;
+ myaddr += reg_len;
+ len -= reg_len;
continue;
}
@@ -372,9 +371,8 @@ dcache_alloc (DCACHE *dcache, CORE_ADDR addr)
if (db)
remove_block (&dcache->freelist, db);
else
- db = ((struct dcache_block *)
- xmalloc (offsetof (struct dcache_block, data)
- + dcache->line_size));
+ db = ((struct dcache_block *) xmalloc (
+ offsetof (struct dcache_block, data) + dcache->line_size));
dcache->size++;
}
@@ -406,7 +404,7 @@ dcache_peek_byte (DCACHE *dcache, CORE_ADDR addr, gdb_byte *ptr)
db = dcache_alloc (dcache, addr);
if (!dcache_read_line (dcache, db))
- return 0;
+ return 0;
}
*ptr = db->data[XFORM (dcache, addr)];
@@ -449,9 +447,7 @@ dcache_init (void)
{
DCACHE *dcache = XNEW (DCACHE);
- dcache->tree = splay_tree_new (dcache_splay_tree_compare,
- NULL,
- NULL);
+ dcache->tree = splay_tree_new (dcache_splay_tree_compare, NULL, NULL);
dcache->oldest = NULL;
dcache->freelist = NULL;
@@ -463,7 +459,6 @@ dcache_init (void)
return dcache;
}
-
/* Read LEN bytes from dcache memory at MEMADDR, transferring to
debugger address MYADDR. If the data is presently cached, this
fills the cache. Arguments/return are like the target_xfer_partial
@@ -471,8 +466,8 @@ dcache_init (void)
enum target_xfer_status
dcache_read_memory_partial (struct target_ops *ops, DCACHE *dcache,
- CORE_ADDR memaddr, gdb_byte *myaddr,
- ULONGEST len, ULONGEST *xfered_len)
+ CORE_ADDR memaddr, gdb_byte *myaddr, ULONGEST len,
+ ULONGEST *xfered_len)
{
ULONGEST i;
@@ -527,8 +522,7 @@ dcache_read_memory_partial (struct target_ops *ops, DCACHE *dcache,
void
dcache_update (DCACHE *dcache, enum target_xfer_status status,
- CORE_ADDR memaddr, const gdb_byte *myaddr,
- ULONGEST len)
+ CORE_ADDR memaddr, const gdb_byte *myaddr, ULONGEST len)
{
ULONGEST i;
@@ -554,7 +548,7 @@ dcache_print_line (DCACHE *dcache, int index)
if (dcache == NULL)
{
- gdb_printf (_("No data cache available.\n"));
+ gdb_printf (_ ("No data cache available.\n"));
return;
}
@@ -569,14 +563,14 @@ dcache_print_line (DCACHE *dcache, int index)
if (!n)
{
- gdb_printf (_("No such cache line exists.\n"));
+ gdb_printf (_ ("No such cache line exists.\n"));
return;
}
-
+
db = (struct dcache_block *) n->value;
- gdb_printf (_("Line %d: address %s [%d hits]\n"),
- index, paddress (target_gdbarch (), db->addr), db->refs);
+ gdb_printf (_ ("Line %d: address %s [%d hits]\n"), index,
+ paddress (target_gdbarch (), db->addr), db->refs);
for (j = 0; j < dcache->line_size; j++)
{
@@ -604,7 +598,7 @@ dcache_info_1 (DCACHE *dcache, const char *exp)
i = strtol (exp, &linestart, 10);
if (linestart == exp || i < 0)
{
- gdb_printf (_("Usage: info dcache [LINENUMBER]\n"));
+ gdb_printf (_ ("Usage: info dcache [LINENUMBER]\n"));
return;
}
@@ -612,18 +606,16 @@ dcache_info_1 (DCACHE *dcache, const char *exp)
return;
}
- gdb_printf (_("Dcache %u lines of %u bytes each.\n"),
- dcache_size,
- dcache ? (unsigned) dcache->line_size
- : dcache_line_size);
+ gdb_printf (_ ("Dcache %u lines of %u bytes each.\n"), dcache_size,
+ dcache ? (unsigned) dcache->line_size : dcache_line_size);
if (dcache == NULL || dcache->ptid == null_ptid)
{
- gdb_printf (_("No data cache available.\n"));
+ gdb_printf (_ ("No data cache available.\n"));
return;
}
- gdb_printf (_("Contains data for %s\n"),
+ gdb_printf (_ ("Contains data for %s\n"),
target_pid_to_str (dcache->ptid).c_str ());
refcount = 0;
@@ -635,15 +627,15 @@ dcache_info_1 (DCACHE *dcache, const char *exp)
{
struct dcache_block *db = (struct dcache_block *) n->value;
- gdb_printf (_("Line %d: address %s [%d hits]\n"),
- i, paddress (target_gdbarch (), db->addr), db->refs);
+ gdb_printf (_ ("Line %d: address %s [%d hits]\n"), i,
+ paddress (target_gdbarch (), db->addr), db->refs);
i++;
refcount += db->refs;
n = splay_tree_successor (dcache->tree, n->key);
}
- gdb_printf (_("Cache state: %d active lines, %d hits\n"), i, refcount);
+ gdb_printf (_ ("Cache state: %d active lines, %d hits\n"), i, refcount);
}
static void
@@ -653,13 +645,12 @@ info_dcache_command (const char *exp, int tty)
}
static void
-set_dcache_size (const char *args, int from_tty,
- struct cmd_list_element *c)
+set_dcache_size (const char *args, int from_tty, struct cmd_list_element *c)
{
if (dcache_size == 0)
{
dcache_size = DCACHE_DEFAULT_SIZE;
- error (_("Dcache size must be greater than 0."));
+ error (_ ("Dcache size must be greater than 0."));
}
target_dcache_invalidate ();
}
@@ -668,61 +659,55 @@ static void
set_dcache_line_size (const char *args, int from_tty,
struct cmd_list_element *c)
{
- if (dcache_line_size < 2
- || (dcache_line_size & (dcache_line_size - 1)) != 0)
+ if (dcache_line_size < 2 || (dcache_line_size & (dcache_line_size - 1)) != 0)
{
unsigned d = dcache_line_size;
dcache_line_size = DCACHE_DEFAULT_LINE_SIZE;
- error (_("Invalid dcache line size: %u (must be power of 2)."), d);
+ error (_ ("Invalid dcache line size: %u (must be power of 2)."), d);
}
target_dcache_invalidate ();
}
void _initialize_dcache ();
+
void
_initialize_dcache ()
{
- add_setshow_boolean_cmd ("remotecache", class_support,
- &dcache_enabled_p, _("\
-Set cache use for remote targets."), _("\
-Show cache use for remote targets."), _("\
+ add_setshow_boolean_cmd ("remotecache", class_support, &dcache_enabled_p,
+ _ ("\
+Set cache use for remote targets."),
+ _ ("\
+Show cache use for remote targets."),
+ _ ("\
This used to enable the data cache for remote targets. The cache\n\
functionality is now controlled by the memory region system and the\n\
\"stack-cache\" flag; \"remotecache\" now does nothing and\n\
exists only for compatibility reasons."),
- NULL,
- show_dcache_enabled_p,
- &setlist, &showlist);
+ NULL, show_dcache_enabled_p, &setlist, &showlist);
- add_info ("dcache", info_dcache_command,
- _("\
+ add_info ("dcache", info_dcache_command, _ ("\
Print information on the dcache performance.\n\
Usage: info dcache [LINENUMBER]\n\
With no arguments, this command prints the cache configuration and a\n\
summary of each line in the cache. With an argument, dump\"\n\
the contents of the given line."));
- add_setshow_prefix_cmd ("dcache", class_obscure,
- _("\
+ add_setshow_prefix_cmd ("dcache", class_obscure, _ ("\
Use this command to set number of lines in dcache and line-size."),
- ("Show dcache settings."),
- &dcache_set_list, &dcache_show_list,
- &setlist, &showlist);
+ ("Show dcache settings."), &dcache_set_list,
+ &dcache_show_list, &setlist, &showlist);
- add_setshow_zuinteger_cmd ("line-size", class_obscure,
- &dcache_line_size, _("\
-Set dcache line size in bytes (must be power of 2)."), _("\
+ add_setshow_zuinteger_cmd ("line-size", class_obscure, &dcache_line_size,
+ _ ("\
+Set dcache line size in bytes (must be power of 2)."),
+ _ ("\
Show dcache line size."),
- NULL,
- set_dcache_line_size,
- NULL,
+ NULL, set_dcache_line_size, NULL,
&dcache_set_list, &dcache_show_list);
- add_setshow_zuinteger_cmd ("size", class_obscure,
- &dcache_size, _("\
-Set number of dcache lines."), _("\
+ add_setshow_zuinteger_cmd ("size", class_obscure, &dcache_size, _ ("\
+Set number of dcache lines."),
+ _ ("\
Show number of dcache lines."),
- NULL,
- set_dcache_size,
- NULL,
- &dcache_set_list, &dcache_show_list);
+ NULL, set_dcache_size, NULL, &dcache_set_list,
+ &dcache_show_list);
}
diff --git a/gdb/dcache.h b/gdb/dcache.h
index 1bc42ac7840..2b528404750 100644
--- a/gdb/dcache.h
+++ b/gdb/dcache.h
@@ -21,7 +21,7 @@
#ifndef DCACHE_H
#define DCACHE_H
-#include "target.h" /* for enum target_xfer_status */
+#include "target.h" /* for enum target_xfer_status */
typedef struct dcache_struct DCACHE;
@@ -37,19 +37,15 @@ void dcache_free (DCACHE *);
/* A deletion adapter that calls dcache_free. */
struct dcache_deleter
{
- void operator() (DCACHE *d) const
- {
- dcache_free (d);
- }
+ void operator() (DCACHE *d) const { dcache_free (d); }
};
enum target_xfer_status
- dcache_read_memory_partial (struct target_ops *ops, DCACHE *dcache,
- CORE_ADDR memaddr, gdb_byte *myaddr,
- ULONGEST len, ULONGEST *xfered_len);
+dcache_read_memory_partial (struct target_ops *ops, DCACHE *dcache,
+ CORE_ADDR memaddr, gdb_byte *myaddr, ULONGEST len,
+ ULONGEST *xfered_len);
void dcache_update (DCACHE *dcache, enum target_xfer_status status,
- CORE_ADDR memaddr, const gdb_byte *myaddr,
- ULONGEST len);
+ CORE_ADDR memaddr, const gdb_byte *myaddr, ULONGEST len);
#endif /* DCACHE_H */
diff --git a/gdb/debuginfod-support.c b/gdb/debuginfod-support.c
index 04d254a1601..0e25fc98335 100644
--- a/gdb/debuginfod-support.c
+++ b/gdb/debuginfod-support.c
@@ -35,13 +35,8 @@ static const char debuginfod_on[] = "on";
static const char debuginfod_off[] = "off";
static const char debuginfod_ask[] = "ask";
-static const char *debuginfod_enabled_enum[] =
-{
- debuginfod_on,
- debuginfod_off,
- debuginfod_ask,
- nullptr
-};
+static const char *debuginfod_enabled_enum[]
+ = { debuginfod_on, debuginfod_off, debuginfod_ask, nullptr };
static const char *debuginfod_enabled =
#if defined(HAVE_LIBDEBUGINFOD)
@@ -54,8 +49,7 @@ static unsigned int debuginfod_verbose = 1;
#ifndef HAVE_LIBDEBUGINFOD
scoped_fd
-debuginfod_source_query (const unsigned char *build_id,
- int build_id_len,
+debuginfod_source_query (const unsigned char *build_id, int build_id_len,
const char *srcpath,
gdb::unique_xmalloc_ptr<char> *destname)
{
@@ -63,8 +57,7 @@ debuginfod_source_query (const unsigned char *build_id,
}
scoped_fd
-debuginfod_debuginfo_query (const unsigned char *build_id,
- int build_id_len,
+debuginfod_debuginfo_query (const unsigned char *build_id, int build_id_len,
const char *filename,
gdb::unique_xmalloc_ptr<char> *destname)
{
@@ -72,15 +65,14 @@ debuginfod_debuginfo_query (const unsigned char *build_id,
}
scoped_fd
-debuginfod_exec_query (const unsigned char *build_id,
- int build_id_len,
+debuginfod_exec_query (const unsigned char *build_id, int build_id_len,
const char *filename,
gdb::unique_xmalloc_ptr<char> *destname)
{
return scoped_fd (-ENOSYS);
}
-#define NO_IMPL _("Support for debuginfod is not compiled into GDB.")
+#define NO_IMPL _ ("Support for debuginfod is not compiled into GDB.")
#else
#include <elfutils/debuginfod.h>
@@ -88,11 +80,13 @@ debuginfod_exec_query (const unsigned char *build_id,
struct user_data
{
user_data (const char *desc, const char *fname)
- : desc (desc), fname (fname)
- { }
+ : desc (desc),
+ fname (fname)
+ {
+ }
- const char * const desc;
- const char * const fname;
+ const char *const desc;
+ const char *const fname;
ui_out::progress_update progress;
};
@@ -100,16 +94,12 @@ struct user_data
struct debuginfod_client_deleter
{
- void operator() (debuginfod_client *c)
- {
- debuginfod_end (c);
- }
+ void operator() (debuginfod_client *c) { debuginfod_end (c); }
};
using debuginfod_client_up
= std::unique_ptr<debuginfod_client, debuginfod_client_deleter>;
-
/* Convert SIZE into a unit suitable for use with progress updates.
SIZE should in given in bytes and will be converted into KB, MB, GB
or remain unchanged. UNIT will be set to "B", "KB", "MB" or "GB"
@@ -143,13 +133,12 @@ progressfn (debuginfod_client *c, long cur, long total)
gdb_assert (data != nullptr);
string_file styled_fname (current_uiout->can_emit_style_escape ());
- fprintf_styled (&styled_fname, file_name_style.style (), "%s",
- data->fname);
+ fprintf_styled (&styled_fname, file_name_style.style (), "%s", data->fname);
if (check_quit_flag ())
{
- gdb_printf ("Cancelling download of %s %s...\n",
- data->desc, styled_fname.c_str ());
+ gdb_printf ("Cancelling download of %s %s...\n", data->desc,
+ styled_fname.c_str ());
return 1;
}
@@ -165,17 +154,17 @@ progressfn (debuginfod_client *c, long cur, long total)
if (howmuch >= 0.0 && howmuch <= 1.0)
{
double d_total = (double) total;
- const char *unit = get_size_and_unit (d_total);
- std::string msg = string_printf ("Downloading %0.2f %s %s %s",
- d_total, unit, data->desc,
- styled_fname.c_str ());
+ const char *unit = get_size_and_unit (d_total);
+ std::string msg
+ = string_printf ("Downloading %0.2f %s %s %s", d_total, unit,
+ data->desc, styled_fname.c_str ());
data->progress.update_progress (msg, unit, howmuch, d_total);
return 0;
}
}
- std::string msg = string_printf ("Downloading %s %s",
- data->desc, styled_fname.c_str ());
+ std::string msg
+ = string_printf ("Downloading %s %s", data->desc, styled_fname.c_str ());
data->progress.update_progress (msg);
return 0;
}
@@ -204,15 +193,13 @@ debuginfod_is_enabled ()
{
const char *urls = skip_spaces (getenv (DEBUGINFOD_URLS_ENV_VAR));
- if (debuginfod_enabled == debuginfod_off
- || urls == nullptr
- || *urls == '\0')
+ if (debuginfod_enabled == debuginfod_off || urls == nullptr || *urls == '\0')
return false;
if (debuginfod_enabled == debuginfod_ask)
{
- gdb_printf (_("\nThis GDB supports auto-downloading debuginfo " \
- "from the following URLs:\n"));
+ gdb_printf (_ ("\nThis GDB supports auto-downloading debuginfo "
+ "from the following URLs:\n"));
gdb::string_view url_view (urls);
while (true)
@@ -229,29 +216,28 @@ debuginfod_is_enabled ()
DIAGNOSTIC_IGNORE_STRINGOP_OVERREAD
off = url_view.find_first_of (' ');
DIAGNOSTIC_POP
- gdb_printf
- (_(" <%ps>\n"),
- styled_string (file_name_style.style (),
- gdb::to_string (url_view.substr (0,
- off)).c_str ()));
+ gdb_printf (_ (" <%ps>\n"),
+ styled_string (
+ file_name_style.style (),
+ gdb::to_string (url_view.substr (0, off)).c_str ()));
if (off == gdb::string_view::npos)
break;
url_view = url_view.substr (off);
}
- int resp = nquery (_("Enable debuginfod for this session? "));
+ int resp = nquery (_ ("Enable debuginfod for this session? "));
if (!resp)
{
- gdb_printf (_("Debuginfod has been disabled.\nTo make this " \
- "setting permanent, add \'set debuginfod " \
- "enabled off\' to .gdbinit.\n"));
+ gdb_printf (_ ("Debuginfod has been disabled.\nTo make this "
+ "setting permanent, add \'set debuginfod "
+ "enabled off\' to .gdbinit.\n"));
debuginfod_enabled = debuginfod_off;
return false;
}
- gdb_printf (_("Debuginfod has been enabled.\nTo make this " \
- "setting permanent, add \'set debuginfod enabled " \
- "on\' to .gdbinit.\n"));
+ gdb_printf (_ ("Debuginfod has been enabled.\nTo make this "
+ "setting permanent, add \'set debuginfod enabled "
+ "on\' to .gdbinit.\n"));
debuginfod_enabled = debuginfod_on;
}
@@ -267,17 +253,15 @@ print_outcome (user_data &data, int fd)
current_uiout->do_progress_end ();
if (fd < 0 && fd != -ENOENT)
- gdb_printf (_("Download failed: %s. Continuing without %s %ps.\n"),
- safe_strerror (-fd),
- data.desc,
+ gdb_printf (_ ("Download failed: %s. Continuing without %s %ps.\n"),
+ safe_strerror (-fd), data.desc,
styled_string (file_name_style.style (), data.fname));
}
/* See debuginfod-support.h */
scoped_fd
-debuginfod_source_query (const unsigned char *build_id,
- int build_id_len,
+debuginfod_source_query (const unsigned char *build_id, int build_id_len,
const char *srcpath,
gdb::unique_xmalloc_ptr<char> *destname)
{
@@ -300,10 +284,7 @@ debuginfod_source_query (const unsigned char *build_id,
target_terminal::ours ();
}
- scoped_fd fd (debuginfod_find_source (c,
- build_id,
- build_id_len,
- srcpath,
+ scoped_fd fd (debuginfod_find_source (c, build_id, build_id_len, srcpath,
&dname));
debuginfod_set_user_data (c, nullptr);
print_outcome (data, fd.get ());
@@ -317,8 +298,7 @@ debuginfod_source_query (const unsigned char *build_id,
/* See debuginfod-support.h */
scoped_fd
-debuginfod_debuginfo_query (const unsigned char *build_id,
- int build_id_len,
+debuginfod_debuginfo_query (const unsigned char *build_id, int build_id_len,
const char *filename,
gdb::unique_xmalloc_ptr<char> *destname)
{
@@ -341,8 +321,7 @@ debuginfod_debuginfo_query (const unsigned char *build_id,
target_terminal::ours ();
}
- scoped_fd fd (debuginfod_find_debuginfo (c, build_id, build_id_len,
- &dname));
+ scoped_fd fd (debuginfod_find_debuginfo (c, build_id, build_id_len, &dname));
debuginfod_set_user_data (c, nullptr);
print_outcome (data, fd.get ());
@@ -355,8 +334,7 @@ debuginfod_debuginfo_query (const unsigned char *build_id,
/* See debuginfod-support.h */
scoped_fd
-debuginfod_exec_query (const unsigned char *build_id,
- int build_id_len,
+debuginfod_exec_query (const unsigned char *build_id, int build_id_len,
const char *filename,
gdb::unique_xmalloc_ptr<char> *destname)
{
@@ -379,7 +357,8 @@ debuginfod_exec_query (const unsigned char *build_id,
target_terminal::ours ();
}
- scoped_fd fd (debuginfod_find_executable (c, build_id, build_id_len, &dname));
+ scoped_fd fd (debuginfod_find_executable (c, build_id, build_id_len,
+ &dname));
debuginfod_set_user_data (c, nullptr);
print_outcome (data, fd.get ());
@@ -419,8 +398,9 @@ show_debuginfod_enabled (ui_file *file, int from_tty, cmd_list_element *cmd,
const char *value)
{
gdb_printf (file,
- _("Debuginfod functionality is currently set to "
- "\"%s\".\n"), debuginfod_enabled);
+ _ ("Debuginfod functionality is currently set to "
+ "\"%s\".\n"),
+ debuginfod_enabled);
}
/* Set callback for "set debuginfod urls". */
@@ -430,7 +410,7 @@ set_debuginfod_urls (const std::string &urls)
{
#if defined(HAVE_LIBDEBUGINFOD)
if (setenv (DEBUGINFOD_URLS_ENV_VAR, urls.c_str (), 1) != 0)
- warning (_("Unable to set debuginfod URLs: %s"), safe_strerror (errno));
+ warning (_ ("Unable to set debuginfod URLs: %s"), safe_strerror (errno));
#else
error (NO_IMPL);
#endif
@@ -438,7 +418,7 @@ set_debuginfod_urls (const std::string &urls)
/* Get callback for "set debuginfod urls". */
-static const std::string&
+static const std::string &
get_debuginfod_urls ()
{
static std::string urls;
@@ -461,9 +441,9 @@ show_debuginfod_urls (ui_file *file, int from_tty, cmd_list_element *cmd,
const char *value)
{
if (value[0] == '\0')
- gdb_printf (file, _("Debuginfod URLs have not been set.\n"));
+ gdb_printf (file, _ ("Debuginfod URLs have not been set.\n"));
else
- gdb_printf (file, _("Debuginfod URLs are currently set to:\n%s\n"),
+ gdb_printf (file, _ ("Debuginfod URLs are currently set to:\n%s\n"),
value);
}
@@ -473,58 +453,56 @@ static void
show_debuginfod_verbose_command (ui_file *file, int from_tty,
cmd_list_element *cmd, const char *value)
{
- gdb_printf (file, _("Debuginfod verbose output is set to %s.\n"),
- value);
+ gdb_printf (file, _ ("Debuginfod verbose output is set to %s.\n"), value);
}
/* Register debuginfod commands. */
void _initialize_debuginfod ();
+
void
_initialize_debuginfod ()
{
/* set/show debuginfod */
add_setshow_prefix_cmd ("debuginfod", class_run,
- _("Set debuginfod options."),
- _("Show debuginfod options."),
+ _ ("Set debuginfod options."),
+ _ ("Show debuginfod options."),
&set_debuginfod_prefix_list,
- &show_debuginfod_prefix_list,
- &setlist, &showlist);
+ &show_debuginfod_prefix_list, &setlist, &showlist);
add_setshow_enum_cmd ("enabled", class_run, debuginfod_enabled_enum,
- _("Set whether to use debuginfod."),
- _("Show whether to use debuginfod."),
- _("\
+ _ ("Set whether to use debuginfod."),
+ _ ("Show whether to use debuginfod."), _ ("\
When on, enable the use of debuginfod to download missing debug info and\n\
source files."),
- set_debuginfod_enabled,
- get_debuginfod_enabled,
- show_debuginfod_enabled,
- &set_debuginfod_prefix_list,
+ set_debuginfod_enabled, get_debuginfod_enabled,
+ show_debuginfod_enabled, &set_debuginfod_prefix_list,
&show_debuginfod_prefix_list);
/* set/show debuginfod urls */
- add_setshow_string_noescape_cmd ("urls", class_run, _("\
-Set the list of debuginfod server URLs."), _("\
-Show the list of debuginfod server URLs."), _("\
+ add_setshow_string_noescape_cmd ("urls", class_run, _ ("\
+Set the list of debuginfod server URLs."),
+ _ ("\
+Show the list of debuginfod server URLs."),
+ _ ("\
Manage the space-separated list of debuginfod server URLs that GDB will query \
when missing debuginfo, executables or source files.\nThe default value is \
copied from the DEBUGINFOD_URLS environment variable."),
- set_debuginfod_urls,
- get_debuginfod_urls,
+ set_debuginfod_urls, get_debuginfod_urls,
show_debuginfod_urls,
&set_debuginfod_prefix_list,
&show_debuginfod_prefix_list);
/* set/show debuginfod verbose */
- add_setshow_zuinteger_cmd ("verbose", class_support,
- &debuginfod_verbose, _("\
-Set verbosity of debuginfod output."), _("\
-Show debuginfod debugging."), _("\
+ add_setshow_zuinteger_cmd ("verbose", class_support, &debuginfod_verbose,
+ _ ("\
+Set verbosity of debuginfod output."),
+ _ ("\
+Show debuginfod debugging."),
+ _ ("\
When set to a non-zero value, display verbose output for each debuginfod \
query.\nTo disable, set to zero. Verbose output is displayed by default."),
- nullptr,
- show_debuginfod_verbose_command,
+ nullptr, show_debuginfod_verbose_command,
&set_debuginfod_prefix_list,
&show_debuginfod_prefix_list);
}
diff --git a/gdb/debuginfod-support.h b/gdb/debuginfod-support.h
index 542d1688fa1..686482ba804 100644
--- a/gdb/debuginfod-support.h
+++ b/gdb/debuginfod-support.h
@@ -38,8 +38,7 @@
function returns -ENOSYS. */
extern scoped_fd
-debuginfod_source_query (const unsigned char *build_id,
- int build_id_len,
+debuginfod_source_query (const unsigned char *build_id, int build_id_len,
const char *src_path,
gdb::unique_xmalloc_ptr<char> *destname);
@@ -56,8 +55,7 @@ debuginfod_source_query (const unsigned char *build_id,
function returns -ENOSYS. */
extern scoped_fd
-debuginfod_debuginfo_query (const unsigned char *build_id,
- int build_id_len,
+debuginfod_debuginfo_query (const unsigned char *build_id, int build_id_len,
const char *filename,
gdb::unique_xmalloc_ptr<char> *destname);
@@ -73,9 +71,8 @@ debuginfod_debuginfo_query (const unsigned char *build_id,
is stored in DESTNAME. If GDB is not built with debuginfod, this
function returns -ENOSYS. */
-extern scoped_fd debuginfod_exec_query (const unsigned char *build_id,
- int build_id_len,
- const char *filename,
- gdb::unique_xmalloc_ptr<char>
- *destname);
+extern scoped_fd
+debuginfod_exec_query (const unsigned char *build_id, int build_id_len,
+ const char *filename,
+ gdb::unique_xmalloc_ptr<char> *destname);
#endif /* DEBUGINFOD_SUPPORT_H */
diff --git a/gdb/defs.h b/gdb/defs.h
index b6a132173fb..3c7e354762a 100644
--- a/gdb/defs.h
+++ b/gdb/defs.h
@@ -22,7 +22,7 @@
#define DEFS_H
#ifdef GDBSERVER
-# error gdbserver should not include gdb/defs.h
+#error gdbserver should not include gdb/defs.h
#endif
#include "gdbsupport/common-defs.h"
@@ -69,33 +69,32 @@
accept. */
enum compile_i_scope_types
- {
- COMPILE_I_INVALID_SCOPE,
+{
+ COMPILE_I_INVALID_SCOPE,
- /* A simple scope. Wrap an expression into a simple scope that
+ /* A simple scope. Wrap an expression into a simple scope that
takes no arguments, returns no value, and uses the generic
function name "_gdb_expr". */
- COMPILE_I_SIMPLE_SCOPE,
+ COMPILE_I_SIMPLE_SCOPE,
- /* Do not wrap the expression,
+ /* Do not wrap the expression,
it has to provide function "_gdb_expr" on its own. */
- COMPILE_I_RAW_SCOPE,
+ COMPILE_I_RAW_SCOPE,
- /* A printable expression scope. Wrap an expression into a scope
+ /* A printable expression scope. Wrap an expression into a scope
suitable for the "compile print" command. It uses the generic
function name "_gdb_expr". COMPILE_I_PRINT_ADDRESS_SCOPE variant
is the usual one, taking address of the object.
COMPILE_I_PRINT_VALUE_SCOPE is needed for arrays where the array
name already specifies its address. See get_out_value_type. */
- COMPILE_I_PRINT_ADDRESS_SCOPE,
- COMPILE_I_PRINT_VALUE_SCOPE,
- };
-
+ COMPILE_I_PRINT_ADDRESS_SCOPE,
+ COMPILE_I_PRINT_VALUE_SCOPE,
+};
template<typename T>
-using RequireLongest = gdb::Requires<gdb::Or<std::is_same<T, LONGEST>,
- std::is_same<T, ULONGEST>>>;
+using RequireLongest = gdb::Requires<
+ gdb::Or<std::is_same<T, LONGEST>, std::is_same<T, ULONGEST>>>;
/* Just in case they're not defined in stdio.h. */
@@ -208,24 +207,24 @@ extern void quit_serial_event_clear (void);
'languages' array in language.c.) */
enum language
- {
- language_unknown, /* Language not known */
- language_auto, /* Placeholder for automatic setting */
- language_c, /* C */
- language_objc, /* Objective-C */
- language_cplus, /* C++ */
- language_d, /* D */
- language_go, /* Go */
- language_fortran, /* Fortran */
- language_m2, /* Modula-2 */
- language_asm, /* Assembly language */
- language_pascal, /* Pascal */
- language_opencl, /* OpenCL */
- language_rust, /* Rust */
- language_minimal, /* All other languages, minimal support only */
- language_ada, /* Ada */
- nr_languages
- };
+{
+ language_unknown, /* Language not known */
+ language_auto, /* Placeholder for automatic setting */
+ language_c, /* C */
+ language_objc, /* Objective-C */
+ language_cplus, /* C++ */
+ language_d, /* D */
+ language_go, /* Go */
+ language_fortran, /* Fortran */
+ language_m2, /* Modula-2 */
+ language_asm, /* Assembly language */
+ language_pascal, /* Pascal */
+ language_opencl, /* OpenCL */
+ language_rust, /* Rust */
+ language_minimal, /* All other languages, minimal support only */
+ language_ada, /* Ada */
+ nr_languages
+};
/* The number of bits needed to represent all languages, with enough
padding to allow for reasonable growth. */
@@ -236,11 +235,11 @@ gdb_static_assert (nr_languages <= (1 << LANGUAGE_BITS));
#define LANGUAGE_BYTES ((LANGUAGE_BITS + HOST_CHAR_BIT - 1) / HOST_CHAR_BIT)
enum precision_type
- {
- single_precision,
- double_precision,
- unspecified_precision
- };
+{
+ single_precision,
+ double_precision,
+ unspecified_precision
+};
/* * A generic, not quite boolean, enumeration. This is used for
set/show commands in which the options are on/off/automatic. */
@@ -292,13 +291,12 @@ struct value;
/* This really belong in utils.c (path-utils.c?), but it references some
globals that are currently only available to main.c. */
-extern std::string relocate_gdb_directory (const char *initial, bool relocatable);
+extern std::string relocate_gdb_directory (const char *initial,
+ bool relocatable);
-
/* Annotation stuff. */
-extern int annotation_level; /* in stack.c */
-
+extern int annotation_level; /* in stack.c */
/* From regex.c or libc. BSD 4.4 declares this with the argument type as
"const char *" in unistd.h, so we can't declare the argument
@@ -330,8 +328,7 @@ extern bool info_verbose;
extern void set_next_address (struct gdbarch *, CORE_ADDR);
extern int print_address_symbolic (struct gdbarch *, CORE_ADDR,
- struct ui_file *, int,
- const char *);
+ struct ui_file *, int, const char *);
extern void print_address (struct gdbarch *, CORE_ADDR, struct ui_file *);
extern const char *pc_prefix (CORE_ADDR);
@@ -357,55 +354,55 @@ typedef int (*find_memory_region_ftype) (CORE_ADDR addr, unsigned long size,
value.h, but needs to be here for the same reason. */
enum lval_type
- {
- /* * Not an lval. */
- not_lval,
- /* * In memory. */
- lval_memory,
- /* * In a register. Registers are relative to a frame. */
- lval_register,
- /* * In a gdb internal variable. */
- lval_internalvar,
- /* * Value encapsulates a callable defined in an extension language. */
- lval_xcallable,
- /* * Part of a gdb internal variable (structure field). */
- lval_internalvar_component,
- /* * Value's bits are fetched and stored using functions provided
+{
+ /* * Not an lval. */
+ not_lval,
+ /* * In memory. */
+ lval_memory,
+ /* * In a register. Registers are relative to a frame. */
+ lval_register,
+ /* * In a gdb internal variable. */
+ lval_internalvar,
+ /* * Value encapsulates a callable defined in an extension language. */
+ lval_xcallable,
+ /* * Part of a gdb internal variable (structure field). */
+ lval_internalvar_component,
+ /* * Value's bits are fetched and stored using functions provided
by its creator. */
- lval_computed
- };
+ lval_computed
+};
/* * Parameters of the "info proc" command. */
enum info_proc_what
- {
- /* * Display the default cmdline, cwd and exe outputs. */
- IP_MINIMAL,
+{
+ /* * Display the default cmdline, cwd and exe outputs. */
+ IP_MINIMAL,
- /* * Display `info proc mappings'. */
- IP_MAPPINGS,
+ /* * Display `info proc mappings'. */
+ IP_MAPPINGS,
- /* * Display `info proc status'. */
- IP_STATUS,
+ /* * Display `info proc status'. */
+ IP_STATUS,
- /* * Display `info proc stat'. */
- IP_STAT,
+ /* * Display `info proc stat'. */
+ IP_STAT,
- /* * Display `info proc cmdline'. */
- IP_CMDLINE,
+ /* * Display `info proc cmdline'. */
+ IP_CMDLINE,
- /* * Display `info proc exe'. */
- IP_EXE,
+ /* * Display `info proc exe'. */
+ IP_EXE,
- /* * Display `info proc cwd'. */
- IP_CWD,
+ /* * Display `info proc cwd'. */
+ IP_CWD,
- /* * Display `info proc files'. */
- IP_FILES,
+ /* * Display `info proc files'. */
+ IP_FILES,
- /* * Display all of the above. */
- IP_ALL
- };
+ /* * Display all of the above. */
+ IP_ALL
+};
/* * Default radixes for input and output. Only some values supported. */
extern unsigned input_radix;
@@ -418,12 +415,12 @@ extern unsigned output_radix;
value.h. */
enum val_prettyformat
- {
- Val_no_prettyformat = 0,
- Val_prettyformat,
- /* * Use the default setting which the user has specified. */
- Val_prettyformat_default
- };
+{
+ Val_no_prettyformat = 0,
+ Val_prettyformat,
+ /* * Use the default setting which the user has specified. */
+ Val_prettyformat_default
+};
/* * Optional native machine support. Non-native (and possibly pure
multi-arch) targets do not need a "nm.h" file. This will be a
@@ -443,38 +440,38 @@ enum val_prettyformat
4.x and 4.3BSD. This assumption means these systems are no longer
supported. */
#ifndef FOPEN_RB
-# include "fopen-bin.h"
+#include "fopen-bin.h"
#endif
/* Defaults for system-wide constants (if not defined by xm.h, we fake it).
FIXME: Assumes 2's complement arithmetic. */
-#if !defined (UINT_MAX)
-#define UINT_MAX ((unsigned int)(~0)) /* 0xFFFFFFFF for 32-bits */
+#if !defined(UINT_MAX)
+#define UINT_MAX ((unsigned int) (~0)) /* 0xFFFFFFFF for 32-bits */
#endif
-#if !defined (INT_MAX)
-#define INT_MAX ((int)(UINT_MAX >> 1)) /* 0x7FFFFFFF for 32-bits */
+#if !defined(INT_MAX)
+#define INT_MAX ((int) (UINT_MAX >> 1)) /* 0x7FFFFFFF for 32-bits */
#endif
-#if !defined (INT_MIN)
-#define INT_MIN ((int)((int) ~0 ^ INT_MAX)) /* 0x80000000 for 32-bits */
+#if !defined(INT_MIN)
+#define INT_MIN ((int) ((int) ~0 ^ INT_MAX)) /* 0x80000000 for 32-bits */
#endif
-#if !defined (ULONG_MAX)
-#define ULONG_MAX ((unsigned long)(~0L)) /* 0xFFFFFFFF for 32-bits */
+#if !defined(ULONG_MAX)
+#define ULONG_MAX ((unsigned long) (~0L)) /* 0xFFFFFFFF for 32-bits */
#endif
-#if !defined (LONG_MAX)
-#define LONG_MAX ((long)(ULONG_MAX >> 1)) /* 0x7FFFFFFF for 32-bits */
+#if !defined(LONG_MAX)
+#define LONG_MAX ((long) (ULONG_MAX >> 1)) /* 0x7FFFFFFF for 32-bits */
#endif
-#if !defined (ULONGEST_MAX)
-#define ULONGEST_MAX (~(ULONGEST)0) /* 0xFFFFFFFFFFFFFFFF for 64-bits */
+#if !defined(ULONGEST_MAX)
+#define ULONGEST_MAX (~(ULONGEST) 0) /* 0xFFFFFFFFFFFFFFFF for 64-bits */
#endif
-#if !defined (LONGEST_MAX) /* 0x7FFFFFFFFFFFFFFF for 64-bits */
-#define LONGEST_MAX ((LONGEST)(ULONGEST_MAX >> 1))
+#if !defined(LONGEST_MAX) /* 0x7FFFFFFFFFFFFFFF for 64-bits */
+#define LONGEST_MAX ((LONGEST) (ULONGEST_MAX >> 1))
#endif
/* * Convert a LONGEST to an int. This is used in contexts (e.g. number of
@@ -505,7 +502,8 @@ enum symbol_needs_kind
/* In findvar.c. */
template<typename T, typename = RequireLongest<T>>
-T extract_integer (gdb::array_view<const gdb_byte>, enum bfd_endian byte_order);
+T extract_integer (gdb::array_view<const gdb_byte>,
+ enum bfd_endian byte_order);
static inline LONGEST
extract_signed_integer (gdb::array_view<const gdb_byte> buf,
@@ -551,15 +549,15 @@ extern void store_integer (gdb_byte *addr, int len, enum bfd_endian byte_order,
T val);
static inline void
-store_signed_integer (gdb_byte *addr, int len,
- enum bfd_endian byte_order, LONGEST val)
+store_signed_integer (gdb_byte *addr, int len, enum bfd_endian byte_order,
+ LONGEST val)
{
return store_integer (addr, len, byte_order, val);
}
static inline void
-store_unsigned_integer (gdb_byte *addr, int len,
- enum bfd_endian byte_order, ULONGEST val)
+store_unsigned_integer (gdb_byte *addr, int len, enum bfd_endian byte_order,
+ ULONGEST val)
{
return store_integer (addr, len, byte_order, val);
}
@@ -581,20 +579,20 @@ extern void (*deprecated_post_add_symbol_hook) (void);
extern void (*selected_frame_level_changed_hook) (int);
extern int (*deprecated_ui_loop_hook) (int signo);
extern void (*deprecated_show_load_progress) (const char *section,
- unsigned long section_sent,
- unsigned long section_size,
- unsigned long total_sent,
+ unsigned long section_sent,
+ unsigned long section_size,
+ unsigned long total_sent,
unsigned long total_size);
-extern void (*deprecated_print_frame_info_listing_hook) (struct symtab * s,
+extern void (*deprecated_print_frame_info_listing_hook) (struct symtab *s,
int line,
int stopline,
int noerror);
extern int (*deprecated_query_hook) (const char *, va_list)
- ATTRIBUTE_FPTR_PRINTF(1,0);
+ ATTRIBUTE_FPTR_PRINTF (1, 0);
extern void (*deprecated_warning_hook) (const char *, va_list)
- ATTRIBUTE_FPTR_PRINTF(1,0);
-extern void (*deprecated_readline_begin_hook) (const char *, ...)
- ATTRIBUTE_FPTR_PRINTF_1;
+ ATTRIBUTE_FPTR_PRINTF (1, 0);
+extern void (*deprecated_readline_begin_hook) (const char *,
+ ...) ATTRIBUTE_FPTR_PRINTF_1;
extern char *(*deprecated_readline_hook) (const char *);
extern void (*deprecated_readline_end_hook) (void);
extern void (*deprecated_context_hook) (int);
@@ -604,7 +602,7 @@ extern ptid_t (*deprecated_target_wait_hook) (ptid_t ptid,
extern void (*deprecated_attach_hook) (void);
extern void (*deprecated_detach_hook) (void);
-extern void (*deprecated_call_command_hook) (struct cmd_list_element * c,
+extern void (*deprecated_call_command_hook) (struct cmd_list_element *c,
const char *cmd, int from_tty);
extern int (*deprecated_ui_load_progress_hook) (const char *section,
@@ -613,11 +611,11 @@ extern int (*deprecated_ui_load_progress_hook) (const char *section,
/* If this definition isn't overridden by the header files, assume
that isatty and fileno exist on this system. */
#ifndef ISATTY
-#define ISATTY(FP) (isatty (fileno (FP)))
+#define ISATTY(FP) (isatty (fileno (FP)))
#endif
/* * A width that can achieve a better legibility for GDB MI mode. */
-#define GDB_MI_MSG_WIDTH 80
+#define GDB_MI_MSG_WIDTH 80
/* From progspace.c */
@@ -636,16 +634,17 @@ enum block_enum
/* User selection used in observable.h and multiple print functions. */
enum user_selected_what_flag
- {
- /* Inferior selected. */
- USER_SELECTED_INFERIOR = 1 << 1,
+{
+ /* Inferior selected. */
+ USER_SELECTED_INFERIOR = 1 << 1,
- /* Thread selected. */
- USER_SELECTED_THREAD = 1 << 2,
+ /* Thread selected. */
+ USER_SELECTED_THREAD = 1 << 2,
+
+ /* Frame selected. */
+ USER_SELECTED_FRAME = 1 << 3
+};
- /* Frame selected. */
- USER_SELECTED_FRAME = 1 << 3
- };
DEF_ENUM_FLAGS_TYPE (enum user_selected_what_flag, user_selected_what);
#include "utils.h"
diff --git a/gdb/dicos-tdep.c b/gdb/dicos-tdep.c
index 376ed7f1113..bbf1a676e67 100644
--- a/gdb/dicos-tdep.c
+++ b/gdb/dicos-tdep.c
@@ -79,9 +79,8 @@ dicos_load_module_p (bfd *abfd, int header_size)
storage_needed = bfd_get_symtab_upper_bound (abfd);
if (storage_needed < 0)
{
- warning (_("Can't read elf symbols from %s: %s"),
- bfd_get_filename (abfd),
- bfd_errmsg (bfd_get_error ()));
+ warning (_ ("Can't read elf symbols from %s: %s"),
+ bfd_get_filename (abfd), bfd_errmsg (bfd_get_error ()));
return 0;
}
@@ -93,16 +92,14 @@ dicos_load_module_p (bfd *abfd, int header_size)
symcount = bfd_canonicalize_symtab (abfd, symbol_table);
if (symcount < 0)
- warning (_("Can't read elf symbols from %s: %s"),
- bfd_get_filename (abfd),
- bfd_errmsg (bfd_get_error ()));
+ warning (_ ("Can't read elf symbols from %s: %s"),
+ bfd_get_filename (abfd), bfd_errmsg (bfd_get_error ()));
else
{
for (i = 0; i < symcount; i++)
{
asymbol *sym = symbol_table[i];
- if (sym->name != NULL
- && symname[0] == sym->name[0]
+ if (sym->name != NULL && symname[0] == sym->name[0]
&& strcmp (symname + 1, sym->name + 1) == 0)
{
ret = 1;
diff --git a/gdb/dictionary.c b/gdb/dictionary.c
index 403508adfdc..0bc6d77c3a2 100644
--- a/gdb/dictionary.c
+++ b/gdb/dictionary.c
@@ -90,16 +90,16 @@
Used only for debugging. */
enum dict_type
- {
- /* Symbols are stored in a fixed-size hash table. */
- DICT_HASHED,
- /* Symbols are stored in an expandable hash table. */
- DICT_HASHED_EXPANDABLE,
- /* Symbols are stored in a fixed-size array. */
- DICT_LINEAR,
- /* Symbols are stored in an expandable array. */
- DICT_LINEAR_EXPANDABLE
- };
+{
+ /* Symbols are stored in a fixed-size hash table. */
+ DICT_HASHED,
+ /* Symbols are stored in an expandable hash table. */
+ DICT_HASHED_EXPANDABLE,
+ /* Symbols are stored in a fixed-size array. */
+ DICT_LINEAR,
+ /* Symbols are stored in an expandable array. */
+ DICT_LINEAR_EXPANDABLE
+};
/* The virtual function table. */
@@ -168,37 +168,36 @@ struct dictionary
{
const struct language_defn *language;
const struct dict_vector *vector;
+
union
{
struct dictionary_hashed hashed;
struct dictionary_hashed_expandable hashed_expandable;
struct dictionary_linear linear;
struct dictionary_linear_expandable linear_expandable;
- }
- data;
+ } data;
};
/* Accessor macros. */
-#define DICT_VECTOR(d) (d)->vector
-#define DICT_LANGUAGE(d) (d)->language
+#define DICT_VECTOR(d) (d)->vector
+#define DICT_LANGUAGE(d) (d)->language
/* These can be used for DICT_HASHED_EXPANDABLE, too. */
-#define DICT_HASHED_NBUCKETS(d) (d)->data.hashed.nbuckets
-#define DICT_HASHED_BUCKETS(d) (d)->data.hashed.buckets
-#define DICT_HASHED_BUCKET(d,i) DICT_HASHED_BUCKETS (d) [i]
+#define DICT_HASHED_NBUCKETS(d) (d)->data.hashed.nbuckets
+#define DICT_HASHED_BUCKETS(d) (d)->data.hashed.buckets
+#define DICT_HASHED_BUCKET(d, i) DICT_HASHED_BUCKETS (d)[i]
-#define DICT_HASHED_EXPANDABLE_NSYMS(d) (d)->data.hashed_expandable.nsyms
+#define DICT_HASHED_EXPANDABLE_NSYMS(d) (d)->data.hashed_expandable.nsyms
/* These can be used for DICT_LINEAR_EXPANDABLEs, too. */
-#define DICT_LINEAR_NSYMS(d) (d)->data.linear.nsyms
-#define DICT_LINEAR_SYMS(d) (d)->data.linear.syms
-#define DICT_LINEAR_SYM(d,i) DICT_LINEAR_SYMS (d) [i]
+#define DICT_LINEAR_NSYMS(d) (d)->data.linear.nsyms
+#define DICT_LINEAR_SYMS(d) (d)->data.linear.syms
+#define DICT_LINEAR_SYM(d, i) DICT_LINEAR_SYMS (d)[i]
-#define DICT_LINEAR_EXPANDABLE_CAPACITY(d) \
- (d)->data.linear_expandable.capacity
+#define DICT_LINEAR_EXPANDABLE_CAPACITY(d) (d)->data.linear_expandable.capacity
/* The initial size of a DICT_*_EXPANDABLE dictionary. */
@@ -207,20 +206,20 @@ struct dictionary
/* This calculates the number of buckets we'll use in a hashtable,
given the number of symbols that it will contain. */
-#define DICT_HASHTABLE_SIZE(n) ((n)/5 + 1)
+#define DICT_HASHTABLE_SIZE(n) ((n) / 5 + 1)
/* Accessor macros for dict_iterators; they're here rather than
dictionary.h because code elsewhere should treat dict_iterators as
opaque. */
/* The dictionary that the iterator is associated to. */
-#define DICT_ITERATOR_DICT(iter) (iter)->dict
+#define DICT_ITERATOR_DICT(iter) (iter)->dict
/* For linear dictionaries, the index of the last symbol returned; for
hashed dictionaries, the bucket of the last symbol returned. */
-#define DICT_ITERATOR_INDEX(iter) (iter)->index
+#define DICT_ITERATOR_INDEX(iter) (iter)->index
/* For hashed dictionaries, this points to the last symbol returned;
otherwise, this is unused. */
-#define DICT_ITERATOR_CURRENT(iter) (iter)->current
+#define DICT_ITERATOR_CURRENT(iter) (iter)->current
/* Declarations of functions for vectors. */
@@ -241,7 +240,7 @@ static struct symbol *iterator_next_hashed (struct dict_iterator *iterator);
static struct symbol *iter_match_first_hashed (const struct dictionary *dict,
const lookup_name_info &name,
- struct dict_iterator *iterator);
+ struct dict_iterator *iterator);
static struct symbol *iter_match_next_hashed (const lookup_name_info &name,
struct dict_iterator *iterator);
@@ -285,61 +284,56 @@ static void add_symbol_linear_expandable (struct dictionary *dict,
/* Various vectors that we'll actually use. */
-static const struct dict_vector dict_hashed_vector =
- {
- DICT_HASHED, /* type */
- free_obstack, /* free */
- add_symbol_nonexpandable, /* add_symbol */
- iterator_first_hashed, /* iterator_first */
- iterator_next_hashed, /* iterator_next */
- iter_match_first_hashed, /* iter_name_first */
- iter_match_next_hashed, /* iter_name_next */
- size_hashed, /* size */
- };
-
-static const struct dict_vector dict_hashed_expandable_vector =
- {
- DICT_HASHED_EXPANDABLE, /* type */
- free_hashed_expandable, /* free */
- add_symbol_hashed_expandable, /* add_symbol */
- iterator_first_hashed, /* iterator_first */
- iterator_next_hashed, /* iterator_next */
- iter_match_first_hashed, /* iter_name_first */
- iter_match_next_hashed, /* iter_name_next */
- size_hashed_expandable, /* size */
- };
-
-static const struct dict_vector dict_linear_vector =
- {
- DICT_LINEAR, /* type */
- free_obstack, /* free */
- add_symbol_nonexpandable, /* add_symbol */
- iterator_first_linear, /* iterator_first */
- iterator_next_linear, /* iterator_next */
- iter_match_first_linear, /* iter_name_first */
- iter_match_next_linear, /* iter_name_next */
- size_linear, /* size */
- };
-
-static const struct dict_vector dict_linear_expandable_vector =
- {
- DICT_LINEAR_EXPANDABLE, /* type */
- free_linear_expandable, /* free */
- add_symbol_linear_expandable, /* add_symbol */
- iterator_first_linear, /* iterator_first */
- iterator_next_linear, /* iterator_next */
- iter_match_first_linear, /* iter_name_first */
- iter_match_next_linear, /* iter_name_next */
- size_linear, /* size */
- };
+static const struct dict_vector dict_hashed_vector = {
+ DICT_HASHED, /* type */
+ free_obstack, /* free */
+ add_symbol_nonexpandable, /* add_symbol */
+ iterator_first_hashed, /* iterator_first */
+ iterator_next_hashed, /* iterator_next */
+ iter_match_first_hashed, /* iter_name_first */
+ iter_match_next_hashed, /* iter_name_next */
+ size_hashed, /* size */
+};
+
+static const struct dict_vector dict_hashed_expandable_vector = {
+ DICT_HASHED_EXPANDABLE, /* type */
+ free_hashed_expandable, /* free */
+ add_symbol_hashed_expandable, /* add_symbol */
+ iterator_first_hashed, /* iterator_first */
+ iterator_next_hashed, /* iterator_next */
+ iter_match_first_hashed, /* iter_name_first */
+ iter_match_next_hashed, /* iter_name_next */
+ size_hashed_expandable, /* size */
+};
+
+static const struct dict_vector dict_linear_vector = {
+ DICT_LINEAR, /* type */
+ free_obstack, /* free */
+ add_symbol_nonexpandable, /* add_symbol */
+ iterator_first_linear, /* iterator_first */
+ iterator_next_linear, /* iterator_next */
+ iter_match_first_linear, /* iter_name_first */
+ iter_match_next_linear, /* iter_name_next */
+ size_linear, /* size */
+};
+
+static const struct dict_vector dict_linear_expandable_vector = {
+ DICT_LINEAR_EXPANDABLE, /* type */
+ free_linear_expandable, /* free */
+ add_symbol_linear_expandable, /* add_symbol */
+ iterator_first_linear, /* iterator_first */
+ iterator_next_linear, /* iterator_next */
+ iter_match_first_linear, /* iter_name_first */
+ iter_match_next_linear, /* iter_name_next */
+ size_linear, /* size */
+};
/* Declarations of helper functions (i.e. ones that don't go into
vectors). */
static struct symbol *iterator_hashed_advance (struct dict_iterator *iter);
-static void insert_symbol_hashed (struct dictionary *dict,
- struct symbol *sym);
+static void insert_symbol_hashed (struct dictionary *dict, struct symbol *sym);
static void expand_hashtable (struct dictionary *dict);
@@ -348,8 +342,7 @@ static void expand_hashtable (struct dictionary *dict);
/* Create a hashed dictionary of a given language. */
static struct dictionary *
-dict_create_hashed (struct obstack *obstack,
- enum language language,
+dict_create_hashed (struct obstack *obstack, enum language language,
const std::vector<symbol *> &symbol_list)
{
/* Allocate the dictionary. */
@@ -382,8 +375,8 @@ dict_create_hashed_expandable (enum language language)
DICT_VECTOR (retval) = &dict_hashed_expandable_vector;
DICT_LANGUAGE (retval) = language_def (language);
DICT_HASHED_NBUCKETS (retval) = DICT_EXPANDABLE_INITIAL_CAPACITY;
- DICT_HASHED_BUCKETS (retval) = XCNEWVEC (struct symbol *,
- DICT_EXPANDABLE_INITIAL_CAPACITY);
+ DICT_HASHED_BUCKETS (retval)
+ = XCNEWVEC (struct symbol *, DICT_EXPANDABLE_INITIAL_CAPACITY);
DICT_HASHED_EXPANDABLE_NSYMS (retval) = 0;
return retval;
@@ -392,8 +385,7 @@ dict_create_hashed_expandable (enum language language)
/* Create a linear dictionary of a given language. */
static struct dictionary *
-dict_create_linear (struct obstack *obstack,
- enum language language,
+dict_create_linear (struct obstack *obstack, enum language language,
const std::vector<symbol *> &symbol_list)
{
struct dictionary *retval = XOBNEW (obstack, struct dictionary);
@@ -503,12 +495,11 @@ dict_size (const struct dictionary *dict)
{
return (DICT_VECTOR (dict))->size (dict);
}
-
+
/* Now come functions (well, one function, currently) that are
implemented generically by means of the vtable. Typically, they're
rarely used. */
-
/* The functions implementing the dictionary interface. */
/* Generic functions, where appropriate. */
@@ -522,7 +513,7 @@ free_obstack (struct dictionary *dict)
static void
add_symbol_nonexpandable (struct dictionary *dict, struct symbol *sym)
{
- internal_error (_("dict_add_symbol: non-expandable dictionary"));
+ internal_error (_ ("dict_add_symbol: non-expandable dictionary"));
}
/* Functions for DICT_HASHED and DICT_HASHED_EXPANDABLE. */
@@ -542,7 +533,7 @@ iterator_next_hashed (struct dict_iterator *iterator)
struct symbol *next;
next = DICT_ITERATOR_CURRENT (iterator)->hash_next;
-
+
if (next == NULL)
return iterator_hashed_advance (iterator);
else
@@ -562,7 +553,7 @@ iterator_hashed_advance (struct dict_iterator *iterator)
for (i = DICT_ITERATOR_INDEX (iterator) + 1; i < nbuckets; ++i)
{
struct symbol *sym = DICT_HASHED_BUCKET (dict, i);
-
+
if (sym != NULL)
{
DICT_ITERATOR_INDEX (iterator) = i;
@@ -591,9 +582,8 @@ iter_match_first_hashed (const struct dictionary *dict,
/* Loop through the symbols in the given bucket, breaking when SYM
first matches. If SYM never matches, it will be set to NULL;
either way, we have the right return value. */
-
- for (sym = DICT_HASHED_BUCKET (dict, hash_index);
- sym != NULL;
+
+ for (sym = DICT_HASHED_BUCKET (dict, hash_index); sym != NULL;
sym = sym->hash_next)
{
/* Warning: the order of arguments to compare matters! */
@@ -614,8 +604,7 @@ iter_match_next_hashed (const lookup_name_info &name,
= lang->get_symbol_name_matcher (name);
struct symbol *next;
- for (next = DICT_ITERATOR_CURRENT (iterator)->hash_next;
- next != NULL;
+ for (next = DICT_ITERATOR_CURRENT (iterator)->hash_next; next != NULL;
next = next->hash_next)
{
if (matches_name (next->search_name (), name, NULL))
@@ -630,8 +619,7 @@ iter_match_next_hashed (const lookup_name_info &name,
/* Insert SYM into DICT. */
static void
-insert_symbol_hashed (struct dictionary *dict,
- struct symbol *sym)
+insert_symbol_hashed (struct dictionary *dict, struct symbol *sym)
{
unsigned int hash_index;
unsigned int hash;
@@ -663,8 +651,7 @@ free_hashed_expandable (struct dictionary *dict)
}
static void
-add_symbol_hashed_expandable (struct dictionary *dict,
- struct symbol *sym)
+add_symbol_hashed_expandable (struct dictionary *dict, struct symbol *sym)
{
int nsyms = ++DICT_HASHED_EXPANDABLE_NSYMS (dict);
@@ -698,10 +685,9 @@ expand_hashtable (struct dictionary *dict)
struct symbol *sym, *next_sym;
sym = old_buckets[i];
- if (sym != NULL)
+ if (sym != NULL)
{
- for (next_sym = sym->hash_next;
- next_sym != NULL;
+ for (next_sym = sym->hash_next; next_sym != NULL;
next_sym = sym->hash_next)
{
insert_symbol_hashed (dict, sym);
@@ -851,7 +837,7 @@ iter_match_next_linear (const lookup_name_info &name,
}
DICT_ITERATOR_INDEX (iterator) = i;
-
+
return retval;
}
@@ -870,10 +856,8 @@ free_linear_expandable (struct dictionary *dict)
xfree (dict);
}
-
static void
-add_symbol_linear_expandable (struct dictionary *dict,
- struct symbol *sym)
+add_symbol_linear_expandable (struct dictionary *dict, struct symbol *sym)
{
int nsyms = ++DICT_LINEAR_NSYMS (dict);
@@ -910,16 +894,17 @@ struct multidictionary
namespace std
{
- template<> struct hash<enum language>
- {
- typedef enum language argument_type;
- typedef std::size_t result_type;
+template<>
+struct hash<enum language>
+{
+ typedef enum language argument_type;
+ typedef std::size_t result_type;
- result_type operator() (const argument_type &l) const noexcept
- {
- return static_cast<result_type> (l);
- }
- };
+ result_type operator() (const argument_type &l) const noexcept
+ {
+ return static_cast<result_type> (l);
+ }
+};
} /* namespace std */
/* A helper function to collate symbols on the pending list by language. */
@@ -929,8 +914,8 @@ collate_pending_symbols_by_language (const struct pending *symbol_list)
{
std::unordered_map<enum language, std::vector<symbol *>> nsyms;
- for (const pending *list_counter = symbol_list;
- list_counter != nullptr; list_counter = list_counter->next)
+ for (const pending *list_counter = symbol_list; list_counter != nullptr;
+ list_counter = list_counter->next)
{
for (int i = list_counter->nsyms - 1; i >= 0; --i)
{
@@ -948,8 +933,7 @@ struct multidictionary *
mdict_create_hashed (struct obstack *obstack,
const struct pending *symbol_list)
{
- struct multidictionary *retval
- = XOBNEW (obstack, struct multidictionary);
+ struct multidictionary *retval = XOBNEW (obstack, struct multidictionary);
std::unordered_map<enum language, std::vector<symbol *>> nsyms
= collate_pending_symbols_by_language (symbol_list);
@@ -993,8 +977,7 @@ struct multidictionary *
mdict_create_linear (struct obstack *obstack,
const struct pending *symbol_list)
{
- struct multidictionary *retval
- = XOBNEW (obstack, struct multidictionary);
+ struct multidictionary *retval = XOBNEW (obstack, struct multidictionary);
std::unordered_map<enum language, std::vector<symbol *>> nsyms
= collate_pending_symbols_by_language (symbol_list);
@@ -1093,8 +1076,8 @@ create_new_language_dictionary (struct multidictionary *mdict,
{
case DICT_HASHED:
case DICT_LINEAR:
- internal_error (_("create_new_language_dictionary: attempted to expand "
- "non-expandable multidictionary"));
+ internal_error (_ ("create_new_language_dictionary: attempted to expand "
+ "non-expandable multidictionary"));
case DICT_HASHED_EXPANDABLE:
retval = dict_create_hashed_expandable (language);
@@ -1120,8 +1103,7 @@ create_new_language_dictionary (struct multidictionary *mdict,
void
mdict_add_symbol (struct multidictionary *mdict, struct symbol *sym)
{
- struct dictionary *dict
- = find_language_dictionary (mdict, sym->language ());
+ struct dictionary *dict = find_language_dictionary (mdict, sym->language ());
if (dict == nullptr)
{
@@ -1199,9 +1181,8 @@ mdict_iterator_next (struct mdict_iterator *miterator)
for (unsigned short idx = ++miterator->current_idx;
idx < miterator->mdict->n_allocated_dictionaries; ++idx)
{
- result
- = dict_iterator_first (miterator->mdict->dictionaries[idx],
- &miterator->iterator);
+ result = dict_iterator_first (miterator->mdict->dictionaries[idx],
+ &miterator->iterator);
if (result != nullptr)
{
miterator->current_idx = idx;
@@ -1253,9 +1234,8 @@ mdict_iter_match_next (const lookup_name_info &name,
for (unsigned short idx = ++miterator->current_idx;
idx < miterator->mdict->n_allocated_dictionaries; ++idx)
{
- result
- = dict_iter_match_first (miterator->mdict->dictionaries[idx],
- name, &miterator->iterator);
+ result = dict_iter_match_first (miterator->mdict->dictionaries[idx],
+ name, &miterator->iterator);
if (result != nullptr)
{
miterator->current_idx = idx;
diff --git a/gdb/dictionary.h b/gdb/dictionary.h
index 9dc02c91e04..1d628fe4e06 100644
--- a/gdb/dictionary.h
+++ b/gdb/dictionary.h
@@ -45,8 +45,8 @@ struct language_defn;
OBSTACK; the environment is initialized from SYMBOL_LIST. */
extern struct multidictionary *
- mdict_create_hashed (struct obstack *obstack,
- const struct pending *symbol_list);
+mdict_create_hashed (struct obstack *obstack,
+ const struct pending *symbol_list);
/* Create a multi-language dictionary of symbols, implemented
via a hashtable that grows as necessary. The initial dictionary of
@@ -54,7 +54,7 @@ extern struct multidictionary *
Call mdict_free() when you're done with it. */
extern struct multidictionary *
- mdict_create_hashed_expandable (enum language language);
+mdict_create_hashed_expandable (enum language language);
/* Create a multi-language dictionary of symbols, implemented
via a fixed-size array. All memory it uses is allocated on
@@ -63,8 +63,8 @@ extern struct multidictionary *
SYMBOL_LIST. */
extern struct multidictionary *
- mdict_create_linear (struct obstack *obstack,
- const struct pending *symbol_list);
+mdict_create_linear (struct obstack *obstack,
+ const struct pending *symbol_list);
/* Create a multi-language dictionary of symbols, implemented
via an array that grows as necessary. The multidictionary initially
@@ -72,7 +72,7 @@ extern struct multidictionary *
call mdict_add_symbol(). Call mdict_free() when you're done with it. */
extern struct multidictionary *
- mdict_create_linear_expandable (enum language language);
+mdict_create_linear_expandable (enum language language);
/* The functions providing the interface to multi-language dictionaries.
Note that the most common parts of the interface, namely symbol lookup,
@@ -127,8 +127,8 @@ struct mdict_iterator
return that first symbol, or NULL if MDICT is empty. */
extern struct symbol *
- mdict_iterator_first (const struct multidictionary *mdict,
- struct mdict_iterator *miterator);
+mdict_iterator_first (const struct multidictionary *mdict,
+ struct mdict_iterator *miterator);
/* Advance MITERATOR, and return the next symbol, or NULL if there are
no more symbols. Don't call this if you've previously received
@@ -144,9 +144,9 @@ extern struct symbol *mdict_iterator_next (struct mdict_iterator *miterator);
if there are no such symbols. */
extern struct symbol *
- mdict_iter_match_first (const struct multidictionary *mdict,
- const lookup_name_info &name,
- struct mdict_iterator *miterator);
+mdict_iter_match_first (const struct multidictionary *mdict,
+ const lookup_name_info &name,
+ struct mdict_iterator *miterator);
/* Advance MITERATOR to point at the next symbol in MDICT whose
search_name () is NAME, as tested using COMPARE (see
@@ -171,9 +171,8 @@ extern int mdict_size (const struct multidictionary *mdict);
It's implemented as a single loop, so you can terminate the loop
early by a break if you desire. */
-#define ALL_DICT_SYMBOLS(dict, iter, sym) \
- for ((sym) = mdict_iterator_first ((dict), &(iter)); \
- (sym); \
- (sym) = mdict_iterator_next (&(iter)))
+#define ALL_DICT_SYMBOLS(dict, iter, sym) \
+ for ((sym) = mdict_iterator_first ((dict), &(iter)); (sym); \
+ (sym) = mdict_iterator_next (&(iter)))
#endif /* DICTIONARY_H */
diff --git a/gdb/disasm-flags.h b/gdb/disasm-flags.h
index e2e8a7a82e5..a57bd3a358f 100644
--- a/gdb/disasm-flags.h
+++ b/gdb/disasm-flags.h
@@ -25,17 +25,17 @@
/* Flags used to control how GDB's disassembler behaves. */
enum gdb_disassembly_flag : unsigned
- {
- DISASSEMBLY_SOURCE_DEPRECATED = (0x1 << 0),
- DISASSEMBLY_RAW_INSN = (0x1 << 1),
- DISASSEMBLY_OMIT_FNAME = (0x1 << 2),
- DISASSEMBLY_FILENAME = (0x1 << 3),
- DISASSEMBLY_OMIT_PC = (0x1 << 4),
- DISASSEMBLY_SOURCE = (0x1 << 5),
- DISASSEMBLY_SPECULATIVE = (0x1 << 6),
- DISASSEMBLY_RAW_BYTES = (0x1 << 7),
- };
+{
+ DISASSEMBLY_SOURCE_DEPRECATED = (0x1 << 0),
+ DISASSEMBLY_RAW_INSN = (0x1 << 1),
+ DISASSEMBLY_OMIT_FNAME = (0x1 << 2),
+ DISASSEMBLY_FILENAME = (0x1 << 3),
+ DISASSEMBLY_OMIT_PC = (0x1 << 4),
+ DISASSEMBLY_SOURCE = (0x1 << 5),
+ DISASSEMBLY_SPECULATIVE = (0x1 << 6),
+ DISASSEMBLY_RAW_BYTES = (0x1 << 7),
+};
+
DEF_ENUM_FLAGS_TYPE (enum gdb_disassembly_flag, gdb_disassembly_flags);
#endif /* DISASM_FLAGS_H */
-
diff --git a/gdb/disasm-selftests.c b/gdb/disasm-selftests.c
index 0cf766a48b7..c903a1558a8 100644
--- a/gdb/disasm-selftests.c
+++ b/gdb/disasm-selftests.c
@@ -23,7 +23,8 @@
#include "selftest-arch.h"
#include "gdbarch.h"
-namespace selftests {
+namespace selftests
+{
/* Return a pointer to a buffer containing an instruction that can be
disassembled for architecture GDBARCH. *LEN will be set to the length
@@ -43,14 +44,14 @@ get_test_insn (struct gdbarch *gdbarch, size_t *len)
{
case bfd_arch_bfin:
/* M3.L = 0xe117 */
- static const gdb_byte bfin_insn[] = {0x17, 0xe1, 0xff, 0xff};
+ static const gdb_byte bfin_insn[] = { 0x17, 0xe1, 0xff, 0xff };
insn = bfin_insn;
*len = sizeof (bfin_insn);
break;
case bfd_arch_arm:
/* mov r0, #0 */
- static const gdb_byte arm_insn[] = {0x0, 0x0, 0xa0, 0xe3};
+ static const gdb_byte arm_insn[] = { 0x0, 0x0, 0xa0, 0xe3 };
insn = arm_insn;
*len = sizeof (arm_insn);
@@ -81,14 +82,14 @@ get_test_insn (struct gdbarch *gdbarch, size_t *len)
goto generic_case;
case bfd_arch_s390:
/* nopr %r7 */
- static const gdb_byte s390_insn[] = {0x07, 0x07};
+ static const gdb_byte s390_insn[] = { 0x07, 0x07 };
insn = s390_insn;
*len = sizeof (s390_insn);
break;
case bfd_arch_xstormy16:
/* nop */
- static const gdb_byte xstormy16_insn[] = {0x0, 0x0};
+ static const gdb_byte xstormy16_insn[] = { 0x0, 0x0 };
insn = xstormy16_insn;
*len = sizeof (xstormy16_insn);
@@ -141,7 +142,7 @@ get_test_insn (struct gdbarch *gdbarch, size_t *len)
enum gdb_osabi it;
bool found = false;
for (it = GDB_OSABI_UNKNOWN; it != GDB_OSABI_INVALID;
- it = static_cast<enum gdb_osabi>(static_cast<int>(it) + 1))
+ it = static_cast<enum gdb_osabi> (static_cast<int> (it) + 1))
{
if (it == GDB_OSABI_UNKNOWN)
continue;
@@ -206,17 +207,16 @@ print_one_insn_test (struct gdbarch *gdbarch)
public:
explicit gdb_disassembler_test (struct gdbarch *gdbarch,
- const gdb_byte *insn,
- size_t len)
+ const gdb_byte *insn, size_t len)
: gdb_disassembler (gdbarch,
(run_verbose () ? gdb_stdlog : &null_stream),
gdb_disassembler_test::read_memory),
- m_insn (insn), m_len (len)
+ m_insn (insn),
+ m_len (len)
{
}
- int
- print_insn (CORE_ADDR memaddr)
+ int print_insn (CORE_ADDR memaddr)
{
int len = gdb_disassembler::print_insn (memaddr);
@@ -227,6 +227,7 @@ print_one_insn_test (struct gdbarch *gdbarch)
}
private:
+
/* A buffer contain one instruction. */
const gdb_byte *m_insn;
@@ -238,7 +239,7 @@ print_one_insn_test (struct gdbarch *gdbarch)
struct disassemble_info *info) noexcept
{
gdb_disassembler_test *self
- = static_cast<gdb_disassembler_test *>(info->application_data);
+ = static_cast<gdb_disassembler_test *> (info->application_data);
/* The disassembler in opcodes may read more data than one
instruction. Supply infinite consecutive copies
@@ -275,8 +276,8 @@ buffered_insn_length_test (struct gdbarch *gdbarch)
return;
CORE_ADDR insn_address = 0;
- int calculated_len = gdb_buffered_insn_length (gdbarch, insn, buf_len,
- insn_address);
+ int calculated_len
+ = gdb_buffered_insn_length (gdbarch, insn, buf_len, insn_address);
SELF_CHECK (calculated_len == buf_len);
}
@@ -289,6 +290,7 @@ memory_error_test (struct gdbarch *gdbarch)
class gdb_disassembler_test : public gdb_disassembler
{
public:
+
gdb_disassembler_test (struct gdbarch *gdbarch)
: gdb_disassembler (gdbarch, &null_stream,
gdb_disassembler_test::read_memory)
@@ -334,6 +336,7 @@ memory_error_test (struct gdbarch *gdbarch)
} // namespace selftests
void _initialize_disasm_selftests ();
+
void
_initialize_disasm_selftests ()
{
diff --git a/gdb/disasm.c b/gdb/disasm.c
index a0406377acc..4cc59899465 100644
--- a/gdb/disasm.c
+++ b/gdb/disasm.c
@@ -54,22 +54,22 @@ static bool use_libopcodes_styling_option = use_libopcodes_styling;
/* The "maint show libopcodes-styling enabled" command. */
static void
-show_use_libopcodes_styling (struct ui_file *file, int from_tty,
- struct cmd_list_element *c,
- const char *value)
+show_use_libopcodes_styling (struct ui_file *file, int from_tty,
+ struct cmd_list_element *c, const char *value)
{
gdb_non_printing_memory_disassembler dis (target_gdbarch ());
bool supported = dis.disasm_info ()->created_styled_output;
if (supported || !use_libopcodes_styling)
- gdb_printf (file, _("Use of libopcodes styling support is \"%s\".\n"),
+ gdb_printf (file, _ ("Use of libopcodes styling support is \"%s\".\n"),
value);
else
{
/* Use of libopcodes styling is not supported, and the user has this
turned on! */
- gdb_printf (file, _("Use of libopcodes styling support is \"off\""
- " (not supported on architecture \"%s\")\n"),
+ gdb_printf (file,
+ _ ("Use of libopcodes styling support is \"off\""
+ " (not supported on architecture \"%s\")\n"),
gdbarch_bfd_arch_info (target_gdbarch ())->printable_name);
}
}
@@ -91,8 +91,9 @@ set_use_libopcodes_styling (const char *args, int from_tty,
if (use_libopcodes_styling_option && !supported)
{
use_libopcodes_styling_option = use_libopcodes_styling;
- error (_("Use of libopcodes styling not supported on architecture \"%s\"."),
- gdbarch_bfd_arch_info (target_gdbarch ())->printable_name);
+ error (
+ _ ("Use of libopcodes styling not supported on architecture \"%s\"."),
+ gdbarch_bfd_arch_info (target_gdbarch ())->printable_name);
}
else
use_libopcodes_styling = use_libopcodes_styling_option;
@@ -140,8 +141,7 @@ eq_dis_line_entry (const void *item_lhs, const void *item_rhs)
const struct dis_line_entry *lhs = (const struct dis_line_entry *) item_lhs;
const struct dis_line_entry *rhs = (const struct dis_line_entry *) item_rhs;
- return (lhs->symtab == rhs->symtab
- && lhs->line == rhs->line);
+ return (lhs->symtab == rhs->symtab && lhs->line == rhs->line);
}
/* Create the table to manage lines for mixed source/disassembly. */
@@ -149,9 +149,8 @@ eq_dis_line_entry (const void *item_lhs, const void *item_rhs)
static htab_t
allocate_dis_line_table (void)
{
- return htab_create_alloc (41,
- hash_dis_line_entry, eq_dis_line_entry,
- xfree, xcalloc, xfree);
+ return htab_create_alloc (41, hash_dis_line_entry, eq_dis_line_entry, xfree,
+ xcalloc, xfree);
}
/* Add a new dis_line_entry containing SYMTAB and LINE to TABLE. */
@@ -189,9 +188,9 @@ line_has_code_p (htab_t table, struct symtab *symtab, int line)
/* Wrapper of target_read_code. */
int
-gdb_disassembler_memory_reader::dis_asm_read_memory
- (bfd_vma memaddr, gdb_byte *myaddr, unsigned int len,
- struct disassemble_info *info) noexcept
+gdb_disassembler_memory_reader::dis_asm_read_memory (
+ bfd_vma memaddr, gdb_byte *myaddr, unsigned int len,
+ struct disassemble_info *info) noexcept
{
return target_read_code (memaddr, myaddr, len);
}
@@ -199,11 +198,11 @@ gdb_disassembler_memory_reader::dis_asm_read_memory
/* Wrapper of memory_error. */
void
-gdb_disassembler::dis_asm_memory_error
- (int err, bfd_vma memaddr, struct disassemble_info *info) noexcept
+gdb_disassembler::dis_asm_memory_error (int err, bfd_vma memaddr,
+ struct disassemble_info *info) noexcept
{
gdb_disassembler *self
- = static_cast<gdb_disassembler *>(info->application_data);
+ = static_cast<gdb_disassembler *> (info->application_data);
self->m_err_memaddr.emplace (memaddr);
}
@@ -211,11 +210,11 @@ gdb_disassembler::dis_asm_memory_error
/* Wrapper of print_address. */
void
-gdb_disassembler::dis_asm_print_address
- (bfd_vma addr, struct disassemble_info *info) noexcept
+gdb_disassembler::dis_asm_print_address (
+ bfd_vma addr, struct disassemble_info *info) noexcept
{
gdb_disassembler *self
- = static_cast<gdb_disassembler *>(info->application_data);
+ = static_cast<gdb_disassembler *> (info->application_data);
if (self->in_comment_p ())
{
@@ -255,8 +254,8 @@ gdb_printing_disassembler::stream_from_gdb_disassemble_info (void *dis_info)
/* Format disassembler output to STREAM. */
int
-gdb_printing_disassembler::fprintf_func (void *dis_info,
- const char *format, ...) noexcept
+gdb_printing_disassembler::fprintf_func (void *dis_info, const char *format,
+ ...) noexcept
{
ui_file *stream = stream_from_gdb_disassemble_info (dis_info);
@@ -272,9 +271,10 @@ gdb_printing_disassembler::fprintf_func (void *dis_info,
/* See disasm.h. */
int
-gdb_printing_disassembler::fprintf_styled_func
- (void *dis_info, enum disassembler_style style,
- const char *format, ...) noexcept
+gdb_printing_disassembler::fprintf_styled_func (void *dis_info,
+ enum disassembler_style style,
+ const char *format,
+ ...) noexcept
{
ui_file *stream = stream_from_gdb_disassemble_info (dis_info);
gdb_printing_disassembler *dis = (gdb_printing_disassembler *) dis_info;
@@ -358,8 +358,8 @@ line_is_less_than (const deprecated_dis_line_entry &mle1,
/* See disasm.h. */
int
-gdb_pretty_print_disassembler::pretty_print_insn (const struct disasm_insn *insn,
- gdb_disassembly_flags flags)
+gdb_pretty_print_disassembler::pretty_print_insn (
+ const struct disasm_insn *insn, gdb_disassembly_flags flags)
{
/* parts of the symbolic representation of the address */
int unmapped;
@@ -367,6 +367,7 @@ gdb_pretty_print_disassembler::pretty_print_insn (const struct disasm_insn *insn
int line;
int size;
CORE_ADDR pc;
+
struct gdbarch *gdbarch = arch ();
{
@@ -428,8 +429,7 @@ gdb_pretty_print_disassembler::pretty_print_insn (const struct disasm_insn *insn
/* A helper function to write the M_INSN_STB buffer, followed by a
newline. This can be called in a couple of situations. */
- auto write_out_insn_buffer = [&] ()
- {
+ auto write_out_insn_buffer = [&] () {
m_uiout->field_stream ("inst", m_insn_stb);
m_uiout->text ("\n");
};
@@ -491,13 +491,15 @@ gdb_pretty_print_disassembler::pretty_print_insn (const struct disasm_insn *insn
if (di->display_endian == BFD_ENDIAN_LITTLE)
{
- for (int k = bytes_per_chunk; k-- != 0; )
- m_opcode_stb.printf ("%02x", (unsigned) m_opcode_data[i + k]);
+ for (int k = bytes_per_chunk; k-- != 0;)
+ m_opcode_stb.printf ("%02x",
+ (unsigned) m_opcode_data[i + k]);
}
else
{
for (int k = 0; k < bytes_per_chunk; k++)
- m_opcode_stb.printf ("%02x", (unsigned) m_opcode_data[i + k]);
+ m_opcode_stb.printf ("%02x",
+ (unsigned) m_opcode_data[i + k]);
}
}
@@ -523,9 +525,9 @@ gdb_pretty_print_disassembler::pretty_print_insn (const struct disasm_insn *insn
}
static int
-dump_insns (struct gdbarch *gdbarch,
- struct ui_out *uiout, CORE_ADDR low, CORE_ADDR high,
- int how_many, gdb_disassembly_flags flags, CORE_ADDR *end_pc)
+dump_insns (struct gdbarch *gdbarch, struct ui_out *uiout, CORE_ADDR low,
+ CORE_ADDR high, int how_many, gdb_disassembly_flags flags,
+ CORE_ADDR *end_pc)
{
struct disasm_insn insn;
int num_displayed = 0;
@@ -564,11 +566,11 @@ dump_insns (struct gdbarch *gdbarch,
N.B. This view is deprecated. */
static void
-do_mixed_source_and_assembly_deprecated
- (struct gdbarch *gdbarch, struct ui_out *uiout,
- struct symtab *symtab,
- CORE_ADDR low, CORE_ADDR high,
- int how_many, gdb_disassembly_flags flags)
+do_mixed_source_and_assembly_deprecated (struct gdbarch *gdbarch,
+ struct ui_out *uiout,
+ struct symtab *symtab, CORE_ADDR low,
+ CORE_ADDR high, int how_many,
+ gdb_disassembly_flags flags)
{
int newlines = 0;
int nlines;
@@ -598,14 +600,15 @@ do_mixed_source_and_assembly_deprecated
/* First, skip all the preceding functions. */
- for (i = 0; i < nlines - 1 && le[i].pc < low; i++);
+ for (i = 0; i < nlines - 1 && le[i].pc < low; i++)
+ ;
/* Now, copy all entries before the end of this function. */
for (; i < nlines - 1 && le[i].pc < high; i++)
{
if (le[i].line == le[i + 1].line && le[i].pc == le[i + 1].pc)
- continue; /* Ignore duplicates. */
+ continue; /* Ignore duplicates. */
/* Skip any end-of-function markers. */
if (le[i].line == 0)
@@ -656,7 +659,8 @@ do_mixed_source_and_assembly_deprecated
if (next_line == mle[i].line)
{
outer_tuple_emitter.emplace (uiout, "src_and_asm_line");
- print_source_lines (symtab, next_line, mle[i].line + 1, psl_flags);
+ print_source_lines (symtab, next_line, mle[i].line + 1,
+ psl_flags);
}
else
{
@@ -673,22 +677,23 @@ do_mixed_source_and_assembly_deprecated
/* Print the last line and leave list open for
asm instructions to be added. */
outer_tuple_emitter.emplace (uiout, "src_and_asm_line");
- print_source_lines (symtab, next_line, mle[i].line + 1, psl_flags);
+ print_source_lines (symtab, next_line, mle[i].line + 1,
+ psl_flags);
}
}
else
{
outer_tuple_emitter.emplace (uiout, "src_and_asm_line");
- print_source_lines (symtab, mle[i].line, mle[i].line + 1, psl_flags);
+ print_source_lines (symtab, mle[i].line, mle[i].line + 1,
+ psl_flags);
}
next_line = mle[i].line + 1;
inner_list_emitter.emplace (uiout, "line_asm_insn");
}
- num_displayed += dump_insns (gdbarch, uiout,
- mle[i].start_pc, mle[i].end_pc,
- how_many, flags, NULL);
+ num_displayed += dump_insns (gdbarch, uiout, mle[i].start_pc,
+ mle[i].end_pc, how_many, flags, NULL);
/* When we've reached the end of the mle array, or we've seen the last
assembly range for this source line, close out the list/tuple. */
@@ -709,11 +714,10 @@ do_mixed_source_and_assembly_deprecated
immediately following. */
static void
-do_mixed_source_and_assembly (struct gdbarch *gdbarch,
- struct ui_out *uiout,
- struct symtab *main_symtab,
- CORE_ADDR low, CORE_ADDR high,
- int how_many, gdb_disassembly_flags flags)
+do_mixed_source_and_assembly (struct gdbarch *gdbarch, struct ui_out *uiout,
+ struct symtab *main_symtab, CORE_ADDR low,
+ CORE_ADDR high, int how_many,
+ gdb_disassembly_flags flags)
{
const struct linetable_entry *le, *first_le;
int i, nlines;
@@ -816,9 +820,7 @@ do_mixed_source_and_assembly (struct gdbarch *gdbarch,
/* If this is the first line of output, check for any preceding
lines. */
- if (last_line == 0
- && first_le != NULL
- && first_le->line < sal.line)
+ if (last_line == 0 && first_le != NULL && first_le->line < sal.line)
{
start_preceding_line_to_display = first_le->line;
end_preceding_line_to_display = sal.line;
@@ -837,8 +839,8 @@ do_mixed_source_and_assembly (struct gdbarch *gdbarch,
not associated with code that we'll print later. */
for (l = sal.line - 1; l > last_line; --l)
{
- if (line_has_code_p (dis_line_table.get (),
- sal.symtab, l))
+ if (line_has_code_p (dis_line_table.get (), sal.symtab,
+ l))
break;
}
if (l < sal.line - 1)
@@ -868,8 +870,7 @@ do_mixed_source_and_assembly (struct gdbarch *gdbarch,
list_emitter.reset ();
tuple_emitter.reset ();
}
- if (sal.symtab != last_symtab
- && !(flags & DISASSEMBLY_FILENAME))
+ if (sal.symtab != last_symtab && !(flags & DISASSEMBLY_FILENAME))
{
/* Remember MI ignores ui_out_text.
We don't have to do anything here for MI because MI
@@ -891,8 +892,7 @@ do_mixed_source_and_assembly (struct gdbarch *gdbarch,
gdb_assert (sal.symtab != NULL);
for (l = start_preceding_line_to_display;
- l < end_preceding_line_to_display;
- ++l)
+ l < end_preceding_line_to_display; ++l)
{
ui_out_emit_tuple line_tuple_emitter (uiout,
"src_and_asm_line");
@@ -904,7 +904,7 @@ do_mixed_source_and_assembly (struct gdbarch *gdbarch,
if (sal.symtab != NULL)
print_source_lines (sal.symtab, sal.line, sal.line + 1, psl_flags);
else
- uiout->text (_("--- no source info for this pc ---\n"));
+ uiout->text (_ ("--- no source info for this pc ---\n"));
list_emitter.emplace (uiout, "line_asm_insn");
}
else
@@ -920,8 +920,8 @@ do_mixed_source_and_assembly (struct gdbarch *gdbarch,
end_pc = std::min (sal.end, high);
else
end_pc = pc + 1;
- num_displayed += dump_insns (gdbarch, uiout, pc, end_pc,
- how_many, flags, &end_pc);
+ num_displayed
+ += dump_insns (gdbarch, uiout, pc, end_pc, how_many, flags, &end_pc);
pc = end_pc;
if (how_many >= 0 && num_displayed >= how_many)
@@ -933,9 +933,8 @@ do_mixed_source_and_assembly (struct gdbarch *gdbarch,
}
static void
-do_assembly_only (struct gdbarch *gdbarch, struct ui_out *uiout,
- CORE_ADDR low, CORE_ADDR high,
- int how_many, gdb_disassembly_flags flags)
+do_assembly_only (struct gdbarch *gdbarch, struct ui_out *uiout, CORE_ADDR low,
+ CORE_ADDR high, int how_many, gdb_disassembly_flags flags)
{
ui_out_emit_list list_emitter (uiout, "asm_insns");
@@ -970,11 +969,12 @@ get_all_disassembler_options (struct gdbarch *gdbarch)
gdb_disassembler::gdb_disassembler (struct gdbarch *gdbarch,
struct ui_file *file,
read_memory_ftype func)
- : gdb_printing_disassembler (gdbarch, &m_buffer, func,
- dis_asm_memory_error, dis_asm_print_address),
+ : gdb_printing_disassembler (gdbarch, &m_buffer, func, dis_asm_memory_error,
+ dis_asm_print_address),
m_dest (file),
m_buffer (!use_ext_lang_for_styling () && use_libopcodes_for_styling ())
-{ /* Nothing. */ }
+{ /* Nothing. */
+}
/* See disasm.h. */
@@ -999,8 +999,7 @@ gdb_disassembler::use_ext_lang_for_styling () const
phase, then we will need to update this code. */
return (disassembler_styling
&& (!m_di.created_styled_output || !use_libopcodes_styling)
- && use_ext_lang_colorization_p
- && m_dest->can_emit_style_escape ());
+ && use_ext_lang_colorization_p && m_dest->can_emit_style_escape ());
}
/* See disasm.h. */
@@ -1010,20 +1009,17 @@ gdb_disassembler::use_libopcodes_for_styling () const
{
/* See the comment on the use of m_di.created_styled_output in the
gdb_disassembler::use_ext_lang_for_styling function. */
- return (disassembler_styling
- && m_di.created_styled_output
- && use_libopcodes_styling
- && m_dest->can_emit_style_escape ());
+ return (disassembler_styling && m_di.created_styled_output
+ && use_libopcodes_styling && m_dest->can_emit_style_escape ());
}
/* See disasm.h. */
-gdb_disassemble_info::gdb_disassemble_info
- (struct gdbarch *gdbarch,
- read_memory_ftype read_memory_func, memory_error_ftype memory_error_func,
- print_address_ftype print_address_func, fprintf_ftype fprintf_func,
- fprintf_styled_ftype fprintf_styled_func)
- : m_gdbarch (gdbarch)
+gdb_disassemble_info::gdb_disassemble_info (
+ struct gdbarch *gdbarch, read_memory_ftype read_memory_func,
+ memory_error_ftype memory_error_func, print_address_ftype print_address_func,
+ fprintf_ftype fprintf_func, fprintf_styled_ftype fprintf_styled_func)
+ : m_gdbarch (gdbarch)
{
gdb_assert (fprintf_func != nullptr);
gdb_assert (fprintf_styled_func != nullptr);
@@ -1091,8 +1087,7 @@ bool gdb_disassembler::use_ext_lang_colorization_p = true;
/* See disasm.h. */
int
-gdb_disassembler::print_insn (CORE_ADDR memaddr,
- int *branch_delay_insns)
+gdb_disassembler::print_insn (CORE_ADDR memaddr, int *branch_delay_insns)
{
m_err_memaddr.reset ();
m_buffer.clear ();
@@ -1131,8 +1126,8 @@ gdb_disassembler::print_insn (CORE_ADDR memaddr,
To do this we perform an in-place new, but this time turn on
the styling support, then we can re-disassembly the
instruction, and gain any minimal styling GDB might add. */
- gdb_static_assert ((std::is_same<decltype (m_buffer),
- string_file>::value));
+ gdb_static_assert (
+ (std::is_same<decltype (m_buffer), string_file>::value));
gdb_assert (!m_buffer.term_out ());
m_buffer.~string_file ();
new (&m_buffer) string_file (use_libopcodes_for_styling ());
@@ -1152,7 +1147,7 @@ gdb_disassembler::print_insn (CORE_ADDR memaddr,
if (m_err_memaddr.has_value ())
memory_error (TARGET_XFER_E_IO, *m_err_memaddr);
else
- error (_("unknown disassembler error (error = %d)"), length);
+ error (_ ("unknown disassembler error (error = %d)"), length);
}
if (branch_delay_insns != NULL)
@@ -1167,8 +1162,8 @@ gdb_disassembler::print_insn (CORE_ADDR memaddr,
void
gdb_disassembly (struct gdbarch *gdbarch, struct ui_out *uiout,
- gdb_disassembly_flags flags, int how_many,
- CORE_ADDR low, CORE_ADDR high)
+ gdb_disassembly_flags flags, int how_many, CORE_ADDR low,
+ CORE_ADDR high)
{
struct symtab *symtab;
int nlines = -1;
@@ -1184,12 +1179,12 @@ gdb_disassembly (struct gdbarch *gdbarch, struct ui_out *uiout,
do_assembly_only (gdbarch, uiout, low, high, how_many, flags);
else if (flags & DISASSEMBLY_SOURCE)
- do_mixed_source_and_assembly (gdbarch, uiout, symtab, low, high,
- how_many, flags);
+ do_mixed_source_and_assembly (gdbarch, uiout, symtab, low, high, how_many,
+ flags);
else if (flags & DISASSEMBLY_SOURCE_DEPRECATED)
- do_mixed_source_and_assembly_deprecated (gdbarch, uiout, symtab,
- low, high, how_many, flags);
+ do_mixed_source_and_assembly_deprecated (gdbarch, uiout, symtab, low, high,
+ how_many, flags);
gdb_flush (gdb_stdout);
}
@@ -1202,7 +1197,6 @@ int
gdb_print_insn (struct gdbarch *gdbarch, CORE_ADDR memaddr,
struct ui_file *stream, int *branch_delay_insns)
{
-
gdb_disassembler di (gdbarch, stream);
return di.print_insn (memaddr, branch_delay_insns);
@@ -1220,8 +1214,9 @@ gdb_insn_length (struct gdbarch *gdbarch, CORE_ADDR addr)
/* See disasm.h. */
int
-gdb_non_printing_disassembler::null_fprintf_func
- (void *stream, const char *format, ...) noexcept
+gdb_non_printing_disassembler::null_fprintf_func (void *stream,
+ const char *format,
+ ...) noexcept
{
return 0;
}
@@ -1229,9 +1224,9 @@ gdb_non_printing_disassembler::null_fprintf_func
/* See disasm.h. */
int
-gdb_non_printing_disassembler::null_fprintf_styled_func
- (void *stream, enum disassembler_style style,
- const char *format, ...) noexcept
+gdb_non_printing_disassembler::null_fprintf_styled_func (
+ void *stream, enum disassembler_style style, const char *format,
+ ...) noexcept
{
return 0;
}
@@ -1263,8 +1258,8 @@ struct gdb_non_printing_buffer_disassembler
buffer containing INSN. */
int
-gdb_buffered_insn_length (struct gdbarch *gdbarch,
- const gdb_byte *insn, int max_len, CORE_ADDR addr)
+gdb_buffered_insn_length (struct gdbarch *gdbarch, const gdb_byte *insn,
+ int max_len, CORE_ADDR addr)
{
gdb::array_view<const gdb_byte> buffer
= gdb::make_array_view (insn, max_len);
@@ -1291,8 +1286,8 @@ set_disassembler_options (const char *prospective_options)
const disasm_options_t *valid_options;
gdb::unique_xmalloc_ptr<char> prospective_options_local
= make_unique_xstrdup (prospective_options);
- char *options = remove_whitespace_and_extra_commas
- (prospective_options_local.get ());
+ char *options
+ = remove_whitespace_and_extra_commas (prospective_options_local.get ());
const char *opt;
/* Allow all architectures, even ones that do not support 'set disassembler',
@@ -1310,7 +1305,7 @@ set_disassembler_options (const char *prospective_options)
valid_options_and_args = gdbarch_valid_disassembler_options (gdbarch);
if (valid_options_and_args == NULL)
{
- gdb_printf (gdb_stderr, _("\
+ gdb_printf (gdb_stderr, _ ("\
'set disassembler-options ...' is not supported on this architecture.\n"));
return;
}
@@ -1319,41 +1314,41 @@ set_disassembler_options (const char *prospective_options)
/* Verify we have valid disassembler options. */
FOR_EACH_DISASSEMBLER_OPTION (opt, options)
- {
- size_t i;
- for (i = 0; valid_options->name[i] != NULL; i++)
- if (valid_options->arg != NULL && valid_options->arg[i] != NULL)
- {
- size_t len = strlen (valid_options->name[i]);
- bool found = false;
- const char *arg;
- size_t j;
-
- if (memcmp (opt, valid_options->name[i], len) != 0)
- continue;
- arg = opt + len;
- if (valid_options->arg[i]->values == NULL)
- break;
- for (j = 0; valid_options->arg[i]->values[j] != NULL; j++)
- if (disassembler_options_cmp
- (arg, valid_options->arg[i]->values[j]) == 0)
- {
- found = true;
- break;
- }
- if (found)
- break;
- }
- else if (disassembler_options_cmp (opt, valid_options->name[i]) == 0)
- break;
- if (valid_options->name[i] == NULL)
+ {
+ size_t i;
+ for (i = 0; valid_options->name[i] != NULL; i++)
+ if (valid_options->arg != NULL && valid_options->arg[i] != NULL)
{
- gdb_printf (gdb_stderr,
- _("Invalid disassembler option value: '%s'.\n"),
- opt);
- return;
+ size_t len = strlen (valid_options->name[i]);
+ bool found = false;
+ const char *arg;
+ size_t j;
+
+ if (memcmp (opt, valid_options->name[i], len) != 0)
+ continue;
+ arg = opt + len;
+ if (valid_options->arg[i]->values == NULL)
+ break;
+ for (j = 0; valid_options->arg[i]->values[j] != NULL; j++)
+ if (disassembler_options_cmp (arg,
+ valid_options->arg[i]->values[j])
+ == 0)
+ {
+ found = true;
+ break;
+ }
+ if (found)
+ break;
}
- }
+ else if (disassembler_options_cmp (opt, valid_options->name[i]) == 0)
+ break;
+ if (valid_options->name[i] == NULL)
+ {
+ gdb_printf (gdb_stderr,
+ _ ("Invalid disassembler option value: '%s'.\n"), opt);
+ return;
+ }
+ }
free (*disassembler_options);
*disassembler_options = xstrdup (options);
@@ -1379,22 +1374,22 @@ show_disassembler_options_sfunc (struct ui_file *file, int from_tty,
if (options == NULL)
options = "";
- gdb_printf (file, _("The current disassembler options are '%s'\n\n"),
+ gdb_printf (file, _ ("The current disassembler options are '%s'\n\n"),
options);
valid_options_and_args = gdbarch_valid_disassembler_options (gdbarch);
if (valid_options_and_args == NULL)
{
- gdb_puts (_("There are no disassembler options available "
- "for this architecture.\n"),
+ gdb_puts (_ ("There are no disassembler options available "
+ "for this architecture.\n"),
file);
return;
}
valid_options = &valid_options_and_args->options;
- gdb_printf (file, _("\
+ gdb_printf (file, _ ("\
The following disassembler options are supported for use with the\n\
'set disassembler-options OPTION [,OPTION]...' command:\n"));
@@ -1457,7 +1452,7 @@ The following disassembler options are supported for use with the\n\
{
if (valid_args[i].values == NULL)
continue;
- gdb_printf (file, _("\n\
+ gdb_printf (file, _ ("\n\
For the options above, the following values are supported for \"%s\":\n "),
valid_args[i].name);
for (j = 0; valid_args[i].values[j] != NULL; j++)
@@ -1474,8 +1469,8 @@ The following disassembler options are supported for use with the\n\
static void
disassembler_options_completer (struct cmd_list_element *ignore,
- completion_tracker &tracker,
- const char *text, const char *word)
+ completion_tracker &tracker, const char *text,
+ const char *word)
{
struct gdbarch *gdbarch = get_current_arch ();
const disasm_options_and_args_t *opts_and_args
@@ -1494,45 +1489,46 @@ disassembler_options_completer (struct cmd_list_element *ignore,
}
}
-
/* Initialization code. */
void _initialize_disasm ();
+
void
_initialize_disasm ()
{
/* Add the command that controls the disassembler options. */
set_show_commands set_show_disas_opts
= add_setshow_string_noescape_cmd ("disassembler-options", no_class,
- &prospective_options, _("\
+ &prospective_options, _ ("\
Set the disassembler options.\n\
Usage: set disassembler-options OPTION [,OPTION]...\n\n\
-See: 'show disassembler-options' for valid option values."), _("\
-Show the disassembler options."), NULL,
- set_disassembler_options_sfunc,
- show_disassembler_options_sfunc,
- &setlist, &showlist);
+See: 'show disassembler-options' for valid option values."),
+ _ ("\
+Show the disassembler options."),
+ NULL, set_disassembler_options_sfunc,
+ show_disassembler_options_sfunc,
+ &setlist, &showlist);
set_cmd_completer (set_show_disas_opts.set, disassembler_options_completer);
-
/* All the 'maint set|show libopcodes-styling' sub-commands. */
static struct cmd_list_element *maint_set_libopcodes_styling_cmdlist;
static struct cmd_list_element *maint_show_libopcodes_styling_cmdlist;
/* Adds 'maint set|show libopcodes-styling'. */
add_setshow_prefix_cmd ("libopcodes-styling", class_maintenance,
- _("Set libopcodes-styling specific variables."),
- _("Show libopcodes-styling specific variables."),
+ _ ("Set libopcodes-styling specific variables."),
+ _ ("Show libopcodes-styling specific variables."),
&maint_set_libopcodes_styling_cmdlist,
&maint_show_libopcodes_styling_cmdlist,
- &maintenance_set_cmdlist,
- &maintenance_show_cmdlist);
+ &maintenance_set_cmdlist, &maintenance_show_cmdlist);
/* Adds 'maint set|show gnu-source-highlight enabled'. */
add_setshow_boolean_cmd ("enabled", class_maintenance,
- &use_libopcodes_styling_option, _("\
-Set whether the libopcodes styling support should be used."), _("\
-Show whether the libopcodes styling support should be used."),_("\
+ &use_libopcodes_styling_option, _ ("\
+Set whether the libopcodes styling support should be used."),
+ _ ("\
+Show whether the libopcodes styling support should be used."),
+ _ ("\
When enabled, GDB will try to make use of the builtin libopcodes styling\n\
support, to style the disassembler output. Not every architecture has\n\
styling support within libopcodes, so enabling this is not a guarantee\n\
diff --git a/gdb/disasm.h b/gdb/disasm.h
index 02d94081077..5b7838a034f 100644
--- a/gdb/disasm.h
+++ b/gdb/disasm.h
@@ -47,13 +47,11 @@ struct gdb_disassemble_info
DISABLE_COPY_AND_ASSIGN (gdb_disassemble_info);
/* Return the gdbarch we are disassembling for. */
- struct gdbarch *arch ()
- { return m_gdbarch; }
+ struct gdbarch *arch () { return m_gdbarch; }
/* Return a pointer to the disassemble_info, this will be needed for
passing into the libopcodes disassembler. */
- struct disassemble_info *disasm_info ()
- { return &m_di; }
+ struct disassemble_info *disasm_info () { return &m_di; }
protected:
@@ -65,20 +63,19 @@ protected:
will become relevant when you switch to C++17, and this warning
causes the build to fail. */
using read_memory_ftype
- = int (*) (bfd_vma, bfd_byte *, unsigned int, struct disassemble_info *)
- LIBOPCODE_CALLBACK_NOEXCEPT;
+ = int (*) (bfd_vma, bfd_byte *, unsigned int,
+ struct disassemble_info *) LIBOPCODE_CALLBACK_NOEXCEPT;
using memory_error_ftype
- = void (*) (int, bfd_vma, struct disassemble_info *)
- LIBOPCODE_CALLBACK_NOEXCEPT;
+ = void (*) (int, bfd_vma,
+ struct disassemble_info *) LIBOPCODE_CALLBACK_NOEXCEPT;
using print_address_ftype
- = void (*) (bfd_vma, struct disassemble_info *)
- LIBOPCODE_CALLBACK_NOEXCEPT;
+ = void (*) (bfd_vma,
+ struct disassemble_info *) LIBOPCODE_CALLBACK_NOEXCEPT;
using fprintf_ftype
- = int (*) (void *, const char *, ...)
- LIBOPCODE_CALLBACK_NOEXCEPT;
+ = int (*) (void *, const char *, ...) LIBOPCODE_CALLBACK_NOEXCEPT;
using fprintf_styled_ftype
- = int (*) (void *, enum disassembler_style, const char *, ...)
- LIBOPCODE_CALLBACK_NOEXCEPT;
+ = int (*) (void *, enum disassembler_style, const char *,
+ ...) LIBOPCODE_CALLBACK_NOEXCEPT;
/* Constructor, many fields in m_di are initialized from GDBARCH. The
remaining arguments are function callbacks that are written into m_di.
@@ -102,6 +99,7 @@ protected:
struct disassemble_info m_di;
private:
+
/* The architecture we are disassembling for. */
struct gdbarch *m_gdbarch;
@@ -124,8 +122,7 @@ struct gdb_printing_disassembler : public gdb_disassemble_info
DISABLE_COPY_AND_ASSIGN (gdb_printing_disassembler);
/* The stream that disassembler output is being written too. */
- struct ui_file *stream ()
- { return m_stream; }
+ struct ui_file *stream () { return m_stream; }
protected:
@@ -133,14 +130,13 @@ protected:
We also add the two print functions to the arguments passed to the
parent. See gdb_disassemble_info for a description of how the
arguments are handled. */
- gdb_printing_disassembler (struct gdbarch *gdbarch,
- struct ui_file *stream,
+ gdb_printing_disassembler (struct gdbarch *gdbarch, struct ui_file *stream,
read_memory_ftype read_memory_func,
memory_error_ftype memory_error_func,
print_address_ftype print_address_func)
- : gdb_disassemble_info (gdbarch, read_memory_func,
- memory_error_func, print_address_func,
- fprintf_func, fprintf_styled_func),
+ : gdb_disassemble_info (gdbarch, read_memory_func, memory_error_func,
+ print_address_func, fprintf_func,
+ fprintf_styled_func),
m_stream (stream)
{
gdb_assert (stream != nullptr);
@@ -150,7 +146,7 @@ protected:
DIS_INFO pointer is a pointer to a gdb_printing_disassembler object.
Content is written to the m_stream extracted from DIS_INFO. */
static int fprintf_func (void *dis_info, const char *format, ...) noexcept
- ATTRIBUTE_PRINTF(2,3);
+ ATTRIBUTE_PRINTF (2, 3);
/* Callback used as the disassemble_info's fprintf_styled_func callback.
The DIS_INFO pointer is a pointer to a gdb_printing_disassembler
@@ -158,17 +154,15 @@ protected:
static int fprintf_styled_func (void *dis_info,
enum disassembler_style style,
const char *format, ...) noexcept
- ATTRIBUTE_PRINTF(3,4);
+ ATTRIBUTE_PRINTF (3, 4);
/* Return true if the disassembler is considered inside a comment, false
otherwise. */
- bool in_comment_p () const
- { return m_in_comment; }
+ bool in_comment_p () const { return m_in_comment; }
/* Set whether the disassembler should be considered as within comment
text or not. */
- void set_in_comment (bool c)
- { m_in_comment = c; }
+ void set_in_comment (bool c) { m_in_comment = c; }
private:
@@ -197,27 +191,26 @@ struct gdb_non_printing_disassembler : public gdb_disassemble_info
{
gdb_non_printing_disassembler (struct gdbarch *gdbarch,
read_memory_ftype read_memory_func)
- : gdb_disassemble_info (gdbarch,
- read_memory_func,
+ : gdb_disassemble_info (gdbarch, read_memory_func,
nullptr /* memory_error_func */,
nullptr /* print_address_func */,
- null_fprintf_func,
- null_fprintf_styled_func)
- { /* Nothing. */ }
+ null_fprintf_func, null_fprintf_styled_func)
+ { /* Nothing. */
+ }
private:
/* Callback used as the disassemble_info's fprintf_func callback, this
doesn't write anything to STREAM, but just returns 0. */
static int null_fprintf_func (void *stream, const char *format, ...) noexcept
- ATTRIBUTE_PRINTF(2,3);
+ ATTRIBUTE_PRINTF (2, 3);
/* Callback used as the disassemble_info's fprintf_styled_func callback,
, this doesn't write anything to STREAM, but just returns 0. */
static int null_fprintf_styled_func (void *stream,
enum disassembler_style style,
const char *format, ...) noexcept
- ATTRIBUTE_PRINTF(3,4);
+ ATTRIBUTE_PRINTF (3, 4);
};
/* This is a helper class, for use as an additional base-class, by some of
@@ -244,8 +237,9 @@ struct gdb_non_printing_memory_disassembler
{
/* Constructor. GDBARCH is the architecture to disassemble for. */
gdb_non_printing_memory_disassembler (struct gdbarch *gdbarch)
- :gdb_non_printing_disassembler (gdbarch, dis_asm_read_memory)
- { /* Nothing. */ }
+ : gdb_non_printing_disassembler (gdbarch, dis_asm_read_memory)
+ { /* Nothing. */
+ }
};
/* A dissassembler class that provides 'print_insn', a method for
@@ -256,7 +250,8 @@ struct gdb_disassembler : public gdb_printing_disassembler,
{
gdb_disassembler (struct gdbarch *gdbarch, struct ui_file *file)
: gdb_disassembler (gdbarch, file, dis_asm_read_memory)
- { /* Nothing. */ }
+ { /* Nothing. */
+ }
DISABLE_COPY_AND_ASSIGN (gdb_disassembler);
@@ -266,10 +261,12 @@ struct gdb_disassembler : public gdb_printing_disassembler,
int print_insn (CORE_ADDR memaddr, int *branch_delay_insns = NULL);
protected:
+
gdb_disassembler (struct gdbarch *gdbarch, struct ui_file *file,
read_memory_ftype func);
private:
+
/* This member variable is given a value by calling dis_asm_memory_error.
If after calling into the libopcodes disassembler we get back a
negative value (which indicates an error), then, if this variable has
@@ -334,7 +331,7 @@ struct disasm_insn
unsigned int number;
/* True if the instruction was executed speculatively. */
- unsigned int is_speculative:1;
+ unsigned int is_speculative : 1;
};
extern void gdb_disassembly (struct gdbarch *gdbarch, struct ui_out *uiout,
@@ -353,12 +350,14 @@ extern int gdb_print_insn (struct gdbarch *gdbarch, CORE_ADDR memaddr,
class gdb_pretty_print_disassembler
{
public:
+
explicit gdb_pretty_print_disassembler (struct gdbarch *gdbarch,
struct ui_out *uiout)
: m_uiout (uiout),
m_insn_stb (uiout->can_emit_style_escape ()),
m_di (gdbarch, &m_insn_stb)
- {}
+ {
+ }
/* Prints the instruction INSN into the saved ui_out and returns the
length of the printed instruction in bytes. */
@@ -366,6 +365,7 @@ public:
gdb_disassembly_flags flags);
private:
+
/* Returns the architecture used for disassembling. */
struct gdbarch *arch () { return m_di.arch (); }
diff --git a/gdb/displaced-stepping.c b/gdb/displaced-stepping.c
index 06b32a80f6a..dce9726ff34 100644
--- a/gdb/displaced-stepping.c
+++ b/gdb/displaced-stepping.c
@@ -40,7 +40,7 @@ static void
show_debug_displaced (struct ui_file *file, int from_tty,
struct cmd_list_element *c, const char *value)
{
- gdb_printf (file, _("Displace stepping debugging is %s.\n"), value);
+ gdb_printf (file, _ ("Displace stepping debugging is %s.\n"), value);
}
displaced_step_prepare_status
@@ -112,18 +112,17 @@ displaced_step_buffers::prepare (thread_info *thread, CORE_ADDR &displaced_pc)
/* Save the original contents of the displaced stepping buffer. */
buffer->saved_copy.resize (len);
- int status = target_read_memory (buffer->addr,
- buffer->saved_copy.data (), len);
+ int status
+ = target_read_memory (buffer->addr, buffer->saved_copy.data (), len);
if (status != 0)
throw_error (MEMORY_ERROR,
- _("Error accessing memory address %s (%s) for "
- "displaced-stepping scratch space."),
+ _ ("Error accessing memory address %s (%s) for "
+ "displaced-stepping scratch space."),
paddress (arch, buffer->addr), safe_strerror (status));
- displaced_debug_printf ("saved %s: %s",
- paddress (arch, buffer->addr),
- displaced_step_dump_bytes
- (buffer->saved_copy.data (), len).c_str ());
+ displaced_debug_printf (
+ "saved %s: %s", paddress (arch, buffer->addr),
+ displaced_step_dump_bytes (buffer->saved_copy.data (), len).c_str ());
/* Save this in a local variable first, so it's released if code below
throws. */
@@ -148,12 +147,10 @@ displaced_step_buffers::prepare (thread_info *thread, CORE_ADDR &displaced_pc)
/* Reset the displaced step buffer state if we failed to write PC.
Otherwise we will prevent this buffer from being used, as it will
always have a thread in buffer->current_thread. */
- auto reset_buffer = make_scope_exit
- ([buffer] ()
- {
- buffer->current_thread = nullptr;
- buffer->copy_insn_closure.reset ();
- });
+ auto reset_buffer = make_scope_exit ([buffer] () {
+ buffer->current_thread = nullptr;
+ buffer->copy_insn_closure.reset ();
+ });
/* Adjust the PC so it points to the displaced step buffer address that will
be used. This needs to be done after we save the copy_insn_closure, as
@@ -182,8 +179,8 @@ displaced_step_buffers::prepare (thread_info *thread, CORE_ADDR &displaced_pc)
}
static void
-write_memory_ptid (ptid_t ptid, CORE_ADDR memaddr,
- const gdb_byte *myaddr, int len)
+write_memory_ptid (ptid_t ptid, CORE_ADDR memaddr, const gdb_byte *myaddr,
+ int len)
{
scoped_restore save_inferior_ptid = make_scoped_restore (&inferior_ptid);
@@ -246,11 +243,10 @@ displaced_step_buffers::finish (gdbarch *arch, thread_info *thread,
ULONGEST len = gdbarch_max_insn_length (arch);
/* Restore memory of the buffer. */
- write_memory_ptid (thread->ptid, buffer->addr,
- buffer->saved_copy.data (), len);
+ write_memory_ptid (thread->ptid, buffer->addr, buffer->saved_copy.data (),
+ len);
- displaced_debug_printf ("restored %s %s",
- thread->ptid.to_string ().c_str (),
+ displaced_debug_printf ("restored %s %s", thread->ptid.to_string ().c_str (),
paddress (arch, buffer->addr));
regcache *rc = get_thread_regcache (thread);
@@ -261,8 +257,7 @@ displaced_step_buffers::finish (gdbarch *arch, thread_info *thread,
if (instruction_executed_successfully)
{
gdbarch_displaced_step_fixup (arch, copy_insn_closure.get (),
- buffer->original_pc,
- buffer->addr, rc);
+ buffer->original_pc, buffer->addr, rc);
return DISPLACED_STEP_FINISH_STATUS_OK;
}
else
@@ -282,11 +277,11 @@ displaced_step_buffers::copy_insn_closure_by_addr (CORE_ADDR addr)
for (const displaced_step_buffer &buffer : m_buffers)
{
if (addr == buffer.addr)
- {
- /* The closure information should always be available. */
- gdb_assert (buffer.copy_insn_closure.get () != nullptr);
- return buffer.copy_insn_closure.get ();
- }
+ {
+ /* The closure information should always be available. */
+ gdb_assert (buffer.copy_insn_closure.get () != nullptr);
+ return buffer.copy_insn_closure.get ();
+ }
}
return nullptr;
@@ -313,15 +308,17 @@ displaced_step_buffers::restore_in_ptid (ptid_t ptid)
}
void _initialize_displaced_stepping ();
+
void
_initialize_displaced_stepping ()
{
- add_setshow_boolean_cmd ("displaced", class_maintenance,
- &debug_displaced, _("\
-Set displaced stepping debugging."), _("\
-Show displaced stepping debugging."), _("\
+ add_setshow_boolean_cmd ("displaced", class_maintenance, &debug_displaced,
+ _ ("\
+Set displaced stepping debugging."),
+ _ ("\
+Show displaced stepping debugging."),
+ _ ("\
When non-zero, displaced stepping specific debugging is enabled."),
- NULL,
- show_debug_displaced,
- &setdebuglist, &showdebuglist);
+ NULL, show_debug_displaced, &setdebuglist,
+ &showdebuglist);
}
diff --git a/gdb/displaced-stepping.h b/gdb/displaced-stepping.h
index e154927ad92..ccbf39bb6bb 100644
--- a/gdb/displaced-stepping.h
+++ b/gdb/displaced-stepping.h
@@ -33,7 +33,7 @@ extern bool debug_displaced;
/* Print a "displaced" debug statement. */
#define displaced_debug_printf(fmt, ...) \
- debug_prefixed_printf_cond (debug_displaced, "displaced",fmt, ##__VA_ARGS__)
+ debug_prefixed_printf_cond (debug_displaced, "displaced", fmt, ##__VA_ARGS__)
enum displaced_step_prepare_status
{
@@ -75,8 +75,9 @@ using displaced_step_copy_insn_closure_up
struct buf_displaced_step_copy_insn_closure : displaced_step_copy_insn_closure
{
buf_displaced_step_copy_insn_closure (int buf_size)
- : buf (buf_size)
- {}
+ : buf (buf_size)
+ {
+ }
/* The content of this buffer is up to the user of the class, but typically
original instruction bytes, used during fixup to determine what needs to
@@ -88,10 +89,7 @@ struct buf_displaced_step_copy_insn_closure : displaced_step_copy_insn_closure
struct displaced_step_inferior_state
{
- displaced_step_inferior_state ()
- {
- reset ();
- }
+ displaced_step_inferior_state () { reset (); }
/* Put this object back in its original state. */
void reset ()
@@ -120,16 +118,10 @@ struct displaced_step_inferior_state
struct displaced_step_thread_state
{
/* Return true if this thread is currently executing a displaced step. */
- bool in_progress () const
- {
- return m_original_gdbarch != nullptr;
- }
+ bool in_progress () const { return m_original_gdbarch != nullptr; }
/* Return the gdbarch of the thread prior to the step. */
- gdbarch *get_original_gdbarch () const
- {
- return m_original_gdbarch;
- }
+ gdbarch *get_original_gdbarch () const { return m_original_gdbarch; }
/* Mark this thread as currently executing a displaced step.
@@ -141,12 +133,10 @@ struct displaced_step_thread_state
}
/* Mark this thread as no longer executing a displaced step. */
- void reset ()
- {
- m_original_gdbarch = nullptr;
- }
+ void reset () { m_original_gdbarch = nullptr; }
private:
+
gdbarch *m_original_gdbarch = nullptr;
};
@@ -171,7 +161,7 @@ struct displaced_step_buffers
gdb_signal sig);
const displaced_step_copy_insn_closure *
- copy_insn_closure_by_addr (CORE_ADDR addr);
+ copy_insn_closure_by_addr (CORE_ADDR addr);
void restore_in_ptid (ptid_t ptid);
@@ -183,7 +173,8 @@ private:
{
explicit displaced_step_buffer (CORE_ADDR addr)
: addr (addr)
- {}
+ {
+ }
/* Address of the buffer. */
const CORE_ADDR addr;
diff --git a/gdb/dtrace-probe.c b/gdb/dtrace-probe.c
index 9805b8a8e78..9cbfe63c39b 100644
--- a/gdb/dtrace-probe.c
+++ b/gdb/dtrace-probe.c
@@ -38,7 +38,7 @@
with information about probes. */
#ifndef SHT_SUNW_dof
-# define SHT_SUNW_dof 0x6ffffff4
+#define SHT_SUNW_dof 0x6ffffff4
#endif
/* The following structure represents a single argument for the
@@ -48,9 +48,11 @@ struct dtrace_probe_arg
{
dtrace_probe_arg (struct type *type_, std::string &&type_str_,
expression_up &&expr_)
- : type (type_), type_str (std::move (type_str_)),
+ : type (type_),
+ type_str (std::move (type_str_)),
expr (std::move (expr_))
- {}
+ {
+ }
/* The type of the probe argument. */
struct type *type;
@@ -77,6 +79,7 @@ struct dtrace_probe_enabler
class dtrace_static_probe_ops : public static_probe_ops
{
public:
+
/* See probe.h. */
bool is_linespec (const char **linespecp) const override;
@@ -88,14 +91,11 @@ public:
const char *type_name () const override;
/* See probe.h. */
- bool can_enable () const override
- {
- return true;
- }
+ bool can_enable () const override { return true; }
/* See probe.h. */
- std::vector<struct info_probe_column> gen_info_probes_table_header
- () const override;
+ std::vector<struct info_probe_column>
+ gen_info_probes_table_header () const override;
};
/* DTrace static_probe_ops. */
@@ -107,16 +107,18 @@ const dtrace_static_probe_ops dtrace_static_probe_ops {};
class dtrace_probe : public probe
{
public:
+
/* Constructor for dtrace_probe. */
- dtrace_probe (std::string &&name_, std::string &&provider_, CORE_ADDR address_,
- struct gdbarch *arch_,
+ dtrace_probe (std::string &&name_, std::string &&provider_,
+ CORE_ADDR address_, struct gdbarch *arch_,
std::vector<struct dtrace_probe_arg> &&args_,
std::vector<struct dtrace_probe_enabler> &&enablers_)
: probe (std::move (name_), std::move (provider_), address_, arch_),
m_args (std::move (args_)),
m_enablers (std::move (enablers_)),
m_args_expr_built (false)
- {}
+ {
+ }
/* See probe.h. */
CORE_ADDR get_relocated_address (struct objfile *objfile) override;
@@ -128,12 +130,10 @@ public:
bool can_evaluate_arguments () const override;
/* See probe.h. */
- struct value *evaluate_argument (unsigned n,
- frame_info_ptr frame) override;
+ struct value *evaluate_argument (unsigned n, frame_info_ptr frame) override;
/* See probe.h. */
- void compile_to_ax (struct agent_expr *aexpr,
- struct axs_value *axs_value,
+ void compile_to_ax (struct agent_expr *aexpr, struct axs_value *axs_value,
unsigned n) override;
/* See probe.h. */
@@ -162,6 +162,7 @@ public:
bool is_enabled () const;
private:
+
/* A probe can have zero or more arguments. */
std::vector<struct dtrace_probe_arg> m_args;
@@ -241,21 +242,21 @@ struct dtrace_dof_hdr
/* Identification bytes (see above). */
uint8_t dofh_ident[16];
/* File attribute flags (if any). */
- uint32_t dofh_flags;
+ uint32_t dofh_flags;
/* Size of file header in bytes. */
- uint32_t dofh_hdrsize;
+ uint32_t dofh_hdrsize;
/* Size of section header in bytes. */
- uint32_t dofh_secsize;
+ uint32_t dofh_secsize;
/* Number of section headers. */
- uint32_t dofh_secnum;
+ uint32_t dofh_secnum;
/* File offset of section headers. */
- uint64_t dofh_secoff;
+ uint64_t dofh_secoff;
/* File size of loadable portion. */
- uint64_t dofh_loadsz;
+ uint64_t dofh_loadsz;
/* File size of entire DOF file. */
- uint64_t dofh_filesz;
+ uint64_t dofh_filesz;
/* Reserved for future use. */
- uint64_t dofh_pad;
+ uint64_t dofh_pad;
};
/* A DOF section, whose contents depend on its type. The several
@@ -267,15 +268,15 @@ struct dtrace_dof_sect
/* Section type (see the define above). */
uint32_t dofs_type;
/* Section data memory alignment. */
- uint32_t dofs_align;
+ uint32_t dofs_align;
/* Section flags (if any). */
- uint32_t dofs_flags;
+ uint32_t dofs_flags;
/* Size of section entry (if table). */
uint32_t dofs_entsize;
/* DOF + offset points to the section data. */
uint64_t dofs_offset;
/* Size of section data in bytes. */
- uint64_t dofs_size;
+ uint64_t dofs_size;
};
/* A DOF provider, which is the provider of a probe. */
@@ -283,19 +284,19 @@ struct dtrace_dof_sect
struct dtrace_dof_provider
{
/* Link to a DTRACE_DOF_SECT_TYPE_STRTAB section. */
- uint32_t dofpv_strtab;
+ uint32_t dofpv_strtab;
/* Link to a DTRACE_DOF_SECT_TYPE_PROBES section. */
- uint32_t dofpv_probes;
+ uint32_t dofpv_probes;
/* Link to a DTRACE_DOF_SECT_TYPE_PRARGS section. */
- uint32_t dofpv_prargs;
+ uint32_t dofpv_prargs;
/* Link to a DTRACE_DOF_SECT_TYPE_PROFFS section. */
- uint32_t dofpv_proffs;
+ uint32_t dofpv_proffs;
/* Provider name string. */
- uint32_t dofpv_name;
+ uint32_t dofpv_name;
/* Provider attributes. */
uint32_t dofpv_provattr;
/* Module attributes. */
- uint32_t dofpv_modattr;
+ uint32_t dofpv_modattr;
/* Function attributes. */
uint32_t dofpv_funcattr;
/* Name attributes. */
@@ -315,33 +316,33 @@ struct dtrace_dof_provider
struct dtrace_dof_probe
{
/* Probe base address or offset. */
- uint64_t dofpr_addr;
+ uint64_t dofpr_addr;
/* Probe function string. */
- uint32_t dofpr_func;
+ uint32_t dofpr_func;
/* Probe name string. */
- uint32_t dofpr_name;
+ uint32_t dofpr_name;
/* Native argument type strings. */
- uint32_t dofpr_nargv;
+ uint32_t dofpr_nargv;
/* Translated argument type strings. */
- uint32_t dofpr_xargv;
+ uint32_t dofpr_xargv;
/* Index of first argument mapping. */
- uint32_t dofpr_argidx;
+ uint32_t dofpr_argidx;
/* Index of first offset entry. */
- uint32_t dofpr_offidx;
+ uint32_t dofpr_offidx;
/* Native argument count. */
- uint8_t dofpr_nargc;
+ uint8_t dofpr_nargc;
/* Translated argument count. */
- uint8_t dofpr_xargc;
+ uint8_t dofpr_xargc;
/* Number of offset entries for probe. */
- uint16_t dofpr_noffs;
+ uint16_t dofpr_noffs;
/* Index of first is-enabled offset. */
uint32_t dofpr_enoffidx;
/* Number of is-enabled offsets. */
uint16_t dofpr_nenoffs;
/* Reserved for future use. */
- uint16_t dofpr_pad1;
+ uint16_t dofpr_pad1;
/* Reserved for future use. */
- uint32_t dofpr_pad2;
+ uint32_t dofpr_pad2;
};
/* DOF supports two different encodings: MSB (big-endian) and LSB
@@ -349,12 +350,12 @@ struct dtrace_dof_probe
The following function returns an unsigned value in the host
endianness. */
-#define DOF_UINT(dof, field) \
- extract_unsigned_integer ((gdb_byte *) &(field), \
- sizeof ((field)), \
+#define DOF_UINT(dof, field) \
+ extract_unsigned_integer ((gdb_byte *) &(field), sizeof ((field)), \
(((dof)->dofh_ident[DTRACE_DOF_ID_ENCODING] \
- == DTRACE_DOF_ENCODE_MSB) \
- ? BFD_ENDIAN_BIG : BFD_ENDIAN_LITTLE))
+ == DTRACE_DOF_ENCODE_MSB) \
+ ? BFD_ENDIAN_BIG \
+ : BFD_ENDIAN_LITTLE))
/* The following macro applies a given byte offset to a DOF (a pointer
to a dtrace_dof_hdr structure) and returns the resulting
@@ -366,11 +367,10 @@ struct dtrace_dof_probe
section in a DOF object. The section is referred to by its index
in the sections array. */
-#define DTRACE_DOF_SECT(dof, idx) \
- ((struct dtrace_dof_sect *) \
- DTRACE_DOF_PTR ((dof), \
- DOF_UINT ((dof), (dof)->dofh_secoff) \
- + ((idx) * DOF_UINT ((dof), (dof)->dofh_secsize))))
+#define DTRACE_DOF_SECT(dof, idx) \
+ ((struct dtrace_dof_sect *) DTRACE_DOF_PTR ( \
+ (dof), DOF_UINT ((dof), (dof)->dofh_secoff) \
+ + ((idx) *DOF_UINT ((dof), (dof)->dofh_secsize))))
/* Helper function to examine the probe described by the given PROBE
and PROVIDER data structures and add it to the PROBESP vector.
@@ -378,14 +378,13 @@ struct dtrace_dof_probe
DOF program containing the attributes for the probe. */
static void
-dtrace_process_dof_probe (struct objfile *objfile,
- struct gdbarch *gdbarch,
+dtrace_process_dof_probe (struct objfile *objfile, struct gdbarch *gdbarch,
std::vector<std::unique_ptr<probe>> *probesp,
struct dtrace_dof_hdr *dof,
struct dtrace_dof_probe *probe,
- struct dtrace_dof_provider *provider,
- char *strtab, char *offtab, char *eofftab,
- char *argtab, uint64_t strtab_size)
+ struct dtrace_dof_provider *provider, char *strtab,
+ char *offtab, char *eofftab, char *argtab,
+ uint64_t strtab_size)
{
int i, j, num_probes, num_enablers;
char *p;
@@ -440,8 +439,8 @@ dtrace_process_dof_probe (struct objfile *objfile,
uint32_t enabler_offset
= ((uint32_t *) eofftab)[DOF_UINT (dof, probe->dofpr_enoffidx) + i];
- enabler.address = DOF_UINT (dof, probe->dofpr_addr)
- + DOF_UINT (dof, enabler_offset);
+ enabler.address
+ = DOF_UINT (dof, probe->dofpr_addr) + DOF_UINT (dof, enabler_offset);
enablers.push_back (enabler);
}
@@ -500,11 +499,10 @@ dtrace_process_dof_probe (struct objfile *objfile,
}
std::vector<struct dtrace_probe_enabler> enablers_copy = enablers;
- dtrace_probe *ret = new dtrace_probe (std::string (name),
- std::string (probe_provider),
- address, gdbarch,
- std::move (args),
- std::move (enablers_copy));
+ dtrace_probe *ret
+ = new dtrace_probe (std::string (name), std::string (probe_provider),
+ address, gdbarch, std::move (args),
+ std::move (enablers_copy));
/* Successfully created probe. */
probesp->emplace_back (ret);
@@ -542,8 +540,8 @@ dtrace_process_dof (asection *sect, struct objfile *objfile,
/* Make sure this DOF is not an enabling DOF, i.e. there are no ECB
Description sections. */
- section = (struct dtrace_dof_sect *) DTRACE_DOF_PTR (dof,
- DOF_UINT (dof, dof->dofh_secoff));
+ section = (struct dtrace_dof_sect *)
+ DTRACE_DOF_PTR (dof, DOF_UINT (dof, dof->dofh_secoff));
for (i = 0; i < DOF_UINT (dof, dof->dofh_secnum); i++, section++)
if (section->dofs_type == DTRACE_DOF_SECT_TYPE_ECBDESC)
return;
@@ -551,8 +549,8 @@ dtrace_process_dof (asection *sect, struct objfile *objfile,
/* Iterate over any section of type Provider and extract the probe
information from them. If there are no "provider" sections on
the DOF then we just return. */
- section = (struct dtrace_dof_sect *) DTRACE_DOF_PTR (dof,
- DOF_UINT (dof, dof->dofh_secoff));
+ section = (struct dtrace_dof_sect *)
+ DTRACE_DOF_PTR (dof, DOF_UINT (dof, dof->dofh_secoff));
for (i = 0; i < DOF_UINT (dof, dof->dofh_secnum); i++, section++)
if (DOF_UINT (dof, section->dofs_type) == DTRACE_DOF_SECT_TYPE_PROVIDER)
{
@@ -568,10 +566,14 @@ dtrace_process_dof (asection *sect, struct objfile *objfile,
= DTRACE_DOF_SECT (dof, DOF_UINT (dof, provider->dofpv_proffs));
struct dtrace_dof_sect *eoffsets_s
= DTRACE_DOF_SECT (dof, DOF_UINT (dof, provider->dofpv_prenoffs));
- char *strtab = DTRACE_DOF_PTR (dof, DOF_UINT (dof, strtab_s->dofs_offset));
- char *offtab = DTRACE_DOF_PTR (dof, DOF_UINT (dof, offsets_s->dofs_offset));
- char *eofftab = DTRACE_DOF_PTR (dof, DOF_UINT (dof, eoffsets_s->dofs_offset));
- char *argtab = DTRACE_DOF_PTR (dof, DOF_UINT (dof, args_s->dofs_offset));
+ char *strtab
+ = DTRACE_DOF_PTR (dof, DOF_UINT (dof, strtab_s->dofs_offset));
+ char *offtab
+ = DTRACE_DOF_PTR (dof, DOF_UINT (dof, offsets_s->dofs_offset));
+ char *eofftab
+ = DTRACE_DOF_PTR (dof, DOF_UINT (dof, eoffsets_s->dofs_offset));
+ char *argtab
+ = DTRACE_DOF_PTR (dof, DOF_UINT (dof, args_s->dofs_offset));
unsigned int entsize = DOF_UINT (dof, probes_s->dofs_entsize);
int num_probes;
@@ -592,23 +594,24 @@ dtrace_process_dof (asection *sect, struct objfile *objfile,
for (i = 0; i < num_probes; i++)
{
- struct dtrace_dof_probe *probe = (struct dtrace_dof_probe *)
- DTRACE_DOF_PTR (dof, DOF_UINT (dof, probes_s->dofs_offset)
- + (i * DOF_UINT (dof, probes_s->dofs_entsize)));
-
- dtrace_process_dof_probe (objfile,
- gdbarch, probesp,
- dof, probe,
- provider, strtab, offtab, eofftab, argtab,
+ struct dtrace_dof_probe *probe
+ = (struct dtrace_dof_probe *) DTRACE_DOF_PTR (
+ dof, DOF_UINT (dof, probes_s->dofs_offset)
+ + (i * DOF_UINT (dof, probes_s->dofs_entsize)));
+
+ dtrace_process_dof_probe (objfile, gdbarch, probesp, dof, probe,
+ provider, strtab, offtab, eofftab,
+ argtab,
DOF_UINT (dof, strtab_s->dofs_size));
}
}
return;
-
- invalid_dof_data:
- complaint (_("skipping section '%s' which does not contain valid DOF data."),
- sect->name);
+
+invalid_dof_data:
+ complaint (
+ _ ("skipping section '%s' which does not contain valid DOF data."),
+ sect->name);
}
/* Implementation of 'build_arg_exprs' method. */
@@ -630,8 +633,8 @@ dtrace_probe::build_arg_exprs (struct gdbarch *gdbarch)
/* The argument value, which is ABI dependent and casted to
`long int'. */
- expr::operation_up op = gdbarch_dtrace_parse_probe_argument (gdbarch,
- argc);
+ expr::operation_up op
+ = gdbarch_dtrace_parse_probe_argument (gdbarch, argc);
/* Casting to the expected type, but only if the type was
recognized at probe load time. Otherwise the argument will
@@ -655,11 +658,10 @@ dtrace_probe::get_arg_by_number (unsigned n, struct gdbarch *gdbarch)
this->build_arg_exprs (gdbarch);
if (n > m_args.size ())
- internal_error (_("Probe '%s' has %d arguments, but GDB is requesting\n"
- "argument %u. This should not happen. Please\n"
- "report this bug."),
- this->get_name ().c_str (),
- (int) m_args.size (), n);
+ internal_error (_ ("Probe '%s' has %d arguments, but GDB is requesting\n"
+ "argument %u. This should not happen. Please\n"
+ "report this bug."),
+ this->get_name ().c_str (), (int) m_args.size (), n);
return &m_args[n];
}
@@ -707,8 +709,7 @@ dtrace_probe::can_evaluate_arguments () const
/* Implementation of the evaluate_argument method. */
struct value *
-dtrace_probe::evaluate_argument (unsigned n,
- frame_info_ptr frame)
+dtrace_probe::evaluate_argument (unsigned n, frame_info_ptr frame)
{
struct gdbarch *gdbarch = this->get_gdbarch ();
struct dtrace_probe_arg *arg;
@@ -769,7 +770,7 @@ dtrace_probe::enable ()
/* Enabling a dtrace probe implies patching the text section of the
running process, so make sure the inferior is indeed running. */
if (inferior_ptid == null_ptid)
- error (_("No inferior running"));
+ error (_ ("No inferior running"));
/* Fast path. */
if (this->is_enabled ())
@@ -782,7 +783,6 @@ dtrace_probe::enable ()
gdbarch_dtrace_enable_probe (gdbarch, enabler.address);
}
-
/* Implementation of the disable_probe method. */
void
@@ -793,7 +793,7 @@ dtrace_probe::disable ()
/* Disabling a dtrace probe implies patching the text section of the
running process, so make sure the inferior is indeed running. */
if (inferior_ptid == null_ptid)
- error (_("No inferior running"));
+ error (_ ("No inferior running"));
/* Fast path. */
if (!this->is_enabled ())
@@ -802,7 +802,7 @@ dtrace_probe::disable ()
/* Are we trying to disable a probe that does not have any enabler
associated? */
if (m_enablers.empty ())
- error (_("Probe %s:%s cannot be disabled: no enablers."),
+ error (_ ("Probe %s:%s cannot be disabled: no enablers."),
this->get_provider ().c_str (), this->get_name ().c_str ());
/* Iterate over all defined enabler in the given probe and disable
@@ -825,9 +825,8 @@ dtrace_static_probe_ops::is_linespec (const char **linespecp) const
/* Implementation of the get_probes method. */
void
-dtrace_static_probe_ops::get_probes
- (std::vector<std::unique_ptr<probe>> *probesp,
- struct objfile *objfile) const
+dtrace_static_probe_ops::get_probes (
+ std::vector<std::unique_ptr<probe>> *probesp, struct objfile *objfile) const
{
bfd *abfd = objfile->obfd.get ();
asection *sect = NULL;
@@ -851,8 +850,8 @@ dtrace_static_probe_ops::get_probes
dtrace_process_dof (sect, objfile, probesp,
(struct dtrace_dof_hdr *) dof);
else
- complaint (_("could not obtain the contents of"
- "section '%s' in objfile `%s'."),
+ complaint (_ ("could not obtain the contents of"
+ "section '%s' in objfile `%s'."),
bfd_section_name (sect), bfd_get_filename (abfd));
xfree (dof);
@@ -876,7 +875,7 @@ dtrace_static_probe_ops::gen_info_probes_table_header () const
struct info_probe_column dtrace_probe_column;
dtrace_probe_column.field_name = "enabled";
- dtrace_probe_column.print_name = _("Enabled");
+ dtrace_probe_column.print_name = _ ("Enabled");
return std::vector<struct info_probe_column> { dtrace_probe_column };
}
@@ -890,13 +889,13 @@ info_probes_dtrace_command (const char *arg, int from_tty)
}
void _initialize_dtrace_probe ();
+
void
_initialize_dtrace_probe ()
{
all_static_probe_ops.push_back (&dtrace_static_probe_ops);
- add_cmd ("dtrace", class_info, info_probes_dtrace_command,
- _("\
+ add_cmd ("dtrace", class_info, info_probes_dtrace_command, _ ("\
Show information about DTrace static probes.\n\
Usage: info probes dtrace [PROVIDER [NAME [OBJECT]]]\n\
Each argument is a regular expression, used to select probes.\n\
diff --git a/gdb/dummy-frame.c b/gdb/dummy-frame.c
index 784ac103eec..33c66394b94 100644
--- a/gdb/dummy-frame.c
+++ b/gdb/dummy-frame.c
@@ -17,7 +17,6 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
-
#include "defs.h"
#include "dummy-frame.h"
#include "regcache.h"
@@ -44,8 +43,7 @@ struct dummy_frame_id
/* Return whether dummy_frame_id *ID1 and *ID2 are equal. */
static int
-dummy_frame_id_eq (struct dummy_frame_id *id1,
- struct dummy_frame_id *id2)
+dummy_frame_id_eq (struct dummy_frame_id *id1, struct dummy_frame_id *id2)
{
return id1->id == id2->id && id1->thread == id2->thread;
}
@@ -129,8 +127,8 @@ remove_dummy_frame (struct dummy_frame **dummy_ptr)
static bool
pop_dummy_frame_bpt (struct breakpoint *b, struct dummy_frame *dummy)
{
- if (b->thread == dummy->id.thread->global_num
- && b->disposition == disp_del && b->frame_id == dummy->id.id)
+ if (b->thread == dummy->id.thread->global_num && b->disposition == disp_del
+ && b->frame_id == dummy->id.id)
{
while (b->related_breakpoint != b)
delete_breakpoint (b->related_breakpoint);
@@ -288,8 +286,7 @@ struct dummy_frame_cache
static int
dummy_frame_sniffer (const struct frame_unwind *self,
- frame_info_ptr this_frame,
- void **this_prologue_cache)
+ frame_info_ptr this_frame, void **this_prologue_cache)
{
/* When unwinding a normal frame, the stack structure is determined
by analyzing the frame's function's code (be it using brute force
@@ -298,7 +295,7 @@ dummy_frame_sniffer (const struct frame_unwind *self,
entry point, or some random address on the stack. Trying to use
that PC to apply standard frame ID unwind techniques is just
asking for trouble. */
-
+
/* Don't bother unless there is at least one dummy frame. */
if (dummy_frame_stack != NULL)
{
@@ -310,8 +307,7 @@ dummy_frame_sniffer (const struct frame_unwind *self,
struct dummy_frame_id dummy_id = { this_id, inferior_thread () };
/* Use that ID to find the corresponding cache entry. */
- for (dummyframe = dummy_frame_stack;
- dummyframe != NULL;
+ for (dummyframe = dummy_frame_stack; dummyframe != NULL;
dummyframe = dummyframe->next)
{
if (dummy_frame_id_eq (&dummyframe->id, &dummy_id))
@@ -319,8 +315,8 @@ dummy_frame_sniffer (const struct frame_unwind *self,
struct dummy_frame_cache *cache;
cache = FRAME_OBSTACK_ZALLOC (struct dummy_frame_cache);
- cache->prev_regcache = get_infcall_suspend_state_regcache
- (dummyframe->caller_state);
+ cache->prev_regcache = get_infcall_suspend_state_regcache (
+ dummyframe->caller_state);
cache->this_id = this_id;
(*this_prologue_cache) = cache;
return 1;
@@ -335,8 +331,7 @@ dummy_frame_sniffer (const struct frame_unwind *self,
static struct value *
dummy_frame_prev_register (frame_info_ptr this_frame,
- void **this_prologue_cache,
- int regnum)
+ void **this_prologue_cache, int regnum)
{
struct dummy_frame_cache *cache
= (struct dummy_frame_cache *) *this_prologue_cache;
@@ -353,8 +348,8 @@ dummy_frame_prev_register (frame_info_ptr this_frame,
/* Use the regcache_cooked_read() method so that it, on the fly,
constructs either a raw or pseudo register from the raw
register cache. */
- cache->prev_regcache->cooked_read
- (regnum, value_contents_writeable (reg_val).data ());
+ cache->prev_regcache->cooked_read (
+ regnum, value_contents_writeable (reg_val).data ());
return reg_val;
}
@@ -364,8 +359,7 @@ dummy_frame_prev_register (frame_info_ptr this_frame,
dummy cache is located and saved in THIS_PROLOGUE_CACHE. */
static void
-dummy_frame_this_id (frame_info_ptr this_frame,
- void **this_prologue_cache,
+dummy_frame_this_id (frame_info_ptr this_frame, void **this_prologue_cache,
struct frame_id *this_id)
{
/* The dummy-frame sniffer always fills in the cache. */
@@ -376,8 +370,7 @@ dummy_frame_this_id (frame_info_ptr this_frame,
(*this_id) = cache->this_id;
}
-const struct frame_unwind dummy_frame_unwind =
-{
+const struct frame_unwind dummy_frame_unwind = {
"dummy",
DUMMY_FRAME,
default_frame_unwind_stop_reason,
@@ -405,8 +398,7 @@ fprint_dummy_frames (struct ui_file *file)
struct dummy_frame *s;
for (s = dummy_frame_stack; s != NULL; s = s->next)
- gdb_printf (file, "%s: id=%s, ptid=%s\n",
- host_address_to_string (s),
+ gdb_printf (file, "%s: id=%s, ptid=%s\n", host_address_to_string (s),
s->id.id.to_string ().c_str (),
s->id.thread->ptid.to_string ().c_str ());
}
@@ -421,18 +413,20 @@ maintenance_print_dummy_frames (const char *args, int from_tty)
stdio_file file;
if (!file.open (args, "w"))
- perror_with_name (_("maintenance print dummy-frames"));
+ perror_with_name (_ ("maintenance print dummy-frames"));
fprint_dummy_frames (&file);
}
}
void _initialize_dummy_frame ();
+
void
_initialize_dummy_frame ()
{
add_cmd ("dummy-frames", class_maintenance, maintenance_print_dummy_frames,
- _("Print the contents of the internal dummy-frame stack."),
+ _ ("Print the contents of the internal dummy-frame stack."),
&maintenanceprintlist);
- gdb::observers::inferior_created.attach (cleanup_dummy_frames, "dummy-frame");
+ gdb::observers::inferior_created.attach (cleanup_dummy_frames,
+ "dummy-frame");
}
diff --git a/gdb/dummy-frame.h b/gdb/dummy-frame.h
index 3123aa1b452..b24bf942b04 100644
--- a/gdb/dummy-frame.h
+++ b/gdb/dummy-frame.h
@@ -17,7 +17,7 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
-#if !defined (DUMMY_FRAME_H)
+#if !defined(DUMMY_FRAME_H)
#define DUMMY_FRAME_H 1
#include "frame.h"
@@ -35,8 +35,7 @@ class thread_info;
frame's code. */
extern void dummy_frame_push (infcall_suspend_state *caller_state,
- const frame_id *dummy_id,
- thread_info *thread);
+ const frame_id *dummy_id, thread_info *thread);
/* Pop the dummy frame DUMMY_ID, restoring program state to that before the
frame was created.
@@ -64,8 +63,7 @@ typedef void (dummy_frame_dtor_ftype) (void *data, int registers_valid);
discarded. Dummy frame with DUMMY_ID must exist. Multiple
destructors may be registered, they will be called in the reverse
order of registrations (LIFO). */
-extern void register_dummy_frame_dtor (frame_id dummy_id,
- thread_info *thread,
+extern void register_dummy_frame_dtor (frame_id dummy_id, thread_info *thread,
dummy_frame_dtor_ftype *dtor,
void *dtor_data);
diff --git a/gdb/dwarf2/abbrev-cache.c b/gdb/dwarf2/abbrev-cache.c
index 6de81cd8075..73df4d7a380 100644
--- a/gdb/dwarf2/abbrev-cache.c
+++ b/gdb/dwarf2/abbrev-cache.c
@@ -43,8 +43,8 @@ abbrev_cache::eq_table (const void *lhs, const void *rhs)
abbrev_cache::abbrev_cache ()
: m_tables (htab_create_alloc (20, hash_table, eq_table,
- htab_delete_entry<abbrev_table>,
- xcalloc, xfree))
+ htab_delete_entry<abbrev_table>, xcalloc,
+ xfree))
{
}
@@ -56,9 +56,9 @@ abbrev_cache::add (abbrev_table_up table)
return;
search_key key = { table->section, table->sect_off };
- void **slot = htab_find_slot_with_hash (m_tables.get (), &key,
- to_underlying (table->sect_off),
- INSERT);
+ void **slot
+ = htab_find_slot_with_hash (m_tables.get (), &key,
+ to_underlying (table->sect_off), INSERT);
/* If this one already existed, then it should have been reused. */
gdb_assert (*slot == nullptr);
*slot = (void *) table.release ();
diff --git a/gdb/dwarf2/abbrev-cache.h b/gdb/dwarf2/abbrev-cache.h
index d9406534c5d..41979820ac2 100644
--- a/gdb/dwarf2/abbrev-cache.h
+++ b/gdb/dwarf2/abbrev-cache.h
@@ -26,6 +26,7 @@
class abbrev_cache
{
public:
+
abbrev_cache ();
DISABLE_COPY_AND_ASSIGN (abbrev_cache);
diff --git a/gdb/dwarf2/abbrev.c b/gdb/dwarf2/abbrev.c
index 1ebf8f6eed5..4e55cb40717 100644
--- a/gdb/dwarf2/abbrev.c
+++ b/gdb/dwarf2/abbrev.c
@@ -61,8 +61,8 @@ eq_abbrev (const void *lhs, const void *rhs)
abbrev_table::abbrev_table (sect_offset off, struct dwarf2_section_info *sect)
: sect_off (off),
section (sect),
- m_abbrevs (htab_create_alloc (20, hash_abbrev, eq_abbrev,
- nullptr, xcalloc, xfree))
+ m_abbrevs (htab_create_alloc (20, hash_abbrev, eq_abbrev, nullptr, xcalloc,
+ xfree))
{
}
@@ -117,8 +117,7 @@ tag_interesting_for_index (dwarf_tag tag)
/* Read in an abbrev table. */
abbrev_table_up
-abbrev_table::read (struct dwarf2_section_info *section,
- sect_offset sect_off)
+abbrev_table::read (struct dwarf2_section_info *section, sect_offset sect_off)
{
bfd *abfd = section->get_bfd_owner ();
const gdb_byte *abbrev_ptr;
@@ -135,8 +134,8 @@ abbrev_table::read (struct dwarf2_section_info *section,
{
unsigned int bytes_read;
/* Loop until we reach an abbrev number of 0. */
- unsigned int abbrev_number = read_unsigned_leb128 (abfd, abbrev_ptr,
- &bytes_read);
+ unsigned int abbrev_number
+ = read_unsigned_leb128 (abfd, abbrev_ptr, &bytes_read);
if (abbrev_number == 0)
break;
abbrev_ptr += bytes_read;
@@ -181,8 +180,8 @@ abbrev_table::read (struct dwarf2_section_info *section,
abbrev_ptr += bytes_read;
if (cur_attr.form == DW_FORM_implicit_const)
{
- cur_attr.implicit_const = read_signed_leb128 (abfd, abbrev_ptr,
- &bytes_read);
+ cur_attr.implicit_const
+ = read_signed_leb128 (abfd, abbrev_ptr, &bytes_read);
abbrev_ptr += bytes_read;
}
else
diff --git a/gdb/dwarf2/abbrev.h b/gdb/dwarf2/abbrev.h
index 00cfbacf2d0..81f6db4c20e 100644
--- a/gdb/dwarf2/abbrev.h
+++ b/gdb/dwarf2/abbrev.h
@@ -31,8 +31,8 @@
struct attr_abbrev
{
- ENUM_BITFIELD(dwarf_attribute) name : 16;
- ENUM_BITFIELD(dwarf_form) form : 16;
+ ENUM_BITFIELD (dwarf_attribute) name : 16;
+ ENUM_BITFIELD (dwarf_form) form : 16;
/* It is valid only if FORM is DW_FORM_implicit_const. */
LONGEST implicit_const;
@@ -80,8 +80,7 @@ struct abbrev_table
search.number = abbrev_number;
return (struct abbrev_info *) htab_find_with_hash (m_abbrevs.get (),
- &search,
- abbrev_number);
+ &search, abbrev_number);
}
/* Where the abbrev table came from.
diff --git a/gdb/dwarf2/attribute.c b/gdb/dwarf2/attribute.c
index 3b14757f9db..bbd69e5ae45 100644
--- a/gdb/dwarf2/attribute.c
+++ b/gdb/dwarf2/attribute.c
@@ -67,14 +67,10 @@ bool
attribute::form_is_string () const
{
return (form == DW_FORM_strp || form == DW_FORM_line_strp
- || form == DW_FORM_string
- || form == DW_FORM_strx
- || form == DW_FORM_strx1
- || form == DW_FORM_strx2
- || form == DW_FORM_strx3
- || form == DW_FORM_strx4
- || form == DW_FORM_GNU_str_index
- || form == DW_FORM_GNU_strp_alt);
+ || form == DW_FORM_string || form == DW_FORM_strx
+ || form == DW_FORM_strx1 || form == DW_FORM_strx2
+ || form == DW_FORM_strx3 || form == DW_FORM_strx4
+ || form == DW_FORM_GNU_str_index || form == DW_FORM_GNU_strp_alt);
}
/* See attribute.h. */
@@ -93,12 +89,9 @@ attribute::as_string () const
bool
attribute::form_is_block () const
{
- return (form == DW_FORM_block1
- || form == DW_FORM_block2
- || form == DW_FORM_block4
- || form == DW_FORM_block
- || form == DW_FORM_exprloc
- || form == DW_FORM_data16);
+ return (form == DW_FORM_block1 || form == DW_FORM_block2
+ || form == DW_FORM_block4 || form == DW_FORM_block
+ || form == DW_FORM_exprloc || form == DW_FORM_data16);
}
/* See attribute.h. */
@@ -106,10 +99,8 @@ attribute::form_is_block () const
bool
attribute::form_is_section_offset () const
{
- return (form == DW_FORM_data4
- || form == DW_FORM_data8
- || form == DW_FORM_sec_offset
- || form == DW_FORM_loclistx);
+ return (form == DW_FORM_data4 || form == DW_FORM_data8
+ || form == DW_FORM_sec_offset || form == DW_FORM_loclistx);
}
/* See attribute.h. */
@@ -137,7 +128,7 @@ attribute::form_is_constant () const
void
attribute::get_ref_die_offset_complaint () const
{
- complaint (_("unsupported die ref attribute form: '%s'"),
+ complaint (_ ("unsupported die ref attribute form: '%s'"),
dwarf_form_name (form));
}
@@ -148,16 +139,14 @@ attribute::constant_value (int default_value) const
{
if (form == DW_FORM_sdata || form == DW_FORM_implicit_const)
return u.snd;
- else if (form == DW_FORM_udata
- || form == DW_FORM_data1
- || form == DW_FORM_data2
- || form == DW_FORM_data4
+ else if (form == DW_FORM_udata || form == DW_FORM_data1
+ || form == DW_FORM_data2 || form == DW_FORM_data4
|| form == DW_FORM_data8)
return u.unsnd;
else
{
/* For DW_FORM_data16 see attribute::form_is_constant. */
- complaint (_("Attribute value is not a constant (%s)"),
+ complaint (_ ("Attribute value is not a constant (%s)"),
dwarf_form_name (form));
return default_value;
}
@@ -168,22 +157,14 @@ attribute::constant_value (int default_value) const
bool
attribute::form_is_unsigned () const
{
- return (form == DW_FORM_ref_addr
- || form == DW_FORM_GNU_ref_alt
- || form == DW_FORM_data2
- || form == DW_FORM_data4
- || form == DW_FORM_data8
- || form == DW_FORM_sec_offset
- || form == DW_FORM_data1
- || form == DW_FORM_flag
- || form == DW_FORM_flag_present
- || form == DW_FORM_udata
- || form == DW_FORM_rnglistx
- || form == DW_FORM_loclistx
- || form == DW_FORM_ref1
- || form == DW_FORM_ref2
- || form == DW_FORM_ref4
- || form == DW_FORM_ref8
+ return (form == DW_FORM_ref_addr || form == DW_FORM_GNU_ref_alt
+ || form == DW_FORM_data2 || form == DW_FORM_data4
+ || form == DW_FORM_data8 || form == DW_FORM_sec_offset
+ || form == DW_FORM_data1 || form == DW_FORM_flag
+ || form == DW_FORM_flag_present || form == DW_FORM_udata
+ || form == DW_FORM_rnglistx || form == DW_FORM_loclistx
+ || form == DW_FORM_ref1 || form == DW_FORM_ref2
+ || form == DW_FORM_ref4 || form == DW_FORM_ref8
|| form == DW_FORM_ref_udata);
}
@@ -200,16 +181,11 @@ attribute::form_is_signed () const
bool
attribute::form_requires_reprocessing () const
{
- return (form == DW_FORM_strx
- || form == DW_FORM_strx1
- || form == DW_FORM_strx2
- || form == DW_FORM_strx3
- || form == DW_FORM_strx4
- || form == DW_FORM_GNU_str_index
- || form == DW_FORM_addrx
- || form == DW_FORM_GNU_addr_index
- || form == DW_FORM_rnglistx
- || form == DW_FORM_loclistx);
+ return (form == DW_FORM_strx || form == DW_FORM_strx1
+ || form == DW_FORM_strx2 || form == DW_FORM_strx3
+ || form == DW_FORM_strx4 || form == DW_FORM_GNU_str_index
+ || form == DW_FORM_addrx || form == DW_FORM_GNU_addr_index
+ || form == DW_FORM_rnglistx || form == DW_FORM_loclistx);
}
/* See attribute.h. */
@@ -230,7 +206,7 @@ attribute::defaulted () const
/* If the form was not constant, we already complained in
constant_value, so there's no need to complain again. */
if (form_is_constant ())
- complaint (_("unrecognized DW_AT_defaulted value (%s)"),
+ complaint (_ ("unrecognized DW_AT_defaulted value (%s)"),
plongest (value));
return DW_DEFAULTED_no;
}
@@ -253,7 +229,7 @@ attribute::as_virtuality () const
/* If the form was not constant, we already complained in
constant_value, so there's no need to complain again. */
if (form_is_constant ())
- complaint (_("unrecognized DW_AT_virtuality value (%s)"),
+ complaint (_ ("unrecognized DW_AT_virtuality value (%s)"),
plongest (value));
return DW_VIRTUALITY_none;
}
diff --git a/gdb/dwarf2/attribute.h b/gdb/dwarf2/attribute.h
index e13822af911..406a0a18522 100644
--- a/gdb/dwarf2/attribute.h
+++ b/gdb/dwarf2/attribute.h
@@ -110,7 +110,7 @@ struct attribute
if (form_is_unsigned ())
return as_unsigned ();
if (form_is_signed ())
- return (ULONGEST)as_signed ();
+ return (ULONGEST) as_signed ();
gdb_assert (false);
}
@@ -149,12 +149,9 @@ struct attribute
bool form_is_ref () const
{
- return (form == DW_FORM_ref_addr
- || form == DW_FORM_ref1
- || form == DW_FORM_ref2
- || form == DW_FORM_ref4
- || form == DW_FORM_ref8
- || form == DW_FORM_ref_udata
+ return (form == DW_FORM_ref_addr || form == DW_FORM_ref1
+ || form == DW_FORM_ref2 || form == DW_FORM_ref4
+ || form == DW_FORM_ref8 || form == DW_FORM_ref_udata
|| form == DW_FORM_GNU_ref_alt);
}
@@ -264,18 +261,14 @@ struct attribute
void set_address (CORE_ADDR addr)
{
gdb_assert (form == DW_FORM_addr
- || ((form == DW_FORM_addrx
- || form == DW_FORM_GNU_addr_index)
+ || ((form == DW_FORM_addrx || form == DW_FORM_GNU_addr_index)
&& requires_reprocessing));
u.addr = addr;
requires_reprocessing = 0;
}
/* True if this attribute requires reprocessing. */
- bool requires_reprocessing_p () const
- {
- return requires_reprocessing;
- }
+ bool requires_reprocessing_p () const { return requires_reprocessing; }
/* Return the value as one of the recognized enum
dwarf_defaulted_attribute constants according to DWARF5 spec,
@@ -293,7 +286,7 @@ struct attribute
will issue a complaint and return false. */
bool as_boolean () const;
- ENUM_BITFIELD(dwarf_attribute) name : 15;
+ ENUM_BITFIELD (dwarf_attribute) name : 15;
/* A boolean that is used for forms that require reprocessing. A
form may require data not directly available in the attribute.
@@ -306,7 +299,7 @@ struct attribute
forms. */
unsigned int requires_reprocessing : 1;
- ENUM_BITFIELD(dwarf_form) form : 15;
+ ENUM_BITFIELD (dwarf_form) form : 15;
/* Has u.str already been updated by dwarf2_canonicalize_name? This
field should be in u.str but it is kept here for better struct
@@ -314,15 +307,14 @@ struct attribute
unsigned int string_is_canonical : 1;
union
- {
- const char *str;
- struct dwarf_block *blk;
- ULONGEST unsnd;
- LONGEST snd;
- CORE_ADDR addr;
- ULONGEST signature;
- }
- u;
+ {
+ const char *str;
+ struct dwarf_block *blk;
+ ULONGEST unsnd;
+ LONGEST snd;
+ CORE_ADDR addr;
+ ULONGEST signature;
+ } u;
private:
diff --git a/gdb/dwarf2/call-site.h b/gdb/dwarf2/call-site.h
index c8a1e8b2971..6288bb85fb8 100644
--- a/gdb/dwarf2/call-site.h
+++ b/gdb/dwarf2/call-site.h
@@ -66,16 +66,16 @@ struct call_site_target
}
void set_loc_physname (const char *physname)
- {
- m_loc_kind = PHYSNAME;
- m_loc.physname = physname;
- }
+ {
+ m_loc_kind = PHYSNAME;
+ m_loc.physname = physname;
+ }
void set_loc_dwarf_block (dwarf2_locexpr_baton *dwarf_block)
- {
- m_loc_kind = DWARF_BLOCK;
- m_loc.dwarf_block = dwarf_block;
- }
+ {
+ m_loc_kind = DWARF_BLOCK;
+ m_loc.dwarf_block = dwarf_block;
+ }
void set_loc_array (unsigned length, const CORE_ADDR *data)
{
@@ -107,6 +107,7 @@ private:
const char *physname;
/* DWARF block. */
struct dwarf2_locexpr_baton *dwarf_block;
+
/* Array of addresses. */
struct
{
@@ -165,31 +166,27 @@ struct call_site
{
call_site (CORE_ADDR pc, dwarf2_per_cu_data *per_cu,
dwarf2_per_objfile *per_objfile)
- : per_cu (per_cu), per_objfile (per_objfile), m_unrelocated_pc (pc)
- {}
-
- static int
- eq (const call_site *a, const call_site *b)
+ : per_cu (per_cu),
+ per_objfile (per_objfile),
+ m_unrelocated_pc (pc)
{
- return a->m_unrelocated_pc == b->m_unrelocated_pc;
}
- static hashval_t
- hash (const call_site *a)
+ static int eq (const call_site *a, const call_site *b)
{
- return a->m_unrelocated_pc;
+ return a->m_unrelocated_pc == b->m_unrelocated_pc;
}
- static int
- eq (const void *a, const void *b)
+ static hashval_t hash (const call_site *a) { return a->m_unrelocated_pc; }
+
+ static int eq (const void *a, const void *b)
{
- return eq ((const call_site *)a, (const call_site *)b);
+ return eq ((const call_site *) a, (const call_site *) b);
}
- static hashval_t
- hash (const void *a)
+ static hashval_t hash (const void *a)
{
- return hash ((const call_site *)a);
+ return hash ((const call_site *) a);
}
/* Return the address of the first instruction after this call. */
@@ -202,8 +199,7 @@ struct call_site
void iterate_over_addresses (struct gdbarch *call_site_gdbarch,
frame_info_ptr caller_frame,
- call_site_target::iterate_ftype callback)
- const
+ call_site_target::iterate_ftype callback) const
{
return target.iterate_over_addresses (call_site_gdbarch, this,
caller_frame, callback);
@@ -216,7 +212,9 @@ struct call_site
/* * Describe DW_AT_call_target. Missing attribute uses
FIELD_LOC_KIND_DWARF_BLOCK with FIELD_DWARF_BLOCK == NULL. */
- struct call_site_target target {};
+ struct call_site_target target
+ {
+ };
/* * Size of the PARAMETER array. */
@@ -232,10 +230,12 @@ struct call_site
dwarf2_per_objfile *const per_objfile = nullptr;
private:
+
/* Unrelocated address of the first instruction after this call. */
const CORE_ADDR m_unrelocated_pc;
public:
+
/* * Describe DW_TAG_call_site's DW_TAG_formal_parameter. */
struct call_site_parameter parameter[];
diff --git a/gdb/dwarf2/comp-unit-head.c b/gdb/dwarf2/comp-unit-head.c
index 2deceb50932..29bec7d9f05 100644
--- a/gdb/dwarf2/comp-unit-head.c
+++ b/gdb/dwarf2/comp-unit-head.c
@@ -50,8 +50,8 @@ read_comp_unit_head (struct comp_unit_head *cu_header,
info_ptr += bytes_read;
unsigned version = read_2_bytes (abfd, info_ptr);
if (version < 2 || version > 5)
- error (_("Dwarf Error: wrong version in compilation unit header "
- "(is %d, should be 2, 3, 4 or 5) [in module %s]"),
+ error (_ ("Dwarf Error: wrong version in compilation unit header "
+ "(is %d, should be 2, 3, 4 or 5) [in module %s]"),
version, filename);
cu_header->version = version;
info_ptr += 2;
@@ -65,12 +65,12 @@ read_comp_unit_head (struct comp_unit_head *cu_header,
cu_header->unit_type = DW_UT_type;
break;
default:
- internal_error (_("read_comp_unit_head: invalid section_kind"));
+ internal_error (_ ("read_comp_unit_head: invalid section_kind"));
}
else
{
- cu_header->unit_type = static_cast<enum dwarf_unit_type>
- (read_1_byte (abfd, info_ptr));
+ cu_header->unit_type
+ = static_cast<enum dwarf_unit_type> (read_1_byte (abfd, info_ptr));
info_ptr += 1;
switch (cu_header->unit_type)
{
@@ -79,20 +79,21 @@ read_comp_unit_head (struct comp_unit_head *cu_header,
case DW_UT_skeleton:
case DW_UT_split_compile:
if (section_kind != rcuh_kind::COMPILE)
- error (_("Dwarf Error: wrong unit_type in compilation unit header "
- "(is %s, should be %s) [in module %s]"),
- dwarf_unit_type_name (cu_header->unit_type),
- dwarf_unit_type_name (DW_UT_type), filename);
+ error (
+ _ ("Dwarf Error: wrong unit_type in compilation unit header "
+ "(is %s, should be %s) [in module %s]"),
+ dwarf_unit_type_name (cu_header->unit_type),
+ dwarf_unit_type_name (DW_UT_type), filename);
break;
case DW_UT_type:
case DW_UT_split_type:
section_kind = rcuh_kind::TYPE;
break;
default:
- error (_("Dwarf Error: wrong unit_type in compilation unit header "
- "(is %#04x, should be one of: %s, %s, %s, %s or %s) "
- "[in module %s]"), cu_header->unit_type,
- dwarf_unit_type_name (DW_UT_compile),
+ error (_ ("Dwarf Error: wrong unit_type in compilation unit header "
+ "(is %#04x, should be one of: %s, %s, %s, %s or %s) "
+ "[in module %s]"),
+ cu_header->unit_type, dwarf_unit_type_name (DW_UT_compile),
dwarf_unit_type_name (DW_UT_skeleton),
dwarf_unit_type_name (DW_UT_split_compile),
dwarf_unit_type_name (DW_UT_type),
@@ -112,12 +113,12 @@ read_comp_unit_head (struct comp_unit_head *cu_header,
}
signed_addr = bfd_get_sign_extend_vma (abfd);
if (signed_addr < 0)
- internal_error (_("read_comp_unit_head: dwarf from non elf file"));
+ internal_error (_ ("read_comp_unit_head: dwarf from non elf file"));
cu_header->signed_addr_p = signed_addr;
bool header_has_signature = section_kind == rcuh_kind::TYPE
- || cu_header->unit_type == DW_UT_skeleton
- || cu_header->unit_type == DW_UT_split_compile;
+ || cu_header->unit_type == DW_UT_skeleton
+ || cu_header->unit_type == DW_UT_split_compile;
if (header_has_signature)
{
@@ -132,9 +133,9 @@ read_comp_unit_head (struct comp_unit_head *cu_header,
info_ptr += bytes_read;
cu_header->type_cu_offset_in_tu = (cu_offset) type_offset;
if (to_underlying (cu_header->type_cu_offset_in_tu) != type_offset)
- error (_("Dwarf Error: Too big type_offset in compilation unit "
- "header (is %s) [in module %s]"), plongest (type_offset),
- filename);
+ error (_ ("Dwarf Error: Too big type_offset in compilation unit "
+ "header (is %s) [in module %s]"),
+ plongest (type_offset), filename);
}
return info_ptr;
@@ -154,20 +155,19 @@ error_check_comp_unit_head (dwarf2_per_objfile *per_objfile,
if (to_underlying (header->abbrev_sect_off)
>= abbrev_section->get_size (per_objfile->objfile))
- error (_("Dwarf Error: bad offset (%s) in compilation unit header "
- "(offset %s + 6) [in module %s]"),
+ error (_ ("Dwarf Error: bad offset (%s) in compilation unit header "
+ "(offset %s + 6) [in module %s]"),
sect_offset_str (header->abbrev_sect_off),
- sect_offset_str (header->sect_off),
- filename);
+ sect_offset_str (header->sect_off), filename);
/* Cast to ULONGEST to use 64-bit arithmetic when possible to
avoid potential 32-bit overflow. */
if (((ULONGEST) header->sect_off + header->get_length_with_initial ())
> section->size)
- error (_("Dwarf Error: bad length (0x%x) in compilation unit header "
- "(offset %s + 0) [in module %s]"),
- header->get_length_without_initial (), sect_offset_str (header->sect_off),
- filename);
+ error (_ ("Dwarf Error: bad length (0x%x) in compilation unit header "
+ "(offset %s + 0) [in module %s]"),
+ header->get_length_without_initial (),
+ sect_offset_str (header->sect_off), filename);
}
/* See comp-unit-head.h. */
@@ -213,8 +213,9 @@ comp_unit_head::read_address (bfd *abfd, const gdb_byte *buf,
retval = bfd_get_signed_64 (abfd, buf);
break;
default:
- internal_error (_("read_address: bad switch, signed [in module %s]"),
- bfd_get_filename (abfd));
+ internal_error (
+ _ ("read_address: bad switch, signed [in module %s]"),
+ bfd_get_filename (abfd));
}
}
else
@@ -231,8 +232,8 @@ comp_unit_head::read_address (bfd *abfd, const gdb_byte *buf,
retval = bfd_get_64 (abfd, buf);
break;
default:
- internal_error (_("read_address: bad switch, "
- "unsigned [in module %s]"),
+ internal_error (_ ("read_address: bad switch, "
+ "unsigned [in module %s]"),
bfd_get_filename (abfd));
}
}
diff --git a/gdb/dwarf2/comp-unit-head.h b/gdb/dwarf2/comp-unit-head.h
index 65a16f4ef14..2cd8f04f0e5 100644
--- a/gdb/dwarf2/comp-unit-head.h
+++ b/gdb/dwarf2/comp-unit-head.h
@@ -38,8 +38,11 @@ struct dwarf2_per_objfile;
struct comp_unit_head
{
private:
+
unsigned int m_length = 0;
+
public:
+
unsigned char version = 0;
unsigned char addr_size = 0;
unsigned char signed_addr_p = 0;
@@ -51,7 +54,9 @@ public:
/* Size of the length field; either 4 or 12. */
unsigned int initial_length_size = 0;
- enum dwarf_unit_type unit_type {};
+ enum dwarf_unit_type unit_type
+ {
+ };
/* Offset to first die in this cu from the start of the cu.
This will be the first byte following the compilation unit header. */
@@ -70,10 +75,7 @@ public:
DW_UT_skeleton or DW_UT_split_compile. */
ULONGEST signature = 0;
- void set_length (unsigned int length)
- {
- m_length = length;
- }
+ void set_length (unsigned int length) { m_length = length; }
/* Return the total length of the CU described by this header, including the
initial length field. */
@@ -84,10 +86,7 @@ public:
/* Return the total length of the CU described by this header, excluding the
initial length field. */
- unsigned int get_length_without_initial () const
- {
- return m_length;
- }
+ unsigned int get_length_without_initial () const { return m_length; }
/* Return TRUE if OFF is within this CU. */
bool offset_in_cu_p (sect_offset off) const
@@ -113,27 +112,27 @@ public:
};
/* Expected enum dwarf_unit_type for read_comp_unit_head. */
-enum class rcuh_kind { COMPILE, TYPE };
+enum class rcuh_kind
+{
+ COMPILE,
+ TYPE
+};
/* Read in the comp unit header information from the debug_info at info_ptr.
Use rcuh_kind::COMPILE as the default type if not known by the caller.
NOTE: This leaves members offset, first_die_offset to be filled in
by the caller. */
-extern const gdb_byte *read_comp_unit_head
- (struct comp_unit_head *cu_header,
- const gdb_byte *info_ptr,
- struct dwarf2_section_info *section,
- rcuh_kind section_kind);
+extern const gdb_byte *read_comp_unit_head (
+ struct comp_unit_head *cu_header, const gdb_byte *info_ptr,
+ struct dwarf2_section_info *section, rcuh_kind section_kind);
/* Read in a CU/TU header and perform some basic error checking.
The contents of the header are stored in HEADER.
The result is a pointer to the start of the first DIE. */
-extern const gdb_byte *read_and_check_comp_unit_head
- (dwarf2_per_objfile *per_objfile,
- struct comp_unit_head *header,
- struct dwarf2_section_info *section,
- struct dwarf2_section_info *abbrev_section,
- const gdb_byte *info_ptr,
- rcuh_kind section_kind);
+extern const gdb_byte *read_and_check_comp_unit_head (
+ dwarf2_per_objfile *per_objfile, struct comp_unit_head *header,
+ struct dwarf2_section_info *section,
+ struct dwarf2_section_info *abbrev_section, const gdb_byte *info_ptr,
+ rcuh_kind section_kind);
#endif /* GDB_DWARF2_COMP_UNIT_H */
diff --git a/gdb/dwarf2/cooked-index.c b/gdb/dwarf2/cooked-index.c
index f253a4267c9..54e6af5508f 100644
--- a/gdb/dwarf2/cooked-index.c
+++ b/gdb/dwarf2/cooked-index.c
@@ -51,18 +51,15 @@ int
cooked_index_entry::compare (const char *stra, const char *strb,
comparison_mode mode)
{
- auto munge = [] (char c) -> unsigned char
- {
- /* We want to sort '<' before any other printable character.
+ auto munge = [] (char c) -> unsigned char {
+ /* We want to sort '<' before any other printable character.
So, rewrite '<' to something just before ' '. */
- if (c == '<')
- return '\x1f';
- return TOLOWER ((unsigned char) c);
- };
-
- while (*stra != '\0'
- && *strb != '\0'
- && (munge (*stra) == munge (*strb)))
+ if (c == '<')
+ return '\x1f';
+ return TOLOWER ((unsigned char) c);
+ };
+
+ while (*stra != '\0' && *strb != '\0' && (munge (*stra) == munge (*strb)))
{
++stra;
++strb;
@@ -88,7 +85,8 @@ cooked_index_entry::compare (const char *stra, const char *strb,
#if GDB_SELF_TEST
-namespace {
+namespace
+{
void
test_compare ()
@@ -98,60 +96,65 @@ test_compare ()
const auto mode_sort = cooked_index_entry::SORT;
const auto mode_complete = cooked_index_entry::COMPLETE;
- SELF_CHECK (cooked_index_entry::compare ("abcd", "abcd",
- mode_compare) == 0);
- SELF_CHECK (cooked_index_entry::compare ("abcd", "abcd",
- mode_complete) == 0);
-
- SELF_CHECK (cooked_index_entry::compare ("abcd", "ABCDE",
- mode_compare) < 0);
- SELF_CHECK (cooked_index_entry::compare ("ABCDE", "abcd",
- mode_compare) > 0);
- SELF_CHECK (cooked_index_entry::compare ("abcd", "ABCDE",
- mode_complete) < 0);
- SELF_CHECK (cooked_index_entry::compare ("ABCDE", "abcd",
- mode_complete) == 0);
-
- SELF_CHECK (cooked_index_entry::compare ("name", "name<>",
- mode_compare) < 0);
- SELF_CHECK (cooked_index_entry::compare ("name<>", "name",
- mode_compare) == 0);
- SELF_CHECK (cooked_index_entry::compare ("name", "name<>",
- mode_complete) < 0);
- SELF_CHECK (cooked_index_entry::compare ("name<>", "name",
- mode_complete) == 0);
+ SELF_CHECK (cooked_index_entry::compare ("abcd", "abcd", mode_compare) == 0);
+ SELF_CHECK (cooked_index_entry::compare ("abcd", "abcd", mode_complete)
+ == 0);
+
+ SELF_CHECK (cooked_index_entry::compare ("abcd", "ABCDE", mode_compare) < 0);
+ SELF_CHECK (cooked_index_entry::compare ("ABCDE", "abcd", mode_compare) > 0);
+ SELF_CHECK (cooked_index_entry::compare ("abcd", "ABCDE", mode_complete)
+ < 0);
+ SELF_CHECK (cooked_index_entry::compare ("ABCDE", "abcd", mode_complete)
+ == 0);
+
+ SELF_CHECK (cooked_index_entry::compare ("name", "name<>", mode_compare)
+ < 0);
+ SELF_CHECK (cooked_index_entry::compare ("name<>", "name", mode_compare)
+ == 0);
+ SELF_CHECK (cooked_index_entry::compare ("name", "name<>", mode_complete)
+ < 0);
+ SELF_CHECK (cooked_index_entry::compare ("name<>", "name", mode_complete)
+ == 0);
SELF_CHECK (cooked_index_entry::compare ("name<arg>", "name<arg>",
- mode_compare) == 0);
+ mode_compare)
+ == 0);
SELF_CHECK (cooked_index_entry::compare ("name<arg>", "name<ag>",
- mode_compare) > 0);
+ mode_compare)
+ > 0);
SELF_CHECK (cooked_index_entry::compare ("name<arg>", "name<arg>",
- mode_complete) == 0);
+ mode_complete)
+ == 0);
SELF_CHECK (cooked_index_entry::compare ("name<arg>", "name<ag>",
- mode_complete) > 0);
+ mode_complete)
+ > 0);
SELF_CHECK (cooked_index_entry::compare ("name<arg<more>>",
- "name<arg<more>>",
- mode_compare) == 0);
+ "name<arg<more>>", mode_compare)
+ == 0);
SELF_CHECK (cooked_index_entry::compare ("name", "name<arg<more>>",
- mode_compare) < 0);
+ mode_compare)
+ < 0);
SELF_CHECK (cooked_index_entry::compare ("name<arg<more>>", "name",
- mode_compare) == 0);
+ mode_compare)
+ == 0);
SELF_CHECK (cooked_index_entry::compare ("name<arg<more>>", "name<arg<",
- mode_compare) > 0);
+ mode_compare)
+ > 0);
SELF_CHECK (cooked_index_entry::compare ("name<arg<more>>", "name<arg<",
- mode_complete) == 0);
+ mode_complete)
+ == 0);
SELF_CHECK (cooked_index_entry::compare ("", "abcd", mode_compare) < 0);
SELF_CHECK (cooked_index_entry::compare ("", "abcd", mode_complete) < 0);
SELF_CHECK (cooked_index_entry::compare ("abcd", "", mode_compare) > 0);
SELF_CHECK (cooked_index_entry::compare ("abcd", "", mode_complete) == 0);
- SELF_CHECK (cooked_index_entry::compare ("func", "func<type>",
- mode_sort) < 0);
- SELF_CHECK (cooked_index_entry::compare ("func<type>", "func1",
- mode_sort) < 0);
+ SELF_CHECK (cooked_index_entry::compare ("func", "func<type>", mode_sort)
+ < 0);
+ SELF_CHECK (cooked_index_entry::compare ("func<type>", "func1", mode_sort)
+ < 0);
}
} /* anonymous namespace */
@@ -209,16 +212,15 @@ cooked_index_shard::add (sect_offset die_offset, enum dwarf_tag tag,
const cooked_index_entry *parent_entry,
dwarf2_per_cu_data *per_cu)
{
- cooked_index_entry *result = create (die_offset, tag, flags, name,
- parent_entry, per_cu);
+ cooked_index_entry *result
+ = create (die_offset, tag, flags, name, parent_entry, per_cu);
m_entries.push_back (result);
/* An explicitly-tagged main program should always override the
implicit "main" discovery. */
if ((flags & IS_MAIN) != 0)
m_main = result;
- else if (per_cu->lang () != language_ada
- && m_main == nullptr
+ else if (per_cu->lang () != language_ada && m_main == nullptr
&& strcmp (name, "main") == 0)
m_main = result;
@@ -230,10 +232,9 @@ cooked_index_shard::add (sect_offset die_offset, enum dwarf_tag tag,
void
cooked_index_shard::finalize ()
{
- m_future = gdb::thread_pool::g_thread_pool->post_task ([this] ()
- {
- do_finalize ();
- });
+ m_future = gdb::thread_pool::g_thread_pool->post_task ([this] () {
+ do_finalize ();
+ });
}
/* See cooked-index.h. */
@@ -245,8 +246,8 @@ cooked_index_shard::handle_gnat_encoded_entry (cooked_index_entry *entry,
std::string canonical = ada_decode (entry->name, false, false);
if (canonical.empty ())
return {};
- std::vector<gdb::string_view> names = split_name (canonical.c_str (),
- split_style::DOT);
+ std::vector<gdb::string_view> names
+ = split_name (canonical.c_str (), split_style::DOT);
gdb::string_view tail = names.back ();
names.pop_back ();
@@ -254,8 +255,8 @@ cooked_index_shard::handle_gnat_encoded_entry (cooked_index_entry *entry,
for (const auto &name : names)
{
uint32_t hashval = dwarf5_djb_hash (name);
- void **slot = htab_find_slot_with_hash (gnat_entries, &name,
- hashval, INSERT);
+ void **slot
+ = htab_find_slot_with_hash (gnat_entries, &name, hashval, INSERT);
/* CUs are processed in order, so we only need to check the most
recent entry. */
cooked_index_entry *last = (cooked_index_entry *) *slot;
@@ -263,9 +264,8 @@ cooked_index_shard::handle_gnat_encoded_entry (cooked_index_entry *entry,
{
gdb::unique_xmalloc_ptr<char> new_name
= make_unique_xstrndup (name.data (), name.length ());
- last = create (entry->die_offset, DW_TAG_namespace,
- 0, new_name.get (), parent,
- entry->per_cu);
+ last = create (entry->die_offset, DW_TAG_namespace, 0,
+ new_name.get (), parent, entry->per_cu);
last->canonical = last->name;
m_names.push_back (std::move (new_name));
*slot = last;
@@ -283,18 +283,16 @@ cooked_index_shard::handle_gnat_encoded_entry (cooked_index_entry *entry,
void
cooked_index_shard::do_finalize ()
{
- auto hash_name_ptr = [] (const void *p)
- {
- const cooked_index_entry *entry = (const cooked_index_entry *) p;
- return htab_hash_pointer (entry->name);
- };
+ auto hash_name_ptr = [] (const void *p) {
+ const cooked_index_entry *entry = (const cooked_index_entry *) p;
+ return htab_hash_pointer (entry->name);
+ };
- auto eq_name_ptr = [] (const void *a, const void *b) -> int
- {
- const cooked_index_entry *ea = (const cooked_index_entry *) a;
- const cooked_index_entry *eb = (const cooked_index_entry *) b;
- return ea->name == eb->name;
- };
+ auto eq_name_ptr = [] (const void *a, const void *b) -> int {
+ const cooked_index_entry *ea = (const cooked_index_entry *) a;
+ const cooked_index_entry *eb = (const cooked_index_entry *) b;
+ return ea->name == eb->name;
+ };
/* We can use pointer equality here because names come from
.debug_str, which will normally be unique-ified by the linker.
@@ -303,22 +301,20 @@ cooked_index_shard::do_finalize ()
htab_up seen_names (htab_create_alloc (10, hash_name_ptr, eq_name_ptr,
nullptr, xcalloc, xfree));
- auto hash_entry = [] (const void *e)
- {
- const cooked_index_entry *entry = (const cooked_index_entry *) e;
- return dwarf5_djb_hash (entry->canonical);
- };
+ auto hash_entry = [] (const void *e) {
+ const cooked_index_entry *entry = (const cooked_index_entry *) e;
+ return dwarf5_djb_hash (entry->canonical);
+ };
- auto eq_entry = [] (const void *a, const void *b) -> int
- {
- const cooked_index_entry *ae = (const cooked_index_entry *) a;
- const gdb::string_view *sv = (const gdb::string_view *) b;
- return (strlen (ae->canonical) == sv->length ()
- && strncasecmp (ae->canonical, sv->data (), sv->length ()) == 0);
- };
+ auto eq_entry = [] (const void *a, const void *b) -> int {
+ const cooked_index_entry *ae = (const cooked_index_entry *) a;
+ const gdb::string_view *sv = (const gdb::string_view *) b;
+ return (strlen (ae->canonical) == sv->length ()
+ && strncasecmp (ae->canonical, sv->data (), sv->length ()) == 0);
+ };
- htab_up gnat_entries (htab_create_alloc (10, hash_entry, eq_entry,
- nullptr, xcalloc, xfree));
+ htab_up gnat_entries (htab_create_alloc (10, hash_entry, eq_entry, nullptr,
+ xcalloc, xfree));
for (cooked_index_entry *entry : m_entries)
{
@@ -340,14 +336,13 @@ cooked_index_shard::do_finalize ()
else if (entry->per_cu->lang () == language_cplus
|| entry->per_cu->lang () == language_c)
{
- void **slot = htab_find_slot (seen_names.get (), entry,
- INSERT);
+ void **slot = htab_find_slot (seen_names.get (), entry, INSERT);
if (*slot == nullptr)
{
gdb::unique_xmalloc_ptr<char> canon_name
= (entry->per_cu->lang () == language_cplus
- ? cp_canonicalize_string (entry->name)
- : c_canonicalize_name (entry->name));
+ ? cp_canonicalize_string (entry->name)
+ : c_canonicalize_name (entry->name));
if (canon_name == nullptr)
entry->canonical = entry->name;
else
@@ -370,10 +365,9 @@ cooked_index_shard::do_finalize ()
m_names.shrink_to_fit ();
m_entries.shrink_to_fit ();
std::sort (m_entries.begin (), m_entries.end (),
- [] (const cooked_index_entry *a, const cooked_index_entry *b)
- {
- return *a < *b;
- });
+ [] (const cooked_index_entry *a, const cooked_index_entry *b) {
+ return *a < *b;
+ });
}
/* See cooked-index.h. */
@@ -383,22 +377,21 @@ cooked_index_shard::find (const std::string &name, bool completing) const
{
wait ();
- cooked_index_entry::comparison_mode mode = (completing
- ? cooked_index_entry::COMPLETE
- : cooked_index_entry::MATCH);
+ cooked_index_entry::comparison_mode mode
+ = (completing ? cooked_index_entry::COMPLETE : cooked_index_entry::MATCH);
auto lower = std::lower_bound (m_entries.cbegin (), m_entries.cend (), name,
[=] (const cooked_index_entry *entry,
- const std::string &n)
- {
- return cooked_index_entry::compare (entry->canonical, n.c_str (), mode) < 0;
+ const std::string &n) {
+ return cooked_index_entry::compare (entry->canonical, n.c_str (), mode)
+ < 0;
});
auto upper = std::upper_bound (m_entries.cbegin (), m_entries.cend (), name,
[=] (const std::string &n,
- const cooked_index_entry *entry)
- {
- return cooked_index_entry::compare (entry->canonical, n.c_str (), mode) > 0;
+ const cooked_index_entry *entry) {
+ return cooked_index_entry::compare (entry->canonical, n.c_str (), mode)
+ > 0;
});
return range (lower, upper);
@@ -459,8 +452,7 @@ cooked_index::get_main () const
{
const cooked_index_entry *entry = index->get_main ();
if (result == nullptr
- || ((result->flags & IS_MAIN) == 0
- && entry != nullptr
+ || ((result->flags & IS_MAIN) == 0 && entry != nullptr
&& (entry->flags & IS_MAIN) != 0))
result = entry;
}
@@ -504,7 +496,7 @@ cooked_index::dump (gdbarch *arch) const
const cooked_index_entry *main_entry = this->get_main ();
if (main_entry != nullptr)
gdb_printf (" main: ((cooked_index_entry *) %p) [%s]\n", main_entry,
- main_entry->name);
+ main_entry->name);
else
gdb_printf (" main: ((cooked_index_entry *) 0)\n");
@@ -520,31 +512,31 @@ cooked_index::dump (gdbarch *arch) const
gdb_printf (" [%zu] ((addrmap *) %p)\n", i, &addrmap);
gdb_printf ("\n");
- addrmap.foreach ([arch] (CORE_ADDR start_addr, const void *obj)
- {
- QUIT;
+ addrmap.foreach ([arch] (CORE_ADDR start_addr, const void *obj) {
+ QUIT;
- const char *start_addr_str = paddress (arch, start_addr);
+ const char *start_addr_str = paddress (arch, start_addr);
- if (obj != nullptr)
- {
- const dwarf2_per_cu_data *per_cu
- = static_cast<const dwarf2_per_cu_data *> (obj);
- gdb_printf (" [%s] ((dwarf2_per_cu_data *) %p)\n",
- start_addr_str, per_cu);
- }
- else
- gdb_printf (" [%s] ((dwarf2_per_cu_data *) 0)\n",
- start_addr_str);
+ if (obj != nullptr)
+ {
+ const dwarf2_per_cu_data *per_cu
+ = static_cast<const dwarf2_per_cu_data *> (obj);
+ gdb_printf (" [%s] ((dwarf2_per_cu_data *) %p)\n",
+ start_addr_str, per_cu);
+ }
+ else
+ gdb_printf (" [%s] ((dwarf2_per_cu_data *) 0)\n",
+ start_addr_str);
- return 0;
- });
+ return 0;
+ });
gdb_printf ("\n");
}
}
void _initialize_cooked_index ();
+
void
_initialize_cooked_index ()
{
diff --git a/gdb/dwarf2/cooked-index.h b/gdb/dwarf2/cooked-index.h
index 7a8216abbf3..38bd1f1e44d 100644
--- a/gdb/dwarf2/cooked-index.h
+++ b/gdb/dwarf2/cooked-index.h
@@ -52,6 +52,7 @@ enum cooked_index_flag_enum : unsigned char
definition. */
IS_TYPE_DECLARATION = 16,
};
+
DEF_ENUM_FLAGS_TYPE (enum cooked_index_flag_enum, cooked_index_flag);
/* Return a string representation of FLAGS. */
@@ -87,11 +88,9 @@ struct cooked_index_entry : public allocate_on_obstack
if ((flags & IS_TYPE_DECLARATION) != 0)
return false;
- if ((search_flags & SEARCH_STATIC_BLOCK) != 0
- && (flags & IS_STATIC) != 0)
+ if ((search_flags & SEARCH_STATIC_BLOCK) != 0 && (flags & IS_STATIC) != 0)
return true;
- if ((search_flags & SEARCH_GLOBAL_BLOCK) != 0
- && (flags & IS_STATIC) == 0)
+ if ((search_flags & SEARCH_GLOBAL_BLOCK) != 0 && (flags & IS_STATIC) == 0)
return true;
return false;
}
@@ -128,8 +127,7 @@ struct cooked_index_entry : public allocate_on_obstack
switch (kind)
{
case VARIABLES_DOMAIN:
- return (tag == DW_TAG_variable
- || tag == DW_TAG_constant
+ return (tag == DW_TAG_variable || tag == DW_TAG_constant
|| tag == DW_TAG_enumerator);
case FUNCTIONS_DOMAIN:
return tag == DW_TAG_subprogram;
@@ -192,7 +190,7 @@ struct cooked_index_entry : public allocate_on_obstack
comparison_mode mode);
/* Compare two entries by canonical name. */
- bool operator< (const cooked_index_entry &other) const
+ bool operator<(const cooked_index_entry &other) const
{
return compare (canonical, other.canonical, SORT) < 0;
}
@@ -235,14 +233,14 @@ class cooked_index;
class cooked_index_shard
{
public:
+
cooked_index_shard () = default;
DISABLE_COPY_AND_ASSIGN (cooked_index_shard);
/* Create a new cooked_index_entry and register it with this object.
Entries are owned by this object. The new item is returned. */
const cooked_index_entry *add (sect_offset die_offset, enum dwarf_tag tag,
- cooked_index_flag flags,
- const char *name,
+ cooked_index_flag flags, const char *name,
const cooked_index_entry *parent_entry,
dwarf2_per_cu_data *per_cu);
@@ -259,16 +257,13 @@ public:
void finalize ();
/* Wait for this index's finalization to be complete. */
- void wait () const
- {
- m_future.wait ();
- }
+ void wait () const { m_future.wait (); }
friend class cooked_index;
/* A simple range over part of m_entries. */
typedef iterator_range<std::vector<cooked_index_entry *>::const_iterator>
- range;
+ range;
/* Return a range of all the entries. */
range all_entries () const
@@ -286,10 +281,7 @@ private:
/* Return the entry that is believed to represent the program's
"main". This will return NULL if no such entry is available. */
- const cooked_index_entry *get_main () const
- {
- return m_main;
- }
+ const cooked_index_entry *get_main () const { return m_main; }
/* Look up ADDR in the address map, and return either the
corresponding CU, or nullptr if the address could not be
@@ -301,16 +293,13 @@ private:
/* Create a new cooked_index_entry and register it with this object.
Entries are owned by this object. The new item is returned. */
- cooked_index_entry *create (sect_offset die_offset,
- enum dwarf_tag tag,
- cooked_index_flag flags,
- const char *name,
+ cooked_index_entry *create (sect_offset die_offset, enum dwarf_tag tag,
+ cooked_index_flag flags, const char *name,
const cooked_index_entry *parent_entry,
dwarf2_per_cu_data *per_cu)
{
- return new (&m_storage) cooked_index_entry (die_offset, tag, flags,
- name, parent_entry,
- per_cu);
+ return new (&m_storage)
+ cooked_index_entry (die_offset, tag, flags, name, parent_entry, per_cu);
}
/* GNAT only emits mangled ("encoded") names in the DWARF, and does
@@ -318,8 +307,8 @@ private:
to do lookups. This function recreates that structure for an
existing entry. It returns the base name (last element) of the
full decoded name. */
- gdb::unique_xmalloc_ptr<char> handle_gnat_encoded_entry
- (cooked_index_entry *entry, htab_t gnat_entries);
+ gdb::unique_xmalloc_ptr<char>
+ handle_gnat_encoded_entry (cooked_index_entry *entry, htab_t gnat_entries);
/* A helper method that does the work of 'finalize'. */
void do_finalize ();
@@ -408,10 +397,7 @@ public:
"main". This will return NULL if no such entry is available. */
const cooked_index_entry *get_main () const;
- cooked_index *index_for_writing () override
- {
- return this;
- }
+ cooked_index *index_for_writing () override { return this; }
quick_symbol_functions_up make_quick_functions () const override;
diff --git a/gdb/dwarf2/cu.c b/gdb/dwarf2/cu.c
index 9c1691c90e9..0dd51cb5434 100644
--- a/gdb/dwarf2/cu.c
+++ b/gdb/dwarf2/cu.c
@@ -76,9 +76,9 @@ dwarf2_cu::start_compunit_symtab (const char *name, const char *comp_dir,
name_for_id = name_for_id_holder.c_str ();
}
- m_builder.reset (new struct buildsym_compunit
- (this->per_objfile->objfile,
- name, comp_dir, name_for_id, lang (), low_pc));
+ m_builder.reset (new struct buildsym_compunit (this->per_objfile->objfile,
+ name, comp_dir, name_for_id,
+ lang (), low_pc));
list_in_scope = get_builder ()->get_file_symbols ();
@@ -158,9 +158,8 @@ dwarf2_cu::add_dependence (struct dwarf2_per_cu_data *ref_per_cu)
if (m_dependencies == nullptr)
m_dependencies
- = htab_create_alloc_ex (5, htab_hash_pointer, htab_eq_pointer,
- NULL, &comp_unit_obstack,
- hashtab_obstack_allocate,
+ = htab_create_alloc_ex (5, htab_hash_pointer, htab_eq_pointer, NULL,
+ &comp_unit_obstack, hashtab_obstack_allocate,
dummy_obstack_deallocate);
slot = htab_find_slot (m_dependencies, ref_per_cu, INSERT);
diff --git a/gdb/dwarf2/cu.h b/gdb/dwarf2/cu.h
index 8059b70f721..f54b173e383 100644
--- a/gdb/dwarf2/cu.h
+++ b/gdb/dwarf2/cu.h
@@ -83,16 +83,10 @@ struct dwarf2_cu
void mark ();
/* Clear the mark on this CU. */
- void clear_mark ()
- {
- m_mark = false;
- }
+ void clear_mark () { m_mark = false; }
/* True if this CU has been marked. */
- bool is_marked () const
- {
- return m_mark;
- }
+ bool is_marked () const { return m_mark; }
/* Add a dependence relationship from this cu to REF_PER_CU. */
void add_dependence (struct dwarf2_per_cu_data *ref_per_cu);
@@ -115,6 +109,7 @@ struct dwarf2_cu
const char *producer = nullptr;
private:
+
/* The symtab builder for this CU. This is only non-NULL when full
symbols are being read. */
std::unique_ptr<buildsym_compunit> m_builder;
@@ -125,6 +120,7 @@ private:
htab_t m_dependencies = nullptr;
public:
+
/* The generic symbol table building routines have separate lists for
file scope symbols and all all other scopes (local scopes). So
we need to select the right one to pass to add_symbol_to_list().
diff --git a/gdb/dwarf2/die.h b/gdb/dwarf2/die.h
index ae46514c859..944c2389f3f 100644
--- a/gdb/dwarf2/die.h
+++ b/gdb/dwarf2/die.h
@@ -42,14 +42,14 @@ struct die_info
{
for (unsigned i = 0; i < num_attrs; ++i)
if (attrs[i].name == DW_AT_addr_base
- || attrs[i].name == DW_AT_GNU_addr_base)
+ || attrs[i].name == DW_AT_GNU_addr_base)
{
if (attrs[i].form_is_unsigned ())
{
/* If both exist, just use the first one. */
return attrs[i].as_unsigned ();
}
- complaint (_("address base attribute (offset %s) as wrong form"),
+ complaint (_ ("address base attribute (offset %s) as wrong form"),
sect_offset_str (sect_off));
}
return gdb::optional<ULONGEST> ();
@@ -66,7 +66,7 @@ struct die_info
if (attrs[i].form_is_unsigned ())
return attrs[i].as_unsigned ();
- complaint (_("ranges base attribute (offset %s) has wrong form"),
+ complaint (_ ("ranges base attribute (offset %s) has wrong form"),
sect_offset_str (sect_off));
}
@@ -83,7 +83,7 @@ struct die_info
if (attrs[i].form_is_unsigned ())
return attrs[i].as_unsigned ();
- complaint (_("rnglists base attribute (offset %s) has wrong form"),
+ complaint (_ ("rnglists base attribute (offset %s) has wrong form"),
sect_offset_str (sect_off));
}
@@ -91,7 +91,7 @@ struct die_info
}
/* DWARF-2 tag for this DIE. */
- ENUM_BITFIELD(dwarf_tag) tag : 16;
+ ENUM_BITFIELD (dwarf_tag) tag : 16;
/* Number of attributes */
unsigned char num_attrs;
@@ -116,9 +116,9 @@ struct die_info
points to this die's parent; CHILD points to the first child of
this node; and all the children of a given node are chained
together via their SIBLING fields. */
- struct die_info *child; /* Its first child, if any. */
- struct die_info *sibling; /* Its next sibling, if any. */
- struct die_info *parent; /* Its parent, if any. */
+ struct die_info *child; /* Its first child, if any. */
+ struct die_info *sibling; /* Its next sibling, if any. */
+ struct die_info *parent; /* Its parent, if any. */
/* An array of attributes, with NUM_ATTRS elements. There may be
zero, but it's not common and zero-sized arrays are not
diff --git a/gdb/dwarf2/dwz.c b/gdb/dwarf2/dwz.c
index 447c942da6a..3a098568996 100644
--- a/gdb/dwarf2/dwz.c
+++ b/gdb/dwarf2/dwz.c
@@ -36,12 +36,12 @@ dwz_file::read_string (struct objfile *objfile, LONGEST str_offset)
str.read (objfile);
if (str.buffer == NULL)
- error (_("DW_FORM_GNU_strp_alt used without .debug_str "
- "section [in module %s]"),
+ error (_ ("DW_FORM_GNU_strp_alt used without .debug_str "
+ "section [in module %s]"),
bfd_get_filename (dwz_bfd.get ()));
if (str_offset >= str.size)
- error (_("DW_FORM_GNU_strp_alt pointing outside of "
- ".debug_str section [in module %s]"),
+ error (_ ("DW_FORM_GNU_strp_alt pointing outside of "
+ ".debug_str section [in module %s]"),
bfd_get_filename (dwz_bfd.get ()));
gdb_assert (HOST_CHAR_BIT == 8);
if (str.buffer[str_offset] == '\0')
@@ -195,18 +195,17 @@ dwarf2_get_dwz_file (dwarf2_per_bfd *per_bfd, bool require)
return per_bfd->dwz_file.get ();
bfd_set_error (bfd_error_no_error);
- gdb::unique_xmalloc_ptr<char> data
- (bfd_get_alt_debug_link_info (per_bfd->obfd,
- &buildid_len_arg, &buildid));
+ gdb::unique_xmalloc_ptr<char> data (
+ bfd_get_alt_debug_link_info (per_bfd->obfd, &buildid_len_arg, &buildid));
if (data == NULL)
{
if (bfd_get_error () == bfd_error_no_error)
{
if (!require)
return nullptr;
- error (_("could not read '.gnu_debugaltlink' section"));
+ error (_ ("could not read '.gnu_debugaltlink' section"));
}
- error (_("could not read '.gnu_debugaltlink' section: %s"),
+ error (_ ("could not read '.gnu_debugaltlink' section: %s"),
bfd_errmsg (bfd_get_error ()));
}
@@ -248,9 +247,7 @@ dwarf2_get_dwz_file (dwarf2_per_bfd *per_bfd, bool require)
gdb::unique_xmalloc_ptr<char> alt_filename;
const char *origname = bfd_get_filename (per_bfd->obfd);
- scoped_fd fd (debuginfod_debuginfo_query (buildid,
- buildid_len,
- origname,
+ scoped_fd fd (debuginfod_debuginfo_query (buildid, buildid_len, origname,
&alt_filename));
if (fd.get () >= 0)
@@ -259,7 +256,7 @@ dwarf2_get_dwz_file (dwarf2_per_bfd *per_bfd, bool require)
dwz_bfd = gdb_bfd_open (alt_filename.get (), gnutarget);
if (dwz_bfd == nullptr)
- warning (_("File \"%s\" from debuginfod cannot be opened as bfd"),
+ warning (_ ("File \"%s\" from debuginfod cannot be opened as bfd"),
alt_filename.get ());
else if (!build_id_verify (dwz_bfd.get (), buildid_len, buildid))
dwz_bfd.reset (nullptr);
@@ -267,11 +264,11 @@ dwarf2_get_dwz_file (dwarf2_per_bfd *per_bfd, bool require)
}
if (dwz_bfd == NULL)
- error (_("could not find '.gnu_debugaltlink' file for %s"),
+ error (_ ("could not find '.gnu_debugaltlink' file for %s"),
bfd_get_filename (per_bfd->obfd));
- std::unique_ptr<struct dwz_file> result
- (new struct dwz_file (std::move (dwz_bfd)));
+ std::unique_ptr<struct dwz_file> result (
+ new struct dwz_file (std::move (dwz_bfd)));
for (asection *sec : gdb_bfd_sections (result->dwz_bfd))
locate_dwz_sections (result->dwz_bfd.get (), sec, result.get ());
diff --git a/gdb/dwarf2/dwz.h b/gdb/dwarf2/dwz.h
index 232b4dbce01..f3fd81b9ec7 100644
--- a/gdb/dwarf2/dwz.h
+++ b/gdb/dwarf2/dwz.h
@@ -41,13 +41,33 @@ struct dwz_file
}
/* A dwz file can only contain a few sections. */
- struct dwarf2_section_info abbrev {};
- struct dwarf2_section_info info {};
- struct dwarf2_section_info str {};
- struct dwarf2_section_info line {};
- struct dwarf2_section_info macro {};
- struct dwarf2_section_info gdb_index {};
- struct dwarf2_section_info debug_names {};
+ struct dwarf2_section_info abbrev
+ {
+ };
+
+ struct dwarf2_section_info info
+ {
+ };
+
+ struct dwarf2_section_info str
+ {
+ };
+
+ struct dwarf2_section_info line
+ {
+ };
+
+ struct dwarf2_section_info macro
+ {
+ };
+
+ struct dwarf2_section_info gdb_index
+ {
+ };
+
+ struct dwarf2_section_info debug_names
+ {
+ };
/* The dwz's BFD. */
gdb_bfd_ref_ptr dwz_bfd;
diff --git a/gdb/dwarf2/expr.c b/gdb/dwarf2/expr.c
index eecd18f59c9..c9aa2e07d17 100644
--- a/gdb/dwarf2/expr.c
+++ b/gdb/dwarf2/expr.c
@@ -52,18 +52,18 @@ static void
ensure_have_frame (frame_info_ptr frame, const char *op_name)
{
if (frame == nullptr)
- throw_error (GENERIC_ERROR,
- _("%s evaluation requires a frame."), op_name);
+ throw_error (GENERIC_ERROR, _ ("%s evaluation requires a frame."),
+ op_name);
}
/* Ensure that a PER_CU is defined and throw an exception otherwise. */
static void
-ensure_have_per_cu (dwarf2_per_cu_data *per_cu, const char* op_name)
+ensure_have_per_cu (dwarf2_per_cu_data *per_cu, const char *op_name)
{
if (per_cu == nullptr)
throw_error (GENERIC_ERROR,
- _("%s evaluation requires a compilation unit."), op_name);
+ _ ("%s evaluation requires a compilation unit."), op_name);
}
/* Return the number of bytes overlapping a contiguous chunk of N_BITS
@@ -148,8 +148,7 @@ rw_pieced_value (value *v, value *from, bool check_optimized)
LONGEST offset = 0, max_offset;
gdb_byte *v_contents;
const gdb_byte *from_contents;
- piece_closure *c
- = (piece_closure *) value_computed_closure (v);
+ piece_closure *c = (piece_closure *) value_computed_closure (v);
gdb::byte_vector buffer;
bool bits_big_endian = type_byte_order (value_type (v)) == BFD_ENDIAN_BIG;
@@ -171,11 +170,9 @@ rw_pieced_value (value *v, value *from, bool check_optimized)
ULONGEST bits_to_skip = 8 * value_offset (v);
if (value_bitsize (v))
{
- bits_to_skip += (8 * value_offset (value_parent (v))
- + value_bitpos (v));
+ bits_to_skip += (8 * value_offset (value_parent (v)) + value_bitpos (v));
if (from != nullptr
- && (type_byte_order (value_type (from))
- == BFD_ENDIAN_BIG))
+ && (type_byte_order (value_type (from)) == BFD_ENDIAN_BIG))
{
/* Use the least significant bits of FROM. */
max_offset = 8 * value_type (from)->length ();
@@ -226,8 +223,8 @@ rw_pieced_value (value *v, value *from, bool check_optimized)
{
/* Read mode. */
if (!get_frame_register_bytes (frame, gdb_regnum,
- bits_to_skip / 8,
- buffer, &optim, &unavail))
+ bits_to_skip / 8, buffer,
+ &optim, &unavail))
{
if (optim)
{
@@ -237,15 +234,14 @@ rw_pieced_value (value *v, value *from, bool check_optimized)
this_size_bits);
}
if (unavail && !check_optimized)
- mark_value_bits_unavailable (v, offset,
- this_size_bits);
+ mark_value_bits_unavailable (v, offset, this_size_bits);
break;
}
if (!check_optimized)
- copy_bitwise (v_contents, offset,
- buffer.data (), bits_to_skip % 8,
- this_size_bits, bits_big_endian);
+ copy_bitwise (v_contents, offset, buffer.data (),
+ bits_to_skip % 8, this_size_bits,
+ bits_big_endian);
}
else
{
@@ -255,25 +251,23 @@ rw_pieced_value (value *v, value *from, bool check_optimized)
/* Data is copied non-byte-aligned into the register.
Need some bits from original register value. */
get_frame_register_bytes (frame, gdb_regnum,
- bits_to_skip / 8,
- buffer, &optim, &unavail);
+ bits_to_skip / 8, buffer, &optim,
+ &unavail);
if (optim)
throw_error (OPTIMIZED_OUT_ERROR,
- _("Can't do read-modify-write to "
- "update bitfield; containing word "
- "has been optimized out"));
+ _ ("Can't do read-modify-write to "
+ "update bitfield; containing word "
+ "has been optimized out"));
if (unavail)
throw_error (NOT_AVAILABLE_ERROR,
- _("Can't do read-modify-write to "
- "update bitfield; containing word "
- "is unavailable"));
+ _ ("Can't do read-modify-write to "
+ "update bitfield; containing word "
+ "is unavailable"));
}
- copy_bitwise (buffer.data (), bits_to_skip % 8,
- from_contents, offset,
- this_size_bits, bits_big_endian);
- put_frame_register_bytes (frame, gdb_regnum,
- bits_to_skip / 8,
+ copy_bitwise (buffer.data (), bits_to_skip % 8, from_contents,
+ offset, this_size_bits, bits_big_endian);
+ put_frame_register_bytes (frame, gdb_regnum, bits_to_skip / 8,
buffer);
}
}
@@ -294,12 +288,10 @@ rw_pieced_value (value *v, value *from, bool check_optimized)
/* Everything is byte-aligned; no buffer needed. */
if (from != nullptr)
write_memory_with_notification (start_addr,
- (from_contents
- + offset / 8),
+ (from_contents + offset / 8),
this_size_bits / 8);
else
- read_value_memory (v, offset,
- p->v.mem.in_stack_memory,
+ read_value_memory (v, offset, p->v.mem.in_stack_memory,
p->v.mem.addr + bits_to_skip / 8,
v_contents + offset / 8,
this_size_bits / 8);
@@ -312,13 +304,12 @@ rw_pieced_value (value *v, value *from, bool check_optimized)
if (from == nullptr)
{
/* Read mode. */
- read_value_memory (v, offset,
- p->v.mem.in_stack_memory,
+ read_value_memory (v, offset, p->v.mem.in_stack_memory,
p->v.mem.addr + bits_to_skip / 8,
buffer.data (), this_size);
- copy_bitwise (v_contents, offset,
- buffer.data (), bits_to_skip % 8,
- this_size_bits, bits_big_endian);
+ copy_bitwise (v_contents, offset, buffer.data (),
+ bits_to_skip % 8, this_size_bits,
+ bits_big_endian);
}
else
{
@@ -328,8 +319,7 @@ rw_pieced_value (value *v, value *from, bool check_optimized)
if (this_size <= 8)
{
/* Perform a single read for small sizes. */
- read_memory (start_addr, buffer.data (),
- this_size);
+ read_memory (start_addr, buffer.data (), this_size);
}
else
{
@@ -341,11 +331,9 @@ rw_pieced_value (value *v, value *from, bool check_optimized)
}
}
- copy_bitwise (buffer.data (), bits_to_skip % 8,
- from_contents, offset,
- this_size_bits, bits_big_endian);
- write_memory_with_notification (start_addr,
- buffer.data (),
+ copy_bitwise (buffer.data (), bits_to_skip % 8, from_contents,
+ offset, this_size_bits, bits_big_endian);
+ write_memory_with_notification (start_addr, buffer.data (),
this_size);
}
}
@@ -378,8 +366,7 @@ rw_pieced_value (value *v, value *from, bool check_optimized)
copy_bitwise (v_contents, offset,
value_contents_all (p->v.value).data (),
- bits_to_skip,
- this_size_bits, bits_big_endian);
+ bits_to_skip, this_size_bits, bits_big_endian);
}
break;
@@ -404,18 +391,17 @@ rw_pieced_value (value *v, value *from, bool check_optimized)
if (n > literal_size_bits - bits_to_skip)
n = literal_size_bits - bits_to_skip;
- copy_bitwise (v_contents, offset,
- p->v.literal.data, bits_to_skip,
+ copy_bitwise (v_contents, offset, p->v.literal.data, bits_to_skip,
n, bits_big_endian);
}
break;
case DWARF_VALUE_IMPLICIT_POINTER:
- if (from != nullptr)
- {
- mark_value_bits_optimized_out (v, offset, this_size_bits);
- break;
- }
+ if (from != nullptr)
+ {
+ mark_value_bits_optimized_out (v, offset, this_size_bits);
+ break;
+ }
/* These bits show up as zeros -- but do not cause the value to
be considered optimized-out. */
@@ -428,7 +414,7 @@ rw_pieced_value (value *v, value *from, bool check_optimized)
break;
default:
- internal_error (_("invalid location type"));
+ internal_error (_ ("invalid location type"));
}
offset += this_size_bits;
@@ -502,8 +488,7 @@ check_pieced_synthetic_pointer (const value *value, LONGEST bit_offset,
static value *
indirect_pieced_value (value *value)
{
- piece_closure *c
- = (piece_closure *) value_computed_closure (value);
+ piece_closure *c = (piece_closure *) value_computed_closure (value);
int i;
dwarf_expr_piece *piece = NULL;
@@ -539,14 +524,14 @@ indirect_pieced_value (value *value)
return NULL;
if (bit_length != 0)
- error (_("Invalid use of DW_OP_implicit_pointer"));
+ error (_ ("Invalid use of DW_OP_implicit_pointer"));
piece = p;
break;
}
gdb_assert (piece != NULL && c->per_cu != nullptr);
- frame_info_ptr frame = get_selected_frame (_("No frame selected."));
+ frame_info_ptr frame = get_selected_frame (_ ("No frame selected."));
/* This is an offset requested by GDB, such as value subscripts.
However, due to how synthetic pointers are implemented, this is
@@ -563,9 +548,8 @@ indirect_pieced_value (value *value)
= extract_signed_integer (value_contents (value), byte_order);
byte_offset += piece->v.ptr.offset;
- return indirect_synthetic_pointer (piece->v.ptr.die_sect_off,
- byte_offset, c->per_cu,
- c->per_objfile, frame, type);
+ return indirect_synthetic_pointer (piece->v.ptr.die_sect_off, byte_offset,
+ c->per_cu, c->per_objfile, frame, type);
}
/* Implementation of the coerce_ref method of lval_funcs for synthetic C++
@@ -581,18 +565,17 @@ coerce_pieced_ref (const value *value)
{
const piece_closure *closure
= (piece_closure *) value_computed_closure (value);
- frame_info_ptr frame
- = get_selected_frame (_("No frame selected."));
+ frame_info_ptr frame = get_selected_frame (_ ("No frame selected."));
/* gdb represents synthetic pointers as pieced values with a single
piece. */
gdb_assert (closure != NULL);
gdb_assert (closure->pieces.size () == 1);
- return indirect_synthetic_pointer
- (closure->pieces[0].v.ptr.die_sect_off,
- closure->pieces[0].v.ptr.offset,
- closure->per_cu, closure->per_objfile, frame, type);
+ return indirect_synthetic_pointer (closure->pieces[0].v.ptr.die_sect_off,
+ closure->pieces[0].v.ptr.offset,
+ closure->per_cu, closure->per_objfile,
+ frame, type);
}
else
{
@@ -627,24 +610,22 @@ free_pieced_value_closure (value *v)
}
/* Functions for accessing a variable described by DW_OP_piece. */
-static const struct lval_funcs pieced_value_funcs = {
- read_pieced_value,
- write_pieced_value,
- is_optimized_out_pieced_value,
- indirect_pieced_value,
- coerce_pieced_ref,
- check_pieced_synthetic_pointer,
- copy_pieced_value_closure,
- free_pieced_value_closure
-};
+static const struct lval_funcs pieced_value_funcs
+ = { read_pieced_value,
+ write_pieced_value,
+ is_optimized_out_pieced_value,
+ indirect_pieced_value,
+ coerce_pieced_ref,
+ check_pieced_synthetic_pointer,
+ copy_pieced_value_closure,
+ free_pieced_value_closure };
/* Given context CTX, section offset SECT_OFF, and compilation unit
data PER_CU, execute the "variable value" operation on the DIE
found at SECT_OFF. */
static value *
-sect_variable_value (sect_offset sect_off,
- dwarf2_per_cu_data *per_cu,
+sect_variable_value (sect_offset sect_off, dwarf2_per_cu_data *per_cu,
dwarf2_per_objfile *per_objfile)
{
const char *var_name = nullptr;
@@ -653,15 +634,15 @@ sect_variable_value (sect_offset sect_off,
&var_name);
if (die_type == NULL)
- error (_("Bad DW_OP_GNU_variable_value DIE."));
+ error (_ ("Bad DW_OP_GNU_variable_value DIE."));
/* Note: Things still work when the following test is removed. This
test and error is here to conform to the proposed specification. */
- if (die_type->code () != TYPE_CODE_INT
- && die_type->code () != TYPE_CODE_ENUM
+ if (die_type->code () != TYPE_CODE_INT && die_type->code () != TYPE_CODE_ENUM
&& die_type->code () != TYPE_CODE_RANGE
&& die_type->code () != TYPE_CODE_PTR)
- error (_("Type of DW_OP_GNU_variable_value DIE must be an integer or pointer."));
+ error (_ (
+ "Type of DW_OP_GNU_variable_value DIE must be an integer or pointer."));
if (var_name != nullptr)
{
@@ -671,7 +652,7 @@ sect_variable_value (sect_offset sect_off,
}
struct type *type = lookup_pointer_type (die_type);
- frame_info_ptr frame = get_selected_frame (_("No frame selected."));
+ frame_info_ptr frame = get_selected_frame (_ ("No frame selected."));
return indirect_synthetic_pointer (sect_off, 0, per_cu, per_objfile, frame,
type, true);
}
@@ -696,13 +677,12 @@ dwarf_expr_context::address_type () const
else if (this->m_addr_size == 8)
ndx = 2;
else
- error (_("Unsupported address size in DWARF expressions: %d bits"),
+ error (_ ("Unsupported address size in DWARF expressions: %d bits"),
8 * this->m_addr_size);
if (types->dw_types[ndx] == NULL)
- types->dw_types[ndx]
- = arch_integer_type (arch, 8 * this->m_addr_size,
- 0, "<signed DWARF address type>");
+ types->dw_types[ndx] = arch_integer_type (arch, 8 * this->m_addr_size, 0,
+ "<signed DWARF address type>");
return types->dw_types[ndx];
}
@@ -711,8 +691,8 @@ dwarf_expr_context::address_type () const
dwarf_expr_context::dwarf_expr_context (dwarf2_per_objfile *per_objfile,
int addr_size)
-: m_addr_size (addr_size),
- m_per_objfile (per_objfile)
+ : m_addr_size (addr_size),
+ m_per_objfile (per_objfile)
{
}
@@ -738,7 +718,7 @@ void
dwarf_expr_context::pop ()
{
if (this->m_stack.empty ())
- error (_("dwarf expression stack underflow"));
+ error (_ ("dwarf expression stack underflow"));
this->m_stack.pop_back ();
}
@@ -749,24 +729,23 @@ struct value *
dwarf_expr_context::fetch (int n)
{
if (this->m_stack.size () <= n)
- error (_("Asked for position %d of stack, "
+ error (_ ("Asked for position %d of stack, "
"stack only has %zu elements on it."),
- n, this->m_stack.size ());
+ n, this->m_stack.size ());
return this->m_stack[this->m_stack.size () - (1 + n)].value;
}
/* See expr.h. */
void
-dwarf_expr_context::get_frame_base (const gdb_byte **start,
- size_t * length)
+dwarf_expr_context::get_frame_base (const gdb_byte **start, size_t *length)
{
ensure_have_frame (this->m_frame, "DW_OP_fbreg");
const block *bl = get_frame_block (this->m_frame, NULL);
if (bl == NULL)
- error (_("frame address is not available."));
+ error (_ ("frame address is not available."));
/* Use block_linkage_function, which returns a real (not inlined)
function, instead of get_frame_function, which may return an
@@ -791,11 +770,11 @@ dwarf_expr_context::get_base_type (cu_offset die_cu_off)
if (this->m_per_cu == nullptr)
return builtin_type (this->m_per_objfile->objfile->arch ())->builtin_int;
- struct type *result = dwarf2_get_die_type (die_cu_off, this->m_per_cu,
- this->m_per_objfile);
+ struct type *result
+ = dwarf2_get_die_type (die_cu_off, this->m_per_cu, this->m_per_objfile);
if (result == nullptr)
- error (_("Could not find type for operation"));
+ error (_ ("Could not find type for operation"));
return result;
}
@@ -809,11 +788,10 @@ dwarf_expr_context::dwarf_call (cu_offset die_cu_off)
frame_info_ptr frame = this->m_frame;
- auto get_pc_from_frame = [frame] ()
- {
- ensure_have_frame (frame, "DW_OP_call");
- return get_frame_address_in_block (frame);
- };
+ auto get_pc_from_frame = [frame] () {
+ ensure_have_frame (frame, "DW_OP_call");
+ return get_frame_address_in_block (frame);
+ };
dwarf2_locexpr_baton block
= dwarf2_fetch_die_loc_cu_off (die_cu_off, this->m_per_cu,
@@ -828,8 +806,7 @@ dwarf_expr_context::dwarf_call (cu_offset die_cu_off)
/* See expr.h. */
void
-dwarf_expr_context::read_mem (gdb_byte *buf, CORE_ADDR addr,
- size_t length)
+dwarf_expr_context::read_mem (gdb_byte *buf, CORE_ADDR addr, size_t length)
{
if (length == 0)
return;
@@ -865,8 +842,7 @@ dwarf_expr_context::push_dwarf_reg_entry_value (call_site_parameter_kind kind,
frame_info_ptr caller_frame = get_prev_frame (this->m_frame);
call_site_parameter *parameter
= dwarf_expr_reg_to_entry_parameter (this->m_frame, kind, kind_u,
- &caller_per_cu,
- &caller_per_objfile);
+ &caller_per_cu, &caller_per_objfile);
const gdb_byte *data_src
= deref_size == -1 ? parameter->value : parameter->data_value;
size_t size
@@ -875,7 +851,7 @@ dwarf_expr_context::push_dwarf_reg_entry_value (call_site_parameter_kind kind,
/* DEREF_SIZE size is not verified here. */
if (data_src == nullptr)
throw_error (NO_ENTRY_VALUE_ERROR,
- _("Cannot resolve DW_AT_call_data_value"));
+ _ ("Cannot resolve DW_AT_call_data_value"));
/* We are about to evaluate an expression in the context of the caller
of the current frame. This evaluation context may be different from
@@ -883,14 +859,14 @@ dwarf_expr_context::push_dwarf_reg_entry_value (call_site_parameter_kind kind,
It is possible for the caller to be from a different objfile from the
callee if the call is made through a function pointer. */
- scoped_restore save_frame = make_scoped_restore (&this->m_frame,
- caller_frame);
- scoped_restore save_per_cu = make_scoped_restore (&this->m_per_cu,
- caller_per_cu);
- scoped_restore save_addr_info = make_scoped_restore (&this->m_addr_info,
- nullptr);
- scoped_restore save_per_objfile = make_scoped_restore (&this->m_per_objfile,
- caller_per_objfile);
+ scoped_restore save_frame
+ = make_scoped_restore (&this->m_frame, caller_frame);
+ scoped_restore save_per_cu
+ = make_scoped_restore (&this->m_per_cu, caller_per_cu);
+ scoped_restore save_addr_info
+ = make_scoped_restore (&this->m_addr_info, nullptr);
+ scoped_restore save_per_objfile
+ = make_scoped_restore (&this->m_per_objfile, caller_per_objfile);
scoped_restore save_addr_size = make_scoped_restore (&this->m_addr_size);
this->m_addr_size = this->m_per_cu->addr_size ();
@@ -932,8 +908,7 @@ dwarf_expr_context::fetch_result (struct type *type, struct type *subobj_type,
piece_closure *c
= allocate_piece_closure (this->m_per_cu, this->m_per_objfile,
std::move (this->m_pieces), this->m_frame);
- retval = allocate_computed_value (subobj_type,
- &pieced_value_funcs, c);
+ retval = allocate_computed_value (subobj_type, &pieced_value_funcs, c);
set_value_offset (retval, subobj_offset);
}
else
@@ -950,16 +925,16 @@ dwarf_expr_context::fetch_result (struct type *type, struct type *subobj_type,
gdbarch *f_arch = get_frame_arch (this->m_frame);
int dwarf_regnum
= longest_to_int (value_as_long (this->fetch (0)));
- int gdb_regnum = dwarf_reg_to_regnum_or_error (f_arch,
- dwarf_regnum);
+ int gdb_regnum
+ = dwarf_reg_to_regnum_or_error (f_arch, dwarf_regnum);
if (subobj_offset != 0)
- error (_("cannot use offset on synthetic pointer to register"));
+ error (_ ("cannot use offset on synthetic pointer to register"));
gdb_assert (this->m_frame != NULL);
- retval = value_from_register (subobj_type, gdb_regnum,
- this->m_frame);
+ retval
+ = value_from_register (subobj_type, gdb_regnum, this->m_frame);
if (value_optimized_out (retval))
{
/* This means the register has undefined value / was
@@ -992,18 +967,18 @@ dwarf_expr_context::fetch_result (struct type *type, struct type *subobj_type,
switch (subobj_type->code ())
{
- case TYPE_CODE_FUNC:
- case TYPE_CODE_METHOD:
- ptr_type = builtin_type (arch)->builtin_func_ptr;
- break;
- default:
- ptr_type = builtin_type (arch)->builtin_data_ptr;
- break;
+ case TYPE_CODE_FUNC:
+ case TYPE_CODE_METHOD:
+ ptr_type = builtin_type (arch)->builtin_func_ptr;
+ break;
+ default:
+ ptr_type = builtin_type (arch)->builtin_data_ptr;
+ break;
}
- address = value_as_address (value_from_pointer (ptr_type, address));
+ address
+ = value_as_address (value_from_pointer (ptr_type, address));
- retval = value_at_lazy (subobj_type,
- address + subobj_offset);
+ retval = value_at_lazy (subobj_type, address + subobj_offset);
if (in_stack_memory)
set_value_stack (retval, 1);
}
@@ -1053,7 +1028,7 @@ dwarf_expr_context::fetch_result (struct type *type, struct type *subobj_type,
/* DWARF_VALUE_OPTIMIZED_OUT can't occur in this context --
it can only be encountered when making a piece. */
default:
- internal_error (_("invalid location type"));
+ internal_error (_ ("invalid location type"));
}
}
@@ -1084,10 +1059,9 @@ dwarf_expr_context::evaluate (const gdb_byte *addr, size_t len, bool as_lval,
static void
dwarf_require_integral (struct type *type)
{
- if (type->code () != TYPE_CODE_INT
- && type->code () != TYPE_CODE_CHAR
+ if (type->code () != TYPE_CODE_INT && type->code () != TYPE_CODE_CHAR
&& type->code () != TYPE_CODE_BOOL)
- error (_("integral type expected in DWARF expression"));
+ error (_ ("integral type expected in DWARF expression"));
}
/* Return the unsigned form of TYPE. TYPE is necessarily an integral
@@ -1107,8 +1081,8 @@ get_unsigned_type (struct gdbarch *gdbarch, struct type *type)
case 8:
return builtin_type (gdbarch)->builtin_uint64;
default:
- error (_("no unsigned variant found for type, while evaluating "
- "DWARF expression"));
+ error (_ ("no unsigned variant found for type, while evaluating "
+ "DWARF expression"));
}
}
@@ -1129,8 +1103,8 @@ get_signed_type (struct gdbarch *gdbarch, struct type *type)
case 8:
return builtin_type (gdbarch)->builtin_int64;
default:
- error (_("no signed variant found for type, while evaluating "
- "DWARF expression"));
+ error (_ ("no signed variant found for type, while evaluating "
+ "DWARF expression"));
}
}
@@ -1156,8 +1130,7 @@ dwarf_expr_context::fetch_address (int n)
if (gdbarch_integer_to_address_p (arch))
{
gdb_byte *buf = (gdb_byte *) alloca (this->m_addr_size);
- type *int_type = get_unsigned_type (arch,
- value_type (result_val));
+ type *int_type = get_unsigned_type (arch, value_type (result_val));
store_unsigned_integer (buf, this->m_addr_size, byte_order, result);
return gdbarch_integer_to_address (arch, int_type, buf);
@@ -1172,9 +1145,9 @@ bool
dwarf_expr_context::fetch_in_stack_memory (int n)
{
if (this->m_stack.size () <= n)
- error (_("Asked for position %d of stack, "
+ error (_ ("Asked for position %d of stack, "
"stack only has %zu elements on it."),
- n, this->m_stack.size ());
+ n, this->m_stack.size ());
return this->m_stack[this->m_stack.size () - (1 + n)].in_stack_memory;
}
@@ -1246,24 +1219,24 @@ dwarf_expr_context::eval (const gdb_byte *addr, size_t len)
/* Helper to read a uleb128 value or throw an error. */
const gdb_byte *
-safe_read_uleb128 (const gdb_byte *buf, const gdb_byte *buf_end,
- uint64_t *r)
+safe_read_uleb128 (const gdb_byte *buf, const gdb_byte *buf_end, uint64_t *r)
{
buf = gdb_read_uleb128 (buf, buf_end, r);
if (buf == NULL)
- error (_("DWARF expression error: ran off end of buffer reading uleb128 value"));
+ error (_ (
+ "DWARF expression error: ran off end of buffer reading uleb128 value"));
return buf;
}
/* Helper to read a sleb128 value or throw an error. */
const gdb_byte *
-safe_read_sleb128 (const gdb_byte *buf, const gdb_byte *buf_end,
- int64_t *r)
+safe_read_sleb128 (const gdb_byte *buf, const gdb_byte *buf_end, int64_t *r)
{
buf = gdb_read_sleb128 (buf, buf_end, r);
if (buf == NULL)
- error (_("DWARF expression error: ran off end of buffer reading sleb128 value"));
+ error (_ (
+ "DWARF expression error: ran off end of buffer reading sleb128 value"));
return buf;
}
@@ -1272,10 +1245,10 @@ safe_skip_leb128 (const gdb_byte *buf, const gdb_byte *buf_end)
{
buf = gdb_skip_leb128 (buf, buf_end);
if (buf == NULL)
- error (_("DWARF expression error: ran off end of buffer reading leb128 value"));
+ error (_ (
+ "DWARF expression error: ran off end of buffer reading leb128 value"));
return buf;
}
-
/* Check that the current operator is either at the end of an
expression, or that it is followed by a composition operator or by
@@ -1287,9 +1260,9 @@ dwarf_expr_require_composition (const gdb_byte *op_ptr, const gdb_byte *op_end,
{
if (op_ptr != op_end && *op_ptr != DW_OP_piece && *op_ptr != DW_OP_bit_piece
&& *op_ptr != DW_OP_GNU_uninit)
- error (_("DWARF-2 expression error: `%s' operations must be "
- "used either alone or in conjunction with DW_OP_piece "
- "or DW_OP_bit_piece."),
+ error (_ ("DWARF-2 expression error: `%s' operations must be "
+ "used either alone or in conjunction with DW_OP_piece "
+ "or DW_OP_bit_piece."),
op_name);
}
@@ -1377,7 +1350,7 @@ dwarf_block_to_dwarf_reg_deref (const gdb_byte *buf, const gdb_byte *buf_end,
if (buf == NULL)
return -1;
if ((int) dwarf_reg != dwarf_reg)
- return -1;
+ return -1;
}
else
return -1;
@@ -1397,7 +1370,7 @@ dwarf_block_to_dwarf_reg_deref (const gdb_byte *buf, const gdb_byte *buf_end,
{
buf++;
if (buf >= buf_end)
- return -1;
+ return -1;
*deref_size_return = *buf++;
}
else
@@ -1456,15 +1429,14 @@ dwarf_block_to_sp_offset (struct gdbarch *gdbarch, const gdb_byte *buf,
else
{
if (*buf != DW_OP_bregx)
- return 0;
+ return 0;
buf++;
buf = gdb_read_uleb128 (buf, buf_end, &dwarf_reg);
if (buf == NULL)
return 0;
}
- if (dwarf_reg_to_regnum (gdbarch, dwarf_reg)
- != gdbarch_sp_regnum (gdbarch))
+ if (dwarf_reg_to_regnum (gdbarch, dwarf_reg) != gdbarch_sp_regnum (gdbarch))
return 0;
buf = gdb_read_sleb128 (buf, buf_end, &sp_offset);
@@ -1496,10 +1468,10 @@ dwarf_expr_context::execute_stack_op (const gdb_byte *op_ptr,
type *address_type = this->address_type ();
this->m_location = DWARF_VALUE_MEMORY;
- this->m_initialized = 1; /* Default is initialized. */
+ this->m_initialized = 1; /* Default is initialized. */
if (this->m_recursion_depth > this->m_max_recursion_depth)
- error (_("DWARF-2 expression error: Loop detected (%d)."),
+ error (_ ("DWARF-2 expression error: Loop detected (%d)."),
this->m_recursion_depth);
this->m_recursion_depth++;
@@ -1561,8 +1533,8 @@ dwarf_expr_context::execute_stack_op (const gdb_byte *op_ptr,
break;
case DW_OP_addr:
- result = extract_unsigned_integer (op_ptr,
- this->m_addr_size, byte_order);
+ result
+ = extract_unsigned_integer (op_ptr, this->m_addr_size, byte_order);
op_ptr += this->m_addr_size;
/* Some versions of GCC emit DW_OP_addr before
DW_OP_GNU_push_tls_address. In this case the value is an
@@ -1699,7 +1671,7 @@ dwarf_expr_context::execute_stack_op (const gdb_byte *op_ptr,
op_ptr = safe_read_uleb128 (op_ptr, op_end, &len);
if (op_ptr + len > op_end)
- error (_("DW_OP_implicit_value: too few bytes available."));
+ error (_ ("DW_OP_implicit_value: too few bytes available."));
this->m_len = len;
this->m_data = op_ptr;
this->m_location = DWARF_VALUE_LITERAL;
@@ -1723,8 +1695,8 @@ dwarf_expr_context::execute_stack_op (const gdb_byte *op_ptr,
int ref_addr_size = this->m_per_cu->ref_addr_size ();
/* The referred-to DIE of sect_offset kind. */
- this->m_len = extract_unsigned_integer (op_ptr, ref_addr_size,
- byte_order);
+ this->m_len
+ = extract_unsigned_integer (op_ptr, ref_addr_size, byte_order);
op_ptr += ref_addr_size;
/* The byte offset into the data. */
@@ -1801,7 +1773,8 @@ dwarf_expr_context::execute_stack_op (const gdb_byte *op_ptr,
backup the current stack locally and install a new empty stack,
then reset it afterwards, effectively erasing whatever the
recursive call put there. */
- std::vector<dwarf_stack_value> saved_stack = std::move (this->m_stack);
+ std::vector<dwarf_stack_value> saved_stack
+ = std::move (this->m_stack);
this->m_stack.clear ();
/* FIXME: cagney/2003-03-26: This code should be using
@@ -1812,11 +1785,11 @@ dwarf_expr_context::execute_stack_op (const gdb_byte *op_ptr,
if (this->m_location == DWARF_VALUE_MEMORY)
result = fetch_address (0);
else if (this->m_location == DWARF_VALUE_REGISTER)
- result
- = read_addr_from_reg (this->m_frame, value_as_long (fetch (0)));
+ result = read_addr_from_reg (this->m_frame,
+ value_as_long (fetch (0)));
else
- error (_("Not implemented: computing frame "
- "base using explicit value operator"));
+ error (_ ("Not implemented: computing frame "
+ "base using explicit value operator"));
result = result + offset;
result_val = value_from_ulongest (address_type, result);
in_stack_memory = true;
@@ -1842,13 +1815,13 @@ dwarf_expr_context::execute_stack_op (const gdb_byte *op_ptr,
result_val = fetch (offset);
in_stack_memory = fetch_in_stack_memory (offset);
break;
-
+
case DW_OP_swap:
{
if (this->m_stack.size () < 2)
- error (_("Not enough elements for "
+ error (_ ("Not enough elements for "
"DW_OP_swap. Need 2, have %zu."),
- this->m_stack.size ());
+ this->m_stack.size ());
dwarf_stack_value &t1 = this->m_stack[this->m_stack.size () - 1];
dwarf_stack_value &t2 = this->m_stack[this->m_stack.size () - 2];
@@ -1864,15 +1837,15 @@ dwarf_expr_context::execute_stack_op (const gdb_byte *op_ptr,
case DW_OP_rot:
{
if (this->m_stack.size () < 3)
- error (_("Not enough elements for "
+ error (_ ("Not enough elements for "
"DW_OP_rot. Need 3, have %zu."),
- this->m_stack.size ());
+ this->m_stack.size ());
dwarf_stack_value temp = this->m_stack[this->m_stack.size () - 1];
this->m_stack[this->m_stack.size () - 1]
= this->m_stack[this->m_stack.size () - 2];
this->m_stack[this->m_stack.size () - 2]
- = this->m_stack[this->m_stack.size () - 3];
+ = this->m_stack[this->m_stack.size () - 3];
this->m_stack[this->m_stack.size () - 3] = temp;
goto no_push;
}
@@ -1882,7 +1855,8 @@ dwarf_expr_context::execute_stack_op (const gdb_byte *op_ptr,
case DW_OP_deref_type:
case DW_OP_GNU_deref_type:
{
- int addr_size = (op == DW_OP_deref ? this->m_addr_size : *op_ptr++);
+ int addr_size
+ = (op == DW_OP_deref ? this->m_addr_size : *op_ptr++);
gdb_byte *buf = (gdb_byte *) alloca (addr_size);
CORE_ADDR addr = fetch_address (0);
struct type *type;
@@ -1904,12 +1878,12 @@ dwarf_expr_context::execute_stack_op (const gdb_byte *op_ptr,
from the type length, we need to zero-extend it. */
if (type->length () != addr_size)
{
- ULONGEST datum =
- extract_unsigned_integer (buf, addr_size, byte_order);
+ ULONGEST datum
+ = extract_unsigned_integer (buf, addr_size, byte_order);
buf = (gdb_byte *) alloca (type->length ());
- store_unsigned_integer (buf, type->length (),
- byte_order, datum);
+ store_unsigned_integer (buf, type->length (), byte_order,
+ datum);
}
result_val = value_from_contents_and_address (type, buf, addr);
@@ -1929,7 +1903,8 @@ dwarf_expr_context::execute_stack_op (const gdb_byte *op_ptr,
{
case DW_OP_abs:
if (value_less (result_val,
- value_zero (value_type (result_val), not_lval)))
+ value_zero (value_type (result_val),
+ not_lval)))
result_val = value_neg (result_val);
break;
case DW_OP_neg:
@@ -1977,8 +1952,8 @@ dwarf_expr_context::execute_stack_op (const gdb_byte *op_ptr,
first = fetch (0);
pop ();
- if (! base_types_equal_p (value_type (first), value_type (second)))
- error (_("Incompatible types on DWARF stack"));
+ if (!base_types_equal_p (value_type (first), value_type (second)))
+ error (_ ("Incompatible types on DWARF stack"));
switch (op)
{
@@ -2073,12 +2048,12 @@ dwarf_expr_context::execute_stack_op (const gdb_byte *op_ptr,
break;
case DW_OP_le:
/* A <= B is !(B < A). */
- result = ! value_less (second, first);
+ result = !value_less (second, first);
result_val = value_from_ulongest (address_type, result);
break;
case DW_OP_ge:
/* A >= B is !(A < B). */
- result = ! value_less (first, second);
+ result = !value_less (first, second);
result_val = value_from_ulongest (address_type, result);
break;
case DW_OP_eq:
@@ -2095,11 +2070,11 @@ dwarf_expr_context::execute_stack_op (const gdb_byte *op_ptr,
result_val = value_from_ulongest (address_type, result);
break;
case DW_OP_ne:
- result = ! value_equal (first, second);
+ result = !value_equal (first, second);
result_val = value_from_ulongest (address_type, result);
break;
default:
- internal_error (_("Can't be reached."));
+ internal_error (_ ("Can't be reached."));
}
}
break;
@@ -2189,8 +2164,8 @@ dwarf_expr_context::execute_stack_op (const gdb_byte *op_ptr,
case DW_OP_GNU_uninit:
if (op_ptr != op_end)
- error (_("DWARF-2 expression error: DW_OP_GNU_uninit must always "
- "be the very last op."));
+ error (_ ("DWARF-2 expression error: DW_OP_GNU_uninit must always "
+ "be the very last op."));
this->m_initialized = 0;
goto no_push;
@@ -2219,8 +2194,7 @@ dwarf_expr_context::execute_stack_op (const gdb_byte *op_ptr,
int ref_addr_size = this->m_per_cu->ref_addr_size ();
sect_offset sect_off
- = (sect_offset) extract_unsigned_integer (op_ptr,
- ref_addr_size,
+ = (sect_offset) extract_unsigned_integer (op_ptr, ref_addr_size,
byte_order);
op_ptr += ref_addr_size;
result_val = sect_variable_value (sect_off, this->m_per_cu,
@@ -2228,7 +2202,7 @@ dwarf_expr_context::execute_stack_op (const gdb_byte *op_ptr,
result_val = value_cast (address_type, result_val);
}
break;
-
+
case DW_OP_entry_value:
case DW_OP_GNU_entry_value:
{
@@ -2238,34 +2212,33 @@ dwarf_expr_context::execute_stack_op (const gdb_byte *op_ptr,
op_ptr = safe_read_uleb128 (op_ptr, op_end, &len);
if (op_ptr + len > op_end)
- error (_("DW_OP_entry_value: too few bytes available."));
+ error (_ ("DW_OP_entry_value: too few bytes available."));
kind_u.dwarf_reg = dwarf_block_to_dwarf_reg (op_ptr, op_ptr + len);
if (kind_u.dwarf_reg != -1)
{
op_ptr += len;
- this->push_dwarf_reg_entry_value (CALL_SITE_PARAMETER_DWARF_REG,
- kind_u,
- -1 /* deref_size */);
+ this->push_dwarf_reg_entry_value (
+ CALL_SITE_PARAMETER_DWARF_REG, kind_u, -1 /* deref_size */);
goto no_push;
}
- kind_u.dwarf_reg = dwarf_block_to_dwarf_reg_deref (op_ptr,
- op_ptr + len,
- &deref_size);
+ kind_u.dwarf_reg
+ = dwarf_block_to_dwarf_reg_deref (op_ptr, op_ptr + len,
+ &deref_size);
if (kind_u.dwarf_reg != -1)
{
if (deref_size == -1)
deref_size = this->m_addr_size;
op_ptr += len;
- this->push_dwarf_reg_entry_value (CALL_SITE_PARAMETER_DWARF_REG,
- kind_u, deref_size);
+ this->push_dwarf_reg_entry_value (
+ CALL_SITE_PARAMETER_DWARF_REG, kind_u, deref_size);
goto no_push;
}
- error (_("DWARF-2 expression error: DW_OP_entry_value is "
- "supported only for single DW_OP_reg* "
- "or for DW_OP_breg*(0)+DW_OP_deref*"));
+ error (_ ("DWARF-2 expression error: DW_OP_entry_value is "
+ "supported only for single DW_OP_reg* "
+ "or for DW_OP_breg*(0)+DW_OP_deref*"));
}
case DW_OP_GNU_parameter_ref:
@@ -2276,8 +2249,7 @@ dwarf_expr_context::execute_stack_op (const gdb_byte *op_ptr,
= (cu_offset) extract_unsigned_integer (op_ptr, 4, byte_order);
op_ptr += 4;
this->push_dwarf_reg_entry_value (CALL_SITE_PARAMETER_PARAM_OFFSET,
- kind_u,
- -1 /* deref_size */);
+ kind_u, -1 /* deref_size */);
}
goto no_push;
@@ -2298,7 +2270,8 @@ dwarf_expr_context::execute_stack_op (const gdb_byte *op_ptr,
type = get_base_type (type_die_cu_off);
if (type->length () != n)
- error (_("DW_OP_const_type has different sizes for type and data"));
+ error (
+ _ ("DW_OP_const_type has different sizes for type and data"));
result_val = value_from_contents (type, data);
}
@@ -2345,13 +2318,11 @@ dwarf_expr_context::execute_stack_op (const gdb_byte *op_ptr,
{
/* Nothing. */
}
- else if (type->length ()
- != value_type (result_val)->length ())
- error (_("DW_OP_reinterpret has wrong size"));
+ else if (type->length () != value_type (result_val)->length ())
+ error (_ ("DW_OP_reinterpret has wrong size"));
else
- result_val
- = value_from_contents (type,
- value_contents_all (result_val).data ());
+ result_val = value_from_contents (
+ type, value_contents_all (result_val).data ());
}
break;
@@ -2360,21 +2331,20 @@ dwarf_expr_context::execute_stack_op (const gdb_byte *op_ptr,
if (this->m_addr_info == nullptr
|| (this->m_addr_info->valaddr.data () == nullptr
&& this->m_addr_info->addr == 0))
- error (_("Location address is not set."));
+ error (_ ("Location address is not set."));
result_val
= value_from_ulongest (address_type, this->m_addr_info->addr);
break;
default:
- error (_("Unhandled dwarf expression opcode 0x%x"), op);
+ error (_ ("Unhandled dwarf expression opcode 0x%x"), op);
}
/* Most things push a result value. */
gdb_assert (result_val != NULL);
push (result_val, in_stack_memory);
- no_push:
- ;
+ no_push:;
}
/* To simplify our main caller, if the result is an implicit
diff --git a/gdb/dwarf2/expr.h b/gdb/dwarf2/expr.h
index 44fc645116a..51c9ba7c4aa 100644
--- a/gdb/dwarf2/expr.h
+++ b/gdb/dwarf2/expr.h
@@ -19,7 +19,7 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
-#if !defined (DWARF2EXPR_H)
+#if !defined(DWARF2EXPR_H)
#define DWARF2EXPR_H
#include "leb128.h"
@@ -103,8 +103,10 @@ struct dwarf_expr_piece
struct dwarf_stack_value
{
dwarf_stack_value (struct value *value_, int in_stack_memory_)
- : value (value_), in_stack_memory (in_stack_memory_)
- {}
+ : value (value_),
+ in_stack_memory (in_stack_memory_)
+ {
+ }
struct value *value;
@@ -119,8 +121,7 @@ struct dwarf_stack_value
its current state and its callbacks. */
struct dwarf_expr_context
{
- dwarf_expr_context (dwarf2_per_objfile *per_objfile,
- int addr_size);
+ dwarf_expr_context (dwarf2_per_objfile *per_objfile, int addr_size);
virtual ~dwarf_expr_context () = default;
void push_address (CORE_ADDR value, bool in_stack_memory);
@@ -144,6 +145,7 @@ struct dwarf_expr_context
LONGEST subobj_offset = 0);
private:
+
/* The stack of values. */
std::vector<dwarf_stack_value> m_stack;
@@ -278,8 +280,7 @@ int dwarf_block_to_sp_offset (struct gdbarch *gdbarch, const gdb_byte *buf,
purposes. */
static inline const gdb_byte *
-gdb_read_uleb128 (const gdb_byte *buf, const gdb_byte *buf_end,
- uint64_t *r)
+gdb_read_uleb128 (const gdb_byte *buf, const gdb_byte *buf_end, uint64_t *r)
{
size_t bytes_read = read_uleb128_to_uint64 (buf, buf_end, r);
@@ -289,8 +290,7 @@ gdb_read_uleb128 (const gdb_byte *buf, const gdb_byte *buf_end,
}
static inline const gdb_byte *
-gdb_read_sleb128 (const gdb_byte *buf, const gdb_byte *buf_end,
- int64_t *r)
+gdb_read_sleb128 (const gdb_byte *buf, const gdb_byte *buf_end, int64_t *r)
{
size_t bytes_read = read_sleb128_to_int64 (buf, buf_end, r);
@@ -309,13 +309,11 @@ gdb_skip_leb128 (const gdb_byte *buf, const gdb_byte *buf_end)
return buf + bytes_read;
}
-extern const gdb_byte *safe_read_uleb128 (const gdb_byte *buf,
- const gdb_byte *buf_end,
- uint64_t *r);
+extern const gdb_byte *
+safe_read_uleb128 (const gdb_byte *buf, const gdb_byte *buf_end, uint64_t *r);
extern const gdb_byte *safe_read_sleb128 (const gdb_byte *buf,
- const gdb_byte *buf_end,
- int64_t *r);
+ const gdb_byte *buf_end, int64_t *r);
extern const gdb_byte *safe_skip_leb128 (const gdb_byte *buf,
const gdb_byte *buf_end);
diff --git a/gdb/dwarf2/file-and-dir.h b/gdb/dwarf2/file-and-dir.h
index 193a138a176..3dcb0572bed 100644
--- a/gdb/dwarf2/file-and-dir.h
+++ b/gdb/dwarf2/file-and-dir.h
@@ -43,10 +43,7 @@ struct file_and_directory
}
/* Return true if the file name is unknown. */
- bool is_unknown () const
- {
- return m_name == nullptr;
- }
+ bool is_unknown () const { return m_name == nullptr; }
/* Set the compilation directory. */
void set_comp_dir (std::string &&dir)
@@ -100,10 +97,7 @@ struct file_and_directory
}
/* Forget the full name. */
- void forget_fullname ()
- {
- m_fullname.reset ();
- }
+ void forget_fullname () { m_fullname.reset (); }
private:
diff --git a/gdb/dwarf2/frame-tailcall.c b/gdb/dwarf2/frame-tailcall.c
index cfa70725afb..c0947a52142 100644
--- a/gdb/dwarf2/frame-tailcall.c
+++ b/gdb/dwarf2/frame-tailcall.c
@@ -158,7 +158,7 @@ cache_find (frame_info_ptr fi)
gdb_assert (fi != NULL);
}
- search.next_bottom_frame = fi.get();
+ search.next_bottom_frame = fi.get ();
search.refc = 1;
slot = htab_find_slot (cache_htab, &search, NO_INSERT);
if (slot == NULL)
@@ -173,11 +173,11 @@ cache_find (frame_info_ptr fi)
If THIS_FRAME is CACHE-> NEXT_BOTTOM_FRAME return -1. */
static int
-existing_next_levels (frame_info_ptr this_frame,
- struct tailcall_cache *cache)
+existing_next_levels (frame_info_ptr this_frame, struct tailcall_cache *cache)
{
- int retval = (frame_relative_level (this_frame)
- - frame_relative_level (frame_info_ptr (cache->next_bottom_frame)) - 1);
+ int retval
+ = (frame_relative_level (this_frame)
+ - frame_relative_level (frame_info_ptr (cache->next_bottom_frame)) - 1);
gdb_assert (retval >= -1);
@@ -223,8 +223,8 @@ tailcall_frame_this_id (frame_info_ptr this_frame, void **this_cache,
*this_id = get_frame_id (next_frame);
(*this_id).code_addr = get_frame_pc (this_frame);
(*this_id).code_addr_p = true;
- (*this_id).artificial_depth = (cache->chain_levels
- - existing_next_levels (this_frame, cache));
+ (*this_id).artificial_depth
+ = (cache->chain_levels - existing_next_levels (this_frame, cache));
gdb_assert ((*this_id).artificial_depth > 0);
}
@@ -294,8 +294,8 @@ dwarf2_tailcall_prev_register_first (frame_info_ptr this_frame,
dwarf2_tailcall_prev_register_first. */
static struct value *
-tailcall_frame_prev_register (frame_info_ptr this_frame,
- void **this_cache, int regnum)
+tailcall_frame_prev_register (frame_info_ptr this_frame, void **this_cache,
+ int regnum)
{
struct tailcall_cache *cache = (struct tailcall_cache *) *this_cache;
struct value *val;
@@ -316,7 +316,7 @@ tailcall_frame_prev_register (frame_info_ptr this_frame,
static int
tailcall_frame_sniffer (const struct frame_unwind *self,
- frame_info_ptr this_frame, void **this_cache)
+ frame_info_ptr this_frame, void **this_cache)
{
frame_info_ptr next_frame;
int next_levels;
@@ -367,7 +367,7 @@ dwarf2_tailcall_sniffer_first (frame_info_ptr this_frame,
void **tailcall_cachep,
const LONGEST *entry_cfa_sp_offsetp)
{
- CORE_ADDR prev_pc = 0, prev_sp = 0; /* GCC warning. */
+ CORE_ADDR prev_pc = 0, prev_sp = 0; /* GCC warning. */
int prev_sp_p = 0;
CORE_ADDR this_pc;
struct gdbarch *prev_gdbarch;
@@ -461,7 +461,8 @@ static struct gdbarch *
tailcall_frame_prev_arch (frame_info_ptr this_frame,
void **this_prologue_cache)
{
- struct tailcall_cache *cache = (struct tailcall_cache *) *this_prologue_cache;
+ struct tailcall_cache *cache
+ = (struct tailcall_cache *) *this_prologue_cache;
return get_frame_arch (frame_info_ptr (cache->next_bottom_frame));
}
@@ -469,23 +470,22 @@ tailcall_frame_prev_arch (frame_info_ptr this_frame,
/* Virtual tail call frame unwinder if dwarf2_tailcall_sniffer_first finds
a chain to create. */
-const struct frame_unwind dwarf2_tailcall_frame_unwind =
-{
- "dwarf2 tailcall",
- TAILCALL_FRAME,
- default_frame_unwind_stop_reason,
- tailcall_frame_this_id,
- tailcall_frame_prev_register,
- NULL,
- tailcall_frame_sniffer,
- tailcall_frame_dealloc_cache,
- tailcall_frame_prev_arch
-};
+const struct frame_unwind dwarf2_tailcall_frame_unwind
+ = { "dwarf2 tailcall",
+ TAILCALL_FRAME,
+ default_frame_unwind_stop_reason,
+ tailcall_frame_this_id,
+ tailcall_frame_prev_register,
+ NULL,
+ tailcall_frame_sniffer,
+ tailcall_frame_dealloc_cache,
+ tailcall_frame_prev_arch };
void _initialize_tailcall_frame ();
+
void
_initialize_tailcall_frame ()
{
- cache_htab = htab_create_alloc (50, cache_hash, cache_eq, NULL, xcalloc,
- xfree);
+ cache_htab
+ = htab_create_alloc (50, cache_hash, cache_eq, NULL, xcalloc, xfree);
}
diff --git a/gdb/dwarf2/frame-tailcall.h b/gdb/dwarf2/frame-tailcall.h
index a4359e2f8a5..27eccfc0bec 100644
--- a/gdb/dwarf2/frame-tailcall.h
+++ b/gdb/dwarf2/frame-tailcall.h
@@ -26,13 +26,13 @@ struct frame_unwind;
/* The tail call frame unwinder. */
extern void
- dwarf2_tailcall_sniffer_first (frame_info_ptr this_frame,
- void **tailcall_cachep,
- const LONGEST *entry_cfa_sp_offsetp);
+dwarf2_tailcall_sniffer_first (frame_info_ptr this_frame,
+ void **tailcall_cachep,
+ const LONGEST *entry_cfa_sp_offsetp);
extern struct value *
- dwarf2_tailcall_prev_register_first (frame_info_ptr this_frame,
- void **tailcall_cachep, int regnum);
+dwarf2_tailcall_prev_register_first (frame_info_ptr this_frame,
+ void **tailcall_cachep, int regnum);
extern const struct frame_unwind dwarf2_tailcall_frame_unwind;
diff --git a/gdb/dwarf2/frame.c b/gdb/dwarf2/frame.c
index 7f2bcf29387..61a407e55c5 100644
--- a/gdb/dwarf2/frame.c
+++ b/gdb/dwarf2/frame.c
@@ -167,8 +167,8 @@ struct comp_unit
auto_obstack obstack;
};
-static struct dwarf2_fde *dwarf2_frame_find_fde
- (CORE_ADDR *pc, dwarf2_per_objfile **out_per_objfile);
+static struct dwarf2_fde *
+dwarf2_frame_find_fde (CORE_ADDR *pc, dwarf2_per_objfile **out_per_objfile);
static int dwarf2_frame_adjust_regnum (struct gdbarch *gdbarch, int regnum,
int eh_frame_p);
@@ -177,7 +177,6 @@ static CORE_ADDR read_encoded_value (struct comp_unit *unit, gdb_byte encoding,
int ptr_len, const gdb_byte *buf,
unsigned int *bytes_read_ptr,
CORE_ADDR func_base);
-
/* See dwarf2/frame.h. */
bool dwarf2_frame_unwinders_enabled_p = true;
@@ -187,7 +186,8 @@ bool dwarf2_frame_unwinders_enabled_p = true;
#define cfa_exp_len cfa_reg
dwarf2_frame_state::dwarf2_frame_state (CORE_ADDR pc_, struct dwarf2_cie *cie)
- : pc (pc_), data_align (cie->data_alignment_factor),
+ : pc (pc_),
+ data_align (cie->data_alignment_factor),
code_align (cie->code_alignment_factor),
retaddr_column (cie->return_address_register)
{
@@ -216,7 +216,7 @@ dwarf2_restore_rule (struct gdbarch *gdbarch, ULONGEST reg_num,
{
int regnum = dwarf_reg_to_regnum (gdbarch, reg);
- complaint (_("\
+ complaint (_ ("\
incomplete CFI data; DW_CFA_restore unspecified\n\
register %s (#%d) at %s"),
gdbarch_register_name (gdbarch, regnum), regnum,
@@ -240,7 +240,6 @@ execute_stack_op (const gdb_byte *exp, ULONGEST len, int addr_size,
else
return value_as_address (result_val);
}
-
/* Execute FDE program from INSN_PTR possibly up to INSN_END or up to inferior
PC. Modify FS state accordingly. Return current INSN_PTR where the
@@ -362,7 +361,7 @@ execute_cfa_program (struct dwarf2_fde *fde, const gdb_byte *insn_ptr,
if (old_rs == NULL)
{
- complaint (_("\
+ complaint (_ ("\
bad CFI data; mismatched DW_CFA_restore_state at %s"),
paddress (gdbarch, fs->pc));
}
@@ -385,8 +384,8 @@ bad CFI data; mismatched DW_CFA_restore_state at %s"),
case DW_CFA_def_cfa_register:
insn_ptr = safe_read_uleb128 (insn_ptr, insn_end, &reg);
- fs->regs.cfa_reg = dwarf2_frame_adjust_regnum (gdbarch, reg,
- eh_frame_p);
+ fs->regs.cfa_reg
+ = dwarf2_frame_adjust_regnum (gdbarch, reg, eh_frame_p);
fs->regs.cfa_how = CFA_REG_OFFSET;
break;
@@ -462,8 +461,8 @@ bad CFI data; mismatched DW_CFA_restore_state at %s"),
case DW_CFA_def_cfa_sf:
insn_ptr = safe_read_uleb128 (insn_ptr, insn_end, &reg);
- fs->regs.cfa_reg = dwarf2_frame_adjust_regnum (gdbarch, reg,
- eh_frame_p);
+ fs->regs.cfa_reg
+ = dwarf2_frame_adjust_regnum (gdbarch, reg, eh_frame_p);
insn_ptr = safe_read_sleb128 (insn_ptr, insn_end, &offset);
fs->regs.cfa_offset = offset * fs->data_align;
fs->regs.cfa_how = CFA_REG_OFFSET;
@@ -495,12 +494,13 @@ bad CFI data; mismatched DW_CFA_restore_state at %s"),
{
/* Handle vendor-specific CFI for different architectures. */
if (!gdbarch_execute_dwarf_cfa_vendor_op (gdbarch, insn, fs))
- error (_("Call Frame Instruction op %d in vendor extension "
- "space is not handled on this architecture."),
- insn);
+ error (
+ _ ("Call Frame Instruction op %d in vendor extension "
+ "space is not handled on this architecture."),
+ insn);
}
else
- internal_error (_("Unknown CFI encountered."));
+ internal_error (_ ("Unknown CFI encountered."));
}
}
}
@@ -517,7 +517,8 @@ bad CFI data; mismatched DW_CFA_restore_state at %s"),
#if GDB_SELF_TEST
-namespace selftests {
+namespace selftests
+{
/* Unit test to function execute_cfa_program. */
@@ -536,17 +537,19 @@ execute_cfa_program_test (struct gdbarch *gdbarch)
dwarf2_frame_state fs (0, fde.cie);
- gdb_byte insns[] =
- {
- DW_CFA_def_cfa, 1, 4, /* DW_CFA_def_cfa: r1 ofs 4 */
- DW_CFA_offset | 0x2, 1, /* DW_CFA_offset: r2 at cfa-4 */
- DW_CFA_remember_state,
- DW_CFA_restore_state,
- };
+ gdb_byte insns[] = {
+ DW_CFA_def_cfa,
+ 1,
+ 4, /* DW_CFA_def_cfa: r1 ofs 4 */
+ DW_CFA_offset | 0x2,
+ 1, /* DW_CFA_offset: r2 at cfa-4 */
+ DW_CFA_remember_state,
+ DW_CFA_restore_state,
+ };
const gdb_byte *insn_end = insns + sizeof (insns);
- const gdb_byte *out = execute_cfa_program (&fde, insns, insn_end, gdbarch,
- 0, &fs, 0);
+ const gdb_byte *out
+ = execute_cfa_program (&fde, insns, insn_end, gdbarch, 0, &fs, 0);
SELF_CHECK (out == insn_end);
SELF_CHECK (fs.pc == 0);
@@ -575,12 +578,9 @@ execute_cfa_program_test (struct gdbarch *gdbarch)
} // namespace selftests
#endif /* GDB_SELF_TEST */
-
-
/* Architecture-specific operations. */
-static void dwarf2_frame_default_init_reg (struct gdbarch *gdbarch,
- int regnum,
+static void dwarf2_frame_default_init_reg (struct gdbarch *gdbarch, int regnum,
struct dwarf2_frame_state_reg *reg,
frame_info_ptr this_frame);
@@ -710,8 +710,8 @@ dwarf2_frame_signal_frame_p (struct gdbarch *gdbarch,
void
dwarf2_frame_set_adjust_regnum (struct gdbarch *gdbarch,
- int (*adjust_regnum) (struct gdbarch *,
- int, int))
+ int (*adjust_regnum) (struct gdbarch *, int,
+ int))
{
struct dwarf2_frame_ops *ops = get_frame_ops (gdbarch);
@@ -722,8 +722,8 @@ dwarf2_frame_set_adjust_regnum (struct gdbarch *gdbarch,
register. */
static int
-dwarf2_frame_adjust_regnum (struct gdbarch *gdbarch,
- int regnum, int eh_frame_p)
+dwarf2_frame_adjust_regnum (struct gdbarch *gdbarch, int regnum,
+ int eh_frame_p)
{
struct dwarf2_frame_ops *ops = get_frame_ops (gdbarch);
@@ -764,15 +764,13 @@ dwarf2_frame_find_quirks (struct dwarf2_frame_state *fs,
return;
}
}
-
/* See dwarf2/frame.h. */
int
dwarf2_fetch_cfa_info (struct gdbarch *gdbarch, CORE_ADDR pc,
- struct dwarf2_per_cu_data *data,
- int *regnum_out, LONGEST *offset_out,
- CORE_ADDR *text_offset_out,
+ struct dwarf2_per_cu_data *data, int *regnum_out,
+ LONGEST *offset_out, CORE_ADDR *text_offset_out,
const gdb_byte **cfa_start_out,
const gdb_byte **cfa_end_out)
{
@@ -783,7 +781,7 @@ dwarf2_fetch_cfa_info (struct gdbarch *gdbarch, CORE_ADDR pc,
/* Find the correct FDE. */
fde = dwarf2_frame_find_fde (&pc1, &per_objfile);
if (fde == NULL)
- error (_("Could not compute CFA; needed to translate this expression"));
+ error (_ ("Could not compute CFA; needed to translate this expression"));
gdb_assert (per_objfile != nullptr);
@@ -793,8 +791,8 @@ dwarf2_fetch_cfa_info (struct gdbarch *gdbarch, CORE_ADDR pc,
dwarf2_frame_find_quirks (&fs, fde);
/* First decode all the insns in the CIE. */
- execute_cfa_program (fde, fde->cie->initial_instructions,
- fde->cie->end, gdbarch, pc, &fs,
+ execute_cfa_program (fde, fde->cie->initial_instructions, fde->cie->end,
+ gdbarch, pc, &fs,
per_objfile->objfile->text_section_offset ());
/* Save the initialized register set. */
@@ -826,11 +824,10 @@ dwarf2_fetch_cfa_info (struct gdbarch *gdbarch, CORE_ADDR pc,
return 0;
default:
- internal_error (_("Unknown CFA rule."));
+ internal_error (_ ("Unknown CFA rule."));
}
}
-
/* Custom function data object for architecture specific prev_register
implementation. Main purpose of this object is to allow caching of
expensive data lookups in the prev_register handling. */
@@ -931,9 +928,8 @@ dwarf2_frame_cache (frame_info_ptr this_frame, void **this_cache)
dwarf2_frame_find_quirks (&fs, fde);
/* First decode all the insns in the CIE. */
- execute_cfa_program (fde, fde->cie->initial_instructions,
- fde->cie->end, gdbarch,
- get_frame_address_in_block (this_frame), &fs,
+ execute_cfa_program (fde, fde->cie->initial_instructions, fde->cie->end,
+ gdbarch, get_frame_address_in_block (this_frame), &fs,
cache->per_objfile->objfile->text_section_offset ());
/* Save the initialized register set. */
@@ -950,9 +946,9 @@ dwarf2_frame_cache (frame_info_ptr this_frame, void **this_cache)
&& entry_pc < fde->initial_location + fde->address_range)
{
/* Decode the insns in the FDE up to the entry PC. */
- instr = execute_cfa_program
- (fde, fde->instructions, fde->end, gdbarch, entry_pc, &fs,
- cache->per_objfile->objfile->text_section_offset ());
+ instr = execute_cfa_program (
+ fde, fde->instructions, fde->end, gdbarch, entry_pc, &fs,
+ cache->per_objfile->objfile->text_section_offset ());
if (fs.regs.cfa_how == CFA_REG_OFFSET
&& (dwarf_reg_to_regnum (gdbarch, fs.regs.cfa_reg)
@@ -984,14 +980,13 @@ dwarf2_frame_cache (frame_info_ptr this_frame, void **this_cache)
break;
case CFA_EXP:
- cache->cfa =
- execute_stack_op (fs.regs.cfa_exp, fs.regs.cfa_exp_len,
- cache->addr_size, this_frame, 0, 0,
- cache->per_objfile);
+ cache->cfa = execute_stack_op (fs.regs.cfa_exp, fs.regs.cfa_exp_len,
+ cache->addr_size, this_frame, 0, 0,
+ cache->per_objfile);
break;
default:
- internal_error (_("Unknown CFA rule."));
+ internal_error (_ ("Unknown CFA rule."));
}
}
catch (const gdb_exception_error &ex)
@@ -1018,7 +1013,7 @@ dwarf2_frame_cache (frame_info_ptr this_frame, void **this_cache)
return address column; it's perfectly all right for it to
correspond to a real register. */
{
- int column; /* CFI speak for "register number". */
+ int column; /* CFI speak for "register number". */
for (column = 0; column < fs.regs.reg.size (); column++)
{
@@ -1043,7 +1038,7 @@ dwarf2_frame_cache (frame_info_ptr this_frame, void **this_cache)
if (fs.regs.reg[column].how == DWARF2_FRAME_REG_UNSPECIFIED)
{
if (cache->reg[regnum].how == DWARF2_FRAME_REG_UNSPECIFIED)
- complaint (_("\
+ complaint (_ ("\
incomplete CFI data; unspecified registers (e.g., %s) at %s"),
gdbarch_register_name (gdbarch, regnum),
paddress (gdbarch, fs.pc));
@@ -1105,15 +1100,14 @@ incomplete CFI data; unspecified registers (e.g., %s) at %s"),
cache->undefined_retaddr = 1;
dwarf2_tailcall_sniffer_first (this_frame, &cache->tailcall_cache,
- (entry_cfa_sp_offset_p
- ? &entry_cfa_sp_offset : NULL));
+ (entry_cfa_sp_offset_p ? &entry_cfa_sp_offset
+ : NULL));
return cache;
}
static enum unwind_stop_reason
-dwarf2_frame_unwind_stop_reason (frame_info_ptr this_frame,
- void **this_cache)
+dwarf2_frame_unwind_stop_reason (frame_info_ptr this_frame, void **this_cache)
{
struct dwarf2_frame_cache *cache
= dwarf2_frame_cache (this_frame, this_cache);
@@ -1131,11 +1125,12 @@ static void
dwarf2_frame_this_id (frame_info_ptr this_frame, void **this_cache,
struct frame_id *this_id)
{
- struct dwarf2_frame_cache *cache =
- dwarf2_frame_cache (this_frame, this_cache);
+ struct dwarf2_frame_cache *cache
+ = dwarf2_frame_cache (this_frame, this_cache);
if (cache->unavailable_retaddr)
- (*this_id) = frame_id_build_unavailable_stack (get_frame_func (this_frame));
+ (*this_id)
+ = frame_id_build_unavailable_stack (get_frame_func (this_frame));
else if (cache->undefined_retaddr)
return;
else
@@ -1147,8 +1142,8 @@ dwarf2_frame_prev_register (frame_info_ptr this_frame, void **this_cache,
int regnum)
{
struct gdbarch *gdbarch = get_frame_arch (this_frame);
- struct dwarf2_frame_cache *cache =
- dwarf2_frame_cache (this_frame, this_cache);
+ struct dwarf2_frame_cache *cache
+ = dwarf2_frame_cache (this_frame, this_cache);
CORE_ADDR addr;
int realnum;
@@ -1160,10 +1155,10 @@ dwarf2_frame_prev_register (frame_info_ptr this_frame, void **this_cache,
if (cache->tailcall_cache)
{
struct value *val;
-
- val = dwarf2_tailcall_prev_register_first (this_frame,
- &cache->tailcall_cache,
- regnum);
+
+ val
+ = dwarf2_tailcall_prev_register_first (this_frame,
+ &cache->tailcall_cache, regnum);
if (val)
return val;
}
@@ -1180,16 +1175,15 @@ dwarf2_frame_prev_register (frame_info_ptr this_frame, void **this_cache,
return frame_unwind_got_memory (this_frame, regnum, addr);
case DWARF2_FRAME_REG_SAVED_REG:
- realnum = dwarf_reg_to_regnum_or_error
- (gdbarch, cache->reg[regnum].loc.reg);
+ realnum
+ = dwarf_reg_to_regnum_or_error (gdbarch, cache->reg[regnum].loc.reg);
return frame_unwind_got_register (this_frame, regnum, realnum);
case DWARF2_FRAME_REG_SAVED_EXP:
- addr = execute_stack_op (cache->reg[regnum].loc.exp.start,
- cache->reg[regnum].loc.exp.len,
- cache->addr_size,
- this_frame, cache->cfa, 1,
- cache->per_objfile);
+ addr
+ = execute_stack_op (cache->reg[regnum].loc.exp.start,
+ cache->reg[regnum].loc.exp.len, cache->addr_size,
+ this_frame, cache->cfa, 1, cache->per_objfile);
return frame_unwind_got_memory (this_frame, regnum, addr);
case DWARF2_FRAME_REG_SAVED_VAL_OFFSET:
@@ -1197,11 +1191,10 @@ dwarf2_frame_prev_register (frame_info_ptr this_frame, void **this_cache,
return frame_unwind_got_constant (this_frame, regnum, addr);
case DWARF2_FRAME_REG_SAVED_VAL_EXP:
- addr = execute_stack_op (cache->reg[regnum].loc.exp.start,
- cache->reg[regnum].loc.exp.len,
- cache->addr_size,
- this_frame, cache->cfa, 1,
- cache->per_objfile);
+ addr
+ = execute_stack_op (cache->reg[regnum].loc.exp.start,
+ cache->reg[regnum].loc.exp.len, cache->addr_size,
+ this_frame, cache->cfa, 1, cache->per_objfile);
return frame_unwind_got_constant (this_frame, regnum, addr);
case DWARF2_FRAME_REG_UNSPECIFIED:
@@ -1226,8 +1219,8 @@ dwarf2_frame_prev_register (frame_info_ptr this_frame, void **this_cache,
case DWARF2_FRAME_REG_RA_OFFSET:
addr = cache->reg[regnum].loc.offset;
- regnum = dwarf_reg_to_regnum_or_error
- (gdbarch, cache->retaddr_reg.loc.reg);
+ regnum
+ = dwarf_reg_to_regnum_or_error (gdbarch, cache->retaddr_reg.loc.reg);
addr += get_frame_register_unsigned (this_frame, regnum);
return frame_unwind_got_address (this_frame, regnum, addr);
@@ -1235,7 +1228,7 @@ dwarf2_frame_prev_register (frame_info_ptr this_frame, void **this_cache,
return cache->reg[regnum].loc.fn (this_frame, this_cache, regnum);
default:
- internal_error (_("Unknown register rule."));
+ internal_error (_ ("Unknown register rule."));
}
}
@@ -1288,7 +1281,7 @@ static void
dwarf2_frame_dealloc_cache (frame_info *self, void *this_cache)
{
struct dwarf2_frame_cache *cache
- = dwarf2_frame_cache (frame_info_ptr (self), &this_cache);
+ = dwarf2_frame_cache (frame_info_ptr (self), &this_cache);
if (cache->tailcall_cache)
dwarf2_tailcall_frame_unwind.dealloc_cache (self, cache->tailcall_cache);
@@ -1319,8 +1312,7 @@ dwarf2_frame_sniffer (const struct frame_unwind *self,
correctly. */
if (fde->cie->signal_frame
- || dwarf2_frame_signal_frame_p (get_frame_arch (this_frame),
- this_frame))
+ || dwarf2_frame_signal_frame_p (get_frame_arch (this_frame), this_frame))
return self->type == SIGTRAMP_FRAME;
if (self->type != NORMAL_FRAME)
@@ -1329,31 +1321,23 @@ dwarf2_frame_sniffer (const struct frame_unwind *self,
return 1;
}
-static const struct frame_unwind dwarf2_frame_unwind =
-{
- "dwarf2",
- NORMAL_FRAME,
- dwarf2_frame_unwind_stop_reason,
- dwarf2_frame_this_id,
- dwarf2_frame_prev_register,
- NULL,
- dwarf2_frame_sniffer,
- dwarf2_frame_dealloc_cache
-};
+static const struct frame_unwind dwarf2_frame_unwind
+ = { "dwarf2",
+ NORMAL_FRAME,
+ dwarf2_frame_unwind_stop_reason,
+ dwarf2_frame_this_id,
+ dwarf2_frame_prev_register,
+ NULL,
+ dwarf2_frame_sniffer,
+ dwarf2_frame_dealloc_cache };
-static const struct frame_unwind dwarf2_signal_frame_unwind =
-{
- "dwarf2 signal",
- SIGTRAMP_FRAME,
- dwarf2_frame_unwind_stop_reason,
- dwarf2_frame_this_id,
- dwarf2_frame_prev_register,
- NULL,
- dwarf2_frame_sniffer,
-
- /* TAILCALL_CACHE can never be in such frame to need dealloc_cache. */
- NULL
-};
+static const struct frame_unwind dwarf2_signal_frame_unwind
+ = { "dwarf2 signal", SIGTRAMP_FRAME, dwarf2_frame_unwind_stop_reason,
+ dwarf2_frame_this_id, dwarf2_frame_prev_register, NULL,
+ dwarf2_frame_sniffer,
+
+ /* TAILCALL_CACHE can never be in such frame to need dealloc_cache. */
+ NULL };
/* Append the DWARF-2 frame unwinders to GDBARCH's list. */
@@ -1363,7 +1347,6 @@ dwarf2_append_unwinders (struct gdbarch *gdbarch)
frame_unwind_append_unwinder (gdbarch, &dwarf2_frame_unwind);
frame_unwind_append_unwinder (gdbarch, &dwarf2_signal_frame_unwind);
}
-
/* There is no explicitly defined relationship between the CFA and the
location of frame's local variables and arguments/parameters.
@@ -1374,19 +1357,15 @@ dwarf2_append_unwinders (struct gdbarch *gdbarch)
static CORE_ADDR
dwarf2_frame_base_address (frame_info_ptr this_frame, void **this_cache)
{
- struct dwarf2_frame_cache *cache =
- dwarf2_frame_cache (this_frame, this_cache);
+ struct dwarf2_frame_cache *cache
+ = dwarf2_frame_cache (this_frame, this_cache);
return cache->cfa;
}
-static const struct frame_base dwarf2_frame_base =
-{
- &dwarf2_frame_unwind,
- dwarf2_frame_base_address,
- dwarf2_frame_base_address,
- dwarf2_frame_base_address
-};
+static const struct frame_base dwarf2_frame_base
+ = { &dwarf2_frame_unwind, dwarf2_frame_base_address,
+ dwarf2_frame_base_address, dwarf2_frame_base_address };
const struct frame_base *
dwarf2_frame_base_sniffer (frame_info_ptr this_frame)
@@ -1409,23 +1388,22 @@ dwarf2_frame_cfa (frame_info_ptr this_frame)
if (frame_unwinder_is (this_frame, &record_btrace_tailcall_frame_unwind)
|| frame_unwinder_is (this_frame, &record_btrace_frame_unwind))
throw_error (NOT_AVAILABLE_ERROR,
- _("cfa not available for record btrace target"));
+ _ ("cfa not available for record btrace target"));
while (get_frame_type (this_frame) == INLINE_FRAME)
this_frame = get_prev_frame (this_frame);
if (get_frame_unwind_stop_reason (this_frame) == UNWIND_UNAVAILABLE)
throw_error (NOT_AVAILABLE_ERROR,
- _("can't compute CFA for this frame: "
- "required registers or memory are unavailable"));
+ _ ("can't compute CFA for this frame: "
+ "required registers or memory are unavailable"));
if (get_frame_id (this_frame).stack_status != FID_STACK_VALID)
- throw_error (NOT_AVAILABLE_ERROR,
- _("can't compute CFA for this frame: "
- "frame base not available"));
+ throw_error (NOT_AVAILABLE_ERROR, _ ("can't compute CFA for this frame: "
+ "frame base not available"));
return get_frame_base (this_frame);
}
-
+
/* We store the frame data on the BFD. This is only done if it is
independent of the address space and so can be shared. */
static const registry<bfd>::key<comp_unit> dwarf2_frame_bfd_data;
@@ -1434,7 +1412,6 @@ static const registry<bfd>::key<comp_unit> dwarf2_frame_bfd_data;
any debug info requires relocations), then we store the frame data
on the objfile instead, and do not share it. */
static const registry<objfile>::key<comp_unit> dwarf2_frame_objfile_data;
-
/* Pointer encoding helper functions. */
@@ -1464,14 +1441,13 @@ encoding_for_size (unsigned int size)
case 8:
return DW_EH_PE_udata8;
default:
- internal_error (_("Unsupported address size"));
+ internal_error (_ ("Unsupported address size"));
}
}
static CORE_ADDR
-read_encoded_value (struct comp_unit *unit, gdb_byte encoding,
- int ptr_len, const gdb_byte *buf,
- unsigned int *bytes_read_ptr,
+read_encoded_value (struct comp_unit *unit, gdb_byte encoding, int ptr_len,
+ const gdb_byte *buf, unsigned int *bytes_read_ptr,
CORE_ADDR func_base)
{
ptrdiff_t offset;
@@ -1480,7 +1456,7 @@ read_encoded_value (struct comp_unit *unit, gdb_byte encoding,
/* GCC currently doesn't generate DW_EH_PE_indirect encodings for
FDE's. */
if (encoding & DW_EH_PE_indirect)
- internal_error (_("Unsupported encoding: DW_EH_PE_indirect"));
+ internal_error (_ ("Unsupported encoding: DW_EH_PE_indirect"));
*bytes_read_ptr = 0;
@@ -1512,7 +1488,7 @@ read_encoded_value (struct comp_unit *unit, gdb_byte encoding,
}
break;
default:
- internal_error (_("Invalid or unsupported encoding"));
+ internal_error (_ ("Invalid or unsupported encoding"));
}
if ((encoding & 0x07) == 0x00)
@@ -1559,10 +1535,9 @@ read_encoded_value (struct comp_unit *unit, gdb_byte encoding,
*bytes_read_ptr += 8;
return (base + bfd_get_signed_64 (unit->abfd, (bfd_byte *) buf));
default:
- internal_error (_("Invalid or unsupported encoding"));
+ internal_error (_ ("Invalid or unsupported encoding"));
}
}
-
/* Find CIE with the given CIE_POINTER in CIE_TABLE. */
static struct dwarf2_cie *
@@ -1680,23 +1655,19 @@ enum eh_frame_type
EH_CIE_OR_FDE_TYPE_ID = EH_CIE_TYPE_ID | EH_FDE_TYPE_ID
};
-static const gdb_byte *decode_frame_entry (struct gdbarch *gdbarch,
- struct comp_unit *unit,
- const gdb_byte *start,
- int eh_frame_p,
- dwarf2_cie_table &cie_table,
- dwarf2_fde_table *fde_table,
- enum eh_frame_type entry_type);
+static const gdb_byte *
+decode_frame_entry (struct gdbarch *gdbarch, struct comp_unit *unit,
+ const gdb_byte *start, int eh_frame_p,
+ dwarf2_cie_table &cie_table, dwarf2_fde_table *fde_table,
+ enum eh_frame_type entry_type);
/* Decode the next CIE or FDE, entry_type specifies the expected type.
Return NULL if invalid input, otherwise the next byte to be processed. */
static const gdb_byte *
-decode_frame_entry_1 (struct gdbarch *gdbarch,
- struct comp_unit *unit, const gdb_byte *start,
- int eh_frame_p,
- dwarf2_cie_table &cie_table,
- dwarf2_fde_table *fde_table,
+decode_frame_entry_1 (struct gdbarch *gdbarch, struct comp_unit *unit,
+ const gdb_byte *start, int eh_frame_p,
+ dwarf2_cie_table &cie_table, dwarf2_fde_table *fde_table,
enum eh_frame_type entry_type)
{
const gdb_byte *buf, *end;
@@ -1751,7 +1722,7 @@ decode_frame_entry_1 (struct gdbarch *gdbarch,
/* Check that a CIE was expected. */
if ((entry_type & EH_CIE_TYPE_ID) == 0)
- error (_("Found a CIE when not expecting it."));
+ error (_ ("Found a CIE when not expecting it."));
/* Record the offset into the .debug_frame section of this CIE. */
cie_pointer = start - unit->dwarf_frame_buffer;
@@ -1844,8 +1815,7 @@ decode_frame_entry_1 (struct gdbarch *gdbarch,
}
cie->return_address_register
- = dwarf2_frame_adjust_regnum (gdbarch,
- cie->return_address_register,
+ = dwarf2_frame_adjust_regnum (gdbarch, cie->return_address_register,
eh_frame_p);
cie->saw_z_augmentation = (*augmentation == 'z');
@@ -1882,8 +1852,8 @@ decode_frame_entry_1 (struct gdbarch *gdbarch,
{
/* Skip. Avoid indirection since we throw away the result. */
gdb_byte encoding = (*buf++) & ~DW_EH_PE_indirect;
- read_encoded_value (unit, encoding, cie->ptr_size,
- buf, &bytes_read, 0);
+ read_encoded_value (unit, encoding, cie->ptr_size, buf,
+ &bytes_read, 0);
buf += bytes_read;
augmentation++;
}
@@ -1923,7 +1893,7 @@ decode_frame_entry_1 (struct gdbarch *gdbarch,
/* Check that an FDE was expected. */
if ((entry_type & EH_FDE_TYPE_ID) == 0)
- error (_("Found an FDE when not expecting it."));
+ error (_ ("Found an FDE when not expecting it."));
/* In an .eh_frame section, the CIE pointer is the delta between the
address within the FDE where the CIE pointer is stored and the
@@ -1957,9 +1927,9 @@ decode_frame_entry_1 (struct gdbarch *gdbarch,
fde->initial_location = gdbarch_adjust_dwarf2_addr (gdbarch, addr);
buf += bytes_read;
- fde->address_range =
- read_encoded_value (unit, fde->cie->encoding & 0x0f,
- fde->cie->ptr_size, buf, &bytes_read, 0);
+ fde->address_range
+ = read_encoded_value (unit, fde->cie->encoding & 0x0f,
+ fde->cie->ptr_size, buf, &bytes_read, 0);
addr = gdbarch_adjust_dwarf2_addr (gdbarch, addr + fde->address_range);
fde->address_range = addr - fde->initial_location;
buf += bytes_read;
@@ -1995,21 +1965,27 @@ decode_frame_entry_1 (struct gdbarch *gdbarch,
expect an FDE or a CIE. */
static const gdb_byte *
-decode_frame_entry (struct gdbarch *gdbarch,
- struct comp_unit *unit, const gdb_byte *start,
- int eh_frame_p,
- dwarf2_cie_table &cie_table,
- dwarf2_fde_table *fde_table,
+decode_frame_entry (struct gdbarch *gdbarch, struct comp_unit *unit,
+ const gdb_byte *start, int eh_frame_p,
+ dwarf2_cie_table &cie_table, dwarf2_fde_table *fde_table,
enum eh_frame_type entry_type)
{
- enum { NONE, ALIGN4, ALIGN8, FAIL } workaround = NONE;
+ enum
+ {
+ NONE,
+ ALIGN4,
+ ALIGN8,
+ FAIL
+ } workaround
+ = NONE;
+
const gdb_byte *ret;
ptrdiff_t start_offset;
while (1)
{
- ret = decode_frame_entry_1 (gdbarch, unit, start, eh_frame_p,
- cie_table, fde_table, entry_type);
+ ret = decode_frame_entry_1 (gdbarch, unit, start, eh_frame_p, cie_table,
+ fde_table, entry_type);
if (ret != NULL)
break;
@@ -2066,21 +2042,21 @@ decode_frame_entry (struct gdbarch *gdbarch,
break;
case ALIGN4:
- complaint (_("\
+ complaint (_ ("\
Corrupt data in %s:%s; align 4 workaround apparently succeeded"),
bfd_get_filename (unit->dwarf_frame_section->owner),
bfd_section_name (unit->dwarf_frame_section));
break;
case ALIGN8:
- complaint (_("\
+ complaint (_ ("\
Corrupt data in %s:%s; align 8 workaround apparently succeeded"),
bfd_get_filename (unit->dwarf_frame_section->owner),
bfd_section_name (unit->dwarf_frame_section));
break;
default:
- complaint (_("Corrupt data in %s:%s"),
+ complaint (_ ("Corrupt data in %s:%s"),
bfd_get_filename (unit->dwarf_frame_section->owner),
bfd_section_name (unit->dwarf_frame_section));
break;
@@ -2088,14 +2064,14 @@ Corrupt data in %s:%s; align 8 workaround apparently succeeded"),
return ret;
}
-
+
static bool
fde_is_less_than (const dwarf2_fde *aa, const dwarf2_fde *bb)
{
if (aa->initial_location == bb->initial_location)
{
- if (aa->address_range != bb->address_range
- && aa->eh_frame_p == 0 && bb->eh_frame_p == 0)
+ if (aa->address_range != bb->address_range && aa->eh_frame_p == 0
+ && bb->eh_frame_p == 0)
/* Linker bug, e.g. gold/10400.
Work around it by keeping stable sort order. */
return aa < bb;
@@ -2148,16 +2124,17 @@ dwarf2_build_frame_info (struct objfile *objfile)
try
{
frame_ptr = unit->dwarf_frame_buffer;
- while (frame_ptr < unit->dwarf_frame_buffer + unit->dwarf_frame_size)
- frame_ptr = decode_frame_entry (gdbarch, unit.get (),
- frame_ptr, 1,
- cie_table, &fde_table,
- EH_CIE_OR_FDE_TYPE_ID);
+ while (frame_ptr
+ < unit->dwarf_frame_buffer + unit->dwarf_frame_size)
+ frame_ptr
+ = decode_frame_entry (gdbarch, unit.get (), frame_ptr, 1,
+ cie_table, &fde_table,
+ EH_CIE_OR_FDE_TYPE_ID);
}
catch (const gdb_exception_error &e)
{
- warning (_("skipping .eh_frame info of %s: %s"),
+ warning (_ ("skipping .eh_frame info of %s: %s"),
objfile_name (objfile), e.what ());
fde_table.clear ();
@@ -2170,8 +2147,7 @@ dwarf2_build_frame_info (struct objfile *objfile)
dwarf2_get_section_info (objfile, DWARF2_DEBUG_FRAME,
&unit->dwarf_frame_section,
- &unit->dwarf_frame_buffer,
- &unit->dwarf_frame_size);
+ &unit->dwarf_frame_buffer, &unit->dwarf_frame_size);
if (unit->dwarf_frame_size)
{
size_t num_old_fde_entries = fde_table.size ();
@@ -2186,7 +2162,7 @@ dwarf2_build_frame_info (struct objfile *objfile)
}
catch (const gdb_exception_error &e)
{
- warning (_("skipping .debug_frame info of %s: %s"),
+ warning (_ ("skipping .debug_frame info of %s: %s"),
objfile_name (objfile), e.what ());
fde_table.resize (num_old_fde_entries);
@@ -2225,8 +2201,7 @@ dwarf2_build_frame_info (struct objfile *objfile)
Also discard leftovers from --gc-sections. */
for (struct dwarf2_fde *fde : fde_table)
{
- if (fde->initial_location == 0
- && first_non_zero_fde != NULL
+ if (fde->initial_location == 0 && first_non_zero_fde != NULL
&& (first_non_zero_fde->initial_location
< fde->initial_location + fde->address_range))
continue;
@@ -2247,29 +2222,28 @@ dwarf2_build_frame_info (struct objfile *objfile)
static void
show_dwarf_unwinders_enabled_p (struct ui_file *file, int from_tty,
- struct cmd_list_element *c,
- const char *value)
+ struct cmd_list_element *c, const char *value)
{
- gdb_printf (file,
- _("The DWARF stack unwinders are currently %s.\n"),
+ gdb_printf (file, _ ("The DWARF stack unwinders are currently %s.\n"),
value);
}
void _initialize_dwarf2_frame ();
+
void
_initialize_dwarf2_frame ()
{
add_setshow_boolean_cmd ("unwinders", class_obscure,
- &dwarf2_frame_unwinders_enabled_p , _("\
-Set whether the DWARF stack frame unwinders are used."), _("\
-Show whether the DWARF stack frame unwinders are used."), _("\
+ &dwarf2_frame_unwinders_enabled_p, _ ("\
+Set whether the DWARF stack frame unwinders are used."),
+ _ ("\
+Show whether the DWARF stack frame unwinders are used."),
+ _ ("\
When enabled the DWARF stack frame unwinders can be used for architectures\n\
that support the DWARF unwinders. Enabling the DWARF unwinders for an\n\
architecture that doesn't support them will have no effect."),
- NULL,
- show_dwarf_unwinders_enabled_p,
- &set_dwarf_cmdlist,
- &show_dwarf_cmdlist);
+ NULL, show_dwarf_unwinders_enabled_p,
+ &set_dwarf_cmdlist, &show_dwarf_cmdlist);
#if GDB_SELF_TEST
selftests::register_test_foreach_arch ("execute_cfa_program",
diff --git a/gdb/dwarf2/frame.h b/gdb/dwarf2/frame.h
index 5643e557513..3dfa9369ec1 100644
--- a/gdb/dwarf2/frame.h
+++ b/gdb/dwarf2/frame.h
@@ -57,11 +57,11 @@ enum dwarf2_frame_reg_rule
/* These aren't defined by the DWARF2 CFI specification, but are
used internally by GDB. */
- DWARF2_FRAME_REG_FN, /* Call a registered function. */
- DWARF2_FRAME_REG_RA, /* Return Address. */
- DWARF2_FRAME_REG_RA_OFFSET, /* Return Address with offset. */
- DWARF2_FRAME_REG_CFA, /* Call Frame Address. */
- DWARF2_FRAME_REG_CFA_OFFSET /* Call Frame Address with offset. */
+ DWARF2_FRAME_REG_FN, /* Call a registered function. */
+ DWARF2_FRAME_REG_RA, /* Return Address. */
+ DWARF2_FRAME_REG_RA_OFFSET, /* Return Address with offset. */
+ DWARF2_FRAME_REG_CFA, /* Call Frame Address. */
+ DWARF2_FRAME_REG_CFA_OFFSET /* Call Frame Address with offset. */
};
/* Register state. */
@@ -73,14 +73,17 @@ struct dwarf2_frame_state_reg
{
/* Each register save state can be described in terms of a CFA slot,
another register, or a location expression. */
- union {
+ union
+ {
LONGEST offset;
ULONGEST reg;
+
struct
{
const gdb_byte *start;
ULONGEST len;
} exp;
+
fn_prev_register fn;
} loc;
enum dwarf2_frame_reg_rule how;
@@ -96,22 +99,22 @@ enum cfa_how_kind
struct dwarf2_frame_state_reg_info
{
dwarf2_frame_state_reg_info () = default;
- ~dwarf2_frame_state_reg_info ()
- {
- delete prev;
- }
+
+ ~dwarf2_frame_state_reg_info () { delete prev; }
/* Copy constructor. */
dwarf2_frame_state_reg_info (const dwarf2_frame_state_reg_info &src)
- : reg (src.reg), cfa_offset (src.cfa_offset),
- cfa_reg (src.cfa_reg), cfa_how (src.cfa_how), cfa_exp (src.cfa_exp),
+ : reg (src.reg),
+ cfa_offset (src.cfa_offset),
+ cfa_reg (src.cfa_reg),
+ cfa_how (src.cfa_how),
+ cfa_exp (src.cfa_exp),
prev (src.prev)
{
}
/* Assignment operator for both move-assignment and copy-assignment. */
- dwarf2_frame_state_reg_info&
- operator= (dwarf2_frame_state_reg_info rhs)
+ dwarf2_frame_state_reg_info &operator= (dwarf2_frame_state_reg_info rhs)
{
swap (*this, rhs);
return *this;
@@ -119,8 +122,11 @@ struct dwarf2_frame_state_reg_info
/* Move constructor. */
dwarf2_frame_state_reg_info (dwarf2_frame_state_reg_info &&rhs) noexcept
- : reg (std::move (rhs.reg)), cfa_offset (rhs.cfa_offset),
- cfa_reg (rhs.cfa_reg), cfa_how (rhs.cfa_how), cfa_exp (rhs.cfa_exp),
+ : reg (std::move (rhs.reg)),
+ cfa_offset (rhs.cfa_offset),
+ cfa_reg (rhs.cfa_reg),
+ cfa_how (rhs.cfa_how),
+ cfa_exp (rhs.cfa_exp),
prev (rhs.prev)
{
rhs.prev = nullptr;
@@ -149,8 +155,9 @@ struct dwarf2_frame_state_reg_info
struct dwarf2_frame_state_reg_info *prev = NULL;
private:
- friend void swap (dwarf2_frame_state_reg_info& lhs,
- dwarf2_frame_state_reg_info& rhs)
+
+ friend void swap (dwarf2_frame_state_reg_info &lhs,
+ dwarf2_frame_state_reg_info &rhs)
{
using std::swap;
@@ -173,14 +180,18 @@ struct dwarf2_frame_state
/* Each register save state can be described in terms of a CFA slot,
another register, or a location expression. */
- struct dwarf2_frame_state_reg_info regs {};
+ struct dwarf2_frame_state_reg_info regs
+ {
+ };
/* The PC described by the current frame state. */
CORE_ADDR pc;
/* Initial register set from the CIE.
Used to implement DW_CFA_restore. */
- struct dwarf2_frame_state_reg_info initial {};
+ struct dwarf2_frame_state_reg_info initial
+ {
+ };
/* The information we care about from the CIE. */
const LONGEST data_align;
@@ -207,26 +218,23 @@ extern bool dwarf2_frame_unwinders_enabled_p;
/* Set the architecture-specific register state initialization
function for GDBARCH to INIT_REG. */
-extern void dwarf2_frame_set_init_reg (struct gdbarch *gdbarch,
- void (*init_reg) (struct gdbarch *, int,
- struct dwarf2_frame_state_reg *,
- frame_info_ptr));
+extern void dwarf2_frame_set_init_reg (
+ struct gdbarch *gdbarch,
+ void (*init_reg) (struct gdbarch *, int, struct dwarf2_frame_state_reg *,
+ frame_info_ptr));
/* Set the architecture-specific signal trampoline recognition
function for GDBARCH to SIGNAL_FRAME_P. */
-extern void
- dwarf2_frame_set_signal_frame_p (struct gdbarch *gdbarch,
- int (*signal_frame_p) (struct gdbarch *,
- frame_info_ptr));
+extern void dwarf2_frame_set_signal_frame_p (
+ struct gdbarch *gdbarch,
+ int (*signal_frame_p) (struct gdbarch *, frame_info_ptr));
/* Set the architecture-specific adjustment of .eh_frame and .debug_frame
register numbers. */
-extern void
- dwarf2_frame_set_adjust_regnum (struct gdbarch *gdbarch,
- int (*adjust_regnum) (struct gdbarch *,
- int, int));
+extern void dwarf2_frame_set_adjust_regnum (
+ struct gdbarch *gdbarch, int (*adjust_regnum) (struct gdbarch *, int, int));
/* Append the DWARF-2 frame unwinders to GDBARCH's list. */
@@ -236,7 +244,7 @@ void dwarf2_append_unwinders (struct gdbarch *gdbarch);
NULL if it can't be handled by the DWARF CFI frame unwinder. */
extern const struct frame_base *
- dwarf2_frame_base_sniffer (frame_info_ptr this_frame);
+dwarf2_frame_base_sniffer (frame_info_ptr this_frame);
/* Compute the DWARF CFA for a frame. */
@@ -264,7 +272,6 @@ extern int dwarf2_fetch_cfa_info (struct gdbarch *gdbarch, CORE_ADDR pc,
const gdb_byte **cfa_start_out,
const gdb_byte **cfa_end_out);
-
/* Allocate a new instance of the function unique data.
The main purpose of this custom function data object is to allow caching the
diff --git a/gdb/dwarf2/index-cache.c b/gdb/dwarf2/index-cache.c
index a74847949f9..969104a2137 100644
--- a/gdb/dwarf2/index-cache.c
+++ b/gdb/dwarf2/index-cache.c
@@ -37,9 +37,9 @@
/* When set to true, show debug messages about the index cache. */
static bool debug_index_cache = false;
-#define index_cache_debug(FMT, ...) \
- debug_prefixed_printf_cond_nofunc (debug_index_cache, "index-cache", \
- FMT, ## __VA_ARGS__)
+#define index_cache_debug(FMT, ...) \
+ debug_prefixed_printf_cond_nofunc (debug_index_cache, "index-cache", FMT, \
+ ##__VA_ARGS__)
/* The index cache directory, used for "set/show index-cache directory". */
static std::string index_cache_directory;
@@ -104,8 +104,7 @@ index_cache::store (dwarf2_per_objfile *per_objfile)
const bfd_build_id *build_id = build_id_bfd_get (obj->obfd.get ());
if (build_id == nullptr)
{
- index_cache_debug ("objfile %s has no build id",
- objfile_name (obj));
+ index_cache_debug ("objfile %s has no build id", objfile_name (obj));
return;
}
@@ -118,7 +117,8 @@ index_cache::store (dwarf2_per_objfile *per_objfile)
if (dwz != nullptr)
{
- const bfd_build_id *dwz_build_id = build_id_bfd_get (dwz->dwz_bfd.get ());
+ const bfd_build_id *dwz_build_id
+ = build_id_bfd_get (dwz->dwz_bfd.get ());
if (dwz_build_id == nullptr)
{
@@ -133,7 +133,7 @@ index_cache::store (dwarf2_per_objfile *per_objfile)
if (m_dir.empty ())
{
- warning (_("The index cache directory name is empty, skipping store."));
+ warning (_ ("The index cache directory name is empty, skipping store."));
return;
}
@@ -142,7 +142,7 @@ index_cache::store (dwarf2_per_objfile *per_objfile)
/* Try to create the containing directory. */
if (!mkdir_recursive (m_dir.c_str ()))
{
- warning (_("index cache: could not make cache directory: %s"),
+ warning (_ ("index cache: could not make cache directory: %s"),
safe_strerror (errno));
return;
}
@@ -152,9 +152,8 @@ index_cache::store (dwarf2_per_objfile *per_objfile)
/* Write the index itself to the directory, using the build id as the
filename. */
- write_dwarf_index (per_objfile, m_dir.c_str (),
- build_id_str.c_str (), dwz_build_id_ptr,
- dw_index_kind::GDB_INDEX);
+ write_dwarf_index (per_objfile, m_dir.c_str (), build_id_str.c_str (),
+ dwz_build_id_ptr, dw_index_kind::GDB_INDEX);
}
catch (const gdb_exception_error &except)
{
@@ -173,7 +172,8 @@ struct index_cache_resource_mmap final : public index_cache_resource
file doesn't exist. */
index_cache_resource_mmap (const char *filename)
: mapping (mmap_file (filename))
- {}
+ {
+ }
scoped_mmap mapping;
};
@@ -189,8 +189,8 @@ index_cache::lookup_gdb_index (const bfd_build_id *build_id,
if (m_dir.empty ())
{
- warning (_("The index cache directory name is empty, skipping cache "
- "lookup."));
+ warning (_ ("The index cache directory name is empty, skipping cache "
+ "lookup."));
return {};
}
@@ -199,8 +199,7 @@ index_cache::lookup_gdb_index (const bfd_build_id *build_id,
try
{
- index_cache_debug ("trying to read %s",
- filename.c_str ());
+ index_cache_debug ("trying to read %s", filename.c_str ());
/* Try to map that file. */
index_cache_resource_mmap *mmap_resource
@@ -209,14 +208,14 @@ index_cache::lookup_gdb_index (const bfd_build_id *build_id,
/* Yay, it worked! Hand the resource to the caller. */
resource->reset (mmap_resource);
- return gdb::array_view<const gdb_byte>
- ((const gdb_byte *) mmap_resource->mapping.get (),
- mmap_resource->mapping.size ());
+ return gdb::array_view<const gdb_byte> ((const gdb_byte *)
+ mmap_resource->mapping.get (),
+ mmap_resource->mapping.size ());
}
catch (const gdb_exception_error &except)
{
- index_cache_debug ("couldn't read %s: %s",
- filename.c_str (), except.what ());
+ index_cache_debug ("couldn't read %s: %s", filename.c_str (),
+ except.what ());
}
return {};
@@ -262,9 +261,8 @@ show_index_cache_command (const char *arg, int from_tty)
cmd_show_list (show_index_cache_prefix_list, from_tty);
gdb_printf ("\n");
- gdb_printf
- (_("The index cache is currently %s.\n"),
- global_index_cache.enabled () ? _("enabled") : _("disabled"));
+ gdb_printf (_ ("The index cache is currently %s.\n"),
+ global_index_cache.enabled () ? _ ("enabled") : _ ("disabled"));
}
/* "set/show index-cache enabled" set callback. */
@@ -292,7 +290,7 @@ static void
show_index_cache_enabled_command (ui_file *stream, int from_tty,
cmd_list_element *cmd, const char *value)
{
- gdb_printf (stream, _("The index cache is %s.\n"), value);
+ gdb_printf (stream, _ ("The index cache is %s.\n"), value);
}
/* "set index-cache directory" handler. */
@@ -321,13 +319,14 @@ show_index_cache_stats_command (const char *arg, int from_tty)
gdb_printf ("\n");
}
- gdb_printf (_("%s Cache hits (this session): %u\n"),
- indent, global_index_cache.n_hits ());
- gdb_printf (_("%sCache misses (this session): %u\n"),
- indent, global_index_cache.n_misses ());
+ gdb_printf (_ ("%s Cache hits (this session): %u\n"), indent,
+ global_index_cache.n_hits ());
+ gdb_printf (_ ("%sCache misses (this session): %u\n"), indent,
+ global_index_cache.n_misses ());
}
void _initialize_index_cache ();
+
void
_initialize_index_cache ()
{
@@ -339,30 +338,27 @@ _initialize_index_cache ()
global_index_cache.set_directory (std::move (cache_dir));
}
else
- warning (_("Couldn't determine a path for the index cache directory."));
+ warning (_ ("Couldn't determine a path for the index cache directory."));
/* set index-cache */
add_basic_prefix_cmd ("index-cache", class_files,
- _("Set index-cache options."),
- &set_index_cache_prefix_list,
- false, &setlist);
+ _ ("Set index-cache options."),
+ &set_index_cache_prefix_list, false, &setlist);
/* show index-cache */
add_prefix_cmd ("index-cache", class_files, show_index_cache_command,
- _("Show index-cache options."), &show_index_cache_prefix_list,
- false, &showlist);
+ _ ("Show index-cache options."),
+ &show_index_cache_prefix_list, false, &showlist);
/* set/show index-cache enabled */
set_show_commands setshow_index_cache_enabled_cmds
- = add_setshow_boolean_cmd ("enabled", class_files,
- _("Enable the index cache."),
- _("Show whether the index cache is enabled."),
- _("When on, enable the use of the index cache."),
- set_index_cache_enabled_command,
- get_index_cache_enabled_command,
- show_index_cache_enabled_command,
- &set_index_cache_prefix_list,
- &show_index_cache_prefix_list);
+ = add_setshow_boolean_cmd (
+ "enabled", class_files, _ ("Enable the index cache."),
+ _ ("Show whether the index cache is enabled."),
+ _ ("When on, enable the use of the index cache."),
+ set_index_cache_enabled_command, get_index_cache_enabled_command,
+ show_index_cache_enabled_command, &set_index_cache_prefix_list,
+ &show_index_cache_prefix_list);
/* set index-cache on */
cmd_list_element *set_index_cache_on_cmd
@@ -380,25 +376,23 @@ _initialize_index_cache ()
/* set index-cache directory */
add_setshow_filename_cmd ("directory", class_files, &index_cache_directory,
- _("Set the directory of the index cache."),
- _("Show the directory of the index cache."),
- NULL,
+ _ ("Set the directory of the index cache."),
+ _ ("Show the directory of the index cache."), NULL,
set_index_cache_directory_command, NULL,
&set_index_cache_prefix_list,
&show_index_cache_prefix_list);
/* show index-cache stats */
add_cmd ("stats", class_files, show_index_cache_stats_command,
- _("Show some stats about the index cache."),
+ _ ("Show some stats about the index cache."),
&show_index_cache_prefix_list);
/* set debug index-cache */
add_setshow_boolean_cmd ("index-cache", class_maintenance,
&debug_index_cache,
- _("Set display of index-cache debug messages."),
- _("Show display of index-cache debug messages."),
- _("\
+ _ ("Set display of index-cache debug messages."),
+ _ ("Show display of index-cache debug messages."),
+ _ ("\
When non-zero, debugging output for the index cache is displayed."),
- NULL, NULL,
- &setdebuglist, &showdebuglist);
+ NULL, NULL, &setdebuglist, &showdebuglist);
}
diff --git a/gdb/dwarf2/index-cache.h b/gdb/dwarf2/index-cache.h
index c4cadd0a458..095dc21625f 100644
--- a/gdb/dwarf2/index-cache.h
+++ b/gdb/dwarf2/index-cache.h
@@ -37,14 +37,12 @@ struct index_cache_resource
class index_cache
{
public:
+
/* Change the directory used to save/load index files. */
void set_directory (std::string dir);
/* Return true if the usage of the cache is enabled. */
- bool enabled () const
- {
- return m_enabled;
- }
+ bool enabled () const { return m_enabled; }
/* Enable the cache. */
void enable ();
@@ -66,8 +64,7 @@ public:
std::unique_ptr<index_cache_resource> *resource);
/* Return the number of cache hits. */
- unsigned int n_hits () const
- { return m_n_hits; }
+ unsigned int n_hits () const { return m_n_hits; }
/* Record a cache hit. */
void hit ()
@@ -77,8 +74,7 @@ public:
}
/* Return the number of cache misses. */
- unsigned int n_misses () const
- { return m_n_misses; }
+ unsigned int n_misses () const { return m_n_misses; }
/* Record a cache miss. */
void miss ()
diff --git a/gdb/dwarf2/index-write.c b/gdb/dwarf2/index-write.c
index 52f6054b234..d3bf59fa271 100644
--- a/gdb/dwarf2/index-write.c
+++ b/gdb/dwarf2/index-write.c
@@ -48,25 +48,31 @@
/* Ensure only legit values are used. */
#define DW2_GDB_INDEX_SYMBOL_STATIC_SET_VALUE(cu_index, value) \
- do { \
- gdb_assert ((unsigned int) (value) <= 1); \
- GDB_INDEX_SYMBOL_STATIC_SET_VALUE((cu_index), (value)); \
- } while (0)
+ do \
+ { \
+ gdb_assert ((unsigned int) (value) <= 1); \
+ GDB_INDEX_SYMBOL_STATIC_SET_VALUE ((cu_index), (value)); \
+ } \
+ while (0)
/* Ensure only legit values are used. */
-#define DW2_GDB_INDEX_SYMBOL_KIND_SET_VALUE(cu_index, value) \
- do { \
- gdb_assert ((value) >= GDB_INDEX_SYMBOL_KIND_TYPE \
- && (value) <= GDB_INDEX_SYMBOL_KIND_OTHER); \
- GDB_INDEX_SYMBOL_KIND_SET_VALUE((cu_index), (value)); \
- } while (0)
+#define DW2_GDB_INDEX_SYMBOL_KIND_SET_VALUE(cu_index, value) \
+ do \
+ { \
+ gdb_assert ((value) >= GDB_INDEX_SYMBOL_KIND_TYPE \
+ && (value) <= GDB_INDEX_SYMBOL_KIND_OTHER); \
+ GDB_INDEX_SYMBOL_KIND_SET_VALUE ((cu_index), (value)); \
+ } \
+ while (0)
/* Ensure we don't use more than the allotted number of bits for the CU. */
-#define DW2_GDB_INDEX_CU_SET_VALUE(cu_index, value) \
- do { \
- gdb_assert (((value) & ~GDB_INDEX_CU_MASK) == 0); \
- GDB_INDEX_CU_SET_VALUE((cu_index), (value)); \
- } while (0)
+#define DW2_GDB_INDEX_CU_SET_VALUE(cu_index, value) \
+ do \
+ { \
+ gdb_assert (((value) & ~GDB_INDEX_CU_MASK) == 0); \
+ GDB_INDEX_CU_SET_VALUE ((cu_index), (value)); \
+ } \
+ while (0)
/* The "save gdb-index" command. */
@@ -77,7 +83,7 @@ static void
file_write (FILE *file, const void *data, size_t size)
{
if (fwrite (data, 1, size, file) != size)
- error (_("couldn't data write to file"));
+ error (_ ("couldn't data write to file"));
}
/* Write the contents of VEC to FILE, with error checking. */
@@ -94,6 +100,7 @@ file_write (FILE *file, const std::vector<Elem, Alloc> &vec)
class data_buf
{
public:
+
/* Copy ARRAY to the end of the buffer. */
void append_array (gdb::array_view<const gdb_byte> array)
{
@@ -137,24 +144,16 @@ public:
}
/* Return the size of the buffer. */
- size_t size () const
- {
- return m_vec.size ();
- }
+ size_t size () const { return m_vec.size (); }
/* Return true iff the buffer is empty. */
- bool empty () const
- {
- return m_vec.empty ();
- }
+ bool empty () const { return m_vec.empty (); }
/* Write the buffer to FILE. */
- void file_write (FILE *file) const
- {
- ::file_write (file, m_vec);
- }
+ void file_write (FILE *file) const { ::file_write (file, m_vec); }
private:
+
/* Grow SIZE bytes at the end of the buffer. Returns a pointer to
the start of the new block. */
gdb_byte *grow (size_t size)
@@ -185,10 +184,7 @@ struct symtab_index_entry
/* The symbol table. This is a power-of-2-sized hash table. */
struct mapped_symtab
{
- mapped_symtab ()
- {
- data.resize (1024);
- }
+ mapped_symtab () { data.resize (1024); }
/* Minimize each entry in the symbol table, removing duplicates. */
void minimize ()
@@ -250,9 +246,8 @@ hash_expand (struct mapped_symtab *symtab)
IS_STATIC is one if the symbol is static, otherwise zero (global). */
static void
-add_index_entry (struct mapped_symtab *symtab, const char *name,
- int is_static, gdb_index_symbol_kind kind,
- offset_type cu_index)
+add_index_entry (struct mapped_symtab *symtab, const char *name, int is_static,
+ gdb_index_symbol_kind kind, offset_type cu_index)
{
offset_type cu_index_and_attrs;
@@ -301,16 +296,15 @@ symtab_index_entry::minimize ()
similar to what gdb historically did for partial symbols. */
std::unordered_set<offset_type> seen;
from = std::remove_if (cu_indices.begin (), cu_indices.end (),
- [&] (offset_type val)
- {
- gdb_index_symbol_kind kind = GDB_INDEX_SYMBOL_KIND_VALUE (val);
- if (kind != GDB_INDEX_SYMBOL_KIND_TYPE
- && kind != GDB_INDEX_SYMBOL_KIND_VARIABLE)
- return false;
-
- val &= ~GDB_INDEX_CU_MASK;
- return !seen.insert (val).second;
- });
+ [&] (offset_type val) {
+ gdb_index_symbol_kind kind = GDB_INDEX_SYMBOL_KIND_VALUE (val);
+ if (kind != GDB_INDEX_SYMBOL_KIND_TYPE
+ && kind != GDB_INDEX_SYMBOL_KIND_VARIABLE)
+ return false;
+
+ val &= ~GDB_INDEX_CU_MASK;
+ return !seen.insert (val).second;
+ });
cu_indices.erase (from, cu_indices.end ());
}
@@ -320,9 +314,11 @@ symtab_index_entry::minimize ()
class c_str_view
{
public:
+
c_str_view (const char *cstr)
: m_cstr (cstr)
- {}
+ {
+ }
bool operator== (const c_str_view &other) const
{
@@ -331,12 +327,10 @@ public:
/* Return the underlying C string. Note, the returned string is
only a reference with lifetime of this object. */
- const char *c_str () const
- {
- return m_cstr;
- }
+ const char *c_str () const { return m_cstr; }
private:
+
friend class c_str_view_hasher;
const char *const m_cstr;
};
@@ -346,7 +340,8 @@ private:
class c_str_view_hasher
{
public:
- size_t operator () (const c_str_view &x) const
+
+ size_t operator() (const c_str_view &x) const
{
return mapped_index_string_hash (INT_MAX, x.m_cstr);
}
@@ -357,10 +352,11 @@ template<typename T>
class vector_hasher
{
public:
- size_t operator () (const std::vector<T> &key) const
+
+ size_t operator() (const std::vector<T> &key) const
{
- return iterative_hash (key.data (),
- sizeof (key.front ()) * key.size (), 0);
+ return iterative_hash (key.data (), sizeof (key.front ()) * key.size (),
+ 0);
}
};
@@ -390,8 +386,7 @@ write_hash_table (mapped_symtab *symtab, data_buf &output, data_buf &cpool)
lookup, and then destroys the new node if another node
already had the same key. C++17 try_emplace will avoid
this. */
- const auto found
- = symbol_hash_table.find (entry.cu_indices);
+ const auto found = symbol_hash_table.find (entry.cu_indices);
if (found != symbol_hash_table.end ())
{
entry.index_offset = found->second;
@@ -414,7 +409,8 @@ write_hash_table (mapped_symtab *symtab, data_buf &output, data_buf &cpool)
if (entry.name != NULL)
{
- const auto insertpair = str_table.emplace (entry.name, cpool.size ());
+ const auto insertpair
+ = str_table.emplace (entry.name, cpool.size ());
if (insertpair.second)
cpool.append_cstr0 (entry.name);
str_off = insertpair.first->second;
@@ -442,7 +438,8 @@ struct addrmap_index_data
addrmap_index_data (data_buf &addr_vec_, cu_index_map &cu_index_htab_)
: addr_vec (addr_vec_),
cu_index_htab (cu_index_htab_)
- {}
+ {
+ }
data_buf &addr_vec;
cu_index_map &cu_index_htab;
@@ -462,8 +459,8 @@ struct addrmap_index_data
/* Write an address entry to ADDR_VEC. */
static void
-add_address_entry (data_buf &addr_vec,
- CORE_ADDR start, CORE_ADDR end, unsigned int cu_index)
+add_address_entry (data_buf &addr_vec, CORE_ADDR start, CORE_ADDR end,
+ unsigned int cu_index)
{
addr_vec.append_uint (8, BFD_ENDIAN_LITTLE, start);
addr_vec.append_uint (8, BFD_ENDIAN_LITTLE, end);
@@ -479,8 +476,7 @@ addrmap_index_data::operator() (CORE_ADDR start_addr, const void *obj)
= static_cast<const dwarf2_per_cu_data *> (obj);
if (previous_valid)
- add_address_entry (addr_vec,
- previous_cu_start, start_addr,
+ add_address_entry (addr_vec, previous_cu_start, start_addr,
previous_cu_index);
previous_cu_start = start_addr;
@@ -515,27 +511,27 @@ write_address_map (const addrmap *addrmap, data_buf &addr_vec,
doesn't work here. To cope we pass 0xff...ff, this is a rare situation
anyway. */
if (addrmap_index_data.previous_valid)
- add_address_entry (addr_vec,
- addrmap_index_data.previous_cu_start, (CORE_ADDR) -1,
- addrmap_index_data.previous_cu_index);
+ add_address_entry (addr_vec, addrmap_index_data.previous_cu_start,
+ (CORE_ADDR) -1, addrmap_index_data.previous_cu_index);
}
/* DWARF-5 .debug_names builder. */
class debug_names
{
public:
+
debug_names (dwarf2_per_objfile *per_objfile, bool is_dwarf64,
bfd_endian dwarf5_byte_order)
: m_dwarf5_byte_order (dwarf5_byte_order),
m_dwarf32 (dwarf5_byte_order),
m_dwarf64 (dwarf5_byte_order),
- m_dwarf (is_dwarf64
- ? static_cast<dwarf &> (m_dwarf64)
- : static_cast<dwarf &> (m_dwarf32)),
+ m_dwarf (is_dwarf64 ? static_cast<dwarf &> (m_dwarf64)
+ : static_cast<dwarf &> (m_dwarf32)),
m_name_table_string_offs (m_dwarf.name_table_string_offs),
m_name_table_entry_offs (m_dwarf.name_table_entry_offs),
m_debugstrlookup (per_objfile)
- {}
+ {
+ }
int dwarf5_offset_size () const
{
@@ -544,7 +540,11 @@ public:
}
/* Is this symbol from DW_TAG_compile_unit or DW_TAG_type_unit? */
- enum class unit_kind { cu, tu };
+ enum class unit_kind
+ {
+ cu,
+ tu
+ };
/* Insert one symbol. */
void insert (const cooked_index_entry *entry)
@@ -565,9 +565,8 @@ public:
int cu_index = it->second;
bool is_static = (entry->flags & IS_STATIC) != 0;
- unit_kind kind = (entry->per_cu->is_debug_types
- ? unit_kind::tu
- : unit_kind::cu);
+ unit_kind kind
+ = (entry->per_cu->is_debug_types ? unit_kind::tu : unit_kind::cu);
if (entry->per_cu->lang () == language_ada)
{
@@ -596,9 +595,9 @@ public:
see PR symtab/24820 for details. */
std::string decoded = ada_decode (name);
if (decoded[0] == '<')
- name = (char *) obstack_copy0 (&m_string_obstack,
- decoded.c_str () + 1,
- decoded.length () - 2);
+ name
+ = (char *) obstack_copy0 (&m_string_obstack, decoded.c_str () + 1,
+ decoded.length () - 2);
else
name = obstack_strdup (&m_string_obstack,
ada_encode (decoded.c_str ()));
@@ -619,8 +618,8 @@ public:
/* Verify the build method has not be called twice. */
gdb_assert (m_abbrev_table.empty ());
const size_t name_count = m_name_to_value_set.size ();
- m_bucket_table.resize
- (std::pow (2, std::ceil (std::log2 (name_count * 4 / 3))));
+ m_bucket_table.resize (std::pow (2, std::ceil (std::log2 (name_count * 4
+ / 3))));
m_hash_table.reserve (name_count);
m_name_table_string_offs.reserve (name_count);
m_name_table_entry_offs.reserve (name_count);
@@ -631,19 +630,19 @@ public:
uint32_t hash;
decltype (m_name_to_value_set)::const_iterator it;
};
+
std::vector<std::forward_list<hash_it_pair>> bucket_hash;
bucket_hash.resize (m_bucket_table.size ());
for (decltype (m_name_to_value_set)::const_iterator it
- = m_name_to_value_set.cbegin ();
- it != m_name_to_value_set.cend ();
- ++it)
+ = m_name_to_value_set.cbegin ();
+ it != m_name_to_value_set.cend (); ++it)
{
const char *const name = it->first.c_str ();
const uint32_t hash = dwarf5_djb_hash (name);
hash_it_pair hashitpair;
hashitpair.hash = hash;
hashitpair.it = it;
- auto &slot = bucket_hash[hash % bucket_hash.size()];
+ auto &slot = bucket_hash[hash % bucket_hash.size ()];
slot.push_front (std::move (hashitpair));
}
for (size_t bucket_ix = 0; bucket_ix < bucket_hash.size (); ++bucket_ix)
@@ -660,34 +659,35 @@ public:
for (const hash_it_pair &hashitpair : hashitlist)
{
m_hash_table.push_back (0);
- store_unsigned_integer (reinterpret_cast<gdb_byte *>
- (&m_hash_table.back ()),
- sizeof (m_hash_table.back ()),
- m_dwarf5_byte_order, hashitpair.hash);
+ store_unsigned_integer (
+ reinterpret_cast<gdb_byte *> (&m_hash_table.back ()),
+ sizeof (m_hash_table.back ()), m_dwarf5_byte_order,
+ hashitpair.hash);
const c_str_view &name = hashitpair.it->first;
const std::set<symbol_value> &value_set = hashitpair.it->second;
- m_name_table_string_offs.push_back_reorder
- (m_debugstrlookup.lookup (name.c_str ()));
+ m_name_table_string_offs.push_back_reorder (
+ m_debugstrlookup.lookup (name.c_str ()));
m_name_table_entry_offs.push_back_reorder (m_entry_pool.size ());
gdb_assert (!value_set.empty ());
for (const symbol_value &value : value_set)
{
- int &idx = m_indexkey_to_idx[index_key (value.dwarf_tag,
- value.is_static,
- value.kind)];
+ int &idx
+ = m_indexkey_to_idx[index_key (value.dwarf_tag,
+ value.is_static, value.kind)];
if (idx == 0)
{
idx = m_idx_next++;
m_abbrev_table.append_unsigned_leb128 (idx);
m_abbrev_table.append_unsigned_leb128 (value.dwarf_tag);
- m_abbrev_table.append_unsigned_leb128
- (value.kind == unit_kind::cu ? DW_IDX_compile_unit
- : DW_IDX_type_unit);
+ m_abbrev_table.append_unsigned_leb128 (
+ value.kind == unit_kind::cu ? DW_IDX_compile_unit
+ : DW_IDX_type_unit);
m_abbrev_table.append_unsigned_leb128 (DW_FORM_udata);
- m_abbrev_table.append_unsigned_leb128 (value.is_static
- ? DW_IDX_GNU_internal
- : DW_IDX_GNU_external);
- m_abbrev_table.append_unsigned_leb128 (DW_FORM_flag_present);
+ m_abbrev_table.append_unsigned_leb128 (
+ value.is_static ? DW_IDX_GNU_internal
+ : DW_IDX_GNU_external);
+ m_abbrev_table.append_unsigned_leb128 (
+ DW_FORM_flag_present);
/* Terminate attributes list. */
m_abbrev_table.append_unsigned_leb128 (0);
@@ -805,8 +805,8 @@ private:
= m_str_table.emplace (c_str_view (s),
data - per_objfile->per_bfd->str.buffer);
if (!insertpair.second)
- complaint (_("Duplicate string \"%s\" in "
- ".debug_str section [in module %s]"),
+ complaint (_ ("Duplicate string \"%s\" in "
+ ".debug_str section [in module %s]"),
s, bfd_get_filename (m_abfd));
data += strlen (s) + 1;
}
@@ -820,20 +820,18 @@ private:
const auto it = m_str_table.find (c_str_view (s));
if (it != m_str_table.end ())
return it->second;
- const size_t offset = (m_per_objfile->per_bfd->str.size
- + m_str_add_buf.size ());
+ const size_t offset
+ = (m_per_objfile->per_bfd->str.size + m_str_add_buf.size ());
m_str_table.emplace (c_str_view (s), offset);
m_str_add_buf.append_cstr0 (s);
return offset;
}
/* Append the end of the .debug_str section to FILE. */
- void file_write (FILE *file) const
- {
- m_str_add_buf.file_write (file);
- }
+ void file_write (FILE *file) const { m_str_add_buf.file_write (file); }
private:
+
std::unordered_map<c_str_view, size_t, c_str_view_hasher> m_str_table;
bfd *const m_abfd;
dwarf2_per_objfile *m_per_objfile;
@@ -847,13 +845,15 @@ private:
class index_key
{
public:
+
index_key (int dwarf_tag_, bool is_static_, unit_kind kind_)
- : dwarf_tag (dwarf_tag_), is_static (is_static_), kind (kind_)
+ : dwarf_tag (dwarf_tag_),
+ is_static (is_static_),
+ kind (kind_)
{
}
- bool
- operator== (const index_key &other) const
+ bool operator== (const index_key &other) const
{
return (dwarf_tag == other.dwarf_tag && is_static == other.is_static
&& kind == other.kind);
@@ -868,10 +868,10 @@ private:
class index_key_hasher
{
public:
- size_t
- operator () (const index_key &key) const
+
+ size_t operator() (const index_key &key) const
{
- return (std::hash<int>() (key.dwarf_tag) << 1) | key.is_static;
+ return (std::hash<int> () (key.dwarf_tag) << 1) | key.is_static;
}
};
@@ -879,27 +879,30 @@ private:
class symbol_value
{
public:
+
const int dwarf_tag, cu_index;
const bool is_static;
const unit_kind kind;
symbol_value (int dwarf_tag_, int cu_index_, bool is_static_,
unit_kind kind_)
- : dwarf_tag (dwarf_tag_), cu_index (cu_index_), is_static (is_static_),
+ : dwarf_tag (dwarf_tag_),
+ cu_index (cu_index_),
+ is_static (is_static_),
kind (kind_)
- {}
+ {
+ }
- bool
- operator< (const symbol_value &other) const
+ bool operator<(const symbol_value &other) const
{
-#define X(n) \
- do \
- { \
+#define X(n) \
+ do \
+ { \
if (n < other.n) \
- return true; \
+ return true; \
if (n > other.n) \
- return false; \
- } \
+ return false; \
+ } \
while (0)
X (dwarf_tag);
X (is_static);
@@ -915,11 +918,15 @@ private:
class offset_vec
{
protected:
+
const bfd_endian dwarf5_byte_order;
+
public:
+
explicit offset_vec (bfd_endian dwarf5_byte_order_)
: dwarf5_byte_order (dwarf5_byte_order_)
- {}
+ {
+ }
/* Call std::vector::reserve for NELEM elements. */
virtual void reserve (size_t nelem) = 0;
@@ -940,16 +947,15 @@ private:
class offset_vec_tmpl : public offset_vec
{
public:
+
explicit offset_vec_tmpl (bfd_endian dwarf5_byte_order_)
: offset_vec (dwarf5_byte_order_)
- {}
-
- /* Implement offset_vec::reserve. */
- void reserve (size_t nelem) override
{
- m_vec.reserve (nelem);
}
+ /* Implement offset_vec::reserve. */
+ void reserve (size_t nelem) override { m_vec.reserve (nelem); }
+
/* Implement offset_vec::push_back_reorder. */
void push_back_reorder (size_t elem) override
{
@@ -967,12 +973,10 @@ private:
}
/* Implement offset_vec::file_write. */
- void file_write (FILE *file) const override
- {
- ::file_write (file, m_vec);
- }
+ void file_write (FILE *file) const override { ::file_write (file, m_vec); }
private:
+
std::vector<OffsetSize> m_vec;
};
@@ -981,6 +985,7 @@ private:
class dwarf
{
public:
+
offset_vec &name_table_string_offs, &name_table_entry_offs;
dwarf (offset_vec &name_table_string_offs_,
@@ -997,13 +1002,16 @@ private:
class dwarf_tmpl : public dwarf
{
public:
+
explicit dwarf_tmpl (bfd_endian dwarf5_byte_order_)
: dwarf (m_name_table_string_offs, m_name_table_entry_offs),
m_name_table_string_offs (dwarf5_byte_order_),
m_name_table_entry_offs (dwarf5_byte_order_)
- {}
+ {
+ }
private:
+
offset_vec_tmpl<OffsetSize> m_name_table_string_offs;
offset_vec_tmpl<OffsetSize> m_name_table_entry_offs;
};
@@ -1075,12 +1083,9 @@ assert_file_size (FILE *file, size_t expected_size)
arguments. */
static void
-write_gdbindex_1 (FILE *out_file,
- const data_buf &cu_list,
- const data_buf &types_cu_list,
- const data_buf &addr_vec,
- const data_buf &symtab_vec,
- const data_buf &constant_pool)
+write_gdbindex_1 (FILE *out_file, const data_buf &cu_list,
+ const data_buf &types_cu_list, const data_buf &addr_vec,
+ const data_buf &symtab_vec, const data_buf &constant_pool)
{
data_buf contents;
const offset_type size_of_header = 6 * sizeof (offset_type);
@@ -1124,8 +1129,7 @@ write_gdbindex_1 (FILE *out_file,
/* Write the contents of the internal "cooked" index. */
static void
-write_cooked_index (cooked_index *table,
- const cu_index_map &cu_index_htab,
+write_cooked_index (cooked_index *table, const cu_index_map &cu_index_htab,
struct mapped_symtab *symtab)
{
const char *main_for_ada = main_name ();
@@ -1155,8 +1159,8 @@ write_cooked_index (cooked_index *table,
gdb, it has to use the encoded name, with any
suffixes stripped. */
std::string encoded = ada_encode (name, false);
- name = obstack_strdup (&symtab->m_string_obstack,
- encoded.c_str ());
+ name
+ = obstack_strdup (&symtab->m_string_obstack, encoded.c_str ());
}
}
else if (entry->per_cu->lang () == language_cplus
@@ -1178,8 +1182,7 @@ write_cooked_index (cooked_index *table,
gdb_index_symbol_kind kind;
if (entry->tag == DW_TAG_subprogram)
kind = GDB_INDEX_SYMBOL_KIND_FUNCTION;
- else if (entry->tag == DW_TAG_variable
- || entry->tag == DW_TAG_constant
+ else if (entry->tag == DW_TAG_variable || entry->tag == DW_TAG_constant
|| entry->tag == DW_TAG_enumerator)
kind = GDB_INDEX_SYMBOL_KIND_VARIABLE;
else if (entry->tag == DW_TAG_module
@@ -1188,8 +1191,8 @@ write_cooked_index (cooked_index *table,
else
kind = GDB_INDEX_SYMBOL_KIND_TYPE;
- add_index_entry (symtab, name, (entry->flags & IS_STATIC) != 0,
- kind, it->second);
+ add_index_entry (symtab, name, (entry->flags & IS_STATIC) != 0, kind,
+ it->second);
}
}
@@ -1224,8 +1227,7 @@ write_gdbindex (dwarf2_per_objfile *per_objfile, cooked_index *table,
int types_counter = 0;
for (int i = 0; i < per_objfile->per_bfd->all_units.size (); ++i)
{
- dwarf2_per_cu_data *per_cu
- = per_objfile->per_bfd->all_units[i].get ();
+ dwarf2_per_cu_data *per_cu = per_objfile->per_bfd->all_units[i].get ();
int &this_counter = per_cu->is_debug_types ? types_counter : counter;
@@ -1235,9 +1237,9 @@ write_gdbindex (dwarf2_per_objfile *per_objfile, cooked_index *table,
/* The all_units list contains CUs read from the objfile as well as
from the eventual dwz file. We need to place the entry in the
corresponding index. */
- data_buf &cu_list = (per_cu->is_debug_types
- ? types_cu_list
- : per_cu->is_dwz ? dwz_cu_list : objfile_cu_list);
+ data_buf &cu_list = (per_cu->is_debug_types ? types_cu_list
+ : per_cu->is_dwz ? dwz_cu_list
+ : objfile_cu_list);
cu_list.append_uint (8, BFD_ENDIAN_LITTLE,
to_underlying (per_cu->sect_off));
if (per_cu->is_debug_types)
@@ -1245,8 +1247,7 @@ write_gdbindex (dwarf2_per_objfile *per_objfile, cooked_index *table,
signatured_type *sig_type = (signatured_type *) per_cu;
cu_list.append_uint (8, BFD_ENDIAN_LITTLE,
to_underlying (sig_type->type_offset_in_tu));
- cu_list.append_uint (8, BFD_ENDIAN_LITTLE,
- sig_type->signature);
+ cu_list.append_uint (8, BFD_ENDIAN_LITTLE, sig_type->signature);
}
else
cu_list.append_uint (8, BFD_ENDIAN_LITTLE, per_cu->length ());
@@ -1271,8 +1272,8 @@ write_gdbindex (dwarf2_per_objfile *per_objfile, cooked_index *table,
write_hash_table (&symtab, symtab_vec, constant_pool);
- write_gdbindex_1(out_file, objfile_cu_list, types_cu_list, addr_vec,
- symtab_vec, constant_pool);
+ write_gdbindex_1 (out_file, objfile_cu_list, types_cu_list, addr_vec,
+ symtab_vec, constant_pool);
if (dwz_out_file != NULL)
write_gdbindex_1 (dwz_out_file, dwz_cu_list, {}, {}, {}, {});
@@ -1306,8 +1307,7 @@ write_debug_names (dwarf2_per_objfile *per_objfile, cooked_index *table,
int types_counter = 0;
for (int i = 0; i < per_objfile->per_bfd->all_units.size (); ++i)
{
- dwarf2_per_cu_data *per_cu
- = per_objfile->per_bfd->all_units[i].get ();
+ dwarf2_per_cu_data *per_cu = per_objfile->per_bfd->all_units[i].get ();
int &this_counter = per_cu->is_debug_types ? types_counter : counter;
data_buf &this_list = per_cu->is_debug_types ? types_cu_list : cu_list;
@@ -1319,7 +1319,7 @@ write_debug_names (dwarf2_per_objfile *per_objfile, cooked_index *table,
++this_counter;
}
- /* Verify that all units are represented. */
+ /* Verify that all units are represented. */
gdb_assert (counter == per_objfile->per_bfd->all_comp_units.size ());
gdb_assert (types_counter == per_objfile->per_bfd->all_type_units.size ());
@@ -1331,8 +1331,7 @@ write_debug_names (dwarf2_per_objfile *per_objfile, cooked_index *table,
/* No addr_vec - DWARF-5 uses .debug_aranges generated by GCC. */
const offset_type bytes_of_header
- = ((dwarf5_is_dwarf64 ? 12 : 4)
- + 2 + 2 + 7 * 4
+ = ((dwarf5_is_dwarf64 ? 12 : 4) + 2 + 2 + 7 * 4
+ sizeof (dwarf5_gdb_augmentation));
size_t expected_bytes = 0;
expected_bytes += bytes_of_header;
@@ -1407,23 +1406,21 @@ write_debug_names (dwarf2_per_objfile *per_objfile, cooked_index *table,
struct index_wip_file
{
- index_wip_file (const char *dir, const char *basename,
- const char *suffix)
+ index_wip_file (const char *dir, const char *basename, const char *suffix)
{
- filename = (std::string (dir) + SLASH_STRING + basename
- + suffix);
+ filename = (std::string (dir) + SLASH_STRING + basename + suffix);
filename_temp = make_temp_filename (filename);
- scoped_fd out_file_fd = gdb_mkostemp_cloexec (filename_temp.data (),
- O_BINARY);
+ scoped_fd out_file_fd
+ = gdb_mkostemp_cloexec (filename_temp.data (), O_BINARY);
if (out_file_fd.get () == -1)
perror_with_name (("mkstemp"));
out_file = out_file_fd.to_file ("wb");
if (out_file == nullptr)
- error (_("Can't open `%s' for writing"), filename_temp.data ());
+ error (_ ("Can't open `%s' for writing"), filename_temp.data ());
unlink_file.emplace (filename_temp.data ());
}
@@ -1461,23 +1458,25 @@ write_dwarf_index (dwarf2_per_objfile *per_objfile, const char *dir,
struct objfile *objfile = per_objfile->objfile;
if (per_objfile->per_bfd->index_table == nullptr)
- error (_("No debugging symbols"));
- cooked_index *table = per_objfile->per_bfd->index_table->index_for_writing ();
+ error (_ ("No debugging symbols"));
+ cooked_index *table
+ = per_objfile->per_bfd->index_table->index_for_writing ();
if (per_objfile->per_bfd->types.size () > 1)
- error (_("Cannot make an index when the file has multiple .debug_types sections"));
-
+ error (_ ("Cannot make an index when the file has multiple .debug_types "
+ "sections"));
gdb_assert ((objfile->flags & OBJF_NOT_FILENAME) == 0);
- const char *index_suffix = (index_kind == dw_index_kind::DEBUG_NAMES
- ? INDEX5_SUFFIX : INDEX4_SUFFIX);
+ const char *index_suffix
+ = (index_kind == dw_index_kind::DEBUG_NAMES ? INDEX5_SUFFIX
+ : INDEX4_SUFFIX);
index_wip_file objfile_index_wip (dir, basename, index_suffix);
gdb::optional<index_wip_file> dwz_index_wip;
if (dwz_basename != NULL)
- dwz_index_wip.emplace (dir, dwz_basename, index_suffix);
+ dwz_index_wip.emplace (dir, dwz_basename, index_suffix);
if (index_kind == dw_index_kind::DEBUG_NAMES)
{
@@ -1491,7 +1490,8 @@ write_dwarf_index (dwarf2_per_objfile *per_objfile, const char *dir,
else
write_gdbindex (per_objfile, table, objfile_index_wip.out_file.get (),
(dwz_index_wip.has_value ()
- ? dwz_index_wip->out_file.get () : NULL));
+ ? dwz_index_wip->out_file.get ()
+ : NULL));
objfile_index_wip.finalize ();
@@ -1523,7 +1523,7 @@ save_gdb_index_command (const char *arg, int from_tty)
}
if (!*arg)
- error (_("usage: save gdb-index [-dwarf-5] DIRECTORY"));
+ error (_ ("usage: save gdb-index [-dwarf-5] DIRECTORY"));
for (objfile *objfile : current_program_space->objfiles ())
{
@@ -1550,20 +1550,20 @@ save_gdb_index_command (const char *arg, int from_tty)
catch (const gdb_exception_error &except)
{
exception_fprintf (gdb_stderr, except,
- _("Error while writing index for `%s': "),
+ _ ("Error while writing index for `%s': "),
objfile_name (objfile));
}
- }
-
+ }
}
}
void _initialize_dwarf_index_write ();
+
void
_initialize_dwarf_index_write ()
{
- cmd_list_element *c = add_cmd ("gdb-index", class_files,
- save_gdb_index_command, _("\
+ cmd_list_element *c
+ = add_cmd ("gdb-index", class_files, save_gdb_index_command, _ ("\
Save a gdb-index file.\n\
Usage: save gdb-index [-dwarf-5] DIRECTORY\n\
\n\
diff --git a/gdb/dwarf2/index-write.h b/gdb/dwarf2/index-write.h
index be8052a08d5..c81698bd06f 100644
--- a/gdb/dwarf2/index-write.h
+++ b/gdb/dwarf2/index-write.h
@@ -32,8 +32,9 @@
derived from INDEX_KIND is added to this base name. DWZ_BASENAME is the
same, but for the dwz file's index. */
-extern void write_dwarf_index
- (dwarf2_per_objfile *per_objfile, const char *dir, const char *basename,
- const char *dwz_basename, dw_index_kind index_kind);
+extern void write_dwarf_index (dwarf2_per_objfile *per_objfile,
+ const char *dir, const char *basename,
+ const char *dwz_basename,
+ dw_index_kind index_kind);
#endif /* DWARF_INDEX_WRITE_H */
diff --git a/gdb/dwarf2/leb.c b/gdb/dwarf2/leb.c
index 8dbfac2fb1e..9144cdda834 100644
--- a/gdb/dwarf2/leb.c
+++ b/gdb/dwarf2/leb.c
@@ -29,7 +29,7 @@
ULONGEST
read_unsigned_leb128 (bfd *abfd, const gdb_byte *buf,
- unsigned int *bytes_read_ptr)
+ unsigned int *bytes_read_ptr)
{
ULONGEST result;
unsigned int num_read;
@@ -127,7 +127,7 @@ read_offset (bfd *abfd, const gdb_byte *buf, unsigned int offset_size)
retval = bfd_get_64 (abfd, buf);
break;
default:
- internal_error (_("read_offset_1: bad switch [in module %s]"),
+ internal_error (_ ("read_offset_1: bad switch [in module %s]"),
bfd_get_filename (abfd));
}
diff --git a/gdb/dwarf2/line-header.c b/gdb/dwarf2/line-header.c
index 9d74c8fe75b..f81f9182f3c 100644
--- a/gdb/dwarf2/line-header.c
+++ b/gdb/dwarf2/line-header.c
@@ -36,20 +36,17 @@ line_header::add_include_dir (const char *include_dir)
new_size = m_include_dirs.size ();
else
new_size = m_include_dirs.size () + 1;
- gdb_printf (gdb_stdlog, "Adding dir %zu: %s\n",
- new_size, include_dir);
+ gdb_printf (gdb_stdlog, "Adding dir %zu: %s\n", new_size, include_dir);
}
m_include_dirs.push_back (include_dir);
}
void
-line_header::add_file_name (const char *name,
- dir_index d_index,
- unsigned int mod_time,
- unsigned int length)
+line_header::add_file_name (const char *name, dir_index d_index,
+ unsigned int mod_time, unsigned int length)
{
file_name_index index
- = version >= 5 ? file_names_size (): file_names_size () + 1;
+ = version >= 5 ? file_names_size () : file_names_size () + 1;
if (dwarf_line_debug >= 2)
gdb_printf (gdb_stdlog, "Adding file %d: %s\n", index, name);
@@ -83,7 +80,7 @@ line_header::file_file_name (const file_entry &fe) const
static void
dwarf2_statement_list_fits_in_line_number_section_complaint (void)
{
- complaint (_("statement list doesn't fit in .debug_line section"));
+ complaint (_ ("statement list doesn't fit in .debug_line section"));
}
/* Cover function for read_initial_length.
@@ -107,7 +104,7 @@ read_checked_initial_length_and_offset (bfd *abfd, const gdb_byte *buf,
|| cu_header->initial_length_size == 12);
if (cu_header->initial_length_size != *bytes_read)
- complaint (_("intermixed 32-bit and 64-bit DWARF sections"));
+ complaint (_ ("intermixed 32-bit and 64-bit DWARF sections"));
*offset_size = (*bytes_read == 4) ? 4 : 8;
return length;
@@ -123,8 +120,7 @@ read_formatted_entries (dwarf2_per_objfile *per_objfile, bfd *abfd,
const gdb_byte **bufp, struct line_header *lh,
unsigned int offset_size,
void (*callback) (struct line_header *lh,
- const char *name,
- dir_index d_index,
+ const char *name, dir_index d_index,
unsigned int mod_time,
unsigned int length))
{
@@ -154,10 +150,11 @@ read_formatted_entries (dwarf2_per_objfile *per_objfile, bfd *abfd,
for (formati = 0; formati < format_count; formati++)
{
- ULONGEST content_type = read_unsigned_leb128 (abfd, format, &bytes_read);
+ ULONGEST content_type
+ = read_unsigned_leb128 (abfd, format, &bytes_read);
format += bytes_read;
- ULONGEST form = read_unsigned_leb128 (abfd, format, &bytes_read);
+ ULONGEST form = read_unsigned_leb128 (abfd, format, &bytes_read);
format += bytes_read;
gdb::optional<const char *> string;
@@ -236,7 +233,7 @@ read_formatted_entries (dwarf2_per_objfile *per_objfile, bfd *abfd,
case DW_LNCT_MD5:
break;
default:
- complaint (_("Unknown format content type %s"),
+ complaint (_ ("Unknown format content type %s"),
pulongest (content_type));
}
}
@@ -250,11 +247,11 @@ read_formatted_entries (dwarf2_per_objfile *per_objfile, bfd *abfd,
/* See line-header.h. */
line_header_up
-dwarf_decode_line_header (sect_offset sect_off, bool is_dwz,
- dwarf2_per_objfile *per_objfile,
- struct dwarf2_section_info *section,
- const struct comp_unit_head *cu_header,
- const char *comp_dir)
+dwarf_decode_line_header (sect_offset sect_off, bool is_dwz,
+ dwarf2_per_objfile *per_objfile,
+ struct dwarf2_section_info *section,
+ const struct comp_unit_head *cu_header,
+ const char *comp_dir)
{
const gdb_byte *line_ptr;
unsigned int bytes_read, offset_size;
@@ -298,7 +295,7 @@ dwarf_decode_line_header (sect_offset sect_off, bool is_dwz,
{
/* This is a version we don't understand. The format could have
changed in ways we don't handle properly so just punt. */
- complaint (_("unsupported version in .debug_line section"));
+ complaint (_ ("unsupported version in .debug_line section"));
return NULL;
}
if (lh->version >= 5)
@@ -313,8 +310,8 @@ dwarf_decode_line_header (sect_offset sect_off, bool is_dwz,
line_ptr += 1;
if (segment_selector_size != 0)
{
- complaint (_("unsupported segment selector size %u "
- "in .debug_line section"),
+ complaint (_ ("unsupported segment selector size %u "
+ "in .debug_line section"),
segment_selector_size);
return NULL;
}
@@ -337,8 +334,8 @@ dwarf_decode_line_header (sect_offset sect_off, bool is_dwz,
if (lh->maximum_ops_per_instruction == 0)
{
lh->maximum_ops_per_instruction = 1;
- complaint (_("invalid maximum_ops_per_instruction "
- "in `.debug_line' section"));
+ complaint (_ ("invalid maximum_ops_per_instruction "
+ "in `.debug_line' section"));
}
lh->default_is_stmt = read_1_byte (abfd, line_ptr);
@@ -351,7 +348,7 @@ dwarf_decode_line_header (sect_offset sect_off, bool is_dwz,
line_ptr += 1;
lh->standard_opcode_lengths.reset (new unsigned char[lh->opcode_base]);
- lh->standard_opcode_lengths[0] = 1; /* This should never be used anyway. */
+ lh->standard_opcode_lengths[0] = 1; /* This should never be used anyway. */
for (i = 1; i < lh->opcode_base; ++i)
{
lh->standard_opcode_lengths[i] = read_1_byte (abfd, line_ptr);
@@ -365,25 +362,24 @@ dwarf_decode_line_header (sect_offset sect_off, bool is_dwz,
offset_size,
[] (struct line_header *header, const char *name,
dir_index d_index, unsigned int mod_time,
- unsigned int length)
- {
- header->add_include_dir (name);
- });
+ unsigned int length) {
+ header->add_include_dir (name);
+ });
/* Read file name table. */
read_formatted_entries (per_objfile, abfd, &line_ptr, lh.get (),
offset_size,
[] (struct line_header *header, const char *name,
dir_index d_index, unsigned int mod_time,
- unsigned int length)
- {
- header->add_file_name (name, d_index, mod_time, length);
- });
+ unsigned int length) {
+ header->add_file_name (name, d_index, mod_time, length);
+ });
}
else
{
/* Read directory table. */
- while ((cur_dir = read_direct_string (abfd, line_ptr, &bytes_read)) != NULL)
+ while ((cur_dir = read_direct_string (abfd, line_ptr, &bytes_read))
+ != NULL)
{
line_ptr += bytes_read;
lh->add_include_dir (cur_dir);
@@ -391,13 +387,15 @@ dwarf_decode_line_header (sect_offset sect_off, bool is_dwz,
line_ptr += bytes_read;
/* Read file name table. */
- while ((cur_file = read_direct_string (abfd, line_ptr, &bytes_read)) != NULL)
+ while ((cur_file = read_direct_string (abfd, line_ptr, &bytes_read))
+ != NULL)
{
unsigned int mod_time, length;
dir_index d_index;
line_ptr += bytes_read;
- d_index = (dir_index) read_unsigned_leb128 (abfd, line_ptr, &bytes_read);
+ d_index
+ = (dir_index) read_unsigned_leb128 (abfd, line_ptr, &bytes_read);
line_ptr += bytes_read;
mod_time = read_unsigned_leb128 (abfd, line_ptr, &bytes_read);
line_ptr += bytes_read;
@@ -410,8 +408,8 @@ dwarf_decode_line_header (sect_offset sect_off, bool is_dwz,
}
if (line_ptr > (section->buffer + section->size))
- complaint (_("line number info header doesn't "
- "fit in `.debug_line' section"));
+ complaint (_ ("line number info header doesn't "
+ "fit in `.debug_line' section"));
return lh;
}
diff --git a/gdb/dwarf2/line-header.h b/gdb/dwarf2/line-header.h
index 59a42e336f5..7472e9d7e5f 100644
--- a/gdb/dwarf2/line-header.h
+++ b/gdb/dwarf2/line-header.h
@@ -41,7 +41,8 @@ struct file_entry
d_index (d_index_),
mod_time (mod_time_),
length (length_)
- {}
+ {
+ }
/* Return the include directory at D_INDEX stored in LH. Returns
NULL if D_INDEX is out of bounds. */
@@ -74,15 +75,18 @@ struct line_header
unit in the context of which we are reading this line header, or nullptr
if unknown or not applicable. */
explicit line_header (const char *comp_dir)
- : offset_in_dwz {}, m_comp_dir (comp_dir)
- {}
+ : offset_in_dwz {},
+ m_comp_dir (comp_dir)
+ {
+ }
/* This constructor should only be used to create line_header intances to do
hash table lookups. */
line_header (sect_offset sect_off, bool offset_in_dwz)
: sect_off (sect_off),
offset_in_dwz (offset_in_dwz)
- {}
+ {
+ }
/* Add an entry to the include directory table. */
void add_include_dir (const char *include_dir);
@@ -136,11 +140,10 @@ struct line_header
/* The indexes are 0-based in DWARF 5 and 1-based in DWARF 4. Therefore,
this method should only be used to iterate through all file entries in an
index-agnostic manner. */
- std::vector<file_entry> &file_names ()
- { return m_file_names; }
+ std::vector<file_entry> &file_names () { return m_file_names; }
+
/* A const overload of the same. */
- const std::vector<file_entry> &file_names () const
- { return m_file_names; }
+ const std::vector<file_entry> &file_names () const { return m_file_names; }
/* Offset of line number information in .debug_line section. */
sect_offset sect_off {};
@@ -162,8 +165,7 @@ struct line_header
element is standard_opcode_lengths[opcode_base - 1]. */
std::unique_ptr<unsigned char[]> standard_opcode_lengths;
- int file_names_size () const
- { return m_file_names.size(); }
+ int file_names_size () const { return m_file_names.size (); }
/* The start and end of the statement program following this
header. These point into dwarf2_per_objfile->line_buffer. */
@@ -177,10 +179,10 @@ struct line_header
/* Return the compilation directory of the compilation unit in the context of
which this line header is read. Return nullptr if non applicable. */
- const char *comp_dir () const
- { return m_comp_dir; }
+ const char *comp_dir () const { return m_comp_dir; }
+
+private:
- private:
/* The include_directories table. Note these are observing
pointers. The memory is owned by debug_line_buffer. */
std::vector<const char *> m_include_dirs;
@@ -212,9 +214,9 @@ file_entry::include_dir (const line_header *lh) const
the returned object point into the dwarf line section buffer,
and must not be freed. */
-extern line_header_up dwarf_decode_line_header
- (sect_offset sect_off, bool is_dwz, dwarf2_per_objfile *per_objfile,
- struct dwarf2_section_info *section, const struct comp_unit_head *cu_header,
- const char *comp_dir);
+extern line_header_up dwarf_decode_line_header (
+ sect_offset sect_off, bool is_dwz, dwarf2_per_objfile *per_objfile,
+ struct dwarf2_section_info *section, const struct comp_unit_head *cu_header,
+ const char *comp_dir);
#endif /* DWARF2_LINE_HEADER_H */
diff --git a/gdb/dwarf2/loc.c b/gdb/dwarf2/loc.c
index 236ad820462..da0ede5797a 100644
--- a/gdb/dwarf2/loc.c
+++ b/gdb/dwarf2/loc.c
@@ -47,10 +47,10 @@
#include "gdbsupport/underlying.h"
#include "gdbsupport/byte-vector.h"
-static struct value *dwarf2_evaluate_loc_desc_full
- (struct type *type, frame_info_ptr frame, const gdb_byte *data,
- size_t size, dwarf2_per_cu_data *per_cu, dwarf2_per_objfile *per_objfile,
- struct type *subobj_type, LONGEST subobj_byte_offset, bool as_lval = true);
+static struct value *dwarf2_evaluate_loc_desc_full (
+ struct type *type, frame_info_ptr frame, const gdb_byte *data, size_t size,
+ dwarf2_per_cu_data *per_cu, dwarf2_per_objfile *per_objfile,
+ struct type *subobj_type, LONGEST subobj_byte_offset, bool as_lval = true);
/* Until these have formal names, we define these here.
ref: http://gcc.gnu.org/wiki/DebugFission
@@ -95,8 +95,8 @@ enum debug_loc_kind
void
invalid_synthetic_pointer (void)
{
- error (_("access outside bounds of object "
- "referenced via synthetic pointer"));
+ error (_ ("access outside bounds of object "
+ "referenced via synthetic pointer"));
}
/* Decode the addresses in a non-dwo .debug_loc entry.
@@ -106,13 +106,11 @@ invalid_synthetic_pointer (void)
static enum debug_loc_kind
decode_debug_loc_addresses (const gdb_byte *loc_ptr, const gdb_byte *buf_end,
- const gdb_byte **new_ptr,
- CORE_ADDR *low, CORE_ADDR *high,
- enum bfd_endian byte_order,
- unsigned int addr_size,
- int signed_addr_p)
+ const gdb_byte **new_ptr, CORE_ADDR *low,
+ CORE_ADDR *high, enum bfd_endian byte_order,
+ unsigned int addr_size, int signed_addr_p)
{
- CORE_ADDR base_mask = ~(~(CORE_ADDR)1 << (addr_size * 8 - 1));
+ CORE_ADDR base_mask = ~(~(CORE_ADDR) 1 << (addr_size * 8 - 1));
if (buf_end - loc_ptr < 2 * addr_size)
return DEBUG_LOC_BUFFER_OVERFLOW;
@@ -154,11 +152,9 @@ decode_debug_loclists_addresses (dwarf2_per_cu_data *per_cu,
dwarf2_per_objfile *per_objfile,
const gdb_byte *loc_ptr,
const gdb_byte *buf_end,
- const gdb_byte **new_ptr,
- CORE_ADDR *low, CORE_ADDR *high,
- enum bfd_endian byte_order,
- unsigned int addr_size,
- int signed_addr_p)
+ const gdb_byte **new_ptr, CORE_ADDR *low,
+ CORE_ADDR *high, enum bfd_endian byte_order,
+ unsigned int addr_size, int signed_addr_p)
{
uint64_t u64;
@@ -171,7 +167,7 @@ decode_debug_loclists_addresses (dwarf2_per_cu_data *per_cu,
*low = 0;
loc_ptr = gdb_read_uleb128 (loc_ptr, buf_end, &u64);
if (loc_ptr == NULL)
- return DEBUG_LOC_BUFFER_OVERFLOW;
+ return DEBUG_LOC_BUFFER_OVERFLOW;
*high = dwarf2_read_addr_index (per_cu, per_objfile, u64);
*new_ptr = loc_ptr;
@@ -180,13 +176,13 @@ decode_debug_loclists_addresses (dwarf2_per_cu_data *per_cu,
case DW_LLE_startx_length:
loc_ptr = gdb_read_uleb128 (loc_ptr, buf_end, &u64);
if (loc_ptr == NULL)
- return DEBUG_LOC_BUFFER_OVERFLOW;
+ return DEBUG_LOC_BUFFER_OVERFLOW;
*low = dwarf2_read_addr_index (per_cu, per_objfile, u64);
*high = *low;
loc_ptr = gdb_read_uleb128 (loc_ptr, buf_end, &u64);
if (loc_ptr == NULL)
- return DEBUG_LOC_BUFFER_OVERFLOW;
+ return DEBUG_LOC_BUFFER_OVERFLOW;
*high += u64;
*new_ptr = loc_ptr;
@@ -194,19 +190,19 @@ decode_debug_loclists_addresses (dwarf2_per_cu_data *per_cu,
case DW_LLE_start_length:
if (buf_end - loc_ptr < addr_size)
- return DEBUG_LOC_BUFFER_OVERFLOW;
+ return DEBUG_LOC_BUFFER_OVERFLOW;
if (signed_addr_p)
- *low = extract_signed_integer (loc_ptr, addr_size, byte_order);
+ *low = extract_signed_integer (loc_ptr, addr_size, byte_order);
else
- *low = extract_unsigned_integer (loc_ptr, addr_size, byte_order);
+ *low = extract_unsigned_integer (loc_ptr, addr_size, byte_order);
loc_ptr += addr_size;
*high = *low;
loc_ptr = gdb_read_uleb128 (loc_ptr, buf_end, &u64);
if (loc_ptr == NULL)
- return DEBUG_LOC_BUFFER_OVERFLOW;
+ return DEBUG_LOC_BUFFER_OVERFLOW;
*high += u64;
*new_ptr = loc_ptr;
@@ -280,9 +276,8 @@ decode_debug_loc_dwo_addresses (dwarf2_per_cu_data *per_cu,
dwarf2_per_objfile *per_objfile,
const gdb_byte *loc_ptr,
const gdb_byte *buf_end,
- const gdb_byte **new_ptr,
- CORE_ADDR *low, CORE_ADDR *high,
- enum bfd_endian byte_order)
+ const gdb_byte **new_ptr, CORE_ADDR *low,
+ CORE_ADDR *high, enum bfd_endian byte_order)
{
uint64_t low_index, high_index;
@@ -372,21 +367,20 @@ dwarf2_find_location_expression (struct dwarf2_loclist_baton *baton,
const gdb_byte *new_ptr = NULL; /* init for gcc -Wall */
if (baton->per_cu->version () < 5 && baton->from_dwo)
- kind = decode_debug_loc_dwo_addresses (baton->per_cu,
- baton->per_objfile,
- loc_ptr, buf_end, &new_ptr,
- &low, &high, byte_order);
+ kind
+ = decode_debug_loc_dwo_addresses (baton->per_cu, baton->per_objfile,
+ loc_ptr, buf_end, &new_ptr, &low,
+ &high, byte_order);
else if (baton->per_cu->version () < 5)
- kind = decode_debug_loc_addresses (loc_ptr, buf_end, &new_ptr,
- &low, &high,
- byte_order, addr_size,
+ kind = decode_debug_loc_addresses (loc_ptr, buf_end, &new_ptr, &low,
+ &high, byte_order, addr_size,
signed_addr_p);
else
- kind = decode_debug_loclists_addresses (baton->per_cu,
- baton->per_objfile,
- loc_ptr, buf_end, &new_ptr,
- &low, &high, byte_order,
- addr_size, signed_addr_p);
+ kind
+ = decode_debug_loclists_addresses (baton->per_cu, baton->per_objfile,
+ loc_ptr, buf_end, &new_ptr, &low,
+ &high, byte_order, addr_size,
+ signed_addr_p);
loc_ptr = new_ptr;
switch (kind)
@@ -406,8 +400,8 @@ dwarf2_find_location_expression (struct dwarf2_loclist_baton *baton,
case DEBUG_LOC_BUFFER_OVERFLOW:
case DEBUG_LOC_INVALID_ENTRY:
- error (_("dwarf2_find_location_expression: "
- "Corrupted DWARF expression."));
+ error (_ ("dwarf2_find_location_expression: "
+ "Corrupted DWARF expression."));
default:
gdb_assert_not_reached ("bad debug_loc_kind");
@@ -506,8 +500,9 @@ locexpr_get_frame_base (struct symbol *framefunc, frame_info_ptr frame)
type = builtin_type (gdbarch)->builtin_data_ptr;
dlbaton = (struct dwarf2_locexpr_baton *) SYMBOL_LOCATION_BATON (framefunc);
- SYMBOL_BLOCK_OPS (framefunc)->find_frame_base_location
- (framefunc, get_frame_pc (frame), &start, &length);
+ SYMBOL_BLOCK_OPS (framefunc)->find_frame_base_location (framefunc,
+ get_frame_pc (frame),
+ &start, &length);
result = dwarf2_evaluate_loc_desc (type, frame, start, length,
dlbaton->per_cu, dlbaton->per_objfile);
@@ -522,11 +517,8 @@ locexpr_get_frame_base (struct symbol *framefunc, frame_info_ptr frame)
/* Vector for inferior functions as represented by LOC_BLOCK, if the inferior
function uses DWARF expression for its DW_AT_frame_base. */
-const struct symbol_block_ops dwarf2_block_frame_base_locexpr_funcs =
-{
- locexpr_find_frame_base_location,
- locexpr_get_frame_base
-};
+const struct symbol_block_ops dwarf2_block_frame_base_locexpr_funcs
+ = { locexpr_find_frame_base_location, locexpr_get_frame_base };
/* Implement find_frame_base_location method for LOC_BLOCK functions using
DWARF location list for its DW_AT_frame_base. */
@@ -563,8 +555,9 @@ loclist_get_frame_base (struct symbol *framefunc, frame_info_ptr frame)
type = builtin_type (gdbarch)->builtin_data_ptr;
dlbaton = (struct dwarf2_loclist_baton *) SYMBOL_LOCATION_BATON (framefunc);
- SYMBOL_BLOCK_OPS (framefunc)->find_frame_base_location
- (framefunc, get_frame_pc (frame), &start, &length);
+ SYMBOL_BLOCK_OPS (framefunc)->find_frame_base_location (framefunc,
+ get_frame_pc (frame),
+ &start, &length);
result = dwarf2_evaluate_loc_desc (type, frame, start, length,
dlbaton->per_cu, dlbaton->per_objfile);
@@ -579,11 +572,8 @@ loclist_get_frame_base (struct symbol *framefunc, frame_info_ptr frame)
/* Vector for inferior functions as represented by LOC_BLOCK, if the inferior
function uses DWARF location list for its DW_AT_frame_base. */
-const struct symbol_block_ops dwarf2_block_frame_base_loclist_funcs =
-{
- loclist_find_frame_base_location,
- loclist_get_frame_base
-};
+const struct symbol_block_ops dwarf2_block_frame_base_loclist_funcs
+ = { loclist_find_frame_base_location, loclist_get_frame_base };
/* See dwarf2/loc.h. */
@@ -601,7 +591,7 @@ func_get_frame_base_dwarf_block (struct symbol *framefunc, CORE_ADDR pc,
*length = 0;
if (*length == 0)
- error (_("Could not find the frame base for \"%s\"."),
+ error (_ ("Could not find the frame base for \"%s\"."),
framefunc->natural_name ());
}
@@ -610,8 +600,7 @@ func_get_frame_base_dwarf_block (struct symbol *framefunc, CORE_ADDR pc,
value *
compute_var_value (const char *name)
{
- struct block_symbol sym = lookup_symbol (name, nullptr, VAR_DOMAIN,
- nullptr);
+ struct block_symbol sym = lookup_symbol (name, nullptr, VAR_DOMAIN, nullptr);
if (sym.symbol != nullptr)
return value_of_variable (sym.symbol, sym.block);
return nullptr;
@@ -627,19 +616,17 @@ static void
show_entry_values_debug (struct ui_file *file, int from_tty,
struct cmd_list_element *c, const char *value)
{
- gdb_printf (file,
- _("Entry values and tail call frames debugging is %s.\n"),
+ gdb_printf (file, _ ("Entry values and tail call frames debugging is %s.\n"),
value);
}
/* See gdbtypes.h. */
void
-call_site_target::iterate_over_addresses
- (struct gdbarch *call_site_gdbarch,
- const struct call_site *call_site,
- frame_info_ptr caller_frame,
- iterate_ftype callback) const
+call_site_target::iterate_over_addresses (struct gdbarch *call_site_gdbarch,
+ const struct call_site *call_site,
+ frame_info_ptr caller_frame,
+ iterate_ftype callback) const
{
switch (m_loc_kind)
{
@@ -654,28 +641,26 @@ call_site_target::iterate_over_addresses
if (dwarf_block == NULL)
{
struct bound_minimal_symbol msym;
-
+
msym = lookup_minimal_symbol_by_pc (call_site->pc () - 1);
throw_error (NO_ENTRY_VALUE_ERROR,
- _("DW_AT_call_target is not specified at %s in %s"),
+ _ ("DW_AT_call_target is not specified at %s in %s"),
paddress (call_site_gdbarch, call_site->pc ()),
(msym.minsym == NULL ? "???"
- : msym.minsym->print_name ()));
-
+ : msym.minsym->print_name ()));
}
if (caller_frame == NULL)
{
struct bound_minimal_symbol msym;
-
+
msym = lookup_minimal_symbol_by_pc (call_site->pc () - 1);
throw_error (NO_ENTRY_VALUE_ERROR,
- _("DW_AT_call_target DWARF block resolving "
- "requires known frame which is currently not "
- "available at %s in %s"),
+ _ ("DW_AT_call_target DWARF block resolving "
+ "requires known frame which is currently not "
+ "available at %s in %s"),
paddress (call_site_gdbarch, call_site->pc ()),
(msym.minsym == NULL ? "???"
- : msym.minsym->print_name ()));
-
+ : msym.minsym->print_name ()));
}
caller_arch = get_frame_arch (caller_frame);
caller_core_addr_type = builtin_type (caller_arch)->builtin_func_ptr;
@@ -703,13 +688,12 @@ call_site_target::iterate_over_addresses
if (msym.minsym == NULL)
{
msym = lookup_minimal_symbol_by_pc (call_site->pc () - 1);
- throw_error (NO_ENTRY_VALUE_ERROR,
- _("Cannot find function \"%s\" for a call site target "
- "at %s in %s"),
- physname, paddress (call_site_gdbarch, call_site->pc ()),
- (msym.minsym == NULL ? "???"
- : msym.minsym->print_name ()));
-
+ throw_error (
+ NO_ENTRY_VALUE_ERROR,
+ _ ("Cannot find function \"%s\" for a call site target "
+ "at %s in %s"),
+ physname, paddress (call_site_gdbarch, call_site->pc ()),
+ (msym.minsym == NULL ? "???" : msym.minsym->print_name ()));
}
callback (msym.value_address ());
}
@@ -735,7 +719,7 @@ call_site_target::iterate_over_addresses
break;
default:
- internal_error (_("invalid call site target kind"));
+ internal_error (_ ("invalid call site target kind"));
}
}
@@ -751,8 +735,8 @@ func_addr_to_tail_call_list (struct gdbarch *gdbarch, CORE_ADDR addr)
if (sym == NULL || sym->value_block ()->entry_pc () != addr)
throw_error (NO_ENTRY_VALUE_ERROR,
- _("DW_TAG_call_site resolving failed to find function "
- "name for address %s"),
+ _ ("DW_TAG_call_site resolving failed to find function "
+ "name for address %s"),
paddress (gdbarch, addr));
type = sym->type ();
@@ -794,31 +778,30 @@ func_verify_no_selftailcall (struct gdbarch *gdbarch, CORE_ADDR verify_addr)
func_sym = func_addr_to_tail_call_list (gdbarch, addr);
- for (call_site = TYPE_TAIL_CALL_LIST (func_sym->type ());
- call_site; call_site = call_site->tail_call_next)
+ for (call_site = TYPE_TAIL_CALL_LIST (func_sym->type ()); call_site;
+ call_site = call_site->tail_call_next)
{
/* CALLER_FRAME with registers is not available for tail-call jumped
frames. */
call_site->iterate_over_addresses (gdbarch, nullptr,
- [&] (CORE_ADDR target_addr)
- {
- if (target_addr == verify_addr)
- {
- struct bound_minimal_symbol msym;
-
- msym = lookup_minimal_symbol_by_pc (verify_addr);
- throw_error (NO_ENTRY_VALUE_ERROR,
- _("DW_OP_entry_value resolving has found "
- "function \"%s\" at %s can call itself via tail "
- "calls"),
- (msym.minsym == NULL ? "???"
- : msym.minsym->print_name ()),
- paddress (gdbarch, verify_addr));
- }
-
- if (addr_hash.insert (target_addr).second)
- todo.push_back (target_addr);
- });
+ [&] (CORE_ADDR target_addr) {
+ if (target_addr == verify_addr)
+ {
+ struct bound_minimal_symbol msym;
+
+ msym = lookup_minimal_symbol_by_pc (verify_addr);
+ throw_error (
+ NO_ENTRY_VALUE_ERROR,
+ _ ("DW_OP_entry_value resolving has found "
+ "function \"%s\" at %s can call itself via tail "
+ "calls"),
+ (msym.minsym == NULL ? "???" : msym.minsym->print_name ()),
+ paddress (gdbarch, verify_addr));
+ }
+
+ if (addr_hash.insert (target_addr).second)
+ todo.push_back (target_addr);
+ });
}
}
}
@@ -833,9 +816,7 @@ tailcall_dump (struct gdbarch *gdbarch, const struct call_site *call_site)
struct bound_minimal_symbol msym = lookup_minimal_symbol_by_pc (addr - 1);
gdb_printf (gdb_stdlog, " %s(%s)", paddress (gdbarch, addr),
- (msym.minsym == NULL ? "???"
- : msym.minsym->print_name ()));
-
+ (msym.minsym == NULL ? "???" : msym.minsym->print_name ()));
}
/* Intersect RESULTP with CHAIN to keep RESULTP unambiguous, keep in RESULTP
@@ -857,10 +838,8 @@ chain_candidate (struct gdbarch *gdbarch,
{
/* Create the initial chain containing all the passed PCs. */
- struct call_site_chain *result
- = ((struct call_site_chain *)
- xmalloc (sizeof (*result)
- + sizeof (*result->call_site) * (length - 1)));
+ struct call_site_chain *result = ((struct call_site_chain *) xmalloc (
+ sizeof (*result) + sizeof (*result->call_site) * (length - 1)));
result->length = length;
result->callers = result->callees = length;
if (!chain.empty ())
@@ -947,24 +926,21 @@ chain_candidate (struct gdbarch *gdbarch,
true. */
static bool
-call_site_find_chain_2
- (struct gdbarch *gdbarch,
- gdb::unique_xmalloc_ptr<struct call_site_chain> *resultp,
- std::vector<struct call_site *> &chain,
- std::unordered_set<CORE_ADDR> &addr_hash,
- struct call_site *call_site,
- CORE_ADDR callee_pc)
+call_site_find_chain_2 (
+ struct gdbarch *gdbarch,
+ gdb::unique_xmalloc_ptr<struct call_site_chain> *resultp,
+ std::vector<struct call_site *> &chain,
+ std::unordered_set<CORE_ADDR> &addr_hash, struct call_site *call_site,
+ CORE_ADDR callee_pc)
{
std::vector<CORE_ADDR> addresses;
bool found_exact = false;
- call_site->iterate_over_addresses (gdbarch, nullptr,
- [&] (CORE_ADDR addr)
- {
- if (addr == callee_pc)
- found_exact = true;
- else
- addresses.push_back (addr);
- });
+ call_site->iterate_over_addresses (gdbarch, nullptr, [&] (CORE_ADDR addr) {
+ if (addr == callee_pc)
+ found_exact = true;
+ else
+ addresses.push_back (addr);
+ });
if (found_exact)
{
@@ -979,7 +955,7 @@ call_site_find_chain_2
struct symbol *target_func
= func_addr_to_tail_call_list (gdbarch, target_func_addr);
for (struct call_site *target_call_site
- = TYPE_TAIL_CALL_LIST (target_func->type ());
+ = TYPE_TAIL_CALL_LIST (target_func->type ());
target_call_site != nullptr;
target_call_site = target_call_site->tail_call_next)
{
@@ -988,9 +964,8 @@ call_site_find_chain_2
/* Successfully entered TARGET_CALL_SITE. */
chain.push_back (target_call_site);
- if (!call_site_find_chain_2 (gdbarch, resultp, chain,
- addr_hash, target_call_site,
- callee_pc))
+ if (!call_site_find_chain_2 (gdbarch, resultp, chain, addr_hash,
+ target_call_site, callee_pc))
return false;
size_t removed = addr_hash.erase (target_call_site->pc ());
@@ -1030,7 +1005,7 @@ call_site_find_chain_1 (struct gdbarch *gdbarch, CORE_ADDR caller_pc,
/* We are not interested in the specific PC inside the callee function. */
callee_pc = get_pc_function_start (callee_pc);
if (callee_pc == 0)
- throw_error (NO_ENTRY_VALUE_ERROR, _("Unable to find function for PC %s"),
+ throw_error (NO_ENTRY_VALUE_ERROR, _ ("Unable to find function for PC %s"),
paddress (gdbarch, save_callee_pc));
/* Mark CALL_SITEs so we do not visit the same ones twice. */
@@ -1049,19 +1024,20 @@ call_site_find_chain_1 (struct gdbarch *gdbarch, CORE_ADDR caller_pc,
if (retval == NULL)
{
struct bound_minimal_symbol msym_caller, msym_callee;
-
+
msym_caller = lookup_minimal_symbol_by_pc (caller_pc);
msym_callee = lookup_minimal_symbol_by_pc (callee_pc);
- throw_error (NO_ENTRY_VALUE_ERROR,
- _("There are no unambiguously determinable intermediate "
- "callers or callees between caller function \"%s\" at %s "
- "and callee function \"%s\" at %s"),
- (msym_caller.minsym == NULL
- ? "???" : msym_caller.minsym->print_name ()),
- paddress (gdbarch, caller_pc),
- (msym_callee.minsym == NULL
- ? "???" : msym_callee.minsym->print_name ()),
- paddress (gdbarch, callee_pc));
+ throw_error (
+ NO_ENTRY_VALUE_ERROR,
+ _ ("There are no unambiguously determinable intermediate "
+ "callers or callees between caller function \"%s\" at %s "
+ "and callee function \"%s\" at %s"),
+ (msym_caller.minsym == NULL ? "???"
+ : msym_caller.minsym->print_name ()),
+ paddress (gdbarch, caller_pc),
+ (msym_callee.minsym == NULL ? "???"
+ : msym_callee.minsym->print_name ()),
+ paddress (gdbarch, callee_pc));
}
return retval;
@@ -1153,12 +1129,11 @@ dwarf_expr_reg_to_entry_parameter (frame_info_ptr frame,
struct gdbarch *caller_gdbarch = frame_unwind_arch (frame);
throw_error (NO_ENTRY_VALUE_ERROR,
- _("DW_OP_entry_value resolving callee gdbarch %s "
- "(of %s (%s)) does not match caller gdbarch %s"),
+ _ ("DW_OP_entry_value resolving callee gdbarch %s "
+ "(of %s (%s)) does not match caller gdbarch %s"),
gdbarch_bfd_arch_info (gdbarch)->printable_name,
paddress (gdbarch, func_addr),
- (msym.minsym == NULL ? "???"
- : msym.minsym->print_name ()),
+ (msym.minsym == NULL ? "???" : msym.minsym->print_name ()),
gdbarch_bfd_arch_info (caller_gdbarch)->printable_name);
}
@@ -1167,11 +1142,11 @@ dwarf_expr_reg_to_entry_parameter (frame_info_ptr frame,
struct bound_minimal_symbol msym
= lookup_minimal_symbol_by_pc (func_addr);
- throw_error (NO_ENTRY_VALUE_ERROR, _("DW_OP_entry_value resolving "
- "requires caller of %s (%s)"),
+ throw_error (NO_ENTRY_VALUE_ERROR,
+ _ ("DW_OP_entry_value resolving "
+ "requires caller of %s (%s)"),
paddress (gdbarch, func_addr),
- (msym.minsym == NULL ? "???"
- : msym.minsym->print_name ()));
+ (msym.minsym == NULL ? "???" : msym.minsym->print_name ()));
}
caller_pc = get_frame_pc (caller_frame);
call_site = call_site_for_pc (gdbarch, caller_pc);
@@ -1179,31 +1154,29 @@ dwarf_expr_reg_to_entry_parameter (frame_info_ptr frame,
bool found = false;
unsigned count = 0;
call_site->iterate_over_addresses (gdbarch, caller_frame,
- [&] (CORE_ADDR addr)
- {
- /* Preserve any address. */
- target_addr = addr;
- ++count;
- if (addr == func_addr)
- found = true;
- });
+ [&] (CORE_ADDR addr) {
+ /* Preserve any address. */
+ target_addr = addr;
+ ++count;
+ if (addr == func_addr)
+ found = true;
+ });
if (!found)
{
struct minimal_symbol *target_msym, *func_msym;
target_msym = lookup_minimal_symbol_by_pc (target_addr).minsym;
func_msym = lookup_minimal_symbol_by_pc (func_addr).minsym;
- throw_error (NO_ENTRY_VALUE_ERROR,
- _("DW_OP_entry_value resolving expects callee %s at %s %s"
- "but the called frame is for %s at %s"),
- (target_msym == NULL ? "???"
- : target_msym->print_name ()),
- paddress (gdbarch, target_addr),
- (count > 0
- ? _("(but note there are multiple addresses not listed)")
- : ""),
- func_msym == NULL ? "???" : func_msym->print_name (),
- paddress (gdbarch, func_addr));
+ throw_error (
+ NO_ENTRY_VALUE_ERROR,
+ _ ("DW_OP_entry_value resolving expects callee %s at %s %s"
+ "but the called frame is for %s at %s"),
+ (target_msym == NULL ? "???" : target_msym->print_name ()),
+ paddress (gdbarch, target_addr),
+ (count > 0 ? _ ("(but note there are multiple addresses not listed)")
+ : ""),
+ func_msym == NULL ? "???" : func_msym->print_name (),
+ paddress (gdbarch, func_addr));
}
/* No entry value based parameters would be reliable if this function can
@@ -1223,10 +1196,11 @@ dwarf_expr_reg_to_entry_parameter (frame_info_ptr frame,
/* DW_TAG_call_site_parameter will be missing just if GCC could not
determine its value. */
- throw_error (NO_ENTRY_VALUE_ERROR, _("Cannot find matching parameter "
- "at DW_TAG_call_site %s at %s"),
+ throw_error (NO_ENTRY_VALUE_ERROR,
+ _ ("Cannot find matching parameter "
+ "at DW_TAG_call_site %s at %s"),
paddress (gdbarch, caller_pc),
- msym == NULL ? "???" : msym->print_name ());
+ msym == NULL ? "???" : msym->print_name ());
}
*per_cu_return = call_site->per_cu;
@@ -1260,7 +1234,7 @@ dwarf_entry_parameter_to_value (struct call_site_parameter *parameter,
/* DEREF_SIZE size is not verified here. */
if (data_src == NULL)
throw_error (NO_ENTRY_VALUE_ERROR,
- _("Cannot resolve DW_AT_call_data_value"));
+ _ ("Cannot resolve DW_AT_call_data_value"));
return dwarf2_evaluate_loc_desc (type, caller_frame, data_src, size, per_cu,
per_objfile, false);
@@ -1309,17 +1283,15 @@ entry_data_value_free_closure (struct value *v)
is stored in the caller. On the first dereference use
DW_AT_call_data_value in the caller. */
-static const struct lval_funcs entry_data_value_funcs =
-{
- NULL, /* read */
- NULL, /* write */
- nullptr,
- NULL, /* indirect */
- entry_data_value_coerce_ref,
- NULL, /* check_synthetic_pointer */
- entry_data_value_copy_closure,
- entry_data_value_free_closure
-};
+static const struct lval_funcs entry_data_value_funcs
+ = { NULL, /* read */
+ NULL, /* write */
+ nullptr,
+ NULL, /* indirect */
+ entry_data_value_coerce_ref,
+ NULL, /* check_synthetic_pointer */
+ entry_data_value_copy_closure,
+ entry_data_value_free_closure };
/* See dwarf2/loc.h. */
struct value *
@@ -1335,14 +1307,14 @@ value_of_dwarf_reg_entry (struct type *type, frame_info_ptr frame,
dwarf2_per_cu_data *caller_per_cu;
dwarf2_per_objfile *caller_per_objfile;
- parameter = dwarf_expr_reg_to_entry_parameter (frame, kind, kind_u,
- &caller_per_cu,
- &caller_per_objfile);
+ parameter
+ = dwarf_expr_reg_to_entry_parameter (frame, kind, kind_u, &caller_per_cu,
+ &caller_per_objfile);
- outer_val = dwarf_entry_parameter_to_value (parameter, -1 /* deref_size */,
- type, caller_frame,
- caller_per_cu,
- caller_per_objfile);
+ outer_val
+ = dwarf_entry_parameter_to_value (parameter, -1 /* deref_size */, type,
+ caller_frame, caller_per_cu,
+ caller_per_objfile);
/* Check if DW_AT_call_data_value cannot be used. If it should be
used and it is not available do not fall back to OUTER_VAL - dereferencing
@@ -1353,19 +1325,17 @@ value_of_dwarf_reg_entry (struct type *type, frame_info_ptr frame,
|| checked_type->target_type () == NULL)
return outer_val;
- target_val = dwarf_entry_parameter_to_value (parameter,
- target_type->length (),
- target_type, caller_frame,
- caller_per_cu,
- caller_per_objfile);
+ target_val
+ = dwarf_entry_parameter_to_value (parameter, target_type->length (),
+ target_type, caller_frame, caller_per_cu,
+ caller_per_objfile);
val = allocate_computed_value (type, &entry_data_value_funcs,
release_value (target_val).release ());
/* Copy the referencing pointer to the new computed value. */
memcpy (value_contents_raw (val).data (),
- value_contents_raw (outer_val).data (),
- checked_type->length ());
+ value_contents_raw (outer_val).data (), checked_type->length ());
set_value_lazy (val, 0);
return val;
@@ -1386,19 +1356,19 @@ value_of_dwarf_block_entry (struct type *type, frame_info_ptr frame,
kind_u.dwarf_reg = dwarf_block_to_dwarf_reg (block, block + block_len);
if (kind_u.dwarf_reg != -1)
- return value_of_dwarf_reg_entry (type, frame, CALL_SITE_PARAMETER_DWARF_REG,
- kind_u);
+ return value_of_dwarf_reg_entry (type, frame,
+ CALL_SITE_PARAMETER_DWARF_REG, kind_u);
if (dwarf_block_to_fb_offset (block, block + block_len, &kind_u.fb_offset))
- return value_of_dwarf_reg_entry (type, frame, CALL_SITE_PARAMETER_FB_OFFSET,
- kind_u);
+ return value_of_dwarf_reg_entry (type, frame,
+ CALL_SITE_PARAMETER_FB_OFFSET, kind_u);
/* This can normally happen - throw NO_ENTRY_VALUE_ERROR to get the message
suppressed during normal operation. The expression can be arbitrary if
there is no caller-callee entry value binding expected. */
throw_error (NO_ENTRY_VALUE_ERROR,
- _("DWARF-2 expression error: DW_OP_entry_value is supported "
- "only for single DW_OP_reg* or for DW_OP_fbreg(*)"));
+ _ ("DWARF-2 expression error: DW_OP_entry_value is supported "
+ "only for single DW_OP_reg* or for DW_OP_fbreg(*)"));
}
/* Fetch a DW_AT_const_value through a synthetic pointer. */
@@ -1414,8 +1384,8 @@ fetch_const_value_from_synthetic_pointer (sect_offset die, LONGEST byte_offset,
LONGEST len;
auto_obstack temp_obstack;
- bytes = dwarf2_fetch_constant_bytes (die, per_cu, per_objfile,
- &temp_obstack, &len);
+ bytes = dwarf2_fetch_constant_bytes (die, per_cu, per_objfile, &temp_obstack,
+ &len);
if (bytes != NULL)
{
@@ -1444,18 +1414,16 @@ indirect_synthetic_pointer (sect_offset die, LONGEST byte_offset,
bool resolve_abstract_p)
{
/* Fetch the location expression of the DIE we're pointing to. */
- auto get_frame_address_in_block_wrapper = [frame] ()
- {
- return get_frame_address_in_block (frame);
- };
+ auto get_frame_address_in_block_wrapper
+ = [frame] () { return get_frame_address_in_block (frame); };
struct dwarf2_locexpr_baton baton
= dwarf2_fetch_die_loc_sect_off (die, per_cu, per_objfile,
get_frame_address_in_block_wrapper,
resolve_abstract_p);
/* Get type of pointed-to DIE. */
- struct type *orig_type = dwarf2_fetch_die_type_sect_off (die, per_cu,
- per_objfile);
+ struct type *orig_type
+ = dwarf2_fetch_die_type_sect_off (die, per_cu, per_objfile);
if (orig_type == NULL)
invalid_synthetic_pointer ();
@@ -1466,8 +1434,7 @@ indirect_synthetic_pointer (sect_offset die, LONGEST byte_offset,
return dwarf2_evaluate_loc_desc_full (orig_type, frame, baton.data,
baton.size, baton.per_cu,
baton.per_objfile,
- type->target_type (),
- byte_offset);
+ type->target_type (), byte_offset);
else
return fetch_const_value_from_synthetic_pointer (die, byte_offset, per_cu,
per_objfile, type);
@@ -1485,8 +1452,7 @@ dwarf2_evaluate_loc_desc_full (struct type *type, frame_info_ptr frame,
dwarf2_per_cu_data *per_cu,
dwarf2_per_objfile *per_objfile,
struct type *subobj_type,
- LONGEST subobj_byte_offset,
- bool as_lval)
+ LONGEST subobj_byte_offset, bool as_lval)
{
if (subobj_type == NULL)
{
@@ -1506,8 +1472,8 @@ dwarf2_evaluate_loc_desc_full (struct type *type, frame_info_ptr frame,
try
{
- retval = ctx.evaluate (data, size, as_lval, per_cu, frame, nullptr,
- type, subobj_type, subobj_byte_offset);
+ retval = ctx.evaluate (data, size, as_lval, per_cu, frame, nullptr, type,
+ subobj_type, subobj_byte_offset);
}
catch (const gdb_exception_error &ex)
{
@@ -1515,8 +1481,7 @@ dwarf2_evaluate_loc_desc_full (struct type *type, frame_info_ptr frame,
{
free_values.free_to_mark ();
retval = allocate_value (subobj_type);
- mark_value_bytes_unavailable (retval, 0,
- subobj_type->length ());
+ mark_value_bytes_unavailable (retval, 0, subobj_type->length ());
return retval;
}
else if (ex.error == NO_ENTRY_VALUE_ERROR)
@@ -1590,8 +1555,8 @@ dwarf2_locexpr_baton_eval (const struct dwarf2_locexpr_baton *dlbaton,
try
{
- result = ctx.evaluate (dlbaton->data, dlbaton->size,
- true, per_cu, frame, addr_stack);
+ result = ctx.evaluate (dlbaton->data, dlbaton->size, true, per_cu, frame,
+ addr_stack);
}
catch (const gdb_exception_error &ex)
{
@@ -1674,11 +1639,10 @@ dwarf2_evaluate_property (const struct dynamic_prop *prop,
is signed, we have to sign-extend the value because
CORE_ADDR on 64bit machine has 8 bytes but address
size of an 32bit application is bytes. */
- const int addr_size
- = (baton->locexpr.per_cu->addr_size ()
- * TARGET_CHAR_BIT);
+ const int addr_size = (baton->locexpr.per_cu->addr_size ()
+ * TARGET_CHAR_BIT);
const CORE_ADDR neg_mask
- = (~((CORE_ADDR) 0) << (addr_size - 1));
+ = (~((CORE_ADDR) 0) << (addr_size - 1));
/* Check if signed bit is set and sign-extend values. */
if (*value & neg_mask)
@@ -1737,11 +1701,11 @@ dwarf2_evaluate_property (const struct dynamic_prop *prop,
break;
}
if (pinfo == NULL)
- error (_("cannot find reference address for offset property"));
+ error (_ ("cannot find reference address for offset property"));
if (pinfo->valaddr.data () != NULL)
- val = value_from_contents
- (baton->offset_info.type,
- pinfo->valaddr.data () + baton->offset_info.offset);
+ val = value_from_contents (baton->offset_info.type,
+ pinfo->valaddr.data ()
+ + baton->offset_info.offset);
else
val = value_at (baton->offset_info.type,
pinfo->addr + baton->offset_info.offset);
@@ -1767,12 +1731,10 @@ dwarf2_evaluate_property (const struct dynamic_prop *prop,
/* See dwarf2/loc.h. */
void
-dwarf2_compile_property_to_c (string_file *stream,
- const char *result_name,
+dwarf2_compile_property_to_c (string_file *stream, const char *result_name,
struct gdbarch *gdbarch,
std::vector<bool> &registers_used,
- const struct dynamic_prop *prop,
- CORE_ADDR pc,
+ const struct dynamic_prop *prop, CORE_ADDR pc,
struct symbol *sym)
{
struct dwarf2_property_baton *baton
@@ -1798,10 +1760,9 @@ dwarf2_compile_property_to_c (string_file *stream,
per_objfile = baton->loclist.per_objfile;
}
- compile_dwarf_bounds_to_c (stream, result_name, prop, sym, pc,
- gdbarch, registers_used,
- per_cu->addr_size (),
- data, data + size, per_cu, per_objfile);
+ compile_dwarf_bounds_to_c (stream, result_name, prop, sym, pc, gdbarch,
+ registers_used, per_cu->addr_size (), data,
+ data + size, per_cu, per_objfile);
}
/* Compute the correct symbol_needs_kind value for the location
@@ -1814,10 +1775,8 @@ static enum symbol_needs_kind
dwarf2_get_symbol_read_needs (gdb::array_view<const gdb_byte> expr,
dwarf2_per_cu_data *per_cu,
dwarf2_per_objfile *per_objfile,
- bfd_endian byte_order,
- int addr_size,
- int ref_addr_size,
- int depth = 0)
+ bfd_endian byte_order, int addr_size,
+ int ref_addr_size, int depth = 0)
{
enum symbol_needs_kind symbol_needs = SYMBOL_NEEDS_NONE;
@@ -1837,23 +1796,22 @@ dwarf2_get_symbol_read_needs (gdb::array_view<const gdb_byte> expr,
/* Insert OP in OPS_TO_VISIT if it is within the expression's range and
hasn't been visited yet. */
auto insert_in_ops_to_visit
- = [expr_end, &visited_ops, &ops_to_visit] (const gdb_byte *op_ptr)
- {
- if (op_ptr >= expr_end)
- return;
+ = [expr_end, &visited_ops, &ops_to_visit] (const gdb_byte *op_ptr) {
+ if (op_ptr >= expr_end)
+ return;
- if (visited_ops.find (op_ptr) != visited_ops.end ())
- return;
+ if (visited_ops.find (op_ptr) != visited_ops.end ())
+ return;
- ops_to_visit.push_back (op_ptr);
- };
+ ops_to_visit.push_back (op_ptr);
+ };
/* Expressions can invoke other expressions with DW_OP_call*. Protect against
a loop of calls. */
const int max_depth = 256;
if (depth > max_depth)
- error (_("DWARF-2 expression error: Loop detected."));
+ error (_ ("DWARF-2 expression error: Loop detected."));
depth++;
@@ -2128,15 +2086,13 @@ dwarf2_get_symbol_read_needs (gdb::array_view<const gdb_byte> expr,
= (cu_offset) extract_unsigned_integer (op_ptr, len, byte_order);
op_ptr += len;
- auto get_frame_pc = [&symbol_needs] ()
- {
- symbol_needs = SYMBOL_NEEDS_FRAME;
- return 0;
- };
+ auto get_frame_pc = [&symbol_needs] () {
+ symbol_needs = SYMBOL_NEEDS_FRAME;
+ return 0;
+ };
struct dwarf2_locexpr_baton baton
- = dwarf2_fetch_die_loc_cu_off (cu_off, per_cu,
- per_objfile,
+ = dwarf2_fetch_die_loc_cu_off (cu_off, per_cu, per_objfile,
get_frame_pc);
/* If SYMBOL_NEEDS_FRAME is returned from the previous call,
@@ -2146,14 +2102,10 @@ dwarf2_get_symbol_read_needs (gdb::array_view<const gdb_byte> expr,
gdbarch *arch = baton.per_objfile->objfile->arch ();
gdb::array_view<const gdb_byte> sub_expr (baton.data,
baton.size);
- symbol_needs
- = dwarf2_get_symbol_read_needs (sub_expr,
- baton.per_cu,
- baton.per_objfile,
- gdbarch_byte_order (arch),
- baton.per_cu->addr_size (),
- baton.per_cu->ref_addr_size (),
- depth);
+ symbol_needs = dwarf2_get_symbol_read_needs (
+ sub_expr, baton.per_cu, baton.per_objfile,
+ gdbarch_byte_order (arch), baton.per_cu->addr_size (),
+ baton.per_cu->ref_addr_size (), depth);
}
break;
}
@@ -2161,35 +2113,31 @@ dwarf2_get_symbol_read_needs (gdb::array_view<const gdb_byte> expr,
case DW_OP_GNU_variable_value:
{
sect_offset sect_off
- = (sect_offset) extract_unsigned_integer (op_ptr,
- ref_addr_size,
+ = (sect_offset) extract_unsigned_integer (op_ptr, ref_addr_size,
byte_order);
op_ptr += ref_addr_size;
struct type *die_type
- = dwarf2_fetch_die_type_sect_off (sect_off, per_cu,
- per_objfile);
+ = dwarf2_fetch_die_type_sect_off (sect_off, per_cu, per_objfile);
if (die_type == NULL)
- error (_("Bad DW_OP_GNU_variable_value DIE."));
+ error (_ ("Bad DW_OP_GNU_variable_value DIE."));
/* Note: Things still work when the following test is
removed. This test and error is here to conform to the
proposed specification. */
if (die_type->code () != TYPE_CODE_INT
- && die_type->code () != TYPE_CODE_PTR)
- error (_("Type of DW_OP_GNU_variable_value DIE must be "
- "an integer or pointer."));
+ && die_type->code () != TYPE_CODE_PTR)
+ error (_ ("Type of DW_OP_GNU_variable_value DIE must be "
+ "an integer or pointer."));
- auto get_frame_pc = [&symbol_needs] ()
- {
- symbol_needs = SYMBOL_NEEDS_FRAME;
- return 0;
- };
+ auto get_frame_pc = [&symbol_needs] () {
+ symbol_needs = SYMBOL_NEEDS_FRAME;
+ return 0;
+ };
struct dwarf2_locexpr_baton baton
- = dwarf2_fetch_die_loc_sect_off (sect_off, per_cu,
- per_objfile,
+ = dwarf2_fetch_die_loc_sect_off (sect_off, per_cu, per_objfile,
get_frame_pc, true);
/* If SYMBOL_NEEDS_FRAME is returned from the previous call,
@@ -2199,14 +2147,10 @@ dwarf2_get_symbol_read_needs (gdb::array_view<const gdb_byte> expr,
gdbarch *arch = baton.per_objfile->objfile->arch ();
gdb::array_view<const gdb_byte> sub_expr (baton.data,
baton.size);
- symbol_needs
- = dwarf2_get_symbol_read_needs (sub_expr,
- baton.per_cu,
- baton.per_objfile,
- gdbarch_byte_order (arch),
- baton.per_cu->addr_size (),
- baton.per_cu->ref_addr_size (),
- depth);
+ symbol_needs = dwarf2_get_symbol_read_needs (
+ sub_expr, baton.per_cu, baton.per_objfile,
+ gdbarch_byte_order (arch), baton.per_cu->addr_size (),
+ baton.per_cu->ref_addr_size (), depth);
}
break;
}
@@ -2222,7 +2166,7 @@ dwarf2_get_symbol_read_needs (gdb::array_view<const gdb_byte> expr,
}
default:
- error (_("Unhandled DWARF expression opcode 0x%x"), op);
+ error (_ ("Unhandled DWARF expression opcode 0x%x"), op);
}
/* If it is known that a frame information is
@@ -2245,11 +2189,11 @@ unimplemented (unsigned int op)
const char *name = get_DW_OP_name (op);
if (name)
- error (_("DWARF operator %s cannot be translated to an agent expression"),
+ error (_ ("DWARF operator %s cannot be translated to an agent expression"),
name);
else
- error (_("Unknown DWARF operator 0x%02x cannot be translated "
- "to an agent expression"),
+ error (_ ("Unknown DWARF operator 0x%02x cannot be translated "
+ "to an agent expression"),
op);
}
@@ -2266,7 +2210,7 @@ dwarf_reg_to_regnum (struct gdbarch *arch, int dwarf_reg)
if (reg == -1)
{
- complaint (_("bad DWARF register number %d"), dwarf_reg);
+ complaint (_ ("bad DWARF register number %d"), dwarf_reg);
}
return reg;
}
@@ -2281,8 +2225,8 @@ throw_bad_regnum_error (ULONGEST dwarf_reg)
We *could* have int and ULONGEST versions of dwarf2_reg_to_regnum_or_error
but that's overkill for now. */
if ((int) dwarf_reg == dwarf_reg)
- error (_("Unable to access DWARF register number %d"), (int) dwarf_reg);
- error (_("Unable to access DWARF register number %s"),
+ error (_ ("Unable to access DWARF register number %d"), (int) dwarf_reg);
+ error (_ ("Unable to access DWARF register number %s"),
pulongest (dwarf_reg));
}
@@ -2362,13 +2306,12 @@ access_memory (struct gdbarch *arch, struct agent_expr *expr, ULONGEST nbits)
static void
dwarf2_compile_expr_to_ax (struct agent_expr *expr, struct axs_value *loc,
unsigned int addr_size, const gdb_byte *op_ptr,
- const gdb_byte *op_end,
- dwarf2_per_cu_data *per_cu,
+ const gdb_byte *op_end, dwarf2_per_cu_data *per_cu,
dwarf2_per_objfile *per_objfile)
{
gdbarch *arch = expr->gdbarch;
std::vector<int> dw_labels, patches;
- const gdb_byte * const base = op_ptr;
+ const gdb_byte *const base = op_ptr;
const gdb_byte *previous_piece = op_ptr;
enum bfd_endian byte_order = gdbarch_byte_order (arch);
ULONGEST bits_collected = 0;
@@ -2382,7 +2325,7 @@ dwarf2_compile_expr_to_ax (struct agent_expr *expr, struct axs_value *loc,
while (op_ptr < op_end)
{
- enum dwarf_location_atom op = (enum dwarf_location_atom) *op_ptr;
+ enum dwarf_location_atom op = (enum dwarf_location_atom) * op_ptr;
uint64_t uoffset, reg;
int64_t offset;
int i;
@@ -2555,13 +2498,13 @@ dwarf2_compile_expr_to_ax (struct agent_expr *expr, struct axs_value *loc,
op_ptr = safe_read_uleb128 (op_ptr, op_end, &len);
if (op_ptr + len > op_end)
- error (_("DW_OP_implicit_value: too few bytes available."));
+ error (_ ("DW_OP_implicit_value: too few bytes available."));
if (len > sizeof (ULONGEST))
- error (_("Cannot translate DW_OP_implicit_value of %d bytes"),
+ error (_ ("Cannot translate DW_OP_implicit_value of %d bytes"),
(int) len);
- ax_const_l (expr, extract_unsigned_integer (op_ptr, len,
- byte_order));
+ ax_const_l (expr,
+ extract_unsigned_integer (op_ptr, len, byte_order));
op_ptr += len;
dwarf_expr_require_composition (op_ptr, op_end,
"DW_OP_implicit_value");
@@ -2641,12 +2584,12 @@ dwarf2_compile_expr_to_ax (struct agent_expr *expr, struct axs_value *loc,
b = block_for_pc (expr->scope);
if (!b)
- error (_("No block found for address"));
+ error (_ ("No block found for address"));
framefunc = block_linkage_function (b);
if (!framefunc)
- error (_("No function found for block"));
+ error (_ ("No function found for block"));
func_get_frame_base_dwarf_block (framefunc, expr->scope,
&datastart, &datalen);
@@ -2704,8 +2647,8 @@ dwarf2_compile_expr_to_ax (struct agent_expr *expr, struct axs_value *loc,
size = addr_size;
if (size != 1 && size != 2 && size != 4 && size != 8)
- error (_("Unsupported size %d in %s"),
- size, get_DW_OP_name (op));
+ error (_ ("Unsupported size %d in %s"), size,
+ get_DW_OP_name (op));
access_memory (arch, expr, size * TARGET_CHAR_BIT);
}
break;
@@ -2863,9 +2806,9 @@ dwarf2_compile_expr_to_ax (struct agent_expr *expr, struct axs_value *loc,
LONGEST off;
const gdb_byte *cfa_start, *cfa_end;
- if (dwarf2_fetch_cfa_info (arch, expr->scope, per_cu,
- &regnum, &off,
- &text_offset, &cfa_start, &cfa_end))
+ if (dwarf2_fetch_cfa_info (arch, expr->scope, per_cu, &regnum,
+ &off, &text_offset, &cfa_start,
+ &cfa_end))
{
/* Register. */
ax_reg (expr, regnum);
@@ -2923,7 +2866,7 @@ dwarf2_compile_expr_to_ax (struct agent_expr *expr, struct axs_value *loc,
uint64_t size;
if (op_ptr - 1 == previous_piece)
- error (_("Cannot translate empty pieces to agent expressions"));
+ error (_ ("Cannot translate empty pieces to agent expressions"));
previous_piece = op_ptr - 1;
op_ptr = safe_read_uleb128 (op_ptr, op_end, &size);
@@ -2936,7 +2879,7 @@ dwarf2_compile_expr_to_ax (struct agent_expr *expr, struct axs_value *loc,
op_ptr = safe_read_uleb128 (op_ptr, op_end, &uoffset);
if (bits_collected + size > 8 * sizeof (LONGEST))
- error (_("Expression pieces exceed word size"));
+ error (_ ("Expression pieces exceed word size"));
/* Access the bits. */
switch (loc->kind)
@@ -2997,10 +2940,7 @@ dwarf2_compile_expr_to_ax (struct agent_expr *expr, struct axs_value *loc,
uoffset = extract_unsigned_integer (op_ptr, size, byte_order);
op_ptr += size;
- auto get_frame_pc_from_expr = [expr] ()
- {
- return expr->scope;
- };
+ auto get_frame_pc_from_expr = [expr] () { return expr->scope; };
cu_offset cuoffset = (cu_offset) uoffset;
block = dwarf2_fetch_die_loc_cu_off (cuoffset, per_cu, per_objfile,
get_frame_pc_from_expr);
@@ -3030,12 +2970,11 @@ dwarf2_compile_expr_to_ax (struct agent_expr *expr, struct axs_value *loc,
{
int targ = offsets[dw_labels[i]];
if (targ == -1)
- internal_error (_("invalid label"));
+ internal_error (_ ("invalid label"));
ax_label (expr, patches[i], targ);
}
}
-
/* Return the value of SYMBOL in FRAME using the DWARF-2 expression
evaluator to calculate the location. */
static struct value *
@@ -3078,8 +3017,7 @@ locexpr_get_symbol_read_needs (struct symbol *symbol)
gdbarch *arch = dlbaton->per_objfile->objfile->arch ();
gdb::array_view<const gdb_byte> expr (dlbaton->data, dlbaton->size);
- return dwarf2_get_symbol_read_needs (expr,
- dlbaton->per_cu,
+ return dwarf2_get_symbol_read_needs (expr, dlbaton->per_cu,
dlbaton->per_objfile,
gdbarch_byte_order (arch),
dlbaton->per_cu->addr_size (),
@@ -3112,7 +3050,7 @@ locexpr_regname (struct gdbarch *gdbarch, int dwarf_regnum)
{
/* The text is output as "$bad_register_number".
That is why we use the underscores. */
- return _("bad_register_number");
+ return _ ("bad_register_number");
}
return gdbarch_register_name (gdbarch, regnum);
}
@@ -3136,7 +3074,7 @@ locexpr_describe_location_piece (struct symbol *symbol, struct ui_file *stream,
if (data[0] >= DW_OP_reg0 && data[0] <= DW_OP_reg31)
{
- gdb_printf (stream, _("a variable in $%s"),
+ gdb_printf (stream, _ ("a variable in $%s"),
locexpr_regname (gdbarch, data[0] - DW_OP_reg0));
data += 1;
}
@@ -3145,7 +3083,7 @@ locexpr_describe_location_piece (struct symbol *symbol, struct ui_file *stream,
uint64_t reg;
data = safe_read_uleb128 (data + 1, end, &reg);
- gdb_printf (stream, _("a variable in $%s"),
+ gdb_printf (stream, _ ("a variable in $%s"),
locexpr_regname (gdbarch, reg));
}
else if (data[0] == DW_OP_fbreg)
@@ -3166,27 +3104,28 @@ locexpr_describe_location_piece (struct symbol *symbol, struct ui_file *stream,
b = block_for_pc (addr);
if (!b)
- error (_("No block found for address for symbol \"%s\"."),
+ error (_ ("No block found for address for symbol \"%s\"."),
symbol->print_name ());
framefunc = block_linkage_function (b);
if (!framefunc)
- error (_("No function found for block for symbol \"%s\"."),
+ error (_ ("No function found for block for symbol \"%s\"."),
symbol->print_name ());
- func_get_frame_base_dwarf_block (framefunc, addr, &base_data, &base_size);
+ func_get_frame_base_dwarf_block (framefunc, addr, &base_data,
+ &base_size);
if (base_data[0] >= DW_OP_breg0 && base_data[0] <= DW_OP_breg31)
{
const gdb_byte *buf_end;
-
+
frame_reg = base_data[0] - DW_OP_breg0;
buf_end = safe_read_sleb128 (base_data + 1, base_data + base_size,
&base_offset);
if (buf_end != base_data + base_size)
- error (_("Unexpected opcode after "
- "DW_OP_breg%u for symbol \"%s\"."),
+ error (_ ("Unexpected opcode after "
+ "DW_OP_breg%u for symbol \"%s\"."),
frame_reg, symbol->print_name ());
}
else if (base_data[0] >= DW_OP_reg0 && base_data[0] <= DW_OP_reg31)
@@ -3202,10 +3141,9 @@ locexpr_describe_location_piece (struct symbol *symbol, struct ui_file *stream,
return save_data;
}
- gdb_printf (stream,
- _("a variable at frame base reg $%s offset %s+%s"),
- locexpr_regname (gdbarch, frame_reg),
- plongest (base_offset), plongest (frame_offset));
+ gdb_printf (stream, _ ("a variable at frame base reg $%s offset %s+%s"),
+ locexpr_regname (gdbarch, frame_reg), plongest (base_offset),
+ plongest (frame_offset));
}
else if (data[0] >= DW_OP_breg0 && data[0] <= DW_OP_breg31
&& piece_end_p (data, end))
@@ -3214,8 +3152,7 @@ locexpr_describe_location_piece (struct symbol *symbol, struct ui_file *stream,
data = safe_read_sleb128 (data + 1, end, &offset);
- gdb_printf (stream,
- _("a variable at offset %s from base reg $%s"),
+ gdb_printf (stream, _ ("a variable at offset %s from base reg $%s"),
plongest (offset),
locexpr_regname (gdbarch, data[0] - DW_OP_breg0));
}
@@ -3246,9 +3183,9 @@ locexpr_describe_location_piece (struct symbol *symbol, struct ui_file *stream,
offset = extract_unsigned_integer (data + 1, addr_size,
gdbarch_byte_order (gdbarch));
- gdb_printf (stream,
- _("a thread-local variable at offset 0x%s "
- "in the thread-local storage for `%s'"),
+ gdb_printf (stream,
+ _ ("a thread-local variable at offset 0x%s "
+ "in the thread-local storage for `%s'"),
phex_nz (offset, addr_size), objfile_name (objfile));
data += 1 + addr_size + 1;
@@ -3260,8 +3197,7 @@ locexpr_describe_location_piece (struct symbol *symbol, struct ui_file *stream,
DW_OP_GNU_push_tls_address) */
else if (data + 3 <= end
&& data + 1 + (leb128_size = skip_leb128 (data + 1, end)) < end
- && data[0] == DW_OP_GNU_const_index
- && leb128_size > 0
+ && data[0] == DW_OP_GNU_const_index && leb128_size > 0
&& (data[1 + leb128_size] == DW_OP_GNU_push_tls_address
|| data[1 + leb128_size] == DW_OP_form_tls_address)
&& piece_end_p (data + 2 + leb128_size, end))
@@ -3270,19 +3206,17 @@ locexpr_describe_location_piece (struct symbol *symbol, struct ui_file *stream,
data = safe_read_uleb128 (data + 1, end, &offset);
offset = dwarf2_read_addr_index (per_cu, per_objfile, offset);
- gdb_printf (stream,
- _("a thread-local variable at offset 0x%s "
- "in the thread-local storage for `%s'"),
+ gdb_printf (stream,
+ _ ("a thread-local variable at offset 0x%s "
+ "in the thread-local storage for `%s'"),
phex_nz (offset, addr_size), objfile_name (objfile));
++data;
}
- else if (data[0] >= DW_OP_lit0
- && data[0] <= DW_OP_lit31
- && data + 1 < end
+ else if (data[0] >= DW_OP_lit0 && data[0] <= DW_OP_lit31 && data + 1 < end
&& data[1] == DW_OP_stack_value)
{
- gdb_printf (stream, _("the constant %d"), data[0] - DW_OP_lit0);
+ gdb_printf (stream, _ ("the constant %d"), data[0] - DW_OP_lit0);
data += 2;
}
@@ -3297,19 +3231,17 @@ locexpr_describe_location_piece (struct symbol *symbol, struct ui_file *stream,
of the buffer, an error is thrown. */
static const gdb_byte *
-disassemble_dwarf_expression (struct ui_file *stream,
- struct gdbarch *arch, unsigned int addr_size,
- int offset_size, const gdb_byte *start,
- const gdb_byte *data, const gdb_byte *end,
- int indent, int all,
+disassemble_dwarf_expression (struct ui_file *stream, struct gdbarch *arch,
+ unsigned int addr_size, int offset_size,
+ const gdb_byte *start, const gdb_byte *data,
+ const gdb_byte *end, int indent, int all,
dwarf2_per_cu_data *per_cu,
dwarf2_per_objfile *per_objfile)
{
while (data < end
- && (all
- || (data[0] != DW_OP_piece && data[0] != DW_OP_bit_piece)))
+ && (all || (data[0] != DW_OP_piece && data[0] != DW_OP_bit_piece)))
{
- enum dwarf_location_atom op = (enum dwarf_location_atom) *data++;
+ enum dwarf_location_atom op = (enum dwarf_location_atom) * data++;
uint64_t ul;
int64_t l;
const char *name;
@@ -3317,10 +3249,10 @@ disassemble_dwarf_expression (struct ui_file *stream,
name = get_DW_OP_name (op);
if (!name)
- error (_("Unrecognized DWARF opcode 0x%02x at %ld"),
- op, (long) (data - 1 - start));
- gdb_printf (stream, " %*ld: %s", indent + 4,
- (long) (data - 1 - start), name);
+ error (_ ("Unrecognized DWARF opcode 0x%02x at %ld"), op,
+ (long) (data - 1 - start));
+ gdb_printf (stream, " %*ld: %s", indent + 4, (long) (data - 1 - start),
+ name);
switch (op)
{
@@ -3477,10 +3409,8 @@ disassemble_dwarf_expression (struct ui_file *stream,
case DW_OP_bregx:
data = safe_read_uleb128 (data, end, &ul);
data = safe_read_sleb128 (data, end, &l);
- gdb_printf (stream, " register %s [$%s] offset %s",
- pulongest (ul),
- locexpr_regname (arch, (int) ul),
- plongest (l));
+ gdb_printf (stream, " register %s [$%s] offset %s", pulongest (ul),
+ locexpr_regname (arch, (int) ul), plongest (l));
break;
case DW_OP_fbreg:
@@ -3503,15 +3433,13 @@ disassemble_dwarf_expression (struct ui_file *stream,
case DW_OP_skip:
l = extract_signed_integer (data, 2, gdbarch_byte_order (arch));
data += 2;
- gdb_printf (stream, " to %ld",
- (long) (data + l - start));
+ gdb_printf (stream, " to %ld", (long) (data + l - start));
break;
case DW_OP_bra:
l = extract_signed_integer (data, 2, gdbarch_byte_order (arch));
data += 2;
- gdb_printf (stream, " %ld",
- (long) (data + l - start));
+ gdb_printf (stream, " %ld", (long) (data + l - start));
break;
case DW_OP_call2:
@@ -3544,8 +3472,8 @@ disassemble_dwarf_expression (struct ui_file *stream,
data = safe_read_uleb128 (data, end, &ul);
data = safe_read_uleb128 (data, end, &offset);
- gdb_printf (stream, " size %s offset %s (bits)",
- pulongest (ul), pulongest (offset));
+ gdb_printf (stream, " size %s offset %s (bits)", pulongest (ul),
+ pulongest (offset));
}
break;
@@ -3558,8 +3486,7 @@ disassemble_dwarf_expression (struct ui_file *stream,
data = safe_read_sleb128 (data, end, &l);
- gdb_printf (stream, " DIE %s offset %s",
- phex_nz (ul, offset_size),
+ gdb_printf (stream, " DIE %s offset %s", phex_nz (ul, offset_size),
plongest (l));
}
break;
@@ -3576,8 +3503,7 @@ disassemble_dwarf_expression (struct ui_file *stream,
gdb_printf (stream, "<");
type_print (type, "", stream, -1);
gdb_printf (stream, " [0x%s]> %d",
- phex_nz (to_underlying (offset), 0),
- deref_addr_size);
+ phex_nz (to_underlying (offset), 0), deref_addr_size);
}
break;
@@ -3694,8 +3620,8 @@ show_dwarf_always_disassemble (struct ui_file *file, int from_tty,
struct cmd_list_element *c, const char *value)
{
gdb_printf (file,
- _("Whether to always disassemble "
- "DWARF expressions is %s.\n"),
+ _ ("Whether to always disassemble "
+ "DWARF expressions is %s.\n"),
value);
}
@@ -3704,9 +3630,8 @@ show_dwarf_always_disassemble (struct ui_file *file, int from_tty,
static void
locexpr_describe_location_1 (struct symbol *symbol, CORE_ADDR addr,
- struct ui_file *stream,
- const gdb_byte *data, size_t size,
- unsigned int addr_size,
+ struct ui_file *stream, const gdb_byte *data,
+ size_t size, unsigned int addr_size,
int offset_size, dwarf2_per_cu_data *per_cu,
dwarf2_per_objfile *per_objfile)
{
@@ -3722,35 +3647,33 @@ locexpr_describe_location_1 (struct symbol *symbol, CORE_ADDR addr,
if (first_piece)
first_piece = 0;
else
- gdb_printf (stream, _(", and "));
+ gdb_printf (stream, _ (", and "));
if (!dwarf_always_disassemble)
{
- data = locexpr_describe_location_piece (symbol, stream,
- addr, per_cu, per_objfile,
- data, end, addr_size);
+ data = locexpr_describe_location_piece (symbol, stream, addr, per_cu,
+ per_objfile, data, end,
+ addr_size);
/* If we printed anything, or if we have an empty piece,
then don't disassemble. */
- if (data != here
- || data[0] == DW_OP_piece
+ if (data != here || data[0] == DW_OP_piece
|| data[0] == DW_OP_bit_piece)
disassemble = 0;
}
if (disassemble)
{
- gdb_printf (stream, _("a complex DWARF expression:\n"));
- data = disassemble_dwarf_expression (stream,
- objfile->arch (),
- addr_size, offset_size, data,
- data, end, 0,
- dwarf_always_disassemble,
- per_cu, per_objfile);
+ gdb_printf (stream, _ ("a complex DWARF expression:\n"));
+ data
+ = disassemble_dwarf_expression (stream, objfile->arch (),
+ addr_size, offset_size, data, data,
+ end, 0, dwarf_always_disassemble,
+ per_cu, per_objfile);
}
if (data < end)
{
int empty = data == here;
-
+
if (disassemble)
gdb_printf (stream, " ");
if (data[0] == DW_OP_piece)
@@ -3760,11 +3683,10 @@ locexpr_describe_location_1 (struct symbol *symbol, CORE_ADDR addr,
data = safe_read_uleb128 (data + 1, end, &bytes);
if (empty)
- gdb_printf (stream, _("an empty %s-byte piece"),
+ gdb_printf (stream, _ ("an empty %s-byte piece"),
pulongest (bytes));
else
- gdb_printf (stream, _(" [%s-byte piece]"),
- pulongest (bytes));
+ gdb_printf (stream, _ (" [%s-byte piece]"), pulongest (bytes));
}
else if (data[0] == DW_OP_bit_piece)
{
@@ -3774,12 +3696,10 @@ locexpr_describe_location_1 (struct symbol *symbol, CORE_ADDR addr,
data = safe_read_uleb128 (data, end, &offset);
if (empty)
- gdb_printf (stream,
- _("an empty %s-bit piece"),
+ gdb_printf (stream, _ ("an empty %s-bit piece"),
pulongest (bits));
else
- gdb_printf (stream,
- _(" [%s-bit piece, offset %s bits]"),
+ gdb_printf (stream, _ (" [%s-bit piece, offset %s bits]"),
pulongest (bits), pulongest (offset));
}
else
@@ -3791,7 +3711,7 @@ locexpr_describe_location_1 (struct symbol *symbol, CORE_ADDR addr,
}
if (bad || data > end)
- error (_("Corrupted DWARF2 expression for \"%s\"."),
+ error (_ ("Corrupted DWARF2 expression for \"%s\"."),
symbol->print_name ());
}
@@ -3807,9 +3727,8 @@ locexpr_describe_location (struct symbol *symbol, CORE_ADDR addr,
unsigned int addr_size = dlbaton->per_cu->addr_size ();
int offset_size = dlbaton->per_cu->offset_size ();
- locexpr_describe_location_1 (symbol, addr, stream,
- dlbaton->data, dlbaton->size,
- addr_size, offset_size,
+ locexpr_describe_location_1 (symbol, addr, stream, dlbaton->data,
+ dlbaton->size, addr_size, offset_size,
dlbaton->per_cu, dlbaton->per_objfile);
}
@@ -3837,34 +3756,32 @@ locexpr_tracepoint_var_ref (struct symbol *symbol, struct agent_expr *ax,
static void
locexpr_generate_c_location (struct symbol *sym, string_file *stream,
struct gdbarch *gdbarch,
- std::vector<bool> &registers_used,
- CORE_ADDR pc, const char *result_name)
+ std::vector<bool> &registers_used, CORE_ADDR pc,
+ const char *result_name)
{
struct dwarf2_locexpr_baton *dlbaton
= (struct dwarf2_locexpr_baton *) SYMBOL_LOCATION_BATON (sym);
unsigned int addr_size = dlbaton->per_cu->addr_size ();
if (dlbaton->size == 0)
- error (_("symbol \"%s\" is optimized out"), sym->natural_name ());
+ error (_ ("symbol \"%s\" is optimized out"), sym->natural_name ());
- compile_dwarf_expr_to_c (stream, result_name,
- sym, pc, gdbarch, registers_used, addr_size,
- dlbaton->data, dlbaton->data + dlbaton->size,
- dlbaton->per_cu, dlbaton->per_objfile);
+ compile_dwarf_expr_to_c (stream, result_name, sym, pc, gdbarch,
+ registers_used, addr_size, dlbaton->data,
+ dlbaton->data + dlbaton->size, dlbaton->per_cu,
+ dlbaton->per_objfile);
}
/* The set of location functions used with the DWARF-2 expression
evaluator. */
-const struct symbol_computed_ops dwarf2_locexpr_funcs = {
- locexpr_read_variable,
- locexpr_read_variable_at_entry,
- locexpr_get_symbol_read_needs,
- locexpr_describe_location,
- 0, /* location_has_loclist */
- locexpr_tracepoint_var_ref,
- locexpr_generate_c_location
-};
-
+const struct symbol_computed_ops dwarf2_locexpr_funcs
+ = { locexpr_read_variable,
+ locexpr_read_variable_at_entry,
+ locexpr_get_symbol_read_needs,
+ locexpr_describe_location,
+ 0, /* location_has_loclist */
+ locexpr_tracepoint_var_ref,
+ locexpr_generate_c_location };
/* Wrapper functions for location lists. These generally find
the appropriate location expression and call something above. */
@@ -3956,7 +3873,7 @@ loclist_describe_location (struct symbol *symbol, CORE_ADDR addr,
loc_ptr = dlbaton->data;
buf_end = dlbaton->data + dlbaton->size;
- gdb_printf (stream, _("multi-location:\n"));
+ gdb_printf (stream, _ ("multi-location:\n"));
/* Iterate through locations until we run out. */
while (!done)
@@ -3968,20 +3885,19 @@ loclist_describe_location (struct symbol *symbol, CORE_ADDR addr,
if (dlbaton->per_cu->version () < 5 && dlbaton->from_dwo)
kind = decode_debug_loc_dwo_addresses (dlbaton->per_cu,
- dlbaton->per_objfile,
- loc_ptr, buf_end, &new_ptr,
- &low, &high, byte_order);
+ dlbaton->per_objfile, loc_ptr,
+ buf_end, &new_ptr, &low, &high,
+ byte_order);
else if (dlbaton->per_cu->version () < 5)
- kind = decode_debug_loc_addresses (loc_ptr, buf_end, &new_ptr,
- &low, &high,
- byte_order, addr_size,
+ kind = decode_debug_loc_addresses (loc_ptr, buf_end, &new_ptr, &low,
+ &high, byte_order, addr_size,
signed_addr_p);
else
kind = decode_debug_loclists_addresses (dlbaton->per_cu,
- dlbaton->per_objfile,
- loc_ptr, buf_end, &new_ptr,
- &low, &high, byte_order,
- addr_size, signed_addr_p);
+ dlbaton->per_objfile, loc_ptr,
+ buf_end, &new_ptr, &low, &high,
+ byte_order, addr_size,
+ signed_addr_p);
loc_ptr = new_ptr;
switch (kind)
{
@@ -3991,7 +3907,7 @@ loclist_describe_location (struct symbol *symbol, CORE_ADDR addr,
case DEBUG_LOC_BASE_ADDRESS:
base_address = high;
- gdb_printf (stream, _(" Base address %s"),
+ gdb_printf (stream, _ (" Base address %s"),
paddress (gdbarch, base_address));
continue;
@@ -4002,7 +3918,7 @@ loclist_describe_location (struct symbol *symbol, CORE_ADDR addr,
case DEBUG_LOC_BUFFER_OVERFLOW:
case DEBUG_LOC_INVALID_ENTRY:
- error (_("Corrupted DWARF expression for symbol \"%s\"."),
+ error (_ ("Corrupted DWARF expression for symbol \"%s\"."),
symbol->print_name ());
default:
@@ -4022,26 +3938,26 @@ loclist_describe_location (struct symbol *symbol, CORE_ADDR addr,
high = gdbarch_adjust_dwarf2_addr (gdbarch, high);
if (dlbaton->per_cu->version () < 5)
- {
- length = extract_unsigned_integer (loc_ptr, 2, byte_order);
- loc_ptr += 2;
- }
+ {
+ length = extract_unsigned_integer (loc_ptr, 2, byte_order);
+ loc_ptr += 2;
+ }
else
- {
- unsigned int bytes_read;
- length = read_unsigned_leb128 (NULL, loc_ptr, &bytes_read);
- loc_ptr += bytes_read;
- }
+ {
+ unsigned int bytes_read;
+ length = read_unsigned_leb128 (NULL, loc_ptr, &bytes_read);
+ loc_ptr += bytes_read;
+ }
/* (It would improve readability to print only the minimum
necessary digits of the second number of the range.) */
- gdb_printf (stream, _(" Range %s-%s: "),
- paddress (gdbarch, low), paddress (gdbarch, high));
+ gdb_printf (stream, _ (" Range %s-%s: "), paddress (gdbarch, low),
+ paddress (gdbarch, high));
/* Now describe this particular location. */
locexpr_describe_location_1 (symbol, low, stream, loc_ptr, length,
- addr_size, offset_size,
- dlbaton->per_cu, dlbaton->per_objfile);
+ addr_size, offset_size, dlbaton->per_cu,
+ dlbaton->per_objfile);
gdb_printf (stream, "\n");
@@ -4074,8 +3990,8 @@ loclist_tracepoint_var_ref (struct symbol *symbol, struct agent_expr *ax,
static void
loclist_generate_c_location (struct symbol *sym, string_file *stream,
struct gdbarch *gdbarch,
- std::vector<bool> &registers_used,
- CORE_ADDR pc, const char *result_name)
+ std::vector<bool> &registers_used, CORE_ADDR pc,
+ const char *result_name)
{
struct dwarf2_loclist_baton *dlbaton
= (struct dwarf2_loclist_baton *) SYMBOL_LOCATION_BATON (sym);
@@ -4085,53 +4001,50 @@ loclist_generate_c_location (struct symbol *sym, string_file *stream,
data = dwarf2_find_location_expression (dlbaton, &size, pc);
if (size == 0)
- error (_("symbol \"%s\" is optimized out"), sym->natural_name ());
+ error (_ ("symbol \"%s\" is optimized out"), sym->natural_name ());
- compile_dwarf_expr_to_c (stream, result_name,
- sym, pc, gdbarch, registers_used, addr_size,
- data, data + size,
- dlbaton->per_cu,
- dlbaton->per_objfile);
+ compile_dwarf_expr_to_c (stream, result_name, sym, pc, gdbarch,
+ registers_used, addr_size, data, data + size,
+ dlbaton->per_cu, dlbaton->per_objfile);
}
/* The set of location functions used with the DWARF-2 expression
evaluator and location lists. */
-const struct symbol_computed_ops dwarf2_loclist_funcs = {
- loclist_read_variable,
- loclist_read_variable_at_entry,
- loclist_symbol_needs,
- loclist_describe_location,
- 1, /* location_has_loclist */
- loclist_tracepoint_var_ref,
- loclist_generate_c_location
-};
+const struct symbol_computed_ops dwarf2_loclist_funcs
+ = { loclist_read_variable,
+ loclist_read_variable_at_entry,
+ loclist_symbol_needs,
+ loclist_describe_location,
+ 1, /* location_has_loclist */
+ loclist_tracepoint_var_ref,
+ loclist_generate_c_location };
void _initialize_dwarf2loc ();
+
void
_initialize_dwarf2loc ()
{
add_setshow_zuinteger_cmd ("entry-values", class_maintenance,
&entry_values_debug,
- _("Set entry values and tail call frames "
- "debugging."),
- _("Show entry values and tail call frames "
- "debugging."),
- _("When non-zero, the process of determining "
- "parameter values from function entry point "
- "and tail call frames will be printed."),
- NULL,
- show_entry_values_debug,
- &setdebuglist, &showdebuglist);
+ _ ("Set entry values and tail call frames "
+ "debugging."),
+ _ ("Show entry values and tail call frames "
+ "debugging."),
+ _ ("When non-zero, the process of determining "
+ "parameter values from function entry point "
+ "and tail call frames will be printed."),
+ NULL, show_entry_values_debug, &setdebuglist,
+ &showdebuglist);
add_setshow_boolean_cmd ("always-disassemble", class_obscure,
- &dwarf_always_disassemble, _("\
-Set whether `info address' always disassembles DWARF expressions."), _("\
-Show whether `info address' always disassembles DWARF expressions."), _("\
+ &dwarf_always_disassemble, _ ("\
+Set whether `info address' always disassembles DWARF expressions."),
+ _ ("\
+Show whether `info address' always disassembles DWARF expressions."),
+ _ ("\
When enabled, DWARF expressions are always printed in an assembly-like\n\
syntax. When disabled, expressions will be printed in a more\n\
conversational style, when possible."),
- NULL,
- show_dwarf_always_disassemble,
- &set_dwarf_cmdlist,
- &show_dwarf_cmdlist);
+ NULL, show_dwarf_always_disassemble,
+ &set_dwarf_cmdlist, &show_dwarf_cmdlist);
}
diff --git a/gdb/dwarf2/loc.h b/gdb/dwarf2/loc.h
index 37925f48497..4a8c512e7df 100644
--- a/gdb/dwarf2/loc.h
+++ b/gdb/dwarf2/loc.h
@@ -17,7 +17,7 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
-#if !defined (DWARF2LOC_H)
+#if !defined(DWARF2LOC_H)
#define DWARF2LOC_H
#include "dwarf2/expr.h"
@@ -36,10 +36,9 @@ struct axs_value;
extern unsigned int entry_values_debug;
/* Find a particular location expression from a location list. */
-const gdb_byte *dwarf2_find_location_expression
- (struct dwarf2_loclist_baton *baton,
- size_t *locexpr_length,
- CORE_ADDR pc);
+const gdb_byte *
+dwarf2_find_location_expression (struct dwarf2_loclist_baton *baton,
+ size_t *locexpr_length, CORE_ADDR pc);
/* Find the frame base information for FRAMEFUNC at PC. START is an
out parameter which is set to point to the DWARF expression to
@@ -64,11 +63,10 @@ value *compute_var_value (const char *name);
Function always returns non-NULL, it throws NO_ENTRY_VALUE_ERROR
otherwise. */
-struct call_site_parameter *dwarf_expr_reg_to_entry_parameter
- (frame_info_ptr frame, enum call_site_parameter_kind kind,
- union call_site_parameter_u kind_u, dwarf2_per_cu_data **per_cu_return,
- dwarf2_per_objfile **per_objfile_return);
-
+struct call_site_parameter *dwarf_expr_reg_to_entry_parameter (
+ frame_info_ptr frame, enum call_site_parameter_kind kind,
+ union call_site_parameter_u kind_u, dwarf2_per_cu_data **per_cu_return,
+ dwarf2_per_objfile **per_objfile_return);
/* Evaluate a location description, starting at DATA and with length
SIZE, to find the current location of variable of TYPE in the context
@@ -77,8 +75,7 @@ struct call_site_parameter *dwarf_expr_reg_to_entry_parameter
struct value *dwarf2_evaluate_loc_desc (struct type *type,
frame_info_ptr frame,
- const gdb_byte *data,
- size_t size,
+ const gdb_byte *data, size_t size,
dwarf2_per_cu_data *per_cu,
dwarf2_per_objfile *per_objfile,
bool as_lval = true);
@@ -143,8 +140,7 @@ void dwarf2_compile_property_to_c (string_file *stream,
struct gdbarch *gdbarch,
std::vector<bool> &registers_used,
const struct dynamic_prop *prop,
- CORE_ADDR address,
- struct symbol *sym);
+ CORE_ADDR address, struct symbol *sym);
/* The symbol location baton types used by the DWARF-2 reader (i.e.
SYMBOL_LOCATION_BATON for a LOC_COMPUTED symbol). "struct
@@ -230,6 +226,7 @@ struct dwarf2_property_baton
by value then it will be of PROPERTY_TYPE. This field should never be
NULL. */
struct type *property_type;
+
union
{
/* Location expression either evaluated in the context of
@@ -253,19 +250,20 @@ extern const struct symbol_block_ops dwarf2_block_frame_base_loclist_funcs;
/* Determined tail calls for constructing virtual tail call frames. */
struct call_site_chain
- {
- /* Initially CALLERS == CALLEES == LENGTH. For partially ambiguous result
+{
+ /* Initially CALLERS == CALLEES == LENGTH. For partially ambiguous result
CALLERS + CALLEES < LENGTH. */
- int callers, callees, length;
+ int callers, callees, length;
- /* Variably sized array with LENGTH elements. Later [0..CALLERS-1] contain
+ /* Variably sized array with LENGTH elements. Later [0..CALLERS-1] contain
top (GDB "prev") sites and [LENGTH-CALLEES..LENGTH-1] contain bottom
(GDB "next") sites. One is interested primarily in the PC field. */
- struct call_site *call_site[1];
- };
+ struct call_site *call_site[1];
+};
-extern gdb::unique_xmalloc_ptr<call_site_chain> call_site_find_chain
- (struct gdbarch *gdbarch, CORE_ADDR caller_pc, CORE_ADDR callee_pc);
+extern gdb::unique_xmalloc_ptr<call_site_chain>
+call_site_find_chain (struct gdbarch *gdbarch, CORE_ADDR caller_pc,
+ CORE_ADDR callee_pc);
/* A helper function to convert a DWARF register to an arch register.
ARCH is the architecture.
@@ -291,10 +289,10 @@ extern void invalid_synthetic_pointer ();
/* Fetch the value pointed to by a synthetic pointer. */
-extern struct value *indirect_synthetic_pointer
- (sect_offset die, LONGEST byte_offset, dwarf2_per_cu_data *per_cu,
- dwarf2_per_objfile *per_objfile, frame_info_ptr frame,
- struct type *type, bool resolve_abstract_p = false);
+extern struct value *indirect_synthetic_pointer (
+ sect_offset die, LONGEST byte_offset, dwarf2_per_cu_data *per_cu,
+ dwarf2_per_objfile *per_objfile, frame_info_ptr frame, struct type *type,
+ bool resolve_abstract_p = false);
/* Read parameter of TYPE at (callee) FRAME's function entry. KIND and KIND_U
are used to match DW_AT_location at the caller's
@@ -303,8 +301,8 @@ extern struct value *indirect_synthetic_pointer
Function always returns non-NULL value. It throws NO_ENTRY_VALUE_ERROR if
it cannot resolve the parameter for any reason. */
-extern struct value *value_of_dwarf_reg_entry (struct type *type,
- struct frame_info_ptr frame,
- enum call_site_parameter_kind kind,
- union call_site_parameter_u kind_u);
+extern struct value *
+value_of_dwarf_reg_entry (struct type *type, struct frame_info_ptr frame,
+ enum call_site_parameter_kind kind,
+ union call_site_parameter_u kind_u);
#endif /* DWARF2LOC_H */
diff --git a/gdb/dwarf2/macro.c b/gdb/dwarf2/macro.c
index 78cce2d69eb..ba21c828e4f 100644
--- a/gdb/dwarf2/macro.c
+++ b/gdb/dwarf2/macro.c
@@ -40,14 +40,13 @@
static void
dwarf2_macro_malformed_definition_complaint (const char *arg1)
{
- complaint (_("macro debug info contains a "
- "malformed macro definition:\n`%s'"),
+ complaint (_ ("macro debug info contains a "
+ "malformed macro definition:\n`%s'"),
arg1);
}
static struct macro_source_file *
-macro_start_file (buildsym_compunit *builder,
- int file, int line,
+macro_start_file (buildsym_compunit *builder, int file, int line,
struct macro_source_file *current_file,
const struct line_header *lh)
{
@@ -62,13 +61,12 @@ macro_start_file (buildsym_compunit *builder,
/* The compiler produced a bogus file number. We can at least
record the macro definitions made in the file, even if we
won't be able to find the file by name. */
- complaint (_("bad file number in macro information (%d)"),
- file);
+ complaint (_ ("bad file number in macro information (%d)"), file);
file_name = string_printf ("<bad macro file number %d>", file);
}
- if (! current_file)
+ if (!current_file)
{
/* Note: We don't create a macro table for this compilation unit
at all until we actually get a filename. */
@@ -90,8 +88,8 @@ consume_improper_spaces (const char *p, const char *body)
{
if (*p == ' ')
{
- complaint (_("macro definition contains spaces "
- "in formal argument list:\n`%s'"),
+ complaint (_ ("macro definition contains spaces "
+ "in formal argument list:\n`%s'"),
body);
while (*p == ' ')
@@ -101,7 +99,6 @@ consume_improper_spaces (const char *p, const char *body)
return p;
}
-
static void
parse_macro_definition (struct macro_source_file *file, int line,
const char *body)
@@ -131,7 +128,6 @@ parse_macro_definition (struct macro_source_file *file, int line,
but versions of GCC around March 2002 include spaces after the
commas. */
-
/* Find the extent of the macro name. The macro name is terminated
by either a space or null character (for an object-like macro) or
an opening paren (for a function-like macro). */
@@ -177,7 +173,7 @@ parse_macro_definition (struct macro_source_file *file, int line,
while (*p && *p != ',' && *p != ')' && *p != ' ')
p++;
- if (! *p || p == arg_start)
+ if (!*p || p == arg_start)
dwarf2_macro_malformed_definition_complaint (body);
else
{
@@ -208,16 +204,14 @@ parse_macro_definition (struct macro_source_file *file, int line,
if (*p == ' ')
/* Perfectly formed definition, no complaints. */
- macro_define_function (file, line, name.c_str (),
- argc, (const char **) argv,
- p + 1);
+ macro_define_function (file, line, name.c_str (), argc,
+ (const char **) argv, p + 1);
else if (*p == '\0')
{
/* Complain, but do define it. */
dwarf2_macro_malformed_definition_complaint (body);
- macro_define_function (file, line, name.c_str (),
- argc, (const char **) argv,
- p);
+ macro_define_function (file, line, name.c_str (), argc,
+ (const char **) argv, p);
}
else
/* Just complain. */
@@ -244,8 +238,7 @@ parse_macro_definition (struct macro_source_file *file, int line,
static const gdb_byte *
skip_form_bytes (bfd *abfd, const gdb_byte *bytes, const gdb_byte *buffer_end,
- enum dwarf_form form,
- unsigned int offset_size,
+ enum dwarf_form form, unsigned int offset_size,
const struct dwarf2_section_info *section)
{
unsigned int bytes_read;
@@ -318,8 +311,8 @@ skip_form_bytes (bfd *abfd, const gdb_byte *bytes, const gdb_byte *buffer_end,
default:
{
- complaint (_("invalid form 0x%x in `%s'"),
- form, section->get_name ());
+ complaint (_ ("invalid form 0x%x in `%s'"), form,
+ section->get_name ());
return NULL;
}
}
@@ -332,11 +325,9 @@ skip_form_bytes (bfd *abfd, const gdb_byte *bytes, const gdb_byte *buffer_end,
on error, issues a complaint and returns NULL. */
static const gdb_byte *
-skip_unknown_opcode (unsigned int opcode,
- const gdb_byte **opcode_definitions,
+skip_unknown_opcode (unsigned int opcode, const gdb_byte **opcode_definitions,
const gdb_byte *mac_ptr, const gdb_byte *mac_end,
- bfd *abfd,
- unsigned int offset_size,
+ bfd *abfd, unsigned int offset_size,
const struct dwarf2_section_info *section)
{
unsigned int bytes_read, i;
@@ -345,7 +336,7 @@ skip_unknown_opcode (unsigned int opcode,
if (opcode_definitions[opcode] == NULL)
{
- complaint (_("unrecognized DW_MACINFO or DW_MACRO opcode 0x%x"),
+ complaint (_ ("unrecognized DW_MACINFO or DW_MACRO opcode 0x%x"),
opcode);
return NULL;
}
@@ -356,9 +347,9 @@ skip_unknown_opcode (unsigned int opcode,
for (i = 0; i < arg; ++i)
{
- mac_ptr = skip_form_bytes (abfd, mac_ptr, mac_end,
- (enum dwarf_form) defn[i], offset_size,
- section);
+ mac_ptr
+ = skip_form_bytes (abfd, mac_ptr, mac_end, (enum dwarf_form) defn[i],
+ offset_size, section);
if (mac_ptr == NULL)
{
/* skip_form_bytes already issued the complaint. */
@@ -375,10 +366,8 @@ skip_unknown_opcode (unsigned int opcode,
the header, or issues a complaint and returns NULL on error. */
static const gdb_byte *
-dwarf_parse_macro_header (const gdb_byte **opcode_definitions,
- bfd *abfd,
- const gdb_byte *mac_ptr,
- unsigned int *offset_size,
+dwarf_parse_macro_header (const gdb_byte **opcode_definitions, bfd *abfd,
+ const gdb_byte *mac_ptr, unsigned int *offset_size,
int section_is_gnu)
{
memset (opcode_definitions, 0, 256 * sizeof (gdb_byte *));
@@ -390,7 +379,7 @@ dwarf_parse_macro_header (const gdb_byte **opcode_definitions,
version = read_2_bytes (abfd, mac_ptr);
if (version != 4 && version != 5)
{
- complaint (_("unrecognized version `%d' in .debug_macro section"),
+ complaint (_ ("unrecognized version `%d' in .debug_macro section"),
version);
return NULL;
}
@@ -434,8 +423,7 @@ dwarf_parse_macro_header (const gdb_byte **opcode_definitions,
static void
dwarf_decode_macro_bytes (dwarf2_per_objfile *per_objfile,
- buildsym_compunit *builder,
- bfd *abfd,
+ buildsym_compunit *builder, bfd *abfd,
const gdb_byte *mac_ptr, const gdb_byte *mac_end,
struct macro_source_file *current_file,
const struct line_header *lh,
@@ -478,7 +466,8 @@ dwarf_decode_macro_bytes (dwarf2_per_objfile *per_objfile,
break;
}
- macinfo_type = (enum dwarf_macro_record_type) read_1_byte (abfd, mac_ptr);
+ macinfo_type
+ = (enum dwarf_macro_record_type) read_1_byte (abfd, mac_ptr);
mac_ptr++;
/* Note that we rely on the fact that the corresponding GNU and
@@ -521,38 +510,39 @@ dwarf_decode_macro_bytes (dwarf2_per_objfile *per_objfile,
mac_ptr += offset_size;
if (macinfo_type == DW_MACRO_define_sup
- || macinfo_type == DW_MACRO_undef_sup
- || section_is_dwz)
+ || macinfo_type == DW_MACRO_undef_sup || section_is_dwz)
{
- dwz_file *dwz = dwarf2_get_dwz_file (per_objfile->per_bfd,
- true);
+ dwz_file *dwz
+ = dwarf2_get_dwz_file (per_objfile->per_bfd, true);
body = dwz->read_string (objfile, str_offset);
}
else
- body = per_objfile->per_bfd->str.read_string (objfile,
- str_offset,
- "DW_FORM_strp");
+ body
+ = per_objfile->per_bfd->str.read_string (objfile,
+ str_offset,
+ "DW_FORM_strp");
}
is_define = (macinfo_type == DW_MACRO_define
|| macinfo_type == DW_MACRO_define_strp
|| macinfo_type == DW_MACRO_define_sup);
- if (! current_file)
+ if (!current_file)
{
/* DWARF violation as no main source is present. */
- complaint (_("debug info with no main source gives macro %s "
- "on line %d: %s"),
- is_define ? _("definition") : _("undefinition"),
+ complaint (_ ("debug info with no main source gives macro %s "
+ "on line %d: %s"),
+ is_define ? _ ("definition") : _ ("undefinition"),
line, body);
break;
}
if ((line == 0 && !at_commandline)
|| (line != 0 && at_commandline))
- complaint (_("debug info gives %s macro %s with %s line %d: %s"),
- at_commandline ? _("command-line") : _("in-file"),
- is_define ? _("definition") : _("undefinition"),
- line == 0 ? _("zero") : _("non-zero"), line, body);
+ complaint (
+ _ ("debug info gives %s macro %s with %s line %d: %s"),
+ at_commandline ? _ ("command-line") : _ ("in-file"),
+ is_define ? _ ("definition") : _ ("undefinition"),
+ line == 0 ? _ ("zero") : _ ("non-zero"), line, body);
if (body == NULL)
{
@@ -561,11 +551,11 @@ dwarf_decode_macro_bytes (dwarf2_per_objfile *per_objfile,
For more info, see
https://bugzilla.redhat.com/show_bug.cgi?id=1708786 */
- complaint (_("debug info gives %s invalid macro %s "
- "without body (corrupted?) at line %d "
- "on file %s"),
- at_commandline ? _("command-line") : _("in-file"),
- is_define ? _("definition") : _("undefinition"),
+ complaint (_ ("debug info gives %s invalid macro %s "
+ "without body (corrupted?) at line %d "
+ "on file %s"),
+ at_commandline ? _ ("command-line") : _ ("in-file"),
+ is_define ? _ ("definition") : _ ("undefinition"),
line, current_file->filename);
}
else if (is_define)
@@ -587,48 +577,54 @@ dwarf_decode_macro_bytes (dwarf2_per_objfile *per_objfile,
int line = read_unsigned_leb128 (abfd, mac_ptr, &bytes_read);
mac_ptr += bytes_read;
- int offset_index = read_unsigned_leb128 (abfd, mac_ptr, &bytes_read);
+ int offset_index
+ = read_unsigned_leb128 (abfd, mac_ptr, &bytes_read);
mac_ptr += bytes_read;
/* Use of the strx operators requires a DW_AT_str_offsets_base. */
if (!str_offsets_base.has_value ())
{
- complaint (_("use of %s with unknown string offsets base "
- "[in module %s]"),
+ complaint (_ ("use of %s with unknown string offsets base "
+ "[in module %s]"),
(macinfo_type == DW_MACRO_define_strx
- ? "DW_MACRO_define_strx"
- : "DW_MACRO_undef_strx"),
+ ? "DW_MACRO_define_strx"
+ : "DW_MACRO_undef_strx"),
objfile_name (objfile));
break;
}
str_offsets_section->read (objfile);
- const gdb_byte *info_ptr = (str_offsets_section->buffer
- + *str_offsets_base
- + offset_index * offset_size);
+ const gdb_byte *info_ptr
+ = (str_offsets_section->buffer + *str_offsets_base
+ + offset_index * offset_size);
- const char *macinfo_str = (macinfo_type == DW_MACRO_define_strx ?
- "DW_MACRO_define_strx" : "DW_MACRO_undef_strx");
+ const char *macinfo_str
+ = (macinfo_type == DW_MACRO_define_strx ? "DW_MACRO_define_strx"
+ : "DW_MACRO_undef_strx");
if (*str_offsets_base + offset_index * offset_size
>= str_offsets_section->size)
{
- complaint (_("%s pointing outside of .debug_str_offsets section "
- "[in module %s]"), macinfo_str, objfile_name (objfile));
+ complaint (
+ _ ("%s pointing outside of .debug_str_offsets section "
+ "[in module %s]"),
+ macinfo_str, objfile_name (objfile));
break;
}
ULONGEST str_offset = read_offset (abfd, info_ptr, offset_size);
- const char *body = str_section->read_string (objfile, str_offset,
- macinfo_str);
+ const char *body
+ = str_section->read_string (objfile, str_offset, macinfo_str);
if (current_file == nullptr)
{
/* DWARF violation as no main source is present. */
- complaint (_("debug info with no main source gives macro %s "
- "on line %d: %s"),
- macinfo_type == DW_MACRO_define_strx ? _("definition")
- : _("undefinition"), line, body);
+ complaint (_ ("debug info with no main source gives macro %s "
+ "on line %d: %s"),
+ macinfo_type == DW_MACRO_define_strx
+ ? _ ("definition")
+ : _ ("undefinition"),
+ line, body);
break;
}
@@ -636,8 +632,8 @@ dwarf_decode_macro_bytes (dwarf2_per_objfile *per_objfile,
parse_macro_definition (current_file, line, body);
else
macro_undef (current_file, line, body);
- }
- break;
+ }
+ break;
case DW_MACRO_start_file:
{
@@ -651,10 +647,11 @@ dwarf_decode_macro_bytes (dwarf2_per_objfile *per_objfile,
if ((line == 0 && !at_commandline)
|| (line != 0 && at_commandline))
- complaint (_("debug info gives source %d included "
- "from %s at %s line %d"),
- file, at_commandline ? _("command-line") : _("file"),
- line == 0 ? _("zero") : _("non-zero"), line);
+ complaint (_ ("debug info gives source %d included "
+ "from %s at %s line %d"),
+ file,
+ at_commandline ? _ ("command-line") : _ ("file"),
+ line == 0 ? _ ("zero") : _ ("non-zero"), line);
if (at_commandline)
{
@@ -663,15 +660,15 @@ dwarf_decode_macro_bytes (dwarf2_per_objfile *per_objfile,
at_commandline = 0;
}
else
- current_file = macro_start_file (builder, file, line,
- current_file, lh);
+ current_file
+ = macro_start_file (builder, file, line, current_file, lh);
}
break;
case DW_MACRO_end_file:
- if (! current_file)
- complaint (_("macro debug info has an unmatched "
- "`close_file' directive"));
+ if (!current_file)
+ complaint (_ ("macro debug info has an unmatched "
+ "`close_file' directive"));
else if (current_file->included_by == nullptr
&& producer_is_clang (cu))
{
@@ -686,7 +683,7 @@ dwarf_decode_macro_bytes (dwarf2_per_objfile *per_objfile,
else
{
current_file = current_file->included_by;
- if (! current_file)
+ if (!current_file)
{
enum dwarf_macro_record_type next_type;
@@ -708,8 +705,8 @@ dwarf_decode_macro_bytes (dwarf2_per_objfile *per_objfile,
= (enum dwarf_macro_record_type) read_1_byte (abfd,
mac_ptr);
if (next_type != 0)
- complaint (_("no terminating 0-type entry for "
- "macros in `.debug_macinfo' section"));
+ complaint (_ ("no terminating 0-type entry for "
+ "macros in `.debug_macinfo' section"));
return;
}
@@ -732,8 +729,8 @@ dwarf_decode_macro_bytes (dwarf2_per_objfile *per_objfile,
if (macinfo_type == DW_MACRO_import_sup)
{
- dwz_file *dwz = dwarf2_get_dwz_file (per_objfile->per_bfd,
- true);
+ dwz_file *dwz
+ = dwarf2_get_dwz_file (per_objfile->per_bfd, true);
dwz->macro.read (objfile);
@@ -750,8 +747,8 @@ dwarf_decode_macro_bytes (dwarf2_per_objfile *per_objfile,
{
/* This has actually happened; see
http://sourceware.org/bugzilla/show_bug.cgi?id=13568. */
- complaint (_("recursive DW_MACRO_import in "
- ".debug_macro section"));
+ complaint (_ ("recursive DW_MACRO_import in "
+ ".debug_macro section"));
}
else
{
@@ -787,15 +784,16 @@ dwarf_decode_macro_bytes (dwarf2_per_objfile *per_objfile,
/* FALLTHROUGH */
default:
- mac_ptr = skip_unknown_opcode (macinfo_type, opcode_definitions,
- mac_ptr, mac_end, abfd, offset_size,
- section);
+ mac_ptr
+ = skip_unknown_opcode (macinfo_type, opcode_definitions, mac_ptr,
+ mac_end, abfd, offset_size, section);
if (mac_ptr == NULL)
return;
break;
}
DIAGNOSTIC_POP
- } while (macinfo_type != 0);
+ }
+ while (macinfo_type != 0);
}
void
@@ -803,7 +801,8 @@ dwarf_decode_macros (dwarf2_per_objfile *per_objfile,
buildsym_compunit *builder,
const dwarf2_section_info *section,
const struct line_header *lh, unsigned int offset_size,
- unsigned int offset, struct dwarf2_section_info *str_section,
+ unsigned int offset,
+ struct dwarf2_section_info *str_section,
struct dwarf2_section_info *str_offsets_section,
gdb::optional<ULONGEST> str_offsets_base,
int section_is_gnu, struct dwarf2_cu *cu)
@@ -850,7 +849,8 @@ dwarf_decode_macros (dwarf2_per_objfile *per_objfile,
break;
}
- macinfo_type = (enum dwarf_macro_record_type) read_1_byte (abfd, mac_ptr);
+ macinfo_type
+ = (enum dwarf_macro_record_type) read_1_byte (abfd, mac_ptr);
mac_ptr++;
/* Note that we rely on the fact that the corresponding GNU and
@@ -887,8 +887,8 @@ dwarf_decode_macros (dwarf2_per_objfile *per_objfile,
file = read_unsigned_leb128 (abfd, mac_ptr, &bytes_read);
mac_ptr += bytes_read;
- current_file = macro_start_file (builder, file, line,
- current_file, lh);
+ current_file
+ = macro_start_file (builder, file, line, current_file, lh);
}
break;
@@ -942,15 +942,16 @@ dwarf_decode_macros (dwarf2_per_objfile *per_objfile,
/* FALLTHROUGH */
default:
- mac_ptr = skip_unknown_opcode (macinfo_type, opcode_definitions,
- mac_ptr, mac_end, abfd, offset_size,
- section);
+ mac_ptr
+ = skip_unknown_opcode (macinfo_type, opcode_definitions, mac_ptr,
+ mac_end, abfd, offset_size, section);
if (mac_ptr == NULL)
return;
break;
}
DIAGNOSTIC_POP
- } while (macinfo_type != 0 && current_file == NULL);
+ }
+ while (macinfo_type != 0 && current_file == NULL);
/* Second pass: Process all entries.
@@ -959,8 +960,8 @@ dwarf_decode_macros (dwarf2_per_objfile *per_objfile,
reach the first DW_MACINFO_start_file entry. */
htab_up include_hash (htab_create_alloc (1, htab_hash_pointer,
- htab_eq_pointer,
- NULL, xcalloc, xfree));
+ htab_eq_pointer, NULL, xcalloc,
+ xfree));
mac_ptr = section->buffer + offset;
slot = htab_find_slot (include_hash.get (), mac_ptr, INSERT);
*slot = (void *) mac_ptr;
diff --git a/gdb/dwarf2/macro.h b/gdb/dwarf2/macro.h
index d92994fef16..dc92c187c34 100644
--- a/gdb/dwarf2/macro.h
+++ b/gdb/dwarf2/macro.h
@@ -26,8 +26,7 @@ extern void dwarf_decode_macros (dwarf2_per_objfile *per_objfile,
buildsym_compunit *builder,
const dwarf2_section_info *section,
const struct line_header *lh,
- unsigned int offset_size,
- unsigned int offset,
+ unsigned int offset_size, unsigned int offset,
dwarf2_section_info *str_section,
dwarf2_section_info *str_offsets_section,
gdb::optional<ULONGEST> str_offsets_base,
diff --git a/gdb/dwarf2/mapped-index.h b/gdb/dwarf2/mapped-index.h
index 29c7291ef96..ad4aab3032f 100644
--- a/gdb/dwarf2/mapped-index.h
+++ b/gdb/dwarf2/mapped-index.h
@@ -64,10 +64,7 @@ struct dwarf_scanner_base
/* An ad hoc version check. This is needed for .gdb_index to check
whether a version 8 or above index is in use. Returns true if
the index is usable, false otherwise. */
- virtual bool version_check () const
- {
- return true;
- }
+ virtual bool version_check () const { return true; }
/* This is called when writing an index. For a cooked index, it
will return 'this' as a cooked index. For other forms, it will
@@ -94,8 +91,9 @@ struct mapped_index_base : public dwarf_scanner_base
virtual size_t symbol_name_count () const = 0;
/* Get the name of the symbol at IDX in the symbol table. */
- virtual const char *symbol_name_at
- (offset_type idx, dwarf2_per_objfile *per_objfile) const = 0;
+ virtual const char *symbol_name_at (offset_type idx,
+ dwarf2_per_objfile *per_objfile) const
+ = 0;
/* Return whether the name at IDX in the symbol table should be
ignored. */
@@ -113,13 +111,13 @@ struct mapped_index_base : public dwarf_scanner_base
vector. */
std::pair<std::vector<name_component>::const_iterator,
std::vector<name_component>::const_iterator>
- find_name_components_bounds (const lookup_name_info &ln_no_params,
- enum language lang,
- dwarf2_per_objfile *per_objfile) const;
+ find_name_components_bounds (const lookup_name_info &ln_no_params,
+ enum language lang,
+ dwarf2_per_objfile *per_objfile) const;
cooked_index *index_for_writing () override
{
- error (_("Cannot use an index to create the index"));
+ error (_ ("Cannot use an index to create the index"));
}
};
diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c
index fb5aa7b8e5b..d5e274e9d56 100644
--- a/gdb/dwarf2/read.c
+++ b/gdb/dwarf2/read.c
@@ -52,7 +52,7 @@
#include "dwarf2.h"
#include "demangle.h"
#include "gdb-demangle.h"
-#include "filenames.h" /* for DOSish file names */
+#include "filenames.h" /* for DOSish file names */
#include "language.h"
#include "complaints.h"
#include "dwarf2/expr.h"
@@ -101,13 +101,13 @@ static unsigned int dwarf_read_debug = 0;
/* Print a "dwarf-read" debug statement if dwarf_read_debug is >= 1. */
-#define dwarf_read_debug_printf(fmt, ...) \
+#define dwarf_read_debug_printf(fmt, ...) \
debug_prefixed_printf_cond (dwarf_read_debug >= 1, "dwarf-read", fmt, \
##__VA_ARGS__)
/* Print a "dwarf-read" debug statement if dwarf_read_debug is >= 2. */
-#define dwarf_read_debug_printf_v(fmt, ...) \
+#define dwarf_read_debug_printf_v(fmt, ...) \
debug_prefixed_printf_cond (dwarf_read_debug >= 2, "dwarf-read", fmt, \
##__VA_ARGS__)
@@ -125,7 +125,7 @@ static bool use_deprecated_index_sections = false;
/* This is used to store the data that is always per objfile. */
static const registry<objfile>::key<dwarf2_per_objfile>
- dwarf2_objfile_data_key;
+ dwarf2_objfile_data_key;
/* These are used to store the dwarf2_per_bfd objects.
@@ -165,6 +165,7 @@ static int dwarf2_loclist_block_index;
class offset_view
{
public:
+
offset_view () = default;
explicit offset_view (gdb::array_view<const gdb_byte> bytes)
@@ -176,24 +177,18 @@ public:
offset_type operator[] (size_t index) const
{
const gdb_byte *bytes = &m_bytes[index * sizeof (offset_type)];
- return (offset_type) extract_unsigned_integer (bytes,
- sizeof (offset_type),
+ return (offset_type) extract_unsigned_integer (bytes, sizeof (offset_type),
BFD_ENDIAN_LITTLE);
}
/* Return the number of offset_types in this array. */
- size_t size () const
- {
- return m_bytes.size () / sizeof (offset_type);
- }
+ size_t size () const { return m_bytes.size () / sizeof (offset_type); }
/* Return true if this view is empty. */
- bool empty () const
- {
- return m_bytes.empty ();
- }
+ bool empty () const { return m_bytes.empty (); }
private:
+
/* The underlying bytes. */
gdb::array_view<const gdb_byte> m_bytes;
};
@@ -230,28 +225,26 @@ struct mapped_index final : public mapped_index_base
bool symbol_name_slot_invalid (offset_type idx) const override
{
- return (symbol_name_index (idx) == 0
- && symbol_vec_index (idx) == 0);
+ return (symbol_name_index (idx) == 0 && symbol_vec_index (idx) == 0);
}
/* Convenience method to get at the name of the symbol at IDX in the
symbol table. */
- const char *symbol_name_at
- (offset_type idx, dwarf2_per_objfile *per_objfile) const override
+ const char *symbol_name_at (offset_type idx,
+ dwarf2_per_objfile *per_objfile) const override
{
return (const char *) (this->constant_pool.data ()
+ symbol_name_index (idx));
}
size_t symbol_name_count () const override
- { return this->symbol_table.size () / 2; }
+ {
+ return this->symbol_table.size () / 2;
+ }
quick_symbol_functions_up make_quick_functions () const override;
- bool version_check () const override
- {
- return version >= 8;
- }
+ bool version_check () const override { return version >= 8; }
};
/* A description of the mapped .debug_names.
@@ -273,6 +266,7 @@ struct mapped_debug_names final : public mapped_index_base
struct index_val
{
ULONGEST dwarf_tag;
+
struct attr
{
/* Attribute name DW_IDX_*. */
@@ -284,23 +278,25 @@ struct mapped_debug_names final : public mapped_index_base
/* Value if FORM is DW_FORM_implicit_const. */
LONGEST implicit_const;
};
+
std::vector<attr> attr_vec;
};
std::unordered_map<ULONGEST, index_val> abbrev_map;
- const char *namei_to_name
- (uint32_t namei, dwarf2_per_objfile *per_objfile) const;
+ const char *namei_to_name (uint32_t namei,
+ dwarf2_per_objfile *per_objfile) const;
/* Implementation of the mapped_index_base virtual interface, for
the name_components cache. */
- const char *symbol_name_at
- (offset_type idx, dwarf2_per_objfile *per_objfile) const override
- { return namei_to_name (idx, per_objfile); }
+ const char *symbol_name_at (offset_type idx,
+ dwarf2_per_objfile *per_objfile) const override
+ {
+ return namei_to_name (idx, per_objfile);
+ }
- size_t symbol_name_count () const override
- { return this->name_count; }
+ size_t symbol_name_count () const override { return this->name_count; }
quick_symbol_functions_up make_quick_functions () const override;
};
@@ -318,29 +314,27 @@ get_dwarf2_per_objfile (struct objfile *objfile)
/* Note that if the debugging section has been compressed, it might
have a name like .zdebug_info. */
-const struct dwarf2_debug_sections dwarf2_elf_names =
-{
- { ".debug_info", ".zdebug_info" },
- { ".debug_abbrev", ".zdebug_abbrev" },
- { ".debug_line", ".zdebug_line" },
- { ".debug_loc", ".zdebug_loc" },
- { ".debug_loclists", ".zdebug_loclists" },
- { ".debug_macinfo", ".zdebug_macinfo" },
- { ".debug_macro", ".zdebug_macro" },
- { ".debug_str", ".zdebug_str" },
- { ".debug_str_offsets", ".zdebug_str_offsets" },
- { ".debug_line_str", ".zdebug_line_str" },
- { ".debug_ranges", ".zdebug_ranges" },
- { ".debug_rnglists", ".zdebug_rnglists" },
- { ".debug_types", ".zdebug_types" },
- { ".debug_addr", ".zdebug_addr" },
- { ".debug_frame", ".zdebug_frame" },
- { ".eh_frame", NULL },
- { ".gdb_index", ".zgdb_index" },
- { ".debug_names", ".zdebug_names" },
- { ".debug_aranges", ".zdebug_aranges" },
- 23
-};
+const struct dwarf2_debug_sections dwarf2_elf_names
+ = { { ".debug_info", ".zdebug_info" },
+ { ".debug_abbrev", ".zdebug_abbrev" },
+ { ".debug_line", ".zdebug_line" },
+ { ".debug_loc", ".zdebug_loc" },
+ { ".debug_loclists", ".zdebug_loclists" },
+ { ".debug_macinfo", ".zdebug_macinfo" },
+ { ".debug_macro", ".zdebug_macro" },
+ { ".debug_str", ".zdebug_str" },
+ { ".debug_str_offsets", ".zdebug_str_offsets" },
+ { ".debug_line_str", ".zdebug_line_str" },
+ { ".debug_ranges", ".zdebug_ranges" },
+ { ".debug_rnglists", ".zdebug_rnglists" },
+ { ".debug_types", ".zdebug_types" },
+ { ".debug_addr", ".zdebug_addr" },
+ { ".debug_frame", ".zdebug_frame" },
+ { ".eh_frame", NULL },
+ { ".gdb_index", ".zgdb_index" },
+ { ".debug_names", ".zdebug_names" },
+ { ".debug_aranges", ".zdebug_aranges" },
+ 23 };
/* List of DWO/DWP sections. */
@@ -359,9 +353,7 @@ static const struct dwop_section_names
struct dwarf2_section_names types_dwo;
struct dwarf2_section_names cu_index;
struct dwarf2_section_names tu_index;
-}
-dwop_section_names =
-{
+} dwop_section_names = {
{ ".debug_abbrev.dwo", ".zdebug_abbrev.dwo" },
{ ".debug_info.dwo", ".zdebug_info.dwo" },
{ ".debug_line.dwo", ".zdebug_line.dwo" },
@@ -423,7 +415,9 @@ struct stmt_list_hash
struct type_unit_group
{
/* The data used to construct the hash key. */
- struct stmt_list_hash hash {};
+ struct stmt_list_hash hash
+ {
+ };
};
/* These sections are what may appear in a (real or virtual) DWO file. */
@@ -508,7 +502,9 @@ struct dwo_file
/* The sections that make up this DWO file.
Remember that for virtual DWO files in DWP V2 or DWP V5, these are virtual
sections (for lack of a better name). */
- struct dwo_sections sections {};
+ struct dwo_sections sections
+ {
+ };
/* The CUs in the file.
Each element is a struct dwo_unit. Multiple CUs per DWO are supported as
@@ -610,38 +606,41 @@ struct dwp_hash_table
uint32_t version, nr_columns;
uint32_t nr_units, nr_slots;
const gdb_byte *hash_table, *unit_table;
+
union
{
struct
{
const gdb_byte *indices;
} v1;
+
struct
{
/* This is indexed by column number and gives the id of the section
in that column. */
-#define MAX_NR_V2_DWO_SECTIONS \
- (1 /* .debug_info or .debug_types */ \
- + 1 /* .debug_abbrev */ \
- + 1 /* .debug_line */ \
- + 1 /* .debug_loc */ \
- + 1 /* .debug_str_offsets */ \
+#define MAX_NR_V2_DWO_SECTIONS \
+ (1 /* .debug_info or .debug_types */ \
+ + 1 /* .debug_abbrev */ \
+ + 1 /* .debug_line */ \
+ + 1 /* .debug_loc */ \
+ + 1 /* .debug_str_offsets */ \
+ 1 /* .debug_macro or .debug_macinfo */)
int section_ids[MAX_NR_V2_DWO_SECTIONS];
const gdb_byte *offsets;
const gdb_byte *sizes;
} v2;
+
struct
{
/* This is indexed by column number and gives the id of the section
in that column. */
-#define MAX_NR_V5_DWO_SECTIONS \
- (1 /* .debug_info */ \
- + 1 /* .debug_abbrev */ \
- + 1 /* .debug_line */ \
- + 1 /* .debug_loclists */ \
+#define MAX_NR_V5_DWO_SECTIONS \
+ (1 /* .debug_info */ \
+ + 1 /* .debug_abbrev */ \
+ + 1 /* .debug_line */ \
+ + 1 /* .debug_loclists */ \
+ 1 /* .debug_str_offsets */ \
- + 1 /* .debug_macro */ \
+ + 1 /* .debug_macro */ \
+ 1 /* .debug_rnglists */)
int section_ids[MAX_NR_V5_DWO_SECTIONS];
const gdb_byte *offsets;
@@ -670,7 +669,9 @@ struct dwp_file
gdb_bfd_ref_ptr dbfd;
/* Section info for this file. */
- struct dwp_sections sections {};
+ struct dwp_sections sections
+ {
+ };
/* Table of CUs in the file. */
const struct dwp_hash_table *cus = nullptr;
@@ -725,12 +726,9 @@ class cutu_reader : public die_reader_specs
{
public:
- cutu_reader (dwarf2_per_cu_data *this_cu,
- dwarf2_per_objfile *per_objfile,
- struct abbrev_table *abbrev_table,
- dwarf2_cu *existing_cu,
- bool skip_partial,
- abbrev_cache *cache = nullptr);
+ cutu_reader (dwarf2_per_cu_data *this_cu, dwarf2_per_objfile *per_objfile,
+ struct abbrev_table *abbrev_table, dwarf2_cu *existing_cu,
+ bool skip_partial, abbrev_cache *cache = nullptr);
explicit cutu_reader (struct dwarf2_per_cu_data *this_cu,
dwarf2_per_objfile *per_objfile,
@@ -757,6 +755,7 @@ public:
}
private:
+
void init_tu_and_read_dwo_dies (dwarf2_per_cu_data *this_cu,
dwarf2_per_objfile *per_objfile,
dwarf2_cu *existing_cu);
@@ -822,7 +821,10 @@ struct nextfield
reference. We track the section offset of each field to make
this link. */
sect_offset offset;
- struct field field {};
+
+ struct field field
+ {
+ };
};
struct fnfieldlist
@@ -864,10 +866,7 @@ struct field_info
std::vector<variant_part_builder> variant_parts;
/* Return the total number of fields (including baseclasses). */
- int nfields () const
- {
- return fields.size () + baseclasses.size ();
- }
+ int nfields () const { return fields.size () + baseclasses.size (); }
};
/* Loaded secondary compilation units are kept in memory until they
@@ -876,15 +875,17 @@ struct field_info
sizes of up to at least twenty will improve startup time for
typical inter-CU-reference binaries, at an obvious memory cost. */
static int dwarf_max_cache_age = 5;
+
static void
show_dwarf_max_cache_age (struct ui_file *file, int from_tty,
struct cmd_list_element *c, const char *value)
{
- gdb_printf (file, _("The upper bound on the age of cached "
- "DWARF compilation units is %s.\n"),
+ gdb_printf (file,
+ _ ("The upper bound on the age of cached "
+ "DWARF compilation units is %s.\n"),
value);
}
-
+
/* local function prototypes */
static void dwarf2_find_base_address (struct die_info *die,
@@ -896,8 +897,7 @@ static void build_type_psymtabs_reader (cutu_reader *reader,
static void dwarf2_build_psymtabs_hard (dwarf2_per_objfile *per_objfile);
-static void var_decode_location (struct attribute *attr,
- struct symbol *sym,
+static void var_decode_location (struct attribute *attr, struct symbol *sym,
struct dwarf2_cu *cu);
static unsigned int peek_abbrev_code (bfd *, const gdb_byte *);
@@ -910,17 +910,20 @@ static const gdb_byte *read_attribute (const struct die_reader_specs *,
static void read_attribute_reprocess (const struct die_reader_specs *reader,
struct attribute *attr, dwarf_tag tag);
-static CORE_ADDR read_addr_index (struct dwarf2_cu *cu, unsigned int addr_index);
+static CORE_ADDR read_addr_index (struct dwarf2_cu *cu,
+ unsigned int addr_index);
static sect_offset read_abbrev_offset (dwarf2_per_objfile *per_objfile,
dwarf2_section_info *, sect_offset);
-static const char *read_indirect_string
- (dwarf2_per_objfile *per_objfile, bfd *, const gdb_byte *,
- const struct comp_unit_head *, unsigned int *);
+static const char *read_indirect_string (dwarf2_per_objfile *per_objfile,
+ bfd *, const gdb_byte *,
+ const struct comp_unit_head *,
+ unsigned int *);
-static const char *read_indirect_string_at_offset
- (dwarf2_per_objfile *per_objfile, LONGEST str_offset);
+static const char *
+read_indirect_string_at_offset (dwarf2_per_objfile *per_objfile,
+ LONGEST str_offset);
static CORE_ADDR read_addr_index_from_leb128 (struct dwarf2_cu *,
const gdb_byte *,
@@ -938,7 +941,8 @@ static struct attribute *dwarf2_attr (struct die_info *, unsigned int,
static const char *dwarf2_string_attr (struct die_info *die, unsigned int name,
struct dwarf2_cu *cu);
-static const char *dwarf2_dwo_name (struct die_info *die, struct dwarf2_cu *cu);
+static const char *dwarf2_dwo_name (struct die_info *die,
+ struct dwarf2_cu *cu);
static int dwarf2_flag_true_p (struct die_info *die, unsigned name,
struct dwarf2_cu *cu);
@@ -952,8 +956,7 @@ static line_header_up dwarf_decode_line_header (sect_offset sect_off,
struct dwarf2_cu *cu,
const char *comp_dir);
-static void dwarf_decode_lines (struct line_header *,
- struct dwarf2_cu *,
+static void dwarf_decode_lines (struct line_header *, struct dwarf2_cu *,
CORE_ADDR, int decode_mapping);
static void dwarf2_start_subfile (dwarf2_cu *cu, const file_entry &fe,
@@ -966,8 +969,7 @@ static void dwarf2_const_value (const struct attribute *, struct symbol *,
struct dwarf2_cu *);
static void dwarf2_const_value_attr (const struct attribute *attr,
- struct type *type,
- const char *name,
+ struct type *type, const char *name,
struct obstack *obstack,
struct dwarf2_cu *cu, LONGEST *value,
const gdb_byte **bytes,
@@ -989,7 +991,8 @@ static void set_descriptive_type (struct type *, struct die_info *,
static struct type *die_containing_type (struct die_info *,
struct dwarf2_cu *);
-static struct type *lookup_die_type (struct die_info *, const struct attribute *,
+static struct type *lookup_die_type (struct die_info *,
+ const struct attribute *,
struct dwarf2_cu *);
static struct type *read_type_die (struct die_info *, struct dwarf2_cu *);
@@ -1018,8 +1021,8 @@ static void read_variable (struct die_info *die, struct dwarf2_cu *cu);
static struct dwarf2_section_info *cu_debug_loc_section (struct dwarf2_cu *cu);
/* Return the .debug_rnglists section to use for cu. */
-static struct dwarf2_section_info *cu_debug_rnglists_section
- (struct dwarf2_cu *cu, dwarf_tag tag);
+static struct dwarf2_section_info *
+cu_debug_rnglists_section (struct dwarf2_cu *cu, dwarf_tag tag);
/* How dwarf2_get_pc_bounds constructed its *LOWPC and *HIGHPC return
values. Keep the items ordered with increasing constraints compliance. */
@@ -1041,12 +1044,10 @@ enum pc_bounds_kind
static enum pc_bounds_kind dwarf2_get_pc_bounds (struct die_info *,
CORE_ADDR *, CORE_ADDR *,
- struct dwarf2_cu *,
- addrmap *,
+ struct dwarf2_cu *, addrmap *,
void *);
-static void get_scope_pc_bounds (struct die_info *,
- CORE_ADDR *, CORE_ADDR *,
+static void get_scope_pc_bounds (struct die_info *, CORE_ADDR *, CORE_ADDR *,
struct dwarf2_cu *);
static void dwarf2_record_block_ranges (struct die_info *, struct block *,
@@ -1055,12 +1056,11 @@ static void dwarf2_record_block_ranges (struct die_info *, struct block *,
static void dwarf2_add_field (struct field_info *, struct die_info *,
struct dwarf2_cu *);
-static void dwarf2_attach_fields_to_type (struct field_info *,
- struct type *, struct dwarf2_cu *);
+static void dwarf2_attach_fields_to_type (struct field_info *, struct type *,
+ struct dwarf2_cu *);
-static void dwarf2_add_member_fn (struct field_info *,
- struct die_info *, struct type *,
- struct dwarf2_cu *);
+static void dwarf2_add_member_fn (struct field_info *, struct die_info *,
+ struct type *, struct dwarf2_cu *);
static void dwarf2_attach_fn_fields_to_type (struct field_info *,
struct type *,
@@ -1083,8 +1083,8 @@ static bool read_alias (struct die_info *die, struct dwarf2_cu *cu);
static struct type *read_module_type (struct die_info *die,
struct dwarf2_cu *cu);
-static const char *namespace_name (struct die_info *die,
- int *is_anonymous, struct dwarf2_cu *);
+static const char *namespace_name (struct die_info *die, int *is_anonymous,
+ struct dwarf2_cu *);
static void process_enumeration_scope (struct die_info *, struct dwarf2_cu *);
@@ -1094,9 +1094,9 @@ static CORE_ADDR decode_locdesc (struct dwarf_block *, struct dwarf2_cu *,
static enum dwarf_array_dim_ordering read_array_order (struct die_info *,
struct dwarf2_cu *);
-static struct die_info *read_die_and_siblings_1
- (const struct die_reader_specs *, const gdb_byte *, const gdb_byte **,
- struct die_info *);
+static struct die_info *
+read_die_and_siblings_1 (const struct die_reader_specs *, const gdb_byte *,
+ const gdb_byte **, struct die_info *);
static struct die_info *read_die_and_siblings (const struct die_reader_specs *,
const gdb_byte *info_ptr,
@@ -1117,8 +1117,7 @@ static const char *dwarf2_canonicalize_name (const char *, struct dwarf2_cu *,
static const char *dwarf2_name (struct die_info *die, struct dwarf2_cu *);
-static const char *dwarf2_full_name (const char *name,
- struct die_info *die,
+static const char *dwarf2_full_name (const char *name, struct die_info *die,
struct dwarf2_cu *cu);
static const char *dwarf2_physname (const char *name, struct die_info *die,
@@ -1136,8 +1135,7 @@ static void dump_die_1 (struct ui_file *, int level, int max_level,
/*static*/ void dump_die (struct die_info *, int max_level);
-static void store_in_ref_table (struct die_info *,
- struct dwarf2_cu *);
+static void store_in_ref_table (struct die_info *, struct dwarf2_cu *);
static struct die_info *follow_die_ref_or_sig (struct die_info *,
const struct attribute *,
@@ -1182,17 +1180,15 @@ static void fill_in_loclist_baton (struct dwarf2_cu *cu,
static void dwarf2_symbol_mark_computed (const struct attribute *attr,
struct symbol *sym,
- struct dwarf2_cu *cu,
- int is_block);
+ struct dwarf2_cu *cu, int is_block);
static const gdb_byte *skip_one_die (const struct die_reader_specs *reader,
const gdb_byte *info_ptr,
const struct abbrev_info *abbrev,
bool do_skip_children = true);
-static struct dwarf2_per_cu_data *dwarf2_find_containing_comp_unit
- (sect_offset sect_off, unsigned int offset_in_dwz,
- dwarf2_per_bfd *per_bfd);
+static struct dwarf2_per_cu_data *dwarf2_find_containing_comp_unit (
+ sect_offset sect_off, unsigned int offset_in_dwz, dwarf2_per_bfd *per_bfd);
static void prepare_one_comp_unit (struct dwarf2_cu *cu,
struct die_info *comp_unit_die,
@@ -1205,8 +1201,7 @@ static void create_all_units (dwarf2_per_objfile *per_objfile);
static void load_full_comp_unit (dwarf2_per_cu_data *per_cu,
dwarf2_per_objfile *per_objfile,
- dwarf2_cu *existing_cu,
- bool skip_partial,
+ dwarf2_cu *existing_cu, bool skip_partial,
enum language pretend_language);
static void process_full_comp_unit (dwarf2_cu *cu,
@@ -1235,6 +1230,7 @@ static void process_queue (dwarf2_per_objfile *per_objfile);
class dwarf2_queue_guard
{
public:
+
explicit dwarf2_queue_guard (dwarf2_per_objfile *per_objfile)
: m_per_objfile (per_objfile)
{
@@ -1255,6 +1251,7 @@ public:
DISABLE_COPY_AND_ASSIGN (dwarf2_queue_guard);
private:
+
dwarf2_per_objfile *m_per_objfile;
};
@@ -1280,31 +1277,33 @@ dwarf2_per_cu_data_deleter::operator() (dwarf2_per_cu_data *data)
delete data;
}
-static file_and_directory &find_file_and_directory
- (struct die_info *die, struct dwarf2_cu *cu);
+static file_and_directory &find_file_and_directory (struct die_info *die,
+ struct dwarf2_cu *cu);
-static const char *compute_include_file_name
- (const struct line_header *lh,
- const file_entry &fe,
- const file_and_directory &cu_info,
- std::string &name_holder);
+static const char *
+compute_include_file_name (const struct line_header *lh, const file_entry &fe,
+ const file_and_directory &cu_info,
+ std::string &name_holder);
static htab_up allocate_signatured_type_table ();
static htab_up allocate_dwo_unit_table ();
-static struct dwo_unit *lookup_dwo_unit_in_dwp
- (dwarf2_per_objfile *per_objfile, struct dwp_file *dwp_file,
- const char *comp_dir, ULONGEST signature, int is_debug_types);
+static struct dwo_unit *
+lookup_dwo_unit_in_dwp (dwarf2_per_objfile *per_objfile,
+ struct dwp_file *dwp_file, const char *comp_dir,
+ ULONGEST signature, int is_debug_types);
static struct dwp_file *get_dwp_file (dwarf2_per_objfile *per_objfile);
-static struct dwo_unit *lookup_dwo_comp_unit
- (dwarf2_cu *cu, const char *dwo_name, const char *comp_dir,
- ULONGEST signature);
+static struct dwo_unit *lookup_dwo_comp_unit (dwarf2_cu *cu,
+ const char *dwo_name,
+ const char *comp_dir,
+ ULONGEST signature);
-static struct dwo_unit *lookup_dwo_type_unit
- (dwarf2_cu *cu, const char *dwo_name, const char *comp_dir);
+static struct dwo_unit *lookup_dwo_type_unit (dwarf2_cu *cu,
+ const char *dwo_name,
+ const char *comp_dir);
static void queue_and_load_all_dwo_tus (dwarf2_cu *cu);
@@ -1315,41 +1314,41 @@ typedef std::unique_ptr<struct dwo_file> dwo_file_up;
static void process_cu_includes (dwarf2_per_objfile *per_objfile);
static void check_producer (struct dwarf2_cu *cu);
-
+
/* Various complaints about symbol reading that don't abort the process. */
static void
dwarf2_debug_line_missing_file_complaint (void)
{
- complaint (_(".debug_line section has line data without a file"));
+ complaint (_ (".debug_line section has line data without a file"));
}
static void
dwarf2_debug_line_missing_end_sequence_complaint (void)
{
- complaint (_(".debug_line section has line "
- "program sequence without an end"));
+ complaint (_ (".debug_line section has line "
+ "program sequence without an end"));
}
static void
dwarf2_complex_location_expr_complaint (void)
{
- complaint (_("location expression too complex"));
+ complaint (_ ("location expression too complex"));
}
static void
dwarf2_const_value_length_mismatch_complaint (const char *arg1, int arg2,
int arg3)
{
- complaint (_("const value length mismatch for '%s', got %d, expected %d"),
+ complaint (_ ("const value length mismatch for '%s', got %d, expected %d"),
arg1, arg2, arg3);
}
static void
dwarf2_invalid_attrib_class_complaint (const char *arg1, const char *arg2)
{
- complaint (_("invalid attribute class or form for '%s' in '%s'"),
- arg1, arg2);
+ complaint (_ ("invalid attribute class or form for '%s' in '%s'"), arg1,
+ arg2);
}
/* Hash function for line_header_hash. */
@@ -1382,8 +1381,6 @@ line_header_eq_voidp (const void *item_lhs, const void *item_rhs)
&& ofs_lhs->offset_in_dwz == ofs_rhs->offset_in_dwz);
}
-
-
/* An iterator for all_units that is based on index. This
approach makes it possible to iterate over all_units safely,
when some caller in the loop may add new units. */
@@ -1414,7 +1411,6 @@ public:
return m_index == other.m_index;
}
-
bool operator!= (const all_units_iterator &other) const
{
return m_index != other.m_index;
@@ -1436,15 +1432,9 @@ public:
{
}
- all_units_iterator begin ()
- {
- return all_units_iterator (m_per_bfd, true);
- }
+ all_units_iterator begin () { return all_units_iterator (m_per_bfd, true); }
- all_units_iterator end ()
- {
- return all_units_iterator (m_per_bfd, false);
- }
+ all_units_iterator end () { return all_units_iterator (m_per_bfd, false); }
private:
@@ -1498,10 +1488,7 @@ public:
{
}
- ~free_cached_comp_units ()
- {
- m_per_objfile->remove_all_cus ();
- }
+ ~free_cached_comp_units () { m_per_objfile->remove_all_cus (); }
DISABLE_COPY_AND_ASSIGN (free_cached_comp_units);
@@ -1551,8 +1538,7 @@ dwarf2_per_objfile::set_symtab (const dwarf2_per_cu_data *per_cu,
bool
dwarf2_has_info (struct objfile *objfile,
- const struct dwarf2_debug_sections *names,
- bool can_copy)
+ const struct dwarf2_debug_sections *names, bool can_copy)
{
if (objfile->flags & OBJF_READNEVER)
return false;
@@ -1578,8 +1564,8 @@ dwarf2_has_info (struct objfile *objfile,
if (per_bfd == nullptr)
{
/* No, create it now. */
- per_bfd = new dwarf2_per_bfd (objfile->obfd.get (), names,
- can_copy);
+ per_bfd
+ = new dwarf2_per_bfd (objfile->obfd.get (), names, can_copy);
dwarf2_per_bfd_bfd_data_key.set (objfile->obfd.get (), per_bfd);
}
}
@@ -1590,7 +1576,8 @@ dwarf2_has_info (struct objfile *objfile,
dwarf2_per_bfd_objfile_data_key.set (objfile, per_bfd);
}
- per_objfile = dwarf2_objfile_data_key.emplace (objfile, objfile, per_bfd);
+ per_objfile
+ = dwarf2_objfile_data_key.emplace (objfile, objfile, per_bfd);
}
return (!per_objfile->per_bfd->info.is_virtual
@@ -1614,8 +1601,8 @@ dwarf2_per_bfd::locate_sections (bfd *abfd, asection *sectp,
> bfd_get_file_size (abfd))
{
bfd_size_type size = elf_section_data (sectp)->this_hdr.sh_size;
- warning (_("Discarding section %s which has a section size (%s"
- ") larger than the file size [in module %s]"),
+ warning (_ ("Discarding section %s which has a section size (%s"
+ ") larger than the file size [in module %s]"),
bfd_section_name (sectp), phex_nz (size, sizeof (size)),
bfd_get_filename (abfd));
}
@@ -1730,9 +1717,8 @@ dwarf2_per_bfd::locate_sections (bfd *abfd, asection *sectp,
void
dwarf2_get_section_info (struct objfile *objfile,
- enum dwarf2_section_enum sect,
- asection **sectp, const gdb_byte **bufp,
- bfd_size_type *sizep)
+ enum dwarf2_section_enum sect, asection **sectp,
+ const gdb_byte **bufp, bfd_size_type *sizep)
{
dwarf2_per_objfile *per_objfile = get_dwarf2_per_objfile (objfile);
struct dwarf2_section_info *info;
@@ -1784,7 +1770,6 @@ dwarf2_per_bfd::map_info_sections (struct objfile *objfile)
section.read (objfile);
}
-
/* DWARF quick_symbol_functions support. */
/* TUs can share .debug_line entries, and there can be a lot more TUs than
@@ -1841,13 +1826,13 @@ struct dwarf2_base_index_functions : public quick_symbol_functions
virtual dwarf2_per_cu_data *find_per_cu (dwarf2_per_bfd *per_bfd,
CORE_ADDR adjusted_pc);
- struct compunit_symtab *find_pc_sect_compunit_symtab
- (struct objfile *objfile, struct bound_minimal_symbol msymbol,
- CORE_ADDR pc, struct obj_section *section, int warn_if_readin)
- override final;
+ struct compunit_symtab *find_pc_sect_compunit_symtab (
+ struct objfile *objfile, struct bound_minimal_symbol msymbol, CORE_ADDR pc,
+ struct obj_section *section, int warn_if_readin) override final;
- struct compunit_symtab *find_compunit_symtab_by_address
- (struct objfile *objfile, CORE_ADDR address) override
+ struct compunit_symtab *
+ find_compunit_symtab_by_address (struct objfile *objfile,
+ CORE_ADDR address) override
{
return nullptr;
}
@@ -1864,28 +1849,23 @@ struct dwarf2_base_index_functions : public quick_symbol_functions
struct readnow_functions : public dwarf2_base_index_functions
{
- void dump (struct objfile *objfile) override
- {
- }
+ void dump (struct objfile *objfile) override {}
- void expand_matching_symbols
- (struct objfile *,
- const lookup_name_info &lookup_name,
- domain_enum domain,
- int global,
- symbol_compare_ftype *ordered_compare) override
+ void expand_matching_symbols (struct objfile *,
+ const lookup_name_info &lookup_name,
+ domain_enum domain, int global,
+ symbol_compare_ftype *ordered_compare) override
{
}
- bool expand_symtabs_matching
- (struct objfile *objfile,
- gdb::function_view<expand_symtabs_file_matcher_ftype> file_matcher,
- const lookup_name_info *lookup_name,
- gdb::function_view<expand_symtabs_symbol_matcher_ftype> symbol_matcher,
- gdb::function_view<expand_symtabs_exp_notify_ftype> expansion_notify,
- block_search_flags search_flags,
- domain_enum domain,
- enum search_domain kind) override
+ bool expand_symtabs_matching (
+ struct objfile *objfile,
+ gdb::function_view<expand_symtabs_file_matcher_ftype> file_matcher,
+ const lookup_name_info *lookup_name,
+ gdb::function_view<expand_symtabs_symbol_matcher_ftype> symbol_matcher,
+ gdb::function_view<expand_symtabs_exp_notify_ftype> expansion_notify,
+ block_search_flags search_flags, domain_enum domain,
+ enum search_domain kind) override
{
return true;
}
@@ -1895,44 +1875,36 @@ struct dwarf2_gdb_index : public dwarf2_base_index_functions
{
void dump (struct objfile *objfile) override;
- void expand_matching_symbols
- (struct objfile *,
- const lookup_name_info &lookup_name,
- domain_enum domain,
- int global,
- symbol_compare_ftype *ordered_compare) override;
-
- bool expand_symtabs_matching
- (struct objfile *objfile,
- gdb::function_view<expand_symtabs_file_matcher_ftype> file_matcher,
- const lookup_name_info *lookup_name,
- gdb::function_view<expand_symtabs_symbol_matcher_ftype> symbol_matcher,
- gdb::function_view<expand_symtabs_exp_notify_ftype> expansion_notify,
- block_search_flags search_flags,
- domain_enum domain,
- enum search_domain kind) override;
+ void expand_matching_symbols (
+ struct objfile *, const lookup_name_info &lookup_name, domain_enum domain,
+ int global, symbol_compare_ftype *ordered_compare) override;
+
+ bool expand_symtabs_matching (
+ struct objfile *objfile,
+ gdb::function_view<expand_symtabs_file_matcher_ftype> file_matcher,
+ const lookup_name_info *lookup_name,
+ gdb::function_view<expand_symtabs_symbol_matcher_ftype> symbol_matcher,
+ gdb::function_view<expand_symtabs_exp_notify_ftype> expansion_notify,
+ block_search_flags search_flags, domain_enum domain,
+ enum search_domain kind) override;
};
struct dwarf2_debug_names_index : public dwarf2_base_index_functions
{
void dump (struct objfile *objfile) override;
- void expand_matching_symbols
- (struct objfile *,
- const lookup_name_info &lookup_name,
- domain_enum domain,
- int global,
- symbol_compare_ftype *ordered_compare) override;
-
- bool expand_symtabs_matching
- (struct objfile *objfile,
- gdb::function_view<expand_symtabs_file_matcher_ftype> file_matcher,
- const lookup_name_info *lookup_name,
- gdb::function_view<expand_symtabs_symbol_matcher_ftype> symbol_matcher,
- gdb::function_view<expand_symtabs_exp_notify_ftype> expansion_notify,
- block_search_flags search_flags,
- domain_enum domain,
- enum search_domain kind) override;
+ void expand_matching_symbols (
+ struct objfile *, const lookup_name_info &lookup_name, domain_enum domain,
+ int global, symbol_compare_ftype *ordered_compare) override;
+
+ bool expand_symtabs_matching (
+ struct objfile *objfile,
+ gdb::function_view<expand_symtabs_file_matcher_ftype> file_matcher,
+ const lookup_name_info *lookup_name,
+ gdb::function_view<expand_symtabs_symbol_matcher_ftype> symbol_matcher,
+ gdb::function_view<expand_symtabs_exp_notify_ftype> expansion_notify,
+ block_search_flags search_flags, domain_enum domain,
+ enum search_domain kind) override;
};
quick_symbol_functions_up
@@ -2002,9 +1974,9 @@ eq_file_name_entry (const void *a, const void *b)
static htab_up
create_quick_file_names_table (unsigned int nr_initial_entries)
{
- return htab_up (htab_create_alloc (nr_initial_entries,
- hash_file_name_entry, eq_file_name_entry,
- nullptr, xcalloc, xfree));
+ return htab_up (htab_create_alloc (nr_initial_entries, hash_file_name_entry,
+ eq_file_name_entry, nullptr, xcalloc,
+ xfree));
}
/* Read in CU (dwarf2_cu object) for PER_CU in the context of PER_OBJFILE. This
@@ -2023,7 +1995,7 @@ load_cu (dwarf2_per_cu_data *per_cu, dwarf2_per_objfile *per_objfile,
dwarf2_cu *cu = per_objfile->get_cu (per_cu);
if (cu == nullptr)
- return nullptr; /* Dummy CU. */
+ return nullptr; /* Dummy CU. */
dwarf2_find_base_address (cu->dies, cu);
@@ -2050,9 +2022,7 @@ dw2_do_instantiate_symtab (dwarf2_per_cu_data *per_cu,
/* If we just loaded a CU from a DWO, and we're working with an index
that may badly handle TUs, load all the TUs in that DWO as well.
http://sourceware.org/bugzilla/show_bug.cgi?id=15021 */
- if (!per_cu->is_debug_types
- && cu != NULL
- && cu->dwo_unit != NULL
+ if (!per_cu->is_debug_types && cu != NULL && cu->dwo_unit != NULL
&& per_objfile->per_bfd->index_table != NULL
&& !per_objfile->per_bfd->index_table->version_check ()
/* DWP files aren't supported yet. */
@@ -2075,8 +2045,7 @@ dw2_do_instantiate_symtab (dwarf2_per_cu_data *per_cu,
static struct compunit_symtab *
dw2_instantiate_symtab (dwarf2_per_cu_data *per_cu,
- dwarf2_per_objfile *per_objfile,
- bool skip_partial)
+ dwarf2_per_objfile *per_objfile, bool skip_partial)
{
if (!per_objfile->symtab_set_p (per_cu))
{
@@ -2118,8 +2087,7 @@ dwarf2_per_bfd::allocate_signatured_type (ULONGEST signature)
static dwarf2_per_cu_data_up
create_cu_from_index_list (dwarf2_per_bfd *per_bfd,
- struct dwarf2_section_info *section,
- int is_dwz,
+ struct dwarf2_section_info *section, int is_dwz,
sect_offset sect_off, ULONGEST length)
{
dwarf2_per_cu_data_up the_cu = per_bfd->allocate_per_cu ();
@@ -2134,18 +2102,19 @@ create_cu_from_index_list (dwarf2_per_bfd *per_bfd,
CUs. */
static void
-create_cus_from_index_list (dwarf2_per_bfd *per_bfd,
- const gdb_byte *cu_list, offset_type n_elements,
- struct dwarf2_section_info *section,
- int is_dwz)
+create_cus_from_index_list (dwarf2_per_bfd *per_bfd, const gdb_byte *cu_list,
+ offset_type n_elements,
+ struct dwarf2_section_info *section, int is_dwz)
{
for (offset_type i = 0; i < n_elements; i += 2)
{
gdb_static_assert (sizeof (ULONGEST) >= 8);
sect_offset sect_off
- = (sect_offset) extract_unsigned_integer (cu_list, 8, BFD_ENDIAN_LITTLE);
- ULONGEST length = extract_unsigned_integer (cu_list + 8, 8, BFD_ENDIAN_LITTLE);
+ = (sect_offset) extract_unsigned_integer (cu_list, 8,
+ BFD_ENDIAN_LITTLE);
+ ULONGEST length
+ = extract_unsigned_integer (cu_list + 8, 8, BFD_ENDIAN_LITTLE);
cu_list += 2 * 8;
dwarf2_per_cu_data_up per_cu
@@ -2159,9 +2128,9 @@ create_cus_from_index_list (dwarf2_per_bfd *per_bfd,
the CU objects for PER_BFD. */
static void
-create_cus_from_index (dwarf2_per_bfd *per_bfd,
- const gdb_byte *cu_list, offset_type cu_list_elements,
- const gdb_byte *dwz_list, offset_type dwz_elements)
+create_cus_from_index (dwarf2_per_bfd *per_bfd, const gdb_byte *cu_list,
+ offset_type cu_list_elements, const gdb_byte *dwz_list,
+ offset_type dwz_elements)
{
gdb_assert (per_bfd->all_units.empty ());
per_bfd->all_units.reserve ((cu_list_elements + dwz_elements) / 2);
@@ -2173,16 +2142,16 @@ create_cus_from_index (dwarf2_per_bfd *per_bfd,
return;
dwz_file *dwz = dwarf2_get_dwz_file (per_bfd);
- create_cus_from_index_list (per_bfd, dwz_list, dwz_elements,
- &dwz->info, 1);
+ create_cus_from_index_list (per_bfd, dwz_list, dwz_elements, &dwz->info, 1);
}
/* Create the signatured type hash table from the index. */
static void
-create_signatured_type_table_from_index
- (dwarf2_per_bfd *per_bfd, struct dwarf2_section_info *section,
- const gdb_byte *bytes, offset_type elements)
+create_signatured_type_table_from_index (dwarf2_per_bfd *per_bfd,
+ struct dwarf2_section_info *section,
+ const gdb_byte *bytes,
+ offset_type elements)
{
htab_up sig_types_hash = allocate_signatured_type_table ();
@@ -2219,11 +2188,10 @@ create_signatured_type_table_from_index
/* Create the signatured type hash table from .debug_names. */
static void
-create_signatured_type_table_from_debug_names
- (dwarf2_per_objfile *per_objfile,
- const mapped_debug_names &map,
- struct dwarf2_section_info *section,
- struct dwarf2_section_info *abbrev_section)
+create_signatured_type_table_from_debug_names (
+ dwarf2_per_objfile *per_objfile, const mapped_debug_names &map,
+ struct dwarf2_section_info *section,
+ struct dwarf2_section_info *abbrev_section)
{
struct objfile *objfile = per_objfile->objfile;
@@ -2237,20 +2205,19 @@ create_signatured_type_table_from_debug_names
signatured_type_up sig_type;
void **slot;
- sect_offset sect_off
- = (sect_offset) (extract_unsigned_integer
- (map.tu_table_reordered + i * map.offset_size,
- map.offset_size,
- map.dwarf5_byte_order));
+ sect_offset sect_off = (sect_offset) (extract_unsigned_integer (
+ map.tu_table_reordered + i * map.offset_size, map.offset_size,
+ map.dwarf5_byte_order));
comp_unit_head cu_header;
read_and_check_comp_unit_head (per_objfile, &cu_header, section,
abbrev_section,
- section->buffer + to_underlying (sect_off),
+ section->buffer
+ + to_underlying (sect_off),
rcuh_kind::TYPE);
- sig_type = per_objfile->per_bfd->allocate_signatured_type
- (cu_header.signature);
+ sig_type
+ = per_objfile->per_bfd->allocate_signatured_type (cu_header.signature);
sig_type->type_offset_in_tu = cu_header.type_cu_offset_in_tu;
sig_type->section = section;
sig_type->sect_off = sect_off;
@@ -2296,14 +2263,15 @@ create_addrmap_from_index (dwarf2_per_objfile *per_objfile,
if (lo > hi)
{
- complaint (_(".gdb_index address table has invalid range (%s - %s)"),
- hex_string (lo), hex_string (hi));
+ complaint (
+ _ (".gdb_index address table has invalid range (%s - %s)"),
+ hex_string (lo), hex_string (hi));
continue;
}
if (cu_index >= per_bfd->all_units.size ())
{
- complaint (_(".gdb_index address table has invalid CU number %u"),
+ complaint (_ (".gdb_index address table has invalid CU number %u"),
(unsigned) cu_index);
continue;
}
@@ -2332,8 +2300,7 @@ read_addrmap_from_aranges (dwarf2_per_objfile *per_objfile,
const CORE_ADDR baseaddr = objfile->text_section_offset ();
dwarf2_per_bfd *per_bfd = per_objfile->per_bfd;
- std::unordered_map<sect_offset,
- dwarf2_per_cu_data *,
+ std::unordered_map<sect_offset, dwarf2_per_cu_data *,
gdb::hash_enum<sect_offset>>
debug_info_offset_to_per_cu;
for (const auto &per_cu : per_bfd->all_units)
@@ -2366,8 +2333,8 @@ read_addrmap_from_aranges (dwarf2_per_objfile *per_objfile,
const gdb_byte *const entry_addr = addr;
unsigned int bytes_read;
- const LONGEST entry_length = read_initial_length (abfd, addr,
- &bytes_read);
+ const LONGEST entry_length
+ = read_initial_length (abfd, addr, &bytes_read);
addr += bytes_read;
const gdb_byte *const entry_end = addr + entry_length;
@@ -2375,9 +2342,9 @@ read_addrmap_from_aranges (dwarf2_per_objfile *per_objfile,
const uint8_t offset_size = dwarf5_is_dwarf64 ? 8 : 4;
if (addr + entry_length > section->buffer + section->size)
{
- warning (_("Section .debug_aranges in %s entry at offset %s "
- "length %s exceeds section length %s, "
- "ignoring .debug_aranges."),
+ warning (_ ("Section .debug_aranges in %s entry at offset %s "
+ "length %s exceeds section length %s, "
+ "ignoring .debug_aranges."),
objfile_name (objfile),
plongest (entry_addr - section->buffer),
plongest (bytes_read + entry_length),
@@ -2390,8 +2357,8 @@ read_addrmap_from_aranges (dwarf2_per_objfile *per_objfile,
addr += 2;
if (version != 2)
{
- warning (_("Section .debug_aranges in %s entry at offset %s "
- "has unsupported version %d, ignoring .debug_aranges."),
+ warning (_ ("Section .debug_aranges in %s entry at offset %s "
+ "has unsupported version %d, ignoring .debug_aranges."),
objfile_name (objfile),
plongest (entry_addr - section->buffer), version);
return false;
@@ -2404,9 +2371,9 @@ read_addrmap_from_aranges (dwarf2_per_objfile *per_objfile,
= debug_info_offset_to_per_cu.find (sect_offset (debug_info_offset));
if (per_cu_it == debug_info_offset_to_per_cu.cend ())
{
- warning (_("Section .debug_aranges in %s entry at offset %s "
- "debug_info_offset %s does not exists, "
- "ignoring .debug_aranges."),
+ warning (_ ("Section .debug_aranges in %s entry at offset %s "
+ "debug_info_offset %s does not exists, "
+ "ignoring .debug_aranges."),
objfile_name (objfile),
plongest (entry_addr - section->buffer),
pulongest (debug_info_offset));
@@ -2416,8 +2383,8 @@ read_addrmap_from_aranges (dwarf2_per_objfile *per_objfile,
= debug_info_offset_seen.insert (sect_offset (debug_info_offset));
if (!insertpair.second)
{
- warning (_("Section .debug_aranges in %s has duplicate "
- "debug_info_offset %s, ignoring .debug_aranges."),
+ warning (_ ("Section .debug_aranges in %s has duplicate "
+ "debug_info_offset %s, ignoring .debug_aranges."),
objfile_name (objfile),
sect_offset_str (sect_offset (debug_info_offset)));
return false;
@@ -2427,8 +2394,8 @@ read_addrmap_from_aranges (dwarf2_per_objfile *per_objfile,
const uint8_t address_size = *addr++;
if (address_size < 1 || address_size > 8)
{
- warning (_("Section .debug_aranges in %s entry at offset %s "
- "address_size %u is invalid, ignoring .debug_aranges."),
+ warning (_ ("Section .debug_aranges in %s entry at offset %s "
+ "address_size %u is invalid, ignoring .debug_aranges."),
objfile_name (objfile),
plongest (entry_addr - section->buffer), address_size);
return false;
@@ -2437,9 +2404,9 @@ read_addrmap_from_aranges (dwarf2_per_objfile *per_objfile,
const uint8_t segment_selector_size = *addr++;
if (segment_selector_size != 0)
{
- warning (_("Section .debug_aranges in %s entry at offset %s "
- "segment_selector_size %u is not supported, "
- "ignoring .debug_aranges."),
+ warning (_ ("Section .debug_aranges in %s entry at offset %s "
+ "segment_selector_size %u is not supported, "
+ "ignoring .debug_aranges."),
objfile_name (objfile),
plongest (entry_addr - section->buffer),
segment_selector_size);
@@ -2459,18 +2426,18 @@ read_addrmap_from_aranges (dwarf2_per_objfile *per_objfile,
{
if (addr + 2 * address_size > entry_end)
{
- warning (_("Section .debug_aranges in %s entry at offset %s "
- "address list is not properly terminated, "
- "ignoring .debug_aranges."),
+ warning (_ ("Section .debug_aranges in %s entry at offset %s "
+ "address list is not properly terminated, "
+ "ignoring .debug_aranges."),
objfile_name (objfile),
plongest (entry_addr - section->buffer));
return false;
}
- ULONGEST start = extract_unsigned_integer (addr, address_size,
- dwarf5_byte_order);
+ ULONGEST start
+ = extract_unsigned_integer (addr, address_size, dwarf5_byte_order);
addr += address_size;
- ULONGEST length = extract_unsigned_integer (addr, address_size,
- dwarf5_byte_order);
+ ULONGEST length
+ = extract_unsigned_integer (addr, address_size, dwarf5_byte_order);
addr += address_size;
if (start == 0 && length == 0)
{
@@ -2512,9 +2479,8 @@ create_addrmap_from_aranges (dwarf2_per_objfile *per_objfile,
addrmap_mutable mutable_map;
if (read_addrmap_from_aranges (per_objfile, section, &mutable_map))
- per_bfd->index_addrmap
- = new (&per_bfd->obstack) addrmap_fixed (&per_bfd->obstack,
- &mutable_map);
+ per_bfd->index_addrmap = new (&per_bfd->obstack)
+ addrmap_fixed (&per_bfd->obstack, &mutable_map);
}
/* A helper function that reads the .gdb_index from BUFFER and fills
@@ -2529,11 +2495,9 @@ create_addrmap_from_aranges (dwarf2_per_objfile *per_objfile,
Returns true if all went well, false otherwise. */
static bool
-read_gdb_index_from_buffer (const char *filename,
- bool deprecated_ok,
+read_gdb_index_from_buffer (const char *filename, bool deprecated_ok,
gdb::array_view<const gdb_byte> buffer,
- struct mapped_index *map,
- const gdb_byte **cu_list,
+ struct mapped_index *map, const gdb_byte **cu_list,
offset_type *cu_list_elements,
const gdb_byte **types_list,
offset_type *types_list_elements)
@@ -2552,7 +2516,7 @@ read_gdb_index_from_buffer (const char *filename,
static int warning_printed = 0;
if (!warning_printed)
{
- warning (_("Skipping obsolete .gdb_index section in %s."),
+ warning (_ ("Skipping obsolete .gdb_index section in %s."),
filename);
warning_printed = 1;
}
@@ -2571,7 +2535,7 @@ read_gdb_index_from_buffer (const char *filename,
static int warning_printed = 0;
if (!warning_printed)
{
- warning (_("\
+ warning (_ ("\
Skipping deprecated .gdb_index section in %s.\n\
Do \"set use-deprecated-index-sections on\" before the file is read\n\
to use the section anyway."),
@@ -2635,21 +2599,21 @@ static void finalize_all_units (dwarf2_per_bfd *per_bfd);
/* Callback types for dwarf2_read_gdb_index. */
-typedef gdb::function_view
- <gdb::array_view<const gdb_byte>(objfile *, dwarf2_per_bfd *)>
- get_gdb_index_contents_ftype;
-typedef gdb::function_view
- <gdb::array_view<const gdb_byte>(objfile *, dwz_file *)>
- get_gdb_index_contents_dwz_ftype;
+typedef gdb::function_view<gdb::array_view<const gdb_byte> (objfile *,
+ dwarf2_per_bfd *)>
+ get_gdb_index_contents_ftype;
+typedef gdb::function_view<gdb::array_view<const gdb_byte> (objfile *,
+ dwz_file *)>
+ get_gdb_index_contents_dwz_ftype;
/* Read .gdb_index. If everything went ok, initialize the "quick"
elements of all the CUs and return 1. Otherwise, return 0. */
static int
-dwarf2_read_gdb_index
- (dwarf2_per_objfile *per_objfile,
- get_gdb_index_contents_ftype get_gdb_index_contents,
- get_gdb_index_contents_dwz_ftype get_gdb_index_contents_dwz)
+dwarf2_read_gdb_index (
+ dwarf2_per_objfile *per_objfile,
+ get_gdb_index_contents_ftype get_gdb_index_contents,
+ get_gdb_index_contents_dwz_ftype get_gdb_index_contents_dwz)
{
const gdb_byte *cu_list, *types_list, *dwz_list = NULL;
offset_type cu_list_elements, types_list_elements, dwz_list_elements = 0;
@@ -2696,7 +2660,7 @@ dwarf2_read_gdb_index
&dwz_types_ignore,
&dwz_types_elements_ignore))
{
- warning (_("could not read '.gdb_index' section from %s; skipping"),
+ warning (_ ("could not read '.gdb_index' section from %s; skipping"),
bfd_get_filename (dwz->dwz_bfd.get ()));
return 0;
}
@@ -2716,9 +2680,7 @@ dwarf2_read_gdb_index
}
dwarf2_section_info *section
- = (per_bfd->types.size () == 1
- ? &per_bfd->types[0]
- : &per_bfd->info);
+ = (per_bfd->types.size () == 1 ? &per_bfd->types[0] : &per_bfd->info);
create_signatured_type_table_from_index (per_bfd, section, types_list,
types_list_elements);
@@ -2729,8 +2691,8 @@ dwarf2_read_gdb_index
create_addrmap_from_index (per_objfile, map.get ());
per_bfd->index_table = std::move (map);
- per_bfd->quick_file_names_table =
- create_quick_file_names_table (per_bfd->all_units.size ());
+ per_bfd->quick_file_names_table
+ = create_quick_file_names_table (per_bfd->all_units.size ());
return 1;
}
@@ -2749,7 +2711,7 @@ dw2_get_file_names_reader (const struct die_reader_specs *reader,
void **slot;
struct quick_file_names *qfn;
- gdb_assert (! this_cu->is_debug_types);
+ gdb_assert (!this_cu->is_debug_types);
this_cu->files_read = true;
/* Our callers never want to match partial units -- instead they
@@ -2776,8 +2738,9 @@ dw2_get_file_names_reader (const struct die_reader_specs *reader,
If we have we're done. */
find_entry.hash.dwo_unit = cu->dwo_unit;
find_entry.hash.line_sect_off = line_offset;
- slot = htab_find_slot (per_objfile->per_bfd->quick_file_names_table.get (),
- &find_entry, INSERT);
+ slot
+ = htab_find_slot (per_objfile->per_bfd->quick_file_names_table.get (),
+ &find_entry, INSERT);
if (*slot != NULL)
{
lh_cu->file_names = (struct quick_file_names *) *slot;
@@ -2806,8 +2769,8 @@ dw2_get_file_names_reader (const struct die_reader_specs *reader,
for (const auto &entry : lh->file_names ())
{
std::string name_holder;
- const char *include_name =
- compute_include_file_name (lh.get (), entry, fnd, name_holder);
+ const char *include_name
+ = compute_include_file_name (lh.get (), entry, fnd, name_holder);
if (include_name != nullptr)
{
include_name = per_objfile->objfile->intern (include_name);
@@ -2818,9 +2781,8 @@ dw2_get_file_names_reader (const struct die_reader_specs *reader,
qfn->num_file_names = offset + include_names.size ();
qfn->comp_dir = fnd.intern_comp_dir (per_objfile->objfile);
- qfn->file_names =
- XOBNEWVEC (&per_objfile->per_bfd->obstack, const char *,
- qfn->num_file_names);
+ qfn->file_names = XOBNEWVEC (&per_objfile->per_bfd->obstack, const char *,
+ qfn->num_file_names);
if (offset != 0)
qfn->file_names[0] = per_objfile->objfile->intern (fnd.get_name ());
@@ -2841,7 +2803,7 @@ dw2_get_file_names (dwarf2_per_cu_data *this_cu,
dwarf2_per_objfile *per_objfile)
{
/* This should never be called for TUs. */
- gdb_assert (! this_cu->is_debug_types);
+ gdb_assert (!this_cu->is_debug_types);
if (this_cu->files_read)
return this_cu->file_names;
@@ -2886,7 +2848,8 @@ dwarf2_base_index_functions::find_last_source_symtab (struct objfile *objfile)
dwarf2_per_objfile *per_objfile = get_dwarf2_per_objfile (objfile);
dwarf2_per_cu_data *dwarf_cu
= per_objfile->per_bfd->all_units.back ().get ();
- compunit_symtab *cust = dw2_instantiate_symtab (dwarf_cu, per_objfile, false);
+ compunit_symtab *cust
+ = dw2_instantiate_symtab (dwarf_cu, per_objfile, false);
if (cust == NULL)
return NULL;
@@ -2917,8 +2880,8 @@ dwarf2_per_cu_data::free_cached_file_names ()
}
void
-dwarf2_base_index_functions::forget_cached_source_info
- (struct objfile *objfile)
+dwarf2_base_index_functions::forget_cached_source_info (
+ struct objfile *objfile)
{
dwarf2_per_objfile *per_objfile = get_dwarf2_per_objfile (objfile);
@@ -2978,29 +2941,29 @@ dw2_symtab_iter_init (struct dw2_symtab_iterator *iter,
/* Return the next matching CU or NULL if there are no more. */
static struct dwarf2_per_cu_data *
-dw2_symtab_iter_next (struct dw2_symtab_iterator *iter,
- mapped_index &index)
+dw2_symtab_iter_next (struct dw2_symtab_iterator *iter, mapped_index &index)
{
dwarf2_per_objfile *per_objfile = iter->per_objfile;
- for ( ; iter->next < iter->length; ++iter->next)
+ for (; iter->next < iter->length; ++iter->next)
{
offset_type cu_index_and_attrs = iter->vec[iter->next + 1];
offset_type cu_index = GDB_INDEX_CU_VALUE (cu_index_and_attrs);
- gdb_index_symbol_kind symbol_kind =
- GDB_INDEX_SYMBOL_KIND_VALUE (cu_index_and_attrs);
+ gdb_index_symbol_kind symbol_kind
+ = GDB_INDEX_SYMBOL_KIND_VALUE (cu_index_and_attrs);
/* Only check the symbol attributes if they're present.
Indices prior to version 7 don't record them,
and indices >= 7 may elide them for certain symbols
(gold does this). */
- int attrs_valid = (index.version >= 7
- && symbol_kind != GDB_INDEX_SYMBOL_KIND_NONE);
+ int attrs_valid
+ = (index.version >= 7 && symbol_kind != GDB_INDEX_SYMBOL_KIND_NONE);
/* Don't crash on bad data. */
if (cu_index >= per_objfile->per_bfd->all_units.size ())
{
- complaint (_(".gdb_index entry has bad CU index"
- " [in module %s]"), objfile_name (per_objfile->objfile));
+ complaint (_ (".gdb_index entry has bad CU index"
+ " [in module %s]"),
+ objfile_name (per_objfile->objfile));
continue;
}
@@ -3024,8 +2987,7 @@ dw2_symtab_iter_next (struct dw2_symtab_iterator *iter,
}
/* Work around gold/15646. */
- if (!is_static
- && symbol_kind == GDB_INDEX_SYMBOL_KIND_TYPE)
+ if (!is_static && symbol_kind == GDB_INDEX_SYMBOL_KIND_TYPE)
{
if (iter->global_seen)
continue;
@@ -3088,8 +3050,8 @@ dwarf2_base_index_functions::print_stats (struct objfile *objfile,
if (!per_objfile->symtab_set_p (per_cu))
++count;
}
- gdb_printf (_(" Number of read CUs: %d\n"), total - count);
- gdb_printf (_(" Number of unread CUs: %d\n"), count);
+ gdb_printf (_ (" Number of read CUs: %d\n"), total - count);
+ gdb_printf (_ (" Number of unread CUs: %d\n"), count);
}
/* This dumps minimal information about the index.
@@ -3102,8 +3064,8 @@ dwarf2_gdb_index::dump (struct objfile *objfile)
{
dwarf2_per_objfile *per_objfile = get_dwarf2_per_objfile (objfile);
- mapped_index *index = (gdb::checked_static_cast<mapped_index *>
- (per_objfile->per_bfd->index_table.get ()));
+ mapped_index *index = (gdb::checked_static_cast<mapped_index *> (
+ per_objfile->per_bfd->index_table.get ()));
gdb_printf (".gdb_index: version %d\n", index->version);
gdb_printf ("\n");
}
@@ -3127,58 +3089,50 @@ dwarf2_base_index_functions::expand_all_symtabs (struct objfile *objfile)
}
}
-static bool
-dw2_expand_symtabs_matching_symbol
- (mapped_index_base &index,
- const lookup_name_info &lookup_name_in,
- gdb::function_view<expand_symtabs_symbol_matcher_ftype> symbol_matcher,
- gdb::function_view<bool (offset_type)> match_callback,
- dwarf2_per_objfile *per_objfile);
+static bool dw2_expand_symtabs_matching_symbol (
+ mapped_index_base &index, const lookup_name_info &lookup_name_in,
+ gdb::function_view<expand_symtabs_symbol_matcher_ftype> symbol_matcher,
+ gdb::function_view<bool (offset_type)> match_callback,
+ dwarf2_per_objfile *per_objfile);
-static bool
-dw2_expand_symtabs_matching_one
- (dwarf2_per_cu_data *per_cu,
- dwarf2_per_objfile *per_objfile,
- gdb::function_view<expand_symtabs_file_matcher_ftype> file_matcher,
- gdb::function_view<expand_symtabs_exp_notify_ftype> expansion_notify);
+static bool dw2_expand_symtabs_matching_one (
+ dwarf2_per_cu_data *per_cu, dwarf2_per_objfile *per_objfile,
+ gdb::function_view<expand_symtabs_file_matcher_ftype> file_matcher,
+ gdb::function_view<expand_symtabs_exp_notify_ftype> expansion_notify);
void
-dwarf2_gdb_index::expand_matching_symbols
- (struct objfile *objfile,
- const lookup_name_info &name, domain_enum domain,
- int global,
- symbol_compare_ftype *ordered_compare)
+dwarf2_gdb_index::expand_matching_symbols (
+ struct objfile *objfile, const lookup_name_info &name, domain_enum domain,
+ int global, symbol_compare_ftype *ordered_compare)
{
/* Used for Ada. */
dwarf2_per_objfile *per_objfile = get_dwarf2_per_objfile (objfile);
const block_enum block_kind = global ? GLOBAL_BLOCK : STATIC_BLOCK;
- mapped_index &index
- = *(gdb::checked_static_cast<mapped_index *>
- (per_objfile->per_bfd->index_table.get ()));
+ mapped_index &index = *(gdb::checked_static_cast<mapped_index *> (
+ per_objfile->per_bfd->index_table.get ()));
const char *match_name = name.ada ().lookup_name ().c_str ();
- auto matcher = [&] (const char *symname)
- {
+ auto matcher = [&] (const char *symname) {
if (ordered_compare == nullptr)
return true;
return ordered_compare (symname, match_name) == 0;
};
- dw2_expand_symtabs_matching_symbol (index, name, matcher,
- [&] (offset_type namei)
- {
- struct dw2_symtab_iterator iter;
- struct dwarf2_per_cu_data *per_cu;
+ dw2_expand_symtabs_matching_symbol (
+ index, name, matcher,
+ [&] (offset_type namei) {
+ struct dw2_symtab_iterator iter;
+ struct dwarf2_per_cu_data *per_cu;
- dw2_symtab_iter_init (&iter, per_objfile, block_kind, domain, namei,
- index);
- while ((per_cu = dw2_symtab_iter_next (&iter, index)) != NULL)
- dw2_expand_symtabs_matching_one (per_cu, per_objfile, nullptr,
- nullptr);
- return true;
- }, per_objfile);
+ dw2_symtab_iter_init (&iter, per_objfile, block_kind, domain, namei,
+ index);
+ while ((per_cu = dw2_symtab_iter_next (&iter, index)) != NULL)
+ dw2_expand_symtabs_matching_one (per_cu, per_objfile, nullptr, nullptr);
+ return true;
+ },
+ per_objfile);
}
/* Starting from a search name, return the string that finds the upper
@@ -3258,9 +3212,9 @@ make_sort_after_prefix_name (const char *search_name)
std::pair<std::vector<name_component>::const_iterator,
std::vector<name_component>::const_iterator>
-mapped_index_base::find_name_components_bounds
- (const lookup_name_info &lookup_name_without_params, language lang,
- dwarf2_per_objfile *per_objfile) const
+mapped_index_base::find_name_components_bounds (
+ const lookup_name_info &lookup_name_without_params, language lang,
+ dwarf2_per_objfile *per_objfile) const
{
auto *name_cmp
= this->name_components_casing == case_sensitive_on ? strcmp : strcasecmp;
@@ -3270,42 +3224,38 @@ mapped_index_base::find_name_components_bounds
/* Comparison function object for lower_bound that matches against a
given symbol name. */
- auto lookup_compare_lower = [&] (const name_component &elem,
- const char *name)
- {
- const char *elem_qualified = this->symbol_name_at (elem.idx, per_objfile);
- const char *elem_name = elem_qualified + elem.name_offset;
- return name_cmp (elem_name, name) < 0;
- };
+ auto lookup_compare_lower
+ = [&] (const name_component &elem, const char *name) {
+ const char *elem_qualified = this->symbol_name_at (elem.idx, per_objfile);
+ const char *elem_name = elem_qualified + elem.name_offset;
+ return name_cmp (elem_name, name) < 0;
+ };
/* Comparison function object for upper_bound that matches against a
given symbol name. */
- auto lookup_compare_upper = [&] (const char *name,
- const name_component &elem)
- {
- const char *elem_qualified = this->symbol_name_at (elem.idx, per_objfile);
- const char *elem_name = elem_qualified + elem.name_offset;
- return name_cmp (name, elem_name) < 0;
- };
+ auto lookup_compare_upper
+ = [&] (const char *name, const name_component &elem) {
+ const char *elem_qualified = this->symbol_name_at (elem.idx, per_objfile);
+ const char *elem_name = elem_qualified + elem.name_offset;
+ return name_cmp (name, elem_name) < 0;
+ };
auto begin = this->name_components.begin ();
auto end = this->name_components.end ();
/* Find the lower bound. */
- auto lower = [&] ()
- {
- if (lookup_name_without_params.completion_mode () && lang_name[0] == '\0')
- return begin;
- else
- return std::lower_bound (begin, end, lang_name, lookup_compare_lower);
- } ();
+ auto lower = [&] () {
+ if (lookup_name_without_params.completion_mode () && lang_name[0] == '\0')
+ return begin;
+ else
+ return std::lower_bound (begin, end, lang_name, lookup_compare_lower);
+ }();
/* Find the upper bound. */
- auto upper = [&] ()
- {
- if (lookup_name_without_params.completion_mode ())
- {
- /* In completion mode, we want UPPER to point past all
+ auto upper = [&] () {
+ if (lookup_name_without_params.completion_mode ())
+ {
+ /* In completion mode, we want UPPER to point past all
symbols names that have the same prefix. I.e., with
these symbols, and completing "func":
@@ -3316,17 +3266,17 @@ mapped_index_base::find_name_components_bounds
We find the upper bound by looking for the insertion
point of "func"-with-last-character-incremented,
i.e. "fund". */
- std::string after = make_sort_after_prefix_name (lang_name);
- if (after.empty ())
- return end;
- return std::lower_bound (lower, end, after.c_str (),
- lookup_compare_lower);
- }
- else
- return std::upper_bound (lower, end, lang_name, lookup_compare_upper);
- } ();
+ std::string after = make_sort_after_prefix_name (lang_name);
+ if (after.empty ())
+ return end;
+ return std::lower_bound (lower, end, after.c_str (),
+ lookup_compare_lower);
+ }
+ else
+ return std::upper_bound (lower, end, lang_name, lookup_compare_upper);
+ }();
- return {lower, upper};
+ return { lower, upper };
}
/* See declaration. */
@@ -3362,7 +3312,7 @@ mapped_index_base::build_name_components (dwarf2_per_objfile *per_objfile)
current_len += cp_find_first_component (name + current_len))
{
gdb_assert (name[current_len] == ':');
- this->name_components.push_back ({previous_len, idx});
+ this->name_components.push_back ({ previous_len, idx });
/* Skip the '::'. */
current_len += 2;
previous_len = current_len;
@@ -3371,36 +3321,32 @@ mapped_index_base::build_name_components (dwarf2_per_objfile *per_objfile)
else
{
/* Handle the Ada encoded (aka mangled) form here. */
- for (const char *iter = strstr (name, "__");
- iter != nullptr;
+ for (const char *iter = strstr (name, "__"); iter != nullptr;
iter = strstr (iter, "__"))
{
- this->name_components.push_back ({previous_len, idx});
+ this->name_components.push_back ({ previous_len, idx });
iter += 2;
previous_len = iter - name;
}
}
- this->name_components.push_back ({previous_len, idx});
+ this->name_components.push_back ({ previous_len, idx });
}
/* Sort name_components elements by name. */
- auto name_comp_compare = [&] (const name_component &left,
- const name_component &right)
- {
- const char *left_qualified
- = this->symbol_name_at (left.idx, per_objfile);
- const char *right_qualified
- = this->symbol_name_at (right.idx, per_objfile);
+ auto name_comp_compare
+ = [&] (const name_component &left, const name_component &right) {
+ const char *left_qualified = this->symbol_name_at (left.idx, per_objfile);
+ const char *right_qualified
+ = this->symbol_name_at (right.idx, per_objfile);
- const char *left_name = left_qualified + left.name_offset;
- const char *right_name = right_qualified + right.name_offset;
+ const char *left_name = left_qualified + left.name_offset;
+ const char *right_name = right_qualified + right.name_offset;
- return name_cmp (left_name, right_name) < 0;
- };
+ return name_cmp (left_name, right_name) < 0;
+ };
- std::sort (this->name_components.begin (),
- this->name_components.end (),
+ std::sort (this->name_components.begin (), this->name_components.end (),
name_comp_compare);
}
@@ -3412,12 +3358,11 @@ mapped_index_base::build_name_components (dwarf2_per_objfile *per_objfile)
symbol's index in the mapped_index_base symbol table. */
static bool
-dw2_expand_symtabs_matching_symbol
- (mapped_index_base &index,
- const lookup_name_info &lookup_name_in,
- gdb::function_view<expand_symtabs_symbol_matcher_ftype> symbol_matcher,
- gdb::function_view<bool (offset_type)> match_callback,
- dwarf2_per_objfile *per_objfile)
+dw2_expand_symtabs_matching_symbol (
+ mapped_index_base &index, const lookup_name_info &lookup_name_in,
+ gdb::function_view<expand_symtabs_symbol_matcher_ftype> symbol_matcher,
+ gdb::function_view<bool (offset_type)> match_callback,
+ dwarf2_per_objfile *per_objfile)
{
lookup_name_info lookup_name_without_params
= lookup_name_in.make_ignore_params ();
@@ -3459,8 +3404,7 @@ dw2_expand_symtabs_matching_symbol
= lang->get_symbol_name_matcher (lookup_name_without_params);
name_and_matcher key {
- name_matcher,
- lookup_name_without_params.language_lookup_name (lang_e)
+ name_matcher, lookup_name_without_params.language_lookup_name (lang_e)
};
/* Don't insert the same comparison routine more than once.
@@ -3519,7 +3463,10 @@ dw2_expand_symtabs_matching_symbol
#if GDB_SELF_TEST
-namespace selftests { namespace dw2_expand_symtabs_matching {
+namespace selftests
+{
+namespace dw2_expand_symtabs_matching
+{
/* A mock .gdb_index/.debug_names-like name index table, enough to
exercise dw2_expand_symtabs_matching_symbol, which works with the
@@ -3528,21 +3475,20 @@ namespace selftests { namespace dw2_expand_symtabs_matching {
class mock_mapped_index : public mapped_index_base
{
public:
+
mock_mapped_index (gdb::array_view<const char *> symbols)
: m_symbol_table (symbols)
- {}
+ {
+ }
DISABLE_COPY_AND_ASSIGN (mock_mapped_index);
/* Return the number of names in the symbol table. */
- size_t symbol_name_count () const override
- {
- return m_symbol_table.size ();
- }
+ size_t symbol_name_count () const override { return m_symbol_table.size (); }
/* Get the name of the symbol at IDX in the symbol table. */
- const char *symbol_name_at
- (offset_type idx, dwarf2_per_objfile *per_objfile) const override
+ const char *symbol_name_at (offset_type idx,
+ dwarf2_per_objfile *per_objfile) const override
{
return m_symbol_table[idx];
}
@@ -3553,6 +3499,7 @@ public:
}
private:
+
gdb::array_view<const char *> m_symbol_table;
};
@@ -3573,8 +3520,7 @@ string_or_null (const char *str)
indicating the file:line that failed, and returns false. */
static bool
-check_match (const char *file, int line,
- mock_mapped_index &mock_index,
+check_match (const char *file, int line, mock_mapped_index &mock_index,
const char *name, symbol_name_match_type match_type,
bool completion_mode,
std::initializer_list<const char *> expected_list,
@@ -3584,14 +3530,11 @@ check_match (const char *file, int line,
bool matched = true;
- auto mismatch = [&] (const char *expected_str,
- const char *got)
- {
- warning (_("%s:%d: match_type=%s, looking-for=\"%s\", "
- "expected=\"%s\", got=\"%s\"\n"),
+ auto mismatch = [&] (const char *expected_str, const char *got) {
+ warning (_ ("%s:%d: match_type=%s, looking-for=\"%s\", "
+ "expected=\"%s\", got=\"%s\"\n"),
file, line,
- (match_type == symbol_name_match_type::FULL
- ? "FULL" : "WILD"),
+ (match_type == symbol_name_match_type::FULL ? "FULL" : "WILD"),
name, string_or_null (expected_str), string_or_null (got));
matched = false;
};
@@ -3599,10 +3542,9 @@ check_match (const char *file, int line,
auto expected_it = expected_list.begin ();
auto expected_end = expected_list.end ();
- dw2_expand_symtabs_matching_symbol (mock_index, lookup_name,
- nullptr,
- [&] (offset_type idx)
- {
+ dw2_expand_symtabs_matching_symbol (
+ mock_index, lookup_name, nullptr,
+ [&] (offset_type idx) {
const char *matched_name = mock_index.symbol_name_at (idx, per_objfile);
const char *expected_str
= expected_it == expected_end ? NULL : *expected_it++;
@@ -3610,10 +3552,11 @@ check_match (const char *file, int line,
if (expected_str == NULL || strcmp (expected_str, matched_name) != 0)
mismatch (expected_str, matched_name);
return true;
- }, per_objfile);
+ },
+ per_objfile);
const char *expected_str
- = expected_it == expected_end ? NULL : *expected_it++;
+ = expected_it == expected_end ? NULL : *expected_it++;
if (expected_str != NULL)
mismatch (expected_str, NULL);
@@ -3622,32 +3565,22 @@ check_match (const char *file, int line,
/* The symbols added to the mock mapped_index for testing (in
canonical form). */
-static const char *test_symbols[] = {
- "function",
- "std::bar",
- "std::zfunction",
- "std::zfunction2",
- "w1::w2",
- "ns::foo<char*>",
- "ns::foo<int>",
- "ns::foo<long>",
- "ns2::tmpl<int>::foo2",
- "(anonymous namespace)::A::B::C",
-
- /* These are used to check that the increment-last-char in the
+static const char *test_symbols[]
+ = { "function", "std::bar", "std::zfunction", "std::zfunction2", "w1::w2",
+ "ns::foo<char*>", "ns::foo<int>", "ns::foo<long>",
+ "ns2::tmpl<int>::foo2", "(anonymous namespace)::A::B::C",
+
+ /* These are used to check that the increment-last-char in the
matching algorithm for completion doesn't match "t1_fund" when
completing "t1_func". */
- "t1_func",
- "t1_func1",
- "t1_fund",
- "t1_fund1",
+ "t1_func", "t1_func1", "t1_fund", "t1_fund1",
- /* A UTF-8 name with multi-byte sequences to make sure that
+ /* A UTF-8 name with multi-byte sequences to make sure that
cp-name-parser understands this as a single identifier ("função"
is "function" in PT). */
- u8"u8função",
+ u8"u8função",
- /* Test a symbol name that ends with a 0xff character, which is a
+ /* Test a symbol name that ends with a 0xff character, which is a
valid character in non-UTF-8 source character sets (e.g. Latin1
'ÿ'), and we can't rule out compilers allowing it in identifiers.
We test this because the completion algorithm finds the upper
@@ -3655,37 +3588,34 @@ static const char *test_symbols[] = {
"func"-with-last-character-incremented, i.e. "fund", and adding 1
to 0xff should wraparound and carry to the previous character.
See comments in make_sort_after_prefix_name. */
- "yfunc\377",
+ "yfunc\377",
- /* Some more symbols with \377 (0xff). See above. */
- "\377",
- "\377\377123",
+ /* Some more symbols with \377 (0xff). See above. */
+ "\377", "\377\377123",
- /* A name with all sorts of complications. Starts with "z" to make
+/* A name with all sorts of complications. Starts with "z" to make
it easier for the completion tests below. */
-#define Z_SYM_NAME \
- "z::std::tuple<(anonymous namespace)::ui*, std::bar<(anonymous namespace)::ui> >" \
- "::tuple<(anonymous namespace)::ui*, " \
- "std::default_delete<(anonymous namespace)::ui>, void>"
+#define Z_SYM_NAME \
+ "z::std::tuple<(anonymous namespace)::ui*, std::bar<(anonymous " \
+ "namespace)::ui> >" \
+ "::tuple<(anonymous namespace)::ui*, " \
+ "std::default_delete<(anonymous namespace)::ui>, void>"
- Z_SYM_NAME
-};
+ Z_SYM_NAME };
/* Returns true if the mapped_index_base::find_name_component_bounds
method finds EXPECTED_SYMS in INDEX when looking for SEARCH_NAME,
in completion mode. */
static bool
-check_find_bounds_finds (mapped_index_base &index,
- const char *search_name,
+check_find_bounds_finds (mapped_index_base &index, const char *search_name,
gdb::array_view<const char *> expected_syms,
dwarf2_per_objfile *per_objfile)
{
- lookup_name_info lookup_name (search_name,
- symbol_name_match_type::FULL, true);
+ lookup_name_info lookup_name (search_name, symbol_name_match_type::FULL,
+ true);
- auto bounds = index.find_name_components_bounds (lookup_name,
- language_cplus,
+ auto bounds = index.find_name_components_bounds (lookup_name, language_cplus,
per_objfile);
size_t distance = std::distance (bounds.first, bounds.second);
@@ -3721,9 +3651,8 @@ test_mapped_index_find_name_component_bounds ()
"t1_func1",
};
- SELF_CHECK (check_find_bounds_finds
- (mock_index, "t1_func", expected_syms,
- NULL /* per_objfile */));
+ SELF_CHECK (check_find_bounds_finds (mock_index, "t1_func", expected_syms,
+ NULL /* per_objfile */));
}
/* Check that the increment-last-char in the name matching algorithm
@@ -3734,15 +3663,15 @@ test_mapped_index_find_name_component_bounds ()
"\377",
"\377\377123",
};
- SELF_CHECK (check_find_bounds_finds
- (mock_index, "\377", expected_syms1, NULL /* per_objfile */));
+ SELF_CHECK (check_find_bounds_finds (mock_index, "\377", expected_syms1,
+ NULL /* per_objfile */));
static const char *expected_syms2[] = {
"\377\377123",
};
- SELF_CHECK (check_find_bounds_finds
- (mock_index, "\377\377", expected_syms2,
- NULL /* per_objfile */));
+ SELF_CHECK (check_find_bounds_finds (mock_index, "\377\377",
+ expected_syms2,
+ NULL /* per_objfile */));
}
}
@@ -3760,22 +3689,23 @@ test_dw2_expand_symtabs_matching_symbol ()
/* Create the expected symbols list (an initializer_list). Needed
because lists have commas, and we need to pass them to CHECK,
which is a macro. */
-#define EXPECT(...) { __VA_ARGS__ }
+#define EXPECT(...) \
+ { \
+ __VA_ARGS__ \
+ }
/* Wrapper for check_match that passes down the current
__FILE__/__LINE__. */
-#define CHECK_MATCH(NAME, MATCH_TYPE, COMPLETION_MODE, EXPECTED_LIST) \
- any_mismatch |= !check_match (__FILE__, __LINE__, \
- mock_index, \
- NAME, MATCH_TYPE, COMPLETION_MODE, \
- EXPECTED_LIST, NULL)
+#define CHECK_MATCH(NAME, MATCH_TYPE, COMPLETION_MODE, EXPECTED_LIST) \
+ any_mismatch \
+ |= !check_match (__FILE__, __LINE__, mock_index, NAME, MATCH_TYPE, \
+ COMPLETION_MODE, EXPECTED_LIST, NULL)
/* Identity checks. */
for (const char *sym : test_symbols)
{
/* Should be able to match all existing symbols. */
- CHECK_MATCH (sym, symbol_name_match_type::FULL, false,
- EXPECT (sym));
+ CHECK_MATCH (sym, symbol_name_match_type::FULL, false, EXPECT (sym));
/* Should be able to match all existing symbols with
parameters. */
@@ -3831,10 +3761,8 @@ test_dw2_expand_symtabs_matching_symbol ()
/* While "w" is a prefix of both components, the match function
should still only be called once. */
{
- CHECK_MATCH ("w", symbol_name_match_type::FULL, true,
- EXPECT ("w1::w2"));
- CHECK_MATCH ("w", symbol_name_match_type::WILD, true,
- EXPECT ("w1::w2"));
+ CHECK_MATCH ("w", symbol_name_match_type::FULL, true, EXPECT ("w1::w2"));
+ CHECK_MATCH ("w", symbol_name_match_type::WILD, true, EXPECT ("w1::w2"));
}
/* Same, with a "complicated" symbol. */
@@ -3883,7 +3811,7 @@ test_dw2_expand_symtabs_matching_symbol ()
{
static const char expected[] = "ns::foo<char*>";
/* Try both completion and non-completion modes. */
- static const bool completion_mode[2] = {false, true};
+ static const bool completion_mode[2] = { false, true };
for (size_t i = 0; i < 2; i++)
{
CHECK_MATCH ("ns :: foo < char * >", symbol_name_match_type::FULL,
@@ -3891,8 +3819,9 @@ test_dw2_expand_symtabs_matching_symbol ()
CHECK_MATCH ("foo < char * >", symbol_name_match_type::WILD,
completion_mode[i], EXPECT (expected));
- CHECK_MATCH ("ns :: foo < char * > (int)", symbol_name_match_type::FULL,
- completion_mode[i], EXPECT (expected));
+ CHECK_MATCH ("ns :: foo < char * > (int)",
+ symbol_name_match_type::FULL, completion_mode[i],
+ EXPECT (expected));
CHECK_MATCH ("foo < char * > (int)", symbol_name_match_type::WILD,
completion_mode[i], EXPECT (expected));
}
@@ -3905,31 +3834,25 @@ test_dw2_expand_symtabs_matching_symbol ()
symbol_name_match_type::FULL, true, EXPECT (expected));
CHECK_MATCH ("ns :: foo < char * > ( int ) &&",
symbol_name_match_type::FULL, true, EXPECT (expected));
- CHECK_MATCH ("foo < char * > ( int ) const",
- symbol_name_match_type::WILD, true, EXPECT (expected));
- CHECK_MATCH ("foo < char * > ( int ) &&",
- symbol_name_match_type::WILD, true, EXPECT (expected));
+ CHECK_MATCH ("foo < char * > ( int ) const", symbol_name_match_type::WILD,
+ true, EXPECT (expected));
+ CHECK_MATCH ("foo < char * > ( int ) &&", symbol_name_match_type::WILD,
+ true, EXPECT (expected));
}
/* Test lookup names that don't match anything. */
{
- CHECK_MATCH ("bar2", symbol_name_match_type::WILD, false,
- {});
+ CHECK_MATCH ("bar2", symbol_name_match_type::WILD, false, {});
- CHECK_MATCH ("doesntexist", symbol_name_match_type::FULL, false,
- {});
+ CHECK_MATCH ("doesntexist", symbol_name_match_type::FULL, false, {});
}
/* Some wild matching tests, exercising "(anonymous namespace)",
which should not be confused with a parameter list. */
{
static const char *syms[] = {
- "A::B::C",
- "B::C",
- "C",
- "A :: B :: C ( int )",
- "B :: C ( int )",
- "C ( int )",
+ "A::B::C", "B::C", "C", "A :: B :: C ( int )",
+ "B :: C ( int )", "C ( int )",
};
for (const char *s : syms)
@@ -3941,8 +3864,7 @@ test_dw2_expand_symtabs_matching_symbol ()
{
static const char expected[] = "ns2::tmpl<int>::foo2";
- CHECK_MATCH ("tmp", symbol_name_match_type::WILD, true,
- EXPECT (expected));
+ CHECK_MATCH ("tmp", symbol_name_match_type::WILD, true, EXPECT (expected));
CHECK_MATCH ("tmpl<", symbol_name_match_type::WILD, true,
EXPECT (expected));
}
@@ -3960,7 +3882,8 @@ run_test ()
test_dw2_expand_symtabs_matching_symbol ();
}
-}} // namespace selftests::dw2_expand_symtabs_matching
+} // namespace dw2_expand_symtabs_matching
+} // namespace selftests
#endif /* GDB_SELF_TEST */
@@ -3970,11 +3893,10 @@ run_test ()
EXPANSION_NOTIFY on it. */
static bool
-dw2_expand_symtabs_matching_one
- (dwarf2_per_cu_data *per_cu,
- dwarf2_per_objfile *per_objfile,
- gdb::function_view<expand_symtabs_file_matcher_ftype> file_matcher,
- gdb::function_view<expand_symtabs_exp_notify_ftype> expansion_notify)
+dw2_expand_symtabs_matching_one (
+ dwarf2_per_cu_data *per_cu, dwarf2_per_objfile *per_objfile,
+ gdb::function_view<expand_symtabs_file_matcher_ftype> file_matcher,
+ gdb::function_view<expand_symtabs_exp_notify_ftype> expansion_notify)
{
if (file_matcher == NULL || per_cu->mark)
{
@@ -3995,18 +3917,16 @@ dw2_expand_symtabs_matching_one
index of the symbol name that matched. */
static bool
-dw2_expand_marked_cus
- (dwarf2_per_objfile *per_objfile, offset_type idx,
- gdb::function_view<expand_symtabs_file_matcher_ftype> file_matcher,
- gdb::function_view<expand_symtabs_exp_notify_ftype> expansion_notify,
- block_search_flags search_flags,
- search_domain kind)
+dw2_expand_marked_cus (
+ dwarf2_per_objfile *per_objfile, offset_type idx,
+ gdb::function_view<expand_symtabs_file_matcher_ftype> file_matcher,
+ gdb::function_view<expand_symtabs_exp_notify_ftype> expansion_notify,
+ block_search_flags search_flags, search_domain kind)
{
offset_type vec_len, vec_idx;
bool global_seen = false;
- mapped_index &index
- = *(gdb::checked_static_cast<mapped_index *>
- (per_objfile->per_bfd->index_table.get ()));
+ mapped_index &index = *(gdb::checked_static_cast<mapped_index *> (
+ per_objfile->per_bfd->index_table.get ()));
offset_view vec (index.constant_pool.slice (index.symbol_vec_index (idx)));
vec_len = vec[0];
@@ -4015,20 +3935,18 @@ dw2_expand_marked_cus
offset_type cu_index_and_attrs = vec[vec_idx + 1];
/* This value is only valid for index versions >= 7. */
int is_static = GDB_INDEX_SYMBOL_STATIC_VALUE (cu_index_and_attrs);
- gdb_index_symbol_kind symbol_kind =
- GDB_INDEX_SYMBOL_KIND_VALUE (cu_index_and_attrs);
+ gdb_index_symbol_kind symbol_kind
+ = GDB_INDEX_SYMBOL_KIND_VALUE (cu_index_and_attrs);
int cu_index = GDB_INDEX_CU_VALUE (cu_index_and_attrs);
/* Only check the symbol attributes if they're present.
Indices prior to version 7 don't record them,
and indices >= 7 may elide them for certain symbols
(gold does this). */
- int attrs_valid =
- (index.version >= 7
- && symbol_kind != GDB_INDEX_SYMBOL_KIND_NONE);
+ int attrs_valid
+ = (index.version >= 7 && symbol_kind != GDB_INDEX_SYMBOL_KIND_NONE);
/* Work around gold/15646. */
- if (attrs_valid
- && !is_static
+ if (attrs_valid && !is_static
&& symbol_kind == GDB_INDEX_SYMBOL_KIND_TYPE)
{
if (global_seen)
@@ -4077,8 +3995,9 @@ dw2_expand_marked_cus
/* Don't crash on bad data. */
if (cu_index >= per_objfile->per_bfd->all_units.size ())
{
- complaint (_(".gdb_index entry has bad CU index"
- " [in module %s]"), objfile_name (per_objfile->objfile));
+ complaint (_ (".gdb_index entry has bad CU index"
+ " [in module %s]"),
+ objfile_name (per_objfile->objfile));
continue;
}
@@ -4096,19 +4015,19 @@ dw2_expand_marked_cus
that match FILE_MATCHER. */
static void
-dw_expand_symtabs_matching_file_matcher
- (dwarf2_per_objfile *per_objfile,
- gdb::function_view<expand_symtabs_file_matcher_ftype> file_matcher)
+dw_expand_symtabs_matching_file_matcher (
+ dwarf2_per_objfile *per_objfile,
+ gdb::function_view<expand_symtabs_file_matcher_ftype> file_matcher)
{
if (file_matcher == NULL)
return;
htab_up visited_found (htab_create_alloc (10, htab_hash_pointer,
- htab_eq_pointer,
- NULL, xcalloc, xfree));
+ htab_eq_pointer, NULL, xcalloc,
+ xfree));
htab_up visited_not_found (htab_create_alloc (10, htab_hash_pointer,
- htab_eq_pointer,
- NULL, xcalloc, xfree));
+ htab_eq_pointer, NULL, xcalloc,
+ xfree));
/* The rule is CUs specify all the files, including those used by
any TU, so there's no need to scan TUs here. */
@@ -4146,8 +4065,8 @@ dw_expand_symtabs_matching_file_matcher
}
}
- quick_file_names *file_data = dw2_get_file_names (per_cu.get (),
- per_objfile);
+ quick_file_names *file_data
+ = dw2_get_file_names (per_cu.get (), per_objfile);
if (file_data == NULL)
continue;
@@ -4172,8 +4091,7 @@ dw_expand_symtabs_matching_file_matcher
/* Before we invoke realpath, which can get expensive when many
files are involved, do a quick comparison of the basenames. */
if (!basenames_may_differ
- && !file_matcher (lbasename (file_data->file_names[j]),
- true))
+ && !file_matcher (lbasename (file_data->file_names[j]), true))
continue;
this_real_name = dw2_get_real_path (per_objfile, file_data, j);
@@ -4184,24 +4102,21 @@ dw_expand_symtabs_matching_file_matcher
}
}
- void **slot = htab_find_slot (per_cu->mark
- ? visited_found.get ()
- : visited_not_found.get (),
+ void **slot = htab_find_slot (per_cu->mark ? visited_found.get ()
+ : visited_not_found.get (),
file_data, INSERT);
*slot = file_data;
}
}
bool
-dwarf2_gdb_index::expand_symtabs_matching
- (struct objfile *objfile,
- gdb::function_view<expand_symtabs_file_matcher_ftype> file_matcher,
- const lookup_name_info *lookup_name,
- gdb::function_view<expand_symtabs_symbol_matcher_ftype> symbol_matcher,
- gdb::function_view<expand_symtabs_exp_notify_ftype> expansion_notify,
- block_search_flags search_flags,
- domain_enum domain,
- enum search_domain kind)
+dwarf2_gdb_index::expand_symtabs_matching (
+ struct objfile *objfile,
+ gdb::function_view<expand_symtabs_file_matcher_ftype> file_matcher,
+ const lookup_name_info *lookup_name,
+ gdb::function_view<expand_symtabs_symbol_matcher_ftype> symbol_matcher,
+ gdb::function_view<expand_symtabs_exp_notify_ftype> expansion_notify,
+ block_search_flags search_flags, domain_enum domain, enum search_domain kind)
{
dwarf2_per_objfile *per_objfile = get_dwarf2_per_objfile (objfile);
@@ -4211,8 +4126,7 @@ dwarf2_gdb_index::expand_symtabs_matching
gdb_assert (lookup_name != nullptr || symbol_matcher == nullptr);
if (lookup_name == nullptr)
{
- for (dwarf2_per_cu_data *per_cu
- : all_units_range (per_objfile->per_bfd))
+ for (dwarf2_per_cu_data *per_cu : all_units_range (per_objfile->per_bfd))
{
QUIT;
@@ -4224,20 +4138,18 @@ dwarf2_gdb_index::expand_symtabs_matching
return true;
}
- mapped_index &index
- = *(gdb::checked_static_cast<mapped_index *>
- (per_objfile->per_bfd->index_table.get ()));
+ mapped_index &index = *(gdb::checked_static_cast<mapped_index *> (
+ per_objfile->per_bfd->index_table.get ()));
- bool result
- = dw2_expand_symtabs_matching_symbol (index, *lookup_name,
- symbol_matcher,
- [&] (offset_type idx)
- {
- if (!dw2_expand_marked_cus (per_objfile, idx, file_matcher,
- expansion_notify, search_flags, kind))
- return false;
- return true;
- }, per_objfile);
+ bool result = dw2_expand_symtabs_matching_symbol (
+ index, *lookup_name, symbol_matcher,
+ [&] (offset_type idx) {
+ if (!dw2_expand_marked_cus (per_objfile, idx, file_matcher,
+ expansion_notify, search_flags, kind))
+ return false;
+ return true;
+ },
+ per_objfile);
return result;
}
@@ -4282,42 +4194,38 @@ dwarf2_base_index_functions::find_per_cu (dwarf2_per_bfd *per_bfd,
}
struct compunit_symtab *
-dwarf2_base_index_functions::find_pc_sect_compunit_symtab
- (struct objfile *objfile,
- struct bound_minimal_symbol msymbol,
- CORE_ADDR pc,
- struct obj_section *section,
- int warn_if_readin)
+dwarf2_base_index_functions::find_pc_sect_compunit_symtab (
+ struct objfile *objfile, struct bound_minimal_symbol msymbol, CORE_ADDR pc,
+ struct obj_section *section, int warn_if_readin)
{
struct compunit_symtab *result;
dwarf2_per_objfile *per_objfile = get_dwarf2_per_objfile (objfile);
CORE_ADDR baseaddr = objfile->text_section_offset ();
- struct dwarf2_per_cu_data *data = find_per_cu (per_objfile->per_bfd,
- pc - baseaddr);
+ struct dwarf2_per_cu_data *data
+ = find_per_cu (per_objfile->per_bfd, pc - baseaddr);
if (data == nullptr)
return nullptr;
if (warn_if_readin && per_objfile->symtab_set_p (data))
- warning (_("(Internal error: pc %s in read in CU, but not in symtab.)"),
+ warning (_ ("(Internal error: pc %s in read in CU, but not in symtab.)"),
paddress (objfile->arch (), pc));
- result = recursively_find_pc_sect_compunit_symtab
- (dw2_instantiate_symtab (data, per_objfile, false), pc);
+ result = recursively_find_pc_sect_compunit_symtab (
+ dw2_instantiate_symtab (data, per_objfile, false), pc);
if (warn_if_readin && result == nullptr)
- warning (_("(Error: pc %s in address map, but not in symtab.)"),
+ warning (_ ("(Error: pc %s in address map, but not in symtab.)"),
paddress (objfile->arch (), pc));
return result;
}
void
-dwarf2_base_index_functions::map_symbol_filenames
- (struct objfile *objfile,
- gdb::function_view<symbol_filename_ftype> fun,
- bool need_fullname)
+dwarf2_base_index_functions::map_symbol_filenames (
+ struct objfile *objfile, gdb::function_view<symbol_filename_ftype> fun,
+ bool need_fullname)
{
dwarf2_per_objfile *per_objfile = get_dwarf2_per_objfile (objfile);
@@ -4333,16 +4241,14 @@ dwarf2_base_index_functions::map_symbol_filenames
for (const auto &per_cu : per_objfile->per_bfd->all_units)
{
- if (!per_cu->is_debug_types
- && per_objfile->symtab_set_p (per_cu.get ()))
+ if (!per_cu->is_debug_types && per_objfile->symtab_set_p (per_cu.get ()))
{
if (per_cu->file_names != nullptr)
qfn_cache.insert (per_cu->file_names);
}
}
- for (dwarf2_per_cu_data *per_cu
- : all_units_range (per_objfile->per_bfd))
+ for (dwarf2_per_cu_data *per_cu : all_units_range (per_objfile->per_bfd))
{
/* We only need to look at symtabs not already expanded. */
if (per_cu->is_debug_types || per_objfile->symtab_set_p (per_cu))
@@ -4427,8 +4333,7 @@ static const gdb_byte dwarf5_augmentation[] = { 'G', 'D', 'B', 0 };
Returns true if all went well, false otherwise. */
static bool
-read_debug_names_from_section (struct objfile *objfile,
- const char *filename,
+read_debug_names_from_section (struct objfile *objfile, const char *filename,
struct dwarf2_section_info *section,
mapped_debug_names &map)
{
@@ -4457,8 +4362,8 @@ read_debug_names_from_section (struct objfile *objfile,
if (bytes_read + length != section->size)
{
/* There may be multiple per-CU indices. */
- warning (_("Section .debug_names in %s length %s does not match "
- "section length %s, ignoring .debug_names."),
+ warning (_ ("Section .debug_names in %s length %s does not match "
+ "section length %s, ignoring .debug_names."),
filename, plongest (bytes_read + length),
pulongest (section->size));
return false;
@@ -4469,8 +4374,8 @@ read_debug_names_from_section (struct objfile *objfile,
addr += 2;
if (version != 5)
{
- warning (_("Section .debug_names in %s has unsupported version %d, "
- "ignoring .debug_names."),
+ warning (_ ("Section .debug_names in %s has unsupported version %d, "
+ "ignoring .debug_names."),
filename, version);
return false;
}
@@ -4480,8 +4385,8 @@ read_debug_names_from_section (struct objfile *objfile,
addr += 2;
if (padding != 0)
{
- warning (_("Section .debug_names in %s has unsupported padding %d, "
- "ignoring .debug_names."),
+ warning (_ ("Section .debug_names in %s has unsupported padding %d, "
+ "ignoring .debug_names."),
filename, padding);
return false;
}
@@ -4501,9 +4406,10 @@ read_debug_names_from_section (struct objfile *objfile,
addr += 4;
if (foreign_tu_count != 0)
{
- warning (_("Section .debug_names in %s has unsupported %lu foreign TUs, "
- "ignoring .debug_names."),
- filename, static_cast<unsigned long> (foreign_tu_count));
+ warning (
+ _ ("Section .debug_names in %s has unsupported %lu foreign TUs, "
+ "ignoring .debug_names."),
+ filename, static_cast<unsigned long> (foreign_tu_count));
return false;
}
@@ -4525,10 +4431,10 @@ read_debug_names_from_section (struct objfile *objfile,
string. This value is rounded up to a multiple of 4. */
uint32_t augmentation_string_size = read_4_bytes (abfd, addr);
addr += 4;
- map.augmentation_is_gdb = ((augmentation_string_size
- == sizeof (dwarf5_augmentation))
- && memcmp (addr, dwarf5_augmentation,
- sizeof (dwarf5_augmentation)) == 0);
+ map.augmentation_is_gdb
+ = ((augmentation_string_size == sizeof (dwarf5_augmentation))
+ && memcmp (addr, dwarf5_augmentation, sizeof (dwarf5_augmentation))
+ == 0);
augmentation_string_size += (-augmentation_string_size) & 3;
addr += augmentation_string_size;
@@ -4555,7 +4461,8 @@ read_debug_names_from_section (struct objfile *objfile,
const gdb_byte *abbrev_table_start = addr;
for (;;)
{
- const ULONGEST index_num = read_unsigned_leb128 (abfd, addr, &bytes_read);
+ const ULONGEST index_num
+ = read_unsigned_leb128 (abfd, addr, &bytes_read);
addr += bytes_read;
if (index_num == 0)
break;
@@ -4564,8 +4471,8 @@ read_debug_names_from_section (struct objfile *objfile,
= map.abbrev_map.emplace (index_num, mapped_debug_names::index_val ());
if (!insertpair.second)
{
- warning (_("Section .debug_names in %s has duplicate index %s, "
- "ignoring .debug_names."),
+ warning (_ ("Section .debug_names in %s has duplicate index %s, "
+ "ignoring .debug_names."),
filename, pulongest (index_num));
return false;
}
@@ -4582,8 +4489,8 @@ read_debug_names_from_section (struct objfile *objfile,
addr += bytes_read;
if (attr.form == DW_FORM_implicit_const)
{
- attr.implicit_const = read_signed_leb128 (abfd, addr,
- &bytes_read);
+ attr.implicit_const
+ = read_signed_leb128 (abfd, addr, &bytes_read);
addr += bytes_read;
}
if (attr.dw_idx == 0 && attr.form == 0)
@@ -4593,8 +4500,8 @@ read_debug_names_from_section (struct objfile *objfile,
}
if (addr != abbrev_table_start + abbrev_table_size)
{
- warning (_("Section .debug_names in %s has abbreviation_table "
- "of size %s vs. written as %u, ignoring .debug_names."),
+ warning (_ ("Section .debug_names in %s has abbreviation_table "
+ "of size %s vs. written as %u, ignoring .debug_names."),
filename, plongest (addr - abbrev_table_start),
abbrev_table_size);
return false;
@@ -4610,26 +4517,23 @@ read_debug_names_from_section (struct objfile *objfile,
static bool
create_cus_from_debug_names_list (dwarf2_per_bfd *per_bfd,
const mapped_debug_names &map,
- dwarf2_section_info &section,
- bool is_dwz)
+ dwarf2_section_info &section, bool is_dwz)
{
if (!map.augmentation_is_gdb)
{
for (uint32_t i = 0; i < map.cu_count; ++i)
{
- sect_offset sect_off
- = (sect_offset) (extract_unsigned_integer
- (map.cu_table_reordered + i * map.offset_size,
- map.offset_size,
- map.dwarf5_byte_order));
+ sect_offset sect_off = (sect_offset) (extract_unsigned_integer (
+ map.cu_table_reordered + i * map.offset_size, map.offset_size,
+ map.dwarf5_byte_order));
/* We don't know the length of the CU, because the CU list in a
.debug_names index can be incomplete, so we can't use the start
of the next CU as end of this CU. We create the CUs here with
length 0, and in cutu_reader::cutu_reader we'll fill in the
actual length. */
dwarf2_per_cu_data_up per_cu
- = create_cu_from_index_list (per_bfd, &section, is_dwz,
- sect_off, 0);
+ = create_cu_from_index_list (per_bfd, &section, is_dwz, sect_off,
+ 0);
per_bfd->all_units.push_back (std::move (per_cu));
}
return true;
@@ -4641,11 +4545,9 @@ create_cus_from_debug_names_list (dwarf2_per_bfd *per_bfd,
sect_offset sect_off_next;
if (i < map.cu_count)
{
- sect_off_next
- = (sect_offset) (extract_unsigned_integer
- (map.cu_table_reordered + i * map.offset_size,
- map.offset_size,
- map.dwarf5_byte_order));
+ sect_off_next = (sect_offset) (extract_unsigned_integer (
+ map.cu_table_reordered + i * map.offset_size, map.offset_size,
+ map.dwarf5_byte_order));
}
else
sect_off_next = (sect_offset) section.size;
@@ -4653,14 +4555,15 @@ create_cus_from_debug_names_list (dwarf2_per_bfd *per_bfd,
{
if (sect_off_next == sect_off_prev)
{
- warning (_("Section .debug_names has duplicate entry in CU table,"
- " ignoring .debug_names."));
+ warning (
+ _ ("Section .debug_names has duplicate entry in CU table,"
+ " ignoring .debug_names."));
return false;
}
if (sect_off_next < sect_off_prev)
{
- warning (_("Section .debug_names has non-ascending CU table,"
- " ignoring .debug_names."));
+ warning (_ ("Section .debug_names has non-ascending CU table,"
+ " ignoring .debug_names."));
return false;
}
/* Note: we're not using length = sect_off_next - sect_off_prev,
@@ -4724,12 +4627,13 @@ dwarf2_read_debug_names (dwarf2_per_objfile *per_objfile)
dwz_file *dwz = dwarf2_get_dwz_file (per_bfd);
if (dwz != NULL)
{
- if (!read_debug_names_from_section (objfile,
- bfd_get_filename (dwz->dwz_bfd.get ()),
- &dwz->debug_names, dwz_map))
+ if (!read_debug_names_from_section (
+ objfile, bfd_get_filename (dwz->dwz_bfd.get ()), &dwz->debug_names,
+ dwz_map))
{
- warning (_("could not read '.debug_names' section from %s; skipping"),
- bfd_get_filename (dwz->dwz_bfd.get ()));
+ warning (
+ _ ("could not read '.debug_names' section from %s; skipping"),
+ bfd_get_filename (dwz->dwz_bfd.get ()));
return false;
}
}
@@ -4751,12 +4655,11 @@ dwarf2_read_debug_names (dwarf2_per_objfile *per_objfile)
}
dwarf2_section_info *section
- = (per_bfd->types.size () == 1
- ? &per_bfd->types[0]
- : &per_bfd->info);
+ = (per_bfd->types.size () == 1 ? &per_bfd->types[0] : &per_bfd->info);
- create_signatured_type_table_from_debug_names
- (per_objfile, *map, section, &per_bfd->abbrev);
+ create_signatured_type_table_from_debug_names (per_objfile, *map,
+ section,
+ &per_bfd->abbrev);
}
finalize_all_units (per_bfd);
@@ -4764,8 +4667,8 @@ dwarf2_read_debug_names (dwarf2_per_objfile *per_objfile)
create_addrmap_from_aranges (per_objfile, &per_bfd->debug_aranges);
per_bfd->index_table = std::move (map);
- per_bfd->quick_file_names_table =
- create_quick_file_names_table (per_bfd->all_units.size ());
+ per_bfd->quick_file_names_table
+ = create_quick_file_names_table (per_bfd->all_units.size ());
return true;
}
@@ -4776,14 +4679,17 @@ dwarf2_read_debug_names (dwarf2_per_objfile *per_objfile)
class dw2_debug_names_iterator
{
public:
+
dw2_debug_names_iterator (const mapped_debug_names &map,
- block_search_flags block_index,
- domain_enum domain,
+ block_search_flags block_index, domain_enum domain,
const char *name, dwarf2_per_objfile *per_objfile)
- : m_map (map), m_block_index (block_index), m_domain (domain),
+ : m_map (map),
+ m_block_index (block_index),
+ m_domain (domain),
m_addr (find_vec_in_debug_names (map, name, per_objfile)),
m_per_objfile (per_objfile)
- {}
+ {
+ }
dw2_debug_names_iterator (const mapped_debug_names &map,
search_domain search, uint32_t namei,
@@ -4794,33 +4700,38 @@ public:
m_search (search),
m_addr (find_vec_in_debug_names (map, namei, per_objfile)),
m_per_objfile (per_objfile)
- {}
+ {
+ }
dw2_debug_names_iterator (const mapped_debug_names &map,
block_search_flags block_index, domain_enum domain,
uint32_t namei, dwarf2_per_objfile *per_objfile)
- : m_map (map), m_block_index (block_index), m_domain (domain),
+ : m_map (map),
+ m_block_index (block_index),
+ m_domain (domain),
m_addr (find_vec_in_debug_names (map, namei, per_objfile)),
m_per_objfile (per_objfile)
- {}
+ {
+ }
/* Return the next matching CU or NULL if there are no more. */
dwarf2_per_cu_data *next ();
private:
- static const gdb_byte *find_vec_in_debug_names (const mapped_debug_names &map,
- const char *name,
- dwarf2_per_objfile *per_objfile);
- static const gdb_byte *find_vec_in_debug_names (const mapped_debug_names &map,
- uint32_t namei,
- dwarf2_per_objfile *per_objfile);
+
+ static const gdb_byte *
+ find_vec_in_debug_names (const mapped_debug_names &map, const char *name,
+ dwarf2_per_objfile *per_objfile);
+ static const gdb_byte *
+ find_vec_in_debug_names (const mapped_debug_names &map, uint32_t namei,
+ dwarf2_per_objfile *per_objfile);
/* The internalized form of .debug_names. */
const mapped_debug_names &m_map;
/* Restrict the search to these blocks. */
- block_search_flags m_block_index = (SEARCH_GLOBAL_BLOCK
- | SEARCH_STATIC_BLOCK);
+ block_search_flags m_block_index
+ = (SEARCH_GLOBAL_BLOCK | SEARCH_STATIC_BLOCK);
/* The kind of symbol we're looking for. */
const domain_enum m_domain = UNDEF_DOMAIN;
@@ -4834,14 +4745,13 @@ private:
};
const char *
-mapped_debug_names::namei_to_name
- (uint32_t namei, dwarf2_per_objfile *per_objfile) const
+mapped_debug_names::namei_to_name (uint32_t namei,
+ dwarf2_per_objfile *per_objfile) const
{
const ULONGEST namei_string_offs
= extract_unsigned_integer ((name_table_string_offs_reordered
+ namei * offset_size),
- offset_size,
- dwarf5_byte_order);
+ offset_size, dwarf5_byte_order);
return read_indirect_string_at_offset (per_objfile, namei_string_offs);
}
@@ -4850,9 +4760,9 @@ mapped_debug_names::namei_to_name
return NULL. */
const gdb_byte *
-dw2_debug_names_iterator::find_vec_in_debug_names
- (const mapped_debug_names &map, const char *name,
- dwarf2_per_objfile *per_objfile)
+dw2_debug_names_iterator::find_vec_in_debug_names (
+ const mapped_debug_names &map, const char *name,
+ dwarf2_per_objfile *per_objfile)
{
int (*cmp) (const char *, const char *);
@@ -4875,35 +4785,33 @@ dw2_debug_names_iterator::find_vec_in_debug_names
cmp = (case_sensitivity == case_sensitive_on ? strcmp : strcasecmp);
const uint32_t full_hash = dwarf5_djb_hash (name);
- uint32_t namei
- = extract_unsigned_integer (reinterpret_cast<const gdb_byte *>
- (map.bucket_table_reordered
- + (full_hash % map.bucket_count)), 4,
- map.dwarf5_byte_order);
+ uint32_t namei = extract_unsigned_integer (
+ reinterpret_cast<const gdb_byte *> (map.bucket_table_reordered
+ + (full_hash % map.bucket_count)),
+ 4, map.dwarf5_byte_order);
if (namei == 0)
return NULL;
--namei;
if (namei >= map.name_count)
{
- complaint (_("Wrong .debug_names with name index %u but name_count=%u "
- "[in module %s]"),
- namei, map.name_count,
- objfile_name (per_objfile->objfile));
+ complaint (_ ("Wrong .debug_names with name index %u but name_count=%u "
+ "[in module %s]"),
+ namei, map.name_count, objfile_name (per_objfile->objfile));
return NULL;
}
for (;;)
{
- const uint32_t namei_full_hash
- = extract_unsigned_integer (reinterpret_cast<const gdb_byte *>
- (map.hash_table_reordered + namei), 4,
- map.dwarf5_byte_order);
+ const uint32_t namei_full_hash = extract_unsigned_integer (
+ reinterpret_cast<const gdb_byte *> (map.hash_table_reordered + namei),
+ 4, map.dwarf5_byte_order);
if (full_hash % map.bucket_count != namei_full_hash % map.bucket_count)
return NULL;
if (full_hash == namei_full_hash)
{
- const char *const namei_string = map.namei_to_name (namei, per_objfile);
+ const char *const namei_string
+ = map.namei_to_name (namei, per_objfile);
#if 0 /* An expensive sanity check. */
if (namei_full_hash != dwarf5_djb_hash (namei_string))
@@ -4917,10 +4825,10 @@ dw2_debug_names_iterator::find_vec_in_debug_names
if (cmp (namei_string, name) == 0)
{
- const ULONGEST namei_entry_offs
- = extract_unsigned_integer ((map.name_table_entry_offs_reordered
- + namei * map.offset_size),
- map.offset_size, map.dwarf5_byte_order);
+ const ULONGEST namei_entry_offs = extract_unsigned_integer (
+ (map.name_table_entry_offs_reordered
+ + namei * map.offset_size),
+ map.offset_size, map.dwarf5_byte_order);
return map.entry_pool + namei_entry_offs;
}
}
@@ -4932,15 +4840,15 @@ dw2_debug_names_iterator::find_vec_in_debug_names
}
const gdb_byte *
-dw2_debug_names_iterator::find_vec_in_debug_names
- (const mapped_debug_names &map, uint32_t namei, dwarf2_per_objfile *per_objfile)
+dw2_debug_names_iterator::find_vec_in_debug_names (
+ const mapped_debug_names &map, uint32_t namei,
+ dwarf2_per_objfile *per_objfile)
{
if (namei >= map.name_count)
{
- complaint (_("Wrong .debug_names with name index %u but name_count=%u "
- "[in module %s]"),
- namei, map.name_count,
- objfile_name (per_objfile->objfile));
+ complaint (_ ("Wrong .debug_names with name index %u but name_count=%u "
+ "[in module %s]"),
+ namei, map.name_count, objfile_name (per_objfile->objfile));
return NULL;
}
@@ -4963,7 +4871,7 @@ dw2_debug_names_iterator::next ()
struct objfile *objfile = m_per_objfile->objfile;
bfd *const abfd = objfile->obfd.get ();
- again:
+again:
unsigned int bytes_read;
const ULONGEST abbrev = read_unsigned_leb128 (abfd, m_addr, &bytes_read);
@@ -4974,17 +4882,19 @@ dw2_debug_names_iterator::next ()
const auto indexval_it = m_map.abbrev_map.find (abbrev);
if (indexval_it == m_map.abbrev_map.cend ())
{
- complaint (_("Wrong .debug_names undefined abbrev code %s "
- "[in module %s]"),
+ complaint (_ ("Wrong .debug_names undefined abbrev code %s "
+ "[in module %s]"),
pulongest (abbrev), objfile_name (objfile));
return NULL;
}
const mapped_debug_names::index_val &indexval = indexval_it->second;
- enum class symbol_linkage {
+ enum class symbol_linkage
+ {
unknown,
static_,
extern_,
- } symbol_linkage_ = symbol_linkage::unknown;
+ } symbol_linkage_
+ = symbol_linkage::unknown;
dwarf2_per_cu_data *per_cu = NULL;
for (const mapped_debug_names::index_val::attr &attr : indexval.attr_vec)
{
@@ -5014,9 +4924,8 @@ dw2_debug_names_iterator::next ()
m_addr += 8;
break;
default:
- complaint (_("Unsupported .debug_names form %s [in module %s]"),
- dwarf_form_name (attr.form),
- objfile_name (objfile));
+ complaint (_ ("Unsupported .debug_names form %s [in module %s]"),
+ dwarf_form_name (attr.form), objfile_name (objfile));
return NULL;
}
switch (attr.dw_idx)
@@ -5026,10 +4935,9 @@ dw2_debug_names_iterator::next ()
/* Don't crash on bad data. */
if (ull >= per_bfd->all_comp_units.size ())
{
- complaint (_(".debug_names entry has bad CU index %s"
- " [in module %s]"),
- pulongest (ull),
- objfile_name (objfile));
+ complaint (_ (".debug_names entry has bad CU index %s"
+ " [in module %s]"),
+ pulongest (ull), objfile_name (objfile));
continue;
}
}
@@ -5039,10 +4947,9 @@ dw2_debug_names_iterator::next ()
/* Don't crash on bad data. */
if (ull >= per_bfd->all_type_units.size ())
{
- complaint (_(".debug_names entry has bad TU index %s"
- " [in module %s]"),
- pulongest (ull),
- objfile_name (objfile));
+ complaint (_ (".debug_names entry has bad TU index %s"
+ " [in module %s]"),
+ pulongest (ull), objfile_name (objfile));
continue;
}
{
@@ -5200,54 +5107,48 @@ dwarf2_debug_names_index::dump (struct objfile *objfile)
}
void
-dwarf2_debug_names_index::expand_matching_symbols
- (struct objfile *objfile,
- const lookup_name_info &name, domain_enum domain,
- int global,
- symbol_compare_ftype *ordered_compare)
+dwarf2_debug_names_index::expand_matching_symbols (
+ struct objfile *objfile, const lookup_name_info &name, domain_enum domain,
+ int global, symbol_compare_ftype *ordered_compare)
{
dwarf2_per_objfile *per_objfile = get_dwarf2_per_objfile (objfile);
- mapped_debug_names &map
- = *(gdb::checked_static_cast<mapped_debug_names *>
- (per_objfile->per_bfd->index_table.get ()));
+ mapped_debug_names &map = *(gdb::checked_static_cast<mapped_debug_names *> (
+ per_objfile->per_bfd->index_table.get ()));
const block_search_flags block_flags
= global ? SEARCH_GLOBAL_BLOCK : SEARCH_STATIC_BLOCK;
const char *match_name = name.ada ().lookup_name ().c_str ();
- auto matcher = [&] (const char *symname)
- {
- if (ordered_compare == nullptr)
- return true;
- return ordered_compare (symname, match_name) == 0;
- };
+ auto matcher = [&] (const char *symname) {
+ if (ordered_compare == nullptr)
+ return true;
+ return ordered_compare (symname, match_name) == 0;
+ };
- dw2_expand_symtabs_matching_symbol (map, name, matcher,
- [&] (offset_type namei)
- {
- /* The name was matched, now expand corresponding CUs that were
+ dw2_expand_symtabs_matching_symbol (
+ map, name, matcher,
+ [&] (offset_type namei) {
+ /* The name was matched, now expand corresponding CUs that were
marked. */
- dw2_debug_names_iterator iter (map, block_flags, domain, namei,
- per_objfile);
+ dw2_debug_names_iterator iter (map, block_flags, domain, namei,
+ per_objfile);
- struct dwarf2_per_cu_data *per_cu;
- while ((per_cu = iter.next ()) != NULL)
- dw2_expand_symtabs_matching_one (per_cu, per_objfile, nullptr,
- nullptr);
- return true;
- }, per_objfile);
+ struct dwarf2_per_cu_data *per_cu;
+ while ((per_cu = iter.next ()) != NULL)
+ dw2_expand_symtabs_matching_one (per_cu, per_objfile, nullptr, nullptr);
+ return true;
+ },
+ per_objfile);
}
bool
-dwarf2_debug_names_index::expand_symtabs_matching
- (struct objfile *objfile,
- gdb::function_view<expand_symtabs_file_matcher_ftype> file_matcher,
- const lookup_name_info *lookup_name,
- gdb::function_view<expand_symtabs_symbol_matcher_ftype> symbol_matcher,
- gdb::function_view<expand_symtabs_exp_notify_ftype> expansion_notify,
- block_search_flags search_flags,
- domain_enum domain,
- enum search_domain kind)
+dwarf2_debug_names_index::expand_symtabs_matching (
+ struct objfile *objfile,
+ gdb::function_view<expand_symtabs_file_matcher_ftype> file_matcher,
+ const lookup_name_info *lookup_name,
+ gdb::function_view<expand_symtabs_symbol_matcher_ftype> symbol_matcher,
+ gdb::function_view<expand_symtabs_exp_notify_ftype> expansion_notify,
+ block_search_flags search_flags, domain_enum domain, enum search_domain kind)
{
dwarf2_per_objfile *per_objfile = get_dwarf2_per_objfile (objfile);
@@ -5257,8 +5158,7 @@ dwarf2_debug_names_index::expand_symtabs_matching
gdb_assert (lookup_name != nullptr || symbol_matcher == nullptr);
if (lookup_name == nullptr)
{
- for (dwarf2_per_cu_data *per_cu
- : all_units_range (per_objfile->per_bfd))
+ for (dwarf2_per_cu_data *per_cu : all_units_range (per_objfile->per_bfd))
{
QUIT;
@@ -5270,27 +5170,24 @@ dwarf2_debug_names_index::expand_symtabs_matching
return true;
}
- mapped_debug_names &map
- = *(gdb::checked_static_cast<mapped_debug_names *>
- (per_objfile->per_bfd->index_table.get ()));
+ mapped_debug_names &map = *(gdb::checked_static_cast<mapped_debug_names *> (
+ per_objfile->per_bfd->index_table.get ()));
- bool result
- = dw2_expand_symtabs_matching_symbol (map, *lookup_name,
- symbol_matcher,
- [&] (offset_type namei)
- {
- /* The name was matched, now expand corresponding CUs that were
+ bool result = dw2_expand_symtabs_matching_symbol (
+ map, *lookup_name, symbol_matcher,
+ [&] (offset_type namei) {
+ /* The name was matched, now expand corresponding CUs that were
marked. */
- dw2_debug_names_iterator iter (map, kind, namei, per_objfile, domain);
+ dw2_debug_names_iterator iter (map, kind, namei, per_objfile, domain);
- struct dwarf2_per_cu_data *per_cu;
- while ((per_cu = iter.next ()) != NULL)
- if (!dw2_expand_symtabs_matching_one (per_cu, per_objfile,
- file_matcher,
- expansion_notify))
- return false;
- return true;
- }, per_objfile);
+ struct dwarf2_per_cu_data *per_cu;
+ while ((per_cu = iter.next ()) != NULL)
+ if (!dw2_expand_symtabs_matching_one (per_cu, per_objfile, file_matcher,
+ expansion_notify))
+ return false;
+ return true;
+ },
+ per_objfile);
return result;
}
@@ -5298,7 +5195,7 @@ dwarf2_debug_names_index::expand_symtabs_matching
/* Get the content of the .gdb_index section of OBJ. SECTION_OWNER should point
to either a dwarf2_per_bfd or dwz_file object. */
-template <typename T>
+template<typename T>
static gdb::array_view<const gdb_byte>
get_gdb_index_contents_from_section (objfile *obj, T *section_owner)
{
@@ -5327,14 +5224,15 @@ get_gdb_index_contents_from_section (objfile *obj, T *section_owner)
DWARF2_OBJ. */
static gdb::array_view<const gdb_byte>
-get_gdb_index_contents_from_cache (objfile *obj, dwarf2_per_bfd *dwarf2_per_bfd)
+get_gdb_index_contents_from_cache (objfile *obj,
+ dwarf2_per_bfd *dwarf2_per_bfd)
{
const bfd_build_id *build_id = build_id_bfd_get (obj->obfd.get ());
if (build_id == nullptr)
return {};
- return global_index_cache.lookup_gdb_index (build_id,
- &dwarf2_per_bfd->index_cache_res);
+ return global_index_cache.lookup_gdb_index (
+ build_id, &dwarf2_per_bfd->index_cache_res);
}
/* Same as the above, but for DWZ. */
@@ -5389,14 +5287,14 @@ dwarf2_initialize_objfile (struct objfile *objfile)
if (dwarf2_read_debug_names (per_objfile))
{
dwarf_read_debug_printf ("found debug names");
- objfile->qf.push_front
- (per_bfd->index_table->make_quick_functions ());
+ objfile->qf.push_front (per_bfd->index_table->make_quick_functions ());
return;
}
- if (dwarf2_read_gdb_index (per_objfile,
- get_gdb_index_contents_from_section<struct dwarf2_per_bfd>,
- get_gdb_index_contents_from_section<dwz_file>))
+ if (dwarf2_read_gdb_index (
+ per_objfile,
+ get_gdb_index_contents_from_section<struct dwarf2_per_bfd>,
+ get_gdb_index_contents_from_section<dwz_file>))
{
dwarf_read_debug_printf ("found gdb index from file");
objfile->qf.push_front (per_bfd->index_table->make_quick_functions ());
@@ -5404,8 +5302,7 @@ dwarf2_initialize_objfile (struct objfile *objfile)
}
/* ... otherwise, try to find the index in the index cache. */
- if (dwarf2_read_gdb_index (per_objfile,
- get_gdb_index_contents_from_cache,
+ if (dwarf2_read_gdb_index (per_objfile, get_gdb_index_contents_from_cache,
get_gdb_index_contents_from_cache_dwz))
{
dwarf_read_debug_printf ("found gdb index from cache");
@@ -5418,8 +5315,6 @@ dwarf2_initialize_objfile (struct objfile *objfile)
objfile->qf.push_front (make_cooked_index_funcs ());
}
-
-
/* Build a partial symbol table. */
static void
@@ -5488,8 +5383,7 @@ get_abbrev_section_for_cu (struct dwarf2_per_cu_data *this_cu)
static sect_offset
read_abbrev_offset (dwarf2_per_objfile *per_objfile,
- struct dwarf2_section_info *section,
- sect_offset sect_off)
+ struct dwarf2_section_info *section, sect_offset sect_off)
{
bfd *abfd = section->get_bfd_owner ();
const gdb_byte *info_ptr;
@@ -5526,8 +5420,10 @@ hash_signatured_type (const void *item)
static int
eq_signatured_type (const void *item_lhs, const void *item_rhs)
{
- const struct signatured_type *lhs = (const struct signatured_type *) item_lhs;
- const struct signatured_type *rhs = (const struct signatured_type *) item_rhs;
+ const struct signatured_type *lhs
+ = (const struct signatured_type *) item_lhs;
+ const struct signatured_type *rhs
+ = (const struct signatured_type *) item_rhs;
return lhs->signature == rhs->signature;
}
@@ -5537,10 +5433,9 @@ eq_signatured_type (const void *item_lhs, const void *item_rhs)
static htab_up
allocate_signatured_type_table ()
{
- return htab_up (htab_create_alloc (41,
- hash_signatured_type,
- eq_signatured_type,
- NULL, xcalloc, xfree));
+ return htab_up (htab_create_alloc (41, hash_signatured_type,
+ eq_signatured_type, NULL, xcalloc,
+ xfree));
}
/* A helper for create_debug_types_hash_table. Read types from SECTION
@@ -5550,8 +5445,8 @@ allocate_signatured_type_table ()
static void
create_debug_type_hash_table (dwarf2_per_objfile *per_objfile,
struct dwo_file *dwo_file,
- dwarf2_section_info *section, htab_up &types_htab,
- rcuh_kind section_kind)
+ dwarf2_section_info *section,
+ htab_up &types_htab, rcuh_kind section_kind)
{
struct objfile *objfile = per_objfile->objfile;
struct dwarf2_section_info *abbrev_section;
@@ -5560,8 +5455,7 @@ create_debug_type_hash_table (dwarf2_per_objfile *per_objfile,
abbrev_section = &dwo_file->sections.abbrev;
- dwarf_read_debug_printf ("Reading %s for %s",
- section->get_name (),
+ dwarf_read_debug_printf ("Reading %s for %s", section->get_name (),
abbrev_section->get_file_name ());
section->read (objfile);
@@ -5602,8 +5496,7 @@ create_debug_type_hash_table (dwarf2_per_objfile *per_objfile,
length = header.get_length_with_initial ();
/* Skip dummy type units. */
- if (ptr >= info_ptr + length
- || peek_abbrev_code (abfd, ptr) == 0
+ if (ptr >= info_ptr + length || peek_abbrev_code (abfd, ptr) == 0
|| (header.unit_type != DW_UT_type
&& header.unit_type != DW_UT_split_type))
{
@@ -5625,8 +5518,8 @@ create_debug_type_hash_table (dwarf2_per_objfile *per_objfile,
slot = htab_find_slot (types_htab.get (), dwo_tu, INSERT);
gdb_assert (slot != NULL);
if (*slot != NULL)
- complaint (_("debug type entry at offset %s is duplicate to"
- " the entry at offset %s, signature %s"),
+ complaint (_ ("debug type entry at offset %s is duplicate to"
+ " the entry at offset %s, signature %s"),
sect_offset_str (sect_off),
sect_offset_str (dwo_tu->sect_off),
hex_string (header.signature));
@@ -5649,10 +5542,9 @@ create_debug_type_hash_table (dwarf2_per_objfile *per_objfile,
Note: This function processes DWO files only, not DWP files. */
static void
-create_debug_types_hash_table (dwarf2_per_objfile *per_objfile,
- struct dwo_file *dwo_file,
- gdb::array_view<dwarf2_section_info> type_sections,
- htab_up &types_htab)
+create_debug_types_hash_table (
+ dwarf2_per_objfile *per_objfile, struct dwo_file *dwo_file,
+ gdb::array_view<dwarf2_section_info> type_sections, htab_up &types_htab)
{
for (dwarf2_section_info &section : type_sections)
create_debug_type_hash_table (per_objfile, dwo_file, &section, types_htab,
@@ -5674,8 +5566,7 @@ add_type_unit (dwarf2_per_objfile *per_objfile, ULONGEST sig, void **slot)
= per_objfile->per_bfd->allocate_signatured_type (sig);
signatured_type *sig_type = sig_type_holder.get ();
- per_objfile->per_bfd->all_units.emplace_back
- (sig_type_holder.release ());
+ per_objfile->per_bfd->all_units.emplace_back (sig_type_holder.release ());
if (slot == NULL)
{
@@ -5699,7 +5590,7 @@ fill_in_sig_entry_from_dwo_entry (dwarf2_per_objfile *per_objfile,
dwarf2_per_bfd *per_bfd = per_objfile->per_bfd;
/* Make sure we're not clobbering something we don't expect to. */
- gdb_assert (! sig_entry->queued);
+ gdb_assert (!sig_entry->queued);
gdb_assert (per_objfile->get_cu (sig_entry) == NULL);
gdb_assert (!per_objfile->symtab_set_p (sig_entry));
gdb_assert (sig_entry->signature == dwo_entry->signature);
@@ -5707,8 +5598,7 @@ fill_in_sig_entry_from_dwo_entry (dwarf2_per_objfile *per_objfile,
|| (to_underlying (sig_entry->type_offset_in_section)
== to_underlying (dwo_entry->type_offset_in_tu)));
gdb_assert (sig_entry->type_unit_group == NULL);
- gdb_assert (sig_entry->dwo_unit == NULL
- || sig_entry->dwo_unit == dwo_entry);
+ gdb_assert (sig_entry->dwo_unit == NULL || sig_entry->dwo_unit == dwo_entry);
sig_entry->section = dwo_entry->section;
sig_entry->sect_off = dwo_entry->sect_off;
@@ -5777,8 +5667,8 @@ lookup_dwo_signatured_type (struct dwarf2_cu *cu, ULONGEST sig)
if (dwo_file->tus == NULL)
return NULL;
find_dwo_entry.signature = sig;
- dwo_entry = (struct dwo_unit *) htab_find (dwo_file->tus.get (),
- &find_dwo_entry);
+ dwo_entry
+ = (struct dwo_unit *) htab_find (dwo_file->tus.get (), &find_dwo_entry);
if (dwo_entry == NULL)
return NULL;
@@ -5860,9 +5750,8 @@ lookup_signatured_type (struct dwarf2_cu *cu, ULONGEST sig)
if (per_objfile->per_bfd->signatured_types == NULL)
return NULL;
signatured_type find_entry (sig);
- return ((struct signatured_type *)
- htab_find (per_objfile->per_bfd->signatured_types.get (),
- &find_entry));
+ return ((struct signatured_type *) htab_find (
+ per_objfile->per_bfd->signatured_types.get (), &find_entry));
}
}
@@ -5871,8 +5760,7 @@ lookup_signatured_type (struct dwarf2_cu *cu, ULONGEST sig)
/* Initialize a die_reader_specs struct from a dwarf2_cu struct. */
static void
-init_cu_die_reader (struct die_reader_specs *reader,
- struct dwarf2_cu *cu,
+init_cu_die_reader (struct die_reader_specs *reader, struct dwarf2_cu *cu,
struct dwarf2_section_info *section,
struct dwo_file *dwo_file,
struct abbrev_table *abbrev_table)
@@ -5907,8 +5795,7 @@ init_cu_die_reader (struct die_reader_specs *reader,
The result is non-zero if a valid (non-dummy) DIE was found. */
static int
-read_cutu_die_from_dwo (dwarf2_cu *cu,
- struct dwo_unit *dwo_unit,
+read_cutu_die_from_dwo (dwarf2_cu *cu, struct dwo_unit *dwo_unit,
struct die_info *stub_comp_unit_die,
const char *stub_comp_dir,
struct die_reader_specs *result_reader,
@@ -5922,7 +5809,7 @@ read_cutu_die_from_dwo (dwarf2_cu *cu,
bfd *abfd;
const gdb_byte *begin_info_ptr, *info_ptr;
struct attribute *comp_dir, *stmt_list, *low_pc, *high_pc, *ranges;
- int i,num_extra_attrs;
+ int i, num_extra_attrs;
struct dwarf2_section_info *dwo_abbrev_section;
struct die_info *comp_unit_die;
@@ -5982,8 +5869,8 @@ read_cutu_die_from_dwo (dwarf2_cu *cu,
dwarf2_section_info *section = dwo_unit->section;
section->read (objfile);
abfd = section->get_bfd_owner ();
- begin_info_ptr = info_ptr = (section->buffer
- + to_underlying (dwo_unit->sect_off));
+ begin_info_ptr = info_ptr
+ = (section->buffer + to_underlying (dwo_unit->sect_off));
dwo_abbrev_section = &dwo_unit->dwo_file->sections.abbrev;
if (per_cu->is_debug_types)
@@ -5996,8 +5883,8 @@ read_cutu_die_from_dwo (dwarf2_cu *cu,
/* This is not an assert because it can be caused by bad debug info. */
if (sig_type->signature != cu->header.signature)
{
- error (_("Dwarf Error: signature mismatch %s vs %s while reading"
- " TU at offset %s [in module %s]"),
+ error (_ ("Dwarf Error: signature mismatch %s vs %s while reading"
+ " TU at offset %s [in module %s]"),
hex_string (sig_type->signature),
hex_string (cu->header.signature),
sect_offset_str (dwo_unit->sect_off),
@@ -6035,11 +5922,8 @@ read_cutu_die_from_dwo (dwarf2_cu *cu,
from the stub. This has the benefit of simplifying the rest of
the code - all the work to maintain the illusion of a single
DW_TAG_{compile,type}_unit DIE is done here. */
- num_extra_attrs = ((stmt_list != NULL)
- + (low_pc != NULL)
- + (high_pc != NULL)
- + (ranges != NULL)
- + (comp_dir != NULL));
+ num_extra_attrs = ((stmt_list != NULL) + (low_pc != NULL) + (high_pc != NULL)
+ + (ranges != NULL) + (comp_dir != NULL));
info_ptr = read_full_die_1 (result_reader, result_comp_unit_die, info_ptr,
num_extra_attrs);
@@ -6060,8 +5944,7 @@ read_cutu_die_from_dwo (dwarf2_cu *cu,
if (dwarf_die_debug)
{
- gdb_printf (gdb_stdlog,
- "Read die from %s@0x%x of %s:\n",
+ gdb_printf (gdb_stdlog, "Read die from %s@0x%x of %s:\n",
section->get_name (),
(unsigned) (begin_info_ptr - section->buffer),
bfd_get_filename (abfd));
@@ -6081,7 +5964,7 @@ read_cutu_die_from_dwo (dwarf2_cu *cu,
the signature is in the DW_AT_GNU_dwo_id attribute. In DWARF 5 and later, the
signature is part of the header. */
static gdb::optional<ULONGEST>
-lookup_dwo_id (struct dwarf2_cu *cu, struct die_info* comp_unit_die)
+lookup_dwo_id (struct dwarf2_cu *cu, struct die_info *comp_unit_die)
{
if (cu->header.version >= 5)
return cu->header.signature;
@@ -6124,8 +6007,8 @@ lookup_dwo_unit (dwarf2_cu *cu, die_info *comp_unit_die, const char *dwo_name)
gdb::optional<ULONGEST> signature = lookup_dwo_id (cu, comp_unit_die);
if (!signature.has_value ())
- error (_("Dwarf Error: missing dwo_id for dwo_name %s"
- " [in module %s]"),
+ error (_ ("Dwarf Error: missing dwo_id for dwo_name %s"
+ " [in module %s]"),
dwo_name, bfd_get_filename (per_cu->per_bfd->obfd));
dwo_unit = lookup_dwo_comp_unit (cu, dwo_name, comp_dir, *signature);
@@ -6175,10 +6058,9 @@ cutu_reader::init_tu_and_read_dwo_dies (dwarf2_per_cu_data *this_cu,
if (read_cutu_die_from_dwo (cu, sig_type->dwo_unit,
NULL /* stub_comp_unit_die */,
- sig_type->dwo_unit->dwo_file->comp_dir,
- this, &info_ptr,
- &comp_unit_die,
- &m_dwo_abbrev_table) == 0)
+ sig_type->dwo_unit->dwo_file->comp_dir, this,
+ &info_ptr, &comp_unit_die, &m_dwo_abbrev_table)
+ == 0)
{
/* Dummy die. */
dummy_p = true;
@@ -6198,8 +6080,7 @@ cutu_reader::init_tu_and_read_dwo_dies (dwarf2_per_cu_data *this_cu,
cutu_reader::cutu_reader (dwarf2_per_cu_data *this_cu,
dwarf2_per_objfile *per_objfile,
struct abbrev_table *abbrev_table,
- dwarf2_cu *existing_cu,
- bool skip_partial,
+ dwarf2_cu *existing_cu, bool skip_partial,
abbrev_cache *cache)
: die_reader_specs {},
m_this_cu (this_cu)
@@ -6234,7 +6115,8 @@ cutu_reader::cutu_reader (dwarf2_per_cu_data *this_cu,
/* This is cheap if the section is already read in. */
section->read (objfile);
- begin_info_ptr = info_ptr = section->buffer + to_underlying (this_cu->sect_off);
+ begin_info_ptr = info_ptr
+ = section->buffer + to_underlying (this_cu->sect_off);
abbrev_section = get_abbrev_section_for_cu (this_cu);
@@ -6293,17 +6175,17 @@ cutu_reader::cutu_reader (dwarf2_per_cu_data *this_cu,
this_cu->set_length (cu->header.get_length_with_initial ());
/* Establish the type offset that can be used to lookup the type. */
- sig_type->type_offset_in_section =
- this_cu->sect_off + to_underlying (sig_type->type_offset_in_tu);
+ sig_type->type_offset_in_section
+ = this_cu->sect_off + to_underlying (sig_type->type_offset_in_tu);
this_cu->set_version (cu->header.version);
}
else
{
- info_ptr = read_and_check_comp_unit_head (per_objfile, &cu->header,
- section, abbrev_section,
- info_ptr,
- rcuh_kind::COMPILE);
+ info_ptr
+ = read_and_check_comp_unit_head (per_objfile, &cu->header, section,
+ abbrev_section, info_ptr,
+ rcuh_kind::COMPILE);
gdb_assert (this_cu->sect_off == cu->header.sect_off);
this_cu->set_length (cu->header.get_length_with_initial ());
@@ -6327,8 +6209,8 @@ cutu_reader::cutu_reader (dwarf2_per_cu_data *this_cu,
else
{
if (cache != nullptr)
- abbrev_table = cache->find (abbrev_section,
- cu->header.abbrev_sect_off);
+ abbrev_table
+ = cache->find (abbrev_section, cu->header.abbrev_sect_off);
if (abbrev_table == nullptr)
{
abbrev_section->read (objfile);
@@ -6364,19 +6246,18 @@ cutu_reader::cutu_reader (dwarf2_per_cu_data *this_cu,
if (comp_unit_die->has_children)
{
- complaint (_("compilation unit with DW_AT_GNU_dwo_name"
- " has children (offset %s) [in module %s]"),
+ complaint (_ ("compilation unit with DW_AT_GNU_dwo_name"
+ " has children (offset %s) [in module %s]"),
sect_offset_str (this_cu->sect_off),
bfd_get_filename (abfd));
}
dwo_unit = lookup_dwo_unit (cu, comp_unit_die, dwo_name);
if (dwo_unit != NULL)
{
- if (read_cutu_die_from_dwo (cu, dwo_unit,
- comp_unit_die, NULL,
- this, &info_ptr,
- &dwo_comp_unit_die,
- &m_dwo_abbrev_table) == 0)
+ if (read_cutu_die_from_dwo (cu, dwo_unit, comp_unit_die, NULL, this,
+ &info_ptr, &dwo_comp_unit_die,
+ &m_dwo_abbrev_table)
+ == 0)
{
/* Dummy die. */
dummy_p = true;
@@ -6445,21 +6326,19 @@ cutu_reader::cutu_reader (dwarf2_per_cu_data *this_cu,
gdb_assert (per_objfile->get_cu (this_cu) == nullptr);
- abbrev_section = (dwo_file != NULL
- ? &dwo_file->sections.abbrev
- : get_abbrev_section_for_cu (this_cu));
+ abbrev_section = (dwo_file != NULL ? &dwo_file->sections.abbrev
+ : get_abbrev_section_for_cu (this_cu));
/* This is cheap if the section is already read in. */
section->read (objfile);
m_new_cu.reset (new dwarf2_cu (this_cu, per_objfile));
- begin_info_ptr = info_ptr = section->buffer + to_underlying (this_cu->sect_off);
- info_ptr = read_and_check_comp_unit_head (per_objfile, &m_new_cu->header,
- section, abbrev_section, info_ptr,
- (this_cu->is_debug_types
- ? rcuh_kind::TYPE
- : rcuh_kind::COMPILE));
+ begin_info_ptr = info_ptr
+ = section->buffer + to_underlying (this_cu->sect_off);
+ info_ptr = read_and_check_comp_unit_head (
+ per_objfile, &m_new_cu->header, section, abbrev_section, info_ptr,
+ (this_cu->is_debug_types ? rcuh_kind::TYPE : rcuh_kind::COMPILE));
if (parent_cu != nullptr)
{
@@ -6485,7 +6364,6 @@ cutu_reader::cutu_reader (dwarf2_per_cu_data *this_cu,
info_ptr = read_full_die (this, &comp_unit_die, info_ptr);
}
-
/* Type Unit Groups.
Type Unit Groups are a way to collapse the set of all TUs (type units) into
@@ -6506,8 +6384,10 @@ hash_type_unit_group (const void *item)
static int
eq_type_unit_group (const void *item_lhs, const void *item_rhs)
{
- const struct type_unit_group *lhs = (const struct type_unit_group *) item_lhs;
- const struct type_unit_group *rhs = (const struct type_unit_group *) item_rhs;
+ const struct type_unit_group *lhs
+ = (const struct type_unit_group *) item_lhs;
+ const struct type_unit_group *rhs
+ = (const struct type_unit_group *) item_rhs;
return eq_stmt_list_entry (&lhs->hash, &rhs->hash);
}
@@ -6517,8 +6397,7 @@ eq_type_unit_group (const void *item_lhs, const void *item_rhs)
static htab_up
allocate_type_unit_groups_table ()
{
- return htab_up (htab_create_alloc (3,
- hash_type_unit_group,
+ return htab_up (htab_create_alloc (3, hash_type_unit_group,
eq_type_unit_group,
htab_delete_entry<type_unit_group>,
xcalloc, xfree));
@@ -6558,7 +6437,8 @@ get_type_unit_group (struct dwarf2_cu *cu, const struct attribute *stmt_list)
struct type_unit_group type_unit_group_for_lookup;
if (per_objfile->per_bfd->type_unit_groups == NULL)
- per_objfile->per_bfd->type_unit_groups = allocate_type_unit_groups_table ();
+ per_objfile->per_bfd->type_unit_groups
+ = allocate_type_unit_groups_table ();
/* Do we need to create a new group, or can we use an existing one? */
@@ -6597,7 +6477,6 @@ get_type_unit_group (struct dwarf2_cu *cu, const struct attribute *stmt_list)
gdb_assert (tu_group != nullptr);
return tu_group;
}
-
/* An instance of this is created when scanning DWARF to create a
cooked index. */
@@ -6607,8 +6486,7 @@ class cooked_index_storage
public:
cooked_index_storage ()
- : m_reader_hash (htab_create_alloc (10, hash_cutu_reader,
- eq_cutu_reader,
+ : m_reader_hash (htab_create_alloc (10, hash_cutu_reader, eq_cutu_reader,
htab_delete_entry<cutu_reader>,
xcalloc, xfree)),
m_index (new cooked_index_shard)
@@ -6618,18 +6496,15 @@ public:
DISABLE_COPY_AND_ASSIGN (cooked_index_storage);
/* Return the current abbrev cache. */
- abbrev_cache *get_abbrev_cache ()
- {
- return &m_abbrev_cache;
- }
+ abbrev_cache *get_abbrev_cache () { return &m_abbrev_cache; }
/* Return the DIE reader corresponding to PER_CU. If no such reader
has been registered, return NULL. */
cutu_reader *get_reader (dwarf2_per_cu_data *per_cu)
{
int index = per_cu->index;
- return (cutu_reader *) htab_find_with_hash (m_reader_hash.get (),
- &index, index);
+ return (cutu_reader *) htab_find_with_hash (m_reader_hash.get (), &index,
+ index);
}
/* Preserve READER by storing it in the local hash table. */
@@ -6638,8 +6513,8 @@ public:
m_abbrev_cache.add (reader->release_abbrev_table ());
int index = reader->cu->per_cu->index;
- void **slot = htab_find_slot_with_hash (m_reader_hash.get (), &index,
- index, INSERT);
+ void **slot
+ = htab_find_slot_with_hash (m_reader_hash.get (), &index, index, INSERT);
gdb_assert (*slot == nullptr);
cutu_reader *result = reader.get ();
*slot = reader.release ();
@@ -6649,8 +6524,7 @@ public:
/* Add an entry to the index. The arguments describe the entry; see
cooked-index.h. The new entry is returned. */
const cooked_index_entry *add (sect_offset die_offset, enum dwarf_tag tag,
- cooked_index_flag flags,
- const char *name,
+ cooked_index_flag flags, const char *name,
const cooked_index_entry *parent_entry,
dwarf2_per_cu_data *per_cu)
{
@@ -6666,10 +6540,7 @@ public:
}
/* Return the mutable addrmap that is currently being created. */
- addrmap_mutable *get_addrmap ()
- {
- return &m_addrmap;
- }
+ addrmap_mutable *get_addrmap () { return &m_addrmap; }
private:
@@ -6705,8 +6576,7 @@ class cooked_indexer
{
public:
- cooked_indexer (cooked_index_storage *storage,
- dwarf2_per_cu_data *per_cu,
+ cooked_indexer (cooked_index_storage *storage, dwarf2_per_cu_data *per_cu,
enum language language)
: m_index_storage (storage),
m_per_cu (per_cu),
@@ -6741,8 +6611,7 @@ private:
up just a single DIE. */
cutu_reader *ensure_cu_exists (cutu_reader *reader,
dwarf2_per_objfile *per_objfile,
- sect_offset sect_off,
- bool is_dwz,
+ sect_offset sect_off, bool is_dwz,
bool for_scanning);
/* Index DIEs in the READER starting at INFO_PTR. PARENT_ENTRY is
@@ -6751,25 +6620,20 @@ private:
function scopes must be fully explored in order to find nested
functions. This returns a pointer to just after the spot where
reading stopped. */
- const gdb_byte *index_dies (cutu_reader *reader,
- const gdb_byte *info_ptr,
+ const gdb_byte *index_dies (cutu_reader *reader, const gdb_byte *info_ptr,
const cooked_index_entry *parent_entry,
bool fully);
/* Scan the attributes for a given DIE and update the out
parameters. Returns a pointer to the byte after the DIE. */
- const gdb_byte *scan_attributes (dwarf2_per_cu_data *scanning_per_cu,
- cutu_reader *reader,
- const gdb_byte *watermark_ptr,
- const gdb_byte *info_ptr,
- const abbrev_info *abbrev,
- const char **name,
- const char **linkage_name,
- cooked_index_flag *flags,
- sect_offset *sibling_offset,
- const cooked_index_entry **parent_entry,
- CORE_ADDR *maybe_defer,
- bool for_specification);
+ const gdb_byte *
+ scan_attributes (dwarf2_per_cu_data *scanning_per_cu, cutu_reader *reader,
+ const gdb_byte *watermark_ptr, const gdb_byte *info_ptr,
+ const abbrev_info *abbrev, const char **name,
+ const char **linkage_name, cooked_index_flag *flags,
+ sect_offset *sibling_offset,
+ const cooked_index_entry **parent_entry,
+ CORE_ADDR *maybe_defer, bool for_specification);
/* Handle DW_TAG_imported_unit, by scanning the DIE to find
DW_AT_import, and then scanning the referenced CU. Returns a
@@ -6780,10 +6644,8 @@ private:
/* Recursively read DIEs, recording the section offsets in
m_die_range_map and then calling index_dies. */
- const gdb_byte *recurse (cutu_reader *reader,
- const gdb_byte *info_ptr,
- const cooked_index_entry *parent_entry,
- bool fully);
+ const gdb_byte *recurse (cutu_reader *reader, const gdb_byte *info_ptr,
+ const cooked_index_entry *parent_entry, bool fully);
/* The storage object, where the results are kept. */
cooked_index_storage *m_index_storage;
@@ -6857,8 +6719,7 @@ process_psymtab_comp_unit (dwarf2_per_cu_data *this_cu,
/* Reader function for build_type_psymtabs. */
static void
-build_type_psymtabs_reader (cutu_reader *reader,
- cooked_index_storage *storage)
+build_type_psymtabs_reader (cutu_reader *reader, cooked_index_storage *storage)
{
struct dwarf2_cu *cu = reader->cu;
struct dwarf2_per_cu_data *per_cu = cu->per_cu;
@@ -6866,7 +6727,7 @@ build_type_psymtabs_reader (cutu_reader *reader,
gdb_assert (per_cu->is_debug_types);
- if (! type_unit_die->has_children)
+ if (!type_unit_die->has_children)
return;
prepare_one_comp_unit (cu, type_unit_die, language_minimal);
@@ -6881,11 +6742,13 @@ build_type_psymtabs_reader (cutu_reader *reader,
struct tu_abbrev_offset
{
tu_abbrev_offset (signatured_type *sig_type_, sect_offset abbrev_offset_)
- : sig_type (sig_type_), abbrev_offset (abbrev_offset_)
- {}
+ : sig_type (sig_type_),
+ abbrev_offset (abbrev_offset_)
+ {
+ }
/* This is used when sorting. */
- bool operator< (const tu_abbrev_offset &other) const
+ bool operator<(const tu_abbrev_offset &other) const
{
return abbrev_offset < other.abbrev_offset;
}
@@ -6956,9 +6819,9 @@ build_type_psymtabs (dwarf2_per_objfile *per_objfile,
if (cu->is_debug_types)
{
auto sig_type = static_cast<signatured_type *> (cu.get ());
- sorted_by_abbrev.emplace_back
- (sig_type, read_abbrev_offset (per_objfile, sig_type->section,
- sig_type->sect_off));
+ sorted_by_abbrev.emplace_back (
+ sig_type, read_abbrev_offset (per_objfile, sig_type->section,
+ sig_type->sect_off));
}
}
@@ -6969,18 +6832,17 @@ build_type_psymtabs (dwarf2_per_objfile *per_objfile,
for (const tu_abbrev_offset &tu : sorted_by_abbrev)
{
/* Switch to the next abbrev table if necessary. */
- if (abbrev_table == NULL
- || tu.abbrev_offset != abbrev_offset)
+ if (abbrev_table == NULL || tu.abbrev_offset != abbrev_offset)
{
abbrev_offset = tu.abbrev_offset;
per_objfile->per_bfd->abbrev.read (per_objfile->objfile);
- abbrev_table =
- abbrev_table::read (&per_objfile->per_bfd->abbrev, abbrev_offset);
+ abbrev_table = abbrev_table::read (&per_objfile->per_bfd->abbrev,
+ abbrev_offset);
++tu_stats->nr_uniq_abbrev_tables;
}
- cutu_reader reader (tu.sig_type, per_objfile,
- abbrev_table.get (), nullptr, false);
+ cutu_reader reader (tu.sig_type, per_objfile, abbrev_table.get (),
+ nullptr, false);
if (!reader.dummy_p)
build_type_psymtabs_reader (&reader, storage);
}
@@ -6999,8 +6861,7 @@ print_tu_stats (dwarf2_per_objfile *per_objfile)
tu_stats->nr_uniq_abbrev_tables);
dwarf_read_debug_printf (" %d symtabs from stmt_list entries",
tu_stats->nr_symtabs);
- dwarf_read_debug_printf (" %d symtab sharers",
- tu_stats->nr_symtab_sharers);
+ dwarf_read_debug_printf (" %d symtab sharers", tu_stats->nr_symtab_sharers);
dwarf_read_debug_printf (" %d type units without a stmt_list",
tu_stats->nr_stmt_less_type_units);
dwarf_read_debug_printf (" %d all_type_units reallocs",
@@ -7116,11 +6977,10 @@ dwarf2_build_psymtabs_hard (dwarf2_per_objfile *per_objfile)
using iter_type = decltype (per_bfd->all_units.begin ());
- auto task_size_ = [] (iter_type iter)
- {
- dwarf2_per_cu_data *per_cu = iter->get ();
- return (size_t)per_cu->length ();
- };
+ auto task_size_ = [] (iter_type iter) {
+ dwarf2_per_cu_data *per_cu = iter->get ();
+ return (size_t) per_cu->length ();
+ };
auto task_size = gdb::make_function_view (task_size_);
/* Each thread returns a pair holding a cooked index, and a vector
@@ -7130,28 +6990,26 @@ dwarf2_build_psymtabs_hard (dwarf2_per_objfile *per_objfile)
prompt, which looks weird. */
using result_type = std::pair<std::unique_ptr<cooked_index_shard>,
std::vector<gdb_exception>>;
- std::vector<result_type> results
- = gdb::parallel_for_each (1, per_bfd->all_units.begin (),
- per_bfd->all_units.end (),
- [=] (iter_type iter, iter_type end)
- {
- std::vector<gdb_exception> errors;
- cooked_index_storage thread_storage;
- for (; iter != end; ++iter)
- {
- dwarf2_per_cu_data *per_cu = iter->get ();
- try
- {
- process_psymtab_comp_unit (per_cu, per_objfile,
- &thread_storage);
- }
- catch (gdb_exception &except)
- {
- errors.push_back (std::move (except));
- }
- }
- return result_type (thread_storage.release (), std::move (errors));
- }, task_size);
+ std::vector<result_type> results = gdb::parallel_for_each (
+ 1, per_bfd->all_units.begin (), per_bfd->all_units.end (),
+ [=] (iter_type iter, iter_type end) {
+ std::vector<gdb_exception> errors;
+ cooked_index_storage thread_storage;
+ for (; iter != end; ++iter)
+ {
+ dwarf2_per_cu_data *per_cu = iter->get ();
+ try
+ {
+ process_psymtab_comp_unit (per_cu, per_objfile, &thread_storage);
+ }
+ catch (gdb_exception &except)
+ {
+ errors.push_back (std::move (except));
+ }
+ }
+ return result_type (thread_storage.release (), std::move (errors));
+ },
+ task_size);
/* Only show a given exception a single time. */
std::unordered_set<gdb_exception> seen_exceptions;
@@ -7189,15 +7047,13 @@ static void
read_comp_units_from_section (dwarf2_per_objfile *per_objfile,
struct dwarf2_section_info *section,
struct dwarf2_section_info *abbrev_section,
- unsigned int is_dwz,
- htab_up &types_htab,
+ unsigned int is_dwz, htab_up &types_htab,
rcuh_kind section_kind)
{
const gdb_byte *info_ptr;
struct objfile *objfile = per_objfile->objfile;
- dwarf_read_debug_printf ("Reading %s for %s",
- section->get_name (),
+ dwarf_read_debug_printf ("Reading %s for %s", section->get_name (),
section->get_file_name ());
section->read (objfile);
@@ -7212,8 +7068,7 @@ read_comp_units_from_section (dwarf2_per_objfile *per_objfile,
comp_unit_head cu_header;
read_and_check_comp_unit_head (per_objfile, &cu_header, section,
- abbrev_section, info_ptr,
- section_kind);
+ abbrev_section, info_ptr, section_kind);
/* Save the compilation unit for later lookup. */
if (cu_header.unit_type != DW_UT_type)
@@ -7223,8 +7078,8 @@ read_comp_units_from_section (dwarf2_per_objfile *per_objfile,
if (types_htab == nullptr)
types_htab = allocate_signatured_type_table ();
- auto sig_type = per_objfile->per_bfd->allocate_signatured_type
- (cu_header.signature);
+ auto sig_type = per_objfile->per_bfd->allocate_signatured_type (
+ cu_header.signature);
signatured_type *sig_ptr = sig_type.get ();
sig_type->type_offset_in_tu = cu_header.type_cu_offset_in_tu;
this_cu.reset (sig_type.release ());
@@ -7232,8 +7087,8 @@ read_comp_units_from_section (dwarf2_per_objfile *per_objfile,
void **slot = htab_find_slot (types_htab.get (), sig_ptr, INSERT);
gdb_assert (slot != nullptr);
if (*slot != nullptr)
- complaint (_("debug type entry at offset %s is duplicate to"
- " the entry at offset %s, signature %s"),
+ complaint (_ ("debug type entry at offset %s is duplicate to"
+ " the entry at offset %s, signature %s"),
sect_offset_str (sect_off),
sect_offset_str (sig_ptr->sect_off),
hex_string (sig_ptr->signature));
@@ -7275,12 +7130,12 @@ create_all_units (dwarf2_per_objfile *per_objfile)
gdb_assert (per_objfile->per_bfd->all_units.empty ());
read_comp_units_from_section (per_objfile, &per_objfile->per_bfd->info,
- &per_objfile->per_bfd->abbrev, 0,
- types_htab, rcuh_kind::COMPILE);
+ &per_objfile->per_bfd->abbrev, 0, types_htab,
+ rcuh_kind::COMPILE);
for (dwarf2_section_info &section : per_objfile->per_bfd->types)
read_comp_units_from_section (per_objfile, &section,
- &per_objfile->per_bfd->abbrev, 0,
- types_htab, rcuh_kind::TYPE);
+ &per_objfile->per_bfd->abbrev, 0, types_htab,
+ rcuh_kind::TYPE);
dwz_file *dwz;
try
@@ -7327,8 +7182,8 @@ peek_abbrev_code (bfd *abfd, const gdb_byte *info_ptr)
the initial number. */
static const struct abbrev_info *
-peek_die_abbrev (const die_reader_specs &reader,
- const gdb_byte *info_ptr, unsigned int *bytes_read)
+peek_die_abbrev (const die_reader_specs &reader, const gdb_byte *info_ptr,
+ unsigned int *bytes_read)
{
dwarf2_cu *cu = reader.cu;
bfd *abfd = reader.abfd;
@@ -7342,8 +7197,8 @@ peek_die_abbrev (const die_reader_specs &reader,
= reader.abbrev_table->lookup_abbrev (abbrev_number);
if (!abbrev)
{
- error (_("Dwarf Error: Could not find abbrev number %d in %s"
- " at offset %s [in module %s]"),
+ error (_ ("Dwarf Error: Could not find abbrev number %d in %s"
+ " at offset %s [in module %s]"),
abbrev_number, cu->per_cu->is_debug_types ? "TU" : "CU",
sect_offset_str (cu->header.sect_off), bfd_get_filename (abfd));
}
@@ -7361,8 +7216,8 @@ skip_children (const struct die_reader_specs *reader, const gdb_byte *info_ptr)
while (1)
{
unsigned int bytes_read;
- const abbrev_info *abbrev = peek_die_abbrev (*reader, info_ptr,
- &bytes_read);
+ const abbrev_info *abbrev
+ = peek_die_abbrev (*reader, info_ptr, &bytes_read);
if (abbrev == NULL)
return info_ptr + bytes_read;
@@ -7418,14 +7273,14 @@ skip_one_die (const struct die_reader_specs *reader, const gdb_byte *info_ptr,
{
read_attribute (reader, &attr, &abbrev->attrs[i], info_ptr);
if (attr.form == DW_FORM_ref_addr)
- complaint (_("ignoring absolute DW_AT_sibling"));
+ complaint (_ ("ignoring absolute DW_AT_sibling"));
else
{
sect_offset off = attr.get_ref_die_offset ();
const gdb_byte *sibling_ptr = buffer + to_underlying (off);
if (sibling_ptr < info_ptr)
- complaint (_("DW_AT_sibling points backwards"));
+ complaint (_ ("DW_AT_sibling points backwards"));
else if (sibling_ptr > reader->buffer_end)
reader->die_section->overflow_complaint ();
else
@@ -7524,10 +7379,9 @@ skip_one_die (const struct die_reader_specs *reader, const gdb_byte *info_ptr,
goto skip_attribute;
default:
- error (_("Dwarf Error: Cannot handle %s "
- "in DWARF reader [in module %s]"),
- dwarf_form_name (form),
- bfd_get_filename (abfd));
+ error (_ ("Dwarf Error: Cannot handle %s "
+ "in DWARF reader [in module %s]"),
+ dwarf_form_name (form), bfd_get_filename (abfd));
}
}
@@ -7536,14 +7390,13 @@ skip_one_die (const struct die_reader_specs *reader, const gdb_byte *info_ptr,
else
return info_ptr;
}
-
+
/* Reading in full CUs. */
/* Add PER_CU to the queue. */
static void
-queue_comp_unit (dwarf2_per_cu_data *per_cu,
- dwarf2_per_objfile *per_objfile,
+queue_comp_unit (dwarf2_per_cu_data *per_cu, dwarf2_per_objfile *per_objfile,
enum language pretend_language)
{
per_cu->queued = 1;
@@ -7607,7 +7460,7 @@ maybe_queue_comp_unit (struct dwarf2_cu *dependent_cu,
if (!per_objfile->symtab_set_p (per_cu))
{
/* Add it to the queue. */
- queue_comp_unit (per_cu, per_objfile, pretend_language);
+ queue_comp_unit (per_cu, per_objfile, pretend_language);
queued = true;
}
@@ -7649,8 +7502,8 @@ process_queue (dwarf2_per_objfile *per_objfile)
if (per_cu->is_debug_types)
{
- struct signatured_type *sig_type =
- (struct signatured_type *) per_cu;
+ struct signatured_type *sig_type
+ = (struct signatured_type *) per_cu;
sprintf (buf, "TU %s at offset %s",
hex_string (sig_type->signature),
@@ -7719,12 +7572,10 @@ die_eq (const void *item_lhs, const void *item_rhs)
static void
load_full_comp_unit (dwarf2_per_cu_data *this_cu,
- dwarf2_per_objfile *per_objfile,
- dwarf2_cu *existing_cu,
- bool skip_partial,
- enum language pretend_language)
+ dwarf2_per_objfile *per_objfile, dwarf2_cu *existing_cu,
+ bool skip_partial, enum language pretend_language)
{
- gdb_assert (! this_cu->is_debug_types);
+ gdb_assert (!this_cu->is_debug_types);
cutu_reader reader (this_cu, per_objfile, NULL, existing_cu, skip_partial);
if (reader.dummy_p)
@@ -7734,19 +7585,16 @@ load_full_comp_unit (dwarf2_per_cu_data *this_cu,
const gdb_byte *info_ptr = reader.info_ptr;
gdb_assert (cu->die_hash == NULL);
- cu->die_hash =
- htab_create_alloc_ex (cu->header.get_length_without_initial () / 12,
- die_hash,
- die_eq,
- NULL,
- &cu->comp_unit_obstack,
- hashtab_obstack_allocate,
- dummy_obstack_deallocate);
+ cu->die_hash
+ = htab_create_alloc_ex (cu->header.get_length_without_initial () / 12,
+ die_hash, die_eq, NULL, &cu->comp_unit_obstack,
+ hashtab_obstack_allocate,
+ dummy_obstack_deallocate);
if (reader.comp_unit_die->has_children)
reader.comp_unit_die->child
- = read_die_and_siblings (&reader, reader.info_ptr,
- &info_ptr, reader.comp_unit_die);
+ = read_die_and_siblings (&reader, reader.info_ptr, &info_ptr,
+ reader.comp_unit_die);
cu->dies = reader.comp_unit_die;
/* comp_unit_die is not stored in die_hash, no need. */
@@ -7860,19 +7708,17 @@ fixup_go_packaging (struct dwarf2_cu *cu)
struct pending *list;
int i;
- for (list = *cu->get_builder ()->get_global_symbols ();
- list != NULL;
+ for (list = *cu->get_builder ()->get_global_symbols (); list != NULL;
list = list->next)
{
for (i = 0; i < list->nsyms; ++i)
{
struct symbol *sym = list->symbol[i];
- if (sym->language () == language_go
- && sym->aclass () == LOC_BLOCK)
+ if (sym->language () == language_go && sym->aclass () == LOC_BLOCK)
{
- gdb::unique_xmalloc_ptr<char> this_package_name
- (go_symbol_package_name (sym));
+ gdb::unique_xmalloc_ptr<char> this_package_name (
+ go_symbol_package_name (sym));
if (this_package_name == NULL)
continue;
@@ -7881,13 +7727,15 @@ fixup_go_packaging (struct dwarf2_cu *cu)
else
{
struct objfile *objfile = cu->per_objfile->objfile;
- if (strcmp (package_name.get (), this_package_name.get ()) != 0)
- complaint (_("Symtab %s has objects from two different Go packages: %s and %s"),
- (sym->symtab () != NULL
- ? symtab_to_filename_for_display
- (sym->symtab ())
- : objfile_name (objfile)),
- this_package_name.get (), package_name.get ());
+ if (strcmp (package_name.get (), this_package_name.get ())
+ != 0)
+ complaint (
+ _ ("Symtab %s has objects from two different Go "
+ "packages: %s and %s"),
+ (sym->symtab () != NULL
+ ? symtab_to_filename_for_display (sym->symtab ())
+ : objfile_name (objfile)),
+ this_package_name.get (), package_name.get ());
}
}
}
@@ -7897,8 +7745,8 @@ fixup_go_packaging (struct dwarf2_cu *cu)
{
struct objfile *objfile = cu->per_objfile->objfile;
const char *saved_package_name = objfile->intern (package_name.get ());
- struct type *type = init_type (objfile, TYPE_CODE_MODULE, 0,
- saved_package_name);
+ struct type *type
+ = init_type (objfile, TYPE_CODE_MODULE, 0, saved_package_name);
struct symbol *sym;
sym = new (&objfile->objfile_obstack) symbol;
@@ -7983,11 +7831,12 @@ alloc_rust_variant (struct obstack *obstack, struct type *type,
consequence. */
part->is_unsigned
= (discriminant_index == -1
- ? false
- : type->field (discriminant_index).type ()->is_unsigned ());
+ ? false
+ : type->field (discriminant_index).type ()->is_unsigned ());
part->variants = gdb::array_view<variant> (variants, n_variants);
- void *storage = obstack_alloc (obstack, sizeof (gdb::array_view<variant_part>));
+ void *storage
+ = obstack_alloc (obstack, sizeof (gdb::array_view<variant_part>));
gdb::array_view<variant_part> *prop_value
= new (storage) gdb::array_view<variant_part> (part, 1);
@@ -8041,15 +7890,13 @@ quirk_rust_enum (struct type *type, struct objfile *objfile)
char *tail;
unsigned long index = strtoul (name, &tail, 10);
name = tail;
- if (*name != '$'
- || index >= field_type->num_fields ()
+ if (*name != '$' || index >= field_type->num_fields ()
|| (field_type->field (index).loc_kind ()
!= FIELD_LOC_KIND_BITPOS))
{
- complaint (_("Could not parse Rust enum encoding string \"%s\""
- "[in module %s]"),
- type->field (0).name (),
- objfile_name (objfile));
+ complaint (_ ("Could not parse Rust enum encoding string \"%s\""
+ "[in module %s]"),
+ type->field (0).name (), objfile_name (objfile));
return;
}
++name;
@@ -8064,8 +7911,8 @@ quirk_rust_enum (struct type *type, struct objfile *objfile)
type->set_num_fields (3);
/* Save the field we care about. */
struct field saved_field = type->field (0);
- type->set_fields
- ((struct field *) TYPE_ZALLOC (type, 3 * sizeof (struct field)));
+ type->set_fields ((struct field *)
+ TYPE_ZALLOC (type, 3 * sizeof (struct field)));
/* Put the discriminant at index 0. */
type->field (0).set_type (field_type);
@@ -8076,17 +7923,15 @@ quirk_rust_enum (struct type *type, struct objfile *objfile)
/* The order of fields doesn't really matter, so put the real
field at index 1 and the data-less field at index 2. */
type->field (1) = saved_field;
- type->field (1).set_name
- (rust_last_path_segment (type->field (1).type ()->name ()));
- type->field (1).type ()->set_name
- (rust_fully_qualify (&objfile->objfile_obstack, type->name (),
- type->field (1).name ()));
+ type->field (1).set_name (
+ rust_last_path_segment (type->field (1).type ()->name ()));
+ type->field (1).type ()->set_name (rust_fully_qualify (
+ &objfile->objfile_obstack, type->name (), type->field (1).name ()));
const char *dataless_name
- = rust_fully_qualify (&objfile->objfile_obstack, type->name (),
- name);
- struct type *dataless_type = init_type (objfile, TYPE_CODE_VOID, 0,
- dataless_name);
+ = rust_fully_qualify (&objfile->objfile_obstack, type->name (), name);
+ struct type *dataless_type
+ = init_type (objfile, TYPE_CODE_VOID, 0, dataless_name);
type->field (2).set_type (dataless_type);
/* NAME points into the original discriminant name, which
already has the correct lifetime. */
@@ -8106,12 +7951,10 @@ quirk_rust_enum (struct type *type, struct objfile *objfile)
type->set_code (TYPE_CODE_STRUCT);
struct type *field_type = type->field (0).type ();
- const char *variant_name
- = rust_last_path_segment (field_type->name ());
+ const char *variant_name = rust_last_path_segment (field_type->name ());
type->field (0).set_name (variant_name);
- field_type->set_name
- (rust_fully_qualify (&objfile->objfile_obstack,
- type->name (), variant_name));
+ field_type->set_name (rust_fully_qualify (&objfile->objfile_obstack,
+ type->name (), variant_name));
alloc_rust_variant (&objfile->objfile_obstack, type, -1, 0, {});
}
@@ -8132,8 +7975,8 @@ quirk_rust_enum (struct type *type, struct objfile *objfile)
/* Could be data-less variant, so keep going. */
disr_type = nullptr;
}
- else if (strcmp (disr_type->field (0).name (),
- "RUST$ENUM$DISR") != 0)
+ else if (strcmp (disr_type->field (0).name (), "RUST$ENUM$DISR")
+ != 0)
{
/* Not a Rust enum. */
return;
@@ -8187,9 +8030,9 @@ quirk_rust_enum (struct type *type, struct objfile *objfile)
/* We don't need a range entry for the discriminant, but we do
need one for every other field, as there is no default
variant. */
- discriminant_range *ranges = XOBNEWVEC (&objfile->objfile_obstack,
- discriminant_range,
- n_fields - 1);
+ discriminant_range *ranges
+ = XOBNEWVEC (&objfile->objfile_obstack, discriminant_range,
+ n_fields - 1);
/* Skip the discriminant here. */
for (int i = 1; i < n_fields; ++i)
{
@@ -8218,9 +8061,9 @@ quirk_rust_enum (struct type *type, struct objfile *objfile)
sub_type->set_fields (sub_type->fields () + 1);
}
type->field (i).set_name (variant_name);
- sub_type->set_name
- (rust_fully_qualify (&objfile->objfile_obstack,
- type->name (), variant_name));
+ sub_type->set_name (rust_fully_qualify (&objfile->objfile_obstack,
+ type->name (),
+ variant_name));
}
/* Indicate that this is a variant type. */
@@ -8258,8 +8101,8 @@ dwarf2_per_objfile::get_type_unit_group_unshareable (type_unit_group *tu_group)
}
struct type *
-dwarf2_per_objfile::get_type_for_signatured_type
- (signatured_type *sig_type) const
+dwarf2_per_objfile::get_type_for_signatured_type (
+ signatured_type *sig_type) const
{
auto iter = this->m_type_map.find (sig_type);
if (iter == this->m_type_map.end ())
@@ -8268,8 +8111,9 @@ dwarf2_per_objfile::get_type_for_signatured_type
return iter->second;
}
-void dwarf2_per_objfile::set_type_for_signatured_type
- (signatured_type *sig_type, struct type *type)
+void
+dwarf2_per_objfile::set_type_for_signatured_type (signatured_type *sig_type,
+ struct type *type)
{
gdb_assert (this->m_type_map.find (sig_type) == this->m_type_map.end ());
@@ -8323,9 +8167,8 @@ recursively_compute_inclusions (std::vector<compunit_symtab *> *result,
if (!per_cu->imported_symtabs_empty ())
for (dwarf2_per_cu_data *ptr : *per_cu->imported_symtabs)
{
- recursively_compute_inclusions (result, all_children,
- all_type_symtabs, ptr, per_objfile,
- cust);
+ recursively_compute_inclusions (result, all_children, all_type_symtabs,
+ ptr, per_objfile, cust);
}
}
@@ -8336,7 +8179,7 @@ static void
compute_compunit_symtab_includes (dwarf2_per_cu_data *per_cu,
dwarf2_per_objfile *per_objfile)
{
- gdb_assert (! per_cu->is_debug_types);
+ gdb_assert (!per_cu->is_debug_types);
if (!per_cu->imported_symtabs_empty ())
{
@@ -8349,11 +8192,11 @@ compute_compunit_symtab_includes (dwarf2_per_cu_data *per_cu,
return;
htab_up all_children (htab_create_alloc (1, htab_hash_pointer,
- htab_eq_pointer,
- NULL, xcalloc, xfree));
+ htab_eq_pointer, NULL, xcalloc,
+ xfree));
htab_up all_type_symtabs (htab_create_alloc (1, htab_hash_pointer,
- htab_eq_pointer,
- NULL, xcalloc, xfree));
+ htab_eq_pointer, NULL,
+ xcalloc, xfree));
for (dwarf2_per_cu_data *ptr : *per_cu->imported_symtabs)
{
@@ -8364,9 +8207,8 @@ compute_compunit_symtab_includes (dwarf2_per_cu_data *per_cu,
/* Now we have a transitive closure of all the included symtabs. */
len = result_symtabs.size ();
- cust->includes
- = XOBNEWVEC (&per_objfile->objfile->objfile_obstack,
- struct compunit_symtab *, len + 1);
+ cust->includes = XOBNEWVEC (&per_objfile->objfile->objfile_obstack,
+ struct compunit_symtab *, len + 1);
memcpy (cust->includes, result_symtabs.data (),
len * sizeof (compunit_symtab *));
cust->includes[len] = NULL;
@@ -8381,7 +8223,7 @@ process_cu_includes (dwarf2_per_objfile *per_objfile)
{
for (dwarf2_per_cu_data *iter : per_objfile->per_bfd->just_read_cus)
{
- if (! iter->is_debug_types)
+ if (!iter->is_debug_types)
compute_compunit_symtab_includes (iter, per_objfile);
}
@@ -8419,10 +8261,10 @@ process_full_comp_unit (dwarf2_cu *cu, enum language pretend_language)
case DW_TAG_type_unit:
break;
default:
- error (_("Dwarf Error: unexpected tag '%s' at offset %s [in module %s]"),
- dwarf_tag_name (cu->dies->tag),
- sect_offset_str (cu->per_cu->sect_off),
- objfile_name (per_objfile->objfile));
+ error (
+ _ ("Dwarf Error: unexpected tag '%s' at offset %s [in module %s]"),
+ dwarf_tag_name (cu->dies->tag), sect_offset_str (cu->per_cu->sect_off),
+ objfile_name (per_objfile->objfile));
}
/* Do line number decoding in read_file_scope () */
@@ -8456,8 +8298,9 @@ process_full_comp_unit (dwarf2_cu *cu, enum language pretend_language)
this comp unit. */
dwarf2_record_block_ranges (cu->dies, static_block, baseaddr, cu);
- cust = cu->get_builder ()->end_compunit_symtab_from_static_block
- (static_block, 0);
+ cust
+ = cu->get_builder ()->end_compunit_symtab_from_static_block (static_block,
+ 0);
if (cust != NULL)
{
@@ -8504,8 +8347,7 @@ process_full_comp_unit (dwarf2_cu *cu, enum language pretend_language)
already been loaded into memory. */
static void
-process_full_type_unit (dwarf2_cu *cu,
- enum language pretend_language)
+process_full_type_unit (dwarf2_cu *cu, enum language pretend_language)
{
dwarf2_per_objfile *per_objfile = cu->per_objfile;
struct compunit_symtab *cust;
@@ -8536,8 +8378,8 @@ process_full_type_unit (dwarf2_cu *cu,
If this is the first TU to use this symtab, complete the construction
of it with end_expandable_symtab. Otherwise, complete the addition of
this TU's symbols to the existing symtab. */
- type_unit_group_unshareable *tug_unshare =
- per_objfile->get_type_unit_group_unshareable (sig_type->type_unit_group);
+ type_unit_group_unshareable *tug_unshare
+ = per_objfile->get_type_unit_group_unshareable (sig_type->type_unit_group);
if (tug_unshare->compunit_symtab == NULL)
{
buildsym_compunit *builder = cu->get_builder ();
@@ -8577,8 +8419,8 @@ process_imported_unit_die (struct die_info *die, struct dwarf2_cu *cu)
/* For now we don't handle imported units in type units. */
if (cu->per_cu->is_debug_types)
{
- error (_("Dwarf Error: DW_TAG_imported_unit is not"
- " supported in type units [in module %s]"),
+ error (_ ("Dwarf Error: DW_TAG_imported_unit is not"
+ " supported in type units [in module %s]"),
objfile_name (cu->per_objfile->objfile));
}
@@ -8602,8 +8444,7 @@ process_imported_unit_die (struct die_info *die, struct dwarf2_cu *cu)
return;
/* If necessary, add it to the queue and load its DIEs. */
- if (maybe_queue_comp_unit (cu, per_cu, per_objfile,
- cu->lang ()))
+ if (maybe_queue_comp_unit (cu, per_cu, per_objfile, cu->lang ()))
load_full_comp_unit (per_cu, per_objfile, per_objfile->get_cu (per_cu),
false, cu->lang ());
@@ -8616,8 +8457,10 @@ process_imported_unit_die (struct die_info *die, struct dwarf2_cu *cu)
class process_die_scope
{
public:
+
process_die_scope (die_info *die, dwarf2_cu *cu)
- : m_die (die), m_cu (cu)
+ : m_die (die),
+ m_cu (cu)
{
/* We should only be processing DIEs not already in process. */
gdb_assert (!m_die->in_process);
@@ -8639,6 +8482,7 @@ public:
}
private:
+
die_info *m_die;
dwarf2_cu *m_cu;
};
@@ -8663,8 +8507,7 @@ process_die (struct die_info *die, struct dwarf2_cu *cu)
break;
case DW_TAG_subprogram:
/* Nested subprograms in Fortran get a prefix. */
- if (cu->lang () == language_fortran
- && die->parent != NULL
+ if (cu->lang () == language_fortran && die->parent != NULL
&& die->parent->tag == DW_TAG_subprogram)
cu->processing_has_namespace_info = true;
/* Fall through. */
@@ -8740,9 +8583,10 @@ process_die (struct die_info *die, struct dwarf2_cu *cu)
/* Fall through. */
case DW_TAG_imported_module:
cu->processing_has_namespace_info = true;
- if (die->child != NULL && (die->tag == DW_TAG_imported_declaration
- || cu->lang () != language_fortran))
- complaint (_("Tag '%s' has unexpected children"),
+ if (die->child != NULL
+ && (die->tag == DW_TAG_imported_declaration
+ || cu->lang () != language_fortran))
+ complaint (_ ("Tag '%s' has unexpected children"),
dwarf_tag_name (die->tag));
read_import_statement (die, cu);
break;
@@ -8760,7 +8604,7 @@ process_die (struct die_info *die, struct dwarf2_cu *cu)
break;
}
}
-
+
/* DWARF name computation. */
/* A helper function for dwarf2_compute_name which determines whether DIE
@@ -8810,9 +8654,9 @@ die_needs_namespace (struct die_info *die, struct dwarf2_cu *cu)
/* A variable in a lexical block of some kind does not need a
namespace, even though in C++ such variables may be external
and have a mangled name. */
- if (die->parent->tag == DW_TAG_lexical_block
- || die->parent->tag == DW_TAG_try_block
- || die->parent->tag == DW_TAG_catch_block
+ if (die->parent->tag == DW_TAG_lexical_block
+ || die->parent->tag == DW_TAG_try_block
+ || die->parent->tag == DW_TAG_catch_block
|| die->parent->tag == DW_TAG_subprogram)
return 0;
return 1;
@@ -8876,9 +8720,8 @@ dw2_linkage_name (struct die_info *die, struct dwarf2_cu *cu)
canonicalized. */
static const char *
-dwarf2_compute_name (const char *name,
- struct die_info *die, struct dwarf2_cu *cu,
- int physname)
+dwarf2_compute_name (const char *name, struct die_info *die,
+ struct dwarf2_cu *cu, int physname)
{
struct objfile *objfile = cu->per_objfile->objfile;
@@ -8894,8 +8737,7 @@ dwarf2_compute_name (const char *name,
Fortran names because there is no mangling standard. So new_symbol
will set the demangled name to the result of dwarf2_full_name, and it is
the demangled name that GDB uses if it exists. */
- if (lang == language_ada
- || (lang == language_fortran && physname))
+ if (lang == language_ada || (lang == language_fortran && physname))
{
/* For Ada unit, we prefer the linkage name over the name, as
the former contains the exported name, which the user expects
@@ -8910,9 +8752,8 @@ dwarf2_compute_name (const char *name,
/* These are the only languages we know how to qualify names in. */
if (name != NULL
- && (lang == language_cplus
- || lang == language_fortran || lang == language_d
- || lang == language_rust))
+ && (lang == language_cplus || lang == language_fortran
+ || lang == language_d || lang == language_rust))
{
if (die_needs_namespace (die, cu))
{
@@ -8923,8 +8764,8 @@ dwarf2_compute_name (const char *name,
prefix = determine_prefix (die, cu);
if (*prefix != '\0')
{
- gdb::unique_xmalloc_ptr<char> prefixed_name
- (typename_concat (NULL, prefix, name, physname, cu));
+ gdb::unique_xmalloc_ptr<char> prefixed_name (
+ typename_concat (NULL, prefix, name, physname, cu));
buf.puts (prefixed_name.get ());
}
@@ -8983,7 +8824,7 @@ dwarf2_compute_name (const char *name,
attr = dwarf2_attr (child, DW_AT_type, cu);
if (attr == NULL)
{
- complaint (_("template parameter missing DW_AT_type"));
+ complaint (_ ("template parameter missing DW_AT_type"));
buf.puts ("UNKNOWN_TYPE");
continue;
}
@@ -8999,15 +8840,15 @@ dwarf2_compute_name (const char *name,
attr = dwarf2_attr (child, DW_AT_const_value, cu);
if (attr == NULL)
{
- complaint (_("template parameter missing "
- "DW_AT_const_value"));
+ complaint (_ ("template parameter missing "
+ "DW_AT_const_value"));
buf.puts ("UNKNOWN_VALUE");
continue;
}
dwarf2_const_value_attr (attr, type, name,
- &cu->comp_unit_obstack, cu,
- &value, &bytes, &baton);
+ &cu->comp_unit_obstack, cu, &value,
+ &bytes, &baton);
if (type->has_no_signedness ())
/* GDB prints characters as NUMBER 'CHAR'. If that's
@@ -9018,8 +8859,7 @@ dwarf2_compute_name (const char *name,
struct value_print_options opts;
if (baton != NULL)
- v = dwarf2_evaluate_loc_desc (type, NULL,
- baton->data,
+ v = dwarf2_evaluate_loc_desc (type, NULL, baton->data,
baton->size,
baton->per_cu,
baton->per_objfile);
@@ -9062,8 +8902,7 @@ dwarf2_compute_name (const char *name,
{
struct type *type = read_type_die (die, cu);
- c_type_print_args (type, &buf, 1, lang,
- &type_print_raw_options);
+ c_type_print_args (type, &buf, 1, lang, &type_print_raw_options);
if (lang == language_cplus)
{
@@ -9089,7 +8928,8 @@ dwarf2_compute_name (const char *name,
/* If we only computed INTERMEDIATE_NAME, or if
INTERMEDIATE_NAME is already canonical, then we need to
intern it. */
- if (canonical_name == NULL || canonical_name == intermediate_name.c_str ())
+ if (canonical_name == NULL
+ || canonical_name == intermediate_name.c_str ())
name = objfile->intern (intermediate_name);
else
name = canonical_name;
@@ -9154,8 +8994,8 @@ dwarf2_physname (const char *name, struct die_info *die, struct dwarf2_cu *cu)
to look up their definition from their declaration so
the only disadvantage remains the minimal symbol variant
`long name(params)' does not have the proper inferior type. */
- demangled = gdb_demangle (mangled, (DMGL_PARAMS | DMGL_ANSI
- | DMGL_RET_DROP));
+ demangled = gdb_demangle (mangled,
+ (DMGL_PARAMS | DMGL_ANSI | DMGL_RET_DROP));
}
if (demangled)
canon = demangled.get ();
@@ -9176,8 +9016,8 @@ dwarf2_physname (const char *name, struct die_info *die, struct dwarf2_cu *cu)
compute DW_AT_linkage_name incorrectly. But in such case
GDB would need to be bug-to-bug compatible. */
- complaint (_("Computed physname <%s> does not match demangled <%s> "
- "(from linkage <%s>) - DIE at %s [in module %s]"),
+ complaint (_ ("Computed physname <%s> does not match demangled <%s> "
+ "(from linkage <%s>) - DIE at %s [in module %s]"),
physname, canon, mangled, sect_offset_str (die->sect_off),
objfile_name (objfile));
@@ -9224,7 +9064,7 @@ read_alias (struct die_info *die, struct dwarf2_cu *cu)
/* If the compiler has nested DW_AT_imported_declaration DIEs,
keep inspecting DIEs until we hit the underlying import. */
#define MAX_NESTED_IMPORTED_DECLARATIONS 100
- for (num = 0; num < MAX_NESTED_IMPORTED_DECLARATIONS; ++num)
+ for (num = 0; num < MAX_NESTED_IMPORTED_DECLARATIONS; ++num)
{
attr = dwarf2_attr (d, DW_AT_import, cu);
if (attr == NULL)
@@ -9237,8 +9077,9 @@ read_alias (struct die_info *die, struct dwarf2_cu *cu)
if (num == MAX_NESTED_IMPORTED_DECLARATIONS)
{
- complaint (_("DIE at %s has too many recursively imported "
- "declarations"), sect_offset_str (d->sect_off));
+ complaint (_ ("DIE at %s has too many recursively imported "
+ "declarations"),
+ sect_offset_str (d->sect_off));
return false;
}
@@ -9312,11 +9153,11 @@ read_decl_line (struct die_info *die, struct dwarf2_cu *cu)
if (0 <= val && val <= UINT_MAX)
return (unsigned int) val;
- complaint (_("Declared line for using directive is too large"));
+ complaint (_ ("Declared line for using directive is too large"));
return 0;
}
- complaint (_("Declared line for using directive is of incorrect format"));
+ complaint (_ ("Declared line for using directive is of incorrect format"));
return 0;
}
@@ -9340,7 +9181,7 @@ read_import_statement (struct die_info *die, struct dwarf2_cu *cu)
import_attr = dwarf2_attr (die, DW_AT_import, cu);
if (import_attr == NULL)
{
- complaint (_("Tag '%s' has no DW_AT_import"),
+ complaint (_ ("Tag '%s' has no DW_AT_import"),
dwarf_tag_name (die->tag));
return;
}
@@ -9402,17 +9243,13 @@ read_import_statement (struct die_info *die, struct dwarf2_cu *cu)
canonical_name = imported_name_prefix;
}
else if (strlen (imported_name_prefix) > 0)
- canonical_name = obconcat (&objfile->objfile_obstack,
- imported_name_prefix,
- (cu->lang () == language_d
- ? "."
- : "::"),
+ canonical_name = obconcat (&objfile->objfile_obstack, imported_name_prefix,
+ (cu->lang () == language_d ? "." : "::"),
imported_name, (char *) NULL);
else
canonical_name = imported_name;
- if (die->tag == DW_TAG_imported_module
- && cu->lang () == language_fortran)
+ if (die->tag == DW_TAG_imported_module && cu->lang () == language_fortran)
for (child_die = die->child; child_die && child_die->tag;
child_die = child_die->sibling)
{
@@ -9423,8 +9260,8 @@ read_import_statement (struct die_info *die, struct dwarf2_cu *cu)
if (child_die->tag != DW_TAG_imported_declaration)
{
- complaint (_("child DW_TAG_imported_declaration expected "
- "- DIE at %s [in module %s]"),
+ complaint (_ ("child DW_TAG_imported_declaration expected "
+ "- DIE at %s [in module %s]"),
sect_offset_str (child_die->sect_off),
objfile_name (objfile));
continue;
@@ -9433,19 +9270,19 @@ read_import_statement (struct die_info *die, struct dwarf2_cu *cu)
import_attr = dwarf2_attr (child_die, DW_AT_import, cu);
if (import_attr == NULL)
{
- complaint (_("Tag '%s' has no DW_AT_import"),
+ complaint (_ ("Tag '%s' has no DW_AT_import"),
dwarf_tag_name (child_die->tag));
continue;
}
imported_cu = cu;
- imported_die = follow_die_ref_or_sig (child_die, import_attr,
- &imported_cu);
+ imported_die
+ = follow_die_ref_or_sig (child_die, import_attr, &imported_cu);
imported_name = dwarf2_name (imported_die, imported_cu);
if (imported_name == NULL)
{
- complaint (_("child DW_TAG_imported_declaration has unknown "
- "imported name - DIE at %s [in module %s]"),
+ complaint (_ ("child DW_TAG_imported_declaration has unknown "
+ "imported name - DIE at %s [in module %s]"),
sect_offset_str (child_die->sect_off),
objfile_name (objfile));
continue;
@@ -9456,15 +9293,9 @@ read_import_statement (struct die_info *die, struct dwarf2_cu *cu)
process_die (child_die, cu);
}
- add_using_directive (using_directives (cu),
- import_prefix,
- canonical_name,
- import_alias,
- imported_declaration,
- excludes,
- read_decl_line (die, cu),
- 0,
- &objfile->objfile_obstack);
+ add_using_directive (using_directives (cu), import_prefix, canonical_name,
+ import_alias, imported_declaration, excludes,
+ read_decl_line (die, cu), 0, &objfile->objfile_obstack);
}
/* ICC<14 does not output the required DW_AT_declaration on incomplete
@@ -9527,10 +9358,8 @@ find_file_and_directory (struct die_info *die, struct dwarf2_cu *cu)
file_and_directory res (dwarf2_string_attr (die, DW_AT_name, cu),
dwarf2_string_attr (die, DW_AT_comp_dir, cu));
- if (res.get_comp_dir () == nullptr
- && producer_is_gcc_lt_4_3 (cu)
- && res.get_name () != nullptr
- && IS_ABSOLUTE_PATH (res.get_name ()))
+ if (res.get_comp_dir () == nullptr && producer_is_gcc_lt_4_3 (cu)
+ && res.get_name () != nullptr && IS_ABSOLUTE_PATH (res.get_name ()))
{
res.set_comp_dir (ldirname (res.get_name ()));
res.set_name (make_unique_xstrdup (lbasename (res.get_name ())));
@@ -9556,7 +9385,7 @@ handle_DW_AT_stmt_list (struct die_info *die, struct dwarf2_cu *cu,
void **slot;
int decode_mapping;
- gdb_assert (! cu->per_cu->is_debug_types);
+ gdb_assert (!cu->per_cu->is_debug_types);
attr = dwarf2_attr (die, DW_AT_stmt_list, cu);
if (attr == NULL || !attr->form_is_unsigned ())
@@ -9570,14 +9399,11 @@ handle_DW_AT_stmt_list (struct die_info *die, struct dwarf2_cu *cu,
compile_unit, then use the line header hash table if it's already
created, but don't create one just yet. */
- if (per_objfile->line_header_hash == NULL
- && die->tag == DW_TAG_partial_unit)
+ if (per_objfile->line_header_hash == NULL && die->tag == DW_TAG_partial_unit)
{
- per_objfile->line_header_hash
- .reset (htab_create_alloc (127, line_header_hash_voidp,
- line_header_eq_voidp,
- htab_delete_entry<line_header>,
- xcalloc, xfree));
+ per_objfile->line_header_hash.reset (
+ htab_create_alloc (127, line_header_hash_voidp, line_header_eq_voidp,
+ htab_delete_entry<line_header>, xcalloc, xfree));
}
line_header line_header_local (line_offset, cu->per_cu->is_dwz);
@@ -9601,8 +9427,8 @@ handle_DW_AT_stmt_list (struct die_info *die, struct dwarf2_cu *cu,
/* dwarf_decode_line_header does not yet provide sufficient information.
We always have to call also dwarf_decode_lines for it. */
- line_header_up lh = dwarf_decode_line_header (line_offset, cu,
- fnd.get_comp_dir ());
+ line_header_up lh
+ = dwarf_decode_line_header (line_offset, cu, fnd.get_comp_dir ());
if (lh == NULL)
return;
@@ -9704,7 +9530,7 @@ read_file_scope (struct die_info *die, struct dwarf2_cu *cu)
if (attr != nullptr && attr->form_is_unsigned () && cu->line_header)
{
if (dwarf2_attr (die, DW_AT_macro_info, cu))
- complaint (_("CU refers to both DW_AT_macros and DW_AT_macro_info"));
+ complaint (_ ("CU refers to both DW_AT_macros and DW_AT_macro_info"));
dwarf_decode_macros (cu, attr->as_unsigned (), 1);
}
@@ -9765,11 +9591,10 @@ dwarf2_cu::setup_type_unit_groups (struct die_info *die)
gdb_assert (tug_unshare->symtabs == NULL);
gdb_assert (m_builder == nullptr);
struct compunit_symtab *cust = tug_unshare->compunit_symtab;
- m_builder.reset (new struct buildsym_compunit
- (cust->objfile (), "",
- cust->dirname (),
- cust->language (),
- 0, cust));
+ m_builder.reset (new struct buildsym_compunit (cust->objfile (), "",
+ cust->dirname (),
+ cust->language (), 0,
+ cust));
list_in_scope = get_builder ()->get_file_symbols ();
}
return;
@@ -9788,8 +9613,8 @@ dwarf2_cu::setup_type_unit_groups (struct die_info *die)
time. */
tug_unshare->symtabs
- = XOBNEWVEC (&cust->objfile ()->objfile_obstack,
- struct symtab *, line_header->file_names_size ());
+ = XOBNEWVEC (&cust->objfile ()->objfile_obstack, struct symtab *,
+ line_header->file_names_size ());
auto &file_names = line_header->file_names ();
for (i = 0; i < file_names.size (); ++i)
@@ -9819,11 +9644,8 @@ dwarf2_cu::setup_type_unit_groups (struct die_info *die)
{
gdb_assert (m_builder == nullptr);
struct compunit_symtab *cust = tug_unshare->compunit_symtab;
- m_builder.reset (new struct buildsym_compunit
- (cust->objfile (), "",
- cust->dirname (),
- cust->language (),
- 0, cust));
+ m_builder.reset (new struct buildsym_compunit (
+ cust->objfile (), "", cust->dirname (), cust->language (), 0, cust));
list_in_scope = get_builder ()->get_file_symbols ();
auto &file_names = line_header->file_names ();
@@ -9868,7 +9690,7 @@ read_type_unit_scope (struct die_info *die, struct dwarf2_cu *cu)
}
}
}
-
+
/* DWO/DWP files.
http://gcc.gnu.org/wiki/DebugFission
@@ -9908,18 +9730,15 @@ eq_dwo_file (const void *item_lhs, const void *item_rhs)
static htab_up
allocate_dwo_file_hash_table ()
{
- return htab_up (htab_create_alloc (41,
- hash_dwo_file,
- eq_dwo_file,
- htab_delete_entry<dwo_file>,
- xcalloc, xfree));
+ return htab_up (htab_create_alloc (41, hash_dwo_file, eq_dwo_file,
+ htab_delete_entry<dwo_file>, xcalloc,
+ xfree));
}
/* Lookup DWO file DWO_NAME. */
static void **
-lookup_dwo_file_slot (dwarf2_per_objfile *per_objfile,
- const char *dwo_name,
+lookup_dwo_file_slot (dwarf2_per_objfile *per_objfile, const char *dwo_name,
const char *comp_dir)
{
struct dwo_file find_entry;
@@ -9966,20 +9785,16 @@ allocate_dwo_unit_table ()
{
/* Start out with a pretty small number.
Generally DWO files contain only one CU and maybe some TUs. */
- return htab_up (htab_create_alloc (3,
- hash_dwo_unit,
- eq_dwo_unit,
- NULL, xcalloc, xfree));
+ return htab_up (htab_create_alloc (3, hash_dwo_unit, eq_dwo_unit, NULL,
+ xcalloc, xfree));
}
/* die_reader_func for create_dwo_cu. */
static void
create_dwo_cu_reader (const struct die_reader_specs *reader,
- const gdb_byte *info_ptr,
- struct die_info *comp_unit_die,
- struct dwo_file *dwo_file,
- struct dwo_unit *dwo_unit)
+ const gdb_byte *info_ptr, struct die_info *comp_unit_die,
+ struct dwo_file *dwo_file, struct dwo_unit *dwo_unit)
{
struct dwarf2_cu *cu = reader->cu;
sect_offset sect_off = cu->per_cu->sect_off;
@@ -9988,8 +9803,8 @@ create_dwo_cu_reader (const struct die_reader_specs *reader,
gdb::optional<ULONGEST> signature = lookup_dwo_id (cu, comp_unit_die);
if (!signature.has_value ())
{
- complaint (_("Dwarf Error: debug entry at offset %s is missing"
- " its dwo_id [in module %s]"),
+ complaint (_ ("Dwarf Error: debug entry at offset %s is missing"
+ " its dwo_id [in module %s]"),
sect_offset_str (sect_off), dwo_file->dwo_name);
return;
}
@@ -10009,9 +9824,9 @@ create_dwo_cu_reader (const struct die_reader_specs *reader,
Note: This function processes DWO files only, not DWP files. */
static void
-create_cus_hash_table (dwarf2_per_objfile *per_objfile,
- dwarf2_cu *cu, struct dwo_file &dwo_file,
- dwarf2_section_info &section, htab_up &cus_htab)
+create_cus_hash_table (dwarf2_per_objfile *per_objfile, dwarf2_cu *cu,
+ struct dwo_file &dwo_file, dwarf2_section_info &section,
+ htab_up &cus_htab)
{
struct objfile *objfile = per_objfile->objfile;
dwarf2_per_bfd *per_bfd = per_objfile->per_bfd;
@@ -10023,15 +9838,17 @@ create_cus_hash_table (dwarf2_per_objfile *per_objfile,
if (info_ptr == NULL)
return;
- dwarf_read_debug_printf ("Reading %s for %s:",
- section.get_name (),
+ dwarf_read_debug_printf ("Reading %s for %s:", section.get_name (),
section.get_file_name ());
end_ptr = info_ptr + section.size;
while (info_ptr < end_ptr)
{
struct dwarf2_per_cu_data per_cu;
- struct dwo_unit read_unit {};
+
+ struct dwo_unit read_unit
+ {
+ };
struct dwo_unit *dwo_unit;
void **slot;
sect_offset sect_off = (sect_offset) (info_ptr - section.buffer);
@@ -10054,22 +9871,22 @@ create_cus_hash_table (dwarf2_per_objfile *per_objfile,
if (cus_htab == NULL)
cus_htab = allocate_dwo_unit_table ();
- dwo_unit = OBSTACK_ZALLOC (&per_bfd->obstack,
- struct dwo_unit);
+ dwo_unit = OBSTACK_ZALLOC (&per_bfd->obstack, struct dwo_unit);
*dwo_unit = read_unit;
slot = htab_find_slot (cus_htab.get (), dwo_unit, INSERT);
gdb_assert (slot != NULL);
if (*slot != NULL)
{
- const struct dwo_unit *dup_cu = (const struct dwo_unit *)*slot;
+ const struct dwo_unit *dup_cu = (const struct dwo_unit *) *slot;
sect_offset dup_sect_off = dup_cu->sect_off;
- complaint (_("debug cu entry at offset %s is duplicate to"
- " the entry at offset %s, signature %s"),
- sect_offset_str (sect_off), sect_offset_str (dup_sect_off),
+ complaint (_ ("debug cu entry at offset %s is duplicate to"
+ " the entry at offset %s, signature %s"),
+ sect_offset_str (sect_off),
+ sect_offset_str (dup_sect_off),
hex_string (dwo_unit->signature));
}
- *slot = (void *)dwo_unit;
+ *slot = (void *) dwo_unit;
}
}
@@ -10266,18 +10083,19 @@ create_dwp_hash_table (dwarf2_per_objfile *per_objfile,
if (version != 1 && version != 2 && version != 5)
{
- error (_("Dwarf Error: unsupported DWP file version (%s)"
- " [in module %s]"),
+ error (_ ("Dwarf Error: unsupported DWP file version (%s)"
+ " [in module %s]"),
pulongest (version), dwp_file->name);
}
if (nr_slots != (nr_slots & -nr_slots))
{
- error (_("Dwarf Error: number of slots in DWP hash table (%s)"
- " is not power of 2 [in module %s]"),
+ error (_ ("Dwarf Error: number of slots in DWP hash table (%s)"
+ " is not power of 2 [in module %s]"),
pulongest (nr_slots), dwp_file->name);
}
- htab = OBSTACK_ZALLOC (&per_objfile->per_bfd->obstack, struct dwp_hash_table);
+ htab
+ = OBSTACK_ZALLOC (&per_objfile->per_bfd->obstack, struct dwp_hash_table);
htab->version = version;
htab->nr_columns = nr_columns;
htab->nr_units = nr_units;
@@ -10286,17 +10104,15 @@ create_dwp_hash_table (dwarf2_per_objfile *per_objfile,
htab->unit_table = htab->hash_table + sizeof (uint64_t) * nr_slots;
/* Exit early if the table is empty. */
- if (nr_slots == 0 || nr_units == 0
- || (version == 2 && nr_columns == 0)
+ if (nr_slots == 0 || nr_units == 0 || (version == 2 && nr_columns == 0)
|| (version == 5 && nr_columns == 0))
{
/* All must be zero. */
- if (nr_slots != 0 || nr_units != 0
- || (version == 2 && nr_columns != 0)
+ if (nr_slots != 0 || nr_units != 0 || (version == 2 && nr_columns != 0)
|| (version == 5 && nr_columns != 0))
{
- complaint (_("Empty DWP but nr_slots,nr_units,nr_columns not"
- " all zero [in modules %s]"),
+ complaint (_ ("Empty DWP but nr_slots,nr_units,nr_columns not"
+ " all zero [in modules %s]"),
dwp_file->name);
}
return htab;
@@ -10304,14 +10120,15 @@ create_dwp_hash_table (dwarf2_per_objfile *per_objfile,
if (version == 1)
{
- htab->section_pool.v1.indices =
- htab->unit_table + sizeof (uint32_t) * nr_slots;
+ htab->section_pool.v1.indices
+ = htab->unit_table + sizeof (uint32_t) * nr_slots;
/* It's harder to decide whether the section is too small in v1.
V1 is deprecated anyway so we punt. */
}
else if (version == 2)
{
- const gdb_byte *ids_ptr = htab->unit_table + sizeof (uint32_t) * nr_slots;
+ const gdb_byte *ids_ptr
+ = htab->unit_table + sizeof (uint32_t) * nr_slots;
int *ids = htab->section_pool.v2.section_ids;
size_t sizeof_ids = sizeof (htab->section_pool.v2.section_ids);
/* Reverse map for error checking. */
@@ -10320,14 +10137,14 @@ create_dwp_hash_table (dwarf2_per_objfile *per_objfile,
if (nr_columns < 2)
{
- error (_("Dwarf Error: bad DWP hash table, too few columns"
- " in section table [in module %s]"),
+ error (_ ("Dwarf Error: bad DWP hash table, too few columns"
+ " in section table [in module %s]"),
dwp_file->name);
}
if (nr_columns > MAX_NR_V2_DWO_SECTIONS)
{
- error (_("Dwarf Error: bad DWP hash table, too many columns"
- " in section table [in module %s]"),
+ error (_ ("Dwarf Error: bad DWP hash table, too many columns"
+ " in section table [in module %s]"),
dwp_file->name);
}
memset (ids, 255, sizeof_ids);
@@ -10338,51 +10155,51 @@ create_dwp_hash_table (dwarf2_per_objfile *per_objfile,
if (id < DW_SECT_MIN || id > DW_SECT_MAX)
{
- error (_("Dwarf Error: bad DWP hash table, bad section id %d"
- " in section table [in module %s]"),
+ error (_ ("Dwarf Error: bad DWP hash table, bad section id %d"
+ " in section table [in module %s]"),
id, dwp_file->name);
}
if (ids_seen[id] != -1)
{
- error (_("Dwarf Error: bad DWP hash table, duplicate section"
- " id %d in section table [in module %s]"),
+ error (_ ("Dwarf Error: bad DWP hash table, duplicate section"
+ " id %d in section table [in module %s]"),
id, dwp_file->name);
}
ids_seen[id] = i;
ids[i] = id;
}
/* Must have exactly one info or types section. */
- if (((ids_seen[DW_SECT_INFO] != -1)
- + (ids_seen[DW_SECT_TYPES] != -1))
+ if (((ids_seen[DW_SECT_INFO] != -1) + (ids_seen[DW_SECT_TYPES] != -1))
!= 1)
{
- error (_("Dwarf Error: bad DWP hash table, missing/duplicate"
- " DWO info/types section [in module %s]"),
+ error (_ ("Dwarf Error: bad DWP hash table, missing/duplicate"
+ " DWO info/types section [in module %s]"),
dwp_file->name);
}
/* Must have an abbrev section. */
if (ids_seen[DW_SECT_ABBREV] == -1)
{
- error (_("Dwarf Error: bad DWP hash table, missing DWO abbrev"
- " section [in module %s]"),
+ error (_ ("Dwarf Error: bad DWP hash table, missing DWO abbrev"
+ " section [in module %s]"),
dwp_file->name);
}
htab->section_pool.v2.offsets = ids_ptr + sizeof (uint32_t) * nr_columns;
- htab->section_pool.v2.sizes =
- htab->section_pool.v2.offsets + (sizeof (uint32_t)
- * nr_units * nr_columns);
- if ((htab->section_pool.v2.sizes + (sizeof (uint32_t)
- * nr_units * nr_columns))
+ htab->section_pool.v2.sizes
+ = htab->section_pool.v2.offsets
+ + (sizeof (uint32_t) * nr_units * nr_columns);
+ if ((htab->section_pool.v2.sizes
+ + (sizeof (uint32_t) * nr_units * nr_columns))
> index_end)
{
- error (_("Dwarf Error: DWP index section is corrupt (too small)"
- " [in module %s]"),
+ error (_ ("Dwarf Error: DWP index section is corrupt (too small)"
+ " [in module %s]"),
dwp_file->name);
}
}
else /* version == 5 */
{
- const gdb_byte *ids_ptr = htab->unit_table + sizeof (uint32_t) * nr_slots;
+ const gdb_byte *ids_ptr
+ = htab->unit_table + sizeof (uint32_t) * nr_slots;
int *ids = htab->section_pool.v5.section_ids;
size_t sizeof_ids = sizeof (htab->section_pool.v5.section_ids);
/* Reverse map for error checking. */
@@ -10390,14 +10207,14 @@ create_dwp_hash_table (dwarf2_per_objfile *per_objfile,
if (nr_columns < 2)
{
- error (_("Dwarf Error: bad DWP hash table, too few columns"
- " in section table [in module %s]"),
+ error (_ ("Dwarf Error: bad DWP hash table, too few columns"
+ " in section table [in module %s]"),
dwp_file->name);
}
if (nr_columns > MAX_NR_V5_DWO_SECTIONS)
{
- error (_("Dwarf Error: bad DWP hash table, too many columns"
- " in section table [in module %s]"),
+ error (_ ("Dwarf Error: bad DWP hash table, too many columns"
+ " in section table [in module %s]"),
dwp_file->name);
}
memset (ids, 255, sizeof_ids);
@@ -10408,14 +10225,14 @@ create_dwp_hash_table (dwarf2_per_objfile *per_objfile,
if (id < DW_SECT_MIN || id > DW_SECT_MAX_V5)
{
- error (_("Dwarf Error: bad DWP hash table, bad section id %d"
- " in section table [in module %s]"),
+ error (_ ("Dwarf Error: bad DWP hash table, bad section id %d"
+ " in section table [in module %s]"),
id, dwp_file->name);
}
if (ids_seen[id] != -1)
{
- error (_("Dwarf Error: bad DWP hash table, duplicate section"
- " id %d in section table [in module %s]"),
+ error (_ ("Dwarf Error: bad DWP hash table, duplicate section"
+ " id %d in section table [in module %s]"),
id, dwp_file->name);
}
ids_seen[id] = i;
@@ -10424,27 +10241,27 @@ create_dwp_hash_table (dwarf2_per_objfile *per_objfile,
/* Must have seen an info section. */
if (ids_seen[DW_SECT_INFO_V5] == -1)
{
- error (_("Dwarf Error: bad DWP hash table, missing/duplicate"
- " DWO info/types section [in module %s]"),
+ error (_ ("Dwarf Error: bad DWP hash table, missing/duplicate"
+ " DWO info/types section [in module %s]"),
dwp_file->name);
}
/* Must have an abbrev section. */
if (ids_seen[DW_SECT_ABBREV_V5] == -1)
{
- error (_("Dwarf Error: bad DWP hash table, missing DWO abbrev"
- " section [in module %s]"),
+ error (_ ("Dwarf Error: bad DWP hash table, missing DWO abbrev"
+ " section [in module %s]"),
dwp_file->name);
}
htab->section_pool.v5.offsets = ids_ptr + sizeof (uint32_t) * nr_columns;
htab->section_pool.v5.sizes
- = htab->section_pool.v5.offsets + (sizeof (uint32_t)
- * nr_units * nr_columns);
- if ((htab->section_pool.v5.sizes + (sizeof (uint32_t)
- * nr_units * nr_columns))
+ = htab->section_pool.v5.offsets
+ + (sizeof (uint32_t) * nr_units * nr_columns);
+ if ((htab->section_pool.v5.sizes
+ + (sizeof (uint32_t) * nr_units * nr_columns))
> index_end)
{
- error (_("Dwarf Error: DWP index section is corrupt (too small)"
- " [in module %s]"),
+ error (_ ("Dwarf Error: DWP index section is corrupt (too small)"
+ " [in module %s]"),
dwp_file->name);
}
}
@@ -10539,13 +10356,12 @@ locate_v1_virtual_dwo_sections (asection *sectp,
static struct dwo_unit *
create_dwo_unit_in_dwp_v1 (dwarf2_per_objfile *per_objfile,
- struct dwp_file *dwp_file,
- uint32_t unit_index,
- const char *comp_dir,
- ULONGEST signature, int is_debug_types)
+ struct dwp_file *dwp_file, uint32_t unit_index,
+ const char *comp_dir, ULONGEST signature,
+ int is_debug_types)
{
- const struct dwp_hash_table *dwp_htab =
- is_debug_types ? dwp_file->tus : dwp_file->cus;
+ const struct dwp_hash_table *dwp_htab
+ = is_debug_types ? dwp_file->tus : dwp_file->cus;
bfd *dbfd = dwp_file->dbfd.get ();
const char *kind = is_debug_types ? "TU" : "CU";
struct dwo_file *dwo_file;
@@ -10556,20 +10372,20 @@ create_dwo_unit_in_dwp_v1 (dwarf2_per_objfile *per_objfile,
gdb_assert (dwp_file->version == 1);
- dwarf_read_debug_printf ("Reading %s %s/%s in DWP V1 file: %s",
- kind, pulongest (unit_index), hex_string (signature),
+ dwarf_read_debug_printf ("Reading %s %s/%s in DWP V1 file: %s", kind,
+ pulongest (unit_index), hex_string (signature),
dwp_file->name);
/* Fetch the sections of this DWO unit.
Put a limit on the number of sections we look for so that bad data
doesn't cause us to loop forever. */
-#define MAX_NR_V1_DWO_SECTIONS \
- (1 /* .debug_info or .debug_types */ \
- + 1 /* .debug_abbrev */ \
- + 1 /* .debug_line */ \
- + 1 /* .debug_loc */ \
- + 1 /* .debug_str_offsets */ \
+#define MAX_NR_V1_DWO_SECTIONS \
+ (1 /* .debug_info or .debug_types */ \
+ + 1 /* .debug_abbrev */ \
+ + 1 /* .debug_line */ \
+ + 1 /* .debug_loc */ \
+ + 1 /* .debug_str_offsets */ \
+ 1 /* .debug_macro or .debug_macinfo */ \
+ 1 /* trailing zero */)
@@ -10578,41 +10394,38 @@ create_dwo_unit_in_dwp_v1 (dwarf2_per_objfile *per_objfile,
for (i = 0; i < MAX_NR_V1_DWO_SECTIONS; ++i)
{
asection *sectp;
- uint32_t section_nr =
- read_4_bytes (dbfd,
- dwp_htab->section_pool.v1.indices
- + (unit_index + i) * sizeof (uint32_t));
+ uint32_t section_nr
+ = read_4_bytes (dbfd, dwp_htab->section_pool.v1.indices
+ + (unit_index + i) * sizeof (uint32_t));
if (section_nr == 0)
break;
if (section_nr >= dwp_file->num_sections)
{
- error (_("Dwarf Error: bad DWP hash table, section number too large"
- " [in module %s]"),
+ error (_ ("Dwarf Error: bad DWP hash table, section number too large"
+ " [in module %s]"),
dwp_file->name);
}
sectp = dwp_file->elf_sections[section_nr];
- if (! locate_v1_virtual_dwo_sections (sectp, &sections))
+ if (!locate_v1_virtual_dwo_sections (sectp, &sections))
{
- error (_("Dwarf Error: bad DWP hash table, invalid section found"
- " [in module %s]"),
+ error (_ ("Dwarf Error: bad DWP hash table, invalid section found"
+ " [in module %s]"),
dwp_file->name);
}
}
- if (i < 2
- || sections.info_or_types.empty ()
- || sections.abbrev.empty ())
+ if (i < 2 || sections.info_or_types.empty () || sections.abbrev.empty ())
{
- error (_("Dwarf Error: bad DWP hash table, missing DWO sections"
- " [in module %s]"),
+ error (_ ("Dwarf Error: bad DWP hash table, missing DWO sections"
+ " [in module %s]"),
dwp_file->name);
}
if (i == MAX_NR_V1_DWO_SECTIONS)
{
- error (_("Dwarf Error: bad DWP hash table, too many DWO sections"
- " [in module %s]"),
+ error (_ ("Dwarf Error: bad DWP hash table, too many DWO sections"
+ " [in module %s]"),
dwp_file->name);
}
@@ -10625,15 +10438,13 @@ create_dwo_unit_in_dwp_v1 (dwarf2_per_objfile *per_objfile,
(fewer struct dwo_file objects to allocate). Remember that for really
large apps there can be on the order of 8K CUs and 200K TUs, or more. */
- std::string virtual_dwo_name =
- string_printf ("virtual-dwo/%d-%d-%d-%d",
- sections.abbrev.get_id (),
- sections.line.get_id (),
- sections.loc.get_id (),
- sections.str_offsets.get_id ());
+ std::string virtual_dwo_name
+ = string_printf ("virtual-dwo/%d-%d-%d-%d", sections.abbrev.get_id (),
+ sections.line.get_id (), sections.loc.get_id (),
+ sections.str_offsets.get_id ());
/* Can we use an existing virtual DWO file? */
- dwo_file_slot = lookup_dwo_file_slot (per_objfile, virtual_dwo_name.c_str (),
- comp_dir);
+ dwo_file_slot
+ = lookup_dwo_file_slot (per_objfile, virtual_dwo_name.c_str (), comp_dir);
/* Create one if necessary. */
if (*dwo_file_slot == NULL)
{
@@ -10671,8 +10482,8 @@ create_dwo_unit_in_dwp_v1 (dwarf2_per_objfile *per_objfile,
dwo_unit = OBSTACK_ZALLOC (&per_objfile->per_bfd->obstack, struct dwo_unit);
dwo_unit->dwo_file = dwo_file;
dwo_unit->signature = signature;
- dwo_unit->section =
- XOBNEW (&per_objfile->per_bfd->obstack, struct dwarf2_section_info);
+ dwo_unit->section
+ = XOBNEW (&per_objfile->per_bfd->obstack, struct dwarf2_section_info);
*dwo_unit->section = sections.info_or_types;
/* dwo_unit->{offset,length,type_offset_in_tu} are set later. */
@@ -10707,11 +10518,10 @@ create_dwp_v2_or_v5_section (dwarf2_per_objfile *per_objfile,
/* Flag an error if the piece denoted by OFFSET,SIZE is outside the
bounds of the real section. This is a pretty-rare event, so just
flag an error (easier) instead of a warning and trying to cope. */
- if (sectp == NULL
- || offset + size > bfd_section_size (sectp))
+ if (sectp == NULL || offset + size > bfd_section_size (sectp))
{
- error (_("Dwarf Error: Bad DWP V2 or V5 section info, doesn't fit"
- " in section %s [in module %s]"),
+ error (_ ("Dwarf Error: Bad DWP V2 or V5 section info, doesn't fit"
+ " in section %s [in module %s]"),
sectp ? bfd_section_name (sectp) : "<unknown>",
objfile_name (per_objfile->objfile));
}
@@ -10728,13 +10538,12 @@ create_dwp_v2_or_v5_section (dwarf2_per_objfile *per_objfile,
static struct dwo_unit *
create_dwo_unit_in_dwp_v2 (dwarf2_per_objfile *per_objfile,
- struct dwp_file *dwp_file,
- uint32_t unit_index,
- const char *comp_dir,
- ULONGEST signature, int is_debug_types)
+ struct dwp_file *dwp_file, uint32_t unit_index,
+ const char *comp_dir, ULONGEST signature,
+ int is_debug_types)
{
- const struct dwp_hash_table *dwp_htab =
- is_debug_types ? dwp_file->tus : dwp_file->cus;
+ const struct dwp_hash_table *dwp_htab
+ = is_debug_types ? dwp_file->tus : dwp_file->cus;
bfd *dbfd = dwp_file->dbfd.get ();
const char *kind = is_debug_types ? "TU" : "CU";
struct dwo_file *dwo_file;
@@ -10745,8 +10554,8 @@ create_dwo_unit_in_dwp_v2 (dwarf2_per_objfile *per_objfile,
gdb_assert (dwp_file->version == 2);
- dwarf_read_debug_printf ("Reading %s %s/%s in DWP V2 file: %s",
- kind, pulongest (unit_index), hex_string (signature),
+ dwarf_read_debug_printf ("Reading %s %s/%s in DWP V2 file: %s", kind,
+ pulongest (unit_index), hex_string (signature),
dwp_file->name);
/* Fetch the section offsets of this DWO unit. */
@@ -10755,16 +10564,16 @@ create_dwo_unit_in_dwp_v2 (dwarf2_per_objfile *per_objfile,
for (i = 0; i < dwp_htab->nr_columns; ++i)
{
- uint32_t offset = read_4_bytes (dbfd,
- dwp_htab->section_pool.v2.offsets
- + (((unit_index - 1) * dwp_htab->nr_columns
- + i)
- * sizeof (uint32_t)));
- uint32_t size = read_4_bytes (dbfd,
- dwp_htab->section_pool.v2.sizes
- + (((unit_index - 1) * dwp_htab->nr_columns
- + i)
- * sizeof (uint32_t)));
+ uint32_t offset
+ = read_4_bytes (dbfd,
+ dwp_htab->section_pool.v2.offsets
+ + (((unit_index - 1) * dwp_htab->nr_columns + i)
+ * sizeof (uint32_t)));
+ uint32_t size
+ = read_4_bytes (dbfd,
+ dwp_htab->section_pool.v2.sizes
+ + (((unit_index - 1) * dwp_htab->nr_columns + i)
+ * sizeof (uint32_t)));
switch (dwp_htab->section_pool.v2.section_ids[i])
{
@@ -10809,16 +10618,15 @@ create_dwo_unit_in_dwp_v2 (dwarf2_per_objfile *per_objfile,
(fewer struct dwo_file objects to allocate). Remember that for really
large apps there can be on the order of 8K CUs and 200K TUs, or more. */
- std::string virtual_dwo_name =
- string_printf ("virtual-dwo/%ld-%ld-%ld-%ld",
- (long) (sections.abbrev_size ? sections.abbrev_offset : 0),
- (long) (sections.line_size ? sections.line_offset : 0),
- (long) (sections.loc_size ? sections.loc_offset : 0),
- (long) (sections.str_offsets_size
- ? sections.str_offsets_offset : 0));
+ std::string virtual_dwo_name = string_printf (
+ "virtual-dwo/%ld-%ld-%ld-%ld",
+ (long) (sections.abbrev_size ? sections.abbrev_offset : 0),
+ (long) (sections.line_size ? sections.line_offset : 0),
+ (long) (sections.loc_size ? sections.loc_offset : 0),
+ (long) (sections.str_offsets_size ? sections.str_offsets_offset : 0));
/* Can we use an existing virtual DWO file? */
- dwo_file_slot = lookup_dwo_file_slot (per_objfile, virtual_dwo_name.c_str (),
- comp_dir);
+ dwo_file_slot
+ = lookup_dwo_file_slot (per_objfile, virtual_dwo_name.c_str (), comp_dir);
/* Create one if necessary. */
if (*dwo_file_slot == NULL)
{
@@ -10828,30 +10636,31 @@ create_dwo_unit_in_dwp_v2 (dwarf2_per_objfile *per_objfile,
dwo_file = new struct dwo_file;
dwo_file->dwo_name = per_objfile->objfile->intern (virtual_dwo_name);
dwo_file->comp_dir = comp_dir;
- dwo_file->sections.abbrev =
- create_dwp_v2_or_v5_section (per_objfile, &dwp_file->sections.abbrev,
- sections.abbrev_offset,
- sections.abbrev_size);
- dwo_file->sections.line =
- create_dwp_v2_or_v5_section (per_objfile, &dwp_file->sections.line,
- sections.line_offset,
- sections.line_size);
- dwo_file->sections.loc =
- create_dwp_v2_or_v5_section (per_objfile, &dwp_file->sections.loc,
- sections.loc_offset, sections.loc_size);
- dwo_file->sections.macinfo =
- create_dwp_v2_or_v5_section (per_objfile, &dwp_file->sections.macinfo,
- sections.macinfo_offset,
- sections.macinfo_size);
- dwo_file->sections.macro =
- create_dwp_v2_or_v5_section (per_objfile, &dwp_file->sections.macro,
- sections.macro_offset,
- sections.macro_size);
- dwo_file->sections.str_offsets =
- create_dwp_v2_or_v5_section (per_objfile,
- &dwp_file->sections.str_offsets,
- sections.str_offsets_offset,
- sections.str_offsets_size);
+ dwo_file->sections.abbrev
+ = create_dwp_v2_or_v5_section (per_objfile, &dwp_file->sections.abbrev,
+ sections.abbrev_offset,
+ sections.abbrev_size);
+ dwo_file->sections.line
+ = create_dwp_v2_or_v5_section (per_objfile, &dwp_file->sections.line,
+ sections.line_offset,
+ sections.line_size);
+ dwo_file->sections.loc
+ = create_dwp_v2_or_v5_section (per_objfile, &dwp_file->sections.loc,
+ sections.loc_offset, sections.loc_size);
+ dwo_file->sections.macinfo
+ = create_dwp_v2_or_v5_section (per_objfile,
+ &dwp_file->sections.macinfo,
+ sections.macinfo_offset,
+ sections.macinfo_size);
+ dwo_file->sections.macro
+ = create_dwp_v2_or_v5_section (per_objfile, &dwp_file->sections.macro,
+ sections.macro_offset,
+ sections.macro_size);
+ dwo_file->sections.str_offsets
+ = create_dwp_v2_or_v5_section (per_objfile,
+ &dwp_file->sections.str_offsets,
+ sections.str_offsets_offset,
+ sections.str_offsets_size);
/* The "str" section is global to the entire DWP file. */
dwo_file->sections.str = dwp_file->sections.str;
/* The info or types section is assigned below to dwo_unit,
@@ -10874,15 +10683,14 @@ create_dwo_unit_in_dwp_v2 (dwarf2_per_objfile *per_objfile,
dwo_unit = OBSTACK_ZALLOC (&per_objfile->per_bfd->obstack, struct dwo_unit);
dwo_unit->dwo_file = dwo_file;
dwo_unit->signature = signature;
- dwo_unit->section =
- XOBNEW (&per_objfile->per_bfd->obstack, struct dwarf2_section_info);
- *dwo_unit->section = create_dwp_v2_or_v5_section
- (per_objfile,
- is_debug_types
- ? &dwp_file->sections.types
- : &dwp_file->sections.info,
- sections.info_or_types_offset,
- sections.info_or_types_size);
+ dwo_unit->section
+ = XOBNEW (&per_objfile->per_bfd->obstack, struct dwarf2_section_info);
+ *dwo_unit->section
+ = create_dwp_v2_or_v5_section (per_objfile,
+ is_debug_types ? &dwp_file->sections.types
+ : &dwp_file->sections.info,
+ sections.info_or_types_offset,
+ sections.info_or_types_size);
/* dwo_unit->{offset,length,type_offset_in_tu} are set later. */
return dwo_unit;
@@ -10895,10 +10703,9 @@ create_dwo_unit_in_dwp_v2 (dwarf2_per_objfile *per_objfile,
static struct dwo_unit *
create_dwo_unit_in_dwp_v5 (dwarf2_per_objfile *per_objfile,
- struct dwp_file *dwp_file,
- uint32_t unit_index,
- const char *comp_dir,
- ULONGEST signature, int is_debug_types)
+ struct dwp_file *dwp_file, uint32_t unit_index,
+ const char *comp_dir, ULONGEST signature,
+ int is_debug_types)
{
const struct dwp_hash_table *dwp_htab
= is_debug_types ? dwp_file->tus : dwp_file->cus;
@@ -10906,13 +10713,17 @@ create_dwo_unit_in_dwp_v5 (dwarf2_per_objfile *per_objfile,
const char *kind = is_debug_types ? "TU" : "CU";
struct dwo_file *dwo_file;
struct dwo_unit *dwo_unit;
- struct virtual_v2_or_v5_dwo_sections sections {};
+
+ struct virtual_v2_or_v5_dwo_sections sections
+ {
+ };
+
void **dwo_file_slot;
gdb_assert (dwp_file->version == 5);
- dwarf_read_debug_printf ("Reading %s %s/%s in DWP V5 file: %s",
- kind, pulongest (unit_index), hex_string (signature),
+ dwarf_read_debug_printf ("Reading %s %s/%s in DWP V5 file: %s", kind,
+ pulongest (unit_index), hex_string (signature),
dwp_file->name);
/* Fetch the section offsets of this DWO unit. */
@@ -10921,51 +10732,50 @@ create_dwo_unit_in_dwp_v5 (dwarf2_per_objfile *per_objfile,
for (int i = 0; i < dwp_htab->nr_columns; ++i)
{
- uint32_t offset = read_4_bytes (dbfd,
- dwp_htab->section_pool.v5.offsets
- + (((unit_index - 1)
- * dwp_htab->nr_columns
- + i)
- * sizeof (uint32_t)));
- uint32_t size = read_4_bytes (dbfd,
- dwp_htab->section_pool.v5.sizes
- + (((unit_index - 1) * dwp_htab->nr_columns
- + i)
- * sizeof (uint32_t)));
+ uint32_t offset
+ = read_4_bytes (dbfd,
+ dwp_htab->section_pool.v5.offsets
+ + (((unit_index - 1) * dwp_htab->nr_columns + i)
+ * sizeof (uint32_t)));
+ uint32_t size
+ = read_4_bytes (dbfd,
+ dwp_htab->section_pool.v5.sizes
+ + (((unit_index - 1) * dwp_htab->nr_columns + i)
+ * sizeof (uint32_t)));
switch (dwp_htab->section_pool.v5.section_ids[i])
{
- case DW_SECT_ABBREV_V5:
- sections.abbrev_offset = offset;
- sections.abbrev_size = size;
- break;
- case DW_SECT_INFO_V5:
- sections.info_or_types_offset = offset;
- sections.info_or_types_size = size;
- break;
- case DW_SECT_LINE_V5:
- sections.line_offset = offset;
- sections.line_size = size;
- break;
- case DW_SECT_LOCLISTS_V5:
- sections.loclists_offset = offset;
- sections.loclists_size = size;
- break;
- case DW_SECT_MACRO_V5:
- sections.macro_offset = offset;
- sections.macro_size = size;
- break;
- case DW_SECT_RNGLISTS_V5:
- sections.rnglists_offset = offset;
- sections.rnglists_size = size;
- break;
- case DW_SECT_STR_OFFSETS_V5:
- sections.str_offsets_offset = offset;
- sections.str_offsets_size = size;
- break;
- case DW_SECT_RESERVED_V5:
- default:
- break;
+ case DW_SECT_ABBREV_V5:
+ sections.abbrev_offset = offset;
+ sections.abbrev_size = size;
+ break;
+ case DW_SECT_INFO_V5:
+ sections.info_or_types_offset = offset;
+ sections.info_or_types_size = size;
+ break;
+ case DW_SECT_LINE_V5:
+ sections.line_offset = offset;
+ sections.line_size = size;
+ break;
+ case DW_SECT_LOCLISTS_V5:
+ sections.loclists_offset = offset;
+ sections.loclists_size = size;
+ break;
+ case DW_SECT_MACRO_V5:
+ sections.macro_offset = offset;
+ sections.macro_size = size;
+ break;
+ case DW_SECT_RNGLISTS_V5:
+ sections.rnglists_offset = offset;
+ sections.rnglists_size = size;
+ break;
+ case DW_SECT_STR_OFFSETS_V5:
+ sections.str_offsets_offset = offset;
+ sections.str_offsets_size = size;
+ break;
+ case DW_SECT_RESERVED_V5:
+ default:
+ break;
}
}
@@ -10978,19 +10788,17 @@ create_dwo_unit_in_dwp_v5 (dwarf2_per_objfile *per_objfile,
(fewer struct dwo_file objects to allocate). Remember that for really
large apps there can be on the order of 8K CUs and 200K TUs, or more. */
- std::string virtual_dwo_name =
- string_printf ("virtual-dwo/%ld-%ld-%ld-%ld-%ld-%ld",
- (long) (sections.abbrev_size ? sections.abbrev_offset : 0),
- (long) (sections.line_size ? sections.line_offset : 0),
- (long) (sections.loclists_size ? sections.loclists_offset : 0),
- (long) (sections.str_offsets_size
- ? sections.str_offsets_offset : 0),
- (long) (sections.macro_size ? sections.macro_offset : 0),
- (long) (sections.rnglists_size ? sections.rnglists_offset: 0));
+ std::string virtual_dwo_name = string_printf (
+ "virtual-dwo/%ld-%ld-%ld-%ld-%ld-%ld",
+ (long) (sections.abbrev_size ? sections.abbrev_offset : 0),
+ (long) (sections.line_size ? sections.line_offset : 0),
+ (long) (sections.loclists_size ? sections.loclists_offset : 0),
+ (long) (sections.str_offsets_size ? sections.str_offsets_offset : 0),
+ (long) (sections.macro_size ? sections.macro_offset : 0),
+ (long) (sections.rnglists_size ? sections.rnglists_offset : 0));
/* Can we use an existing virtual DWO file? */
- dwo_file_slot = lookup_dwo_file_slot (per_objfile,
- virtual_dwo_name.c_str (),
- comp_dir);
+ dwo_file_slot
+ = lookup_dwo_file_slot (per_objfile, virtual_dwo_name.c_str (), comp_dir);
/* Create one if necessary. */
if (*dwo_file_slot == NULL)
{
@@ -11000,35 +10808,33 @@ create_dwo_unit_in_dwp_v5 (dwarf2_per_objfile *per_objfile,
dwo_file = new struct dwo_file;
dwo_file->dwo_name = per_objfile->objfile->intern (virtual_dwo_name);
dwo_file->comp_dir = comp_dir;
- dwo_file->sections.abbrev =
- create_dwp_v2_or_v5_section (per_objfile,
- &dwp_file->sections.abbrev,
- sections.abbrev_offset,
- sections.abbrev_size);
- dwo_file->sections.line =
- create_dwp_v2_or_v5_section (per_objfile,
- &dwp_file->sections.line,
- sections.line_offset, sections.line_size);
- dwo_file->sections.macro =
- create_dwp_v2_or_v5_section (per_objfile,
- &dwp_file->sections.macro,
- sections.macro_offset,
- sections.macro_size);
- dwo_file->sections.loclists =
- create_dwp_v2_or_v5_section (per_objfile,
- &dwp_file->sections.loclists,
- sections.loclists_offset,
- sections.loclists_size);
- dwo_file->sections.rnglists =
- create_dwp_v2_or_v5_section (per_objfile,
- &dwp_file->sections.rnglists,
- sections.rnglists_offset,
- sections.rnglists_size);
- dwo_file->sections.str_offsets =
- create_dwp_v2_or_v5_section (per_objfile,
- &dwp_file->sections.str_offsets,
- sections.str_offsets_offset,
- sections.str_offsets_size);
+ dwo_file->sections.abbrev
+ = create_dwp_v2_or_v5_section (per_objfile, &dwp_file->sections.abbrev,
+ sections.abbrev_offset,
+ sections.abbrev_size);
+ dwo_file->sections.line
+ = create_dwp_v2_or_v5_section (per_objfile, &dwp_file->sections.line,
+ sections.line_offset,
+ sections.line_size);
+ dwo_file->sections.macro
+ = create_dwp_v2_or_v5_section (per_objfile, &dwp_file->sections.macro,
+ sections.macro_offset,
+ sections.macro_size);
+ dwo_file->sections.loclists
+ = create_dwp_v2_or_v5_section (per_objfile,
+ &dwp_file->sections.loclists,
+ sections.loclists_offset,
+ sections.loclists_size);
+ dwo_file->sections.rnglists
+ = create_dwp_v2_or_v5_section (per_objfile,
+ &dwp_file->sections.rnglists,
+ sections.rnglists_offset,
+ sections.rnglists_size);
+ dwo_file->sections.str_offsets
+ = create_dwp_v2_or_v5_section (per_objfile,
+ &dwp_file->sections.str_offsets,
+ sections.str_offsets_offset,
+ sections.str_offsets_size);
/* The "str" section is global to the entire DWP file. */
dwo_file->sections.str = dwp_file->sections.str;
/* The info or types section is assigned below to dwo_unit,
@@ -11053,10 +10859,10 @@ create_dwo_unit_in_dwp_v5 (dwarf2_per_objfile *per_objfile,
dwo_unit->signature = signature;
dwo_unit->section
= XOBNEW (&per_objfile->per_bfd->obstack, struct dwarf2_section_info);
- *dwo_unit->section = create_dwp_v2_or_v5_section (per_objfile,
- &dwp_file->sections.info,
- sections.info_or_types_offset,
- sections.info_or_types_size);
+ *dwo_unit->section
+ = create_dwp_v2_or_v5_section (per_objfile, &dwp_file->sections.info,
+ sections.info_or_types_offset,
+ sections.info_or_types_size);
/* dwo_unit->{offset,length,type_offset_in_tu} are set later. */
return dwo_unit;
@@ -11070,8 +10876,8 @@ lookup_dwo_unit_in_dwp (dwarf2_per_objfile *per_objfile,
struct dwp_file *dwp_file, const char *comp_dir,
ULONGEST signature, int is_debug_types)
{
- const struct dwp_hash_table *dwp_htab =
- is_debug_types ? dwp_file->tus : dwp_file->cus;
+ const struct dwp_hash_table *dwp_htab
+ = is_debug_types ? dwp_file->tus : dwp_file->cus;
bfd *dbfd = dwp_file->dbfd.get ();
uint32_t mask = dwp_htab->nr_slots - 1;
uint32_t hash = signature & mask;
@@ -11082,9 +10888,8 @@ lookup_dwo_unit_in_dwp (dwarf2_per_objfile *per_objfile,
memset (&find_dwo_cu, 0, sizeof (find_dwo_cu));
find_dwo_cu.signature = signature;
- slot = htab_find_slot (is_debug_types
- ? dwp_file->loaded_tus.get ()
- : dwp_file->loaded_cus.get (),
+ slot = htab_find_slot (is_debug_types ? dwp_file->loaded_tus.get ()
+ : dwp_file->loaded_cus.get (),
&find_dwo_cu, INSERT);
if (*slot != NULL)
@@ -11095,13 +10900,13 @@ lookup_dwo_unit_in_dwp (dwarf2_per_objfile *per_objfile,
{
ULONGEST signature_in_table;
- signature_in_table =
- read_8_bytes (dbfd, dwp_htab->hash_table + hash * sizeof (uint64_t));
+ signature_in_table
+ = read_8_bytes (dbfd, dwp_htab->hash_table + hash * sizeof (uint64_t));
if (signature_in_table == signature)
{
- uint32_t unit_index =
- read_4_bytes (dbfd,
- dwp_htab->unit_table + hash * sizeof (uint32_t));
+ uint32_t unit_index
+ = read_4_bytes (dbfd,
+ dwp_htab->unit_table + hash * sizeof (uint32_t));
if (dwp_file->version == 1)
{
@@ -11128,8 +10933,8 @@ lookup_dwo_unit_in_dwp (dwarf2_per_objfile *per_objfile,
hash = (hash + hash2) & mask;
}
- error (_("Dwarf Error: bad DWP hash table, lookup didn't terminate"
- " [in module %s]"),
+ error (_ ("Dwarf Error: bad DWP hash table, lookup didn't terminate"
+ " [in module %s]"),
dwp_file->name);
}
@@ -11146,8 +10951,8 @@ lookup_dwo_unit_in_dwp (dwarf2_per_objfile *per_objfile,
NOTE: This function is derived from symfile_bfd_open. */
static gdb_bfd_ref_ptr
-try_open_dwop_file (dwarf2_per_objfile *per_objfile,
- const char *file_name, int is_dwp, int search_cwd)
+try_open_dwop_file (dwarf2_per_objfile *per_objfile, const char *file_name,
+ int is_dwp, int search_cwd)
{
int desc;
/* Blech. OPF_TRY_CWD_FIRST also disables searching the path list if
@@ -11175,8 +10980,8 @@ try_open_dwop_file (dwarf2_per_objfile *per_objfile,
/* Add the path for the executable binary to the list of search paths. */
std::string objfile_dir = ldirname (objfile_name (per_objfile->objfile));
search_path_holder.reset (concat (objfile_dir.c_str (),
- dirname_separator_string,
- search_path, nullptr));
+ dirname_separator_string, search_path,
+ nullptr));
search_path = search_path_holder.get ();
openp_flags flags = OPF_RETURN_REALPATH;
@@ -11184,13 +10989,13 @@ try_open_dwop_file (dwarf2_per_objfile *per_objfile,
flags |= OPF_SEARCH_IN_PATH;
gdb::unique_xmalloc_ptr<char> absolute_name;
- desc = openp (search_path, flags, file_name,
- O_RDONLY | O_BINARY, &absolute_name);
+ desc = openp (search_path, flags, file_name, O_RDONLY | O_BINARY,
+ &absolute_name);
if (desc < 0)
return NULL;
- gdb_bfd_ref_ptr sym_bfd (gdb_bfd_open (absolute_name.get (),
- gnutarget, desc));
+ gdb_bfd_ref_ptr sym_bfd (gdb_bfd_open (absolute_name.get (), gnutarget,
+ desc));
if (sym_bfd == NULL)
return NULL;
bfd_set_cacheable (sym_bfd.get (), 1);
@@ -11215,12 +11020,12 @@ try_open_dwop_file (dwarf2_per_objfile *per_objfile,
same as symfile_bfd_open. */
static gdb_bfd_ref_ptr
-open_dwo_file (dwarf2_per_objfile *per_objfile,
- const char *file_name, const char *comp_dir)
+open_dwo_file (dwarf2_per_objfile *per_objfile, const char *file_name,
+ const char *comp_dir)
{
if (IS_ABSOLUTE_PATH (file_name))
- return try_open_dwop_file (per_objfile, file_name,
- 0 /*is_dwp*/, 0 /*search_cwd*/);
+ return try_open_dwop_file (per_objfile, file_name, 0 /*is_dwp*/,
+ 0 /*search_cwd*/);
/* Before trying the search path, try DWO_NAME in COMP_DIR. */
@@ -11230,8 +11035,8 @@ open_dwo_file (dwarf2_per_objfile *per_objfile,
/* NOTE: If comp_dir is a relative path, this will also try the
search path, which seems useful. */
- gdb_bfd_ref_ptr abfd (try_open_dwop_file
- (per_objfile, path_to_try.c_str (), 0 /*is_dwp*/, 1 /*search_cwd*/));
+ gdb_bfd_ref_ptr abfd (try_open_dwop_file (
+ per_objfile, path_to_try.c_str (), 0 /*is_dwp*/, 1 /*search_cwd*/));
if (abfd != NULL)
return abfd;
@@ -11243,8 +11048,8 @@ open_dwo_file (dwarf2_per_objfile *per_objfile,
if (debug_file_directory.empty ())
return NULL;
- return try_open_dwop_file (per_objfile, file_name,
- 0 /*is_dwp*/, 1 /*search_cwd*/);
+ return try_open_dwop_file (per_objfile, file_name, 0 /*is_dwp*/,
+ 1 /*search_cwd*/);
}
/* This function is mapped across the sections and remembers the offset and
@@ -11490,10 +11295,9 @@ eq_dwp_loaded_cutus (const void *a, const void *b)
static htab_up
allocate_dwp_loaded_cutus_table ()
{
- return htab_up (htab_create_alloc (3,
- hash_dwp_loaded_cutus,
- eq_dwp_loaded_cutus,
- NULL, xcalloc, xfree));
+ return htab_up (htab_create_alloc (3, hash_dwp_loaded_cutus,
+ eq_dwp_loaded_cutus, NULL, xcalloc,
+ xfree));
}
/* Try to open DWP file FILE_NAME.
@@ -11506,8 +11310,7 @@ static gdb_bfd_ref_ptr
open_dwp_file (dwarf2_per_objfile *per_objfile, const char *file_name)
{
gdb_bfd_ref_ptr abfd (try_open_dwop_file (per_objfile, file_name,
- 1 /*is_dwp*/,
- 1 /*search_cwd*/));
+ 1 /*is_dwp*/, 1 /*search_cwd*/));
if (abfd != NULL)
return abfd;
@@ -11525,8 +11328,7 @@ open_dwp_file (dwarf2_per_objfile *per_objfile, const char *file_name)
If the user wants to search "." to handle this case,
it must be added to debug-file-directory. */
return try_open_dwop_file (per_objfile, lbasename (file_name),
- 1 /*is_dwp*/,
- 0 /*search_cwd*/);
+ 1 /*is_dwp*/, 0 /*search_cwd*/);
}
return NULL;
@@ -11552,7 +11354,8 @@ open_and_init_dwp_file (dwarf2_per_objfile *per_objfile)
struct objfile *backlink = objfile->separate_debug_objfile_backlink;
const char *backlink_basename = lbasename (backlink->original_name);
- dwp_name = ldirname (objfile->original_name) + SLASH_STRING + backlink_basename;
+ dwp_name
+ = ldirname (objfile->original_name) + SLASH_STRING + backlink_basename;
}
else
dwp_name = objfile->original_name;
@@ -11577,13 +11380,12 @@ open_and_init_dwp_file (dwarf2_per_objfile *per_objfile)
}
const char *name = bfd_get_filename (dbfd.get ());
- std::unique_ptr<struct dwp_file> dwp_file
- (new struct dwp_file (name, std::move (dbfd)));
+ std::unique_ptr<struct dwp_file> dwp_file (
+ new struct dwp_file (name, std::move (dbfd)));
dwp_file->num_sections = elf_numsections (dwp_file->dbfd);
- dwp_file->elf_sections =
- OBSTACK_CALLOC (&per_objfile->per_bfd->obstack,
- dwp_file->num_sections, asection *);
+ dwp_file->elf_sections = OBSTACK_CALLOC (&per_objfile->per_bfd->obstack,
+ dwp_file->num_sections, asection *);
for (asection *sec : gdb_bfd_sections (dwp_file->dbfd))
dwarf2_locate_common_dwp_sections (objfile, dwp_file->dbfd.get (), sec,
@@ -11600,8 +11402,8 @@ open_and_init_dwp_file (dwarf2_per_objfile *per_objfile)
/* Technically speaking, we should try to limp along, but this is
pretty bizarre. We use pulongest here because that's the established
portability solution (e.g, we cannot use %u for uint32_t). */
- error (_("Dwarf Error: DWP file CU version %s doesn't match"
- " TU version %s [in DWP file %s]"),
+ error (_ ("Dwarf Error: DWP file CU version %s doesn't match"
+ " TU version %s [in DWP file %s]"),
pulongest (dwp_file->cus->version),
pulongest (dwp_file->tus->version), dwp_name.c_str ());
}
@@ -11627,9 +11429,10 @@ open_and_init_dwp_file (dwarf2_per_objfile *per_objfile)
dwp_file->loaded_tus = allocate_dwp_loaded_cutus_table ();
dwarf_read_debug_printf ("DWP file found: %s", dwp_file->name);
- dwarf_read_debug_printf (" %s CUs, %s TUs",
- pulongest (dwp_file->cus ? dwp_file->cus->nr_units : 0),
- pulongest (dwp_file->tus ? dwp_file->tus->nr_units : 0));
+ dwarf_read_debug_printf (
+ " %s CUs, %s TUs",
+ pulongest (dwp_file->cus ? dwp_file->cus->nr_units : 0),
+ pulongest (dwp_file->tus ? dwp_file->tus->nr_units : 0));
return dwp_file;
}
@@ -11682,19 +11485,19 @@ lookup_dwo_cutu (dwarf2_cu *cu, const char *dwo_name, const char *comp_dir,
dwp_file = get_dwp_file (per_objfile);
if (dwp_file != NULL)
{
- const struct dwp_hash_table *dwp_htab =
- is_debug_types ? dwp_file->tus : dwp_file->cus;
+ const struct dwp_hash_table *dwp_htab
+ = is_debug_types ? dwp_file->tus : dwp_file->cus;
if (dwp_htab != NULL)
{
- struct dwo_unit *dwo_cutu =
- lookup_dwo_unit_in_dwp (per_objfile, dwp_file, comp_dir, signature,
- is_debug_types);
+ struct dwo_unit *dwo_cutu
+ = lookup_dwo_unit_in_dwp (per_objfile, dwp_file, comp_dir,
+ signature, is_debug_types);
if (dwo_cutu != NULL)
{
- dwarf_read_debug_printf ("Virtual DWO %s %s found: @%s",
- kind, hex_string (signature),
+ dwarf_read_debug_printf ("Virtual DWO %s %s found: @%s", kind,
+ hex_string (signature),
host_address_to_string (dwo_cutu));
return dwo_cutu;
@@ -11724,9 +11527,8 @@ lookup_dwo_cutu (dwarf2_cu *cu, const char *dwo_name, const char *comp_dir,
memset (&find_dwo_cutu, 0, sizeof (find_dwo_cutu));
find_dwo_cutu.signature = signature;
- dwo_cutu
- = (struct dwo_unit *) htab_find (dwo_file->tus.get (),
- &find_dwo_cutu);
+ dwo_cutu = (struct dwo_unit *) htab_find (dwo_file->tus.get (),
+ &find_dwo_cutu);
}
else if (!is_debug_types && dwo_file->cus)
{
@@ -11734,14 +11536,14 @@ lookup_dwo_cutu (dwarf2_cu *cu, const char *dwo_name, const char *comp_dir,
memset (&find_dwo_cutu, 0, sizeof (find_dwo_cutu));
find_dwo_cutu.signature = signature;
- dwo_cutu = (struct dwo_unit *)htab_find (dwo_file->cus.get (),
- &find_dwo_cutu);
+ dwo_cutu = (struct dwo_unit *) htab_find (dwo_file->cus.get (),
+ &find_dwo_cutu);
}
if (dwo_cutu != NULL)
{
- dwarf_read_debug_printf ("DWO %s %s(%s) found: @%s",
- kind, dwo_name, hex_string (signature),
+ dwarf_read_debug_printf ("DWO %s %s(%s) found: @%s", kind,
+ dwo_name, hex_string (signature),
host_address_to_string (dwo_cutu));
return dwo_cutu;
@@ -11753,8 +11555,8 @@ lookup_dwo_cutu (dwarf2_cu *cu, const char *dwo_name, const char *comp_dir,
someone deleted the DWO/DWP file, or the search path isn't set up
correctly to find the file. */
- dwarf_read_debug_printf ("DWO %s %s(%s) not found",
- kind, dwo_name, hex_string (signature));
+ dwarf_read_debug_printf ("DWO %s %s(%s) not found", kind, dwo_name,
+ hex_string (signature));
/* This is a warning and not a complaint because it can be caused by
pilot error (e.g., user accidentally deleting the DWO). */
@@ -11764,11 +11566,11 @@ lookup_dwo_cutu (dwarf2_cu *cu, const char *dwo_name, const char *comp_dir,
std::string dwp_text;
if (dwp_file != NULL)
- dwp_text = string_printf (" [in DWP file %s]",
- lbasename (dwp_file->name));
+ dwp_text
+ = string_printf (" [in DWP file %s]", lbasename (dwp_file->name));
- warning (_("Could not find DWO %s %s(%s)%s referenced by %s at offset %s"
- " [in module %s]"),
+ warning (_ ("Could not find DWO %s %s(%s)%s referenced by %s at offset %s"
+ " [in module %s]"),
kind, dwo_name, hex_string (signature), dwp_text.c_str (), kind,
sect_offset_str (cu->per_cu->sect_off), objfile_name (objfile));
}
@@ -11779,8 +11581,8 @@ lookup_dwo_cutu (dwarf2_cu *cu, const char *dwo_name, const char *comp_dir,
See lookup_dwo_cutu_unit for details. */
static struct dwo_unit *
-lookup_dwo_comp_unit (dwarf2_cu *cu, const char *dwo_name, const char *comp_dir,
- ULONGEST signature)
+lookup_dwo_comp_unit (dwarf2_cu *cu, const char *dwo_name,
+ const char *comp_dir, ULONGEST signature)
{
gdb_assert (!cu->per_cu->is_debug_types);
@@ -11791,7 +11593,8 @@ lookup_dwo_comp_unit (dwarf2_cu *cu, const char *dwo_name, const char *comp_dir,
See lookup_dwo_cutu_unit for details. */
static struct dwo_unit *
-lookup_dwo_type_unit (dwarf2_cu *cu, const char *dwo_name, const char *comp_dir)
+lookup_dwo_type_unit (dwarf2_cu *cu, const char *dwo_name,
+ const char *comp_dir)
{
gdb_assert (cu->per_cu->is_debug_types);
@@ -11815,8 +11618,7 @@ queue_and_load_dwo_tu (void **slot, void *info)
/* We pass NULL for DEPENDENT_CU because we don't yet know if there's
a real dependency of PER_CU on SIG_TYPE. That is detected later
while processing PER_CU. */
- if (maybe_queue_comp_unit (NULL, sig_type, cu->per_objfile,
- cu->lang ()))
+ if (maybe_queue_comp_unit (NULL, sig_type, cu->per_objfile, cu->lang ()))
load_full_type_unit (sig_type, cu->per_objfile);
cu->per_cu->imported_symtabs_push (sig_type);
}
@@ -11876,7 +11678,7 @@ inherit_abstract_dies (struct die_info *die, struct dwarf2_cu *cu)
if (die->tag != origin_die->tag
&& !(die->tag == DW_TAG_inlined_subroutine
&& origin_die->tag == DW_TAG_subprogram))
- complaint (_("DIE %s and its abstract origin %s have different tags"),
+ complaint (_ ("DIE %s and its abstract origin %s have different tags"),
sect_offset_str (die->sect_off),
sect_offset_str (origin_die->sect_off));
@@ -11891,8 +11693,7 @@ inherit_abstract_dies (struct die_info *die, struct dwarf2_cu *cu)
die_info *abstract_child = origin_die->child;
while (concrete_child != nullptr || abstract_child != nullptr)
{
- if (concrete_child == nullptr
- || abstract_child == nullptr
+ if (concrete_child == nullptr || abstract_child == nullptr
|| concrete_child->tag != abstract_child->tag)
{
are_isomorphic = false;
@@ -11913,8 +11714,7 @@ inherit_abstract_dies (struct die_info *die, struct dwarf2_cu *cu)
std::vector<sect_offset> offsets;
- for (die_info *child_die = die->child;
- child_die && child_die->tag;
+ for (die_info *child_die = die->child; child_die && child_die->tag;
child_die = child_die->sibling)
{
/* We are trying to process concrete instance entries:
@@ -11945,16 +11745,15 @@ inherit_abstract_dies (struct die_info *die, struct dwarf2_cu *cu)
if (attr == nullptr)
break;
- child_origin_die = follow_die_ref (child_origin_die, attr,
- &child_origin_cu);
+ child_origin_die
+ = follow_die_ref (child_origin_die, attr, &child_origin_cu);
}
/* If missing DW_AT_abstract_origin, try the corresponding child
of the origin. Clang emits such lexical scopes. */
if (child_origin_die == child_die
&& dwarf2_attr (child_die, DW_AT_abstract_origin, cu) == nullptr
- && are_isomorphic
- && child_die->tag == DW_TAG_lexical_block)
+ && are_isomorphic && child_die->tag == DW_TAG_lexical_block)
child_origin_die = corresponding_abstract_child;
/* According to DWARF3 3.3.8.2 #3 new entries without their abstract
@@ -11964,13 +11763,13 @@ inherit_abstract_dies (struct die_info *die, struct dwarf2_cu *cu)
if (child_die->tag != child_origin_die->tag
&& !(child_die->tag == DW_TAG_inlined_subroutine
&& child_origin_die->tag == DW_TAG_subprogram))
- complaint (_("Child DIE %s and its abstract origin %s have "
- "different tags"),
+ complaint (_ ("Child DIE %s and its abstract origin %s have "
+ "different tags"),
sect_offset_str (child_die->sect_off),
sect_offset_str (child_origin_die->sect_off));
if (child_origin_die->parent != origin_die)
- complaint (_("Child DIE %s and its abstract origin %s have "
- "different parents"),
+ complaint (_ ("Child DIE %s and its abstract origin %s have "
+ "different parents"),
sect_offset_str (child_die->sect_off),
sect_offset_str (child_origin_die->sect_off));
else
@@ -11985,12 +11784,11 @@ inherit_abstract_dies (struct die_info *die, struct dwarf2_cu *cu)
{
std::sort (offsets.begin (), offsets.end ());
- for (auto offsets_it = offsets.begin () + 1;
- offsets_it < offsets.end ();
+ for (auto offsets_it = offsets.begin () + 1; offsets_it < offsets.end ();
++offsets_it)
if (*(offsets_it - 1) == *offsets_it)
- complaint (_("Multiple children of DIE %s refer "
- "to DIE %s as their abstract origin"),
+ complaint (_ ("Multiple children of DIE %s refer "
+ "to DIE %s as their abstract origin"),
sect_offset_str (die->sect_off),
sect_offset_str (*offsets_it));
}
@@ -12065,7 +11863,7 @@ read_func_scope (struct die_info *die, struct dwarf2_cu *cu)
illegal according to the DWARF standard. */
if (name == NULL)
{
- complaint (_("missing name for subprogram DIE at %s"),
+ complaint (_ ("missing name for subprogram DIE at %s"),
sect_offset_str (die->sect_off));
return;
}
@@ -12080,15 +11878,14 @@ read_func_scope (struct die_info *die, struct dwarf2_cu *cu)
bool external_p = attr != nullptr && attr->as_boolean ();
attr = dwarf2_attr (die, DW_AT_inline, cu);
bool inlined_p
- = (attr != nullptr
- && attr->is_nonnegative ()
+ = (attr != nullptr && attr->is_nonnegative ()
&& (attr->as_nonnegative () == DW_INL_inlined
|| attr->as_nonnegative () == DW_INL_declared_inlined));
attr = dwarf2_attr (die, DW_AT_declaration, cu);
bool decl_p = attr != nullptr && attr->as_boolean ();
if (!external_p && !inlined_p && !decl_p)
- complaint (_("cannot get low and high bounds "
- "for subprogram DIE at %s"),
+ complaint (_ ("cannot get low and high bounds "
+ "for subprogram DIE at %s"),
sect_offset_str (die->sect_off));
}
return;
@@ -12187,13 +11984,11 @@ read_func_scope (struct die_info *die, struct dwarf2_cu *cu)
struct context_stack cstk = cu->get_builder ()->pop_context ();
/* Make a block for the local symbols within. */
block = cu->get_builder ()->finish_block (cstk.name, cstk.old_blocks,
- cstk.static_link, lowpc, highpc);
+ cstk.static_link, lowpc, highpc);
/* For C++, set the block's scope. */
- if ((cu->lang () == language_cplus
- || cu->lang () == language_fortran
- || cu->lang () == language_d
- || cu->lang () == language_rust)
+ if ((cu->lang () == language_cplus || cu->lang () == language_fortran
+ || cu->lang () == language_d || cu->lang () == language_rust)
&& cu->processing_has_namespace_info)
block_set_scope (block, determine_prefix (die, cu),
&objfile->objfile_obstack);
@@ -12212,8 +12007,7 @@ read_func_scope (struct die_info *die, struct dwarf2_cu *cu)
templ_func->template_arguments
= XOBNEWVEC (&objfile->objfile_obstack, struct symbol *,
templ_func->n_template_arguments);
- memcpy (templ_func->template_arguments,
- template_args.data (),
+ memcpy (templ_func->template_arguments, template_args.data (),
(templ_func->n_template_arguments * sizeof (struct symbol *)));
/* Make sure that the symtab is set on the new symbols. Even
@@ -12262,8 +12056,7 @@ read_lexical_block_scope (struct die_info *die, struct dwarf2_cu *cu)
/* DW_TAG_lexical_block has no attributes, process its children as if
there was no wrapping by that DW_TAG_lexical_block.
GCC does no longer produces such DWARF since GCC r224161. */
- for (child_die = die->child;
- child_die != NULL && child_die->tag;
+ for (child_die = die->child; child_die != NULL && child_die->tag;
child_die = child_die->sibling)
{
/* We might already be processing this DIE. This can happen
@@ -12300,7 +12093,7 @@ read_lexical_block_scope (struct die_info *die, struct dwarf2_cu *cu)
{
struct block *block
= cu->get_builder ()->finish_block (0, cstk.old_blocks, NULL,
- cstk.start_addr, highpc);
+ cstk.start_addr, highpc);
/* Note that recording ranges after traversing children, as we
do here, means that recording a parent's ranges entails
@@ -12319,8 +12112,7 @@ read_lexical_block_scope (struct die_info *die, struct dwarf2_cu *cu)
}
static void dwarf2_ranges_read_low_addrs (unsigned offset,
- struct dwarf2_cu *cu,
- dwarf_tag tag,
+ struct dwarf2_cu *cu, dwarf_tag tag,
std::vector<CORE_ADDR> &result);
/* Read in DW_TAG_call_site and insert it to CU->call_site_htab. */
@@ -12348,8 +12140,8 @@ read_call_site_scope (struct die_info *die, struct dwarf2_cu *cu)
}
if (!attr)
{
- complaint (_("missing DW_AT_call_return_pc for DW_TAG_call_site "
- "DIE %s [in module %s]"),
+ complaint (_ ("missing DW_AT_call_return_pc for DW_TAG_call_site "
+ "DIE %s [in module %s]"),
sect_offset_str (die->sect_off), objfile_name (objfile));
return;
}
@@ -12358,16 +12150,16 @@ read_call_site_scope (struct die_info *die, struct dwarf2_cu *cu)
pc -= baseaddr;
if (cu->call_site_htab == NULL)
- cu->call_site_htab = htab_create_alloc_ex (16, call_site::hash,
- call_site::eq, NULL,
- &objfile->objfile_obstack,
- hashtab_obstack_allocate, NULL);
+ cu->call_site_htab
+ = htab_create_alloc_ex (16, call_site::hash, call_site::eq, NULL,
+ &objfile->objfile_obstack,
+ hashtab_obstack_allocate, NULL);
struct call_site call_site_local (pc, nullptr, nullptr);
slot = htab_find_slot (cu->call_site_htab, &call_site_local, INSERT);
if (*slot != NULL)
{
- complaint (_("Duplicate PC %s for DW_TAG_call_site "
- "DIE %s [in module %s]"),
+ complaint (_ ("Duplicate PC %s for DW_TAG_call_site "
+ "DIE %s [in module %s]"),
paddress (gdbarch, pc), sect_offset_str (die->sect_off),
objfile_name (objfile));
return;
@@ -12382,8 +12174,8 @@ read_call_site_scope (struct die_info *die, struct dwarf2_cu *cu)
if (child_die->tag != DW_TAG_call_site_parameter
&& child_die->tag != DW_TAG_GNU_call_site_parameter)
{
- complaint (_("Tag %d is not DW_TAG_call_site_parameter in "
- "DW_TAG_call_site child DIE %s [in module %s]"),
+ complaint (_ ("Tag %d is not DW_TAG_call_site_parameter in "
+ "DW_TAG_call_site child DIE %s [in module %s]"),
child_die->tag, sect_offset_str (child_die->sect_off),
objfile_name (objfile));
continue;
@@ -12393,15 +12185,16 @@ read_call_site_scope (struct die_info *die, struct dwarf2_cu *cu)
}
struct call_site *call_site
- = new (XOBNEWVAR (&objfile->objfile_obstack,
- struct call_site,
- sizeof (*call_site) + sizeof (call_site->parameter[0]) * nparams))
- struct call_site (pc, cu->per_cu, per_objfile);
+ = new (XOBNEWVAR (&objfile->objfile_obstack, struct call_site,
+ sizeof (*call_site)
+ + sizeof (call_site->parameter[0])
+ * nparams)) struct call_site (pc, cu->per_cu,
+ per_objfile);
*slot = call_site;
/* We never call the destructor of call_site, so we must ensure it is
trivially destructible. */
- gdb_static_assert(std::is_trivially_destructible<struct call_site>::value);
+ gdb_static_assert (std::is_trivially_destructible<struct call_site>::value);
if (dwarf2_flag_true_p (die, DW_AT_call_tail_call, cu)
|| dwarf2_flag_true_p (die, DW_AT_GNU_tail_call, cu))
@@ -12412,12 +12205,12 @@ read_call_site_scope (struct die_info *die, struct dwarf2_cu *cu)
for (func_die = die->parent;
func_die && func_die->tag != DW_TAG_subprogram
&& func_die->tag != DW_TAG_subroutine_type;
- func_die = func_die->parent);
+ func_die = func_die->parent)
+ ;
/* DW_AT_call_all_calls is a superset
of DW_AT_call_all_tail_calls. */
- if (func_die
- && !dwarf2_flag_true_p (func_die, DW_AT_call_all_calls, cu)
+ if (func_die && !dwarf2_flag_true_p (func_die, DW_AT_call_all_calls, cu)
&& !dwarf2_flag_true_p (func_die, DW_AT_GNU_all_call_sites, cu)
&& !dwarf2_flag_true_p (func_die, DW_AT_call_all_tail_calls, cu)
&& !dwarf2_flag_true_p (func_die, DW_AT_GNU_all_tail_call_sites, cu))
@@ -12446,9 +12239,10 @@ read_call_site_scope (struct die_info *die, struct dwarf2_cu *cu)
TYPE_TAIL_CALL_LIST (func_type) = call_site;
}
else
- complaint (_("Cannot find function owning DW_TAG_call_site "
- "DIE %s [in module %s]"),
- sect_offset_str (die->sect_off), objfile_name (objfile));
+ complaint (_ ("Cannot find function owning DW_TAG_call_site "
+ "DIE %s [in module %s]"),
+ sect_offset_str (die->sect_off),
+ objfile_name (objfile));
}
}
@@ -12471,7 +12265,8 @@ read_call_site_scope (struct die_info *die, struct dwarf2_cu *cu)
struct dwarf2_locexpr_baton *dlbaton;
struct dwarf_block *block = attr->as_block ();
- dlbaton = XOBNEW (&objfile->objfile_obstack, struct dwarf2_locexpr_baton);
+ dlbaton
+ = XOBNEW (&objfile->objfile_obstack, struct dwarf2_locexpr_baton);
dlbaton->data = block->data;
dlbaton->size = block->size;
dlbaton->per_objfile = per_objfile;
@@ -12499,16 +12294,17 @@ read_call_site_scope (struct die_info *die, struct dwarf2_cu *cu)
if (target_physname == NULL)
target_physname = dwarf2_physname (NULL, target_die, target_cu);
if (target_physname == NULL)
- complaint (_("DW_AT_call_target target DIE has invalid "
- "physname, for referencing DIE %s [in module %s]"),
- sect_offset_str (die->sect_off), objfile_name (objfile));
+ complaint (_ ("DW_AT_call_target target DIE has invalid "
+ "physname, for referencing DIE %s [in module %s]"),
+ sect_offset_str (die->sect_off),
+ objfile_name (objfile));
else
call_site->target.set_loc_physname (target_physname);
}
else if (ranges_attr != nullptr && ranges_attr->form_is_unsigned ())
{
- ULONGEST ranges_offset = (ranges_attr->as_unsigned ()
- + target_cu->gnu_ranges_base);
+ ULONGEST ranges_offset
+ = (ranges_attr->as_unsigned () + target_cu->gnu_ranges_base);
std::vector<CORE_ADDR> addresses;
dwarf2_ranges_read_low_addrs (ranges_offset, target_cu,
target_die->tag, addresses);
@@ -12525,9 +12321,10 @@ read_call_site_scope (struct die_info *die, struct dwarf2_cu *cu)
if (dwarf2_get_pc_bounds (target_die, &lowpc, NULL, target_cu,
nullptr, nullptr)
<= PC_BOUNDS_INVALID)
- complaint (_("DW_AT_call_target target DIE has invalid "
- "low pc, for referencing DIE %s [in module %s]"),
- sect_offset_str (die->sect_off), objfile_name (objfile));
+ complaint (_ ("DW_AT_call_target target DIE has invalid "
+ "low pc, for referencing DIE %s [in module %s]"),
+ sect_offset_str (die->sect_off),
+ objfile_name (objfile));
else
{
lowpc = (gdbarch_adjust_dwarf2_addr (gdbarch, lowpc + baseaddr)
@@ -12537,12 +12334,11 @@ read_call_site_scope (struct die_info *die, struct dwarf2_cu *cu)
}
}
else
- complaint (_("DW_TAG_call_site DW_AT_call_target is neither "
- "block nor reference, for DIE %s [in module %s]"),
+ complaint (_ ("DW_TAG_call_site DW_AT_call_target is neither "
+ "block nor reference, for DIE %s [in module %s]"),
sect_offset_str (die->sect_off), objfile_name (objfile));
- for (child_die = die->child;
- child_die && child_die->tag;
+ for (child_die = die->child; child_die && child_die->tag;
child_die = child_die->sibling)
{
struct call_site_parameter *parameter;
@@ -12580,8 +12376,8 @@ read_call_site_scope (struct die_info *die, struct dwarf2_cu *cu)
/* As DW_OP_GNU_parameter_ref uses CU-relative offset this
binding can be done only inside one CU. Such referenced DIE
therefore cannot be even moved to DW_TAG_partial_unit. */
- complaint (_("DW_AT_call_parameter offset is not in CU for "
- "DW_TAG_call_site child DIE %s [in module %s]"),
+ complaint (_ ("DW_AT_call_parameter offset is not in CU for "
+ "DW_TAG_call_site child DIE %s [in module %s]"),
sect_offset_str (child_die->sect_off),
objfile_name (objfile));
continue;
@@ -12591,31 +12387,33 @@ read_call_site_scope (struct die_info *die, struct dwarf2_cu *cu)
}
else if (loc == NULL || origin != NULL || !loc->form_is_block ())
{
- complaint (_("No DW_FORM_block* DW_AT_location for "
- "DW_TAG_call_site child DIE %s [in module %s]"),
- sect_offset_str (child_die->sect_off), objfile_name (objfile));
+ complaint (_ ("No DW_FORM_block* DW_AT_location for "
+ "DW_TAG_call_site child DIE %s [in module %s]"),
+ sect_offset_str (child_die->sect_off),
+ objfile_name (objfile));
continue;
}
else
{
struct dwarf_block *block = loc->as_block ();
- parameter->u.dwarf_reg = dwarf_block_to_dwarf_reg
- (block->data, &block->data[block->size]);
+ parameter->u.dwarf_reg
+ = dwarf_block_to_dwarf_reg (block->data,
+ &block->data[block->size]);
if (parameter->u.dwarf_reg != -1)
parameter->kind = CALL_SITE_PARAMETER_DWARF_REG;
else if (dwarf_block_to_sp_offset (gdbarch, block->data,
- &block->data[block->size],
+ &block->data[block->size],
&parameter->u.fb_offset))
parameter->kind = CALL_SITE_PARAMETER_FB_OFFSET;
else
{
- complaint (_("Only single DW_OP_reg or DW_OP_fbreg is supported "
- "for DW_FORM_block* DW_AT_location is supported for "
- "DW_TAG_call_site child DIE %s "
- "[in module %s]"),
- sect_offset_str (child_die->sect_off),
- objfile_name (objfile));
+ complaint (
+ _ ("Only single DW_OP_reg or DW_OP_fbreg is supported "
+ "for DW_FORM_block* DW_AT_location is supported for "
+ "DW_TAG_call_site child DIE %s "
+ "[in module %s]"),
+ sect_offset_str (child_die->sect_off), objfile_name (objfile));
continue;
}
}
@@ -12625,8 +12423,8 @@ read_call_site_scope (struct die_info *die, struct dwarf2_cu *cu)
attr = dwarf2_attr (child_die, DW_AT_GNU_call_site_value, cu);
if (attr == NULL || !attr->form_is_block ())
{
- complaint (_("No DW_FORM_block* DW_AT_call_value for "
- "DW_TAG_call_site child DIE %s [in module %s]"),
+ complaint (_ ("No DW_FORM_block* DW_AT_call_value for "
+ "DW_TAG_call_site child DIE %s [in module %s]"),
sect_offset_str (child_die->sect_off),
objfile_name (objfile));
continue;
@@ -12647,8 +12445,8 @@ read_call_site_scope (struct die_info *die, struct dwarf2_cu *cu)
if (attr != nullptr)
{
if (!attr->form_is_block ())
- complaint (_("No DW_FORM_block* DW_AT_call_data_value for "
- "DW_TAG_call_site child DIE %s [in module %s]"),
+ complaint (_ ("No DW_FORM_block* DW_AT_call_data_value for "
+ "DW_TAG_call_site child DIE %s [in module %s]"),
sect_offset_str (child_die->sect_off),
objfile_name (objfile));
else
@@ -12721,8 +12519,8 @@ read_variable (struct die_info *die, struct dwarf2_cu *cu)
struct die_info *origin_die
= follow_die_ref (die, abstract_origin, &origin_cu);
dwarf2_per_objfile *per_objfile = cu->per_objfile;
- per_objfile->per_bfd->abstract_to_concrete
- [origin_die->sect_off].push_back (die->sect_off);
+ per_objfile->per_bfd->abstract_to_concrete[origin_die->sect_off]
+ .push_back (die->sect_off);
}
}
@@ -12733,10 +12531,10 @@ read_variable (struct die_info *die, struct dwarf2_cu *cu)
Return true if the attributes are present and valid, otherwise,
return false. */
-template <typename Callback>
+template<typename Callback>
static bool
-dwarf2_rnglists_process (unsigned offset, struct dwarf2_cu *cu,
- dwarf_tag tag, Callback &&callback)
+dwarf2_rnglists_process (unsigned offset, struct dwarf2_cu *cu, dwarf_tag tag,
+ Callback &&callback)
{
dwarf2_per_objfile *per_objfile = cu->per_objfile;
struct objfile *objfile = per_objfile->objfile;
@@ -12754,7 +12552,7 @@ dwarf2_rnglists_process (unsigned offset, struct dwarf2_cu *cu,
if (offset >= rnglists_section->size)
{
- complaint (_("Offset %d out of bounds for DW_AT_ranges attribute"),
+ complaint (_ ("Offset %d out of bounds for DW_AT_ranges attribute"),
offset);
return false;
}
@@ -12764,8 +12562,8 @@ dwarf2_rnglists_process (unsigned offset, struct dwarf2_cu *cu,
{
/* Initialize it due to a false compiler warning. */
CORE_ADDR range_beginning = 0, range_end = 0;
- const gdb_byte *buf_end = (rnglists_section->buffer
- + rnglists_section->size);
+ const gdb_byte *buf_end
+ = (rnglists_section->buffer + rnglists_section->size);
unsigned int bytes_read;
if (buffer == buf_end)
@@ -12773,7 +12571,7 @@ dwarf2_rnglists_process (unsigned offset, struct dwarf2_cu *cu,
overflow = true;
break;
}
- const auto rlet = static_cast<enum dwarf_range_list_entry>(*buffer++);
+ const auto rlet = static_cast<enum dwarf_range_list_entry> (*buffer++);
switch (rlet)
{
case DW_RLE_end_of_list:
@@ -12798,8 +12596,8 @@ dwarf2_rnglists_process (unsigned offset, struct dwarf2_cu *cu,
overflow = true;
break;
}
- range_beginning = cu->header.read_address (obfd, buffer,
- &bytes_read);
+ range_beginning
+ = cu->header.read_address (obfd, buffer, &bytes_read);
buffer += bytes_read;
range_end = (range_beginning
+ read_unsigned_leb128 (obfd, buffer, &bytes_read));
@@ -12845,8 +12643,8 @@ dwarf2_rnglists_process (unsigned offset, struct dwarf2_cu *cu,
overflow = true;
break;
}
- range_beginning = cu->header.read_address (obfd, buffer,
- &bytes_read);
+ range_beginning
+ = cu->header.read_address (obfd, buffer, &bytes_read);
buffer += bytes_read;
range_end = cu->header.read_address (obfd, buffer, &bytes_read);
buffer += bytes_read;
@@ -12865,7 +12663,7 @@ dwarf2_rnglists_process (unsigned offset, struct dwarf2_cu *cu,
range_end = read_addr_index (cu, addr_index);
break;
default:
- complaint (_("Invalid .debug_rnglists data (no base address)"));
+ complaint (_ ("Invalid .debug_rnglists data (no base address)"));
return false;
}
if (rlet == DW_RLE_end_of_list || overflow)
@@ -12876,7 +12674,7 @@ dwarf2_rnglists_process (unsigned offset, struct dwarf2_cu *cu,
if (range_beginning > range_end)
{
/* Inverted range entries are invalid. */
- complaint (_("Invalid .debug_rnglists data (inverted range)"));
+ complaint (_ ("Invalid .debug_rnglists data (inverted range)"));
return false;
}
@@ -12890,8 +12688,9 @@ dwarf2_rnglists_process (unsigned offset, struct dwarf2_cu *cu,
if (!base.has_value ())
{
/* We have no valid base address for the DW_RLE_offset_pair. */
- complaint (_("Invalid .debug_rnglists data (no base address for "
- "DW_RLE_offset_pair)"));
+ complaint (
+ _ ("Invalid .debug_rnglists data (no base address for "
+ "DW_RLE_offset_pair)"));
return false;
}
@@ -12901,11 +12700,11 @@ dwarf2_rnglists_process (unsigned offset, struct dwarf2_cu *cu,
/* A not-uncommon case of bad debug info.
Don't pollute the addrmap with bad data. */
- if (range_beginning == 0
- && !per_objfile->per_bfd->has_section_at_zero)
+ if (range_beginning == 0 && !per_objfile->per_bfd->has_section_at_zero)
{
- complaint (_(".debug_rnglists entry has start address of zero"
- " [in module %s]"), objfile_name (objfile));
+ complaint (_ (".debug_rnglists entry has start address of zero"
+ " [in module %s]"),
+ objfile_name (objfile));
continue;
}
@@ -12914,8 +12713,8 @@ dwarf2_rnglists_process (unsigned offset, struct dwarf2_cu *cu,
if (overflow)
{
- complaint (_("Offset %d is not terminated "
- "for DW_AT_ranges attribute"),
+ complaint (_ ("Offset %d is not terminated "
+ "for DW_AT_ranges attribute"),
offset);
return false;
}
@@ -12928,7 +12727,7 @@ dwarf2_rnglists_process (unsigned offset, struct dwarf2_cu *cu,
void (CORE_ADDR range_beginning, CORE_ADDR range_end)
Return 1 if the attributes are present and valid, otherwise, return 0. */
-template <typename Callback>
+template<typename Callback>
static int
dwarf2_ranges_process (unsigned offset, struct dwarf2_cu *cu, dwarf_tag tag,
Callback &&callback)
@@ -12938,7 +12737,7 @@ dwarf2_ranges_process (unsigned offset, struct dwarf2_cu *cu, dwarf_tag tag,
struct comp_unit_head *cu_header = &cu->header;
bfd *obfd = objfile->obfd.get ();
unsigned int addr_size = cu_header->addr_size;
- CORE_ADDR mask = ~(~(CORE_ADDR)1 << (addr_size * 8 - 1));
+ CORE_ADDR mask = ~(~(CORE_ADDR) 1 << (addr_size * 8 - 1));
/* Base address selection entry. */
gdb::optional<CORE_ADDR> base;
unsigned int dummy;
@@ -12952,7 +12751,7 @@ dwarf2_ranges_process (unsigned offset, struct dwarf2_cu *cu, dwarf_tag tag,
per_objfile->per_bfd->ranges.read (objfile);
if (offset >= per_objfile->per_bfd->ranges.size)
{
- complaint (_("Offset %d out of bounds for DW_AT_ranges attribute"),
+ complaint (_ ("Offset %d out of bounds for DW_AT_ranges attribute"),
offset);
return 0;
}
@@ -12988,14 +12787,14 @@ dwarf2_ranges_process (unsigned offset, struct dwarf2_cu *cu, dwarf_tag tag,
{
/* We have no valid base address for the ranges
data. */
- complaint (_("Invalid .debug_ranges data (no base address)"));
+ complaint (_ ("Invalid .debug_ranges data (no base address)"));
return 0;
}
if (range_beginning > range_end)
{
/* Inverted range entries are invalid. */
- complaint (_("Invalid .debug_ranges data (inverted range)"));
+ complaint (_ ("Invalid .debug_ranges data (inverted range)"));
return 0;
}
@@ -13008,11 +12807,11 @@ dwarf2_ranges_process (unsigned offset, struct dwarf2_cu *cu, dwarf_tag tag,
/* A not-uncommon case of bad debug info.
Don't pollute the addrmap with bad data. */
- if (range_beginning == 0
- && !per_objfile->per_bfd->has_section_at_zero)
+ if (range_beginning == 0 && !per_objfile->per_bfd->has_section_at_zero)
{
- complaint (_(".debug_ranges entry has start address of zero"
- " [in module %s]"), objfile_name (objfile));
+ complaint (_ (".debug_ranges entry has start address of zero"
+ " [in module %s]"),
+ objfile_name (objfile));
continue;
}
@@ -13029,8 +12828,8 @@ dwarf2_ranges_process (unsigned offset, struct dwarf2_cu *cu, dwarf_tag tag,
static int
dwarf2_ranges_read (unsigned offset, CORE_ADDR *low_return,
- CORE_ADDR *high_return, struct dwarf2_cu *cu,
- addrmap *map, void *datum, dwarf_tag tag)
+ CORE_ADDR *high_return, struct dwarf2_cu *cu, addrmap *map,
+ void *datum, dwarf_tag tag)
{
struct objfile *objfile = cu->per_objfile->objfile;
struct gdbarch *gdbarch = objfile->arch ();
@@ -13041,44 +12840,43 @@ dwarf2_ranges_read (unsigned offset, CORE_ADDR *low_return,
int retval;
retval = dwarf2_ranges_process (offset, cu, tag,
- [&] (CORE_ADDR range_beginning, CORE_ADDR range_end)
- {
- if (map != nullptr)
- {
- CORE_ADDR lowpc;
- CORE_ADDR highpc;
-
- lowpc = (gdbarch_adjust_dwarf2_addr (gdbarch,
- range_beginning + baseaddr)
- - baseaddr);
- highpc = (gdbarch_adjust_dwarf2_addr (gdbarch,
- range_end + baseaddr)
- - baseaddr);
- map->set_empty (lowpc, highpc - 1, datum);
- }
+ [&] (CORE_ADDR range_beginning,
+ CORE_ADDR range_end) {
+ if (map != nullptr)
+ {
+ CORE_ADDR lowpc;
+ CORE_ADDR highpc;
+
+ lowpc
+ = (gdbarch_adjust_dwarf2_addr (gdbarch, range_beginning + baseaddr)
+ - baseaddr);
+ highpc = (gdbarch_adjust_dwarf2_addr (gdbarch, range_end + baseaddr)
+ - baseaddr);
+ map->set_empty (lowpc, highpc - 1, datum);
+ }
- /* FIXME: This is recording everything as a low-high
+ /* FIXME: This is recording everything as a low-high
segment of consecutive addresses. We should have a
data structure for discontiguous block ranges
instead. */
- if (! low_set)
- {
+ if (!low_set)
+ {
+ low = range_beginning;
+ high = range_end;
+ low_set = 1;
+ }
+ else
+ {
+ if (range_beginning < low)
low = range_beginning;
+ if (range_end > high)
high = range_end;
- low_set = 1;
- }
- else
- {
- if (range_beginning < low)
- low = range_beginning;
- if (range_end > high)
- high = range_end;
- }
- });
+ }
+ });
if (!retval)
return 0;
- if (! low_set)
+ if (!low_set)
/* If the first entry is an end-of-list marker, the range
describes an empty scope, i.e. no instructions. */
return 0;
@@ -13094,14 +12892,12 @@ dwarf2_ranges_read (unsigned offset, CORE_ADDR *low_return,
static void
dwarf2_ranges_read_low_addrs (unsigned offset, struct dwarf2_cu *cu,
- dwarf_tag tag,
- std::vector<CORE_ADDR> &result)
+ dwarf_tag tag, std::vector<CORE_ADDR> &result)
{
dwarf2_ranges_process (offset, cu, tag,
- [&] (CORE_ADDR start, CORE_ADDR end)
- {
- result.push_back (start);
- });
+ [&] (CORE_ADDR start, CORE_ADDR end) {
+ result.push_back (start);
+ });
}
/* Get low and high pc attributes from a die. See enum pc_bounds_kind
@@ -13110,8 +12906,8 @@ dwarf2_ranges_read_low_addrs (unsigned offset, struct dwarf2_cu *cu,
static enum pc_bounds_kind
dwarf2_get_pc_bounds (struct die_info *die, CORE_ADDR *lowpc,
- CORE_ADDR *highpc, struct dwarf2_cu *cu,
- addrmap *map, void *datum)
+ CORE_ADDR *highpc, struct dwarf2_cu *cu, addrmap *map,
+ void *datum)
{
dwarf2_per_objfile *per_objfile = cu->per_objfile;
struct attribute *attr;
@@ -13154,8 +12950,8 @@ dwarf2_get_pc_bounds (struct die_info *die, CORE_ADDR *lowpc,
/* Value of the DW_AT_ranges attribute is the offset in the
.debug_ranges section. */
- if (!dwarf2_ranges_read (ranges_offset, &low, &high, cu,
- map, datum, die->tag))
+ if (!dwarf2_ranges_read (ranges_offset, &low, &high, cu, map, datum,
+ die->tag))
return PC_BOUNDS_INVALID;
/* Found discontinuous range of addresses. */
ret = PC_BOUNDS_RANGES;
@@ -13191,9 +12987,8 @@ dwarf2_get_pc_bounds (struct die_info *die, CORE_ADDR *lowpc,
and HIGHPC to the high address if greater than HIGHPC. */
static void
-dwarf2_get_subprogram_pc_bounds (struct die_info *die,
- CORE_ADDR *lowpc, CORE_ADDR *highpc,
- struct dwarf2_cu *cu)
+dwarf2_get_subprogram_pc_bounds (struct die_info *die, CORE_ADDR *lowpc,
+ CORE_ADDR *highpc, struct dwarf2_cu *cu)
{
CORE_ADDR low, high;
struct die_info *child = die->child;
@@ -13228,16 +13023,15 @@ dwarf2_get_subprogram_pc_bounds (struct die_info *die,
determined, set *LOWPC to -1 and *HIGHPC to 0. */
static void
-get_scope_pc_bounds (struct die_info *die,
- CORE_ADDR *lowpc, CORE_ADDR *highpc,
+get_scope_pc_bounds (struct die_info *die, CORE_ADDR *lowpc, CORE_ADDR *highpc,
struct dwarf2_cu *cu)
{
CORE_ADDR best_low = (CORE_ADDR) -1;
CORE_ADDR best_high = (CORE_ADDR) 0;
CORE_ADDR current_low, current_high;
- if (dwarf2_get_pc_bounds (die, &current_low, &current_high, cu,
- nullptr, nullptr)
+ if (dwarf2_get_pc_bounds (die, &current_low, &current_high, cu, nullptr,
+ nullptr)
>= PC_BOUNDS_RANGES)
{
best_low = current_low;
@@ -13249,13 +13043,15 @@ get_scope_pc_bounds (struct die_info *die,
while (child && child->tag)
{
- switch (child->tag) {
- case DW_TAG_subprogram:
- dwarf2_get_subprogram_pc_bounds (child, &best_low, &best_high, cu);
- break;
- case DW_TAG_namespace:
- case DW_TAG_module:
- /* FIXME: carlton/2004-01-16: Should we do this for
+ switch (child->tag)
+ {
+ case DW_TAG_subprogram:
+ dwarf2_get_subprogram_pc_bounds (child, &best_low, &best_high,
+ cu);
+ break;
+ case DW_TAG_namespace:
+ case DW_TAG_module:
+ /* FIXME: carlton/2004-01-16: Should we do this for
DW_TAG_class_type/DW_TAG_structure_type, too? I think
that current GCC's always emit the DIEs corresponding
to definitions of methods of classes as children of a
@@ -13263,18 +13059,18 @@ get_scope_pc_bounds (struct die_info *die,
the DIEs giving the declarations, which could be
anywhere). But I don't see any reason why the
standards says that they have to be there. */
- get_scope_pc_bounds (child, &current_low, &current_high, cu);
+ get_scope_pc_bounds (child, &current_low, &current_high, cu);
- if (current_low != ((CORE_ADDR) -1))
- {
- best_low = std::min (best_low, current_low);
- best_high = std::max (best_high, current_high);
- }
- break;
- default:
- /* Ignore. */
- break;
- }
+ if (current_low != ((CORE_ADDR) -1))
+ {
+ best_low = std::min (best_low, current_low);
+ best_high = std::max (best_high, current_high);
+ }
+ break;
+ default:
+ /* Ignore. */
+ break;
+ }
child = child->sibling;
}
@@ -13328,15 +13124,14 @@ dwarf2_record_block_ranges (struct die_info *die, struct block *block,
std::vector<blockrange> blockvec;
dwarf2_ranges_process (ranges_offset, cu, die->tag,
- [&] (CORE_ADDR start, CORE_ADDR end)
- {
- start += baseaddr;
- end += baseaddr;
- start = gdbarch_adjust_dwarf2_addr (gdbarch, start);
- end = gdbarch_adjust_dwarf2_addr (gdbarch, end);
- cu->get_builder ()->record_block_range (block, start, end - 1);
- blockvec.emplace_back (start, end);
- });
+ [&] (CORE_ADDR start, CORE_ADDR end) {
+ start += baseaddr;
+ end += baseaddr;
+ start = gdbarch_adjust_dwarf2_addr (gdbarch, start);
+ end = gdbarch_adjust_dwarf2_addr (gdbarch, end);
+ cu->get_builder ()->record_block_range (block, start, end - 1);
+ blockvec.emplace_back (start, end);
+ });
block->set_ranges (make_blockranges (objfile, blockvec));
}
@@ -13398,7 +13193,6 @@ producer_is_gxx_lt_4_6 (struct dwarf2_cu *cu)
return cu->producer_is_gxx_lt_4_6;
}
-
/* Codewarrior (at least as of version 5.0.40) generates dwarf line information
with incorrect is_stmt attributes. */
@@ -13422,11 +13216,10 @@ dwarf2_access_attribute (struct die_info *die, struct dwarf2_cu *cu)
if (attr != nullptr)
{
LONGEST value = attr->constant_value (-1);
- if (value == DW_ACCESS_public
- || value == DW_ACCESS_protected
+ if (value == DW_ACCESS_public || value == DW_ACCESS_protected
|| value == DW_ACCESS_private)
return (dwarf_access_attribute) value;
- complaint (_("Unhandled DW_AT_accessibility value (%s)"),
+ complaint (_ ("Unhandled DW_AT_accessibility value (%s)"),
plongest (value));
}
@@ -13521,7 +13314,8 @@ handle_member_location (struct die_info *die, struct dwarf2_cu *cu,
*/
if (offset == -1 && cu->producer_is_gcc_11)
{
- complaint (_("DW_AT_data_member_location value of -1, assuming 0"));
+ complaint (
+ _ ("DW_AT_data_member_location value of -1, assuming 0"));
offset = 0;
}
@@ -13607,17 +13401,17 @@ dwarf2_add_field (struct field_info *fip, struct die_info *die,
&& !die_is_declaration (die, cu))
{
if (die->tag == DW_TAG_namelist_item)
- {
+ {
/* Typically, DW_TAG_namelist_item are references to namelist items.
If so, follow that reference. */
struct attribute *attr1 = dwarf2_attr (die, DW_AT_namelist_item, cu);
struct die_info *item_die = nullptr;
struct dwarf2_cu *item_cu = cu;
- if (attr1->form_is_ref ())
+ if (attr1->form_is_ref ())
item_die = follow_die_ref (die, attr1, &item_cu);
if (item_die != nullptr)
die = item_die;
- }
+ }
/* Data member other than a C++ static data member. */
/* Get type of field. */
@@ -13648,7 +13442,8 @@ dwarf2_add_field (struct field_info *fip, struct die_info *die,
anonymous object to the MSB of the field. We don't
have to do anything special since we don't need to
know the size of the anonymous object. */
- fp->set_loc_bitpos (fp->loc_bitpos () + attr->constant_value (0));
+ fp->set_loc_bitpos (fp->loc_bitpos ()
+ + attr->constant_value (0));
}
else
{
@@ -13678,8 +13473,8 @@ dwarf2_add_field (struct field_info *fip, struct die_info *die,
anonymous_size = fp->type ()->length ();
}
fp->set_loc_bitpos (fp->loc_bitpos ()
- + anonymous_size * bits_per_byte
- - bit_offset - FIELD_BITSIZE (*fp));
+ + anonymous_size * bits_per_byte - bit_offset
+ - FIELD_BITSIZE (*fp));
}
}
@@ -13828,7 +13623,7 @@ convert_variant_range (struct obstack *obstack, const variant_field &variant,
if (variant.discr_list_data == nullptr)
{
discriminant_range r
- = {variant.discriminant_value, variant.discriminant_value};
+ = { variant.discriminant_value, variant.discriminant_value };
ranges.push_back (r);
}
else
@@ -13839,7 +13634,7 @@ convert_variant_range (struct obstack *obstack, const variant_field &variant,
{
if (data[0] != DW_DSC_range && data[0] != DW_DSC_label)
{
- complaint (_("invalid discriminant marker: %d"), data[0]);
+ complaint (_ ("invalid discriminant marker: %d"), data[0]);
break;
}
bool is_range = data[0] == DW_DSC_range;
@@ -13850,7 +13645,7 @@ convert_variant_range (struct obstack *obstack, const variant_field &variant,
if (data.empty ())
{
- complaint (_("DW_AT_discr_list missing low value"));
+ complaint (_ ("DW_AT_discr_list missing low value"));
break;
}
if (is_unsigned)
@@ -13864,12 +13659,12 @@ convert_variant_range (struct obstack *obstack, const variant_field &variant,
{
if (data.empty ())
{
- complaint (_("DW_AT_discr_list missing high value"));
+ complaint (_ ("DW_AT_discr_list missing high value"));
break;
}
if (is_unsigned)
- high = read_unsigned_leb128 (nullptr, data.data (),
- &bytes_read);
+ high
+ = read_unsigned_leb128 (nullptr, data.data (), &bytes_read);
else
high = (LONGEST) read_signed_leb128 (nullptr, data.data (),
&bytes_read);
@@ -13882,17 +13677,16 @@ convert_variant_range (struct obstack *obstack, const variant_field &variant,
}
}
- discriminant_range *result = XOBNEWVEC (obstack, discriminant_range,
- ranges.size ());
+ discriminant_range *result
+ = XOBNEWVEC (obstack, discriminant_range, ranges.size ());
std::copy (ranges.begin (), ranges.end (), result);
return gdb::array_view<discriminant_range> (result, ranges.size ());
}
-static const gdb::array_view<variant_part> create_variant_parts
- (struct obstack *obstack,
- const offset_map_type &offset_map,
- struct field_info *fi,
- const std::vector<variant_part_builder> &variant_parts);
+static const gdb::array_view<variant_part>
+create_variant_parts (struct obstack *obstack,
+ const offset_map_type &offset_map, struct field_info *fi,
+ const std::vector<variant_part_builder> &variant_parts);
/* Fill in a "struct variant" for a given variant field. RESULT is
the variant to fill in. OBSTACK is where any needed allocations
@@ -13902,14 +13696,14 @@ static const gdb::array_view<variant_part> create_variant_parts
static void
create_one_variant (variant &result, struct obstack *obstack,
- const offset_map_type &offset_map,
- struct field_info *fi, const variant_field &field)
+ const offset_map_type &offset_map, struct field_info *fi,
+ const variant_field &field)
{
result.discriminants = convert_variant_range (obstack, field, false);
result.first_field = field.first_field + fi->baseclasses.size ();
result.last_field = field.last_field + fi->baseclasses.size ();
- result.parts = create_variant_parts (obstack, offset_map, fi,
- field.variant_parts);
+ result.parts
+ = create_variant_parts (obstack, offset_map, fi, field.variant_parts);
}
/* Fill in a "struct variant_part" for a given variant part. RESULT
@@ -13920,8 +13714,7 @@ create_one_variant (variant &result, struct obstack *obstack,
converted. */
static void
-create_one_variant_part (variant_part &result,
- struct obstack *obstack,
+create_one_variant_part (variant_part &result, struct obstack *obstack,
const offset_map_type &offset_map,
struct field_info *fi,
const variant_part_builder &builder)
@@ -13957,8 +13750,7 @@ create_one_variant_part (variant_part &result,
static const gdb::array_view<variant_part>
create_variant_parts (struct obstack *obstack,
- const offset_map_type &offset_map,
- struct field_info *fi,
+ const offset_map_type &offset_map, struct field_info *fi,
const std::vector<variant_part_builder> &variant_parts)
{
if (variant_parts.empty ())
@@ -13993,9 +13785,8 @@ add_variant_property (struct field_info *fip, struct type *type,
fip->variant_parts);
struct dynamic_prop prop;
- prop.set_variant_parts ((gdb::array_view<variant_part> *)
- obstack_copy (&objfile->objfile_obstack, &parts,
- sizeof (parts)));
+ prop.set_variant_parts ((gdb::array_view<variant_part> *) obstack_copy (
+ &objfile->objfile_obstack, &parts, sizeof (parts)));
type->add_dyn_prop (DYN_PROP_VARIANT_PARTS, prop);
}
@@ -14011,23 +13802,23 @@ dwarf2_attach_fields_to_type (struct field_info *fip, struct type *type,
/* Record the field count, allocate space for the array of fields,
and create blank accessibility bitfields if necessary. */
type->set_num_fields (nfields);
- type->set_fields
- ((struct field *) TYPE_ZALLOC (type, sizeof (struct field) * nfields));
+ type->set_fields ((struct field *) TYPE_ZALLOC (type, sizeof (struct field)
+ * nfields));
if (fip->non_public_fields && cu->lang () != language_ada)
{
ALLOCATE_CPLUS_STRUCT_TYPE (type);
- TYPE_FIELD_PRIVATE_BITS (type) =
- (B_TYPE *) TYPE_ALLOC (type, B_BYTES (nfields));
+ TYPE_FIELD_PRIVATE_BITS (type)
+ = (B_TYPE *) TYPE_ALLOC (type, B_BYTES (nfields));
B_CLRALL (TYPE_FIELD_PRIVATE_BITS (type), nfields);
- TYPE_FIELD_PROTECTED_BITS (type) =
- (B_TYPE *) TYPE_ALLOC (type, B_BYTES (nfields));
+ TYPE_FIELD_PROTECTED_BITS (type)
+ = (B_TYPE *) TYPE_ALLOC (type, B_BYTES (nfields));
B_CLRALL (TYPE_FIELD_PROTECTED_BITS (type), nfields);
- TYPE_FIELD_IGNORE_BITS (type) =
- (B_TYPE *) TYPE_ALLOC (type, B_BYTES (nfields));
+ TYPE_FIELD_IGNORE_BITS (type)
+ = (B_TYPE *) TYPE_ALLOC (type, B_BYTES (nfields));
B_CLRALL (TYPE_FIELD_IGNORE_BITS (type), nfields);
}
@@ -14052,8 +13843,9 @@ dwarf2_attach_fields_to_type (struct field_info *fip, struct type *type,
for (int i = 0; i < nfields; ++i)
{
struct nextfield &field
- = ((i < fip->baseclasses.size ()) ? fip->baseclasses[i]
- : fip->fields[i - fip->baseclasses.size ()]);
+ = ((i < fip->baseclasses.size ())
+ ? fip->baseclasses[i]
+ : fip->fields[i - fip->baseclasses.size ()]);
type->field (i) = field.field;
switch (field.accessibility)
@@ -14074,7 +13866,7 @@ dwarf2_attach_fields_to_type (struct field_info *fip, struct type *type,
default:
/* Unknown accessibility. Complain and treat it as public. */
{
- complaint (_("unsupported accessibility %d"),
+ complaint (_ ("unsupported accessibility %d"),
field.accessibility);
}
break;
@@ -14086,7 +13878,7 @@ dwarf2_attach_fields_to_type (struct field_info *fip, struct type *type,
case DW_VIRTUALITY_virtual:
case DW_VIRTUALITY_pure_virtual:
if (cu->lang () == language_ada)
- error (_("unexpected virtuality in component of Ada type"));
+ error (_ ("unexpected virtuality in component of Ada type"));
SET_TYPE_FIELD_VIRTUAL (type, i);
break;
}
@@ -14137,7 +13929,7 @@ dwarf2_add_member_fn (struct field_info *fip, struct die_info *die,
struct type *this_type;
if (cu->lang () == language_ada)
- error (_("unexpected member function in Ada type"));
+ error (_ ("unexpected member function in Ada type"));
/* Get name of member function. */
fieldname = dwarf2_name (die, cu);
@@ -14170,8 +13962,8 @@ dwarf2_add_member_fn (struct field_info *fip, struct die_info *die,
/* Delay processing of the physname until later. */
if (cu->lang () == language_cplus)
- add_to_method_list (type, i, flp->fnfields.size () - 1, fieldname,
- die, cu);
+ add_to_method_list (type, i, flp->fnfields.size () - 1, fieldname, die,
+ cu);
else
{
const char *physname = dwarf2_physname (fieldname, die, cu);
@@ -14186,10 +13978,8 @@ dwarf2_add_member_fn (struct field_info *fip, struct die_info *die,
/* TYPE is the domain of this method, and THIS_TYPE is the type
of the method itself (TYPE_CODE_METHOD). */
- smash_to_method_type (fnp->type, type,
- this_type->target_type (),
- this_type->fields (),
- this_type->num_fields (),
+ smash_to_method_type (fnp->type, type, this_type->target_type (),
+ this_type->fields (), this_type->num_fields (),
this_type->has_varargs ());
/* Handle static member functions.
@@ -14202,7 +13992,7 @@ dwarf2_add_member_fn (struct field_info *fip, struct die_info *die,
fnp->voffset = VOFFSET_STATIC;
}
else
- complaint (_("member function type missing for '%s'"),
+ complaint (_ ("member function type missing for '%s'"),
dwarf2_full_name (fieldname, die, cu));
/* Get fcontext from DW_AT_containing_type if present. */
@@ -14260,8 +14050,7 @@ dwarf2_add_member_fn (struct field_info *fip, struct die_info *die,
fnp->voffset = decode_locdesc (block, cu) + 2;
}
else if (block->data[0] == DW_OP_deref
- || (block->size > 1
- && block->data[0] == DW_OP_deref_size
+ || (block->size > 1 && block->data[0] == DW_OP_deref_size
&& block->data[1] == cu->header.addr_size))
{
fnp->voffset = decode_locdesc (block, cu);
@@ -14282,8 +14071,8 @@ dwarf2_add_member_fn (struct field_info *fip, struct die_info *die,
if (this_type->num_fields () == 0
|| !TYPE_FIELD_ARTIFICIAL (this_type, 0))
{
- complaint (_("cannot determine context for virtual member "
- "function \"%s\" (offset %s)"),
+ complaint (_ ("cannot determine context for virtual member "
+ "function \"%s\" (offset %s)"),
fieldname, sect_offset_str (die->sect_off));
}
else
@@ -14308,8 +14097,8 @@ dwarf2_add_member_fn (struct field_info *fip, struct die_info *die,
if (attr != nullptr && attr->as_virtuality () != DW_VIRTUALITY_none)
{
/* GCC does this, as of 2008-08-25; PR debug/37237. */
- complaint (_("Member function \"%s\" (offset %s) is virtual "
- "but the vtable offset is not specified"),
+ complaint (_ ("Member function \"%s\" (offset %s) is virtual "
+ "but the vtable offset is not specified"),
fieldname, sect_offset_str (die->sect_off));
ALLOCATE_CPLUS_STRUCT_TYPE (type);
TYPE_CPLUS_DYNAMIC (type) = 1;
@@ -14324,12 +14113,12 @@ dwarf2_attach_fn_fields_to_type (struct field_info *fip, struct type *type,
struct dwarf2_cu *cu)
{
if (cu->lang () == language_ada)
- error (_("unexpected member functions in Ada type"));
+ error (_ ("unexpected member functions in Ada type"));
ALLOCATE_CPLUS_STRUCT_TYPE (type);
- TYPE_FN_FIELDLISTS (type) = (struct fn_fieldlist *)
- TYPE_ALLOC (type,
- sizeof (struct fn_fieldlist) * fip->fnfieldlists.size ());
+ TYPE_FN_FIELDLISTS (type)
+ = (struct fn_fieldlist *) TYPE_ALLOC (type, sizeof (struct fn_fieldlist)
+ * fip->fnfieldlists.size ());
for (int i = 0; i < fip->fnfieldlists.size (); i++)
{
@@ -14338,8 +14127,9 @@ dwarf2_attach_fn_fields_to_type (struct field_info *fip, struct type *type,
TYPE_FN_FIELDLIST_NAME (type, i) = nf.name;
TYPE_FN_FIELDLIST_LENGTH (type, i) = nf.fnfields.size ();
- fn_flp->fn_fields = (struct fn_field *)
- TYPE_ALLOC (type, sizeof (struct fn_field) * nf.fnfields.size ());
+ fn_flp->fn_fields
+ = (struct fn_field *) TYPE_ALLOC (type, sizeof (struct fn_field)
+ * nf.fnfields.size ());
for (int k = 0; k < nf.fnfields.size (); ++k)
fn_flp->fn_fields[k] = nf.fnfields[k];
@@ -14387,8 +14177,7 @@ quirk_gcc_member_function_pointer (struct type *type, struct objfile *objfile)
/* Find the type of the method. */
pfn_type = type->field (0).type ();
- if (pfn_type == NULL
- || pfn_type->code () != TYPE_CODE_PTR
+ if (pfn_type == NULL || pfn_type->code () != TYPE_CODE_PTR
|| pfn_type->target_type ()->code () != TYPE_CODE_FUNC)
return;
@@ -14436,8 +14225,7 @@ rewrite_array_type (struct type *type)
struct type *copy = copy_type (type);
int nfields = copy->num_fields ();
field *new_fields
- = ((struct field *) TYPE_ZALLOC (copy,
- nfields * sizeof (struct field)));
+ = ((struct field *) TYPE_ZALLOC (copy, nfields * sizeof (struct field)));
memcpy (new_fields, copy->fields (), nfields * sizeof (struct field));
copy->set_fields (new_fields);
if (new_target != nullptr)
@@ -14445,8 +14233,7 @@ rewrite_array_type (struct type *type)
struct type *index_copy = copy_type (index_type);
range_bounds *bounds
- = (struct range_bounds *) TYPE_ZALLOC (index_copy,
- sizeof (range_bounds));
+ = (struct range_bounds *) TYPE_ZALLOC (index_copy, sizeof (range_bounds));
*bounds = *current_bounds;
bounds->low.set_const_val (1);
bounds->high.set_const_val (0);
@@ -14508,8 +14295,8 @@ get_alignment (struct dwarf2_cu *cu, struct die_info *die)
if (!attr->form_is_constant ())
{
- complaint (_("DW_AT_alignment must have constant form"
- " - DIE at %s [in module %s]"),
+ complaint (_ ("DW_AT_alignment must have constant form"
+ " - DIE at %s [in module %s]"),
sect_offset_str (die->sect_off),
objfile_name (cu->per_objfile->objfile));
return 0;
@@ -14518,8 +14305,8 @@ get_alignment (struct dwarf2_cu *cu, struct die_info *die)
LONGEST val = attr->constant_value (0);
if (val < 0)
{
- complaint (_("DW_AT_alignment value must not be negative"
- " - DIE at %s [in module %s]"),
+ complaint (_ ("DW_AT_alignment value must not be negative"
+ " - DIE at %s [in module %s]"),
sect_offset_str (die->sect_off),
objfile_name (cu->per_objfile->objfile));
return 0;
@@ -14528,16 +14315,16 @@ get_alignment (struct dwarf2_cu *cu, struct die_info *die)
if (align == 0)
{
- complaint (_("DW_AT_alignment value must not be zero"
- " - DIE at %s [in module %s]"),
+ complaint (_ ("DW_AT_alignment value must not be zero"
+ " - DIE at %s [in module %s]"),
sect_offset_str (die->sect_off),
objfile_name (cu->per_objfile->objfile));
return 0;
}
if ((align & (align - 1)) != 0)
{
- complaint (_("DW_AT_alignment value must be a power of 2"
- " - DIE at %s [in module %s]"),
+ complaint (_ ("DW_AT_alignment value must be a power of 2"
+ " - DIE at %s [in module %s]"),
sect_offset_str (die->sect_off),
objfile_name (cu->per_objfile->objfile));
return 0;
@@ -14554,8 +14341,8 @@ maybe_set_alignment (struct dwarf2_cu *cu, struct die_info *die,
struct type *type)
{
if (!set_type_align (type, get_alignment (cu, die)))
- complaint (_("DW_AT_alignment value too large"
- " - DIE at %s [in module %s]"),
+ complaint (_ ("DW_AT_alignment value too large"
+ " - DIE at %s [in module %s]"),
sect_offset_str (die->sect_off),
objfile_name (cu->per_objfile->objfile));
}
@@ -14574,8 +14361,9 @@ is_valid_DW_AT_calling_convention_for_type (ULONGEST value)
return true;
default:
- complaint (_("unrecognized DW_AT_calling_convention value "
- "(%s) for a type"), pulongest (value));
+ complaint (_ ("unrecognized DW_AT_calling_convention value "
+ "(%s) for a type"),
+ pulongest (value));
return false;
}
}
@@ -14600,8 +14388,9 @@ is_valid_DW_AT_calling_convention_for_subroutine (ULONGEST value)
return true;
default:
- complaint (_("unrecognized DW_AT_calling_convention value "
- "(%s) for a subroutine"), pulongest (value));
+ complaint (_ ("unrecognized DW_AT_calling_convention value "
+ "(%s) for a subroutine"),
+ pulongest (value));
return false;
}
}
@@ -14645,8 +14434,7 @@ read_structure_type (struct die_info *die, struct dwarf2_cu *cu)
name = dwarf2_name (die, cu);
if (name != NULL)
{
- if (cu->lang () == language_cplus
- || cu->lang () == language_d
+ if (cu->lang () == language_cplus || cu->lang () == language_d
|| cu->lang () == language_rust)
{
const char *full_name = dwarf2_full_name (name, die, cu);
@@ -14745,12 +14533,9 @@ read_structure_type (struct die_info *die, struct dwarf2_cu *cu)
return type;
}
-static void handle_struct_member_die
- (struct die_info *child_die,
- struct type *type,
- struct field_info *fi,
- std::vector<struct symbol *> *template_args,
- struct dwarf2_cu *cu);
+static void handle_struct_member_die (
+ struct die_info *child_die, struct type *type, struct field_info *fi,
+ std::vector<struct symbol *> *template_args, struct dwarf2_cu *cu);
/* A helper for handle_struct_member_die that handles
DW_TAG_variant_part. */
@@ -14769,8 +14554,8 @@ handle_variant_part (struct die_info *die, struct type *type,
}
else if (!fi->current_variant_part->processing_variant)
{
- complaint (_("nested DW_TAG_variant_part seen "
- "- DIE at %s [in module %s]"),
+ complaint (_ ("nested DW_TAG_variant_part seen "
+ "- DIE at %s [in module %s]"),
sect_offset_str (die->sect_off),
objfile_name (cu->per_objfile->objfile));
return;
@@ -14801,14 +14586,13 @@ handle_variant_part (struct die_info *die, struct type *type,
}
else
{
- complaint (_("DW_AT_discr does not have DIE reference form"
- " - DIE at %s [in module %s]"),
+ complaint (_ ("DW_AT_discr does not have DIE reference form"
+ " - DIE at %s [in module %s]"),
sect_offset_str (die->sect_off),
objfile_name (cu->per_objfile->objfile));
}
- for (die_info *child_die = die->child;
- child_die != NULL;
+ for (die_info *child_die = die->child; child_die != NULL;
child_die = child_die->sibling)
handle_struct_member_die (child_die, type, fi, template_args, cu);
}
@@ -14817,23 +14601,22 @@ handle_variant_part (struct die_info *die, struct type *type,
DW_TAG_variant. */
static void
-handle_variant (struct die_info *die, struct type *type,
- struct field_info *fi,
+handle_variant (struct die_info *die, struct type *type, struct field_info *fi,
std::vector<struct symbol *> *template_args,
struct dwarf2_cu *cu)
{
if (fi->current_variant_part == nullptr)
{
- complaint (_("saw DW_TAG_variant outside DW_TAG_variant_part "
- "- DIE at %s [in module %s]"),
+ complaint (_ ("saw DW_TAG_variant outside DW_TAG_variant_part "
+ "- DIE at %s [in module %s]"),
sect_offset_str (die->sect_off),
objfile_name (cu->per_objfile->objfile));
return;
}
if (fi->current_variant_part->processing_variant)
{
- complaint (_("nested DW_TAG_variant seen "
- "- DIE at %s [in module %s]"),
+ complaint (_ ("nested DW_TAG_variant seen "
+ "- DIE at %s [in module %s]"),
sect_offset_str (die->sect_off),
objfile_name (cu->per_objfile->objfile));
return;
@@ -14861,8 +14644,7 @@ handle_variant (struct die_info *die, struct type *type,
else
variant.discriminant_value = discr->constant_value (0);
- for (die_info *variant_child = die->child;
- variant_child != NULL;
+ for (die_info *variant_child = die->child; variant_child != NULL;
variant_child = variant_child->sibling)
handle_struct_member_die (variant_child, type, fi, template_args, cu);
@@ -14878,8 +14660,7 @@ handle_struct_member_die (struct die_info *child_die, struct type *type,
std::vector<struct symbol *> *template_args,
struct dwarf2_cu *cu)
{
- if (child_die->tag == DW_TAG_member
- || child_die->tag == DW_TAG_variable
+ if (child_die->tag == DW_TAG_member || child_die->tag == DW_TAG_variable
|| child_die->tag == DW_TAG_namelist_item)
{
/* NOTE: carlton/2002-11-05: A C++ static data member
@@ -14940,7 +14721,7 @@ process_structure_scope (struct die_info *die, struct dwarf2_cu *cu)
type = read_structure_type (die, cu);
bool has_template_parameters = false;
- if (die->child != NULL && ! die_is_declaration (die, cu))
+ if (die->child != NULL && !die_is_declaration (die, cu))
{
struct field_info fi;
std::vector<struct symbol *> template_args;
@@ -14960,11 +14741,9 @@ process_structure_scope (struct die_info *die, struct dwarf2_cu *cu)
ALLOCATE_CPLUS_STRUCT_TYPE (type);
TYPE_N_TEMPLATE_ARGUMENTS (type) = template_args.size ();
TYPE_TEMPLATE_ARGUMENTS (type)
- = XOBNEWVEC (&objfile->objfile_obstack,
- struct symbol *,
+ = XOBNEWVEC (&objfile->objfile_obstack, struct symbol *,
TYPE_N_TEMPLATE_ARGUMENTS (type));
- memcpy (TYPE_TEMPLATE_ARGUMENTS (type),
- template_args.data (),
+ memcpy (TYPE_TEMPLATE_ARGUMENTS (type), template_args.data (),
(TYPE_N_TEMPLATE_ARGUMENTS (type)
* sizeof (struct symbol *)));
}
@@ -14991,8 +14770,7 @@ process_structure_scope (struct die_info *die, struct dwarf2_cu *cu)
int i;
/* Our own class provides vtbl ptr. */
- for (i = t->num_fields () - 1;
- i >= TYPE_N_BASECLASSES (t);
+ for (i = t->num_fields () - 1; i >= TYPE_N_BASECLASSES (t);
--i)
{
const char *fieldname = t->field (i).name ();
@@ -15006,8 +14784,8 @@ process_structure_scope (struct die_info *die, struct dwarf2_cu *cu)
/* Complain if virtual function table field not found. */
if (i < TYPE_N_BASECLASSES (t))
- complaint (_("virtual function table pointer "
- "not found when defining class '%s'"),
+ complaint (_ ("virtual function table pointer "
+ "not found when defining class '%s'"),
type->name () ? type->name () : "");
}
else
@@ -15016,7 +14794,8 @@ process_structure_scope (struct die_info *die, struct dwarf2_cu *cu)
}
}
else if (cu->producer
- && startswith (cu->producer, "IBM(R) XL C/C++ Advanced Edition"))
+ && startswith (cu->producer,
+ "IBM(R) XL C/C++ Advanced Edition"))
{
/* The IBM XLC compiler does not provide direct indication
of the containing type, but the vtable pointer is
@@ -15024,8 +14803,7 @@ process_structure_scope (struct die_info *die, struct dwarf2_cu *cu)
int i;
- for (i = type->num_fields () - 1;
- i >= TYPE_N_BASECLASSES (type);
+ for (i = type->num_fields () - 1; i >= TYPE_N_BASECLASSES (type);
--i)
{
if (strcmp (type->field (i).name (), "__vfp") == 0)
@@ -15045,10 +14823,8 @@ process_structure_scope (struct die_info *die, struct dwarf2_cu *cu)
int count = fi.typedef_field_list.size ();
ALLOCATE_CPLUS_STRUCT_TYPE (type);
- TYPE_TYPEDEF_FIELD_ARRAY (type)
- = ((struct decl_field *)
- TYPE_ALLOC (type,
- sizeof (TYPE_TYPEDEF_FIELD (type, 0)) * count));
+ TYPE_TYPEDEF_FIELD_ARRAY (type) = ((struct decl_field *) TYPE_ALLOC (
+ type, sizeof (TYPE_TYPEDEF_FIELD (type, 0)) * count));
TYPE_TYPEDEF_FIELD_COUNT (type) = count;
for (int i = 0; i < fi.typedef_field_list.size (); ++i)
@@ -15057,15 +14833,13 @@ process_structure_scope (struct die_info *die, struct dwarf2_cu *cu)
/* Copy fi.nested_types_list linked list elements content into the
allocated array TYPE_NESTED_TYPES_ARRAY (type). */
- if (!fi.nested_types_list.empty ()
- && cu->lang () != language_ada)
+ if (!fi.nested_types_list.empty () && cu->lang () != language_ada)
{
int count = fi.nested_types_list.size ();
ALLOCATE_CPLUS_STRUCT_TYPE (type);
- TYPE_NESTED_TYPES_ARRAY (type)
- = ((struct decl_field *)
- TYPE_ALLOC (type, sizeof (struct decl_field) * count));
+ TYPE_NESTED_TYPES_ARRAY (type) = ((struct decl_field *) TYPE_ALLOC (
+ type, sizeof (struct decl_field) * count));
TYPE_NESTED_TYPES_COUNT (type) = count;
for (int i = 0; i < fi.nested_types_list.size (); ++i)
@@ -15090,8 +14864,7 @@ process_structure_scope (struct die_info *die, struct dwarf2_cu *cu)
while (child_die != NULL && child_die->tag)
{
- if (child_die->tag == DW_TAG_member
- || child_die->tag == DW_TAG_variable
+ if (child_die->tag == DW_TAG_member || child_die->tag == DW_TAG_variable
|| child_die->tag == DW_TAG_inheritance
|| child_die->tag == DW_TAG_template_value_param
|| child_die->tag == DW_TAG_template_type_param)
@@ -15121,15 +14894,14 @@ process_structure_scope (struct die_info *die, struct dwarf2_cu *cu)
else if (cu->line_header != nullptr)
{
/* Any related symtab will do. */
- symtab
- = cu->line_header->file_names ()[0].symtab;
+ symtab = cu->line_header->file_names ()[0].symtab;
}
else
{
symtab = nullptr;
- complaint (_("could not find suitable "
- "symtab for template parameter"
- " - DIE at %s [in module %s]"),
+ complaint (_ ("could not find suitable "
+ "symtab for template parameter"
+ " - DIE at %s [in module %s]"),
sect_offset_str (die->sect_off),
objfile_name (objfile));
}
@@ -15152,8 +14924,7 @@ process_structure_scope (struct die_info *die, struct dwarf2_cu *cu)
children. In particular, the fields are computed. */
static void
-update_enumeration_type_from_children (struct die_info *die,
- struct type *type,
+update_enumeration_type_from_children (struct die_info *die, struct type *type,
struct dwarf2_cu *cu)
{
struct die_info *child_die;
@@ -15163,8 +14934,7 @@ update_enumeration_type_from_children (struct die_info *die,
auto_obstack obstack;
std::vector<struct field> fields;
- for (child_die = die->child;
- child_die != NULL && child_die->tag;
+ for (child_die = die->child; child_die != NULL && child_die->tag;
child_die = child_die->sibling)
{
struct attribute *attr;
@@ -15184,8 +14954,8 @@ update_enumeration_type_from_children (struct die_info *die,
if (name == NULL)
name = "<anonymous enumerator>";
- dwarf2_const_value_attr (attr, type, name, &obstack, cu,
- &value, &bytes, &baton);
+ dwarf2_const_value_attr (attr, type, name, &obstack, cu, &value, &bytes,
+ &baton);
if (value < 0)
{
unsigned_enum = 0;
@@ -15206,9 +14976,9 @@ update_enumeration_type_from_children (struct die_info *die,
if (!fields.empty ())
{
type->set_num_fields (fields.size ());
- type->set_fields
- ((struct field *)
- TYPE_ALLOC (type, sizeof (struct field) * fields.size ()));
+ type->set_fields ((struct field *) TYPE_ALLOC (type,
+ sizeof (struct field)
+ * fields.size ()));
memcpy (type->fields (), fields.data (),
sizeof (struct field) * fields.size ());
}
@@ -15292,8 +15062,7 @@ read_enumeration_type (struct die_info *die, struct dwarf2_cu *cu)
if (type->length () == 0)
type->set_length (underlying_type->length ());
- if (TYPE_RAW_ALIGN (type) == 0
- && TYPE_RAW_ALIGN (underlying_type) != 0)
+ if (TYPE_RAW_ALIGN (type) == 0 && TYPE_RAW_ALIGN (underlying_type) != 0)
set_type_align (type, TYPE_RAW_ALIGN (underlying_type));
}
@@ -15356,8 +15125,7 @@ process_enumeration_scope (struct die_info *die, struct dwarf2_cu *cu)
actually available. Note that we do not want to do this for all
enums which are just declarations, because C++0x allows forward
enum declarations. */
- if (cu->per_cu->is_debug_types
- && die_is_declaration (die, cu))
+ if (cu->per_cu->is_debug_types && die_is_declaration (die, cu))
{
struct signatured_type *sig_type;
@@ -15432,7 +15200,7 @@ recognize_bound_expression (struct die_info *die, enum dwarf_attribute name,
return false;
int offset = 0;
- if (start ==end)
+ if (start == end)
return false;
else if (*start == DW_OP_deref_size || *start == DW_OP_deref)
{
@@ -15517,16 +15285,14 @@ quirk_ada_thick_pointer (struct die_info *die, struct dwarf2_cu *cu,
other layout, because we don't know what expression the compiler
might choose to emit should this happen. */
struct dwarf_block *blk = attr->as_block ();
- if (blk->size != 2
- || blk->data[0] != DW_OP_push_object_address
+ if (blk->size != 2 || blk->data[0] != DW_OP_push_object_address
|| blk->data[1] != DW_OP_deref)
return nullptr;
int bounds_offset = -1;
int max_align = -1;
std::vector<struct field> range_fields;
- for (struct die_info *child_die = die->child;
- child_die;
+ for (struct die_info *child_die = die->child; child_die;
child_die = child_die->sibling)
{
if (child_die->tag == DW_TAG_subrange_type)
@@ -15578,9 +15344,8 @@ quirk_ada_thick_pointer (struct die_info *die, struct dwarf2_cu *cu,
bounds->set_code (TYPE_CODE_STRUCT);
bounds->set_num_fields (range_fields.size ());
- bounds->set_fields
- ((struct field *) TYPE_ALLOC (bounds, (bounds->num_fields ()
- * sizeof (struct field))));
+ bounds->set_fields ((struct field *) TYPE_ALLOC (
+ bounds, (bounds->num_fields () * sizeof (struct field))));
memcpy (bounds->fields (), range_fields.data (),
bounds->num_fields () * sizeof (struct field));
@@ -15597,8 +15362,8 @@ quirk_ada_thick_pointer (struct die_info *die, struct dwarf2_cu *cu,
{
gdb_assert (iter->code () == TYPE_CODE_ARRAY);
iter->main_type->dyn_prop_list = nullptr;
- iter->set_index_type
- (create_static_range_type (NULL, bounds->field (i).type (), 1, 0));
+ iter->set_index_type (
+ create_static_range_type (NULL, bounds->field (i).type (), 1, 0));
iter = iter->target_type ();
}
@@ -15606,9 +15371,8 @@ quirk_ada_thick_pointer (struct die_info *die, struct dwarf2_cu *cu,
result->set_code (TYPE_CODE_STRUCT);
result->set_num_fields (2);
- result->set_fields
- ((struct field *) TYPE_ZALLOC (result, (result->num_fields ()
- * sizeof (struct field))));
+ result->set_fields ((struct field *) TYPE_ZALLOC (
+ result, (result->num_fields () * sizeof (struct field))));
/* The names are chosen to coincide with what the compiler does with
-fgnat-encodings=all, which the Ada code in gdb already
@@ -15658,12 +15422,12 @@ read_array_type (struct die_info *die, struct dwarf2_cu *cu)
byte_stride_prop
= (struct dynamic_prop *) alloca (sizeof (struct dynamic_prop));
- stride_ok = attr_to_dynamic_prop (attr, die, cu, byte_stride_prop,
- prop_type);
+ stride_ok
+ = attr_to_dynamic_prop (attr, die, cu, byte_stride_prop, prop_type);
if (!stride_ok)
{
- complaint (_("unable to read array DW_AT_byte_stride "
- " - DIE at %s [in module %s]"),
+ complaint (_ ("unable to read array DW_AT_byte_stride "
+ " - DIE at %s [in module %s]"),
sect_offset_str (die->sect_off),
objfile_name (cu->per_objfile->objfile));
/* Ignore this attribute. We will likely not be able to print
@@ -15709,7 +15473,7 @@ read_array_type (struct die_info *die, struct dwarf2_cu *cu)
if (range_types.empty ())
{
- complaint (_("unable to find array range - DIE at %s [in module %s]"),
+ complaint (_ ("unable to find array range - DIE at %s [in module %s]"),
sect_offset_str (die->sect_off),
objfile_name (cu->per_objfile->objfile));
return NULL;
@@ -15769,8 +15533,8 @@ read_array_type (struct die_info *die, struct dwarf2_cu *cu)
if (attr->as_unsigned () >= type->length ())
type->set_length (attr->as_unsigned ());
else
- complaint (_("DW_AT_byte_size for array type smaller "
- "than the total size of elements"));
+ complaint (_ ("DW_AT_byte_size for array type smaller "
+ "than the total size of elements"));
}
name = dwarf2_name (die, cu);
@@ -15817,8 +15581,8 @@ read_array_order (struct die_info *die, struct dwarf2_cu *cu)
FIXME: dsl/2004-8-20: If G77 is ever fixed, this will also need
version checking. */
- if (cu->lang () == language_fortran
- && cu->producer && strstr (cu->producer, "GNU F77"))
+ if (cu->lang () == language_fortran && cu->producer
+ && strstr (cu->producer, "GNU F77"))
{
return DW_ORD_row_major;
}
@@ -15886,8 +15650,7 @@ mark_common_block_symbol_computed (struct symbol *sym,
gdb_assert (common_loc && member_loc);
gdb_assert (common_loc->form_is_block ());
- gdb_assert (member_loc->form_is_block ()
- || member_loc->form_is_constant ());
+ gdb_assert (member_loc->form_is_block () || member_loc->form_is_constant ());
baton = XOBNEW (&objfile->objfile_obstack, struct dwarf2_locexpr_baton);
baton->per_objfile = per_objfile;
@@ -15974,8 +15737,7 @@ read_common_block (struct die_info *die, struct dwarf2_cu *cu)
struct common_block *common_block;
struct symbol *sym;
- for (child_die = die->child;
- child_die && child_die->tag;
+ for (child_die = die->child; child_die && child_die->tag;
child_die = child_die->sibling)
++n_entries;
@@ -15987,8 +15749,7 @@ read_common_block (struct die_info *die, struct dwarf2_cu *cu)
memset (common_block->contents, 0, n_entries * sizeof (struct symbol *));
common_block->n_entries = 0;
- for (child_die = die->child;
- child_die && child_die->tag;
+ for (child_die = die->child; child_die && child_die->tag;
child_die = child_die->sibling)
{
/* Create the symbol in the DW_TAG_common_block block in the current
@@ -16000,18 +15761,18 @@ read_common_block (struct die_info *die, struct dwarf2_cu *cu)
common_block->contents[common_block->n_entries++] = sym;
- member_loc = dwarf2_attr (child_die, DW_AT_data_member_location,
- cu);
+ member_loc
+ = dwarf2_attr (child_die, DW_AT_data_member_location, cu);
if (member_loc)
{
/* GDB has handled this for a long time, but it is
not specified by DWARF. It seems to have been
emitted by gfortran at least as recently as:
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23057. */
- complaint (_("Variable in common block has "
- "DW_AT_data_member_location "
- "- DIE at %s [in module %s]"),
- sect_offset_str (child_die->sect_off),
+ complaint (_ ("Variable in common block has "
+ "DW_AT_data_member_location "
+ "- DIE at %s [in module %s]"),
+ sect_offset_str (child_die->sect_off),
objfile_name (objfile));
if (member_loc->form_is_section_offset ())
@@ -16064,8 +15825,8 @@ read_namespace_type (struct die_info *die, struct dwarf2_cu *cu)
previous_prefix = determine_prefix (die, cu);
if (previous_prefix[0] != '\0')
- name = typename_concat (&objfile->objfile_obstack,
- previous_prefix, name, 0, cu);
+ name = typename_concat (&objfile->objfile_obstack, previous_prefix, name,
+ 0, cu);
/* Create the type. */
type = init_type (objfile, TYPE_CODE_NAMESPACE, 0, name);
@@ -16098,11 +15859,10 @@ read_namespace (struct die_info *die, struct dwarf2_cu *cu)
const char *previous_prefix = determine_prefix (die, cu);
std::vector<const char *> excludes;
- add_using_directive (using_directives (cu),
- previous_prefix, type->name (), NULL,
- NULL, excludes,
- read_decl_line (die, cu),
- 0, &objfile->objfile_obstack);
+ add_using_directive (using_directives (cu), previous_prefix,
+ type->name (), NULL, NULL, excludes,
+ read_decl_line (die, cu), 0,
+ &objfile->objfile_obstack);
}
}
@@ -16165,8 +15925,7 @@ namespace_name (struct die_info *die, int *is_anonymous, struct dwarf2_cu *cu)
/* Loop through the extensions until we find a name. */
- for (current_die = die;
- current_die != NULL;
+ for (current_die = die; current_die != NULL;
current_die = dwarf2_extension (die, &cu))
{
/* We don't use dwarf2_name here so that we can detect the absence
@@ -16242,12 +16001,12 @@ read_tag_pointer_type (struct die_info *die, struct dwarf2_cu *cu)
}
else if (type->length () != byte_size)
{
- complaint (_("invalid pointer size %d"), byte_size);
+ complaint (_ ("invalid pointer size %d"), byte_size);
}
else if (TYPE_RAW_ALIGN (type) != alignment)
{
- complaint (_("Invalid DW_AT_alignment"
- " - DIE at %s [in module %s]"),
+ complaint (_ ("Invalid DW_AT_alignment"
+ " - DIE at %s [in module %s]"),
sect_offset_str (die->sect_off),
objfile_name (cu->per_objfile->objfile));
}
@@ -16302,7 +16061,7 @@ read_tag_ptr_to_member_type (struct die_info *die, struct dwarf2_cu *cu)
static struct type *
read_tag_reference_type (struct die_info *die, struct dwarf2_cu *cu,
- enum type_code refcode)
+ enum type_code refcode)
{
struct comp_unit_head *cu_header = &cu->header;
struct type *type, *target_type;
@@ -16465,8 +16224,8 @@ read_tag_string_type (struct die_info *die, struct dwarf2_cu *cu)
static bool warning_printed = false;
if (!warning_printed)
{
- warning (_("DW_AT_bit_size and DW_AT_string_length_bit_size not "
- "currently supported on DW_TAG_string_type."));
+ warning (_ ("DW_AT_bit_size and DW_AT_string_length_bit_size not "
+ "currently supported on DW_TAG_string_type."));
warning_printed = true;
}
}
@@ -16554,8 +16313,7 @@ prototyped_function_p (struct die_info *die, struct dwarf2_cu *cu)
languages that allow unprototyped functions (Eg: Objective C).
For all other languages, assume that functions are always
prototyped. */
- if (cu->lang () != language_c
- && cu->lang () != language_objc
+ if (cu->lang () != language_c && cu->lang () != language_objc
&& cu->lang () != language_opencl)
return 1;
@@ -16583,8 +16341,8 @@ static struct type *
read_subroutine_type (struct die_info *die, struct dwarf2_cu *cu)
{
struct objfile *objfile = cu->per_objfile->objfile;
- struct type *type; /* Type that this function returns. */
- struct type *ftype; /* Function that returns above type. */
+ struct type *type; /* Type that this function returns. */
+ struct type *ftype; /* Function that returns above type. */
struct attribute *attr;
type = die_type (die, cu);
@@ -16604,7 +16362,8 @@ read_subroutine_type (struct die_info *die, struct dwarf2_cu *cu)
the default value DW_CC_normal. */
attr = dwarf2_attr (die, DW_AT_calling_convention, cu);
if (attr != nullptr
- && is_valid_DW_AT_calling_convention_for_subroutine (attr->constant_value (0)))
+ && is_valid_DW_AT_calling_convention_for_subroutine (
+ attr->constant_value (0)))
TYPE_CALLING_CONVENTION (ftype)
= (enum dwarf_calling_convention) attr->constant_value (0);
else if (cu->producer && strstr (cu->producer, "IBM XL C for OpenCL"))
@@ -16646,8 +16405,8 @@ read_subroutine_type (struct die_info *die, struct dwarf2_cu *cu)
/* Allocate storage for parameters and fill them in. */
ftype->set_num_fields (nparams);
- ftype->set_fields
- ((struct field *) TYPE_ZALLOC (ftype, nparams * sizeof (struct field)));
+ ftype->set_fields (
+ (struct field *) TYPE_ZALLOC (ftype, nparams * sizeof (struct field)));
/* TYPE_FIELD_TYPE must never be NULL. Pre-fill the array to ensure it
even if we error out during the parameters reading below. */
@@ -16681,8 +16440,7 @@ read_subroutine_type (struct die_info *die, struct dwarf2_cu *cu)
/* RealView does not mark THIS as const, which the testsuite
expects. GCC marks THIS as const in method definitions,
but not in the class specifications (GCC PR 43053). */
- if (cu->lang () == language_cplus
- && !TYPE_CONST (arg_type)
+ if (cu->lang () == language_cplus && !TYPE_CONST (arg_type)
&& TYPE_FIELD_ARTIFICIAL (ftype, iparams))
{
int is_this = 0;
@@ -16738,8 +16496,8 @@ read_typedef (struct die_info *die, struct dwarf2_cu *cu)
{
/* Self-referential typedefs are, it seems, not allowed by the DWARF
spec and cause infinite loops in GDB. */
- complaint (_("Self-referential DW_TAG_typedef "
- "- DIE at %s [in module %s]"),
+ complaint (_ ("Self-referential DW_TAG_typedef "
+ "- DIE at %s [in module %s]"),
sect_offset_str (die->sect_off), objfile_name (objfile));
this_type->set_target_type (nullptr);
}
@@ -16770,15 +16528,15 @@ get_mpz (struct dwarf2_cu *cu, gdb_mpz *value, struct attribute *attr)
if (blk->size > 0 && blk->data[0] == DW_OP_implicit_value)
{
uint64_t len;
- const gdb_byte *ptr = safe_read_uleb128 (blk->data + 1,
- blk->data + blk->size,
- &len);
+ const gdb_byte *ptr
+ = safe_read_uleb128 (blk->data + 1, blk->data + blk->size, &len);
if (ptr - blk->data + len <= blk->size)
{
- mpz_import (value->val, len,
- bfd_big_endian (cu->per_objfile->objfile->obfd.get ())
- ? 1 : -1,
- 1, 0, 0, ptr);
+ mpz_import (
+ value->val, len,
+ bfd_big_endian (cu->per_objfile->objfile->obfd.get ()) ? 1
+ : -1,
+ 1, 0, 0, ptr);
return;
}
}
@@ -16790,8 +16548,8 @@ get_mpz (struct dwarf2_cu *cu, gdb_mpz *value, struct attribute *attr)
{
dwarf_block *blk = attr->as_block ();
mpz_import (value->val, blk->size,
- bfd_big_endian (cu->per_objfile->objfile->obfd.get ())
- ? 1 : -1,
+ bfd_big_endian (cu->per_objfile->objfile->obfd.get ()) ? 1
+ : -1,
1, 0, 0, blk->data);
}
else
@@ -16813,12 +16571,12 @@ get_dwarf2_rational_constant (struct die_info *die, struct dwarf2_cu *cu,
num_attr = dwarf2_attr (die, DW_AT_GNU_numerator, cu);
if (num_attr == nullptr)
- complaint (_("DW_AT_GNU_numerator missing in %s DIE at %s"),
+ complaint (_ ("DW_AT_GNU_numerator missing in %s DIE at %s"),
dwarf_tag_name (die->tag), sect_offset_str (die->sect_off));
denom_attr = dwarf2_attr (die, DW_AT_GNU_denominator, cu);
if (denom_attr == nullptr)
- complaint (_("DW_AT_GNU_denominator missing in %s DIE at %s"),
+ complaint (_ ("DW_AT_GNU_denominator missing in %s DIE at %s"),
dwarf_tag_name (die->tag), sect_offset_str (die->sect_off));
if (num_attr == nullptr || denom_attr == nullptr)
@@ -16851,15 +16609,15 @@ get_dwarf2_unsigned_rational_constant (struct die_info *die,
}
else if (mpz_sgn (num.val) == -1)
{
- complaint (_("unexpected negative value for DW_AT_GNU_numerator"
- " in DIE at %s"),
+ complaint (_ ("unexpected negative value for DW_AT_GNU_numerator"
+ " in DIE at %s"),
sect_offset_str (die->sect_off));
return;
}
else if (mpz_sgn (denom.val) == -1)
{
- complaint (_("unexpected negative value for DW_AT_GNU_denominator"
- " in DIE at %s"),
+ complaint (_ ("unexpected negative value for DW_AT_GNU_denominator"
+ " in DIE at %s"),
sect_offset_str (die->sect_off));
return;
}
@@ -16907,8 +16665,8 @@ ada_get_gnat_encoded_number (const char *encoding, int &k, gdb_mpz *result)
failure. */
static bool
-ada_get_gnat_encoded_ratio (const char *encoding, int &offset,
- gdb_mpz *num, gdb_mpz *denom)
+ada_get_gnat_encoded_ratio (const char *encoding, int &offset, gdb_mpz *num,
+ gdb_mpz *denom)
{
if (!ada_get_gnat_encoded_number (encoding, offset, num))
return false;
@@ -16971,7 +16729,7 @@ finish_fixed_point_type (struct type *type, const char *suffix,
see the encoded value. */
scale_num = 1;
scale_denom = 1;
- complaint (_("no scale found for fixed-point type (DIE at %s)"),
+ complaint (_ ("no scale found for fixed-point type (DIE at %s)"),
sect_offset_str (die->sect_off));
}
}
@@ -16980,7 +16738,8 @@ finish_fixed_point_type (struct type *type, const char *suffix,
LONGEST scale_exp = attr->constant_value (0);
gdb_mpz *num_or_denom = scale_exp > 0 ? &scale_num : &scale_denom;
- mpz_mul_2exp (num_or_denom->val, num_or_denom->val, std::abs (scale_exp));
+ mpz_mul_2exp (num_or_denom->val, num_or_denom->val,
+ std::abs (scale_exp));
}
else if (attr->name == DW_AT_decimal_scale)
{
@@ -16996,17 +16755,17 @@ finish_fixed_point_type (struct type *type, const char *suffix,
scale_die = follow_die_ref (die, attr, &scale_cu);
if (scale_die->tag == DW_TAG_constant)
- get_dwarf2_unsigned_rational_constant (scale_die, scale_cu,
- &scale_num, &scale_denom);
+ get_dwarf2_unsigned_rational_constant (scale_die, scale_cu, &scale_num,
+ &scale_denom);
else
- complaint (_("%s DIE not supported as target of DW_AT_small attribute"
- " (DIE at %s)"),
+ complaint (_ ("%s DIE not supported as target of DW_AT_small attribute"
+ " (DIE at %s)"),
dwarf_tag_name (die->tag), sect_offset_str (die->sect_off));
}
else
{
- complaint (_("unsupported scale attribute %s for fixed-point type"
- " (DIE at %s)"),
+ complaint (_ ("unsupported scale attribute %s for fixed-point type"
+ " (DIE at %s)"),
dwarf_attr_name (attr->name),
sect_offset_str (die->sect_off));
}
@@ -17079,16 +16838,14 @@ dwarf2_init_integer_type (struct dwarf2_cu *cu, struct objfile *objfile,
CU is the DIE's Compilation Unit. */
static bool
-has_zero_over_zero_small_attribute (struct die_info *die,
- struct dwarf2_cu *cu)
+has_zero_over_zero_small_attribute (struct die_info *die, struct dwarf2_cu *cu)
{
struct attribute *attr = dwarf2_attr (die, DW_AT_small, cu);
if (attr == nullptr)
return false;
struct dwarf2_cu *scale_cu = cu;
- struct die_info *scale_die
- = follow_die_ref (die, attr, &scale_cu);
+ struct die_info *scale_die = follow_die_ref (die, attr, &scale_cu);
if (scale_die->tag != DW_TAG_constant)
return false;
@@ -17108,8 +16865,7 @@ has_zero_over_zero_small_attribute (struct die_info *die,
named, we try to select a suitable name based on the size of the
component. */
static struct type *
-dwarf2_init_complex_target_type (struct dwarf2_cu *cu,
- struct objfile *objfile,
+dwarf2_init_complex_target_type (struct dwarf2_cu *cu, struct objfile *objfile,
int bits, const char *name_hint,
enum bfd_endian byte_order)
{
@@ -17130,7 +16886,7 @@ dwarf2_init_complex_target_type (struct dwarf2_cu *cu,
case 64:
tt = builtin_f_type (gdbarch)->builtin_real_s8;
break;
- case 96: /* The x86-32 ABI specifies 96-bit long double. */
+ case 96: /* The x86-32 ABI specifies 96-bit long double. */
case 128:
tt = builtin_f_type (gdbarch)->builtin_real_s16;
break;
@@ -17145,7 +16901,7 @@ dwarf2_init_complex_target_type (struct dwarf2_cu *cu,
case 64:
tt = builtin_type (gdbarch)->builtin_double;
break;
- case 96: /* The x86-32 ABI specifies 96-bit long double. */
+ case 96: /* The x86-32 ABI specifies 96-bit long double. */
case 128:
tt = builtin_type (gdbarch)->builtin_long_double;
break;
@@ -17184,7 +16940,7 @@ read_base_type (struct die_info *die, struct dwarf2_cu *cu)
bits = attr->constant_value (0) * TARGET_CHAR_BIT;
name = dwarf2_name (die, cu);
if (!name)
- complaint (_("DW_AT_name missing from DW_TAG_base_type"));
+ complaint (_ ("DW_AT_name missing from DW_TAG_base_type"));
arch = objfile->arch ();
enum bfd_endian byte_order = gdbarch_byte_order (arch);
@@ -17203,7 +16959,8 @@ read_base_type (struct die_info *die, struct dwarf2_cu *cu)
byte_order = BFD_ENDIAN_LITTLE;
break;
default:
- complaint (_("DW_AT_endianity has unrecognized value %d"), endianity);
+ complaint (_ ("DW_AT_endianity has unrecognized value %d"),
+ endianity);
break;
}
}
@@ -17220,9 +16977,8 @@ read_base_type (struct die_info *die, struct dwarf2_cu *cu)
the scaling factor via the standard DWARF mechanisms, and
for which the info is provided via the GNAT encodings instead.
This is likely what this DIE is about. */
- encoding = (encoding == DW_ATE_signed_fixed
- ? DW_ATE_signed
- : DW_ATE_unsigned);
+ encoding
+ = (encoding == DW_ATE_signed_fixed ? DW_ATE_signed : DW_ATE_unsigned);
}
/* With GNAT encodings, fixed-point information will be encoded in
@@ -17231,8 +16987,7 @@ read_base_type (struct die_info *die, struct dwarf2_cu *cu)
than an "else if". */
const char *gnat_encoding_suffix = nullptr;
if ((encoding == DW_ATE_signed || encoding == DW_ATE_unsigned)
- && cu->lang () == language_ada
- && name != nullptr)
+ && cu->lang () == language_ada && name != nullptr)
{
gnat_encoding_suffix = gnat_encoded_fixed_point_type_info (name);
if (gnat_encoding_suffix != nullptr)
@@ -17245,99 +17000,91 @@ read_base_type (struct die_info *die, struct dwarf2_cu *cu)
"XF". */
gnat_encoding_suffix += strlen (GNAT_FIXED_POINT_SUFFIX) - 1;
- encoding = (encoding == DW_ATE_signed
- ? DW_ATE_signed_fixed
- : DW_ATE_unsigned_fixed);
+ encoding = (encoding == DW_ATE_signed ? DW_ATE_signed_fixed
+ : DW_ATE_unsigned_fixed);
}
}
switch (encoding)
{
- case DW_ATE_address:
- /* Turn DW_ATE_address into a void * pointer. */
- type = init_type (objfile, TYPE_CODE_VOID, TARGET_CHAR_BIT, NULL);
- type = init_pointer_type (objfile, bits, name, type);
- break;
- case DW_ATE_boolean:
- type = init_boolean_type (objfile, bits, 1, name);
- break;
- case DW_ATE_complex_float:
- type = dwarf2_init_complex_target_type (cu, objfile, bits / 2, name,
- byte_order);
- if (type->code () == TYPE_CODE_ERROR)
- {
- if (name == nullptr)
- {
- struct obstack *obstack
- = &cu->per_objfile->objfile->objfile_obstack;
- name = obconcat (obstack, "_Complex ", type->name (),
- nullptr);
- }
- type = init_type (objfile, TYPE_CODE_ERROR, bits, name);
- }
- else
- type = init_complex_type (name, type);
- break;
- case DW_ATE_decimal_float:
- type = init_decfloat_type (objfile, bits, name);
- break;
- case DW_ATE_float:
- type = dwarf2_init_float_type (objfile, bits, name, name, byte_order);
- break;
- case DW_ATE_signed:
- type = dwarf2_init_integer_type (cu, objfile, bits, 0, name);
- break;
- case DW_ATE_unsigned:
- if (cu->lang () == language_fortran
- && name
- && startswith (name, "character("))
- type = init_character_type (objfile, bits, 1, name);
- else
- type = dwarf2_init_integer_type (cu, objfile, bits, 1, name);
- break;
- case DW_ATE_signed_char:
- if (cu->lang () == language_ada
- || cu->lang () == language_m2
- || cu->lang () == language_pascal
- || cu->lang () == language_fortran)
- type = init_character_type (objfile, bits, 0, name);
- else
- type = dwarf2_init_integer_type (cu, objfile, bits, 0, name);
- break;
- case DW_ATE_unsigned_char:
- if (cu->lang () == language_ada
- || cu->lang () == language_m2
- || cu->lang () == language_pascal
- || cu->lang () == language_fortran
- || cu->lang () == language_rust)
- type = init_character_type (objfile, bits, 1, name);
- else
- type = dwarf2_init_integer_type (cu, objfile, bits, 1, name);
- break;
- case DW_ATE_UTF:
+ case DW_ATE_address:
+ /* Turn DW_ATE_address into a void * pointer. */
+ type = init_type (objfile, TYPE_CODE_VOID, TARGET_CHAR_BIT, NULL);
+ type = init_pointer_type (objfile, bits, name, type);
+ break;
+ case DW_ATE_boolean:
+ type = init_boolean_type (objfile, bits, 1, name);
+ break;
+ case DW_ATE_complex_float:
+ type = dwarf2_init_complex_target_type (cu, objfile, bits / 2, name,
+ byte_order);
+ if (type->code () == TYPE_CODE_ERROR)
{
- type = init_character_type (objfile, bits, 1, name);
- return set_die_type (die, type, cu);
+ if (name == nullptr)
+ {
+ struct obstack *obstack
+ = &cu->per_objfile->objfile->objfile_obstack;
+ name = obconcat (obstack, "_Complex ", type->name (), nullptr);
+ }
+ type = init_type (objfile, TYPE_CODE_ERROR, bits, name);
}
- break;
- case DW_ATE_signed_fixed:
- type = init_fixed_point_type (objfile, bits, 0, name);
- finish_fixed_point_type (type, gnat_encoding_suffix, die, cu);
- break;
- case DW_ATE_unsigned_fixed:
- type = init_fixed_point_type (objfile, bits, 1, name);
- finish_fixed_point_type (type, gnat_encoding_suffix, die, cu);
- break;
+ else
+ type = init_complex_type (name, type);
+ break;
+ case DW_ATE_decimal_float:
+ type = init_decfloat_type (objfile, bits, name);
+ break;
+ case DW_ATE_float:
+ type = dwarf2_init_float_type (objfile, bits, name, name, byte_order);
+ break;
+ case DW_ATE_signed:
+ type = dwarf2_init_integer_type (cu, objfile, bits, 0, name);
+ break;
+ case DW_ATE_unsigned:
+ if (cu->lang () == language_fortran && name
+ && startswith (name, "character("))
+ type = init_character_type (objfile, bits, 1, name);
+ else
+ type = dwarf2_init_integer_type (cu, objfile, bits, 1, name);
+ break;
+ case DW_ATE_signed_char:
+ if (cu->lang () == language_ada || cu->lang () == language_m2
+ || cu->lang () == language_pascal || cu->lang () == language_fortran)
+ type = init_character_type (objfile, bits, 0, name);
+ else
+ type = dwarf2_init_integer_type (cu, objfile, bits, 0, name);
+ break;
+ case DW_ATE_unsigned_char:
+ if (cu->lang () == language_ada || cu->lang () == language_m2
+ || cu->lang () == language_pascal || cu->lang () == language_fortran
+ || cu->lang () == language_rust)
+ type = init_character_type (objfile, bits, 1, name);
+ else
+ type = dwarf2_init_integer_type (cu, objfile, bits, 1, name);
+ break;
+ case DW_ATE_UTF:
+ {
+ type = init_character_type (objfile, bits, 1, name);
+ return set_die_type (die, type, cu);
+ }
+ break;
+ case DW_ATE_signed_fixed:
+ type = init_fixed_point_type (objfile, bits, 0, name);
+ finish_fixed_point_type (type, gnat_encoding_suffix, die, cu);
+ break;
+ case DW_ATE_unsigned_fixed:
+ type = init_fixed_point_type (objfile, bits, 1, name);
+ finish_fixed_point_type (type, gnat_encoding_suffix, die, cu);
+ break;
- default:
- complaint (_("unsupported DW_AT_encoding: '%s'"),
- dwarf_type_encoding_name (encoding));
- type = init_type (objfile, TYPE_CODE_ERROR, bits, name);
- break;
+ default:
+ complaint (_ ("unsupported DW_AT_encoding: '%s'"),
+ dwarf_type_encoding_name (encoding));
+ type = init_type (objfile, TYPE_CODE_ERROR, bits, name);
+ break;
}
- if (type->code () == TYPE_CODE_INT
- && name != nullptr
+ if (type->code () == TYPE_CODE_INT && name != nullptr
&& strcmp (name, "char") == 0)
type->set_has_no_signedness (true);
@@ -17354,8 +17101,7 @@ read_base_type (struct die_info *die, struct dwarf2_cu *cu)
attr = dwarf2_attr (die, DW_AT_data_bit_offset, cu);
/* Only use the attributes if they make sense together. */
if (attr == nullptr
- || (attr->as_unsigned () + real_bit_size
- <= 8 * type->length ()))
+ || (attr->as_unsigned () + real_bit_size <= 8 * type->length ()))
{
TYPE_MAIN_TYPE (type)->type_specific.int_stuff.bit_size
= real_bit_size;
@@ -17419,8 +17165,7 @@ attr_to_dynamic_prop (const struct attribute *attr, struct die_info *die,
{
size_t data_size = 16;
block = XOBNEW (obstack, struct dwarf_block);
- block->size = (data_size
- + 2 /* Extra bytes for DW_OP and arg. */);
+ block->size = (data_size + 2 /* Extra bytes for DW_OP and arg. */);
gdb_byte *data = XOBNEWVEC (obstack, gdb_byte, block->size);
data[0] = DW_OP_implicit_value;
data[1] = data_size;
@@ -17454,11 +17199,11 @@ attr_to_dynamic_prop (const struct attribute *attr, struct die_info *die,
target_die = follow_die_ref (die, attr, &target_cu);
target_attr = dwarf2_attr (target_die, DW_AT_location, target_cu);
if (target_attr == NULL)
- target_attr = dwarf2_attr (target_die, DW_AT_data_member_location,
- target_cu);
+ target_attr
+ = dwarf2_attr (target_die, DW_AT_data_member_location, target_cu);
if (target_attr == nullptr)
- target_attr = dwarf2_attr (target_die, DW_AT_data_bit_offset,
- target_cu);
+ target_attr
+ = dwarf2_attr (target_die, DW_AT_data_bit_offset, target_cu);
if (target_attr == NULL)
{
const char *name = var_decl_name (target_die, target_cu);
@@ -17472,51 +17217,51 @@ attr_to_dynamic_prop (const struct attribute *attr, struct die_info *die,
switch (target_attr->name)
{
- case DW_AT_location:
- if (target_attr->form_is_section_offset ())
- {
- baton = XOBNEW (obstack, struct dwarf2_property_baton);
- baton->property_type = die_type (target_die, target_cu);
- fill_in_loclist_baton (cu, &baton->loclist, target_attr);
- prop->set_loclist (baton);
- gdb_assert (prop->baton () != NULL);
- }
- else if (target_attr->form_is_block ())
- {
- baton = XOBNEW (obstack, struct dwarf2_property_baton);
- baton->property_type = die_type (target_die, target_cu);
- baton->locexpr.per_cu = cu->per_cu;
- baton->locexpr.per_objfile = per_objfile;
- struct dwarf_block *block = target_attr->as_block ();
- baton->locexpr.size = block->size;
- baton->locexpr.data = block->data;
- baton->locexpr.is_reference = true;
- prop->set_locexpr (baton);
- gdb_assert (prop->baton () != NULL);
- }
- else
- {
- dwarf2_invalid_attrib_class_complaint ("DW_AT_location",
- "dynamic property");
- return 0;
- }
- break;
- case DW_AT_data_member_location:
- case DW_AT_data_bit_offset:
+ case DW_AT_location:
+ if (target_attr->form_is_section_offset ())
{
- LONGEST offset;
-
- if (!handle_member_location (target_die, target_cu, &offset))
- return 0;
-
baton = XOBNEW (obstack, struct dwarf2_property_baton);
- baton->property_type = read_type_die (target_die->parent,
- target_cu);
- baton->offset_info.offset = offset;
- baton->offset_info.type = die_type (target_die, target_cu);
- prop->set_addr_offset (baton);
- break;
+ baton->property_type = die_type (target_die, target_cu);
+ fill_in_loclist_baton (cu, &baton->loclist, target_attr);
+ prop->set_loclist (baton);
+ gdb_assert (prop->baton () != NULL);
+ }
+ else if (target_attr->form_is_block ())
+ {
+ baton = XOBNEW (obstack, struct dwarf2_property_baton);
+ baton->property_type = die_type (target_die, target_cu);
+ baton->locexpr.per_cu = cu->per_cu;
+ baton->locexpr.per_objfile = per_objfile;
+ struct dwarf_block *block = target_attr->as_block ();
+ baton->locexpr.size = block->size;
+ baton->locexpr.data = block->data;
+ baton->locexpr.is_reference = true;
+ prop->set_locexpr (baton);
+ gdb_assert (prop->baton () != NULL);
}
+ else
+ {
+ dwarf2_invalid_attrib_class_complaint ("DW_AT_location",
+ "dynamic property");
+ return 0;
+ }
+ break;
+ case DW_AT_data_member_location:
+ case DW_AT_data_bit_offset:
+ {
+ LONGEST offset;
+
+ if (!handle_member_location (target_die, target_cu, &offset))
+ return 0;
+
+ baton = XOBNEW (obstack, struct dwarf2_property_baton);
+ baton->property_type
+ = read_type_die (target_die->parent, target_cu);
+ baton->offset_info.offset = offset;
+ baton->offset_info.type = die_type (target_die, target_cu);
+ prop->set_addr_offset (baton);
+ break;
+ }
}
}
else if (attr->form_is_constant ())
@@ -17541,7 +17286,7 @@ attr_to_dynamic_prop (const struct attribute *attr, struct die_info *die,
return 1;
- invalid:
+invalid:
dwarf2_invalid_attrib_class_complaint (dwarf_form_name (attr->form),
dwarf2_name (die, cu));
return 0;
@@ -17639,8 +17384,8 @@ read_subrange_type (struct die_info *die, struct dwarf2_cu *cu)
if (attr != nullptr)
attr_to_dynamic_prop (attr, die, cu, &low, base_type);
else if (!low_default_is_valid)
- complaint (_("Missing DW_AT_lower_bound "
- "- DIE at %s [in module %s]"),
+ complaint (_ ("Missing DW_AT_lower_bound "
+ "- DIE at %s [in module %s]"),
sect_offset_str (die->sect_off),
objfile_name (cu->per_objfile->objfile));
@@ -17660,13 +17405,13 @@ read_subrange_type (struct die_info *die, struct dwarf2_cu *cu)
else
{
if (attr_ub != NULL)
- complaint (_("Unresolved DW_AT_upper_bound "
- "- DIE at %s [in module %s]"),
+ complaint (_ ("Unresolved DW_AT_upper_bound "
+ "- DIE at %s [in module %s]"),
sect_offset_str (die->sect_off),
objfile_name (cu->per_objfile->objfile));
if (attr_count != NULL)
- complaint (_("Unresolved DW_AT_count "
- "- DIE at %s [in module %s]"),
+ complaint (_ ("Unresolved DW_AT_count "
+ "- DIE at %s [in module %s]"),
sect_offset_str (die->sect_off),
objfile_name (cu->per_objfile->objfile));
}
@@ -17694,12 +17439,12 @@ read_subrange_type (struct die_info *die, struct dwarf2_cu *cu)
ULONGEST negative_mask
= -((ULONGEST) 1 << (base_type->length () * TARGET_CHAR_BIT - 1));
- if (low.kind () == PROP_CONST
- && !base_type->is_unsigned () && (low.const_val () & negative_mask))
+ if (low.kind () == PROP_CONST && !base_type->is_unsigned ()
+ && (low.const_val () & negative_mask))
low.set_const_val (low.const_val () | negative_mask);
- if (high.kind () == PROP_CONST
- && !base_type->is_unsigned () && (high.const_val () & negative_mask))
+ if (high.kind () == PROP_CONST && !base_type->is_unsigned ()
+ && (high.const_val () & negative_mask))
high.set_const_val (high.const_val () | negative_mask);
}
@@ -17720,8 +17465,8 @@ read_subrange_type (struct die_info *die, struct dwarf2_cu *cu)
/* It only makes sense to have either a bit or byte stride. */
if (attr_byte_stride != nullptr)
{
- complaint (_("Found DW_AT_bit_stride and DW_AT_byte_stride "
- "- DIE at %s [in module %s]"),
+ complaint (_ ("Found DW_AT_bit_stride and DW_AT_byte_stride "
+ "- DIE at %s [in module %s]"),
sect_offset_str (die->sect_off),
objfile_name (cu->per_objfile->objfile));
attr_bit_stride = nullptr;
@@ -17734,16 +17479,15 @@ read_subrange_type (struct die_info *die, struct dwarf2_cu *cu)
}
}
- if (attr_byte_stride != nullptr
- || attr_bit_stride != nullptr)
+ if (attr_byte_stride != nullptr || attr_bit_stride != nullptr)
{
bool byte_stride_p = (attr_byte_stride != nullptr);
struct dynamic_prop *stride
= byte_stride_p ? &byte_stride_prop : &bit_stride_prop;
range_type
- = create_range_type_with_stride (NULL, orig_base_type, &low,
- &high, bias, stride, byte_stride_p);
+ = create_range_type_with_stride (NULL, orig_base_type, &low, &high,
+ bias, stride, byte_stride_p);
}
else
range_type = create_range_type (NULL, orig_base_type, &low, &high, bias);
@@ -17799,8 +17543,7 @@ read_unspecified_type (struct die_info *die, struct dwarf2_cu *cu)
static struct die_info *
read_die_and_children (const struct die_reader_specs *reader,
- const gdb_byte *info_ptr,
- const gdb_byte **new_info_ptr,
+ const gdb_byte *info_ptr, const gdb_byte **new_info_ptr,
struct die_info *parent)
{
struct die_info *die;
@@ -17870,17 +17613,15 @@ read_die_and_siblings_1 (const struct die_reader_specs *reader,
static struct die_info *
read_die_and_siblings (const struct die_reader_specs *reader,
- const gdb_byte *info_ptr,
- const gdb_byte **new_info_ptr,
+ const gdb_byte *info_ptr, const gdb_byte **new_info_ptr,
struct die_info *parent)
{
- struct die_info *die = read_die_and_siblings_1 (reader, info_ptr,
- new_info_ptr, parent);
+ struct die_info *die
+ = read_die_and_siblings_1 (reader, info_ptr, new_info_ptr, parent);
if (dwarf_die_debug)
{
- gdb_printf (gdb_stdlog,
- "Read die from %s@0x%x of %s:\n",
+ gdb_printf (gdb_stdlog, "Read die from %s@0x%x of %s:\n",
reader->die_section->get_name (),
(unsigned) (info_ptr - reader->die_section->buffer),
bfd_get_filename (reader->abfd));
@@ -17898,9 +17639,8 @@ read_die_and_siblings (const struct die_reader_specs *reader,
except for its child, sibling, and parent fields. */
static const gdb_byte *
-read_full_die_1 (const struct die_reader_specs *reader,
- struct die_info **diep, const gdb_byte *info_ptr,
- int num_extra_attrs)
+read_full_die_1 (const struct die_reader_specs *reader, struct die_info **diep,
+ const gdb_byte *info_ptr, int num_extra_attrs)
{
unsigned int abbrev_number, bytes_read, i;
const struct abbrev_info *abbrev;
@@ -17919,9 +17659,8 @@ read_full_die_1 (const struct die_reader_specs *reader,
abbrev = reader->abbrev_table->lookup_abbrev (abbrev_number);
if (!abbrev)
- error (_("Dwarf Error: could not find abbrev number %d [in module %s]"),
- abbrev_number,
- bfd_get_filename (abfd));
+ error (_ ("Dwarf Error: could not find abbrev number %d [in module %s]"),
+ abbrev_number, bfd_get_filename (abfd));
die = dwarf_alloc_die (cu, abbrev->num_attrs + num_extra_attrs);
die->sect_off = sect_off;
@@ -17937,8 +17676,8 @@ read_full_die_1 (const struct die_reader_specs *reader,
bool any_need_reprocess = false;
for (i = 0; i < abbrev->num_attrs; ++i)
{
- info_ptr = read_attribute (reader, &die->attrs[i], &abbrev->attrs[i],
- info_ptr);
+ info_ptr
+ = read_attribute (reader, &die->attrs[i], &abbrev->attrs[i], info_ptr);
if (die->attrs[i].requires_reprocessing_p ())
any_need_reprocess = true;
}
@@ -17976,8 +17715,8 @@ read_full_die_1 (const struct die_reader_specs *reader,
except for its child, sibling, and parent fields. */
static const gdb_byte *
-read_full_die (const struct die_reader_specs *reader,
- struct die_info **diep, const gdb_byte *info_ptr)
+read_full_die (const struct die_reader_specs *reader, struct die_info **diep,
+ const gdb_byte *info_ptr)
{
const gdb_byte *result;
@@ -17985,8 +17724,7 @@ read_full_die (const struct die_reader_specs *reader,
if (dwarf_die_debug)
{
- gdb_printf (gdb_stdlog,
- "Read die from %s@0x%x of %s:\n",
+ gdb_printf (gdb_stdlog, "Read die from %s@0x%x of %s:\n",
reader->die_section->get_name (),
(unsigned) (info_ptr - reader->die_section->buffer),
bfd_get_filename (reader->abfd));
@@ -17995,7 +17733,6 @@ read_full_die (const struct die_reader_specs *reader,
return result;
}
-
void
cooked_indexer::check_bounds (cutu_reader *reader)
@@ -18083,8 +17820,8 @@ cooked_indexer::ensure_cu_exists (cutu_reader *reader,
prepare_one_comp_unit (new_reader.cu, new_reader.comp_unit_die,
language_minimal);
- std::unique_ptr<cutu_reader> copy
- (new cutu_reader (std::move (new_reader)));
+ std::unique_ptr<cutu_reader> copy (
+ new cutu_reader (std::move (new_reader)));
result = m_index_storage->preserve (std::move (copy));
}
@@ -18098,18 +17835,13 @@ cooked_indexer::ensure_cu_exists (cutu_reader *reader,
}
const gdb_byte *
-cooked_indexer::scan_attributes (dwarf2_per_cu_data *scanning_per_cu,
- cutu_reader *reader,
- const gdb_byte *watermark_ptr,
- const gdb_byte *info_ptr,
- const abbrev_info *abbrev,
- const char **name,
- const char **linkage_name,
- cooked_index_flag *flags,
- sect_offset *sibling_offset,
- const cooked_index_entry **parent_entry,
- CORE_ADDR *maybe_defer,
- bool for_specification)
+cooked_indexer::scan_attributes (
+ dwarf2_per_cu_data *scanning_per_cu, cutu_reader *reader,
+ const gdb_byte *watermark_ptr, const gdb_byte *info_ptr,
+ const abbrev_info *abbrev, const char **name, const char **linkage_name,
+ cooked_index_flag *flags, sect_offset *sibling_offset,
+ const cooked_index_entry **parent_entry, CORE_ADDR *maybe_defer,
+ bool for_specification)
{
bool origin_is_dwz = false;
bool is_declaration = false;
@@ -18266,39 +17998,35 @@ cooked_indexer::scan_attributes (dwarf2_per_cu_data *scanning_per_cu,
origin_is_dwz, false);
if (new_reader != nullptr)
{
- const gdb_byte *new_info_ptr = (new_reader->buffer
- + to_underlying (origin_offset));
+ const gdb_byte *new_info_ptr
+ = (new_reader->buffer + to_underlying (origin_offset));
- if (new_reader->cu == reader->cu
- && new_info_ptr > watermark_ptr
+ if (new_reader->cu == reader->cu && new_info_ptr > watermark_ptr
&& *parent_entry == nullptr)
*maybe_defer = form_addr (origin_offset, origin_is_dwz);
else if (*parent_entry == nullptr)
{
CORE_ADDR lookup = form_addr (origin_offset, origin_is_dwz);
void *obj = m_die_range_map.find (lookup);
- *parent_entry = static_cast <cooked_index_entry *> (obj);
+ *parent_entry = static_cast<cooked_index_entry *> (obj);
}
unsigned int bytes_read;
- const abbrev_info *new_abbrev = peek_die_abbrev (*new_reader,
- new_info_ptr,
- &bytes_read);
+ const abbrev_info *new_abbrev
+ = peek_die_abbrev (*new_reader, new_info_ptr, &bytes_read);
new_info_ptr += bytes_read;
- scan_attributes (scanning_per_cu, new_reader, new_info_ptr, new_info_ptr,
- new_abbrev, name, linkage_name, flags, nullptr,
- parent_entry, maybe_defer, true);
+ scan_attributes (scanning_per_cu, new_reader, new_info_ptr,
+ new_info_ptr, new_abbrev, name, linkage_name, flags,
+ nullptr, parent_entry, maybe_defer, true);
}
}
if (!for_specification)
{
- if (m_language == language_ada
- && *linkage_name == nullptr)
+ if (m_language == language_ada && *linkage_name == nullptr)
*linkage_name = *name;
- if (!scanning_per_cu->addresses_seen
- && low_pc.has_value ()
+ if (!scanning_per_cu->addresses_seen && low_pc.has_value ()
&& (reader->cu->per_objfile->per_bfd->has_section_at_zero
|| *low_pc != 0)
&& high_pc.has_value ())
@@ -18358,8 +18086,8 @@ cooked_indexer::index_imported_unit (cutu_reader *reader,
if (attr.name == DW_AT_import)
{
sect_off = attr.get_ref_die_offset ();
- is_dwz = (attr.form == DW_FORM_GNU_ref_alt
- || reader->cu->per_cu->is_dwz);
+ is_dwz
+ = (attr.form == DW_FORM_GNU_ref_alt || reader->cu->per_cu->is_dwz);
}
}
@@ -18368,8 +18096,8 @@ cooked_indexer::index_imported_unit (cutu_reader *reader,
return info_ptr;
dwarf2_per_objfile *per_objfile = reader->cu->per_objfile;
- cutu_reader *new_reader = ensure_cu_exists (reader, per_objfile, sect_off,
- is_dwz, true);
+ cutu_reader *new_reader
+ = ensure_cu_exists (reader, per_objfile, sect_off, is_dwz, true);
if (new_reader != nullptr)
{
index_dies (new_reader, new_reader->info_ptr, nullptr, false);
@@ -18381,17 +18109,15 @@ cooked_indexer::index_imported_unit (cutu_reader *reader,
}
const gdb_byte *
-cooked_indexer::recurse (cutu_reader *reader,
- const gdb_byte *info_ptr,
- const cooked_index_entry *parent_entry,
- bool fully)
+cooked_indexer::recurse (cutu_reader *reader, const gdb_byte *info_ptr,
+ const cooked_index_entry *parent_entry, bool fully)
{
info_ptr = index_dies (reader, info_ptr, parent_entry, fully);
if (parent_entry != nullptr)
{
- CORE_ADDR start = form_addr (parent_entry->die_offset,
- reader->cu->per_cu->is_dwz);
+ CORE_ADDR start
+ = form_addr (parent_entry->die_offset, reader->cu->per_cu->is_dwz);
CORE_ADDR end = form_addr (sect_offset (info_ptr - 1 - reader->buffer),
reader->cu->per_cu->is_dwz);
m_die_range_map.set_empty (start, end, (void *) parent_entry);
@@ -18401,21 +18127,19 @@ cooked_indexer::recurse (cutu_reader *reader,
}
const gdb_byte *
-cooked_indexer::index_dies (cutu_reader *reader,
- const gdb_byte *info_ptr,
- const cooked_index_entry *parent_entry,
- bool fully)
+cooked_indexer::index_dies (cutu_reader *reader, const gdb_byte *info_ptr,
+ const cooked_index_entry *parent_entry, bool fully)
{
- const gdb_byte *end_ptr = (reader->buffer
- + to_underlying (reader->cu->header.sect_off)
- + reader->cu->header.get_length_with_initial ());
+ const gdb_byte *end_ptr
+ = (reader->buffer + to_underlying (reader->cu->header.sect_off)
+ + reader->cu->header.get_length_with_initial ());
while (info_ptr < end_ptr)
{
sect_offset this_die = (sect_offset) (info_ptr - reader->buffer);
unsigned int bytes_read;
- const abbrev_info *abbrev = peek_die_abbrev (*reader, info_ptr,
- &bytes_read);
+ const abbrev_info *abbrev
+ = peek_die_abbrev (*reader, info_ptr, &bytes_read);
info_ptr += bytes_read;
if (abbrev == nullptr)
break;
@@ -18440,13 +18164,12 @@ cooked_indexer::index_dies (cutu_reader *reader,
cooked_index_flag flags = IS_STATIC;
sect_offset sibling {};
const cooked_index_entry *this_parent_entry = parent_entry;
- info_ptr = scan_attributes (reader->cu->per_cu, reader, info_ptr,
- info_ptr, abbrev, &name, &linkage_name,
- &flags, &sibling, &this_parent_entry,
- &defer, false);
+ info_ptr
+ = scan_attributes (reader->cu->per_cu, reader, info_ptr, info_ptr,
+ abbrev, &name, &linkage_name, &flags, &sibling,
+ &this_parent_entry, &defer, false);
- if (abbrev->tag == DW_TAG_namespace
- && m_language == language_cplus
+ if (abbrev->tag == DW_TAG_namespace && m_language == language_cplus
&& strcmp (name, "::") == 0)
{
/* GCC 4.0 and 4.1 had a bug (PR c++/28460) where they
@@ -18460,13 +18183,12 @@ cooked_indexer::index_dies (cutu_reader *reader,
if (name != nullptr)
{
if (defer != 0)
- m_deferred_entries.push_back ({
- this_die, name, defer, abbrev->tag, flags
- });
+ m_deferred_entries.push_back ({ this_die, name, defer, abbrev->tag,
+ flags });
else
- this_entry = m_index_storage->add (this_die, abbrev->tag, flags,
- name, this_parent_entry,
- m_per_cu);
+ this_entry
+ = m_index_storage->add (this_die, abbrev->tag, flags, name,
+ this_parent_entry, m_per_cu);
}
if (linkage_name != nullptr)
@@ -18479,11 +18201,11 @@ cooked_indexer::index_dies (cutu_reader *reader,
have linkage name present but name is absent. */
if (name != nullptr
|| (abbrev->tag != DW_TAG_subprogram
- && abbrev->tag != DW_TAG_inlined_subroutine
- && abbrev->tag != DW_TAG_entry_point))
+ && abbrev->tag != DW_TAG_inlined_subroutine
+ && abbrev->tag != DW_TAG_entry_point))
flags = flags | IS_LINKAGE;
- m_index_storage->add (this_die, abbrev->tag, flags,
- linkage_name, nullptr, m_per_cu);
+ m_index_storage->add (this_die, abbrev->tag, flags, linkage_name,
+ nullptr, m_per_cu);
}
if (abbrev->has_children)
@@ -18509,9 +18231,8 @@ cooked_indexer::index_dies (cutu_reader *reader,
"enum_class::enumerator"; otherwise we inject the
names into our own parent scope. */
info_ptr = recurse (reader, info_ptr,
- ((flags & IS_ENUM_CLASS) == 0)
- ? parent_entry
- : this_entry,
+ ((flags & IS_ENUM_CLASS) == 0) ? parent_entry
+ : this_entry,
fully);
continue;
@@ -18542,7 +18263,7 @@ cooked_indexer::index_dies (cutu_reader *reader,
= reader->buffer + to_underlying (sibling);
if (sibling_ptr < info_ptr)
- complaint (_("DW_AT_sibling points backwards"));
+ complaint (_ ("DW_AT_sibling points backwards"));
else if (sibling_ptr > reader->buffer_end)
reader->die_section->overflow_complaint ();
else
@@ -18569,7 +18290,7 @@ cooked_indexer::make_index (cutu_reader *reader)
{
CORE_ADDR key = form_addr (entry.die_offset, m_per_cu->is_dwz);
void *obj = m_die_range_map.find (key);
- cooked_index_entry *parent = static_cast <cooked_index_entry *> (obj);
+ cooked_index_entry *parent = static_cast<cooked_index_entry *> (obj);
m_index_storage->add (entry.die_offset, entry.tag, entry.flags,
entry.name, parent, m_per_cu);
}
@@ -18583,15 +18304,15 @@ struct cooked_index_functions : public dwarf2_base_index_functions
dwarf2_per_cu_data *find_per_cu (dwarf2_per_bfd *per_bfd,
CORE_ADDR adjusted_pc) override;
- struct compunit_symtab *find_compunit_symtab_by_address
- (struct objfile *objfile, CORE_ADDR address) override;
+ struct compunit_symtab *
+ find_compunit_symtab_by_address (struct objfile *objfile,
+ CORE_ADDR address) override;
void dump (struct objfile *objfile) override
{
dwarf2_per_objfile *per_objfile = get_dwarf2_per_objfile (objfile);
- cooked_index *index
- = (gdb::checked_static_cast<cooked_index *>
- (per_objfile->per_bfd->index_table.get ()));
+ cooked_index *index = (gdb::checked_static_cast<cooked_index *> (
+ per_objfile->per_bfd->index_table.get ()));
if (index == nullptr)
return;
@@ -18600,27 +18321,20 @@ struct cooked_index_functions : public dwarf2_base_index_functions
index->dump (objfile->arch ());
}
- void expand_matching_symbols
- (struct objfile *,
- const lookup_name_info &lookup_name,
- domain_enum domain,
- int global,
- symbol_compare_ftype *ordered_compare) override;
-
- bool expand_symtabs_matching
- (struct objfile *objfile,
- gdb::function_view<expand_symtabs_file_matcher_ftype> file_matcher,
- const lookup_name_info *lookup_name,
- gdb::function_view<expand_symtabs_symbol_matcher_ftype> symbol_matcher,
- gdb::function_view<expand_symtabs_exp_notify_ftype> expansion_notify,
- block_search_flags search_flags,
- domain_enum domain,
- enum search_domain kind) override;
-
- bool can_lazily_read_symbols () override
- {
- return true;
- }
+ void expand_matching_symbols (
+ struct objfile *, const lookup_name_info &lookup_name, domain_enum domain,
+ int global, symbol_compare_ftype *ordered_compare) override;
+
+ bool expand_symtabs_matching (
+ struct objfile *objfile,
+ gdb::function_view<expand_symtabs_file_matcher_ftype> file_matcher,
+ const lookup_name_info *lookup_name,
+ gdb::function_view<expand_symtabs_symbol_matcher_ftype> symbol_matcher,
+ gdb::function_view<expand_symtabs_exp_notify_ftype> expansion_notify,
+ block_search_flags search_flags, domain_enum domain,
+ enum search_domain kind) override;
+
+ bool can_lazily_read_symbols () override { return true; }
void read_partial_symbols (struct objfile *objfile) override
{
@@ -18634,24 +18348,22 @@ cooked_index_functions::find_per_cu (dwarf2_per_bfd *per_bfd,
CORE_ADDR adjusted_pc)
{
cooked_index *table
- = (gdb::checked_static_cast<cooked_index *>
- (per_bfd->index_table.get ()));
+ = (gdb::checked_static_cast<cooked_index *> (per_bfd->index_table.get ()));
if (table == nullptr)
return nullptr;
return table->lookup (adjusted_pc);
}
struct compunit_symtab *
-cooked_index_functions::find_compunit_symtab_by_address
- (struct objfile *objfile, CORE_ADDR address)
+cooked_index_functions::find_compunit_symtab_by_address (
+ struct objfile *objfile, CORE_ADDR address)
{
if (objfile->sect_index_data == -1)
return nullptr;
dwarf2_per_objfile *per_objfile = get_dwarf2_per_objfile (objfile);
- cooked_index *table
- = (gdb::checked_static_cast<cooked_index *>
- (per_objfile->per_bfd->index_table.get ()));
+ cooked_index *table = (gdb::checked_static_cast<cooked_index *> (
+ per_objfile->per_bfd->index_table.get ()));
if (table == nullptr)
return nullptr;
@@ -18664,23 +18376,18 @@ cooked_index_functions::find_compunit_symtab_by_address
}
void
-cooked_index_functions::expand_matching_symbols
- (struct objfile *objfile,
- const lookup_name_info &lookup_name,
- domain_enum domain,
- int global,
- symbol_compare_ftype *ordered_compare)
+cooked_index_functions::expand_matching_symbols (
+ struct objfile *objfile, const lookup_name_info &lookup_name,
+ domain_enum domain, int global, symbol_compare_ftype *ordered_compare)
{
dwarf2_per_objfile *per_objfile = get_dwarf2_per_objfile (objfile);
- cooked_index *table
- = (gdb::checked_static_cast<cooked_index *>
- (per_objfile->per_bfd->index_table.get ()));
+ cooked_index *table = (gdb::checked_static_cast<cooked_index *> (
+ per_objfile->per_bfd->index_table.get ()));
if (table == nullptr)
return;
- const block_search_flags search_flags = (global
- ? SEARCH_GLOBAL_BLOCK
- : SEARCH_STATIC_BLOCK);
+ const block_search_flags search_flags
+ = (global ? SEARCH_GLOBAL_BLOCK : SEARCH_STATIC_BLOCK);
const language_defn *lang = language_def (language_ada);
symbol_name_matcher_ftype *name_match
= lang->get_symbol_name_matcher (lookup_name);
@@ -18692,8 +18399,7 @@ cooked_index_functions::expand_matching_symbols
if (entry->parent_entry != nullptr)
continue;
- if (!entry->matches (search_flags)
- || !entry->matches (domain))
+ if (!entry->matches (search_flags) || !entry->matches (domain))
continue;
if (name_match (entry->canonical, lookup_name, nullptr))
@@ -18702,21 +18408,18 @@ cooked_index_functions::expand_matching_symbols
}
bool
-cooked_index_functions::expand_symtabs_matching
- (struct objfile *objfile,
- gdb::function_view<expand_symtabs_file_matcher_ftype> file_matcher,
- const lookup_name_info *lookup_name,
- gdb::function_view<expand_symtabs_symbol_matcher_ftype> symbol_matcher,
- gdb::function_view<expand_symtabs_exp_notify_ftype> expansion_notify,
- block_search_flags search_flags,
- domain_enum domain,
- enum search_domain kind)
+cooked_index_functions::expand_symtabs_matching (
+ struct objfile *objfile,
+ gdb::function_view<expand_symtabs_file_matcher_ftype> file_matcher,
+ const lookup_name_info *lookup_name,
+ gdb::function_view<expand_symtabs_symbol_matcher_ftype> symbol_matcher,
+ gdb::function_view<expand_symtabs_exp_notify_ftype> expansion_notify,
+ block_search_flags search_flags, domain_enum domain, enum search_domain kind)
{
dwarf2_per_objfile *per_objfile = get_dwarf2_per_objfile (objfile);
- cooked_index *table
- = (gdb::checked_static_cast<cooked_index *>
- (per_objfile->per_bfd->index_table.get ()));
+ cooked_index *table = (gdb::checked_static_cast<cooked_index *> (
+ per_objfile->per_bfd->index_table.get ()));
if (table == nullptr)
return true;
@@ -18728,8 +18431,7 @@ cooked_index_functions::expand_symtabs_matching
gdb_assert (lookup_name != nullptr || symbol_matcher == nullptr);
if (lookup_name == nullptr)
{
- for (dwarf2_per_cu_data *per_cu
- : all_units_range (per_objfile->per_bfd))
+ for (dwarf2_per_cu_data *per_cu : all_units_range (per_objfile->per_bfd))
{
QUIT;
@@ -18746,16 +18448,14 @@ cooked_index_functions::expand_symtabs_matching
bool completing = lookup_name->completion_mode ();
/* Unique styles of language splitting. */
- static const enum language unique_styles[] =
- {
- /* No splitting is also a style. */
- language_c,
- /* This includes Rust. */
- language_cplus,
- /* This includes Go. */
- language_d,
- language_ada
- };
+ static const enum language unique_styles[]
+ = { /* No splitting is also a style. */
+ language_c,
+ /* This includes Rust. */
+ language_cplus,
+ /* This includes Go. */
+ language_d, language_ada
+ };
for (enum language lang : unique_styles)
{
@@ -18763,8 +18463,8 @@ cooked_index_functions::expand_symtabs_matching
= lookup_name_without_params.split_name (lang);
std::string last_name = gdb::to_string (name_vec.back ());
- for (const cooked_index_entry *entry : table->find (last_name,
- completing))
+ for (const cooked_index_entry *entry :
+ table->find (last_name, completing))
{
QUIT;
@@ -18778,8 +18478,7 @@ cooked_index_functions::expand_symtabs_matching
continue;
/* See if the symbol matches the type filter. */
- if (!entry->matches (search_flags)
- || !entry->matches (domain)
+ if (!entry->matches (search_flags) || !entry->matches (domain)
|| !entry->matches (kind))
continue;
@@ -18795,7 +18494,8 @@ cooked_index_functions::expand_symtabs_matching
match, this did not match. */
if (parent == nullptr
|| strncmp (parent->name, name_vec[i - 1].data (),
- name_vec[i - 1].length ()) != 0)
+ name_vec[i - 1].length ())
+ != 0)
{
found = false;
break;
@@ -18851,8 +18551,6 @@ cooked_index::make_quick_functions () const
return make_cooked_index_funcs ();
}
-
-
/* Read the .debug_loclists or .debug_rnglists header (they are the same format)
contents from the given SECTION in the HEADER.
@@ -18897,7 +18595,7 @@ lookup_loclist_base (struct dwarf2_cu *cu)
if (cu->dwo_unit != nullptr)
{
if (cu->header.initial_length_size == 4)
- return LOCLIST_HEADER_SIZE32;
+ return LOCLIST_HEADER_SIZE32;
return LOCLIST_HEADER_SIZE64;
}
return cu->loclist_base;
@@ -18912,14 +18610,14 @@ read_loclist_index (struct dwarf2_cu *cu, ULONGEST loclist_index)
dwarf2_per_objfile *per_objfile = cu->per_objfile;
struct objfile *objfile = per_objfile->objfile;
bfd *abfd = objfile->obfd.get ();
- ULONGEST loclist_header_size =
- (cu->header.initial_length_size == 4 ? LOCLIST_HEADER_SIZE32
- : LOCLIST_HEADER_SIZE64);
+ ULONGEST loclist_header_size
+ = (cu->header.initial_length_size == 4 ? LOCLIST_HEADER_SIZE32
+ : LOCLIST_HEADER_SIZE64);
ULONGEST loclist_base = lookup_loclist_base (cu);
/* Offset in .debug_loclists of the offset for LOCLIST_INDEX. */
- ULONGEST start_offset =
- loclist_base + loclist_index * cu->header.offset_size;
+ ULONGEST start_offset
+ = loclist_base + loclist_index * cu->header.offset_size;
/* Get loclists section. */
struct dwarf2_section_info *section = cu_debug_loc_section (cu);
@@ -18927,30 +18625,33 @@ read_loclist_index (struct dwarf2_cu *cu, ULONGEST loclist_index)
/* Read the loclists section content. */
section->read (objfile);
if (section->buffer == NULL)
- error (_("DW_FORM_loclistx used without .debug_loclists "
- "section [in module %s]"), objfile_name (objfile));
+ error (_ ("DW_FORM_loclistx used without .debug_loclists "
+ "section [in module %s]"),
+ objfile_name (objfile));
/* DW_AT_loclists_base points after the .debug_loclists contribution header,
so if loclist_base is smaller than the header size, we have a problem. */
if (loclist_base < loclist_header_size)
- error (_("DW_AT_loclists_base is smaller than header size [in module %s]"),
- objfile_name (objfile));
+ error (
+ _ ("DW_AT_loclists_base is smaller than header size [in module %s]"),
+ objfile_name (objfile));
/* Read the header of the loclists contribution. */
struct loclists_rnglists_header header;
read_loclists_rnglists_header (&header, section,
- (sect_offset) (loclist_base - loclist_header_size));
+ (sect_offset) (loclist_base
+ - loclist_header_size));
/* Verify the loclist index is valid. */
if (loclist_index >= header.offset_entry_count)
- error (_("DW_FORM_loclistx pointing outside of "
- ".debug_loclists offset array [in module %s]"),
+ error (_ ("DW_FORM_loclistx pointing outside of "
+ ".debug_loclists offset array [in module %s]"),
objfile_name (objfile));
/* Validate that reading won't go beyond the end of the section. */
if (start_offset + cu->header.offset_size > section->size)
- error (_("Reading DW_FORM_loclistx index beyond end of"
- ".debug_loclists section [in module %s]"),
+ error (_ ("Reading DW_FORM_loclistx index beyond end of"
+ ".debug_loclists section [in module %s]"),
objfile_name (objfile));
const gdb_byte *info_ptr = section->buffer + start_offset;
@@ -18971,19 +18672,19 @@ read_rnglist_index (struct dwarf2_cu *cu, ULONGEST rnglist_index,
struct dwarf2_per_objfile *dwarf2_per_objfile = cu->per_objfile;
struct objfile *objfile = dwarf2_per_objfile->objfile;
bfd *abfd = objfile->obfd.get ();
- ULONGEST rnglist_header_size =
- (cu->header.initial_length_size == 4 ? RNGLIST_HEADER_SIZE32
- : RNGLIST_HEADER_SIZE64);
+ ULONGEST rnglist_header_size
+ = (cu->header.initial_length_size == 4 ? RNGLIST_HEADER_SIZE32
+ : RNGLIST_HEADER_SIZE64);
/* When reading a DW_FORM_rnglistx from a DWO, we read from the DWO's
.debug_rnglists.dwo section. The rnglists base given in the skeleton
doesn't apply. */
- ULONGEST rnglist_base =
- (cu->dwo_unit != nullptr) ? rnglist_header_size : cu->rnglists_base;
+ ULONGEST rnglist_base
+ = (cu->dwo_unit != nullptr) ? rnglist_header_size : cu->rnglists_base;
/* Offset in .debug_rnglists of the offset for RNGLIST_INDEX. */
- ULONGEST start_offset =
- rnglist_base + rnglist_index * cu->header.offset_size;
+ ULONGEST start_offset
+ = rnglist_base + rnglist_index * cu->header.offset_size;
/* Get rnglists section. */
struct dwarf2_section_info *section = cu_debug_rnglists_section (cu, tag);
@@ -18991,31 +18692,33 @@ read_rnglist_index (struct dwarf2_cu *cu, ULONGEST rnglist_index,
/* Read the rnglists section content. */
section->read (objfile);
if (section->buffer == nullptr)
- error (_("DW_FORM_rnglistx used without .debug_rnglists section "
- "[in module %s]"),
+ error (_ ("DW_FORM_rnglistx used without .debug_rnglists section "
+ "[in module %s]"),
objfile_name (objfile));
/* DW_AT_rnglists_base points after the .debug_rnglists contribution header,
so if rnglist_base is smaller than the header size, we have a problem. */
if (rnglist_base < rnglist_header_size)
- error (_("DW_AT_rnglists_base is smaller than header size [in module %s]"),
- objfile_name (objfile));
+ error (
+ _ ("DW_AT_rnglists_base is smaller than header size [in module %s]"),
+ objfile_name (objfile));
/* Read the header of the rnglists contribution. */
struct loclists_rnglists_header header;
read_loclists_rnglists_header (&header, section,
- (sect_offset) (rnglist_base - rnglist_header_size));
+ (sect_offset) (rnglist_base
+ - rnglist_header_size));
/* Verify the rnglist index is valid. */
if (rnglist_index >= header.offset_entry_count)
- error (_("DW_FORM_rnglistx index pointing outside of "
- ".debug_rnglists offset array [in module %s]"),
+ error (_ ("DW_FORM_rnglistx index pointing outside of "
+ ".debug_rnglists offset array [in module %s]"),
objfile_name (objfile));
/* Validate that reading won't go beyond the end of the section. */
if (start_offset + cu->header.offset_size > section->size)
- error (_("Reading DW_FORM_rnglistx index beyond end of"
- ".debug_rnglists section [in module %s]"),
+ error (_ ("Reading DW_FORM_rnglistx index beyond end of"
+ ".debug_rnglists section [in module %s]"),
objfile_name (objfile));
const gdb_byte *info_ptr = section->buffer + start_offset;
@@ -19037,46 +18740,44 @@ read_attribute_reprocess (const struct die_reader_specs *reader,
struct dwarf2_cu *cu = reader->cu;
switch (attr->form)
{
- case DW_FORM_addrx:
- case DW_FORM_GNU_addr_index:
- attr->set_address (read_addr_index (cu,
- attr->as_unsigned_reprocess ()));
- break;
- case DW_FORM_loclistx:
- {
- sect_offset loclists_sect_off
- = read_loclist_index (cu, attr->as_unsigned_reprocess ());
+ case DW_FORM_addrx:
+ case DW_FORM_GNU_addr_index:
+ attr->set_address (read_addr_index (cu, attr->as_unsigned_reprocess ()));
+ break;
+ case DW_FORM_loclistx:
+ {
+ sect_offset loclists_sect_off
+ = read_loclist_index (cu, attr->as_unsigned_reprocess ());
- attr->set_unsigned (to_underlying (loclists_sect_off));
- }
- break;
- case DW_FORM_rnglistx:
- {
- sect_offset rnglists_sect_off
- = read_rnglist_index (cu, attr->as_unsigned_reprocess (), tag);
+ attr->set_unsigned (to_underlying (loclists_sect_off));
+ }
+ break;
+ case DW_FORM_rnglistx:
+ {
+ sect_offset rnglists_sect_off
+ = read_rnglist_index (cu, attr->as_unsigned_reprocess (), tag);
- attr->set_unsigned (to_underlying (rnglists_sect_off));
- }
+ attr->set_unsigned (to_underlying (rnglists_sect_off));
+ }
+ break;
+ case DW_FORM_strx:
+ case DW_FORM_strx1:
+ case DW_FORM_strx2:
+ case DW_FORM_strx3:
+ case DW_FORM_strx4:
+ case DW_FORM_GNU_str_index:
+ {
+ unsigned int str_index = attr->as_unsigned_reprocess ();
+ gdb_assert (!attr->canonical_string_p ());
+ if (reader->dwo_file != NULL)
+ attr->set_string_noncanonical (read_dwo_str_index (reader,
+ str_index));
+ else
+ attr->set_string_noncanonical (read_stub_str_index (cu, str_index));
break;
- case DW_FORM_strx:
- case DW_FORM_strx1:
- case DW_FORM_strx2:
- case DW_FORM_strx3:
- case DW_FORM_strx4:
- case DW_FORM_GNU_str_index:
- {
- unsigned int str_index = attr->as_unsigned_reprocess ();
- gdb_assert (!attr->canonical_string_p ());
- if (reader->dwo_file != NULL)
- attr->set_string_noncanonical (read_dwo_str_index (reader,
- str_index));
- else
- attr->set_string_noncanonical (read_stub_str_index (cu,
- str_index));
- break;
- }
- default:
- gdb_assert_not_reached ("Unexpected DWARF form.");
+ }
+ default:
+ gdb_assert_not_reached ("Unexpected DWARF form.");
}
}
@@ -19176,10 +18877,8 @@ read_attribute_value (const struct die_reader_specs *reader,
case DW_FORM_strp:
if (!cu->per_cu->is_dwz)
{
- attr->set_string_noncanonical
- (read_indirect_string (per_objfile,
- abfd, info_ptr, cu_header,
- &bytes_read));
+ attr->set_string_noncanonical (read_indirect_string (
+ per_objfile, abfd, info_ptr, cu_header, &bytes_read));
info_ptr += bytes_read;
break;
}
@@ -19187,9 +18886,8 @@ read_attribute_value (const struct die_reader_specs *reader,
case DW_FORM_line_strp:
if (!cu->per_cu->is_dwz)
{
- attr->set_string_noncanonical
- (per_objfile->read_line_string (info_ptr, cu_header,
- &bytes_read));
+ attr->set_string_noncanonical (
+ per_objfile->read_line_string (info_ptr, cu_header, &bytes_read));
info_ptr += bytes_read;
break;
}
@@ -19197,11 +18895,10 @@ read_attribute_value (const struct die_reader_specs *reader,
case DW_FORM_GNU_strp_alt:
{
dwz_file *dwz = dwarf2_get_dwz_file (per_objfile->per_bfd, true);
- LONGEST str_offset = cu_header->read_offset (abfd, info_ptr,
- &bytes_read);
+ LONGEST str_offset
+ = cu_header->read_offset (abfd, info_ptr, &bytes_read);
- attr->set_string_noncanonical
- (dwz->read_string (objfile, str_offset));
+ attr->set_string_noncanonical (dwz->read_string (objfile, str_offset));
info_ptr += bytes_read;
}
break;
@@ -19283,8 +18980,8 @@ read_attribute_value (const struct die_reader_specs *reader,
implicit_const = read_signed_leb128 (abfd, info_ptr, &bytes_read);
info_ptr += bytes_read;
}
- info_ptr = read_attribute_value (reader, attr, form, implicit_const,
- info_ptr);
+ info_ptr
+ = read_attribute_value (reader, attr, form, implicit_const, info_ptr);
break;
case DW_FORM_implicit_const:
attr->set_signed (implicit_const);
@@ -19332,9 +19029,9 @@ read_attribute_value (const struct die_reader_specs *reader,
}
break;
default:
- error (_("Dwarf Error: Cannot handle %s in DWARF reader [in module %s]"),
- dwarf_form_name (form),
- bfd_get_filename (abfd));
+ error (
+ _ ("Dwarf Error: Cannot handle %s in DWARF reader [in module %s]"),
+ dwarf_form_name (form), bfd_get_filename (abfd));
}
/* Super hack. */
@@ -19347,13 +19044,12 @@ read_attribute_value (const struct die_reader_specs *reader,
an object of this size seems pretty unlikely so we can relatively
safely treat these cases as if the size attribute was invalid and
treat them as zero by default. */
- if (attr->name == DW_AT_byte_size
- && form == DW_FORM_data4
+ if (attr->name == DW_AT_byte_size && form == DW_FORM_data4
&& attr->as_unsigned () >= 0xffffffff)
{
- complaint
- (_("Suspicious DW_AT_byte_size value treated as zero instead of %s"),
- hex_string (attr->as_unsigned ()));
+ complaint (
+ _ ("Suspicious DW_AT_byte_size value treated as zero instead of %s"),
+ hex_string (attr->as_unsigned ()));
attr->set_unsigned (0);
}
@@ -19363,9 +19059,8 @@ read_attribute_value (const struct die_reader_specs *reader,
/* Read an attribute described by an abbreviated attribute. */
static const gdb_byte *
-read_attribute (const struct die_reader_specs *reader,
- struct attribute *attr, const struct attr_abbrev *abbrev,
- const gdb_byte *info_ptr)
+read_attribute (const struct die_reader_specs *reader, struct attribute *attr,
+ const struct attr_abbrev *abbrev, const gdb_byte *info_ptr)
{
attr->name = abbrev->name;
attr->string_is_canonical = 0;
@@ -19408,7 +19103,8 @@ dwarf2_per_objfile::read_line_string (const gdb_byte *buf,
bfd *abfd = objfile->obfd.get ();
ULONGEST str_offset = read_offset (abfd, buf, offset_size);
- return per_bfd->line_str.read_string (objfile, str_offset, "DW_FORM_line_strp");
+ return per_bfd->line_str.read_string (objfile, str_offset,
+ "DW_FORM_line_strp");
}
/* See read.h. */
@@ -19421,7 +19117,8 @@ dwarf2_per_objfile::read_line_string (const gdb_byte *buf,
bfd *abfd = objfile->obfd.get ();
LONGEST str_offset = cu_header->read_offset (abfd, buf, bytes_read_ptr);
- return per_bfd->line_str.read_string (objfile, str_offset, "DW_FORM_line_strp");
+ return per_bfd->line_str.read_string (objfile, str_offset,
+ "DW_FORM_line_strp");
}
/* Given index ADDR_INDEX in .debug_addr, fetch the value.
@@ -19439,12 +19136,13 @@ read_addr_index_1 (dwarf2_per_objfile *per_objfile, unsigned int addr_index,
per_objfile->per_bfd->addr.read (objfile);
if (per_objfile->per_bfd->addr.buffer == NULL)
- error (_("DW_FORM_addr_index used without .debug_addr section [in module %s]"),
- objfile_name (objfile));
+ error (
+ _ ("DW_FORM_addr_index used without .debug_addr section [in module %s]"),
+ objfile_name (objfile));
if (addr_base_or_zero + addr_index * addr_size
>= per_objfile->per_bfd->addr.size)
- error (_("DW_FORM_addr_index pointing outside of "
- ".debug_addr section [in module %s]"),
+ error (_ ("DW_FORM_addr_index pointing outside of "
+ ".debug_addr section [in module %s]"),
objfile_name (objfile));
info_ptr = (per_objfile->per_bfd->addr.buffer + addr_base_or_zero
+ addr_index * addr_size);
@@ -19459,8 +19157,8 @@ read_addr_index_1 (dwarf2_per_objfile *per_objfile, unsigned int addr_index,
static CORE_ADDR
read_addr_index (struct dwarf2_cu *cu, unsigned int addr_index)
{
- return read_addr_index_1 (cu->per_objfile, addr_index,
- cu->addr_base, cu->header.addr_size);
+ return read_addr_index_1 (cu->per_objfile, addr_index, cu->addr_base,
+ cu->header.addr_size);
}
/* Given a pointer to an leb128 value, fetch the value from .debug_addr. */
@@ -19522,8 +19220,7 @@ dwarf2_read_addr_index (dwarf2_per_cu_data *per_cu,
DWO file. */
static const char *
-read_str_index (struct dwarf2_cu *cu,
- struct dwarf2_section_info *str_section,
+read_str_index (struct dwarf2_cu *cu, struct dwarf2_section_info *str_section,
struct dwarf2_section_info *str_offsets_section,
ULONGEST str_offsets_base, ULONGEST str_index,
unsigned offset_size)
@@ -19539,25 +19236,24 @@ read_str_index (struct dwarf2_cu *cu,
str_section->read (objfile);
str_offsets_section->read (objfile);
if (str_section->buffer == NULL)
- error (_("%s used without %s section"
- " in CU at offset %s [in module %s]"),
+ error (_ ("%s used without %s section"
+ " in CU at offset %s [in module %s]"),
form_name, str_section->get_name (),
sect_offset_str (cu->header.sect_off), objf_name);
if (str_offsets_section->buffer == NULL)
- error (_("%s used without %s section"
- " in CU at offset %s [in module %s]"),
+ error (_ ("%s used without %s section"
+ " in CU at offset %s [in module %s]"),
form_name, str_section->get_name (),
sect_offset_str (cu->header.sect_off), objf_name);
- info_ptr = (str_offsets_section->buffer
- + str_offsets_base
+ info_ptr = (str_offsets_section->buffer + str_offsets_base
+ str_index * offset_size);
if (offset_size == 4)
str_offset = bfd_get_32 (abfd, info_ptr);
else
str_offset = bfd_get_64 (abfd, info_ptr);
if (str_offset >= str_section->size)
- error (_("Offset from %s pointing outside of"
- " .debug_str.dwo section in CU at offset %s [in module %s]"),
+ error (_ ("Offset from %s pointing outside of"
+ " .debug_str.dwo section in CU at offset %s [in module %s]"),
form_name, sect_offset_str (cu->header.sect_off), objf_name);
return (const char *) (str_section->buffer + str_offset);
}
@@ -19595,9 +19291,9 @@ read_dwo_str_index (const struct die_reader_specs *reader, ULONGEST str_index)
because we parse the header more than once (see FIXME above)
we'd have many warnings, so use a complaint instead, which at
least has a limit. */
- complaint (_("Section .debug_str_offsets in %s has unsupported"
- " version %d, use empty string."),
- reader->dwo_file->dwo_name, version);
+ complaint (_ ("Section .debug_str_offsets in %s has unsupported"
+ " version %d, use empty string."),
+ reader->dwo_file->dwo_name, version);
return "";
}
@@ -19615,10 +19311,9 @@ read_dwo_str_index (const struct die_reader_specs *reader, ULONGEST str_index)
/* Determine offset_size based on the .debug_info header. */
offset_size = reader->cu->header.offset_size;
- }
+ }
- return read_str_index (reader->cu,
- &reader->dwo_file->sections.str,
+ return read_str_index (reader->cu, &reader->dwo_file->sections.str,
&reader->dwo_file->sections.str_offsets,
str_offsets_base, str_index, offset_size);
}
@@ -19634,13 +19329,12 @@ read_stub_str_index (struct dwarf2_cu *cu, ULONGEST str_index)
static const char str_offsets_attr_name[] = "DW_AT_str_offsets";
if (!cu->str_offsets_base.has_value ())
- error (_("%s used in Fission stub without %s"
- " in CU at offset 0x%lx [in module %s]"),
- form_name, str_offsets_attr_name,
- (long) cu->header.offset_size, objf_name);
+ error (_ ("%s used in Fission stub without %s"
+ " in CU at offset 0x%lx [in module %s]"),
+ form_name, str_offsets_attr_name, (long) cu->header.offset_size,
+ objf_name);
- return read_str_index (cu,
- &cu->per_objfile->per_bfd->str,
+ return read_str_index (cu, &cu->per_objfile->per_bfd->str,
&cu->per_objfile->per_bfd->str_offsets,
*cu->str_offsets_base, str_index,
cu->header.offset_size);
@@ -19760,7 +19454,8 @@ dwarf2_attr (struct die_info *die, unsigned int name, struct dwarf2_cu *cu)
is either not found or is of an incorrect type. */
static const char *
-dwarf2_string_attr (struct die_info *die, unsigned int name, struct dwarf2_cu *cu)
+dwarf2_string_attr (struct die_info *die, unsigned int name,
+ struct dwarf2_cu *cu)
{
struct attribute *attr;
const char *str = NULL;
@@ -19771,8 +19466,8 @@ dwarf2_string_attr (struct die_info *die, unsigned int name, struct dwarf2_cu *c
{
str = attr->as_string ();
if (str == nullptr)
- complaint (_("string type expected for attribute %s for "
- "DIE at %s in module %s"),
+ complaint (_ ("string type expected for attribute %s for "
+ "DIE at %s in module %s"),
dwarf_attr_name (name), sect_offset_str (die->sect_off),
objfile_name (cu->per_objfile->objfile));
}
@@ -19826,8 +19521,8 @@ die_is_declaration (struct die_info *die, struct dwarf2_cu *cu)
static struct die_info *
die_specification (struct die_info *die, struct dwarf2_cu **spec_cu)
{
- struct attribute *spec_attr = dwarf2_attr (die, DW_AT_specification,
- *spec_cu);
+ struct attribute *spec_attr
+ = dwarf2_attr (die, DW_AT_specification, *spec_cu);
if (spec_attr == NULL)
spec_attr = dwarf2_attr (die, DW_AT_abstract_origin, *spec_cu);
@@ -19884,15 +19579,14 @@ dwarf_decode_line_header (sect_offset sect_off, struct dwarf2_cu *cu,
if (section->buffer == NULL)
{
if (cu->dwo_unit && cu->per_cu->is_debug_types)
- complaint (_("missing .debug_line.dwo section"));
+ complaint (_ ("missing .debug_line.dwo section"));
else
- complaint (_("missing .debug_line section"));
+ complaint (_ ("missing .debug_line section"));
return 0;
}
- return dwarf_decode_line_header (sect_off, cu->per_cu->is_dwz,
- per_objfile, section, &cu->header,
- comp_dir);
+ return dwarf_decode_line_header (sect_off, cu->per_cu->is_dwz, per_objfile,
+ section, &cu->header, comp_dir);
}
/* Subroutine of dwarf_decode_lines to simplify it.
@@ -19969,6 +19663,7 @@ compute_include_file_name (const struct line_header *lh, const file_entry &fe,
class lnp_state_machine
{
public:
+
/* Initialize a machine state for the start of a line number
program. */
lnp_state_machine (struct dwarf2_cu *cu, gdbarch *arch, line_header *lh);
@@ -19986,8 +19681,7 @@ public:
/* Check ADDRESS is -1, or zero and less than UNRELOCATED_LOWPC, and if true
nop-out rest of the lines in this sequence. */
- void check_line_address (struct dwarf2_cu *cu,
- const gdb_byte *line_ptr,
+ void check_line_address (struct dwarf2_cu *cu, const gdb_byte *line_ptr,
CORE_ADDR unrelocated_lowpc, CORE_ADDR address);
void handle_set_discriminator (unsigned int discriminator)
@@ -20011,19 +19705,13 @@ public:
void handle_special_opcode (unsigned char op_code);
/* Handle DW_LNS_advance_line. */
- void handle_advance_line (int line_delta)
- {
- advance_line (line_delta);
- }
+ void handle_advance_line (int line_delta) { advance_line (line_delta); }
/* Handle DW_LNS_set_file. */
void handle_set_file (file_name_index file);
/* Handle DW_LNS_negate_stmt. */
- void handle_negate_stmt ()
- {
- m_flags ^= LEF_IS_STMT;
- }
+ void handle_negate_stmt () { m_flags ^= LEF_IS_STMT; }
/* Handle DW_LNS_const_add_pc. */
void handle_const_add_pc ();
@@ -20044,18 +19732,13 @@ public:
}
/* Handle DW_LNE_end_sequence. */
- void handle_end_sequence ()
- {
- m_currently_recording_lines = true;
- }
+ void handle_end_sequence () { m_currently_recording_lines = true; }
/* Handle DW_LNS_set_prologue_end. */
- void handle_set_prologue_end ()
- {
- m_flags |= LEF_PROLOGUE_END;
- }
+ void handle_set_prologue_end () { m_flags |= LEF_PROLOGUE_END; }
private:
+
/* Advance the line by LINE_DELTA. */
void advance_line (int line_delta)
{
@@ -20116,12 +19799,12 @@ private:
void
lnp_state_machine::handle_advance_pc (CORE_ADDR adjust)
{
- CORE_ADDR addr_adj = (((m_op_index + adjust)
- / m_line_header->maximum_ops_per_instruction)
- * m_line_header->minimum_instruction_length);
+ CORE_ADDR addr_adj
+ = (((m_op_index + adjust) / m_line_header->maximum_ops_per_instruction)
+ * m_line_header->minimum_instruction_length);
m_address += gdbarch_adjust_dwarf2_line (m_gdbarch, addr_adj, true);
- m_op_index = ((m_op_index + adjust)
- % m_line_header->maximum_ops_per_instruction);
+ m_op_index
+ = ((m_op_index + adjust) % m_line_header->maximum_ops_per_instruction);
}
void
@@ -20167,13 +19850,12 @@ lnp_state_machine::handle_const_add_pc ()
= (255 - m_line_header->opcode_base) / m_line_header->line_range;
CORE_ADDR addr_adj
- = (((m_op_index + adjust)
- / m_line_header->maximum_ops_per_instruction)
+ = (((m_op_index + adjust) / m_line_header->maximum_ops_per_instruction)
* m_line_header->minimum_instruction_length);
m_address += gdbarch_adjust_dwarf2_line (m_gdbarch, addr_adj, true);
- m_op_index = ((m_op_index + adjust)
- % m_line_header->maximum_ops_per_instruction);
+ m_op_index
+ = ((m_op_index + adjust) % m_line_header->maximum_ops_per_instruction);
}
/* Return non-zero if we should add LINE to the line number table.
@@ -20207,8 +19889,8 @@ lnp_state_machine::handle_const_add_pc ()
within one sequence, thus this coalescing is ok. */
static int
-dwarf_record_line_p (struct dwarf2_cu *cu,
- unsigned int line, unsigned int last_line,
+dwarf_record_line_p (struct dwarf2_cu *cu, unsigned int line,
+ unsigned int last_line,
int line_has_non_zero_discriminator,
struct subfile *last_subfile)
{
@@ -20230,16 +19912,14 @@ dwarf_record_line_p (struct dwarf2_cu *cu,
static void
dwarf_record_line_1 (struct gdbarch *gdbarch, struct subfile *subfile,
unsigned int line, CORE_ADDR address,
- linetable_entry_flags flags,
- struct dwarf2_cu *cu)
+ linetable_entry_flags flags, struct dwarf2_cu *cu)
{
CORE_ADDR addr = gdbarch_addr_bits_remove (gdbarch, address);
if (dwarf_line_debug)
{
- gdb_printf (gdb_stdlog,
- "Recording line %u, file %s, address %s\n",
- line, lbasename (subfile->name.c_str ()),
+ gdb_printf (gdb_stdlog, "Recording line %u, file %s, address %s\n", line,
+ lbasename (subfile->name.c_str ()),
paddress (gdbarch, address));
}
@@ -20261,8 +19941,7 @@ dwarf_finish_line (struct gdbarch *gdbarch, struct subfile *subfile,
if (dwarf_line_debug)
{
- gdb_printf (gdb_stdlog,
- "Finishing current line, file %s, address %s\n",
+ gdb_printf (gdb_stdlog, "Finishing current line, file %s, address %s\n",
lbasename (subfile->name.c_str ()),
paddress (gdbarch, address));
}
@@ -20278,11 +19957,9 @@ lnp_state_machine::record_line (bool end_sequence)
gdb_printf (gdb_stdlog,
"Processing actual line %u: file %u,"
" address %s, is_stmt %u, prologue_end %u, discrim %u%s\n",
- m_line, m_file,
- paddress (m_gdbarch, m_address),
+ m_line, m_file, paddress (m_gdbarch, m_address),
(m_flags & LEF_IS_STMT) != 0,
- (m_flags & LEF_PROLOGUE_END) != 0,
- m_discriminator,
+ (m_flags & LEF_PROLOGUE_END) != 0, m_discriminator,
(end_sequence ? "\t(end sequence)" : ""));
}
@@ -20314,8 +19991,7 @@ lnp_state_machine::record_line (bool end_sequence)
= m_last_subfile != m_cu->get_builder ()->get_current_subfile ();
bool ignore_this_line
= ((file_changed && !end_sequence && m_last_address == m_address
- && ((m_flags & LEF_IS_STMT) == 0)
- && m_stmt_at_address)
+ && ((m_flags & LEF_IS_STMT) == 0) && m_stmt_at_address)
|| (!end_sequence && m_line == 0));
if ((file_changed && !ignore_this_line) || end_sequence)
@@ -20335,10 +20011,10 @@ lnp_state_machine::record_line (bool end_sequence)
m_last_subfile))
{
buildsym_compunit *builder = m_cu->get_builder ();
- dwarf_record_line_1 (m_gdbarch,
- builder->get_current_subfile (),
+ dwarf_record_line_1 (m_gdbarch, builder->get_current_subfile (),
m_line, m_address, lte_flags,
- m_currently_recording_lines ? m_cu : nullptr);
+ m_currently_recording_lines ? m_cu
+ : nullptr);
}
m_last_subfile = m_cu->get_builder ()->get_current_subfile ();
m_last_line = m_line;
@@ -20374,7 +20050,8 @@ lnp_state_machine::lnp_state_machine (struct dwarf2_cu *cu, gdbarch *arch,
void
lnp_state_machine::check_line_address (struct dwarf2_cu *cu,
const gdb_byte *line_ptr,
- CORE_ADDR unrelocated_lowpc, CORE_ADDR address)
+ CORE_ADDR unrelocated_lowpc,
+ CORE_ADDR address)
{
/* Linkers resolve a symbolic relocation referencing a GC'd function to 0 or
-1. If ADDRESS is 0, ignoring the opcode will err if the text section is
@@ -20390,7 +20067,7 @@ lnp_state_machine::check_line_address (struct dwarf2_cu *cu,
struct objfile *objfile = cu->per_objfile->objfile;
long line_offset = line_ptr - get_debug_line_section (cu)->buffer;
- complaint (_(".debug_line address at offset 0x%lx is 0 [in module %s]"),
+ complaint (_ (".debug_line address at offset 0x%lx is 0 [in module %s]"),
line_offset, objfile_name (objfile));
m_currently_recording_lines = false;
/* Note: m_currently_recording_lines is left as false until we see
@@ -20445,159 +20122,164 @@ dwarf_decode_lines_1 (struct line_header *lh, struct dwarf2_cu *cu,
/* Special opcode. */
state_machine.handle_special_opcode (op_code);
}
- else switch (op_code)
- {
- case DW_LNS_extended_op:
- extended_len = read_unsigned_leb128 (abfd, line_ptr,
- &bytes_read);
- line_ptr += bytes_read;
- extended_end = line_ptr + extended_len;
- extended_op = read_1_byte (abfd, line_ptr);
- line_ptr += 1;
- if (DW_LNE_lo_user <= extended_op
- && extended_op <= DW_LNE_hi_user)
- {
- /* Vendor extension, ignore. */
- line_ptr = extended_end;
- break;
- }
- switch (extended_op)
- {
- case DW_LNE_end_sequence:
- state_machine.handle_end_sequence ();
- end_sequence = true;
- break;
- case DW_LNE_set_address:
+ else
+ switch (op_code)
+ {
+ case DW_LNS_extended_op:
+ extended_len
+ = read_unsigned_leb128 (abfd, line_ptr, &bytes_read);
+ line_ptr += bytes_read;
+ extended_end = line_ptr + extended_len;
+ extended_op = read_1_byte (abfd, line_ptr);
+ line_ptr += 1;
+ if (DW_LNE_lo_user <= extended_op
+ && extended_op <= DW_LNE_hi_user)
{
- CORE_ADDR address
- = cu->header.read_address (abfd, line_ptr, &bytes_read);
- line_ptr += bytes_read;
-
- state_machine.check_line_address (cu, line_ptr,
- lowpc - baseaddr, address);
- state_machine.handle_set_address (baseaddr, address);
+ /* Vendor extension, ignore. */
+ line_ptr = extended_end;
+ break;
}
- break;
- case DW_LNE_define_file:
+ switch (extended_op)
{
- const char *cur_file;
- unsigned int mod_time, length;
- dir_index dindex;
-
- cur_file = read_direct_string (abfd, line_ptr,
+ case DW_LNE_end_sequence:
+ state_machine.handle_end_sequence ();
+ end_sequence = true;
+ break;
+ case DW_LNE_set_address:
+ {
+ CORE_ADDR address
+ = cu->header.read_address (abfd, line_ptr,
&bytes_read);
- line_ptr += bytes_read;
- dindex = (dir_index)
- read_unsigned_leb128 (abfd, line_ptr, &bytes_read);
- line_ptr += bytes_read;
- mod_time =
- read_unsigned_leb128 (abfd, line_ptr, &bytes_read);
- line_ptr += bytes_read;
- length =
- read_unsigned_leb128 (abfd, line_ptr, &bytes_read);
- line_ptr += bytes_read;
- lh->add_file_name (cur_file, dindex, mod_time, length);
- }
- break;
- case DW_LNE_set_discriminator:
- {
- /* The discriminator is not interesting to the
+ line_ptr += bytes_read;
+
+ state_machine.check_line_address (cu, line_ptr,
+ lowpc - baseaddr,
+ address);
+ state_machine.handle_set_address (baseaddr, address);
+ }
+ break;
+ case DW_LNE_define_file:
+ {
+ const char *cur_file;
+ unsigned int mod_time, length;
+ dir_index dindex;
+
+ cur_file
+ = read_direct_string (abfd, line_ptr, &bytes_read);
+ line_ptr += bytes_read;
+ dindex
+ = (dir_index) read_unsigned_leb128 (abfd, line_ptr,
+ &bytes_read);
+ line_ptr += bytes_read;
+ mod_time
+ = read_unsigned_leb128 (abfd, line_ptr, &bytes_read);
+ line_ptr += bytes_read;
+ length
+ = read_unsigned_leb128 (abfd, line_ptr, &bytes_read);
+ line_ptr += bytes_read;
+ lh->add_file_name (cur_file, dindex, mod_time, length);
+ }
+ break;
+ case DW_LNE_set_discriminator:
+ {
+ /* The discriminator is not interesting to the
debugger; just ignore it. We still need to
check its value though:
if there are consecutive entries for the same
(non-prologue) line we want to coalesce them.
PR 17276. */
- unsigned int discr
- = read_unsigned_leb128 (abfd, line_ptr, &bytes_read);
- line_ptr += bytes_read;
+ unsigned int discr
+ = read_unsigned_leb128 (abfd, line_ptr, &bytes_read);
+ line_ptr += bytes_read;
- state_machine.handle_set_discriminator (discr);
+ state_machine.handle_set_discriminator (discr);
+ }
+ break;
+ default:
+ complaint (_ ("mangled .debug_line section"));
+ return;
}
- break;
- default:
- complaint (_("mangled .debug_line section"));
- return;
- }
- /* Make sure that we parsed the extended op correctly. If e.g.
+ /* Make sure that we parsed the extended op correctly. If e.g.
we expected a different address size than the producer used,
we may have read the wrong number of bytes. */
- if (line_ptr != extended_end)
+ if (line_ptr != extended_end)
+ {
+ complaint (_ ("mangled .debug_line section"));
+ return;
+ }
+ break;
+ case DW_LNS_copy:
+ state_machine.handle_copy ();
+ break;
+ case DW_LNS_advance_pc:
{
- complaint (_("mangled .debug_line section"));
- return;
+ CORE_ADDR adjust
+ = read_unsigned_leb128 (abfd, line_ptr, &bytes_read);
+ line_ptr += bytes_read;
+
+ state_machine.handle_advance_pc (adjust);
}
- break;
- case DW_LNS_copy:
- state_machine.handle_copy ();
- break;
- case DW_LNS_advance_pc:
- {
- CORE_ADDR adjust
- = read_unsigned_leb128 (abfd, line_ptr, &bytes_read);
- line_ptr += bytes_read;
+ break;
+ case DW_LNS_advance_line:
+ {
+ int line_delta
+ = read_signed_leb128 (abfd, line_ptr, &bytes_read);
+ line_ptr += bytes_read;
- state_machine.handle_advance_pc (adjust);
- }
- break;
- case DW_LNS_advance_line:
- {
- int line_delta
- = read_signed_leb128 (abfd, line_ptr, &bytes_read);
- line_ptr += bytes_read;
+ state_machine.handle_advance_line (line_delta);
+ }
+ break;
+ case DW_LNS_set_file:
+ {
+ file_name_index file
+ = (file_name_index) read_unsigned_leb128 (abfd, line_ptr,
+ &bytes_read);
+ line_ptr += bytes_read;
- state_machine.handle_advance_line (line_delta);
- }
- break;
- case DW_LNS_set_file:
- {
- file_name_index file
- = (file_name_index) read_unsigned_leb128 (abfd, line_ptr,
- &bytes_read);
+ state_machine.handle_set_file (file);
+ }
+ break;
+ case DW_LNS_set_column:
+ (void) read_unsigned_leb128 (abfd, line_ptr, &bytes_read);
line_ptr += bytes_read;
-
- state_machine.handle_set_file (file);
- }
- break;
- case DW_LNS_set_column:
- (void) read_unsigned_leb128 (abfd, line_ptr, &bytes_read);
- line_ptr += bytes_read;
- break;
- case DW_LNS_negate_stmt:
- state_machine.handle_negate_stmt ();
- break;
- case DW_LNS_set_basic_block:
- break;
- /* Add to the address register of the state machine the
+ break;
+ case DW_LNS_negate_stmt:
+ state_machine.handle_negate_stmt ();
+ break;
+ case DW_LNS_set_basic_block:
+ break;
+ /* Add to the address register of the state machine the
address increment value corresponding to special opcode
255. I.e., this value is scaled by the minimum
instruction length since special opcode 255 would have
scaled the increment. */
- case DW_LNS_const_add_pc:
- state_machine.handle_const_add_pc ();
- break;
- case DW_LNS_fixed_advance_pc:
- {
- CORE_ADDR addr_adj = read_2_bytes (abfd, line_ptr);
- line_ptr += 2;
+ case DW_LNS_const_add_pc:
+ state_machine.handle_const_add_pc ();
+ break;
+ case DW_LNS_fixed_advance_pc:
+ {
+ CORE_ADDR addr_adj = read_2_bytes (abfd, line_ptr);
+ line_ptr += 2;
- state_machine.handle_fixed_advance_pc (addr_adj);
- }
- break;
- case DW_LNS_set_prologue_end:
- state_machine.handle_set_prologue_end ();
- break;
- default:
- {
- /* Unknown standard opcode, ignore it. */
- int i;
+ state_machine.handle_fixed_advance_pc (addr_adj);
+ }
+ break;
+ case DW_LNS_set_prologue_end:
+ state_machine.handle_set_prologue_end ();
+ break;
+ default:
+ {
+ /* Unknown standard opcode, ignore it. */
+ int i;
- for (i = 0; i < lh->standard_opcode_lengths[op_code]; i++)
- {
- (void) read_unsigned_leb128 (abfd, line_ptr, &bytes_read);
- line_ptr += bytes_read;
- }
+ for (i = 0; i < lh->standard_opcode_lengths[op_code]; i++)
+ {
+ (void) read_unsigned_leb128 (abfd, line_ptr,
+ &bytes_read);
+ line_ptr += bytes_read;
+ }
+ }
}
- }
}
if (!end_sequence)
@@ -20741,23 +20423,21 @@ var_decode_location (struct attribute *attr, struct symbol *sym,
&& block->size == 1 + cu_header->addr_size)
|| ((block->data[0] == DW_OP_GNU_addr_index
|| block->data[0] == DW_OP_addrx)
- && (block->size
- == 1 + leb128_size (&block->data[1]))))
+ && (block->size == 1 + leb128_size (&block->data[1]))))
{
unsigned int dummy;
if (block->data[0] == DW_OP_addr)
- sym->set_value_address
- (cu->header.read_address (objfile->obfd.get (), block->data + 1,
- &dummy));
+ sym->set_value_address (cu->header.read_address (
+ objfile->obfd.get (), block->data + 1, &dummy));
else
- sym->set_value_address
- (read_addr_index_from_leb128 (cu, block->data + 1, &dummy));
+ sym->set_value_address (
+ read_addr_index_from_leb128 (cu, block->data + 1, &dummy));
sym->set_aclass_index (LOC_STATIC);
fixup_symbol_section (sym, objfile);
- sym->set_value_address
- (sym->value_address ()
- + objfile->section_offsets[sym->section_index ()]);
+ sym->set_value_address (
+ sym->value_address ()
+ + objfile->section_offsets[sym->section_index ()]);
return;
}
}
@@ -20802,9 +20482,10 @@ new_symbol (struct die_info *die, struct type *type, struct dwarf2_cu *cu,
baseaddr = objfile->text_section_offset ();
name = dwarf2_name (die, cu);
- if (name == nullptr && (die->tag == DW_TAG_subprogram
- || die->tag == DW_TAG_inlined_subroutine
- || die->tag == DW_TAG_entry_point))
+ if (name == nullptr
+ && (die->tag == DW_TAG_subprogram
+ || die->tag == DW_TAG_inlined_subroutine
+ || die->tag == DW_TAG_entry_point))
name = dw2_linkage_name (die, cu);
if (name)
@@ -20822,9 +20503,8 @@ new_symbol (struct die_info *die, struct type *type, struct dwarf2_cu *cu,
/* Fortran does not have mangling standard and the mangling does differ
between gfortran, iFort etc. */
const char *physname
- = (cu->lang () == language_fortran
- ? dwarf2_full_name (name, die, cu)
- : dwarf2_physname (name, die, cu));
+ = (cu->lang () == language_fortran ? dwarf2_full_name (name, die, cu)
+ : dwarf2_physname (name, die, cu));
const char *linkagename = dw2_linkage_name (die, cu);
if (linkagename == nullptr || cu->lang () == language_ada)
@@ -20848,15 +20528,15 @@ new_symbol (struct die_info *die, struct type *type, struct dwarf2_cu *cu,
sym->set_type (type);
else
sym->set_type (die_type (die, cu));
- attr = dwarf2_attr (die,
- inlined_func ? DW_AT_call_line : DW_AT_decl_line,
- cu);
+ attr
+ = dwarf2_attr (die, inlined_func ? DW_AT_call_line : DW_AT_decl_line,
+ cu);
if (attr != nullptr)
sym->set_line (attr->constant_value (0));
- attr = dwarf2_attr (die,
- inlined_func ? DW_AT_call_file : DW_AT_decl_file,
- cu);
+ attr
+ = dwarf2_attr (die, inlined_func ? DW_AT_call_file : DW_AT_decl_file,
+ cu);
if (attr != nullptr && attr->is_nonnegative ())
{
file_name_index file_index
@@ -20869,7 +20549,7 @@ new_symbol (struct die_info *die, struct type *type, struct dwarf2_cu *cu,
fe = NULL;
if (fe == NULL)
- complaint (_("file index out of range"));
+ complaint (_ ("file index out of range"));
else
sym->set_symtab (fe->symtab);
}
@@ -20970,8 +20650,7 @@ new_symbol (struct die_info *die, struct type *type, struct dwarf2_cu *cu,
&& die->parent->tag == DW_TAG_common_block)
attr2 = NULL;
- if (sym->aclass () == LOC_STATIC
- && sym->value_address () == 0
+ if (sym->aclass () == LOC_STATIC && sym->value_address () == 0
&& !per_objfile->per_bfd->has_section_at_zero)
{
/* When a static variable is eliminated by the linker,
@@ -20991,19 +20670,18 @@ new_symbol (struct die_info *die, struct type *type, struct dwarf2_cu *cu,
marked hidden, in which case this would not
apply. */
bound_minimal_symbol found
- = (lookup_minimal_symbol_linkage
- (sym->linkage_name (), objfile));
+ = (lookup_minimal_symbol_linkage (sym->linkage_name (),
+ objfile));
if (found.minsym != nullptr)
sym->maybe_copied = 1;
}
/* A variable with DW_AT_external is never static,
but it may be block-scoped. */
- list_to_add
- = ((cu->list_in_scope
- == cu->get_builder ()->get_file_symbols ())
- ? cu->get_builder ()->get_global_symbols ()
- : cu->list_in_scope);
+ list_to_add = ((cu->list_in_scope
+ == cu->get_builder ()->get_file_symbols ())
+ ? cu->get_builder ()->get_global_symbols ()
+ : cu->list_in_scope);
}
else
list_to_add = cu->list_in_scope;
@@ -21033,11 +20711,10 @@ new_symbol (struct die_info *die, struct type *type, struct dwarf2_cu *cu,
{
/* A variable with DW_AT_external is never static, but it
may be block-scoped. */
- list_to_add
- = ((cu->list_in_scope
- == cu->get_builder ()->get_file_symbols ())
- ? cu->get_builder ()->get_global_symbols ()
- : cu->list_in_scope);
+ list_to_add = ((cu->list_in_scope
+ == cu->get_builder ()->get_file_symbols ())
+ ? cu->get_builder ()->get_global_symbols ()
+ : cu->list_in_scope);
sym->set_aclass_index (LOC_UNRESOLVED);
}
@@ -21114,15 +20791,14 @@ new_symbol (struct die_info *die, struct type *type, struct dwarf2_cu *cu,
buildsym_compunit *builder = cu->get_builder ();
list_to_add
= (cu->list_in_scope == builder->get_file_symbols ()
- && cu->lang () == language_cplus
- ? builder->get_global_symbols ()
- : cu->list_in_scope);
+ && cu->lang () == language_cplus
+ ? builder->get_global_symbols ()
+ : cu->list_in_scope);
/* The semantics of C++ state that "struct foo {
... }" also defines a typedef for "foo". */
if (cu->lang () == language_cplus
- || cu->lang () == language_ada
- || cu->lang () == language_d
+ || cu->lang () == language_ada || cu->lang () == language_d
|| cu->lang () == language_rust)
{
/* The symbol's name is already allocated along
@@ -21160,9 +20836,9 @@ new_symbol (struct die_info *die, struct type *type, struct dwarf2_cu *cu,
list_to_add
= (cu->list_in_scope == cu->get_builder ()->get_file_symbols ()
- && cu->lang () == language_cplus
- ? cu->get_builder ()->get_global_symbols ()
- : cu->list_in_scope);
+ && cu->lang () == language_cplus
+ ? cu->get_builder ()->get_global_symbols ()
+ : cu->list_in_scope);
}
break;
case DW_TAG_imported_declaration:
@@ -21185,8 +20861,7 @@ new_symbol (struct die_info *die, struct type *type, struct dwarf2_cu *cu,
trash data, but since we must specifically ignore things
we don't recognize, there is nothing else we should do at
this point. */
- complaint (_("unsupported tag: '%s'"),
- dwarf_tag_name (die->tag));
+ complaint (_ ("unsupported tag: '%s'"), dwarf_tag_name (die->tag));
break;
}
@@ -21202,8 +20877,7 @@ new_symbol (struct die_info *die, struct type *type, struct dwarf2_cu *cu,
/* For the benefit of old versions of GCC, check for anonymous
namespaces based on the demangled name. */
- if (!cu->processing_has_namespace_info
- && cu->lang () == language_cplus)
+ if (!cu->processing_has_namespace_info && cu->lang () == language_cplus)
cp_scan_for_anonymous_namespaces (cu->get_builder (), sym, objfile);
}
return (sym);
@@ -21222,8 +20896,9 @@ dwarf2_const_value_data (const struct attribute *attr, struct obstack *obstack,
struct dwarf2_cu *cu, LONGEST *value, int bits)
{
struct objfile *objfile = cu->per_objfile->objfile;
- enum bfd_endian byte_order = bfd_big_endian (objfile->obfd.get ()) ?
- BFD_ENDIAN_BIG : BFD_ENDIAN_LITTLE;
+ enum bfd_endian byte_order = bfd_big_endian (objfile->obfd.get ())
+ ? BFD_ENDIAN_BIG
+ : BFD_ENDIAN_LITTLE;
LONGEST l = attr->constant_value (0);
if (bits < sizeof (*value) * 8)
@@ -21252,16 +20927,17 @@ dwarf2_const_value_data (const struct attribute *attr, struct obstack *obstack,
static void
dwarf2_const_value_attr (const struct attribute *attr, struct type *type,
const char *name, struct obstack *obstack,
- struct dwarf2_cu *cu,
- LONGEST *value, const gdb_byte **bytes,
+ struct dwarf2_cu *cu, LONGEST *value,
+ const gdb_byte **bytes,
struct dwarf2_locexpr_baton **baton)
{
dwarf2_per_objfile *per_objfile = cu->per_objfile;
struct objfile *objfile = per_objfile->objfile;
struct comp_unit_head *cu_header = &cu->header;
struct dwarf_block *blk;
- enum bfd_endian byte_order = (bfd_big_endian (objfile->obfd.get ()) ?
- BFD_ENDIAN_BIG : BFD_ENDIAN_LITTLE);
+ enum bfd_endian byte_order
+ = (bfd_big_endian (objfile->obfd.get ()) ? BFD_ENDIAN_BIG
+ : BFD_ENDIAN_LITTLE);
*value = 0;
*bytes = NULL;
@@ -21292,8 +20968,8 @@ dwarf2_const_value_attr (const struct attribute *attr, struct type *type,
(*baton)->data = data;
data[0] = DW_OP_addr;
- store_unsigned_integer (&data[1], cu_header->addr_size,
- byte_order, attr->as_address ());
+ store_unsigned_integer (&data[1], cu_header->addr_size, byte_order,
+ attr->as_address ());
data[cu_header->addr_size + 1] = DW_OP_stack_value;
}
break;
@@ -21347,14 +21023,13 @@ dwarf2_const_value_attr (const struct attribute *attr, struct type *type,
break;
default:
- complaint (_("unsupported const value attribute form: '%s'"),
+ complaint (_ ("unsupported const value attribute form: '%s'"),
dwarf_form_name (attr->form));
*value = 0;
break;
}
}
-
/* Copy constant value from an attribute to a symbol. */
static void
@@ -21366,10 +21041,9 @@ dwarf2_const_value (const struct attribute *attr, struct symbol *sym,
const gdb_byte *bytes;
struct dwarf2_locexpr_baton *baton;
- dwarf2_const_value_attr (attr, sym->type (),
- sym->print_name (),
- &objfile->objfile_obstack, cu,
- &value, &bytes, &baton);
+ dwarf2_const_value_attr (attr, sym->type (), sym->print_name (),
+ &objfile->objfile_obstack, cu, &value, &bytes,
+ &baton);
if (baton != NULL)
{
@@ -21461,8 +21135,9 @@ die_containing_type (struct die_info *die, struct dwarf2_cu *cu)
type_attr = dwarf2_attr (die, DW_AT_containing_type, cu);
if (!type_attr)
- error (_("Dwarf Error: Problem turning containing type into gdb type "
- "[in module %s]"), objfile_name (objfile));
+ error (_ ("Dwarf Error: Problem turning containing type into gdb type "
+ "[in module %s]"),
+ objfile_name (objfile));
return lookup_die_type (die, type_attr, cu);
}
@@ -21477,7 +21152,7 @@ build_error_marker_type (struct dwarf2_cu *cu, struct die_info *die)
char *saved;
std::string message
- = string_printf (_("<unknown type in %s, CU %s, DIE %s>"),
+ = string_printf (_ ("<unknown type in %s, CU %s, DIE %s>"),
objfile_name (objfile),
sect_offset_str (cu->header.sect_off),
sect_offset_str (die->sect_off));
@@ -21510,8 +21185,8 @@ lookup_die_type (struct die_info *die, const struct attribute *attr,
struct dwarf2_per_cu_data *per_cu;
sect_offset sect_off = attr->get_ref_die_offset ();
- per_cu = dwarf2_find_containing_comp_unit (sect_off, 1,
- per_objfile->per_bfd);
+ per_cu
+ = dwarf2_find_containing_comp_unit (sect_off, 1, per_objfile->per_bfd);
this_type = get_die_type_at_offset (sect_off, per_cu, per_objfile);
}
else if (attr->form_is_ref ())
@@ -21528,8 +21203,8 @@ lookup_die_type (struct die_info *die, const struct attribute *attr,
}
else
{
- complaint (_("Dwarf Error: Bad type attribute %s in DIE"
- " at %s [in module %s]"),
+ complaint (_ ("Dwarf Error: Bad type attribute %s in DIE"
+ " at %s [in module %s]"),
dwarf_attr_name (attr->name), sect_offset_str (die->sect_off),
objfile_name (objfile));
return build_error_marker_type (cu, die);
@@ -21657,7 +21332,7 @@ read_type_die_1 (struct die_info *die, struct dwarf2_cu *cu)
this_type = read_tag_atomic_type (die, cu);
break;
default:
- complaint (_("unexpected tag in read_type_die: '%s'"),
+ complaint (_ ("unexpected tag in read_type_die: '%s'"),
dwarf_tag_name (die->tag));
break;
}
@@ -21689,9 +21364,7 @@ guess_full_die_structure_name (struct die_info *die, struct dwarf2_cu *cu)
cu = spec_cu;
}
- for (child = die->child;
- child != NULL;
- child = child->sibling)
+ for (child = die->child; child != NULL; child = child->sibling)
{
if (child->tag == DW_TAG_subprogram)
{
@@ -21699,8 +21372,8 @@ guess_full_die_structure_name (struct die_info *die, struct dwarf2_cu *cu)
if (linkage_name != NULL)
{
- gdb::unique_xmalloc_ptr<char> actual_name
- (cu->language_defn->class_name_from_physname (linkage_name));
+ gdb::unique_xmalloc_ptr<char> actual_name (
+ cu->language_defn->class_name_from_physname (linkage_name));
const char *name = NULL;
if (actual_name != NULL)
@@ -21720,8 +21393,8 @@ guess_full_die_structure_name (struct die_info *die, struct dwarf2_cu *cu)
if (actual_name_len > die_name_len + 2
&& ptr[actual_name_len - die_name_len - 1] == ':')
name = obstack_strndup (
- &objfile->per_bfd->storage_obstack,
- ptr, actual_name_len - die_name_len - 2);
+ &objfile->per_bfd->storage_obstack, ptr,
+ actual_name_len - die_name_len - 2);
}
}
return name;
@@ -21763,8 +21436,7 @@ anonymous_struct_prefix (struct die_info *die, struct dwarf2_cu *cu)
return "";
struct objfile *objfile = cu->per_objfile->objfile;
- return obstack_strndup (&objfile->per_bfd->storage_obstack,
- attr_name,
+ return obstack_strndup (&objfile->per_bfd->storage_obstack, attr_name,
&base[-1] - attr_name);
}
@@ -21792,10 +21464,8 @@ determine_prefix (struct die_info *die, struct dwarf2_cu *cu)
struct type *parent_type;
const char *retval;
- if (cu->lang () != language_cplus
- && cu->lang () != language_fortran
- && cu->lang () != language_d
- && cu->lang () != language_rust)
+ if (cu->lang () != language_cplus && cu->lang () != language_fortran
+ && cu->lang () != language_d && cu->lang () != language_rust)
return "";
retval = anonymous_struct_prefix (die, cu);
@@ -21870,7 +21540,7 @@ determine_prefix (struct die_info *die, struct dwarf2_cu *cu)
doesn't allow it), and break the loop here. */
name = dwarf2_name (die, cu);
parent_name = dwarf2_name (parent, cu);
- complaint (_("template param type '%s' defined within parent '%s'"),
+ complaint (_ ("template param type '%s' defined within parent '%s'"),
name ? name : "<unknown>",
parent_name ? parent_name : "<unknown>");
return "";
@@ -21905,8 +21575,7 @@ determine_prefix (struct die_info *die, struct dwarf2_cu *cu)
case DW_TAG_partial_unit:
/* gcc-4.5 -gdwarf-4 can drop the enclosing namespace. Cope. */
if (cu->lang () == language_cplus
- && !per_objfile->per_bfd->types.empty ()
- && die->child != NULL
+ && !per_objfile->per_bfd->types.empty () && die->child != NULL
&& (die->tag == DW_TAG_class_type
|| die->tag == DW_TAG_structure_type
|| die->tag == DW_TAG_union_type))
@@ -21921,7 +21590,7 @@ determine_prefix (struct die_info *die, struct dwarf2_cu *cu)
of the parent's subroutine. */
if (cu->lang () == language_fortran)
{
- if ((die->tag == DW_TAG_subprogram)
+ if ((die->tag == DW_TAG_subprogram)
&& (dwarf2_name (parent, cu) != NULL))
return dwarf2_name (parent, cu);
}
@@ -21946,7 +21615,7 @@ determine_prefix (struct die_info *die, struct dwarf2_cu *cu)
an obconcat, otherwise allocate storage for the result. The CU argument is
used to determine the language and hence, the appropriate separator. */
-#define MAX_SEP_LEN 7 /* strlen ("__") + strlen ("_MOD_") */
+#define MAX_SEP_LEN 7 /* strlen ("__") + strlen ("_MOD_") */
static char *
typename_concat (struct obstack *obs, const char *prefix, const char *suffix,
@@ -21955,8 +21624,8 @@ typename_concat (struct obstack *obs, const char *prefix, const char *suffix,
const char *lead = "";
const char *sep;
- if (suffix == NULL || suffix[0] == '\0'
- || prefix == NULL || prefix[0] == '\0')
+ if (suffix == NULL || suffix[0] == '\0' || prefix == NULL
+ || prefix[0] == '\0')
sep = "";
else if (cu->lang () == language_d)
{
@@ -21988,9 +21657,8 @@ typename_concat (struct obstack *obs, const char *prefix, const char *suffix,
if (obs == NULL)
{
- char *retval
- = ((char *)
- xmalloc (strlen (prefix) + MAX_SEP_LEN + strlen (suffix) + 1));
+ char *retval = ((char *) xmalloc (strlen (prefix) + MAX_SEP_LEN
+ + strlen (suffix) + 1));
strcpy (retval, lead);
strcat (retval, prefix);
@@ -22025,16 +21693,16 @@ unnamed_template_tag_name (die_info *die, dwarf2_cu *cu)
die_info *child = die->parent->child;
while (child != die)
- {
- gdb_assert (child != nullptr);
- if (child->tag == DW_TAG_template_type_param
- || child->tag == DW_TAG_template_value_param)
- {
- if (dwarf2_attr (child, DW_AT_name, cu) == nullptr)
- ++nth_unnamed;
- }
- child = child->sibling;
- }
+ {
+ gdb_assert (child != nullptr);
+ if (child->tag == DW_TAG_template_type_param
+ || child->tag == DW_TAG_template_value_param)
+ {
+ if (dwarf2_attr (child, DW_AT_name, cu) == nullptr)
+ ++nth_unnamed;
+ }
+ child = child->sibling;
+ }
const std::string name_str = "<unnamed" + std::to_string (nth_unnamed) + ">";
return cu->per_objfile->objfile->intern (name_str.c_str ());
@@ -22051,16 +21719,14 @@ dwarf2_canonicalize_name (const char *name, struct dwarf2_cu *cu,
if (cu->lang () == language_cplus)
{
- gdb::unique_xmalloc_ptr<char> canon_name
- = cp_canonicalize_string (name);
+ gdb::unique_xmalloc_ptr<char> canon_name = cp_canonicalize_string (name);
if (canon_name != nullptr)
name = objfile->intern (canon_name.get ());
}
else if (cu->lang () == language_c)
{
- gdb::unique_xmalloc_ptr<char> canon_name
- = c_canonicalize_name (name);
+ gdb::unique_xmalloc_ptr<char> canon_name = c_canonicalize_name (name);
if (canon_name != nullptr)
name = objfile->intern (canon_name.get ());
@@ -22080,12 +21746,9 @@ dwarf2_name (struct die_info *die, struct dwarf2_cu *cu)
attr = dwarf2_attr (die, DW_AT_name, cu);
const char *attr_name = attr == nullptr ? nullptr : attr->as_string ();
- if (attr_name == nullptr
- && die->tag != DW_TAG_namespace
- && die->tag != DW_TAG_class_type
- && die->tag != DW_TAG_interface_type
- && die->tag != DW_TAG_structure_type
- && die->tag != DW_TAG_namelist
+ if (attr_name == nullptr && die->tag != DW_TAG_namespace
+ && die->tag != DW_TAG_class_type && die->tag != DW_TAG_interface_type
+ && die->tag != DW_TAG_structure_type && die->tag != DW_TAG_namelist
&& die->tag != DW_TAG_union_type
&& die->tag != DW_TAG_template_type_param
&& die->tag != DW_TAG_template_value_param)
@@ -22146,8 +21809,8 @@ dwarf2_name (struct die_info *die, struct dwarf2_cu *cu)
call for the same DIE. */
if (!attr->canonical_string_p ())
{
- gdb::unique_xmalloc_ptr<char> demangled
- (gdb_demangle (attr_name, DMGL_TYPES));
+ gdb::unique_xmalloc_ptr<char> demangled (
+ gdb_demangle (attr_name, DMGL_TYPES));
if (demangled == nullptr)
return nullptr;
@@ -22197,26 +21860,22 @@ dump_die_shallow (struct ui_file *f, int indent, struct die_info *die)
{
unsigned int i;
- gdb_printf (f, "%*sDie: %s (abbrev %d, offset %s)\n",
- indent, "",
+ gdb_printf (f, "%*sDie: %s (abbrev %d, offset %s)\n", indent, "",
dwarf_tag_name (die->tag), die->abbrev,
sect_offset_str (die->sect_off));
if (die->parent != NULL)
- gdb_printf (f, "%*s parent at offset: %s\n",
- indent, "",
+ gdb_printf (f, "%*s parent at offset: %s\n", indent, "",
sect_offset_str (die->parent->sect_off));
- gdb_printf (f, "%*s has children: %s\n",
- indent, "",
+ gdb_printf (f, "%*s has children: %s\n", indent, "",
dwarf_bool_name (die->child != NULL));
gdb_printf (f, "%*s attributes:\n", indent, "");
for (i = 0; i < die->num_attrs; ++i)
{
- gdb_printf (f, "%*s %s (%s) ",
- indent, "",
+ gdb_printf (f, "%*s %s (%s) ", indent, "",
dwarf_attr_name (die->attrs[i].name),
dwarf_form_name (die->attrs[i].form));
@@ -22281,8 +21940,8 @@ dump_die_shallow (struct ui_file *f, int indent, struct die_info *die)
case DW_FORM_GNU_str_index:
case DW_FORM_GNU_strp_alt:
gdb_printf (f, "string: \"%s\" (%s canonicalized)",
- die->attrs[i].as_string ()
- ? die->attrs[i].as_string () : "",
+ die->attrs[i].as_string () ? die->attrs[i].as_string ()
+ : "",
die->attrs[i].canonical_string_p () ? "is" : "not");
break;
case DW_FORM_flag:
@@ -22297,8 +21956,7 @@ dump_die_shallow (struct ui_file *f, int indent, struct die_info *die)
case DW_FORM_indirect:
/* The reader will have reduced the indirect form to
the "base form" so this form should not occur. */
- gdb_printf (f,
- "unexpected attribute form: DW_FORM_indirect");
+ gdb_printf (f, "unexpected attribute form: DW_FORM_indirect");
break;
case DW_FORM_sdata:
case DW_FORM_implicit_const:
@@ -22342,8 +22000,7 @@ dump_die_1 (struct ui_file *f, int level, int max_level, struct die_info *die)
}
else
{
- gdb_printf (f,
- " [not printed, max nesting level reached]\n");
+ gdb_printf (f, " [not printed, max nesting level reached]\n");
}
}
@@ -22368,8 +22025,7 @@ store_in_ref_table (struct die_info *die, struct dwarf2_cu *cu)
void **slot;
slot = htab_find_slot_with_hash (cu->die_hash, die,
- to_underlying (die->sect_off),
- INSERT);
+ to_underlying (die->sect_off), INSERT);
*slot = die;
}
@@ -22391,7 +22047,7 @@ follow_die_ref_or_sig (struct die_info *src_die, const struct attribute *attr,
else
{
dump_die_for_error (src_die);
- error (_("Dwarf Error: Expected reference attribute [in module %s]"),
+ error (_ ("Dwarf Error: Expected reference attribute [in module %s]"),
objfile_name ((*ref_cu)->per_objfile->objfile));
}
@@ -22487,8 +22143,8 @@ follow_die_ref (struct die_info *src_die, const struct attribute *attr,
|| cu->per_cu->is_dwz),
ref_cu);
if (!die)
- error (_("Dwarf Error: Cannot find DIE at %s referenced from DIE "
- "at %s [in module %s]"),
+ error (_ ("Dwarf Error: Cannot find DIE at %s referenced from DIE "
+ "at %s [in module %s]"),
sect_offset_str (sect_off), sect_offset_str (src_die->sect_off),
objfile_name (cu->per_objfile->objfile));
@@ -22517,13 +22173,13 @@ dwarf2_fetch_die_loc_sect_off (sect_offset sect_off,
{
/* We shouldn't get here for a dummy CU, but don't crash on the user.
Instead just throw an error, not much else we can do. */
- error (_("Dwarf Error: Dummy CU at %s referenced in module %s"),
+ error (_ ("Dwarf Error: Dummy CU at %s referenced in module %s"),
sect_offset_str (sect_off), objfile_name (objfile));
}
die = follow_die_offset (sect_off, per_cu->is_dwz, &cu);
if (!die)
- error (_("Dwarf Error: Cannot find DIE at %s referenced in module %s"),
+ error (_ ("Dwarf Error: Cannot find DIE at %s referenced in module %s"),
sect_offset_str (sect_off), objfile_name (objfile));
attr = dwarf2_attr (die, DW_AT_location, cu);
@@ -22535,15 +22191,13 @@ dwarf2_fetch_die_loc_sect_off (sect_offset sect_off,
CORE_ADDR baseaddr = objfile->text_section_offset ();
struct gdbarch *gdbarch = objfile->arch ();
- for (const auto &cand_off
- : per_objfile->per_bfd->abstract_to_concrete[die->sect_off])
+ for (const auto &cand_off :
+ per_objfile->per_bfd->abstract_to_concrete[die->sect_off])
{
struct dwarf2_cu *cand_cu = cu;
struct die_info *cand
= follow_die_offset (cand_off, per_cu->is_dwz, &cand_cu);
- if (!cand
- || !cand->parent
- || cand->parent->tag != DW_TAG_subprogram)
+ if (!cand || !cand->parent || cand->parent->tag != DW_TAG_subprogram)
continue;
CORE_ADDR pc_low, pc_high;
@@ -22577,15 +22231,15 @@ dwarf2_fetch_die_loc_sect_off (sect_offset sect_off,
fill_in_loclist_baton (cu, &loclist_baton, attr);
- retval.data = dwarf2_find_location_expression (&loclist_baton,
- &size, pc);
+ retval.data
+ = dwarf2_find_location_expression (&loclist_baton, &size, pc);
retval.size = size;
}
else
{
if (!attr->form_is_block ())
- error (_("Dwarf Error: DIE at %s referenced in module %s "
- "is neither DW_FORM_block* nor DW_FORM_exprloc"),
+ error (_ ("Dwarf Error: DIE at %s referenced in module %s "
+ "is neither DW_FORM_block* nor DW_FORM_exprloc"),
sect_offset_str (sect_off), objfile_name (objfile));
struct dwarf_block *block = attr->as_block ();
@@ -22618,11 +22272,8 @@ dwarf2_fetch_die_loc_cu_off (cu_offset offset_in_cu,
OBSTACK. */
static const gdb_byte *
-write_constant_as_bytes (struct obstack *obstack,
- enum bfd_endian byte_order,
- struct type *type,
- ULONGEST value,
- LONGEST *len)
+write_constant_as_bytes (struct obstack *obstack, enum bfd_endian byte_order,
+ struct type *type, ULONGEST value, LONGEST *len)
{
gdb_byte *result;
@@ -22636,10 +22287,8 @@ write_constant_as_bytes (struct obstack *obstack,
/* See read.h. */
const gdb_byte *
-dwarf2_fetch_constant_bytes (sect_offset sect_off,
- dwarf2_per_cu_data *per_cu,
- dwarf2_per_objfile *per_objfile,
- obstack *obstack,
+dwarf2_fetch_constant_bytes (sect_offset sect_off, dwarf2_per_cu_data *per_cu,
+ dwarf2_per_objfile *per_objfile, obstack *obstack,
LONGEST *len)
{
struct die_info *die;
@@ -22658,21 +22307,21 @@ dwarf2_fetch_constant_bytes (sect_offset sect_off,
{
/* We shouldn't get here for a dummy CU, but don't crash on the user.
Instead just throw an error, not much else we can do. */
- error (_("Dwarf Error: Dummy CU at %s referenced in module %s"),
+ error (_ ("Dwarf Error: Dummy CU at %s referenced in module %s"),
sect_offset_str (sect_off), objfile_name (objfile));
}
die = follow_die_offset (sect_off, per_cu->is_dwz, &cu);
if (!die)
- error (_("Dwarf Error: Cannot find DIE at %s referenced in module %s"),
+ error (_ ("Dwarf Error: Cannot find DIE at %s referenced in module %s"),
sect_offset_str (sect_off), objfile_name (objfile));
attr = dwarf2_attr (die, DW_AT_const_value, cu);
if (attr == NULL)
return NULL;
- byte_order = (bfd_big_endian (objfile->obfd.get ())
- ? BFD_ENDIAN_BIG : BFD_ENDIAN_LITTLE);
+ byte_order = (bfd_big_endian (objfile->obfd.get ()) ? BFD_ENDIAN_BIG
+ : BFD_ENDIAN_LITTLE);
switch (attr->form)
{
@@ -22723,46 +22372,46 @@ dwarf2_fetch_constant_bytes (sect_offset sect_off,
type = die_type (die, cu);
result = dwarf2_const_value_data (attr, obstack, cu, &value, 8);
if (result == NULL)
- result = write_constant_as_bytes (obstack, byte_order,
- type, value, len);
+ result
+ = write_constant_as_bytes (obstack, byte_order, type, value, len);
break;
case DW_FORM_data2:
type = die_type (die, cu);
result = dwarf2_const_value_data (attr, obstack, cu, &value, 16);
if (result == NULL)
- result = write_constant_as_bytes (obstack, byte_order,
- type, value, len);
+ result
+ = write_constant_as_bytes (obstack, byte_order, type, value, len);
break;
case DW_FORM_data4:
type = die_type (die, cu);
result = dwarf2_const_value_data (attr, obstack, cu, &value, 32);
if (result == NULL)
- result = write_constant_as_bytes (obstack, byte_order,
- type, value, len);
+ result
+ = write_constant_as_bytes (obstack, byte_order, type, value, len);
break;
case DW_FORM_data8:
type = die_type (die, cu);
result = dwarf2_const_value_data (attr, obstack, cu, &value, 64);
if (result == NULL)
- result = write_constant_as_bytes (obstack, byte_order,
- type, value, len);
+ result
+ = write_constant_as_bytes (obstack, byte_order, type, value, len);
break;
case DW_FORM_sdata:
case DW_FORM_implicit_const:
type = die_type (die, cu);
- result = write_constant_as_bytes (obstack, byte_order,
- type, attr->as_signed (), len);
+ result = write_constant_as_bytes (obstack, byte_order, type,
+ attr->as_signed (), len);
break;
case DW_FORM_udata:
type = die_type (die, cu);
- result = write_constant_as_bytes (obstack, byte_order,
- type, attr->as_unsigned (), len);
+ result = write_constant_as_bytes (obstack, byte_order, type,
+ attr->as_unsigned (), len);
break;
default:
- complaint (_("unsupported const value attribute form: '%s'"),
+ complaint (_ ("unsupported const value attribute form: '%s'"),
dwarf_form_name (attr->form));
break;
}
@@ -22799,8 +22448,7 @@ dwarf2_fetch_die_type_sect_off (sect_offset sect_off,
/* See read.h. */
struct type *
-dwarf2_get_die_type (cu_offset die_offset,
- dwarf2_per_cu_data *per_cu,
+dwarf2_get_die_type (cu_offset die_offset, dwarf2_per_cu_data *per_cu,
dwarf2_per_objfile *per_objfile)
{
sect_offset die_offset_sect = per_cu->sect_off + to_underlying (die_offset);
@@ -22821,7 +22469,6 @@ follow_die_sig_1 (struct die_info *src_die, struct signatured_type *sig_type,
struct die_info *die;
dwarf2_per_objfile *per_objfile = (*ref_cu)->per_objfile;
-
/* While it might be nice to assert sig_type->type == NULL here,
we can get here for DW_AT_imported_declaration where we need
the DIE not the type. */
@@ -22831,8 +22478,7 @@ follow_die_sig_1 (struct die_info *src_die, struct signatured_type *sig_type,
Even if maybe_queue_comp_unit doesn't require us to load the CU's DIEs,
it doesn't mean they are currently loaded. Since we require them
to be loaded, we must check for ourselves. */
- if (maybe_queue_comp_unit (*ref_cu, sig_type, per_objfile,
- language_minimal)
+ if (maybe_queue_comp_unit (*ref_cu, sig_type, per_objfile, language_minimal)
|| per_objfile->get_cu (sig_type) == nullptr)
read_signatured_type (sig_type, per_objfile);
@@ -22840,8 +22486,8 @@ follow_die_sig_1 (struct die_info *src_die, struct signatured_type *sig_type,
gdb_assert (sig_cu != NULL);
gdb_assert (to_underlying (sig_type->type_offset_in_section) != 0);
temp_die.sect_off = sig_type->type_offset_in_section;
- die = (struct die_info *) htab_find_with_hash (sig_cu->die_hash, &temp_die,
- to_underlying (temp_die.sect_off));
+ die = (struct die_info *) htab_find_with_hash (
+ sig_cu->die_hash, &temp_die, to_underlying (temp_die.sect_off));
if (die)
{
/* For .gdb_index version 7 keep track of included TUs.
@@ -22880,8 +22526,8 @@ follow_die_sig (struct die_info *src_die, const struct attribute *attr,
the debug info. */
if (sig_type == NULL)
{
- error (_("Dwarf Error: Cannot find signatured DIE %s referenced"
- " from DIE at %s [in module %s]"),
+ error (_ ("Dwarf Error: Cannot find signatured DIE %s referenced"
+ " from DIE at %s [in module %s]"),
hex_string (signature), sect_offset_str (src_die->sect_off),
objfile_name ((*ref_cu)->per_objfile->objfile));
}
@@ -22890,8 +22536,8 @@ follow_die_sig (struct die_info *src_die, const struct attribute *attr,
if (die == NULL)
{
dump_die_for_error (src_die);
- error (_("Dwarf Error: Problem reading signatured DIE %s referenced"
- " from DIE at %s [in module %s]"),
+ error (_ ("Dwarf Error: Problem reading signatured DIE %s referenced"
+ " from DIE at %s [in module %s]"),
hex_string (signature), sect_offset_str (src_die->sect_off),
objfile_name ((*ref_cu)->per_objfile->objfile));
}
@@ -22917,8 +22563,8 @@ get_signatured_type (struct die_info *die, ULONGEST signature,
the debug info. */
if (sig_type == NULL)
{
- complaint (_("Dwarf Error: Cannot find signatured DIE %s referenced"
- " from DIE at %s [in module %s]"),
+ complaint (_ ("Dwarf Error: Cannot find signatured DIE %s referenced"
+ " from DIE at %s [in module %s]"),
hex_string (signature), sect_offset_str (die->sect_off),
objfile_name (per_objfile->objfile));
return build_error_marker_type (cu, die);
@@ -22939,8 +22585,8 @@ get_signatured_type (struct die_info *die, ULONGEST signature,
type = read_type_die (type_die, type_cu);
if (type == NULL)
{
- complaint (_("Dwarf Error: Cannot build signatured type %s"
- " referenced from DIE at %s [in module %s]"),
+ complaint (_ ("Dwarf Error: Cannot build signatured type %s"
+ " referenced from DIE at %s [in module %s]"),
hex_string (signature), sect_offset_str (die->sect_off),
objfile_name (per_objfile->objfile));
type = build_error_marker_type (cu, die);
@@ -22948,8 +22594,8 @@ get_signatured_type (struct die_info *die, ULONGEST signature,
}
else
{
- complaint (_("Dwarf Error: Problem reading signatured DIE %s referenced"
- " from DIE at %s [in module %s]"),
+ complaint (_ ("Dwarf Error: Problem reading signatured DIE %s referenced"
+ " from DIE at %s [in module %s]"),
hex_string (signature), sect_offset_str (die->sect_off),
objfile_name (per_objfile->objfile));
type = build_error_marker_type (cu, die);
@@ -22983,8 +22629,8 @@ get_DW_AT_signature_type (struct die_info *die, const struct attribute *attr,
{
dwarf2_per_objfile *per_objfile = cu->per_objfile;
- complaint (_("Dwarf Error: DW_AT_signature has bad form %s in DIE"
- " at %s [in module %s]"),
+ complaint (_ ("Dwarf Error: DW_AT_signature has bad form %s in DIE"
+ " at %s [in module %s]"),
dwarf_form_name (attr->form), sect_offset_str (die->sect_off),
objfile_name (per_objfile->objfile));
return build_error_marker_type (cu, die);
@@ -23030,14 +22676,11 @@ read_signatured_type (signatured_type *sig_type,
const gdb_byte *info_ptr = reader.info_ptr;
gdb_assert (cu->die_hash == NULL);
- cu->die_hash =
- htab_create_alloc_ex (cu->header.get_length_without_initial () / 12,
- die_hash,
- die_eq,
- NULL,
- &cu->comp_unit_obstack,
- hashtab_obstack_allocate,
- dummy_obstack_deallocate);
+ cu->die_hash
+ = htab_create_alloc_ex (cu->header.get_length_without_initial () / 12,
+ die_hash, die_eq, NULL, &cu->comp_unit_obstack,
+ hashtab_obstack_allocate,
+ dummy_obstack_deallocate);
if (reader.comp_unit_die->has_children)
reader.comp_unit_die->child
@@ -23184,8 +22827,7 @@ decode_locdesc (struct dwarf_block *blk, struct dwarf2_cu *cu, bool *computed)
case DW_OP_addr:
stack[++stacki] = cu->header.read_address (objfile->obfd.get (),
- &data[i],
- &bytes_read);
+ &data[i], &bytes_read);
i += bytes_read;
break;
@@ -23195,7 +22837,8 @@ decode_locdesc (struct dwarf_block *blk, struct dwarf2_cu *cu, bool *computed)
break;
case DW_OP_const1s:
- stack[++stacki] = read_1_signed_byte (objfile->obfd.get (), &data[i]);
+ stack[++stacki]
+ = read_1_signed_byte (objfile->obfd.get (), &data[i]);
i += 1;
break;
@@ -23205,7 +22848,8 @@ decode_locdesc (struct dwarf_block *blk, struct dwarf2_cu *cu, bool *computed)
break;
case DW_OP_const2s:
- stack[++stacki] = read_2_signed_bytes (objfile->obfd.get (), &data[i]);
+ stack[++stacki]
+ = read_2_signed_bytes (objfile->obfd.get (), &data[i]);
i += 2;
break;
@@ -23215,7 +22859,8 @@ decode_locdesc (struct dwarf_block *blk, struct dwarf2_cu *cu, bool *computed)
break;
case DW_OP_const4s:
- stack[++stacki] = read_4_signed_bytes (objfile->obfd.get (), &data[i]);
+ stack[++stacki]
+ = read_4_signed_bytes (objfile->obfd.get (), &data[i]);
i += 4;
break;
@@ -23225,8 +22870,8 @@ decode_locdesc (struct dwarf_block *blk, struct dwarf2_cu *cu, bool *computed)
break;
case DW_OP_constu:
- stack[++stacki] = read_unsigned_leb128 (NULL, (data + i),
- &bytes_read);
+ stack[++stacki]
+ = read_unsigned_leb128 (NULL, (data + i), &bytes_read);
i += bytes_read;
break;
@@ -23246,8 +22891,8 @@ decode_locdesc (struct dwarf_block *blk, struct dwarf2_cu *cu, bool *computed)
break;
case DW_OP_plus_uconst:
- stack[stacki] += read_unsigned_leb128 (NULL, (data + i),
- &bytes_read);
+ stack[stacki]
+ += read_unsigned_leb128 (NULL, (data + i), &bytes_read);
i += bytes_read;
break;
@@ -23298,8 +22943,8 @@ decode_locdesc (struct dwarf_block *blk, struct dwarf2_cu *cu, bool *computed)
case DW_OP_addrx:
case DW_OP_GNU_addr_index:
case DW_OP_GNU_const_index:
- stack[++stacki] = read_addr_index_from_leb128 (cu, &data[i],
- &bytes_read);
+ stack[++stacki]
+ = read_addr_index_from_leb128 (cu, &data[i], &bytes_read);
i += bytes_read;
break;
@@ -23309,11 +22954,9 @@ decode_locdesc (struct dwarf_block *blk, struct dwarf2_cu *cu, bool *computed)
const char *name = get_DW_OP_name (op);
if (name)
- complaint (_("unsupported stack op: '%s'"),
- name);
+ complaint (_ ("unsupported stack op: '%s'"), name);
else
- complaint (_("unsupported stack op: '%02x'"),
- op);
+ complaint (_ ("unsupported stack op: '%02x'"), op);
}
return (stack[stacki]);
@@ -23324,14 +22967,14 @@ decode_locdesc (struct dwarf_block *blk, struct dwarf2_cu *cu, bool *computed)
if (stacki >= ARRAY_SIZE (stack) - 1)
{
if (computed == nullptr)
- complaint (_("location description stack overflow"));
+ complaint (_ ("location description stack overflow"));
return 0;
}
if (stacki <= 0)
{
if (computed == nullptr)
- complaint (_("location description stack underflow"));
+ complaint (_ ("location description stack underflow"));
return 0;
}
}
@@ -23363,8 +23006,6 @@ dwarf_alloc_die (struct dwarf2_cu *cu, int num_attrs)
return (die);
}
-
-
/* Macro support. */
/* An overload of dwarf_decode_macros that finds the correct section
@@ -23411,7 +23052,7 @@ dwarf_decode_macros (struct dwarf2_cu *cu, unsigned int offset,
section->read (objfile);
if (section->buffer == nullptr)
{
- complaint (_("missing %s section"), section_name);
+ complaint (_ ("missing %s section"), section_name);
return;
}
@@ -23423,8 +23064,7 @@ dwarf_decode_macros (struct dwarf2_cu *cu, unsigned int offset,
if (cu->dwo_unit != nullptr)
{
- str_offsets_section = &cu->dwo_unit->dwo_file
- ->sections.str_offsets;
+ str_offsets_section = &cu->dwo_unit->dwo_file->sections.str_offsets;
str_section = &cu->dwo_unit->dwo_file->sections.str;
str_offsets_base = cu->header.addr_size;
}
@@ -23435,9 +23075,9 @@ dwarf_decode_macros (struct dwarf2_cu *cu, unsigned int offset,
str_offsets_base = cu->str_offsets_base;
}
- dwarf_decode_macros (per_objfile, builder, section, lh,
- offset_size, offset, str_section, str_offsets_section,
- str_offsets_base, section_is_gnu, cu);
+ dwarf_decode_macros (per_objfile, builder, section, lh, offset_size, offset,
+ str_section, str_offsets_section, str_offsets_base,
+ section_is_gnu, cu);
}
/* Return the .debug_loc section to use for CU.
@@ -23463,7 +23103,7 @@ static struct dwarf2_section_info *
cu_debug_rnglists_section (struct dwarf2_cu *cu, dwarf_tag tag)
{
if (cu->header.version < 5)
- error (_(".debug_rnglists section cannot be used in DWARF %d"),
+ error (_ (".debug_rnglists section cannot be used in DWARF %d"),
cu->header.version);
struct dwarf2_per_objfile *dwarf2_per_objfile = cu->per_objfile;
@@ -23472,8 +23112,7 @@ cu_debug_rnglists_section (struct dwarf2_cu *cu, dwarf_tag tag)
would be the .dwo file, if there is one. However for DW_TAG_compile_unit
or DW_TAG_skeleton unit, we always want to read from objfile/linked
program. */
- if (cu->dwo_unit != nullptr
- && tag != DW_TAG_compile_unit
+ if (cu->dwo_unit != nullptr && tag != DW_TAG_compile_unit
&& tag != DW_TAG_skeleton_unit)
{
struct dwo_sections *sections = &cu->dwo_unit->dwo_file->sections;
@@ -23481,7 +23120,7 @@ cu_debug_rnglists_section (struct dwarf2_cu *cu, dwarf_tag tag)
if (sections->rnglists.size > 0)
return &sections->rnglists;
else
- error (_(".debug_rnglists section is missing from .dwo file."));
+ error (_ (".debug_rnglists section is missing from .dwo file."));
}
return &dwarf2_per_objfile->per_bfd->rnglists;
}
@@ -23533,12 +23172,11 @@ dwarf2_symbol_mark_computed (const struct attribute *attr, struct symbol *sym,
fill_in_loclist_baton (cu, baton, attr);
if (!cu->base_address.has_value ())
- complaint (_("Location list used without "
- "specifying the CU base address."));
+ complaint (_ ("Location list used without "
+ "specifying the CU base address."));
- sym->set_aclass_index ((is_block
- ? dwarf2_loclist_block_index
- : dwarf2_loclist_index));
+ sym->set_aclass_index ((is_block ? dwarf2_loclist_block_index
+ : dwarf2_loclist_index));
SYMBOL_LOCATION_BATON (sym) = baton;
}
else
@@ -23568,9 +23206,8 @@ dwarf2_symbol_mark_computed (const struct attribute *attr, struct symbol *sym,
baton->size = 0;
}
- sym->set_aclass_index ((is_block
- ? dwarf2_locexpr_block_index
- : dwarf2_locexpr_index));
+ sym->set_aclass_index ((is_block ? dwarf2_locexpr_block_index
+ : dwarf2_locexpr_index));
SYMBOL_LOCATION_BATON (sym) = baton;
}
}
@@ -23630,10 +23267,9 @@ dwarf2_per_cu_data::ref_addr_size () const
tested. */
static int
-dwarf2_find_containing_comp_unit
- (sect_offset sect_off,
- unsigned int offset_in_dwz,
- const std::vector<dwarf2_per_cu_data_up> &all_units)
+dwarf2_find_containing_comp_unit (
+ sect_offset sect_off, unsigned int offset_in_dwz,
+ const std::vector<dwarf2_per_cu_data_up> &all_units)
{
int low, high;
@@ -23664,27 +23300,25 @@ dwarf2_find_containing_comp_unit (sect_offset sect_off,
unsigned int offset_in_dwz,
dwarf2_per_bfd *per_bfd)
{
- int low = dwarf2_find_containing_comp_unit
- (sect_off, offset_in_dwz, per_bfd->all_units);
+ int low = dwarf2_find_containing_comp_unit (sect_off, offset_in_dwz,
+ per_bfd->all_units);
dwarf2_per_cu_data *this_cu = per_bfd->all_units[low].get ();
if (this_cu->is_dwz != offset_in_dwz || this_cu->sect_off > sect_off)
{
if (low == 0 || this_cu->is_dwz != offset_in_dwz)
- error (_("Dwarf Error: could not find partial DIE containing "
- "offset %s [in module %s]"),
- sect_offset_str (sect_off),
- bfd_get_filename (per_bfd->obfd));
+ error (_ ("Dwarf Error: could not find partial DIE containing "
+ "offset %s [in module %s]"),
+ sect_offset_str (sect_off), bfd_get_filename (per_bfd->obfd));
- gdb_assert (per_bfd->all_units[low-1]->sect_off
- <= sect_off);
+ gdb_assert (per_bfd->all_units[low - 1]->sect_off <= sect_off);
return per_bfd->all_units[low - 1].get ();
}
else
{
if (low == per_bfd->all_units.size () - 1
&& sect_off >= this_cu->sect_off + this_cu->length ())
- error (_("invalid dwarf2 offset %s"), sect_offset_str (sect_off));
+ error (_ ("invalid dwarf2 offset %s"), sect_offset_str (sect_off));
gdb_assert (sect_off < this_cu->sect_off + this_cu->length ());
return this_cu;
}
@@ -23692,8 +23326,10 @@ dwarf2_find_containing_comp_unit (sect_offset sect_off,
#if GDB_SELF_TEST
-namespace selftests {
-namespace find_containing_comp_unit {
+namespace selftests
+{
+namespace find_containing_comp_unit
+{
static void
run_test ()
@@ -23740,8 +23376,8 @@ run_test ()
SELF_CHECK (units[result].get () == four_ptr);
}
-}
-}
+} // namespace find_containing_comp_unit
+} // namespace selftests
#endif /* GDB_SELF_TEST */
@@ -23767,8 +23403,7 @@ prepare_one_comp_unit (struct dwarf2_cu *cu, struct die_info *comp_unit_die,
string. */
lang = language_opencl;
}
- else if (cu->producer != nullptr
- && strstr (cu->producer, "GNU Go ") != NULL)
+ else if (cu->producer != nullptr && strstr (cu->producer, "GNU Go ") != NULL)
{
/* Similar hack for Go. */
lang = language_go;
@@ -23792,7 +23427,7 @@ prepare_one_comp_unit (struct dwarf2_cu *cu, struct die_info *comp_unit_die,
cu->per_cu->set_unit_type (DW_UT_type);
break;
default:
- error (_("Dwarf Error: unexpected tag '%s' at offset %s"),
+ error (_ ("Dwarf Error: unexpected tag '%s' at offset %s"),
dwarf_tag_name (comp_unit_die->tag),
sect_offset_str (cu->per_cu->sect_off));
}
@@ -23966,14 +23601,11 @@ set_die_type (struct die_info *die, struct type *type, struct dwarf2_cu *cu,
where the type-specific area is used to store the floatformat).
But this is not a problem, because the gnat-specific information
is actually not needed for these types. */
- if (need_gnat_info (cu)
- && type->code () != TYPE_CODE_FUNC
- && type->code () != TYPE_CODE_FLT
- && type->code () != TYPE_CODE_METHODPTR
+ if (need_gnat_info (cu) && type->code () != TYPE_CODE_FUNC
+ && type->code () != TYPE_CODE_FLT && type->code () != TYPE_CODE_METHODPTR
&& type->code () != TYPE_CODE_MEMBERPTR
&& type->code () != TYPE_CODE_METHOD
- && type->code () != TYPE_CODE_FIXED_POINT
- && !HAVE_GNAT_AUX_INFO (type))
+ && type->code () != TYPE_CODE_FIXED_POINT && !HAVE_GNAT_AUX_INFO (type))
INIT_GNAT_SPECIFIC (type);
/* Read DW_AT_allocated and set in type. */
@@ -24013,10 +23645,9 @@ set_die_type (struct die_info *die, struct type *type, struct dwarf2_cu *cu,
if (per_objfile->die_type_hash == NULL)
per_objfile->die_type_hash
- = htab_up (htab_create_alloc (127,
- per_cu_offset_and_type_hash,
- per_cu_offset_and_type_eq,
- NULL, xcalloc, xfree));
+ = htab_up (htab_create_alloc (127, per_cu_offset_and_type_hash,
+ per_cu_offset_and_type_eq, NULL, xcalloc,
+ xfree));
ofs.per_cu = cu->per_cu;
ofs.sect_off = die->sect_off;
@@ -24024,10 +23655,10 @@ set_die_type (struct die_info *die, struct type *type, struct dwarf2_cu *cu,
slot = (struct dwarf2_per_cu_offset_and_type **)
htab_find_slot (per_objfile->die_type_hash.get (), &ofs, INSERT);
if (*slot)
- complaint (_("A problem internal to GDB: DIE %s has type already set"),
+ complaint (_ ("A problem internal to GDB: DIE %s has type already set"),
sect_offset_str (die->sect_off));
- *slot = XOBNEW (&objfile->objfile_obstack,
- struct dwarf2_per_cu_offset_and_type);
+ *slot
+ = XOBNEW (&objfile->objfile_obstack, struct dwarf2_per_cu_offset_and_type);
**slot = ofs;
return type;
}
@@ -24036,8 +23667,7 @@ set_die_type (struct die_info *die, struct type *type, struct dwarf2_cu *cu,
or return NULL if the die does not have a saved type. */
static struct type *
-get_die_type_at_offset (sect_offset sect_off,
- dwarf2_per_cu_data *per_cu,
+get_die_type_at_offset (sect_offset sect_off, dwarf2_per_cu_data *per_cu,
dwarf2_per_objfile *per_objfile)
{
struct dwarf2_per_cu_offset_and_type *slot, ofs;
@@ -24048,7 +23678,7 @@ get_die_type_at_offset (sect_offset sect_off,
ofs.per_cu = per_cu;
ofs.sect_off = sect_off;
slot = ((struct dwarf2_per_cu_offset_and_type *)
- htab_find (per_objfile->die_type_hash.get (), &ofs));
+ htab_find (per_objfile->die_type_hash.get (), &ofs));
if (slot)
return slot->type;
else
@@ -24071,95 +23701,97 @@ static void
show_check_physname (struct ui_file *file, int from_tty,
struct cmd_list_element *c, const char *value)
{
- gdb_printf (file,
- _("Whether to check \"physname\" is %s.\n"),
- value);
+ gdb_printf (file, _ ("Whether to check \"physname\" is %s.\n"), value);
}
void _initialize_dwarf2_read ();
+
void
_initialize_dwarf2_read ()
{
- add_setshow_prefix_cmd ("dwarf", class_maintenance,
- _("\
+ add_setshow_prefix_cmd ("dwarf", class_maintenance, _ ("\
Set DWARF specific variables.\n\
Configure DWARF variables such as the cache size."),
- _("\
+ _ ("\
Show DWARF specific variables.\n\
Show DWARF variables such as the cache size."),
&set_dwarf_cmdlist, &show_dwarf_cmdlist,
&maintenance_set_cmdlist, &maintenance_show_cmdlist);
add_setshow_zinteger_cmd ("max-cache-age", class_obscure,
- &dwarf_max_cache_age, _("\
-Set the upper bound on the age of cached DWARF compilation units."), _("\
-Show the upper bound on the age of cached DWARF compilation units."), _("\
+ &dwarf_max_cache_age, _ ("\
+Set the upper bound on the age of cached DWARF compilation units."),
+ _ ("\
+Show the upper bound on the age of cached DWARF compilation units."),
+ _ ("\
A higher limit means that cached compilation units will be stored\n\
in memory longer, and more total memory will be used. Zero disables\n\
caching, which can slow down startup."),
- NULL,
- show_dwarf_max_cache_age,
- &set_dwarf_cmdlist,
+ NULL, show_dwarf_max_cache_age, &set_dwarf_cmdlist,
&show_dwarf_cmdlist);
- add_setshow_zuinteger_cmd ("dwarf-read", no_class, &dwarf_read_debug, _("\
-Set debugging of the DWARF reader."), _("\
-Show debugging of the DWARF reader."), _("\
+ add_setshow_zuinteger_cmd ("dwarf-read", no_class, &dwarf_read_debug, _ ("\
+Set debugging of the DWARF reader."),
+ _ ("\
+Show debugging of the DWARF reader."),
+ _ ("\
When enabled (non-zero), debugging messages are printed during DWARF\n\
reading and symtab expansion. A value of 1 (one) provides basic\n\
information. A value greater than 1 provides more verbose information."),
- NULL,
- NULL,
- &setdebuglist, &showdebuglist);
+ NULL, NULL, &setdebuglist, &showdebuglist);
- add_setshow_zuinteger_cmd ("dwarf-die", no_class, &dwarf_die_debug, _("\
-Set debugging of the DWARF DIE reader."), _("\
-Show debugging of the DWARF DIE reader."), _("\
+ add_setshow_zuinteger_cmd ("dwarf-die", no_class, &dwarf_die_debug, _ ("\
+Set debugging of the DWARF DIE reader."),
+ _ ("\
+Show debugging of the DWARF DIE reader."),
+ _ ("\
When enabled (non-zero), DIEs are dumped after they are read in.\n\
The value is the maximum depth to print."),
- NULL,
- NULL,
- &setdebuglist, &showdebuglist);
+ NULL, NULL, &setdebuglist, &showdebuglist);
- add_setshow_zuinteger_cmd ("dwarf-line", no_class, &dwarf_line_debug, _("\
-Set debugging of the dwarf line reader."), _("\
-Show debugging of the dwarf line reader."), _("\
+ add_setshow_zuinteger_cmd ("dwarf-line", no_class, &dwarf_line_debug, _ ("\
+Set debugging of the dwarf line reader."),
+ _ ("\
+Show debugging of the dwarf line reader."),
+ _ ("\
When enabled (non-zero), line number entries are dumped as they are read in.\n\
A value of 1 (one) provides basic information.\n\
A value greater than 1 provides more verbose information."),
- NULL,
- NULL,
- &setdebuglist, &showdebuglist);
+ NULL, NULL, &setdebuglist, &showdebuglist);
- add_setshow_boolean_cmd ("check-physname", no_class, &check_physname, _("\
-Set cross-checking of \"physname\" code against demangler."), _("\
-Show cross-checking of \"physname\" code against demangler."), _("\
+ add_setshow_boolean_cmd ("check-physname", no_class, &check_physname, _ ("\
+Set cross-checking of \"physname\" code against demangler."),
+ _ ("\
+Show cross-checking of \"physname\" code against demangler."),
+ _ ("\
When enabled, GDB's internal \"physname\" code is checked against\n\
the demangler."),
- NULL, show_check_physname,
- &setdebuglist, &showdebuglist);
-
- add_setshow_boolean_cmd ("use-deprecated-index-sections",
- no_class, &use_deprecated_index_sections, _("\
-Set whether to use deprecated gdb_index sections."), _("\
-Show whether to use deprecated gdb_index sections."), _("\
+ NULL, show_check_physname, &setdebuglist,
+ &showdebuglist);
+
+ add_setshow_boolean_cmd ("use-deprecated-index-sections", no_class,
+ &use_deprecated_index_sections, _ ("\
+Set whether to use deprecated gdb_index sections."),
+ _ ("\
+Show whether to use deprecated gdb_index sections."),
+ _ ("\
When enabled, deprecated .gdb_index sections are used anyway.\n\
Normally they are ignored either because of a missing feature or\n\
performance issue.\n\
Warning: This option must be enabled before gdb reads the file."),
- NULL,
- NULL,
- &setlist, &showlist);
-
- dwarf2_locexpr_index = register_symbol_computed_impl (LOC_COMPUTED,
- &dwarf2_locexpr_funcs);
- dwarf2_loclist_index = register_symbol_computed_impl (LOC_COMPUTED,
- &dwarf2_loclist_funcs);
-
- dwarf2_locexpr_block_index = register_symbol_block_impl (LOC_BLOCK,
- &dwarf2_block_frame_base_locexpr_funcs);
- dwarf2_loclist_block_index = register_symbol_block_impl (LOC_BLOCK,
- &dwarf2_block_frame_base_loclist_funcs);
+ NULL, NULL, &setlist, &showlist);
+
+ dwarf2_locexpr_index
+ = register_symbol_computed_impl (LOC_COMPUTED, &dwarf2_locexpr_funcs);
+ dwarf2_loclist_index
+ = register_symbol_computed_impl (LOC_COMPUTED, &dwarf2_loclist_funcs);
+
+ dwarf2_locexpr_block_index
+ = register_symbol_block_impl (LOC_BLOCK,
+ &dwarf2_block_frame_base_locexpr_funcs);
+ dwarf2_loclist_block_index
+ = register_symbol_block_impl (LOC_BLOCK,
+ &dwarf2_block_frame_base_loclist_funcs);
#if GDB_SELF_TEST
selftests::register_test ("dw2_expand_symtabs_matching",
diff --git a/gdb/dwarf2/read.h b/gdb/dwarf2/read.h
index 8045a57563f..360e3ebba89 100644
--- a/gdb/dwarf2/read.h
+++ b/gdb/dwarf2/read.h
@@ -91,7 +91,7 @@ struct dwarf2_per_cu_data_deleter
/* A specialization of unique_ptr for dwarf2_per_cu_data and
subclasses. */
typedef std::unique_ptr<dwarf2_per_cu_data, dwarf2_per_cu_data_deleter>
- dwarf2_per_cu_data_up;
+ dwarf2_per_cu_data_up;
/* Persistent data held for a compilation unit, even when not
processing it. We put a pointer to this structure in the
@@ -120,12 +120,14 @@ struct dwarf2_per_cu_data
sect_offset sect_off {};
private:
+
unsigned int m_length = 0;
/* DWARF standard version this data has been read from (such as 4 or 5). */
unsigned char m_dwarf_version = 0;
public:
+
/* Flag indicating this compilation unit will be read in before
any of the current compilation units are processed. */
unsigned int queued : 1;
@@ -177,13 +179,15 @@ public:
packed<bool, 1> addresses_seen = false;
private:
+
/* The unit type of this CU. */
- std::atomic<packed<dwarf_unit_type, 1>> m_unit_type {(dwarf_unit_type)0};
+ std::atomic<packed<dwarf_unit_type, 1>> m_unit_type { (dwarf_unit_type) 0 };
/* The language of this CU. */
- std::atomic<packed<language, LANGUAGE_BYTES>> m_lang {language_unknown};
+ std::atomic<packed<language, LANGUAGE_BYTES>> m_lang { language_unknown };
public:
+
/* True if this CU has been scanned by the indexer; false if
not. */
std::atomic<bool> scanned;
@@ -243,7 +247,7 @@ public:
could be refactored to make this private. Until then please try to
avoid direct access to this member, and instead use the helper
functions above. */
- std::vector <dwarf2_per_cu_data *> *imported_symtabs = nullptr;
+ std::vector<dwarf2_per_cu_data *> *imported_symtabs = nullptr;
/* Return true of IMPORTED_SYMTABS is empty or not yet allocated. */
bool imported_symtabs_empty () const
@@ -256,7 +260,7 @@ public:
void imported_symtabs_push (dwarf2_per_cu_data *p)
{
if (imported_symtabs == nullptr)
- imported_symtabs = new std::vector <dwarf2_per_cu_data *>;
+ imported_symtabs = new std::vector<dwarf2_per_cu_data *>;
imported_symtabs->push_back (p);
}
@@ -338,7 +342,7 @@ public:
void set_unit_type (dwarf_unit_type unit_type)
{
/* Set if not set already. */
- packed<dwarf_unit_type, 1> nope = (dwarf_unit_type)0;
+ packed<dwarf_unit_type, 1> nope = (dwarf_unit_type) 0;
if (m_unit_type.compare_exchange_strong (nope, unit_type))
return;
@@ -382,7 +386,8 @@ struct signatured_type : public dwarf2_per_cu_data
{
signatured_type (ULONGEST signature)
: signature (signature)
- {}
+ {
+ }
/* The type's signature. */
ULONGEST signature;
@@ -424,7 +429,8 @@ struct dwarf2_per_bfd
used. CAN_COPY is true for formats where symbol
interposition is possible and so symbol values must follow copy
relocation rules. */
- dwarf2_per_bfd (bfd *obfd, const dwarf2_debug_sections *names, bool can_copy);
+ dwarf2_per_bfd (bfd *obfd, const dwarf2_debug_sections *names,
+ bool can_copy);
~dwarf2_per_bfd ();
@@ -451,6 +457,7 @@ struct dwarf2_per_bfd
void map_info_sections (struct objfile *objfile);
private:
+
/* This function is mapped across the sections and remembers the
offset and size of each of the debugging sections we are
interested in. */
@@ -458,6 +465,7 @@ private:
const dwarf2_debug_sections &names);
public:
+
/* The corresponding BFD. */
bfd *obfd;
@@ -506,7 +514,9 @@ public:
/* Type unit statistics, to see how well the scaling improvements
are doing. */
- struct tu_stats tu_stats {};
+ struct tu_stats tu_stats
+ {
+ };
/* A table mapping DW_AT_dwo_name values to struct dwo_file objects.
This is NULL if the table hasn't been allocated yet. */
@@ -591,8 +601,10 @@ struct type_unit_group_unshareable
struct dwarf2_per_objfile
{
dwarf2_per_objfile (struct objfile *objfile, dwarf2_per_bfd *per_bfd)
- : objfile (objfile), per_bfd (per_bfd)
- {}
+ : objfile (objfile),
+ per_bfd (per_bfd)
+ {
+ }
~dwarf2_per_objfile ();
@@ -605,8 +617,7 @@ struct dwarf2_per_objfile
/* Return pointer to string at .debug_line_str offset as read from BUF.
The offset_size is OFFSET_SIZE. */
- const char *read_line_string (const gdb_byte *buf,
- unsigned int offset_size);
+ const char *read_line_string (const gdb_byte *buf, unsigned int offset_size);
/* Return true if the symtab corresponding to PER_CU has been set,
false otherwise. */
@@ -620,8 +631,8 @@ struct dwarf2_per_objfile
/* Get the type_unit_group_unshareable corresponding to TU_GROUP. If one
does not exist, create it. */
- type_unit_group_unshareable *get_type_unit_group_unshareable
- (type_unit_group *tu_group);
+ type_unit_group_unshareable *
+ get_type_unit_group_unshareable (type_unit_group *tu_group);
struct type *get_type_for_signatured_type (signatured_type *sig_type) const;
@@ -666,6 +677,7 @@ struct dwarf2_per_objfile
gdb::optional<std::queue<dwarf2_queue_item>> queue;
private:
+
/* Hold the corresponding compunit_symtab for each CU or TU. This
is indexed by dwarf2_per_cu_data::index. A NULL value means
that the CU/TU has not been expanded yet. */
@@ -684,8 +696,8 @@ private:
/* Map from the objfile-independent dwarf2_per_cu_data instances to the
corresponding objfile-dependent dwarf2_cu instances. */
- std::unordered_map<dwarf2_per_cu_data *,
- std::unique_ptr<dwarf2_cu>> m_dwarf2_cus;
+ std::unordered_map<dwarf2_per_cu_data *, std::unique_ptr<dwarf2_cu>>
+ m_dwarf2_cus;
};
/* Get the dwarf2_per_objfile associated to OBJFILE. */
@@ -713,53 +725,55 @@ CORE_ADDR dwarf2_read_addr_index (dwarf2_per_cu_data *per_cu,
dwarf2_locexpr_baton->data has lifetime of
PER_CU->DWARF2_PER_OBJFILE->OBJFILE. */
-struct dwarf2_locexpr_baton dwarf2_fetch_die_loc_sect_off
- (sect_offset sect_off, dwarf2_per_cu_data *per_cu,
- dwarf2_per_objfile *per_objfile,
- gdb::function_view<CORE_ADDR ()> get_frame_pc,
- bool resolve_abstract_p = false);
+struct dwarf2_locexpr_baton
+dwarf2_fetch_die_loc_sect_off (sect_offset sect_off,
+ dwarf2_per_cu_data *per_cu,
+ dwarf2_per_objfile *per_objfile,
+ gdb::function_view<CORE_ADDR ()> get_frame_pc,
+ bool resolve_abstract_p = false);
/* Like dwarf2_fetch_die_loc_sect_off, but take a CU
offset. */
-struct dwarf2_locexpr_baton dwarf2_fetch_die_loc_cu_off
- (cu_offset offset_in_cu, dwarf2_per_cu_data *per_cu,
- dwarf2_per_objfile *per_objfile,
- gdb::function_view<CORE_ADDR ()> get_frame_pc);
+struct dwarf2_locexpr_baton
+dwarf2_fetch_die_loc_cu_off (cu_offset offset_in_cu,
+ dwarf2_per_cu_data *per_cu,
+ dwarf2_per_objfile *per_objfile,
+ gdb::function_view<CORE_ADDR ()> get_frame_pc);
/* If the DIE at SECT_OFF in PER_CU has a DW_AT_const_value, return a
pointer to the constant bytes and set LEN to the length of the
data. If memory is needed, allocate it on OBSTACK. If the DIE
does not have a DW_AT_const_value, return NULL. */
-extern const gdb_byte *dwarf2_fetch_constant_bytes
- (sect_offset sect_off, dwarf2_per_cu_data *per_cu,
- dwarf2_per_objfile *per_objfile, obstack *obstack,
- LONGEST *len);
+extern const gdb_byte *
+dwarf2_fetch_constant_bytes (sect_offset sect_off, dwarf2_per_cu_data *per_cu,
+ dwarf2_per_objfile *per_objfile, obstack *obstack,
+ LONGEST *len);
/* Return the type of the die at SECT_OFF in PER_CU. Return NULL if no
valid type for this die is found. If VAR_NAME is non-null, and if
the DIE in question is a variable declaration (definitions are
excluded), then *VAR_NAME is set to the variable's name. */
-struct type *dwarf2_fetch_die_type_sect_off
- (sect_offset sect_off, dwarf2_per_cu_data *per_cu,
- dwarf2_per_objfile *per_objfile,
- const char **var_name = nullptr);
+struct type *dwarf2_fetch_die_type_sect_off (sect_offset sect_off,
+ dwarf2_per_cu_data *per_cu,
+ dwarf2_per_objfile *per_objfile,
+ const char **var_name = nullptr);
/* When non-zero, dump line number entries as they are read in. */
extern unsigned int dwarf_line_debug;
/* Dwarf2 sections that can be accessed by dwarf2_get_section_info. */
-enum dwarf2_section_enum {
+enum dwarf2_section_enum
+{
DWARF2_DEBUG_FRAME,
DWARF2_EH_FRAME
};
extern void dwarf2_get_section_info (struct objfile *,
- enum dwarf2_section_enum,
- asection **, const gdb_byte **,
- bfd_size_type *);
+ enum dwarf2_section_enum, asection **,
+ const gdb_byte **, bfd_size_type *);
/* Return true if the producer of the inferior is clang. */
extern bool producer_is_clang (struct dwarf2_cu *cu);
diff --git a/gdb/dwarf2/sect-names.h b/gdb/dwarf2/sect-names.h
index c05d496aed8..6a3dadf472f 100644
--- a/gdb/dwarf2/sect-names.h
+++ b/gdb/dwarf2/sect-names.h
@@ -28,7 +28,8 @@
It doesn't make sense to have a NULL NORMAL field but a non-NULL COMPRESSED
field. */
-struct dwarf2_section_names {
+struct dwarf2_section_names
+{
const char *normal;
const char *compressed;
@@ -47,7 +48,8 @@ struct dwarf2_section_names {
update all instances of dwarf2_debug_sections if you add a field to this
structure. It is always safe to use { NULL, NULL } in this case. */
-struct dwarf2_debug_sections {
+struct dwarf2_debug_sections
+{
struct dwarf2_section_names info;
struct dwarf2_section_names abbrev;
struct dwarf2_section_names line;
diff --git a/gdb/dwarf2/section.c b/gdb/dwarf2/section.c
index c9ef41893ee..ae2ee61d046 100644
--- a/gdb/dwarf2/section.c
+++ b/gdb/dwarf2/section.c
@@ -33,8 +33,8 @@
void
dwarf2_section_info::overflow_complaint () const
{
- complaint (_("debug info runs off end of %s section"
- " [in module %s]"),
+ complaint (_ ("debug info runs off end of %s section"
+ " [in module %s]"),
get_name (), get_file_name ());
}
@@ -135,14 +135,14 @@ dwarf2_section_info::read (struct objfile *objfile)
/* If this is a virtual section we need to read in the real one first. */
if (is_virtual)
{
- struct dwarf2_section_info *containing_section =
- get_containing_section ();
+ struct dwarf2_section_info *containing_section
+ = get_containing_section ();
gdb_assert (sectp != NULL);
if ((sectp->flags & SEC_RELOC) != 0)
{
- error (_("Dwarf Error: DWP format V2 with relocations is not"
- " supported in section %s [in module %s]"),
+ error (_ ("Dwarf Error: DWP format V2 with relocations is not"
+ " supported in section %s [in module %s]"),
get_name (), get_file_name ());
}
containing_section->read (objfile);
@@ -184,8 +184,8 @@ dwarf2_section_info::read (struct objfile *objfile)
if (bfd_seek (abfd, sectp->filepos, SEEK_SET) != 0
|| bfd_bread (buf, size, abfd) != size)
{
- error (_("Dwarf Error: Can't read DWARF data"
- " in section %s [in module %s]"),
+ error (_ ("Dwarf Error: Can't read DWARF data"
+ " in section %s [in module %s]"),
bfd_section_name (sectp), bfd_get_filename (abfd));
}
}
@@ -198,15 +198,14 @@ dwarf2_section_info::read_string (struct objfile *objfile, LONGEST str_offset,
if (buffer == NULL)
{
if (get_bfd_section () == nullptr)
- error (_("Dwarf Error: %s used without required section"),
- form_name);
+ error (_ ("Dwarf Error: %s used without required section"), form_name);
else
- error (_("Dwarf Error: %s used without %s section [in module %s]"),
+ error (_ ("Dwarf Error: %s used without %s section [in module %s]"),
form_name, get_name (), get_file_name ());
}
if (str_offset >= size)
- error (_("%s pointing outside of %s section [in module %s]"),
- form_name, get_name (), get_file_name ());
+ error (_ ("%s pointing outside of %s section [in module %s]"), form_name,
+ get_name (), get_file_name ());
gdb_assert (HOST_CHAR_BIT == 8);
if (buffer[str_offset] == '\0')
return NULL;
diff --git a/gdb/dwarf2/section.h b/gdb/dwarf2/section.h
index fbeb9745075..5fb0ffe350c 100644
--- a/gdb/dwarf2/section.h
+++ b/gdb/dwarf2/section.h
@@ -111,6 +111,7 @@ struct dwarf2_section_info
section. */
struct dwarf2_section_info *containing_section;
} s;
+
/* Pointer to section data, only valid if readin. */
const gdb_byte *buffer;
/* The size of the section, real or virtual. */
diff --git a/gdb/elf-none-tdep.c b/gdb/elf-none-tdep.c
index 460f02e7dbb..8a4fe8d7b0d 100644
--- a/gdb/elf-none-tdep.c
+++ b/gdb/elf-none-tdep.c
@@ -21,7 +21,7 @@
#include "defs.h"
#include "elf-none-tdep.h"
#include "regset.h"
-#include "elf-bfd.h" /* for elfcore_write_* */
+#include "elf-bfd.h" /* for elfcore_write_* */
#include "inferior.h"
#include "regcache.h"
#include "gdbarch.h"
@@ -97,9 +97,8 @@ elf_none_make_corefile_notes (struct gdbarch *gdbarch, bfd *obfd,
stop_signal = GDB_SIGNAL_0;
if (signalled_thr != nullptr)
- gcore_elf_build_thread_register_notes (gdbarch, signalled_thr,
- stop_signal, obfd, &note_data,
- note_size);
+ gcore_elf_build_thread_register_notes (gdbarch, signalled_thr, stop_signal,
+ obfd, &note_data, note_size);
for (thread_info *thr : current_inferior ()->non_exited_threads ())
{
if (thr == signalled_thr)
@@ -109,7 +108,6 @@ elf_none_make_corefile_notes (struct gdbarch *gdbarch, bfd *obfd,
&note_data, note_size);
}
-
/* Target description. */
gcore_elf_make_tdesc_note (obfd, &note_data, note_size);
diff --git a/gdb/elfread.c b/gdb/elfread.c
index 45cd73b01af..44b694fef32 100644
--- a/gdb/elfread.c
+++ b/gdb/elfread.c
@@ -57,11 +57,11 @@
It's local to elf_symfile_read. */
struct elfinfo
- {
- asection *stabsect; /* Section pointer for .stab section */
- asection *mdebugsect; /* Section pointer for .mdebug section */
- asection *ctfsect; /* Section pointer for .ctf section */
- };
+{
+ asection *stabsect; /* Section pointer for .stab section */
+ asection *mdebugsect; /* Section pointer for .mdebug section */
+ asection *ctfsect; /* Section pointer for .ctf section */
+};
/* Type for per-BFD data. */
@@ -146,11 +146,11 @@ elf_symfile_segments (bfd *abfd)
/* Exclude debuginfo files from this warning, too, since those
are often not strictly compliant with the standard. See, e.g.,
ld/24717 for more discussion. */
- if (!is_debuginfo_file (abfd)
- && bfd_section_size (sect) > 0 && j == num_segments
- && (bfd_section_flags (sect) & SEC_LOAD) != 0)
- warning (_("Loadable section \"%s\" outside of ELF segments\n in %s"),
- bfd_section_name (sect), bfd_get_filename (abfd));
+ if (!is_debuginfo_file (abfd) && bfd_section_size (sect) > 0
+ && j == num_segments && (bfd_section_flags (sect) & SEC_LOAD) != 0)
+ warning (
+ _ ("Loadable section \"%s\" outside of ELF segments\n in %s"),
+ bfd_section_name (sect), bfd_get_filename (abfd));
}
return data;
@@ -193,11 +193,10 @@ elf_locate_sections (asection *sectp, struct elfinfo *ei)
}
static struct minimal_symbol *
-record_minimal_symbol (minimal_symbol_reader &reader,
- gdb::string_view name, bool copy_name,
- CORE_ADDR address,
- enum minimal_symbol_type ms_type,
- asection *bfd_section, struct objfile *objfile)
+record_minimal_symbol (minimal_symbol_reader &reader, gdb::string_view name,
+ bool copy_name, CORE_ADDR address,
+ enum minimal_symbol_type ms_type, asection *bfd_section,
+ struct objfile *objfile)
{
struct gdbarch *gdbarch = objfile->arch ();
@@ -239,9 +238,8 @@ record_minimal_symbol (minimal_symbol_reader &reader,
#define ST_SYNTHETIC 2
static void
-elf_symtab_read (minimal_symbol_reader &reader,
- struct objfile *objfile, int type,
- long number_of_symbols, asymbol **symbol_table,
+elf_symtab_read (minimal_symbol_reader &reader, struct objfile *objfile,
+ int type, long number_of_symbols, asymbol **symbol_table,
bool copy_names)
{
struct gdbarch *gdbarch = objfile->arch ();
@@ -278,8 +276,7 @@ elf_symtab_read (minimal_symbol_reader &reader,
continue;
}
- if (type == ST_DYNAMIC
- && sym->section == bfd_und_section_ptr
+ if (type == ST_DYNAMIC && sym->section == bfd_und_section_ptr
&& (sym->flags & BSF_FUNCTION))
{
struct minimal_symbol *msym;
@@ -308,8 +305,8 @@ elf_symtab_read (minimal_symbol_reader &reader,
continue;
if (symaddr >= bfd_section_vma (sect)
- && symaddr < bfd_section_vma (sect)
- + bfd_section_size (sect))
+ && symaddr
+ < bfd_section_vma (sect) + bfd_section_size (sect))
break;
}
if (!sect)
@@ -332,9 +329,8 @@ elf_symtab_read (minimal_symbol_reader &reader,
&& bfd_get_section_by_name (abfd, ".plt") != NULL)
continue;
- msym = record_minimal_symbol
- (reader, sym->name, copy_names,
- symaddr, mst_solib_trampoline, sect, objfile);
+ msym = record_minimal_symbol (reader, sym->name, copy_names, symaddr,
+ mst_solib_trampoline, sect, objfile);
if (msym != NULL)
{
msym->filename = filesymname;
@@ -353,8 +349,8 @@ elf_symtab_read (minimal_symbol_reader &reader,
filesymname = objfile->intern (sym->name);
else if (sym->flags & BSF_SECTION_SYM)
continue;
- else if (sym->flags & (BSF_GLOBAL | BSF_LOCAL | BSF_WEAK
- | BSF_GNU_UNIQUE))
+ else if (sym->flags
+ & (BSF_GLOBAL | BSF_LOCAL | BSF_WEAK | BSF_GNU_UNIQUE))
{
struct minimal_symbol *msym;
@@ -374,8 +370,9 @@ elf_symtab_read (minimal_symbol_reader &reader,
NOTE: uweigand-20071112: Synthetic symbols do not
have an ELF-private part, so do not touch those. */
- unsigned int shndx = type == ST_SYNTHETIC ? 0 :
- elf_sym->internal_elf_sym.st_shndx;
+ unsigned int shndx = type == ST_SYNTHETIC
+ ? 0
+ : elf_sym->internal_elf_sym.st_shndx;
switch (shndx)
{
@@ -414,8 +411,7 @@ elf_symtab_read (minimal_symbol_reader &reader,
*/
else if ((sym->name[0] == '.' && sym->name[1] == 'L'
&& (sym->flags & BSF_SYNTHETIC) == 0)
- || ((sym->flags & BSF_LOCAL)
- && sym->name[0] == '$'
+ || ((sym->flags & BSF_LOCAL) && sym->name[0] == '$'
&& sym->name[1] == 'L'))
/* Looks like a compiler-generated label. Skip
it. The assembler should be skipping these (to
@@ -470,11 +466,10 @@ elf_symtab_read (minimal_symbol_reader &reader,
hob with actions like finding what function the PC
is in. Ignore them if they aren't text, data, or bss. */
/* ms_type = mst_unknown; */
- continue; /* Skip this symbol. */
+ continue; /* Skip this symbol. */
}
- msym = record_minimal_symbol
- (reader, sym->name, copy_names, symaddr,
- ms_type, sym->section, objfile);
+ msym = record_minimal_symbol (reader, sym->name, copy_names, symaddr,
+ ms_type, sym->section, objfile);
if (msym)
{
@@ -500,12 +495,11 @@ elf_symtab_read (minimal_symbol_reader &reader,
bool is_plt = is_at_symbol && strcmp (atsign, "@plt") == 0;
int len = is_at_symbol ? atsign - sym->name : 0;
- if (is_at_symbol
- && !is_plt
+ if (is_at_symbol && !is_plt
&& (elf_sym->version & VERSYM_HIDDEN) == 0)
record_minimal_symbol (reader,
- gdb::string_view (sym->name, len),
- true, symaddr, ms_type, sym->section,
+ gdb::string_view (sym->name, len), true,
+ symaddr, ms_type, sym->section,
objfile);
else if (is_plt)
{
@@ -517,17 +511,17 @@ elf_symtab_read (minimal_symbol_reader &reader,
{
struct minimal_symbol *mtramp;
- mtramp = record_minimal_symbol
- (reader, gdb::string_view (sym->name, len), true,
- symaddr, mst_solib_trampoline, sym->section, objfile);
+ mtramp = record_minimal_symbol (
+ reader, gdb::string_view (sym->name, len), true,
+ symaddr, mst_solib_trampoline, sym->section, objfile);
if (mtramp)
{
- mtramp->set_size (msym->size());
+ mtramp->set_size (msym->size ());
mtramp->created_by_gdb = 1;
mtramp->filename = filesymname;
if (elf_make_msymbol_special_p)
- gdbarch_elf_make_msymbol_special (gdbarch,
- sym, mtramp);
+ gdbarch_elf_make_msymbol_special (gdbarch, sym,
+ mtramp);
}
}
}
@@ -544,8 +538,8 @@ elf_symtab_read (minimal_symbol_reader &reader,
DYN_SYMBOL_TABLE is no longer easily available for OBJFILE. */
static void
-elf_rel_plt_read (minimal_symbol_reader &reader,
- struct objfile *objfile, asymbol **dyn_symbol_table)
+elf_rel_plt_read (minimal_symbol_reader &reader, struct objfile *objfile,
+ asymbol **dyn_symbol_table)
{
bfd *obfd = objfile->obfd.get ();
const struct elf_backend_data *bed = get_elf_backend_data (obfd);
@@ -589,21 +583,20 @@ elf_rel_plt_read (minimal_symbol_reader &reader,
if (relplt == NULL)
return;
- if (! bed->s->slurp_reloc_table (obfd, relplt, dyn_symbol_table, TRUE))
+ if (!bed->s->slurp_reloc_table (obfd, relplt, dyn_symbol_table, TRUE))
return;
std::string string_buffer;
/* Does ADDRESS reside in SECTION of OBFD? */
- auto within_section = [obfd] (asection *section, CORE_ADDR address)
- {
- if (section == NULL)
- return false;
+ auto within_section = [obfd] (asection *section, CORE_ADDR address) {
+ if (section == NULL)
+ return false;
- return (bfd_section_vma (section) <= address
- && (address < bfd_section_vma (section)
- + bfd_section_size (section)));
- };
+ return (bfd_section_vma (section) <= address
+ && (address
+ < bfd_section_vma (section) + bfd_section_size (section)));
+ };
reloc_count = relplt->size / elf_section_data (relplt)->this_hdr.sh_entsize;
for (reloc = 0; reloc < reloc_count; reloc++)
@@ -636,9 +629,8 @@ elf_rel_plt_read (minimal_symbol_reader &reader,
string_buffer.assign (name);
string_buffer.append (got_suffix, got_suffix + got_suffix_len);
- msym = record_minimal_symbol (reader, string_buffer,
- true, address, mst_slot_got_plt,
- msym_section, objfile);
+ msym = record_minimal_symbol (reader, string_buffer, true, address,
+ mst_slot_got_plt, msym_section, objfile);
if (msym)
msym->set_size (ptr_size);
}
@@ -722,8 +714,7 @@ elf_gnu_ifunc_record_cache (const char *name, CORE_ADDR addr)
if (htab == NULL)
{
htab = htab_create_alloc (1, elf_gnu_ifunc_cache_hash,
- elf_gnu_ifunc_cache_eq,
- NULL, xcalloc, xfree);
+ elf_gnu_ifunc_cache_eq, NULL, xcalloc, xfree);
elf_objfile_gnu_ifunc_cache_data.set (objfile, htab);
}
@@ -731,8 +722,8 @@ elf_gnu_ifunc_record_cache (const char *name, CORE_ADDR addr)
obstack_grow (&objfile->objfile_obstack, &entry_local,
offsetof (struct elf_gnu_ifunc_cache, name));
obstack_grow_str0 (&objfile->objfile_obstack, name);
- entry_p
- = (struct elf_gnu_ifunc_cache *) obstack_finish (&objfile->objfile_obstack);
+ entry_p = (struct elf_gnu_ifunc_cache *)
+ obstack_finish (&objfile->objfile_obstack);
slot = htab_find_slot (htab, entry_p, INSERT);
if (*slot != NULL)
@@ -746,10 +737,10 @@ elf_gnu_ifunc_record_cache (const char *name, CORE_ADDR addr)
/* This case indicates buggy inferior program, the resolved address
should never change. */
- warning (_("gnu-indirect-function \"%s\" has changed its resolved "
- "function_address from %s to %s"),
- name, paddress (gdbarch, entry_found_p->addr),
- paddress (gdbarch, addr));
+ warning (_ ("gnu-indirect-function \"%s\" has changed its resolved "
+ "function_address from %s to %s"),
+ name, paddress (gdbarch, entry_found_p->addr),
+ paddress (gdbarch, addr));
}
/* New ENTRY_P is here leaked/duplicate in the OBJFILE obstack. */
@@ -775,34 +766,34 @@ elf_gnu_ifunc_resolve_by_cache (const char *name, CORE_ADDR *addr_p)
To search other namespaces, we would need to provide context, e.g. in
form of an objfile in that namespace. */
- gdbarch_iterate_over_objfiles_in_search_order
- (target_gdbarch (),
- [name, &addr_p, &found] (struct objfile *objfile)
- {
- htab_t htab;
- elf_gnu_ifunc_cache *entry_p;
- void **slot;
-
- htab = elf_objfile_gnu_ifunc_cache_data.get (objfile);
- if (htab == NULL)
- return 0;
-
- entry_p = ((elf_gnu_ifunc_cache *)
- alloca (sizeof (*entry_p) + strlen (name)));
- strcpy (entry_p->name, name);
-
- slot = htab_find_slot (htab, entry_p, NO_INSERT);
- if (slot == NULL)
- return 0;
- entry_p = (elf_gnu_ifunc_cache *) *slot;
- gdb_assert (entry_p != NULL);
-
- if (addr_p)
- *addr_p = entry_p->addr;
-
- found = 1;
- return 1;
- }, nullptr);
+ gdbarch_iterate_over_objfiles_in_search_order (
+ target_gdbarch (),
+ [name, &addr_p, &found] (struct objfile *objfile) {
+ htab_t htab;
+ elf_gnu_ifunc_cache *entry_p;
+ void **slot;
+
+ htab = elf_objfile_gnu_ifunc_cache_data.get (objfile);
+ if (htab == NULL)
+ return 0;
+
+ entry_p
+ = ((elf_gnu_ifunc_cache *) alloca (sizeof (*entry_p) + strlen (name)));
+ strcpy (entry_p->name, name);
+
+ slot = htab_find_slot (htab, entry_p, NO_INSERT);
+ if (slot == NULL)
+ return 0;
+ entry_p = (elf_gnu_ifunc_cache *) *slot;
+ gdb_assert (entry_p != NULL);
+
+ if (addr_p)
+ *addr_p = entry_p->addr;
+
+ found = 1;
+ return 1;
+ },
+ nullptr);
return found;
}
@@ -829,50 +820,50 @@ elf_gnu_ifunc_resolve_by_got (const char *name, CORE_ADDR *addr_p)
To search other namespaces, we would need to provide context, e.g. in
form of an objfile in that namespace. */
- gdbarch_iterate_over_objfiles_in_search_order
- (target_gdbarch (),
- [name, name_got_plt, &addr_p, &found] (struct objfile *objfile)
- {
- bfd *obfd = objfile->obfd.get ();
- struct gdbarch *gdbarch = objfile->arch ();
- type *ptr_type = builtin_type (gdbarch)->builtin_data_ptr;
- size_t ptr_size = ptr_type->length ();
- CORE_ADDR pointer_address, addr;
- asection *plt;
- gdb_byte *buf = (gdb_byte *) alloca (ptr_size);
- bound_minimal_symbol msym;
-
- msym = lookup_minimal_symbol (name_got_plt, NULL, objfile);
- if (msym.minsym == NULL)
- return 0;
- if (msym.minsym->type () != mst_slot_got_plt)
- return 0;
- pointer_address = msym.value_address ();
-
- plt = bfd_get_section_by_name (obfd, ".plt");
- if (plt == NULL)
- return 0;
-
- if (msym.minsym->size () != ptr_size)
- return 0;
- if (target_read_memory (pointer_address, buf, ptr_size) != 0)
- return 0;
- addr = extract_typed_address (buf, ptr_type);
- addr = gdbarch_convert_from_func_ptr_addr
- (gdbarch, addr, current_inferior ()->top_target ());
- addr = gdbarch_addr_bits_remove (gdbarch, addr);
-
- if (elf_gnu_ifunc_record_cache (name, addr))
- {
- if (addr_p != NULL)
- *addr_p = addr;
-
- found = 1;
- return 1;
- }
-
- return 0;
- }, nullptr);
+ gdbarch_iterate_over_objfiles_in_search_order (
+ target_gdbarch (),
+ [name, name_got_plt, &addr_p, &found] (struct objfile *objfile) {
+ bfd *obfd = objfile->obfd.get ();
+ struct gdbarch *gdbarch = objfile->arch ();
+ type *ptr_type = builtin_type (gdbarch)->builtin_data_ptr;
+ size_t ptr_size = ptr_type->length ();
+ CORE_ADDR pointer_address, addr;
+ asection *plt;
+ gdb_byte *buf = (gdb_byte *) alloca (ptr_size);
+ bound_minimal_symbol msym;
+
+ msym = lookup_minimal_symbol (name_got_plt, NULL, objfile);
+ if (msym.minsym == NULL)
+ return 0;
+ if (msym.minsym->type () != mst_slot_got_plt)
+ return 0;
+ pointer_address = msym.value_address ();
+
+ plt = bfd_get_section_by_name (obfd, ".plt");
+ if (plt == NULL)
+ return 0;
+
+ if (msym.minsym->size () != ptr_size)
+ return 0;
+ if (target_read_memory (pointer_address, buf, ptr_size) != 0)
+ return 0;
+ addr = extract_typed_address (buf, ptr_type);
+ addr = gdbarch_convert_from_func_ptr_addr (
+ gdbarch, addr, current_inferior ()->top_target ());
+ addr = gdbarch_addr_bits_remove (gdbarch, addr);
+
+ if (elf_gnu_ifunc_record_cache (name, addr))
+ {
+ if (addr_p != NULL)
+ *addr_p = addr;
+
+ found = 1;
+ return 1;
+ }
+
+ return 0;
+ },
+ nullptr);
return found;
}
@@ -931,12 +922,14 @@ elf_gnu_ifunc_resolve_addr (struct gdbarch *gdbarch, CORE_ADDR pc)
function descriptor. */
target_auxv_search (AT_HWCAP, &hwcap);
- hwcap_val = value_from_longest (builtin_type (gdbarch)
- ->builtin_unsigned_long, hwcap);
+ hwcap_val
+ = value_from_longest (builtin_type (gdbarch)->builtin_unsigned_long,
+ hwcap);
address_val = call_function_by_hand (function, NULL, hwcap_val);
address = value_as_address (address_val);
- address = gdbarch_convert_from_func_ptr_addr
- (gdbarch, address, current_inferior ()->top_target ());
+ address
+ = gdbarch_convert_from_func_ptr_addr (gdbarch, address,
+ current_inferior ()->top_target ());
address = gdbarch_addr_bits_remove (gdbarch, address);
if (name_at_pc)
@@ -981,10 +974,10 @@ elf_gnu_ifunc_resolver_stop (code_breakpoint *b)
sal.pc = prev_pc;
sal.section = find_pc_overlay (sal.pc);
sal.explicit_pc = 1;
- b_return
- = set_momentary_breakpoint (get_frame_arch (prev_frame), sal,
- prev_frame_id,
- bp_gnu_ifunc_resolver_return).release ();
+ b_return = set_momentary_breakpoint (get_frame_arch (prev_frame), sal,
+ prev_frame_id,
+ bp_gnu_ifunc_resolver_return)
+ .release ();
/* set_momentary_breakpoint invalidates PREV_FRAME. */
prev_frame = NULL;
@@ -1024,8 +1017,8 @@ elf_gnu_ifunc_resolver_return_stop (code_breakpoint *b)
delete_breakpoint (b);
break;
default:
- internal_error (_("handle_inferior_event: Invalid "
- "gnu-indirect-function breakpoint type %d"),
+ internal_error (_ ("handle_inferior_event: Invalid "
+ "gnu-indirect-function breakpoint type %d"),
(int) b->type);
}
b = (code_breakpoint *) b_next;
@@ -1041,8 +1034,9 @@ elf_gnu_ifunc_resolver_return_stop (code_breakpoint *b)
gdbarch_return_value_as_value (gdbarch, func_func, value_type, regcache,
&value, NULL);
resolved_address = value_as_address (value);
- resolved_pc = gdbarch_convert_from_func_ptr_addr
- (gdbarch, resolved_address, current_inferior ()->top_target ());
+ resolved_pc
+ = gdbarch_convert_from_func_ptr_addr (gdbarch, resolved_address,
+ current_inferior ()->top_target ());
resolved_pc = gdbarch_addr_bits_remove (gdbarch, resolved_pc);
gdb_assert (current_program_space == b->pspace || b->pspace == NULL);
@@ -1050,7 +1044,8 @@ elf_gnu_ifunc_resolver_return_stop (code_breakpoint *b)
b->type = bp_breakpoint;
update_breakpoint_locations (b, current_program_space,
- find_function_start_sal (resolved_pc, NULL, true),
+ find_function_start_sal (resolved_pc, NULL,
+ true),
{});
}
@@ -1074,10 +1069,8 @@ elf_read_minimal_symbols (struct objfile *objfile, int symfile_flags,
redo all the work anyway, because the psym readers for those
kinds of debuginfo need extra information found here. This can
go away once all types of symbols are in the per-BFD object. */
- if (objfile->per_bfd->minsyms_read
- && ei->stabsect == NULL
- && ei->mdebugsect == NULL
- && ei->ctfsect == NULL)
+ if (objfile->per_bfd->minsyms_read && ei->stabsect == NULL
+ && ei->mdebugsect == NULL && ei->ctfsect == NULL)
{
symtab_create_debug_printf ("minimal symbols were previously read");
return;
@@ -1089,7 +1082,7 @@ elf_read_minimal_symbols (struct objfile *objfile, int symfile_flags,
storage_needed = bfd_get_symtab_upper_bound (objfile->obfd.get ());
if (storage_needed < 0)
- error (_("Can't read symbols from %s: %s"),
+ error (_ ("Can't read symbols from %s: %s"),
bfd_get_filename (objfile->obfd.get ()),
bfd_errmsg (bfd_get_error ()));
@@ -1102,7 +1095,7 @@ elf_read_minimal_symbols (struct objfile *objfile, int symfile_flags,
symcount = bfd_canonicalize_symtab (objfile->obfd.get (), symbol_table);
if (symcount < 0)
- error (_("Can't read symbols from %s: %s"),
+ error (_ ("Can't read symbols from %s: %s"),
bfd_get_filename (objfile->obfd.get ()),
bfd_errmsg (bfd_get_error ()));
@@ -1128,7 +1121,7 @@ elf_read_minimal_symbols (struct objfile *objfile, int symfile_flags,
dyn_symbol_table);
if (dynsymcount < 0)
- error (_("Can't read symbols from %s: %s"),
+ error (_ ("Can't read symbols from %s: %s"),
bfd_get_filename (objfile->obfd.get ()),
bfd_errmsg (bfd_get_error ()));
@@ -1157,15 +1150,15 @@ elf_read_minimal_symbols (struct objfile *objfile, int symfile_flags,
/* Add synthetic symbols - for instance, names for any PLT entries. */
- synthcount = bfd_get_synthetic_symtab (synth_abfd, symcount, symbol_table,
- dynsymcount, dyn_symbol_table,
- &synthsyms);
+ synthcount
+ = bfd_get_synthetic_symtab (synth_abfd, symcount, symbol_table,
+ dynsymcount, dyn_symbol_table, &synthsyms);
if (synthcount > 0)
{
long i;
- std::unique_ptr<asymbol *[]>
- synth_symbol_table (new asymbol *[synthcount]);
+ std::unique_ptr<asymbol *[]> synth_symbol_table (
+ new asymbol *[synthcount]);
for (i = 0; i < synthcount; i++)
synth_symbol_table[i] = synthsyms + i;
elf_symtab_read (reader, objfile, ST_SYNTHETIC, synthcount,
@@ -1219,8 +1212,8 @@ elf_symfile_read_dwarf2 (struct objfile *objfile,
= find_separate_debug_file_by_buildid (objfile, &warnings_vector);
if (debugfile.empty ())
- debugfile = find_separate_debug_file_by_debuglink (objfile,
- &warnings_vector);
+ debugfile
+ = find_separate_debug_file_by_debuglink (objfile, &warnings_vector);
if (!debugfile.empty ())
{
@@ -1239,19 +1232,20 @@ elf_symfile_read_dwarf2 (struct objfile *objfile,
if (build_id != nullptr)
{
gdb::unique_xmalloc_ptr<char> symfile_path;
- scoped_fd fd (debuginfod_debuginfo_query (build_id->data,
- build_id->size,
- filename,
- &symfile_path));
+ scoped_fd fd (debuginfod_debuginfo_query (
+ build_id->data, build_id->size, filename, &symfile_path));
if (fd.get () >= 0)
{
/* File successfully retrieved from server. */
- gdb_bfd_ref_ptr debug_bfd (symfile_bfd_open (symfile_path.get ()));
+ gdb_bfd_ref_ptr debug_bfd (
+ symfile_bfd_open (symfile_path.get ()));
if (debug_bfd == nullptr)
- warning (_("File \"%s\" from debuginfod cannot be opened as bfd"),
- filename);
+ warning (
+ _ (
+ "File \"%s\" from debuginfod cannot be opened as bfd"),
+ filename);
else if (build_id_verify (debug_bfd.get (), build_id->size,
build_id->data))
{
@@ -1343,9 +1337,7 @@ elf_symfile_read (struct objfile *objfile, symfile_add_flags symfile_flags)
/* FIXME should probably warn about a stab section without a stabstr. */
if (str_sect)
- elfstab_build_psymtabs (objfile,
- ei.stabsect,
- str_sect->filepos,
+ elfstab_build_psymtabs (objfile, ei.stabsect, str_sect->filepos,
bfd_section_size (str_sect));
}
@@ -1408,41 +1400,34 @@ elf_get_probes (struct objfile *objfile)
return *probes_per_bfd;
}
-
-
/* Implementation `sym_probe_fns', as documented in symfile.h. */
-static const struct sym_probe_fns elf_probe_fns =
-{
- elf_get_probes, /* sym_get_probes */
+static const struct sym_probe_fns elf_probe_fns = {
+ elf_get_probes, /* sym_get_probes */
};
/* Register that we are able to handle ELF object file formats. */
-static const struct sym_fns elf_sym_fns =
-{
- elf_new_init, /* init anything gbl to entire symtab */
- elf_symfile_init, /* read initial info, setup for sym_read() */
- elf_symfile_read, /* read a symbol file into symtab */
- elf_symfile_finish, /* finished with file, cleanup */
- default_symfile_offsets, /* Translate ext. to int. relocation */
- elf_symfile_segments, /* Get segment information from a file. */
+static const struct sym_fns elf_sym_fns = {
+ elf_new_init, /* init anything gbl to entire symtab */
+ elf_symfile_init, /* read initial info, setup for sym_read() */
+ elf_symfile_read, /* read a symbol file into symtab */
+ elf_symfile_finish, /* finished with file, cleanup */
+ default_symfile_offsets, /* Translate ext. to int. relocation */
+ elf_symfile_segments, /* Get segment information from a file. */
NULL,
- default_symfile_relocate, /* Relocate a debug section. */
- &elf_probe_fns, /* sym_probe_fns */
+ default_symfile_relocate, /* Relocate a debug section. */
+ &elf_probe_fns, /* sym_probe_fns */
};
/* STT_GNU_IFUNC resolver vector to be installed to gnu_ifunc_fns_p. */
-static const struct gnu_ifunc_fns elf_gnu_ifunc_fns =
-{
- elf_gnu_ifunc_resolve_addr,
- elf_gnu_ifunc_resolve_name,
- elf_gnu_ifunc_resolver_stop,
- elf_gnu_ifunc_resolver_return_stop
-};
+static const struct gnu_ifunc_fns elf_gnu_ifunc_fns
+ = { elf_gnu_ifunc_resolve_addr, elf_gnu_ifunc_resolve_name,
+ elf_gnu_ifunc_resolver_stop, elf_gnu_ifunc_resolver_return_stop };
void _initialize_elfread ();
+
void
_initialize_elfread ()
{
diff --git a/gdb/eval.c b/gdb/eval.c
index bb42e693b17..69022f3502a 100644
--- a/gdb/eval.c
+++ b/gdb/eval.c
@@ -25,7 +25,7 @@
#include "target.h"
#include "frame.h"
#include "gdbthread.h"
-#include "language.h" /* For CAST_IS_CONVERSION. */
+#include "language.h" /* For CAST_IS_CONVERSION. */
#include "cp-abi.h"
#include "infcall.h"
#include "objc-lang.h"
@@ -44,7 +44,6 @@
#include "c-exp.h"
#include "inferior.h"
-
/* Parse the string EXP as a C expression, evaluate it,
and return the result as a number. */
@@ -85,7 +84,6 @@ parse_to_comma_and_eval (const char **expp)
return evaluate_expression (expr.get ());
}
-
/* See expression.h. */
@@ -156,8 +154,7 @@ evaluate_type (struct expression *exp)
values will be left on the value chain. */
void
-fetch_subexp_value (struct expression *exp,
- expr::operation *op,
+fetch_subexp_value (struct expression *exp, expr::operation *op,
struct value **valp, struct value **resultp,
std::vector<value_ref_ptr> *val_chain,
bool preserve_errors)
@@ -209,7 +206,6 @@ fetch_subexp_value (struct expression *exp,
*valp = result;
else
{
-
try
{
value_fetch_lazy (result);
@@ -281,8 +277,7 @@ binop_promote (const struct language_defn *language, struct gdbarch *gdbarch,
type1 = check_typedef (value_type (*arg1));
type2 = check_typedef (value_type (*arg2));
- if ((type1->code () != TYPE_CODE_FLT
- && type1->code () != TYPE_CODE_DECFLOAT
+ if ((type1->code () != TYPE_CODE_FLT && type1->code () != TYPE_CODE_DECFLOAT
&& !is_integral_type (type1))
|| (type2->code () != TYPE_CODE_FLT
&& type2->code () != TYPE_CODE_DECFLOAT
@@ -297,8 +292,7 @@ binop_promote (const struct language_defn *language, struct gdbarch *gdbarch,
{
/* No promotion required. */
}
- else if (type1->code () == TYPE_CODE_FLT
- || type2->code () == TYPE_CODE_FLT)
+ else if (type1->code () == TYPE_CODE_FLT || type2->code () == TYPE_CODE_FLT)
{
switch (language->la_language)
{
@@ -377,39 +371,37 @@ binop_promote (const struct language_defn *language, struct gdbarch *gdbarch,
case language_objc:
if (result_len <= builtin->builtin_int->length ())
{
- promoted_type = (unsigned_operation
- ? builtin->builtin_unsigned_int
- : builtin->builtin_int);
+ promoted_type
+ = (unsigned_operation ? builtin->builtin_unsigned_int
+ : builtin->builtin_int);
}
else if (result_len <= builtin->builtin_long->length ())
{
- promoted_type = (unsigned_operation
- ? builtin->builtin_unsigned_long
- : builtin->builtin_long);
+ promoted_type
+ = (unsigned_operation ? builtin->builtin_unsigned_long
+ : builtin->builtin_long);
}
else
{
- promoted_type = (unsigned_operation
- ? builtin->builtin_unsigned_long_long
- : builtin->builtin_long_long);
+ promoted_type
+ = (unsigned_operation ? builtin->builtin_unsigned_long_long
+ : builtin->builtin_long_long);
}
break;
case language_opencl:
if (result_len
- <= lookup_signed_typename (language, "int")->length())
+ <= lookup_signed_typename (language, "int")->length ())
{
- promoted_type =
- (unsigned_operation
- ? lookup_unsigned_typename (language, "int")
- : lookup_signed_typename (language, "int"));
+ promoted_type = (unsigned_operation
+ ? lookup_unsigned_typename (language, "int")
+ : lookup_signed_typename (language, "int"));
}
else if (result_len
- <= lookup_signed_typename (language, "long")->length())
+ <= lookup_signed_typename (language, "long")->length ())
{
- promoted_type =
- (unsigned_operation
- ? lookup_unsigned_typename (language, "long")
- : lookup_signed_typename (language,"long"));
+ promoted_type = (unsigned_operation
+ ? lookup_unsigned_typename (language, "long")
+ : lookup_signed_typename (language, "long"));
}
break;
default:
@@ -473,20 +465,25 @@ ptrmath_type_p (const struct language_defn *lang, struct type *type)
class fake_method
{
public:
- fake_method (type_instance_flags flags,
- int num_types, struct type **param_types);
+
+ fake_method (type_instance_flags flags, int num_types,
+ struct type **param_types);
~fake_method ();
/* The constructed type. */
struct type *type () { return &m_type; }
private:
- struct type m_type {};
+
+ struct type m_type
+ {
+ };
+
main_type m_main_type {};
};
-fake_method::fake_method (type_instance_flags flags,
- int num_types, struct type **param_types)
+fake_method::fake_method (type_instance_flags flags, int num_types,
+ struct type **param_types)
{
struct type *type = &m_type;
@@ -517,8 +514,8 @@ fake_method::fake_method (type_instance_flags flags,
allocate memory for auxiliary fields, and free the memory ourselves
when we are done with it. */
type->set_num_fields (num_types);
- type->set_fields
- ((struct field *) xzalloc (sizeof (struct field) * num_types));
+ type->set_fields ((struct field *) xzalloc (sizeof (struct field)
+ * num_types));
while (num_types-- > 0)
type->field (num_types).set_type (param_types[num_types]);
@@ -534,18 +531,17 @@ namespace expr
value *
type_instance_operation::evaluate (struct type *expect_type,
- struct expression *exp,
- enum noside noside)
+ struct expression *exp, enum noside noside)
{
type_instance_flags flags = std::get<0> (m_storage);
std::vector<type *> &types = std::get<1> (m_storage);
fake_method fake_expect_type (flags, types.size (), types.data ());
- return std::get<2> (m_storage)->evaluate (fake_expect_type.type (),
- exp, noside);
+ return std::get<2> (m_storage)->evaluate (fake_expect_type.type (), exp,
+ noside);
}
-}
+} // namespace expr
/* Helper for evaluating an OP_VAR_VALUE. */
@@ -585,8 +581,7 @@ namespace expr
value *
var_value_operation::evaluate (struct type *expect_type,
- struct expression *exp,
- enum noside noside)
+ struct expression *exp, enum noside noside)
{
symbol *var = std::get<0> (m_storage).symbol;
if (var->type ()->code () == TYPE_CODE_ERROR)
@@ -599,8 +594,8 @@ var_value_operation::evaluate (struct type *expect_type,
/* Helper for evaluating an OP_VAR_MSYM_VALUE. */
value *
-evaluate_var_msym_value (enum noside noside,
- struct objfile *objfile, minimal_symbol *msymbol)
+evaluate_var_msym_value (enum noside noside, struct objfile *objfile,
+ minimal_symbol *msymbol)
{
CORE_ADDR address;
type *the_type = find_minsym_type_and_address (msymbol, objfile, &address);
@@ -614,14 +609,12 @@ evaluate_var_msym_value (enum noside noside,
/* See expression.h. */
value *
-evaluate_subexp_do_call (expression *exp, enum noside noside,
- value *callee,
+evaluate_subexp_do_call (expression *exp, enum noside noside, value *callee,
gdb::array_view<value *> argvec,
- const char *function_name,
- type *default_return_type)
+ const char *function_name, type *default_return_type)
{
if (callee == NULL)
- error (_("Cannot evaluate function -- may be inlined"));
+ error (_ ("Cannot evaluate function -- may be inlined"));
if (noside == EVAL_AVOID_SIDE_EFFECTS)
{
/* If the return type doesn't look like a function type,
@@ -643,7 +636,7 @@ evaluate_subexp_do_call (expression *exp, enum noside noside,
type *return_type = result_type_of_xmethod (callee, argvec);
if (return_type == NULL)
- error (_("Xmethod is missing return type."));
+ error (_ ("Xmethod is missing return type."));
return value_zero (return_type, not_lval);
}
else if (ftype->code () == TYPE_CODE_FUNC
@@ -669,14 +662,14 @@ evaluate_subexp_do_call (expression *exp, enum noside noside,
return allocate_value (return_type);
}
else
- error (_("Expression of type other than "
- "\"Function returning ...\" used as function"));
+ error (_ ("Expression of type other than "
+ "\"Function returning ...\" used as function"));
}
switch (value_type (callee)->code ())
{
case TYPE_CODE_INTERNAL_FUNCTION:
- return call_internal_function (exp->gdbarch, exp->language_defn,
- callee, argvec.size (), argvec.data ());
+ return call_internal_function (exp->gdbarch, exp->language_defn, callee,
+ argvec.size (), argvec.data ());
case TYPE_CODE_XMETHOD:
return call_xmethod (callee, argvec);
default:
@@ -688,10 +681,8 @@ namespace expr
{
value *
-operation::evaluate_funcall (struct type *expect_type,
- struct expression *exp,
- enum noside noside,
- const char *function_name,
+operation::evaluate_funcall (struct type *expect_type, struct expression *exp,
+ enum noside noside, const char *function_name,
const std::vector<operation_up> &args)
{
std::vector<value *> vals (args.size ());
@@ -708,8 +699,8 @@ operation::evaluate_funcall (struct type *expect_type,
vals[i] = args[i]->evaluate_with_coercion (exp, noside);
}
- return evaluate_subexp_do_call (exp, noside, callee, vals,
- function_name, expect_type);
+ return evaluate_subexp_do_call (exp, noside, callee, vals, function_name,
+ expect_type);
}
value *
@@ -727,23 +718,22 @@ var_value_operation::evaluate_funcall (struct type *expect_type,
argvec[i] = args[i]->evaluate_with_coercion (exp, noside);
struct symbol *symp;
- find_overload_match (argvec, NULL, NON_METHOD,
- NULL, std::get<0> (m_storage).symbol,
- NULL, &symp, NULL, 0, noside);
+ find_overload_match (argvec, NULL, NON_METHOD, NULL,
+ std::get<0> (m_storage).symbol, NULL, &symp, NULL, 0,
+ noside);
if (symp->type ()->code () == TYPE_CODE_ERROR)
error_unknown_type (symp->print_name ());
- value *callee = evaluate_var_value (noside, std::get<0> (m_storage).block,
- symp);
+ value *callee
+ = evaluate_var_value (noside, std::get<0> (m_storage).block, symp);
- return evaluate_subexp_do_call (exp, noside, callee, argvec,
- nullptr, expect_type);
+ return evaluate_subexp_do_call (exp, noside, callee, argvec, nullptr,
+ expect_type);
}
value *
scope_operation::evaluate_funcall (struct type *expect_type,
- struct expression *exp,
- enum noside noside,
+ struct expression *exp, enum noside noside,
const std::vector<operation_up> &args)
{
if (!overload_resolution
@@ -760,13 +750,13 @@ scope_operation::evaluate_funcall (struct type *expect_type,
std::vector<value *> argvec (1 + args.size ());
if (type->code () == TYPE_CODE_NAMESPACE)
{
- function = cp_lookup_symbol_namespace (type->name (),
- name.c_str (),
- get_selected_block (0),
- VAR_DOMAIN).symbol;
+ function
+ = cp_lookup_symbol_namespace (type->name (), name.c_str (),
+ get_selected_block (0), VAR_DOMAIN)
+ .symbol;
if (function == NULL)
- error (_("No symbol \"%s\" in namespace \"%s\"."),
- name.c_str (), type->name ());
+ error (_ ("No symbol \"%s\" in namespace \"%s\"."), name.c_str (),
+ type->name ());
}
else
{
@@ -787,14 +777,14 @@ scope_operation::evaluate_funcall (struct type *expect_type,
{
int static_memfuncp;
- find_overload_match (arg_view, function_name, METHOD,
- &argvec[0], nullptr, &callee, nullptr,
- &static_memfuncp, 0, noside);
+ find_overload_match (arg_view, function_name, METHOD, &argvec[0],
+ nullptr, &callee, nullptr, &static_memfuncp, 0,
+ noside);
if (!static_memfuncp)
{
/* For the time being, we don't handle this. */
- error (_("Call to overloaded function %s requires "
- "`this' pointer"),
+ error (_ ("Call to overloaded function %s requires "
+ "`this' pointer"),
function_name);
}
@@ -804,14 +794,13 @@ scope_operation::evaluate_funcall (struct type *expect_type,
{
symbol *symp;
arg_view = arg_view.slice (1);
- find_overload_match (arg_view, nullptr,
- NON_METHOD, nullptr, function,
+ find_overload_match (arg_view, nullptr, NON_METHOD, nullptr, function,
nullptr, &symp, nullptr, 1, noside);
callee = value_of_variable (symp, get_selected_block (0));
}
- return evaluate_subexp_do_call (exp, noside, callee, arg_view,
- nullptr, expect_type);
+ return evaluate_subexp_do_call (exp, noside, callee, arg_view, nullptr,
+ expect_type);
}
value *
@@ -848,8 +837,7 @@ structop_member_base::evaluate_funcall (struct type *expect_type,
}
else if (a1_type->code () == TYPE_CODE_MEMBERPTR)
{
- struct type *type_ptr
- = lookup_pointer_type (TYPE_SELF_TYPE (a1_type));
+ struct type *type_ptr = lookup_pointer_type (TYPE_SELF_TYPE (a1_type));
struct type *target_type_ptr
= lookup_pointer_type (a1_type->target_type ());
@@ -865,21 +853,20 @@ structop_member_base::evaluate_funcall (struct type *expect_type,
val_view = val_view.slice (1);
}
else
- error (_("Non-pointer-to-member value used in pointer-to-member "
- "construct"));
+ error (_ ("Non-pointer-to-member value used in pointer-to-member "
+ "construct"));
for (int i = 0; i < args.size (); ++i)
vals[i + 1] = args[i]->evaluate_with_coercion (exp, noside);
- return evaluate_subexp_do_call (exp, noside, callee, val_view,
- nullptr, expect_type);
-
+ return evaluate_subexp_do_call (exp, noside, callee, val_view, nullptr,
+ expect_type);
}
value *
-structop_base_operation::evaluate_funcall
- (struct type *expect_type, struct expression *exp, enum noside noside,
- const std::vector<operation_up> &args)
+structop_base_operation::evaluate_funcall (
+ struct type *expect_type, struct expression *exp, enum noside noside,
+ const std::vector<operation_up> &args)
{
/* Allocate space for the function call arguments, Including space for a
`this' pointer at the start. */
@@ -940,15 +927,13 @@ structop_base_operation::evaluate_funcall
int static_memfuncp;
value *callee;
const char *tstr = std::get<1> (m_storage).c_str ();
- if (overload_resolution
- && exp->language_defn->la_language == language_cplus)
+ if (overload_resolution && exp->language_defn->la_language == language_cplus)
{
/* Language is C++, do some overload resolution before
evaluation. */
value *val0 = vals[0];
- find_overload_match (arg_view, tstr, METHOD,
- &val0, nullptr, &callee, nullptr,
- &static_memfuncp, 0, noside);
+ find_overload_match (arg_view, tstr, METHOD, &val0, nullptr, &callee,
+ nullptr, &static_memfuncp, 0, noside);
vals[0] = val0;
}
else
@@ -956,24 +941,23 @@ structop_base_operation::evaluate_funcall
{
struct value *temp = vals[0];
- callee = value_struct_elt (&temp, arg_view, tstr,
- &static_memfuncp,
- op == STRUCTOP_STRUCT
- ? "structure" : "structure pointer");
+ callee = value_struct_elt (&temp, arg_view, tstr, &static_memfuncp,
+ op == STRUCTOP_STRUCT ? "structure"
+ : "structure pointer");
/* value_struct_elt updates temp with the correct value of the
``this'' pointer if necessary, so modify it to reflect any
``this'' changes. */
vals[0] = value_from_longest (lookup_pointer_type (value_type (temp)),
value_address (temp)
- + value_embedded_offset (temp));
+ + value_embedded_offset (temp));
}
/* Take out `this' if needed. */
if (static_memfuncp)
arg_view = arg_view.slice (1);
- return evaluate_subexp_do_call (exp, noside, callee, arg_view,
- nullptr, expect_type);
+ return evaluate_subexp_do_call (exp, noside, callee, arg_view, nullptr,
+ expect_type);
}
/* Helper for structop_base_operation::complete which recursively adds
@@ -992,22 +976,21 @@ add_struct_fields (struct type *type, completion_list &output,
for (i = 0; i < type->num_fields (); ++i)
{
if (i < TYPE_N_BASECLASSES (type))
- add_struct_fields (TYPE_BASECLASS (type, i),
- output, fieldname, namelen, prefix);
+ add_struct_fields (TYPE_BASECLASS (type, i), output, fieldname,
+ namelen, prefix);
else if (type->field (i).name ())
{
if (type->field (i).name ()[0] != '\0')
{
- if (! strncmp (type->field (i).name (),
- fieldname, namelen))
+ if (!strncmp (type->field (i).name (), fieldname, namelen))
output.emplace_back (concat (prefix, type->field (i).name (),
nullptr));
}
else if (type->field (i).type ()->code () == TYPE_CODE_UNION)
{
/* Recurse into anonymous unions. */
- add_struct_fields (type->field (i).type (),
- output, fieldname, namelen, prefix);
+ add_struct_fields (type->field (i).type (), output, fieldname,
+ namelen, prefix);
}
}
}
@@ -1016,7 +999,7 @@ add_struct_fields (struct type *type, completion_list &output,
{
const char *name = TYPE_FN_FIELDLIST_NAME (type, i);
- if (name && ! strncmp (name, fieldname, namelen))
+ if (name && !strncmp (name, fieldname, namelen))
{
if (!computed_type_name)
{
@@ -1050,13 +1033,12 @@ structop_base_operation::complete (struct expression *exp,
type = type->target_type ();
}
- if (type->code () == TYPE_CODE_UNION
- || type->code () == TYPE_CODE_STRUCT)
+ if (type->code () == TYPE_CODE_UNION || type->code () == TYPE_CODE_STRUCT)
{
completion_list result;
- add_struct_fields (type, result, fieldname.c_str (),
- fieldname.length (), prefix);
+ add_struct_fields (type, result, fieldname.c_str (), fieldname.length (),
+ prefix);
tracker.add_completions (std::move (result));
return true;
}
@@ -1075,8 +1057,7 @@ is_integral_or_integral_reference (struct type *type)
return true;
type = check_typedef (type);
- return (type != nullptr
- && TYPE_IS_REFERENCE (type)
+ return (type != nullptr && TYPE_IS_REFERENCE (type)
&& is_integral_type (type->target_type ()));
}
@@ -1084,13 +1065,12 @@ is_integral_or_integral_reference (struct type *type)
struct value *
eval_op_scope (struct type *expect_type, struct expression *exp,
- enum noside noside,
- struct type *type, const char *string)
+ enum noside noside, struct type *type, const char *string)
{
- struct value *arg1 = value_aggregate_elt (type, string, expect_type,
- 0, noside);
+ struct value *arg1
+ = value_aggregate_elt (type, string, expect_type, 0, noside);
if (arg1 == NULL)
- error (_("There is no field named %s"), string);
+ error (_ ("There is no field named %s"), string);
return arg1;
}
@@ -1105,7 +1085,7 @@ eval_op_var_entry_value (struct type *expect_type, struct expression *exp,
if (SYMBOL_COMPUTED_OPS (sym) == NULL
|| SYMBOL_COMPUTED_OPS (sym)->read_variable_at_entry == NULL)
- error (_("Symbol \"%s\" does not have any specific entry value"),
+ error (_ ("Symbol \"%s\" does not have any specific entry value"),
sym->print_name ());
frame_info_ptr frame = get_selected_frame (NULL);
@@ -1119,8 +1099,8 @@ eval_op_var_msym_value (struct type *expect_type, struct expression *exp,
enum noside noside, bool outermost_p,
bound_minimal_symbol msymbol)
{
- value *val = evaluate_var_msym_value (noside, msymbol.objfile,
- msymbol.minsym);
+ value *val
+ = evaluate_var_msym_value (noside, msymbol.objfile, msymbol.minsym);
struct type *type = value_type (val);
if (type->code () == TYPE_CODE_ERROR
@@ -1133,14 +1113,13 @@ eval_op_var_msym_value (struct type *expect_type, struct expression *exp,
struct value *
eval_op_func_static_var (struct type *expect_type, struct expression *exp,
- enum noside noside,
- value *func, const char *var)
+ enum noside noside, value *func, const char *var)
{
CORE_ADDR addr = value_address (func);
const block *blk = block_for_pc (addr);
struct block_symbol sym = lookup_symbol (var, blk, VAR_DOMAIN, NULL);
if (sym.symbol == NULL)
- error (_("No symbol \"%s\" in specified context."), var);
+ error (_ ("No symbol \"%s\" in specified context."), var);
return evaluate_var_value (noside, sym.block, sym.symbol);
}
@@ -1153,10 +1132,9 @@ eval_op_register (struct type *expect_type, struct expression *exp,
int regno;
struct value *val;
- regno = user_reg_map_name_to_regnum (exp->gdbarch,
- name, strlen (name));
+ regno = user_reg_map_name_to_regnum (exp->gdbarch, name, strlen (name));
if (regno == -1)
- error (_("Register $%s not available."), name);
+ error (_ ("Register $%s not available."), name);
/* In EVAL_AVOID_SIDE_EFFECTS mode, we only need to return
a value with the appropriate register type. Unfortunately,
@@ -1169,7 +1147,7 @@ eval_op_register (struct type *expect_type, struct expression *exp,
else
val = value_of_register (regno, get_selected_frame (NULL));
if (val == NULL)
- error (_("Value of register %s not available."), name);
+ error (_ ("Value of register %s not available."), name);
else
return val;
}
@@ -1178,13 +1156,12 @@ namespace expr
{
value *
-string_operation::evaluate (struct type *expect_type,
- struct expression *exp,
+string_operation::evaluate (struct type *expect_type, struct expression *exp,
enum noside noside)
{
const std::string &str = std::get<0> (m_storage);
- struct type *type = language_string_char_type (exp->language_defn,
- exp->gdbarch);
+ struct type *type
+ = language_string_char_type (exp->language_defn, exp->gdbarch);
return value_string (str.c_str (), str.size (), type);
}
@@ -1194,8 +1171,7 @@ string_operation::evaluate (struct type *expect_type,
struct value *
eval_op_objc_selector (struct type *expect_type, struct expression *exp,
- enum noside noside,
- const char *sel)
+ enum noside noside, const char *sel)
{
struct type *selector_type = builtin_type (exp->gdbarch)->builtin_data_ptr;
return value_from_longest (selector_type,
@@ -1206,8 +1182,8 @@ eval_op_objc_selector (struct type *expect_type, struct expression *exp,
struct value *
eval_op_ternop (struct type *expect_type, struct expression *exp,
- enum noside noside,
- struct value *array, struct value *low, struct value *upper)
+ enum noside noside, struct value *array, struct value *low,
+ struct value *upper)
{
int lowbound = value_as_long (low);
int upperbound = value_as_long (upper);
@@ -1218,11 +1194,10 @@ eval_op_ternop (struct type *expect_type, struct expression *exp,
struct value *
eval_op_structop_struct (struct type *expect_type, struct expression *exp,
- enum noside noside,
- struct value *arg1, const char *string)
+ enum noside noside, struct value *arg1,
+ const char *string)
{
- struct value *arg3 = value_struct_elt (&arg1, {}, string,
- NULL, "structure");
+ struct value *arg3 = value_struct_elt (&arg1, {}, string, NULL, "structure");
if (noside == EVAL_AVOID_SIDE_EFFECTS)
arg3 = value_zero (value_type (arg3), VALUE_LVAL (arg3));
return arg3;
@@ -1232,8 +1207,8 @@ eval_op_structop_struct (struct type *expect_type, struct expression *exp,
struct value *
eval_op_structop_ptr (struct type *expect_type, struct expression *exp,
- enum noside noside,
- struct value *arg1, const char *string)
+ enum noside noside, struct value *arg1,
+ const char *string)
{
/* Check to see if operator '->' has been overloaded. If so replace
arg1 with the value returned by evaluating operator->(). */
@@ -1270,15 +1245,14 @@ eval_op_structop_ptr (struct type *expect_type, struct expression *exp,
if (opts.objectprint && arg_type->target_type ()
&& (arg_type->target_type ()->code () == TYPE_CODE_STRUCT))
{
- real_type = value_rtti_indirect_type (arg1, &full, &top,
- &using_enc);
+ real_type = value_rtti_indirect_type (arg1, &full, &top, &using_enc);
if (real_type)
arg1 = value_cast (real_type, arg1);
}
}
- struct value *arg3 = value_struct_elt (&arg1, {}, string,
- NULL, "structure pointer");
+ struct value *arg3
+ = value_struct_elt (&arg1, {}, string, NULL, "structure pointer");
if (noside == EVAL_AVOID_SIDE_EFFECTS)
arg3 = value_zero (value_type (arg3), VALUE_LVAL (arg3));
return arg3;
@@ -1288,8 +1262,7 @@ eval_op_structop_ptr (struct type *expect_type, struct expression *exp,
struct value *
eval_op_member (struct type *expect_type, struct expression *exp,
- enum noside noside,
- struct value *arg1, struct value *arg2)
+ enum noside noside, struct value *arg1, struct value *arg2)
{
long mem_offset;
@@ -1321,8 +1294,8 @@ eval_op_member (struct type *expect_type, struct expression *exp,
return value_ind (arg3);
default:
- error (_("non-pointer-to-member value used "
- "in pointer-to-member construct"));
+ error (_ ("non-pointer-to-member value used "
+ "in pointer-to-member construct"));
}
}
@@ -1330,8 +1303,7 @@ eval_op_member (struct type *expect_type, struct expression *exp,
struct value *
eval_op_add (struct type *expect_type, struct expression *exp,
- enum noside noside,
- struct value *arg1, struct value *arg2)
+ enum noside noside, struct value *arg1, struct value *arg2)
{
if (binop_user_defined_p (BINOP_ADD, arg1, arg2))
return value_x_binop (arg1, arg2, BINOP_ADD, OP_NULL, noside);
@@ -1352,8 +1324,7 @@ eval_op_add (struct type *expect_type, struct expression *exp,
struct value *
eval_op_sub (struct type *expect_type, struct expression *exp,
- enum noside noside,
- struct value *arg1, struct value *arg2)
+ enum noside noside, struct value *arg1, struct value *arg2)
{
if (binop_user_defined_p (BINOP_SUB, arg1, arg2))
return value_x_binop (arg1, arg2, BINOP_SUB, OP_NULL, noside);
@@ -1366,7 +1337,7 @@ eval_op_sub (struct type *expect_type, struct expression *exp,
}
else if (ptrmath_type_p (exp->language_defn, value_type (arg1))
&& is_integral_or_integral_reference (value_type (arg2)))
- return value_ptradd (arg1, - value_as_long (arg2));
+ return value_ptradd (arg1, -value_as_long (arg2));
else
{
binop_promote (exp->language_defn, exp->gdbarch, &arg1, &arg2);
@@ -1378,8 +1349,8 @@ eval_op_sub (struct type *expect_type, struct expression *exp,
struct value *
eval_op_binary (struct type *expect_type, struct expression *exp,
- enum noside noside, enum exp_opcode op,
- struct value *arg1, struct value *arg2)
+ enum noside noside, enum exp_opcode op, struct value *arg1,
+ struct value *arg2)
{
if (binop_user_defined_p (op, arg1, arg2))
return value_x_binop (arg1, arg2, op, OP_NULL, noside);
@@ -1392,9 +1363,7 @@ eval_op_binary (struct type *expect_type, struct expression *exp,
/* ??? Do we really want to test for BINOP_MOD here?
The implementation of value_binop gives it a well-defined
value. */
- && (op == BINOP_DIV
- || op == BINOP_INTDIV
- || op == BINOP_REM
+ && (op == BINOP_DIV || op == BINOP_INTDIV || op == BINOP_REM
|| op == BINOP_MOD)
&& value_logical_not (arg2))
{
@@ -1423,8 +1392,8 @@ eval_op_binary (struct type *expect_type, struct expression *exp,
struct value *
eval_op_subscript (struct type *expect_type, struct expression *exp,
- enum noside noside, enum exp_opcode op,
- struct value *arg1, struct value *arg2)
+ enum noside noside, enum exp_opcode op, struct value *arg1,
+ struct value *arg2)
{
if (binop_user_defined_p (op, arg1, arg2))
return value_x_binop (arg1, arg2, op, OP_NULL, noside);
@@ -1436,14 +1405,13 @@ eval_op_subscript (struct type *expect_type, struct expression *exp,
arg1 = coerce_ref (arg1);
struct type *type = check_typedef (value_type (arg1));
- if (type->code () != TYPE_CODE_ARRAY
- && type->code () != TYPE_CODE_PTR)
+ if (type->code () != TYPE_CODE_ARRAY && type->code () != TYPE_CODE_PTR)
{
if (type->name ())
- error (_("cannot subscript something of type `%s'"),
+ error (_ ("cannot subscript something of type `%s'"),
type->name ());
else
- error (_("cannot subscript requested type"));
+ error (_ ("cannot subscript requested type"));
}
if (noside == EVAL_AVOID_SIDE_EFFECTS)
@@ -1457,8 +1425,8 @@ eval_op_subscript (struct type *expect_type, struct expression *exp,
struct value *
eval_op_equal (struct type *expect_type, struct expression *exp,
- enum noside noside, enum exp_opcode op,
- struct value *arg1, struct value *arg2)
+ enum noside noside, enum exp_opcode op, struct value *arg1,
+ struct value *arg2)
{
if (binop_user_defined_p (op, arg1, arg2))
{
@@ -1468,8 +1436,8 @@ eval_op_equal (struct type *expect_type, struct expression *exp,
{
binop_promote (exp->language_defn, exp->gdbarch, &arg1, &arg2);
int tem = value_equal (arg1, arg2);
- struct type *type = language_bool_type (exp->language_defn,
- exp->gdbarch);
+ struct type *type
+ = language_bool_type (exp->language_defn, exp->gdbarch);
return value_from_longest (type, (LONGEST) tem);
}
}
@@ -1478,8 +1446,8 @@ eval_op_equal (struct type *expect_type, struct expression *exp,
struct value *
eval_op_notequal (struct type *expect_type, struct expression *exp,
- enum noside noside, enum exp_opcode op,
- struct value *arg1, struct value *arg2)
+ enum noside noside, enum exp_opcode op, struct value *arg1,
+ struct value *arg2)
{
if (binop_user_defined_p (op, arg1, arg2))
{
@@ -1489,9 +1457,9 @@ eval_op_notequal (struct type *expect_type, struct expression *exp,
{
binop_promote (exp->language_defn, exp->gdbarch, &arg1, &arg2);
int tem = value_equal (arg1, arg2);
- struct type *type = language_bool_type (exp->language_defn,
- exp->gdbarch);
- return value_from_longest (type, (LONGEST) ! tem);
+ struct type *type
+ = language_bool_type (exp->language_defn, exp->gdbarch);
+ return value_from_longest (type, (LONGEST) !tem);
}
}
@@ -1499,8 +1467,8 @@ eval_op_notequal (struct type *expect_type, struct expression *exp,
struct value *
eval_op_less (struct type *expect_type, struct expression *exp,
- enum noside noside, enum exp_opcode op,
- struct value *arg1, struct value *arg2)
+ enum noside noside, enum exp_opcode op, struct value *arg1,
+ struct value *arg2)
{
if (binop_user_defined_p (op, arg1, arg2))
{
@@ -1510,8 +1478,8 @@ eval_op_less (struct type *expect_type, struct expression *exp,
{
binop_promote (exp->language_defn, exp->gdbarch, &arg1, &arg2);
int tem = value_less (arg1, arg2);
- struct type *type = language_bool_type (exp->language_defn,
- exp->gdbarch);
+ struct type *type
+ = language_bool_type (exp->language_defn, exp->gdbarch);
return value_from_longest (type, (LONGEST) tem);
}
}
@@ -1520,8 +1488,8 @@ eval_op_less (struct type *expect_type, struct expression *exp,
struct value *
eval_op_gtr (struct type *expect_type, struct expression *exp,
- enum noside noside, enum exp_opcode op,
- struct value *arg1, struct value *arg2)
+ enum noside noside, enum exp_opcode op, struct value *arg1,
+ struct value *arg2)
{
if (binop_user_defined_p (op, arg1, arg2))
{
@@ -1531,8 +1499,8 @@ eval_op_gtr (struct type *expect_type, struct expression *exp,
{
binop_promote (exp->language_defn, exp->gdbarch, &arg1, &arg2);
int tem = value_less (arg2, arg1);
- struct type *type = language_bool_type (exp->language_defn,
- exp->gdbarch);
+ struct type *type
+ = language_bool_type (exp->language_defn, exp->gdbarch);
return value_from_longest (type, (LONGEST) tem);
}
}
@@ -1541,8 +1509,8 @@ eval_op_gtr (struct type *expect_type, struct expression *exp,
struct value *
eval_op_geq (struct type *expect_type, struct expression *exp,
- enum noside noside, enum exp_opcode op,
- struct value *arg1, struct value *arg2)
+ enum noside noside, enum exp_opcode op, struct value *arg1,
+ struct value *arg2)
{
if (binop_user_defined_p (op, arg1, arg2))
{
@@ -1552,8 +1520,8 @@ eval_op_geq (struct type *expect_type, struct expression *exp,
{
binop_promote (exp->language_defn, exp->gdbarch, &arg1, &arg2);
int tem = value_less (arg2, arg1) || value_equal (arg1, arg2);
- struct type *type = language_bool_type (exp->language_defn,
- exp->gdbarch);
+ struct type *type
+ = language_bool_type (exp->language_defn, exp->gdbarch);
return value_from_longest (type, (LONGEST) tem);
}
}
@@ -1562,8 +1530,8 @@ eval_op_geq (struct type *expect_type, struct expression *exp,
struct value *
eval_op_leq (struct type *expect_type, struct expression *exp,
- enum noside noside, enum exp_opcode op,
- struct value *arg1, struct value *arg2)
+ enum noside noside, enum exp_opcode op, struct value *arg1,
+ struct value *arg2)
{
if (binop_user_defined_p (op, arg1, arg2))
{
@@ -1573,8 +1541,8 @@ eval_op_leq (struct type *expect_type, struct expression *exp,
{
binop_promote (exp->language_defn, exp->gdbarch, &arg1, &arg2);
int tem = value_less (arg1, arg2) || value_equal (arg1, arg2);
- struct type *type = language_bool_type (exp->language_defn,
- exp->gdbarch);
+ struct type *type
+ = language_bool_type (exp->language_defn, exp->gdbarch);
return value_from_longest (type, (LONGEST) tem);
}
}
@@ -1583,13 +1551,12 @@ eval_op_leq (struct type *expect_type, struct expression *exp,
struct value *
eval_op_repeat (struct type *expect_type, struct expression *exp,
- enum noside noside, enum exp_opcode op,
- struct value *arg1, struct value *arg2)
+ enum noside noside, enum exp_opcode op, struct value *arg1,
+ struct value *arg2)
{
struct type *type = check_typedef (value_type (arg2));
- if (type->code () != TYPE_CODE_INT
- && type->code () != TYPE_CODE_ENUM)
- error (_("Non-integral right operand for \"@\" operator."));
+ if (type->code () != TYPE_CODE_INT && type->code () != TYPE_CODE_ENUM)
+ error (_ ("Non-integral right operand for \"@\" operator."));
if (noside == EVAL_AVOID_SIDE_EFFECTS)
{
return allocate_repeat_value (value_type (arg1),
@@ -1603,8 +1570,7 @@ eval_op_repeat (struct type *expect_type, struct expression *exp,
struct value *
eval_op_plus (struct type *expect_type, struct expression *exp,
- enum noside noside, enum exp_opcode op,
- struct value *arg1)
+ enum noside noside, enum exp_opcode op, struct value *arg1)
{
if (unop_user_defined_p (op, arg1))
return value_x_unop (arg1, op, noside);
@@ -1619,8 +1585,7 @@ eval_op_plus (struct type *expect_type, struct expression *exp,
struct value *
eval_op_neg (struct type *expect_type, struct expression *exp,
- enum noside noside, enum exp_opcode op,
- struct value *arg1)
+ enum noside noside, enum exp_opcode op, struct value *arg1)
{
if (unop_user_defined_p (op, arg1))
return value_x_unop (arg1, op, noside);
@@ -1635,8 +1600,7 @@ eval_op_neg (struct type *expect_type, struct expression *exp,
struct value *
eval_op_complement (struct type *expect_type, struct expression *exp,
- enum noside noside, enum exp_opcode op,
- struct value *arg1)
+ enum noside noside, enum exp_opcode op, struct value *arg1)
{
if (unop_user_defined_p (UNOP_COMPLEMENT, arg1))
return value_x_unop (arg1, UNOP_COMPLEMENT, noside);
@@ -1651,15 +1615,14 @@ eval_op_complement (struct type *expect_type, struct expression *exp,
struct value *
eval_op_lognot (struct type *expect_type, struct expression *exp,
- enum noside noside, enum exp_opcode op,
- struct value *arg1)
+ enum noside noside, enum exp_opcode op, struct value *arg1)
{
if (unop_user_defined_p (op, arg1))
return value_x_unop (arg1, op, noside);
else
{
- struct type *type = language_bool_type (exp->language_defn,
- exp->gdbarch);
+ struct type *type
+ = language_bool_type (exp->language_defn, exp->gdbarch);
return value_from_longest (type, (LONGEST) value_logical_not (arg1));
}
}
@@ -1668,14 +1631,13 @@ eval_op_lognot (struct type *expect_type, struct expression *exp,
struct value *
eval_op_ind (struct type *expect_type, struct expression *exp,
- enum noside noside,
- struct value *arg1)
+ enum noside noside, struct value *arg1)
{
struct type *type = check_typedef (value_type (arg1));
if (type->code () == TYPE_CODE_METHODPTR
|| type->code () == TYPE_CODE_MEMBERPTR)
- error (_("Attempt to dereference pointer "
- "to member without an object"));
+ error (_ ("Attempt to dereference pointer "
+ "to member without an object"));
if (unop_user_defined_p (UNOP_IND, arg1))
return value_x_unop (arg1, UNOP_IND, noside);
else if (noside == EVAL_AVOID_SIDE_EFFECTS)
@@ -1693,14 +1655,13 @@ eval_op_ind (struct type *expect_type, struct expression *exp,
if (type->is_pointer_or_reference ()
/* In C you can dereference an array to get the 1st elt. */
|| type->code () == TYPE_CODE_ARRAY)
- return value_zero (type->target_type (),
- lval_memory);
+ return value_zero (type->target_type (), lval_memory);
else if (type->code () == TYPE_CODE_INT)
/* GDB allows dereferencing an int. */
return value_zero (builtin_type (exp->gdbarch)->builtin_int,
lval_memory);
else
- error (_("Attempt to take contents of a non-pointer value."));
+ error (_ ("Attempt to take contents of a non-pointer value."));
}
}
@@ -1718,15 +1679,14 @@ eval_op_ind (struct type *expect_type, struct expression *exp,
struct value *
eval_op_alignof (struct type *expect_type, struct expression *exp,
- enum noside noside,
- struct value *arg1)
+ enum noside noside, struct value *arg1)
{
struct type *type = value_type (arg1);
/* FIXME: This should be size_t. */
struct type *size_type = builtin_type (exp->gdbarch)->builtin_int;
ULONGEST align = type_align (type);
if (align == 0)
- error (_("could not determine alignment of type"));
+ error (_ ("could not determine alignment of type"));
return value_from_longest (size_type, align);
}
@@ -1734,8 +1694,7 @@ eval_op_alignof (struct type *expect_type, struct expression *exp,
struct value *
eval_op_memval (struct type *expect_type, struct expression *exp,
- enum noside noside,
- struct value *arg1, struct type *type)
+ enum noside noside, struct value *arg1, struct type *type)
{
if (noside == EVAL_AVOID_SIDE_EFFECTS)
return value_zero (type, lval_memory);
@@ -1747,8 +1706,7 @@ eval_op_memval (struct type *expect_type, struct expression *exp,
struct value *
eval_op_preinc (struct type *expect_type, struct expression *exp,
- enum noside noside, enum exp_opcode op,
- struct value *arg1)
+ enum noside noside, enum exp_opcode op, struct value *arg1)
{
if (noside == EVAL_AVOID_SIDE_EFFECTS)
return arg1;
@@ -1778,8 +1736,7 @@ eval_op_preinc (struct type *expect_type, struct expression *exp,
struct value *
eval_op_predec (struct type *expect_type, struct expression *exp,
- enum noside noside, enum exp_opcode op,
- struct value *arg1)
+ enum noside noside, enum exp_opcode op, struct value *arg1)
{
if (noside == EVAL_AVOID_SIDE_EFFECTS)
return arg1;
@@ -1809,8 +1766,7 @@ eval_op_predec (struct type *expect_type, struct expression *exp,
struct value *
eval_op_postinc (struct type *expect_type, struct expression *exp,
- enum noside noside, enum exp_opcode op,
- struct value *arg1)
+ enum noside noside, enum exp_opcode op, struct value *arg1)
{
if (noside == EVAL_AVOID_SIDE_EFFECTS)
return arg1;
@@ -1843,8 +1799,7 @@ eval_op_postinc (struct type *expect_type, struct expression *exp,
struct value *
eval_op_postdec (struct type *expect_type, struct expression *exp,
- enum noside noside, enum exp_opcode op,
- struct value *arg1)
+ enum noside noside, enum exp_opcode op, struct value *arg1)
{
if (noside == EVAL_AVOID_SIDE_EFFECTS)
return arg1;
@@ -1882,7 +1837,7 @@ eval_op_type (struct type *expect_type, struct expression *exp,
if (noside == EVAL_AVOID_SIDE_EFFECTS)
return allocate_value (type);
else
- error (_("Attempt to use a type name as an expression"));
+ error (_ ("Attempt to use a type name as an expression"));
}
/* A helper function for BINOP_ASSIGN_MODIFY. */
@@ -1896,14 +1851,14 @@ eval_binop_assign_modify (struct type *expect_type, struct expression *exp,
return arg1;
if (binop_user_defined_p (op, arg1, arg2))
return value_x_binop (arg1, arg2, BINOP_ASSIGN_MODIFY, op, noside);
- else if (op == BINOP_ADD && ptrmath_type_p (exp->language_defn,
- value_type (arg1))
+ else if (op == BINOP_ADD
+ && ptrmath_type_p (exp->language_defn, value_type (arg1))
&& is_integral_type (value_type (arg2)))
arg2 = value_ptradd (arg1, value_as_long (arg2));
- else if (op == BINOP_SUB && ptrmath_type_p (exp->language_defn,
- value_type (arg1))
+ else if (op == BINOP_SUB
+ && ptrmath_type_p (exp->language_defn, value_type (arg1))
&& is_integral_type (value_type (arg2)))
- arg2 = value_ptradd (arg1, - value_as_long (arg2));
+ arg2 = value_ptradd (arg1, -value_as_long (arg2));
else
{
struct value *tmp = arg1;
@@ -1925,8 +1880,8 @@ eval_binop_assign_modify (struct type *expect_type, struct expression *exp,
null pointer. */
static struct value *
eval_op_objc_msgcall (struct type *expect_type, struct expression *exp,
- enum noside noside, CORE_ADDR selector,
- value *target, gdb::array_view<value *> args)
+ enum noside noside, CORE_ADDR selector, value *target,
+ gdb::array_view<value *> args)
{
CORE_ADDR responds_selector = 0;
CORE_ADDR method_selector = 0;
@@ -1976,19 +1931,17 @@ eval_op_objc_msgcall (struct type *expect_type, struct expression *exp,
type = lookup_pointer_type (type);
msg_send = find_function_in_inferior ("objc_msg_lookup", NULL);
- msg_send_stret
- = find_function_in_inferior ("objc_msg_lookup", NULL);
+ msg_send_stret = find_function_in_inferior ("objc_msg_lookup", NULL);
msg_send = value_from_pointer (type, value_as_address (msg_send));
- msg_send_stret = value_from_pointer (type,
- value_as_address (msg_send_stret));
+ msg_send_stret
+ = value_from_pointer (type, value_as_address (msg_send_stret));
}
else
{
msg_send = find_function_in_inferior ("objc_msgSend", NULL);
/* Special dispatcher for methods returning structs. */
- msg_send_stret
- = find_function_in_inferior ("objc_msgSend_stret", NULL);
+ msg_send_stret = find_function_in_inferior ("objc_msgSend_stret", NULL);
}
/* Verify the target object responds to this method. The
@@ -1999,20 +1952,17 @@ eval_op_objc_msgcall (struct type *expect_type, struct expression *exp,
responds_selector
= lookup_child_selector (exp->gdbarch, "respondsToSelector:");
if (responds_selector == 0)
- responds_selector
- = lookup_child_selector (exp->gdbarch, "respondsTo:");
+ responds_selector = lookup_child_selector (exp->gdbarch, "respondsTo:");
if (responds_selector == 0)
- error (_("no 'respondsTo:' or 'respondsToSelector:' method"));
+ error (_ ("no 'respondsTo:' or 'respondsToSelector:' method"));
- method_selector
- = lookup_child_selector (exp->gdbarch, "methodForSelector:");
+ method_selector = lookup_child_selector (exp->gdbarch, "methodForSelector:");
if (method_selector == 0)
- method_selector
- = lookup_child_selector (exp->gdbarch, "methodFor:");
+ method_selector = lookup_child_selector (exp->gdbarch, "methodFor:");
if (method_selector == 0)
- error (_("no 'methodFor:' or 'methodForSelector:' method"));
+ error (_ ("no 'methodFor:' or 'methodForSelector:' method"));
/* Call the verification method, to make sure that the target
class implements the desired method. */
@@ -2023,15 +1973,15 @@ eval_op_objc_msgcall (struct type *expect_type, struct expression *exp,
argvec[3] = value_from_longest (long_type, selector);
argvec[4] = 0;
- ret = call_function_by_hand (argvec[0], NULL, {argvec + 1, 3});
+ ret = call_function_by_hand (argvec[0], NULL, { argvec + 1, 3 });
if (gnu_runtime)
{
/* Function objc_msg_lookup returns a pointer. */
argvec[0] = ret;
- ret = call_function_by_hand (argvec[0], NULL, {argvec + 1, 3});
+ ret = call_function_by_hand (argvec[0], NULL, { argvec + 1, 3 });
}
if (value_as_long (ret) == 0)
- error (_("Target does not respond to this message selector."));
+ error (_ ("Target does not respond to this message selector."));
/* Call "methodForSelector:" method, to get the address of a
function method that implements this selector for this
@@ -2045,11 +1995,11 @@ eval_op_objc_msgcall (struct type *expect_type, struct expression *exp,
argvec[3] = value_from_longest (long_type, selector);
argvec[4] = 0;
- ret = call_function_by_hand (argvec[0], NULL, {argvec + 1, 3});
+ ret = call_function_by_hand (argvec[0], NULL, { argvec + 1, 3 });
if (gnu_runtime)
{
argvec[0] = ret;
- ret = call_function_by_hand (argvec[0], NULL, {argvec + 1, 3});
+ ret = call_function_by_hand (argvec[0], NULL, { argvec + 1, 3 });
}
/* ret should now be the selector. */
@@ -2061,8 +2011,8 @@ eval_op_objc_msgcall (struct type *expect_type, struct expression *exp,
/* The address might point to a function descriptor;
resolve it to the actual code address instead. */
- addr = gdbarch_convert_from_func_ptr_addr
- (exp->gdbarch, addr, current_inferior ()->top_target ());
+ addr = gdbarch_convert_from_func_ptr_addr (
+ exp->gdbarch, addr, current_inferior ()->top_target ());
/* Is it a high_level symbol? */
sym = find_pc_function (addr);
@@ -2084,15 +2034,13 @@ eval_op_objc_msgcall (struct type *expect_type, struct expression *exp,
val_type = check_typedef (val_type);
- if ((val_type == NULL)
- || (val_type->code () == TYPE_CODE_ERROR))
+ if ((val_type == NULL) || (val_type->code () == TYPE_CODE_ERROR))
{
if (expect_type != NULL)
val_type = expect_type;
}
- struct_return = using_struct_return (exp->gdbarch, method,
- val_type);
+ struct_return = using_struct_return (exp->gdbarch, method, val_type);
}
else if (expect_type != NULL)
{
@@ -2116,8 +2064,8 @@ eval_op_objc_msgcall (struct type *expect_type, struct expression *exp,
if (method)
{
if (value_type (method)->code () != TYPE_CODE_FUNC)
- error (_("method address has symbol information "
- "with non-function type; skipping"));
+ error (_ ("method address has symbol information "
+ "with non-function type; skipping"));
/* Create a function pointer of the appropriate type, and
replace its value with the value of msg_send or
@@ -2142,7 +2090,6 @@ eval_op_objc_msgcall (struct type *expect_type, struct expression *exp,
called_method = msg_send;
}
-
if (noside == EVAL_AVOID_SIDE_EFFECTS)
{
/* If the return type doesn't look like a function type,
@@ -2167,8 +2114,8 @@ eval_op_objc_msgcall (struct type *expect_type, struct expression *exp,
return allocate_value (callee_type);
}
else
- error (_("Expression of type other than "
- "\"method returning ...\" used as a method"));
+ error (_ ("Expression of type other than "
+ "\"method returning ...\" used as a method"));
}
/* Now depending on whether we found a symbol for the method,
@@ -2218,10 +2165,10 @@ eval_multi_subscript (struct type *expect_type, struct expression *exp,
default:
if (type->name ())
- error (_("cannot subscript something of type `%s'"),
+ error (_ ("cannot subscript something of type `%s'"),
type->name ());
else
- error (_("cannot subscript requested type"));
+ error (_ ("cannot subscript requested type"));
}
}
}
@@ -2233,8 +2180,7 @@ namespace expr
value *
objc_msgcall_operation::evaluate (struct type *expect_type,
- struct expression *exp,
- enum noside noside)
+ struct expression *exp, enum noside noside)
{
enum noside sub_no_side = EVAL_NORMAL;
struct type *selector_type = builtin_type (exp->gdbarch)->builtin_data_ptr;
@@ -2258,8 +2204,8 @@ objc_msgcall_operation::evaluate (struct type *expect_type,
argvec[i + 2] = args[i]->evaluate_with_coercion (exp, sub_no_side);
argvec[args.size () + 2] = nullptr;
- return eval_op_objc_msgcall (expect_type, exp, noside, std::
- get<0> (m_storage), target,
+ return eval_op_objc_msgcall (expect_type, exp, noside,
+ std::get<0> (m_storage), target,
gdb::make_array_view (argvec,
args.size () + 3));
}
@@ -2280,8 +2226,7 @@ multi_subscript_operation::evaluate (struct type *expect_type,
value *
logical_and_operation::evaluate (struct type *expect_type,
- struct expression *exp,
- enum noside noside)
+ struct expression *exp, enum noside noside)
{
value *arg1 = std::get<0> (m_storage)->evaluate (nullptr, exp, noside);
@@ -2301,16 +2246,15 @@ logical_and_operation::evaluate (struct type *expect_type,
arg2 = std::get<1> (m_storage)->evaluate (nullptr, exp, noside);
tem = value_logical_not (arg2);
}
- struct type *type = language_bool_type (exp->language_defn,
- exp->gdbarch);
+ struct type *type
+ = language_bool_type (exp->language_defn, exp->gdbarch);
return value_from_longest (type, !tem);
}
}
value *
logical_or_operation::evaluate (struct type *expect_type,
- struct expression *exp,
- enum noside noside)
+ struct expression *exp, enum noside noside)
{
value *arg1 = std::get<0> (m_storage)->evaluate (nullptr, exp, noside);
@@ -2331,15 +2275,14 @@ logical_or_operation::evaluate (struct type *expect_type,
tem = value_logical_not (arg2);
}
- struct type *type = language_bool_type (exp->language_defn,
- exp->gdbarch);
+ struct type *type
+ = language_bool_type (exp->language_defn, exp->gdbarch);
return value_from_longest (type, !tem);
}
}
value *
-adl_func_operation::evaluate (struct type *expect_type,
- struct expression *exp,
+adl_func_operation::evaluate (struct type *expect_type, struct expression *exp,
enum noside noside)
{
std::vector<operation_up> &arg_ops = std::get<2> (m_storage);
@@ -2348,16 +2291,13 @@ adl_func_operation::evaluate (struct type *expect_type,
args[i] = arg_ops[i]->evaluate_with_coercion (exp, noside);
struct symbol *symp;
- find_overload_match (args, std::get<0> (m_storage).c_str (),
- NON_METHOD,
- nullptr, nullptr,
- nullptr, &symp, nullptr, 0, noside);
+ find_overload_match (args, std::get<0> (m_storage).c_str (), NON_METHOD,
+ nullptr, nullptr, nullptr, &symp, nullptr, 0, noside);
if (symp->type ()->code () == TYPE_CODE_ERROR)
error_unknown_type (symp->print_name ());
value *callee = evaluate_var_value (noside, std::get<1> (m_storage), symp);
- return evaluate_subexp_do_call (exp, noside, callee, args,
- nullptr, expect_type);
-
+ return evaluate_subexp_do_call (exp, noside, callee, args, nullptr,
+ expect_type);
}
/* This function evaluates brace-initializers (in C/C++) for
@@ -2386,11 +2326,11 @@ array_operation::evaluate_struct_tuple (struct value *struct_val,
&& field_is_static (&struct_type->field (fieldno)))
fieldno++;
if (fieldno >= struct_type->num_fields ())
- error (_("too many initializers"));
+ error (_ ("too many initializers"));
field_type = struct_type->field (fieldno).type ();
if (field_type->code () == TYPE_CODE_UNION
&& struct_type->field (fieldno).name ()[0] == '0')
- error (_("don't know which variant you want to set"));
+ error (_ ("don't know which variant you want to set"));
/* Here, struct_type is the type of the inner struct,
while substruct_type is the type of the inner struct.
@@ -2415,19 +2355,17 @@ array_operation::evaluate_struct_tuple (struct value *struct_val,
bitpos = struct_type->field (fieldno).loc_bitpos ();
addr = value_contents_writeable (struct_val).data () + bitpos / 8;
if (bitsize)
- modify_field (struct_type, addr,
- value_as_long (val), bitpos % 8, bitsize);
+ modify_field (struct_type, addr, value_as_long (val), bitpos % 8,
+ bitsize);
else
memcpy (addr, value_contents (val).data (),
value_type (val)->length ());
-
}
return struct_val;
}
value *
-array_operation::evaluate (struct type *expect_type,
- struct expression *exp,
+array_operation::evaluate (struct type *expect_type, struct expression *exp,
enum noside noside)
{
int tem;
@@ -2437,8 +2375,7 @@ array_operation::evaluate (struct type *expect_type,
int nargs = tem3 - tem2 + 1;
struct type *type = expect_type ? check_typedef (expect_type) : nullptr;
- if (expect_type != nullptr
- && type->code () == TYPE_CODE_STRUCT)
+ if (expect_type != nullptr && type->code () == TYPE_CODE_STRUCT)
{
struct value *rec = allocate_value (expect_type);
@@ -2446,8 +2383,7 @@ array_operation::evaluate (struct type *expect_type,
return evaluate_struct_tuple (rec, exp, noside, nargs);
}
- if (expect_type != nullptr
- && type->code () == TYPE_CODE_ARRAY)
+ if (expect_type != nullptr && type->code () == TYPE_CODE_ARRAY)
{
struct type *range_type = type->index_type ();
struct type *element_type = type->target_type ();
@@ -2466,24 +2402,22 @@ array_operation::evaluate (struct type *expect_type,
{
struct value *element;
- element = in_args[index - low_bound]->evaluate (element_type,
- exp, noside);
+ element
+ = in_args[index - low_bound]->evaluate (element_type, exp, noside);
if (value_type (element) != element_type)
element = value_cast (element_type, element);
if (index > high_bound)
/* To avoid memory corruption. */
- error (_("Too many array elements"));
+ error (_ ("Too many array elements"));
memcpy (value_contents_raw (array).data ()
- + (index - low_bound) * element_size,
- value_contents (element).data (),
- element_size);
+ + (index - low_bound) * element_size,
+ value_contents (element).data (), element_size);
index++;
}
return array;
}
- if (expect_type != nullptr
- && type->code () == TYPE_CODE_SET)
+ if (expect_type != nullptr && type->code () == TYPE_CODE_SET)
{
struct value *set = allocate_value (expect_type);
gdb_byte *valaddr = value_contents_raw (set).data ();
@@ -2497,7 +2431,7 @@ array_operation::evaluate (struct type *expect_type,
check_type = check_type->target_type ();
if (!get_discrete_bounds (element_type, &low_bound, &high_bound))
- error (_("(power)set type with unknown size"));
+ error (_ ("(power)set type with unknown size"));
memset (valaddr, '\0', type->length ());
int idx = 0;
for (tem = 0; tem < nargs; tem++)
@@ -2521,18 +2455,18 @@ array_operation::evaluate (struct type *expect_type,
|| (range_low_type->code () == TYPE_CODE_ENUM
&& (range_low_type != range_high_type)))
/* different element modes. */
- error (_("POWERSET tuple elements of different mode"));
+ error (_ ("POWERSET tuple elements of different mode"));
if ((check_type->code () != range_low_type->code ())
|| (check_type->code () == TYPE_CODE_ENUM
&& range_low_type != check_type))
- error (_("incompatible POWERSET tuple elements"));
+ error (_ ("incompatible POWERSET tuple elements"));
if (range_low > range_high)
{
- warning (_("empty POWERSET tuple range"));
+ warning (_ ("empty POWERSET tuple range"));
continue;
}
if (range_low < low_bound || range_high > high_bound)
- error (_("POWERSET tuple element out of range"));
+ error (_ ("POWERSET tuple element out of range"));
range_low -= low_bound;
range_high -= low_bound;
for (; range_low <= range_high; range_low++)
@@ -2541,8 +2475,8 @@ array_operation::evaluate (struct type *expect_type,
if (gdbarch_byte_order (exp->gdbarch) == BFD_ENDIAN_BIG)
bit_index = TARGET_CHAR_BIT - 1 - bit_index;
- valaddr[(unsigned) range_low / TARGET_CHAR_BIT]
- |= 1 << bit_index;
+ valaddr[(unsigned) range_low / TARGET_CHAR_BIT] |= 1
+ << bit_index;
}
}
return set;
@@ -2560,23 +2494,21 @@ array_operation::evaluate (struct type *expect_type,
value *
unop_extract_operation::evaluate (struct type *expect_type,
- struct expression *exp,
- enum noside noside)
+ struct expression *exp, enum noside noside)
{
value *old_value = std::get<0> (m_storage)->evaluate (nullptr, exp, noside);
struct type *type = get_type ();
if (type->length () > value_type (old_value)->length ())
- error (_("length type is larger than the value type"));
+ error (_ ("length type is larger than the value type"));
struct value *result = allocate_value (type);
value_contents_copy (result, 0, old_value, 0, type->length ());
return result;
}
-}
+} // namespace expr
-
/* Helper for evaluate_subexp_for_address. */
static value *
@@ -2590,12 +2522,12 @@ evaluate_subexp_for_address_base (struct expression *exp, enum noside noside,
if (TYPE_IS_REFERENCE (type))
return value_zero (lookup_pointer_type (type->target_type ()),
not_lval);
- else if (VALUE_LVAL (x) == lval_memory || value_must_coerce_to_target (x))
- return value_zero (lookup_pointer_type (value_type (x)),
- not_lval);
+ else if (VALUE_LVAL (x) == lval_memory
+ || value_must_coerce_to_target (x))
+ return value_zero (lookup_pointer_type (value_type (x)), not_lval);
else
- error (_("Attempt to take address of "
- "value not located in memory."));
+ error (_ ("Attempt to take address of "
+ "value not located in memory."));
}
return value_addr (x);
}
@@ -2604,8 +2536,7 @@ namespace expr
{
value *
-operation::evaluate_for_cast (struct type *expect_type,
- struct expression *exp,
+operation::evaluate_for_cast (struct type *expect_type, struct expression *exp,
enum noside noside)
{
value *val = evaluate (expect_type, exp, noside);
@@ -2623,11 +2554,11 @@ value *
scope_operation::evaluate_for_address (struct expression *exp,
enum noside noside)
{
- value *x = value_aggregate_elt (std::get<0> (m_storage),
- std::get<1> (m_storage).c_str (),
- NULL, 1, noside);
+ value *x
+ = value_aggregate_elt (std::get<0> (m_storage),
+ std::get<1> (m_storage).c_str (), NULL, 1, noside);
if (x == NULL)
- error (_("There is no field named %s"), std::get<1> (m_storage).c_str ());
+ error (_ ("There is no field named %s"), std::get<1> (m_storage).c_str ());
return x;
}
@@ -2697,10 +2628,9 @@ var_value_operation::evaluate_for_address (struct expression *exp,
struct type *type = lookup_pointer_type (var->type ());
enum address_class sym_class = var->aclass ();
- if (sym_class == LOC_CONST
- || sym_class == LOC_CONST_BYTES
+ if (sym_class == LOC_CONST || sym_class == LOC_CONST_BYTES
|| sym_class == LOC_REGISTER)
- error (_("Attempt to take address of register or constant."));
+ error (_ ("Attempt to take address of register or constant."));
return value_zero (type, not_lval);
}
@@ -2714,18 +2644,17 @@ var_value_operation::evaluate_with_coercion (struct expression *exp,
{
struct symbol *var = std::get<0> (m_storage).symbol;
struct type *type = check_typedef (var->type ());
- if (type->code () == TYPE_CODE_ARRAY
- && !type->is_vector ()
+ if (type->code () == TYPE_CODE_ARRAY && !type->is_vector ()
&& CAST_IS_CONVERSION (exp->language_defn))
{
- struct value *val = address_of_variable (var,
- std::get<0> (m_storage).block);
+ struct value *val
+ = address_of_variable (var, std::get<0> (m_storage).block);
return value_cast (lookup_pointer_type (type->target_type ()), val);
}
return evaluate (nullptr, exp, noside);
}
-}
+} // namespace expr
/* Helper function for evaluating the size of a type. */
@@ -2794,8 +2723,8 @@ subscript_operation::evaluate_for_sizeof (struct expression *exp,
/* FIXME: This should be size_t. */
struct type *size_type
= builtin_type (exp->gdbarch)->builtin_int;
- return value_from_longest
- (size_type, (LONGEST) value_type (val)->length ());
+ return value_from_longest (
+ size_type, (LONGEST) value_type (val)->length ());
}
}
}
@@ -2811,9 +2740,8 @@ unop_ind_base_operation::evaluate_for_sizeof (struct expression *exp,
value *val = std::get<0> (m_storage)->evaluate (nullptr, exp,
EVAL_AVOID_SIDE_EFFECTS);
struct type *type = check_typedef (value_type (val));
- if (!type->is_pointer_or_reference ()
- && type->code () != TYPE_CODE_ARRAY)
- error (_("Attempt to take contents of a non-pointer value."));
+ if (!type->is_pointer_or_reference () && type->code () != TYPE_CODE_ARRAY)
+ error (_ ("Attempt to take contents of a non-pointer value."));
type = type->target_type ();
if (is_dynamic_type (type))
type = value_type (value_ind (val));
@@ -2889,8 +2817,7 @@ var_value_operation::evaluate_for_cast (struct type *to_type,
struct expression *exp,
enum noside noside)
{
- value *val = evaluate_var_value (noside,
- std::get<0> (m_storage).block,
+ value *val = evaluate_var_value (noside, std::get<0> (m_storage).block,
std::get<0> (m_storage).symbol);
val = value_cast (to_type, val);
@@ -2905,7 +2832,7 @@ var_value_operation::evaluate_for_cast (struct type *to_type,
return val;
}
-}
+} // namespace expr
/* Parse a type expression in the string [P..P+LENGTH). */
@@ -2923,6 +2850,6 @@ parse_and_eval_type (const char *p, int length)
expr::unop_cast_operation *op
= dynamic_cast<expr::unop_cast_operation *> (expr->op.get ());
if (op == nullptr)
- error (_("Internal error in eval_type."));
+ error (_ ("Internal error in eval_type."));
return op->get_type ();
}
diff --git a/gdb/event-top.c b/gdb/event-top.c
index 14984707df1..85fa0573736 100644
--- a/gdb/event-top.c
+++ b/gdb/event-top.c
@@ -29,11 +29,11 @@
#include "event-top.h"
#include "interps.h"
#include <signal.h>
-#include "cli/cli-script.h" /* for reset_command_nest_depth */
+#include "cli/cli-script.h" /* for reset_command_nest_depth */
#include "main.h"
#include "gdbthread.h"
#include "observable.h"
-#include "gdbcmd.h" /* for dont_repeat() */
+#include "gdbcmd.h" /* for dont_repeat() */
#include "annotate.h"
#include "maint.h"
#include "gdbsupport/buffer.h"
@@ -67,7 +67,7 @@ static void handle_sighup (int sig);
/* Functions to be invoked by the event loop in response to
signals. */
-#if defined (SIGQUIT) || defined (SIGHUP)
+#if defined(SIGQUIT) || defined(SIGHUP)
static void async_do_nothing (gdb_client_data);
#endif
#ifdef SIGHUP
@@ -112,7 +112,7 @@ static void
show_bt_on_fatal_signal (struct ui_file *file, int from_tty,
struct cmd_list_element *cmd, const char *value)
{
- gdb_printf (file, _("Backtrace on a fatal signal is %s.\n"), value);
+ gdb_printf (file, _ ("Backtrace on a fatal signal is %s.\n"), value);
}
/* Signal handling variables. */
@@ -136,7 +136,6 @@ static struct async_signal_handler *async_sigterm_token;
/* This hook is called by gdb_rl_callback_read_char_wrapper after each
character is processed. */
void (*after_char_processing_hook) (void);
-
/* Wrapper function for calling into the readline library. This takes
care of a couple things:
@@ -188,31 +187,31 @@ gdb_rl_callback_read_char_wrapper_noexcept () noexcept
ABIs). So we instead wrap the readline call with a sjlj-based
TRY/CATCH, and rethrow the GDB exception once back in GDB. */
TRY_SJLJ
- {
- rl_callback_read_char ();
+ {
+ rl_callback_read_char ();
#if RL_VERSION_MAJOR >= 8
- /* It can happen that readline (while in rl_callback_read_char)
+ /* It can happen that readline (while in rl_callback_read_char)
received a signal, but didn't handle it yet. Make sure it's handled
now. If we don't do that we run into two related problems:
- we have to wait for another event triggering
rl_callback_read_char before the signal is handled
- there's no guarantee that the signal will be processed before the
event. */
- while (rl_pending_signal () != 0)
- /* Do this in a while loop, in case rl_check_signals also leaves a
+ while (rl_pending_signal () != 0)
+ /* Do this in a while loop, in case rl_check_signals also leaves a
pending signal. I'm not sure if that's possible, but it seems
better to handle the scenario than to assert. */
- rl_check_signals ();
+ rl_check_signals ();
#else
- /* Unfortunately, rl_check_signals is not available. */
+ /* Unfortunately, rl_check_signals is not available. */
#endif
- if (after_char_processing_hook)
- (*after_char_processing_hook) ();
- }
+ if (after_char_processing_hook)
+ (*after_char_processing_hook) ();
+ }
CATCH_SJLJ (ex, RETURN_MASK_ALL)
- {
- gdb_expt = std::move (ex);
- }
+ {
+ gdb_expt = std::move (ex);
+ }
END_CATCH_SJLJ
return gdb_expt;
@@ -398,12 +397,12 @@ display_gdb_prompt (const char *new_prompt)
/* Do not call the python hook on an explicit prompt change as
passed to this function, as this forms a secondary/local prompt,
IE, displayed but not set. */
- if (! new_prompt)
+ if (!new_prompt)
{
struct ui *ui = current_ui;
if (ui->prompt_state == PROMPTED)
- internal_error (_("double prompt"));
+ internal_error (_ ("double prompt"));
else if (ui->prompt_state == PROMPT_BLOCKED)
{
/* This is to trick readline into not trying to display the
@@ -515,7 +514,7 @@ stdin_event_handler (int error, gdb_client_data client_data)
if (main_ui == ui)
{
/* If stdin died, we may as well kill gdb. */
- gdb_printf (gdb_stderr, _("error detected on stdin\n"));
+ gdb_printf (gdb_stderr, _ ("error detected on stdin\n"));
quit_command ((char *) 0, 0);
}
else
@@ -595,7 +594,6 @@ async_disable_stdin (void)
ui->prompt_state = PROMPT_BLOCKED;
ui->unregister_file_handler ();
}
-
/* Handle a gdb command line. This function is called when
handle_line_of_input has concatenated one or more input lines into
@@ -670,8 +668,7 @@ command_line_append_input_line (std::string &cmd_line_buffer, const char *rl)
*/
const char *
-handle_line_of_input (std::string &cmd_line_buffer,
- const char *rl, int repeat,
+handle_line_of_input (std::string &cmd_line_buffer, const char *rl, int repeat,
const char *annotation_suffix)
{
struct ui *ui = current_ui;
@@ -688,7 +685,8 @@ handle_line_of_input (std::string &cmd_line_buffer,
printf_unfiltered (("\n\032\032post-%s\n"), annotation_suffix);
#define SERVER_COMMAND_PREFIX "server "
- server_command = startswith (cmd_line_buffer.c_str (), SERVER_COMMAND_PREFIX);
+ server_command
+ = startswith (cmd_line_buffer.c_str (), SERVER_COMMAND_PREFIX);
if (server_command)
{
/* Note that we don't call `save_command_line'. Between this
@@ -737,7 +735,8 @@ handle_line_of_input (std::string &cmd_line_buffer,
and then later fetch it from the value history and remove the
'#'. The kill ring is probably better, but some people are in
the habit of commenting things out. */
- if (cmd_line_buffer[0] != '\0' && from_tty && current_ui->input_interactive_p ())
+ if (cmd_line_buffer[0] != '\0' && from_tty
+ && current_ui->input_interactive_p ())
gdb_add_history (cmd_line_buffer.c_str ());
/* Save into global buffer if appropriate. */
@@ -851,7 +850,10 @@ command_line_handler (gdb::unique_xmalloc_ptr<char> &&rl)
ui->prompt_state = PROMPT_NEEDED;
/* Ensure the UI's line buffer is empty for the next command. */
- SCOPE_EXIT { line_buffer.clear (); };
+ SCOPE_EXIT
+ {
+ line_buffer.clear ();
+ };
command_handler (cmd);
@@ -920,7 +922,6 @@ gdb_readline_no_editing_callback (gdb_client_data client_data)
result = buffer_finish (&line_buffer);
ui->input_handler (gdb::unique_xmalloc_ptr<char> (result));
}
-
/* Attempt to unblock signal SIG, return true if the signal was unblocked,
otherwise, return false. */
@@ -949,27 +950,26 @@ handle_fatal_signal (int sig)
#endif
#ifdef GDB_PRINT_INTERNAL_BACKTRACE
- const auto sig_write = [] (const char *msg) -> void
- {
+ const auto sig_write = [] (const char *msg) -> void {
gdb_stderr->write_async_safe (msg, strlen (msg));
};
if (bt_on_fatal_signal)
{
sig_write ("\n\n");
- sig_write (_("Fatal signal: "));
+ sig_write (_ ("Fatal signal: "));
sig_write (strsignal (sig));
sig_write ("\n");
gdb_internal_backtrace ();
- sig_write (_("A fatal error internal to GDB has been detected, "
- "further\ndebugging is not possible. GDB will now "
- "terminate.\n\n"));
- sig_write (_("This is a bug, please report it."));
+ sig_write (_ ("A fatal error internal to GDB has been detected, "
+ "further\ndebugging is not possible. GDB will now "
+ "terminate.\n\n"));
+ sig_write (_ ("This is a bug, please report it."));
if (REPORT_BUGS_TO[0] != '\0')
{
- sig_write (_(" For instructions, see:\n"));
+ sig_write (_ (" For instructions, see:\n"));
sig_write (REPORT_BUGS_TO);
sig_write (".");
}
@@ -982,15 +982,14 @@ handle_fatal_signal (int sig)
/* If possible arrange for SIG to have its default behaviour (which
should be to terminate the current process), unblock SIG, and reraise
the signal. This ensures GDB terminates with the expected signal. */
- if (signal (sig, SIG_DFL) != SIG_ERR
- && unblock_signal (sig))
+ if (signal (sig, SIG_DFL) != SIG_ERR && unblock_signal (sig))
raise (sig);
- /* The above failed, so try to use SIGABRT to terminate GDB. */
+ /* The above failed, so try to use SIGABRT to terminate GDB. */
#ifdef SIGABRT
signal (SIGABRT, SIG_DFL);
#endif
- abort (); /* ARI: abort */
+ abort (); /* ARI: abort */
}
/* The SIGSEGV handler for this thread, or NULL if there is none. GDB
@@ -1011,7 +1010,7 @@ static void handle_sigsegv (int sig);
static void
install_handle_sigsegv ()
{
-#if defined (HAVE_SIGACTION)
+#if defined(HAVE_SIGACTION)
struct sigaction sa;
sa.sa_handler = handle_sigsegv;
sigemptyset (&sa.sa_mask);
@@ -1038,8 +1037,6 @@ handle_sigsegv (int sig)
thread_local_segv_handler (sig);
}
-
-
/* The serial event associated with the QUIT flag. set_quit_flag sets
this, and check_quit_flag clears it. Used by interruptible_select
to be able to do interruptible I/O with no race with the SIGINT
@@ -1069,8 +1066,8 @@ gdb_init_signals (void)
quit_serial_event = make_serial_event ();
- sigint_token =
- create_async_signal_handler (async_request_quit, NULL, "sigint");
+ sigint_token
+ = create_async_signal_handler (async_request_quit, NULL, "sigint");
install_sigint_handler (handle_sigint);
async_sigterm_token
@@ -1078,23 +1075,23 @@ gdb_init_signals (void)
signal (SIGTERM, handle_sigterm);
#ifdef SIGQUIT
- sigquit_token =
- create_async_signal_handler (async_do_nothing, NULL, "sigquit");
+ sigquit_token
+ = create_async_signal_handler (async_do_nothing, NULL, "sigquit");
signal (SIGQUIT, handle_sigquit);
#endif
#ifdef SIGHUP
if (signal (SIGHUP, handle_sighup) != SIG_IGN)
- sighup_token =
- create_async_signal_handler (async_disconnect, NULL, "sighup");
+ sighup_token
+ = create_async_signal_handler (async_disconnect, NULL, "sighup");
else
- sighup_token =
- create_async_signal_handler (async_do_nothing, NULL, "sighup");
+ sighup_token
+ = create_async_signal_handler (async_do_nothing, NULL, "sighup");
#endif
#ifdef SIGTSTP
- sigtstp_token =
- create_async_signal_handler (async_sigtstp_handler, NULL, "sigtstp");
+ sigtstp_token
+ = create_async_signal_handler (async_sigtstp_handler, NULL, "sigtstp");
#endif
#ifdef SIGFPE
@@ -1175,9 +1172,8 @@ handle_sigint (int sig)
/* See gdb_select.h. */
int
-interruptible_select (int n,
- fd_set *readfds, fd_set *writefds, fd_set *exceptfds,
- struct timeval *timeout)
+interruptible_select (int n, fd_set *readfds, fd_set *writefds,
+ fd_set *exceptfds, struct timeval *timeout)
{
fd_set my_readfds;
int fd;
@@ -1254,7 +1250,7 @@ handle_sigquit (int sig)
}
#endif
-#if defined (SIGQUIT) || defined (SIGHUP)
+#if defined(SIGQUIT) || defined(SIGHUP)
/* Called by the event loop in response to a SIGQUIT or an
ignored SIGHUP. */
static void
@@ -1278,7 +1274,6 @@ handle_sighup (int sig)
static void
async_disconnect (gdb_client_data arg)
{
-
try
{
quit_cover ();
@@ -1286,8 +1281,7 @@ async_disconnect (gdb_client_data arg)
catch (const gdb_exception &exception)
{
- gdb_puts ("Could not kill the program being debugged",
- gdb_stderr);
+ gdb_puts ("Could not kill the program being debugged", gdb_stderr);
exception_print (gdb_stderr, exception);
}
@@ -1302,7 +1296,7 @@ async_disconnect (gdb_client_data arg)
}
}
- signal (SIGHUP, SIG_DFL); /*FIXME: ??????????? */
+ signal (SIGHUP, SIG_DFL); /*FIXME: ??????????? */
raise (SIGHUP);
}
#endif
@@ -1333,8 +1327,6 @@ async_sigtstp_handler (gdb_client_data arg)
}
#endif /* SIGTSTP */
-
-
/* Set things up for readline to be invoked via the alternate
interface, i.e. via a callback function
(gdb_rl_callback_read_char), and hook up instream to the event
@@ -1349,8 +1341,8 @@ gdb_setup_readline (int editing)
However, that is only allowed on the main UI, as we can only have
one instance of readline. Also, INSTREAM might be nullptr when
executing a user-defined command. */
- if (ui->instream != nullptr && ISATTY (ui->instream)
- && editing && ui == main_ui)
+ if (ui->instream != nullptr && ISATTY (ui->instream) && editing
+ && ui == main_ui)
{
/* Tell gdb that we will be using the readline library. This
could be overwritten by a command in .gdbinit like 'set
@@ -1391,13 +1383,14 @@ gdb_disable_readline (void)
ui->unregister_file_handler ();
}
-scoped_segv_handler_restore::scoped_segv_handler_restore (segv_handler_t new_handler)
+scoped_segv_handler_restore::scoped_segv_handler_restore (
+ segv_handler_t new_handler)
{
m_old_handler = thread_local_segv_handler;
thread_local_segv_handler = new_handler;
}
-scoped_segv_handler_restore::~scoped_segv_handler_restore()
+scoped_segv_handler_restore::~scoped_segv_handler_restore ()
{
thread_local_segv_handler = m_old_handler;
}
@@ -1406,12 +1399,9 @@ static const char debug_event_loop_off[] = "off";
static const char debug_event_loop_all_except_ui[] = "all-except-ui";
static const char debug_event_loop_all[] = "all";
-static const char *debug_event_loop_enum[] = {
- debug_event_loop_off,
- debug_event_loop_all_except_ui,
- debug_event_loop_all,
- nullptr
-};
+static const char *debug_event_loop_enum[]
+ = { debug_event_loop_off, debug_event_loop_all_except_ui,
+ debug_event_loop_all, nullptr };
static const char *debug_event_loop_value = debug_event_loop_off;
@@ -1433,34 +1423,34 @@ static void
show_debug_event_loop_command (struct ui_file *file, int from_tty,
struct cmd_list_element *cmd, const char *value)
{
- gdb_printf (file, _("Event loop debugging is %s.\n"), value);
+ gdb_printf (file, _ ("Event loop debugging is %s.\n"), value);
}
void _initialize_event_top ();
+
void
_initialize_event_top ()
{
- add_setshow_enum_cmd ("event-loop", class_maintenance,
- debug_event_loop_enum,
+ add_setshow_enum_cmd ("event-loop", class_maintenance, debug_event_loop_enum,
&debug_event_loop_value,
- _("Set event-loop debugging."),
- _("Show event-loop debugging."),
- _("\
+ _ ("Set event-loop debugging."),
+ _ ("Show event-loop debugging."), _ ("\
Control whether to show event loop-related debug messages."),
set_debug_event_loop_command,
- show_debug_event_loop_command,
- &setdebuglist, &showdebuglist);
+ show_debug_event_loop_command, &setdebuglist,
+ &showdebuglist);
add_setshow_boolean_cmd ("backtrace-on-fatal-signal", class_maintenance,
- &bt_on_fatal_signal, _("\
-Set whether to produce a backtrace if GDB receives a fatal signal."), _("\
-Show whether GDB will produce a backtrace if it receives a fatal signal."), _("\
+ &bt_on_fatal_signal, _ ("\
+Set whether to produce a backtrace if GDB receives a fatal signal."),
+ _ ("\
+Show whether GDB will produce a backtrace if it receives a fatal signal."),
+ _ ("\
Use \"on\" to enable, \"off\" to disable.\n\
If enabled, GDB will produce a minimal backtrace if it encounters a fatal\n\
signal from within GDB itself. This is a mechanism to help diagnose\n\
crashes within GDB, not a mechanism for debugging inferiors."),
gdb_internal_backtrace_set_cmd,
- show_bt_on_fatal_signal,
- &maintenance_set_cmdlist,
+ show_bt_on_fatal_signal, &maintenance_set_cmdlist,
&maintenance_show_cmdlist);
}
diff --git a/gdb/event-top.h b/gdb/event-top.h
index f7247f5c4f2..189877b2d10 100644
--- a/gdb/event-top.h
+++ b/gdb/event-top.h
@@ -82,11 +82,13 @@ typedef void (*segv_handler_t) (int);
original one. */
class scoped_segv_handler_restore
{
- public:
+public:
+
scoped_segv_handler_restore (segv_handler_t new_handler);
~scoped_segv_handler_restore ();
- private:
+private:
+
segv_handler_t m_old_handler;
};
diff --git a/gdb/exceptions.c b/gdb/exceptions.c
index 4ab8dce58de..2474d103a80 100644
--- a/gdb/exceptions.c
+++ b/gdb/exceptions.c
@@ -83,7 +83,7 @@ print_exception (struct ui_file *file, const struct gdb_exception &e)
end++;
file->write (start, end - start);
}
- }
+ }
gdb_printf (file, "\n");
/* Now append the annotation. */
@@ -97,7 +97,7 @@ print_exception (struct ui_file *file, const struct gdb_exception &e)
annotate_error ();
break;
default:
- internal_error (_("Bad switch."));
+ internal_error (_ ("Bad switch."));
}
}
diff --git a/gdb/exceptions.h b/gdb/exceptions.h
index 0ef959ef06b..59c39149c18 100644
--- a/gdb/exceptions.h
+++ b/gdb/exceptions.h
@@ -28,7 +28,7 @@ extern void exception_print (struct ui_file *file,
const struct gdb_exception &e);
extern void exception_fprintf (struct ui_file *file,
const struct gdb_exception &e,
- const char *prefix,
- ...) ATTRIBUTE_PRINTF (3, 4);
+ const char *prefix, ...)
+ ATTRIBUTE_PRINTF (3, 4);
#endif
diff --git a/gdb/exec.c b/gdb/exec.c
index ad543c9fc9e..4a4ade665ab 100644
--- a/gdb/exec.c
+++ b/gdb/exec.c
@@ -53,26 +53,22 @@
void (*deprecated_file_changed_hook) (const char *);
-static const target_info exec_target_info = {
- "exec",
- N_("Local exec file"),
- N_("Use an executable file as a target.\n\
-Specify the filename of the executable file.")
-};
+static const target_info exec_target_info
+ = { "exec", N_ ("Local exec file"),
+ N_ ("Use an executable file as a target.\n\
+Specify the filename of the executable file.") };
/* The target vector for executable files. */
struct exec_target final : public target_ops
{
- const target_info &info () const override
- { return exec_target_info; }
+ const target_info &info () const override { return exec_target_info; }
strata stratum () const override { return file_stratum; }
void close () override;
enum target_xfer_status xfer_partial (enum target_object object,
- const char *annex,
- gdb_byte *readbuf,
+ const char *annex, gdb_byte *readbuf,
const gdb_byte *writebuf,
ULONGEST offset, ULONGEST len,
ULONGEST *xfered_len) override;
@@ -89,11 +85,15 @@ static exec_target exec_ops;
file determined from target. */
static const char *const exec_file_mismatch_names[]
- = {"ask", "warn", "off", NULL };
+ = { "ask", "warn", "off", NULL };
+
enum exec_file_mismatch_mode
- {
- exec_file_mismatch_ask, exec_file_mismatch_warn, exec_file_mismatch_off
- };
+{
+ exec_file_mismatch_ask,
+ exec_file_mismatch_warn,
+ exec_file_mismatch_off
+};
+
static const char *exec_file_mismatch = exec_file_mismatch_names[0];
static enum exec_file_mismatch_mode exec_file_mismatch_mode
= exec_file_mismatch_ask;
@@ -103,19 +103,17 @@ static void
show_exec_file_mismatch_command (struct ui_file *file, int from_tty,
struct cmd_list_element *c, const char *value)
{
- gdb_printf (file,
- _("exec-file-mismatch handling is currently \"%s\".\n"),
+ gdb_printf (file, _ ("exec-file-mismatch handling is currently \"%s\".\n"),
exec_file_mismatch_names[exec_file_mismatch_mode]);
}
/* Set command. Change the setting for range checking. */
static void
-set_exec_file_mismatch_command (const char *ignore,
- int from_tty, struct cmd_list_element *c)
+set_exec_file_mismatch_command (const char *ignore, int from_tty,
+ struct cmd_list_element *c)
{
- for (enum exec_file_mismatch_mode mode = exec_file_mismatch_ask;
- ;
- mode = static_cast<enum exec_file_mismatch_mode>(1 + (int) mode))
+ for (enum exec_file_mismatch_mode mode = exec_file_mismatch_ask;;
+ mode = static_cast<enum exec_file_mismatch_mode> (1 + (int) mode))
{
if (strcmp (exec_file_mismatch, exec_file_mismatch_names[mode]) == 0)
{
@@ -123,7 +121,7 @@ set_exec_file_mismatch_command (const char *ignore,
return;
}
if (mode == exec_file_mismatch_off)
- internal_error (_("Unrecognized exec-file-mismatch setting: \"%s\""),
+ internal_error (_ ("Unrecognized exec-file-mismatch setting: \"%s\""),
exec_file_mismatch);
}
}
@@ -131,15 +129,15 @@ set_exec_file_mismatch_command (const char *ignore,
/* Whether to open exec and core files read-only or read-write. */
bool write_files = false;
+
static void
show_write_files (struct ui_file *file, int from_tty,
struct cmd_list_element *c, const char *value)
{
- gdb_printf (file, _("Writing into executable and core files is %s.\n"),
+ gdb_printf (file, _ ("Writing into executable and core files is %s.\n"),
value);
}
-
static void
exec_target_open (const char *args, int from_tty)
{
@@ -257,7 +255,8 @@ validate_exec_file (int from_tty)
if (exec_file_build_id->size == target_exec_file_build_id->size
&& memcmp (exec_file_build_id->data,
target_exec_file_build_id->data,
- exec_file_build_id->size) == 0)
+ exec_file_build_id->size)
+ == 0)
{
/* Match. */
return;
@@ -274,16 +273,17 @@ validate_exec_file (int from_tty)
/* In case the exec file is not local, exec_file_target has to point at
the target file system. */
- if (is_target_filename (current_exec_file) && !target_filesystem_is_local ())
+ if (is_target_filename (current_exec_file)
+ && !target_filesystem_is_local ())
exec_file_target = TARGET_SYSROOT_PREFIX + exec_file_target;
- warning
- (_("Build ID mismatch between current exec-file %ps\n"
- "and automatically determined exec-file %ps\n"
- "exec-file-mismatch handling is currently \"%s\""),
- styled_string (file_name_style.style (), current_exec_file),
- styled_string (file_name_style.style (), exec_file_target.c_str ()),
- exec_file_mismatch_names[exec_file_mismatch_mode]);
+ warning (_ ("Build ID mismatch between current exec-file %ps\n"
+ "and automatically determined exec-file %ps\n"
+ "exec-file-mismatch handling is currently \"%s\""),
+ styled_string (file_name_style.style (), current_exec_file),
+ styled_string (file_name_style.style (),
+ exec_file_target.c_str ()),
+ exec_file_mismatch_names[exec_file_mismatch_mode]);
if (exec_file_mismatch_mode == exec_file_mismatch_ask)
{
symfile_add_flags add_flags = SYMFILE_MAINLINE;
@@ -299,7 +299,7 @@ validate_exec_file (int from_tty)
}
catch (gdb_exception_error &err)
{
- warning (_("loading %ps %s"),
+ warning (_ ("loading %ps %s"),
styled_string (file_name_style.style (),
exec_file_target.c_str ()),
err.message != NULL ? err.what () : "error");
@@ -324,10 +324,10 @@ exec_file_locate_attach (int pid, int defer_bp_reset, int from_tty)
exec_file_target = target_pid_to_exec_file (pid);
if (exec_file_target == NULL)
{
- warning (_("No executable has been specified and target does not "
- "support\n"
- "determining executable automatically. "
- "Try using the \"file\" command."));
+ warning (_ ("No executable has been specified and target does not "
+ "support\n"
+ "determining executable automatically. "
+ "Try using the \"file\" command."));
return;
}
@@ -378,7 +378,7 @@ exec_file_attach (const char *filename, int from_tty)
if (!filename)
{
if (from_tty)
- gdb_printf (_("No executable file now.\n"));
+ gdb_printf (_ ("No executable file now.\n"));
set_gdbarch_from_file (NULL);
}
@@ -402,8 +402,8 @@ exec_file_attach (const char *filename, int from_tty)
{
/* gdb_bfd_fopen does not support "target:" filenames. */
if (write_files)
- warning (_("writing into executable files is "
- "not supported for %s sysroots"),
+ warning (_ ("writing into executable files is "
+ "not supported for %s sysroots"),
TARGET_SYSROOT_PREFIX);
scratch_pathname = filename;
@@ -412,10 +412,10 @@ exec_file_attach (const char *filename, int from_tty)
}
else
{
- scratch_chan = openp (getenv ("PATH"), OPF_TRY_CWD_FIRST,
- filename, write_files ?
- O_RDWR | O_BINARY : O_RDONLY | O_BINARY,
- &scratch_storage);
+ scratch_chan
+ = openp (getenv ("PATH"), OPF_TRY_CWD_FIRST, filename,
+ write_files ? O_RDWR | O_BINARY : O_RDONLY | O_BINARY,
+ &scratch_storage);
#if defined(__GO32__) || defined(_WIN32) || defined(__CYGWIN__)
if (scratch_chan < 0)
{
@@ -423,11 +423,10 @@ exec_file_attach (const char *filename, int from_tty)
char *exename = (char *) alloca (strlen (filename) + 5);
strcat (strcpy (exename, filename), ".exe");
- scratch_chan = openp (getenv ("PATH"), OPF_TRY_CWD_FIRST,
- exename, write_files ?
- O_RDWR | O_BINARY
- : O_RDONLY | O_BINARY,
- &scratch_storage);
+ scratch_chan
+ = openp (getenv ("PATH"), OPF_TRY_CWD_FIRST, exename,
+ write_files ? O_RDWR | O_BINARY : O_RDONLY | O_BINARY,
+ &scratch_storage);
if (scratch_chan < 0)
errno = first_errno;
}
@@ -445,15 +444,15 @@ exec_file_attach (const char *filename, int from_tty)
gdb_bfd_ref_ptr temp;
if (write_files && !load_via_target)
- temp = gdb_bfd_fopen (canonical_pathname, gnutarget,
- FOPEN_RUB, scratch_chan);
+ temp = gdb_bfd_fopen (canonical_pathname, gnutarget, FOPEN_RUB,
+ scratch_chan);
else
temp = gdb_bfd_open (canonical_pathname, gnutarget, scratch_chan);
current_program_space->set_exec_bfd (std::move (temp));
if (!current_program_space->exec_bfd ())
{
- error (_("\"%s\": could not open as an executable file: %s."),
+ error (_ ("\"%s\": could not open as an executable file: %s."),
scratch_pathname, bfd_errmsg (bfd_get_error ()));
}
@@ -461,13 +460,11 @@ exec_file_attach (const char *filename, int from_tty)
filesystem and so cannot be used for "target:" files. */
gdb_assert (current_program_space->exec_filename == nullptr);
if (load_via_target)
- current_program_space->exec_filename
- = (make_unique_xstrdup
- (bfd_get_filename (current_program_space->exec_bfd ())));
+ current_program_space->exec_filename = (make_unique_xstrdup (
+ bfd_get_filename (current_program_space->exec_bfd ())));
else
- current_program_space->exec_filename
- = make_unique_xstrdup (gdb_realpath_keepfile
- (scratch_pathname).c_str ());
+ current_program_space->exec_filename = make_unique_xstrdup (
+ gdb_realpath_keepfile (scratch_pathname).c_str ());
if (!bfd_check_format_matches (current_program_space->exec_bfd (),
bfd_object, &matching))
@@ -475,12 +472,12 @@ exec_file_attach (const char *filename, int from_tty)
/* Make sure to close exec_bfd, or else "run" might try to use
it. */
current_program_space->exec_close ();
- error (_("\"%s\": not in executable format: %s"), scratch_pathname,
+ error (_ ("\"%s\": not in executable format: %s"), scratch_pathname,
gdb_bfd_errmsg (bfd_get_error (), matching).c_str ());
}
- target_section_table sections
- = build_section_table (current_program_space->exec_bfd ());
+ target_section_table sections
+ = build_section_table (current_program_space->exec_bfd ());
current_program_space->ebfd_mtime
= bfd_get_mtime (current_program_space->exec_bfd ());
@@ -516,9 +513,9 @@ static void
exec_file_command (const char *args, int from_tty)
{
if (from_tty && target_has_execution ()
- && !query (_("A program is being debugged already.\n"
- "Are you sure you want to change the file? ")))
- error (_("File not changed."));
+ && !query (_ ("A program is being debugged already.\n"
+ "Are you sure you want to change the file? ")))
+ error (_ ("File not changed."));
if (args)
{
@@ -529,10 +526,11 @@ exec_file_command (const char *args, int from_tty)
char **argv = built_argv.get ();
for (; (*argv != NULL) && (**argv == '-'); argv++)
- {;
+ {
+ ;
}
if (*argv == NULL)
- error (_("No executable file name was specified"));
+ error (_ ("No executable file name was specified"));
gdb::unique_xmalloc_ptr<char> filename (tilde_expand (*argv));
exec_file_attach (filename.get (), from_tty);
@@ -555,7 +553,6 @@ file_command (const char *arg, int from_tty)
if (deprecated_file_changed_hook)
deprecated_file_changed_hook (arg);
}
-
/* Builds a section table, given args BFD, TABLE. */
@@ -636,7 +633,8 @@ program_space::add_target_sections (struct objfile *objfile)
continue;
m_target_sections.emplace_back (osect->addr (), osect->endaddr (),
- osect->the_bfd_section, (void *) objfile);
+ osect->the_bfd_section,
+ (void *) objfile);
}
}
@@ -648,12 +646,11 @@ program_space::remove_target_sections (void *owner)
{
gdb_assert (owner != NULL);
- auto it = std::remove_if (m_target_sections.begin (),
- m_target_sections.end (),
- [&] (target_section &sect)
- {
- return sect.owner == owner;
- });
+ auto it
+ = std::remove_if (m_target_sections.begin (), m_target_sections.end (),
+ [&] (target_section &sect) {
+ return sect.owner == owner;
+ });
m_target_sections.erase (it, m_target_sections.end ());
/* If we don't have any more sections to read memory from,
@@ -683,11 +680,9 @@ exec_on_vfork (inferior *vfork_child)
vfork_child->push_target (&exec_ops);
}
-
-
enum target_xfer_status
-exec_read_partial_read_only (gdb_byte *readbuf, ULONGEST offset,
- ULONGEST len, ULONGEST *xfered_len)
+exec_read_partial_read_only (gdb_byte *readbuf, ULONGEST offset, ULONGEST len,
+ ULONGEST *xfered_len)
{
/* It's unduly pedantic to refuse to look at the executable for
read-only pieces; so do the equivalent of readonly regions aka
@@ -700,8 +695,7 @@ exec_read_partial_read_only (gdb_byte *readbuf, ULONGEST offset,
for (s = current_program_space->exec_bfd ()->sections; s; s = s->next)
{
- if ((s->flags & SEC_LOAD) == 0
- || (s->flags & SEC_READONLY) == 0)
+ if ((s->flags & SEC_LOAD) == 0 || (s->flags & SEC_READONLY) == 0)
continue;
vma = s->vma;
@@ -714,8 +708,9 @@ exec_read_partial_read_only (gdb_byte *readbuf, ULONGEST offset,
if (amt > len)
amt = len;
- amt = bfd_get_section_contents (current_program_space->exec_bfd (), s,
- readbuf, offset - vma, amt);
+ amt
+ = bfd_get_section_contents (current_program_space->exec_bfd (),
+ s, readbuf, offset - vma, amt);
if (amt == 0)
return TARGET_XFER_EOF;
@@ -793,8 +788,7 @@ section_table_read_available_memory (gdb_byte *readbuf, ULONGEST offset,
if (offset >= r.start)
status = exec_read_partial_read_only (readbuf, offset,
- end - offset,
- xfered_len);
+ end - offset, xfered_len);
else
{
*xfered_len = r.start - offset;
@@ -809,12 +803,10 @@ section_table_read_available_memory (gdb_byte *readbuf, ULONGEST offset,
}
enum target_xfer_status
-section_table_xfer_memory_partial (gdb_byte *readbuf, const gdb_byte *writebuf,
- ULONGEST offset, ULONGEST len,
- ULONGEST *xfered_len,
- const target_section_table &sections,
- gdb::function_view<bool
- (const struct target_section *)> match_cb)
+section_table_xfer_memory_partial (
+ gdb_byte *readbuf, const gdb_byte *writebuf, ULONGEST offset, ULONGEST len,
+ ULONGEST *xfered_len, const target_section_table &sections,
+ gdb::function_view<bool (const struct target_section *)> match_cb)
{
int res;
ULONGEST memaddr = offset;
@@ -828,20 +820,18 @@ section_table_xfer_memory_partial (gdb_byte *readbuf, const gdb_byte *writebuf,
bfd *abfd = asect->owner;
if (match_cb != nullptr && !match_cb (&p))
- continue; /* not the section we need. */
+ continue; /* not the section we need. */
if (memaddr >= p.addr)
{
if (memend <= p.endaddr)
{
/* Entire transfer is within this section. */
if (writebuf)
- res = bfd_set_section_contents (abfd, asect,
- writebuf, memaddr - p.addr,
- len);
+ res = bfd_set_section_contents (abfd, asect, writebuf,
+ memaddr - p.addr, len);
else
- res = bfd_get_section_contents (abfd, asect,
- readbuf, memaddr - p.addr,
- len);
+ res = bfd_get_section_contents (abfd, asect, readbuf,
+ memaddr - p.addr, len);
if (res != 0)
{
@@ -861,13 +851,11 @@ section_table_xfer_memory_partial (gdb_byte *readbuf, const gdb_byte *writebuf,
/* This section overlaps the transfer. Just do half. */
len = p.endaddr - memaddr;
if (writebuf)
- res = bfd_set_section_contents (abfd, asect,
- writebuf, memaddr - p.addr,
- len);
+ res = bfd_set_section_contents (abfd, asect, writebuf,
+ memaddr - p.addr, len);
else
- res = bfd_get_section_contents (abfd, asect,
- readbuf, memaddr - p.addr,
- len);
+ res = bfd_get_section_contents (abfd, asect, readbuf,
+ memaddr - p.addr, len);
if (res != 0)
{
*xfered_len = len;
@@ -879,25 +867,22 @@ section_table_xfer_memory_partial (gdb_byte *readbuf, const gdb_byte *writebuf,
}
}
- return TARGET_XFER_EOF; /* We can't help. */
+ return TARGET_XFER_EOF; /* We can't help. */
}
enum target_xfer_status
-exec_target::xfer_partial (enum target_object object,
- const char *annex, gdb_byte *readbuf,
- const gdb_byte *writebuf,
+exec_target::xfer_partial (enum target_object object, const char *annex,
+ gdb_byte *readbuf, const gdb_byte *writebuf,
ULONGEST offset, ULONGEST len, ULONGEST *xfered_len)
{
const target_section_table *table = target_get_section_table (this);
if (object == TARGET_OBJECT_MEMORY)
- return section_table_xfer_memory_partial (readbuf, writebuf,
- offset, len, xfered_len,
- *table);
+ return section_table_xfer_memory_partial (readbuf, writebuf, offset, len,
+ xfered_len, *table);
else
return TARGET_XFER_E_IO;
}
-
void
print_section_info (const target_section_table *t, bfd *abfd)
@@ -906,11 +891,10 @@ print_section_info (const target_section_table *t, bfd *abfd)
/* FIXME: 16 is not wide enough when gdbarch_addr_bit > 64. */
int wid = gdbarch_addr_bit (gdbarch) <= 32 ? 8 : 16;
- gdb_printf ("\t`%ps', ",
- styled_string (file_name_style.style (),
- bfd_get_filename (abfd)));
+ gdb_printf ("\t`%ps', ", styled_string (file_name_style.style (),
+ bfd_get_filename (abfd)));
gdb_stdout->wrap_here (8);
- gdb_printf (_("file type %s.\n"), bfd_get_target (abfd));
+ gdb_printf (_ ("file type %s.\n"), bfd_get_target (abfd));
if (abfd == current_program_space->exec_bfd ())
{
/* gcc-3.4 does not like the initialization in
@@ -928,8 +912,8 @@ print_section_info (const target_section_table *t, bfd *abfd)
continue;
if (bfd_section_vma (psect) <= abfd->start_address
- && abfd->start_address < (bfd_section_vma (psect)
- + bfd_section_size (psect)))
+ && abfd->start_address
+ < (bfd_section_vma (psect) + bfd_section_size (psect)))
{
displacement = p.addr - bfd_section_vma (psect);
found = true;
@@ -937,15 +921,14 @@ print_section_info (const target_section_table *t, bfd *abfd)
}
}
if (!found)
- warning (_("Cannot find section for the entry point of %ps."),
+ warning (_ ("Cannot find section for the entry point of %ps."),
styled_string (file_name_style.style (),
bfd_get_filename (abfd)));
- entry_point = gdbarch_addr_bits_remove (gdbarch,
- bfd_get_start_address (abfd)
- + displacement);
- gdb_printf (_("\tEntry point: %s\n"),
- paddress (gdbarch, entry_point));
+ entry_point
+ = gdbarch_addr_bits_remove (gdbarch, bfd_get_start_address (abfd)
+ + displacement);
+ gdb_printf (_ ("\tEntry point: %s\n"), paddress (gdbarch, entry_point));
}
for (const target_section &p : *t)
{
@@ -962,13 +945,11 @@ print_section_info (const target_section_table *t, bfd *abfd)
format string accordingly. */
/* FIXME: i18n: Need to rewrite this sentence. */
if (info_verbose)
- gdb_printf (" @ %s",
- hex_string_custom (psect->filepos, 8));
+ gdb_printf (" @ %s", hex_string_custom (psect->filepos, 8));
gdb_printf (" is %s", bfd_section_name (psect));
if (pbfd != abfd)
- gdb_printf (" in %ps",
- styled_string (file_name_style.style (),
- bfd_get_filename (pbfd)));
+ gdb_printf (" in %ps", styled_string (file_name_style.style (),
+ bfd_get_filename (pbfd)));
gdb_printf ("\n");
}
}
@@ -980,7 +961,7 @@ exec_target::files_info ()
print_section_info (&current_program_space->target_sections (),
current_program_space->exec_bfd ());
else
- gdb_puts (_("\t<no file loaded>\n"));
+ gdb_puts (_ ("\t<no file loaded>\n"));
}
static void
@@ -989,10 +970,11 @@ set_section_command (const char *args, int from_tty)
const char *secname;
if (args == 0)
- error (_("Must specify section name and its virtual address"));
+ error (_ ("Must specify section name and its virtual address"));
/* Parse out section name. */
- for (secname = args; !isspace (*args); args++);
+ for (secname = args; !isspace (*args); args++)
+ ;
unsigned seclen = args - secname;
/* Parse out new virtual address. */
@@ -1013,7 +995,7 @@ set_section_command (const char *args, int from_tty)
}
std::string secprint (secname, seclen);
- error (_("Section %s not found"), secprint.c_str ());
+ error (_ ("Section %s not found"), secprint.c_str ());
}
/* If we can find a section in FILENAME with BFD index INDEX, adjust
@@ -1024,8 +1006,8 @@ exec_set_section_address (const char *filename, int index, CORE_ADDR address)
{
for (target_section &p : current_program_space->target_sections ())
{
- if (filename_cmp (filename,
- bfd_get_filename (p.the_bfd_section->owner)) == 0
+ if (filename_cmp (filename, bfd_get_filename (p.the_bfd_section->owner))
+ == 0
&& index == p.the_bfd_section->index)
{
p.endaddr += address - p.addr;
@@ -1045,7 +1027,7 @@ exec_target::has_memory ()
gdb::unique_xmalloc_ptr<char>
exec_target::make_corefile_notes (bfd *obfd, int *note_size)
{
- error (_("Can't create a corefile"));
+ error (_ ("Can't create a corefile"));
}
int
@@ -1055,49 +1037,49 @@ exec_target::find_memory_regions (find_memory_region_ftype func, void *data)
}
void _initialize_exec ();
+
void
_initialize_exec ()
{
struct cmd_list_element *c;
- c = add_cmd ("file", class_files, file_command, _("\
+ c = add_cmd ("file", class_files, file_command, _ ("\
Use FILE as program to be debugged.\n\
It is read for its symbols, for getting the contents of pure memory,\n\
and it is the program executed when you use the `run' command.\n\
If FILE cannot be found as specified, your execution directory path\n\
($PATH) is searched for a command of that name.\n\
-No arg means to have no executable file and no symbols."), &cmdlist);
+No arg means to have no executable file and no symbols."),
+ &cmdlist);
set_cmd_completer (c, filename_completer);
- c = add_cmd ("exec-file", class_files, exec_file_command, _("\
+ c = add_cmd ("exec-file", class_files, exec_file_command, _ ("\
Use FILE as program for getting contents of pure memory.\n\
If FILE cannot be found as specified, your execution directory path\n\
is searched for a command of that name.\n\
-No arg means have no executable file."), &cmdlist);
+No arg means have no executable file."),
+ &cmdlist);
set_cmd_completer (c, filename_completer);
- add_com ("section", class_files, set_section_command, _("\
+ add_com ("section", class_files, set_section_command, _ ("\
Change the base address of section SECTION of the exec file to ADDR.\n\
This can be used if the exec file does not contain section addresses,\n\
(such as in the a.out format), or when the addresses specified in the\n\
file itself are wrong. Each section must be changed separately. The\n\
``info files'' command lists all the sections and their addresses."));
- add_setshow_boolean_cmd ("write", class_support, &write_files, _("\
-Set writing into executable and core files."), _("\
-Show writing into executable and core files."), NULL,
- NULL,
- show_write_files,
- &setlist, &showlist);
+ add_setshow_boolean_cmd ("write", class_support, &write_files, _ ("\
+Set writing into executable and core files."),
+ _ ("\
+Show writing into executable and core files."),
+ NULL, NULL, show_write_files, &setlist, &showlist);
add_setshow_enum_cmd ("exec-file-mismatch", class_support,
- exec_file_mismatch_names,
- &exec_file_mismatch,
- _("\
+ exec_file_mismatch_names, &exec_file_mismatch, _ ("\
Set exec-file-mismatch handling (ask|warn|off)."),
- _("\
+ _ ("\
Show exec-file-mismatch handling (ask|warn|off)."),
- _("\
+ _ ("\
Specifies how to handle a mismatch between the current exec-file\n\
loaded by GDB and the exec-file automatically determined when attaching\n\
to a process:\n\n\
@@ -1109,8 +1091,7 @@ GDB detects a mismatch by comparing the build IDs of the files.\n\
If the user confirms loading the determined exec-file, then its symbols\n\
will be loaded as well."),
set_exec_file_mismatch_command,
- show_exec_file_mismatch_command,
- &setlist, &showlist);
+ show_exec_file_mismatch_command, &setlist, &showlist);
add_target (exec_target_info, exec_target_open, filename_completer);
}
diff --git a/gdb/exec.h b/gdb/exec.h
index 200a5c69265..26f02c7e614 100644
--- a/gdb/exec.h
+++ b/gdb/exec.h
@@ -46,8 +46,8 @@ extern void exec_on_vfork (inferior *vfork_child);
otherwise. */
extern enum target_xfer_status
- exec_read_partial_read_only (gdb_byte *readbuf, ULONGEST offset,
- ULONGEST len, ULONGEST *xfered_len);
+exec_read_partial_read_only (gdb_byte *readbuf, ULONGEST offset, ULONGEST len,
+ ULONGEST *xfered_len);
/* Read or write from mappable sections of BFD executable files.
@@ -71,22 +71,18 @@ extern enum target_xfer_status
One, and only one, of readbuf or writebuf must be non-NULL. */
-extern enum target_xfer_status
- section_table_xfer_memory_partial (gdb_byte *,
- const gdb_byte *,
- ULONGEST, ULONGEST, ULONGEST *,
- const target_section_table &,
- gdb::function_view<bool
- (const struct target_section *)> match_cb
- = nullptr);
+extern enum target_xfer_status section_table_xfer_memory_partial (
+ gdb_byte *, const gdb_byte *, ULONGEST, ULONGEST, ULONGEST *,
+ const target_section_table &,
+ gdb::function_view<bool (const struct target_section *)> match_cb = nullptr);
/* Read from mappable read-only sections of BFD executable files.
Similar to exec_read_partial_read_only, but return
TARGET_XFER_UNAVAILABLE if data is unavailable. */
extern enum target_xfer_status
- section_table_read_available_memory (gdb_byte *readbuf, ULONGEST offset,
- ULONGEST len, ULONGEST *xfered_len);
+section_table_read_available_memory (gdb_byte *readbuf, ULONGEST offset,
+ ULONGEST len, ULONGEST *xfered_len);
/* Set the loaded address of a section. */
extern void exec_set_section_address (const char *, int, CORE_ADDR);
@@ -95,8 +91,7 @@ extern void exec_set_section_address (const char *, int, CORE_ADDR);
special cased --- it's filename is omitted; if it is the executable
file, its entry point is printed. */
-extern void print_section_info (const target_section_table *table,
- bfd *abfd);
+extern void print_section_info (const target_section_table *table, bfd *abfd);
/* Helper function that attempts to open the symbol file at EXEC_FILE_HOST.
If successful, it proceeds to add the symbol file as the main symbol file.
diff --git a/gdb/expop.h b/gdb/expop.h
index bfe55e4f2fd..c2f5af979a3 100644
--- a/gdb/expop.h
+++ b/gdb/expop.h
@@ -31,23 +31,18 @@
struct agent_expr;
struct axs_value;
-extern void gen_expr_binop (struct expression *exp,
- enum exp_opcode op,
+extern void gen_expr_binop (struct expression *exp, enum exp_opcode op,
expr::operation *lhs, expr::operation *rhs,
struct agent_expr *ax, struct axs_value *value);
-extern void gen_expr_structop (struct expression *exp,
- enum exp_opcode op,
- expr::operation *lhs,
- const char *name,
+extern void gen_expr_structop (struct expression *exp, enum exp_opcode op,
+ expr::operation *lhs, const char *name,
struct agent_expr *ax, struct axs_value *value);
-extern void gen_expr_unop (struct expression *exp,
- enum exp_opcode op,
- expr::operation *lhs,
- struct agent_expr *ax, struct axs_value *value);
+extern void gen_expr_unop (struct expression *exp, enum exp_opcode op,
+ expr::operation *lhs, struct agent_expr *ax,
+ struct axs_value *value);
extern struct value *eval_op_scope (struct type *expect_type,
- struct expression *exp,
- enum noside noside,
+ struct expression *exp, enum noside noside,
struct type *type, const char *string);
extern struct value *eval_op_var_msym_value (struct type *expect_type,
struct expression *exp,
@@ -59,16 +54,15 @@ extern struct value *eval_op_var_entry_value (struct type *expect_type,
enum noside noside, symbol *sym);
extern struct value *eval_op_func_static_var (struct type *expect_type,
struct expression *exp,
- enum noside noside,
- value *func, const char *var);
+ enum noside noside, value *func,
+ const char *var);
extern struct value *eval_op_register (struct type *expect_type,
struct expression *exp,
enum noside noside, const char *name);
extern struct value *eval_op_ternop (struct type *expect_type,
struct expression *exp,
- enum noside noside,
- struct value *array, struct value *low,
- struct value *upper);
+ enum noside noside, struct value *array,
+ struct value *low, struct value *upper);
extern struct value *eval_op_structop_struct (struct type *expect_type,
struct expression *exp,
enum noside noside,
@@ -81,15 +75,13 @@ extern struct value *eval_op_structop_ptr (struct type *expect_type,
const char *string);
extern struct value *eval_op_member (struct type *expect_type,
struct expression *exp,
- enum noside noside,
- struct value *arg1, struct value *arg2);
+ enum noside noside, struct value *arg1,
+ struct value *arg2);
extern struct value *eval_op_add (struct type *expect_type,
- struct expression *exp,
- enum noside noside,
+ struct expression *exp, enum noside noside,
struct value *arg1, struct value *arg2);
extern struct value *eval_op_sub (struct type *expect_type,
- struct expression *exp,
- enum noside noside,
+ struct expression *exp, enum noside noside,
struct value *arg1, struct value *arg2);
extern struct value *eval_op_binary (struct type *expect_type,
struct expression *exp,
@@ -101,48 +93,39 @@ extern struct value *eval_op_subscript (struct type *expect_type,
struct value *arg1,
struct value *arg2);
extern struct value *eval_op_equal (struct type *expect_type,
- struct expression *exp,
- enum noside noside, enum exp_opcode op,
- struct value *arg1,
+ struct expression *exp, enum noside noside,
+ enum exp_opcode op, struct value *arg1,
struct value *arg2);
extern struct value *eval_op_notequal (struct type *expect_type,
struct expression *exp,
enum noside noside, enum exp_opcode op,
- struct value *arg1,
- struct value *arg2);
+ struct value *arg1, struct value *arg2);
extern struct value *eval_op_less (struct type *expect_type,
- struct expression *exp,
- enum noside noside, enum exp_opcode op,
- struct value *arg1,
+ struct expression *exp, enum noside noside,
+ enum exp_opcode op, struct value *arg1,
struct value *arg2);
extern struct value *eval_op_gtr (struct type *expect_type,
- struct expression *exp,
- enum noside noside, enum exp_opcode op,
- struct value *arg1,
+ struct expression *exp, enum noside noside,
+ enum exp_opcode op, struct value *arg1,
struct value *arg2);
extern struct value *eval_op_geq (struct type *expect_type,
- struct expression *exp,
- enum noside noside, enum exp_opcode op,
- struct value *arg1,
+ struct expression *exp, enum noside noside,
+ enum exp_opcode op, struct value *arg1,
struct value *arg2);
extern struct value *eval_op_leq (struct type *expect_type,
- struct expression *exp,
- enum noside noside, enum exp_opcode op,
- struct value *arg1,
+ struct expression *exp, enum noside noside,
+ enum exp_opcode op, struct value *arg1,
struct value *arg2);
extern struct value *eval_op_repeat (struct type *expect_type,
struct expression *exp,
enum noside noside, enum exp_opcode op,
- struct value *arg1,
- struct value *arg2);
+ struct value *arg1, struct value *arg2);
extern struct value *eval_op_plus (struct type *expect_type,
- struct expression *exp,
- enum noside noside, enum exp_opcode op,
- struct value *arg1);
+ struct expression *exp, enum noside noside,
+ enum exp_opcode op, struct value *arg1);
extern struct value *eval_op_neg (struct type *expect_type,
- struct expression *exp,
- enum noside noside, enum exp_opcode op,
- struct value *arg1);
+ struct expression *exp, enum noside noside,
+ enum exp_opcode op, struct value *arg1);
extern struct value *eval_op_complement (struct type *expect_type,
struct expression *exp,
enum noside noside,
@@ -150,50 +133,41 @@ extern struct value *eval_op_complement (struct type *expect_type,
struct value *arg1);
extern struct value *eval_op_lognot (struct type *expect_type,
struct expression *exp,
- enum noside noside,
- enum exp_opcode op,
+ enum noside noside, enum exp_opcode op,
struct value *arg1);
extern struct value *eval_op_preinc (struct type *expect_type,
struct expression *exp,
- enum noside noside,
- enum exp_opcode op,
+ enum noside noside, enum exp_opcode op,
struct value *arg1);
extern struct value *eval_op_predec (struct type *expect_type,
struct expression *exp,
- enum noside noside,
- enum exp_opcode op,
+ enum noside noside, enum exp_opcode op,
struct value *arg1);
extern struct value *eval_op_postinc (struct type *expect_type,
struct expression *exp,
- enum noside noside,
- enum exp_opcode op,
+ enum noside noside, enum exp_opcode op,
struct value *arg1);
extern struct value *eval_op_postdec (struct type *expect_type,
struct expression *exp,
- enum noside noside,
- enum exp_opcode op,
+ enum noside noside, enum exp_opcode op,
struct value *arg1);
extern struct value *eval_op_ind (struct type *expect_type,
- struct expression *exp,
- enum noside noside,
+ struct expression *exp, enum noside noside,
struct value *arg1);
extern struct value *eval_op_type (struct type *expect_type,
- struct expression *exp,
- enum noside noside, struct type *type);
+ struct expression *exp, enum noside noside,
+ struct type *type);
extern struct value *eval_op_alignof (struct type *expect_type,
struct expression *exp,
- enum noside noside,
- struct value *arg1);
+ enum noside noside, struct value *arg1);
extern struct value *eval_op_memval (struct type *expect_type,
struct expression *exp,
- enum noside noside,
- struct value *arg1, struct type *type);
-extern struct value *eval_binop_assign_modify (struct type *expect_type,
- struct expression *exp,
- enum noside noside,
- enum exp_opcode op,
- struct value *arg1,
- struct value *arg2);
+ enum noside noside, struct value *arg1,
+ struct type *type);
+extern struct value *
+eval_binop_assign_modify (struct type *expect_type, struct expression *exp,
+ enum noside noside, enum exp_opcode op,
+ struct value *arg1, struct value *arg2);
namespace expr
{
@@ -228,8 +202,7 @@ check_objfile (struct symbol *sym, struct objfile *objfile)
return check_objfile (sym->objfile (), objfile);
}
-extern bool check_objfile (const struct block *block,
- struct objfile *objfile);
+extern bool check_objfile (const struct block *block, struct objfile *objfile);
static inline bool
check_objfile (const block_symbol &sym, struct objfile *objfile)
@@ -305,8 +278,7 @@ extern bool check_objfile (const std::unique_ptr<ada_component> &comp,
struct objfile *objfile);
static inline void
-dump_for_expression (struct ui_file *stream, int depth,
- const operation_up &op)
+dump_for_expression (struct ui_file *stream, int depth, const operation_up &op)
{
op->dump (stream, depth);
}
@@ -343,7 +315,7 @@ void
dump_for_expression (struct ui_file *stream, int depth,
const std::vector<T> &vals)
{
- gdb_printf (stream, _("%*sVector:\n"), depth, "");
+ gdb_printf (stream, _ ("%*sVector:\n"), depth, "");
for (auto &item : vals)
dump_for_expression (stream, depth + 1, item);
}
@@ -392,16 +364,16 @@ private:
/* do_dump does the work of dumping the data. */
template<int I, typename... T>
- typename std::enable_if<I == sizeof... (T), void>::type
- do_dump (struct ui_file *stream, int depth, const std::tuple<T...> &value)
- const
+ typename std::enable_if<I == sizeof...(T), void>::type
+ do_dump (struct ui_file *stream, int depth,
+ const std::tuple<T...> &value) const
{
}
template<int I, typename... T>
- typename std::enable_if<I < sizeof... (T), void>::type
- do_dump (struct ui_file *stream, int depth, const std::tuple<T...> &value)
- const
+ typename std::enable_if
+ < I<sizeof...(T), void>::type do_dump (struct ui_file *stream, int depth,
+ const std::tuple<T...> &value) const
{
dump_for_expression (stream, depth, std::get<I> (value));
do_dump<I + 1, T...> (stream, depth, value);
@@ -410,17 +382,17 @@ private:
/* do_check_objfile does the work of checking whether this object
refers to OBJFILE. */
template<int I, typename... T>
- typename std::enable_if<I == sizeof... (T), bool>::type
- do_check_objfile (struct objfile *objfile, const std::tuple<T...> &value)
- const
+ typename std::enable_if<I == sizeof...(T), bool>::type
+ do_check_objfile (struct objfile *objfile,
+ const std::tuple<T...> &value) const
{
return false;
}
template<int I, typename... T>
- typename std::enable_if<I < sizeof... (T), bool>::type
- do_check_objfile (struct objfile *objfile, const std::tuple<T...> &value)
- const
+ typename std::enable_if < I<sizeof...(T), bool>::type
+ do_check_objfile (struct objfile *objfile,
+ const std::tuple<T...> &value) const
{
if (check_objfile (std::get<I> (value), objfile))
return true;
@@ -472,9 +444,7 @@ static inline bool
check_constant (struct symbol *sym)
{
enum address_class sc = sym->aclass ();
- return (sc == LOC_BLOCK
- || sc == LOC_CONST
- || sc == LOC_CONST_BYTES
+ return (sc == LOC_BLOCK || sc == LOC_CONST || sc == LOC_CONST_BYTES
|| sc == LOC_LABEL);
}
@@ -507,8 +477,7 @@ check_constant (const std::pair<S, T> &item)
implementation of 'constant_p' that works by checking the
operands. */
template<typename... Arg>
-class maybe_constant_operation
- : public tuple_holding_operation<Arg...>
+class maybe_constant_operation : public tuple_holding_operation<Arg...>
{
public:
@@ -522,15 +491,15 @@ public:
private:
template<int I, typename... T>
- typename std::enable_if<I == sizeof... (T), bool>::type
+ typename std::enable_if<I == sizeof...(T), bool>::type
do_check_constant (const std::tuple<T...> &value) const
{
return true;
}
template<int I, typename... T>
- typename std::enable_if<I < sizeof... (T), bool>::type
- do_check_constant (const std::tuple<T...> &value) const
+ typename std::enable_if < I<sizeof...(T), bool>::type
+ do_check_constant (const std::tuple<T...> &value) const
{
if (!check_constant (std::get<I> (value)))
return false;
@@ -548,8 +517,7 @@ typedef std::array<gdb_byte, 16> float_data;
This does not need the facilities provided by
tuple_holding_operation, so it does not use it. */
-class float_const_operation
- : public operation
+class float_const_operation : public operation
{
public:
@@ -559,18 +527,15 @@ public:
{
}
- value *evaluate (struct type *expect_type,
- struct expression *exp,
+ value *evaluate (struct type *expect_type, struct expression *exp,
enum noside noside) override
{
return value_from_contents (m_type, m_data.data ());
}
- enum exp_opcode opcode () const override
- { return OP_FLOAT; }
+ enum exp_opcode opcode () const override { return OP_FLOAT; }
- bool constant_p () const override
- { return true; }
+ bool constant_p () const override { return true; }
void dump (struct ui_file *stream, int depth) const override;
@@ -587,81 +552,65 @@ public:
using maybe_constant_operation::maybe_constant_operation;
- value *evaluate (struct type *expect_type,
- struct expression *exp,
+ value *evaluate (struct type *expect_type, struct expression *exp,
enum noside noside) override
{
- return eval_op_scope (expect_type, exp, noside,
- std::get<0> (m_storage),
+ return eval_op_scope (expect_type, exp, noside, std::get<0> (m_storage),
std::get<1> (m_storage).c_str ());
}
value *evaluate_for_address (struct expression *exp,
enum noside noside) override;
- value *evaluate_funcall (struct type *expect_type,
- struct expression *exp,
+ value *evaluate_funcall (struct type *expect_type, struct expression *exp,
enum noside noside,
const std::vector<operation_up> &args) override;
- enum exp_opcode opcode () const override
- { return OP_SCOPE; }
+ enum exp_opcode opcode () const override { return OP_SCOPE; }
protected:
- void do_generate_ax (struct expression *exp,
- struct agent_expr *ax,
+ void do_generate_ax (struct expression *exp, struct agent_expr *ax,
struct axs_value *value,
- struct type *cast_type)
- override;
+ struct type *cast_type) override;
};
/* Compute the value of a variable. */
-class var_value_operation
- : public maybe_constant_operation<block_symbol>
+class var_value_operation : public maybe_constant_operation<block_symbol>
{
public:
using maybe_constant_operation::maybe_constant_operation;
- value *evaluate (struct type *expect_type,
- struct expression *exp,
+ value *evaluate (struct type *expect_type, struct expression *exp,
enum noside noside) override;
value *evaluate_with_coercion (struct expression *exp,
enum noside noside) override;
- value *evaluate_for_sizeof (struct expression *exp, enum noside noside)
- override;
+ value *evaluate_for_sizeof (struct expression *exp,
+ enum noside noside) override;
- value *evaluate_for_cast (struct type *expect_type,
- struct expression *exp,
+ value *evaluate_for_cast (struct type *expect_type, struct expression *exp,
enum noside noside) override;
- value *evaluate_for_address (struct expression *exp, enum noside noside)
- override;
+ value *evaluate_for_address (struct expression *exp,
+ enum noside noside) override;
- value *evaluate_funcall (struct type *expect_type,
- struct expression *exp,
+ value *evaluate_funcall (struct type *expect_type, struct expression *exp,
enum noside noside,
const std::vector<operation_up> &args) override;
- enum exp_opcode opcode () const override
- { return OP_VAR_VALUE; }
+ enum exp_opcode opcode () const override { return OP_VAR_VALUE; }
/* Return the symbol referenced by this object. */
- symbol *get_symbol () const
- {
- return std::get<0> (m_storage).symbol;
- }
+ symbol *get_symbol () const { return std::get<0> (m_storage).symbol; }
protected:
- void do_generate_ax (struct expression *exp,
- struct agent_expr *ax,
+ void do_generate_ax (struct expression *exp, struct agent_expr *ax,
struct axs_value *value,
- struct type *cast_type)
- override;
+ struct type *cast_type) override;
};
class long_const_operation
@@ -671,27 +620,22 @@ public:
using tuple_holding_operation::tuple_holding_operation;
- value *evaluate (struct type *expect_type,
- struct expression *exp,
+ value *evaluate (struct type *expect_type, struct expression *exp,
enum noside noside) override
{
return value_from_longest (std::get<0> (m_storage),
std::get<1> (m_storage));
}
- enum exp_opcode opcode () const override
- { return OP_LONG; }
+ enum exp_opcode opcode () const override { return OP_LONG; }
- bool constant_p () const override
- { return true; }
+ bool constant_p () const override { return true; }
protected:
- void do_generate_ax (struct expression *exp,
- struct agent_expr *ax,
+ void do_generate_ax (struct expression *exp, struct agent_expr *ax,
struct axs_value *value,
- struct type *cast_type)
- override;
+ struct type *cast_type) override;
};
class var_msym_value_operation
@@ -701,26 +645,23 @@ public:
using maybe_constant_operation::maybe_constant_operation;
- value *evaluate (struct type *expect_type,
- struct expression *exp,
+ value *evaluate (struct type *expect_type, struct expression *exp,
enum noside noside) override
{
return eval_op_var_msym_value (expect_type, exp, noside, m_outermost,
std::get<0> (m_storage));
}
- value *evaluate_for_sizeof (struct expression *exp, enum noside noside)
- override;
+ value *evaluate_for_sizeof (struct expression *exp,
+ enum noside noside) override;
- value *evaluate_for_address (struct expression *exp, enum noside noside)
- override;
+ value *evaluate_for_address (struct expression *exp,
+ enum noside noside) override;
- value *evaluate_for_cast (struct type *expect_type,
- struct expression *exp,
+ value *evaluate_for_cast (struct type *expect_type, struct expression *exp,
enum noside noside) override;
- value *evaluate_funcall (struct type *expect_type,
- struct expression *exp,
+ value *evaluate_funcall (struct type *expect_type, struct expression *exp,
enum noside noside,
const std::vector<operation_up> &args) override
{
@@ -728,43 +669,34 @@ public:
return operation::evaluate_funcall (expect_type, exp, noside, name, args);
}
- enum exp_opcode opcode () const override
- { return OP_VAR_MSYM_VALUE; }
+ enum exp_opcode opcode () const override { return OP_VAR_MSYM_VALUE; }
- void set_outermost () override
- {
- m_outermost = true;
- }
+ void set_outermost () override { m_outermost = true; }
protected:
/* True if this is the outermost operation in the expression. */
bool m_outermost = false;
- void do_generate_ax (struct expression *exp,
- struct agent_expr *ax,
+ void do_generate_ax (struct expression *exp, struct agent_expr *ax,
struct axs_value *value,
- struct type *cast_type)
- override;
+ struct type *cast_type) override;
};
-class var_entry_value_operation
- : public tuple_holding_operation<symbol *>
+class var_entry_value_operation : public tuple_holding_operation<symbol *>
{
public:
using tuple_holding_operation::tuple_holding_operation;
- value *evaluate (struct type *expect_type,
- struct expression *exp,
+ value *evaluate (struct type *expect_type, struct expression *exp,
enum noside noside) override
{
return eval_op_var_entry_value (expect_type, exp, noside,
std::get<0> (m_storage));
}
- enum exp_opcode opcode () const override
- { return OP_VAR_ENTRY_VALUE; }
+ enum exp_opcode opcode () const override { return OP_VAR_ENTRY_VALUE; }
};
class func_static_var_operation
@@ -774,8 +706,7 @@ public:
using maybe_constant_operation::maybe_constant_operation;
- value *evaluate (struct type *expect_type,
- struct expression *exp,
+ value *evaluate (struct type *expect_type, struct expression *exp,
enum noside noside) override
{
value *func = std::get<0> (m_storage)->evaluate (nullptr, exp, noside);
@@ -783,128 +714,100 @@ public:
std::get<1> (m_storage).c_str ());
}
- enum exp_opcode opcode () const override
- { return OP_FUNC_STATIC_VAR; }
+ enum exp_opcode opcode () const override { return OP_FUNC_STATIC_VAR; }
};
-class last_operation
- : public tuple_holding_operation<int>
+class last_operation : public tuple_holding_operation<int>
{
public:
using tuple_holding_operation::tuple_holding_operation;
- value *evaluate (struct type *expect_type,
- struct expression *exp,
+ value *evaluate (struct type *expect_type, struct expression *exp,
enum noside noside) override
{
return access_value_history (std::get<0> (m_storage));
}
- enum exp_opcode opcode () const override
- { return OP_LAST; }
+ enum exp_opcode opcode () const override { return OP_LAST; }
};
-class register_operation
- : public tuple_holding_operation<std::string>
+class register_operation : public tuple_holding_operation<std::string>
{
public:
using tuple_holding_operation::tuple_holding_operation;
- value *evaluate (struct type *expect_type,
- struct expression *exp,
+ value *evaluate (struct type *expect_type, struct expression *exp,
enum noside noside) override
{
return eval_op_register (expect_type, exp, noside,
std::get<0> (m_storage).c_str ());
}
- enum exp_opcode opcode () const override
- { return OP_REGISTER; }
+ enum exp_opcode opcode () const override { return OP_REGISTER; }
/* Return the name of the register. */
- const char *get_name () const
- {
- return std::get<0> (m_storage).c_str ();
- }
+ const char *get_name () const { return std::get<0> (m_storage).c_str (); }
protected:
- void do_generate_ax (struct expression *exp,
- struct agent_expr *ax,
+ void do_generate_ax (struct expression *exp, struct agent_expr *ax,
struct axs_value *value,
- struct type *cast_type)
- override;
+ struct type *cast_type) override;
};
-class bool_operation
- : public tuple_holding_operation<bool>
+class bool_operation : public tuple_holding_operation<bool>
{
public:
using tuple_holding_operation::tuple_holding_operation;
- value *evaluate (struct type *expect_type,
- struct expression *exp,
+ value *evaluate (struct type *expect_type, struct expression *exp,
enum noside noside) override
{
struct type *type = language_bool_type (exp->language_defn, exp->gdbarch);
return value_from_longest (type, std::get<0> (m_storage));
}
- enum exp_opcode opcode () const override
- { return OP_BOOL; }
+ enum exp_opcode opcode () const override { return OP_BOOL; }
- bool constant_p () const override
- { return true; }
+ bool constant_p () const override { return true; }
};
-class internalvar_operation
- : public tuple_holding_operation<internalvar *>
+class internalvar_operation : public tuple_holding_operation<internalvar *>
{
public:
using tuple_holding_operation::tuple_holding_operation;
- value *evaluate (struct type *expect_type,
- struct expression *exp,
+ value *evaluate (struct type *expect_type, struct expression *exp,
enum noside noside) override
{
- return value_of_internalvar (exp->gdbarch,
- std::get<0> (m_storage));
+ return value_of_internalvar (exp->gdbarch, std::get<0> (m_storage));
}
- internalvar *get_internalvar () const
- {
- return std::get<0> (m_storage);
- }
+ internalvar *get_internalvar () const { return std::get<0> (m_storage); }
- enum exp_opcode opcode () const override
- { return OP_INTERNALVAR; }
+ enum exp_opcode opcode () const override { return OP_INTERNALVAR; }
protected:
- void do_generate_ax (struct expression *exp,
- struct agent_expr *ax,
+ void do_generate_ax (struct expression *exp, struct agent_expr *ax,
struct axs_value *value,
- struct type *cast_type)
- override;
+ struct type *cast_type) override;
};
-class string_operation
- : public tuple_holding_operation<std::string>
+class string_operation : public tuple_holding_operation<std::string>
{
public:
using tuple_holding_operation::tuple_holding_operation;
- value *evaluate (struct type *expect_type,
- struct expression *exp,
+ value *evaluate (struct type *expect_type, struct expression *exp,
enum noside noside) override;
- enum exp_opcode opcode () const override
- { return OP_STRING; }
+ enum exp_opcode opcode () const override { return OP_STRING; }
};
class ternop_slice_operation
@@ -914,8 +817,7 @@ public:
using maybe_constant_operation::maybe_constant_operation;
- value *evaluate (struct type *expect_type,
- struct expression *exp,
+ value *evaluate (struct type *expect_type, struct expression *exp,
enum noside noside) override
{
struct value *array
@@ -927,8 +829,7 @@ public:
return eval_op_ternop (expect_type, exp, noside, array, low, upper);
}
- enum exp_opcode opcode () const override
- { return TERNOP_SLICE; }
+ enum exp_opcode opcode () const override { return TERNOP_SLICE; }
};
class ternop_cond_operation
@@ -938,8 +839,7 @@ public:
using maybe_constant_operation::maybe_constant_operation;
- value *evaluate (struct type *expect_type,
- struct expression *exp,
+ value *evaluate (struct type *expect_type, struct expression *exp,
enum noside noside) override
{
struct value *val
@@ -950,16 +850,13 @@ public:
return std::get<1> (m_storage)->evaluate (nullptr, exp, noside);
}
- enum exp_opcode opcode () const override
- { return TERNOP_COND; }
+ enum exp_opcode opcode () const override { return TERNOP_COND; }
protected:
- void do_generate_ax (struct expression *exp,
- struct agent_expr *ax,
+ void do_generate_ax (struct expression *exp, struct agent_expr *ax,
struct axs_value *value,
- struct type *cast_type)
- override;
+ struct type *cast_type) override;
};
class complex_operation
@@ -969,18 +866,15 @@ public:
using maybe_constant_operation::maybe_constant_operation;
- value *evaluate (struct type *expect_type,
- struct expression *exp,
+ value *evaluate (struct type *expect_type, struct expression *exp,
enum noside noside) override
{
value *real = std::get<0> (m_storage)->evaluate (nullptr, exp, noside);
value *imag = std::get<1> (m_storage)->evaluate (nullptr, exp, noside);
- return value_literal_complex (real, imag,
- std::get<2> (m_storage));
+ return value_literal_complex (real, imag, std::get<2> (m_storage));
}
- enum exp_opcode opcode () const override
- { return OP_COMPLEX; }
+ enum exp_opcode opcode () const override { return OP_COMPLEX; }
};
class structop_base_operation
@@ -989,13 +883,9 @@ class structop_base_operation
public:
/* Used for completion. Return the field name. */
- const std::string &get_string () const
- {
- return std::get<1> (m_storage);
- }
+ const std::string &get_string () const { return std::get<1> (m_storage); }
- value *evaluate_funcall (struct type *expect_type,
- struct expression *exp,
+ value *evaluate_funcall (struct type *expect_type, struct expression *exp,
enum noside noside,
const std::vector<operation_up> &args) override;
@@ -1017,49 +907,41 @@ protected:
using tuple_holding_operation::tuple_holding_operation;
};
-class structop_operation
- : public structop_base_operation
+class structop_operation : public structop_base_operation
{
public:
using structop_base_operation::structop_base_operation;
- value *evaluate (struct type *expect_type,
- struct expression *exp,
+ value *evaluate (struct type *expect_type, struct expression *exp,
enum noside noside) override
{
- value *val =std::get<0> (m_storage)->evaluate (nullptr, exp, noside);
+ value *val = std::get<0> (m_storage)->evaluate (nullptr, exp, noside);
return eval_op_structop_struct (expect_type, exp, noside, val,
std::get<1> (m_storage).c_str ());
}
- enum exp_opcode opcode () const override
- { return STRUCTOP_STRUCT; }
+ enum exp_opcode opcode () const override { return STRUCTOP_STRUCT; }
protected:
- void do_generate_ax (struct expression *exp,
- struct agent_expr *ax,
+ void do_generate_ax (struct expression *exp, struct agent_expr *ax,
struct axs_value *value,
- struct type *cast_type)
- override
+ struct type *cast_type) override
{
gen_expr_structop (exp, STRUCTOP_STRUCT,
std::get<0> (this->m_storage).get (),
- std::get<1> (this->m_storage).c_str (),
- ax, value);
+ std::get<1> (this->m_storage).c_str (), ax, value);
}
};
-class structop_ptr_operation
- : public structop_base_operation
+class structop_ptr_operation : public structop_base_operation
{
public:
using structop_base_operation::structop_base_operation;
- value *evaluate (struct type *expect_type,
- struct expression *exp,
+ value *evaluate (struct type *expect_type, struct expression *exp,
enum noside noside) override
{
value *val = std::get<0> (m_storage)->evaluate (nullptr, exp, noside);
@@ -1067,21 +949,16 @@ public:
std::get<1> (m_storage).c_str ());
}
- enum exp_opcode opcode () const override
- { return STRUCTOP_PTR; }
+ enum exp_opcode opcode () const override { return STRUCTOP_PTR; }
protected:
- void do_generate_ax (struct expression *exp,
- struct agent_expr *ax,
+ void do_generate_ax (struct expression *exp, struct agent_expr *ax,
struct axs_value *value,
- struct type *cast_type)
- override
+ struct type *cast_type) override
{
- gen_expr_structop (exp, STRUCTOP_PTR,
- std::get<0> (this->m_storage).get (),
- std::get<1> (this->m_storage).c_str (),
- ax, value);
+ gen_expr_structop (exp, STRUCTOP_PTR, std::get<0> (this->m_storage).get (),
+ std::get<1> (this->m_storage).c_str (), ax, value);
}
};
@@ -1092,54 +969,43 @@ public:
using tuple_holding_operation::tuple_holding_operation;
- value *evaluate_funcall (struct type *expect_type,
- struct expression *exp,
+ value *evaluate_funcall (struct type *expect_type, struct expression *exp,
enum noside noside,
const std::vector<operation_up> &args) override;
};
-class structop_member_operation
- : public structop_member_base
+class structop_member_operation : public structop_member_base
{
public:
using structop_member_base::structop_member_base;
- value *evaluate (struct type *expect_type,
- struct expression *exp,
+ value *evaluate (struct type *expect_type, struct expression *exp,
enum noside noside) override
{
- value *lhs
- = std::get<0> (m_storage)->evaluate_for_address (exp, noside);
- value *rhs
- = std::get<1> (m_storage)->evaluate (nullptr, exp, noside);
+ value *lhs = std::get<0> (m_storage)->evaluate_for_address (exp, noside);
+ value *rhs = std::get<1> (m_storage)->evaluate (nullptr, exp, noside);
return eval_op_member (expect_type, exp, noside, lhs, rhs);
}
- enum exp_opcode opcode () const override
- { return STRUCTOP_MEMBER; }
+ enum exp_opcode opcode () const override { return STRUCTOP_MEMBER; }
};
-class structop_mptr_operation
- : public structop_member_base
+class structop_mptr_operation : public structop_member_base
{
public:
using structop_member_base::structop_member_base;
- value *evaluate (struct type *expect_type,
- struct expression *exp,
+ value *evaluate (struct type *expect_type, struct expression *exp,
enum noside noside) override
{
- value *lhs
- = std::get<0> (m_storage)->evaluate (nullptr, exp, noside);
- value *rhs
- = std::get<1> (m_storage)->evaluate (nullptr, exp, noside);
+ value *lhs = std::get<0> (m_storage)->evaluate (nullptr, exp, noside);
+ value *rhs = std::get<1> (m_storage)->evaluate (nullptr, exp, noside);
return eval_op_member (expect_type, exp, noside, lhs, rhs);
}
- enum exp_opcode opcode () const override
- { return STRUCTOP_MPTR; }
+ enum exp_opcode opcode () const override { return STRUCTOP_MPTR; }
};
class concat_operation
@@ -1149,19 +1015,15 @@ public:
using maybe_constant_operation::maybe_constant_operation;
- value *evaluate (struct type *expect_type,
- struct expression *exp,
+ value *evaluate (struct type *expect_type, struct expression *exp,
enum noside noside) override
{
- value *lhs
- = std::get<0> (m_storage)->evaluate_with_coercion (exp, noside);
- value *rhs
- = std::get<1> (m_storage)->evaluate_with_coercion (exp, noside);
+ value *lhs = std::get<0> (m_storage)->evaluate_with_coercion (exp, noside);
+ value *rhs = std::get<1> (m_storage)->evaluate_with_coercion (exp, noside);
return value_concat (lhs, rhs);
}
- enum exp_opcode opcode () const override
- { return BINOP_CONCAT; }
+ enum exp_opcode opcode () const override { return BINOP_CONCAT; }
};
class add_operation
@@ -1171,32 +1033,24 @@ public:
using maybe_constant_operation::maybe_constant_operation;
- value *evaluate (struct type *expect_type,
- struct expression *exp,
+ value *evaluate (struct type *expect_type, struct expression *exp,
enum noside noside) override
{
- value *lhs
- = std::get<0> (m_storage)->evaluate_with_coercion (exp, noside);
- value *rhs
- = std::get<1> (m_storage)->evaluate_with_coercion (exp, noside);
+ value *lhs = std::get<0> (m_storage)->evaluate_with_coercion (exp, noside);
+ value *rhs = std::get<1> (m_storage)->evaluate_with_coercion (exp, noside);
return eval_op_add (expect_type, exp, noside, lhs, rhs);
}
- enum exp_opcode opcode () const override
- { return BINOP_ADD; }
+ enum exp_opcode opcode () const override { return BINOP_ADD; }
protected:
- void do_generate_ax (struct expression *exp,
- struct agent_expr *ax,
+ void do_generate_ax (struct expression *exp, struct agent_expr *ax,
struct axs_value *value,
- struct type *cast_type)
- override
+ struct type *cast_type) override
{
- gen_expr_binop (exp, BINOP_ADD,
- std::get<0> (this->m_storage).get (),
- std::get<1> (this->m_storage).get (),
- ax, value);
+ gen_expr_binop (exp, BINOP_ADD, std::get<0> (this->m_storage).get (),
+ std::get<1> (this->m_storage).get (), ax, value);
}
};
@@ -1207,39 +1061,31 @@ public:
using maybe_constant_operation::maybe_constant_operation;
- value *evaluate (struct type *expect_type,
- struct expression *exp,
+ value *evaluate (struct type *expect_type, struct expression *exp,
enum noside noside) override
{
- value *lhs
- = std::get<0> (m_storage)->evaluate_with_coercion (exp, noside);
- value *rhs
- = std::get<1> (m_storage)->evaluate_with_coercion (exp, noside);
+ value *lhs = std::get<0> (m_storage)->evaluate_with_coercion (exp, noside);
+ value *rhs = std::get<1> (m_storage)->evaluate_with_coercion (exp, noside);
return eval_op_sub (expect_type, exp, noside, lhs, rhs);
}
- enum exp_opcode opcode () const override
- { return BINOP_SUB; }
+ enum exp_opcode opcode () const override { return BINOP_SUB; }
protected:
- void do_generate_ax (struct expression *exp,
- struct agent_expr *ax,
+ void do_generate_ax (struct expression *exp, struct agent_expr *ax,
struct axs_value *value,
- struct type *cast_type)
- override
+ struct type *cast_type) override
{
- gen_expr_binop (exp, BINOP_SUB,
- std::get<0> (this->m_storage).get (),
- std::get<1> (this->m_storage).get (),
- ax, value);
+ gen_expr_binop (exp, BINOP_SUB, std::get<0> (this->m_storage).get (),
+ std::get<1> (this->m_storage).get (), ax, value);
}
};
typedef struct value *binary_ftype (struct type *expect_type,
- struct expression *exp,
- enum noside noside, enum exp_opcode op,
- struct value *arg1, struct value *arg2);
+ struct expression *exp, enum noside noside,
+ enum exp_opcode op, struct value *arg1,
+ struct value *arg2);
template<enum exp_opcode OP, binary_ftype FUNC>
class binop_operation
@@ -1249,24 +1095,19 @@ public:
using maybe_constant_operation::maybe_constant_operation;
- value *evaluate (struct type *expect_type,
- struct expression *exp,
+ value *evaluate (struct type *expect_type, struct expression *exp,
enum noside noside) override
{
- value *lhs
- = std::get<0> (m_storage)->evaluate (nullptr, exp, noside);
- value *rhs
- = std::get<1> (m_storage)->evaluate (nullptr, exp, noside);
+ value *lhs = std::get<0> (m_storage)->evaluate (nullptr, exp, noside);
+ value *rhs = std::get<1> (m_storage)->evaluate (nullptr, exp, noside);
return FUNC (expect_type, exp, noside, OP, lhs, rhs);
}
- enum exp_opcode opcode () const override
- { return OP; }
+ enum exp_opcode opcode () const override { return OP; }
};
template<enum exp_opcode OP, binary_ftype FUNC>
-class usual_ax_binop_operation
- : public binop_operation<OP, FUNC>
+class usual_ax_binop_operation : public binop_operation<OP, FUNC>
{
public:
@@ -1274,16 +1115,12 @@ public:
protected:
- void do_generate_ax (struct expression *exp,
- struct agent_expr *ax,
+ void do_generate_ax (struct expression *exp, struct agent_expr *ax,
struct axs_value *value,
- struct type *cast_type)
- override
+ struct type *cast_type) override
{
- gen_expr_binop (exp, OP,
- std::get<0> (this->m_storage).get (),
- std::get<1> (this->m_storage).get (),
- ax, value);
+ gen_expr_binop (exp, OP, std::get<0> (this->m_storage).get (),
+ std::get<1> (this->m_storage).get (), ax, value);
}
};
@@ -1297,16 +1134,17 @@ using rem_operation = usual_ax_binop_operation<BINOP_REM, eval_op_binary>;
using lsh_operation = usual_ax_binop_operation<BINOP_LSH, eval_op_binary>;
using rsh_operation = usual_ax_binop_operation<BINOP_RSH, eval_op_binary>;
using bitwise_and_operation
- = usual_ax_binop_operation<BINOP_BITWISE_AND, eval_op_binary>;
+ = usual_ax_binop_operation<BINOP_BITWISE_AND, eval_op_binary>;
using bitwise_ior_operation
- = usual_ax_binop_operation<BINOP_BITWISE_IOR, eval_op_binary>;
+ = usual_ax_binop_operation<BINOP_BITWISE_IOR, eval_op_binary>;
using bitwise_xor_operation
- = usual_ax_binop_operation<BINOP_BITWISE_XOR, eval_op_binary>;
+ = usual_ax_binop_operation<BINOP_BITWISE_XOR, eval_op_binary>;
class subscript_operation
: public usual_ax_binop_operation<BINOP_SUBSCRIPT, eval_op_subscript>
{
public:
+
using usual_ax_binop_operation<BINOP_SUBSCRIPT,
eval_op_subscript>::usual_ax_binop_operation;
@@ -1316,64 +1154,51 @@ public:
/* Implementation of comparison operations. */
template<enum exp_opcode OP, binary_ftype FUNC>
-class comparison_operation
- : public usual_ax_binop_operation<OP, FUNC>
+class comparison_operation : public usual_ax_binop_operation<OP, FUNC>
{
public:
using usual_ax_binop_operation<OP, FUNC>::usual_ax_binop_operation;
- value *evaluate (struct type *expect_type,
- struct expression *exp,
+ value *evaluate (struct type *expect_type, struct expression *exp,
enum noside noside) override
{
value *lhs
= std::get<0> (this->m_storage)->evaluate (nullptr, exp, noside);
- value *rhs
- = std::get<1> (this->m_storage)->evaluate (value_type (lhs), exp,
- noside);
+ value *rhs = std::get<1> (this->m_storage)
+ ->evaluate (value_type (lhs), exp, noside);
return FUNC (expect_type, exp, noside, OP, lhs, rhs);
}
};
-class equal_operation
- : public comparison_operation<BINOP_EQUAL, eval_op_equal>
+class equal_operation : public comparison_operation<BINOP_EQUAL, eval_op_equal>
{
public:
using comparison_operation::comparison_operation;
- operation *get_lhs () const
- {
- return std::get<0> (m_storage).get ();
- }
+ operation *get_lhs () const { return std::get<0> (m_storage).get (); }
- operation *get_rhs () const
- {
- return std::get<1> (m_storage).get ();
- }
+ operation *get_rhs () const { return std::get<1> (m_storage).get (); }
};
using notequal_operation
- = comparison_operation<BINOP_NOTEQUAL, eval_op_notequal>;
+ = comparison_operation<BINOP_NOTEQUAL, eval_op_notequal>;
using less_operation = comparison_operation<BINOP_LESS, eval_op_less>;
using gtr_operation = comparison_operation<BINOP_GTR, eval_op_gtr>;
using geq_operation = comparison_operation<BINOP_GEQ, eval_op_geq>;
using leq_operation = comparison_operation<BINOP_LEQ, eval_op_leq>;
/* Implement the GDB '@' repeat operator. */
-class repeat_operation
- : public binop_operation<BINOP_REPEAT, eval_op_repeat>
+class repeat_operation : public binop_operation<BINOP_REPEAT, eval_op_repeat>
{
using binop_operation<BINOP_REPEAT, eval_op_repeat>::binop_operation;
protected:
- void do_generate_ax (struct expression *exp,
- struct agent_expr *ax,
+ void do_generate_ax (struct expression *exp, struct agent_expr *ax,
struct axs_value *value,
- struct type *cast_type)
- override;
+ struct type *cast_type) override;
};
/* C-style comma operator. */
@@ -1384,8 +1209,7 @@ public:
using maybe_constant_operation::maybe_constant_operation;
- value *evaluate (struct type *expect_type,
- struct expression *exp,
+ value *evaluate (struct type *expect_type, struct expression *exp,
enum noside noside) override
{
/* The left-hand-side is only evaluated for side effects, so don't
@@ -1395,113 +1219,96 @@ public:
return std::get<1> (m_storage)->evaluate (nullptr, exp, noside);
}
- enum exp_opcode opcode () const override
- { return BINOP_COMMA; }
+ enum exp_opcode opcode () const override { return BINOP_COMMA; }
protected:
- void do_generate_ax (struct expression *exp,
- struct agent_expr *ax,
+ void do_generate_ax (struct expression *exp, struct agent_expr *ax,
struct axs_value *value,
- struct type *cast_type)
- override;
+ struct type *cast_type) override;
};
typedef struct value *unary_ftype (struct type *expect_type,
- struct expression *exp,
- enum noside noside, enum exp_opcode op,
- struct value *arg1);
+ struct expression *exp, enum noside noside,
+ enum exp_opcode op, struct value *arg1);
/* Base class for unary operations. */
template<enum exp_opcode OP, unary_ftype FUNC>
-class unop_operation
- : public maybe_constant_operation<operation_up>
+class unop_operation : public maybe_constant_operation<operation_up>
{
public:
using maybe_constant_operation::maybe_constant_operation;
- value *evaluate (struct type *expect_type,
- struct expression *exp,
+ value *evaluate (struct type *expect_type, struct expression *exp,
enum noside noside) override
{
value *val = std::get<0> (m_storage)->evaluate (nullptr, exp, noside);
return FUNC (expect_type, exp, noside, OP, val);
}
- enum exp_opcode opcode () const override
- { return OP; }
+ enum exp_opcode opcode () const override { return OP; }
};
/* Unary operations that can also be turned into agent expressions in
the "usual" way. */
template<enum exp_opcode OP, unary_ftype FUNC>
-class usual_ax_unop_operation
- : public unop_operation<OP, FUNC>
+class usual_ax_unop_operation : public unop_operation<OP, FUNC>
{
using unop_operation<OP, FUNC>::unop_operation;
protected:
- void do_generate_ax (struct expression *exp,
- struct agent_expr *ax,
+ void do_generate_ax (struct expression *exp, struct agent_expr *ax,
struct axs_value *value,
- struct type *cast_type)
- override
+ struct type *cast_type) override
{
- gen_expr_unop (exp, OP,
- std::get<0> (this->m_storage).get (),
- ax, value);
+ gen_expr_unop (exp, OP, std::get<0> (this->m_storage).get (), ax, value);
}
};
using unary_plus_operation = usual_ax_unop_operation<UNOP_PLUS, eval_op_plus>;
using unary_neg_operation = usual_ax_unop_operation<UNOP_NEG, eval_op_neg>;
using unary_complement_operation
- = usual_ax_unop_operation<UNOP_COMPLEMENT, eval_op_complement>;
+ = usual_ax_unop_operation<UNOP_COMPLEMENT, eval_op_complement>;
using unary_logical_not_operation
- = usual_ax_unop_operation<UNOP_LOGICAL_NOT, eval_op_lognot>;
+ = usual_ax_unop_operation<UNOP_LOGICAL_NOT, eval_op_lognot>;
/* Handle pre- and post- increment and -decrement. */
template<enum exp_opcode OP, unary_ftype FUNC>
-class unop_incr_operation
- : public tuple_holding_operation<operation_up>
+class unop_incr_operation : public tuple_holding_operation<operation_up>
{
public:
using tuple_holding_operation::tuple_holding_operation;
- value *evaluate (struct type *expect_type,
- struct expression *exp,
+ value *evaluate (struct type *expect_type, struct expression *exp,
enum noside noside) override
{
value *val = std::get<0> (m_storage)->evaluate (expect_type, exp, noside);
return FUNC (expect_type, exp, noside, OP, val);
}
- enum exp_opcode opcode () const override
- { return OP; }
+ enum exp_opcode opcode () const override { return OP; }
};
using preinc_operation
- = unop_incr_operation<UNOP_PREINCREMENT, eval_op_preinc>;
+ = unop_incr_operation<UNOP_PREINCREMENT, eval_op_preinc>;
using predec_operation
- = unop_incr_operation<UNOP_PREDECREMENT, eval_op_predec>;
+ = unop_incr_operation<UNOP_PREDECREMENT, eval_op_predec>;
using postinc_operation
- = unop_incr_operation<UNOP_POSTINCREMENT, eval_op_postinc>;
+ = unop_incr_operation<UNOP_POSTINCREMENT, eval_op_postinc>;
using postdec_operation
- = unop_incr_operation<UNOP_POSTDECREMENT, eval_op_postdec>;
+ = unop_incr_operation<UNOP_POSTDECREMENT, eval_op_postdec>;
/* Base class for implementations of UNOP_IND. */
-class unop_ind_base_operation
- : public tuple_holding_operation<operation_up>
+class unop_ind_base_operation : public tuple_holding_operation<operation_up>
{
public:
using tuple_holding_operation::tuple_holding_operation;
- value *evaluate (struct type *expect_type,
- struct expression *exp,
+ value *evaluate (struct type *expect_type, struct expression *exp,
enum noside noside) override
{
if (expect_type != nullptr && expect_type->code () == TYPE_CODE_PTR)
@@ -1516,13 +1323,11 @@ public:
value *evaluate_for_sizeof (struct expression *exp,
enum noside noside) override;
- enum exp_opcode opcode () const override
- { return UNOP_IND; }
+ enum exp_opcode opcode () const override { return UNOP_IND; }
};
/* Ordinary UNOP_IND implementation. */
-class unop_ind_operation
- : public unop_ind_base_operation
+class unop_ind_operation : public unop_ind_base_operation
{
public:
@@ -1530,73 +1335,61 @@ public:
protected:
- void do_generate_ax (struct expression *exp,
- struct agent_expr *ax,
+ void do_generate_ax (struct expression *exp, struct agent_expr *ax,
struct axs_value *value,
- struct type *cast_type)
- override
+ struct type *cast_type) override
{
- gen_expr_unop (exp, UNOP_IND,
- std::get<0> (this->m_storage).get (),
- ax, value);
+ gen_expr_unop (exp, UNOP_IND, std::get<0> (this->m_storage).get (), ax,
+ value);
}
};
/* Implement OP_TYPE. */
-class type_operation
- : public tuple_holding_operation<struct type *>
+class type_operation : public tuple_holding_operation<struct type *>
{
public:
using tuple_holding_operation::tuple_holding_operation;
- value *evaluate (struct type *expect_type,
- struct expression *exp,
+ value *evaluate (struct type *expect_type, struct expression *exp,
enum noside noside) override
{
return eval_op_type (expect_type, exp, noside, std::get<0> (m_storage));
}
- enum exp_opcode opcode () const override
- { return OP_TYPE; }
+ enum exp_opcode opcode () const override { return OP_TYPE; }
- bool constant_p () const override
- { return true; }
+ bool constant_p () const override { return true; }
};
/* Implement the "typeof" operation. */
-class typeof_operation
- : public maybe_constant_operation<operation_up>
+class typeof_operation : public maybe_constant_operation<operation_up>
{
public:
using maybe_constant_operation::maybe_constant_operation;
- value *evaluate (struct type *expect_type,
- struct expression *exp,
+ value *evaluate (struct type *expect_type, struct expression *exp,
enum noside noside) override
{
if (noside == EVAL_AVOID_SIDE_EFFECTS)
return std::get<0> (m_storage)->evaluate (nullptr, exp,
EVAL_AVOID_SIDE_EFFECTS);
else
- error (_("Attempt to use a type as an expression"));
+ error (_ ("Attempt to use a type as an expression"));
}
- enum exp_opcode opcode () const override
- { return OP_TYPEOF; }
+ enum exp_opcode opcode () const override { return OP_TYPEOF; }
};
/* Implement 'decltype'. */
-class decltype_operation
- : public maybe_constant_operation<operation_up>
+class decltype_operation : public maybe_constant_operation<operation_up>
{
public:
using maybe_constant_operation::maybe_constant_operation;
- value *evaluate (struct type *expect_type,
- struct expression *exp,
+ value *evaluate (struct type *expect_type, struct expression *exp,
enum noside noside) override
{
if (noside == EVAL_AVOID_SIDE_EFFECTS)
@@ -1605,12 +1398,9 @@ public:
= std::get<0> (m_storage)->evaluate (nullptr, exp,
EVAL_AVOID_SIDE_EFFECTS);
enum exp_opcode sub_op = std::get<0> (m_storage)->opcode ();
- if (sub_op == BINOP_SUBSCRIPT
- || sub_op == STRUCTOP_MEMBER
- || sub_op == STRUCTOP_MPTR
- || sub_op == UNOP_IND
- || sub_op == STRUCTOP_STRUCT
- || sub_op == STRUCTOP_PTR
+ if (sub_op == BINOP_SUBSCRIPT || sub_op == STRUCTOP_MEMBER
+ || sub_op == STRUCTOP_MPTR || sub_op == UNOP_IND
+ || sub_op == STRUCTOP_STRUCT || sub_op == STRUCTOP_PTR
|| sub_op == OP_SCOPE)
{
struct type *type = value_type (result);
@@ -1625,60 +1415,53 @@ public:
return result;
}
else
- error (_("Attempt to use a type as an expression"));
+ error (_ ("Attempt to use a type as an expression"));
}
- enum exp_opcode opcode () const override
- { return OP_DECLTYPE; }
+ enum exp_opcode opcode () const override { return OP_DECLTYPE; }
};
/* Implement 'typeid'. */
-class typeid_operation
- : public tuple_holding_operation<operation_up>
+class typeid_operation : public tuple_holding_operation<operation_up>
{
public:
using tuple_holding_operation::tuple_holding_operation;
- value *evaluate (struct type *expect_type,
- struct expression *exp,
+ value *evaluate (struct type *expect_type, struct expression *exp,
enum noside noside) override
{
enum exp_opcode sub_op = std::get<0> (m_storage)->opcode ();
enum noside sub_noside
= ((sub_op == OP_TYPE || sub_op == OP_DECLTYPE || sub_op == OP_TYPEOF)
- ? EVAL_AVOID_SIDE_EFFECTS
- : noside);
+ ? EVAL_AVOID_SIDE_EFFECTS
+ : noside);
- value *result = std::get<0> (m_storage)->evaluate (nullptr, exp,
- sub_noside);
+ value *result
+ = std::get<0> (m_storage)->evaluate (nullptr, exp, sub_noside);
if (noside != EVAL_NORMAL)
return allocate_value (cplus_typeid_type (exp->gdbarch));
return cplus_typeid (result);
}
- enum exp_opcode opcode () const override
- { return OP_TYPEID; }
+ enum exp_opcode opcode () const override { return OP_TYPEID; }
};
/* Implement the address-of operation. */
-class unop_addr_operation
- : public maybe_constant_operation<operation_up>
+class unop_addr_operation : public maybe_constant_operation<operation_up>
{
public:
using maybe_constant_operation::maybe_constant_operation;
- value *evaluate (struct type *expect_type,
- struct expression *exp,
+ value *evaluate (struct type *expect_type, struct expression *exp,
enum noside noside) override
{
/* C++: check for and handle pointer to members. */
return std::get<0> (m_storage)->evaluate_for_address (exp, noside);
}
- enum exp_opcode opcode () const override
- { return UNOP_ADDR; }
+ enum exp_opcode opcode () const override { return UNOP_ADDR; }
/* Return the subexpression. */
const operation_up &get_expression () const
@@ -1688,55 +1471,45 @@ public:
protected:
- void do_generate_ax (struct expression *exp,
- struct agent_expr *ax,
+ void do_generate_ax (struct expression *exp, struct agent_expr *ax,
struct axs_value *value,
- struct type *cast_type)
- override
+ struct type *cast_type) override
{
- gen_expr_unop (exp, UNOP_ADDR,
- std::get<0> (this->m_storage).get (),
- ax, value);
+ gen_expr_unop (exp, UNOP_ADDR, std::get<0> (this->m_storage).get (), ax,
+ value);
}
};
/* Implement 'sizeof'. */
-class unop_sizeof_operation
- : public maybe_constant_operation<operation_up>
+class unop_sizeof_operation : public maybe_constant_operation<operation_up>
{
public:
using maybe_constant_operation::maybe_constant_operation;
- value *evaluate (struct type *expect_type,
- struct expression *exp,
+ value *evaluate (struct type *expect_type, struct expression *exp,
enum noside noside) override
{
return std::get<0> (m_storage)->evaluate_for_sizeof (exp, noside);
}
- enum exp_opcode opcode () const override
- { return UNOP_SIZEOF; }
+ enum exp_opcode opcode () const override { return UNOP_SIZEOF; }
protected:
- void do_generate_ax (struct expression *exp,
- struct agent_expr *ax,
+ void do_generate_ax (struct expression *exp, struct agent_expr *ax,
struct axs_value *value,
- struct type *cast_type)
- override;
+ struct type *cast_type) override;
};
/* Implement 'alignof'. */
-class unop_alignof_operation
- : public maybe_constant_operation<operation_up>
+class unop_alignof_operation : public maybe_constant_operation<operation_up>
{
public:
using maybe_constant_operation::maybe_constant_operation;
- value *evaluate (struct type *expect_type,
- struct expression *exp,
+ value *evaluate (struct type *expect_type, struct expression *exp,
enum noside noside) override
{
value *val = std::get<0> (m_storage)->evaluate (nullptr, exp,
@@ -1744,8 +1517,7 @@ public:
return eval_op_alignof (expect_type, exp, noside, val);
}
- enum exp_opcode opcode () const override
- { return UNOP_ALIGNOF; }
+ enum exp_opcode opcode () const override { return UNOP_ALIGNOF; }
};
/* Implement UNOP_MEMVAL. */
@@ -1756,8 +1528,7 @@ public:
using tuple_holding_operation::tuple_holding_operation;
- value *evaluate (struct type *expect_type,
- struct expression *exp,
+ value *evaluate (struct type *expect_type, struct expression *exp,
enum noside noside) override
{
value *val = std::get<0> (m_storage)->evaluate (expect_type, exp, noside);
@@ -1771,22 +1542,16 @@ public:
value *evaluate_for_address (struct expression *exp,
enum noside noside) override;
- enum exp_opcode opcode () const override
- { return UNOP_MEMVAL; }
+ enum exp_opcode opcode () const override { return UNOP_MEMVAL; }
/* Return the type referenced by this object. */
- struct type *get_type () const
- {
- return std::get<1> (m_storage);
- }
+ struct type *get_type () const { return std::get<1> (m_storage); }
protected:
- void do_generate_ax (struct expression *exp,
- struct agent_expr *ax,
+ void do_generate_ax (struct expression *exp, struct agent_expr *ax,
struct axs_value *value,
- struct type *cast_type)
- override;
+ struct type *cast_type) override;
};
/* Implement UNOP_MEMVAL_TYPE. */
@@ -1797,8 +1562,7 @@ public:
using tuple_holding_operation::tuple_holding_operation;
- value *evaluate (struct type *expect_type,
- struct expression *exp,
+ value *evaluate (struct type *expect_type, struct expression *exp,
enum noside noside) override
{
value *typeval
@@ -1815,43 +1579,35 @@ public:
value *evaluate_for_address (struct expression *exp,
enum noside noside) override;
- enum exp_opcode opcode () const override
- { return UNOP_MEMVAL_TYPE; }
+ enum exp_opcode opcode () const override { return UNOP_MEMVAL_TYPE; }
protected:
- void do_generate_ax (struct expression *exp,
- struct agent_expr *ax,
+ void do_generate_ax (struct expression *exp, struct agent_expr *ax,
struct axs_value *value,
- struct type *cast_type)
- override;
+ struct type *cast_type) override;
};
/* Implement the 'this' expression. */
-class op_this_operation
- : public tuple_holding_operation<>
+class op_this_operation : public tuple_holding_operation<>
{
public:
using tuple_holding_operation::tuple_holding_operation;
- value *evaluate (struct type *expect_type,
- struct expression *exp,
+ value *evaluate (struct type *expect_type, struct expression *exp,
enum noside noside) override
{
return value_of_this (exp->language_defn);
}
- enum exp_opcode opcode () const override
- { return OP_THIS; }
+ enum exp_opcode opcode () const override { return OP_THIS; }
protected:
- void do_generate_ax (struct expression *exp,
- struct agent_expr *ax,
+ void do_generate_ax (struct expression *exp, struct agent_expr *ax,
struct axs_value *value,
- struct type *cast_type)
- override;
+ struct type *cast_type) override;
};
/* Implement the "type instance" operation. */
@@ -1863,12 +1619,10 @@ public:
using tuple_holding_operation::tuple_holding_operation;
- value *evaluate (struct type *expect_type,
- struct expression *exp,
+ value *evaluate (struct type *expect_type, struct expression *exp,
enum noside noside) override;
- enum exp_opcode opcode () const override
- { return TYPE_INSTANCE; }
+ enum exp_opcode opcode () const override { return TYPE_INSTANCE; }
};
/* The assignment operator. */
@@ -1879,8 +1633,7 @@ public:
using tuple_holding_operation::tuple_holding_operation;
- value *evaluate (struct type *expect_type,
- struct expression *exp,
+ value *evaluate (struct type *expect_type, struct expression *exp,
enum noside noside) override
{
value *lhs = std::get<0> (m_storage)->evaluate (nullptr, exp, noside);
@@ -1889,9 +1642,8 @@ public:
expected type. This avoids a weird case where re-assigning a
string or array to an internal variable could error with "Too
many array elements". */
- struct type *xtype = (VALUE_LVAL (lhs) == lval_internalvar
- ? nullptr
- : value_type (lhs));
+ struct type *xtype
+ = (VALUE_LVAL (lhs) == lval_internalvar ? nullptr : value_type (lhs));
value *rhs = std::get<1> (m_storage)->evaluate (xtype, exp, noside);
if (noside == EVAL_AVOID_SIDE_EFFECTS)
@@ -1902,22 +1654,16 @@ public:
return value_assign (lhs, rhs);
}
- enum exp_opcode opcode () const override
- { return BINOP_ASSIGN; }
+ enum exp_opcode opcode () const override { return BINOP_ASSIGN; }
/* Return the left-hand-side of the assignment. */
- operation *get_lhs () const
- {
- return std::get<0> (m_storage).get ();
- }
+ operation *get_lhs () const { return std::get<0> (m_storage).get (); }
protected:
- void do_generate_ax (struct expression *exp,
- struct agent_expr *ax,
+ void do_generate_ax (struct expression *exp, struct agent_expr *ax,
struct axs_value *value,
- struct type *cast_type)
- override;
+ struct type *cast_type) override;
};
/* Assignment with modification, like "+=". */
@@ -1928,8 +1674,7 @@ public:
using tuple_holding_operation::tuple_holding_operation;
- value *evaluate (struct type *expect_type,
- struct expression *exp,
+ value *evaluate (struct type *expect_type, struct expression *exp,
enum noside noside) override
{
value *lhs = std::get<1> (m_storage)->evaluate (nullptr, exp, noside);
@@ -1938,16 +1683,13 @@ public:
std::get<0> (m_storage), lhs, rhs);
}
- enum exp_opcode opcode () const override
- { return BINOP_ASSIGN_MODIFY; }
+ enum exp_opcode opcode () const override { return BINOP_ASSIGN_MODIFY; }
protected:
- void do_generate_ax (struct expression *exp,
- struct agent_expr *ax,
+ void do_generate_ax (struct expression *exp, struct agent_expr *ax,
struct axs_value *value,
- struct type *cast_type)
- override;
+ struct type *cast_type) override;
};
/* Not a cast! Extract a value of a given type from the contents of a
@@ -1964,19 +1706,14 @@ public:
value *evaluate (struct type *expect_type, struct expression *exp,
enum noside noside) override;
- enum exp_opcode opcode () const override
- { return UNOP_EXTRACT; }
+ enum exp_opcode opcode () const override { return UNOP_EXTRACT; }
/* Return the type referenced by this object. */
- struct type *get_type () const
- {
- return std::get<1> (m_storage);
- }
+ struct type *get_type () const { return std::get<1> (m_storage); }
protected:
- void do_generate_ax (struct expression *exp,
- struct agent_expr *ax,
+ void do_generate_ax (struct expression *exp, struct agent_expr *ax,
struct axs_value *value,
struct type *cast_type) override;
};
@@ -1989,30 +1726,23 @@ public:
using maybe_constant_operation::maybe_constant_operation;
- value *evaluate (struct type *expect_type,
- struct expression *exp,
+ value *evaluate (struct type *expect_type, struct expression *exp,
enum noside noside) override
{
return std::get<0> (m_storage)->evaluate_for_cast (std::get<1> (m_storage),
exp, noside);
}
- enum exp_opcode opcode () const override
- { return UNOP_CAST; }
+ enum exp_opcode opcode () const override { return UNOP_CAST; }
/* Return the type referenced by this object. */
- struct type *get_type () const
- {
- return std::get<1> (m_storage);
- }
+ struct type *get_type () const { return std::get<1> (m_storage); }
protected:
- void do_generate_ax (struct expression *exp,
- struct agent_expr *ax,
+ void do_generate_ax (struct expression *exp, struct agent_expr *ax,
struct axs_value *value,
- struct type *cast_type)
- override;
+ struct type *cast_type) override;
};
/* A cast, but the type comes from an expression, not a "struct
@@ -2024,26 +1754,22 @@ public:
using maybe_constant_operation::maybe_constant_operation;
- value *evaluate (struct type *expect_type,
- struct expression *exp,
+ value *evaluate (struct type *expect_type, struct expression *exp,
enum noside noside) override
{
value *val = std::get<0> (m_storage)->evaluate (nullptr, exp,
EVAL_AVOID_SIDE_EFFECTS);
- return std::get<1> (m_storage)->evaluate_for_cast (value_type (val),
- exp, noside);
+ return std::get<1> (m_storage)->evaluate_for_cast (value_type (val), exp,
+ noside);
}
- enum exp_opcode opcode () const override
- { return UNOP_CAST_TYPE; }
+ enum exp_opcode opcode () const override { return UNOP_CAST_TYPE; }
protected:
- void do_generate_ax (struct expression *exp,
- struct agent_expr *ax,
+ void do_generate_ax (struct expression *exp, struct agent_expr *ax,
struct axs_value *value,
- struct type *cast_type)
- override;
+ struct type *cast_type) override;
};
typedef value *cxx_cast_ftype (struct type *, value *);
@@ -2058,8 +1784,7 @@ public:
using maybe_constant_operation::maybe_constant_operation;
- value *evaluate (struct type *expect_type,
- struct expression *exp,
+ value *evaluate (struct type *expect_type, struct expression *exp,
enum noside noside) override
{
value *val = std::get<0> (m_storage)->evaluate (nullptr, exp,
@@ -2069,14 +1794,13 @@ public:
return FUNC (type, rhs);
}
- enum exp_opcode opcode () const override
- { return OP; }
+ enum exp_opcode opcode () const override { return OP; }
};
-using dynamic_cast_operation = cxx_cast_operation<UNOP_DYNAMIC_CAST,
- value_dynamic_cast>;
-using reinterpret_cast_operation = cxx_cast_operation<UNOP_REINTERPRET_CAST,
- value_reinterpret_cast>;
+using dynamic_cast_operation
+ = cxx_cast_operation<UNOP_DYNAMIC_CAST, value_dynamic_cast>;
+using reinterpret_cast_operation
+ = cxx_cast_operation<UNOP_REINTERPRET_CAST, value_reinterpret_cast>;
/* Multi-dimensional subscripting. */
class multi_subscript_operation
@@ -2086,12 +1810,10 @@ public:
using tuple_holding_operation::tuple_holding_operation;
- value *evaluate (struct type *expect_type,
- struct expression *exp,
+ value *evaluate (struct type *expect_type, struct expression *exp,
enum noside noside) override;
- enum exp_opcode opcode () const override
- { return MULTI_SUBSCRIPT; }
+ enum exp_opcode opcode () const override { return MULTI_SUBSCRIPT; }
};
/* The "&&" operator. */
@@ -2102,20 +1824,16 @@ public:
using maybe_constant_operation::maybe_constant_operation;
- value *evaluate (struct type *expect_type,
- struct expression *exp,
+ value *evaluate (struct type *expect_type, struct expression *exp,
enum noside noside) override;
- enum exp_opcode opcode () const override
- { return BINOP_LOGICAL_AND; }
+ enum exp_opcode opcode () const override { return BINOP_LOGICAL_AND; }
protected:
- void do_generate_ax (struct expression *exp,
- struct agent_expr *ax,
+ void do_generate_ax (struct expression *exp, struct agent_expr *ax,
struct axs_value *value,
- struct type *cast_type)
- override;
+ struct type *cast_type) override;
};
/* The "||" operator. */
@@ -2126,20 +1844,16 @@ public:
using maybe_constant_operation::maybe_constant_operation;
- value *evaluate (struct type *expect_type,
- struct expression *exp,
+ value *evaluate (struct type *expect_type, struct expression *exp,
enum noside noside) override;
- enum exp_opcode opcode () const override
- { return BINOP_LOGICAL_OR; }
+ enum exp_opcode opcode () const override { return BINOP_LOGICAL_OR; }
protected:
- void do_generate_ax (struct expression *exp,
- struct agent_expr *ax,
+ void do_generate_ax (struct expression *exp, struct agent_expr *ax,
struct axs_value *value,
- struct type *cast_type)
- override;
+ struct type *cast_type) override;
};
/* This class implements ADL (aka Koenig) function calls for C++. It
@@ -2153,12 +1867,10 @@ public:
using tuple_holding_operation::tuple_holding_operation;
- value *evaluate (struct type *expect_type,
- struct expression *exp,
+ value *evaluate (struct type *expect_type, struct expression *exp,
enum noside noside) override;
- enum exp_opcode opcode () const override
- { return OP_ADL_FUNC; }
+ enum exp_opcode opcode () const override { return OP_ADL_FUNC; }
};
/* The OP_ARRAY operation. */
@@ -2169,12 +1881,10 @@ public:
using tuple_holding_operation::tuple_holding_operation;
- value *evaluate (struct type *expect_type,
- struct expression *exp,
+ value *evaluate (struct type *expect_type, struct expression *exp,
enum noside noside) override;
- enum exp_opcode opcode () const override
- { return OP_ARRAY; }
+ enum exp_opcode opcode () const override { return OP_ARRAY; }
private:
@@ -2192,16 +1902,14 @@ public:
using tuple_holding_operation::tuple_holding_operation;
- value *evaluate (struct type *expect_type,
- struct expression *exp,
+ value *evaluate (struct type *expect_type, struct expression *exp,
enum noside noside) override
{
return std::get<0> (m_storage)->evaluate_funcall (expect_type, exp, noside,
std::get<1> (m_storage));
}
- enum exp_opcode opcode () const override
- { return OP_FUNCALL; }
+ enum exp_opcode opcode () const override { return OP_FUNCALL; }
};
} /* namespace expr */
diff --git a/gdb/expprint.c b/gdb/expprint.c
index 63004f7f106..89c8bd1a54c 100644
--- a/gdb/expprint.c
+++ b/gdb/expprint.c
@@ -24,7 +24,7 @@
#include "value.h"
#include "language.h"
#include "parser-defs.h"
-#include "user-regs.h" /* For user_reg_map_regnum_to_name. */
+#include "user-regs.h" /* For user_reg_map_regnum_to_name. */
#include "target.h"
#include "block.h"
#include "objfiles.h"
@@ -51,9 +51,9 @@ op_name (enum exp_opcode opcode)
xsnprintf (buf, sizeof (buf), "<unknown %d>", opcode);
return buf;
}
-#define OP(name) \
- case name: \
- return #name ;
+#define OP(name) \
+ case name: \
+ return #name;
#include "std-operator.def"
#undef OP
}
@@ -64,8 +64,7 @@ extern void ATTRIBUTE_USED debug_exp (struct expression *exp);
/* Print EXP. */
-void
-ATTRIBUTE_USED
+void ATTRIBUTE_USED
debug_exp (struct expression *exp)
{
exp->dump (gdb_stdlog);
@@ -84,19 +83,19 @@ check_objfile (const struct block *block, struct objfile *objfile)
void
dump_for_expression (struct ui_file *stream, int depth, enum exp_opcode op)
{
- gdb_printf (stream, _("%*sOperation: %s\n"), depth, "", op_name (op));
+ gdb_printf (stream, _ ("%*sOperation: %s\n"), depth, "", op_name (op));
}
void
dump_for_expression (struct ui_file *stream, int depth, const std::string &str)
{
- gdb_printf (stream, _("%*sString: %s\n"), depth, "", str.c_str ());
+ gdb_printf (stream, _ ("%*sString: %s\n"), depth, "", str.c_str ());
}
void
dump_for_expression (struct ui_file *stream, int depth, struct type *type)
{
- gdb_printf (stream, _("%*sType: "), depth, "");
+ gdb_printf (stream, _ ("%*sType: "), depth, "");
type_print (type, nullptr, stream, 0);
gdb_printf (stream, "\n");
}
@@ -104,22 +103,21 @@ dump_for_expression (struct ui_file *stream, int depth, struct type *type)
void
dump_for_expression (struct ui_file *stream, int depth, CORE_ADDR addr)
{
- gdb_printf (stream, _("%*sConstant: %s\n"), depth, "",
+ gdb_printf (stream, _ ("%*sConstant: %s\n"), depth, "",
core_addr_to_string (addr));
}
void
dump_for_expression (struct ui_file *stream, int depth, internalvar *ivar)
{
- gdb_printf (stream, _("%*sInternalvar: $%s\n"), depth, "",
+ gdb_printf (stream, _ ("%*sInternalvar: $%s\n"), depth, "",
internalvar_name (ivar));
}
void
dump_for_expression (struct ui_file *stream, int depth, symbol *sym)
{
- gdb_printf (stream, _("%*sSymbol: %s\n"), depth, "",
- sym->print_name ());
+ gdb_printf (stream, _ ("%*sSymbol: %s\n"), depth, "", sym->print_name ());
dump_for_expression (stream, depth + 1, sym->type ());
}
@@ -127,21 +125,21 @@ void
dump_for_expression (struct ui_file *stream, int depth,
bound_minimal_symbol msym)
{
- gdb_printf (stream, _("%*sMinsym %s in objfile %s\n"), depth, "",
+ gdb_printf (stream, _ ("%*sMinsym %s in objfile %s\n"), depth, "",
msym.minsym->print_name (), objfile_name (msym.objfile));
}
void
dump_for_expression (struct ui_file *stream, int depth, const block *bl)
{
- gdb_printf (stream, _("%*sBlock: %p\n"), depth, "", bl);
+ gdb_printf (stream, _ ("%*sBlock: %p\n"), depth, "", bl);
}
void
dump_for_expression (struct ui_file *stream, int depth,
const block_symbol &sym)
{
- gdb_printf (stream, _("%*sBlock symbol:\n"), depth, "");
+ gdb_printf (stream, _ ("%*sBlock symbol:\n"), depth, "");
dump_for_expression (stream, depth + 1, sym.symbol);
dump_for_expression (stream, depth + 1, sym.block);
}
@@ -150,7 +148,7 @@ void
dump_for_expression (struct ui_file *stream, int depth,
type_instance_flags flags)
{
- gdb_printf (stream, _("%*sType flags: "), depth, "");
+ gdb_printf (stream, _ ("%*sType flags: "), depth, "");
if (flags & TYPE_INSTANCE_FLAG_CONST)
gdb_puts ("const ", stream);
if (flags & TYPE_INSTANCE_FLAG_VOLATILE)
@@ -162,43 +160,42 @@ void
dump_for_expression (struct ui_file *stream, int depth,
enum c_string_type_values flags)
{
- gdb_printf (stream, _("%*sC string flags: "), depth, "");
+ gdb_printf (stream, _ ("%*sC string flags: "), depth, "");
switch (flags & ~C_CHAR)
{
case C_WIDE_STRING:
- gdb_puts (_("wide "), stream);
+ gdb_puts (_ ("wide "), stream);
break;
case C_STRING_16:
- gdb_puts (_("u16 "), stream);
+ gdb_puts (_ ("u16 "), stream);
break;
case C_STRING_32:
- gdb_puts (_("u32 "), stream);
+ gdb_puts (_ ("u32 "), stream);
break;
default:
- gdb_puts (_("ordinary "), stream);
+ gdb_puts (_ ("ordinary "), stream);
break;
}
if ((flags & C_CHAR) != 0)
- gdb_puts (_("char"), stream);
+ gdb_puts (_ ("char"), stream);
else
- gdb_puts (_("string"), stream);
+ gdb_puts (_ ("string"), stream);
gdb_puts ("\n", stream);
}
void
-dump_for_expression (struct ui_file *stream, int depth,
- enum range_flag flags)
+dump_for_expression (struct ui_file *stream, int depth, enum range_flag flags)
{
- gdb_printf (stream, _("%*sRange:"), depth, "");
+ gdb_printf (stream, _ ("%*sRange:"), depth, "");
if ((flags & RANGE_LOW_BOUND_DEFAULT) != 0)
- gdb_puts (_("low-default "), stream);
+ gdb_puts (_ ("low-default "), stream);
if ((flags & RANGE_HIGH_BOUND_DEFAULT) != 0)
- gdb_puts (_("high-default "), stream);
+ gdb_puts (_ ("high-default "), stream);
if ((flags & RANGE_HIGH_BOUND_EXCLUSIVE) != 0)
- gdb_puts (_("high-exclusive "), stream);
+ gdb_puts (_ ("high-exclusive "), stream);
if ((flags & RANGE_HAS_STRIDE) != 0)
- gdb_puts (_("has-stride"), stream);
+ gdb_puts (_ ("has-stride"), stream);
gdb_printf (stream, "\n");
}
@@ -212,7 +209,7 @@ dump_for_expression (struct ui_file *stream, int depth,
void
float_const_operation::dump (struct ui_file *stream, int depth) const
{
- gdb_printf (stream, _("%*sFloat: "), depth, "");
+ gdb_printf (stream, _ ("%*sFloat: "), depth, "");
print_floating (m_data.data (), m_type, stream);
gdb_printf (stream, "\n");
}
diff --git a/gdb/expression.h b/gdb/expression.h
index c314fc24e1b..02fe81548a8 100644
--- a/gdb/expression.h
+++ b/gdb/expression.h
@@ -17,7 +17,7 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
-#if !defined (EXPRESSION_H)
+#if !defined(EXPRESSION_H)
#define EXPRESSION_H 1
#include "gdbtypes.h"
@@ -37,24 +37,26 @@ enum innermost_block_tracker_type
/* Track the innermost block for registers within an expression. */
INNERMOST_BLOCK_FOR_REGISTERS = (1 << 1)
};
+
DEF_ENUM_FLAGS_TYPE (enum innermost_block_tracker_type,
innermost_block_tracker_types);
enum exp_opcode : uint8_t
- {
-#define OP(name) name ,
+{
+
+#define OP(name) name,
#include "std-operator.def"
#undef OP
- };
+};
/* Values of NOSIDE argument to eval_subexp. */
enum noside
- {
- EVAL_NORMAL,
- EVAL_AVOID_SIDE_EFFECTS /* Don't modify any variables or
+{
+ EVAL_NORMAL,
+ EVAL_AVOID_SIDE_EFFECTS /* Don't modify any variables or
call any functions. The value
returned will have the correct
type, and will have an
@@ -66,7 +68,7 @@ enum noside
Ideally this would not even read
target memory, but currently it
does in many situations. */
- };
+};
struct expression;
struct agent_expr;
@@ -95,9 +97,9 @@ public:
virtual ~operation () = default;
/* Evaluate this operation. */
- virtual value *evaluate (struct type *expect_type,
- struct expression *exp,
- enum noside noside) = 0;
+ virtual value *evaluate (struct type *expect_type, struct expression *exp,
+ enum noside noside)
+ = 0;
/* Evaluate this operation in a context where C-like coercion is
needed. */
@@ -128,8 +130,7 @@ public:
'evaluate'. ARGS holds the operations that should be evaluated
to get the arguments to the call. */
virtual value *evaluate_funcall (struct type *expect_type,
- struct expression *exp,
- enum noside noside,
+ struct expression *exp, enum noside noside,
const std::vector<operation_up> &args)
{
/* Defer to the helper overload. */
@@ -137,19 +138,16 @@ public:
}
/* True if this is a constant expression. */
- virtual bool constant_p () const
- { return false; }
+ virtual bool constant_p () const { return false; }
/* Return true if this operation uses OBJFILE (and will become
dangling when OBJFILE is unloaded), otherwise return false.
OBJFILE must not be a separate debug info file. */
- virtual bool uses_objfile (struct objfile *objfile) const
- { return false; }
+ virtual bool uses_objfile (struct objfile *objfile) const { return false; }
/* Generate agent expression bytecodes for this operation. */
void generate_ax (struct expression *exp, struct agent_expr *ax,
- struct axs_value *value,
- struct type *cast_type = nullptr);
+ struct axs_value *value, struct type *cast_type = nullptr);
/* Return the opcode that is implemented by this operation. */
virtual enum exp_opcode opcode () const = 0;
@@ -159,25 +157,21 @@ public:
/* Call to indicate that this is the outermost operation in the
expression. This should almost never be overridden. */
- virtual void set_outermost () { }
+ virtual void set_outermost () {}
protected:
/* A helper overload that wraps evaluate_subexp_do_call. */
- value *evaluate_funcall (struct type *expect_type,
- struct expression *exp,
- enum noside noside,
- const char *function_name,
+ value *evaluate_funcall (struct type *expect_type, struct expression *exp,
+ enum noside noside, const char *function_name,
const std::vector<operation_up> &args);
/* Called by generate_ax to do the work for this particular
operation. */
- virtual void do_generate_ax (struct expression *exp,
- struct agent_expr *ax,
- struct axs_value *value,
- struct type *cast_type)
+ virtual void do_generate_ax (struct expression *exp, struct agent_expr *ax,
+ struct axs_value *value, struct type *cast_type)
{
- error (_("Cannot translate to agent expression"));
+ error (_ ("Cannot translate to agent expression"));
}
};
@@ -189,7 +183,7 @@ make_operation (Arg... args)
return operation_up (new T (std::forward<Arg> (args)...));
}
-}
+} // namespace expr
struct expression
{
@@ -203,16 +197,10 @@ struct expression
/* Return the opcode for the outermost sub-expression of this
expression. */
- enum exp_opcode first_opcode () const
- {
- return op->opcode ();
- }
+ enum exp_opcode first_opcode () const { return op->opcode (); }
/* Dump the expression to STREAM. */
- void dump (struct ui_file *stream)
- {
- op->dump (stream, 0);
- }
+ void dump (struct ui_file *stream) { op->dump (stream, 0); }
/* Return true if this expression uses OBJFILE (and will become
dangling when OBJFILE is unloaded), otherwise return false.
@@ -243,7 +231,6 @@ extern expression_up parse_expression (const char *,
extern expression_up parse_expression_with_language (const char *string,
enum language lang);
-
class completion_tracker;
/* Base class for expression completion. An instance of this
@@ -255,14 +242,14 @@ struct expr_completion_base
results. Return true if completion was possible (even if no
completions were found), false to fall back to ordinary
expression completion (i.e., symbol names). */
- virtual bool complete (struct expression *exp,
- completion_tracker &tracker) = 0;
+ virtual bool complete (struct expression *exp, completion_tracker &tracker)
+ = 0;
virtual ~expr_completion_base () = default;
};
-extern expression_up parse_expression_for_completion
- (const char *, std::unique_ptr<expr_completion_base> *completer);
+extern expression_up parse_expression_for_completion (
+ const char *, std::unique_ptr<expr_completion_base> *completer);
class innermost_block_tracker;
extern expression_up parse_exp_1 (const char **, CORE_ADDR pc,
@@ -277,12 +264,10 @@ extern expression_up parse_exp_1 (const char **, CORE_ADDR pc,
DEFAULT_RETURN_TYPE is used as the function's return type if the return
type is unknown. */
-extern struct value *evaluate_subexp_do_call (expression *exp,
- enum noside noside,
- value *callee,
- gdb::array_view<value *> argvec,
- const char *function_name,
- type *default_return_type);
+extern struct value *
+evaluate_subexp_do_call (expression *exp, enum noside noside, value *callee,
+ gdb::array_view<value *> argvec,
+ const char *function_name, type *default_return_type);
/* From expprint.c */
diff --git a/gdb/extension-priv.h b/gdb/extension-priv.h
index 119377b4024..1b395042721 100644
--- a/gdb/extension-priv.h
+++ b/gdb/extension-priv.h
@@ -143,10 +143,10 @@ struct extension_language_ops
This function has a bit of a funny name, since it actually applies
recognizers, but this seemed clearer given the start_type_printers
and free_type_printers functions. */
- enum ext_lang_rc (*apply_type_printers)
- (const struct extension_language_defn *,
- const struct ext_lang_type_printers *,
- struct type *, char **prettied_type);
+ enum ext_lang_rc (*apply_type_printers) (
+ const struct extension_language_defn *,
+ const struct ext_lang_type_printers *, struct type *,
+ char **prettied_type);
/* Called after a type has been printed to give the type pretty-printer
mechanism an opportunity to clean up. */
@@ -157,11 +157,11 @@ struct extension_language_ops
to OPTIONS. VAL is the object to print. Returns EXT_LANG_RC_OK
upon success, EXT_LANG_RC_NOP if the value is not recognized, and
EXT_LANG_RC_ERROR if an error was encountered. */
- enum ext_lang_rc (*apply_val_pretty_printer)
- (const struct extension_language_defn *,
- struct value *val, struct ui_file *stream, int recurse,
- const struct value_print_options *options,
- const struct language_defn *language);
+ enum ext_lang_rc (*apply_val_pretty_printer) (
+ const struct extension_language_defn *, struct value *val,
+ struct ui_file *stream, int recurse,
+ const struct value_print_options *options,
+ const struct language_defn *language);
/* GDB access to the "frame filter" feature.
FRAME is the source frame to start frame-filter invocation. FLAGS is an
@@ -177,11 +177,10 @@ struct extension_language_ops
beginning of the slice of frames to print, and FRAME_HIGH is the
upper limit of the frames to count. Returns SCR_BT_ERROR on error,
or SCR_BT_COMPLETED on success. */
- enum ext_lang_bt_status (*apply_frame_filter)
- (const struct extension_language_defn *,
- frame_info_ptr frame, frame_filter_flags flags,
- enum ext_lang_frame_args args_type,
- struct ui_out *out, int frame_low, int frame_high);
+ enum ext_lang_bt_status (*apply_frame_filter) (
+ const struct extension_language_defn *, frame_info_ptr frame,
+ frame_filter_flags flags, enum ext_lang_frame_args args_type,
+ struct ui_out *out, int frame_low, int frame_high);
/* Update values held by the extension language when OBJFILE is discarded.
New global types must be created for every such value, which must then be
@@ -207,8 +206,8 @@ struct extension_language_ops
every extension language, even if another extension language has a
"stop" method: other kinds of breakpoints may be implemented using
this method, e.g., "finish breakpoints" in Python. */
- enum ext_lang_bp_stop (*breakpoint_cond_says_stop)
- (const struct extension_language_defn *, struct breakpoint *);
+ enum ext_lang_bp_stop (*breakpoint_cond_says_stop) (
+ const struct extension_language_defn *, struct breakpoint *);
/* The next two are used to connect GDB's SIGINT handling with the
extension language's.
@@ -245,11 +244,9 @@ struct extension_language_ops
This field may be NULL if the extension language does not support
xmethods. */
- enum ext_lang_rc (*get_matching_xmethod_workers)
- (const struct extension_language_defn *extlang,
- struct type *obj_type,
- const char *method_name,
- std::vector<xmethod_worker_up> *dm_vec);
+ enum ext_lang_rc (*get_matching_xmethod_workers) (
+ const struct extension_language_defn *extlang, struct type *obj_type,
+ const char *method_name, std::vector<xmethod_worker_up> *dm_vec);
/* Colorize a source file. NAME is the source file's name, and
CONTENTS is the contents of the file. This should either return
@@ -275,8 +272,7 @@ struct extension_language_ops
If no instruction can be disassembled then return an empty value and
other extension languages will get a chance to perform the
disassembly. */
- gdb::optional<int> (*print_insn) (struct gdbarch *gdbarch,
- CORE_ADDR address,
+ gdb::optional<int> (*print_insn) (struct gdbarch *gdbarch, CORE_ADDR address,
struct disassemble_info *info);
};
@@ -305,8 +301,8 @@ struct active_ext_lang_state
extern const struct extension_language_defn *get_active_ext_lang (void);
-extern struct active_ext_lang_state *set_active_ext_lang
- (const struct extension_language_defn *);
+extern struct active_ext_lang_state *
+set_active_ext_lang (const struct extension_language_defn *);
extern void restore_active_ext_lang (struct active_ext_lang_state *previous);
diff --git a/gdb/extension.c b/gdb/extension.c
index 0a9803a3023..5ef006c3a3e 100644
--- a/gdb/extension.c
+++ b/gdb/extension.c
@@ -42,25 +42,18 @@ static objfile_script_sourcer_func source_gdb_objfile_script;
This exists, in part, to support auto-loading ${prog}-gdb.gdb scripts. */
static const struct extension_language_script_ops
- extension_language_gdb_script_ops =
-{
- source_gdb_script,
- source_gdb_objfile_script,
- NULL, /* objfile_script_executor */
- auto_load_gdb_scripts_enabled
-};
+ extension_language_gdb_script_ops
+ = { source_gdb_script, source_gdb_objfile_script,
+ NULL, /* objfile_script_executor */
+ auto_load_gdb_scripts_enabled };
-const struct extension_language_defn extension_language_gdb =
-{
- EXT_LANG_GDB,
- "gdb",
- "GDB",
+const struct extension_language_defn extension_language_gdb = {
+ EXT_LANG_GDB, "gdb", "GDB",
/* We fall back to interpreting a script as a GDB script if it doesn't
match the other scripting languages, but for consistency's sake
give it a formal suffix. */
- ".gdb",
- "-gdb.gdb",
+ ".gdb", "-gdb.gdb",
/* cli_control_type: This is never used: GDB's own scripting language
has a variety of control types (if, while, etc.). */
@@ -83,12 +76,12 @@ const struct extension_language_defn extension_language_gdb =
pretty-printed value is the one that is used. This algorithm is employed
throughout. */
-static const std::array<const extension_language_defn *, 2> extension_languages
-{
- /* To preserve existing behaviour, python should always appear first. */
- &extension_language_python,
- &extension_language_guile,
-};
+static const std::array<const extension_language_defn *, 2>
+ extension_languages {
+ /* To preserve existing behaviour, python should always appear first. */
+ &extension_language_python,
+ &extension_language_guile,
+ };
/* Return a pointer to the struct extension_language_defn object of
extension language LANG.
@@ -173,18 +166,18 @@ ext_lang_initialized_p (const struct extension_language_defn *extlang)
void
throw_ext_lang_unsupported (const struct extension_language_defn *extlang)
{
- error (_("Scripting in the \"%s\" language is not supported"
- " in this copy of GDB."),
+ error (_ ("Scripting in the \"%s\" language is not supported"
+ " in this copy of GDB."),
ext_lang_capitalized_name (extlang));
}
-
+
/* Methods for GDB's own extension/scripting language. */
/* The extension_language_script_ops.script_sourcer "method". */
static void
-source_gdb_script (const struct extension_language_defn *extlang,
- FILE *stream, const char *file)
+source_gdb_script (const struct extension_language_defn *extlang, FILE *stream,
+ const char *file)
{
script_from_file (stream, file);
}
@@ -193,12 +186,12 @@ source_gdb_script (const struct extension_language_defn *extlang,
static void
source_gdb_objfile_script (const struct extension_language_defn *extlang,
- struct objfile *objfile,
- FILE *stream, const char *file)
+ struct objfile *objfile, FILE *stream,
+ const char *file)
{
script_from_file (stream, file);
}
-
+
/* Accessors for "public" attributes of struct extension_language. */
/* Return the "name" field of EXTLANG. */
@@ -232,7 +225,7 @@ ext_lang_auto_load_suffix (const struct extension_language_defn *extlang)
{
return extlang->auto_load_suffix;
}
-
+
/* extension_language_script_ops wrappers. */
/* Return the script "sourcer" function for EXTLANG.
@@ -274,8 +267,8 @@ ext_lang_objfile_script_sourcer (const struct extension_language_defn *extlang)
The extension language is not required to implement this function. */
objfile_script_executor_func *
-ext_lang_objfile_script_executor
- (const struct extension_language_defn *extlang)
+ext_lang_objfile_script_executor (
+ const struct extension_language_defn *extlang)
{
if (extlang->script_ops == NULL)
return NULL;
@@ -296,22 +289,20 @@ ext_lang_auto_load_enabled (const struct extension_language_defn *extlang)
return extlang->script_ops->auto_load_enabled (extlang);
}
-
/* RAII class used to temporarily return SIG to its default handler. */
template<int SIG>
struct scoped_default_signal
{
- scoped_default_signal ()
- { m_old_sig_handler = signal (SIG, SIG_DFL); }
+ scoped_default_signal () { m_old_sig_handler = signal (SIG, SIG_DFL); }
- ~scoped_default_signal ()
- { signal (SIG, m_old_sig_handler); }
+ ~scoped_default_signal () { signal (SIG, m_old_sig_handler); }
DISABLE_COPY_AND_ASSIGN (scoped_default_signal);
private:
+
/* The previous signal handler that needs to be restored. */
sighandler_t m_old_sig_handler;
};
@@ -332,8 +323,7 @@ ext_lang_initialization (void)
{
for (const struct extension_language_defn *extlang : extension_languages)
{
- if (extlang->ops != nullptr
- && extlang->ops->initialize != NULL)
+ if (extlang->ops != nullptr && extlang->ops->initialize != NULL)
{
scoped_default_sigint set_sigint_to_default_handler;
extlang->ops->initialize (extlang);
@@ -388,12 +378,11 @@ auto_load_ext_lang_scripts_for_objfile (struct objfile *objfile)
for (const struct extension_language_defn *extlang : extension_languages)
{
- if (extlang->ops != nullptr
- && ext_lang_auto_load_enabled (extlang))
+ if (extlang->ops != nullptr && ext_lang_auto_load_enabled (extlang))
auto_load_objfile_script (objfile, extlang);
}
}
-
+
/* Interface to type pretty-printers implemented in an extension language. */
/* Call this at the start when preparing to pretty-print a type.
@@ -407,8 +396,7 @@ ext_lang_type_printers::ext_lang_type_printers ()
{
for (const struct extension_language_defn *extlang : extension_languages)
{
- if (extlang->ops != nullptr
- && extlang->ops->start_type_printers != NULL)
+ if (extlang->ops != nullptr && extlang->ops->start_type_printers != NULL)
extlang->ops->start_type_printers (extlang, this);
}
}
@@ -427,11 +415,10 @@ apply_ext_lang_type_printers (struct ext_lang_type_printers *printers,
char *result = NULL;
enum ext_lang_rc rc;
- if (extlang->ops == nullptr
- || extlang->ops->apply_type_printers == NULL)
+ if (extlang->ops == nullptr || extlang->ops->apply_type_printers == NULL)
continue;
- rc = extlang->ops->apply_type_printers (extlang, printers, type,
- &result);
+ rc
+ = extlang->ops->apply_type_printers (extlang, printers, type, &result);
switch (rc)
{
case EXT_LANG_RC_OK:
@@ -453,12 +440,11 @@ ext_lang_type_printers::~ext_lang_type_printers ()
{
for (const struct extension_language_defn *extlang : extension_languages)
{
- if (extlang->ops != nullptr
- && extlang->ops->free_type_printers != NULL)
+ if (extlang->ops != nullptr && extlang->ops->free_type_printers != NULL)
extlang->ops->free_type_printers (extlang, this);
}
}
-
+
/* Try to pretty-print a value onto stdio stream STREAM according to
OPTIONS. VAL is the object to print. Returns non-zero if the
value was successfully pretty-printed.
@@ -474,8 +460,8 @@ ext_lang_type_printers::~ext_lang_type_printers ()
errors that trigger an exception in the extension language. */
int
-apply_ext_lang_val_pretty_printer (struct value *val,
- struct ui_file *stream, int recurse,
+apply_ext_lang_val_pretty_printer (struct value *val, struct ui_file *stream,
+ int recurse,
const struct value_print_options *options,
const struct language_defn *language)
{
@@ -525,22 +511,19 @@ apply_ext_lang_val_pretty_printer (struct value *val,
rather than trying filters in other extension languages. */
enum ext_lang_bt_status
-apply_ext_lang_frame_filter (frame_info_ptr frame,
- frame_filter_flags flags,
+apply_ext_lang_frame_filter (frame_info_ptr frame, frame_filter_flags flags,
enum ext_lang_frame_args args_type,
- struct ui_out *out,
- int frame_low, int frame_high)
+ struct ui_out *out, int frame_low, int frame_high)
{
for (const struct extension_language_defn *extlang : extension_languages)
{
enum ext_lang_bt_status status;
- if (extlang->ops == nullptr
- || extlang->ops->apply_frame_filter == NULL)
+ if (extlang->ops == nullptr || extlang->ops->apply_frame_filter == NULL)
continue;
- status = extlang->ops->apply_frame_filter (extlang, frame, flags,
- args_type, out,
- frame_low, frame_high);
+ status
+ = extlang->ops->apply_frame_filter (extlang, frame, flags, args_type,
+ out, frame_low, frame_high);
/* We use the filters from the first extension language that has
applicable filters. Also, an error is reported immediately
rather than continue trying. */
@@ -564,8 +547,7 @@ preserve_ext_lang_values (struct objfile *objfile, htab_t copied_types)
{
for (const struct extension_language_defn *extlang : extension_languages)
{
- if (extlang->ops != nullptr
- && extlang->ops->preserve_values != NULL)
+ if (extlang->ops != nullptr && extlang->ops->preserve_values != NULL)
extlang->ops->preserve_values (extlang, objfile, copied_types);
}
}
@@ -585,8 +567,7 @@ get_breakpoint_cond_ext_lang (struct breakpoint *b,
{
for (const struct extension_language_defn *extlang : extension_languages)
{
- if (extlang->ops != nullptr
- && extlang->language != skip_lang
+ if (extlang->ops != nullptr && extlang->language != skip_lang
&& extlang->ops->breakpoint_has_cond != NULL
&& extlang->ops->breakpoint_has_cond (extlang, b))
return extlang;
@@ -629,7 +610,7 @@ breakpoint_ext_lang_cond_says_stop (struct breakpoint *b)
return stop != EXT_LANG_BP_STOP_NO;
}
-
+
/* ^C/SIGINT support.
This requires cooperation with the extension languages so the support
is defined here. */
@@ -684,7 +665,8 @@ install_gdb_sigint_handler (struct signal_handler *previous)
}
#if GDB_SELF_TEST
-namespace selftests {
+namespace selftests
+{
void (*hook_set_active_ext_lang) () = nullptr;
}
#endif
@@ -808,8 +790,7 @@ check_quit_flag (void)
for (const struct extension_language_defn *extlang : extension_languages)
{
- if (extlang->ops != nullptr
- && extlang->ops->check_quit_flag != NULL)
+ if (extlang->ops != nullptr && extlang->ops->check_quit_flag != NULL)
if (extlang->ops->check_quit_flag (extlang) != 0)
result = 1;
}
@@ -844,12 +825,12 @@ get_matching_xmethod_workers (struct type *type, const char *method_name,
|| extlang->ops->get_matching_xmethod_workers == NULL)
continue;
- rc = extlang->ops->get_matching_xmethod_workers (extlang,
- type, method_name,
- workers);
+ rc = extlang->ops->get_matching_xmethod_workers (extlang, type,
+ method_name, workers);
if (rc == EXT_LANG_RC_ERROR)
- error (_("Error while looking for matching xmethod workers "
- "defined in %s."), extlang->capitalized_name);
+ error (_ ("Error while looking for matching xmethod workers "
+ "defined in %s."),
+ extlang->capitalized_name);
}
}
@@ -862,8 +843,9 @@ xmethod_worker::get_arg_types ()
ext_lang_rc rc = do_get_arg_types (&type_array);
if (rc == EXT_LANG_RC_ERROR)
- error (_("Error while looking for arg types of a xmethod worker "
- "defined in %s."), m_extlang->capitalized_name);
+ error (_ ("Error while looking for arg types of a xmethod worker "
+ "defined in %s."),
+ m_extlang->capitalized_name);
return type_array;
}
@@ -878,8 +860,9 @@ xmethod_worker::get_result_type (value *object, gdb::array_view<value *> args)
ext_lang_rc rc = do_get_result_type (object, args, &result_type);
if (rc == EXT_LANG_RC_ERROR)
{
- error (_("Error while fetching result type of an xmethod worker "
- "defined in %s."), m_extlang->capitalized_name);
+ error (_ ("Error while fetching result type of an xmethod worker "
+ "defined in %s."),
+ m_extlang->capitalized_name);
}
return result_type;
@@ -894,8 +877,7 @@ ext_lang_colorize (const std::string &filename, const std::string &contents)
for (const struct extension_language_defn *extlang : extension_languages)
{
- if (extlang->ops == nullptr
- || extlang->ops->colorize == nullptr)
+ if (extlang->ops == nullptr || extlang->ops->colorize == nullptr)
continue;
result = extlang->ops->colorize (filename, contents);
if (result.has_value ())
@@ -914,8 +896,7 @@ ext_lang_colorize_disasm (const std::string &content, gdbarch *gdbarch)
for (const struct extension_language_defn *extlang : extension_languages)
{
- if (extlang->ops == nullptr
- || extlang->ops->colorize_disasm == nullptr)
+ if (extlang->ops == nullptr || extlang->ops->colorize_disasm == nullptr)
continue;
result = extlang->ops->colorize_disasm (content, gdbarch);
if (result.has_value ())
@@ -933,8 +914,7 @@ ext_lang_print_insn (struct gdbarch *gdbarch, CORE_ADDR address,
{
for (const struct extension_language_defn *extlang : extension_languages)
{
- if (extlang->ops == nullptr
- || extlang->ops->print_insn == nullptr)
+ if (extlang->ops == nullptr || extlang->ops->print_insn == nullptr)
continue;
gdb::optional<int> length
= extlang->ops->print_insn (gdbarch, address, info);
@@ -957,8 +937,7 @@ ext_lang_before_prompt (const char *current_gdb_prompt)
{
enum ext_lang_rc rc;
- if (extlang->ops == nullptr
- || extlang->ops->before_prompt == NULL)
+ if (extlang->ops == nullptr || extlang->ops->before_prompt == NULL)
continue;
rc = extlang->ops->before_prompt (extlang, current_gdb_prompt);
switch (rc)
@@ -975,6 +954,7 @@ ext_lang_before_prompt (const char *current_gdb_prompt)
}
void _initialize_extension ();
+
void
_initialize_extension ()
{
diff --git a/gdb/extension.h b/gdb/extension.h
index c7d1df2629f..a903c00f565 100644
--- a/gdb/extension.h
+++ b/gdb/extension.h
@@ -45,65 +45,67 @@ typedef void script_sourcer_func (const struct extension_language_defn *,
/* A function to load and process a script for an objfile.
The file has been opened and is ready to be read from the beginning.
Any exceptions are not caught, and are passed to the caller. */
-typedef void objfile_script_sourcer_func
- (const struct extension_language_defn *,
- struct objfile *, FILE *stream, const char *filename);
+typedef void
+objfile_script_sourcer_func (const struct extension_language_defn *,
+ struct objfile *, FILE *stream,
+ const char *filename);
/* A function to execute a script for an objfile.
Any exceptions are not caught, and are passed to the caller. */
-typedef void objfile_script_executor_func
- (const struct extension_language_defn *,
- struct objfile *, const char *name, const char *script);
+typedef void
+objfile_script_executor_func (const struct extension_language_defn *,
+ struct objfile *, const char *name,
+ const char *script);
/* Enum of each extension(/scripting) language. */
enum extension_language
- {
- EXT_LANG_NONE,
- EXT_LANG_GDB,
- EXT_LANG_PYTHON,
- EXT_LANG_GUILE
- };
+{
+ EXT_LANG_NONE,
+ EXT_LANG_GDB,
+ EXT_LANG_PYTHON,
+ EXT_LANG_GUILE
+};
/* Extension language frame-filter status return values. */
enum ext_lang_bt_status
- {
- /* Return when an error has occurred in processing frame filters,
+{
+ /* Return when an error has occurred in processing frame filters,
or when printing the stack. */
- EXT_LANG_BT_ERROR = -1,
+ EXT_LANG_BT_ERROR = -1,
- /* Return from internal routines to indicate that the function
+ /* Return from internal routines to indicate that the function
succeeded. */
- EXT_LANG_BT_OK = 1,
+ EXT_LANG_BT_OK = 1,
- /* Return when the frame filter process is complete, but there
+ /* Return when the frame filter process is complete, but there
were no filter registered and enabled to process. */
- EXT_LANG_BT_NO_FILTERS = 2
- };
+ EXT_LANG_BT_NO_FILTERS = 2
+};
/* Flags to pass to apply_extlang_frame_filter. */
enum frame_filter_flag
- {
- /* Set this flag if frame level is to be printed. */
- PRINT_LEVEL = 1 << 0,
+{
+ /* Set this flag if frame level is to be printed. */
+ PRINT_LEVEL = 1 << 0,
- /* Set this flag if frame information is to be printed. */
- PRINT_FRAME_INFO = 1 << 1,
+ /* Set this flag if frame information is to be printed. */
+ PRINT_FRAME_INFO = 1 << 1,
- /* Set this flag if frame arguments are to be printed. */
- PRINT_ARGS = 1 << 2,
+ /* Set this flag if frame arguments are to be printed. */
+ PRINT_ARGS = 1 << 2,
- /* Set this flag if frame locals are to be printed. */
- PRINT_LOCALS = 1 << 3,
+ /* Set this flag if frame locals are to be printed. */
+ PRINT_LOCALS = 1 << 3,
- /* Set this flag if a "More frames" message is to be printed. */
- PRINT_MORE_FRAMES = 1 << 4,
+ /* Set this flag if a "More frames" message is to be printed. */
+ PRINT_MORE_FRAMES = 1 << 4,
- /* Set this flag if elided frames should not be printed. */
- PRINT_HIDE = 1 << 5,
- };
+ /* Set this flag if elided frames should not be printed. */
+ PRINT_HIDE = 1 << 5,
+};
DEF_ENUM_FLAGS_TYPE (enum frame_filter_flag, frame_filter_flags);
@@ -111,40 +113,40 @@ DEF_ENUM_FLAGS_TYPE (enum frame_filter_flag, frame_filter_flags);
can occur in different cases of frame filter instantiation. */
enum ext_lang_frame_args
- {
- /* Print no values for arguments when invoked from the MI. */
- NO_VALUES = PRINT_NO_VALUES,
+{
+ /* Print no values for arguments when invoked from the MI. */
+ NO_VALUES = PRINT_NO_VALUES,
- MI_PRINT_ALL_VALUES = PRINT_ALL_VALUES,
+ MI_PRINT_ALL_VALUES = PRINT_ALL_VALUES,
- /* Print only simple values (what MI defines as "simple") for
+ /* Print only simple values (what MI defines as "simple") for
arguments when invoked from the MI. */
- MI_PRINT_SIMPLE_VALUES = PRINT_SIMPLE_VALUES,
+ MI_PRINT_SIMPLE_VALUES = PRINT_SIMPLE_VALUES,
- /* Print only scalar values for arguments when invoked from the CLI. */
- CLI_SCALAR_VALUES,
+ /* Print only scalar values for arguments when invoked from the CLI. */
+ CLI_SCALAR_VALUES,
- /* Print all values for arguments when invoked from the CLI. */
- CLI_ALL_VALUES,
+ /* Print all values for arguments when invoked from the CLI. */
+ CLI_ALL_VALUES,
- /* Only indicate the presence of arguments when invoked from the CLI. */
- CLI_PRESENCE
- };
+ /* Only indicate the presence of arguments when invoked from the CLI. */
+ CLI_PRESENCE
+};
/* The possible results of
extension_language_ops.breakpoint_cond_says_stop. */
enum ext_lang_bp_stop
- {
- /* No "stop" condition is set. */
- EXT_LANG_BP_STOP_UNSET,
+{
+ /* No "stop" condition is set. */
+ EXT_LANG_BP_STOP_UNSET,
- /* A "stop" condition is set, and it says "don't stop". */
- EXT_LANG_BP_STOP_NO,
+ /* A "stop" condition is set, and it says "don't stop". */
+ EXT_LANG_BP_STOP_NO,
- /* A "stop" condition is set, and it says "stop". */
- EXT_LANG_BP_STOP_YES
- };
+ /* A "stop" condition is set, and it says "stop". */
+ EXT_LANG_BP_STOP_YES
+};
/* Table of type printers associated with the global typedef table. */
@@ -184,8 +186,9 @@ enum ext_lang_rc
struct xmethod_worker
{
xmethod_worker (const extension_language_defn *extlang)
- : m_extlang (extlang)
- {}
+ : m_extlang (extlang)
+ {
+ }
virtual ~xmethod_worker () = default;
@@ -210,16 +213,17 @@ private:
/* Return the types of the arguments the method takes. The types
are returned in TYPE_ARGS, one per argument. */
- virtual enum ext_lang_rc do_get_arg_types
- (std::vector<type *> *type_args) = 0;
+ virtual enum ext_lang_rc do_get_arg_types (std::vector<type *> *type_args)
+ = 0;
/* Fetch the type of the result of the method implemented by this
worker. OBJECT and ARGS are the same as for the invoked method.
The result type is stored in *RESULT_TYPE. */
- virtual enum ext_lang_rc do_get_result_type
- (struct value *obj, gdb::array_view<value *> args,
- struct type **result_type_ptr) = 0;
+ virtual enum ext_lang_rc do_get_result_type (struct value *obj,
+ gdb::array_view<value *> args,
+ struct type **result_type_ptr)
+ = 0;
/* The language the xmethod worker is implemented in. */
@@ -231,47 +235,48 @@ typedef std::unique_ptr<xmethod_worker> xmethod_worker_up;
/* The interface for gdb's own extension(/scripting) language. */
extern const struct extension_language_defn extension_language_gdb;
-extern const struct extension_language_defn *get_ext_lang_defn
- (enum extension_language lang);
+extern const struct extension_language_defn *
+get_ext_lang_defn (enum extension_language lang);
-extern const struct extension_language_defn *get_ext_lang_of_file
- (const char *file);
+extern const struct extension_language_defn *
+get_ext_lang_of_file (const char *file);
extern int ext_lang_present_p (const struct extension_language_defn *);
extern int ext_lang_initialized_p (const struct extension_language_defn *);
-extern void throw_ext_lang_unsupported
- (const struct extension_language_defn *);
+extern void
+throw_ext_lang_unsupported (const struct extension_language_defn *);
/* Accessors for "public" attributes of the extension language definition. */
-extern enum extension_language ext_lang_kind
- (const struct extension_language_defn *);
+extern enum extension_language
+ext_lang_kind (const struct extension_language_defn *);
extern const char *ext_lang_name (const struct extension_language_defn *);
-extern const char *ext_lang_capitalized_name
- (const struct extension_language_defn *);
+extern const char *
+ext_lang_capitalized_name (const struct extension_language_defn *);
extern const char *ext_lang_suffix (const struct extension_language_defn *);
-extern const char *ext_lang_auto_load_suffix
- (const struct extension_language_defn *);
+extern const char *
+ext_lang_auto_load_suffix (const struct extension_language_defn *);
-extern script_sourcer_func *ext_lang_script_sourcer
- (const struct extension_language_defn *);
+extern script_sourcer_func *
+ext_lang_script_sourcer (const struct extension_language_defn *);
-extern objfile_script_sourcer_func *ext_lang_objfile_script_sourcer
- (const struct extension_language_defn *);
+extern objfile_script_sourcer_func *
+ext_lang_objfile_script_sourcer (const struct extension_language_defn *);
-extern objfile_script_executor_func *ext_lang_objfile_script_executor
- (const struct extension_language_defn *);
+extern objfile_script_executor_func *
+ext_lang_objfile_script_executor (const struct extension_language_defn *);
/* Return true if auto-loading of EXTLANG scripts is enabled.
False is returned if support for this language isn't compiled in. */
-extern bool ext_lang_auto_load_enabled (const struct extension_language_defn *);
+extern bool
+ext_lang_auto_load_enabled (const struct extension_language_defn *);
/* Wrappers for each extension language API function that iterate over all
extension languages. */
@@ -285,20 +290,23 @@ extern void auto_load_ext_lang_scripts_for_objfile (struct objfile *);
extern char *apply_ext_lang_type_printers (struct ext_lang_type_printers *,
struct type *);
-extern int apply_ext_lang_val_pretty_printer
- (struct value *value, struct ui_file *stream, int recurse,
- const struct value_print_options *options,
- const struct language_defn *language);
+extern int
+apply_ext_lang_val_pretty_printer (struct value *value, struct ui_file *stream,
+ int recurse,
+ const struct value_print_options *options,
+ const struct language_defn *language);
-extern enum ext_lang_bt_status apply_ext_lang_frame_filter
- (frame_info_ptr frame, frame_filter_flags flags,
- enum ext_lang_frame_args args_type,
- struct ui_out *out, int frame_low, int frame_high);
+extern enum ext_lang_bt_status
+apply_ext_lang_frame_filter (frame_info_ptr frame, frame_filter_flags flags,
+ enum ext_lang_frame_args args_type,
+ struct ui_out *out, int frame_low,
+ int frame_high);
extern void preserve_ext_lang_values (struct objfile *, htab_t copied_types);
-extern const struct extension_language_defn *get_breakpoint_cond_ext_lang
- (struct breakpoint *b, enum extension_language skip_lang);
+extern const struct extension_language_defn *
+get_breakpoint_cond_ext_lang (struct breakpoint *b,
+ enum extension_language skip_lang);
extern bool breakpoint_ext_lang_cond_says_stop (struct breakpoint *);
@@ -307,25 +315,25 @@ extern bool breakpoint_ext_lang_cond_says_stop (struct breakpoint *);
methods with name METHOD_NAME. All matches found are appended to the WORKERS
vector. */
-extern void get_matching_xmethod_workers
- (struct type *type, const char *method_name,
- std::vector<xmethod_worker_up> *workers);
+extern void
+get_matching_xmethod_workers (struct type *type, const char *method_name,
+ std::vector<xmethod_worker_up> *workers);
/* Try to colorize some source code. FILENAME is the name of the file
holding the code. CONTENTS is the source code itself. This will
either a colorized (using ANSI terminal escapes) version of the
source code, or an empty value if colorizing could not be done. */
-extern gdb::optional<std::string> ext_lang_colorize
- (const std::string &filename, const std::string &contents);
+extern gdb::optional<std::string>
+ext_lang_colorize (const std::string &filename, const std::string &contents);
/* Try to colorize a single line of disassembler output, CONTENT for
GDBARCH. This will return either a colorized (using ANSI terminal
escapes) version of CONTENT, or an empty value if colorizing could not
be done. */
-extern gdb::optional<std::string> ext_lang_colorize_disasm
- (const std::string &content, gdbarch *gdbarch);
+extern gdb::optional<std::string>
+ext_lang_colorize_disasm (const std::string &content, gdbarch *gdbarch);
/* Calls extension_language_ops::print_insn for each extension language,
returning the result from the first extension language that returns a
@@ -334,11 +342,13 @@ extern gdb::optional<std::string> ext_lang_colorize_disasm
All arguments are forwarded to extension_language_ops::print_insn, see
that function for a full description. */
-extern gdb::optional<int> ext_lang_print_insn
- (struct gdbarch *gdbarch, CORE_ADDR address, struct disassemble_info *info);
+extern gdb::optional<int> ext_lang_print_insn (struct gdbarch *gdbarch,
+ CORE_ADDR address,
+ struct disassemble_info *info);
#if GDB_SELF_TEST
-namespace selftests {
+namespace selftests
+{
extern void (*hook_set_active_ext_lang) ();
}
#endif
diff --git a/gdb/f-array-walker.h b/gdb/f-array-walker.h
index 5e52eaf038c..5a6691e1895 100644
--- a/gdb/f-array-walker.h
+++ b/gdb/f-array-walker.h
@@ -30,6 +30,7 @@
class fortran_array_offset_calculator
{
public:
+
/* Create a new offset calculator for TYPE, which is either an array or a
string. */
explicit fortran_array_offset_calculator (struct type *type)
@@ -38,7 +39,7 @@ public:
type = check_typedef (type);
if (type->code () != TYPE_CODE_ARRAY
&& (type->code () != TYPE_CODE_STRING))
- error (_("can only compute offsets for arrays and strings"));
+ error (_ ("can only compute offsets for arrays and strings"));
/* Get the range, and extract the bounds. */
struct type *range_type = type->index_type ();
@@ -111,8 +112,7 @@ struct fortran_array_walker_base_impl
SHOULD_CONTINUE is false then this function must also return false,
the function is still called though in case extra work needs to be
done as part of the stopping process. */
- bool continue_walking (bool should_continue)
- { return should_continue; }
+ bool continue_walking (bool should_continue) { return should_continue; }
/* Called when GDB starts iterating over a dimension of the array. The
argument INDEX_TYPE is the type of the index used to address elements
@@ -122,7 +122,8 @@ struct fortran_array_walker_base_impl
For a concrete example of how this function is called see the comment
on process_element below. */
void start_dimension (struct type *index_type, LONGEST nelts, bool inner_p)
- { /* Nothing. */ }
+ { /* Nothing. */
+ }
/* Called when GDB finishes iterating over a dimension of the array. The
argument INNER_P is true for the inner most dimension (the dimension
@@ -131,7 +132,8 @@ struct fortran_array_walker_base_impl
dimension. For a concrete example of how this function is called
see the comment on process_element below. */
void finish_dimension (bool inner_p, bool last_p)
- { /* Nothing. */ }
+ { /* Nothing. */
+ }
/* Called when processing dimensions of the array other than the
innermost one. WALK_1 is the walker to normally call, ELT_TYPE is
@@ -140,10 +142,9 @@ struct fortran_array_walker_base_impl
value of the index the current element is at in the upper dimension.
Finally LAST_P is true only when this is the last element that will
be processed in this dimension. */
- void process_dimension (gdb::function_view<void (struct type *,
- int, bool)> walk_1,
- struct type *elt_type, LONGEST elt_off,
- LONGEST index, bool last_p)
+ void process_dimension (
+ gdb::function_view<void (struct type *, int, bool)> walk_1,
+ struct type *elt_type, LONGEST elt_off, LONGEST index, bool last_p)
{
walk_1 (elt_type, elt_off, last_p);
}
@@ -172,9 +173,10 @@ struct fortran_array_walker_base_impl
process_element (TYPE, OFFSET, true);
finish_dimension (true, true);
finish_dimension (false, true); */
- void process_element (struct type *elt_type, LONGEST elt_off,
- LONGEST index, bool last_p)
- { /* Nothing. */ }
+ void process_element (struct type *elt_type, LONGEST elt_off, LONGEST index,
+ bool last_p)
+ { /* Nothing. */
+ }
};
/* A class to wrap up the process of iterating over a multi-dimensional
@@ -187,36 +189,34 @@ class fortran_array_walker
/* Ensure that Impl is derived from the required base class. This just
ensures that all of the required API methods are available and have a
sensible default implementation. */
- gdb_static_assert ((std::is_base_of<fortran_array_walker_base_impl,Impl>::value));
+ gdb_static_assert (
+ (std::is_base_of<fortran_array_walker_base_impl, Impl>::value));
public:
+
/* Create a new array walker. TYPE is the type of the array being walked
over, and ADDRESS is the base address for the object of TYPE in
memory. All other arguments are forwarded to the constructor of the
template parameter class IMPL. */
- template <typename ...Args>
- fortran_array_walker (struct type *type, CORE_ADDR address,
- Args... args)
+ template<typename... Args>
+ fortran_array_walker (struct type *type, CORE_ADDR address, Args... args)
: m_type (type),
m_address (address),
m_impl (type, address, args...),
m_ndimensions (calc_f77_array_dims (m_type)),
m_nss (0)
- { /* Nothing. */ }
+ { /* Nothing. */
+ }
/* Walk the array. */
- void
- walk ()
- {
- walk_1 (m_type, 0, false);
- }
+ void walk () { walk_1 (m_type, 0, false); }
private:
+
/* The core of the array walking algorithm. TYPE is the type of
the current dimension being processed and OFFSET is the offset
(in bytes) for the start of this dimension. */
- void
- walk_1 (struct type *type, int offset, bool last_p)
+ void walk_1 (struct type *type, int offset, bool last_p)
{
/* Extract the range, and get lower and upper bounds. */
struct type *range_type = check_typedef (type)->index_type ();
@@ -241,19 +241,16 @@ private:
/* For dimensions other than the inner most, walk each element and
recurse while peeling off one more dimension of the array. */
for (LONGEST i = lowerbound;
- m_impl.continue_walking (i < upperbound + 1);
- i++)
+ m_impl.continue_walking (i < upperbound + 1); i++)
{
/* Use the index and the stride to work out a new offset. */
LONGEST new_offset = offset + calc.index_offset (i);
/* Now print the lower dimension. */
- m_impl.process_dimension
- ([this] (struct type *w_type, int w_offset, bool w_last_p) -> void
- {
- this->walk_1 (w_type, w_offset, w_last_p);
- },
- subarray_type, new_offset, i, i == upperbound);
+ m_impl.process_dimension (
+ [this] (struct type *w_type, int w_offset, bool w_last_p)
+ -> void { this->walk_1 (w_type, w_offset, w_last_p); },
+ subarray_type, new_offset, i, i == upperbound);
}
}
else
@@ -263,8 +260,7 @@ private:
/* For the inner most dimension of the array, process each element
within this dimension. */
for (LONGEST i = lowerbound;
- m_impl.continue_walking (i < upperbound + 1);
- i++)
+ m_impl.continue_walking (i < upperbound + 1); i++)
{
LONGEST elt_off = offset + calc.index_offset (i);
diff --git a/gdb/f-exp.h b/gdb/f-exp.h
index 0c3bc8bfd21..0ce23a04db2 100644
--- a/gdb/f-exp.h
+++ b/gdb/f-exp.h
@@ -23,15 +23,13 @@
#include "expop.h"
extern struct value *eval_op_f_abs (struct type *expect_type,
- struct expression *exp,
- enum noside noside,
+ struct expression *exp, enum noside noside,
enum exp_opcode opcode,
struct value *arg1);
extern struct value *eval_op_f_mod (struct type *expect_type,
- struct expression *exp,
- enum noside noside,
- enum exp_opcode opcode,
- struct value *arg1, struct value *arg2);
+ struct expression *exp, enum noside noside,
+ enum exp_opcode opcode, struct value *arg1,
+ struct value *arg2);
/* Implement expression evaluation for Fortran's CEILING intrinsic function
called with one argument. For EXPECT_TYPE, EXP, and NOSIDE see
@@ -121,22 +119,18 @@ extern struct value *eval_op_f_associated (struct type *expect_type,
enum noside noside,
enum exp_opcode opcode,
struct value *arg1);
-extern struct value *eval_op_f_associated (struct type *expect_type,
- struct expression *exp,
- enum noside noside,
- enum exp_opcode opcode,
- struct value *arg1,
- struct value *arg2);
-extern struct value * eval_op_f_allocated (struct type *expect_type,
- struct expression *exp,
- enum noside noside,
- enum exp_opcode op,
- struct value *arg1);
-extern struct value * eval_op_f_loc (struct type *expect_type,
- struct expression *exp,
- enum noside noside,
- enum exp_opcode op,
- struct value *arg1);
+extern struct value *
+eval_op_f_associated (struct type *expect_type, struct expression *exp,
+ enum noside noside, enum exp_opcode opcode,
+ struct value *arg1, struct value *arg2);
+extern struct value *eval_op_f_allocated (struct type *expect_type,
+ struct expression *exp,
+ enum noside noside,
+ enum exp_opcode op,
+ struct value *arg1);
+extern struct value *eval_op_f_loc (struct type *expect_type,
+ struct expression *exp, enum noside noside,
+ enum exp_opcode op, struct value *arg1);
/* Implement the evaluation of UNOP_FORTRAN_RANK. EXPECTED_TYPE, EXP, and
NOSIDE are as for expression::evaluate (see expression.h). OP will
@@ -145,8 +139,7 @@ extern struct value * eval_op_f_loc (struct type *expect_type,
extern struct value *eval_op_f_rank (struct type *expect_type,
struct expression *exp,
- enum noside noside,
- enum exp_opcode op,
+ enum noside noside, enum exp_opcode op,
struct value *arg1);
/* Implement expression evaluation for Fortran's SIZE keyword. For
@@ -165,12 +158,10 @@ extern struct value *eval_op_f_array_size (struct type *expect_type,
arguments, representing the two values passed to Fortran's SIZE
keyword. */
-extern struct value *eval_op_f_array_size (struct type *expect_type,
- struct expression *exp,
- enum noside noside,
- enum exp_opcode opcode,
- struct value *arg1,
- struct value *arg2);
+extern struct value *
+eval_op_f_array_size (struct type *expect_type, struct expression *exp,
+ enum noside noside, enum exp_opcode opcode,
+ struct value *arg1, struct value *arg2);
/* Implement expression evaluation for Fortran's SIZE intrinsic function called
with three arguments. For EXPECT_TYPE, EXP, and NOSIDE see
@@ -204,8 +195,7 @@ typedef value *binary_kind_ftype (type *expect_type, expression *exp,
/* Two-argument operation with the second argument being a kind argument. */
template<exp_opcode OP, binary_kind_ftype FUNC>
-class fortran_kind_2arg
- : public tuple_holding_operation<operation_up, type*>
+class fortran_kind_2arg : public tuple_holding_operation<operation_up, type *>
{
public:
@@ -218,8 +208,7 @@ public:
return FUNC (expect_type, exp, noside, OP, arg1, kind_arg);
}
- exp_opcode opcode () const override
- { return OP; }
+ exp_opcode opcode () const override { return OP; }
};
/* Function prototype for Fortran intrinsic functions taking two arguments and
@@ -245,49 +234,47 @@ public:
return FUNC (expect_type, exp, noside, OP, arg1, arg2, kind_arg);
}
- exp_opcode opcode () const override
- { return OP; }
+ exp_opcode opcode () const override { return OP; }
};
using fortran_abs_operation = unop_operation<UNOP_ABS, eval_op_f_abs>;
-using fortran_ceil_operation_1arg = unop_operation<FORTRAN_CEILING,
- eval_op_f_ceil>;
-using fortran_ceil_operation_2arg = fortran_kind_2arg<FORTRAN_CEILING,
- eval_op_f_ceil>;
-using fortran_floor_operation_1arg = unop_operation<FORTRAN_FLOOR,
- eval_op_f_floor>;
-using fortran_floor_operation_2arg = fortran_kind_2arg<FORTRAN_FLOOR,
- eval_op_f_floor>;
-using fortran_kind_operation = unop_operation<UNOP_FORTRAN_KIND,
- eval_op_f_kind>;
-using fortran_allocated_operation = unop_operation<UNOP_FORTRAN_ALLOCATED,
- eval_op_f_allocated>;
-using fortran_loc_operation = unop_operation<UNOP_FORTRAN_LOC,
- eval_op_f_loc>;
+using fortran_ceil_operation_1arg
+ = unop_operation<FORTRAN_CEILING, eval_op_f_ceil>;
+using fortran_ceil_operation_2arg
+ = fortran_kind_2arg<FORTRAN_CEILING, eval_op_f_ceil>;
+using fortran_floor_operation_1arg
+ = unop_operation<FORTRAN_FLOOR, eval_op_f_floor>;
+using fortran_floor_operation_2arg
+ = fortran_kind_2arg<FORTRAN_FLOOR, eval_op_f_floor>;
+using fortran_kind_operation
+ = unop_operation<UNOP_FORTRAN_KIND, eval_op_f_kind>;
+using fortran_allocated_operation
+ = unop_operation<UNOP_FORTRAN_ALLOCATED, eval_op_f_allocated>;
+using fortran_loc_operation = unop_operation<UNOP_FORTRAN_LOC, eval_op_f_loc>;
using fortran_mod_operation = binop_operation<BINOP_MOD, eval_op_f_mod>;
-using fortran_modulo_operation = binop_operation<BINOP_FORTRAN_MODULO,
- eval_op_f_modulo>;
-using fortran_associated_1arg = unop_operation<FORTRAN_ASSOCIATED,
- eval_op_f_associated>;
-using fortran_associated_2arg = binop_operation<FORTRAN_ASSOCIATED,
- eval_op_f_associated>;
-using fortran_rank_operation = unop_operation<UNOP_FORTRAN_RANK,
- eval_op_f_rank>;
-using fortran_array_size_1arg = unop_operation<FORTRAN_ARRAY_SIZE,
- eval_op_f_array_size>;
-using fortran_array_size_2arg = binop_operation<FORTRAN_ARRAY_SIZE,
- eval_op_f_array_size>;
-using fortran_array_size_3arg = fortran_kind_3arg<FORTRAN_ARRAY_SIZE,
- eval_op_f_array_size>;
-using fortran_array_shape_operation = unop_operation<UNOP_FORTRAN_SHAPE,
- eval_op_f_array_shape>;
-using fortran_cmplx_operation_1arg = unop_operation<FORTRAN_CMPLX,
- eval_op_f_cmplx>;
-using fortran_cmplx_operation_2arg = binop_operation<FORTRAN_CMPLX,
- eval_op_f_cmplx>;
-using fortran_cmplx_operation_3arg = fortran_kind_3arg<FORTRAN_CMPLX,
- eval_op_f_cmplx>;
+using fortran_modulo_operation
+ = binop_operation<BINOP_FORTRAN_MODULO, eval_op_f_modulo>;
+using fortran_associated_1arg
+ = unop_operation<FORTRAN_ASSOCIATED, eval_op_f_associated>;
+using fortran_associated_2arg
+ = binop_operation<FORTRAN_ASSOCIATED, eval_op_f_associated>;
+using fortran_rank_operation
+ = unop_operation<UNOP_FORTRAN_RANK, eval_op_f_rank>;
+using fortran_array_size_1arg
+ = unop_operation<FORTRAN_ARRAY_SIZE, eval_op_f_array_size>;
+using fortran_array_size_2arg
+ = binop_operation<FORTRAN_ARRAY_SIZE, eval_op_f_array_size>;
+using fortran_array_size_3arg
+ = fortran_kind_3arg<FORTRAN_ARRAY_SIZE, eval_op_f_array_size>;
+using fortran_array_shape_operation
+ = unop_operation<UNOP_FORTRAN_SHAPE, eval_op_f_array_shape>;
+using fortran_cmplx_operation_1arg
+ = unop_operation<FORTRAN_CMPLX, eval_op_f_cmplx>;
+using fortran_cmplx_operation_2arg
+ = binop_operation<FORTRAN_CMPLX, eval_op_f_cmplx>;
+using fortran_cmplx_operation_3arg
+ = fortran_kind_3arg<FORTRAN_CMPLX, eval_op_f_cmplx>;
/* OP_RANGE for Fortran. */
class fortran_range_operation
@@ -298,17 +285,13 @@ public:
using tuple_holding_operation::tuple_holding_operation;
- value *evaluate (struct type *expect_type,
- struct expression *exp,
+ value *evaluate (struct type *expect_type, struct expression *exp,
enum noside noside) override
{
- error (_("ranges not allowed in this context"));
+ error (_ ("ranges not allowed in this context"));
}
- range_flag get_flags () const
- {
- return std::get<0> (m_storage);
- }
+ range_flag get_flags () const { return std::get<0> (m_storage); }
value *evaluate0 (struct expression *exp, enum noside noside) const
{
@@ -325,8 +308,7 @@ public:
return std::get<3> (m_storage)->evaluate (nullptr, exp, noside);
}
- enum exp_opcode opcode () const override
- { return OP_RANGE; }
+ enum exp_opcode opcode () const override { return OP_RANGE; }
};
/* In F77, functions, substring ops and array subscript operations
@@ -339,12 +321,13 @@ public:
using tuple_holding_operation::tuple_holding_operation;
- value *evaluate (struct type *expect_type,
- struct expression *exp,
+ value *evaluate (struct type *expect_type, struct expression *exp,
enum noside noside) override;
enum exp_opcode opcode () const override
- { return OP_F77_UNDETERMINED_ARGLIST; }
+ {
+ return OP_F77_UNDETERMINED_ARGLIST;
+ }
private:
@@ -360,12 +343,10 @@ public:
using tuple_holding_operation::tuple_holding_operation;
- value *evaluate (struct type *expect_type,
- struct expression *exp,
+ value *evaluate (struct type *expect_type, struct expression *exp,
enum noside noside) override;
- enum exp_opcode opcode () const override
- { return std::get<0> (m_storage); }
+ enum exp_opcode opcode () const override { return std::get<0> (m_storage); }
};
/* Two-argument form of Fortran ubound/lbound intrinsics. */
@@ -376,12 +357,10 @@ public:
using tuple_holding_operation::tuple_holding_operation;
- value *evaluate (struct type *expect_type,
- struct expression *exp,
+ value *evaluate (struct type *expect_type, struct expression *exp,
enum noside noside) override;
- enum exp_opcode opcode () const override
- { return std::get<0> (m_storage); }
+ enum exp_opcode opcode () const override { return std::get<0> (m_storage); }
};
/* Three-argument form of Fortran ubound/lbound intrinsics. */
@@ -395,24 +374,20 @@ public:
value *evaluate (type *expect_type, expression *exp, noside noside) override;
- exp_opcode opcode () const override
- { return std::get<0> (m_storage); }
+ exp_opcode opcode () const override { return std::get<0> (m_storage); }
};
/* Implement STRUCTOP_STRUCT for Fortran. */
-class fortran_structop_operation
- : public structop_base_operation
+class fortran_structop_operation : public structop_base_operation
{
public:
using structop_base_operation::structop_base_operation;
- value *evaluate (struct type *expect_type,
- struct expression *exp,
+ value *evaluate (struct type *expect_type, struct expression *exp,
enum noside noside) override;
- enum exp_opcode opcode () const override
- { return STRUCTOP_STRUCT; }
+ enum exp_opcode opcode () const override { return STRUCTOP_STRUCT; }
};
} /* namespace expr */
diff --git a/gdb/f-lang.c b/gdb/f-lang.c
index a1e425a2d55..521e45fa81d 100644
--- a/gdb/f-lang.c
+++ b/gdb/f-lang.c
@@ -50,8 +50,7 @@ static void
show_repack_array_slices (struct ui_file *file, int from_tty,
struct cmd_list_element *c, const char *value)
{
- gdb_printf (file, _("Repacking of Fortran array slices is %s.\n"),
- value);
+ gdb_printf (file, _ ("Repacking of Fortran array slices is %s.\n"), value);
}
/* Debugging of Fortran's array slicing. */
@@ -63,16 +62,16 @@ show_fortran_array_slicing_debug (struct ui_file *file, int from_tty,
struct cmd_list_element *c,
const char *value)
{
- gdb_printf (file, _("Debugging of Fortran array slicing is %s.\n"),
- value);
+ gdb_printf (file, _ ("Debugging of Fortran array slicing is %s.\n"), value);
}
/* Local functions */
static value *fortran_prepare_argument (struct expression *exp,
- expr::operation *subexp,
- int arg_num, bool is_internal_call_p,
- struct type *func_type, enum noside noside);
+ expr::operation *subexp, int arg_num,
+ bool is_internal_call_p,
+ struct type *func_type,
+ enum noside noside);
/* Return the encoding that should be used for the character type
TYPE. */
@@ -95,7 +94,7 @@ f_language::get_encoding (struct type *type)
break;
default:
- error (_("unrecognized character type"));
+ error (_ ("unrecognized character type"));
}
return encoding;
@@ -112,9 +111,9 @@ fortran_require_array (struct type *type, bool lbound_p)
if (type->code () != TYPE_CODE_ARRAY)
{
if (lbound_p)
- error (_("LBOUND can only be applied to arrays"));
+ error (_ ("LBOUND can only be applied to arrays"));
else
- error (_("UBOUND can only be applied to arrays"));
+ error (_ ("UBOUND can only be applied to arrays"));
}
}
@@ -123,8 +122,7 @@ fortran_require_array (struct type *type, bool lbound_p)
array type). GDBARCH is the current architecture. */
static struct value *
-fortran_bounds_all_dims (bool lbound_p,
- struct gdbarch *gdbarch,
+fortran_bounds_all_dims (bool lbound_p, struct gdbarch *gdbarch,
struct value *array)
{
type *array_type = check_typedef (value_type (array));
@@ -133,8 +131,8 @@ fortran_bounds_all_dims (bool lbound_p,
/* Allocate a result value of the correct type. */
struct type *range
= create_static_range_type (nullptr,
- builtin_f_type (gdbarch)->builtin_integer,
- 1, ndimensions);
+ builtin_f_type (gdbarch)->builtin_integer, 1,
+ ndimensions);
struct type *elm_type = builtin_f_type (gdbarch)->builtin_integer;
struct type *result_type = create_array_type (nullptr, elm_type, range);
struct value *result = allocate_value (result_type);
@@ -142,8 +140,7 @@ fortran_bounds_all_dims (bool lbound_p,
/* Walk the array dimensions backwards due to the way the array will be
laid out in memory, the first dimension will be the most inner. */
LONGEST elm_len = elm_type->length ();
- for (LONGEST dst_offset = elm_len * (ndimensions - 1);
- dst_offset >= 0;
+ for (LONGEST dst_offset = elm_len * (ndimensions - 1); dst_offset >= 0;
dst_offset -= elm_len)
{
LONGEST b;
@@ -175,7 +172,7 @@ fortran_bounds_all_dims (bool lbound_p,
static value *
fortran_bounds_for_dimension (bool lbound_p, value *array, value *dim_val,
- type* result_type)
+ type *result_type)
{
/* Check the requested dimension is valid for this array. */
type *array_type = check_typedef (value_type (array));
@@ -184,9 +181,9 @@ fortran_bounds_for_dimension (bool lbound_p, value *array, value *dim_val,
if (dim < 1 || dim > ndimensions)
{
if (lbound_p)
- error (_("LBOUND dimension must be from 1 to %d"), ndimensions);
+ error (_ ("LBOUND dimension must be from 1 to %d"), ndimensions);
else
- error (_("UBOUND dimension must be from 1 to %d"), ndimensions);
+ error (_ ("UBOUND dimension must be from 1 to %d"), ndimensions);
}
/* Walk the dimensions backwards, due to the ordering in which arrays are
@@ -226,7 +223,7 @@ calc_f77_array_dims (struct type *array_type)
return 1;
if ((array_type->code () != TYPE_CODE_ARRAY))
- error (_("Can't get dimensions for a non-array type"));
+ error (_ ("Can't get dimensions for a non-array type"));
tmp_type = array_type;
@@ -242,15 +239,16 @@ calc_f77_array_dims (struct type *array_type)
slices. This is a base class for two alternative repacking mechanisms,
one for when repacking from a lazy value, and one for repacking from a
non-lazy (already loaded) value. */
-class fortran_array_repacker_base_impl
- : public fortran_array_walker_base_impl
+class fortran_array_repacker_base_impl : public fortran_array_walker_base_impl
{
public:
+
/* Constructor, DEST is the value we are repacking into. */
fortran_array_repacker_base_impl (struct value *dest)
: m_dest (dest),
m_dest_offset (0)
- { /* Nothing. */ }
+ { /* Nothing. */
+ }
/* When we start processing the inner most dimension, this is where we
will be creating values for each element as we load them and then copy
@@ -278,6 +276,7 @@ public:
}
protected:
+
/* Copy the contents of array element ELT into M_DEST at the next
available offset. */
void copy_element_to_dest (struct value *elt)
@@ -308,6 +307,7 @@ class fortran_lazy_array_repacker_impl
: public fortran_array_repacker_base_impl
{
public:
+
/* Constructor. TYPE is the type of the slice being loaded from the
parent value, so this type will correctly reflect the strides required
to find all of the elements from the parent value. ADDRESS is the
@@ -318,18 +318,20 @@ public:
struct value *dest)
: fortran_array_repacker_base_impl (dest),
m_addr (address)
- { /* Nothing. */ }
+ { /* Nothing. */
+ }
/* Create a lazy value in target memory representing a single element,
then load the element into GDB's memory and copy the contents into the
destination value. */
- void process_element (struct type *elt_type, LONGEST elt_off,
- LONGEST index, bool last_p)
+ void process_element (struct type *elt_type, LONGEST elt_off, LONGEST index,
+ bool last_p)
{
copy_element_to_dest (value_at_lazy (elt_type, m_addr + elt_off));
}
private:
+
/* The address in target memory where the parent value starts. */
CORE_ADDR m_addr;
};
@@ -338,10 +340,10 @@ private:
slices. This class is specialised for repacking an array slice from a
previously loaded (non-lazy) array value, as such it fetches the
element values from the contents of the parent value. */
-class fortran_array_repacker_impl
- : public fortran_array_repacker_base_impl
+class fortran_array_repacker_impl : public fortran_array_repacker_base_impl
{
public:
+
/* Constructor. TYPE is the type for the array slice within the parent
value, as such it has stride values as required to find the elements
within the original parent value. ADDRESS is the address in target
@@ -350,8 +352,8 @@ public:
VAL is the parent object from which we are loading the value, and
DEST is the value into which we are repacking. */
explicit fortran_array_repacker_impl (struct type *type, CORE_ADDR address,
- LONGEST base_offset,
- struct value *val, struct value *dest)
+ LONGEST base_offset, struct value *val,
+ struct value *dest)
: fortran_array_repacker_base_impl (dest),
m_base_offset (base_offset),
m_val (val)
@@ -362,8 +364,8 @@ public:
/* Extract an element of ELT_TYPE at offset (M_BASE_OFFSET + ELT_OFF)
from the content buffer of M_VAL then copy this extracted value into
the repacked destination value. */
- void process_element (struct type *elt_type, LONGEST elt_off,
- LONGEST index, bool last_p)
+ void process_element (struct type *elt_type, LONGEST elt_off, LONGEST index,
+ bool last_p)
{
struct value *elt
= value_from_component (m_val, elt_type, (elt_off + m_base_offset));
@@ -371,6 +373,7 @@ public:
}
private:
+
/* The offset into the content buffer of M_VAL to the start of the slice
being extracted. */
LONGEST m_base_offset;
@@ -379,7 +382,6 @@ private:
struct value *m_val;
};
-
/* Evaluate FORTRAN_ASSOCIATED expressions. Both GDBARCH and LANG are
extracted from the expression being evaluated. POINTER is the required
first argument to the 'associated' keyword, and TARGET is the optional
@@ -397,7 +399,7 @@ fortran_associated (struct gdbarch *gdbarch, const language_defn *lang,
struct type *pointer_type = check_typedef (value_type (pointer));
if (TYPE_ASSOCIATED_PROP (pointer_type) == nullptr
&& pointer_type->code () != TYPE_CODE_PTR)
- error (_("ASSOCIATED can only be applied to pointers"));
+ error (_ ("ASSOCIATED can only be applied to pointers"));
/* Get an address from POINTER. Fortran (or at least gfortran) models
array pointers as arrays with a dynamic data address, so we need to
@@ -449,7 +451,7 @@ fortran_associated (struct gdbarch *gdbarch, const language_defn *lang,
|| (pointer_target_type->code () != TYPE_CODE_ARRAY
&& (pointer_target_type->length ()
!= target_target_type->length ())))
- error (_("arguments to associated must be of same type and kind"));
+ error (_ ("arguments to associated must be of same type and kind"));
/* If TARGET is not in memory, or the original pointer is specifically
known to be not associated with anything, then the answer is obviously
@@ -461,8 +463,7 @@ fortran_associated (struct gdbarch *gdbarch, const language_defn *lang,
if (value_lval_const (target) != lval_memory
|| type_not_associated (pointer_type)
|| (TYPE_ASSOCIATED_PROP (pointer_type) == nullptr
- && pointer_type->code () == TYPE_CODE_PTR
- && pointer_addr == 0))
+ && pointer_type->code () == TYPE_CODE_PTR && pointer_addr == 0))
return value_from_longest (result_type, 0);
/* See the comment for POINTER_ADDR above. */
@@ -528,14 +529,14 @@ fortran_associated (struct gdbarch *gdbarch, const language_defn *lang,
but we need to convert to bits (hence the * 8). */
pointer_stride = pointer_range->bounds ()->bit_stride ();
if (pointer_stride == 0)
- pointer_stride
- = type_length_units (check_typedef
- (pointer_type->target_type ())) * 8;
+ pointer_stride = type_length_units (
+ check_typedef (pointer_type->target_type ()))
+ * 8;
target_stride = target_range->bounds ()->bit_stride ();
if (target_stride == 0)
target_stride
- = type_length_units (check_typedef
- (target_type->target_type ())) * 8;
+ = type_length_units (check_typedef (target_type->target_type ()))
+ * 8;
if (pointer_stride != target_stride)
break;
@@ -553,22 +554,17 @@ fortran_associated (struct gdbarch *gdbarch, const language_defn *lang,
}
struct value *
-eval_op_f_associated (struct type *expect_type,
- struct expression *exp,
- enum noside noside,
- enum exp_opcode opcode,
+eval_op_f_associated (struct type *expect_type, struct expression *exp,
+ enum noside noside, enum exp_opcode opcode,
struct value *arg1)
{
return fortran_associated (exp->gdbarch, exp->language_defn, arg1);
}
struct value *
-eval_op_f_associated (struct type *expect_type,
- struct expression *exp,
- enum noside noside,
- enum exp_opcode opcode,
- struct value *arg1,
- struct value *arg2)
+eval_op_f_associated (struct type *expect_type, struct expression *exp,
+ enum noside noside, enum exp_opcode opcode,
+ struct value *arg1, struct value *arg2)
{
return fortran_associated (exp->gdbarch, exp->language_defn, arg1, arg2);
}
@@ -590,9 +586,9 @@ fortran_array_size (value *array, value *dim_val, type *result_type)
/* Check that ARRAY is the correct type. */
struct type *array_type = check_typedef (value_type (array));
if (array_type->code () != TYPE_CODE_ARRAY)
- error (_("SIZE can only be applied to arrays"));
+ error (_ ("SIZE can only be applied to arrays"));
if (type_not_allocated (array_type) || type_not_associated (array_type))
- error (_("SIZE can only be used on allocated/associated arrays"));
+ error (_ ("SIZE can only be used on allocated/associated arrays"));
int ndimensions = calc_f77_array_dims (array_type);
int dim = -1;
@@ -601,11 +597,11 @@ fortran_array_size (value *array, value *dim_val, type *result_type)
if (dim_val != nullptr)
{
if (check_typedef (value_type (dim_val))->code () != TYPE_CODE_INT)
- error (_("DIM argument to SIZE must be an integer"));
+ error (_ ("DIM argument to SIZE must be an integer"));
dim = (int) value_as_long (dim_val);
if (dim < 1 || dim > ndimensions)
- error (_("DIM argument to SIZE must be between 1 and %d"),
+ error (_ ("DIM argument to SIZE must be between 1 and %d"),
ndimensions);
}
@@ -621,7 +617,7 @@ fortran_array_size (value *array, value *dim_val, type *result_type)
struct type *range = array_type->index_type ();
if (!get_discrete_bounds (range, &lbound, &ubound))
- error (_("failed to find array bounds"));
+ error (_ ("failed to find array bounds"));
LONGEST dim_size = (ubound - lbound + 1);
if (result == 0)
@@ -643,10 +639,8 @@ fortran_array_size (value *array, value *dim_val, type *result_type)
/* See f-exp.h. */
struct value *
-eval_op_f_array_size (struct type *expect_type,
- struct expression *exp,
- enum noside noside,
- enum exp_opcode opcode,
+eval_op_f_array_size (struct type *expect_type, struct expression *exp,
+ enum noside noside, enum exp_opcode opcode,
struct value *arg1)
{
gdb_assert (opcode == FORTRAN_ARRAY_SIZE);
@@ -658,12 +652,9 @@ eval_op_f_array_size (struct type *expect_type,
/* See f-exp.h. */
struct value *
-eval_op_f_array_size (struct type *expect_type,
- struct expression *exp,
- enum noside noside,
- enum exp_opcode opcode,
- struct value *arg1,
- struct value *arg2)
+eval_op_f_array_size (struct type *expect_type, struct expression *exp,
+ enum noside noside, enum exp_opcode opcode,
+ struct value *arg1, struct value *arg2)
{
gdb_assert (opcode == FORTRAN_ARRAY_SIZE);
@@ -673,9 +664,10 @@ eval_op_f_array_size (struct type *expect_type,
/* See f-exp.h. */
-value *eval_op_f_array_size (type *expect_type, expression *exp, noside noside,
- exp_opcode opcode, value *arg1, value *arg2,
- type *kind_arg)
+value *
+eval_op_f_array_size (type *expect_type, expression *exp, noside noside,
+ exp_opcode opcode, value *arg1, value *arg2,
+ type *kind_arg)
{
gdb_assert (opcode == FORTRAN_ARRAY_SIZE);
gdb_assert (kind_arg->code () == TYPE_CODE_INT);
@@ -703,7 +695,7 @@ fortran_array_shape (struct gdbarch *gdbarch, const language_defn *lang,
Fortran specification. */
if (val_type->code () == TYPE_CODE_ARRAY
&& (type_not_associated (val_type) || type_not_allocated (val_type)))
- error (_("The array passed to SHAPE must be allocated or associated"));
+ error (_ ("The array passed to SHAPE must be allocated or associated"));
/* The Fortran specification allows non-array types to be passed to this
function, in which case we get back an empty array.
@@ -715,8 +707,7 @@ fortran_array_shape (struct gdbarch *gdbarch, const language_defn *lang,
/* Allocate a result value of the correct type. */
struct type *range
- = create_static_range_type (nullptr,
- builtin_type (gdbarch)->builtin_int,
+ = create_static_range_type (nullptr, builtin_type (gdbarch)->builtin_int,
1, ndimensions);
struct type *elm_type = builtin_f_type (gdbarch)->builtin_integer;
struct type *result_type = create_array_type (nullptr, elm_type, range);
@@ -728,14 +719,13 @@ fortran_array_shape (struct gdbarch *gdbarch, const language_defn *lang,
If VAL was not an array then ndimensions will be 0, in which case we
will never go around this loop. */
- for (LONGEST dst_offset = elm_len * (ndimensions - 1);
- dst_offset >= 0;
+ for (LONGEST dst_offset = elm_len * (ndimensions - 1); dst_offset >= 0;
dst_offset -= elm_len)
{
LONGEST lbound, ubound;
if (!get_discrete_bounds (val_type->index_type (), &lbound, &ubound))
- error (_("failed to find array bounds"));
+ error (_ ("failed to find array bounds"));
LONGEST dim_size = (ubound - lbound + 1);
@@ -768,9 +758,7 @@ eval_op_f_array_shape (struct type *expect_type, struct expression *exp,
struct value *
eval_op_f_abs (struct type *expect_type, struct expression *exp,
- enum noside noside,
- enum exp_opcode opcode,
- struct value *arg1)
+ enum noside noside, enum exp_opcode opcode, struct value *arg1)
{
struct type *type = value_type (arg1);
switch (type->code ())
@@ -789,30 +777,27 @@ eval_op_f_abs (struct type *expect_type, struct expression *exp,
return value_from_longest (type, l);
}
}
- error (_("ABS of type %s not supported"), TYPE_SAFE_NAME (type));
+ error (_ ("ABS of type %s not supported"), TYPE_SAFE_NAME (type));
}
/* A helper function for BINOP_MOD. */
struct value *
eval_op_f_mod (struct type *expect_type, struct expression *exp,
- enum noside noside,
- enum exp_opcode opcode,
- struct value *arg1, struct value *arg2)
+ enum noside noside, enum exp_opcode opcode, struct value *arg1,
+ struct value *arg2)
{
struct type *type = value_type (arg1);
if (type->code () != value_type (arg2)->code ())
- error (_("non-matching types for parameters to MOD ()"));
+ error (_ ("non-matching types for parameters to MOD ()"));
switch (type->code ())
{
case TYPE_CODE_FLT:
{
- double d1
- = target_float_to_host_double (value_contents (arg1).data (),
- value_type (arg1));
- double d2
- = target_float_to_host_double (value_contents (arg2).data (),
- value_type (arg2));
+ double d1 = target_float_to_host_double (value_contents (arg1).data (),
+ value_type (arg1));
+ double d2 = target_float_to_host_double (value_contents (arg2).data (),
+ value_type (arg2));
double d3 = fmod (d1, d2);
return value_from_host_double (type, d3);
}
@@ -821,12 +806,12 @@ eval_op_f_mod (struct type *expect_type, struct expression *exp,
LONGEST v1 = value_as_long (arg1);
LONGEST v2 = value_as_long (arg2);
if (v2 == 0)
- error (_("calling MOD (N, 0) is undefined"));
+ error (_ ("calling MOD (N, 0) is undefined"));
LONGEST v3 = v1 - (v1 / v2) * v2;
return value_from_longest (value_type (arg1), v3);
}
}
- error (_("MOD of type %s not supported"), TYPE_SAFE_NAME (type));
+ error (_ ("MOD of type %s not supported"), TYPE_SAFE_NAME (type));
}
/* A helper function for the different FORTRAN_CEILING overloads. Calculates
@@ -837,7 +822,7 @@ static value *
fortran_ceil_operation (value *arg1, type *result_type)
{
if (value_type (arg1)->code () != TYPE_CODE_FLT)
- error (_("argument to CEILING must be of type float"));
+ error (_ ("argument to CEILING must be of type float"));
double val = target_float_to_host_double (value_contents (arg1).data (),
value_type (arg1));
val = ceil (val);
@@ -848,9 +833,7 @@ fortran_ceil_operation (value *arg1, type *result_type)
struct value *
eval_op_f_ceil (struct type *expect_type, struct expression *exp,
- enum noside noside,
- enum exp_opcode opcode,
- struct value *arg1)
+ enum noside noside, enum exp_opcode opcode, struct value *arg1)
{
gdb_assert (opcode == FORTRAN_CEILING);
type *result_type = builtin_f_type (exp->gdbarch)->builtin_integer;
@@ -876,7 +859,7 @@ static value *
fortran_floor_operation (value *arg1, type *result_type)
{
if (value_type (arg1)->code () != TYPE_CODE_FLT)
- error (_("argument to FLOOR must be of type float"));
+ error (_ ("argument to FLOOR must be of type float"));
double val = target_float_to_host_double (value_contents (arg1).data (),
value_type (arg1));
val = floor (val);
@@ -887,9 +870,8 @@ fortran_floor_operation (value *arg1, type *result_type)
struct value *
eval_op_f_floor (struct type *expect_type, struct expression *exp,
- enum noside noside,
- enum exp_opcode opcode,
- struct value *arg1)
+ enum noside noside, enum exp_opcode opcode,
+ struct value *arg1)
{
gdb_assert (opcode == FORTRAN_FLOOR);
type *result_type = builtin_f_type (exp->gdbarch)->builtin_integer;
@@ -911,13 +893,12 @@ eval_op_f_floor (type *expect_type, expression *exp, noside noside,
struct value *
eval_op_f_modulo (struct type *expect_type, struct expression *exp,
- enum noside noside,
- enum exp_opcode opcode,
+ enum noside noside, enum exp_opcode opcode,
struct value *arg1, struct value *arg2)
{
struct type *type = value_type (arg1);
if (type->code () != value_type (arg2)->code ())
- error (_("non-matching types for parameters to MODULO ()"));
+ error (_ ("non-matching types for parameters to MODULO ()"));
/* MODULO(A, P) = A - FLOOR (A / P) * P */
switch (type->code ())
{
@@ -932,19 +913,17 @@ eval_op_f_modulo (struct type *expect_type, struct expression *exp,
}
case TYPE_CODE_FLT:
{
- double a
- = target_float_to_host_double (value_contents (arg1).data (),
- value_type (arg1));
- double p
- = target_float_to_host_double (value_contents (arg2).data (),
- value_type (arg2));
+ double a = target_float_to_host_double (value_contents (arg1).data (),
+ value_type (arg1));
+ double p = target_float_to_host_double (value_contents (arg2).data (),
+ value_type (arg2));
double result = fmod (a, p);
if (result != 0 && (a < 0.0) != (p < 0.0))
result += p;
return value_from_host_double (type, result);
}
}
- error (_("MODULO of type %s not supported"), TYPE_SAFE_NAME (type));
+ error (_ ("MODULO of type %s not supported"), TYPE_SAFE_NAME (type));
}
/* A helper function for FORTRAN_CMPLX. */
@@ -969,14 +948,14 @@ eval_op_f_cmplx (type *expect_type, expression *exp, noside noside,
struct value *
eval_op_f_cmplx (struct type *expect_type, struct expression *exp,
- enum noside noside,
- enum exp_opcode opcode,
+ enum noside noside, enum exp_opcode opcode,
struct value *arg1, struct value *arg2)
{
if (value_type (arg1)->code () == TYPE_CODE_COMPLEX
|| value_type (arg2)->code () == TYPE_CODE_COMPLEX)
- error (_("Types of arguments for CMPLX called with more then one argument "
- "must be REAL or INTEGER"));
+ error (
+ _ ("Types of arguments for CMPLX called with more then one argument "
+ "must be REAL or INTEGER"));
type *result_type = builtin_f_type (exp->gdbarch)->builtin_complex;
return value_literal_complex (arg1, arg2, result_type);
@@ -991,8 +970,9 @@ eval_op_f_cmplx (type *expect_type, expression *exp, noside noside,
gdb_assert (kind_arg->code () == TYPE_CODE_COMPLEX);
if (value_type (arg1)->code () == TYPE_CODE_COMPLEX
|| value_type (arg2)->code () == TYPE_CODE_COMPLEX)
- error (_("Types of arguments for CMPLX called with more then one argument "
- "must be REAL or INTEGER"));
+ error (
+ _ ("Types of arguments for CMPLX called with more then one argument "
+ "must be REAL or INTEGER"));
return value_literal_complex (arg1, arg2, kind_arg);
}
@@ -1001,9 +981,7 @@ eval_op_f_cmplx (type *expect_type, expression *exp, noside noside,
struct value *
eval_op_f_kind (struct type *expect_type, struct expression *exp,
- enum noside noside,
- enum exp_opcode opcode,
- struct value *arg1)
+ enum noside noside, enum exp_opcode opcode, struct value *arg1)
{
struct type *type = value_type (arg1);
@@ -1013,7 +991,7 @@ eval_op_f_kind (struct type *expect_type, struct expression *exp,
case TYPE_CODE_UNION:
case TYPE_CODE_MODULE:
case TYPE_CODE_FUNC:
- error (_("argument to kind must be an intrinsic type"));
+ error (_ ("argument to kind must be an intrinsic type"));
}
if (!type->target_type ())
@@ -1032,9 +1010,8 @@ eval_op_f_allocated (struct type *expect_type, struct expression *exp,
{
struct type *type = check_typedef (value_type (arg1));
if (type->code () != TYPE_CODE_ARRAY)
- error (_("ALLOCATED can only be applied to arrays"));
- struct type *result_type
- = builtin_f_type (exp->gdbarch)->builtin_logical;
+ error (_ ("ALLOCATED can only be applied to arrays"));
+ struct type *result_type = builtin_f_type (exp->gdbarch)->builtin_logical;
LONGEST result_value = type_not_allocated (type) ? 0 : 1;
return value_from_longest (result_type, result_value);
}
@@ -1042,16 +1019,12 @@ eval_op_f_allocated (struct type *expect_type, struct expression *exp,
/* See f-exp.h. */
struct value *
-eval_op_f_rank (struct type *expect_type,
- struct expression *exp,
- enum noside noside,
- enum exp_opcode op,
- struct value *arg1)
+eval_op_f_rank (struct type *expect_type, struct expression *exp,
+ enum noside noside, enum exp_opcode op, struct value *arg1)
{
gdb_assert (op == UNOP_FORTRAN_RANK);
- struct type *result_type
- = builtin_f_type (exp->gdbarch)->builtin_integer;
+ struct type *result_type = builtin_f_type (exp->gdbarch)->builtin_integer;
struct type *type = check_typedef (value_type (arg1));
if (type->code () != TYPE_CODE_ARRAY)
return value_from_longest (result_type, 0);
@@ -1063,8 +1036,7 @@ eval_op_f_rank (struct type *expect_type,
struct value *
eval_op_f_loc (struct type *expect_type, struct expression *exp,
- enum noside noside, enum exp_opcode op,
- struct value *arg1)
+ enum noside noside, enum exp_opcode op, struct value *arg1)
{
struct type *result_type;
if (gdbarch_ptr_bit (exp->gdbarch) == 16)
@@ -1088,8 +1060,7 @@ namespace expr
for evaluate. */
value *
-fortran_undetermined::value_subarray (value *array,
- struct expression *exp,
+fortran_undetermined::value_subarray (value *array, struct expression *exp,
enum noside noside)
{
type *original_array_type = check_typedef (value_type (array));
@@ -1105,23 +1076,23 @@ fortran_undetermined::value_subarray (value *array,
if (ops[0]->opcode () != OP_RANGE)
{
if (type_not_associated (original_array_type))
- error (_("no such vector element (vector not associated)"));
+ error (_ ("no such vector element (vector not associated)"));
else if (type_not_allocated (original_array_type))
- error (_("no such vector element (vector not allocated)"));
+ error (_ ("no such vector element (vector not allocated)"));
}
else
{
if (type_not_associated (original_array_type))
- error (_("array not associated"));
+ error (_ ("array not associated"));
else if (type_not_allocated (original_array_type))
- error (_("array not allocated"));
+ error (_ ("array not allocated"));
}
/* First check that the number of dimensions in the type we are slicing
matches the number of arguments we were passed. */
int ndimensions = calc_f77_array_dims (original_array_type);
if (nargs != ndimensions)
- error (_("Wrong number of subscripts"));
+ error (_ ("Wrong number of subscripts"));
/* This will be initialised below with the type of the elements held in
ARRAY. */
@@ -1174,7 +1145,8 @@ fortran_undetermined::value_subarray (value *array,
high (h),
stride (s),
index (idx)
- { /* Nothing. */ }
+ { /* Nothing. */
+ }
/* The low bound for this dimension of the slice. */
LONGEST low;
@@ -1225,7 +1197,7 @@ fortran_undetermined::value_subarray (value *array,
stride = 1;
if (stride == 0)
- error (_("stride must not be 0"));
+ error (_ ("stride must not be 0"));
/* Get information about this dimension in the original ARRAY. */
struct type *target_type = dim_type->target_type ();
@@ -1245,23 +1217,22 @@ fortran_undetermined::value_subarray (value *array,
debug_printf ("| | |-> Low bound: %s\n", plongest (lb));
debug_printf ("| | |-> High bound: %s\n", plongest (ub));
debug_printf ("| | |-> Bit stride: %s\n", plongest (sd));
- debug_printf ("| | |-> Byte stride: %s\n", plongest (sd / 8));
+ debug_printf ("| | |-> Byte stride: %s\n",
+ plongest (sd / 8));
debug_printf ("| | |-> Type size: %s\n",
pulongest (dim_type->length ()));
debug_printf ("| | '-> Target type size: %s\n",
pulongest (target_type->length ()));
debug_printf ("| |-> Accessing:\n");
- debug_printf ("| | |-> Low bound: %s\n",
- plongest (low));
- debug_printf ("| | |-> High bound: %s\n",
- plongest (high));
+ debug_printf ("| | |-> Low bound: %s\n", plongest (low));
+ debug_printf ("| | |-> High bound: %s\n", plongest (high));
debug_printf ("| | '-> Element stride: %s\n",
plongest (stride));
}
/* Check the user hasn't asked for something invalid. */
if (high > ub || low < lb)
- error (_("array subscript out of bounds"));
+ error (_ ("array subscript out of bounds"));
/* Calculate what this dimension of the new slice array will look
like. OFFSET is the byte offset from the start of the
@@ -1284,10 +1255,10 @@ fortran_undetermined::value_subarray (value *array,
{
offset += std::abs (remainder) * target_type->length ();
if (stride > 0)
- error (_("incorrect stride and boundary combination"));
+ error (_ ("incorrect stride and boundary combination"));
}
else if (stride < 0)
- error (_("incorrect stride and boundary combination"));
+ error (_ ("incorrect stride and boundary combination"));
/* Is the data within this dimension contiguous? It is if the
newly computed stride is the same size as a single element of
@@ -1300,7 +1271,8 @@ fortran_undetermined::value_subarray (value *array,
debug_printf ("| '-> Results:\n");
debug_printf ("| |-> Offset = %s\n", plongest (offset));
debug_printf ("| |-> Elements = %s\n", plongest (e_count));
- debug_printf ("| |-> Low bound = %s\n", plongest (new_low));
+ debug_printf ("| |-> Low bound = %s\n",
+ plongest (new_low));
debug_printf ("| |-> High bound = %s\n",
plongest (new_high));
debug_printf ("| |-> Byte stride = %s\n",
@@ -1317,8 +1289,7 @@ fortran_undetermined::value_subarray (value *array,
the new array slice will be. */
slice_element_size = std::abs (new_stride * e_count);
- slice_dims.emplace_back (new_low, new_high, new_stride,
- index_type);
+ slice_dims.emplace_back (new_low, new_high, new_stride, index_type);
/* Update the total offset. */
total_offset += offset;
@@ -1352,8 +1323,7 @@ fortran_undetermined::value_subarray (value *array,
debug_printf ("| | '-> Target type size: %s\n",
pulongest (target_type->length ()));
debug_printf ("| '-> Accessing:\n");
- debug_printf ("| '-> Index: %s\n",
- plongest (index));
+ debug_printf ("| '-> Index: %s\n", plongest (index));
}
/* If the array has actual content then check the index is in
@@ -1361,17 +1331,19 @@ fortran_undetermined::value_subarray (value *array,
have a known upper bound, so don't error check in that
situation. */
if (index < lb
- || (dim_type->index_type ()->bounds ()->high.kind () != PROP_UNDEFINED
+ || (dim_type->index_type ()->bounds ()->high.kind ()
+ != PROP_UNDEFINED
&& index > ub)
|| (VALUE_LVAL (array) != lval_memory
- && dim_type->index_type ()->bounds ()->high.kind () == PROP_UNDEFINED))
+ && dim_type->index_type ()->bounds ()->high.kind ()
+ == PROP_UNDEFINED))
{
if (type_not_associated (dim_type))
- error (_("no such vector element (vector not associated)"));
+ error (_ ("no such vector element (vector not associated)"));
else if (type_not_allocated (dim_type))
- error (_("no such vector element (vector not allocated)"));
+ error (_ ("no such vector element (vector not allocated)"));
else
- error (_("no such vector element"));
+ error (_ ("no such vector element"));
}
/* Calculate using the type stride, not the target type size. */
@@ -1395,9 +1367,8 @@ fortran_undetermined::value_subarray (value *array,
struct type *new_range
= create_range_type_with_stride ((struct type *) NULL,
- d.index->target_type (),
- &p_low, &p_high, 0, &p_stride,
- true);
+ d.index->target_type (), &p_low,
+ &p_high, 0, &p_stride, true);
array_slice_type
= create_array_type (nullptr, array_slice_type, new_range);
}
@@ -1407,8 +1378,7 @@ fortran_undetermined::value_subarray (value *array,
debug_printf ("'-> Final result:\n");
debug_printf (" |-> Type: %s\n",
type_to_string (array_slice_type).c_str ());
- debug_printf (" |-> Total offset: %s\n",
- plongest (total_offset));
+ debug_printf (" |-> Total offset: %s\n", plongest (total_offset));
debug_printf (" |-> Base address: %s\n",
core_addr_to_string (value_address (array)));
debug_printf (" '-> Contiguous = %s\n",
@@ -1431,9 +1401,8 @@ fortran_undetermined::value_subarray (value *array,
struct type *new_range
= create_range_type_with_stride ((struct type *) NULL,
- d.index->target_type (),
- &p_low, &p_high, 0, &p_stride,
- true);
+ d.index->target_type (), &p_low,
+ &p_high, 0, &p_stride, true);
repacked_array_type
= create_array_type (nullptr, repacked_array_type, new_range);
}
@@ -1445,15 +1414,15 @@ fortran_undetermined::value_subarray (value *array,
|| (total_offset + array_slice_type->length ()
> check_typedef (value_type (array))->length ()))
{
- fortran_array_walker<fortran_lazy_array_repacker_impl> p
- (array_slice_type, value_address (array) + total_offset, dest);
+ fortran_array_walker<fortran_lazy_array_repacker_impl> p (
+ array_slice_type, value_address (array) + total_offset, dest);
p.walk ();
}
else
{
- fortran_array_walker<fortran_array_repacker_impl> p
- (array_slice_type, value_address (array) + total_offset,
- total_offset, array, dest);
+ fortran_array_walker<fortran_array_repacker_impl> p (
+ array_slice_type, value_address (array) + total_offset,
+ total_offset, array, dest);
p.walk ();
}
array = dest;
@@ -1472,14 +1441,14 @@ fortran_undetermined::value_subarray (value *array,
array = value_at_lazy (array_slice_type,
value_address (array) + total_offset);
else
- array = value_from_contents_and_address
- (array_slice_type, value_contents (array).data () + total_offset,
- value_address (array) + total_offset);
+ array = value_from_contents_and_address (
+ array_slice_type, value_contents (array).data () + total_offset,
+ value_address (array) + total_offset);
}
else if (!value_lazy (array))
array = value_from_component (array, array_slice_type, total_offset);
else
- error (_("cannot subscript arrays that are not in memory"));
+ error (_ ("cannot subscript arrays that are not in memory"));
}
return array;
@@ -1487,8 +1456,7 @@ fortran_undetermined::value_subarray (value *array,
value *
fortran_undetermined::evaluate (struct type *expect_type,
- struct expression *exp,
- enum noside noside)
+ struct expression *exp, enum noside noside)
{
value *callee = std::get<0> (m_storage)->evaluate (nullptr, exp, noside);
if (noside == EVAL_AVOID_SIDE_EFFECTS
@@ -1532,22 +1500,20 @@ fortran_undetermined::evaluate (struct type *expect_type,
std::vector<value *> argvec (actual.size ());
bool is_internal_func = (code == TYPE_CODE_INTERNAL_FUNCTION);
for (int tem = 0; tem < argvec.size (); tem++)
- argvec[tem] = fortran_prepare_argument (exp, actual[tem].get (),
- tem, is_internal_func,
- value_type (callee),
- noside);
- return evaluate_subexp_do_call (exp, noside, callee, argvec,
- nullptr, expect_type);
+ argvec[tem] = fortran_prepare_argument (exp, actual[tem].get (), tem,
+ is_internal_func,
+ value_type (callee), noside);
+ return evaluate_subexp_do_call (exp, noside, callee, argvec, nullptr,
+ expect_type);
}
default:
- error (_("Cannot perform substring on this type"));
+ error (_ ("Cannot perform substring on this type"));
}
}
value *
-fortran_bound_1arg::evaluate (struct type *expect_type,
- struct expression *exp,
+fortran_bound_1arg::evaluate (struct type *expect_type, struct expression *exp,
enum noside noside)
{
bool lbound_p = std::get<0> (m_storage) == FORTRAN_LBOUND;
@@ -1557,8 +1523,7 @@ fortran_bound_1arg::evaluate (struct type *expect_type,
}
value *
-fortran_bound_2arg::evaluate (struct type *expect_type,
- struct expression *exp,
+fortran_bound_2arg::evaluate (struct type *expect_type, struct expression *exp,
enum noside noside)
{
bool lbound_p = std::get<0> (m_storage) == FORTRAN_LBOUND;
@@ -1571,9 +1536,9 @@ fortran_bound_2arg::evaluate (struct type *expect_type,
if (type_arg2->code () != TYPE_CODE_INT)
{
if (lbound_p)
- error (_("LBOUND second argument should be an integer"));
+ error (_ ("LBOUND second argument should be an integer"));
else
- error (_("UBOUND second argument should be an integer"));
+ error (_ ("UBOUND second argument should be an integer"));
}
type *result_type = builtin_f_type (exp->gdbarch)->builtin_integer;
@@ -1581,8 +1546,7 @@ fortran_bound_2arg::evaluate (struct type *expect_type,
}
value *
-fortran_bound_3arg::evaluate (type *expect_type,
- expression *exp,
+fortran_bound_3arg::evaluate (type *expect_type, expression *exp,
noside noside)
{
const bool lbound_p = std::get<0> (m_storage) == FORTRAN_LBOUND;
@@ -1595,9 +1559,9 @@ fortran_bound_3arg::evaluate (type *expect_type,
if (type_arg2->code () != TYPE_CODE_INT)
{
if (lbound_p)
- error (_("LBOUND second argument should be an integer"));
+ error (_ ("LBOUND second argument should be an integer"));
else
- error (_("UBOUND second argument should be an integer"));
+ error (_ ("UBOUND second argument should be an integer"));
}
type *kind_arg = std::get<3> (m_storage);
@@ -1668,10 +1632,7 @@ f_language::language_arch_info (struct gdbarch *gdbarch,
const struct builtin_f_type *builtin = builtin_f_type (gdbarch);
/* Helper function to allow shorter lines below. */
- auto add = [&] (struct type * t)
- {
- lai->add_primitive_type (t);
- };
+ auto add = [&] (struct type *t) { lai->add_primitive_type (t); };
add (builtin->builtin_character);
add (builtin->builtin_logical);
@@ -1710,8 +1671,8 @@ f_language::lookup_symbol_nonlocal (const char *name,
/* See language.h. */
symbol_name_matcher_ftype *
-f_language::get_symbol_name_matcher_inner
- (const lookup_name_info &lookup_name) const
+f_language::get_symbol_name_matcher_inner (
+ const lookup_name_info &lookup_name) const
{
return cp_get_symbol_name_matcher (lookup_name);
}
@@ -1758,12 +1719,12 @@ build_fortran_types (struct gdbarch *gdbarch)
"integer*8");
builtin_f_type->builtin_real
- = arch_float_type (gdbarch, gdbarch_float_bit (gdbarch),
- "real*4", gdbarch_float_format (gdbarch));
+ = arch_float_type (gdbarch, gdbarch_float_bit (gdbarch), "real*4",
+ gdbarch_float_format (gdbarch));
builtin_f_type->builtin_real_s8
- = arch_float_type (gdbarch, gdbarch_double_bit (gdbarch),
- "real*8", gdbarch_double_format (gdbarch));
+ = arch_float_type (gdbarch, gdbarch_double_bit (gdbarch), "real*8",
+ gdbarch_double_format (gdbarch));
auto fmt = gdbarch_floatformat_for_type (gdbarch, "real(kind=16)", 128);
if (fmt != nullptr)
@@ -1771,8 +1732,8 @@ build_fortran_types (struct gdbarch *gdbarch)
= arch_float_type (gdbarch, 128, "real*16", fmt);
else if (gdbarch_long_double_bit (gdbarch) == 128)
builtin_f_type->builtin_real_s16
- = arch_float_type (gdbarch, gdbarch_long_double_bit (gdbarch),
- "real*16", gdbarch_long_double_format (gdbarch));
+ = arch_float_type (gdbarch, gdbarch_long_double_bit (gdbarch), "real*16",
+ gdbarch_long_double_format (gdbarch));
else
builtin_f_type->builtin_real_s16
= arch_type (gdbarch, TYPE_CODE_ERROR, 128, "real*16");
@@ -1813,20 +1774,22 @@ static struct cmd_list_element *set_fortran_list;
static struct cmd_list_element *show_fortran_list;
void _initialize_f_language ();
+
void
_initialize_f_language ()
{
- add_setshow_prefix_cmd
- ("fortran", no_class,
- _("Prefix command for changing Fortran-specific settings."),
- _("Generic command for showing Fortran-specific settings."),
- &set_fortran_list, &show_fortran_list,
- &setlist, &showlist);
+ add_setshow_prefix_cmd (
+ "fortran", no_class,
+ _ ("Prefix command for changing Fortran-specific settings."),
+ _ ("Generic command for showing Fortran-specific settings."),
+ &set_fortran_list, &show_fortran_list, &setlist, &showlist);
add_setshow_boolean_cmd ("repack-array-slices", class_vars,
- &repack_array_slices, _("\
-Enable or disable repacking of non-contiguous array slices."), _("\
-Show whether non-contiguous array slices are repacked."), _("\
+ &repack_array_slices, _ ("\
+Enable or disable repacking of non-contiguous array slices."),
+ _ ("\
+Show whether non-contiguous array slices are repacked."),
+ _ ("\
When the user requests a slice of a Fortran array then we can either return\n\
a descriptor that describes the array in place (using the original array data\n\
in its existing location) or the original data can be repacked (copied) to a\n\
@@ -1836,19 +1799,19 @@ When the content of the array slice is contiguous within the original array\n\
then the result will never be repacked, but when the data for the new array\n\
is non-contiguous within the original array repacking will only be performed\n\
when this setting is on."),
- NULL,
- show_repack_array_slices,
- &set_fortran_list, &show_fortran_list);
+ NULL, show_repack_array_slices, &set_fortran_list,
+ &show_fortran_list);
/* Debug Fortran's array slicing logic. */
add_setshow_boolean_cmd ("fortran-array-slicing", class_maintenance,
- &fortran_array_slicing_debug, _("\
-Set debugging of Fortran array slicing."), _("\
-Show debugging of Fortran array slicing."), _("\
+ &fortran_array_slicing_debug, _ ("\
+Set debugging of Fortran array slicing."),
+ _ ("\
+Show debugging of Fortran array slicing."),
+ _ ("\
When on, debugging of Fortran array slicing is enabled."),
- NULL,
- show_fortran_array_slicing_debug,
- &setdebuglist, &showdebuglist);
+ NULL, show_fortran_array_slicing_debug,
+ &setdebuglist, &showdebuglist);
}
/* Ensures that function argument VALUE is in the appropriate form to
@@ -1879,14 +1842,16 @@ fortran_argument_convert (struct value *value, bool is_artificial)
const CORE_ADDR addr
= value_as_long (value_allocate_space_in_inferior (length));
write_memory (addr, value_contents (value).data (), length);
- struct value *val = value_from_contents_and_address
- (type, value_contents (value).data (), addr);
+ struct value *val
+ = value_from_contents_and_address (type,
+ value_contents (value).data (),
+ addr);
return value_addr (val);
}
else
return value_addr (value); /* Program variables, e.g. arrays. */
}
- return value;
+ return value;
}
/* Prepare (and return) an argument value ready for an inferior function
@@ -1908,8 +1873,7 @@ fortran_argument_convert (struct value *value, bool is_artificial)
malloc in target memory. Infinite recursion ensues. */
static value *
-fortran_prepare_argument (struct expression *exp,
- expr::operation *subexp,
+fortran_prepare_argument (struct expression *exp, expr::operation *subexp,
int arg_num, bool is_internal_call_p,
struct type *func_type, enum noside noside)
{
@@ -1917,8 +1881,8 @@ fortran_prepare_argument (struct expression *exp,
return subexp->evaluate_with_coercion (exp, noside);
bool is_artificial = ((arg_num >= func_type->num_fields ())
- ? true
- : TYPE_FIELD_ARTIFICIAL (func_type, arg_num));
+ ? true
+ : TYPE_FIELD_ARTIFICIAL (func_type, arg_num));
/* If this is an artificial argument, then either, this is an argument
beyond the end of the known arguments, or possibly, there are no known
@@ -1978,7 +1942,7 @@ fortran_adjust_dynamic_array_base_address_hack (struct type *type,
for this dimension points to the element at the highest memory
address and the stride is negative. */
struct type *tmp_type = type;
- for (int i = 0 ; i < ndimensions; ++i)
+ for (int i = 0; i < ndimensions; ++i)
{
/* Grab the range for this dimension and extract the lower and upper
bounds. */
diff --git a/gdb/f-lang.h b/gdb/f-lang.h
index 673e273d31a..24b0f833a6d 100644
--- a/gdb/f-lang.h
+++ b/gdb/f-lang.h
@@ -34,34 +34,32 @@ struct parser_state;
class f_language : public language_defn
{
public:
+
f_language ()
: language_defn (language_fortran)
- { /* Nothing. */ }
+ { /* Nothing. */
+ }
/* See language.h. */
- const char *name () const override
- { return "fortran"; }
+ const char *name () const override { return "fortran"; }
/* See language.h. */
- const char *natural_name () const override
- { return "Fortran"; }
+ const char *natural_name () const override { return "Fortran"; }
/* See language.h. */
const std::vector<const char *> &filename_extensions () const override
{
- static const std::vector<const char *> extensions = {
- ".f", ".F", ".for", ".FOR", ".ftn", ".FTN", ".fpp", ".FPP",
- ".f90", ".F90", ".f95", ".F95", ".f03", ".F03", ".f08", ".F08"
- };
+ static const std::vector<const char *> extensions
+ = { ".f", ".F", ".for", ".FOR", ".ftn", ".FTN", ".fpp", ".FPP",
+ ".f90", ".F90", ".f95", ".F95", ".f03", ".F03", ".f08", ".F08" };
return extensions;
}
/* See language.h. */
- void print_array_index (struct type *index_type,
- LONGEST index,
+ void print_array_index (struct type *index_type, LONGEST index,
struct ui_file *stream,
const value_print_options *options) const override;
@@ -77,7 +75,7 @@ public:
gdb::unique_xmalloc_ptr<char> demangle_symbol (const char *mangled,
int options) const override
{
- /* We could support demangling here to provide module namespaces
+ /* We could support demangling here to provide module namespaces
also for inferiors with only minimal symbol table (ELF symbols).
Just the mangling standard is not standardized across compilers
and there is no DW_AT_producer available for inferiors with only
@@ -115,34 +113,31 @@ public:
return retval;
}
-
/* See language.h. */
- void collect_symbol_completion_matches (completion_tracker &tracker,
- complete_symbol_mode mode,
- symbol_name_match_type name_match_type,
- const char *text, const char *word,
- enum type_code code) const override
+ void collect_symbol_completion_matches (
+ completion_tracker &tracker, complete_symbol_mode mode,
+ symbol_name_match_type name_match_type, const char *text, const char *word,
+ enum type_code code) const override
{
/* Consider the modules separator :: as a valid symbol name character
class. */
default_collect_symbol_completion_matches_break_on (tracker, mode,
- name_match_type,
- text, word, ":",
- code);
+ name_match_type, text,
+ word, ":", code);
}
/* See language.h. */
- void value_print_inner
- (struct value *val, struct ui_file *stream, int recurse,
- const struct value_print_options *options) const override;
+ void
+ value_print_inner (struct value *val, struct ui_file *stream, int recurse,
+ const struct value_print_options *options) const override;
/* See language.h. */
- struct block_symbol lookup_symbol_nonlocal
- (const char *name, const struct block *block,
- const domain_enum domain) const override;
+ struct block_symbol
+ lookup_symbol_nonlocal (const char *name, const struct block *block,
+ const domain_enum domain) const override;
/* See language.h. */
@@ -150,8 +145,8 @@ public:
/* See language.h. */
- void emitchar (int ch, struct type *chtype,
- struct ui_file *stream, int quoter) const override
+ void emitchar (int ch, struct type *chtype, struct ui_file *stream,
+ int quoter) const override
{
const char *encoding = get_encoding (chtype);
generic_emit_char (ch, chtype, stream, quoter, encoding);
@@ -203,37 +198,39 @@ public:
/* See language.h. */
- const char *struct_too_deep_ellipsis () const override
- { return "(...)"; }
+ const char *struct_too_deep_ellipsis () const override { return "(...)"; }
/* See language.h. */
- bool c_style_arrays_p () const override
- { return false; }
+ bool c_style_arrays_p () const override { return false; }
/* See language.h. */
- bool range_checking_on_by_default () const override
- { return true; }
+ bool range_checking_on_by_default () const override { return true; }
/* See language.h. */
enum case_sensitivity case_sensitivity () const override
- { return case_sensitive_off; }
+ {
+ return case_sensitive_off;
+ }
/* See language.h. */
enum array_ordering array_ordering () const override
- { return array_column_major; }
+ {
+ return array_column_major;
+ }
protected:
/* See language.h. */
- symbol_name_matcher_ftype *get_symbol_name_matcher_inner
- (const lookup_name_info &lookup_name) const override;
+ symbol_name_matcher_ftype *get_symbol_name_matcher_inner (
+ const lookup_name_info &lookup_name) const override;
private:
+
/* Return the encoding that should be used for the character type
TYPE. */
@@ -247,8 +244,7 @@ private:
any typename for TYPE and show its details.
SHOW is always zero on recursive calls. */
- void f_type_print_varspec_prefix (struct type *type,
- struct ui_file * stream,
+ void f_type_print_varspec_prefix (struct type *type, struct ui_file *stream,
int show, int passed_a_ptr) const;
/* Print any array sizes, function arguments or close parentheses needed
@@ -260,8 +256,7 @@ private:
when the array is not allocated or not associated and so there are no
known upper or lower bounds. */
- void f_type_print_varspec_suffix (struct type *type,
- struct ui_file *stream,
+ void f_type_print_varspec_suffix (struct type *type, struct ui_file *stream,
int show, int passed_a_ptr,
int demangled_args,
int arrayprint_recurse_level,
@@ -370,7 +365,8 @@ extern struct type *fortran_preserve_arg_pointer (struct value *arg,
element here. Yes, this will break some things, but it fixes other
things. The hope is that it fixes more than it breaks. */
-extern CORE_ADDR fortran_adjust_dynamic_array_base_address_hack
- (struct type *type, CORE_ADDR address);
+extern CORE_ADDR
+fortran_adjust_dynamic_array_base_address_hack (struct type *type,
+ CORE_ADDR address);
#endif /* F_LANG_H */
diff --git a/gdb/f-typeprint.c b/gdb/f-typeprint.c
index e4aed6e5904..7bc593c8ae2 100644
--- a/gdb/f-typeprint.c
+++ b/gdb/f-typeprint.c
@@ -54,21 +54,17 @@ f_language::print_type (struct type *type, const char *varstring,
f_type_print_base (type, stream, show, level);
code = type->code ();
- if ((varstring != NULL && *varstring != '\0')
- /* Need a space if going to print stars or brackets; but not if we
+ if (
+ (varstring != NULL && *varstring != '\0')
+ /* Need a space if going to print stars or brackets; but not if we
will print just a type name. */
- || ((show > 0
- || type->name () == 0)
- && (code == TYPE_CODE_FUNC
- || code == TYPE_CODE_METHOD
- || code == TYPE_CODE_ARRAY
- || ((code == TYPE_CODE_PTR
- || code == TYPE_CODE_REF)
- && (type->target_type ()->code () == TYPE_CODE_FUNC
- || (type->target_type ()->code ()
- == TYPE_CODE_METHOD)
- || (type->target_type ()->code ()
- == TYPE_CODE_ARRAY))))))
+ || ((show > 0 || type->name () == 0)
+ && (code == TYPE_CODE_FUNC || code == TYPE_CODE_METHOD
+ || code == TYPE_CODE_ARRAY
+ || ((code == TYPE_CODE_PTR || code == TYPE_CODE_REF)
+ && (type->target_type ()->code () == TYPE_CODE_FUNC
+ || (type->target_type ()->code () == TYPE_CODE_METHOD)
+ || (type->target_type ()->code () == TYPE_CODE_ARRAY))))))
gdb_puts (" ", stream);
f_type_print_varspec_prefix (type, stream, show, 0);
@@ -81,18 +77,19 @@ f_language::print_type (struct type *type, const char *varstring,
/* For demangled function names, we have the arglist as part of the name,
so don't print an additional pair of ()'s. */
- demangled_args = (*varstring != '\0'
- && varstring[strlen (varstring) - 1] == ')');
- f_type_print_varspec_suffix (type, stream, show, 0, demangled_args, 0, false);
- }
+ demangled_args
+ = (*varstring != '\0' && varstring[strlen (varstring) - 1] == ')');
+ f_type_print_varspec_suffix (type, stream, show, 0, demangled_args, 0,
+ false);
+ }
}
/* See f-lang.h. */
void
f_language::f_type_print_varspec_prefix (struct type *type,
- struct ui_file *stream,
- int show, int passed_a_ptr) const
+ struct ui_file *stream, int show,
+ int passed_a_ptr) const
{
if (type == 0)
return;
@@ -146,9 +143,8 @@ f_language::f_type_print_varspec_prefix (struct type *type,
void
f_language::f_type_print_varspec_suffix (struct type *type,
- struct ui_file *stream,
- int show, int passed_a_ptr,
- int demangled_args,
+ struct ui_file *stream, int show,
+ int passed_a_ptr, int demangled_args,
int arrayprint_recurse_level,
bool print_rank_only) const
{
@@ -188,8 +184,8 @@ f_language::f_type_print_varspec_suffix (struct type *type,
}
if (type->target_type ()->code () == TYPE_CODE_ARRAY)
- f_type_print_varspec_suffix (type->target_type (), stream, 0,
- 0, 0, arrayprint_recurse_level,
+ f_type_print_varspec_suffix (type->target_type (), stream, 0, 0, 0,
+ arrayprint_recurse_level,
print_rank_only);
if (print_rank_only)
@@ -197,7 +193,7 @@ f_language::f_type_print_varspec_suffix (struct type *type,
else
{
LONGEST lower_bound = f77_get_lowerbound (type);
- if (lower_bound != 1) /* Not the default. */
+ if (lower_bound != 1) /* Not the default. */
gdb_printf (stream, "%s:", plongest (lower_bound));
/* Make sure that, if we have an assumed size array, we
@@ -214,8 +210,8 @@ f_language::f_type_print_varspec_suffix (struct type *type,
}
if (type->target_type ()->code () != TYPE_CODE_ARRAY)
- f_type_print_varspec_suffix (type->target_type (), stream, 0,
- 0, 0, arrayprint_recurse_level,
+ f_type_print_varspec_suffix (type->target_type (), stream, 0, 0, 0,
+ arrayprint_recurse_level,
print_rank_only);
if (arrayprint_recurse_level == 1)
@@ -237,14 +233,14 @@ f_language::f_type_print_varspec_suffix (struct type *type,
int i, nfields = type->num_fields ();
f_type_print_varspec_suffix (type->target_type (), stream, 0,
- passed_a_ptr, 0,
- arrayprint_recurse_level, false);
+ passed_a_ptr, 0, arrayprint_recurse_level,
+ false);
if (passed_a_ptr)
gdb_printf (stream, ") ");
gdb_printf (stream, "(");
if (nfields == 0 && type->is_prototyped ())
- print_type (builtin_f_type (type->arch ())->builtin_void,
- "", stream, -1, 0, 0);
+ print_type (builtin_f_type (type->arch ())->builtin_void, "", stream,
+ -1, 0, 0);
else
for (i = 0; i < nfields; i++)
{
@@ -321,7 +317,7 @@ f_language::f_type_print_base (struct type *type, struct ui_file *stream,
if (type->code () == TYPE_CODE_UNION)
prefix = "Type, C_Union :: ";
else if (type->code () == TYPE_CODE_STRUCT
- || type->code () == TYPE_CODE_NAMELIST)
+ || type->code () == TYPE_CODE_NAMELIST)
prefix = "Type ";
gdb_printf (stream, "%*s%s%s", level, "", prefix, type->name ());
return;
@@ -427,13 +423,13 @@ f_language::f_type_print_base (struct type *type, struct ui_file *stream,
gdb_puts ("\n", stream);
for (index = 0; index < type->num_fields (); index++)
{
- f_type_print_base (type->field (index).type (), stream,
- show - 1, level + 4);
+ f_type_print_base (type->field (index).type (), stream, show - 1,
+ level + 4);
gdb_puts (" :: ", stream);
fputs_styled (type->field (index).name (),
variable_name_style.style (), stream);
- f_type_print_varspec_suffix (type->field (index).type (),
- stream, show - 1, 0, 0, 0, false);
+ f_type_print_varspec_suffix (type->field (index).type (), stream,
+ show - 1, 0, 0, 0, false);
gdb_puts ("\n", stream);
}
gdb_printf (stream, "%*sEnd Type ", level, "");
@@ -454,7 +450,7 @@ f_language::f_type_print_base (struct type *type, struct ui_file *stream,
if (type->name () != NULL)
gdb_printf (stream, "%*s%s", level, "", type->name ());
else
- error (_("Invalid type code (%d) in symbol table."), type->code ());
+ error (_ ("Invalid type code (%d) in symbol table."), type->code ());
break;
}
diff --git a/gdb/f-valprint.c b/gdb/f-valprint.c
index 55dbcc8309f..a193de2df27 100644
--- a/gdb/f-valprint.c
+++ b/gdb/f-valprint.c
@@ -44,7 +44,7 @@ LONGEST
f77_get_lowerbound (struct type *type)
{
if (type->bounds ()->low.kind () != PROP_CONST)
- error (_("Lower bound may not be '*' in F77"));
+ error (_ ("Lower bound may not be '*' in F77"));
return type->bounds ()->low.const_val ();
}
@@ -112,17 +112,16 @@ struct dimension_stats
class fortran_array_printer_impl : public fortran_array_walker_base_impl
{
public:
+
/* Constructor. TYPE is the array type being printed, ADDRESS is the
address in target memory for the object of TYPE being printed. VAL is
the GDB value (of TYPE) being printed. STREAM is where to print to,
RECOURSE is passed through (and prevents infinite recursion), and
OPTIONS are the printing control options. */
- explicit fortran_array_printer_impl (struct type *type,
- CORE_ADDR address,
- struct value *val,
- struct ui_file *stream,
- int recurse,
- const struct value_print_options *options)
+ explicit fortran_array_printer_impl (
+ struct type *type, CORE_ADDR address, struct value *val,
+ struct ui_file *stream, int recurse,
+ const struct value_print_options *options)
: m_elts (0),
m_val (val),
m_stream (stream),
@@ -131,7 +130,8 @@ public:
m_dimension (0),
m_nrepeats (0),
m_stats (0)
- { /* Nothing. */ }
+ { /* Nothing. */
+ }
/* Called while iterating over the array bounds. When SHOULD_CONTINUE is
false then we must return false, as we have reached the end of the
@@ -184,21 +184,19 @@ public:
index in the dimension currently being walked and LAST_P is true
only when this is the last element that will be processed in this
dimension. */
- void process_dimension (gdb::function_view<void (struct type *,
- int, bool)> walk_1,
- struct type *elt_type, LONGEST elt_off,
- LONGEST index, bool last_p)
+ void process_dimension (
+ gdb::function_view<void (struct type *, int, bool)> walk_1,
+ struct type *elt_type, LONGEST elt_off, LONGEST index, bool last_p)
{
size_t dim_indx = m_dimension - 1;
struct type *elt_type_prev = m_elt_type_prev;
LONGEST elt_off_prev = m_elt_off_prev;
- bool repeated = (m_options->repeat_count_threshold < UINT_MAX
- && elt_type_prev != nullptr
- && (m_elts + ((m_nrepeats + 1)
- * m_stats[dim_indx + 1].nelts)
- <= m_options->print_max)
- && dimension_contents_eq (m_val, elt_type,
- elt_off_prev, elt_off));
+ bool repeated
+ = (m_options->repeat_count_threshold < UINT_MAX
+ && elt_type_prev != nullptr
+ && (m_elts + ((m_nrepeats + 1) * m_stats[dim_indx + 1].nelts)
+ <= m_options->print_max)
+ && dimension_contents_eq (m_val, elt_type, elt_off_prev, elt_off));
if (repeated)
m_nrepeats++;
@@ -212,8 +210,7 @@ public:
annotate_elt_rep (nrepeats + 1);
gdb_printf (m_stream, "%p[<repeats %s times>%p]",
metadata_style.style ().ptr (),
- plongest (nrepeats + 1),
- nullptr);
+ plongest (nrepeats + 1), nullptr);
annotate_elt_rep_end ();
if (!repeated)
gdb_puts (" ", m_stream);
@@ -223,8 +220,8 @@ public:
for (LONGEST i = nrepeats; i > 0; i--)
{
maybe_print_array_index (m_stats[dim_indx].index_type,
- index - nrepeats + repeated,
- m_stream, m_options);
+ index - nrepeats + repeated, m_stream,
+ m_options);
walk_1 (elt_type_prev, elt_off_prev, repeated && i == 1);
}
@@ -255,8 +252,8 @@ public:
start of the parent object, where INDEX is the value of the element's
index in the dimension currently being walked and LAST_P is true only
when this is the last element to be processed in this dimension. */
- void process_element (struct type *elt_type, LONGEST elt_off,
- LONGEST index, bool last_p)
+ void process_element (struct type *elt_type, LONGEST elt_off, LONGEST index,
+ bool last_p)
{
size_t dim_indx = m_dimension - 1;
struct type *elt_type_prev = m_elt_type_prev;
@@ -281,8 +278,7 @@ public:
annotate_elt_rep (nrepeats + 1);
gdb_printf (m_stream, "%p[<repeats %s times>%p]",
metadata_style.style ().ptr (),
- plongest (nrepeats + 1),
- nullptr);
+ plongest (nrepeats + 1), nullptr);
annotate_elt_rep_end ();
}
else
@@ -294,8 +290,8 @@ public:
for (LONGEST i = nrepeats; i > 0; i--)
{
maybe_print_array_index (m_stats[dim_indx].index_type,
- index - i + 1,
- m_stream, m_options);
+ index - i + 1, m_stream,
+ m_options);
common_val_print (e_val, m_stream, m_recurse, m_options,
current_language);
if (i > 1)
@@ -328,13 +324,13 @@ public:
}
private:
+
/* Called to compare two VAL elements of ELT_TYPE at offsets OFFSET1
and OFFSET2 each. Handle subarrays recursively, because they may
have been sliced and we do not want to compare any memory contents
present between the slices requested. */
- bool
- dimension_contents_eq (const struct value *val, struct type *type,
- LONGEST offset1, LONGEST offset2)
+ bool dimension_contents_eq (const struct value *val, struct type *type,
+ LONGEST offset1, LONGEST offset2)
{
if (type->code () == TYPE_CODE_ARRAY
&& type->target_type ()->code () != TYPE_CODE_CHAR)
@@ -362,8 +358,7 @@ private:
return true;
}
else
- return value_contents_eq (val, offset1, val, offset2,
- type->length ());
+ return value_contents_eq (val, offset1, val, offset2, type->length ());
}
/* The number of elements printed so far. */
@@ -405,25 +400,17 @@ fortran_print_array (struct type *type, CORE_ADDR address,
const struct value *val,
const struct value_print_options *options)
{
- fortran_array_walker<fortran_array_printer_impl> p
- (type, address, (struct value *) val, stream, recurse, options);
+ fortran_array_walker<fortran_array_printer_impl> p (type, address,
+ (struct value *) val,
+ stream, recurse,
+ options);
p.walk ();
}
-
/* Decorations for Fortran. */
-static const struct generic_val_print_decorations f_decorations =
-{
- "(",
- ",",
- ")",
- ".TRUE.",
- ".FALSE.",
- "void",
- "{",
- "}"
-};
+static const struct generic_val_print_decorations f_decorations
+ = { "(", ",", ")", ".TRUE.", ".FALSE.", "void", "{", "}" };
/* See f-lang.h. */
@@ -458,8 +445,7 @@ f_language::value_print_inner (struct value *val, struct ui_file *stream,
f77_get_dynamic_length_of_aggregate (type);
printstr (stream, ch_type, valaddr,
- type->length () / ch_type->length (), NULL, 0,
- options);
+ type->length () / ch_type->length (), NULL, 0, options);
}
break;
@@ -494,15 +480,13 @@ f_language::value_print_inner (struct value *val, struct ui_file *stream,
/* For a pointer to char or unsigned char, also print the string
pointed to, unless pointer is null. */
- if (elttype->length () == 1
- && elttype->code () == TYPE_CODE_INT
- && (options->format == 0 || options->format == 's')
- && addr != 0)
+ if (elttype->length () == 1 && elttype->code () == TYPE_CODE_INT
+ && (options->format == 0 || options->format == 's') && addr != 0)
{
if (want_space)
gdb_puts (" ", stream);
- val_print_string (type->target_type (), NULL, addr, -1,
- stream, options);
+ val_print_string (type->target_type (), NULL, addr, -1, stream,
+ options);
}
return;
}
@@ -532,8 +516,9 @@ f_language::value_print_inner (struct value *val, struct ui_file *stream,
= lookup_symbol (field_name, get_selected_block (nullptr),
VAR_DOMAIN, nullptr);
if (sym.symbol == nullptr)
- error (_("failed to find symbol for name list component %s"),
- field_name);
+ error (
+ _ ("failed to find symbol for name list component %s"),
+ field_name);
field = value_of_variable (sym.symbol, sym.block);
}
else
@@ -549,21 +534,21 @@ f_language::value_print_inner (struct value *val, struct ui_file *stream,
gdb_puts (" = ", stream);
}
- common_val_print (field, stream, recurse + 1,
- options, current_language);
+ common_val_print (field, stream, recurse + 1, options,
+ current_language);
++printed_field;
}
- }
+ }
gdb_printf (stream, " )");
- break;
+ break;
case TYPE_CODE_BOOL:
if (options->format || options->output_format)
{
struct value_print_options opts = *options;
- opts.format = (options->format ? options->format
- : options->output_format);
+ opts.format
+ = (options->format ? options->format : options->output_format);
value_print_scalar_formatted (val, &opts, 0, stream);
}
else
@@ -614,8 +599,9 @@ info_common_command_for_block (const struct block *block, const char *comname,
gdb_assert (sym->aclass () == LOC_COMMON_BLOCK);
- if (comname && (!sym->linkage_name ()
- || strcmp (comname, sym->linkage_name ()) != 0))
+ if (comname
+ && (!sym->linkage_name ()
+ || strcmp (comname, sym->linkage_name ()) != 0))
continue;
if (*any_printed)
@@ -623,17 +609,16 @@ info_common_command_for_block (const struct block *block, const char *comname,
else
*any_printed = 1;
if (sym->print_name ())
- gdb_printf (_("Contents of F77 COMMON block '%s':\n"),
+ gdb_printf (_ ("Contents of F77 COMMON block '%s':\n"),
sym->print_name ());
else
- gdb_printf (_("Contents of blank COMMON block:\n"));
-
+ gdb_printf (_ ("Contents of blank COMMON block:\n"));
+
for (index = 0; index < common->n_entries; index++)
{
struct value *val = NULL;
- gdb_printf ("%s = ",
- common->contents[index]->print_name ());
+ gdb_printf ("%s = ", common->contents[index]->print_name ());
try
{
@@ -669,7 +654,7 @@ info_common_command (const char *comname, int from_tty)
first make sure that it is visible and if so, let
us display its contents. */
- fi = get_selected_frame (_("No frame selected"));
+ fi = get_selected_frame (_ ("No frame selected"));
/* The following is generally ripped off from stack.c's routine
print_frame_info(). */
@@ -677,7 +662,7 @@ info_common_command (const char *comname, int from_tty)
block = get_frame_block (fi, 0);
if (block == NULL)
{
- gdb_printf (_("No symbol table info available.\n"));
+ gdb_printf (_ ("No symbol table info available.\n"));
return;
}
@@ -694,16 +679,17 @@ info_common_command (const char *comname, int from_tty)
if (!values_printed)
{
if (comname)
- gdb_printf (_("No common block '%s'.\n"), comname);
+ gdb_printf (_ ("No common block '%s'.\n"), comname);
else
- gdb_printf (_("No common blocks.\n"));
+ gdb_printf (_ ("No common blocks.\n"));
}
}
void _initialize_f_valprint ();
+
void
_initialize_f_valprint ()
{
add_info ("common", info_common_command,
- _("Print out the values contained in a Fortran COMMON block."));
+ _ ("Print out the values contained in a Fortran COMMON block."));
}
diff --git a/gdb/fbsd-nat.c b/gdb/fbsd-nat.c
index 27d2fe45092..27d657051c5 100644
--- a/gdb/fbsd-nat.c
+++ b/gdb/fbsd-nat.c
@@ -50,8 +50,8 @@
#include <list>
#ifndef PT_GETREGSET
-#define PT_GETREGSET 42 /* Get a target register set */
-#define PT_SETREGSET 43 /* Set a target register set */
+#define PT_GETREGSET 42 /* Get a target register set */
+#define PT_SETREGSET 43 /* Set a target register set */
#endif
/* Return the name of a file that can be opened to get the symbols for
@@ -91,10 +91,10 @@ fbsd_nat_target::find_memory_regions (find_memory_region_ftype func,
uint64_t size;
int i, nitems;
- gdb::unique_xmalloc_ptr<struct kinfo_vmentry>
- vmentl (kinfo_getvmmap (pid, &nitems));
+ gdb::unique_xmalloc_ptr<struct kinfo_vmentry> vmentl (
+ kinfo_getvmmap (pid, &nitems));
if (vmentl == NULL)
- perror_with_name (_("Couldn't fetch VM map entries"));
+ perror_with_name (_ ("Couldn't fetch VM map entries"));
for (i = 0, kve = vmentl.get (); i < nitems; i++, kve++)
{
@@ -113,8 +113,7 @@ fbsd_nat_target::find_memory_regions (find_memory_region_ftype func,
size = kve->kve_end - kve->kve_start;
if (info_verbose)
{
- gdb_printf ("Save segment, %ld bytes at %s (%c%c%c)\n",
- (long) size,
+ gdb_printf ("Save segment, %ld bytes at %s (%c%c%c)\n", (long) size,
paddress (target_gdbarch (), kve->kve_start),
kve->kve_protection & KVME_PROT_READ ? 'r' : '-',
kve->kve_protection & KVME_PROT_WRITE ? 'w' : '-',
@@ -231,7 +230,7 @@ fbsd_nat_target::info_proc (const char *args, enum info_proc_what what)
do_status = true;
break;
default:
- error (_("Not supported on this target."));
+ error (_ ("Not supported on this target."));
}
gdb_argv built_argv (args);
@@ -239,14 +238,14 @@ fbsd_nat_target::info_proc (const char *args, enum info_proc_what what)
{
pid = inferior_ptid.pid ();
if (pid == 0)
- error (_("No current process: you must name one."));
+ error (_ ("No current process: you must name one."));
}
else if (built_argv.count () == 1 && isdigit (built_argv[0][0]))
pid = strtol (built_argv[0], NULL, 10);
else
- error (_("Invalid arguments."));
+ error (_ ("Invalid arguments."));
- gdb_printf (_("process %d\n"), pid);
+ gdb_printf (_ ("process %d\n"), pid);
if (do_cwd || do_exe || do_files)
fdtbl.reset (kinfo_getfile (pid, &nfd));
@@ -256,7 +255,7 @@ fbsd_nat_target::info_proc (const char *args, enum info_proc_what what)
if (cmdline != nullptr)
gdb_printf ("cmdline = '%s'\n", cmdline.get ());
else
- warning (_("unable to fetch command line"));
+ warning (_ ("unable to fetch command line"));
}
if (do_cwd)
{
@@ -273,7 +272,7 @@ fbsd_nat_target::info_proc (const char *args, enum info_proc_what what)
if (cwd != NULL)
gdb_printf ("cwd = '%s'\n", cwd);
else
- warning (_("unable to fetch current working directory"));
+ warning (_ ("unable to fetch current working directory"));
}
if (do_exe)
{
@@ -292,7 +291,7 @@ fbsd_nat_target::info_proc (const char *args, enum info_proc_what what)
if (exe != NULL)
gdb_printf ("exe = '%s'\n", exe);
else
- warning (_("unable to fetch executable path name"));
+ warning (_ ("unable to fetch executable path name"));
}
if (do_files)
{
@@ -309,13 +308,13 @@ fbsd_nat_target::info_proc (const char *args, enum info_proc_what what)
&kf->kf_sa_peer, kf->kf_path);
}
else
- warning (_("unable to fetch list of open files"));
+ warning (_ ("unable to fetch list of open files"));
}
if (do_mappings)
{
int nvment;
- gdb::unique_xmalloc_ptr<struct kinfo_vmentry>
- vmentl (kinfo_getvmmap (pid, &nvment));
+ gdb::unique_xmalloc_ptr<struct kinfo_vmentry> vmentl (
+ kinfo_getvmmap (pid, &nvment));
if (vmentl != nullptr)
{
@@ -330,12 +329,12 @@ fbsd_nat_target::info_proc (const char *args, enum info_proc_what what)
kve->kve_path);
}
else
- warning (_("unable to fetch virtual memory map"));
+ warning (_ ("unable to fetch virtual memory map"));
}
if (do_status)
{
if (!fbsd_fetch_kinfo_proc (pid, &kp))
- warning (_("Failed to fetch process information"));
+ warning (_ ("Failed to fetch process information"));
else
{
const char *state;
@@ -404,18 +403,14 @@ fbsd_nat_target::info_proc (const char *args, enum info_proc_what what)
plongest (kp.ki_rusage_ch.ru_stime.tv_sec),
kp.ki_rusage_ch.ru_stime.tv_usec);
gdb_printf ("'nice' value: %d\n", kp.ki_nice);
- gdb_printf ("Start time: %s.%06ld\n",
- plongest (kp.ki_start.tv_sec),
+ gdb_printf ("Start time: %s.%06ld\n", plongest (kp.ki_start.tv_sec),
kp.ki_start.tv_usec);
pgtok = getpagesize () / 1024;
gdb_printf ("Virtual memory size: %s kB\n",
pulongest (kp.ki_size / 1024));
- gdb_printf ("Data size: %s kB\n",
- pulongest (kp.ki_dsize * pgtok));
- gdb_printf ("Stack size: %s kB\n",
- pulongest (kp.ki_ssize * pgtok));
- gdb_printf ("Text size: %s kB\n",
- pulongest (kp.ki_tsize * pgtok));
+ gdb_printf ("Data size: %s kB\n", pulongest (kp.ki_dsize * pgtok));
+ gdb_printf ("Stack size: %s kB\n", pulongest (kp.ki_ssize * pgtok));
+ gdb_printf ("Text size: %s kB\n", pulongest (kp.ki_tsize * pgtok));
gdb_printf ("Resident set size: %s kB\n",
pulongest (kp.ki_rssize * pgtok));
gdb_printf ("Maximum RSS: %s kB\n",
@@ -441,7 +436,8 @@ fbsd_nat_target::info_proc (const char *args, enum info_proc_what what)
/* Return the size of siginfo for the current inferior. */
#ifdef __LP64__
-union sigval32 {
+union sigval32
+{
int sival_int;
uint32_t sival_ptr;
};
@@ -461,25 +457,30 @@ struct siginfo32
int si_status;
uint32_t si_addr;
union sigval32 si_value;
+
union
{
struct
{
int _trapno;
} _fault;
+
struct
{
int _timerid;
int _overrun;
} _timer;
+
struct
{
int _mqd;
} _mesgq;
+
struct
{
int32_t _band;
} _poll;
+
struct
{
int32_t __spare1__;
@@ -543,34 +544,35 @@ fbsd_convert_siginfo (siginfo_t *si)
si32._reason.__spare__.__spare1__ = si->_reason.__spare__.__spare1__;
for (int i = 0; i < 7; i++)
si32._reason.__spare__.__spare2__[i] = si->_reason.__spare__.__spare2__[i];
- switch (si->si_signo) {
- case SIGILL:
- case SIGFPE:
- case SIGSEGV:
- case SIGBUS:
- si32.si_trapno = si->si_trapno;
- break;
- }
- switch (si->si_code) {
- case SI_TIMER:
- si32.si_timerid = si->si_timerid;
- si32.si_overrun = si->si_overrun;
- break;
- case SI_MESGQ:
- si32.si_mqd = si->si_mqd;
- break;
- }
+ switch (si->si_signo)
+ {
+ case SIGILL:
+ case SIGFPE:
+ case SIGSEGV:
+ case SIGBUS:
+ si32.si_trapno = si->si_trapno;
+ break;
+ }
+ switch (si->si_code)
+ {
+ case SI_TIMER:
+ si32.si_timerid = si->si_timerid;
+ si32.si_overrun = si->si_overrun;
+ break;
+ case SI_MESGQ:
+ si32.si_mqd = si->si_mqd;
+ break;
+ }
- memcpy(si, &si32, sizeof (si32));
+ memcpy (si, &si32, sizeof (si32));
#endif
}
/* Implement the "xfer_partial" target_ops method. */
enum target_xfer_status
-fbsd_nat_target::xfer_partial (enum target_object object,
- const char *annex, gdb_byte *readbuf,
- const gdb_byte *writebuf,
+fbsd_nat_target::xfer_partial (enum target_object object, const char *annex,
+ gdb_byte *readbuf, const gdb_byte *writebuf,
ULONGEST offset, ULONGEST len,
ULONGEST *xfered_len)
{
@@ -594,7 +596,8 @@ fbsd_nat_target::xfer_partial (enum target_object object,
if (offset > siginfo_size)
return TARGET_XFER_E_IO;
- if (ptrace (PT_LWPINFO, pid, (PTRACE_TYPE_ARG3) &pl, sizeof (pl)) == -1)
+ if (ptrace (PT_LWPINFO, pid, (PTRACE_TYPE_ARG3) &pl, sizeof (pl))
+ == -1)
return TARGET_XFER_E_IO;
if (!(pl.pl_flags & PL_FLAG_SI))
@@ -709,9 +712,8 @@ fbsd_nat_target::xfer_partial (enum target_object object,
}
#endif
default:
- return inf_ptrace_target::xfer_partial (object, annex,
- readbuf, writebuf, offset,
- len, xfered_len);
+ return inf_ptrace_target::xfer_partial (object, annex, readbuf, writebuf,
+ offset, len, xfered_len);
}
}
@@ -722,15 +724,14 @@ static void
show_fbsd_lwp_debug (struct ui_file *file, int from_tty,
struct cmd_list_element *c, const char *value)
{
- gdb_printf (file, _("Debugging of FreeBSD lwp module is %s.\n"), value);
+ gdb_printf (file, _ ("Debugging of FreeBSD lwp module is %s.\n"), value);
}
static void
show_fbsd_nat_debug (struct ui_file *file, int from_tty,
struct cmd_list_element *c, const char *value)
{
- gdb_printf (file, _("Debugging of FreeBSD native target is %s.\n"),
- value);
+ gdb_printf (file, _ ("Debugging of FreeBSD native target is %s.\n"), value);
}
#define fbsd_lwp_debug_printf(fmt, ...) \
@@ -739,7 +740,6 @@ show_fbsd_nat_debug (struct ui_file *file, int from_tty,
#define fbsd_nat_debug_printf(fmt, ...) \
debug_prefixed_printf_cond (debug_fbsd_nat, "fbsd-nat", fmt, ##__VA_ARGS__)
-
/*
FreeBSD's first thread support was via a "reentrant" version of libc
(libc_r) that first shipped in 2.2.7. This library multiplexed all
@@ -776,8 +776,7 @@ fbsd_nat_target::thread_alive (ptid_t ptid)
{
struct ptrace_lwpinfo pl;
- if (ptrace (PT_LWPINFO, ptid.lwp (), (caddr_t) &pl, sizeof pl)
- == -1)
+ if (ptrace (PT_LWPINFO, ptid.lwp (), (caddr_t) &pl, sizeof pl) == -1)
return false;
#ifdef PL_FLAG_EXITED
if (pl.pl_flags & PL_FLAG_EXITED)
@@ -852,23 +851,25 @@ fbsd_enable_proc_events (pid_t pid)
#ifdef PT_GET_EVENT_MASK
int events;
- if (ptrace (PT_GET_EVENT_MASK, pid, (PTRACE_TYPE_ARG3)&events,
- sizeof (events)) == -1)
+ if (ptrace (PT_GET_EVENT_MASK, pid, (PTRACE_TYPE_ARG3) &events,
+ sizeof (events))
+ == -1)
perror_with_name (("ptrace (PT_GET_EVENT_MASK)"));
events |= PTRACE_FORK | PTRACE_LWP;
#ifdef PTRACE_VFORK
events |= PTRACE_VFORK;
#endif
- if (ptrace (PT_SET_EVENT_MASK, pid, (PTRACE_TYPE_ARG3)&events,
- sizeof (events)) == -1)
+ if (ptrace (PT_SET_EVENT_MASK, pid, (PTRACE_TYPE_ARG3) &events,
+ sizeof (events))
+ == -1)
perror_with_name (("ptrace (PT_SET_EVENT_MASK)"));
#else
#ifdef TDP_RFPPWAIT
- if (ptrace (PT_FOLLOW_FORK, pid, (PTRACE_TYPE_ARG3)0, 1) == -1)
+ if (ptrace (PT_FOLLOW_FORK, pid, (PTRACE_TYPE_ARG3) 0, 1) == -1)
perror_with_name (("ptrace (PT_FOLLOW_FORK)"));
#endif
#ifdef PT_LWP_EVENTS
- if (ptrace (PT_LWP_EVENTS, pid, (PTRACE_TYPE_ARG3)0, 1) == -1)
+ if (ptrace (PT_LWP_EVENTS, pid, (PTRACE_TYPE_ARG3) 0, 1) == -1)
perror_with_name (("ptrace (PT_LWP_EVENTS)"));
#endif
#endif
@@ -985,7 +986,8 @@ fbsd_nat_target::async (bool enable)
if (!async_file_open ())
internal_error ("failed to create event pipe.");
- add_file_handler (async_wait_fd (), handle_target_event, NULL, "fbsd-nat");
+ add_file_handler (async_wait_fd (), handle_target_event, NULL,
+ "fbsd-nat");
/* Trigger a poll in case there are pending events to
handle. */
@@ -1140,9 +1142,8 @@ fbsd_nat_target::resume (ptid_t ptid, int step, enum gdb_signal signo)
request = PT_SUSPEND;
if (ptrace (request, tp->ptid.lwp (), NULL, 0) == -1)
- perror_with_name (request == PT_RESUME ?
- ("ptrace (PT_RESUME)") :
- ("ptrace (PT_SUSPEND)"));
+ perror_with_name (request == PT_RESUME ? ("ptrace (PT_RESUME)")
+ : ("ptrace (PT_SUSPEND)"));
if (request == PT_RESUME)
low_prepare_to_resume (tp);
}
@@ -1203,7 +1204,6 @@ static bool
fbsd_handle_debug_trap (fbsd_nat_target *target, ptid_t ptid,
const struct ptrace_lwpinfo &pl)
{
-
/* Ignore traps without valid siginfo or for signals other than
SIGTRAP.
@@ -1301,7 +1301,7 @@ fbsd_nat_target::wait_1 (ptid_t ptid, struct target_waitstatus *ourstatus,
fbsd_lwp_debug_printf ("deleting thread for LWP %u",
pl.pl_lwpid);
if (print_thread_events)
- gdb_printf (_("[%s exited]\n"),
+ gdb_printf (_ ("[%s exited]\n"),
target_pid_to_str (wptid).c_str ());
low_delete_thread (thr);
delete_thread (thr);
@@ -1369,7 +1369,8 @@ fbsd_nat_target::wait_1 (ptid_t ptid, struct target_waitstatus *ourstatus,
gdb_assert (pid == child);
- if (ptrace (PT_LWPINFO, child, (caddr_t)&pl, sizeof pl) == -1)
+ if (ptrace (PT_LWPINFO, child, (caddr_t) &pl, sizeof pl)
+ == -1)
perror_with_name (("ptrace (PT_LWPINFO)"));
gdb_assert (pl.pl_flags & PL_FLAG_CHILD);
@@ -1388,7 +1389,7 @@ fbsd_nat_target::wait_1 (ptid_t ptid, struct target_waitstatus *ourstatus,
is_vfork = true;
}
else
- warning (_("Failed to fetch process information"));
+ warning (_ ("Failed to fetch process information"));
#endif
low_new_fork (wptid, child);
@@ -1421,8 +1422,8 @@ fbsd_nat_target::wait_1 (ptid_t ptid, struct target_waitstatus *ourstatus,
if (pl.pl_flags & PL_FLAG_EXEC)
{
- ourstatus->set_execd
- (make_unique_xstrdup (pid_to_exec_file (pid)));
+ ourstatus->set_execd (
+ make_unique_xstrdup (pid_to_exec_file (pid)));
return wptid;
}
@@ -1489,7 +1490,7 @@ fbsd_nat_target::wait (ptid_t ptid, struct target_waitstatus *ourstatus,
event loop keeps polling until no event is returned. */
if (is_async_p ()
&& ((ourstatus->kind () != TARGET_WAITKIND_IGNORE
- && ourstatus->kind() != TARGET_WAITKIND_NO_RESUMED)
+ && ourstatus->kind () != TARGET_WAITKIND_NO_RESUMED)
|| ptid != minus_one_ptid))
async_file_mark ();
@@ -1508,11 +1509,11 @@ fbsd_nat_target::stopped_by_sw_breakpoint ()
struct ptrace_lwpinfo pl;
if (ptrace (PT_LWPINFO, get_ptrace_pid (inferior_ptid), (caddr_t) &pl,
- sizeof pl) == -1)
+ sizeof pl)
+ == -1)
return false;
- return (pl.pl_flags == PL_FLAG_SI
- && pl.pl_siginfo.si_signo == SIGTRAP
+ return (pl.pl_flags == PL_FLAG_SI && pl.pl_siginfo.si_signo == SIGTRAP
&& pl.pl_siginfo.si_code == TRAP_BRKPT);
}
@@ -1530,14 +1531,17 @@ fbsd_nat_target::supports_stopped_by_sw_breakpoint ()
class maybe_disable_address_space_randomization
{
public:
- explicit maybe_disable_address_space_randomization (bool disable_randomization)
+
+ explicit maybe_disable_address_space_randomization (
+ bool disable_randomization)
{
if (disable_randomization)
{
if (procctl (P_PID, getpid (), PROC_ASLR_STATUS, &m_aslr_ctl) == -1)
{
- warning (_("Failed to fetch current address space randomization "
- "status: %s"), safe_strerror (errno));
+ warning (_ ("Failed to fetch current address space randomization "
+ "status: %s"),
+ safe_strerror (errno));
return;
}
@@ -1548,7 +1552,7 @@ public:
int ctl = PROC_ASLR_FORCE_DISABLE;
if (procctl (P_PID, getpid (), PROC_ASLR_CTL, &ctl) == -1)
{
- warning (_("Error disabling address space randomization: %s"),
+ warning (_ ("Error disabling address space randomization: %s"),
safe_strerror (errno));
return;
}
@@ -1562,7 +1566,7 @@ public:
if (m_aslr_ctl_set)
{
if (procctl (P_PID, getpid (), PROC_ASLR_CTL, &m_aslr_ctl) == -1)
- warning (_("Error restoring address space randomization: %s"),
+ warning (_ ("Error restoring address space randomization: %s"),
safe_strerror (errno));
}
}
@@ -1570,6 +1574,7 @@ public:
DISABLE_COPY_AND_ASSIGN (maybe_disable_address_space_randomization);
private:
+
bool m_aslr_ctl_set = false;
int m_aslr_ctl = 0;
};
@@ -1577,12 +1582,12 @@ private:
void
fbsd_nat_target::create_inferior (const char *exec_file,
- const std::string &allargs,
- char **env, int from_tty)
+ const std::string &allargs, char **env,
+ int from_tty)
{
#ifdef PROC_ASLR_CTL
- maybe_disable_address_space_randomization restore_aslr_ctl
- (disable_randomization);
+ maybe_disable_address_space_randomization restore_aslr_ctl (
+ disable_randomization);
#endif
inf_ptrace_target::create_inferior (exec_file, allargs, env, from_tty);
@@ -1607,7 +1612,7 @@ fbsd_nat_target::follow_fork (inferior *child_inf, ptid_t child_ptid,
/* Breakpoints have already been detached from the child by
infrun.c. */
- if (ptrace (PT_DETACH, child_pid, (PTRACE_TYPE_ARG3)1, 0) == -1)
+ if (ptrace (PT_DETACH, child_pid, (PTRACE_TYPE_ARG3) 1, 0) == -1)
perror_with_name (("ptrace (PT_DETACH)"));
#ifndef PTRACE_VFORK
@@ -1699,11 +1704,10 @@ fbsd_nat_target::remove_exec_catchpoint (int pid)
#ifdef HAVE_STRUCT_PTRACE_LWPINFO_PL_SYSCALL_CODE
int
-fbsd_nat_target::set_syscall_catchpoint (int pid, bool needed,
- int any_count,
- gdb::array_view<const int> syscall_counts)
+fbsd_nat_target::set_syscall_catchpoint (
+ int pid, bool needed, int any_count,
+ gdb::array_view<const int> syscall_counts)
{
-
/* Ignore the arguments. inf-ptrace.c will use PT_SYSCALL which
will catch all system call entries and exits. The system calls
are filtered by GDB rather than the kernel. */
@@ -1739,11 +1743,12 @@ fbsd_nat_target::fetch_register_set (struct regcache *regcache, int regnum,
pid_t pid = get_ptrace_pid (regcache->ptid ());
if (regnum == -1
- || (regnum >= regbase && regcache_map_supplies (map, regnum - regbase,
- regcache->arch(), size)))
+ || (regnum >= regbase
+ && regcache_map_supplies (map, regnum - regbase, regcache->arch (),
+ size)))
{
if (ptrace (fetch_op, pid, (PTRACE_TYPE_ARG3) regs, 0) == -1)
- perror_with_name (_("Couldn't get registers"));
+ perror_with_name (_ ("Couldn't get registers"));
regset->supply_regset (regset, regcache, regnum, regs, size);
return true;
@@ -1764,16 +1769,17 @@ fbsd_nat_target::store_register_set (struct regcache *regcache, int regnum,
pid_t pid = get_ptrace_pid (regcache->ptid ());
if (regnum == -1
- || (regnum >= regbase && regcache_map_supplies (map, regnum - regbase,
- regcache->arch(), size)))
+ || (regnum >= regbase
+ && regcache_map_supplies (map, regnum - regbase, regcache->arch (),
+ size)))
{
if (ptrace (fetch_op, pid, (PTRACE_TYPE_ARG3) regs, 0) == -1)
- perror_with_name (_("Couldn't get registers"));
+ perror_with_name (_ ("Couldn't get registers"));
regset->collect_regset (regset, regcache, regnum, regs, size);
if (ptrace (store_op, pid, (PTRACE_TYPE_ARG3) regs, 0) == -1)
- perror_with_name (_("Couldn't write registers"));
+ perror_with_name (_ ("Couldn't write registers"));
return true;
}
return false;
@@ -1806,15 +1812,16 @@ fbsd_nat_target::fetch_regset (struct regcache *regcache, int regnum, int note,
pid_t pid = get_ptrace_pid (regcache->ptid ());
if (regnum == -1
- || (regnum >= regbase && regcache_map_supplies (map, regnum - regbase,
- regcache->arch(), size)))
+ || (regnum >= regbase
+ && regcache_map_supplies (map, regnum - regbase, regcache->arch (),
+ size)))
{
struct iovec iov;
iov.iov_base = regs;
iov.iov_len = size;
if (ptrace (PT_GETREGSET, pid, (PTRACE_TYPE_ARG3) &iov, note) == -1)
- perror_with_name (_("Couldn't get registers"));
+ perror_with_name (_ ("Couldn't get registers"));
regset->supply_regset (regset, regcache, regnum, regs, size);
return true;
@@ -1832,20 +1839,21 @@ fbsd_nat_target::store_regset (struct regcache *regcache, int regnum, int note,
pid_t pid = get_ptrace_pid (regcache->ptid ());
if (regnum == -1
- || (regnum >= regbase && regcache_map_supplies (map, regnum - regbase,
- regcache->arch(), size)))
+ || (regnum >= regbase
+ && regcache_map_supplies (map, regnum - regbase, regcache->arch (),
+ size)))
{
struct iovec iov;
iov.iov_base = regs;
iov.iov_len = size;
if (ptrace (PT_GETREGSET, pid, (PTRACE_TYPE_ARG3) &iov, note) == -1)
- perror_with_name (_("Couldn't get registers"));
+ perror_with_name (_ ("Couldn't get registers"));
regset->collect_regset (regset, regcache, regnum, regs, size);
if (ptrace (PT_SETREGSET, pid, (PTRACE_TYPE_ARG3) &iov, note) == -1)
- perror_with_name (_("Couldn't write registers"));
+ perror_with_name (_ ("Couldn't write registers"));
return true;
}
return false;
@@ -1862,31 +1870,35 @@ fbsd_nat_get_siginfo (ptid_t ptid, siginfo_t *siginfo)
if (ptrace (PT_LWPINFO, pid, (caddr_t) &pl, sizeof pl) == -1)
return false;
if (!(pl.pl_flags & PL_FLAG_SI))
- return false;;
+ return false;
+ ;
*siginfo = pl.pl_siginfo;
return (true);
}
void _initialize_fbsd_nat ();
+
void
_initialize_fbsd_nat ()
{
- add_setshow_boolean_cmd ("fbsd-lwp", class_maintenance,
- &debug_fbsd_lwp, _("\
-Set debugging of FreeBSD lwp module."), _("\
-Show debugging of FreeBSD lwp module."), _("\
+ add_setshow_boolean_cmd ("fbsd-lwp", class_maintenance, &debug_fbsd_lwp,
+ _ ("\
+Set debugging of FreeBSD lwp module."),
+ _ ("\
+Show debugging of FreeBSD lwp module."),
+ _ ("\
Enables printf debugging output."),
- NULL,
- &show_fbsd_lwp_debug,
- &setdebuglist, &showdebuglist);
- add_setshow_boolean_cmd ("fbsd-nat", class_maintenance,
- &debug_fbsd_nat, _("\
-Set debugging of FreeBSD native target."), _("\
-Show debugging of FreeBSD native target."), _("\
+ NULL, &show_fbsd_lwp_debug, &setdebuglist,
+ &showdebuglist);
+ add_setshow_boolean_cmd ("fbsd-nat", class_maintenance, &debug_fbsd_nat,
+ _ ("\
+Set debugging of FreeBSD native target."),
+ _ ("\
+Show debugging of FreeBSD native target."),
+ _ ("\
Enables printf debugging output."),
- NULL,
- &show_fbsd_nat_debug,
- &setdebuglist, &showdebuglist);
+ NULL, &show_fbsd_nat_debug, &setdebuglist,
+ &showdebuglist);
/* Install a SIGCHLD handler. */
signal (SIGCHLD, sigchld_handler);
diff --git a/gdb/fbsd-nat.h b/gdb/fbsd-nat.h
index a19bceaf5e4..e06fa21aba9 100644
--- a/gdb/fbsd-nat.h
+++ b/gdb/fbsd-nat.h
@@ -32,11 +32,11 @@
older kernels without TRAP_BRKPT support did not report valid
values on any architecture. */
#if (__FreeBSD_kernel_version >= 1102502) || (__FreeBSD_version >= 1102502)
-# define USE_SIGTRAP_SIGINFO
+#define USE_SIGTRAP_SIGINFO
#elif defined(TRAP_BRKPT)
-# if !defined(__mips__) && !defined(__sparc64__)
-# define USE_SIGTRAP_SIGINFO
-# endif
+#if !defined(__mips__) && !defined(__sparc64__)
+#define USE_SIGTRAP_SIGINFO
+#endif
#endif
/* A prototype FreeBSD target. */
@@ -44,6 +44,7 @@
class fbsd_nat_target : public inf_ptrace_target
{
public:
+
const char *pid_to_exec_file (int pid) override;
int find_memory_regions (find_memory_region_ftype func, void *data) override;
@@ -51,8 +52,7 @@ public:
bool info_proc (const char *, enum info_proc_what) override;
enum target_xfer_status xfer_partial (enum target_object object,
- const char *annex,
- gdb_byte *readbuf,
+ const char *annex, gdb_byte *readbuf,
const gdb_byte *writebuf,
ULONGEST offset, ULONGEST len,
ULONGEST *xfered_len) override;
@@ -71,10 +71,12 @@ public:
void async (bool) override;
thread_control_capabilities get_thread_control_capabilities () override
- { return tc_schedlock; }
+ {
+ return tc_schedlock;
+ }
- void create_inferior (const char *, const std::string &,
- char **, int) override;
+ void create_inferior (const char *, const std::string &, char **,
+ int) override;
void resume (ptid_t, int, enum gdb_signal) override;
@@ -101,8 +103,8 @@ public:
int remove_exec_catchpoint (int) override;
#ifdef HAVE_STRUCT_PTRACE_LWPINFO_PL_SYSCALL_CODE
- int set_syscall_catchpoint (int, bool, int, gdb::array_view<const int>)
- override;
+ int set_syscall_catchpoint (int, bool, int,
+ gdb::array_view<const int>) override;
#endif
bool supports_multi_process () override;
@@ -112,22 +114,20 @@ public:
/* Methods meant to be overridden by arch-specific target
classes. */
- virtual void low_new_fork (ptid_t parent, pid_t child)
- {}
+ virtual void low_new_fork (ptid_t parent, pid_t child) {}
/* The method to call, if any, when a thread is destroyed. */
- virtual void low_delete_thread (thread_info *)
- {}
+ virtual void low_delete_thread (thread_info *) {}
/* Hook to call prior to resuming a thread. */
- virtual void low_prepare_to_resume (thread_info *)
- {}
+ virtual void low_prepare_to_resume (thread_info *) {}
protected:
void post_startup_inferior (ptid_t) override;
private:
+
ptid_t wait_1 (ptid_t, struct target_waitstatus *, target_wait_flags);
/* Helper routines for use in fetch_registers and store_registers in
@@ -147,8 +147,8 @@ private:
matching REGNUM. */
bool fetch_register_set (struct regcache *regcache, int regnum, int fetch_op,
- const struct regset *regset, int regbase, void *regs,
- size_t size);
+ const struct regset *regset, int regbase,
+ void *regs, size_t size);
bool store_register_set (struct regcache *regcache, int regnum, int fetch_op,
int store_op, const struct regset *regset,
@@ -167,10 +167,11 @@ private:
size_t size);
protected:
+
/* Wrapper versions of the above helpers which accept a register set
type such as 'struct reg' or 'struct fpreg'. */
- template <class Regset>
+ template<class Regset>
bool fetch_register_set (struct regcache *regcache, int regnum, int fetch_op,
const struct regset *regset, int regbase = 0)
{
@@ -179,7 +180,7 @@ protected:
&regs, sizeof (regs));
}
- template <class Regset>
+ template<class Regset>
bool store_register_set (struct regcache *regcache, int regnum, int fetch_op,
int store_op, const struct regset *regset,
int regbase = 0)
@@ -200,7 +201,7 @@ protected:
/* Wrapper versions of the PT_GETREGSET and PT_REGSET helpers which
accept a register set type. */
- template <class Regset>
+ template<class Regset>
bool fetch_regset (struct regcache *regcache, int regnum, int note,
const struct regset *regset, int regbase = 0)
{
@@ -209,7 +210,7 @@ protected:
sizeof (regs));
}
- template <class Regset>
+ template<class Regset>
bool store_regset (struct regcache *regcache, int regnum, int note,
const struct regset *regset, int regbase = 0)
{
diff --git a/gdb/fbsd-tdep.c b/gdb/fbsd-tdep.c
index 3a7cb9b14ea..976c6ed905e 100644
--- a/gdb/fbsd-tdep.c
+++ b/gdb/fbsd-tdep.c
@@ -37,100 +37,100 @@
/* This enum is derived from FreeBSD's <sys/signal.h>. */
enum
- {
- FREEBSD_SIGHUP = 1,
- FREEBSD_SIGINT = 2,
- FREEBSD_SIGQUIT = 3,
- FREEBSD_SIGILL = 4,
- FREEBSD_SIGTRAP = 5,
- FREEBSD_SIGABRT = 6,
- FREEBSD_SIGEMT = 7,
- FREEBSD_SIGFPE = 8,
- FREEBSD_SIGKILL = 9,
- FREEBSD_SIGBUS = 10,
- FREEBSD_SIGSEGV = 11,
- FREEBSD_SIGSYS = 12,
- FREEBSD_SIGPIPE = 13,
- FREEBSD_SIGALRM = 14,
- FREEBSD_SIGTERM = 15,
- FREEBSD_SIGURG = 16,
- FREEBSD_SIGSTOP = 17,
- FREEBSD_SIGTSTP = 18,
- FREEBSD_SIGCONT = 19,
- FREEBSD_SIGCHLD = 20,
- FREEBSD_SIGTTIN = 21,
- FREEBSD_SIGTTOU = 22,
- FREEBSD_SIGIO = 23,
- FREEBSD_SIGXCPU = 24,
- FREEBSD_SIGXFSZ = 25,
- FREEBSD_SIGVTALRM = 26,
- FREEBSD_SIGPROF = 27,
- FREEBSD_SIGWINCH = 28,
- FREEBSD_SIGINFO = 29,
- FREEBSD_SIGUSR1 = 30,
- FREEBSD_SIGUSR2 = 31,
- FREEBSD_SIGTHR = 32,
- FREEBSD_SIGLIBRT = 33,
- FREEBSD_SIGRTMIN = 65,
- FREEBSD_SIGRTMAX = 126,
- };
+{
+ FREEBSD_SIGHUP = 1,
+ FREEBSD_SIGINT = 2,
+ FREEBSD_SIGQUIT = 3,
+ FREEBSD_SIGILL = 4,
+ FREEBSD_SIGTRAP = 5,
+ FREEBSD_SIGABRT = 6,
+ FREEBSD_SIGEMT = 7,
+ FREEBSD_SIGFPE = 8,
+ FREEBSD_SIGKILL = 9,
+ FREEBSD_SIGBUS = 10,
+ FREEBSD_SIGSEGV = 11,
+ FREEBSD_SIGSYS = 12,
+ FREEBSD_SIGPIPE = 13,
+ FREEBSD_SIGALRM = 14,
+ FREEBSD_SIGTERM = 15,
+ FREEBSD_SIGURG = 16,
+ FREEBSD_SIGSTOP = 17,
+ FREEBSD_SIGTSTP = 18,
+ FREEBSD_SIGCONT = 19,
+ FREEBSD_SIGCHLD = 20,
+ FREEBSD_SIGTTIN = 21,
+ FREEBSD_SIGTTOU = 22,
+ FREEBSD_SIGIO = 23,
+ FREEBSD_SIGXCPU = 24,
+ FREEBSD_SIGXFSZ = 25,
+ FREEBSD_SIGVTALRM = 26,
+ FREEBSD_SIGPROF = 27,
+ FREEBSD_SIGWINCH = 28,
+ FREEBSD_SIGINFO = 29,
+ FREEBSD_SIGUSR1 = 30,
+ FREEBSD_SIGUSR2 = 31,
+ FREEBSD_SIGTHR = 32,
+ FREEBSD_SIGLIBRT = 33,
+ FREEBSD_SIGRTMIN = 65,
+ FREEBSD_SIGRTMAX = 126,
+};
/* Constants for values of si_code as defined in FreeBSD's
<sys/signal.h>. */
-#define FBSD_SI_USER 0x10001
-#define FBSD_SI_QUEUE 0x10002
-#define FBSD_SI_TIMER 0x10003
-#define FBSD_SI_ASYNCIO 0x10004
-#define FBSD_SI_MESGQ 0x10005
-#define FBSD_SI_KERNEL 0x10006
-#define FBSD_SI_LWP 0x10007
-
-#define FBSD_ILL_ILLOPC 1
-#define FBSD_ILL_ILLOPN 2
-#define FBSD_ILL_ILLADR 3
-#define FBSD_ILL_ILLTRP 4
-#define FBSD_ILL_PRVOPC 5
-#define FBSD_ILL_PRVREG 6
-#define FBSD_ILL_COPROC 7
-#define FBSD_ILL_BADSTK 8
-
-#define FBSD_BUS_ADRALN 1
-#define FBSD_BUS_ADRERR 2
-#define FBSD_BUS_OBJERR 3
-#define FBSD_BUS_OOMERR 100
-
-#define FBSD_SEGV_MAPERR 1
-#define FBSD_SEGV_ACCERR 2
-#define FBSD_SEGV_PKUERR 100
-
-#define FBSD_FPE_INTOVF 1
-#define FBSD_FPE_INTDIV 2
-#define FBSD_FPE_FLTDIV 3
-#define FBSD_FPE_FLTOVF 4
-#define FBSD_FPE_FLTUND 5
-#define FBSD_FPE_FLTRES 6
-#define FBSD_FPE_FLTINV 7
-#define FBSD_FPE_FLTSUB 8
-
-#define FBSD_TRAP_BRKPT 1
-#define FBSD_TRAP_TRACE 2
-#define FBSD_TRAP_DTRACE 3
-#define FBSD_TRAP_CAP 4
-
-#define FBSD_CLD_EXITED 1
-#define FBSD_CLD_KILLED 2
-#define FBSD_CLD_DUMPED 3
-#define FBSD_CLD_TRAPPED 4
-#define FBSD_CLD_STOPPED 5
-#define FBSD_CLD_CONTINUED 6
-
-#define FBSD_POLL_IN 1
-#define FBSD_POLL_OUT 2
-#define FBSD_POLL_MSG 3
-#define FBSD_POLL_ERR 4
-#define FBSD_POLL_PRI 5
-#define FBSD_POLL_HUP 6
+#define FBSD_SI_USER 0x10001
+#define FBSD_SI_QUEUE 0x10002
+#define FBSD_SI_TIMER 0x10003
+#define FBSD_SI_ASYNCIO 0x10004
+#define FBSD_SI_MESGQ 0x10005
+#define FBSD_SI_KERNEL 0x10006
+#define FBSD_SI_LWP 0x10007
+
+#define FBSD_ILL_ILLOPC 1
+#define FBSD_ILL_ILLOPN 2
+#define FBSD_ILL_ILLADR 3
+#define FBSD_ILL_ILLTRP 4
+#define FBSD_ILL_PRVOPC 5
+#define FBSD_ILL_PRVREG 6
+#define FBSD_ILL_COPROC 7
+#define FBSD_ILL_BADSTK 8
+
+#define FBSD_BUS_ADRALN 1
+#define FBSD_BUS_ADRERR 2
+#define FBSD_BUS_OBJERR 3
+#define FBSD_BUS_OOMERR 100
+
+#define FBSD_SEGV_MAPERR 1
+#define FBSD_SEGV_ACCERR 2
+#define FBSD_SEGV_PKUERR 100
+
+#define FBSD_FPE_INTOVF 1
+#define FBSD_FPE_INTDIV 2
+#define FBSD_FPE_FLTDIV 3
+#define FBSD_FPE_FLTOVF 4
+#define FBSD_FPE_FLTUND 5
+#define FBSD_FPE_FLTRES 6
+#define FBSD_FPE_FLTINV 7
+#define FBSD_FPE_FLTSUB 8
+
+#define FBSD_TRAP_BRKPT 1
+#define FBSD_TRAP_TRACE 2
+#define FBSD_TRAP_DTRACE 3
+#define FBSD_TRAP_CAP 4
+
+#define FBSD_CLD_EXITED 1
+#define FBSD_CLD_KILLED 2
+#define FBSD_CLD_DUMPED 3
+#define FBSD_CLD_TRAPPED 4
+#define FBSD_CLD_STOPPED 5
+#define FBSD_CLD_CONTINUED 6
+
+#define FBSD_POLL_IN 1
+#define FBSD_POLL_OUT 2
+#define FBSD_POLL_MSG 3
+#define FBSD_POLL_ERR 4
+#define FBSD_POLL_PRI 5
+#define FBSD_POLL_HUP 6
/* FreeBSD kernels 12.0 and later include a copy of the
'ptrace_lwpinfo' structure returned by the PT_LWPINFO ptrace
@@ -140,19 +140,19 @@ enum
'ptrace_lwpinfo' struct in the note is preceded by a 4 byte integer
containing the size of the structure. */
-#define LWPINFO_OFFSET 0x4
+#define LWPINFO_OFFSET 0x4
/* Offsets in ptrace_lwpinfo. */
-#define LWPINFO_PL_FLAGS 0x8
-#define LWPINFO64_PL_SIGINFO 0x30
-#define LWPINFO32_PL_SIGINFO 0x2c
+#define LWPINFO_PL_FLAGS 0x8
+#define LWPINFO64_PL_SIGINFO 0x30
+#define LWPINFO32_PL_SIGINFO 0x2c
/* Flags in pl_flags. */
-#define PL_FLAG_SI 0x20 /* siginfo is valid */
+#define PL_FLAG_SI 0x20 /* siginfo is valid */
/* Sizes of siginfo_t. */
-#define SIZE64_SIGINFO_T 80
-#define SIZE32_SIGINFO_T 64
+#define SIZE64_SIGINFO_T 80
+#define SIZE32_SIGINFO_T 64
/* Offsets in data structure used in NT_FREEBSD_PROCSTAT_VMMAP core
dump notes. See <sys/user.h> for the definition of struct
@@ -165,30 +165,30 @@ enum
core dump note has always used the 7.1 and later structure
format. */
-#define KVE_STRUCTSIZE 0x0
-#define KVE_START 0x8
-#define KVE_END 0x10
-#define KVE_OFFSET 0x18
-#define KVE_FLAGS 0x2c
-#define KVE_PROTECTION 0x38
-#define KVE_PATH 0x88
+#define KVE_STRUCTSIZE 0x0
+#define KVE_START 0x8
+#define KVE_END 0x10
+#define KVE_OFFSET 0x18
+#define KVE_FLAGS 0x2c
+#define KVE_PROTECTION 0x38
+#define KVE_PATH 0x88
/* Flags in the 'kve_protection' field in struct kinfo_vmentry. These
match the KVME_PROT_* constants in <sys/user.h>. */
-#define KINFO_VME_PROT_READ 0x00000001
-#define KINFO_VME_PROT_WRITE 0x00000002
-#define KINFO_VME_PROT_EXEC 0x00000004
+#define KINFO_VME_PROT_READ 0x00000001
+#define KINFO_VME_PROT_WRITE 0x00000002
+#define KINFO_VME_PROT_EXEC 0x00000004
/* Flags in the 'kve_flags' field in struct kinfo_vmentry. These
match the KVME_FLAG_* constants in <sys/user.h>. */
-#define KINFO_VME_FLAG_COW 0x00000001
-#define KINFO_VME_FLAG_NEEDS_COPY 0x00000002
-#define KINFO_VME_FLAG_NOCOREDUMP 0x00000004
-#define KINFO_VME_FLAG_SUPER 0x00000008
-#define KINFO_VME_FLAG_GROWS_UP 0x00000010
-#define KINFO_VME_FLAG_GROWS_DOWN 0x00000020
+#define KINFO_VME_FLAG_COW 0x00000001
+#define KINFO_VME_FLAG_NEEDS_COPY 0x00000002
+#define KINFO_VME_FLAG_NOCOREDUMP 0x00000004
+#define KINFO_VME_FLAG_SUPER 0x00000008
+#define KINFO_VME_FLAG_GROWS_UP 0x00000010
+#define KINFO_VME_FLAG_GROWS_DOWN 0x00000020
/* Offsets in data structure used in NT_FREEBSD_PROCSTAT_FILES core
dump notes. See <sys/user.h> for the definition of struct
@@ -200,88 +200,88 @@ enum
note wasn't introduced until FreeBSD 9.2. As a result, the core
dump note has always used the 7.1 and later structure format. */
-#define KF_STRUCTSIZE 0x0
-#define KF_TYPE 0x4
-#define KF_FD 0x8
-#define KF_FLAGS 0x10
-#define KF_OFFSET 0x18
-#define KF_VNODE_TYPE 0x20
-#define KF_SOCK_DOMAIN 0x24
-#define KF_SOCK_TYPE 0x28
-#define KF_SOCK_PROTOCOL 0x2c
-#define KF_SA_LOCAL 0x30
-#define KF_SA_PEER 0xb0
-#define KF_PATH 0x170
+#define KF_STRUCTSIZE 0x0
+#define KF_TYPE 0x4
+#define KF_FD 0x8
+#define KF_FLAGS 0x10
+#define KF_OFFSET 0x18
+#define KF_VNODE_TYPE 0x20
+#define KF_SOCK_DOMAIN 0x24
+#define KF_SOCK_TYPE 0x28
+#define KF_SOCK_PROTOCOL 0x2c
+#define KF_SA_LOCAL 0x30
+#define KF_SA_PEER 0xb0
+#define KF_PATH 0x170
/* Constants for the 'kf_type' field in struct kinfo_file. These
match the KF_TYPE_* constants in <sys/user.h>. */
-#define KINFO_FILE_TYPE_VNODE 1
-#define KINFO_FILE_TYPE_SOCKET 2
-#define KINFO_FILE_TYPE_PIPE 3
-#define KINFO_FILE_TYPE_FIFO 4
-#define KINFO_FILE_TYPE_KQUEUE 5
-#define KINFO_FILE_TYPE_CRYPTO 6
-#define KINFO_FILE_TYPE_MQUEUE 7
-#define KINFO_FILE_TYPE_SHM 8
-#define KINFO_FILE_TYPE_SEM 9
-#define KINFO_FILE_TYPE_PTS 10
-#define KINFO_FILE_TYPE_PROCDESC 11
+#define KINFO_FILE_TYPE_VNODE 1
+#define KINFO_FILE_TYPE_SOCKET 2
+#define KINFO_FILE_TYPE_PIPE 3
+#define KINFO_FILE_TYPE_FIFO 4
+#define KINFO_FILE_TYPE_KQUEUE 5
+#define KINFO_FILE_TYPE_CRYPTO 6
+#define KINFO_FILE_TYPE_MQUEUE 7
+#define KINFO_FILE_TYPE_SHM 8
+#define KINFO_FILE_TYPE_SEM 9
+#define KINFO_FILE_TYPE_PTS 10
+#define KINFO_FILE_TYPE_PROCDESC 11
/* Special values for the 'kf_fd' field in struct kinfo_file. These
match the KF_FD_TYPE_* constants in <sys/user.h>. */
-#define KINFO_FILE_FD_TYPE_CWD -1
-#define KINFO_FILE_FD_TYPE_ROOT -2
-#define KINFO_FILE_FD_TYPE_JAIL -3
-#define KINFO_FILE_FD_TYPE_TRACE -4
-#define KINFO_FILE_FD_TYPE_TEXT -5
-#define KINFO_FILE_FD_TYPE_CTTY -6
+#define KINFO_FILE_FD_TYPE_CWD -1
+#define KINFO_FILE_FD_TYPE_ROOT -2
+#define KINFO_FILE_FD_TYPE_JAIL -3
+#define KINFO_FILE_FD_TYPE_TRACE -4
+#define KINFO_FILE_FD_TYPE_TEXT -5
+#define KINFO_FILE_FD_TYPE_CTTY -6
/* Flags in the 'kf_flags' field in struct kinfo_file. These match
the KF_FLAG_* constants in <sys/user.h>. */
-#define KINFO_FILE_FLAG_READ 0x00000001
-#define KINFO_FILE_FLAG_WRITE 0x00000002
-#define KINFO_FILE_FLAG_APPEND 0x00000004
-#define KINFO_FILE_FLAG_ASYNC 0x00000008
-#define KINFO_FILE_FLAG_FSYNC 0x00000010
-#define KINFO_FILE_FLAG_NONBLOCK 0x00000020
-#define KINFO_FILE_FLAG_DIRECT 0x00000040
-#define KINFO_FILE_FLAG_HASLOCK 0x00000080
-#define KINFO_FILE_FLAG_EXEC 0x00004000
+#define KINFO_FILE_FLAG_READ 0x00000001
+#define KINFO_FILE_FLAG_WRITE 0x00000002
+#define KINFO_FILE_FLAG_APPEND 0x00000004
+#define KINFO_FILE_FLAG_ASYNC 0x00000008
+#define KINFO_FILE_FLAG_FSYNC 0x00000010
+#define KINFO_FILE_FLAG_NONBLOCK 0x00000020
+#define KINFO_FILE_FLAG_DIRECT 0x00000040
+#define KINFO_FILE_FLAG_HASLOCK 0x00000080
+#define KINFO_FILE_FLAG_EXEC 0x00004000
/* Constants for the 'kf_vnode_type' field in struct kinfo_file.
These match the KF_VTYPE_* constants in <sys/user.h>. */
-#define KINFO_FILE_VTYPE_VREG 1
-#define KINFO_FILE_VTYPE_VDIR 2
-#define KINFO_FILE_VTYPE_VCHR 4
-#define KINFO_FILE_VTYPE_VLNK 5
-#define KINFO_FILE_VTYPE_VSOCK 6
-#define KINFO_FILE_VTYPE_VFIFO 7
+#define KINFO_FILE_VTYPE_VREG 1
+#define KINFO_FILE_VTYPE_VDIR 2
+#define KINFO_FILE_VTYPE_VCHR 4
+#define KINFO_FILE_VTYPE_VLNK 5
+#define KINFO_FILE_VTYPE_VSOCK 6
+#define KINFO_FILE_VTYPE_VFIFO 7
/* Constants for socket address families. These match AF_* constants
in <sys/socket.h>. */
-#define FBSD_AF_UNIX 1
-#define FBSD_AF_INET 2
-#define FBSD_AF_INET6 28
+#define FBSD_AF_UNIX 1
+#define FBSD_AF_INET 2
+#define FBSD_AF_INET6 28
/* Constants for socket types. These match SOCK_* constants in
<sys/socket.h>. */
-#define FBSD_SOCK_STREAM 1
-#define FBSD_SOCK_DGRAM 2
-#define FBSD_SOCK_SEQPACKET 5
+#define FBSD_SOCK_STREAM 1
+#define FBSD_SOCK_DGRAM 2
+#define FBSD_SOCK_SEQPACKET 5
/* Constants for IP protocols. These match IPPROTO_* constants in
<netinet/in.h>. */
-#define FBSD_IPPROTO_ICMP 1
-#define FBSD_IPPROTO_TCP 6
-#define FBSD_IPPROTO_UDP 17
-#define FBSD_IPPROTO_SCTP 132
+#define FBSD_IPPROTO_ICMP 1
+#define FBSD_IPPROTO_TCP 6
+#define FBSD_IPPROTO_UDP 17
+#define FBSD_IPPROTO_SCTP 132
/* Socket address structures. These have the same layout on all
FreeBSD architectures. In addition, multibyte fields such as IP
@@ -316,7 +316,7 @@ struct fbsd_sockaddr_un
/* Number of 32-bit words in a signal set. This matches _SIG_WORDS in
<sys/_sigset.h> and is the same value on all architectures. */
-#define SIG_WORDS 4
+#define SIG_WORDS 4
/* Offsets in data structure used in NT_FREEBSD_PROCSTAT_PROC core
dump notes. See <sys/user.h> for the definition of struct
@@ -373,124 +373,121 @@ struct kinfo_proc_layout
int ru_majflt;
};
-const struct kinfo_proc_layout kinfo_proc_layout_32 =
- {
- .ki_layout = 0x4,
- .ki_pid = 0x28,
- .ki_ppid = 0x2c,
- .ki_pgid = 0x30,
- .ki_tpgid = 0x34,
- .ki_sid = 0x38,
- .ki_tdev_freebsd11 = 0x44,
- .ki_sigignore = 0x68,
- .ki_sigcatch = 0x78,
- .ki_uid = 0x88,
- .ki_ruid = 0x8c,
- .ki_svuid = 0x90,
- .ki_rgid = 0x94,
- .ki_svgid = 0x98,
- .ki_ngroups = 0x9c,
- .ki_groups = 0xa0,
- .ki_size = 0xe0,
- .ki_rssize = 0xe4,
- .ki_tsize = 0xec,
- .ki_dsize = 0xf0,
- .ki_ssize = 0xf4,
- .ki_start = 0x118,
- .ki_nice = 0x145,
- .ki_comm = 0x17f,
- .ki_tdev = 0x1f0,
- .ki_rusage = 0x220,
- .ki_rusage_ch = 0x278,
-
- .ru_utime = 0x0,
- .ru_stime = 0x10,
- .ru_maxrss = 0x20,
- .ru_minflt = 0x30,
- .ru_majflt = 0x34,
- };
+const struct kinfo_proc_layout kinfo_proc_layout_32 = {
+ .ki_layout = 0x4,
+ .ki_pid = 0x28,
+ .ki_ppid = 0x2c,
+ .ki_pgid = 0x30,
+ .ki_tpgid = 0x34,
+ .ki_sid = 0x38,
+ .ki_tdev_freebsd11 = 0x44,
+ .ki_sigignore = 0x68,
+ .ki_sigcatch = 0x78,
+ .ki_uid = 0x88,
+ .ki_ruid = 0x8c,
+ .ki_svuid = 0x90,
+ .ki_rgid = 0x94,
+ .ki_svgid = 0x98,
+ .ki_ngroups = 0x9c,
+ .ki_groups = 0xa0,
+ .ki_size = 0xe0,
+ .ki_rssize = 0xe4,
+ .ki_tsize = 0xec,
+ .ki_dsize = 0xf0,
+ .ki_ssize = 0xf4,
+ .ki_start = 0x118,
+ .ki_nice = 0x145,
+ .ki_comm = 0x17f,
+ .ki_tdev = 0x1f0,
+ .ki_rusage = 0x220,
+ .ki_rusage_ch = 0x278,
+
+ .ru_utime = 0x0,
+ .ru_stime = 0x10,
+ .ru_maxrss = 0x20,
+ .ru_minflt = 0x30,
+ .ru_majflt = 0x34,
+};
-const struct kinfo_proc_layout kinfo_proc_layout_i386 =
- {
- .ki_layout = 0x4,
- .ki_pid = 0x28,
- .ki_ppid = 0x2c,
- .ki_pgid = 0x30,
- .ki_tpgid = 0x34,
- .ki_sid = 0x38,
- .ki_tdev_freebsd11 = 0x44,
- .ki_sigignore = 0x68,
- .ki_sigcatch = 0x78,
- .ki_uid = 0x88,
- .ki_ruid = 0x8c,
- .ki_svuid = 0x90,
- .ki_rgid = 0x94,
- .ki_svgid = 0x98,
- .ki_ngroups = 0x9c,
- .ki_groups = 0xa0,
- .ki_size = 0xe0,
- .ki_rssize = 0xe4,
- .ki_tsize = 0xec,
- .ki_dsize = 0xf0,
- .ki_ssize = 0xf4,
- .ki_start = 0x118,
- .ki_nice = 0x135,
- .ki_comm = 0x16f,
- .ki_tdev = 0x1e0,
- .ki_rusage = 0x210,
- .ki_rusage_ch = 0x258,
-
- .ru_utime = 0x0,
- .ru_stime = 0x8,
- .ru_maxrss = 0x10,
- .ru_minflt = 0x20,
- .ru_majflt = 0x24,
- };
+const struct kinfo_proc_layout kinfo_proc_layout_i386 = {
+ .ki_layout = 0x4,
+ .ki_pid = 0x28,
+ .ki_ppid = 0x2c,
+ .ki_pgid = 0x30,
+ .ki_tpgid = 0x34,
+ .ki_sid = 0x38,
+ .ki_tdev_freebsd11 = 0x44,
+ .ki_sigignore = 0x68,
+ .ki_sigcatch = 0x78,
+ .ki_uid = 0x88,
+ .ki_ruid = 0x8c,
+ .ki_svuid = 0x90,
+ .ki_rgid = 0x94,
+ .ki_svgid = 0x98,
+ .ki_ngroups = 0x9c,
+ .ki_groups = 0xa0,
+ .ki_size = 0xe0,
+ .ki_rssize = 0xe4,
+ .ki_tsize = 0xec,
+ .ki_dsize = 0xf0,
+ .ki_ssize = 0xf4,
+ .ki_start = 0x118,
+ .ki_nice = 0x135,
+ .ki_comm = 0x16f,
+ .ki_tdev = 0x1e0,
+ .ki_rusage = 0x210,
+ .ki_rusage_ch = 0x258,
+
+ .ru_utime = 0x0,
+ .ru_stime = 0x8,
+ .ru_maxrss = 0x10,
+ .ru_minflt = 0x20,
+ .ru_majflt = 0x24,
+};
-const struct kinfo_proc_layout kinfo_proc_layout_64 =
- {
- .ki_layout = 0x4,
- .ki_pid = 0x48,
- .ki_ppid = 0x4c,
- .ki_pgid = 0x50,
- .ki_tpgid = 0x54,
- .ki_sid = 0x58,
- .ki_tdev_freebsd11 = 0x64,
- .ki_sigignore = 0x88,
- .ki_sigcatch = 0x98,
- .ki_uid = 0xa8,
- .ki_ruid = 0xac,
- .ki_svuid = 0xb0,
- .ki_rgid = 0xb4,
- .ki_svgid = 0xb8,
- .ki_ngroups = 0xbc,
- .ki_groups = 0xc0,
- .ki_size = 0x100,
- .ki_rssize = 0x108,
- .ki_tsize = 0x118,
- .ki_dsize = 0x120,
- .ki_ssize = 0x128,
- .ki_start = 0x150,
- .ki_nice = 0x185,
- .ki_comm = 0x1bf,
- .ki_tdev = 0x230,
- .ki_rusage = 0x260,
- .ki_rusage_ch = 0x2f0,
-
- .ru_utime = 0x0,
- .ru_stime = 0x10,
- .ru_maxrss = 0x20,
- .ru_minflt = 0x40,
- .ru_majflt = 0x48,
- };
+const struct kinfo_proc_layout kinfo_proc_layout_64 = {
+ .ki_layout = 0x4,
+ .ki_pid = 0x48,
+ .ki_ppid = 0x4c,
+ .ki_pgid = 0x50,
+ .ki_tpgid = 0x54,
+ .ki_sid = 0x58,
+ .ki_tdev_freebsd11 = 0x64,
+ .ki_sigignore = 0x88,
+ .ki_sigcatch = 0x98,
+ .ki_uid = 0xa8,
+ .ki_ruid = 0xac,
+ .ki_svuid = 0xb0,
+ .ki_rgid = 0xb4,
+ .ki_svgid = 0xb8,
+ .ki_ngroups = 0xbc,
+ .ki_groups = 0xc0,
+ .ki_size = 0x100,
+ .ki_rssize = 0x108,
+ .ki_tsize = 0x118,
+ .ki_dsize = 0x120,
+ .ki_ssize = 0x128,
+ .ki_start = 0x150,
+ .ki_nice = 0x185,
+ .ki_comm = 0x1bf,
+ .ki_tdev = 0x230,
+ .ki_rusage = 0x260,
+ .ki_rusage_ch = 0x2f0,
+
+ .ru_utime = 0x0,
+ .ru_stime = 0x10,
+ .ru_maxrss = 0x20,
+ .ru_minflt = 0x40,
+ .ru_majflt = 0x48,
+};
struct fbsd_gdbarch_data
- {
- struct type *siginfo_type = nullptr;
- };
+{
+ struct type *siginfo_type = nullptr;
+};
static const registry<gdbarch>::key<fbsd_gdbarch_data>
- fbsd_gdbarch_data_handle;
+ fbsd_gdbarch_data_handle;
static struct fbsd_gdbarch_data *
get_fbsd_gdbarch_data (struct gdbarch *gdbarch)
@@ -509,7 +506,9 @@ struct fbsd_pspace_data
bool rtld_offsets_valid = false;
/* vDSO mapping range. */
- struct mem_range vdso_range {};
+ struct mem_range vdso_range
+ {
+ };
/* Zero if the range hasn't been searched for, > 0 if a range was
found, or < 0 if a range was not found. */
@@ -605,8 +604,10 @@ fbsd_core_xfer_siginfo (struct gdbarch *gdbarch, gdb_byte *readbuf,
if (offset > siginfo_size)
return -1;
- thread_section_name section_name (".note.freebsdcore.lwpinfo", inferior_ptid);
- asection *section = bfd_get_section_by_name (core_bfd, section_name.c_str ());
+ thread_section_name section_name (".note.freebsdcore.lwpinfo",
+ inferior_ptid);
+ asection *section
+ = bfd_get_section_by_name (core_bfd, section_name.c_str ());
if (section == NULL)
return -1;
@@ -653,8 +654,8 @@ find_signalled_thread (struct thread_info *info, void *data)
static gdb::optional<gdb::byte_vector>
fbsd_make_note_desc (enum target_object object, uint32_t structsize)
{
- gdb::optional<gdb::byte_vector> buf =
- target_read_alloc (current_inferior ()->top_target (), object, NULL);
+ gdb::optional<gdb::byte_vector> buf
+ = target_read_alloc (current_inferior ()->top_target (), object, NULL);
if (!buf || buf->empty ())
return {};
@@ -729,21 +730,19 @@ fbsd_make_corefile_notes (struct gdbarch *gdbarch, bfd *obfd, int *note_size)
if (thr == signalled_thr)
continue;
- gcore_elf_build_thread_register_notes (gdbarch, thr, stop_signal,
- obfd, &note_data, note_size);
+ gcore_elf_build_thread_register_notes (gdbarch, thr, stop_signal, obfd,
+ &note_data, note_size);
}
/* Auxiliary vector. */
uint32_t structsize = gdbarch_ptr_bit (gdbarch) / 4; /* Elf_Auxinfo */
- gdb::optional<gdb::byte_vector> note_desc =
- fbsd_make_note_desc (TARGET_OBJECT_AUXV, structsize);
+ gdb::optional<gdb::byte_vector> note_desc
+ = fbsd_make_note_desc (TARGET_OBJECT_AUXV, structsize);
if (note_desc && !note_desc->empty ())
{
- note_data.reset (elfcore_write_note (obfd, note_data.release (),
- note_size, "FreeBSD",
- NT_FREEBSD_PROCSTAT_AUXV,
- note_desc->data (),
- note_desc->size ()));
+ note_data.reset (elfcore_write_note (
+ obfd, note_data.release (), note_size, "FreeBSD",
+ NT_FREEBSD_PROCSTAT_AUXV, note_desc->data (), note_desc->size ()));
if (!note_data)
return NULL;
}
@@ -752,11 +751,9 @@ fbsd_make_corefile_notes (struct gdbarch *gdbarch, bfd *obfd, int *note_size)
note_desc = fbsd_make_note_desc (TARGET_OBJECT_FREEBSD_VMMAP, 0);
if (note_desc && !note_desc->empty ())
{
- note_data.reset (elfcore_write_note (obfd, note_data.release (),
- note_size, "FreeBSD",
- NT_FREEBSD_PROCSTAT_VMMAP,
- note_desc->data (),
- note_desc->size ()));
+ note_data.reset (elfcore_write_note (
+ obfd, note_data.release (), note_size, "FreeBSD",
+ NT_FREEBSD_PROCSTAT_VMMAP, note_desc->data (), note_desc->size ()));
if (!note_data)
return NULL;
}
@@ -912,14 +909,13 @@ fbsd_ipproto (int protocol)
static void
fbsd_print_sockaddr_in (const void *sockaddr)
{
- const struct fbsd_sockaddr_in *sin =
- reinterpret_cast<const struct fbsd_sockaddr_in *> (sockaddr);
+ const struct fbsd_sockaddr_in *sin
+ = reinterpret_cast<const struct fbsd_sockaddr_in *> (sockaddr);
char buf[INET_ADDRSTRLEN];
if (inet_ntop (AF_INET, sin->sin_addr, buf, sizeof buf) == nullptr)
- error (_("Failed to format IPv4 address"));
- gdb_printf ("%s:%u", buf,
- (sin->sin_port[0] << 8) | sin->sin_port[1]);
+ error (_ ("Failed to format IPv4 address"));
+ gdb_printf ("%s:%u", buf, (sin->sin_port[0] << 8) | sin->sin_port[1]);
}
/* Helper function to print out an IPv6 socket address. */
@@ -927,14 +923,13 @@ fbsd_print_sockaddr_in (const void *sockaddr)
static void
fbsd_print_sockaddr_in6 (const void *sockaddr)
{
- const struct fbsd_sockaddr_in6 *sin6 =
- reinterpret_cast<const struct fbsd_sockaddr_in6 *> (sockaddr);
+ const struct fbsd_sockaddr_in6 *sin6
+ = reinterpret_cast<const struct fbsd_sockaddr_in6 *> (sockaddr);
char buf[INET6_ADDRSTRLEN];
if (inet_ntop (AF_INET6, sin6->sin6_addr, buf, sizeof buf) == nullptr)
- error (_("Failed to format IPv6 address"));
- gdb_printf ("%s.%u", buf,
- (sin6->sin6_port[0] << 8) | sin6->sin6_port[1]);
+ error (_ ("Failed to format IPv6 address"));
+ gdb_printf ("%s.%u", buf, (sin6->sin6_port[0] << 8) | sin6->sin6_port[1]);
}
/* See fbsd-tdep.h. */
@@ -942,9 +937,9 @@ fbsd_print_sockaddr_in6 (const void *sockaddr)
void
fbsd_info_proc_files_header ()
{
- gdb_printf (_("Open files:\n\n"));
- gdb_printf (" %6s %6s %10s %9s %s\n",
- "FD", "Type", "Offset", "Flags ", "Name");
+ gdb_printf (_ ("Open files:\n\n"));
+ gdb_printf (" %6s %6s %10s %9s %s\n", "FD", "Type", "Offset", "Flags ",
+ "Name");
}
/* See fbsd-tdep.h. */
@@ -956,8 +951,7 @@ fbsd_info_proc_files_entry (int kf_type, int kf_fd, int kf_flags,
int kf_sock_protocol, const void *kf_sa_local,
const void *kf_sa_peer, const void *kf_path)
{
- gdb_printf (" %6s %6s %10s %8s ",
- fbsd_file_fd (kf_fd),
+ gdb_printf (" %6s %6s %10s %8s ", fbsd_file_fd (kf_fd),
fbsd_file_type (kf_type, kf_vnode_type),
kf_offset > -1 ? hex_string (kf_offset) : "-",
fbsd_file_flags (kf_flags));
@@ -986,10 +980,11 @@ fbsd_info_proc_files_entry (int kf_type, int kf_fd, int kf_flags,
/* For local sockets, print out the first non-nul path
rather than both paths. */
const struct fbsd_sockaddr_un *saddr_un
- = reinterpret_cast<const struct fbsd_sockaddr_un *> (kf_sa_local);
+ = reinterpret_cast<const struct fbsd_sockaddr_un *> (
+ kf_sa_local);
if (saddr_un->sun_path[0] == 0)
- saddr_un = reinterpret_cast<const struct fbsd_sockaddr_un *>
- (kf_sa_peer);
+ saddr_un = reinterpret_cast<const struct fbsd_sockaddr_un *> (
+ kf_sa_peer);
gdb_printf ("%s", saddr_un->sun_path);
break;
}
@@ -1021,18 +1016,18 @@ fbsd_core_info_proc_files (struct gdbarch *gdbarch)
= bfd_get_section_by_name (core_bfd, ".note.freebsdcore.files");
if (section == NULL)
{
- warning (_("unable to find open files in core file"));
+ warning (_ ("unable to find open files in core file"));
return;
}
size_t note_size = bfd_section_size (section);
if (note_size < 4)
- error (_("malformed core note - too short for header"));
+ error (_ ("malformed core note - too short for header"));
gdb::def_vector<unsigned char> contents (note_size);
- if (!bfd_get_section_contents (core_bfd, section, contents.data (),
- 0, note_size))
- error (_("could not get core note contents"));
+ if (!bfd_get_section_contents (core_bfd, section, contents.data (), 0,
+ note_size))
+ error (_ ("could not get core note contents"));
unsigned char *descdata = contents.data ();
unsigned char *descend = descdata + note_size;
@@ -1046,23 +1041,24 @@ fbsd_core_info_proc_files (struct gdbarch *gdbarch)
{
ULONGEST structsize = bfd_get_32 (core_bfd, descdata + KF_STRUCTSIZE);
if (structsize < KF_PATH)
- error (_("malformed core note - file structure too small"));
+ error (_ ("malformed core note - file structure too small"));
LONGEST type = bfd_get_signed_32 (core_bfd, descdata + KF_TYPE);
LONGEST fd = bfd_get_signed_32 (core_bfd, descdata + KF_FD);
LONGEST flags = bfd_get_signed_32 (core_bfd, descdata + KF_FLAGS);
LONGEST offset = bfd_get_signed_64 (core_bfd, descdata + KF_OFFSET);
- LONGEST vnode_type = bfd_get_signed_32 (core_bfd,
- descdata + KF_VNODE_TYPE);
- LONGEST sock_domain = bfd_get_signed_32 (core_bfd,
- descdata + KF_SOCK_DOMAIN);
- LONGEST sock_type = bfd_get_signed_32 (core_bfd, descdata + KF_SOCK_TYPE);
- LONGEST sock_protocol = bfd_get_signed_32 (core_bfd,
- descdata + KF_SOCK_PROTOCOL);
+ LONGEST vnode_type
+ = bfd_get_signed_32 (core_bfd, descdata + KF_VNODE_TYPE);
+ LONGEST sock_domain
+ = bfd_get_signed_32 (core_bfd, descdata + KF_SOCK_DOMAIN);
+ LONGEST sock_type
+ = bfd_get_signed_32 (core_bfd, descdata + KF_SOCK_TYPE);
+ LONGEST sock_protocol
+ = bfd_get_signed_32 (core_bfd, descdata + KF_SOCK_PROTOCOL);
fbsd_info_proc_files_entry (type, fd, flags, offset, vnode_type,
sock_domain, sock_type, sock_protocol,
- descdata + KF_SA_LOCAL, descdata + KF_SA_PEER,
- descdata + KF_PATH);
+ descdata + KF_SA_LOCAL,
+ descdata + KF_SA_PEER, descdata + KF_PATH);
descdata += structsize;
}
@@ -1083,8 +1079,9 @@ fbsd_vm_map_entry_flags (int kve_flags, int kve_protection)
vm_flags[4] = (kve_flags & KINFO_VME_FLAG_COW) ? 'C' : '-';
vm_flags[5] = (kve_flags & KINFO_VME_FLAG_NEEDS_COPY) ? 'N' : '-';
vm_flags[6] = (kve_flags & KINFO_VME_FLAG_SUPER) ? 'S' : '-';
- vm_flags[7] = (kve_flags & KINFO_VME_FLAG_GROWS_UP) ? 'U'
- : (kve_flags & KINFO_VME_FLAG_GROWS_DOWN) ? 'D' : '-';
+ vm_flags[7] = (kve_flags & KINFO_VME_FLAG_GROWS_UP) ? 'U'
+ : (kve_flags & KINFO_VME_FLAG_GROWS_DOWN) ? 'D'
+ : '-';
vm_flags[8] = '\0';
return vm_flags;
@@ -1095,19 +1092,15 @@ fbsd_vm_map_entry_flags (int kve_flags, int kve_protection)
void
fbsd_info_proc_mappings_header (int addr_bit)
{
- gdb_printf (_("Mapped address spaces:\n\n"));
+ gdb_printf (_ ("Mapped address spaces:\n\n"));
if (addr_bit == 64)
{
- gdb_printf (" %18s %18s %10s %10s %9s %s\n",
- "Start Addr",
- " End Addr",
+ gdb_printf (" %18s %18s %10s %10s %9s %s\n", "Start Addr", " End Addr",
" Size", " Offset", "Flags ", "File");
}
else
{
- gdb_printf ("\t%10s %10s %10s %10s %9s %s\n",
- "Start Addr",
- " End Addr",
+ gdb_printf ("\t%10s %10s %10s %10s %9s %s\n", "Start Addr", " End Addr",
" Size", " Offset", "Flags ", "File");
}
}
@@ -1122,20 +1115,16 @@ fbsd_info_proc_mappings_entry (int addr_bit, ULONGEST kve_start,
{
if (addr_bit == 64)
{
- gdb_printf (" %18s %18s %10s %10s %9s %s\n",
- hex_string (kve_start),
- hex_string (kve_end),
- hex_string (kve_end - kve_start),
+ gdb_printf (" %18s %18s %10s %10s %9s %s\n", hex_string (kve_start),
+ hex_string (kve_end), hex_string (kve_end - kve_start),
hex_string (kve_offset),
fbsd_vm_map_entry_flags (kve_flags, kve_protection),
reinterpret_cast<const char *> (kve_path));
}
else
{
- gdb_printf ("\t%10s %10s %10s %10s %9s %s\n",
- hex_string (kve_start),
- hex_string (kve_end),
- hex_string (kve_end - kve_start),
+ gdb_printf ("\t%10s %10s %10s %10s %9s %s\n", hex_string (kve_start),
+ hex_string (kve_end), hex_string (kve_end - kve_start),
hex_string (kve_offset),
fbsd_vm_map_entry_flags (kve_flags, kve_protection),
reinterpret_cast<const char *> (kve_path));
@@ -1154,18 +1143,18 @@ fbsd_core_info_proc_mappings (struct gdbarch *gdbarch)
section = bfd_get_section_by_name (core_bfd, ".note.freebsdcore.vmmap");
if (section == NULL)
{
- warning (_("unable to find mappings in core file"));
+ warning (_ ("unable to find mappings in core file"));
return;
}
note_size = bfd_section_size (section);
if (note_size < 4)
- error (_("malformed core note - too short for header"));
+ error (_ ("malformed core note - too short for header"));
gdb::def_vector<unsigned char> contents (note_size);
- if (!bfd_get_section_contents (core_bfd, section, contents.data (),
- 0, note_size))
- error (_("could not get core note contents"));
+ if (!bfd_get_section_contents (core_bfd, section, contents.data (), 0,
+ note_size))
+ error (_ ("could not get core note contents"));
descdata = contents.data ();
descend = descdata + note_size;
@@ -1178,7 +1167,7 @@ fbsd_core_info_proc_mappings (struct gdbarch *gdbarch)
{
ULONGEST structsize = bfd_get_32 (core_bfd, descdata + KVE_STRUCTSIZE);
if (structsize < KVE_PATH)
- error (_("malformed core note - vmmap entry too small"));
+ error (_ ("malformed core note - vmmap entry too small"));
ULONGEST start = bfd_get_64 (core_bfd, descdata + KVE_START);
ULONGEST end = bfd_get_64 (core_bfd, descdata + KVE_END);
@@ -1208,12 +1197,12 @@ fbsd_core_vnode_path (struct gdbarch *gdbarch, int fd)
note_size = bfd_section_size (section);
if (note_size < 4)
- error (_("malformed core note - too short for header"));
+ error (_ ("malformed core note - too short for header"));
gdb::def_vector<unsigned char> contents (note_size);
- if (!bfd_get_section_contents (core_bfd, section, contents.data (),
- 0, note_size))
- error (_("could not get core note contents"));
+ if (!bfd_get_section_contents (core_bfd, section, contents.data (), 0,
+ note_size))
+ error (_ ("could not get core note contents"));
descdata = contents.data ();
descend = descdata + note_size;
@@ -1227,7 +1216,7 @@ fbsd_core_vnode_path (struct gdbarch *gdbarch, int fd)
structsize = bfd_get_32 (core_bfd, descdata + KF_STRUCTSIZE);
if (structsize < KF_PATH)
- error (_("malformed core note - file structure too small"));
+ error (_ ("malformed core note - file structure too small"));
if (bfd_get_32 (core_bfd, descdata + KF_TYPE) == KINFO_FILE_TYPE_VNODE
&& bfd_get_signed_32 (core_bfd, descdata + KF_FD) == fd)
@@ -1271,8 +1260,7 @@ fbsd_print_sigset (const char *descr, unsigned char *sigset)
{
gdb_printf ("%s: ", descr);
for (int i = 0; i < SIG_WORDS; i++)
- gdb_printf ("%08x ",
- (unsigned int) bfd_get_32 (core_bfd, sigset + i * 4));
+ gdb_printf ("%08x ", (unsigned int) bfd_get_32 (core_bfd, sigset + i * 4));
gdb_printf ("\n");
}
@@ -1292,7 +1280,7 @@ fbsd_core_info_proc_status (struct gdbarch *gdbarch)
section = bfd_get_section_by_name (core_bfd, ".note.freebsdcore.proc");
if (section == NULL)
{
- warning (_("unable to find process info in core file"));
+ warning (_ ("unable to find process info in core file"));
return;
}
@@ -1312,14 +1300,14 @@ fbsd_core_info_proc_status (struct gdbarch *gdbarch)
* field used (ki_rusage_ch.ru_majflt) which is the size of a long.
*/
note_size = bfd_section_size (section);
- if (note_size < (4 + kp->ki_rusage_ch + kp->ru_majflt
- + long_bit / TARGET_CHAR_BIT))
- error (_("malformed core note - too short"));
+ if (note_size
+ < (4 + kp->ki_rusage_ch + kp->ru_majflt + long_bit / TARGET_CHAR_BIT))
+ error (_ ("malformed core note - too short"));
gdb::def_vector<unsigned char> contents (note_size);
- if (!bfd_get_section_contents (core_bfd, section, contents.data (),
- 0, note_size))
- error (_("could not get core note contents"));
+ if (!bfd_get_section_contents (core_bfd, section, contents.data (), 0,
+ note_size))
+ error (_ ("could not get core note contents"));
descdata = contents.data ();
@@ -1329,7 +1317,7 @@ fbsd_core_info_proc_status (struct gdbarch *gdbarch)
/* Verify 'ki_layout' is 0. */
if (bfd_get_32 (core_bfd, descdata + kp->ki_layout) != 0)
{
- warning (_("unsupported process information in core file"));
+ warning (_ ("unsupported process information in core file"));
return;
}
@@ -1370,33 +1358,28 @@ fbsd_core_info_proc_status (struct gdbarch *gdbarch)
pulongest (bfd_get_32 (core_bfd,
descdata + kp->ki_groups + i * 4)));
gdb_printf ("\n");
- value = bfd_get (long_bit, core_bfd,
- descdata + kp->ki_rusage + kp->ru_minflt);
+ value
+ = bfd_get (long_bit, core_bfd, descdata + kp->ki_rusage + kp->ru_minflt);
gdb_printf ("Minor faults (no memory page): %s\n", pulongest (value));
value = bfd_get (long_bit, core_bfd,
descdata + kp->ki_rusage_ch + kp->ru_minflt);
gdb_printf ("Minor faults, children: %s\n", pulongest (value));
- value = bfd_get (long_bit, core_bfd,
- descdata + kp->ki_rusage + kp->ru_majflt);
- gdb_printf ("Major faults (memory page faults): %s\n",
- pulongest (value));
+ value
+ = bfd_get (long_bit, core_bfd, descdata + kp->ki_rusage + kp->ru_majflt);
+ gdb_printf ("Major faults (memory page faults): %s\n", pulongest (value));
value = bfd_get (long_bit, core_bfd,
descdata + kp->ki_rusage_ch + kp->ru_majflt);
gdb_printf ("Major faults, children: %s\n", pulongest (value));
- fbsd_core_fetch_timeval (gdbarch,
- descdata + kp->ki_rusage + kp->ru_utime,
+ fbsd_core_fetch_timeval (gdbarch, descdata + kp->ki_rusage + kp->ru_utime,
sec, value);
gdb_printf ("utime: %s.%06d\n", plongest (sec), (int) value);
- fbsd_core_fetch_timeval (gdbarch,
- descdata + kp->ki_rusage + kp->ru_stime,
+ fbsd_core_fetch_timeval (gdbarch, descdata + kp->ki_rusage + kp->ru_stime,
sec, value);
gdb_printf ("stime: %s.%06d\n", plongest (sec), (int) value);
- fbsd_core_fetch_timeval (gdbarch,
- descdata + kp->ki_rusage_ch + kp->ru_utime,
+ fbsd_core_fetch_timeval (gdbarch, descdata + kp->ki_rusage_ch + kp->ru_utime,
sec, value);
gdb_printf ("utime, children: %s.%06d\n", plongest (sec), (int) value);
- fbsd_core_fetch_timeval (gdbarch,
- descdata + kp->ki_rusage_ch + kp->ru_stime,
+ fbsd_core_fetch_timeval (gdbarch, descdata + kp->ki_rusage_ch + kp->ru_stime,
sec, value);
gdb_printf ("stime, children: %s.%06d\n", plongest (sec), (int) value);
gdb_printf ("'nice' value: %d\n",
@@ -1404,8 +1387,8 @@ fbsd_core_info_proc_status (struct gdbarch *gdbarch)
fbsd_core_fetch_timeval (gdbarch, descdata + kp->ki_start, sec, value);
gdb_printf ("Start time: %s.%06d\n", plongest (sec), (int) value);
gdb_printf ("Virtual memory size: %s kB\n",
- pulongest (bfd_get (addr_bit, core_bfd,
- descdata + kp->ki_size) / 1024));
+ pulongest (bfd_get (addr_bit, core_bfd, descdata + kp->ki_size)
+ / 1024));
gdb_printf ("Data size: %s pages\n",
pulongest (bfd_get (addr_bit, core_bfd,
descdata + kp->ki_dsize)));
@@ -1420,8 +1403,7 @@ fbsd_core_info_proc_status (struct gdbarch *gdbarch)
descdata + kp->ki_rssize)));
gdb_printf ("Maximum RSS: %s pages\n",
pulongest (bfd_get (long_bit, core_bfd,
- descdata + kp->ki_rusage
- + kp->ru_maxrss)));
+ descdata + kp->ki_rusage + kp->ru_maxrss)));
fbsd_print_sigset ("Ignored Signals", descdata + kp->ki_sigignore);
fbsd_print_sigset ("Caught Signals", descdata + kp->ki_sigcatch);
}
@@ -1480,7 +1462,7 @@ fbsd_core_info_proc (struct gdbarch *gdbarch, const char *args,
pid = bfd_core_file_pid (core_bfd);
if (pid != 0)
- gdb_printf (_("process %d\n"), pid);
+ gdb_printf (_ ("process %d\n"), pid);
if (do_cmdline)
{
@@ -1490,25 +1472,25 @@ fbsd_core_info_proc (struct gdbarch *gdbarch, const char *args,
if (cmdline)
gdb_printf ("cmdline = '%s'\n", cmdline);
else
- warning (_("Command line unavailable"));
+ warning (_ ("Command line unavailable"));
}
if (do_cwd)
{
- gdb::unique_xmalloc_ptr<char> cwd =
- fbsd_core_vnode_path (gdbarch, KINFO_FILE_FD_TYPE_CWD);
+ gdb::unique_xmalloc_ptr<char> cwd
+ = fbsd_core_vnode_path (gdbarch, KINFO_FILE_FD_TYPE_CWD);
if (cwd)
gdb_printf ("cwd = '%s'\n", cwd.get ());
else
- warning (_("unable to read current working directory"));
+ warning (_ ("unable to read current working directory"));
}
if (do_exe)
{
- gdb::unique_xmalloc_ptr<char> exe =
- fbsd_core_vnode_path (gdbarch, KINFO_FILE_FD_TYPE_TEXT);
+ gdb::unique_xmalloc_ptr<char> exe
+ = fbsd_core_vnode_path (gdbarch, KINFO_FILE_FD_TYPE_TEXT);
if (exe)
gdb_printf ("exe = '%s'\n", exe.get ());
else
- warning (_("unable to read executable path name"));
+ warning (_ ("unable to read executable path name"));
}
if (do_files)
fbsd_core_info_proc_files (gdbarch);
@@ -1548,31 +1530,36 @@ fbsd_print_auxv_entry (struct gdbarch *gdbarch, struct ui_file *file,
default_print_auxv_entry (gdbarch, file, type, val);
return;
#define _TAGNAME(tag) #tag
-#define TAGNAME(tag) _TAGNAME(AT_##tag)
+#define TAGNAME(tag) _TAGNAME (AT_##tag)
#define TAG(tag, text, kind) \
- case AT_FREEBSD_##tag: name = TAGNAME(tag); description = text; format = kind; break
- TAG (EXECPATH, _("Executable path"), AUXV_FORMAT_STR);
- TAG (CANARY, _("Canary for SSP"), AUXV_FORMAT_HEX);
+ case AT_FREEBSD_##tag: \
+ name = TAGNAME (tag); \
+ description = text; \
+ format = kind; \
+ break
+ TAG (EXECPATH, _ ("Executable path"), AUXV_FORMAT_STR);
+ TAG (CANARY, _ ("Canary for SSP"), AUXV_FORMAT_HEX);
TAG (CANARYLEN, ("Length of the SSP canary"), AUXV_FORMAT_DEC);
- TAG (OSRELDATE, _("OSRELDATE"), AUXV_FORMAT_DEC);
- TAG (NCPUS, _("Number of CPUs"), AUXV_FORMAT_DEC);
- TAG (PAGESIZES, _("Pagesizes"), AUXV_FORMAT_HEX);
- TAG (PAGESIZESLEN, _("Number of pagesizes"), AUXV_FORMAT_DEC);
- TAG (TIMEKEEP, _("Pointer to timehands"), AUXV_FORMAT_HEX);
- TAG (STACKPROT, _("Initial stack protection"), AUXV_FORMAT_HEX);
- TAG (EHDRFLAGS, _("ELF header e_flags"), AUXV_FORMAT_HEX);
- TAG (HWCAP, _("Machine-dependent CPU capability hints"), AUXV_FORMAT_HEX);
- TAG (HWCAP2, _("Extension of AT_HWCAP"), AUXV_FORMAT_HEX);
- TAG (BSDFLAGS, _("ELF BSD flags"), AUXV_FORMAT_HEX);
- TAG (ARGC, _("Argument count"), AUXV_FORMAT_DEC);
- TAG (ARGV, _("Argument vector"), AUXV_FORMAT_HEX);
- TAG (ENVC, _("Environment count"), AUXV_FORMAT_DEC);
- TAG (ENVV, _("Environment vector"), AUXV_FORMAT_HEX);
- TAG (PS_STRINGS, _("Pointer to ps_strings"), AUXV_FORMAT_HEX);
- TAG (FXRNG, _("Pointer to root RNG seed version"), AUXV_FORMAT_HEX);
- TAG (KPRELOAD, _("Base address of vDSO"), AUXV_FORMAT_HEX);
- TAG (USRSTACKBASE, _("Top of user stack"), AUXV_FORMAT_HEX);
- TAG (USRSTACKLIM, _("Grow limit of user stack"), AUXV_FORMAT_HEX);
+ TAG (OSRELDATE, _ ("OSRELDATE"), AUXV_FORMAT_DEC);
+ TAG (NCPUS, _ ("Number of CPUs"), AUXV_FORMAT_DEC);
+ TAG (PAGESIZES, _ ("Pagesizes"), AUXV_FORMAT_HEX);
+ TAG (PAGESIZESLEN, _ ("Number of pagesizes"), AUXV_FORMAT_DEC);
+ TAG (TIMEKEEP, _ ("Pointer to timehands"), AUXV_FORMAT_HEX);
+ TAG (STACKPROT, _ ("Initial stack protection"), AUXV_FORMAT_HEX);
+ TAG (EHDRFLAGS, _ ("ELF header e_flags"), AUXV_FORMAT_HEX);
+ TAG (HWCAP, _ ("Machine-dependent CPU capability hints"),
+ AUXV_FORMAT_HEX);
+ TAG (HWCAP2, _ ("Extension of AT_HWCAP"), AUXV_FORMAT_HEX);
+ TAG (BSDFLAGS, _ ("ELF BSD flags"), AUXV_FORMAT_HEX);
+ TAG (ARGC, _ ("Argument count"), AUXV_FORMAT_DEC);
+ TAG (ARGV, _ ("Argument vector"), AUXV_FORMAT_HEX);
+ TAG (ENVC, _ ("Environment count"), AUXV_FORMAT_DEC);
+ TAG (ENVV, _ ("Environment vector"), AUXV_FORMAT_HEX);
+ TAG (PS_STRINGS, _ ("Pointer to ps_strings"), AUXV_FORMAT_HEX);
+ TAG (FXRNG, _ ("Pointer to root RNG seed version"), AUXV_FORMAT_HEX);
+ TAG (KPRELOAD, _ ("Base address of vDSO"), AUXV_FORMAT_HEX);
+ TAG (USRSTACKBASE, _ ("Top of user stack"), AUXV_FORMAT_HEX);
+ TAG (USRSTACKLIM, _ ("Grow limit of user stack"), AUXV_FORMAT_HEX);
}
fprint_auxv_entry (file, name, description, format, type, val);
@@ -1594,12 +1581,11 @@ fbsd_get_siginfo_type (struct gdbarch *gdbarch)
if (fbsd_gdbarch_data->siginfo_type != NULL)
return fbsd_gdbarch_data->siginfo_type;
- int_type = arch_integer_type (gdbarch, gdbarch_int_bit (gdbarch),
- 0, "int");
+ int_type = arch_integer_type (gdbarch, gdbarch_int_bit (gdbarch), 0, "int");
int32_type = arch_integer_type (gdbarch, 32, 0, "int32_t");
uint32_type = arch_integer_type (gdbarch, 32, 1, "uint32_t");
- long_type = arch_integer_type (gdbarch, gdbarch_long_bit (gdbarch),
- 0, "long");
+ long_type
+ = arch_integer_type (gdbarch, gdbarch_long_bit (gdbarch), 0, "long");
void_ptr_type = lookup_pointer_type (builtin_type (gdbarch)->builtin_void);
/* union sigval */
@@ -1616,8 +1602,7 @@ fbsd_get_siginfo_type (struct gdbarch *gdbarch)
/* __uid_t */
uid_type = arch_type (gdbarch, TYPE_CODE_TYPEDEF,
- uint32_type->length () * TARGET_CHAR_BIT,
- "__uid_t");
+ uint32_type->length () * TARGET_CHAR_BIT, "__uid_t");
uid_type->set_target_type (uint32_type);
pid_type->set_target_is_stub (true);
@@ -1794,8 +1779,7 @@ fbsd_gdb_signal_from_target (struct gdbarch *gdbarch, int signal)
/* Implement the "gdb_signal_to_target" gdbarch method. */
static int
-fbsd_gdb_signal_to_target (struct gdbarch *gdbarch,
- enum gdb_signal signal)
+fbsd_gdb_signal_to_target (struct gdbarch *gdbarch, enum gdb_signal signal)
{
switch (signal)
{
@@ -1902,8 +1886,7 @@ fbsd_gdb_signal_to_target (struct gdbarch *gdbarch,
return FREEBSD_SIGLIBRT;
}
- if (signal >= GDB_SIGNAL_REALTIME_65
- && signal <= GDB_SIGNAL_REALTIME_126)
+ if (signal >= GDB_SIGNAL_REALTIME_65 && signal <= GDB_SIGNAL_REALTIME_126)
{
int offset = signal - GDB_SIGNAL_REALTIME_65;
@@ -1918,14 +1901,13 @@ fbsd_gdb_signal_to_target (struct gdbarch *gdbarch,
static LONGEST
fbsd_get_syscall_number (struct gdbarch *gdbarch, thread_info *thread)
{
-
/* FreeBSD doesn't use gdbarch_get_syscall_number since FreeBSD
native targets fetch the system call number from the
'pl_syscall_code' member of struct ptrace_lwpinfo in fbsd_wait.
However, system call catching requires this function to be
set. */
- internal_error (_("fbsd_get_sycall_number called"));
+ internal_error (_ ("fbsd_get_sycall_number called"));
}
/* Read an integer symbol value from the current target. */
@@ -1935,11 +1917,11 @@ fbsd_read_integer_by_name (struct gdbarch *gdbarch, const char *name)
{
bound_minimal_symbol ms = lookup_minimal_symbol (name, NULL, NULL);
if (ms.minsym == NULL)
- error (_("Unable to resolve symbol '%s'"), name);
+ error (_ ("Unable to resolve symbol '%s'"), name);
gdb_byte buf[4];
if (target_read_memory (ms.value_address (), buf, sizeof buf) != 0)
- error (_("Unable to read value of '%s'"), name);
+ error (_ ("Unable to read value of '%s'"), name);
return extract_signed_integer (buf, gdbarch_byte_order (gdbarch));
}
@@ -1948,20 +1930,22 @@ fbsd_read_integer_by_name (struct gdbarch *gdbarch, const char *name)
structure needed to determine the TLS index of an object file. */
static void
-fbsd_fetch_rtld_offsets (struct gdbarch *gdbarch, struct fbsd_pspace_data *data)
+fbsd_fetch_rtld_offsets (struct gdbarch *gdbarch,
+ struct fbsd_pspace_data *data)
{
try
{
/* Fetch offsets from debug symbols in rtld. */
struct symbol *obj_entry_sym
= lookup_symbol_in_language ("Struct_Obj_Entry", NULL, STRUCT_DOMAIN,
- language_c, NULL).symbol;
+ language_c, NULL)
+ .symbol;
if (obj_entry_sym == NULL)
- error (_("Unable to find Struct_Obj_Entry symbol"));
- data->off_linkmap = lookup_struct_elt (obj_entry_sym->type (),
- "linkmap", 0).offset / 8;
- data->off_tlsindex = lookup_struct_elt (obj_entry_sym->type (),
- "tlsindex", 0).offset / 8;
+ error (_ ("Unable to find Struct_Obj_Entry symbol"));
+ data->off_linkmap
+ = lookup_struct_elt (obj_entry_sym->type (), "linkmap", 0).offset / 8;
+ data->off_tlsindex
+ = lookup_struct_elt (obj_entry_sym->type (), "tlsindex", 0).offset / 8;
data->rtld_offsets_valid = true;
return;
}
@@ -1975,10 +1959,10 @@ fbsd_fetch_rtld_offsets (struct gdbarch *gdbarch, struct fbsd_pspace_data *data)
/* Fetch offsets from global variables in libthr. Note that
this does not work for single-threaded processes that are not
linked against libthr. */
- data->off_linkmap = fbsd_read_integer_by_name (gdbarch,
- "_thread_off_linkmap");
- data->off_tlsindex = fbsd_read_integer_by_name (gdbarch,
- "_thread_off_tlsindex");
+ data->off_linkmap
+ = fbsd_read_integer_by_name (gdbarch, "_thread_off_linkmap");
+ data->off_tlsindex
+ = fbsd_read_integer_by_name (gdbarch, "_thread_off_tlsindex");
data->rtld_offsets_valid = true;
return;
}
@@ -2001,7 +1985,7 @@ fbsd_get_tls_index (struct gdbarch *gdbarch, CORE_ADDR lm_addr)
if (data->off_linkmap == -1)
throw_error (TLS_GENERIC_ERROR,
- _("Cannot fetch runtime linker structure offsets"));
+ _ ("Cannot fetch runtime linker structure offsets"));
/* Simulate container_of to convert from LM_ADDR to the Obj_Entry
pointer and then compute the offset of the tlsindex member. */
@@ -2010,7 +1994,7 @@ fbsd_get_tls_index (struct gdbarch *gdbarch, CORE_ADDR lm_addr)
gdb_byte buf[4];
if (target_read_memory (tlsindex_addr, buf, sizeof buf) != 0)
throw_error (TLS_GENERIC_ERROR,
- _("Cannot find thread-local variables on this target"));
+ _ ("Cannot find thread-local variables on this target"));
return extract_signed_integer (buf, gdbarch_byte_order (gdbarch));
}
@@ -2026,16 +2010,16 @@ fbsd_get_thread_local_address (struct gdbarch *gdbarch, CORE_ADDR dtv_addr,
gdb_byte buf[gdbarch_ptr_bit (gdbarch) / TARGET_CHAR_BIT];
if (target_read_memory (dtv_addr, buf, sizeof buf) != 0)
throw_error (TLS_GENERIC_ERROR,
- _("Cannot find thread-local variables on this target"));
+ _ ("Cannot find thread-local variables on this target"));
const struct builtin_type *builtin = builtin_type (gdbarch);
- CORE_ADDR addr = gdbarch_pointer_to_address (gdbarch,
- builtin->builtin_data_ptr, buf);
+ CORE_ADDR addr
+ = gdbarch_pointer_to_address (gdbarch, builtin->builtin_data_ptr, buf);
addr += (tls_index + 1) * builtin->builtin_data_ptr->length ();
if (target_read_memory (addr, buf, sizeof buf) != 0)
throw_error (TLS_GENERIC_ERROR,
- _("Cannot find thread-local variables on this target"));
+ _ ("Cannot find thread-local variables on this target"));
addr = gdbarch_pointer_to_address (gdbarch, builtin->builtin_data_ptr, buf);
return addr + offset;
@@ -2046,7 +2030,8 @@ fbsd_get_thread_local_address (struct gdbarch *gdbarch, CORE_ADDR dtv_addr,
CORE_ADDR
fbsd_skip_solib_resolver (struct gdbarch *gdbarch, CORE_ADDR pc)
{
- struct bound_minimal_symbol msym = lookup_bound_minimal_symbol ("_rtld_bind");
+ struct bound_minimal_symbol msym
+ = lookup_bound_minimal_symbol ("_rtld_bind");
if (msym.minsym != nullptr && msym.value_address () == pc)
return frame_unwind_caller_pc (get_current_frame ());
@@ -2062,19 +2047,19 @@ fbsd_signal_cause (enum gdb_signal siggnal, int code)
switch (code)
{
case FBSD_SI_USER:
- return _("Sent by kill()");
+ return _ ("Sent by kill()");
case FBSD_SI_QUEUE:
- return _("Sent by sigqueue()");
+ return _ ("Sent by sigqueue()");
case FBSD_SI_TIMER:
- return _("Timer expired");
+ return _ ("Timer expired");
case FBSD_SI_ASYNCIO:
- return _("Asynchronous I/O request completed");
+ return _ ("Asynchronous I/O request completed");
case FBSD_SI_MESGQ:
- return _("Message arrived on empty message queue");
+ return _ ("Message arrived on empty message queue");
case FBSD_SI_KERNEL:
- return _("Sent by kernel");
+ return _ ("Sent by kernel");
case FBSD_SI_LWP:
- return _("Sent by thr_kill()");
+ return _ ("Sent by thr_kill()");
}
switch (siggnal)
@@ -2083,113 +2068,113 @@ fbsd_signal_cause (enum gdb_signal siggnal, int code)
switch (code)
{
case FBSD_ILL_ILLOPC:
- return _("Illegal opcode");
+ return _ ("Illegal opcode");
case FBSD_ILL_ILLOPN:
- return _("Illegal operand");
+ return _ ("Illegal operand");
case FBSD_ILL_ILLADR:
- return _("Illegal addressing mode");
+ return _ ("Illegal addressing mode");
case FBSD_ILL_ILLTRP:
- return _("Illegal trap");
+ return _ ("Illegal trap");
case FBSD_ILL_PRVOPC:
- return _("Privileged opcode");
+ return _ ("Privileged opcode");
case FBSD_ILL_PRVREG:
- return _("Privileged register");
+ return _ ("Privileged register");
case FBSD_ILL_COPROC:
- return _("Coprocessor error");
+ return _ ("Coprocessor error");
case FBSD_ILL_BADSTK:
- return _("Internal stack error");
+ return _ ("Internal stack error");
}
break;
case GDB_SIGNAL_BUS:
switch (code)
{
case FBSD_BUS_ADRALN:
- return _("Invalid address alignment");
+ return _ ("Invalid address alignment");
case FBSD_BUS_ADRERR:
- return _("Address not present");
+ return _ ("Address not present");
case FBSD_BUS_OBJERR:
- return _("Object-specific hardware error");
+ return _ ("Object-specific hardware error");
case FBSD_BUS_OOMERR:
- return _("Out of memory");
+ return _ ("Out of memory");
}
break;
case GDB_SIGNAL_SEGV:
switch (code)
{
case FBSD_SEGV_MAPERR:
- return _("Address not mapped to object");
+ return _ ("Address not mapped to object");
case FBSD_SEGV_ACCERR:
- return _("Invalid permissions for mapped object");
+ return _ ("Invalid permissions for mapped object");
case FBSD_SEGV_PKUERR:
- return _("PKU violation");
+ return _ ("PKU violation");
}
break;
case GDB_SIGNAL_FPE:
switch (code)
{
case FBSD_FPE_INTOVF:
- return _("Integer overflow");
+ return _ ("Integer overflow");
case FBSD_FPE_INTDIV:
- return _("Integer divide by zero");
+ return _ ("Integer divide by zero");
case FBSD_FPE_FLTDIV:
- return _("Floating point divide by zero");
+ return _ ("Floating point divide by zero");
case FBSD_FPE_FLTOVF:
- return _("Floating point overflow");
+ return _ ("Floating point overflow");
case FBSD_FPE_FLTUND:
- return _("Floating point underflow");
+ return _ ("Floating point underflow");
case FBSD_FPE_FLTRES:
- return _("Floating point inexact result");
+ return _ ("Floating point inexact result");
case FBSD_FPE_FLTINV:
- return _("Invalid floating point operation");
+ return _ ("Invalid floating point operation");
case FBSD_FPE_FLTSUB:
- return _("Subscript out of range");
+ return _ ("Subscript out of range");
}
break;
case GDB_SIGNAL_TRAP:
switch (code)
{
case FBSD_TRAP_BRKPT:
- return _("Breakpoint");
+ return _ ("Breakpoint");
case FBSD_TRAP_TRACE:
- return _("Trace trap");
+ return _ ("Trace trap");
case FBSD_TRAP_DTRACE:
- return _("DTrace-induced trap");
+ return _ ("DTrace-induced trap");
case FBSD_TRAP_CAP:
- return _("Capability violation");
+ return _ ("Capability violation");
}
break;
case GDB_SIGNAL_CHLD:
switch (code)
{
case FBSD_CLD_EXITED:
- return _("Child has exited");
+ return _ ("Child has exited");
case FBSD_CLD_KILLED:
- return _("Child has terminated abnormally");
+ return _ ("Child has terminated abnormally");
case FBSD_CLD_DUMPED:
- return _("Child has dumped core");
+ return _ ("Child has dumped core");
case FBSD_CLD_TRAPPED:
- return _("Traced child has trapped");
+ return _ ("Traced child has trapped");
case FBSD_CLD_STOPPED:
- return _("Child has stopped");
+ return _ ("Child has stopped");
case FBSD_CLD_CONTINUED:
- return _("Stopped child has continued");
+ return _ ("Stopped child has continued");
}
break;
case GDB_SIGNAL_POLL:
switch (code)
{
case FBSD_POLL_IN:
- return _("Data input available");
+ return _ ("Data input available");
case FBSD_POLL_OUT:
- return _("Output buffers available");
+ return _ ("Output buffers available");
case FBSD_POLL_MSG:
- return _("Input message available");
+ return _ ("Input message available");
case FBSD_POLL_ERR:
- return _("I/O error");
+ return _ ("I/O error");
case FBSD_POLL_PRI:
- return _("High priority input available");
+ return _ ("High priority input available");
case FBSD_POLL_HUP:
- return _("Device disconnected");
+ return _ ("Device disconnected");
}
break;
}
@@ -2275,31 +2260,30 @@ static ULONGEST
fbsd_vmmap_length (struct gdbarch *gdbarch, unsigned char *entries, size_t len,
CORE_ADDR addr)
{
- enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
- unsigned char *descdata = entries;
- unsigned char *descend = descdata + len;
+ enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
+ unsigned char *descdata = entries;
+ unsigned char *descend = descdata + len;
- /* Skip over the structure size. */
- descdata += 4;
+ /* Skip over the structure size. */
+ descdata += 4;
- while (descdata + KVE_PATH < descend)
- {
- ULONGEST structsize = extract_unsigned_integer (descdata
- + KVE_STRUCTSIZE, 4,
- byte_order);
- if (structsize < KVE_PATH)
- return false;
-
- ULONGEST start = extract_unsigned_integer (descdata + KVE_START, 8,
- byte_order);
- ULONGEST end = extract_unsigned_integer (descdata + KVE_END, 8,
- byte_order);
- if (start == addr)
- return end - start;
-
- descdata += structsize;
- }
- return 0;
+ while (descdata + KVE_PATH < descend)
+ {
+ ULONGEST structsize
+ = extract_unsigned_integer (descdata + KVE_STRUCTSIZE, 4, byte_order);
+ if (structsize < KVE_PATH)
+ return false;
+
+ ULONGEST start
+ = extract_unsigned_integer (descdata + KVE_START, 8, byte_order);
+ ULONGEST end
+ = extract_unsigned_integer (descdata + KVE_END, 8, byte_order);
+ if (start == addr)
+ return end - start;
+
+ descdata += structsize;
+ }
+ return 0;
}
/* Helper for fbsd_vsyscall_range that does the real work of finding
@@ -2314,8 +2298,8 @@ fbsd_vdso_range (struct gdbarch *gdbarch, struct mem_range *range)
if (!target_has_execution ())
{
/* Search for the ending address in the NT_PROCSTAT_VMMAP note. */
- asection *section = bfd_get_section_by_name (core_bfd,
- ".note.freebsdcore.vmmap");
+ asection *section
+ = bfd_get_section_by_name (core_bfd, ".note.freebsdcore.vmmap");
if (section == nullptr)
return false;
@@ -2324,8 +2308,8 @@ fbsd_vdso_range (struct gdbarch *gdbarch, struct mem_range *range)
return false;
gdb::def_vector<unsigned char> contents (note_size);
- if (!bfd_get_section_contents (core_bfd, section, contents.data (),
- 0, note_size))
+ if (!bfd_get_section_contents (core_bfd, section, contents.data (), 0,
+ note_size))
return false;
range->length = fbsd_vmmap_length (gdbarch, contents.data (), note_size,
@@ -2334,9 +2318,9 @@ fbsd_vdso_range (struct gdbarch *gdbarch, struct mem_range *range)
else
{
/* Fetch the list of address space entries from the running target. */
- gdb::optional<gdb::byte_vector> buf =
- target_read_alloc (current_inferior ()->top_target (),
- TARGET_OBJECT_FREEBSD_VMMAP, nullptr);
+ gdb::optional<gdb::byte_vector> buf
+ = target_read_alloc (current_inferior ()->top_target (),
+ TARGET_OBJECT_FREEBSD_VMMAP, nullptr);
if (!buf || buf->empty ())
return false;
diff --git a/gdb/fbsd-tdep.h b/gdb/fbsd-tdep.h
index 65541a01a01..3287ae29891 100644
--- a/gdb/fbsd-tdep.h
+++ b/gdb/fbsd-tdep.h
@@ -34,13 +34,10 @@ extern void fbsd_info_proc_files_header ();
should contain pointers to the corresponding fields in a 'struct
kinfo_file'. */
-extern void fbsd_info_proc_files_entry (int kf_type, int kf_fd, int kf_flags,
- LONGEST kf_offset, int kf_vnode_type,
- int kf_sock_domain, int kf_sock_type,
- int kf_sock_protocol,
- const void *kf_sa_local,
- const void *kf_sa_peer,
- const void *kf_path);
+extern void fbsd_info_proc_files_entry (
+ int kf_type, int kf_fd, int kf_flags, LONGEST kf_offset, int kf_vnode_type,
+ int kf_sock_domain, int kf_sock_type, int kf_sock_protocol,
+ const void *kf_sa_local, const void *kf_sa_peer, const void *kf_path);
/* Output the header for "info proc mappings". ADDR_BIT is the size
of a virtual address in bits. */
@@ -56,8 +53,8 @@ extern void fbsd_info_proc_mappings_header (int addr_bit);
extern void fbsd_info_proc_mappings_entry (int addr_bit, ULONGEST kve_start,
ULONGEST kve_end,
- ULONGEST kve_offset,
- int kve_flags, int kve_protection,
+ ULONGEST kve_offset, int kve_flags,
+ int kve_protection,
const void *kve_path);
/* Helper function to fetch the address of a thread-local variable.
diff --git a/gdb/features/microblaze-with-stack-protect.c b/gdb/features/microblaze-with-stack-protect.c
index 574dc02db67..91da87c99da 100644
--- a/gdb/features/microblaze-with-stack-protect.c
+++ b/gdb/features/microblaze-with-stack-protect.c
@@ -6,13 +6,15 @@
#include "target-descriptions.h"
const struct target_desc *tdesc_microblaze_with_stack_protect;
+
static void
initialize_tdesc_microblaze_with_stack_protect (void)
{
target_desc_up result = allocate_target_description ();
struct tdesc_feature *feature;
- feature = tdesc_create_feature (result.get (), "org.gnu.gdb.microblaze.core");
+ feature
+ = tdesc_create_feature (result.get (), "org.gnu.gdb.microblaze.core");
tdesc_create_reg (feature, "r0", 0, 1, NULL, 32, "int");
tdesc_create_reg (feature, "r1", 1, 1, NULL, 32, "data_ptr");
tdesc_create_reg (feature, "r2", 2, 1, NULL, 32, "int");
@@ -71,7 +73,8 @@ initialize_tdesc_microblaze_with_stack_protect (void)
tdesc_create_reg (feature, "rtlblo", 55, 1, NULL, 32, "int");
tdesc_create_reg (feature, "rtlbhi", 56, 1, NULL, 32, "int");
- feature = tdesc_create_feature (result.get (), "org.gnu.gdb.microblaze.stack-protect");
+ feature = tdesc_create_feature (result.get (),
+ "org.gnu.gdb.microblaze.stack-protect");
tdesc_create_reg (feature, "rslr", 57, 1, NULL, 32, "int");
tdesc_create_reg (feature, "rshr", 58, 1, NULL, 32, "int");
diff --git a/gdb/features/microblaze.c b/gdb/features/microblaze.c
index 8f1fb0a142f..d110584094b 100644
--- a/gdb/features/microblaze.c
+++ b/gdb/features/microblaze.c
@@ -6,13 +6,15 @@
#include "target-descriptions.h"
const struct target_desc *tdesc_microblaze;
+
static void
initialize_tdesc_microblaze (void)
{
target_desc_up result = allocate_target_description ();
struct tdesc_feature *feature;
- feature = tdesc_create_feature (result.get (), "org.gnu.gdb.microblaze.core");
+ feature
+ = tdesc_create_feature (result.get (), "org.gnu.gdb.microblaze.core");
tdesc_create_reg (feature, "r0", 0, 1, NULL, 32, "int");
tdesc_create_reg (feature, "r1", 1, 1, NULL, 32, "data_ptr");
tdesc_create_reg (feature, "r2", 2, 1, NULL, 32, "int");
diff --git a/gdb/features/mips-dsp-linux.c b/gdb/features/mips-dsp-linux.c
index d9d928c8012..7aea124c91f 100644
--- a/gdb/features/mips-dsp-linux.c
+++ b/gdb/features/mips-dsp-linux.c
@@ -6,6 +6,7 @@
#include "target-descriptions.h"
const struct target_desc *tdesc_mips_dsp_linux;
+
static void
initialize_tdesc_mips_dsp_linux (void)
{
diff --git a/gdb/features/mips-linux.c b/gdb/features/mips-linux.c
index 8557bc8357d..a22cc30ef4b 100644
--- a/gdb/features/mips-linux.c
+++ b/gdb/features/mips-linux.c
@@ -6,6 +6,7 @@
#include "target-descriptions.h"
const struct target_desc *tdesc_mips_linux;
+
static void
initialize_tdesc_mips_linux (void)
{
diff --git a/gdb/features/mips64-dsp-linux.c b/gdb/features/mips64-dsp-linux.c
index 80bbbcbd152..2b02a709a4c 100644
--- a/gdb/features/mips64-dsp-linux.c
+++ b/gdb/features/mips64-dsp-linux.c
@@ -6,6 +6,7 @@
#include "target-descriptions.h"
const struct target_desc *tdesc_mips64_dsp_linux;
+
static void
initialize_tdesc_mips64_dsp_linux (void)
{
diff --git a/gdb/features/mips64-linux.c b/gdb/features/mips64-linux.c
index 21e8c37b933..5d329ccb360 100644
--- a/gdb/features/mips64-linux.c
+++ b/gdb/features/mips64-linux.c
@@ -6,6 +6,7 @@
#include "target-descriptions.h"
const struct target_desc *tdesc_mips64_linux;
+
static void
initialize_tdesc_mips64_linux (void)
{
diff --git a/gdb/features/nds32.c b/gdb/features/nds32.c
index 7a08d2c85bb..214284ba10f 100644
--- a/gdb/features/nds32.c
+++ b/gdb/features/nds32.c
@@ -6,6 +6,7 @@
#include "target-descriptions.h"
const struct target_desc *tdesc_nds32;
+
static void
initialize_tdesc_nds32 (void)
{
diff --git a/gdb/features/nios2.c b/gdb/features/nios2.c
index 648f7ed57ab..478ba57267b 100644
--- a/gdb/features/nios2.c
+++ b/gdb/features/nios2.c
@@ -6,6 +6,7 @@
#include "target-descriptions.h"
const struct target_desc *tdesc_nios2;
+
static void
initialize_tdesc_nios2 (void)
{
diff --git a/gdb/features/or1k-linux.c b/gdb/features/or1k-linux.c
index 3eb65489383..99206440699 100644
--- a/gdb/features/or1k-linux.c
+++ b/gdb/features/or1k-linux.c
@@ -6,6 +6,7 @@
#include "target-descriptions.h"
const struct target_desc *tdesc_or1k_linux;
+
static void
initialize_tdesc_or1k_linux (void)
{
diff --git a/gdb/features/or1k.c b/gdb/features/or1k.c
index 67040965bd5..838c349a2f3 100644
--- a/gdb/features/or1k.c
+++ b/gdb/features/or1k.c
@@ -6,6 +6,7 @@
#include "target-descriptions.h"
const struct target_desc *tdesc_or1k;
+
static void
initialize_tdesc_or1k (void)
{
diff --git a/gdb/features/rx.c b/gdb/features/rx.c
index 825a4ac4538..1188a3c51de 100644
--- a/gdb/features/rx.c
+++ b/gdb/features/rx.c
@@ -6,6 +6,7 @@
#include "target-descriptions.h"
const struct target_desc *tdesc_rx;
+
static void
initialize_tdesc_rx (void)
{
diff --git a/gdb/features/s390-gs-linux64.c b/gdb/features/s390-gs-linux64.c
index d48f8312f20..5bb52e81578 100644
--- a/gdb/features/s390-gs-linux64.c
+++ b/gdb/features/s390-gs-linux64.c
@@ -6,6 +6,7 @@
#include "target-descriptions.h"
const struct target_desc *tdesc_s390_gs_linux64;
+
static void
initialize_tdesc_s390_gs_linux64 (void)
{
diff --git a/gdb/features/s390-linux32.c b/gdb/features/s390-linux32.c
index 03ec11a26b3..6c883059385 100644
--- a/gdb/features/s390-linux32.c
+++ b/gdb/features/s390-linux32.c
@@ -6,6 +6,7 @@
#include "target-descriptions.h"
const struct target_desc *tdesc_s390_linux32;
+
static void
initialize_tdesc_s390_linux32 (void)
{
diff --git a/gdb/features/s390-linux32v1.c b/gdb/features/s390-linux32v1.c
index 65de6f254f7..230f84b816a 100644
--- a/gdb/features/s390-linux32v1.c
+++ b/gdb/features/s390-linux32v1.c
@@ -6,6 +6,7 @@
#include "target-descriptions.h"
const struct target_desc *tdesc_s390_linux32v1;
+
static void
initialize_tdesc_s390_linux32v1 (void)
{
diff --git a/gdb/features/s390-linux32v2.c b/gdb/features/s390-linux32v2.c
index 0e3e04dfd43..511fb61f8b9 100644
--- a/gdb/features/s390-linux32v2.c
+++ b/gdb/features/s390-linux32v2.c
@@ -6,6 +6,7 @@
#include "target-descriptions.h"
const struct target_desc *tdesc_s390_linux32v2;
+
static void
initialize_tdesc_s390_linux32v2 (void)
{
diff --git a/gdb/features/s390-linux64.c b/gdb/features/s390-linux64.c
index f0ec91992f9..10d465e0230 100644
--- a/gdb/features/s390-linux64.c
+++ b/gdb/features/s390-linux64.c
@@ -6,6 +6,7 @@
#include "target-descriptions.h"
const struct target_desc *tdesc_s390_linux64;
+
static void
initialize_tdesc_s390_linux64 (void)
{
diff --git a/gdb/features/s390-linux64v1.c b/gdb/features/s390-linux64v1.c
index 9a360c7e267..a80bbfde4ea 100644
--- a/gdb/features/s390-linux64v1.c
+++ b/gdb/features/s390-linux64v1.c
@@ -6,6 +6,7 @@
#include "target-descriptions.h"
const struct target_desc *tdesc_s390_linux64v1;
+
static void
initialize_tdesc_s390_linux64v1 (void)
{
diff --git a/gdb/features/s390-linux64v2.c b/gdb/features/s390-linux64v2.c
index 18bc6ed4f9c..106a0d6c33c 100644
--- a/gdb/features/s390-linux64v2.c
+++ b/gdb/features/s390-linux64v2.c
@@ -6,6 +6,7 @@
#include "target-descriptions.h"
const struct target_desc *tdesc_s390_linux64v2;
+
static void
initialize_tdesc_s390_linux64v2 (void)
{
diff --git a/gdb/features/s390-te-linux64.c b/gdb/features/s390-te-linux64.c
index a8909b36bbf..cb9633d87e5 100644
--- a/gdb/features/s390-te-linux64.c
+++ b/gdb/features/s390-te-linux64.c
@@ -6,6 +6,7 @@
#include "target-descriptions.h"
const struct target_desc *tdesc_s390_te_linux64;
+
static void
initialize_tdesc_s390_te_linux64 (void)
{
diff --git a/gdb/features/s390-tevx-linux64.c b/gdb/features/s390-tevx-linux64.c
index 8f8aec61a49..81e96c2d74a 100644
--- a/gdb/features/s390-tevx-linux64.c
+++ b/gdb/features/s390-tevx-linux64.c
@@ -6,6 +6,7 @@
#include "target-descriptions.h"
const struct target_desc *tdesc_s390_tevx_linux64;
+
static void
initialize_tdesc_s390_tevx_linux64 (void)
{
diff --git a/gdb/features/s390-vx-linux64.c b/gdb/features/s390-vx-linux64.c
index 0bcc14d7d08..2cfb40aada7 100644
--- a/gdb/features/s390-vx-linux64.c
+++ b/gdb/features/s390-vx-linux64.c
@@ -6,6 +6,7 @@
#include "target-descriptions.h"
const struct target_desc *tdesc_s390_vx_linux64;
+
static void
initialize_tdesc_s390_vx_linux64 (void)
{
diff --git a/gdb/features/s390x-gs-linux64.c b/gdb/features/s390x-gs-linux64.c
index 074c38d668c..37dbb21ea39 100644
--- a/gdb/features/s390x-gs-linux64.c
+++ b/gdb/features/s390x-gs-linux64.c
@@ -6,6 +6,7 @@
#include "target-descriptions.h"
const struct target_desc *tdesc_s390x_gs_linux64;
+
static void
initialize_tdesc_s390x_gs_linux64 (void)
{
diff --git a/gdb/features/s390x-linux64.c b/gdb/features/s390x-linux64.c
index af5ba23dc38..db104f6745a 100644
--- a/gdb/features/s390x-linux64.c
+++ b/gdb/features/s390x-linux64.c
@@ -6,6 +6,7 @@
#include "target-descriptions.h"
const struct target_desc *tdesc_s390x_linux64;
+
static void
initialize_tdesc_s390x_linux64 (void)
{
diff --git a/gdb/features/s390x-linux64v1.c b/gdb/features/s390x-linux64v1.c
index a33bdc1672f..b0b51252dc2 100644
--- a/gdb/features/s390x-linux64v1.c
+++ b/gdb/features/s390x-linux64v1.c
@@ -6,6 +6,7 @@
#include "target-descriptions.h"
const struct target_desc *tdesc_s390x_linux64v1;
+
static void
initialize_tdesc_s390x_linux64v1 (void)
{
diff --git a/gdb/features/s390x-linux64v2.c b/gdb/features/s390x-linux64v2.c
index 8b906a47e44..524a233d567 100644
--- a/gdb/features/s390x-linux64v2.c
+++ b/gdb/features/s390x-linux64v2.c
@@ -6,6 +6,7 @@
#include "target-descriptions.h"
const struct target_desc *tdesc_s390x_linux64v2;
+
static void
initialize_tdesc_s390x_linux64v2 (void)
{
diff --git a/gdb/features/s390x-te-linux64.c b/gdb/features/s390x-te-linux64.c
index de8bf610470..c561a6ce4f6 100644
--- a/gdb/features/s390x-te-linux64.c
+++ b/gdb/features/s390x-te-linux64.c
@@ -6,6 +6,7 @@
#include "target-descriptions.h"
const struct target_desc *tdesc_s390x_te_linux64;
+
static void
initialize_tdesc_s390x_te_linux64 (void)
{
diff --git a/gdb/features/s390x-tevx-linux64.c b/gdb/features/s390x-tevx-linux64.c
index 8bd5cc6c439..96c37fcc8b8 100644
--- a/gdb/features/s390x-tevx-linux64.c
+++ b/gdb/features/s390x-tevx-linux64.c
@@ -6,6 +6,7 @@
#include "target-descriptions.h"
const struct target_desc *tdesc_s390x_tevx_linux64;
+
static void
initialize_tdesc_s390x_tevx_linux64 (void)
{
diff --git a/gdb/features/s390x-vx-linux64.c b/gdb/features/s390x-vx-linux64.c
index f450c45144d..41c81d80ce4 100644
--- a/gdb/features/s390x-vx-linux64.c
+++ b/gdb/features/s390x-vx-linux64.c
@@ -6,6 +6,7 @@
#include "target-descriptions.h"
const struct target_desc *tdesc_s390x_vx_linux64;
+
static void
initialize_tdesc_s390x_vx_linux64 (void)
{
diff --git a/gdb/features/z80.c b/gdb/features/z80.c
index f8e2a1988d0..1688f05fc0b 100644
--- a/gdb/features/z80.c
+++ b/gdb/features/z80.c
@@ -6,6 +6,7 @@
#include "target-descriptions.h"
const struct target_desc *tdesc_z80;
+
static void
initialize_tdesc_z80 (void)
{
diff --git a/gdb/filename-seen-cache.c b/gdb/filename-seen-cache.c
index be8fe1c18a0..444a9886153 100644
--- a/gdb/filename-seen-cache.c
+++ b/gdb/filename-seen-cache.c
@@ -21,15 +21,14 @@
#include "filename-seen-cache.h"
#include "filenames.h"
- /* Initial size of the table. It automagically grows from here. */
+/* Initial size of the table. It automagically grows from here. */
#define INITIAL_FILENAME_SEEN_CACHE_SIZE 100
/* filename_seen_cache constructor. */
filename_seen_cache::filename_seen_cache ()
- : m_tab (htab_create_alloc (INITIAL_FILENAME_SEEN_CACHE_SIZE,
- filename_hash, filename_eq,
- NULL, xcalloc, xfree))
+ : m_tab (htab_create_alloc (INITIAL_FILENAME_SEEN_CACHE_SIZE, filename_hash,
+ filename_eq, NULL, xcalloc, xfree))
{
}
diff --git a/gdb/filename-seen-cache.h b/gdb/filename-seen-cache.h
index 7ae878a5616..1463d58cd6f 100644
--- a/gdb/filename-seen-cache.h
+++ b/gdb/filename-seen-cache.h
@@ -29,6 +29,7 @@
class filename_seen_cache
{
public:
+
filename_seen_cache ();
DISABLE_COPY_AND_ASSIGN (filename_seen_cache);
@@ -47,18 +48,18 @@ public:
filename is passed as argument to CALLBACK. */
void traverse (gdb::function_view<void (const char *filename)> callback)
{
- auto erased_cb = [] (void **slot, void *info) -> int
- {
- auto filename = (const char *) *slot;
- auto restored_cb = (decltype (callback) *) info;
- (*restored_cb) (filename);
- return 1;
- };
+ auto erased_cb = [] (void **slot, void *info) -> int {
+ auto filename = (const char *) *slot;
+ auto restored_cb = (decltype (callback) *) info;
+ (*restored_cb) (filename);
+ return 1;
+ };
htab_traverse_noresize (m_tab.get (), erased_cb, &callback);
}
private:
+
/* Table of files seen so far. */
htab_up m_tab;
};
diff --git a/gdb/filesystem.c b/gdb/filesystem.c
index 27a806e1ba0..dae74a7212b 100644
--- a/gdb/filesystem.c
+++ b/gdb/filesystem.c
@@ -25,13 +25,9 @@
const char file_system_kind_auto[] = "auto";
const char file_system_kind_unix[] = "unix";
const char file_system_kind_dos_based[] = "dos-based";
-const char *const target_file_system_kinds[] =
-{
- file_system_kind_auto,
- file_system_kind_unix,
- file_system_kind_dos_based,
- NULL
-};
+const char *const target_file_system_kinds[]
+ = { file_system_kind_auto, file_system_kind_unix, file_system_kind_dos_based,
+ NULL };
const char *target_file_system_kind = file_system_kind_auto;
const char *
@@ -58,35 +54,34 @@ target_lbasename (const char *kind, const char *name)
}
static void
-show_target_file_system_kind_command (struct ui_file *file,
- int from_tty,
+show_target_file_system_kind_command (struct ui_file *file, int from_tty,
struct cmd_list_element *c,
const char *value)
{
if (target_file_system_kind == file_system_kind_auto)
- gdb_printf (file, _("\
+ gdb_printf (file, _ ("\
The assumed file system kind for target reported file names \
is \"%s\" (currently \"%s\").\n"),
- value,
- effective_target_file_system_kind ());
+ value, effective_target_file_system_kind ());
else
- gdb_printf (file, _("\
+ gdb_printf (file, _ ("\
The assumed file system kind for target reported file names \
is \"%s\".\n"),
value);
}
void _initialize_filesystem ();
+
void
_initialize_filesystem ()
{
- add_setshow_enum_cmd ("target-file-system-kind",
- class_files,
- target_file_system_kinds,
- &target_file_system_kind, _("\
-Set assumed file system kind for target reported file names."), _("\
+ add_setshow_enum_cmd ("target-file-system-kind", class_files,
+ target_file_system_kinds, &target_file_system_kind,
+ _ ("\
+Set assumed file system kind for target reported file names."),
+ _ ("\
Show assumed file system kind for target reported file names."),
- _("\
+ _ ("\
If `unix', target file names (e.g., loaded shared library file names)\n\
starting the forward slash (`/') character are considered absolute,\n\
and the directory separator character is the forward slash (`/'). If\n\
@@ -96,6 +91,6 @@ backslash (`\\') is also considered a directory separator. Set to\n\
`auto' (which is the default), to let GDB decide, based on its\n\
knowledge of the target operating system."),
NULL, /* setfunc */
- show_target_file_system_kind_command,
- &setlist, &showlist);
+ show_target_file_system_kind_command, &setlist,
+ &showlist);
}
diff --git a/gdb/filesystem.h b/gdb/filesystem.h
index f2082dacde6..6c579ce9647 100644
--- a/gdb/filesystem.h
+++ b/gdb/filesystem.h
@@ -28,23 +28,22 @@ extern const char *target_file_system_kind;
/* Same as IS_DIR_SEPARATOR but with file system kind KIND's
semantics, instead of host semantics. */
-#define IS_TARGET_DIR_SEPARATOR(kind, c) \
+#define IS_TARGET_DIR_SEPARATOR(kind, c) \
(((kind) == file_system_kind_dos_based) ? IS_DOS_DIR_SEPARATOR (c) \
- : IS_UNIX_DIR_SEPARATOR (c))
+ : IS_UNIX_DIR_SEPARATOR (c))
/* Same as IS_ABSOLUTE_PATH but with file system kind KIND's
semantics, instead of host semantics. */
-#define IS_TARGET_ABSOLUTE_PATH(kind, p) \
+#define IS_TARGET_ABSOLUTE_PATH(kind, p) \
(((kind) == file_system_kind_dos_based) ? IS_DOS_ABSOLUTE_PATH (p) \
- : IS_UNIX_ABSOLUTE_PATH (p))
+ : IS_UNIX_ABSOLUTE_PATH (p))
/* Same as HAS_DRIVE_SPEC but with file system kind KIND's semantics,
instead of host semantics. */
-#define HAS_TARGET_DRIVE_SPEC(kind, p) \
- (((kind) == file_system_kind_dos_based) ? HAS_DOS_DRIVE_SPEC (p) \
- : 0)
+#define HAS_TARGET_DRIVE_SPEC(kind, p) \
+ (((kind) == file_system_kind_dos_based) ? HAS_DOS_DRIVE_SPEC (p) : 0)
/* Same as lbasename, but with file system kind KIND's semantics,
instead of host semantics. */
diff --git a/gdb/findcmd.c b/gdb/findcmd.c
index 637d3fdfaf9..9862e282cc6 100644
--- a/gdb/findcmd.c
+++ b/gdb/findcmd.c
@@ -68,7 +68,7 @@ parse_find_args (const char *args, ULONGEST *max_countp,
struct value *v;
if (args == NULL)
- error (_("Missing search parameters."));
+ error (_ ("Missing search parameters."));
/* Get search granularity and/or max count if specified.
They may be specified in either order, together or separately. */
@@ -96,7 +96,7 @@ parse_find_args (const char *args, ULONGEST *max_countp,
size = *s++;
break;
default:
- error (_("Invalid size granularity."));
+ error (_ ("Invalid size granularity."));
}
}
@@ -121,15 +121,14 @@ parse_find_args (const char *args, ULONGEST *max_countp,
len = value_as_long (v);
if (len == 0)
{
- gdb_printf (_("Empty search range.\n"));
+ gdb_printf (_ ("Empty search range.\n"));
return pattern_buf;
}
if (len < 0)
- error (_("Invalid length."));
+ error (_ ("Invalid length."));
/* Watch for overflows. */
- if (len > CORE_ADDR_MAX
- || (start_addr + len - 1) < start_addr)
- error (_("Search space too large."));
+ if (len > CORE_ADDR_MAX || (start_addr + len - 1) < start_addr)
+ error (_ ("Search space too large."));
search_space_len = len;
}
else
@@ -139,14 +138,14 @@ parse_find_args (const char *args, ULONGEST *max_countp,
v = parse_to_comma_and_eval (&s);
end_addr = value_as_address (v);
if (start_addr > end_addr)
- error (_("Invalid search space, end precedes start."));
+ error (_ ("Invalid search space, end precedes start."));
search_space_len = end_addr - start_addr + 1;
/* We don't support searching all of memory
(i.e. start=0, end = 0xff..ff).
Bail to avoid overflows later on. */
if (search_space_len == 0)
- error (_("Overflow in address range "
- "computation, choose smaller range."));
+ error (_ ("Overflow in address range "
+ "computation, choose smaller range."));
}
if (*s == ',')
@@ -196,10 +195,10 @@ parse_find_args (const char *args, ULONGEST *max_countp,
}
if (pattern_buf.empty ())
- error (_("Missing search pattern."));
+ error (_ ("Missing search pattern."));
if (search_space_len < pattern_buf.size ())
- error (_("Search space too small to contain pattern."));
+ error (_ ("Search space too small to contain pattern."));
*max_countp = max_count;
*start_addrp = start_addr;
@@ -222,26 +221,23 @@ find_command (const char *args, int from_tty)
unsigned int found_count;
CORE_ADDR last_found_addr;
- gdb::byte_vector pattern_buf = parse_find_args (args, &max_count,
- &start_addr,
- &search_space_len,
- big_p);
+ gdb::byte_vector pattern_buf
+ = parse_find_args (args, &max_count, &start_addr, &search_space_len,
+ big_p);
/* Perform the search. */
found_count = 0;
last_found_addr = 0;
- while (search_space_len >= pattern_buf.size ()
- && found_count < max_count)
+ while (search_space_len >= pattern_buf.size () && found_count < max_count)
{
/* Offset from start of this iteration to the next iteration. */
ULONGEST next_iter_incr;
CORE_ADDR found_addr;
int found = target_search_memory (start_addr, search_space_len,
pattern_buf.data (),
- pattern_buf.size (),
- &found_addr);
+ pattern_buf.size (), &found_addr);
if (found <= 0)
break;
@@ -281,10 +277,11 @@ find_command (const char *args, int from_tty)
}
void _initialize_mem_search ();
+
void
_initialize_mem_search ()
{
- add_cmd ("find", class_vars, find_command, _("\
+ add_cmd ("find", class_vars, find_command, _ ("\
Search memory for a sequence of bytes.\n\
Usage:\nfind \
[/SIZE-CHAR] [/MAX-COUNT] START-ADDRESS, END-ADDRESS, EXPR1 [, EXPR2 ...]\n\
diff --git a/gdb/findvar.c b/gdb/findvar.c
index 02d498d8c58..8e14d643322 100644
--- a/gdb/findvar.c
+++ b/gdb/findvar.c
@@ -25,7 +25,7 @@
#include "gdbcore.h"
#include "inferior.h"
#include "target.h"
-#include "symfile.h" /* for overlay functions */
+#include "symfile.h" /* for overlay functions */
#include "regcache.h"
#include "user-regs.h"
#include "block.h"
@@ -39,21 +39,22 @@
LEN bytes long. */
#if TARGET_CHAR_BIT != 8 || HOST_CHAR_BIT != 8
- /* 8 bit characters are a pretty safe assumption these days, so we
+/* 8 bit characters are a pretty safe assumption these days, so we
assume it throughout all these swapping routines. If we had to deal with
9 bit characters, we would need to make len be in bits and would have
to re-write these routines... */
you lose
#endif
-template<typename T, typename>
-T
-extract_integer (gdb::array_view<const gdb_byte> buf, enum bfd_endian byte_order)
+ template<typename T, typename>
+ T
+ extract_integer (gdb::array_view<const gdb_byte> buf,
+ enum bfd_endian byte_order)
{
typename std::make_unsigned<T>::type retval = 0;
if (buf.size () > (int) sizeof (T))
- error (_("\
+ error (_ ("\
That operation is not available on integers of more than %d bytes."),
(int) sizeof (T));
@@ -91,8 +92,9 @@ That operation is not available on integers of more than %d bytes."),
/* Explicit instantiations. */
template LONGEST extract_integer<LONGEST> (gdb::array_view<const gdb_byte> buf,
enum bfd_endian byte_order);
-template ULONGEST extract_integer<ULONGEST>
- (gdb::array_view<const gdb_byte> buf, enum bfd_endian byte_order);
+template ULONGEST
+extract_integer<ULONGEST> (gdb::array_view<const gdb_byte> buf,
+ enum bfd_endian byte_order);
/* Sometimes a long long unsigned integer can be extracted as a
LONGEST value. This is done so that we can print these values
@@ -110,9 +112,7 @@ extract_long_unsigned_integer (const gdb_byte *addr, int orig_len,
len = orig_len;
if (byte_order == BFD_ENDIAN_BIG)
{
- for (p = addr;
- len > (int) sizeof (LONGEST) && p < addr + orig_len;
- p++)
+ for (p = addr; len > (int) sizeof (LONGEST) && p < addr + orig_len; p++)
{
if (*p == 0)
len--;
@@ -124,8 +124,7 @@ extract_long_unsigned_integer (const gdb_byte *addr, int orig_len,
else
{
first_addr = addr;
- for (p = addr + orig_len - 1;
- len > (int) sizeof (LONGEST) && p >= addr;
+ for (p = addr + orig_len - 1; len > (int) sizeof (LONGEST) && p >= addr;
p--)
{
if (*p == 0)
@@ -137,8 +136,7 @@ extract_long_unsigned_integer (const gdb_byte *addr, int orig_len,
if (len <= (int) sizeof (LONGEST))
{
- *pval = (LONGEST) extract_unsigned_integer (first_addr,
- sizeof (LONGEST),
+ *pval = (LONGEST) extract_unsigned_integer (first_addr, sizeof (LONGEST),
byte_order);
return 1;
}
@@ -146,7 +144,6 @@ extract_long_unsigned_integer (const gdb_byte *addr, int orig_len,
return 0;
}
-
/* Treat the bytes at BUF as a pointer of type TYPE, and return the
address it represents. */
CORE_ADDR
@@ -160,8 +157,7 @@ extract_typed_address (const gdb_byte *buf, struct type *type)
target-format integer at ADDR which is LEN bytes long. */
template<typename T, typename>
void
-store_integer (gdb_byte *addr, int len, enum bfd_endian byte_order,
- T val)
+store_integer (gdb_byte *addr, int len, enum bfd_endian byte_order, T val)
{
gdb_byte *p;
gdb_byte *startaddr = addr;
@@ -189,12 +185,10 @@ store_integer (gdb_byte *addr, int len, enum bfd_endian byte_order,
/* Explicit instantiations. */
template void store_integer (gdb_byte *addr, int len,
- enum bfd_endian byte_order,
- LONGEST val);
+ enum bfd_endian byte_order, LONGEST val);
template void store_integer (gdb_byte *addr, int len,
- enum bfd_endian byte_order,
- ULONGEST val);
+ enum bfd_endian byte_order, ULONGEST val);
/* Store the address ADDR as a pointer of type TYPE at BUF, in target
form. */
@@ -305,8 +299,8 @@ value_of_register_lazy (frame_info_ptr frame, int regnum)
/* Given a pointer of type TYPE in target form in BUF, return the
address it represents. */
CORE_ADDR
-unsigned_pointer_to_address (struct gdbarch *gdbarch,
- struct type *type, const gdb_byte *buf)
+unsigned_pointer_to_address (struct gdbarch *gdbarch, struct type *type,
+ const gdb_byte *buf)
{
enum bfd_endian byte_order = type_byte_order (type);
@@ -314,8 +308,8 @@ unsigned_pointer_to_address (struct gdbarch *gdbarch,
}
CORE_ADDR
-signed_pointer_to_address (struct gdbarch *gdbarch,
- struct type *type, const gdb_byte *buf)
+signed_pointer_to_address (struct gdbarch *gdbarch, struct type *type,
+ const gdb_byte *buf)
{
enum bfd_endian byte_order = type_byte_order (type);
@@ -341,7 +335,7 @@ address_to_signed_pointer (struct gdbarch *gdbarch, struct type *type,
store_signed_integer (buf, type->length (), byte_order, addr);
}
-
+
/* See value.h. */
enum symbol_needs_kind
@@ -415,8 +409,7 @@ follow_static_link (frame_info_ptr frame,
/* If we don't know how to compute FRAME's base address, don't give up:
maybe the frame we are looking for is upper in the stack frame. */
- if (framefunc != NULL
- && SYMBOL_BLOCK_OPS (framefunc) != NULL
+ if (framefunc != NULL && SYMBOL_BLOCK_OPS (framefunc) != NULL
&& SYMBOL_BLOCK_OPS (framefunc)->get_frame_base != NULL
&& (SYMBOL_BLOCK_OPS (framefunc)->get_frame_base (framefunc, frame)
== upper_frame_base))
@@ -532,14 +525,13 @@ get_hosting_frame (struct symbol *var, const struct block *var_block,
frame = block_innermost_frame (var_block);
if (frame == NULL)
{
- if (var_block->function ()
- && !block_inlined_p (var_block)
+ if (var_block->function () && !block_inlined_p (var_block)
&& var_block->function ()->print_name ())
- error (_("No frame is currently executing in block %s."),
+ error (_ ("No frame is currently executing in block %s."),
var_block->function ()->print_name ());
else
- error (_("No frame is currently executing in specified"
- " block"));
+ error (_ ("No frame is currently executing in specified"
+ " block"));
}
}
@@ -569,7 +561,7 @@ language_defn::read_var_value (struct symbol *var,
if (sym_need == SYMBOL_NEEDS_FRAME)
gdb_assert (frame != NULL);
else if (sym_need == SYMBOL_NEEDS_REGISTERS && !target_has_registers ())
- error (_("Cannot read `%s' without registers"), var->print_name ());
+ error (_ ("Cannot read `%s' without registers"), var->print_name ());
if (frame != NULL)
frame = get_hosting_frame (var, var_block, frame);
@@ -634,9 +626,8 @@ language_defn::read_var_value (struct symbol *var,
case LOC_STATIC:
if (overlay_debugging)
- addr
- = symbol_overlayed_address (var->value_address (),
- var->obj_section (var->objfile ()));
+ addr = symbol_overlayed_address (var->value_address (),
+ var->obj_section (var->objfile ()));
else
addr = var->value_address ();
break;
@@ -644,7 +635,7 @@ language_defn::read_var_value (struct symbol *var,
case LOC_ARG:
addr = get_frame_args_address (frame);
if (!addr)
- error (_("Unknown argument list address for `%s'."),
+ error (_ ("Unknown argument list address for `%s'."),
var->print_name ());
addr += var->value_longest ();
break;
@@ -656,7 +647,7 @@ language_defn::read_var_value (struct symbol *var,
argref = get_frame_args_address (frame);
if (!argref)
- error (_("Unknown argument list address for `%s'."),
+ error (_ ("Unknown argument list address for `%s'."),
var->print_name ());
argref += var->value_longest ();
ref = value_at (lookup_pointer_type (type), argref);
@@ -670,15 +661,14 @@ language_defn::read_var_value (struct symbol *var,
break;
case LOC_TYPEDEF:
- error (_("Cannot look up value of a typedef `%s'."),
+ error (_ ("Cannot look up value of a typedef `%s'."),
var->print_name ());
break;
case LOC_BLOCK:
if (overlay_debugging)
- addr = symbol_overlayed_address
- (var->value_block ()->entry_pc (),
- var->obj_section (var->objfile ()));
+ addr = symbol_overlayed_address (var->value_block ()->entry_pc (),
+ var->obj_section (var->objfile ()));
else
addr = var->value_block ()->entry_pc ();
break;
@@ -686,18 +676,17 @@ language_defn::read_var_value (struct symbol *var,
case LOC_REGISTER:
case LOC_REGPARM_ADDR:
{
- int regno = SYMBOL_REGISTER_OPS (var)
- ->register_number (var, get_frame_arch (frame));
+ int regno = SYMBOL_REGISTER_OPS (var)->register_number (
+ var, get_frame_arch (frame));
struct value *regval;
if (var->aclass () == LOC_REGPARM_ADDR)
{
- regval = value_from_register (lookup_pointer_type (type),
- regno,
- frame);
+ regval
+ = value_from_register (lookup_pointer_type (type), regno, frame);
if (regval == NULL)
- error (_("Value of register variable not available for `%s'."),
+ error (_ ("Value of register variable not available for `%s'."),
var->print_name ());
addr = value_as_address (regval);
@@ -707,7 +696,7 @@ language_defn::read_var_value (struct symbol *var,
regval = value_from_register (type, regno, frame);
if (regval == NULL)
- error (_("Value of register variable not available for `%s'."),
+ error (_ ("Value of register variable not available for `%s'."),
var->print_name ());
return regval;
}
@@ -722,31 +711,29 @@ language_defn::read_var_value (struct symbol *var,
struct obj_section *obj_section;
bound_minimal_symbol bmsym;
- gdbarch_iterate_over_objfiles_in_search_order
- (var->arch (),
- [var, &bmsym] (objfile *objfile)
- {
- bmsym = lookup_minimal_symbol (var->linkage_name (), nullptr,
- objfile);
+ gdbarch_iterate_over_objfiles_in_search_order (
+ var->arch (),
+ [var, &bmsym] (objfile *objfile) {
+ bmsym
+ = lookup_minimal_symbol (var->linkage_name (), nullptr, objfile);
- /* Stop if a match is found. */
- return bmsym.minsym != nullptr;
- },
- var->objfile ());
+ /* Stop if a match is found. */
+ return bmsym.minsym != nullptr;
+ },
+ var->objfile ());
/* If we can't find the minsym there's a problem in the symbol info.
The symbol exists in the debug info, but it's missing in the minsym
table. */
if (bmsym.minsym == nullptr)
{
- const char *flavour_name
- = objfile_flavour_name (var->objfile ());
+ const char *flavour_name = objfile_flavour_name (var->objfile ());
/* We can't get here unless we've opened the file, so flavour_name
can't be NULL. */
gdb_assert (flavour_name != NULL);
- error (_("Missing %s symbol \"%s\"."),
- flavour_name, var->linkage_name ());
+ error (_ ("Missing %s symbol \"%s\"."), flavour_name,
+ var->linkage_name ());
}
obj_section = bmsym.minsym->obj_section (bmsym.objfile);
@@ -754,9 +741,9 @@ language_defn::read_var_value (struct symbol *var,
a TLS variable. */
if (obj_section == NULL
|| (obj_section->the_bfd_section->flags & SEC_THREAD_LOCAL) != 0)
- addr = bmsym.minsym->value_raw_address ();
+ addr = bmsym.minsym->value_raw_address ();
else
- addr = bmsym.value_address ();
+ addr = bmsym.value_address ();
if (overlay_debugging)
addr = symbol_overlayed_address (addr, obj_section);
/* Determine address of TLS variable. */
@@ -772,7 +759,7 @@ language_defn::read_var_value (struct symbol *var,
return allocate_optimized_out_value (type);
default:
- error (_("Cannot look up value of a botched symbol `%s'."),
+ error (_ ("Cannot look up value of a botched symbol `%s'."),
var->print_name ());
break;
}
@@ -897,7 +884,8 @@ value_from_register (struct type *type, int regnum, frame_info_ptr frame)
including the location. */
v = allocate_value (type);
VALUE_LVAL (v) = lval_register;
- VALUE_NEXT_FRAME_ID (v) = get_frame_id (get_next_frame_sentinel_okay (frame));
+ VALUE_NEXT_FRAME_ID (v)
+ = get_frame_id (get_next_frame_sentinel_okay (frame));
VALUE_REGNUM (v) = regnum;
ok = gdbarch_register_to_value (gdbarch, frame, regnum, type1,
value_contents_raw (v).data (), &optim,
@@ -914,8 +902,8 @@ value_from_register (struct type *type, int regnum, frame_info_ptr frame)
else
{
/* Construct the value. */
- v = gdbarch_value_from_register (gdbarch, type,
- regnum, get_frame_id (frame));
+ v = gdbarch_value_from_register (gdbarch, type, regnum,
+ get_frame_id (frame));
/* Get the data. */
read_frame_register_value (v, frame);
@@ -937,7 +925,7 @@ address_from_register (int regnum, frame_info_ptr frame)
int regnum_max_excl = gdbarch_num_cooked_regs (gdbarch);
if (regnum < 0 || regnum >= regnum_max_excl)
- error (_("Invalid register #%d, expecting 0 <= # < %d"), regnum,
+ error (_ ("Invalid register #%d, expecting 0 <= # < %d"), regnum,
regnum_max_excl);
/* This routine may be called during early unwinding, at a time
@@ -954,8 +942,8 @@ address_from_register (int regnum, frame_info_ptr frame)
gdb_byte *buf = (gdb_byte *) alloca (type->length ());
int optim, unavail, ok;
- ok = gdbarch_register_to_value (gdbarch, frame, regnum, type,
- buf, &optim, &unavail);
+ ok = gdbarch_register_to_value (gdbarch, frame, regnum, type, buf,
+ &optim, &unavail);
if (!ok)
{
/* This function is used while computing a location expression.
@@ -987,8 +975,10 @@ address_from_register (int regnum, frame_info_ptr frame)
}
#if GDB_SELF_TEST
-namespace selftests {
-namespace findvar_tests {
+namespace selftests
+{
+namespace findvar_tests
+{
/* Function to test copy_integer_to_size. Store SOURCE_VAL with size
SOURCE_SIZE to a buffer, making sure no sign extending happens at this
@@ -1002,7 +992,7 @@ static void
do_cint_test (ULONGEST dest_valu, ULONGEST dest_vals, int dest_size,
ULONGEST src_val, int src_size)
{
- for (int i = 0; i < 2 ; i++)
+ for (int i = 0; i < 2; i++)
{
gdb_byte srcbuf[sizeof (ULONGEST)] = {};
gdb_byte destbuf[sizeof (ULONGEST)] = {};
@@ -1020,15 +1010,17 @@ do_cint_test (ULONGEST dest_valu, ULONGEST dest_vals, int dest_size,
memset (destbuf, 0xaa, sizeof (destbuf));
copy_integer_to_size (destbuf, dest_size, srcbuf, src_size, false,
byte_order);
- SELF_CHECK (dest_valu == extract_unsigned_integer (destbuf, dest_size,
- byte_order));
+ SELF_CHECK (dest_valu
+ == extract_unsigned_integer (destbuf, dest_size,
+ byte_order));
/* Test signed. */
memset (destbuf, 0xaa, sizeof (destbuf));
copy_integer_to_size (destbuf, dest_size, srcbuf, src_size, true,
byte_order);
- SELF_CHECK (dest_vals == extract_unsigned_integer (destbuf, dest_size,
- byte_order));
+ SELF_CHECK (dest_vals
+ == extract_unsigned_integer (destbuf, dest_size,
+ byte_order));
}
}
@@ -1062,18 +1054,19 @@ copy_integer_to_size_test ()
do_cint_test (0xff2112345678, 0xffffff2112345678, 8, 0xffffff2112345678, 6);
}
-} // namespace findvar_test
+} // namespace findvar_tests
} // namespace selftests
#endif
void _initialize_findvar ();
+
void
_initialize_findvar ()
{
#if GDB_SELF_TEST
- selftests::register_test
- ("copy_integer_to_size",
- selftests::findvar_tests::copy_integer_to_size_test);
+ selftests::register_test (
+ "copy_integer_to_size",
+ selftests::findvar_tests::copy_integer_to_size_test);
#endif
}
diff --git a/gdb/fork-child.c b/gdb/fork-child.c
index d210427f4b0..6a6398df667 100644
--- a/gdb/fork-child.c
+++ b/gdb/fork-child.c
@@ -109,7 +109,7 @@ postfork_child_hook ()
in a separate process group. */
debug_setpgrp = gdb_setpgid ();
if (debug_setpgrp == -1)
- perror (_("setpgrp failed in child"));
+ perror (_ ("setpgrp failed in child"));
}
/* Ask the tty subsystem to switch to the one we specified
@@ -149,32 +149,29 @@ static void
show_startup_with_shell (struct ui_file *file, int from_tty,
struct cmd_list_element *c, const char *value)
{
- gdb_printf (file,
- _("Use of shell to start subprocesses is %s.\n"),
- value);
+ gdb_printf (file, _ ("Use of shell to start subprocesses is %s.\n"), value);
}
void _initialize_fork_child ();
+
void
_initialize_fork_child ()
{
- add_setshow_filename_cmd ("exec-wrapper", class_run, &exec_wrapper, _("\
+ add_setshow_filename_cmd ("exec-wrapper", class_run, &exec_wrapper, _ ("\
Set a wrapper for running programs.\n\
The wrapper prepares the system and environment for the new program."),
- _("\
-Show the wrapper for running programs."), NULL,
- NULL, NULL,
- &setlist, &showlist);
+ _ ("\
+Show the wrapper for running programs."),
+ NULL, NULL, NULL, &setlist, &showlist);
add_cmd ("exec-wrapper", class_run, unset_exec_wrapper_command,
- _("Disable use of an execution wrapper."),
- &unsetlist);
+ _ ("Disable use of an execution wrapper."), &unsetlist);
add_setshow_boolean_cmd ("startup-with-shell", class_support,
- &startup_with_shell, _("\
-Set use of shell to start subprocesses. The default is on."), _("\
-Show use of shell to start subprocesses."), NULL,
- NULL,
- show_startup_with_shell,
- &setlist, &showlist);
+ &startup_with_shell, _ ("\
+Set use of shell to start subprocesses. The default is on."),
+ _ ("\
+Show use of shell to start subprocesses."),
+ NULL, NULL, show_startup_with_shell, &setlist,
+ &showlist);
}
diff --git a/gdb/frame-base.c b/gdb/frame-base.c
index b9c62275bae..c2c50ef3b5c 100644
--- a/gdb/frame-base.c
+++ b/gdb/frame-base.c
@@ -46,12 +46,10 @@ default_frame_args_address (frame_info_ptr this_frame, void **this_cache)
return default_frame_base_address (this_frame, this_cache);
}
-const struct frame_base default_frame_base = {
- NULL, /* No parent. */
- default_frame_base_address,
- default_frame_locals_address,
- default_frame_args_address
-};
+const struct frame_base default_frame_base
+ = { NULL, /* No parent. */
+ default_frame_base_address, default_frame_locals_address,
+ default_frame_args_address };
struct frame_base_table_entry
{
diff --git a/gdb/frame-base.h b/gdb/frame-base.h
index b572e39b90e..edc506e8294 100644
--- a/gdb/frame-base.h
+++ b/gdb/frame-base.h
@@ -17,7 +17,7 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
-#if !defined (FRAME_BASE_H)
+#if !defined(FRAME_BASE_H)
#define FRAME_BASE_H 1
class frame_info_ptr;
@@ -68,7 +68,8 @@ struct frame_base
/* Given THIS frame, return the frame base methods for THIS frame,
or NULL if it can't handle THIS frame. */
-typedef const struct frame_base *(frame_base_sniffer_ftype) (frame_info_ptr this_frame);
+typedef const struct frame_base *(
+ frame_base_sniffer_ftype) (frame_info_ptr this_frame);
/* Append a frame base sniffer to the list. The sniffers are polled
in the order that they are appended. */
@@ -86,6 +87,7 @@ extern void frame_base_set_default (struct gdbarch *gdbarch,
/* Iterate through the list of frame base handlers until one returns
an implementation. */
-extern const struct frame_base *frame_base_find_by_frame (frame_info_ptr this_frame);
+extern const struct frame_base *
+frame_base_find_by_frame (frame_info_ptr this_frame);
#endif
diff --git a/gdb/frame-id.h b/gdb/frame-id.h
index 5978d99bba8..db0a0fe2169 100644
--- a/gdb/frame-id.h
+++ b/gdb/frame-id.h
@@ -95,7 +95,7 @@ struct frame_id
CORE_ADDR special_addr;
/* Flags to indicate the above fields have valid contents. */
- ENUM_BITFIELD(frame_id_stack_status) stack_status : 3;
+ ENUM_BITFIELD (frame_id_stack_status) stack_status : 3;
unsigned int code_addr_p : 1;
unsigned int special_addr_p : 1;
@@ -117,10 +117,7 @@ struct frame_id
bool operator== (const frame_id &r) const;
/* Inverse of ==. */
- bool operator!= (const frame_id &r) const
- {
- return !(*this == r);
- }
+ bool operator!= (const frame_id &r) const { return !(*this == r); }
};
/* Methods for constructing and comparing Frame IDs. */
diff --git a/gdb/frame-unwind.c b/gdb/frame-unwind.c
index b708c64f967..a7432f220b0 100644
--- a/gdb/frame-unwind.c
+++ b/gdb/frame-unwind.c
@@ -43,7 +43,7 @@ struct frame_unwind_table
};
static const registry<gdbarch>::key<struct frame_unwind_table>
- frame_unwind_data;
+ frame_unwind_data;
/* A helper function to add an unwinder to a list. LINK says where to
install the new unwinder. The new link is returned. */
@@ -91,7 +91,7 @@ get_frame_unwind_table (struct gdbarch *gdbarch)
void
frame_unwind_prepend_unwinder (struct gdbarch *gdbarch,
- const struct frame_unwind *unwinder)
+ const struct frame_unwind *unwinder)
{
struct frame_unwind_table *table = get_frame_unwind_table (gdbarch);
struct frame_unwind_table_entry *entry;
@@ -111,7 +111,8 @@ frame_unwind_append_unwinder (struct gdbarch *gdbarch,
struct frame_unwind_table_entry **ip;
/* Find the end of the list and insert the new entry there. */
- for (ip = table->osabi_head; (*ip) != NULL; ip = &(*ip)->next);
+ for (ip = table->osabi_head; (*ip) != NULL; ip = &(*ip)->next)
+ ;
(*ip) = GDBARCH_OBSTACK_ZALLOC (gdbarch, struct frame_unwind_table_entry);
(*ip)->unwinder = unwinder;
}
@@ -122,7 +123,7 @@ frame_unwind_append_unwinder (struct gdbarch *gdbarch,
static int
frame_unwind_try_unwinder (frame_info_ptr this_frame, void **this_cache,
- const struct frame_unwind *unwinder)
+ const struct frame_unwind *unwinder)
{
int res = 0;
@@ -194,20 +195,20 @@ frame_unwind_find_by_frame (frame_info_ptr this_frame, void **this_cache)
unwinder_from_target = target_get_unwinder ();
if (unwinder_from_target != NULL
&& frame_unwind_try_unwinder (this_frame, this_cache,
- unwinder_from_target))
+ unwinder_from_target))
return;
unwinder_from_target = target_get_tailcall_unwinder ();
if (unwinder_from_target != NULL
&& frame_unwind_try_unwinder (this_frame, this_cache,
- unwinder_from_target))
+ unwinder_from_target))
return;
for (entry = table->list; entry != NULL; entry = entry->next)
if (frame_unwind_try_unwinder (this_frame, this_cache, entry->unwinder))
return;
- internal_error (_("frame_unwind_find_by_frame failed"));
+ internal_error (_ ("frame_unwind_find_by_frame failed"));
}
/* A default frame sniffer which always accepts the frame. Used by
@@ -215,8 +216,7 @@ frame_unwind_find_by_frame (frame_info_ptr this_frame, void **this_cache)
int
default_frame_sniffer (const struct frame_unwind *self,
- frame_info_ptr this_frame,
- void **this_prologue_cache)
+ frame_info_ptr this_frame, void **this_prologue_cache)
{
return 1;
}
@@ -224,8 +224,7 @@ default_frame_sniffer (const struct frame_unwind *self,
/* The default frame unwinder stop_reason callback. */
enum unwind_stop_reason
-default_frame_unwind_stop_reason (frame_info_ptr this_frame,
- void **this_cache)
+default_frame_unwind_stop_reason (frame_info_ptr this_frame, void **this_cache)
{
struct frame_id this_id = get_frame_id (this_frame);
@@ -273,8 +272,7 @@ frame_unwind_got_optimized (frame_info_ptr frame, int regnum)
register NEW_REGNUM. */
struct value *
-frame_unwind_got_register (frame_info_ptr frame,
- int regnum, int new_regnum)
+frame_unwind_got_register (frame_info_ptr frame, int regnum, int new_regnum)
{
return value_of_register_lazy (frame, new_regnum);
}
@@ -296,8 +294,7 @@ frame_unwind_got_memory (frame_info_ptr frame, int regnum, CORE_ADDR addr)
REGNUM has a known constant (computed) value of VAL. */
struct value *
-frame_unwind_got_constant (frame_info_ptr frame, int regnum,
- ULONGEST val)
+frame_unwind_got_constant (frame_info_ptr frame, int regnum, ULONGEST val)
{
struct gdbarch *gdbarch = frame_unwind_arch (frame);
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
@@ -326,8 +323,7 @@ frame_unwind_got_bytes (frame_info_ptr frame, int regnum, const gdb_byte *buf)
CORE_ADDR to a target address if necessary. */
struct value *
-frame_unwind_got_address (frame_info_ptr frame, int regnum,
- CORE_ADDR addr)
+frame_unwind_got_address (frame_info_ptr frame, int regnum, CORE_ADDR addr)
{
struct gdbarch *gdbarch = frame_unwind_arch (frame);
struct value *reg_val;
diff --git a/gdb/frame-unwind.h b/gdb/frame-unwind.h
index 94e055d9fab..8c93e039331 100644
--- a/gdb/frame-unwind.h
+++ b/gdb/frame-unwind.h
@@ -17,7 +17,7 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
-#if !defined (FRAME_UNWIND_H)
+#if !defined(FRAME_UNWIND_H)
#define FRAME_UNWIND_H 1
struct frame_data;
@@ -28,7 +28,7 @@ struct gdbarch;
struct regcache;
struct value;
-#include "frame.h" /* For enum frame_type. */
+#include "frame.h" /* For enum frame_type. */
/* The following unwind functions assume a chain of frames forming the
sequence: (outer) prev <-> this <-> next (inner). All the
@@ -53,8 +53,8 @@ typedef int (frame_sniffer_ftype) (const struct frame_unwind *self,
frame_info_ptr this_frame,
void **this_prologue_cache);
-typedef enum unwind_stop_reason (frame_unwind_stop_reason_ftype)
- (frame_info_ptr this_frame, void **this_prologue_cache);
+typedef enum unwind_stop_reason (frame_unwind_stop_reason_ftype) (
+ frame_info_ptr this_frame, void **this_prologue_cache);
/* A default frame sniffer which always accepts the frame. Used by
fallback prologue unwinders. */
@@ -67,8 +67,8 @@ int default_frame_sniffer (const struct frame_unwind *self,
unwindable. */
enum unwind_stop_reason
- default_frame_unwind_stop_reason (frame_info_ptr this_frame,
- void **this_cache);
+default_frame_unwind_stop_reason (frame_info_ptr this_frame,
+ void **this_cache);
/* A default unwind_pc callback that simply unwinds the register identified
by GDBARCH_PC_REGNUM. */
@@ -140,14 +140,13 @@ typedef void (frame_this_id_ftype) (frame_info_ptr this_frame,
with the other unwind methods. Memory for that cache should be
allocated using FRAME_OBSTACK_ZALLOC(). */
-typedef struct value * (frame_prev_register_ftype)
- (frame_info_ptr this_frame, void **this_prologue_cache,
- int regnum);
+typedef struct value *(frame_prev_register_ftype) (frame_info_ptr this_frame,
+ void **this_prologue_cache,
+ int regnum);
/* Deallocate extra memory associated with the frame cache if any. */
-typedef void (frame_dealloc_cache_ftype) (frame_info *self,
- void *this_cache);
+typedef void (frame_dealloc_cache_ftype) (frame_info *self, void *this_cache);
/* Assuming the frame chain: (outer) prev <-> this <-> next (inner);
use THIS frame, and implicitly the NEXT frame's register unwind
@@ -201,8 +200,7 @@ extern void frame_unwind_find_by_frame (frame_info_ptr this_frame,
/* Return a value which indicates that FRAME did not save REGNUM. */
-struct value *frame_unwind_got_optimized (frame_info_ptr frame,
- int regnum);
+struct value *frame_unwind_got_optimized (frame_info_ptr frame, int regnum);
/* Return a value which indicates that FRAME copied REGNUM into
register NEW_REGNUM. */
diff --git a/gdb/frame.c b/gdb/frame.c
index a08a8f47ebc..05a8501b2a3 100644
--- a/gdb/frame.c
+++ b/gdb/frame.c
@@ -21,7 +21,7 @@
#include "frame.h"
#include "target.h"
#include "value.h"
-#include "inferior.h" /* for inferior_ptid */
+#include "inferior.h" /* for inferior_ptid */
#include "regcache.h"
#include "user-regs.h"
#include "gdbsupport/gdb_obstack.h"
@@ -68,7 +68,8 @@ get_frame_cache_generation ()
set_backtrace_options user_set_backtrace_options;
static frame_info_ptr get_prev_frame_raw (frame_info_ptr this_frame);
-static const char *frame_stop_reason_symbol_string (enum unwind_stop_reason reason);
+static const char *
+frame_stop_reason_symbol_string (enum unwind_stop_reason reason);
static frame_info_ptr create_new_frame (frame_id id);
/* Status of some values cached in the frame_info object. */
@@ -148,7 +149,8 @@ struct frame_info
} prev_arch;
/* Cached copy of the previous frame's resume address. */
- struct {
+ struct
+ {
cached_copy_status status;
/* Did VALUE require unmasking when being read. */
bool masked;
@@ -227,19 +229,16 @@ frame_addr_hash (const void *ap)
const struct frame_id f_id = frame->this_id.value;
hashval_t hash = 0;
- gdb_assert (f_id.stack_status != FID_STACK_INVALID
- || f_id.code_addr_p
+ gdb_assert (f_id.stack_status != FID_STACK_INVALID || f_id.code_addr_p
|| f_id.special_addr_p);
if (f_id.stack_status == FID_STACK_VALID)
- hash = iterative_hash (&f_id.stack_addr,
- sizeof (f_id.stack_addr), hash);
+ hash = iterative_hash (&f_id.stack_addr, sizeof (f_id.stack_addr), hash);
if (f_id.code_addr_p)
- hash = iterative_hash (&f_id.code_addr,
- sizeof (f_id.code_addr), hash);
+ hash = iterative_hash (&f_id.code_addr, sizeof (f_id.code_addr), hash);
if (f_id.special_addr_p)
- hash = iterative_hash (&f_id.special_addr,
- sizeof (f_id.special_addr), hash);
+ hash
+ = iterative_hash (&f_id.special_addr, sizeof (f_id.special_addr), hash);
char user_created_p = f_id.user_created_p;
hash = iterative_hash (&user_created_p, sizeof (user_created_p), hash);
@@ -265,10 +264,7 @@ frame_addr_hash_eq (const void *a, const void *b)
static void
frame_stash_create (void)
{
- frame_stash = htab_create (100,
- frame_addr_hash,
- frame_addr_hash_eq,
- NULL);
+ frame_stash = htab_create (100, frame_addr_hash, frame_addr_hash_eq, NULL);
}
/* Internal function to add a frame to the frame_stash hash table.
@@ -281,8 +277,8 @@ frame_stash_add (frame_info *frame)
/* Do not try to stash the sentinel frame. */
gdb_assert (frame->level >= 0);
- frame_info **slot = (frame_info **) htab_find_slot (frame_stash,
- frame, INSERT);
+ frame_info **slot
+ = (frame_info **) htab_find_slot (frame_stash, frame, INSERT);
/* If we already have a frame in the stack with the same id, we
either have a stack cycle (corrupted stack?), or some bug
@@ -342,7 +338,7 @@ static void
show_frame_debug (struct ui_file *file, int from_tty,
struct cmd_list_element *c, const char *value)
{
- gdb_printf (file, _("Frame debugging is %s.\n"), value);
+ gdb_printf (file, _ ("Frame debugging is %s.\n"), value);
}
/* Implementation of "show backtrace past-main". */
@@ -352,8 +348,8 @@ show_backtrace_past_main (struct ui_file *file, int from_tty,
struct cmd_list_element *c, const char *value)
{
gdb_printf (file,
- _("Whether backtraces should "
- "continue past \"main\" is %s.\n"),
+ _ ("Whether backtraces should "
+ "continue past \"main\" is %s.\n"),
value);
}
@@ -363,8 +359,9 @@ static void
show_backtrace_past_entry (struct ui_file *file, int from_tty,
struct cmd_list_element *c, const char *value)
{
- gdb_printf (file, _("Whether backtraces should continue past the "
- "entry point of a program is %s.\n"),
+ gdb_printf (file,
+ _ ("Whether backtraces should continue past the "
+ "entry point of a program is %s.\n"),
value);
}
@@ -375,8 +372,8 @@ show_backtrace_limit (struct ui_file *file, int from_tty,
struct cmd_list_element *c, const char *value)
{
gdb_printf (file,
- _("An upper bound on the number "
- "of backtrace levels is %s.\n"),
+ _ ("An upper bound on the number "
+ "of backtrace levels is %s.\n"),
value);
}
@@ -401,8 +398,8 @@ frame_id::to_string () const
res += std::string ("stack=") + hex_string (id.stack_addr);
/* Helper function to format 'N=A' if P is true, otherwise '!N'. */
- auto field_to_string = [] (const char *n, bool p, CORE_ADDR a) -> std::string
- {
+ auto field_to_string
+ = [] (const char *n, bool p, CORE_ADDR a) -> std::string {
if (p)
return std::string (n) + "=" + core_addr_to_string (a);
else
@@ -453,7 +450,7 @@ frame_type_str (frame_type type)
};
}
- /* See struct frame_info. */
+/* See struct frame_info. */
std::string
frame_info::to_string () const
@@ -665,7 +662,8 @@ frame_unwind_caller_id (frame_info_ptr next_frame)
}
const struct frame_id null_frame_id = { 0 }; /* All zeros. */
-const struct frame_id sentinel_frame_id = { 0, 0, 0, FID_STACK_SENTINEL, 0, 1, 0 };
+const struct frame_id sentinel_frame_id
+ = { 0, 0, 0, FID_STACK_SENTINEL, 0, 1, 0 };
const struct frame_id outer_frame_id = { 0, 0, 0, FID_STACK_OUTER, 0, 1, 0 };
struct frame_id
@@ -759,8 +757,7 @@ frame_id::operator== (const frame_id &r) const
{
bool eq;
- if (stack_status == FID_STACK_INVALID
- || r.stack_status == FID_STACK_INVALID)
+ if (stack_status == FID_STACK_INVALID || r.stack_status == FID_STACK_INVALID)
/* Like a NaN, if either ID is invalid, the result is false.
Note that a frame ID is invalid iff it is the null frame ID. */
eq = false;
@@ -785,8 +782,8 @@ frame_id::operator== (const frame_id &r) const
/* Frames are equal. */
eq = true;
- frame_debug_printf ("l=%s, r=%s -> %d",
- to_string ().c_str (), r.to_string ().c_str (), eq);
+ frame_debug_printf ("l=%s, r=%s -> %d", to_string ().c_str (),
+ r.to_string ().c_str (), eq);
return eq;
}
@@ -833,8 +830,7 @@ frame_id_inner (struct gdbarch *gdbarch, struct frame_id l, struct frame_id r)
Likewise if either ID has an unavailable stack address. */
inner = false;
else if (l.artificial_depth > r.artificial_depth
- && l.stack_addr == r.stack_addr
- && l.code_addr_p == r.code_addr_p
+ && l.stack_addr == r.stack_addr && l.code_addr_p == r.code_addr_p
&& l.special_addr_p == r.special_addr_p
&& l.special_addr == r.special_addr)
{
@@ -862,9 +858,8 @@ frame_id_inner (struct gdbarch *gdbarch, struct frame_id l, struct frame_id r)
different .code and/or .special address). */
inner = gdbarch_inner_than (gdbarch, l.stack_addr, r.stack_addr);
- frame_debug_printf ("is l=%s inner than r=%s? %d",
- l.to_string ().c_str (), r.to_string ().c_str (),
- inner);
+ frame_debug_printf ("is l=%s inner than r=%s? %d", l.to_string ().c_str (),
+ r.to_string ().c_str (), inner);
return inner;
}
@@ -895,7 +890,7 @@ frame_find_by_id (struct frame_id id)
if (frame)
return frame;
- for (frame = get_current_frame (); ; frame = prev_frame)
+ for (frame = get_current_frame ();; frame = prev_frame)
{
struct frame_id self = get_frame_id (frame);
@@ -978,8 +973,7 @@ frame_unwind_pc (frame_info_ptr this_frame)
this_frame->prev_pc.value = pc;
this_frame->prev_pc.status = CC_VALUE;
- frame_debug_printf ("this_frame=%d -> %s",
- this_frame->level,
+ frame_debug_printf ("this_frame=%d -> %s", this_frame->level,
hex_string (this_frame->prev_pc.value));
}
}
@@ -987,9 +981,9 @@ frame_unwind_pc (frame_info_ptr this_frame)
if (this_frame->prev_pc.status == CC_VALUE)
return this_frame->prev_pc.value;
else if (this_frame->prev_pc.status == CC_UNAVAILABLE)
- throw_error (NOT_AVAILABLE_ERROR, _("PC not available"));
+ throw_error (NOT_AVAILABLE_ERROR, _ ("PC not available"));
else if (this_frame->prev_pc.status == CC_NOT_SAVED)
- throw_error (OPTIMIZED_OUT_ERROR, _("PC not saved"));
+ throw_error (OPTIMIZED_OUT_ERROR, _ ("PC not saved"));
else
internal_error ("unexpected prev_pc status: %d",
(int) this_frame->prev_pc.status);
@@ -1019,7 +1013,8 @@ get_frame_func_if_available (frame_info_ptr this_frame, CORE_ADDR *pc)
/* Make certain that this, and not the adjacent, function is
found. */
- if (!get_frame_address_in_block_if_available (this_frame, &addr_in_block))
+ if (!get_frame_address_in_block_if_available (this_frame,
+ &addr_in_block))
{
next_frame->prev_func.status = CC_UNAVAILABLE;
@@ -1031,8 +1026,7 @@ get_frame_func_if_available (frame_info_ptr this_frame, CORE_ADDR *pc)
next_frame->prev_func.status = CC_VALUE;
next_frame->prev_func.addr = get_pc_function_start (addr_in_block);
- frame_debug_printf ("this_frame=%d -> %s",
- this_frame->level,
+ frame_debug_printf ("this_frame=%d -> %s", this_frame->level,
hex_string (next_frame->prev_func.addr));
}
}
@@ -1057,7 +1051,7 @@ get_frame_func (frame_info_ptr this_frame)
CORE_ADDR pc;
if (!get_frame_func_if_available (this_frame, &pc))
- throw_error (NOT_AVAILABLE_ERROR, _("PC not available"));
+ throw_error (NOT_AVAILABLE_ERROR, _ ("PC not available"));
return pc;
}
@@ -1065,16 +1059,15 @@ get_frame_func (frame_info_ptr this_frame)
std::unique_ptr<readonly_detached_regcache>
frame_save_as_regcache (frame_info_ptr this_frame)
{
- auto cooked_read = [this_frame] (int regnum, gdb_byte *buf)
- {
- if (!deprecated_frame_register_read (this_frame, regnum, buf))
- return REG_UNAVAILABLE;
- else
- return REG_VALID;
- };
+ auto cooked_read = [this_frame] (int regnum, gdb_byte *buf) {
+ if (!deprecated_frame_register_read (this_frame, regnum, buf))
+ return REG_UNAVAILABLE;
+ else
+ return REG_VALID;
+ };
- std::unique_ptr<readonly_detached_regcache> regcache
- (new readonly_detached_regcache (get_frame_arch (this_frame), cooked_read));
+ std::unique_ptr<readonly_detached_regcache> regcache (
+ new readonly_detached_regcache (get_frame_arch (this_frame), cooked_read));
return regcache;
}
@@ -1096,14 +1089,14 @@ frame_pop (frame_info_ptr this_frame)
prev_frame = get_prev_frame_always (this_frame);
if (!prev_frame)
- error (_("Cannot pop the initial frame."));
+ error (_ ("Cannot pop the initial frame."));
/* Ignore TAILCALL_FRAME type frames, they were executed already before
entering THISFRAME. */
prev_frame = skip_tailcall_frames (prev_frame);
if (prev_frame == NULL)
- error (_("Cannot find the caller frame."));
+ error (_ ("Cannot find the caller frame."));
/* Make a copy of all the register values unwound from this frame.
Save them in a scratch buffer so that there isn't a race between
@@ -1129,10 +1122,9 @@ frame_pop (frame_info_ptr this_frame)
}
void
-frame_register_unwind (frame_info_ptr next_frame, int regnum,
- int *optimizedp, int *unavailablep,
- enum lval_type *lvalp, CORE_ADDR *addrp,
- int *realnump, gdb_byte *bufferp)
+frame_register_unwind (frame_info_ptr next_frame, int regnum, int *optimizedp,
+ int *unavailablep, enum lval_type *lvalp,
+ CORE_ADDR *addrp, int *realnump, gdb_byte *bufferp)
{
struct value *value;
@@ -1177,9 +1169,9 @@ frame_register_unwind (frame_info_ptr next_frame, int regnum,
VALUEP is NULL, the registers value is not fetched/computed. */
static void
-frame_register (frame_info_ptr frame, int regnum,
- int *optimizedp, int *unavailablep, enum lval_type *lvalp,
- CORE_ADDR *addrp, int *realnump, gdb_byte *bufferp)
+frame_register (frame_info_ptr frame, int regnum, int *optimizedp,
+ int *unavailablep, enum lval_type *lvalp, CORE_ADDR *addrp,
+ int *realnump, gdb_byte *bufferp)
{
/* Require all but BUFFERP to be valid. A NULL BUFFERP indicates
that the value proper does not need to be fetched. */
@@ -1205,20 +1197,18 @@ frame_unwind_register (frame_info_ptr next_frame, int regnum, gdb_byte *buf)
int realnum;
enum lval_type lval;
- frame_register_unwind (next_frame, regnum, &optimized, &unavailable,
- &lval, &addr, &realnum, buf);
+ frame_register_unwind (next_frame, regnum, &optimized, &unavailable, &lval,
+ &addr, &realnum, buf);
if (optimized)
- throw_error (OPTIMIZED_OUT_ERROR,
- _("Register %d was not saved"), regnum);
+ throw_error (OPTIMIZED_OUT_ERROR, _ ("Register %d was not saved"), regnum);
if (unavailable)
- throw_error (NOT_AVAILABLE_ERROR,
- _("Register %d is not available"), regnum);
+ throw_error (NOT_AVAILABLE_ERROR, _ ("Register %d is not available"),
+ regnum);
}
void
-get_frame_register (frame_info_ptr frame,
- int regnum, gdb_byte *buf)
+get_frame_register (frame_info_ptr frame, int regnum, gdb_byte *buf)
{
frame_unwind_register (frame_info_ptr (frame->next), regnum, buf);
}
@@ -1230,8 +1220,7 @@ frame_unwind_register_value (frame_info_ptr next_frame, int regnum)
gdb_assert (next_frame != NULL);
gdbarch *gdbarch = frame_unwind_arch (next_frame);
- frame_debug_printf ("frame=%d, regnum=%d(%s)",
- next_frame->level, regnum,
+ frame_debug_printf ("frame=%d, regnum=%d(%s)", next_frame->level, regnum,
user_reg_map_regnum_to_name (gdbarch, regnum));
/* Find the unwinder. */
@@ -1239,9 +1228,9 @@ frame_unwind_register_value (frame_info_ptr next_frame, int regnum)
frame_unwind_find_by_frame (next_frame, &next_frame->prologue_cache);
/* Ask this frame to unwind its register. */
- value *value = next_frame->unwind->prev_register (next_frame,
- &next_frame->prologue_cache,
- regnum);
+ value *value
+ = next_frame->unwind->prev_register (next_frame,
+ &next_frame->prologue_cache, regnum);
if (frame_debug)
{
@@ -1256,12 +1245,10 @@ frame_unwind_register_value (frame_info_ptr next_frame, int regnum)
else
{
if (VALUE_LVAL (value) == lval_register)
- gdb_printf (&debug_file, " register=%d",
- VALUE_REGNUM (value));
+ gdb_printf (&debug_file, " register=%d", VALUE_REGNUM (value));
else if (VALUE_LVAL (value) == lval_memory)
gdb_printf (&debug_file, " address=%s",
- paddress (gdbarch,
- value_address (value)));
+ paddress (gdbarch, value_address (value)));
else
gdb_printf (&debug_file, " computed");
@@ -1303,13 +1290,13 @@ frame_unwind_register_signed (frame_info_ptr next_frame, int regnum)
if (value_optimized_out (value))
{
- throw_error (OPTIMIZED_OUT_ERROR,
- _("Register %d was not saved"), regnum);
+ throw_error (OPTIMIZED_OUT_ERROR, _ ("Register %d was not saved"),
+ regnum);
}
if (!value_entirely_available (value))
{
- throw_error (NOT_AVAILABLE_ERROR,
- _("Register %d is not available"), regnum);
+ throw_error (NOT_AVAILABLE_ERROR, _ ("Register %d is not available"),
+ regnum);
}
LONGEST r = extract_signed_integer (value_contents_all (value), byte_order);
@@ -1336,13 +1323,13 @@ frame_unwind_register_unsigned (frame_info_ptr next_frame, int regnum)
if (value_optimized_out (value))
{
- throw_error (OPTIMIZED_OUT_ERROR,
- _("Register %d was not saved"), regnum);
+ throw_error (OPTIMIZED_OUT_ERROR, _ ("Register %d was not saved"),
+ regnum);
}
if (!value_entirely_available (value))
{
- throw_error (NOT_AVAILABLE_ERROR,
- _("Register %d is not available"), regnum);
+ throw_error (NOT_AVAILABLE_ERROR, _ ("Register %d is not available"),
+ regnum);
}
ULONGEST r = extract_unsigned_integer (value_contents_all (value).data (),
@@ -1359,13 +1346,11 @@ get_frame_register_unsigned (frame_info_ptr frame, int regnum)
}
bool
-read_frame_register_unsigned (frame_info_ptr frame, int regnum,
- ULONGEST *val)
+read_frame_register_unsigned (frame_info_ptr frame, int regnum, ULONGEST *val)
{
struct value *regval = get_frame_register_value (frame, regnum);
- if (!value_optimized_out (regval)
- && value_entirely_available (regval))
+ if (!value_optimized_out (regval) && value_entirely_available (regval))
{
struct gdbarch *gdbarch = get_frame_arch (frame);
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
@@ -1380,8 +1365,7 @@ read_frame_register_unsigned (frame_info_ptr frame, int regnum,
}
void
-put_frame_register (frame_info_ptr frame, int regnum,
- const gdb_byte *buf)
+put_frame_register (frame_info_ptr frame, int regnum, const gdb_byte *buf)
{
struct gdbarch *gdbarch = get_frame_arch (frame);
int realnum;
@@ -1390,10 +1374,10 @@ put_frame_register (frame_info_ptr frame, int regnum,
enum lval_type lval;
CORE_ADDR addr;
- frame_register (frame, regnum, &optim, &unavail,
- &lval, &addr, &realnum, NULL);
+ frame_register (frame, regnum, &optim, &unavail, &lval, &addr, &realnum,
+ NULL);
if (optim)
- error (_("Attempt to assign to a register that was not saved."));
+ error (_ ("Attempt to assign to a register that was not saved."));
switch (lval)
{
case lval_memory:
@@ -1405,7 +1389,7 @@ put_frame_register (frame_info_ptr frame, int regnum,
get_current_regcache ()->cooked_write (realnum, buf);
break;
default:
- error (_("Attempt to assign to an unmodifiable value."));
+ error (_ ("Attempt to assign to an unmodifiable value."));
}
}
@@ -1427,17 +1411,16 @@ deprecated_frame_register_read (frame_info_ptr frame, int regnum,
CORE_ADDR addr;
int realnum;
- frame_register (frame, regnum, &optimized, &unavailable,
- &lval, &addr, &realnum, myaddr);
+ frame_register (frame, regnum, &optimized, &unavailable, &lval, &addr,
+ &realnum, myaddr);
return !optimized && !unavailable;
}
bool
-get_frame_register_bytes (frame_info_ptr frame, int regnum,
- CORE_ADDR offset,
- gdb::array_view<gdb_byte> buffer,
- int *optimizedp, int *unavailablep)
+get_frame_register_bytes (frame_info_ptr frame, int regnum, CORE_ADDR offset,
+ gdb::array_view<gdb_byte> buffer, int *optimizedp,
+ int *unavailablep)
{
struct gdbarch *gdbarch = get_frame_arch (frame);
int i;
@@ -1460,14 +1443,15 @@ get_frame_register_bytes (frame_info_ptr frame, int regnum,
int thissize = register_size (gdbarch, i);
if (thissize == 0)
- break; /* This register is not available on this architecture. */
+ break; /* This register is not available on this architecture. */
maxsize += thissize;
}
int len = buffer.size ();
if (len > maxsize)
- error (_("Bad debug information detected: "
- "Attempt to read %d bytes from registers."), len);
+ error (_ ("Bad debug information detected: "
+ "Attempt to read %d bytes from registers."),
+ len);
/* Copy the data. */
while (len > 0)
@@ -1485,8 +1469,8 @@ get_frame_register_bytes (frame_info_ptr frame, int regnum,
CORE_ADDR addr;
int realnum;
- frame_register (frame, regnum, optimizedp, unavailablep,
- &lval, &addr, &realnum, myaddr);
+ frame_register (frame, regnum, optimizedp, unavailablep, &lval,
+ &addr, &realnum, myaddr);
if (*optimizedp || *unavailablep)
return false;
}
@@ -1523,8 +1507,7 @@ get_frame_register_bytes (frame_info_ptr frame, int regnum,
}
void
-put_frame_register_bytes (frame_info_ptr frame, int regnum,
- CORE_ADDR offset,
+put_frame_register_bytes (frame_info_ptr frame, int regnum, CORE_ADDR offset,
gdb::array_view<const gdb_byte> buffer)
{
struct gdbarch *gdbarch = get_frame_arch (frame);
@@ -1627,18 +1610,18 @@ get_current_frame (void)
explicitly checks that ``print $pc'' with no registers prints "No
registers". */
if (!target_has_registers ())
- error (_("No registers."));
+ error (_ ("No registers."));
if (!target_has_stack ())
- error (_("No stack."));
+ error (_ ("No stack."));
if (!target_has_memory ())
- error (_("No memory."));
+ error (_ ("No memory."));
/* Traceframes are effectively a substitute for the live inferior. */
if (get_traceframe_number () < 0)
validate_registers_access ();
if (sentinel_frame == NULL)
- sentinel_frame =
- create_sentinel_frame (current_program_space, get_current_regcache ());
+ sentinel_frame
+ = create_sentinel_frame (current_program_space, get_current_regcache ());
/* Set the current frame before computing the frame id, to avoid
recursion inside compute_frame_id, in case the frame's
@@ -1690,8 +1673,7 @@ static frame_info_ptr selected_frame;
/* See frame.h. */
void
-save_selected_frame (frame_id *frame_id, int *frame_level)
- noexcept
+save_selected_frame (frame_id *frame_id, int *frame_level) noexcept
{
*frame_id = selected_frame_id;
*frame_level = selected_frame_level;
@@ -1700,8 +1682,7 @@ save_selected_frame (frame_id *frame_id, int *frame_level)
/* See frame.h. */
void
-restore_selected_frame (frame_id frame_id, int frame_level)
- noexcept
+restore_selected_frame (frame_id frame_id, int frame_level) noexcept
{
/* Unless it is a user-created frame, save_selected_frame never returns
level == 0, so we shouldn't see it here either. */
@@ -1787,8 +1768,8 @@ lookup_selected_frame (struct frame_id a_frame_id, int frame_level)
/* Warn the user. */
if (frame_level > 0 && !current_uiout->is_mi_like_p ())
{
- warning (_("Couldn't restore frame #%d in "
- "current thread. Bottom (innermost) frame selected:"),
+ warning (_ ("Couldn't restore frame #%d in "
+ "current thread. Bottom (innermost) frame selected:"),
frame_level);
/* For MI, we should probably have a notification about current
frame change. But this error is not very likely, so don't
@@ -1963,8 +1944,8 @@ create_new_frame (frame_id id)
frame_info *fi = FRAME_OBSTACK_ZALLOC (struct frame_info);
- fi->next = create_sentinel_frame (current_program_space,
- get_current_regcache ());
+ fi->next
+ = create_sentinel_frame (current_program_space, get_current_regcache ());
/* Set/update this frame's cached PC value, found in the next frame.
Do this before looking for this frame's unwinder. A sniffer is
@@ -2064,7 +2045,7 @@ reinit_frame_cache (void)
if (sentinel_frame != NULL)
annotate_frames_invalid ();
- sentinel_frame = NULL; /* Invalidate cache */
+ sentinel_frame = NULL; /* Invalidate cache */
invalidate_selected_frame ();
frame_stash_invalidate ();
@@ -2169,8 +2150,7 @@ get_prev_frame_maybe_check_cycle (frame_info_ptr this_frame)
COMPUTING. */
gdb_assert (cycle_detection_p
|| (this_frame->level > 0
- && (this_frame->this_id.p
- == frame_id_status::COMPUTING))
+ && (this_frame->this_id.p == frame_id_status::COMPUTING))
|| (this_frame->level == 0
&& (this_frame->this_id.p
!= frame_id_status::COMPUTED)));
@@ -2234,9 +2214,9 @@ get_prev_frame_always_1 (frame_info_ptr this_frame)
frame_debug_printf (" -> %s // cached",
this_frame->prev->to_string ().c_str ());
else
- frame_debug_printf
- (" -> nullptr // %s // cached",
- frame_stop_reason_symbol_string (this_frame->stop_reason));
+ frame_debug_printf (
+ " -> nullptr // %s // cached",
+ frame_stop_reason_symbol_string (this_frame->stop_reason));
return frame_info_ptr (this_frame->prev);
}
@@ -2283,9 +2263,9 @@ get_prev_frame_always_1 (frame_info_ptr this_frame)
if (this_frame->stop_reason != UNWIND_NO_REASON)
{
- frame_debug_printf
- (" -> nullptr // %s",
- frame_stop_reason_symbol_string (this_frame->stop_reason));
+ frame_debug_printf (
+ " -> nullptr // %s",
+ frame_stop_reason_symbol_string (this_frame->stop_reason));
return NULL;
}
@@ -2330,22 +2310,21 @@ get_prev_frame_always_1 (frame_info_ptr this_frame)
to have the frame prev_pc method and the gdbarch unwind_pc
method set the same lval and location information as
frame_register_unwind. */
- if (this_frame->level > 0
- && gdbarch_pc_regnum (gdbarch) >= 0
+ if (this_frame->level > 0 && gdbarch_pc_regnum (gdbarch) >= 0
&& get_frame_type (this_frame) == NORMAL_FRAME
&& (get_frame_type (frame_info_ptr (this_frame->next)) == NORMAL_FRAME
- || get_frame_type (frame_info_ptr (this_frame->next)) == INLINE_FRAME))
+ || get_frame_type (frame_info_ptr (this_frame->next))
+ == INLINE_FRAME))
{
int optimized, realnum, nrealnum;
enum lval_type lval, nlval;
CORE_ADDR addr, naddr;
- frame_register_unwind_location (this_frame,
- gdbarch_pc_regnum (gdbarch),
+ frame_register_unwind_location (this_frame, gdbarch_pc_regnum (gdbarch),
&optimized, &lval, &addr, &realnum);
frame_register_unwind_location (get_next_frame (this_frame),
- gdbarch_pc_regnum (gdbarch),
- &optimized, &nlval, &naddr, &nrealnum);
+ gdbarch_pc_regnum (gdbarch), &optimized,
+ &nlval, &naddr, &nrealnum);
if ((lval == lval_memory && lval == nlval && addr == naddr)
|| (lval == lval_register && lval == nlval && realnum == nrealnum))
@@ -2460,8 +2439,7 @@ get_prev_frame_raw (frame_info_ptr this_frame)
/* Debug routine to print a NULL frame being returned. */
static void
-frame_debug_got_null_frame (frame_info_ptr this_frame,
- const char *reason)
+frame_debug_got_null_frame (frame_info_ptr this_frame, const char *reason)
{
if (frame_debug)
{
@@ -2503,8 +2481,10 @@ inside_main_func (frame_info_ptr this_frame)
/* Convert any function descriptor addresses into the actual function
code address. */
- sym_addr = gdbarch_convert_from_func_ptr_addr
- (get_frame_arch (this_frame), sym_addr, current_inferior ()->top_target ());
+ sym_addr
+ = gdbarch_convert_from_func_ptr_addr (get_frame_arch (this_frame),
+ sym_addr,
+ current_inferior ()->top_target ());
return sym_addr == get_frame_func (this_frame);
}
@@ -2556,10 +2536,8 @@ get_prev_frame (frame_info_ptr this_frame)
the inferior was when the user function was called. If gdb was inside
the main function when we created the dummy frame, the dummy frame will
point inside the main function. */
- if (this_frame->level >= 0
- && get_frame_type (this_frame) == NORMAL_FRAME
- && !user_set_backtrace_options.backtrace_past_main
- && frame_pc_p
+ if (this_frame->level >= 0 && get_frame_type (this_frame) == NORMAL_FRAME
+ && !user_set_backtrace_options.backtrace_past_main && frame_pc_p
&& inside_main_func (this_frame))
/* Don't unwind past main(). Note, this is done _before_ the
frame has been marked as previously unwound. That way if the
@@ -2603,10 +2581,8 @@ get_prev_frame (frame_info_ptr this_frame)
from main returns directly to the caller of main. Since we don't
stop at main, we should at least stop at the entry point of the
application. */
- if (this_frame->level >= 0
- && get_frame_type (this_frame) == NORMAL_FRAME
- && !user_set_backtrace_options.backtrace_past_entry
- && frame_pc_p
+ if (this_frame->level >= 0 && get_frame_type (this_frame) == NORMAL_FRAME
+ && !user_set_backtrace_options.backtrace_past_entry && frame_pc_p
&& inside_entry_func (this_frame))
{
frame_debug_got_null_frame (this_frame, "inside entry func");
@@ -2639,7 +2615,6 @@ get_frame_pc (frame_info_ptr frame)
bool
get_frame_pc_if_available (frame_info_ptr frame, CORE_ADDR *pc)
{
-
gdb_assert (frame->next != NULL);
try
@@ -2723,7 +2698,6 @@ bool
get_frame_address_in_block_if_available (frame_info_ptr this_frame,
CORE_ADDR *pc)
{
-
try
{
*pc = get_frame_address_in_block (this_frame);
@@ -2915,8 +2889,7 @@ get_frame_memory (frame_info_ptr this_frame, CORE_ADDR addr,
}
LONGEST
-get_frame_memory_signed (frame_info_ptr this_frame, CORE_ADDR addr,
- int len)
+get_frame_memory_signed (frame_info_ptr this_frame, CORE_ADDR addr, int len)
{
struct gdbarch *gdbarch = get_frame_arch (this_frame);
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
@@ -2925,8 +2898,7 @@ get_frame_memory_signed (frame_info_ptr this_frame, CORE_ADDR addr,
}
ULONGEST
-get_frame_memory_unsigned (frame_info_ptr this_frame, CORE_ADDR addr,
- int len)
+get_frame_memory_unsigned (frame_info_ptr this_frame, CORE_ADDR addr, int len)
{
struct gdbarch *gdbarch = get_frame_arch (this_frame);
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
@@ -2935,8 +2907,8 @@ get_frame_memory_unsigned (frame_info_ptr this_frame, CORE_ADDR addr,
}
bool
-safe_frame_unwind_memory (frame_info_ptr this_frame,
- CORE_ADDR addr, gdb::array_view<gdb_byte> buffer)
+safe_frame_unwind_memory (frame_info_ptr this_frame, CORE_ADDR addr,
+ gdb::array_view<gdb_byte> buffer)
{
/* NOTE: target_read_memory returns zero on success! */
return target_read_memory (addr, buffer.data (), buffer.size ()) == 0;
@@ -2968,8 +2940,7 @@ frame_unwind_arch (frame_info_ptr next_frame)
next_frame->prev_arch.arch = arch;
next_frame->prev_arch.p = true;
- frame_debug_printf ("next_frame=%d -> %s",
- next_frame->level,
+ frame_debug_printf ("next_frame=%d -> %s", next_frame->level,
gdbarch_bfd_arch_info (arch)->printable_name);
}
@@ -2997,9 +2968,9 @@ get_frame_language (frame_info_ptr frame)
CORE_ADDR pc = 0;
bool pc_p = false;
- gdb_assert (frame!= NULL);
+ gdb_assert (frame != NULL);
- /* We determine the current frame language by looking up its
+ /* We determine the current frame language by looking up its
associated symtab. To retrieve this symtab, we use the frame
PC. However we cannot use the frame PC as is, because it
usually points to the instruction following the "call", which
@@ -3062,7 +3033,8 @@ unwind_stop_reason_to_string (enum unwind_stop_reason reason)
switch (reason)
{
#define SET(name, description) \
- case name: return _(description);
+ case name: \
+ return _ (description);
#include "unwind_stop_reasons.def"
#undef SET
@@ -3094,7 +3066,8 @@ frame_stop_reason_symbol_string (enum unwind_stop_reason reason)
switch (reason)
{
#define SET(name, description) \
- case name: return #name;
+ case name: \
+ return #name;
#include "unwind_stop_reasons.def"
#undef SET
@@ -3159,9 +3132,10 @@ const gdb::option::option_def set_backtrace_option_defs[] = {
"past-main",
[] (set_backtrace_options *opt) { return &opt->backtrace_past_main; },
show_backtrace_past_main, /* show_cmd_cb */
- N_("Set whether backtraces should continue past \"main\"."),
- N_("Show whether backtraces should continue past \"main\"."),
- N_("Normally the caller of \"main\" is not of interest, so GDB will terminate\n\
+ N_ ("Set whether backtraces should continue past \"main\"."),
+ N_ ("Show whether backtraces should continue past \"main\"."),
+ N_ (
+ "Normally the caller of \"main\" is not of interest, so GDB will terminate\n\
the backtrace at \"main\". Set this if you need to see the rest\n\
of the stack trace."),
},
@@ -3170,9 +3144,12 @@ of the stack trace."),
"past-entry",
[] (set_backtrace_options *opt) { return &opt->backtrace_past_entry; },
show_backtrace_past_entry, /* show_cmd_cb */
- N_("Set whether backtraces should continue past the entry point of a program."),
- N_("Show whether backtraces should continue past the entry point of a program."),
- N_("Normally there are no callers beyond the entry point of a program, so GDB\n\
+ N_ ("Set whether backtraces should continue past the entry point of a "
+ "program."),
+ N_ ("Show whether backtraces should continue past the entry point of a "
+ "program."),
+ N_ (
+ "Normally there are no callers beyond the entry point of a program, so GDB\n\
will terminate the backtrace there. Set this if you need to see\n\
the rest of the stack trace."),
},
@@ -3197,8 +3174,7 @@ maintenance_print_frame_id (const char *args, int from_tty)
/* Print the frame-id. */
gdb_assert (frame != nullptr);
- gdb_printf ("frame-id for frame #%d: %s\n",
- frame_relative_level (frame),
+ gdb_printf ("frame-id for frame #%d: %s\n", frame_relative_level (frame),
get_frame_id (frame).to_string ().c_str ());
}
@@ -3259,6 +3235,7 @@ frame_info_ptr::reinflate () const
}
void _initialize_frame ();
+
void
_initialize_frame ()
{
@@ -3269,41 +3246,42 @@ _initialize_frame ()
gdb::observers::target_changed.attach (frame_observer_target_changed,
"frame");
- add_setshow_prefix_cmd ("backtrace", class_maintenance,
- _("\
+ add_setshow_prefix_cmd ("backtrace", class_maintenance, _ ("\
Set backtrace specific variables.\n\
Configure backtrace variables such as the backtrace limit"),
- _("\
+ _ ("\
Show backtrace specific variables.\n\
Show backtrace variables such as the backtrace limit."),
&set_backtrace_cmdlist, &show_backtrace_cmdlist,
&setlist, &showlist);
add_setshow_uinteger_cmd ("limit", class_obscure,
- &user_set_backtrace_options.backtrace_limit, _("\
-Set an upper bound on the number of backtrace levels."), _("\
-Show the upper bound on the number of backtrace levels."), _("\
+ &user_set_backtrace_options.backtrace_limit, _ ("\
+Set an upper bound on the number of backtrace levels."),
+ _ ("\
+Show the upper bound on the number of backtrace levels."),
+ _ ("\
No more than the specified number of frames can be displayed or examined.\n\
Literal \"unlimited\" or zero means no limit."),
- NULL,
- show_backtrace_limit,
- &set_backtrace_cmdlist,
+ NULL, show_backtrace_limit, &set_backtrace_cmdlist,
&show_backtrace_cmdlist);
- gdb::option::add_setshow_cmds_for_options
- (class_stack, &user_set_backtrace_options,
- set_backtrace_option_defs, &set_backtrace_cmdlist, &show_backtrace_cmdlist);
+ gdb::option::add_setshow_cmds_for_options (class_stack,
+ &user_set_backtrace_options,
+ set_backtrace_option_defs,
+ &set_backtrace_cmdlist,
+ &show_backtrace_cmdlist);
/* Debug this files internals. */
- add_setshow_boolean_cmd ("frame", class_maintenance, &frame_debug, _("\
-Set frame debugging."), _("\
-Show frame debugging."), _("\
+ add_setshow_boolean_cmd ("frame", class_maintenance, &frame_debug, _ ("\
+Set frame debugging."),
+ _ ("\
+Show frame debugging."),
+ _ ("\
When non-zero, frame specific internal debugging is enabled."),
- NULL,
- show_frame_debug,
- &setdebuglist, &showdebuglist);
+ NULL, show_frame_debug, &setdebuglist,
+ &showdebuglist);
add_cmd ("frame-id", class_maintenance, maintenance_print_frame_id,
- _("Print the current frame-id."),
- &maintenanceprintlist);
+ _ ("Print the current frame-id."), &maintenanceprintlist);
}
diff --git a/gdb/frame.h b/gdb/frame.h
index c4f7c121391..70643fdb5e1 100644
--- a/gdb/frame.h
+++ b/gdb/frame.h
@@ -17,7 +17,7 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
-#if !defined (FRAME_H)
+#if !defined(FRAME_H)
#define FRAME_H 1
/* The following is the intended naming schema for frame functions.
@@ -85,12 +85,12 @@ struct frame_print_options;
/* The frame object. */
-
/* Save and restore the currently selected frame. */
class scoped_restore_selected_frame
{
public:
+
/* Save the currently selected frame. */
scoped_restore_selected_frame ();
@@ -151,8 +151,8 @@ extern struct frame_id frame_id_build_unavailable_stack (CORE_ADDR code_addr);
address (typically the entry point). SPECIAL_ADDR is the special
identifier address. */
extern struct frame_id
- frame_id_build_unavailable_stack_special (CORE_ADDR code_addr,
- CORE_ADDR special_addr);
+frame_id_build_unavailable_stack_special (CORE_ADDR code_addr,
+ CORE_ADDR special_addr);
/* Construct a wild card frame ID. The parameter is the frame's constant
stack address (typically the outer-bound). The code address as well
@@ -205,19 +205,14 @@ enum frame_type
class frame_info_ptr : public intrusive_list_node<frame_info_ptr>
{
public:
+
/* Create a frame_info_ptr from a raw pointer. */
explicit frame_info_ptr (struct frame_info *ptr);
/* Create a null frame_info_ptr. */
- frame_info_ptr ()
- {
- frame_list.push_back (*this);
- }
+ frame_info_ptr () { frame_list.push_back (*this); }
- frame_info_ptr (std::nullptr_t)
- {
- frame_list.push_back (*this);
- }
+ frame_info_ptr (std::nullptr_t) { frame_list.push_back (*this); }
frame_info_ptr (const frame_info_ptr &other)
: m_ptr (other.m_ptr),
@@ -274,8 +269,7 @@ public:
return *this;
}
- frame_info *operator-> () const
- { return this->reinflate (); }
+ frame_info *operator->() const { return this->reinflate (); }
/* Fetch the underlying pointer. Note that new code should
generally not use this -- avoid it if at all possible. */
@@ -290,32 +284,21 @@ public:
/* Return true if this object is empty (does not wrap a frame_info
object). */
- bool is_null () const
- {
- return m_cached_level == this->invalid_level;
- };
+ bool is_null () const { return m_cached_level == this->invalid_level; };
/* This exists for compatibility with pre-existing code that checked
a "frame_info *" using "!". */
- bool operator! () const
- {
- return this->is_null ();
- }
+ bool operator!() const { return this->is_null (); }
/* This exists for compatibility with pre-existing code that checked
a "frame_info *" like "if (ptr)". */
- explicit operator bool () const
- {
- return !this->is_null ();
- }
+ explicit operator bool () const { return !this->is_null (); }
/* Invalidate this pointer. */
- void invalidate ()
- {
- m_ptr = nullptr;
- }
+ void invalidate () { m_ptr = nullptr; }
private:
+
/* We sometimes need to construct frame_info_ptr objects around the
sentinel_frame, which has level -1. Therefore, make the invalid frame
level value -2. */
@@ -447,8 +430,8 @@ extern void select_frame (frame_info_ptr);
get_selected_frame directly because this function does not create
the selected-frame's frame_info object if it hasn't been created
yet, and thus is more efficient and doesn't throw. */
-extern void save_selected_frame (frame_id *frame_id, int *frame_level)
- noexcept;
+extern void save_selected_frame (frame_id *frame_id,
+ int *frame_level) noexcept;
/* Restore selected frame as saved with save_selected_frame.
@@ -458,8 +441,8 @@ extern void save_selected_frame (frame_id *frame_id, int *frame_level)
This function does not throw. It is designed to be safe to called
from the destructors of RAII types. */
-extern void restore_selected_frame (frame_id frame_id, int frame_level)
- noexcept;
+extern void restore_selected_frame (frame_id frame_id,
+ int frame_level) noexcept;
/* Given a FRAME, return the next (more inner, younger) or previous
(more outer, older) frame. */
@@ -631,7 +614,8 @@ extern const address_space *get_frame_address_space (frame_info_ptr);
/* For frames where we can not unwind further, describe why. */
enum unwind_stop_reason
- {
+{
+
#define SET(name, description) name,
#define FIRST_ENTRY(name) UNWIND_FIRST = name,
#define LAST_ENTRY(name) UNWIND_LAST = name,
@@ -642,7 +626,7 @@ enum unwind_stop_reason
#undef FIRST_ENTRY
#undef LAST_ENTRY
#undef FIRST_ERROR
- };
+};
/* Return the reason why we can't unwind past this frame. */
@@ -671,9 +655,8 @@ const char *frame_stop_reason_string (frame_info_ptr);
value. */
extern void frame_register_unwind (frame_info_ptr frame, int regnum,
int *optimizedp, int *unavailablep,
- enum lval_type *lvalp,
- CORE_ADDR *addrp, int *realnump,
- gdb_byte *valuep);
+ enum lval_type *lvalp, CORE_ADDR *addrp,
+ int *realnump, gdb_byte *valuep);
/* Fetch a register from this, or unwind a register from the next
frame. Note that the get_frame methods are wrappers to
@@ -681,32 +664,29 @@ extern void frame_register_unwind (frame_info_ptr frame, int regnum,
fetch fails. The value methods never return NULL, but usually
do return a lazy value. */
-extern void frame_unwind_register (frame_info_ptr next_frame,
- int regnum, gdb_byte *buf);
-extern void get_frame_register (frame_info_ptr frame,
- int regnum, gdb_byte *buf);
+extern void frame_unwind_register (frame_info_ptr next_frame, int regnum,
+ gdb_byte *buf);
+extern void get_frame_register (frame_info_ptr frame, int regnum,
+ gdb_byte *buf);
struct value *frame_unwind_register_value (frame_info_ptr next_frame,
int regnum);
-struct value *get_frame_register_value (frame_info_ptr frame,
- int regnum);
+struct value *get_frame_register_value (frame_info_ptr frame, int regnum);
extern LONGEST frame_unwind_register_signed (frame_info_ptr next_frame,
int regnum);
-extern LONGEST get_frame_register_signed (frame_info_ptr frame,
- int regnum);
+extern LONGEST get_frame_register_signed (frame_info_ptr frame, int regnum);
extern ULONGEST frame_unwind_register_unsigned (frame_info_ptr frame,
int regnum);
-extern ULONGEST get_frame_register_unsigned (frame_info_ptr frame,
- int regnum);
+extern ULONGEST get_frame_register_unsigned (frame_info_ptr frame, int regnum);
/* Read a register from this, or unwind a register from the next
frame. Note that the read_frame methods are wrappers to
get_frame_register_value, that do not throw if the result is
optimized out or unavailable. */
-extern bool read_frame_register_unsigned (frame_info_ptr frame,
- int regnum, ULONGEST *val);
+extern bool read_frame_register_unsigned (frame_info_ptr frame, int regnum,
+ ULONGEST *val);
/* The reverse. Store a register value relative to the specified
frame. Note: this call makes the frame's state undefined. The
@@ -761,7 +741,8 @@ extern ULONGEST get_frame_memory_unsigned (frame_info_ptr this_frame,
/* Same as above, but return true zero when the entire memory read
succeeds, false otherwise. */
-extern bool safe_frame_unwind_memory (frame_info_ptr this_frame, CORE_ADDR addr,
+extern bool safe_frame_unwind_memory (frame_info_ptr this_frame,
+ CORE_ADDR addr,
gdb::array_view<gdb_byte> buffer);
/* Return this frame's architecture. */
@@ -773,7 +754,6 @@ extern struct gdbarch *frame_unwind_arch (frame_info_ptr next_frame);
/* Return the previous frame's architecture, skipping inline functions. */
extern struct gdbarch *frame_unwind_caller_arch (frame_info_ptr frame);
-
/* Values for the source flag to be used in print_frame_info ().
For all the cases below, the address is never printed if
'set print address' is off. When 'set print address' is on,
@@ -781,22 +761,22 @@ extern struct gdbarch *frame_unwind_caller_arch (frame_info_ptr frame);
beginning of the source line of the frame
and PRINT_WHAT is != LOC_AND_ADDRESS. */
enum print_what
- {
- /* Print only the address, source line, like in stepi. */
- SRC_LINE = -1,
- /* Print only the location, i.e. level, address,
+{
+ /* Print only the address, source line, like in stepi. */
+ SRC_LINE = -1,
+ /* Print only the location, i.e. level, address,
function, args (as controlled by 'set print frame-arguments'),
file, line, line num. */
- LOCATION,
- /* Print both of the above. */
- SRC_AND_LOC,
- /* Print location only, print the address even if the program counter
+ LOCATION,
+ /* Print both of the above. */
+ SRC_AND_LOC,
+ /* Print location only, print the address even if the program counter
is at the beginning of the source line. */
- LOC_AND_ADDRESS,
- /* Print only level and function,
+ LOC_AND_ADDRESS,
+ /* Print only level and function,
i.e. location only, without address, file, line, line num. */
- SHORT_LOCATION
- };
+ SHORT_LOCATION
+};
/* Allocate zero initialized memory from the frame cache obstack.
Appendices to the frame info (such as the unwind cache) should
@@ -805,13 +785,13 @@ enum print_what
extern void *frame_obstack_zalloc (unsigned long size);
#define FRAME_OBSTACK_ZALLOC(TYPE) \
((TYPE *) frame_obstack_zalloc (sizeof (TYPE)))
-#define FRAME_OBSTACK_CALLOC(NUMBER,TYPE) \
+#define FRAME_OBSTACK_CALLOC(NUMBER, TYPE) \
((TYPE *) frame_obstack_zalloc ((NUMBER) * sizeof (TYPE)))
class readonly_detached_regcache;
/* Create a regcache, and copy the frame's registers into it. */
-std::unique_ptr<readonly_detached_regcache> frame_save_as_regcache
- (frame_info_ptr this_frame);
+std::unique_ptr<readonly_detached_regcache>
+frame_save_as_regcache (frame_info_ptr this_frame);
extern const struct block *get_frame_block (frame_info_ptr,
CORE_ADDR *addr_in_block);
@@ -853,8 +833,8 @@ extern frame_info_ptr find_relative_frame (frame_info_ptr, int *);
/* Wrapper over print_stack_frame modifying current_uiout with UIOUT for
the function call. */
-extern void print_stack_frame_to_uiout (struct ui_out *uiout,
- frame_info_ptr, int print_level,
+extern void print_stack_frame_to_uiout (struct ui_out *uiout, frame_info_ptr,
+ int print_level,
enum print_what print_what,
int set_current_sal);
@@ -940,9 +920,8 @@ struct frame_arg
const char *entry_kind = nullptr;
};
-extern void read_frame_arg (const frame_print_options &fp_opts,
- symbol *sym, frame_info_ptr frame,
- struct frame_arg *argp,
+extern void read_frame_arg (const frame_print_options &fp_opts, symbol *sym,
+ frame_info_ptr frame, struct frame_arg *argp,
struct frame_arg *entryargp);
extern void read_frame_local (struct symbol *sym, frame_info_ptr frame,
struct frame_arg *argp);
@@ -1004,7 +983,8 @@ extern frame_info_ptr create_new_frame (CORE_ADDR base, CORE_ADDR pc);
/* Return true if the frame unwinder for frame FI is UNWINDER; false
otherwise. */
-extern bool frame_unwinder_is (frame_info_ptr fi, const frame_unwind *unwinder);
+extern bool frame_unwinder_is (frame_info_ptr fi,
+ const frame_unwind *unwinder);
/* Return the language of FRAME. */
@@ -1057,5 +1037,4 @@ extern void set_frame_previous_pc_masked (frame_info_ptr frame);
extern bool get_frame_pc_masked (frame_info_ptr frame);
-
#endif /* !defined (FRAME_H) */
diff --git a/gdb/frv-linux-tdep.c b/gdb/frv-linux-tdep.c
index c9cfb6f4c57..07911539058 100644
--- a/gdb/frv-linux-tdep.c
+++ b/gdb/frv-linux-tdep.c
@@ -36,7 +36,8 @@
/* Define the size (in bytes) of an FR-V instruction. */
static const int frv_instr_size = 4;
-enum {
+enum
+{
NORMAL_SIGTRAMP = 1,
RT_SIGTRAMP = 2
};
@@ -55,9 +56,9 @@ frv_linux_pc_in_sigtramp (struct gdbarch *gdbarch, CORE_ADDR pc,
instr = extract_unsigned_integer (buf, sizeof buf, byte_order);
- if (instr == 0x8efc0077) /* setlos #__NR_sigreturn, gr7 */
+ if (instr == 0x8efc0077) /* setlos #__NR_sigreturn, gr7 */
retval = NORMAL_SIGTRAMP;
- else if (instr == 0x8efc00ad) /* setlos #__NR_rt_sigreturn, gr7 */
+ else if (instr == 0x8efc00ad) /* setlos #__NR_rt_sigreturn, gr7 */
retval = RT_SIGTRAMP;
else
return 0;
@@ -65,7 +66,7 @@ frv_linux_pc_in_sigtramp (struct gdbarch *gdbarch, CORE_ADDR pc,
if (target_read_memory (pc + frv_instr_size, buf, sizeof buf) != 0)
return 0;
instr = extract_unsigned_integer (buf, sizeof buf, byte_order);
- if (instr != 0xc0700000) /* tira gr0, 0 */
+ if (instr != 0xc0700000) /* tira gr0, 0 */
return 0;
/* If we get this far, we'll return a non-zero value, either
@@ -208,14 +209,14 @@ frv_linux_sigcontext_reg_addr (frame_info_ptr this_frame, int regno,
padding) = 24.) */
if (target_read_memory (sp + 12, buf, sizeof buf) != 0)
{
- warning (_("Can't read realtime sigtramp frame."));
+ warning (_ ("Can't read realtime sigtramp frame."));
return 0;
}
sc_addr = extract_unsigned_integer (buf, sizeof buf, byte_order);
sc_addr += 24;
}
else
- internal_error (_("not a signal trampoline"));
+ internal_error (_ ("not a signal trampoline"));
if (sc_addr_cache_ptr)
*sc_addr_cache_ptr = sc_addr;
@@ -223,43 +224,42 @@ frv_linux_sigcontext_reg_addr (frame_info_ptr this_frame, int regno,
switch (regno)
{
- case psr_regnum :
+ case psr_regnum:
return sc_addr + 0;
/* sc_addr + 4 has "isr", the Integer Status Register. */
- case ccr_regnum :
+ case ccr_regnum:
return sc_addr + 8;
- case cccr_regnum :
+ case cccr_regnum:
return sc_addr + 12;
- case lr_regnum :
+ case lr_regnum:
return sc_addr + 16;
- case lcr_regnum :
+ case lcr_regnum:
return sc_addr + 20;
- case pc_regnum :
+ case pc_regnum:
return sc_addr + 24;
/* sc_addr + 28 is __status, the exception status.
sc_addr + 32 is syscallno, the syscall number or -1.
sc_addr + 36 is orig_gr8, the original syscall arg #1.
sc_addr + 40 is gner[0].
sc_addr + 44 is gner[1]. */
- case iacc0h_regnum :
+ case iacc0h_regnum:
return sc_addr + 48;
- case iacc0l_regnum :
+ case iacc0l_regnum:
return sc_addr + 52;
- default :
+ default:
if (first_gpr_regnum <= regno && regno <= last_gpr_regnum)
return sc_addr + 56 + 4 * (regno - first_gpr_regnum);
else if (first_fpr_regnum <= regno && regno <= last_fpr_regnum)
return sc_addr + 312 + 4 * (regno - first_fpr_regnum);
else
- return -1; /* not saved. */
+ return -1; /* not saved. */
}
}
/* Signal trampolines. */
static struct trad_frame_cache *
-frv_linux_sigtramp_frame_cache (frame_info_ptr this_frame,
- void **this_cache)
+frv_linux_sigtramp_frame_cache (frame_info_ptr this_frame, void **this_cache)
{
struct gdbarch *gdbarch = get_frame_arch (this_frame);
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
@@ -297,8 +297,7 @@ frv_linux_sigtramp_frame_cache (frame_info_ptr this_frame,
}
static void
-frv_linux_sigtramp_frame_this_id (frame_info_ptr this_frame,
- void **this_cache,
+frv_linux_sigtramp_frame_this_id (frame_info_ptr this_frame, void **this_cache,
struct frame_id *this_id)
{
struct trad_frame_cache *cache
@@ -318,8 +317,7 @@ frv_linux_sigtramp_frame_prev_register (frame_info_ptr this_frame,
static int
frv_linux_sigtramp_frame_sniffer (const struct frame_unwind *self,
- frame_info_ptr this_frame,
- void **this_cache)
+ frame_info_ptr this_frame, void **this_cache)
{
struct gdbarch *gdbarch = get_frame_arch (this_frame);
CORE_ADDR pc = get_frame_pc (this_frame);
@@ -332,24 +330,27 @@ frv_linux_sigtramp_frame_sniffer (const struct frame_unwind *self,
return 0;
}
-static const struct frame_unwind frv_linux_sigtramp_frame_unwind =
-{
- "frv linux sigtramp",
- SIGTRAMP_FRAME,
- default_frame_unwind_stop_reason,
- frv_linux_sigtramp_frame_this_id,
- frv_linux_sigtramp_frame_prev_register,
- NULL,
- frv_linux_sigtramp_frame_sniffer
-};
-
+static const struct frame_unwind frv_linux_sigtramp_frame_unwind
+ = { "frv linux sigtramp",
+ SIGTRAMP_FRAME,
+ default_frame_unwind_stop_reason,
+ frv_linux_sigtramp_frame_this_id,
+ frv_linux_sigtramp_frame_prev_register,
+ NULL,
+ frv_linux_sigtramp_frame_sniffer };
+
/* The FRV kernel defines ELF_NGREG as 46. We add 2 in order to include
the loadmap addresses in the register set. (See below for more info.) */
#define FRV_ELF_NGREG (46 + 2)
typedef unsigned char frv_elf_greg_t[4];
-typedef struct { frv_elf_greg_t reg[FRV_ELF_NGREG]; } frv_elf_gregset_t;
+
+typedef struct
+{
+ frv_elf_greg_t reg[FRV_ELF_NGREG];
+} frv_elf_gregset_t;
typedef unsigned char frv_elf_fpreg_t[4];
+
typedef struct
{
frv_elf_fpreg_t fr[64];
@@ -362,25 +363,24 @@ typedef struct
/* Register maps. */
-static const struct regcache_map_entry frv_linux_gregmap[] =
- {
- { 1, psr_regnum, 4 },
- { 1, REGCACHE_MAP_SKIP, 4 }, /* isr */
- { 1, ccr_regnum, 4 },
- { 1, cccr_regnum, 4 },
- { 1, lr_regnum, 4 },
- { 1, lcr_regnum, 4 },
- { 1, pc_regnum, 4 },
- { 1, REGCACHE_MAP_SKIP, 4 }, /* __status */
- { 1, REGCACHE_MAP_SKIP, 4 }, /* syscallno */
- { 1, REGCACHE_MAP_SKIP, 4 }, /* orig_gr8 */
- { 1, gner0_regnum, 4 },
- { 1, gner1_regnum, 4 },
- { 1, REGCACHE_MAP_SKIP, 8 }, /* iacc0 */
- { 1, tbr_regnum, 4 },
- { 31, first_gpr_regnum + 1, 4 }, /* gr1 ... gr31 */
-
- /* Technically, the loadmap addresses are not part of `pr_reg' as
+static const struct regcache_map_entry frv_linux_gregmap[]
+ = { { 1, psr_regnum, 4 },
+ { 1, REGCACHE_MAP_SKIP, 4 }, /* isr */
+ { 1, ccr_regnum, 4 },
+ { 1, cccr_regnum, 4 },
+ { 1, lr_regnum, 4 },
+ { 1, lcr_regnum, 4 },
+ { 1, pc_regnum, 4 },
+ { 1, REGCACHE_MAP_SKIP, 4 }, /* __status */
+ { 1, REGCACHE_MAP_SKIP, 4 }, /* syscallno */
+ { 1, REGCACHE_MAP_SKIP, 4 }, /* orig_gr8 */
+ { 1, gner0_regnum, 4 },
+ { 1, gner1_regnum, 4 },
+ { 1, REGCACHE_MAP_SKIP, 8 }, /* iacc0 */
+ { 1, tbr_regnum, 4 },
+ { 31, first_gpr_regnum + 1, 4 }, /* gr1 ... gr31 */
+
+ /* Technically, the loadmap addresses are not part of `pr_reg' as
found in the elf_prstatus struct. The fields which communicate
the loadmap address appear (by design) immediately after
`pr_reg' though, and the BFD function elf32_frv_grok_prstatus()
@@ -388,31 +388,24 @@ static const struct regcache_map_entry frv_linux_gregmap[] =
section that it extracts from the core file. So, for our
purposes, they may be viewed as registers. */
- { 1, fdpic_loadmap_exec_regnum, 4 },
- { 1, fdpic_loadmap_interp_regnum, 4 },
- { 0 }
- };
-
-static const struct regcache_map_entry frv_linux_fpregmap[] =
- {
- { 64, first_fpr_regnum, 4 }, /* fr0 ... fr63 */
- { 1, fner0_regnum, 4 },
- { 1, fner1_regnum, 4 },
- { 1, msr0_regnum, 4 },
- { 1, msr1_regnum, 4 },
- { 8, acc0_regnum, 4 }, /* acc0 ... acc7 */
- { 1, accg0123_regnum, 4 },
- { 1, accg4567_regnum, 4 },
- { 1, fsr0_regnum, 4 },
- { 0 }
- };
+ { 1, fdpic_loadmap_exec_regnum, 4 },
+ { 1, fdpic_loadmap_interp_regnum, 4 },
+ { 0 } };
+
+static const struct regcache_map_entry frv_linux_fpregmap[]
+ = { { 64, first_fpr_regnum, 4 }, /* fr0 ... fr63 */
+ { 1, fner0_regnum, 4 }, { 1, fner1_regnum, 4 },
+ { 1, msr0_regnum, 4 }, { 1, msr1_regnum, 4 },
+ { 8, acc0_regnum, 4 }, /* acc0 ... acc7 */
+ { 1, accg0123_regnum, 4 }, { 1, accg4567_regnum, 4 },
+ { 1, fsr0_regnum, 4 }, { 0 } };
/* Unpack an frv_elf_gregset_t into GDB's register cache. */
-static void
+static void
frv_linux_supply_gregset (const struct regset *regset,
- struct regcache *regcache,
- int regnum, const void *gregs, size_t len)
+ struct regcache *regcache, int regnum,
+ const void *gregs, size_t len)
{
int regi;
@@ -429,17 +422,11 @@ frv_linux_supply_gregset (const struct regset *regset,
/* FRV Linux kernel register sets. */
-static const struct regset frv_linux_gregset =
-{
- frv_linux_gregmap,
- frv_linux_supply_gregset, regcache_collect_regset
-};
+static const struct regset frv_linux_gregset
+ = { frv_linux_gregmap, frv_linux_supply_gregset, regcache_collect_regset };
-static const struct regset frv_linux_fpregset =
-{
- frv_linux_fpregmap,
- regcache_supply_regset, regcache_collect_regset
-};
+static const struct regset frv_linux_fpregset
+ = { frv_linux_fpregmap, regcache_supply_regset, regcache_collect_regset };
static void
frv_linux_iterate_over_regset_sections (struct gdbarch *gdbarch,
@@ -453,17 +440,16 @@ frv_linux_iterate_over_regset_sections (struct gdbarch *gdbarch,
&frv_linux_fpregset, NULL, cb_data);
}
-
static void
frv_linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
{
linux_init_abi (info, gdbarch, 0);
/* Set the sigtramp frame sniffer. */
- frame_unwind_append_unwinder (gdbarch, &frv_linux_sigtramp_frame_unwind);
+ frame_unwind_append_unwinder (gdbarch, &frv_linux_sigtramp_frame_unwind);
- set_gdbarch_iterate_over_regset_sections
- (gdbarch, frv_linux_iterate_over_regset_sections);
+ set_gdbarch_iterate_over_regset_sections (
+ gdbarch, frv_linux_iterate_over_regset_sections);
}
static enum gdb_osabi
@@ -483,12 +469,12 @@ frv_linux_elf_osabi_sniffer (bfd *abfd)
}
void _initialize_frv_linux_tdep ();
+
void
_initialize_frv_linux_tdep ()
{
gdbarch_register_osabi (bfd_arch_frv, 0, GDB_OSABI_LINUX,
frv_linux_init_abi);
- gdbarch_register_osabi_sniffer (bfd_arch_frv,
- bfd_target_elf_flavour,
+ gdbarch_register_osabi_sniffer (bfd_arch_frv, bfd_target_elf_flavour,
frv_linux_elf_osabi_sniffer);
}
diff --git a/gdb/frv-tdep.c b/gdb/frv-tdep.c
index 1a709b917c3..d1009e4d4af 100644
--- a/gdb/frv-tdep.c
+++ b/gdb/frv-tdep.c
@@ -29,7 +29,7 @@
#include "dis-asm.h"
#include "sim-regno.h"
#include "sim/sim-frv.h"
-#include "opcodes/frv-desc.h" /* for the H_SPR_... enums */
+#include "opcodes/frv-desc.h" /* for the H_SPR_... enums */
#include "symtab.h"
#include "elf-bfd.h"
#include "elf/frv.h"
@@ -40,18 +40,18 @@
#include "objfiles.h"
#include "gdbarch.h"
-struct frv_unwind_cache /* was struct frame_extra_info */
- {
- /* The previous frame's inner-most stack address. Used as this
+struct frv_unwind_cache /* was struct frame_extra_info */
+{
+ /* The previous frame's inner-most stack address. Used as this
frame ID's stack_addr. */
- CORE_ADDR prev_sp;
+ CORE_ADDR prev_sp;
- /* The frame's base, optionally used by the high-level debug info. */
- CORE_ADDR base;
+ /* The frame's base, optionally used by the high-level debug info. */
+ CORE_ADDR base;
- /* Table indicating the location of each and every register. */
- trad_frame_saved_reg *saved_regs;
- };
+ /* Table indicating the location of each and every register. */
+ trad_frame_saved_reg *saved_regs;
+};
/* A structure describing a particular variant of the FRV.
We allocate and initialize one of these structures when we create
@@ -71,7 +71,9 @@ struct frv_unwind_cache /* was struct frame_extra_info */
struct frv_gdbarch_tdep : gdbarch_tdep_base
{
/* Which ABI is in use? */
- enum frv_abi frv_abi {};
+ enum frv_abi frv_abi
+ {
+ };
/* How many general-purpose registers does this variant have? */
int num_gprs = 0;
@@ -115,15 +117,15 @@ frv_fdpic_loadmap_addresses (struct gdbarch *gdbarch, CORE_ADDR *interp_addr,
if (interp_addr != NULL)
{
ULONGEST val;
- regcache_cooked_read_unsigned (regcache,
- fdpic_loadmap_interp_regnum, &val);
+ regcache_cooked_read_unsigned (regcache, fdpic_loadmap_interp_regnum,
+ &val);
*interp_addr = val;
}
if (exec_addr != NULL)
{
ULONGEST val;
- regcache_cooked_read_unsigned (regcache,
- fdpic_loadmap_exec_regnum, &val);
+ regcache_cooked_read_unsigned (regcache, fdpic_loadmap_exec_regnum,
+ &val);
*exec_addr = val;
}
return 0;
@@ -147,7 +149,7 @@ new_variant ()
/* By default, don't supply any general-purpose or floating-point
register names. */
- var->register_names
+ var->register_names
= (const char **) xmalloc ((frv_num_regs + frv_num_pseudo_regs)
* sizeof (const char *));
for (r = 0; r < frv_num_regs + frv_num_pseudo_regs; r++)
@@ -159,7 +161,7 @@ new_variant ()
var->register_names[pc_regnum] = "pc";
var->register_names[lr_regnum] = "lr";
var->register_names[lcr_regnum] = "lcr";
-
+
var->register_names[psr_regnum] = "psr";
var->register_names[ccr_regnum] = "ccr";
var->register_names[cccr_regnum] = "cccr";
@@ -185,8 +187,7 @@ new_variant ()
in the G packet. If we need more in the future, we'll add them
elsewhere. */
for (r = acc0_regnum; r <= acc7_regnum; r++)
- var->register_names[r]
- = xstrprintf ("acc%d", r - acc0_regnum).release ();
+ var->register_names[r] = xstrprintf ("acc%d", r - acc0_regnum).release ();
/* accg0 - accg7: These are one byte registers. The remote protocol
provides the raw values packed four into a slot. accg0123 and
@@ -212,7 +213,6 @@ new_variant ()
return var;
}
-
/* Indicate that the variant VAR has NUM_GPRS general-purpose
registers, and fill in the names array appropriately. */
static void
@@ -231,7 +231,6 @@ set_variant_num_gprs (frv_gdbarch_tdep *var, int num_gprs)
}
}
-
/* Indicate that the variant VAR has NUM_FPRS floating-point
registers, and fill in the names array appropriately. */
static void
@@ -275,7 +274,6 @@ frv_register_name (struct gdbarch *gdbarch, int reg)
return tdep->register_names[reg];
}
-
static struct type *
frv_register_type (struct gdbarch *gdbarch, int reg)
{
@@ -326,7 +324,7 @@ frv_pseudo_register_read (struct gdbarch *gdbarch, readable_regcache *regcache,
static void
frv_pseudo_register_write (struct gdbarch *gdbarch, struct regcache *regcache,
- int reg, const gdb_byte *buffer)
+ int reg, const gdb_byte *buffer)
{
if (reg == iacc0_regnum)
{
@@ -351,47 +349,46 @@ frv_pseudo_register_write (struct gdbarch *gdbarch, struct regcache *regcache,
static int
frv_register_sim_regno (struct gdbarch *gdbarch, int reg)
{
- static const int spr_map[] =
- {
- H_SPR_PSR, /* psr_regnum */
- H_SPR_CCR, /* ccr_regnum */
- H_SPR_CCCR, /* cccr_regnum */
- -1, /* fdpic_loadmap_exec_regnum */
- -1, /* fdpic_loadmap_interp_regnum */
- -1, /* 134 */
- H_SPR_TBR, /* tbr_regnum */
- H_SPR_BRR, /* brr_regnum */
- H_SPR_DBAR0, /* dbar0_regnum */
- H_SPR_DBAR1, /* dbar1_regnum */
- H_SPR_DBAR2, /* dbar2_regnum */
- H_SPR_DBAR3, /* dbar3_regnum */
- H_SPR_SCR0, /* scr0_regnum */
- H_SPR_SCR1, /* scr1_regnum */
- H_SPR_SCR2, /* scr2_regnum */
- H_SPR_SCR3, /* scr3_regnum */
- H_SPR_LR, /* lr_regnum */
- H_SPR_LCR, /* lcr_regnum */
- H_SPR_IACC0H, /* iacc0h_regnum */
- H_SPR_IACC0L, /* iacc0l_regnum */
- H_SPR_FSR0, /* fsr0_regnum */
- /* FIXME: Add infrastructure for fetching/setting ACC and ACCG regs. */
- -1, /* acc0_regnum */
- -1, /* acc1_regnum */
- -1, /* acc2_regnum */
- -1, /* acc3_regnum */
- -1, /* acc4_regnum */
- -1, /* acc5_regnum */
- -1, /* acc6_regnum */
- -1, /* acc7_regnum */
- -1, /* acc0123_regnum */
- -1, /* acc4567_regnum */
- H_SPR_MSR0, /* msr0_regnum */
- H_SPR_MSR1, /* msr1_regnum */
- H_SPR_GNER0, /* gner0_regnum */
- H_SPR_GNER1, /* gner1_regnum */
- H_SPR_FNER0, /* fner0_regnum */
- H_SPR_FNER1, /* fner1_regnum */
- };
+ static const int spr_map[] = {
+ H_SPR_PSR, /* psr_regnum */
+ H_SPR_CCR, /* ccr_regnum */
+ H_SPR_CCCR, /* cccr_regnum */
+ -1, /* fdpic_loadmap_exec_regnum */
+ -1, /* fdpic_loadmap_interp_regnum */
+ -1, /* 134 */
+ H_SPR_TBR, /* tbr_regnum */
+ H_SPR_BRR, /* brr_regnum */
+ H_SPR_DBAR0, /* dbar0_regnum */
+ H_SPR_DBAR1, /* dbar1_regnum */
+ H_SPR_DBAR2, /* dbar2_regnum */
+ H_SPR_DBAR3, /* dbar3_regnum */
+ H_SPR_SCR0, /* scr0_regnum */
+ H_SPR_SCR1, /* scr1_regnum */
+ H_SPR_SCR2, /* scr2_regnum */
+ H_SPR_SCR3, /* scr3_regnum */
+ H_SPR_LR, /* lr_regnum */
+ H_SPR_LCR, /* lcr_regnum */
+ H_SPR_IACC0H, /* iacc0h_regnum */
+ H_SPR_IACC0L, /* iacc0l_regnum */
+ H_SPR_FSR0, /* fsr0_regnum */
+ /* FIXME: Add infrastructure for fetching/setting ACC and ACCG regs. */
+ -1, /* acc0_regnum */
+ -1, /* acc1_regnum */
+ -1, /* acc2_regnum */
+ -1, /* acc3_regnum */
+ -1, /* acc4_regnum */
+ -1, /* acc5_regnum */
+ -1, /* acc6_regnum */
+ -1, /* acc7_regnum */
+ -1, /* acc0123_regnum */
+ -1, /* acc4567_regnum */
+ H_SPR_MSR0, /* msr0_regnum */
+ H_SPR_MSR1, /* msr1_regnum */
+ H_SPR_GNER0, /* gner0_regnum */
+ H_SPR_GNER1, /* gner1_regnum */
+ H_SPR_FNER0, /* fner0_regnum */
+ H_SPR_FNER1, /* fner1_regnum */
+ };
gdb_assert (reg >= 0 && reg < gdbarch_num_regs (gdbarch));
@@ -412,10 +409,10 @@ frv_register_sim_regno (struct gdbarch *gdbarch, int reg)
return SIM_FRV_SPR0_REGNUM + spr_reg_offset;
}
- internal_error (_("Bad register number %d"), reg);
+ internal_error (_ ("Bad register number %d"), reg);
}
-constexpr gdb_byte frv_break_insn[] = {0xc0, 0x70, 0x00, 0x01};
+constexpr gdb_byte frv_break_insn[] = { 0xc0, 0x70, 0x00, 0x01 };
typedef BP_MANIPULATION (frv_break_insn) frv_breakpoint;
@@ -464,27 +461,22 @@ frv_adjust_breakpoint_address (struct gdbarch *gdbarch, CORE_ADDR bpaddr)
return bpaddr;
}
-
/* Return true if REG is a caller-saves ("scratch") register,
false otherwise. */
static int
is_caller_saves_reg (int reg)
{
- return ((4 <= reg && reg <= 7)
- || (14 <= reg && reg <= 15)
+ return ((4 <= reg && reg <= 7) || (14 <= reg && reg <= 15)
|| (32 <= reg && reg <= 47));
}
-
/* Return true if REG is a callee-saves register, false otherwise. */
static int
is_callee_saves_reg (int reg)
{
- return ((16 <= reg && reg <= 31)
- || (48 <= reg && reg <= 63));
+ return ((16 <= reg && reg <= 31) || (48 <= reg && reg <= 63));
}
-
/* Return true if REG is an argument register, false otherwise. */
static int
is_argument_reg (int reg)
@@ -506,8 +498,7 @@ is_argument_reg (int reg)
prologue analysis. */
static CORE_ADDR
frv_analyze_prologue (struct gdbarch *gdbarch, CORE_ADDR pc,
- frame_info_ptr this_frame,
- struct frv_unwind_cache *info)
+ frame_info_ptr this_frame, struct frv_unwind_cache *info)
{
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
@@ -696,10 +687,10 @@ frv_analyze_prologue (struct gdbarch *gdbarch, CORE_ADDR pc,
We treat this as part of the prologue, and record the register's
saved address in the frame structure. */
else if ((op & 0x01ffffff) == 0x000c10c0
- || (op & 0x01ffffff) == 0x000c1100)
+ || (op & 0x01ffffff) == 0x000c1100)
{
int gr_k = ((op >> 25) & 0x3f);
- int ope = ((op >> 6) & 0x3f);
+ int ope = ((op >> 6) & 0x3f);
int count;
int i;
@@ -797,7 +788,7 @@ frv_analyze_prologue (struct gdbarch *gdbarch, CORE_ADDR pc,
. . . . . . . .
We check that GRk is really an argument register, and treat
all such as part of the prologue. */
- else if ( (op & 0x01fff000) == 0x01442000
+ else if ((op & 0x01fff000) == 0x01442000
|| (op & 0x01fff000) == 0x01402000)
{
int gr_k = ((op >> 25) & 0x3f);
@@ -822,7 +813,7 @@ frv_analyze_prologue (struct gdbarch *gdbarch, CORE_ADDR pc,
We treat this as part of the prologue, and record the register's
saved address in the frame structure. */
else if ((op & 0x01fff000) == 0x014c1000
- || (op & 0x01fff000) == 0x01501000)
+ || (op & 0x01fff000) == 0x01501000)
{
int gr_k = ((op >> 25) & 0x3f);
int count;
@@ -865,7 +856,7 @@ frv_analyze_prologue (struct gdbarch *gdbarch, CORE_ADDR pc,
instructions fall into this pattern, so let's decode the
instruction once, and then work at a higher level. */
else if (((op & 0x01fc0fff) == 0x000c0080)
- || ((op & 0x01fc0000) == 0x01480000))
+ || ((op & 0x01fc0000) == 0x01480000))
{
int gr_k = ((op >> 25) & 0x3f);
int gr_i = ((op >> 12) & 0x3f);
@@ -895,8 +886,7 @@ frv_analyze_prologue (struct gdbarch *gdbarch, CORE_ADDR pc,
/* Saving callee-saves register(s) on the stack, relative to
the SP. */
- else if (gr_i == sp_regnum
- && is_callee_saves_reg (gr_k))
+ else if (gr_i == sp_regnum && is_callee_saves_reg (gr_k))
{
gr_saved[gr_k] = 1;
if (gr_i == sp_regnum)
@@ -907,8 +897,7 @@ frv_analyze_prologue (struct gdbarch *gdbarch, CORE_ADDR pc,
}
/* Saving the scratch register holding the return address. */
- else if (lr_save_reg != -1
- && gr_k == lr_save_reg)
+ else if (lr_save_reg != -1 && gr_k == lr_save_reg)
{
lr_saved_on_stack = 1;
if (gr_i == sp_regnum)
@@ -966,7 +955,6 @@ frv_analyze_prologue (struct gdbarch *gdbarch, CORE_ADDR pc,
return last_prologue_pc;
}
-
static CORE_ADDR
frv_skip_prologue (struct gdbarch *gdbarch, CORE_ADDR pc)
{
@@ -998,7 +986,6 @@ frv_skip_prologue (struct gdbarch *gdbarch, CORE_ADDR pc)
return new_pc;
}
-
/* Examine the instruction pointed to by PC. If it corresponds to
a call to __main, return the address of the next instruction.
Otherwise, return PC. */
@@ -1067,8 +1054,7 @@ frv_skip_main_prologue (struct gdbarch *gdbarch, CORE_ADDR pc)
call_dest = pc + 4 * displ;
s = lookup_minimal_symbol_by_pc (call_dest);
- if (s.minsym != NULL
- && s.minsym->linkage_name () != NULL
+ if (s.minsym != NULL && s.minsym->linkage_name () != NULL
&& strcmp (s.minsym->linkage_name (), "__main") == 0)
{
pc += 4;
@@ -1078,10 +1064,8 @@ frv_skip_main_prologue (struct gdbarch *gdbarch, CORE_ADDR pc)
return orig_pc;
}
-
static struct frv_unwind_cache *
-frv_frame_unwind_cache (frame_info_ptr this_frame,
- void **this_prologue_cache)
+frv_frame_unwind_cache (frame_info_ptr this_frame, void **this_prologue_cache)
{
struct gdbarch *gdbarch = get_frame_arch (this_frame);
struct frv_unwind_cache *info;
@@ -1094,8 +1078,8 @@ frv_frame_unwind_cache (frame_info_ptr this_frame,
info->saved_regs = trad_frame_alloc_saved_regs (this_frame);
/* Prologue analysis does the rest... */
- frv_analyze_prologue (gdbarch,
- get_frame_func (this_frame), this_frame, info);
+ frv_analyze_prologue (gdbarch, get_frame_func (this_frame), this_frame,
+ info);
return info;
}
@@ -1124,7 +1108,7 @@ frv_extract_return_value (struct type *type, struct regcache *regcache,
store_unsigned_integer ((bfd_byte *) valbuf + 4, 4, byte_order, regval);
}
else
- internal_error (_("Illegal return value length: %d"), len);
+ internal_error (_ ("Illegal return value length: %d"), len);
}
static CORE_ADDR
@@ -1184,8 +1168,8 @@ frv_convert_from_func_ptr_addr (struct gdbarch *gdbarch, CORE_ADDR addr,
static CORE_ADDR
frv_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
- struct regcache *regcache, CORE_ADDR bp_addr,
- int nargs, struct value **args, CORE_ADDR sp,
+ struct regcache *regcache, CORE_ADDR bp_addr, int nargs,
+ struct value **args, CORE_ADDR sp,
function_call_return_method return_method,
CORE_ADDR struct_addr)
{
@@ -1237,21 +1221,19 @@ frv_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
if (typecode == TYPE_CODE_STRUCT || typecode == TYPE_CODE_UNION)
{
- store_unsigned_integer (valbuf, 4, byte_order,
- value_address (arg));
+ store_unsigned_integer (valbuf, 4, byte_order, value_address (arg));
typecode = TYPE_CODE_PTR;
len = 4;
val = valbuf;
}
- else if (abi == FRV_ABI_FDPIC
- && len == 4
- && typecode == TYPE_CODE_PTR
+ else if (abi == FRV_ABI_FDPIC && len == 4 && typecode == TYPE_CODE_PTR
&& arg_type->target_type ()->code () == TYPE_CODE_FUNC)
{
/* The FDPIC ABI requires function descriptors to be passed instead
of entry points. */
- CORE_ADDR addr = extract_unsigned_integer
- (value_contents (arg).data (), 4, byte_order);
+ CORE_ADDR addr
+ = extract_unsigned_integer (value_contents (arg).data (), 4,
+ byte_order);
addr = find_func_descr (gdbarch, addr);
store_unsigned_integer (valbuf, 4, byte_order, addr);
typecode = TYPE_CODE_PTR;
@@ -1299,9 +1281,9 @@ frv_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
if (abi == FRV_ABI_FDPIC)
{
/* Set the GOT register for the FDPIC ABI. */
- regcache_cooked_write_unsigned
- (regcache, first_gpr_regnum + 15,
- frv_fdpic_find_global_pointer (func_addr));
+ regcache_cooked_write_unsigned (
+ regcache, first_gpr_regnum + 15,
+ frv_fdpic_find_global_pointer (func_addr));
}
/* Finally, update the SP register. */
@@ -1329,7 +1311,7 @@ frv_store_return_value (struct type *type, struct regcache *regcache,
regcache->cooked_write (9, (bfd_byte *) valbuf + 4);
}
else
- internal_error (_("Don't know how to return a %d-byte value."), len);
+ internal_error (_ ("Don't know how to return a %d-byte value."), len);
}
static enum return_value_convention
@@ -1363,8 +1345,8 @@ frv_return_value (struct gdbarch *gdbarch, struct value *function,
frame. This will be used to create a new GDB frame struct. */
static void
-frv_frame_this_id (frame_info_ptr this_frame,
- void **this_prologue_cache, struct frame_id *this_id)
+frv_frame_this_id (frame_info_ptr this_frame, void **this_prologue_cache,
+ struct frame_id *this_id)
{
struct frv_unwind_cache *info
= frv_frame_unwind_cache (this_frame, this_prologue_cache);
@@ -1393,23 +1375,22 @@ frv_frame_this_id (frame_info_ptr this_frame,
}
static struct value *
-frv_frame_prev_register (frame_info_ptr this_frame,
- void **this_prologue_cache, int regnum)
+frv_frame_prev_register (frame_info_ptr this_frame, void **this_prologue_cache,
+ int regnum)
{
struct frv_unwind_cache *info
= frv_frame_unwind_cache (this_frame, this_prologue_cache);
return trad_frame_get_prev_register (this_frame, info->saved_regs, regnum);
}
-static const struct frame_unwind frv_frame_unwind = {
- "frv prologue",
- NORMAL_FRAME,
- default_frame_unwind_stop_reason,
- frv_frame_this_id,
- frv_frame_prev_register,
- NULL,
- default_frame_sniffer
-};
+static const struct frame_unwind frv_frame_unwind
+ = { "frv prologue",
+ NORMAL_FRAME,
+ default_frame_unwind_stop_reason,
+ frv_frame_this_id,
+ frv_frame_prev_register,
+ NULL,
+ default_frame_sniffer };
static CORE_ADDR
frv_frame_base_address (frame_info_ptr this_frame, void **this_cache)
@@ -1419,12 +1400,9 @@ frv_frame_base_address (frame_info_ptr this_frame, void **this_cache)
return info->base;
}
-static const struct frame_base frv_frame_base = {
- &frv_frame_unwind,
- frv_frame_base_address,
- frv_frame_base_address,
- frv_frame_base_address
-};
+static const struct frame_base frv_frame_base
+ = { &frv_frame_unwind, frv_frame_base_address, frv_frame_base_address,
+ frv_frame_base_address };
static struct gdbarch *
frv_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
@@ -1501,8 +1479,8 @@ frv_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
set_gdbarch_skip_main_prologue (gdbarch, frv_skip_main_prologue);
set_gdbarch_breakpoint_kind_from_pc (gdbarch, frv_breakpoint::kind_from_pc);
set_gdbarch_sw_breakpoint_from_kind (gdbarch, frv_breakpoint::bp_from_kind);
- set_gdbarch_adjust_breakpoint_address
- (gdbarch, frv_adjust_breakpoint_address);
+ set_gdbarch_adjust_breakpoint_address (gdbarch,
+ frv_adjust_breakpoint_address);
set_gdbarch_return_value (gdbarch, frv_return_value);
@@ -1565,6 +1543,7 @@ frv_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
}
void _initialize_frv_tdep ();
+
void
_initialize_frv_tdep ()
{
diff --git a/gdb/frv-tdep.h b/gdb/frv-tdep.h
index 5b699669356..0232f2aed86 100644
--- a/gdb/frv-tdep.h
+++ b/gdb/frv-tdep.h
@@ -21,14 +21,15 @@
/* Enumerate the possible ABIs for FR-V. */
enum frv_abi
- {
- FRV_ABI_EABI,
- FRV_ABI_FDPIC
- };
+{
+ FRV_ABI_EABI,
+ FRV_ABI_FDPIC
+};
/* Register numbers. The order in which these appear define the
remote protocol, so take care in changing them. */
-enum {
+enum
+{
/* Register numbers 0 -- 63 are always reserved for general-purpose
registers. The chip at hand may have less. */
first_gpr_regnum = 0,
@@ -113,7 +114,6 @@ CORE_ADDR frv_fdpic_find_global_pointer (CORE_ADDR addr);
be found, return 0. */
CORE_ADDR frv_fdpic_find_canonical_descriptor (CORE_ADDR entry_point);
-
/* Given an objfile, return the address of its link map. This value is
needed for TLS support. */
CORE_ADDR frv_fetch_objfile_link_map (struct objfile *objfile);
diff --git a/gdb/ft32-tdep.c b/gdb/ft32-tdep.c
index 7a69da61fdb..43f35f27ef7 100644
--- a/gdb/ft32-tdep.c
+++ b/gdb/ft32-tdep.c
@@ -43,10 +43,13 @@
#include "sim/sim-ft32.h"
#include <algorithm>
-#define RAM_BIAS 0x800000 /* Bias added to RAM addresses. */
+#define RAM_BIAS 0x800000 /* Bias added to RAM addresses. */
/* Use an invalid address -1 as 'not available' marker. */
-enum { REG_UNAVAIL = (CORE_ADDR) (-1) };
+enum
+{
+ REG_UNAVAIL = (CORE_ADDR) (-1)
+};
struct ft32_frame_cache
{
@@ -74,22 +77,17 @@ ft32_frame_align (struct gdbarch *gdbarch, CORE_ADDR sp)
return sp & ~1;
}
-
constexpr gdb_byte ft32_break_insn[] = { 0x02, 0x00, 0x34, 0x00 };
typedef BP_MANIPULATION (ft32_break_insn) ft32_breakpoint;
/* FT32 register names. */
-static const char *const ft32_register_names[] =
-{
- "fp", "sp",
- "r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7",
- "r8", "r9", "r10", "r11", "r12", "r13", "r14", "r15",
- "r16", "r17", "r18", "r19", "r20", "r21", "r22", "r23",
- "r24", "r25", "r26", "r27", "r28", "cc",
- "pc"
-};
+static const char *const ft32_register_names[]
+ = { "fp", "sp", "r0", "r1", "r2", "r3", "r4", "r5", "r6",
+ "r7", "r8", "r9", "r10", "r11", "r12", "r13", "r14", "r15",
+ "r16", "r17", "r18", "r19", "r20", "r21", "r22", "r23", "r24",
+ "r25", "r26", "r27", "r28", "cc", "pc" };
/* Implement the "register_name" gdbarch method. */
@@ -133,8 +131,7 @@ ft32_store_return_value (struct type *type, struct regcache *regcache,
regcache_cooked_write_unsigned (regcache, FT32_R0_REGNUM, regval);
if (len > 4)
{
- regval = extract_unsigned_integer (valbuf + 4,
- len - 4, byte_order);
+ regval = extract_unsigned_integer (valbuf + 4, len - 4, byte_order);
regcache_cooked_write_unsigned (regcache, FT32_R1_REGNUM, regval);
}
}
@@ -143,8 +140,7 @@ ft32_store_return_value (struct type *type, struct regcache *regcache,
a compressed instruction pair, return the expanded instruction. */
static ULONGEST
-ft32_fetch_instruction (CORE_ADDR a, int *isize,
- enum bfd_endian byte_order)
+ft32_fetch_instruction (CORE_ADDR a, int *isize, enum bfd_endian byte_order)
{
unsigned int sc[2];
ULONGEST inst;
@@ -166,8 +162,7 @@ ft32_fetch_instruction (CORE_ADDR a, int *isize,
static CORE_ADDR
ft32_analyze_prologue (CORE_ADDR start_addr, CORE_ADDR end_addr,
- struct ft32_frame_cache *cache,
- struct gdbarch *gdbarch)
+ struct ft32_frame_cache *cache, struct gdbarch *gdbarch)
{
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
CORE_ADDR next_addr;
@@ -175,7 +170,7 @@ ft32_analyze_prologue (CORE_ADDR start_addr, CORE_ADDR end_addr,
int isize = 0;
int regnum, pushreg;
struct bound_minimal_symbol msymbol;
- const int first_saved_reg = 13; /* The first saved register. */
+ const int first_saved_reg = 13; /* The first saved register. */
/* PROLOGS are addresses of the subroutine prologs, PROLOGS[n]
is the address of __prolog_$rN.
__prolog_$rN pushes registers from 13 through n inclusive.
@@ -222,12 +217,11 @@ ft32_analyze_prologue (CORE_ADDR start_addr, CORE_ADDR end_addr,
{
if ((4 * (inst & 0x3ffff)) == prologs[regnum])
{
- for (pushreg = first_saved_reg; pushreg <= regnum;
- pushreg++)
+ for (pushreg = first_saved_reg; pushreg <= regnum; pushreg++)
{
cache->framesize += 4;
- cache->saved_regs[FT32_R0_REGNUM + pushreg] =
- cache->framesize;
+ cache->saved_regs[FT32_R0_REGNUM + pushreg]
+ = cache->framesize;
}
}
}
@@ -239,8 +233,8 @@ ft32_analyze_prologue (CORE_ADDR start_addr, CORE_ADDR end_addr,
for (regnum = FT32_R0_REGNUM; regnum < FT32_PC_REGNUM; regnum++)
{
if (cache->saved_regs[regnum] != REG_UNAVAIL)
- cache->saved_regs[regnum] =
- cache->framesize - cache->saved_regs[regnum];
+ cache->saved_regs[regnum]
+ = cache->framesize - cache->saved_regs[regnum];
}
cache->saved_regs[FT32_PC_REGNUM] = cache->framesize;
@@ -294,8 +288,8 @@ ft32_skip_prologue (struct gdbarch *gdbarch, CORE_ADDR pc)
memset (&cache, 0, sizeof cache);
- plg_end = ft32_analyze_prologue (func_addr,
- func_end, &cache, gdbarch);
+ plg_end
+ = ft32_analyze_prologue (func_addr, func_end, &cache, gdbarch);
/* Found a function. */
sym = lookup_symbol (func_name, NULL, VAR_DOMAIN, NULL).symbol;
/* Don't use line number debug info for assembly source files. */
@@ -323,12 +317,11 @@ ft32_skip_prologue (struct gdbarch *gdbarch, CORE_ADDR pc)
RAM appears at address RAM_BIAS, flash at address 0. */
static CORE_ADDR
-ft32_pointer_to_address (struct gdbarch *gdbarch,
- struct type *type, const gdb_byte *buf)
+ft32_pointer_to_address (struct gdbarch *gdbarch, struct type *type,
+ const gdb_byte *buf)
{
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
- CORE_ADDR addr
- = extract_unsigned_integer (buf, type->length (), byte_order);
+ CORE_ADDR addr = extract_unsigned_integer (buf, type->length (), byte_order);
if (TYPE_ADDRESS_CLASS_1 (type))
return addr;
@@ -356,7 +349,7 @@ ft32_address_class_type_flags (int byte_size, int dwarf2_addr_class)
Convert a type_instance_flag_value to an address space qualifier. */
-static const char*
+static const char *
ft32_address_class_type_flags_to_name (struct gdbarch *gdbarch,
type_instance_flags type_flags)
{
@@ -372,7 +365,7 @@ ft32_address_class_type_flags_to_name (struct gdbarch *gdbarch,
static bool
ft32_address_class_name_to_type_flags (struct gdbarch *gdbarch,
- const char* name,
+ const char *name,
type_instance_flags *type_flags_ptr)
{
if (strcmp (name, "flash") == 0)
@@ -489,11 +482,11 @@ ft32_frame_cache (frame_info_ptr this_frame, void **this_cache)
frame. This will be used to create a new GDB frame struct. */
static void
-ft32_frame_this_id (frame_info_ptr this_frame,
- void **this_prologue_cache, struct frame_id *this_id)
+ft32_frame_this_id (frame_info_ptr this_frame, void **this_prologue_cache,
+ struct frame_id *this_id)
{
- struct ft32_frame_cache *cache = ft32_frame_cache (this_frame,
- this_prologue_cache);
+ struct ft32_frame_cache *cache
+ = ft32_frame_cache (this_frame, this_prologue_cache);
/* This marks the outermost frame. */
if (cache->base == 0)
@@ -508,8 +501,8 @@ static struct value *
ft32_frame_prev_register (frame_info_ptr this_frame,
void **this_prologue_cache, int regnum)
{
- struct ft32_frame_cache *cache = ft32_frame_cache (this_frame,
- this_prologue_cache);
+ struct ft32_frame_cache *cache
+ = ft32_frame_cache (this_frame, this_prologue_cache);
gdb_assert (regnum >= 0);
@@ -517,41 +510,34 @@ ft32_frame_prev_register (frame_info_ptr this_frame,
return frame_unwind_got_constant (this_frame, regnum, cache->saved_sp);
if (regnum < FT32_NUM_REGS && cache->saved_regs[regnum] != REG_UNAVAIL)
- return frame_unwind_got_memory (this_frame, regnum,
- RAM_BIAS | cache->saved_regs[regnum]);
+ return frame_unwind_got_memory (this_frame, regnum,
+ RAM_BIAS | cache->saved_regs[regnum]);
return frame_unwind_got_register (this_frame, regnum, regnum);
}
-static const struct frame_unwind ft32_frame_unwind =
-{
- "ft32 prologue",
- NORMAL_FRAME,
- default_frame_unwind_stop_reason,
- ft32_frame_this_id,
- ft32_frame_prev_register,
- NULL,
- default_frame_sniffer
-};
+static const struct frame_unwind ft32_frame_unwind
+ = { "ft32 prologue",
+ NORMAL_FRAME,
+ default_frame_unwind_stop_reason,
+ ft32_frame_this_id,
+ ft32_frame_prev_register,
+ NULL,
+ default_frame_sniffer };
/* Return the base address of this_frame. */
static CORE_ADDR
ft32_frame_base_address (frame_info_ptr this_frame, void **this_cache)
{
- struct ft32_frame_cache *cache = ft32_frame_cache (this_frame,
- this_cache);
+ struct ft32_frame_cache *cache = ft32_frame_cache (this_frame, this_cache);
return cache->base;
}
-static const struct frame_base ft32_frame_base =
-{
- &ft32_frame_unwind,
- ft32_frame_base_address,
- ft32_frame_base_address,
- ft32_frame_base_address
-};
+static const struct frame_base ft32_frame_base
+ = { &ft32_frame_unwind, ft32_frame_base_address, ft32_frame_base_address,
+ ft32_frame_base_address };
/* Allocate and initialize the ft32 gdbarch object. */
@@ -575,8 +561,8 @@ ft32_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
be defined. */
void_type = arch_type (gdbarch, TYPE_CODE_VOID, TARGET_CHAR_BIT, "void");
func_void_type = make_function_type (void_type, NULL);
- tdep->pc_type = arch_pointer_type (gdbarch, 4 * TARGET_CHAR_BIT, NULL,
- func_void_type);
+ tdep->pc_type
+ = arch_pointer_type (gdbarch, 4 * TARGET_CHAR_BIT, NULL, func_void_type);
tdep->pc_type->set_instance_flags (tdep->pc_type->instance_flags ()
| TYPE_INSTANCE_FLAG_ADDRESS_CLASS_1);
@@ -607,11 +593,12 @@ ft32_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
/* Support simple overlay manager. */
set_gdbarch_overlay_update (gdbarch, simple_overlay_update);
- set_gdbarch_address_class_type_flags (gdbarch, ft32_address_class_type_flags);
- set_gdbarch_address_class_name_to_type_flags
- (gdbarch, ft32_address_class_name_to_type_flags);
- set_gdbarch_address_class_type_flags_to_name
- (gdbarch, ft32_address_class_type_flags_to_name);
+ set_gdbarch_address_class_type_flags (gdbarch,
+ ft32_address_class_type_flags);
+ set_gdbarch_address_class_name_to_type_flags (
+ gdbarch, ft32_address_class_name_to_type_flags);
+ set_gdbarch_address_class_type_flags_to_name (
+ gdbarch, ft32_address_class_type_flags_to_name);
return gdbarch;
}
@@ -619,6 +606,7 @@ ft32_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
/* Register this machine's init routine. */
void _initialize_ft32_tdep ();
+
void
_initialize_ft32_tdep ()
{
diff --git a/gdb/gcore-elf.c b/gdb/gcore-elf.c
index 643426d911b..342ebcc008e 100644
--- a/gdb/gcore-elf.c
+++ b/gdb/gcore-elf.c
@@ -31,12 +31,15 @@
struct gcore_elf_collect_regset_section_cb_data
{
- gcore_elf_collect_regset_section_cb_data
- (struct gdbarch *gdbarch, const struct regcache *regcache,
- bfd *obfd, ptid_t ptid, gdb_signal stop_signal,
- gdb::unique_xmalloc_ptr<char> *note_data, int *note_size)
- : gdbarch (gdbarch), regcache (regcache), obfd (obfd),
- note_data (note_data), note_size (note_size),
+ gcore_elf_collect_regset_section_cb_data (
+ struct gdbarch *gdbarch, const struct regcache *regcache, bfd *obfd,
+ ptid_t ptid, gdb_signal stop_signal,
+ gdb::unique_xmalloc_ptr<char> *note_data, int *note_size)
+ : gdbarch (gdbarch),
+ regcache (regcache),
+ obfd (obfd),
+ note_data (note_data),
+ note_size (note_size),
stop_signal (stop_signal)
{
/* The LWP is often not available for bare metal target, in which case
@@ -61,15 +64,15 @@ struct gcore_elf_collect_regset_section_cb_data
regset in the core file note section. */
static void
-gcore_elf_collect_regset_section_cb (const char *sect_name,
- int supply_size, int collect_size,
+gcore_elf_collect_regset_section_cb (const char *sect_name, int supply_size,
+ int collect_size,
const struct regset *regset,
const char *human_name, void *cb_data)
{
struct gcore_elf_collect_regset_section_cb_data *data
= (struct gcore_elf_collect_regset_section_cb_data *) cb_data;
- bool variable_size_section = (regset != nullptr
- && regset->flags & REGSET_VARIABLE_SIZE);
+ bool variable_size_section
+ = (regset != nullptr && regset->flags & REGSET_VARIABLE_SIZE);
gdb_assert (variable_size_section || supply_size == collect_size);
@@ -87,16 +90,13 @@ gcore_elf_collect_regset_section_cb (const char *sect_name,
/* PRSTATUS still needs to be treated specially. */
if (strcmp (sect_name, ".reg") == 0)
- data->note_data->reset (elfcore_write_prstatus
- (data->obfd, data->note_data->release (),
- data->note_size, data->lwp,
- gdb_signal_to_host (data->stop_signal),
- buf.data ()));
+ data->note_data->reset (elfcore_write_prstatus (
+ data->obfd, data->note_data->release (), data->note_size, data->lwp,
+ gdb_signal_to_host (data->stop_signal), buf.data ()));
else
- data->note_data->reset (elfcore_write_register_note
- (data->obfd, data->note_data->release (),
- data->note_size, sect_name, buf.data (),
- collect_size));
+ data->note_data->reset (elfcore_write_register_note (
+ data->obfd, data->note_data->release (), data->note_size, sect_name,
+ buf.data (), collect_size));
if (*data->note_data == nullptr)
data->abort_iteration = true;
@@ -108,39 +108,40 @@ gcore_elf_collect_regset_section_cb (const char *sect_name,
cause thread PTID to stop. */
static void
-gcore_elf_collect_thread_registers
- (const struct regcache *regcache, ptid_t ptid, bfd *obfd,
- gdb::unique_xmalloc_ptr<char> *note_data, int *note_size,
- enum gdb_signal stop_signal)
+gcore_elf_collect_thread_registers (const struct regcache *regcache,
+ ptid_t ptid, bfd *obfd,
+ gdb::unique_xmalloc_ptr<char> *note_data,
+ int *note_size,
+ enum gdb_signal stop_signal)
{
struct gdbarch *gdbarch = regcache->arch ();
- gcore_elf_collect_regset_section_cb_data data (gdbarch, regcache, obfd,
- ptid, stop_signal,
- note_data, note_size);
- gdbarch_iterate_over_regset_sections
- (gdbarch, gcore_elf_collect_regset_section_cb, &data, regcache);
+ gcore_elf_collect_regset_section_cb_data data (gdbarch, regcache, obfd, ptid,
+ stop_signal, note_data,
+ note_size);
+ gdbarch_iterate_over_regset_sections (gdbarch,
+ gcore_elf_collect_regset_section_cb,
+ &data, regcache);
}
/* See gcore-elf.h. */
void
-gcore_elf_build_thread_register_notes
- (struct gdbarch *gdbarch, struct thread_info *info, gdb_signal stop_signal,
- bfd *obfd, gdb::unique_xmalloc_ptr<char> *note_data, int *note_size)
+gcore_elf_build_thread_register_notes (
+ struct gdbarch *gdbarch, struct thread_info *info, gdb_signal stop_signal,
+ bfd *obfd, gdb::unique_xmalloc_ptr<char> *note_data, int *note_size)
{
struct regcache *regcache
- = get_thread_arch_regcache (info->inf->process_target (),
- info->ptid, gdbarch);
+ = get_thread_arch_regcache (info->inf->process_target (), info->ptid,
+ gdbarch);
target_fetch_registers (regcache, -1);
- gcore_elf_collect_thread_registers (regcache, info->ptid, obfd,
- note_data, note_size, stop_signal);
+ gcore_elf_collect_thread_registers (regcache, info->ptid, obfd, note_data,
+ note_size, stop_signal);
}
/* See gcore-elf.h. */
void
-gcore_elf_make_tdesc_note (bfd *obfd,
- gdb::unique_xmalloc_ptr<char> *note_data,
+gcore_elf_make_tdesc_note (bfd *obfd, gdb::unique_xmalloc_ptr<char> *note_data,
int *note_size)
{
/* Append the target description to the core file. */
@@ -159,8 +160,7 @@ gcore_elf_make_tdesc_note (bfd *obfd,
/* Now add the target description into the core file. */
note_data->reset (elfcore_write_register_note (obfd,
note_data->release (),
- note_size,
- ".gdb-tdesc", tdesc_xml,
- tdesc_len));
+ note_size, ".gdb-tdesc",
+ tdesc_xml, tdesc_len));
}
}
diff --git a/gdb/gcore-elf.h b/gdb/gcore-elf.h
index 4803efdf32d..ff65bebf798 100644
--- a/gdb/gcore-elf.h
+++ b/gdb/gcore-elf.h
@@ -17,7 +17,7 @@
/* This file contains generic functions for writing ELF based core files. */
-#if !defined (GCORE_ELF_H)
+#if !defined(GCORE_ELF_H)
#define GCORE_ELF_H 1
#include "gdb_bfd.h"
@@ -32,16 +32,17 @@ struct thread_info;
STOP_SIGNAL. The core file is being written to OBFD, and GDBARCH is the
architecture for which the core file is being generated. */
-extern void gcore_elf_build_thread_register_notes
- (struct gdbarch *gdbarch, struct thread_info *info, gdb_signal stop_signal,
- bfd *obfd, gdb::unique_xmalloc_ptr<char> *note_data, int *note_size);
+extern void gcore_elf_build_thread_register_notes (
+ struct gdbarch *gdbarch, struct thread_info *info, gdb_signal stop_signal,
+ bfd *obfd, gdb::unique_xmalloc_ptr<char> *note_data, int *note_size);
/* Add content to *NOTE_DATA (and update *NOTE_SIZE) to include a note
containing the current targtet's target description. The core file is
being written to OBFD. If something goes wrong then *NOTE_DATA can be
set to nullptr. */
-extern void gcore_elf_make_tdesc_note
- (bfd *obfd, gdb::unique_xmalloc_ptr<char> *note_data, int *note_size);
+extern void
+gcore_elf_make_tdesc_note (bfd *obfd, gdb::unique_xmalloc_ptr<char> *note_data,
+ int *note_size);
#endif /* GCORE_ELF_H */
diff --git a/gdb/gcore.c b/gdb/gcore.c
index 973abadb013..f3570a830ec 100644
--- a/gdb/gcore.c
+++ b/gdb/gcore.c
@@ -57,7 +57,7 @@ create_gcore_bfd (const char *filename)
gdb_bfd_ref_ptr obfd (gdb_bfd_openw (filename, default_gcore_target ()));
if (obfd == NULL)
- error (_("Failed to open '%s' for output."), filename);
+ error (_ ("Failed to open '%s' for output."), filename);
bfd_set_format (obfd.get (), bfd_core);
bfd_set_arch_mach (obfd.get (), default_gcore_arch (), 0);
return obfd;
@@ -79,19 +79,18 @@ write_gcore_file_1 (bfd *obfd)
if (!gdbarch_make_corefile_notes_p (target_gdbarch ()))
note_data = target_make_corefile_notes (obfd, &note_size);
else
- note_data = gdbarch_make_corefile_notes (target_gdbarch (), obfd,
- &note_size);
+ note_data
+ = gdbarch_make_corefile_notes (target_gdbarch (), obfd, &note_size);
if (note_data == NULL || note_size == 0)
- error (_("Target does not support core file generation."));
+ error (_ ("Target does not support core file generation."));
/* Create the note section. */
note_sec = bfd_make_section_anyway_with_flags (obfd, "note0",
SEC_HAS_CONTENTS
- | SEC_READONLY
- | SEC_ALLOC);
+ | SEC_READONLY | SEC_ALLOC);
if (note_sec == NULL)
- error (_("Failed to create 'note' section for corefile: %s"),
+ error (_ ("Failed to create 'note' section for corefile: %s"),
bfd_errmsg (bfd_get_error ()));
bfd_set_section_vma (note_sec, 0);
@@ -100,12 +99,12 @@ write_gcore_file_1 (bfd *obfd)
/* Now create the memory/load sections. */
if (gcore_memory_sections (obfd) == 0)
- error (_("gcore: failed to get corefile memory sections from target."));
+ error (_ ("gcore: failed to get corefile memory sections from target."));
/* Write out the contents of the note section. */
if (!bfd_set_section_contents (obfd, note_sec, note_data.get (), 0,
note_size))
- warning (_("writing note section (%s)"), bfd_errmsg (bfd_get_error ()));
+ warning (_ ("writing note section (%s)"), bfd_errmsg (bfd_get_error ()));
}
/* write_gcore_file -- helper for gcore_command (exported).
@@ -115,7 +114,10 @@ void
write_gcore_file (bfd *obfd)
{
target_prepare_to_generate_core ();
- SCOPE_EXIT { target_done_generating_core (); };
+ SCOPE_EXIT
+ {
+ target_done_generating_core ();
+ };
write_gcore_file_1 (obfd);
}
@@ -140,8 +142,7 @@ gcore_command (const char *args, int from_tty)
}
if (info_verbose)
- gdb_printf ("Opening corefile '%s' for output.\n",
- corefilename.get ());
+ gdb_printf ("Opening corefile '%s' for output.\n", corefilename.get ());
if (target_supports_dumpcore ())
target_dumpcore (corefilename.get ());
@@ -166,12 +167,13 @@ gcore_command (const char *args, int from_tty)
static enum bfd_architecture
default_gcore_arch (void)
{
- const struct bfd_arch_info *bfdarch = gdbarch_bfd_arch_info (target_gdbarch ());
+ const struct bfd_arch_info *bfdarch
+ = gdbarch_bfd_arch_info (target_gdbarch ());
if (bfdarch != NULL)
return bfdarch->arch;
if (current_program_space->exec_bfd () == NULL)
- error (_("Can't find bfd architecture for corefile (need execfile)."));
+ error (_ ("Can't find bfd architecture for corefile (need execfile)."));
return bfd_get_arch (current_program_space->exec_bfd ());
}
@@ -268,8 +270,8 @@ call_target_sbrk (int sbrk_arg)
return (bfd_vma) 0;
gdbarch = sbrk_objf->arch ();
- target_sbrk_arg = value_from_longest (builtin_type (gdbarch)->builtin_int,
- sbrk_arg);
+ target_sbrk_arg
+ = value_from_longest (builtin_type (gdbarch)->builtin_int, sbrk_arg);
gdb_assert (target_sbrk_arg);
ret = call_function_by_hand (sbrk_fn, NULL, target_sbrk_arg);
if (ret == NULL)
@@ -363,11 +365,11 @@ make_output_phdrs (bfd *obfd, asection *osec)
else
p_type = PT_NULL;
- p_flags |= PF_R; /* Segment is readable. */
+ p_flags |= PF_R; /* Segment is readable. */
if (!(bfd_section_flags (osec) & SEC_READONLY))
- p_flags |= PF_W; /* Segment is writable. */
+ p_flags |= PF_W; /* Segment is writable. */
if (bfd_section_flags (osec) & SEC_CODE)
- p_flags |= PF_X; /* Segment is executable. */
+ p_flags |= PF_X; /* Segment is executable. */
bfd_record_phdr (obfd, p_type, 1, p_flags, 0, 0, 0, 0, 1, &osec);
}
@@ -395,8 +397,8 @@ gcore_create_callback (CORE_ADDR vaddr, unsigned long size, int read,
{
if (info_verbose)
{
- gdb_printf ("Ignore segment, %s bytes at %s\n",
- plongest (size), paddress (target_gdbarch (), vaddr));
+ gdb_printf ("Ignore segment, %s bytes at %s\n", plongest (size),
+ paddress (target_gdbarch (), vaddr));
}
return 0;
@@ -430,7 +432,7 @@ gcore_create_callback (CORE_ADDR vaddr, unsigned long size, int read,
&& !(bfd_get_file_flags (abfd) & BFD_IN_MEMORY))
{
flags &= ~(SEC_LOAD | SEC_HAS_CONTENTS);
- goto keep; /* Break out of two nested for loops. */
+ goto keep; /* Break out of two nested for loops. */
}
}
@@ -448,15 +450,15 @@ gcore_create_callback (CORE_ADDR vaddr, unsigned long size, int read,
osec = bfd_make_section_anyway_with_flags (obfd, "load", flags);
if (osec == NULL)
{
- warning (_("Couldn't make gcore segment: %s"),
+ warning (_ ("Couldn't make gcore segment: %s"),
bfd_errmsg (bfd_get_error ()));
return 1;
}
if (info_verbose)
{
- gdb_printf ("Save segment, %s bytes at %s\n",
- plongest (size), paddress (target_gdbarch (), vaddr));
+ gdb_printf ("Save segment, %s bytes at %s\n", plongest (size),
+ paddress (target_gdbarch (), vaddr));
}
bfd_set_section_size (osec, size);
@@ -492,15 +494,16 @@ gcore_create_memtag_section_callback (CORE_ADDR vaddr, unsigned long size,
if (memtag_section == nullptr)
{
- warning (_("Couldn't make gcore memory tag segment: %s"),
+ warning (_ ("Couldn't make gcore memory tag segment: %s"),
bfd_errmsg (bfd_get_error ()));
return 1;
}
if (info_verbose)
{
- gdb_printf (gdb_stdout, "Saved memory tag segment, %s bytes "
- "at %s\n",
+ gdb_printf (gdb_stdout,
+ "Saved memory tag segment, %s bytes "
+ "at %s\n",
plongest (bfd_section_size (memtag_section)),
paddress (target_gdbarch (), vaddr));
}
@@ -535,8 +538,8 @@ objfile_find_memory_regions (struct target_ops *self,
ret = (*func) (objsec->addr (), size,
1, /* All sections will be readable. */
(flags & SEC_READONLY) == 0, /* Writable. */
- (flags & SEC_CODE) != 0, /* Executable. */
- 1, /* MODIFIED is unknown, pass it as true. */
+ (flags & SEC_CODE) != 0, /* Executable. */
+ 1, /* MODIFIED is unknown, pass it as true. */
false, /* No memory tags in the object file. */
obfd);
if (ret != 0)
@@ -547,10 +550,10 @@ objfile_find_memory_regions (struct target_ops *self,
/* Make a stack segment. */
if (derive_stack_segment (&temp_bottom, &temp_top))
(*func) (temp_bottom, temp_top - temp_bottom,
- 1, /* Stack section will be readable. */
- 1, /* Stack section will be writable. */
- 0, /* Stack section will not be executable. */
- 1, /* Stack section will be modified. */
+ 1, /* Stack section will be readable. */
+ 1, /* Stack section will be writable. */
+ 0, /* Stack section will not be executable. */
+ 1, /* Stack section will be modified. */
false, /* No memory tags in the object file. */
obfd);
@@ -558,10 +561,10 @@ objfile_find_memory_regions (struct target_ops *self,
if (derive_heap_segment (current_program_space->exec_bfd (), &temp_bottom,
&temp_top))
(*func) (temp_bottom, temp_top - temp_bottom,
- 1, /* Heap section will be readable. */
- 1, /* Heap section will be writable. */
- 0, /* Heap section will not be executable. */
- 1, /* Heap section will be modified. */
+ 1, /* Heap section will be readable. */
+ 1, /* Heap section will be writable. */
+ 0, /* Heap section will not be executable. */
+ 1, /* Heap section will be modified. */
false, /* No memory tags in the object file. */
obfd);
@@ -590,19 +593,20 @@ gcore_copy_callback (bfd *obfd, asection *osec)
if (size > total_size)
size = total_size;
- if (target_read_memory (bfd_section_vma (osec) + offset,
- memhunk.data (), size) != 0)
+ if (target_read_memory (bfd_section_vma (osec) + offset, memhunk.data (),
+ size)
+ != 0)
{
- warning (_("Memory read failed for corefile "
- "section, %s bytes at %s."),
+ warning (_ ("Memory read failed for corefile "
+ "section, %s bytes at %s."),
plongest (size),
paddress (target_gdbarch (), bfd_section_vma (osec)));
break;
}
- if (!bfd_set_section_contents (obfd, osec, memhunk.data (),
- offset, size))
+ if (!bfd_set_section_contents (obfd, osec, memhunk.data (), offset,
+ size))
{
- warning (_("Failed to write corefile contents (%s)."),
+ warning (_ ("Failed to write corefile contents (%s)."),
bfd_errmsg (bfd_get_error ()));
break;
}
@@ -623,7 +627,7 @@ gcore_copy_memtag_section_callback (bfd *obfd, asection *osec)
/* Fill the section with memory tag contents. */
if (!gdbarch_fill_memtag_section (target_gdbarch (), osec))
- error (_("Failed to fill memory tag section for core file."));
+ error (_ ("Failed to fill memory tag section for core file."));
}
static int
@@ -631,21 +635,24 @@ gcore_memory_sections (bfd *obfd)
{
/* Try gdbarch method first, then fall back to target method. */
if (!gdbarch_find_memory_regions_p (target_gdbarch ())
- || gdbarch_find_memory_regions (target_gdbarch (),
- gcore_create_callback, obfd) != 0)
+ || gdbarch_find_memory_regions (target_gdbarch (), gcore_create_callback,
+ obfd)
+ != 0)
{
if (target_find_memory_regions (gcore_create_callback, obfd) != 0)
- return 0; /* FIXME: error return/msg? */
+ return 0; /* FIXME: error return/msg? */
}
/* Take care of dumping memory tags, if there are any. */
if (!gdbarch_find_memory_regions_p (target_gdbarch ())
|| gdbarch_find_memory_regions (target_gdbarch (),
gcore_create_memtag_section_callback,
- obfd) != 0)
+ obfd)
+ != 0)
{
if (target_find_memory_regions (gcore_create_memtag_section_callback,
- obfd) != 0)
+ obfd)
+ != 0)
return 0;
}
@@ -685,11 +692,12 @@ gcore_find_signalled_thread ()
}
void _initialize_gcore ();
+
void
_initialize_gcore ()
{
cmd_list_element *generate_core_file_cmd
- = add_com ("generate-core-file", class_files, gcore_command, _("\
+ = add_com ("generate-core-file", class_files, gcore_command, _ ("\
Save a core file with the current state of the debugged process.\n\
Usage: generate-core-file [FILENAME]\n\
Argument is optional filename. Default filename is 'core.PROCESS_ID'."));
diff --git a/gdb/gcore.h b/gdb/gcore.h
index 1529a49aaac..fca0e5a055e 100644
--- a/gdb/gcore.h
+++ b/gdb/gcore.h
@@ -17,7 +17,7 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
-#if !defined (GCORE_H)
+#if !defined(GCORE_H)
#define GCORE_H 1
#include "gdb_bfd.h"
diff --git a/gdb/gdb-demangle.c b/gdb/gdb-demangle.c
index 3af3182572b..063f1af6130 100644
--- a/gdb/gdb-demangle.c
+++ b/gdb/gdb-demangle.c
@@ -19,7 +19,6 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
-
/* This file contains support code for C++ demangling that is common
to a styles of demangling, and GDB specific. */
@@ -47,12 +46,12 @@
bool demangle = true;
static void
-show_demangle (struct ui_file *file, int from_tty,
- struct cmd_list_element *c, const char *value)
+show_demangle (struct ui_file *file, int from_tty, struct cmd_list_element *c,
+ const char *value)
{
gdb_printf (file,
- _("Demangling of encoded C++/ObjC names "
- "when displaying symbols is %s.\n"),
+ _ ("Demangling of encoded C++/ObjC names "
+ "when displaying symbols is %s.\n"),
value);
}
@@ -64,8 +63,8 @@ show_asm_demangle (struct ui_file *file, int from_tty,
struct cmd_list_element *c, const char *value)
{
gdb_printf (file,
- _("Demangling of C++/ObjC names in "
- "disassembly listings is %s.\n"),
+ _ ("Demangling of C++/ObjC names in "
+ "disassembly listings is %s.\n"),
value);
}
@@ -79,11 +78,12 @@ static const char *current_demangling_style_string;
_initialize_demangler from libiberty_demanglers[] array. */
static const char **demangling_style_names;
+
static void
-show_demangling_style_names(struct ui_file *file, int from_tty,
- struct cmd_list_element *c, const char *value)
+show_demangling_style_names (struct ui_file *file, int from_tty,
+ struct cmd_list_element *c, const char *value)
{
- gdb_printf (file, _("The current C++ demangling style is \"%s\".\n"),
+ gdb_printf (file, _ ("The current C++ demangling style is \"%s\".\n"),
value);
}
@@ -104,8 +104,8 @@ show_demangling_style_names(struct ui_file *file, int from_tty,
a malloc'd string, even if it is a null-string. */
static void
-set_demangling_command (const char *ignore,
- int from_tty, struct cmd_list_element *c)
+set_demangling_command (const char *ignore, int from_tty,
+ struct cmd_list_element *c)
{
const struct demangler_engine *dem;
int i;
@@ -116,11 +116,10 @@ set_demangling_command (const char *ignore,
If we match, update the current demangling style enum. */
for (dem = libiberty_demanglers, i = 0;
- dem->demangling_style != unknown_demangling;
- dem++)
+ dem->demangling_style != unknown_demangling; dem++)
{
- if (strcmp (current_demangling_style_string,
- dem->demangling_style_name) == 0)
+ if (strcmp (current_demangling_style_string, dem->demangling_style_name)
+ == 0)
{
current_demangling_style = dem->demangling_style;
current_demangling_style_string = demangling_style_names[i];
@@ -145,7 +144,7 @@ set_demangling_command (const char *ignore,
meaning. We don't currently try to handle '_' because the precise forms
of the names are different on those targets. */
-static char cplus_markers[] = {'$', '.', '\0'};
+static char cplus_markers[] = { '$', '.', '\0' };
/* See documentation in gdb-demangle.h. */
@@ -169,8 +168,7 @@ demangle_command (const char *args, int from_tty)
arg_start = arg_buf.c_str ();
std::string lang_name;
- while (processing_args
- && *arg_start == '-')
+ while (processing_args && *arg_start == '-')
{
const char *p = skip_to_space (arg_start);
@@ -187,7 +185,7 @@ demangle_command (const char *args, int from_tty)
name = arg_start;
if (*name == '\0')
- error (_("Usage: demangle [-l LANGUAGE] [--] NAME"));
+ error (_ ("Usage: demangle [-l LANGUAGE] [--] NAME"));
if (!lang_name.empty ())
{
@@ -195,7 +193,7 @@ demangle_command (const char *args, int from_tty)
lang_enum = language_enum (lang_name.c_str ());
if (lang_enum == language_unknown)
- error (_("Unknown language \"%s\""), lang_name.c_str ());
+ error (_ ("Unknown language \"%s\""), lang_name.c_str ());
lang = language_def (lang_enum);
}
else
@@ -206,10 +204,11 @@ demangle_command (const char *args, int from_tty)
if (demangled != NULL)
gdb_printf ("%s\n", demangled.get ());
else
- error (_("Can't demangle \"%s\""), name);
+ error (_ ("Can't demangle \"%s\""), name);
}
void _initialize_gdb_demangle ();
+
void
_initialize_gdb_demangle ()
{
@@ -218,12 +217,11 @@ _initialize_gdb_demangle ()
/* Fill the demangling_style_names[] array, and set the default
demangling style chosen at compilation time. */
for (ndems = 0;
- libiberty_demanglers[ndems].demangling_style != unknown_demangling;
+ libiberty_demanglers[ndems].demangling_style != unknown_demangling;
ndems++)
;
demangling_style_names = XCNEWVEC (const char *, ndems + 1);
- for (i = 0;
- libiberty_demanglers[i].demangling_style != unknown_demangling;
+ for (i = 0; libiberty_demanglers[i].demangling_style != unknown_demangling;
i++)
{
demangling_style_names[i]
@@ -234,31 +232,32 @@ _initialize_gdb_demangle ()
current_demangling_style_string = demangling_style_names[i];
}
- add_setshow_boolean_cmd ("demangle", class_support, &demangle, _("\
-Set demangling of encoded C++/ObjC names when displaying symbols."), _("\
-Show demangling of encoded C++/ObjC names when displaying symbols."), NULL,
- NULL,
- show_demangle,
- &setprintlist, &showprintlist);
+ add_setshow_boolean_cmd ("demangle", class_support, &demangle, _ ("\
+Set demangling of encoded C++/ObjC names when displaying symbols."),
+ _ ("\
+Show demangling of encoded C++/ObjC names when displaying symbols."),
+ NULL, NULL, show_demangle, &setprintlist,
+ &showprintlist);
- add_setshow_boolean_cmd ("asm-demangle", class_support, &asm_demangle, _("\
-Set demangling of C++/ObjC names in disassembly listings."), _("\
-Show demangling of C++/ObjC names in disassembly listings."), NULL,
- NULL,
- show_asm_demangle,
- &setprintlist, &showprintlist);
+ add_setshow_boolean_cmd ("asm-demangle", class_support, &asm_demangle, _ ("\
+Set demangling of C++/ObjC names in disassembly listings."),
+ _ ("\
+Show demangling of C++/ObjC names in disassembly listings."),
+ NULL, NULL, show_asm_demangle, &setprintlist,
+ &showprintlist);
add_setshow_enum_cmd ("demangle-style", class_support,
demangling_style_names,
- &current_demangling_style_string, _("\
-Set the current C++ demangling style."), _("\
-Show the current C++ demangling style."), _("\
+ &current_demangling_style_string, _ ("\
+Set the current C++ demangling style."),
+ _ ("\
+Show the current C++ demangling style."),
+ _ ("\
Use `set demangle-style' without arguments for a list of demangling styles."),
- set_demangling_command,
- show_demangling_style_names,
+ set_demangling_command, show_demangling_style_names,
&setlist, &showlist);
- add_cmd ("demangle", class_support, demangle_command, _("\
+ add_cmd ("demangle", class_support, demangle_command, _ ("\
Demangle a mangled name.\n\
Usage: demangle [-l LANGUAGE] [--] NAME\n\
If LANGUAGE is not specified, NAME is demangled in the current language."),
diff --git a/gdb/gdb-stabs.h b/gdb/gdb-stabs.h
index dff5ddf14cc..b207704d071 100644
--- a/gdb/gdb-stabs.h
+++ b/gdb/gdb-stabs.h
@@ -26,53 +26,52 @@
structures makes the stabs-oriented symbol readers able to call
each others' functions as required. */
-
/* Information is passed among various dbxread routines for accessing
symbol files. A pointer to this structure is kept in the objfile,
using the dbx_objfile_data_key. */
struct dbx_symfile_info
- {
- ~dbx_symfile_info ();
-
- CORE_ADDR text_addr = 0; /* Start of text section */
- int text_size = 0; /* Size of text section */
- int symcount = 0; /* How many symbols are there in the file */
- char *stringtab = nullptr; /* The actual string table */
- int stringtab_size = 0; /* Its size */
- file_ptr symtab_offset = 0; /* Offset in file to symbol table */
- int symbol_size = 0; /* Bytes in a single symbol */
-
- /* See stabsread.h for the use of the following. */
- struct header_file *header_files = nullptr;
- int n_header_files = 0;
- int n_allocated_header_files = 0;
-
- /* Pointers to BFD sections. These are used to speed up the building of
+{
+ ~dbx_symfile_info ();
+
+ CORE_ADDR text_addr = 0; /* Start of text section */
+ int text_size = 0; /* Size of text section */
+ int symcount = 0; /* How many symbols are there in the file */
+ char *stringtab = nullptr; /* The actual string table */
+ int stringtab_size = 0; /* Its size */
+ file_ptr symtab_offset = 0; /* Offset in file to symbol table */
+ int symbol_size = 0; /* Bytes in a single symbol */
+
+ /* See stabsread.h for the use of the following. */
+ struct header_file *header_files = nullptr;
+ int n_header_files = 0;
+ int n_allocated_header_files = 0;
+
+ /* Pointers to BFD sections. These are used to speed up the building of
minimal symbols. */
- asection *text_section = nullptr;
- asection *data_section = nullptr;
- asection *bss_section = nullptr;
+ asection *text_section = nullptr;
+ asection *data_section = nullptr;
+ asection *bss_section = nullptr;
- /* Pointer to the separate ".stab" section, if there is one. */
- asection *stab_section = nullptr;
- };
+ /* Pointer to the separate ".stab" section, if there is one. */
+ asection *stab_section = nullptr;
+};
/* The tag used to find the DBX info attached to an objfile. This is
global because it is referenced by several modules. */
extern const registry<objfile>::key<dbx_symfile_info> dbx_objfile_data_key;
-#define DBX_SYMFILE_INFO(o) (dbx_objfile_data_key.get (o))
-#define DBX_TEXT_ADDR(o) (DBX_SYMFILE_INFO(o)->text_addr)
-#define DBX_TEXT_SIZE(o) (DBX_SYMFILE_INFO(o)->text_size)
-#define DBX_SYMCOUNT(o) (DBX_SYMFILE_INFO(o)->symcount)
-#define DBX_STRINGTAB(o) (DBX_SYMFILE_INFO(o)->stringtab)
-#define DBX_STRINGTAB_SIZE(o) (DBX_SYMFILE_INFO(o)->stringtab_size)
-#define DBX_SYMTAB_OFFSET(o) (DBX_SYMFILE_INFO(o)->symtab_offset)
-#define DBX_SYMBOL_SIZE(o) (DBX_SYMFILE_INFO(o)->symbol_size)
-#define DBX_TEXT_SECTION(o) (DBX_SYMFILE_INFO(o)->text_section)
-#define DBX_DATA_SECTION(o) (DBX_SYMFILE_INFO(o)->data_section)
-#define DBX_BSS_SECTION(o) (DBX_SYMFILE_INFO(o)->bss_section)
-#define DBX_STAB_SECTION(o) (DBX_SYMFILE_INFO(o)->stab_section)
+#define DBX_SYMFILE_INFO(o) (dbx_objfile_data_key.get (o))
+#define DBX_TEXT_ADDR(o) (DBX_SYMFILE_INFO (o)->text_addr)
+#define DBX_TEXT_SIZE(o) (DBX_SYMFILE_INFO (o)->text_size)
+#define DBX_SYMCOUNT(o) (DBX_SYMFILE_INFO (o)->symcount)
+#define DBX_STRINGTAB(o) (DBX_SYMFILE_INFO (o)->stringtab)
+#define DBX_STRINGTAB_SIZE(o) (DBX_SYMFILE_INFO (o)->stringtab_size)
+#define DBX_SYMTAB_OFFSET(o) (DBX_SYMFILE_INFO (o)->symtab_offset)
+#define DBX_SYMBOL_SIZE(o) (DBX_SYMFILE_INFO (o)->symbol_size)
+#define DBX_TEXT_SECTION(o) (DBX_SYMFILE_INFO (o)->text_section)
+#define DBX_DATA_SECTION(o) (DBX_SYMFILE_INFO (o)->data_section)
+#define DBX_BSS_SECTION(o) (DBX_SYMFILE_INFO (o)->bss_section)
+#define DBX_STAB_SECTION(o) (DBX_SYMFILE_INFO (o)->stab_section)
#endif /* GDB_STABS_H */
diff --git a/gdb/gdb_bfd.c b/gdb/gdb_bfd.c
index b05c78218ed..5a5fb8bbb92 100644
--- a/gdb/gdb_bfd.c
+++ b/gdb/gdb_bfd.c
@@ -73,9 +73,7 @@ struct gdb_bfd_data
{
}
- ~gdb_bfd_data ()
- {
- }
+ ~gdb_bfd_data () {}
/* The reference count. */
int refc = 1;
@@ -131,11 +129,12 @@ static htab_t gdb_bfd_cache;
modification time, and file size all match. */
static bool bfd_sharing = true;
+
static void
-show_bfd_sharing (struct ui_file *file, int from_tty,
- struct cmd_list_element *c, const char *value)
+show_bfd_sharing (struct ui_file *file, int from_tty,
+ struct cmd_list_element *c, const char *value)
{
- gdb_printf (file, _("BFD sharing is %s.\n"), value);
+ gdb_printf (file, _ ("BFD sharing is %s.\n"), value);
}
/* When true debugging of the bfd caches is enabled. */
@@ -151,7 +150,7 @@ static void
show_bfd_cache_debug (struct ui_file *file, int from_tty,
struct cmd_list_element *c, const char *value)
{
- gdb_printf (file, _("BFD cache debugging is %s.\n"), value);
+ gdb_printf (file, _ ("BFD cache debugging is %s.\n"), value);
}
/* The type of an object being looked up in gdb_bfd_cache. We use
@@ -194,10 +193,8 @@ eq_bfd (const void *a, const void *b)
= (const struct gdb_bfd_cache_search *) b;
struct gdb_bfd_data *gdata = (struct gdb_bfd_data *) bfd_usrdata (abfd);
- return (gdata->mtime == s->mtime
- && gdata->size == s->size
- && gdata->inode == s->inode
- && gdata->device_id == s->device_id
+ return (gdata->mtime == s->mtime && gdata->size == s->size
+ && gdata->inode == s->inode && gdata->device_id == s->device_id
&& strcmp (bfd_get_filename (abfd), s->filename) == 0);
}
@@ -233,19 +230,17 @@ struct target_buffer
}
/* Return the size of the in-memory BFD file. */
- ULONGEST size () const
- { return m_size; }
+ ULONGEST size () const { return m_size; }
/* Return the base address of the in-memory BFD file. */
- CORE_ADDR base () const
- { return m_base; }
+ CORE_ADDR base () const { return m_base; }
/* Return a generated filename for the in-memory BFD file. The generated
name will include the M_BASE value. */
- const char *filename () const
- { return m_filename.get (); }
+ const char *filename () const { return m_filename.get (); }
private:
+
/* The base address of the in-memory BFD file. */
CORE_ADDR m_base;
@@ -309,7 +304,7 @@ mem_bfd_iovec_pread (struct bfd *abfd, void *stream, void *buf,
static int
mem_bfd_iovec_stat (struct bfd *abfd, void *stream, struct stat *sb)
{
- struct target_buffer *buffer = (struct target_buffer*) stream;
+ struct target_buffer *buffer = (struct target_buffer *) stream;
memset (sb, 0, sizeof (struct stat));
sb->st_size = buffer->size ();
@@ -324,11 +319,8 @@ gdb_bfd_open_from_target_memory (CORE_ADDR addr, ULONGEST size,
{
struct target_buffer *buffer = new target_buffer (addr, size);
- return gdb_bfd_openr_iovec (buffer->filename (), target,
- mem_bfd_iovec_open,
- buffer,
- mem_bfd_iovec_pread,
- mem_bfd_iovec_close,
+ return gdb_bfd_openr_iovec (buffer->filename (), target, mem_bfd_iovec_open,
+ buffer, mem_bfd_iovec_pread, mem_bfd_iovec_close,
mem_bfd_iovec_stat);
}
@@ -385,9 +377,8 @@ gdb_bfd_iovec_fileio_pread (struct bfd *abfd, void *stream, void *buf,
{
QUIT;
- bytes = target_fileio_pread (fd, (gdb_byte *) buf + pos,
- nbytes - pos, offset + pos,
- &target_errno);
+ bytes = target_fileio_pread (fd, (gdb_byte *) buf + pos, nbytes - pos,
+ offset + pos, &target_errno);
if (bytes == 0)
/* Success, but no bytes, means end-of-file. */
break;
@@ -410,7 +401,7 @@ gdb_bfd_iovec_fileio_pread (struct bfd *abfd, void *stream, void *buf,
static void
gdb_bfd_close_warning (const char *name, const char *reason)
{
- warning (_("cannot close \"%s\": %s"), name, reason);
+ warning (_ ("cannot close \"%s\": %s"), name, reason);
}
/* Wrapper for target_fileio_close suitable for passing as the
@@ -433,8 +424,7 @@ gdb_bfd_iovec_fileio_close (struct bfd *abfd, void *stream)
catch (const gdb_exception &ex)
{
/* Also avoid crossing exceptions over bfd. */
- gdb_bfd_close_warning (bfd_get_filename (abfd),
- ex.message->c_str ());
+ gdb_bfd_close_warning (bfd_get_filename (abfd), ex.message->c_str ());
}
/* Zero means success. */
@@ -445,8 +435,7 @@ gdb_bfd_iovec_fileio_close (struct bfd *abfd, void *stream)
STAT_FUNC argument to gdb_bfd_openr_iovec. */
static int
-gdb_bfd_iovec_fileio_fstat (struct bfd *abfd, void *stream,
- struct stat *sb)
+gdb_bfd_iovec_fileio_fstat (struct bfd *abfd, void *stream, struct stat *sb)
{
int fd = *(int *) stream;
fileio_error target_errno;
@@ -488,8 +477,7 @@ gdb_bfd_init_data (struct bfd *abfd, struct stat *st)
/* See gdb_bfd.h. */
gdb_bfd_ref_ptr
-gdb_bfd_open (const char *name, const char *target, int fd,
- bool warn_if_slow)
+gdb_bfd_open (const char *name, const char *target, int fd, bool warn_if_slow)
{
hashval_t hash;
void **slot;
@@ -503,9 +491,9 @@ gdb_bfd_open (const char *name, const char *target, int fd,
{
gdb_assert (fd == -1);
- gdb_bfd_open_closure open_closure { current_inferior (), warn_if_slow };
- return gdb_bfd_openr_iovec (name, target,
- gdb_bfd_iovec_fileio_open,
+ gdb_bfd_open_closure open_closure { current_inferior (),
+ warn_if_slow };
+ return gdb_bfd_openr_iovec (name, target, gdb_bfd_iovec_fileio_open,
&open_closure,
gdb_bfd_iovec_fileio_pread,
gdb_bfd_iovec_fileio_close,
@@ -516,8 +504,8 @@ gdb_bfd_open (const char *name, const char *target, int fd,
}
if (gdb_bfd_cache == NULL)
- gdb_bfd_cache = htab_create_alloc (1, hash_bfd, eq_bfd, NULL,
- xcalloc, xfree);
+ gdb_bfd_cache
+ = htab_create_alloc (1, hash_bfd, eq_bfd, NULL, xcalloc, xfree);
if (fd == -1)
{
@@ -624,8 +612,7 @@ gdb_bfd_close_or_warn (struct bfd *abfd)
ret = bfd_close (abfd);
if (!ret)
- gdb_bfd_close_warning (name,
- bfd_errmsg (bfd_get_error ()));
+ gdb_bfd_close_warning (name, bfd_errmsg (bfd_get_error ()));
return ret;
}
@@ -697,15 +684,15 @@ gdb_bfd_unref (struct bfd *abfd)
search.size = gdata->size;
search.inode = gdata->inode;
search.device_id = gdata->device_id;
- slot = htab_find_slot_with_hash (gdb_bfd_cache, &search, hash,
- NO_INSERT);
+ slot
+ = htab_find_slot_with_hash (gdb_bfd_cache, &search, hash, NO_INSERT);
if (slot && *slot)
htab_clear_slot (gdb_bfd_cache, slot);
}
delete gdata;
- bfd_set_usrdata (abfd, NULL); /* Paranoia. */
+ bfd_set_usrdata (abfd, NULL); /* Paranoia. */
htab_remove_elt (all_bfds, abfd);
@@ -727,8 +714,8 @@ get_section_descriptor (asection *section)
if (result == NULL)
{
- result = ((struct gdb_bfd_section_data *)
- bfd_zalloc (section->owner, sizeof (*result)));
+ result = ((struct gdb_bfd_section_data *) bfd_zalloc (section->owner,
+ sizeof (*result)));
bfd_set_section_userdata (section, result);
}
@@ -770,12 +757,12 @@ gdb_bfd_map_section (asection *sectp, bfd_size_type *size)
if (bfd_section_size (sectp) > 4 * pagesize)
{
descriptor->size = bfd_section_size (sectp);
- descriptor->data = bfd_mmap (abfd, 0, descriptor->size, PROT_READ,
- MAP_PRIVATE, sectp->filepos,
- &descriptor->map_addr,
- &descriptor->map_len);
+ descriptor->data
+ = bfd_mmap (abfd, 0, descriptor->size, PROT_READ, MAP_PRIVATE,
+ sectp->filepos, &descriptor->map_addr,
+ &descriptor->map_len);
- if ((caddr_t)descriptor->data != MAP_FAILED)
+ if ((caddr_t) descriptor->data != MAP_FAILED)
{
#if HAVE_POSIX_MADVISE
posix_madvise (descriptor->map_addr, descriptor->map_len,
@@ -799,9 +786,8 @@ gdb_bfd_map_section (asection *sectp, bfd_size_type *size)
data = NULL;
if (!bfd_get_full_section_contents (abfd, sectp, &data))
{
- warning (_("Can't read data for section '%s' in file '%s'"),
- bfd_section_name (sectp),
- bfd_get_filename (abfd));
+ warning (_ ("Can't read data for section '%s' in file '%s'"),
+ bfd_section_name (sectp), bfd_get_filename (abfd));
/* Set size to 0 to prevent further attempts to read the invalid
section. */
*size = 0;
@@ -809,7 +795,7 @@ gdb_bfd_map_section (asection *sectp, bfd_size_type *size)
}
descriptor->data = data;
- done:
+done:
gdb_assert (descriptor->data != NULL);
*size = descriptor->size;
return (const gdb_byte *) descriptor->data;
@@ -826,7 +812,7 @@ get_file_crc (bfd *abfd, unsigned long *file_crc_return)
if (bfd_seek (abfd, 0, SEEK_SET) != 0)
{
- warning (_("Problem reading \"%s\" for CRC: %s"),
+ warning (_ ("Problem reading \"%s\" for CRC: %s"),
bfd_get_filename (abfd), bfd_errmsg (bfd_get_error ()));
return 0;
}
@@ -839,7 +825,7 @@ get_file_crc (bfd *abfd, unsigned long *file_crc_return)
count = bfd_bread (buffer, sizeof (buffer), abfd);
if (count == (bfd_size_type) -1)
{
- warning (_("Problem reading \"%s\" for CRC: %s"),
+ warning (_ ("Problem reading \"%s\" for CRC: %s"),
bfd_get_filename (abfd), bfd_errmsg (bfd_get_error ()));
return 0;
}
@@ -867,8 +853,6 @@ gdb_bfd_crc (struct bfd *abfd, unsigned long *crc_out)
return gdata->crc_computed;
}
-
-
/* See gdb_bfd.h. */
gdb_bfd_ref_ptr
@@ -904,22 +888,16 @@ gdb_bfd_openw (const char *filename, const char *target)
gdb_bfd_ref_ptr
gdb_bfd_openr_iovec (const char *filename, const char *target,
- void *(*open_func) (struct bfd *nbfd,
- void *open_closure),
+ void *(*open_func) (struct bfd *nbfd, void *open_closure),
void *open_closure,
- file_ptr (*pread_func) (struct bfd *nbfd,
- void *stream,
- void *buf,
- file_ptr nbytes,
+ file_ptr (*pread_func) (struct bfd *nbfd, void *stream,
+ void *buf, file_ptr nbytes,
file_ptr offset),
- int (*close_func) (struct bfd *nbfd,
- void *stream),
- int (*stat_func) (struct bfd *abfd,
- void *stream,
+ int (*close_func) (struct bfd *nbfd, void *stream),
+ int (*stat_func) (struct bfd *abfd, void *stream,
struct stat *sb))
{
- bfd *result = bfd_openr_iovec (filename, target,
- open_func, open_closure,
+ bfd *result = bfd_openr_iovec (filename, target, open_func, open_closure,
pread_func, close_func, stat_func);
return gdb_bfd_ref_ptr::new_reference (result);
@@ -970,8 +948,6 @@ gdb_bfd_record_inclusion (bfd *includer, bfd *includee)
gdata->included_bfds.push_back (gdb_bfd_ref_ptr::new_reference (includee));
}
-
-
gdb_static_assert (ARRAY_SIZE (_bfd_std_section) == 4);
/* See gdb_bfd.h. */
@@ -1038,8 +1014,8 @@ gdb_bfd_get_full_section_contents (bfd *abfd, asection *section,
section_size);
}
-#define AMBIGUOUS_MESS1 ".\nMatching formats:"
-#define AMBIGUOUS_MESS2 \
+#define AMBIGUOUS_MESS1 ".\nMatching formats:"
+#define AMBIGUOUS_MESS2 \
".\nUse \"set gnutarget format-name\" to specify the format."
/* See gdb_bfd.h. */
@@ -1148,11 +1124,11 @@ static bfd_error_handler_type default_bfd_error_handler;
per-inferior basis. */
static void ATTRIBUTE_PRINTF (1, 0)
-gdb_bfd_error_handler (const char *fmt, va_list ap)
+ gdb_bfd_error_handler (const char *fmt, va_list ap)
{
va_list ap_copy;
- va_copy(ap_copy, ap);
+ va_copy (ap_copy, ap);
const std::string str = string_vprintf (fmt, ap_copy);
va_end (ap_copy);
@@ -1167,37 +1143,34 @@ gdb_bfd_error_handler (const char *fmt, va_list ap)
}
void _initialize_gdb_bfd ();
+
void
_initialize_gdb_bfd ()
{
- all_bfds = htab_create_alloc (10, htab_hash_pointer, htab_eq_pointer,
- NULL, xcalloc, xfree);
+ all_bfds = htab_create_alloc (10, htab_hash_pointer, htab_eq_pointer, NULL,
+ xcalloc, xfree);
- add_cmd ("bfds", class_maintenance, maintenance_info_bfds, _("\
+ add_cmd ("bfds", class_maintenance, maintenance_info_bfds, _ ("\
List the BFDs that are currently open."),
&maintenanceinfolist);
- add_setshow_boolean_cmd ("bfd-sharing", no_class,
- &bfd_sharing, _("\
-Set whether gdb will share bfds that appear to be the same file."), _("\
-Show whether gdb will share bfds that appear to be the same file."), _("\
+ add_setshow_boolean_cmd ("bfd-sharing", no_class, &bfd_sharing, _ ("\
+Set whether gdb will share bfds that appear to be the same file."),
+ _ ("\
+Show whether gdb will share bfds that appear to be the same file."),
+ _ ("\
When enabled gdb will reuse existing bfds rather than reopening the\n\
same file. To decide if two files are the same then gdb compares the\n\
filename, file size, file modification time, and file inode."),
- NULL,
- &show_bfd_sharing,
- &maintenance_set_cmdlist,
+ NULL, &show_bfd_sharing, &maintenance_set_cmdlist,
&maintenance_show_cmdlist);
- add_setshow_boolean_cmd ("bfd-cache", class_maintenance,
- &debug_bfd_cache,
- _("Set bfd cache debugging."),
- _("Show bfd cache debugging."),
- _("\
+ add_setshow_boolean_cmd ("bfd-cache", class_maintenance, &debug_bfd_cache,
+ _ ("Set bfd cache debugging."),
+ _ ("Show bfd cache debugging."), _ ("\
When non-zero, bfd cache specific debugging is enabled."),
- NULL,
- &show_bfd_cache_debug,
- &setdebuglist, &showdebuglist);
+ NULL, &show_bfd_cache_debug, &setdebuglist,
+ &showdebuglist);
/* Hook the BFD error/warning handler to limit amount of output. */
default_bfd_error_handler = bfd_set_error_handler (gdb_bfd_error_handler);
diff --git a/gdb/gdb_bfd.h b/gdb/gdb_bfd.h
index d15b1106d9a..b26c9c7c54f 100644
--- a/gdb/gdb_bfd.h
+++ b/gdb/gdb_bfd.h
@@ -63,15 +63,9 @@ void gdb_bfd_unref (struct bfd *abfd);
/* A policy class for gdb::ref_ptr for BFD reference counting. */
struct gdb_bfd_ref_policy
{
- static void incref (struct bfd *abfd)
- {
- gdb_bfd_ref (abfd);
- }
-
- static void decref (struct bfd *abfd)
- {
- gdb_bfd_unref (abfd);
- }
+ static void incref (struct bfd *abfd) { gdb_bfd_ref (abfd); }
+
+ static void decref (struct bfd *abfd) { gdb_bfd_unref (abfd); }
};
/* A gdb::ref_ptr that has been specialized for BFD objects. */
@@ -133,8 +127,6 @@ const gdb_byte *gdb_bfd_map_section (asection *section, bfd_size_type *size);
int gdb_bfd_crc (struct bfd *abfd, unsigned long *crc_out);
-
-
/* A wrapper for bfd_fopen that initializes the gdb-specific reference
count. */
@@ -153,36 +145,26 @@ gdb_bfd_ref_ptr gdb_bfd_openw (const char *, const char *);
/* A wrapper for bfd_openr_iovec that initializes the gdb-specific
reference count. */
-gdb_bfd_ref_ptr gdb_bfd_openr_iovec (const char *filename, const char *target,
- void *(*open_func) (struct bfd *nbfd,
- void *open_closure),
- void *open_closure,
- file_ptr (*pread_func) (struct bfd *nbfd,
- void *stream,
- void *buf,
- file_ptr nbytes,
- file_ptr offset),
- int (*close_func) (struct bfd *nbfd,
- void *stream),
- int (*stat_func) (struct bfd *abfd,
- void *stream,
- struct stat *sb));
+gdb_bfd_ref_ptr gdb_bfd_openr_iovec (
+ const char *filename, const char *target,
+ void *(*open_func) (struct bfd *nbfd, void *open_closure),
+ void *open_closure,
+ file_ptr (*pread_func) (struct bfd *nbfd, void *stream, void *buf,
+ file_ptr nbytes, file_ptr offset),
+ int (*close_func) (struct bfd *nbfd, void *stream),
+ int (*stat_func) (struct bfd *abfd, void *stream, struct stat *sb));
/* A wrapper for bfd_openr_next_archived_file that initializes the
gdb-specific reference count. */
gdb_bfd_ref_ptr gdb_bfd_openr_next_archived_file (bfd *archive, bfd *previous);
-
-
-
/* Return the index of the BFD section SECTION. Ordinarily this is
just the section's index, but for some special sections, like
bfd_com_section_ptr, it will be a synthesized value. */
int gdb_bfd_section_index (bfd *abfd, asection *section);
-
/* Like bfd_count_sections, but include any possible global sections,
like bfd_com_section_ptr. */
diff --git a/gdb/gdb_curses.h b/gdb/gdb_curses.h
index 7ac0ade2a30..38c6b30a851 100644
--- a/gdb/gdb_curses.h
+++ b/gdb/gdb_curses.h
@@ -39,21 +39,21 @@
#define NOMACROS
#define NCURSES_NOMACROS
-#if defined (HAVE_NCURSESW_NCURSES_H)
+#if defined(HAVE_NCURSESW_NCURSES_H)
#include <ncursesw/ncurses.h>
-#elif defined (HAVE_NCURSES_NCURSES_H)
+#elif defined(HAVE_NCURSES_NCURSES_H)
#include <ncurses/ncurses.h>
-#elif defined (HAVE_NCURSES_H)
+#elif defined(HAVE_NCURSES_H)
#include <ncurses.h>
-#elif defined (HAVE_CURSESX_H)
+#elif defined(HAVE_CURSESX_H)
#include <cursesX.h>
-#elif defined (HAVE_CURSES_H)
+#elif defined(HAVE_CURSES_H)
#include <curses.h>
#endif
-#if defined (HAVE_NCURSES_TERM_H)
+#if defined(HAVE_NCURSES_TERM_H)
#include <ncurses/term.h>
-#elif defined (HAVE_TERM_H)
+#elif defined(HAVE_TERM_H)
#include <term.h>
#else
/* On MinGW, a real termcap library is usually not present. Stub versions
diff --git a/gdb/gdb_expat.h b/gdb/gdb_expat.h
index 010404a6fab..99f2a073803 100644
--- a/gdb/gdb_expat.h
+++ b/gdb/gdb_expat.h
@@ -25,8 +25,8 @@
/* Expat 1.95.x does not define these; this is the definition
recommended by the expat 2.0 headers. */
#ifndef XML_STATUS_OK
-# define XML_STATUS_OK 1
-# define XML_STATUS_ERROR 0
+#define XML_STATUS_OK 1
+#define XML_STATUS_ERROR 0
#endif
/* Old versions of expat do not define this macro, so define it
diff --git a/gdb/gdb_wchar.h b/gdb/gdb_wchar.h
index 6621b183642..f831b98560b 100644
--- a/gdb/gdb_wchar.h
+++ b/gdb/gdb_wchar.h
@@ -40,8 +40,7 @@
a phony iconv which only handles a single character set, and we
provide wrappers for the wchar_t functionality we use. */
-
-#if defined (HAVE_ICONV)
+#if defined(HAVE_ICONV)
#include <iconv.h>
#else
/* This define is used elsewhere so we don't need to duplicate the
@@ -57,9 +56,9 @@
order to ensure we can convert to and from wchar_t. We choose
libiconv version 0x108 because it is the first version with
iconvlist. */
-#if defined (HAVE_ICONV) && defined (HAVE_BTOWC) \
- && (defined (__STDC_ISO_10646__) \
- || (defined (_LIBICONV_VERSION) && _LIBICONV_VERSION >= 0x108))
+#if defined(HAVE_ICONV) && defined(HAVE_BTOWC) \
+ && (defined(__STDC_ISO_10646__) \
+ || (defined(_LIBICONV_VERSION) && _LIBICONV_VERSION >= 0x108))
typedef wchar_t gdb_wchar_t;
typedef wint_t gdb_wint_t;
@@ -70,19 +69,19 @@ typedef wint_t gdb_wint_t;
#define gdb_btowc btowc
#define gdb_WEOF WEOF
-#define LCST(X) L ## X
+#define LCST(X) L##X
/* If __STDC_ISO_10646__ is defined, then the host wchar_t is UCS-4.
We exploit this fact in the hope that there are hosts that define
this but which do not support "wchar_t" as an encoding argument to
iconv_open. We put the endianness into the encoding name to avoid
hosts that emit a BOM when the unadorned name is used. */
-#if defined (__STDC_ISO_10646__)
+#if defined(__STDC_ISO_10646__)
#define USE_INTERMEDIATE_ENCODING_FUNCTION
#define INTERMEDIATE_ENCODING intermediate_encoding ()
const char *intermediate_encoding (void);
-#elif defined (_LIBICONV_VERSION) && _LIBICONV_VERSION >= 0x108
+#elif defined(_LIBICONV_VERSION) && _LIBICONV_VERSION >= 0x108
#define INTERMEDIATE_ENCODING "wchar_t"
#else
/* This shouldn't happen, because the earlier #if should have filtered
@@ -94,7 +93,7 @@ const char *intermediate_encoding (void);
/* If we got here and have wchar_t support, we might be on a system
with some problem. So, we just disable everything. */
-#if defined (HAVE_BTOWC)
+#if defined(HAVE_BTOWC)
#define PHONY_ICONV
#endif
diff --git a/gdb/gdbarch-gen.h b/gdb/gdbarch-gen.h
index 32b2d96fbe0..255711919f1 100644
--- a/gdb/gdbarch-gen.h
+++ b/gdb/gdbarch-gen.h
@@ -24,11 +24,10 @@
./gdbarch.py
*/
-
-
/* The following are pre-initialized by GDBARCH. */
-extern const struct bfd_arch_info * gdbarch_bfd_arch_info (struct gdbarch *gdbarch);
+extern const struct bfd_arch_info *
+gdbarch_bfd_arch_info (struct gdbarch *gdbarch);
/* set_gdbarch_bfd_arch_info() - not applicable - pre-initialized. */
extern enum bfd_endian gdbarch_byte_order (struct gdbarch *gdbarch);
@@ -40,10 +39,9 @@ extern enum bfd_endian gdbarch_byte_order_for_code (struct gdbarch *gdbarch);
extern enum gdb_osabi gdbarch_osabi (struct gdbarch *gdbarch);
/* set_gdbarch_osabi() - not applicable - pre-initialized. */
-extern const struct target_desc * gdbarch_target_desc (struct gdbarch *gdbarch);
+extern const struct target_desc *gdbarch_target_desc (struct gdbarch *gdbarch);
/* set_gdbarch_target_desc() - not applicable - pre-initialized. */
-
/* The following are initialized by the target dependent code. */
/* Number of bits in a short or unsigned short for the target machine. */
@@ -65,7 +63,8 @@ extern void set_gdbarch_long_bit (struct gdbarch *gdbarch, int long_bit);
machine. */
extern int gdbarch_long_long_bit (struct gdbarch *gdbarch);
-extern void set_gdbarch_long_long_bit (struct gdbarch *gdbarch, int long_long_bit);
+extern void set_gdbarch_long_long_bit (struct gdbarch *gdbarch,
+ int long_long_bit);
/* The ABI default bit-size and format for "bfloat16", "half", "float", "double", and
"long double". These bit/format pairs should eventually be combined
@@ -74,34 +73,49 @@ extern void set_gdbarch_long_long_bit (struct gdbarch *gdbarch, int long_long_bi
useful). */
extern int gdbarch_bfloat16_bit (struct gdbarch *gdbarch);
-extern void set_gdbarch_bfloat16_bit (struct gdbarch *gdbarch, int bfloat16_bit);
+extern void set_gdbarch_bfloat16_bit (struct gdbarch *gdbarch,
+ int bfloat16_bit);
-extern const struct floatformat ** gdbarch_bfloat16_format (struct gdbarch *gdbarch);
-extern void set_gdbarch_bfloat16_format (struct gdbarch *gdbarch, const struct floatformat ** bfloat16_format);
+extern const struct floatformat **
+gdbarch_bfloat16_format (struct gdbarch *gdbarch);
+extern void
+set_gdbarch_bfloat16_format (struct gdbarch *gdbarch,
+ const struct floatformat **bfloat16_format);
extern int gdbarch_half_bit (struct gdbarch *gdbarch);
extern void set_gdbarch_half_bit (struct gdbarch *gdbarch, int half_bit);
-extern const struct floatformat ** gdbarch_half_format (struct gdbarch *gdbarch);
-extern void set_gdbarch_half_format (struct gdbarch *gdbarch, const struct floatformat ** half_format);
+extern const struct floatformat **
+gdbarch_half_format (struct gdbarch *gdbarch);
+extern void set_gdbarch_half_format (struct gdbarch *gdbarch,
+ const struct floatformat **half_format);
extern int gdbarch_float_bit (struct gdbarch *gdbarch);
extern void set_gdbarch_float_bit (struct gdbarch *gdbarch, int float_bit);
-extern const struct floatformat ** gdbarch_float_format (struct gdbarch *gdbarch);
-extern void set_gdbarch_float_format (struct gdbarch *gdbarch, const struct floatformat ** float_format);
+extern const struct floatformat **
+gdbarch_float_format (struct gdbarch *gdbarch);
+extern void set_gdbarch_float_format (struct gdbarch *gdbarch,
+ const struct floatformat **float_format);
extern int gdbarch_double_bit (struct gdbarch *gdbarch);
extern void set_gdbarch_double_bit (struct gdbarch *gdbarch, int double_bit);
-extern const struct floatformat ** gdbarch_double_format (struct gdbarch *gdbarch);
-extern void set_gdbarch_double_format (struct gdbarch *gdbarch, const struct floatformat ** double_format);
+extern const struct floatformat **
+gdbarch_double_format (struct gdbarch *gdbarch);
+extern void
+set_gdbarch_double_format (struct gdbarch *gdbarch,
+ const struct floatformat **double_format);
extern int gdbarch_long_double_bit (struct gdbarch *gdbarch);
-extern void set_gdbarch_long_double_bit (struct gdbarch *gdbarch, int long_double_bit);
+extern void set_gdbarch_long_double_bit (struct gdbarch *gdbarch,
+ int long_double_bit);
-extern const struct floatformat ** gdbarch_long_double_format (struct gdbarch *gdbarch);
-extern void set_gdbarch_long_double_format (struct gdbarch *gdbarch, const struct floatformat ** long_double_format);
+extern const struct floatformat **
+gdbarch_long_double_format (struct gdbarch *gdbarch);
+extern void
+set_gdbarch_long_double_format (struct gdbarch *gdbarch,
+ const struct floatformat **long_double_format);
/* The ABI default bit-size for "wchar_t". wchar_t is a built-in type
starting with C++11. */
@@ -112,15 +126,22 @@ extern void set_gdbarch_wchar_bit (struct gdbarch *gdbarch, int wchar_bit);
/* One if `wchar_t' is signed, zero if unsigned. */
extern int gdbarch_wchar_signed (struct gdbarch *gdbarch);
-extern void set_gdbarch_wchar_signed (struct gdbarch *gdbarch, int wchar_signed);
+extern void set_gdbarch_wchar_signed (struct gdbarch *gdbarch,
+ int wchar_signed);
/* Returns the floating-point format to be used for values of length LENGTH.
NAME, if non-NULL, is the type name, which may be used to distinguish
different target formats of the same length. */
-typedef const struct floatformat ** (gdbarch_floatformat_for_type_ftype) (struct gdbarch *gdbarch, const char *name, int length);
-extern const struct floatformat ** gdbarch_floatformat_for_type (struct gdbarch *gdbarch, const char *name, int length);
-extern void set_gdbarch_floatformat_for_type (struct gdbarch *gdbarch, gdbarch_floatformat_for_type_ftype *floatformat_for_type);
+typedef const struct floatformat **(
+ gdbarch_floatformat_for_type_ftype) (struct gdbarch *gdbarch,
+ const char *name, int length);
+extern const struct floatformat **
+gdbarch_floatformat_for_type (struct gdbarch *gdbarch, const char *name,
+ int length);
+extern void set_gdbarch_floatformat_for_type (
+ struct gdbarch *gdbarch,
+ gdbarch_floatformat_for_type_ftype *floatformat_for_type);
/* For most targets, a pointer on the target and its representation as an
address in GDB have the same size and "look the same". For such a
@@ -156,7 +177,8 @@ extern void set_gdbarch_addr_bit (struct gdbarch *gdbarch, int addr_bit);
and if Dwarf versions < 4 need to be supported. */
extern int gdbarch_dwarf2_addr_size (struct gdbarch *gdbarch);
-extern void set_gdbarch_dwarf2_addr_size (struct gdbarch *gdbarch, int dwarf2_addr_size);
+extern void set_gdbarch_dwarf2_addr_size (struct gdbarch *gdbarch,
+ int dwarf2_addr_size);
/* One if `char' acts like `signed char', zero if `unsigned char'. */
@@ -166,28 +188,47 @@ extern void set_gdbarch_char_signed (struct gdbarch *gdbarch, int char_signed);
extern bool gdbarch_read_pc_p (struct gdbarch *gdbarch);
typedef CORE_ADDR (gdbarch_read_pc_ftype) (readable_regcache *regcache);
-extern CORE_ADDR gdbarch_read_pc (struct gdbarch *gdbarch, readable_regcache *regcache);
-extern void set_gdbarch_read_pc (struct gdbarch *gdbarch, gdbarch_read_pc_ftype *read_pc);
+extern CORE_ADDR gdbarch_read_pc (struct gdbarch *gdbarch,
+ readable_regcache *regcache);
+extern void set_gdbarch_read_pc (struct gdbarch *gdbarch,
+ gdbarch_read_pc_ftype *read_pc);
extern bool gdbarch_write_pc_p (struct gdbarch *gdbarch);
-typedef void (gdbarch_write_pc_ftype) (struct regcache *regcache, CORE_ADDR val);
-extern void gdbarch_write_pc (struct gdbarch *gdbarch, struct regcache *regcache, CORE_ADDR val);
-extern void set_gdbarch_write_pc (struct gdbarch *gdbarch, gdbarch_write_pc_ftype *write_pc);
+typedef void (gdbarch_write_pc_ftype) (struct regcache *regcache,
+ CORE_ADDR val);
+extern void gdbarch_write_pc (struct gdbarch *gdbarch,
+ struct regcache *regcache, CORE_ADDR val);
+extern void set_gdbarch_write_pc (struct gdbarch *gdbarch,
+ gdbarch_write_pc_ftype *write_pc);
/* Function for getting target's idea of a frame pointer. FIXME: GDB's
whole scheme for dealing with "frames" and "frame pointers" needs a
serious shakedown. */
-typedef void (gdbarch_virtual_frame_pointer_ftype) (struct gdbarch *gdbarch, CORE_ADDR pc, int *frame_regnum, LONGEST *frame_offset);
-extern void gdbarch_virtual_frame_pointer (struct gdbarch *gdbarch, CORE_ADDR pc, int *frame_regnum, LONGEST *frame_offset);
-extern void set_gdbarch_virtual_frame_pointer (struct gdbarch *gdbarch, gdbarch_virtual_frame_pointer_ftype *virtual_frame_pointer);
+typedef void (gdbarch_virtual_frame_pointer_ftype) (struct gdbarch *gdbarch,
+ CORE_ADDR pc,
+ int *frame_regnum,
+ LONGEST *frame_offset);
+extern void gdbarch_virtual_frame_pointer (struct gdbarch *gdbarch,
+ CORE_ADDR pc, int *frame_regnum,
+ LONGEST *frame_offset);
+extern void set_gdbarch_virtual_frame_pointer (
+ struct gdbarch *gdbarch,
+ gdbarch_virtual_frame_pointer_ftype *virtual_frame_pointer);
extern bool gdbarch_pseudo_register_read_p (struct gdbarch *gdbarch);
-typedef enum register_status (gdbarch_pseudo_register_read_ftype) (struct gdbarch *gdbarch, readable_regcache *regcache, int cookednum, gdb_byte *buf);
-extern enum register_status gdbarch_pseudo_register_read (struct gdbarch *gdbarch, readable_regcache *regcache, int cookednum, gdb_byte *buf);
-extern void set_gdbarch_pseudo_register_read (struct gdbarch *gdbarch, gdbarch_pseudo_register_read_ftype *pseudo_register_read);
+typedef enum register_status (gdbarch_pseudo_register_read_ftype) (
+ struct gdbarch *gdbarch, readable_regcache *regcache, int cookednum,
+ gdb_byte *buf);
+extern enum register_status
+gdbarch_pseudo_register_read (struct gdbarch *gdbarch,
+ readable_regcache *regcache, int cookednum,
+ gdb_byte *buf);
+extern void set_gdbarch_pseudo_register_read (
+ struct gdbarch *gdbarch,
+ gdbarch_pseudo_register_read_ftype *pseudo_register_read);
/* Read a register into a new struct value. If the register is wholly
or partly unavailable, this should call mark_value_bytes_unavailable
@@ -196,15 +237,28 @@ extern void set_gdbarch_pseudo_register_read (struct gdbarch *gdbarch, gdbarch_p
extern bool gdbarch_pseudo_register_read_value_p (struct gdbarch *gdbarch);
-typedef struct value * (gdbarch_pseudo_register_read_value_ftype) (struct gdbarch *gdbarch, readable_regcache *regcache, int cookednum);
-extern struct value * gdbarch_pseudo_register_read_value (struct gdbarch *gdbarch, readable_regcache *regcache, int cookednum);
-extern void set_gdbarch_pseudo_register_read_value (struct gdbarch *gdbarch, gdbarch_pseudo_register_read_value_ftype *pseudo_register_read_value);
+typedef struct value *(
+ gdbarch_pseudo_register_read_value_ftype) (struct gdbarch *gdbarch,
+ readable_regcache *regcache,
+ int cookednum);
+extern struct value *gdbarch_pseudo_register_read_value (
+ struct gdbarch *gdbarch, readable_regcache *regcache, int cookednum);
+extern void set_gdbarch_pseudo_register_read_value (
+ struct gdbarch *gdbarch,
+ gdbarch_pseudo_register_read_value_ftype *pseudo_register_read_value);
extern bool gdbarch_pseudo_register_write_p (struct gdbarch *gdbarch);
-typedef void (gdbarch_pseudo_register_write_ftype) (struct gdbarch *gdbarch, struct regcache *regcache, int cookednum, const gdb_byte *buf);
-extern void gdbarch_pseudo_register_write (struct gdbarch *gdbarch, struct regcache *regcache, int cookednum, const gdb_byte *buf);
-extern void set_gdbarch_pseudo_register_write (struct gdbarch *gdbarch, gdbarch_pseudo_register_write_ftype *pseudo_register_write);
+typedef void (gdbarch_pseudo_register_write_ftype) (struct gdbarch *gdbarch,
+ struct regcache *regcache,
+ int cookednum,
+ const gdb_byte *buf);
+extern void gdbarch_pseudo_register_write (struct gdbarch *gdbarch,
+ struct regcache *regcache,
+ int cookednum, const gdb_byte *buf);
+extern void set_gdbarch_pseudo_register_write (
+ struct gdbarch *gdbarch,
+ gdbarch_pseudo_register_write_ftype *pseudo_register_write);
extern int gdbarch_num_regs (struct gdbarch *gdbarch);
extern void set_gdbarch_num_regs (struct gdbarch *gdbarch, int num_regs);
@@ -215,16 +269,21 @@ extern void set_gdbarch_num_regs (struct gdbarch *gdbarch, int num_regs);
combinations of other registers, or they may be computed by GDB. */
extern int gdbarch_num_pseudo_regs (struct gdbarch *gdbarch);
-extern void set_gdbarch_num_pseudo_regs (struct gdbarch *gdbarch, int num_pseudo_regs);
+extern void set_gdbarch_num_pseudo_regs (struct gdbarch *gdbarch,
+ int num_pseudo_regs);
/* Assemble agent expression bytecode to collect pseudo-register REG.
Return -1 if something goes wrong, 0 otherwise. */
extern bool gdbarch_ax_pseudo_register_collect_p (struct gdbarch *gdbarch);
-typedef int (gdbarch_ax_pseudo_register_collect_ftype) (struct gdbarch *gdbarch, struct agent_expr *ax, int reg);
-extern int gdbarch_ax_pseudo_register_collect (struct gdbarch *gdbarch, struct agent_expr *ax, int reg);
-extern void set_gdbarch_ax_pseudo_register_collect (struct gdbarch *gdbarch, gdbarch_ax_pseudo_register_collect_ftype *ax_pseudo_register_collect);
+typedef int (gdbarch_ax_pseudo_register_collect_ftype) (
+ struct gdbarch *gdbarch, struct agent_expr *ax, int reg);
+extern int gdbarch_ax_pseudo_register_collect (struct gdbarch *gdbarch,
+ struct agent_expr *ax, int reg);
+extern void set_gdbarch_ax_pseudo_register_collect (
+ struct gdbarch *gdbarch,
+ gdbarch_ax_pseudo_register_collect_ftype *ax_pseudo_register_collect);
/* Assemble agent expression bytecode to push the value of pseudo-register
REG on the interpreter stack.
@@ -232,9 +291,14 @@ extern void set_gdbarch_ax_pseudo_register_collect (struct gdbarch *gdbarch, gdb
extern bool gdbarch_ax_pseudo_register_push_stack_p (struct gdbarch *gdbarch);
-typedef int (gdbarch_ax_pseudo_register_push_stack_ftype) (struct gdbarch *gdbarch, struct agent_expr *ax, int reg);
-extern int gdbarch_ax_pseudo_register_push_stack (struct gdbarch *gdbarch, struct agent_expr *ax, int reg);
-extern void set_gdbarch_ax_pseudo_register_push_stack (struct gdbarch *gdbarch, gdbarch_ax_pseudo_register_push_stack_ftype *ax_pseudo_register_push_stack);
+typedef int (gdbarch_ax_pseudo_register_push_stack_ftype) (
+ struct gdbarch *gdbarch, struct agent_expr *ax, int reg);
+extern int gdbarch_ax_pseudo_register_push_stack (struct gdbarch *gdbarch,
+ struct agent_expr *ax,
+ int reg);
+extern void set_gdbarch_ax_pseudo_register_push_stack (
+ struct gdbarch *gdbarch,
+ gdbarch_ax_pseudo_register_push_stack_ftype *ax_pseudo_register_push_stack);
/* Some architectures can display additional information for specific
signals.
@@ -242,9 +306,15 @@ extern void set_gdbarch_ax_pseudo_register_push_stack (struct gdbarch *gdbarch,
extern bool gdbarch_report_signal_info_p (struct gdbarch *gdbarch);
-typedef void (gdbarch_report_signal_info_ftype) (struct gdbarch *gdbarch, struct ui_out *uiout, enum gdb_signal siggnal);
-extern void gdbarch_report_signal_info (struct gdbarch *gdbarch, struct ui_out *uiout, enum gdb_signal siggnal);
-extern void set_gdbarch_report_signal_info (struct gdbarch *gdbarch, gdbarch_report_signal_info_ftype *report_signal_info);
+typedef void (gdbarch_report_signal_info_ftype) (struct gdbarch *gdbarch,
+ struct ui_out *uiout,
+ enum gdb_signal siggnal);
+extern void gdbarch_report_signal_info (struct gdbarch *gdbarch,
+ struct ui_out *uiout,
+ enum gdb_signal siggnal);
+extern void set_gdbarch_report_signal_info (
+ struct gdbarch *gdbarch,
+ gdbarch_report_signal_info_ftype *report_signal_info);
/* GDB's standard (or well known) register numbers. These can map onto
a real register or a pseudo (computed) register or not be defined at
@@ -265,28 +335,42 @@ extern void set_gdbarch_fp0_regnum (struct gdbarch *gdbarch, int fp0_regnum);
/* Convert stab register number (from `r' declaration) to a gdb REGNUM. */
-typedef int (gdbarch_stab_reg_to_regnum_ftype) (struct gdbarch *gdbarch, int stab_regnr);
-extern int gdbarch_stab_reg_to_regnum (struct gdbarch *gdbarch, int stab_regnr);
-extern void set_gdbarch_stab_reg_to_regnum (struct gdbarch *gdbarch, gdbarch_stab_reg_to_regnum_ftype *stab_reg_to_regnum);
+typedef int (gdbarch_stab_reg_to_regnum_ftype) (struct gdbarch *gdbarch,
+ int stab_regnr);
+extern int gdbarch_stab_reg_to_regnum (struct gdbarch *gdbarch,
+ int stab_regnr);
+extern void set_gdbarch_stab_reg_to_regnum (
+ struct gdbarch *gdbarch,
+ gdbarch_stab_reg_to_regnum_ftype *stab_reg_to_regnum);
/* Provide a default mapping from a ecoff register number to a gdb REGNUM. */
-typedef int (gdbarch_ecoff_reg_to_regnum_ftype) (struct gdbarch *gdbarch, int ecoff_regnr);
-extern int gdbarch_ecoff_reg_to_regnum (struct gdbarch *gdbarch, int ecoff_regnr);
-extern void set_gdbarch_ecoff_reg_to_regnum (struct gdbarch *gdbarch, gdbarch_ecoff_reg_to_regnum_ftype *ecoff_reg_to_regnum);
+typedef int (gdbarch_ecoff_reg_to_regnum_ftype) (struct gdbarch *gdbarch,
+ int ecoff_regnr);
+extern int gdbarch_ecoff_reg_to_regnum (struct gdbarch *gdbarch,
+ int ecoff_regnr);
+extern void set_gdbarch_ecoff_reg_to_regnum (
+ struct gdbarch *gdbarch,
+ gdbarch_ecoff_reg_to_regnum_ftype *ecoff_reg_to_regnum);
/* Convert from an sdb register number to an internal gdb register number. */
-typedef int (gdbarch_sdb_reg_to_regnum_ftype) (struct gdbarch *gdbarch, int sdb_regnr);
+typedef int (gdbarch_sdb_reg_to_regnum_ftype) (struct gdbarch *gdbarch,
+ int sdb_regnr);
extern int gdbarch_sdb_reg_to_regnum (struct gdbarch *gdbarch, int sdb_regnr);
-extern void set_gdbarch_sdb_reg_to_regnum (struct gdbarch *gdbarch, gdbarch_sdb_reg_to_regnum_ftype *sdb_reg_to_regnum);
+extern void set_gdbarch_sdb_reg_to_regnum (
+ struct gdbarch *gdbarch, gdbarch_sdb_reg_to_regnum_ftype *sdb_reg_to_regnum);
/* Provide a default mapping from a DWARF2 register number to a gdb REGNUM.
Return -1 for bad REGNUM. Note: Several targets get this wrong. */
-typedef int (gdbarch_dwarf2_reg_to_regnum_ftype) (struct gdbarch *gdbarch, int dwarf2_regnr);
-extern int gdbarch_dwarf2_reg_to_regnum (struct gdbarch *gdbarch, int dwarf2_regnr);
-extern void set_gdbarch_dwarf2_reg_to_regnum (struct gdbarch *gdbarch, gdbarch_dwarf2_reg_to_regnum_ftype *dwarf2_reg_to_regnum);
+typedef int (gdbarch_dwarf2_reg_to_regnum_ftype) (struct gdbarch *gdbarch,
+ int dwarf2_regnr);
+extern int gdbarch_dwarf2_reg_to_regnum (struct gdbarch *gdbarch,
+ int dwarf2_regnr);
+extern void set_gdbarch_dwarf2_reg_to_regnum (
+ struct gdbarch *gdbarch,
+ gdbarch_dwarf2_reg_to_regnum_ftype *dwarf2_reg_to_regnum);
/* Return the name of register REGNR for the specified architecture.
REGNR can be any value greater than, or equal to zero, and less than
@@ -294,17 +378,24 @@ extern void set_gdbarch_dwarf2_reg_to_regnum (struct gdbarch *gdbarch, gdbarch_d
GDBARCH, then this function will return an empty string, this function
should never return nullptr. */
-typedef const char * (gdbarch_register_name_ftype) (struct gdbarch *gdbarch, int regnr);
-extern const char * gdbarch_register_name (struct gdbarch *gdbarch, int regnr);
-extern void set_gdbarch_register_name (struct gdbarch *gdbarch, gdbarch_register_name_ftype *register_name);
+typedef const char *(gdbarch_register_name_ftype) (struct gdbarch *gdbarch,
+ int regnr);
+extern const char *gdbarch_register_name (struct gdbarch *gdbarch, int regnr);
+extern void
+set_gdbarch_register_name (struct gdbarch *gdbarch,
+ gdbarch_register_name_ftype *register_name);
/* Return the type of a register specified by the architecture. Only
the register cache should call this function directly; others should
use "register_type". */
-typedef struct type * (gdbarch_register_type_ftype) (struct gdbarch *gdbarch, int reg_nr);
-extern struct type * gdbarch_register_type (struct gdbarch *gdbarch, int reg_nr);
-extern void set_gdbarch_register_type (struct gdbarch *gdbarch, gdbarch_register_type_ftype *register_type);
+typedef struct type *(gdbarch_register_type_ftype) (struct gdbarch *gdbarch,
+ int reg_nr);
+extern struct type *gdbarch_register_type (struct gdbarch *gdbarch,
+ int reg_nr);
+extern void
+set_gdbarch_register_type (struct gdbarch *gdbarch,
+ gdbarch_register_type_ftype *register_type);
/* Generate a dummy frame_id for THIS_FRAME assuming that the frame is
a dummy frame. A dummy frame is created before an inferior call,
@@ -315,65 +406,121 @@ extern void set_gdbarch_register_type (struct gdbarch *gdbarch, gdbarch_register
should match the address at which the breakpoint was set in the dummy
frame. */
-typedef struct frame_id (gdbarch_dummy_id_ftype) (struct gdbarch *gdbarch, frame_info_ptr this_frame);
-extern struct frame_id gdbarch_dummy_id (struct gdbarch *gdbarch, frame_info_ptr this_frame);
-extern void set_gdbarch_dummy_id (struct gdbarch *gdbarch, gdbarch_dummy_id_ftype *dummy_id);
+typedef struct frame_id (gdbarch_dummy_id_ftype) (struct gdbarch *gdbarch,
+ frame_info_ptr this_frame);
+extern struct frame_id gdbarch_dummy_id (struct gdbarch *gdbarch,
+ frame_info_ptr this_frame);
+extern void set_gdbarch_dummy_id (struct gdbarch *gdbarch,
+ gdbarch_dummy_id_ftype *dummy_id);
/* Implement DUMMY_ID and PUSH_DUMMY_CALL, then delete
deprecated_fp_regnum. */
extern int gdbarch_deprecated_fp_regnum (struct gdbarch *gdbarch);
-extern void set_gdbarch_deprecated_fp_regnum (struct gdbarch *gdbarch, int deprecated_fp_regnum);
+extern void set_gdbarch_deprecated_fp_regnum (struct gdbarch *gdbarch,
+ int deprecated_fp_regnum);
extern bool gdbarch_push_dummy_call_p (struct gdbarch *gdbarch);
-typedef CORE_ADDR (gdbarch_push_dummy_call_ftype) (struct gdbarch *gdbarch, struct value *function, struct regcache *regcache, CORE_ADDR bp_addr, int nargs, struct value **args, CORE_ADDR sp, function_call_return_method return_method, CORE_ADDR struct_addr);
-extern CORE_ADDR gdbarch_push_dummy_call (struct gdbarch *gdbarch, struct value *function, struct regcache *regcache, CORE_ADDR bp_addr, int nargs, struct value **args, CORE_ADDR sp, function_call_return_method return_method, CORE_ADDR struct_addr);
-extern void set_gdbarch_push_dummy_call (struct gdbarch *gdbarch, gdbarch_push_dummy_call_ftype *push_dummy_call);
-
-extern enum call_dummy_location_type gdbarch_call_dummy_location (struct gdbarch *gdbarch);
-extern void set_gdbarch_call_dummy_location (struct gdbarch *gdbarch, enum call_dummy_location_type call_dummy_location);
+typedef CORE_ADDR (gdbarch_push_dummy_call_ftype) (
+ struct gdbarch *gdbarch, struct value *function, struct regcache *regcache,
+ CORE_ADDR bp_addr, int nargs, struct value **args, CORE_ADDR sp,
+ function_call_return_method return_method, CORE_ADDR struct_addr);
+extern CORE_ADDR gdbarch_push_dummy_call (
+ struct gdbarch *gdbarch, struct value *function, struct regcache *regcache,
+ CORE_ADDR bp_addr, int nargs, struct value **args, CORE_ADDR sp,
+ function_call_return_method return_method, CORE_ADDR struct_addr);
+extern void
+set_gdbarch_push_dummy_call (struct gdbarch *gdbarch,
+ gdbarch_push_dummy_call_ftype *push_dummy_call);
+
+extern enum call_dummy_location_type
+gdbarch_call_dummy_location (struct gdbarch *gdbarch);
+extern void set_gdbarch_call_dummy_location (
+ struct gdbarch *gdbarch, enum call_dummy_location_type call_dummy_location);
extern bool gdbarch_push_dummy_code_p (struct gdbarch *gdbarch);
-typedef CORE_ADDR (gdbarch_push_dummy_code_ftype) (struct gdbarch *gdbarch, CORE_ADDR sp, CORE_ADDR funaddr, struct value **args, int nargs, struct type *value_type, CORE_ADDR *real_pc, CORE_ADDR *bp_addr, struct regcache *regcache);
-extern CORE_ADDR gdbarch_push_dummy_code (struct gdbarch *gdbarch, CORE_ADDR sp, CORE_ADDR funaddr, struct value **args, int nargs, struct type *value_type, CORE_ADDR *real_pc, CORE_ADDR *bp_addr, struct regcache *regcache);
-extern void set_gdbarch_push_dummy_code (struct gdbarch *gdbarch, gdbarch_push_dummy_code_ftype *push_dummy_code);
+typedef CORE_ADDR (gdbarch_push_dummy_code_ftype) (
+ struct gdbarch *gdbarch, CORE_ADDR sp, CORE_ADDR funaddr,
+ struct value **args, int nargs, struct type *value_type, CORE_ADDR *real_pc,
+ CORE_ADDR *bp_addr, struct regcache *regcache);
+extern CORE_ADDR
+gdbarch_push_dummy_code (struct gdbarch *gdbarch, CORE_ADDR sp,
+ CORE_ADDR funaddr, struct value **args, int nargs,
+ struct type *value_type, CORE_ADDR *real_pc,
+ CORE_ADDR *bp_addr, struct regcache *regcache);
+extern void
+set_gdbarch_push_dummy_code (struct gdbarch *gdbarch,
+ gdbarch_push_dummy_code_ftype *push_dummy_code);
/* Return true if the code of FRAME is writable. */
-typedef int (gdbarch_code_of_frame_writable_ftype) (struct gdbarch *gdbarch, frame_info_ptr frame);
-extern int gdbarch_code_of_frame_writable (struct gdbarch *gdbarch, frame_info_ptr frame);
-extern void set_gdbarch_code_of_frame_writable (struct gdbarch *gdbarch, gdbarch_code_of_frame_writable_ftype *code_of_frame_writable);
-
-typedef void (gdbarch_print_registers_info_ftype) (struct gdbarch *gdbarch, struct ui_file *file, frame_info_ptr frame, int regnum, int all);
-extern void gdbarch_print_registers_info (struct gdbarch *gdbarch, struct ui_file *file, frame_info_ptr frame, int regnum, int all);
-extern void set_gdbarch_print_registers_info (struct gdbarch *gdbarch, gdbarch_print_registers_info_ftype *print_registers_info);
-
-typedef void (gdbarch_print_float_info_ftype) (struct gdbarch *gdbarch, struct ui_file *file, frame_info_ptr frame, const char *args);
-extern void gdbarch_print_float_info (struct gdbarch *gdbarch, struct ui_file *file, frame_info_ptr frame, const char *args);
-extern void set_gdbarch_print_float_info (struct gdbarch *gdbarch, gdbarch_print_float_info_ftype *print_float_info);
+typedef int (gdbarch_code_of_frame_writable_ftype) (struct gdbarch *gdbarch,
+ frame_info_ptr frame);
+extern int gdbarch_code_of_frame_writable (struct gdbarch *gdbarch,
+ frame_info_ptr frame);
+extern void set_gdbarch_code_of_frame_writable (
+ struct gdbarch *gdbarch,
+ gdbarch_code_of_frame_writable_ftype *code_of_frame_writable);
+
+typedef void (gdbarch_print_registers_info_ftype) (struct gdbarch *gdbarch,
+ struct ui_file *file,
+ frame_info_ptr frame,
+ int regnum, int all);
+extern void gdbarch_print_registers_info (struct gdbarch *gdbarch,
+ struct ui_file *file,
+ frame_info_ptr frame, int regnum,
+ int all);
+extern void set_gdbarch_print_registers_info (
+ struct gdbarch *gdbarch,
+ gdbarch_print_registers_info_ftype *print_registers_info);
+
+typedef void (gdbarch_print_float_info_ftype) (struct gdbarch *gdbarch,
+ struct ui_file *file,
+ frame_info_ptr frame,
+ const char *args);
+extern void gdbarch_print_float_info (struct gdbarch *gdbarch,
+ struct ui_file *file,
+ frame_info_ptr frame, const char *args);
+extern void set_gdbarch_print_float_info (
+ struct gdbarch *gdbarch, gdbarch_print_float_info_ftype *print_float_info);
extern bool gdbarch_print_vector_info_p (struct gdbarch *gdbarch);
-typedef void (gdbarch_print_vector_info_ftype) (struct gdbarch *gdbarch, struct ui_file *file, frame_info_ptr frame, const char *args);
-extern void gdbarch_print_vector_info (struct gdbarch *gdbarch, struct ui_file *file, frame_info_ptr frame, const char *args);
-extern void set_gdbarch_print_vector_info (struct gdbarch *gdbarch, gdbarch_print_vector_info_ftype *print_vector_info);
+typedef void (gdbarch_print_vector_info_ftype) (struct gdbarch *gdbarch,
+ struct ui_file *file,
+ frame_info_ptr frame,
+ const char *args);
+extern void gdbarch_print_vector_info (struct gdbarch *gdbarch,
+ struct ui_file *file,
+ frame_info_ptr frame, const char *args);
+extern void set_gdbarch_print_vector_info (
+ struct gdbarch *gdbarch, gdbarch_print_vector_info_ftype *print_vector_info);
/* MAP a GDB RAW register number onto a simulator register number. See
also include/...-sim.h. */
-typedef int (gdbarch_register_sim_regno_ftype) (struct gdbarch *gdbarch, int reg_nr);
+typedef int (gdbarch_register_sim_regno_ftype) (struct gdbarch *gdbarch,
+ int reg_nr);
extern int gdbarch_register_sim_regno (struct gdbarch *gdbarch, int reg_nr);
-extern void set_gdbarch_register_sim_regno (struct gdbarch *gdbarch, gdbarch_register_sim_regno_ftype *register_sim_regno);
+extern void set_gdbarch_register_sim_regno (
+ struct gdbarch *gdbarch,
+ gdbarch_register_sim_regno_ftype *register_sim_regno);
-typedef int (gdbarch_cannot_fetch_register_ftype) (struct gdbarch *gdbarch, int regnum);
+typedef int (gdbarch_cannot_fetch_register_ftype) (struct gdbarch *gdbarch,
+ int regnum);
extern int gdbarch_cannot_fetch_register (struct gdbarch *gdbarch, int regnum);
-extern void set_gdbarch_cannot_fetch_register (struct gdbarch *gdbarch, gdbarch_cannot_fetch_register_ftype *cannot_fetch_register);
+extern void set_gdbarch_cannot_fetch_register (
+ struct gdbarch *gdbarch,
+ gdbarch_cannot_fetch_register_ftype *cannot_fetch_register);
-typedef int (gdbarch_cannot_store_register_ftype) (struct gdbarch *gdbarch, int regnum);
+typedef int (gdbarch_cannot_store_register_ftype) (struct gdbarch *gdbarch,
+ int regnum);
extern int gdbarch_cannot_store_register (struct gdbarch *gdbarch, int regnum);
-extern void set_gdbarch_cannot_store_register (struct gdbarch *gdbarch, gdbarch_cannot_store_register_ftype *cannot_store_register);
+extern void set_gdbarch_cannot_store_register (
+ struct gdbarch *gdbarch,
+ gdbarch_cannot_store_register_ftype *cannot_store_register);
/* Determine the address where a longjmp will land and save this address
in PC. Return nonzero on success.
@@ -382,47 +529,95 @@ extern void set_gdbarch_cannot_store_register (struct gdbarch *gdbarch, gdbarch_
extern bool gdbarch_get_longjmp_target_p (struct gdbarch *gdbarch);
-typedef int (gdbarch_get_longjmp_target_ftype) (frame_info_ptr frame, CORE_ADDR *pc);
-extern int gdbarch_get_longjmp_target (struct gdbarch *gdbarch, frame_info_ptr frame, CORE_ADDR *pc);
-extern void set_gdbarch_get_longjmp_target (struct gdbarch *gdbarch, gdbarch_get_longjmp_target_ftype *get_longjmp_target);
+typedef int (gdbarch_get_longjmp_target_ftype) (frame_info_ptr frame,
+ CORE_ADDR *pc);
+extern int gdbarch_get_longjmp_target (struct gdbarch *gdbarch,
+ frame_info_ptr frame, CORE_ADDR *pc);
+extern void set_gdbarch_get_longjmp_target (
+ struct gdbarch *gdbarch,
+ gdbarch_get_longjmp_target_ftype *get_longjmp_target);
extern int gdbarch_believe_pcc_promotion (struct gdbarch *gdbarch);
-extern void set_gdbarch_believe_pcc_promotion (struct gdbarch *gdbarch, int believe_pcc_promotion);
-
-typedef int (gdbarch_convert_register_p_ftype) (struct gdbarch *gdbarch, int regnum, struct type *type);
-extern int gdbarch_convert_register_p (struct gdbarch *gdbarch, int regnum, struct type *type);
-extern void set_gdbarch_convert_register_p (struct gdbarch *gdbarch, gdbarch_convert_register_p_ftype *convert_register_p);
-
-typedef int (gdbarch_register_to_value_ftype) (frame_info_ptr frame, int regnum, struct type *type, gdb_byte *buf, int *optimizedp, int *unavailablep);
-extern int gdbarch_register_to_value (struct gdbarch *gdbarch, frame_info_ptr frame, int regnum, struct type *type, gdb_byte *buf, int *optimizedp, int *unavailablep);
-extern void set_gdbarch_register_to_value (struct gdbarch *gdbarch, gdbarch_register_to_value_ftype *register_to_value);
-
-typedef void (gdbarch_value_to_register_ftype) (frame_info_ptr frame, int regnum, struct type *type, const gdb_byte *buf);
-extern void gdbarch_value_to_register (struct gdbarch *gdbarch, frame_info_ptr frame, int regnum, struct type *type, const gdb_byte *buf);
-extern void set_gdbarch_value_to_register (struct gdbarch *gdbarch, gdbarch_value_to_register_ftype *value_to_register);
+extern void set_gdbarch_believe_pcc_promotion (struct gdbarch *gdbarch,
+ int believe_pcc_promotion);
+
+typedef int (gdbarch_convert_register_p_ftype) (struct gdbarch *gdbarch,
+ int regnum, struct type *type);
+extern int gdbarch_convert_register_p (struct gdbarch *gdbarch, int regnum,
+ struct type *type);
+extern void set_gdbarch_convert_register_p (
+ struct gdbarch *gdbarch,
+ gdbarch_convert_register_p_ftype *convert_register_p);
+
+typedef int (gdbarch_register_to_value_ftype) (frame_info_ptr frame,
+ int regnum, struct type *type,
+ gdb_byte *buf, int *optimizedp,
+ int *unavailablep);
+extern int gdbarch_register_to_value (struct gdbarch *gdbarch,
+ frame_info_ptr frame, int regnum,
+ struct type *type, gdb_byte *buf,
+ int *optimizedp, int *unavailablep);
+extern void set_gdbarch_register_to_value (
+ struct gdbarch *gdbarch, gdbarch_register_to_value_ftype *register_to_value);
+
+typedef void (gdbarch_value_to_register_ftype) (frame_info_ptr frame,
+ int regnum, struct type *type,
+ const gdb_byte *buf);
+extern void gdbarch_value_to_register (struct gdbarch *gdbarch,
+ frame_info_ptr frame, int regnum,
+ struct type *type, const gdb_byte *buf);
+extern void set_gdbarch_value_to_register (
+ struct gdbarch *gdbarch, gdbarch_value_to_register_ftype *value_to_register);
/* Construct a value representing the contents of register REGNUM in
frame FRAME_ID, interpreted as type TYPE. The routine needs to
allocate and return a struct value with all value attributes
(but not the value contents) filled in. */
-typedef struct value * (gdbarch_value_from_register_ftype) (struct gdbarch *gdbarch, struct type *type, int regnum, struct frame_id frame_id);
-extern struct value * gdbarch_value_from_register (struct gdbarch *gdbarch, struct type *type, int regnum, struct frame_id frame_id);
-extern void set_gdbarch_value_from_register (struct gdbarch *gdbarch, gdbarch_value_from_register_ftype *value_from_register);
-
-typedef CORE_ADDR (gdbarch_pointer_to_address_ftype) (struct gdbarch *gdbarch, struct type *type, const gdb_byte *buf);
-extern CORE_ADDR gdbarch_pointer_to_address (struct gdbarch *gdbarch, struct type *type, const gdb_byte *buf);
-extern void set_gdbarch_pointer_to_address (struct gdbarch *gdbarch, gdbarch_pointer_to_address_ftype *pointer_to_address);
-
-typedef void (gdbarch_address_to_pointer_ftype) (struct gdbarch *gdbarch, struct type *type, gdb_byte *buf, CORE_ADDR addr);
-extern void gdbarch_address_to_pointer (struct gdbarch *gdbarch, struct type *type, gdb_byte *buf, CORE_ADDR addr);
-extern void set_gdbarch_address_to_pointer (struct gdbarch *gdbarch, gdbarch_address_to_pointer_ftype *address_to_pointer);
+typedef struct value *(
+ gdbarch_value_from_register_ftype) (struct gdbarch *gdbarch,
+ struct type *type, int regnum,
+ struct frame_id frame_id);
+extern struct value *gdbarch_value_from_register (struct gdbarch *gdbarch,
+ struct type *type,
+ int regnum,
+ struct frame_id frame_id);
+extern void set_gdbarch_value_from_register (
+ struct gdbarch *gdbarch,
+ gdbarch_value_from_register_ftype *value_from_register);
+
+typedef CORE_ADDR (gdbarch_pointer_to_address_ftype) (struct gdbarch *gdbarch,
+ struct type *type,
+ const gdb_byte *buf);
+extern CORE_ADDR gdbarch_pointer_to_address (struct gdbarch *gdbarch,
+ struct type *type,
+ const gdb_byte *buf);
+extern void set_gdbarch_pointer_to_address (
+ struct gdbarch *gdbarch,
+ gdbarch_pointer_to_address_ftype *pointer_to_address);
+
+typedef void (gdbarch_address_to_pointer_ftype) (struct gdbarch *gdbarch,
+ struct type *type,
+ gdb_byte *buf,
+ CORE_ADDR addr);
+extern void gdbarch_address_to_pointer (struct gdbarch *gdbarch,
+ struct type *type, gdb_byte *buf,
+ CORE_ADDR addr);
+extern void set_gdbarch_address_to_pointer (
+ struct gdbarch *gdbarch,
+ gdbarch_address_to_pointer_ftype *address_to_pointer);
extern bool gdbarch_integer_to_address_p (struct gdbarch *gdbarch);
-typedef CORE_ADDR (gdbarch_integer_to_address_ftype) (struct gdbarch *gdbarch, struct type *type, const gdb_byte *buf);
-extern CORE_ADDR gdbarch_integer_to_address (struct gdbarch *gdbarch, struct type *type, const gdb_byte *buf);
-extern void set_gdbarch_integer_to_address (struct gdbarch *gdbarch, gdbarch_integer_to_address_ftype *integer_to_address);
+typedef CORE_ADDR (gdbarch_integer_to_address_ftype) (struct gdbarch *gdbarch,
+ struct type *type,
+ const gdb_byte *buf);
+extern CORE_ADDR gdbarch_integer_to_address (struct gdbarch *gdbarch,
+ struct type *type,
+ const gdb_byte *buf);
+extern void set_gdbarch_integer_to_address (
+ struct gdbarch *gdbarch,
+ gdbarch_integer_to_address_ftype *integer_to_address);
/* Return the return-value convention that will be used by FUNCTION
to return a value of type VALTYPE. FUNCTION may be NULL in which
@@ -438,8 +633,12 @@ extern void set_gdbarch_integer_to_address (struct gdbarch *gdbarch, gdbarch_int
NOTE: it is better to implement return_value_as_value instead, as that
method can properly handle variably-sized types. */
-typedef enum return_value_convention (gdbarch_return_value_ftype) (struct gdbarch *gdbarch, struct value *function, struct type *valtype, struct regcache *regcache, gdb_byte *readbuf, const gdb_byte *writebuf);
-extern void set_gdbarch_return_value (struct gdbarch *gdbarch, gdbarch_return_value_ftype *return_value);
+typedef enum return_value_convention (gdbarch_return_value_ftype) (
+ struct gdbarch *gdbarch, struct value *function, struct type *valtype,
+ struct regcache *regcache, gdb_byte *readbuf, const gdb_byte *writebuf);
+extern void
+set_gdbarch_return_value (struct gdbarch *gdbarch,
+ gdbarch_return_value_ftype *return_value);
/* Return the return-value convention that will be used by FUNCTION
to return a value of type VALTYPE. FUNCTION may be NULL in which
@@ -453,9 +652,18 @@ extern void set_gdbarch_return_value (struct gdbarch *gdbarch, gdbarch_return_va
to force the value returned by a function (see the "return" command
for instance). */
-typedef enum return_value_convention (gdbarch_return_value_as_value_ftype) (struct gdbarch *gdbarch, struct value *function, struct type *valtype, struct regcache *regcache, struct value **read_value, const gdb_byte *writebuf);
-extern enum return_value_convention gdbarch_return_value_as_value (struct gdbarch *gdbarch, struct value *function, struct type *valtype, struct regcache *regcache, struct value **read_value, const gdb_byte *writebuf);
-extern void set_gdbarch_return_value_as_value (struct gdbarch *gdbarch, gdbarch_return_value_as_value_ftype *return_value_as_value);
+typedef enum return_value_convention (gdbarch_return_value_as_value_ftype) (
+ struct gdbarch *gdbarch, struct value *function, struct type *valtype,
+ struct regcache *regcache, struct value **read_value,
+ const gdb_byte *writebuf);
+extern enum return_value_convention
+gdbarch_return_value_as_value (struct gdbarch *gdbarch, struct value *function,
+ struct type *valtype, struct regcache *regcache,
+ struct value **read_value,
+ const gdb_byte *writebuf);
+extern void set_gdbarch_return_value_as_value (
+ struct gdbarch *gdbarch,
+ gdbarch_return_value_as_value_ftype *return_value_as_value);
/* Return the address at which the value being returned from
the current function will be stored. This routine is only
@@ -464,9 +672,14 @@ extern void set_gdbarch_return_value_as_value (struct gdbarch *gdbarch, gdbarch_
May return 0 when unable to determine that address. */
-typedef CORE_ADDR (gdbarch_get_return_buf_addr_ftype) (struct type *val_type, frame_info_ptr cur_frame);
-extern CORE_ADDR gdbarch_get_return_buf_addr (struct gdbarch *gdbarch, struct type *val_type, frame_info_ptr cur_frame);
-extern void set_gdbarch_get_return_buf_addr (struct gdbarch *gdbarch, gdbarch_get_return_buf_addr_ftype *get_return_buf_addr);
+typedef CORE_ADDR (gdbarch_get_return_buf_addr_ftype) (
+ struct type *val_type, frame_info_ptr cur_frame);
+extern CORE_ADDR gdbarch_get_return_buf_addr (struct gdbarch *gdbarch,
+ struct type *val_type,
+ frame_info_ptr cur_frame);
+extern void set_gdbarch_get_return_buf_addr (
+ struct gdbarch *gdbarch,
+ gdbarch_get_return_buf_addr_ftype *get_return_buf_addr);
/* Return true if the return value of function is stored in the first hidden
parameter. In theory, this feature should be language-dependent, specified
@@ -474,19 +687,30 @@ extern void set_gdbarch_get_return_buf_addr (struct gdbarch *gdbarch, gdbarch_ge
implement it to a target-dependent feature. So that we need such hook here
to be aware of this in GDB. */
-typedef int (gdbarch_return_in_first_hidden_param_p_ftype) (struct gdbarch *gdbarch, struct type *type);
-extern int gdbarch_return_in_first_hidden_param_p (struct gdbarch *gdbarch, struct type *type);
-extern void set_gdbarch_return_in_first_hidden_param_p (struct gdbarch *gdbarch, gdbarch_return_in_first_hidden_param_p_ftype *return_in_first_hidden_param_p);
+typedef int (gdbarch_return_in_first_hidden_param_p_ftype) (
+ struct gdbarch *gdbarch, struct type *type);
+extern int gdbarch_return_in_first_hidden_param_p (struct gdbarch *gdbarch,
+ struct type *type);
+extern void set_gdbarch_return_in_first_hidden_param_p (
+ struct gdbarch *gdbarch, gdbarch_return_in_first_hidden_param_p_ftype
+ *return_in_first_hidden_param_p);
-typedef CORE_ADDR (gdbarch_skip_prologue_ftype) (struct gdbarch *gdbarch, CORE_ADDR ip);
+typedef CORE_ADDR (gdbarch_skip_prologue_ftype) (struct gdbarch *gdbarch,
+ CORE_ADDR ip);
extern CORE_ADDR gdbarch_skip_prologue (struct gdbarch *gdbarch, CORE_ADDR ip);
-extern void set_gdbarch_skip_prologue (struct gdbarch *gdbarch, gdbarch_skip_prologue_ftype *skip_prologue);
+extern void
+set_gdbarch_skip_prologue (struct gdbarch *gdbarch,
+ gdbarch_skip_prologue_ftype *skip_prologue);
extern bool gdbarch_skip_main_prologue_p (struct gdbarch *gdbarch);
-typedef CORE_ADDR (gdbarch_skip_main_prologue_ftype) (struct gdbarch *gdbarch, CORE_ADDR ip);
-extern CORE_ADDR gdbarch_skip_main_prologue (struct gdbarch *gdbarch, CORE_ADDR ip);
-extern void set_gdbarch_skip_main_prologue (struct gdbarch *gdbarch, gdbarch_skip_main_prologue_ftype *skip_main_prologue);
+typedef CORE_ADDR (gdbarch_skip_main_prologue_ftype) (struct gdbarch *gdbarch,
+ CORE_ADDR ip);
+extern CORE_ADDR gdbarch_skip_main_prologue (struct gdbarch *gdbarch,
+ CORE_ADDR ip);
+extern void set_gdbarch_skip_main_prologue (
+ struct gdbarch *gdbarch,
+ gdbarch_skip_main_prologue_ftype *skip_main_prologue);
/* On some platforms, a single function may provide multiple entry points,
e.g. one that is used for function-pointer calls and a different one
@@ -502,56 +726,94 @@ extern void set_gdbarch_skip_main_prologue (struct gdbarch *gdbarch, gdbarch_ski
extern bool gdbarch_skip_entrypoint_p (struct gdbarch *gdbarch);
-typedef CORE_ADDR (gdbarch_skip_entrypoint_ftype) (struct gdbarch *gdbarch, CORE_ADDR ip);
-extern CORE_ADDR gdbarch_skip_entrypoint (struct gdbarch *gdbarch, CORE_ADDR ip);
-extern void set_gdbarch_skip_entrypoint (struct gdbarch *gdbarch, gdbarch_skip_entrypoint_ftype *skip_entrypoint);
+typedef CORE_ADDR (gdbarch_skip_entrypoint_ftype) (struct gdbarch *gdbarch,
+ CORE_ADDR ip);
+extern CORE_ADDR gdbarch_skip_entrypoint (struct gdbarch *gdbarch,
+ CORE_ADDR ip);
+extern void
+set_gdbarch_skip_entrypoint (struct gdbarch *gdbarch,
+ gdbarch_skip_entrypoint_ftype *skip_entrypoint);
typedef int (gdbarch_inner_than_ftype) (CORE_ADDR lhs, CORE_ADDR rhs);
-extern int gdbarch_inner_than (struct gdbarch *gdbarch, CORE_ADDR lhs, CORE_ADDR rhs);
-extern void set_gdbarch_inner_than (struct gdbarch *gdbarch, gdbarch_inner_than_ftype *inner_than);
-
-typedef const gdb_byte * (gdbarch_breakpoint_from_pc_ftype) (struct gdbarch *gdbarch, CORE_ADDR *pcptr, int *lenptr);
-extern const gdb_byte * gdbarch_breakpoint_from_pc (struct gdbarch *gdbarch, CORE_ADDR *pcptr, int *lenptr);
-extern void set_gdbarch_breakpoint_from_pc (struct gdbarch *gdbarch, gdbarch_breakpoint_from_pc_ftype *breakpoint_from_pc);
+extern int gdbarch_inner_than (struct gdbarch *gdbarch, CORE_ADDR lhs,
+ CORE_ADDR rhs);
+extern void set_gdbarch_inner_than (struct gdbarch *gdbarch,
+ gdbarch_inner_than_ftype *inner_than);
+
+typedef const gdb_byte *(
+ gdbarch_breakpoint_from_pc_ftype) (struct gdbarch *gdbarch, CORE_ADDR *pcptr,
+ int *lenptr);
+extern const gdb_byte *gdbarch_breakpoint_from_pc (struct gdbarch *gdbarch,
+ CORE_ADDR *pcptr,
+ int *lenptr);
+extern void set_gdbarch_breakpoint_from_pc (
+ struct gdbarch *gdbarch,
+ gdbarch_breakpoint_from_pc_ftype *breakpoint_from_pc);
/* Return the breakpoint kind for this target based on *PCPTR. */
-typedef int (gdbarch_breakpoint_kind_from_pc_ftype) (struct gdbarch *gdbarch, CORE_ADDR *pcptr);
-extern int gdbarch_breakpoint_kind_from_pc (struct gdbarch *gdbarch, CORE_ADDR *pcptr);
-extern void set_gdbarch_breakpoint_kind_from_pc (struct gdbarch *gdbarch, gdbarch_breakpoint_kind_from_pc_ftype *breakpoint_kind_from_pc);
+typedef int (gdbarch_breakpoint_kind_from_pc_ftype) (struct gdbarch *gdbarch,
+ CORE_ADDR *pcptr);
+extern int gdbarch_breakpoint_kind_from_pc (struct gdbarch *gdbarch,
+ CORE_ADDR *pcptr);
+extern void set_gdbarch_breakpoint_kind_from_pc (
+ struct gdbarch *gdbarch,
+ gdbarch_breakpoint_kind_from_pc_ftype *breakpoint_kind_from_pc);
/* Return the software breakpoint from KIND. KIND can have target
specific meaning like the Z0 kind parameter.
SIZE is set to the software breakpoint's length in memory. */
-typedef const gdb_byte * (gdbarch_sw_breakpoint_from_kind_ftype) (struct gdbarch *gdbarch, int kind, int *size);
-extern const gdb_byte * gdbarch_sw_breakpoint_from_kind (struct gdbarch *gdbarch, int kind, int *size);
-extern void set_gdbarch_sw_breakpoint_from_kind (struct gdbarch *gdbarch, gdbarch_sw_breakpoint_from_kind_ftype *sw_breakpoint_from_kind);
+typedef const gdb_byte *(
+ gdbarch_sw_breakpoint_from_kind_ftype) (struct gdbarch *gdbarch, int kind,
+ int *size);
+extern const gdb_byte *
+gdbarch_sw_breakpoint_from_kind (struct gdbarch *gdbarch, int kind, int *size);
+extern void set_gdbarch_sw_breakpoint_from_kind (
+ struct gdbarch *gdbarch,
+ gdbarch_sw_breakpoint_from_kind_ftype *sw_breakpoint_from_kind);
/* Return the breakpoint kind for this target based on the current
processor state (e.g. the current instruction mode on ARM) and the
*PCPTR. In default, it is gdbarch->breakpoint_kind_from_pc. */
-typedef int (gdbarch_breakpoint_kind_from_current_state_ftype) (struct gdbarch *gdbarch, struct regcache *regcache, CORE_ADDR *pcptr);
-extern int gdbarch_breakpoint_kind_from_current_state (struct gdbarch *gdbarch, struct regcache *regcache, CORE_ADDR *pcptr);
-extern void set_gdbarch_breakpoint_kind_from_current_state (struct gdbarch *gdbarch, gdbarch_breakpoint_kind_from_current_state_ftype *breakpoint_kind_from_current_state);
+typedef int (gdbarch_breakpoint_kind_from_current_state_ftype) (
+ struct gdbarch *gdbarch, struct regcache *regcache, CORE_ADDR *pcptr);
+extern int gdbarch_breakpoint_kind_from_current_state (
+ struct gdbarch *gdbarch, struct regcache *regcache, CORE_ADDR *pcptr);
+extern void set_gdbarch_breakpoint_kind_from_current_state (
+ struct gdbarch *gdbarch, gdbarch_breakpoint_kind_from_current_state_ftype
+ *breakpoint_kind_from_current_state);
extern bool gdbarch_adjust_breakpoint_address_p (struct gdbarch *gdbarch);
-typedef CORE_ADDR (gdbarch_adjust_breakpoint_address_ftype) (struct gdbarch *gdbarch, CORE_ADDR bpaddr);
-extern CORE_ADDR gdbarch_adjust_breakpoint_address (struct gdbarch *gdbarch, CORE_ADDR bpaddr);
-extern void set_gdbarch_adjust_breakpoint_address (struct gdbarch *gdbarch, gdbarch_adjust_breakpoint_address_ftype *adjust_breakpoint_address);
-
-typedef int (gdbarch_memory_insert_breakpoint_ftype) (struct gdbarch *gdbarch, struct bp_target_info *bp_tgt);
-extern int gdbarch_memory_insert_breakpoint (struct gdbarch *gdbarch, struct bp_target_info *bp_tgt);
-extern void set_gdbarch_memory_insert_breakpoint (struct gdbarch *gdbarch, gdbarch_memory_insert_breakpoint_ftype *memory_insert_breakpoint);
-
-typedef int (gdbarch_memory_remove_breakpoint_ftype) (struct gdbarch *gdbarch, struct bp_target_info *bp_tgt);
-extern int gdbarch_memory_remove_breakpoint (struct gdbarch *gdbarch, struct bp_target_info *bp_tgt);
-extern void set_gdbarch_memory_remove_breakpoint (struct gdbarch *gdbarch, gdbarch_memory_remove_breakpoint_ftype *memory_remove_breakpoint);
+typedef CORE_ADDR (gdbarch_adjust_breakpoint_address_ftype) (
+ struct gdbarch *gdbarch, CORE_ADDR bpaddr);
+extern CORE_ADDR gdbarch_adjust_breakpoint_address (struct gdbarch *gdbarch,
+ CORE_ADDR bpaddr);
+extern void set_gdbarch_adjust_breakpoint_address (
+ struct gdbarch *gdbarch,
+ gdbarch_adjust_breakpoint_address_ftype *adjust_breakpoint_address);
+
+typedef int (gdbarch_memory_insert_breakpoint_ftype) (
+ struct gdbarch *gdbarch, struct bp_target_info *bp_tgt);
+extern int gdbarch_memory_insert_breakpoint (struct gdbarch *gdbarch,
+ struct bp_target_info *bp_tgt);
+extern void set_gdbarch_memory_insert_breakpoint (
+ struct gdbarch *gdbarch,
+ gdbarch_memory_insert_breakpoint_ftype *memory_insert_breakpoint);
+
+typedef int (gdbarch_memory_remove_breakpoint_ftype) (
+ struct gdbarch *gdbarch, struct bp_target_info *bp_tgt);
+extern int gdbarch_memory_remove_breakpoint (struct gdbarch *gdbarch,
+ struct bp_target_info *bp_tgt);
+extern void set_gdbarch_memory_remove_breakpoint (
+ struct gdbarch *gdbarch,
+ gdbarch_memory_remove_breakpoint_ftype *memory_remove_breakpoint);
extern CORE_ADDR gdbarch_decr_pc_after_break (struct gdbarch *gdbarch);
-extern void set_gdbarch_decr_pc_after_break (struct gdbarch *gdbarch, CORE_ADDR decr_pc_after_break);
+extern void set_gdbarch_decr_pc_after_break (struct gdbarch *gdbarch,
+ CORE_ADDR decr_pc_after_break);
/* A function can be addressed by either it's "pointer" (possibly a
descriptor address) or "entry point" (first executable instruction).
@@ -561,23 +823,33 @@ extern void set_gdbarch_decr_pc_after_break (struct gdbarch *gdbarch, CORE_ADDR
corresponds to the "function pointer" and the function's start
corresponds to the "function entry point" - and hence is redundant. */
-extern CORE_ADDR gdbarch_deprecated_function_start_offset (struct gdbarch *gdbarch);
-extern void set_gdbarch_deprecated_function_start_offset (struct gdbarch *gdbarch, CORE_ADDR deprecated_function_start_offset);
+extern CORE_ADDR
+gdbarch_deprecated_function_start_offset (struct gdbarch *gdbarch);
+extern void set_gdbarch_deprecated_function_start_offset (
+ struct gdbarch *gdbarch, CORE_ADDR deprecated_function_start_offset);
/* Return the remote protocol register number associated with this
register. Normally the identity mapping. */
-typedef int (gdbarch_remote_register_number_ftype) (struct gdbarch *gdbarch, int regno);
+typedef int (gdbarch_remote_register_number_ftype) (struct gdbarch *gdbarch,
+ int regno);
extern int gdbarch_remote_register_number (struct gdbarch *gdbarch, int regno);
-extern void set_gdbarch_remote_register_number (struct gdbarch *gdbarch, gdbarch_remote_register_number_ftype *remote_register_number);
+extern void set_gdbarch_remote_register_number (
+ struct gdbarch *gdbarch,
+ gdbarch_remote_register_number_ftype *remote_register_number);
/* Fetch the target specific address used to represent a load module. */
extern bool gdbarch_fetch_tls_load_module_address_p (struct gdbarch *gdbarch);
-typedef CORE_ADDR (gdbarch_fetch_tls_load_module_address_ftype) (struct objfile *objfile);
-extern CORE_ADDR gdbarch_fetch_tls_load_module_address (struct gdbarch *gdbarch, struct objfile *objfile);
-extern void set_gdbarch_fetch_tls_load_module_address (struct gdbarch *gdbarch, gdbarch_fetch_tls_load_module_address_ftype *fetch_tls_load_module_address);
+typedef CORE_ADDR (gdbarch_fetch_tls_load_module_address_ftype) (
+ struct objfile *objfile);
+extern CORE_ADDR
+gdbarch_fetch_tls_load_module_address (struct gdbarch *gdbarch,
+ struct objfile *objfile);
+extern void set_gdbarch_fetch_tls_load_module_address (
+ struct gdbarch *gdbarch,
+ gdbarch_fetch_tls_load_module_address_ftype *fetch_tls_load_module_address);
/* Return the thread-local address at OFFSET in the thread-local
storage for the thread PTID and the shared library or executable
@@ -587,20 +859,33 @@ extern void set_gdbarch_fetch_tls_load_module_address (struct gdbarch *gdbarch,
extern bool gdbarch_get_thread_local_address_p (struct gdbarch *gdbarch);
-typedef CORE_ADDR (gdbarch_get_thread_local_address_ftype) (struct gdbarch *gdbarch, ptid_t ptid, CORE_ADDR lm_addr, CORE_ADDR offset);
-extern CORE_ADDR gdbarch_get_thread_local_address (struct gdbarch *gdbarch, ptid_t ptid, CORE_ADDR lm_addr, CORE_ADDR offset);
-extern void set_gdbarch_get_thread_local_address (struct gdbarch *gdbarch, gdbarch_get_thread_local_address_ftype *get_thread_local_address);
+typedef CORE_ADDR (gdbarch_get_thread_local_address_ftype) (
+ struct gdbarch *gdbarch, ptid_t ptid, CORE_ADDR lm_addr, CORE_ADDR offset);
+extern CORE_ADDR gdbarch_get_thread_local_address (struct gdbarch *gdbarch,
+ ptid_t ptid,
+ CORE_ADDR lm_addr,
+ CORE_ADDR offset);
+extern void set_gdbarch_get_thread_local_address (
+ struct gdbarch *gdbarch,
+ gdbarch_get_thread_local_address_ftype *get_thread_local_address);
extern CORE_ADDR gdbarch_frame_args_skip (struct gdbarch *gdbarch);
-extern void set_gdbarch_frame_args_skip (struct gdbarch *gdbarch, CORE_ADDR frame_args_skip);
-
-typedef CORE_ADDR (gdbarch_unwind_pc_ftype) (struct gdbarch *gdbarch, frame_info_ptr next_frame);
-extern CORE_ADDR gdbarch_unwind_pc (struct gdbarch *gdbarch, frame_info_ptr next_frame);
-extern void set_gdbarch_unwind_pc (struct gdbarch *gdbarch, gdbarch_unwind_pc_ftype *unwind_pc);
-
-typedef CORE_ADDR (gdbarch_unwind_sp_ftype) (struct gdbarch *gdbarch, frame_info_ptr next_frame);
-extern CORE_ADDR gdbarch_unwind_sp (struct gdbarch *gdbarch, frame_info_ptr next_frame);
-extern void set_gdbarch_unwind_sp (struct gdbarch *gdbarch, gdbarch_unwind_sp_ftype *unwind_sp);
+extern void set_gdbarch_frame_args_skip (struct gdbarch *gdbarch,
+ CORE_ADDR frame_args_skip);
+
+typedef CORE_ADDR (gdbarch_unwind_pc_ftype) (struct gdbarch *gdbarch,
+ frame_info_ptr next_frame);
+extern CORE_ADDR gdbarch_unwind_pc (struct gdbarch *gdbarch,
+ frame_info_ptr next_frame);
+extern void set_gdbarch_unwind_pc (struct gdbarch *gdbarch,
+ gdbarch_unwind_pc_ftype *unwind_pc);
+
+typedef CORE_ADDR (gdbarch_unwind_sp_ftype) (struct gdbarch *gdbarch,
+ frame_info_ptr next_frame);
+extern CORE_ADDR gdbarch_unwind_sp (struct gdbarch *gdbarch,
+ frame_info_ptr next_frame);
+extern void set_gdbarch_unwind_sp (struct gdbarch *gdbarch,
+ gdbarch_unwind_sp_ftype *unwind_sp);
/* DEPRECATED_FRAME_LOCALS_ADDRESS as been replaced by the per-frame
frame-base. Enable frame-base before frame-unwind. */
@@ -608,25 +893,41 @@ extern void set_gdbarch_unwind_sp (struct gdbarch *gdbarch, gdbarch_unwind_sp_ft
extern bool gdbarch_frame_num_args_p (struct gdbarch *gdbarch);
typedef int (gdbarch_frame_num_args_ftype) (frame_info_ptr frame);
-extern int gdbarch_frame_num_args (struct gdbarch *gdbarch, frame_info_ptr frame);
-extern void set_gdbarch_frame_num_args (struct gdbarch *gdbarch, gdbarch_frame_num_args_ftype *frame_num_args);
+extern int gdbarch_frame_num_args (struct gdbarch *gdbarch,
+ frame_info_ptr frame);
+extern void
+set_gdbarch_frame_num_args (struct gdbarch *gdbarch,
+ gdbarch_frame_num_args_ftype *frame_num_args);
extern bool gdbarch_frame_align_p (struct gdbarch *gdbarch);
-typedef CORE_ADDR (gdbarch_frame_align_ftype) (struct gdbarch *gdbarch, CORE_ADDR address);
-extern CORE_ADDR gdbarch_frame_align (struct gdbarch *gdbarch, CORE_ADDR address);
-extern void set_gdbarch_frame_align (struct gdbarch *gdbarch, gdbarch_frame_align_ftype *frame_align);
-
-typedef int (gdbarch_stabs_argument_has_addr_ftype) (struct gdbarch *gdbarch, struct type *type);
-extern int gdbarch_stabs_argument_has_addr (struct gdbarch *gdbarch, struct type *type);
-extern void set_gdbarch_stabs_argument_has_addr (struct gdbarch *gdbarch, gdbarch_stabs_argument_has_addr_ftype *stabs_argument_has_addr);
+typedef CORE_ADDR (gdbarch_frame_align_ftype) (struct gdbarch *gdbarch,
+ CORE_ADDR address);
+extern CORE_ADDR gdbarch_frame_align (struct gdbarch *gdbarch,
+ CORE_ADDR address);
+extern void set_gdbarch_frame_align (struct gdbarch *gdbarch,
+ gdbarch_frame_align_ftype *frame_align);
+
+typedef int (gdbarch_stabs_argument_has_addr_ftype) (struct gdbarch *gdbarch,
+ struct type *type);
+extern int gdbarch_stabs_argument_has_addr (struct gdbarch *gdbarch,
+ struct type *type);
+extern void set_gdbarch_stabs_argument_has_addr (
+ struct gdbarch *gdbarch,
+ gdbarch_stabs_argument_has_addr_ftype *stabs_argument_has_addr);
extern int gdbarch_frame_red_zone_size (struct gdbarch *gdbarch);
-extern void set_gdbarch_frame_red_zone_size (struct gdbarch *gdbarch, int frame_red_zone_size);
-
-typedef CORE_ADDR (gdbarch_convert_from_func_ptr_addr_ftype) (struct gdbarch *gdbarch, CORE_ADDR addr, struct target_ops *targ);
-extern CORE_ADDR gdbarch_convert_from_func_ptr_addr (struct gdbarch *gdbarch, CORE_ADDR addr, struct target_ops *targ);
-extern void set_gdbarch_convert_from_func_ptr_addr (struct gdbarch *gdbarch, gdbarch_convert_from_func_ptr_addr_ftype *convert_from_func_ptr_addr);
+extern void set_gdbarch_frame_red_zone_size (struct gdbarch *gdbarch,
+ int frame_red_zone_size);
+
+typedef CORE_ADDR (gdbarch_convert_from_func_ptr_addr_ftype) (
+ struct gdbarch *gdbarch, CORE_ADDR addr, struct target_ops *targ);
+extern CORE_ADDR gdbarch_convert_from_func_ptr_addr (struct gdbarch *gdbarch,
+ CORE_ADDR addr,
+ struct target_ops *targ);
+extern void set_gdbarch_convert_from_func_ptr_addr (
+ struct gdbarch *gdbarch,
+ gdbarch_convert_from_func_ptr_addr_ftype *convert_from_func_ptr_addr);
/* On some machines there are bits in addresses which are not really
part of the address, but are used by the kernel, the hardware, etc.
@@ -638,9 +939,12 @@ extern void set_gdbarch_convert_from_func_ptr_addr (struct gdbarch *gdbarch, gdb
sort of generic thing to handle alignment or segmentation (it's
possible it should be in TARGET_READ_PC instead). */
-typedef CORE_ADDR (gdbarch_addr_bits_remove_ftype) (struct gdbarch *gdbarch, CORE_ADDR addr);
-extern CORE_ADDR gdbarch_addr_bits_remove (struct gdbarch *gdbarch, CORE_ADDR addr);
-extern void set_gdbarch_addr_bits_remove (struct gdbarch *gdbarch, gdbarch_addr_bits_remove_ftype *addr_bits_remove);
+typedef CORE_ADDR (gdbarch_addr_bits_remove_ftype) (struct gdbarch *gdbarch,
+ CORE_ADDR addr);
+extern CORE_ADDR gdbarch_addr_bits_remove (struct gdbarch *gdbarch,
+ CORE_ADDR addr);
+extern void set_gdbarch_addr_bits_remove (
+ struct gdbarch *gdbarch, gdbarch_addr_bits_remove_ftype *addr_bits_remove);
/* On some architectures, not all bits of a pointer are significant.
On AArch64, for example, the top bits of a pointer may carry a "tag", which
@@ -653,44 +957,69 @@ extern void set_gdbarch_addr_bits_remove (struct gdbarch *gdbarch, gdbarch_addr_
bits from a pointer) and from code pointers (removing the AArch64 PAC signature
from a pointer containing the return address). */
-typedef CORE_ADDR (gdbarch_remove_non_address_bits_ftype) (struct gdbarch *gdbarch, CORE_ADDR pointer);
-extern CORE_ADDR gdbarch_remove_non_address_bits (struct gdbarch *gdbarch, CORE_ADDR pointer);
-extern void set_gdbarch_remove_non_address_bits (struct gdbarch *gdbarch, gdbarch_remove_non_address_bits_ftype *remove_non_address_bits);
+typedef CORE_ADDR (gdbarch_remove_non_address_bits_ftype) (
+ struct gdbarch *gdbarch, CORE_ADDR pointer);
+extern CORE_ADDR gdbarch_remove_non_address_bits (struct gdbarch *gdbarch,
+ CORE_ADDR pointer);
+extern void set_gdbarch_remove_non_address_bits (
+ struct gdbarch *gdbarch,
+ gdbarch_remove_non_address_bits_ftype *remove_non_address_bits);
/* Return a string representation of the memory tag TAG. */
-typedef std::string (gdbarch_memtag_to_string_ftype) (struct gdbarch *gdbarch, struct value *tag);
-extern std::string gdbarch_memtag_to_string (struct gdbarch *gdbarch, struct value *tag);
-extern void set_gdbarch_memtag_to_string (struct gdbarch *gdbarch, gdbarch_memtag_to_string_ftype *memtag_to_string);
+typedef std::string (gdbarch_memtag_to_string_ftype) (struct gdbarch *gdbarch,
+ struct value *tag);
+extern std::string gdbarch_memtag_to_string (struct gdbarch *gdbarch,
+ struct value *tag);
+extern void set_gdbarch_memtag_to_string (
+ struct gdbarch *gdbarch, gdbarch_memtag_to_string_ftype *memtag_to_string);
/* Return true if ADDRESS contains a tag and false otherwise. ADDRESS
must be either a pointer or a reference type. */
-typedef bool (gdbarch_tagged_address_p_ftype) (struct gdbarch *gdbarch, struct value *address);
-extern bool gdbarch_tagged_address_p (struct gdbarch *gdbarch, struct value *address);
-extern void set_gdbarch_tagged_address_p (struct gdbarch *gdbarch, gdbarch_tagged_address_p_ftype *tagged_address_p);
+typedef bool (gdbarch_tagged_address_p_ftype) (struct gdbarch *gdbarch,
+ struct value *address);
+extern bool gdbarch_tagged_address_p (struct gdbarch *gdbarch,
+ struct value *address);
+extern void set_gdbarch_tagged_address_p (
+ struct gdbarch *gdbarch, gdbarch_tagged_address_p_ftype *tagged_address_p);
/* Return true if the tag from ADDRESS matches the memory tag for that
particular address. Return false otherwise. */
-typedef bool (gdbarch_memtag_matches_p_ftype) (struct gdbarch *gdbarch, struct value *address);
-extern bool gdbarch_memtag_matches_p (struct gdbarch *gdbarch, struct value *address);
-extern void set_gdbarch_memtag_matches_p (struct gdbarch *gdbarch, gdbarch_memtag_matches_p_ftype *memtag_matches_p);
+typedef bool (gdbarch_memtag_matches_p_ftype) (struct gdbarch *gdbarch,
+ struct value *address);
+extern bool gdbarch_memtag_matches_p (struct gdbarch *gdbarch,
+ struct value *address);
+extern void set_gdbarch_memtag_matches_p (
+ struct gdbarch *gdbarch, gdbarch_memtag_matches_p_ftype *memtag_matches_p);
/* Set the tags of type TAG_TYPE, for the memory address range
[ADDRESS, ADDRESS + LENGTH) to TAGS.
Return true if successful and false otherwise. */
-typedef bool (gdbarch_set_memtags_ftype) (struct gdbarch *gdbarch, struct value *address, size_t length, const gdb::byte_vector &tags, memtag_type tag_type);
-extern bool gdbarch_set_memtags (struct gdbarch *gdbarch, struct value *address, size_t length, const gdb::byte_vector &tags, memtag_type tag_type);
-extern void set_gdbarch_set_memtags (struct gdbarch *gdbarch, gdbarch_set_memtags_ftype *set_memtags);
+typedef bool (gdbarch_set_memtags_ftype) (struct gdbarch *gdbarch,
+ struct value *address, size_t length,
+ const gdb::byte_vector &tags,
+ memtag_type tag_type);
+extern bool gdbarch_set_memtags (struct gdbarch *gdbarch,
+ struct value *address, size_t length,
+ const gdb::byte_vector &tags,
+ memtag_type tag_type);
+extern void set_gdbarch_set_memtags (struct gdbarch *gdbarch,
+ gdbarch_set_memtags_ftype *set_memtags);
/* Return the tag of type TAG_TYPE associated with the memory address ADDRESS,
assuming ADDRESS is tagged. */
-typedef struct value * (gdbarch_get_memtag_ftype) (struct gdbarch *gdbarch, struct value *address, memtag_type tag_type);
-extern struct value * gdbarch_get_memtag (struct gdbarch *gdbarch, struct value *address, memtag_type tag_type);
-extern void set_gdbarch_get_memtag (struct gdbarch *gdbarch, gdbarch_get_memtag_ftype *get_memtag);
+typedef struct value *(gdbarch_get_memtag_ftype) (struct gdbarch *gdbarch,
+ struct value *address,
+ memtag_type tag_type);
+extern struct value *gdbarch_get_memtag (struct gdbarch *gdbarch,
+ struct value *address,
+ memtag_type tag_type);
+extern void set_gdbarch_get_memtag (struct gdbarch *gdbarch,
+ gdbarch_get_memtag_ftype *get_memtag);
/* memtag_granule_size is the size of the allocation tag granule, for
architectures that support memory tagging.
@@ -698,7 +1027,8 @@ extern void set_gdbarch_get_memtag (struct gdbarch *gdbarch, gdbarch_get_memtag_
For a non-zero value, this represents the number of bytes of memory per tag. */
extern CORE_ADDR gdbarch_memtag_granule_size (struct gdbarch *gdbarch);
-extern void set_gdbarch_memtag_granule_size (struct gdbarch *gdbarch, CORE_ADDR memtag_granule_size);
+extern void set_gdbarch_memtag_granule_size (struct gdbarch *gdbarch,
+ CORE_ADDR memtag_granule_size);
/* FIXME/cagney/2001-01-18: This should be split in two. A target method that
indicates if the target needs software single step. An ISA method to
@@ -718,54 +1048,84 @@ extern void set_gdbarch_memtag_granule_size (struct gdbarch *gdbarch, CORE_ADDR
extern bool gdbarch_software_single_step_p (struct gdbarch *gdbarch);
-typedef std::vector<CORE_ADDR> (gdbarch_software_single_step_ftype) (struct regcache *regcache);
-extern std::vector<CORE_ADDR> gdbarch_software_single_step (struct gdbarch *gdbarch, struct regcache *regcache);
-extern void set_gdbarch_software_single_step (struct gdbarch *gdbarch, gdbarch_software_single_step_ftype *software_single_step);
+typedef std::vector<CORE_ADDR> (gdbarch_software_single_step_ftype) (
+ struct regcache *regcache);
+extern std::vector<CORE_ADDR>
+gdbarch_software_single_step (struct gdbarch *gdbarch,
+ struct regcache *regcache);
+extern void set_gdbarch_software_single_step (
+ struct gdbarch *gdbarch,
+ gdbarch_software_single_step_ftype *software_single_step);
/* Return non-zero if the processor is executing a delay slot and a
further single-step is needed before the instruction finishes. */
extern bool gdbarch_single_step_through_delay_p (struct gdbarch *gdbarch);
-typedef int (gdbarch_single_step_through_delay_ftype) (struct gdbarch *gdbarch, frame_info_ptr frame);
-extern int gdbarch_single_step_through_delay (struct gdbarch *gdbarch, frame_info_ptr frame);
-extern void set_gdbarch_single_step_through_delay (struct gdbarch *gdbarch, gdbarch_single_step_through_delay_ftype *single_step_through_delay);
+typedef int (gdbarch_single_step_through_delay_ftype) (struct gdbarch *gdbarch,
+ frame_info_ptr frame);
+extern int gdbarch_single_step_through_delay (struct gdbarch *gdbarch,
+ frame_info_ptr frame);
+extern void set_gdbarch_single_step_through_delay (
+ struct gdbarch *gdbarch,
+ gdbarch_single_step_through_delay_ftype *single_step_through_delay);
/* FIXME: cagney/2003-08-28: Need to find a better way of selecting the
disassembler. Perhaps objdump can handle it? */
-typedef int (gdbarch_print_insn_ftype) (bfd_vma vma, struct disassemble_info *info);
-extern int gdbarch_print_insn (struct gdbarch *gdbarch, bfd_vma vma, struct disassemble_info *info);
-extern void set_gdbarch_print_insn (struct gdbarch *gdbarch, gdbarch_print_insn_ftype *print_insn);
-
-typedef CORE_ADDR (gdbarch_skip_trampoline_code_ftype) (frame_info_ptr frame, CORE_ADDR pc);
-extern CORE_ADDR gdbarch_skip_trampoline_code (struct gdbarch *gdbarch, frame_info_ptr frame, CORE_ADDR pc);
-extern void set_gdbarch_skip_trampoline_code (struct gdbarch *gdbarch, gdbarch_skip_trampoline_code_ftype *skip_trampoline_code);
+typedef int (gdbarch_print_insn_ftype) (bfd_vma vma,
+ struct disassemble_info *info);
+extern int gdbarch_print_insn (struct gdbarch *gdbarch, bfd_vma vma,
+ struct disassemble_info *info);
+extern void set_gdbarch_print_insn (struct gdbarch *gdbarch,
+ gdbarch_print_insn_ftype *print_insn);
+
+typedef CORE_ADDR (gdbarch_skip_trampoline_code_ftype) (frame_info_ptr frame,
+ CORE_ADDR pc);
+extern CORE_ADDR gdbarch_skip_trampoline_code (struct gdbarch *gdbarch,
+ frame_info_ptr frame,
+ CORE_ADDR pc);
+extern void set_gdbarch_skip_trampoline_code (
+ struct gdbarch *gdbarch,
+ gdbarch_skip_trampoline_code_ftype *skip_trampoline_code);
/* Vtable of solib operations functions. */
-extern const struct target_so_ops * gdbarch_so_ops (struct gdbarch *gdbarch);
-extern void set_gdbarch_so_ops (struct gdbarch *gdbarch, const struct target_so_ops * so_ops);
+extern const struct target_so_ops *gdbarch_so_ops (struct gdbarch *gdbarch);
+extern void set_gdbarch_so_ops (struct gdbarch *gdbarch,
+ const struct target_so_ops *so_ops);
/* If in_solib_dynsym_resolve_code() returns true, and SKIP_SOLIB_RESOLVER
evaluates non-zero, this is the address where the debugger will place
a step-resume breakpoint to get us past the dynamic linker. */
-typedef CORE_ADDR (gdbarch_skip_solib_resolver_ftype) (struct gdbarch *gdbarch, CORE_ADDR pc);
-extern CORE_ADDR gdbarch_skip_solib_resolver (struct gdbarch *gdbarch, CORE_ADDR pc);
-extern void set_gdbarch_skip_solib_resolver (struct gdbarch *gdbarch, gdbarch_skip_solib_resolver_ftype *skip_solib_resolver);
+typedef CORE_ADDR (gdbarch_skip_solib_resolver_ftype) (struct gdbarch *gdbarch,
+ CORE_ADDR pc);
+extern CORE_ADDR gdbarch_skip_solib_resolver (struct gdbarch *gdbarch,
+ CORE_ADDR pc);
+extern void set_gdbarch_skip_solib_resolver (
+ struct gdbarch *gdbarch,
+ gdbarch_skip_solib_resolver_ftype *skip_solib_resolver);
/* Some systems also have trampoline code for returning from shared libs. */
-typedef int (gdbarch_in_solib_return_trampoline_ftype) (struct gdbarch *gdbarch, CORE_ADDR pc, const char *name);
-extern int gdbarch_in_solib_return_trampoline (struct gdbarch *gdbarch, CORE_ADDR pc, const char *name);
-extern void set_gdbarch_in_solib_return_trampoline (struct gdbarch *gdbarch, gdbarch_in_solib_return_trampoline_ftype *in_solib_return_trampoline);
+typedef int (gdbarch_in_solib_return_trampoline_ftype) (
+ struct gdbarch *gdbarch, CORE_ADDR pc, const char *name);
+extern int gdbarch_in_solib_return_trampoline (struct gdbarch *gdbarch,
+ CORE_ADDR pc, const char *name);
+extern void set_gdbarch_in_solib_return_trampoline (
+ struct gdbarch *gdbarch,
+ gdbarch_in_solib_return_trampoline_ftype *in_solib_return_trampoline);
/* Return true if PC lies inside an indirect branch thunk. */
-typedef bool (gdbarch_in_indirect_branch_thunk_ftype) (struct gdbarch *gdbarch, CORE_ADDR pc);
-extern bool gdbarch_in_indirect_branch_thunk (struct gdbarch *gdbarch, CORE_ADDR pc);
-extern void set_gdbarch_in_indirect_branch_thunk (struct gdbarch *gdbarch, gdbarch_in_indirect_branch_thunk_ftype *in_indirect_branch_thunk);
+typedef bool (gdbarch_in_indirect_branch_thunk_ftype) (struct gdbarch *gdbarch,
+ CORE_ADDR pc);
+extern bool gdbarch_in_indirect_branch_thunk (struct gdbarch *gdbarch,
+ CORE_ADDR pc);
+extern void set_gdbarch_in_indirect_branch_thunk (
+ struct gdbarch *gdbarch,
+ gdbarch_in_indirect_branch_thunk_ftype *in_indirect_branch_thunk);
/* A target might have problems with watchpoints as soon as the stack
frame of the current function has been destroyed. This mostly happens
@@ -777,9 +1137,13 @@ extern void set_gdbarch_in_indirect_branch_thunk (struct gdbarch *gdbarch, gdbar
which don't suffer from that problem could just let this functionality
untouched. */
-typedef int (gdbarch_stack_frame_destroyed_p_ftype) (struct gdbarch *gdbarch, CORE_ADDR addr);
-extern int gdbarch_stack_frame_destroyed_p (struct gdbarch *gdbarch, CORE_ADDR addr);
-extern void set_gdbarch_stack_frame_destroyed_p (struct gdbarch *gdbarch, gdbarch_stack_frame_destroyed_p_ftype *stack_frame_destroyed_p);
+typedef int (gdbarch_stack_frame_destroyed_p_ftype) (struct gdbarch *gdbarch,
+ CORE_ADDR addr);
+extern int gdbarch_stack_frame_destroyed_p (struct gdbarch *gdbarch,
+ CORE_ADDR addr);
+extern void set_gdbarch_stack_frame_destroyed_p (
+ struct gdbarch *gdbarch,
+ gdbarch_stack_frame_destroyed_p_ftype *stack_frame_destroyed_p);
/* Process an ELF symbol in the minimal symbol table in a backend-specific
way. Normally this hook is supposed to do nothing, however if required,
@@ -791,13 +1155,23 @@ extern void set_gdbarch_stack_frame_destroyed_p (struct gdbarch *gdbarch, gdbarc
extern bool gdbarch_elf_make_msymbol_special_p (struct gdbarch *gdbarch);
-typedef void (gdbarch_elf_make_msymbol_special_ftype) (asymbol *sym, struct minimal_symbol *msym);
-extern void gdbarch_elf_make_msymbol_special (struct gdbarch *gdbarch, asymbol *sym, struct minimal_symbol *msym);
-extern void set_gdbarch_elf_make_msymbol_special (struct gdbarch *gdbarch, gdbarch_elf_make_msymbol_special_ftype *elf_make_msymbol_special);
-
-typedef void (gdbarch_coff_make_msymbol_special_ftype) (int val, struct minimal_symbol *msym);
-extern void gdbarch_coff_make_msymbol_special (struct gdbarch *gdbarch, int val, struct minimal_symbol *msym);
-extern void set_gdbarch_coff_make_msymbol_special (struct gdbarch *gdbarch, gdbarch_coff_make_msymbol_special_ftype *coff_make_msymbol_special);
+typedef void (gdbarch_elf_make_msymbol_special_ftype) (
+ asymbol *sym, struct minimal_symbol *msym);
+extern void gdbarch_elf_make_msymbol_special (struct gdbarch *gdbarch,
+ asymbol *sym,
+ struct minimal_symbol *msym);
+extern void set_gdbarch_elf_make_msymbol_special (
+ struct gdbarch *gdbarch,
+ gdbarch_elf_make_msymbol_special_ftype *elf_make_msymbol_special);
+
+typedef void (gdbarch_coff_make_msymbol_special_ftype) (
+ int val, struct minimal_symbol *msym);
+extern void gdbarch_coff_make_msymbol_special (struct gdbarch *gdbarch,
+ int val,
+ struct minimal_symbol *msym);
+extern void set_gdbarch_coff_make_msymbol_special (
+ struct gdbarch *gdbarch,
+ gdbarch_coff_make_msymbol_special_ftype *coff_make_msymbol_special);
/* Process a symbol in the main symbol table in a backend-specific way.
Normally this hook is supposed to do nothing, however if required,
@@ -808,9 +1182,14 @@ extern void set_gdbarch_coff_make_msymbol_special (struct gdbarch *gdbarch, gdba
the values used at the runtime by the program itself, for function
and label references. */
-typedef void (gdbarch_make_symbol_special_ftype) (struct symbol *sym, struct objfile *objfile);
-extern void gdbarch_make_symbol_special (struct gdbarch *gdbarch, struct symbol *sym, struct objfile *objfile);
-extern void set_gdbarch_make_symbol_special (struct gdbarch *gdbarch, gdbarch_make_symbol_special_ftype *make_symbol_special);
+typedef void (gdbarch_make_symbol_special_ftype) (struct symbol *sym,
+ struct objfile *objfile);
+extern void gdbarch_make_symbol_special (struct gdbarch *gdbarch,
+ struct symbol *sym,
+ struct objfile *objfile);
+extern void set_gdbarch_make_symbol_special (
+ struct gdbarch *gdbarch,
+ gdbarch_make_symbol_special_ftype *make_symbol_special);
/* Adjust the address retrieved from a DWARF-2 record other than a line
entry in a backend-specific way. Normally this hook is supposed to
@@ -822,8 +1201,11 @@ extern void set_gdbarch_make_symbol_special (struct gdbarch *gdbarch, gdbarch_ma
table. */
typedef CORE_ADDR (gdbarch_adjust_dwarf2_addr_ftype) (CORE_ADDR pc);
-extern CORE_ADDR gdbarch_adjust_dwarf2_addr (struct gdbarch *gdbarch, CORE_ADDR pc);
-extern void set_gdbarch_adjust_dwarf2_addr (struct gdbarch *gdbarch, gdbarch_adjust_dwarf2_addr_ftype *adjust_dwarf2_addr);
+extern CORE_ADDR gdbarch_adjust_dwarf2_addr (struct gdbarch *gdbarch,
+ CORE_ADDR pc);
+extern void set_gdbarch_adjust_dwarf2_addr (
+ struct gdbarch *gdbarch,
+ gdbarch_adjust_dwarf2_addr_ftype *adjust_dwarf2_addr);
/* Adjust the address updated by a line entry in a backend-specific way.
Normally this hook is supposed to return the address passed unchanged,
@@ -835,60 +1217,102 @@ extern void set_gdbarch_adjust_dwarf2_addr (struct gdbarch *gdbarch, gdbarch_adj
stop PC. */
typedef CORE_ADDR (gdbarch_adjust_dwarf2_line_ftype) (CORE_ADDR addr, int rel);
-extern CORE_ADDR gdbarch_adjust_dwarf2_line (struct gdbarch *gdbarch, CORE_ADDR addr, int rel);
-extern void set_gdbarch_adjust_dwarf2_line (struct gdbarch *gdbarch, gdbarch_adjust_dwarf2_line_ftype *adjust_dwarf2_line);
+extern CORE_ADDR gdbarch_adjust_dwarf2_line (struct gdbarch *gdbarch,
+ CORE_ADDR addr, int rel);
+extern void set_gdbarch_adjust_dwarf2_line (
+ struct gdbarch *gdbarch,
+ gdbarch_adjust_dwarf2_line_ftype *adjust_dwarf2_line);
extern int gdbarch_cannot_step_breakpoint (struct gdbarch *gdbarch);
-extern void set_gdbarch_cannot_step_breakpoint (struct gdbarch *gdbarch, int cannot_step_breakpoint);
+extern void set_gdbarch_cannot_step_breakpoint (struct gdbarch *gdbarch,
+ int cannot_step_breakpoint);
/* See comment in target.h about continuable, steppable and
non-steppable watchpoints. */
extern int gdbarch_have_nonsteppable_watchpoint (struct gdbarch *gdbarch);
-extern void set_gdbarch_have_nonsteppable_watchpoint (struct gdbarch *gdbarch, int have_nonsteppable_watchpoint);
+extern void
+set_gdbarch_have_nonsteppable_watchpoint (struct gdbarch *gdbarch,
+ int have_nonsteppable_watchpoint);
extern bool gdbarch_address_class_type_flags_p (struct gdbarch *gdbarch);
-typedef type_instance_flags (gdbarch_address_class_type_flags_ftype) (int byte_size, int dwarf2_addr_class);
-extern type_instance_flags gdbarch_address_class_type_flags (struct gdbarch *gdbarch, int byte_size, int dwarf2_addr_class);
-extern void set_gdbarch_address_class_type_flags (struct gdbarch *gdbarch, gdbarch_address_class_type_flags_ftype *address_class_type_flags);
-
-extern bool gdbarch_address_class_type_flags_to_name_p (struct gdbarch *gdbarch);
-
-typedef const char * (gdbarch_address_class_type_flags_to_name_ftype) (struct gdbarch *gdbarch, type_instance_flags type_flags);
-extern const char * gdbarch_address_class_type_flags_to_name (struct gdbarch *gdbarch, type_instance_flags type_flags);
-extern void set_gdbarch_address_class_type_flags_to_name (struct gdbarch *gdbarch, gdbarch_address_class_type_flags_to_name_ftype *address_class_type_flags_to_name);
+typedef type_instance_flags (gdbarch_address_class_type_flags_ftype) (
+ int byte_size, int dwarf2_addr_class);
+extern type_instance_flags
+gdbarch_address_class_type_flags (struct gdbarch *gdbarch, int byte_size,
+ int dwarf2_addr_class);
+extern void set_gdbarch_address_class_type_flags (
+ struct gdbarch *gdbarch,
+ gdbarch_address_class_type_flags_ftype *address_class_type_flags);
+
+extern bool
+gdbarch_address_class_type_flags_to_name_p (struct gdbarch *gdbarch);
+
+typedef const char *(
+ gdbarch_address_class_type_flags_to_name_ftype) (struct gdbarch *gdbarch,
+ type_instance_flags
+ type_flags);
+extern const char *
+gdbarch_address_class_type_flags_to_name (struct gdbarch *gdbarch,
+ type_instance_flags type_flags);
+extern void set_gdbarch_address_class_type_flags_to_name (
+ struct gdbarch *gdbarch, gdbarch_address_class_type_flags_to_name_ftype
+ *address_class_type_flags_to_name);
/* Execute vendor-specific DWARF Call Frame Instruction. OP is the instruction.
FS are passed from the generic execute_cfa_program function. */
-typedef bool (gdbarch_execute_dwarf_cfa_vendor_op_ftype) (struct gdbarch *gdbarch, gdb_byte op, struct dwarf2_frame_state *fs);
-extern bool gdbarch_execute_dwarf_cfa_vendor_op (struct gdbarch *gdbarch, gdb_byte op, struct dwarf2_frame_state *fs);
-extern void set_gdbarch_execute_dwarf_cfa_vendor_op (struct gdbarch *gdbarch, gdbarch_execute_dwarf_cfa_vendor_op_ftype *execute_dwarf_cfa_vendor_op);
+typedef bool (gdbarch_execute_dwarf_cfa_vendor_op_ftype) (
+ struct gdbarch *gdbarch, gdb_byte op, struct dwarf2_frame_state *fs);
+extern bool
+gdbarch_execute_dwarf_cfa_vendor_op (struct gdbarch *gdbarch, gdb_byte op,
+ struct dwarf2_frame_state *fs);
+extern void set_gdbarch_execute_dwarf_cfa_vendor_op (
+ struct gdbarch *gdbarch,
+ gdbarch_execute_dwarf_cfa_vendor_op_ftype *execute_dwarf_cfa_vendor_op);
/* Return the appropriate type_flags for the supplied address class.
This function should return true if the address class was recognized and
type_flags was set, false otherwise. */
-extern bool gdbarch_address_class_name_to_type_flags_p (struct gdbarch *gdbarch);
+extern bool
+gdbarch_address_class_name_to_type_flags_p (struct gdbarch *gdbarch);
-typedef bool (gdbarch_address_class_name_to_type_flags_ftype) (struct gdbarch *gdbarch, const char *name, type_instance_flags *type_flags_ptr);
-extern bool gdbarch_address_class_name_to_type_flags (struct gdbarch *gdbarch, const char *name, type_instance_flags *type_flags_ptr);
-extern void set_gdbarch_address_class_name_to_type_flags (struct gdbarch *gdbarch, gdbarch_address_class_name_to_type_flags_ftype *address_class_name_to_type_flags);
+typedef bool (gdbarch_address_class_name_to_type_flags_ftype) (
+ struct gdbarch *gdbarch, const char *name,
+ type_instance_flags *type_flags_ptr);
+extern bool
+gdbarch_address_class_name_to_type_flags (struct gdbarch *gdbarch,
+ const char *name,
+ type_instance_flags *type_flags_ptr);
+extern void set_gdbarch_address_class_name_to_type_flags (
+ struct gdbarch *gdbarch, gdbarch_address_class_name_to_type_flags_ftype
+ *address_class_name_to_type_flags);
/* Is a register in a group */
-typedef int (gdbarch_register_reggroup_p_ftype) (struct gdbarch *gdbarch, int regnum, const struct reggroup *reggroup);
-extern int gdbarch_register_reggroup_p (struct gdbarch *gdbarch, int regnum, const struct reggroup *reggroup);
-extern void set_gdbarch_register_reggroup_p (struct gdbarch *gdbarch, gdbarch_register_reggroup_p_ftype *register_reggroup_p);
+typedef int (gdbarch_register_reggroup_p_ftype) (
+ struct gdbarch *gdbarch, int regnum, const struct reggroup *reggroup);
+extern int gdbarch_register_reggroup_p (struct gdbarch *gdbarch, int regnum,
+ const struct reggroup *reggroup);
+extern void set_gdbarch_register_reggroup_p (
+ struct gdbarch *gdbarch,
+ gdbarch_register_reggroup_p_ftype *register_reggroup_p);
/* Fetch the pointer to the ith function argument. */
extern bool gdbarch_fetch_pointer_argument_p (struct gdbarch *gdbarch);
-typedef CORE_ADDR (gdbarch_fetch_pointer_argument_ftype) (frame_info_ptr frame, int argi, struct type *type);
-extern CORE_ADDR gdbarch_fetch_pointer_argument (struct gdbarch *gdbarch, frame_info_ptr frame, int argi, struct type *type);
-extern void set_gdbarch_fetch_pointer_argument (struct gdbarch *gdbarch, gdbarch_fetch_pointer_argument_ftype *fetch_pointer_argument);
+typedef CORE_ADDR (gdbarch_fetch_pointer_argument_ftype) (frame_info_ptr frame,
+ int argi,
+ struct type *type);
+extern CORE_ADDR gdbarch_fetch_pointer_argument (struct gdbarch *gdbarch,
+ frame_info_ptr frame,
+ int argi, struct type *type);
+extern void set_gdbarch_fetch_pointer_argument (
+ struct gdbarch *gdbarch,
+ gdbarch_fetch_pointer_argument_ftype *fetch_pointer_argument);
/* Iterate over all supported register notes in a core file. For each
supported register note section, the iterator must call CB and pass
@@ -899,41 +1323,68 @@ extern void set_gdbarch_fetch_pointer_argument (struct gdbarch *gdbarch, gdbarch
extern bool gdbarch_iterate_over_regset_sections_p (struct gdbarch *gdbarch);
-typedef void (gdbarch_iterate_over_regset_sections_ftype) (struct gdbarch *gdbarch, iterate_over_regset_sections_cb *cb, void *cb_data, const struct regcache *regcache);
-extern void gdbarch_iterate_over_regset_sections (struct gdbarch *gdbarch, iterate_over_regset_sections_cb *cb, void *cb_data, const struct regcache *regcache);
-extern void set_gdbarch_iterate_over_regset_sections (struct gdbarch *gdbarch, gdbarch_iterate_over_regset_sections_ftype *iterate_over_regset_sections);
+typedef void (gdbarch_iterate_over_regset_sections_ftype) (
+ struct gdbarch *gdbarch, iterate_over_regset_sections_cb *cb, void *cb_data,
+ const struct regcache *regcache);
+extern void gdbarch_iterate_over_regset_sections (
+ struct gdbarch *gdbarch, iterate_over_regset_sections_cb *cb, void *cb_data,
+ const struct regcache *regcache);
+extern void set_gdbarch_iterate_over_regset_sections (
+ struct gdbarch *gdbarch,
+ gdbarch_iterate_over_regset_sections_ftype *iterate_over_regset_sections);
/* Create core file notes */
extern bool gdbarch_make_corefile_notes_p (struct gdbarch *gdbarch);
-typedef gdb::unique_xmalloc_ptr<char> (gdbarch_make_corefile_notes_ftype) (struct gdbarch *gdbarch, bfd *obfd, int *note_size);
-extern gdb::unique_xmalloc_ptr<char> gdbarch_make_corefile_notes (struct gdbarch *gdbarch, bfd *obfd, int *note_size);
-extern void set_gdbarch_make_corefile_notes (struct gdbarch *gdbarch, gdbarch_make_corefile_notes_ftype *make_corefile_notes);
+typedef gdb::unique_xmalloc_ptr<char> (gdbarch_make_corefile_notes_ftype) (
+ struct gdbarch *gdbarch, bfd *obfd, int *note_size);
+extern gdb::unique_xmalloc_ptr<char>
+gdbarch_make_corefile_notes (struct gdbarch *gdbarch, bfd *obfd,
+ int *note_size);
+extern void set_gdbarch_make_corefile_notes (
+ struct gdbarch *gdbarch,
+ gdbarch_make_corefile_notes_ftype *make_corefile_notes);
/* Find core file memory regions */
extern bool gdbarch_find_memory_regions_p (struct gdbarch *gdbarch);
-typedef int (gdbarch_find_memory_regions_ftype) (struct gdbarch *gdbarch, find_memory_region_ftype func, void *data);
-extern int gdbarch_find_memory_regions (struct gdbarch *gdbarch, find_memory_region_ftype func, void *data);
-extern void set_gdbarch_find_memory_regions (struct gdbarch *gdbarch, gdbarch_find_memory_regions_ftype *find_memory_regions);
+typedef int (gdbarch_find_memory_regions_ftype) (struct gdbarch *gdbarch,
+ find_memory_region_ftype func,
+ void *data);
+extern int gdbarch_find_memory_regions (struct gdbarch *gdbarch,
+ find_memory_region_ftype func,
+ void *data);
+extern void set_gdbarch_find_memory_regions (
+ struct gdbarch *gdbarch,
+ gdbarch_find_memory_regions_ftype *find_memory_regions);
/* Given a bfd OBFD, segment ADDRESS and SIZE, create a memory tag section to be dumped to a core file */
extern bool gdbarch_create_memtag_section_p (struct gdbarch *gdbarch);
-typedef asection * (gdbarch_create_memtag_section_ftype) (struct gdbarch *gdbarch, bfd *obfd, CORE_ADDR address, size_t size);
-extern asection * gdbarch_create_memtag_section (struct gdbarch *gdbarch, bfd *obfd, CORE_ADDR address, size_t size);
-extern void set_gdbarch_create_memtag_section (struct gdbarch *gdbarch, gdbarch_create_memtag_section_ftype *create_memtag_section);
+typedef asection *(
+ gdbarch_create_memtag_section_ftype) (struct gdbarch *gdbarch, bfd *obfd,
+ CORE_ADDR address, size_t size);
+extern asection *gdbarch_create_memtag_section (struct gdbarch *gdbarch,
+ bfd *obfd, CORE_ADDR address,
+ size_t size);
+extern void set_gdbarch_create_memtag_section (
+ struct gdbarch *gdbarch,
+ gdbarch_create_memtag_section_ftype *create_memtag_section);
/* Given a memory tag section OSEC, fill OSEC's contents with the appropriate tag data */
extern bool gdbarch_fill_memtag_section_p (struct gdbarch *gdbarch);
-typedef bool (gdbarch_fill_memtag_section_ftype) (struct gdbarch *gdbarch, asection *osec);
-extern bool gdbarch_fill_memtag_section (struct gdbarch *gdbarch, asection *osec);
-extern void set_gdbarch_fill_memtag_section (struct gdbarch *gdbarch, gdbarch_fill_memtag_section_ftype *fill_memtag_section);
+typedef bool (gdbarch_fill_memtag_section_ftype) (struct gdbarch *gdbarch,
+ asection *osec);
+extern bool gdbarch_fill_memtag_section (struct gdbarch *gdbarch,
+ asection *osec);
+extern void set_gdbarch_fill_memtag_section (
+ struct gdbarch *gdbarch,
+ gdbarch_fill_memtag_section_ftype *fill_memtag_section);
/* Decode a memory tag SECTION and return the tags of type TYPE contained in
the memory range [ADDRESS, ADDRESS + LENGTH).
@@ -941,9 +1392,15 @@ extern void set_gdbarch_fill_memtag_section (struct gdbarch *gdbarch, gdbarch_fi
extern bool gdbarch_decode_memtag_section_p (struct gdbarch *gdbarch);
-typedef gdb::byte_vector (gdbarch_decode_memtag_section_ftype) (struct gdbarch *gdbarch, bfd_section *section, int type, CORE_ADDR address, size_t length);
-extern gdb::byte_vector gdbarch_decode_memtag_section (struct gdbarch *gdbarch, bfd_section *section, int type, CORE_ADDR address, size_t length);
-extern void set_gdbarch_decode_memtag_section (struct gdbarch *gdbarch, gdbarch_decode_memtag_section_ftype *decode_memtag_section);
+typedef gdb::byte_vector (gdbarch_decode_memtag_section_ftype) (
+ struct gdbarch *gdbarch, bfd_section *section, int type, CORE_ADDR address,
+ size_t length);
+extern gdb::byte_vector
+gdbarch_decode_memtag_section (struct gdbarch *gdbarch, bfd_section *section,
+ int type, CORE_ADDR address, size_t length);
+extern void set_gdbarch_decode_memtag_section (
+ struct gdbarch *gdbarch,
+ gdbarch_decode_memtag_section_ftype *decode_memtag_section);
/* Read offset OFFSET of TARGET_OBJECT_LIBRARIES formatted shared libraries list from
core file into buffer READBUF with length LEN. Return the number of bytes read
@@ -952,9 +1409,15 @@ extern void set_gdbarch_decode_memtag_section (struct gdbarch *gdbarch, gdbarch_
extern bool gdbarch_core_xfer_shared_libraries_p (struct gdbarch *gdbarch);
-typedef ULONGEST (gdbarch_core_xfer_shared_libraries_ftype) (struct gdbarch *gdbarch, gdb_byte *readbuf, ULONGEST offset, ULONGEST len);
-extern ULONGEST gdbarch_core_xfer_shared_libraries (struct gdbarch *gdbarch, gdb_byte *readbuf, ULONGEST offset, ULONGEST len);
-extern void set_gdbarch_core_xfer_shared_libraries (struct gdbarch *gdbarch, gdbarch_core_xfer_shared_libraries_ftype *core_xfer_shared_libraries);
+typedef ULONGEST (gdbarch_core_xfer_shared_libraries_ftype) (
+ struct gdbarch *gdbarch, gdb_byte *readbuf, ULONGEST offset, ULONGEST len);
+extern ULONGEST gdbarch_core_xfer_shared_libraries (struct gdbarch *gdbarch,
+ gdb_byte *readbuf,
+ ULONGEST offset,
+ ULONGEST len);
+extern void set_gdbarch_core_xfer_shared_libraries (
+ struct gdbarch *gdbarch,
+ gdbarch_core_xfer_shared_libraries_ftype *core_xfer_shared_libraries);
/* Read offset OFFSET of TARGET_OBJECT_LIBRARIES_AIX formatted shared
libraries list from core file into buffer READBUF with length LEN.
@@ -962,25 +1425,36 @@ extern void set_gdbarch_core_xfer_shared_libraries (struct gdbarch *gdbarch, gdb
extern bool gdbarch_core_xfer_shared_libraries_aix_p (struct gdbarch *gdbarch);
-typedef ULONGEST (gdbarch_core_xfer_shared_libraries_aix_ftype) (struct gdbarch *gdbarch, gdb_byte *readbuf, ULONGEST offset, ULONGEST len);
-extern ULONGEST gdbarch_core_xfer_shared_libraries_aix (struct gdbarch *gdbarch, gdb_byte *readbuf, ULONGEST offset, ULONGEST len);
-extern void set_gdbarch_core_xfer_shared_libraries_aix (struct gdbarch *gdbarch, gdbarch_core_xfer_shared_libraries_aix_ftype *core_xfer_shared_libraries_aix);
+typedef ULONGEST (gdbarch_core_xfer_shared_libraries_aix_ftype) (
+ struct gdbarch *gdbarch, gdb_byte *readbuf, ULONGEST offset, ULONGEST len);
+extern ULONGEST gdbarch_core_xfer_shared_libraries_aix (
+ struct gdbarch *gdbarch, gdb_byte *readbuf, ULONGEST offset, ULONGEST len);
+extern void set_gdbarch_core_xfer_shared_libraries_aix (
+ struct gdbarch *gdbarch, gdbarch_core_xfer_shared_libraries_aix_ftype
+ *core_xfer_shared_libraries_aix);
/* How the core target converts a PTID from a core file to a string. */
extern bool gdbarch_core_pid_to_str_p (struct gdbarch *gdbarch);
-typedef std::string (gdbarch_core_pid_to_str_ftype) (struct gdbarch *gdbarch, ptid_t ptid);
-extern std::string gdbarch_core_pid_to_str (struct gdbarch *gdbarch, ptid_t ptid);
-extern void set_gdbarch_core_pid_to_str (struct gdbarch *gdbarch, gdbarch_core_pid_to_str_ftype *core_pid_to_str);
+typedef std::string (gdbarch_core_pid_to_str_ftype) (struct gdbarch *gdbarch,
+ ptid_t ptid);
+extern std::string gdbarch_core_pid_to_str (struct gdbarch *gdbarch,
+ ptid_t ptid);
+extern void
+set_gdbarch_core_pid_to_str (struct gdbarch *gdbarch,
+ gdbarch_core_pid_to_str_ftype *core_pid_to_str);
/* How the core target extracts the name of a thread from a core file. */
extern bool gdbarch_core_thread_name_p (struct gdbarch *gdbarch);
-typedef const char * (gdbarch_core_thread_name_ftype) (struct gdbarch *gdbarch, struct thread_info *thr);
-extern const char * gdbarch_core_thread_name (struct gdbarch *gdbarch, struct thread_info *thr);
-extern void set_gdbarch_core_thread_name (struct gdbarch *gdbarch, gdbarch_core_thread_name_ftype *core_thread_name);
+typedef const char *(gdbarch_core_thread_name_ftype) (struct gdbarch *gdbarch,
+ struct thread_info *thr);
+extern const char *gdbarch_core_thread_name (struct gdbarch *gdbarch,
+ struct thread_info *thr);
+extern void set_gdbarch_core_thread_name (
+ struct gdbarch *gdbarch, gdbarch_core_thread_name_ftype *core_thread_name);
/* Read offset OFFSET of TARGET_OBJECT_SIGNAL_INFO signal information
from core file into buffer READBUF with length LEN. Return the number
@@ -988,42 +1462,57 @@ extern void set_gdbarch_core_thread_name (struct gdbarch *gdbarch, gdbarch_core_
extern bool gdbarch_core_xfer_siginfo_p (struct gdbarch *gdbarch);
-typedef LONGEST (gdbarch_core_xfer_siginfo_ftype) (struct gdbarch *gdbarch, gdb_byte *readbuf, ULONGEST offset, ULONGEST len);
-extern LONGEST gdbarch_core_xfer_siginfo (struct gdbarch *gdbarch, gdb_byte *readbuf, ULONGEST offset, ULONGEST len);
-extern void set_gdbarch_core_xfer_siginfo (struct gdbarch *gdbarch, gdbarch_core_xfer_siginfo_ftype *core_xfer_siginfo);
+typedef LONGEST (gdbarch_core_xfer_siginfo_ftype) (struct gdbarch *gdbarch,
+ gdb_byte *readbuf,
+ ULONGEST offset,
+ ULONGEST len);
+extern LONGEST gdbarch_core_xfer_siginfo (struct gdbarch *gdbarch,
+ gdb_byte *readbuf, ULONGEST offset,
+ ULONGEST len);
+extern void set_gdbarch_core_xfer_siginfo (
+ struct gdbarch *gdbarch, gdbarch_core_xfer_siginfo_ftype *core_xfer_siginfo);
/* BFD target to use when generating a core file. */
extern bool gdbarch_gcore_bfd_target_p (struct gdbarch *gdbarch);
-extern const char * gdbarch_gcore_bfd_target (struct gdbarch *gdbarch);
-extern void set_gdbarch_gcore_bfd_target (struct gdbarch *gdbarch, const char * gcore_bfd_target);
+extern const char *gdbarch_gcore_bfd_target (struct gdbarch *gdbarch);
+extern void set_gdbarch_gcore_bfd_target (struct gdbarch *gdbarch,
+ const char *gcore_bfd_target);
/* If the elements of C++ vtables are in-place function descriptors rather
than normal function pointers (which may point to code or a descriptor),
set this to one. */
extern int gdbarch_vtable_function_descriptors (struct gdbarch *gdbarch);
-extern void set_gdbarch_vtable_function_descriptors (struct gdbarch *gdbarch, int vtable_function_descriptors);
+extern void
+set_gdbarch_vtable_function_descriptors (struct gdbarch *gdbarch,
+ int vtable_function_descriptors);
/* Set if the least significant bit of the delta is used instead of the least
significant bit of the pfn for pointers to virtual member functions. */
extern int gdbarch_vbit_in_delta (struct gdbarch *gdbarch);
-extern void set_gdbarch_vbit_in_delta (struct gdbarch *gdbarch, int vbit_in_delta);
+extern void set_gdbarch_vbit_in_delta (struct gdbarch *gdbarch,
+ int vbit_in_delta);
/* Advance PC to next instruction in order to skip a permanent breakpoint. */
-typedef void (gdbarch_skip_permanent_breakpoint_ftype) (struct regcache *regcache);
-extern void gdbarch_skip_permanent_breakpoint (struct gdbarch *gdbarch, struct regcache *regcache);
-extern void set_gdbarch_skip_permanent_breakpoint (struct gdbarch *gdbarch, gdbarch_skip_permanent_breakpoint_ftype *skip_permanent_breakpoint);
+typedef void (gdbarch_skip_permanent_breakpoint_ftype) (
+ struct regcache *regcache);
+extern void gdbarch_skip_permanent_breakpoint (struct gdbarch *gdbarch,
+ struct regcache *regcache);
+extern void set_gdbarch_skip_permanent_breakpoint (
+ struct gdbarch *gdbarch,
+ gdbarch_skip_permanent_breakpoint_ftype *skip_permanent_breakpoint);
/* The maximum length of an instruction on this architecture in bytes. */
extern bool gdbarch_max_insn_length_p (struct gdbarch *gdbarch);
extern ULONGEST gdbarch_max_insn_length (struct gdbarch *gdbarch);
-extern void set_gdbarch_max_insn_length (struct gdbarch *gdbarch, ULONGEST max_insn_length);
+extern void set_gdbarch_max_insn_length (struct gdbarch *gdbarch,
+ ULONGEST max_insn_length);
/* Copy the instruction at FROM to TO, and make any adjustments
necessary to single-step it at that address.
@@ -1051,9 +1540,16 @@ extern void set_gdbarch_max_insn_length (struct gdbarch *gdbarch, ULONGEST max_i
extern bool gdbarch_displaced_step_copy_insn_p (struct gdbarch *gdbarch);
-typedef displaced_step_copy_insn_closure_up (gdbarch_displaced_step_copy_insn_ftype) (struct gdbarch *gdbarch, CORE_ADDR from, CORE_ADDR to, struct regcache *regs);
-extern displaced_step_copy_insn_closure_up gdbarch_displaced_step_copy_insn (struct gdbarch *gdbarch, CORE_ADDR from, CORE_ADDR to, struct regcache *regs);
-extern void set_gdbarch_displaced_step_copy_insn (struct gdbarch *gdbarch, gdbarch_displaced_step_copy_insn_ftype *displaced_step_copy_insn);
+typedef displaced_step_copy_insn_closure_up (
+ gdbarch_displaced_step_copy_insn_ftype) (struct gdbarch *gdbarch,
+ CORE_ADDR from, CORE_ADDR to,
+ struct regcache *regs);
+extern displaced_step_copy_insn_closure_up
+gdbarch_displaced_step_copy_insn (struct gdbarch *gdbarch, CORE_ADDR from,
+ CORE_ADDR to, struct regcache *regs);
+extern void set_gdbarch_displaced_step_copy_insn (
+ struct gdbarch *gdbarch,
+ gdbarch_displaced_step_copy_insn_ftype *displaced_step_copy_insn);
/* Return true if GDB should use hardware single-stepping to execute a displaced
step instruction. If false, GDB will simply restart execution at the
@@ -1064,9 +1560,12 @@ extern void set_gdbarch_displaced_step_copy_insn (struct gdbarch *gdbarch, gdbar
The default implementation returns false on all targets that provide a
gdbarch_software_single_step routine, and true otherwise. */
-typedef bool (gdbarch_displaced_step_hw_singlestep_ftype) (struct gdbarch *gdbarch);
+typedef bool (gdbarch_displaced_step_hw_singlestep_ftype) (
+ struct gdbarch *gdbarch);
extern bool gdbarch_displaced_step_hw_singlestep (struct gdbarch *gdbarch);
-extern void set_gdbarch_displaced_step_hw_singlestep (struct gdbarch *gdbarch, gdbarch_displaced_step_hw_singlestep_ftype *displaced_step_hw_singlestep);
+extern void set_gdbarch_displaced_step_hw_singlestep (
+ struct gdbarch *gdbarch,
+ gdbarch_displaced_step_hw_singlestep_ftype *displaced_step_hw_singlestep);
/* Fix up the state resulting from successfully single-stepping a
displaced instruction, to give the result we would have gotten from
@@ -1087,9 +1586,15 @@ extern void set_gdbarch_displaced_step_hw_singlestep (struct gdbarch *gdbarch, g
extern bool gdbarch_displaced_step_fixup_p (struct gdbarch *gdbarch);
-typedef void (gdbarch_displaced_step_fixup_ftype) (struct gdbarch *gdbarch, struct displaced_step_copy_insn_closure *closure, CORE_ADDR from, CORE_ADDR to, struct regcache *regs);
-extern void gdbarch_displaced_step_fixup (struct gdbarch *gdbarch, struct displaced_step_copy_insn_closure *closure, CORE_ADDR from, CORE_ADDR to, struct regcache *regs);
-extern void set_gdbarch_displaced_step_fixup (struct gdbarch *gdbarch, gdbarch_displaced_step_fixup_ftype *displaced_step_fixup);
+typedef void (gdbarch_displaced_step_fixup_ftype) (
+ struct gdbarch *gdbarch, struct displaced_step_copy_insn_closure *closure,
+ CORE_ADDR from, CORE_ADDR to, struct regcache *regs);
+extern void gdbarch_displaced_step_fixup (
+ struct gdbarch *gdbarch, struct displaced_step_copy_insn_closure *closure,
+ CORE_ADDR from, CORE_ADDR to, struct regcache *regs);
+extern void set_gdbarch_displaced_step_fixup (
+ struct gdbarch *gdbarch,
+ gdbarch_displaced_step_fixup_ftype *displaced_step_fixup);
/* Prepare THREAD for it to displaced step the instruction at its current PC.
@@ -1097,30 +1602,53 @@ extern void set_gdbarch_displaced_step_fixup (struct gdbarch *gdbarch, gdbarch_d
extern bool gdbarch_displaced_step_prepare_p (struct gdbarch *gdbarch);
-typedef displaced_step_prepare_status (gdbarch_displaced_step_prepare_ftype) (struct gdbarch *gdbarch, thread_info *thread, CORE_ADDR &displaced_pc);
-extern displaced_step_prepare_status gdbarch_displaced_step_prepare (struct gdbarch *gdbarch, thread_info *thread, CORE_ADDR &displaced_pc);
-extern void set_gdbarch_displaced_step_prepare (struct gdbarch *gdbarch, gdbarch_displaced_step_prepare_ftype *displaced_step_prepare);
+typedef displaced_step_prepare_status (gdbarch_displaced_step_prepare_ftype) (
+ struct gdbarch *gdbarch, thread_info *thread, CORE_ADDR &displaced_pc);
+extern displaced_step_prepare_status
+gdbarch_displaced_step_prepare (struct gdbarch *gdbarch, thread_info *thread,
+ CORE_ADDR &displaced_pc);
+extern void set_gdbarch_displaced_step_prepare (
+ struct gdbarch *gdbarch,
+ gdbarch_displaced_step_prepare_ftype *displaced_step_prepare);
/* Clean up after a displaced step of THREAD. */
-typedef displaced_step_finish_status (gdbarch_displaced_step_finish_ftype) (struct gdbarch *gdbarch, thread_info *thread, gdb_signal sig);
-extern displaced_step_finish_status gdbarch_displaced_step_finish (struct gdbarch *gdbarch, thread_info *thread, gdb_signal sig);
-extern void set_gdbarch_displaced_step_finish (struct gdbarch *gdbarch, gdbarch_displaced_step_finish_ftype *displaced_step_finish);
+typedef displaced_step_finish_status (gdbarch_displaced_step_finish_ftype) (
+ struct gdbarch *gdbarch, thread_info *thread, gdb_signal sig);
+extern displaced_step_finish_status
+gdbarch_displaced_step_finish (struct gdbarch *gdbarch, thread_info *thread,
+ gdb_signal sig);
+extern void set_gdbarch_displaced_step_finish (
+ struct gdbarch *gdbarch,
+ gdbarch_displaced_step_finish_ftype *displaced_step_finish);
/* Return the closure associated to the displaced step buffer that is at ADDR. */
-extern bool gdbarch_displaced_step_copy_insn_closure_by_addr_p (struct gdbarch *gdbarch);
-
-typedef const displaced_step_copy_insn_closure * (gdbarch_displaced_step_copy_insn_closure_by_addr_ftype) (inferior *inf, CORE_ADDR addr);
-extern const displaced_step_copy_insn_closure * gdbarch_displaced_step_copy_insn_closure_by_addr (struct gdbarch *gdbarch, inferior *inf, CORE_ADDR addr);
-extern void set_gdbarch_displaced_step_copy_insn_closure_by_addr (struct gdbarch *gdbarch, gdbarch_displaced_step_copy_insn_closure_by_addr_ftype *displaced_step_copy_insn_closure_by_addr);
+extern bool
+gdbarch_displaced_step_copy_insn_closure_by_addr_p (struct gdbarch *gdbarch);
+
+typedef const displaced_step_copy_insn_closure *(
+ gdbarch_displaced_step_copy_insn_closure_by_addr_ftype) (inferior *inf,
+ CORE_ADDR addr);
+extern const displaced_step_copy_insn_closure *
+gdbarch_displaced_step_copy_insn_closure_by_addr (struct gdbarch *gdbarch,
+ inferior *inf,
+ CORE_ADDR addr);
+extern void set_gdbarch_displaced_step_copy_insn_closure_by_addr (
+ struct gdbarch *gdbarch,
+ gdbarch_displaced_step_copy_insn_closure_by_addr_ftype
+ *displaced_step_copy_insn_closure_by_addr);
/* PARENT_INF has forked and CHILD_PTID is the ptid of the child. Restore the
contents of all displaced step buffers in the child's address space. */
-typedef void (gdbarch_displaced_step_restore_all_in_ptid_ftype) (inferior *parent_inf, ptid_t child_ptid);
-extern void gdbarch_displaced_step_restore_all_in_ptid (struct gdbarch *gdbarch, inferior *parent_inf, ptid_t child_ptid);
-extern void set_gdbarch_displaced_step_restore_all_in_ptid (struct gdbarch *gdbarch, gdbarch_displaced_step_restore_all_in_ptid_ftype *displaced_step_restore_all_in_ptid);
+typedef void (gdbarch_displaced_step_restore_all_in_ptid_ftype) (
+ inferior *parent_inf, ptid_t child_ptid);
+extern void gdbarch_displaced_step_restore_all_in_ptid (
+ struct gdbarch *gdbarch, inferior *parent_inf, ptid_t child_ptid);
+extern void set_gdbarch_displaced_step_restore_all_in_ptid (
+ struct gdbarch *gdbarch, gdbarch_displaced_step_restore_all_in_ptid_ftype
+ *displaced_step_restore_all_in_ptid);
/* Relocate an instruction to execute at a different address. OLDLOC
is the address in the inferior memory where the instruction to
@@ -1136,28 +1664,44 @@ extern void set_gdbarch_displaced_step_restore_all_in_ptid (struct gdbarch *gdba
extern bool gdbarch_relocate_instruction_p (struct gdbarch *gdbarch);
-typedef void (gdbarch_relocate_instruction_ftype) (struct gdbarch *gdbarch, CORE_ADDR *to, CORE_ADDR from);
-extern void gdbarch_relocate_instruction (struct gdbarch *gdbarch, CORE_ADDR *to, CORE_ADDR from);
-extern void set_gdbarch_relocate_instruction (struct gdbarch *gdbarch, gdbarch_relocate_instruction_ftype *relocate_instruction);
+typedef void (gdbarch_relocate_instruction_ftype) (struct gdbarch *gdbarch,
+ CORE_ADDR *to,
+ CORE_ADDR from);
+extern void gdbarch_relocate_instruction (struct gdbarch *gdbarch,
+ CORE_ADDR *to, CORE_ADDR from);
+extern void set_gdbarch_relocate_instruction (
+ struct gdbarch *gdbarch,
+ gdbarch_relocate_instruction_ftype *relocate_instruction);
/* Refresh overlay mapped state for section OSECT. */
extern bool gdbarch_overlay_update_p (struct gdbarch *gdbarch);
typedef void (gdbarch_overlay_update_ftype) (struct obj_section *osect);
-extern void gdbarch_overlay_update (struct gdbarch *gdbarch, struct obj_section *osect);
-extern void set_gdbarch_overlay_update (struct gdbarch *gdbarch, gdbarch_overlay_update_ftype *overlay_update);
+extern void gdbarch_overlay_update (struct gdbarch *gdbarch,
+ struct obj_section *osect);
+extern void
+set_gdbarch_overlay_update (struct gdbarch *gdbarch,
+ gdbarch_overlay_update_ftype *overlay_update);
extern bool gdbarch_core_read_description_p (struct gdbarch *gdbarch);
-typedef const struct target_desc * (gdbarch_core_read_description_ftype) (struct gdbarch *gdbarch, struct target_ops *target, bfd *abfd);
-extern const struct target_desc * gdbarch_core_read_description (struct gdbarch *gdbarch, struct target_ops *target, bfd *abfd);
-extern void set_gdbarch_core_read_description (struct gdbarch *gdbarch, gdbarch_core_read_description_ftype *core_read_description);
+typedef const struct target_desc *(
+ gdbarch_core_read_description_ftype) (struct gdbarch *gdbarch,
+ struct target_ops *target, bfd *abfd);
+extern const struct target_desc *
+gdbarch_core_read_description (struct gdbarch *gdbarch,
+ struct target_ops *target, bfd *abfd);
+extern void set_gdbarch_core_read_description (
+ struct gdbarch *gdbarch,
+ gdbarch_core_read_description_ftype *core_read_description);
/* Set if the address in N_SO or N_FUN stabs may be zero. */
extern int gdbarch_sofun_address_maybe_missing (struct gdbarch *gdbarch);
-extern void set_gdbarch_sofun_address_maybe_missing (struct gdbarch *gdbarch, int sofun_address_maybe_missing);
+extern void
+set_gdbarch_sofun_address_maybe_missing (struct gdbarch *gdbarch,
+ int sofun_address_maybe_missing);
/* Parse the instruction at ADDR storing in the record execution log
the registers REGCACHE and memory ranges that will be affected when
@@ -1166,18 +1710,29 @@ extern void set_gdbarch_sofun_address_maybe_missing (struct gdbarch *gdbarch, in
extern bool gdbarch_process_record_p (struct gdbarch *gdbarch);
-typedef int (gdbarch_process_record_ftype) (struct gdbarch *gdbarch, struct regcache *regcache, CORE_ADDR addr);
-extern int gdbarch_process_record (struct gdbarch *gdbarch, struct regcache *regcache, CORE_ADDR addr);
-extern void set_gdbarch_process_record (struct gdbarch *gdbarch, gdbarch_process_record_ftype *process_record);
+typedef int (gdbarch_process_record_ftype) (struct gdbarch *gdbarch,
+ struct regcache *regcache,
+ CORE_ADDR addr);
+extern int gdbarch_process_record (struct gdbarch *gdbarch,
+ struct regcache *regcache, CORE_ADDR addr);
+extern void
+set_gdbarch_process_record (struct gdbarch *gdbarch,
+ gdbarch_process_record_ftype *process_record);
/* Save process state after a signal.
Return -1 if something goes wrong, 0 otherwise. */
extern bool gdbarch_process_record_signal_p (struct gdbarch *gdbarch);
-typedef int (gdbarch_process_record_signal_ftype) (struct gdbarch *gdbarch, struct regcache *regcache, enum gdb_signal signal);
-extern int gdbarch_process_record_signal (struct gdbarch *gdbarch, struct regcache *regcache, enum gdb_signal signal);
-extern void set_gdbarch_process_record_signal (struct gdbarch *gdbarch, gdbarch_process_record_signal_ftype *process_record_signal);
+typedef int (gdbarch_process_record_signal_ftype) (struct gdbarch *gdbarch,
+ struct regcache *regcache,
+ enum gdb_signal signal);
+extern int gdbarch_process_record_signal (struct gdbarch *gdbarch,
+ struct regcache *regcache,
+ enum gdb_signal signal);
+extern void set_gdbarch_process_record_signal (
+ struct gdbarch *gdbarch,
+ gdbarch_process_record_signal_ftype *process_record_signal);
/* Signal translation: translate inferior's signal (target's) number
into GDB's representation. The implementation of this method must
@@ -1189,9 +1744,13 @@ extern void set_gdbarch_process_record_signal (struct gdbarch *gdbarch, gdbarch_
extern bool gdbarch_gdb_signal_from_target_p (struct gdbarch *gdbarch);
-typedef enum gdb_signal (gdbarch_gdb_signal_from_target_ftype) (struct gdbarch *gdbarch, int signo);
-extern enum gdb_signal gdbarch_gdb_signal_from_target (struct gdbarch *gdbarch, int signo);
-extern void set_gdbarch_gdb_signal_from_target (struct gdbarch *gdbarch, gdbarch_gdb_signal_from_target_ftype *gdb_signal_from_target);
+typedef enum gdb_signal (gdbarch_gdb_signal_from_target_ftype) (
+ struct gdbarch *gdbarch, int signo);
+extern enum gdb_signal gdbarch_gdb_signal_from_target (struct gdbarch *gdbarch,
+ int signo);
+extern void set_gdbarch_gdb_signal_from_target (
+ struct gdbarch *gdbarch,
+ gdbarch_gdb_signal_from_target_ftype *gdb_signal_from_target);
/* Signal translation: translate the GDB's internal signal number into
the inferior's signal (target's) representation. The implementation
@@ -1203,9 +1762,13 @@ extern void set_gdbarch_gdb_signal_from_target (struct gdbarch *gdbarch, gdbarch
extern bool gdbarch_gdb_signal_to_target_p (struct gdbarch *gdbarch);
-typedef int (gdbarch_gdb_signal_to_target_ftype) (struct gdbarch *gdbarch, enum gdb_signal signal);
-extern int gdbarch_gdb_signal_to_target (struct gdbarch *gdbarch, enum gdb_signal signal);
-extern void set_gdbarch_gdb_signal_to_target (struct gdbarch *gdbarch, gdbarch_gdb_signal_to_target_ftype *gdb_signal_to_target);
+typedef int (gdbarch_gdb_signal_to_target_ftype) (struct gdbarch *gdbarch,
+ enum gdb_signal signal);
+extern int gdbarch_gdb_signal_to_target (struct gdbarch *gdbarch,
+ enum gdb_signal signal);
+extern void set_gdbarch_gdb_signal_to_target (
+ struct gdbarch *gdbarch,
+ gdbarch_gdb_signal_to_target_ftype *gdb_signal_to_target);
/* Extra signal info inspection.
@@ -1213,36 +1776,50 @@ extern void set_gdbarch_gdb_signal_to_target (struct gdbarch *gdbarch, gdbarch_g
extern bool gdbarch_get_siginfo_type_p (struct gdbarch *gdbarch);
-typedef struct type * (gdbarch_get_siginfo_type_ftype) (struct gdbarch *gdbarch);
-extern struct type * gdbarch_get_siginfo_type (struct gdbarch *gdbarch);
-extern void set_gdbarch_get_siginfo_type (struct gdbarch *gdbarch, gdbarch_get_siginfo_type_ftype *get_siginfo_type);
+typedef struct type *(
+ gdbarch_get_siginfo_type_ftype) (struct gdbarch *gdbarch);
+extern struct type *gdbarch_get_siginfo_type (struct gdbarch *gdbarch);
+extern void set_gdbarch_get_siginfo_type (
+ struct gdbarch *gdbarch, gdbarch_get_siginfo_type_ftype *get_siginfo_type);
/* Record architecture-specific information from the symbol table. */
extern bool gdbarch_record_special_symbol_p (struct gdbarch *gdbarch);
-typedef void (gdbarch_record_special_symbol_ftype) (struct gdbarch *gdbarch, struct objfile *objfile, asymbol *sym);
-extern void gdbarch_record_special_symbol (struct gdbarch *gdbarch, struct objfile *objfile, asymbol *sym);
-extern void set_gdbarch_record_special_symbol (struct gdbarch *gdbarch, gdbarch_record_special_symbol_ftype *record_special_symbol);
+typedef void (gdbarch_record_special_symbol_ftype) (struct gdbarch *gdbarch,
+ struct objfile *objfile,
+ asymbol *sym);
+extern void gdbarch_record_special_symbol (struct gdbarch *gdbarch,
+ struct objfile *objfile,
+ asymbol *sym);
+extern void set_gdbarch_record_special_symbol (
+ struct gdbarch *gdbarch,
+ gdbarch_record_special_symbol_ftype *record_special_symbol);
/* Function for the 'catch syscall' feature.
Get architecture-specific system calls information from registers. */
extern bool gdbarch_get_syscall_number_p (struct gdbarch *gdbarch);
-typedef LONGEST (gdbarch_get_syscall_number_ftype) (struct gdbarch *gdbarch, thread_info *thread);
-extern LONGEST gdbarch_get_syscall_number (struct gdbarch *gdbarch, thread_info *thread);
-extern void set_gdbarch_get_syscall_number (struct gdbarch *gdbarch, gdbarch_get_syscall_number_ftype *get_syscall_number);
+typedef LONGEST (gdbarch_get_syscall_number_ftype) (struct gdbarch *gdbarch,
+ thread_info *thread);
+extern LONGEST gdbarch_get_syscall_number (struct gdbarch *gdbarch,
+ thread_info *thread);
+extern void set_gdbarch_get_syscall_number (
+ struct gdbarch *gdbarch,
+ gdbarch_get_syscall_number_ftype *get_syscall_number);
/* The filename of the XML syscall for this architecture. */
-extern const char * gdbarch_xml_syscall_file (struct gdbarch *gdbarch);
-extern void set_gdbarch_xml_syscall_file (struct gdbarch *gdbarch, const char * xml_syscall_file);
+extern const char *gdbarch_xml_syscall_file (struct gdbarch *gdbarch);
+extern void set_gdbarch_xml_syscall_file (struct gdbarch *gdbarch,
+ const char *xml_syscall_file);
/* Information about system calls from this architecture */
-extern struct syscalls_info * gdbarch_syscalls_info (struct gdbarch *gdbarch);
-extern void set_gdbarch_syscalls_info (struct gdbarch *gdbarch, struct syscalls_info * syscalls_info);
+extern struct syscalls_info *gdbarch_syscalls_info (struct gdbarch *gdbarch);
+extern void set_gdbarch_syscalls_info (struct gdbarch *gdbarch,
+ struct syscalls_info *syscalls_info);
/* SystemTap related fields and functions.
A NULL-terminated array of prefixes used to mark an integer constant
@@ -1253,14 +1830,20 @@ extern void set_gdbarch_syscalls_info (struct gdbarch *gdbarch, struct syscalls_
in this case, this prefix would be the character `$'. */
-extern const char *const * gdbarch_stap_integer_prefixes (struct gdbarch *gdbarch);
-extern void set_gdbarch_stap_integer_prefixes (struct gdbarch *gdbarch, const char *const * stap_integer_prefixes);
+extern const char *const *
+gdbarch_stap_integer_prefixes (struct gdbarch *gdbarch);
+extern void
+set_gdbarch_stap_integer_prefixes (struct gdbarch *gdbarch,
+ const char *const *stap_integer_prefixes);
/* A NULL-terminated array of suffixes used to mark an integer constant
on the architecture's assembly. */
-extern const char *const * gdbarch_stap_integer_suffixes (struct gdbarch *gdbarch);
-extern void set_gdbarch_stap_integer_suffixes (struct gdbarch *gdbarch, const char *const * stap_integer_suffixes);
+extern const char *const *
+gdbarch_stap_integer_suffixes (struct gdbarch *gdbarch);
+extern void
+set_gdbarch_stap_integer_suffixes (struct gdbarch *gdbarch,
+ const char *const *stap_integer_suffixes);
/* A NULL-terminated array of prefixes used to mark a register name on
the architecture's assembly.
@@ -1270,14 +1853,20 @@ extern void set_gdbarch_stap_integer_suffixes (struct gdbarch *gdbarch, const ch
in this case, this prefix would be the character `%'. */
-extern const char *const * gdbarch_stap_register_prefixes (struct gdbarch *gdbarch);
-extern void set_gdbarch_stap_register_prefixes (struct gdbarch *gdbarch, const char *const * stap_register_prefixes);
+extern const char *const *
+gdbarch_stap_register_prefixes (struct gdbarch *gdbarch);
+extern void
+set_gdbarch_stap_register_prefixes (struct gdbarch *gdbarch,
+ const char *const *stap_register_prefixes);
/* A NULL-terminated array of suffixes used to mark a register name on
the architecture's assembly. */
-extern const char *const * gdbarch_stap_register_suffixes (struct gdbarch *gdbarch);
-extern void set_gdbarch_stap_register_suffixes (struct gdbarch *gdbarch, const char *const * stap_register_suffixes);
+extern const char *const *
+gdbarch_stap_register_suffixes (struct gdbarch *gdbarch);
+extern void
+set_gdbarch_stap_register_suffixes (struct gdbarch *gdbarch,
+ const char *const *stap_register_suffixes);
/* A NULL-terminated array of prefixes used to mark a register
indirection on the architecture's assembly.
@@ -1290,8 +1879,11 @@ extern void set_gdbarch_stap_register_suffixes (struct gdbarch *gdbarch, const c
Please note that we use the indirection prefix also for register
displacement, e.g., `4(%eax)' on x86. */
-extern const char *const * gdbarch_stap_register_indirection_prefixes (struct gdbarch *gdbarch);
-extern void set_gdbarch_stap_register_indirection_prefixes (struct gdbarch *gdbarch, const char *const * stap_register_indirection_prefixes);
+extern const char *const *
+gdbarch_stap_register_indirection_prefixes (struct gdbarch *gdbarch);
+extern void set_gdbarch_stap_register_indirection_prefixes (
+ struct gdbarch *gdbarch,
+ const char *const *stap_register_indirection_prefixes);
/* A NULL-terminated array of suffixes used to mark a register
indirection on the architecture's assembly.
@@ -1304,8 +1896,11 @@ extern void set_gdbarch_stap_register_indirection_prefixes (struct gdbarch *gdba
Please note that we use the indirection suffix also for register
displacement, e.g., `4(%eax)' on x86. */
-extern const char *const * gdbarch_stap_register_indirection_suffixes (struct gdbarch *gdbarch);
-extern void set_gdbarch_stap_register_indirection_suffixes (struct gdbarch *gdbarch, const char *const * stap_register_indirection_suffixes);
+extern const char *const *
+gdbarch_stap_register_indirection_suffixes (struct gdbarch *gdbarch);
+extern void set_gdbarch_stap_register_indirection_suffixes (
+ struct gdbarch *gdbarch,
+ const char *const *stap_register_indirection_suffixes);
/* Prefix(es) used to name a register using GDB's nomenclature.
@@ -1314,13 +1909,17 @@ extern void set_gdbarch_stap_register_indirection_suffixes (struct gdbarch *gdba
inside GDB this same register has an `r' appended to its name, so the 10th
register would be represented as `r10' internally. */
-extern const char * gdbarch_stap_gdb_register_prefix (struct gdbarch *gdbarch);
-extern void set_gdbarch_stap_gdb_register_prefix (struct gdbarch *gdbarch, const char * stap_gdb_register_prefix);
+extern const char *gdbarch_stap_gdb_register_prefix (struct gdbarch *gdbarch);
+extern void
+set_gdbarch_stap_gdb_register_prefix (struct gdbarch *gdbarch,
+ const char *stap_gdb_register_prefix);
/* Suffix used to name a register using GDB's nomenclature. */
-extern const char * gdbarch_stap_gdb_register_suffix (struct gdbarch *gdbarch);
-extern void set_gdbarch_stap_gdb_register_suffix (struct gdbarch *gdbarch, const char * stap_gdb_register_suffix);
+extern const char *gdbarch_stap_gdb_register_suffix (struct gdbarch *gdbarch);
+extern void
+set_gdbarch_stap_gdb_register_suffix (struct gdbarch *gdbarch,
+ const char *stap_gdb_register_suffix);
/* Check if S is a single operand.
@@ -1337,9 +1936,13 @@ extern void set_gdbarch_stap_gdb_register_suffix (struct gdbarch *gdbarch, const
extern bool gdbarch_stap_is_single_operand_p (struct gdbarch *gdbarch);
-typedef int (gdbarch_stap_is_single_operand_ftype) (struct gdbarch *gdbarch, const char *s);
-extern int gdbarch_stap_is_single_operand (struct gdbarch *gdbarch, const char *s);
-extern void set_gdbarch_stap_is_single_operand (struct gdbarch *gdbarch, gdbarch_stap_is_single_operand_ftype *stap_is_single_operand);
+typedef int (gdbarch_stap_is_single_operand_ftype) (struct gdbarch *gdbarch,
+ const char *s);
+extern int gdbarch_stap_is_single_operand (struct gdbarch *gdbarch,
+ const char *s);
+extern void set_gdbarch_stap_is_single_operand (
+ struct gdbarch *gdbarch,
+ gdbarch_stap_is_single_operand_ftype *stap_is_single_operand);
/* Function used to handle a "special case" in the parser.
@@ -1365,9 +1968,14 @@ extern void set_gdbarch_stap_is_single_operand (struct gdbarch *gdbarch, gdbarch
extern bool gdbarch_stap_parse_special_token_p (struct gdbarch *gdbarch);
-typedef expr::operation_up (gdbarch_stap_parse_special_token_ftype) (struct gdbarch *gdbarch, struct stap_parse_info *p);
-extern expr::operation_up gdbarch_stap_parse_special_token (struct gdbarch *gdbarch, struct stap_parse_info *p);
-extern void set_gdbarch_stap_parse_special_token (struct gdbarch *gdbarch, gdbarch_stap_parse_special_token_ftype *stap_parse_special_token);
+typedef expr::operation_up (gdbarch_stap_parse_special_token_ftype) (
+ struct gdbarch *gdbarch, struct stap_parse_info *p);
+extern expr::operation_up
+gdbarch_stap_parse_special_token (struct gdbarch *gdbarch,
+ struct stap_parse_info *p);
+extern void set_gdbarch_stap_parse_special_token (
+ struct gdbarch *gdbarch,
+ gdbarch_stap_parse_special_token_ftype *stap_parse_special_token);
/* Perform arch-dependent adjustments to a register name.
@@ -1395,9 +2003,16 @@ extern void set_gdbarch_stap_parse_special_token (struct gdbarch *gdbarch, gdbar
extern bool gdbarch_stap_adjust_register_p (struct gdbarch *gdbarch);
-typedef std::string (gdbarch_stap_adjust_register_ftype) (struct gdbarch *gdbarch, struct stap_parse_info *p, const std::string &regname, int regnum);
-extern std::string gdbarch_stap_adjust_register (struct gdbarch *gdbarch, struct stap_parse_info *p, const std::string &regname, int regnum);
-extern void set_gdbarch_stap_adjust_register (struct gdbarch *gdbarch, gdbarch_stap_adjust_register_ftype *stap_adjust_register);
+typedef std::string (gdbarch_stap_adjust_register_ftype) (
+ struct gdbarch *gdbarch, struct stap_parse_info *p,
+ const std::string &regname, int regnum);
+extern std::string gdbarch_stap_adjust_register (struct gdbarch *gdbarch,
+ struct stap_parse_info *p,
+ const std::string &regname,
+ int regnum);
+extern void set_gdbarch_stap_adjust_register (
+ struct gdbarch *gdbarch,
+ gdbarch_stap_adjust_register_ftype *stap_adjust_register);
/* DTrace related functions.
The expression to compute the NARTGth+1 argument to a DTrace USDT probe.
@@ -1405,34 +2020,50 @@ extern void set_gdbarch_stap_adjust_register (struct gdbarch *gdbarch, gdbarch_s
extern bool gdbarch_dtrace_parse_probe_argument_p (struct gdbarch *gdbarch);
-typedef expr::operation_up (gdbarch_dtrace_parse_probe_argument_ftype) (struct gdbarch *gdbarch, int narg);
-extern expr::operation_up gdbarch_dtrace_parse_probe_argument (struct gdbarch *gdbarch, int narg);
-extern void set_gdbarch_dtrace_parse_probe_argument (struct gdbarch *gdbarch, gdbarch_dtrace_parse_probe_argument_ftype *dtrace_parse_probe_argument);
+typedef expr::operation_up (gdbarch_dtrace_parse_probe_argument_ftype) (
+ struct gdbarch *gdbarch, int narg);
+extern expr::operation_up
+gdbarch_dtrace_parse_probe_argument (struct gdbarch *gdbarch, int narg);
+extern void set_gdbarch_dtrace_parse_probe_argument (
+ struct gdbarch *gdbarch,
+ gdbarch_dtrace_parse_probe_argument_ftype *dtrace_parse_probe_argument);
/* True if the given ADDR does not contain the instruction sequence
corresponding to a disabled DTrace is-enabled probe. */
extern bool gdbarch_dtrace_probe_is_enabled_p (struct gdbarch *gdbarch);
-typedef int (gdbarch_dtrace_probe_is_enabled_ftype) (struct gdbarch *gdbarch, CORE_ADDR addr);
-extern int gdbarch_dtrace_probe_is_enabled (struct gdbarch *gdbarch, CORE_ADDR addr);
-extern void set_gdbarch_dtrace_probe_is_enabled (struct gdbarch *gdbarch, gdbarch_dtrace_probe_is_enabled_ftype *dtrace_probe_is_enabled);
+typedef int (gdbarch_dtrace_probe_is_enabled_ftype) (struct gdbarch *gdbarch,
+ CORE_ADDR addr);
+extern int gdbarch_dtrace_probe_is_enabled (struct gdbarch *gdbarch,
+ CORE_ADDR addr);
+extern void set_gdbarch_dtrace_probe_is_enabled (
+ struct gdbarch *gdbarch,
+ gdbarch_dtrace_probe_is_enabled_ftype *dtrace_probe_is_enabled);
/* Enable a DTrace is-enabled probe at ADDR. */
extern bool gdbarch_dtrace_enable_probe_p (struct gdbarch *gdbarch);
-typedef void (gdbarch_dtrace_enable_probe_ftype) (struct gdbarch *gdbarch, CORE_ADDR addr);
-extern void gdbarch_dtrace_enable_probe (struct gdbarch *gdbarch, CORE_ADDR addr);
-extern void set_gdbarch_dtrace_enable_probe (struct gdbarch *gdbarch, gdbarch_dtrace_enable_probe_ftype *dtrace_enable_probe);
+typedef void (gdbarch_dtrace_enable_probe_ftype) (struct gdbarch *gdbarch,
+ CORE_ADDR addr);
+extern void gdbarch_dtrace_enable_probe (struct gdbarch *gdbarch,
+ CORE_ADDR addr);
+extern void set_gdbarch_dtrace_enable_probe (
+ struct gdbarch *gdbarch,
+ gdbarch_dtrace_enable_probe_ftype *dtrace_enable_probe);
/* Disable a DTrace is-enabled probe at ADDR. */
extern bool gdbarch_dtrace_disable_probe_p (struct gdbarch *gdbarch);
-typedef void (gdbarch_dtrace_disable_probe_ftype) (struct gdbarch *gdbarch, CORE_ADDR addr);
-extern void gdbarch_dtrace_disable_probe (struct gdbarch *gdbarch, CORE_ADDR addr);
-extern void set_gdbarch_dtrace_disable_probe (struct gdbarch *gdbarch, gdbarch_dtrace_disable_probe_ftype *dtrace_disable_probe);
+typedef void (gdbarch_dtrace_disable_probe_ftype) (struct gdbarch *gdbarch,
+ CORE_ADDR addr);
+extern void gdbarch_dtrace_disable_probe (struct gdbarch *gdbarch,
+ CORE_ADDR addr);
+extern void set_gdbarch_dtrace_disable_probe (
+ struct gdbarch *gdbarch,
+ gdbarch_dtrace_disable_probe_ftype *dtrace_disable_probe);
/* True if the list of shared libraries is one and only for all
processes, as opposed to a list of shared libraries per inferior.
@@ -1441,7 +2072,8 @@ extern void set_gdbarch_dtrace_disable_probe (struct gdbarch *gdbarch, gdbarch_d
addresses. */
extern int gdbarch_has_global_solist (struct gdbarch *gdbarch);
-extern void set_gdbarch_has_global_solist (struct gdbarch *gdbarch, int has_global_solist);
+extern void set_gdbarch_has_global_solist (struct gdbarch *gdbarch,
+ int has_global_solist);
/* On some targets, even though each inferior has its own private
address space, the debug interface takes care of making breakpoints
@@ -1449,40 +2081,56 @@ extern void set_gdbarch_has_global_solist (struct gdbarch *gdbarch, int has_glob
this property should be set to true. */
extern int gdbarch_has_global_breakpoints (struct gdbarch *gdbarch);
-extern void set_gdbarch_has_global_breakpoints (struct gdbarch *gdbarch, int has_global_breakpoints);
+extern void set_gdbarch_has_global_breakpoints (struct gdbarch *gdbarch,
+ int has_global_breakpoints);
/* True if inferiors share an address space (e.g., uClinux). */
typedef int (gdbarch_has_shared_address_space_ftype) (struct gdbarch *gdbarch);
extern int gdbarch_has_shared_address_space (struct gdbarch *gdbarch);
-extern void set_gdbarch_has_shared_address_space (struct gdbarch *gdbarch, gdbarch_has_shared_address_space_ftype *has_shared_address_space);
+extern void set_gdbarch_has_shared_address_space (
+ struct gdbarch *gdbarch,
+ gdbarch_has_shared_address_space_ftype *has_shared_address_space);
/* True if a fast tracepoint can be set at an address. */
-typedef int (gdbarch_fast_tracepoint_valid_at_ftype) (struct gdbarch *gdbarch, CORE_ADDR addr, std::string *msg);
-extern int gdbarch_fast_tracepoint_valid_at (struct gdbarch *gdbarch, CORE_ADDR addr, std::string *msg);
-extern void set_gdbarch_fast_tracepoint_valid_at (struct gdbarch *gdbarch, gdbarch_fast_tracepoint_valid_at_ftype *fast_tracepoint_valid_at);
+typedef int (gdbarch_fast_tracepoint_valid_at_ftype) (struct gdbarch *gdbarch,
+ CORE_ADDR addr,
+ std::string *msg);
+extern int gdbarch_fast_tracepoint_valid_at (struct gdbarch *gdbarch,
+ CORE_ADDR addr, std::string *msg);
+extern void set_gdbarch_fast_tracepoint_valid_at (
+ struct gdbarch *gdbarch,
+ gdbarch_fast_tracepoint_valid_at_ftype *fast_tracepoint_valid_at);
/* Guess register state based on tracepoint location. Used for tracepoints
where no registers have been collected, but there's only one location,
allowing us to guess the PC value, and perhaps some other registers.
On entry, regcache has all registers marked as unavailable. */
-typedef void (gdbarch_guess_tracepoint_registers_ftype) (struct gdbarch *gdbarch, struct regcache *regcache, CORE_ADDR addr);
-extern void gdbarch_guess_tracepoint_registers (struct gdbarch *gdbarch, struct regcache *regcache, CORE_ADDR addr);
-extern void set_gdbarch_guess_tracepoint_registers (struct gdbarch *gdbarch, gdbarch_guess_tracepoint_registers_ftype *guess_tracepoint_registers);
+typedef void (gdbarch_guess_tracepoint_registers_ftype) (
+ struct gdbarch *gdbarch, struct regcache *regcache, CORE_ADDR addr);
+extern void gdbarch_guess_tracepoint_registers (struct gdbarch *gdbarch,
+ struct regcache *regcache,
+ CORE_ADDR addr);
+extern void set_gdbarch_guess_tracepoint_registers (
+ struct gdbarch *gdbarch,
+ gdbarch_guess_tracepoint_registers_ftype *guess_tracepoint_registers);
/* Return the "auto" target charset. */
-typedef const char * (gdbarch_auto_charset_ftype) ();
-extern const char * gdbarch_auto_charset (struct gdbarch *gdbarch);
-extern void set_gdbarch_auto_charset (struct gdbarch *gdbarch, gdbarch_auto_charset_ftype *auto_charset);
+typedef const char *(gdbarch_auto_charset_ftype) ();
+extern const char *gdbarch_auto_charset (struct gdbarch *gdbarch);
+extern void
+set_gdbarch_auto_charset (struct gdbarch *gdbarch,
+ gdbarch_auto_charset_ftype *auto_charset);
/* Return the "auto" target wide charset. */
-typedef const char * (gdbarch_auto_wide_charset_ftype) ();
-extern const char * gdbarch_auto_wide_charset (struct gdbarch *gdbarch);
-extern void set_gdbarch_auto_wide_charset (struct gdbarch *gdbarch, gdbarch_auto_wide_charset_ftype *auto_wide_charset);
+typedef const char *(gdbarch_auto_wide_charset_ftype) ();
+extern const char *gdbarch_auto_wide_charset (struct gdbarch *gdbarch);
+extern void set_gdbarch_auto_wide_charset (
+ struct gdbarch *gdbarch, gdbarch_auto_wide_charset_ftype *auto_wide_charset);
/* If non-empty, this is a file extension that will be opened in place
of the file extension reported by the shared library list.
@@ -1491,15 +2139,19 @@ extern void set_gdbarch_auto_wide_charset (struct gdbarch *gdbarch, gdbarch_auto
where the names of the files run on the target differ in extension
compared to the names of the files GDB should load for debug info. */
-extern const char * gdbarch_solib_symbols_extension (struct gdbarch *gdbarch);
-extern void set_gdbarch_solib_symbols_extension (struct gdbarch *gdbarch, const char * solib_symbols_extension);
+extern const char *gdbarch_solib_symbols_extension (struct gdbarch *gdbarch);
+extern void
+set_gdbarch_solib_symbols_extension (struct gdbarch *gdbarch,
+ const char *solib_symbols_extension);
/* If true, the target OS has DOS-based file system semantics. That
is, absolute paths include a drive name, and the backslash is
considered a directory separator. */
extern int gdbarch_has_dos_based_file_system (struct gdbarch *gdbarch);
-extern void set_gdbarch_has_dos_based_file_system (struct gdbarch *gdbarch, int has_dos_based_file_system);
+extern void
+set_gdbarch_has_dos_based_file_system (struct gdbarch *gdbarch,
+ int has_dos_based_file_system);
/* Generate bytecodes to collect the return address in a frame.
Since the bytecodes run on the target, possibly with GDB not even
@@ -1507,17 +2159,29 @@ extern void set_gdbarch_has_dos_based_file_system (struct gdbarch *gdbarch, int
typically this function will issue bytecodes for one or more likely
places that the return address may be found. */
-typedef void (gdbarch_gen_return_address_ftype) (struct gdbarch *gdbarch, struct agent_expr *ax, struct axs_value *value, CORE_ADDR scope);
-extern void gdbarch_gen_return_address (struct gdbarch *gdbarch, struct agent_expr *ax, struct axs_value *value, CORE_ADDR scope);
-extern void set_gdbarch_gen_return_address (struct gdbarch *gdbarch, gdbarch_gen_return_address_ftype *gen_return_address);
+typedef void (gdbarch_gen_return_address_ftype) (struct gdbarch *gdbarch,
+ struct agent_expr *ax,
+ struct axs_value *value,
+ CORE_ADDR scope);
+extern void gdbarch_gen_return_address (struct gdbarch *gdbarch,
+ struct agent_expr *ax,
+ struct axs_value *value,
+ CORE_ADDR scope);
+extern void set_gdbarch_gen_return_address (
+ struct gdbarch *gdbarch,
+ gdbarch_gen_return_address_ftype *gen_return_address);
/* Implement the "info proc" command. */
extern bool gdbarch_info_proc_p (struct gdbarch *gdbarch);
-typedef void (gdbarch_info_proc_ftype) (struct gdbarch *gdbarch, const char *args, enum info_proc_what what);
-extern void gdbarch_info_proc (struct gdbarch *gdbarch, const char *args, enum info_proc_what what);
-extern void set_gdbarch_info_proc (struct gdbarch *gdbarch, gdbarch_info_proc_ftype *info_proc);
+typedef void (gdbarch_info_proc_ftype) (struct gdbarch *gdbarch,
+ const char *args,
+ enum info_proc_what what);
+extern void gdbarch_info_proc (struct gdbarch *gdbarch, const char *args,
+ enum info_proc_what what);
+extern void set_gdbarch_info_proc (struct gdbarch *gdbarch,
+ gdbarch_info_proc_ftype *info_proc);
/* Implement the "info proc" command for core files. Noe that there
are two "info_proc"-like methods on gdbarch -- one for core files,
@@ -1525,9 +2189,14 @@ extern void set_gdbarch_info_proc (struct gdbarch *gdbarch, gdbarch_info_proc_ft
extern bool gdbarch_core_info_proc_p (struct gdbarch *gdbarch);
-typedef void (gdbarch_core_info_proc_ftype) (struct gdbarch *gdbarch, const char *args, enum info_proc_what what);
-extern void gdbarch_core_info_proc (struct gdbarch *gdbarch, const char *args, enum info_proc_what what);
-extern void set_gdbarch_core_info_proc (struct gdbarch *gdbarch, gdbarch_core_info_proc_ftype *core_info_proc);
+typedef void (gdbarch_core_info_proc_ftype) (struct gdbarch *gdbarch,
+ const char *args,
+ enum info_proc_what what);
+extern void gdbarch_core_info_proc (struct gdbarch *gdbarch, const char *args,
+ enum info_proc_what what);
+extern void
+set_gdbarch_core_info_proc (struct gdbarch *gdbarch,
+ gdbarch_core_info_proc_ftype *core_info_proc);
/* Iterate over all objfiles in the order that makes the most sense
for the architecture to make global symbol searches.
@@ -1538,39 +2207,60 @@ extern void set_gdbarch_core_info_proc (struct gdbarch *gdbarch, gdbarch_core_in
If not NULL, CURRENT_OBJFILE corresponds to the objfile being
inspected when the symbol search was requested. */
-typedef void (gdbarch_iterate_over_objfiles_in_search_order_ftype) (struct gdbarch *gdbarch, iterate_over_objfiles_in_search_order_cb_ftype cb, struct objfile *current_objfile);
-extern void gdbarch_iterate_over_objfiles_in_search_order (struct gdbarch *gdbarch, iterate_over_objfiles_in_search_order_cb_ftype cb, struct objfile *current_objfile);
-extern void set_gdbarch_iterate_over_objfiles_in_search_order (struct gdbarch *gdbarch, gdbarch_iterate_over_objfiles_in_search_order_ftype *iterate_over_objfiles_in_search_order);
+typedef void (gdbarch_iterate_over_objfiles_in_search_order_ftype) (
+ struct gdbarch *gdbarch, iterate_over_objfiles_in_search_order_cb_ftype cb,
+ struct objfile *current_objfile);
+extern void gdbarch_iterate_over_objfiles_in_search_order (
+ struct gdbarch *gdbarch, iterate_over_objfiles_in_search_order_cb_ftype cb,
+ struct objfile *current_objfile);
+extern void set_gdbarch_iterate_over_objfiles_in_search_order (
+ struct gdbarch *gdbarch, gdbarch_iterate_over_objfiles_in_search_order_ftype
+ *iterate_over_objfiles_in_search_order);
/* Ravenscar arch-dependent ops. */
-extern struct ravenscar_arch_ops * gdbarch_ravenscar_ops (struct gdbarch *gdbarch);
-extern void set_gdbarch_ravenscar_ops (struct gdbarch *gdbarch, struct ravenscar_arch_ops * ravenscar_ops);
+extern struct ravenscar_arch_ops *
+gdbarch_ravenscar_ops (struct gdbarch *gdbarch);
+extern void
+set_gdbarch_ravenscar_ops (struct gdbarch *gdbarch,
+ struct ravenscar_arch_ops *ravenscar_ops);
/* Return non-zero if the instruction at ADDR is a call; zero otherwise. */
-typedef int (gdbarch_insn_is_call_ftype) (struct gdbarch *gdbarch, CORE_ADDR addr);
+typedef int (gdbarch_insn_is_call_ftype) (struct gdbarch *gdbarch,
+ CORE_ADDR addr);
extern int gdbarch_insn_is_call (struct gdbarch *gdbarch, CORE_ADDR addr);
-extern void set_gdbarch_insn_is_call (struct gdbarch *gdbarch, gdbarch_insn_is_call_ftype *insn_is_call);
+extern void
+set_gdbarch_insn_is_call (struct gdbarch *gdbarch,
+ gdbarch_insn_is_call_ftype *insn_is_call);
/* Return non-zero if the instruction at ADDR is a return; zero otherwise. */
-typedef int (gdbarch_insn_is_ret_ftype) (struct gdbarch *gdbarch, CORE_ADDR addr);
+typedef int (gdbarch_insn_is_ret_ftype) (struct gdbarch *gdbarch,
+ CORE_ADDR addr);
extern int gdbarch_insn_is_ret (struct gdbarch *gdbarch, CORE_ADDR addr);
-extern void set_gdbarch_insn_is_ret (struct gdbarch *gdbarch, gdbarch_insn_is_ret_ftype *insn_is_ret);
+extern void set_gdbarch_insn_is_ret (struct gdbarch *gdbarch,
+ gdbarch_insn_is_ret_ftype *insn_is_ret);
/* Return non-zero if the instruction at ADDR is a jump; zero otherwise. */
-typedef int (gdbarch_insn_is_jump_ftype) (struct gdbarch *gdbarch, CORE_ADDR addr);
+typedef int (gdbarch_insn_is_jump_ftype) (struct gdbarch *gdbarch,
+ CORE_ADDR addr);
extern int gdbarch_insn_is_jump (struct gdbarch *gdbarch, CORE_ADDR addr);
-extern void set_gdbarch_insn_is_jump (struct gdbarch *gdbarch, gdbarch_insn_is_jump_ftype *insn_is_jump);
+extern void
+set_gdbarch_insn_is_jump (struct gdbarch *gdbarch,
+ gdbarch_insn_is_jump_ftype *insn_is_jump);
/* Return true if there's a program/permanent breakpoint planted in
memory at ADDRESS, return false otherwise. */
-typedef bool (gdbarch_program_breakpoint_here_p_ftype) (struct gdbarch *gdbarch, CORE_ADDR address);
-extern bool gdbarch_program_breakpoint_here_p (struct gdbarch *gdbarch, CORE_ADDR address);
-extern void set_gdbarch_program_breakpoint_here_p (struct gdbarch *gdbarch, gdbarch_program_breakpoint_here_p_ftype *program_breakpoint_here_p);
+typedef bool (gdbarch_program_breakpoint_here_p_ftype) (
+ struct gdbarch *gdbarch, CORE_ADDR address);
+extern bool gdbarch_program_breakpoint_here_p (struct gdbarch *gdbarch,
+ CORE_ADDR address);
+extern void set_gdbarch_program_breakpoint_here_p (
+ struct gdbarch *gdbarch,
+ gdbarch_program_breakpoint_here_p_ftype *program_breakpoint_here_p);
/* Read one auxv entry from *READPTR, not reading locations >= ENDPTR.
Return 0 if *READPTR is already at the end of the buffer.
@@ -1579,49 +2269,74 @@ extern void set_gdbarch_program_breakpoint_here_p (struct gdbarch *gdbarch, gdba
extern bool gdbarch_auxv_parse_p (struct gdbarch *gdbarch);
-typedef int (gdbarch_auxv_parse_ftype) (struct gdbarch *gdbarch, const gdb_byte **readptr, const gdb_byte *endptr, CORE_ADDR *typep, CORE_ADDR *valp);
-extern int gdbarch_auxv_parse (struct gdbarch *gdbarch, const gdb_byte **readptr, const gdb_byte *endptr, CORE_ADDR *typep, CORE_ADDR *valp);
-extern void set_gdbarch_auxv_parse (struct gdbarch *gdbarch, gdbarch_auxv_parse_ftype *auxv_parse);
+typedef int (gdbarch_auxv_parse_ftype) (struct gdbarch *gdbarch,
+ const gdb_byte **readptr,
+ const gdb_byte *endptr,
+ CORE_ADDR *typep, CORE_ADDR *valp);
+extern int gdbarch_auxv_parse (struct gdbarch *gdbarch,
+ const gdb_byte **readptr,
+ const gdb_byte *endptr, CORE_ADDR *typep,
+ CORE_ADDR *valp);
+extern void set_gdbarch_auxv_parse (struct gdbarch *gdbarch,
+ gdbarch_auxv_parse_ftype *auxv_parse);
/* Print the description of a single auxv entry described by TYPE and VAL
to FILE. */
-typedef void (gdbarch_print_auxv_entry_ftype) (struct gdbarch *gdbarch, struct ui_file *file, CORE_ADDR type, CORE_ADDR val);
-extern void gdbarch_print_auxv_entry (struct gdbarch *gdbarch, struct ui_file *file, CORE_ADDR type, CORE_ADDR val);
-extern void set_gdbarch_print_auxv_entry (struct gdbarch *gdbarch, gdbarch_print_auxv_entry_ftype *print_auxv_entry);
+typedef void (gdbarch_print_auxv_entry_ftype) (struct gdbarch *gdbarch,
+ struct ui_file *file,
+ CORE_ADDR type, CORE_ADDR val);
+extern void gdbarch_print_auxv_entry (struct gdbarch *gdbarch,
+ struct ui_file *file, CORE_ADDR type,
+ CORE_ADDR val);
+extern void set_gdbarch_print_auxv_entry (
+ struct gdbarch *gdbarch, gdbarch_print_auxv_entry_ftype *print_auxv_entry);
/* Find the address range of the current inferior's vsyscall/vDSO, and
write it to *RANGE. If the vsyscall's length can't be determined, a
range with zero length is returned. Returns true if the vsyscall is
found, false otherwise. */
-typedef int (gdbarch_vsyscall_range_ftype) (struct gdbarch *gdbarch, struct mem_range *range);
-extern int gdbarch_vsyscall_range (struct gdbarch *gdbarch, struct mem_range *range);
-extern void set_gdbarch_vsyscall_range (struct gdbarch *gdbarch, gdbarch_vsyscall_range_ftype *vsyscall_range);
+typedef int (gdbarch_vsyscall_range_ftype) (struct gdbarch *gdbarch,
+ struct mem_range *range);
+extern int gdbarch_vsyscall_range (struct gdbarch *gdbarch,
+ struct mem_range *range);
+extern void
+set_gdbarch_vsyscall_range (struct gdbarch *gdbarch,
+ gdbarch_vsyscall_range_ftype *vsyscall_range);
/* Allocate SIZE bytes of PROT protected page aligned memory in inferior.
PROT has GDB_MMAP_PROT_* bitmask format.
Throw an error if it is not possible. Returned address is always valid. */
typedef CORE_ADDR (gdbarch_infcall_mmap_ftype) (CORE_ADDR size, unsigned prot);
-extern CORE_ADDR gdbarch_infcall_mmap (struct gdbarch *gdbarch, CORE_ADDR size, unsigned prot);
-extern void set_gdbarch_infcall_mmap (struct gdbarch *gdbarch, gdbarch_infcall_mmap_ftype *infcall_mmap);
+extern CORE_ADDR gdbarch_infcall_mmap (struct gdbarch *gdbarch, CORE_ADDR size,
+ unsigned prot);
+extern void
+set_gdbarch_infcall_mmap (struct gdbarch *gdbarch,
+ gdbarch_infcall_mmap_ftype *infcall_mmap);
/* Deallocate SIZE bytes of memory at ADDR in inferior from gdbarch_infcall_mmap.
Print a warning if it is not possible. */
typedef void (gdbarch_infcall_munmap_ftype) (CORE_ADDR addr, CORE_ADDR size);
-extern void gdbarch_infcall_munmap (struct gdbarch *gdbarch, CORE_ADDR addr, CORE_ADDR size);
-extern void set_gdbarch_infcall_munmap (struct gdbarch *gdbarch, gdbarch_infcall_munmap_ftype *infcall_munmap);
+extern void gdbarch_infcall_munmap (struct gdbarch *gdbarch, CORE_ADDR addr,
+ CORE_ADDR size);
+extern void
+set_gdbarch_infcall_munmap (struct gdbarch *gdbarch,
+ gdbarch_infcall_munmap_ftype *infcall_munmap);
/* Return string (caller has to use xfree for it) with options for GCC
to produce code for this target, typically "-m64", "-m32" or "-m31".
These options are put before CU's DW_AT_producer compilation options so that
they can override it. */
-typedef std::string (gdbarch_gcc_target_options_ftype) (struct gdbarch *gdbarch);
+typedef std::string (gdbarch_gcc_target_options_ftype) (
+ struct gdbarch *gdbarch);
extern std::string gdbarch_gcc_target_options (struct gdbarch *gdbarch);
-extern void set_gdbarch_gcc_target_options (struct gdbarch *gdbarch, gdbarch_gcc_target_options_ftype *gcc_target_options);
+extern void set_gdbarch_gcc_target_options (
+ struct gdbarch *gdbarch,
+ gdbarch_gcc_target_options_ftype *gcc_target_options);
/* Return a regular expression that matches names used by this
architecture in GNU configury triplets. The result is statically
@@ -1629,46 +2344,74 @@ extern void set_gdbarch_gcc_target_options (struct gdbarch *gdbarch, gdbarch_gcc
returns the BFD architecture name, which is correct in nearly every
case. */
-typedef const char * (gdbarch_gnu_triplet_regexp_ftype) (struct gdbarch *gdbarch);
-extern const char * gdbarch_gnu_triplet_regexp (struct gdbarch *gdbarch);
-extern void set_gdbarch_gnu_triplet_regexp (struct gdbarch *gdbarch, gdbarch_gnu_triplet_regexp_ftype *gnu_triplet_regexp);
+typedef const char *(
+ gdbarch_gnu_triplet_regexp_ftype) (struct gdbarch *gdbarch);
+extern const char *gdbarch_gnu_triplet_regexp (struct gdbarch *gdbarch);
+extern void set_gdbarch_gnu_triplet_regexp (
+ struct gdbarch *gdbarch,
+ gdbarch_gnu_triplet_regexp_ftype *gnu_triplet_regexp);
/* Return the size in 8-bit bytes of an addressable memory unit on this
architecture. This corresponds to the number of 8-bit bytes associated to
each address in memory. */
-typedef int (gdbarch_addressable_memory_unit_size_ftype) (struct gdbarch *gdbarch);
+typedef int (gdbarch_addressable_memory_unit_size_ftype) (
+ struct gdbarch *gdbarch);
extern int gdbarch_addressable_memory_unit_size (struct gdbarch *gdbarch);
-extern void set_gdbarch_addressable_memory_unit_size (struct gdbarch *gdbarch, gdbarch_addressable_memory_unit_size_ftype *addressable_memory_unit_size);
+extern void set_gdbarch_addressable_memory_unit_size (
+ struct gdbarch *gdbarch,
+ gdbarch_addressable_memory_unit_size_ftype *addressable_memory_unit_size);
/* Functions for allowing a target to modify its disassembler options. */
-extern const char * gdbarch_disassembler_options_implicit (struct gdbarch *gdbarch);
-extern void set_gdbarch_disassembler_options_implicit (struct gdbarch *gdbarch, const char * disassembler_options_implicit);
+extern const char *
+gdbarch_disassembler_options_implicit (struct gdbarch *gdbarch);
+extern void set_gdbarch_disassembler_options_implicit (
+ struct gdbarch *gdbarch, const char *disassembler_options_implicit);
-extern char ** gdbarch_disassembler_options (struct gdbarch *gdbarch);
-extern void set_gdbarch_disassembler_options (struct gdbarch *gdbarch, char ** disassembler_options);
+extern char **gdbarch_disassembler_options (struct gdbarch *gdbarch);
+extern void set_gdbarch_disassembler_options (struct gdbarch *gdbarch,
+ char **disassembler_options);
-extern const disasm_options_and_args_t * gdbarch_valid_disassembler_options (struct gdbarch *gdbarch);
-extern void set_gdbarch_valid_disassembler_options (struct gdbarch *gdbarch, const disasm_options_and_args_t * valid_disassembler_options);
+extern const disasm_options_and_args_t *
+gdbarch_valid_disassembler_options (struct gdbarch *gdbarch);
+extern void set_gdbarch_valid_disassembler_options (
+ struct gdbarch *gdbarch,
+ const disasm_options_and_args_t *valid_disassembler_options);
/* Type alignment override method. Return the architecture specific
alignment required for TYPE. If there is no special handling
required for TYPE then return the value 0, GDB will then apply the
default rules as laid out in gdbtypes.c:type_align. */
-typedef ULONGEST (gdbarch_type_align_ftype) (struct gdbarch *gdbarch, struct type *type);
-extern ULONGEST gdbarch_type_align (struct gdbarch *gdbarch, struct type *type);
-extern void set_gdbarch_type_align (struct gdbarch *gdbarch, gdbarch_type_align_ftype *type_align);
+typedef ULONGEST (gdbarch_type_align_ftype) (struct gdbarch *gdbarch,
+ struct type *type);
+extern ULONGEST gdbarch_type_align (struct gdbarch *gdbarch,
+ struct type *type);
+extern void set_gdbarch_type_align (struct gdbarch *gdbarch,
+ gdbarch_type_align_ftype *type_align);
/* Return a string containing any flags for the given PC in the given FRAME. */
-typedef std::string (gdbarch_get_pc_address_flags_ftype) (frame_info_ptr frame, CORE_ADDR pc);
-extern std::string gdbarch_get_pc_address_flags (struct gdbarch *gdbarch, frame_info_ptr frame, CORE_ADDR pc);
-extern void set_gdbarch_get_pc_address_flags (struct gdbarch *gdbarch, gdbarch_get_pc_address_flags_ftype *get_pc_address_flags);
+typedef std::string (gdbarch_get_pc_address_flags_ftype) (frame_info_ptr frame,
+ CORE_ADDR pc);
+extern std::string gdbarch_get_pc_address_flags (struct gdbarch *gdbarch,
+ frame_info_ptr frame,
+ CORE_ADDR pc);
+extern void set_gdbarch_get_pc_address_flags (
+ struct gdbarch *gdbarch,
+ gdbarch_get_pc_address_flags_ftype *get_pc_address_flags);
/* Read core file mappings */
-typedef void (gdbarch_read_core_file_mappings_ftype) (struct gdbarch *gdbarch, struct bfd *cbfd, read_core_file_mappings_pre_loop_ftype pre_loop_cb, read_core_file_mappings_loop_ftype loop_cb);
-extern void gdbarch_read_core_file_mappings (struct gdbarch *gdbarch, struct bfd *cbfd, read_core_file_mappings_pre_loop_ftype pre_loop_cb, read_core_file_mappings_loop_ftype loop_cb);
-extern void set_gdbarch_read_core_file_mappings (struct gdbarch *gdbarch, gdbarch_read_core_file_mappings_ftype *read_core_file_mappings);
+typedef void (gdbarch_read_core_file_mappings_ftype) (
+ struct gdbarch *gdbarch, struct bfd *cbfd,
+ read_core_file_mappings_pre_loop_ftype pre_loop_cb,
+ read_core_file_mappings_loop_ftype loop_cb);
+extern void gdbarch_read_core_file_mappings (
+ struct gdbarch *gdbarch, struct bfd *cbfd,
+ read_core_file_mappings_pre_loop_ftype pre_loop_cb,
+ read_core_file_mappings_loop_ftype loop_cb);
+extern void set_gdbarch_read_core_file_mappings (
+ struct gdbarch *gdbarch,
+ gdbarch_read_core_file_mappings_ftype *read_core_file_mappings);
diff --git a/gdb/gdbarch-selftests.c b/gdb/gdbarch-selftests.c
index cc9604b9bf7..ada4d1072d5 100644
--- a/gdb/gdbarch-selftests.c
+++ b/gdb/gdbarch-selftests.c
@@ -29,7 +29,8 @@
#include <map>
-namespace selftests {
+namespace selftests
+{
/* Test gdbarch methods register_to_value and value_to_register. */
@@ -37,39 +38,23 @@ static void
register_to_value_test (struct gdbarch *gdbarch)
{
const struct builtin_type *builtin = builtin_type (gdbarch);
- struct type *types[] =
- {
- builtin->builtin_void,
- builtin->builtin_char,
- builtin->builtin_short,
- builtin->builtin_int,
- builtin->builtin_long,
- builtin->builtin_signed_char,
- builtin->builtin_unsigned_short,
- builtin->builtin_unsigned_int,
- builtin->builtin_unsigned_long,
- builtin->builtin_float,
- builtin->builtin_double,
- builtin->builtin_long_double,
- builtin->builtin_complex,
- builtin->builtin_double_complex,
- builtin->builtin_string,
- builtin->builtin_bool,
- builtin->builtin_long_long,
- builtin->builtin_unsigned_long_long,
- builtin->builtin_int8,
- builtin->builtin_uint8,
- builtin->builtin_int16,
- builtin->builtin_uint16,
- builtin->builtin_int32,
- builtin->builtin_uint32,
- builtin->builtin_int64,
- builtin->builtin_uint64,
- builtin->builtin_int128,
- builtin->builtin_uint128,
- builtin->builtin_char16,
- builtin->builtin_char32,
- };
+ struct type *types[] = {
+ builtin->builtin_void, builtin->builtin_char,
+ builtin->builtin_short, builtin->builtin_int,
+ builtin->builtin_long, builtin->builtin_signed_char,
+ builtin->builtin_unsigned_short, builtin->builtin_unsigned_int,
+ builtin->builtin_unsigned_long, builtin->builtin_float,
+ builtin->builtin_double, builtin->builtin_long_double,
+ builtin->builtin_complex, builtin->builtin_double_complex,
+ builtin->builtin_string, builtin->builtin_bool,
+ builtin->builtin_long_long, builtin->builtin_unsigned_long_long,
+ builtin->builtin_int8, builtin->builtin_uint8,
+ builtin->builtin_int16, builtin->builtin_uint16,
+ builtin->builtin_int32, builtin->builtin_uint32,
+ builtin->builtin_int64, builtin->builtin_uint64,
+ builtin->builtin_int128, builtin->builtin_uint128,
+ builtin->builtin_char16, builtin->builtin_char32,
+ };
scoped_mock_context<test_target_ops> mockctx (gdbarch);
@@ -105,8 +90,8 @@ register_to_value_test (struct gdbarch *gdbarch)
int optim, unavail, ok;
/* Set the fingerprint in the last two bytes. */
- buf [type->length ()]= 'w';
- buf [type->length () + 1]= 'l';
+ buf[type->length ()] = 'w';
+ buf[type->length () + 1] = 'l';
ok = gdbarch_register_to_value (gdbarch, frame, regnum, type,
buf.data (), &optim, &unavail);
@@ -142,10 +127,9 @@ register_name_test (struct gdbarch *gdbarch)
return a non-empty string. */
const char *name = gdbarch_register_name (gdbarch, regnum);
- if (run_verbose() && name == nullptr)
+ if (run_verbose () && name == nullptr)
debug_printf ("arch: %s, register: %d returned nullptr\n",
- gdbarch_bfd_arch_info (gdbarch)->printable_name,
- regnum);
+ gdbarch_bfd_arch_info (gdbarch)->printable_name, regnum);
SELF_CHECK (name != nullptr);
/* Every register name, that is not the empty string, should be
@@ -156,7 +140,7 @@ register_name_test (struct gdbarch *gdbarch)
{
std::string s (name);
name_counts[s]++;
- if (run_verbose() && name_counts[s] > 1)
+ if (run_verbose () && name_counts[s] > 1)
debug_printf ("arch: %s, register: %d (%s) is a duplicate\n",
gdbarch_bfd_arch_info (gdbarch)->printable_name,
regnum, name);
@@ -168,6 +152,7 @@ register_name_test (struct gdbarch *gdbarch)
} // namespace selftests
void _initialize_gdbarch_selftests ();
+
void
_initialize_gdbarch_selftests ()
{
diff --git a/gdb/gdbarch.c b/gdb/gdbarch.c
index 04fcc92f8f9..1105ab1bb3f 100644
--- a/gdb/gdbarch.c
+++ b/gdb/gdbarch.c
@@ -24,7 +24,6 @@
./gdbarch.py
*/
-
/* Maintain the struct gdbarch object. */
struct gdbarch
@@ -38,47 +37,52 @@ struct gdbarch
registry<gdbarch> registry_fields;
/* basic architectural information. */
- const struct bfd_arch_info * bfd_arch_info;
+ const struct bfd_arch_info *bfd_arch_info;
enum bfd_endian byte_order;
enum bfd_endian byte_order_for_code;
enum gdb_osabi osabi;
- const struct target_desc * target_desc;
+ const struct target_desc *target_desc;
/* target specific vector. */
gdbarch_tdep_up tdep;
gdbarch_dump_tdep_ftype *dump_tdep = nullptr;
- int short_bit = 2*TARGET_CHAR_BIT;
- int int_bit = 4*TARGET_CHAR_BIT;
- int long_bit = 4*TARGET_CHAR_BIT;
- int long_long_bit = 2*4*TARGET_CHAR_BIT;
- int bfloat16_bit = 2*TARGET_CHAR_BIT;
- const struct floatformat ** bfloat16_format = 0;
- int half_bit = 2*TARGET_CHAR_BIT;
- const struct floatformat ** half_format = 0;
- int float_bit = 4*TARGET_CHAR_BIT;
- const struct floatformat ** float_format = 0;
- int double_bit = 8*TARGET_CHAR_BIT;
- const struct floatformat ** double_format = 0;
- int long_double_bit = 8*TARGET_CHAR_BIT;
- const struct floatformat ** long_double_format = 0;
- int wchar_bit = 4*TARGET_CHAR_BIT;
+ int short_bit = 2 * TARGET_CHAR_BIT;
+ int int_bit = 4 * TARGET_CHAR_BIT;
+ int long_bit = 4 * TARGET_CHAR_BIT;
+ int long_long_bit = 2 * 4 * TARGET_CHAR_BIT;
+ int bfloat16_bit = 2 * TARGET_CHAR_BIT;
+ const struct floatformat **bfloat16_format = 0;
+ int half_bit = 2 * TARGET_CHAR_BIT;
+ const struct floatformat **half_format = 0;
+ int float_bit = 4 * TARGET_CHAR_BIT;
+ const struct floatformat **float_format = 0;
+ int double_bit = 8 * TARGET_CHAR_BIT;
+ const struct floatformat **double_format = 0;
+ int long_double_bit = 8 * TARGET_CHAR_BIT;
+ const struct floatformat **long_double_format = 0;
+ int wchar_bit = 4 * TARGET_CHAR_BIT;
int wchar_signed = -1;
- gdbarch_floatformat_for_type_ftype *floatformat_for_type = default_floatformat_for_type;
- int ptr_bit = 4*TARGET_CHAR_BIT;
+ gdbarch_floatformat_for_type_ftype *floatformat_for_type
+ = default_floatformat_for_type;
+ int ptr_bit = 4 * TARGET_CHAR_BIT;
int addr_bit = 0;
int dwarf2_addr_size = 0;
int char_signed = -1;
gdbarch_read_pc_ftype *read_pc = nullptr;
gdbarch_write_pc_ftype *write_pc = nullptr;
- gdbarch_virtual_frame_pointer_ftype *virtual_frame_pointer = legacy_virtual_frame_pointer;
+ gdbarch_virtual_frame_pointer_ftype *virtual_frame_pointer
+ = legacy_virtual_frame_pointer;
gdbarch_pseudo_register_read_ftype *pseudo_register_read = nullptr;
- gdbarch_pseudo_register_read_value_ftype *pseudo_register_read_value = nullptr;
+ gdbarch_pseudo_register_read_value_ftype *pseudo_register_read_value
+ = nullptr;
gdbarch_pseudo_register_write_ftype *pseudo_register_write = nullptr;
int num_regs = -1;
int num_pseudo_regs = 0;
- gdbarch_ax_pseudo_register_collect_ftype *ax_pseudo_register_collect = nullptr;
- gdbarch_ax_pseudo_register_push_stack_ftype *ax_pseudo_register_push_stack = nullptr;
+ gdbarch_ax_pseudo_register_collect_ftype *ax_pseudo_register_collect
+ = nullptr;
+ gdbarch_ax_pseudo_register_push_stack_ftype *ax_pseudo_register_push_stack
+ = nullptr;
gdbarch_report_signal_info_ftype *report_signal_info = nullptr;
int sp_regnum = -1;
int pc_regnum = -1;
@@ -87,7 +91,8 @@ struct gdbarch
gdbarch_stab_reg_to_regnum_ftype *stab_reg_to_regnum = no_op_reg_to_regnum;
gdbarch_ecoff_reg_to_regnum_ftype *ecoff_reg_to_regnum = no_op_reg_to_regnum;
gdbarch_sdb_reg_to_regnum_ftype *sdb_reg_to_regnum = no_op_reg_to_regnum;
- gdbarch_dwarf2_reg_to_regnum_ftype *dwarf2_reg_to_regnum = no_op_reg_to_regnum;
+ gdbarch_dwarf2_reg_to_regnum_ftype *dwarf2_reg_to_regnum
+ = no_op_reg_to_regnum;
gdbarch_register_name_ftype *register_name = 0;
gdbarch_register_type_ftype *register_type = nullptr;
gdbarch_dummy_id_ftype *dummy_id = default_dummy_id;
@@ -95,52 +100,74 @@ struct gdbarch
gdbarch_push_dummy_call_ftype *push_dummy_call = nullptr;
enum call_dummy_location_type call_dummy_location = AT_ENTRY_POINT;
gdbarch_push_dummy_code_ftype *push_dummy_code = nullptr;
- gdbarch_code_of_frame_writable_ftype *code_of_frame_writable = default_code_of_frame_writable;
- gdbarch_print_registers_info_ftype *print_registers_info = default_print_registers_info;
+ gdbarch_code_of_frame_writable_ftype *code_of_frame_writable
+ = default_code_of_frame_writable;
+ gdbarch_print_registers_info_ftype *print_registers_info
+ = default_print_registers_info;
gdbarch_print_float_info_ftype *print_float_info = default_print_float_info;
gdbarch_print_vector_info_ftype *print_vector_info = nullptr;
- gdbarch_register_sim_regno_ftype *register_sim_regno = legacy_register_sim_regno;
- gdbarch_cannot_fetch_register_ftype *cannot_fetch_register = cannot_register_not;
- gdbarch_cannot_store_register_ftype *cannot_store_register = cannot_register_not;
+ gdbarch_register_sim_regno_ftype *register_sim_regno
+ = legacy_register_sim_regno;
+ gdbarch_cannot_fetch_register_ftype *cannot_fetch_register
+ = cannot_register_not;
+ gdbarch_cannot_store_register_ftype *cannot_store_register
+ = cannot_register_not;
gdbarch_get_longjmp_target_ftype *get_longjmp_target = nullptr;
int believe_pcc_promotion = 0;
- gdbarch_convert_register_p_ftype *convert_register_p = generic_convert_register_p;
+ gdbarch_convert_register_p_ftype *convert_register_p
+ = generic_convert_register_p;
gdbarch_register_to_value_ftype *register_to_value = nullptr;
gdbarch_value_to_register_ftype *value_to_register = nullptr;
- gdbarch_value_from_register_ftype *value_from_register = default_value_from_register;
- gdbarch_pointer_to_address_ftype *pointer_to_address = unsigned_pointer_to_address;
- gdbarch_address_to_pointer_ftype *address_to_pointer = unsigned_address_to_pointer;
+ gdbarch_value_from_register_ftype *value_from_register
+ = default_value_from_register;
+ gdbarch_pointer_to_address_ftype *pointer_to_address
+ = unsigned_pointer_to_address;
+ gdbarch_address_to_pointer_ftype *address_to_pointer
+ = unsigned_address_to_pointer;
gdbarch_integer_to_address_ftype *integer_to_address = nullptr;
gdbarch_return_value_ftype *return_value = nullptr;
- gdbarch_return_value_as_value_ftype *return_value_as_value = default_gdbarch_return_value;
- gdbarch_get_return_buf_addr_ftype *get_return_buf_addr = default_get_return_buf_addr;
- gdbarch_return_in_first_hidden_param_p_ftype *return_in_first_hidden_param_p = default_return_in_first_hidden_param_p;
+ gdbarch_return_value_as_value_ftype *return_value_as_value
+ = default_gdbarch_return_value;
+ gdbarch_get_return_buf_addr_ftype *get_return_buf_addr
+ = default_get_return_buf_addr;
+ gdbarch_return_in_first_hidden_param_p_ftype *return_in_first_hidden_param_p
+ = default_return_in_first_hidden_param_p;
gdbarch_skip_prologue_ftype *skip_prologue = 0;
gdbarch_skip_main_prologue_ftype *skip_main_prologue = nullptr;
gdbarch_skip_entrypoint_ftype *skip_entrypoint = nullptr;
gdbarch_inner_than_ftype *inner_than = 0;
- gdbarch_breakpoint_from_pc_ftype *breakpoint_from_pc = default_breakpoint_from_pc;
+ gdbarch_breakpoint_from_pc_ftype *breakpoint_from_pc
+ = default_breakpoint_from_pc;
gdbarch_breakpoint_kind_from_pc_ftype *breakpoint_kind_from_pc = 0;
gdbarch_sw_breakpoint_from_kind_ftype *sw_breakpoint_from_kind = NULL;
- gdbarch_breakpoint_kind_from_current_state_ftype *breakpoint_kind_from_current_state = default_breakpoint_kind_from_current_state;
+ gdbarch_breakpoint_kind_from_current_state_ftype
+ *breakpoint_kind_from_current_state
+ = default_breakpoint_kind_from_current_state;
gdbarch_adjust_breakpoint_address_ftype *adjust_breakpoint_address = nullptr;
- gdbarch_memory_insert_breakpoint_ftype *memory_insert_breakpoint = default_memory_insert_breakpoint;
- gdbarch_memory_remove_breakpoint_ftype *memory_remove_breakpoint = default_memory_remove_breakpoint;
+ gdbarch_memory_insert_breakpoint_ftype *memory_insert_breakpoint
+ = default_memory_insert_breakpoint;
+ gdbarch_memory_remove_breakpoint_ftype *memory_remove_breakpoint
+ = default_memory_remove_breakpoint;
CORE_ADDR decr_pc_after_break = 0;
CORE_ADDR deprecated_function_start_offset = 0;
- gdbarch_remote_register_number_ftype *remote_register_number = default_remote_register_number;
- gdbarch_fetch_tls_load_module_address_ftype *fetch_tls_load_module_address = nullptr;
+ gdbarch_remote_register_number_ftype *remote_register_number
+ = default_remote_register_number;
+ gdbarch_fetch_tls_load_module_address_ftype *fetch_tls_load_module_address
+ = nullptr;
gdbarch_get_thread_local_address_ftype *get_thread_local_address = nullptr;
CORE_ADDR frame_args_skip = 0;
gdbarch_unwind_pc_ftype *unwind_pc = default_unwind_pc;
gdbarch_unwind_sp_ftype *unwind_sp = default_unwind_sp;
gdbarch_frame_num_args_ftype *frame_num_args = nullptr;
gdbarch_frame_align_ftype *frame_align = nullptr;
- gdbarch_stabs_argument_has_addr_ftype *stabs_argument_has_addr = default_stabs_argument_has_addr;
+ gdbarch_stabs_argument_has_addr_ftype *stabs_argument_has_addr
+ = default_stabs_argument_has_addr;
int frame_red_zone_size = 0;
- gdbarch_convert_from_func_ptr_addr_ftype *convert_from_func_ptr_addr = convert_from_func_ptr_addr_identity;
+ gdbarch_convert_from_func_ptr_addr_ftype *convert_from_func_ptr_addr
+ = convert_from_func_ptr_addr_identity;
gdbarch_addr_bits_remove_ftype *addr_bits_remove = core_addr_identity;
- gdbarch_remove_non_address_bits_ftype *remove_non_address_bits = default_remove_non_address_bits;
+ gdbarch_remove_non_address_bits_ftype *remove_non_address_bits
+ = default_remove_non_address_bits;
gdbarch_memtag_to_string_ftype *memtag_to_string = default_memtag_to_string;
gdbarch_tagged_address_p_ftype *tagged_address_p = default_tagged_address_p;
gdbarch_memtag_matches_p_ftype *memtag_matches_p = default_memtag_matches_p;
@@ -150,48 +177,72 @@ struct gdbarch
gdbarch_software_single_step_ftype *software_single_step = nullptr;
gdbarch_single_step_through_delay_ftype *single_step_through_delay = nullptr;
gdbarch_print_insn_ftype *print_insn = default_print_insn;
- gdbarch_skip_trampoline_code_ftype *skip_trampoline_code = generic_skip_trampoline_code;
- const struct target_so_ops * so_ops = 0;
- gdbarch_skip_solib_resolver_ftype *skip_solib_resolver = generic_skip_solib_resolver;
- gdbarch_in_solib_return_trampoline_ftype *in_solib_return_trampoline = generic_in_solib_return_trampoline;
- gdbarch_in_indirect_branch_thunk_ftype *in_indirect_branch_thunk = default_in_indirect_branch_thunk;
- gdbarch_stack_frame_destroyed_p_ftype *stack_frame_destroyed_p = generic_stack_frame_destroyed_p;
+ gdbarch_skip_trampoline_code_ftype *skip_trampoline_code
+ = generic_skip_trampoline_code;
+ const struct target_so_ops *so_ops = 0;
+ gdbarch_skip_solib_resolver_ftype *skip_solib_resolver
+ = generic_skip_solib_resolver;
+ gdbarch_in_solib_return_trampoline_ftype *in_solib_return_trampoline
+ = generic_in_solib_return_trampoline;
+ gdbarch_in_indirect_branch_thunk_ftype *in_indirect_branch_thunk
+ = default_in_indirect_branch_thunk;
+ gdbarch_stack_frame_destroyed_p_ftype *stack_frame_destroyed_p
+ = generic_stack_frame_destroyed_p;
gdbarch_elf_make_msymbol_special_ftype *elf_make_msymbol_special = nullptr;
- gdbarch_coff_make_msymbol_special_ftype *coff_make_msymbol_special = default_coff_make_msymbol_special;
- gdbarch_make_symbol_special_ftype *make_symbol_special = default_make_symbol_special;
- gdbarch_adjust_dwarf2_addr_ftype *adjust_dwarf2_addr = default_adjust_dwarf2_addr;
- gdbarch_adjust_dwarf2_line_ftype *adjust_dwarf2_line = default_adjust_dwarf2_line;
+ gdbarch_coff_make_msymbol_special_ftype *coff_make_msymbol_special
+ = default_coff_make_msymbol_special;
+ gdbarch_make_symbol_special_ftype *make_symbol_special
+ = default_make_symbol_special;
+ gdbarch_adjust_dwarf2_addr_ftype *adjust_dwarf2_addr
+ = default_adjust_dwarf2_addr;
+ gdbarch_adjust_dwarf2_line_ftype *adjust_dwarf2_line
+ = default_adjust_dwarf2_line;
int cannot_step_breakpoint = 0;
int have_nonsteppable_watchpoint = 0;
gdbarch_address_class_type_flags_ftype *address_class_type_flags = nullptr;
- gdbarch_address_class_type_flags_to_name_ftype *address_class_type_flags_to_name = nullptr;
- gdbarch_execute_dwarf_cfa_vendor_op_ftype *execute_dwarf_cfa_vendor_op = default_execute_dwarf_cfa_vendor_op;
- gdbarch_address_class_name_to_type_flags_ftype *address_class_name_to_type_flags = nullptr;
- gdbarch_register_reggroup_p_ftype *register_reggroup_p = default_register_reggroup_p;
+ gdbarch_address_class_type_flags_to_name_ftype
+ *address_class_type_flags_to_name
+ = nullptr;
+ gdbarch_execute_dwarf_cfa_vendor_op_ftype *execute_dwarf_cfa_vendor_op
+ = default_execute_dwarf_cfa_vendor_op;
+ gdbarch_address_class_name_to_type_flags_ftype
+ *address_class_name_to_type_flags
+ = nullptr;
+ gdbarch_register_reggroup_p_ftype *register_reggroup_p
+ = default_register_reggroup_p;
gdbarch_fetch_pointer_argument_ftype *fetch_pointer_argument = nullptr;
- gdbarch_iterate_over_regset_sections_ftype *iterate_over_regset_sections = nullptr;
+ gdbarch_iterate_over_regset_sections_ftype *iterate_over_regset_sections
+ = nullptr;
gdbarch_make_corefile_notes_ftype *make_corefile_notes = nullptr;
gdbarch_find_memory_regions_ftype *find_memory_regions = nullptr;
gdbarch_create_memtag_section_ftype *create_memtag_section = nullptr;
gdbarch_fill_memtag_section_ftype *fill_memtag_section = nullptr;
gdbarch_decode_memtag_section_ftype *decode_memtag_section = nullptr;
- gdbarch_core_xfer_shared_libraries_ftype *core_xfer_shared_libraries = nullptr;
- gdbarch_core_xfer_shared_libraries_aix_ftype *core_xfer_shared_libraries_aix = nullptr;
+ gdbarch_core_xfer_shared_libraries_ftype *core_xfer_shared_libraries
+ = nullptr;
+ gdbarch_core_xfer_shared_libraries_aix_ftype *core_xfer_shared_libraries_aix
+ = nullptr;
gdbarch_core_pid_to_str_ftype *core_pid_to_str = nullptr;
gdbarch_core_thread_name_ftype *core_thread_name = nullptr;
gdbarch_core_xfer_siginfo_ftype *core_xfer_siginfo = nullptr;
- const char * gcore_bfd_target = 0;
+ const char *gcore_bfd_target = 0;
int vtable_function_descriptors = 0;
int vbit_in_delta = 0;
- gdbarch_skip_permanent_breakpoint_ftype *skip_permanent_breakpoint = default_skip_permanent_breakpoint;
+ gdbarch_skip_permanent_breakpoint_ftype *skip_permanent_breakpoint
+ = default_skip_permanent_breakpoint;
ULONGEST max_insn_length = 0;
gdbarch_displaced_step_copy_insn_ftype *displaced_step_copy_insn = nullptr;
- gdbarch_displaced_step_hw_singlestep_ftype *displaced_step_hw_singlestep = default_displaced_step_hw_singlestep;
+ gdbarch_displaced_step_hw_singlestep_ftype *displaced_step_hw_singlestep
+ = default_displaced_step_hw_singlestep;
gdbarch_displaced_step_fixup_ftype *displaced_step_fixup = NULL;
gdbarch_displaced_step_prepare_ftype *displaced_step_prepare = nullptr;
gdbarch_displaced_step_finish_ftype *displaced_step_finish = NULL;
- gdbarch_displaced_step_copy_insn_closure_by_addr_ftype *displaced_step_copy_insn_closure_by_addr = nullptr;
- gdbarch_displaced_step_restore_all_in_ptid_ftype *displaced_step_restore_all_in_ptid = nullptr;
+ gdbarch_displaced_step_copy_insn_closure_by_addr_ftype
+ *displaced_step_copy_insn_closure_by_addr
+ = nullptr;
+ gdbarch_displaced_step_restore_all_in_ptid_ftype
+ *displaced_step_restore_all_in_ptid
+ = nullptr;
gdbarch_relocate_instruction_ftype *relocate_instruction = NULL;
gdbarch_overlay_update_ftype *overlay_update = nullptr;
gdbarch_core_read_description_ftype *core_read_description = nullptr;
@@ -203,63 +254,76 @@ struct gdbarch
gdbarch_get_siginfo_type_ftype *get_siginfo_type = nullptr;
gdbarch_record_special_symbol_ftype *record_special_symbol = nullptr;
gdbarch_get_syscall_number_ftype *get_syscall_number = nullptr;
- const char * xml_syscall_file = 0;
- struct syscalls_info * syscalls_info = 0;
- const char *const * stap_integer_prefixes = 0;
- const char *const * stap_integer_suffixes = 0;
- const char *const * stap_register_prefixes = 0;
- const char *const * stap_register_suffixes = 0;
- const char *const * stap_register_indirection_prefixes = 0;
- const char *const * stap_register_indirection_suffixes = 0;
- const char * stap_gdb_register_prefix = 0;
- const char * stap_gdb_register_suffix = 0;
+ const char *xml_syscall_file = 0;
+ struct syscalls_info *syscalls_info = 0;
+ const char *const *stap_integer_prefixes = 0;
+ const char *const *stap_integer_suffixes = 0;
+ const char *const *stap_register_prefixes = 0;
+ const char *const *stap_register_suffixes = 0;
+ const char *const *stap_register_indirection_prefixes = 0;
+ const char *const *stap_register_indirection_suffixes = 0;
+ const char *stap_gdb_register_prefix = 0;
+ const char *stap_gdb_register_suffix = 0;
gdbarch_stap_is_single_operand_ftype *stap_is_single_operand = nullptr;
gdbarch_stap_parse_special_token_ftype *stap_parse_special_token = nullptr;
gdbarch_stap_adjust_register_ftype *stap_adjust_register = nullptr;
- gdbarch_dtrace_parse_probe_argument_ftype *dtrace_parse_probe_argument = nullptr;
+ gdbarch_dtrace_parse_probe_argument_ftype *dtrace_parse_probe_argument
+ = nullptr;
gdbarch_dtrace_probe_is_enabled_ftype *dtrace_probe_is_enabled = nullptr;
gdbarch_dtrace_enable_probe_ftype *dtrace_enable_probe = nullptr;
gdbarch_dtrace_disable_probe_ftype *dtrace_disable_probe = nullptr;
int has_global_solist = 0;
int has_global_breakpoints = 0;
- gdbarch_has_shared_address_space_ftype *has_shared_address_space = default_has_shared_address_space;
- gdbarch_fast_tracepoint_valid_at_ftype *fast_tracepoint_valid_at = default_fast_tracepoint_valid_at;
- gdbarch_guess_tracepoint_registers_ftype *guess_tracepoint_registers = default_guess_tracepoint_registers;
+ gdbarch_has_shared_address_space_ftype *has_shared_address_space
+ = default_has_shared_address_space;
+ gdbarch_fast_tracepoint_valid_at_ftype *fast_tracepoint_valid_at
+ = default_fast_tracepoint_valid_at;
+ gdbarch_guess_tracepoint_registers_ftype *guess_tracepoint_registers
+ = default_guess_tracepoint_registers;
gdbarch_auto_charset_ftype *auto_charset = default_auto_charset;
- gdbarch_auto_wide_charset_ftype *auto_wide_charset = default_auto_wide_charset;
- const char * solib_symbols_extension = 0;
+ gdbarch_auto_wide_charset_ftype *auto_wide_charset
+ = default_auto_wide_charset;
+ const char *solib_symbols_extension = 0;
int has_dos_based_file_system = 0;
- gdbarch_gen_return_address_ftype *gen_return_address = default_gen_return_address;
+ gdbarch_gen_return_address_ftype *gen_return_address
+ = default_gen_return_address;
gdbarch_info_proc_ftype *info_proc = nullptr;
gdbarch_core_info_proc_ftype *core_info_proc = nullptr;
- gdbarch_iterate_over_objfiles_in_search_order_ftype *iterate_over_objfiles_in_search_order = default_iterate_over_objfiles_in_search_order;
- struct ravenscar_arch_ops * ravenscar_ops = NULL;
+ gdbarch_iterate_over_objfiles_in_search_order_ftype
+ *iterate_over_objfiles_in_search_order
+ = default_iterate_over_objfiles_in_search_order;
+ struct ravenscar_arch_ops *ravenscar_ops = NULL;
gdbarch_insn_is_call_ftype *insn_is_call = default_insn_is_call;
gdbarch_insn_is_ret_ftype *insn_is_ret = default_insn_is_ret;
gdbarch_insn_is_jump_ftype *insn_is_jump = default_insn_is_jump;
- gdbarch_program_breakpoint_here_p_ftype *program_breakpoint_here_p = default_program_breakpoint_here_p;
+ gdbarch_program_breakpoint_here_p_ftype *program_breakpoint_here_p
+ = default_program_breakpoint_here_p;
gdbarch_auxv_parse_ftype *auxv_parse = nullptr;
gdbarch_print_auxv_entry_ftype *print_auxv_entry = default_print_auxv_entry;
gdbarch_vsyscall_range_ftype *vsyscall_range = default_vsyscall_range;
gdbarch_infcall_mmap_ftype *infcall_mmap = default_infcall_mmap;
gdbarch_infcall_munmap_ftype *infcall_munmap = default_infcall_munmap;
- gdbarch_gcc_target_options_ftype *gcc_target_options = default_gcc_target_options;
- gdbarch_gnu_triplet_regexp_ftype *gnu_triplet_regexp = default_gnu_triplet_regexp;
- gdbarch_addressable_memory_unit_size_ftype *addressable_memory_unit_size = default_addressable_memory_unit_size;
- const char * disassembler_options_implicit = 0;
- char ** disassembler_options = 0;
- const disasm_options_and_args_t * valid_disassembler_options = 0;
+ gdbarch_gcc_target_options_ftype *gcc_target_options
+ = default_gcc_target_options;
+ gdbarch_gnu_triplet_regexp_ftype *gnu_triplet_regexp
+ = default_gnu_triplet_regexp;
+ gdbarch_addressable_memory_unit_size_ftype *addressable_memory_unit_size
+ = default_addressable_memory_unit_size;
+ const char *disassembler_options_implicit = 0;
+ char **disassembler_options = 0;
+ const disasm_options_and_args_t *valid_disassembler_options = 0;
gdbarch_type_align_ftype *type_align = default_type_align;
- gdbarch_get_pc_address_flags_ftype *get_pc_address_flags = default_get_pc_address_flags;
- gdbarch_read_core_file_mappings_ftype *read_core_file_mappings = default_read_core_file_mappings;
+ gdbarch_get_pc_address_flags_ftype *get_pc_address_flags
+ = default_get_pc_address_flags;
+ gdbarch_read_core_file_mappings_ftype *read_core_file_mappings
+ = default_read_core_file_mappings;
};
/* Create a new ``struct gdbarch'' based on information provided by
``struct gdbarch_info''. */
struct gdbarch *
-gdbarch_alloc (const struct gdbarch_info *info,
- gdbarch_tdep_up tdep)
+gdbarch_alloc (const struct gdbarch_info *info, gdbarch_tdep_up tdep)
{
struct gdbarch *gdbarch;
@@ -276,8 +340,6 @@ gdbarch_alloc (const struct gdbarch_info *info,
return gdbarch;
}
-
-
/* Ensure that all values in a GDBARCH are reasonable. */
static void
@@ -367,7 +429,8 @@ verify_gdbarch (struct gdbarch *gdbarch)
/* Skip verify of address_to_pointer, invalid_p == 0 */
/* Skip verify of integer_to_address, has predicate. */
/* Skip verify of return_value, invalid_p == 0 */
- if ((gdbarch->return_value_as_value == default_gdbarch_return_value) == (gdbarch->return_value == nullptr))
+ if ((gdbarch->return_value_as_value == default_gdbarch_return_value)
+ == (gdbarch->return_value == nullptr))
log.puts ("\n\treturn_value_as_value");
/* Skip verify of get_return_buf_addr, invalid_p == 0 */
/* Skip verify of return_in_first_hidden_param_p, invalid_p == 0 */
@@ -449,7 +512,7 @@ verify_gdbarch (struct gdbarch *gdbarch)
/* Skip verify of displaced_step_hw_singlestep, invalid_p == 0 */
/* Skip verify of displaced_step_fixup, has predicate. */
/* Skip verify of displaced_step_prepare, has predicate. */
- if ((! gdbarch->displaced_step_finish) != (! gdbarch->displaced_step_prepare))
+ if ((!gdbarch->displaced_step_finish) != (!gdbarch->displaced_step_prepare))
log.puts ("\n\tdisplaced_step_finish");
/* Skip verify of displaced_step_copy_insn_closure_by_addr, has predicate. */
/* Skip verify of displaced_step_restore_all_in_ptid, invalid_p == 0 */
@@ -514,11 +577,10 @@ verify_gdbarch (struct gdbarch *gdbarch)
/* Skip verify of get_pc_address_flags, invalid_p == 0 */
/* Skip verify of read_core_file_mappings, invalid_p == 0 */
if (!log.empty ())
- internal_error (_("verify_gdbarch: the following are invalid ...%s"),
+ internal_error (_ ("verify_gdbarch: the following are invalid ...%s"),
log.c_str ());
}
-
/* Print out the details of the current architecture. */
void
@@ -526,836 +588,588 @@ gdbarch_dump (struct gdbarch *gdbarch, struct ui_file *file)
{
const char *gdb_nm_file = "<not-defined>";
-#if defined (GDB_NM_FILE)
+#if defined(GDB_NM_FILE)
gdb_nm_file = GDB_NM_FILE;
#endif
- gdb_printf (file,
- "gdbarch_dump: GDB_NM_FILE = %s\n",
- gdb_nm_file);
- gdb_printf (file,
- "gdbarch_dump: bfd_arch_info = %s\n",
+ gdb_printf (file, "gdbarch_dump: GDB_NM_FILE = %s\n", gdb_nm_file);
+ gdb_printf (file, "gdbarch_dump: bfd_arch_info = %s\n",
gdbarch_bfd_arch_info (gdbarch)->printable_name);
- gdb_printf (file,
- "gdbarch_dump: byte_order = %s\n",
+ gdb_printf (file, "gdbarch_dump: byte_order = %s\n",
plongest (gdbarch->byte_order));
- gdb_printf (file,
- "gdbarch_dump: byte_order_for_code = %s\n",
+ gdb_printf (file, "gdbarch_dump: byte_order_for_code = %s\n",
plongest (gdbarch->byte_order_for_code));
- gdb_printf (file,
- "gdbarch_dump: osabi = %s\n",
- plongest (gdbarch->osabi));
- gdb_printf (file,
- "gdbarch_dump: target_desc = %s\n",
+ gdb_printf (file, "gdbarch_dump: osabi = %s\n", plongest (gdbarch->osabi));
+ gdb_printf (file, "gdbarch_dump: target_desc = %s\n",
host_address_to_string (gdbarch->target_desc));
- gdb_printf (file,
- "gdbarch_dump: short_bit = %s\n",
+ gdb_printf (file, "gdbarch_dump: short_bit = %s\n",
plongest (gdbarch->short_bit));
- gdb_printf (file,
- "gdbarch_dump: int_bit = %s\n",
+ gdb_printf (file, "gdbarch_dump: int_bit = %s\n",
plongest (gdbarch->int_bit));
- gdb_printf (file,
- "gdbarch_dump: long_bit = %s\n",
+ gdb_printf (file, "gdbarch_dump: long_bit = %s\n",
plongest (gdbarch->long_bit));
- gdb_printf (file,
- "gdbarch_dump: long_long_bit = %s\n",
+ gdb_printf (file, "gdbarch_dump: long_long_bit = %s\n",
plongest (gdbarch->long_long_bit));
- gdb_printf (file,
- "gdbarch_dump: bfloat16_bit = %s\n",
+ gdb_printf (file, "gdbarch_dump: bfloat16_bit = %s\n",
plongest (gdbarch->bfloat16_bit));
- gdb_printf (file,
- "gdbarch_dump: bfloat16_format = %s\n",
+ gdb_printf (file, "gdbarch_dump: bfloat16_format = %s\n",
pformat (gdbarch, gdbarch->bfloat16_format));
- gdb_printf (file,
- "gdbarch_dump: half_bit = %s\n",
+ gdb_printf (file, "gdbarch_dump: half_bit = %s\n",
plongest (gdbarch->half_bit));
- gdb_printf (file,
- "gdbarch_dump: half_format = %s\n",
+ gdb_printf (file, "gdbarch_dump: half_format = %s\n",
pformat (gdbarch, gdbarch->half_format));
- gdb_printf (file,
- "gdbarch_dump: float_bit = %s\n",
+ gdb_printf (file, "gdbarch_dump: float_bit = %s\n",
plongest (gdbarch->float_bit));
- gdb_printf (file,
- "gdbarch_dump: float_format = %s\n",
+ gdb_printf (file, "gdbarch_dump: float_format = %s\n",
pformat (gdbarch, gdbarch->float_format));
- gdb_printf (file,
- "gdbarch_dump: double_bit = %s\n",
+ gdb_printf (file, "gdbarch_dump: double_bit = %s\n",
plongest (gdbarch->double_bit));
- gdb_printf (file,
- "gdbarch_dump: double_format = %s\n",
+ gdb_printf (file, "gdbarch_dump: double_format = %s\n",
pformat (gdbarch, gdbarch->double_format));
- gdb_printf (file,
- "gdbarch_dump: long_double_bit = %s\n",
+ gdb_printf (file, "gdbarch_dump: long_double_bit = %s\n",
plongest (gdbarch->long_double_bit));
- gdb_printf (file,
- "gdbarch_dump: long_double_format = %s\n",
+ gdb_printf (file, "gdbarch_dump: long_double_format = %s\n",
pformat (gdbarch, gdbarch->long_double_format));
- gdb_printf (file,
- "gdbarch_dump: wchar_bit = %s\n",
+ gdb_printf (file, "gdbarch_dump: wchar_bit = %s\n",
plongest (gdbarch->wchar_bit));
- gdb_printf (file,
- "gdbarch_dump: wchar_signed = %s\n",
+ gdb_printf (file, "gdbarch_dump: wchar_signed = %s\n",
plongest (gdbarch->wchar_signed));
- gdb_printf (file,
- "gdbarch_dump: floatformat_for_type = <%s>\n",
+ gdb_printf (file, "gdbarch_dump: floatformat_for_type = <%s>\n",
host_address_to_string (gdbarch->floatformat_for_type));
- gdb_printf (file,
- "gdbarch_dump: ptr_bit = %s\n",
+ gdb_printf (file, "gdbarch_dump: ptr_bit = %s\n",
plongest (gdbarch->ptr_bit));
- gdb_printf (file,
- "gdbarch_dump: addr_bit = %s\n",
+ gdb_printf (file, "gdbarch_dump: addr_bit = %s\n",
plongest (gdbarch->addr_bit));
- gdb_printf (file,
- "gdbarch_dump: dwarf2_addr_size = %s\n",
+ gdb_printf (file, "gdbarch_dump: dwarf2_addr_size = %s\n",
plongest (gdbarch->dwarf2_addr_size));
- gdb_printf (file,
- "gdbarch_dump: char_signed = %s\n",
+ gdb_printf (file, "gdbarch_dump: char_signed = %s\n",
plongest (gdbarch->char_signed));
- gdb_printf (file,
- "gdbarch_dump: gdbarch_read_pc_p() = %d\n",
+ gdb_printf (file, "gdbarch_dump: gdbarch_read_pc_p() = %d\n",
gdbarch_read_pc_p (gdbarch));
- gdb_printf (file,
- "gdbarch_dump: read_pc = <%s>\n",
+ gdb_printf (file, "gdbarch_dump: read_pc = <%s>\n",
host_address_to_string (gdbarch->read_pc));
- gdb_printf (file,
- "gdbarch_dump: gdbarch_write_pc_p() = %d\n",
+ gdb_printf (file, "gdbarch_dump: gdbarch_write_pc_p() = %d\n",
gdbarch_write_pc_p (gdbarch));
- gdb_printf (file,
- "gdbarch_dump: write_pc = <%s>\n",
+ gdb_printf (file, "gdbarch_dump: write_pc = <%s>\n",
host_address_to_string (gdbarch->write_pc));
- gdb_printf (file,
- "gdbarch_dump: virtual_frame_pointer = <%s>\n",
+ gdb_printf (file, "gdbarch_dump: virtual_frame_pointer = <%s>\n",
host_address_to_string (gdbarch->virtual_frame_pointer));
- gdb_printf (file,
- "gdbarch_dump: gdbarch_pseudo_register_read_p() = %d\n",
+ gdb_printf (file, "gdbarch_dump: gdbarch_pseudo_register_read_p() = %d\n",
gdbarch_pseudo_register_read_p (gdbarch));
- gdb_printf (file,
- "gdbarch_dump: pseudo_register_read = <%s>\n",
+ gdb_printf (file, "gdbarch_dump: pseudo_register_read = <%s>\n",
host_address_to_string (gdbarch->pseudo_register_read));
gdb_printf (file,
"gdbarch_dump: gdbarch_pseudo_register_read_value_p() = %d\n",
gdbarch_pseudo_register_read_value_p (gdbarch));
- gdb_printf (file,
- "gdbarch_dump: pseudo_register_read_value = <%s>\n",
+ gdb_printf (file, "gdbarch_dump: pseudo_register_read_value = <%s>\n",
host_address_to_string (gdbarch->pseudo_register_read_value));
- gdb_printf (file,
- "gdbarch_dump: gdbarch_pseudo_register_write_p() = %d\n",
+ gdb_printf (file, "gdbarch_dump: gdbarch_pseudo_register_write_p() = %d\n",
gdbarch_pseudo_register_write_p (gdbarch));
- gdb_printf (file,
- "gdbarch_dump: pseudo_register_write = <%s>\n",
+ gdb_printf (file, "gdbarch_dump: pseudo_register_write = <%s>\n",
host_address_to_string (gdbarch->pseudo_register_write));
- gdb_printf (file,
- "gdbarch_dump: num_regs = %s\n",
+ gdb_printf (file, "gdbarch_dump: num_regs = %s\n",
plongest (gdbarch->num_regs));
- gdb_printf (file,
- "gdbarch_dump: num_pseudo_regs = %s\n",
+ gdb_printf (file, "gdbarch_dump: num_pseudo_regs = %s\n",
plongest (gdbarch->num_pseudo_regs));
gdb_printf (file,
"gdbarch_dump: gdbarch_ax_pseudo_register_collect_p() = %d\n",
gdbarch_ax_pseudo_register_collect_p (gdbarch));
- gdb_printf (file,
- "gdbarch_dump: ax_pseudo_register_collect = <%s>\n",
+ gdb_printf (file, "gdbarch_dump: ax_pseudo_register_collect = <%s>\n",
host_address_to_string (gdbarch->ax_pseudo_register_collect));
gdb_printf (file,
"gdbarch_dump: gdbarch_ax_pseudo_register_push_stack_p() = %d\n",
gdbarch_ax_pseudo_register_push_stack_p (gdbarch));
- gdb_printf (file,
- "gdbarch_dump: ax_pseudo_register_push_stack = <%s>\n",
+ gdb_printf (file, "gdbarch_dump: ax_pseudo_register_push_stack = <%s>\n",
host_address_to_string (gdbarch->ax_pseudo_register_push_stack));
- gdb_printf (file,
- "gdbarch_dump: gdbarch_report_signal_info_p() = %d\n",
+ gdb_printf (file, "gdbarch_dump: gdbarch_report_signal_info_p() = %d\n",
gdbarch_report_signal_info_p (gdbarch));
- gdb_printf (file,
- "gdbarch_dump: report_signal_info = <%s>\n",
+ gdb_printf (file, "gdbarch_dump: report_signal_info = <%s>\n",
host_address_to_string (gdbarch->report_signal_info));
- gdb_printf (file,
- "gdbarch_dump: sp_regnum = %s\n",
+ gdb_printf (file, "gdbarch_dump: sp_regnum = %s\n",
plongest (gdbarch->sp_regnum));
- gdb_printf (file,
- "gdbarch_dump: pc_regnum = %s\n",
+ gdb_printf (file, "gdbarch_dump: pc_regnum = %s\n",
plongest (gdbarch->pc_regnum));
- gdb_printf (file,
- "gdbarch_dump: ps_regnum = %s\n",
+ gdb_printf (file, "gdbarch_dump: ps_regnum = %s\n",
plongest (gdbarch->ps_regnum));
- gdb_printf (file,
- "gdbarch_dump: fp0_regnum = %s\n",
+ gdb_printf (file, "gdbarch_dump: fp0_regnum = %s\n",
plongest (gdbarch->fp0_regnum));
- gdb_printf (file,
- "gdbarch_dump: stab_reg_to_regnum = <%s>\n",
+ gdb_printf (file, "gdbarch_dump: stab_reg_to_regnum = <%s>\n",
host_address_to_string (gdbarch->stab_reg_to_regnum));
- gdb_printf (file,
- "gdbarch_dump: ecoff_reg_to_regnum = <%s>\n",
+ gdb_printf (file, "gdbarch_dump: ecoff_reg_to_regnum = <%s>\n",
host_address_to_string (gdbarch->ecoff_reg_to_regnum));
- gdb_printf (file,
- "gdbarch_dump: sdb_reg_to_regnum = <%s>\n",
+ gdb_printf (file, "gdbarch_dump: sdb_reg_to_regnum = <%s>\n",
host_address_to_string (gdbarch->sdb_reg_to_regnum));
- gdb_printf (file,
- "gdbarch_dump: dwarf2_reg_to_regnum = <%s>\n",
+ gdb_printf (file, "gdbarch_dump: dwarf2_reg_to_regnum = <%s>\n",
host_address_to_string (gdbarch->dwarf2_reg_to_regnum));
- gdb_printf (file,
- "gdbarch_dump: register_name = <%s>\n",
+ gdb_printf (file, "gdbarch_dump: register_name = <%s>\n",
host_address_to_string (gdbarch->register_name));
- gdb_printf (file,
- "gdbarch_dump: register_type = <%s>\n",
+ gdb_printf (file, "gdbarch_dump: register_type = <%s>\n",
host_address_to_string (gdbarch->register_type));
- gdb_printf (file,
- "gdbarch_dump: dummy_id = <%s>\n",
+ gdb_printf (file, "gdbarch_dump: dummy_id = <%s>\n",
host_address_to_string (gdbarch->dummy_id));
- gdb_printf (file,
- "gdbarch_dump: deprecated_fp_regnum = %s\n",
+ gdb_printf (file, "gdbarch_dump: deprecated_fp_regnum = %s\n",
plongest (gdbarch->deprecated_fp_regnum));
- gdb_printf (file,
- "gdbarch_dump: gdbarch_push_dummy_call_p() = %d\n",
+ gdb_printf (file, "gdbarch_dump: gdbarch_push_dummy_call_p() = %d\n",
gdbarch_push_dummy_call_p (gdbarch));
- gdb_printf (file,
- "gdbarch_dump: push_dummy_call = <%s>\n",
+ gdb_printf (file, "gdbarch_dump: push_dummy_call = <%s>\n",
host_address_to_string (gdbarch->push_dummy_call));
- gdb_printf (file,
- "gdbarch_dump: call_dummy_location = %s\n",
+ gdb_printf (file, "gdbarch_dump: call_dummy_location = %s\n",
plongest (gdbarch->call_dummy_location));
- gdb_printf (file,
- "gdbarch_dump: gdbarch_push_dummy_code_p() = %d\n",
+ gdb_printf (file, "gdbarch_dump: gdbarch_push_dummy_code_p() = %d\n",
gdbarch_push_dummy_code_p (gdbarch));
- gdb_printf (file,
- "gdbarch_dump: push_dummy_code = <%s>\n",
+ gdb_printf (file, "gdbarch_dump: push_dummy_code = <%s>\n",
host_address_to_string (gdbarch->push_dummy_code));
- gdb_printf (file,
- "gdbarch_dump: code_of_frame_writable = <%s>\n",
+ gdb_printf (file, "gdbarch_dump: code_of_frame_writable = <%s>\n",
host_address_to_string (gdbarch->code_of_frame_writable));
- gdb_printf (file,
- "gdbarch_dump: print_registers_info = <%s>\n",
+ gdb_printf (file, "gdbarch_dump: print_registers_info = <%s>\n",
host_address_to_string (gdbarch->print_registers_info));
- gdb_printf (file,
- "gdbarch_dump: print_float_info = <%s>\n",
+ gdb_printf (file, "gdbarch_dump: print_float_info = <%s>\n",
host_address_to_string (gdbarch->print_float_info));
- gdb_printf (file,
- "gdbarch_dump: gdbarch_print_vector_info_p() = %d\n",
+ gdb_printf (file, "gdbarch_dump: gdbarch_print_vector_info_p() = %d\n",
gdbarch_print_vector_info_p (gdbarch));
- gdb_printf (file,
- "gdbarch_dump: print_vector_info = <%s>\n",
+ gdb_printf (file, "gdbarch_dump: print_vector_info = <%s>\n",
host_address_to_string (gdbarch->print_vector_info));
- gdb_printf (file,
- "gdbarch_dump: register_sim_regno = <%s>\n",
+ gdb_printf (file, "gdbarch_dump: register_sim_regno = <%s>\n",
host_address_to_string (gdbarch->register_sim_regno));
- gdb_printf (file,
- "gdbarch_dump: cannot_fetch_register = <%s>\n",
+ gdb_printf (file, "gdbarch_dump: cannot_fetch_register = <%s>\n",
host_address_to_string (gdbarch->cannot_fetch_register));
- gdb_printf (file,
- "gdbarch_dump: cannot_store_register = <%s>\n",
+ gdb_printf (file, "gdbarch_dump: cannot_store_register = <%s>\n",
host_address_to_string (gdbarch->cannot_store_register));
- gdb_printf (file,
- "gdbarch_dump: gdbarch_get_longjmp_target_p() = %d\n",
+ gdb_printf (file, "gdbarch_dump: gdbarch_get_longjmp_target_p() = %d\n",
gdbarch_get_longjmp_target_p (gdbarch));
- gdb_printf (file,
- "gdbarch_dump: get_longjmp_target = <%s>\n",
+ gdb_printf (file, "gdbarch_dump: get_longjmp_target = <%s>\n",
host_address_to_string (gdbarch->get_longjmp_target));
- gdb_printf (file,
- "gdbarch_dump: believe_pcc_promotion = %s\n",
+ gdb_printf (file, "gdbarch_dump: believe_pcc_promotion = %s\n",
plongest (gdbarch->believe_pcc_promotion));
- gdb_printf (file,
- "gdbarch_dump: convert_register_p = <%s>\n",
+ gdb_printf (file, "gdbarch_dump: convert_register_p = <%s>\n",
host_address_to_string (gdbarch->convert_register_p));
- gdb_printf (file,
- "gdbarch_dump: register_to_value = <%s>\n",
+ gdb_printf (file, "gdbarch_dump: register_to_value = <%s>\n",
host_address_to_string (gdbarch->register_to_value));
- gdb_printf (file,
- "gdbarch_dump: value_to_register = <%s>\n",
+ gdb_printf (file, "gdbarch_dump: value_to_register = <%s>\n",
host_address_to_string (gdbarch->value_to_register));
- gdb_printf (file,
- "gdbarch_dump: value_from_register = <%s>\n",
+ gdb_printf (file, "gdbarch_dump: value_from_register = <%s>\n",
host_address_to_string (gdbarch->value_from_register));
- gdb_printf (file,
- "gdbarch_dump: pointer_to_address = <%s>\n",
+ gdb_printf (file, "gdbarch_dump: pointer_to_address = <%s>\n",
host_address_to_string (gdbarch->pointer_to_address));
- gdb_printf (file,
- "gdbarch_dump: address_to_pointer = <%s>\n",
+ gdb_printf (file, "gdbarch_dump: address_to_pointer = <%s>\n",
host_address_to_string (gdbarch->address_to_pointer));
- gdb_printf (file,
- "gdbarch_dump: gdbarch_integer_to_address_p() = %d\n",
+ gdb_printf (file, "gdbarch_dump: gdbarch_integer_to_address_p() = %d\n",
gdbarch_integer_to_address_p (gdbarch));
- gdb_printf (file,
- "gdbarch_dump: integer_to_address = <%s>\n",
+ gdb_printf (file, "gdbarch_dump: integer_to_address = <%s>\n",
host_address_to_string (gdbarch->integer_to_address));
- gdb_printf (file,
- "gdbarch_dump: return_value = <%s>\n",
+ gdb_printf (file, "gdbarch_dump: return_value = <%s>\n",
host_address_to_string (gdbarch->return_value));
- gdb_printf (file,
- "gdbarch_dump: return_value_as_value = <%s>\n",
+ gdb_printf (file, "gdbarch_dump: return_value_as_value = <%s>\n",
host_address_to_string (gdbarch->return_value_as_value));
- gdb_printf (file,
- "gdbarch_dump: get_return_buf_addr = <%s>\n",
+ gdb_printf (file, "gdbarch_dump: get_return_buf_addr = <%s>\n",
host_address_to_string (gdbarch->get_return_buf_addr));
- gdb_printf (file,
- "gdbarch_dump: return_in_first_hidden_param_p = <%s>\n",
- host_address_to_string (gdbarch->return_in_first_hidden_param_p));
- gdb_printf (file,
- "gdbarch_dump: skip_prologue = <%s>\n",
+ gdb_printf (
+ file, "gdbarch_dump: return_in_first_hidden_param_p = <%s>\n",
+ host_address_to_string (gdbarch->return_in_first_hidden_param_p));
+ gdb_printf (file, "gdbarch_dump: skip_prologue = <%s>\n",
host_address_to_string (gdbarch->skip_prologue));
- gdb_printf (file,
- "gdbarch_dump: gdbarch_skip_main_prologue_p() = %d\n",
+ gdb_printf (file, "gdbarch_dump: gdbarch_skip_main_prologue_p() = %d\n",
gdbarch_skip_main_prologue_p (gdbarch));
- gdb_printf (file,
- "gdbarch_dump: skip_main_prologue = <%s>\n",
+ gdb_printf (file, "gdbarch_dump: skip_main_prologue = <%s>\n",
host_address_to_string (gdbarch->skip_main_prologue));
- gdb_printf (file,
- "gdbarch_dump: gdbarch_skip_entrypoint_p() = %d\n",
+ gdb_printf (file, "gdbarch_dump: gdbarch_skip_entrypoint_p() = %d\n",
gdbarch_skip_entrypoint_p (gdbarch));
- gdb_printf (file,
- "gdbarch_dump: skip_entrypoint = <%s>\n",
+ gdb_printf (file, "gdbarch_dump: skip_entrypoint = <%s>\n",
host_address_to_string (gdbarch->skip_entrypoint));
- gdb_printf (file,
- "gdbarch_dump: inner_than = <%s>\n",
+ gdb_printf (file, "gdbarch_dump: inner_than = <%s>\n",
host_address_to_string (gdbarch->inner_than));
- gdb_printf (file,
- "gdbarch_dump: breakpoint_from_pc = <%s>\n",
+ gdb_printf (file, "gdbarch_dump: breakpoint_from_pc = <%s>\n",
host_address_to_string (gdbarch->breakpoint_from_pc));
- gdb_printf (file,
- "gdbarch_dump: breakpoint_kind_from_pc = <%s>\n",
+ gdb_printf (file, "gdbarch_dump: breakpoint_kind_from_pc = <%s>\n",
host_address_to_string (gdbarch->breakpoint_kind_from_pc));
- gdb_printf (file,
- "gdbarch_dump: sw_breakpoint_from_kind = <%s>\n",
+ gdb_printf (file, "gdbarch_dump: sw_breakpoint_from_kind = <%s>\n",
host_address_to_string (gdbarch->sw_breakpoint_from_kind));
- gdb_printf (file,
- "gdbarch_dump: breakpoint_kind_from_current_state = <%s>\n",
- host_address_to_string (gdbarch->breakpoint_kind_from_current_state));
+ gdb_printf (
+ file, "gdbarch_dump: breakpoint_kind_from_current_state = <%s>\n",
+ host_address_to_string (gdbarch->breakpoint_kind_from_current_state));
gdb_printf (file,
"gdbarch_dump: gdbarch_adjust_breakpoint_address_p() = %d\n",
gdbarch_adjust_breakpoint_address_p (gdbarch));
- gdb_printf (file,
- "gdbarch_dump: adjust_breakpoint_address = <%s>\n",
+ gdb_printf (file, "gdbarch_dump: adjust_breakpoint_address = <%s>\n",
host_address_to_string (gdbarch->adjust_breakpoint_address));
- gdb_printf (file,
- "gdbarch_dump: memory_insert_breakpoint = <%s>\n",
+ gdb_printf (file, "gdbarch_dump: memory_insert_breakpoint = <%s>\n",
host_address_to_string (gdbarch->memory_insert_breakpoint));
- gdb_printf (file,
- "gdbarch_dump: memory_remove_breakpoint = <%s>\n",
+ gdb_printf (file, "gdbarch_dump: memory_remove_breakpoint = <%s>\n",
host_address_to_string (gdbarch->memory_remove_breakpoint));
- gdb_printf (file,
- "gdbarch_dump: decr_pc_after_break = %s\n",
+ gdb_printf (file, "gdbarch_dump: decr_pc_after_break = %s\n",
core_addr_to_string_nz (gdbarch->decr_pc_after_break));
- gdb_printf (file,
- "gdbarch_dump: deprecated_function_start_offset = %s\n",
- core_addr_to_string_nz (gdbarch->deprecated_function_start_offset));
- gdb_printf (file,
- "gdbarch_dump: remote_register_number = <%s>\n",
+ gdb_printf (
+ file, "gdbarch_dump: deprecated_function_start_offset = %s\n",
+ core_addr_to_string_nz (gdbarch->deprecated_function_start_offset));
+ gdb_printf (file, "gdbarch_dump: remote_register_number = <%s>\n",
host_address_to_string (gdbarch->remote_register_number));
gdb_printf (file,
"gdbarch_dump: gdbarch_fetch_tls_load_module_address_p() = %d\n",
gdbarch_fetch_tls_load_module_address_p (gdbarch));
- gdb_printf (file,
- "gdbarch_dump: fetch_tls_load_module_address = <%s>\n",
+ gdb_printf (file, "gdbarch_dump: fetch_tls_load_module_address = <%s>\n",
host_address_to_string (gdbarch->fetch_tls_load_module_address));
gdb_printf (file,
"gdbarch_dump: gdbarch_get_thread_local_address_p() = %d\n",
gdbarch_get_thread_local_address_p (gdbarch));
- gdb_printf (file,
- "gdbarch_dump: get_thread_local_address = <%s>\n",
+ gdb_printf (file, "gdbarch_dump: get_thread_local_address = <%s>\n",
host_address_to_string (gdbarch->get_thread_local_address));
- gdb_printf (file,
- "gdbarch_dump: frame_args_skip = %s\n",
+ gdb_printf (file, "gdbarch_dump: frame_args_skip = %s\n",
core_addr_to_string_nz (gdbarch->frame_args_skip));
- gdb_printf (file,
- "gdbarch_dump: unwind_pc = <%s>\n",
+ gdb_printf (file, "gdbarch_dump: unwind_pc = <%s>\n",
host_address_to_string (gdbarch->unwind_pc));
- gdb_printf (file,
- "gdbarch_dump: unwind_sp = <%s>\n",
+ gdb_printf (file, "gdbarch_dump: unwind_sp = <%s>\n",
host_address_to_string (gdbarch->unwind_sp));
- gdb_printf (file,
- "gdbarch_dump: gdbarch_frame_num_args_p() = %d\n",
+ gdb_printf (file, "gdbarch_dump: gdbarch_frame_num_args_p() = %d\n",
gdbarch_frame_num_args_p (gdbarch));
- gdb_printf (file,
- "gdbarch_dump: frame_num_args = <%s>\n",
+ gdb_printf (file, "gdbarch_dump: frame_num_args = <%s>\n",
host_address_to_string (gdbarch->frame_num_args));
- gdb_printf (file,
- "gdbarch_dump: gdbarch_frame_align_p() = %d\n",
+ gdb_printf (file, "gdbarch_dump: gdbarch_frame_align_p() = %d\n",
gdbarch_frame_align_p (gdbarch));
- gdb_printf (file,
- "gdbarch_dump: frame_align = <%s>\n",
+ gdb_printf (file, "gdbarch_dump: frame_align = <%s>\n",
host_address_to_string (gdbarch->frame_align));
- gdb_printf (file,
- "gdbarch_dump: stabs_argument_has_addr = <%s>\n",
+ gdb_printf (file, "gdbarch_dump: stabs_argument_has_addr = <%s>\n",
host_address_to_string (gdbarch->stabs_argument_has_addr));
- gdb_printf (file,
- "gdbarch_dump: frame_red_zone_size = %s\n",
+ gdb_printf (file, "gdbarch_dump: frame_red_zone_size = %s\n",
plongest (gdbarch->frame_red_zone_size));
- gdb_printf (file,
- "gdbarch_dump: convert_from_func_ptr_addr = <%s>\n",
+ gdb_printf (file, "gdbarch_dump: convert_from_func_ptr_addr = <%s>\n",
host_address_to_string (gdbarch->convert_from_func_ptr_addr));
- gdb_printf (file,
- "gdbarch_dump: addr_bits_remove = <%s>\n",
+ gdb_printf (file, "gdbarch_dump: addr_bits_remove = <%s>\n",
host_address_to_string (gdbarch->addr_bits_remove));
- gdb_printf (file,
- "gdbarch_dump: remove_non_address_bits = <%s>\n",
+ gdb_printf (file, "gdbarch_dump: remove_non_address_bits = <%s>\n",
host_address_to_string (gdbarch->remove_non_address_bits));
- gdb_printf (file,
- "gdbarch_dump: memtag_to_string = <%s>\n",
+ gdb_printf (file, "gdbarch_dump: memtag_to_string = <%s>\n",
host_address_to_string (gdbarch->memtag_to_string));
- gdb_printf (file,
- "gdbarch_dump: tagged_address_p = <%s>\n",
+ gdb_printf (file, "gdbarch_dump: tagged_address_p = <%s>\n",
host_address_to_string (gdbarch->tagged_address_p));
- gdb_printf (file,
- "gdbarch_dump: memtag_matches_p = <%s>\n",
+ gdb_printf (file, "gdbarch_dump: memtag_matches_p = <%s>\n",
host_address_to_string (gdbarch->memtag_matches_p));
- gdb_printf (file,
- "gdbarch_dump: set_memtags = <%s>\n",
+ gdb_printf (file, "gdbarch_dump: set_memtags = <%s>\n",
host_address_to_string (gdbarch->set_memtags));
- gdb_printf (file,
- "gdbarch_dump: get_memtag = <%s>\n",
+ gdb_printf (file, "gdbarch_dump: get_memtag = <%s>\n",
host_address_to_string (gdbarch->get_memtag));
- gdb_printf (file,
- "gdbarch_dump: memtag_granule_size = %s\n",
+ gdb_printf (file, "gdbarch_dump: memtag_granule_size = %s\n",
core_addr_to_string_nz (gdbarch->memtag_granule_size));
- gdb_printf (file,
- "gdbarch_dump: gdbarch_software_single_step_p() = %d\n",
+ gdb_printf (file, "gdbarch_dump: gdbarch_software_single_step_p() = %d\n",
gdbarch_software_single_step_p (gdbarch));
- gdb_printf (file,
- "gdbarch_dump: software_single_step = <%s>\n",
+ gdb_printf (file, "gdbarch_dump: software_single_step = <%s>\n",
host_address_to_string (gdbarch->software_single_step));
gdb_printf (file,
"gdbarch_dump: gdbarch_single_step_through_delay_p() = %d\n",
gdbarch_single_step_through_delay_p (gdbarch));
- gdb_printf (file,
- "gdbarch_dump: single_step_through_delay = <%s>\n",
+ gdb_printf (file, "gdbarch_dump: single_step_through_delay = <%s>\n",
host_address_to_string (gdbarch->single_step_through_delay));
- gdb_printf (file,
- "gdbarch_dump: print_insn = <%s>\n",
+ gdb_printf (file, "gdbarch_dump: print_insn = <%s>\n",
host_address_to_string (gdbarch->print_insn));
- gdb_printf (file,
- "gdbarch_dump: skip_trampoline_code = <%s>\n",
+ gdb_printf (file, "gdbarch_dump: skip_trampoline_code = <%s>\n",
host_address_to_string (gdbarch->skip_trampoline_code));
- gdb_printf (file,
- "gdbarch_dump: so_ops = %s\n",
+ gdb_printf (file, "gdbarch_dump: so_ops = %s\n",
host_address_to_string (gdbarch->so_ops));
- gdb_printf (file,
- "gdbarch_dump: skip_solib_resolver = <%s>\n",
+ gdb_printf (file, "gdbarch_dump: skip_solib_resolver = <%s>\n",
host_address_to_string (gdbarch->skip_solib_resolver));
- gdb_printf (file,
- "gdbarch_dump: in_solib_return_trampoline = <%s>\n",
+ gdb_printf (file, "gdbarch_dump: in_solib_return_trampoline = <%s>\n",
host_address_to_string (gdbarch->in_solib_return_trampoline));
- gdb_printf (file,
- "gdbarch_dump: in_indirect_branch_thunk = <%s>\n",
+ gdb_printf (file, "gdbarch_dump: in_indirect_branch_thunk = <%s>\n",
host_address_to_string (gdbarch->in_indirect_branch_thunk));
- gdb_printf (file,
- "gdbarch_dump: stack_frame_destroyed_p = <%s>\n",
+ gdb_printf (file, "gdbarch_dump: stack_frame_destroyed_p = <%s>\n",
host_address_to_string (gdbarch->stack_frame_destroyed_p));
gdb_printf (file,
"gdbarch_dump: gdbarch_elf_make_msymbol_special_p() = %d\n",
gdbarch_elf_make_msymbol_special_p (gdbarch));
- gdb_printf (file,
- "gdbarch_dump: elf_make_msymbol_special = <%s>\n",
+ gdb_printf (file, "gdbarch_dump: elf_make_msymbol_special = <%s>\n",
host_address_to_string (gdbarch->elf_make_msymbol_special));
- gdb_printf (file,
- "gdbarch_dump: coff_make_msymbol_special = <%s>\n",
+ gdb_printf (file, "gdbarch_dump: coff_make_msymbol_special = <%s>\n",
host_address_to_string (gdbarch->coff_make_msymbol_special));
- gdb_printf (file,
- "gdbarch_dump: make_symbol_special = <%s>\n",
+ gdb_printf (file, "gdbarch_dump: make_symbol_special = <%s>\n",
host_address_to_string (gdbarch->make_symbol_special));
- gdb_printf (file,
- "gdbarch_dump: adjust_dwarf2_addr = <%s>\n",
+ gdb_printf (file, "gdbarch_dump: adjust_dwarf2_addr = <%s>\n",
host_address_to_string (gdbarch->adjust_dwarf2_addr));
- gdb_printf (file,
- "gdbarch_dump: adjust_dwarf2_line = <%s>\n",
+ gdb_printf (file, "gdbarch_dump: adjust_dwarf2_line = <%s>\n",
host_address_to_string (gdbarch->adjust_dwarf2_line));
- gdb_printf (file,
- "gdbarch_dump: cannot_step_breakpoint = %s\n",
+ gdb_printf (file, "gdbarch_dump: cannot_step_breakpoint = %s\n",
plongest (gdbarch->cannot_step_breakpoint));
- gdb_printf (file,
- "gdbarch_dump: have_nonsteppable_watchpoint = %s\n",
+ gdb_printf (file, "gdbarch_dump: have_nonsteppable_watchpoint = %s\n",
plongest (gdbarch->have_nonsteppable_watchpoint));
gdb_printf (file,
"gdbarch_dump: gdbarch_address_class_type_flags_p() = %d\n",
gdbarch_address_class_type_flags_p (gdbarch));
- gdb_printf (file,
- "gdbarch_dump: address_class_type_flags = <%s>\n",
+ gdb_printf (file, "gdbarch_dump: address_class_type_flags = <%s>\n",
host_address_to_string (gdbarch->address_class_type_flags));
- gdb_printf (file,
- "gdbarch_dump: gdbarch_address_class_type_flags_to_name_p() = %d\n",
- gdbarch_address_class_type_flags_to_name_p (gdbarch));
- gdb_printf (file,
- "gdbarch_dump: address_class_type_flags_to_name = <%s>\n",
- host_address_to_string (gdbarch->address_class_type_flags_to_name));
- gdb_printf (file,
- "gdbarch_dump: execute_dwarf_cfa_vendor_op = <%s>\n",
+ gdb_printf (
+ file, "gdbarch_dump: gdbarch_address_class_type_flags_to_name_p() = %d\n",
+ gdbarch_address_class_type_flags_to_name_p (gdbarch));
+ gdb_printf (
+ file, "gdbarch_dump: address_class_type_flags_to_name = <%s>\n",
+ host_address_to_string (gdbarch->address_class_type_flags_to_name));
+ gdb_printf (file, "gdbarch_dump: execute_dwarf_cfa_vendor_op = <%s>\n",
host_address_to_string (gdbarch->execute_dwarf_cfa_vendor_op));
- gdb_printf (file,
- "gdbarch_dump: gdbarch_address_class_name_to_type_flags_p() = %d\n",
- gdbarch_address_class_name_to_type_flags_p (gdbarch));
- gdb_printf (file,
- "gdbarch_dump: address_class_name_to_type_flags = <%s>\n",
- host_address_to_string (gdbarch->address_class_name_to_type_flags));
- gdb_printf (file,
- "gdbarch_dump: register_reggroup_p = <%s>\n",
+ gdb_printf (
+ file, "gdbarch_dump: gdbarch_address_class_name_to_type_flags_p() = %d\n",
+ gdbarch_address_class_name_to_type_flags_p (gdbarch));
+ gdb_printf (
+ file, "gdbarch_dump: address_class_name_to_type_flags = <%s>\n",
+ host_address_to_string (gdbarch->address_class_name_to_type_flags));
+ gdb_printf (file, "gdbarch_dump: register_reggroup_p = <%s>\n",
host_address_to_string (gdbarch->register_reggroup_p));
- gdb_printf (file,
- "gdbarch_dump: gdbarch_fetch_pointer_argument_p() = %d\n",
+ gdb_printf (file, "gdbarch_dump: gdbarch_fetch_pointer_argument_p() = %d\n",
gdbarch_fetch_pointer_argument_p (gdbarch));
- gdb_printf (file,
- "gdbarch_dump: fetch_pointer_argument = <%s>\n",
+ gdb_printf (file, "gdbarch_dump: fetch_pointer_argument = <%s>\n",
host_address_to_string (gdbarch->fetch_pointer_argument));
gdb_printf (file,
"gdbarch_dump: gdbarch_iterate_over_regset_sections_p() = %d\n",
gdbarch_iterate_over_regset_sections_p (gdbarch));
- gdb_printf (file,
- "gdbarch_dump: iterate_over_regset_sections = <%s>\n",
+ gdb_printf (file, "gdbarch_dump: iterate_over_regset_sections = <%s>\n",
host_address_to_string (gdbarch->iterate_over_regset_sections));
- gdb_printf (file,
- "gdbarch_dump: gdbarch_make_corefile_notes_p() = %d\n",
+ gdb_printf (file, "gdbarch_dump: gdbarch_make_corefile_notes_p() = %d\n",
gdbarch_make_corefile_notes_p (gdbarch));
- gdb_printf (file,
- "gdbarch_dump: make_corefile_notes = <%s>\n",
+ gdb_printf (file, "gdbarch_dump: make_corefile_notes = <%s>\n",
host_address_to_string (gdbarch->make_corefile_notes));
- gdb_printf (file,
- "gdbarch_dump: gdbarch_find_memory_regions_p() = %d\n",
+ gdb_printf (file, "gdbarch_dump: gdbarch_find_memory_regions_p() = %d\n",
gdbarch_find_memory_regions_p (gdbarch));
- gdb_printf (file,
- "gdbarch_dump: find_memory_regions = <%s>\n",
+ gdb_printf (file, "gdbarch_dump: find_memory_regions = <%s>\n",
host_address_to_string (gdbarch->find_memory_regions));
- gdb_printf (file,
- "gdbarch_dump: gdbarch_create_memtag_section_p() = %d\n",
+ gdb_printf (file, "gdbarch_dump: gdbarch_create_memtag_section_p() = %d\n",
gdbarch_create_memtag_section_p (gdbarch));
- gdb_printf (file,
- "gdbarch_dump: create_memtag_section = <%s>\n",
+ gdb_printf (file, "gdbarch_dump: create_memtag_section = <%s>\n",
host_address_to_string (gdbarch->create_memtag_section));
- gdb_printf (file,
- "gdbarch_dump: gdbarch_fill_memtag_section_p() = %d\n",
+ gdb_printf (file, "gdbarch_dump: gdbarch_fill_memtag_section_p() = %d\n",
gdbarch_fill_memtag_section_p (gdbarch));
- gdb_printf (file,
- "gdbarch_dump: fill_memtag_section = <%s>\n",
+ gdb_printf (file, "gdbarch_dump: fill_memtag_section = <%s>\n",
host_address_to_string (gdbarch->fill_memtag_section));
- gdb_printf (file,
- "gdbarch_dump: gdbarch_decode_memtag_section_p() = %d\n",
+ gdb_printf (file, "gdbarch_dump: gdbarch_decode_memtag_section_p() = %d\n",
gdbarch_decode_memtag_section_p (gdbarch));
- gdb_printf (file,
- "gdbarch_dump: decode_memtag_section = <%s>\n",
+ gdb_printf (file, "gdbarch_dump: decode_memtag_section = <%s>\n",
host_address_to_string (gdbarch->decode_memtag_section));
gdb_printf (file,
"gdbarch_dump: gdbarch_core_xfer_shared_libraries_p() = %d\n",
gdbarch_core_xfer_shared_libraries_p (gdbarch));
- gdb_printf (file,
- "gdbarch_dump: core_xfer_shared_libraries = <%s>\n",
+ gdb_printf (file, "gdbarch_dump: core_xfer_shared_libraries = <%s>\n",
host_address_to_string (gdbarch->core_xfer_shared_libraries));
- gdb_printf (file,
- "gdbarch_dump: gdbarch_core_xfer_shared_libraries_aix_p() = %d\n",
- gdbarch_core_xfer_shared_libraries_aix_p (gdbarch));
- gdb_printf (file,
- "gdbarch_dump: core_xfer_shared_libraries_aix = <%s>\n",
- host_address_to_string (gdbarch->core_xfer_shared_libraries_aix));
- gdb_printf (file,
- "gdbarch_dump: gdbarch_core_pid_to_str_p() = %d\n",
+ gdb_printf (
+ file, "gdbarch_dump: gdbarch_core_xfer_shared_libraries_aix_p() = %d\n",
+ gdbarch_core_xfer_shared_libraries_aix_p (gdbarch));
+ gdb_printf (
+ file, "gdbarch_dump: core_xfer_shared_libraries_aix = <%s>\n",
+ host_address_to_string (gdbarch->core_xfer_shared_libraries_aix));
+ gdb_printf (file, "gdbarch_dump: gdbarch_core_pid_to_str_p() = %d\n",
gdbarch_core_pid_to_str_p (gdbarch));
- gdb_printf (file,
- "gdbarch_dump: core_pid_to_str = <%s>\n",
+ gdb_printf (file, "gdbarch_dump: core_pid_to_str = <%s>\n",
host_address_to_string (gdbarch->core_pid_to_str));
- gdb_printf (file,
- "gdbarch_dump: gdbarch_core_thread_name_p() = %d\n",
+ gdb_printf (file, "gdbarch_dump: gdbarch_core_thread_name_p() = %d\n",
gdbarch_core_thread_name_p (gdbarch));
- gdb_printf (file,
- "gdbarch_dump: core_thread_name = <%s>\n",
+ gdb_printf (file, "gdbarch_dump: core_thread_name = <%s>\n",
host_address_to_string (gdbarch->core_thread_name));
- gdb_printf (file,
- "gdbarch_dump: gdbarch_core_xfer_siginfo_p() = %d\n",
+ gdb_printf (file, "gdbarch_dump: gdbarch_core_xfer_siginfo_p() = %d\n",
gdbarch_core_xfer_siginfo_p (gdbarch));
- gdb_printf (file,
- "gdbarch_dump: core_xfer_siginfo = <%s>\n",
+ gdb_printf (file, "gdbarch_dump: core_xfer_siginfo = <%s>\n",
host_address_to_string (gdbarch->core_xfer_siginfo));
- gdb_printf (file,
- "gdbarch_dump: gdbarch_gcore_bfd_target_p() = %d\n",
+ gdb_printf (file, "gdbarch_dump: gdbarch_gcore_bfd_target_p() = %d\n",
gdbarch_gcore_bfd_target_p (gdbarch));
- gdb_printf (file,
- "gdbarch_dump: gcore_bfd_target = %s\n",
+ gdb_printf (file, "gdbarch_dump: gcore_bfd_target = %s\n",
pstring (gdbarch->gcore_bfd_target));
- gdb_printf (file,
- "gdbarch_dump: vtable_function_descriptors = %s\n",
+ gdb_printf (file, "gdbarch_dump: vtable_function_descriptors = %s\n",
plongest (gdbarch->vtable_function_descriptors));
- gdb_printf (file,
- "gdbarch_dump: vbit_in_delta = %s\n",
+ gdb_printf (file, "gdbarch_dump: vbit_in_delta = %s\n",
plongest (gdbarch->vbit_in_delta));
- gdb_printf (file,
- "gdbarch_dump: skip_permanent_breakpoint = <%s>\n",
+ gdb_printf (file, "gdbarch_dump: skip_permanent_breakpoint = <%s>\n",
host_address_to_string (gdbarch->skip_permanent_breakpoint));
- gdb_printf (file,
- "gdbarch_dump: gdbarch_max_insn_length_p() = %d\n",
+ gdb_printf (file, "gdbarch_dump: gdbarch_max_insn_length_p() = %d\n",
gdbarch_max_insn_length_p (gdbarch));
- gdb_printf (file,
- "gdbarch_dump: max_insn_length = %s\n",
+ gdb_printf (file, "gdbarch_dump: max_insn_length = %s\n",
plongest (gdbarch->max_insn_length));
gdb_printf (file,
"gdbarch_dump: gdbarch_displaced_step_copy_insn_p() = %d\n",
gdbarch_displaced_step_copy_insn_p (gdbarch));
- gdb_printf (file,
- "gdbarch_dump: displaced_step_copy_insn = <%s>\n",
+ gdb_printf (file, "gdbarch_dump: displaced_step_copy_insn = <%s>\n",
host_address_to_string (gdbarch->displaced_step_copy_insn));
- gdb_printf (file,
- "gdbarch_dump: displaced_step_hw_singlestep = <%s>\n",
+ gdb_printf (file, "gdbarch_dump: displaced_step_hw_singlestep = <%s>\n",
host_address_to_string (gdbarch->displaced_step_hw_singlestep));
- gdb_printf (file,
- "gdbarch_dump: gdbarch_displaced_step_fixup_p() = %d\n",
+ gdb_printf (file, "gdbarch_dump: gdbarch_displaced_step_fixup_p() = %d\n",
gdbarch_displaced_step_fixup_p (gdbarch));
- gdb_printf (file,
- "gdbarch_dump: displaced_step_fixup = <%s>\n",
+ gdb_printf (file, "gdbarch_dump: displaced_step_fixup = <%s>\n",
host_address_to_string (gdbarch->displaced_step_fixup));
- gdb_printf (file,
- "gdbarch_dump: gdbarch_displaced_step_prepare_p() = %d\n",
+ gdb_printf (file, "gdbarch_dump: gdbarch_displaced_step_prepare_p() = %d\n",
gdbarch_displaced_step_prepare_p (gdbarch));
- gdb_printf (file,
- "gdbarch_dump: displaced_step_prepare = <%s>\n",
+ gdb_printf (file, "gdbarch_dump: displaced_step_prepare = <%s>\n",
host_address_to_string (gdbarch->displaced_step_prepare));
- gdb_printf (file,
- "gdbarch_dump: displaced_step_finish = <%s>\n",
+ gdb_printf (file, "gdbarch_dump: displaced_step_finish = <%s>\n",
host_address_to_string (gdbarch->displaced_step_finish));
gdb_printf (file,
- "gdbarch_dump: gdbarch_displaced_step_copy_insn_closure_by_addr_p() = %d\n",
+ "gdbarch_dump: "
+ "gdbarch_displaced_step_copy_insn_closure_by_addr_p() = %d\n",
gdbarch_displaced_step_copy_insn_closure_by_addr_p (gdbarch));
- gdb_printf (file,
- "gdbarch_dump: displaced_step_copy_insn_closure_by_addr = <%s>\n",
- host_address_to_string (gdbarch->displaced_step_copy_insn_closure_by_addr));
- gdb_printf (file,
- "gdbarch_dump: displaced_step_restore_all_in_ptid = <%s>\n",
- host_address_to_string (gdbarch->displaced_step_restore_all_in_ptid));
- gdb_printf (file,
- "gdbarch_dump: gdbarch_relocate_instruction_p() = %d\n",
+ gdb_printf (
+ file, "gdbarch_dump: displaced_step_copy_insn_closure_by_addr = <%s>\n",
+ host_address_to_string (
+ gdbarch->displaced_step_copy_insn_closure_by_addr));
+ gdb_printf (
+ file, "gdbarch_dump: displaced_step_restore_all_in_ptid = <%s>\n",
+ host_address_to_string (gdbarch->displaced_step_restore_all_in_ptid));
+ gdb_printf (file, "gdbarch_dump: gdbarch_relocate_instruction_p() = %d\n",
gdbarch_relocate_instruction_p (gdbarch));
- gdb_printf (file,
- "gdbarch_dump: relocate_instruction = <%s>\n",
+ gdb_printf (file, "gdbarch_dump: relocate_instruction = <%s>\n",
host_address_to_string (gdbarch->relocate_instruction));
- gdb_printf (file,
- "gdbarch_dump: gdbarch_overlay_update_p() = %d\n",
+ gdb_printf (file, "gdbarch_dump: gdbarch_overlay_update_p() = %d\n",
gdbarch_overlay_update_p (gdbarch));
- gdb_printf (file,
- "gdbarch_dump: overlay_update = <%s>\n",
+ gdb_printf (file, "gdbarch_dump: overlay_update = <%s>\n",
host_address_to_string (gdbarch->overlay_update));
- gdb_printf (file,
- "gdbarch_dump: gdbarch_core_read_description_p() = %d\n",
+ gdb_printf (file, "gdbarch_dump: gdbarch_core_read_description_p() = %d\n",
gdbarch_core_read_description_p (gdbarch));
- gdb_printf (file,
- "gdbarch_dump: core_read_description = <%s>\n",
+ gdb_printf (file, "gdbarch_dump: core_read_description = <%s>\n",
host_address_to_string (gdbarch->core_read_description));
- gdb_printf (file,
- "gdbarch_dump: sofun_address_maybe_missing = %s\n",
+ gdb_printf (file, "gdbarch_dump: sofun_address_maybe_missing = %s\n",
plongest (gdbarch->sofun_address_maybe_missing));
- gdb_printf (file,
- "gdbarch_dump: gdbarch_process_record_p() = %d\n",
+ gdb_printf (file, "gdbarch_dump: gdbarch_process_record_p() = %d\n",
gdbarch_process_record_p (gdbarch));
- gdb_printf (file,
- "gdbarch_dump: process_record = <%s>\n",
+ gdb_printf (file, "gdbarch_dump: process_record = <%s>\n",
host_address_to_string (gdbarch->process_record));
- gdb_printf (file,
- "gdbarch_dump: gdbarch_process_record_signal_p() = %d\n",
+ gdb_printf (file, "gdbarch_dump: gdbarch_process_record_signal_p() = %d\n",
gdbarch_process_record_signal_p (gdbarch));
- gdb_printf (file,
- "gdbarch_dump: process_record_signal = <%s>\n",
+ gdb_printf (file, "gdbarch_dump: process_record_signal = <%s>\n",
host_address_to_string (gdbarch->process_record_signal));
- gdb_printf (file,
- "gdbarch_dump: gdbarch_gdb_signal_from_target_p() = %d\n",
+ gdb_printf (file, "gdbarch_dump: gdbarch_gdb_signal_from_target_p() = %d\n",
gdbarch_gdb_signal_from_target_p (gdbarch));
- gdb_printf (file,
- "gdbarch_dump: gdb_signal_from_target = <%s>\n",
+ gdb_printf (file, "gdbarch_dump: gdb_signal_from_target = <%s>\n",
host_address_to_string (gdbarch->gdb_signal_from_target));
- gdb_printf (file,
- "gdbarch_dump: gdbarch_gdb_signal_to_target_p() = %d\n",
+ gdb_printf (file, "gdbarch_dump: gdbarch_gdb_signal_to_target_p() = %d\n",
gdbarch_gdb_signal_to_target_p (gdbarch));
- gdb_printf (file,
- "gdbarch_dump: gdb_signal_to_target = <%s>\n",
+ gdb_printf (file, "gdbarch_dump: gdb_signal_to_target = <%s>\n",
host_address_to_string (gdbarch->gdb_signal_to_target));
- gdb_printf (file,
- "gdbarch_dump: gdbarch_get_siginfo_type_p() = %d\n",
+ gdb_printf (file, "gdbarch_dump: gdbarch_get_siginfo_type_p() = %d\n",
gdbarch_get_siginfo_type_p (gdbarch));
- gdb_printf (file,
- "gdbarch_dump: get_siginfo_type = <%s>\n",
+ gdb_printf (file, "gdbarch_dump: get_siginfo_type = <%s>\n",
host_address_to_string (gdbarch->get_siginfo_type));
- gdb_printf (file,
- "gdbarch_dump: gdbarch_record_special_symbol_p() = %d\n",
+ gdb_printf (file, "gdbarch_dump: gdbarch_record_special_symbol_p() = %d\n",
gdbarch_record_special_symbol_p (gdbarch));
- gdb_printf (file,
- "gdbarch_dump: record_special_symbol = <%s>\n",
+ gdb_printf (file, "gdbarch_dump: record_special_symbol = <%s>\n",
host_address_to_string (gdbarch->record_special_symbol));
- gdb_printf (file,
- "gdbarch_dump: gdbarch_get_syscall_number_p() = %d\n",
+ gdb_printf (file, "gdbarch_dump: gdbarch_get_syscall_number_p() = %d\n",
gdbarch_get_syscall_number_p (gdbarch));
- gdb_printf (file,
- "gdbarch_dump: get_syscall_number = <%s>\n",
+ gdb_printf (file, "gdbarch_dump: get_syscall_number = <%s>\n",
host_address_to_string (gdbarch->get_syscall_number));
- gdb_printf (file,
- "gdbarch_dump: xml_syscall_file = %s\n",
+ gdb_printf (file, "gdbarch_dump: xml_syscall_file = %s\n",
pstring (gdbarch->xml_syscall_file));
- gdb_printf (file,
- "gdbarch_dump: syscalls_info = %s\n",
+ gdb_printf (file, "gdbarch_dump: syscalls_info = %s\n",
host_address_to_string (gdbarch->syscalls_info));
- gdb_printf (file,
- "gdbarch_dump: stap_integer_prefixes = %s\n",
+ gdb_printf (file, "gdbarch_dump: stap_integer_prefixes = %s\n",
pstring_list (gdbarch->stap_integer_prefixes));
- gdb_printf (file,
- "gdbarch_dump: stap_integer_suffixes = %s\n",
+ gdb_printf (file, "gdbarch_dump: stap_integer_suffixes = %s\n",
pstring_list (gdbarch->stap_integer_suffixes));
- gdb_printf (file,
- "gdbarch_dump: stap_register_prefixes = %s\n",
+ gdb_printf (file, "gdbarch_dump: stap_register_prefixes = %s\n",
pstring_list (gdbarch->stap_register_prefixes));
- gdb_printf (file,
- "gdbarch_dump: stap_register_suffixes = %s\n",
+ gdb_printf (file, "gdbarch_dump: stap_register_suffixes = %s\n",
pstring_list (gdbarch->stap_register_suffixes));
- gdb_printf (file,
- "gdbarch_dump: stap_register_indirection_prefixes = %s\n",
+ gdb_printf (file, "gdbarch_dump: stap_register_indirection_prefixes = %s\n",
pstring_list (gdbarch->stap_register_indirection_prefixes));
- gdb_printf (file,
- "gdbarch_dump: stap_register_indirection_suffixes = %s\n",
+ gdb_printf (file, "gdbarch_dump: stap_register_indirection_suffixes = %s\n",
pstring_list (gdbarch->stap_register_indirection_suffixes));
- gdb_printf (file,
- "gdbarch_dump: stap_gdb_register_prefix = %s\n",
+ gdb_printf (file, "gdbarch_dump: stap_gdb_register_prefix = %s\n",
pstring (gdbarch->stap_gdb_register_prefix));
- gdb_printf (file,
- "gdbarch_dump: stap_gdb_register_suffix = %s\n",
+ gdb_printf (file, "gdbarch_dump: stap_gdb_register_suffix = %s\n",
pstring (gdbarch->stap_gdb_register_suffix));
- gdb_printf (file,
- "gdbarch_dump: gdbarch_stap_is_single_operand_p() = %d\n",
+ gdb_printf (file, "gdbarch_dump: gdbarch_stap_is_single_operand_p() = %d\n",
gdbarch_stap_is_single_operand_p (gdbarch));
- gdb_printf (file,
- "gdbarch_dump: stap_is_single_operand = <%s>\n",
+ gdb_printf (file, "gdbarch_dump: stap_is_single_operand = <%s>\n",
host_address_to_string (gdbarch->stap_is_single_operand));
gdb_printf (file,
"gdbarch_dump: gdbarch_stap_parse_special_token_p() = %d\n",
gdbarch_stap_parse_special_token_p (gdbarch));
- gdb_printf (file,
- "gdbarch_dump: stap_parse_special_token = <%s>\n",
+ gdb_printf (file, "gdbarch_dump: stap_parse_special_token = <%s>\n",
host_address_to_string (gdbarch->stap_parse_special_token));
- gdb_printf (file,
- "gdbarch_dump: gdbarch_stap_adjust_register_p() = %d\n",
+ gdb_printf (file, "gdbarch_dump: gdbarch_stap_adjust_register_p() = %d\n",
gdbarch_stap_adjust_register_p (gdbarch));
- gdb_printf (file,
- "gdbarch_dump: stap_adjust_register = <%s>\n",
+ gdb_printf (file, "gdbarch_dump: stap_adjust_register = <%s>\n",
host_address_to_string (gdbarch->stap_adjust_register));
gdb_printf (file,
"gdbarch_dump: gdbarch_dtrace_parse_probe_argument_p() = %d\n",
gdbarch_dtrace_parse_probe_argument_p (gdbarch));
- gdb_printf (file,
- "gdbarch_dump: dtrace_parse_probe_argument = <%s>\n",
+ gdb_printf (file, "gdbarch_dump: dtrace_parse_probe_argument = <%s>\n",
host_address_to_string (gdbarch->dtrace_parse_probe_argument));
- gdb_printf (file,
- "gdbarch_dump: gdbarch_dtrace_probe_is_enabled_p() = %d\n",
+ gdb_printf (file, "gdbarch_dump: gdbarch_dtrace_probe_is_enabled_p() = %d\n",
gdbarch_dtrace_probe_is_enabled_p (gdbarch));
- gdb_printf (file,
- "gdbarch_dump: dtrace_probe_is_enabled = <%s>\n",
+ gdb_printf (file, "gdbarch_dump: dtrace_probe_is_enabled = <%s>\n",
host_address_to_string (gdbarch->dtrace_probe_is_enabled));
- gdb_printf (file,
- "gdbarch_dump: gdbarch_dtrace_enable_probe_p() = %d\n",
+ gdb_printf (file, "gdbarch_dump: gdbarch_dtrace_enable_probe_p() = %d\n",
gdbarch_dtrace_enable_probe_p (gdbarch));
- gdb_printf (file,
- "gdbarch_dump: dtrace_enable_probe = <%s>\n",
+ gdb_printf (file, "gdbarch_dump: dtrace_enable_probe = <%s>\n",
host_address_to_string (gdbarch->dtrace_enable_probe));
- gdb_printf (file,
- "gdbarch_dump: gdbarch_dtrace_disable_probe_p() = %d\n",
+ gdb_printf (file, "gdbarch_dump: gdbarch_dtrace_disable_probe_p() = %d\n",
gdbarch_dtrace_disable_probe_p (gdbarch));
- gdb_printf (file,
- "gdbarch_dump: dtrace_disable_probe = <%s>\n",
+ gdb_printf (file, "gdbarch_dump: dtrace_disable_probe = <%s>\n",
host_address_to_string (gdbarch->dtrace_disable_probe));
- gdb_printf (file,
- "gdbarch_dump: has_global_solist = %s\n",
+ gdb_printf (file, "gdbarch_dump: has_global_solist = %s\n",
plongest (gdbarch->has_global_solist));
- gdb_printf (file,
- "gdbarch_dump: has_global_breakpoints = %s\n",
+ gdb_printf (file, "gdbarch_dump: has_global_breakpoints = %s\n",
plongest (gdbarch->has_global_breakpoints));
- gdb_printf (file,
- "gdbarch_dump: has_shared_address_space = <%s>\n",
+ gdb_printf (file, "gdbarch_dump: has_shared_address_space = <%s>\n",
host_address_to_string (gdbarch->has_shared_address_space));
- gdb_printf (file,
- "gdbarch_dump: fast_tracepoint_valid_at = <%s>\n",
+ gdb_printf (file, "gdbarch_dump: fast_tracepoint_valid_at = <%s>\n",
host_address_to_string (gdbarch->fast_tracepoint_valid_at));
- gdb_printf (file,
- "gdbarch_dump: guess_tracepoint_registers = <%s>\n",
+ gdb_printf (file, "gdbarch_dump: guess_tracepoint_registers = <%s>\n",
host_address_to_string (gdbarch->guess_tracepoint_registers));
- gdb_printf (file,
- "gdbarch_dump: auto_charset = <%s>\n",
+ gdb_printf (file, "gdbarch_dump: auto_charset = <%s>\n",
host_address_to_string (gdbarch->auto_charset));
- gdb_printf (file,
- "gdbarch_dump: auto_wide_charset = <%s>\n",
+ gdb_printf (file, "gdbarch_dump: auto_wide_charset = <%s>\n",
host_address_to_string (gdbarch->auto_wide_charset));
- gdb_printf (file,
- "gdbarch_dump: solib_symbols_extension = %s\n",
+ gdb_printf (file, "gdbarch_dump: solib_symbols_extension = %s\n",
pstring (gdbarch->solib_symbols_extension));
- gdb_printf (file,
- "gdbarch_dump: has_dos_based_file_system = %s\n",
+ gdb_printf (file, "gdbarch_dump: has_dos_based_file_system = %s\n",
plongest (gdbarch->has_dos_based_file_system));
- gdb_printf (file,
- "gdbarch_dump: gen_return_address = <%s>\n",
+ gdb_printf (file, "gdbarch_dump: gen_return_address = <%s>\n",
host_address_to_string (gdbarch->gen_return_address));
- gdb_printf (file,
- "gdbarch_dump: gdbarch_info_proc_p() = %d\n",
+ gdb_printf (file, "gdbarch_dump: gdbarch_info_proc_p() = %d\n",
gdbarch_info_proc_p (gdbarch));
- gdb_printf (file,
- "gdbarch_dump: info_proc = <%s>\n",
+ gdb_printf (file, "gdbarch_dump: info_proc = <%s>\n",
host_address_to_string (gdbarch->info_proc));
- gdb_printf (file,
- "gdbarch_dump: gdbarch_core_info_proc_p() = %d\n",
+ gdb_printf (file, "gdbarch_dump: gdbarch_core_info_proc_p() = %d\n",
gdbarch_core_info_proc_p (gdbarch));
- gdb_printf (file,
- "gdbarch_dump: core_info_proc = <%s>\n",
+ gdb_printf (file, "gdbarch_dump: core_info_proc = <%s>\n",
host_address_to_string (gdbarch->core_info_proc));
- gdb_printf (file,
- "gdbarch_dump: iterate_over_objfiles_in_search_order = <%s>\n",
- host_address_to_string (gdbarch->iterate_over_objfiles_in_search_order));
- gdb_printf (file,
- "gdbarch_dump: ravenscar_ops = %s\n",
+ gdb_printf (
+ file, "gdbarch_dump: iterate_over_objfiles_in_search_order = <%s>\n",
+ host_address_to_string (gdbarch->iterate_over_objfiles_in_search_order));
+ gdb_printf (file, "gdbarch_dump: ravenscar_ops = %s\n",
host_address_to_string (gdbarch->ravenscar_ops));
- gdb_printf (file,
- "gdbarch_dump: insn_is_call = <%s>\n",
+ gdb_printf (file, "gdbarch_dump: insn_is_call = <%s>\n",
host_address_to_string (gdbarch->insn_is_call));
- gdb_printf (file,
- "gdbarch_dump: insn_is_ret = <%s>\n",
+ gdb_printf (file, "gdbarch_dump: insn_is_ret = <%s>\n",
host_address_to_string (gdbarch->insn_is_ret));
- gdb_printf (file,
- "gdbarch_dump: insn_is_jump = <%s>\n",
+ gdb_printf (file, "gdbarch_dump: insn_is_jump = <%s>\n",
host_address_to_string (gdbarch->insn_is_jump));
- gdb_printf (file,
- "gdbarch_dump: program_breakpoint_here_p = <%s>\n",
+ gdb_printf (file, "gdbarch_dump: program_breakpoint_here_p = <%s>\n",
host_address_to_string (gdbarch->program_breakpoint_here_p));
- gdb_printf (file,
- "gdbarch_dump: gdbarch_auxv_parse_p() = %d\n",
+ gdb_printf (file, "gdbarch_dump: gdbarch_auxv_parse_p() = %d\n",
gdbarch_auxv_parse_p (gdbarch));
- gdb_printf (file,
- "gdbarch_dump: auxv_parse = <%s>\n",
+ gdb_printf (file, "gdbarch_dump: auxv_parse = <%s>\n",
host_address_to_string (gdbarch->auxv_parse));
- gdb_printf (file,
- "gdbarch_dump: print_auxv_entry = <%s>\n",
+ gdb_printf (file, "gdbarch_dump: print_auxv_entry = <%s>\n",
host_address_to_string (gdbarch->print_auxv_entry));
- gdb_printf (file,
- "gdbarch_dump: vsyscall_range = <%s>\n",
+ gdb_printf (file, "gdbarch_dump: vsyscall_range = <%s>\n",
host_address_to_string (gdbarch->vsyscall_range));
- gdb_printf (file,
- "gdbarch_dump: infcall_mmap = <%s>\n",
+ gdb_printf (file, "gdbarch_dump: infcall_mmap = <%s>\n",
host_address_to_string (gdbarch->infcall_mmap));
- gdb_printf (file,
- "gdbarch_dump: infcall_munmap = <%s>\n",
+ gdb_printf (file, "gdbarch_dump: infcall_munmap = <%s>\n",
host_address_to_string (gdbarch->infcall_munmap));
- gdb_printf (file,
- "gdbarch_dump: gcc_target_options = <%s>\n",
+ gdb_printf (file, "gdbarch_dump: gcc_target_options = <%s>\n",
host_address_to_string (gdbarch->gcc_target_options));
- gdb_printf (file,
- "gdbarch_dump: gnu_triplet_regexp = <%s>\n",
+ gdb_printf (file, "gdbarch_dump: gnu_triplet_regexp = <%s>\n",
host_address_to_string (gdbarch->gnu_triplet_regexp));
- gdb_printf (file,
- "gdbarch_dump: addressable_memory_unit_size = <%s>\n",
+ gdb_printf (file, "gdbarch_dump: addressable_memory_unit_size = <%s>\n",
host_address_to_string (gdbarch->addressable_memory_unit_size));
- gdb_printf (file,
- "gdbarch_dump: disassembler_options_implicit = %s\n",
+ gdb_printf (file, "gdbarch_dump: disassembler_options_implicit = %s\n",
pstring (gdbarch->disassembler_options_implicit));
- gdb_printf (file,
- "gdbarch_dump: disassembler_options = %s\n",
+ gdb_printf (file, "gdbarch_dump: disassembler_options = %s\n",
pstring_ptr (gdbarch->disassembler_options));
- gdb_printf (file,
- "gdbarch_dump: valid_disassembler_options = %s\n",
+ gdb_printf (file, "gdbarch_dump: valid_disassembler_options = %s\n",
host_address_to_string (gdbarch->valid_disassembler_options));
- gdb_printf (file,
- "gdbarch_dump: type_align = <%s>\n",
+ gdb_printf (file, "gdbarch_dump: type_align = <%s>\n",
host_address_to_string (gdbarch->type_align));
- gdb_printf (file,
- "gdbarch_dump: get_pc_address_flags = <%s>\n",
+ gdb_printf (file, "gdbarch_dump: get_pc_address_flags = <%s>\n",
host_address_to_string (gdbarch->get_pc_address_flags));
- gdb_printf (file,
- "gdbarch_dump: read_core_file_mappings = <%s>\n",
+ gdb_printf (file, "gdbarch_dump: read_core_file_mappings = <%s>\n",
host_address_to_string (gdbarch->read_core_file_mappings));
if (gdbarch->dump_tdep != NULL)
gdbarch->dump_tdep (gdbarch, file);
}
-
const struct bfd_arch_info *
gdbarch_bfd_arch_info (struct gdbarch *gdbarch)
{
@@ -1412,8 +1226,7 @@ gdbarch_short_bit (struct gdbarch *gdbarch)
}
void
-set_gdbarch_short_bit (struct gdbarch *gdbarch,
- int short_bit)
+set_gdbarch_short_bit (struct gdbarch *gdbarch, int short_bit)
{
gdbarch->short_bit = short_bit;
}
@@ -1429,8 +1242,7 @@ gdbarch_int_bit (struct gdbarch *gdbarch)
}
void
-set_gdbarch_int_bit (struct gdbarch *gdbarch,
- int int_bit)
+set_gdbarch_int_bit (struct gdbarch *gdbarch, int int_bit)
{
gdbarch->int_bit = int_bit;
}
@@ -1446,8 +1258,7 @@ gdbarch_long_bit (struct gdbarch *gdbarch)
}
void
-set_gdbarch_long_bit (struct gdbarch *gdbarch,
- int long_bit)
+set_gdbarch_long_bit (struct gdbarch *gdbarch, int long_bit)
{
gdbarch->long_bit = long_bit;
}
@@ -1463,8 +1274,7 @@ gdbarch_long_long_bit (struct gdbarch *gdbarch)
}
void
-set_gdbarch_long_long_bit (struct gdbarch *gdbarch,
- int long_long_bit)
+set_gdbarch_long_long_bit (struct gdbarch *gdbarch, int long_long_bit)
{
gdbarch->long_long_bit = long_long_bit;
}
@@ -1480,8 +1290,7 @@ gdbarch_bfloat16_bit (struct gdbarch *gdbarch)
}
void
-set_gdbarch_bfloat16_bit (struct gdbarch *gdbarch,
- int bfloat16_bit)
+set_gdbarch_bfloat16_bit (struct gdbarch *gdbarch, int bfloat16_bit)
{
gdbarch->bfloat16_bit = bfloat16_bit;
}
@@ -1497,7 +1306,7 @@ gdbarch_bfloat16_format (struct gdbarch *gdbarch)
void
set_gdbarch_bfloat16_format (struct gdbarch *gdbarch,
- const struct floatformat ** bfloat16_format)
+ const struct floatformat **bfloat16_format)
{
gdbarch->bfloat16_format = bfloat16_format;
}
@@ -1513,8 +1322,7 @@ gdbarch_half_bit (struct gdbarch *gdbarch)
}
void
-set_gdbarch_half_bit (struct gdbarch *gdbarch,
- int half_bit)
+set_gdbarch_half_bit (struct gdbarch *gdbarch, int half_bit)
{
gdbarch->half_bit = half_bit;
}
@@ -1530,7 +1338,7 @@ gdbarch_half_format (struct gdbarch *gdbarch)
void
set_gdbarch_half_format (struct gdbarch *gdbarch,
- const struct floatformat ** half_format)
+ const struct floatformat **half_format)
{
gdbarch->half_format = half_format;
}
@@ -1546,8 +1354,7 @@ gdbarch_float_bit (struct gdbarch *gdbarch)
}
void
-set_gdbarch_float_bit (struct gdbarch *gdbarch,
- int float_bit)
+set_gdbarch_float_bit (struct gdbarch *gdbarch, int float_bit)
{
gdbarch->float_bit = float_bit;
}
@@ -1563,7 +1370,7 @@ gdbarch_float_format (struct gdbarch *gdbarch)
void
set_gdbarch_float_format (struct gdbarch *gdbarch,
- const struct floatformat ** float_format)
+ const struct floatformat **float_format)
{
gdbarch->float_format = float_format;
}
@@ -1579,8 +1386,7 @@ gdbarch_double_bit (struct gdbarch *gdbarch)
}
void
-set_gdbarch_double_bit (struct gdbarch *gdbarch,
- int double_bit)
+set_gdbarch_double_bit (struct gdbarch *gdbarch, int double_bit)
{
gdbarch->double_bit = double_bit;
}
@@ -1596,7 +1402,7 @@ gdbarch_double_format (struct gdbarch *gdbarch)
void
set_gdbarch_double_format (struct gdbarch *gdbarch,
- const struct floatformat ** double_format)
+ const struct floatformat **double_format)
{
gdbarch->double_format = double_format;
}
@@ -1612,8 +1418,7 @@ gdbarch_long_double_bit (struct gdbarch *gdbarch)
}
void
-set_gdbarch_long_double_bit (struct gdbarch *gdbarch,
- int long_double_bit)
+set_gdbarch_long_double_bit (struct gdbarch *gdbarch, int long_double_bit)
{
gdbarch->long_double_bit = long_double_bit;
}
@@ -1629,7 +1434,7 @@ gdbarch_long_double_format (struct gdbarch *gdbarch)
void
set_gdbarch_long_double_format (struct gdbarch *gdbarch,
- const struct floatformat ** long_double_format)
+ const struct floatformat **long_double_format)
{
gdbarch->long_double_format = long_double_format;
}
@@ -1645,8 +1450,7 @@ gdbarch_wchar_bit (struct gdbarch *gdbarch)
}
void
-set_gdbarch_wchar_bit (struct gdbarch *gdbarch,
- int wchar_bit)
+set_gdbarch_wchar_bit (struct gdbarch *gdbarch, int wchar_bit)
{
gdbarch->wchar_bit = wchar_bit;
}
@@ -1663,14 +1467,14 @@ gdbarch_wchar_signed (struct gdbarch *gdbarch)
}
void
-set_gdbarch_wchar_signed (struct gdbarch *gdbarch,
- int wchar_signed)
+set_gdbarch_wchar_signed (struct gdbarch *gdbarch, int wchar_signed)
{
gdbarch->wchar_signed = wchar_signed;
}
const struct floatformat **
-gdbarch_floatformat_for_type (struct gdbarch *gdbarch, const char *name, int length)
+gdbarch_floatformat_for_type (struct gdbarch *gdbarch, const char *name,
+ int length)
{
gdb_assert (gdbarch != NULL);
gdb_assert (gdbarch->floatformat_for_type != NULL);
@@ -1680,8 +1484,9 @@ gdbarch_floatformat_for_type (struct gdbarch *gdbarch, const char *name, int len
}
void
-set_gdbarch_floatformat_for_type (struct gdbarch *gdbarch,
- gdbarch_floatformat_for_type_ftype floatformat_for_type)
+set_gdbarch_floatformat_for_type (
+ struct gdbarch *gdbarch,
+ gdbarch_floatformat_for_type_ftype floatformat_for_type)
{
gdbarch->floatformat_for_type = floatformat_for_type;
}
@@ -1697,8 +1502,7 @@ gdbarch_ptr_bit (struct gdbarch *gdbarch)
}
void
-set_gdbarch_ptr_bit (struct gdbarch *gdbarch,
- int ptr_bit)
+set_gdbarch_ptr_bit (struct gdbarch *gdbarch, int ptr_bit)
{
gdbarch->ptr_bit = ptr_bit;
}
@@ -1715,8 +1519,7 @@ gdbarch_addr_bit (struct gdbarch *gdbarch)
}
void
-set_gdbarch_addr_bit (struct gdbarch *gdbarch,
- int addr_bit)
+set_gdbarch_addr_bit (struct gdbarch *gdbarch, int addr_bit)
{
gdbarch->addr_bit = addr_bit;
}
@@ -1733,8 +1536,7 @@ gdbarch_dwarf2_addr_size (struct gdbarch *gdbarch)
}
void
-set_gdbarch_dwarf2_addr_size (struct gdbarch *gdbarch,
- int dwarf2_addr_size)
+set_gdbarch_dwarf2_addr_size (struct gdbarch *gdbarch, int dwarf2_addr_size)
{
gdbarch->dwarf2_addr_size = dwarf2_addr_size;
}
@@ -1751,8 +1553,7 @@ gdbarch_char_signed (struct gdbarch *gdbarch)
}
void
-set_gdbarch_char_signed (struct gdbarch *gdbarch,
- int char_signed)
+set_gdbarch_char_signed (struct gdbarch *gdbarch, int char_signed)
{
gdbarch->char_signed = char_signed;
}
@@ -1775,8 +1576,7 @@ gdbarch_read_pc (struct gdbarch *gdbarch, readable_regcache *regcache)
}
void
-set_gdbarch_read_pc (struct gdbarch *gdbarch,
- gdbarch_read_pc_ftype read_pc)
+set_gdbarch_read_pc (struct gdbarch *gdbarch, gdbarch_read_pc_ftype read_pc)
{
gdbarch->read_pc = read_pc;
}
@@ -1789,7 +1589,8 @@ gdbarch_write_pc_p (struct gdbarch *gdbarch)
}
void
-gdbarch_write_pc (struct gdbarch *gdbarch, struct regcache *regcache, CORE_ADDR val)
+gdbarch_write_pc (struct gdbarch *gdbarch, struct regcache *regcache,
+ CORE_ADDR val)
{
gdb_assert (gdbarch != NULL);
gdb_assert (gdbarch->write_pc != NULL);
@@ -1799,14 +1600,14 @@ gdbarch_write_pc (struct gdbarch *gdbarch, struct regcache *regcache, CORE_ADDR
}
void
-set_gdbarch_write_pc (struct gdbarch *gdbarch,
- gdbarch_write_pc_ftype write_pc)
+set_gdbarch_write_pc (struct gdbarch *gdbarch, gdbarch_write_pc_ftype write_pc)
{
gdbarch->write_pc = write_pc;
}
void
-gdbarch_virtual_frame_pointer (struct gdbarch *gdbarch, CORE_ADDR pc, int *frame_regnum, LONGEST *frame_offset)
+gdbarch_virtual_frame_pointer (struct gdbarch *gdbarch, CORE_ADDR pc,
+ int *frame_regnum, LONGEST *frame_offset)
{
gdb_assert (gdbarch != NULL);
gdb_assert (gdbarch->virtual_frame_pointer != NULL);
@@ -1816,8 +1617,9 @@ gdbarch_virtual_frame_pointer (struct gdbarch *gdbarch, CORE_ADDR pc, int *frame
}
void
-set_gdbarch_virtual_frame_pointer (struct gdbarch *gdbarch,
- gdbarch_virtual_frame_pointer_ftype virtual_frame_pointer)
+set_gdbarch_virtual_frame_pointer (
+ struct gdbarch *gdbarch,
+ gdbarch_virtual_frame_pointer_ftype virtual_frame_pointer)
{
gdbarch->virtual_frame_pointer = virtual_frame_pointer;
}
@@ -1830,7 +1632,9 @@ gdbarch_pseudo_register_read_p (struct gdbarch *gdbarch)
}
enum register_status
-gdbarch_pseudo_register_read (struct gdbarch *gdbarch, readable_regcache *regcache, int cookednum, gdb_byte *buf)
+gdbarch_pseudo_register_read (struct gdbarch *gdbarch,
+ readable_regcache *regcache, int cookednum,
+ gdb_byte *buf)
{
gdb_assert (gdbarch != NULL);
gdb_assert (gdbarch->pseudo_register_read != NULL);
@@ -1840,8 +1644,9 @@ gdbarch_pseudo_register_read (struct gdbarch *gdbarch, readable_regcache *regcac
}
void
-set_gdbarch_pseudo_register_read (struct gdbarch *gdbarch,
- gdbarch_pseudo_register_read_ftype pseudo_register_read)
+set_gdbarch_pseudo_register_read (
+ struct gdbarch *gdbarch,
+ gdbarch_pseudo_register_read_ftype pseudo_register_read)
{
gdbarch->pseudo_register_read = pseudo_register_read;
}
@@ -1854,7 +1659,8 @@ gdbarch_pseudo_register_read_value_p (struct gdbarch *gdbarch)
}
struct value *
-gdbarch_pseudo_register_read_value (struct gdbarch *gdbarch, readable_regcache *regcache, int cookednum)
+gdbarch_pseudo_register_read_value (struct gdbarch *gdbarch,
+ readable_regcache *regcache, int cookednum)
{
gdb_assert (gdbarch != NULL);
gdb_assert (gdbarch->pseudo_register_read_value != NULL);
@@ -1864,8 +1670,9 @@ gdbarch_pseudo_register_read_value (struct gdbarch *gdbarch, readable_regcache *
}
void
-set_gdbarch_pseudo_register_read_value (struct gdbarch *gdbarch,
- gdbarch_pseudo_register_read_value_ftype pseudo_register_read_value)
+set_gdbarch_pseudo_register_read_value (
+ struct gdbarch *gdbarch,
+ gdbarch_pseudo_register_read_value_ftype pseudo_register_read_value)
{
gdbarch->pseudo_register_read_value = pseudo_register_read_value;
}
@@ -1878,7 +1685,9 @@ gdbarch_pseudo_register_write_p (struct gdbarch *gdbarch)
}
void
-gdbarch_pseudo_register_write (struct gdbarch *gdbarch, struct regcache *regcache, int cookednum, const gdb_byte *buf)
+gdbarch_pseudo_register_write (struct gdbarch *gdbarch,
+ struct regcache *regcache, int cookednum,
+ const gdb_byte *buf)
{
gdb_assert (gdbarch != NULL);
gdb_assert (gdbarch->pseudo_register_write != NULL);
@@ -1888,8 +1697,9 @@ gdbarch_pseudo_register_write (struct gdbarch *gdbarch, struct regcache *regcach
}
void
-set_gdbarch_pseudo_register_write (struct gdbarch *gdbarch,
- gdbarch_pseudo_register_write_ftype pseudo_register_write)
+set_gdbarch_pseudo_register_write (
+ struct gdbarch *gdbarch,
+ gdbarch_pseudo_register_write_ftype pseudo_register_write)
{
gdbarch->pseudo_register_write = pseudo_register_write;
}
@@ -1906,8 +1716,7 @@ gdbarch_num_regs (struct gdbarch *gdbarch)
}
void
-set_gdbarch_num_regs (struct gdbarch *gdbarch,
- int num_regs)
+set_gdbarch_num_regs (struct gdbarch *gdbarch, int num_regs)
{
gdbarch->num_regs = num_regs;
}
@@ -1923,8 +1732,7 @@ gdbarch_num_pseudo_regs (struct gdbarch *gdbarch)
}
void
-set_gdbarch_num_pseudo_regs (struct gdbarch *gdbarch,
- int num_pseudo_regs)
+set_gdbarch_num_pseudo_regs (struct gdbarch *gdbarch, int num_pseudo_regs)
{
gdbarch->num_pseudo_regs = num_pseudo_regs;
}
@@ -1937,7 +1745,8 @@ gdbarch_ax_pseudo_register_collect_p (struct gdbarch *gdbarch)
}
int
-gdbarch_ax_pseudo_register_collect (struct gdbarch *gdbarch, struct agent_expr *ax, int reg)
+gdbarch_ax_pseudo_register_collect (struct gdbarch *gdbarch,
+ struct agent_expr *ax, int reg)
{
gdb_assert (gdbarch != NULL);
gdb_assert (gdbarch->ax_pseudo_register_collect != NULL);
@@ -1947,8 +1756,9 @@ gdbarch_ax_pseudo_register_collect (struct gdbarch *gdbarch, struct agent_expr *
}
void
-set_gdbarch_ax_pseudo_register_collect (struct gdbarch *gdbarch,
- gdbarch_ax_pseudo_register_collect_ftype ax_pseudo_register_collect)
+set_gdbarch_ax_pseudo_register_collect (
+ struct gdbarch *gdbarch,
+ gdbarch_ax_pseudo_register_collect_ftype ax_pseudo_register_collect)
{
gdbarch->ax_pseudo_register_collect = ax_pseudo_register_collect;
}
@@ -1961,7 +1771,8 @@ gdbarch_ax_pseudo_register_push_stack_p (struct gdbarch *gdbarch)
}
int
-gdbarch_ax_pseudo_register_push_stack (struct gdbarch *gdbarch, struct agent_expr *ax, int reg)
+gdbarch_ax_pseudo_register_push_stack (struct gdbarch *gdbarch,
+ struct agent_expr *ax, int reg)
{
gdb_assert (gdbarch != NULL);
gdb_assert (gdbarch->ax_pseudo_register_push_stack != NULL);
@@ -1971,8 +1782,9 @@ gdbarch_ax_pseudo_register_push_stack (struct gdbarch *gdbarch, struct agent_exp
}
void
-set_gdbarch_ax_pseudo_register_push_stack (struct gdbarch *gdbarch,
- gdbarch_ax_pseudo_register_push_stack_ftype ax_pseudo_register_push_stack)
+set_gdbarch_ax_pseudo_register_push_stack (
+ struct gdbarch *gdbarch,
+ gdbarch_ax_pseudo_register_push_stack_ftype ax_pseudo_register_push_stack)
{
gdbarch->ax_pseudo_register_push_stack = ax_pseudo_register_push_stack;
}
@@ -1985,7 +1797,8 @@ gdbarch_report_signal_info_p (struct gdbarch *gdbarch)
}
void
-gdbarch_report_signal_info (struct gdbarch *gdbarch, struct ui_out *uiout, enum gdb_signal siggnal)
+gdbarch_report_signal_info (struct gdbarch *gdbarch, struct ui_out *uiout,
+ enum gdb_signal siggnal)
{
gdb_assert (gdbarch != NULL);
gdb_assert (gdbarch->report_signal_info != NULL);
@@ -1995,8 +1808,8 @@ gdbarch_report_signal_info (struct gdbarch *gdbarch, struct ui_out *uiout, enum
}
void
-set_gdbarch_report_signal_info (struct gdbarch *gdbarch,
- gdbarch_report_signal_info_ftype report_signal_info)
+set_gdbarch_report_signal_info (
+ struct gdbarch *gdbarch, gdbarch_report_signal_info_ftype report_signal_info)
{
gdbarch->report_signal_info = report_signal_info;
}
@@ -2012,8 +1825,7 @@ gdbarch_sp_regnum (struct gdbarch *gdbarch)
}
void
-set_gdbarch_sp_regnum (struct gdbarch *gdbarch,
- int sp_regnum)
+set_gdbarch_sp_regnum (struct gdbarch *gdbarch, int sp_regnum)
{
gdbarch->sp_regnum = sp_regnum;
}
@@ -2029,8 +1841,7 @@ gdbarch_pc_regnum (struct gdbarch *gdbarch)
}
void
-set_gdbarch_pc_regnum (struct gdbarch *gdbarch,
- int pc_regnum)
+set_gdbarch_pc_regnum (struct gdbarch *gdbarch, int pc_regnum)
{
gdbarch->pc_regnum = pc_regnum;
}
@@ -2046,8 +1857,7 @@ gdbarch_ps_regnum (struct gdbarch *gdbarch)
}
void
-set_gdbarch_ps_regnum (struct gdbarch *gdbarch,
- int ps_regnum)
+set_gdbarch_ps_regnum (struct gdbarch *gdbarch, int ps_regnum)
{
gdbarch->ps_regnum = ps_regnum;
}
@@ -2063,8 +1873,7 @@ gdbarch_fp0_regnum (struct gdbarch *gdbarch)
}
void
-set_gdbarch_fp0_regnum (struct gdbarch *gdbarch,
- int fp0_regnum)
+set_gdbarch_fp0_regnum (struct gdbarch *gdbarch, int fp0_regnum)
{
gdbarch->fp0_regnum = fp0_regnum;
}
@@ -2080,8 +1889,8 @@ gdbarch_stab_reg_to_regnum (struct gdbarch *gdbarch, int stab_regnr)
}
void
-set_gdbarch_stab_reg_to_regnum (struct gdbarch *gdbarch,
- gdbarch_stab_reg_to_regnum_ftype stab_reg_to_regnum)
+set_gdbarch_stab_reg_to_regnum (
+ struct gdbarch *gdbarch, gdbarch_stab_reg_to_regnum_ftype stab_reg_to_regnum)
{
gdbarch->stab_reg_to_regnum = stab_reg_to_regnum;
}
@@ -2097,8 +1906,9 @@ gdbarch_ecoff_reg_to_regnum (struct gdbarch *gdbarch, int ecoff_regnr)
}
void
-set_gdbarch_ecoff_reg_to_regnum (struct gdbarch *gdbarch,
- gdbarch_ecoff_reg_to_regnum_ftype ecoff_reg_to_regnum)
+set_gdbarch_ecoff_reg_to_regnum (
+ struct gdbarch *gdbarch,
+ gdbarch_ecoff_reg_to_regnum_ftype ecoff_reg_to_regnum)
{
gdbarch->ecoff_reg_to_regnum = ecoff_reg_to_regnum;
}
@@ -2114,8 +1924,8 @@ gdbarch_sdb_reg_to_regnum (struct gdbarch *gdbarch, int sdb_regnr)
}
void
-set_gdbarch_sdb_reg_to_regnum (struct gdbarch *gdbarch,
- gdbarch_sdb_reg_to_regnum_ftype sdb_reg_to_regnum)
+set_gdbarch_sdb_reg_to_regnum (
+ struct gdbarch *gdbarch, gdbarch_sdb_reg_to_regnum_ftype sdb_reg_to_regnum)
{
gdbarch->sdb_reg_to_regnum = sdb_reg_to_regnum;
}
@@ -2131,8 +1941,9 @@ gdbarch_dwarf2_reg_to_regnum (struct gdbarch *gdbarch, int dwarf2_regnr)
}
void
-set_gdbarch_dwarf2_reg_to_regnum (struct gdbarch *gdbarch,
- gdbarch_dwarf2_reg_to_regnum_ftype dwarf2_reg_to_regnum)
+set_gdbarch_dwarf2_reg_to_regnum (
+ struct gdbarch *gdbarch,
+ gdbarch_dwarf2_reg_to_regnum_ftype dwarf2_reg_to_regnum)
{
gdbarch->dwarf2_reg_to_regnum = dwarf2_reg_to_regnum;
}
@@ -2186,8 +1997,7 @@ gdbarch_dummy_id (struct gdbarch *gdbarch, frame_info_ptr this_frame)
}
void
-set_gdbarch_dummy_id (struct gdbarch *gdbarch,
- gdbarch_dummy_id_ftype dummy_id)
+set_gdbarch_dummy_id (struct gdbarch *gdbarch, gdbarch_dummy_id_ftype dummy_id)
{
gdbarch->dummy_id = dummy_id;
}
@@ -2217,13 +2027,18 @@ gdbarch_push_dummy_call_p (struct gdbarch *gdbarch)
}
CORE_ADDR
-gdbarch_push_dummy_call (struct gdbarch *gdbarch, struct value *function, struct regcache *regcache, CORE_ADDR bp_addr, int nargs, struct value **args, CORE_ADDR sp, function_call_return_method return_method, CORE_ADDR struct_addr)
+gdbarch_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
+ struct regcache *regcache, CORE_ADDR bp_addr,
+ int nargs, struct value **args, CORE_ADDR sp,
+ function_call_return_method return_method,
+ CORE_ADDR struct_addr)
{
gdb_assert (gdbarch != NULL);
gdb_assert (gdbarch->push_dummy_call != NULL);
if (gdbarch_debug >= 2)
gdb_printf (gdb_stdlog, "gdbarch_push_dummy_call called\n");
- return gdbarch->push_dummy_call (gdbarch, function, regcache, bp_addr, nargs, args, sp, return_method, struct_addr);
+ return gdbarch->push_dummy_call (gdbarch, function, regcache, bp_addr, nargs,
+ args, sp, return_method, struct_addr);
}
void
@@ -2244,8 +2059,8 @@ gdbarch_call_dummy_location (struct gdbarch *gdbarch)
}
void
-set_gdbarch_call_dummy_location (struct gdbarch *gdbarch,
- enum call_dummy_location_type call_dummy_location)
+set_gdbarch_call_dummy_location (
+ struct gdbarch *gdbarch, enum call_dummy_location_type call_dummy_location)
{
gdbarch->call_dummy_location = call_dummy_location;
}
@@ -2258,13 +2073,17 @@ gdbarch_push_dummy_code_p (struct gdbarch *gdbarch)
}
CORE_ADDR
-gdbarch_push_dummy_code (struct gdbarch *gdbarch, CORE_ADDR sp, CORE_ADDR funaddr, struct value **args, int nargs, struct type *value_type, CORE_ADDR *real_pc, CORE_ADDR *bp_addr, struct regcache *regcache)
+gdbarch_push_dummy_code (struct gdbarch *gdbarch, CORE_ADDR sp,
+ CORE_ADDR funaddr, struct value **args, int nargs,
+ struct type *value_type, CORE_ADDR *real_pc,
+ CORE_ADDR *bp_addr, struct regcache *regcache)
{
gdb_assert (gdbarch != NULL);
gdb_assert (gdbarch->push_dummy_code != NULL);
if (gdbarch_debug >= 2)
gdb_printf (gdb_stdlog, "gdbarch_push_dummy_code called\n");
- return gdbarch->push_dummy_code (gdbarch, sp, funaddr, args, nargs, value_type, real_pc, bp_addr, regcache);
+ return gdbarch->push_dummy_code (gdbarch, sp, funaddr, args, nargs,
+ value_type, real_pc, bp_addr, regcache);
}
void
@@ -2285,14 +2104,16 @@ gdbarch_code_of_frame_writable (struct gdbarch *gdbarch, frame_info_ptr frame)
}
void
-set_gdbarch_code_of_frame_writable (struct gdbarch *gdbarch,
- gdbarch_code_of_frame_writable_ftype code_of_frame_writable)
+set_gdbarch_code_of_frame_writable (
+ struct gdbarch *gdbarch,
+ gdbarch_code_of_frame_writable_ftype code_of_frame_writable)
{
gdbarch->code_of_frame_writable = code_of_frame_writable;
}
void
-gdbarch_print_registers_info (struct gdbarch *gdbarch, struct ui_file *file, frame_info_ptr frame, int regnum, int all)
+gdbarch_print_registers_info (struct gdbarch *gdbarch, struct ui_file *file,
+ frame_info_ptr frame, int regnum, int all)
{
gdb_assert (gdbarch != NULL);
gdb_assert (gdbarch->print_registers_info != NULL);
@@ -2302,14 +2123,16 @@ gdbarch_print_registers_info (struct gdbarch *gdbarch, struct ui_file *file, fra
}
void
-set_gdbarch_print_registers_info (struct gdbarch *gdbarch,
- gdbarch_print_registers_info_ftype print_registers_info)
+set_gdbarch_print_registers_info (
+ struct gdbarch *gdbarch,
+ gdbarch_print_registers_info_ftype print_registers_info)
{
gdbarch->print_registers_info = print_registers_info;
}
void
-gdbarch_print_float_info (struct gdbarch *gdbarch, struct ui_file *file, frame_info_ptr frame, const char *args)
+gdbarch_print_float_info (struct gdbarch *gdbarch, struct ui_file *file,
+ frame_info_ptr frame, const char *args)
{
gdb_assert (gdbarch != NULL);
gdb_assert (gdbarch->print_float_info != NULL);
@@ -2333,7 +2156,8 @@ gdbarch_print_vector_info_p (struct gdbarch *gdbarch)
}
void
-gdbarch_print_vector_info (struct gdbarch *gdbarch, struct ui_file *file, frame_info_ptr frame, const char *args)
+gdbarch_print_vector_info (struct gdbarch *gdbarch, struct ui_file *file,
+ frame_info_ptr frame, const char *args)
{
gdb_assert (gdbarch != NULL);
gdb_assert (gdbarch->print_vector_info != NULL);
@@ -2343,8 +2167,8 @@ gdbarch_print_vector_info (struct gdbarch *gdbarch, struct ui_file *file, frame_
}
void
-set_gdbarch_print_vector_info (struct gdbarch *gdbarch,
- gdbarch_print_vector_info_ftype print_vector_info)
+set_gdbarch_print_vector_info (
+ struct gdbarch *gdbarch, gdbarch_print_vector_info_ftype print_vector_info)
{
gdbarch->print_vector_info = print_vector_info;
}
@@ -2360,8 +2184,8 @@ gdbarch_register_sim_regno (struct gdbarch *gdbarch, int reg_nr)
}
void
-set_gdbarch_register_sim_regno (struct gdbarch *gdbarch,
- gdbarch_register_sim_regno_ftype register_sim_regno)
+set_gdbarch_register_sim_regno (
+ struct gdbarch *gdbarch, gdbarch_register_sim_regno_ftype register_sim_regno)
{
gdbarch->register_sim_regno = register_sim_regno;
}
@@ -2377,8 +2201,9 @@ gdbarch_cannot_fetch_register (struct gdbarch *gdbarch, int regnum)
}
void
-set_gdbarch_cannot_fetch_register (struct gdbarch *gdbarch,
- gdbarch_cannot_fetch_register_ftype cannot_fetch_register)
+set_gdbarch_cannot_fetch_register (
+ struct gdbarch *gdbarch,
+ gdbarch_cannot_fetch_register_ftype cannot_fetch_register)
{
gdbarch->cannot_fetch_register = cannot_fetch_register;
}
@@ -2394,8 +2219,9 @@ gdbarch_cannot_store_register (struct gdbarch *gdbarch, int regnum)
}
void
-set_gdbarch_cannot_store_register (struct gdbarch *gdbarch,
- gdbarch_cannot_store_register_ftype cannot_store_register)
+set_gdbarch_cannot_store_register (
+ struct gdbarch *gdbarch,
+ gdbarch_cannot_store_register_ftype cannot_store_register)
{
gdbarch->cannot_store_register = cannot_store_register;
}
@@ -2408,7 +2234,8 @@ gdbarch_get_longjmp_target_p (struct gdbarch *gdbarch)
}
int
-gdbarch_get_longjmp_target (struct gdbarch *gdbarch, frame_info_ptr frame, CORE_ADDR *pc)
+gdbarch_get_longjmp_target (struct gdbarch *gdbarch, frame_info_ptr frame,
+ CORE_ADDR *pc)
{
gdb_assert (gdbarch != NULL);
gdb_assert (gdbarch->get_longjmp_target != NULL);
@@ -2418,8 +2245,8 @@ gdbarch_get_longjmp_target (struct gdbarch *gdbarch, frame_info_ptr frame, CORE_
}
void
-set_gdbarch_get_longjmp_target (struct gdbarch *gdbarch,
- gdbarch_get_longjmp_target_ftype get_longjmp_target)
+set_gdbarch_get_longjmp_target (
+ struct gdbarch *gdbarch, gdbarch_get_longjmp_target_ftype get_longjmp_target)
{
gdbarch->get_longjmp_target = get_longjmp_target;
}
@@ -2442,7 +2269,8 @@ set_gdbarch_believe_pcc_promotion (struct gdbarch *gdbarch,
}
int
-gdbarch_convert_register_p (struct gdbarch *gdbarch, int regnum, struct type *type)
+gdbarch_convert_register_p (struct gdbarch *gdbarch, int regnum,
+ struct type *type)
{
gdb_assert (gdbarch != NULL);
gdb_assert (gdbarch->convert_register_p != NULL);
@@ -2452,31 +2280,35 @@ gdbarch_convert_register_p (struct gdbarch *gdbarch, int regnum, struct type *ty
}
void
-set_gdbarch_convert_register_p (struct gdbarch *gdbarch,
- gdbarch_convert_register_p_ftype convert_register_p)
+set_gdbarch_convert_register_p (
+ struct gdbarch *gdbarch, gdbarch_convert_register_p_ftype convert_register_p)
{
gdbarch->convert_register_p = convert_register_p;
}
int
-gdbarch_register_to_value (struct gdbarch *gdbarch, frame_info_ptr frame, int regnum, struct type *type, gdb_byte *buf, int *optimizedp, int *unavailablep)
+gdbarch_register_to_value (struct gdbarch *gdbarch, frame_info_ptr frame,
+ int regnum, struct type *type, gdb_byte *buf,
+ int *optimizedp, int *unavailablep)
{
gdb_assert (gdbarch != NULL);
gdb_assert (gdbarch->register_to_value != NULL);
if (gdbarch_debug >= 2)
gdb_printf (gdb_stdlog, "gdbarch_register_to_value called\n");
- return gdbarch->register_to_value (frame, regnum, type, buf, optimizedp, unavailablep);
+ return gdbarch->register_to_value (frame, regnum, type, buf, optimizedp,
+ unavailablep);
}
void
-set_gdbarch_register_to_value (struct gdbarch *gdbarch,
- gdbarch_register_to_value_ftype register_to_value)
+set_gdbarch_register_to_value (
+ struct gdbarch *gdbarch, gdbarch_register_to_value_ftype register_to_value)
{
gdbarch->register_to_value = register_to_value;
}
void
-gdbarch_value_to_register (struct gdbarch *gdbarch, frame_info_ptr frame, int regnum, struct type *type, const gdb_byte *buf)
+gdbarch_value_to_register (struct gdbarch *gdbarch, frame_info_ptr frame,
+ int regnum, struct type *type, const gdb_byte *buf)
{
gdb_assert (gdbarch != NULL);
gdb_assert (gdbarch->value_to_register != NULL);
@@ -2486,14 +2318,15 @@ gdbarch_value_to_register (struct gdbarch *gdbarch, frame_info_ptr frame, int re
}
void
-set_gdbarch_value_to_register (struct gdbarch *gdbarch,
- gdbarch_value_to_register_ftype value_to_register)
+set_gdbarch_value_to_register (
+ struct gdbarch *gdbarch, gdbarch_value_to_register_ftype value_to_register)
{
gdbarch->value_to_register = value_to_register;
}
struct value *
-gdbarch_value_from_register (struct gdbarch *gdbarch, struct type *type, int regnum, struct frame_id frame_id)
+gdbarch_value_from_register (struct gdbarch *gdbarch, struct type *type,
+ int regnum, struct frame_id frame_id)
{
gdb_assert (gdbarch != NULL);
gdb_assert (gdbarch->value_from_register != NULL);
@@ -2503,14 +2336,16 @@ gdbarch_value_from_register (struct gdbarch *gdbarch, struct type *type, int reg
}
void
-set_gdbarch_value_from_register (struct gdbarch *gdbarch,
- gdbarch_value_from_register_ftype value_from_register)
+set_gdbarch_value_from_register (
+ struct gdbarch *gdbarch,
+ gdbarch_value_from_register_ftype value_from_register)
{
gdbarch->value_from_register = value_from_register;
}
CORE_ADDR
-gdbarch_pointer_to_address (struct gdbarch *gdbarch, struct type *type, const gdb_byte *buf)
+gdbarch_pointer_to_address (struct gdbarch *gdbarch, struct type *type,
+ const gdb_byte *buf)
{
gdb_assert (gdbarch != NULL);
gdb_assert (gdbarch->pointer_to_address != NULL);
@@ -2520,14 +2355,15 @@ gdbarch_pointer_to_address (struct gdbarch *gdbarch, struct type *type, const gd
}
void
-set_gdbarch_pointer_to_address (struct gdbarch *gdbarch,
- gdbarch_pointer_to_address_ftype pointer_to_address)
+set_gdbarch_pointer_to_address (
+ struct gdbarch *gdbarch, gdbarch_pointer_to_address_ftype pointer_to_address)
{
gdbarch->pointer_to_address = pointer_to_address;
}
void
-gdbarch_address_to_pointer (struct gdbarch *gdbarch, struct type *type, gdb_byte *buf, CORE_ADDR addr)
+gdbarch_address_to_pointer (struct gdbarch *gdbarch, struct type *type,
+ gdb_byte *buf, CORE_ADDR addr)
{
gdb_assert (gdbarch != NULL);
gdb_assert (gdbarch->address_to_pointer != NULL);
@@ -2537,8 +2373,8 @@ gdbarch_address_to_pointer (struct gdbarch *gdbarch, struct type *type, gdb_byte
}
void
-set_gdbarch_address_to_pointer (struct gdbarch *gdbarch,
- gdbarch_address_to_pointer_ftype address_to_pointer)
+set_gdbarch_address_to_pointer (
+ struct gdbarch *gdbarch, gdbarch_address_to_pointer_ftype address_to_pointer)
{
gdbarch->address_to_pointer = address_to_pointer;
}
@@ -2551,7 +2387,8 @@ gdbarch_integer_to_address_p (struct gdbarch *gdbarch)
}
CORE_ADDR
-gdbarch_integer_to_address (struct gdbarch *gdbarch, struct type *type, const gdb_byte *buf)
+gdbarch_integer_to_address (struct gdbarch *gdbarch, struct type *type,
+ const gdb_byte *buf)
{
gdb_assert (gdbarch != NULL);
gdb_assert (gdbarch->integer_to_address != NULL);
@@ -2561,8 +2398,8 @@ gdbarch_integer_to_address (struct gdbarch *gdbarch, struct type *type, const gd
}
void
-set_gdbarch_integer_to_address (struct gdbarch *gdbarch,
- gdbarch_integer_to_address_ftype integer_to_address)
+set_gdbarch_integer_to_address (
+ struct gdbarch *gdbarch, gdbarch_integer_to_address_ftype integer_to_address)
{
gdbarch->integer_to_address = integer_to_address;
}
@@ -2575,24 +2412,30 @@ set_gdbarch_return_value (struct gdbarch *gdbarch,
}
enum return_value_convention
-gdbarch_return_value_as_value (struct gdbarch *gdbarch, struct value *function, struct type *valtype, struct regcache *regcache, struct value **read_value, const gdb_byte *writebuf)
+gdbarch_return_value_as_value (struct gdbarch *gdbarch, struct value *function,
+ struct type *valtype, struct regcache *regcache,
+ struct value **read_value,
+ const gdb_byte *writebuf)
{
gdb_assert (gdbarch != NULL);
gdb_assert (gdbarch->return_value_as_value != NULL);
if (gdbarch_debug >= 2)
gdb_printf (gdb_stdlog, "gdbarch_return_value_as_value called\n");
- return gdbarch->return_value_as_value (gdbarch, function, valtype, regcache, read_value, writebuf);
+ return gdbarch->return_value_as_value (gdbarch, function, valtype, regcache,
+ read_value, writebuf);
}
void
-set_gdbarch_return_value_as_value (struct gdbarch *gdbarch,
- gdbarch_return_value_as_value_ftype return_value_as_value)
+set_gdbarch_return_value_as_value (
+ struct gdbarch *gdbarch,
+ gdbarch_return_value_as_value_ftype return_value_as_value)
{
gdbarch->return_value_as_value = return_value_as_value;
}
CORE_ADDR
-gdbarch_get_return_buf_addr (struct gdbarch *gdbarch, struct type *val_type, frame_info_ptr cur_frame)
+gdbarch_get_return_buf_addr (struct gdbarch *gdbarch, struct type *val_type,
+ frame_info_ptr cur_frame)
{
gdb_assert (gdbarch != NULL);
gdb_assert (gdbarch->get_return_buf_addr != NULL);
@@ -2602,14 +2445,16 @@ gdbarch_get_return_buf_addr (struct gdbarch *gdbarch, struct type *val_type, fra
}
void
-set_gdbarch_get_return_buf_addr (struct gdbarch *gdbarch,
- gdbarch_get_return_buf_addr_ftype get_return_buf_addr)
+set_gdbarch_get_return_buf_addr (
+ struct gdbarch *gdbarch,
+ gdbarch_get_return_buf_addr_ftype get_return_buf_addr)
{
gdbarch->get_return_buf_addr = get_return_buf_addr;
}
int
-gdbarch_return_in_first_hidden_param_p (struct gdbarch *gdbarch, struct type *type)
+gdbarch_return_in_first_hidden_param_p (struct gdbarch *gdbarch,
+ struct type *type)
{
gdb_assert (gdbarch != NULL);
gdb_assert (gdbarch->return_in_first_hidden_param_p != NULL);
@@ -2619,8 +2464,9 @@ gdbarch_return_in_first_hidden_param_p (struct gdbarch *gdbarch, struct type *ty
}
void
-set_gdbarch_return_in_first_hidden_param_p (struct gdbarch *gdbarch,
- gdbarch_return_in_first_hidden_param_p_ftype return_in_first_hidden_param_p)
+set_gdbarch_return_in_first_hidden_param_p (
+ struct gdbarch *gdbarch,
+ gdbarch_return_in_first_hidden_param_p_ftype return_in_first_hidden_param_p)
{
gdbarch->return_in_first_hidden_param_p = return_in_first_hidden_param_p;
}
@@ -2660,8 +2506,8 @@ gdbarch_skip_main_prologue (struct gdbarch *gdbarch, CORE_ADDR ip)
}
void
-set_gdbarch_skip_main_prologue (struct gdbarch *gdbarch,
- gdbarch_skip_main_prologue_ftype skip_main_prologue)
+set_gdbarch_skip_main_prologue (
+ struct gdbarch *gdbarch, gdbarch_skip_main_prologue_ftype skip_main_prologue)
{
gdbarch->skip_main_prologue = skip_main_prologue;
}
@@ -2708,7 +2554,8 @@ set_gdbarch_inner_than (struct gdbarch *gdbarch,
}
const gdb_byte *
-gdbarch_breakpoint_from_pc (struct gdbarch *gdbarch, CORE_ADDR *pcptr, int *lenptr)
+gdbarch_breakpoint_from_pc (struct gdbarch *gdbarch, CORE_ADDR *pcptr,
+ int *lenptr)
{
gdb_assert (gdbarch != NULL);
gdb_assert (gdbarch->breakpoint_from_pc != NULL);
@@ -2718,8 +2565,8 @@ gdbarch_breakpoint_from_pc (struct gdbarch *gdbarch, CORE_ADDR *pcptr, int *lenp
}
void
-set_gdbarch_breakpoint_from_pc (struct gdbarch *gdbarch,
- gdbarch_breakpoint_from_pc_ftype breakpoint_from_pc)
+set_gdbarch_breakpoint_from_pc (
+ struct gdbarch *gdbarch, gdbarch_breakpoint_from_pc_ftype breakpoint_from_pc)
{
gdbarch->breakpoint_from_pc = breakpoint_from_pc;
}
@@ -2735,8 +2582,9 @@ gdbarch_breakpoint_kind_from_pc (struct gdbarch *gdbarch, CORE_ADDR *pcptr)
}
void
-set_gdbarch_breakpoint_kind_from_pc (struct gdbarch *gdbarch,
- gdbarch_breakpoint_kind_from_pc_ftype breakpoint_kind_from_pc)
+set_gdbarch_breakpoint_kind_from_pc (
+ struct gdbarch *gdbarch,
+ gdbarch_breakpoint_kind_from_pc_ftype breakpoint_kind_from_pc)
{
gdbarch->breakpoint_kind_from_pc = breakpoint_kind_from_pc;
}
@@ -2752,27 +2600,34 @@ gdbarch_sw_breakpoint_from_kind (struct gdbarch *gdbarch, int kind, int *size)
}
void
-set_gdbarch_sw_breakpoint_from_kind (struct gdbarch *gdbarch,
- gdbarch_sw_breakpoint_from_kind_ftype sw_breakpoint_from_kind)
+set_gdbarch_sw_breakpoint_from_kind (
+ struct gdbarch *gdbarch,
+ gdbarch_sw_breakpoint_from_kind_ftype sw_breakpoint_from_kind)
{
gdbarch->sw_breakpoint_from_kind = sw_breakpoint_from_kind;
}
int
-gdbarch_breakpoint_kind_from_current_state (struct gdbarch *gdbarch, struct regcache *regcache, CORE_ADDR *pcptr)
+gdbarch_breakpoint_kind_from_current_state (struct gdbarch *gdbarch,
+ struct regcache *regcache,
+ CORE_ADDR *pcptr)
{
gdb_assert (gdbarch != NULL);
gdb_assert (gdbarch->breakpoint_kind_from_current_state != NULL);
if (gdbarch_debug >= 2)
- gdb_printf (gdb_stdlog, "gdbarch_breakpoint_kind_from_current_state called\n");
- return gdbarch->breakpoint_kind_from_current_state (gdbarch, regcache, pcptr);
+ gdb_printf (gdb_stdlog,
+ "gdbarch_breakpoint_kind_from_current_state called\n");
+ return gdbarch->breakpoint_kind_from_current_state (gdbarch, regcache,
+ pcptr);
}
void
-set_gdbarch_breakpoint_kind_from_current_state (struct gdbarch *gdbarch,
- gdbarch_breakpoint_kind_from_current_state_ftype breakpoint_kind_from_current_state)
+set_gdbarch_breakpoint_kind_from_current_state (
+ struct gdbarch *gdbarch, gdbarch_breakpoint_kind_from_current_state_ftype
+ breakpoint_kind_from_current_state)
{
- gdbarch->breakpoint_kind_from_current_state = breakpoint_kind_from_current_state;
+ gdbarch->breakpoint_kind_from_current_state
+ = breakpoint_kind_from_current_state;
}
bool
@@ -2793,14 +2648,16 @@ gdbarch_adjust_breakpoint_address (struct gdbarch *gdbarch, CORE_ADDR bpaddr)
}
void
-set_gdbarch_adjust_breakpoint_address (struct gdbarch *gdbarch,
- gdbarch_adjust_breakpoint_address_ftype adjust_breakpoint_address)
+set_gdbarch_adjust_breakpoint_address (
+ struct gdbarch *gdbarch,
+ gdbarch_adjust_breakpoint_address_ftype adjust_breakpoint_address)
{
gdbarch->adjust_breakpoint_address = adjust_breakpoint_address;
}
int
-gdbarch_memory_insert_breakpoint (struct gdbarch *gdbarch, struct bp_target_info *bp_tgt)
+gdbarch_memory_insert_breakpoint (struct gdbarch *gdbarch,
+ struct bp_target_info *bp_tgt)
{
gdb_assert (gdbarch != NULL);
gdb_assert (gdbarch->memory_insert_breakpoint != NULL);
@@ -2810,14 +2667,16 @@ gdbarch_memory_insert_breakpoint (struct gdbarch *gdbarch, struct bp_target_info
}
void
-set_gdbarch_memory_insert_breakpoint (struct gdbarch *gdbarch,
- gdbarch_memory_insert_breakpoint_ftype memory_insert_breakpoint)
+set_gdbarch_memory_insert_breakpoint (
+ struct gdbarch *gdbarch,
+ gdbarch_memory_insert_breakpoint_ftype memory_insert_breakpoint)
{
gdbarch->memory_insert_breakpoint = memory_insert_breakpoint;
}
int
-gdbarch_memory_remove_breakpoint (struct gdbarch *gdbarch, struct bp_target_info *bp_tgt)
+gdbarch_memory_remove_breakpoint (struct gdbarch *gdbarch,
+ struct bp_target_info *bp_tgt)
{
gdb_assert (gdbarch != NULL);
gdb_assert (gdbarch->memory_remove_breakpoint != NULL);
@@ -2827,8 +2686,9 @@ gdbarch_memory_remove_breakpoint (struct gdbarch *gdbarch, struct bp_target_info
}
void
-set_gdbarch_memory_remove_breakpoint (struct gdbarch *gdbarch,
- gdbarch_memory_remove_breakpoint_ftype memory_remove_breakpoint)
+set_gdbarch_memory_remove_breakpoint (
+ struct gdbarch *gdbarch,
+ gdbarch_memory_remove_breakpoint_ftype memory_remove_breakpoint)
{
gdbarch->memory_remove_breakpoint = memory_remove_breakpoint;
}
@@ -2856,13 +2716,14 @@ gdbarch_deprecated_function_start_offset (struct gdbarch *gdbarch)
gdb_assert (gdbarch != NULL);
/* Skip verify of deprecated_function_start_offset, invalid_p == 0 */
if (gdbarch_debug >= 2)
- gdb_printf (gdb_stdlog, "gdbarch_deprecated_function_start_offset called\n");
+ gdb_printf (gdb_stdlog,
+ "gdbarch_deprecated_function_start_offset called\n");
return gdbarch->deprecated_function_start_offset;
}
void
-set_gdbarch_deprecated_function_start_offset (struct gdbarch *gdbarch,
- CORE_ADDR deprecated_function_start_offset)
+set_gdbarch_deprecated_function_start_offset (
+ struct gdbarch *gdbarch, CORE_ADDR deprecated_function_start_offset)
{
gdbarch->deprecated_function_start_offset = deprecated_function_start_offset;
}
@@ -2878,8 +2739,9 @@ gdbarch_remote_register_number (struct gdbarch *gdbarch, int regno)
}
void
-set_gdbarch_remote_register_number (struct gdbarch *gdbarch,
- gdbarch_remote_register_number_ftype remote_register_number)
+set_gdbarch_remote_register_number (
+ struct gdbarch *gdbarch,
+ gdbarch_remote_register_number_ftype remote_register_number)
{
gdbarch->remote_register_number = remote_register_number;
}
@@ -2892,7 +2754,8 @@ gdbarch_fetch_tls_load_module_address_p (struct gdbarch *gdbarch)
}
CORE_ADDR
-gdbarch_fetch_tls_load_module_address (struct gdbarch *gdbarch, struct objfile *objfile)
+gdbarch_fetch_tls_load_module_address (struct gdbarch *gdbarch,
+ struct objfile *objfile)
{
gdb_assert (gdbarch != NULL);
gdb_assert (gdbarch->fetch_tls_load_module_address != NULL);
@@ -2902,8 +2765,9 @@ gdbarch_fetch_tls_load_module_address (struct gdbarch *gdbarch, struct objfile *
}
void
-set_gdbarch_fetch_tls_load_module_address (struct gdbarch *gdbarch,
- gdbarch_fetch_tls_load_module_address_ftype fetch_tls_load_module_address)
+set_gdbarch_fetch_tls_load_module_address (
+ struct gdbarch *gdbarch,
+ gdbarch_fetch_tls_load_module_address_ftype fetch_tls_load_module_address)
{
gdbarch->fetch_tls_load_module_address = fetch_tls_load_module_address;
}
@@ -2916,7 +2780,8 @@ gdbarch_get_thread_local_address_p (struct gdbarch *gdbarch)
}
CORE_ADDR
-gdbarch_get_thread_local_address (struct gdbarch *gdbarch, ptid_t ptid, CORE_ADDR lm_addr, CORE_ADDR offset)
+gdbarch_get_thread_local_address (struct gdbarch *gdbarch, ptid_t ptid,
+ CORE_ADDR lm_addr, CORE_ADDR offset)
{
gdb_assert (gdbarch != NULL);
gdb_assert (gdbarch->get_thread_local_address != NULL);
@@ -2926,8 +2791,9 @@ gdbarch_get_thread_local_address (struct gdbarch *gdbarch, ptid_t ptid, CORE_ADD
}
void
-set_gdbarch_get_thread_local_address (struct gdbarch *gdbarch,
- gdbarch_get_thread_local_address_ftype get_thread_local_address)
+set_gdbarch_get_thread_local_address (
+ struct gdbarch *gdbarch,
+ gdbarch_get_thread_local_address_ftype get_thread_local_address)
{
gdbarch->get_thread_local_address = get_thread_local_address;
}
@@ -3042,8 +2908,9 @@ gdbarch_stabs_argument_has_addr (struct gdbarch *gdbarch, struct type *type)
}
void
-set_gdbarch_stabs_argument_has_addr (struct gdbarch *gdbarch,
- gdbarch_stabs_argument_has_addr_ftype stabs_argument_has_addr)
+set_gdbarch_stabs_argument_has_addr (
+ struct gdbarch *gdbarch,
+ gdbarch_stabs_argument_has_addr_ftype stabs_argument_has_addr)
{
gdbarch->stabs_argument_has_addr = stabs_argument_has_addr;
}
@@ -3066,7 +2933,8 @@ set_gdbarch_frame_red_zone_size (struct gdbarch *gdbarch,
}
CORE_ADDR
-gdbarch_convert_from_func_ptr_addr (struct gdbarch *gdbarch, CORE_ADDR addr, struct target_ops *targ)
+gdbarch_convert_from_func_ptr_addr (struct gdbarch *gdbarch, CORE_ADDR addr,
+ struct target_ops *targ)
{
gdb_assert (gdbarch != NULL);
gdb_assert (gdbarch->convert_from_func_ptr_addr != NULL);
@@ -3076,8 +2944,9 @@ gdbarch_convert_from_func_ptr_addr (struct gdbarch *gdbarch, CORE_ADDR addr, str
}
void
-set_gdbarch_convert_from_func_ptr_addr (struct gdbarch *gdbarch,
- gdbarch_convert_from_func_ptr_addr_ftype convert_from_func_ptr_addr)
+set_gdbarch_convert_from_func_ptr_addr (
+ struct gdbarch *gdbarch,
+ gdbarch_convert_from_func_ptr_addr_ftype convert_from_func_ptr_addr)
{
gdbarch->convert_from_func_ptr_addr = convert_from_func_ptr_addr;
}
@@ -3110,8 +2979,9 @@ gdbarch_remove_non_address_bits (struct gdbarch *gdbarch, CORE_ADDR pointer)
}
void
-set_gdbarch_remove_non_address_bits (struct gdbarch *gdbarch,
- gdbarch_remove_non_address_bits_ftype remove_non_address_bits)
+set_gdbarch_remove_non_address_bits (
+ struct gdbarch *gdbarch,
+ gdbarch_remove_non_address_bits_ftype remove_non_address_bits)
{
gdbarch->remove_non_address_bits = remove_non_address_bits;
}
@@ -3168,7 +3038,9 @@ set_gdbarch_memtag_matches_p (struct gdbarch *gdbarch,
}
bool
-gdbarch_set_memtags (struct gdbarch *gdbarch, struct value *address, size_t length, const gdb::byte_vector &tags, memtag_type tag_type)
+gdbarch_set_memtags (struct gdbarch *gdbarch, struct value *address,
+ size_t length, const gdb::byte_vector &tags,
+ memtag_type tag_type)
{
gdb_assert (gdbarch != NULL);
gdb_assert (gdbarch->set_memtags != NULL);
@@ -3185,7 +3057,8 @@ set_gdbarch_set_memtags (struct gdbarch *gdbarch,
}
struct value *
-gdbarch_get_memtag (struct gdbarch *gdbarch, struct value *address, memtag_type tag_type)
+gdbarch_get_memtag (struct gdbarch *gdbarch, struct value *address,
+ memtag_type tag_type)
{
gdb_assert (gdbarch != NULL);
gdb_assert (gdbarch->get_memtag != NULL);
@@ -3226,7 +3099,8 @@ gdbarch_software_single_step_p (struct gdbarch *gdbarch)
}
std::vector<CORE_ADDR>
-gdbarch_software_single_step (struct gdbarch *gdbarch, struct regcache *regcache)
+gdbarch_software_single_step (struct gdbarch *gdbarch,
+ struct regcache *regcache)
{
gdb_assert (gdbarch != NULL);
gdb_assert (gdbarch->software_single_step != NULL);
@@ -3236,8 +3110,9 @@ gdbarch_software_single_step (struct gdbarch *gdbarch, struct regcache *regcache
}
void
-set_gdbarch_software_single_step (struct gdbarch *gdbarch,
- gdbarch_software_single_step_ftype software_single_step)
+set_gdbarch_software_single_step (
+ struct gdbarch *gdbarch,
+ gdbarch_software_single_step_ftype software_single_step)
{
gdbarch->software_single_step = software_single_step;
}
@@ -3250,7 +3125,8 @@ gdbarch_single_step_through_delay_p (struct gdbarch *gdbarch)
}
int
-gdbarch_single_step_through_delay (struct gdbarch *gdbarch, frame_info_ptr frame)
+gdbarch_single_step_through_delay (struct gdbarch *gdbarch,
+ frame_info_ptr frame)
{
gdb_assert (gdbarch != NULL);
gdb_assert (gdbarch->single_step_through_delay != NULL);
@@ -3260,14 +3136,16 @@ gdbarch_single_step_through_delay (struct gdbarch *gdbarch, frame_info_ptr frame
}
void
-set_gdbarch_single_step_through_delay (struct gdbarch *gdbarch,
- gdbarch_single_step_through_delay_ftype single_step_through_delay)
+set_gdbarch_single_step_through_delay (
+ struct gdbarch *gdbarch,
+ gdbarch_single_step_through_delay_ftype single_step_through_delay)
{
gdbarch->single_step_through_delay = single_step_through_delay;
}
int
-gdbarch_print_insn (struct gdbarch *gdbarch, bfd_vma vma, struct disassemble_info *info)
+gdbarch_print_insn (struct gdbarch *gdbarch, bfd_vma vma,
+ struct disassemble_info *info)
{
gdb_assert (gdbarch != NULL);
gdb_assert (gdbarch->print_insn != NULL);
@@ -3284,7 +3162,8 @@ set_gdbarch_print_insn (struct gdbarch *gdbarch,
}
CORE_ADDR
-gdbarch_skip_trampoline_code (struct gdbarch *gdbarch, frame_info_ptr frame, CORE_ADDR pc)
+gdbarch_skip_trampoline_code (struct gdbarch *gdbarch, frame_info_ptr frame,
+ CORE_ADDR pc)
{
gdb_assert (gdbarch != NULL);
gdb_assert (gdbarch->skip_trampoline_code != NULL);
@@ -3294,8 +3173,9 @@ gdbarch_skip_trampoline_code (struct gdbarch *gdbarch, frame_info_ptr frame, COR
}
void
-set_gdbarch_skip_trampoline_code (struct gdbarch *gdbarch,
- gdbarch_skip_trampoline_code_ftype skip_trampoline_code)
+set_gdbarch_skip_trampoline_code (
+ struct gdbarch *gdbarch,
+ gdbarch_skip_trampoline_code_ftype skip_trampoline_code)
{
gdbarch->skip_trampoline_code = skip_trampoline_code;
}
@@ -3311,7 +3191,7 @@ gdbarch_so_ops (struct gdbarch *gdbarch)
void
set_gdbarch_so_ops (struct gdbarch *gdbarch,
- const struct target_so_ops * so_ops)
+ const struct target_so_ops *so_ops)
{
gdbarch->so_ops = so_ops;
}
@@ -3327,14 +3207,16 @@ gdbarch_skip_solib_resolver (struct gdbarch *gdbarch, CORE_ADDR pc)
}
void
-set_gdbarch_skip_solib_resolver (struct gdbarch *gdbarch,
- gdbarch_skip_solib_resolver_ftype skip_solib_resolver)
+set_gdbarch_skip_solib_resolver (
+ struct gdbarch *gdbarch,
+ gdbarch_skip_solib_resolver_ftype skip_solib_resolver)
{
gdbarch->skip_solib_resolver = skip_solib_resolver;
}
int
-gdbarch_in_solib_return_trampoline (struct gdbarch *gdbarch, CORE_ADDR pc, const char *name)
+gdbarch_in_solib_return_trampoline (struct gdbarch *gdbarch, CORE_ADDR pc,
+ const char *name)
{
gdb_assert (gdbarch != NULL);
gdb_assert (gdbarch->in_solib_return_trampoline != NULL);
@@ -3344,8 +3226,9 @@ gdbarch_in_solib_return_trampoline (struct gdbarch *gdbarch, CORE_ADDR pc, const
}
void
-set_gdbarch_in_solib_return_trampoline (struct gdbarch *gdbarch,
- gdbarch_in_solib_return_trampoline_ftype in_solib_return_trampoline)
+set_gdbarch_in_solib_return_trampoline (
+ struct gdbarch *gdbarch,
+ gdbarch_in_solib_return_trampoline_ftype in_solib_return_trampoline)
{
gdbarch->in_solib_return_trampoline = in_solib_return_trampoline;
}
@@ -3361,8 +3244,9 @@ gdbarch_in_indirect_branch_thunk (struct gdbarch *gdbarch, CORE_ADDR pc)
}
void
-set_gdbarch_in_indirect_branch_thunk (struct gdbarch *gdbarch,
- gdbarch_in_indirect_branch_thunk_ftype in_indirect_branch_thunk)
+set_gdbarch_in_indirect_branch_thunk (
+ struct gdbarch *gdbarch,
+ gdbarch_in_indirect_branch_thunk_ftype in_indirect_branch_thunk)
{
gdbarch->in_indirect_branch_thunk = in_indirect_branch_thunk;
}
@@ -3378,8 +3262,9 @@ gdbarch_stack_frame_destroyed_p (struct gdbarch *gdbarch, CORE_ADDR addr)
}
void
-set_gdbarch_stack_frame_destroyed_p (struct gdbarch *gdbarch,
- gdbarch_stack_frame_destroyed_p_ftype stack_frame_destroyed_p)
+set_gdbarch_stack_frame_destroyed_p (
+ struct gdbarch *gdbarch,
+ gdbarch_stack_frame_destroyed_p_ftype stack_frame_destroyed_p)
{
gdbarch->stack_frame_destroyed_p = stack_frame_destroyed_p;
}
@@ -3392,7 +3277,8 @@ gdbarch_elf_make_msymbol_special_p (struct gdbarch *gdbarch)
}
void
-gdbarch_elf_make_msymbol_special (struct gdbarch *gdbarch, asymbol *sym, struct minimal_symbol *msym)
+gdbarch_elf_make_msymbol_special (struct gdbarch *gdbarch, asymbol *sym,
+ struct minimal_symbol *msym)
{
gdb_assert (gdbarch != NULL);
gdb_assert (gdbarch->elf_make_msymbol_special != NULL);
@@ -3402,14 +3288,16 @@ gdbarch_elf_make_msymbol_special (struct gdbarch *gdbarch, asymbol *sym, struct
}
void
-set_gdbarch_elf_make_msymbol_special (struct gdbarch *gdbarch,
- gdbarch_elf_make_msymbol_special_ftype elf_make_msymbol_special)
+set_gdbarch_elf_make_msymbol_special (
+ struct gdbarch *gdbarch,
+ gdbarch_elf_make_msymbol_special_ftype elf_make_msymbol_special)
{
gdbarch->elf_make_msymbol_special = elf_make_msymbol_special;
}
void
-gdbarch_coff_make_msymbol_special (struct gdbarch *gdbarch, int val, struct minimal_symbol *msym)
+gdbarch_coff_make_msymbol_special (struct gdbarch *gdbarch, int val,
+ struct minimal_symbol *msym)
{
gdb_assert (gdbarch != NULL);
gdb_assert (gdbarch->coff_make_msymbol_special != NULL);
@@ -3419,14 +3307,16 @@ gdbarch_coff_make_msymbol_special (struct gdbarch *gdbarch, int val, struct mini
}
void
-set_gdbarch_coff_make_msymbol_special (struct gdbarch *gdbarch,
- gdbarch_coff_make_msymbol_special_ftype coff_make_msymbol_special)
+set_gdbarch_coff_make_msymbol_special (
+ struct gdbarch *gdbarch,
+ gdbarch_coff_make_msymbol_special_ftype coff_make_msymbol_special)
{
gdbarch->coff_make_msymbol_special = coff_make_msymbol_special;
}
void
-gdbarch_make_symbol_special (struct gdbarch *gdbarch, struct symbol *sym, struct objfile *objfile)
+gdbarch_make_symbol_special (struct gdbarch *gdbarch, struct symbol *sym,
+ struct objfile *objfile)
{
gdb_assert (gdbarch != NULL);
gdb_assert (gdbarch->make_symbol_special != NULL);
@@ -3436,8 +3326,9 @@ gdbarch_make_symbol_special (struct gdbarch *gdbarch, struct symbol *sym, struct
}
void
-set_gdbarch_make_symbol_special (struct gdbarch *gdbarch,
- gdbarch_make_symbol_special_ftype make_symbol_special)
+set_gdbarch_make_symbol_special (
+ struct gdbarch *gdbarch,
+ gdbarch_make_symbol_special_ftype make_symbol_special)
{
gdbarch->make_symbol_special = make_symbol_special;
}
@@ -3453,8 +3344,8 @@ gdbarch_adjust_dwarf2_addr (struct gdbarch *gdbarch, CORE_ADDR pc)
}
void
-set_gdbarch_adjust_dwarf2_addr (struct gdbarch *gdbarch,
- gdbarch_adjust_dwarf2_addr_ftype adjust_dwarf2_addr)
+set_gdbarch_adjust_dwarf2_addr (
+ struct gdbarch *gdbarch, gdbarch_adjust_dwarf2_addr_ftype adjust_dwarf2_addr)
{
gdbarch->adjust_dwarf2_addr = adjust_dwarf2_addr;
}
@@ -3470,8 +3361,8 @@ gdbarch_adjust_dwarf2_line (struct gdbarch *gdbarch, CORE_ADDR addr, int rel)
}
void
-set_gdbarch_adjust_dwarf2_line (struct gdbarch *gdbarch,
- gdbarch_adjust_dwarf2_line_ftype adjust_dwarf2_line)
+set_gdbarch_adjust_dwarf2_line (
+ struct gdbarch *gdbarch, gdbarch_adjust_dwarf2_line_ftype adjust_dwarf2_line)
{
gdbarch->adjust_dwarf2_line = adjust_dwarf2_line;
}
@@ -3518,7 +3409,8 @@ gdbarch_address_class_type_flags_p (struct gdbarch *gdbarch)
}
type_instance_flags
-gdbarch_address_class_type_flags (struct gdbarch *gdbarch, int byte_size, int dwarf2_addr_class)
+gdbarch_address_class_type_flags (struct gdbarch *gdbarch, int byte_size,
+ int dwarf2_addr_class)
{
gdb_assert (gdbarch != NULL);
gdb_assert (gdbarch->address_class_type_flags != NULL);
@@ -3528,8 +3420,9 @@ gdbarch_address_class_type_flags (struct gdbarch *gdbarch, int byte_size, int dw
}
void
-set_gdbarch_address_class_type_flags (struct gdbarch *gdbarch,
- gdbarch_address_class_type_flags_ftype address_class_type_flags)
+set_gdbarch_address_class_type_flags (
+ struct gdbarch *gdbarch,
+ gdbarch_address_class_type_flags_ftype address_class_type_flags)
{
gdbarch->address_class_type_flags = address_class_type_flags;
}
@@ -3542,24 +3435,28 @@ gdbarch_address_class_type_flags_to_name_p (struct gdbarch *gdbarch)
}
const char *
-gdbarch_address_class_type_flags_to_name (struct gdbarch *gdbarch, type_instance_flags type_flags)
+gdbarch_address_class_type_flags_to_name (struct gdbarch *gdbarch,
+ type_instance_flags type_flags)
{
gdb_assert (gdbarch != NULL);
gdb_assert (gdbarch->address_class_type_flags_to_name != NULL);
if (gdbarch_debug >= 2)
- gdb_printf (gdb_stdlog, "gdbarch_address_class_type_flags_to_name called\n");
+ gdb_printf (gdb_stdlog,
+ "gdbarch_address_class_type_flags_to_name called\n");
return gdbarch->address_class_type_flags_to_name (gdbarch, type_flags);
}
void
-set_gdbarch_address_class_type_flags_to_name (struct gdbarch *gdbarch,
- gdbarch_address_class_type_flags_to_name_ftype address_class_type_flags_to_name)
+set_gdbarch_address_class_type_flags_to_name (
+ struct gdbarch *gdbarch, gdbarch_address_class_type_flags_to_name_ftype
+ address_class_type_flags_to_name)
{
gdbarch->address_class_type_flags_to_name = address_class_type_flags_to_name;
}
bool
-gdbarch_execute_dwarf_cfa_vendor_op (struct gdbarch *gdbarch, gdb_byte op, struct dwarf2_frame_state *fs)
+gdbarch_execute_dwarf_cfa_vendor_op (struct gdbarch *gdbarch, gdb_byte op,
+ struct dwarf2_frame_state *fs)
{
gdb_assert (gdbarch != NULL);
gdb_assert (gdbarch->execute_dwarf_cfa_vendor_op != NULL);
@@ -3569,8 +3466,9 @@ gdbarch_execute_dwarf_cfa_vendor_op (struct gdbarch *gdbarch, gdb_byte op, struc
}
void
-set_gdbarch_execute_dwarf_cfa_vendor_op (struct gdbarch *gdbarch,
- gdbarch_execute_dwarf_cfa_vendor_op_ftype execute_dwarf_cfa_vendor_op)
+set_gdbarch_execute_dwarf_cfa_vendor_op (
+ struct gdbarch *gdbarch,
+ gdbarch_execute_dwarf_cfa_vendor_op_ftype execute_dwarf_cfa_vendor_op)
{
gdbarch->execute_dwarf_cfa_vendor_op = execute_dwarf_cfa_vendor_op;
}
@@ -3583,24 +3481,30 @@ gdbarch_address_class_name_to_type_flags_p (struct gdbarch *gdbarch)
}
bool
-gdbarch_address_class_name_to_type_flags (struct gdbarch *gdbarch, const char *name, type_instance_flags *type_flags_ptr)
+gdbarch_address_class_name_to_type_flags (struct gdbarch *gdbarch,
+ const char *name,
+ type_instance_flags *type_flags_ptr)
{
gdb_assert (gdbarch != NULL);
gdb_assert (gdbarch->address_class_name_to_type_flags != NULL);
if (gdbarch_debug >= 2)
- gdb_printf (gdb_stdlog, "gdbarch_address_class_name_to_type_flags called\n");
- return gdbarch->address_class_name_to_type_flags (gdbarch, name, type_flags_ptr);
+ gdb_printf (gdb_stdlog,
+ "gdbarch_address_class_name_to_type_flags called\n");
+ return gdbarch->address_class_name_to_type_flags (gdbarch, name,
+ type_flags_ptr);
}
void
-set_gdbarch_address_class_name_to_type_flags (struct gdbarch *gdbarch,
- gdbarch_address_class_name_to_type_flags_ftype address_class_name_to_type_flags)
+set_gdbarch_address_class_name_to_type_flags (
+ struct gdbarch *gdbarch, gdbarch_address_class_name_to_type_flags_ftype
+ address_class_name_to_type_flags)
{
gdbarch->address_class_name_to_type_flags = address_class_name_to_type_flags;
}
int
-gdbarch_register_reggroup_p (struct gdbarch *gdbarch, int regnum, const struct reggroup *reggroup)
+gdbarch_register_reggroup_p (struct gdbarch *gdbarch, int regnum,
+ const struct reggroup *reggroup)
{
gdb_assert (gdbarch != NULL);
gdb_assert (gdbarch->register_reggroup_p != NULL);
@@ -3610,8 +3514,9 @@ gdbarch_register_reggroup_p (struct gdbarch *gdbarch, int regnum, const struct r
}
void
-set_gdbarch_register_reggroup_p (struct gdbarch *gdbarch,
- gdbarch_register_reggroup_p_ftype register_reggroup_p)
+set_gdbarch_register_reggroup_p (
+ struct gdbarch *gdbarch,
+ gdbarch_register_reggroup_p_ftype register_reggroup_p)
{
gdbarch->register_reggroup_p = register_reggroup_p;
}
@@ -3624,7 +3529,8 @@ gdbarch_fetch_pointer_argument_p (struct gdbarch *gdbarch)
}
CORE_ADDR
-gdbarch_fetch_pointer_argument (struct gdbarch *gdbarch, frame_info_ptr frame, int argi, struct type *type)
+gdbarch_fetch_pointer_argument (struct gdbarch *gdbarch, frame_info_ptr frame,
+ int argi, struct type *type)
{
gdb_assert (gdbarch != NULL);
gdb_assert (gdbarch->fetch_pointer_argument != NULL);
@@ -3634,8 +3540,9 @@ gdbarch_fetch_pointer_argument (struct gdbarch *gdbarch, frame_info_ptr frame, i
}
void
-set_gdbarch_fetch_pointer_argument (struct gdbarch *gdbarch,
- gdbarch_fetch_pointer_argument_ftype fetch_pointer_argument)
+set_gdbarch_fetch_pointer_argument (
+ struct gdbarch *gdbarch,
+ gdbarch_fetch_pointer_argument_ftype fetch_pointer_argument)
{
gdbarch->fetch_pointer_argument = fetch_pointer_argument;
}
@@ -3648,7 +3555,10 @@ gdbarch_iterate_over_regset_sections_p (struct gdbarch *gdbarch)
}
void
-gdbarch_iterate_over_regset_sections (struct gdbarch *gdbarch, iterate_over_regset_sections_cb *cb, void *cb_data, const struct regcache *regcache)
+gdbarch_iterate_over_regset_sections (struct gdbarch *gdbarch,
+ iterate_over_regset_sections_cb *cb,
+ void *cb_data,
+ const struct regcache *regcache)
{
gdb_assert (gdbarch != NULL);
gdb_assert (gdbarch->iterate_over_regset_sections != NULL);
@@ -3658,8 +3568,9 @@ gdbarch_iterate_over_regset_sections (struct gdbarch *gdbarch, iterate_over_regs
}
void
-set_gdbarch_iterate_over_regset_sections (struct gdbarch *gdbarch,
- gdbarch_iterate_over_regset_sections_ftype iterate_over_regset_sections)
+set_gdbarch_iterate_over_regset_sections (
+ struct gdbarch *gdbarch,
+ gdbarch_iterate_over_regset_sections_ftype iterate_over_regset_sections)
{
gdbarch->iterate_over_regset_sections = iterate_over_regset_sections;
}
@@ -3672,7 +3583,8 @@ gdbarch_make_corefile_notes_p (struct gdbarch *gdbarch)
}
gdb::unique_xmalloc_ptr<char>
-gdbarch_make_corefile_notes (struct gdbarch *gdbarch, bfd *obfd, int *note_size)
+gdbarch_make_corefile_notes (struct gdbarch *gdbarch, bfd *obfd,
+ int *note_size)
{
gdb_assert (gdbarch != NULL);
gdb_assert (gdbarch->make_corefile_notes != NULL);
@@ -3682,8 +3594,9 @@ gdbarch_make_corefile_notes (struct gdbarch *gdbarch, bfd *obfd, int *note_size)
}
void
-set_gdbarch_make_corefile_notes (struct gdbarch *gdbarch,
- gdbarch_make_corefile_notes_ftype make_corefile_notes)
+set_gdbarch_make_corefile_notes (
+ struct gdbarch *gdbarch,
+ gdbarch_make_corefile_notes_ftype make_corefile_notes)
{
gdbarch->make_corefile_notes = make_corefile_notes;
}
@@ -3696,7 +3609,8 @@ gdbarch_find_memory_regions_p (struct gdbarch *gdbarch)
}
int
-gdbarch_find_memory_regions (struct gdbarch *gdbarch, find_memory_region_ftype func, void *data)
+gdbarch_find_memory_regions (struct gdbarch *gdbarch,
+ find_memory_region_ftype func, void *data)
{
gdb_assert (gdbarch != NULL);
gdb_assert (gdbarch->find_memory_regions != NULL);
@@ -3706,8 +3620,9 @@ gdbarch_find_memory_regions (struct gdbarch *gdbarch, find_memory_region_ftype f
}
void
-set_gdbarch_find_memory_regions (struct gdbarch *gdbarch,
- gdbarch_find_memory_regions_ftype find_memory_regions)
+set_gdbarch_find_memory_regions (
+ struct gdbarch *gdbarch,
+ gdbarch_find_memory_regions_ftype find_memory_regions)
{
gdbarch->find_memory_regions = find_memory_regions;
}
@@ -3720,7 +3635,8 @@ gdbarch_create_memtag_section_p (struct gdbarch *gdbarch)
}
asection *
-gdbarch_create_memtag_section (struct gdbarch *gdbarch, bfd *obfd, CORE_ADDR address, size_t size)
+gdbarch_create_memtag_section (struct gdbarch *gdbarch, bfd *obfd,
+ CORE_ADDR address, size_t size)
{
gdb_assert (gdbarch != NULL);
gdb_assert (gdbarch->create_memtag_section != NULL);
@@ -3730,8 +3646,9 @@ gdbarch_create_memtag_section (struct gdbarch *gdbarch, bfd *obfd, CORE_ADDR add
}
void
-set_gdbarch_create_memtag_section (struct gdbarch *gdbarch,
- gdbarch_create_memtag_section_ftype create_memtag_section)
+set_gdbarch_create_memtag_section (
+ struct gdbarch *gdbarch,
+ gdbarch_create_memtag_section_ftype create_memtag_section)
{
gdbarch->create_memtag_section = create_memtag_section;
}
@@ -3754,8 +3671,9 @@ gdbarch_fill_memtag_section (struct gdbarch *gdbarch, asection *osec)
}
void
-set_gdbarch_fill_memtag_section (struct gdbarch *gdbarch,
- gdbarch_fill_memtag_section_ftype fill_memtag_section)
+set_gdbarch_fill_memtag_section (
+ struct gdbarch *gdbarch,
+ gdbarch_fill_memtag_section_ftype fill_memtag_section)
{
gdbarch->fill_memtag_section = fill_memtag_section;
}
@@ -3768,18 +3686,21 @@ gdbarch_decode_memtag_section_p (struct gdbarch *gdbarch)
}
gdb::byte_vector
-gdbarch_decode_memtag_section (struct gdbarch *gdbarch, bfd_section *section, int type, CORE_ADDR address, size_t length)
+gdbarch_decode_memtag_section (struct gdbarch *gdbarch, bfd_section *section,
+ int type, CORE_ADDR address, size_t length)
{
gdb_assert (gdbarch != NULL);
gdb_assert (gdbarch->decode_memtag_section != NULL);
if (gdbarch_debug >= 2)
gdb_printf (gdb_stdlog, "gdbarch_decode_memtag_section called\n");
- return gdbarch->decode_memtag_section (gdbarch, section, type, address, length);
+ return gdbarch->decode_memtag_section (gdbarch, section, type, address,
+ length);
}
void
-set_gdbarch_decode_memtag_section (struct gdbarch *gdbarch,
- gdbarch_decode_memtag_section_ftype decode_memtag_section)
+set_gdbarch_decode_memtag_section (
+ struct gdbarch *gdbarch,
+ gdbarch_decode_memtag_section_ftype decode_memtag_section)
{
gdbarch->decode_memtag_section = decode_memtag_section;
}
@@ -3792,7 +3713,8 @@ gdbarch_core_xfer_shared_libraries_p (struct gdbarch *gdbarch)
}
ULONGEST
-gdbarch_core_xfer_shared_libraries (struct gdbarch *gdbarch, gdb_byte *readbuf, ULONGEST offset, ULONGEST len)
+gdbarch_core_xfer_shared_libraries (struct gdbarch *gdbarch, gdb_byte *readbuf,
+ ULONGEST offset, ULONGEST len)
{
gdb_assert (gdbarch != NULL);
gdb_assert (gdbarch->core_xfer_shared_libraries != NULL);
@@ -3802,8 +3724,9 @@ gdbarch_core_xfer_shared_libraries (struct gdbarch *gdbarch, gdb_byte *readbuf,
}
void
-set_gdbarch_core_xfer_shared_libraries (struct gdbarch *gdbarch,
- gdbarch_core_xfer_shared_libraries_ftype core_xfer_shared_libraries)
+set_gdbarch_core_xfer_shared_libraries (
+ struct gdbarch *gdbarch,
+ gdbarch_core_xfer_shared_libraries_ftype core_xfer_shared_libraries)
{
gdbarch->core_xfer_shared_libraries = core_xfer_shared_libraries;
}
@@ -3816,18 +3739,22 @@ gdbarch_core_xfer_shared_libraries_aix_p (struct gdbarch *gdbarch)
}
ULONGEST
-gdbarch_core_xfer_shared_libraries_aix (struct gdbarch *gdbarch, gdb_byte *readbuf, ULONGEST offset, ULONGEST len)
+gdbarch_core_xfer_shared_libraries_aix (struct gdbarch *gdbarch,
+ gdb_byte *readbuf, ULONGEST offset,
+ ULONGEST len)
{
gdb_assert (gdbarch != NULL);
gdb_assert (gdbarch->core_xfer_shared_libraries_aix != NULL);
if (gdbarch_debug >= 2)
gdb_printf (gdb_stdlog, "gdbarch_core_xfer_shared_libraries_aix called\n");
- return gdbarch->core_xfer_shared_libraries_aix (gdbarch, readbuf, offset, len);
+ return gdbarch->core_xfer_shared_libraries_aix (gdbarch, readbuf, offset,
+ len);
}
void
-set_gdbarch_core_xfer_shared_libraries_aix (struct gdbarch *gdbarch,
- gdbarch_core_xfer_shared_libraries_aix_ftype core_xfer_shared_libraries_aix)
+set_gdbarch_core_xfer_shared_libraries_aix (
+ struct gdbarch *gdbarch,
+ gdbarch_core_xfer_shared_libraries_aix_ftype core_xfer_shared_libraries_aix)
{
gdbarch->core_xfer_shared_libraries_aix = core_xfer_shared_libraries_aix;
}
@@ -3888,7 +3815,8 @@ gdbarch_core_xfer_siginfo_p (struct gdbarch *gdbarch)
}
LONGEST
-gdbarch_core_xfer_siginfo (struct gdbarch *gdbarch, gdb_byte *readbuf, ULONGEST offset, ULONGEST len)
+gdbarch_core_xfer_siginfo (struct gdbarch *gdbarch, gdb_byte *readbuf,
+ ULONGEST offset, ULONGEST len)
{
gdb_assert (gdbarch != NULL);
gdb_assert (gdbarch->core_xfer_siginfo != NULL);
@@ -3898,8 +3826,8 @@ gdbarch_core_xfer_siginfo (struct gdbarch *gdbarch, gdb_byte *readbuf, ULONGEST
}
void
-set_gdbarch_core_xfer_siginfo (struct gdbarch *gdbarch,
- gdbarch_core_xfer_siginfo_ftype core_xfer_siginfo)
+set_gdbarch_core_xfer_siginfo (
+ struct gdbarch *gdbarch, gdbarch_core_xfer_siginfo_ftype core_xfer_siginfo)
{
gdbarch->core_xfer_siginfo = core_xfer_siginfo;
}
@@ -3924,7 +3852,7 @@ gdbarch_gcore_bfd_target (struct gdbarch *gdbarch)
void
set_gdbarch_gcore_bfd_target (struct gdbarch *gdbarch,
- const char * gcore_bfd_target)
+ const char *gcore_bfd_target)
{
gdbarch->gcore_bfd_target = gcore_bfd_target;
}
@@ -3957,14 +3885,14 @@ gdbarch_vbit_in_delta (struct gdbarch *gdbarch)
}
void
-set_gdbarch_vbit_in_delta (struct gdbarch *gdbarch,
- int vbit_in_delta)
+set_gdbarch_vbit_in_delta (struct gdbarch *gdbarch, int vbit_in_delta)
{
gdbarch->vbit_in_delta = vbit_in_delta;
}
void
-gdbarch_skip_permanent_breakpoint (struct gdbarch *gdbarch, struct regcache *regcache)
+gdbarch_skip_permanent_breakpoint (struct gdbarch *gdbarch,
+ struct regcache *regcache)
{
gdb_assert (gdbarch != NULL);
gdb_assert (gdbarch->skip_permanent_breakpoint != NULL);
@@ -3974,8 +3902,9 @@ gdbarch_skip_permanent_breakpoint (struct gdbarch *gdbarch, struct regcache *reg
}
void
-set_gdbarch_skip_permanent_breakpoint (struct gdbarch *gdbarch,
- gdbarch_skip_permanent_breakpoint_ftype skip_permanent_breakpoint)
+set_gdbarch_skip_permanent_breakpoint (
+ struct gdbarch *gdbarch,
+ gdbarch_skip_permanent_breakpoint_ftype skip_permanent_breakpoint)
{
gdbarch->skip_permanent_breakpoint = skip_permanent_breakpoint;
}
@@ -3999,8 +3928,7 @@ gdbarch_max_insn_length (struct gdbarch *gdbarch)
}
void
-set_gdbarch_max_insn_length (struct gdbarch *gdbarch,
- ULONGEST max_insn_length)
+set_gdbarch_max_insn_length (struct gdbarch *gdbarch, ULONGEST max_insn_length)
{
gdbarch->max_insn_length = max_insn_length;
}
@@ -4013,7 +3941,8 @@ gdbarch_displaced_step_copy_insn_p (struct gdbarch *gdbarch)
}
displaced_step_copy_insn_closure_up
-gdbarch_displaced_step_copy_insn (struct gdbarch *gdbarch, CORE_ADDR from, CORE_ADDR to, struct regcache *regs)
+gdbarch_displaced_step_copy_insn (struct gdbarch *gdbarch, CORE_ADDR from,
+ CORE_ADDR to, struct regcache *regs)
{
gdb_assert (gdbarch != NULL);
gdb_assert (gdbarch->displaced_step_copy_insn != NULL);
@@ -4023,8 +3952,9 @@ gdbarch_displaced_step_copy_insn (struct gdbarch *gdbarch, CORE_ADDR from, CORE_
}
void
-set_gdbarch_displaced_step_copy_insn (struct gdbarch *gdbarch,
- gdbarch_displaced_step_copy_insn_ftype displaced_step_copy_insn)
+set_gdbarch_displaced_step_copy_insn (
+ struct gdbarch *gdbarch,
+ gdbarch_displaced_step_copy_insn_ftype displaced_step_copy_insn)
{
gdbarch->displaced_step_copy_insn = displaced_step_copy_insn;
}
@@ -4040,8 +3970,9 @@ gdbarch_displaced_step_hw_singlestep (struct gdbarch *gdbarch)
}
void
-set_gdbarch_displaced_step_hw_singlestep (struct gdbarch *gdbarch,
- gdbarch_displaced_step_hw_singlestep_ftype displaced_step_hw_singlestep)
+set_gdbarch_displaced_step_hw_singlestep (
+ struct gdbarch *gdbarch,
+ gdbarch_displaced_step_hw_singlestep_ftype displaced_step_hw_singlestep)
{
gdbarch->displaced_step_hw_singlestep = displaced_step_hw_singlestep;
}
@@ -4054,7 +3985,10 @@ gdbarch_displaced_step_fixup_p (struct gdbarch *gdbarch)
}
void
-gdbarch_displaced_step_fixup (struct gdbarch *gdbarch, struct displaced_step_copy_insn_closure *closure, CORE_ADDR from, CORE_ADDR to, struct regcache *regs)
+gdbarch_displaced_step_fixup (struct gdbarch *gdbarch,
+ struct displaced_step_copy_insn_closure *closure,
+ CORE_ADDR from, CORE_ADDR to,
+ struct regcache *regs)
{
gdb_assert (gdbarch != NULL);
gdb_assert (gdbarch->displaced_step_fixup != NULL);
@@ -4065,8 +3999,9 @@ gdbarch_displaced_step_fixup (struct gdbarch *gdbarch, struct displaced_step_cop
}
void
-set_gdbarch_displaced_step_fixup (struct gdbarch *gdbarch,
- gdbarch_displaced_step_fixup_ftype displaced_step_fixup)
+set_gdbarch_displaced_step_fixup (
+ struct gdbarch *gdbarch,
+ gdbarch_displaced_step_fixup_ftype displaced_step_fixup)
{
gdbarch->displaced_step_fixup = displaced_step_fixup;
}
@@ -4079,7 +4014,8 @@ gdbarch_displaced_step_prepare_p (struct gdbarch *gdbarch)
}
displaced_step_prepare_status
-gdbarch_displaced_step_prepare (struct gdbarch *gdbarch, thread_info *thread, CORE_ADDR &displaced_pc)
+gdbarch_displaced_step_prepare (struct gdbarch *gdbarch, thread_info *thread,
+ CORE_ADDR &displaced_pc)
{
gdb_assert (gdbarch != NULL);
gdb_assert (gdbarch->displaced_step_prepare != NULL);
@@ -4089,14 +4025,16 @@ gdbarch_displaced_step_prepare (struct gdbarch *gdbarch, thread_info *thread, CO
}
void
-set_gdbarch_displaced_step_prepare (struct gdbarch *gdbarch,
- gdbarch_displaced_step_prepare_ftype displaced_step_prepare)
+set_gdbarch_displaced_step_prepare (
+ struct gdbarch *gdbarch,
+ gdbarch_displaced_step_prepare_ftype displaced_step_prepare)
{
gdbarch->displaced_step_prepare = displaced_step_prepare;
}
displaced_step_finish_status
-gdbarch_displaced_step_finish (struct gdbarch *gdbarch, thread_info *thread, gdb_signal sig)
+gdbarch_displaced_step_finish (struct gdbarch *gdbarch, thread_info *thread,
+ gdb_signal sig)
{
gdb_assert (gdbarch != NULL);
gdb_assert (gdbarch->displaced_step_finish != NULL);
@@ -4106,8 +4044,9 @@ gdbarch_displaced_step_finish (struct gdbarch *gdbarch, thread_info *thread, gdb
}
void
-set_gdbarch_displaced_step_finish (struct gdbarch *gdbarch,
- gdbarch_displaced_step_finish_ftype displaced_step_finish)
+set_gdbarch_displaced_step_finish (
+ struct gdbarch *gdbarch,
+ gdbarch_displaced_step_finish_ftype displaced_step_finish)
{
gdbarch->displaced_step_finish = displaced_step_finish;
}
@@ -4120,37 +4059,48 @@ gdbarch_displaced_step_copy_insn_closure_by_addr_p (struct gdbarch *gdbarch)
}
const displaced_step_copy_insn_closure *
-gdbarch_displaced_step_copy_insn_closure_by_addr (struct gdbarch *gdbarch, inferior *inf, CORE_ADDR addr)
+gdbarch_displaced_step_copy_insn_closure_by_addr (struct gdbarch *gdbarch,
+ inferior *inf,
+ CORE_ADDR addr)
{
gdb_assert (gdbarch != NULL);
gdb_assert (gdbarch->displaced_step_copy_insn_closure_by_addr != NULL);
if (gdbarch_debug >= 2)
- gdb_printf (gdb_stdlog, "gdbarch_displaced_step_copy_insn_closure_by_addr called\n");
+ gdb_printf (gdb_stdlog,
+ "gdbarch_displaced_step_copy_insn_closure_by_addr called\n");
return gdbarch->displaced_step_copy_insn_closure_by_addr (inf, addr);
}
void
-set_gdbarch_displaced_step_copy_insn_closure_by_addr (struct gdbarch *gdbarch,
- gdbarch_displaced_step_copy_insn_closure_by_addr_ftype displaced_step_copy_insn_closure_by_addr)
+set_gdbarch_displaced_step_copy_insn_closure_by_addr (
+ struct gdbarch *gdbarch,
+ gdbarch_displaced_step_copy_insn_closure_by_addr_ftype
+ displaced_step_copy_insn_closure_by_addr)
{
- gdbarch->displaced_step_copy_insn_closure_by_addr = displaced_step_copy_insn_closure_by_addr;
+ gdbarch->displaced_step_copy_insn_closure_by_addr
+ = displaced_step_copy_insn_closure_by_addr;
}
void
-gdbarch_displaced_step_restore_all_in_ptid (struct gdbarch *gdbarch, inferior *parent_inf, ptid_t child_ptid)
+gdbarch_displaced_step_restore_all_in_ptid (struct gdbarch *gdbarch,
+ inferior *parent_inf,
+ ptid_t child_ptid)
{
gdb_assert (gdbarch != NULL);
gdb_assert (gdbarch->displaced_step_restore_all_in_ptid != NULL);
if (gdbarch_debug >= 2)
- gdb_printf (gdb_stdlog, "gdbarch_displaced_step_restore_all_in_ptid called\n");
+ gdb_printf (gdb_stdlog,
+ "gdbarch_displaced_step_restore_all_in_ptid called\n");
gdbarch->displaced_step_restore_all_in_ptid (parent_inf, child_ptid);
}
void
-set_gdbarch_displaced_step_restore_all_in_ptid (struct gdbarch *gdbarch,
- gdbarch_displaced_step_restore_all_in_ptid_ftype displaced_step_restore_all_in_ptid)
+set_gdbarch_displaced_step_restore_all_in_ptid (
+ struct gdbarch *gdbarch, gdbarch_displaced_step_restore_all_in_ptid_ftype
+ displaced_step_restore_all_in_ptid)
{
- gdbarch->displaced_step_restore_all_in_ptid = displaced_step_restore_all_in_ptid;
+ gdbarch->displaced_step_restore_all_in_ptid
+ = displaced_step_restore_all_in_ptid;
}
bool
@@ -4161,7 +4111,8 @@ gdbarch_relocate_instruction_p (struct gdbarch *gdbarch)
}
void
-gdbarch_relocate_instruction (struct gdbarch *gdbarch, CORE_ADDR *to, CORE_ADDR from)
+gdbarch_relocate_instruction (struct gdbarch *gdbarch, CORE_ADDR *to,
+ CORE_ADDR from)
{
gdb_assert (gdbarch != NULL);
gdb_assert (gdbarch->relocate_instruction != NULL);
@@ -4172,8 +4123,9 @@ gdbarch_relocate_instruction (struct gdbarch *gdbarch, CORE_ADDR *to, CORE_ADDR
}
void
-set_gdbarch_relocate_instruction (struct gdbarch *gdbarch,
- gdbarch_relocate_instruction_ftype relocate_instruction)
+set_gdbarch_relocate_instruction (
+ struct gdbarch *gdbarch,
+ gdbarch_relocate_instruction_ftype relocate_instruction)
{
gdbarch->relocate_instruction = relocate_instruction;
}
@@ -4210,7 +4162,8 @@ gdbarch_core_read_description_p (struct gdbarch *gdbarch)
}
const struct target_desc *
-gdbarch_core_read_description (struct gdbarch *gdbarch, struct target_ops *target, bfd *abfd)
+gdbarch_core_read_description (struct gdbarch *gdbarch,
+ struct target_ops *target, bfd *abfd)
{
gdb_assert (gdbarch != NULL);
gdb_assert (gdbarch->core_read_description != NULL);
@@ -4220,8 +4173,9 @@ gdbarch_core_read_description (struct gdbarch *gdbarch, struct target_ops *targe
}
void
-set_gdbarch_core_read_description (struct gdbarch *gdbarch,
- gdbarch_core_read_description_ftype core_read_description)
+set_gdbarch_core_read_description (
+ struct gdbarch *gdbarch,
+ gdbarch_core_read_description_ftype core_read_description)
{
gdbarch->core_read_description = core_read_description;
}
@@ -4251,7 +4205,8 @@ gdbarch_process_record_p (struct gdbarch *gdbarch)
}
int
-gdbarch_process_record (struct gdbarch *gdbarch, struct regcache *regcache, CORE_ADDR addr)
+gdbarch_process_record (struct gdbarch *gdbarch, struct regcache *regcache,
+ CORE_ADDR addr)
{
gdb_assert (gdbarch != NULL);
gdb_assert (gdbarch->process_record != NULL);
@@ -4275,7 +4230,9 @@ gdbarch_process_record_signal_p (struct gdbarch *gdbarch)
}
int
-gdbarch_process_record_signal (struct gdbarch *gdbarch, struct regcache *regcache, enum gdb_signal signal)
+gdbarch_process_record_signal (struct gdbarch *gdbarch,
+ struct regcache *regcache,
+ enum gdb_signal signal)
{
gdb_assert (gdbarch != NULL);
gdb_assert (gdbarch->process_record_signal != NULL);
@@ -4285,8 +4242,9 @@ gdbarch_process_record_signal (struct gdbarch *gdbarch, struct regcache *regcach
}
void
-set_gdbarch_process_record_signal (struct gdbarch *gdbarch,
- gdbarch_process_record_signal_ftype process_record_signal)
+set_gdbarch_process_record_signal (
+ struct gdbarch *gdbarch,
+ gdbarch_process_record_signal_ftype process_record_signal)
{
gdbarch->process_record_signal = process_record_signal;
}
@@ -4309,8 +4267,9 @@ gdbarch_gdb_signal_from_target (struct gdbarch *gdbarch, int signo)
}
void
-set_gdbarch_gdb_signal_from_target (struct gdbarch *gdbarch,
- gdbarch_gdb_signal_from_target_ftype gdb_signal_from_target)
+set_gdbarch_gdb_signal_from_target (
+ struct gdbarch *gdbarch,
+ gdbarch_gdb_signal_from_target_ftype gdb_signal_from_target)
{
gdbarch->gdb_signal_from_target = gdb_signal_from_target;
}
@@ -4333,8 +4292,9 @@ gdbarch_gdb_signal_to_target (struct gdbarch *gdbarch, enum gdb_signal signal)
}
void
-set_gdbarch_gdb_signal_to_target (struct gdbarch *gdbarch,
- gdbarch_gdb_signal_to_target_ftype gdb_signal_to_target)
+set_gdbarch_gdb_signal_to_target (
+ struct gdbarch *gdbarch,
+ gdbarch_gdb_signal_to_target_ftype gdb_signal_to_target)
{
gdbarch->gdb_signal_to_target = gdb_signal_to_target;
}
@@ -4371,7 +4331,8 @@ gdbarch_record_special_symbol_p (struct gdbarch *gdbarch)
}
void
-gdbarch_record_special_symbol (struct gdbarch *gdbarch, struct objfile *objfile, asymbol *sym)
+gdbarch_record_special_symbol (struct gdbarch *gdbarch,
+ struct objfile *objfile, asymbol *sym)
{
gdb_assert (gdbarch != NULL);
gdb_assert (gdbarch->record_special_symbol != NULL);
@@ -4381,8 +4342,9 @@ gdbarch_record_special_symbol (struct gdbarch *gdbarch, struct objfile *objfile,
}
void
-set_gdbarch_record_special_symbol (struct gdbarch *gdbarch,
- gdbarch_record_special_symbol_ftype record_special_symbol)
+set_gdbarch_record_special_symbol (
+ struct gdbarch *gdbarch,
+ gdbarch_record_special_symbol_ftype record_special_symbol)
{
gdbarch->record_special_symbol = record_special_symbol;
}
@@ -4405,8 +4367,8 @@ gdbarch_get_syscall_number (struct gdbarch *gdbarch, thread_info *thread)
}
void
-set_gdbarch_get_syscall_number (struct gdbarch *gdbarch,
- gdbarch_get_syscall_number_ftype get_syscall_number)
+set_gdbarch_get_syscall_number (
+ struct gdbarch *gdbarch, gdbarch_get_syscall_number_ftype get_syscall_number)
{
gdbarch->get_syscall_number = get_syscall_number;
}
@@ -4423,7 +4385,7 @@ gdbarch_xml_syscall_file (struct gdbarch *gdbarch)
void
set_gdbarch_xml_syscall_file (struct gdbarch *gdbarch,
- const char * xml_syscall_file)
+ const char *xml_syscall_file)
{
gdbarch->xml_syscall_file = xml_syscall_file;
}
@@ -4440,7 +4402,7 @@ gdbarch_syscalls_info (struct gdbarch *gdbarch)
void
set_gdbarch_syscalls_info (struct gdbarch *gdbarch,
- struct syscalls_info * syscalls_info)
+ struct syscalls_info *syscalls_info)
{
gdbarch->syscalls_info = syscalls_info;
}
@@ -4457,7 +4419,7 @@ gdbarch_stap_integer_prefixes (struct gdbarch *gdbarch)
void
set_gdbarch_stap_integer_prefixes (struct gdbarch *gdbarch,
- const char *const * stap_integer_prefixes)
+ const char *const *stap_integer_prefixes)
{
gdbarch->stap_integer_prefixes = stap_integer_prefixes;
}
@@ -4474,7 +4436,7 @@ gdbarch_stap_integer_suffixes (struct gdbarch *gdbarch)
void
set_gdbarch_stap_integer_suffixes (struct gdbarch *gdbarch,
- const char *const * stap_integer_suffixes)
+ const char *const *stap_integer_suffixes)
{
gdbarch->stap_integer_suffixes = stap_integer_suffixes;
}
@@ -4491,7 +4453,7 @@ gdbarch_stap_register_prefixes (struct gdbarch *gdbarch)
void
set_gdbarch_stap_register_prefixes (struct gdbarch *gdbarch,
- const char *const * stap_register_prefixes)
+ const char *const *stap_register_prefixes)
{
gdbarch->stap_register_prefixes = stap_register_prefixes;
}
@@ -4508,7 +4470,7 @@ gdbarch_stap_register_suffixes (struct gdbarch *gdbarch)
void
set_gdbarch_stap_register_suffixes (struct gdbarch *gdbarch,
- const char *const * stap_register_suffixes)
+ const char *const *stap_register_suffixes)
{
gdbarch->stap_register_suffixes = stap_register_suffixes;
}
@@ -4519,15 +4481,18 @@ gdbarch_stap_register_indirection_prefixes (struct gdbarch *gdbarch)
gdb_assert (gdbarch != NULL);
/* Skip verify of stap_register_indirection_prefixes, invalid_p == 0 */
if (gdbarch_debug >= 2)
- gdb_printf (gdb_stdlog, "gdbarch_stap_register_indirection_prefixes called\n");
+ gdb_printf (gdb_stdlog,
+ "gdbarch_stap_register_indirection_prefixes called\n");
return gdbarch->stap_register_indirection_prefixes;
}
void
-set_gdbarch_stap_register_indirection_prefixes (struct gdbarch *gdbarch,
- const char *const * stap_register_indirection_prefixes)
+set_gdbarch_stap_register_indirection_prefixes (
+ struct gdbarch *gdbarch,
+ const char *const *stap_register_indirection_prefixes)
{
- gdbarch->stap_register_indirection_prefixes = stap_register_indirection_prefixes;
+ gdbarch->stap_register_indirection_prefixes
+ = stap_register_indirection_prefixes;
}
const char *const *
@@ -4536,15 +4501,18 @@ gdbarch_stap_register_indirection_suffixes (struct gdbarch *gdbarch)
gdb_assert (gdbarch != NULL);
/* Skip verify of stap_register_indirection_suffixes, invalid_p == 0 */
if (gdbarch_debug >= 2)
- gdb_printf (gdb_stdlog, "gdbarch_stap_register_indirection_suffixes called\n");
+ gdb_printf (gdb_stdlog,
+ "gdbarch_stap_register_indirection_suffixes called\n");
return gdbarch->stap_register_indirection_suffixes;
}
void
-set_gdbarch_stap_register_indirection_suffixes (struct gdbarch *gdbarch,
- const char *const * stap_register_indirection_suffixes)
+set_gdbarch_stap_register_indirection_suffixes (
+ struct gdbarch *gdbarch,
+ const char *const *stap_register_indirection_suffixes)
{
- gdbarch->stap_register_indirection_suffixes = stap_register_indirection_suffixes;
+ gdbarch->stap_register_indirection_suffixes
+ = stap_register_indirection_suffixes;
}
const char *
@@ -4559,7 +4527,7 @@ gdbarch_stap_gdb_register_prefix (struct gdbarch *gdbarch)
void
set_gdbarch_stap_gdb_register_prefix (struct gdbarch *gdbarch,
- const char * stap_gdb_register_prefix)
+ const char *stap_gdb_register_prefix)
{
gdbarch->stap_gdb_register_prefix = stap_gdb_register_prefix;
}
@@ -4576,7 +4544,7 @@ gdbarch_stap_gdb_register_suffix (struct gdbarch *gdbarch)
void
set_gdbarch_stap_gdb_register_suffix (struct gdbarch *gdbarch,
- const char * stap_gdb_register_suffix)
+ const char *stap_gdb_register_suffix)
{
gdbarch->stap_gdb_register_suffix = stap_gdb_register_suffix;
}
@@ -4599,8 +4567,9 @@ gdbarch_stap_is_single_operand (struct gdbarch *gdbarch, const char *s)
}
void
-set_gdbarch_stap_is_single_operand (struct gdbarch *gdbarch,
- gdbarch_stap_is_single_operand_ftype stap_is_single_operand)
+set_gdbarch_stap_is_single_operand (
+ struct gdbarch *gdbarch,
+ gdbarch_stap_is_single_operand_ftype stap_is_single_operand)
{
gdbarch->stap_is_single_operand = stap_is_single_operand;
}
@@ -4613,7 +4582,8 @@ gdbarch_stap_parse_special_token_p (struct gdbarch *gdbarch)
}
expr::operation_up
-gdbarch_stap_parse_special_token (struct gdbarch *gdbarch, struct stap_parse_info *p)
+gdbarch_stap_parse_special_token (struct gdbarch *gdbarch,
+ struct stap_parse_info *p)
{
gdb_assert (gdbarch != NULL);
gdb_assert (gdbarch->stap_parse_special_token != NULL);
@@ -4623,8 +4593,9 @@ gdbarch_stap_parse_special_token (struct gdbarch *gdbarch, struct stap_parse_inf
}
void
-set_gdbarch_stap_parse_special_token (struct gdbarch *gdbarch,
- gdbarch_stap_parse_special_token_ftype stap_parse_special_token)
+set_gdbarch_stap_parse_special_token (
+ struct gdbarch *gdbarch,
+ gdbarch_stap_parse_special_token_ftype stap_parse_special_token)
{
gdbarch->stap_parse_special_token = stap_parse_special_token;
}
@@ -4637,7 +4608,9 @@ gdbarch_stap_adjust_register_p (struct gdbarch *gdbarch)
}
std::string
-gdbarch_stap_adjust_register (struct gdbarch *gdbarch, struct stap_parse_info *p, const std::string &regname, int regnum)
+gdbarch_stap_adjust_register (struct gdbarch *gdbarch,
+ struct stap_parse_info *p,
+ const std::string &regname, int regnum)
{
gdb_assert (gdbarch != NULL);
gdb_assert (gdbarch->stap_adjust_register != NULL);
@@ -4647,8 +4620,9 @@ gdbarch_stap_adjust_register (struct gdbarch *gdbarch, struct stap_parse_info *p
}
void
-set_gdbarch_stap_adjust_register (struct gdbarch *gdbarch,
- gdbarch_stap_adjust_register_ftype stap_adjust_register)
+set_gdbarch_stap_adjust_register (
+ struct gdbarch *gdbarch,
+ gdbarch_stap_adjust_register_ftype stap_adjust_register)
{
gdbarch->stap_adjust_register = stap_adjust_register;
}
@@ -4671,8 +4645,9 @@ gdbarch_dtrace_parse_probe_argument (struct gdbarch *gdbarch, int narg)
}
void
-set_gdbarch_dtrace_parse_probe_argument (struct gdbarch *gdbarch,
- gdbarch_dtrace_parse_probe_argument_ftype dtrace_parse_probe_argument)
+set_gdbarch_dtrace_parse_probe_argument (
+ struct gdbarch *gdbarch,
+ gdbarch_dtrace_parse_probe_argument_ftype dtrace_parse_probe_argument)
{
gdbarch->dtrace_parse_probe_argument = dtrace_parse_probe_argument;
}
@@ -4695,8 +4670,9 @@ gdbarch_dtrace_probe_is_enabled (struct gdbarch *gdbarch, CORE_ADDR addr)
}
void
-set_gdbarch_dtrace_probe_is_enabled (struct gdbarch *gdbarch,
- gdbarch_dtrace_probe_is_enabled_ftype dtrace_probe_is_enabled)
+set_gdbarch_dtrace_probe_is_enabled (
+ struct gdbarch *gdbarch,
+ gdbarch_dtrace_probe_is_enabled_ftype dtrace_probe_is_enabled)
{
gdbarch->dtrace_probe_is_enabled = dtrace_probe_is_enabled;
}
@@ -4719,8 +4695,9 @@ gdbarch_dtrace_enable_probe (struct gdbarch *gdbarch, CORE_ADDR addr)
}
void
-set_gdbarch_dtrace_enable_probe (struct gdbarch *gdbarch,
- gdbarch_dtrace_enable_probe_ftype dtrace_enable_probe)
+set_gdbarch_dtrace_enable_probe (
+ struct gdbarch *gdbarch,
+ gdbarch_dtrace_enable_probe_ftype dtrace_enable_probe)
{
gdbarch->dtrace_enable_probe = dtrace_enable_probe;
}
@@ -4743,8 +4720,9 @@ gdbarch_dtrace_disable_probe (struct gdbarch *gdbarch, CORE_ADDR addr)
}
void
-set_gdbarch_dtrace_disable_probe (struct gdbarch *gdbarch,
- gdbarch_dtrace_disable_probe_ftype dtrace_disable_probe)
+set_gdbarch_dtrace_disable_probe (
+ struct gdbarch *gdbarch,
+ gdbarch_dtrace_disable_probe_ftype dtrace_disable_probe)
{
gdbarch->dtrace_disable_probe = dtrace_disable_probe;
}
@@ -4760,8 +4738,7 @@ gdbarch_has_global_solist (struct gdbarch *gdbarch)
}
void
-set_gdbarch_has_global_solist (struct gdbarch *gdbarch,
- int has_global_solist)
+set_gdbarch_has_global_solist (struct gdbarch *gdbarch, int has_global_solist)
{
gdbarch->has_global_solist = has_global_solist;
}
@@ -4794,14 +4771,16 @@ gdbarch_has_shared_address_space (struct gdbarch *gdbarch)
}
void
-set_gdbarch_has_shared_address_space (struct gdbarch *gdbarch,
- gdbarch_has_shared_address_space_ftype has_shared_address_space)
+set_gdbarch_has_shared_address_space (
+ struct gdbarch *gdbarch,
+ gdbarch_has_shared_address_space_ftype has_shared_address_space)
{
gdbarch->has_shared_address_space = has_shared_address_space;
}
int
-gdbarch_fast_tracepoint_valid_at (struct gdbarch *gdbarch, CORE_ADDR addr, std::string *msg)
+gdbarch_fast_tracepoint_valid_at (struct gdbarch *gdbarch, CORE_ADDR addr,
+ std::string *msg)
{
gdb_assert (gdbarch != NULL);
gdb_assert (gdbarch->fast_tracepoint_valid_at != NULL);
@@ -4811,14 +4790,16 @@ gdbarch_fast_tracepoint_valid_at (struct gdbarch *gdbarch, CORE_ADDR addr, std::
}
void
-set_gdbarch_fast_tracepoint_valid_at (struct gdbarch *gdbarch,
- gdbarch_fast_tracepoint_valid_at_ftype fast_tracepoint_valid_at)
+set_gdbarch_fast_tracepoint_valid_at (
+ struct gdbarch *gdbarch,
+ gdbarch_fast_tracepoint_valid_at_ftype fast_tracepoint_valid_at)
{
gdbarch->fast_tracepoint_valid_at = fast_tracepoint_valid_at;
}
void
-gdbarch_guess_tracepoint_registers (struct gdbarch *gdbarch, struct regcache *regcache, CORE_ADDR addr)
+gdbarch_guess_tracepoint_registers (struct gdbarch *gdbarch,
+ struct regcache *regcache, CORE_ADDR addr)
{
gdb_assert (gdbarch != NULL);
gdb_assert (gdbarch->guess_tracepoint_registers != NULL);
@@ -4828,8 +4809,9 @@ gdbarch_guess_tracepoint_registers (struct gdbarch *gdbarch, struct regcache *re
}
void
-set_gdbarch_guess_tracepoint_registers (struct gdbarch *gdbarch,
- gdbarch_guess_tracepoint_registers_ftype guess_tracepoint_registers)
+set_gdbarch_guess_tracepoint_registers (
+ struct gdbarch *gdbarch,
+ gdbarch_guess_tracepoint_registers_ftype guess_tracepoint_registers)
{
gdbarch->guess_tracepoint_registers = guess_tracepoint_registers;
}
@@ -4862,8 +4844,8 @@ gdbarch_auto_wide_charset (struct gdbarch *gdbarch)
}
void
-set_gdbarch_auto_wide_charset (struct gdbarch *gdbarch,
- gdbarch_auto_wide_charset_ftype auto_wide_charset)
+set_gdbarch_auto_wide_charset (
+ struct gdbarch *gdbarch, gdbarch_auto_wide_charset_ftype auto_wide_charset)
{
gdbarch->auto_wide_charset = auto_wide_charset;
}
@@ -4880,7 +4862,7 @@ gdbarch_solib_symbols_extension (struct gdbarch *gdbarch)
void
set_gdbarch_solib_symbols_extension (struct gdbarch *gdbarch,
- const char * solib_symbols_extension)
+ const char *solib_symbols_extension)
{
gdbarch->solib_symbols_extension = solib_symbols_extension;
}
@@ -4903,7 +4885,8 @@ set_gdbarch_has_dos_based_file_system (struct gdbarch *gdbarch,
}
void
-gdbarch_gen_return_address (struct gdbarch *gdbarch, struct agent_expr *ax, struct axs_value *value, CORE_ADDR scope)
+gdbarch_gen_return_address (struct gdbarch *gdbarch, struct agent_expr *ax,
+ struct axs_value *value, CORE_ADDR scope)
{
gdb_assert (gdbarch != NULL);
gdb_assert (gdbarch->gen_return_address != NULL);
@@ -4913,8 +4896,8 @@ gdbarch_gen_return_address (struct gdbarch *gdbarch, struct agent_expr *ax, stru
}
void
-set_gdbarch_gen_return_address (struct gdbarch *gdbarch,
- gdbarch_gen_return_address_ftype gen_return_address)
+set_gdbarch_gen_return_address (
+ struct gdbarch *gdbarch, gdbarch_gen_return_address_ftype gen_return_address)
{
gdbarch->gen_return_address = gen_return_address;
}
@@ -4927,7 +4910,8 @@ gdbarch_info_proc_p (struct gdbarch *gdbarch)
}
void
-gdbarch_info_proc (struct gdbarch *gdbarch, const char *args, enum info_proc_what what)
+gdbarch_info_proc (struct gdbarch *gdbarch, const char *args,
+ enum info_proc_what what)
{
gdb_assert (gdbarch != NULL);
gdb_assert (gdbarch->info_proc != NULL);
@@ -4951,7 +4935,8 @@ gdbarch_core_info_proc_p (struct gdbarch *gdbarch)
}
void
-gdbarch_core_info_proc (struct gdbarch *gdbarch, const char *args, enum info_proc_what what)
+gdbarch_core_info_proc (struct gdbarch *gdbarch, const char *args,
+ enum info_proc_what what)
{
gdb_assert (gdbarch != NULL);
gdb_assert (gdbarch->core_info_proc != NULL);
@@ -4968,20 +4953,26 @@ set_gdbarch_core_info_proc (struct gdbarch *gdbarch,
}
void
-gdbarch_iterate_over_objfiles_in_search_order (struct gdbarch *gdbarch, iterate_over_objfiles_in_search_order_cb_ftype cb, struct objfile *current_objfile)
+gdbarch_iterate_over_objfiles_in_search_order (
+ struct gdbarch *gdbarch, iterate_over_objfiles_in_search_order_cb_ftype cb,
+ struct objfile *current_objfile)
{
gdb_assert (gdbarch != NULL);
gdb_assert (gdbarch->iterate_over_objfiles_in_search_order != NULL);
if (gdbarch_debug >= 2)
- gdb_printf (gdb_stdlog, "gdbarch_iterate_over_objfiles_in_search_order called\n");
- gdbarch->iterate_over_objfiles_in_search_order (gdbarch, cb, current_objfile);
+ gdb_printf (gdb_stdlog,
+ "gdbarch_iterate_over_objfiles_in_search_order called\n");
+ gdbarch->iterate_over_objfiles_in_search_order (gdbarch, cb,
+ current_objfile);
}
void
-set_gdbarch_iterate_over_objfiles_in_search_order (struct gdbarch *gdbarch,
- gdbarch_iterate_over_objfiles_in_search_order_ftype iterate_over_objfiles_in_search_order)
+set_gdbarch_iterate_over_objfiles_in_search_order (
+ struct gdbarch *gdbarch, gdbarch_iterate_over_objfiles_in_search_order_ftype
+ iterate_over_objfiles_in_search_order)
{
- gdbarch->iterate_over_objfiles_in_search_order = iterate_over_objfiles_in_search_order;
+ gdbarch->iterate_over_objfiles_in_search_order
+ = iterate_over_objfiles_in_search_order;
}
struct ravenscar_arch_ops *
@@ -4996,7 +4987,7 @@ gdbarch_ravenscar_ops (struct gdbarch *gdbarch)
void
set_gdbarch_ravenscar_ops (struct gdbarch *gdbarch,
- struct ravenscar_arch_ops * ravenscar_ops)
+ struct ravenscar_arch_ops *ravenscar_ops)
{
gdbarch->ravenscar_ops = ravenscar_ops;
}
@@ -5063,8 +5054,9 @@ gdbarch_program_breakpoint_here_p (struct gdbarch *gdbarch, CORE_ADDR address)
}
void
-set_gdbarch_program_breakpoint_here_p (struct gdbarch *gdbarch,
- gdbarch_program_breakpoint_here_p_ftype program_breakpoint_here_p)
+set_gdbarch_program_breakpoint_here_p (
+ struct gdbarch *gdbarch,
+ gdbarch_program_breakpoint_here_p_ftype program_breakpoint_here_p)
{
gdbarch->program_breakpoint_here_p = program_breakpoint_here_p;
}
@@ -5077,7 +5069,8 @@ gdbarch_auxv_parse_p (struct gdbarch *gdbarch)
}
int
-gdbarch_auxv_parse (struct gdbarch *gdbarch, const gdb_byte **readptr, const gdb_byte *endptr, CORE_ADDR *typep, CORE_ADDR *valp)
+gdbarch_auxv_parse (struct gdbarch *gdbarch, const gdb_byte **readptr,
+ const gdb_byte *endptr, CORE_ADDR *typep, CORE_ADDR *valp)
{
gdb_assert (gdbarch != NULL);
gdb_assert (gdbarch->auxv_parse != NULL);
@@ -5094,7 +5087,8 @@ set_gdbarch_auxv_parse (struct gdbarch *gdbarch,
}
void
-gdbarch_print_auxv_entry (struct gdbarch *gdbarch, struct ui_file *file, CORE_ADDR type, CORE_ADDR val)
+gdbarch_print_auxv_entry (struct gdbarch *gdbarch, struct ui_file *file,
+ CORE_ADDR type, CORE_ADDR val)
{
gdb_assert (gdbarch != NULL);
gdb_assert (gdbarch->print_auxv_entry != NULL);
@@ -5145,7 +5139,8 @@ set_gdbarch_infcall_mmap (struct gdbarch *gdbarch,
}
void
-gdbarch_infcall_munmap (struct gdbarch *gdbarch, CORE_ADDR addr, CORE_ADDR size)
+gdbarch_infcall_munmap (struct gdbarch *gdbarch, CORE_ADDR addr,
+ CORE_ADDR size)
{
gdb_assert (gdbarch != NULL);
gdb_assert (gdbarch->infcall_munmap != NULL);
@@ -5172,8 +5167,8 @@ gdbarch_gcc_target_options (struct gdbarch *gdbarch)
}
void
-set_gdbarch_gcc_target_options (struct gdbarch *gdbarch,
- gdbarch_gcc_target_options_ftype gcc_target_options)
+set_gdbarch_gcc_target_options (
+ struct gdbarch *gdbarch, gdbarch_gcc_target_options_ftype gcc_target_options)
{
gdbarch->gcc_target_options = gcc_target_options;
}
@@ -5189,8 +5184,8 @@ gdbarch_gnu_triplet_regexp (struct gdbarch *gdbarch)
}
void
-set_gdbarch_gnu_triplet_regexp (struct gdbarch *gdbarch,
- gdbarch_gnu_triplet_regexp_ftype gnu_triplet_regexp)
+set_gdbarch_gnu_triplet_regexp (
+ struct gdbarch *gdbarch, gdbarch_gnu_triplet_regexp_ftype gnu_triplet_regexp)
{
gdbarch->gnu_triplet_regexp = gnu_triplet_regexp;
}
@@ -5206,8 +5201,9 @@ gdbarch_addressable_memory_unit_size (struct gdbarch *gdbarch)
}
void
-set_gdbarch_addressable_memory_unit_size (struct gdbarch *gdbarch,
- gdbarch_addressable_memory_unit_size_ftype addressable_memory_unit_size)
+set_gdbarch_addressable_memory_unit_size (
+ struct gdbarch *gdbarch,
+ gdbarch_addressable_memory_unit_size_ftype addressable_memory_unit_size)
{
gdbarch->addressable_memory_unit_size = addressable_memory_unit_size;
}
@@ -5223,8 +5219,8 @@ gdbarch_disassembler_options_implicit (struct gdbarch *gdbarch)
}
void
-set_gdbarch_disassembler_options_implicit (struct gdbarch *gdbarch,
- const char * disassembler_options_implicit)
+set_gdbarch_disassembler_options_implicit (
+ struct gdbarch *gdbarch, const char *disassembler_options_implicit)
{
gdbarch->disassembler_options_implicit = disassembler_options_implicit;
}
@@ -5241,7 +5237,7 @@ gdbarch_disassembler_options (struct gdbarch *gdbarch)
void
set_gdbarch_disassembler_options (struct gdbarch *gdbarch,
- char ** disassembler_options)
+ char **disassembler_options)
{
gdbarch->disassembler_options = disassembler_options;
}
@@ -5257,8 +5253,9 @@ gdbarch_valid_disassembler_options (struct gdbarch *gdbarch)
}
void
-set_gdbarch_valid_disassembler_options (struct gdbarch *gdbarch,
- const disasm_options_and_args_t * valid_disassembler_options)
+set_gdbarch_valid_disassembler_options (
+ struct gdbarch *gdbarch,
+ const disasm_options_and_args_t *valid_disassembler_options)
{
gdbarch->valid_disassembler_options = valid_disassembler_options;
}
@@ -5281,7 +5278,8 @@ set_gdbarch_type_align (struct gdbarch *gdbarch,
}
std::string
-gdbarch_get_pc_address_flags (struct gdbarch *gdbarch, frame_info_ptr frame, CORE_ADDR pc)
+gdbarch_get_pc_address_flags (struct gdbarch *gdbarch, frame_info_ptr frame,
+ CORE_ADDR pc)
{
gdb_assert (gdbarch != NULL);
gdb_assert (gdbarch->get_pc_address_flags != NULL);
@@ -5291,14 +5289,18 @@ gdbarch_get_pc_address_flags (struct gdbarch *gdbarch, frame_info_ptr frame, COR
}
void
-set_gdbarch_get_pc_address_flags (struct gdbarch *gdbarch,
- gdbarch_get_pc_address_flags_ftype get_pc_address_flags)
+set_gdbarch_get_pc_address_flags (
+ struct gdbarch *gdbarch,
+ gdbarch_get_pc_address_flags_ftype get_pc_address_flags)
{
gdbarch->get_pc_address_flags = get_pc_address_flags;
}
void
-gdbarch_read_core_file_mappings (struct gdbarch *gdbarch, struct bfd *cbfd, read_core_file_mappings_pre_loop_ftype pre_loop_cb, read_core_file_mappings_loop_ftype loop_cb)
+gdbarch_read_core_file_mappings (
+ struct gdbarch *gdbarch, struct bfd *cbfd,
+ read_core_file_mappings_pre_loop_ftype pre_loop_cb,
+ read_core_file_mappings_loop_ftype loop_cb)
{
gdb_assert (gdbarch != NULL);
gdb_assert (gdbarch->read_core_file_mappings != NULL);
@@ -5308,8 +5310,9 @@ gdbarch_read_core_file_mappings (struct gdbarch *gdbarch, struct bfd *cbfd, read
}
void
-set_gdbarch_read_core_file_mappings (struct gdbarch *gdbarch,
- gdbarch_read_core_file_mappings_ftype read_core_file_mappings)
+set_gdbarch_read_core_file_mappings (
+ struct gdbarch *gdbarch,
+ gdbarch_read_core_file_mappings_ftype read_core_file_mappings)
{
gdbarch->read_core_file_mappings = read_core_file_mappings;
}
diff --git a/gdb/gdbarch.h b/gdb/gdbarch.h
index f0399c2fa88..abc1d6857f8 100644
--- a/gdb/gdbarch.h
+++ b/gdb/gdbarch.h
@@ -17,7 +17,6 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
-
#ifndef GDBARCH_H
#define GDBARCH_H
@@ -66,7 +65,7 @@ struct inferior;
struct gdbarch_tdep_base
{
- virtual ~gdbarch_tdep_base() = default;
+ virtual ~gdbarch_tdep_base () = default;
};
using gdbarch_tdep_up = std::unique_ptr<gdbarch_tdep_base>;
@@ -90,7 +89,7 @@ extern struct gdbarch *target_gdbarch (void);
gdbarch method. */
using iterate_over_objfiles_in_search_order_cb_ftype
- = gdb::function_view<bool(objfile *)>;
+ = gdb::function_view<bool (objfile *)>;
/* Callback type for regset section iterators. The callback usually
invokes the REGSET's supply or collect method, to which it must
@@ -100,9 +99,9 @@ using iterate_over_objfiles_in_search_order_cb_ftype
is used for diagnostic messages. CB_DATA should have been passed
unchanged through the iterator. */
-typedef void (iterate_over_regset_sections_cb)
- (const char *sect_name, int supply_size, int collect_size,
- const struct regset *regset, const char *human_name, void *cb_data);
+typedef void (iterate_over_regset_sections_cb) (
+ const char *sect_name, int supply_size, int collect_size,
+ const struct regset *regset, const char *human_name, void *cb_data);
/* For a function call, does the function return a value using a
normal value return or a structure return - passing a hidden
@@ -140,16 +139,13 @@ enum class memtag_type
/* Callback types for 'read_core_file_mappings' gdbarch method. */
-using read_core_file_mappings_pre_loop_ftype =
- gdb::function_view<void (ULONGEST count)>;
+using read_core_file_mappings_pre_loop_ftype
+ = gdb::function_view<void (ULONGEST count)>;
-using read_core_file_mappings_loop_ftype =
- gdb::function_view<void (int num,
- ULONGEST start,
- ULONGEST end,
- ULONGEST file_ofs,
- const char *filename,
- const bfd_build_id *build_id)>;
+using read_core_file_mappings_loop_ftype
+ = gdb::function_view<void (int num, ULONGEST start, ULONGEST end,
+ ULONGEST file_ofs, const char *filename,
+ const bfd_build_id *build_id)>;
/* Possible values for gdbarch_call_dummy_location. */
enum call_dummy_location_type
@@ -204,7 +200,6 @@ gdbarch_tdep (struct gdbarch *gdbarch)
components it was determined that the global aproach was not
applicable. */
-
/* Register a new architectural family with GDB.
Register support for the specified ARCHITECTURE with GDB. When
@@ -250,7 +245,8 @@ struct gdbarch_info
/* Ensure the union is zero-initialized. Relies on the fact that there's
no member larger than TDESC_DATA. */
: tdesc_data ()
- {}
+ {
+ }
const struct bfd_arch_info *bfd_arch_info = nullptr;
@@ -268,15 +264,17 @@ struct gdbarch_info
const struct target_desc *target_desc = nullptr;
};
-typedef struct gdbarch *(gdbarch_init_ftype) (struct gdbarch_info info, struct gdbarch_list *arches);
-typedef void (gdbarch_dump_tdep_ftype) (struct gdbarch *gdbarch, struct ui_file *file);
+typedef struct gdbarch *(gdbarch_init_ftype) (struct gdbarch_info info,
+ struct gdbarch_list *arches);
+typedef void (gdbarch_dump_tdep_ftype) (struct gdbarch *gdbarch,
+ struct ui_file *file);
typedef bool (gdbarch_supports_arch_info_ftype) (const struct bfd_arch_info *);
-extern void gdbarch_register (enum bfd_architecture architecture,
- gdbarch_init_ftype *init,
- gdbarch_dump_tdep_ftype *dump_tdep = nullptr,
- gdbarch_supports_arch_info_ftype *supports_arch_info = nullptr);
-
+extern void
+gdbarch_register (enum bfd_architecture architecture, gdbarch_init_ftype *init,
+ gdbarch_dump_tdep_ftype *dump_tdep = nullptr,
+ gdbarch_supports_arch_info_ftype *supports_arch_info
+ = nullptr);
/* Return a vector of the valid architecture names. Since architectures are
registered during the _initialize phase this function only returns useful
@@ -284,12 +282,12 @@ extern void gdbarch_register (enum bfd_architecture architecture,
extern std::vector<const char *> gdbarch_printable_names ();
-
/* Helper function. Search the list of ARCHES for a GDBARCH that
matches the information provided by INFO. */
-extern struct gdbarch_list *gdbarch_list_lookup_by_info (struct gdbarch_list *arches, const struct gdbarch_info *info);
-
+extern struct gdbarch_list *
+gdbarch_list_lookup_by_info (struct gdbarch_list *arches,
+ const struct gdbarch_info *info);
/* Helper function. Create a preliminary ``struct gdbarch''. Perform
basic initialization using values obtained from the INFO and TDEP
@@ -299,7 +297,6 @@ extern struct gdbarch_list *gdbarch_list_lookup_by_info (struct gdbarch_list *ar
extern struct gdbarch *gdbarch_alloc (const struct gdbarch_info *info,
gdbarch_tdep_up tdep);
-
/* Helper function. Free a partially-constructed ``struct gdbarch''.
It is assumed that the caller freeds the ``struct
gdbarch_tdep''. */
@@ -308,8 +305,7 @@ extern void gdbarch_free (struct gdbarch *);
struct gdbarch_deleter
{
- void operator() (gdbarch *arch) const
- { gdbarch_free (arch); }
+ void operator() (gdbarch *arch) const { gdbarch_free (arch); }
};
using gdbarch_up = std::unique_ptr<gdbarch, gdbarch_deleter>;
@@ -322,9 +318,11 @@ extern obstack *gdbarch_obstack (gdbarch *arch);
obstack. The memory is freed when the corresponding architecture
is also freed. */
-#define GDBARCH_OBSTACK_CALLOC(GDBARCH, NR, TYPE) obstack_calloc<TYPE> (gdbarch_obstack ((GDBARCH)), (NR))
+#define GDBARCH_OBSTACK_CALLOC(GDBARCH, NR, TYPE) \
+ obstack_calloc<TYPE> (gdbarch_obstack ((GDBARCH)), (NR))
-#define GDBARCH_OBSTACK_ZALLOC(GDBARCH, TYPE) obstack_zalloc<TYPE> (gdbarch_obstack ((GDBARCH)))
+#define GDBARCH_OBSTACK_ZALLOC(GDBARCH, TYPE) \
+ obstack_zalloc<TYPE> (gdbarch_obstack ((GDBARCH)))
/* Duplicate STRING, returning an equivalent string that's allocated on the
obstack associated with GDBARCH. The string is freed when the corresponding
@@ -343,7 +341,6 @@ extern char *gdbarch_obstack_strdup (struct gdbarch *arch, const char *string);
extern int gdbarch_update_p (struct gdbarch_info info);
-
/* Helper function. Find an architecture matching info.
INFO should have relevant fields set, and then finished using
@@ -354,12 +351,10 @@ extern int gdbarch_update_p (struct gdbarch_info info);
extern struct gdbarch *gdbarch_find_by_info (struct gdbarch_info info);
-
/* Helper function. Set the target gdbarch to "gdbarch". */
extern void set_target_gdbarch (struct gdbarch *gdbarch);
-
/* A registry adaptor for gdbarch. This arranges to store the
registry in the gdbarch. */
template<>
@@ -373,7 +368,6 @@ struct registry_accessor<gdbarch>
extern void set_gdbarch_from_file (bfd *);
-
/* Initialize the current architecture to the "first" one we find on
our list. */
diff --git a/gdb/gdbcmd.h b/gdb/gdbcmd.h
index 9f6765670c1..c64b0afca71 100644
--- a/gdb/gdbcmd.h
+++ b/gdb/gdbcmd.h
@@ -21,7 +21,7 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
-#if !defined (GDBCMD_H)
+#if !defined(GDBCMD_H)
#define GDBCMD_H 1
#include "command.h"
@@ -34,7 +34,8 @@ extern void execute_command (const char *, int);
/* Run FN. Sends its output to FILE, do not display it to the screen.
The global BATCH_FLAG will be temporarily set to true. */
-extern void execute_fn_to_ui_file (struct ui_file *file, std::function<void(void)> fn);
+extern void execute_fn_to_ui_file (struct ui_file *file,
+ std::function<void (void)> fn);
/* Run FN. Capture its output into the returned string, do not display it
to the screen. The global BATCH_FLAG will temporarily be set to true.
@@ -43,12 +44,13 @@ extern void execute_fn_to_ui_file (struct ui_file *file, std::function<void(void
(e.g. no styling). */
extern void execute_fn_to_string (std::string &res,
- std::function<void(void)> fn, bool term_out);
+ std::function<void (void)> fn,
+ bool term_out);
/* As execute_fn_to_ui_file, but run execute_command for P and FROM_TTY. */
-extern void execute_command_to_ui_file (struct ui_file *file,
- const char *p, int from_tty);
+extern void execute_command_to_ui_file (struct ui_file *file, const char *p,
+ int from_tty);
/* As execute_fn_to_string, but run execute_command for P and FROM_TTY. */
@@ -57,13 +59,13 @@ extern void execute_command_to_string (std::string &res, const char *p,
/* As execute_command_to_string, but ignore resulting string. */
-extern void execute_command_to_string (const char *p,
- int from_tty, bool term_out);
+extern void execute_command_to_string (const char *p, int from_tty,
+ bool term_out);
extern void print_command_line (struct command_line *, unsigned int,
struct ui_file *);
-extern void print_command_lines (struct ui_out *,
- struct command_line *, unsigned int);
+extern void print_command_lines (struct ui_out *, struct command_line *,
+ unsigned int);
/* Chains containing all defined "set/show style" subcommands. */
extern struct cmd_list_element *style_set_list;
diff --git a/gdb/gdbcore.h b/gdb/gdbcore.h
index 56ddea65334..dd5f3daa466 100644
--- a/gdb/gdbcore.h
+++ b/gdb/gdbcore.h
@@ -19,7 +19,7 @@
/* Interface routines for core, executable, etc. */
-#if !defined (GDBCORE_H)
+#if !defined(GDBCORE_H)
#define GDBCORE_H 1
struct type;
@@ -58,8 +58,8 @@ extern void read_code (CORE_ADDR memaddr, gdb_byte *myaddr, ssize_t len);
/* Read an integer from debugged memory, given address and number of
bytes. */
-extern LONGEST read_memory_integer (CORE_ADDR memaddr,
- int len, enum bfd_endian byte_order);
+extern LONGEST read_memory_integer (CORE_ADDR memaddr, int len,
+ enum bfd_endian byte_order);
extern int safe_read_memory_integer (CORE_ADDR memaddr, int len,
enum bfd_endian byte_order,
LONGEST *return_value);
@@ -67,8 +67,7 @@ extern int safe_read_memory_integer (CORE_ADDR memaddr, int len,
/* Read an unsigned integer from debugged memory, given address and
number of bytes. */
-extern ULONGEST read_memory_unsigned_integer (CORE_ADDR memaddr,
- int len,
+extern ULONGEST read_memory_unsigned_integer (CORE_ADDR memaddr, int len,
enum bfd_endian byte_order);
extern int safe_read_memory_unsigned_integer (CORE_ADDR memaddr, int len,
enum bfd_endian byte_order,
@@ -83,8 +82,7 @@ extern LONGEST read_code_integer (CORE_ADDR memaddr, int len,
/* Read an unsigned integer from debugged code memory, given address,
number of bytes, and byte order for code. */
-extern ULONGEST read_code_unsigned_integer (CORE_ADDR memaddr,
- int len,
+extern ULONGEST read_code_unsigned_integer (CORE_ADDR memaddr, int len,
enum bfd_endian byte_order);
/* Read the pointer of type TYPE at ADDR, and return the address it
@@ -113,7 +111,7 @@ extern void write_memory_unsigned_integer (CORE_ADDR addr, int len,
extern void write_memory_signed_integer (CORE_ADDR addr, int len,
enum bfd_endian byte_order,
LONGEST value);
-
+
/* Hook for `exec_file_command' command to call. */
extern void (*deprecated_exec_file_display_hook) (const char *filename);
@@ -147,7 +145,8 @@ extern void exec_file_attach (const char *filename, int from_tty);
the filename of the main executable is already known.
DEFER_BP_RESET uses SYMFILE_DEFER_BP_RESET for the main symbol file. */
-extern void exec_file_locate_attach (int pid, int defer_bp_reset, int from_tty);
+extern void exec_file_locate_attach (int pid, int defer_bp_reset,
+ int from_tty);
extern void validate_files (void);
@@ -175,6 +174,7 @@ extern void set_gnutarget (const char *);
class thread_section_name
{
public:
+
/* NAME is the single-threaded section name. If PTID represents an
LWP, then the build section name is "NAME/LWP", otherwise it's
just "NAME" unmodified. */
@@ -191,12 +191,12 @@ public:
/* Return the computed section name. The result is valid as long as
this thread_section_name object is live. */
- const char *c_str () const
- { return m_section_name; }
+ const char *c_str () const { return m_section_name; }
DISABLE_COPY_AND_ASSIGN (thread_section_name);
private:
+
/* Either a pointer into M_STORAGE, or a pointer to the name passed
as parameter to the constructor. */
const char *m_section_name;
diff --git a/gdb/gdbthread.h b/gdb/gdbthread.h
index c0f27a8a66e..10ec04cf751 100644
--- a/gdb/gdbthread.h
+++ b/gdb/gdbthread.h
@@ -84,11 +84,11 @@ enum thread_state
STEP_OVER_NONE means don't step over any subroutine calls. */
enum step_over_calls_kind
- {
- STEP_OVER_NONE,
- STEP_OVER_ALL,
- STEP_OVER_UNDEBUGGABLE
- };
+{
+ STEP_OVER_NONE,
+ STEP_OVER_ALL,
+ STEP_OVER_UNDEBUGGABLE
+};
/* Inferior thread specific part of `struct infcall_control_state'.
@@ -121,8 +121,8 @@ struct thread_control_state
wait_for_inferior in a minor way if this were changed to the
address of the instruction and that address plus one. But maybe
not). */
- CORE_ADDR step_range_start = 0; /* Inclusive */
- CORE_ADDR step_range_end = 0; /* Exclusive */
+ CORE_ADDR step_range_start = 0; /* Inclusive */
+ CORE_ADDR step_range_end = 0; /* Exclusive */
/* Function the thread was in as of last it started stepping. */
struct symbol *step_start_function = nullptr;
@@ -138,11 +138,15 @@ struct thread_control_state
/* Stack frame address as of when stepping command was issued.
This is how we know when we step into a subroutine call, and how
to set the frame for the breakpoint used to step out. */
- struct frame_id step_frame_id {};
+ struct frame_id step_frame_id
+ {
+ };
/* Similarly, the frame ID of the underlying stack frame (skipping
any inlined frames). */
- struct frame_id step_stack_frame_id {};
+ struct frame_id step_stack_frame_id
+ {
+ };
/* True if the the thread is presently stepping over a breakpoint or
a watchpoint, either with an inline step over or a displaced (out
@@ -245,6 +249,7 @@ class thread_info : public refcounted_object,
public intrusive_list_node<thread_info>
{
public:
+
explicit thread_info (inferior *inf, ptid_t ptid);
~thread_info ();
@@ -253,7 +258,7 @@ public:
/* Mark this thread as running and notify observers. */
void set_running (bool running);
- ptid_t ptid; /* "Actual process id";
+ ptid_t ptid; /* "Actual process id";
In fact, this may be overloaded with
kernel thread id, etc. */
@@ -300,10 +305,7 @@ public:
/* The user-given name of the thread.
Returns nullptr if the thread does not have a user-given name. */
- const char *name () const
- {
- return m_name.get ();
- }
+ const char *name () const { return m_name.get (); }
/* Set the user-given name of the thread.
@@ -313,15 +315,13 @@ public:
m_name = std::move (name);
}
- bool executing () const
- { return m_executing; }
+ bool executing () const { return m_executing; }
/* Set the thread's 'm_executing' field from EXECUTING, and if EXECUTING
is true also clears the thread's stop_pc. */
void set_executing (bool executing);
- bool resumed () const
- { return m_resumed; }
+ bool resumed () const { return m_resumed; }
/* Set the thread's 'm_resumed' field from RESUMED. The thread may also
be added to (when RESUMED is true), or removed from (when RESUMED is
@@ -366,25 +366,16 @@ public:
/* Set this thread's stop PC. */
- void set_stop_pc (CORE_ADDR stop_pc)
- {
- m_suspend.stop_pc = stop_pc;
- }
+ void set_stop_pc (CORE_ADDR stop_pc) { m_suspend.stop_pc = stop_pc; }
/* Remove the stop_pc stored on this thread. */
- void clear_stop_pc ()
- {
- m_suspend.stop_pc.reset ();
- }
+ void clear_stop_pc () { m_suspend.stop_pc.reset (); }
/* Return true if this thread has a cached stop pc value, otherwise
return false. */
- bool stop_pc_p () const
- {
- return m_suspend.stop_pc.has_value ();
- }
+ bool stop_pc_p () const { return m_suspend.stop_pc.has_value (); }
/* Return true if this thread has a pending wait status. */
@@ -418,24 +409,15 @@ public:
/* Return this thread's stop signal. */
- gdb_signal stop_signal () const
- {
- return m_suspend.stop_signal;
- }
+ gdb_signal stop_signal () const { return m_suspend.stop_signal; }
/* Set this thread's stop signal. */
- void set_stop_signal (gdb_signal sig)
- {
- m_suspend.stop_signal = sig;
- }
+ void set_stop_signal (gdb_signal sig) { m_suspend.stop_signal = sig; }
/* Return this thread's stop reason. */
- target_stop_reason stop_reason () const
- {
- return m_suspend.stop_reason;
- }
+ target_stop_reason stop_reason () const { return m_suspend.stop_reason; }
/* Set this thread's stop reason. */
@@ -446,10 +428,7 @@ public:
/* Get the FSM associated with the thread. */
- struct thread_fsm *thread_fsm () const
- {
- return m_thread_fsm.get ();
- }
+ struct thread_fsm *thread_fsm () const { return m_thread_fsm.get (); }
/* Get the owning reference to the FSM associated with the thread.
@@ -525,7 +504,9 @@ public:
std::unique_ptr<private_thread_info> priv;
/* Branch trace information for this thread. */
- struct btrace_thread_info btrace {};
+ struct btrace_thread_info btrace
+ {
+ };
/* Flag which indicates that the stack temporaries should be stored while
evaluating expressions. */
@@ -549,6 +530,7 @@ public:
displaced_step_thread_state displaced_step_state;
private:
+
/* True if this thread is resumed from infrun's perspective.
Note that a thread can be marked both as not-executing and
resumed at the same time. This happens if we try to resume a
@@ -679,8 +661,9 @@ extern struct thread_info *find_thread_ptid (process_stratum_target *targ,
struct thread_info *find_thread_global_id (int global_id);
/* Find thread by thread library specific handle in inferior INF. */
-struct thread_info *find_thread_by_handle
- (gdb::array_view<const gdb_byte> handle, struct inferior *inf);
+struct thread_info *
+find_thread_by_handle (gdb::array_view<const gdb_byte> handle,
+ struct inferior *inf);
/* Finds the first thread of the specified inferior. */
extern struct thread_info *first_thread_of_inferior (inferior *inf);
@@ -694,8 +677,8 @@ extern struct thread_info *any_thread_of_inferior (inferior *inf);
extern struct thread_info *any_live_thread_of_inferior (inferior *inf);
/* Change the ptid of thread OLD_PTID to NEW_PTID. */
-void thread_change_ptid (process_stratum_target *targ,
- ptid_t old_ptid, ptid_t new_ptid);
+void thread_change_ptid (process_stratum_target *targ, ptid_t old_ptid,
+ ptid_t new_ptid);
/* Iterator function to call a user-provided callback function
once for each known thread. */
@@ -780,21 +763,21 @@ extern void switch_to_thread_no_regs (struct thread_info *thread);
MINUS_ONE_PTID, applies to all threads of TARG. If
ptid_is_pid(PTID) is true, applies to all threads of the process
pointed at by {TARG,PTID}. */
-extern void set_resumed (process_stratum_target *targ,
- ptid_t ptid, bool resumed);
+extern void set_resumed (process_stratum_target *targ, ptid_t ptid,
+ bool resumed);
/* Marks thread PTID of TARG as running, or as stopped. If PTID is
minus_one_ptid, marks all threads of TARG. */
-extern void set_running (process_stratum_target *targ,
- ptid_t ptid, bool running);
+extern void set_running (process_stratum_target *targ, ptid_t ptid,
+ bool running);
/* Marks or clears thread(s) PTID of TARG as having been requested to
stop. If PTID is MINUS_ONE_PTID, applies to all threads of TARG.
If ptid_is_pid(PTID) is true, applies to all threads of the process
pointed at by {TARG, PTID}. If STOP, then the
THREAD_STOP_REQUESTED observer is called with PTID as argument. */
-extern void set_stop_requested (process_stratum_target *targ,
- ptid_t ptid, bool stop);
+extern void set_stop_requested (process_stratum_target *targ, ptid_t ptid,
+ bool stop);
/* Marks thread PTID of TARG as executing, or not. If PTID is
minus_one_ptid, marks all threads of TARG.
@@ -802,8 +785,8 @@ extern void set_stop_requested (process_stratum_target *targ,
Note that this is different from the running state. See the
description of state and executing fields of struct
thread_info. */
-extern void set_executing (process_stratum_target *targ,
- ptid_t ptid, bool executing);
+extern void set_executing (process_stratum_target *targ, ptid_t ptid,
+ bool executing);
/* True if any (known or unknown) thread of TARG is or may be
executing. */
@@ -823,8 +806,7 @@ extern void finish_thread_state (process_stratum_target *targ, ptid_t ptid);
/* Calls finish_thread_state on scope exit, unless release() is called
to disengage. */
-using scoped_finish_thread_state
- = FORWARD_SCOPE_EXIT (finish_thread_state);
+using scoped_finish_thread_state = FORWARD_SCOPE_EXIT (finish_thread_state);
/* Commands with a prefix of `thread'. */
extern struct cmd_list_element *thread_cmd_list;
@@ -843,14 +825,14 @@ extern bool print_thread_events;
NULL and PID is not -1, then the thread is printed if it belongs to
the specified process. Otherwise, an error is raised. */
extern void print_thread_info (struct ui_out *uiout,
- const char *requested_threads,
- int pid);
+ const char *requested_threads, int pid);
/* Save/restore current inferior/thread/frame. */
class scoped_restore_current_thread
{
public:
+
scoped_restore_current_thread ();
~scoped_restore_current_thread ();
@@ -860,6 +842,7 @@ public:
void dont_restore () { m_dont_restore = true; }
private:
+
void restore ();
bool m_dont_restore = false;
@@ -877,7 +860,7 @@ private:
/* Returns a pointer into the thread_info corresponding to
INFERIOR_PTID. INFERIOR_PTID *must* be in the thread list. */
-extern struct thread_info* inferior_thread (void);
+extern struct thread_info *inferior_thread (void);
extern void update_thread_list (void);
@@ -924,7 +907,8 @@ private:
extern bool thread_stack_temporaries_enabled_p (struct thread_info *tp);
-extern void push_thread_stack_temporary (struct thread_info *tp, struct value *v);
+extern void push_thread_stack_temporary (struct thread_info *tp,
+ struct value *v);
extern value *get_last_thread_stack_temporary (struct thread_info *tp);
@@ -946,11 +930,9 @@ using thread_step_over_list_safe_range
static inline thread_step_over_list_safe_range
make_thread_step_over_list_safe_range (thread_step_over_list &list)
{
- return thread_step_over_list_safe_range
- (thread_step_over_list_safe_iterator (list.begin (),
- list.end ()),
- thread_step_over_list_safe_iterator (list.end (),
- list.end ()));
+ return thread_step_over_list_safe_range (
+ thread_step_over_list_safe_iterator (list.begin (), list.end ()),
+ thread_step_over_list_safe_iterator (list.end (), list.end ()));
}
/* Add TP to the end of the global pending step-over chain. */
@@ -960,8 +942,8 @@ extern void global_thread_step_over_chain_enqueue (thread_info *tp);
/* Append the thread step over list LIST to the global thread step over
chain. */
-extern void global_thread_step_over_chain_enqueue_chain
- (thread_step_over_list &&list);
+extern void
+global_thread_step_over_chain_enqueue_chain (thread_step_over_list &&list);
/* Remove TP from the global pending step-over chain. */
@@ -1026,9 +1008,8 @@ extern bool switch_to_thread_if_alive (thread_info *thr);
exception if !FLAGS.SILENT and !FLAGS.CONT and CMD fails. */
extern void thread_try_catch_cmd (thread_info *thr,
- gdb::optional<int> ada_task,
- const char *cmd, int from_tty,
- const qcs_flags &flags);
+ gdb::optional<int> ada_task, const char *cmd,
+ int from_tty, const qcs_flags &flags);
/* Return a string representation of STATE. */
diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c
index 45751c9c895..3f119103e5f 100644
--- a/gdb/gdbtypes.c
+++ b/gdb/gdbtypes.c
@@ -52,82 +52,58 @@ copy_dynamic_prop_list (struct obstack *, struct dynamic_prop_list *);
/* Initialize BADNESS constants. */
-const struct rank LENGTH_MISMATCH_BADNESS = {INVALID_CONVERSION,0};
-
-const struct rank TOO_FEW_PARAMS_BADNESS = {INVALID_CONVERSION,0};
-const struct rank INCOMPATIBLE_TYPE_BADNESS = {INVALID_CONVERSION,0};
-
-const struct rank EXACT_MATCH_BADNESS = {0,0};
-
-const struct rank INTEGER_PROMOTION_BADNESS = {1,0};
-const struct rank FLOAT_PROMOTION_BADNESS = {1,0};
-const struct rank BASE_PTR_CONVERSION_BADNESS = {1,0};
-const struct rank CV_CONVERSION_BADNESS = {1, 0};
-const struct rank INTEGER_CONVERSION_BADNESS = {2,0};
-const struct rank FLOAT_CONVERSION_BADNESS = {2,0};
-const struct rank INT_FLOAT_CONVERSION_BADNESS = {2,0};
-const struct rank VOID_PTR_CONVERSION_BADNESS = {2,0};
-const struct rank BOOL_CONVERSION_BADNESS = {3,0};
-const struct rank BASE_CONVERSION_BADNESS = {2,0};
-const struct rank REFERENCE_CONVERSION_BADNESS = {2,0};
-const struct rank REFERENCE_SEE_THROUGH_BADNESS = {0,1};
-const struct rank NULL_POINTER_CONVERSION_BADNESS = {2,0};
-const struct rank NS_POINTER_CONVERSION_BADNESS = {10,0};
-const struct rank NS_INTEGER_POINTER_CONVERSION_BADNESS = {3,0};
+const struct rank LENGTH_MISMATCH_BADNESS = { INVALID_CONVERSION, 0 };
+
+const struct rank TOO_FEW_PARAMS_BADNESS = { INVALID_CONVERSION, 0 };
+const struct rank INCOMPATIBLE_TYPE_BADNESS = { INVALID_CONVERSION, 0 };
+
+const struct rank EXACT_MATCH_BADNESS = { 0, 0 };
+
+const struct rank INTEGER_PROMOTION_BADNESS = { 1, 0 };
+const struct rank FLOAT_PROMOTION_BADNESS = { 1, 0 };
+const struct rank BASE_PTR_CONVERSION_BADNESS = { 1, 0 };
+const struct rank CV_CONVERSION_BADNESS = { 1, 0 };
+const struct rank INTEGER_CONVERSION_BADNESS = { 2, 0 };
+const struct rank FLOAT_CONVERSION_BADNESS = { 2, 0 };
+const struct rank INT_FLOAT_CONVERSION_BADNESS = { 2, 0 };
+const struct rank VOID_PTR_CONVERSION_BADNESS = { 2, 0 };
+const struct rank BOOL_CONVERSION_BADNESS = { 3, 0 };
+const struct rank BASE_CONVERSION_BADNESS = { 2, 0 };
+const struct rank REFERENCE_CONVERSION_BADNESS = { 2, 0 };
+const struct rank REFERENCE_SEE_THROUGH_BADNESS = { 0, 1 };
+const struct rank NULL_POINTER_CONVERSION_BADNESS = { 2, 0 };
+const struct rank NS_POINTER_CONVERSION_BADNESS = { 10, 0 };
+const struct rank NS_INTEGER_POINTER_CONVERSION_BADNESS = { 3, 0 };
/* Floatformat pairs. */
-const struct floatformat *floatformats_ieee_half[BFD_ENDIAN_UNKNOWN] = {
- &floatformat_ieee_half_big,
- &floatformat_ieee_half_little
-};
-const struct floatformat *floatformats_ieee_single[BFD_ENDIAN_UNKNOWN] = {
- &floatformat_ieee_single_big,
- &floatformat_ieee_single_little
-};
-const struct floatformat *floatformats_ieee_double[BFD_ENDIAN_UNKNOWN] = {
- &floatformat_ieee_double_big,
- &floatformat_ieee_double_little
-};
-const struct floatformat *floatformats_ieee_quad[BFD_ENDIAN_UNKNOWN] = {
- &floatformat_ieee_quad_big,
- &floatformat_ieee_quad_little
-};
-const struct floatformat *floatformats_ieee_double_littlebyte_bigword[BFD_ENDIAN_UNKNOWN] = {
- &floatformat_ieee_double_big,
- &floatformat_ieee_double_littlebyte_bigword
-};
-const struct floatformat *floatformats_i387_ext[BFD_ENDIAN_UNKNOWN] = {
- &floatformat_i387_ext,
- &floatformat_i387_ext
-};
-const struct floatformat *floatformats_m68881_ext[BFD_ENDIAN_UNKNOWN] = {
- &floatformat_m68881_ext,
- &floatformat_m68881_ext
-};
-const struct floatformat *floatformats_arm_ext[BFD_ENDIAN_UNKNOWN] = {
- &floatformat_arm_ext_big,
- &floatformat_arm_ext_littlebyte_bigword
-};
-const struct floatformat *floatformats_ia64_spill[BFD_ENDIAN_UNKNOWN] = {
- &floatformat_ia64_spill_big,
- &floatformat_ia64_spill_little
-};
-const struct floatformat *floatformats_vax_f[BFD_ENDIAN_UNKNOWN] = {
- &floatformat_vax_f,
- &floatformat_vax_f
-};
-const struct floatformat *floatformats_vax_d[BFD_ENDIAN_UNKNOWN] = {
- &floatformat_vax_d,
- &floatformat_vax_d
-};
-const struct floatformat *floatformats_ibm_long_double[BFD_ENDIAN_UNKNOWN] = {
- &floatformat_ibm_long_double_big,
- &floatformat_ibm_long_double_little
-};
-const struct floatformat *floatformats_bfloat16[BFD_ENDIAN_UNKNOWN] = {
- &floatformat_bfloat16_big,
- &floatformat_bfloat16_little
-};
+const struct floatformat *floatformats_ieee_half[BFD_ENDIAN_UNKNOWN]
+ = { &floatformat_ieee_half_big, &floatformat_ieee_half_little };
+const struct floatformat *floatformats_ieee_single[BFD_ENDIAN_UNKNOWN]
+ = { &floatformat_ieee_single_big, &floatformat_ieee_single_little };
+const struct floatformat *floatformats_ieee_double[BFD_ENDIAN_UNKNOWN]
+ = { &floatformat_ieee_double_big, &floatformat_ieee_double_little };
+const struct floatformat *floatformats_ieee_quad[BFD_ENDIAN_UNKNOWN]
+ = { &floatformat_ieee_quad_big, &floatformat_ieee_quad_little };
+const struct floatformat
+ *floatformats_ieee_double_littlebyte_bigword[BFD_ENDIAN_UNKNOWN]
+ = { &floatformat_ieee_double_big,
+ &floatformat_ieee_double_littlebyte_bigword };
+const struct floatformat *floatformats_i387_ext[BFD_ENDIAN_UNKNOWN]
+ = { &floatformat_i387_ext, &floatformat_i387_ext };
+const struct floatformat *floatformats_m68881_ext[BFD_ENDIAN_UNKNOWN]
+ = { &floatformat_m68881_ext, &floatformat_m68881_ext };
+const struct floatformat *floatformats_arm_ext[BFD_ENDIAN_UNKNOWN]
+ = { &floatformat_arm_ext_big, &floatformat_arm_ext_littlebyte_bigword };
+const struct floatformat *floatformats_ia64_spill[BFD_ENDIAN_UNKNOWN]
+ = { &floatformat_ia64_spill_big, &floatformat_ia64_spill_little };
+const struct floatformat *floatformats_vax_f[BFD_ENDIAN_UNKNOWN]
+ = { &floatformat_vax_f, &floatformat_vax_f };
+const struct floatformat *floatformats_vax_d[BFD_ENDIAN_UNKNOWN]
+ = { &floatformat_vax_d, &floatformat_vax_d };
+const struct floatformat *floatformats_ibm_long_double[BFD_ENDIAN_UNKNOWN]
+ = { &floatformat_ibm_long_double_big, &floatformat_ibm_long_double_little };
+const struct floatformat *floatformats_bfloat16[BFD_ENDIAN_UNKNOWN]
+ = { &floatformat_bfloat16_big, &floatformat_bfloat16_little };
/* Should opaque types be resolved? */
@@ -145,11 +121,11 @@ static bool strict_type_checking = true;
static void
show_opaque_type_resolution (struct ui_file *file, int from_tty,
- struct cmd_list_element *c,
- const char *value)
+ struct cmd_list_element *c, const char *value)
{
- gdb_printf (file, _("Resolution of opaque struct/class/union types "
- "(if set before loading symbols) is %s.\n"),
+ gdb_printf (file,
+ _ ("Resolution of opaque struct/class/union types "
+ "(if set before loading symbols) is %s.\n"),
value);
}
@@ -159,8 +135,7 @@ static void
show_overload_debug (struct ui_file *file, int from_tty,
struct cmd_list_element *c, const char *value)
{
- gdb_printf (file, _("Debugging of C++ overloading is %s.\n"),
- value);
+ gdb_printf (file, _ ("Debugging of C++ overloading is %s.\n"), value);
}
/* A function to show the status of strict type checking. */
@@ -169,10 +144,9 @@ static void
show_strict_type_checking (struct ui_file *file, int from_tty,
struct cmd_list_element *c, const char *value)
{
- gdb_printf (file, _("Strict type checking is %s.\n"), value);
+ gdb_printf (file, _ ("Strict type checking is %s.\n"), value);
}
-
/* Allocate a new OBJFILE-associated type structure and fill it
with some defaults. Space for the type structure is allocated
on the objfile's objfile_obstack. */
@@ -186,8 +160,8 @@ alloc_type (struct objfile *objfile)
/* Alloc the structure and start off with all fields zeroed. */
type = OBSTACK_ZALLOC (&objfile->objfile_obstack, struct type);
- TYPE_MAIN_TYPE (type) = OBSTACK_ZALLOC (&objfile->objfile_obstack,
- struct main_type);
+ TYPE_MAIN_TYPE (type)
+ = OBSTACK_ZALLOC (&objfile->objfile_obstack, struct main_type);
OBJSTAT (objfile, n_types++);
type->set_owner (objfile);
@@ -195,7 +169,7 @@ alloc_type (struct objfile *objfile)
/* Initialize the fields that might not be zero. */
type->set_code (TYPE_CODE_UNDEF);
- TYPE_CHAIN (type) = type; /* Chain back to itself. */
+ TYPE_CHAIN (type) = type; /* Chain back to itself. */
return type;
}
@@ -221,7 +195,7 @@ alloc_type_arch (struct gdbarch *gdbarch)
/* Initialize the fields that might not be zero. */
type->set_code (TYPE_CODE_UNDEF);
- TYPE_CHAIN (type) = type; /* Chain back to itself. */
+ TYPE_CHAIN (type) = type; /* Chain back to itself. */
return type;
}
@@ -303,7 +277,7 @@ alloc_type_instance (struct type *oldtype)
TYPE_MAIN_TYPE (type) = TYPE_MAIN_TYPE (oldtype);
- TYPE_CHAIN (type) = type; /* Chain back to itself for now. */
+ TYPE_CHAIN (type) = type; /* Chain back to itself for now. */
return type;
}
@@ -340,7 +314,7 @@ smash_type (struct type *type)
struct type *
make_pointer_type (struct type *type, struct type **typeptr)
{
- struct type *ntype; /* New type */
+ struct type *ntype; /* New type */
struct type *chain;
ntype = TYPE_POINTER_TYPE (type);
@@ -348,22 +322,22 @@ make_pointer_type (struct type *type, struct type **typeptr)
if (ntype)
{
if (typeptr == 0)
- return ntype; /* Don't care about alloc,
+ return ntype; /* Don't care about alloc,
and have new type. */
else if (*typeptr == 0)
{
- *typeptr = ntype; /* Tracking alloc, and have new type. */
+ *typeptr = ntype; /* Tracking alloc, and have new type. */
return ntype;
}
}
- if (typeptr == 0 || *typeptr == 0) /* We'll need to allocate one. */
+ if (typeptr == 0 || *typeptr == 0) /* We'll need to allocate one. */
{
ntype = alloc_type_copy (type);
if (typeptr)
*typeptr = ntype;
}
- else /* We have storage, but need to reset it. */
+ else /* We have storage, but need to reset it. */
{
ntype = *typeptr;
chain = TYPE_CHAIN (ntype);
@@ -412,36 +386,36 @@ lookup_pointer_type (struct type *type)
struct type *
make_reference_type (struct type *type, struct type **typeptr,
- enum type_code refcode)
+ enum type_code refcode)
{
- struct type *ntype; /* New type */
+ struct type *ntype; /* New type */
struct type **reftype;
struct type *chain;
gdb_assert (refcode == TYPE_CODE_REF || refcode == TYPE_CODE_RVALUE_REF);
ntype = (refcode == TYPE_CODE_REF ? TYPE_REFERENCE_TYPE (type)
- : TYPE_RVALUE_REFERENCE_TYPE (type));
+ : TYPE_RVALUE_REFERENCE_TYPE (type));
if (ntype)
{
if (typeptr == 0)
- return ntype; /* Don't care about alloc,
+ return ntype; /* Don't care about alloc,
and have new type. */
else if (*typeptr == 0)
{
- *typeptr = ntype; /* Tracking alloc, and have new type. */
+ *typeptr = ntype; /* Tracking alloc, and have new type. */
return ntype;
}
}
- if (typeptr == 0 || *typeptr == 0) /* We'll need to allocate one. */
+ if (typeptr == 0 || *typeptr == 0) /* We'll need to allocate one. */
{
ntype = alloc_type_copy (type);
if (typeptr)
*typeptr = ntype;
}
- else /* We have storage, but need to reset it. */
+ else /* We have storage, but need to reset it. */
{
ntype = *typeptr;
chain = TYPE_CHAIN (ntype);
@@ -451,7 +425,7 @@ make_reference_type (struct type *type, struct type **typeptr,
ntype->set_target_type (type);
reftype = (refcode == TYPE_CODE_REF ? &TYPE_REFERENCE_TYPE (type)
- : &TYPE_RVALUE_REFERENCE_TYPE (type));
+ : &TYPE_RVALUE_REFERENCE_TYPE (type));
*reftype = ntype;
@@ -508,15 +482,15 @@ lookup_rvalue_reference_type (struct type *type)
struct type *
make_function_type (struct type *type, struct type **typeptr)
{
- struct type *ntype; /* New type */
+ struct type *ntype; /* New type */
- if (typeptr == 0 || *typeptr == 0) /* We'll need to allocate one. */
+ if (typeptr == 0 || *typeptr == 0) /* We'll need to allocate one. */
{
ntype = alloc_type_copy (type);
if (typeptr)
*typeptr = ntype;
}
- else /* We have storage, but need to reset it. */
+ else /* We have storage, but need to reset it. */
{
ntype = *typeptr;
smash_type (ntype);
@@ -546,8 +520,7 @@ lookup_function_type (struct type *type)
varargs function. */
struct type *
-lookup_function_type_with_arguments (struct type *type,
- int nparams,
+lookup_function_type_with_arguments (struct type *type, int nparams,
struct type **param_types)
{
struct type *fn = make_function_type (type, (struct type **) 0);
@@ -573,8 +546,8 @@ lookup_function_type_with_arguments (struct type *type,
}
fn->set_num_fields (nparams);
- fn->set_fields
- ((struct field *) TYPE_ZALLOC (fn, nparams * sizeof (struct field)));
+ fn->set_fields ((struct field *)
+ TYPE_ZALLOC (fn, nparams * sizeof (struct field)));
for (i = 0; i < nparams; ++i)
fn->field (i).set_type (param_types[i]);
@@ -601,7 +574,7 @@ address_space_name_to_type_instance_flags (struct gdbarch *gdbarch,
&type_flags))
return type_flags;
else
- error (_("Unknown address space specifier: \"%s\""), space_identifier);
+ error (_ ("Unknown address space specifier: \"%s\""), space_identifier);
}
/* Identify address space identifier by type_instance_flags and return
@@ -689,11 +662,11 @@ struct type *
make_type_with_address_space (struct type *type,
type_instance_flags space_flag)
{
- type_instance_flags new_flags = ((type->instance_flags ()
- & ~(TYPE_INSTANCE_FLAG_CODE_SPACE
- | TYPE_INSTANCE_FLAG_DATA_SPACE
- | TYPE_INSTANCE_FLAG_ADDRESS_CLASS_ALL))
- | space_flag);
+ type_instance_flags new_flags
+ = ((type->instance_flags ()
+ & ~(TYPE_INSTANCE_FLAG_CODE_SPACE | TYPE_INSTANCE_FLAG_DATA_SPACE
+ | TYPE_INSTANCE_FLAG_ADDRESS_CLASS_ALL))
+ | space_flag);
return make_qualified_type (type, new_flags, NULL);
}
@@ -711,15 +684,13 @@ make_type_with_address_space (struct type *type,
new type we construct. */
struct type *
-make_cv_type (int cnst, int voltl,
- struct type *type,
- struct type **typeptr)
+make_cv_type (int cnst, int voltl, struct type *type, struct type **typeptr)
{
- struct type *ntype; /* New type */
+ struct type *ntype; /* New type */
- type_instance_flags new_flags = (type->instance_flags ()
- & ~(TYPE_INSTANCE_FLAG_CONST
- | TYPE_INSTANCE_FLAG_VOLATILE));
+ type_instance_flags new_flags
+ = (type->instance_flags ()
+ & ~(TYPE_INSTANCE_FLAG_CONST | TYPE_INSTANCE_FLAG_VOLATILE));
if (cnst)
new_flags |= TYPE_INSTANCE_FLAG_CONST;
@@ -743,9 +714,8 @@ make_cv_type (int cnst, int voltl,
name each time you encounter them. */
gdb_assert ((*typeptr)->objfile_owner () == type->objfile_owner ());
}
-
- ntype = make_qualified_type (type, new_flags,
- typeptr ? *typeptr : NULL);
+
+ ntype = make_qualified_type (type, new_flags, typeptr ? *typeptr : NULL);
if (typeptr != NULL)
*typeptr = ntype;
@@ -758,10 +728,8 @@ make_cv_type (int cnst, int voltl,
struct type *
make_restrict_type (struct type *type)
{
- return make_qualified_type (type,
- (type->instance_flags ()
- | TYPE_INSTANCE_FLAG_RESTRICT),
- NULL);
+ return make_qualified_type (
+ type, (type->instance_flags () | TYPE_INSTANCE_FLAG_RESTRICT), NULL);
}
/* Make a type without const, volatile, or restrict. */
@@ -782,10 +750,8 @@ make_unqualified_type (struct type *type)
struct type *
make_atomic_type (struct type *type)
{
- return make_qualified_type (type,
- (type->instance_flags ()
- | TYPE_INSTANCE_FLAG_ATOMIC),
- NULL);
+ return make_qualified_type (
+ type, (type->instance_flags () | TYPE_INSTANCE_FLAG_ATOMIC), NULL);
}
/* Replace the contents of ntype with the type *type. This changes the
@@ -915,11 +881,9 @@ operator== (const range_bounds &l, const range_bounds &r)
{
#define FIELD_EQ(FIELD) (l.FIELD == r.FIELD)
- return (FIELD_EQ (low)
- && FIELD_EQ (high)
+ return (FIELD_EQ (low) && FIELD_EQ (high)
&& FIELD_EQ (flag_upper_bound_is_count)
- && FIELD_EQ (flag_bound_evaluated)
- && FIELD_EQ (bias));
+ && FIELD_EQ (flag_bound_evaluated) && FIELD_EQ (bias));
#undef FIELD_EQ
}
@@ -930,8 +894,7 @@ operator== (const range_bounds &l, const range_bounds &r)
struct type *
create_range_type (struct type *result_type, struct type *index_type,
const struct dynamic_prop *low_bound,
- const struct dynamic_prop *high_bound,
- LONGEST bias)
+ const struct dynamic_prop *high_bound, LONGEST bias)
{
/* The INDEX_TYPE should be a type capable of holding the upper and lower
bounds, as such a zero sized, or void type makes no sense. */
@@ -982,8 +945,8 @@ create_range_type (struct type *result_type, struct type *index_type,
result_type->set_is_unsigned (false);
}
- result_type->set_endianity_is_not_default
- (index_type->endianity_is_not_default ());
+ result_type->set_endianity_is_not_default (
+ index_type->endianity_is_not_default ());
return result_type;
}
@@ -995,12 +958,11 @@ create_range_type_with_stride (struct type *result_type,
struct type *index_type,
const struct dynamic_prop *low_bound,
const struct dynamic_prop *high_bound,
- LONGEST bias,
- const struct dynamic_prop *stride,
+ LONGEST bias, const struct dynamic_prop *stride,
bool byte_stride_p)
{
- result_type = create_range_type (result_type, index_type, low_bound,
- high_bound, bias);
+ result_type
+ = create_range_type (result_type, index_type, low_bound, high_bound, bias);
gdb_assert (stride != nullptr);
result_type->bounds ()->stride = *stride;
@@ -1009,8 +971,6 @@ create_range_type_with_stride (struct type *result_type,
return result_type;
}
-
-
/* Create a range type using either a blank type supplied in
RESULT_TYPE, or creating a new type, inheriting the objfile from
INDEX_TYPE.
@@ -1104,7 +1064,7 @@ get_discrete_low_bound (struct type *type)
return 0;
case TYPE_CODE_INT:
- if (type->length () > sizeof (LONGEST)) /* Too big */
+ if (type->length () > sizeof (LONGEST)) /* Too big */
return {};
if (!type->is_unsigned ())
@@ -1171,7 +1131,7 @@ get_discrete_high_bound (struct type *type)
return 1;
case TYPE_CODE_INT:
- if (type->length () > sizeof (LONGEST)) /* Too big */
+ if (type->length () > sizeof (LONGEST)) /* Too big */
return {};
if (!type->is_unsigned ())
@@ -1288,8 +1248,7 @@ update_static_array_size (struct type *type)
if (type->dyn_prop (DYN_PROP_BYTE_STRIDE) == nullptr
&& has_static_range (range_type->bounds ())
- && (!type_not_associated (type)
- && !type_not_allocated (type)))
+ && (!type_not_associated (type) && !type_not_allocated (type)))
{
LONGEST low_bound, high_bound;
int stride;
@@ -1371,8 +1330,7 @@ create_array_type_with_stride (struct type *result_type,
struct dynamic_prop *byte_stride_prop,
unsigned int bit_stride)
{
- if (byte_stride_prop != NULL
- && byte_stride_prop->kind () == PROP_CONST)
+ if (byte_stride_prop != NULL && byte_stride_prop->kind () == PROP_CONST)
{
/* The byte stride is actually not dynamic. Pretend we were
called with bit_stride set instead of byte_stride_prop.
@@ -1389,8 +1347,8 @@ create_array_type_with_stride (struct type *result_type,
result_type->set_target_type (element_type);
result_type->set_num_fields (1);
- result_type->set_fields
- ((struct field *) TYPE_ZALLOC (result_type, sizeof (struct field)));
+ result_type->set_fields ((struct field *)
+ TYPE_ZALLOC (result_type, sizeof (struct field)));
result_type->set_index_type (range_type);
if (byte_stride_prop != NULL)
result_type->add_dyn_prop (DYN_PROP_BYTE_STRIDE, *byte_stride_prop);
@@ -1419,17 +1377,16 @@ create_array_type_with_stride (struct type *result_type,
(BIT_STRIDE = 0), thus building an unpacked array. */
struct type *
-create_array_type (struct type *result_type,
- struct type *element_type,
+create_array_type (struct type *result_type, struct type *element_type,
struct type *range_type)
{
- return create_array_type_with_stride (result_type, element_type,
- range_type, NULL, 0);
+ return create_array_type_with_stride (result_type, element_type, range_type,
+ NULL, 0);
}
struct type *
-lookup_array_range_type (struct type *element_type,
- LONGEST low_bound, LONGEST high_bound)
+lookup_array_range_type (struct type *element_type, LONGEST low_bound,
+ LONGEST high_bound)
{
struct type *index_type;
struct type *range_type;
@@ -1439,8 +1396,8 @@ lookup_array_range_type (struct type *element_type,
else
index_type = builtin_type (element_type->arch_owner ())->builtin_int;
- range_type = create_static_range_type (NULL, index_type,
- low_bound, high_bound);
+ range_type
+ = create_static_range_type (NULL, index_type, low_bound, high_bound);
return create_array_type (NULL, element_type, range_type);
}
@@ -1458,25 +1415,22 @@ lookup_array_range_type (struct type *element_type,
type? */
struct type *
-create_string_type (struct type *result_type,
- struct type *string_char_type,
+create_string_type (struct type *result_type, struct type *string_char_type,
struct type *range_type)
{
- result_type = create_array_type (result_type,
- string_char_type,
- range_type);
+ result_type = create_array_type (result_type, string_char_type, range_type);
result_type->set_code (TYPE_CODE_STRING);
return result_type;
}
struct type *
-lookup_string_range_type (struct type *string_char_type,
- LONGEST low_bound, LONGEST high_bound)
+lookup_string_range_type (struct type *string_char_type, LONGEST low_bound,
+ LONGEST high_bound)
{
struct type *result_type;
- result_type = lookup_array_range_type (string_char_type,
- low_bound, high_bound);
+ result_type
+ = lookup_array_range_type (string_char_type, low_bound, high_bound);
result_type->set_code (TYPE_CODE_STRING);
return result_type;
}
@@ -1489,8 +1443,8 @@ create_set_type (struct type *result_type, struct type *domain_type)
result_type->set_code (TYPE_CODE_SET);
result_type->set_num_fields (1);
- result_type->set_fields
- ((struct field *) TYPE_ZALLOC (result_type, sizeof (struct field)));
+ result_type->set_fields ((struct field *)
+ TYPE_ZALLOC (result_type, sizeof (struct field)));
if (!domain_type->is_stub ())
{
@@ -1650,8 +1604,8 @@ smash_to_methodptr_type (struct type *type, struct type *to_type)
void
smash_to_method_type (struct type *type, struct type *self_type,
- struct type *to_type, struct field *args,
- int nargs, int varargs)
+ struct type *to_type, struct field *args, int nargs,
+ int varargs)
{
smash_type (type);
type->set_code (TYPE_CODE_METHOD);
@@ -1689,9 +1643,9 @@ type_name_or_error (struct type *type)
name = saved_type->name ();
objfile = saved_type->objfile_owner ();
- error (_("Invalid anonymous type %s [in module %s], GCC PR debug/47510 bug?"),
- name ? name : "<anonymous>",
- objfile ? objfile_name (objfile) : "<arch>");
+ error (
+ _ ("Invalid anonymous type %s [in module %s], GCC PR debug/47510 bug?"),
+ name ? name : "<anonymous>", objfile ? objfile_name (objfile) : "<arch>");
}
/* Lookup a typedef or primitive type named NAME, visible in lexical
@@ -1699,20 +1653,20 @@ type_name_or_error (struct type *type)
suitably defined. */
struct type *
-lookup_typename (const struct language_defn *language,
- const char *name,
+lookup_typename (const struct language_defn *language, const char *name,
const struct block *block, int noerr)
{
struct symbol *sym;
sym = lookup_symbol_in_language (name, block, VAR_DOMAIN,
- language->la_language, NULL).symbol;
+ language->la_language, NULL)
+ .symbol;
if (sym != NULL && sym->aclass () == LOC_TYPEDEF)
return sym->type ();
if (noerr)
return NULL;
- error (_("No type named %s."), name);
+ error (_ ("No type named %s."), name);
}
struct type *
@@ -1747,11 +1701,11 @@ lookup_struct (const char *name, const struct block *block)
if (sym == NULL)
{
- error (_("No struct type named %s."), name);
+ error (_ ("No struct type named %s."), name);
}
if (sym->type ()->code () != TYPE_CODE_STRUCT)
{
- error (_("This context has class, union or enum %s, not a struct."),
+ error (_ ("This context has class, union or enum %s, not a struct."),
name);
}
return (sym->type ());
@@ -1769,7 +1723,7 @@ lookup_union (const char *name, const struct block *block)
sym = lookup_symbol (name, block, STRUCT_DOMAIN, 0).symbol;
if (sym == NULL)
- error (_("No union type named %s."), name);
+ error (_ ("No union type named %s."), name);
t = sym->type ();
@@ -1777,8 +1731,7 @@ lookup_union (const char *name, const struct block *block)
return t;
/* If we get here, it's not a union. */
- error (_("This context has class, struct or enum %s, not a union."),
- name);
+ error (_ ("This context has class, struct or enum %s, not a union."), name);
}
/* Lookup an enum type named "enum NAME",
@@ -1792,11 +1745,11 @@ lookup_enum (const char *name, const struct block *block)
sym = lookup_symbol (name, block, STRUCT_DOMAIN, 0).symbol;
if (sym == NULL)
{
- error (_("No enum type named %s."), name);
+ error (_ ("No enum type named %s."), name);
}
if (sym->type ()->code () != TYPE_CODE_ENUM)
{
- error (_("This context has class, struct or union %s, not an enum."),
+ error (_ ("This context has class, struct or union %s, not an enum."),
name);
}
return (sym->type ());
@@ -1806,27 +1759,26 @@ lookup_enum (const char *name, const struct block *block)
visible in lexical block BLOCK. */
struct type *
-lookup_template_type (const char *name, struct type *type,
+lookup_template_type (const char *name, struct type *type,
const struct block *block)
{
struct symbol *sym;
- char *nam = (char *)
- alloca (strlen (name) + strlen (type->name ()) + 4);
+ char *nam = (char *) alloca (strlen (name) + strlen (type->name ()) + 4);
strcpy (nam, name);
strcat (nam, "<");
strcat (nam, type->name ());
- strcat (nam, " >"); /* FIXME, extra space still introduced in gcc? */
+ strcat (nam, " >"); /* FIXME, extra space still introduced in gcc? */
sym = lookup_symbol (nam, block, VAR_DOMAIN, 0).symbol;
if (sym == NULL)
{
- error (_("No template type named %s."), name);
+ error (_ ("No template type named %s."), name);
}
if (sym->type ()->code () != TYPE_CODE_STRUCT)
{
- error (_("This context has class, union or enum %s, not a struct."),
+ error (_ ("This context has class, union or enum %s, not a struct."),
name);
}
return (sym->type ());
@@ -1842,17 +1794,15 @@ lookup_struct_elt (struct type *type, const char *name, int noerr)
for (;;)
{
type = check_typedef (type);
- if (type->code () != TYPE_CODE_PTR
- && type->code () != TYPE_CODE_REF)
+ if (type->code () != TYPE_CODE_PTR && type->code () != TYPE_CODE_REF)
break;
type = type->target_type ();
}
- if (type->code () != TYPE_CODE_STRUCT
- && type->code () != TYPE_CODE_UNION)
+ if (type->code () != TYPE_CODE_STRUCT && type->code () != TYPE_CODE_UNION)
{
std::string type_name = type_to_string (type);
- error (_("Type %s is not a structure or union type."),
+ error (_ ("Type %s is not a structure or union type."),
type_name.c_str ());
}
@@ -1862,7 +1812,7 @@ lookup_struct_elt (struct type *type, const char *name, int noerr)
if (t_field_name && (strcmp_iw (t_field_name, name) == 0))
{
- return {&type->field (i), type->field (i).loc_bitpos ()};
+ return { &type->field (i), type->field (i).loc_bitpos () };
}
else if (!t_field_name || *t_field_name == '\0')
{
@@ -1885,10 +1835,10 @@ lookup_struct_elt (struct type *type, const char *name, int noerr)
}
if (noerr)
- return {nullptr, 0};
+ return { nullptr, 0 };
std::string type_name = type_to_string (type);
- error (_("Type %s has no component named %s."), type_name.c_str (), name);
+ error (_ ("Type %s has no component named %s."), type_name.c_str (), name);
}
/* See gdbtypes.h. */
@@ -2067,7 +2017,7 @@ get_vptr_fieldno (struct type *type, struct type **basetypep)
static void
stub_noname_complaint (void)
{
- complaint (_("stub type has NULL name"));
+ complaint (_ ("stub type has NULL name"));
}
/* Return nonzero if TYPE has a DYN_PROP_BYTE_STRIDE dynamic property
@@ -2189,8 +2139,8 @@ is_dynamic_type (struct type *type)
return is_dynamic_type_internal (type, 1);
}
-static struct type *resolve_dynamic_type_internal
- (struct type *type, struct property_addr_info *addr_stack, int top_level);
+static struct type *resolve_dynamic_type_internal (
+ struct type *type, struct property_addr_info *addr_stack, int top_level);
/* Given a dynamic range type (dyn_range_type) and a stack of
struct property_addr_info elements, return a static version
@@ -2210,8 +2160,8 @@ static struct type *resolve_dynamic_type_internal
static struct type *
resolve_dynamic_range (struct type *dyn_range_type,
- struct property_addr_info *addr_stack,
- int rank, bool resolve_p = true)
+ struct property_addr_info *addr_stack, int rank,
+ bool resolve_p = true)
{
CORE_ADDR value;
struct type *static_range_type, *static_target_type;
@@ -2221,29 +2171,32 @@ resolve_dynamic_range (struct type *dyn_range_type,
gdb_assert (rank >= 0);
const struct dynamic_prop *prop = &dyn_range_type->bounds ()->low;
- if (resolve_p && dwarf2_evaluate_property (prop, NULL, addr_stack, &value,
- { (CORE_ADDR) rank }))
+ if (resolve_p
+ && dwarf2_evaluate_property (prop, NULL, addr_stack, &value,
+ { (CORE_ADDR) rank }))
low_bound.set_const_val (value);
else
low_bound.set_undefined ();
prop = &dyn_range_type->bounds ()->high;
- if (resolve_p && dwarf2_evaluate_property (prop, NULL, addr_stack, &value,
- { (CORE_ADDR) rank }))
+ if (resolve_p
+ && dwarf2_evaluate_property (prop, NULL, addr_stack, &value,
+ { (CORE_ADDR) rank }))
{
high_bound.set_const_val (value);
if (dyn_range_type->bounds ()->flag_upper_bound_is_count)
- high_bound.set_const_val
- (low_bound.const_val () + high_bound.const_val () - 1);
+ high_bound.set_const_val (low_bound.const_val ()
+ + high_bound.const_val () - 1);
}
else
high_bound.set_undefined ();
bool byte_stride_p = dyn_range_type->bounds ()->flag_is_byte_stride;
prop = &dyn_range_type->bounds ()->stride;
- if (resolve_p && dwarf2_evaluate_property (prop, NULL, addr_stack, &value,
- { (CORE_ADDR) rank }))
+ if (resolve_p
+ && dwarf2_evaluate_property (prop, NULL, addr_stack, &value,
+ { (CORE_ADDR) rank }))
{
stride.set_const_val (value);
@@ -2254,8 +2207,8 @@ resolve_dynamic_range (struct type *dyn_range_type,
struct gdbarch *gdbarch = dyn_range_type->arch ();
int unit_size = gdbarch_addressable_memory_unit_size (gdbarch);
if (!byte_stride_p && (value % (unit_size * 8)) != 0)
- error (_("bit strides that are not a multiple of the byte size "
- "are currently not supported"));
+ error (_ ("bit strides that are not a multiple of the byte size "
+ "are currently not supported"));
}
else
{
@@ -2267,9 +2220,11 @@ resolve_dynamic_range (struct type *dyn_range_type,
= resolve_dynamic_type_internal (dyn_range_type->target_type (),
addr_stack, 0);
LONGEST bias = dyn_range_type->bounds ()->bias;
- static_range_type = create_range_type_with_stride
- (copy_type (dyn_range_type), static_target_type,
- &low_bound, &high_bound, bias, &stride, byte_stride_p);
+ static_range_type
+ = create_range_type_with_stride (copy_type (dyn_range_type),
+ static_target_type, &low_bound,
+ &high_bound, bias, &stride,
+ byte_stride_p);
static_range_type->bounds ()->flag_bound_evaluated = 1;
return static_range_type;
}
@@ -2342,8 +2297,7 @@ resolve_dynamic_array_or_string_1 (struct type *type,
}
range_type = check_typedef (type->index_type ());
- range_type
- = resolve_dynamic_range (range_type, addr_stack, rank, resolve_p);
+ range_type = resolve_dynamic_range (range_type, addr_stack, rank, resolve_p);
ary_dim = check_typedef (type->target_type ());
if (ary_dim != NULL && ary_dim->code () == TYPE_CODE_ARRAY)
@@ -2368,7 +2322,7 @@ resolve_dynamic_array_or_string_1 (struct type *type,
/* Could be a bug in our code, but it could also happen
if the DWARF info is not correct. Issue a warning,
and assume no byte/bit stride (leave bit_stride = 0). */
- warning (_("cannot determine array stride for type %s"),
+ warning (_ ("cannot determine array stride for type %s"),
type->name () ? type->name () : "<no name>");
}
}
@@ -2426,7 +2380,8 @@ resolve_dynamic_array_or_string (struct type *type,
{
/* What would this even mean? A string with a dynamic rank
greater than 1. */
- error (_("unable to handle string with dynamic rank greater than 1"));
+ error (
+ _ ("unable to handle string with dynamic rank greater than 1"));
}
else if (rank > 1)
{
@@ -2485,12 +2440,9 @@ resolve_dynamic_union (struct type *type,
gdb_assert (type->code () == TYPE_CODE_UNION);
resolved_type = copy_type (type);
- resolved_type->set_fields
- ((struct field *)
- TYPE_ALLOC (resolved_type,
- resolved_type->num_fields () * sizeof (struct field)));
- memcpy (resolved_type->fields (),
- type->fields (),
+ resolved_type->set_fields ((struct field *) TYPE_ALLOC (
+ resolved_type, resolved_type->num_fields () * sizeof (struct field)));
+ memcpy (resolved_type->fields (), type->fields (),
resolved_type->num_fields () * sizeof (struct field));
for (i = 0; i < resolved_type->num_fields (); ++i)
{
@@ -2523,11 +2475,9 @@ variant::matches (ULONGEST value, bool is_unsigned) const
return false;
}
-static void
-compute_variant_fields_inner (struct type *type,
- struct property_addr_info *addr_stack,
- const variant_part &part,
- std::vector<bool> &flags);
+static void compute_variant_fields_inner (
+ struct type *type, struct property_addr_info *addr_stack,
+ const variant_part &part, std::vector<bool> &flags);
/* A helper function to determine which variant fields will be active.
This handles both the variant's direct fields, and any variant
@@ -2542,8 +2492,7 @@ static void
compute_variant_fields_recurse (struct type *type,
struct property_addr_info *addr_stack,
const variant &variant,
- std::vector<bool> &flags,
- bool enabled)
+ std::vector<bool> &flags, bool enabled)
{
for (int field = variant.first_field; field < variant.last_field; ++field)
flags[field] = enabled;
@@ -2583,17 +2532,17 @@ compute_variant_fields_inner (struct type *type,
int idx = part.discriminant_index;
if (type->field (idx).loc_kind () != FIELD_LOC_KIND_BITPOS)
- error (_("Cannot determine struct field location"
- " (invalid location kind)"));
+ error (_ ("Cannot determine struct field location"
+ " (invalid location kind)"));
if (addr_stack->valaddr.data () != NULL)
- discr_value = unpack_field_as_long (type, addr_stack->valaddr.data (),
- idx);
+ discr_value
+ = unpack_field_as_long (type, addr_stack->valaddr.data (), idx);
else
{
- CORE_ADDR addr = (addr_stack->addr
- + (type->field (idx).loc_bitpos ()
- / TARGET_CHAR_BIT));
+ CORE_ADDR addr
+ = (addr_stack->addr
+ + (type->field (idx).loc_bitpos () / TARGET_CHAR_BIT));
LONGEST bitsize = TYPE_FIELD_BITSIZE (type, idx);
LONGEST size = bitsize / 8;
@@ -2603,11 +2552,10 @@ compute_variant_fields_inner (struct type *type,
gdb_byte bits[sizeof (ULONGEST)];
read_memory (addr, bits, size);
- LONGEST bitpos = (type->field (idx).loc_bitpos ()
- % TARGET_CHAR_BIT);
+ LONGEST bitpos = (type->field (idx).loc_bitpos () % TARGET_CHAR_BIT);
- discr_value = unpack_bits_as_long (type->field (idx).type (),
- bits, bitpos, bitsize);
+ discr_value = unpack_bits_as_long (type->field (idx).type (), bits,
+ bitpos, bitsize);
}
}
@@ -2629,9 +2577,9 @@ compute_variant_fields_inner (struct type *type,
applied_variant = default_variant;
for (const auto &variant : part.variants)
- compute_variant_fields_recurse (type, addr_stack, variant,
- flags, applied_variant == &variant);
-}
+ compute_variant_fields_recurse (type, addr_stack, variant, flags,
+ applied_variant == &variant);
+}
/* Determine which variant fields are available in TYPE. The enabled
fields are stored in RESOLVED_TYPE. ADDR_STACK holds information
@@ -2639,8 +2587,7 @@ compute_variant_fields_inner (struct type *type,
parts for this type. */
static void
-compute_variant_fields (struct type *type,
- struct type *resolved_type,
+compute_variant_fields (struct type *type, struct type *resolved_type,
struct property_addr_info *addr_stack,
const gdb::array_view<variant_part> &parts)
{
@@ -2651,12 +2598,10 @@ compute_variant_fields (struct type *type,
for (const auto &part : parts)
compute_variant_fields_inner (type, addr_stack, part, flags);
- resolved_type->set_num_fields
- (std::count (flags.begin (), flags.end (), true));
- resolved_type->set_fields
- ((struct field *)
- TYPE_ALLOC (resolved_type,
- resolved_type->num_fields () * sizeof (struct field)));
+ resolved_type->set_num_fields (std::count (flags.begin (), flags.end (),
+ true));
+ resolved_type->set_fields ((struct field *) TYPE_ALLOC (
+ resolved_type, resolved_type->num_fields () * sizeof (struct field)));
int out = 0;
for (int i = 0; i < type->num_fields (); ++i)
@@ -2685,7 +2630,8 @@ resolve_dynamic_struct (struct type *type,
resolved_type = copy_type (type);
- dynamic_prop *variant_prop = resolved_type->dyn_prop (DYN_PROP_VARIANT_PARTS);
+ dynamic_prop *variant_prop
+ = resolved_type->dyn_prop (DYN_PROP_VARIANT_PARTS);
if (variant_prop != nullptr && variant_prop->kind () == PROP_VARIANT_PARTS)
{
compute_variant_fields (type, resolved_type, addr_stack,
@@ -2696,13 +2642,10 @@ resolve_dynamic_struct (struct type *type,
}
else
{
- resolved_type->set_fields
- ((struct field *)
- TYPE_ALLOC (resolved_type,
- resolved_type->num_fields () * sizeof (struct field)));
+ resolved_type->set_fields ((struct field *) TYPE_ALLOC (
+ resolved_type, resolved_type->num_fields () * sizeof (struct field)));
if (type->num_fields () > 0)
- memcpy (resolved_type->fields (),
- type->fields (),
+ memcpy (resolved_type->fields (), type->fields (),
resolved_type->num_fields () * sizeof (struct field));
}
@@ -2726,9 +2669,9 @@ resolve_dynamic_struct (struct type *type,
CORE_ADDR addr;
if (dwarf2_evaluate_property (&prop, nullptr, addr_stack, &addr,
- {addr_stack->addr}))
- resolved_type->field (i).set_loc_bitpos
- (TARGET_CHAR_BIT * (addr - addr_stack->addr));
+ { addr_stack->addr }))
+ resolved_type->field (i).set_loc_bitpos (
+ TARGET_CHAR_BIT * (addr - addr_stack->addr));
}
/* As we know this field is not a static field, the field's
@@ -2739,8 +2682,8 @@ resolve_dynamic_struct (struct type *type,
is not severe enough to suggest to the user he stops
his debugging session because of it. */
if (resolved_type->field (i).loc_kind () != FIELD_LOC_KIND_BITPOS)
- error (_("Cannot determine struct field location"
- " (invalid location kind)"));
+ error (_ ("Cannot determine struct field location"
+ " (invalid location kind)"));
pinfo.type = check_typedef (resolved_type->field (i).type ());
size_t offset = resolved_type->field (i).loc_bitpos () / TARGET_CHAR_BIT;
@@ -2750,9 +2693,8 @@ resolve_dynamic_struct (struct type *type,
pinfo.addr = addr_stack->addr + offset;
pinfo.next = addr_stack;
- resolved_type->field (i).set_type
- (resolve_dynamic_type_internal (resolved_type->field (i).type (),
- &pinfo, 0));
+ resolved_type->field (i).set_type (resolve_dynamic_type_internal (
+ resolved_type->field (i).type (), &pinfo, 0));
gdb_assert (resolved_type->field (i).loc_kind ()
== FIELD_LOC_KIND_BITPOS);
@@ -2816,9 +2758,8 @@ resolve_dynamic_type_internal (struct type *type,
if (type->code () == TYPE_CODE_TYPEDEF)
{
resolved_type = copy_type (type);
- resolved_type->set_target_type
- (resolve_dynamic_type_internal (type->target_type (), addr_stack,
- top_level));
+ resolved_type->set_target_type (resolve_dynamic_type_internal (
+ type->target_type (), addr_stack, top_level));
}
else
{
@@ -2834,16 +2775,15 @@ resolve_dynamic_type_internal (struct type *type,
pinfo.type = check_typedef (type->target_type ());
pinfo.valaddr = {};
if (addr_stack->valaddr.data () != NULL)
- pinfo.addr = extract_typed_address (addr_stack->valaddr.data (),
- type);
+ pinfo.addr
+ = extract_typed_address (addr_stack->valaddr.data (), type);
else
pinfo.addr = read_memory_typed_address (addr_stack->addr, type);
pinfo.next = addr_stack;
resolved_type = copy_type (type);
- resolved_type->set_target_type
- (resolve_dynamic_type_internal (type->target_type (),
- &pinfo, top_level));
+ resolved_type->set_target_type (resolve_dynamic_type_internal (
+ type->target_type (), &pinfo, top_level));
break;
}
@@ -2904,11 +2844,10 @@ resolve_dynamic_type_internal (struct type *type,
struct type *
resolve_dynamic_type (struct type *type,
- gdb::array_view<const gdb_byte> valaddr,
- CORE_ADDR addr)
+ gdb::array_view<const gdb_byte> valaddr, CORE_ADDR addr)
{
struct property_addr_info pinfo
- = {check_typedef (type), valaddr, addr, NULL};
+ = { check_typedef (type), valaddr, addr, NULL };
return resolve_dynamic_type_internal (type, &pinfo, 1);
}
@@ -3040,7 +2979,7 @@ check_typedef (struct type *type)
sym = lookup_symbol (name, 0, STRUCT_DOMAIN, 0).symbol;
if (sym)
type->set_target_type (sym->type ());
- else /* TYPE_CODE_UNDEF */
+ else /* TYPE_CODE_UNDEF */
type->set_target_type (alloc_type_arch (type->arch ()));
}
type = type->target_type ();
@@ -3058,8 +2997,7 @@ check_typedef (struct type *type)
"it can't happen". */
{
const type_instance_flags ALL_SPACES
- = (TYPE_INSTANCE_FLAG_CODE_SPACE
- | TYPE_INSTANCE_FLAG_DATA_SPACE);
+ = (TYPE_INSTANCE_FLAG_CODE_SPACE | TYPE_INSTANCE_FLAG_DATA_SPACE);
const type_instance_flags ALL_CLASSES
= TYPE_INSTANCE_FLAG_ADDRESS_CLASS_ALL;
@@ -3081,8 +3019,7 @@ check_typedef (struct type *type)
types, instead of identifying them as stub types in the first
place. */
- if (TYPE_IS_OPAQUE (type)
- && opaque_type_resolution
+ if (TYPE_IS_OPAQUE (type) && opaque_type_resolution
&& !currently_reading_symtab)
{
const char *name = type->name ();
@@ -3108,7 +3045,8 @@ check_typedef (struct type *type)
move over any other types NEWTYPE refers to, which could
be an unbounded amount of stuff. */
if (newtype->objfile_owner () == type->objfile_owner ())
- type = make_qualified_type (newtype, type->instance_flags (), type);
+ type
+ = make_qualified_type (newtype, type->instance_flags (), type);
else
type = newtype;
}
@@ -3134,8 +3072,8 @@ check_typedef (struct type *type)
with the complete type only if they are in the same
objfile. */
if (sym->type ()->objfile_owner () == type->objfile_owner ())
- type = make_qualified_type (sym->type (),
- type->instance_flags (), type);
+ type = make_qualified_type (sym->type (), type->instance_flags (),
+ type);
else
type = sym->type ();
}
@@ -3176,8 +3114,8 @@ safe_parse_type (struct gdbarch *gdbarch, const char *p, int length)
struct type *type = NULL; /* Initialize to keep gcc happy. */
/* Suppress error messages. */
- scoped_restore saved_gdb_stderr = make_scoped_restore (&gdb_stderr,
- &null_stream);
+ scoped_restore saved_gdb_stderr
+ = make_scoped_restore (&gdb_stderr, &null_stream);
/* Call parse_and_eval_type() without fear of longjmp()s. */
try
@@ -3222,8 +3160,7 @@ check_stub_method (struct type *type, int method_id, int signature_id)
p = NULL;
if (demangled_name == NULL || p == NULL)
- error (_("Internal: Cannot demangle mangled name `%s'."),
- mangled_name);
+ error (_ ("Internal: Cannot demangle mangled name `%s'."), mangled_name);
/* Now, read in the parameters that define this type. */
p += 1;
@@ -3252,8 +3189,8 @@ check_stub_method (struct type *type, int method_id, int signature_id)
/* We need one extra slot, for the THIS pointer. */
- argtypes = (struct field *)
- TYPE_ALLOC (type, (argcount + 1) * sizeof (struct field));
+ argtypes = (struct field *) TYPE_ALLOC (type, (argcount + 1)
+ * sizeof (struct field));
p = argtypetext;
/* Add THIS pointer for non-static methods. */
@@ -3266,7 +3203,7 @@ check_stub_method (struct type *type, int method_id, int signature_id)
argcount = 1;
}
- if (*p != ')') /* () means no args, skip while. */
+ if (*p != ')') /* () means no args, skip while. */
{
depth = 0;
while (*p)
@@ -3278,8 +3215,8 @@ check_stub_method (struct type *type, int method_id, int signature_id)
if (strncmp (argtypetext, "...", p - argtypetext) != 0
&& strncmp (argtypetext, "void", p - argtypetext) != 0)
{
- argtypes[argcount].set_type
- (safe_parse_type (gdbarch, argtypetext, p - argtypetext));
+ argtypes[argcount].set_type (
+ safe_parse_type (gdbarch, argtypetext, p - argtypetext));
argcount += 1;
}
argtypetext = p + 1;
@@ -3304,8 +3241,8 @@ check_stub_method (struct type *type, int method_id, int signature_id)
mtype = TYPE_FN_FIELD_TYPE (f, signature_id);
/* MTYPE may currently be a function (TYPE_CODE_FUNC).
We want a method (TYPE_CODE_METHOD). */
- smash_to_method_type (mtype, type, mtype->target_type (),
- argtypes, argcount, p[-2] == '.');
+ smash_to_method_type (mtype, type, mtype->target_type (), argtypes, argcount,
+ p[-2] == '.');
mtype->set_is_stub (false);
TYPE_FN_FIELD_STUB (f, signature_id) = 0;
}
@@ -3332,7 +3269,7 @@ check_stub_method_group (struct type *type, int method_id)
}
/* Ensure it is in .rodata (if available) by working around GCC PR 44690. */
-const struct cplus_struct_type cplus_struct_default = { };
+const struct cplus_struct_type cplus_struct_default = {};
void
allocate_cplus_struct_type (struct type *type)
@@ -3348,8 +3285,7 @@ allocate_cplus_struct_type (struct type *type)
set_type_vptr_fieldno (type, -1);
}
-const struct gnat_aux_type gnat_aux_default =
- { NULL };
+const struct gnat_aux_type gnat_aux_default = { NULL };
/* Set the TYPE's type-specific kind to TYPE_SPECIFIC_GNAT_STUFF,
and allocate the associated gnat-specific data. The gnat-specific
@@ -3359,8 +3295,9 @@ void
allocate_gnat_aux_type (struct type *type)
{
TYPE_SPECIFIC_FIELD (type) = TYPE_SPECIFIC_GNAT_STUFF;
- TYPE_GNAT_SPECIFIC (type) = (struct gnat_aux_type *)
- TYPE_ALLOC (type, sizeof (struct gnat_aux_type));
+ TYPE_GNAT_SPECIFIC (type)
+ = (struct gnat_aux_type *) TYPE_ALLOC (type,
+ sizeof (struct gnat_aux_type));
*(TYPE_GNAT_SPECIFIC (type)) = gnat_aux_default;
}
@@ -3374,20 +3311,20 @@ set_type_code (struct type *type, enum type_code code)
switch (code)
{
- case TYPE_CODE_STRUCT:
- case TYPE_CODE_UNION:
- case TYPE_CODE_NAMESPACE:
- INIT_CPLUS_SPECIFIC (type);
- break;
- case TYPE_CODE_FLT:
- TYPE_SPECIFIC_FIELD (type) = TYPE_SPECIFIC_FLOATFORMAT;
- break;
- case TYPE_CODE_FUNC:
- INIT_FUNC_SPECIFIC (type);
- break;
- case TYPE_CODE_FIXED_POINT:
- INIT_FIXED_POINT_SPECIFIC (type);
- break;
+ case TYPE_CODE_STRUCT:
+ case TYPE_CODE_UNION:
+ case TYPE_CODE_NAMESPACE:
+ INIT_CPLUS_SPECIFIC (type);
+ break;
+ case TYPE_CODE_FLT:
+ TYPE_SPECIFIC_FIELD (type) = TYPE_SPECIFIC_FLOATFORMAT;
+ break;
+ case TYPE_CODE_FUNC:
+ INIT_FUNC_SPECIFIC (type);
+ break;
+ case TYPE_CODE_FIXED_POINT:
+ INIT_FIXED_POINT_SPECIFIC (type);
+ break;
}
}
@@ -3456,8 +3393,8 @@ init_nodebug_var_type (struct objfile *objfile, const char *name)
the type's TYPE_UNSIGNED flag. NAME is the type name. */
struct type *
-init_integer_type (struct objfile *objfile,
- int bit, int unsigned_p, const char *name)
+init_integer_type (struct objfile *objfile, int bit, int unsigned_p,
+ const char *name)
{
struct type *t;
@@ -3477,8 +3414,8 @@ init_integer_type (struct objfile *objfile,
the type's TYPE_UNSIGNED flag. NAME is the type name. */
struct type *
-init_character_type (struct objfile *objfile,
- int bit, int unsigned_p, const char *name)
+init_character_type (struct objfile *objfile, int bit, int unsigned_p,
+ const char *name)
{
struct type *t;
@@ -3494,8 +3431,8 @@ init_character_type (struct objfile *objfile,
the type's TYPE_UNSIGNED flag. NAME is the type name. */
struct type *
-init_boolean_type (struct objfile *objfile,
- int bit, int unsigned_p, const char *name)
+init_boolean_type (struct objfile *objfile, int bit, int unsigned_p,
+ const char *name)
{
struct type *t;
@@ -3518,8 +3455,7 @@ init_boolean_type (struct objfile *objfile,
order of the objfile's architecture is used. */
struct type *
-init_float_type (struct objfile *objfile,
- int bit, const char *name,
+init_float_type (struct objfile *objfile, int bit, const char *name,
const struct floatformat **floatformats,
enum bfd_endian byte_order)
{
@@ -3574,9 +3510,8 @@ init_complex_type (const char *name, struct type *target_type)
if (name == nullptr && target_type->name () != nullptr)
{
char *new_name
- = (char *) TYPE_ALLOC (target_type,
- strlen (target_type->name ())
- + strlen ("_Complex ") + 1);
+ = (char *) TYPE_ALLOC (target_type, strlen (target_type->name ())
+ + strlen ("_Complex ") + 1);
strcpy (new_name, "_Complex ");
strcat (new_name, target_type->name ());
name = new_name;
@@ -3600,8 +3535,8 @@ init_complex_type (const char *name, struct type *target_type)
TYPE_UNSIGNED flag. */
struct type *
-init_pointer_type (struct objfile *objfile,
- int bit, const char *name, struct type *target_type)
+init_pointer_type (struct objfile *objfile, int bit, const char *name,
+ struct type *target_type)
{
struct type *t;
@@ -3617,8 +3552,8 @@ init_pointer_type (struct objfile *objfile,
NAME is the type name. */
struct type *
-init_fixed_point_type (struct objfile *objfile,
- int bit, int unsigned_p, const char *name)
+init_fixed_point_type (struct objfile *objfile, int bit, int unsigned_p,
+ const char *name)
{
struct type *t;
@@ -3753,7 +3688,6 @@ set_type_align (struct type *type, ULONGEST align)
return true;
}
-
/* Queries on types. */
int
@@ -3762,35 +3696,29 @@ can_dereference (struct type *t)
/* FIXME: Should we return true for references as well as
pointers? */
t = check_typedef (t);
- return
- (t != NULL
- && t->code () == TYPE_CODE_PTR
- && t->target_type ()->code () != TYPE_CODE_VOID);
+ return (t != NULL && t->code () == TYPE_CODE_PTR
+ && t->target_type ()->code () != TYPE_CODE_VOID);
}
int
is_integral_type (struct type *t)
{
t = check_typedef (t);
- return
- ((t != NULL)
- && !is_fixed_point_type (t)
- && ((t->code () == TYPE_CODE_INT)
- || (t->code () == TYPE_CODE_ENUM)
- || (t->code () == TYPE_CODE_FLAGS)
- || (t->code () == TYPE_CODE_CHAR)
- || (t->code () == TYPE_CODE_RANGE)
- || (t->code () == TYPE_CODE_BOOL)));
+ return ((t != NULL) && !is_fixed_point_type (t)
+ && ((t->code () == TYPE_CODE_INT) || (t->code () == TYPE_CODE_ENUM)
+ || (t->code () == TYPE_CODE_FLAGS)
+ || (t->code () == TYPE_CODE_CHAR)
+ || (t->code () == TYPE_CODE_RANGE)
+ || (t->code () == TYPE_CODE_BOOL)));
}
int
is_floating_type (struct type *t)
{
t = check_typedef (t);
- return
- ((t != NULL)
- && ((t->code () == TYPE_CODE_FLT)
- || (t->code () == TYPE_CODE_DECFLOAT)));
+ return ((t != NULL)
+ && ((t->code () == TYPE_CODE_FLT)
+ || (t->code () == TYPE_CODE_DECFLOAT)));
}
/* Return true if TYPE is scalar. */
@@ -3828,8 +3756,8 @@ is_scalar_type_recursive (struct type *t)
if (is_scalar_type (t))
return 1;
/* Are we dealing with an array or string of known dimensions? */
- else if ((t->code () == TYPE_CODE_ARRAY
- || t->code () == TYPE_CODE_STRING) && t->num_fields () == 1
+ else if ((t->code () == TYPE_CODE_ARRAY || t->code () == TYPE_CODE_STRING)
+ && t->num_fields () == 1
&& t->index_type ()->code () == TYPE_CODE_RANGE)
{
LONGEST low_bound, high_bound;
@@ -3864,8 +3792,7 @@ is_scalar_type_recursive (struct type *t)
int
class_or_union_p (const struct type *t)
{
- return (t->code () == TYPE_CODE_STRUCT
- || t->code () == TYPE_CODE_UNION);
+ return (t->code () == TYPE_CODE_STRUCT || t->code () == TYPE_CODE_UNION);
}
/* A helper function which returns true if types A and B represent the
@@ -3876,8 +3803,7 @@ int
class_types_same_p (const struct type *a, const struct type *b)
{
return (TYPE_MAIN_TYPE (a) == TYPE_MAIN_TYPE (b)
- || (a->name () && b->name ()
- && !strcmp (a->name (), b->name ())));
+ || (a->name () && b->name () && !strcmp (a->name (), b->name ())));
}
/* If BASE is an ancestor of DCLASS return the distance between them.
@@ -3915,7 +3841,7 @@ distance_to_ancestor (struct type *base, struct type *dclass, int is_public)
for (i = 0; i < TYPE_N_BASECLASSES (dclass); i++)
{
- if (is_public && ! BASETYPE_VIA_PUBLIC (dclass, i))
+ if (is_public && !BASETYPE_VIA_PUBLIC (dclass, i))
continue;
d = distance_to_ancestor (base, TYPE_BASECLASS (dclass, i), is_public);
@@ -3950,8 +3876,7 @@ is_public_ancestor (struct type *base, struct type *dclass)
/* A helper function for is_unique_ancestor. */
static int
-is_unique_ancestor_worker (struct type *base, struct type *dclass,
- int *offset,
+is_unique_ancestor_worker (struct type *base, struct type *dclass, int *offset,
const gdb_byte *valaddr, int embedded_offset,
CORE_ADDR address, struct value *val)
{
@@ -3967,8 +3892,8 @@ is_unique_ancestor_worker (struct type *base, struct type *dclass,
iter = check_typedef (TYPE_BASECLASS (dclass, i));
- this_offset = baseclass_offset (dclass, i, valaddr, embedded_offset,
- address, val);
+ this_offset
+ = baseclass_offset (dclass, i, valaddr, embedded_offset, address, val);
if (class_types_same_p (base, iter))
{
@@ -3989,8 +3914,7 @@ is_unique_ancestor_worker (struct type *base, struct type *dclass,
++count;
}
else
- count += is_unique_ancestor_worker (base, iter, offset,
- valaddr,
+ count += is_unique_ancestor_worker (base, iter, offset, valaddr,
embedded_offset + this_offset,
address, val);
}
@@ -4009,7 +3933,8 @@ is_unique_ancestor (struct type *base, struct value *val)
return is_unique_ancestor_worker (base, value_type (val), &offset,
value_contents_for_printing (val).data (),
value_embedded_offset (val),
- value_address (val), val) == 1;
+ value_address (val), val)
+ == 1;
}
/* See gdbtypes.h. */
@@ -4043,7 +3968,6 @@ is_nocall_function (const struct type *type)
return TYPE_CALLING_CONVENTION (type) == DW_CC_nocall;
}
-
/* Overload resolution. */
/* Return the sum of the rank of A with the rank of B. */
@@ -4130,23 +4054,23 @@ compare_badness (const badness_vector &a, const badness_vector &b)
if (a_invalid != b_invalid)
{
if (a_invalid)
- return 3; /* A > B */
- return 2; /* A < B */
+ return 3; /* A > B */
+ return 2; /* A < B */
}
else if (found_pos)
{
if (found_neg)
- return 1; /* incomparable */
+ return 1; /* incomparable */
else
- return 3; /* A > B */
+ return 3; /* A > B */
}
else
/* no positives */
{
if (found_neg)
- return 2; /* A < B */
+ return 2; /* A < B */
else
- return 0; /* A == B */
+ return 0; /* A == B */
}
}
@@ -4155,8 +4079,7 @@ compare_badness (const badness_vector &a, const badness_vector &b)
has ARGS.size() + 1 entries. */
badness_vector
-rank_function (gdb::array_view<type *> parms,
- gdb::array_view<value *> args)
+rank_function (gdb::array_view<type *> parms, gdb::array_view<value *> args)
{
/* add 1 for the length-match rank. */
badness_vector bv;
@@ -4169,16 +4092,14 @@ rank_function (gdb::array_view<type *> parms,
arguments and ellipsis parameter lists, we should consider those
and rank the length-match more finely. */
- bv.push_back ((args.size () != parms.size ())
- ? LENGTH_MISMATCH_BADNESS
- : EXACT_MATCH_BADNESS);
+ bv.push_back ((args.size () != parms.size ()) ? LENGTH_MISMATCH_BADNESS
+ : EXACT_MATCH_BADNESS);
/* Now rank all the parameters of the candidate function. */
size_t min_len = std::min (parms.size (), args.size ());
for (size_t i = 0; i < min_len; i++)
- bv.push_back (rank_one_type (parms[i], value_type (args[i]),
- args[i]));
+ bv.push_back (rank_one_type (parms[i], value_type (args[i]), args[i]));
/* If more arguments than parameters, add dummy entries. */
for (size_t i = min_len; i < args.size (); i++)
@@ -4256,18 +4177,15 @@ types_equal (struct type *a, struct type *b)
/* If a and b are both pointers types or both reference types then
they are equal of the same type iff the objects they refer to are
of the same type. */
- if (a->code () == TYPE_CODE_PTR
- || a->code () == TYPE_CODE_REF)
- return types_equal (a->target_type (),
- b->target_type ());
+ if (a->code () == TYPE_CODE_PTR || a->code () == TYPE_CODE_REF)
+ return types_equal (a->target_type (), b->target_type ());
/* Well, damnit, if the names are exactly the same, I'll say they
are exactly the same. This happens when we generate method
stubs. The types won't point to the same address, but they
really are the same. */
- if (a->name () && b->name ()
- && strcmp (a->name (), b->name ()) == 0)
+ if (a->name () && b->name () && strcmp (a->name (), b->name ()) == 0)
return true;
/* Two function types are equal if their argument and return types
@@ -4278,7 +4196,7 @@ types_equal (struct type *a, struct type *b)
if (a->num_fields () != b->num_fields ())
return false;
-
+
if (!types_equal (a->target_type (), b->target_type ()))
return false;
@@ -4291,7 +4209,7 @@ types_equal (struct type *a, struct type *b)
return false;
}
-
+
/* Deep comparison of types. */
/* An entry in the type-equality bcache. */
@@ -4332,11 +4250,11 @@ check_types_equal (struct type *type1, struct type *type2,
if (type1 == type2)
return true;
- if (type1->code () != type2->code ()
- || type1->length () != type2->length ()
+ if (type1->code () != type2->code () || type1->length () != type2->length ()
|| type1->is_unsigned () != type2->is_unsigned ()
|| type1->has_no_signedness () != type2->has_no_signedness ()
- || type1->endianity_is_not_default () != type2->endianity_is_not_default ()
+ || type1->endianity_is_not_default ()
+ != type2->endianity_is_not_default ()
|| type1->has_varargs () != type2->has_varargs ()
|| type1->is_vector () != type2->is_vector ()
|| TYPE_NOTTEXT (type1) != TYPE_NOTTEXT (type2)
@@ -4403,8 +4321,8 @@ check_types_equal (struct type *type1, struct type *type2,
}
break;
default:
- internal_error (_("Unsupported field kind "
- "%d by check_types_equal"),
+ internal_error (_ ("Unsupported field kind "
+ "%d by check_types_equal"),
field1->loc_kind ());
}
@@ -4417,8 +4335,7 @@ check_types_equal (struct type *type1, struct type *type2,
if (type2->target_type () == NULL)
return false;
- worklist->emplace_back (type1->target_type (),
- type2->target_type ());
+ worklist->emplace_back (type1->target_type (), type2->target_type ());
}
else if (type2->target_type () != NULL)
return false;
@@ -4499,9 +4416,10 @@ type_not_associated (const struct type *type)
/* rank_one_type helper for when PARM's type code is TYPE_CODE_PTR. */
static struct rank
-rank_one_type_parm_ptr (struct type *parm, struct type *arg, struct value *value)
+rank_one_type_parm_ptr (struct type *parm, struct type *arg,
+ struct value *value)
{
- struct rank rank = {0,0};
+ struct rank rank = { 0, 0 };
switch (arg->code ())
{
@@ -4513,9 +4431,8 @@ rank_one_type_parm_ptr (struct type *parm, struct type *arg, struct value *value
return VOID_PTR_CONVERSION_BADNESS;
/* (b) pointer to ancestor-pointer conversion. */
- rank.subrank = distance_to_ancestor (parm->target_type (),
- arg->target_type (),
- 0);
+ rank.subrank
+ = distance_to_ancestor (parm->target_type (), arg->target_type (), 0);
if (rank.subrank >= 0)
return sum_ranks (BASE_PTR_CONVERSION_BADNESS, rank);
@@ -4570,14 +4487,14 @@ rank_one_type_parm_ptr (struct type *parm, struct type *arg, struct value *value
/* rank_one_type helper for when PARM's type code is TYPE_CODE_ARRAY. */
static struct rank
-rank_one_type_parm_array (struct type *parm, struct type *arg, struct value *value)
+rank_one_type_parm_array (struct type *parm, struct type *arg,
+ struct value *value)
{
switch (arg->code ())
{
case TYPE_CODE_PTR:
case TYPE_CODE_ARRAY:
- return rank_one_type (parm->target_type (),
- arg->target_type (), NULL);
+ return rank_one_type (parm->target_type (), arg->target_type (), NULL);
default:
return INCOMPATIBLE_TYPE_BADNESS;
}
@@ -4586,11 +4503,12 @@ rank_one_type_parm_array (struct type *parm, struct type *arg, struct value *val
/* rank_one_type helper for when PARM's type code is TYPE_CODE_FUNC. */
static struct rank
-rank_one_type_parm_func (struct type *parm, struct type *arg, struct value *value)
+rank_one_type_parm_func (struct type *parm, struct type *arg,
+ struct value *value)
{
switch (arg->code ())
{
- case TYPE_CODE_PTR: /* funcptr -> func */
+ case TYPE_CODE_PTR: /* funcptr -> func */
return rank_one_type (parm, arg->target_type (), NULL);
default:
return INCOMPATIBLE_TYPE_BADNESS;
@@ -4600,7 +4518,8 @@ rank_one_type_parm_func (struct type *parm, struct type *arg, struct value *valu
/* rank_one_type helper for when PARM's type code is TYPE_CODE_INT. */
static struct rank
-rank_one_type_parm_int (struct type *parm, struct type *arg, struct value *value)
+rank_one_type_parm_int (struct type *parm, struct type *arg,
+ struct value *value)
{
switch (arg->code ())
{
@@ -4613,8 +4532,8 @@ rank_one_type_parm_int (struct type *parm, struct type *arg, struct value *value
{
/* This case only for character types. */
if (arg->has_no_signedness ())
- return EXACT_MATCH_BADNESS; /* plain char -> plain char */
- else /* signed/unsigned char -> plain char */
+ return EXACT_MATCH_BADNESS; /* plain char -> plain char */
+ else /* signed/unsigned char -> plain char */
return INTEGER_CONVERSION_BADNESS;
}
else if (parm->is_unsigned ())
@@ -4623,11 +4542,9 @@ rank_one_type_parm_int (struct type *parm, struct type *arg, struct value *value
{
/* unsigned int -> unsigned int, or
unsigned long -> unsigned long */
- if (integer_types_same_name_p (parm->name (),
- arg->name ()))
+ if (integer_types_same_name_p (parm->name (), arg->name ()))
return EXACT_MATCH_BADNESS;
- else if (integer_types_same_name_p (arg->name (),
- "int")
+ else if (integer_types_same_name_p (arg->name (), "int")
&& integer_types_same_name_p (parm->name (),
"long"))
/* unsigned int -> unsigned long */
@@ -4638,10 +4555,8 @@ rank_one_type_parm_int (struct type *parm, struct type *arg, struct value *value
}
else
{
- if (integer_types_same_name_p (arg->name (),
- "long")
- && integer_types_same_name_p (parm->name (),
- "int"))
+ if (integer_types_same_name_p (arg->name (), "long")
+ && integer_types_same_name_p (parm->name (), "int"))
/* signed long -> unsigned int */
return INTEGER_CONVERSION_BADNESS;
else
@@ -4651,13 +4566,10 @@ rank_one_type_parm_int (struct type *parm, struct type *arg, struct value *value
}
else if (!arg->has_no_signedness () && !arg->is_unsigned ())
{
- if (integer_types_same_name_p (parm->name (),
- arg->name ()))
+ if (integer_types_same_name_p (parm->name (), arg->name ()))
return EXACT_MATCH_BADNESS;
- else if (integer_types_same_name_p (arg->name (),
- "int")
- && integer_types_same_name_p (parm->name (),
- "long"))
+ else if (integer_types_same_name_p (arg->name (), "int")
+ && integer_types_same_name_p (parm->name (), "long"))
return INTEGER_PROMOTION_BADNESS;
else
return INTEGER_CONVERSION_BADNESS;
@@ -4689,7 +4601,8 @@ rank_one_type_parm_int (struct type *parm, struct type *arg, struct value *value
/* rank_one_type helper for when PARM's type code is TYPE_CODE_ENUM. */
static struct rank
-rank_one_type_parm_enum (struct type *parm, struct type *arg, struct value *value)
+rank_one_type_parm_enum (struct type *parm, struct type *arg,
+ struct value *value)
{
switch (arg->code ())
{
@@ -4711,7 +4624,8 @@ rank_one_type_parm_enum (struct type *parm, struct type *arg, struct value *valu
/* rank_one_type helper for when PARM's type code is TYPE_CODE_CHAR. */
static struct rank
-rank_one_type_parm_char (struct type *parm, struct type *arg, struct value *value)
+rank_one_type_parm_char (struct type *parm, struct type *arg,
+ struct value *value)
{
switch (arg->code ())
{
@@ -4758,7 +4672,8 @@ rank_one_type_parm_char (struct type *parm, struct type *arg, struct value *valu
/* rank_one_type helper for when PARM's type code is TYPE_CODE_RANGE. */
static struct rank
-rank_one_type_parm_range (struct type *parm, struct type *arg, struct value *value)
+rank_one_type_parm_range (struct type *parm, struct type *arg,
+ struct value *value)
{
switch (arg->code ())
{
@@ -4778,7 +4693,8 @@ rank_one_type_parm_range (struct type *parm, struct type *arg, struct value *val
/* rank_one_type helper for when PARM's type code is TYPE_CODE_BOOL. */
static struct rank
-rank_one_type_parm_bool (struct type *parm, struct type *arg, struct value *value)
+rank_one_type_parm_bool (struct type *parm, struct type *arg,
+ struct value *value)
{
switch (arg->code ())
{
@@ -4809,7 +4725,8 @@ rank_one_type_parm_bool (struct type *parm, struct type *arg, struct value *valu
/* rank_one_type helper for when PARM's type code is TYPE_CODE_FLOAT. */
static struct rank
-rank_one_type_parm_float (struct type *parm, struct type *arg, struct value *value)
+rank_one_type_parm_float (struct type *parm, struct type *arg,
+ struct value *value)
{
switch (arg->code ())
{
@@ -4834,10 +4751,11 @@ rank_one_type_parm_float (struct type *parm, struct type *arg, struct value *val
/* rank_one_type helper for when PARM's type code is TYPE_CODE_COMPLEX. */
static struct rank
-rank_one_type_parm_complex (struct type *parm, struct type *arg, struct value *value)
+rank_one_type_parm_complex (struct type *parm, struct type *arg,
+ struct value *value)
{
switch (arg->code ())
- { /* Strictly not needed for C++, but... */
+ { /* Strictly not needed for C++, but... */
case TYPE_CODE_FLT:
return FLOAT_PROMOTION_BADNESS;
case TYPE_CODE_COMPLEX:
@@ -4850,9 +4768,10 @@ rank_one_type_parm_complex (struct type *parm, struct type *arg, struct value *v
/* rank_one_type helper for when PARM's type code is TYPE_CODE_STRUCT. */
static struct rank
-rank_one_type_parm_struct (struct type *parm, struct type *arg, struct value *value)
+rank_one_type_parm_struct (struct type *parm, struct type *arg,
+ struct value *value)
{
- struct rank rank = {0, 0};
+ struct rank rank = { 0, 0 };
switch (arg->code ())
{
@@ -4870,14 +4789,15 @@ rank_one_type_parm_struct (struct type *parm, struct type *arg, struct value *va
/* rank_one_type helper for when PARM's type code is TYPE_CODE_SET. */
static struct rank
-rank_one_type_parm_set (struct type *parm, struct type *arg, struct value *value)
+rank_one_type_parm_set (struct type *parm, struct type *arg,
+ struct value *value)
{
switch (arg->code ())
{
/* Not in C++ */
case TYPE_CODE_SET:
- return rank_one_type (parm->field (0).type (),
- arg->field (0).type (), NULL);
+ return rank_one_type (parm->field (0).type (), arg->field (0).type (),
+ NULL);
default:
return INCOMPATIBLE_TYPE_BADNESS;
}
@@ -4898,7 +4818,7 @@ rank_one_type_parm_set (struct type *parm, struct type *arg, struct value *value
struct rank
rank_one_type (struct type *parm, struct type *arg, struct value *value)
{
- struct rank rank = {0,0};
+ struct rank rank = { 0, 0 };
/* Resolve typedefs */
if (parm->code () == TYPE_CODE_TYPEDEF)
@@ -4962,10 +4882,8 @@ rank_one_type (struct type *parm, struct type *arg, struct value *value)
if (overload_debug)
{
/* Debugging only. */
- gdb_printf (gdb_stderr,
- "------ Arg is %s [%d], parm is %s [%d]\n",
- arg->name (), arg->code (),
- parm->name (), parm->code ());
+ gdb_printf (gdb_stderr, "------ Arg is %s [%d], parm is %s [%d]\n",
+ arg->name (), arg->code (), parm->name (), parm->code ());
}
/* x -> y means arg of type x being supplied for parameter of type y. */
@@ -4998,11 +4916,11 @@ rank_one_type (struct type *parm, struct type *arg, struct value *value)
return rank_one_type_parm_set (parm, arg, value);
default:
return INCOMPATIBLE_TYPE_BADNESS;
- } /* switch (arg->code ()) */
+ } /* switch (arg->code ()) */
}
/* End of functions for overload resolution. */
-
+
/* Routines to pretty-print types. */
static void
@@ -5036,9 +4954,8 @@ print_args (struct field *args, int nargs, int spaces)
for (i = 0; i < nargs; i++)
{
- gdb_printf
- ("%*s[%d] name '%s'\n", spaces, "", i,
- args[i].name () != NULL ? args[i].name () : "<NULL>");
+ gdb_printf ("%*s[%d] name '%s'\n", spaces, "", i,
+ args[i].name () != NULL ? args[i].name () : "<NULL>");
recursive_dump_type (args[i].type (), spaces + 2);
}
}
@@ -5068,39 +4985,35 @@ dump_fn_fieldlists (struct type *type, int spaces)
for (method_idx = 0; method_idx < TYPE_NFN_FIELDS (type); method_idx++)
{
f = TYPE_FN_FIELDLIST1 (type, method_idx);
- gdb_printf
- ("%*s[%d] name '%s' (%s) length %d\n", spaces + 2, "",
- method_idx,
- TYPE_FN_FIELDLIST_NAME (type, method_idx),
- host_address_to_string (TYPE_FN_FIELDLIST_NAME (type, method_idx)),
- TYPE_FN_FIELDLIST_LENGTH (type, method_idx));
+ gdb_printf ("%*s[%d] name '%s' (%s) length %d\n", spaces + 2, "",
+ method_idx, TYPE_FN_FIELDLIST_NAME (type, method_idx),
+ host_address_to_string (TYPE_FN_FIELDLIST_NAME (type,
+ method_idx)),
+ TYPE_FN_FIELDLIST_LENGTH (type, method_idx));
for (overload_idx = 0;
overload_idx < TYPE_FN_FIELDLIST_LENGTH (type, method_idx);
overload_idx++)
{
- gdb_printf
- ("%*s[%d] physname '%s' (%s)\n",
- spaces + 4, "", overload_idx,
- TYPE_FN_FIELD_PHYSNAME (f, overload_idx),
- host_address_to_string (TYPE_FN_FIELD_PHYSNAME (f,
- overload_idx)));
- gdb_printf
- ("%*stype %s\n", spaces + 8, "",
- host_address_to_string (TYPE_FN_FIELD_TYPE (f, overload_idx)));
+ gdb_printf (
+ "%*s[%d] physname '%s' (%s)\n", spaces + 4, "", overload_idx,
+ TYPE_FN_FIELD_PHYSNAME (f, overload_idx),
+ host_address_to_string (TYPE_FN_FIELD_PHYSNAME (f, overload_idx)));
+ gdb_printf (
+ "%*stype %s\n", spaces + 8, "",
+ host_address_to_string (TYPE_FN_FIELD_TYPE (f, overload_idx)));
recursive_dump_type (TYPE_FN_FIELD_TYPE (f, overload_idx),
spaces + 8 + 2);
- gdb_printf
- ("%*sargs %s\n", spaces + 8, "",
- host_address_to_string (TYPE_FN_FIELD_ARGS (f, overload_idx)));
+ gdb_printf (
+ "%*sargs %s\n", spaces + 8, "",
+ host_address_to_string (TYPE_FN_FIELD_ARGS (f, overload_idx)));
print_args (TYPE_FN_FIELD_ARGS (f, overload_idx),
TYPE_FN_FIELD_TYPE (f, overload_idx)->num_fields (),
spaces + 8 + 2);
- gdb_printf
- ("%*sfcontext %s\n", spaces + 8, "",
- host_address_to_string (TYPE_FN_FIELD_FCONTEXT (f,
- overload_idx)));
+ gdb_printf (
+ "%*sfcontext %s\n", spaces + 8, "",
+ host_address_to_string (TYPE_FN_FIELD_FCONTEXT (f, overload_idx)));
gdb_printf ("%*sis_const %d\n", spaces + 8, "",
TYPE_FN_FIELD_CONST (f, overload_idx));
@@ -5125,23 +5038,19 @@ dump_fn_fieldlists (struct type *type, int spaces)
static void
print_cplus_stuff (struct type *type, int spaces)
{
- gdb_printf ("%*svptr_fieldno %d\n", spaces, "",
- TYPE_VPTR_FIELDNO (type));
+ gdb_printf ("%*svptr_fieldno %d\n", spaces, "", TYPE_VPTR_FIELDNO (type));
gdb_printf ("%*svptr_basetype %s\n", spaces, "",
host_address_to_string (TYPE_VPTR_BASETYPE (type)));
if (TYPE_VPTR_BASETYPE (type) != NULL)
recursive_dump_type (TYPE_VPTR_BASETYPE (type), spaces + 2);
- gdb_printf ("%*sn_baseclasses %d\n", spaces, "",
- TYPE_N_BASECLASSES (type));
- gdb_printf ("%*snfn_fields %d\n", spaces, "",
- TYPE_NFN_FIELDS (type));
+ gdb_printf ("%*sn_baseclasses %d\n", spaces, "", TYPE_N_BASECLASSES (type));
+ gdb_printf ("%*snfn_fields %d\n", spaces, "", TYPE_NFN_FIELDS (type));
if (TYPE_N_BASECLASSES (type) > 0)
{
- gdb_printf
- ("%*svirtual_field_bits (%d bits at *%s)",
- spaces, "", TYPE_N_BASECLASSES (type),
- host_address_to_string (TYPE_FIELD_VIRTUAL_BITS (type)));
+ gdb_printf ("%*svirtual_field_bits (%d bits at *%s)", spaces, "",
+ TYPE_N_BASECLASSES (type),
+ host_address_to_string (TYPE_FIELD_VIRTUAL_BITS (type)));
print_bit_vector (TYPE_FIELD_VIRTUAL_BITS (type),
TYPE_N_BASECLASSES (type));
@@ -5151,20 +5060,19 @@ print_cplus_stuff (struct type *type, int spaces)
{
if (TYPE_FIELD_PRIVATE_BITS (type) != NULL)
{
- gdb_printf
- ("%*sprivate_field_bits (%d bits at *%s)",
- spaces, "", type->num_fields (),
- host_address_to_string (TYPE_FIELD_PRIVATE_BITS (type)));
+ gdb_printf ("%*sprivate_field_bits (%d bits at *%s)", spaces, "",
+ type->num_fields (),
+ host_address_to_string (TYPE_FIELD_PRIVATE_BITS (type)));
print_bit_vector (TYPE_FIELD_PRIVATE_BITS (type),
type->num_fields ());
gdb_puts ("\n");
}
if (TYPE_FIELD_PROTECTED_BITS (type) != NULL)
{
- gdb_printf
- ("%*sprotected_field_bits (%d bits at *%s",
- spaces, "", type->num_fields (),
- host_address_to_string (TYPE_FIELD_PROTECTED_BITS (type)));
+ gdb_printf (
+ "%*sprotected_field_bits (%d bits at *%s", spaces, "",
+ type->num_fields (),
+ host_address_to_string (TYPE_FIELD_PROTECTED_BITS (type)));
print_bit_vector (TYPE_FIELD_PROTECTED_BITS (type),
type->num_fields ());
gdb_puts ("\n");
@@ -5211,7 +5119,7 @@ static struct obstack dont_print_type_obstack;
/* Print the dynamic_prop PROP. */
static void
-dump_dynamic_prop (dynamic_prop const& prop)
+dump_dynamic_prop (dynamic_prop const &prop)
{
switch (prop.kind ())
{
@@ -5245,8 +5153,8 @@ recursive_dump_type (struct type *type, int spaces)
struct type **first_dont_print
= (struct type **) obstack_base (&dont_print_type_obstack);
- int i = (struct type **)
- obstack_next_free (&dont_print_type_obstack) - first_dont_print;
+ int i = (struct type **) obstack_next_free (&dont_print_type_obstack)
+ - first_dont_print;
while (--i >= 0)
{
@@ -5254,7 +5162,7 @@ recursive_dump_type (struct type *type, int spaces)
{
gdb_printf ("%*stype node %s", spaces, "",
host_address_to_string (type));
- gdb_printf (_(" <same as already seen type>\n"));
+ gdb_printf (_ (" <same as already seen type>\n"));
return;
}
}
@@ -5262,8 +5170,7 @@ recursive_dump_type (struct type *type, int spaces)
obstack_ptr_grow (&dont_print_type_obstack, type);
}
- gdb_printf ("%*stype node %s\n", spaces, "",
- host_address_to_string (type));
+ gdb_printf ("%*stype node %s\n", spaces, "", host_address_to_string (type));
gdb_printf ("%*sname '%s' (%s)\n", spaces, "",
type->name () ? type->name () : "<NULL>",
host_address_to_string (type->name ()));
@@ -5350,8 +5257,7 @@ recursive_dump_type (struct type *type, int spaces)
break;
}
gdb_puts ("\n");
- gdb_printf ("%*slength %s\n", spaces, "",
- pulongest (type->length ()));
+ gdb_printf ("%*slength %s\n", spaces, "", pulongest (type->length ()));
if (type->is_objfile_owned ())
gdb_printf ("%*sobjfile %s\n", spaces, "",
host_address_to_string (type->objfile_owner ()));
@@ -5370,7 +5276,7 @@ recursive_dump_type (struct type *type, int spaces)
host_address_to_string (TYPE_REFERENCE_TYPE (type)));
gdb_printf ("%*stype_chain %s\n", spaces, "",
host_address_to_string (TYPE_CHAIN (type)));
- gdb_printf ("%*sinstance_flags 0x%x", spaces, "",
+ gdb_printf ("%*sinstance_flags 0x%x", spaces, "",
(unsigned) type->instance_flags ());
if (TYPE_CONST (type))
{
@@ -5478,17 +5384,16 @@ recursive_dump_type (struct type *type, int spaces)
for (idx = 0; idx < type->num_fields (); idx++)
{
if (type->code () == TYPE_CODE_ENUM)
- gdb_printf ("%*s[%d] enumval %s type ", spaces + 2, "",
- idx, plongest (type->field (idx).loc_enumval ()));
+ gdb_printf ("%*s[%d] enumval %s type ", spaces + 2, "", idx,
+ plongest (type->field (idx).loc_enumval ()));
else
- gdb_printf ("%*s[%d] bitpos %s bitsize %d type ", spaces + 2, "",
- idx, plongest (type->field (idx).loc_bitpos ()),
+ gdb_printf ("%*s[%d] bitpos %s bitsize %d type ", spaces + 2, "", idx,
+ plongest (type->field (idx).loc_bitpos ()),
TYPE_FIELD_BITSIZE (type, idx));
gdb_printf ("%s name '%s' (%s)\n",
host_address_to_string (type->field (idx).type ()),
- type->field (idx).name () != NULL
- ? type->field (idx).name ()
- : "<NULL>",
+ type->field (idx).name () != NULL ? type->field (idx).name ()
+ : "<NULL>",
host_address_to_string (type->field (idx).name ()));
if (type->field (idx).type () != NULL)
{
@@ -5506,44 +5411,44 @@ recursive_dump_type (struct type *type, int spaces)
switch (TYPE_SPECIFIC_FIELD (type))
{
- case TYPE_SPECIFIC_CPLUS_STUFF:
- gdb_printf ("%*scplus_stuff %s\n", spaces, "",
- host_address_to_string (TYPE_CPLUS_SPECIFIC (type)));
- print_cplus_stuff (type, spaces);
- break;
+ case TYPE_SPECIFIC_CPLUS_STUFF:
+ gdb_printf ("%*scplus_stuff %s\n", spaces, "",
+ host_address_to_string (TYPE_CPLUS_SPECIFIC (type)));
+ print_cplus_stuff (type, spaces);
+ break;
- case TYPE_SPECIFIC_GNAT_STUFF:
- gdb_printf ("%*sgnat_stuff %s\n", spaces, "",
- host_address_to_string (TYPE_GNAT_SPECIFIC (type)));
- print_gnat_stuff (type, spaces);
- break;
+ case TYPE_SPECIFIC_GNAT_STUFF:
+ gdb_printf ("%*sgnat_stuff %s\n", spaces, "",
+ host_address_to_string (TYPE_GNAT_SPECIFIC (type)));
+ print_gnat_stuff (type, spaces);
+ break;
- case TYPE_SPECIFIC_FLOATFORMAT:
- gdb_printf ("%*sfloatformat ", spaces, "");
- if (TYPE_FLOATFORMAT (type) == NULL
- || TYPE_FLOATFORMAT (type)->name == NULL)
- gdb_puts ("(null)");
- else
- gdb_puts (TYPE_FLOATFORMAT (type)->name);
- gdb_puts ("\n");
- break;
+ case TYPE_SPECIFIC_FLOATFORMAT:
+ gdb_printf ("%*sfloatformat ", spaces, "");
+ if (TYPE_FLOATFORMAT (type) == NULL
+ || TYPE_FLOATFORMAT (type)->name == NULL)
+ gdb_puts ("(null)");
+ else
+ gdb_puts (TYPE_FLOATFORMAT (type)->name);
+ gdb_puts ("\n");
+ break;
- case TYPE_SPECIFIC_FUNC:
- gdb_printf ("%*scalling_convention %d\n", spaces, "",
- TYPE_CALLING_CONVENTION (type));
- /* tail_call_list is not printed. */
- break;
+ case TYPE_SPECIFIC_FUNC:
+ gdb_printf ("%*scalling_convention %d\n", spaces, "",
+ TYPE_CALLING_CONVENTION (type));
+ /* tail_call_list is not printed. */
+ break;
- case TYPE_SPECIFIC_SELF_TYPE:
- gdb_printf ("%*sself_type %s\n", spaces, "",
- host_address_to_string (TYPE_SELF_TYPE (type)));
- break;
+ case TYPE_SPECIFIC_SELF_TYPE:
+ gdb_printf ("%*sself_type %s\n", spaces, "",
+ host_address_to_string (TYPE_SELF_TYPE (type)));
+ break;
- case TYPE_SPECIFIC_FIXED_POINT:
- gdb_printf ("%*sfixed_point_info ", spaces, "");
- print_fixed_point_type_info (type, spaces);
- gdb_puts ("\n");
- break;
+ case TYPE_SPECIFIC_FIXED_POINT:
+ gdb_printf ("%*sfixed_point_info ", spaces, "");
+ print_fixed_point_type_info (type, spaces);
+ gdb_puts ("\n");
+ break;
case TYPE_SPECIFIC_INT:
if (type->bit_size_differs_p ())
@@ -5559,17 +5464,19 @@ recursive_dump_type (struct type *type, int spaces)
if (spaces == 0)
obstack_free (&dont_print_type_obstack, NULL);
}
-
+
/* Trivial helpers for the libiberty hash table, for mapping one
type to another. */
struct type_pair
{
type_pair (struct type *old_, struct type *newobj_)
- : old (old_), newobj (newobj_)
- {}
+ : old (old_),
+ newobj (newobj_)
+ {
+ }
- struct type * const old, * const newobj;
+ struct type *const old, *const newobj;
};
static hashval_t
@@ -5596,8 +5503,8 @@ htab_up
create_copied_types_hash ()
{
return htab_up (htab_create_alloc (1, type_pair_hash, type_pair_eq,
- htab_delete_entry<type_pair>,
- xcalloc, xfree));
+ htab_delete_entry<type_pair>, xcalloc,
+ xfree));
}
/* Recursively copy (deep copy) a dynamic attribute list of a type. */
@@ -5613,9 +5520,8 @@ copy_dynamic_prop_list (struct obstack *storage,
{
struct dynamic_prop_list *node_copy;
- node_copy = ((struct dynamic_prop_list *)
- obstack_copy (storage, *node_ptr,
- sizeof (struct dynamic_prop_list)));
+ node_copy = ((struct dynamic_prop_list *) obstack_copy (
+ storage, *node_ptr, sizeof (struct dynamic_prop_list)));
node_copy->prop = (*node_ptr)->prop;
*node_ptr = node_copy;
@@ -5671,43 +5577,44 @@ copy_type_recursive (struct type *type, htab_t copied_types)
int i, nfields;
nfields = type->num_fields ();
- new_type->set_fields
- ((struct field *)
- TYPE_ZALLOC (new_type, nfields * sizeof (struct field)));
+ new_type->set_fields ((struct field *) TYPE_ZALLOC (
+ new_type, nfields * sizeof (struct field)));
for (i = 0; i < nfields; i++)
{
- TYPE_FIELD_ARTIFICIAL (new_type, i) =
- TYPE_FIELD_ARTIFICIAL (type, i);
+ TYPE_FIELD_ARTIFICIAL (new_type, i)
+ = TYPE_FIELD_ARTIFICIAL (type, i);
TYPE_FIELD_BITSIZE (new_type, i) = TYPE_FIELD_BITSIZE (type, i);
if (type->field (i).type ())
- new_type->field (i).set_type
- (copy_type_recursive (type->field (i).type (), copied_types));
+ new_type->field (i).set_type (
+ copy_type_recursive (type->field (i).type (), copied_types));
if (type->field (i).name ())
new_type->field (i).set_name (xstrdup (type->field (i).name ()));
switch (type->field (i).loc_kind ())
{
case FIELD_LOC_KIND_BITPOS:
- new_type->field (i).set_loc_bitpos (type->field (i).loc_bitpos ());
+ new_type->field (i).set_loc_bitpos (
+ type->field (i).loc_bitpos ());
break;
case FIELD_LOC_KIND_ENUMVAL:
- new_type->field (i).set_loc_enumval (type->field (i).loc_enumval ());
+ new_type->field (i).set_loc_enumval (
+ type->field (i).loc_enumval ());
break;
case FIELD_LOC_KIND_PHYSADDR:
- new_type->field (i).set_loc_physaddr
- (type->field (i).loc_physaddr ());
+ new_type->field (i).set_loc_physaddr (
+ type->field (i).loc_physaddr ());
break;
case FIELD_LOC_KIND_PHYSNAME:
- new_type->field (i).set_loc_physname
- (xstrdup (type->field (i).loc_physname ()));
+ new_type->field (i).set_loc_physname (
+ xstrdup (type->field (i).loc_physname ()));
+ break;
+ case FIELD_LOC_KIND_DWARF_BLOCK:
+ new_type->field (i).set_loc_dwarf_block (
+ type->field (i).loc_dwarf_block ());
break;
- case FIELD_LOC_KIND_DWARF_BLOCK:
- new_type->field (i).set_loc_dwarf_block
- (type->field (i).loc_dwarf_block ());
- break;
default:
- internal_error (_("Unexpected type field location kind: %d"),
+ internal_error (_ ("Unexpected type field location kind: %d"),
type->field (i).loc_kind ());
}
}
@@ -5717,8 +5624,8 @@ copy_type_recursive (struct type *type, htab_t copied_types)
if (type->code () == TYPE_CODE_RANGE)
{
range_bounds *bounds
- = ((struct range_bounds *) TYPE_ALLOC
- (new_type, sizeof (struct range_bounds)));
+ = ((struct range_bounds *) TYPE_ALLOC (new_type,
+ sizeof (struct range_bounds)));
*bounds = *type->bounds ();
new_type->set_bounds (bounds);
@@ -5729,11 +5636,10 @@ copy_type_recursive (struct type *type, htab_t copied_types)
= copy_dynamic_prop_list (gdbarch_obstack (new_type->arch_owner ()),
type->main_type->dyn_prop_list);
-
/* Copy pointers to other types. */
if (type->target_type ())
- new_type->set_target_type
- (copy_type_recursive (type->target_type (), copied_types));
+ new_type->set_target_type (copy_type_recursive (type->target_type (),
+ copied_types));
/* Maybe copy the type_specific bits.
@@ -5761,9 +5667,8 @@ copy_type_recursive (struct type *type, htab_t copied_types)
INIT_GNAT_SPECIFIC (new_type);
break;
case TYPE_SPECIFIC_SELF_TYPE:
- set_type_self_type (new_type,
- copy_type_recursive (TYPE_SELF_TYPE (type),
- copied_types));
+ set_type_self_type (new_type, copy_type_recursive (TYPE_SELF_TYPE (type),
+ copied_types));
break;
case TYPE_SPECIFIC_FIXED_POINT:
INIT_FIXED_POINT_SPECIFIC (new_type);
@@ -5796,24 +5701,24 @@ copy_type (const struct type *type)
sizeof (struct main_type));
if (type->main_type->dyn_prop_list != NULL)
{
- struct obstack *storage = (type->is_objfile_owned ()
- ? &type->objfile_owner ()->objfile_obstack
- : gdbarch_obstack (type->arch_owner ()));
+ struct obstack *storage
+ = (type->is_objfile_owned () ? &type->objfile_owner ()->objfile_obstack
+ : gdbarch_obstack (type->arch_owner ()));
new_type->main_type->dyn_prop_list
= copy_dynamic_prop_list (storage, type->main_type->dyn_prop_list);
}
return new_type;
}
-
+
/* Helper functions to initialize architecture-specific types. */
/* Allocate a type structure associated with GDBARCH and set its
CODE, LENGTH, and NAME fields. */
struct type *
-arch_type (struct gdbarch *gdbarch,
- enum type_code code, int bit, const char *name)
+arch_type (struct gdbarch *gdbarch, enum type_code code, int bit,
+ const char *name)
{
struct type *type;
@@ -5833,8 +5738,8 @@ arch_type (struct gdbarch *gdbarch,
the type's TYPE_UNSIGNED flag. NAME is the type name. */
struct type *
-arch_integer_type (struct gdbarch *gdbarch,
- int bit, int unsigned_p, const char *name)
+arch_integer_type (struct gdbarch *gdbarch, int bit, int unsigned_p,
+ const char *name)
{
struct type *t;
@@ -5850,8 +5755,8 @@ arch_integer_type (struct gdbarch *gdbarch,
the type's TYPE_UNSIGNED flag. NAME is the type name. */
struct type *
-arch_character_type (struct gdbarch *gdbarch,
- int bit, int unsigned_p, const char *name)
+arch_character_type (struct gdbarch *gdbarch, int bit, int unsigned_p,
+ const char *name)
{
struct type *t;
@@ -5867,8 +5772,8 @@ arch_character_type (struct gdbarch *gdbarch,
the type's TYPE_UNSIGNED flag. NAME is the type name. */
struct type *
-arch_boolean_type (struct gdbarch *gdbarch,
- int bit, int unsigned_p, const char *name)
+arch_boolean_type (struct gdbarch *gdbarch, int bit, int unsigned_p,
+ const char *name)
{
struct type *t;
@@ -5885,8 +5790,7 @@ arch_boolean_type (struct gdbarch *gdbarch,
TYPE_FLOATFORMAT from FLOATFORMATS. */
struct type *
-arch_float_type (struct gdbarch *gdbarch,
- int bit, const char *name,
+arch_float_type (struct gdbarch *gdbarch, int bit, const char *name,
const struct floatformat **floatformats)
{
const struct floatformat *fmt = floatformats[gdbarch_byte_order (gdbarch)];
@@ -5917,8 +5821,8 @@ arch_decfloat_type (struct gdbarch *gdbarch, int bit, const char *name)
TYPE_UNSIGNED flag. */
struct type *
-arch_pointer_type (struct gdbarch *gdbarch,
- int bit, const char *name, struct type *target_type)
+arch_pointer_type (struct gdbarch *gdbarch, int bit, const char *name,
+ struct type *target_type)
{
struct type *t;
@@ -5940,8 +5844,8 @@ arch_flags_type (struct gdbarch *gdbarch, const char *name, int bit)
type->set_is_unsigned (true);
type->set_num_fields (0);
/* Pre-allocate enough space assuming every field is one bit. */
- type->set_fields
- ((struct field *) TYPE_ZALLOC (type, bit * sizeof (struct field)));
+ type->set_fields ((struct field *)
+ TYPE_ZALLOC (type, bit * sizeof (struct field)));
return type;
}
@@ -5978,8 +5882,7 @@ void
append_flags_type_flag (struct type *type, int bitpos, const char *name)
{
append_flags_type_field (type, bitpos, 1,
- builtin_type (type->arch ())->builtin_bool,
- name);
+ builtin_type (type->arch ())->builtin_bool, name);
}
/* Allocate a TYPE_CODE_STRUCT or TYPE_CODE_UNION type structure (as
@@ -6009,8 +5912,7 @@ append_composite_type_field_raw (struct type *t, const char *name,
struct field *f;
t->set_num_fields (t->num_fields () + 1);
- t->set_fields (XRESIZEVEC (struct field, t->fields (),
- t->num_fields ()));
+ t->set_fields (XRESIZEVEC (struct field, t->fields (), t->num_fields ()));
f = &t->field (t->num_fields () - 1);
memset (f, 0, sizeof f[0]);
f[0].set_type (field);
@@ -6037,9 +5939,8 @@ append_composite_type_field_aligned (struct type *t, const char *name,
t->set_length (t->length () + field->length ());
if (t->num_fields () > 1)
{
- f->set_loc_bitpos
- (f[-1].loc_bitpos ()
- + (f[-1].type ()->length () * TARGET_CHAR_BIT));
+ f->set_loc_bitpos (f[-1].loc_bitpos ()
+ + (f[-1].type ()->length () * TARGET_CHAR_BIT));
if (alignment)
{
@@ -6051,8 +5952,8 @@ append_composite_type_field_aligned (struct type *t, const char *name,
if (left)
{
f->set_loc_bitpos (f[0].loc_bitpos () + (alignment - left));
- t->set_length
- (t->length () + (alignment - left) / TARGET_CHAR_BIT);
+ t->set_length (t->length ()
+ + (alignment - left) / TARGET_CHAR_BIT);
}
}
}
@@ -6068,8 +5969,6 @@ append_composite_type_field (struct type *t, const char *name,
append_composite_type_field_aligned (t, name, field, 0);
}
-
-
/* We manage the lifetimes of fixed_point_type_info objects by
attaching them to the objfile. Currently, these objects are
modified during construction, and GMP does not provide a way to
@@ -6077,11 +5976,11 @@ append_composite_type_field (struct type *t, const char *name,
them. If we did do this, they could be moved to the per-BFD and
shared across objfiles. */
typedef std::vector<std::unique_ptr<fixed_point_type_info>>
- fixed_point_type_storage;
+ fixed_point_type_storage;
/* Key used for managing the storage of fixed-point type info. */
static const struct registry<objfile>::key<fixed_point_type_storage>
- fixed_point_objfile_key;
+ fixed_point_objfile_key;
/* See gdbtypes.h. */
@@ -6147,8 +6046,6 @@ type::fixed_point_scaling_factor ()
return type->fixed_point_info ().scaling_factor;
}
-
-
static const registry<gdbarch>::key<struct builtin_type> gdbtypes_data;
static struct builtin_type *
@@ -6164,47 +6061,42 @@ create_gdbtypes_data (struct gdbarch *gdbarch)
!gdbarch_char_signed (gdbarch), "char");
builtin_type->builtin_char->set_has_no_signedness (true);
builtin_type->builtin_signed_char
- = arch_integer_type (gdbarch, TARGET_CHAR_BIT,
- 0, "signed char");
+ = arch_integer_type (gdbarch, TARGET_CHAR_BIT, 0, "signed char");
builtin_type->builtin_unsigned_char
- = arch_integer_type (gdbarch, TARGET_CHAR_BIT,
- 1, "unsigned char");
+ = arch_integer_type (gdbarch, TARGET_CHAR_BIT, 1, "unsigned char");
builtin_type->builtin_short
- = arch_integer_type (gdbarch, gdbarch_short_bit (gdbarch),
- 0, "short");
+ = arch_integer_type (gdbarch, gdbarch_short_bit (gdbarch), 0, "short");
builtin_type->builtin_unsigned_short
- = arch_integer_type (gdbarch, gdbarch_short_bit (gdbarch),
- 1, "unsigned short");
+ = arch_integer_type (gdbarch, gdbarch_short_bit (gdbarch), 1,
+ "unsigned short");
builtin_type->builtin_int
- = arch_integer_type (gdbarch, gdbarch_int_bit (gdbarch),
- 0, "int");
+ = arch_integer_type (gdbarch, gdbarch_int_bit (gdbarch), 0, "int");
builtin_type->builtin_unsigned_int
- = arch_integer_type (gdbarch, gdbarch_int_bit (gdbarch),
- 1, "unsigned int");
+ = arch_integer_type (gdbarch, gdbarch_int_bit (gdbarch), 1,
+ "unsigned int");
builtin_type->builtin_long
- = arch_integer_type (gdbarch, gdbarch_long_bit (gdbarch),
- 0, "long");
+ = arch_integer_type (gdbarch, gdbarch_long_bit (gdbarch), 0, "long");
builtin_type->builtin_unsigned_long
- = arch_integer_type (gdbarch, gdbarch_long_bit (gdbarch),
- 1, "unsigned long");
+ = arch_integer_type (gdbarch, gdbarch_long_bit (gdbarch), 1,
+ "unsigned long");
builtin_type->builtin_long_long
- = arch_integer_type (gdbarch, gdbarch_long_long_bit (gdbarch),
- 0, "long long");
+ = arch_integer_type (gdbarch, gdbarch_long_long_bit (gdbarch), 0,
+ "long long");
builtin_type->builtin_unsigned_long_long
- = arch_integer_type (gdbarch, gdbarch_long_long_bit (gdbarch),
- 1, "unsigned long long");
+ = arch_integer_type (gdbarch, gdbarch_long_long_bit (gdbarch), 1,
+ "unsigned long long");
builtin_type->builtin_half
- = arch_float_type (gdbarch, gdbarch_half_bit (gdbarch),
- "half", gdbarch_half_format (gdbarch));
+ = arch_float_type (gdbarch, gdbarch_half_bit (gdbarch), "half",
+ gdbarch_half_format (gdbarch));
builtin_type->builtin_float
- = arch_float_type (gdbarch, gdbarch_float_bit (gdbarch),
- "float", gdbarch_float_format (gdbarch));
+ = arch_float_type (gdbarch, gdbarch_float_bit (gdbarch), "float",
+ gdbarch_float_format (gdbarch));
builtin_type->builtin_bfloat16
- = arch_float_type (gdbarch, gdbarch_bfloat16_bit (gdbarch),
- "bfloat16", gdbarch_bfloat16_format (gdbarch));
+ = arch_float_type (gdbarch, gdbarch_bfloat16_bit (gdbarch), "bfloat16",
+ gdbarch_bfloat16_format (gdbarch));
builtin_type->builtin_double
- = arch_float_type (gdbarch, gdbarch_double_bit (gdbarch),
- "double", gdbarch_double_format (gdbarch));
+ = arch_float_type (gdbarch, gdbarch_double_bit (gdbarch), "double",
+ gdbarch_double_format (gdbarch));
builtin_type->builtin_long_double
= arch_float_type (gdbarch, gdbarch_long_double_bit (gdbarch),
"long double", gdbarch_long_double_format (gdbarch));
@@ -6233,26 +6125,19 @@ create_gdbtypes_data (struct gdbarch *gdbarch)
= arch_character_type (gdbarch, TARGET_CHAR_BIT, 1, "true character");
/* Fixed-size integer types. */
- builtin_type->builtin_int0
- = arch_integer_type (gdbarch, 0, 0, "int0_t");
- builtin_type->builtin_int8
- = arch_integer_type (gdbarch, 8, 0, "int8_t");
- builtin_type->builtin_uint8
- = arch_integer_type (gdbarch, 8, 1, "uint8_t");
- builtin_type->builtin_int16
- = arch_integer_type (gdbarch, 16, 0, "int16_t");
+ builtin_type->builtin_int0 = arch_integer_type (gdbarch, 0, 0, "int0_t");
+ builtin_type->builtin_int8 = arch_integer_type (gdbarch, 8, 0, "int8_t");
+ builtin_type->builtin_uint8 = arch_integer_type (gdbarch, 8, 1, "uint8_t");
+ builtin_type->builtin_int16 = arch_integer_type (gdbarch, 16, 0, "int16_t");
builtin_type->builtin_uint16
= arch_integer_type (gdbarch, 16, 1, "uint16_t");
- builtin_type->builtin_int24
- = arch_integer_type (gdbarch, 24, 0, "int24_t");
+ builtin_type->builtin_int24 = arch_integer_type (gdbarch, 24, 0, "int24_t");
builtin_type->builtin_uint24
= arch_integer_type (gdbarch, 24, 1, "uint24_t");
- builtin_type->builtin_int32
- = arch_integer_type (gdbarch, 32, 0, "int32_t");
+ builtin_type->builtin_int32 = arch_integer_type (gdbarch, 32, 0, "int32_t");
builtin_type->builtin_uint32
= arch_integer_type (gdbarch, 32, 1, "uint32_t");
- builtin_type->builtin_int64
- = arch_integer_type (gdbarch, 64, 0, "int64_t");
+ builtin_type->builtin_int64 = arch_integer_type (gdbarch, 64, 0, "int64_t");
builtin_type->builtin_uint64
= arch_integer_type (gdbarch, 64, 1, "uint64_t");
builtin_type->builtin_int128
@@ -6260,13 +6145,13 @@ create_gdbtypes_data (struct gdbarch *gdbarch)
builtin_type->builtin_uint128
= arch_integer_type (gdbarch, 128, 1, "uint128_t");
- builtin_type->builtin_int8->set_instance_flags
- (builtin_type->builtin_int8->instance_flags ()
- | TYPE_INSTANCE_FLAG_NOTTEXT);
+ builtin_type->builtin_int8->set_instance_flags (
+ builtin_type->builtin_int8->instance_flags ()
+ | TYPE_INSTANCE_FLAG_NOTTEXT);
- builtin_type->builtin_uint8->set_instance_flags
- (builtin_type->builtin_uint8->instance_flags ()
- | TYPE_INSTANCE_FLAG_NOTTEXT);
+ builtin_type->builtin_uint8->set_instance_flags (
+ builtin_type->builtin_uint8->instance_flags ()
+ | TYPE_INSTANCE_FLAG_NOTTEXT);
/* Wide character types. */
builtin_type->builtin_char16
@@ -6286,9 +6171,8 @@ create_gdbtypes_data (struct gdbarch *gdbarch)
= lookup_function_type (builtin_type->builtin_func_ptr);
/* This type represents a GDB internal function. */
- builtin_type->internal_fn
- = arch_type (gdbarch, TYPE_CODE_INTERNAL_FUNCTION, 0,
- "<internal function>");
+ builtin_type->internal_fn = arch_type (gdbarch, TYPE_CODE_INTERNAL_FUNCTION,
+ 0, "<internal function>");
/* This type represents an xmethod. */
builtin_type->xmethod
@@ -6325,8 +6209,8 @@ objfile_type (struct objfile *objfile)
if (objfile_type)
return objfile_type;
- objfile_type = OBSTACK_CALLOC (&objfile->objfile_obstack,
- 1, struct objfile_type);
+ objfile_type
+ = OBSTACK_CALLOC (&objfile->objfile_obstack, 1, struct objfile_type);
/* Use the objfile architecture to determine basic type properties. */
gdbarch = objfile->arch ();
@@ -6339,41 +6223,36 @@ objfile_type (struct objfile *objfile)
!gdbarch_char_signed (gdbarch), "char");
objfile_type->builtin_char->set_has_no_signedness (true);
objfile_type->builtin_signed_char
- = init_integer_type (objfile, TARGET_CHAR_BIT,
- 0, "signed char");
+ = init_integer_type (objfile, TARGET_CHAR_BIT, 0, "signed char");
objfile_type->builtin_unsigned_char
- = init_integer_type (objfile, TARGET_CHAR_BIT,
- 1, "unsigned char");
+ = init_integer_type (objfile, TARGET_CHAR_BIT, 1, "unsigned char");
objfile_type->builtin_short
- = init_integer_type (objfile, gdbarch_short_bit (gdbarch),
- 0, "short");
+ = init_integer_type (objfile, gdbarch_short_bit (gdbarch), 0, "short");
objfile_type->builtin_unsigned_short
- = init_integer_type (objfile, gdbarch_short_bit (gdbarch),
- 1, "unsigned short");
+ = init_integer_type (objfile, gdbarch_short_bit (gdbarch), 1,
+ "unsigned short");
objfile_type->builtin_int
- = init_integer_type (objfile, gdbarch_int_bit (gdbarch),
- 0, "int");
+ = init_integer_type (objfile, gdbarch_int_bit (gdbarch), 0, "int");
objfile_type->builtin_unsigned_int
- = init_integer_type (objfile, gdbarch_int_bit (gdbarch),
- 1, "unsigned int");
+ = init_integer_type (objfile, gdbarch_int_bit (gdbarch), 1,
+ "unsigned int");
objfile_type->builtin_long
- = init_integer_type (objfile, gdbarch_long_bit (gdbarch),
- 0, "long");
+ = init_integer_type (objfile, gdbarch_long_bit (gdbarch), 0, "long");
objfile_type->builtin_unsigned_long
- = init_integer_type (objfile, gdbarch_long_bit (gdbarch),
- 1, "unsigned long");
+ = init_integer_type (objfile, gdbarch_long_bit (gdbarch), 1,
+ "unsigned long");
objfile_type->builtin_long_long
- = init_integer_type (objfile, gdbarch_long_long_bit (gdbarch),
- 0, "long long");
+ = init_integer_type (objfile, gdbarch_long_long_bit (gdbarch), 0,
+ "long long");
objfile_type->builtin_unsigned_long_long
- = init_integer_type (objfile, gdbarch_long_long_bit (gdbarch),
- 1, "unsigned long long");
+ = init_integer_type (objfile, gdbarch_long_long_bit (gdbarch), 1,
+ "unsigned long long");
objfile_type->builtin_float
- = init_float_type (objfile, gdbarch_float_bit (gdbarch),
- "float", gdbarch_float_format (gdbarch));
+ = init_float_type (objfile, gdbarch_float_bit (gdbarch), "float",
+ gdbarch_float_format (gdbarch));
objfile_type->builtin_double
- = init_float_type (objfile, gdbarch_double_bit (gdbarch),
- "double", gdbarch_double_format (gdbarch));
+ = init_float_type (objfile, gdbarch_double_bit (gdbarch), "double",
+ gdbarch_double_format (gdbarch));
objfile_type->builtin_long_double
= init_float_type (objfile, gdbarch_long_double_bit (gdbarch),
"long double", gdbarch_long_double_format (gdbarch));
@@ -6400,9 +6279,11 @@ objfile_type (struct objfile *objfile)
objfile_type->nodebug_data_symbol
= init_nodebug_var_type (objfile, "<data variable, no debug info>");
objfile_type->nodebug_unknown_symbol
- = init_nodebug_var_type (objfile, "<variable (not text or data), no debug info>");
+ = init_nodebug_var_type (objfile,
+ "<variable (not text or data), no debug info>");
objfile_type->nodebug_tls_symbol
- = init_nodebug_var_type (objfile, "<thread local variable, no debug info>");
+ = init_nodebug_var_type (objfile,
+ "<thread local variable, no debug info>");
/* NOTE: on some targets, addresses and pointers are not necessarily
the same.
@@ -6441,35 +6322,32 @@ call_site::pc () const
}
void _initialize_gdbtypes ();
+
void
_initialize_gdbtypes ()
{
add_setshow_zuinteger_cmd ("overload", no_class, &overload_debug,
- _("Set debugging of C++ overloading."),
- _("Show debugging of C++ overloading."),
- _("When enabled, ranking of the "
- "functions is displayed."),
- NULL,
- show_overload_debug,
- &setdebuglist, &showdebuglist);
+ _ ("Set debugging of C++ overloading."),
+ _ ("Show debugging of C++ overloading."),
+ _ ("When enabled, ranking of the "
+ "functions is displayed."),
+ NULL, show_overload_debug, &setdebuglist,
+ &showdebuglist);
/* Add user knob for controlling resolution of opaque types. */
add_setshow_boolean_cmd ("opaque-type-resolution", class_support,
&opaque_type_resolution,
- _("Set resolution of opaque struct/class/union"
- " types (if set before loading symbols)."),
- _("Show resolution of opaque struct/class/union"
- " types (if set before loading symbols)."),
- NULL, NULL,
- show_opaque_type_resolution,
- &setlist, &showlist);
+ _ ("Set resolution of opaque struct/class/union"
+ " types (if set before loading symbols)."),
+ _ ("Show resolution of opaque struct/class/union"
+ " types (if set before loading symbols)."),
+ NULL, NULL, show_opaque_type_resolution, &setlist,
+ &showlist);
/* Add an option to permit non-strict type checking. */
- add_setshow_boolean_cmd ("type", class_support,
- &strict_type_checking,
- _("Set strict type checking."),
- _("Show strict type checking."),
- NULL, NULL,
- show_strict_type_checking,
- &setchecklist, &showchecklist);
+ add_setshow_boolean_cmd ("type", class_support, &strict_type_checking,
+ _ ("Set strict type checking."),
+ _ ("Show strict type checking."), NULL, NULL,
+ show_strict_type_checking, &setchecklist,
+ &showchecklist);
}
diff --git a/gdb/gdbtypes.h b/gdb/gdbtypes.h
index 18ea1bca19c..9631d12d71d 100644
--- a/gdb/gdbtypes.h
+++ b/gdb/gdbtypes.h
@@ -20,7 +20,7 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
-#if !defined (GDBTYPES_H)
+#if !defined(GDBTYPES_H)
#define GDBTYPES_H 1
/* * \page gdbtypes GDB Types
@@ -67,25 +67,25 @@ struct dwarf2_per_objfile;
/* Some macros for char-based bitfields. */
-#define B_SET(a,x) ((a)[(x)>>3] |= (1 << ((x)&7)))
-#define B_CLR(a,x) ((a)[(x)>>3] &= ~(1 << ((x)&7)))
-#define B_TST(a,x) ((a)[(x)>>3] & (1 << ((x)&7)))
-#define B_TYPE unsigned char
-#define B_BYTES(x) ( 1 + ((x)>>3) )
-#define B_CLRALL(a,x) memset ((a), 0, B_BYTES(x))
+#define B_SET(a, x) ((a)[(x) >> 3] |= (1 << ((x) &7)))
+#define B_CLR(a, x) ((a)[(x) >> 3] &= ~(1 << ((x) &7)))
+#define B_TST(a, x) ((a)[(x) >> 3] & (1 << ((x) &7)))
+#define B_TYPE unsigned char
+#define B_BYTES(x) (1 + ((x) >> 3))
+#define B_CLRALL(a, x) memset ((a), 0, B_BYTES (x))
/* * Different kinds of data types are distinguished by the `code'
field. */
enum type_code
- {
- TYPE_CODE_UNDEF = 0, /**< Not used; catches errors */
+{
+ TYPE_CODE_UNDEF = 0, /**< Not used; catches errors */
#define OP(X) X,
#include "type-codes.def"
#undef OP
- };
+};
/* * Some bits for the type's instance_flags word. See the macros
below for documentation on each bit. */
@@ -108,12 +108,13 @@ DEF_ENUM_FLAGS_TYPE (enum type_instance_flag_value, type_instance_flags);
/* * Not textual. By default, GDB treats all single byte integers as
characters (or elements of strings) unless this flag is set. */
-#define TYPE_NOTTEXT(t) (((t)->instance_flags ()) & TYPE_INSTANCE_FLAG_NOTTEXT)
+#define TYPE_NOTTEXT(t) (((t)->instance_flags ()) & TYPE_INSTANCE_FLAG_NOTTEXT)
/* * Constant type. If this is set, the corresponding type has a
const modifier. */
-#define TYPE_CONST(t) ((((t)->instance_flags ()) & TYPE_INSTANCE_FLAG_CONST) != 0)
+#define TYPE_CONST(t) \
+ ((((t)->instance_flags ()) & TYPE_INSTANCE_FLAG_CONST) != 0)
/* * Volatile type. If this is set, the corresponding type has a
volatile modifier. */
@@ -139,8 +140,7 @@ DEF_ENUM_FLAGS_TYPE (enum type_instance_flag_value, type_instance_flags);
((t)->code () == TYPE_CODE_REF || (t)->code () == TYPE_CODE_RVALUE_REF)
/* * True if this type is allocatable. */
-#define TYPE_IS_ALLOCATABLE(t) \
- ((t)->dyn_prop (DYN_PROP_ALLOCATED) != NULL)
+#define TYPE_IS_ALLOCATABLE(t) ((t)->dyn_prop (DYN_PROP_ALLOCATED) != NULL)
/* * True if this type has variant parts. */
#define TYPE_HAS_VARIANT_PARTS(t) \
@@ -182,14 +182,14 @@ DEF_ENUM_FLAGS_TYPE (enum type_instance_flag_value, type_instance_flags);
target specific ways to represent these different types of address
classes. */
-#define TYPE_ADDRESS_CLASS_1(t) (((t)->instance_flags ()) \
- & TYPE_INSTANCE_FLAG_ADDRESS_CLASS_1)
-#define TYPE_ADDRESS_CLASS_2(t) (((t)->instance_flags ()) \
- & TYPE_INSTANCE_FLAG_ADDRESS_CLASS_2)
+#define TYPE_ADDRESS_CLASS_1(t) \
+ (((t)->instance_flags ()) & TYPE_INSTANCE_FLAG_ADDRESS_CLASS_1)
+#define TYPE_ADDRESS_CLASS_2(t) \
+ (((t)->instance_flags ()) & TYPE_INSTANCE_FLAG_ADDRESS_CLASS_2)
#define TYPE_INSTANCE_FLAG_ADDRESS_CLASS_ALL \
(TYPE_INSTANCE_FLAG_ADDRESS_CLASS_1 | TYPE_INSTANCE_FLAG_ADDRESS_CLASS_2)
-#define TYPE_ADDRESS_CLASS_ALL(t) (((t)->instance_flags ()) \
- & TYPE_INSTANCE_FLAG_ADDRESS_CLASS_ALL)
+#define TYPE_ADDRESS_CLASS_ALL(t) \
+ (((t)->instance_flags ()) & TYPE_INSTANCE_FLAG_ADDRESS_CLASS_ALL)
/* * Information about a single discriminant. */
@@ -237,10 +237,7 @@ struct variant : allocate_on_obstack
/* * Return true if this is the default variant. The default
variant can be recognized because it has no associated
discriminants. */
- bool is_default () const
- {
- return discriminants.empty ();
- }
+ bool is_default () const { return discriminants.empty (); }
/* * Return true if this variant matches VALUE. IS_UNSIGNED is true
if this should be an unsigned comparison; false for signed. */
@@ -268,16 +265,15 @@ struct variant_part : allocate_on_obstack
gdb::array_view<variant> variants;
};
-
enum dynamic_prop_kind
{
- PROP_UNDEFINED, /* Not defined. */
- PROP_CONST, /* Constant. */
- PROP_ADDR_OFFSET, /* Address offset. */
- PROP_LOCEXPR, /* Location expression. */
- PROP_LOCLIST, /* Location list. */
+ PROP_UNDEFINED, /* Not defined. */
+ PROP_CONST, /* Constant. */
+ PROP_ADDR_OFFSET, /* Address offset. */
+ PROP_LOCEXPR, /* Location expression. */
+ PROP_LOCLIST, /* Location list. */
PROP_VARIANT_PARTS, /* Variant parts. */
- PROP_TYPE, /* Type. */
+ PROP_TYPE, /* Type. */
PROP_VARIABLE_NAME, /* Variable name. */
};
@@ -316,15 +312,9 @@ union dynamic_prop_data
struct dynamic_prop
{
- dynamic_prop_kind kind () const
- {
- return m_kind;
- }
+ dynamic_prop_kind kind () const { return m_kind; }
- void set_undefined ()
- {
- m_kind = PROP_UNDEFINED;
- }
+ void set_undefined () { m_kind = PROP_UNDEFINED; }
LONGEST const_val () const
{
@@ -341,8 +331,7 @@ struct dynamic_prop
void *baton () const
{
- gdb_assert (m_kind == PROP_LOCEXPR
- || m_kind == PROP_LOCLIST
+ gdb_assert (m_kind == PROP_LOCEXPR || m_kind == PROP_LOCLIST
|| m_kind == PROP_ADDR_OFFSET);
return m_data.baton;
@@ -420,7 +409,8 @@ struct dynamic_prop
extern bool operator== (const dynamic_prop &l, const dynamic_prop &r);
/* Compare two dynamic_prop objects for inequality. */
-static inline bool operator!= (const dynamic_prop &l, const dynamic_prop &r)
+static inline bool
+operator!= (const dynamic_prop &l, const dynamic_prop &r)
{
return !(l == r);
}
@@ -471,13 +461,13 @@ struct dynamic_prop_list
used. */
enum field_loc_kind
- {
- FIELD_LOC_KIND_BITPOS, /**< bitpos */
- FIELD_LOC_KIND_ENUMVAL, /**< enumval */
- FIELD_LOC_KIND_PHYSADDR, /**< physaddr */
- FIELD_LOC_KIND_PHYSNAME, /**< physname */
- FIELD_LOC_KIND_DWARF_BLOCK /**< dwarf_block */
- };
+{
+ FIELD_LOC_KIND_BITPOS, /**< bitpos */
+ FIELD_LOC_KIND_ENUMVAL, /**< enumval */
+ FIELD_LOC_KIND_PHYSADDR, /**< physaddr */
+ FIELD_LOC_KIND_PHYSNAME, /**< physname */
+ FIELD_LOC_KIND_DWARF_BLOCK /**< dwarf_block */
+};
/* * A discriminant to determine which field in the
main_type.type_specific union is being used, if any.
@@ -538,32 +528,17 @@ union field_location
struct field
{
- struct type *type () const
- {
- return this->m_type;
- }
+ struct type *type () const { return this->m_type; }
- void set_type (struct type *type)
- {
- this->m_type = type;
- }
+ void set_type (struct type *type) { this->m_type = type; }
- const char *name () const
- {
- return m_name;
- }
+ const char *name () const { return m_name; }
- void set_name (const char *name)
- {
- m_name = name;
- }
+ void set_name (const char *name) { m_name = name; }
/* Location getters / setters. */
- field_loc_kind loc_kind () const
- {
- return m_loc_kind;
- }
+ field_loc_kind loc_kind () const { return m_loc_kind; }
LONGEST loc_bitpos () const
{
@@ -636,7 +611,7 @@ struct field
/* * Discriminant for union field_location. */
- ENUM_BITFIELD(field_loc_kind) m_loc_kind : 3;
+ ENUM_BITFIELD (field_loc_kind) m_loc_kind : 3;
/* * Size of this field, in bits, or zero if not packed.
If non-zero in an array type, indicates the element size in
@@ -709,7 +684,8 @@ struct range_bounds
extern bool operator== (const range_bounds &l, const range_bounds &r);
/* Compare two range_bounds objects for inequality. */
-static inline bool operator!= (const range_bounds &l, const range_bounds &r)
+static inline bool
+operator!= (const range_bounds &l, const range_bounds &r)
{
return !(l == r);
}
@@ -772,7 +748,7 @@ struct main_type
{
/* * Code for kind of type. */
- ENUM_BITFIELD(type_code) code : 8;
+ ENUM_BITFIELD (type_code) code : 8;
/* * Flags about this type. These fields appear at this location
because they packs nicely here. See the TYPE_* macros for
@@ -813,7 +789,7 @@ struct main_type
/* * A discriminant telling us which field of the type_specific
union is being used for this type, if any. */
- ENUM_BITFIELD(type_specific_kind) type_specific_field : 3;
+ ENUM_BITFIELD (type_specific_kind) type_specific_field : 3;
/* * Number of fields described for this type. This field appears
at this location because it packs nicely here. */
@@ -870,7 +846,7 @@ struct main_type
because we can allocate the space for a type before
we know what to put in it. */
- union
+ union
{
struct field *fields;
@@ -906,48 +882,27 @@ struct type
Note that the code can be TYPE_CODE_TYPEDEF, so if you want the real
type, you need to do `check_typedef (type)->code ()`. */
- type_code code () const
- {
- return this->main_type->code;
- }
+ type_code code () const { return this->main_type->code; }
/* Set the type code of this type. */
- void set_code (type_code code)
- {
- this->main_type->code = code;
- }
+ void set_code (type_code code) { this->main_type->code = code; }
/* Get the name of this type. */
- const char *name () const
- {
- return this->main_type->name;
- }
+ const char *name () const { return this->main_type->name; }
/* Set the name of this type. */
- void set_name (const char *name)
- {
- this->main_type->name = name;
- }
+ void set_name (const char *name) { this->main_type->name = name; }
/* Note that if thistype is a TYPEDEF type, you have to call check_typedef.
But check_typedef does set the TYPE_LENGTH of the TYPEDEF type,
so you only have to call check_typedef once. Since allocate_value
calls check_typedef, VALUE_TYPE (X)->length () is safe. */
- ULONGEST length () const
- {
- return this->m_length;
- }
+ ULONGEST length () const { return this->m_length; }
- void set_length (ULONGEST length)
- {
- this->m_length = length;
- }
+ void set_length (ULONGEST length) { this->m_length = length; }
/* Get the number of fields of this type. */
- int num_fields () const
- {
- return this->main_type->nfields;
- }
+ int num_fields () const { return this->main_type->nfields; }
/* Set the number of fields of this type. */
void set_num_fields (int num_fields)
@@ -956,10 +911,7 @@ struct type
}
/* Get the fields array of this type. */
- struct field *fields () const
- {
- return this->main_type->flds_bnds.fields;
- }
+ struct field *fields () const { return this->main_type->flds_bnds.fields; }
/* Get the field at index IDX. */
struct field &field (int idx) const
@@ -974,15 +926,9 @@ struct type
this->main_type->flds_bnds.fields = fields;
}
- type *index_type () const
- {
- return this->field (0).type ();
- }
+ type *index_type () const { return this->field (0).type (); }
- struct type *target_type () const
- {
- return this->main_type->m_target_type;
- }
+ struct type *target_type () const { return this->main_type->m_target_type; }
void set_target_type (struct type *target_type)
{
@@ -1019,8 +965,8 @@ struct type
return this->index_type ()->bounds ();
default:
- gdb_assert_not_reached
- ("type::bounds called on type with invalid code");
+ gdb_assert_not_reached (
+ "type::bounds called on type with invalid code");
}
}
@@ -1042,10 +988,7 @@ struct type
/* Unsigned integer type. If this is not set for a TYPE_CODE_INT,
the type is signed (unless TYPE_NOSIGN is set). */
- bool is_unsigned () const
- {
- return this->main_type->m_flag_unsigned;
- }
+ bool is_unsigned () const { return this->main_type->m_flag_unsigned; }
void set_is_unsigned (bool is_unsigned)
{
@@ -1056,10 +999,7 @@ struct type
"unsigned char" are distinct types; so we need an extra flag to
indicate the absence of a sign! */
- bool has_no_signedness () const
- {
- return this->main_type->m_flag_nosign;
- }
+ bool has_no_signedness () const { return this->main_type->m_flag_nosign; }
void set_has_no_signedness (bool has_no_signedness)
{
@@ -1070,15 +1010,9 @@ struct type
if someone referenced a type that wasn't defined in a source file
via (struct sir_not_appearing_in_this_film *)). */
- bool is_stub () const
- {
- return this->main_type->m_flag_stub;
- }
+ bool is_stub () const { return this->main_type->m_flag_stub; }
- void set_is_stub (bool is_stub)
- {
- this->main_type->m_flag_stub = is_stub;
- }
+ void set_is_stub (bool is_stub) { this->main_type->m_flag_stub = is_stub; }
/* The target type of this type is a stub type, and this type needs
to be updated if it gets un-stubbed in check_typedef. Used for
@@ -1086,10 +1020,7 @@ struct type
based on the TYPE_LENGTH of the target type. Also, set for
TYPE_CODE_TYPEDEF. */
- bool target_is_stub () const
- {
- return this->main_type->m_flag_target_stub;
- }
+ bool target_is_stub () const { return this->main_type->m_flag_target_stub; }
void set_target_is_stub (bool target_is_stub)
{
@@ -1101,10 +1032,7 @@ struct type
to coerce the args, or to just do the standard conversions. This
is used with a short field. */
- bool is_prototyped () const
- {
- return this->main_type->m_flag_prototyped;
- }
+ bool is_prototyped () const { return this->main_type->m_flag_prototyped; }
void set_is_prototyped (bool is_prototyped)
{
@@ -1114,10 +1042,7 @@ struct type
/* FIXME drow/2002-06-03: Only used for methods, but applies as well
to functions. */
- bool has_varargs () const
- {
- return this->main_type->m_flag_varargs;
- }
+ bool has_varargs () const { return this->main_type->m_flag_varargs; }
void set_has_varargs (bool has_varargs)
{
@@ -1128,10 +1053,7 @@ struct type
attribute to the array type. We slurp that in as a new flag of a
type. This is used only in dwarf2read.c. */
- bool is_vector () const
- {
- return this->main_type->m_flag_vector;
- }
+ bool is_vector () const { return this->main_type->m_flag_vector; }
void set_is_vector (bool is_vector)
{
@@ -1158,10 +1080,7 @@ struct type
determines the final returned function type to be presented to
user. */
- bool is_gnu_ifunc () const
- {
- return this->main_type->m_flag_gnu_ifunc;
- }
+ bool is_gnu_ifunc () const { return this->main_type->m_flag_gnu_ifunc; }
void set_is_gnu_ifunc (bool is_gnu_ifunc)
{
@@ -1202,7 +1121,6 @@ struct type
this->main_type->m_flag_endianity_not_default = endianity_is_not_default;
}
-
/* True if this type was declared using the "class" keyword. This is
only valid for C++ structure and enum types. If false, a structure
was declared as a "struct"; if true it was declared "class". For
@@ -1223,10 +1141,7 @@ struct type
the values are pairwise disjoint when "and"ed together. This
affects how enum values are printed. */
- bool is_flag_enum () const
- {
- return this->main_type->m_flag_flag_enum;
- }
+ bool is_flag_enum () const { return this->main_type->m_flag_flag_enum; }
void set_is_flag_enum (bool is_flag_enum)
{
@@ -1447,7 +1362,6 @@ struct type
struct fn_fieldlist
{
-
/* * The overloaded name.
This is generally allocated in the objfile's obstack.
However stabsread.c sometimes uses malloc. */
@@ -1463,8 +1377,6 @@ struct fn_fieldlist
struct fn_field *fn_fields;
};
-
-
struct fn_field
{
/* * If is_stub is clear, this is the mangled name which we can look
@@ -1494,16 +1406,16 @@ struct fn_field
/* Attributes. */
- unsigned int is_const:1;
- unsigned int is_volatile:1;
- unsigned int is_private:1;
- unsigned int is_protected:1;
- unsigned int is_artificial:1;
+ unsigned int is_const : 1;
+ unsigned int is_volatile : 1;
+ unsigned int is_private : 1;
+ unsigned int is_protected : 1;
+ unsigned int is_artificial : 1;
/* * A stub method only has some fields valid (but they are enough
to reconstruct the rest of the fields). */
- unsigned int is_stub:1;
+ unsigned int is_stub : 1;
/* * True if this function is a constructor, false otherwise. */
@@ -1520,15 +1432,14 @@ struct fn_field
/* * Unused. */
- unsigned int dummy:6;
+ unsigned int dummy : 6;
/* * Index into that baseclass's virtual function table, minus 2;
else if static: VOFFSET_STATIC; else: 0. */
- unsigned int voffset:16;
+ unsigned int voffset : 16;
#define VOFFSET_STATIC 1
-
};
struct decl_field
@@ -1553,15 +1464,15 @@ struct decl_field
TYPE_CODE_UNION nodes. */
struct cplus_struct_type
- {
- /* * Number of base classes this type derives from. The
+{
+ /* * Number of base classes this type derives from. The
baseclasses are stored in the first N_BASECLASSES fields
(i.e. the `fields' field of the struct type). The only fields
of struct field that are used are: type, name, loc.bitpos. */
- short n_baseclasses;
+ short n_baseclasses;
- /* * Field number of the virtual function table pointer in VPTR_BASETYPE.
+ /* * Field number of the virtual function table pointer in VPTR_BASETYPE.
All access to this field must be through TYPE_VPTR_FIELDNO as one
thing it does is check whether the field has been initialized.
Initially TYPE_RAW_CPLUS_SPECIFIC has the value of cplus_struct_default,
@@ -1575,36 +1486,36 @@ struct cplus_struct_type
Unused if this type does not have virtual functions. */
- short vptr_fieldno;
+ short vptr_fieldno;
- /* * Number of methods with unique names. All overloaded methods
+ /* * Number of methods with unique names. All overloaded methods
with the same name count only once. */
- short nfn_fields;
+ short nfn_fields;
- /* * Number of template arguments. */
+ /* * Number of template arguments. */
- unsigned short n_template_arguments;
+ unsigned short n_template_arguments;
- /* * One if this struct is a dynamic class, as defined by the
+ /* * One if this struct is a dynamic class, as defined by the
Itanium C++ ABI: if it requires a virtual table pointer,
because it or any of its base classes have one or more virtual
member functions or virtual base classes. Minus one if not
dynamic. Zero if not yet computed. */
- int is_dynamic : 2;
+ int is_dynamic : 2;
- /* * The calling convention for this type, fetched from the
+ /* * The calling convention for this type, fetched from the
DW_AT_calling_convention attribute. The value is one of the
DW_CC constants. */
- ENUM_BITFIELD (dwarf_calling_convention) calling_convention : 8;
+ ENUM_BITFIELD (dwarf_calling_convention) calling_convention : 8;
- /* * The base class which defined the virtual function table pointer. */
+ /* * The base class which defined the virtual function table pointer. */
- struct type *vptr_basetype;
+ struct type *vptr_basetype;
- /* * For derived classes, the number of base classes is given by
+ /* * For derived classes, the number of base classes is given by
n_baseclasses and virtual_field_bits is a bit vector containing
one bit per base class. If the base class is virtual, the
corresponding bit will be set.
@@ -1617,66 +1528,66 @@ struct cplus_struct_type
B is a baseclass of C; A is a virtual baseclass for C.
This is a C++ 2.0 language feature. */
- B_TYPE *virtual_field_bits;
+ B_TYPE *virtual_field_bits;
- /* * For classes with private fields, the number of fields is
+ /* * For classes with private fields, the number of fields is
given by nfields and private_field_bits is a bit vector
containing one bit per field.
If the field is private, the corresponding bit will be set. */
- B_TYPE *private_field_bits;
+ B_TYPE *private_field_bits;
- /* * For classes with protected fields, the number of fields is
+ /* * For classes with protected fields, the number of fields is
given by nfields and protected_field_bits is a bit vector
containing one bit per field.
If the field is private, the corresponding bit will be set. */
- B_TYPE *protected_field_bits;
+ B_TYPE *protected_field_bits;
- /* * For classes with fields to be ignored, either this is
+ /* * For classes with fields to be ignored, either this is
optimized out or this field has length 0. */
- B_TYPE *ignore_field_bits;
+ B_TYPE *ignore_field_bits;
- /* * For classes, structures, and unions, a description of each
+ /* * For classes, structures, and unions, a description of each
field, which consists of an overloaded name, followed by the
types of arguments that the method expects, and then the name
after it has been renamed to make it distinct.
fn_fieldlists points to an array of nfn_fields of these. */
- struct fn_fieldlist *fn_fieldlists;
+ struct fn_fieldlist *fn_fieldlists;
- /* * typedefs defined inside this class. typedef_field points to
+ /* * typedefs defined inside this class. typedef_field points to
an array of typedef_field_count elements. */
- struct decl_field *typedef_field;
+ struct decl_field *typedef_field;
- unsigned typedef_field_count;
+ unsigned typedef_field_count;
- /* * The nested types defined by this type. nested_types points to
+ /* * The nested types defined by this type. nested_types points to
an array of nested_types_count elements. */
- struct decl_field *nested_types;
+ struct decl_field *nested_types;
- unsigned nested_types_count;
+ unsigned nested_types_count;
- /* * The template arguments. This is an array with
+ /* * The template arguments. This is an array with
N_TEMPLATE_ARGUMENTS elements. This is NULL for non-template
classes. */
- struct symbol **template_arguments;
- };
+ struct symbol **template_arguments;
+};
/* * Struct used to store conversion rankings. */
struct rank
- {
- short rank;
+{
+ short rank;
- /* * When two conversions are of the same type and therefore have
+ /* * When two conversions are of the same type and therefore have
the same rank, subrank is used to differentiate the two.
Eg: Two derived-class-pointer to base-class-pointer conversions
@@ -1684,8 +1595,8 @@ struct rank
conversion with the shorter distance to the ancestor is
preferable. 'subrank' would be used to reflect that. */
- short subrank;
- };
+ short subrank;
+};
/* * Used for ranking a function for overload resolution. */
@@ -1694,44 +1605,44 @@ typedef std::vector<rank> badness_vector;
/* * GNAT Ada-specific information for various Ada types. */
struct gnat_aux_type
- {
- /* * Parallel type used to encode information about dynamic types
+{
+ /* * Parallel type used to encode information about dynamic types
used in Ada (such as variant records, variable-size array,
etc). */
- struct type* descriptive_type;
- };
+ struct type *descriptive_type;
+};
/* * For TYPE_CODE_FUNC and TYPE_CODE_METHOD types. */
struct func_type
- {
- /* * The calling convention for targets supporting multiple ABIs.
+{
+ /* * The calling convention for targets supporting multiple ABIs.
Right now this is only fetched from the Dwarf-2
DW_AT_calling_convention attribute. The value is one of the
DW_CC constants. */
- ENUM_BITFIELD (dwarf_calling_convention) calling_convention : 8;
+ ENUM_BITFIELD (dwarf_calling_convention) calling_convention : 8;
- /* * Whether this function normally returns to its caller. It is
+ /* * Whether this function normally returns to its caller. It is
set from the DW_AT_noreturn attribute if set on the
DW_TAG_subprogram. */
- unsigned int is_noreturn : 1;
+ unsigned int is_noreturn : 1;
- /* * Only those DW_TAG_call_site's in this function that have
+ /* * Only those DW_TAG_call_site's in this function that have
DW_AT_call_tail_call set are linked in this list. Function
without its tail call list complete
(DW_AT_call_all_tail_calls or its superset
DW_AT_call_all_calls) has TAIL_CALL_LIST NULL, even if some
DW_TAG_call_site's exist in such function. */
- struct call_site *tail_call_list;
+ struct call_site *tail_call_list;
- /* * For method types (TYPE_CODE_METHOD), the aggregate type that
+ /* * For method types (TYPE_CODE_METHOD), the aggregate type that
contains the method. */
- struct type *self_type;
- };
+ struct type *self_type;
+};
/* The type-specific info for TYPE_CODE_FIXED_POINT types. */
@@ -1748,18 +1659,18 @@ extern const struct cplus_struct_type cplus_struct_default;
extern void allocate_cplus_struct_type (struct type *);
-#define INIT_CPLUS_SPECIFIC(type) \
+#define INIT_CPLUS_SPECIFIC(type) \
(TYPE_SPECIFIC_FIELD (type) = TYPE_SPECIFIC_CPLUS_STUFF, \
- TYPE_RAW_CPLUS_SPECIFIC (type) = (struct cplus_struct_type*) \
- &cplus_struct_default)
+ TYPE_RAW_CPLUS_SPECIFIC (type) \
+ = (struct cplus_struct_type *) &cplus_struct_default)
#define ALLOCATE_CPLUS_STRUCT_TYPE(type) allocate_cplus_struct_type (type)
-#define HAVE_CPLUS_STRUCT(type) \
+#define HAVE_CPLUS_STRUCT(type) \
(TYPE_SPECIFIC_FIELD (type) == TYPE_SPECIFIC_CPLUS_STUFF \
- && TYPE_RAW_CPLUS_SPECIFIC (type) != &cplus_struct_default)
+ && TYPE_RAW_CPLUS_SPECIFIC (type) != &cplus_struct_default)
-#define INIT_NONE_SPECIFIC(type) \
+#define INIT_NONE_SPECIFIC(type) \
(TYPE_SPECIFIC_FIELD (type) = TYPE_SPECIFIC_NONE, \
TYPE_MAIN_TYPE (type)->type_specific = {})
@@ -1767,7 +1678,7 @@ extern const struct gnat_aux_type gnat_aux_default;
extern void allocate_gnat_aux_type (struct type *);
-#define INIT_GNAT_SPECIFIC(type) \
+#define INIT_GNAT_SPECIFIC(type) \
(TYPE_SPECIFIC_FIELD (type) = TYPE_SPECIFIC_GNAT_STUFF, \
TYPE_GNAT_SPECIFIC (type) = (struct gnat_aux_type *) &gnat_aux_default)
#define ALLOCATE_GNAT_AUX_TYPE(type) allocate_gnat_aux_type (type)
@@ -1777,21 +1688,21 @@ extern void allocate_gnat_aux_type (struct type *);
(TYPE_SPECIFIC_FIELD (type) == TYPE_SPECIFIC_GNAT_STUFF)
/* * True if TYPE is known to be an Ada type of some kind. */
-#define ADA_TYPE_P(type) \
- (TYPE_SPECIFIC_FIELD (type) == TYPE_SPECIFIC_GNAT_STUFF \
- || (TYPE_SPECIFIC_FIELD (type) == TYPE_SPECIFIC_NONE \
- && (type)->is_fixed_instance ()))
-
-#define INIT_FUNC_SPECIFIC(type) \
- (TYPE_SPECIFIC_FIELD (type) = TYPE_SPECIFIC_FUNC, \
- TYPE_MAIN_TYPE (type)->type_specific.func_stuff = (struct func_type *) \
- TYPE_ZALLOC (type, \
+#define ADA_TYPE_P(type) \
+ (TYPE_SPECIFIC_FIELD (type) == TYPE_SPECIFIC_GNAT_STUFF \
+ || (TYPE_SPECIFIC_FIELD (type) == TYPE_SPECIFIC_NONE \
+ && (type)->is_fixed_instance ()))
+
+#define INIT_FUNC_SPECIFIC(type) \
+ (TYPE_SPECIFIC_FIELD (type) = TYPE_SPECIFIC_FUNC, \
+ TYPE_MAIN_TYPE (type)->type_specific.func_stuff = (struct func_type *) \
+ TYPE_ZALLOC (type, \
sizeof (*TYPE_MAIN_TYPE (type)->type_specific.func_stuff)))
/* "struct fixed_point_type_info" has a field that has a destructor.
See allocate_fixed_point_type_info to understand how this is
handled. */
-#define INIT_FIXED_POINT_SPECIFIC(type) \
+#define INIT_FIXED_POINT_SPECIFIC(type) \
(TYPE_SPECIFIC_FIELD (type) = TYPE_SPECIFIC_FIXED_POINT, \
allocate_fixed_point_type_info (type))
@@ -1837,8 +1748,7 @@ extern bool set_type_align (struct type *, ULONGEST);
((thistype)->dyn_prop (DYN_PROP_ALLOCATED))
#define TYPE_ASSOCIATED_PROP(thistype) \
((thistype)->dyn_prop (DYN_PROP_ASSOCIATED))
-#define TYPE_RANK_PROP(thistype) \
- ((thistype)->dyn_prop (DYN_PROP_RANK))
+#define TYPE_RANK_PROP(thistype) ((thistype)->dyn_prop (DYN_PROP_RANK))
/* C++ */
@@ -1854,80 +1764,102 @@ extern void set_type_vptr_basetype (struct type *, struct type *);
#define TYPE_VPTR_FIELDNO(thistype) internal_type_vptr_fieldno (thistype)
#define TYPE_VPTR_BASETYPE(thistype) internal_type_vptr_basetype (thistype)
-#define TYPE_NFN_FIELDS(thistype) TYPE_CPLUS_SPECIFIC(thistype)->nfn_fields
+#define TYPE_NFN_FIELDS(thistype) TYPE_CPLUS_SPECIFIC (thistype)->nfn_fields
#define TYPE_SPECIFIC_FIELD(thistype) \
- TYPE_MAIN_TYPE(thistype)->type_specific_field
+ TYPE_MAIN_TYPE (thistype)->type_specific_field
/* We need this tap-dance with the TYPE_RAW_SPECIFIC because of the case
where we're trying to print an Ada array using the C language.
In that case, there is no "cplus_stuff", but the C language assumes
that there is. What we do, in that case, is pretend that there is
an implicit one which is the default cplus stuff. */
-#define TYPE_CPLUS_SPECIFIC(thistype) \
- (!HAVE_CPLUS_STRUCT(thistype) \
- ? (struct cplus_struct_type*)&cplus_struct_default \
- : TYPE_RAW_CPLUS_SPECIFIC(thistype))
-#define TYPE_RAW_CPLUS_SPECIFIC(thistype) TYPE_MAIN_TYPE(thistype)->type_specific.cplus_stuff
+#define TYPE_CPLUS_SPECIFIC(thistype) \
+ (!HAVE_CPLUS_STRUCT (thistype) \
+ ? (struct cplus_struct_type *) &cplus_struct_default \
+ : TYPE_RAW_CPLUS_SPECIFIC (thistype))
+#define TYPE_RAW_CPLUS_SPECIFIC(thistype) \
+ TYPE_MAIN_TYPE (thistype)->type_specific.cplus_stuff
#define TYPE_CPLUS_CALLING_CONVENTION(thistype) \
- TYPE_MAIN_TYPE(thistype)->type_specific.cplus_stuff->calling_convention
-#define TYPE_FLOATFORMAT(thistype) TYPE_MAIN_TYPE(thistype)->type_specific.floatformat
-#define TYPE_GNAT_SPECIFIC(thistype) TYPE_MAIN_TYPE(thistype)->type_specific.gnat_stuff
-#define TYPE_DESCRIPTIVE_TYPE(thistype) TYPE_GNAT_SPECIFIC(thistype)->descriptive_type
-#define TYPE_CALLING_CONVENTION(thistype) TYPE_MAIN_TYPE(thistype)->type_specific.func_stuff->calling_convention
-#define TYPE_NO_RETURN(thistype) TYPE_MAIN_TYPE(thistype)->type_specific.func_stuff->is_noreturn
-#define TYPE_TAIL_CALL_LIST(thistype) TYPE_MAIN_TYPE(thistype)->type_specific.func_stuff->tail_call_list
-#define TYPE_BASECLASS(thistype,index) ((thistype)->field (index).type ())
-#define TYPE_N_BASECLASSES(thistype) TYPE_CPLUS_SPECIFIC(thistype)->n_baseclasses
-#define TYPE_BASECLASS_NAME(thistype,index) (thistype->field (index).name ())
-#define TYPE_BASECLASS_BITPOS(thistype,index) (thistype->field (index).loc_bitpos ())
+ TYPE_MAIN_TYPE (thistype)->type_specific.cplus_stuff->calling_convention
+#define TYPE_FLOATFORMAT(thistype) \
+ TYPE_MAIN_TYPE (thistype)->type_specific.floatformat
+#define TYPE_GNAT_SPECIFIC(thistype) \
+ TYPE_MAIN_TYPE (thistype)->type_specific.gnat_stuff
+#define TYPE_DESCRIPTIVE_TYPE(thistype) \
+ TYPE_GNAT_SPECIFIC (thistype)->descriptive_type
+#define TYPE_CALLING_CONVENTION(thistype) \
+ TYPE_MAIN_TYPE (thistype)->type_specific.func_stuff->calling_convention
+#define TYPE_NO_RETURN(thistype) \
+ TYPE_MAIN_TYPE (thistype)->type_specific.func_stuff->is_noreturn
+#define TYPE_TAIL_CALL_LIST(thistype) \
+ TYPE_MAIN_TYPE (thistype)->type_specific.func_stuff->tail_call_list
+#define TYPE_BASECLASS(thistype, index) ((thistype)->field (index).type ())
+#define TYPE_N_BASECLASSES(thistype) \
+ TYPE_CPLUS_SPECIFIC (thistype)->n_baseclasses
+#define TYPE_BASECLASS_NAME(thistype, index) (thistype->field (index).name ())
+#define TYPE_BASECLASS_BITPOS(thistype, index) \
+ (thistype->field (index).loc_bitpos ())
#define BASETYPE_VIA_PUBLIC(thistype, index) \
- ((!TYPE_FIELD_PRIVATE(thistype, index)) && (!TYPE_FIELD_PROTECTED(thistype, index)))
+ ((!TYPE_FIELD_PRIVATE (thistype, index)) \
+ && (!TYPE_FIELD_PROTECTED (thistype, index)))
#define TYPE_CPLUS_DYNAMIC(thistype) TYPE_CPLUS_SPECIFIC (thistype)->is_dynamic
-#define BASETYPE_VIA_VIRTUAL(thistype, index) \
- (TYPE_CPLUS_SPECIFIC(thistype)->virtual_field_bits == NULL ? 0 \
- : B_TST(TYPE_CPLUS_SPECIFIC(thistype)->virtual_field_bits, (index)))
+#define BASETYPE_VIA_VIRTUAL(thistype, index) \
+ (TYPE_CPLUS_SPECIFIC (thistype)->virtual_field_bits == NULL \
+ ? 0 \
+ : B_TST (TYPE_CPLUS_SPECIFIC (thistype)->virtual_field_bits, (index)))
#define FIELD_ARTIFICIAL(thisfld) ((thisfld).artificial)
#define FIELD_BITSIZE(thisfld) ((thisfld).bitsize)
-#define TYPE_FIELD_ARTIFICIAL(thistype, n) FIELD_ARTIFICIAL((thistype)->field (n))
-#define TYPE_FIELD_BITSIZE(thistype, n) FIELD_BITSIZE((thistype)->field (n))
-#define TYPE_FIELD_PACKED(thistype, n) (FIELD_BITSIZE((thistype)->field (n))!=0)
+#define TYPE_FIELD_ARTIFICIAL(thistype, n) \
+ FIELD_ARTIFICIAL ((thistype)->field (n))
+#define TYPE_FIELD_BITSIZE(thistype, n) FIELD_BITSIZE ((thistype)->field (n))
+#define TYPE_FIELD_PACKED(thistype, n) \
+ (FIELD_BITSIZE ((thistype)->field (n)) != 0)
#define TYPE_FIELD_PRIVATE_BITS(thistype) \
- TYPE_CPLUS_SPECIFIC(thistype)->private_field_bits
+ TYPE_CPLUS_SPECIFIC (thistype)->private_field_bits
#define TYPE_FIELD_PROTECTED_BITS(thistype) \
- TYPE_CPLUS_SPECIFIC(thistype)->protected_field_bits
+ TYPE_CPLUS_SPECIFIC (thistype)->protected_field_bits
#define TYPE_FIELD_IGNORE_BITS(thistype) \
- TYPE_CPLUS_SPECIFIC(thistype)->ignore_field_bits
+ TYPE_CPLUS_SPECIFIC (thistype)->ignore_field_bits
#define TYPE_FIELD_VIRTUAL_BITS(thistype) \
- TYPE_CPLUS_SPECIFIC(thistype)->virtual_field_bits
+ TYPE_CPLUS_SPECIFIC (thistype)->virtual_field_bits
#define SET_TYPE_FIELD_PRIVATE(thistype, n) \
- B_SET (TYPE_CPLUS_SPECIFIC(thistype)->private_field_bits, (n))
+ B_SET (TYPE_CPLUS_SPECIFIC (thistype)->private_field_bits, (n))
#define SET_TYPE_FIELD_PROTECTED(thistype, n) \
- B_SET (TYPE_CPLUS_SPECIFIC(thistype)->protected_field_bits, (n))
+ B_SET (TYPE_CPLUS_SPECIFIC (thistype)->protected_field_bits, (n))
#define SET_TYPE_FIELD_IGNORE(thistype, n) \
- B_SET (TYPE_CPLUS_SPECIFIC(thistype)->ignore_field_bits, (n))
+ B_SET (TYPE_CPLUS_SPECIFIC (thistype)->ignore_field_bits, (n))
#define SET_TYPE_FIELD_VIRTUAL(thistype, n) \
- B_SET (TYPE_CPLUS_SPECIFIC(thistype)->virtual_field_bits, (n))
-#define TYPE_FIELD_PRIVATE(thistype, n) \
- (TYPE_CPLUS_SPECIFIC(thistype)->private_field_bits == NULL ? 0 \
- : B_TST(TYPE_CPLUS_SPECIFIC(thistype)->private_field_bits, (n)))
-#define TYPE_FIELD_PROTECTED(thistype, n) \
- (TYPE_CPLUS_SPECIFIC(thistype)->protected_field_bits == NULL ? 0 \
- : B_TST(TYPE_CPLUS_SPECIFIC(thistype)->protected_field_bits, (n)))
-#define TYPE_FIELD_IGNORE(thistype, n) \
- (TYPE_CPLUS_SPECIFIC(thistype)->ignore_field_bits == NULL ? 0 \
- : B_TST(TYPE_CPLUS_SPECIFIC(thistype)->ignore_field_bits, (n)))
-#define TYPE_FIELD_VIRTUAL(thistype, n) \
- (TYPE_CPLUS_SPECIFIC(thistype)->virtual_field_bits == NULL ? 0 \
- : B_TST(TYPE_CPLUS_SPECIFIC(thistype)->virtual_field_bits, (n)))
-
-#define TYPE_FN_FIELDLISTS(thistype) TYPE_CPLUS_SPECIFIC(thistype)->fn_fieldlists
-#define TYPE_FN_FIELDLIST(thistype, n) TYPE_CPLUS_SPECIFIC(thistype)->fn_fieldlists[n]
-#define TYPE_FN_FIELDLIST1(thistype, n) TYPE_CPLUS_SPECIFIC(thistype)->fn_fieldlists[n].fn_fields
-#define TYPE_FN_FIELDLIST_NAME(thistype, n) TYPE_CPLUS_SPECIFIC(thistype)->fn_fieldlists[n].name
-#define TYPE_FN_FIELDLIST_LENGTH(thistype, n) TYPE_CPLUS_SPECIFIC(thistype)->fn_fieldlists[n].length
+ B_SET (TYPE_CPLUS_SPECIFIC (thistype)->virtual_field_bits, (n))
+#define TYPE_FIELD_PRIVATE(thistype, n) \
+ (TYPE_CPLUS_SPECIFIC (thistype)->private_field_bits == NULL \
+ ? 0 \
+ : B_TST (TYPE_CPLUS_SPECIFIC (thistype)->private_field_bits, (n)))
+#define TYPE_FIELD_PROTECTED(thistype, n) \
+ (TYPE_CPLUS_SPECIFIC (thistype)->protected_field_bits == NULL \
+ ? 0 \
+ : B_TST (TYPE_CPLUS_SPECIFIC (thistype)->protected_field_bits, (n)))
+#define TYPE_FIELD_IGNORE(thistype, n) \
+ (TYPE_CPLUS_SPECIFIC (thistype)->ignore_field_bits == NULL \
+ ? 0 \
+ : B_TST (TYPE_CPLUS_SPECIFIC (thistype)->ignore_field_bits, (n)))
+#define TYPE_FIELD_VIRTUAL(thistype, n) \
+ (TYPE_CPLUS_SPECIFIC (thistype)->virtual_field_bits == NULL \
+ ? 0 \
+ : B_TST (TYPE_CPLUS_SPECIFIC (thistype)->virtual_field_bits, (n)))
+
+#define TYPE_FN_FIELDLISTS(thistype) \
+ TYPE_CPLUS_SPECIFIC (thistype)->fn_fieldlists
+#define TYPE_FN_FIELDLIST(thistype, n) \
+ TYPE_CPLUS_SPECIFIC (thistype)->fn_fieldlists[n]
+#define TYPE_FN_FIELDLIST1(thistype, n) \
+ TYPE_CPLUS_SPECIFIC (thistype)->fn_fieldlists[n].fn_fields
+#define TYPE_FN_FIELDLIST_NAME(thistype, n) \
+ TYPE_CPLUS_SPECIFIC (thistype)->fn_fieldlists[n].name
+#define TYPE_FN_FIELDLIST_LENGTH(thistype, n) \
+ TYPE_CPLUS_SPECIFIC (thistype)->fn_fieldlists[n].length
#define TYPE_N_TEMPLATE_ARGUMENTS(thistype) \
TYPE_CPLUS_SPECIFIC (thistype)->n_template_arguments
@@ -1948,9 +1880,10 @@ extern void set_type_vptr_basetype (struct type *, struct type *);
#define TYPE_FN_FIELD_STUB(thisfn, n) ((thisfn)[n].is_stub)
#define TYPE_FN_FIELD_CONSTRUCTOR(thisfn, n) ((thisfn)[n].is_constructor)
#define TYPE_FN_FIELD_FCONTEXT(thisfn, n) ((thisfn)[n].fcontext)
-#define TYPE_FN_FIELD_VOFFSET(thisfn, n) ((thisfn)[n].voffset-2)
+#define TYPE_FN_FIELD_VOFFSET(thisfn, n) ((thisfn)[n].voffset - 2)
#define TYPE_FN_FIELD_VIRTUAL_P(thisfn, n) ((thisfn)[n].voffset > 1)
-#define TYPE_FN_FIELD_STATIC_P(thisfn, n) ((thisfn)[n].voffset == VOFFSET_STATIC)
+#define TYPE_FN_FIELD_STATIC_P(thisfn, n) \
+ ((thisfn)[n].voffset == VOFFSET_STATIC)
#define TYPE_FN_FIELD_DEFAULTED(thisfn, n) ((thisfn)[n].defaulted)
#define TYPE_FN_FIELD_DELETED(thisfn, n) ((thisfn)[n].is_deleted)
@@ -1967,10 +1900,10 @@ extern void set_type_vptr_basetype (struct type *, struct type *);
TYPE_CPLUS_SPECIFIC (thistype)->typedef_field_count
#define TYPE_TYPEDEF_FIELD_PROTECTED(thistype, n) \
TYPE_TYPEDEF_FIELD (thistype, n).is_protected
-#define TYPE_TYPEDEF_FIELD_PRIVATE(thistype, n) \
+#define TYPE_TYPEDEF_FIELD_PRIVATE(thistype, n) \
TYPE_TYPEDEF_FIELD (thistype, n).is_private
-#define TYPE_NESTED_TYPES_ARRAY(thistype) \
+#define TYPE_NESTED_TYPES_ARRAY(thistype) \
TYPE_CPLUS_SPECIFIC (thistype)->nested_types
#define TYPE_NESTED_TYPES_FIELD(thistype, n) \
TYPE_CPLUS_SPECIFIC (thistype)->nested_types[n]
@@ -1982,28 +1915,27 @@ extern void set_type_vptr_basetype (struct type *, struct type *);
TYPE_CPLUS_SPECIFIC (thistype)->nested_types_count
#define TYPE_NESTED_TYPES_FIELD_PROTECTED(thistype, n) \
TYPE_NESTED_TYPES_FIELD (thistype, n).is_protected
-#define TYPE_NESTED_TYPES_FIELD_PRIVATE(thistype, n) \
+#define TYPE_NESTED_TYPES_FIELD_PRIVATE(thistype, n) \
TYPE_NESTED_TYPES_FIELD (thistype, n).is_private
-#define TYPE_IS_OPAQUE(thistype) \
- ((((thistype)->code () == TYPE_CODE_STRUCT) \
- || ((thistype)->code () == TYPE_CODE_UNION)) \
- && ((thistype)->num_fields () == 0) \
- && (!HAVE_CPLUS_STRUCT (thistype) \
- || TYPE_NFN_FIELDS (thistype) == 0) \
+#define TYPE_IS_OPAQUE(thistype) \
+ ((((thistype)->code () == TYPE_CODE_STRUCT) \
+ || ((thistype)->code () == TYPE_CODE_UNION)) \
+ && ((thistype)->num_fields () == 0) \
+ && (!HAVE_CPLUS_STRUCT (thistype) || TYPE_NFN_FIELDS (thistype) == 0) \
&& ((thistype)->is_stub () || !(thistype)->stub_is_supported ()))
/* * A helper macro that returns the name of a type or "unnamed type"
if the type has no name. */
#define TYPE_SAFE_NAME(type) \
- (type->name () != nullptr ? type->name () : _("<unnamed type>"))
+ (type->name () != nullptr ? type->name () : _ ("<unnamed type>"))
/* * A helper macro that returns the name of an error type. If the
type has a name, it is used; otherwise, a default is used. */
#define TYPE_ERROR_NAME(type) \
- (type->name () ? type->name () : _("<error type>"))
+ (type->name () ? type->name () : _ ("<error type>"))
/* Given TYPE, return its floatformat. */
const struct floatformat *floatformat_from_type (const struct type *type);
@@ -2144,20 +2076,22 @@ struct objfile_type
/* * Return the type table for the specified objfile. */
extern const struct objfile_type *objfile_type (struct objfile *objfile);
-
+
/* Explicit floating-point formats. See "floatformat.h". */
extern const struct floatformat *floatformats_ieee_half[BFD_ENDIAN_UNKNOWN];
extern const struct floatformat *floatformats_ieee_single[BFD_ENDIAN_UNKNOWN];
extern const struct floatformat *floatformats_ieee_double[BFD_ENDIAN_UNKNOWN];
extern const struct floatformat *floatformats_ieee_quad[BFD_ENDIAN_UNKNOWN];
-extern const struct floatformat *floatformats_ieee_double_littlebyte_bigword[BFD_ENDIAN_UNKNOWN];
+extern const struct floatformat
+ *floatformats_ieee_double_littlebyte_bigword[BFD_ENDIAN_UNKNOWN];
extern const struct floatformat *floatformats_i387_ext[BFD_ENDIAN_UNKNOWN];
extern const struct floatformat *floatformats_m68881_ext[BFD_ENDIAN_UNKNOWN];
extern const struct floatformat *floatformats_arm_ext[BFD_ENDIAN_UNKNOWN];
extern const struct floatformat *floatformats_ia64_spill[BFD_ENDIAN_UNKNOWN];
extern const struct floatformat *floatformats_vax_f[BFD_ENDIAN_UNKNOWN];
extern const struct floatformat *floatformats_vax_d[BFD_ENDIAN_UNKNOWN];
-extern const struct floatformat *floatformats_ibm_long_double[BFD_ENDIAN_UNKNOWN];
+extern const struct floatformat
+ *floatformats_ibm_long_double[BFD_ENDIAN_UNKNOWN];
extern const struct floatformat *floatformats_bfloat16[BFD_ENDIAN_UNKNOWN];
/* Allocate space for storing data associated with a particular
@@ -2174,16 +2108,15 @@ extern const struct floatformat *floatformats_bfloat16[BFD_ENDIAN_UNKNOWN];
should call xmalloc directly, and ensure the memory is correctly freed
when it is no longer needed. */
-#define TYPE_ALLOC(t,size) \
- (obstack_alloc (((t)->is_objfile_owned () \
- ? &((t)->objfile_owner ()->objfile_obstack) \
- : gdbarch_obstack ((t)->arch_owner ())), \
+#define TYPE_ALLOC(t, size) \
+ (obstack_alloc (((t)->is_objfile_owned () \
+ ? &((t)->objfile_owner ()->objfile_obstack) \
+ : gdbarch_obstack ((t)->arch_owner ())), \
size))
-
/* See comment on TYPE_ALLOC. */
-#define TYPE_ZALLOC(t,size) (memset (TYPE_ALLOC (t, size), 0, size))
+#define TYPE_ZALLOC(t, size) (memset (TYPE_ALLOC (t, size), 0, size))
/* Use alloc_type to allocate a type owned by an objfile. Use
alloc_type_arch to allocate a type owned by an architecture. Use
@@ -2247,24 +2180,26 @@ extern struct type *arch_pointer_type (struct gdbarch *, int, const char *,
field packed against the previous. */
extern struct type *arch_composite_type (struct gdbarch *gdbarch,
- const char *name, enum type_code code);
+ const char *name,
+ enum type_code code);
extern void append_composite_type_field (struct type *t, const char *name,
struct type *field);
extern void append_composite_type_field_aligned (struct type *t,
const char *name,
struct type *field,
int alignment);
-struct field *append_composite_type_field_raw (struct type *t, const char *name,
+struct field *append_composite_type_field_raw (struct type *t,
+ const char *name,
struct type *field);
/* Helper functions to construct a bit flags type. An initially empty
type is created using arch_flag_type(). Flags are then added using
append_flag_type_field() and append_flag_type_flag(). */
-extern struct type *arch_flags_type (struct gdbarch *gdbarch,
- const char *name, int bit);
-extern void append_flags_type_field (struct type *type,
- int start_bitpos, int nr_bits,
- struct type *field_type, const char *name);
+extern struct type *arch_flags_type (struct gdbarch *gdbarch, const char *name,
+ int bit);
+extern void append_flags_type_field (struct type *type, int start_bitpos,
+ int nr_bits, struct type *field_type,
+ const char *name);
extern void append_flags_type_flag (struct type *type, int bitpos,
const char *name);
@@ -2275,7 +2210,6 @@ extern struct type *lookup_reference_type (struct type *, enum type_code);
extern struct type *lookup_lvalue_reference_type (struct type *);
extern struct type *lookup_rvalue_reference_type (struct type *);
-
extern struct type *make_reference_type (struct type *, struct type **,
enum type_code);
@@ -2289,14 +2223,16 @@ extern struct type *make_atomic_type (struct type *);
extern void replace_type (struct type *, struct type *);
-extern type_instance_flags address_space_name_to_type_instance_flags
- (struct gdbarch *, const char *);
+extern type_instance_flags
+address_space_name_to_type_instance_flags (struct gdbarch *, const char *);
-extern const char *address_space_type_instance_flags_to_name
- (struct gdbarch *, type_instance_flags);
+extern const char *
+address_space_type_instance_flags_to_name (struct gdbarch *,
+ type_instance_flags);
-extern struct type *make_type_with_address_space
- (struct type *type, type_instance_flags space_identifier);
+extern struct type *
+make_type_with_address_space (struct type *type,
+ type_instance_flags space_identifier);
extern struct type *lookup_memberptr_type (struct type *, struct type *);
@@ -2363,32 +2299,28 @@ extern struct type *make_function_type (struct type *, struct type **);
extern struct type *lookup_function_type (struct type *);
-extern struct type *lookup_function_type_with_arguments (struct type *,
- int,
+extern struct type *lookup_function_type_with_arguments (struct type *, int,
struct type **);
extern struct type *create_static_range_type (struct type *, struct type *,
LONGEST, LONGEST);
-
-extern struct type *create_array_type_with_stride
- (struct type *, struct type *, struct type *,
- struct dynamic_prop *, unsigned int);
+extern struct type *
+create_array_type_with_stride (struct type *, struct type *, struct type *,
+ struct dynamic_prop *, unsigned int);
extern struct type *create_range_type (struct type *, struct type *,
const struct dynamic_prop *,
- const struct dynamic_prop *,
- LONGEST);
+ const struct dynamic_prop *, LONGEST);
/* Like CREATE_RANGE_TYPE but also sets up a stride. When BYTE_STRIDE_P
is true the value in STRIDE is a byte stride, otherwise STRIDE is a bit
stride. */
-extern struct type * create_range_type_with_stride
- (struct type *result_type, struct type *index_type,
- const struct dynamic_prop *low_bound,
- const struct dynamic_prop *high_bound, LONGEST bias,
- const struct dynamic_prop *stride, bool byte_stride_p);
+extern struct type *create_range_type_with_stride (
+ struct type *result_type, struct type *index_type,
+ const struct dynamic_prop *low_bound, const struct dynamic_prop *high_bound,
+ LONGEST bias, const struct dynamic_prop *stride, bool byte_stride_p);
extern struct type *create_array_type (struct type *, struct type *,
struct type *);
@@ -2423,9 +2355,9 @@ extern CORE_ADDR get_pointer_type_max (struct type *);
have a different type when resolved (depending on the contents of
memory). In this situation, 'is_dynamic_type' will still return
true for the return value of this function. */
-extern struct type *resolve_dynamic_type
- (struct type *type, gdb::array_view<const gdb_byte> valaddr,
- CORE_ADDR addr);
+extern struct type *
+resolve_dynamic_type (struct type *type,
+ gdb::array_view<const gdb_byte> valaddr, CORE_ADDR addr);
/* * Predicate if the type has dynamic values, which are not resolved yet.
See the caveat in 'resolve_dynamic_type' to understand a scenario
@@ -2545,8 +2477,7 @@ extern const struct rank NS_INTEGER_POINTER_CONVERSION_BADNESS;
extern struct rank sum_ranks (struct rank a, struct rank b);
extern int compare_ranks (struct rank a, struct rank b);
-extern int compare_badness (const badness_vector &,
- const badness_vector &);
+extern int compare_badness (const badness_vector &, const badness_vector &);
extern badness_vector rank_function (gdb::array_view<type *> parms,
gdb::array_view<value *> args);
@@ -2561,8 +2492,8 @@ extern int field_is_static (struct field *);
/* printcmd.c */
extern void print_scalar_formatted (const gdb_byte *, struct type *,
- const struct value_print_options *,
- int, struct ui_file *);
+ const struct value_print_options *, int,
+ struct ui_file *);
extern int can_dereference (struct type *);
diff --git a/gdb/glibc-tdep.c b/gdb/glibc-tdep.c
index 69b091e7e1b..9282c029219 100644
--- a/gdb/glibc-tdep.c
+++ b/gdb/glibc-tdep.c
@@ -53,7 +53,7 @@ glibc_skip_solib_resolver (struct gdbarch *gdbarch, CORE_ADDR pc)
of GNU/Linux will provide a portable, efficient interface for
debugging programs that use shared libraries. */
- struct bound_minimal_symbol resolver
+ struct bound_minimal_symbol resolver
= lookup_bound_minimal_symbol ("_dl_runtime_resolve");
if (resolver.minsym)
@@ -61,9 +61,9 @@ glibc_skip_solib_resolver (struct gdbarch *gdbarch, CORE_ADDR pc)
/* The dynamic linker began using this name in early 2005. */
struct bound_minimal_symbol fixup
= lookup_minimal_symbol ("_dl_fixup", NULL, resolver.objfile);
-
+
/* This is the name used in older versions. */
- if (! fixup.minsym)
+ if (!fixup.minsym)
fixup = lookup_minimal_symbol ("fixup", NULL, resolver.objfile);
if (fixup.minsym && fixup.value_address () == pc)
@@ -71,4 +71,4 @@ glibc_skip_solib_resolver (struct gdbarch *gdbarch, CORE_ADDR pc)
}
return 0;
-}
+}
diff --git a/gdb/gmp-utils.c b/gdb/gmp-utils.c
index b9c9b495398..f7edb675305 100644
--- a/gdb/gmp-utils.c
+++ b/gdb/gmp-utils.c
@@ -68,15 +68,15 @@ void
gdb_mpz::write (gdb::array_view<gdb_byte> buf, enum bfd_endian byte_order,
bool unsigned_p) const
{
- this->safe_export
- (buf, byte_order == BFD_ENDIAN_BIG ? 1 : -1 /* endian */, unsigned_p);
+ this->safe_export (buf, byte_order == BFD_ENDIAN_BIG ? 1 : -1 /* endian */,
+ unsigned_p);
}
/* See gmp-utils.h. */
void
-gdb_mpz::safe_export (gdb::array_view<gdb_byte> buf,
- int endian, bool unsigned_p) const
+gdb_mpz::safe_export (gdb::array_view<gdb_byte> buf, int endian,
+ bool unsigned_p) const
{
gdb_assert (buf.size () > 0);
@@ -112,12 +112,10 @@ gdb_mpz::safe_export (gdb::array_view<gdb_byte> buf,
}
if (mpz_cmp (val, lo.val) < 0 || mpz_cmp (val, hi.val) > 0)
- error (_("Cannot export value %s as %zu-bits %s integer"
- " (must be between %s and %s)"),
- this->str ().c_str (),
- max_usable_bits,
- unsigned_p ? _("unsigned") : _("signed"),
- lo.str ().c_str (),
+ error (_ ("Cannot export value %s as %zu-bits %s integer"
+ " (must be between %s and %s)"),
+ this->str ().c_str (), max_usable_bits,
+ unsigned_p ? _ ("unsigned") : _ ("signed"), lo.str ().c_str (),
hi.str ().c_str ());
gdb_mpz exported_val (val);
@@ -144,9 +142,9 @@ gdb_mpz::safe_export (gdb::array_view<gdb_byte> buf,
copy the data over to BUF. */
size_t word_countp;
- gdb::unique_xmalloc_ptr<void> exported
- (mpz_export (NULL, &word_countp, -1 /* order */, buf.size () /* size */,
- endian, 0 /* nails */, exported_val.val));
+ gdb::unique_xmalloc_ptr<void> exported (
+ mpz_export (NULL, &word_countp, -1 /* order */, buf.size () /* size */,
+ endian, 0 /* nails */, exported_val.val));
gdb_assert (word_countp == 1);
@@ -169,8 +167,8 @@ gdb_mpq::get_rounded () const
towards zero. */
gdb_mpz quotient, remainder;
- mpz_fdiv_qr (quotient.val, remainder.val,
- mpq_numref (abs_val.val), mpq_denref (abs_val.val));
+ mpz_fdiv_qr (quotient.val, remainder.val, mpq_numref (abs_val.val),
+ mpq_denref (abs_val.val));
/* Multiply the remainder by 2, and see if it is greater or equal
to abs_val's denominator. If yes, round to the next integer. */
diff --git a/gdb/gmp-utils.h b/gdb/gmp-utils.h
index 0e57471b2ef..9c7583557b5 100644
--- a/gdb/gmp-utils.h
+++ b/gdb/gmp-utils.h
@@ -71,7 +71,6 @@ struct gdb_mpz
mpz_swap (val, from.val);
}
-
gdb_mpz &operator= (const gdb_mpz &from)
{
mpz_set (val, from.val);
@@ -94,7 +93,8 @@ struct gdb_mpz
/* Convert VAL to an integer of the given type.
The return type can signed or unsigned, with no size restriction. */
- template<typename T> T as_integer () const;
+ template<typename T>
+ T as_integer () const;
/* Set VAL by importing the number stored in the byte array (BUF),
using the given BYTE_ORDER. The size of the data to read is
@@ -120,7 +120,8 @@ struct gdb_mpz
private:
/* Helper template for constructor and operator=. */
- template<typename T> void set (T src);
+ template<typename T>
+ void set (T src);
/* Low-level function to export VAL into BUF as a number whose byte size
is the size of BUF.
@@ -137,8 +138,8 @@ private:
An error is raised if BUF is not large enough to contain the value
being exported. */
- void safe_export (gdb::array_view<gdb_byte> buf,
- int endian, bool unsigned_p) const;
+ void safe_export (gdb::array_view<gdb_byte> buf, int endian,
+ bool unsigned_p) const;
};
/* A class to make it easier to use GMP's mpq_t values within GDB. */
@@ -255,9 +256,8 @@ template<typename T>
void
gdb_mpz::set (T src)
{
- mpz_import (val, 1 /* count */, -1 /* order */,
- sizeof (T) /* size */, 0 /* endian (0 = native) */,
- 0 /* nails */, &src /* op */);
+ mpz_import (val, 1 /* count */, -1 /* order */, sizeof (T) /* size */,
+ 0 /* endian (0 = native) */, 0 /* nails */, &src /* op */);
if (std::is_signed<T>::value && src < 0)
{
/* mpz_import does not handle the sign, so our value was imported
@@ -278,7 +278,7 @@ gdb_mpz::as_integer () const
{
T result;
- this->safe_export ({(gdb_byte *) &result, sizeof (result)},
+ this->safe_export ({ (gdb_byte *) &result, sizeof (result) },
0 /* endian (0 = native) */,
!std::is_signed<T>::value /* unsigned_p */);
diff --git a/gdb/gnu-nat.c b/gdb/gnu-nat.c
index 004cacc8180..f9e545bb7a6 100644
--- a/gdb/gnu-nat.c
+++ b/gdb/gnu-nat.c
@@ -105,128 +105,131 @@ bool gnu_debug_flag = false;
static struct inf *make_inf ();
-#define inf_debug(_inf, msg, args...) \
- do { struct inf *__inf = (_inf); \
- debug ("{inf %d %s}: " msg, __inf->pid, \
- host_address_to_string (__inf) , ##args); } while (0)
+#define inf_debug(_inf, msg, args...) \
+ do \
+ { \
+ struct inf *__inf = (_inf); \
+ debug ("{inf %d %s}: " msg, __inf->pid, host_address_to_string (__inf), \
+ ##args); \
+ } \
+ while (0)
/* Evaluate RPC_EXPR in a scope with the variables MSGPORT and REFPORT bound
to INF's msg port and task port respectively. If it has no msg port,
EIEIO is returned. INF must refer to a running process! */
-#define INF_MSGPORT_RPC(inf, rpc_expr) \
+#define INF_MSGPORT_RPC(inf, rpc_expr) \
HURD_MSGPORT_RPC (proc_getmsgport (proc_server, inf->pid, &msgport), \
- (refport = inf->task->port, 0), 0, \
+ (refport = inf->task->port, 0), 0, \
msgport ? (rpc_expr) : EIEIO)
/* Like INF_MSGPORT_RPC, but will also resume the signal thread to ensure
there's someone around to deal with the RPC (and resuspend things
afterwards). This effects INF's threads' resume_sc count. */
-#define INF_RESUME_MSGPORT_RPC(inf, rpc_expr) \
- (inf_set_threads_resume_sc_for_signal_thread (inf) \
- ? ({ kern_return_t __e; \
- inf_resume (inf); \
- __e = INF_MSGPORT_RPC (inf, rpc_expr); \
- inf_suspend (inf); \
- __e; }) \
- : EIEIO)
-
-
+#define INF_RESUME_MSGPORT_RPC(inf, rpc_expr) \
+ (inf_set_threads_resume_sc_for_signal_thread (inf) ? ({ \
+ kern_return_t __e; \
+ inf_resume (inf); \
+ __e = INF_MSGPORT_RPC (inf, rpc_expr); \
+ inf_suspend (inf); \
+ __e; \
+ }) \
+ : EIEIO)
+
/* The state passed by an exception message. */
struct exc_state
- {
- int exception; /* The exception code. */
- int code, subcode;
- mach_port_t handler; /* The real exception port to handle this. */
- mach_port_t reply; /* The reply port from the exception call. */
- };
+{
+ int exception; /* The exception code. */
+ int code, subcode;
+ mach_port_t handler; /* The real exception port to handle this. */
+ mach_port_t reply; /* The reply port from the exception call. */
+};
/* The results of the last wait an inf did. */
struct inf_wait
- {
- struct target_waitstatus status; /* The status returned to gdb. */
- struct exc_state exc; /* The exception that caused us to return. */
- struct proc *thread; /* The thread in question. */
- int suppress; /* Something trivial happened. */
- };
+{
+ struct target_waitstatus status; /* The status returned to gdb. */
+ struct exc_state exc; /* The exception that caused us to return. */
+ struct proc *thread; /* The thread in question. */
+ int suppress; /* Something trivial happened. */
+};
/* Further Hurd-specific state of an inferior. */
struct inf
- {
- /* Fields describing the current inferior. */
+{
+ /* Fields describing the current inferior. */
- struct proc *task; /* The mach task. */
- struct proc *threads; /* A linked list of all threads in TASK. */
+ struct proc *task; /* The mach task. */
+ struct proc *threads; /* A linked list of all threads in TASK. */
- /* True if THREADS needn't be validated by querying the task. We
+ /* True if THREADS needn't be validated by querying the task. We
assume that we and the task in question are the only ones
frobbing the thread list, so as long as we don't let any code
run, we don't have to worry about THREADS changing. */
- int threads_up_to_date;
+ int threads_up_to_date;
- pid_t pid; /* The real system PID. */
+ pid_t pid; /* The real system PID. */
- struct inf_wait wait; /* What to return from target_wait. */
+ struct inf_wait wait; /* What to return from target_wait. */
- /* One thread proc in INF may be in `single-stepping mode'. This
+ /* One thread proc in INF may be in `single-stepping mode'. This
is it. */
- struct proc *step_thread;
+ struct proc *step_thread;
- /* The thread we think is the signal thread. */
- struct proc *signal_thread;
+ /* The thread we think is the signal thread. */
+ struct proc *signal_thread;
- mach_port_t event_port; /* Where we receive various msgs. */
+ mach_port_t event_port; /* Where we receive various msgs. */
- /* True if we think at least one thread in the inferior could currently be
+ /* True if we think at least one thread in the inferior could currently be
running. */
- unsigned int running:1;
+ unsigned int running : 1;
- /* True if the process has stopped (in the proc server sense). Note that
+ /* True if the process has stopped (in the proc server sense). Note that
since a proc server `stop' leaves the signal thread running, the inf can
be RUNNING && STOPPED... */
- unsigned int stopped:1;
+ unsigned int stopped : 1;
- /* True if the inferior has no message port. */
- unsigned int nomsg:1;
+ /* True if the inferior has no message port. */
+ unsigned int nomsg : 1;
- /* True if the inferior is traced. */
- unsigned int traced:1;
+ /* True if the inferior is traced. */
+ unsigned int traced : 1;
- /* True if we shouldn't try waiting for the inferior, usually because we
+ /* True if we shouldn't try waiting for the inferior, usually because we
can't for some reason. */
- unsigned int no_wait:1;
+ unsigned int no_wait : 1;
- /* When starting a new inferior, we don't try to validate threads until all
+ /* When starting a new inferior, we don't try to validate threads until all
the proper execs have been done, which this flag states we still
expect to happen. */
- unsigned int pending_execs:1;
+ unsigned int pending_execs : 1;
- /* Fields describing global state. */
+ /* Fields describing global state. */
- /* The task suspend count used when gdb has control. This is normally 1 to
+ /* The task suspend count used when gdb has control. This is normally 1 to
make things easier for us, but sometimes (like when attaching to vital
system servers) it may be desirable to let the task continue to run
(pausing individual threads as necessary). */
- int pause_sc;
+ int pause_sc;
- /* The task suspend count left when detaching from a task. */
- int detach_sc;
+ /* The task suspend count left when detaching from a task. */
+ int detach_sc;
- /* The initial values used for the run_sc and pause_sc of newly discovered
+ /* The initial values used for the run_sc and pause_sc of newly discovered
threads -- see the definition of those fields in struct proc. */
- int default_thread_run_sc;
- int default_thread_pause_sc;
- int default_thread_detach_sc;
+ int default_thread_run_sc;
+ int default_thread_pause_sc;
+ int default_thread_detach_sc;
- /* True if the process should be traced when started/attached. Newly
+ /* True if the process should be traced when started/attached. Newly
started processes *must* be traced at first to exec them properly, but
if this is false, tracing is turned off as soon it has done so. */
- int want_signals;
+ int want_signals;
- /* True if exceptions from the inferior process should be trapped. This
+ /* True if exceptions from the inferior process should be trapped. This
must be on to use breakpoints. */
- int want_exceptions;
- };
-
+ int want_exceptions;
+};
int
__proc_pid (struct proc *proc)
@@ -234,7 +237,6 @@ __proc_pid (struct proc *proc)
return proc->inf->pid;
}
-
/* Update PROC's real suspend count to match it's desired one. Returns true
if we think PROC is now in a runnable state. */
int
@@ -252,8 +254,9 @@ gnu_nat_target::proc_update_sc (struct proc *proc)
{
gdb_assert (proc_is_thread (proc));
proc_debug (proc, "storing back changed thread state");
- err = thread_set_state (proc->port, THREAD_STATE_FLAVOR,
- (thread_state_t) &proc->state, THREAD_STATE_SIZE);
+ err
+ = thread_set_state (proc->port, THREAD_STATE_FLAVOR,
+ (thread_state_t) &proc->state, THREAD_STATE_SIZE);
if (!err)
proc->state_changed = 0;
}
@@ -298,7 +301,6 @@ gnu_nat_target::proc_update_sc (struct proc *proc)
return running;
}
-
/* Thread_abort is called on PROC if needed. PROC must be a thread proc.
If PROC is deemed `precious', then nothing is done unless FORCE is true.
In particular, a thread is precious if it's running (in which case forcing
@@ -318,7 +320,7 @@ gnu_nat_target::proc_abort (struct proc *proc, int force)
proc->sc = 1;
inf_update_suspends (proc->inf);
running = 0;
- warning (_("Stopped %s."), proc_string (proc));
+ warning (_ ("Stopped %s."), proc_string (proc));
}
else if (proc == inf->wait.thread && inf->wait.exc.reply && !force)
/* An exception is pending on PROC, which don't mess with. */
@@ -357,9 +359,9 @@ gnu_nat_target::proc_get_state (struct proc *proc, int will_modify)
if (!proc->state_valid)
{
mach_msg_type_number_t state_size = THREAD_STATE_SIZE;
- kern_return_t err =
- thread_get_state (proc->port, THREAD_STATE_FLAVOR,
- (thread_state_t) &proc->state, &state_size);
+ kern_return_t err
+ = thread_get_state (proc->port, THREAD_STATE_FLAVOR,
+ (thread_state_t) &proc->state, &state_size);
proc_debug (proc, "getting thread state");
proc->state_valid = !err;
@@ -375,10 +377,9 @@ gnu_nat_target::proc_get_state (struct proc *proc, int will_modify)
return 0;
}
-
/* Set PORT to PROC's exception port. */
kern_return_t
-gnu_nat_target::proc_get_exception_port (struct proc * proc, mach_port_t * port)
+gnu_nat_target::proc_get_exception_port (struct proc *proc, mach_port_t *port)
{
if (proc_is_task (proc))
return task_get_exception_port (proc->port, port);
@@ -388,7 +389,7 @@ gnu_nat_target::proc_get_exception_port (struct proc * proc, mach_port_t * port)
/* Set PROC's exception port to PORT. */
kern_return_t
-gnu_nat_target::proc_set_exception_port (struct proc * proc, mach_port_t port)
+gnu_nat_target::proc_set_exception_port (struct proc *proc, mach_port_t port)
{
proc_debug (proc, "setting exception port: %lu", port);
if (proc_is_task (proc))
@@ -456,7 +457,7 @@ gnu_nat_target::proc_steal_exc_port (struct proc *proc, mach_port_t exc_port)
if (!err)
proc->exc_port = exc_port;
else
- warning (_("Error setting exception port for %s: %s"),
+ warning (_ ("Error setting exception port for %s: %s"),
proc_string (proc), safe_strerror (err));
}
}
@@ -486,12 +487,11 @@ gnu_nat_target::proc_restore_exc_port (struct proc *proc)
if (!err)
proc->exc_port = MACH_PORT_NULL;
else
- warning (_("Error setting exception port for %s: %s"),
+ warning (_ ("Error setting exception port for %s: %s"),
proc_string (proc), safe_strerror (err));
}
}
-
/* Turns hardware tracing in PROC on or off when SET is true or false,
respectively. Returns true on success. */
int
@@ -500,7 +500,7 @@ gnu_nat_target::proc_trace (struct proc *proc, int set)
thread_state_t state = proc_get_state (proc, 1);
if (!state)
- return 0; /* The thread must be dead. */
+ return 0; /* The thread must be dead. */
proc_debug (proc, "tracing %s", set ? "on" : "off");
@@ -518,7 +518,6 @@ gnu_nat_target::proc_trace (struct proc *proc, int set)
return 1;
}
-
/* A variable from which to assign new TIDs. */
static int next_thread_id = 1;
@@ -556,15 +555,14 @@ gnu_nat_target::make_proc (struct inf *inf, mach_port_t port, int tid)
proc_debug (proc, "is new");
/* Get notified when things die. */
- err =
- mach_port_request_notification (mach_task_self (), port,
- MACH_NOTIFY_DEAD_NAME, 1,
- inf->event_port,
- MACH_MSG_TYPE_MAKE_SEND_ONCE,
- &prev_port);
+ err = mach_port_request_notification (mach_task_self (), port,
+ MACH_NOTIFY_DEAD_NAME, 1,
+ inf->event_port,
+ MACH_MSG_TYPE_MAKE_SEND_ONCE,
+ &prev_port);
if (err)
- warning (_("Couldn't request notification for port %lu: %s"),
- port, safe_strerror (err));
+ warning (_ ("Couldn't request notification for port %lu: %s"), port,
+ safe_strerror (err));
else
{
proc_debug (proc, "notifications to: %lu", inf->event_port);
@@ -622,7 +620,6 @@ gnu_nat_target::_proc_free (struct proc *proc)
return next;
}
-
static struct inf *
make_inf (void)
{
@@ -650,8 +647,8 @@ make_inf (void)
inf->default_thread_run_sc = 0;
inf->default_thread_pause_sc = 0;
inf->default_thread_detach_sc = 0;
- inf->want_signals = 1; /* By default */
- inf->want_exceptions = 1; /* By default */
+ inf->want_signals = 1; /* By default */
+ inf->want_exceptions = 1; /* By default */
return inf;
}
@@ -676,7 +673,6 @@ gnu_nat_target::inf_clear_wait (struct inf *inf)
}
}
-
void
gnu_nat_target::inf_cleanup (struct inf *inf)
{
@@ -710,18 +706,17 @@ gnu_nat_target::inf_startup (struct inf *inf, int pid)
inf_cleanup (inf);
/* Make the port on which we receive all events. */
- err = mach_port_allocate (mach_task_self (),
- MACH_PORT_RIGHT_RECEIVE, &inf->event_port);
+ err = mach_port_allocate (mach_task_self (), MACH_PORT_RIGHT_RECEIVE,
+ &inf->event_port);
if (err)
- error (_("Error allocating event port: %s"), safe_strerror (err));
+ error (_ ("Error allocating event port: %s"), safe_strerror (err));
/* Make a send right for it, so we can easily copy it for other people. */
- mach_port_insert_right (mach_task_self (), inf->event_port,
- inf->event_port, MACH_MSG_TYPE_MAKE_SEND);
+ mach_port_insert_right (mach_task_self (), inf->event_port, inf->event_port,
+ MACH_MSG_TYPE_MAKE_SEND);
inf_set_pid (inf, pid);
}
-
/* Close current process, if any, and attach INF to process PORT. */
void
gnu_nat_target::inf_set_pid (struct inf *inf, pid_t pid)
@@ -738,8 +733,8 @@ gnu_nat_target::inf_set_pid (struct inf *inf, pid_t pid)
kern_return_t err = proc_pid2task (proc_server, pid, &task_port);
if (err)
- error (_("Error getting task for pid %d: %s"),
- pid, safe_strerror (err));
+ error (_ ("Error getting task for pid %d: %s"), pid,
+ safe_strerror (err));
}
inf_debug (inf, "setting task: %lu", task_port);
@@ -750,7 +745,7 @@ gnu_nat_target::inf_set_pid (struct inf *inf, pid_t pid)
if (task && task->port != task_port)
{
inf->task = 0;
- inf_validate_procs (inf); /* Trash all the threads. */
+ inf_validate_procs (inf); /* Trash all the threads. */
_proc_free (task); /* And the task. */
}
@@ -771,7 +766,6 @@ gnu_nat_target::inf_set_pid (struct inf *inf, pid_t pid)
inf->pid = -1;
}
-
/* Validates INF's stopped, nomsg and traced field from the actual
proc server state. Note that the traced field is only updated from
the proc server state if we do not have a message port. If we do
@@ -784,9 +778,9 @@ gnu_nat_target::inf_validate_procinfo (struct inf *inf)
struct procinfo *pi;
mach_msg_type_number_t pi_len = 0;
int info_flags = 0;
- kern_return_t err =
- proc_getprocinfo (proc_server, inf->pid, &info_flags,
- (procinfo_t *) &pi, &pi_len, &noise, &noise_len);
+ kern_return_t err
+ = proc_getprocinfo (proc_server, inf->pid, &info_flags, (procinfo_t *) &pi,
+ &pi_len, &noise, &noise_len);
if (!err)
{
@@ -814,7 +808,7 @@ gnu_nat_target::inf_validate_task_sc (struct inf *inf)
int suspend_count = -1;
kern_return_t err;
- retry:
+retry:
err = proc_getprocinfo (proc_server, inf->pid, &info_flags,
(procinfo_t *) &pi, &pi_len, &noise, &noise_len);
if (err)
@@ -842,10 +836,10 @@ gnu_nat_target::inf_validate_task_sc (struct inf *inf)
if (inf->task->cur_sc < suspend_count)
{
- if (!query (_("Pid %d has an additional task suspend count of %d;"
- " clear it? "), inf->pid,
- suspend_count - inf->task->cur_sc))
- error (_("Additional task suspend count left untouched."));
+ if (!query (_ ("Pid %d has an additional task suspend count of %d;"
+ " clear it? "),
+ inf->pid, suspend_count - inf->task->cur_sc))
+ error (_ ("Additional task suspend count left untouched."));
inf->task->cur_sc = suspend_count;
}
@@ -860,25 +854,24 @@ gnu_nat_target::inf_set_traced (struct inf *inf, int on)
{
if (on == inf->traced)
return;
-
+
if (inf->task && !inf->task->dead)
/* Make it take effect immediately. */
{
sigset_t mask = on ? ~(sigset_t) 0 : 0;
- kern_return_t err =
- INF_RESUME_MSGPORT_RPC (inf, msg_set_init_int (msgport, refport,
- INIT_TRACEMASK, mask));
+ kern_return_t err = INF_RESUME_MSGPORT_RPC (
+ inf, msg_set_init_int (msgport, refport, INIT_TRACEMASK, mask));
if (err == EIEIO)
{
if (on)
- warning (_("Can't modify tracing state for pid %d: %s"),
- inf->pid, "No signal thread");
+ warning (_ ("Can't modify tracing state for pid %d: %s"), inf->pid,
+ "No signal thread");
inf->traced = on;
}
else if (err)
- warning (_("Can't modify tracing state for pid %d: %s"),
- inf->pid, safe_strerror (err));
+ warning (_ ("Can't modify tracing state for pid %d: %s"), inf->pid,
+ safe_strerror (err));
else
inf->traced = on;
}
@@ -886,7 +879,6 @@ gnu_nat_target::inf_set_traced (struct inf *inf, int on)
inf->traced = on;
}
-
/* Makes all the real suspend count deltas of all the procs in INF
match the desired values. Careful to always do thread/task suspend
counts in the safe order. Returns true if at least one thread is
@@ -940,7 +932,6 @@ gnu_nat_target::inf_update_suspends (struct inf *inf)
return 0;
}
-
/* Converts a GDB pid to a struct proc. */
struct proc *
inf_tid_to_thread (struct inf *inf, int tid)
@@ -980,7 +971,6 @@ inf_threads (struct inf *inf, inf_threads_ftype *f, void *arg)
f (thread, arg);
}
-
/* Make INF's list of threads be consistent with reality of TASK. */
void
gnu_nat_target::inf_validate_procs (struct inf *inf)
@@ -1033,7 +1023,7 @@ gnu_nat_target::inf_validate_procs (struct inf *inf)
for (i = search_start, left = num_threads; left; i++, left--)
{
if (i >= num_threads)
- i -= num_threads; /* I wrapped around. */
+ i -= num_threads; /* I wrapped around. */
if (thread->port == threads[i])
/* We already know about this thread. */
{
@@ -1049,7 +1039,7 @@ gnu_nat_target::inf_validate_procs (struct inf *inf)
{
proc_debug (thread, "died!");
thread->port = MACH_PORT_NULL;
- thread = _proc_free (thread); /* THREAD is dead. */
+ thread = _proc_free (thread); /* THREAD is dead. */
if (last)
last->next = thread;
else
@@ -1091,12 +1081,11 @@ gnu_nat_target::inf_validate_procs (struct inf *inf)
}
}
- vm_deallocate (mach_task_self (),
- (vm_address_t) threads, (num_threads * sizeof (thread_t)));
+ vm_deallocate (mach_task_self (), (vm_address_t) threads,
+ (num_threads * sizeof (thread_t)));
}
}
-
/* Makes sure that INF's thread list is synced with the actual process. */
int
inf_update_procs (struct inf *inf)
@@ -1113,7 +1102,8 @@ inf_update_procs (struct inf *inf)
their pause_sc. */
void
gnu_nat_target::inf_set_threads_resume_sc (struct inf *inf,
- struct proc *run_thread, int run_others)
+ struct proc *run_thread,
+ int run_others)
{
struct proc *thread;
@@ -1127,7 +1117,6 @@ gnu_nat_target::inf_set_threads_resume_sc (struct inf *inf,
thread->resume_sc = thread->pause_sc;
}
-
/* Cause INF to continue execution immediately; individual threads may still
be suspended (but their suspend counts will be updated). */
void
@@ -1171,7 +1160,6 @@ gnu_nat_target::inf_suspend (struct inf *inf)
inf_update_suspends (inf);
}
-
/* INF has one thread PROC that is in single-stepping mode. This
function changes it to be PROC, changing any old step_thread to be
a normal one. A PROC of 0 clears any existing value. */
@@ -1197,7 +1185,6 @@ gnu_nat_target::inf_set_step_thread (struct inf *inf, struct proc *thread)
}
}
-
/* Set up the thread resume_sc's so that only the signal thread is running
(plus whatever other thread are set to always run). Returns true if we
did so, or false if we can't find a signal thread. */
@@ -1221,7 +1208,6 @@ inf_update_signal_thread (struct inf *inf)
inf->signal_thread = inf->threads ? inf->threads->next : 0;
}
-
/* Detachs from INF's inferior task, letting it run once again... */
void
gnu_nat_target::inf_detach (struct inf *inf)
@@ -1276,7 +1262,6 @@ gnu_nat_target::inf_attach (struct inf *inf, int pid)
inf_startup (inf, pid);
}
-
/* Makes sure that we've got our exception ports entrenched in the process. */
void
gnu_nat_target::inf_steal_exc_ports (struct inf *inf)
@@ -1285,7 +1270,7 @@ gnu_nat_target::inf_steal_exc_ports (struct inf *inf)
inf_debug (inf, "stealing exception ports");
- inf_set_step_thread (inf, 0); /* The step thread is special. */
+ inf_set_step_thread (inf, 0); /* The step thread is special. */
proc_steal_exc_port (inf->task, inf->event_port);
for (thread = inf->threads; thread; thread = thread->next)
@@ -1300,14 +1285,13 @@ gnu_nat_target::inf_restore_exc_ports (struct inf *inf)
inf_debug (inf, "restoring exception ports");
- inf_set_step_thread (inf, 0); /* The step thread is special. */
+ inf_set_step_thread (inf, 0); /* The step thread is special. */
proc_restore_exc_port (inf->task);
for (thread = inf->threads; thread; thread = thread->next)
proc_restore_exc_port (thread);
}
-
/* Deliver signal SIG to INF. If INF is stopped, delivering a signal, even
signal 0, will continue it. INF is assumed to be in a paused state, and
the resume_sc's of INF's threads may be affected. */
@@ -1327,8 +1311,7 @@ gnu_nat_target::inf_signal (struct inf *inf, enum gdb_signal sig)
struct inf_wait *w = &inf->wait;
if (w->status.kind () == TARGET_WAITKIND_STOPPED
- && w->status.sig () == sig
- && w->thread && !w->thread->aborted)
+ && w->status.sig () == sig && w->thread && !w->thread->aborted)
/* We're passing through the last exception we received. This is
kind of bogus, because exceptions are per-thread whereas gdb
treats signals as per-process. We just forward the exception to
@@ -1337,66 +1320,63 @@ gnu_nat_target::inf_signal (struct inf *inf, enum gdb_signal sig)
{
struct exc_state *e = &w->exc;
- inf_debug (inf, "passing through exception:"
+ inf_debug (inf,
+ "passing through exception:"
" task = %lu, thread = %lu, exc = %d"
", code = %d, subcode = %d",
- w->thread->port, inf->task->port,
- e->exception, e->code, e->subcode);
- err =
- exception_raise_request (e->handler,
- e->reply, MACH_MSG_TYPE_MOVE_SEND_ONCE,
- w->thread->port, inf->task->port,
- e->exception, e->code, e->subcode);
+ w->thread->port, inf->task->port, e->exception, e->code,
+ e->subcode);
+ err = exception_raise_request (e->handler, e->reply,
+ MACH_MSG_TYPE_MOVE_SEND_ONCE,
+ w->thread->port, inf->task->port,
+ e->exception, e->code, e->subcode);
}
else
- error (_("Can't forward spontaneous exception (%s)."), NAME);
+ error (_ ("Can't forward spontaneous exception (%s)."), NAME);
}
else
/* A Unix signal. */
- if (inf->stopped)
- /* The process is stopped and expecting a signal. Just send off a
+ if (inf->stopped)
+ /* The process is stopped and expecting a signal. Just send off a
request and let it get handled when we resume everything. */
- {
- inf_debug (inf, "sending %s to stopped process", NAME);
- err =
- INF_MSGPORT_RPC (inf,
- msg_sig_post_untraced_request (msgport,
- inf->event_port,
- MACH_MSG_TYPE_MAKE_SEND_ONCE,
- host_sig, 0,
- refport));
- if (!err)
- /* Posting an untraced signal automatically continues it.
+ {
+ inf_debug (inf, "sending %s to stopped process", NAME);
+ err = INF_MSGPORT_RPC (
+ inf, msg_sig_post_untraced_request (msgport, inf->event_port,
+ MACH_MSG_TYPE_MAKE_SEND_ONCE,
+ host_sig, 0, refport));
+ if (!err)
+ /* Posting an untraced signal automatically continues it.
We clear this here rather than when we get the reply
because we'd rather assume it's not stopped when it
actually is, than the reverse. */
- inf->stopped = 0;
- }
- else
- /* It's not expecting it. We have to let just the signal thread
+ inf->stopped = 0;
+ }
+ else
+ /* It's not expecting it. We have to let just the signal thread
run, and wait for it to get into a reasonable state before we
can continue the rest of the process. When we finally resume the
process the signal we request will be the very first thing that
happens. */
- {
- inf_debug (inf, "sending %s to unstopped process"
- " (so resuming signal thread)", NAME);
- err =
- INF_RESUME_MSGPORT_RPC (inf,
- msg_sig_post_untraced (msgport, host_sig,
- 0, refport));
- }
+ {
+ inf_debug (inf,
+ "sending %s to unstopped process"
+ " (so resuming signal thread)",
+ NAME);
+ err = INF_RESUME_MSGPORT_RPC (inf,
+ msg_sig_post_untraced (msgport, host_sig,
+ 0, refport));
+ }
if (err == EIEIO)
/* Can't do too much... */
- warning (_("Can't deliver signal %s: No signal thread."), NAME);
+ warning (_ ("Can't deliver signal %s: No signal thread."), NAME);
else if (err)
- warning (_("Delivering signal %s: %s"), NAME, safe_strerror (err));
+ warning (_ ("Delivering signal %s: %s"), NAME, safe_strerror (err));
#undef NAME
}
-
/* Continue INF without delivering a signal. This is meant to be used
when INF does not have a message port. */
void
@@ -1422,10 +1402,9 @@ gnu_nat_target::inf_continue (struct inf *inf)
}
if (err)
- warning (_("Can't continue process: %s"), safe_strerror (err));
+ warning (_ ("Can't continue process: %s"), safe_strerror (err));
}
-
/* The inferior used for all gdb target ops. */
struct inf *gnu_current_inf = 0;
@@ -1440,11 +1419,12 @@ gnu_nat_target::wait (ptid_t ptid, struct target_waitstatus *status,
target_wait_flags options)
{
struct msg
- {
- mach_msg_header_t hdr;
- mach_msg_type_t type;
- int data[8000];
- } msg;
+ {
+ mach_msg_header_t hdr;
+ mach_msg_type_t type;
+ int data[8000];
+ } msg;
+
kern_return_t err;
struct proc *thread;
struct inf *inf = gnu_current_inf;
@@ -1458,7 +1438,7 @@ gnu_nat_target::wait (ptid_t ptid, struct target_waitstatus *status,
{
inf_validate_procs (inf);
if (!inf->threads && !inf->task->dead)
- error (_("There are no threads; try again later."));
+ error (_ ("There are no threads; try again later."));
}
waiting_inf = inf;
@@ -1479,10 +1459,10 @@ rewait:
interrupt_operation (proc_server, 0);
}
- err =
- proc_wait_request (proc_server, inf->event_port, inf->pid, WUNTRACED);
+ err = proc_wait_request (proc_server, inf->event_port, inf->pid,
+ WUNTRACED);
if (err)
- warning (_("wait request failed: %s"), safe_strerror (err));
+ warning (_ ("wait request failed: %s"), safe_strerror (err));
else
{
inf_debug (inf, "waits pending: %d", proc_waits_pending);
@@ -1502,9 +1482,9 @@ rewait:
(3) wait reply from the proc server. */
inf_debug (inf, "waiting for an event...");
- err = mach_msg (&msg.hdr, MACH_RCV_MSG | MACH_RCV_INTERRUPT,
- 0, sizeof (struct msg), inf->event_port,
- MACH_MSG_TIMEOUT_NONE, MACH_PORT_NULL);
+ err = mach_msg (&msg.hdr, MACH_RCV_MSG | MACH_RCV_INTERRUPT, 0,
+ sizeof (struct msg), inf->event_port, MACH_MSG_TIMEOUT_NONE,
+ MACH_PORT_NULL);
/* Re-suspend the task. */
inf_suspend (inf);
@@ -1518,17 +1498,16 @@ rewait:
if (err == EMACH_RCV_INTERRUPTED)
inf_debug (inf, "interrupted");
else if (err)
- error (_("Couldn't wait for an event: %s"), safe_strerror (err));
+ error (_ ("Couldn't wait for an event: %s"), safe_strerror (err));
else
{
struct
- {
- mach_msg_header_t hdr;
- mach_msg_type_t err_type;
- kern_return_t err;
- char noise[200];
- }
- reply;
+ {
+ mach_msg_header_t hdr;
+ mach_msg_type_t err_type;
+ kern_return_t err;
+ char noise[200];
+ } reply;
inf_debug (inf, "event: msgid = %d", msg.hdr.msgh_id);
@@ -1538,11 +1517,11 @@ rewait:
&& !process_reply_server (&msg.hdr, &reply.hdr)
&& !msg_reply_server (&msg.hdr, &reply.hdr))
/* Whatever it is, it's something strange. */
- error (_("Got a strange event, msg id = %d."), msg.hdr.msgh_id);
+ error (_ ("Got a strange event, msg id = %d."), msg.hdr.msgh_id);
if (reply.err)
- error (_("Handling event, msgid = %d: %s"),
- msg.hdr.msgh_id, safe_strerror (reply.err));
+ error (_ ("Handling event, msgid = %d: %s"), msg.hdr.msgh_id,
+ safe_strerror (reply.err));
}
if (inf->pending_execs)
@@ -1609,10 +1588,9 @@ rewait:
}
}
- if (thread
- && ptid != minus_one_ptid
- && status->kind () != TARGET_WAITKIND_SPURIOUS
- && inf->pause_sc == 0 && thread->pause_sc == 0)
+ if (thread && ptid != minus_one_ptid
+ && status->kind () != TARGET_WAITKIND_SPURIOUS && inf->pause_sc == 0
+ && thread->pause_sc == 0)
/* If something actually happened to THREAD, make sure we
suspend it. */
{
@@ -1620,14 +1598,12 @@ rewait:
inf_update_suspends (inf);
}
- inf_debug (inf, "returning ptid = %s, %s",
- ptid.to_string ().c_str (),
+ inf_debug (inf, "returning ptid = %s, %s", ptid.to_string ().c_str (),
status->to_string ().c_str ());
return ptid;
}
-
/* The rpc handler called by exc_server. */
kern_return_t
S_exception_raise_request (mach_port_t port, mach_port_t reply_port,
@@ -1685,9 +1661,8 @@ S_exception_raise_request (mach_port_t port, mach_port_t reply_port,
}
if (inf->wait.exc.handler != MACH_PORT_NULL)
/* Add a reference to the exception handler. */
- mach_port_mod_refs (mach_task_self (),
- inf->wait.exc.handler, MACH_PORT_RIGHT_SEND,
- 1);
+ mach_port_mod_refs (mach_task_self (), inf->wait.exc.handler,
+ MACH_PORT_RIGHT_SEND, 1);
inf->wait.exc.exception = exception;
inf->wait.exc.code = code;
@@ -1697,8 +1672,8 @@ S_exception_raise_request (mach_port_t port, mach_port_t reply_port,
/* Exceptions are encoded in the signal space by putting
them after _NSIG; this assumes they're positive (and not
extremely large)! */
- inf->wait.status.set_stopped
- (gdb_signal_from_host (_NSIG + exception));
+ inf->wait.status.set_stopped (gdb_signal_from_host (_NSIG
+ + exception));
}
}
else
@@ -1711,13 +1686,12 @@ S_exception_raise_request (mach_port_t port, mach_port_t reply_port,
return 0;
}
-
/* Fill in INF's wait field after a task has died without giving us more
detailed information. */
static void
inf_task_died_status (struct inf *inf)
{
- warning (_("Pid %d died with unknown exit status, using SIGKILL."),
+ warning (_ ("Pid %d died with unknown exit status, using SIGKILL."),
inf->pid);
inf->wait.status.set_signalled (GDB_SIGNAL_KILL);
}
@@ -1759,36 +1733,31 @@ do_mach_notify_dead_name (mach_port_t notify, mach_port_t dead_port)
}
mach_port_deallocate (mach_task_self (), dead_port);
- inf->threads_up_to_date = 0; /* Just in case. */
+ inf->threads_up_to_date = 0; /* Just in case. */
return 0;
}
-
-#define ILL_RPC(fun, ...) \
+#define ILL_RPC(fun, ...) \
extern "C" kern_return_t fun (__VA_ARGS__); \
- kern_return_t fun (__VA_ARGS__) \
- { \
- warning (_("illegal rpc: %s"), #fun); \
- return 0; \
+ kern_return_t fun (__VA_ARGS__) \
+ { \
+ warning (_ ("illegal rpc: %s"), #fun); \
+ return 0; \
}
-ILL_RPC (do_mach_notify_no_senders,
- mach_port_t notify, mach_port_mscount_t count)
-ILL_RPC (do_mach_notify_port_deleted,
- mach_port_t notify, mach_port_t name)
-ILL_RPC (do_mach_notify_msg_accepted,
- mach_port_t notify, mach_port_t name)
-ILL_RPC (do_mach_notify_port_destroyed,
- mach_port_t notify, mach_port_t name)
-ILL_RPC (do_mach_notify_send_once,
- mach_port_t notify)
-
+ILL_RPC (do_mach_notify_no_senders, mach_port_t notify,
+ mach_port_mscount_t count)
+ILL_RPC (do_mach_notify_port_deleted, mach_port_t notify, mach_port_t name)
+ILL_RPC (do_mach_notify_msg_accepted, mach_port_t notify, mach_port_t name)
+ILL_RPC (do_mach_notify_port_destroyed, mach_port_t notify, mach_port_t name)
+ILL_RPC (do_mach_notify_send_once, mach_port_t notify)
+
/* Process_reply server routines. We only use process_wait_reply. */
kern_return_t
-S_proc_wait_reply (mach_port_t reply, kern_return_t err,
- int status, int sigcode, rusage_t rusage, pid_t pid)
+S_proc_wait_reply (mach_port_t reply, kern_return_t err, int status,
+ int sigcode, rusage_t rusage, pid_t pid)
{
struct inf *inf = waiting_inf;
@@ -1814,8 +1783,8 @@ S_proc_wait_reply (mach_port_t reply, kern_return_t err,
{
if (err != EINTR)
{
- warning (_("Can't wait for pid %d: %s"),
- inf->pid, safe_strerror (err));
+ warning (_ ("Can't wait for pid %d: %s"), inf->pid,
+ safe_strerror (err));
inf->no_wait = 1;
/* Since we can't see the inferior's signals, don't trap them. */
@@ -1834,74 +1803,70 @@ S_proc_wait_reply (mach_port_t reply, kern_return_t err,
}
}
else
- inf->wait.suppress = 1; /* Something odd happened. Ignore. */
+ inf->wait.suppress = 1; /* Something odd happened. Ignore. */
return 0;
}
-ILL_RPC (S_proc_setmsgport_reply,
- mach_port_t reply_port, kern_return_t return_code,
- mach_port_t oldmsgport)
-ILL_RPC (S_proc_getmsgport_reply,
- mach_port_t reply_port, kern_return_t return_code,
- mach_port_t msgports, mach_msg_type_name_t msgportsPoly)
-ILL_RPC (S_proc_pid2task_reply,
- mach_port_t reply_port, kern_return_t return_code, mach_port_t task)
-ILL_RPC (S_proc_task2pid_reply,
- mach_port_t reply_port, kern_return_t return_code, pid_t pid)
-ILL_RPC (S_proc_task2proc_reply,
- mach_port_t reply_port, kern_return_t return_code,
- mach_port_t proc, mach_msg_type_name_t procPoly)
-ILL_RPC (S_proc_proc2task_reply,
- mach_port_t reply_port, kern_return_t return_code, mach_port_t task)
-ILL_RPC (S_proc_pid2proc_reply,
- mach_port_t reply_port, kern_return_t return_code,
- mach_port_t proc, mach_msg_type_name_t procPoly)
-ILL_RPC (S_proc_getprocinfo_reply,
- mach_port_t reply_port, kern_return_t return_code,
- int flags, const_procinfo_t procinfo, mach_msg_type_number_t procinfoCnt,
- const_data_t threadwaits, mach_msg_type_number_t threadwaitsCnt)
-ILL_RPC (S_proc_getprocargs_reply,
- mach_port_t reply_port, kern_return_t return_code,
- const_data_t procargs, mach_msg_type_number_t procargsCnt)
-ILL_RPC (S_proc_getprocenv_reply,
- mach_port_t reply_port, kern_return_t return_code,
- const_data_t procenv, mach_msg_type_number_t procenvCnt)
-ILL_RPC (S_proc_getloginid_reply,
- mach_port_t reply_port, kern_return_t return_code, pid_t login_id)
-ILL_RPC (S_proc_getloginpids_reply,
- mach_port_t reply_port, kern_return_t return_code,
- const_pidarray_t pids, mach_msg_type_number_t pidsCnt)
-ILL_RPC (S_proc_getlogin_reply,
- mach_port_t reply_port, kern_return_t return_code, const_string_t logname)
-ILL_RPC (S_proc_getsid_reply,
- mach_port_t reply_port, kern_return_t return_code, pid_t sid)
-ILL_RPC (S_proc_getsessionpgids_reply,
- mach_port_t reply_port, kern_return_t return_code,
- const_pidarray_t pgidset, mach_msg_type_number_t pgidsetCnt)
-ILL_RPC (S_proc_getsessionpids_reply,
- mach_port_t reply_port, kern_return_t return_code,
- const_pidarray_t pidset, mach_msg_type_number_t pidsetCnt)
-ILL_RPC (S_proc_getsidport_reply,
- mach_port_t reply_port, kern_return_t return_code,
- mach_port_t sessport)
-ILL_RPC (S_proc_getpgrp_reply,
- mach_port_t reply_port, kern_return_t return_code, pid_t pgrp)
-ILL_RPC (S_proc_getpgrppids_reply,
- mach_port_t reply_port, kern_return_t return_code,
- const_pidarray_t pidset, mach_msg_type_number_t pidsetCnt)
-ILL_RPC (S_proc_get_tty_reply,
- mach_port_t reply_port, kern_return_t return_code, mach_port_t tty)
-ILL_RPC (S_proc_getnports_reply,
- mach_port_t reply_port, kern_return_t return_code,
- mach_msg_type_number_t nports)
-ILL_RPC (S_proc_is_important_reply,
- mach_port_t reply_port, kern_return_t return_code,
- boolean_t essential)
-ILL_RPC (S_proc_get_code_reply,
- mach_port_t reply_port, kern_return_t return_code,
- vm_address_t start_code, vm_address_t end_code)
-
+ILL_RPC (S_proc_setmsgport_reply, mach_port_t reply_port,
+ kern_return_t return_code, mach_port_t oldmsgport)
+ILL_RPC (S_proc_getmsgport_reply, mach_port_t reply_port,
+ kern_return_t return_code, mach_port_t msgports,
+ mach_msg_type_name_t msgportsPoly)
+ILL_RPC (S_proc_pid2task_reply, mach_port_t reply_port,
+ kern_return_t return_code, mach_port_t task)
+ILL_RPC (S_proc_task2pid_reply, mach_port_t reply_port,
+ kern_return_t return_code, pid_t pid)
+ILL_RPC (S_proc_task2proc_reply, mach_port_t reply_port,
+ kern_return_t return_code, mach_port_t proc,
+ mach_msg_type_name_t procPoly)
+ILL_RPC (S_proc_proc2task_reply, mach_port_t reply_port,
+ kern_return_t return_code, mach_port_t task)
+ILL_RPC (S_proc_pid2proc_reply, mach_port_t reply_port,
+ kern_return_t return_code, mach_port_t proc,
+ mach_msg_type_name_t procPoly)
+ILL_RPC (S_proc_getprocinfo_reply, mach_port_t reply_port,
+ kern_return_t return_code, int flags, const_procinfo_t procinfo,
+ mach_msg_type_number_t procinfoCnt, const_data_t threadwaits,
+ mach_msg_type_number_t threadwaitsCnt)
+ILL_RPC (S_proc_getprocargs_reply, mach_port_t reply_port,
+ kern_return_t return_code, const_data_t procargs,
+ mach_msg_type_number_t procargsCnt)
+ILL_RPC (S_proc_getprocenv_reply, mach_port_t reply_port,
+ kern_return_t return_code, const_data_t procenv,
+ mach_msg_type_number_t procenvCnt)
+ILL_RPC (S_proc_getloginid_reply, mach_port_t reply_port,
+ kern_return_t return_code, pid_t login_id)
+ILL_RPC (S_proc_getloginpids_reply, mach_port_t reply_port,
+ kern_return_t return_code, const_pidarray_t pids,
+ mach_msg_type_number_t pidsCnt)
+ILL_RPC (S_proc_getlogin_reply, mach_port_t reply_port,
+ kern_return_t return_code, const_string_t logname)
+ILL_RPC (S_proc_getsid_reply, mach_port_t reply_port,
+ kern_return_t return_code, pid_t sid)
+ILL_RPC (S_proc_getsessionpgids_reply, mach_port_t reply_port,
+ kern_return_t return_code, const_pidarray_t pgidset,
+ mach_msg_type_number_t pgidsetCnt)
+ILL_RPC (S_proc_getsessionpids_reply, mach_port_t reply_port,
+ kern_return_t return_code, const_pidarray_t pidset,
+ mach_msg_type_number_t pidsetCnt)
+ILL_RPC (S_proc_getsidport_reply, mach_port_t reply_port,
+ kern_return_t return_code, mach_port_t sessport)
+ILL_RPC (S_proc_getpgrp_reply, mach_port_t reply_port,
+ kern_return_t return_code, pid_t pgrp)
+ILL_RPC (S_proc_getpgrppids_reply, mach_port_t reply_port,
+ kern_return_t return_code, const_pidarray_t pidset,
+ mach_msg_type_number_t pidsetCnt)
+ILL_RPC (S_proc_get_tty_reply, mach_port_t reply_port,
+ kern_return_t return_code, mach_port_t tty)
+ILL_RPC (S_proc_getnports_reply, mach_port_t reply_port,
+ kern_return_t return_code, mach_msg_type_number_t nports)
+ILL_RPC (S_proc_is_important_reply, mach_port_t reply_port,
+ kern_return_t return_code, boolean_t essential)
+ILL_RPC (S_proc_get_code_reply, mach_port_t reply_port,
+ kern_return_t return_code, vm_address_t start_code,
+ vm_address_t end_code)
+
/* Msg_reply server routines. We only use msg_sig_post_untraced_reply. */
kern_return_t
@@ -1917,7 +1882,7 @@ S_msg_sig_post_untraced_reply (mach_port_t reply, kern_return_t err)
server should like). */
inf->wait.status.set_stopped (GDB_SIGNAL_0);
else if (err)
- warning (_("Signal delivery failed: %s"), safe_strerror (err));
+ warning (_ ("Signal delivery failed: %s"), safe_strerror (err));
if (err)
/* We only get this reply when we've posted a signal to a process which we
@@ -1931,16 +1896,15 @@ S_msg_sig_post_untraced_reply (mach_port_t reply, kern_return_t err)
return 0;
}
-ILL_RPC (S_msg_sig_post_reply,
- mach_port_t reply, kern_return_t err)
-
+ILL_RPC (S_msg_sig_post_reply, mach_port_t reply, kern_return_t err)
+
/* Returns the number of messages queued for the receive right PORT. */
static mach_port_msgcount_t
port_msgs_queued (mach_port_t port)
{
struct mach_port_status status;
- kern_return_t err =
- mach_port_get_receive_status (mach_task_self (), port, &status);
+ kern_return_t err
+ = mach_port_get_receive_status (mach_task_self (), port, &status);
if (err)
return 0;
@@ -1948,7 +1912,6 @@ port_msgs_queued (mach_port_t port)
return status.mps_msgcount;
}
-
/* Resume execution of the inferior process.
If STEP is nonzero, single-step it.
@@ -1972,8 +1935,8 @@ gnu_nat_target::resume (ptid_t ptid, int step, enum gdb_signal sig)
int resume_all;
struct inf *inf = gnu_current_inf;
- inf_debug (inf, "ptid = %s, step = %d, sig = %d",
- ptid.to_string ().c_str (), step, sig);
+ inf_debug (inf, "ptid = %s, step = %d, sig = %d", ptid.to_string ().c_str (),
+ step, sig);
inf_validate_procinfo (inf);
@@ -1989,7 +1952,7 @@ gnu_nat_target::resume (ptid_t ptid, int step, enum gdb_signal sig)
abort the faulting thread, which will perhaps retake it. */
{
proc_abort (inf->wait.thread, 1);
- warning (_("Aborting %s with unforwarded exception %s."),
+ warning (_ ("Aborting %s with unforwarded exception %s."),
proc_string (inf->wait.thread),
gdb_signal_to_name (inf->wait.status.sig ()));
}
@@ -2007,9 +1970,8 @@ gnu_nat_target::resume (ptid_t ptid, int step, enum gdb_signal sig)
if (resume_all)
/* Allow all threads to run, except perhaps single-stepping one. */
{
- inf_debug (inf, "running all threads; tid = %d",
- inferior_ptid.pid ());
- ptid = inferior_ptid; /* What to step. */
+ inf_debug (inf, "running all threads; tid = %d", inferior_ptid.pid ());
+ ptid = inferior_ptid; /* What to step. */
inf_set_threads_resume_sc (inf, 0, 1);
}
else
@@ -2018,10 +1980,9 @@ gnu_nat_target::resume (ptid_t ptid, int step, enum gdb_signal sig)
struct proc *thread = inf_tid_to_thread (inf, ptid.lwp ());
if (!thread)
- error (_("Can't run single thread id %s: no such thread!"),
+ error (_ ("Can't run single thread id %s: no such thread!"),
target_pid_to_str (ptid).c_str ());
- inf_debug (inf, "running one thread: %s",
- ptid.to_string ().c_str ());
+ inf_debug (inf, "running one thread: %s", ptid.to_string ().c_str ());
inf_set_threads_resume_sc (inf, thread, 0);
}
@@ -2029,11 +1990,10 @@ gnu_nat_target::resume (ptid_t ptid, int step, enum gdb_signal sig)
{
step_thread = inf_tid_to_thread (inf, ptid.lwp ());
if (!step_thread)
- warning (_("Can't step thread id %s: no such thread."),
+ warning (_ ("Can't step thread id %s: no such thread."),
target_pid_to_str (ptid).c_str ());
else
- inf_debug (inf, "stepping thread: %s",
- ptid.to_string ().c_str ());
+ inf_debug (inf, "stepping thread: %s", ptid.to_string ().c_str ());
}
if (step_thread != inf->step_thread)
inf_set_step_thread (inf, step_thread);
@@ -2042,7 +2002,6 @@ gnu_nat_target::resume (ptid_t ptid, int step, enum gdb_signal sig)
inf_resume (inf);
}
-
void
gnu_nat_target::kill ()
{
@@ -2066,7 +2025,6 @@ gnu_nat_target::mourn_inferior ()
inf_child_target::mourn_inferior ();
}
-
/* Fork an inferior process, and start debugging it. */
/* Set INFERIOR_PID to the first thread available in the child, if any. */
@@ -2101,8 +2059,7 @@ gnu_ptrace_me (void)
void
gnu_nat_target::create_inferior (const char *exec_file,
- const std::string &allargs,
- char **env,
+ const std::string &allargs, char **env,
int from_tty)
{
struct inf *inf = cur_inf ();
@@ -2114,8 +2071,8 @@ gnu_nat_target::create_inferior (const char *exec_file,
if (!inferior->target_is_pushed (this))
inferior->push_target (this);
- pid = fork_inferior (exec_file, allargs, env, gnu_ptrace_me,
- NULL, NULL, NULL, NULL);
+ pid = fork_inferior (exec_file, allargs, env, gnu_ptrace_me, NULL, NULL,
+ NULL, NULL);
/* We have something that executes now. We'll be running through
the shell at this point (if startup-with-shell is true), but the
@@ -2158,7 +2115,6 @@ gnu_nat_target::create_inferior (const char *exec_file,
inf_restore_exc_ports (inf);
}
-
/* Attach to process PID, then initialize for debugging it
and wait for the trace-trap that results from attaching. */
void
@@ -2170,8 +2126,8 @@ gnu_nat_target::attach (const char *args, int from_tty)
pid = parse_pid_to_attach (args);
- if (pid == getpid ()) /* Trying to masturbate? */
- error (_("I refuse to debug myself!"));
+ if (pid == getpid ()) /* Trying to masturbate? */
+ error (_ ("I refuse to debug myself!"));
target_announce_attach (from_tty, pid);
@@ -2202,12 +2158,11 @@ gnu_nat_target::attach (const char *args, int from_tty)
inf_update_signal_thread (inf);
inf_set_traced (inf, inf->want_signals);
-#if 0 /* Do we need this? */
+#if 0 /* Do we need this? */
renumber_threads (0); /* Give our threads reasonable names. */
#endif
}
-
/* Take a program previously attached to and detaches it.
The program resumes execution and will no longer stop
on signals, etc. We'd better not have left any breakpoints
@@ -2227,23 +2182,20 @@ gnu_nat_target::detach (inferior *inf, int from_tty)
maybe_unpush_target ();
}
-
void
gnu_nat_target::stop (ptid_t ptid)
{
- error (_("stop target function not implemented"));
+ error (_ ("stop target function not implemented"));
}
bool
gnu_nat_target::thread_alive (ptid_t ptid)
{
inf_update_procs (gnu_current_inf);
- return !!inf_tid_to_thread (gnu_current_inf,
- ptid.lwp ());
+ return !!inf_tid_to_thread (gnu_current_inf, ptid.lwp ());
}
-
/* Read inferior task's LEN bytes from ADDR and copy it to MYADDR in
gdb's address space. Return 0 on failure; number of bytes read
otherwise. */
@@ -2252,8 +2204,8 @@ gnu_read_inferior (task_t task, CORE_ADDR addr, gdb_byte *myaddr, int length)
{
kern_return_t err;
vm_address_t low_address = (vm_address_t) trunc_page (addr);
- vm_size_t aligned_length =
- (vm_size_t) round_page (addr + length) - low_address;
+ vm_size_t aligned_length
+ = (vm_size_t) round_page (addr + length) - low_address;
pointer_t copied;
mach_msg_type_number_t copy_count;
@@ -2266,20 +2218,26 @@ gnu_read_inferior (task_t task, CORE_ADDR addr, gdb_byte *myaddr, int length)
length);
if (err)
{
- warning (_("Read from inferior faulted: %s"), safe_strerror (err));
+ warning (_ ("Read from inferior faulted: %s"), safe_strerror (err));
length = 0;
}
err = vm_deallocate (mach_task_self (), copied, copy_count);
if (err)
- warning (_("gnu_read_inferior vm_deallocate failed: %s"),
+ warning (_ ("gnu_read_inferior vm_deallocate failed: %s"),
safe_strerror (err));
return length;
}
-#define CHK_GOTO_OUT(str,ret) \
- do if (ret != KERN_SUCCESS) { errstr = #str; goto out; } while(0)
+#define CHK_GOTO_OUT(str, ret) \
+ do \
+ if (ret != KERN_SUCCESS) \
+ { \
+ errstr = #str; \
+ goto out; \
+ } \
+ while (0)
struct vm_region_list
{
@@ -2294,13 +2252,13 @@ struct obstack region_obstack;
/* Write gdb's LEN bytes from MYADDR and copy it to ADDR in inferior
task's address space. */
static int
-gnu_write_inferior (task_t task, CORE_ADDR addr,
- const gdb_byte *myaddr, int length)
+gnu_write_inferior (task_t task, CORE_ADDR addr, const gdb_byte *myaddr,
+ int length)
{
kern_return_t err;
vm_address_t low_address = (vm_address_t) trunc_page (addr);
- vm_size_t aligned_length =
- (vm_size_t) round_page (addr + length) - low_address;
+ vm_size_t aligned_length
+ = (vm_size_t) round_page (addr + length) - low_address;
pointer_t copied;
mach_msg_type_number_t copy_count;
int deallocate = 0;
@@ -2311,17 +2269,13 @@ gnu_write_inferior (task_t task, CORE_ADDR addr,
struct vm_region_list *region_head = NULL;
/* Get memory from inferior with page aligned addresses. */
- err = vm_read (task,
- low_address,
- aligned_length,
- &copied,
- &copy_count);
+ err = vm_read (task, low_address, aligned_length, &copied, &copy_count);
CHK_GOTO_OUT ("gnu_write_inferior vm_read failed", err);
deallocate++;
- err = hurd_safe_copyout ((void *) (addr - low_address + copied),
- myaddr, length);
+ err = hurd_safe_copyout ((void *) (addr - low_address + copied), myaddr,
+ length);
CHK_GOTO_OUT ("Write to inferior faulted", err);
obstack_init (&region_obstack);
@@ -2345,22 +2299,15 @@ gnu_write_inferior (task_t task, CORE_ADDR addr,
vm_size_t region_length = remaining_length;
vm_address_t old_address = region_address;
- err = vm_region (task,
- &region_address,
- &region_length,
- &protection,
- &max_protection,
- &inheritance,
- &shared,
- &object_name,
+ err = vm_region (task, &region_address, &region_length, &protection,
+ &max_protection, &inheritance, &shared, &object_name,
&offset);
CHK_GOTO_OUT ("vm_region failed", err);
/* Check for holes in memory. */
if (old_address != region_address)
{
- warning (_("No memory at 0x%lx. Nothing written"),
- old_address);
+ warning (_ ("No memory at 0x%lx. Nothing written"), old_address);
err = KERN_SUCCESS;
length = 0;
goto out;
@@ -2368,8 +2315,8 @@ gnu_write_inferior (task_t task, CORE_ADDR addr,
if (!(max_protection & VM_PROT_WRITE))
{
- warning (_("Memory at address 0x%lx is unwritable. "
- "Nothing written"),
+ warning (_ ("Memory at address 0x%lx is unwritable. "
+ "Nothing written"),
old_address);
err = KERN_SUCCESS;
length = 0;
@@ -2399,19 +2346,13 @@ gnu_write_inferior (task_t task, CORE_ADDR addr,
{
if (!(scan->protection & VM_PROT_WRITE))
{
- err = vm_protect (task,
- scan->start,
- scan->length,
- FALSE,
+ err = vm_protect (task, scan->start, scan->length, FALSE,
scan->protection | VM_PROT_WRITE);
CHK_GOTO_OUT ("vm_protect: enable write failed", err);
}
}
- err = vm_write (task,
- low_address,
- copied,
- aligned_length);
+ err = vm_write (task, low_address, copied, aligned_length);
CHK_GOTO_OUT ("vm_write failed", err);
/* Set up the original region protections, if they were changed. */
@@ -2419,10 +2360,7 @@ gnu_write_inferior (task_t task, CORE_ADDR addr,
{
if (!(scan->protection & VM_PROT_WRITE))
{
- err = vm_protect (task,
- scan->start,
- scan->length,
- FALSE,
+ err = vm_protect (task, scan->start, scan->length, FALSE,
scan->protection);
CHK_GOTO_OUT ("vm_protect: enable write failed", err);
}
@@ -2434,22 +2372,18 @@ out:
{
obstack_free (&region_obstack, 0);
- (void) vm_deallocate (mach_task_self (),
- copied,
- copy_count);
+ (void) vm_deallocate (mach_task_self (), copied, copy_count);
}
if (err != KERN_SUCCESS)
{
- warning (_("%s: %s"), errstr, mach_error_string (err));
+ warning (_ ("%s: %s"), errstr, mach_error_string (err));
return 0;
}
return length;
}
-
-
/* Implement the to_xfer_partial target_ops method for
TARGET_OBJECT_MEMORY. */
@@ -2458,9 +2392,8 @@ gnu_xfer_memory (gdb_byte *readbuf, const gdb_byte *writebuf,
CORE_ADDR memaddr, ULONGEST len, ULONGEST *xfered_len)
{
task_t task = (gnu_current_inf
- ? (gnu_current_inf->task
- ? gnu_current_inf->task->port : 0)
- : 0);
+ ? (gnu_current_inf->task ? gnu_current_inf->task->port : 0)
+ : 0);
int res;
if (task == MACH_PORT_NULL)
@@ -2493,17 +2426,16 @@ gnu_xfer_memory (gdb_byte *readbuf, const gdb_byte *writebuf,
/* GNU does not have auxv, but we can at least fake the AT_ENTRY entry for PIE
binaries. */
static enum target_xfer_status
-gnu_xfer_auxv (gdb_byte *readbuf, const gdb_byte *writebuf,
- CORE_ADDR memaddr, ULONGEST len, ULONGEST *xfered_len)
+gnu_xfer_auxv (gdb_byte *readbuf, const gdb_byte *writebuf, CORE_ADDR memaddr,
+ ULONGEST len, ULONGEST *xfered_len)
{
task_t task = (gnu_current_inf
- ? (gnu_current_inf->task
- ? gnu_current_inf->task->port : 0)
- : 0);
+ ? (gnu_current_inf->task ? gnu_current_inf->task->port : 0)
+ : 0);
process_t proc;
kern_return_t err;
vm_address_t entry;
- ElfW(auxv_t) auxv[2];
+ ElfW (auxv_t) auxv[2];
if (task == MACH_PORT_NULL)
return TARGET_XFER_E_IO;
@@ -2546,10 +2478,10 @@ gnu_xfer_auxv (gdb_byte *readbuf, const gdb_byte *writebuf,
/* Target to_xfer_partial implementation. */
enum target_xfer_status
-gnu_nat_target::xfer_partial (enum target_object object,
- const char *annex, gdb_byte *readbuf,
- const gdb_byte *writebuf, ULONGEST offset,
- ULONGEST len, ULONGEST *xfered_len)
+gnu_nat_target::xfer_partial (enum target_object object, const char *annex,
+ gdb_byte *readbuf, const gdb_byte *writebuf,
+ ULONGEST offset, ULONGEST len,
+ ULONGEST *xfered_len)
{
switch (object)
{
@@ -2565,8 +2497,7 @@ gnu_nat_target::xfer_partial (enum target_object object,
/* Call FUNC on each memory region in the task. */
int
-gnu_nat_target::find_memory_regions (find_memory_region_ftype func,
- void *data)
+gnu_nat_target::find_memory_regions (find_memory_region_ftype func, void *data)
{
kern_return_t err;
task_t task;
@@ -2591,20 +2522,14 @@ gnu_nat_target::find_memory_regions (find_memory_region_ftype func,
vm_offset_t offset;
vm_size_t region_length = VM_MAX_ADDRESS - region_address;
- err = vm_region (task,
- &region_address,
- &region_length,
- &protection,
- &max_protection,
- &inheritance,
- &shared,
- &object_name,
+ err = vm_region (task, &region_address, &region_length, &protection,
+ &max_protection, &inheritance, &shared, &object_name,
&offset);
if (err == KERN_NO_SPACE)
break;
if (err != KERN_SUCCESS)
{
- warning (_("vm_region failed: %s"), mach_error_string (err));
+ warning (_ ("vm_region failed: %s"), mach_error_string (err));
return -1;
}
@@ -2622,7 +2547,7 @@ gnu_nat_target::find_memory_regions (find_memory_region_ftype func,
last_protection & VM_PROT_READ,
last_protection & VM_PROT_WRITE,
last_protection & VM_PROT_EXECUTE,
- 1, /* MODIFIED is unknown, pass it as true. */
+ 1, /* MODIFIED is unknown, pass it as true. */
false, /* No memory tags in the object file. */
data);
last_region_address = region_address;
@@ -2634,17 +2559,15 @@ gnu_nat_target::find_memory_regions (find_memory_region_ftype func,
/* Report the final region. */
if (last_region_end > last_region_address && last_protection != VM_PROT_NONE)
(*func) (last_region_address, last_region_end - last_region_address,
- last_protection & VM_PROT_READ,
- last_protection & VM_PROT_WRITE,
+ last_protection & VM_PROT_READ, last_protection & VM_PROT_WRITE,
last_protection & VM_PROT_EXECUTE,
- 1, /* MODIFIED is unknown, pass it as true. */
+ 1, /* MODIFIED is unknown, pass it as true. */
false, /* No memory tags in the object file. */
data);
return 0;
}
-
/* Return printable description of proc. */
char *
proc_string (struct proc *proc)
@@ -2654,8 +2577,8 @@ proc_string (struct proc *proc)
if (proc_is_task (proc))
xsnprintf (tid_str, sizeof (tid_str), "process %d", proc->inf->pid);
else
- xsnprintf (tid_str, sizeof (tid_str), "Thread %d.%d",
- proc->inf->pid, proc->tid);
+ xsnprintf (tid_str, sizeof (tid_str), "Thread %d.%d", proc->inf->pid,
+ proc->tid);
return tid_str;
}
@@ -2672,7 +2595,6 @@ gnu_nat_target::pid_to_str (ptid_t ptid)
return string_printf ("bogus thread id %d", tid);
}
-
/* User task commands. */
static struct cmd_list_element *set_task_cmd_list = 0;
@@ -2699,7 +2621,7 @@ parse_int_arg (const char *args, const char *cmd_prefix)
if (*args && *arg_end == '\0')
return val;
}
- error (_("Illegal argument for \"%s\" command, should be an integer."),
+ error (_ ("Illegal argument for \"%s\" command, should be an integer."),
cmd_prefix);
}
@@ -2712,8 +2634,8 @@ _parse_bool_arg (const char *args, const char *t_val, const char *f_val,
else if (strcmp (args, f_val) == 0)
return 0;
else
- error (_("Illegal argument for \"%s\" command, "
- "should be \"%s\" or \"%s\"."),
+ error (_ ("Illegal argument for \"%s\" command, "
+ "should be \"%s\" or \"%s\"."),
cmd_prefix, t_val, f_val);
}
@@ -2724,7 +2646,7 @@ static void
check_empty (const char *args, const char *cmd_prefix)
{
if (args)
- error (_("Garbage after \"%s\" command: `%s'"), cmd_prefix, args);
+ error (_ ("Garbage after \"%s\" command: `%s'"), cmd_prefix, args);
}
/* Returns the alive thread named by INFERIOR_PID, or signals an error. */
@@ -2732,10 +2654,9 @@ static struct proc *
cur_thread (void)
{
struct inf *inf = cur_inf ();
- struct proc *thread = inf_tid_to_thread (inf,
- inferior_ptid.lwp ());
+ struct proc *thread = inf_tid_to_thread (inf, inferior_ptid.lwp ());
if (!thread)
- error (_("No current thread."));
+ error (_ ("No current thread."));
return thread;
}
@@ -2746,11 +2667,10 @@ active_inf (void)
struct inf *inf = cur_inf ();
if (!inf->task)
- error (_("No current process."));
+ error (_ ("No current process."));
return inf;
}
-
static void
set_task_pause_cmd (int arg, int from_tty)
{
@@ -2778,16 +2698,15 @@ show_task_pause_cmd (const char *args, int from_tty)
check_empty (args, "show task pause");
gdb_printf ("The inferior task %s suspended while gdb has control.\n",
- inf->task
- ? (inf->pause_sc == 0 ? "isn't" : "is")
- : (inf->pause_sc == 0 ? "won't be" : "will be"));
+ inf->task ? (inf->pause_sc == 0 ? "isn't" : "is")
+ : (inf->pause_sc == 0 ? "won't be" : "will be"));
}
static void
set_task_detach_sc_cmd (const char *args, int from_tty)
{
- cur_inf ()->detach_sc = parse_int_arg (args,
- "set task detach-suspend-count");
+ cur_inf ()->detach_sc
+ = parse_int_arg (args, "set task detach-suspend-count");
}
static void
@@ -2799,14 +2718,13 @@ show_task_detach_sc_cmd (const char *args, int from_tty)
cur_inf ()->detach_sc);
}
-
static void
set_thread_default_pause_cmd (const char *args, int from_tty)
{
struct inf *inf = cur_inf ();
- inf->default_thread_pause_sc =
- parse_bool_arg (args, "set thread default pause") ? 0 : 1;
+ inf->default_thread_pause_sc
+ = parse_bool_arg (args, "set thread default pause") ? 0 : 1;
}
static void
@@ -2826,8 +2744,8 @@ set_thread_default_run_cmd (const char *args, int from_tty)
{
struct inf *inf = cur_inf ();
- inf->default_thread_run_sc =
- parse_bool_arg (args, "set thread default run") ? 0 : 1;
+ inf->default_thread_run_sc
+ = parse_bool_arg (args, "set thread default run") ? 0 : 1;
}
static void
@@ -2843,8 +2761,8 @@ show_thread_default_run_cmd (const char *args, int from_tty)
static void
set_thread_default_detach_sc_cmd (const char *args, int from_tty)
{
- cur_inf ()->default_thread_detach_sc =
- parse_int_arg (args, "set thread default detach-suspend-count");
+ cur_inf ()->default_thread_detach_sc
+ = parse_int_arg (args, "set thread default detach-suspend-count");
}
static void
@@ -2855,7 +2773,6 @@ show_thread_default_detach_sc_cmd (const char *args, int from_tty)
cur_inf ()->default_thread_detach_sc);
}
-
/* Steal a send right called NAME in the inferior task, and make it PROC's
saved exception port. */
void
@@ -2866,14 +2783,13 @@ gnu_nat_target::steal_exc_port (struct proc *proc, mach_port_t name)
mach_msg_type_name_t port_type;
if (!proc || !proc->inf->task)
- error (_("No inferior task."));
+ error (_ ("No inferior task."));
- err = mach_port_extract_right (proc->inf->task->port,
- name, MACH_MSG_TYPE_COPY_SEND,
- &port, &port_type);
+ err = mach_port_extract_right (proc->inf->task->port, name,
+ MACH_MSG_TYPE_COPY_SEND, &port, &port_type);
if (err)
- error (_("Couldn't extract send right %lu from inferior: %s"),
- name, safe_strerror (err));
+ error (_ ("Couldn't extract send right %lu from inferior: %s"), name,
+ safe_strerror (err));
if (proc->saved_exc_port)
/* Get rid of our reference to the old one. */
@@ -2888,8 +2804,8 @@ gnu_nat_target::steal_exc_port (struct proc *proc, mach_port_t name)
{
proc->exc_port = proc->inf->event_port;
err = proc_set_exception_port (proc, proc->exc_port);
- error (_("Can't set exception port for %s: %s"),
- proc_string (proc), safe_strerror (err));
+ error (_ ("Can't set exception port for %s: %s"), proc_string (proc),
+ safe_strerror (err));
}
}
@@ -2899,7 +2815,7 @@ set_task_exc_port_cmd (const char *args, int from_tty)
struct inf *inf = cur_inf ();
if (!args)
- error (_("No argument to \"set task exception-port\" command."));
+ error (_ ("No argument to \"set task exception-port\" command."));
gnu_target->steal_exc_port (inf->task, parse_and_eval_address (args));
}
@@ -2925,8 +2841,8 @@ set_sig_thread_cmd (const char *args, int from_tty)
struct inf *inf = cur_inf ();
if (!args || (!isdigit (*args) && strcmp (args, "none") != 0))
- error (_("Illegal argument to \"set signal-thread\" command.\n"
- "Should be a thread ID, or \"none\"."));
+ error (_ ("Illegal argument to \"set signal-thread\" command.\n"
+ "Should be a thread ID, or \"none\"."));
if (strcmp (args, "none") == 0)
inf->signal_thread = 0;
@@ -2950,7 +2866,6 @@ show_sig_thread_cmd (const char *args, int from_tty)
gdb_printf ("There is no signal thread.\n");
}
-
static void
set_signals_cmd (int arg, int from_tty)
{
@@ -2966,7 +2881,7 @@ set_signals_cmd (int arg, int from_tty)
static void
set_signals_cmd (const char *args, int from_tty)
{
- set_signals_cmd(parse_bool_arg (args, "set signals"), from_tty);
+ set_signals_cmd (parse_bool_arg (args, "set signals"), from_tty);
}
static void
@@ -2976,9 +2891,8 @@ show_signals_cmd (const char *args, int from_tty)
check_empty (args, "show signals");
gdb_printf ("The inferior process's signals %s intercepted.\n",
- inf->task
- ? (inf->traced ? "are" : "aren't")
- : (inf->want_signals ? "will be" : "won't be"));
+ inf->task ? (inf->traced ? "are" : "aren't")
+ : (inf->want_signals ? "will be" : "won't be"));
}
static void
@@ -2987,7 +2901,7 @@ set_exceptions_cmd (int arg, int from_tty)
struct inf *inf = cur_inf ();
/* Make this take effect immediately in a running process. */
- /* XXX */ ;
+ /* XXX */;
inf->want_exceptions = arg;
}
@@ -3005,12 +2919,10 @@ show_exceptions_cmd (const char *args, int from_tty)
check_empty (args, "show exceptions");
gdb_printf ("Exceptions in the inferior %s trapped.\n",
- inf->task
- ? (inf->want_exceptions ? "are" : "aren't")
- : (inf->want_exceptions ? "will be" : "won't be"));
+ inf->task ? (inf->want_exceptions ? "are" : "aren't")
+ : (inf->want_exceptions ? "will be" : "won't be"));
}
-
static void
set_task_cmd (const char *args, int from_tty)
{
@@ -3045,7 +2957,6 @@ show_task_cmd (const char *args, int from_tty)
show_thread_default_detach_sc_cmd (0, from_tty);
}
-
static void
set_noninvasive_cmd (const char *args, int from_tty)
{
@@ -3057,7 +2968,6 @@ set_noninvasive_cmd (const char *args, int from_tty)
set_exceptions_cmd (inv_arg, from_tty);
}
-
static void
info_port_rights (const char *args, mach_port_type_t only)
{
@@ -3071,22 +2981,20 @@ info_port_rights (const char *args, mach_port_type_t only)
{
struct value *val = parse_to_comma_and_eval (&args);
long right = value_as_long (val);
- error_t err =
- print_port_info (right, 0, inf->task->port, PORTINFO_DETAILS,
- stdout);
+ error_t err = print_port_info (right, 0, inf->task->port,
+ PORTINFO_DETAILS, stdout);
if (err)
- error (_("%ld: %s."), right, safe_strerror (err));
+ error (_ ("%ld: %s."), right, safe_strerror (err));
}
}
else
/* Print all of them. */
{
- error_t err =
- print_task_ports_info (inf->task->port, only, PORTINFO_DETAILS,
- stdout);
+ error_t err = print_task_ports_info (inf->task->port, only,
+ PORTINFO_DETAILS, stdout);
if (err)
- error (_("%s."), safe_strerror (err));
+ error (_ ("%s."), safe_strerror (err));
}
}
@@ -3120,88 +3028,88 @@ info_port_rights_cmd (const char *args, int from_tty)
info_port_rights (args, ~0);
}
-
static void
add_task_commands (void)
{
- add_cmd ("pause", class_run, set_thread_default_pause_cmd, _("\
+ add_cmd ("pause", class_run, set_thread_default_pause_cmd, _ ("\
Set whether the new threads are suspended while gdb has control.\n\
This property normally has no effect because the whole task is\n\
suspended, however, that may be disabled with \"set task pause off\".\n\
The default value is \"off\"."),
&set_thread_default_cmd_list);
- add_cmd ("pause", no_class, show_thread_default_pause_cmd, _("\
+ add_cmd ("pause", no_class, show_thread_default_pause_cmd, _ ("\
Show whether new threads are suspended while gdb has control."),
&show_thread_default_cmd_list);
-
- add_cmd ("run", class_run, set_thread_default_run_cmd, _("\
+
+ add_cmd ("run", class_run, set_thread_default_run_cmd, _ ("\
Set whether new threads are allowed to run (once gdb has noticed them)."),
&set_thread_default_cmd_list);
- add_cmd ("run", no_class, show_thread_default_run_cmd, _("\
+ add_cmd ("run", no_class, show_thread_default_run_cmd, _ ("\
Show whether new threads are allowed to run (once gdb has noticed them)."),
&show_thread_default_cmd_list);
-
+
add_cmd ("detach-suspend-count", class_run, set_thread_default_detach_sc_cmd,
- _("Set the default detach-suspend-count value for new threads."),
+ _ ("Set the default detach-suspend-count value for new threads."),
&set_thread_default_cmd_list);
add_cmd ("detach-suspend-count", no_class, show_thread_default_detach_sc_cmd,
- _("Show the default detach-suspend-count value for new threads."),
+ _ ("Show the default detach-suspend-count value for new threads."),
&show_thread_default_cmd_list);
cmd_list_element *set_signals_cmd_
- = add_cmd ("signals", class_run, set_signals_cmd, _("\
+ = add_cmd ("signals", class_run, set_signals_cmd, _ ("\
Set whether the inferior process's signals will be intercepted.\n\
Mach exceptions (such as breakpoint traps) are not affected."),
&setlist);
add_alias_cmd ("sigs", set_signals_cmd_, class_run, 1, &setlist);
cmd_list_element *show_signals_cmd_
- = add_cmd ("signals", no_class, show_signals_cmd, _("\
+ = add_cmd ("signals", no_class, show_signals_cmd, _ ("\
Show whether the inferior process's signals will be intercepted."),
&showlist);
add_alias_cmd ("sigs", show_signals_cmd_, no_class, 1, &showlist);
cmd_list_element *set_signal_thread_cmd_
- = add_cmd ("signal-thread", class_run, set_sig_thread_cmd, _("\
+ = add_cmd ("signal-thread", class_run, set_sig_thread_cmd, _ ("\
Set the thread that gdb thinks is the libc signal thread.\n\
This thread is run when delivering a signal to a non-stopped process."),
&setlist);
add_alias_cmd ("sigthread", set_signal_thread_cmd_, class_run, 1, &setlist);
cmd_list_element *show_signal_thread_cmd_
- = add_cmd ("signal-thread", no_class, show_sig_thread_cmd, _("\
+ = add_cmd ("signal-thread", no_class, show_sig_thread_cmd, _ ("\
Set the thread that gdb thinks is the libc signal thread."),
&showlist);
add_alias_cmd ("sigthread", show_signal_thread_cmd_, no_class, 1, &showlist);
- add_cmd ("stopped", class_run, set_stopped_cmd, _("\
+ add_cmd ("stopped", class_run, set_stopped_cmd, _ ("\
Set whether gdb thinks the inferior process is stopped as with SIGSTOP.\n\
Stopped process will be continued by sending them a signal."),
&setlist);
- add_cmd ("stopped", no_class, show_stopped_cmd, _("\
+ add_cmd ("stopped", no_class, show_stopped_cmd, _ ("\
Show whether gdb thinks the inferior process is stopped as with SIGSTOP."),
&showlist);
cmd_list_element *set_exceptions_cmd_
- = add_cmd ("exceptions", class_run, set_exceptions_cmd, _("\
+ = add_cmd ("exceptions", class_run, set_exceptions_cmd, _ ("\
Set whether exceptions in the inferior process will be trapped.\n\
When exceptions are turned off, neither breakpoints nor single-stepping\n\
-will work."), &setlist);
+will work."),
+ &setlist);
/* Allow `set exc' despite conflict with `set exception-port'. */
add_alias_cmd ("exc", set_exceptions_cmd_, class_run, 1, &setlist);
- add_cmd ("exceptions", no_class, show_exceptions_cmd, _("\
+ add_cmd ("exceptions", no_class, show_exceptions_cmd, _ ("\
Show whether exceptions in the inferior process will be trapped."),
&showlist);
add_prefix_cmd ("task", no_class, set_task_cmd,
- _("Command prefix for setting task attributes."),
+ _ ("Command prefix for setting task attributes."),
&set_task_cmd_list, 0, &setlist);
add_prefix_cmd ("task", no_class, show_task_cmd,
- _("Command prefix for showing task attributes."),
+ _ ("Command prefix for showing task attributes."),
&show_task_cmd_list, 0, &showlist);
- add_cmd ("pause", class_run, set_task_pause_cmd, _("\
+ add_cmd ("pause", class_run, set_task_pause_cmd, _ ("\
Set whether the task is suspended while gdb has control.\n\
A value of \"on\" takes effect immediately, otherwise nothing happens\n\
until the next time the program is continued.\n\
@@ -3209,19 +3117,20 @@ When setting this to \"off\", \"set thread default pause on\" can be\n\
used to pause individual threads by default instead."),
&set_task_cmd_list);
add_cmd ("pause", no_class, show_task_pause_cmd,
- _("Show whether the task is suspended while gdb has control."),
+ _ ("Show whether the task is suspended while gdb has control."),
&show_task_cmd_list);
- add_cmd ("detach-suspend-count", class_run, set_task_detach_sc_cmd,
- _("Set the suspend count will leave on the thread when detaching."),
- &set_task_cmd_list);
+ add_cmd (
+ "detach-suspend-count", class_run, set_task_detach_sc_cmd,
+ _ ("Set the suspend count will leave on the thread when detaching."),
+ &set_task_cmd_list);
add_cmd ("detach-suspend-count", no_class, show_task_detach_sc_cmd,
- _("Show the suspend count will leave "
- "on the thread when detaching."),
+ _ ("Show the suspend count will leave "
+ "on the thread when detaching."),
&show_task_cmd_list);
cmd_list_element *set_task_exception_port_cmd_
- = add_cmd ("exception-port", no_class, set_task_exc_port_cmd, _("\
+ = add_cmd ("exception-port", no_class, set_task_exc_port_cmd, _ ("\
Set the task exception port to which we forward exceptions.\n\
The argument should be the value of the send right in the task."),
&set_task_cmd_list);
@@ -3232,7 +3141,7 @@ The argument should be the value of the send right in the task."),
/* A convenient way of turning on all options require to noninvasively
debug running tasks. */
- add_cmd ("noninvasive", no_class, set_noninvasive_cmd, _("\
+ add_cmd ("noninvasive", no_class, set_noninvasive_cmd, _ ("\
Set task options so that we interfere as little as possible.\n\
This is the same as setting `task pause', `exceptions', and\n\
`signals' to the opposite value."),
@@ -3240,23 +3149,22 @@ This is the same as setting `task pause', `exceptions', and\n\
/* Commands to show information about the task's ports. */
add_info ("send-rights", info_send_rights_cmd,
- _("Show information about the task's send rights."));
+ _ ("Show information about the task's send rights."));
add_info ("receive-rights", info_recv_rights_cmd,
- _("Show information about the task's receive rights."));
+ _ ("Show information about the task's receive rights."));
cmd_list_element *port_rights_cmd
= add_info ("port-rights", info_port_rights_cmd,
- _("Show information about the task's port rights."));
+ _ ("Show information about the task's port rights."));
cmd_list_element *port_sets_cmd
= add_info ("port-sets", info_port_sets_cmd,
- _("Show information about the task's port sets."));
+ _ ("Show information about the task's port sets."));
add_info ("dead-names", info_dead_names_cmd,
- _("Show information about the task's dead names."));
+ _ ("Show information about the task's dead names."));
add_info_alias ("ports", port_rights_cmd, 1);
add_info_alias ("port", port_rights_cmd, 1);
add_info_alias ("psets", port_sets_cmd, 1);
}
-
static void
set_thread_pause_cmd (const char *args, int from_tty)
{
@@ -3278,8 +3186,7 @@ show_thread_pause_cmd (const char *args, int from_tty)
check_empty (args, "show task pause");
gdb_printf ("Thread %s %s suspended while gdb has control%s.\n",
- proc_string (thread),
- sc ? "is" : "isn't",
+ proc_string (thread), sc ? "is" : "isn't",
!sc && thread->inf->pause_sc ? " (but the task is)" : "");
}
@@ -3297,16 +3204,15 @@ show_thread_run_cmd (const char *args, int from_tty)
struct proc *thread = cur_thread ();
check_empty (args, "show thread run");
- gdb_printf ("Thread %s %s allowed to run.",
- proc_string (thread),
+ gdb_printf ("Thread %s %s allowed to run.", proc_string (thread),
thread->run_sc == 0 ? "is" : "isn't");
}
static void
set_thread_detach_sc_cmd (const char *args, int from_tty)
{
- cur_thread ()->detach_sc = parse_int_arg (args,
- "set thread detach-suspend-count");
+ cur_thread ()->detach_sc
+ = parse_int_arg (args, "set thread detach-suspend-count");
}
static void
@@ -3317,8 +3223,7 @@ show_thread_detach_sc_cmd (const char *args, int from_tty)
check_empty (args, "show thread detach-suspend-count");
gdb_printf ("Thread %s will be left with a suspend count"
" of %d when detaching.\n",
- proc_string (thread),
- thread->detach_sc);
+ proc_string (thread), thread->detach_sc);
}
static void
@@ -3327,7 +3232,7 @@ set_thread_exc_port_cmd (const char *args, int from_tty)
struct proc *thread = cur_thread ();
if (!args)
- error (_("No argument to \"set thread exception-port\" command."));
+ error (_ ("No argument to \"set thread exception-port\" command."));
gnu_target->steal_exc_port (thread, parse_and_eval_address (args));
}
@@ -3353,9 +3258,8 @@ thread_takeover_sc_cmd (const char *args, int from_tty)
thread_basic_info_data_t _info;
thread_basic_info_t info = &_info;
mach_msg_type_number_t info_len = THREAD_BASIC_INFO_COUNT;
- kern_return_t err
- = mach_thread_info (thread->port, THREAD_BASIC_INFO,
- (int *) &info, &info_len);
+ kern_return_t err = mach_thread_info (thread->port, THREAD_BASIC_INFO,
+ (int *) &info, &info_len);
if (err)
error (("%s."), safe_strerror (err));
thread->sc = info->suspend_count;
@@ -3366,25 +3270,23 @@ thread_takeover_sc_cmd (const char *args, int from_tty)
info_len * sizeof (int));
}
-
static void
add_thread_commands (void)
{
add_setshow_prefix_cmd ("thread", no_class,
- _("Command prefix for setting thread properties."),
- _("Command prefix for showing thread properties."),
- &set_thread_cmd_list,
- &show_thread_cmd_list,
+ _ ("Command prefix for setting thread properties."),
+ _ ("Command prefix for showing thread properties."),
+ &set_thread_cmd_list, &show_thread_cmd_list,
&setlist, &showlist);
- add_setshow_prefix_cmd ("default", no_class,
- _("Command prefix for setting default thread properties."),
- _("Command prefix for showing default thread properties."),
- &set_thread_default_cmd_list,
- &show_thread_default_cmd_list,
- &set_thread_cmd_list, &show_thread_cmd_list);
+ add_setshow_prefix_cmd (
+ "default", no_class,
+ _ ("Command prefix for setting default thread properties."),
+ _ ("Command prefix for showing default thread properties."),
+ &set_thread_default_cmd_list, &show_thread_default_cmd_list,
+ &set_thread_cmd_list, &show_thread_cmd_list);
- add_cmd ("pause", class_run, set_thread_pause_cmd, _("\
+ add_cmd ("pause", class_run, set_thread_pause_cmd, _ ("\
Set whether the current thread is suspended while gdb has control.\n\
A value of \"on\" takes effect immediately, otherwise nothing happens\n\
until the next time the program is continued. This property normally\n\
@@ -3392,40 +3294,40 @@ has no effect because the whole task is suspended, however, that may\n\
be disabled with \"set task pause off\".\n\
The default value is \"off\"."),
&set_thread_cmd_list);
- add_cmd ("pause", no_class, show_thread_pause_cmd, _("\
+ add_cmd ("pause", no_class, show_thread_pause_cmd, _ ("\
Show whether the current thread is suspended while gdb has control."),
&show_thread_cmd_list);
add_cmd ("run", class_run, set_thread_run_cmd,
- _("Set whether the current thread is allowed to run."),
+ _ ("Set whether the current thread is allowed to run."),
&set_thread_cmd_list);
add_cmd ("run", no_class, show_thread_run_cmd,
- _("Show whether the current thread is allowed to run."),
+ _ ("Show whether the current thread is allowed to run."),
&show_thread_cmd_list);
- add_cmd ("detach-suspend-count", class_run, set_thread_detach_sc_cmd, _("\
+ add_cmd ("detach-suspend-count", class_run, set_thread_detach_sc_cmd, _ ("\
Set the suspend count will leave on the thread when detaching.\n\
Note that this is relative to suspend count when gdb noticed the thread;\n\
use the `thread takeover-suspend-count' to force it to an absolute value."),
&set_thread_cmd_list);
- add_cmd ("detach-suspend-count", no_class, show_thread_detach_sc_cmd, _("\
+ add_cmd ("detach-suspend-count", no_class, show_thread_detach_sc_cmd, _ ("\
Show the suspend count will leave on the thread when detaching.\n\
Note that this is relative to suspend count when gdb noticed the thread;\n\
use the `thread takeover-suspend-count' to force it to an absolute value."),
&show_thread_cmd_list);
cmd_list_element *set_thread_exception_port_cmd_
- = add_cmd ("exception-port", no_class, set_thread_exc_port_cmd, _("\
+ = add_cmd ("exception-port", no_class, set_thread_exc_port_cmd, _ ("\
Set the thread exception port to which we forward exceptions.\n\
This overrides the task exception port.\n\
The argument should be the value of the send right in the task."),
- &set_thread_cmd_list);
+ &set_thread_cmd_list);
add_alias_cmd ("excp", set_thread_exception_port_cmd_, no_class, 1,
&set_thread_cmd_list);
add_alias_cmd ("exc-port", set_thread_exception_port_cmd_, no_class, 1,
&set_thread_cmd_list);
- add_cmd ("takeover-suspend-count", no_class, thread_takeover_sc_cmd, _("\
+ add_cmd ("takeover-suspend-count", no_class, thread_takeover_sc_cmd, _ ("\
Force the threads absolute suspend-count to be gdb's.\n\
Prior to giving this command, gdb's thread suspend-counts are relative\n\
to the thread's initial suspend-count when gdb notices the threads."),
@@ -3433,6 +3335,7 @@ to the thread's initial suspend-count when gdb notices the threads."),
}
void _initialize_gnu_nat ();
+
void
_initialize_gnu_nat ()
{
@@ -3440,18 +3343,13 @@ _initialize_gnu_nat ()
add_task_commands ();
add_thread_commands ();
- add_setshow_boolean_cmd ("gnu-nat", class_maintenance,
- &gnu_debug_flag,
- _("Set debugging output for the gnu backend."),
- _("Show debugging output for the gnu backend."),
- NULL,
- NULL,
- NULL,
- &setdebuglist,
- &showdebuglist);
-}
-
-#ifdef FLUSH_INFERIOR_CACHE
+ add_setshow_boolean_cmd ("gnu-nat", class_maintenance, &gnu_debug_flag,
+ _ ("Set debugging output for the gnu backend."),
+ _ ("Show debugging output for the gnu backend."),
+ NULL, NULL, NULL, &setdebuglist, &showdebuglist);
+}
+
+#ifdef FLUSH_INFERIOR_CACHE
/* When over-writing code on some machines the I-Cache must be flushed
explicitly, because it is not kept coherent by the lazy hardware.
@@ -3464,12 +3362,9 @@ flush_inferior_icache (CORE_ADDR pc, int amount)
vm_machine_attribute_val_t flush = MATTR_VAL_ICACHE_FLUSH;
kern_return_t ret;
- ret = vm_machine_attribute (gnu_current_inf->task->port,
- pc,
- amount,
- MATTR_CACHE,
- &flush);
+ ret = vm_machine_attribute (gnu_current_inf->task->port, pc, amount,
+ MATTR_CACHE, &flush);
if (ret != KERN_SUCCESS)
- warning (_("Error flushing inferior's cache : %s"), safe_strerror (ret));
+ warning (_ ("Error flushing inferior's cache : %s"), safe_strerror (ret));
}
#endif /* FLUSH_INFERIOR_CACHE */
diff --git a/gdb/gnu-nat.h b/gdb/gnu-nat.h
index 42393cda064..bb85fa3cc13 100644
--- a/gdb/gnu-nat.h
+++ b/gdb/gnu-nat.h
@@ -55,41 +55,41 @@ int inf_update_procs (struct inf *inf);
/* A proc is either a thread, or the task (there can only be one task proc
because it always has the same TID, PROC_TID_TASK). */
struct proc
- {
- thread_t port; /* The task or thread port. */
- int tid; /* The GDB pid (actually a thread id). */
- int num; /* An id number for threads, to print. */
-
- mach_port_t saved_exc_port; /* The task/thread's real exception port. */
- mach_port_t exc_port; /* Our replacement, which for. */
-
- int sc; /* Desired suspend count. */
- int cur_sc; /* Implemented suspend count. */
- int run_sc; /* Default sc when the program is running. */
- int pause_sc; /* Default sc when gdb has control. */
- int resume_sc; /* Sc resulting from the last resume. */
- int detach_sc; /* SC to leave around when detaching
+{
+ thread_t port; /* The task or thread port. */
+ int tid; /* The GDB pid (actually a thread id). */
+ int num; /* An id number for threads, to print. */
+
+ mach_port_t saved_exc_port; /* The task/thread's real exception port. */
+ mach_port_t exc_port; /* Our replacement, which for. */
+
+ int sc; /* Desired suspend count. */
+ int cur_sc; /* Implemented suspend count. */
+ int run_sc; /* Default sc when the program is running. */
+ int pause_sc; /* Default sc when gdb has control. */
+ int resume_sc; /* Sc resulting from the last resume. */
+ int detach_sc; /* SC to leave around when detaching
from program. */
- thread_state_data_t state; /* Registers, &c. */
- int state_valid:1; /* True if STATE is up to date. */
- int state_changed:1;
+ thread_state_data_t state; /* Registers, &c. */
+ int state_valid : 1; /* True if STATE is up to date. */
+ int state_changed : 1;
- int aborted:1; /* True if thread_abort has been called. */
- int dead:1; /* We happen to know it's actually dead. */
+ int aborted : 1; /* True if thread_abort has been called. */
+ int dead : 1; /* We happen to know it's actually dead. */
- /* Bit mask of registers fetched by gdb. This is used when we re-fetch
+ /* Bit mask of registers fetched by gdb. This is used when we re-fetch
STATE after aborting the thread, to detect that gdb may have out-of-date
information. */
- unsigned long fetched_regs;
+ unsigned long fetched_regs;
- struct inf *inf; /* Where we come from. */
+ struct inf *inf; /* Where we come from. */
- struct proc *next;
- };
+ struct proc *next;
+};
/* The task has a thread entry with this TID. */
-#define PROC_TID_TASK (-1)
+#define PROC_TID_TASK (-1)
#define proc_is_task(proc) ((proc)->tid == PROC_TID_TASK)
#define proc_is_thread(proc) ((proc)->tid != PROC_TID_TASK)
@@ -99,18 +99,25 @@ extern int __proc_pid (struct proc *proc);
/* Return printable description of proc. */
extern char *proc_string (struct proc *proc);
-#define proc_debug(_proc, msg, args...) \
- do { struct proc *__proc = (_proc); \
- debug ("{proc %d/%d %s}: " msg, \
- __proc_pid (__proc), __proc->tid, \
- host_address_to_string (__proc) , ##args); } while (0)
+#define proc_debug(_proc, msg, args...) \
+ do \
+ { \
+ struct proc *__proc = (_proc); \
+ debug ("{proc %d/%d %s}: " msg, __proc_pid (__proc), __proc->tid, \
+ host_address_to_string (__proc), ##args); \
+ } \
+ while (0)
extern bool gnu_debug_flag;
-#define debug(msg, args...) \
- do { if (gnu_debug_flag) \
- gdb_printf (gdb_stdlog, "%s:%d: " msg "\r\n", \
- __FILE__ , __LINE__ , ##args); } while (0)
+#define debug(msg, args...) \
+ do \
+ { \
+ if (gnu_debug_flag) \
+ gdb_printf (gdb_stdlog, "%s:%d: " msg "\r\n", __FILE__, __LINE__, \
+ ##args); \
+ } \
+ while (0)
/* A prototype generic GNU/Hurd target. The client can override it
with local methods. */
@@ -118,26 +125,24 @@ extern bool gnu_debug_flag;
struct gnu_nat_target : public inf_child_target
{
void attach (const char *, int) override;
- bool attach_no_wait () override
- { return true; }
+
+ bool attach_no_wait () override { return true; }
void detach (inferior *, int) override;
void resume (ptid_t, int, enum gdb_signal) override;
ptid_t wait (ptid_t, struct target_waitstatus *, target_wait_flags) override;
enum target_xfer_status xfer_partial (enum target_object object,
- const char *annex,
- gdb_byte *readbuf,
+ const char *annex, gdb_byte *readbuf,
const gdb_byte *writebuf,
ULONGEST offset, ULONGEST len,
ULONGEST *xfered_len) override;
- int find_memory_regions (find_memory_region_ftype func, void *data)
- override;
+ int find_memory_regions (find_memory_region_ftype func, void *data) override;
void kill () override;
- void create_inferior (const char *, const std::string &,
- char **, int) override;
+ void create_inferior (const char *, const std::string &, char **,
+ int) override;
void mourn_inferior () override;
bool thread_alive (ptid_t ptid) override;
std::string pid_to_str (ptid_t) override;
@@ -155,6 +160,7 @@ struct gnu_nat_target : public inf_child_target
thread_state_t proc_get_state (struct proc *proc, int will_modify);
private:
+
void inf_clear_wait (struct inf *inf);
void inf_cleanup (struct inf *inf);
void inf_startup (struct inf *inf, int pid);
@@ -164,8 +170,7 @@ private:
void inf_validate_procinfo (struct inf *inf);
void inf_validate_task_sc (struct inf *inf);
void inf_restore_exc_ports (struct inf *inf);
- void inf_set_threads_resume_sc (struct inf *inf,
- struct proc *run_thread,
+ void inf_set_threads_resume_sc (struct inf *inf, struct proc *run_thread,
int run_others);
int inf_set_threads_resume_sc_for_signal_thread (struct inf *inf);
void inf_resume (struct inf *inf);
@@ -179,7 +184,7 @@ private:
void proc_abort (struct proc *proc, int force);
struct proc *_proc_free (struct proc *proc);
int proc_update_sc (struct proc *proc);
- kern_return_t proc_get_exception_port (struct proc *proc, mach_port_t * port);
+ kern_return_t proc_get_exception_port (struct proc *proc, mach_port_t *port);
kern_return_t proc_set_exception_port (struct proc *proc, mach_port_t port);
mach_port_t _proc_get_exc_port (struct proc *proc);
void proc_steal_exc_port (struct proc *proc, mach_port_t exc_port);
diff --git a/gdb/gnu-v2-abi.c b/gdb/gnu-v2-abi.c
index cee45ead123..6c46c38bc70 100644
--- a/gdb/gnu-v2-abi.c
+++ b/gdb/gnu-v2-abi.c
@@ -60,9 +60,9 @@ gnuv2_is_vtable_name (const char *name)
return (((name)[0] == '_'
&& (((name)[1] == 'V' && (name)[2] == 'T')
|| ((name)[1] == 'v' && (name)[2] == 't'))
- && is_cplus_marker ((name)[3])) ||
- ((name)[0] == '_' && (name)[1] == '_'
- && (name)[2] == 'v' && (name)[3] == 't' && (name)[4] == '_'));
+ && is_cplus_marker ((name)[3]))
+ || ((name)[0] == '_' && (name)[1] == '_' && (name)[2] == 'v'
+ && (name)[3] == 't' && (name)[4] == '_'));
}
static int
@@ -71,7 +71,6 @@ gnuv2_is_operator_name (const char *name)
return startswith (name, CP_OPERATOR_STR);
}
-
/* Return a virtual function as a value.
ARG1 is the object which provides the virtual function
table pointer. *ARG1P is side-effected in calling this function.
@@ -81,8 +80,8 @@ gnuv2_is_operator_name (const char *name)
TYPE is the type in which F is located. */
static struct value *
-gnuv2_virtual_fn_field (struct value **arg1p, struct fn_field * f, int j,
- struct type * type, int offset)
+gnuv2_virtual_fn_field (struct value **arg1p, struct fn_field *f, int j,
+ struct type *type, int offset)
{
struct value *arg1 = *arg1p;
struct type *type1 = check_typedef (value_type (arg1));
@@ -159,7 +158,7 @@ gnuv2_virtual_fn_field (struct value **arg1p, struct fn_field * f, int j,
{
/* Move the `this' pointer according to the virtual function table. */
set_value_offset (arg1, value_offset (arg1)
- + value_as_long (value_field (entry, 0)));
+ + value_as_long (value_field (entry, 0)));
if (!value_lazy (arg1))
{
@@ -172,7 +171,7 @@ gnuv2_virtual_fn_field (struct value **arg1p, struct fn_field * f, int j,
else if (entry_type->code () == TYPE_CODE_PTR)
vfn = entry;
else
- error (_("I'm confused: virtual function table has bad type"));
+ error (_ ("I'm confused: virtual function table has bad type"));
/* Reinstantiate the function pointer with the correct type. */
deprecated_set_value_type (vfn,
lookup_pointer_type (TYPE_FN_FIELD_TYPE (f, j)));
@@ -181,9 +180,9 @@ gnuv2_virtual_fn_field (struct value **arg1p, struct fn_field * f, int j,
return vfn;
}
-
static struct type *
-gnuv2_value_rtti_type (struct value *v, int *full, LONGEST *top, int *using_enc)
+gnuv2_value_rtti_type (struct value *v, int *full, LONGEST *top,
+ int *using_enc)
{
struct type *known_type;
struct type *rtti_type;
@@ -215,8 +214,8 @@ gnuv2_value_rtti_type (struct value *v, int *full, LONGEST *top, int *using_enc)
until then. */
/* Try to get the vptr basetype, fieldno. */
- known_type_vptr_fieldno = get_vptr_fieldno (known_type,
- &known_type_vptr_basetype);
+ known_type_vptr_fieldno
+ = get_vptr_fieldno (known_type, &known_type_vptr_basetype);
/* If we can't find it, give up. */
if (known_type_vptr_fieldno < 0)
@@ -226,11 +225,11 @@ gnuv2_value_rtti_type (struct value *v, int *full, LONGEST *top, int *using_enc)
so we can get at the vtable properly. */
btype = known_type_vptr_basetype;
btype = check_typedef (btype);
- if (btype != known_type )
+ if (btype != known_type)
{
v = value_cast (btype, v);
if (using_enc)
- *using_enc=1;
+ *using_enc = 1;
}
/* We can't use value_ind here, because it would want to use RTTI, and
we'd waste a bunch of time figuring out we already know the type.
@@ -241,15 +240,15 @@ gnuv2_value_rtti_type (struct value *v, int *full, LONGEST *top, int *using_enc)
vtbl = value_as_address (value_field (v, known_type_vptr_fieldno));
/* Try to find a symbol that is the vtable. */
- minsym=lookup_minimal_symbol_by_pc(vtbl);
- if (minsym.minsym==NULL
- || (linkage_name=minsym.minsym->linkage_name ())==NULL
+ minsym = lookup_minimal_symbol_by_pc (vtbl);
+ if (minsym.minsym == NULL
+ || (linkage_name = minsym.minsym->linkage_name ()) == NULL
|| !is_vtable_name (linkage_name))
return NULL;
/* If we just skip the prefix, we get screwed by namespaces. */
gdb::unique_xmalloc_ptr<char> demangled_name
- = gdb_demangle(linkage_name,DMGL_PARAMS|DMGL_ANSI);
+ = gdb_demangle (linkage_name, DMGL_PARAMS | DMGL_ANSI);
p = strchr (demangled_name.get (), ' ');
if (p)
*p = '\0';
@@ -260,29 +259,29 @@ gnuv2_value_rtti_type (struct value *v, int *full, LONGEST *top, int *using_enc)
if (rtti_type == NULL)
return NULL;
- if (TYPE_N_BASECLASSES(rtti_type) > 1 && full && (*full) != 1)
+ if (TYPE_N_BASECLASSES (rtti_type) > 1 && full && (*full) != 1)
{
if (top)
- *top = TYPE_BASECLASS_BITPOS (rtti_type,
- TYPE_VPTR_FIELDNO(rtti_type)) / 8;
- if (top && ((*top) >0))
+ *top = TYPE_BASECLASS_BITPOS (rtti_type, TYPE_VPTR_FIELDNO (rtti_type))
+ / 8;
+ if (top && ((*top) > 0))
{
if (rtti_type->length () > known_type->length ())
{
if (full)
- *full=0;
+ *full = 0;
}
else
{
if (full)
- *full=1;
+ *full = 1;
}
}
}
else
{
if (full)
- *full=1;
+ *full = 1;
}
return rtti_type;
@@ -314,8 +313,7 @@ vb_match (struct type *type, int index, struct type *basetype)
/* It's a virtual baseclass pointer, now we just need to find out whether
it is for this baseclass. */
fieldtype = type->field (index).type ();
- if (fieldtype == NULL
- || fieldtype->code () != TYPE_CODE_PTR)
+ if (fieldtype == NULL || fieldtype->code () != TYPE_CODE_PTR)
/* "Can't happen". */
return 0;
@@ -326,10 +324,8 @@ vb_match (struct type *type, int index, struct type *basetype)
if (fieldtype->target_type () == basetype)
return 1;
- if (basetype->name () != NULL
- && fieldtype->target_type ()->name () != NULL
- && strcmp (basetype->name (),
- fieldtype->target_type ()->name ()) == 0)
+ if (basetype->name () != NULL && fieldtype->target_type ()->name () != NULL
+ && strcmp (basetype->name (), fieldtype->target_type ()->name ()) == 0)
return 1;
return 0;
}
@@ -340,9 +336,9 @@ vb_match (struct type *type, int index, struct type *basetype)
to (the address of)(ARG) + OFFSET. */
static int
-gnuv2_baseclass_offset (struct type *type, int index,
- const bfd_byte *valaddr, LONGEST embedded_offset,
- CORE_ADDR address, const struct value *val)
+gnuv2_baseclass_offset (struct type *type, int index, const bfd_byte *valaddr,
+ LONGEST embedded_offset, CORE_ADDR address,
+ const struct value *val)
{
struct type *basetype = TYPE_BASECLASS (type, index);
@@ -370,7 +366,7 @@ gnuv2_baseclass_offset (struct type *type, int index,
if (!value_bytes_available (val, embedded_offset + field_offset,
field_length))
throw_error (NOT_AVAILABLE_ERROR,
- _("Virtual baseclass pointer is not available"));
+ _ ("Virtual baseclass pointer is not available"));
addr = unpack_pointer (field_type,
valaddr + embedded_offset + field_offset);
@@ -384,15 +380,14 @@ gnuv2_baseclass_offset (struct type *type, int index,
/* Don't go through baseclass_offset, as that wraps
exceptions, thus, inner exceptions would be wrapped more
than once. */
- int boffset =
- gnuv2_baseclass_offset (type, i, valaddr,
- embedded_offset, address, val);
+ int boffset = gnuv2_baseclass_offset (type, i, valaddr,
+ embedded_offset, address, val);
if (boffset)
return boffset;
}
- error (_("Baseclass offset not found"));
+ error (_ ("Baseclass offset not found"));
}
/* Baseclass is easily computed. */
@@ -415,6 +410,7 @@ init_gnuv2_ops (void)
}
void _initialize_gnu_v2_abi ();
+
void
_initialize_gnu_v2_abi ()
{
diff --git a/gdb/gnu-v3-abi.c b/gdb/gnu-v3-abi.c
index 6f5b87f1308..72547b127d8 100644
--- a/gdb/gnu-v3-abi.c
+++ b/gdb/gnu-v3-abi.c
@@ -41,7 +41,6 @@ static struct cp_abi_ops gnu_v3_abi_ops;
static const registry<gdbarch>::key<struct type> std_type_info_gdbarch_data;
-
static int
gnuv3_is_vtable_name (const char *name)
{
@@ -54,7 +53,6 @@ gnuv3_is_operator_name (const char *name)
return startswith (name, CP_OPERATOR_STR);
}
-
/* To help us find the components of a vtable, we build ourselves a
GDB type object representing the vtable structure. Following the
V3 ABI, it goes something like this:
@@ -94,16 +92,15 @@ gnuv3_is_operator_name (const char *name)
appropriately for the architecture. */
static const registry<gdbarch>::key<struct type> vtable_type_gdbarch_data;
-
/* Human-readable names for the numbers of the fields above. */
-enum {
+enum
+{
vtable_field_vcall_and_vbase_offsets,
vtable_field_offset_to_top,
vtable_field_type_info,
vtable_field_virtual_functions
};
-
/* Return a GDB type representing `struct gdb_gnu_v3_abi_vtable',
described above, laid out appropriately for ARCH.
@@ -120,10 +117,8 @@ get_gdb_vtable_type (struct gdbarch *arch)
if (result != nullptr)
return result;
- struct type *void_ptr_type
- = builtin_type (arch)->builtin_data_ptr;
- struct type *ptr_to_void_fn_type
- = builtin_type (arch)->builtin_func_ptr;
+ struct type *void_ptr_type = builtin_type (arch)->builtin_data_ptr;
+ struct type *ptr_to_void_fn_type = builtin_type (arch)->builtin_func_ptr;
/* ARCH can't give us the true ptrdiff_t type, so we guess. */
struct type *ptrdiff_type
@@ -181,7 +176,6 @@ get_gdb_vtable_type (struct gdbarch *arch)
return result;
}
-
/* Return the ptrdiff_t type used in the vtable type. */
static struct type *
vtable_ptrdiff_type (struct gdbarch *gdbarch)
@@ -204,7 +198,6 @@ vtable_address_point_offset (struct gdbarch *gdbarch)
/ TARGET_CHAR_BIT);
}
-
/* Determine whether structure TYPE is a dynamic class. Cache the
result. */
@@ -255,8 +248,8 @@ gnuv3_dynamic_class (struct type *type)
architecture, or NULL if CONTAINER does not have a vtable. */
static struct value *
-gnuv3_get_vtable (struct gdbarch *gdbarch,
- struct type *container_type, CORE_ADDR container_addr)
+gnuv3_get_vtable (struct gdbarch *gdbarch, struct type *container_type,
+ CORE_ADDR container_addr)
{
struct type *vtable_type = get_gdb_vtable_type (gdbarch);
struct type *vtable_pointer_type;
@@ -289,13 +282,12 @@ gnuv3_get_vtable (struct gdbarch *gdbarch,
than the address point. */
return value_at_lazy (vtable_type,
vtable_address
- - vtable_address_point_offset (gdbarch));
+ - vtable_address_point_offset (gdbarch));
}
-
static struct type *
-gnuv3_rtti_type (struct value *value,
- int *full_p, LONGEST *top_p, int *using_enc_p)
+gnuv3_rtti_type (struct value *value, int *full_p, LONGEST *top_p,
+ int *using_enc_p)
{
struct gdbarch *gdbarch;
struct type *values_type = check_typedef (value_type (value));
@@ -326,10 +318,11 @@ gnuv3_rtti_type (struct value *value,
/* Find the linker symbol for this vtable. */
vtable_symbol
= lookup_minimal_symbol_by_pc (value_address (vtable)
- + value_embedded_offset (vtable)).minsym;
- if (! vtable_symbol)
+ + value_embedded_offset (vtable))
+ .minsym;
+ if (!vtable_symbol)
return NULL;
-
+
/* The symbol's demangled name should be something like "vtable for
CLASS", where CLASS is the name of the run-time type of VALUE.
If we didn't like this approach, we could instead look in the
@@ -339,10 +332,10 @@ gnuv3_rtti_type (struct value *value,
if (vtable_symbol_name == NULL
|| !startswith (vtable_symbol_name, "vtable for "))
{
- warning (_("can't find linker symbol for virtual table for `%s' value"),
+ warning (_ ("can't find linker symbol for virtual table for `%s' value"),
TYPE_SAFE_NAME (values_type));
if (vtable_symbol_name)
- warning (_(" found `%s' instead"), vtable_symbol_name);
+ warning (_ (" found `%s' instead"), vtable_symbol_name);
return NULL;
}
class_name = vtable_symbol_name + 11;
@@ -371,11 +364,11 @@ gnuv3_rtti_type (struct value *value,
= value_as_long (value_field (vtable, vtable_field_offset_to_top));
if (full_p)
- *full_p = (- offset_to_top == value_embedded_offset (value)
+ *full_p = (-offset_to_top == value_embedded_offset (value)
&& (value_enclosing_type (value)->length ()
>= run_time_type->length ()));
if (top_p)
- *top_p = - offset_to_top;
+ *top_p = -offset_to_top;
return run_time_type;
}
@@ -415,8 +408,7 @@ gnuv3_get_virtual_fn (struct gdbarch *gdbarch, struct value *container,
for a description of the arguments. */
static struct value *
-gnuv3_virtual_fn_field (struct value **value_p,
- struct fn_field *f, int j,
+gnuv3_virtual_fn_field (struct value **value_p, struct fn_field *f, int j,
struct type *vfn_base, int offset)
{
struct type *values_type = check_typedef (value_type (*value_p));
@@ -424,7 +416,7 @@ gnuv3_virtual_fn_field (struct value **value_p,
/* Some simple sanity checks. */
if (values_type->code () != TYPE_CODE_STRUCT)
- error (_("Only classes can have virtual functions."));
+ error (_ ("Only classes can have virtual functions."));
/* Determine architecture. */
gdbarch = values_type->arch ();
@@ -448,9 +440,9 @@ gnuv3_virtual_fn_field (struct value **value_p,
-1 is returned on error. */
static int
-gnuv3_baseclass_offset (struct type *type, int index,
- const bfd_byte *valaddr, LONGEST embedded_offset,
- CORE_ADDR address, const struct value *val)
+gnuv3_baseclass_offset (struct type *type, int index, const bfd_byte *valaddr,
+ LONGEST embedded_offset, CORE_ADDR address,
+ const struct value *val)
{
struct gdbarch *gdbarch;
struct type *ptr_type;
@@ -471,8 +463,7 @@ gnuv3_baseclass_offset (struct type *type, int index,
if (type->field (index).loc_kind () == FIELD_LOC_KIND_DWARF_BLOCK)
{
struct dwarf2_property_baton baton;
- baton.property_type
- = lookup_pointer_type (type->field (index).type ());
+ baton.property_type = lookup_pointer_type (type->field (index).type ());
baton.locexpr = *type->field (index).loc_dwarf_block ();
struct dynamic_prop prop;
@@ -487,7 +478,7 @@ gnuv3_baseclass_offset (struct type *type, int index,
CORE_ADDR result;
if (dwarf2_evaluate_property (&prop, nullptr, &addr_stack, &result,
- {addr_stack.addr}))
+ { addr_stack.addr }))
return (int) (result - addr_stack.addr);
}
@@ -497,12 +488,12 @@ gnuv3_baseclass_offset (struct type *type, int index,
complete inheritance graph based on the debug info. Neither is
worthwhile. */
cur_base_offset = TYPE_BASECLASS_BITPOS (type, index) / 8;
- if (cur_base_offset >= - vtable_address_point_offset (gdbarch))
- error (_("Expected a negative vbase offset (old compiler?)"));
+ if (cur_base_offset >= -vtable_address_point_offset (gdbarch))
+ error (_ ("Expected a negative vbase offset (old compiler?)"));
cur_base_offset = cur_base_offset + vtable_address_point_offset (gdbarch);
- if ((- cur_base_offset) % ptr_type->length () != 0)
- error (_("Misaligned vbase offset."));
+ if ((-cur_base_offset) % ptr_type->length () != 0)
+ error (_ ("Misaligned vbase offset."));
cur_base_offset = cur_base_offset / ((int) ptr_type->length ());
vtable = gnuv3_get_vtable (gdbarch, type, address + embedded_offset);
@@ -567,10 +558,8 @@ gnuv3_find_method_in (struct type *domain, CORE_ADDR voffset,
/* Decode GNU v3 method pointer. */
static int
-gnuv3_decode_method_ptr (struct gdbarch *gdbarch,
- const gdb_byte *contents,
- CORE_ADDR *value_p,
- LONGEST *adjustment_p)
+gnuv3_decode_method_ptr (struct gdbarch *gdbarch, const gdb_byte *contents,
+ CORE_ADDR *value_p, LONGEST *adjustment_p)
{
struct type *funcptr_type = builtin_type (gdbarch)->builtin_func_ptr;
struct type *offset_type = vtable_ptrdiff_type (gdbarch);
@@ -586,11 +575,11 @@ gnuv3_decode_method_ptr (struct gdbarch *gdbarch,
yet know which case we have, so we extract the value under both
interpretations and choose the right one later on. */
ptr_value = extract_typed_address (contents, funcptr_type);
- voffset = extract_signed_integer (contents,
- funcptr_type->length (), byte_order);
+ voffset
+ = extract_signed_integer (contents, funcptr_type->length (), byte_order);
contents += funcptr_type->length ();
- adjustment = extract_signed_integer (contents,
- offset_type->length (), byte_order);
+ adjustment
+ = extract_signed_integer (contents, offset_type->length (), byte_order);
if (!gdbarch_vbit_in_delta (gdbarch))
{
@@ -603,7 +592,7 @@ gnuv3_decode_method_ptr (struct gdbarch *gdbarch,
adjustment = adjustment >> 1;
}
- *value_p = vbit? voffset : ptr_value;
+ *value_p = vbit ? voffset : ptr_value;
*adjustment_p = adjustment;
return vbit;
}
@@ -611,8 +600,7 @@ gnuv3_decode_method_ptr (struct gdbarch *gdbarch,
/* GNU v3 implementation of cplus_print_method_ptr. */
static void
-gnuv3_print_method_ptr (const gdb_byte *contents,
- struct type *type,
+gnuv3_print_method_ptr (const gdb_byte *contents, struct type *type,
struct ui_file *stream)
{
struct type *self_type = TYPE_SELF_TYPE (type);
@@ -700,8 +688,8 @@ gnuv3_method_ptr_size (struct type *type)
/* GNU v3 implementation of cplus_make_method_ptr. */
static void
-gnuv3_make_method_ptr (struct type *type, gdb_byte *contents,
- CORE_ADDR value, int is_virtual)
+gnuv3_make_method_ptr (struct type *type, gdb_byte *contents, CORE_ADDR value,
+ int is_virtual)
{
struct gdbarch *gdbarch = type->arch ();
int size = builtin_type (gdbarch)->builtin_data_ptr->length ();
@@ -777,8 +765,8 @@ gnuv3_method_ptr_to_value (struct value **this_p, struct value *method_ptr)
LONGEST voffset;
voffset = ptr_value / vtable_ptrdiff_type (gdbarch)->length ();
- return gnuv3_get_virtual_fn (gdbarch, value_ind (*this_p),
- method_type, voffset);
+ return gnuv3_get_virtual_fn (gdbarch, value_ind (*this_p), method_type,
+ voffset);
}
else
return value_from_pointer (lookup_pointer_type (method_type), ptr_value);
@@ -825,10 +813,10 @@ static bool
compare_value_and_voffset (const struct value_and_voffset *va,
const struct value_and_voffset *vb)
{
- CORE_ADDR addra = (value_address (va->value)
- + value_embedded_offset (va->value));
- CORE_ADDR addrb = (value_address (vb->value)
- + value_embedded_offset (vb->value));
+ CORE_ADDR addra
+ = (value_address (va->value) + value_embedded_offset (va->value));
+ CORE_ADDR addrb
+ = (value_address (vb->value) + value_embedded_offset (vb->value));
return addra < addrb;
}
@@ -898,23 +886,21 @@ compute_vtable_size (htab_t offset_hash,
static void
print_one_vtable (struct gdbarch *gdbarch, struct value *value,
- int max_voffset,
- struct value_print_options *opts)
+ int max_voffset, struct value_print_options *opts)
{
int i;
struct type *type = check_typedef (value_type (value));
struct value *vtable;
CORE_ADDR vt_addr;
- vtable = gnuv3_get_vtable (gdbarch, type,
- value_address (value)
- + value_embedded_offset (value));
- vt_addr = value_address (value_field (vtable,
- vtable_field_virtual_functions));
+ vtable
+ = gnuv3_get_vtable (gdbarch, type,
+ value_address (value) + value_embedded_offset (value));
+ vt_addr
+ = value_address (value_field (vtable, vtable_field_virtual_functions));
- gdb_printf (_("vtable for '%s' @ %s (subobject @ %s):\n"),
- TYPE_SAFE_NAME (type),
- paddress (gdbarch, vt_addr),
+ gdb_printf (_ ("vtable for '%s' @ %s (subobject @ %s):\n"),
+ TYPE_SAFE_NAME (type), paddress (gdbarch, vt_addr),
paddress (gdbarch, (value_address (value)
+ value_embedded_offset (value))));
@@ -941,7 +927,7 @@ print_one_vtable (struct gdbarch *gdbarch, struct value *value,
catch (const gdb_exception_error &ex)
{
fprintf_styled (gdb_stdout, metadata_style.style (),
- _("<error: %s>"), ex.what ());
+ _ ("<error: %s>"), ex.what ());
got_error = 1;
}
@@ -988,13 +974,13 @@ gnuv3_print_vtable (struct value *value)
if (!vtable)
{
- gdb_printf (_("This object does not have a virtual function table\n"));
+ gdb_printf (_ ("This object does not have a virtual function table\n"));
return;
}
htab_up offset_hash (htab_create_alloc (1, hash_value_and_voffset,
- eq_value_and_voffset,
- xfree, xcalloc, xfree));
+ eq_value_and_voffset, xfree, xcalloc,
+ xfree));
std::vector<value_and_voffset *> result_vec;
compute_vtable_size (offset_hash.get (), &result_vec, value);
@@ -1026,10 +1012,8 @@ build_std_type_info_type (struct gdbarch *arch)
struct type *t;
struct field *field_list, *field;
int offset;
- struct type *void_ptr_type
- = builtin_type (arch)->builtin_data_ptr;
- struct type *char_type
- = builtin_type (arch)->builtin_char;
+ struct type *void_ptr_type = builtin_type (arch)->builtin_data_ptr;
+ struct type *char_type = builtin_type (arch)->builtin_char;
struct type *char_ptr_type
= make_pointer_type (make_cv_type (1, 0, char_type, NULL), NULL);
@@ -1070,8 +1054,8 @@ gnuv3_get_typeid_type (struct gdbarch *gdbarch)
struct symbol *typeinfo;
struct type *typeinfo_type;
- typeinfo = lookup_symbol ("std::type_info", NULL, STRUCT_DOMAIN,
- NULL).symbol;
+ typeinfo
+ = lookup_symbol ("std::type_info", NULL, STRUCT_DOMAIN, NULL).symbol;
if (typeinfo == NULL)
{
typeinfo_type = std_type_info_gdbarch_data.get (gdbarch);
@@ -1118,32 +1102,30 @@ gnuv3_get_typeid (struct value *value)
type_name = type_to_string (type);
if (type_name.empty ())
- error (_("cannot find typeinfo for unnamed type"));
+ error (_ ("cannot find typeinfo for unnamed type"));
/* We need to canonicalize the type name here, because we do lookups
using the demangled name, and so we must match the format it
uses. E.g., GDB tends to use "const char *" as a type name, but
the demangler uses "char const *". */
canonical = cp_canonicalize_string (type_name.c_str ());
- const char *name = (canonical == nullptr
- ? type_name.c_str ()
- : canonical.get ());
+ const char *name
+ = (canonical == nullptr ? type_name.c_str () : canonical.get ());
typeinfo_type = gnuv3_get_typeid_type (gdbarch);
/* We check for lval_memory because in the "typeid (type-id)" case,
the type is passed via a not_lval value object. */
if (type->code () == TYPE_CODE_STRUCT
- && value_lval_const (value) == lval_memory
- && gnuv3_dynamic_class (type))
+ && value_lval_const (value) == lval_memory && gnuv3_dynamic_class (type))
{
struct value *vtable, *typeinfo_value;
- CORE_ADDR address = value_address (value) + value_embedded_offset (value);
+ CORE_ADDR address
+ = value_address (value) + value_embedded_offset (value);
vtable = gnuv3_get_vtable (gdbarch, type, address);
if (vtable == NULL)
- error (_("cannot find typeinfo for object of type '%s'"),
- name);
+ error (_ ("cannot find typeinfo for object of type '%s'"), name);
typeinfo_value = value_field (vtable, vtable_field_type_info);
result = value_ind (value_cast (make_pointer_type (typeinfo_type, NULL),
typeinfo_value));
@@ -1155,7 +1137,7 @@ gnuv3_get_typeid (struct value *value)
= lookup_minimal_symbol (sym_name.c_str (), NULL, NULL);
if (minsym.minsym == NULL)
- error (_("could not find typeinfo symbol for '%s'"), name);
+ error (_ ("could not find typeinfo symbol for '%s'"), name);
result = value_at_lazy (typeinfo_type, minsym.value_address ());
}
@@ -1178,15 +1160,15 @@ gnuv3_get_typename_from_type_info (struct value *type_info_ptr)
addr = value_as_address (type_info_ptr);
typeinfo_sym = lookup_minimal_symbol_by_pc (addr);
if (typeinfo_sym.minsym == NULL)
- error (_("could not find minimal symbol for typeinfo address %s"),
+ error (_ ("could not find minimal symbol for typeinfo address %s"),
paddress (gdbarch, addr));
#define TYPEINFO_PREFIX "typeinfo for "
#define TYPEINFO_PREFIX_LEN (sizeof (TYPEINFO_PREFIX) - 1)
symname = typeinfo_sym.minsym->demangled_name ();
- if (symname == NULL || strncmp (symname, TYPEINFO_PREFIX,
- TYPEINFO_PREFIX_LEN))
- error (_("typeinfo symbol '%s' has unexpected name"),
+ if (symname == NULL
+ || strncmp (symname, TYPEINFO_PREFIX, TYPEINFO_PREFIX_LEN))
+ error (_ ("typeinfo symbol '%s' has unexpected name"),
typeinfo_sym.minsym->linkage_name ());
class_name = symname + TYPEINFO_PREFIX_LEN;
@@ -1215,7 +1197,7 @@ gnuv3_get_type_from_type_info (struct value *type_info_ptr)
/* Determine if we are currently in a C++ thunk. If so, get the address
of the routine we are thunking to and continue to there instead. */
-static CORE_ADDR
+static CORE_ADDR
gnuv3_skip_trampoline (frame_info_ptr frame, CORE_ADDR stop_pc)
{
CORE_ADDR real_stop_pc, method_stop_pc, func_addr;
@@ -1223,7 +1205,7 @@ gnuv3_skip_trampoline (frame_info_ptr frame, CORE_ADDR stop_pc)
struct bound_minimal_symbol thunk_sym, fn_sym;
struct obj_section *section;
const char *thunk_name, *fn_name;
-
+
real_stop_pc = gdbarch_skip_trampoline_code (gdbarch, frame, stop_pc);
if (real_stop_pc == 0)
real_stop_pc = stop_pc;
@@ -1252,13 +1234,13 @@ gnuv3_skip_trampoline (frame_info_ptr frame, CORE_ADDR stop_pc)
(powerpc 64 for example). Make sure to retrieve the address
of the real function from the function descriptor before passing on
the address to other layers of GDB. */
- func_addr = gdbarch_convert_from_func_ptr_addr
- (gdbarch, method_stop_pc, current_inferior ()->top_target ());
+ func_addr
+ = gdbarch_convert_from_func_ptr_addr (gdbarch, method_stop_pc,
+ current_inferior ()->top_target ());
if (func_addr != 0)
method_stop_pc = func_addr;
- real_stop_pc = gdbarch_skip_trampoline_code
- (gdbarch, frame, method_stop_pc);
+ real_stop_pc = gdbarch_skip_trampoline_code (gdbarch, frame, method_stop_pc);
if (real_stop_pc == 0)
real_stop_pc = method_stop_pc;
@@ -1328,8 +1310,7 @@ is_implicit_def (definition_style def)
static bool
is_copy_or_move_constructor_type (struct type *class_type,
- struct type *method_type,
- type_code expected)
+ struct type *method_type, type_code expected)
{
/* The method should take at least two arguments... */
if (method_type->num_fields () < 2)
@@ -1369,8 +1350,7 @@ is_copy_or_move_constructor_type (struct type *class_type,
/* Return true if METHOD_TYPE is a copy ctor type for CLASS_TYPE. */
static bool
-is_copy_constructor_type (struct type *class_type,
- struct type *method_type)
+is_copy_constructor_type (struct type *class_type, struct type *method_type)
{
return is_copy_or_move_constructor_type (class_type, method_type,
TYPE_CODE_REF);
@@ -1379,8 +1359,7 @@ is_copy_constructor_type (struct type *class_type,
/* Return true if METHOD_TYPE is a move ctor type for CLASS_TYPE. */
static bool
-is_move_constructor_type (struct type *class_type,
- struct type *method_type)
+is_move_constructor_type (struct type *class_type, struct type *method_type)
{
return is_copy_or_move_constructor_type (class_type, method_type,
TYPE_CODE_RVALUE_REF);
@@ -1422,8 +1401,7 @@ gnuv3_pass_by_reference (struct type *type)
definition_style mctor_def = DOES_NOT_EXIST_IN_SOURCE;
/* We're only interested in things that can have methods. */
- if (type->code () != TYPE_CODE_STRUCT
- && type->code () != TYPE_CODE_UNION)
+ if (type->code () != TYPE_CODE_STRUCT && type->code () != TYPE_CODE_UNION)
return info;
/* The compiler may have emitted the calling convention attribute.
@@ -1502,9 +1480,8 @@ gnuv3_pass_by_reference (struct type *type)
}
}
- bool cctor_implicitly_deleted
- = (mctor_def != DOES_NOT_EXIST_IN_SOURCE
- && cctor_def == DOES_NOT_EXIST_IN_SOURCE);
+ bool cctor_implicitly_deleted = (mctor_def != DOES_NOT_EXIST_IN_SOURCE
+ && cctor_def == DOES_NOT_EXIST_IN_SOURCE);
bool cctor_explicitly_deleted = (cctor_def == DELETED);
@@ -1517,12 +1494,10 @@ gnuv3_pass_by_reference (struct type *type)
info.trivially_destructible = is_implicit_def (dtor_def);
info.trivially_copy_constructible
- = (is_implicit_def (cctor_def)
- && !is_dynamic);
+ = (is_implicit_def (cctor_def) && !is_dynamic);
info.trivially_copyable
- = (info.trivially_copy_constructible
- && info.trivially_destructible
+ = (info.trivially_copy_constructible && info.trivially_destructible
&& !is_user_provided_def (mctor_def));
/* Even if all the constructors and destructors were artificial, one
@@ -1573,10 +1548,10 @@ init_gnuv3_ops (void)
gnu_v3_abi_ops.shortname = "gnu-v3";
gnu_v3_abi_ops.longname = "GNU G++ Version 3 ABI";
gnu_v3_abi_ops.doc = "G++ Version 3 ABI";
- gnu_v3_abi_ops.is_destructor_name =
- (enum dtor_kinds (*) (const char *))is_gnu_v3_mangled_dtor;
- gnu_v3_abi_ops.is_constructor_name =
- (enum ctor_kinds (*) (const char *))is_gnu_v3_mangled_ctor;
+ gnu_v3_abi_ops.is_destructor_name
+ = (enum dtor_kinds (*) (const char *)) is_gnu_v3_mangled_dtor;
+ gnu_v3_abi_ops.is_constructor_name
+ = (enum ctor_kinds (*) (const char *)) is_gnu_v3_mangled_ctor;
gnu_v3_abi_ops.is_vtable_name = gnuv3_is_vtable_name;
gnu_v3_abi_ops.is_operator_name = gnuv3_is_operator_name;
gnu_v3_abi_ops.rtti_type = gnuv3_rtti_type;
@@ -1597,6 +1572,7 @@ init_gnuv3_ops (void)
}
void _initialize_gnu_v3_abi ();
+
void
_initialize_gnu_v3_abi ()
{
diff --git a/gdb/go-lang.c b/gdb/go-lang.c
index 7549f14dc63..39435633841 100644
--- a/gdb/go-lang.c
+++ b/gdb/go-lang.c
@@ -106,8 +106,7 @@ gccgo_string_p (struct type *type)
static int
sixg_string_p (struct type *type)
{
- if (type->num_fields () == 2
- && type->name () != NULL
+ if (type->num_fields () == 2 && type->name () != NULL
&& strcmp (type->name (), "string") == 0)
return 1;
@@ -124,8 +123,7 @@ go_classify_struct_type (struct type *type)
/* Recognize strings as they're useful to be able to print without
pretty-printers. */
- if (gccgo_string_p (type)
- || sixg_string_p (type))
+ if (gccgo_string_p (type) || sixg_string_p (type))
return GO_TYPE_STRING;
return GO_TYPE_NONE;
@@ -137,8 +135,8 @@ go_classify_struct_type (struct type *type)
The caller is responsible for memory management. */
static void
-unpack_package_and_object (char *buf,
- const char **packagep, const char **objectp)
+unpack_package_and_object (char *buf, const char **packagep,
+ const char **objectp)
{
char *last_dot;
@@ -181,8 +179,7 @@ unpack_package_and_object (char *buf,
for that too. */
static char *
-unpack_mangled_go_symbol (const char *mangled_name,
- const char **packagep,
+unpack_mangled_go_symbol (const char *mangled_name, const char **packagep,
const char **objectp,
const char **method_type_packagep,
const char **method_type_objectp,
@@ -255,7 +252,7 @@ unpack_mangled_go_symbol (const char *mangled_name,
return NULL;
/* More quick checks. */
- if (last_dot[1] == '\0' /* foo. */
+ if (last_dot[1] == '\0' /* foo. */
|| last_dot[-1] == '.') /* foo..bar */
return NULL;
@@ -310,8 +307,8 @@ unpack_mangled_go_symbol (const char *mangled_name,
/* Ensure not something like "..foo". */
&& (method_type > buf && method_type[-1] != '.'))
{
- unpack_package_and_object (saw_digit + 2,
- method_type_packagep, method_type_objectp);
+ unpack_package_and_object (saw_digit + 2, method_type_packagep,
+ method_type_objectp);
*method_type = '\0';
*method_type_is_pointerp = saw_pointer;
}
@@ -345,12 +342,9 @@ go_language::demangle_symbol (const char *mangled_name, int options) const
if (mangled_name == NULL)
return NULL;
- gdb::unique_xmalloc_ptr<char> name_buf
- (unpack_mangled_go_symbol (mangled_name,
- &package_name, &object_name,
- &method_type_package_name,
- &method_type_object_name,
- &method_type_is_pointer));
+ gdb::unique_xmalloc_ptr<char> name_buf (unpack_mangled_go_symbol (
+ mangled_name, &package_name, &object_name, &method_type_package_name,
+ &method_type_object_name, &method_type_is_pointer));
if (name_buf == NULL)
return NULL;
@@ -361,7 +355,7 @@ go_language::demangle_symbol (const char *mangled_name, int options) const
{
/* FIXME: Seems like we should include package_name here somewhere. */
if (method_type_is_pointer)
- obstack_grow_str (&tempbuf, "(*");
+ obstack_grow_str (&tempbuf, "(*");
obstack_grow_str (&tempbuf, method_type_package_name);
obstack_grow_str (&tempbuf, ".");
obstack_grow_str (&tempbuf, method_type_object_name);
@@ -397,9 +391,8 @@ go_symbol_package_name (const struct symbol *sym)
char *result;
gdb_assert (sym->language () == language_go);
- name_buf = unpack_mangled_go_symbol (mangled_name,
- &package_name, &object_name,
- &method_type_package_name,
+ name_buf = unpack_mangled_go_symbol (mangled_name, &package_name,
+ &object_name, &method_type_package_name,
&method_type_object_name,
&method_type_is_pointer);
/* Some Go symbols don't have mangled form we interpret (yet). */
@@ -448,7 +441,7 @@ go_language::language_arch_info (struct gdbarch *gdbarch,
const struct builtin_go_type *builtin = builtin_go_type (gdbarch);
/* Helper function to allow shorter lines below. */
- auto add = [&] (struct type * t) -> struct type *
+ auto add = [&](struct type * t) -> struct type *
{
lai->add_primitive_type (t);
return t;
@@ -488,26 +481,19 @@ build_go_types (struct gdbarch *gdbarch)
builtin_go_type->builtin_void
= arch_type (gdbarch, TYPE_CODE_VOID, TARGET_CHAR_BIT, "void");
- builtin_go_type->builtin_char
- = arch_character_type (gdbarch, 8, 1, "char");
- builtin_go_type->builtin_bool
- = arch_boolean_type (gdbarch, 8, 0, "bool");
+ builtin_go_type->builtin_char = arch_character_type (gdbarch, 8, 1, "char");
+ builtin_go_type->builtin_bool = arch_boolean_type (gdbarch, 8, 0, "bool");
builtin_go_type->builtin_int
= arch_integer_type (gdbarch, gdbarch_int_bit (gdbarch), 0, "int");
builtin_go_type->builtin_uint
= arch_integer_type (gdbarch, gdbarch_int_bit (gdbarch), 1, "uint");
builtin_go_type->builtin_uintptr
= arch_integer_type (gdbarch, gdbarch_ptr_bit (gdbarch), 1, "uintptr");
- builtin_go_type->builtin_int8
- = arch_integer_type (gdbarch, 8, 0, "int8");
- builtin_go_type->builtin_int16
- = arch_integer_type (gdbarch, 16, 0, "int16");
- builtin_go_type->builtin_int32
- = arch_integer_type (gdbarch, 32, 0, "int32");
- builtin_go_type->builtin_int64
- = arch_integer_type (gdbarch, 64, 0, "int64");
- builtin_go_type->builtin_uint8
- = arch_integer_type (gdbarch, 8, 1, "uint8");
+ builtin_go_type->builtin_int8 = arch_integer_type (gdbarch, 8, 0, "int8");
+ builtin_go_type->builtin_int16 = arch_integer_type (gdbarch, 16, 0, "int16");
+ builtin_go_type->builtin_int32 = arch_integer_type (gdbarch, 32, 0, "int32");
+ builtin_go_type->builtin_int64 = arch_integer_type (gdbarch, 64, 0, "int64");
+ builtin_go_type->builtin_uint8 = arch_integer_type (gdbarch, 8, 1, "uint8");
builtin_go_type->builtin_uint16
= arch_integer_type (gdbarch, 16, 1, "uint16");
builtin_go_type->builtin_uint32
diff --git a/gdb/go-lang.h b/gdb/go-lang.h
index 1820b4c9658..c16afa63d20 100644
--- a/gdb/go-lang.h
+++ b/gdb/go-lang.h
@@ -17,7 +17,7 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
-#if !defined (GO_LANG_H)
+#if !defined(GO_LANG_H)
#define GO_LANG_H 1
struct type_print_options;
@@ -74,19 +74,19 @@ extern const struct builtin_go_type *builtin_go_type (struct gdbarch *);
class go_language : public language_defn
{
public:
+
go_language ()
: language_defn (language_go)
- { /* Nothing. */ }
+ { /* Nothing. */
+ }
/* See language.h. */
- const char *name () const override
- { return "go"; }
+ const char *name () const override { return "go"; }
/* See language.h. */
- const char *natural_name () const override
- { return "Go"; }
+ const char *natural_name () const override { return "Go"; }
/* See language.h. */
@@ -95,9 +95,9 @@ public:
/* See language.h. */
- bool sniff_from_mangled_name
- (const char *mangled, gdb::unique_xmalloc_ptr<char> *demangled)
- const override
+ bool sniff_from_mangled_name (
+ const char *mangled,
+ gdb::unique_xmalloc_ptr<char> *demangled) const override
{
*demangled = demangle_symbol (mangled, 0);
return *demangled != NULL;
@@ -116,9 +116,9 @@ public:
/* See language.h. */
- void value_print_inner
- (struct value *val, struct ui_file *stream, int recurse,
- const struct value_print_options *options) const override;
+ void
+ value_print_inner (struct value *val, struct ui_file *stream, int recurse,
+ const struct value_print_options *options) const override;
/* See language.h. */
@@ -135,8 +135,7 @@ public:
/* See language.h. */
- bool store_sym_names_in_linkage_form_p () const override
- { return true; }
+ bool store_sym_names_in_linkage_form_p () const override { return true; }
};
#endif /* !defined (GO_LANG_H) */
diff --git a/gdb/go-valprint.c b/gdb/go-valprint.c
index 5ded53ec633..0bbf76b8139 100644
--- a/gdb/go-valprint.c
+++ b/gdb/go-valprint.c
@@ -37,10 +37,8 @@
gdb_assert (go_classify_struct_type (type) == GO_TYPE_STRING). */
static void
-print_go_string (struct type *type,
- LONGEST embedded_offset, CORE_ADDR address,
- struct ui_file *stream, int recurse,
- struct value *val,
+print_go_string (struct type *type, LONGEST embedded_offset, CORE_ADDR address,
+ struct ui_file *stream, int recurse, struct value *val,
const struct value_print_options *options)
{
struct gdbarch *gdbarch = type->arch ();
@@ -54,14 +52,13 @@ print_go_string (struct type *type,
LONGEST addr;
const gdb_byte *valaddr = value_contents_for_printing (val).data ();
+ if (!unpack_value_field_as_long (type, valaddr, embedded_offset, 0, val,
+ &addr))
+ error (_ ("Unable to read string address"));
- if (! unpack_value_field_as_long (type, valaddr, embedded_offset, 0,
- val, &addr))
- error (_("Unable to read string address"));
-
- if (! unpack_value_field_as_long (type, valaddr, embedded_offset, 1,
- val, &length))
- error (_("Unable to read string length"));
+ if (!unpack_value_field_as_long (type, valaddr, embedded_offset, 1, val,
+ &length))
+ error (_ ("Unable to read string length"));
/* TODO(dje): Print address of struct or actual string? */
if (options->addressprint)
@@ -72,9 +69,8 @@ print_go_string (struct type *type,
if (length < 0)
{
- gdb_printf (_("<invalid length: %ps>"),
- styled_string (metadata_style.style (),
- plongest (addr)));
+ gdb_printf (_ ("<invalid length: %ps>"),
+ styled_string (metadata_style.style (), plongest (addr)));
return;
}
@@ -87,37 +83,37 @@ print_go_string (struct type *type,
/* See go-lang.h. */
void
-go_language::value_print_inner (struct value *val, struct ui_file *stream,
- int recurse,
- const struct value_print_options *options) const
+go_language::value_print_inner (
+ struct value *val, struct ui_file *stream, int recurse,
+ const struct value_print_options *options) const
{
struct type *type = check_typedef (value_type (val));
switch (type->code ())
{
- case TYPE_CODE_STRUCT:
- {
- enum go_type go_type = go_classify_struct_type (type);
-
- switch (go_type)
- {
- case GO_TYPE_STRING:
- if (! options->raw)
- {
- print_go_string (type, value_embedded_offset (val),
- value_address (val),
- stream, recurse, val, options);
- return;
- }
- break;
- default:
- break;
- }
- }
- /* Fall through. */
-
- default:
- c_value_print_inner (val, stream, recurse, options);
- break;
+ case TYPE_CODE_STRUCT:
+ {
+ enum go_type go_type = go_classify_struct_type (type);
+
+ switch (go_type)
+ {
+ case GO_TYPE_STRING:
+ if (!options->raw)
+ {
+ print_go_string (type, value_embedded_offset (val),
+ value_address (val), stream, recurse, val,
+ options);
+ return;
+ }
+ break;
+ default:
+ break;
+ }
+ }
+ /* Fall through. */
+
+ default:
+ c_value_print_inner (val, stream, recurse, options);
+ break;
}
}
diff --git a/gdb/go32-nat.c b/gdb/go32-nat.c
index 566d6d58f1c..2aa39f213ea 100644
--- a/gdb/go32-nat.c
+++ b/gdb/go32-nat.c
@@ -124,33 +124,31 @@
/* This code will be provided from DJGPP 2.03 on. Until then I code it
here. */
typedef struct
- {
- unsigned short sig0;
- unsigned short sig1;
- unsigned short sig2;
- unsigned short sig3;
- unsigned short exponent:15;
- unsigned short sign:1;
- }
-NPXREG;
+{
+ unsigned short sig0;
+ unsigned short sig1;
+ unsigned short sig2;
+ unsigned short sig3;
+ unsigned short exponent : 15;
+ unsigned short sign : 1;
+} NPXREG;
typedef struct
- {
- unsigned int control;
- unsigned int status;
- unsigned int tag;
- unsigned int eip;
- unsigned int cs;
- unsigned int dataptr;
- unsigned int datasel;
- NPXREG reg[8];
- }
-NPX;
+{
+ unsigned int control;
+ unsigned int status;
+ unsigned int tag;
+ unsigned int eip;
+ unsigned int cs;
+ unsigned int dataptr;
+ unsigned int datasel;
+ NPXREG reg[8];
+} NPX;
static NPX npx;
-static void save_npx (void); /* Save the FPU of the debugged program. */
-static void load_npx (void); /* Restore the FPU of the debugged program. */
+static void save_npx (void); /* Save the FPU of the debugged program. */
+static void load_npx (void); /* Restore the FPU of the debugged program. */
/* ------------------------------------------------------------------------- */
/* Store the contents of the NPX in the global variable `npx'. */
@@ -170,25 +168,26 @@ save_npx (void)
1: \n\
fnsave %0 \n\
fwait "
-: "=m" (npx)
-: /* No input */
-: "%eax");
+ : "=m"(npx)
+ : /* No input */
+ : "%eax");
}
/* *INDENT-ON* */
-
/* ------------------------------------------------------------------------- */
/* Reload the contents of the NPX from the global variable `npx'. */
static void
load_npx (void)
{
- asm ("frstor %0":"=m" (npx));
+ asm ("frstor %0" : "=m"(npx));
}
+
/* ------------------------------------------------------------------------- */
/* Stubs for the missing redirection functions. */
-typedef struct {
+typedef struct
+{
char *command;
int redirected;
} cmdline_t;
@@ -224,7 +223,12 @@ redir_debug_init (cmdline_t *ptr)
}
#endif /* __DJGPP_MINOR < 3 */
-typedef enum { wp_insert, wp_remove, wp_count } wp_op;
+typedef enum
+{
+ wp_insert,
+ wp_remove,
+ wp_count
+} wp_op;
/* This holds the current reference counts for each debug register. */
static int dr_ref_count[4];
@@ -233,106 +237,101 @@ static int dr_ref_count[4];
static int prog_has_started = 0;
-#define r_ofs(x) (offsetof(TSS,x))
+#define r_ofs(x) (offsetof (TSS, x))
static struct
{
size_t tss_ofs;
size_t size;
-}
-regno_mapping[] =
-{
- {r_ofs (tss_eax), 4}, /* normal registers, from a_tss */
- {r_ofs (tss_ecx), 4},
- {r_ofs (tss_edx), 4},
- {r_ofs (tss_ebx), 4},
- {r_ofs (tss_esp), 4},
- {r_ofs (tss_ebp), 4},
- {r_ofs (tss_esi), 4},
- {r_ofs (tss_edi), 4},
- {r_ofs (tss_eip), 4},
- {r_ofs (tss_eflags), 4},
- {r_ofs (tss_cs), 2},
- {r_ofs (tss_ss), 2},
- {r_ofs (tss_ds), 2},
- {r_ofs (tss_es), 2},
- {r_ofs (tss_fs), 2},
- {r_ofs (tss_gs), 2},
- {0, 10}, /* 8 FP registers, from npx.reg[] */
- {1, 10},
- {2, 10},
- {3, 10},
- {4, 10},
- {5, 10},
- {6, 10},
- {7, 10},
- /* The order of the next 7 registers must be consistent
+} regno_mapping[] = {
+ { r_ofs (tss_eax), 4 }, /* normal registers, from a_tss */
+ { r_ofs (tss_ecx), 4 },
+ { r_ofs (tss_edx), 4 },
+ { r_ofs (tss_ebx), 4 },
+ { r_ofs (tss_esp), 4 },
+ { r_ofs (tss_ebp), 4 },
+ { r_ofs (tss_esi), 4 },
+ { r_ofs (tss_edi), 4 },
+ { r_ofs (tss_eip), 4 },
+ { r_ofs (tss_eflags), 4 },
+ { r_ofs (tss_cs), 2 },
+ { r_ofs (tss_ss), 2 },
+ { r_ofs (tss_ds), 2 },
+ { r_ofs (tss_es), 2 },
+ { r_ofs (tss_fs), 2 },
+ { r_ofs (tss_gs), 2 },
+ { 0, 10 }, /* 8 FP registers, from npx.reg[] */
+ { 1, 10 },
+ { 2, 10 },
+ { 3, 10 },
+ { 4, 10 },
+ { 5, 10 },
+ { 6, 10 },
+ { 7, 10 },
+ /* The order of the next 7 registers must be consistent
with their numbering in config/i386/tm-i386.h, which see. */
- {0, 2}, /* control word, from npx */
- {4, 2}, /* status word, from npx */
- {8, 2}, /* tag word, from npx */
- {16, 2}, /* last FP exception CS from npx */
- {12, 4}, /* last FP exception EIP from npx */
- {24, 2}, /* last FP exception operand selector from npx */
- {20, 4}, /* last FP exception operand offset from npx */
- {18, 2} /* last FP opcode from npx */
+ { 0, 2 }, /* control word, from npx */
+ { 4, 2 }, /* status word, from npx */
+ { 8, 2 }, /* tag word, from npx */
+ { 16, 2 }, /* last FP exception CS from npx */
+ { 12, 4 }, /* last FP exception EIP from npx */
+ { 24, 2 }, /* last FP exception operand selector from npx */
+ { 20, 4 }, /* last FP exception operand offset from npx */
+ { 18, 2 } /* last FP opcode from npx */
};
static struct
- {
- int go32_sig;
- enum gdb_signal gdb_sig;
- }
-sig_map[] =
-{
- {0, GDB_SIGNAL_FPE},
- {1, GDB_SIGNAL_TRAP},
- /* Exception 2 is triggered by the NMI. DJGPP handles it as SIGILL,
+{
+ int go32_sig;
+ enum gdb_signal gdb_sig;
+} sig_map[]
+ = { { 0, GDB_SIGNAL_FPE },
+ { 1, GDB_SIGNAL_TRAP },
+ /* Exception 2 is triggered by the NMI. DJGPP handles it as SIGILL,
but I think SIGBUS is better, since the NMI is usually activated
as a result of a memory parity check failure. */
- {2, GDB_SIGNAL_BUS},
- {3, GDB_SIGNAL_TRAP},
- {4, GDB_SIGNAL_FPE},
- {5, GDB_SIGNAL_SEGV},
- {6, GDB_SIGNAL_ILL},
- {7, GDB_SIGNAL_EMT}, /* no-coprocessor exception */
- {8, GDB_SIGNAL_SEGV},
- {9, GDB_SIGNAL_SEGV},
- {10, GDB_SIGNAL_BUS},
- {11, GDB_SIGNAL_SEGV},
- {12, GDB_SIGNAL_SEGV},
- {13, GDB_SIGNAL_SEGV},
- {14, GDB_SIGNAL_SEGV},
- {16, GDB_SIGNAL_FPE},
- {17, GDB_SIGNAL_BUS},
- {31, GDB_SIGNAL_ILL},
- {0x1b, GDB_SIGNAL_INT},
- {0x75, GDB_SIGNAL_FPE},
- {0x78, GDB_SIGNAL_ALRM},
- {0x79, GDB_SIGNAL_INT},
- {0x7a, GDB_SIGNAL_QUIT},
- {-1, GDB_SIGNAL_LAST}
-};
+ { 2, GDB_SIGNAL_BUS },
+ { 3, GDB_SIGNAL_TRAP },
+ { 4, GDB_SIGNAL_FPE },
+ { 5, GDB_SIGNAL_SEGV },
+ { 6, GDB_SIGNAL_ILL },
+ { 7, GDB_SIGNAL_EMT }, /* no-coprocessor exception */
+ { 8, GDB_SIGNAL_SEGV },
+ { 9, GDB_SIGNAL_SEGV },
+ { 10, GDB_SIGNAL_BUS },
+ { 11, GDB_SIGNAL_SEGV },
+ { 12, GDB_SIGNAL_SEGV },
+ { 13, GDB_SIGNAL_SEGV },
+ { 14, GDB_SIGNAL_SEGV },
+ { 16, GDB_SIGNAL_FPE },
+ { 17, GDB_SIGNAL_BUS },
+ { 31, GDB_SIGNAL_ILL },
+ { 0x1b, GDB_SIGNAL_INT },
+ { 0x75, GDB_SIGNAL_FPE },
+ { 0x78, GDB_SIGNAL_ALRM },
+ { 0x79, GDB_SIGNAL_INT },
+ { 0x7a, GDB_SIGNAL_QUIT },
+ { -1, GDB_SIGNAL_LAST } };
-static struct {
+static struct
+{
enum gdb_signal gdb_sig;
int djgpp_excepno;
-} excepn_map[] = {
- {GDB_SIGNAL_0, -1},
- {GDB_SIGNAL_ILL, 6}, /* Invalid Opcode */
- {GDB_SIGNAL_EMT, 7}, /* triggers SIGNOFP */
- {GDB_SIGNAL_SEGV, 13}, /* GPF */
- {GDB_SIGNAL_BUS, 17}, /* Alignment Check */
- /* The rest are fake exceptions, see dpmiexcp.c in djlsr*.zip for
+} excepn_map[]
+ = { { GDB_SIGNAL_0, -1 },
+ { GDB_SIGNAL_ILL, 6 }, /* Invalid Opcode */
+ { GDB_SIGNAL_EMT, 7 }, /* triggers SIGNOFP */
+ { GDB_SIGNAL_SEGV, 13 }, /* GPF */
+ { GDB_SIGNAL_BUS, 17 }, /* Alignment Check */
+ /* The rest are fake exceptions, see dpmiexcp.c in djlsr*.zip for
details. */
- {GDB_SIGNAL_TERM, 0x1b}, /* triggers Ctrl-Break type of SIGINT */
- {GDB_SIGNAL_FPE, 0x75},
- {GDB_SIGNAL_INT, 0x79},
- {GDB_SIGNAL_QUIT, 0x7a},
- {GDB_SIGNAL_ALRM, 0x78}, /* triggers SIGTIMR */
- {GDB_SIGNAL_PROF, 0x78},
- {GDB_SIGNAL_LAST, -1}
-};
+ { GDB_SIGNAL_TERM, 0x1b }, /* triggers Ctrl-Break type of SIGINT */
+ { GDB_SIGNAL_FPE, 0x75 },
+ { GDB_SIGNAL_INT, 0x79 },
+ { GDB_SIGNAL_QUIT, 0x7a },
+ { GDB_SIGNAL_ALRM, 0x78 }, /* triggers SIGTIMR */
+ { GDB_SIGNAL_PROF, 0x78 },
+ { GDB_SIGNAL_LAST, -1 } };
/* The go32 target. */
@@ -348,8 +347,7 @@ struct go32_nat_target final : public x86_nat_target<inf_child_target>
void store_registers (struct regcache *, int) override;
enum target_xfer_status xfer_partial (enum target_object object,
- const char *annex,
- gdb_byte *readbuf,
+ const char *annex, gdb_byte *readbuf,
const gdb_byte *writebuf,
ULONGEST offset, ULONGEST len,
ULONGEST *xfered_len) override;
@@ -370,8 +368,8 @@ struct go32_nat_target final : public x86_nat_target<inf_child_target>
void kill () override;
- void create_inferior (const char *, const std::string &,
- char **, int) override;
+ void create_inferior (const char *, const std::string &, char **,
+ int) override;
void mourn_inferior () override;
@@ -385,7 +383,7 @@ static go32_nat_target the_go32_nat_target;
void
go32_nat_target::attach (const char *args, int from_tty)
{
- error (_("\
+ error (_ ("\
You cannot attach to a running program on this platform.\n\
Use the `run' command to run DJGPP programs."));
}
@@ -402,8 +400,8 @@ go32_nat_target::resume (ptid_t ptid, int step, enum gdb_signal siggnal)
if (siggnal != GDB_SIGNAL_0 && siggnal != GDB_SIGNAL_TRAP)
{
- for (i = 0, resume_signal = -1;
- excepn_map[i].gdb_sig != GDB_SIGNAL_LAST; i++)
+ for (i = 0, resume_signal = -1; excepn_map[i].gdb_sig != GDB_SIGNAL_LAST;
+ i++)
if (excepn_map[i].gdb_sig == siggnal)
{
resume_signal = excepn_map[i].djgpp_excepno;
@@ -426,7 +424,7 @@ go32_nat_target::wait (ptid_t ptid, struct target_waitstatus *status,
unsigned long INT3_addr = 0;
int stepping_over_INT = 0;
- a_tss.tss_eflags &= 0xfeff; /* Reset the single-step flag (TF). */
+ a_tss.tss_eflags &= 0xfeff; /* Reset the single-step flag (TF). */
if (resume_is_step)
{
/* If the next instruction is INT xx or INTO, we need to handle
@@ -467,7 +465,7 @@ go32_nat_target::wait (ptid_t ptid, struct target_waitstatus *status,
}
else
{
- a_tss.tss_trap = 0xffff; /* run_child looks for this. */
+ a_tss.tss_trap = 0xffff; /* run_child looks for this. */
a_tss.tss_irqn = resume_signal;
}
@@ -499,7 +497,7 @@ go32_nat_target::wait (ptid_t ptid, struct target_waitstatus *status,
if (stepping_over_INT && a_tss.tss_eip == INT3_addr + 1)
{
/* Restore the original opcode. */
- a_tss.tss_eip--; /* EIP points *after* the INT3 instruction. */
+ a_tss.tss_eip--; /* EIP points *after* the INT3 instruction. */
write_child (a_tss.tss_eip, &saved_opcode, 1);
/* Simulate a TRAP exception. */
a_tss.tss_irqn = 1;
@@ -540,11 +538,11 @@ fetch_register (struct regcache *regcache, int regno)
if (regno < gdbarch_fp0_regnum (gdbarch))
regcache->raw_supply (regno,
(char *) &a_tss + regno_mapping[regno].tss_ofs);
- else if (i386_fp_regnum_p (gdbarch, regno) || i386_fpc_regnum_p (gdbarch,
- regno))
+ else if (i386_fp_regnum_p (gdbarch, regno)
+ || i386_fpc_regnum_p (gdbarch, regno))
i387_supply_fsave (regcache, regno, &npx);
else
- internal_error (_("Invalid register no. %d in fetch_register."), regno);
+ internal_error (_ ("Invalid register no. %d in fetch_register."), regno);
}
void
@@ -554,9 +552,7 @@ go32_nat_target::fetch_registers (struct regcache *regcache, int regno)
fetch_register (regcache, regno);
else
{
- for (regno = 0;
- regno < gdbarch_fp0_regnum (regcache->arch ());
- regno++)
+ for (regno = 0; regno < gdbarch_fp0_regnum (regcache->arch ()); regno++)
fetch_register (regcache, regno);
i387_supply_fsave (regcache, -1, &npx);
}
@@ -569,11 +565,11 @@ store_register (const struct regcache *regcache, int regno)
if (regno < gdbarch_fp0_regnum (gdbarch))
regcache->raw_collect (regno,
(char *) &a_tss + regno_mapping[regno].tss_ofs);
- else if (i386_fp_regnum_p (gdbarch, regno) || i386_fpc_regnum_p (gdbarch,
- regno))
+ else if (i386_fp_regnum_p (gdbarch, regno)
+ || i386_fpc_regnum_p (gdbarch, regno))
i387_collect_fsave (regcache, regno, &npx);
else
- internal_error (_("Invalid register no. %d in store_register."), regno);
+ internal_error (_ ("Invalid register no. %d in store_register."), regno);
}
void
@@ -638,10 +634,9 @@ go32_xfer_memory (gdb_byte *readbuf, const gdb_byte *writebuf,
/* Target to_xfer_partial implementation. */
enum target_xfer_status
-go32_nat_target::xfer_partial (enum target_object object,
- const char *annex, gdb_byte *readbuf,
- const gdb_byte *writebuf, ULONGEST offset,
- ULONGEST len,
+go32_nat_target::xfer_partial (enum target_object object, const char *annex,
+ gdb_byte *readbuf, const gdb_byte *writebuf,
+ ULONGEST offset, ULONGEST len,
ULONGEST *xfered_len)
{
switch (object)
@@ -650,13 +645,12 @@ go32_nat_target::xfer_partial (enum target_object object,
return go32_xfer_memory (readbuf, writebuf, offset, len, xfered_len);
default:
- return this->beneath ()->xfer_partial (object, annex,
- readbuf, writebuf, offset, len,
- xfered_len);
+ return this->beneath ()->xfer_partial (object, annex, readbuf, writebuf,
+ offset, len, xfered_len);
}
}
-static cmdline_t child_cmd; /* Parsed child's command line kept here. */
+static cmdline_t child_cmd; /* Parsed child's command line kept here. */
void
go32_nat_target::files_info ()
@@ -672,8 +666,8 @@ go32_nat_target::kill_inferior ()
void
go32_nat_target::create_inferior (const char *exec_file,
- const std::string &allargs,
- char **env, int from_tty)
+ const std::string &allargs, char **env,
+ int from_tty)
{
extern char **environ;
jmp_buf start_state;
@@ -698,8 +692,8 @@ go32_nat_target::create_inferior (const char *exec_file,
/* Init command line storage. */
if (redir_debug_init (&child_cmd) == -1)
- internal_error (_("Cannot allocate redirection storage: "
- "not enough memory.\n"));
+ internal_error (_ ("Cannot allocate redirection storage: "
+ "not enough memory.\n"));
/* Parse the command line and create redirections. */
if (strpbrk (args, "<>"))
@@ -707,7 +701,7 @@ go32_nat_target::create_inferior (const char *exec_file,
if (redir_cmdline_parse (args, &child_cmd) == 0)
args = child_cmd.command;
else
- error (_("Syntax error in command line."));
+ error (_ ("Syntax error in command line."));
}
else
child_cmd.command = xstrdup (args);
@@ -715,8 +709,8 @@ go32_nat_target::create_inferior (const char *exec_file,
cmdlen = strlen (args);
/* v2loadimage passes command lines via DOS memory, so it cannot
possibly handle commands longer than 1MB. */
- if (cmdlen > 1024*1024)
- error (_("Command line too long."));
+ if (cmdlen > 1024 * 1024)
+ error (_ ("Command line too long."));
cmdline = (char *) xmalloc (cmdlen + 4);
strcpy (cmdline + 1, args);
@@ -729,7 +723,7 @@ go32_nat_target::create_inferior (const char *exec_file,
cmdline[cmdlen + 1] = 13;
}
else
- cmdline[0] = 0xff; /* Signal v2loadimage it's a long command. */
+ cmdline[0] = 0xff; /* Signal v2loadimage it's a long command. */
environ = env;
@@ -739,7 +733,7 @@ go32_nat_target::create_inferior (const char *exec_file,
xfree (cmdline);
if (result != 0)
- error (_("Load failed for image %s"), exec_file);
+ error (_ ("Load failed for image %s"), exec_file);
edi_init (start_state);
#if __DJGPP_MINOR__ < 3
@@ -797,7 +791,7 @@ static void
go32_set_dr (int i, CORE_ADDR addr)
{
if (i < 0 || i > 3)
- internal_error (_("Invalid register %d in go32_set_dr.\n"), i);
+ internal_error (_ ("Invalid register %d in go32_set_dr.\n"), i);
D_REGS[i] = addr;
}
@@ -837,7 +831,7 @@ static CORE_ADDR
go32_get_dr (int i)
{
if (i < 0 || i > 3)
- internal_error (_("Invalid register %d in go32_get_dr.\n"), i);
+ internal_error (_ ("Invalid register %d in go32_get_dr.\n"), i);
return D_REGS[i];
}
@@ -862,11 +856,11 @@ device_mode (int fd, int raw_p)
else
newmode &= ~0x20;
- if (oldmode & 0x80) /* Only for character dev. */
+ if (oldmode & 0x80) /* Only for character dev. */
{
regs.x.ax = 0x4401;
regs.x.bx = fd;
- regs.x.dx = newmode & 0xff; /* Force upper byte zero, else it fails. */
+ regs.x.dx = newmode & 0xff; /* Force upper byte zero, else it fails. */
__dpmi_int (0x21, &regs);
if (regs.x.flags & 1)
return -1;
@@ -874,7 +868,6 @@ device_mode (int fd, int raw_p)
return (oldmode & 0x20) == 0x20;
}
-
static int inf_mode_valid = 0;
static int inf_terminal_mode;
@@ -887,7 +880,7 @@ static int terminal_is_ours = 1;
void
go32_nat_target::terminal_init ()
{
- inf_mode_valid = 0; /* Reinitialize, in case they are restarting child. */
+ inf_mode_valid = 0; /* Reinitialize, in case they are restarting child. */
terminal_is_ours = 1;
}
@@ -895,8 +888,9 @@ void
go32_nat_target::terminal_info (const char *args, int from_tty)
{
gdb_printf ("Inferior's terminal is in %s mode.\n",
- !inf_mode_valid
- ? "default" : inf_terminal_mode ? "raw" : "cooked");
+ !inf_mode_valid ? "default"
+ : inf_terminal_mode ? "raw"
+ : "cooked");
#if __DJGPP_MINOR__ > 2
if (child_cmd.redirection)
@@ -906,16 +900,17 @@ go32_nat_target::terminal_info (const char *args, int from_tty)
for (i = 0; i < DBG_HANDLES; i++)
{
if (child_cmd.redirection[i]->file_name)
- gdb_printf ("\tFile handle %d is redirected to `%s'.\n",
- i, child_cmd.redirection[i]->file_name);
+ gdb_printf ("\tFile handle %d is redirected to `%s'.\n", i,
+ child_cmd.redirection[i]->file_name);
else if (_get_dev_info (child_cmd.redirection[i]->inf_handle) == -1)
- gdb_printf
- ("\tFile handle %d appears to be closed by inferior.\n", i);
+ gdb_printf ("\tFile handle %d appears to be closed by inferior.\n",
+ i);
/* Mask off the raw/cooked bit when comparing device info words. */
- else if ((_get_dev_info (child_cmd.redirection[i]->inf_handle) & 0xdf)
+ else if ((_get_dev_info (child_cmd.redirection[i]->inf_handle)
+ & 0xdf)
!= (_get_dev_info (i) & 0xdf))
- gdb_printf
- ("\tFile handle %d appears to be redirected by inferior.\n", i);
+ gdb_printf (
+ "\tFile handle %d appears to be redirected by inferior.\n", i);
}
}
#endif
@@ -929,7 +924,7 @@ go32_nat_target::terminal_inferior ()
if (redir_to_child (&child_cmd) == -1)
{
redir_to_debugger (&child_cmd);
- error (_("Cannot redirect standard handles for program: %s."),
+ error (_ ("Cannot redirect standard handles for program: %s."),
safe_strerror (errno));
}
/* Set the console device of the inferior to whatever mode
@@ -963,7 +958,7 @@ go32_nat_target::terminal_ours ()
if (redir_to_debugger (&child_cmd) == -1)
{
redir_to_child (&child_cmd);
- error (_("Cannot redirect standard handles for debugger: %s."),
+ error (_ ("Cannot redirect standard handles for debugger: %s."),
safe_strerror (errno));
}
}
@@ -997,7 +992,7 @@ dos_codepage (void)
if (!(regs.x.flags & 1))
return regs.x.bx & 0xffff;
else
- return 437; /* default */
+ return 437; /* default */
}
/* Limited emulation of `nl_langinfo', for charset.c. */
@@ -1008,21 +1003,21 @@ nl_langinfo (nl_item item)
switch (item)
{
- case CODESET:
- {
- /* 8 is enough for SHORT_MAX + "CP" + null. */
- char buf[8];
- int blen = sizeof (buf);
- int needed = snprintf (buf, blen, "CP%d", dos_codepage ());
-
- if (needed > blen) /* Should never happen. */
- buf[0] = 0;
- retval = xstrdup (buf);
- }
- break;
- default:
- retval = xstrdup ("");
- break;
+ case CODESET:
+ {
+ /* 8 is enough for SHORT_MAX + "CP" + null. */
+ char buf[8];
+ int blen = sizeof (buf);
+ int needed = snprintf (buf, blen, "CP%d", dos_codepage ());
+
+ if (needed > blen) /* Should never happen. */
+ buf[0] = 0;
+ retval = xstrdup (buf);
+ }
+ break;
+ default:
+ retval = xstrdup ("");
+ break;
}
return retval;
}
@@ -1031,12 +1026,12 @@ unsigned short windows_major, windows_minor;
/* Compute the version Windows reports via Int 2Fh/AX=1600h. */
static void
-go32_get_windows_version(void)
+go32_get_windows_version (void)
{
__dpmi_regs r;
r.x.ax = 0x1600;
- __dpmi_int(0x2f, &r);
+ __dpmi_int (0x2f, &r);
if (r.h.al > 2 && r.h.al != 0x80 && r.h.al != 0xff
&& (r.h.al > 3 || r.h.ah > 0))
{
@@ -1044,7 +1039,7 @@ go32_get_windows_version(void)
windows_minor = r.h.ah;
}
else
- windows_major = 0xff; /* meaning no Windows */
+ windows_major = 0xff; /* meaning no Windows */
}
/* A subroutine of go32_sysinfo to display memory info. */
@@ -1072,15 +1067,15 @@ print_mem (unsigned long datum, const char *header, int in_pages_p)
static void
go32_sysinfo (const char *arg, int from_tty)
{
- static const char test_pattern[] =
- "deadbeafdeadbeafdeadbeafdeadbeafdeadbeaf"
- "deadbeafdeadbeafdeadbeafdeadbeafdeadbeaf"
- "deadbeafdeadbeafdeadbeafdeadbeafdeadbeafdeadbeaf";
+ static const char test_pattern[]
+ = "deadbeafdeadbeafdeadbeafdeadbeafdeadbeaf"
+ "deadbeafdeadbeafdeadbeafdeadbeafdeadbeaf"
+ "deadbeafdeadbeafdeadbeafdeadbeafdeadbeafdeadbeaf";
struct utsname u;
char cpuid_vendor[13];
unsigned cpuid_max = 0, cpuid_eax, cpuid_ebx, cpuid_ecx, cpuid_edx;
unsigned true_dos_version = _get_dos_version (1);
- unsigned advertized_dos_version = ((unsigned int)_osmajor << 8) | _osminor;
+ unsigned advertized_dos_version = ((unsigned int) _osmajor << 8) | _osminor;
int dpmi_flags;
char dpmi_vendor_info[129];
int dpmi_vendor_available;
@@ -1119,10 +1114,8 @@ go32_sysinfo (const char *arg, int from_tty)
"movl %%edx, %1;"
"movl %%ecx, %2;"
"movl %%eax, %3;"
- : "=m" (cpuid_vendor[0]),
- "=m" (cpuid_vendor[4]),
- "=m" (cpuid_vendor[8]),
- "=m" (cpuid_max)
+ : "=m"(cpuid_vendor[0]), "=m"(cpuid_vendor[4]),
+ "=m"(cpuid_vendor[8]), "=m"(cpuid_max)
:
: "%eax", "%ebx", "%ecx", "%edx");
cpuid_vendor[12] = '\0';
@@ -1137,14 +1130,8 @@ go32_sysinfo (const char *arg, int from_tty)
/* CPUID with EAX = 1 returns processor signature and features. */
if (cpuid_max >= 1)
{
- static const char *brand_name[] = {
- "",
- " Celeron",
- " III",
- " III Xeon",
- "", "", "", "",
- " 4"
- };
+ static const char *brand_name[]
+ = { "", " Celeron", " III", " III Xeon", "", "", "", "", " 4" };
char cpu_string[80];
char cpu_brand[20];
unsigned brand_idx;
@@ -1159,20 +1146,18 @@ go32_sysinfo (const char *arg, int from_tty)
#else
__asm__ __volatile__ ("movl $1, %%eax;"
"cpuid;"
- : "=a" (cpuid_eax),
- "=b" (cpuid_ebx),
- "=d" (cpuid_edx)
+ : "=a"(cpuid_eax), "=b"(cpuid_ebx), "=d"(cpuid_edx)
:
: "%ecx");
#endif
brand_idx = cpuid_ebx & 0xff;
cpu_family = (cpuid_eax >> 8) & 0xf;
- cpu_model = (cpuid_eax >> 4) & 0xf;
+ cpu_model = (cpuid_eax >> 4) & 0xf;
cpu_brand[0] = '\0';
if (intel_p)
{
if (brand_idx > 0
- && brand_idx < sizeof(brand_name)/sizeof(brand_name[0])
+ && brand_idx < sizeof (brand_name) / sizeof (brand_name[0])
&& *brand_name[brand_idx])
strcpy (cpu_brand, brand_name[brand_idx]);
else if (cpu_family == 5)
@@ -1188,21 +1173,21 @@ go32_sysinfo (const char *arg, int from_tty)
{
switch (cpu_model)
{
- case 1:
- strcpy (cpu_brand, " Pro");
- break;
- case 3:
- strcpy (cpu_brand, " II");
- break;
- case 5:
- strcpy (cpu_brand, " II Xeon");
- break;
- case 6:
- strcpy (cpu_brand, " Celeron");
- break;
- case 7:
- strcpy (cpu_brand, " III");
- break;
+ case 1:
+ strcpy (cpu_brand, " Pro");
+ break;
+ case 3:
+ strcpy (cpu_brand, " II");
+ break;
+ case 5:
+ strcpy (cpu_brand, " II Xeon");
+ break;
+ case 6:
+ strcpy (cpu_brand, " Celeron");
+ break;
+ case 7:
+ strcpy (cpu_brand, " III");
+ break;
}
}
}
@@ -1210,51 +1195,51 @@ go32_sysinfo (const char *arg, int from_tty)
{
switch (cpu_family)
{
- case 4:
- strcpy (cpu_brand, "486/5x86");
- break;
- case 5:
- switch (cpu_model)
- {
- case 0:
- case 1:
- case 2:
- case 3:
- strcpy (cpu_brand, "-K5");
- break;
- case 6:
- case 7:
- strcpy (cpu_brand, "-K6");
- break;
- case 8:
- strcpy (cpu_brand, "-K6-2");
- break;
- case 9:
- strcpy (cpu_brand, "-K6-III");
- break;
- }
- break;
- case 6:
- switch (cpu_model)
- {
- case 1:
- case 2:
- case 4:
- strcpy (cpu_brand, " Athlon");
- break;
- case 3:
- strcpy (cpu_brand, " Duron");
- break;
- }
- break;
+ case 4:
+ strcpy (cpu_brand, "486/5x86");
+ break;
+ case 5:
+ switch (cpu_model)
+ {
+ case 0:
+ case 1:
+ case 2:
+ case 3:
+ strcpy (cpu_brand, "-K5");
+ break;
+ case 6:
+ case 7:
+ strcpy (cpu_brand, "-K6");
+ break;
+ case 8:
+ strcpy (cpu_brand, "-K6-2");
+ break;
+ case 9:
+ strcpy (cpu_brand, "-K6-III");
+ break;
+ }
+ break;
+ case 6:
+ switch (cpu_model)
+ {
+ case 1:
+ case 2:
+ case 4:
+ strcpy (cpu_brand, " Athlon");
+ break;
+ case 3:
+ strcpy (cpu_brand, " Duron");
+ break;
+ }
+ break;
}
}
xsnprintf (cpu_string, sizeof (cpu_string), "%s%s Model %d Stepping %d",
- intel_p ? "Pentium" : (amd_p ? "AMD" : (hygon_p ? "Hygon" : "ix86")),
+ intel_p ? "Pentium"
+ : (amd_p ? "AMD" : (hygon_p ? "Hygon" : "ix86")),
cpu_brand, cpu_model, cpuid_eax & 0xf);
gdb_printf ("%*s%s\n", 31, "", cpu_string);
- if (((cpuid_edx & (6 | (0x0d << 23))) != 0)
- || ((cpuid_edx & 1) == 0)
+ if (((cpuid_edx & (6 | (0x0d << 23))) != 0) || ((cpuid_edx & 1) == 0)
|| ((amd_p || hygon_p) && (cpuid_edx & (3 << 30)) != 0))
{
gdb_puts ("CPU Features...................");
@@ -1285,8 +1270,8 @@ go32_sysinfo (const char *arg, int from_tty)
}
}
gdb_puts ("\n");
- gdb_printf ("DOS Version....................%s %s.%s",
- _os_flavor, u.release, u.version);
+ gdb_printf ("DOS Version....................%s %s.%s", _os_flavor, u.release,
+ u.version);
if (true_dos_version != advertized_dos_version)
gdb_printf (" (disguised as v%d.%d)", _osmajor, _osminor);
gdb_puts ("\n");
@@ -1300,32 +1285,32 @@ go32_sysinfo (const char *arg, int from_tty)
windows_major, windows_minor);
switch (windows_major)
{
- case 3:
- windows_flavor = "3.X";
- break;
- case 4:
- switch (windows_minor)
- {
- case 0:
- windows_flavor = "95, 95A, or 95B";
- break;
- case 3:
- windows_flavor = "95B OSR2.1 or 95C OSR2.5";
- break;
- case 10:
- windows_flavor = "98 or 98 SE";
- break;
- case 90:
- windows_flavor = "ME";
- break;
- default:
- windows_flavor = "9X";
- break;
- }
- break;
- default:
- windows_flavor = "??";
- break;
+ case 3:
+ windows_flavor = "3.X";
+ break;
+ case 4:
+ switch (windows_minor)
+ {
+ case 0:
+ windows_flavor = "95, 95A, or 95B";
+ break;
+ case 3:
+ windows_flavor = "95B OSR2.1 or 95C OSR2.5";
+ break;
+ case 10:
+ windows_flavor = "98 or 98 SE";
+ break;
+ case 90:
+ windows_flavor = "ME";
+ break;
+ default:
+ windows_flavor = "9X";
+ break;
+ }
+ break;
+ default:
+ windows_flavor = "??";
+ break;
}
gdb_printf ("%s)\n", windows_flavor);
}
@@ -1336,12 +1321,12 @@ go32_sysinfo (const char *arg, int from_tty)
/* On some versions of Windows, __dpmi_get_capabilities returns
zero, but the buffer is not filled with info, so we fill the
buffer with a known pattern and test for it afterwards. */
- memcpy (dpmi_vendor_info, test_pattern, sizeof(dpmi_vendor_info));
- dpmi_vendor_available =
- __dpmi_get_capabilities (&dpmi_flags, dpmi_vendor_info);
+ memcpy (dpmi_vendor_info, test_pattern, sizeof (dpmi_vendor_info));
+ dpmi_vendor_available
+ = __dpmi_get_capabilities (&dpmi_flags, dpmi_vendor_info);
if (dpmi_vendor_available == 0
- && memcmp (dpmi_vendor_info, test_pattern,
- sizeof(dpmi_vendor_info)) != 0)
+ && memcmp (dpmi_vendor_info, test_pattern, sizeof (dpmi_vendor_info))
+ != 0)
{
/* The DPMI spec says the vendor string should be ASCIIZ, but
I don't trust the vendors to follow that... */
@@ -1349,10 +1334,9 @@ go32_sysinfo (const char *arg, int from_tty)
dpmi_vendor_info[128] = '\0';
gdb_printf ("DPMI Host......................"
"%s v%d.%d (capabilities: %#x)\n",
- &dpmi_vendor_info[2],
- (unsigned)dpmi_vendor_info[0],
- (unsigned)dpmi_vendor_info[1],
- ((unsigned)dpmi_flags & 0x7f));
+ &dpmi_vendor_info[2], (unsigned) dpmi_vendor_info[0],
+ (unsigned) dpmi_vendor_info[1],
+ ((unsigned) dpmi_flags & 0x7f));
}
else
gdb_printf ("DPMI Host......................(Info not available)\n");
@@ -1365,15 +1349,14 @@ go32_sysinfo (const char *arg, int from_tty)
(dpmi_version_data.flags & 4) ? "" : "out");
gdb_printf ("%*sInterrupts reflected to %s mode\n", 31, "",
(dpmi_version_data.flags & 2) ? "V86" : "Real");
- gdb_printf ("%*sProcessor type: i%d86\n", 31, "",
- dpmi_version_data.cpu);
+ gdb_printf ("%*sProcessor type: i%d86\n", 31, "", dpmi_version_data.cpu);
gdb_printf ("%*sPIC base interrupt: Master: %#x Slave: %#x\n", 31, "",
dpmi_version_data.master_pic, dpmi_version_data.slave_pic);
/* a_tss is only initialized when the debuggee is first run. */
if (prog_has_started)
{
- __asm__ __volatile__ ("pushfl ; popl %0" : "=g" (eflags));
+ __asm__ __volatile__ ("pushfl ; popl %0" : "=g"(eflags));
gdb_printf ("Protection....................."
"Ring %d (in %s), with%s I/O protection\n",
a_tss.tss_cs & 3, (a_tss.tss_cs & 4) ? "LDT" : "GDT",
@@ -1402,14 +1385,11 @@ go32_sysinfo (const char *arg, int from_tty)
__dpmi_int (0x21, &regs);
if ((regs.x.flags & 1) == 0)
{
- static const char *dos_hilo[] = {
- "Low", "", "", "", "High", "", "", "", "High, then Low"
- };
- static const char *dos_fit[] = {
- "First", "Best", "Last"
- };
+ static const char *dos_hilo[]
+ = { "Low", "", "", "", "High", "", "", "", "High, then Low" };
+ static const char *dos_fit[] = { "First", "Best", "Last" };
int hilo_idx = (regs.x.ax >> 4) & 0x0f;
- int fit_idx = regs.x.ax & 0x0f;
+ int fit_idx = regs.x.ax & 0x0f;
if (hilo_idx > 8)
hilo_idx = 0;
@@ -1426,29 +1406,31 @@ go32_sysinfo (const char *arg, int from_tty)
}
}
-struct seg_descr {
+struct seg_descr
+{
unsigned short limit0;
unsigned short base0;
- unsigned char base1;
- unsigned stype:5;
- unsigned dpl:2;
- unsigned present:1;
- unsigned limit1:4;
- unsigned available:1;
- unsigned dummy:1;
- unsigned bit32:1;
- unsigned page_granular:1;
- unsigned char base2;
+ unsigned char base1;
+ unsigned stype : 5;
+ unsigned dpl : 2;
+ unsigned present : 1;
+ unsigned limit1 : 4;
+ unsigned available : 1;
+ unsigned dummy : 1;
+ unsigned bit32 : 1;
+ unsigned page_granular : 1;
+ unsigned char base2;
} __attribute__ ((packed));
-struct gate_descr {
+struct gate_descr
+{
unsigned short offset0;
unsigned short selector;
- unsigned param_count:5;
- unsigned dummy:3;
- unsigned stype:5;
- unsigned dpl:2;
- unsigned present:1;
+ unsigned param_count : 5;
+ unsigned dummy : 3;
+ unsigned stype : 5;
+ unsigned dpl : 2;
+ unsigned present : 1;
unsigned short offset1;
} __attribute__ ((packed));
@@ -1498,7 +1480,7 @@ read_memory_region (unsigned long addr, void *dest, size_t len)
/* W2K silently fails to set the segment limit, leaving
it at zero; this test avoids the resulting crash. */
&& __dpmi_get_segment_limit (sel) >= segment_limit)
- movedata (sel, 0, _my_ds (), (unsigned)dest, len);
+ movedata (sel, 0, _my_ds (), (unsigned) dest, len);
else
retval = 0;
@@ -1517,13 +1499,14 @@ get_descriptor (unsigned long table_base, int idx, void *descr)
unsigned long addr = table_base + idx * 8; /* 8 bytes per entry */
if (read_memory_region (addr, descr, 8))
- return (int)((struct seg_descr *)descr)->stype;
+ return (int) ((struct seg_descr *) descr)->stype;
return -1;
}
-struct dtr_reg {
- unsigned short limit __attribute__((packed));
- unsigned long base __attribute__((packed));
+struct dtr_reg
+{
+ unsigned short limit __attribute__ ((packed));
+ unsigned long base __attribute__ ((packed));
};
/* Display a segment descriptor stored at index IDX in a descriptor
@@ -1543,9 +1526,9 @@ display_descriptor (unsigned type, unsigned long base_addr, int idx, int force)
/* For each type of descriptor table, this has a bit set if the
corresponding type of selectors is valid in that table. */
static unsigned allowed_descriptors[] = {
- 0xffffdafeL, /* GDT */
- 0x0000c0e0L, /* IDT */
- 0xffffdafaL /* LDT */
+ 0xffffdafeL, /* GDT */
+ 0x0000c0e0L, /* IDT */
+ 0xffffdafaL /* LDT */
};
/* If the program hasn't started yet, assume the debuggee will
@@ -1557,105 +1540,100 @@ display_descriptor (unsigned type, unsigned long base_addr, int idx, int force)
&& (allowed_descriptors[type] & (1 << descr.stype)) != 0)
{
gdb_printf ("0x%03x: ",
- type == 1
- ? idx : (idx * 8) | (type ? (cpl | 4) : 0));
+ type == 1 ? idx : (idx * 8) | (type ? (cpl | 4) : 0));
if (descr.page_granular)
limit = (limit << 12) | 0xfff; /* big segment: low 12 bit set */
if (descr.stype == 1 || descr.stype == 2 || descr.stype == 3
|| descr.stype == 9 || descr.stype == 11
|| (descr.stype >= 16 && descr.stype < 32))
- gdb_printf ("base=0x%02x%02x%04x limit=0x%08lx",
- descr.base2, descr.base1, descr.base0, limit);
+ gdb_printf ("base=0x%02x%02x%04x limit=0x%08lx", descr.base2,
+ descr.base1, descr.base0, limit);
switch (descr.stype)
{
- case 1:
- case 3:
- gdb_printf (" 16-bit TSS (task %sactive)",
- descr.stype == 3 ? "" : "in");
- break;
- case 2:
- gdb_puts (" LDT");
- break;
- case 4:
- memcpy (&gate, &descr, sizeof gate);
- gdb_printf ("selector=0x%04x offs=0x%04x%04x",
- gate.selector, gate.offset1, gate.offset0);
- gdb_printf (" 16-bit Call Gate (params=%d)",
- gate.param_count);
- break;
- case 5:
- gdb_printf ("TSS selector=0x%04x", descr.base0);
- gdb_printf ("%*sTask Gate", 16, "");
- break;
- case 6:
- case 7:
- memcpy (&gate, &descr, sizeof gate);
- gdb_printf ("selector=0x%04x offs=0x%04x%04x",
- gate.selector, gate.offset1, gate.offset0);
- gdb_printf (" 16-bit %s Gate",
- descr.stype == 6 ? "Interrupt" : "Trap");
- break;
- case 9:
- case 11:
- gdb_printf (" 32-bit TSS (task %sactive)",
- descr.stype == 3 ? "" : "in");
- break;
- case 12:
- memcpy (&gate, &descr, sizeof gate);
- gdb_printf ("selector=0x%04x offs=0x%04x%04x",
- gate.selector, gate.offset1, gate.offset0);
- gdb_printf (" 32-bit Call Gate (params=%d)",
- gate.param_count);
- break;
- case 14:
- case 15:
- memcpy (&gate, &descr, sizeof gate);
- gdb_printf ("selector=0x%04x offs=0x%04x%04x",
- gate.selector, gate.offset1, gate.offset0);
- gdb_printf (" 32-bit %s Gate",
- descr.stype == 14 ? "Interrupt" : "Trap");
- break;
- case 16: /* data segments */
- case 17:
- case 18:
- case 19:
- case 20:
- case 21:
- case 22:
- case 23:
- gdb_printf (" %s-bit Data (%s Exp-%s%s)",
- descr.bit32 ? "32" : "16",
- descr.stype & 2
- ? "Read/Write," : "Read-Only, ",
- descr.stype & 4 ? "down" : "up",
- descr.stype & 1 ? "" : ", N.Acc");
- break;
- case 24: /* code segments */
- case 25:
- case 26:
- case 27:
- case 28:
- case 29:
- case 30:
- case 31:
- gdb_printf (" %s-bit Code (%s, %sConf%s)",
- descr.bit32 ? "32" : "16",
- descr.stype & 2 ? "Exec/Read" : "Exec-Only",
- descr.stype & 4 ? "" : "N.",
- descr.stype & 1 ? "" : ", N.Acc");
- break;
- default:
- gdb_printf ("Unknown type 0x%02x", descr.stype);
- break;
+ case 1:
+ case 3:
+ gdb_printf (" 16-bit TSS (task %sactive)",
+ descr.stype == 3 ? "" : "in");
+ break;
+ case 2:
+ gdb_puts (" LDT");
+ break;
+ case 4:
+ memcpy (&gate, &descr, sizeof gate);
+ gdb_printf ("selector=0x%04x offs=0x%04x%04x", gate.selector,
+ gate.offset1, gate.offset0);
+ gdb_printf (" 16-bit Call Gate (params=%d)", gate.param_count);
+ break;
+ case 5:
+ gdb_printf ("TSS selector=0x%04x", descr.base0);
+ gdb_printf ("%*sTask Gate", 16, "");
+ break;
+ case 6:
+ case 7:
+ memcpy (&gate, &descr, sizeof gate);
+ gdb_printf ("selector=0x%04x offs=0x%04x%04x", gate.selector,
+ gate.offset1, gate.offset0);
+ gdb_printf (" 16-bit %s Gate",
+ descr.stype == 6 ? "Interrupt" : "Trap");
+ break;
+ case 9:
+ case 11:
+ gdb_printf (" 32-bit TSS (task %sactive)",
+ descr.stype == 3 ? "" : "in");
+ break;
+ case 12:
+ memcpy (&gate, &descr, sizeof gate);
+ gdb_printf ("selector=0x%04x offs=0x%04x%04x", gate.selector,
+ gate.offset1, gate.offset0);
+ gdb_printf (" 32-bit Call Gate (params=%d)", gate.param_count);
+ break;
+ case 14:
+ case 15:
+ memcpy (&gate, &descr, sizeof gate);
+ gdb_printf ("selector=0x%04x offs=0x%04x%04x", gate.selector,
+ gate.offset1, gate.offset0);
+ gdb_printf (" 32-bit %s Gate",
+ descr.stype == 14 ? "Interrupt" : "Trap");
+ break;
+ case 16: /* data segments */
+ case 17:
+ case 18:
+ case 19:
+ case 20:
+ case 21:
+ case 22:
+ case 23:
+ gdb_printf (" %s-bit Data (%s Exp-%s%s)",
+ descr.bit32 ? "32" : "16",
+ descr.stype & 2 ? "Read/Write," : "Read-Only, ",
+ descr.stype & 4 ? "down" : "up",
+ descr.stype & 1 ? "" : ", N.Acc");
+ break;
+ case 24: /* code segments */
+ case 25:
+ case 26:
+ case 27:
+ case 28:
+ case 29:
+ case 30:
+ case 31:
+ gdb_printf (" %s-bit Code (%s, %sConf%s)",
+ descr.bit32 ? "32" : "16",
+ descr.stype & 2 ? "Exec/Read" : "Exec-Only",
+ descr.stype & 4 ? "" : "N.",
+ descr.stype & 1 ? "" : ", N.Acc");
+ break;
+ default:
+ gdb_printf ("Unknown type 0x%02x", descr.stype);
+ break;
}
gdb_puts ("\n");
}
else if (force)
{
gdb_printf ("0x%03x: ",
- type == 1
- ? idx : (idx * 8) | (type ? (cpl | 4) : 0));
+ type == 1 ? idx : (idx * 8) | (type ? (cpl | 4) : 0));
if (!descr.present)
gdb_puts ("Segment not present\n");
else
@@ -1684,30 +1662,27 @@ go32_sldt (const char *arg, int from_tty)
if (*arg)
{
ldt_entry = parse_and_eval_long (arg);
- if (ldt_entry < 0
- || (ldt_entry & 4) == 0
+ if (ldt_entry < 0 || (ldt_entry & 4) == 0
|| (ldt_entry & 3) != (cpl & 3))
- error (_("Invalid LDT entry 0x%03lx."), (unsigned long)ldt_entry);
+ error (_ ("Invalid LDT entry 0x%03lx."),
+ (unsigned long) ldt_entry);
}
}
- __asm__ __volatile__ ("sgdt %0" : "=m" (gdtr) : /* no inputs */ );
- __asm__ __volatile__ ("sldt %0" : "=m" (ldtr) : /* no inputs */ );
+ __asm__ __volatile__ ("sgdt %0" : "=m"(gdtr) : /* no inputs */);
+ __asm__ __volatile__ ("sldt %0" : "=m"(ldtr) : /* no inputs */);
ldt_idx = ldtr / 8;
if (ldt_idx == 0)
gdb_puts ("There is no LDT.\n");
/* LDT's entry in the GDT must have the type LDT, which is 2. */
else if (get_descriptor (gdtr.base, ldt_idx, &ldt_descr) != 2)
gdb_printf ("LDT is present (at %#x), but unreadable by GDB.\n",
- ldt_descr.base0
- | (ldt_descr.base1 << 16)
- | (ldt_descr.base2 << 24));
+ ldt_descr.base0 | (ldt_descr.base1 << 16)
+ | (ldt_descr.base2 << 24));
else
{
- unsigned base =
- ldt_descr.base0
- | (ldt_descr.base1 << 16)
- | (ldt_descr.base2 << 24);
+ unsigned base
+ = ldt_descr.base0 | (ldt_descr.base1 << 16) | (ldt_descr.base2 << 24);
unsigned limit = ldt_descr.limit0 | (ldt_descr.limit1 << 16);
int max_entry;
@@ -1725,8 +1700,8 @@ go32_sldt (const char *arg, int from_tty)
if (ldt_entry >= 0)
{
if (ldt_entry > limit)
- error (_("Invalid LDT entry %#lx: outside valid limits [0..%#x]"),
- (unsigned long)ldt_entry, limit);
+ error (_ ("Invalid LDT entry %#lx: outside valid limits [0..%#x]"),
+ (unsigned long) ldt_entry, limit);
display_descriptor (ldt_descr.stype, base, ldt_entry / 8, 1);
}
@@ -1755,20 +1730,20 @@ go32_sgdt (const char *arg, int from_tty)
{
gdt_entry = parse_and_eval_long (arg);
if (gdt_entry < 0 || (gdt_entry & 7) != 0)
- error (_("Invalid GDT entry 0x%03lx: "
- "not an integral multiple of 8."),
- (unsigned long)gdt_entry);
+ error (_ ("Invalid GDT entry 0x%03lx: "
+ "not an integral multiple of 8."),
+ (unsigned long) gdt_entry);
}
}
- __asm__ __volatile__ ("sgdt %0" : "=m" (gdtr) : /* no inputs */ );
+ __asm__ __volatile__ ("sgdt %0" : "=m"(gdtr) : /* no inputs */);
max_entry = (gdtr.limit + 1) / 8;
if (gdt_entry >= 0)
{
if (gdt_entry > gdtr.limit)
- error (_("Invalid GDT entry %#lx: outside valid limits [0..%#x]"),
- (unsigned long)gdt_entry, gdtr.limit);
+ error (_ ("Invalid GDT entry %#lx: outside valid limits [0..%#x]"),
+ (unsigned long) gdt_entry, gdtr.limit);
display_descriptor (0, gdtr.base, gdt_entry / 8, 1);
}
@@ -1796,20 +1771,20 @@ go32_sidt (const char *arg, int from_tty)
{
idt_entry = parse_and_eval_long (arg);
if (idt_entry < 0)
- error (_("Invalid (negative) IDT entry %ld."), idt_entry);
+ error (_ ("Invalid (negative) IDT entry %ld."), idt_entry);
}
}
- __asm__ __volatile__ ("sidt %0" : "=m" (idtr) : /* no inputs */ );
+ __asm__ __volatile__ ("sidt %0" : "=m"(idtr) : /* no inputs */);
max_entry = (idtr.limit + 1) / 8;
- if (max_entry > 0x100) /* No more than 256 entries. */
+ if (max_entry > 0x100) /* No more than 256 entries. */
max_entry = 0x100;
if (idt_entry >= 0)
{
if (idt_entry > idtr.limit)
- error (_("Invalid IDT entry %#lx: outside valid limits [0..%#x]"),
- (unsigned long)idt_entry, idtr.limit);
+ error (_ ("Invalid IDT entry %#lx: outside valid limits [0..%#x]"),
+ (unsigned long) idt_entry, idtr.limit);
display_descriptor (1, idtr.base, idt_entry, 1);
}
@@ -1839,8 +1814,8 @@ get_cr3 (void)
return pdbr;
/* Get the linear address of GDT and the Task Register. */
- __asm__ __volatile__ ("sgdt %0" : "=m" (gdtr) : /* no inputs */ );
- __asm__ __volatile__ ("str %0" : "=m" (taskreg) : /* no inputs */ );
+ __asm__ __volatile__ ("sgdt %0" : "=m"(gdtr) : /* no inputs */);
+ __asm__ __volatile__ ("str %0" : "=m"(taskreg) : /* no inputs */);
/* Task Register is a segment selector for the TSS of the current
task. Therefore, it can be used as an index into the GDT to get
@@ -1849,13 +1824,12 @@ get_cr3 (void)
offset to point to the 3 low bytes of the base address. */
offset = gdtr.base + (taskreg & 0xfff8) + 2;
-
/* CWSDPMI's task base is always under the 1MB mark. */
if (offset > 0xfffff)
return 0;
_farsetsel (_dos_ds);
- taskbase = _farnspeekl (offset) & 0xffffffU;
+ taskbase = _farnspeekl (offset) & 0xffffffU;
taskbase += _farnspeekl (offset + 2) & 0xff000000U;
if (taskbase > 0xfffff)
return 0;
@@ -1865,7 +1839,7 @@ get_cr3 (void)
cr3 = _farnspeekl (taskbase + 0x1c) & ~0xfff;
if (cr3 > 0xfffff)
{
-#if 0 /* Not fully supported yet. */
+#if 0 /* Not fully supported yet. */
/* The Page Directory is in UMBs. In that case, CWSDPMI puts
the first Page Table right below the Page Directory. Thus,
the first Page Table's entry for its own address and the Page
@@ -1903,7 +1877,7 @@ get_pde (int n)
if (pdbr && n >= 0 && n < 1024)
{
- pde = _farpeekl (_dos_ds, pdbr + 4*n);
+ pde = _farpeekl (_dos_ds, pdbr + 4 * n);
}
return pde;
}
@@ -1919,8 +1893,8 @@ get_pte (unsigned long pde, int n)
page tables, for now. */
if ((pde & 1) && !(pde & 0x80) && n >= 0 && n < 1024)
{
- pde &= ~0xfff; /* Clear non-address bits. */
- pte = _farpeekl (_dos_ds, pde + 4*n);
+ pde &= ~0xfff; /* Clear non-address bits. */
+ pte = _farpeekl (_dos_ds, pde + 4 * n);
}
return pte;
}
@@ -1966,7 +1940,8 @@ go32_pde (const char *arg, int from_tty)
{
pde_idx = parse_and_eval_long (arg);
if (pde_idx < 0 || pde_idx >= 1024)
- error (_("Entry %ld is outside valid limits [0..1023]."), pde_idx);
+ error (_ ("Entry %ld is outside valid limits [0..1023]."),
+ pde_idx);
}
}
@@ -1994,7 +1969,8 @@ display_page_table (long n, int force)
int i;
gdb_printf ("Page Table pointed to by "
- "Page Directory entry 0x%lx:\n", n);
+ "Page Directory entry 0x%lx:\n",
+ n);
for (i = 0; i < 1024; i++)
display_ptable_entry (get_pte (pde, i), 0, 0, 0);
gdb_puts ("\n");
@@ -2016,7 +1992,8 @@ go32_pte (const char *arg, int from_tty)
{
pde_idx = parse_and_eval_long (arg);
if (pde_idx < 0 || pde_idx >= 1024)
- error (_("Entry %ld is outside valid limits [0..1023]."), pde_idx);
+ error (_ ("Entry %ld is outside valid limits [0..1023]."),
+ pde_idx);
}
}
@@ -2043,7 +2020,7 @@ go32_pte_for_address (const char *arg, int from_tty)
addr = parse_and_eval_address (arg);
}
if (!addr)
- error_no_arg (_("linear address"));
+ error_no_arg (_ ("linear address"));
pdbr = get_cr3 ();
if (!pdbr)
@@ -2054,8 +2031,7 @@ go32_pte_for_address (const char *arg, int from_tty)
int pte_idx = (addr >> 12) & 0x3ff;
unsigned offs = addr & 0xfff;
- gdb_printf ("Page Table entry for address %s:\n",
- hex_string(addr));
+ gdb_printf ("Page Table entry for address %s:\n", hex_string (addr));
display_ptable_entry (get_pte (get_pde (pde_idx), pte_idx), 0, 1, offs);
}
}
@@ -2063,6 +2039,7 @@ go32_pte_for_address (const char *arg, int from_tty)
static struct cmd_list_element *info_dos_cmdlist = NULL;
void _initialize_go32_nat ();
+
void
_initialize_go32_nat ()
{
@@ -2081,41 +2058,41 @@ _initialize_go32_nat ()
/* Initialize child's command line storage. */
if (redir_debug_init (&child_cmd) == -1)
- internal_error (_("Cannot allocate redirection storage: "
- "not enough memory.\n"));
+ internal_error (_ ("Cannot allocate redirection storage: "
+ "not enough memory.\n"));
/* We are always processing GCC-compiled programs. */
processing_gcc_compilation = 2;
- add_basic_prefix_cmd ("dos", class_info, _("\
+ add_basic_prefix_cmd ("dos", class_info, _ ("\
Print information specific to DJGPP (aka MS-DOS) debugging."),
&info_dos_cmdlist, 0, &infolist);
- add_cmd ("sysinfo", class_info, go32_sysinfo, _("\
+ add_cmd ("sysinfo", class_info, go32_sysinfo, _ ("\
Display information about the target system, including CPU, OS, DPMI, etc."),
&info_dos_cmdlist);
- add_cmd ("ldt", class_info, go32_sldt, _("\
+ add_cmd ("ldt", class_info, go32_sldt, _ ("\
Display entries in the LDT (Local Descriptor Table).\n\
Entry number (an expression) as an argument means display only that entry."),
&info_dos_cmdlist);
- add_cmd ("gdt", class_info, go32_sgdt, _("\
+ add_cmd ("gdt", class_info, go32_sgdt, _ ("\
Display entries in the GDT (Global Descriptor Table).\n\
Entry number (an expression) as an argument means display only that entry."),
&info_dos_cmdlist);
- add_cmd ("idt", class_info, go32_sidt, _("\
+ add_cmd ("idt", class_info, go32_sidt, _ ("\
Display entries in the IDT (Interrupt Descriptor Table).\n\
Entry number (an expression) as an argument means display only that entry."),
&info_dos_cmdlist);
- add_cmd ("pde", class_info, go32_pde, _("\
+ add_cmd ("pde", class_info, go32_pde, _ ("\
Display entries in the Page Directory.\n\
Entry number (an expression) as an argument means display only that entry."),
&info_dos_cmdlist);
- add_cmd ("pte", class_info, go32_pte, _("\
+ add_cmd ("pte", class_info, go32_pte, _ ("\
Display entries in Page Tables.\n\
Entry number (an expression) as an argument means display only entries\n\
from the Page Table pointed to by the specified Page Directory entry."),
&info_dos_cmdlist);
- add_cmd ("address-pte", class_info, go32_pte_for_address, _("\
+ add_cmd ("address-pte", class_info, go32_pte_for_address, _ ("\
Display a Page Table entry for a linear address.\n\
The address argument must be a linear address, after adding to\n\
it the base address of the appropriate segment.\n\
diff --git a/gdb/guile/guile-internal.h b/gdb/guile/guile-internal.h
index 42ecb3c24f9..5200ce90bf1 100644
--- a/gdb/guile/guile-internal.h
+++ b/gdb/guile/guile-internal.h
@@ -23,7 +23,6 @@
/* See README file in this directory for implementation notes, coding
conventions, et.al. */
-
#include "hashtab.h"
#include "extension-priv.h"
#include "symtab.h"
@@ -50,7 +49,10 @@ struct scheme_variable
/* End of scheme_variable table mark. */
-#define END_VARIABLES { NULL, SCM_BOOL_F, NULL }
+#define END_VARIABLES \
+ { \
+ NULL, SCM_BOOL_F, NULL \
+ }
/* Although scm_t_subr is meant to hold a function pointer, at least
in some versions of guile, it is actually a typedef to "void *".
@@ -102,7 +104,10 @@ struct scheme_function
/* End of scheme_function table mark. */
-#define END_FUNCTIONS { NULL, 0, 0, 0, NULL, NULL }
+#define END_FUNCTIONS \
+ { \
+ NULL, 0, 0, 0, NULL, NULL \
+ }
/* Useful for defining a set of constants. */
@@ -112,7 +117,10 @@ struct scheme_integer_constant
int value;
};
-#define END_INTEGER_CONSTANTS { NULL, 0 }
+#define END_INTEGER_CONSTANTS \
+ { \
+ NULL, 0 \
+ }
/* Pass this instead of 0 to routines like SCM_ASSERT to indicate the value
is not a function argument. */
@@ -174,7 +182,7 @@ extern SCM gdbscm_invalid_object_error_symbol;
extern SCM gdbscm_map_string;
extern SCM gdbscm_array_string;
extern SCM gdbscm_string_string;
-
+
/* scm-utils.c */
extern void gdbscm_define_variables (const scheme_variable *, int is_public);
@@ -210,10 +218,10 @@ extern int gdbscm_is_procedure (SCM proc);
extern char *gdbscm_gc_xstrdup (const char *);
-extern const char * const *gdbscm_gc_dup_argv (char **argv);
+extern const char *const *gdbscm_gc_dup_argv (char **argv);
extern int gdbscm_guile_version_is_at_least (int major, int minor, int micro);
-
+
/* GDB smobs, from scm-gsmob.c */
/* All gdb smobs must contain one of the following as the first member:
@@ -237,8 +245,7 @@ extern int gdbscm_guile_version_is_at_least (int major, int minor, int micro);
gdb_smob as if it is a subclass. To that end we use macro GDB_SMOB_HEAD
to ensure this. */
-#define GDB_SMOB_HEAD \
- int empty_base_class;
+#define GDB_SMOB_HEAD int empty_base_class;
struct gdb_smob
{
@@ -290,15 +297,15 @@ extern void gdbscm_init_eqable_gsmob (eqable_gdb_smob *base,
extern htab_t gdbscm_create_eqable_gsmob_ptr_map (htab_hash hash_fn,
htab_eq eq_fn);
-extern eqable_gdb_smob **gdbscm_find_eqable_gsmob_ptr_slot
- (htab_t htab, eqable_gdb_smob *base);
+extern eqable_gdb_smob **
+gdbscm_find_eqable_gsmob_ptr_slot (htab_t htab, eqable_gdb_smob *base);
extern void gdbscm_fill_eqable_gsmob_ptr_slot (eqable_gdb_smob **slot,
eqable_gdb_smob *base);
extern void gdbscm_clear_eqable_gsmob_ptr_slot (htab_t htab,
eqable_gdb_smob *base);
-
+
/* Exceptions and calling out to Guile. */
/* scm-exception.c */
@@ -313,8 +320,8 @@ extern SCM gdbscm_exception_args (SCM excp);
extern SCM gdbscm_make_exception_with_stack (SCM key, SCM args, SCM stack);
-extern SCM gdbscm_make_error_scm (SCM key, SCM subr, SCM message,
- SCM args, SCM data);
+extern SCM gdbscm_make_error_scm (SCM key, SCM subr, SCM message, SCM args,
+ SCM data);
extern SCM gdbscm_make_error (SCM key, const char *subr, const char *message,
SCM args, SCM data);
@@ -326,39 +333,38 @@ extern SCM gdbscm_make_invalid_object_error (const char *subr, int arg_pos,
SCM bad_value, const char *error);
extern void gdbscm_invalid_object_error (const char *subr, int arg_pos,
- SCM bad_value, const char *error)
- ATTRIBUTE_NORETURN;
+ SCM bad_value,
+ const char *error) ATTRIBUTE_NORETURN;
extern SCM gdbscm_make_out_of_range_error (const char *subr, int arg_pos,
SCM bad_value, const char *error);
extern void gdbscm_out_of_range_error (const char *subr, int arg_pos,
- SCM bad_value, const char *error)
- ATTRIBUTE_NORETURN;
+ SCM bad_value,
+ const char *error) ATTRIBUTE_NORETURN;
extern SCM gdbscm_make_misc_error (const char *subr, int arg_pos,
SCM bad_value, const char *error);
-extern void gdbscm_misc_error (const char *subr, int arg_pos,
- SCM bad_value, const char *error)
- ATTRIBUTE_NORETURN;
+extern void gdbscm_misc_error (const char *subr, int arg_pos, SCM bad_value,
+ const char *error) ATTRIBUTE_NORETURN;
extern void gdbscm_throw (SCM exception) ATTRIBUTE_NORETURN;
struct gdbscm_gdb_exception;
-extern SCM gdbscm_scm_from_gdb_exception
- (const gdbscm_gdb_exception &exception);
+extern SCM
+gdbscm_scm_from_gdb_exception (const gdbscm_gdb_exception &exception);
-extern void gdbscm_throw_gdb_exception (gdbscm_gdb_exception exception)
- ATTRIBUTE_NORETURN;
+extern void
+gdbscm_throw_gdb_exception (gdbscm_gdb_exception exception) ATTRIBUTE_NORETURN;
-extern void gdbscm_print_exception_with_stack (SCM port, SCM stack,
- SCM key, SCM args);
+extern void gdbscm_print_exception_with_stack (SCM port, SCM stack, SCM key,
+ SCM args);
extern void gdbscm_print_gdb_exception (SCM port, SCM exception);
-extern gdb::unique_xmalloc_ptr<char> gdbscm_exception_message_to_string
- (SCM exception);
+extern gdb::unique_xmalloc_ptr<char>
+gdbscm_exception_message_to_string (SCM exception);
extern excp_matcher_func gdbscm_memory_error_p;
@@ -367,12 +373,13 @@ extern excp_matcher_func gdbscm_user_error_p;
extern SCM gdbscm_make_memory_error (const char *subr, const char *msg,
SCM args);
-extern void gdbscm_memory_error (const char *subr, const char *msg, SCM args)
- ATTRIBUTE_NORETURN;
+extern void gdbscm_memory_error (const char *subr, const char *msg,
+ SCM args) ATTRIBUTE_NORETURN;
/* scm-safe-call.c */
-extern const char *gdbscm_with_guile (const char *(*func) (void *), void *data);
+extern const char *gdbscm_with_guile (const char *(*func) (void *),
+ void *data);
extern SCM gdbscm_call_guile (SCM (*func) (void *), void *data,
excp_matcher_func *ok_excps);
@@ -389,22 +396,21 @@ extern SCM gdbscm_safe_call_3 (SCM proc, SCM arg0, SCM arg1, SCM arg2,
excp_matcher_func *ok_excps);
extern SCM gdbscm_safe_call_4 (SCM proc, SCM arg0, SCM arg1, SCM arg2,
- SCM arg3,
- excp_matcher_func *ok_excps);
+ SCM arg3, excp_matcher_func *ok_excps);
extern SCM gdbscm_safe_apply_1 (SCM proc, SCM arg0, SCM args,
excp_matcher_func *ok_excps);
extern SCM gdbscm_unsafe_call_1 (SCM proc, SCM arg0);
-extern gdb::unique_xmalloc_ptr<char> gdbscm_safe_eval_string
- (const char *string, int display_result);
+extern gdb::unique_xmalloc_ptr<char>
+gdbscm_safe_eval_string (const char *string, int display_result);
-extern gdb::unique_xmalloc_ptr<char> gdbscm_safe_source_script
- (const char *filename);
+extern gdb::unique_xmalloc_ptr<char>
+gdbscm_safe_source_script (const char *filename);
extern void gdbscm_enter_repl (void);
-
+
/* Interface to various GDB objects, in alphabetical order. */
/* scm-arch.c */
@@ -423,8 +429,9 @@ extern SCM arscm_scm_from_arch (struct gdbarch *gdbarch);
extern SCM bkscm_scm_from_block (const struct block *block,
struct objfile *objfile);
-extern const struct block *bkscm_scm_to_block
- (SCM block_scm, int arg_pos, const char *func_name, SCM *excp);
+extern const struct block *bkscm_scm_to_block (SCM block_scm, int arg_pos,
+ const char *func_name,
+ SCM *excp);
/* scm-cmd.c */
@@ -482,14 +489,13 @@ extern int lsscm_is_lazy_string (SCM scm);
extern SCM lsscm_make_lazy_string (CORE_ADDR address, int length,
const char *encoding, struct type *type);
-extern struct value *lsscm_safe_lazy_string_to_value (SCM string,
- int arg_pos,
+extern struct value *lsscm_safe_lazy_string_to_value (SCM string, int arg_pos,
const char *func_name,
SCM *except_scmp);
-extern void lsscm_val_print_lazy_string
- (SCM string, struct ui_file *stream,
- const struct value_print_options *options);
+extern void
+lsscm_val_print_lazy_string (SCM string, struct ui_file *stream,
+ const struct value_print_options *options);
/* scm-objfile.c */
@@ -520,16 +526,17 @@ extern gdb::unique_xmalloc_ptr<char> gdbscm_scm_to_c_string (SCM string);
extern SCM gdbscm_scm_from_c_string (const char *string);
extern SCM gdbscm_scm_from_printf (const char *format, ...)
- ATTRIBUTE_PRINTF (1, 2);
+ ATTRIBUTE_PRINTF (1, 2);
-extern gdb::unique_xmalloc_ptr<char> gdbscm_scm_to_string
- (SCM string, size_t *lenp, const char *charset, int strict, SCM *except_scmp);
+extern gdb::unique_xmalloc_ptr<char>
+gdbscm_scm_to_string (SCM string, size_t *lenp, const char *charset,
+ int strict, SCM *except_scmp);
extern SCM gdbscm_scm_from_string (const char *string, size_t len,
const char *charset, int strict);
-extern gdb::unique_xmalloc_ptr<char> gdbscm_scm_to_host_string
- (SCM string, size_t *lenp, SCM *except);
+extern gdb::unique_xmalloc_ptr<char>
+gdbscm_scm_to_host_string (SCM string, size_t *lenp, SCM *except);
extern SCM gdbscm_scm_from_host_string (const char *string, size_t len);
@@ -539,8 +546,9 @@ extern int syscm_is_symbol (SCM scm);
extern SCM syscm_scm_from_symbol (struct symbol *symbol);
-extern struct symbol *syscm_get_valid_symbol_arg_unsafe
- (SCM self, int arg_pos, const char *func_name);
+extern struct symbol *
+syscm_get_valid_symbol_arg_unsafe (SCM self, int arg_pos,
+ const char *func_name);
/* scm-symtab.c */
@@ -574,15 +582,15 @@ extern int vlscm_is_value (SCM scm);
extern SCM vlscm_scm_from_value (struct value *value);
extern SCM vlscm_scm_from_value_no_release (struct value *value);
-extern struct value *vlscm_convert_typed_value_from_scheme
- (const char *func_name, int obj_arg_pos, SCM obj,
- int type_arg_pos, SCM type_scm, struct type *type, SCM *except_scmp,
- struct gdbarch *gdbarch, const struct language_defn *language);
+extern struct value *vlscm_convert_typed_value_from_scheme (
+ const char *func_name, int obj_arg_pos, SCM obj, int type_arg_pos,
+ SCM type_scm, struct type *type, SCM *except_scmp, struct gdbarch *gdbarch,
+ const struct language_defn *language);
+
+extern struct value *vlscm_convert_value_from_scheme (
+ const char *func_name, int obj_arg_pos, SCM obj, SCM *except_scmp,
+ struct gdbarch *gdbarch, const struct language_defn *language);
-extern struct value *vlscm_convert_value_from_scheme
- (const char *func_name, int obj_arg_pos, SCM obj, SCM *except_scmp,
- struct gdbarch *gdbarch, const struct language_defn *language);
-
/* stript_lang methods */
extern objfile_script_sourcer_func gdbscm_source_objfile_script;
@@ -593,23 +601,23 @@ extern objfile_script_executor_func gdbscm_execute_objfile_script;
extern bool gdbscm_auto_load_enabled (const struct extension_language_defn *);
-extern void gdbscm_preserve_values
- (const struct extension_language_defn *,
- struct objfile *, htab_t copied_types);
+extern void gdbscm_preserve_values (const struct extension_language_defn *,
+ struct objfile *, htab_t copied_types);
-extern enum ext_lang_rc gdbscm_apply_val_pretty_printer
- (const struct extension_language_defn *,
- struct value *val,
- struct ui_file *stream, int recurse,
- const struct value_print_options *options,
- const struct language_defn *language);
+extern enum ext_lang_rc
+gdbscm_apply_val_pretty_printer (const struct extension_language_defn *,
+ struct value *val, struct ui_file *stream,
+ int recurse,
+ const struct value_print_options *options,
+ const struct language_defn *language);
extern int gdbscm_breakpoint_has_cond (const struct extension_language_defn *,
struct breakpoint *b);
-extern enum ext_lang_bp_stop gdbscm_breakpoint_cond_says_stop
- (const struct extension_language_defn *, struct breakpoint *b);
-
+extern enum ext_lang_bp_stop
+gdbscm_breakpoint_cond_says_stop (const struct extension_language_defn *,
+ struct breakpoint *b);
+
/* Initializers for each piece of Scheme support, in alphabetical order. */
extern void gdbscm_initialize_arches (void);
@@ -634,7 +642,6 @@ extern void gdbscm_initialize_symbols (void);
extern void gdbscm_initialize_symtabs (void);
extern void gdbscm_initialize_types (void);
extern void gdbscm_initialize_values (void);
-
/* A complication with the Guile code is that we have two types of
exceptions to consider. GDB/C++ exceptions, and Guile/SJLJ
@@ -675,14 +682,16 @@ unpack (const gdb_exception &exc)
/* Use this after a TRY/CATCH to throw the appropriate Scheme
exception if a GDB error occurred. */
-#define GDBSCM_HANDLE_GDB_EXCEPTION(exception) \
- do { \
- if (exception.reason < 0) \
- { \
- gdbscm_throw_gdb_exception (exception); \
- /*NOTREACHED */ \
- } \
- } while (0)
+#define GDBSCM_HANDLE_GDB_EXCEPTION(exception) \
+ do \
+ { \
+ if (exception.reason < 0) \
+ { \
+ gdbscm_throw_gdb_exception (exception); \
+ /*NOTREACHED */ \
+ } \
+ } \
+ while (0)
/* Use this to wrap a callable to throw the appropriate Scheme
exception if the callable throws a GDB error. ARGS are forwarded
@@ -695,7 +704,7 @@ unpack (const gdb_exception &exc)
template<typename Function, typename... Args>
SCM
-gdbscm_wrap (Function &&func, Args &&... args)
+gdbscm_wrap (Function &&func, Args &&...args)
{
SCM result = SCM_BOOL_F;
gdbscm_gdb_exception exc {};
diff --git a/gdb/guile/guile.c b/gdb/guile/guile.c
index 887b7fa5dc8..d3b7bcc69bf 100644
--- a/gdb/guile/guile.c
+++ b/gdb/guile/guile.c
@@ -58,13 +58,9 @@ const char gdbscm_print_excp_full[] = "full";
const char gdbscm_print_excp_message[] = "message";
/* "set guile print-stack" choices. */
-static const char *const guile_print_excp_enums[] =
- {
- gdbscm_print_excp_none,
- gdbscm_print_excp_full,
- gdbscm_print_excp_message,
- NULL
- };
+static const char *const guile_print_excp_enums[]
+ = { gdbscm_print_excp_none, gdbscm_print_excp_full,
+ gdbscm_print_excp_message, NULL };
/* The exception printing variable. 'full' if we want to print the
error message and stack, 'none' if we want to print nothing, and
@@ -72,13 +68,13 @@ static const char *const guile_print_excp_enums[] =
the default. */
const char *gdbscm_print_excp = gdbscm_print_excp_message;
-
#ifdef HAVE_GUILE
static void gdbscm_initialize (const struct extension_language_defn *);
static int gdbscm_initialized (const struct extension_language_defn *);
-static void gdbscm_eval_from_control_command
- (const struct extension_language_defn *, struct command_line *);
+static void
+gdbscm_eval_from_control_command (const struct extension_language_defn *,
+ struct command_line *);
static script_sourcer_func gdbscm_source_script;
static void gdbscm_set_backtrace (int enable);
@@ -100,18 +96,13 @@ static const char boot_scm_filename[] = "boot.scm";
/* The interface between gdb proper and loading of python scripts. */
-static const struct extension_language_script_ops guile_extension_script_ops =
-{
- gdbscm_source_script,
- gdbscm_source_objfile_script,
- gdbscm_execute_objfile_script,
- gdbscm_auto_load_enabled
-};
+static const struct extension_language_script_ops guile_extension_script_ops
+ = { gdbscm_source_script, gdbscm_source_objfile_script,
+ gdbscm_execute_objfile_script, gdbscm_auto_load_enabled };
/* The interface between gdb proper and guile scripting. */
-static const struct extension_language_ops guile_extension_ops =
-{
+static const struct extension_language_ops guile_extension_ops = {
gdbscm_initialize,
gdbscm_initialized,
@@ -141,25 +132,23 @@ static const struct extension_language_ops guile_extension_ops =
/* The main struct describing GDB's interface to the Guile
extension language. */
-extern const struct extension_language_defn extension_language_guile =
-{
- EXT_LANG_GUILE,
- "guile",
- "Guile",
+extern const struct extension_language_defn extension_language_guile
+ = { EXT_LANG_GUILE,
+ "guile",
+ "Guile",
- ".scm",
- "-gdb.scm",
+ ".scm",
+ "-gdb.scm",
- guile_control,
+ guile_control,
#ifdef HAVE_GUILE
- &guile_extension_script_ops,
- &guile_extension_ops
+ &guile_extension_script_ops,
+ &guile_extension_ops
#else
- NULL,
- NULL
+ NULL, NULL
#endif
-};
+ };
#ifdef HAVE_GUILE
/* Implementation of the gdb "guile-repl" command. */
@@ -178,7 +167,7 @@ guile_repl_command (const char *arg, int from_tty)
sort it out, we forbid arguments. */
if (arg && *arg)
- error (_("guile-repl currently does not take any arguments."));
+ error (_ ("guile-repl currently does not take any arguments."));
else
{
dont_repeat ();
@@ -249,13 +238,13 @@ compute_scheme_string (struct command_line *l)
This is the extension_language_ops.eval_from_control_command "method". */
static void
-gdbscm_eval_from_control_command
- (const struct extension_language_defn *extlang, struct command_line *cmd)
+gdbscm_eval_from_control_command (
+ const struct extension_language_defn *extlang, struct command_line *cmd)
{
char *script;
if (cmd->body_list_1 != nullptr)
- error (_("Invalid \"guile\" block structure."));
+ error (_ ("Invalid \"guile\" block structure."));
script = compute_scheme_string (cmd->body_list_0.get ());
gdb::unique_xmalloc_ptr<char> msg = gdbscm_safe_eval_string (script, 0);
@@ -279,7 +268,7 @@ gdbscm_source_script (const struct extension_language_defn *extlang,
if (msg != NULL)
gdb_printf (gdb_stderr, "%s\n", msg.get ());
}
-
+
/* (execute string [#:from-tty boolean] [#:to-string boolean])
A Scheme function which evaluates a string using the gdb CLI. */
@@ -292,31 +281,28 @@ gdbscm_execute_gdb_command (SCM command_scm, SCM rest)
char *command;
gdbscm_parse_function_args (FUNC_NAME, SCM_ARG1, keywords, "s#tt",
- command_scm, &command, rest,
- &from_tty_arg_pos, &from_tty,
- &to_string_arg_pos, &to_string);
+ command_scm, &command, rest, &from_tty_arg_pos,
+ &from_tty, &to_string_arg_pos, &to_string);
- return gdbscm_wrap ([=]
- {
- gdb::unique_xmalloc_ptr<char> command_holder (command);
- std::string to_string_res;
+ return gdbscm_wrap ([=] {
+ gdb::unique_xmalloc_ptr<char> command_holder (command);
+ std::string to_string_res;
- scoped_restore restore_async = make_scoped_restore (&current_ui->async,
- 0);
+ scoped_restore restore_async = make_scoped_restore (&current_ui->async, 0);
- scoped_restore preventer = prevent_dont_repeat ();
- if (to_string)
- execute_command_to_string (to_string_res, command, from_tty, false);
- else
- execute_command (command, from_tty);
+ scoped_restore preventer = prevent_dont_repeat ();
+ if (to_string)
+ execute_command_to_string (to_string_res, command, from_tty, false);
+ else
+ execute_command (command, from_tty);
- /* Do any commands attached to breakpoint we stopped at. */
- bpstat_do_actions ();
+ /* Do any commands attached to breakpoint we stopped at. */
+ bpstat_do_actions ();
- if (to_string)
- return gdbscm_scm_from_c_string (to_string_res.c_str ());
- return SCM_UNSPECIFIED;
- });
+ if (to_string)
+ return gdbscm_scm_from_c_string (to_string_res.c_str ());
+ return SCM_UNSPECIFIED;
+ });
}
/* (data-directory) -> string */
@@ -369,8 +355,8 @@ guile_repl_command (const char *arg, int from_tty)
{
arg = skip_spaces (arg);
if (arg && *arg)
- error (_("guile-repl currently does not take any arguments."));
- error (_("Guile scripting is not supported in this copy of GDB."));
+ error (_ ("guile-repl currently does not take any arguments."));
+ error (_ ("Guile scripting is not supported in this copy of GDB."));
}
static void
@@ -378,7 +364,7 @@ guile_command (const char *arg, int from_tty)
{
arg = skip_spaces (arg);
if (arg && *arg)
- error (_("Guile scripting is not supported in this copy of GDB."));
+ error (_ ("Guile scripting is not supported in this copy of GDB."));
else
{
/* Even if Guile isn't enabled, we still have to slurp the
@@ -390,22 +376,19 @@ guile_command (const char *arg, int from_tty)
}
#endif /* ! HAVE_GUILE */
-
+
/* Lists for 'set,show,info guile' commands. */
static struct cmd_list_element *set_guile_list;
static struct cmd_list_element *show_guile_list;
static struct cmd_list_element *info_guile_list;
-
/* Initialization. */
#ifdef HAVE_GUILE
-static const scheme_function misc_guile_functions[] =
-{
- { "execute", 1, 0, 1, as_a_scm_t_subr (gdbscm_execute_gdb_command),
- "\
+static const scheme_function misc_guile_functions[]
+ = { { "execute", 1, 0, 1, as_a_scm_t_subr (gdbscm_execute_gdb_command), "\
Execute the given GDB command.\n\
\n\
Arguments: string [#:to-string boolean] [#:from-tty boolean]\n\
@@ -417,29 +400,23 @@ Execute the given GDB command.\n\
Returns: The result of the command if #:to-string is true.\n\
Otherwise returns unspecified." },
- { "data-directory", 0, 0, 0, as_a_scm_t_subr (gdbscm_data_directory),
- "\
+ { "data-directory", 0, 0, 0, as_a_scm_t_subr (gdbscm_data_directory), "\
Return the name of GDB's data directory." },
- { "guile-data-directory", 0, 0, 0,
- as_a_scm_t_subr (gdbscm_guile_data_directory),
- "\
+ { "guile-data-directory", 0, 0, 0,
+ as_a_scm_t_subr (gdbscm_guile_data_directory), "\
Return the name of the Guile directory within GDB's data directory." },
- { "gdb-version", 0, 0, 0, as_a_scm_t_subr (gdbscm_gdb_version),
- "\
+ { "gdb-version", 0, 0, 0, as_a_scm_t_subr (gdbscm_gdb_version), "\
Return GDB's version string." },
- { "host-config", 0, 0, 0, as_a_scm_t_subr (gdbscm_host_config),
- "\
+ { "host-config", 0, 0, 0, as_a_scm_t_subr (gdbscm_host_config), "\
Return the name of the host configuration." },
- { "target-config", 0, 0, 0, as_a_scm_t_subr (gdbscm_target_config),
- "\
+ { "target-config", 0, 0, 0, as_a_scm_t_subr (gdbscm_target_config), "\
Return the name of the target configuration." },
- END_FUNCTIONS
-};
+ END_FUNCTIONS };
/* Load BOOT_SCM_FILE, the first Scheme file that gets loaded. */
@@ -463,8 +440,7 @@ boot_guile_support (void *boot_scm_file)
static int
standard_throw_args_p (SCM args)
{
- if (gdbscm_is_true (scm_list_p (args))
- && scm_ilength (args) >= 3)
+ if (gdbscm_is_true (scm_list_p (args)) && scm_ilength (args) >= 3)
{
/* The function in which the error occurred. */
SCM arg0 = scm_list_ref (args, scm_from_int (0));
@@ -474,8 +450,7 @@ standard_throw_args_p (SCM args)
SCM arg2 = scm_list_ref (args, scm_from_int (2));
if ((scm_is_string (arg0) || gdbscm_is_false (arg0))
- && scm_is_string (arg1)
- && gdbscm_is_true (scm_list_p (arg2)))
+ && scm_is_string (arg1) && gdbscm_is_true (scm_list_p (arg2)))
return 1;
}
@@ -497,9 +472,10 @@ print_standard_throw_error (SCM args)
/* ARG0 is #f if no function was recorded. */
if (gdbscm_is_true (arg0))
{
- scm_simple_format (scm_current_error_port (),
- scm_from_latin1_string (_("Error in function ~s:~%")),
- scm_list_1 (arg0));
+ scm_simple_format (
+ scm_current_error_port (),
+ scm_from_latin1_string (_ ("Error in function ~s:~%")),
+ scm_list_1 (arg0));
}
scm_simple_format (scm_current_error_port (), arg1, arg2);
}
@@ -521,9 +497,10 @@ print_throw_error (SCM key, SCM args)
print_standard_throw_error (args);
else
{
- scm_simple_format (scm_current_error_port (),
- scm_from_latin1_string (_("Throw to key `~a' with args `~s'.~%")),
- scm_list_2 (key, args));
+ scm_simple_format (
+ scm_current_error_port (),
+ scm_from_latin1_string (_ ("Throw to key `~a' with args `~s'.~%")),
+ scm_list_2 (key, args));
}
}
@@ -537,10 +514,10 @@ handle_boot_error (void *boot_scm_file, SCM key, SCM args)
print_throw_error (key, args);
gdb_printf (gdb_stderr, "\n");
- warning (_("Could not complete Guile gdb module initialization from:\n"
- "%s.\n"
- "Limited Guile support is available.\n"
- "Suggest passing --data-directory=/path/to/gdb/data-directory."),
+ warning (_ ("Could not complete Guile gdb module initialization from:\n"
+ "%s.\n"
+ "Limited Guile support is available.\n"
+ "Suggest passing --data-directory=/path/to/gdb/data-directory."),
(const char *) boot_scm_file);
return SCM_UNSPECIFIED;
@@ -554,10 +531,10 @@ initialize_scheme_side (void)
{
char *boot_scm_path;
- guile_datadir = concat (gdb_datadir.c_str (), SLASH_STRING, "guile",
- (char *) NULL);
- boot_scm_path = concat (guile_datadir, SLASH_STRING, "gdb",
- SLASH_STRING, boot_scm_filename, (char *) NULL);
+ guile_datadir
+ = concat (gdb_datadir.c_str (), SLASH_STRING, "guile", (char *) NULL);
+ boot_scm_path = concat (guile_datadir, SLASH_STRING, "gdb", SLASH_STRING,
+ boot_scm_filename, (char *) NULL);
scm_c_catch (SCM_BOOL_T, boot_guile_support, boot_scm_path,
handle_boot_error, boot_scm_path, NULL, NULL);
@@ -743,26 +720,26 @@ install_gdb_commands (void)
cmd_list_element *guile_repl_cmd
= add_com ("guile-repl", class_obscure, guile_repl_command,
#ifdef HAVE_GUILE
- _("\
+ _ ("\
Start an interactive Guile prompt.\n\
\n\
To return to GDB, type the EOF character (e.g., Ctrl-D on an empty\n\
prompt) or ,quit.")
-#else /* HAVE_GUILE */
- _("\
+#else /* HAVE_GUILE */
+ _ ("\
Start a Guile interactive prompt.\n\
\n\
Guile scripting is not supported in this copy of GDB.\n\
This command is only a placeholder.")
#endif /* HAVE_GUILE */
- );
+ );
add_com_alias ("gr", guile_repl_cmd, class_obscure, 1);
/* Since "help guile" is easy to type, and intuitive, we add general help
in using GDB+Guile to this command. */
guile_cmd_element = add_com ("guile", class_obscure, guile_command,
#ifdef HAVE_GUILE
- _("\
+ _ ("\
Evaluate one or more Guile expressions.\n\
\n\
The expression(s) can be given as an argument, for instance:\n\
@@ -784,48 +761,49 @@ or if you want to import the (gdb) module with a prefix, use:\n\
The Guile interactive session, started with the \"guile-repl\"\n\
command, provides extensive help and apropos capabilities.\n\
Type \",help\" once in a Guile interactive session.")
-#else /* HAVE_GUILE */
- _("\
+#else /* HAVE_GUILE */
+ _ ("\
Evaluate a Guile expression.\n\
\n\
Guile scripting is not supported in this copy of GDB.\n\
This command is only a placeholder.")
#endif /* HAVE_GUILE */
- );
+ );
add_com_alias ("gu", guile_cmd_element, class_obscure, 1);
set_show_commands setshow_guile_cmds
- = add_setshow_prefix_cmd ("guile", class_obscure,
- _("\
+ = add_setshow_prefix_cmd ("guile", class_obscure, _ ("\
Prefix command for Guile preference settings."),
- _("\
+ _ ("\
Prefix command for Guile preference settings."),
- &set_guile_list, &show_guile_list,
- &setlist, &showlist);
+ &set_guile_list, &show_guile_list, &setlist,
+ &showlist);
add_alias_cmd ("gu", setshow_guile_cmds.set, class_obscure, 1, &setlist);
add_alias_cmd ("gu", setshow_guile_cmds.show, class_obscure, 1, &showlist);
cmd_list_element *info_guile_cmd
= add_basic_prefix_cmd ("guile", class_obscure,
- _("Prefix command for Guile info displays."),
+ _ ("Prefix command for Guile info displays."),
&info_guile_list, 0, &infolist);
add_info_alias ("gu", info_guile_cmd, 1);
/* The name "print-stack" is carried over from Python.
A better name is "print-exception". */
add_setshow_enum_cmd ("print-stack", no_class, guile_print_excp_enums,
- &gdbscm_print_excp, _("\
-Set mode for Guile exception printing on error."), _("\
-Show the mode of Guile exception printing on error."), _("\
+ &gdbscm_print_excp, _ ("\
+Set mode for Guile exception printing on error."),
+ _ ("\
+Show the mode of Guile exception printing on error."),
+ _ ("\
none == no stack or message will be printed.\n\
full == a message and a stack will be printed.\n\
message == an error message without a stack will be printed."),
- NULL, NULL,
- &set_guile_list, &show_guile_list);
+ NULL, NULL, &set_guile_list, &show_guile_list);
}
void _initialize_guile ();
+
void
_initialize_guile ()
{
diff --git a/gdb/guile/scm-arch.c b/gdb/guile/scm-arch.c
index be66a188ea6..c442b4b2aea 100644
--- a/gdb/guile/scm-arch.c
+++ b/gdb/guile/scm-arch.c
@@ -44,10 +44,10 @@ static scm_t_bits arch_smob_tag;
/* Use a 'void *' here because it isn't guaranteed that SCM is a
pointer. */
static const registry<gdbarch>::key<void, gdb::noop_deleter<void>>
- arch_object_data;
+ arch_object_data;
static int arscm_is_arch (SCM);
-
+
/* Administrivia for arch smobs. */
/* The smob "print" function for <gdb:arch>. */
@@ -73,8 +73,8 @@ arscm_print_arch_smob (SCM self, SCM port, scm_print_state *pstate)
static SCM
arscm_make_arch_smob (struct gdbarch *gdbarch)
{
- arch_smob *a_smob = (arch_smob *)
- scm_gc_malloc (sizeof (arch_smob), arch_smob_name);
+ arch_smob *a_smob
+ = (arch_smob *) scm_gc_malloc (sizeof (arch_smob), arch_smob_name);
SCM a_scm;
a_smob->gdbarch = gdbarch;
@@ -155,7 +155,7 @@ arscm_get_arch_smob_arg_unsafe (SCM self, int arg_pos, const char *func_name)
return a_smob;
}
-
+
/* Arch methods. */
/* (current-arch) -> <gdb:arch>
@@ -190,7 +190,7 @@ static SCM
gdbscm_arch_charset (SCM self)
{
arch_smob *a_smob
- =arscm_get_arch_smob_arg_unsafe (self, SCM_ARG1, FUNC_NAME);
+ = arscm_get_arch_smob_arg_unsafe (self, SCM_ARG1, FUNC_NAME);
struct gdbarch *gdbarch = a_smob->gdbarch;
return gdbscm_scm_from_c_string (target_charset (gdbarch));
@@ -207,7 +207,7 @@ gdbscm_arch_wide_charset (SCM self)
return gdbscm_scm_from_c_string (target_wide_charset (gdbarch));
}
-
+
/* Builtin types.
The order the types are defined here follows the order in
@@ -232,8 +232,7 @@ gdbscm_arch_builtin_type (SCM self, const char *func_name)
static SCM
gdbscm_arch_void_type (SCM self)
{
- struct type *type
- = gdbscm_arch_builtin_type (self, FUNC_NAME)->builtin_void;
+ struct type *type = gdbscm_arch_builtin_type (self, FUNC_NAME)->builtin_void;
return tyscm_scm_from_type (type);
}
@@ -243,8 +242,7 @@ gdbscm_arch_void_type (SCM self)
static SCM
gdbscm_arch_char_type (SCM self)
{
- struct type *type
- = gdbscm_arch_builtin_type (self, FUNC_NAME)->builtin_char;
+ struct type *type = gdbscm_arch_builtin_type (self, FUNC_NAME)->builtin_char;
return tyscm_scm_from_type (type);
}
@@ -265,8 +263,7 @@ gdbscm_arch_short_type (SCM self)
static SCM
gdbscm_arch_int_type (SCM self)
{
- struct type *type
- = gdbscm_arch_builtin_type (self, FUNC_NAME)->builtin_int;
+ struct type *type = gdbscm_arch_builtin_type (self, FUNC_NAME)->builtin_int;
return tyscm_scm_from_type (type);
}
@@ -276,8 +273,7 @@ gdbscm_arch_int_type (SCM self)
static SCM
gdbscm_arch_long_type (SCM self)
{
- struct type *type
- = gdbscm_arch_builtin_type (self, FUNC_NAME)->builtin_long;
+ struct type *type = gdbscm_arch_builtin_type (self, FUNC_NAME)->builtin_long;
return tyscm_scm_from_type (type);
}
@@ -375,8 +371,7 @@ gdbscm_arch_longdouble_type (SCM self)
static SCM
gdbscm_arch_bool_type (SCM self)
{
- struct type *type
- = gdbscm_arch_builtin_type (self, FUNC_NAME)->builtin_bool;
+ struct type *type = gdbscm_arch_builtin_type (self, FUNC_NAME)->builtin_bool;
return tyscm_scm_from_type (type);
}
@@ -408,8 +403,7 @@ gdbscm_arch_ulonglong_type (SCM self)
static SCM
gdbscm_arch_int8_type (SCM self)
{
- struct type *type
- = gdbscm_arch_builtin_type (self, FUNC_NAME)->builtin_int8;
+ struct type *type = gdbscm_arch_builtin_type (self, FUNC_NAME)->builtin_int8;
return tyscm_scm_from_type (type);
}
@@ -490,103 +484,84 @@ gdbscm_arch_uint64_type (SCM self)
return tyscm_scm_from_type (type);
}
-
+
/* Initialize the Scheme architecture support. */
-static const scheme_function arch_functions[] =
-{
- { "arch?", 1, 0, 0, as_a_scm_t_subr (gdbscm_arch_p),
- "\
+static const scheme_function arch_functions[] = {
+ { "arch?", 1, 0, 0, as_a_scm_t_subr (gdbscm_arch_p), "\
Return #t if the object is a <gdb:arch> object." },
- { "current-arch", 0, 0, 0, as_a_scm_t_subr (gdbscm_current_arch),
- "\
+ { "current-arch", 0, 0, 0, as_a_scm_t_subr (gdbscm_current_arch), "\
Return the <gdb:arch> object representing the architecture of the\n\
currently selected stack frame, if there is one, or the architecture of the\n\
current target if there isn't.\n\
\n\
Arguments: none" },
- { "arch-name", 1, 0, 0, as_a_scm_t_subr (gdbscm_arch_name),
- "\
+ { "arch-name", 1, 0, 0, as_a_scm_t_subr (gdbscm_arch_name), "\
Return the name of the architecture." },
- { "arch-charset", 1, 0, 0, as_a_scm_t_subr (gdbscm_arch_charset),
- "\
+ { "arch-charset", 1, 0, 0, as_a_scm_t_subr (gdbscm_arch_charset), "\
Return name of target character set as a string." },
{ "arch-wide-charset", 1, 0, 0, as_a_scm_t_subr (gdbscm_arch_wide_charset),
- "\
+ "\
Return name of target wide character set as a string." },
- { "arch-void-type", 1, 0, 0, as_a_scm_t_subr (gdbscm_arch_void_type),
- "\
+ { "arch-void-type", 1, 0, 0, as_a_scm_t_subr (gdbscm_arch_void_type), "\
Return the <gdb:type> object for the \"void\" type\n\
of the architecture." },
- { "arch-char-type", 1, 0, 0, as_a_scm_t_subr (gdbscm_arch_char_type),
- "\
+ { "arch-char-type", 1, 0, 0, as_a_scm_t_subr (gdbscm_arch_char_type), "\
Return the <gdb:type> object for the \"char\" type\n\
of the architecture." },
- { "arch-short-type", 1, 0, 0, as_a_scm_t_subr (gdbscm_arch_short_type),
- "\
+ { "arch-short-type", 1, 0, 0, as_a_scm_t_subr (gdbscm_arch_short_type), "\
Return the <gdb:type> object for the \"short\" type\n\
of the architecture." },
- { "arch-int-type", 1, 0, 0, as_a_scm_t_subr (gdbscm_arch_int_type),
- "\
+ { "arch-int-type", 1, 0, 0, as_a_scm_t_subr (gdbscm_arch_int_type), "\
Return the <gdb:type> object for the \"int\" type\n\
of the architecture." },
- { "arch-long-type", 1, 0, 0, as_a_scm_t_subr (gdbscm_arch_long_type),
- "\
+ { "arch-long-type", 1, 0, 0, as_a_scm_t_subr (gdbscm_arch_long_type), "\
Return the <gdb:type> object for the \"long\" type\n\
of the architecture." },
- { "arch-schar-type", 1, 0, 0, as_a_scm_t_subr (gdbscm_arch_schar_type),
- "\
+ { "arch-schar-type", 1, 0, 0, as_a_scm_t_subr (gdbscm_arch_schar_type), "\
Return the <gdb:type> object for the \"signed char\" type\n\
of the architecture." },
- { "arch-uchar-type", 1, 0, 0, as_a_scm_t_subr (gdbscm_arch_uchar_type),
- "\
+ { "arch-uchar-type", 1, 0, 0, as_a_scm_t_subr (gdbscm_arch_uchar_type), "\
Return the <gdb:type> object for the \"unsigned char\" type\n\
of the architecture." },
- { "arch-ushort-type", 1, 0, 0, as_a_scm_t_subr (gdbscm_arch_ushort_type),
- "\
+ { "arch-ushort-type", 1, 0, 0, as_a_scm_t_subr (gdbscm_arch_ushort_type), "\
Return the <gdb:type> object for the \"unsigned short\" type\n\
of the architecture." },
- { "arch-uint-type", 1, 0, 0, as_a_scm_t_subr (gdbscm_arch_uint_type),
- "\
+ { "arch-uint-type", 1, 0, 0, as_a_scm_t_subr (gdbscm_arch_uint_type), "\
Return the <gdb:type> object for the \"unsigned int\" type\n\
of the architecture." },
- { "arch-ulong-type", 1, 0, 0, as_a_scm_t_subr (gdbscm_arch_ulong_type),
- "\
+ { "arch-ulong-type", 1, 0, 0, as_a_scm_t_subr (gdbscm_arch_ulong_type), "\
Return the <gdb:type> object for the \"unsigned long\" type\n\
of the architecture." },
- { "arch-float-type", 1, 0, 0, as_a_scm_t_subr (gdbscm_arch_float_type),
- "\
+ { "arch-float-type", 1, 0, 0, as_a_scm_t_subr (gdbscm_arch_float_type), "\
Return the <gdb:type> object for the \"float\" type\n\
of the architecture." },
- { "arch-double-type", 1, 0, 0, as_a_scm_t_subr (gdbscm_arch_double_type),
- "\
+ { "arch-double-type", 1, 0, 0, as_a_scm_t_subr (gdbscm_arch_double_type), "\
Return the <gdb:type> object for the \"double\" type\n\
of the architecture." },
{ "arch-longdouble-type", 1, 0, 0,
- as_a_scm_t_subr (gdbscm_arch_longdouble_type),
- "\
+ as_a_scm_t_subr (gdbscm_arch_longdouble_type), "\
Return the <gdb:type> object for the \"long double\" type\n\
of the architecture." },
- { "arch-bool-type", 1, 0, 0, as_a_scm_t_subr (gdbscm_arch_bool_type),
- "\
+ { "arch-bool-type", 1, 0, 0, as_a_scm_t_subr (gdbscm_arch_bool_type), "\
Return the <gdb:type> object for the \"bool\" type\n\
of the architecture." },
@@ -596,48 +571,39 @@ Return the <gdb:type> object for the \"long long\" type\n\
of the architecture." },
{ "arch-ulonglong-type", 1, 0, 0,
- as_a_scm_t_subr (gdbscm_arch_ulonglong_type),
- "\
+ as_a_scm_t_subr (gdbscm_arch_ulonglong_type), "\
Return the <gdb:type> object for the \"unsigned long long\" type\n\
of the architecture." },
- { "arch-int8-type", 1, 0, 0, as_a_scm_t_subr (gdbscm_arch_int8_type),
- "\
+ { "arch-int8-type", 1, 0, 0, as_a_scm_t_subr (gdbscm_arch_int8_type), "\
Return the <gdb:type> object for the \"int8\" type\n\
of the architecture." },
- { "arch-uint8-type", 1, 0, 0, as_a_scm_t_subr (gdbscm_arch_uint8_type),
- "\
+ { "arch-uint8-type", 1, 0, 0, as_a_scm_t_subr (gdbscm_arch_uint8_type), "\
Return the <gdb:type> object for the \"uint8\" type\n\
of the architecture." },
- { "arch-int16-type", 1, 0, 0, as_a_scm_t_subr (gdbscm_arch_int16_type),
- "\
+ { "arch-int16-type", 1, 0, 0, as_a_scm_t_subr (gdbscm_arch_int16_type), "\
Return the <gdb:type> object for the \"int16\" type\n\
of the architecture." },
- { "arch-uint16-type", 1, 0, 0, as_a_scm_t_subr (gdbscm_arch_uint16_type),
- "\
+ { "arch-uint16-type", 1, 0, 0, as_a_scm_t_subr (gdbscm_arch_uint16_type), "\
Return the <gdb:type> object for the \"uint16\" type\n\
of the architecture." },
- { "arch-int32-type", 1, 0, 0, as_a_scm_t_subr (gdbscm_arch_int32_type),
- "\
+ { "arch-int32-type", 1, 0, 0, as_a_scm_t_subr (gdbscm_arch_int32_type), "\
Return the <gdb:type> object for the \"int32\" type\n\
of the architecture." },
- { "arch-uint32-type", 1, 0, 0, as_a_scm_t_subr (gdbscm_arch_uint32_type),
- "\
+ { "arch-uint32-type", 1, 0, 0, as_a_scm_t_subr (gdbscm_arch_uint32_type), "\
Return the <gdb:type> object for the \"uint32\" type\n\
of the architecture." },
- { "arch-int64-type", 1, 0, 0, as_a_scm_t_subr (gdbscm_arch_int64_type),
- "\
+ { "arch-int64-type", 1, 0, 0, as_a_scm_t_subr (gdbscm_arch_int64_type), "\
Return the <gdb:type> object for the \"int64\" type\n\
of the architecture." },
- { "arch-uint64-type", 1, 0, 0, as_a_scm_t_subr (gdbscm_arch_uint64_type),
- "\
+ { "arch-uint64-type", 1, 0, 0, as_a_scm_t_subr (gdbscm_arch_uint64_type), "\
Return the <gdb:type> object for the \"uint64\" type\n\
of the architecture." },
diff --git a/gdb/guile/scm-auto-load.c b/gdb/guile/scm-auto-load.c
index fc98d99bc0a..a520fe54511 100644
--- a/gdb/guile/scm-auto-load.c
+++ b/gdb/guile/scm-auto-load.c
@@ -38,7 +38,7 @@ static void
show_auto_load_guile_scripts (struct ui_file *file, int from_tty,
struct cmd_list_element *c, const char *value)
{
- gdb_printf (file, _("Auto-loading of Guile scripts is %s.\n"), value);
+ gdb_printf (file, _ ("Auto-loading of Guile scripts is %s.\n"), value);
}
/* See guile-internal.h. */
@@ -56,14 +56,16 @@ info_auto_load_guile_scripts (const char *pattern, int from_tty)
{
auto_load_info_scripts (pattern, from_tty, &extension_language_guile);
}
-
+
void
gdbscm_initialize_auto_load (void)
{
add_setshow_boolean_cmd ("guile-scripts", class_support,
- &auto_load_guile_scripts, _("\
-Set the debugger's behaviour regarding auto-loaded Guile scripts."), _("\
-Show the debugger's behaviour regarding auto-loaded Guile scripts."), _("\
+ &auto_load_guile_scripts, _ ("\
+Set the debugger's behaviour regarding auto-loaded Guile scripts."),
+ _ ("\
+Show the debugger's behaviour regarding auto-loaded Guile scripts."),
+ _ ("\
If enabled, auto-loaded Guile scripts are loaded when the debugger reads\n\
an executable or shared library.\n\
This options has security implications for untrusted inferiors."),
@@ -72,7 +74,7 @@ This options has security implications for untrusted inferiors."),
auto_load_show_cmdlist_get ());
add_cmd ("guile-scripts", class_info, info_auto_load_guile_scripts,
- _("Print the list of automatically loaded Guile scripts.\n\
+ _ ("Print the list of automatically loaded Guile scripts.\n\
Usage: info auto-load guile-scripts [REGEXP]"),
auto_load_info_cmdlist_get ());
}
diff --git a/gdb/guile/scm-block.c b/gdb/guile/scm-block.c
index 02cd3ff9a43..dbbe65cd62e 100644
--- a/gdb/guile/scm-block.c
+++ b/gdb/guile/scm-block.c
@@ -67,7 +67,8 @@ struct block_syms_progress_smob
};
static const char block_smob_name[] = "gdb:block";
-static const char block_syms_progress_smob_name[] = "gdb:block-symbols-iterator";
+static const char block_syms_progress_smob_name[]
+ = "gdb:block-symbols-iterator";
/* The tag Guile knows the block smobs by. */
static scm_t_bits block_smob_tag;
@@ -85,8 +86,7 @@ struct bkscm_deleter
/* Helper function for bkscm_del_objfile_blocks to mark the block
as invalid. */
- static int
- bkscm_mark_block_invalid (void **slot, void *info)
+ static int bkscm_mark_block_invalid (void **slot, void *info)
{
block_smob *b_smob = (block_smob *) *slot;
@@ -104,8 +104,8 @@ struct bkscm_deleter
};
static const registry<objfile>::key<htab, bkscm_deleter>
- bkscm_objfile_data_key;
-
+ bkscm_objfile_data_key;
+
/* Administrivia for block smobs. */
/* Helper function to hash a block_smob. */
@@ -126,8 +126,7 @@ bkscm_eq_block_smob (const void *ap, const void *bp)
const block_smob *a = (const block_smob *) ap;
const block_smob *b = (const block_smob *) bp;
- return (a->block == b->block
- && a->block != NULL);
+ return (a->block == b->block && a->block != NULL);
}
/* Return the struct block pointer -> SCM mapping table.
@@ -187,8 +186,8 @@ bkscm_print_block_smob (SCM self, SCM port, scm_print_state *pstate)
if (b->function () != NULL)
gdbscm_printf (port, " %s", b->function ()->print_name ());
- gdbscm_printf (port, " %s-%s",
- hex_string (b->start ()), hex_string (b->end ()));
+ gdbscm_printf (port, " %s-%s", hex_string (b->start ()),
+ hex_string (b->end ()));
scm_puts (">", port);
@@ -203,8 +202,8 @@ bkscm_print_block_smob (SCM self, SCM port, scm_print_state *pstate)
static SCM
bkscm_make_block_smob (void)
{
- block_smob *b_smob = (block_smob *)
- scm_gc_malloc (sizeof (block_smob), block_smob_name);
+ block_smob *b_smob
+ = (block_smob *) scm_gc_malloc (sizeof (block_smob), block_smob_name);
SCM b_scm;
b_smob->block = NULL;
@@ -304,7 +303,7 @@ bkscm_get_valid_block_smob_arg_unsafe (SCM self, int arg_pos,
if (!bkscm_is_valid (b_smob))
{
gdbscm_invalid_object_error (func_name, arg_pos, self,
- _("<gdb:block>"));
+ _ ("<gdb:block>"));
}
return b_smob;
@@ -321,8 +320,8 @@ bkscm_get_valid_block (SCM scm, int arg_pos, const char *func_name, SCM *excp)
if (!bkscm_is_block (scm))
{
- *excp = gdbscm_make_type_error (func_name, arg_pos, scm,
- block_smob_name);
+ *excp
+ = gdbscm_make_type_error (func_name, arg_pos, scm, block_smob_name);
return NULL;
}
@@ -330,7 +329,7 @@ bkscm_get_valid_block (SCM scm, int arg_pos, const char *func_name, SCM *excp)
if (!bkscm_is_valid (b_smob))
{
*excp = gdbscm_make_invalid_object_error (func_name, arg_pos, scm,
- _("<gdb:block>"));
+ _ ("<gdb:block>"));
return NULL;
}
@@ -354,7 +353,6 @@ bkscm_scm_to_block (SCM block_scm, int arg_pos, const char *func_name,
return NULL;
}
-
/* Block methods. */
/* (block-valid? <gdb:block>) -> boolean
@@ -519,7 +517,7 @@ gdbscm_block_symbols (SCM self)
return scm_reverse_x (result, SCM_EOL);
}
-
+
/* The <gdb:block-symbols-iterator> object,
for iterating over all symbols in a block. */
@@ -543,17 +541,17 @@ bkscm_print_block_syms_progress_smob (SCM self, SCM port,
{
struct compunit_symtab *cust;
- gdbscm_printf (port, " %s",
- i_smob->iter.which == GLOBAL_BLOCK
- ? "global" : "static");
+ gdbscm_printf (port, " %s",
+ i_smob->iter.which == GLOBAL_BLOCK ? "global"
+ : "static");
if (i_smob->iter.idx != -1)
gdbscm_printf (port, " @%d", i_smob->iter.idx);
- cust = (i_smob->iter.idx == -1
- ? i_smob->iter.d.compunit_symtab
- : i_smob->iter.d.compunit_symtab->includes[i_smob->iter.idx]);
- gdbscm_printf (port, " %s",
- symtab_to_filename_for_display
- (cust->primary_filetab ()));
+ cust = (i_smob->iter.idx == -1 ? i_smob->iter.d.compunit_symtab
+ : i_smob->iter.d.compunit_symtab
+ ->includes[i_smob->iter.idx]);
+ gdbscm_printf (
+ port, " %s",
+ symtab_to_filename_for_display (cust->primary_filetab ()));
break;
}
case FIRST_LOCAL_BLOCK:
@@ -641,15 +639,14 @@ gdbscm_block_next_symbol_x (SCM self)
iter_smob = (iterator_smob *) SCM_SMOB_DATA (iter_scm);
block_scm = itscm_iterator_smob_object (iter_smob);
- b_smob = bkscm_get_valid_block_smob_arg_unsafe (block_scm,
- SCM_ARG1, FUNC_NAME);
+ b_smob
+ = bkscm_get_valid_block_smob_arg_unsafe (block_scm, SCM_ARG1, FUNC_NAME);
block = b_smob->block;
progress = itscm_iterator_smob_progress (iter_smob);
- SCM_ASSERT_TYPE (bkscm_is_block_syms_progress (progress),
- progress, SCM_ARG1, FUNC_NAME,
- block_syms_progress_smob_name);
+ SCM_ASSERT_TYPE (bkscm_is_block_syms_progress (progress), progress, SCM_ARG1,
+ FUNC_NAME, block_syms_progress_smob_name);
p_smob = (block_syms_progress_smob *) SCM_SMOB_DATA (progress);
if (!p_smob->initialized_p)
@@ -665,7 +662,7 @@ gdbscm_block_next_symbol_x (SCM self)
return syscm_scm_from_symbol (sym);
}
-
+
/* (lookup-block address) -> <gdb:block>
Returns the innermost lexical block containing the specified pc value,
or #f if there is none. */
@@ -696,83 +693,70 @@ gdbscm_lookup_block (SCM pc_scm)
if (cust == NULL || cust->objfile () == NULL)
{
gdbscm_out_of_range_error (FUNC_NAME, SCM_ARG1, pc_scm,
- _("cannot locate object file for block"));
+ _ ("cannot locate object file for block"));
}
if (block != NULL)
return bkscm_scm_from_block (block, cust->objfile ());
return SCM_BOOL_F;
}
-
+
/* Initialize the Scheme block support. */
-static const scheme_function block_functions[] =
-{
- { "block?", 1, 0, 0, as_a_scm_t_subr (gdbscm_block_p),
- "\
+static const scheme_function block_functions[]
+ = { { "block?", 1, 0, 0, as_a_scm_t_subr (gdbscm_block_p), "\
Return #t if the object is a <gdb:block> object." },
- { "block-valid?", 1, 0, 0, as_a_scm_t_subr (gdbscm_block_valid_p),
- "\
+ { "block-valid?", 1, 0, 0, as_a_scm_t_subr (gdbscm_block_valid_p), "\
Return #t if the block is valid.\n\
A block becomes invalid when its objfile is freed." },
- { "block-start", 1, 0, 0, as_a_scm_t_subr (gdbscm_block_start),
- "\
+ { "block-start", 1, 0, 0, as_a_scm_t_subr (gdbscm_block_start), "\
Return the start address of the block." },
- { "block-end", 1, 0, 0, as_a_scm_t_subr (gdbscm_block_end),
- "\
+ { "block-end", 1, 0, 0, as_a_scm_t_subr (gdbscm_block_end), "\
Return the end address of the block." },
- { "block-function", 1, 0, 0, as_a_scm_t_subr (gdbscm_block_function),
- "\
+ { "block-function", 1, 0, 0, as_a_scm_t_subr (gdbscm_block_function), "\
Return the gdb:symbol object of the function containing the block\n\
or #f if the block does not live in any function." },
- { "block-superblock", 1, 0, 0, as_a_scm_t_subr (gdbscm_block_superblock),
- "\
+ { "block-superblock", 1, 0, 0, as_a_scm_t_subr (gdbscm_block_superblock),
+ "\
Return the superblock (parent block) of the block." },
- { "block-global-block", 1, 0, 0, as_a_scm_t_subr (gdbscm_block_global_block),
- "\
+ { "block-global-block", 1, 0, 0,
+ as_a_scm_t_subr (gdbscm_block_global_block), "\
Return the global block of the block." },
- { "block-static-block", 1, 0, 0, as_a_scm_t_subr (gdbscm_block_static_block),
- "\
+ { "block-static-block", 1, 0, 0,
+ as_a_scm_t_subr (gdbscm_block_static_block), "\
Return the static block of the block." },
- { "block-global?", 1, 0, 0, as_a_scm_t_subr (gdbscm_block_global_p),
- "\
+ { "block-global?", 1, 0, 0, as_a_scm_t_subr (gdbscm_block_global_p), "\
Return #t if block is a global block." },
- { "block-static?", 1, 0, 0, as_a_scm_t_subr (gdbscm_block_static_p),
- "\
+ { "block-static?", 1, 0, 0, as_a_scm_t_subr (gdbscm_block_static_p), "\
Return #t if block is a static block." },
- { "block-symbols", 1, 0, 0, as_a_scm_t_subr (gdbscm_block_symbols),
- "\
+ { "block-symbols", 1, 0, 0, as_a_scm_t_subr (gdbscm_block_symbols), "\
Return a list of all symbols (as <gdb:symbol> objects) in the block." },
- { "make-block-symbols-iterator", 1, 0, 0,
- as_a_scm_t_subr (gdbscm_make_block_syms_iter),
- "\
+ { "make-block-symbols-iterator", 1, 0, 0,
+ as_a_scm_t_subr (gdbscm_make_block_syms_iter), "\
Return a <gdb:iterator> object for iterating over all symbols in the block." },
- { "block-symbols-progress?", 1, 0, 0,
- as_a_scm_t_subr (bkscm_block_syms_progress_p),
- "\
+ { "block-symbols-progress?", 1, 0, 0,
+ as_a_scm_t_subr (bkscm_block_syms_progress_p), "\
Return #t if the object is a <gdb:block-symbols-progress> object." },
- { "lookup-block", 1, 0, 0, as_a_scm_t_subr (gdbscm_lookup_block),
- "\
+ { "lookup-block", 1, 0, 0, as_a_scm_t_subr (gdbscm_lookup_block), "\
Return the innermost GDB block containing the address or #f if none found.\n\
\n\
Arguments:\n\
address: the address to lookup" },
- END_FUNCTIONS
-};
+ END_FUNCTIONS };
void
gdbscm_initialize_blocks (void)
diff --git a/gdb/guile/scm-breakpoint.c b/gdb/guile/scm-breakpoint.c
index a7e043d847b..7b61221a36e 100644
--- a/gdb/guile/scm-breakpoint.c
+++ b/gdb/guile/scm-breakpoint.c
@@ -107,7 +107,7 @@ static SCM type_keyword;
static SCM wp_class_keyword;
static SCM internal_keyword;
static SCM temporary_keyword;
-
+
/* Administrivia for breakpoint smobs. */
/* The smob "free" function for <gdb:breakpoint>. */
@@ -136,14 +136,22 @@ bpscm_type_to_string (enum bptype type)
{
switch (type)
{
- case bp_none: return "BP_NONE";
- case bp_breakpoint: return "BP_BREAKPOINT";
- case bp_watchpoint: return "BP_WATCHPOINT";
- case bp_hardware_watchpoint: return "BP_HARDWARE_WATCHPOINT";
- case bp_read_watchpoint: return "BP_READ_WATCHPOINT";
- case bp_access_watchpoint: return "BP_ACCESS_WATCHPOINT";
- case bp_catchpoint: return "BP_CATCHPOINT";
- default: return "internal/other";
+ case bp_none:
+ return "BP_NONE";
+ case bp_breakpoint:
+ return "BP_BREAKPOINT";
+ case bp_watchpoint:
+ return "BP_WATCHPOINT";
+ case bp_hardware_watchpoint:
+ return "BP_HARDWARE_WATCHPOINT";
+ case bp_read_watchpoint:
+ return "BP_READ_WATCHPOINT";
+ case bp_access_watchpoint:
+ return "BP_ACCESS_WATCHPOINT";
+ case bp_catchpoint:
+ return "BP_CATCHPOINT";
+ default:
+ return "internal/other";
}
}
@@ -154,10 +162,14 @@ bpscm_enable_state_to_string (enum enable_state enable_state)
{
switch (enable_state)
{
- case bp_disabled: return "disabled";
- case bp_enabled: return "enabled";
- case bp_call_disabled: return "call_disabled";
- default: return "unknown";
+ case bp_disabled:
+ return "disabled";
+ case bp_enabled:
+ return "enabled";
+ case bp_call_disabled:
+ return "call_disabled";
+ default:
+ return "unknown";
}
}
@@ -179,8 +191,7 @@ bpscm_print_breakpoint_smob (SCM self, SCM port, scm_print_state *pstate)
/* Careful, the breakpoint may be invalid. */
if (b != NULL)
{
- gdbscm_printf (port, " %s %s %s",
- bpscm_type_to_string (b->type),
+ gdbscm_printf (port, " %s %s %s", bpscm_type_to_string (b->type),
bpscm_enable_state_to_string (b->enable_state),
b->silent ? "silent" : "noisy");
@@ -208,8 +219,9 @@ bpscm_print_breakpoint_smob (SCM self, SCM port, scm_print_state *pstate)
static SCM
bpscm_make_breakpoint_smob (void)
{
- breakpoint_smob *bp_smob = (breakpoint_smob *)
- scm_gc_malloc (sizeof (breakpoint_smob), breakpoint_smob_name);
+ breakpoint_smob *bp_smob
+ = (breakpoint_smob *) scm_gc_malloc (sizeof (breakpoint_smob),
+ breakpoint_smob_name);
SCM bp_scm;
memset (bp_smob, 0, sizeof (*bp_smob));
@@ -234,12 +246,9 @@ bpscm_want_scm_wrapper_p (struct breakpoint *bp, int from_scheme)
return 0;
/* The others are not supported. */
- if (bp->type != bp_breakpoint
- && bp->type != bp_watchpoint
- && bp->type != bp_hardware_watchpoint
- && bp->type != bp_read_watchpoint
- && bp->type != bp_access_watchpoint
- && bp->type != bp_catchpoint)
+ if (bp->type != bp_breakpoint && bp->type != bp_watchpoint
+ && bp->type != bp_hardware_watchpoint && bp->type != bp_read_watchpoint
+ && bp->type != bp_access_watchpoint && bp->type != bp_catchpoint)
return 0;
return 1;
@@ -327,12 +336,12 @@ bpscm_get_valid_breakpoint_smob_arg_unsafe (SCM self, int arg_pos,
if (!bpscm_is_valid (bp_smob))
{
gdbscm_invalid_object_error (func_name, arg_pos, self,
- _("<gdb:breakpoint>"));
+ _ ("<gdb:breakpoint>"));
}
return bp_smob;
}
-
+
/* Breakpoint methods. */
/* (make-breakpoint string [#:type integer] [#:wp-class integer]
@@ -345,14 +354,12 @@ bpscm_get_valid_breakpoint_smob_arg_unsafe (SCM self, int arg_pos,
static SCM
gdbscm_make_breakpoint (SCM location_scm, SCM rest)
{
- const SCM keywords[] = {
- type_keyword, wp_class_keyword, internal_keyword,
- temporary_keyword, SCM_BOOL_F
- };
+ const SCM keywords[] = { type_keyword, wp_class_keyword, internal_keyword,
+ temporary_keyword, SCM_BOOL_F };
char *s;
char *location;
- int type_arg_pos = -1, access_type_arg_pos = -1,
- internal_arg_pos = -1, temporary_arg_pos = -1;
+ int type_arg_pos = -1, access_type_arg_pos = -1, internal_arg_pos = -1,
+ temporary_arg_pos = -1;
int type = bp_breakpoint;
int access_type = hw_write;
int internal = 0;
@@ -361,11 +368,10 @@ gdbscm_make_breakpoint (SCM location_scm, SCM rest)
breakpoint_smob *bp_smob;
gdbscm_parse_function_args (FUNC_NAME, SCM_ARG1, keywords, "s#iitt",
- location_scm, &location, rest,
- &type_arg_pos, &type,
- &access_type_arg_pos, &access_type,
- &internal_arg_pos, &internal,
- &temporary_arg_pos, &temporary);
+ location_scm, &location, rest, &type_arg_pos,
+ &type, &access_type_arg_pos, &access_type,
+ &internal_arg_pos, &internal, &temporary_arg_pos,
+ &temporary);
result = bpscm_make_breakpoint_smob ();
bp_smob = (breakpoint_smob *) SCM_SMOB_DATA (result);
@@ -381,7 +387,7 @@ gdbscm_make_breakpoint (SCM location_scm, SCM rest)
{
gdbscm_misc_error (FUNC_NAME, access_type_arg_pos,
scm_from_int (access_type),
- _("access type with breakpoint is not allowed"));
+ _ ("access type with breakpoint is not allowed"));
}
break;
case bp_watchpoint:
@@ -394,7 +400,7 @@ gdbscm_make_breakpoint (SCM location_scm, SCM rest)
default:
gdbscm_out_of_range_error (FUNC_NAME, access_type_arg_pos,
scm_from_int (access_type),
- _("invalid watchpoint class"));
+ _ ("invalid watchpoint class"));
}
break;
case bp_none:
@@ -406,13 +412,12 @@ gdbscm_make_breakpoint (SCM location_scm, SCM rest)
const char *type_name = bpscm_type_to_string ((enum bptype) type);
gdbscm_misc_error (FUNC_NAME, type_arg_pos,
gdbscm_scm_from_c_string (type_name),
- _("unsupported breakpoint type"));
+ _ ("unsupported breakpoint type"));
}
break;
default:
- gdbscm_out_of_range_error (FUNC_NAME, type_arg_pos,
- scm_from_int (type),
- _("invalid breakpoint type"));
+ gdbscm_out_of_range_error (FUNC_NAME, type_arg_pos, scm_from_int (type),
+ _ ("invalid breakpoint type"));
}
bp_smob->is_scheme_bkpt = 1;
@@ -440,17 +445,17 @@ gdbscm_register_breakpoint_x (SCM self)
/* We only support registering breakpoints created with make-breakpoint. */
if (!bp_smob->is_scheme_bkpt)
- scm_misc_error (FUNC_NAME, _("not a Scheme breakpoint"), SCM_EOL);
+ scm_misc_error (FUNC_NAME, _ ("not a Scheme breakpoint"), SCM_EOL);
if (bpscm_is_valid (bp_smob))
- scm_misc_error (FUNC_NAME, _("breakpoint is already registered"), SCM_EOL);
+ scm_misc_error (FUNC_NAME, _ ("breakpoint is already registered"),
+ SCM_EOL);
pending_breakpoint_scm = self;
location = bp_smob->spec.location;
copy = skip_spaces (location);
location_spec_up locspec
- = string_to_location_spec_basic (&copy,
- current_language,
+ = string_to_location_spec_basic (&copy, current_language,
symbol_name_match_type::WILD);
try
@@ -462,16 +467,11 @@ gdbscm_register_breakpoint_x (SCM self)
{
case bp_breakpoint:
{
- const breakpoint_ops *ops =
- breakpoint_ops_for_location_spec (locspec.get (), false);
- create_breakpoint (get_current_arch (),
- locspec.get (), NULL, -1, NULL, false,
- 0,
- temporary, bp_breakpoint,
- 0,
- AUTO_BOOLEAN_TRUE,
- ops,
- 0, 1, internal, 0);
+ const breakpoint_ops *ops
+ = breakpoint_ops_for_location_spec (locspec.get (), false);
+ create_breakpoint (get_current_arch (), locspec.get (), NULL, -1,
+ NULL, false, 0, temporary, bp_breakpoint, 0,
+ AUTO_BOOLEAN_TRUE, ops, 0, 1, internal, 0);
break;
}
case bp_watchpoint:
@@ -607,7 +607,7 @@ gdbscm_set_breakpoint_enabled_x (SCM self, SCM newvalue)
= bpscm_get_valid_breakpoint_smob_arg_unsafe (self, SCM_ARG1, FUNC_NAME);
SCM_ASSERT_TYPE (gdbscm_is_bool (newvalue), newvalue, SCM_ARG2, FUNC_NAME,
- _("boolean"));
+ _ ("boolean"));
gdbscm_gdb_exception exc {};
try
@@ -646,7 +646,7 @@ gdbscm_set_breakpoint_silent_x (SCM self, SCM newvalue)
= bpscm_get_valid_breakpoint_smob_arg_unsafe (self, SCM_ARG1, FUNC_NAME);
SCM_ASSERT_TYPE (gdbscm_is_bool (newvalue), newvalue, SCM_ARG2, FUNC_NAME,
- _("boolean"));
+ _ ("boolean"));
gdbscm_gdb_exception exc {};
try
@@ -684,7 +684,7 @@ gdbscm_set_breakpoint_ignore_count_x (SCM self, SCM newvalue)
long value;
SCM_ASSERT_TYPE (scm_is_signed_integer (newvalue, LONG_MIN, LONG_MAX),
- newvalue, SCM_ARG2, FUNC_NAME, _("integer"));
+ newvalue, SCM_ARG2, FUNC_NAME, _ ("integer"));
value = scm_to_long (newvalue);
if (value < 0)
@@ -725,7 +725,7 @@ gdbscm_set_breakpoint_hit_count_x (SCM self, SCM newvalue)
long value;
SCM_ASSERT_TYPE (scm_is_signed_integer (newvalue, LONG_MIN, LONG_MAX),
- newvalue, SCM_ARG2, FUNC_NAME, _("integer"));
+ newvalue, SCM_ARG2, FUNC_NAME, _ ("integer"));
value = scm_to_long (newvalue);
if (value < 0)
@@ -734,7 +734,7 @@ gdbscm_set_breakpoint_hit_count_x (SCM self, SCM newvalue)
if (value != 0)
{
gdbscm_out_of_range_error (FUNC_NAME, SCM_ARG2, newvalue,
- _("hit-count must be zero"));
+ _ ("hit-count must be zero"));
}
bp_smob->bp->hit_count = 0;
@@ -771,13 +771,13 @@ gdbscm_set_breakpoint_thread_x (SCM self, SCM newvalue)
if (!valid_global_thread_id (id))
{
gdbscm_out_of_range_error (FUNC_NAME, SCM_ARG2, newvalue,
- _("invalid thread id"));
+ _ ("invalid thread id"));
}
}
else if (gdbscm_is_false (newvalue))
id = -1;
else
- SCM_ASSERT_TYPE (0, newvalue, SCM_ARG2, FUNC_NAME, _("integer or #f"));
+ SCM_ASSERT_TYPE (0, newvalue, SCM_ARG2, FUNC_NAME, _ ("integer or #f"));
breakpoint_set_thread (bp_smob->bp, id);
@@ -823,16 +823,16 @@ gdbscm_set_breakpoint_task_x (SCM self, SCM newvalue)
}
GDBSCM_HANDLE_GDB_EXCEPTION (exc);
- if (! valid_id)
+ if (!valid_id)
{
gdbscm_out_of_range_error (FUNC_NAME, SCM_ARG2, newvalue,
- _("invalid task id"));
+ _ ("invalid task id"));
}
}
else if (gdbscm_is_false (newvalue))
id = 0;
else
- SCM_ASSERT_TYPE (0, newvalue, SCM_ARG2, FUNC_NAME, _("integer or #f"));
+ SCM_ASSERT_TYPE (0, newvalue, SCM_ARG2, FUNC_NAME, _ ("integer or #f"));
gdbscm_gdb_exception exc {};
try
@@ -883,7 +883,7 @@ gdbscm_breakpoint_expression (SCM self)
wp = (struct watchpoint *) bp_smob->bp;
const char *str = wp->exp_string.get ();
- if (! str)
+ if (!str)
str = "";
return gdbscm_scm_from_c_string (str);
@@ -899,7 +899,7 @@ gdbscm_breakpoint_condition (SCM self)
char *str;
str = bp_smob->bp->cond_string.get ();
- if (! str)
+ if (!str)
return SCM_BOOL_F;
return gdbscm_scm_from_c_string (str);
@@ -915,20 +915,17 @@ gdbscm_set_breakpoint_condition_x (SCM self, SCM newvalue)
= bpscm_get_valid_breakpoint_smob_arg_unsafe (self, SCM_ARG1, FUNC_NAME);
SCM_ASSERT_TYPE (scm_is_string (newvalue) || gdbscm_is_false (newvalue),
- newvalue, SCM_ARG2, FUNC_NAME,
- _("string or #f"));
+ newvalue, SCM_ARG2, FUNC_NAME, _ ("string or #f"));
- return gdbscm_wrap ([=]
- {
- gdb::unique_xmalloc_ptr<char> exp
- = (gdbscm_is_false (newvalue)
- ? nullptr
- : gdbscm_scm_to_c_string (newvalue));
+ return gdbscm_wrap ([=] {
+ gdb::unique_xmalloc_ptr<char> exp
+ = (gdbscm_is_false (newvalue) ? nullptr
+ : gdbscm_scm_to_c_string (newvalue));
- set_breakpoint_condition (bp_smob->bp, exp ? exp.get () : "", 0, false);
+ set_breakpoint_condition (bp_smob->bp, exp ? exp.get () : "", 0, false);
- return SCM_UNSPECIFIED;
- });
+ return SCM_UNSPECIFIED;
+ });
}
/* (breakpoint-stop <gdb:breakpoint>) -> procedure or #f */
@@ -953,9 +950,8 @@ gdbscm_set_breakpoint_stop_x (SCM self, SCM newvalue)
const struct extension_language_defn *extlang = NULL;
SCM_ASSERT_TYPE (gdbscm_is_procedure (newvalue)
- || gdbscm_is_false (newvalue),
- newvalue, SCM_ARG2, FUNC_NAME,
- _("procedure or #f"));
+ || gdbscm_is_false (newvalue),
+ newvalue, SCM_ARG2, FUNC_NAME, _ ("procedure or #f"));
if (bp_smob->bp->cond_string != NULL)
extlang = get_ext_lang_defn (EXT_LANG_GDB);
@@ -964,10 +960,11 @@ gdbscm_set_breakpoint_stop_x (SCM self, SCM newvalue)
if (extlang != NULL)
{
char *error_text
- = xstrprintf (_("Only one stop condition allowed. There is"
- " currently a %s stop condition defined for"
- " this breakpoint."),
- ext_lang_capitalized_name (extlang)).release ();
+ = xstrprintf (_ ("Only one stop condition allowed. There is"
+ " currently a %s stop condition defined for"
+ " this breakpoint."),
+ ext_lang_capitalized_name (extlang))
+ .release ();
scm_dynwind_begin ((scm_t_dynwind_flags) 0);
gdbscm_dynwind_xfree (error_text);
@@ -1060,7 +1057,7 @@ gdbscm_breakpoint_temporary (SCM self)
return scm_from_bool (bp_smob->bp->disposition == disp_del
|| bp_smob->bp->disposition == disp_del_at_next_stop);
}
-
+
/* Return TRUE if "stop" has been set for this breakpoint.
This is the extension_language_ops.breakpoint_has_cond "method". */
@@ -1086,8 +1083,8 @@ gdbscm_breakpoint_has_cond (const struct extension_language_defn *extlang,
This is the extension_language_ops.breakpoint_cond_says_stop "method". */
enum ext_lang_bp_stop
-gdbscm_breakpoint_cond_says_stop
- (const struct extension_language_defn *extlang, struct breakpoint *b)
+gdbscm_breakpoint_cond_says_stop (
+ const struct extension_language_defn *extlang, struct breakpoint *b)
{
breakpoint_smob *bp_smob = b->scm_bp_object;
SCM predicate_result;
@@ -1112,7 +1109,7 @@ gdbscm_breakpoint_cond_says_stop
return stop ? EXT_LANG_BP_STOP_YES : EXT_LANG_BP_STOP_NO;
}
-
+
/* Event callback functions. */
/* Callback that is used when a breakpoint is created.
@@ -1164,30 +1161,26 @@ bpscm_breakpoint_deleted (struct breakpoint *b)
}
}
}
-
+
/* Initialize the Scheme breakpoint code. */
-static const scheme_integer_constant breakpoint_integer_constants[] =
-{
- { "BP_NONE", bp_none },
- { "BP_BREAKPOINT", bp_breakpoint },
- { "BP_WATCHPOINT", bp_watchpoint },
- { "BP_HARDWARE_WATCHPOINT", bp_hardware_watchpoint },
- { "BP_READ_WATCHPOINT", bp_read_watchpoint },
- { "BP_ACCESS_WATCHPOINT", bp_access_watchpoint },
- { "BP_CATCHPOINT", bp_catchpoint },
-
- { "WP_READ", hw_read },
- { "WP_WRITE", hw_write },
- { "WP_ACCESS", hw_access },
-
- END_INTEGER_CONSTANTS
-};
+static const scheme_integer_constant breakpoint_integer_constants[]
+ = { { "BP_NONE", bp_none },
+ { "BP_BREAKPOINT", bp_breakpoint },
+ { "BP_WATCHPOINT", bp_watchpoint },
+ { "BP_HARDWARE_WATCHPOINT", bp_hardware_watchpoint },
+ { "BP_READ_WATCHPOINT", bp_read_watchpoint },
+ { "BP_ACCESS_WATCHPOINT", bp_access_watchpoint },
+ { "BP_CATCHPOINT", bp_catchpoint },
-static const scheme_function breakpoint_functions[] =
-{
- { "make-breakpoint", 1, 0, 1, as_a_scm_t_subr (gdbscm_make_breakpoint),
- "\
+ { "WP_READ", hw_read },
+ { "WP_WRITE", hw_write },
+ { "WP_ACCESS", hw_access },
+
+ END_INTEGER_CONSTANTS };
+
+static const scheme_function breakpoint_functions[] = {
+ { "make-breakpoint", 1, 0, 1, as_a_scm_t_subr (gdbscm_make_breakpoint), "\
Create a GDB breakpoint object.\n\
\n\
Arguments:\n\
@@ -1196,22 +1189,19 @@ Create a GDB breakpoint object.\n\
<gdb:breakpoint> object" },
{ "register-breakpoint!", 1, 0, 0,
- as_a_scm_t_subr (gdbscm_register_breakpoint_x),
- "\
+ as_a_scm_t_subr (gdbscm_register_breakpoint_x), "\
Register a <gdb:breakpoint> object with GDB." },
- { "delete-breakpoint!", 1, 0, 0, as_a_scm_t_subr (gdbscm_delete_breakpoint_x),
- "\
+ { "delete-breakpoint!", 1, 0, 0,
+ as_a_scm_t_subr (gdbscm_delete_breakpoint_x), "\
Delete the breakpoint from GDB." },
- { "breakpoints", 0, 0, 0, as_a_scm_t_subr (gdbscm_breakpoints),
- "\
+ { "breakpoints", 0, 0, 0, as_a_scm_t_subr (gdbscm_breakpoints), "\
Return a list of all GDB breakpoints.\n\
\n\
Arguments: none" },
- { "breakpoint?", 1, 0, 0, as_a_scm_t_subr (gdbscm_breakpoint_p),
- "\
+ { "breakpoint?", 1, 0, 0, as_a_scm_t_subr (gdbscm_breakpoint_p), "\
Return #t if the object is a <gdb:breakpoint> object." },
{ "breakpoint-valid?", 1, 0, 0, as_a_scm_t_subr (gdbscm_breakpoint_valid_p),
@@ -1222,72 +1212,62 @@ Return #t if the breakpoint has not been deleted from GDB." },
"\
Return the breakpoint's number." },
- { "breakpoint-temporary?", 1, 0, 0, as_a_scm_t_subr (gdbscm_breakpoint_temporary),
- "\
+ { "breakpoint-temporary?", 1, 0, 0,
+ as_a_scm_t_subr (gdbscm_breakpoint_temporary), "\
Return #t if the breakpoint is a temporary breakpoint." },
- { "breakpoint-type", 1, 0, 0, as_a_scm_t_subr (gdbscm_breakpoint_type),
- "\
+ { "breakpoint-type", 1, 0, 0, as_a_scm_t_subr (gdbscm_breakpoint_type), "\
Return the type of the breakpoint." },
- { "breakpoint-visible?", 1, 0, 0, as_a_scm_t_subr (gdbscm_breakpoint_visible),
- "\
+ { "breakpoint-visible?", 1, 0, 0,
+ as_a_scm_t_subr (gdbscm_breakpoint_visible), "\
Return #t if the breakpoint is visible to the user." },
{ "breakpoint-location", 1, 0, 0,
- as_a_scm_t_subr (gdbscm_breakpoint_location),
- "\
+ as_a_scm_t_subr (gdbscm_breakpoint_location), "\
Return the location of the breakpoint as specified by the user." },
{ "breakpoint-expression", 1, 0, 0,
- as_a_scm_t_subr (gdbscm_breakpoint_expression),
- "\
+ as_a_scm_t_subr (gdbscm_breakpoint_expression), "\
Return the expression of the breakpoint as specified by the user.\n\
Valid for watchpoints only, returns #f for non-watchpoints." },
{ "breakpoint-enabled?", 1, 0, 0,
- as_a_scm_t_subr (gdbscm_breakpoint_enabled_p),
- "\
+ as_a_scm_t_subr (gdbscm_breakpoint_enabled_p), "\
Return #t if the breakpoint is enabled." },
{ "set-breakpoint-enabled!", 2, 0, 0,
- as_a_scm_t_subr (gdbscm_set_breakpoint_enabled_x),
- "\
+ as_a_scm_t_subr (gdbscm_set_breakpoint_enabled_x), "\
Set the breakpoint's enabled state.\n\
\n\
Arguments: <gdb:breakpoint> boolean" },
- { "breakpoint-silent?", 1, 0, 0, as_a_scm_t_subr (gdbscm_breakpoint_silent_p),
- "\
+ { "breakpoint-silent?", 1, 0, 0,
+ as_a_scm_t_subr (gdbscm_breakpoint_silent_p), "\
Return #t if the breakpoint is silent." },
{ "set-breakpoint-silent!", 2, 0, 0,
- as_a_scm_t_subr (gdbscm_set_breakpoint_silent_x),
- "\
+ as_a_scm_t_subr (gdbscm_set_breakpoint_silent_x), "\
Set the breakpoint's silent state.\n\
\n\
Arguments: <gdb:breakpoint> boolean" },
{ "breakpoint-ignore-count", 1, 0, 0,
- as_a_scm_t_subr (gdbscm_breakpoint_ignore_count),
- "\
+ as_a_scm_t_subr (gdbscm_breakpoint_ignore_count), "\
Return the breakpoint's \"ignore\" count." },
{ "set-breakpoint-ignore-count!", 2, 0, 0,
- as_a_scm_t_subr (gdbscm_set_breakpoint_ignore_count_x),
- "\
+ as_a_scm_t_subr (gdbscm_set_breakpoint_ignore_count_x), "\
Set the breakpoint's \"ignore\" count.\n\
\n\
Arguments: <gdb:breakpoint> count" },
{ "breakpoint-hit-count", 1, 0, 0,
- as_a_scm_t_subr (gdbscm_breakpoint_hit_count),
- "\
+ as_a_scm_t_subr (gdbscm_breakpoint_hit_count), "\
Return the breakpoint's \"hit\" count." },
{ "set-breakpoint-hit-count!", 2, 0, 0,
- as_a_scm_t_subr (gdbscm_set_breakpoint_hit_count_x),
- "\
+ as_a_scm_t_subr (gdbscm_set_breakpoint_hit_count_x), "\
Set the breakpoint's \"hit\" count. The value must be zero.\n\
\n\
Arguments: <gdb:breakpoint> 0" },
@@ -1297,45 +1277,38 @@ Set the breakpoint's \"hit\" count. The value must be zero.\n\
Return the breakpoint's global thread id or #f if there isn't one." },
{ "set-breakpoint-thread!", 2, 0, 0,
- as_a_scm_t_subr (gdbscm_set_breakpoint_thread_x),
- "\
+ as_a_scm_t_subr (gdbscm_set_breakpoint_thread_x), "\
Set the global thread id for this breakpoint.\n\
\n\
Arguments: <gdb:breakpoint> global-thread-id" },
- { "breakpoint-task", 1, 0, 0, as_a_scm_t_subr (gdbscm_breakpoint_task),
- "\
+ { "breakpoint-task", 1, 0, 0, as_a_scm_t_subr (gdbscm_breakpoint_task), "\
Return the breakpoint's Ada task-id or #f if there isn't one." },
{ "set-breakpoint-task!", 2, 0, 0,
- as_a_scm_t_subr (gdbscm_set_breakpoint_task_x),
- "\
+ as_a_scm_t_subr (gdbscm_set_breakpoint_task_x), "\
Set the breakpoint's Ada task-id.\n\
\n\
Arguments: <gdb:breakpoint> task-id" },
{ "breakpoint-condition", 1, 0, 0,
- as_a_scm_t_subr (gdbscm_breakpoint_condition),
- "\
+ as_a_scm_t_subr (gdbscm_breakpoint_condition), "\
Return the breakpoint's condition as specified by the user.\n\
Return #f if there isn't one." },
{ "set-breakpoint-condition!", 2, 0, 0,
- as_a_scm_t_subr (gdbscm_set_breakpoint_condition_x),
- "\
+ as_a_scm_t_subr (gdbscm_set_breakpoint_condition_x), "\
Set the breakpoint's condition.\n\
\n\
Arguments: <gdb:breakpoint> condition\n\
condition: a string" },
- { "breakpoint-stop", 1, 0, 0, as_a_scm_t_subr (gdbscm_breakpoint_stop),
- "\
+ { "breakpoint-stop", 1, 0, 0, as_a_scm_t_subr (gdbscm_breakpoint_stop), "\
Return the breakpoint's stop predicate.\n\
Return #f if there isn't one." },
{ "set-breakpoint-stop!", 2, 0, 0,
- as_a_scm_t_subr (gdbscm_set_breakpoint_stop_x),
- "\
+ as_a_scm_t_subr (gdbscm_set_breakpoint_stop_x), "\
Set the breakpoint's stop predicate.\n\
\n\
Arguments: <gdb:breakpoint> procedure\n\
@@ -1343,8 +1316,7 @@ Set the breakpoint's stop predicate.\n\
Its result is true if program execution should stop." },
{ "breakpoint-commands", 1, 0, 0,
- as_a_scm_t_subr (gdbscm_breakpoint_commands),
- "\
+ as_a_scm_t_subr (gdbscm_breakpoint_commands), "\
Return the breakpoint's commands." },
END_FUNCTIONS
diff --git a/gdb/guile/scm-cmd.c b/gdb/guile/scm-cmd.c
index 08a6136afec..8f07715fc95 100644
--- a/gdb/guile/scm-cmd.c
+++ b/gdb/guile/scm-cmd.c
@@ -108,8 +108,7 @@ struct cmdscm_completer
completer_ftype *completer;
};
-static const struct cmdscm_completer cmdscm_completers[] =
-{
+static const struct cmdscm_completer cmdscm_completers[] = {
{ "COMPLETE_NONE", noop_completer },
{ "COMPLETE_FILENAME", filename_completer },
{ "COMPLETE_LOCATION", location_completer },
@@ -118,11 +117,11 @@ static const struct cmdscm_completer cmdscm_completers[] =
{ "COMPLETE_EXPRESSION", expression_completer },
};
-#define N_COMPLETERS (sizeof (cmdscm_completers) \
- / sizeof (cmdscm_completers[0]))
+#define N_COMPLETERS \
+ (sizeof (cmdscm_completers) / sizeof (cmdscm_completers[0]))
static int cmdscm_is_valid (command_smob *);
-
+
/* Administrivia for command smobs. */
/* The smob "print" function for <gdb:command>. */
@@ -137,7 +136,7 @@ cmdscm_print_command_smob (SCM self, SCM port, scm_print_state *pstate)
gdbscm_printf (port, " %s",
c_smob->name != NULL ? c_smob->name : "{unnamed}");
- if (! cmdscm_is_valid (c_smob))
+ if (!cmdscm_is_valid (c_smob))
scm_puts (" {invalid}", port);
scm_puts (">", port);
@@ -155,8 +154,8 @@ cmdscm_print_command_smob (SCM self, SCM port, scm_print_state *pstate)
static SCM
cmdscm_make_command_smob (void)
{
- command_smob *c_smob = (command_smob *)
- scm_gc_malloc (sizeof (command_smob), command_smob_name);
+ command_smob *c_smob = (command_smob *) scm_gc_malloc (sizeof (command_smob),
+ command_smob_name);
SCM c_scm;
memset (c_smob, 0, sizeof (*c_smob));
@@ -241,12 +240,12 @@ cmdscm_get_valid_command_smob_arg_unsafe (SCM self, int arg_pos,
if (!cmdscm_is_valid (c_smob))
{
gdbscm_invalid_object_error (func_name, arg_pos, self,
- _("<gdb:command>"));
+ _ ("<gdb:command>"));
}
return c_smob;
}
-
+
/* Scheme functions for GDB commands. */
/* (command-valid? <gdb:command>) -> boolean
@@ -275,7 +274,7 @@ gdbscm_dont_repeat (SCM self)
return SCM_UNSPECIFIED;
}
-
+
/* The make-command function. */
/* Called if the gdb cmd_list_element is destroyed. */
@@ -293,7 +292,7 @@ cmdscm_destroyer (struct cmd_list_element *self, void *context)
static void
cmdscm_function (const char *args, int from_tty, cmd_list_element *command)
{
- command_smob *c_smob/*obj*/ = (command_smob *) command->context ();
+ command_smob *c_smob /*obj*/ = (command_smob *) command->context ();
SCM arg_scm, tty_scm, result;
gdb_assert (c_smob != NULL);
@@ -302,12 +301,12 @@ cmdscm_function (const char *args, int from_tty, cmd_list_element *command)
args = "";
arg_scm = gdbscm_scm_from_string (args, strlen (args), host_charset (), 1);
if (gdbscm_is_exception (arg_scm))
- error (_("Could not convert arguments to Scheme string."));
+ error (_ ("Could not convert arguments to Scheme string."));
tty_scm = scm_from_bool (from_tty);
- result = gdbscm_safe_call_3 (c_smob->invoke, c_smob->containing_scm,
- arg_scm, tty_scm, gdbscm_user_error_p);
+ result = gdbscm_safe_call_3 (c_smob->invoke, c_smob->containing_scm, arg_scm,
+ tty_scm, gdbscm_user_error_p);
if (gdbscm_is_exception (result))
{
@@ -323,7 +322,7 @@ cmdscm_function (const char *args, int from_tty, cmd_list_element *command)
else
{
gdbscm_print_gdb_exception (SCM_BOOL_F, result);
- error (_("Error occurred in Scheme-implemented GDB command."));
+ error (_ ("Error occurred in Scheme-implemented GDB command."));
}
}
}
@@ -355,14 +354,13 @@ cmdscm_add_completion (SCM completion, completion_tracker &tracker)
if (!scm_is_string (completion))
{
/* Inform the user, but otherwise ignore the entire result. */
- cmdscm_bad_completion_result (_("Bad text from completer: "),
+ cmdscm_bad_completion_result (_ ("Bad text from completer: "),
completion);
return 0;
}
gdb::unique_xmalloc_ptr<char> item
- = gdbscm_scm_to_string (completion, NULL, host_charset (), 1,
- &except_scm);
+ = gdbscm_scm_to_string (completion, NULL, host_charset (), 1, &except_scm);
if (item == NULL)
{
/* Inform the user, but otherwise ignore the entire result. */
@@ -379,28 +377,26 @@ cmdscm_add_completion (SCM completion, completion_tracker &tracker)
static void
cmdscm_completer (struct cmd_list_element *command,
- completion_tracker &tracker,
- const char *text, const char *word)
+ completion_tracker &tracker, const char *text,
+ const char *word)
{
- command_smob *c_smob/*obj*/ = (command_smob *) command->context ();
+ command_smob *c_smob /*obj*/ = (command_smob *) command->context ();
SCM completer_result_scm;
SCM text_scm, word_scm;
gdb_assert (c_smob != NULL);
gdb_assert (gdbscm_is_procedure (c_smob->complete));
- text_scm = gdbscm_scm_from_string (text, strlen (text), host_charset (),
- 1);
+ text_scm = gdbscm_scm_from_string (text, strlen (text), host_charset (), 1);
if (gdbscm_is_exception (text_scm))
- error (_("Could not convert \"text\" argument to Scheme string."));
- word_scm = gdbscm_scm_from_string (word, strlen (word), host_charset (),
- 1);
+ error (_ ("Could not convert \"text\" argument to Scheme string."));
+ word_scm = gdbscm_scm_from_string (word, strlen (word), host_charset (), 1);
if (gdbscm_is_exception (word_scm))
- error (_("Could not convert \"word\" argument to Scheme string."));
+ error (_ ("Could not convert \"word\" argument to Scheme string."));
completer_result_scm
- = gdbscm_safe_call_3 (c_smob->complete, c_smob->containing_scm,
- text_scm, word_scm, NULL);
+ = gdbscm_safe_call_3 (c_smob->complete, c_smob->containing_scm, text_scm,
+ word_scm, NULL);
if (gdbscm_is_exception (completer_result_scm))
{
@@ -446,7 +442,7 @@ cmdscm_completer (struct cmd_list_element *command,
else
{
/* Inform the user, but otherwise ignore. */
- cmdscm_bad_completion_result (_("Bad completer result: "),
+ cmdscm_bad_completion_result (_ ("Bad completer result: "),
completer_result_scm);
}
}
@@ -467,9 +463,8 @@ cmdscm_completer (struct cmd_list_element *command,
On error a Scheme exception is thrown. */
char *
-gdbscm_parse_command_name (const char *name,
- const char *func_name, int arg_pos,
- struct cmd_list_element ***base_list,
+gdbscm_parse_command_name (const char *name, const char *func_name,
+ int arg_pos, struct cmd_list_element ***base_list,
struct cmd_list_element **start_list)
{
struct cmd_list_element *elt;
@@ -484,7 +479,7 @@ gdbscm_parse_command_name (const char *name,
{
gdbscm_out_of_range_error (func_name, arg_pos,
gdbscm_scm_from_c_string (name),
- _("no command name found"));
+ _ ("no command name found"));
}
lastchar = i;
@@ -512,8 +507,9 @@ gdbscm_parse_command_name (const char *name,
elt = lookup_cmd_1 (&prefix_text2, *start_list, NULL, NULL, 1);
if (elt == NULL || elt == CMD_LIST_AMBIGUOUS)
{
- msg = xstrprintf (_("could not find command prefix '%s'"),
- prefix_text.get ()).release ();
+ msg = xstrprintf (_ ("could not find command prefix '%s'"),
+ prefix_text.get ())
+ .release ();
scm_dynwind_begin ((scm_t_dynwind_flags) 0);
gdbscm_dynwind_xfree (msg);
gdbscm_out_of_range_error (func_name, arg_pos,
@@ -526,8 +522,8 @@ gdbscm_parse_command_name (const char *name,
return result.release ();
}
- msg = xstrprintf (_("'%s' is not a prefix command"),
- prefix_text.get ()).release ();
+ msg = xstrprintf (_ ("'%s' is not a prefix command"), prefix_text.get ())
+ .release ();
scm_dynwind_begin ((scm_t_dynwind_flags) 0);
gdbscm_dynwind_xfree (msg);
gdbscm_out_of_range_error (func_name, arg_pos,
@@ -535,8 +531,7 @@ gdbscm_parse_command_name (const char *name,
/* NOTREACHED */
}
-static const scheme_integer_constant command_classes[] =
-{
+static const scheme_integer_constant command_classes[] = {
/* Note: alias and user are special; pseudo appears to be unused,
and there is no reason to expose tui, I think. */
{ "COMMAND_NONE", no_class },
@@ -647,10 +642,9 @@ gdbscm_canonicalize_command_name (const char *name, int want_trailing_space)
static SCM
gdbscm_make_command (SCM name_scm, SCM rest)
{
- const SCM keywords[] = {
- invoke_keyword, command_class_keyword, completer_class_keyword,
- prefix_p_keyword, doc_keyword, SCM_BOOL_F
- };
+ const SCM keywords[]
+ = { invoke_keyword, command_class_keyword, completer_class_keyword,
+ prefix_p_keyword, doc_keyword, SCM_BOOL_F };
int invoke_arg_pos = -1, command_class_arg_pos = 1;
int completer_class_arg_pos = -1, is_prefix_arg_pos = -1;
int doc_arg_pos = -1;
@@ -665,15 +659,14 @@ gdbscm_make_command (SCM name_scm, SCM rest)
command_smob *c_smob;
gdbscm_parse_function_args (FUNC_NAME, SCM_ARG1, keywords, "s#OiOts",
- name_scm, &name, rest,
- &invoke_arg_pos, &invoke,
+ name_scm, &name, rest, &invoke_arg_pos, &invoke,
&command_class_arg_pos, &command_class,
&completer_class_arg_pos, &completer_class,
- &is_prefix_arg_pos, &is_prefix,
- &doc_arg_pos, &doc);
+ &is_prefix_arg_pos, &is_prefix, &doc_arg_pos,
+ &doc);
if (doc == NULL)
- doc = xstrdup (_("This command is not documented."));
+ doc = xstrdup (_ ("This command is not documented."));
s = name;
name = gdbscm_canonicalize_command_name (s, is_prefix);
@@ -682,38 +675,36 @@ gdbscm_make_command (SCM name_scm, SCM rest)
doc = gdbscm_gc_xstrdup (s);
xfree (s);
- if (is_prefix
- ? name[0] == ' '
- : name[0] == '\0')
+ if (is_prefix ? name[0] == ' ' : name[0] == '\0')
{
gdbscm_out_of_range_error (FUNC_NAME, SCM_ARG1, name_scm,
- _("no command name found"));
+ _ ("no command name found"));
}
if (gdbscm_is_true (invoke))
{
- SCM_ASSERT_TYPE (gdbscm_is_procedure (invoke), invoke,
- invoke_arg_pos, FUNC_NAME, _("procedure"));
+ SCM_ASSERT_TYPE (gdbscm_is_procedure (invoke), invoke, invoke_arg_pos,
+ FUNC_NAME, _ ("procedure"));
}
if (!gdbscm_valid_command_class_p (command_class))
{
gdbscm_out_of_range_error (FUNC_NAME, command_class_arg_pos,
scm_from_int (command_class),
- _("invalid command class argument"));
+ _ ("invalid command class argument"));
}
SCM_ASSERT_TYPE (gdbscm_is_false (completer_class)
- || scm_is_integer (completer_class)
- || gdbscm_is_procedure (completer_class),
+ || scm_is_integer (completer_class)
+ || gdbscm_is_procedure (completer_class),
completer_class, completer_class_arg_pos, FUNC_NAME,
- _("integer or procedure"));
+ _ ("integer or procedure"));
if (scm_is_integer (completer_class)
&& !scm_is_signed_integer (completer_class, 0, N_COMPLETERS - 1))
{
gdbscm_out_of_range_error (FUNC_NAME, completer_class_arg_pos,
completer_class,
- _("invalid completion type argument"));
+ _ ("invalid completion type argument"));
}
c_scm = cmdscm_make_command_smob ();
@@ -742,7 +733,7 @@ gdbscm_register_command_x (SCM self)
struct cmd_list_element *cmd = NULL;
if (cmdscm_is_valid (c_smob))
- scm_misc_error (FUNC_NAME, _("command is already registered"), SCM_EOL);
+ scm_misc_error (FUNC_NAME, _ ("command is already registered"), SCM_EOL);
cmd_name = gdbscm_parse_command_name (c_smob->name, FUNC_NAME, SCM_ARG1,
&cmd_list, &cmdlist);
@@ -758,14 +749,14 @@ gdbscm_register_command_x (SCM self)
sub-commands. */
int allow_unknown = gdbscm_is_true (c_smob->invoke);
- cmd = add_prefix_cmd (c_smob->cmd_name, c_smob->cmd_class,
- NULL, c_smob->doc, &c_smob->sub_list,
- allow_unknown, cmd_list);
+ cmd = add_prefix_cmd (c_smob->cmd_name, c_smob->cmd_class, NULL,
+ c_smob->doc, &c_smob->sub_list, allow_unknown,
+ cmd_list);
}
else
{
- cmd = add_cmd (c_smob->cmd_name, c_smob->cmd_class,
- c_smob->doc, cmd_list);
+ cmd = add_cmd (c_smob->cmd_name, c_smob->cmd_class, c_smob->doc,
+ cmd_list);
}
}
catch (const gdb_exception &except)
@@ -786,10 +777,10 @@ gdbscm_register_command_x (SCM self)
if (gdbscm_is_true (c_smob->complete))
{
- set_cmd_completer (cmd,
- scm_is_integer (c_smob->complete)
- ? cmdscm_completers[scm_to_int (c_smob->complete)].completer
- : cmdscm_completer);
+ set_cmd_completer (
+ cmd, scm_is_integer (c_smob->complete)
+ ? cmdscm_completers[scm_to_int (c_smob->complete)].completer
+ : cmdscm_completer);
}
/* The owner of this command is not in GC-controlled memory, so we need
@@ -798,13 +789,11 @@ gdbscm_register_command_x (SCM self)
return SCM_UNSPECIFIED;
}
-
+
/* Initialize the Scheme command support. */
-static const scheme_function command_functions[] =
-{
- { "make-command", 1, 0, 1, as_a_scm_t_subr (gdbscm_make_command),
- "\
+static const scheme_function command_functions[]
+ = { { "make-command", 1, 0, 1, as_a_scm_t_subr (gdbscm_make_command), "\
Make a GDB command object.\n\
\n\
Arguments: name [#:invoke lambda]\n\
@@ -824,27 +813,23 @@ Make a GDB command object.\n\
doc: The \"doc string\" of the command.\n\
Returns: <gdb:command> object" },
- { "register-command!", 1, 0, 0, as_a_scm_t_subr (gdbscm_register_command_x),
- "\
+ { "register-command!", 1, 0, 0,
+ as_a_scm_t_subr (gdbscm_register_command_x), "\
Register a <gdb:command> object with GDB." },
- { "command?", 1, 0, 0, as_a_scm_t_subr (gdbscm_command_p),
- "\
+ { "command?", 1, 0, 0, as_a_scm_t_subr (gdbscm_command_p), "\
Return #t if the object is a <gdb:command> object." },
- { "command-valid?", 1, 0, 0, as_a_scm_t_subr (gdbscm_command_valid_p),
- "\
+ { "command-valid?", 1, 0, 0, as_a_scm_t_subr (gdbscm_command_valid_p), "\
Return #t if the <gdb:command> object is valid." },
- { "dont-repeat", 1, 0, 0, as_a_scm_t_subr (gdbscm_dont_repeat),
- "\
+ { "dont-repeat", 1, 0, 0, as_a_scm_t_subr (gdbscm_dont_repeat), "\
Prevent command repetition when user enters an empty line.\n\
\n\
Arguments: <gdb:command>\n\
Returns: unspecified" },
- END_FUNCTIONS
-};
+ END_FUNCTIONS };
/* Initialize the 'commands' code. */
diff --git a/gdb/guile/scm-disasm.c b/gdb/guile/scm-disasm.c
index 58ccb4f497e..4206a127ba7 100644
--- a/gdb/guile/scm-disasm.c
+++ b/gdb/guile/scm-disasm.c
@@ -40,8 +40,8 @@ static SCM length_symbol;
class gdbscm_disassembler : public gdb_disassembler
{
public:
- gdbscm_disassembler (struct gdbarch *gdbarch,
- struct ui_file *stream,
+
+ gdbscm_disassembler (struct gdbarch *gdbarch, struct ui_file *stream,
SCM port, ULONGEST offset);
SCM port;
@@ -59,19 +59,17 @@ struct gdbscm_disasm_read_data
unsigned int length;
gdbscm_disassembler *dinfo;
};
-
+
/* Subroutine of gdbscm_arch_disassemble to simplify it.
Return the result for one instruction. */
static SCM
dascm_make_insn (CORE_ADDR pc, const char *assembly, int insn_len)
{
- return scm_list_3 (scm_cons (address_symbol,
- gdbscm_scm_from_ulongest (pc)),
+ return scm_list_3 (scm_cons (address_symbol, gdbscm_scm_from_ulongest (pc)),
scm_cons (asm_symbol,
gdbscm_scm_from_c_string (assembly)),
- scm_cons (length_symbol,
- scm_from_int (insn_len)));
+ scm_cons (length_symbol, scm_from_int (insn_len)));
}
/* Helper function for gdbscm_disasm_read_memory to safely read from a
@@ -126,10 +124,11 @@ gdbscm_disasm_read_memory (bfd_vma memaddr, bfd_byte *myaddr,
}
gdbscm_disassembler::gdbscm_disassembler (struct gdbarch *gdbarch,
- struct ui_file *stream,
- SCM port_, ULONGEST offset_)
+ struct ui_file *stream, SCM port_,
+ ULONGEST offset_)
: gdb_disassembler (gdbarch, stream, gdbscm_disasm_read_memory),
- port (port_), offset (offset_)
+ port (port_),
+ offset (offset_)
{
}
@@ -144,8 +143,8 @@ gdbscm_disassembler::gdbscm_disassembler (struct gdbarch *gdbarch,
This is based on gdb_print_insn, see it for details. */
static int
-gdbscm_print_insn_from_port (struct gdbarch *gdbarch,
- SCM port, ULONGEST offset, CORE_ADDR memaddr,
+gdbscm_print_insn_from_port (struct gdbarch *gdbarch, SCM port,
+ ULONGEST offset, CORE_ADDR memaddr,
string_file *stream, int *branch_delay_insns)
{
gdbscm_disassembler di (gdbarch, stream, port, offset);
@@ -176,9 +175,8 @@ gdbscm_arch_disassemble (SCM self, SCM start_scm, SCM rest)
arch_smob *a_smob
= arscm_get_arch_smob_arg_unsafe (self, SCM_ARG1, FUNC_NAME);
struct gdbarch *gdbarch = arscm_get_gdbarch (a_smob);
- const SCM keywords[] = {
- port_keyword, offset_keyword, size_keyword, count_keyword, SCM_BOOL_F
- };
+ const SCM keywords[] = { port_keyword, offset_keyword, size_keyword,
+ count_keyword, SCM_BOOL_F };
int port_arg_pos = -1, offset_arg_pos = -1;
int size_arg_pos = -1, count_arg_pos = -1;
SCM port = SCM_BOOL_F;
@@ -193,11 +191,9 @@ gdbscm_arch_disassemble (SCM self, SCM start_scm, SCM rest)
SCM result;
gdbscm_parse_function_args (FUNC_NAME, SCM_ARG2, keywords, "U#OUuu",
- start_scm, &start_arg, rest,
- &port_arg_pos, &port,
- &offset_arg_pos, &offset,
- &size_arg_pos, &size,
- &count_arg_pos, &count);
+ start_scm, &start_arg, rest, &port_arg_pos,
+ &port, &offset_arg_pos, &offset, &size_arg_pos,
+ &size, &count_arg_pos, &count);
/* START is first stored in a ULONGEST because we don't have a format char
for CORE_ADDR, and it's not really worth it to have one yet. */
start = start_arg;
@@ -205,18 +201,16 @@ gdbscm_arch_disassemble (SCM self, SCM start_scm, SCM rest)
if (port_arg_pos > 0)
{
SCM_ASSERT_TYPE (gdbscm_is_false (port)
- || gdbscm_is_true (scm_input_port_p (port)),
- port, port_arg_pos, FUNC_NAME, _("input port"));
+ || gdbscm_is_true (scm_input_port_p (port)),
+ port, port_arg_pos, FUNC_NAME, _ ("input port"));
}
using_port = gdbscm_is_true (port);
- if (offset_arg_pos > 0
- && (port_arg_pos < 0
- || gdbscm_is_false (port)))
+ if (offset_arg_pos > 0 && (port_arg_pos < 0 || gdbscm_is_false (port)))
{
gdbscm_out_of_range_error (FUNC_NAME, offset_arg_pos,
gdbscm_scm_from_ulongest (offset),
- _("offset provided but port is missing"));
+ _ ("offset provided but port is missing"));
}
if (size_arg_pos > 0)
@@ -227,10 +221,11 @@ gdbscm_arch_disassemble (SCM self, SCM start_scm, SCM rest)
a nuisance we can relax things later. */
if (start + size < start)
{
- gdbscm_out_of_range_error (FUNC_NAME, 0,
- scm_list_2 (gdbscm_scm_from_ulongest (start),
- gdbscm_scm_from_ulongest (size)),
- _("start+size overflows"));
+ gdbscm_out_of_range_error (
+ FUNC_NAME, 0,
+ scm_list_2 (gdbscm_scm_from_ulongest (start),
+ gdbscm_scm_from_ulongest (size)),
+ _ ("start+size overflows"));
}
end = start + size - 1;
}
@@ -242,7 +237,7 @@ gdbscm_arch_disassemble (SCM self, SCM start_scm, SCM rest)
result = SCM_EOL;
- for (pc = start, i = 0; pc <= end && i < count; )
+ for (pc = start, i = 0; pc <= end && i < count;)
{
int insn_len = 0;
string_file buf;
@@ -264,8 +259,7 @@ gdbscm_arch_disassemble (SCM self, SCM start_scm, SCM rest)
}
GDBSCM_HANDLE_GDB_EXCEPTION (exc);
- result = scm_cons (dascm_make_insn (pc, buf.c_str (), insn_len),
- result);
+ result = scm_cons (dascm_make_insn (pc, buf.c_str (), insn_len), result);
pc += insn_len;
i++;
@@ -273,13 +267,12 @@ gdbscm_arch_disassemble (SCM self, SCM start_scm, SCM rest)
return scm_reverse_x (result, SCM_EOL);
}
-
+
/* Initialize the Scheme architecture support. */
-static const scheme_function disasm_functions[] =
-{
- { "arch-disassemble", 2, 0, 1, as_a_scm_t_subr (gdbscm_arch_disassemble),
- "\
+static const scheme_function disasm_functions[]
+ = { { "arch-disassemble", 2, 0, 1, as_a_scm_t_subr (gdbscm_arch_disassemble),
+ "\
Return list of disassembled instructions in memory.\n\
\n\
Arguments: <gdb:arch> start-address\n\
@@ -299,8 +292,7 @@ Return list of disassembled instructions in memory.\n\
Each instruction in the result is an alist:\n\
(('address . address) ('asm . disassembly) ('length . length))." },
- END_FUNCTIONS
-};
+ END_FUNCTIONS };
void
gdbscm_initialize_disasm (void)
diff --git a/gdb/guile/scm-exception.c b/gdb/guile/scm-exception.c
index 529d2b3f1a8..18d334ab2da 100644
--- a/gdb/guile/scm-exception.c
+++ b/gdb/guile/scm-exception.c
@@ -81,16 +81,16 @@ static SCM none_symbol;
static SCM message_symbol;
static SCM full_symbol;
-static const char percent_print_exception_message_name[] =
- "%print-exception-message";
+static const char percent_print_exception_message_name[]
+ = "%print-exception-message";
/* Variable containing %print-exception-message.
It is not defined until late in initialization, after our init routine
has run. Cope by looking it up lazily. */
static SCM percent_print_exception_message_var = SCM_BOOL_F;
-static const char percent_print_exception_with_stack_name[] =
- "%print-exception-with-stack";
+static const char percent_print_exception_with_stack_name[]
+ = "%print-exception-with-stack";
/* Variable containing %print-exception-with-stack.
It is not defined until late in initialization, after our init routine
@@ -100,7 +100,7 @@ static SCM percent_print_exception_with_stack_var = SCM_BOOL_F;
/* Counter to keep track of the number of times we create a <gdb:exception>
object, for performance monitoring purposes. */
static unsigned long gdbscm_exception_count = 0;
-
+
/* Administrivia for exception smobs. */
/* The smob "print" function for <gdb:exception>. */
@@ -127,8 +127,9 @@ exscm_print_exception_smob (SCM self, SCM port, scm_print_state *pstate)
SCM
gdbscm_make_exception (SCM key, SCM args)
{
- exception_smob *e_smob = (exception_smob *)
- scm_gc_malloc (sizeof (exception_smob), exception_smob_name);
+ exception_smob *e_smob
+ = (exception_smob *) scm_gc_malloc (sizeof (exception_smob),
+ exception_smob_name);
SCM smob;
e_smob->key = key;
@@ -184,7 +185,7 @@ gdbscm_exception_args (SCM self)
e_smob = (exception_smob *) SCM_SMOB_DATA (self);
return e_smob->args;
}
-
+
/* Wrap an exception in a <gdb:exception> object that includes STACK.
gdbscm_print_exception_with_stack knows how to unwrap it. */
@@ -217,14 +218,13 @@ gdbscm_make_error_scm (SCM key, SCM subr, SCM message, SCM args, SCM data)
See gdbscm_make_error_scm for a description of the arguments. */
SCM
-gdbscm_make_error (SCM key, const char *subr, const char *message,
- SCM args, SCM data)
-{
- return gdbscm_make_error_scm
- (key,
- subr == NULL ? SCM_BOOL_F : scm_from_latin1_string (subr),
- message == NULL ? SCM_BOOL_F : scm_from_latin1_string (message),
- args, data);
+gdbscm_make_error (SCM key, const char *subr, const char *message, SCM args,
+ SCM data)
+{
+ return gdbscm_make_error_scm (
+ key, subr == NULL ? SCM_BOOL_F : scm_from_latin1_string (subr),
+ message == NULL ? SCM_BOOL_F : scm_from_latin1_string (message), args,
+ data);
}
/* Version of SCM_ASSERT_TYPE/scm_wrong_type_arg_msg that creates a
@@ -241,13 +241,13 @@ gdbscm_make_type_error (const char *subr, int arg_pos, SCM bad_value,
{
if (expected_type != NULL)
{
- msg = xstrprintf (_("Wrong type argument in position %d"
- " (expecting %s): ~S"),
+ msg = xstrprintf (_ ("Wrong type argument in position %d"
+ " (expecting %s): ~S"),
arg_pos, expected_type);
}
else
{
- msg = xstrprintf (_("Wrong type argument in position %d: ~S"),
+ msg = xstrprintf (_ ("Wrong type argument in position %d: ~S"),
arg_pos);
}
}
@@ -255,11 +255,11 @@ gdbscm_make_type_error (const char *subr, int arg_pos, SCM bad_value,
{
if (expected_type != NULL)
{
- msg = xstrprintf (_("Wrong type argument (expecting %s): ~S"),
+ msg = xstrprintf (_ ("Wrong type argument (expecting %s): ~S"),
expected_type);
}
else
- msg = xstrprintf (_("Wrong type argument: ~S"));
+ msg = xstrprintf (_ ("Wrong type argument: ~S"));
}
result = gdbscm_make_error (scm_arg_type_key, subr, msg.get (),
@@ -285,18 +285,18 @@ gdbscm_make_arg_error (SCM key, const char *subr, int arg_pos, SCM bad_value,
{
if (arg_pos > 0)
{
- msg = xstrprintf (_("%s %s in position %d: ~S"),
- error_prefix, error, arg_pos);
+ msg = xstrprintf (_ ("%s %s in position %d: ~S"), error_prefix,
+ error, arg_pos);
}
else
- msg = xstrprintf (_("%s %s: ~S"), error_prefix, error);
+ msg = xstrprintf (_ ("%s %s: ~S"), error_prefix, error);
}
else
{
if (arg_pos > 0)
- msg = xstrprintf (_("%s in position %d: ~S"), error, arg_pos);
+ msg = xstrprintf (_ ("%s in position %d: ~S"), error, arg_pos);
else
- msg = xstrprintf (_("%s: ~S"), error);
+ msg = xstrprintf (_ ("%s: ~S"), error);
}
result = gdbscm_make_error (key, subr, msg.get (), scm_list_1 (bad_value),
@@ -311,9 +311,9 @@ SCM
gdbscm_make_invalid_object_error (const char *subr, int arg_pos, SCM bad_value,
const char *object)
{
- return gdbscm_make_arg_error (gdbscm_invalid_object_error_symbol,
- subr, arg_pos, bad_value,
- _("Invalid object:"), object);
+ return gdbscm_make_arg_error (gdbscm_invalid_object_error_symbol, subr,
+ arg_pos, bad_value, _ ("Invalid object:"),
+ object);
}
/* Throw an invalid-object error.
@@ -335,9 +335,8 @@ SCM
gdbscm_make_out_of_range_error (const char *subr, int arg_pos, SCM bad_value,
const char *error)
{
- return gdbscm_make_arg_error (scm_out_of_range_key,
- subr, arg_pos, bad_value,
- _("Out of range:"), error);
+ return gdbscm_make_arg_error (scm_out_of_range_key, subr, arg_pos, bad_value,
+ _ ("Out of range:"), error);
}
/* Throw an out-of-range error.
@@ -359,8 +358,8 @@ SCM
gdbscm_make_misc_error (const char *subr, int arg_pos, SCM bad_value,
const char *error)
{
- return gdbscm_make_arg_error (scm_misc_error_key,
- subr, arg_pos, bad_value, NULL, error);
+ return gdbscm_make_arg_error (scm_misc_error_key, subr, arg_pos, bad_value,
+ NULL, error);
}
/* Throw a misc-error error. */
@@ -379,8 +378,7 @@ gdbscm_misc_error (const char *subr, int arg_pos, SCM bad_value,
SCM
gdbscm_make_memory_error (const char *subr, const char *msg, SCM args)
{
- return gdbscm_make_error (memory_error_symbol, subr, msg, args,
- SCM_EOL);
+ return gdbscm_make_error (memory_error_symbol, subr, msg, args, SCM_EOL);
}
/* Throw a gdb:memory-error exception. */
@@ -433,7 +431,7 @@ gdbscm_scm_from_gdb_exception (const gdbscm_gdb_exception &exception)
if (exception.reason == RETURN_QUIT)
{
/* Handle this specially to be consistent with top-repl.scm. */
- return gdbscm_make_error (signal_symbol, NULL, _("User interrupt"),
+ return gdbscm_make_error (signal_symbol, NULL, _ ("User interrupt"),
SCM_EOL, scm_list_1 (scm_from_int (SIGINT)));
}
@@ -442,10 +440,9 @@ gdbscm_scm_from_gdb_exception (const gdbscm_gdb_exception &exception)
else
key = error_symbol;
- return gdbscm_make_error (key, NULL, "~A",
- scm_list_1 (gdbscm_scm_from_c_string
- (exception.message)),
- SCM_BOOL_F);
+ return gdbscm_make_error (
+ key, NULL, "~A", scm_list_1 (gdbscm_scm_from_c_string (exception.message)),
+ SCM_BOOL_F);
}
/* Convert a GDB exception to the appropriate Scheme exception and throw it.
@@ -489,8 +486,9 @@ gdbscm_print_exception_message (SCM port, SCM frame, SCM key, SCM args)
that. */
if (gdbscm_is_false (percent_print_exception_message_var))
{
- gdbscm_printf (port, _("Error in Scheme exception printing,"
- " can't find %s.\n"),
+ gdbscm_printf (port,
+ _ ("Error in Scheme exception printing,"
+ " can't find %s.\n"),
percent_print_exception_message_name);
return;
}
@@ -503,7 +501,7 @@ gdbscm_print_exception_message (SCM port, SCM frame, SCM key, SCM args)
But don't use the exception printing machinery! */
if (gdbscm_is_exception (status))
{
- gdbscm_printf (port, _("Error in Scheme exception printing:\n"));
+ gdbscm_printf (port, _ ("Error in Scheme exception printing:\n"));
scm_display (status, port);
scm_newline (port);
}
@@ -540,8 +538,9 @@ gdbscm_print_exception_with_stack (SCM port, SCM stack, SCM key, SCM args)
that. */
if (gdbscm_is_false (percent_print_exception_with_stack_var))
{
- gdbscm_printf (port, _("Error in Scheme exception printing,"
- " can't find %s.\n"),
+ gdbscm_printf (port,
+ _ ("Error in Scheme exception printing,"
+ " can't find %s.\n"),
percent_print_exception_with_stack_name);
return;
}
@@ -554,7 +553,7 @@ gdbscm_print_exception_with_stack (SCM port, SCM stack, SCM key, SCM args)
But don't use the exception printing machinery! */
if (gdbscm_is_exception (status))
{
- gdbscm_printf (port, _("Error in Scheme exception printing:\n"));
+ gdbscm_printf (port, _ ("Error in Scheme exception printing:\n"));
scm_display (status, port);
scm_newline (port);
}
@@ -590,8 +589,7 @@ gdbscm_exception_message_to_string (SCM exception)
if (scm_is_eq (key, with_stack_error_symbol)
/* Don't crash on a badly generated gdb:with-stack exception. */
- && scm_is_pair (args)
- && scm_is_pair (scm_cdr (args)))
+ && scm_is_pair (args) && scm_is_pair (scm_cdr (args)))
{
key = scm_car (args);
args = scm_cddr (args);
@@ -627,54 +625,44 @@ gdbscm_percent_exception_count (void)
{
return scm_from_ulong (gdbscm_exception_count);
}
-
+
/* Initialize the Scheme exception support. */
-static const scheme_function exception_functions[] =
-{
- { "make-exception", 2, 0, 0, as_a_scm_t_subr (gdbscm_make_exception),
- "\
+static const scheme_function exception_functions[]
+ = { { "make-exception", 2, 0, 0, as_a_scm_t_subr (gdbscm_make_exception), "\
Create a <gdb:exception> object.\n\
\n\
Arguments: key args\n\
These are the standard key,args arguments of \"throw\"." },
- { "exception?", 1, 0, 0, as_a_scm_t_subr (gdbscm_exception_p),
- "\
+ { "exception?", 1, 0, 0, as_a_scm_t_subr (gdbscm_exception_p), "\
Return #t if the object is a <gdb:exception> object." },
- { "exception-key", 1, 0, 0, as_a_scm_t_subr (gdbscm_exception_key),
- "\
+ { "exception-key", 1, 0, 0, as_a_scm_t_subr (gdbscm_exception_key), "\
Return the exception's key." },
- { "exception-args", 1, 0, 0, as_a_scm_t_subr (gdbscm_exception_args),
- "\
+ { "exception-args", 1, 0, 0, as_a_scm_t_subr (gdbscm_exception_args), "\
Return the exception's arg list." },
- END_FUNCTIONS
-};
+ END_FUNCTIONS };
-static const scheme_function private_exception_functions[] =
-{
- { "%exception-print-style", 0, 0, 0,
- as_a_scm_t_subr (gdbscm_percent_exception_print_style),
- "\
+static const scheme_function private_exception_functions[]
+ = { { "%exception-print-style", 0, 0, 0,
+ as_a_scm_t_subr (gdbscm_percent_exception_print_style), "\
Return the value of the \"guile print-stack\" option." },
- { "%exception-count", 0, 0, 0,
- as_a_scm_t_subr (gdbscm_percent_exception_count),
- "\
+ { "%exception-count", 0, 0, 0,
+ as_a_scm_t_subr (gdbscm_percent_exception_count), "\
Return a count of the number of <gdb:exception> objects created.\n\
This is for debugging purposes." },
- END_FUNCTIONS
-};
+ END_FUNCTIONS };
void
gdbscm_initialize_exceptions (void)
{
- exception_smob_tag = gdbscm_make_smob_type (exception_smob_name,
- sizeof (exception_smob));
+ exception_smob_tag
+ = gdbscm_make_smob_type (exception_smob_name, sizeof (exception_smob));
scm_set_smob_print (exception_smob_tag, exscm_print_exception_smob);
gdbscm_define_functions (exception_functions, 1);
diff --git a/gdb/guile/scm-frame.c b/gdb/guile/scm-frame.c
index 45863c587c1..055558fea82 100644
--- a/gdb/guile/scm-frame.c
+++ b/gdb/guile/scm-frame.c
@@ -84,8 +84,7 @@ struct frscm_deleter
/* Helper function for frscm_del_inferior_frames to mark the frame
as invalid. */
- static int
- frscm_mark_frame_invalid (void **slot, void *info)
+ static int frscm_mark_frame_invalid (void **slot, void *info)
{
frame_smob *f_smob = (frame_smob *) *slot;
@@ -102,8 +101,8 @@ struct frscm_deleter
};
static const registry<inferior>::key<htab, frscm_deleter>
- frscm_inferior_data_key;
-
+ frscm_inferior_data_key;
+
/* Administrivia for frame smobs. */
/* Helper function to hash a frame_smob. */
@@ -120,8 +119,8 @@ frscm_hash_frame_smob (const void *p)
if (fid->code_addr_p)
hash = iterative_hash (&fid->code_addr, sizeof (fid->code_addr), hash);
if (fid->special_addr_p)
- hash = iterative_hash (&fid->special_addr, sizeof (fid->special_addr),
- hash);
+ hash
+ = iterative_hash (&fid->special_addr, sizeof (fid->special_addr), hash);
return hash;
}
@@ -134,8 +133,7 @@ frscm_eq_frame_smob (const void *ap, const void *bp)
const frame_smob *a = (const frame_smob *) ap;
const frame_smob *b = (const frame_smob *) bp;
- return (a->frame_id == b->frame_id
- && a->inferior == b->inferior
+ return (a->frame_id == b->frame_id && a->inferior == b->inferior
&& a->inferior != NULL);
}
@@ -184,8 +182,7 @@ frscm_print_frame_smob (SCM self, SCM port, scm_print_state *pstate)
{
frame_smob *f_smob = (frame_smob *) SCM_SMOB_DATA (self);
- gdbscm_printf (port, "#<%s %s>",
- frame_smob_name,
+ gdbscm_printf (port, "#<%s %s>", frame_smob_name,
f_smob->frame_id.to_string ().c_str ());
scm_remember_upto_here_1 (self);
@@ -198,8 +195,8 @@ frscm_print_frame_smob (SCM self, SCM port, scm_print_state *pstate)
static SCM
frscm_make_frame_smob (void)
{
- frame_smob *f_smob = (frame_smob *)
- scm_gc_malloc (sizeof (frame_smob), frame_smob_name);
+ frame_smob *f_smob
+ = (frame_smob *) scm_gc_malloc (sizeof (frame_smob), frame_smob_name);
SCM f_scm;
f_smob->frame_id = null_frame_id;
@@ -346,11 +343,10 @@ frscm_get_frame_smob_arg_unsafe (SCM self, int arg_pos, const char *func_name)
if (f_smob->inferior == NULL)
{
- gdbscm_invalid_object_error (func_name, arg_pos, self,
- _("inferior"));
+ gdbscm_invalid_object_error (func_name, arg_pos, self, _ ("inferior"));
}
if (f_smob->inferior != current_inferior ())
- scm_misc_error (func_name, _("inferior has changed"), SCM_EOL);
+ scm_misc_error (func_name, _ ("inferior has changed"), SCM_EOL);
return f_smob;
}
@@ -374,7 +370,6 @@ frscm_frame_smob_to_frame (frame_smob *f_smob)
return frame;
}
-
/* Frame methods. */
/* (frame-valid? <gdb:frame>) -> bool
@@ -438,7 +433,7 @@ gdbscm_frame_name (SCM self)
if (!found)
{
gdbscm_invalid_object_error (FUNC_NAME, SCM_ARG1, self,
- _("<gdb:frame>"));
+ _ ("<gdb:frame>"));
}
if (name != NULL)
@@ -480,7 +475,7 @@ gdbscm_frame_type (SCM self)
if (!found)
{
gdbscm_invalid_object_error (FUNC_NAME, SCM_ARG1, self,
- _("<gdb:frame>"));
+ _ ("<gdb:frame>"));
}
return scm_from_int (type);
@@ -512,7 +507,7 @@ gdbscm_frame_arch (SCM self)
if (!found)
{
gdbscm_invalid_object_error (FUNC_NAME, SCM_ARG1, self,
- _("<gdb:frame>"));
+ _ ("<gdb:frame>"));
}
return arscm_scm_from_arch (f_smob->gdbarch);
@@ -549,7 +544,7 @@ gdbscm_frame_unwind_stop_reason (SCM self)
if (!found)
{
gdbscm_invalid_object_error (FUNC_NAME, SCM_ARG1, self,
- _("<gdb:frame>"));
+ _ ("<gdb:frame>"));
}
return scm_from_int (stop_reason);
@@ -586,7 +581,7 @@ gdbscm_frame_pc (SCM self)
if (!found)
{
gdbscm_invalid_object_error (FUNC_NAME, SCM_ARG1, self,
- _("<gdb:frame>"));
+ _ ("<gdb:frame>"));
}
return gdbscm_scm_from_ulongest (pc);
@@ -623,24 +618,22 @@ gdbscm_frame_block (SCM self)
if (!found)
{
gdbscm_invalid_object_error (FUNC_NAME, SCM_ARG1, self,
- _("<gdb:frame>"));
+ _ ("<gdb:frame>"));
}
- for (fn_block = block;
- fn_block != NULL && fn_block->function () == NULL;
+ for (fn_block = block; fn_block != NULL && fn_block->function () == NULL;
fn_block = fn_block->superblock ())
continue;
if (block == NULL || fn_block == NULL || fn_block->function () == NULL)
{
- scm_misc_error (FUNC_NAME, _("cannot find block for frame"),
+ scm_misc_error (FUNC_NAME, _ ("cannot find block for frame"),
scm_list_1 (self));
}
if (block != NULL)
{
- return bkscm_scm_from_block
- (block, fn_block->function ()->objfile ());
+ return bkscm_scm_from_block (block, fn_block->function ()->objfile ());
}
return SCM_BOOL_F;
@@ -678,7 +671,7 @@ gdbscm_frame_function (SCM self)
if (!found)
{
gdbscm_invalid_object_error (FUNC_NAME, SCM_ARG1, self,
- _("<gdb:frame>"));
+ _ ("<gdb:frame>"));
}
if (sym != NULL)
@@ -719,7 +712,7 @@ gdbscm_frame_older (SCM self)
if (!found)
{
gdbscm_invalid_object_error (FUNC_NAME, SCM_ARG1, self,
- _("<gdb:frame>"));
+ _ ("<gdb:frame>"));
}
if (prev != NULL)
@@ -760,7 +753,7 @@ gdbscm_frame_newer (SCM self)
if (!found)
{
gdbscm_invalid_object_error (FUNC_NAME, SCM_ARG1, self,
- _("<gdb:frame>"));
+ _ ("<gdb:frame>"));
}
if (next != NULL)
@@ -800,7 +793,7 @@ gdbscm_frame_sal (SCM self)
if (!found)
{
gdbscm_invalid_object_error (FUNC_NAME, SCM_ARG1, self,
- _("<gdb:frame>"));
+ _ ("<gdb:frame>"));
}
return stscm_scm_from_sal (sal);
@@ -818,8 +811,8 @@ gdbscm_frame_read_register (SCM self, SCM register_scm)
frame_smob *f_smob;
f_smob = frscm_get_frame_smob_arg_unsafe (self, SCM_ARG1, FUNC_NAME);
- gdbscm_parse_function_args (FUNC_NAME, SCM_ARG2, NULL, "s",
- register_scm, &register_str);
+ gdbscm_parse_function_args (FUNC_NAME, SCM_ARG2, NULL, "s", register_scm,
+ &register_str);
gdbscm_gdb_exception except {};
@@ -849,13 +842,13 @@ gdbscm_frame_read_register (SCM self, SCM register_scm)
if (!found)
{
gdbscm_invalid_object_error (FUNC_NAME, SCM_ARG1, self,
- _("<gdb:frame>"));
+ _ ("<gdb:frame>"));
}
if (value == NULL)
{
gdbscm_out_of_range_error (FUNC_NAME, SCM_ARG2, register_scm,
- _("unknown register"));
+ _ ("unknown register"));
}
return vlscm_scm_from_value (value);
@@ -897,23 +890,23 @@ gdbscm_frame_read_var (SCM self, SCM symbol_scm, SCM rest)
if (frame == NULL)
{
gdbscm_invalid_object_error (FUNC_NAME, SCM_ARG1, self,
- _("<gdb:frame>"));
+ _ ("<gdb:frame>"));
}
- gdbscm_parse_function_args (FUNC_NAME, SCM_ARG3, keywords, "#O",
- rest, &block_arg_pos, &block_scm);
+ gdbscm_parse_function_args (FUNC_NAME, SCM_ARG3, keywords, "#O", rest,
+ &block_arg_pos, &block_scm);
if (syscm_is_symbol (symbol_scm))
{
- var = syscm_get_valid_symbol_arg_unsafe (symbol_scm, SCM_ARG2,
- FUNC_NAME);
+ var
+ = syscm_get_valid_symbol_arg_unsafe (symbol_scm, SCM_ARG2, FUNC_NAME);
SCM_ASSERT (SCM_UNBNDP (block_scm), block_scm, SCM_ARG3, FUNC_NAME);
}
else if (scm_is_string (symbol_scm))
{
gdbscm_gdb_exception except {};
- if (! SCM_UNBNDP (block_scm))
+ if (!SCM_UNBNDP (block_scm))
{
SCM except_scm;
@@ -925,8 +918,8 @@ gdbscm_frame_read_var (SCM self, SCM symbol_scm, SCM rest)
}
{
- gdb::unique_xmalloc_ptr<char> var_name
- (gdbscm_scm_to_c_string (symbol_scm));
+ gdb::unique_xmalloc_ptr<char> var_name (
+ gdbscm_scm_to_c_string (symbol_scm));
/* N.B. Between here and the end of the scope, don't do anything
to cause a Scheme exception. */
@@ -936,8 +929,8 @@ gdbscm_frame_read_var (SCM self, SCM symbol_scm, SCM rest)
if (block == NULL)
block = get_frame_block (frame_info_ptr (frame), NULL);
- lookup_sym = lookup_symbol (var_name.get (), block, VAR_DOMAIN,
- NULL);
+ lookup_sym
+ = lookup_symbol (var_name.get (), block, VAR_DOMAIN, NULL);
var = lookup_sym.symbol;
block = lookup_sym.block;
}
@@ -951,13 +944,13 @@ gdbscm_frame_read_var (SCM self, SCM symbol_scm, SCM rest)
if (var == NULL)
gdbscm_out_of_range_error (FUNC_NAME, 0, symbol_scm,
- _("variable not found"));
+ _ ("variable not found"));
}
else
{
/* Use SCM_ASSERT_TYPE for more consistent error messages. */
SCM_ASSERT_TYPE (0, symbol_scm, SCM_ARG1, FUNC_NAME,
- _("gdb:symbol or string"));
+ _ ("gdb:symbol or string"));
}
try
@@ -1003,7 +996,7 @@ gdbscm_frame_select (SCM self)
if (!found)
{
gdbscm_invalid_object_error (FUNC_NAME, SCM_ARG1, self,
- _("<gdb:frame>"));
+ _ ("<gdb:frame>"));
}
return SCM_UNSPECIFIED;
@@ -1042,7 +1035,7 @@ gdbscm_selected_frame (void)
gdbscm_gdb_exception exc {};
try
{
- frame = get_selected_frame (_("No frame is currently selected")).get ();
+ frame = get_selected_frame (_ ("No frame is currently selected")).get ();
}
catch (const gdb_exception &except)
{
@@ -1062,8 +1055,8 @@ gdbscm_unwind_stop_reason_string (SCM reason_scm)
int reason;
const char *str;
- gdbscm_parse_function_args (FUNC_NAME, SCM_ARG1, NULL, "i",
- reason_scm, &reason);
+ gdbscm_parse_function_args (FUNC_NAME, SCM_ARG1, NULL, "i", reason_scm,
+ &reason);
if (reason < UNWIND_FIRST || reason > UNWIND_LAST)
scm_out_of_range (FUNC_NAME, reason_scm);
@@ -1071,123 +1064,100 @@ gdbscm_unwind_stop_reason_string (SCM reason_scm)
str = unwind_stop_reason_to_string ((enum unwind_stop_reason) reason);
return gdbscm_scm_from_c_string (str);
}
-
+
/* Initialize the Scheme frame support. */
-static const scheme_integer_constant frame_integer_constants[] =
-{
-#define ENTRY(X) { #X, X }
-
- ENTRY (NORMAL_FRAME),
- ENTRY (DUMMY_FRAME),
- ENTRY (INLINE_FRAME),
- ENTRY (TAILCALL_FRAME),
- ENTRY (SIGTRAMP_FRAME),
- ENTRY (ARCH_FRAME),
+static const scheme_integer_constant frame_integer_constants[] = {
+#define ENTRY(X) \
+ { \
+#X, X \
+ }
+
+ ENTRY (NORMAL_FRAME), ENTRY (DUMMY_FRAME), ENTRY (INLINE_FRAME),
+ ENTRY (TAILCALL_FRAME), ENTRY (SIGTRAMP_FRAME), ENTRY (ARCH_FRAME),
ENTRY (SENTINEL_FRAME),
#undef ENTRY
-#define SET(name, description) \
- { "FRAME_" #name, name },
+#define SET(name, description) { "FRAME_" #name, name },
#include "unwind_stop_reasons.def"
#undef SET
END_INTEGER_CONSTANTS
};
-static const scheme_function frame_functions[] =
-{
- { "frame?", 1, 0, 0, as_a_scm_t_subr (gdbscm_frame_p),
- "\
+static const scheme_function frame_functions[]
+ = { { "frame?", 1, 0, 0, as_a_scm_t_subr (gdbscm_frame_p), "\
Return #t if the object is a <gdb:frame> object." },
- { "frame-valid?", 1, 0, 0, as_a_scm_t_subr (gdbscm_frame_valid_p),
- "\
+ { "frame-valid?", 1, 0, 0, as_a_scm_t_subr (gdbscm_frame_valid_p), "\
Return #t if the object is a valid <gdb:frame> object.\n\
Frames become invalid when the inferior returns to its caller." },
- { "frame-name", 1, 0, 0, as_a_scm_t_subr (gdbscm_frame_name),
- "\
+ { "frame-name", 1, 0, 0, as_a_scm_t_subr (gdbscm_frame_name), "\
Return the name of the function corresponding to this frame,\n\
or #f if there is no function." },
- { "frame-arch", 1, 0, 0, as_a_scm_t_subr (gdbscm_frame_arch),
- "\
+ { "frame-arch", 1, 0, 0, as_a_scm_t_subr (gdbscm_frame_arch), "\
Return the frame's architecture as a <gdb:arch> object." },
- { "frame-type", 1, 0, 0, as_a_scm_t_subr (gdbscm_frame_type),
- "\
+ { "frame-type", 1, 0, 0, as_a_scm_t_subr (gdbscm_frame_type), "\
Return the frame type, namely one of the gdb:*_FRAME constants." },
- { "frame-unwind-stop-reason", 1, 0, 0,
- as_a_scm_t_subr (gdbscm_frame_unwind_stop_reason),
- "\
+ { "frame-unwind-stop-reason", 1, 0, 0,
+ as_a_scm_t_subr (gdbscm_frame_unwind_stop_reason), "\
Return one of the gdb:FRAME_UNWIND_* constants explaining why\n\
it's not possible to find frames older than this." },
- { "frame-pc", 1, 0, 0, as_a_scm_t_subr (gdbscm_frame_pc),
- "\
+ { "frame-pc", 1, 0, 0, as_a_scm_t_subr (gdbscm_frame_pc), "\
Return the frame's resume address." },
- { "frame-block", 1, 0, 0, as_a_scm_t_subr (gdbscm_frame_block),
- "\
+ { "frame-block", 1, 0, 0, as_a_scm_t_subr (gdbscm_frame_block), "\
Return the frame's code block, or #f if one cannot be found." },
- { "frame-function", 1, 0, 0, as_a_scm_t_subr (gdbscm_frame_function),
- "\
+ { "frame-function", 1, 0, 0, as_a_scm_t_subr (gdbscm_frame_function), "\
Return the <gdb:symbol> for the function corresponding to this frame,\n\
or #f if there isn't one." },
- { "frame-older", 1, 0, 0, as_a_scm_t_subr (gdbscm_frame_older),
- "\
+ { "frame-older", 1, 0, 0, as_a_scm_t_subr (gdbscm_frame_older), "\
Return the frame immediately older (outer) to this frame,\n\
or #f if there isn't one." },
- { "frame-newer", 1, 0, 0, as_a_scm_t_subr (gdbscm_frame_newer),
- "\
+ { "frame-newer", 1, 0, 0, as_a_scm_t_subr (gdbscm_frame_newer), "\
Return the frame immediately newer (inner) to this frame,\n\
or #f if there isn't one." },
- { "frame-sal", 1, 0, 0, as_a_scm_t_subr (gdbscm_frame_sal),
- "\
+ { "frame-sal", 1, 0, 0, as_a_scm_t_subr (gdbscm_frame_sal), "\
Return the frame's symtab-and-line <gdb:sal> object." },
- { "frame-read-var", 2, 0, 1, as_a_scm_t_subr (gdbscm_frame_read_var),
- "\
+ { "frame-read-var", 2, 0, 1, as_a_scm_t_subr (gdbscm_frame_read_var), "\
Return the value of the symbol in the frame.\n\
\n\
Arguments: <gdb:frame> <gdb:symbol>\n\
Or: <gdb:frame> string [#:block <gdb:block>]" },
- { "frame-read-register", 2, 0, 0,
- as_a_scm_t_subr (gdbscm_frame_read_register),
- "\
+ { "frame-read-register", 2, 0, 0,
+ as_a_scm_t_subr (gdbscm_frame_read_register), "\
Return the value of the register in the frame.\n\
\n\
Arguments: <gdb:frame> string" },
- { "frame-select", 1, 0, 0, as_a_scm_t_subr (gdbscm_frame_select),
- "\
+ { "frame-select", 1, 0, 0, as_a_scm_t_subr (gdbscm_frame_select), "\
Select this frame." },
- { "newest-frame", 0, 0, 0, as_a_scm_t_subr (gdbscm_newest_frame),
- "\
+ { "newest-frame", 0, 0, 0, as_a_scm_t_subr (gdbscm_newest_frame), "\
Return the newest frame." },
- { "selected-frame", 0, 0, 0, as_a_scm_t_subr (gdbscm_selected_frame),
- "\
+ { "selected-frame", 0, 0, 0, as_a_scm_t_subr (gdbscm_selected_frame), "\
Return the selected frame." },
- { "unwind-stop-reason-string", 1, 0, 0,
- as_a_scm_t_subr (gdbscm_unwind_stop_reason_string),
- "\
+ { "unwind-stop-reason-string", 1, 0, 0,
+ as_a_scm_t_subr (gdbscm_unwind_stop_reason_string), "\
Return a string explaining the unwind stop reason.\n\
\n\
Arguments: integer (the result of frame-unwind-stop-reason)" },
- END_FUNCTIONS
-};
+ END_FUNCTIONS };
void
gdbscm_initialize_frames (void)
diff --git a/gdb/guile/scm-gsmob.c b/gdb/guile/scm-gsmob.c
index a0724d8b2b0..e5884a6d0ab 100644
--- a/gdb/guile/scm-gsmob.c
+++ b/gdb/guile/scm-gsmob.c
@@ -91,8 +91,8 @@ gdbscm_is_gsmob (SCM scm)
if (SCM_IMP (scm))
return 0;
- slot = htab_find_slot (registered_gsmobs, (void *) SCM_TYP16 (scm),
- NO_INSERT);
+ slot
+ = htab_find_slot (registered_gsmobs, (void *) SCM_TYP16 (scm), NO_INSERT);
return slot != NULL;
}
@@ -109,19 +109,22 @@ gdbscm_make_smob_type (const char *name, size_t size)
#if SCM_MAJOR_VERSION == 2 && SCM_MINOR_VERSION == 0
/* Prior to Guile 2.1.0, smob classes were only exposed via exports
from the (oop goops) module. */
- SCM bound_name = scm_string_append (scm_list_3 (scm_from_latin1_string ("<"),
- scm_from_latin1_string (name),
- scm_from_latin1_string (">")));
+ SCM bound_name
+ = scm_string_append (scm_list_3 (scm_from_latin1_string ("<"),
+ scm_from_latin1_string (name),
+ scm_from_latin1_string (">")));
bound_name = scm_string_to_symbol (bound_name);
- SCM smob_type = scm_public_ref (scm_list_2 (scm_from_latin1_symbol ("oop"),
- scm_from_latin1_symbol ("goops")),
- bound_name);
-#elif SCM_MAJOR_VERSION == 2 && SCM_MINOR_VERSION == 1 && SCM_MICRO_VERSION == 0
+ SCM smob_type
+ = scm_public_ref (scm_list_2 (scm_from_latin1_symbol ("oop"),
+ scm_from_latin1_symbol ("goops")),
+ bound_name);
+#elif SCM_MAJOR_VERSION == 2 && SCM_MINOR_VERSION == 1 \
+ && SCM_MICRO_VERSION == 0
/* Guile 2.1.0 doesn't provide any API for looking up smob classes.
We could try allocating a fake instance and using scm_class_of,
but it's probably not worth the trouble for the sake of a single
development release. */
-# error "Unsupported Guile version"
+#error "Unsupported Guile version"
#else
/* Guile 2.1.1 and above provides scm_smob_type_class. */
SCM smob_type = scm_smob_type_class (result);
@@ -165,7 +168,6 @@ gdbscm_init_eqable_gsmob (eqable_gdb_smob *base, SCM containing_scm)
base->containing_scm = containing_scm;
}
-
/* gsmob accessors */
/* Return the gsmob in SELF.
@@ -175,7 +177,7 @@ static SCM
gsscm_get_gsmob_arg_unsafe (SCM self, int arg_pos, const char *func_name)
{
SCM_ASSERT_TYPE (gdbscm_is_gsmob (self), self, arg_pos, func_name,
- _("any gdb smob"));
+ _ ("any gdb smob"));
return self;
}
@@ -201,7 +203,6 @@ gdbscm_gsmob_kind (SCM self)
return result;
}
-
/* When underlying gdb data structures are deleted, we need to update any
smobs with references to them. There are several smobs that reference
objfile-based data, so we provide helpers to manage this. */
@@ -212,8 +213,7 @@ gdbscm_gsmob_kind (SCM self)
htab_t
gdbscm_create_eqable_gsmob_ptr_map (htab_hash hash_fn, htab_eq eq_fn)
{
- htab_t htab = htab_create_alloc (7, hash_fn, eq_fn,
- NULL, xcalloc, xfree);
+ htab_t htab = htab_create_alloc (7, hash_fn, eq_fn, NULL, xcalloc, xfree);
return htab;
}
@@ -255,16 +255,14 @@ gdbscm_clear_eqable_gsmob_ptr_slot (htab_t htab, eqable_gdb_smob *base)
gdb_assert (slot != NULL);
htab_clear_slot (htab, slot);
}
-
+
/* Initialize the Scheme gsmobs code. */
-static const scheme_function gsmob_functions[] =
-{
+static const scheme_function gsmob_functions[] = {
/* N.B. There is a general rule of not naming symbols in gdb-guile with a
"gdb" prefix. This symbol does not violate this rule because it is to
be read as "gdb-object-foo", not "gdb-foo". */
- { "gdb-object-kind", 1, 0, 0, as_a_scm_t_subr (gdbscm_gsmob_kind),
- "\
+ { "gdb-object-kind", 1, 0, 0, as_a_scm_t_subr (gdbscm_gsmob_kind), "\
Return the kind of the GDB object, e.g., <gdb:breakpoint>, as a symbol." },
END_FUNCTIONS
@@ -273,8 +271,7 @@ Return the kind of the GDB object, e.g., <gdb:breakpoint>, as a symbol." },
void
gdbscm_initialize_smobs (void)
{
- registered_gsmobs = htab_create_alloc (10,
- hash_scm_t_bits, eq_scm_t_bits,
+ registered_gsmobs = htab_create_alloc (10, hash_scm_t_bits, eq_scm_t_bits,
NULL, xcalloc, xfree);
gdbscm_define_functions (gsmob_functions, 1);
diff --git a/gdb/guile/scm-iterator.c b/gdb/guile/scm-iterator.c
index a26e0b7eb54..249a0708c78 100644
--- a/gdb/guile/scm-iterator.c
+++ b/gdb/guile/scm-iterator.c
@@ -106,7 +106,7 @@ itscm_set_iterator_smob_progress_x (iterator_smob *i_smob, SCM progress)
{
i_smob->progress = progress;
}
-
+
/* Administrivia for iterator smobs. */
/* The smob "print" function for <gdb:iterator>. */
@@ -137,8 +137,9 @@ itscm_print_iterator_smob (SCM self, SCM port, scm_print_state *pstate)
static SCM
itscm_make_iterator_smob (SCM object, SCM progress, SCM next)
{
- iterator_smob *i_smob = (iterator_smob *)
- scm_gc_malloc (sizeof (iterator_smob), iterator_smob_name);
+ iterator_smob *i_smob
+ = (iterator_smob *) scm_gc_malloc (sizeof (iterator_smob),
+ iterator_smob_name);
SCM i_scm;
i_smob->object = object;
@@ -158,7 +159,7 @@ gdbscm_make_iterator (SCM object, SCM progress, SCM next)
SCM i_scm;
SCM_ASSERT_TYPE (gdbscm_is_procedure (next), next, SCM_ARG3, FUNC_NAME,
- _("procedure"));
+ _ ("procedure"));
i_scm = itscm_make_iterator_smob (object, progress, next);
@@ -220,7 +221,7 @@ itscm_safe_call_next_x (SCM iter, excp_matcher_func *ok_excps)
i_smob = (iterator_smob *) SCM_SMOB_DATA (iter);
return gdbscm_safe_call_1 (i_smob->next_x, iter, ok_excps);
}
-
+
/* Iterator methods. */
/* Returns the <gdb:iterator> smob in SELF.
@@ -295,13 +296,11 @@ gdbscm_iterator_next_x (SCM self)
return gdbscm_safe_call_1 (i_smob->next_x, self, NULL);
}
-
+
/* Initialize the Scheme iterator code. */
-static const scheme_function iterator_functions[] =
-{
- { "make-iterator", 3, 0, 0, as_a_scm_t_subr (gdbscm_make_iterator),
- "\
+static const scheme_function iterator_functions[] = {
+ { "make-iterator", 3, 0, 0, as_a_scm_t_subr (gdbscm_make_iterator), "\
Create a <gdb:iterator> object.\n\
\n\
Arguments: object progress next!\n\
@@ -313,12 +312,10 @@ Create a <gdb:iterator> object.\n\
By convention end-of-iteration should be marked with (end-of-iteration)\n\
from module (gdb iterator)." },
- { "iterator?", 1, 0, 0, as_a_scm_t_subr (gdbscm_iterator_p),
- "\
+ { "iterator?", 1, 0, 0, as_a_scm_t_subr (gdbscm_iterator_p), "\
Return #t if the object is a <gdb:iterator> object." },
- { "iterator-object", 1, 0, 0, as_a_scm_t_subr (gdbscm_iterator_object),
- "\
+ { "iterator-object", 1, 0, 0, as_a_scm_t_subr (gdbscm_iterator_object), "\
Return the object being iterated over." },
{ "iterator-progress", 1, 0, 0, as_a_scm_t_subr (gdbscm_iterator_progress),
@@ -326,16 +323,13 @@ Return the object being iterated over." },
Return the progress object of the iterator." },
{ "set-iterator-progress!", 2, 0, 0,
- as_a_scm_t_subr (gdbscm_set_iterator_progress_x),
- "\
+ as_a_scm_t_subr (gdbscm_set_iterator_progress_x), "\
Set the progress object of the iterator." },
- { "iterator-next!", 1, 0, 0, as_a_scm_t_subr (gdbscm_iterator_next_x),
- "\
+ { "iterator-next!", 1, 0, 0, as_a_scm_t_subr (gdbscm_iterator_next_x), "\
Invoke the next! procedure of the iterator and return its result." },
- { "end-of-iteration", 0, 0, 0, as_a_scm_t_subr (gdbscm_end_of_iteration),
- "\
+ { "end-of-iteration", 0, 0, 0, as_a_scm_t_subr (gdbscm_end_of_iteration), "\
Return the end-of-iteration marker." },
{ "end-of-iteration?", 1, 0, 0, as_a_scm_t_subr (gdbscm_end_of_iteration_p),
@@ -348,8 +342,8 @@ Return #t if the object is the end-of-iteration marker." },
void
gdbscm_initialize_iterators (void)
{
- iterator_smob_tag = gdbscm_make_smob_type (iterator_smob_name,
- sizeof (iterator_smob));
+ iterator_smob_tag
+ = gdbscm_make_smob_type (iterator_smob_name, sizeof (iterator_smob));
scm_set_smob_print (iterator_smob_tag, itscm_print_iterator_smob);
gdbscm_define_functions (iterator_functions, 1);
diff --git a/gdb/guile/scm-lazy-string.c b/gdb/guile/scm-lazy-string.c
index 7efbb44029d..ec21b1e9174 100644
--- a/gdb/guile/scm-lazy-string.c
+++ b/gdb/guile/scm-lazy-string.c
@@ -64,7 +64,7 @@ static const char lazy_string_smob_name[] = "gdb:lazy-string";
/* The tag Guile knows the lazy string smob by. */
static scm_t_bits lazy_string_smob_tag;
-
+
/* Administrivia for lazy string smobs. */
/* The smob "free" function for <gdb:lazy-string>. */
@@ -110,8 +110,9 @@ static SCM
lsscm_make_lazy_string_smob (CORE_ADDR address, int length,
const char *encoding, struct type *type)
{
- lazy_string_smob *ls_smob = (lazy_string_smob *)
- scm_gc_malloc (sizeof (lazy_string_smob), lazy_string_smob_name);
+ lazy_string_smob *ls_smob
+ = (lazy_string_smob *) scm_gc_malloc (sizeof (lazy_string_smob),
+ lazy_string_smob_name);
SCM ls_scm;
gdb_assert (length >= -1);
@@ -152,28 +153,27 @@ gdbscm_lazy_string_p (SCM scm)
If there's an error a <gdb:exception> object is returned. */
SCM
-lsscm_make_lazy_string (CORE_ADDR address, int length,
- const char *encoding, struct type *type)
+lsscm_make_lazy_string (CORE_ADDR address, int length, const char *encoding,
+ struct type *type)
{
if (length < -1)
{
- return gdbscm_make_out_of_range_error (NULL, 0,
- scm_from_int (length),
- _("invalid length"));
+ return gdbscm_make_out_of_range_error (NULL, 0, scm_from_int (length),
+ _ ("invalid length"));
}
if (address == 0 && length != 0)
{
- return gdbscm_make_out_of_range_error
- (NULL, 0, scm_from_int (length),
- _("cannot create a lazy string with address 0x0,"
+ return gdbscm_make_out_of_range_error (
+ NULL, 0, scm_from_int (length),
+ _ ("cannot create a lazy string with address 0x0,"
" and a non-zero length"));
}
if (type == NULL)
{
- return gdbscm_make_out_of_range_error
- (NULL, 0, scm_from_int (0), _("a lazy string's type cannot be NULL"));
+ return gdbscm_make_out_of_range_error (
+ NULL, 0, scm_from_int (0), _ ("a lazy string's type cannot be NULL"));
}
return lsscm_make_lazy_string_smob (address, length, encoding, type);
@@ -212,7 +212,7 @@ lsscm_elt_type (lazy_string_smob *ls_smob)
return realtype;
}
}
-
+
/* Lazy string methods. */
/* (lazy-string-address <gdb:lazy-string>) -> address */
@@ -303,9 +303,8 @@ lsscm_safe_lazy_string_to_value (SCM string, int arg_pos,
if (ls_smob->address == 0)
{
- *except_scmp
- = gdbscm_make_out_of_range_error (func_name, arg_pos, string,
- _("cannot create a value from NULL"));
+ *except_scmp = gdbscm_make_out_of_range_error (
+ func_name, arg_pos, string, _ ("cannot create a value from NULL"));
return NULL;
}
@@ -324,8 +323,8 @@ lsscm_safe_lazy_string_to_value (SCM string, int arg_pos,
/* PR 20786: There's no way to specify an array of length zero.
Record a length of [0,-1] which is how Ada does it. Anything
we do is broken, but this one possible solution. */
- type = lookup_array_range_type (realtype->target_type (),
- 0, ls_smob->length - 1);
+ type = lookup_array_range_type (realtype->target_type (), 0,
+ ls_smob->length - 1);
value = value_at_lazy (type, ls_smob->address);
}
else
@@ -360,52 +359,45 @@ lsscm_val_print_lazy_string (SCM string, struct ui_file *stream,
ls_smob = (lazy_string_smob *) SCM_SMOB_DATA (string);
elt_type = lsscm_elt_type (ls_smob);
- val_print_string (elt_type, ls_smob->encoding,
- ls_smob->address, ls_smob->length,
- stream, options);
+ val_print_string (elt_type, ls_smob->encoding, ls_smob->address,
+ ls_smob->length, stream, options);
}
-
+
/* Initialize the Scheme lazy-strings code. */
-static const scheme_function lazy_string_functions[] =
-{
- { "lazy-string?", 1, 0, 0, as_a_scm_t_subr (gdbscm_lazy_string_p),
- "\
+static const scheme_function lazy_string_functions[]
+ = { { "lazy-string?", 1, 0, 0, as_a_scm_t_subr (gdbscm_lazy_string_p), "\
Return #t if the object is a <gdb:lazy-string> object." },
- { "lazy-string-address", 1, 0, 0,
- as_a_scm_t_subr (gdbscm_lazy_string_address),
- "\
+ { "lazy-string-address", 1, 0, 0,
+ as_a_scm_t_subr (gdbscm_lazy_string_address), "\
Return the address of the lazy-string." },
- { "lazy-string-length", 1, 0, 0, as_a_scm_t_subr (gdbscm_lazy_string_length),
- "\
+ { "lazy-string-length", 1, 0, 0,
+ as_a_scm_t_subr (gdbscm_lazy_string_length), "\
Return the length of the lazy-string.\n\
If the length is -1 then the length is determined by the first null\n\
of appropriate width." },
- { "lazy-string-encoding", 1, 0, 0,
- as_a_scm_t_subr (gdbscm_lazy_string_encoding),
- "\
+ { "lazy-string-encoding", 1, 0, 0,
+ as_a_scm_t_subr (gdbscm_lazy_string_encoding), "\
Return the encoding of the lazy-string." },
- { "lazy-string-type", 1, 0, 0, as_a_scm_t_subr (gdbscm_lazy_string_type),
- "\
+ { "lazy-string-type", 1, 0, 0, as_a_scm_t_subr (gdbscm_lazy_string_type),
+ "\
Return the <gdb:type> of the lazy-string." },
- { "lazy-string->value", 1, 0, 0,
- as_a_scm_t_subr (gdbscm_lazy_string_to_value),
- "\
+ { "lazy-string->value", 1, 0, 0,
+ as_a_scm_t_subr (gdbscm_lazy_string_to_value), "\
Return the <gdb:value> representation of the lazy-string." },
- END_FUNCTIONS
-};
+ END_FUNCTIONS };
void
gdbscm_initialize_lazy_strings (void)
{
- lazy_string_smob_tag = gdbscm_make_smob_type (lazy_string_smob_name,
- sizeof (lazy_string_smob));
+ lazy_string_smob_tag
+ = gdbscm_make_smob_type (lazy_string_smob_name, sizeof (lazy_string_smob));
scm_set_smob_free (lazy_string_smob_tag, lsscm_free_lazy_string_smob);
scm_set_smob_print (lazy_string_smob_tag, lsscm_print_lazy_string_smob);
diff --git a/gdb/guile/scm-math.c b/gdb/guile/scm-math.c
index 26019b4df3f..228afebb310 100644
--- a/gdb/guile/scm-math.c
+++ b/gdb/guile/scm-math.c
@@ -80,9 +80,9 @@ vlscm_unop_gdbthrow (enum valscm_unary_opcode opcode, SCM x,
scoped_value_mark free_values;
SCM except_scm;
- value *arg1 = vlscm_convert_value_from_scheme (func_name, SCM_ARG1, x,
- &except_scm, gdbarch,
- language);
+ value *arg1
+ = vlscm_convert_value_from_scheme (func_name, SCM_ARG1, x, &except_scm,
+ gdbarch, language);
if (arg1 == NULL)
return except_scm;
@@ -96,8 +96,7 @@ vlscm_unop_gdbthrow (enum valscm_unary_opcode opcode, SCM x,
{
struct type *type = language_bool_type (language, gdbarch);
res_val
- = value_from_longest (type,
- (LONGEST) value_logical_not (arg1));
+ = value_from_longest (type, (LONGEST) value_logical_not (arg1));
}
break;
case VALSCM_NEG:
@@ -146,13 +145,13 @@ vlscm_binop_gdbthrow (enum valscm_binary_opcode opcode, SCM x, SCM y,
scoped_value_mark free_values;
- arg1 = vlscm_convert_value_from_scheme (func_name, SCM_ARG1, x,
- &except_scm, gdbarch, language);
+ arg1 = vlscm_convert_value_from_scheme (func_name, SCM_ARG1, x, &except_scm,
+ gdbarch, language);
if (arg1 == NULL)
return except_scm;
- arg2 = vlscm_convert_value_from_scheme (func_name, SCM_ARG2, y,
- &except_scm, gdbarch, language);
+ arg2 = vlscm_convert_value_from_scheme (func_name, SCM_ARG2, y, &except_scm,
+ gdbarch, language);
if (arg2 == NULL)
return except_scm;
@@ -168,11 +167,9 @@ vlscm_binop_gdbthrow (enum valscm_binary_opcode opcode, SCM x, SCM y,
rtype = check_typedef (rtype);
rtype = STRIP_REFERENCE (rtype);
- if (ltype->code () == TYPE_CODE_PTR
- && is_integral_type (rtype))
+ if (ltype->code () == TYPE_CODE_PTR && is_integral_type (rtype))
res_val = value_ptradd (arg1, value_as_long (arg2));
- else if (rtype->code () == TYPE_CODE_PTR
- && is_integral_type (ltype))
+ else if (rtype->code () == TYPE_CODE_PTR && is_integral_type (ltype))
res_val = value_ptradd (arg2, value_as_long (arg1));
else
res_val = value_binop (arg1, arg2, BINOP_ADD);
@@ -188,17 +185,14 @@ vlscm_binop_gdbthrow (enum valscm_binary_opcode opcode, SCM x, SCM y,
rtype = check_typedef (rtype);
rtype = STRIP_REFERENCE (rtype);
- if (ltype->code () == TYPE_CODE_PTR
- && rtype->code () == TYPE_CODE_PTR)
+ if (ltype->code () == TYPE_CODE_PTR && rtype->code () == TYPE_CODE_PTR)
{
/* A ptrdiff_t for the target would be preferable here. */
- res_val
- = value_from_longest (builtin_type (gdbarch)->builtin_long,
- value_ptrdiff (arg1, arg2));
+ res_val = value_from_longest (builtin_type (gdbarch)->builtin_long,
+ value_ptrdiff (arg1, arg2));
}
- else if (ltype->code () == TYPE_CODE_PTR
- && is_integral_type (rtype))
- res_val = value_ptradd (arg1, - value_as_long (arg2));
+ else if (ltype->code () == TYPE_CODE_PTR && is_integral_type (rtype))
+ res_val = value_ptradd (arg1, -value_as_long (arg2));
else
res_val = value_binop (arg1, arg2, BINOP_SUB);
}
@@ -416,53 +410,50 @@ gdbscm_value_logxor (SCM x, SCM y)
static SCM
vlscm_rich_compare (int op, SCM x, SCM y, const char *func_name)
{
- return gdbscm_wrap ([=]
- {
- struct gdbarch *gdbarch = get_current_arch ();
- const struct language_defn *language = current_language;
- SCM except_scm;
-
- scoped_value_mark free_values;
-
- value *v1
- = vlscm_convert_value_from_scheme (func_name, SCM_ARG1, x,
- &except_scm, gdbarch, language);
- if (v1 == NULL)
- return except_scm;
-
- value *v2
- = vlscm_convert_value_from_scheme (func_name, SCM_ARG2, y,
- &except_scm, gdbarch, language);
- if (v2 == NULL)
- return except_scm;
-
- int result;
- switch (op)
- {
- case BINOP_LESS:
- result = value_less (v1, v2);
- break;
- case BINOP_LEQ:
- result = (value_less (v1, v2)
- || value_equal (v1, v2));
- break;
- case BINOP_EQUAL:
- result = value_equal (v1, v2);
- break;
- case BINOP_NOTEQUAL:
- gdb_assert_not_reached ("not-equal not implemented");
- case BINOP_GTR:
- result = value_less (v2, v1);
- break;
- case BINOP_GEQ:
- result = (value_less (v2, v1)
- || value_equal (v1, v2));
- break;
- default:
- gdb_assert_not_reached ("invalid <gdb:value> comparison");
- }
- return scm_from_bool (result);
- });
+ return gdbscm_wrap ([=] {
+ struct gdbarch *gdbarch = get_current_arch ();
+ const struct language_defn *language = current_language;
+ SCM except_scm;
+
+ scoped_value_mark free_values;
+
+ value *v1
+ = vlscm_convert_value_from_scheme (func_name, SCM_ARG1, x, &except_scm,
+ gdbarch, language);
+ if (v1 == NULL)
+ return except_scm;
+
+ value *v2
+ = vlscm_convert_value_from_scheme (func_name, SCM_ARG2, y, &except_scm,
+ gdbarch, language);
+ if (v2 == NULL)
+ return except_scm;
+
+ int result;
+ switch (op)
+ {
+ case BINOP_LESS:
+ result = value_less (v1, v2);
+ break;
+ case BINOP_LEQ:
+ result = (value_less (v1, v2) || value_equal (v1, v2));
+ break;
+ case BINOP_EQUAL:
+ result = value_equal (v1, v2);
+ break;
+ case BINOP_NOTEQUAL:
+ gdb_assert_not_reached ("not-equal not implemented");
+ case BINOP_GTR:
+ result = value_less (v2, v1);
+ break;
+ case BINOP_GEQ:
+ result = (value_less (v2, v1) || value_equal (v1, v2));
+ break;
+ default:
+ gdb_assert_not_reached ("invalid <gdb:value> comparison");
+ }
+ return scm_from_bool (result);
+ });
}
/* (value=? x y) -> boolean
@@ -506,7 +497,7 @@ gdbscm_value_ge_p (SCM x, SCM y)
{
return vlscm_rich_compare (BINOP_GEQ, x, y, FUNC_NAME);
}
-
+
/* Subroutine of vlscm_convert_typed_value_from_scheme to simplify it.
Convert OBJ, a Scheme number, to a <gdb:value> object.
OBJ_ARG_POS is its position in the argument list, used in exception text.
@@ -531,10 +522,9 @@ vlscm_convert_typed_number (const char *func_name, int obj_arg_pos, SCM obj,
ULONGEST max = get_unsigned_type_max (type);
if (!scm_is_unsigned_integer (obj, 0, max))
{
- *except_scmp
- = gdbscm_make_out_of_range_error
- (func_name, obj_arg_pos, obj,
- _("value out of range for type"));
+ *except_scmp = gdbscm_make_out_of_range_error (
+ func_name, obj_arg_pos, obj,
+ _ ("value out of range for type"));
return NULL;
}
return value_from_longest (type, gdbscm_scm_to_ulongest (obj));
@@ -546,10 +536,9 @@ vlscm_convert_typed_number (const char *func_name, int obj_arg_pos, SCM obj,
get_signed_type_minmax (type, &min, &max);
if (!scm_is_signed_integer (obj, min, max))
{
- *except_scmp
- = gdbscm_make_out_of_range_error
- (func_name, obj_arg_pos, obj,
- _("value out of range for type"));
+ *except_scmp = gdbscm_make_out_of_range_error (
+ func_name, obj_arg_pos, obj,
+ _ ("value out of range for type"));
return NULL;
}
return value_from_longest (type, gdbscm_scm_to_longest (obj));
@@ -560,10 +549,8 @@ vlscm_convert_typed_number (const char *func_name, int obj_arg_pos, SCM obj,
CORE_ADDR max = get_pointer_type_max (type);
if (!scm_is_unsigned_integer (obj, 0, max))
{
- *except_scmp
- = gdbscm_make_out_of_range_error
- (func_name, obj_arg_pos, obj,
- _("value out of range for type"));
+ *except_scmp = gdbscm_make_out_of_range_error (
+ func_name, obj_arg_pos, obj, _ ("value out of range for type"));
return NULL;
}
return value_from_pointer (type, gdbscm_scm_to_ulongest (obj));
@@ -572,8 +559,8 @@ vlscm_convert_typed_number (const char *func_name, int obj_arg_pos, SCM obj,
return value_from_host_double (type, scm_to_double (obj));
else
{
- *except_scmp = gdbscm_make_type_error (func_name, obj_arg_pos, obj,
- NULL);
+ *except_scmp
+ = gdbscm_make_type_error (func_name, obj_arg_pos, obj, NULL);
return NULL;
}
}
@@ -650,8 +637,9 @@ vlscm_convert_number (const char *func_name, int obj_arg_pos, SCM obj,
else if (scm_is_real (obj))
return value_from_host_double (bt->builtin_double, scm_to_double (obj));
- *except_scmp = gdbscm_make_out_of_range_error (func_name, obj_arg_pos, obj,
- _("value not a number representable on the target"));
+ *except_scmp = gdbscm_make_out_of_range_error (
+ func_name, obj_arg_pos, obj,
+ _ ("value not a number representable on the target"));
return NULL;
}
@@ -667,9 +655,9 @@ vlscm_convert_number (const char *func_name, int obj_arg_pos, SCM obj,
object is stored in *EXCEPT_SCMP, and NULL is returned. */
static struct value *
-vlscm_convert_bytevector (SCM bv, struct type *type, SCM type_scm,
- int arg_pos, const char *func_name,
- SCM *except_scmp, struct gdbarch *gdbarch)
+vlscm_convert_bytevector (SCM bv, struct type *type, SCM type_scm, int arg_pos,
+ const char *func_name, SCM *except_scmp,
+ struct gdbarch *gdbarch)
{
LONGEST length = SCM_BYTEVECTOR_LENGTH (bv);
struct value *value;
@@ -683,14 +671,14 @@ vlscm_convert_bytevector (SCM bv, struct type *type, SCM type_scm,
type = check_typedef (type);
if (type->length () != length)
{
- *except_scmp = gdbscm_make_out_of_range_error (func_name, arg_pos,
- type_scm,
- _("size of type does not match size of bytevector"));
+ *except_scmp = gdbscm_make_out_of_range_error (
+ func_name, arg_pos, type_scm,
+ _ ("size of type does not match size of bytevector"));
return NULL;
}
- value = value_from_contents (type,
- (gdb_byte *) SCM_BYTEVECTOR_CONTENTS (bv));
+ value
+ = value_from_contents (type, (gdb_byte *) SCM_BYTEVECTOR_CONTENTS (bv));
return value;
}
@@ -713,11 +701,9 @@ vlscm_convert_bytevector (SCM bv, struct type *type, SCM type_scm,
Otherwise the new value is returned, added to the all_values chain. */
struct value *
-vlscm_convert_typed_value_from_scheme (const char *func_name,
- int obj_arg_pos, SCM obj,
- int type_arg_pos, SCM type_scm,
- struct type *type,
- SCM *except_scmp,
+vlscm_convert_typed_value_from_scheme (const char *func_name, int obj_arg_pos,
+ SCM obj, int type_arg_pos, SCM type_scm,
+ struct type *type, SCM *except_scmp,
struct gdbarch *gdbarch,
const struct language_defn *language)
{
@@ -738,9 +724,9 @@ vlscm_convert_typed_value_from_scheme (const char *func_name,
{
if (type != NULL)
{
- except_scm = gdbscm_make_misc_error (func_name, type_arg_pos,
- type_scm,
- _("No type allowed"));
+ except_scm
+ = gdbscm_make_misc_error (func_name, type_arg_pos, type_scm,
+ _ ("No type allowed"));
value = NULL;
}
else
@@ -748,24 +734,21 @@ vlscm_convert_typed_value_from_scheme (const char *func_name,
}
else if (gdbscm_is_true (scm_bytevector_p (obj)))
{
- value = vlscm_convert_bytevector (obj, type, type_scm,
- obj_arg_pos, func_name,
- &except_scm, gdbarch);
+ value = vlscm_convert_bytevector (obj, type, type_scm, obj_arg_pos,
+ func_name, &except_scm, gdbarch);
}
- else if (gdbscm_is_bool (obj))
+ else if (gdbscm_is_bool (obj))
{
- if (type != NULL
- && !is_integral_type (type))
+ if (type != NULL && !is_integral_type (type))
{
except_scm = gdbscm_make_type_error (func_name, type_arg_pos,
type_scm, NULL);
}
else
{
- value = value_from_longest (type
- ? type
- : language_bool_type (language,
- gdbarch),
+ value = value_from_longest (type ? type
+ : language_bool_type (language,
+ gdbarch),
gdbscm_is_true (obj));
}
}
@@ -789,19 +772,17 @@ vlscm_convert_typed_value_from_scheme (const char *func_name,
if (type != NULL)
{
- except_scm = gdbscm_make_misc_error (func_name, type_arg_pos,
- type_scm,
- _("No type allowed"));
+ except_scm
+ = gdbscm_make_misc_error (func_name, type_arg_pos, type_scm,
+ _ ("No type allowed"));
value = NULL;
}
else
{
/* TODO: Provide option to specify conversion strategy. */
gdb::unique_xmalloc_ptr<char> s
- = gdbscm_scm_to_string (obj, &len,
- target_charset (gdbarch),
- 0 /*non-strict*/,
- &except_scm);
+ = gdbscm_scm_to_string (obj, &len, target_charset (gdbarch),
+ 0 /*non-strict*/, &except_scm);
if (s != NULL)
value = value_cstring (s.get (), len,
language_string_char_type (language,
@@ -814,22 +795,21 @@ vlscm_convert_typed_value_from_scheme (const char *func_name,
{
if (type != NULL)
{
- except_scm = gdbscm_make_misc_error (func_name, type_arg_pos,
- type_scm,
- _("No type allowed"));
+ except_scm
+ = gdbscm_make_misc_error (func_name, type_arg_pos, type_scm,
+ _ ("No type allowed"));
value = NULL;
}
else
{
value = lsscm_safe_lazy_string_to_value (obj, obj_arg_pos,
- func_name,
- &except_scm);
+ func_name, &except_scm);
}
}
else /* OBJ isn't anything we support. */
{
- except_scm = gdbscm_make_type_error (func_name, obj_arg_pos, obj,
- NULL);
+ except_scm
+ = gdbscm_make_type_error (func_name, obj_arg_pos, obj, NULL);
value = NULL;
}
}
@@ -852,119 +832,93 @@ vlscm_convert_typed_value_from_scheme (const char *func_name,
details. */
struct value *
-vlscm_convert_value_from_scheme (const char *func_name,
- int obj_arg_pos, SCM obj,
- SCM *except_scmp, struct gdbarch *gdbarch,
+vlscm_convert_value_from_scheme (const char *func_name, int obj_arg_pos,
+ SCM obj, SCM *except_scmp,
+ struct gdbarch *gdbarch,
const struct language_defn *language)
{
return vlscm_convert_typed_value_from_scheme (func_name, obj_arg_pos, obj,
-1, SCM_UNDEFINED, NULL,
- except_scmp,
- gdbarch, language);
+ except_scmp, gdbarch,
+ language);
}
-
+
/* Initialize value math support. */
-static const scheme_function math_functions[] =
-{
- { "value-add", 2, 0, 0, as_a_scm_t_subr (gdbscm_value_add),
- "\
+static const scheme_function math_functions[]
+ = { { "value-add", 2, 0, 0, as_a_scm_t_subr (gdbscm_value_add), "\
Return a + b." },
- { "value-sub", 2, 0, 0, as_a_scm_t_subr (gdbscm_value_sub),
- "\
+ { "value-sub", 2, 0, 0, as_a_scm_t_subr (gdbscm_value_sub), "\
Return a - b." },
- { "value-mul", 2, 0, 0, as_a_scm_t_subr (gdbscm_value_mul),
- "\
+ { "value-mul", 2, 0, 0, as_a_scm_t_subr (gdbscm_value_mul), "\
Return a * b." },
- { "value-div", 2, 0, 0, as_a_scm_t_subr (gdbscm_value_div),
- "\
+ { "value-div", 2, 0, 0, as_a_scm_t_subr (gdbscm_value_div), "\
Return a / b." },
- { "value-rem", 2, 0, 0, as_a_scm_t_subr (gdbscm_value_rem),
- "\
+ { "value-rem", 2, 0, 0, as_a_scm_t_subr (gdbscm_value_rem), "\
Return a % b." },
- { "value-mod", 2, 0, 0, as_a_scm_t_subr (gdbscm_value_mod),
- "\
+ { "value-mod", 2, 0, 0, as_a_scm_t_subr (gdbscm_value_mod), "\
Return a mod b. See Knuth 1.2.4." },
- { "value-pow", 2, 0, 0, as_a_scm_t_subr (gdbscm_value_pow),
- "\
+ { "value-pow", 2, 0, 0, as_a_scm_t_subr (gdbscm_value_pow), "\
Return pow (x, y)." },
- { "value-not", 1, 0, 0, as_a_scm_t_subr (gdbscm_value_not),
- "\
+ { "value-not", 1, 0, 0, as_a_scm_t_subr (gdbscm_value_not), "\
Return !a." },
- { "value-neg", 1, 0, 0, as_a_scm_t_subr (gdbscm_value_neg),
- "\
+ { "value-neg", 1, 0, 0, as_a_scm_t_subr (gdbscm_value_neg), "\
Return -a." },
- { "value-pos", 1, 0, 0, as_a_scm_t_subr (gdbscm_value_pos),
- "\
+ { "value-pos", 1, 0, 0, as_a_scm_t_subr (gdbscm_value_pos), "\
Return a." },
- { "value-abs", 1, 0, 0, as_a_scm_t_subr (gdbscm_value_abs),
- "\
+ { "value-abs", 1, 0, 0, as_a_scm_t_subr (gdbscm_value_abs), "\
Return abs (a)." },
- { "value-lsh", 2, 0, 0, as_a_scm_t_subr (gdbscm_value_lsh),
- "\
+ { "value-lsh", 2, 0, 0, as_a_scm_t_subr (gdbscm_value_lsh), "\
Return a << b." },
- { "value-rsh", 2, 0, 0, as_a_scm_t_subr (gdbscm_value_rsh),
- "\
+ { "value-rsh", 2, 0, 0, as_a_scm_t_subr (gdbscm_value_rsh), "\
Return a >> b." },
- { "value-min", 2, 0, 0, as_a_scm_t_subr (gdbscm_value_min),
- "\
+ { "value-min", 2, 0, 0, as_a_scm_t_subr (gdbscm_value_min), "\
Return min (a, b)." },
- { "value-max", 2, 0, 0, as_a_scm_t_subr (gdbscm_value_max),
- "\
+ { "value-max", 2, 0, 0, as_a_scm_t_subr (gdbscm_value_max), "\
Return max (a, b)." },
- { "value-lognot", 1, 0, 0, as_a_scm_t_subr (gdbscm_value_lognot),
- "\
+ { "value-lognot", 1, 0, 0, as_a_scm_t_subr (gdbscm_value_lognot), "\
Return ~a." },
- { "value-logand", 2, 0, 0, as_a_scm_t_subr (gdbscm_value_logand),
- "\
+ { "value-logand", 2, 0, 0, as_a_scm_t_subr (gdbscm_value_logand), "\
Return a & b." },
- { "value-logior", 2, 0, 0, as_a_scm_t_subr (gdbscm_value_logior),
- "\
+ { "value-logior", 2, 0, 0, as_a_scm_t_subr (gdbscm_value_logior), "\
Return a | b." },
- { "value-logxor", 2, 0, 0, as_a_scm_t_subr (gdbscm_value_logxor),
- "\
+ { "value-logxor", 2, 0, 0, as_a_scm_t_subr (gdbscm_value_logxor), "\
Return a ^ b." },
- { "value=?", 2, 0, 0, as_a_scm_t_subr (gdbscm_value_eq_p),
- "\
+ { "value=?", 2, 0, 0, as_a_scm_t_subr (gdbscm_value_eq_p), "\
Return a == b." },
- { "value<?", 2, 0, 0, as_a_scm_t_subr (gdbscm_value_lt_p),
- "\
+ { "value<?", 2, 0, 0, as_a_scm_t_subr (gdbscm_value_lt_p), "\
Return a < b." },
- { "value<=?", 2, 0, 0, as_a_scm_t_subr (gdbscm_value_le_p),
- "\
+ { "value<=?", 2, 0, 0, as_a_scm_t_subr (gdbscm_value_le_p), "\
Return a <= b." },
- { "value>?", 2, 0, 0, as_a_scm_t_subr (gdbscm_value_gt_p),
- "\
+ { "value>?", 2, 0, 0, as_a_scm_t_subr (gdbscm_value_gt_p), "\
Return a > b." },
- { "value>=?", 2, 0, 0, as_a_scm_t_subr (gdbscm_value_ge_p),
- "\
+ { "value>=?", 2, 0, 0, as_a_scm_t_subr (gdbscm_value_ge_p), "\
Return a >= b." },
- END_FUNCTIONS
-};
+ END_FUNCTIONS };
void
gdbscm_initialize_math (void)
diff --git a/gdb/guile/scm-objfile.c b/gdb/guile/scm-objfile.c
index 9a7e3a37f28..1c258ecc009 100644
--- a/gdb/guile/scm-objfile.c
+++ b/gdb/guile/scm-objfile.c
@@ -60,7 +60,7 @@ struct ofscm_deleter
};
static const registry<objfile>::key<objfile_smob, ofscm_deleter>
- ofscm_objfile_data_key;
+ ofscm_objfile_data_key;
/* Return the list of pretty-printers registered with O_SMOB. */
@@ -69,7 +69,7 @@ ofscm_objfile_smob_pretty_printers (objfile_smob *o_smob)
{
return o_smob->pretty_printers;
}
-
+
/* Administrivia for objfile smobs. */
/* The smob "print" function for <gdb:objfile>. */
@@ -81,9 +81,8 @@ ofscm_print_objfile_smob (SCM self, SCM port, scm_print_state *pstate)
gdbscm_printf (port, "#<%s ", objfile_smob_name);
gdbscm_printf (port, "%s",
- o_smob->objfile != NULL
- ? objfile_name (o_smob->objfile)
- : "{invalid}");
+ o_smob->objfile != NULL ? objfile_name (o_smob->objfile)
+ : "{invalid}");
scm_puts (">", port);
scm_remember_upto_here_1 (self);
@@ -99,8 +98,8 @@ ofscm_print_objfile_smob (SCM self, SCM port, scm_print_state *pstate)
static SCM
ofscm_make_objfile_smob (void)
{
- objfile_smob *o_smob = (objfile_smob *)
- scm_gc_malloc (sizeof (objfile_smob), objfile_smob_name);
+ objfile_smob *o_smob = (objfile_smob *) scm_gc_malloc (sizeof (objfile_smob),
+ objfile_smob_name);
SCM o_scm;
o_smob->objfile = NULL;
@@ -208,12 +207,12 @@ ofscm_get_valid_objfile_smob_arg_unsafe (SCM self, int arg_pos,
if (!ofscm_is_valid (o_smob))
{
gdbscm_invalid_object_error (func_name, arg_pos, self,
- _("<gdb:objfile>"));
+ _ ("<gdb:objfile>"));
}
return o_smob;
}
-
+
/* Objfile methods. */
/* (objfile-valid? <gdb:objfile>) -> boolean
@@ -275,14 +274,14 @@ gdbscm_set_objfile_pretty_printers_x (SCM self, SCM printers)
objfile_smob *o_smob
= ofscm_get_objfile_smob_arg_unsafe (self, SCM_ARG1, FUNC_NAME);
- SCM_ASSERT_TYPE (gdbscm_is_true (scm_list_p (printers)), printers,
- SCM_ARG2, FUNC_NAME, _("list"));
+ SCM_ASSERT_TYPE (gdbscm_is_true (scm_list_p (printers)), printers, SCM_ARG2,
+ FUNC_NAME, _ ("list"));
o_smob->pretty_printers = printers;
return SCM_UNSPECIFIED;
}
-
+
/* The "current" objfile. This is set when gdb detects that a new
objfile has been loaded. It is only set for the duration of a call to
gdbscm_source_objfile_script and gdbscm_execute_objfile_script; it is NULL
@@ -363,47 +362,40 @@ gdbscm_objfiles (void)
return scm_reverse_x (result, SCM_EOL);
}
-
+
/* Initialize the Scheme objfile support. */
-static const scheme_function objfile_functions[] =
-{
- { "objfile?", 1, 0, 0, as_a_scm_t_subr (gdbscm_objfile_p),
- "\
+static const scheme_function objfile_functions[]
+ = { { "objfile?", 1, 0, 0, as_a_scm_t_subr (gdbscm_objfile_p), "\
Return #t if the object is a <gdb:objfile> object." },
- { "objfile-valid?", 1, 0, 0, as_a_scm_t_subr (gdbscm_objfile_valid_p),
- "\
+ { "objfile-valid?", 1, 0, 0, as_a_scm_t_subr (gdbscm_objfile_valid_p), "\
Return #t if the objfile is valid (hasn't been deleted from gdb)." },
- { "objfile-filename", 1, 0, 0, as_a_scm_t_subr (gdbscm_objfile_filename),
- "\
+ { "objfile-filename", 1, 0, 0, as_a_scm_t_subr (gdbscm_objfile_filename),
+ "\
Return the file name of the objfile." },
- { "objfile-progspace", 1, 0, 0, as_a_scm_t_subr (gdbscm_objfile_progspace),
- "\
+ { "objfile-progspace", 1, 0, 0,
+ as_a_scm_t_subr (gdbscm_objfile_progspace), "\
Return the progspace that the objfile lives in." },
- { "objfile-pretty-printers", 1, 0, 0,
- as_a_scm_t_subr (gdbscm_objfile_pretty_printers),
- "\
+ { "objfile-pretty-printers", 1, 0, 0,
+ as_a_scm_t_subr (gdbscm_objfile_pretty_printers), "\
Return a list of pretty-printers of the objfile." },
- { "set-objfile-pretty-printers!", 2, 0, 0,
- as_a_scm_t_subr (gdbscm_set_objfile_pretty_printers_x),
- "\
+ { "set-objfile-pretty-printers!", 2, 0, 0,
+ as_a_scm_t_subr (gdbscm_set_objfile_pretty_printers_x), "\
Set the list of pretty-printers of the objfile." },
- { "current-objfile", 0, 0, 0, as_a_scm_t_subr (gdbscm_get_current_objfile),
- "\
+ { "current-objfile", 0, 0, 0,
+ as_a_scm_t_subr (gdbscm_get_current_objfile), "\
Return the current objfile if there is one or #f if there isn't one." },
- { "objfiles", 0, 0, 0, as_a_scm_t_subr (gdbscm_objfiles),
- "\
+ { "objfiles", 0, 0, 0, as_a_scm_t_subr (gdbscm_objfiles), "\
Return a list of all objfiles in the current program space." },
- END_FUNCTIONS
-};
+ END_FUNCTIONS };
void
gdbscm_initialize_objfiles (void)
diff --git a/gdb/guile/scm-param.c b/gdb/guile/scm-param.c
index 0bb87b0d3ed..5a5421698f6 100644
--- a/gdb/guile/scm-param.c
+++ b/gdb/guile/scm-param.c
@@ -99,7 +99,7 @@ struct param_smob
/* For an enum parameter, the possible values. The vector lives in GC
space, it will be freed with the smob. */
- const char * const *enumeration;
+ const char *const *enumeration;
/* The set_func funcion or #f if not specified.
This function is called *after* the parameter is set.
@@ -143,21 +143,17 @@ static const struct
/* Extra literals, such as `unlimited', accepted in lieu of a number. */
const literal_def *extra_literals;
-}
-param_to_var[] =
-{
- { var_boolean },
- { var_auto_boolean },
- { var_integer },
- { var_uinteger, uinteger_unlimited_literals },
- { var_uinteger },
- { var_pinteger, pinteger_unlimited_literals },
- { var_string },
- { var_string_noescape },
- { var_optional_filename },
- { var_filename },
- { var_enum }
-};
+} param_to_var[] = { { var_boolean },
+ { var_auto_boolean },
+ { var_integer },
+ { var_uinteger, uinteger_unlimited_literals },
+ { var_uinteger },
+ { var_pinteger, pinteger_unlimited_literals },
+ { var_string },
+ { var_string_noescape },
+ { var_optional_filename },
+ { var_filename },
+ { var_enum } };
/* Wraps a setting around an existing param_smob. This abstraction
is used to manipulate the value in S->VALUE in a type safe manner using
@@ -205,7 +201,7 @@ static int pascm_is_valid (param_smob *);
static const char *pascm_param_type_name (enum param_types type);
static SCM pascm_param_value (const setting &var, int arg_pos,
const char *func_name);
-
+
/* Administrivia for parameter smobs. */
static int
@@ -218,7 +214,7 @@ pascm_print_param_smob (SCM self, SCM port, scm_print_state *pstate)
gdbscm_printf (port, " %s", p_smob->name);
- if (! pascm_is_valid (p_smob))
+ if (!pascm_is_valid (p_smob))
scm_puts (" {invalid}", port);
gdbscm_printf (port, " %s ", p_smob->pname);
@@ -239,8 +235,8 @@ pascm_print_param_smob (SCM self, SCM port, scm_print_state *pstate)
static SCM
pascm_make_param_smob (void)
{
- param_smob *p_smob = (param_smob *)
- scm_gc_malloc (sizeof (param_smob), param_smob_name);
+ param_smob *p_smob
+ = (param_smob *) scm_gc_malloc (sizeof (param_smob), param_smob_name);
SCM p_scm;
memset (p_smob, 0, sizeof (*p_smob));
@@ -302,14 +298,14 @@ pascm_is_valid (param_smob *p_smob)
{
return p_smob->commands.set != nullptr;
}
-
+
/* A helper function which return the default documentation string for
a parameter (which is to say that it's undocumented). */
static char *
get_doc_string (void)
{
- return xstrdup (_("This command is not documented."));
+ return xstrdup (_ ("This command is not documented."));
}
/* Subroutine of pascm_set_func, pascm_show_func to simplify them.
@@ -354,18 +350,18 @@ pascm_set_func (const char *args, int from_tty, struct cmd_list_element *c)
if (gdbscm_is_exception (result))
{
pascm_signal_setshow_error (result,
- _("Error occurred setting parameter."));
+ _ ("Error occurred setting parameter."));
}
if (!scm_is_string (result))
- error (_("Result of %s set-func is not a string."), p_smob->name);
+ error (_ ("Result of %s set-func is not a string."), p_smob->name);
- gdb::unique_xmalloc_ptr<char> msg = gdbscm_scm_to_host_string (result, NULL,
- &exception);
+ gdb::unique_xmalloc_ptr<char> msg
+ = gdbscm_scm_to_host_string (result, NULL, &exception);
if (msg == NULL)
{
gdbscm_print_gdb_exception (SCM_BOOL_F, exception);
- error (_("Error converting show text to host string."));
+ error (_ ("Error converting show text to host string."));
}
/* GDB is usually silent when a parameter is set. */
@@ -390,7 +386,7 @@ pascm_show_func (struct ui_file *file, int from_tty,
value_scm = gdbscm_scm_from_host_string (value, strlen (value));
if (gdbscm_is_exception (value_scm))
{
- error (_("Error converting parameter value \"%s\" to Scheme string."),
+ error (_ ("Error converting parameter value \"%s\" to Scheme string."),
value);
}
self = p_smob->containing_scm;
@@ -401,15 +397,15 @@ pascm_show_func (struct ui_file *file, int from_tty,
if (gdbscm_is_exception (result))
{
pascm_signal_setshow_error (result,
- _("Error occurred showing parameter."));
+ _ ("Error occurred showing parameter."));
}
- gdb::unique_xmalloc_ptr<char> msg = gdbscm_scm_to_host_string (result, NULL,
- &exception);
+ gdb::unique_xmalloc_ptr<char> msg
+ = gdbscm_scm_to_host_string (result, NULL, &exception);
if (msg == NULL)
{
gdbscm_print_gdb_exception (SCM_BOOL_F, exception);
- error (_("Error converting show text to host string."));
+ error (_ ("Error converting show text to host string."));
}
gdb_printf (file, "%s\n", msg.get ());
@@ -421,10 +417,9 @@ pascm_show_func (struct ui_file *file, int from_tty,
static set_show_commands
add_setshow_generic (enum var_types param_type,
const literal_def *extra_literals,
- enum command_class cmd_class,
- char *cmd_name, param_smob *self,
- char *set_doc, char *show_doc, char *help_doc,
- cmd_func_ftype *set_func,
+ enum command_class cmd_class, char *cmd_name,
+ param_smob *self, char *set_doc, char *show_doc,
+ char *help_doc, cmd_func_ftype *set_func,
show_value_ftype *show_func,
struct cmd_list_element **set_list,
struct cmd_list_element **show_list)
@@ -434,73 +429,72 @@ add_setshow_generic (enum var_types param_type,
switch (param_type)
{
case var_boolean:
- commands = add_setshow_boolean_cmd (cmd_name, cmd_class,
- &self->value.boolval, set_doc,
- show_doc, help_doc, set_func,
- show_func, set_list, show_list);
+ commands
+ = add_setshow_boolean_cmd (cmd_name, cmd_class, &self->value.boolval,
+ set_doc, show_doc, help_doc, set_func,
+ show_func, set_list, show_list);
break;
case var_auto_boolean:
- commands = add_setshow_auto_boolean_cmd (cmd_name, cmd_class,
- &self->value.autoboolval,
- set_doc, show_doc, help_doc,
- set_func, show_func, set_list,
- show_list);
+ commands
+ = add_setshow_auto_boolean_cmd (cmd_name, cmd_class,
+ &self->value.autoboolval, set_doc,
+ show_doc, help_doc, set_func,
+ show_func, set_list, show_list);
break;
case var_uinteger:
- commands = add_setshow_uinteger_cmd (cmd_name, cmd_class,
- &self->value.uintval,
- extra_literals, set_doc,
- show_doc, help_doc, set_func,
- show_func, set_list, show_list);
+ commands
+ = add_setshow_uinteger_cmd (cmd_name, cmd_class, &self->value.uintval,
+ extra_literals, set_doc, show_doc,
+ help_doc, set_func, show_func, set_list,
+ show_list);
break;
case var_integer:
- commands = add_setshow_integer_cmd (cmd_name, cmd_class,
- &self->value.intval,
- extra_literals, set_doc,
- show_doc, help_doc, set_func,
- show_func, set_list, show_list);
+ commands
+ = add_setshow_integer_cmd (cmd_name, cmd_class, &self->value.intval,
+ extra_literals, set_doc, show_doc, help_doc,
+ set_func, show_func, set_list, show_list);
break;
case var_pinteger:
- commands = add_setshow_pinteger_cmd (cmd_name, cmd_class,
- &self->value.intval,
- extra_literals, set_doc,
- show_doc, help_doc, set_func,
- show_func, set_list, show_list);
+ commands
+ = add_setshow_pinteger_cmd (cmd_name, cmd_class, &self->value.intval,
+ extra_literals, set_doc, show_doc,
+ help_doc, set_func, show_func, set_list,
+ show_list);
break;
case var_string:
- commands = add_setshow_string_cmd (cmd_name, cmd_class,
- self->value.stringval, set_doc,
- show_doc, help_doc, set_func,
- show_func, set_list, show_list);
+ commands
+ = add_setshow_string_cmd (cmd_name, cmd_class, self->value.stringval,
+ set_doc, show_doc, help_doc, set_func,
+ show_func, set_list, show_list);
break;
case var_string_noescape:
- commands = add_setshow_string_noescape_cmd (cmd_name, cmd_class,
- self->value.stringval,
- set_doc, show_doc, help_doc,
- set_func, show_func, set_list,
- show_list);
+ commands
+ = add_setshow_string_noescape_cmd (cmd_name, cmd_class,
+ self->value.stringval, set_doc,
+ show_doc, help_doc, set_func,
+ show_func, set_list, show_list);
break;
case var_optional_filename:
- commands = add_setshow_optional_filename_cmd (cmd_name, cmd_class,
- self->value.stringval,
- set_doc, show_doc, help_doc,
- set_func, show_func,
- set_list, show_list);
+ commands
+ = add_setshow_optional_filename_cmd (cmd_name, cmd_class,
+ self->value.stringval, set_doc,
+ show_doc, help_doc, set_func,
+ show_func, set_list, show_list);
break;
case var_filename:
- commands = add_setshow_filename_cmd (cmd_name, cmd_class,
- self->value.stringval, set_doc,
- show_doc, help_doc, set_func,
- show_func, set_list, show_list);
+ commands
+ = add_setshow_filename_cmd (cmd_name, cmd_class, self->value.stringval,
+ set_doc, show_doc, help_doc, set_func,
+ show_func, set_list, show_list);
break;
case var_enum:
@@ -529,21 +523,21 @@ add_setshow_generic (enum var_types param_type,
Throws an exception if there's a problem with the values.
Space for the result is allocated from the GC heap. */
-static const char * const *
+static const char *const *
compute_enum_list (SCM enum_values_scm, int arg_pos, const char *func_name)
{
long i, size;
char **enum_values;
- const char * const *result;
+ const char *const *result;
SCM_ASSERT_TYPE (gdbscm_is_true (scm_list_p (enum_values_scm)),
- enum_values_scm, arg_pos, func_name, _("list"));
+ enum_values_scm, arg_pos, func_name, _ ("list"));
size = scm_ilength (enum_values_scm);
if (size == 0)
{
gdbscm_out_of_range_error (FUNC_NAME, arg_pos, enum_values_scm,
- _("enumeration list is empty"));
+ _ ("enumeration list is empty"));
}
enum_values = XCNEWVEC (char *, size + 1);
@@ -557,10 +551,10 @@ compute_enum_list (SCM enum_values_scm, int arg_pos, const char *func_name)
if (!scm_is_string (value))
{
freeargv (enum_values);
- SCM_ASSERT_TYPE (0, value, arg_pos, func_name, _("string"));
+ SCM_ASSERT_TYPE (0, value, arg_pos, func_name, _ ("string"));
}
- enum_values[i] = gdbscm_scm_to_host_string (value, NULL,
- &exception).release ();
+ enum_values[i]
+ = gdbscm_scm_to_host_string (value, NULL, &exception).release ();
if (enum_values[i] == NULL)
{
freeargv (enum_values);
@@ -576,22 +570,20 @@ compute_enum_list (SCM enum_values_scm, int arg_pos, const char *func_name)
return result;
}
-static const scheme_integer_constant parameter_types[] =
-{
- { "PARAM_BOOLEAN", param_boolean }, /* ARI: param_boolean */
- { "PARAM_AUTO_BOOLEAN", param_auto_boolean },
- { "PARAM_ZINTEGER", param_zinteger },
- { "PARAM_UINTEGER", param_uinteger },
- { "PARAM_ZUINTEGER", param_zuinteger },
- { "PARAM_ZUINTEGER_UNLIMITED", param_zuinteger_unlimited },
- { "PARAM_STRING", param_string },
- { "PARAM_STRING_NOESCAPE", param_string_noescape },
- { "PARAM_OPTIONAL_FILENAME", param_optional_filename },
- { "PARAM_FILENAME", param_filename },
- { "PARAM_ENUM", param_enum },
-
- END_INTEGER_CONSTANTS
-};
+static const scheme_integer_constant parameter_types[]
+ = { { "PARAM_BOOLEAN", param_boolean }, /* ARI: param_boolean */
+ { "PARAM_AUTO_BOOLEAN", param_auto_boolean },
+ { "PARAM_ZINTEGER", param_zinteger },
+ { "PARAM_UINTEGER", param_uinteger },
+ { "PARAM_ZUINTEGER", param_zuinteger },
+ { "PARAM_ZUINTEGER_UNLIMITED", param_zuinteger_unlimited },
+ { "PARAM_STRING", param_string },
+ { "PARAM_STRING_NOESCAPE", param_string_noescape },
+ { "PARAM_OPTIONAL_FILENAME", param_optional_filename },
+ { "PARAM_FILENAME", param_filename },
+ { "PARAM_ENUM", param_enum },
+
+ END_INTEGER_CONSTANTS };
/* Return non-zero if PARAM_TYPE is a valid parameter type. */
@@ -675,15 +667,13 @@ pascm_param_value (const setting &var, int arg_pos, const char *func_name)
case var_integer:
case var_pinteger:
{
- LONGEST value
- = (var.type () == var_uinteger
- ? static_cast<LONGEST> (var.get<unsigned int> ())
- : static_cast<LONGEST> (var.get<int> ()));
+ LONGEST value = (var.type () == var_uinteger
+ ? static_cast<LONGEST> (var.get<unsigned int> ())
+ : static_cast<LONGEST> (var.get<int> ()));
if (var.extra_literals () != nullptr)
for (const literal_def *l = var.extra_literals ();
- l->literal != nullptr;
- l++)
+ l->literal != nullptr; l++)
if (value == l->use)
return scm_from_latin1_keyword (l->literal);
if (var.type () == var_pinteger)
@@ -701,7 +691,7 @@ pascm_param_value (const setting &var, int arg_pos, const char *func_name)
return gdbscm_make_out_of_range_error (func_name, arg_pos,
scm_from_int (var.type ()),
- _("program error: unhandled type"));
+ _ ("program error: unhandled type"));
}
/* Set the value of a parameter of type P_SMOB->TYPE in P_SMOB->VAR from VALUE.
@@ -709,8 +699,7 @@ pascm_param_value (const setting &var, int arg_pos, const char *func_name)
Throws a Scheme exception if VALUE_SCM is invalid for TYPE. */
static void
-pascm_set_param_value_x (param_smob *p_smob,
- const char * const *enumeration,
+pascm_set_param_value_x (param_smob *p_smob, const char *const *enumeration,
SCM value, int arg_pos, const char *func_name)
{
setting var = make_setting (p_smob);
@@ -722,10 +711,10 @@ pascm_set_param_value_x (param_smob *p_smob,
case var_optional_filename:
case var_filename:
SCM_ASSERT_TYPE (scm_is_string (value)
- || (var.type () != var_filename
- && gdbscm_is_false (value)),
+ || (var.type () != var_filename
+ && gdbscm_is_false (value)),
value, arg_pos, func_name,
- _("string or #f for non-PARAM_FILENAME parameters"));
+ _ ("string or #f for non-PARAM_FILENAME parameters"));
if (gdbscm_is_false (value))
var.set<std::string> ("");
else
@@ -746,7 +735,7 @@ pascm_set_param_value_x (param_smob *p_smob,
SCM exception;
SCM_ASSERT_TYPE (scm_is_string (value), value, arg_pos, func_name,
- _("string"));
+ _ ("string"));
gdb::unique_xmalloc_ptr<char> str
= gdbscm_scm_to_host_string (value, nullptr, &exception);
if (str == nullptr)
@@ -759,7 +748,7 @@ pascm_set_param_value_x (param_smob *p_smob,
if (enumeration[i] == nullptr)
{
gdbscm_out_of_range_error (func_name, arg_pos, value,
- _("not member of enumeration"));
+ _ ("not member of enumeration"));
}
var.set<const char *> (enumeration[i]);
break;
@@ -767,15 +756,14 @@ pascm_set_param_value_x (param_smob *p_smob,
case var_boolean:
SCM_ASSERT_TYPE (gdbscm_is_bool (value), value, arg_pos, func_name,
- _("boolean"));
+ _ ("boolean"));
var.set<bool> (gdbscm_is_true (value));
break;
case var_auto_boolean:
SCM_ASSERT_TYPE (gdbscm_is_bool (value)
- || scm_is_eq (value, auto_keyword),
- value, arg_pos, func_name,
- _("boolean or #:auto"));
+ || scm_is_eq (value, auto_keyword),
+ value, arg_pos, func_name, _ ("boolean or #:auto"));
if (scm_is_eq (value, auto_keyword))
var.set<enum auto_boolean> (AUTO_BOOLEAN_AUTO);
else if (gdbscm_is_true (value))
@@ -798,17 +786,14 @@ pascm_set_param_value_x (param_smob *p_smob,
LONGEST val;
if (extra_literals != nullptr)
- for (const literal_def *l = extra_literals;
- l->literal != nullptr;
+ for (const literal_def *l = extra_literals; l->literal != nullptr;
l++, count++)
{
if (count != 0)
buffer += ", ";
buffer = buffer + "#:" + l->literal;
- if (keyword
- && allowed == TRIBOOL_UNKNOWN
- && scm_is_eq (value,
- scm_from_latin1_keyword (l->literal)))
+ if (keyword && allowed == TRIBOOL_UNKNOWN
+ && scm_is_eq (value, scm_from_latin1_keyword (l->literal)))
{
val = l->use;
allowed = TRIBOOL_TRUE;
@@ -819,24 +804,24 @@ pascm_set_param_value_x (param_smob *p_smob,
{
if (extra_literals == nullptr)
SCM_ASSERT_TYPE (integer, value, arg_pos, func_name,
- _("integer"));
+ _ ("integer"));
else if (count > 1)
SCM_ASSERT_TYPE (integer, value, arg_pos, func_name,
- string_printf (_("integer or one of: %s"),
- buffer.c_str ()).c_str ());
+ string_printf (_ ("integer or one of: %s"),
+ buffer.c_str ())
+ .c_str ());
else
- SCM_ASSERT_TYPE (integer, value, arg_pos, func_name,
- string_printf (_("integer or %s"),
- buffer.c_str ()).c_str ());
+ SCM_ASSERT_TYPE (
+ integer, value, arg_pos, func_name,
+ string_printf (_ ("integer or %s"), buffer.c_str ()).c_str ());
val = (var_type == var_uinteger
- ? static_cast<LONGEST> (scm_to_uint (value))
- : static_cast<LONGEST> (scm_to_int (value)));
+ ? static_cast<LONGEST> (scm_to_uint (value))
+ : static_cast<LONGEST> (scm_to_int (value)));
if (extra_literals != nullptr)
for (const literal_def *l = extra_literals;
- l->literal != nullptr;
- l++)
+ l->literal != nullptr; l++)
{
if (l->val.has_value () && val == *l->val)
{
@@ -847,7 +832,7 @@ pascm_set_param_value_x (param_smob *p_smob,
else if (val == l->use)
allowed = TRIBOOL_FALSE;
}
- }
+ }
if (allowed == TRIBOOL_UNKNOWN)
{
@@ -860,7 +845,7 @@ pascm_set_param_value_x (param_smob *p_smob,
}
if (allowed == TRIBOOL_FALSE)
gdbscm_out_of_range_error (func_name, arg_pos, value,
- _("integer out of range"));
+ _ ("integer out of range"));
if (var_type == var_uinteger)
var.set<unsigned int> (static_cast<unsigned int> (val));
@@ -889,7 +874,7 @@ pascm_free_parameter_smob (SCM self)
return 0;
}
-
+
/* Parameter Scheme functions. */
/* (make-parameter name
@@ -932,12 +917,11 @@ pascm_free_parameter_smob (SCM self)
static SCM
gdbscm_make_parameter (SCM name_scm, SCM rest)
{
- const SCM keywords[] = {
- command_class_keyword, parameter_type_keyword, enum_list_keyword,
- set_func_keyword, show_func_keyword,
- doc_keyword, set_doc_keyword, show_doc_keyword,
- initial_value_keyword, SCM_BOOL_F
- };
+ const SCM keywords[] = { command_class_keyword, parameter_type_keyword,
+ enum_list_keyword, set_func_keyword,
+ show_func_keyword, doc_keyword,
+ set_doc_keyword, show_doc_keyword,
+ initial_value_keyword, SCM_BOOL_F };
int cmd_class_arg_pos = -1, param_type_arg_pos = -1;
int enum_list_arg_pos = -1, set_func_arg_pos = -1, show_func_arg_pos = -1;
int doc_arg_pos = -1, set_doc_arg_pos = -1, show_doc_arg_pos = -1;
@@ -950,20 +934,17 @@ gdbscm_make_parameter (SCM name_scm, SCM rest)
SCM set_func = SCM_BOOL_F, show_func = SCM_BOOL_F;
char *doc = NULL, *set_doc = NULL, *show_doc = NULL;
SCM initial_value_scm = SCM_BOOL_F;
- const char * const *enum_list = NULL;
+ const char *const *enum_list = NULL;
SCM p_scm;
param_smob *p_smob;
gdbscm_parse_function_args (FUNC_NAME, SCM_ARG1, keywords, "s#iiOOOsssO",
- name_scm, &name, rest,
- &cmd_class_arg_pos, &cmd_class,
- &param_type_arg_pos, &param_type,
+ name_scm, &name, rest, &cmd_class_arg_pos,
+ &cmd_class, &param_type_arg_pos, &param_type,
&enum_list_arg_pos, &enum_list_scm,
- &set_func_arg_pos, &set_func,
- &show_func_arg_pos, &show_func,
- &doc_arg_pos, &doc,
- &set_doc_arg_pos, &set_doc,
- &show_doc_arg_pos, &show_doc,
+ &set_func_arg_pos, &set_func, &show_func_arg_pos,
+ &show_func, &doc_arg_pos, &doc, &set_doc_arg_pos,
+ &set_doc, &show_doc_arg_pos, &show_doc,
&initial_value_arg_pos, &initial_value_scm);
/* If doc is NULL, leave it NULL. See add_setshow_cmd_full. */
@@ -992,40 +973,41 @@ gdbscm_make_parameter (SCM name_scm, SCM rest)
{
gdbscm_out_of_range_error (FUNC_NAME, cmd_class_arg_pos,
scm_from_int (cmd_class),
- _("invalid command class argument"));
+ _ ("invalid command class argument"));
}
if (!pascm_valid_parameter_type_p (param_type))
{
gdbscm_out_of_range_error (FUNC_NAME, param_type_arg_pos,
scm_from_int (param_type),
- _("invalid parameter type argument"));
+ _ ("invalid parameter type argument"));
}
if (enum_list_arg_pos > 0 && param_type != param_enum)
{
- gdbscm_misc_error (FUNC_NAME, enum_list_arg_pos, enum_list_scm,
- _("#:enum-values can only be provided with PARAM_ENUM"));
+ gdbscm_misc_error (
+ FUNC_NAME, enum_list_arg_pos, enum_list_scm,
+ _ ("#:enum-values can only be provided with PARAM_ENUM"));
}
if (enum_list_arg_pos < 0 && param_type == param_enum)
{
gdbscm_misc_error (FUNC_NAME, GDBSCM_ARG_NONE, SCM_BOOL_F,
- _("PARAM_ENUM requires an enum-values argument"));
+ _ ("PARAM_ENUM requires an enum-values argument"));
}
if (set_func_arg_pos > 0)
{
SCM_ASSERT_TYPE (gdbscm_is_procedure (set_func), set_func,
- set_func_arg_pos, FUNC_NAME, _("procedure"));
+ set_func_arg_pos, FUNC_NAME, _ ("procedure"));
}
if (show_func_arg_pos > 0)
{
SCM_ASSERT_TYPE (gdbscm_is_procedure (show_func), show_func,
- show_func_arg_pos, FUNC_NAME, _("procedure"));
+ show_func_arg_pos, FUNC_NAME, _ ("procedure"));
}
if (param_type == param_enum)
{
/* Note: enum_list lives in GC space, so we don't have to worry about
freeing it if we later throw an exception. */
- enum_list = compute_enum_list (enum_list_scm, enum_list_arg_pos,
- FUNC_NAME);
+ enum_list
+ = compute_enum_list (enum_list_scm, enum_list_arg_pos, FUNC_NAME);
}
/* If initial-value is a function, we need the parameter object constructed
@@ -1056,13 +1038,13 @@ gdbscm_make_parameter (SCM name_scm, SCM rest)
{
if (gdbscm_is_procedure (initial_value_scm))
{
- initial_value_scm = gdbscm_safe_call_1 (initial_value_scm,
- p_smob->containing_scm, NULL);
+ initial_value_scm
+ = gdbscm_safe_call_1 (initial_value_scm, p_smob->containing_scm,
+ NULL);
if (gdbscm_is_exception (initial_value_scm))
gdbscm_throw (initial_value_scm);
}
- pascm_set_param_value_x (p_smob, enum_list,
- initial_value_scm,
+ pascm_set_param_value_x (p_smob, enum_list, initial_value_scm,
initial_value_arg_pos, FUNC_NAME);
}
@@ -1096,7 +1078,7 @@ gdbscm_register_parameter_x (SCM self)
struct cmd_list_element **set_list, **show_list;
if (pascm_is_valid (p_smob))
- scm_misc_error (FUNC_NAME, _("parameter is already registered"), SCM_EOL);
+ scm_misc_error (FUNC_NAME, _ ("parameter is already registered"), SCM_EOL);
cmd_name = gdbscm_parse_command_name (p_smob->name, FUNC_NAME, SCM_ARG1,
&set_list, &setlist);
@@ -1108,25 +1090,27 @@ gdbscm_register_parameter_x (SCM self)
if (pascm_parameter_defined_p (p_smob->cmd_name, *set_list))
{
- gdbscm_misc_error (FUNC_NAME, SCM_ARG1, self,
- _("parameter exists, \"set\" command is already defined"));
+ gdbscm_misc_error (
+ FUNC_NAME, SCM_ARG1, self,
+ _ ("parameter exists, \"set\" command is already defined"));
}
if (pascm_parameter_defined_p (p_smob->cmd_name, *show_list))
{
- gdbscm_misc_error (FUNC_NAME, SCM_ARG1, self,
- _("parameter exists, \"show\" command is already defined"));
+ gdbscm_misc_error (
+ FUNC_NAME, SCM_ARG1, self,
+ _ ("parameter exists, \"show\" command is already defined"));
}
gdbscm_gdb_exception exc {};
try
{
- p_smob->commands = add_setshow_generic
- (p_smob->type, p_smob->extra_literals,
- p_smob->cmd_class, p_smob->cmd_name, p_smob,
- p_smob->set_doc, p_smob->show_doc, p_smob->doc,
- (gdbscm_is_procedure (p_smob->set_func) ? pascm_set_func : NULL),
- (gdbscm_is_procedure (p_smob->show_func) ? pascm_show_func : NULL),
- set_list, show_list);
+ p_smob->commands = add_setshow_generic (
+ p_smob->type, p_smob->extra_literals, p_smob->cmd_class,
+ p_smob->cmd_name, p_smob, p_smob->set_doc, p_smob->show_doc,
+ p_smob->doc,
+ (gdbscm_is_procedure (p_smob->set_func) ? pascm_set_func : NULL),
+ (gdbscm_is_procedure (p_smob->show_func) ? pascm_show_func : NULL),
+ set_list, show_list);
}
catch (const gdb_exception &except)
{
@@ -1150,13 +1134,13 @@ gdbscm_register_parameter_x (SCM self)
static SCM
gdbscm_parameter_value (SCM self)
{
- SCM_ASSERT_TYPE (pascm_is_parameter (self) || scm_is_string (self),
- self, SCM_ARG1, FUNC_NAME, _("<gdb:parameter> or string"));
+ SCM_ASSERT_TYPE (pascm_is_parameter (self) || scm_is_string (self), self,
+ SCM_ARG1, FUNC_NAME, _ ("<gdb:parameter> or string"));
if (pascm_is_parameter (self))
{
- param_smob *p_smob = pascm_get_param_smob_arg_unsafe (self, SCM_ARG1,
- FUNC_NAME);
+ param_smob *p_smob
+ = pascm_get_param_smob_arg_unsafe (self, SCM_ARG1, FUNC_NAME);
return pascm_param_value (make_setting (p_smob), SCM_ARG1, FUNC_NAME);
}
@@ -1187,13 +1171,13 @@ gdbscm_parameter_value (SCM self)
if (!found)
{
gdbscm_out_of_range_error (FUNC_NAME, SCM_ARG1, self,
- _("parameter not found"));
+ _ ("parameter not found"));
}
if (!cmd->var.has_value ())
{
gdbscm_out_of_range_error (FUNC_NAME, SCM_ARG1, self,
- _("not a parameter"));
+ _ ("not a parameter"));
}
return pascm_param_value (*cmd->var, SCM_ARG1, FUNC_NAME);
@@ -1205,21 +1189,19 @@ gdbscm_parameter_value (SCM self)
static SCM
gdbscm_set_parameter_value_x (SCM self, SCM value)
{
- param_smob *p_smob = pascm_get_param_smob_arg_unsafe (self, SCM_ARG1,
- FUNC_NAME);
+ param_smob *p_smob
+ = pascm_get_param_smob_arg_unsafe (self, SCM_ARG1, FUNC_NAME);
- pascm_set_param_value_x (p_smob, p_smob->enumeration,
- value, SCM_ARG2, FUNC_NAME);
+ pascm_set_param_value_x (p_smob, p_smob->enumeration, value, SCM_ARG2,
+ FUNC_NAME);
return SCM_UNSPECIFIED;
}
-
+
/* Initialize the Scheme parameter support. */
-static const scheme_function parameter_functions[] =
-{
- { "make-parameter", 1, 0, 1, as_a_scm_t_subr (gdbscm_make_parameter),
- "\
+static const scheme_function parameter_functions[]
+ = { { "make-parameter", 1, 0, 1, as_a_scm_t_subr (gdbscm_make_parameter), "\
Make a GDB parameter object.\n\
\n\
Arguments: name\n\
@@ -1250,29 +1232,25 @@ Make a GDB parameter object.\n\
show-doc: The \"doc string\" when showing the parameter.\n\
initial-value: The initial value of the parameter." },
- { "register-parameter!", 1, 0, 0,
- as_a_scm_t_subr (gdbscm_register_parameter_x),
- "\
+ { "register-parameter!", 1, 0, 0,
+ as_a_scm_t_subr (gdbscm_register_parameter_x), "\
Register a <gdb:parameter> object with GDB." },
- { "parameter?", 1, 0, 0, as_a_scm_t_subr (gdbscm_parameter_p),
- "\
+ { "parameter?", 1, 0, 0, as_a_scm_t_subr (gdbscm_parameter_p), "\
Return #t if the object is a <gdb:parameter> object." },
- { "parameter-value", 1, 0, 0, as_a_scm_t_subr (gdbscm_parameter_value),
- "\
+ { "parameter-value", 1, 0, 0, as_a_scm_t_subr (gdbscm_parameter_value),
+ "\
Return the value of a <gdb:parameter> object\n\
or any gdb parameter if param is a string naming the parameter." },
- { "set-parameter-value!", 2, 0, 0,
- as_a_scm_t_subr (gdbscm_set_parameter_value_x),
- "\
+ { "set-parameter-value!", 2, 0, 0,
+ as_a_scm_t_subr (gdbscm_set_parameter_value_x), "\
Set the value of a <gdb:parameter> object.\n\
\n\
Arguments: <gdb:parameter> value" },
- END_FUNCTIONS
-};
+ END_FUNCTIONS };
void
gdbscm_initialize_parameters (void)
diff --git a/gdb/guile/scm-ports.c b/gdb/guile/scm-ports.c
index 48b60759234..94f7226ef72 100644
--- a/gdb/guile/scm-ports.c
+++ b/gdb/guile/scm-ports.c
@@ -29,24 +29,24 @@
#include "gdbsupport/gdb_optional.h"
#ifdef HAVE_POLL
-#if defined (HAVE_POLL_H)
+#if defined(HAVE_POLL_H)
#include <poll.h>
-#elif defined (HAVE_SYS_POLL_H)
+#elif defined(HAVE_SYS_POLL_H)
#include <sys/poll.h>
#endif
#endif
/* Whether we're using Guile < 2.2 and its clumsy port API. */
-#define USING_GUILE_BEFORE_2_2 \
+#define USING_GUILE_BEFORE_2_2 \
(SCM_MAJOR_VERSION == 2 && SCM_MINOR_VERSION == 0)
-
/* A ui-file for sending output to Guile. */
class ioscm_file_port : public ui_file
{
public:
+
/* Return a ui_file that writes to PORT. */
explicit ioscm_file_port (SCM port);
@@ -54,6 +54,7 @@ public:
void write (const char *buf, long length_buf) override;
private:
+
SCM m_port;
};
@@ -111,7 +112,11 @@ static SCM output_port_scm;
static SCM error_port_scm;
/* Internal enum for specifying output port. */
-enum oport { GDB_STDOUT, GDB_STDERR };
+enum oport
+{
+ GDB_STDOUT,
+ GDB_STDERR
+};
/* This is the memory port descriptor, scm_ptob_descriptor. */
#if USING_GUILE_BEFORE_2_2
@@ -152,7 +157,7 @@ static const unsigned natural_buf_size = 16;
static SCM mode_keyword;
static SCM start_keyword;
static SCM size_keyword;
-
+
/* Helper to do the low level work of opening a port. */
#if USING_GUILE_BEFORE_2_2
@@ -188,7 +193,6 @@ ioscm_open_port (scm_t_port_type *port_type, long mode_bits, scm_t_bits stream)
#endif
-
/* Support for connecting Guile's stdio ports to GDB's stdio ports. */
/* Print a string S, length SIZE, but don't escape characters, except
@@ -218,7 +222,7 @@ ioscm_input_waiting (SCM port)
{
int fdes = 0;
- if (! scm_is_eq (port, input_port_scm))
+ if (!scm_is_eq (port, input_port_scm))
return 0;
#ifdef HAVE_POLL
@@ -262,9 +266,8 @@ ioscm_input_waiting (SCM port)
FD_ZERO (&input_fds);
FD_SET (fdes, &input_fds);
- num_found = interruptible_select (num_fds,
- &input_fds, NULL, NULL,
- &timeout);
+ num_found
+ = interruptible_select (num_fds, &input_fds, NULL, NULL, &timeout);
if (num_found < 0)
{
/* Guile doesn't export SIGINT hooks like Python does.
@@ -285,7 +288,7 @@ ioscm_fill_input (SCM port)
scm_t_port *pt = SCM_PTAB_ENTRY (port);
/* If we're called on stdout,stderr, punt. */
- if (! scm_is_eq (port, input_port_scm))
+ if (!scm_is_eq (port, input_port_scm))
return (scm_t_wchar) EOF; /* Set errno and return -1? */
gdb_flush (gdb_stdout);
@@ -307,7 +310,6 @@ ioscm_fill_input (SCM port)
static void
ioscm_write (SCM port, const void *data, size_t size)
{
-
/* If we're called on stdin, punt. */
if (scm_is_eq (port, input_port_scm))
return;
@@ -354,7 +356,7 @@ ioscm_read_from_port (SCM port, SCM dst, size_t start, size_t count)
char *read_buf;
/* If we're called on stdout,stderr, punt. */
- if (! scm_is_eq (port, input_port_scm))
+ if (!scm_is_eq (port, input_port_scm))
return 0;
gdb_flush (gdb_stdout);
@@ -534,7 +536,7 @@ gdbscm_stdio_port_p (SCM scm)
&& (SCM_PORT_TYPE (scm) == stdio_port_desc));
#endif
}
-
+
/* GDB's ports are accessed via functions to keep them read-only. */
/* (input-port) -> port */
@@ -560,12 +562,13 @@ gdbscm_error_port (void)
{
return error_port_scm;
}
-
+
/* Support for sending GDB I/O to Guile ports. */
ioscm_file_port::ioscm_file_port (SCM port)
: m_port (port)
-{}
+{
+}
void
ioscm_file_port::flush ()
@@ -578,7 +581,6 @@ ioscm_file_port::write (const char *buffer, long length_buffer)
scm_c_write (m_port, buffer, length_buffer);
}
-
/* Helper routine for with-{output,error}-to-port. */
static SCM
@@ -587,10 +589,10 @@ ioscm_with_output_to_port_worker (SCM port, SCM thunk, enum oport oport,
{
SCM result;
- SCM_ASSERT_TYPE (gdbscm_is_true (scm_output_port_p (port)), port,
- SCM_ARG1, func_name, _("output port"));
- SCM_ASSERT_TYPE (gdbscm_is_true (scm_thunk_p (thunk)), thunk,
- SCM_ARG2, func_name, _("thunk"));
+ SCM_ASSERT_TYPE (gdbscm_is_true (scm_output_port_p (port)), port, SCM_ARG1,
+ func_name, _ ("output port"));
+ SCM_ASSERT_TYPE (gdbscm_is_true (scm_thunk_p (thunk)), thunk, SCM_ARG2,
+ func_name, _ ("thunk"));
set_batch_flag_and_restore_page_info save_page_info;
@@ -598,8 +600,8 @@ ioscm_with_output_to_port_worker (SCM port, SCM thunk, enum oport oport,
ui_file_up port_file (new ioscm_file_port (port));
- scoped_restore save_file = make_scoped_restore (oport == GDB_STDERR
- ? &gdb_stderr : &gdb_stdout);
+ scoped_restore save_file
+ = make_scoped_restore (oport == GDB_STDERR ? &gdb_stderr : &gdb_stdout);
{
gdb::optional<ui_out_redirect_pop> redirect_popper;
@@ -650,7 +652,7 @@ gdbscm_percent_with_gdb_error_to_port (SCM port, SCM thunk)
{
return ioscm_with_output_to_port_worker (port, thunk, GDB_STDERR, FUNC_NAME);
}
-
+
/* Support for r/w memory via ports. */
/* Perform an "lseek" to OFFSET,WHENCE on memory port IOMEM.
@@ -715,9 +717,9 @@ gdbscm_memory_port_fill_input (SCM port)
if (to_read > iomem->size - iomem->current)
to_read = iomem->size - iomem->current;
- if (target_read_memory (iomem->start + iomem->current, pt->read_buf,
- to_read) != 0)
- gdbscm_memory_error (FUNC_NAME, _("error reading memory"), SCM_EOL);
+ if (target_read_memory (iomem->start + iomem->current, pt->read_buf, to_read)
+ != 0)
+ gdbscm_memory_error (FUNC_NAME, _ ("error reading memory"), SCM_EOL);
iomem->current += to_read;
pt->read_pos = pt->read_buf;
@@ -740,7 +742,7 @@ gdbscm_memory_port_end_input (SCM port, int offset)
|| (offset > 0 && remaining + offset < remaining))
{
gdbscm_out_of_range_error (FUNC_NAME, 0, scm_from_int (offset),
- _("overflow in offset calculation"));
+ _ ("overflow in offset calculation"));
}
offset += remaining;
@@ -752,7 +754,7 @@ gdbscm_memory_port_end_input (SCM port, int offset)
if (!ioscm_lseek_address (iomem, -offset, SEEK_CUR))
{
gdbscm_out_of_range_error (FUNC_NAME, 0, scm_from_int (offset),
- _("bad offset"));
+ _ ("bad offset"));
}
}
@@ -777,12 +779,13 @@ gdbscm_memory_port_flush (SCM port)
{
gdbscm_out_of_range_error (FUNC_NAME, 0,
gdbscm_scm_from_ulongest (to_write),
- _("writing beyond end of memory range"));
+ _ ("writing beyond end of memory range"));
}
if (target_write_memory (iomem->start + iomem->current, pt->write_buf,
- to_write) != 0)
- gdbscm_memory_error (FUNC_NAME, _("error writing memory"), SCM_EOL);
+ to_write)
+ != 0)
+ gdbscm_memory_error (FUNC_NAME, _ ("error writing memory"), SCM_EOL);
iomem->current += to_write;
pt->write_pos = pt->write_buf;
@@ -815,8 +818,7 @@ gdbscm_memory_port_seek (SCM port, scm_t_off offset, int whence)
CORE_ADDR current = iomem->current;
size_t delta = pt->write_pos - pt->write_buf;
- if (current + delta < current
- || current + delta > iomem->size)
+ if (current + delta < current || current + delta > iomem->size)
rc = 0;
else
{
@@ -871,7 +873,7 @@ gdbscm_memory_port_seek (SCM port, scm_t_off offset, int whence)
{
gdbscm_out_of_range_error (FUNC_NAME, 0,
gdbscm_scm_from_longest (offset),
- _("bad seek"));
+ _ ("bad seek"));
}
/* TODO: The Guile API doesn't support 32x64. We can't fix that here,
@@ -895,14 +897,14 @@ gdbscm_memory_port_write (SCM port, const void *void_data, size_t size)
if (size > iomem->size - iomem->current)
{
gdbscm_out_of_range_error (FUNC_NAME, 0, gdbscm_scm_from_ulongest (size),
- _("writing beyond end of memory range"));
+ _ ("writing beyond end of memory range"));
}
if (pt->write_buf == &pt->shortbuf)
{
/* Unbuffered port. */
if (target_write_memory (iomem->start + iomem->current, data, size) != 0)
- gdbscm_memory_error (FUNC_NAME, _("error writing memory"), SCM_EOL);
+ gdbscm_memory_error (FUNC_NAME, _ ("error writing memory"), SCM_EOL);
iomem->current += size;
return;
}
@@ -933,8 +935,9 @@ gdbscm_memory_port_write (SCM port, const void *void_data, size_t size)
if (remaining >= pt->write_buf_size)
{
if (target_write_memory (iomem->start + iomem->current, ptr,
- remaining) != 0)
- gdbscm_memory_error (FUNC_NAME, _("error writing memory"),
+ remaining)
+ != 0)
+ gdbscm_memory_error (FUNC_NAME, _ ("error writing memory"),
SCM_EOL);
iomem->current += remaining;
}
@@ -1002,23 +1005,21 @@ ioscm_reinit_memory_port (SCM port, size_t read_buf_size,
if (pt->read_buf == &pt->shortbuf)
{
gdb_assert (pt->write_buf == &pt->shortbuf);
- scm_misc_error (func_name, _("port is unbuffered: ~a"),
+ scm_misc_error (func_name, _ ("port is unbuffered: ~a"),
scm_list_1 (port));
}
/* Next check if anything is buffered. */
- if (read_buf_size != pt->read_buf_size
- && pt->read_end != pt->read_buf)
+ if (read_buf_size != pt->read_buf_size && pt->read_end != pt->read_buf)
{
- scm_misc_error (func_name, _("read buffer not empty: ~a"),
+ scm_misc_error (func_name, _ ("read buffer not empty: ~a"),
scm_list_1 (port));
}
- if (write_buf_size != pt->write_buf_size
- && pt->write_pos != pt->write_buf)
+ if (write_buf_size != pt->write_buf_size && pt->write_pos != pt->write_buf)
{
- scm_misc_error (func_name, _("write buffer not empty: ~a"),
+ scm_misc_error (func_name, _ ("write buffer not empty: ~a"),
scm_list_1 (port));
}
@@ -1080,9 +1081,8 @@ gdbscm_memory_port_read (SCM port, SCM dst, size_t start, size_t count)
count = iomem->size - iomem->current;
read_buf = (gdb_byte *) SCM_BYTEVECTOR_CONTENTS (dst) + start;
- if (target_read_memory (iomem->start + iomem->current, read_buf,
- count) != 0)
- gdbscm_memory_error (FUNC_NAME, _("error reading memory"), SCM_EOL);
+ if (target_read_memory (iomem->start + iomem->current, read_buf, count) != 0)
+ gdbscm_memory_error (FUNC_NAME, _ ("error reading memory"), SCM_EOL);
iomem->current += count;
return count;
@@ -1092,19 +1092,17 @@ static size_t
gdbscm_memory_port_write (SCM port, SCM src, size_t start, size_t count)
{
ioscm_memory_port *iomem = (ioscm_memory_port *) SCM_STREAM (port);
- const gdb_byte *data =
- (const gdb_byte *) SCM_BYTEVECTOR_CONTENTS (src) + start;
+ const gdb_byte *data
+ = (const gdb_byte *) SCM_BYTEVECTOR_CONTENTS (src) + start;
/* If the request goes past the end of the port's memory range, flag an
error. */
if (count > iomem->size - iomem->current)
gdbscm_out_of_range_error (FUNC_NAME, 0, scm_from_size_t (count),
- _("writing beyond end of memory range"));
+ _ ("writing beyond end of memory range"));
- if (target_write_memory (iomem->start + iomem->current, data,
- count) != 0)
- gdbscm_memory_error (FUNC_NAME, _("error writing memory"),
- SCM_EOL);
+ if (target_write_memory (iomem->start + iomem->current, data, count) != 0)
+ gdbscm_memory_error (FUNC_NAME, _ ("error writing memory"), SCM_EOL);
iomem->current += count;
@@ -1119,9 +1117,8 @@ gdbscm_memory_port_seek (SCM port, scm_t_off offset, int whence)
rc = ioscm_lseek_address (iomem, offset, whence);
if (rc == 0)
- gdbscm_out_of_range_error (FUNC_NAME, 0,
- gdbscm_scm_from_longest (offset),
- _("bad seek"));
+ gdbscm_out_of_range_error (FUNC_NAME, 0, gdbscm_scm_from_longest (offset),
+ _ ("bad seek"));
/* TODO: The Guile API doesn't support 32x64. We can't fix that here,
and there's no need to throw an error if the new address can't be
@@ -1193,9 +1190,8 @@ ioscm_parse_mode_bits (const char *func_name, const char *mode)
if (*mode != 'r' && *mode != 'w')
{
- gdbscm_out_of_range_error (func_name, 0,
- gdbscm_scm_from_c_string (mode),
- _("bad mode string"));
+ gdbscm_out_of_range_error (func_name, 0, gdbscm_scm_from_c_string (mode),
+ _ ("bad mode string"));
}
for (p = mode + 1; *p != '\0'; ++p)
{
@@ -1208,7 +1204,7 @@ ioscm_parse_mode_bits (const char *func_name, const char *mode)
default:
gdbscm_out_of_range_error (func_name, 0,
gdbscm_scm_from_c_string (mode),
- _("bad mode string"));
+ _ ("bad mode string"));
}
}
@@ -1314,9 +1310,8 @@ ioscm_init_memory_port_buffers (SCM port)
static SCM
gdbscm_open_memory (SCM rest)
{
- const SCM keywords[] = {
- mode_keyword, start_keyword, size_keyword, SCM_BOOL_F
- };
+ const SCM keywords[]
+ = { mode_keyword, start_keyword, size_keyword, SCM_BOOL_F };
char *mode = NULL;
CORE_ADDR start = 0;
CORE_ADDR end;
@@ -1326,8 +1321,7 @@ gdbscm_open_memory (SCM rest)
long mode_bits;
gdbscm_parse_function_args (FUNC_NAME, SCM_ARG1, keywords, "#sUU", rest,
- &mode_arg_pos, &mode,
- &start_arg_pos, &start,
+ &mode_arg_pos, &mode, &start_arg_pos, &start,
&size_arg_pos, &size);
scm_dynwind_begin ((scm_t_dynwind_flags) 0);
@@ -1342,10 +1336,11 @@ gdbscm_open_memory (SCM rest)
a nuisance we can relax things later. */
if (start + size < start)
{
- gdbscm_out_of_range_error (FUNC_NAME, 0,
- scm_list_2 (gdbscm_scm_from_ulongest (start),
- gdbscm_scm_from_ulongest (size)),
- _("start+size overflows"));
+ gdbscm_out_of_range_error (
+ FUNC_NAME, 0,
+ scm_list_2 (gdbscm_scm_from_ulongest (start),
+ gdbscm_scm_from_ulongest (size)),
+ _ ("start+size overflows"));
}
end = start + size;
}
@@ -1361,8 +1356,7 @@ gdbscm_open_memory (SCM rest)
mode_bits |= SCM_BUF0;
auto stream = ioscm_init_memory_port_stream (start, end);
- port = ioscm_open_port (memory_port_desc, mode_bits,
- (scm_t_bits) stream);
+ port = ioscm_open_port (memory_port_desc, mode_bits, (scm_t_bits) stream);
#if USING_GUILE_BEFORE_2_2
ioscm_init_memory_port_buffers (port);
@@ -1440,7 +1434,7 @@ gdbscm_set_memory_port_read_buffer_size_x (SCM port, SCM size)
SCM_ASSERT_TYPE (gdbscm_is_memory_port (port), port, SCM_ARG1, FUNC_NAME,
memory_port_desc_name);
SCM_ASSERT_TYPE (scm_is_integer (size), size, SCM_ARG2, FUNC_NAME,
- _("integer"));
+ _ ("integer"));
if (!scm_is_unsigned_integer (size, min_memory_port_buf_size,
max_memory_port_buf_size))
@@ -1490,7 +1484,7 @@ gdbscm_set_memory_port_write_buffer_size_x (SCM port, SCM size)
SCM_ASSERT_TYPE (gdbscm_is_memory_port (port), port, SCM_ARG1, FUNC_NAME,
memory_port_desc_name);
SCM_ASSERT_TYPE (scm_is_integer (size), size, SCM_ARG2, FUNC_NAME,
- _("integer"));
+ _ ("integer"));
if (!scm_is_unsigned_integer (size, min_memory_port_buf_size,
max_memory_port_buf_size))
@@ -1508,73 +1502,60 @@ gdbscm_set_memory_port_write_buffer_size_x (SCM port, SCM size)
return scm_setvbuf (port, scm_from_utf8_symbol ("block"), size);
#endif
}
-
+
/* Initialize gdb ports. */
-static const scheme_function port_functions[] =
-{
- { "input-port", 0, 0, 0, as_a_scm_t_subr (gdbscm_input_port),
- "\
+static const scheme_function port_functions[]
+ = { { "input-port", 0, 0, 0, as_a_scm_t_subr (gdbscm_input_port), "\
Return gdb's input port." },
- { "output-port", 0, 0, 0, as_a_scm_t_subr (gdbscm_output_port),
- "\
+ { "output-port", 0, 0, 0, as_a_scm_t_subr (gdbscm_output_port), "\
Return gdb's output port." },
- { "error-port", 0, 0, 0, as_a_scm_t_subr (gdbscm_error_port),
- "\
+ { "error-port", 0, 0, 0, as_a_scm_t_subr (gdbscm_error_port), "\
Return gdb's error port." },
- { "stdio-port?", 1, 0, 0, as_a_scm_t_subr (gdbscm_stdio_port_p),
- "\
+ { "stdio-port?", 1, 0, 0, as_a_scm_t_subr (gdbscm_stdio_port_p), "\
Return #t if the object is a gdb:stdio-port." },
- { "open-memory", 0, 0, 1, as_a_scm_t_subr (gdbscm_open_memory),
- "\
+ { "open-memory", 0, 0, 1, as_a_scm_t_subr (gdbscm_open_memory), "\
Return a port that can be used for reading/writing inferior memory.\n\
\n\
Arguments: [#:mode string] [#:start address] [#:size integer]\n\
Returns: A port object." },
- { "memory-port?", 1, 0, 0, as_a_scm_t_subr (gdbscm_memory_port_p),
- "\
+ { "memory-port?", 1, 0, 0, as_a_scm_t_subr (gdbscm_memory_port_p), "\
Return #t if the object is a memory port." },
- { "memory-port-range", 1, 0, 0, as_a_scm_t_subr (gdbscm_memory_port_range),
- "\
+ { "memory-port-range", 1, 0, 0,
+ as_a_scm_t_subr (gdbscm_memory_port_range), "\
Return the memory range of the port as (start end)." },
- { "memory-port-read-buffer-size", 1, 0, 0,
- as_a_scm_t_subr (gdbscm_memory_port_read_buffer_size),
- "\
+ { "memory-port-read-buffer-size", 1, 0, 0,
+ as_a_scm_t_subr (gdbscm_memory_port_read_buffer_size), "\
Return the size of the read buffer for the memory port." },
- { "set-memory-port-read-buffer-size!", 2, 0, 0,
- as_a_scm_t_subr (gdbscm_set_memory_port_read_buffer_size_x),
- "\
+ { "set-memory-port-read-buffer-size!", 2, 0, 0,
+ as_a_scm_t_subr (gdbscm_set_memory_port_read_buffer_size_x), "\
Set the size of the read buffer for the memory port.\n\
\n\
Arguments: port integer\n\
Returns: unspecified." },
- { "memory-port-write-buffer-size", 1, 0, 0,
- as_a_scm_t_subr (gdbscm_memory_port_write_buffer_size),
- "\
+ { "memory-port-write-buffer-size", 1, 0, 0,
+ as_a_scm_t_subr (gdbscm_memory_port_write_buffer_size), "\
Return the size of the write buffer for the memory port." },
- { "set-memory-port-write-buffer-size!", 2, 0, 0,
- as_a_scm_t_subr (gdbscm_set_memory_port_write_buffer_size_x),
- "\
+ { "set-memory-port-write-buffer-size!", 2, 0, 0,
+ as_a_scm_t_subr (gdbscm_set_memory_port_write_buffer_size_x), "\
Set the size of the write buffer for the memory port.\n\
\n\
Arguments: port integer\n\
Returns: unspecified." },
- END_FUNCTIONS
-};
+ END_FUNCTIONS };
-static const scheme_function private_port_functions[] =
-{
+static const scheme_function private_port_functions[] = {
#if 0 /* TODO */
{ "%with-gdb-input-from-port", 2, 0, 0,
as_a_scm_t_subr (gdbscm_percent_with_gdb_input_from_port),
@@ -1588,8 +1569,7 @@ This procedure is experimental." },
#endif
{ "%with-gdb-output-to-port", 2, 0, 0,
- as_a_scm_t_subr (gdbscm_percent_with_gdb_output_to_port),
- "\
+ as_a_scm_t_subr (gdbscm_percent_with_gdb_output_to_port), "\
Temporarily set GDB's output port to PORT and then invoke THUNK.\n\
\n\
Arguments: port thunk\n\
@@ -1598,8 +1578,7 @@ Temporarily set GDB's output port to PORT and then invoke THUNK.\n\
This procedure is experimental." },
{ "%with-gdb-error-to-port", 2, 0, 0,
- as_a_scm_t_subr (gdbscm_percent_with_gdb_error_to_port),
- "\
+ as_a_scm_t_subr (gdbscm_percent_with_gdb_error_to_port), "\
Temporarily set GDB's error port to PORT and then invoke THUNK.\n\
\n\
Arguments: port thunk\n\
@@ -1644,8 +1623,8 @@ gdbscm_initialize_ports (void)
#if USING_GUILE_BEFORE_2_2
/* Error message text for "out of range" memory port buffer sizes. */
- out_of_range_buf_size = xstrprintf ("size not between %u - %u",
- min_memory_port_buf_size,
- max_memory_port_buf_size);
+ out_of_range_buf_size
+ = xstrprintf ("size not between %u - %u", min_memory_port_buf_size,
+ max_memory_port_buf_size);
#endif
}
diff --git a/gdb/guile/scm-pretty-print.c b/gdb/guile/scm-pretty-print.c
index cb6677c8831..a96591cc4f6 100644
--- a/gdb/guile/scm-pretty-print.c
+++ b/gdb/guile/scm-pretty-print.c
@@ -73,7 +73,7 @@ struct pretty_printer_smob
/* A procedure called to look up the printer for the given value.
The procedure is called as (lookup gdb:pretty-printer value).
The result should either be a gdb:pretty-printer object that will print
- the value, or #f if the value is not recognized. */
+ the value, or #f if the value is not recognized. */
SCM lookup;
/* Note: Attaching subprinters to this smob is left to Scheme. */
@@ -101,10 +101,9 @@ struct pretty_printer_worker_smob
SCM children;
};
-static const char pretty_printer_smob_name[] =
- "gdb:pretty-printer";
-static const char pretty_printer_worker_smob_name[] =
- "gdb:pretty-printer-worker";
+static const char pretty_printer_smob_name[] = "gdb:pretty-printer";
+static const char pretty_printer_worker_smob_name[]
+ = "gdb:pretty-printer-worker";
/* The tag Guile knows the pretty-printer smobs by. */
static scm_t_bits pretty_printer_smob_tag;
@@ -120,7 +119,7 @@ static SCM pp_type_error_symbol;
static SCM ppscm_map_string;
static SCM ppscm_array_string;
static SCM ppscm_string_string;
-
+
/* Administrivia for pretty-printer matcher smobs. */
/* The smob "print" function for <gdb:pretty-printer>. */
@@ -147,15 +146,15 @@ ppscm_print_pretty_printer_smob (SCM self, SCM port, scm_print_state *pstate)
static SCM
gdbscm_make_pretty_printer (SCM name, SCM lookup)
{
- pretty_printer_smob *pp_smob = (pretty_printer_smob *)
- scm_gc_malloc (sizeof (pretty_printer_smob),
- pretty_printer_smob_name);
+ pretty_printer_smob *pp_smob
+ = (pretty_printer_smob *) scm_gc_malloc (sizeof (pretty_printer_smob),
+ pretty_printer_smob_name);
SCM smob;
SCM_ASSERT_TYPE (scm_is_string (name), name, SCM_ARG1, FUNC_NAME,
- _("string"));
+ _ ("string"));
SCM_ASSERT_TYPE (gdbscm_is_procedure (lookup), lookup, SCM_ARG2, FUNC_NAME,
- _("procedure"));
+ _ ("procedure"));
pp_smob->name = name;
pp_smob->lookup = lookup;
@@ -208,7 +207,7 @@ ppscm_get_pretty_printer_smob_arg_unsafe (SCM self, int arg_pos,
return pp_smob;
}
-
+
/* Pretty-printer methods. */
/* (pretty-printer-enabled? <gdb:pretty-printer>) -> boolean */
@@ -251,14 +250,14 @@ gdbscm_pretty_printers (void)
static SCM
gdbscm_set_pretty_printers_x (SCM printers)
{
- SCM_ASSERT_TYPE (gdbscm_is_true (scm_list_p (printers)), printers,
- SCM_ARG1, FUNC_NAME, _("list"));
+ SCM_ASSERT_TYPE (gdbscm_is_true (scm_list_p (printers)), printers, SCM_ARG1,
+ FUNC_NAME, _ ("list"));
pretty_printer_list = printers;
return SCM_UNSPECIFIED;
}
-
+
/* Administrivia for pretty-printer-worker smobs.
These are created when a matcher recognizes a value. */
@@ -320,7 +319,7 @@ gdbscm_pretty_printer_worker_p (SCM scm)
{
return scm_from_bool (ppscm_is_pretty_printer_worker (scm));
}
-
+
/* Helper function to create a <gdb:exception> object indicating that the
type of some value returned from a pretty-printer is invalid. */
@@ -328,9 +327,9 @@ static SCM
ppscm_make_pp_type_error_exception (const char *message, SCM object)
{
std::string msg = string_printf ("%s: ~S", message);
- return gdbscm_make_error (pp_type_error_symbol,
- NULL /* func */, msg.c_str (),
- scm_list_1 (object), scm_list_1 (object));
+ return gdbscm_make_error (pp_type_error_symbol, NULL /* func */,
+ msg.c_str (), scm_list_1 (object),
+ scm_list_1 (object));
}
/* Print MESSAGE as an exception (meaning it is controlled by
@@ -366,11 +365,11 @@ ppscm_search_pp_list (SCM list, SCM value)
return SCM_BOOL_F;
if (gdbscm_is_false (scm_list_p (list))) /* scm_is_pair? */
{
- return ppscm_make_pp_type_error_exception
- (_("pretty-printer list is not a list"), list);
+ return ppscm_make_pp_type_error_exception (
+ _ ("pretty-printer list is not a list"), list);
}
- for ( ; scm_is_pair (list); list = scm_cdr (list))
+ for (; scm_is_pair (list); list = scm_cdr (list))
{
SCM matcher = scm_car (list);
SCM worker;
@@ -378,9 +377,9 @@ ppscm_search_pp_list (SCM list, SCM value)
if (!ppscm_is_pretty_printer (matcher))
{
- return ppscm_make_pp_type_error_exception
- (_("pretty-printer list contains non-pretty-printer object"),
- matcher);
+ return ppscm_make_pp_type_error_exception (
+ _ ("pretty-printer list contains non-pretty-printer object"),
+ matcher);
}
pp_smob = (pretty_printer_smob *) SCM_SMOB_DATA (matcher);
@@ -391,28 +390,28 @@ ppscm_search_pp_list (SCM list, SCM value)
if (!gdbscm_is_procedure (pp_smob->lookup))
{
- return ppscm_make_pp_type_error_exception
- (_("invalid lookup object in pretty-printer matcher"),
- pp_smob->lookup);
+ return ppscm_make_pp_type_error_exception (
+ _ ("invalid lookup object in pretty-printer matcher"),
+ pp_smob->lookup);
}
- worker = gdbscm_safe_call_2 (pp_smob->lookup, matcher,
- value, gdbscm_memory_error_p);
+ worker = gdbscm_safe_call_2 (pp_smob->lookup, matcher, value,
+ gdbscm_memory_error_p);
if (!gdbscm_is_false (worker))
{
if (gdbscm_is_exception (worker))
return worker;
if (ppscm_is_pretty_printer_worker (worker))
return worker;
- return ppscm_make_pp_type_error_exception
- (_("invalid result from pretty-printer lookup"), worker);
+ return ppscm_make_pp_type_error_exception (
+ _ ("invalid result from pretty-printer lookup"), worker);
}
}
if (!scm_is_null (list))
{
- return ppscm_make_pp_type_error_exception
- (_("pretty-printer list is not a list"), orig_list);
+ return ppscm_make_pp_type_error_exception (
+ _ ("pretty-printer list is not a list"), orig_list);
}
return SCM_BOOL_F;
@@ -533,8 +532,7 @@ ppscm_pretty_print_one_value (SCM printer, struct value **out_value,
gdbscm_memory_error_p);
if (gdbscm_is_false (result))
; /* Done. */
- else if (scm_is_string (result)
- || lsscm_is_lazy_string (result))
+ else if (scm_is_string (result) || lsscm_is_lazy_string (result))
; /* Done. */
else if (vlscm_is_value (result))
{
@@ -542,8 +540,8 @@ ppscm_pretty_print_one_value (SCM printer, struct value **out_value,
*out_value
= vlscm_convert_value_from_scheme (FUNC_NAME, GDBSCM_ARG_NONE,
- result, &except_scm,
- gdbarch, language);
+ result, &except_scm, gdbarch,
+ language);
if (*out_value != NULL)
result = SCM_BOOL_T;
else
@@ -554,8 +552,8 @@ ppscm_pretty_print_one_value (SCM printer, struct value **out_value,
else
{
/* Invalid result from to-string. */
- result = ppscm_make_pp_type_error_exception
- (_("invalid result from pretty-printer to-string"), result);
+ result = ppscm_make_pp_type_error_exception (
+ _ ("invalid result from pretty-printer to-string"), result);
}
}
catch (const gdb_exception &except)
@@ -568,7 +566,7 @@ ppscm_pretty_print_one_value (SCM printer, struct value **out_value,
/* Return the display hint for PRINTER as a Scheme object.
The caller is responsible for ensuring PRINTER is a
<gdb:pretty-printer-worker> object. */
-
+
static SCM
ppscm_get_display_hint_scm (SCM printer)
{
@@ -617,7 +615,7 @@ ppscm_print_exception_unless_memory_error (SCM exception,
/* This "shouldn't happen", but play it safe. */
if (msg == NULL || msg.get ()[0] == '\0')
- gdb_printf (stream, _("<error reading variable>"));
+ gdb_printf (stream, _ ("<error reading variable>"));
else
{
/* Remove the trailing newline. We could instead call a special
@@ -628,7 +626,7 @@ ppscm_print_exception_unless_memory_error (SCM exception,
if (msg_text[len - 1] == '\n')
msg_text[len - 1] = '\0';
- gdb_printf (stream, _("<error reading variable: %s>"), msg_text);
+ gdb_printf (stream, _ ("<error reading variable: %s>"), msg_text);
}
}
else
@@ -649,8 +647,8 @@ ppscm_print_string_repr (SCM printer, enum display_hint hint,
SCM str_scm;
enum guile_string_repr_result result = STRING_REPR_ERROR;
- str_scm = ppscm_pretty_print_one_value (printer, &replacement,
- gdbarch, language);
+ str_scm
+ = ppscm_pretty_print_one_value (printer, &replacement, gdbarch, language);
if (gdbscm_is_false (str_scm))
{
result = STRING_REPR_NONE;
@@ -668,15 +666,15 @@ ppscm_print_string_repr (SCM printer, enum display_hint hint,
{
size_t length;
gdb::unique_xmalloc_ptr<char> string
- = gdbscm_scm_to_string (str_scm, &length,
- target_charset (gdbarch), 0 /*!strict*/, NULL);
+ = gdbscm_scm_to_string (str_scm, &length, target_charset (gdbarch),
+ 0 /*!strict*/, NULL);
if (hint == HINT_STRING)
{
struct type *type = builtin_type (gdbarch)->builtin_char;
-
- language->printstr (stream, type, (gdb_byte *) string.get (),
- length, NULL, 0, options);
+
+ language->printstr (stream, type, (gdb_byte *) string.get (), length,
+ NULL, 0, options);
}
else
{
@@ -737,9 +735,9 @@ ppscm_print_children (SCM printer, enum display_hint hint,
return;
if (!gdbscm_is_procedure (w_smob->children))
{
- ppscm_print_pp_type_error
- (_("pretty-printer \"children\" object is not a procedure or #f"),
- w_smob->children);
+ ppscm_print_pp_type_error (
+ _ ("pretty-printer \"children\" object is not a procedure or #f"),
+ w_smob->children);
return;
}
@@ -747,8 +745,8 @@ ppscm_print_children (SCM printer, enum display_hint hint,
is_map = hint == HINT_MAP;
is_array = hint == HINT_ARRAY;
- children = gdbscm_safe_call_1 (w_smob->children, printer,
- gdbscm_memory_error_p);
+ children
+ = gdbscm_safe_call_1 (w_smob->children, printer, gdbscm_memory_error_p);
if (gdbscm_is_exception (children))
{
ppscm_print_exception_unless_memory_error (children, stream);
@@ -760,9 +758,10 @@ ppscm_print_children (SCM printer, enum display_hint hint,
children iterated over. */
if (!itscm_is_iterator (children))
{
- ppscm_print_pp_type_error
- (_("result of pretty-printer \"children\" procedure is not"
- " a <gdb:iterator> object"), children);
+ ppscm_print_pp_type_error (
+ _ ("result of pretty-printer \"children\" procedure is not"
+ " a <gdb:iterator> object"),
+ children);
goto done;
}
iter = children;
@@ -798,25 +797,25 @@ ppscm_print_children (SCM printer, enum display_hint hint,
break;
}
- if (! scm_is_pair (item))
+ if (!scm_is_pair (item))
{
- ppscm_print_pp_type_error
- (_("result of pretty-printer children iterator is not a pair"
+ ppscm_print_pp_type_error (
+ _ ("result of pretty-printer children iterator is not a pair"
" or (end-of-iteration)"),
- item);
+ item);
continue;
}
scm_name = scm_car (item);
v_scm = scm_cdr (item);
if (!scm_is_string (scm_name))
{
- ppscm_print_pp_type_error
- (_("first element of pretty-printer children iterator is not"
- " a string"), item);
+ ppscm_print_pp_type_error (
+ _ ("first element of pretty-printer children iterator is not"
+ " a string"),
+ item);
continue;
}
- gdb::unique_xmalloc_ptr<char> name
- = gdbscm_scm_to_c_string (scm_name);
+ gdb::unique_xmalloc_ptr<char> name = gdbscm_scm_to_c_string (scm_name);
/* Print initial "=" to separate print_string_repr output and
children. For other elements, there are three cases:
@@ -828,7 +827,7 @@ ppscm_print_children (SCM printer, enum display_hint hint,
if (!printed_nothing)
gdb_puts (" = ", stream);
}
- else if (! is_map || i % 2 == 0)
+ else if (!is_map || i % 2 == 0)
gdb_puts (pretty ? "," : ", ", stream);
/* Skip printing children if max_depth has been reached. This check
@@ -853,7 +852,7 @@ ppscm_print_children (SCM printer, enum display_hint hint,
break;
}
- if (! is_map || i % 2 == 0)
+ if (!is_map || i % 2 == 0)
{
if (pretty)
{
@@ -861,7 +860,7 @@ ppscm_print_children (SCM printer, enum display_hint hint,
print_spaces (2 + 2 * recurse, stream);
}
else
- stream->wrap_here (2 + 2 *recurse);
+ stream->wrap_here (2 + 2 * recurse);
}
if (is_map && i % 2 == 0)
@@ -873,7 +872,7 @@ ppscm_print_children (SCM printer, enum display_hint hint,
if (options->print_array_indexes)
gdb_printf (stream, "[%d] = ", i);
}
- else if (! is_map)
+ else if (!is_map)
{
gdb_puts (name.get (), stream);
gdb_puts (" = ", stream);
@@ -897,8 +896,8 @@ ppscm_print_children (SCM printer, enum display_hint hint,
SCM except_scm;
struct value *value
= vlscm_convert_value_from_scheme (FUNC_NAME, GDBSCM_ARG_NONE,
- v_scm, &except_scm,
- gdbarch, language);
+ v_scm, &except_scm, gdbarch,
+ language);
if (value == NULL)
{
@@ -911,8 +910,7 @@ ppscm_print_children (SCM printer, enum display_hint hint,
level of depth. This means the key will print before the
value does. */
struct value_print_options opt = *options;
- if (is_map && i % 2 == 0
- && opt.max_depth != -1
+ if (is_map && i % 2 == 0 && opt.max_depth != -1
&& opt.max_depth < INT_MAX)
++opt.max_depth;
common_val_print (value, stream, recurse + 1, &opt, language);
@@ -942,7 +940,7 @@ ppscm_print_children (SCM printer, enum display_hint hint,
gdb_puts ("}", stream);
}
- done:
+done:
/* Play it safe, make sure ITER doesn't get GC'd. */
scm_remember_upto_here_1 (iter);
}
@@ -951,8 +949,8 @@ ppscm_print_children (SCM printer, enum display_hint hint,
enum ext_lang_rc
gdbscm_apply_val_pretty_printer (const struct extension_language_defn *extlang,
- struct value *value,
- struct ui_file *stream, int recurse,
+ struct value *value, struct ui_file *stream,
+ int recurse,
const struct value_print_options *options,
const struct language_defn *language)
{
@@ -1016,26 +1014,23 @@ gdbscm_apply_val_pretty_printer (const struct extension_language_defn *extlang,
options, gdbarch, language);
if (print_result != STRING_REPR_ERROR)
{
- ppscm_print_children (printer, hint, stream, recurse, options,
- gdbarch, language,
- print_result == STRING_REPR_NONE);
+ ppscm_print_children (printer, hint, stream, recurse, options, gdbarch,
+ language, print_result == STRING_REPR_NONE);
}
result = EXT_LANG_RC_OK;
- done:
+done:
if (gdbscm_is_exception (exception))
ppscm_print_exception_unless_memory_error (exception, stream);
return result;
}
-
+
/* Initialize the Scheme pretty-printer code. */
-static const scheme_function pretty_printer_functions[] =
-{
+static const scheme_function pretty_printer_functions[] = {
{ "make-pretty-printer", 2, 0, 0,
- as_a_scm_t_subr (gdbscm_make_pretty_printer),
- "\
+ as_a_scm_t_subr (gdbscm_make_pretty_printer), "\
Create a <gdb:pretty-printer> object.\n\
\n\
Arguments: name lookup\n\
@@ -1043,24 +1038,20 @@ Create a <gdb:pretty-printer> object.\n\
lookup: a procedure:\n\
(pretty-printer <gdb:value>) -> <gdb:pretty-printer-worker> | #f." },
- { "pretty-printer?", 1, 0, 0, as_a_scm_t_subr (gdbscm_pretty_printer_p),
- "\
+ { "pretty-printer?", 1, 0, 0, as_a_scm_t_subr (gdbscm_pretty_printer_p), "\
Return #t if the object is a <gdb:pretty-printer> object." },
{ "pretty-printer-enabled?", 1, 0, 0,
- as_a_scm_t_subr (gdbscm_pretty_printer_enabled_p),
- "\
+ as_a_scm_t_subr (gdbscm_pretty_printer_enabled_p), "\
Return #t if the pretty-printer is enabled." },
{ "set-pretty-printer-enabled!", 2, 0, 0,
- as_a_scm_t_subr (gdbscm_set_pretty_printer_enabled_x),
- "\
+ as_a_scm_t_subr (gdbscm_set_pretty_printer_enabled_x), "\
Set the enabled flag of the pretty-printer.\n\
Returns \"unspecified\"." },
{ "make-pretty-printer-worker", 3, 0, 0,
- as_a_scm_t_subr (gdbscm_make_pretty_printer_worker),
- "\
+ as_a_scm_t_subr (gdbscm_make_pretty_printer_worker), "\
Create a <gdb:pretty-printer-worker> object.\n\
\n\
Arguments: display-hint to-string children\n\
@@ -1071,17 +1062,14 @@ Create a <gdb:pretty-printer-worker> object.\n\
(pretty-printer) -> <gdb:iterator>" },
{ "pretty-printer-worker?", 1, 0, 0,
- as_a_scm_t_subr (gdbscm_pretty_printer_worker_p),
- "\
+ as_a_scm_t_subr (gdbscm_pretty_printer_worker_p), "\
Return #t if the object is a <gdb:pretty-printer-worker> object." },
- { "pretty-printers", 0, 0, 0, as_a_scm_t_subr (gdbscm_pretty_printers),
- "\
+ { "pretty-printers", 0, 0, 0, as_a_scm_t_subr (gdbscm_pretty_printers), "\
Return the list of global pretty-printers." },
{ "set-pretty-printers!", 1, 0, 0,
- as_a_scm_t_subr (gdbscm_set_pretty_printers_x),
- "\
+ as_a_scm_t_subr (gdbscm_set_pretty_printers_x), "\
Set the list of global pretty-printers." },
END_FUNCTIONS
diff --git a/gdb/guile/scm-progspace.c b/gdb/guile/scm-progspace.c
index 99f793896f8..129720ab2fe 100644
--- a/gdb/guile/scm-progspace.c
+++ b/gdb/guile/scm-progspace.c
@@ -63,7 +63,7 @@ struct psscm_deleter
};
static const registry<program_space>::key<pspace_smob, psscm_deleter>
- psscm_pspace_data_key;
+ psscm_pspace_data_key;
/* Return the list of pretty-printers registered with P_SMOB. */
@@ -72,7 +72,7 @@ psscm_pspace_smob_pretty_printers (const pspace_smob *p_smob)
{
return p_smob->pretty_printers;
}
-
+
/* Administrivia for progspace smobs. */
/* The smob "print" function for <gdb:progspace>. */
@@ -88,9 +88,8 @@ psscm_print_pspace_smob (SCM self, SCM port, scm_print_state *pstate)
struct objfile *objfile = p_smob->pspace->symfile_object_file;
gdbscm_printf (port, "%s",
- objfile != NULL
- ? objfile_name (objfile)
- : "{no symfile}");
+ objfile != NULL ? objfile_name (objfile)
+ : "{no symfile}");
}
else
scm_puts ("{invalid}", port);
@@ -109,8 +108,8 @@ psscm_print_pspace_smob (SCM self, SCM port, scm_print_state *pstate)
static SCM
psscm_make_pspace_smob (void)
{
- pspace_smob *p_smob = (pspace_smob *)
- scm_gc_malloc (sizeof (pspace_smob), pspace_smob_name);
+ pspace_smob *p_smob
+ = (pspace_smob *) scm_gc_malloc (sizeof (pspace_smob), pspace_smob_name);
SCM p_scm;
p_smob->pspace = NULL;
@@ -188,8 +187,7 @@ psscm_get_pspace_arg_unsafe (SCM self, int arg_pos, const char *func_name)
Throws an exception if SELF is not a <gdb:progspace> object. */
static pspace_smob *
-psscm_get_pspace_smob_arg_unsafe (SCM self, int arg_pos,
- const char *func_name)
+psscm_get_pspace_smob_arg_unsafe (SCM self, int arg_pos, const char *func_name)
{
SCM p_scm = psscm_get_pspace_arg_unsafe (self, arg_pos, func_name);
pspace_smob *p_smob = (pspace_smob *) SCM_SMOB_DATA (p_scm);
@@ -219,12 +217,12 @@ psscm_get_valid_pspace_smob_arg_unsafe (SCM self, int arg_pos,
if (!psscm_is_valid (p_smob))
{
gdbscm_invalid_object_error (func_name, arg_pos, self,
- _("<gdb:progspace>"));
+ _ ("<gdb:progspace>"));
}
return p_smob;
}
-
+
/* Program space methods. */
/* (progspace-valid? <gdb:progspace>) -> boolean
@@ -315,8 +313,8 @@ gdbscm_set_progspace_pretty_printers_x (SCM self, SCM printers)
pspace_smob *p_smob
= psscm_get_pspace_smob_arg_unsafe (self, SCM_ARG1, FUNC_NAME);
- SCM_ASSERT_TYPE (gdbscm_is_true (scm_list_p (printers)), printers,
- SCM_ARG2, FUNC_NAME, _("list"));
+ SCM_ASSERT_TYPE (gdbscm_is_true (scm_list_p (printers)), printers, SCM_ARG2,
+ FUNC_NAME, _ ("list"));
p_smob->pretty_printers = printers;
@@ -355,49 +353,43 @@ gdbscm_progspaces (void)
return scm_reverse_x (result, SCM_EOL);
}
-
+
/* Initialize the Scheme program space support. */
-static const scheme_function pspace_functions[] =
-{
- { "progspace?", 1, 0, 0, as_a_scm_t_subr (gdbscm_progspace_p),
- "\
+static const scheme_function pspace_functions[]
+ = { { "progspace?", 1, 0, 0, as_a_scm_t_subr (gdbscm_progspace_p), "\
Return #t if the object is a <gdb:objfile> object." },
- { "progspace-valid?", 1, 0, 0, as_a_scm_t_subr (gdbscm_progspace_valid_p),
- "\
+ { "progspace-valid?", 1, 0, 0,
+ as_a_scm_t_subr (gdbscm_progspace_valid_p), "\
Return #t if the progspace is valid (hasn't been deleted from gdb)." },
- { "progspace-filename", 1, 0, 0, as_a_scm_t_subr (gdbscm_progspace_filename),
- "\
+ { "progspace-filename", 1, 0, 0,
+ as_a_scm_t_subr (gdbscm_progspace_filename), "\
Return the name of the main symbol file of the progspace." },
- { "progspace-objfiles", 1, 0, 0, as_a_scm_t_subr (gdbscm_progspace_objfiles),
- "\
+ { "progspace-objfiles", 1, 0, 0,
+ as_a_scm_t_subr (gdbscm_progspace_objfiles), "\
Return the list of objfiles associated with the progspace.\n\
Objfiles that are separate debug objfiles are not included in the result.\n\
The order of appearance of objfiles in the result is arbitrary." },
- { "progspace-pretty-printers", 1, 0, 0,
- as_a_scm_t_subr (gdbscm_progspace_pretty_printers),
- "\
+ { "progspace-pretty-printers", 1, 0, 0,
+ as_a_scm_t_subr (gdbscm_progspace_pretty_printers), "\
Return a list of pretty-printers of the progspace." },
- { "set-progspace-pretty-printers!", 2, 0, 0,
- as_a_scm_t_subr (gdbscm_set_progspace_pretty_printers_x),
- "\
+ { "set-progspace-pretty-printers!", 2, 0, 0,
+ as_a_scm_t_subr (gdbscm_set_progspace_pretty_printers_x), "\
Set the list of pretty-printers of the progspace." },
- { "current-progspace", 0, 0, 0, as_a_scm_t_subr (gdbscm_current_progspace),
- "\
+ { "current-progspace", 0, 0, 0,
+ as_a_scm_t_subr (gdbscm_current_progspace), "\
Return the current program space if there is one or #f if there isn't one." },
- { "progspaces", 0, 0, 0, as_a_scm_t_subr (gdbscm_progspaces),
- "\
+ { "progspaces", 0, 0, 0, as_a_scm_t_subr (gdbscm_progspaces), "\
Return a list of all program spaces." },
- END_FUNCTIONS
-};
+ END_FUNCTIONS };
void
gdbscm_initialize_pspaces (void)
diff --git a/gdb/guile/scm-safe-call.c b/gdb/guile/scm-safe-call.c
index 46551bec792..04bde1311b6 100644
--- a/gdb/guile/scm-safe-call.c
+++ b/gdb/guile/scm-safe-call.c
@@ -151,9 +151,7 @@ gdbscm_with_catch (void *data)
struct with_catch_data *d = (struct with_catch_data *) data;
d->catch_result
- = scm_c_catch (SCM_BOOL_T,
- d->func, d->data,
- d->unwind_handler, d,
+ = scm_c_catch (SCM_BOOL_T, d->func, d->data, d->unwind_handler, d,
d->pre_unwind_handler, d);
#if HAVE_GUILE_MANUAL_FINALIZATION
@@ -177,7 +175,7 @@ gdbscm_with_guile (const char *(*func) (void *), void *data)
c_data.func = func;
c_data.data = data;
/* Set this now in case an exception is thrown. */
- c_data.result = _("Error while executing Scheme code.");
+ c_data.result = _ ("Error while executing Scheme code.");
catch_data.func = scscm_safe_call_body;
catch_data.data = &c_data;
@@ -219,7 +217,7 @@ gdbscm_call_guile (SCM (*func) (void *), void *data,
return catch_data.catch_result;
}
-
+
/* Utilities to safely call Scheme code, catching all exceptions, and
preventing continuation capture.
The result is the result of calling the function, or if an exception occurs
@@ -335,7 +333,7 @@ gdbscm_safe_apply_1 (SCM proc, SCM arg0, SCM rest, excp_matcher_func *ok_excps)
return gdbscm_call_guile (scscm_apply_1_body, args, ok_excps);
}
-
+
/* Utilities to call Scheme code, not catching exceptions, and
not preventing continuation capture.
The result is the result of calling the function.
@@ -358,7 +356,7 @@ gdbscm_unsafe_call_1 (SCM proc, SCM arg0)
{
return scm_call_1 (proc, arg0);
}
-
+
/* Utilities for safely evaluating a Scheme expression string. */
struct eval_scheme_string_data
@@ -407,7 +405,7 @@ gdbscm_safe_eval_string (const char *string, int display_result)
return make_unique_xstrdup (result);
return NULL;
}
-
+
/* Utilities for safely loading Scheme scripts. */
/* Helper function for gdbscm_safe_source_scheme_script. */
@@ -448,14 +446,13 @@ gdbscm_safe_source_script (const char *filename)
filename = abs_filename.get ();
}
- result = gdbscm_with_guile (scscm_source_scheme_script,
- (void *) filename);
+ result = gdbscm_with_guile (scscm_source_scheme_script, (void *) filename);
if (result != NULL)
return make_unique_xstrdup (result);
return NULL;
}
-
+
/* Utility for entering an interactive Guile repl. */
void
diff --git a/gdb/guile/scm-string.c b/gdb/guile/scm-string.c
index f8e03ddc65d..7e92757f0a0 100644
--- a/gdb/guile/scm-string.c
+++ b/gdb/guile/scm-string.c
@@ -114,8 +114,8 @@ gdbscm_call_scm_to_stringn (void *datap)
It is an error to call this if STRING is not a string. */
gdb::unique_xmalloc_ptr<char>
-gdbscm_scm_to_string (SCM string, size_t *lenp,
- const char *charset, int strict, SCM *except_scmp)
+gdbscm_scm_to_string (SCM string, size_t *lenp, const char *charset,
+ int strict, SCM *except_scmp)
{
struct scm_to_stringn_data data;
SCM scm_result;
@@ -123,9 +123,8 @@ gdbscm_scm_to_string (SCM string, size_t *lenp,
data.string = string;
data.lenp = lenp;
data.charset = charset;
- data.conversion_kind = (strict
- ? SCM_FAILED_CONVERSION_ERROR
- : SCM_FAILED_CONVERSION_ESCAPE_SEQUENCE);
+ data.conversion_kind = (strict ? SCM_FAILED_CONVERSION_ERROR
+ : SCM_FAILED_CONVERSION_ESCAPE_SEQUENCE);
data.result = NULL;
scm_result = gdbscm_call_guile (gdbscm_call_scm_to_stringn, &data, NULL);
@@ -174,8 +173,8 @@ gdbscm_call_scm_from_stringn (void *datap)
can't be converted (limitation of underlying Guile conversion support). */
SCM
-gdbscm_scm_from_string (const char *string, size_t len,
- const char *charset, int strict)
+gdbscm_scm_from_string (const char *string, size_t len, const char *charset,
+ int strict)
{
struct scm_from_stringn_data data;
SCM scm_result;
@@ -184,9 +183,8 @@ gdbscm_scm_from_string (const char *string, size_t len,
data.len = len;
data.charset = charset;
/* The use of SCM_FAILED_CONVERSION_QUESTION_MARK is specified by Guile. */
- data.conversion_kind = (strict
- ? SCM_FAILED_CONVERSION_ERROR
- : SCM_FAILED_CONVERSION_QUESTION_MARK);
+ data.conversion_kind = (strict ? SCM_FAILED_CONVERSION_ERROR
+ : SCM_FAILED_CONVERSION_QUESTION_MARK);
data.result = SCM_UNDEFINED;
scm_result = gdbscm_call_guile (gdbscm_call_scm_from_stringn, &data, NULL);
@@ -239,8 +237,8 @@ gdbscm_string_to_argv (SCM string_scm)
char *string;
SCM result = SCM_EOL;
- gdbscm_parse_function_args (FUNC_NAME, SCM_ARG1, NULL, "s",
- string_scm, &string);
+ gdbscm_parse_function_args (FUNC_NAME, SCM_ARG1, NULL, "s", string_scm,
+ &string);
if (string == NULL || *string == '\0')
{
@@ -256,18 +254,15 @@ gdbscm_string_to_argv (SCM string_scm)
return scm_reverse_x (result, SCM_EOL);
}
-
+
/* Initialize the Scheme charset interface to GDB. */
-static const scheme_function string_functions[] =
-{
- { "string->argv", 1, 0, 0, as_a_scm_t_subr (gdbscm_string_to_argv),
- "\
+static const scheme_function string_functions[]
+ = { { "string->argv", 1, 0, 0, as_a_scm_t_subr (gdbscm_string_to_argv), "\
Convert a string to a list of strings split up according to\n\
gdb's argv parsing rules." },
- END_FUNCTIONS
-};
+ END_FUNCTIONS };
void
gdbscm_initialize_strings (void)
diff --git a/gdb/guile/scm-symbol.c b/gdb/guile/scm-symbol.c
index 1619705f065..5ebf53dd412 100644
--- a/gdb/guile/scm-symbol.c
+++ b/gdb/guile/scm-symbol.c
@@ -59,8 +59,7 @@ struct syscm_deleter
/* Helper function for syscm_del_objfile_symbols to mark the symbol
as invalid. */
- static int
- syscm_mark_symbol_invalid (void **slot, void *info)
+ static int syscm_mark_symbol_invalid (void **slot, void *info)
{
symbol_smob *s_smob = (symbol_smob *) *slot;
@@ -77,7 +76,7 @@ struct syscm_deleter
};
static const registry<objfile>::key<htab, syscm_deleter>
- syscm_objfile_data_key;
+ syscm_objfile_data_key;
struct syscm_gdbarch_data
{
@@ -86,7 +85,7 @@ struct syscm_gdbarch_data
};
static const registry<gdbarch>::key<syscm_gdbarch_data> syscm_gdbarch_data_key;
-
+
/* Administrivia for symbol smobs. */
/* Helper function to hash a symbol_smob. */
@@ -107,8 +106,7 @@ syscm_eq_symbol_smob (const void *ap, const void *bp)
const symbol_smob *a = (const symbol_smob *) ap;
const symbol_smob *b = (const symbol_smob *) bp;
- return (a->symbol == b->symbol
- && a->symbol != NULL);
+ return (a->symbol == b->symbol && a->symbol != NULL);
}
/* Return the struct symbol pointer -> SCM mapping table.
@@ -179,9 +177,8 @@ syscm_print_symbol_smob (SCM self, SCM port, scm_print_state *pstate)
if (pstate->writingp)
gdbscm_printf (port, "#<%s ", symbol_smob_name);
gdbscm_printf (port, "%s",
- s_smob->symbol != NULL
- ? s_smob->symbol->print_name ()
- : "<invalid>");
+ s_smob->symbol != NULL ? s_smob->symbol->print_name ()
+ : "<invalid>");
if (pstate->writingp)
scm_puts (">", port);
@@ -196,8 +193,8 @@ syscm_print_symbol_smob (SCM self, SCM port, scm_print_state *pstate)
static SCM
syscm_make_symbol_smob (void)
{
- symbol_smob *s_smob = (symbol_smob *)
- scm_gc_malloc (sizeof (symbol_smob), symbol_smob_name);
+ symbol_smob *s_smob
+ = (symbol_smob *) scm_gc_malloc (sizeof (symbol_smob), symbol_smob_name);
SCM s_scm;
s_smob->symbol = NULL;
@@ -295,7 +292,7 @@ syscm_get_valid_symbol_smob_arg_unsafe (SCM self, int arg_pos,
if (!syscm_is_valid (s_smob))
{
gdbscm_invalid_object_error (func_name, arg_pos, self,
- _("<gdb:symbol>"));
+ _ ("<gdb:symbol>"));
}
return s_smob;
@@ -308,13 +305,12 @@ struct symbol *
syscm_get_valid_symbol_arg_unsafe (SCM self, int arg_pos,
const char *func_name)
{
- symbol_smob *s_smob = syscm_get_valid_symbol_smob_arg_unsafe (self, arg_pos,
- func_name);
+ symbol_smob *s_smob
+ = syscm_get_valid_symbol_smob_arg_unsafe (self, arg_pos, func_name);
return s_smob->symbol;
}
-
/* Symbol methods. */
/* (symbol-valid? <gdb:symbol>) -> boolean
@@ -465,7 +461,8 @@ gdbscm_symbol_variable_p (SCM self)
return scm_from_bool (!symbol->is_argument ()
&& (theclass == LOC_LOCAL || theclass == LOC_REGISTER
- || theclass == LOC_STATIC || theclass == LOC_COMPUTED
+ || theclass == LOC_STATIC
+ || theclass == LOC_COMPUTED
|| theclass == LOC_OPTIMIZED_OUT));
}
@@ -522,15 +519,15 @@ gdbscm_symbol_value (SCM self, SCM rest)
frame_smob *f_smob = NULL;
struct value *value = NULL;
- gdbscm_parse_function_args (FUNC_NAME, SCM_ARG2, keywords, "#O",
- rest, &frame_pos, &frame_scm);
+ gdbscm_parse_function_args (FUNC_NAME, SCM_ARG2, keywords, "#O", rest,
+ &frame_pos, &frame_scm);
if (!gdbscm_is_false (frame_scm))
f_smob = frscm_get_frame_smob_arg_unsafe (frame_scm, frame_pos, FUNC_NAME);
if (symbol->aclass () == LOC_TYPEDEF)
{
gdbscm_out_of_range_error (FUNC_NAME, SCM_ARG1, self,
- _("cannot get the value of a typedef"));
+ _ ("cannot get the value of a typedef"));
}
gdbscm_gdb_exception exc {};
@@ -542,11 +539,11 @@ gdbscm_symbol_value (SCM self, SCM rest)
{
frame_info = frame_info_ptr (frscm_frame_smob_to_frame (f_smob));
if (frame_info == NULL)
- error (_("Invalid frame"));
+ error (_ ("Invalid frame"));
}
-
+
if (symbol_read_needs_frame (symbol) && frame_info == NULL)
- error (_("Symbol requires a frame to compute its value"));
+ error (_ ("Symbol requires a frame to compute its value"));
/* TODO: currently, we have no way to recover the block in which SYMBOL
was found, so we have no block to pass to read_var_value. This will
@@ -562,7 +559,7 @@ gdbscm_symbol_value (SCM self, SCM rest)
GDBSCM_HANDLE_GDB_EXCEPTION (exc);
return vlscm_scm_from_value (value);
}
-
+
/* (lookup-symbol name [#:block <gdb:block>] [#:domain domain])
-> (<gdb:symbol> field-of-this?)
The result is #f if the symbol is not found.
@@ -580,9 +577,8 @@ gdbscm_lookup_symbol (SCM name_scm, SCM rest)
struct field_of_this_result is_a_field_of_this;
struct symbol *symbol = NULL;
- gdbscm_parse_function_args (FUNC_NAME, SCM_ARG1, keywords, "s#Oi",
- name_scm, &name, rest,
- &block_arg_pos, &block_scm,
+ gdbscm_parse_function_args (FUNC_NAME, SCM_ARG1, keywords, "s#Oi", name_scm,
+ &name, rest, &block_arg_pos, &block_scm,
&domain_arg_pos, &domain);
if (block_arg_pos >= 0)
@@ -603,7 +599,7 @@ gdbscm_lookup_symbol (SCM name_scm, SCM rest)
try
{
frame_info_ptr selected_frame
- = get_selected_frame (_("no frame selected"));
+ = get_selected_frame (_ ("no frame selected"));
block = get_frame_block (selected_frame, NULL);
}
catch (const gdb_exception &ex)
@@ -618,7 +614,8 @@ gdbscm_lookup_symbol (SCM name_scm, SCM rest)
try
{
symbol = lookup_symbol (name, block, (domain_enum) domain,
- &is_a_field_of_this).symbol;
+ &is_a_field_of_this)
+ .symbol;
}
catch (const gdb_exception &ex)
{
@@ -648,9 +645,8 @@ gdbscm_lookup_global_symbol (SCM name_scm, SCM rest)
struct symbol *symbol = NULL;
gdbscm_gdb_exception except {};
- gdbscm_parse_function_args (FUNC_NAME, SCM_ARG1, keywords, "s#i",
- name_scm, &name, rest,
- &domain_arg_pos, &domain);
+ gdbscm_parse_function_args (FUNC_NAME, SCM_ARG1, keywords, "s#i", name_scm,
+ &name, rest, &domain_arg_pos, &domain);
try
{
@@ -669,74 +665,54 @@ gdbscm_lookup_global_symbol (SCM name_scm, SCM rest)
return syscm_scm_from_symbol (symbol);
}
-
+
/* Initialize the Scheme symbol support. */
/* Note: The SYMBOL_ prefix on the integer constants here is present for
compatibility with the Python support. */
-static const scheme_integer_constant symbol_integer_constants[] =
-{
-#define X(SYM) { "SYMBOL_" #SYM, SYM }
- X (LOC_UNDEF),
- X (LOC_CONST),
- X (LOC_STATIC),
- X (LOC_REGISTER),
- X (LOC_ARG),
- X (LOC_REF_ARG),
- X (LOC_LOCAL),
- X (LOC_TYPEDEF),
- X (LOC_LABEL),
- X (LOC_BLOCK),
- X (LOC_CONST_BYTES),
- X (LOC_UNRESOLVED),
- X (LOC_OPTIMIZED_OUT),
- X (LOC_COMPUTED),
- X (LOC_REGPARM_ADDR),
-
- X (UNDEF_DOMAIN),
- X (VAR_DOMAIN),
- X (STRUCT_DOMAIN),
- X (LABEL_DOMAIN),
- X (VARIABLES_DOMAIN),
- X (FUNCTIONS_DOMAIN),
+static const scheme_integer_constant symbol_integer_constants[] = {
+#define X(SYM) \
+ { \
+ "SYMBOL_" #SYM, SYM \
+ }
+ X (LOC_UNDEF), X (LOC_CONST), X (LOC_STATIC),
+ X (LOC_REGISTER), X (LOC_ARG), X (LOC_REF_ARG),
+ X (LOC_LOCAL), X (LOC_TYPEDEF), X (LOC_LABEL),
+ X (LOC_BLOCK), X (LOC_CONST_BYTES), X (LOC_UNRESOLVED),
+ X (LOC_OPTIMIZED_OUT), X (LOC_COMPUTED), X (LOC_REGPARM_ADDR),
+
+ X (UNDEF_DOMAIN), X (VAR_DOMAIN), X (STRUCT_DOMAIN),
+ X (LABEL_DOMAIN), X (VARIABLES_DOMAIN), X (FUNCTIONS_DOMAIN),
X (TYPES_DOMAIN),
#undef X
END_INTEGER_CONSTANTS
};
-static const scheme_function symbol_functions[] =
-{
- { "symbol?", 1, 0, 0, as_a_scm_t_subr (gdbscm_symbol_p),
- "\
+static const scheme_function symbol_functions[] = {
+ { "symbol?", 1, 0, 0, as_a_scm_t_subr (gdbscm_symbol_p), "\
Return #t if the object is a <gdb:symbol> object." },
- { "symbol-valid?", 1, 0, 0, as_a_scm_t_subr (gdbscm_symbol_valid_p),
- "\
+ { "symbol-valid?", 1, 0, 0, as_a_scm_t_subr (gdbscm_symbol_valid_p), "\
Return #t if object is a valid <gdb:symbol> object.\n\
A valid symbol is a symbol that has not been freed.\n\
Symbols are freed when the objfile they come from is freed." },
- { "symbol-type", 1, 0, 0, as_a_scm_t_subr (gdbscm_symbol_type),
- "\
+ { "symbol-type", 1, 0, 0, as_a_scm_t_subr (gdbscm_symbol_type), "\
Return the type of symbol." },
- { "symbol-symtab", 1, 0, 0, as_a_scm_t_subr (gdbscm_symbol_symtab),
- "\
+ { "symbol-symtab", 1, 0, 0, as_a_scm_t_subr (gdbscm_symbol_symtab), "\
Return the symbol table (<gdb:symtab>) containing symbol." },
- { "symbol-line", 1, 0, 0, as_a_scm_t_subr (gdbscm_symbol_line),
- "\
+ { "symbol-line", 1, 0, 0, as_a_scm_t_subr (gdbscm_symbol_line), "\
Return the line number at which the symbol was defined." },
- { "symbol-name", 1, 0, 0, as_a_scm_t_subr (gdbscm_symbol_name),
- "\
+ { "symbol-name", 1, 0, 0, as_a_scm_t_subr (gdbscm_symbol_name), "\
Return the name of the symbol as a string." },
{ "symbol-linkage-name", 1, 0, 0,
- as_a_scm_t_subr (gdbscm_symbol_linkage_name),
- "\
+ as_a_scm_t_subr (gdbscm_symbol_linkage_name), "\
Return the linkage name of the symbol as a string." },
{ "symbol-print-name", 1, 0, 0, as_a_scm_t_subr (gdbscm_symbol_print_name),
@@ -750,34 +726,27 @@ asked GDB to display demangled or mangled names." },
Return the address class of the symbol." },
{ "symbol-needs-frame?", 1, 0, 0,
- as_a_scm_t_subr (gdbscm_symbol_needs_frame_p),
- "\
+ as_a_scm_t_subr (gdbscm_symbol_needs_frame_p), "\
Return #t if the symbol needs a frame to compute its value." },
- { "symbol-argument?", 1, 0, 0, as_a_scm_t_subr (gdbscm_symbol_argument_p),
- "\
+ { "symbol-argument?", 1, 0, 0, as_a_scm_t_subr (gdbscm_symbol_argument_p), "\
Return #t if the symbol is a function argument." },
- { "symbol-constant?", 1, 0, 0, as_a_scm_t_subr (gdbscm_symbol_constant_p),
- "\
+ { "symbol-constant?", 1, 0, 0, as_a_scm_t_subr (gdbscm_symbol_constant_p), "\
Return #t if the symbol is a constant." },
- { "symbol-function?", 1, 0, 0, as_a_scm_t_subr (gdbscm_symbol_function_p),
- "\
+ { "symbol-function?", 1, 0, 0, as_a_scm_t_subr (gdbscm_symbol_function_p), "\
Return #t if the symbol is a function." },
- { "symbol-variable?", 1, 0, 0, as_a_scm_t_subr (gdbscm_symbol_variable_p),
- "\
+ { "symbol-variable?", 1, 0, 0, as_a_scm_t_subr (gdbscm_symbol_variable_p), "\
Return #t if the symbol is a variable." },
- { "symbol-value", 1, 0, 1, as_a_scm_t_subr (gdbscm_symbol_value),
- "\
+ { "symbol-value", 1, 0, 1, as_a_scm_t_subr (gdbscm_symbol_value), "\
Return the value of the symbol.\n\
\n\
Arguments: <gdb:symbol> [#:frame frame]" },
- { "lookup-symbol", 1, 0, 1, as_a_scm_t_subr (gdbscm_lookup_symbol),
- "\
+ { "lookup-symbol", 1, 0, 1, as_a_scm_t_subr (gdbscm_lookup_symbol), "\
Return (<gdb:symbol> field-of-this?) if found, otherwise #f.\n\
\n\
Arguments: name [#:block block] [#:domain domain]\n\
@@ -786,8 +755,7 @@ Return (<gdb:symbol> field-of-this?) if found, otherwise #f.\n\
domain: a SYMBOL_*_DOMAIN value" },
{ "lookup-global-symbol", 1, 0, 1,
- as_a_scm_t_subr (gdbscm_lookup_global_symbol),
- "\
+ as_a_scm_t_subr (gdbscm_lookup_global_symbol), "\
Return <gdb:symbol> if found, otherwise #f.\n\
\n\
Arguments: name [#:domain domain]\n\
diff --git a/gdb/guile/scm-symtab.c b/gdb/guile/scm-symtab.c
index f3c3347caa7..21ca0fe1f7e 100644
--- a/gdb/guile/scm-symtab.c
+++ b/gdb/guile/scm-symtab.c
@@ -87,8 +87,7 @@ struct stscm_deleter
/* Helper function for stscm_del_objfile_symtabs to mark the symtab
as invalid. */
- static int
- stscm_mark_symtab_invalid (void **slot, void *info)
+ static int stscm_mark_symtab_invalid (void **slot, void *info)
{
symtab_smob *st_smob = (symtab_smob *) *slot;
@@ -105,8 +104,8 @@ struct stscm_deleter
};
static const registry<objfile>::key<htab, stscm_deleter>
- stscm_objfile_data_key;
-
+ stscm_objfile_data_key;
+
/* Administrivia for symtab smobs. */
/* Helper function to hash a symbol_smob. */
@@ -127,8 +126,7 @@ stscm_eq_symtab_smob (const void *ap, const void *bp)
const symtab_smob *a = (const symtab_smob *) ap;
const symtab_smob *b = (const symtab_smob *) bp;
- return (a->symtab == b->symtab
- && a->symtab != NULL);
+ return (a->symtab == b->symtab && a->symtab != NULL);
}
/* Return the struct symtab pointer -> SCM mapping table.
@@ -180,8 +178,8 @@ stscm_print_symtab_smob (SCM self, SCM port, scm_print_state *pstate)
gdbscm_printf (port, "#<%s ", symtab_smob_name);
gdbscm_printf (port, "%s",
st_smob->symtab != NULL
- ? symtab_to_filename_for_display (st_smob->symtab)
- : "<invalid>");
+ ? symtab_to_filename_for_display (st_smob->symtab)
+ : "<invalid>");
scm_puts (">", port);
scm_remember_upto_here_1 (self);
@@ -195,8 +193,8 @@ stscm_print_symtab_smob (SCM self, SCM port, scm_print_state *pstate)
static SCM
stscm_make_symtab_smob (void)
{
- symtab_smob *st_smob = (symtab_smob *)
- scm_gc_malloc (sizeof (symtab_smob), symtab_smob_name);
+ symtab_smob *st_smob
+ = (symtab_smob *) scm_gc_malloc (sizeof (symtab_smob), symtab_smob_name);
SCM st_scm;
st_smob->symtab = NULL;
@@ -244,7 +242,7 @@ stscm_scm_from_symtab (struct symtab *symtab)
st_smob = (symtab_smob *) SCM_SMOB_DATA (st_scm);
st_smob->symtab = symtab;
gdbscm_fill_eqable_gsmob_ptr_slot (slot, &st_smob->base);
-
+
return st_scm;
}
@@ -293,13 +291,12 @@ stscm_get_valid_symtab_smob_arg_unsafe (SCM self, int arg_pos,
if (!stscm_is_valid (st_smob))
{
gdbscm_invalid_object_error (func_name, arg_pos, self,
- _("<gdb:symtab>"));
+ _ ("<gdb:symtab>"));
}
return st_smob;
}
-
/* Symbol table methods. */
/* (symtab-valid? <gdb:symtab>) -> boolean
@@ -383,7 +380,7 @@ gdbscm_symtab_static_block (SCM self)
return bkscm_scm_from_block (block, symtab->compunit ()->objfile ());
}
-
+
/* Administrivia for sal (symtab-and-line) smobs. */
/* The smob "print" function for <gdb:sal>. */
@@ -508,13 +505,12 @@ stscm_get_valid_sal_smob_arg (SCM self, int arg_pos, const char *func_name)
if (!stscm_sal_is_valid (s_smob))
{
- gdbscm_invalid_object_error (func_name, arg_pos, self,
- _("<gdb:sal>"));
+ gdbscm_invalid_object_error (func_name, arg_pos, self, _ ("<gdb:sal>"));
}
return s_smob;
}
-
+
/* sal methods */
/* (sal-valid? <gdb:sal>) -> boolean
@@ -603,69 +599,54 @@ gdbscm_find_pc_line (SCM pc_scm)
GDBSCM_HANDLE_GDB_EXCEPTION (exc);
return stscm_scm_from_sal (sal);
}
-
+
/* Initialize the Scheme symbol support. */
-static const scheme_function symtab_functions[] =
-{
- { "symtab?", 1, 0, 0, as_a_scm_t_subr (gdbscm_symtab_p),
- "\
+static const scheme_function symtab_functions[] = {
+ { "symtab?", 1, 0, 0, as_a_scm_t_subr (gdbscm_symtab_p), "\
Return #t if the object is a <gdb:symtab> object." },
- { "symtab-valid?", 1, 0, 0, as_a_scm_t_subr (gdbscm_symtab_valid_p),
- "\
+ { "symtab-valid?", 1, 0, 0, as_a_scm_t_subr (gdbscm_symtab_valid_p), "\
Return #t if the symtab still exists in GDB.\n\
Symtabs are deleted when the corresponding objfile is freed." },
- { "symtab-filename", 1, 0, 0, as_a_scm_t_subr (gdbscm_symtab_filename),
- "\
+ { "symtab-filename", 1, 0, 0, as_a_scm_t_subr (gdbscm_symtab_filename), "\
Return the symtab's source file name." },
- { "symtab-fullname", 1, 0, 0, as_a_scm_t_subr (gdbscm_symtab_fullname),
- "\
+ { "symtab-fullname", 1, 0, 0, as_a_scm_t_subr (gdbscm_symtab_fullname), "\
Return the symtab's full source file name." },
- { "symtab-objfile", 1, 0, 0, as_a_scm_t_subr (gdbscm_symtab_objfile),
- "\
+ { "symtab-objfile", 1, 0, 0, as_a_scm_t_subr (gdbscm_symtab_objfile), "\
Return the symtab's objfile." },
{ "symtab-global-block", 1, 0, 0,
- as_a_scm_t_subr (gdbscm_symtab_global_block),
- "\
+ as_a_scm_t_subr (gdbscm_symtab_global_block), "\
Return the symtab's global block." },
{ "symtab-static-block", 1, 0, 0,
- as_a_scm_t_subr (gdbscm_symtab_static_block),
- "\
+ as_a_scm_t_subr (gdbscm_symtab_static_block), "\
Return the symtab's static block." },
- { "sal?", 1, 0, 0, as_a_scm_t_subr (gdbscm_sal_p),
- "\
+ { "sal?", 1, 0, 0, as_a_scm_t_subr (gdbscm_sal_p), "\
Return #t if the object is a <gdb:sal> (symtab-and-line) object." },
- { "sal-valid?", 1, 0, 0, as_a_scm_t_subr (gdbscm_sal_valid_p),
- "\
+ { "sal-valid?", 1, 0, 0, as_a_scm_t_subr (gdbscm_sal_valid_p), "\
Return #t if the symtab for the sal still exists in GDB.\n\
Symtabs are deleted when the corresponding objfile is freed." },
- { "sal-symtab", 1, 0, 0, as_a_scm_t_subr (gdbscm_sal_symtab),
- "\
+ { "sal-symtab", 1, 0, 0, as_a_scm_t_subr (gdbscm_sal_symtab), "\
Return the sal's symtab." },
- { "sal-line", 1, 0, 0, as_a_scm_t_subr (gdbscm_sal_line),
- "\
+ { "sal-line", 1, 0, 0, as_a_scm_t_subr (gdbscm_sal_line), "\
Return the sal's line number, or #f if there is none." },
- { "sal-pc", 1, 0, 0, as_a_scm_t_subr (gdbscm_sal_pc),
- "\
+ { "sal-pc", 1, 0, 0, as_a_scm_t_subr (gdbscm_sal_pc), "\
Return the sal's address." },
- { "sal-last", 1, 0, 0, as_a_scm_t_subr (gdbscm_sal_last),
- "\
+ { "sal-last", 1, 0, 0, as_a_scm_t_subr (gdbscm_sal_last), "\
Return the last address specified by the sal, or #f if there is none." },
- { "find-pc-line", 1, 0, 0, as_a_scm_t_subr (gdbscm_find_pc_line),
- "\
+ { "find-pc-line", 1, 0, 0, as_a_scm_t_subr (gdbscm_find_pc_line), "\
Return the sal corresponding to the address, or #f if there isn't one.\n\
\n\
Arguments: address" },
diff --git a/gdb/guile/scm-type.c b/gdb/guile/scm-type.c
index da16d22990c..a2a0d88e8ea 100644
--- a/gdb/guile/scm-type.c
+++ b/gdb/guile/scm-type.c
@@ -66,8 +66,8 @@ struct field_smob
static const char type_smob_name[] = "gdb:type";
static const char field_smob_name[] = "gdb:field";
-static const char not_composite_error[] =
- N_("type is not a structure, union, or enum type");
+static const char not_composite_error[]
+ = N_ ("type is not a structure, union, or enum type");
/* The tag Guile knows the type smob by. */
static scm_t_bits type_smob_tag;
@@ -95,13 +95,14 @@ struct tyscm_deleter
gdb_assert (htab != nullptr);
htab_up copied_types = create_copied_types_hash ();
- htab_traverse_noresize (htab, tyscm_copy_type_recursive, copied_types.get ());
+ htab_traverse_noresize (htab, tyscm_copy_type_recursive,
+ copied_types.get ());
htab_delete (htab);
}
};
static const registry<objfile>::key<htab, tyscm_deleter>
- tyscm_objfile_data_key;
+ tyscm_objfile_data_key;
/* Hash table to uniquify global (non-objfile-owned) types. */
static htab_t global_types_map;
@@ -139,7 +140,7 @@ tyscm_type_name (struct type *type)
gdbscm_throw (excp);
}
-
+
/* Administrivia for type smobs. */
/* Helper function to hash a type_smob. */
@@ -160,8 +161,7 @@ tyscm_eq_type_smob (const void *ap, const void *bp)
const type_smob *a = (const type_smob *) ap;
const type_smob *b = (const type_smob *) bp;
- return (a->type == b->type
- && a->type != NULL);
+ return (a->type == b->type && a->type != NULL);
}
/* Return the struct type pointer -> SCM mapping table.
@@ -272,8 +272,8 @@ tyscm_equal_p_type_smob (SCM type1_scm, SCM type2_scm)
static SCM
tyscm_make_type_smob (void)
{
- type_smob *t_smob = (type_smob *)
- scm_gc_malloc (sizeof (type_smob), type_smob_name);
+ type_smob *t_smob
+ = (type_smob *) scm_gc_malloc (sizeof (type_smob), type_smob_name);
SCM t_scm;
/* This must be filled in by the caller. */
@@ -397,7 +397,6 @@ tyscm_copy_type_recursive (void **slot, void *info)
return 1;
}
-
/* Administrivia for field smobs. */
/* The smob "print" function for <gdb:field>. */
@@ -424,8 +423,8 @@ tyscm_print_field_smob (SCM self, SCM port, scm_print_state *pstate)
static SCM
tyscm_make_field_smob (SCM type_scm, int field_num)
{
- field_smob *f_smob = (field_smob *)
- scm_gc_malloc (sizeof (field_smob), field_smob_name);
+ field_smob *f_smob
+ = (field_smob *) scm_gc_malloc (sizeof (field_smob), field_smob_name);
SCM result;
f_smob->type_scm = type_scm;
@@ -511,7 +510,7 @@ tyscm_field_smob_to_field (field_smob *f_smob)
return &type->field (f_smob->field_num);
}
-
+
/* Type smob accessors. */
/* (type-code <gdb:type>) -> integer
@@ -545,7 +544,7 @@ gdbscm_type_fields (SCM self)
containing_type = tyscm_get_composite (type);
if (containing_type == NULL)
gdbscm_out_of_range_error (FUNC_NAME, SCM_ARG1, self,
- _(not_composite_error));
+ _ (not_composite_error));
/* If SELF is a typedef or reference, we want the underlying type,
which is what tyscm_get_composite returns. */
@@ -572,8 +571,7 @@ gdbscm_type_tag (SCM self)
struct type *type = t_smob->type;
const char *tagname = nullptr;
- if (type->code () == TYPE_CODE_STRUCT
- || type->code () == TYPE_CODE_UNION
+ if (type->code () == TYPE_CODE_STRUCT || type->code () == TYPE_CODE_UNION
|| type->code () == TYPE_CODE_ENUM)
tagname = type->name ();
@@ -666,7 +664,6 @@ gdbscm_type_strip_typedefs (SCM self)
static struct type *
tyscm_get_composite (struct type *type)
{
-
for (;;)
{
gdbscm_gdb_exception exc {};
@@ -680,16 +677,14 @@ tyscm_get_composite (struct type *type)
}
GDBSCM_HANDLE_GDB_EXCEPTION (exc);
- if (type->code () != TYPE_CODE_PTR
- && type->code () != TYPE_CODE_REF)
+ if (type->code () != TYPE_CODE_PTR && type->code () != TYPE_CODE_REF)
break;
type = type->target_type ();
}
/* If this is not a struct, union, or enum type, raise TypeError
exception. */
- if (type->code () != TYPE_CODE_STRUCT
- && type->code () != TYPE_CODE_UNION
+ if (type->code () != TYPE_CODE_STRUCT && type->code () != TYPE_CODE_UNION
&& type->code () != TYPE_CODE_ENUM)
return NULL;
@@ -708,8 +703,8 @@ tyscm_array_1 (SCM self, SCM n1_scm, SCM n2_scm, int is_vector,
long n1, n2 = 0;
struct type *array = NULL;
- gdbscm_parse_function_args (func_name, SCM_ARG2, NULL, "l|l",
- n1_scm, &n1, n2_scm, &n2);
+ gdbscm_parse_function_args (func_name, SCM_ARG2, NULL, "l|l", n1_scm, &n1,
+ n2_scm, &n2);
if (SCM_UNBNDP (n2_scm))
{
@@ -722,7 +717,7 @@ tyscm_array_1 (SCM self, SCM n1_scm, SCM n2_scm, int is_vector,
gdbscm_out_of_range_error (func_name, SCM_ARG3,
scm_cons (scm_from_long (n1),
scm_from_long (n2)),
- _("Array length must not be negative"));
+ _ ("Array length must not be negative"));
}
gdbscm_gdb_exception exc {};
@@ -813,9 +808,9 @@ gdbscm_type_range (SCM self)
LONGEST low = 0, high = 0;
SCM_ASSERT_TYPE (type->code () == TYPE_CODE_ARRAY
- || type->code () == TYPE_CODE_STRING
- || type->code () == TYPE_CODE_RANGE,
- self, SCM_ARG1, FUNC_NAME, _("ranged type"));
+ || type->code () == TYPE_CODE_STRING
+ || type->code () == TYPE_CODE_RANGE,
+ self, SCM_ARG1, FUNC_NAME, _ ("ranged type"));
switch (type->code ())
{
@@ -950,7 +945,7 @@ gdbscm_type_unqualified (SCM self)
GDBSCM_HANDLE_GDB_EXCEPTION (exc);
return tyscm_scm_from_type (type);
}
-
+
/* Field related accessors of types. */
/* (type-num-fields <gdb:type>) -> integer
@@ -966,7 +961,7 @@ gdbscm_type_num_fields (SCM self)
type = tyscm_get_composite (type);
if (type == NULL)
gdbscm_out_of_range_error (FUNC_NAME, SCM_ARG1, self,
- _(not_composite_error));
+ _ (not_composite_error));
return scm_from_long (type->num_fields ());
}
@@ -982,7 +977,7 @@ gdbscm_type_field (SCM self, SCM field_scm)
struct type *type = t_smob->type;
SCM_ASSERT_TYPE (scm_is_string (field_scm), field_scm, SCM_ARG2, FUNC_NAME,
- _("string"));
+ _ ("string"));
/* We want just fields of this type, not of base types, so instead of
using lookup_struct_elt_type, portions of that function are
@@ -991,7 +986,7 @@ gdbscm_type_field (SCM self, SCM field_scm)
type = tyscm_get_composite (type);
if (type == NULL)
gdbscm_out_of_range_error (FUNC_NAME, SCM_ARG1, self,
- _(not_composite_error));
+ _ (not_composite_error));
{
gdb::unique_xmalloc_ptr<char> field = gdbscm_scm_to_c_string (field_scm);
@@ -1009,7 +1004,7 @@ gdbscm_type_field (SCM self, SCM field_scm)
}
gdbscm_out_of_range_error (FUNC_NAME, SCM_ARG1, field_scm,
- _("Unknown field"));
+ _ ("Unknown field"));
}
/* (type-has-field? <gdb:type> string) -> boolean
@@ -1023,7 +1018,7 @@ gdbscm_type_has_field_p (SCM self, SCM field_scm)
struct type *type = t_smob->type;
SCM_ASSERT_TYPE (scm_is_string (field_scm), field_scm, SCM_ARG2, FUNC_NAME,
- _("string"));
+ _ ("string"));
/* We want just fields of this type, not of base types, so instead of
using lookup_struct_elt_type, portions of that function are
@@ -1032,11 +1027,10 @@ gdbscm_type_has_field_p (SCM self, SCM field_scm)
type = tyscm_get_composite (type);
if (type == NULL)
gdbscm_out_of_range_error (FUNC_NAME, SCM_ARG1, self,
- _(not_composite_error));
+ _ (not_composite_error));
{
- gdb::unique_xmalloc_ptr<char> field
- = gdbscm_scm_to_c_string (field_scm);
+ gdb::unique_xmalloc_ptr<char> field = gdbscm_scm_to_c_string (field_scm);
for (int i = 0; i < type->num_fields (); i++)
{
@@ -1065,7 +1059,7 @@ gdbscm_make_field_iterator (SCM self)
containing_type = tyscm_get_composite (type);
if (containing_type == NULL)
gdbscm_out_of_range_error (FUNC_NAME, SCM_ARG1, self,
- _(not_composite_error));
+ _ (not_composite_error));
/* If SELF is a typedef or reference, we want the underlying type,
which is what tyscm_get_composite returns. */
@@ -1098,14 +1092,13 @@ gdbscm_type_next_field_x (SCM self)
object = itscm_iterator_smob_object (i_smob);
progress = itscm_iterator_smob_progress (i_smob);
- SCM_ASSERT_TYPE (tyscm_is_type (object), object,
- SCM_ARG1, FUNC_NAME, type_smob_name);
+ SCM_ASSERT_TYPE (tyscm_is_type (object), object, SCM_ARG1, FUNC_NAME,
+ type_smob_name);
t_smob = (type_smob *) SCM_SMOB_DATA (object);
type = t_smob->type;
- SCM_ASSERT_TYPE (scm_is_signed_integer (progress,
- 0, type->num_fields ()),
- progress, SCM_ARG1, FUNC_NAME, _("integer"));
+ SCM_ASSERT_TYPE (scm_is_signed_integer (progress, 0, type->num_fields ()),
+ progress, SCM_ARG1, FUNC_NAME, _ ("integer"));
field = scm_to_int (progress);
if (field < type->num_fields ())
@@ -1117,7 +1110,7 @@ gdbscm_type_next_field_x (SCM self)
return gdbscm_end_of_iteration ();
}
-
+
/* Field smob accessors. */
/* (field-name <gdb:field>) -> string
@@ -1162,8 +1155,8 @@ gdbscm_field_enumval (SCM self)
struct field *field = tyscm_field_smob_to_field (f_smob);
struct type *type = tyscm_field_smob_containing_type (f_smob);
- SCM_ASSERT_TYPE (type->code () == TYPE_CODE_ENUM,
- self, SCM_ARG1, FUNC_NAME, _("enum type"));
+ SCM_ASSERT_TYPE (type->code () == TYPE_CODE_ENUM, self, SCM_ARG1, FUNC_NAME,
+ _ ("enum type"));
return scm_from_long (field->loc_enumval ());
}
@@ -1179,8 +1172,8 @@ gdbscm_field_bitpos (SCM self)
struct field *field = tyscm_field_smob_to_field (f_smob);
struct type *type = tyscm_field_smob_containing_type (f_smob);
- SCM_ASSERT_TYPE (type->code () != TYPE_CODE_ENUM,
- self, SCM_ARG1, FUNC_NAME, _("non-enum type"));
+ SCM_ASSERT_TYPE (type->code () != TYPE_CODE_ENUM, self, SCM_ARG1, FUNC_NAME,
+ _ ("non-enum type"));
return scm_from_long (field->loc_bitpos ());
}
@@ -1225,7 +1218,7 @@ gdbscm_field_baseclass_p (SCM self)
return scm_from_bool (f_smob->field_num < TYPE_N_BASECLASSES (type));
return SCM_BOOL_F;
}
-
+
/* Return the type named TYPE_NAME in BLOCK.
Returns NULL if not found.
This routine does not throw an error. */
@@ -1244,8 +1237,7 @@ tyscm_lookup_typename (const char *type_name, const struct block *block)
else if (startswith (type_name, "enum "))
type = lookup_enum (type_name + 5, NULL);
else
- type = lookup_typename (current_language,
- type_name, block, 0);
+ type = lookup_typename (current_language, type_name, block, 0);
}
catch (const gdb_exception &except)
{
@@ -1268,16 +1260,15 @@ gdbscm_lookup_type (SCM name_scm, SCM rest)
const struct block *block = NULL;
struct type *type;
- gdbscm_parse_function_args (FUNC_NAME, SCM_ARG1, keywords, "s#O",
- name_scm, &name,
- rest, &block_arg_pos, &block_scm);
+ gdbscm_parse_function_args (FUNC_NAME, SCM_ARG1, keywords, "s#O", name_scm,
+ &name, rest, &block_arg_pos, &block_scm);
if (block_arg_pos != -1)
{
SCM exception;
- block = bkscm_scm_to_block (block_scm, block_arg_pos, FUNC_NAME,
- &exception);
+ block
+ = bkscm_scm_to_block (block_scm, block_arg_pos, FUNC_NAME, &exception);
if (block == NULL)
{
xfree (name);
@@ -1291,12 +1282,10 @@ gdbscm_lookup_type (SCM name_scm, SCM rest)
return tyscm_scm_from_type (type);
return SCM_BOOL_F;
}
-
-/* Initialize the Scheme type code. */
+/* Initialize the Scheme type code. */
-static const scheme_integer_constant type_integer_constants[] =
-{
+static const scheme_integer_constant type_integer_constants[] = {
/* This is kept for backward compatibility. */
{ "TYPE_CODE_BITSTRING", -1 },
@@ -1307,46 +1296,36 @@ static const scheme_integer_constant type_integer_constants[] =
END_INTEGER_CONSTANTS
};
-static const scheme_function type_functions[] =
-{
- { "type?", 1, 0, 0, as_a_scm_t_subr (gdbscm_type_p),
- "\
+static const scheme_function type_functions[] = {
+ { "type?", 1, 0, 0, as_a_scm_t_subr (gdbscm_type_p), "\
Return #t if the object is a <gdb:type> object." },
- { "lookup-type", 1, 0, 1, as_a_scm_t_subr (gdbscm_lookup_type),
- "\
+ { "lookup-type", 1, 0, 1, as_a_scm_t_subr (gdbscm_lookup_type), "\
Return the <gdb:type> object representing string or #f if not found.\n\
If block is given then the type is looked for in that block.\n\
\n\
Arguments: string [#:block <gdb:block>]" },
- { "type-code", 1, 0, 0, as_a_scm_t_subr (gdbscm_type_code),
- "\
+ { "type-code", 1, 0, 0, as_a_scm_t_subr (gdbscm_type_code), "\
Return the code of the type" },
- { "type-tag", 1, 0, 0, as_a_scm_t_subr (gdbscm_type_tag),
- "\
+ { "type-tag", 1, 0, 0, as_a_scm_t_subr (gdbscm_type_tag), "\
Return the tag name of the type, or #f if there isn't one." },
- { "type-name", 1, 0, 0, as_a_scm_t_subr (gdbscm_type_name),
- "\
+ { "type-name", 1, 0, 0, as_a_scm_t_subr (gdbscm_type_name), "\
Return the name of the type as a string, or #f if there isn't one." },
- { "type-print-name", 1, 0, 0, as_a_scm_t_subr (gdbscm_type_print_name),
- "\
+ { "type-print-name", 1, 0, 0, as_a_scm_t_subr (gdbscm_type_print_name), "\
Return the print name of the type as a string." },
- { "type-sizeof", 1, 0, 0, as_a_scm_t_subr (gdbscm_type_sizeof),
- "\
+ { "type-sizeof", 1, 0, 0, as_a_scm_t_subr (gdbscm_type_sizeof), "\
Return the size of the type, in bytes." },
{ "type-strip-typedefs", 1, 0, 0,
- as_a_scm_t_subr (gdbscm_type_strip_typedefs),
- "\
+ as_a_scm_t_subr (gdbscm_type_strip_typedefs), "\
Return a type formed by stripping the type of all typedefs." },
- { "type-array", 2, 1, 0, as_a_scm_t_subr (gdbscm_type_array),
- "\
+ { "type-array", 2, 1, 0, as_a_scm_t_subr (gdbscm_type_array), "\
Return a type representing an array of objects of the type.\n\
\n\
Arguments: <gdb:type> [low-bound] high-bound\n\
@@ -1355,8 +1334,7 @@ Return a type representing an array of objects of the type.\n\
the array size.\n\
Valid bounds for array indices are [low-bound,high-bound]." },
- { "type-vector", 2, 1, 0, as_a_scm_t_subr (gdbscm_type_vector),
- "\
+ { "type-vector", 2, 1, 0, as_a_scm_t_subr (gdbscm_type_vector), "\
Return a type representing a vector of objects of the type.\n\
Vectors differ from arrays in that if the current language has C-style\n\
arrays, vectors don't decay to a pointer to the first element.\n\
@@ -1368,89 +1346,70 @@ They are first class values.\n\
the array size.\n\
Valid bounds for array indices are [low-bound,high-bound]." },
- { "type-pointer", 1, 0, 0, as_a_scm_t_subr (gdbscm_type_pointer),
- "\
+ { "type-pointer", 1, 0, 0, as_a_scm_t_subr (gdbscm_type_pointer), "\
Return a type of pointer to the type." },
- { "type-range", 1, 0, 0, as_a_scm_t_subr (gdbscm_type_range),
- "\
+ { "type-range", 1, 0, 0, as_a_scm_t_subr (gdbscm_type_range), "\
Return (low high) representing the range for the type." },
- { "type-reference", 1, 0, 0, as_a_scm_t_subr (gdbscm_type_reference),
- "\
+ { "type-reference", 1, 0, 0, as_a_scm_t_subr (gdbscm_type_reference), "\
Return a type of reference to the type." },
- { "type-target", 1, 0, 0, as_a_scm_t_subr (gdbscm_type_target),
- "\
+ { "type-target", 1, 0, 0, as_a_scm_t_subr (gdbscm_type_target), "\
Return the target type of the type." },
- { "type-const", 1, 0, 0, as_a_scm_t_subr (gdbscm_type_const),
- "\
+ { "type-const", 1, 0, 0, as_a_scm_t_subr (gdbscm_type_const), "\
Return a const variant of the type." },
- { "type-volatile", 1, 0, 0, as_a_scm_t_subr (gdbscm_type_volatile),
- "\
+ { "type-volatile", 1, 0, 0, as_a_scm_t_subr (gdbscm_type_volatile), "\
Return a volatile variant of the type." },
- { "type-unqualified", 1, 0, 0, as_a_scm_t_subr (gdbscm_type_unqualified),
- "\
+ { "type-unqualified", 1, 0, 0, as_a_scm_t_subr (gdbscm_type_unqualified), "\
Return a variant of the type without const or volatile attributes." },
- { "type-num-fields", 1, 0, 0, as_a_scm_t_subr (gdbscm_type_num_fields),
- "\
+ { "type-num-fields", 1, 0, 0, as_a_scm_t_subr (gdbscm_type_num_fields), "\
Return the number of fields of the type." },
- { "type-fields", 1, 0, 0, as_a_scm_t_subr (gdbscm_type_fields),
- "\
+ { "type-fields", 1, 0, 0, as_a_scm_t_subr (gdbscm_type_fields), "\
Return the list of <gdb:field> objects of fields of the type." },
{ "make-field-iterator", 1, 0, 0,
- as_a_scm_t_subr (gdbscm_make_field_iterator),
- "\
+ as_a_scm_t_subr (gdbscm_make_field_iterator), "\
Return a <gdb:iterator> object for iterating over the fields of the type." },
- { "type-field", 2, 0, 0, as_a_scm_t_subr (gdbscm_type_field),
- "\
+ { "type-field", 2, 0, 0, as_a_scm_t_subr (gdbscm_type_field), "\
Return the field named by string of the type.\n\
\n\
Arguments: <gdb:type> string" },
- { "type-has-field?", 2, 0, 0, as_a_scm_t_subr (gdbscm_type_has_field_p),
- "\
+ { "type-has-field?", 2, 0, 0, as_a_scm_t_subr (gdbscm_type_has_field_p), "\
Return #t if the type has field named string.\n\
\n\
Arguments: <gdb:type> string" },
- { "field?", 1, 0, 0, as_a_scm_t_subr (gdbscm_field_p),
- "\
+ { "field?", 1, 0, 0, as_a_scm_t_subr (gdbscm_field_p), "\
Return #t if the object is a <gdb:field> object." },
- { "field-name", 1, 0, 0, as_a_scm_t_subr (gdbscm_field_name),
- "\
+ { "field-name", 1, 0, 0, as_a_scm_t_subr (gdbscm_field_name), "\
Return the name of the field." },
- { "field-type", 1, 0, 0, as_a_scm_t_subr (gdbscm_field_type),
- "\
+ { "field-type", 1, 0, 0, as_a_scm_t_subr (gdbscm_field_type), "\
Return the type of the field." },
- { "field-enumval", 1, 0, 0, as_a_scm_t_subr (gdbscm_field_enumval),
- "\
+ { "field-enumval", 1, 0, 0, as_a_scm_t_subr (gdbscm_field_enumval), "\
Return the enum value represented by the field." },
- { "field-bitpos", 1, 0, 0, as_a_scm_t_subr (gdbscm_field_bitpos),
- "\
+ { "field-bitpos", 1, 0, 0, as_a_scm_t_subr (gdbscm_field_bitpos), "\
Return the offset in bits of the field in its containing type." },
- { "field-bitsize", 1, 0, 0, as_a_scm_t_subr (gdbscm_field_bitsize),
- "\
+ { "field-bitsize", 1, 0, 0, as_a_scm_t_subr (gdbscm_field_bitsize), "\
Return the size of the field in bits." },
{ "field-artificial?", 1, 0, 0, as_a_scm_t_subr (gdbscm_field_artificial_p),
"\
Return #t if the field is artificial." },
- { "field-baseclass?", 1, 0, 0, as_a_scm_t_subr (gdbscm_field_baseclass_p),
- "\
+ { "field-baseclass?", 1, 0, 0, as_a_scm_t_subr (gdbscm_field_baseclass_p), "\
Return #t if the field is a baseclass." },
END_FUNCTIONS
@@ -1464,8 +1423,8 @@ gdbscm_initialize_types (void)
scm_set_smob_print (type_smob_tag, tyscm_print_type_smob);
scm_set_smob_equalp (type_smob_tag, tyscm_equal_p_type_smob);
- field_smob_tag = gdbscm_make_smob_type (field_smob_name,
- sizeof (field_smob));
+ field_smob_tag
+ = gdbscm_make_smob_type (field_smob_name, sizeof (field_smob));
scm_set_smob_print (field_smob_tag, tyscm_print_field_smob);
gdbscm_define_integer_constants (type_integer_constants, 1);
diff --git a/gdb/guile/scm-utils.c b/gdb/guile/scm-utils.c
index 4ddb09a26ff..0975e7e6e6e 100644
--- a/gdb/guile/scm-utils.c
+++ b/gdb/guile/scm-utils.c
@@ -72,7 +72,7 @@ gdbscm_define_integer_constants (const scheme_integer_constant *constants,
scm_c_export (sc->name, NULL);
}
}
-
+
/* scm_printf, alas it doesn't exist. */
void
@@ -109,7 +109,7 @@ gdbscm_debug_write (SCM obj)
scm_newline (port);
scm_force_output (port);
}
-
+
/* Subroutine of gdbscm_parse_function_args to simplify it.
Return the number of keyword arguments. */
@@ -177,14 +177,16 @@ validate_arg_format (const char *format)
}
/* Our version of SCM_ASSERT_TYPE that calls gdbscm_make_type_error. */
-#define CHECK_TYPE(ok, arg, position, func_name, expected_type) \
- do { \
- if (!(ok)) \
- { \
- return gdbscm_make_type_error ((func_name), (position), (arg), \
- (expected_type)); \
- } \
- } while (0)
+#define CHECK_TYPE(ok, arg, position, func_name, expected_type) \
+ do \
+ { \
+ if (!(ok)) \
+ { \
+ return gdbscm_make_type_error ((func_name), (position), (arg), \
+ (expected_type)); \
+ } \
+ } \
+ while (0)
/* Subroutine of gdbscm_parse_function_args to simplify it.
Check the type of ARG against FORMAT_CHAR and extract the value.
@@ -192,8 +194,8 @@ validate_arg_format (const char *format)
The result is #f upon success or a <gdb:exception> object. */
static SCM
-extract_arg (char format_char, SCM arg, void *argp,
- const char *func_name, int position)
+extract_arg (char format_char, SCM arg, void *argp, const char *func_name,
+ int position)
{
switch (format_char)
{
@@ -202,7 +204,7 @@ extract_arg (char format_char, SCM arg, void *argp,
char **arg_ptr = (char **) argp;
CHECK_TYPE (gdbscm_is_true (scm_string_p (arg)), arg, position,
- func_name, _("string"));
+ func_name, _ ("string"));
*arg_ptr = gdbscm_scm_to_c_string (arg).release ();
break;
}
@@ -212,7 +214,7 @@ extract_arg (char format_char, SCM arg, void *argp,
/* While in Scheme, anything non-#f is "true", we're strict. */
CHECK_TYPE (gdbscm_is_bool (arg), arg, position, func_name,
- _("boolean"));
+ _ ("boolean"));
*arg_ptr = gdbscm_is_true (arg);
break;
}
@@ -220,8 +222,8 @@ extract_arg (char format_char, SCM arg, void *argp,
{
int *arg_ptr = (int *) argp;
- CHECK_TYPE (scm_is_signed_integer (arg, INT_MIN, INT_MAX),
- arg, position, func_name, _("int"));
+ CHECK_TYPE (scm_is_signed_integer (arg, INT_MIN, INT_MAX), arg,
+ position, func_name, _ ("int"));
*arg_ptr = scm_to_int (arg);
break;
}
@@ -229,8 +231,8 @@ extract_arg (char format_char, SCM arg, void *argp,
{
int *arg_ptr = (int *) argp;
- CHECK_TYPE (scm_is_unsigned_integer (arg, 0, UINT_MAX),
- arg, position, func_name, _("unsigned int"));
+ CHECK_TYPE (scm_is_unsigned_integer (arg, 0, UINT_MAX), arg, position,
+ func_name, _ ("unsigned int"));
*arg_ptr = scm_to_uint (arg);
break;
}
@@ -238,8 +240,8 @@ extract_arg (char format_char, SCM arg, void *argp,
{
long *arg_ptr = (long *) argp;
- CHECK_TYPE (scm_is_signed_integer (arg, LONG_MIN, LONG_MAX),
- arg, position, func_name, _("long"));
+ CHECK_TYPE (scm_is_signed_integer (arg, LONG_MIN, LONG_MAX), arg,
+ position, func_name, _ ("long"));
*arg_ptr = scm_to_long (arg);
break;
}
@@ -247,8 +249,8 @@ extract_arg (char format_char, SCM arg, void *argp,
{
unsigned long *arg_ptr = (unsigned long *) argp;
- CHECK_TYPE (scm_is_unsigned_integer (arg, 0, ULONG_MAX),
- arg, position, func_name, _("unsigned long"));
+ CHECK_TYPE (scm_is_unsigned_integer (arg, 0, ULONG_MAX), arg, position,
+ func_name, _ ("unsigned long"));
*arg_ptr = scm_to_ulong (arg);
break;
}
@@ -256,8 +258,8 @@ extract_arg (char format_char, SCM arg, void *argp,
{
LONGEST *arg_ptr = (LONGEST *) argp;
- CHECK_TYPE (scm_is_signed_integer (arg, INT64_MIN, INT64_MAX),
- arg, position, func_name, _("LONGEST"));
+ CHECK_TYPE (scm_is_signed_integer (arg, INT64_MIN, INT64_MAX), arg,
+ position, func_name, _ ("LONGEST"));
*arg_ptr = gdbscm_scm_to_longest (arg);
break;
}
@@ -265,8 +267,8 @@ extract_arg (char format_char, SCM arg, void *argp,
{
ULONGEST *arg_ptr = (ULONGEST *) argp;
- CHECK_TYPE (scm_is_unsigned_integer (arg, 0, UINT64_MAX),
- arg, position, func_name, _("ULONGEST"));
+ CHECK_TYPE (scm_is_unsigned_integer (arg, 0, UINT64_MAX), arg,
+ position, func_name, _ ("ULONGEST"));
*arg_ptr = gdbscm_scm_to_ulongest (arg);
break;
}
@@ -304,17 +306,15 @@ lookup_keyword (const SCM *keyword_list, SCM keyword)
return -1;
}
-
/* Helper for gdbscm_parse_function_args that does most of the work,
in a separate function wrapped with gdbscm_wrap so that we can use
non-trivial-dtor objects here. The result is #f upon success or a
<gdb:exception> object otherwise. */
static SCM
-gdbscm_parse_function_args_1 (const char *func_name,
- int beginning_arg_pos,
- const SCM *keywords,
- const char *format, va_list args)
+gdbscm_parse_function_args_1 (const char *func_name, int beginning_arg_pos,
+ const SCM *keywords, const char *format,
+ va_list args)
{
const char *p;
int i, have_rest, num_keywords, position;
@@ -377,8 +377,7 @@ gdbscm_parse_function_args_1 (const char *func_name,
keyword_positions[i] = -1;
}
- while (scm_is_pair (rest)
- && scm_is_keyword (scm_car (rest)))
+ while (scm_is_pair (rest) && scm_is_keyword (scm_car (rest)))
{
SCM keyword = scm_car (rest);
@@ -386,16 +385,16 @@ gdbscm_parse_function_args_1 (const char *func_name,
if (i < 0)
{
status = gdbscm_make_error (scm_arg_type_key, func_name,
- _("Unrecognized keyword: ~a"),
+ _ ("Unrecognized keyword: ~a"),
scm_list_1 (keyword), keyword);
goto fail;
}
if (!scm_is_pair (scm_cdr (rest)))
{
- status = gdbscm_make_error
- (scm_arg_type_key, func_name,
- _("Missing value for keyword argument"),
- scm_list_1 (keyword), keyword);
+ status
+ = gdbscm_make_error (scm_arg_type_key, func_name,
+ _ ("Missing value for keyword argument"),
+ scm_list_1 (keyword), keyword);
goto fail;
}
keyword_args[i] = scm_cadr (rest);
@@ -410,7 +409,7 @@ gdbscm_parse_function_args_1 (const char *func_name,
void *arg_ptr = va_arg (args, void *);
SCM arg = keyword_args[i];
- if (! scm_is_eq (arg, SCM_UNSPECIFIED))
+ if (!scm_is_eq (arg, SCM_UNSPECIFIED))
{
*arg_pos_ptr = keyword_positions[i];
status = extract_arg (p[i], arg, arg_ptr, func_name,
@@ -436,11 +435,11 @@ gdbscm_parse_function_args_1 (const char *func_name,
}
else
{
- if (! scm_is_null (rest))
+ if (!scm_is_null (rest))
{
status = gdbscm_make_error (scm_args_number_key, func_name,
- _("Too many arguments"),
- SCM_EOL, SCM_BOOL_F);
+ _ ("Too many arguments"), SCM_EOL,
+ SCM_BOOL_F);
goto fail;
}
}
@@ -448,7 +447,7 @@ gdbscm_parse_function_args_1 (const char *func_name,
/* Return anything not-an-exception. */
return SCM_BOOL_F;
- fail:
+fail:
for (char *ptr : allocated_strings)
xfree (ptr);
@@ -525,21 +524,18 @@ gdbscm_parse_function_args_1 (const char *func_name,
argument. Unbound optional arguments are ignored. */
void
-gdbscm_parse_function_args (const char *func_name,
- int beginning_arg_pos,
- const SCM *keywords,
- const char *format, ...)
+gdbscm_parse_function_args (const char *func_name, int beginning_arg_pos,
+ const SCM *keywords, const char *format, ...)
{
va_list args;
va_start (args, format);
- gdbscm_wrap (gdbscm_parse_function_args_1, func_name,
- beginning_arg_pos, keywords, format, args);
+ gdbscm_wrap (gdbscm_parse_function_args_1, func_name, beginning_arg_pos,
+ keywords, format, args);
va_end (args);
}
-
/* Return longest L as a scheme object. */
SCM
@@ -609,7 +605,7 @@ gdbscm_gc_xstrdup (const char *str)
/* Return a duplicate of ARGV living on the GC heap. */
-const char * const *
+const char *const *
gdbscm_gc_dup_argv (char **argv)
{
int i, len;
@@ -622,7 +618,7 @@ gdbscm_gc_dup_argv (char **argv)
/* Allocating "pointerless" works because the pointers are all
self-contained within the object. */
result = (char **) scm_gc_malloc_pointerless (((len + 1) * sizeof (char *))
- + string_space,
+ + string_space,
"parameter enum list");
p = (char *) &result[len + 1];
@@ -634,7 +630,7 @@ gdbscm_gc_dup_argv (char **argv)
}
result[i] = NULL;
- return (const char * const *) result;
+ return (const char *const *) result;
}
/* Return non-zero if the version of Guile being used it at least
diff --git a/gdb/guile/scm-value.c b/gdb/guile/scm-value.c
index b9948303bc1..d79574561ea 100644
--- a/gdb/guile/scm-value.c
+++ b/gdb/guile/scm-value.c
@@ -77,7 +77,7 @@ static SCM length_keyword;
static SCM error_symbol;
static SCM escape_symbol;
static SCM substitute_symbol;
-
+
/* Administrivia for value smobs. */
/* Iterate over all the <gdb:value> objects, calling preserve_one_value on
@@ -207,8 +207,8 @@ vlscm_equal_p_value_smob (SCM v1, SCM v2)
static SCM
vlscm_make_value_smob (void)
{
- value_smob *v_smob = (value_smob *)
- scm_gc_malloc (sizeof (value_smob), value_smob_name);
+ value_smob *v_smob
+ = (value_smob *) scm_gc_malloc (sizeof (value_smob), value_smob_name);
SCM v_scm;
/* These must be filled in by the caller. */
@@ -315,7 +315,7 @@ vlscm_scm_to_value (SCM v_scm)
v_smob = (value_smob *) SCM_SMOB_DATA (v_scm);
return v_smob->value;
}
-
+
/* Value methods. */
/* (make-value x [#:type type]) -> <gdb:value> */
@@ -333,28 +333,23 @@ gdbscm_make_value (SCM x, SCM rest)
struct type *type = NULL;
if (type_arg_pos > 0)
{
- type_smob *t_smob = tyscm_get_type_smob_arg_unsafe (type_scm,
- type_arg_pos,
- FUNC_NAME);
+ type_smob *t_smob
+ = tyscm_get_type_smob_arg_unsafe (type_scm, type_arg_pos, FUNC_NAME);
type = tyscm_type_smob_type (t_smob);
}
- return gdbscm_wrap ([=]
- {
- scoped_value_mark free_values;
+ return gdbscm_wrap ([=] {
+ scoped_value_mark free_values;
- SCM except_scm;
- struct value *value
- = vlscm_convert_typed_value_from_scheme (FUNC_NAME, SCM_ARG1, x,
- type_arg_pos, type_scm, type,
- &except_scm,
- get_current_arch (),
- current_language);
- if (value == NULL)
- return except_scm;
-
- return vlscm_scm_from_value (value);
- });
+ SCM except_scm;
+ struct value *value = vlscm_convert_typed_value_from_scheme (
+ FUNC_NAME, SCM_ARG1, x, type_arg_pos, type_scm, type, &except_scm,
+ get_current_arch (), current_language);
+ if (value == NULL)
+ return except_scm;
+
+ return vlscm_scm_from_value (value);
+ });
}
/* (make-lazy-value <gdb:type> address) -> <gdb:value> */
@@ -362,22 +357,21 @@ gdbscm_make_value (SCM x, SCM rest)
static SCM
gdbscm_make_lazy_value (SCM type_scm, SCM address_scm)
{
- type_smob *t_smob = tyscm_get_type_smob_arg_unsafe (type_scm,
- SCM_ARG1, FUNC_NAME);
+ type_smob *t_smob
+ = tyscm_get_type_smob_arg_unsafe (type_scm, SCM_ARG1, FUNC_NAME);
struct type *type = tyscm_type_smob_type (t_smob);
ULONGEST address;
- gdbscm_parse_function_args (FUNC_NAME, SCM_ARG2, NULL, "U",
- address_scm, &address);
+ gdbscm_parse_function_args (FUNC_NAME, SCM_ARG2, NULL, "U", address_scm,
+ &address);
- return gdbscm_wrap ([=]
- {
- scoped_value_mark free_values;
+ return gdbscm_wrap ([=] {
+ scoped_value_mark free_values;
- struct value *value = value_from_contents_and_address (type, NULL,
- address);
- return vlscm_scm_from_value (value);
- });
+ struct value *value
+ = value_from_contents_and_address (type, NULL, address);
+ return vlscm_scm_from_value (value);
+ });
}
/* (value-optimized-out? <gdb:value>) -> boolean */
@@ -388,10 +382,9 @@ gdbscm_value_optimized_out_p (SCM self)
value_smob *v_smob
= vlscm_get_value_smob_arg_unsafe (self, SCM_ARG1, FUNC_NAME);
- return gdbscm_wrap ([=]
- {
- return scm_from_bool (value_optimized_out (v_smob->value));
- });
+ return gdbscm_wrap ([=] {
+ return scm_from_bool (value_optimized_out (v_smob->value));
+ });
}
/* (value-address <gdb:value>) -> integer
@@ -404,30 +397,29 @@ gdbscm_value_address (SCM self)
= vlscm_get_value_smob_arg_unsafe (self, SCM_ARG1, FUNC_NAME);
struct value *value = v_smob->value;
- return gdbscm_wrap ([=]
- {
- if (SCM_UNBNDP (v_smob->address))
- {
- scoped_value_mark free_values;
+ return gdbscm_wrap ([=] {
+ if (SCM_UNBNDP (v_smob->address))
+ {
+ scoped_value_mark free_values;
- SCM address = SCM_BOOL_F;
+ SCM address = SCM_BOOL_F;
- try
- {
- address = vlscm_scm_from_value (value_addr (value));
- }
- catch (const gdb_exception &except)
- {
- }
+ try
+ {
+ address = vlscm_scm_from_value (value_addr (value));
+ }
+ catch (const gdb_exception &except)
+ {
+ }
- if (gdbscm_is_exception (address))
- return address;
+ if (gdbscm_is_exception (address))
+ return address;
- v_smob->address = address;
- }
+ v_smob->address = address;
+ }
- return v_smob->address;
- });
+ return v_smob->address;
+ });
}
/* (value-dereference <gdb:value>) -> <gdb:value>
@@ -439,13 +431,12 @@ gdbscm_value_dereference (SCM self)
value_smob *v_smob
= vlscm_get_value_smob_arg_unsafe (self, SCM_ARG1, FUNC_NAME);
- return gdbscm_wrap ([=]
- {
- scoped_value_mark free_values;
+ return gdbscm_wrap ([=] {
+ scoped_value_mark free_values;
- struct value *res_val = value_ind (v_smob->value);
- return vlscm_scm_from_value (res_val);
- });
+ struct value *res_val = value_ind (v_smob->value);
+ return vlscm_scm_from_value (res_val);
+ });
}
/* (value-referenced-value <gdb:value>) -> <gdb:value>
@@ -464,28 +455,27 @@ gdbscm_value_referenced_value (SCM self)
= vlscm_get_value_smob_arg_unsafe (self, SCM_ARG1, FUNC_NAME);
struct value *value = v_smob->value;
- return gdbscm_wrap ([=]
- {
- scoped_value_mark free_values;
-
- struct value *res_val;
-
- switch (check_typedef (value_type (value))->code ())
- {
- case TYPE_CODE_PTR:
- res_val = value_ind (value);
- break;
- case TYPE_CODE_REF:
- case TYPE_CODE_RVALUE_REF:
- res_val = coerce_ref (value);
- break;
- default:
- error (_("Trying to get the referenced value from a value which is"
- " neither a pointer nor a reference"));
- }
-
- return vlscm_scm_from_value (res_val);
- });
+ return gdbscm_wrap ([=] {
+ scoped_value_mark free_values;
+
+ struct value *res_val;
+
+ switch (check_typedef (value_type (value))->code ())
+ {
+ case TYPE_CODE_PTR:
+ res_val = value_ind (value);
+ break;
+ case TYPE_CODE_REF:
+ case TYPE_CODE_RVALUE_REF:
+ res_val = coerce_ref (value);
+ break;
+ default:
+ error (_ ("Trying to get the referenced value from a value which is"
+ " neither a pointer nor a reference"));
+ }
+
+ return vlscm_scm_from_value (res_val);
+ });
}
static SCM
@@ -495,13 +485,12 @@ gdbscm_reference_value (SCM self, enum type_code refcode)
= vlscm_get_value_smob_arg_unsafe (self, SCM_ARG1, FUNC_NAME);
struct value *value = v_smob->value;
- return gdbscm_wrap ([=]
- {
- scoped_value_mark free_values;
+ return gdbscm_wrap ([=] {
+ scoped_value_mark free_values;
- struct value *res_val = value_ref (value, refcode);
- return vlscm_scm_from_value (res_val);
- });
+ struct value *res_val = value_ref (value, refcode);
+ return vlscm_scm_from_value (res_val);
+ });
}
/* (value-reference-value <gdb:value>) -> <gdb:value> */
@@ -529,13 +518,12 @@ gdbscm_value_const_value (SCM self)
= vlscm_get_value_smob_arg_unsafe (self, SCM_ARG1, FUNC_NAME);
struct value *value = v_smob->value;
- return gdbscm_wrap ([=]
- {
- scoped_value_mark free_values;
+ return gdbscm_wrap ([=] {
+ scoped_value_mark free_values;
- struct value *res_val = make_cv_value (1, 0, value);
- return vlscm_scm_from_value (res_val);
- });
+ struct value *res_val = make_cv_value (1, 0, value);
+ return vlscm_scm_from_value (res_val);
+ });
}
/* (value-type <gdb:value>) -> <gdb:type> */
@@ -563,7 +551,7 @@ gdbscm_value_dynamic_type (SCM self)
struct value *value = v_smob->value;
struct type *type = NULL;
- if (! SCM_UNBNDP (v_smob->dynamic_type))
+ if (!SCM_UNBNDP (v_smob->dynamic_type))
return v_smob->dynamic_type;
gdbscm_gdb_exception exc {};
@@ -630,23 +618,22 @@ vlscm_do_cast (SCM self, SCM type_scm, enum exp_opcode op,
= tyscm_get_type_smob_arg_unsafe (type_scm, SCM_ARG2, FUNC_NAME);
struct type *type = tyscm_type_smob_type (t_smob);
- return gdbscm_wrap ([=]
- {
- scoped_value_mark free_values;
-
- struct value *res_val;
- if (op == UNOP_DYNAMIC_CAST)
- res_val = value_dynamic_cast (type, value);
- else if (op == UNOP_REINTERPRET_CAST)
- res_val = value_reinterpret_cast (type, value);
- else
- {
- gdb_assert (op == UNOP_CAST);
- res_val = value_cast (type, value);
- }
-
- return vlscm_scm_from_value (res_val);
- });
+ return gdbscm_wrap ([=] {
+ scoped_value_mark free_values;
+
+ struct value *res_val;
+ if (op == UNOP_DYNAMIC_CAST)
+ res_val = value_dynamic_cast (type, value);
+ else if (op == UNOP_REINTERPRET_CAST)
+ res_val = value_reinterpret_cast (type, value);
+ else
+ {
+ gdb_assert (op == UNOP_CAST);
+ res_val = value_cast (type, value);
+ }
+
+ return vlscm_scm_from_value (res_val);
+ });
}
/* (value-cast <gdb:value> <gdb:type>) -> <gdb:value> */
@@ -684,21 +671,20 @@ gdbscm_value_field (SCM self, SCM field_scm)
= vlscm_get_value_smob_arg_unsafe (self, SCM_ARG1, FUNC_NAME);
SCM_ASSERT_TYPE (scm_is_string (field_scm), field_scm, SCM_ARG2, FUNC_NAME,
- _("string"));
+ _ ("string"));
- return gdbscm_wrap ([=]
- {
- scoped_value_mark free_values;
+ return gdbscm_wrap ([=] {
+ scoped_value_mark free_values;
- gdb::unique_xmalloc_ptr<char> field = gdbscm_scm_to_c_string (field_scm);
+ gdb::unique_xmalloc_ptr<char> field = gdbscm_scm_to_c_string (field_scm);
- struct value *tmp = v_smob->value;
+ struct value *tmp = v_smob->value;
- struct value *res_val = value_struct_elt (&tmp, {}, field.get (), NULL,
- "struct/class/union");
+ struct value *res_val
+ = value_struct_elt (&tmp, {}, field.get (), NULL, "struct/class/union");
- return vlscm_scm_from_value (res_val);
- });
+ return vlscm_scm_from_value (res_val);
+ });
}
/* (value-subscript <gdb:value> integer|<gdb:value>) -> <gdb:value>
@@ -714,32 +700,30 @@ gdbscm_value_subscript (SCM self, SCM index_scm)
SCM_ASSERT (type != NULL, self, SCM_ARG2, FUNC_NAME);
- return gdbscm_wrap ([=]
- {
- scoped_value_mark free_values;
+ return gdbscm_wrap ([=] {
+ scoped_value_mark free_values;
- SCM except_scm;
- struct value *index
- = vlscm_convert_value_from_scheme (FUNC_NAME, SCM_ARG2, index_scm,
- &except_scm,
- type->arch (),
- current_language);
- if (index == NULL)
- return except_scm;
-
- /* Assume we are attempting an array access, and let the value code
+ SCM except_scm;
+ struct value *index
+ = vlscm_convert_value_from_scheme (FUNC_NAME, SCM_ARG2, index_scm,
+ &except_scm, type->arch (),
+ current_language);
+ if (index == NULL)
+ return except_scm;
+
+ /* Assume we are attempting an array access, and let the value code
throw an exception if the index has an invalid type.
Check the value's type is something that can be accessed via
a subscript. */
- struct value *tmp = coerce_ref (value);
- struct type *tmp_type = check_typedef (value_type (tmp));
- if (tmp_type->code () != TYPE_CODE_ARRAY
- && tmp_type->code () != TYPE_CODE_PTR)
- error (_("Cannot subscript requested type"));
-
- struct value *res_val = value_subscript (tmp, value_as_long (index));
- return vlscm_scm_from_value (res_val);
- });
+ struct value *tmp = coerce_ref (value);
+ struct type *tmp_type = check_typedef (value_type (tmp));
+ if (tmp_type->code () != TYPE_CODE_ARRAY
+ && tmp_type->code () != TYPE_CODE_PTR)
+ error (_ ("Cannot subscript requested type"));
+
+ struct value *res_val = value_subscript (tmp, value_as_long (index));
+ return vlscm_scm_from_value (res_val);
+ });
}
/* (value-call <gdb:value> arg-list) -> <gdb:value>
@@ -766,12 +750,11 @@ gdbscm_value_call (SCM self, SCM args)
}
GDBSCM_HANDLE_GDB_EXCEPTION (exc);
- SCM_ASSERT_TYPE (ftype->code () == TYPE_CODE_FUNC, self,
- SCM_ARG1, FUNC_NAME,
- _("function (value of TYPE_CODE_FUNC)"));
+ SCM_ASSERT_TYPE (ftype->code () == TYPE_CODE_FUNC, self, SCM_ARG1, FUNC_NAME,
+ _ ("function (value of TYPE_CODE_FUNC)"));
- SCM_ASSERT_TYPE (gdbscm_is_true (scm_list_p (args)), args,
- SCM_ARG2, FUNC_NAME, _("list"));
+ SCM_ASSERT_TYPE (gdbscm_is_true (scm_list_p (args)), args, SCM_ARG2,
+ FUNC_NAME, _ ("list"));
args_count = scm_ilength (args);
if (args_count > 0)
@@ -786,10 +769,9 @@ gdbscm_value_call (SCM self, SCM args)
{
SCM arg = scm_car (args);
- vargs[i] = vlscm_convert_value_from_scheme (FUNC_NAME,
- GDBSCM_ARG_NONE, arg,
- &except_scm,
- gdbarch, language);
+ vargs[i]
+ = vlscm_convert_value_from_scheme (FUNC_NAME, GDBSCM_ARG_NONE, arg,
+ &except_scm, gdbarch, language);
if (vargs[i] == NULL)
gdbscm_throw (except_scm);
@@ -798,14 +780,13 @@ gdbscm_value_call (SCM self, SCM args)
gdb_assert (gdbscm_is_true (scm_null_p (args)));
}
- return gdbscm_wrap ([=]
- {
- scoped_value_mark free_values;
+ return gdbscm_wrap ([=] {
+ scoped_value_mark free_values;
- auto av = gdb::make_array_view (vargs, args_count);
- value *return_value = call_function_by_hand (function, NULL, av);
- return vlscm_scm_from_value (return_value);
- });
+ auto av = gdb::make_array_view (vargs, args_count);
+ value *return_value = call_function_by_hand (function, NULL, av);
+ return vlscm_scm_from_value (return_value);
+ });
}
/* (value->bytevector <gdb:value>) -> bytevector */
@@ -847,10 +828,8 @@ gdbscm_value_to_bytevector (SCM self)
static int
is_intlike (struct type *type, int ptr_ok)
{
- return (type->code () == TYPE_CODE_INT
- || type->code () == TYPE_CODE_ENUM
- || type->code () == TYPE_CODE_BOOL
- || type->code () == TYPE_CODE_CHAR
+ return (type->code () == TYPE_CODE_INT || type->code () == TYPE_CODE_ENUM
+ || type->code () == TYPE_CODE_BOOL || type->code () == TYPE_CODE_CHAR
|| (ptr_ok && type->code () == TYPE_CODE_PTR));
}
@@ -880,7 +859,7 @@ gdbscm_value_to_bool (SCM self)
GDBSCM_HANDLE_GDB_EXCEPTION (exc);
SCM_ASSERT_TYPE (is_intlike (type, 1), self, SCM_ARG1, FUNC_NAME,
- _("integer-like gdb value"));
+ _ ("integer-like gdb value"));
try
{
@@ -924,7 +903,7 @@ gdbscm_value_to_integer (SCM self)
GDBSCM_HANDLE_GDB_EXCEPTION (exc);
SCM_ASSERT_TYPE (is_intlike (type, 1), self, SCM_ARG1, FUNC_NAME,
- _("integer-like gdb value"));
+ _ ("integer-like gdb value"));
try
{
@@ -972,7 +951,7 @@ gdbscm_value_to_real (SCM self)
GDBSCM_HANDLE_GDB_EXCEPTION (exc);
SCM_ASSERT_TYPE (is_intlike (type, 0) || type->code () == TYPE_CODE_FLT,
- self, SCM_ARG1, FUNC_NAME, _("number"));
+ self, SCM_ARG1, FUNC_NAME, _ ("number"));
try
{
@@ -1002,7 +981,7 @@ gdbscm_value_to_real (SCM self)
/* TODO: Is there a better way to check if the value fits? */
if (!value_equal (value, check))
gdbscm_out_of_range_error (FUNC_NAME, SCM_ARG1, self,
- _("number can't be converted to a double"));
+ _ ("number can't be converted to a double"));
return scm_from_double (d);
}
@@ -1036,9 +1015,8 @@ gdbscm_value_to_string (SCM self, SCM rest)
value_smob *v_smob
= vlscm_get_value_smob_arg_unsafe (self, SCM_ARG1, FUNC_NAME);
struct value *value = v_smob->value;
- const SCM keywords[] = {
- encoding_keyword, errors_keyword, length_keyword, SCM_BOOL_F
- };
+ const SCM keywords[]
+ = { encoding_keyword, errors_keyword, length_keyword, SCM_BOOL_F };
int encoding_arg_pos = -1, errors_arg_pos = -1, length_arg_pos = -1;
char *encoding = NULL;
SCM errors = SCM_BOOL_F;
@@ -1053,18 +1031,16 @@ gdbscm_value_to_string (SCM self, SCM rest)
We can't have existing cleanups when a Scheme exception is thrown. */
gdbscm_parse_function_args (FUNC_NAME, SCM_ARG2, keywords, "#sOi", rest,
- &encoding_arg_pos, &encoding,
- &errors_arg_pos, &errors,
- &length_arg_pos, &length);
+ &encoding_arg_pos, &encoding, &errors_arg_pos,
+ &errors, &length_arg_pos, &length);
- if (errors_arg_pos > 0
- && errors != SCM_BOOL_F
+ if (errors_arg_pos > 0 && errors != SCM_BOOL_F
&& !scm_is_eq (errors, error_symbol)
&& !scm_is_eq (errors, substitute_symbol))
{
SCM excp
= gdbscm_make_out_of_range_error (FUNC_NAME, errors_arg_pos, errors,
- _("invalid error kind"));
+ _ ("invalid error kind"));
xfree (encoding);
gdbscm_throw (excp);
@@ -1103,14 +1079,11 @@ gdbscm_value_to_string (SCM self, SCM rest)
gdbscm_dynwind_xfree (encoding);
gdbscm_dynwind_xfree (buffer_contents);
- result = scm_from_stringn ((const char *) buffer_contents,
- length * char_type->length (),
- (encoding != NULL && *encoding != '\0'
- ? encoding
- : la_encoding),
- scm_is_eq (errors, error_symbol)
- ? SCM_FAILED_CONVERSION_ERROR
- : SCM_FAILED_CONVERSION_QUESTION_MARK);
+ result = scm_from_stringn (
+ (const char *) buffer_contents, length * char_type->length (),
+ (encoding != NULL && *encoding != '\0' ? encoding : la_encoding),
+ scm_is_eq (errors, error_symbol) ? SCM_FAILED_CONVERSION_ERROR
+ : SCM_FAILED_CONVERSION_QUESTION_MARK);
scm_dynwind_end ();
@@ -1145,14 +1118,13 @@ gdbscm_value_to_lazy_string (SCM self, SCM rest)
We can't have existing cleanups when a Scheme exception is thrown. */
gdbscm_parse_function_args (FUNC_NAME, SCM_ARG2, keywords, "#si", rest,
- &encoding_arg_pos, &encoding,
- &length_arg_pos, &length);
+ &encoding_arg_pos, &encoding, &length_arg_pos,
+ &length);
if (length < -1)
{
gdbscm_out_of_range_error (FUNC_NAME, length_arg_pos,
- scm_from_int (length),
- _("invalid length"));
+ scm_from_int (length), _ ("invalid length"));
}
try
@@ -1181,18 +1153,18 @@ gdbscm_value_to_lazy_string (SCM self, SCM rest)
length = array_length;
else if (array_length == -1)
{
- type = lookup_array_range_type (realtype->target_type (),
- 0, length - 1);
+ type = lookup_array_range_type (realtype->target_type (), 0,
+ length - 1);
}
else if (length != array_length)
{
/* We need to create a new array type with the
specified length. */
if (length > array_length)
- error (_("length is larger than array size"));
- type = lookup_array_range_type (type->target_type (),
- low_bound,
- low_bound + length - 1);
+ error (_ ("length is larger than array size"));
+ type
+ = lookup_array_range_type (type->target_type (), low_bound,
+ low_bound + length - 1);
}
addr = value_address (value);
break;
@@ -1245,12 +1217,11 @@ gdbscm_value_fetch_lazy_x (SCM self)
= vlscm_get_value_smob_arg_unsafe (self, SCM_ARG1, FUNC_NAME);
struct value *value = v_smob->value;
- return gdbscm_wrap ([=]
- {
- if (value_lazy (value))
- value_fetch_lazy (value);
- return SCM_UNSPECIFIED;
- });
+ return gdbscm_wrap ([=] {
+ if (value_lazy (value))
+ value_fetch_lazy (value);
+ return SCM_UNSPECIFIED;
+ });
}
/* (value-print <gdb:value>) -> string */
@@ -1287,7 +1258,7 @@ gdbscm_value_print (SCM self)
return scm_from_stringn (stb.c_str (), stb.size (), host_charset (),
SCM_FAILED_CONVERSION_QUESTION_MARK);
}
-
+
/* (parse-and-eval string) -> <gdb:value>
Parse a string and evaluate the string as an expression. */
@@ -1295,14 +1266,13 @@ static SCM
gdbscm_parse_and_eval (SCM expr_scm)
{
char *expr_str;
- gdbscm_parse_function_args (FUNC_NAME, SCM_ARG1, NULL, "s",
- expr_scm, &expr_str);
+ gdbscm_parse_function_args (FUNC_NAME, SCM_ARG1, NULL, "s", expr_scm,
+ &expr_str);
- return gdbscm_wrap ([=]
- {
- scoped_value_mark free_values;
- return vlscm_scm_from_value (parse_and_eval (expr_str));
- });
+ return gdbscm_wrap ([=] {
+ scoped_value_mark free_values;
+ return vlscm_scm_from_value (parse_and_eval (expr_str));
+ });
}
/* (history-ref integer) -> <gdb:value>
@@ -1314,10 +1284,9 @@ gdbscm_history_ref (SCM index)
int i;
gdbscm_parse_function_args (FUNC_NAME, SCM_ARG1, NULL, "i", index, &i);
- return gdbscm_wrap ([=]
- {
- return vlscm_scm_from_value (access_value_history (i));
- });
+ return gdbscm_wrap ([=] {
+ return vlscm_scm_from_value (access_value_history (i));
+ });
}
/* (history-append! <gdb:value>) -> index
@@ -1328,22 +1297,18 @@ gdbscm_history_append_x (SCM value)
{
value_smob *v_smob
= vlscm_get_value_smob_arg_unsafe (value, SCM_ARG1, FUNC_NAME);
- return gdbscm_wrap ([=]
- {
- return scm_from_int (record_latest_value (v_smob->value));
- });
+ return gdbscm_wrap ([=] {
+ return scm_from_int (record_latest_value (v_smob->value));
+ });
}
-
+
/* Initialize the Scheme value code. */
-static const scheme_function value_functions[] =
-{
- { "value?", 1, 0, 0, as_a_scm_t_subr (gdbscm_value_p),
- "\
+static const scheme_function value_functions[] = {
+ { "value?", 1, 0, 0, as_a_scm_t_subr (gdbscm_value_p), "\
Return #t if the object is a <gdb:value> object." },
- { "make-value", 1, 0, 1, as_a_scm_t_subr (gdbscm_make_value),
- "\
+ { "make-value", 1, 0, 1, as_a_scm_t_subr (gdbscm_make_value), "\
Create a <gdb:value> representing object.\n\
Typically this is used to convert numbers and strings to\n\
<gdb:value> objects.\n\
@@ -1351,24 +1316,20 @@ Typically this is used to convert numbers and strings to\n\
Arguments: object [#:type <gdb:type>]" },
{ "value-optimized-out?", 1, 0, 0,
- as_a_scm_t_subr (gdbscm_value_optimized_out_p),
- "\
+ as_a_scm_t_subr (gdbscm_value_optimized_out_p), "\
Return #t if the value has been optimizd out." },
- { "value-address", 1, 0, 0, as_a_scm_t_subr (gdbscm_value_address),
- "\
+ { "value-address", 1, 0, 0, as_a_scm_t_subr (gdbscm_value_address), "\
Return the address of the value." },
- { "value-type", 1, 0, 0, as_a_scm_t_subr (gdbscm_value_type),
- "\
+ { "value-type", 1, 0, 0, as_a_scm_t_subr (gdbscm_value_type), "\
Return the type of the value." },
{ "value-dynamic-type", 1, 0, 0, as_a_scm_t_subr (gdbscm_value_dynamic_type),
"\
Return the dynamic type of the value." },
- { "value-cast", 2, 0, 0, as_a_scm_t_subr (gdbscm_value_cast),
- "\
+ { "value-cast", 2, 0, 0, as_a_scm_t_subr (gdbscm_value_cast), "\
Cast the value to the supplied type.\n\
\n\
Arguments: <gdb:value> <gdb:type>" },
@@ -1381,8 +1342,7 @@ dynamic_cast operator.\n\
Arguments: <gdb:value> <gdb:type>" },
{ "value-reinterpret-cast", 2, 0, 0,
- as_a_scm_t_subr (gdbscm_value_reinterpret_cast),
- "\
+ as_a_scm_t_subr (gdbscm_value_reinterpret_cast), "\
Cast the value to the supplied type, as if by the C++\n\
reinterpret_cast operator.\n\
\n\
@@ -1393,8 +1353,7 @@ reinterpret_cast operator.\n\
Return the result of applying the C unary * operator to the value." },
{ "value-referenced-value", 1, 0, 0,
- as_a_scm_t_subr (gdbscm_value_referenced_value),
- "\
+ as_a_scm_t_subr (gdbscm_value_referenced_value), "\
Given a value of a reference type, return the value referenced.\n\
The difference between this function and value-dereference is that\n\
the latter applies * unary operator to a value, which need not always\n\
@@ -1404,34 +1363,28 @@ value-dereference will result in a value of type 'int' while\n\
value-referenced-value will result in a value of type 'int *'." },
{ "value-reference-value", 1, 0, 0,
- as_a_scm_t_subr (gdbscm_value_reference_value),
- "\
+ as_a_scm_t_subr (gdbscm_value_reference_value), "\
Return a <gdb:value> object which is a reference to the given value." },
{ "value-rvalue-reference-value", 1, 0, 0,
- as_a_scm_t_subr (gdbscm_value_rvalue_reference_value),
- "\
+ as_a_scm_t_subr (gdbscm_value_rvalue_reference_value), "\
Return a <gdb:value> object which is an rvalue reference to the given value." },
- { "value-const-value", 1, 0, 0,
- as_a_scm_t_subr (gdbscm_value_const_value),
+ { "value-const-value", 1, 0, 0, as_a_scm_t_subr (gdbscm_value_const_value),
"\
Return a <gdb:value> object which is a 'const' version of the given value." },
- { "value-field", 2, 0, 0, as_a_scm_t_subr (gdbscm_value_field),
- "\
+ { "value-field", 2, 0, 0, as_a_scm_t_subr (gdbscm_value_field), "\
Return the specified field of the value.\n\
\n\
Arguments: <gdb:value> string" },
- { "value-subscript", 2, 0, 0, as_a_scm_t_subr (gdbscm_value_subscript),
- "\
+ { "value-subscript", 2, 0, 0, as_a_scm_t_subr (gdbscm_value_subscript), "\
Return the value of the array at the specified index.\n\
\n\
Arguments: <gdb:value> integer" },
- { "value-call", 2, 0, 0, as_a_scm_t_subr (gdbscm_value_call),
- "\
+ { "value-call", 2, 0, 0, as_a_scm_t_subr (gdbscm_value_call), "\
Perform an inferior function call taking the value as a pointer to the\n\
function to call.\n\
Each element of the argument list must be a <gdb:value> object or an object\n\
@@ -1440,18 +1393,15 @@ The result is the value returned by the function.\n\
\n\
Arguments: <gdb:value> arg-list" },
- { "value->bool", 1, 0, 0, as_a_scm_t_subr (gdbscm_value_to_bool),
- "\
+ { "value->bool", 1, 0, 0, as_a_scm_t_subr (gdbscm_value_to_bool), "\
Return the Scheme boolean representing the GDB value.\n\
The value must be \"integer like\". Pointers are ok." },
- { "value->integer", 1, 0, 0, as_a_scm_t_subr (gdbscm_value_to_integer),
- "\
+ { "value->integer", 1, 0, 0, as_a_scm_t_subr (gdbscm_value_to_integer), "\
Return the Scheme integer representing the GDB value.\n\
The value must be \"integer like\". Pointers are ok." },
- { "value->real", 1, 0, 0, as_a_scm_t_subr (gdbscm_value_to_real),
- "\
+ { "value->real", 1, 0, 0, as_a_scm_t_subr (gdbscm_value_to_real), "\
Return the Scheme real number representing the GDB value.\n\
The value must be a number." },
@@ -1460,8 +1410,7 @@ The value must be a number." },
Return a Scheme bytevector with the raw contents of the GDB value.\n\
No transformation, endian or otherwise, is performed." },
- { "value->string", 1, 0, 1, as_a_scm_t_subr (gdbscm_value_to_string),
- "\
+ { "value->string", 1, 0, 1, as_a_scm_t_subr (gdbscm_value_to_string), "\
Return the Unicode string of the value's contents.\n\
If ENCODING is not given, the string is assumed to be encoded in\n\
the target's charset.\n\
@@ -1475,8 +1424,7 @@ If LENGTH is provided, only fetch string to the length provided.\n\
[#:length length]" },
{ "value->lazy-string", 1, 0, 1,
- as_a_scm_t_subr (gdbscm_value_to_lazy_string),
- "\
+ as_a_scm_t_subr (gdbscm_value_to_lazy_string), "\
Return a Scheme object representing a lazily fetched Unicode string\n\
of the value's contents.\n\
If ENCODING is not given, the string is assumed to be encoded in\n\
@@ -1485,14 +1433,12 @@ If LENGTH is provided, only fetch string to the length provided.\n\
\n\
Arguments: <gdb:value> [#:encoding encoding] [#:length length]" },
- { "value-lazy?", 1, 0, 0, as_a_scm_t_subr (gdbscm_value_lazy_p),
- "\
+ { "value-lazy?", 1, 0, 0, as_a_scm_t_subr (gdbscm_value_lazy_p), "\
Return #t if the value is lazy (not fetched yet from the inferior).\n\
A lazy value is fetched when needed, or when the value-fetch-lazy! function\n\
is called." },
- { "make-lazy-value", 2, 0, 0, as_a_scm_t_subr (gdbscm_make_lazy_value),
- "\
+ { "make-lazy-value", 2, 0, 0, as_a_scm_t_subr (gdbscm_make_lazy_value), "\
Create a <gdb:value> that will be lazily fetched from the target.\n\
\n\
Arguments: <gdb:type> address" },
@@ -1502,20 +1448,16 @@ Create a <gdb:value> that will be lazily fetched from the target.\n\
Fetch the value from the inferior, if it was lazy.\n\
The result is \"unspecified\"." },
- { "value-print", 1, 0, 0, as_a_scm_t_subr (gdbscm_value_print),
- "\
+ { "value-print", 1, 0, 0, as_a_scm_t_subr (gdbscm_value_print), "\
Return the string representation (print form) of the value." },
- { "parse-and-eval", 1, 0, 0, as_a_scm_t_subr (gdbscm_parse_and_eval),
- "\
+ { "parse-and-eval", 1, 0, 0, as_a_scm_t_subr (gdbscm_parse_and_eval), "\
Evaluates string in gdb and returns the result as a <gdb:value> object." },
- { "history-ref", 1, 0, 0, as_a_scm_t_subr (gdbscm_history_ref),
- "\
+ { "history-ref", 1, 0, 0, as_a_scm_t_subr (gdbscm_history_ref), "\
Return the specified value from GDB's value history." },
- { "history-append!", 1, 0, 0, as_a_scm_t_subr (gdbscm_history_append_x),
- "\
+ { "history-append!", 1, 0, 0, as_a_scm_t_subr (gdbscm_history_append_x), "\
Append the specified value onto GDB's value history." },
END_FUNCTIONS
@@ -1524,8 +1466,8 @@ Append the specified value onto GDB's value history." },
void
gdbscm_initialize_values (void)
{
- value_smob_tag = gdbscm_make_smob_type (value_smob_name,
- sizeof (value_smob));
+ value_smob_tag
+ = gdbscm_make_smob_type (value_smob_name, sizeof (value_smob));
scm_set_smob_free (value_smob_tag, vlscm_free_value_smob);
scm_set_smob_print (value_smob_tag, vlscm_print_value_smob);
scm_set_smob_equalp (value_smob_tag, vlscm_equal_p_value_smob);
diff --git a/gdb/h8300-tdep.c b/gdb/h8300-tdep.c
index 0ac4608fe1e..e14f01059a6 100644
--- a/gdb/h8300-tdep.c
+++ b/gdb/h8300-tdep.c
@@ -35,20 +35,33 @@
enum gdb_regnum
{
- E_R0_REGNUM, E_ER0_REGNUM = E_R0_REGNUM, E_ARG0_REGNUM = E_R0_REGNUM,
+ E_R0_REGNUM,
+ E_ER0_REGNUM = E_R0_REGNUM,
+ E_ARG0_REGNUM = E_R0_REGNUM,
E_RET0_REGNUM = E_R0_REGNUM,
- E_R1_REGNUM, E_ER1_REGNUM = E_R1_REGNUM, E_RET1_REGNUM = E_R1_REGNUM,
- E_R2_REGNUM, E_ER2_REGNUM = E_R2_REGNUM, E_ARGLAST_REGNUM = E_R2_REGNUM,
- E_R3_REGNUM, E_ER3_REGNUM = E_R3_REGNUM,
- E_R4_REGNUM, E_ER4_REGNUM = E_R4_REGNUM,
- E_R5_REGNUM, E_ER5_REGNUM = E_R5_REGNUM,
- E_R6_REGNUM, E_ER6_REGNUM = E_R6_REGNUM, E_FP_REGNUM = E_R6_REGNUM,
+ E_R1_REGNUM,
+ E_ER1_REGNUM = E_R1_REGNUM,
+ E_RET1_REGNUM = E_R1_REGNUM,
+ E_R2_REGNUM,
+ E_ER2_REGNUM = E_R2_REGNUM,
+ E_ARGLAST_REGNUM = E_R2_REGNUM,
+ E_R3_REGNUM,
+ E_ER3_REGNUM = E_R3_REGNUM,
+ E_R4_REGNUM,
+ E_ER4_REGNUM = E_R4_REGNUM,
+ E_R5_REGNUM,
+ E_ER5_REGNUM = E_R5_REGNUM,
+ E_R6_REGNUM,
+ E_ER6_REGNUM = E_R6_REGNUM,
+ E_FP_REGNUM = E_R6_REGNUM,
E_SP_REGNUM,
E_CCR_REGNUM,
E_PC_REGNUM,
E_CYCLES_REGNUM,
- E_TICK_REGNUM, E_EXR_REGNUM = E_TICK_REGNUM,
- E_INST_REGNUM, E_TICKS_REGNUM = E_INST_REGNUM,
+ E_TICK_REGNUM,
+ E_EXR_REGNUM = E_TICK_REGNUM,
+ E_INST_REGNUM,
+ E_TICKS_REGNUM = E_INST_REGNUM,
E_INSTS_REGNUM,
E_MACH_REGNUM,
E_MACL_REGNUM,
@@ -59,7 +72,7 @@ enum gdb_regnum
#define H8300_MAX_NUM_REGS 18
#define E_PSEUDO_CCR_REGNUM(gdbarch) (gdbarch_num_regs (gdbarch))
-#define E_PSEUDO_EXR_REGNUM(gdbarch) (gdbarch_num_regs (gdbarch)+1)
+#define E_PSEUDO_EXR_REGNUM(gdbarch) (gdbarch_num_regs (gdbarch) + 1)
struct h8300_frame_cache
{
@@ -88,9 +101,10 @@ static int is_h8300smode (struct gdbarch *gdbarch);
static int is_h8300sxmode (struct gdbarch *gdbarch);
static int is_h8300_normal_mode (struct gdbarch *gdbarch);
-#define BINWORD(gdbarch) ((is_h8300hmode (gdbarch) \
- && !is_h8300_normal_mode (gdbarch)) \
- ? h8300h_reg_size : h8300_reg_size)
+#define BINWORD(gdbarch) \
+ ((is_h8300hmode (gdbarch) && !is_h8300_normal_mode (gdbarch)) \
+ ? h8300h_reg_size \
+ : h8300_reg_size)
/* Normal frames. */
@@ -116,33 +130,33 @@ h8300_init_frame_cache (struct gdbarch *gdbarch,
cache->saved_regs[i] = -1;
}
-#define IS_MOVB_RnRm(x) (((x) & 0xff88) == 0x0c88)
-#define IS_MOVW_RnRm(x) (((x) & 0xff88) == 0x0d00)
-#define IS_MOVL_RnRm(x) (((x) & 0xff88) == 0x0f80)
-#define IS_MOVB_Rn16_SP(x) (((x) & 0xfff0) == 0x6ee0)
-#define IS_MOVB_EXT(x) ((x) == 0x7860)
-#define IS_MOVB_Rn24_SP(x) (((x) & 0xfff0) == 0x6aa0)
-#define IS_MOVW_Rn16_SP(x) (((x) & 0xfff0) == 0x6fe0)
-#define IS_MOVW_EXT(x) ((x) == 0x78e0)
-#define IS_MOVW_Rn24_SP(x) (((x) & 0xfff0) == 0x6ba0)
+#define IS_MOVB_RnRm(x) (((x) &0xff88) == 0x0c88)
+#define IS_MOVW_RnRm(x) (((x) &0xff88) == 0x0d00)
+#define IS_MOVL_RnRm(x) (((x) &0xff88) == 0x0f80)
+#define IS_MOVB_Rn16_SP(x) (((x) &0xfff0) == 0x6ee0)
+#define IS_MOVB_EXT(x) ((x) == 0x7860)
+#define IS_MOVB_Rn24_SP(x) (((x) &0xfff0) == 0x6aa0)
+#define IS_MOVW_Rn16_SP(x) (((x) &0xfff0) == 0x6fe0)
+#define IS_MOVW_EXT(x) ((x) == 0x78e0)
+#define IS_MOVW_Rn24_SP(x) (((x) &0xfff0) == 0x6ba0)
/* Same instructions as mov.w, just prefixed with 0x0100. */
-#define IS_MOVL_PRE(x) ((x) == 0x0100)
-#define IS_MOVL_Rn16_SP(x) (((x) & 0xfff0) == 0x6fe0)
-#define IS_MOVL_EXT(x) ((x) == 0x78e0)
-#define IS_MOVL_Rn24_SP(x) (((x) & 0xfff0) == 0x6ba0)
-
-#define IS_PUSHFP_MOVESPFP(x) ((x) == 0x6df60d76)
-#define IS_PUSH_FP(x) ((x) == 0x01006df6)
-#define IS_MOV_SP_FP(x) ((x) == 0x0ff6)
-#define IS_SUB2_SP(x) ((x) == 0x1b87)
-#define IS_SUB4_SP(x) ((x) == 0x1b97)
-#define IS_ADD_IMM_SP(x) ((x) == 0x7a1f)
-#define IS_SUB_IMM_SP(x) ((x) == 0x7a3f)
-#define IS_SUBL4_SP(x) ((x) == 0x1acf)
-#define IS_MOV_IMM_Rn(x) (((x) & 0xfff0) == 0x7905)
-#define IS_SUB_RnSP(x) (((x) & 0xff0f) == 0x1907)
-#define IS_ADD_RnSP(x) (((x) & 0xff0f) == 0x0907)
-#define IS_PUSH(x) (((x) & 0xfff0) == 0x6df0)
+#define IS_MOVL_PRE(x) ((x) == 0x0100)
+#define IS_MOVL_Rn16_SP(x) (((x) &0xfff0) == 0x6fe0)
+#define IS_MOVL_EXT(x) ((x) == 0x78e0)
+#define IS_MOVL_Rn24_SP(x) (((x) &0xfff0) == 0x6ba0)
+
+#define IS_PUSHFP_MOVESPFP(x) ((x) == 0x6df60d76)
+#define IS_PUSH_FP(x) ((x) == 0x01006df6)
+#define IS_MOV_SP_FP(x) ((x) == 0x0ff6)
+#define IS_SUB2_SP(x) ((x) == 0x1b87)
+#define IS_SUB4_SP(x) ((x) == 0x1b97)
+#define IS_ADD_IMM_SP(x) ((x) == 0x7a1f)
+#define IS_SUB_IMM_SP(x) ((x) == 0x7a3f)
+#define IS_SUBL4_SP(x) ((x) == 0x1acf)
+#define IS_MOV_IMM_Rn(x) (((x) &0xfff0) == 0x7905)
+#define IS_SUB_RnSP(x) (((x) &0xff0f) == 0x1907)
+#define IS_ADD_RnSP(x) (((x) &0xff0f) == 0x0907)
+#define IS_PUSH(x) (((x) &0xfff0) == 0x6df0)
/* If the instruction at PC is an argument register spill, return its
length. Otherwise, return zero.
@@ -162,12 +176,12 @@ h8300_is_argument_spill (struct gdbarch *gdbarch, CORE_ADDR pc)
int w = read_memory_unsigned_integer (pc, 2, byte_order);
if ((IS_MOVB_RnRm (w) || IS_MOVW_RnRm (w) || IS_MOVL_RnRm (w))
- && (w & 0x70) <= 0x20 /* Rs is R0, R1 or R2 */
- && (w & 0x7) >= 0x3 && (w & 0x7) <= 0x5) /* Rd is R3, R4 or R5 */
+ && (w & 0x70) <= 0x20 /* Rs is R0, R1 or R2 */
+ && (w & 0x7) >= 0x3 && (w & 0x7) <= 0x5) /* Rd is R3, R4 or R5 */
return 2;
- if (IS_MOVB_Rn16_SP (w)
- && 8 <= (w & 0xf) && (w & 0xf) <= 10) /* Rs is R0L, R1L, or R2L */
+ if (IS_MOVB_Rn16_SP (w) && 8 <= (w & 0xf)
+ && (w & 0xf) <= 10) /* Rs is R0L, R1L, or R2L */
{
/* ... and d:16 is negative. */
if (read_memory_integer (pc + 2, 2, byte_order) < 0)
@@ -175,8 +189,8 @@ h8300_is_argument_spill (struct gdbarch *gdbarch, CORE_ADDR pc)
}
else if (IS_MOVB_EXT (w))
{
- if (IS_MOVB_Rn24_SP (read_memory_unsigned_integer (pc + 2,
- 2, byte_order)))
+ if (IS_MOVB_Rn24_SP (read_memory_unsigned_integer (pc + 2, 2,
+ byte_order)))
{
ULONGEST disp = read_memory_unsigned_integer (pc + 4, 4, byte_order);
@@ -185,8 +199,7 @@ h8300_is_argument_spill (struct gdbarch *gdbarch, CORE_ADDR pc)
return 8;
}
}
- else if (IS_MOVW_Rn16_SP (w)
- && (w & 0xf) <= 2) /* Rs is R0, R1, or R2 */
+ else if (IS_MOVW_Rn16_SP (w) && (w & 0xf) <= 2) /* Rs is R0, R1, or R2 */
{
/* ... and d:16 is negative. */
if (read_memory_integer (pc + 2, 2, byte_order) < 0)
@@ -194,8 +207,8 @@ h8300_is_argument_spill (struct gdbarch *gdbarch, CORE_ADDR pc)
}
else if (IS_MOVW_EXT (w))
{
- if (IS_MOVW_Rn24_SP (read_memory_unsigned_integer (pc + 2,
- 2, byte_order)))
+ if (IS_MOVW_Rn24_SP (read_memory_unsigned_integer (pc + 2, 2,
+ byte_order)))
{
ULONGEST disp = read_memory_unsigned_integer (pc + 4, 4, byte_order);
@@ -208,8 +221,7 @@ h8300_is_argument_spill (struct gdbarch *gdbarch, CORE_ADDR pc)
{
int w2 = read_memory_integer (pc + 2, 2, byte_order);
- if (IS_MOVL_Rn16_SP (w2)
- && (w2 & 0xf) <= 2) /* Rs is ER0, ER1, or ER2 */
+ if (IS_MOVL_Rn16_SP (w2) && (w2 & 0xf) <= 2) /* Rs is ER0, ER1, or ER2 */
{
/* ... and d:16 is negative. */
if (read_memory_integer (pc + 4, 2, byte_order) < 0)
@@ -219,8 +231,8 @@ h8300_is_argument_spill (struct gdbarch *gdbarch, CORE_ADDR pc)
{
if (IS_MOVL_Rn24_SP (read_memory_integer (pc + 4, 2, byte_order)))
{
- ULONGEST disp = read_memory_unsigned_integer (pc + 6, 4,
- byte_order);
+ ULONGEST disp
+ = read_memory_unsigned_integer (pc + 6, 4, byte_order);
/* ... and d:24 is negative. */
if ((disp & 0x00800000) != 0)
@@ -268,9 +280,8 @@ h8300_is_argument_spill (struct gdbarch *gdbarch, CORE_ADDR pc)
*/
static CORE_ADDR
-h8300_analyze_prologue (struct gdbarch *gdbarch,
- CORE_ADDR pc, CORE_ADDR current_pc,
- struct h8300_frame_cache *cache)
+h8300_analyze_prologue (struct gdbarch *gdbarch, CORE_ADDR pc,
+ CORE_ADDR current_pc, struct h8300_frame_cache *cache)
{
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
unsigned int op;
@@ -469,8 +480,7 @@ static void
h8300_frame_this_id (frame_info_ptr this_frame, void **this_cache,
struct frame_id *this_id)
{
- struct h8300_frame_cache *cache =
- h8300_frame_cache (this_frame, this_cache);
+ struct h8300_frame_cache *cache = h8300_frame_cache (this_frame, this_cache);
/* This marks the outermost frame. */
if (cache->base == 0)
@@ -484,31 +494,28 @@ h8300_frame_prev_register (frame_info_ptr this_frame, void **this_cache,
int regnum)
{
struct gdbarch *gdbarch = get_frame_arch (this_frame);
- struct h8300_frame_cache *cache =
- h8300_frame_cache (this_frame, this_cache);
+ struct h8300_frame_cache *cache = h8300_frame_cache (this_frame, this_cache);
gdb_assert (regnum >= 0);
if (regnum == E_SP_REGNUM && cache->saved_sp)
return frame_unwind_got_constant (this_frame, regnum, cache->saved_sp);
- if (regnum < gdbarch_num_regs (gdbarch)
- && cache->saved_regs[regnum] != -1)
+ if (regnum < gdbarch_num_regs (gdbarch) && cache->saved_regs[regnum] != -1)
return frame_unwind_got_memory (this_frame, regnum,
cache->saved_regs[regnum]);
return frame_unwind_got_register (this_frame, regnum, regnum);
}
-static const struct frame_unwind h8300_frame_unwind = {
- "h8300 prologue",
- NORMAL_FRAME,
- default_frame_unwind_stop_reason,
- h8300_frame_this_id,
- h8300_frame_prev_register,
- NULL,
- default_frame_sniffer
-};
+static const struct frame_unwind h8300_frame_unwind
+ = { "h8300 prologue",
+ NORMAL_FRAME,
+ default_frame_unwind_stop_reason,
+ h8300_frame_this_id,
+ h8300_frame_prev_register,
+ NULL,
+ default_frame_sniffer };
static CORE_ADDR
h8300_frame_base_address (frame_info_ptr this_frame, void **this_cache)
@@ -517,17 +524,14 @@ h8300_frame_base_address (frame_info_ptr this_frame, void **this_cache)
return cache->base;
}
-static const struct frame_base h8300_frame_base = {
- &h8300_frame_unwind,
- h8300_frame_base_address,
- h8300_frame_base_address,
- h8300_frame_base_address
-};
+static const struct frame_base h8300_frame_base
+ = { &h8300_frame_unwind, h8300_frame_base_address, h8300_frame_base_address,
+ h8300_frame_base_address };
static CORE_ADDR
h8300_skip_prologue (struct gdbarch *gdbarch, CORE_ADDR pc)
{
- CORE_ADDR func_addr = 0 , func_end = 0;
+ CORE_ADDR func_addr = 0, func_end = 0;
if (find_pc_partial_function (pc, NULL, &func_addr, &func_end))
{
@@ -615,8 +619,8 @@ h8300_skip_prologue (struct gdbarch *gdbarch, CORE_ADDR pc)
static CORE_ADDR
h8300_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
- struct regcache *regcache, CORE_ADDR bp_addr,
- int nargs, struct value **args, CORE_ADDR sp,
+ struct regcache *regcache, CORE_ADDR bp_addr, int nargs,
+ struct value **args, CORE_ADDR sp,
function_call_return_method return_method,
CORE_ADDR struct_addr)
{
@@ -655,7 +659,7 @@ h8300_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
std::vector<gdb_byte> padded (padded_len);
memcpy ((len < wordsize ? padded.data () + padded_len - len
- : padded.data ()),
+ : padded.data ()),
contents, len);
/* Could the argument fit in the remaining registers? */
@@ -684,8 +688,8 @@ h8300_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
for (offset = 0; offset < padded_len; offset += wordsize)
{
ULONGEST word
- = extract_unsigned_integer (&padded[offset],
- wordsize, byte_order);
+ = extract_unsigned_integer (&padded[offset], wordsize,
+ byte_order);
regcache_cooked_write_unsigned (regcache, reg++, word);
}
}
@@ -734,13 +738,13 @@ h8300_extract_return_value (struct type *type, struct regcache *regcache,
regcache_cooked_read_unsigned (regcache, E_RET0_REGNUM, &c);
store_unsigned_integer (valbuf, len, byte_order, c);
break;
- case 4: /* Needs two registers on plain H8/300 */
+ case 4: /* Needs two registers on plain H8/300 */
regcache_cooked_read_unsigned (regcache, E_RET0_REGNUM, &c);
store_unsigned_integer (valbuf, 2, byte_order, c);
regcache_cooked_read_unsigned (regcache, E_RET1_REGNUM, &c);
store_unsigned_integer (valbuf + 2, 2, byte_order, c);
break;
- case 8: /* long long is now 8 bytes. */
+ case 8: /* long long is now 8 bytes. */
if (type->code () == TYPE_CODE_INT)
{
regcache_cooked_read_unsigned (regcache, E_RET0_REGNUM, &addr);
@@ -749,7 +753,7 @@ h8300_extract_return_value (struct type *type, struct regcache *regcache,
}
else
{
- error (_("I don't know how this 8 byte value is returned."));
+ error (_ ("I don't know how this 8 byte value is returned."));
}
break;
}
@@ -771,7 +775,7 @@ h8300h_extract_return_value (struct type *type, struct regcache *regcache,
regcache_cooked_read_unsigned (regcache, E_RET0_REGNUM, &c);
store_unsigned_integer (valbuf, type->length (), byte_order, c);
break;
- case 8: /* long long is now 8 bytes. */
+ case 8: /* long long is now 8 bytes. */
if (type->code () == TYPE_CODE_INT)
{
regcache_cooked_read_unsigned (regcache, E_RET0_REGNUM, &c);
@@ -781,7 +785,7 @@ h8300h_extract_return_value (struct type *type, struct regcache *regcache,
}
else
{
- error (_("I don't know how this 8 byte value is returned."));
+ error (_ ("I don't know how this 8 byte value is returned."));
}
break;
}
@@ -796,8 +800,7 @@ h8300_use_struct_convention (struct type *value_type)
if (value_type->code () == TYPE_CODE_STRUCT
|| value_type->code () == TYPE_CODE_UNION)
return 1;
- return !(value_type->length () == 1
- || value_type->length () == 2
+ return !(value_type->length () == 1 || value_type->length () == 2
|| value_type->length () == 4);
}
@@ -809,8 +812,7 @@ h8300h_use_struct_convention (struct type *value_type)
if (value_type->code () == TYPE_CODE_STRUCT
|| value_type->code () == TYPE_CODE_UNION)
return 1;
- return !(value_type->length () == 1
- || value_type->length () == 2
+ return !(value_type->length () == 1 || value_type->length () == 2
|| value_type->length () == 4
|| (value_type->length () == 8
&& value_type->code () == TYPE_CODE_INT));
@@ -831,20 +833,20 @@ h8300_store_return_value (struct type *type, struct regcache *regcache,
switch (type->length ())
{
case 1:
- case 2: /* short... */
+ case 2: /* short... */
val = extract_unsigned_integer (valbuf, type->length (), byte_order);
regcache_cooked_write_unsigned (regcache, E_RET0_REGNUM, val);
break;
- case 4: /* long, float */
+ case 4: /* long, float */
val = extract_unsigned_integer (valbuf, type->length (), byte_order);
regcache_cooked_write_unsigned (regcache, E_RET0_REGNUM,
(val >> 16) & 0xffff);
regcache_cooked_write_unsigned (regcache, E_RET1_REGNUM, val & 0xffff);
break;
- case 8: /* long long, double and long double
+ case 8: /* long long, double and long double
are all defined as 4 byte types so
far so this shouldn't happen. */
- error (_("I don't know how to return an 8 byte value."));
+ error (_ ("I don't know how to return an 8 byte value."));
break;
}
}
@@ -861,7 +863,7 @@ h8300h_store_return_value (struct type *type, struct regcache *regcache,
{
case 1:
case 2:
- case 4: /* long, float */
+ case 4: /* long, float */
val = extract_unsigned_integer (valbuf, type->length (), byte_order);
regcache_cooked_write_unsigned (regcache, E_RET0_REGNUM, val);
break;
@@ -943,50 +945,49 @@ h8300_register_name (struct gdbarch *gdbarch, int regno)
/* The register names change depending on which h8300 processor
type is selected. */
static const char *register_names[] = {
- "r0", "r1", "r2", "r3", "r4", "r5", "r6",
- "sp", "", "pc", "cycles", "tick", "inst",
- "ccr", /* pseudo register */
+ "r0", "r1", "r2", "r3", "r4", "r5", "r6",
+ "sp", "", "pc", "cycles", "tick", "inst", "ccr", /* pseudo register */
};
- return h8300_register_name_common(register_names, ARRAY_SIZE(register_names),
- gdbarch, regno);
+ return h8300_register_name_common (register_names,
+ ARRAY_SIZE (register_names), gdbarch,
+ regno);
}
static const char *
h8300h_register_name (struct gdbarch *gdbarch, int regno)
{
static const char *register_names[] = {
- "er0", "er1", "er2", "er3", "er4", "er5", "er6",
- "sp", "", "pc", "cycles", "tick", "inst",
- "ccr", /* pseudo register */
+ "er0", "er1", "er2", "er3", "er4", "er5", "er6",
+ "sp", "", "pc", "cycles", "tick", "inst", "ccr", /* pseudo register */
};
- return h8300_register_name_common(register_names, ARRAY_SIZE(register_names),
- gdbarch, regno);
+ return h8300_register_name_common (register_names,
+ ARRAY_SIZE (register_names), gdbarch,
+ regno);
}
static const char *
h8300s_register_name (struct gdbarch *gdbarch, int regno)
{
static const char *register_names[] = {
- "er0", "er1", "er2", "er3", "er4", "er5", "er6",
- "sp", "", "pc", "cycles", "", "tick", "inst",
- "mach", "macl",
- "ccr", "exr" /* pseudo registers */
+ "er0", "er1", "er2", "er3", "er4", "er5", "er6", "sp", "", "pc",
+ "cycles", "", "tick", "inst", "mach", "macl", "ccr", "exr" /* pseudo registers */
};
- return h8300_register_name_common(register_names, ARRAY_SIZE(register_names),
- gdbarch, regno);
+ return h8300_register_name_common (register_names,
+ ARRAY_SIZE (register_names), gdbarch,
+ regno);
}
static const char *
h8300sx_register_name (struct gdbarch *gdbarch, int regno)
{
static const char *register_names[] = {
- "er0", "er1", "er2", "er3", "er4", "er5", "er6",
- "sp", "", "pc", "cycles", "", "tick", "inst",
- "mach", "macl", "sbr", "vbr",
- "ccr", "exr" /* pseudo registers */
+ "er0", "er1", "er2", "er3", "er4", "er5", "er6",
+ "sp", "", "pc", "cycles", "", "tick", "inst",
+ "mach", "macl", "sbr", "vbr", "ccr", "exr" /* pseudo registers */
};
- return h8300_register_name_common(register_names, ARRAY_SIZE(register_names),
- gdbarch, regno);
+ return h8300_register_name_common (register_names,
+ ARRAY_SIZE (register_names), gdbarch,
+ regno);
}
static void
@@ -1002,16 +1003,15 @@ h8300_print_register (struct gdbarch *gdbarch, struct ui_file *file,
rval = get_frame_register_signed (frame, regno);
gdb_printf (file, "%-14s ", name);
- if ((regno == E_PSEUDO_CCR_REGNUM (gdbarch)) || \
- (regno == E_PSEUDO_EXR_REGNUM (gdbarch) && is_h8300smode (gdbarch)))
+ if ((regno == E_PSEUDO_CCR_REGNUM (gdbarch))
+ || (regno == E_PSEUDO_EXR_REGNUM (gdbarch) && is_h8300smode (gdbarch)))
{
gdb_printf (file, "0x%02x ", (unsigned char) rval);
print_longest (file, 'u', 1, rval);
}
else
{
- gdb_printf (file, "0x%s ", phex ((ULONGEST) rval,
- BINWORD (gdbarch)));
+ gdb_printf (file, "0x%s ", phex ((ULONGEST) rval, BINWORD (gdbarch)));
print_longest (file, 'd', 1, rval);
}
if (regno == E_PSEUDO_CCR_REGNUM (gdbarch))
@@ -1117,7 +1117,7 @@ static struct type *
h8300_register_type (struct gdbarch *gdbarch, int regno)
{
if (regno < 0 || regno >= gdbarch_num_cooked_regs (gdbarch))
- internal_error (_("h8300_register_type: illegal register number %d"),
+ internal_error (_ ("h8300_register_type: illegal register number %d"),
regno);
else
{
@@ -1155,8 +1155,7 @@ pseudo_from_raw_register (struct gdbarch *gdbarch, readable_regcache *regcache,
status = regcache->raw_read (raw_regno, &val);
if (status == REG_VALID)
- store_unsigned_integer (buf,
- register_size (gdbarch, pseudo_regno),
+ store_unsigned_integer (buf, register_size (gdbarch, pseudo_regno),
byte_order, val);
return status;
}
@@ -1182,13 +1181,13 @@ h8300_pseudo_register_read (struct gdbarch *gdbarch,
{
if (regno == E_PSEUDO_CCR_REGNUM (gdbarch))
{
- return pseudo_from_raw_register (gdbarch, regcache, buf,
- regno, E_CCR_REGNUM);
+ return pseudo_from_raw_register (gdbarch, regcache, buf, regno,
+ E_CCR_REGNUM);
}
else if (regno == E_PSEUDO_EXR_REGNUM (gdbarch))
{
- return pseudo_from_raw_register (gdbarch, regcache, buf,
- regno, E_EXR_REGNUM);
+ return pseudo_from_raw_register (gdbarch, regcache, buf, regno,
+ E_EXR_REGNUM);
}
else
return regcache->raw_read (regno, buf);
@@ -1225,8 +1224,8 @@ h8300s_dbg_reg_to_regnum (struct gdbarch *gdbarch, int regno)
return regno;
}
-/*static unsigned char breakpoint[] = { 0x7A, 0xFF }; *//* ??? */
-constexpr gdb_byte h8300_break_insn[] = { 0x01, 0x80 }; /* Sleep */
+/*static unsigned char breakpoint[] = { 0x7A, 0xFF }; */ /* ??? */
+constexpr gdb_byte h8300_break_insn[] = { 0x01, 0x80 }; /* Sleep */
typedef BP_MANIPULATION (h8300_break_insn) h8300_breakpoint;
@@ -1369,10 +1368,10 @@ h8300_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
frame_unwind_append_unwinder (gdbarch, &h8300_frame_unwind);
return gdbarch;
-
}
void _initialize_h8300_tdep ();
+
void
_initialize_h8300_tdep ()
{
@@ -1383,33 +1382,33 @@ static int
is_h8300hmode (struct gdbarch *gdbarch)
{
return gdbarch_bfd_arch_info (gdbarch)->mach == bfd_mach_h8300sx
- || gdbarch_bfd_arch_info (gdbarch)->mach == bfd_mach_h8300sxn
- || gdbarch_bfd_arch_info (gdbarch)->mach == bfd_mach_h8300s
- || gdbarch_bfd_arch_info (gdbarch)->mach == bfd_mach_h8300sn
- || gdbarch_bfd_arch_info (gdbarch)->mach == bfd_mach_h8300h
- || gdbarch_bfd_arch_info (gdbarch)->mach == bfd_mach_h8300hn;
+ || gdbarch_bfd_arch_info (gdbarch)->mach == bfd_mach_h8300sxn
+ || gdbarch_bfd_arch_info (gdbarch)->mach == bfd_mach_h8300s
+ || gdbarch_bfd_arch_info (gdbarch)->mach == bfd_mach_h8300sn
+ || gdbarch_bfd_arch_info (gdbarch)->mach == bfd_mach_h8300h
+ || gdbarch_bfd_arch_info (gdbarch)->mach == bfd_mach_h8300hn;
}
static int
is_h8300smode (struct gdbarch *gdbarch)
{
return gdbarch_bfd_arch_info (gdbarch)->mach == bfd_mach_h8300sx
- || gdbarch_bfd_arch_info (gdbarch)->mach == bfd_mach_h8300sxn
- || gdbarch_bfd_arch_info (gdbarch)->mach == bfd_mach_h8300s
- || gdbarch_bfd_arch_info (gdbarch)->mach == bfd_mach_h8300sn;
+ || gdbarch_bfd_arch_info (gdbarch)->mach == bfd_mach_h8300sxn
+ || gdbarch_bfd_arch_info (gdbarch)->mach == bfd_mach_h8300s
+ || gdbarch_bfd_arch_info (gdbarch)->mach == bfd_mach_h8300sn;
}
static int
is_h8300sxmode (struct gdbarch *gdbarch)
{
return gdbarch_bfd_arch_info (gdbarch)->mach == bfd_mach_h8300sx
- || gdbarch_bfd_arch_info (gdbarch)->mach == bfd_mach_h8300sxn;
+ || gdbarch_bfd_arch_info (gdbarch)->mach == bfd_mach_h8300sxn;
}
static int
is_h8300_normal_mode (struct gdbarch *gdbarch)
{
return gdbarch_bfd_arch_info (gdbarch)->mach == bfd_mach_h8300sxn
- || gdbarch_bfd_arch_info (gdbarch)->mach == bfd_mach_h8300sn
- || gdbarch_bfd_arch_info (gdbarch)->mach == bfd_mach_h8300hn;
+ || gdbarch_bfd_arch_info (gdbarch)->mach == bfd_mach_h8300sn
+ || gdbarch_bfd_arch_info (gdbarch)->mach == bfd_mach_h8300hn;
}
diff --git a/gdb/hppa-bsd-tdep.c b/gdb/hppa-bsd-tdep.c
index c8b044fdbfd..20e20e3fdcc 100644
--- a/gdb/hppa-bsd-tdep.c
+++ b/gdb/hppa-bsd-tdep.c
@@ -85,8 +85,8 @@ hppabsd_find_global_pointer (struct gdbarch *gdbarch, struct value *function)
/* The NetBSD/OpenBSD ld.so doesn't relocate DT_PLTGOT, so
we have to do it ourselves. */
- pltgot = extract_unsigned_integer (buf, sizeof buf,
- byte_order);
+ pltgot
+ = extract_unsigned_integer (buf, sizeof buf, byte_order);
pltgot += sec->objfile->text_section_offset ();
return pltgot;
@@ -102,7 +102,6 @@ hppabsd_find_global_pointer (struct gdbarch *gdbarch, struct value *function)
return 0;
}
-
static void
hppabsd_dwarf2_frame_init_reg (struct gdbarch *gdbarch, int regnum,
@@ -131,8 +130,8 @@ hppabsd_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
set_gdbarch_skip_trampoline_code (gdbarch, hppa_skip_trampoline_code);
/* OpenBSD and NetBSD use SVR4-style shared libraries. */
- set_solib_svr4_fetch_link_map_offsets
- (gdbarch, svr4_ilp32_fetch_link_map_offsets);
+ set_solib_svr4_fetch_link_map_offsets (gdbarch,
+ svr4_ilp32_fetch_link_map_offsets);
/* Hook in the DWARF CFI frame unwinder. */
dwarf2_frame_set_init_reg (gdbarch, hppabsd_dwarf2_frame_init_reg);
diff --git a/gdb/hppa-linux-nat.c b/gdb/hppa-linux-nat.c
index 27fbd4a0521..156b9bd98e1 100644
--- a/gdb/hppa-linux-nat.c
+++ b/gdb/hppa-linux-nat.c
@@ -38,6 +38,7 @@
class hppa_linux_nat_target final : public linux_nat_target
{
public:
+
/* Add our register access methods. */
void fetch_registers (struct regcache *, int) override;
void store_registers (struct regcache *, int) override;
@@ -53,111 +54,142 @@ static hppa_linux_nat_target the_hppa_linux_nat_target;
Some sort of lookup table is needed because the offsets associated
with the registers are all over the board. */
-static const int u_offsets[] =
- {
- /* general registers */
- -1,
- PT_GR1,
- PT_GR2,
- PT_GR3,
- PT_GR4,
- PT_GR5,
- PT_GR6,
- PT_GR7,
- PT_GR8,
- PT_GR9,
- PT_GR10,
- PT_GR11,
- PT_GR12,
- PT_GR13,
- PT_GR14,
- PT_GR15,
- PT_GR16,
- PT_GR17,
- PT_GR18,
- PT_GR19,
- PT_GR20,
- PT_GR21,
- PT_GR22,
- PT_GR23,
- PT_GR24,
- PT_GR25,
- PT_GR26,
- PT_GR27,
- PT_GR28,
- PT_GR29,
- PT_GR30,
- PT_GR31,
-
- PT_SAR,
- PT_IAOQ0,
- PT_IASQ0,
- PT_IAOQ1,
- PT_IASQ1,
- -1, /* eiem */
- PT_IIR,
- PT_ISR,
- PT_IOR,
- PT_PSW,
- -1, /* goto */
-
- PT_SR4,
- PT_SR0,
- PT_SR1,
- PT_SR2,
- PT_SR3,
- PT_SR5,
- PT_SR6,
- PT_SR7,
-
- -1, /* cr0 */
- -1, /* pid0 */
- -1, /* pid1 */
- -1, /* ccr */
- -1, /* pid2 */
- -1, /* pid3 */
- -1, /* cr24 */
- -1, /* cr25 */
- -1, /* cr26 */
- PT_CR27,
- -1, /* cr28 */
- -1, /* cr29 */
- -1, /* cr30 */
-
- /* Floating point regs. */
- PT_FR0, PT_FR0 + 4,
- PT_FR1, PT_FR1 + 4,
- PT_FR2, PT_FR2 + 4,
- PT_FR3, PT_FR3 + 4,
- PT_FR4, PT_FR4 + 4,
- PT_FR5, PT_FR5 + 4,
- PT_FR6, PT_FR6 + 4,
- PT_FR7, PT_FR7 + 4,
- PT_FR8, PT_FR8 + 4,
- PT_FR9, PT_FR9 + 4,
- PT_FR10, PT_FR10 + 4,
- PT_FR11, PT_FR11 + 4,
- PT_FR12, PT_FR12 + 4,
- PT_FR13, PT_FR13 + 4,
- PT_FR14, PT_FR14 + 4,
- PT_FR15, PT_FR15 + 4,
- PT_FR16, PT_FR16 + 4,
- PT_FR17, PT_FR17 + 4,
- PT_FR18, PT_FR18 + 4,
- PT_FR19, PT_FR19 + 4,
- PT_FR20, PT_FR20 + 4,
- PT_FR21, PT_FR21 + 4,
- PT_FR22, PT_FR22 + 4,
- PT_FR23, PT_FR23 + 4,
- PT_FR24, PT_FR24 + 4,
- PT_FR25, PT_FR25 + 4,
- PT_FR26, PT_FR26 + 4,
- PT_FR27, PT_FR27 + 4,
- PT_FR28, PT_FR28 + 4,
- PT_FR29, PT_FR29 + 4,
- PT_FR30, PT_FR30 + 4,
- PT_FR31, PT_FR31 + 4,
- };
+static const int u_offsets[] = {
+ /* general registers */
+ -1,
+ PT_GR1,
+ PT_GR2,
+ PT_GR3,
+ PT_GR4,
+ PT_GR5,
+ PT_GR6,
+ PT_GR7,
+ PT_GR8,
+ PT_GR9,
+ PT_GR10,
+ PT_GR11,
+ PT_GR12,
+ PT_GR13,
+ PT_GR14,
+ PT_GR15,
+ PT_GR16,
+ PT_GR17,
+ PT_GR18,
+ PT_GR19,
+ PT_GR20,
+ PT_GR21,
+ PT_GR22,
+ PT_GR23,
+ PT_GR24,
+ PT_GR25,
+ PT_GR26,
+ PT_GR27,
+ PT_GR28,
+ PT_GR29,
+ PT_GR30,
+ PT_GR31,
+
+ PT_SAR,
+ PT_IAOQ0,
+ PT_IASQ0,
+ PT_IAOQ1,
+ PT_IASQ1,
+ -1, /* eiem */
+ PT_IIR,
+ PT_ISR,
+ PT_IOR,
+ PT_PSW,
+ -1, /* goto */
+
+ PT_SR4,
+ PT_SR0,
+ PT_SR1,
+ PT_SR2,
+ PT_SR3,
+ PT_SR5,
+ PT_SR6,
+ PT_SR7,
+
+ -1, /* cr0 */
+ -1, /* pid0 */
+ -1, /* pid1 */
+ -1, /* ccr */
+ -1, /* pid2 */
+ -1, /* pid3 */
+ -1, /* cr24 */
+ -1, /* cr25 */
+ -1, /* cr26 */
+ PT_CR27,
+ -1, /* cr28 */
+ -1, /* cr29 */
+ -1, /* cr30 */
+
+ /* Floating point regs. */
+ PT_FR0,
+ PT_FR0 + 4,
+ PT_FR1,
+ PT_FR1 + 4,
+ PT_FR2,
+ PT_FR2 + 4,
+ PT_FR3,
+ PT_FR3 + 4,
+ PT_FR4,
+ PT_FR4 + 4,
+ PT_FR5,
+ PT_FR5 + 4,
+ PT_FR6,
+ PT_FR6 + 4,
+ PT_FR7,
+ PT_FR7 + 4,
+ PT_FR8,
+ PT_FR8 + 4,
+ PT_FR9,
+ PT_FR9 + 4,
+ PT_FR10,
+ PT_FR10 + 4,
+ PT_FR11,
+ PT_FR11 + 4,
+ PT_FR12,
+ PT_FR12 + 4,
+ PT_FR13,
+ PT_FR13 + 4,
+ PT_FR14,
+ PT_FR14 + 4,
+ PT_FR15,
+ PT_FR15 + 4,
+ PT_FR16,
+ PT_FR16 + 4,
+ PT_FR17,
+ PT_FR17 + 4,
+ PT_FR18,
+ PT_FR18 + 4,
+ PT_FR19,
+ PT_FR19 + 4,
+ PT_FR20,
+ PT_FR20 + 4,
+ PT_FR21,
+ PT_FR21 + 4,
+ PT_FR22,
+ PT_FR22 + 4,
+ PT_FR23,
+ PT_FR23 + 4,
+ PT_FR24,
+ PT_FR24 + 4,
+ PT_FR25,
+ PT_FR25 + 4,
+ PT_FR26,
+ PT_FR26 + 4,
+ PT_FR27,
+ PT_FR27 + 4,
+ PT_FR28,
+ PT_FR28 + 4,
+ PT_FR29,
+ PT_FR29 + 4,
+ PT_FR30,
+ PT_FR30 + 4,
+ PT_FR31,
+ PT_FR31 + 4,
+};
static CORE_ADDR
hppa_linux_register_addr (int regno, CORE_ADDR blockend)
@@ -165,7 +197,7 @@ hppa_linux_register_addr (int regno, CORE_ADDR blockend)
CORE_ADDR addr;
if ((unsigned) regno >= ARRAY_SIZE (u_offsets))
- error (_("Invalid register number %d."), regno);
+ error (_ ("Invalid register number %d."), regno);
if (u_offsets[regno] == -1)
addr = 0;
@@ -188,36 +220,38 @@ hppa_linux_register_addr (int regno, CORE_ADDR blockend)
* cr8,9,12,13
* cr10, cr15
*/
-#define GR_REGNUM(_n) (HPPA_R0_REGNUM+_n)
-#define TR_REGNUM(_n) (HPPA_TR0_REGNUM+_n)
-static const int greg_map[] =
- {
- GR_REGNUM(0), GR_REGNUM(1), GR_REGNUM(2), GR_REGNUM(3),
- GR_REGNUM(4), GR_REGNUM(5), GR_REGNUM(6), GR_REGNUM(7),
- GR_REGNUM(8), GR_REGNUM(9), GR_REGNUM(10), GR_REGNUM(11),
- GR_REGNUM(12), GR_REGNUM(13), GR_REGNUM(14), GR_REGNUM(15),
- GR_REGNUM(16), GR_REGNUM(17), GR_REGNUM(18), GR_REGNUM(19),
- GR_REGNUM(20), GR_REGNUM(21), GR_REGNUM(22), GR_REGNUM(23),
- GR_REGNUM(24), GR_REGNUM(25), GR_REGNUM(26), GR_REGNUM(27),
- GR_REGNUM(28), GR_REGNUM(29), GR_REGNUM(30), GR_REGNUM(31),
-
- HPPA_SR4_REGNUM+1, HPPA_SR4_REGNUM+2, HPPA_SR4_REGNUM+3, HPPA_SR4_REGNUM+4,
- HPPA_SR4_REGNUM, HPPA_SR4_REGNUM+5, HPPA_SR4_REGNUM+6, HPPA_SR4_REGNUM+7,
-
- HPPA_PCOQ_HEAD_REGNUM, HPPA_PCOQ_TAIL_REGNUM,
- HPPA_PCSQ_HEAD_REGNUM, HPPA_PCSQ_TAIL_REGNUM,
-
- HPPA_SAR_REGNUM, HPPA_IIR_REGNUM, HPPA_ISR_REGNUM, HPPA_IOR_REGNUM,
- HPPA_IPSW_REGNUM, HPPA_RCR_REGNUM,
-
- TR_REGNUM(0), TR_REGNUM(1), TR_REGNUM(2), TR_REGNUM(3),
- TR_REGNUM(4), TR_REGNUM(5), TR_REGNUM(6), TR_REGNUM(7),
-
- HPPA_PID0_REGNUM, HPPA_PID1_REGNUM, HPPA_PID2_REGNUM, HPPA_PID3_REGNUM,
- HPPA_CCR_REGNUM, HPPA_EIEM_REGNUM,
- };
-
-
+#define GR_REGNUM(_n) (HPPA_R0_REGNUM + _n)
+#define TR_REGNUM(_n) (HPPA_TR0_REGNUM + _n)
+static const int greg_map[] = {
+ GR_REGNUM (0), GR_REGNUM (1), GR_REGNUM (2),
+ GR_REGNUM (3), GR_REGNUM (4), GR_REGNUM (5),
+ GR_REGNUM (6), GR_REGNUM (7), GR_REGNUM (8),
+ GR_REGNUM (9), GR_REGNUM (10), GR_REGNUM (11),
+ GR_REGNUM (12), GR_REGNUM (13), GR_REGNUM (14),
+ GR_REGNUM (15), GR_REGNUM (16), GR_REGNUM (17),
+ GR_REGNUM (18), GR_REGNUM (19), GR_REGNUM (20),
+ GR_REGNUM (21), GR_REGNUM (22), GR_REGNUM (23),
+ GR_REGNUM (24), GR_REGNUM (25), GR_REGNUM (26),
+ GR_REGNUM (27), GR_REGNUM (28), GR_REGNUM (29),
+ GR_REGNUM (30), GR_REGNUM (31),
+
+ HPPA_SR4_REGNUM + 1, HPPA_SR4_REGNUM + 2, HPPA_SR4_REGNUM + 3,
+ HPPA_SR4_REGNUM + 4, HPPA_SR4_REGNUM, HPPA_SR4_REGNUM + 5,
+ HPPA_SR4_REGNUM + 6, HPPA_SR4_REGNUM + 7,
+
+ HPPA_PCOQ_HEAD_REGNUM, HPPA_PCOQ_TAIL_REGNUM, HPPA_PCSQ_HEAD_REGNUM,
+ HPPA_PCSQ_TAIL_REGNUM,
+
+ HPPA_SAR_REGNUM, HPPA_IIR_REGNUM, HPPA_ISR_REGNUM,
+ HPPA_IOR_REGNUM, HPPA_IPSW_REGNUM, HPPA_RCR_REGNUM,
+
+ TR_REGNUM (0), TR_REGNUM (1), TR_REGNUM (2),
+ TR_REGNUM (3), TR_REGNUM (4), TR_REGNUM (5),
+ TR_REGNUM (6), TR_REGNUM (7),
+
+ HPPA_PID0_REGNUM, HPPA_PID1_REGNUM, HPPA_PID2_REGNUM,
+ HPPA_PID3_REGNUM, HPPA_CCR_REGNUM, HPPA_EIEM_REGNUM,
+};
/* Fetch one register. */
@@ -239,9 +273,9 @@ fetch_register (struct regcache *regcache, int regno)
errno = 0;
val = ptrace (PTRACE_PEEKUSER, tid, hppa_linux_register_addr (regno, 0), 0);
if (errno != 0)
- error (_("Couldn't read register %s (#%d): %s."),
- gdbarch_register_name (gdbarch, regno),
- regno, safe_strerror (errno));
+ error (_ ("Couldn't read register %s (#%d): %s."),
+ gdbarch_register_name (gdbarch, regno), regno,
+ safe_strerror (errno));
regcache->raw_supply (regno, &val);
}
@@ -264,9 +298,9 @@ store_register (const struct regcache *regcache, int regno)
regcache->raw_collect (regno, &val);
ptrace (PTRACE_POKEUSER, tid, hppa_linux_register_addr (regno, 0), val);
if (errno != 0)
- error (_("Couldn't write register %s (#%d): %s."),
- gdbarch_register_name (gdbarch, regno),
- regno, safe_strerror (errno));
+ error (_ ("Couldn't write register %s (#%d): %s."),
+ gdbarch_register_name (gdbarch, regno), regno,
+ safe_strerror (errno));
}
/* Fetch registers from the child process. Fetch all registers if
@@ -278,12 +312,10 @@ hppa_linux_nat_target::fetch_registers (struct regcache *regcache, int regno)
{
if (-1 == regno)
{
- for (regno = 0;
- regno < gdbarch_num_regs (regcache->arch ());
- regno++)
+ for (regno = 0; regno < gdbarch_num_regs (regcache->arch ()); regno++)
fetch_register (regcache, regno);
}
- else
+ else
{
fetch_register (regcache, regno);
}
@@ -298,9 +330,7 @@ hppa_linux_nat_target::store_registers (struct regcache *regcache, int regno)
{
if (-1 == regno)
{
- for (regno = 0;
- regno < gdbarch_num_regs (regcache->arch ());
- regno++)
+ for (regno = 0; regno < gdbarch_num_regs (regcache->arch ()); regno++)
store_register (regcache, regno);
}
else
@@ -330,8 +360,8 @@ supply_gregset (struct regcache *regcache, const gdb_gregset_t *gregsetp)
If regno is -1, do this for all registers. */
void
-fill_gregset (const struct regcache *regcache,
- gdb_gregset_t *gregsetp, int regno)
+fill_gregset (const struct regcache *regcache, gdb_gregset_t *gregsetp,
+ int regno)
{
int i;
@@ -357,8 +387,8 @@ supply_fpregset (struct regcache *regcache, const gdb_fpregset_t *fpregsetp)
for (regi = 0; regi <= 31; regi++)
{
from = (const char *) &((*fpregsetp)[regi]);
- regcache->raw_supply (2*regi + HPPA_FP0_REGNUM, from);
- regcache->raw_supply (2*regi + HPPA_FP0_REGNUM + 1, from + 4);
+ regcache->raw_supply (2 * regi + HPPA_FP0_REGNUM, from);
+ regcache->raw_supply (2 * regi + HPPA_FP0_REGNUM + 1, from + 4);
}
}
@@ -368,23 +398,24 @@ supply_fpregset (struct regcache *regcache, const gdb_fpregset_t *fpregsetp)
them all. */
void
-fill_fpregset (const struct regcache *regcache,
- gdb_fpregset_t *fpregsetp, int regno)
+fill_fpregset (const struct regcache *regcache, gdb_fpregset_t *fpregsetp,
+ int regno)
{
int i;
for (i = HPPA_FP0_REGNUM; i < HPPA_FP0_REGNUM + 32 * 2; i++)
- {
+ {
/* Gross. fpregset_t is double, registers[x] has single
precision reg. */
char *to = (char *) &((*fpregsetp)[(i - HPPA_FP0_REGNUM) / 2]);
if ((i - HPPA_FP0_REGNUM) & 1)
to += 4;
regcache->raw_collect (i, to);
- }
+ }
}
void _initialize_hppa_linux_nat ();
+
void
_initialize_hppa_linux_nat ()
{
diff --git a/gdb/hppa-linux-offsets.h b/gdb/hppa-linux-offsets.h
index 999145026cd..33f1f1a5ceb 100644
--- a/gdb/hppa-linux-offsets.h
+++ b/gdb/hppa-linux-offsets.h
@@ -20,89 +20,89 @@
#ifndef HPPA_LINUX_OFFSETS_H
#define HPPA_LINUX_OFFSETS_H
-#define PT_PSW offsetof(struct pt_regs, gr[ 0])
-#define PT_GR1 offsetof(struct pt_regs, gr[ 1])
-#define PT_GR2 offsetof(struct pt_regs, gr[ 2])
-#define PT_GR3 offsetof(struct pt_regs, gr[ 3])
-#define PT_GR4 offsetof(struct pt_regs, gr[ 4])
-#define PT_GR5 offsetof(struct pt_regs, gr[ 5])
-#define PT_GR6 offsetof(struct pt_regs, gr[ 6])
-#define PT_GR7 offsetof(struct pt_regs, gr[ 7])
-#define PT_GR8 offsetof(struct pt_regs, gr[ 8])
-#define PT_GR9 offsetof(struct pt_regs, gr[ 9])
-#define PT_GR10 offsetof(struct pt_regs, gr[10])
-#define PT_GR11 offsetof(struct pt_regs, gr[11])
-#define PT_GR12 offsetof(struct pt_regs, gr[12])
-#define PT_GR13 offsetof(struct pt_regs, gr[13])
-#define PT_GR14 offsetof(struct pt_regs, gr[14])
-#define PT_GR15 offsetof(struct pt_regs, gr[15])
-#define PT_GR16 offsetof(struct pt_regs, gr[16])
-#define PT_GR17 offsetof(struct pt_regs, gr[17])
-#define PT_GR18 offsetof(struct pt_regs, gr[18])
-#define PT_GR19 offsetof(struct pt_regs, gr[19])
-#define PT_GR20 offsetof(struct pt_regs, gr[20])
-#define PT_GR21 offsetof(struct pt_regs, gr[21])
-#define PT_GR22 offsetof(struct pt_regs, gr[22])
-#define PT_GR23 offsetof(struct pt_regs, gr[23])
-#define PT_GR24 offsetof(struct pt_regs, gr[24])
-#define PT_GR25 offsetof(struct pt_regs, gr[25])
-#define PT_GR26 offsetof(struct pt_regs, gr[26])
-#define PT_GR27 offsetof(struct pt_regs, gr[27])
-#define PT_GR28 offsetof(struct pt_regs, gr[28])
-#define PT_GR29 offsetof(struct pt_regs, gr[29])
-#define PT_GR30 offsetof(struct pt_regs, gr[30])
-#define PT_GR31 offsetof(struct pt_regs, gr[31])
-#define PT_FR0 offsetof(struct pt_regs, fr[ 0])
-#define PT_FR1 offsetof(struct pt_regs, fr[ 1])
-#define PT_FR2 offsetof(struct pt_regs, fr[ 2])
-#define PT_FR3 offsetof(struct pt_regs, fr[ 3])
-#define PT_FR4 offsetof(struct pt_regs, fr[ 4])
-#define PT_FR5 offsetof(struct pt_regs, fr[ 5])
-#define PT_FR6 offsetof(struct pt_regs, fr[ 6])
-#define PT_FR7 offsetof(struct pt_regs, fr[ 7])
-#define PT_FR8 offsetof(struct pt_regs, fr[ 8])
-#define PT_FR9 offsetof(struct pt_regs, fr[ 9])
-#define PT_FR10 offsetof(struct pt_regs, fr[10])
-#define PT_FR11 offsetof(struct pt_regs, fr[11])
-#define PT_FR12 offsetof(struct pt_regs, fr[12])
-#define PT_FR13 offsetof(struct pt_regs, fr[13])
-#define PT_FR14 offsetof(struct pt_regs, fr[14])
-#define PT_FR15 offsetof(struct pt_regs, fr[15])
-#define PT_FR16 offsetof(struct pt_regs, fr[16])
-#define PT_FR17 offsetof(struct pt_regs, fr[17])
-#define PT_FR18 offsetof(struct pt_regs, fr[18])
-#define PT_FR19 offsetof(struct pt_regs, fr[19])
-#define PT_FR20 offsetof(struct pt_regs, fr[20])
-#define PT_FR21 offsetof(struct pt_regs, fr[21])
-#define PT_FR22 offsetof(struct pt_regs, fr[22])
-#define PT_FR23 offsetof(struct pt_regs, fr[23])
-#define PT_FR24 offsetof(struct pt_regs, fr[24])
-#define PT_FR25 offsetof(struct pt_regs, fr[25])
-#define PT_FR26 offsetof(struct pt_regs, fr[26])
-#define PT_FR27 offsetof(struct pt_regs, fr[27])
-#define PT_FR28 offsetof(struct pt_regs, fr[28])
-#define PT_FR29 offsetof(struct pt_regs, fr[29])
-#define PT_FR30 offsetof(struct pt_regs, fr[30])
-#define PT_FR31 offsetof(struct pt_regs, fr[31])
-#define PT_SR0 offsetof(struct pt_regs, sr[ 0])
-#define PT_SR1 offsetof(struct pt_regs, sr[ 1])
-#define PT_SR2 offsetof(struct pt_regs, sr[ 2])
-#define PT_SR3 offsetof(struct pt_regs, sr[ 3])
-#define PT_SR4 offsetof(struct pt_regs, sr[ 4])
-#define PT_SR5 offsetof(struct pt_regs, sr[ 5])
-#define PT_SR6 offsetof(struct pt_regs, sr[ 6])
-#define PT_SR7 offsetof(struct pt_regs, sr[ 7])
-#define PT_IASQ0 offsetof(struct pt_regs, iasq[0])
-#define PT_IASQ1 offsetof(struct pt_regs, iasq[1])
-#define PT_IAOQ0 offsetof(struct pt_regs, iaoq[0])
-#define PT_IAOQ1 offsetof(struct pt_regs, iaoq[1])
-#define PT_CR27 offsetof(struct pt_regs, cr27)
-#define PT_ORIG_R28 offsetof(struct pt_regs, orig_r28)
-#define PT_KSP offsetof(struct pt_regs, ksp)
-#define PT_KPC offsetof(struct pt_regs, kpc)
-#define PT_SAR offsetof(struct pt_regs, sar)
-#define PT_IIR offsetof(struct pt_regs, iir)
-#define PT_ISR offsetof(struct pt_regs, isr)
-#define PT_IOR offsetof(struct pt_regs, ior)
+#define PT_PSW offsetof (struct pt_regs, gr[0])
+#define PT_GR1 offsetof (struct pt_regs, gr[1])
+#define PT_GR2 offsetof (struct pt_regs, gr[2])
+#define PT_GR3 offsetof (struct pt_regs, gr[3])
+#define PT_GR4 offsetof (struct pt_regs, gr[4])
+#define PT_GR5 offsetof (struct pt_regs, gr[5])
+#define PT_GR6 offsetof (struct pt_regs, gr[6])
+#define PT_GR7 offsetof (struct pt_regs, gr[7])
+#define PT_GR8 offsetof (struct pt_regs, gr[8])
+#define PT_GR9 offsetof (struct pt_regs, gr[9])
+#define PT_GR10 offsetof (struct pt_regs, gr[10])
+#define PT_GR11 offsetof (struct pt_regs, gr[11])
+#define PT_GR12 offsetof (struct pt_regs, gr[12])
+#define PT_GR13 offsetof (struct pt_regs, gr[13])
+#define PT_GR14 offsetof (struct pt_regs, gr[14])
+#define PT_GR15 offsetof (struct pt_regs, gr[15])
+#define PT_GR16 offsetof (struct pt_regs, gr[16])
+#define PT_GR17 offsetof (struct pt_regs, gr[17])
+#define PT_GR18 offsetof (struct pt_regs, gr[18])
+#define PT_GR19 offsetof (struct pt_regs, gr[19])
+#define PT_GR20 offsetof (struct pt_regs, gr[20])
+#define PT_GR21 offsetof (struct pt_regs, gr[21])
+#define PT_GR22 offsetof (struct pt_regs, gr[22])
+#define PT_GR23 offsetof (struct pt_regs, gr[23])
+#define PT_GR24 offsetof (struct pt_regs, gr[24])
+#define PT_GR25 offsetof (struct pt_regs, gr[25])
+#define PT_GR26 offsetof (struct pt_regs, gr[26])
+#define PT_GR27 offsetof (struct pt_regs, gr[27])
+#define PT_GR28 offsetof (struct pt_regs, gr[28])
+#define PT_GR29 offsetof (struct pt_regs, gr[29])
+#define PT_GR30 offsetof (struct pt_regs, gr[30])
+#define PT_GR31 offsetof (struct pt_regs, gr[31])
+#define PT_FR0 offsetof (struct pt_regs, fr[0])
+#define PT_FR1 offsetof (struct pt_regs, fr[1])
+#define PT_FR2 offsetof (struct pt_regs, fr[2])
+#define PT_FR3 offsetof (struct pt_regs, fr[3])
+#define PT_FR4 offsetof (struct pt_regs, fr[4])
+#define PT_FR5 offsetof (struct pt_regs, fr[5])
+#define PT_FR6 offsetof (struct pt_regs, fr[6])
+#define PT_FR7 offsetof (struct pt_regs, fr[7])
+#define PT_FR8 offsetof (struct pt_regs, fr[8])
+#define PT_FR9 offsetof (struct pt_regs, fr[9])
+#define PT_FR10 offsetof (struct pt_regs, fr[10])
+#define PT_FR11 offsetof (struct pt_regs, fr[11])
+#define PT_FR12 offsetof (struct pt_regs, fr[12])
+#define PT_FR13 offsetof (struct pt_regs, fr[13])
+#define PT_FR14 offsetof (struct pt_regs, fr[14])
+#define PT_FR15 offsetof (struct pt_regs, fr[15])
+#define PT_FR16 offsetof (struct pt_regs, fr[16])
+#define PT_FR17 offsetof (struct pt_regs, fr[17])
+#define PT_FR18 offsetof (struct pt_regs, fr[18])
+#define PT_FR19 offsetof (struct pt_regs, fr[19])
+#define PT_FR20 offsetof (struct pt_regs, fr[20])
+#define PT_FR21 offsetof (struct pt_regs, fr[21])
+#define PT_FR22 offsetof (struct pt_regs, fr[22])
+#define PT_FR23 offsetof (struct pt_regs, fr[23])
+#define PT_FR24 offsetof (struct pt_regs, fr[24])
+#define PT_FR25 offsetof (struct pt_regs, fr[25])
+#define PT_FR26 offsetof (struct pt_regs, fr[26])
+#define PT_FR27 offsetof (struct pt_regs, fr[27])
+#define PT_FR28 offsetof (struct pt_regs, fr[28])
+#define PT_FR29 offsetof (struct pt_regs, fr[29])
+#define PT_FR30 offsetof (struct pt_regs, fr[30])
+#define PT_FR31 offsetof (struct pt_regs, fr[31])
+#define PT_SR0 offsetof (struct pt_regs, sr[0])
+#define PT_SR1 offsetof (struct pt_regs, sr[1])
+#define PT_SR2 offsetof (struct pt_regs, sr[2])
+#define PT_SR3 offsetof (struct pt_regs, sr[3])
+#define PT_SR4 offsetof (struct pt_regs, sr[4])
+#define PT_SR5 offsetof (struct pt_regs, sr[5])
+#define PT_SR6 offsetof (struct pt_regs, sr[6])
+#define PT_SR7 offsetof (struct pt_regs, sr[7])
+#define PT_IASQ0 offsetof (struct pt_regs, iasq[0])
+#define PT_IASQ1 offsetof (struct pt_regs, iasq[1])
+#define PT_IAOQ0 offsetof (struct pt_regs, iaoq[0])
+#define PT_IAOQ1 offsetof (struct pt_regs, iaoq[1])
+#define PT_CR27 offsetof (struct pt_regs, cr27)
+#define PT_ORIG_R28 offsetof (struct pt_regs, orig_r28)
+#define PT_KSP offsetof (struct pt_regs, ksp)
+#define PT_KPC offsetof (struct pt_regs, kpc)
+#define PT_SAR offsetof (struct pt_regs, sar)
+#define PT_IIR offsetof (struct pt_regs, iir)
+#define PT_ISR offsetof (struct pt_regs, isr)
+#define PT_IOR offsetof (struct pt_regs, ior)
#endif /* HPPA_LINUX_OFFSETS_H */
diff --git a/gdb/hppa-linux-tdep.c b/gdb/hppa-linux-tdep.c
index 32b13ae0575..d7d741ea7f7 100644
--- a/gdb/hppa-linux-tdep.c
+++ b/gdb/hppa-linux-tdep.c
@@ -54,15 +54,15 @@ hppa_linux_target_write_pc (struct regcache *regcache, CORE_ADDR v)
{
/* Probably this should be done by the kernel, but it isn't. */
regcache_cooked_write_unsigned (regcache, HPPA_PCOQ_HEAD_REGNUM, v | 0x3);
- regcache_cooked_write_unsigned (regcache,
- HPPA_PCOQ_TAIL_REGNUM, (v + 4) | 0x3);
+ regcache_cooked_write_unsigned (regcache, HPPA_PCOQ_TAIL_REGNUM,
+ (v + 4) | 0x3);
}
/* An instruction to match. */
struct insn_pattern
{
- unsigned int data; /* See if it matches this.... */
- unsigned int mask; /* ... with this mask. */
+ unsigned int data; /* See if it matches this.... */
+ unsigned int mask; /* ... with this mask. */
};
static struct insn_pattern hppa_sigtramp[] = {
@@ -88,8 +88,7 @@ static struct insn_pattern hppa_sigtramp[] = {
matched. */
static int
insns_match_pattern (struct gdbarch *gdbarch, CORE_ADDR pc,
- struct insn_pattern *pattern,
- unsigned int *insn)
+ struct insn_pattern *pattern, unsigned int *insn)
{
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
int i;
@@ -137,9 +136,9 @@ hppa_linux_sigtramp_find_sigcontext (struct gdbarch *gdbarch, CORE_ADDR pc)
int offs = 0;
int attempt;
/* offsets to try to find the trampoline */
- static int pcoffs[] = { 0, 4*4, 5*4 };
+ static int pcoffs[] = { 0, 4 * 4, 5 * 4 };
/* offsets to the rt_sigframe structure */
- static int sfoffs[] = { 4*4, 10*4, 10*4 };
+ static int sfoffs[] = { 4 * 4, 10 * 4, 10 * 4 };
CORE_ADDR sp;
/* Most of the time, this will be correct. The one case when this will
@@ -155,8 +154,8 @@ hppa_linux_sigtramp_find_sigcontext (struct gdbarch *gdbarch, CORE_ADDR pc)
for (attempt = 0; attempt < ARRAY_SIZE (pcoffs); attempt++)
{
- if (insns_match_pattern (gdbarch, sp + pcoffs[attempt],
- hppa_sigtramp, dummy))
+ if (insns_match_pattern (gdbarch, sp + pcoffs[attempt], hppa_sigtramp,
+ dummy))
{
offs = sfoffs[attempt];
break;
@@ -284,8 +283,8 @@ hppa_linux_sigtramp_frame_prev_register (frame_info_ptr this_frame,
{
struct hppa_linux_sigtramp_unwind_cache *info
= hppa_linux_sigtramp_frame_unwind_cache (this_frame, this_prologue_cache);
- return hppa_frame_prev_register_helper (this_frame,
- info->saved_regs, regnum);
+ return hppa_frame_prev_register_helper (this_frame, info->saved_regs,
+ regnum);
}
/* hppa-linux always uses "new-style" rt-signals. The signal handler's return
@@ -308,15 +307,14 @@ hppa_linux_sigtramp_frame_sniffer (const struct frame_unwind *self,
return 0;
}
-static const struct frame_unwind hppa_linux_sigtramp_frame_unwind = {
- "hppa linux sigtramp",
- SIGTRAMP_FRAME,
- default_frame_unwind_stop_reason,
- hppa_linux_sigtramp_frame_this_id,
- hppa_linux_sigtramp_frame_prev_register,
- NULL,
- hppa_linux_sigtramp_frame_sniffer
-};
+static const struct frame_unwind hppa_linux_sigtramp_frame_unwind
+ = { "hppa linux sigtramp",
+ SIGTRAMP_FRAME,
+ default_frame_unwind_stop_reason,
+ hppa_linux_sigtramp_frame_this_id,
+ hppa_linux_sigtramp_frame_prev_register,
+ NULL,
+ hppa_linux_sigtramp_frame_sniffer };
/* Attempt to find (and return) the global pointer for the given
function.
@@ -335,7 +333,7 @@ hppa_linux_find_global_pointer (struct gdbarch *gdbarch,
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
struct obj_section *faddr_sect;
CORE_ADDR faddr;
-
+
faddr = value_as_address (function);
/* Is this a plabel? If so, dereference it to get the gp value. */
@@ -393,8 +391,8 @@ hppa_linux_find_global_pointer (struct gdbarch *gdbarch,
status = target_read_memory (addr + 4, buf, sizeof (buf));
if (status != 0)
break;
- global_pointer = extract_unsigned_integer (buf, sizeof (buf),
- byte_order);
+ global_pointer
+ = extract_unsigned_integer (buf, sizeof (buf), byte_order);
/* The payoff... */
return global_pointer;
}
@@ -408,7 +406,7 @@ hppa_linux_find_global_pointer (struct gdbarch *gdbarch,
}
return 0;
}
-
+
/*
* Registers saved in a coredump:
* gr0..gr31
@@ -421,54 +419,33 @@ hppa_linux_find_global_pointer (struct gdbarch *gdbarch,
* cr10, cr15
*/
-static const struct regcache_map_entry hppa_linux_gregmap[] =
- {
- { 32, HPPA_R0_REGNUM },
- { 1, HPPA_SR4_REGNUM+1 },
- { 1, HPPA_SR4_REGNUM+2 },
- { 1, HPPA_SR4_REGNUM+3 },
- { 1, HPPA_SR4_REGNUM+4 },
- { 1, HPPA_SR4_REGNUM },
- { 1, HPPA_SR4_REGNUM+5 },
- { 1, HPPA_SR4_REGNUM+6 },
- { 1, HPPA_SR4_REGNUM+7 },
- { 1, HPPA_PCOQ_HEAD_REGNUM },
- { 1, HPPA_PCOQ_TAIL_REGNUM },
- { 1, HPPA_PCSQ_HEAD_REGNUM },
- { 1, HPPA_PCSQ_TAIL_REGNUM },
- { 1, HPPA_SAR_REGNUM },
- { 1, HPPA_IIR_REGNUM },
- { 1, HPPA_ISR_REGNUM },
- { 1, HPPA_IOR_REGNUM },
- { 1, HPPA_IPSW_REGNUM },
- { 1, HPPA_RCR_REGNUM },
- { 8, HPPA_TR0_REGNUM },
- { 4, HPPA_PID0_REGNUM },
- { 1, HPPA_CCR_REGNUM },
- { 1, HPPA_EIEM_REGNUM },
- { 0 }
- };
-
-static const struct regcache_map_entry hppa_linux_fpregmap[] =
- {
- /* FIXME: Only works for 32-bit mode. In 64-bit mode there should
+static const struct regcache_map_entry hppa_linux_gregmap[]
+ = { { 32, HPPA_R0_REGNUM }, { 1, HPPA_SR4_REGNUM + 1 },
+ { 1, HPPA_SR4_REGNUM + 2 }, { 1, HPPA_SR4_REGNUM + 3 },
+ { 1, HPPA_SR4_REGNUM + 4 }, { 1, HPPA_SR4_REGNUM },
+ { 1, HPPA_SR4_REGNUM + 5 }, { 1, HPPA_SR4_REGNUM + 6 },
+ { 1, HPPA_SR4_REGNUM + 7 }, { 1, HPPA_PCOQ_HEAD_REGNUM },
+ { 1, HPPA_PCOQ_TAIL_REGNUM }, { 1, HPPA_PCSQ_HEAD_REGNUM },
+ { 1, HPPA_PCSQ_TAIL_REGNUM }, { 1, HPPA_SAR_REGNUM },
+ { 1, HPPA_IIR_REGNUM }, { 1, HPPA_ISR_REGNUM },
+ { 1, HPPA_IOR_REGNUM }, { 1, HPPA_IPSW_REGNUM },
+ { 1, HPPA_RCR_REGNUM }, { 8, HPPA_TR0_REGNUM },
+ { 4, HPPA_PID0_REGNUM }, { 1, HPPA_CCR_REGNUM },
+ { 1, HPPA_EIEM_REGNUM }, { 0 } };
+
+static const struct regcache_map_entry hppa_linux_fpregmap[] = {
+ /* FIXME: Only works for 32-bit mode. In 64-bit mode there should
be 32 fpregs, 8 bytes each. */
- { 64, HPPA_FP0_REGNUM, 4 },
- { 0 }
- };
+ { 64, HPPA_FP0_REGNUM, 4 },
+ { 0 }
+};
/* HPPA Linux kernel register set. */
-static const struct regset hppa_linux_regset =
-{
- hppa_linux_gregmap,
- regcache_supply_regset, regcache_collect_regset
-};
+static const struct regset hppa_linux_regset
+ = { hppa_linux_gregmap, regcache_supply_regset, regcache_collect_regset };
-static const struct regset hppa_linux_fpregset =
-{
- hppa_linux_fpregmap,
- regcache_supply_regset, regcache_collect_regset
-};
+static const struct regset hppa_linux_fpregset
+ = { hppa_linux_fpregmap, regcache_supply_regset, regcache_collect_regset };
static void
hppa_linux_iterate_over_regset_sections (struct gdbarch *gdbarch,
@@ -500,8 +477,8 @@ hppa_linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
frame_unwind_append_unwinder (gdbarch, &hppa_linux_sigtramp_frame_unwind);
/* GNU/Linux uses SVR4-style shared libraries. */
- set_solib_svr4_fetch_link_map_offsets
- (gdbarch, linux_ilp32_fetch_link_map_offsets);
+ set_solib_svr4_fetch_link_map_offsets (gdbarch,
+ linux_ilp32_fetch_link_map_offsets);
tdep->in_solib_call_trampoline = hppa_in_solib_call_trampoline;
set_gdbarch_skip_trampoline_code (gdbarch, hppa_skip_trampoline_code);
@@ -515,8 +492,8 @@ hppa_linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
set_gdbarch_long_double_bit (gdbarch, 64);
set_gdbarch_long_double_format (gdbarch, floatformats_ieee_double);
- set_gdbarch_iterate_over_regset_sections
- (gdbarch, hppa_linux_iterate_over_regset_sections);
+ set_gdbarch_iterate_over_regset_sections (
+ gdbarch, hppa_linux_iterate_over_regset_sections);
set_gdbarch_dwarf2_reg_to_regnum (gdbarch, hppa_dwarf_reg_to_regnum);
@@ -526,11 +503,12 @@ hppa_linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
}
void _initialize_hppa_linux_tdep ();
+
void
_initialize_hppa_linux_tdep ()
{
gdbarch_register_osabi (bfd_arch_hppa, 0, GDB_OSABI_LINUX,
hppa_linux_init_abi);
- gdbarch_register_osabi (bfd_arch_hppa, bfd_mach_hppa20w,
- GDB_OSABI_LINUX, hppa_linux_init_abi);
+ gdbarch_register_osabi (bfd_arch_hppa, bfd_mach_hppa20w, GDB_OSABI_LINUX,
+ hppa_linux_init_abi);
}
diff --git a/gdb/hppa-netbsd-nat.c b/gdb/hppa-netbsd-nat.c
index 124149b1f78..01996b575bc 100644
--- a/gdb/hppa-netbsd-nat.c
+++ b/gdb/hppa-netbsd-nat.c
@@ -41,10 +41,10 @@ static hppa_nbsd_nat_target the_hppa_nbsd_nat_target;
static int
hppanbsd_gregset_supplies_p (int regnum)
{
- return ((regnum >= HPPA_R0_REGNUM && regnum <= HPPA_R31_REGNUM) ||
- (regnum >= HPPA_SAR_REGNUM && regnum <= HPPA_PCSQ_TAIL_REGNUM) ||
- regnum == HPPA_IPSW_REGNUM ||
- (regnum >= HPPA_SR4_REGNUM && regnum <= HPPA_SR4_REGNUM + 5));
+ return ((regnum >= HPPA_R0_REGNUM && regnum <= HPPA_R31_REGNUM)
+ || (regnum >= HPPA_SAR_REGNUM && regnum <= HPPA_PCSQ_TAIL_REGNUM)
+ || regnum == HPPA_IPSW_REGNUM
+ || (regnum >= HPPA_SR4_REGNUM && regnum <= HPPA_SR4_REGNUM + 5));
}
static int
@@ -98,8 +98,8 @@ hppanbsd_supply_fpregset (struct regcache *regcache, const void *fpregs)
in GREGS. */
static void
-hppanbsd_collect_gregset (const struct regcache *regcache,
- void *gregs, int regnum)
+hppanbsd_collect_gregset (const struct regcache *regcache, void *gregs,
+ int regnum)
{
char *regs = gregs;
int *r = gregs;
@@ -146,8 +146,7 @@ hppanbsd_collect_gregset (const struct regcache *regcache,
in FPREGS. */
static void
-hppanbsd_collect_fpregset (struct regcache *regcache,
- void *fpregs, int regnum)
+hppanbsd_collect_fpregset (struct regcache *regcache, void *fpregs, int regnum)
{
char *regs = fpregs;
int i;
@@ -161,7 +160,6 @@ hppanbsd_collect_fpregset (struct regcache *regcache,
}
}
}
-
/* Fetch register REGNUM from the inferior. If REGNUM is -1, do this
for all registers (including the floating-point registers). */
@@ -178,7 +176,7 @@ hppa_nbsd_nat_target::fetch_registers (struct regcache *regcache, int regnum)
struct reg regs;
if (ptrace (PT_GETREGS, pid, (PTRACE_TYPE_ARG3) &regs, lwp) == -1)
- perror_with_name (_("Couldn't get registers"));
+ perror_with_name (_ ("Couldn't get registers"));
hppanbsd_supply_gregset (regcache, &regs);
}
@@ -188,7 +186,7 @@ hppa_nbsd_nat_target::fetch_registers (struct regcache *regcache, int regnum)
struct fpreg fpregs;
if (ptrace (PT_GETFPREGS, pid, (PTRACE_TYPE_ARG3) &fpregs, lwp) == -1)
- perror_with_name (_("Couldn't get floating point status"));
+ perror_with_name (_ ("Couldn't get floating point status"));
hppanbsd_supply_fpregset (regcache, &fpregs);
}
@@ -208,12 +206,12 @@ hppa_nbsd_nat_target::store_registers (struct regcache *regcache, int regnum)
struct reg regs;
if (ptrace (PT_GETREGS, pid, (PTRACE_TYPE_ARG3) &regs, lwp) == -1)
- perror_with_name (_("Couldn't get registers"));
+ perror_with_name (_ ("Couldn't get registers"));
hppanbsd_collect_gregset (regcache, &regs, regnum);
if (ptrace (PT_SETREGS, pid, (PTRACE_TYPE_ARG3) &regs, lwp) == -1)
- perror_with_name (_("Couldn't write registers"));
+ perror_with_name (_ ("Couldn't write registers"));
}
if (regnum == -1 || hppanbsd_fpregset_supplies_p (regnum))
@@ -221,16 +219,17 @@ hppa_nbsd_nat_target::store_registers (struct regcache *regcache, int regnum)
struct fpreg fpregs;
if (ptrace (PT_GETFPREGS, pid, (PTRACE_TYPE_ARG3) &fpregs, lwp) == -1)
- perror_with_name (_("Couldn't get floating point status"));
+ perror_with_name (_ ("Couldn't get floating point status"));
hppanbsd_collect_fpregset (regcache, &fpregs, regnum);
if (ptrace (PT_SETFPREGS, pid, (PTRACE_TYPE_ARG3) &fpregs, lwp) == -1)
- perror_with_name (_("Couldn't write floating point status"));
+ perror_with_name (_ ("Couldn't write floating point status"));
}
}
void _initialize_hppanbsd_nat ();
+
void
_initialize_hppanbsd_nat ()
{
diff --git a/gdb/hppa-netbsd-tdep.c b/gdb/hppa-netbsd-tdep.c
index 6e3b62ae13d..a5546a98fc6 100644
--- a/gdb/hppa-netbsd-tdep.c
+++ b/gdb/hppa-netbsd-tdep.c
@@ -31,77 +31,71 @@
#include "gdbarch.h"
/* From <machine/mcontext.h>. */
-static int hppanbsd_mc_reg_offset[] =
-{
+static int hppanbsd_mc_reg_offset[] = {
/* r0 ... r31 */
- -1, 1 * 4, 2 * 4, 3 * 4,
- 4 * 4, 5 * 4, 6 * 4, 7 * 4,
- 8 * 4, 9 * 4, 10 * 4, 11 * 4,
- 12 * 4, 13 * 4, 14 * 4, 15 * 4,
- 16 * 4, 17 * 4, 18 * 4, 19 * 4,
- 20 * 4, 21 * 4, 22 * 4, 23 * 4,
- 24 * 4, 25 * 4, 26 * 4, 27 * 4,
- 28 * 4, 29 * 4, 30 * 4, 31 * 4,
-
- 32 * 4, /* HPPA_SAR_REGNUM */
- 35 * 4, /* HPPA_PCOQ_HEAD_REGNUM */
- 33 * 4, /* HPPA_PCSQ_HEAD_REGNUM */
- 36 * 4, /* HPPA_PCOQ_TAIL_REGNUM */
- 34 * 4, /* HPPA_PCSQ_TAIL_REGNUM */
- -1, /* HPPA_EIEM_REGNUM */
- -1, /* HPPA_IIR_REGNUM */
- -1, /* HPPA_ISR_REGNUM */
- -1, /* HPPA_IOR_REGNUM */
- 0 * 4, /* HPPA_IPSW_REGNUM */
- -1, /* spare? */
- 41 * 4, /* HPPA_SR4_REGNUM */
- 37 * 4, /* sr0 */
- 38 * 4, /* sr1 */
- 39 * 4, /* sr2 */
- 40 * 4, /* sr3 */
+ -1, 1 * 4, 2 * 4, 3 * 4, 4 * 4, 5 * 4, 6 * 4, 7 * 4,
+ 8 * 4, 9 * 4, 10 * 4, 11 * 4, 12 * 4, 13 * 4, 14 * 4, 15 * 4,
+ 16 * 4, 17 * 4, 18 * 4, 19 * 4, 20 * 4, 21 * 4, 22 * 4, 23 * 4,
+ 24 * 4, 25 * 4, 26 * 4, 27 * 4, 28 * 4, 29 * 4, 30 * 4, 31 * 4,
+
+ 32 * 4, /* HPPA_SAR_REGNUM */
+ 35 * 4, /* HPPA_PCOQ_HEAD_REGNUM */
+ 33 * 4, /* HPPA_PCSQ_HEAD_REGNUM */
+ 36 * 4, /* HPPA_PCOQ_TAIL_REGNUM */
+ 34 * 4, /* HPPA_PCSQ_TAIL_REGNUM */
+ -1, /* HPPA_EIEM_REGNUM */
+ -1, /* HPPA_IIR_REGNUM */
+ -1, /* HPPA_ISR_REGNUM */
+ -1, /* HPPA_IOR_REGNUM */
+ 0 * 4, /* HPPA_IPSW_REGNUM */
+ -1, /* spare? */
+ 41 * 4, /* HPPA_SR4_REGNUM */
+ 37 * 4, /* sr0 */
+ 38 * 4, /* sr1 */
+ 39 * 4, /* sr2 */
+ 40 * 4, /* sr3 */
/* more tbd */
};
static void hppanbsd_sigtramp_cache_init (const struct tramp_frame *,
- frame_info_ptr,
- struct trad_frame_cache *,
- CORE_ADDR);
+ frame_info_ptr,
+ struct trad_frame_cache *,
+ CORE_ADDR);
-static const struct tramp_frame hppanbsd_sigtramp_si4 =
-{
+/* clang-format off */
+static const struct tramp_frame hppanbsd_sigtramp_si4 = {
SIGTRAMP_FRAME,
4,
- {
- { 0xc7d7c012, ULONGEST_MAX }, /* bb,>=,n %arg3, 30, 1f */
- { 0xd6e01c1e, ULONGEST_MAX }, /* depwi 0,31,2,%arg3 */
- { 0x0ee81093, ULONGEST_MAX }, /* ldw 4(%arg3), %r19 */
- { 0x0ee01097, ULONGEST_MAX }, /* ldw 0(%arg3), %arg3 */
- /* 1: */
- { 0xe8404000, ULONGEST_MAX }, /* blr %r0, %rp */
- { 0xeae0c002, ULONGEST_MAX }, /* bv,n %r0(%arg3) */
- { 0x08000240, ULONGEST_MAX }, /* nop */
-
- { 0x0803025a, ULONGEST_MAX }, /* copy %r3, %arg0 */
- { 0x20200801, ULONGEST_MAX }, /* ldil -40000000, %r1 */
- { 0xe420e008, ULONGEST_MAX }, /* be,l 4(%sr7, %r1), %sr0, %r31 */
- { 0x34160268, ULONGEST_MAX }, /* ldi 134, %t1 ; SYS_setcontext */
-
- { 0x081c025a, ULONGEST_MAX }, /* copy ret0, %arg0 */
- { 0x20200801, ULONGEST_MAX }, /* ldil -40000000, %r1 */
- { 0xe420e008, ULONGEST_MAX }, /* be,l 4(%sr7, %r1), %sr0, %r31 */
- { 0x34160002, ULONGEST_MAX }, /* ldi 1, %t1 ; SYS_exit */
- { TRAMP_SENTINEL_INSN, ULONGEST_MAX }
- },
+ { { 0xc7d7c012, ULONGEST_MAX }, /* bb,>=,n %arg3, 30, 1f */
+ { 0xd6e01c1e, ULONGEST_MAX }, /* depwi 0,31,2,%arg3 */
+ { 0x0ee81093, ULONGEST_MAX }, /* ldw 4(%arg3), %r19 */
+ { 0x0ee01097, ULONGEST_MAX }, /* ldw 0(%arg3), %arg3 */
+ /* 1: */
+ { 0xe8404000, ULONGEST_MAX }, /* blr %r0, %rp */
+ { 0xeae0c002, ULONGEST_MAX }, /* bv,n %r0(%arg3) */
+ { 0x08000240, ULONGEST_MAX }, /* nop */
+
+ { 0x0803025a, ULONGEST_MAX }, /* copy %r3, %arg0 */
+ { 0x20200801, ULONGEST_MAX }, /* ldil -40000000, %r1 */
+ { 0xe420e008, ULONGEST_MAX }, /* be,l 4(%sr7, %r1), %sr0, %r31 */
+ { 0x34160268, ULONGEST_MAX }, /* ldi 134, %t1 ; SYS_setcontext */
+
+ { 0x081c025a, ULONGEST_MAX }, /* copy ret0, %arg0 */
+ { 0x20200801, ULONGEST_MAX }, /* ldil -40000000, %r1 */
+ { 0xe420e008, ULONGEST_MAX }, /* be,l 4(%sr7, %r1), %sr0, %r31 */
+ { 0x34160002, ULONGEST_MAX }, /* ldi 1, %t1 ; SYS_exit */
+ { TRAMP_SENTINEL_INSN, ULONGEST_MAX } },
hppanbsd_sigtramp_cache_init
};
+/* clang-format on */
static void
hppanbsd_sigtramp_cache_init (const struct tramp_frame *self,
- frame_info_ptr this_frame,
- struct trad_frame_cache *this_cache,
- CORE_ADDR func)
+ frame_info_ptr this_frame,
+ struct trad_frame_cache *this_cache,
+ CORE_ADDR func)
{
CORE_ADDR sp = get_frame_register_unsigned (this_frame, HPPA_SP_REGNUM);
CORE_ADDR base;
@@ -130,30 +124,25 @@ hppanbsd_sigtramp_cache_init (const struct tramp_frame *self,
/* Core file support. */
/* Sizeof `struct reg' in <machine/reg.h>. */
-#define HPPANBSD_SIZEOF_GREGS (44 * 4)
+#define HPPANBSD_SIZEOF_GREGS (44 * 4)
-static int hppanbsd_reg_offset[] =
-{
+static int hppanbsd_reg_offset[] = {
/* r0 ... r31 */
- -1, 1 * 4, 2 * 4, 3 * 4,
- 4 * 4, 5 * 4, 6 * 4, 7 * 4,
- 8 * 4, 9 * 4, 10 * 4, 11 * 4,
- 12 * 4, 13 * 4, 14 * 4, 15 * 4,
- 16 * 4, 17 * 4, 18 * 4, 19 * 4,
- 20 * 4, 21 * 4, 22 * 4, 23 * 4,
- 24 * 4, 25 * 4, 26 * 4, 27 * 4,
- 28 * 4, 29 * 4, 30 * 4, 31 * 4,
-
- 32 * 4, /* HPPA_SAR_REGNUM */
- 35 * 4, /* HPPA_PCOQ_HEAD_REGNUM */
- 33 * 4, /* HPPA_PCSQ_HEAD_REGNUM */
- 36 * 4, /* HPPA_PCOQ_TAIL_REGNUM */
- 34 * 4, /* HPPA_PCSQ_TAIL_REGNUM */
- -1, /* HPPA_EIEM_REGNUM */
- -1, /* HPPA_IIR_REGNUM */
- -1, /* HPPA_ISR_REGNUM */
- -1, /* HPPA_IOR_REGNUM */
- 0 * 4, /* HPPA_IPSW_REGNUM */
+ -1, 1 * 4, 2 * 4, 3 * 4, 4 * 4, 5 * 4, 6 * 4, 7 * 4,
+ 8 * 4, 9 * 4, 10 * 4, 11 * 4, 12 * 4, 13 * 4, 14 * 4, 15 * 4,
+ 16 * 4, 17 * 4, 18 * 4, 19 * 4, 20 * 4, 21 * 4, 22 * 4, 23 * 4,
+ 24 * 4, 25 * 4, 26 * 4, 27 * 4, 28 * 4, 29 * 4, 30 * 4, 31 * 4,
+
+ 32 * 4, /* HPPA_SAR_REGNUM */
+ 35 * 4, /* HPPA_PCOQ_HEAD_REGNUM */
+ 33 * 4, /* HPPA_PCSQ_HEAD_REGNUM */
+ 36 * 4, /* HPPA_PCOQ_TAIL_REGNUM */
+ 34 * 4, /* HPPA_PCSQ_TAIL_REGNUM */
+ -1, /* HPPA_EIEM_REGNUM */
+ -1, /* HPPA_IIR_REGNUM */
+ -1, /* HPPA_ISR_REGNUM */
+ -1, /* HPPA_IOR_REGNUM */
+ 0 * 4, /* HPPA_IPSW_REGNUM */
};
/* Supply register REGNUM from the buffer specified by GREGS and LEN
@@ -162,8 +151,8 @@ static int hppanbsd_reg_offset[] =
static void
hppanbsd_supply_gregset (const struct regset *regset,
- struct regcache *regcache,
- int regnum, const void *gregs, size_t len)
+ struct regcache *regcache, int regnum,
+ const void *gregs, size_t len)
{
const gdb_byte *regs = (const gdb_byte *) gregs;
int i;
@@ -178,11 +167,8 @@ hppanbsd_supply_gregset (const struct regset *regset,
/* NetBSD/hppa register set. */
-static const struct regset hppanbsd_gregset =
-{
- NULL,
- hppanbsd_supply_gregset
-};
+static const struct regset hppanbsd_gregset
+ = { NULL, hppanbsd_supply_gregset };
/* Iterate over supported core file register note sections. */
@@ -195,7 +181,7 @@ hppanbsd_iterate_over_regset_sections (struct gdbarch *gdbarch,
cb (".reg", HPPANBSD_SIZEOF_GREGS, HPPANBSD_SIZEOF_GREGS, &hppanbsd_gregset,
NULL, cb_data);
}
-
+
static void
hppanbsd_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
{
@@ -205,13 +191,14 @@ hppanbsd_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
nbsd_init_abi (info, gdbarch);
/* Core file support. */
- set_gdbarch_iterate_over_regset_sections
- (gdbarch, hppanbsd_iterate_over_regset_sections);
+ set_gdbarch_iterate_over_regset_sections (
+ gdbarch, hppanbsd_iterate_over_regset_sections);
tramp_frame_prepend_unwinder (gdbarch, &hppanbsd_sigtramp_si4);
}
void _initialize_hppanbsd_tdep ();
+
void
_initialize_hppanbsd_tdep ()
{
diff --git a/gdb/hppa-obsd-nat.c b/gdb/hppa-obsd-nat.c
index 9c2788e99ec..d82e29250f5 100644
--- a/gdb/hppa-obsd-nat.c
+++ b/gdb/hppa-obsd-nat.c
@@ -64,7 +64,7 @@ hppaobsd_supply_gregset (struct regcache *regcache, const void *gregs)
for (regnum = HPPA_R1_REGNUM; regnum <= HPPA_R31_REGNUM; regnum++)
regcache->raw_supply (regnum, regs + regnum * 4);
- if (sizeof(struct reg) >= 46 * 4)
+ if (sizeof (struct reg) >= 46 * 4)
{
regcache->raw_supply (HPPA_IPSW_REGNUM, regs);
regcache->raw_supply (HPPA_SAR_REGNUM, regs + 32 * 4);
@@ -82,7 +82,7 @@ hppaobsd_supply_gregset (struct regcache *regcache, const void *gregs)
regcache->raw_supply (HPPA_SR7_REGNUM, regs + 44 * 4);
regcache->raw_supply (HPPA_CR26_REGNUM, regs + 45 * 4);
regcache->raw_supply (HPPA_CR27_REGNUM, regs + 46 * 4);
- }
+ }
else
{
regcache->raw_supply (HPPA_SAR_REGNUM, regs);
@@ -111,8 +111,8 @@ hppaobsd_supply_fpregset (struct regcache *regcache, const void *fpregs)
in GREGS. */
static void
-hppaobsd_collect_gregset (const struct regcache *regcache,
- void *gregs, int regnum)
+hppaobsd_collect_gregset (const struct regcache *regcache, void *gregs,
+ int regnum)
{
char *regs = gregs;
int i;
@@ -123,7 +123,7 @@ hppaobsd_collect_gregset (const struct regcache *regcache,
regcache->raw_collect (i, regs + i * 4);
}
- if (sizeof(struct reg) >= 46 * 4)
+ if (sizeof (struct reg) >= 46 * 4)
{
if (regnum == -1 || regnum == HPPA_IPSW_REGNUM)
regcache->raw_collect (HPPA_IPSW_REGNUM, regs);
@@ -173,8 +173,7 @@ hppaobsd_collect_gregset (const struct regcache *regcache,
in FPREGS. */
static void
-hppaobsd_collect_fpregset (struct regcache *regcache,
- void *fpregs, int regnum)
+hppaobsd_collect_fpregset (struct regcache *regcache, void *fpregs, int regnum)
{
char *regs = fpregs;
int i;
@@ -188,7 +187,6 @@ hppaobsd_collect_fpregset (struct regcache *regcache,
}
}
}
-
/* Fetch register REGNUM from the inferior. If REGNUM is -1, do this
for all registers (including the floating-point registers). */
@@ -203,7 +201,7 @@ hppa_obsd_nat_target::fetch_registers (struct regcache *regcache, int regnum)
struct reg regs;
if (ptrace (PT_GETREGS, pid, (PTRACE_TYPE_ARG3) &regs, 0) == -1)
- perror_with_name (_("Couldn't get registers"));
+ perror_with_name (_ ("Couldn't get registers"));
hppaobsd_supply_gregset (regcache, &regs);
}
@@ -213,7 +211,7 @@ hppa_obsd_nat_target::fetch_registers (struct regcache *regcache, int regnum)
struct fpreg fpregs;
if (ptrace (PT_GETFPREGS, pid, (PTRACE_TYPE_ARG3) &fpregs, 0) == -1)
- perror_with_name (_("Couldn't get floating point status"));
+ perror_with_name (_ ("Couldn't get floating point status"));
hppaobsd_supply_fpregset (regcache, &fpregs);
}
@@ -230,12 +228,12 @@ hppa_obsd_nat_target::store_registers (struct regcache *regcache, int regnum)
struct reg regs;
if (ptrace (PT_GETREGS, pid, (PTRACE_TYPE_ARG3) &regs, 0) == -1)
- perror_with_name (_("Couldn't get registers"));
+ perror_with_name (_ ("Couldn't get registers"));
hppaobsd_collect_gregset (regcache, &regs, regnum);
if (ptrace (PT_SETREGS, pid, (PTRACE_TYPE_ARG3) &regs, 0) == -1)
- perror_with_name (_("Couldn't write registers"));
+ perror_with_name (_ ("Couldn't write registers"));
}
if (regnum == -1 || hppaobsd_fpregset_supplies_p (regnum))
@@ -243,16 +241,17 @@ hppa_obsd_nat_target::store_registers (struct regcache *regcache, int regnum)
struct fpreg fpregs;
if (ptrace (PT_GETFPREGS, pid, (PTRACE_TYPE_ARG3) &fpregs, 0) == -1)
- perror_with_name (_("Couldn't get floating point status"));
+ perror_with_name (_ ("Couldn't get floating point status"));
hppaobsd_collect_fpregset (regcache, &fpregs, regnum);
if (ptrace (PT_SETFPREGS, pid, (PTRACE_TYPE_ARG3) &fpregs, 0) == -1)
- perror_with_name (_("Couldn't write floating point status"));
+ perror_with_name (_ ("Couldn't write floating point status"));
}
}
void _initialize_hppaobsd_nat ();
+
void
_initialize_hppaobsd_nat ()
{
diff --git a/gdb/hppa-obsd-tdep.c b/gdb/hppa-obsd-tdep.c
index 60f47b32a0c..0d0435119ab 100644
--- a/gdb/hppa-obsd-tdep.c
+++ b/gdb/hppa-obsd-tdep.c
@@ -29,11 +29,11 @@
/* Core file support. */
/* Sizeof `struct reg' in <machine/reg.h>. */
-#define HPPAOBSD_SIZEOF_GREGS (34 * 4) /* OpenBSD 5.1 and earlier. */
-#define HPPANBSD_SIZEOF_GREGS (46 * 4) /* NetBSD and OpenBSD 5.2 and later. */
+#define HPPAOBSD_SIZEOF_GREGS (34 * 4) /* OpenBSD 5.1 and earlier. */
+#define HPPANBSD_SIZEOF_GREGS (46 * 4) /* NetBSD and OpenBSD 5.2 and later. */
/* Sizeof `struct fpreg' in <machine/reg.h>. */
-#define HPPAOBSD_SIZEOF_FPREGS (32 * 8)
+#define HPPAOBSD_SIZEOF_FPREGS (32 * 8)
/* Supply register REGNUM from the buffer specified by GREGS and LEN
in the general-purpose register set REGSET to register cache
@@ -41,8 +41,8 @@
static void
hppaobsd_supply_gregset (const struct regset *regset,
- struct regcache *regcache,
- int regnum, const void *gregs, size_t len)
+ struct regcache *regcache, int regnum,
+ const void *gregs, size_t len)
{
gdb_byte zero[4] = { 0 };
const gdb_byte *regs = (const gdb_byte *) gregs;
@@ -111,8 +111,8 @@ hppaobsd_supply_gregset (const struct regset *regset,
static void
hppaobsd_supply_fpregset (const struct regset *regset,
- struct regcache *regcache,
- int regnum, const void *fpregs, size_t len)
+ struct regcache *regcache, int regnum,
+ const void *fpregs, size_t len)
{
const gdb_byte *regs = (const gdb_byte *) fpregs;
int i;
@@ -128,19 +128,11 @@ hppaobsd_supply_fpregset (const struct regset *regset,
/* OpenBSD/hppa register sets. */
-static const struct regset hppaobsd_gregset =
-{
- NULL,
- hppaobsd_supply_gregset,
- NULL,
- REGSET_VARIABLE_SIZE
-};
+static const struct regset hppaobsd_gregset
+ = { NULL, hppaobsd_supply_gregset, NULL, REGSET_VARIABLE_SIZE };
-static const struct regset hppaobsd_fpregset =
-{
- NULL,
- hppaobsd_supply_fpregset
-};
+static const struct regset hppaobsd_fpregset
+ = { NULL, hppaobsd_supply_fpregset };
/* Iterate over supported core file register note sections. */
@@ -155,7 +147,6 @@ hppaobsd_iterate_over_regset_sections (struct gdbarch *gdbarch,
cb (".reg2", HPPAOBSD_SIZEOF_FPREGS, HPPAOBSD_SIZEOF_FPREGS,
&hppaobsd_fpregset, NULL, cb_data);
}
-
static void
hppaobsd_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
@@ -164,11 +155,12 @@ hppaobsd_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
hppabsd_init_abi (info, gdbarch);
/* Core file support. */
- set_gdbarch_iterate_over_regset_sections
- (gdbarch, hppaobsd_iterate_over_regset_sections);
+ set_gdbarch_iterate_over_regset_sections (
+ gdbarch, hppaobsd_iterate_over_regset_sections);
}
void _initialize_hppabsd_tdep ();
+
void
_initialize_hppabsd_tdep ()
{
diff --git a/gdb/hppa-tdep.c b/gdb/hppa-tdep.c
index 920b872d12d..b71013c580f 100644
--- a/gdb/hppa-tdep.c
+++ b/gdb/hppa-tdep.c
@@ -62,21 +62,21 @@ static const int hppa64_num_regs = 96;
* library that we are debugging.
*/
struct hppa_unwind_info
- {
- struct unwind_table_entry *table; /* Pointer to unwind info */
- struct unwind_table_entry *cache; /* Pointer to last entry we found */
- int last; /* Index of last entry */
- };
+{
+ struct unwind_table_entry *table; /* Pointer to unwind info */
+ struct unwind_table_entry *cache; /* Pointer to last entry we found */
+ int last; /* Index of last entry */
+};
struct hppa_objfile_private
- {
- struct hppa_unwind_info *unwind_info = nullptr; /* a pointer */
- struct so_list *so_info = nullptr; /* a pointer */
- CORE_ADDR dp = 0;
+{
+ struct hppa_unwind_info *unwind_info = nullptr; /* a pointer */
+ struct so_list *so_info = nullptr; /* a pointer */
+ CORE_ADDR dp = 0;
- int dummy_call_sequence_reg = 0;
- CORE_ADDR dummy_call_sequence_addr = 0;
- };
+ int dummy_call_sequence_reg = 0;
+ CORE_ADDR dummy_call_sequence_addr = 0;
+};
/* hppa-specific object data -- unwind and solib info.
TODO/maybe: think about splitting this into two parts; the unwind data is
@@ -185,14 +185,16 @@ hppa_extract_21 (unsigned word)
int
hppa_extract_17 (unsigned word)
{
- return hppa_sign_extend (hppa_get_field (word, 19, 28) |
- hppa_get_field (word, 29, 29) << 10 |
- hppa_get_field (word, 11, 15) << 11 |
- (word & 0x1) << 16, 17) << 2;
+ return hppa_sign_extend (hppa_get_field (word, 19, 28)
+ | hppa_get_field (word, 29, 29) << 10
+ | hppa_get_field (word, 11, 15) << 11
+ | (word & 0x1) << 16,
+ 17)
+ << 2;
}
-CORE_ADDR
-hppa_symbol_address(const char *sym)
+CORE_ADDR
+hppa_symbol_address (const char *sym)
{
struct bound_minimal_symbol minsym;
@@ -200,11 +202,9 @@ hppa_symbol_address(const char *sym)
if (minsym.minsym)
return minsym.value_address ();
else
- return (CORE_ADDR)-1;
+ return (CORE_ADDR) -1;
}
-
-
/* Compare the start address for two unwind entries returning 1 if
the first address is larger than the second, -1 if the second is
larger than the first, and zero if they are equal. */
@@ -212,8 +212,10 @@ hppa_symbol_address(const char *sym)
static int
compare_unwind_entries (const void *arg1, const void *arg2)
{
- const struct unwind_table_entry *a = (const struct unwind_table_entry *) arg1;
- const struct unwind_table_entry *b = (const struct unwind_table_entry *) arg2;
+ const struct unwind_table_entry *a
+ = (const struct unwind_table_entry *) arg1;
+ const struct unwind_table_entry *b
+ = (const struct unwind_table_entry *) arg2;
if (a->region_start > b->region_start)
return 1;
@@ -227,20 +229,20 @@ static void
record_text_segment_lowaddr (bfd *abfd, asection *section, void *data)
{
if ((section->flags & (SEC_ALLOC | SEC_LOAD | SEC_READONLY))
- == (SEC_ALLOC | SEC_LOAD | SEC_READONLY))
+ == (SEC_ALLOC | SEC_LOAD | SEC_READONLY))
{
bfd_vma value = section->vma - section->filepos;
- CORE_ADDR *low_text_segment_address = (CORE_ADDR *)data;
+ CORE_ADDR *low_text_segment_address = (CORE_ADDR *) data;
if (value < *low_text_segment_address)
- *low_text_segment_address = value;
+ *low_text_segment_address = value;
}
}
static void
internalize_unwinds (struct objfile *objfile, struct unwind_table_entry *table,
- asection *section, unsigned int entries,
- size_t size, CORE_ADDR text_offset)
+ asection *section, unsigned int entries, size_t size,
+ CORE_ADDR text_offset)
{
/* We will read the unwind entries into temporary memory, then
fill in the actual unwind table. */
@@ -265,7 +267,7 @@ internalize_unwinds (struct objfile *objfile, struct unwind_table_entry *table,
low_text_segment_address = -1;
bfd_map_over_sections (objfile->obfd.get (),
- record_text_segment_lowaddr,
+ record_text_segment_lowaddr,
&low_text_segment_address);
text_offset = low_text_segment_address;
@@ -281,8 +283,7 @@ internalize_unwinds (struct objfile *objfile, struct unwind_table_entry *table,
endian issues. */
for (i = 0; i < entries; i++)
{
- table[i].region_start = bfd_get_32 (objfile->obfd,
- (bfd_byte *) buf);
+ table[i].region_start = bfd_get_32 (objfile->obfd, (bfd_byte *) buf);
table[i].region_start += text_offset;
buf += 4;
table[i].region_end = bfd_get_32 (objfile->obfd, (bfd_byte *) buf);
@@ -348,8 +349,8 @@ read_unwind_info (struct objfile *objfile)
struct hppa_objfile_private *obj_private;
text_offset = objfile->text_section_offset ();
- ui = (struct hppa_unwind_info *) obstack_alloc (&objfile->objfile_obstack,
- sizeof (struct hppa_unwind_info));
+ ui = (struct hppa_unwind_info *) obstack_alloc (
+ &objfile->objfile_obstack, sizeof (struct hppa_unwind_info));
ui->table = NULL;
ui->cache = NULL;
@@ -363,8 +364,7 @@ read_unwind_info (struct objfile *objfile)
First determine the total size of the unwind tables so that we
can allocate memory in a nice big hunk. */
total_entries = 0;
- for (unwind_sec = objfile->obfd->sections;
- unwind_sec;
+ for (unwind_sec = objfile->obfd->sections; unwind_sec;
unwind_sec = unwind_sec->next)
{
if (strcmp (unwind_sec->name, "$UNWIND_START$") == 0
@@ -379,8 +379,8 @@ read_unwind_info (struct objfile *objfile)
/* Now compute the size of the stub unwinds. Note the ELF tools do not
use stub unwinds at the current time. */
- stub_unwind_sec = bfd_get_section_by_name (objfile->obfd.get (),
- "$UNWIND_END$");
+ stub_unwind_sec
+ = bfd_get_section_by_name (objfile->obfd.get (), "$UNWIND_END$");
if (stub_unwind_sec)
{
@@ -398,15 +398,15 @@ read_unwind_info (struct objfile *objfile)
total_size = total_entries * sizeof (struct unwind_table_entry);
/* Allocate memory for the unwind table. */
- ui->table = (struct unwind_table_entry *)
- obstack_alloc (&objfile->objfile_obstack, total_size);
+ ui->table
+ = (struct unwind_table_entry *) obstack_alloc (&objfile->objfile_obstack,
+ total_size);
ui->last = total_entries - 1;
/* Now read in each unwind section and internalize the standard unwind
entries. */
index = 0;
- for (unwind_sec = objfile->obfd->sections;
- unwind_sec;
+ for (unwind_sec = objfile->obfd->sections; unwind_sec;
unwind_sec = unwind_sec->next)
{
if (strcmp (unwind_sec->name, "$UNWIND_START$") == 0
@@ -428,8 +428,8 @@ read_unwind_info (struct objfile *objfile)
char *buf = (char *) alloca (stub_unwind_size);
/* Read in the stub unwind entries. */
- bfd_get_section_contents (objfile->obfd.get (), stub_unwind_sec, buf,
- 0, stub_unwind_size);
+ bfd_get_section_contents (objfile->obfd.get (), stub_unwind_sec, buf, 0,
+ stub_unwind_size);
/* Now convert them into regular unwind entries. */
for (i = 0; i < stub_entries; i++, index++)
@@ -439,19 +439,18 @@ read_unwind_info (struct objfile *objfile)
/* Convert offset & size into region_start and region_end.
Stuff away the stub type into "reserved" fields. */
- ui->table[index].region_start = bfd_get_32 (objfile->obfd,
- (bfd_byte *) buf);
+ ui->table[index].region_start
+ = bfd_get_32 (objfile->obfd, (bfd_byte *) buf);
ui->table[index].region_start += text_offset;
buf += 4;
- ui->table[index].stub_unwind.stub_type = bfd_get_8 (objfile->obfd,
- (bfd_byte *) buf);
+ ui->table[index].stub_unwind.stub_type
+ = bfd_get_8 (objfile->obfd, (bfd_byte *) buf);
buf += 2;
ui->table[index].region_end
- = ui->table[index].region_start + 4 *
- (bfd_get_16 (objfile->obfd, (bfd_byte *) buf) - 1);
+ = ui->table[index].region_start
+ + 4 * (bfd_get_16 (objfile->obfd, (bfd_byte *) buf) - 1);
buf += 2;
}
-
}
/* Unwind table needs to be kept sorted. */
@@ -477,8 +476,7 @@ find_unwind_entry (CORE_ADDR pc)
int first, middle, last;
if (hppa_debug)
- gdb_printf (gdb_stdlog, "{ find_unwind_entry %s -> ",
- hex_string (pc));
+ gdb_printf (gdb_stdlog, "{ find_unwind_entry %s -> ", hex_string (pc));
/* A function at address 0? Not in HP-UX! */
if (pc == (CORE_ADDR) 0)
@@ -501,14 +499,13 @@ find_unwind_entry (CORE_ADDR pc)
read_unwind_info (objfile);
priv = hppa_objfile_priv_data.get (objfile);
if (priv == NULL)
- error (_("Internal error reading unwind information."));
+ error (_ ("Internal error reading unwind information."));
ui = priv->unwind_info;
}
/* First, check the cache. */
- if (ui->cache
- && pc >= ui->cache->region_start
+ if (ui->cache && pc >= ui->cache->region_start
&& pc <= ui->cache->region_end)
{
if (hppa_debug)
@@ -572,13 +569,11 @@ hppa_stack_frame_destroyed_p (struct gdbarch *gdbarch, CORE_ADDR pc)
/* The most common way to perform a stack adjustment ldo X(sp),sp
We are destroying a stack frame if the offset is negative. */
- if ((inst & 0xffffc000) == 0x37de0000
- && hppa_extract_14 (inst) < 0)
+ if ((inst & 0xffffc000) == 0x37de0000 && hppa_extract_14 (inst) < 0)
return 1;
/* ldw,mb D(sp),X or ldd,mb D(sp),X */
- if (((inst & 0x0fc010e0) == 0x0fc010e0
- || (inst & 0x0fc010e0) == 0x0fc010e0)
+ if (((inst & 0x0fc010e0) == 0x0fc010e0 || (inst & 0x0fc010e0) == 0x0fc010e0)
&& hppa_extract_14 (inst) < 0)
return 1;
@@ -589,7 +584,7 @@ hppa_stack_frame_destroyed_p (struct gdbarch *gdbarch, CORE_ADDR pc)
return 0;
}
-constexpr gdb_byte hppa_break_insn[] = {0x00, 0x01, 0x00, 0x04};
+constexpr gdb_byte hppa_break_insn[] = { 0x00, 0x01, 0x00, 0x04 };
typedef BP_MANIPULATION (hppa_break_insn) hppa_breakpoint;
@@ -598,40 +593,29 @@ typedef BP_MANIPULATION (hppa_break_insn) hppa_breakpoint;
static const char *
hppa32_register_name (struct gdbarch *gdbarch, int i)
{
- static const char *names[] = {
- "flags", "r1", "rp", "r3",
- "r4", "r5", "r6", "r7",
- "r8", "r9", "r10", "r11",
- "r12", "r13", "r14", "r15",
- "r16", "r17", "r18", "r19",
- "r20", "r21", "r22", "r23",
- "r24", "r25", "r26", "dp",
- "ret0", "ret1", "sp", "r31",
- "sar", "pcoqh", "pcsqh", "pcoqt",
- "pcsqt", "eiem", "iir", "isr",
- "ior", "ipsw", "goto", "sr4",
- "sr0", "sr1", "sr2", "sr3",
- "sr5", "sr6", "sr7", "cr0",
- "cr8", "cr9", "ccr", "cr12",
- "cr13", "cr24", "cr25", "cr26",
- "mpsfu_high","mpsfu_low","mpsfu_ovflo","pad",
- "fpsr", "fpe1", "fpe2", "fpe3",
- "fpe4", "fpe5", "fpe6", "fpe7",
- "fr4", "fr4R", "fr5", "fr5R",
- "fr6", "fr6R", "fr7", "fr7R",
- "fr8", "fr8R", "fr9", "fr9R",
- "fr10", "fr10R", "fr11", "fr11R",
- "fr12", "fr12R", "fr13", "fr13R",
- "fr14", "fr14R", "fr15", "fr15R",
- "fr16", "fr16R", "fr17", "fr17R",
- "fr18", "fr18R", "fr19", "fr19R",
- "fr20", "fr20R", "fr21", "fr21R",
- "fr22", "fr22R", "fr23", "fr23R",
- "fr24", "fr24R", "fr25", "fr25R",
- "fr26", "fr26R", "fr27", "fr27R",
- "fr28", "fr28R", "fr29", "fr29R",
- "fr30", "fr30R", "fr31", "fr31R"
- };
+ static const char *names[]
+ = { "flags", "r1", "rp", "r3", "r4", "r5",
+ "r6", "r7", "r8", "r9", "r10", "r11",
+ "r12", "r13", "r14", "r15", "r16", "r17",
+ "r18", "r19", "r20", "r21", "r22", "r23",
+ "r24", "r25", "r26", "dp", "ret0", "ret1",
+ "sp", "r31", "sar", "pcoqh", "pcsqh", "pcoqt",
+ "pcsqt", "eiem", "iir", "isr", "ior", "ipsw",
+ "goto", "sr4", "sr0", "sr1", "sr2", "sr3",
+ "sr5", "sr6", "sr7", "cr0", "cr8", "cr9",
+ "ccr", "cr12", "cr13", "cr24", "cr25", "cr26",
+ "mpsfu_high", "mpsfu_low", "mpsfu_ovflo", "pad", "fpsr", "fpe1",
+ "fpe2", "fpe3", "fpe4", "fpe5", "fpe6", "fpe7",
+ "fr4", "fr4R", "fr5", "fr5R", "fr6", "fr6R",
+ "fr7", "fr7R", "fr8", "fr8R", "fr9", "fr9R",
+ "fr10", "fr10R", "fr11", "fr11R", "fr12", "fr12R",
+ "fr13", "fr13R", "fr14", "fr14R", "fr15", "fr15R",
+ "fr16", "fr16R", "fr17", "fr17R", "fr18", "fr18R",
+ "fr19", "fr19R", "fr20", "fr20R", "fr21", "fr21R",
+ "fr22", "fr22R", "fr23", "fr23R", "fr24", "fr24R",
+ "fr25", "fr25R", "fr26", "fr26R", "fr27", "fr27R",
+ "fr28", "fr28R", "fr29", "fr29R", "fr30", "fr30R",
+ "fr31", "fr31R" };
gdb_static_assert (ARRAY_SIZE (names) == hppa32_num_regs);
return names[i];
}
@@ -640,30 +624,20 @@ static const char *
hppa64_register_name (struct gdbarch *gdbarch, int i)
{
static const char *names[] = {
- "flags", "r1", "rp", "r3",
- "r4", "r5", "r6", "r7",
- "r8", "r9", "r10", "r11",
- "r12", "r13", "r14", "r15",
- "r16", "r17", "r18", "r19",
- "r20", "r21", "r22", "r23",
- "r24", "r25", "r26", "dp",
- "ret0", "ret1", "sp", "r31",
- "sar", "pcoqh", "pcsqh", "pcoqt",
- "pcsqt", "eiem", "iir", "isr",
- "ior", "ipsw", "goto", "sr4",
- "sr0", "sr1", "sr2", "sr3",
- "sr5", "sr6", "sr7", "cr0",
- "cr8", "cr9", "ccr", "cr12",
- "cr13", "cr24", "cr25", "cr26",
- "mpsfu_high","mpsfu_low","mpsfu_ovflo","pad",
- "fpsr", "fpe1", "fpe2", "fpe3",
- "fr4", "fr5", "fr6", "fr7",
- "fr8", "fr9", "fr10", "fr11",
- "fr12", "fr13", "fr14", "fr15",
- "fr16", "fr17", "fr18", "fr19",
- "fr20", "fr21", "fr22", "fr23",
- "fr24", "fr25", "fr26", "fr27",
- "fr28", "fr29", "fr30", "fr31"
+ "flags", "r1", "rp", "r3", "r4", "r5", "r6",
+ "r7", "r8", "r9", "r10", "r11", "r12", "r13",
+ "r14", "r15", "r16", "r17", "r18", "r19", "r20",
+ "r21", "r22", "r23", "r24", "r25", "r26", "dp",
+ "ret0", "ret1", "sp", "r31", "sar", "pcoqh", "pcsqh",
+ "pcoqt", "pcsqt", "eiem", "iir", "isr", "ior", "ipsw",
+ "goto", "sr4", "sr0", "sr1", "sr2", "sr3", "sr5",
+ "sr6", "sr7", "cr0", "cr8", "cr9", "ccr", "cr12",
+ "cr13", "cr24", "cr25", "cr26", "mpsfu_high", "mpsfu_low", "mpsfu_ovflo",
+ "pad", "fpsr", "fpe1", "fpe2", "fpe3", "fr4", "fr5",
+ "fr6", "fr7", "fr8", "fr9", "fr10", "fr11", "fr12",
+ "fr13", "fr14", "fr15", "fr16", "fr17", "fr18", "fr19",
+ "fr20", "fr21", "fr22", "fr23", "fr24", "fr25", "fr26",
+ "fr27", "fr28", "fr29", "fr30", "fr31"
};
gdb_static_assert (ARRAY_SIZE (names) == hppa64_num_regs);
return names[i];
@@ -693,7 +667,7 @@ hppa64_dwarf_reg_to_regnum (struct gdbarch *gdbarch, int reg)
We simply allocate the appropriate amount of stack space and put
arguments into their proper slots. */
-
+
static CORE_ADDR
hppa32_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
struct regcache *regcache, CORE_ADDR bp_addr,
@@ -755,9 +729,9 @@ hppa32_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
/* Integer value store, right aligned. "unpack_long"
takes care of any sign-extension problems. */
param_len = align_up (type->length (), 4);
- store_unsigned_integer
- (param_val, param_len, byte_order,
- unpack_long (type, value_contents (arg).data ()));
+ store_unsigned_integer (
+ param_val, param_len, byte_order,
+ unpack_long (type, value_contents (arg).data ()));
}
else if (type->code () == TYPE_CODE_FLT)
{
@@ -929,13 +903,14 @@ hppa64_convert_code_addr_to_fptr (struct gdbarch *gdbarch, CORE_ADDR code)
if (opd < sec->objfile->sections_end)
{
- for (CORE_ADDR addr = opd->addr (); addr < opd->endaddr (); addr += 2 * 8)
+ for (CORE_ADDR addr = opd->addr (); addr < opd->endaddr ();
+ addr += 2 * 8)
{
ULONGEST opdaddr;
gdb_byte tmp[8];
if (target_read_memory (addr, tmp, sizeof (tmp)))
- break;
+ break;
opdaddr = extract_unsigned_integer (tmp, sizeof (tmp), byte_order);
if (opdaddr == code)
@@ -1053,8 +1028,7 @@ hppa64_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
codeptr = unpack_long (type, value_contents (arg).data ());
fptr = hppa64_convert_code_addr_to_fptr (gdbarch, codeptr);
- store_unsigned_integer (fptrbuf, type->length (), byte_order,
- fptr);
+ store_unsigned_integer (fptrbuf, type->length (), byte_order, fptr);
valbuf = fptrbuf;
}
else
@@ -1112,7 +1086,6 @@ hppa64_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
return sp;
}
-
/* Handle 32/64-bit struct return conventions. */
@@ -1245,7 +1218,6 @@ hppa64_return_value (struct gdbarch *gdbarch, struct value *function,
return RETURN_VALUE_REGISTER_CONVENTION;
}
-
static CORE_ADDR
hppa32_convert_from_func_ptr_addr (struct gdbarch *gdbarch, CORE_ADDR addr,
@@ -1454,31 +1426,31 @@ inst_saves_gr (unsigned long inst)
{
switch ((inst >> 26) & 0x0f)
{
- case 0x03:
- switch ((inst >> 6) & 0x0f)
- {
- case 0x08:
- case 0x09:
- case 0x0a:
- case 0x0b:
- case 0x0c:
- case 0x0d:
- case 0x0e:
- case 0x0f:
- return hppa_extract_5R_store (inst);
- default:
- return 0;
- }
- case 0x18:
- case 0x19:
- case 0x1a:
- case 0x1b:
- case 0x1c:
- /* no 0x1d or 0x1e -- according to parisc 2.0 document */
- case 0x1f:
- return hppa_extract_5R_store (inst);
- default:
- return 0;
+ case 0x03:
+ switch ((inst >> 6) & 0x0f)
+ {
+ case 0x08:
+ case 0x09:
+ case 0x0a:
+ case 0x0b:
+ case 0x0c:
+ case 0x0d:
+ case 0x0e:
+ case 0x0f:
+ return hppa_extract_5R_store (inst);
+ default:
+ return 0;
+ }
+ case 0x18:
+ case 0x19:
+ case 0x1a:
+ case 0x1b:
+ case 0x1c:
+ /* no 0x1d or 0x1e -- according to parisc 2.0 document */
+ case 0x1f:
+ return hppa_extract_5R_store (inst);
+ default:
+ return 0;
}
}
@@ -1512,7 +1484,6 @@ inst_saves_fr (unsigned long inst)
Use information in the unwind table to determine what exactly should
be in the prologue. */
-
static CORE_ADDR
skip_prologue_hard_way (struct gdbarch *gdbarch, CORE_ADDR pc,
int stop_before_branch)
@@ -1671,8 +1642,7 @@ restart:
/* We've got to be read to handle the ldo before the fp register
save. */
- if ((inst & 0xfc000000) == 0x34000000
- && inst_saves_fr (next_inst) >= 4
+ if ((inst & 0xfc000000) == 0x34000000 && inst_saves_fr (next_inst) >= 4
&& inst_saves_fr (next_inst)
<= (gdbarch_ptr_bit (gdbarch) == 64 ? 11 : 7))
{
@@ -1689,8 +1659,7 @@ restart:
&& reg_num <= (gdbarch_ptr_bit (gdbarch) == 64 ? 11 : 7))
{
while (reg_num >= 4
- && reg_num
- <= (gdbarch_ptr_bit (gdbarch) == 64 ? 11 : 7))
+ && reg_num <= (gdbarch_ptr_bit (gdbarch) == 64 ? 11 : 7))
{
pc += 8;
status = target_read_memory (pc, buf, 4);
@@ -1724,7 +1693,7 @@ restart:
all other resources are accounted for, and nothing changed on
this pass. */
if (args_stored
- && !(save_gr || save_fr || save_rp || save_sp || stack_remaining > 0)
+ && !(save_gr || save_fr || save_rp || save_sp || stack_remaining > 0)
&& old_save_gr == save_gr && old_save_fr == save_fr
&& old_save_rp == save_rp && old_save_sp == save_sp
&& old_stack_remaining == stack_remaining)
@@ -1759,7 +1728,6 @@ restart:
return pc;
}
-
/* Return the address of the PC after the last prologue instruction if
we can determine it from the debug symbols. Else return zero. */
@@ -1867,13 +1835,14 @@ hppa_frame_cache (frame_info_ptr this_frame, void **this_cache)
if (hppa_debug)
gdb_printf (gdb_stdlog, "{ hppa_frame_cache (frame=%d) -> ",
- frame_relative_level(this_frame));
+ frame_relative_level (this_frame));
if ((*this_cache) != NULL)
{
if (hppa_debug)
- gdb_printf (gdb_stdlog, "base=%s (cached) }",
- paddress (gdbarch, ((struct hppa_frame_cache *)*this_cache)->base));
+ gdb_printf (
+ gdb_stdlog, "base=%s (cached) }",
+ paddress (gdbarch, ((struct hppa_frame_cache *) *this_cache)->base));
return (struct hppa_frame_cache *) (*this_cache);
}
cache = FRAME_OBSTACK_ZALLOC (struct hppa_frame_cache);
@@ -1896,7 +1865,7 @@ hppa_frame_cache (frame_info_ptr this_frame, void **this_cache)
/* Frame pointer gets saved into a special location. */
if (u->Save_SP && i == HPPA_FP_REGNUM)
continue;
-
+
saved_gr_mask |= (1 << i);
}
@@ -1962,8 +1931,7 @@ hppa_frame_cache (frame_info_ptr this_frame, void **this_cache)
frame_size = 0;
for (pc = start_pc;
- ((saved_gr_mask || saved_fr_mask
- || looking_for_sp || looking_for_rp
+ ((saved_gr_mask || saved_fr_mask || looking_for_sp || looking_for_rp
|| frame_size < (u->Total_frame_size << 3))
&& pc < end_pc);
pc += 4)
@@ -1974,7 +1942,7 @@ hppa_frame_cache (frame_info_ptr this_frame, void **this_cache)
if (!safe_frame_unwind_memory (this_frame, pc, buf4))
{
- error (_("Cannot read instruction at %s."),
+ error (_ ("Cannot read instruction at %s."),
paddress (gdbarch, pc));
return (struct hppa_frame_cache *) (*this_cache);
}
@@ -1983,7 +1951,7 @@ hppa_frame_cache (frame_info_ptr this_frame, void **this_cache)
/* Note the interesting effects of this instruction. */
frame_size += prologue_inst_adjust_sp (inst);
-
+
/* There are limited ways to store the return pointer into the
stack. */
if (inst == 0x6bc23fd9) /* stw rp,-0x14(sr0,sp) */
@@ -1996,17 +1964,17 @@ hppa_frame_cache (frame_info_ptr this_frame, void **this_cache)
looking_for_rp = 0;
cache->saved_regs[HPPA_RP_REGNUM].set_addr (-24);
}
- else if (inst == 0x0fc212c1
+ else if (inst == 0x0fc212c1
|| inst == 0x73c23fe1) /* std rp,-0x10(sr0,sp) */
{
looking_for_rp = 0;
cache->saved_regs[HPPA_RP_REGNUM].set_addr (-16);
}
-
+
/* Check to see if we saved SP into the stack. This also
happens to indicate the location of the saved frame
pointer. */
- if ((inst & 0xffffc000) == 0x6fc10000 /* stw,ma r1,N(sr0,sp) */
+ if ((inst & 0xffffc000) == 0x6fc10000 /* stw,ma r1,N(sr0,sp) */
|| (inst & 0xffffc00c) == 0x73c10008) /* std,ma r1,N(sr0,sp) */
{
looking_for_sp = 0;
@@ -2016,11 +1984,10 @@ hppa_frame_cache (frame_info_ptr this_frame, void **this_cache)
{
fp_in_r1 = 1;
}
-
+
/* Account for general and floating-point register saves. */
reg = inst_saves_gr (inst);
- if (reg >= 3 && reg <= 18
- && (!u->Save_SP || reg != HPPA_FP_REGNUM))
+ if (reg >= 3 && reg <= 18 && (!u->Save_SP || reg != HPPA_FP_REGNUM))
{
saved_gr_mask &= ~(1 << reg);
if ((inst >> 26) == 0x1b && hppa_extract_14 (inst) >= 0)
@@ -2033,15 +2000,15 @@ hppa_frame_cache (frame_info_ptr this_frame, void **this_cache)
else
{
CORE_ADDR offset;
-
+
if ((inst >> 26) == 0x1c)
offset = (inst & 0x1 ? -(1 << 13) : 0)
- | (((inst >> 4) & 0x3ff) << 3);
+ | (((inst >> 4) & 0x3ff) << 3);
else if ((inst >> 26) == 0x03)
offset = hppa_low_hppa_sign_extend (inst & 0x1f, 5);
else
offset = hppa_extract_14 (inst);
-
+
/* Handle code with and without frame pointers. */
if (u->Save_SP)
cache->saved_regs[reg].set_addr (offset);
@@ -2059,12 +2026,12 @@ hppa_frame_cache (frame_info_ptr this_frame, void **this_cache)
HP CC emits them at the current stack pointer modifying the
stack pointer as it stores each register. */
-
+
/* ldo X(%r3),%r1 or ldo X(%r30),%r1. */
if ((inst & 0xffffc000) == 0x34610000
|| (inst & 0xffffc000) == 0x37c10000)
fp_loc = hppa_extract_14 (inst);
-
+
reg = inst_saves_fr (inst);
if (reg >= 12 && reg <= 21)
{
@@ -2086,7 +2053,7 @@ hppa_frame_cache (frame_info_ptr this_frame, void **this_cache)
fp_loc += 8;
}
}
-
+
/* Quit if we hit any kind of branch the previous iteration. */
if (final_iteration)
break;
@@ -2101,18 +2068,19 @@ hppa_frame_cache (frame_info_ptr this_frame, void **this_cache)
/* The frame base always represents the value of %sp at entry to
the current function (and is thus equivalent to the "saved"
stack pointer. */
- CORE_ADDR this_sp = get_frame_register_unsigned (this_frame,
- HPPA_SP_REGNUM);
+ CORE_ADDR this_sp
+ = get_frame_register_unsigned (this_frame, HPPA_SP_REGNUM);
CORE_ADDR fp;
if (hppa_debug)
- gdb_printf (gdb_stdlog, " (this_sp=%s, pc=%s, "
+ gdb_printf (gdb_stdlog,
+ " (this_sp=%s, pc=%s, "
"prologue_end=%s) ",
paddress (gdbarch, this_sp),
paddress (gdbarch, get_frame_pc (this_frame)),
paddress (gdbarch, prologue_end));
- /* Check to see if a frame pointer is available, and use it for
+ /* Check to see if a frame pointer is available, and use it for
frame unwinding if it is.
There are some situations where we need to rely on the frame
@@ -2129,34 +2097,33 @@ hppa_frame_cache (frame_info_ptr this_frame, void **this_cache)
TODO: For the HP compiler, maybe we should use the alloca_frame flag
instead of Save_SP. */
-
- fp = get_frame_register_unsigned (this_frame, HPPA_FP_REGNUM);
- if (u->alloca_frame)
- fp -= u->Total_frame_size << 3;
-
- if (get_frame_pc (this_frame) >= prologue_end
- && (u->Save_SP || u->alloca_frame) && fp != 0)
+ fp = get_frame_register_unsigned (this_frame, HPPA_FP_REGNUM);
+
+ if (u->alloca_frame)
+ fp -= u->Total_frame_size << 3;
+
+ if (get_frame_pc (this_frame) >= prologue_end
+ && (u->Save_SP || u->alloca_frame) && fp != 0)
{
cache->base = fp;
-
+
if (hppa_debug)
gdb_printf (gdb_stdlog, " (base=%s) [frame pointer]",
paddress (gdbarch, cache->base));
}
- else if (u->Save_SP
- && cache->saved_regs[HPPA_SP_REGNUM].is_addr ())
+ else if (u->Save_SP && cache->saved_regs[HPPA_SP_REGNUM].is_addr ())
{
- /* Both we're expecting the SP to be saved and the SP has been
+ /* Both we're expecting the SP to be saved and the SP has been
saved. The entry SP value is saved at this frame's SP
address. */
- cache->base = read_memory_integer (this_sp, word_size, byte_order);
+ cache->base = read_memory_integer (this_sp, word_size, byte_order);
- if (hppa_debug)
- gdb_printf (gdb_stdlog, " (base=%s) [saved]",
- paddress (gdbarch, cache->base));
+ if (hppa_debug)
+ gdb_printf (gdb_stdlog, " (base=%s) [saved]",
+ paddress (gdbarch, cache->base));
}
- else
+ else
{
/* The prologue has been slowly allocating stack space. Adjust
the SP back. */
@@ -2164,7 +2131,6 @@ hppa_frame_cache (frame_info_ptr this_frame, void **this_cache)
if (hppa_debug)
gdb_printf (gdb_stdlog, " (base=%s) [unwind adjust]",
paddress (gdbarch, cache->base));
-
}
cache->saved_regs[HPPA_SP_REGNUM].set_value (cache->base);
}
@@ -2191,15 +2157,15 @@ hppa_frame_cache (frame_info_ptr this_frame, void **this_cache)
{
if (cache->saved_regs[HPPA_RP_REGNUM].is_addr ())
{
- cache->saved_regs[HPPA_PCOQ_HEAD_REGNUM] =
- cache->saved_regs[HPPA_RP_REGNUM];
+ cache->saved_regs[HPPA_PCOQ_HEAD_REGNUM]
+ = cache->saved_regs[HPPA_RP_REGNUM];
if (hppa_debug)
gdb_printf (gdb_stdlog, " (pc=rp) [stack] } ");
}
else
{
- ULONGEST rp = get_frame_register_unsigned (this_frame,
- HPPA_RP_REGNUM);
+ ULONGEST rp
+ = get_frame_register_unsigned (this_frame, HPPA_RP_REGNUM);
cache->saved_regs[HPPA_PCOQ_HEAD_REGNUM].set_value (rp);
if (hppa_debug)
gdb_printf (gdb_stdlog, " (pc=rp) [frame] } ");
@@ -2220,8 +2186,7 @@ hppa_frame_cache (frame_info_ptr this_frame, void **this_cache)
on the stack, but it's been overwritten. The prologue analyzer will
set fp_in_r1 when it sees the copy insn so we know to get the value
from r1 instead. */
- if (u->Save_SP && !cache->saved_regs[HPPA_FP_REGNUM].is_addr ()
- && fp_in_r1)
+ if (u->Save_SP && !cache->saved_regs[HPPA_FP_REGNUM].is_addr () && fp_in_r1)
{
ULONGEST r1 = get_frame_register_unsigned (this_frame, 1);
cache->saved_regs[HPPA_FP_REGNUM].set_value (r1);
@@ -2247,7 +2212,8 @@ hppa_frame_cache (frame_info_ptr this_frame, void **this_cache)
if (hppa_debug)
gdb_printf (gdb_stdlog, "base=%s }",
- paddress (gdbarch, ((struct hppa_frame_cache *)*this_cache)->base));
+ paddress (gdbarch,
+ ((struct hppa_frame_cache *) *this_cache)->base));
return (struct hppa_frame_cache *) (*this_cache);
}
@@ -2265,13 +2231,13 @@ hppa_frame_this_id (frame_info_ptr this_frame, void **this_cache,
}
static struct value *
-hppa_frame_prev_register (frame_info_ptr this_frame,
- void **this_cache, int regnum)
+hppa_frame_prev_register (frame_info_ptr this_frame, void **this_cache,
+ int regnum)
{
struct hppa_frame_cache *info = hppa_frame_cache (this_frame, this_cache);
- return hppa_frame_prev_register_helper (this_frame,
- info->saved_regs, regnum);
+ return hppa_frame_prev_register_helper (this_frame, info->saved_regs,
+ regnum);
}
static int
@@ -2284,16 +2250,14 @@ hppa_frame_unwind_sniffer (const struct frame_unwind *self,
return 0;
}
-static const struct frame_unwind hppa_frame_unwind =
-{
- "hppa unwind table",
- NORMAL_FRAME,
- default_frame_unwind_stop_reason,
- hppa_frame_this_id,
- hppa_frame_prev_register,
- NULL,
- hppa_frame_unwind_sniffer
-};
+static const struct frame_unwind hppa_frame_unwind
+ = { "hppa unwind table",
+ NORMAL_FRAME,
+ default_frame_unwind_stop_reason,
+ hppa_frame_this_id,
+ hppa_frame_prev_register,
+ NULL,
+ hppa_frame_unwind_sniffer };
/* This is a generic fallback frame unwinder that kicks in if we fail all
the other ones. Normally we would expect the stub and regular unwinder
@@ -2314,8 +2278,7 @@ hppa_fallback_frame_cache (frame_info_ptr this_frame, void **this_cache)
CORE_ADDR start_pc;
if (hppa_debug)
- gdb_printf (gdb_stdlog,
- "{ hppa_fallback_frame_cache (frame=%d) -> ",
+ gdb_printf (gdb_stdlog, "{ hppa_fallback_frame_cache (frame=%d) -> ",
frame_relative_level (this_frame));
cache = FRAME_OBSTACK_ZALLOC (struct hppa_frame_cache);
@@ -2352,8 +2315,8 @@ hppa_fallback_frame_cache (frame_info_ptr this_frame, void **this_cache)
}
if (hppa_debug)
- gdb_printf (gdb_stdlog, " frame_size=%d, found_rp=%d }\n",
- frame_size, found_rp);
+ gdb_printf (gdb_stdlog, " frame_size=%d, found_rp=%d }\n", frame_size,
+ found_rp);
cache->base = get_frame_register_unsigned (this_frame, HPPA_SP_REGNUM);
cache->base -= frame_size;
@@ -2361,10 +2324,10 @@ hppa_fallback_frame_cache (frame_info_ptr this_frame, void **this_cache)
if (cache->saved_regs[HPPA_RP_REGNUM].is_addr ())
{
- cache->saved_regs[HPPA_RP_REGNUM].set_addr (cache->saved_regs[HPPA_RP_REGNUM].addr ()
- + cache->base);
- cache->saved_regs[HPPA_PCOQ_HEAD_REGNUM] =
- cache->saved_regs[HPPA_RP_REGNUM];
+ cache->saved_regs[HPPA_RP_REGNUM].set_addr (
+ cache->saved_regs[HPPA_RP_REGNUM].addr () + cache->base);
+ cache->saved_regs[HPPA_PCOQ_HEAD_REGNUM]
+ = cache->saved_regs[HPPA_RP_REGNUM];
}
else
{
@@ -2380,8 +2343,8 @@ static void
hppa_fallback_frame_this_id (frame_info_ptr this_frame, void **this_cache,
struct frame_id *this_id)
{
- struct hppa_frame_cache *info =
- hppa_fallback_frame_cache (this_frame, this_cache);
+ struct hppa_frame_cache *info
+ = hppa_fallback_frame_cache (this_frame, this_cache);
(*this_id) = frame_id_build (info->base, get_frame_func (this_frame));
}
@@ -2393,20 +2356,18 @@ hppa_fallback_frame_prev_register (frame_info_ptr this_frame,
struct hppa_frame_cache *info
= hppa_fallback_frame_cache (this_frame, this_cache);
- return hppa_frame_prev_register_helper (this_frame,
- info->saved_regs, regnum);
+ return hppa_frame_prev_register_helper (this_frame, info->saved_regs,
+ regnum);
}
-static const struct frame_unwind hppa_fallback_frame_unwind =
-{
- "hppa prologue",
- NORMAL_FRAME,
- default_frame_unwind_stop_reason,
- hppa_fallback_frame_this_id,
- hppa_fallback_frame_prev_register,
- NULL,
- default_frame_sniffer
-};
+static const struct frame_unwind hppa_fallback_frame_unwind
+ = { "hppa prologue",
+ NORMAL_FRAME,
+ default_frame_unwind_stop_reason,
+ hppa_fallback_frame_this_id,
+ hppa_fallback_frame_prev_register,
+ NULL,
+ default_frame_sniffer };
/* Stub frames, used for all kinds of call stubs. */
struct hppa_stub_unwind_cache
@@ -2416,8 +2377,7 @@ struct hppa_stub_unwind_cache
};
static struct hppa_stub_unwind_cache *
-hppa_stub_frame_unwind_cache (frame_info_ptr this_frame,
- void **this_cache)
+hppa_stub_frame_unwind_cache (frame_info_ptr this_frame, void **this_cache)
{
struct hppa_stub_unwind_cache *info;
@@ -2437,8 +2397,7 @@ hppa_stub_frame_unwind_cache (frame_info_ptr this_frame,
}
static void
-hppa_stub_frame_this_id (frame_info_ptr this_frame,
- void **this_prologue_cache,
+hppa_stub_frame_this_id (frame_info_ptr this_frame, void **this_prologue_cache,
struct frame_id *this_id)
{
struct hppa_stub_unwind_cache *info
@@ -2456,16 +2415,15 @@ hppa_stub_frame_prev_register (frame_info_ptr this_frame,
= hppa_stub_frame_unwind_cache (this_frame, this_prologue_cache);
if (info == NULL)
- error (_("Requesting registers from null frame."));
+ error (_ ("Requesting registers from null frame."));
- return hppa_frame_prev_register_helper (this_frame,
- info->saved_regs, regnum);
+ return hppa_frame_prev_register_helper (this_frame, info->saved_regs,
+ regnum);
}
static int
hppa_stub_unwind_sniffer (const struct frame_unwind *self,
- frame_info_ptr this_frame,
- void **this_cache)
+ frame_info_ptr this_frame, void **this_cache)
{
CORE_ADDR pc = get_frame_address_in_block (this_frame);
struct gdbarch *gdbarch = get_frame_arch (this_frame);
@@ -2479,15 +2437,14 @@ hppa_stub_unwind_sniffer (const struct frame_unwind *self,
return 0;
}
-static const struct frame_unwind hppa_stub_frame_unwind = {
- "hppa stub",
- NORMAL_FRAME,
- default_frame_unwind_stop_reason,
- hppa_stub_frame_this_id,
- hppa_stub_frame_prev_register,
- NULL,
- hppa_stub_unwind_sniffer
-};
+static const struct frame_unwind hppa_stub_frame_unwind
+ = { "hppa stub",
+ NORMAL_FRAME,
+ default_frame_unwind_stop_reason,
+ hppa_stub_frame_this_id,
+ hppa_stub_frame_prev_register,
+ NULL,
+ hppa_stub_unwind_sniffer };
CORE_ADDR
hppa_unwind_pc (struct gdbarch *gdbarch, frame_info_ptr next_frame)
@@ -2536,7 +2493,9 @@ unwind_command (const char *exp, int from_tty)
gdb_printf ("\tregion_end = %s\n", hex_string (u->region_end));
-#define pif(FLD) if (u->FLD) gdb_printf (" "#FLD);
+#define pif(FLD) \
+ if (u->FLD) \
+ gdb_printf (" " #FLD);
gdb_printf ("\n\tflags =");
pif (Cannot_unwind);
@@ -2565,7 +2524,7 @@ unwind_command (const char *exp, int from_tty)
gdb_putc ('\n');
-#define pin(FLD) gdb_printf ("\t"#FLD" = 0x%x\n", u->FLD);
+#define pin(FLD) gdb_printf ("\t" #FLD " = 0x%x\n", u->FLD);
pin (Region_description);
pin (Entry_FR);
@@ -2577,23 +2536,23 @@ unwind_command (const char *exp, int from_tty)
gdb_printf ("\tstub type = ");
switch (u->stub_unwind.stub_type)
{
- case LONG_BRANCH:
- gdb_printf ("long branch\n");
- break;
- case PARAMETER_RELOCATION:
- gdb_printf ("parameter relocation\n");
- break;
- case EXPORT:
- gdb_printf ("export\n");
- break;
- case IMPORT:
- gdb_printf ("import\n");
- break;
- case IMPORT_SHLIB:
- gdb_printf ("import shlib\n");
- break;
- default:
- gdb_printf ("unknown (%d)\n", u->stub_unwind.stub_type);
+ case LONG_BRANCH:
+ gdb_printf ("long branch\n");
+ break;
+ case PARAMETER_RELOCATION:
+ gdb_printf ("parameter relocation\n");
+ break;
+ case EXPORT:
+ gdb_printf ("export\n");
+ break;
+ case IMPORT:
+ gdb_printf ("import\n");
+ break;
+ case IMPORT_SHLIB:
+ gdb_printf ("import shlib\n");
+ break;
+ default:
+ gdb_printf ("unknown (%d)\n", u->stub_unwind.stub_type);
}
}
}
@@ -2604,19 +2563,19 @@ unwind_command (const char *exp, int from_tty)
static struct type *
hppa32_register_type (struct gdbarch *gdbarch, int regnum)
{
- if (regnum < HPPA_FP4_REGNUM)
- return builtin_type (gdbarch)->builtin_uint32;
- else
- return builtin_type (gdbarch)->builtin_float;
+ if (regnum < HPPA_FP4_REGNUM)
+ return builtin_type (gdbarch)->builtin_uint32;
+ else
+ return builtin_type (gdbarch)->builtin_float;
}
static struct type *
hppa64_register_type (struct gdbarch *gdbarch, int regnum)
{
- if (regnum < HPPA64_FP4_REGNUM)
- return builtin_type (gdbarch)->builtin_uint64;
- else
- return builtin_type (gdbarch)->builtin_double;
+ if (regnum < HPPA64_FP4_REGNUM)
+ return builtin_type (gdbarch)->builtin_uint64;
+ else
+ return builtin_type (gdbarch)->builtin_double;
}
/* Return non-zero if REGNUM is not a register available to the user
@@ -2625,8 +2584,7 @@ hppa64_register_type (struct gdbarch *gdbarch, int regnum)
static int
hppa32_cannot_store_register (struct gdbarch *gdbarch, int regnum)
{
- return (regnum == 0
- || regnum == HPPA_PCSQ_HEAD_REGNUM
+ return (regnum == 0 || regnum == HPPA_PCSQ_HEAD_REGNUM
|| (regnum >= HPPA_PCSQ_TAIL_REGNUM && regnum < HPPA_IPSW_REGNUM)
|| (regnum > HPPA_IPSW_REGNUM && regnum < HPPA_FP4_REGNUM));
}
@@ -2644,8 +2602,7 @@ hppa32_cannot_fetch_register (struct gdbarch *gdbarch, int regnum)
static int
hppa64_cannot_store_register (struct gdbarch *gdbarch, int regnum)
{
- return (regnum == 0
- || regnum == HPPA_PCSQ_HEAD_REGNUM
+ return (regnum == 0 || regnum == HPPA_PCSQ_HEAD_REGNUM
|| (regnum >= HPPA_PCSQ_TAIL_REGNUM && regnum < HPPA_IPSW_REGNUM)
|| (regnum > HPPA_IPSW_REGNUM && regnum < HPPA64_FP4_REGNUM));
}
@@ -2676,15 +2633,15 @@ hppa_addr_bits_remove (struct gdbarch *gdbarch, CORE_ADDR addr)
/* Get the ARGIth function argument for the current function. */
static CORE_ADDR
-hppa_fetch_pointer_argument (frame_info_ptr frame, int argi,
- struct type *type)
+hppa_fetch_pointer_argument (frame_info_ptr frame, int argi, struct type *type)
{
return get_frame_register_unsigned (frame, HPPA_R0_REGNUM + 26 - argi);
}
static enum register_status
-hppa_pseudo_register_read (struct gdbarch *gdbarch, readable_regcache *regcache,
- int regnum, gdb_byte *buf)
+hppa_pseudo_register_read (struct gdbarch *gdbarch,
+ readable_regcache *regcache, int regnum,
+ gdb_byte *buf)
{
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
ULONGEST tmp;
@@ -2708,8 +2665,7 @@ hppa_find_global_pointer (struct gdbarch *gdbarch, struct value *function)
struct value *
hppa_frame_prev_register_helper (frame_info_ptr this_frame,
- trad_frame_saved_reg saved_regs[],
- int regnum)
+ trad_frame_saved_reg saved_regs[], int regnum)
{
struct gdbarch *arch = get_frame_arch (this_frame);
enum bfd_endian byte_order = gdbarch_byte_order (arch);
@@ -2718,9 +2674,9 @@ hppa_frame_prev_register_helper (frame_info_ptr this_frame,
{
int size = register_size (arch, HPPA_PCOQ_HEAD_REGNUM);
CORE_ADDR pc;
- struct value *pcoq_val =
- trad_frame_get_prev_register (this_frame, saved_regs,
- HPPA_PCOQ_HEAD_REGNUM);
+ struct value *pcoq_val
+ = trad_frame_get_prev_register (this_frame, saved_regs,
+ HPPA_PCOQ_HEAD_REGNUM);
pc = extract_unsigned_integer (value_contents_all (pcoq_val).data (),
size, byte_order);
@@ -2729,13 +2685,12 @@ hppa_frame_prev_register_helper (frame_info_ptr this_frame,
return trad_frame_get_prev_register (this_frame, saved_regs, regnum);
}
-
/* An instruction to match. */
struct insn_pattern
{
- unsigned int data; /* See if it matches this.... */
- unsigned int mask; /* ... with this mask. */
+ unsigned int data; /* See if it matches this.... */
+ unsigned int mask; /* ... with this mask. */
};
/* See bfd/elf32-hppa.c */
@@ -2743,7 +2698,7 @@ static struct insn_pattern hppa_long_branch_stub[] = {
/* ldil LR'xxx,%r1 */
{ 0x20200000, 0xffe00000 },
/* be,n RR'xxx(%sr4,%r1) */
- { 0xe0202002, 0xffe02002 },
+ { 0xe0202002, 0xffe02002 },
{ 0, 0 }
};
@@ -2753,7 +2708,7 @@ static struct insn_pattern hppa_long_branch_pic_stub[] = {
/* addil LR'xxx - ($PIC_pcrel$0 - 4), %r1 */
{ 0x28200000, 0xffe00000 },
/* be,n RR'xxxx - ($PIC_pcrel$0 - 8)(%sr4, %r1) */
- { 0xe0202002, 0xffe02002 },
+ { 0xe0202002, 0xffe02002 },
{ 0, 0 }
};
@@ -2790,7 +2745,7 @@ static struct insn_pattern hppa_plt_stub[] = {
};
/* Maximum number of instructions on the patterns above. */
-#define HPPA_MAX_INSN_PATTERN_LEN 4
+#define HPPA_MAX_INSN_PATTERN_LEN 4
/* Return non-zero if the instructions at PC match the series
described in PATTERN, or zero otherwise. PATTERN is an array of
@@ -2837,8 +2792,8 @@ hppa_match_insns_relaxed (struct gdbarch *gdbarch, CORE_ADDR pc,
len++;
for (offset = 0; offset < len; offset++)
- if (hppa_match_insns (gdbarch, pc - offset * HPPA_INSN_SIZE,
- pattern, insn))
+ if (hppa_match_insns (gdbarch, pc - offset * HPPA_INSN_SIZE, pattern,
+ insn))
return 1;
return 0;
@@ -2873,12 +2828,12 @@ hppa_in_solib_call_trampoline (struct gdbarch *gdbarch, CORE_ADDR pc)
if (u != NULL)
return 0;
- return
- (hppa_match_insns_relaxed (gdbarch, pc, hppa_import_stub, insn)
- || hppa_match_insns_relaxed (gdbarch, pc, hppa_import_pic_stub, insn)
- || hppa_match_insns_relaxed (gdbarch, pc, hppa_long_branch_stub, insn)
- || hppa_match_insns_relaxed (gdbarch, pc,
- hppa_long_branch_pic_stub, insn));
+ return (hppa_match_insns_relaxed (gdbarch, pc, hppa_import_stub, insn)
+ || hppa_match_insns_relaxed (gdbarch, pc, hppa_import_pic_stub, insn)
+ || hppa_match_insns_relaxed (gdbarch, pc, hppa_long_branch_stub,
+ insn)
+ || hppa_match_insns_relaxed (gdbarch, pc, hppa_long_branch_pic_stub,
+ insn));
}
/* This code skips several kind of "trampolines" used on PA-RISC
@@ -2930,7 +2885,7 @@ hppa_skip_trampoline_code (frame_info_ptr frame, CORE_ADDR pc)
/* Sanity check: are we pointing to the PLT stub? */
if (!hppa_match_insns (gdbarch, pc, hppa_plt_stub, insn))
{
- warning (_("Cannot resolve PLT stub at %s."),
+ warning (_ ("Cannot resolve PLT stub at %s."),
paddress (gdbarch, pc));
return 0;
}
@@ -2942,7 +2897,6 @@ hppa_skip_trampoline_code (frame_info_ptr frame, CORE_ADDR pc)
return pc;
}
-
/* Here is a table of C type sizes on hppa with various compiles
and options. I measured this on PA 9000/800 with HP-UX 11.11
@@ -2996,8 +2950,8 @@ hppa_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
a 32 or 64 bits architecture. If the bfd_arch_info is not available,
then default to a 32bit machine. */
if (info.bfd_arch_info != NULL)
- tdep->bytes_per_address =
- info.bfd_arch_info->bits_per_address / info.bfd_arch_info->bits_per_byte;
+ tdep->bytes_per_address = info.bfd_arch_info->bits_per_address
+ / info.bfd_arch_info->bits_per_byte;
else
tdep->bytes_per_address = 4;
@@ -3007,28 +2961,28 @@ hppa_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
on a 32 bits or 64 bits target. */
switch (tdep->bytes_per_address)
{
- case 4:
- set_gdbarch_num_regs (gdbarch, hppa32_num_regs);
- set_gdbarch_register_name (gdbarch, hppa32_register_name);
- set_gdbarch_register_type (gdbarch, hppa32_register_type);
- set_gdbarch_cannot_store_register (gdbarch,
- hppa32_cannot_store_register);
- set_gdbarch_cannot_fetch_register (gdbarch,
- hppa32_cannot_fetch_register);
- break;
- case 8:
- set_gdbarch_num_regs (gdbarch, hppa64_num_regs);
- set_gdbarch_register_name (gdbarch, hppa64_register_name);
- set_gdbarch_register_type (gdbarch, hppa64_register_type);
- set_gdbarch_dwarf2_reg_to_regnum (gdbarch, hppa64_dwarf_reg_to_regnum);
- set_gdbarch_cannot_store_register (gdbarch,
- hppa64_cannot_store_register);
- set_gdbarch_cannot_fetch_register (gdbarch,
- hppa64_cannot_fetch_register);
- break;
- default:
- internal_error (_("Unsupported address size: %d"),
- tdep->bytes_per_address);
+ case 4:
+ set_gdbarch_num_regs (gdbarch, hppa32_num_regs);
+ set_gdbarch_register_name (gdbarch, hppa32_register_name);
+ set_gdbarch_register_type (gdbarch, hppa32_register_type);
+ set_gdbarch_cannot_store_register (gdbarch,
+ hppa32_cannot_store_register);
+ set_gdbarch_cannot_fetch_register (gdbarch,
+ hppa32_cannot_fetch_register);
+ break;
+ case 8:
+ set_gdbarch_num_regs (gdbarch, hppa64_num_regs);
+ set_gdbarch_register_name (gdbarch, hppa64_register_name);
+ set_gdbarch_register_type (gdbarch, hppa64_register_type);
+ set_gdbarch_dwarf2_reg_to_regnum (gdbarch, hppa64_dwarf_reg_to_regnum);
+ set_gdbarch_cannot_store_register (gdbarch,
+ hppa64_cannot_store_register);
+ set_gdbarch_cannot_fetch_register (gdbarch,
+ hppa64_cannot_fetch_register);
+ break;
+ default:
+ internal_error (_ ("Unsupported address size: %d"),
+ tdep->bytes_per_address);
}
set_gdbarch_long_bit (gdbarch, tdep->bytes_per_address * TARGET_CHAR_BIT);
@@ -3043,8 +2997,7 @@ hppa_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
/* The following gdbarch vector elements do not depend on the address
size, or in any other gdbarch element previously set. */
set_gdbarch_skip_prologue (gdbarch, hppa_skip_prologue);
- set_gdbarch_stack_frame_destroyed_p (gdbarch,
- hppa_stack_frame_destroyed_p);
+ set_gdbarch_stack_frame_destroyed_p (gdbarch, hppa_stack_frame_destroyed_p);
set_gdbarch_inner_than (gdbarch, core_addr_greaterthan);
set_gdbarch_sp_regnum (gdbarch, HPPA_SP_REGNUM);
set_gdbarch_fp0_regnum (gdbarch, HPPA_FP0_REGNUM);
@@ -3068,17 +3021,17 @@ hppa_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
case 4:
set_gdbarch_push_dummy_call (gdbarch, hppa32_push_dummy_call);
set_gdbarch_frame_align (gdbarch, hppa32_frame_align);
- set_gdbarch_convert_from_func_ptr_addr
- (gdbarch, hppa32_convert_from_func_ptr_addr);
+ set_gdbarch_convert_from_func_ptr_addr (
+ gdbarch, hppa32_convert_from_func_ptr_addr);
break;
case 8:
set_gdbarch_push_dummy_call (gdbarch, hppa64_push_dummy_call);
set_gdbarch_frame_align (gdbarch, hppa64_frame_align);
break;
default:
- internal_error (_("bad switch"));
+ internal_error (_ ("bad switch"));
}
-
+
/* Struct return methods. */
switch (tdep->bytes_per_address)
{
@@ -3089,9 +3042,9 @@ hppa_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
set_gdbarch_return_value (gdbarch, hppa64_return_value);
break;
default:
- internal_error (_("bad switch"));
+ internal_error (_ ("bad switch"));
}
-
+
set_gdbarch_breakpoint_kind_from_pc (gdbarch, hppa_breakpoint::kind_from_pc);
set_gdbarch_sw_breakpoint_from_kind (gdbarch, hppa_breakpoint::bp_from_kind);
set_gdbarch_pseudo_register_read (gdbarch, hppa_pseudo_register_read);
@@ -3115,26 +3068,27 @@ hppa_dump_tdep (struct gdbarch *gdbarch, struct ui_file *file)
{
hppa_gdbarch_tdep *tdep = gdbarch_tdep<hppa_gdbarch_tdep> (gdbarch);
- gdb_printf (file, "bytes_per_address = %d\n",
- tdep->bytes_per_address);
+ gdb_printf (file, "bytes_per_address = %d\n", tdep->bytes_per_address);
gdb_printf (file, "elf = %s\n", tdep->is_elf ? "yes" : "no");
}
void _initialize_hppa_tdep ();
+
void
_initialize_hppa_tdep ()
{
gdbarch_register (bfd_arch_hppa, hppa_gdbarch_init, hppa_dump_tdep);
add_cmd ("unwind", class_maintenance, unwind_command,
- _("Print unwind table entry at given address."),
+ _ ("Print unwind table entry at given address."),
&maintenanceprintlist);
/* Debug this files internals. */
- add_setshow_boolean_cmd ("hppa", class_maintenance, &hppa_debug, _("\
+ add_setshow_boolean_cmd ("hppa", class_maintenance, &hppa_debug, _ ("\
Set whether hppa target specific debugging information should be displayed."),
- _("\
-Show whether hppa target specific debugging information is displayed."), _("\
+ _ ("\
+Show whether hppa target specific debugging information is displayed."),
+ _ ("\
This flag controls whether hppa target specific debugging information is\n\
displayed. This information is particularly useful for debugging frame\n\
unwinding problems."),
diff --git a/gdb/hppa-tdep.h b/gdb/hppa-tdep.h
index 62a5fb8d707..890c90b32e7 100644
--- a/gdb/hppa-tdep.h
+++ b/gdb/hppa-tdep.h
@@ -30,54 +30,54 @@ struct so_list;
enum hppa_regnum
{
- HPPA_R0_REGNUM = 0, /* Doesn't actually exist, used as base for
+ HPPA_R0_REGNUM = 0, /* Doesn't actually exist, used as base for
other r registers. */
HPPA_R1_REGNUM = 1,
- HPPA_FLAGS_REGNUM = 0, /* Various status flags */
- HPPA_RP_REGNUM = 2, /* return pointer */
- HPPA_FP_REGNUM = 3, /* The ABI's frame pointer, when used */
+ HPPA_FLAGS_REGNUM = 0, /* Various status flags */
+ HPPA_RP_REGNUM = 2, /* return pointer */
+ HPPA_FP_REGNUM = 3, /* The ABI's frame pointer, when used */
HPPA_DP_REGNUM = 27,
HPPA_RET0_REGNUM = 28,
HPPA_RET1_REGNUM = 29,
- HPPA_SP_REGNUM = 30, /* Stack pointer. */
+ HPPA_SP_REGNUM = 30, /* Stack pointer. */
HPPA_R31_REGNUM = 31,
- HPPA_SAR_REGNUM = 32, /* Shift Amount Register */
- HPPA_IPSW_REGNUM = 41, /* Interrupt Processor Status Word */
- HPPA_PCOQ_HEAD_REGNUM = 33, /* instruction offset queue head */
- HPPA_PCSQ_HEAD_REGNUM = 34, /* instruction space queue head */
- HPPA_PCOQ_TAIL_REGNUM = 35, /* instruction offset queue tail */
- HPPA_PCSQ_TAIL_REGNUM = 36, /* instruction space queue tail */
- HPPA_EIEM_REGNUM = 37, /* External Interrupt Enable Mask */
- HPPA_IIR_REGNUM = 38, /* Interrupt Instruction Register */
- HPPA_ISR_REGNUM = 39, /* Interrupt Space Register */
- HPPA_IOR_REGNUM = 40, /* Interrupt Offset Register */
- HPPA_SR4_REGNUM = 43, /* space register 4 */
- HPPA_SR0_REGNUM = 44, /* space register 0 */
- HPPA_SR1_REGNUM = 45, /* space register 1 */
- HPPA_SR2_REGNUM = 46, /* space register 2 */
- HPPA_SR3_REGNUM = 47, /* space register 3 */
- HPPA_SR5_REGNUM = 48, /* space register 5 */
- HPPA_SR6_REGNUM = 49, /* space register 6 */
- HPPA_SR7_REGNUM = 50, /* space register 7 */
- HPPA_RCR_REGNUM = 51, /* Recover Counter (also known as cr0) */
- HPPA_PID0_REGNUM = 52, /* Protection ID */
- HPPA_PID1_REGNUM = 53, /* Protection ID */
- HPPA_PID2_REGNUM = 55, /* Protection ID */
- HPPA_PID3_REGNUM = 56, /* Protection ID */
- HPPA_CCR_REGNUM = 54, /* Coprocessor Configuration Register */
- HPPA_TR0_REGNUM = 57, /* Temporary Registers (cr24 -> cr31) */
+ HPPA_SAR_REGNUM = 32, /* Shift Amount Register */
+ HPPA_IPSW_REGNUM = 41, /* Interrupt Processor Status Word */
+ HPPA_PCOQ_HEAD_REGNUM = 33, /* instruction offset queue head */
+ HPPA_PCSQ_HEAD_REGNUM = 34, /* instruction space queue head */
+ HPPA_PCOQ_TAIL_REGNUM = 35, /* instruction offset queue tail */
+ HPPA_PCSQ_TAIL_REGNUM = 36, /* instruction space queue tail */
+ HPPA_EIEM_REGNUM = 37, /* External Interrupt Enable Mask */
+ HPPA_IIR_REGNUM = 38, /* Interrupt Instruction Register */
+ HPPA_ISR_REGNUM = 39, /* Interrupt Space Register */
+ HPPA_IOR_REGNUM = 40, /* Interrupt Offset Register */
+ HPPA_SR4_REGNUM = 43, /* space register 4 */
+ HPPA_SR0_REGNUM = 44, /* space register 0 */
+ HPPA_SR1_REGNUM = 45, /* space register 1 */
+ HPPA_SR2_REGNUM = 46, /* space register 2 */
+ HPPA_SR3_REGNUM = 47, /* space register 3 */
+ HPPA_SR5_REGNUM = 48, /* space register 5 */
+ HPPA_SR6_REGNUM = 49, /* space register 6 */
+ HPPA_SR7_REGNUM = 50, /* space register 7 */
+ HPPA_RCR_REGNUM = 51, /* Recover Counter (also known as cr0) */
+ HPPA_PID0_REGNUM = 52, /* Protection ID */
+ HPPA_PID1_REGNUM = 53, /* Protection ID */
+ HPPA_PID2_REGNUM = 55, /* Protection ID */
+ HPPA_PID3_REGNUM = 56, /* Protection ID */
+ HPPA_CCR_REGNUM = 54, /* Coprocessor Configuration Register */
+ HPPA_TR0_REGNUM = 57, /* Temporary Registers (cr24 -> cr31) */
HPPA_CR26_REGNUM = 59,
- HPPA_CR27_REGNUM = 60, /* Base register for thread-local
+ HPPA_CR27_REGNUM = 60, /* Base register for thread-local
storage, cr27 */
- HPPA_FP0_REGNUM = 64, /* First floating-point. */
+ HPPA_FP0_REGNUM = 64, /* First floating-point. */
HPPA_FP4_REGNUM = 72,
HPPA64_FP4_REGNUM = 68,
- HPPA_FP31R_REGNUM = 127, /* Last floating-point. */
+ HPPA_FP31R_REGNUM = 127, /* Last floating-point. */
- HPPA_ARG0_REGNUM = 26, /* The first argument of a callee. */
- HPPA_ARG1_REGNUM = 25, /* The second argument of a callee. */
- HPPA_ARG2_REGNUM = 24, /* The third argument of a callee. */
- HPPA_ARG3_REGNUM = 23 /* The fourth argument of a callee. */
+ HPPA_ARG0_REGNUM = 26, /* The first argument of a callee. */
+ HPPA_ARG1_REGNUM = 25, /* The second argument of a callee. */
+ HPPA_ARG2_REGNUM = 24, /* The third argument of a callee. */
+ HPPA_ARG3_REGNUM = 23 /* The fourth argument of a callee. */
};
/* Instruction size. */
@@ -96,13 +96,14 @@ struct hppa_gdbarch_tdep : gdbarch_tdep_base
/* Given a function address, try to find the global pointer for the
corresponding shared object. */
- CORE_ADDR (*find_global_pointer) (struct gdbarch *, struct value *) = nullptr;
+ CORE_ADDR (*find_global_pointer)
+ (struct gdbarch *, struct value *) = nullptr;
/* For shared libraries, each call goes through a small piece of
trampoline code in the ".plt" section. IN_SOLIB_CALL_TRAMPOLINE
evaluates to nonzero if we are currently stopped in one of these. */
- int (*in_solib_call_trampoline) (struct gdbarch *gdbarch,
- CORE_ADDR pc) = nullptr;
+ int (*in_solib_call_trampoline) (struct gdbarch *gdbarch, CORE_ADDR pc)
+ = nullptr;
/* For targets that support multiple spaces, we may have additional stubs
in the return path. These stubs are internal to the ABI, and users are
@@ -110,7 +111,8 @@ struct hppa_gdbarch_tdep : gdbarch_tdep_base
adjust the pc to the real caller. This improves the behavior of commands
that traverse frames such as "up" and "finish". */
void (*unwind_adjust_stub) (frame_info_ptr this_frame, CORE_ADDR base,
- trad_frame_saved_reg *saved_regs) = nullptr;
+ trad_frame_saved_reg *saved_regs)
+ = nullptr;
/* These are solib-dependent methods. They are really HPUX only, but
we don't have a HPUX-specific tdep vector at the moment. */
@@ -125,53 +127,52 @@ struct hppa_gdbarch_tdep : gdbarch_tdep_base
*/
struct unwind_table_entry
- {
- CORE_ADDR region_start;
- CORE_ADDR region_end;
-
- unsigned int Cannot_unwind:1; /* 0 */
- unsigned int Millicode:1; /* 1 */
- unsigned int Millicode_save_sr0:1; /* 2 */
- unsigned int Region_description:2; /* 3..4 */
- unsigned int reserved:1; /* 5 */
- unsigned int Entry_SR:1; /* 6 */
- unsigned int Entry_FR:4; /* number saved *//* 7..10 */
- unsigned int Entry_GR:5; /* number saved *//* 11..15 */
- unsigned int Args_stored:1; /* 16 */
- unsigned int Variable_Frame:1; /* 17 */
- unsigned int Separate_Package_Body:1; /* 18 */
- unsigned int Frame_Extension_Millicode:1; /* 19 */
- unsigned int Stack_Overflow_Check:1; /* 20 */
- unsigned int Two_Instruction_SP_Increment:1; /* 21 */
- unsigned int sr4export:1; /* 22 */
- unsigned int cxx_info:1; /* 23 */
- unsigned int cxx_try_catch:1; /* 24 */
- unsigned int sched_entry_seq:1; /* 25 */
- unsigned int reserved1:1; /* 26 */
- unsigned int Save_SP:1; /* 27 */
- unsigned int Save_RP:1; /* 28 */
- unsigned int Save_MRP_in_frame:1; /* 29 */
- unsigned int save_r19:1; /* 30 */
- unsigned int Cleanup_defined:1; /* 31 */
-
- unsigned int MPE_XL_interrupt_marker:1; /* 0 */
- unsigned int HP_UX_interrupt_marker:1; /* 1 */
- unsigned int Large_frame:1; /* 2 */
- unsigned int alloca_frame:1; /* 3 */
- unsigned int reserved2:1; /* 4 */
- unsigned int Total_frame_size:27; /* 5..31 */
-
- /* This is *NOT* part of an actual unwind_descriptor in an object
+{
+ CORE_ADDR region_start;
+ CORE_ADDR region_end;
+
+ unsigned int Cannot_unwind : 1; /* 0 */
+ unsigned int Millicode : 1; /* 1 */
+ unsigned int Millicode_save_sr0 : 1; /* 2 */
+ unsigned int Region_description : 2; /* 3..4 */
+ unsigned int reserved : 1; /* 5 */
+ unsigned int Entry_SR : 1; /* 6 */
+ unsigned int Entry_FR : 4; /* number saved */ /* 7..10 */
+ unsigned int Entry_GR : 5; /* number saved */ /* 11..15 */
+ unsigned int Args_stored : 1; /* 16 */
+ unsigned int Variable_Frame : 1; /* 17 */
+ unsigned int Separate_Package_Body : 1; /* 18 */
+ unsigned int Frame_Extension_Millicode : 1; /* 19 */
+ unsigned int Stack_Overflow_Check : 1; /* 20 */
+ unsigned int Two_Instruction_SP_Increment : 1; /* 21 */
+ unsigned int sr4export : 1; /* 22 */
+ unsigned int cxx_info : 1; /* 23 */
+ unsigned int cxx_try_catch : 1; /* 24 */
+ unsigned int sched_entry_seq : 1; /* 25 */
+ unsigned int reserved1 : 1; /* 26 */
+ unsigned int Save_SP : 1; /* 27 */
+ unsigned int Save_RP : 1; /* 28 */
+ unsigned int Save_MRP_in_frame : 1; /* 29 */
+ unsigned int save_r19 : 1; /* 30 */
+ unsigned int Cleanup_defined : 1; /* 31 */
+
+ unsigned int MPE_XL_interrupt_marker : 1; /* 0 */
+ unsigned int HP_UX_interrupt_marker : 1; /* 1 */
+ unsigned int Large_frame : 1; /* 2 */
+ unsigned int alloca_frame : 1; /* 3 */
+ unsigned int reserved2 : 1; /* 4 */
+ unsigned int Total_frame_size : 27; /* 5..31 */
+
+ /* This is *NOT* part of an actual unwind_descriptor in an object
file. It is *ONLY* part of the "internalized" descriptors that
we create from those in a file. */
- struct
- {
- unsigned int stub_type:4; /* 0..3 */
- unsigned int padding:28; /* 4..31 */
- }
- stub_unwind;
- };
+ struct
+ {
+ unsigned int stub_type : 4; /* 0..3 */
+ unsigned int padding : 28; /* 4..31 */
+ } stub_unwind;
+};
/* HP linkers also generate unwinds for various linker-generated stubs.
GDB reads in the stubs from the $UNWIND_END$ subspace, then
@@ -181,13 +182,13 @@ struct unwind_table_entry
/* The gaps represent linker stubs used in MPE and space for future
expansion. */
enum unwind_stub_types
- {
- LONG_BRANCH = 1,
- PARAMETER_RELOCATION = 2,
- EXPORT = 10,
- IMPORT = 11,
- IMPORT_SHLIB = 12,
- };
+{
+ LONG_BRANCH = 1,
+ PARAMETER_RELOCATION = 2,
+ EXPORT = 10,
+ IMPORT = 11,
+ IMPORT_SHLIB = 12,
+};
struct unwind_table_entry *find_unwind_entry (CORE_ADDR);
@@ -198,12 +199,11 @@ unsigned hppa_extract_5r_store (unsigned int);
int hppa_extract_17 (unsigned int);
int hppa_extract_21 (unsigned);
int hppa_extract_14 (unsigned);
-CORE_ADDR hppa_symbol_address(const char *sym);
+CORE_ADDR hppa_symbol_address (const char *sym);
extern struct value *
- hppa_frame_prev_register_helper (frame_info_ptr this_frame,
- trad_frame_saved_reg *saved_regs,
- int regnum);
+hppa_frame_prev_register_helper (frame_info_ptr this_frame,
+ trad_frame_saved_reg *saved_regs, int regnum);
extern CORE_ADDR hppa_read_pc (struct regcache *regcache);
extern void hppa_write_pc (struct regcache *regcache, CORE_ADDR pc);
@@ -214,4 +214,4 @@ extern int hppa_in_solib_call_trampoline (struct gdbarch *gdbarch,
CORE_ADDR pc);
extern CORE_ADDR hppa_skip_trampoline_code (frame_info_ptr, CORE_ADDR pc);
-#endif /* hppa-tdep.h */
+#endif /* hppa-tdep.h */
diff --git a/gdb/i386-bsd-nat.c b/gdb/i386-bsd-nat.c
index c8365a7b26a..8996b54444d 100644
--- a/gdb/i386-bsd-nat.c
+++ b/gdb/i386-bsd-nat.c
@@ -32,7 +32,6 @@
#include "x86-bsd-nat.h"
#include "i386-bsd-nat.h"
#include "inf-ptrace.h"
-
static PTRACE_TYPE_RET
gdb_ptrace (PTRACE_TYPE_ARG1 request, ptid_t ptid, PTRACE_TYPE_ARG3 addr,
@@ -60,42 +59,30 @@ gdb_ptrace (PTRACE_TYPE_ARG1 request, ptid_t ptid, PTRACE_TYPE_ARG3 addr,
/* At i386bsd_reg_offset[REGNUM] you'll find the offset in `struct
reg' where the GDB register REGNUM is stored. Unsupported
registers are marked with `-1'. */
-static int i386bsd_r_reg_offset[] =
-{
- REG_OFFSET (r_eax),
- REG_OFFSET (r_ecx),
- REG_OFFSET (r_edx),
- REG_OFFSET (r_ebx),
- REG_OFFSET (r_esp),
- REG_OFFSET (r_ebp),
- REG_OFFSET (r_esi),
- REG_OFFSET (r_edi),
- REG_OFFSET (r_eip),
- REG_OFFSET (r_eflags),
- REG_OFFSET (r_cs),
- REG_OFFSET (r_ss),
- REG_OFFSET (r_ds),
- REG_OFFSET (r_es),
+static int i386bsd_r_reg_offset[]
+ = { REG_OFFSET (r_eax), REG_OFFSET (r_ecx), REG_OFFSET (r_edx),
+ REG_OFFSET (r_ebx), REG_OFFSET (r_esp), REG_OFFSET (r_ebp),
+ REG_OFFSET (r_esi), REG_OFFSET (r_edi), REG_OFFSET (r_eip),
+ REG_OFFSET (r_eflags), REG_OFFSET (r_cs), REG_OFFSET (r_ss),
+ REG_OFFSET (r_ds), REG_OFFSET (r_es),
#ifdef HAVE_STRUCT_REG_R_FS
- REG_OFFSET (r_fs),
+ REG_OFFSET (r_fs),
#else
-1,
#endif
#ifdef HAVE_STRUCT_REG_R_GS
- REG_OFFSET (r_gs)
+ REG_OFFSET (r_gs)
#else
-1
#endif
-};
+ };
/* Macro to determine if a register is fetched with PT_GETREGS. */
-#define GETREGS_SUPPLIES(regnum) \
- ((0 <= (regnum) && (regnum) <= 15))
+#define GETREGS_SUPPLIES(regnum) ((0 <= (regnum) && (regnum) <= 15))
/* Set to 1 if the kernel supports PT_GETXMMREGS. Initialized to -1
so that we try PT_GETXMMREGS the first time around. */
static int have_ptrace_xmmregs = -1;
-
/* Supply the general-purpose registers in GREGS, to REGCACHE. */
@@ -119,8 +106,8 @@ i386bsd_supply_gregset (struct regcache *regcache, const void *gregs)
registers. */
static void
-i386bsd_collect_gregset (const struct regcache *regcache,
- void *gregs, int regnum)
+i386bsd_collect_gregset (const struct regcache *regcache, void *gregs,
+ int regnum)
{
char *regs = (char *) gregs;
int i;
@@ -150,7 +137,7 @@ i386bsd_fetch_inferior_registers (struct regcache *regcache, int regnum)
struct reg regs;
if (gdb_ptrace (PT_GETREGS, ptid, (PTRACE_TYPE_ARG3) &regs, 0) == -1)
- perror_with_name (_("Couldn't get registers"));
+ perror_with_name (_ ("Couldn't get registers"));
i386bsd_supply_gregset (regcache, &regs);
if (regnum != -1)
@@ -163,8 +150,8 @@ i386bsd_fetch_inferior_registers (struct regcache *regcache, int regnum)
char xmmregs[512];
if (have_ptrace_xmmregs != 0
- && gdb_ptrace(PT_GETXMMREGS, ptid,
- (PTRACE_TYPE_ARG3) xmmregs, 0) == 0)
+ && gdb_ptrace (PT_GETXMMREGS, ptid, (PTRACE_TYPE_ARG3) xmmregs, 0)
+ == 0)
{
have_ptrace_xmmregs = 1;
i387_supply_fxsave (regcache, -1, xmmregs);
@@ -172,9 +159,9 @@ i386bsd_fetch_inferior_registers (struct regcache *regcache, int regnum)
else
{
have_ptrace_xmmregs = 0;
- if (gdb_ptrace (PT_GETFPREGS, ptid,
- (PTRACE_TYPE_ARG3) &fpregs, 0) == -1)
- perror_with_name (_("Couldn't get floating point status"));
+ if (gdb_ptrace (PT_GETFPREGS, ptid, (PTRACE_TYPE_ARG3) &fpregs, 0)
+ == -1)
+ perror_with_name (_ ("Couldn't get floating point status"));
i387_supply_fsave (regcache, -1, &fpregs);
}
@@ -194,12 +181,12 @@ i386bsd_store_inferior_registers (struct regcache *regcache, int regnum)
struct reg regs;
if (gdb_ptrace (PT_GETREGS, ptid, (PTRACE_TYPE_ARG3) &regs, 0) == -1)
- perror_with_name (_("Couldn't get registers"));
+ perror_with_name (_ ("Couldn't get registers"));
i386bsd_collect_gregset (regcache, &regs, regnum);
if (gdb_ptrace (PT_SETREGS, ptid, (PTRACE_TYPE_ARG3) &regs, 0) == -1)
- perror_with_name (_("Couldn't write registers"));
+ perror_with_name (_ ("Couldn't write registers"));
if (regnum != -1)
return;
@@ -211,34 +198,35 @@ i386bsd_store_inferior_registers (struct regcache *regcache, int regnum)
char xmmregs[512];
if (have_ptrace_xmmregs != 0
- && gdb_ptrace(PT_GETXMMREGS, ptid,
- (PTRACE_TYPE_ARG3) xmmregs, 0) == 0)
+ && gdb_ptrace (PT_GETXMMREGS, ptid, (PTRACE_TYPE_ARG3) xmmregs, 0)
+ == 0)
{
have_ptrace_xmmregs = 1;
i387_collect_fxsave (regcache, regnum, xmmregs);
- if (gdb_ptrace (PT_SETXMMREGS, ptid,
- (PTRACE_TYPE_ARG3) xmmregs, 0) == -1)
- perror_with_name (_("Couldn't write XMM registers"));
+ if (gdb_ptrace (PT_SETXMMREGS, ptid, (PTRACE_TYPE_ARG3) xmmregs, 0)
+ == -1)
+ perror_with_name (_ ("Couldn't write XMM registers"));
}
else
{
have_ptrace_xmmregs = 0;
- if (gdb_ptrace (PT_GETFPREGS, ptid,
- (PTRACE_TYPE_ARG3) &fpregs, 0) == -1)
- perror_with_name (_("Couldn't get floating point status"));
+ if (gdb_ptrace (PT_GETFPREGS, ptid, (PTRACE_TYPE_ARG3) &fpregs, 0)
+ == -1)
+ perror_with_name (_ ("Couldn't get floating point status"));
i387_collect_fsave (regcache, regnum, &fpregs);
- if (gdb_ptrace (PT_SETFPREGS, ptid,
- (PTRACE_TYPE_ARG3) &fpregs, 0) == -1)
- perror_with_name (_("Couldn't write floating point status"));
+ if (gdb_ptrace (PT_SETFPREGS, ptid, (PTRACE_TYPE_ARG3) &fpregs, 0)
+ == -1)
+ perror_with_name (_ ("Couldn't write floating point status"));
}
}
}
void _initialize_i386bsd_nat ();
+
void
_initialize_i386bsd_nat ()
{
@@ -248,7 +236,7 @@ _initialize_i386bsd_nat ()
system header files and sysctl(3) to get at the relevant
information. */
-#if defined (OpenBSD)
+#if defined(OpenBSD)
#define SC_REG_OFFSET i386obsd_sc_reg_offset
#endif
@@ -270,9 +258,9 @@ _initialize_i386bsd_nat ()
if (SC_PC_OFFSET != offset)
{
- warning (_("\
+ warning (_ ("\
offsetof (struct sigcontext, sc_pc) yields %d instead of %d.\n\
-Please report this to <bug-gdb@gnu.org>."),
+Please report this to <bug-gdb@gnu.org>."),
offset, SC_PC_OFFSET);
}
@@ -283,7 +271,7 @@ Please report this to <bug-gdb@gnu.org>."),
if (SC_SP_OFFSET != offset)
{
- warning (_("\
+ warning (_ ("\
offsetof (struct sigcontext, sc_sp) yields %d instead of %d.\n\
Please report this to <bug-gdb@gnu.org>."),
offset, SC_SP_OFFSET);
@@ -296,7 +284,7 @@ Please report this to <bug-gdb@gnu.org>."),
if (SC_FP_OFFSET != offset)
{
- warning (_("\
+ warning (_ ("\
offsetof (struct sigcontext, sc_fp) yields %d instead of %d.\n\
Please report this to <bug-gdb@gnu.org>."),
offset, SC_FP_OFFSET);
diff --git a/gdb/i386-bsd-nat.h b/gdb/i386-bsd-nat.h
index 49e09fc7e7f..9321f3ca6cb 100644
--- a/gdb/i386-bsd-nat.h
+++ b/gdb/i386-bsd-nat.h
@@ -34,11 +34,16 @@ template<typename BaseTarget>
class i386_bsd_nat_target : public x86bsd_nat_target<BaseTarget>
{
public:
+
void fetch_registers (struct regcache *regcache, int regnum) override
- { i386bsd_fetch_inferior_registers (regcache, regnum); }
+ {
+ i386bsd_fetch_inferior_registers (regcache, regnum);
+ }
void store_registers (struct regcache *regcache, int regnum) override
- { i386bsd_store_inferior_registers (regcache, regnum); }
+ {
+ i386bsd_store_inferior_registers (regcache, regnum);
+ }
};
#endif /* i386-bsd-nat.h */
diff --git a/gdb/i386-bsd-tdep.c b/gdb/i386-bsd-tdep.c
index 78b24bc87fe..3d92bed87a9 100644
--- a/gdb/i386-bsd-tdep.c
+++ b/gdb/i386-bsd-tdep.c
@@ -44,31 +44,29 @@ i386bsd_sigcontext_addr (frame_info_ptr this_frame)
return read_memory_unsigned_integer (sp + 8, 4, byte_order);
}
-
/* Support for shared libraries. */
/* Traditional BSD (4.3 BSD, still used for BSDI and 386BSD). */
/* From <machine/signal.h>. */
-int i386bsd_sc_reg_offset[] =
-{
- -1, /* %eax */
- -1, /* %ecx */
- -1, /* %edx */
- -1, /* %ebx */
- 8 + 0 * 4, /* %esp */
- 8 + 1 * 4, /* %ebp */
- -1, /* %esi */
- -1, /* %edi */
- 8 + 3 * 4, /* %eip */
- 8 + 4 * 4, /* %eflags */
- -1, /* %cs */
- -1, /* %ss */
- -1, /* %ds */
- -1, /* %es */
- -1, /* %fs */
- -1 /* %gs */
+int i386bsd_sc_reg_offset[] = {
+ -1, /* %eax */
+ -1, /* %ecx */
+ -1, /* %edx */
+ -1, /* %ebx */
+ 8 + 0 * 4, /* %esp */
+ 8 + 1 * 4, /* %ebp */
+ -1, /* %esi */
+ -1, /* %edi */
+ 8 + 3 * 4, /* %eip */
+ 8 + 4 * 4, /* %eflags */
+ -1, /* %cs */
+ -1, /* %ss */
+ -1, /* %ds */
+ -1, /* %es */
+ -1, /* %fs */
+ -1 /* %gs */
};
void
@@ -84,5 +82,3 @@ i386bsd_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
tdep->sc_reg_offset = i386bsd_sc_reg_offset;
tdep->sc_num_regs = ARRAY_SIZE (i386bsd_sc_reg_offset);
}
-
-
diff --git a/gdb/i386-darwin-nat.c b/gdb/i386-darwin-nat.c
index 284c6771d07..a443c37b4b8 100644
--- a/gdb/i386-darwin-nat.c
+++ b/gdb/i386-darwin-nat.c
@@ -72,13 +72,12 @@ i386_darwin_nat_target::fetch_registers (struct regcache *regcache, int regno)
unsigned int gp_count = x86_THREAD_STATE_COUNT;
kern_return_t ret;
- ret = thread_get_state
- (current_thread, x86_THREAD_STATE, (thread_state_t) & gp_regs,
- &gp_count);
+ ret = thread_get_state (current_thread, x86_THREAD_STATE,
+ (thread_state_t) &gp_regs, &gp_count);
if (ret != KERN_SUCCESS)
{
- warning (_("Error calling thread_get_state for "
- "GP registers for thread 0x%lx\n"),
+ warning (_ ("Error calling thread_get_state for "
+ "GP registers for thread 0x%lx\n"),
(unsigned long) current_thread);
MACH_CHECK_ERROR (ret);
}
@@ -97,13 +96,12 @@ i386_darwin_nat_target::fetch_registers (struct regcache *regcache, int regno)
unsigned int fp_count = x86_FLOAT_STATE_COUNT;
kern_return_t ret;
- ret = thread_get_state
- (current_thread, x86_FLOAT_STATE, (thread_state_t) & fp_regs,
- &fp_count);
+ ret = thread_get_state (current_thread, x86_FLOAT_STATE,
+ (thread_state_t) &fp_regs, &fp_count);
if (ret != KERN_SUCCESS)
{
- warning (_("Error calling thread_get_state for "
- "float registers for thread 0x%lx\n"),
+ warning (_ ("Error calling thread_get_state for "
+ "float registers for thread 0x%lx\n"),
(unsigned long) current_thread);
MACH_CHECK_ERROR (ret);
}
@@ -121,19 +119,19 @@ i386_darwin_nat_target::fetch_registers (struct regcache *regcache, int regno)
kern_return_t ret;
int i;
- ret = thread_get_state
- (current_thread, x86_THREAD_STATE32, (thread_state_t) &gp_regs,
- &gp_count);
+ ret = thread_get_state (current_thread, x86_THREAD_STATE32,
+ (thread_state_t) &gp_regs, &gp_count);
if (ret != KERN_SUCCESS)
{
- warning (_("Error calling thread_get_state for "
- "GP registers for thread 0x%lx\n"),
+ warning (_ ("Error calling thread_get_state for "
+ "GP registers for thread 0x%lx\n"),
(unsigned long) current_thread);
MACH_CHECK_ERROR (ret);
}
for (i = 0; i < I386_NUM_GREGS; i++)
- regcache->raw_supply
- (i, (char *) &gp_regs + i386_darwin_thread_state_reg_offset[i]);
+ regcache->raw_supply (i,
+ (char *) &gp_regs
+ + i386_darwin_thread_state_reg_offset[i]);
fetched++;
}
@@ -145,13 +143,12 @@ i386_darwin_nat_target::fetch_registers (struct regcache *regcache, int regno)
unsigned int fp_count = x86_FLOAT_STATE32_COUNT;
kern_return_t ret;
- ret = thread_get_state
- (current_thread, x86_FLOAT_STATE32, (thread_state_t) &fp_regs,
- &fp_count);
+ ret = thread_get_state (current_thread, x86_FLOAT_STATE32,
+ (thread_state_t) &fp_regs, &fp_count);
if (ret != KERN_SUCCESS)
{
- warning (_("Error calling thread_get_state for "
- "float registers for thread 0x%lx\n"),
+ warning (_ ("Error calling thread_get_state for "
+ "float registers for thread 0x%lx\n"),
(unsigned long) current_thread);
MACH_CHECK_ERROR (ret);
}
@@ -160,9 +157,9 @@ i386_darwin_nat_target::fetch_registers (struct regcache *regcache, int regno)
}
}
- if (! fetched)
+ if (!fetched)
{
- warning (_("unknown register %d"), regno);
+ warning (_ ("unknown register %d"), regno);
regcache->raw_supply (regno, NULL);
}
}
@@ -172,8 +169,7 @@ i386_darwin_nat_target::fetch_registers (struct regcache *regcache, int regno)
Otherwise, REGNO specifies which register (so we can save time). */
void
-i386_darwin_nat_target::store_registers (struct regcache *regcache,
- int regno)
+i386_darwin_nat_target::store_registers (struct regcache *regcache, int regno)
{
thread_t current_thread = regcache->ptid ().tid ();
struct gdbarch *gdbarch = regcache->arch ();
@@ -187,9 +183,8 @@ i386_darwin_nat_target::store_registers (struct regcache *regcache,
kern_return_t ret;
unsigned int gp_count = x86_THREAD_STATE_COUNT;
- ret = thread_get_state
- (current_thread, x86_THREAD_STATE, (thread_state_t) &gp_regs,
- &gp_count);
+ ret = thread_get_state (current_thread, x86_THREAD_STATE,
+ (thread_state_t) &gp_regs, &gp_count);
MACH_CHECK_ERROR (ret);
gdb_assert (gp_regs.tsh.flavor == x86_THREAD_STATE64);
gdb_assert (gp_regs.tsh.count == x86_THREAD_STATE64_COUNT);
@@ -212,9 +207,8 @@ i386_darwin_nat_target::store_registers (struct regcache *regcache,
kern_return_t ret;
unsigned int fp_count = x86_FLOAT_STATE_COUNT;
- ret = thread_get_state
- (current_thread, x86_FLOAT_STATE, (thread_state_t) & fp_regs,
- &fp_count);
+ ret = thread_get_state (current_thread, x86_FLOAT_STATE,
+ (thread_state_t) &fp_regs, &fp_count);
MACH_CHECK_ERROR (ret);
gdb_assert (fp_regs.fsh.flavor == x86_FLOAT_STATE64);
gdb_assert (fp_regs.fsh.count == x86_FLOAT_STATE64_COUNT);
@@ -222,7 +216,7 @@ i386_darwin_nat_target::store_registers (struct regcache *regcache,
amd64_collect_fxsave (regcache, regno, &fp_regs.ufs.fs64.__fpu_fcw);
ret = thread_set_state (current_thread, x86_FLOAT_STATE,
- (thread_state_t) & fp_regs,
+ (thread_state_t) &fp_regs,
x86_FLOAT_STATE_COUNT);
MACH_CHECK_ERROR (ret);
}
@@ -237,15 +231,14 @@ i386_darwin_nat_target::store_registers (struct regcache *regcache,
unsigned int gp_count = x86_THREAD_STATE32_COUNT;
int i;
- ret = thread_get_state
- (current_thread, x86_THREAD_STATE32, (thread_state_t) &gp_regs,
- &gp_count);
+ ret = thread_get_state (current_thread, x86_THREAD_STATE32,
+ (thread_state_t) &gp_regs, &gp_count);
MACH_CHECK_ERROR (ret);
for (i = 0; i < I386_NUM_GREGS; i++)
if (regno == -1 || regno == i)
- regcache->raw_collect
- (i, (char *) &gp_regs + i386_darwin_thread_state_reg_offset[i]);
+ regcache->raw_collect (
+ i, (char *) &gp_regs + i386_darwin_thread_state_reg_offset[i]);
ret = thread_set_state (current_thread, x86_THREAD_STATE32,
(thread_state_t) &gp_regs,
@@ -260,9 +253,8 @@ i386_darwin_nat_target::store_registers (struct regcache *regcache,
unsigned int fp_count = x86_FLOAT_STATE32_COUNT;
kern_return_t ret;
- ret = thread_get_state
- (current_thread, x86_FLOAT_STATE32, (thread_state_t) & fp_regs,
- &fp_count);
+ ret = thread_get_state (current_thread, x86_FLOAT_STATE32,
+ (thread_state_t) &fp_regs, &fp_count);
MACH_CHECK_ERROR (ret);
i387_collect_fxsave (regcache, regno, &fp_regs.__fpu_fcw);
@@ -495,11 +487,10 @@ darwin_check_osabi (darwin_inferior *inf, thread_t thread)
info.byte_order = gdbarch_byte_order (target_gdbarch ());
info.osabi = GDB_OSABI_DARWIN;
if (gp_regs.tsh.flavor == x86_THREAD_STATE64)
- info.bfd_arch_info = bfd_lookup_arch (bfd_arch_i386,
- bfd_mach_x86_64);
+ info.bfd_arch_info = bfd_lookup_arch (bfd_arch_i386, bfd_mach_x86_64);
else
- info.bfd_arch_info = bfd_lookup_arch (bfd_arch_i386,
- bfd_mach_i386_i386);
+ info.bfd_arch_info
+ = bfd_lookup_arch (bfd_arch_i386, bfd_mach_i386_i386);
gdbarch_update_p (info);
}
}
@@ -530,10 +521,9 @@ i386_darwin_sstep_at_sigreturn (x86_thread_state_t *regs)
ULONGEST flags_addr;
unsigned int eflags;
- uctx_addr = read_memory_unsigned_integer
- (regs->uts.ts32.__esp + 4, 4, byte_order);
- mctx_addr = read_memory_unsigned_integer
- (uctx_addr + 28, 4, byte_order);
+ uctx_addr = read_memory_unsigned_integer (regs->uts.ts32.__esp + 4, 4,
+ byte_order);
+ mctx_addr = read_memory_unsigned_integer (uctx_addr + 28, 4, byte_order);
flags_addr = mctx_addr + 12 + 9 * 4;
read_memory (flags_addr, (gdb_byte *) &eflags, 4);
@@ -562,8 +552,8 @@ amd64_darwin_sstep_at_sigreturn (x86_thread_state_t *regs)
ULONGEST flags_addr;
unsigned int rflags;
- mctx_addr = read_memory_unsigned_integer
- (regs->uts.ts64.__rdi + 48, 8, byte_order);
+ mctx_addr = read_memory_unsigned_integer (regs->uts.ts64.__rdi + 48, 8,
+ byte_order);
flags_addr = mctx_addr + 16 + 17 * 8;
/* AMD64 is little endian. */
@@ -584,12 +574,11 @@ darwin_set_sstep (thread_t thread, int enable)
unsigned int count = x86_THREAD_STATE_COUNT;
kern_return_t kret;
- kret = thread_get_state (thread, x86_THREAD_STATE,
- (thread_state_t) &regs, &count);
+ kret = thread_get_state (thread, x86_THREAD_STATE, (thread_state_t) &regs,
+ &count);
if (kret != KERN_SUCCESS)
{
- warning (_("darwin_set_sstep: error %x, thread=%x\n"),
- kret, thread);
+ warning (_ ("darwin_set_sstep: error %x, thread=%x\n"), kret, thread);
return;
}
@@ -628,11 +617,12 @@ darwin_set_sstep (thread_t thread, int enable)
break;
#endif
default:
- error (_("darwin_set_sstep: unknown flavour: %d"), regs.tsh.flavor);
+ error (_ ("darwin_set_sstep: unknown flavour: %d"), regs.tsh.flavor);
}
}
void _initialize_i386_darwin_nat ();
+
void
_initialize_i386_darwin_nat ()
{
diff --git a/gdb/i386-darwin-tdep.c b/gdb/i386-darwin-tdep.c
index d84e5ed8005..084fbd80dff 100644
--- a/gdb/i386-darwin-tdep.c
+++ b/gdb/i386-darwin-tdep.c
@@ -39,28 +39,27 @@
/* Offsets into the struct i386_thread_state where we'll find the saved regs.
From <mach/i386/thread_status.h> and i386-tdep.h. */
-int i386_darwin_thread_state_reg_offset[] =
-{
- 0 * 4, /* EAX */
- 2 * 4, /* ECX */
- 3 * 4, /* EDX */
- 1 * 4, /* EBX */
- 7 * 4, /* ESP */
- 6 * 4, /* EBP */
- 5 * 4, /* ESI */
- 4 * 4, /* EDI */
- 10 * 4, /* EIP */
- 9 * 4, /* EFLAGS */
- 11 * 4, /* CS */
- 8 * 4, /* SS */
- 12 * 4, /* DS */
- 13 * 4, /* ES */
- 14 * 4, /* FS */
- 15 * 4 /* GS */
+int i386_darwin_thread_state_reg_offset[] = {
+ 0 * 4, /* EAX */
+ 2 * 4, /* ECX */
+ 3 * 4, /* EDX */
+ 1 * 4, /* EBX */
+ 7 * 4, /* ESP */
+ 6 * 4, /* EBP */
+ 5 * 4, /* ESI */
+ 4 * 4, /* EDI */
+ 10 * 4, /* EIP */
+ 9 * 4, /* EFLAGS */
+ 11 * 4, /* CS */
+ 8 * 4, /* SS */
+ 12 * 4, /* DS */
+ 13 * 4, /* ES */
+ 14 * 4, /* FS */
+ 15 * 4 /* GS */
};
-const int i386_darwin_thread_state_num_regs =
- ARRAY_SIZE (i386_darwin_thread_state_reg_offset);
+const int i386_darwin_thread_state_num_regs
+ = ARRAY_SIZE (i386_darwin_thread_state_reg_offset);
/* Assuming THIS_FRAME is a Darwin sigtramp routine, return the
address of the associated sigcontext structure. */
@@ -131,15 +130,13 @@ i386_darwin_arg_type_alignment (struct type *type)
aligned.
5. The caller places structures with vector elements on the stack,
16-byte aligned. */
- if (type->code () == TYPE_CODE_STRUCT
- || type->code () == TYPE_CODE_UNION)
+ if (type->code () == TYPE_CODE_STRUCT || type->code () == TYPE_CODE_UNION)
{
int i;
int res = 4;
for (i = 0; i < type->num_fields (); i++)
{
- int align
- = i386_darwin_arg_type_alignment (type->field (i).type ());
+ int align = i386_darwin_arg_type_alignment (type->field (i).type ());
res = std::max (res, align);
}
@@ -190,14 +187,15 @@ i386_darwin_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
if (write_pass)
{
const gdb_byte *val = value_contents_all (args[i]).data ();
- regcache->raw_write (I387_MM0_REGNUM(tdep) + num_m128, val);
+ regcache->raw_write (I387_MM0_REGNUM (tdep) + num_m128, val);
}
num_m128++;
}
else
{
- args_space = align_up (args_space,
- i386_darwin_arg_type_alignment (arg_type));
+ args_space
+ = align_up (args_space,
+ i386_darwin_arg_type_alignment (arg_type));
if (write_pass)
write_memory (sp + args_space,
value_contents_all (args[i]).data (),
@@ -279,7 +277,7 @@ i386_mach_o_osabi_sniffer (bfd *abfd)
{
if (!bfd_check_format (abfd, bfd_object))
return GDB_OSABI_UNKNOWN;
-
+
if (bfd_get_arch (abfd) == bfd_arch_i386)
return GDB_OSABI_DARWIN;
@@ -287,12 +285,13 @@ i386_mach_o_osabi_sniffer (bfd *abfd)
}
void _initialize_i386_darwin_tdep ();
+
void
_initialize_i386_darwin_tdep ()
{
gdbarch_register_osabi_sniffer (bfd_arch_unknown, bfd_target_mach_o_flavour,
i386_mach_o_osabi_sniffer);
- gdbarch_register_osabi (bfd_arch_i386, bfd_mach_i386_i386,
- GDB_OSABI_DARWIN, i386_darwin_init_abi);
+ gdbarch_register_osabi (bfd_arch_i386, bfd_mach_i386_i386, GDB_OSABI_DARWIN,
+ i386_darwin_init_abi);
}
diff --git a/gdb/i386-dicos-tdep.c b/gdb/i386-dicos-tdep.c
index 1a7e4ffe868..a47048f126e 100644
--- a/gdb/i386-dicos-tdep.c
+++ b/gdb/i386-dicos-tdep.c
@@ -42,6 +42,7 @@ i386_dicos_osabi_sniffer (bfd *abfd)
}
void _initialize_i386_dicos_tdep ();
+
void
_initialize_i386_dicos_tdep ()
{
diff --git a/gdb/i386-fbsd-nat.c b/gdb/i386-fbsd-nat.c
index 927771e8b20..74acacd4a4b 100644
--- a/gdb/i386-fbsd-nat.c
+++ b/gdb/i386-fbsd-nat.c
@@ -37,6 +37,7 @@
class i386_fbsd_nat_target final : public x86_fbsd_nat_target
{
public:
+
void fetch_registers (struct regcache *, int) override;
void store_registers (struct regcache *, int) override;
@@ -75,7 +76,7 @@ i386_fbsd_nat_target::fetch_registers (struct regcache *regcache, int regnum)
register_t base;
if (ptrace (PT_GETFSBASE, pid, (PTRACE_TYPE_ARG3) &base, 0) == -1)
- perror_with_name (_("Couldn't get segment register fs_base"));
+ perror_with_name (_ ("Couldn't get segment register fs_base"));
regcache->raw_supply (I386_FSBASE_REGNUM, &base);
if (regnum != -1)
@@ -88,7 +89,7 @@ i386_fbsd_nat_target::fetch_registers (struct regcache *regcache, int regnum)
register_t base;
if (ptrace (PT_GETGSBASE, pid, (PTRACE_TYPE_ARG3) &base, 0) == -1)
- perror_with_name (_("Couldn't get segment register gs_base"));
+ perror_with_name (_ ("Couldn't get segment register gs_base"));
regcache->raw_supply (I386_GSBASE_REGNUM, &base);
if (regnum != -1)
@@ -96,7 +97,7 @@ i386_fbsd_nat_target::fetch_registers (struct regcache *regcache, int regnum)
}
#endif
- /* There is no i386_fxsave_supplies or i386_xsave_supplies.
+ /* There is no i386_fxsave_supplies or i386_xsave_supplies.
Instead, the earlier register sets return early if the request
was for a specific register that was already satisified to avoid
fetching the FPU/XSAVE state unnecessarily. */
@@ -107,7 +108,7 @@ i386_fbsd_nat_target::fetch_registers (struct regcache *regcache, int regnum)
void *xstateregs = alloca (xsave_len);
if (ptrace (PT_GETXSTATE, pid, (PTRACE_TYPE_ARG3) xstateregs, 0) == -1)
- perror_with_name (_("Couldn't get extended state status"));
+ perror_with_name (_ ("Couldn't get extended state status"));
i387_supply_xsave (regcache, regnum, xstateregs);
return;
@@ -117,8 +118,8 @@ i386_fbsd_nat_target::fetch_registers (struct regcache *regcache, int regnum)
{
char xmmregs[I387_SIZEOF_FXSAVE];
- if (ptrace(PT_GETXMMREGS, pid, (PTRACE_TYPE_ARG3) xmmregs, 0) == -1)
- perror_with_name (_("Couldn't get XMM registers"));
+ if (ptrace (PT_GETXMMREGS, pid, (PTRACE_TYPE_ARG3) xmmregs, 0) == -1)
+ perror_with_name (_ ("Couldn't get XMM registers"));
i387_supply_fxsave (regcache, regnum, xmmregs);
return;
@@ -127,7 +128,7 @@ i386_fbsd_nat_target::fetch_registers (struct regcache *regcache, int regnum)
struct fpreg fpregs;
if (ptrace (PT_GETFPREGS, pid, (PTRACE_TYPE_ARG3) &fpregs, 0) == -1)
- perror_with_name (_("Couldn't get floating point status"));
+ perror_with_name (_ ("Couldn't get floating point status"));
i387_supply_fsave (regcache, regnum, &fpregs);
}
@@ -156,7 +157,7 @@ i386_fbsd_nat_target::store_registers (struct regcache *regcache, int regnum)
regcache->raw_collect (I386_FSBASE_REGNUM, &base);
if (ptrace (PT_SETFSBASE, pid, (PTRACE_TYPE_ARG3) &base, 0) == -1)
- perror_with_name (_("Couldn't write segment register fs_base"));
+ perror_with_name (_ ("Couldn't write segment register fs_base"));
if (regnum != -1)
return;
}
@@ -169,13 +170,13 @@ i386_fbsd_nat_target::store_registers (struct regcache *regcache, int regnum)
regcache->raw_collect (I386_GSBASE_REGNUM, &base);
if (ptrace (PT_SETGSBASE, pid, (PTRACE_TYPE_ARG3) &base, 0) == -1)
- perror_with_name (_("Couldn't write segment register gs_base"));
+ perror_with_name (_ ("Couldn't write segment register gs_base"));
if (regnum != -1)
return;
}
#endif
- /* There is no i386_fxsave_supplies or i386_xsave_supplies.
+ /* There is no i386_fxsave_supplies or i386_xsave_supplies.
Instead, the earlier register sets return early if the request
was for a specific register that was already satisified to avoid
fetching the FPU/XSAVE state unnecessarily. */
@@ -186,13 +187,13 @@ i386_fbsd_nat_target::store_registers (struct regcache *regcache, int regnum)
void *xstateregs = alloca (xsave_len);
if (ptrace (PT_GETXSTATE, pid, (PTRACE_TYPE_ARG3) xstateregs, 0) == -1)
- perror_with_name (_("Couldn't get extended state status"));
+ perror_with_name (_ ("Couldn't get extended state status"));
i387_collect_xsave (regcache, regnum, xstateregs, 0);
if (ptrace (PT_SETXSTATE, pid, (PTRACE_TYPE_ARG3) xstateregs, xsave_len)
== -1)
- perror_with_name (_("Couldn't write extended state status"));
+ perror_with_name (_ ("Couldn't write extended state status"));
return;
}
#endif
@@ -200,25 +201,25 @@ i386_fbsd_nat_target::store_registers (struct regcache *regcache, int regnum)
{
char xmmregs[I387_SIZEOF_FXSAVE];
- if (ptrace(PT_GETXMMREGS, pid, (PTRACE_TYPE_ARG3) xmmregs, 0) == -1)
- perror_with_name (_("Couldn't get XMM registers"));
+ if (ptrace (PT_GETXMMREGS, pid, (PTRACE_TYPE_ARG3) xmmregs, 0) == -1)
+ perror_with_name (_ ("Couldn't get XMM registers"));
i387_collect_fxsave (regcache, regnum, xmmregs);
if (ptrace (PT_SETXMMREGS, pid, (PTRACE_TYPE_ARG3) xmmregs, 0) == -1)
- perror_with_name (_("Couldn't write XMM registers"));
+ perror_with_name (_ ("Couldn't write XMM registers"));
return;
}
struct fpreg fpregs;
if (ptrace (PT_GETFPREGS, pid, (PTRACE_TYPE_ARG3) &fpregs, 0) == -1)
- perror_with_name (_("Couldn't get floating point status"));
+ perror_with_name (_ ("Couldn't get floating point status"));
i387_collect_fsave (regcache, regnum, &fpregs);
if (ptrace (PT_SETFPREGS, pid, (PTRACE_TYPE_ARG3) &fpregs, 0) == -1)
- perror_with_name (_("Couldn't write floating point status"));
+ perror_with_name (_ ("Couldn't write floating point status"));
}
/* Resume execution of the inferior process. If STEP is nonzero,
@@ -251,8 +252,7 @@ i386_fbsd_nat_target::resume (ptid_t ptid, int step, enum gdb_signal signal)
never goes through the kernel's trap() function which would
normally clear it. */
- regcache_cooked_read_unsigned (regcache, I386_EFLAGS_REGNUM,
- &eflags);
+ regcache_cooked_read_unsigned (regcache, I386_EFLAGS_REGNUM, &eflags);
if (eflags & 0x0100)
regcache_cooked_write_unsigned (regcache, I386_EFLAGS_REGNUM,
eflags & ~0x0100);
@@ -263,11 +263,9 @@ i386_fbsd_nat_target::resume (ptid_t ptid, int step, enum gdb_signal signal)
/* An addres of (caddr_t) 1 tells ptrace to continue from where it
was. (If GDB wanted it to start some other way, we have already
written a new PC value to the child.) */
- if (ptrace (request, pid, (caddr_t) 1,
- gdb_signal_to_host (signal)) == -1)
+ if (ptrace (request, pid, (caddr_t) 1, gdb_signal_to_host (signal)) == -1)
perror_with_name (("ptrace"));
}
-
/* Support for debugging kernel virtual memory images. */
@@ -302,7 +300,6 @@ i386fbsd_supply_pcb (struct regcache *regcache, struct pcb *pcb)
return 1;
}
-
/* Implement the read_description method. */
@@ -321,7 +318,8 @@ i386_fbsd_nat_target::read_description ()
struct ptrace_xstate_info info;
if (ptrace (PT_GETXSTATE_INFO, inferior_ptid.pid (),
- (PTRACE_TYPE_ARG3) &info, sizeof (info)) == 0)
+ (PTRACE_TYPE_ARG3) &info, sizeof (info))
+ == 0)
{
xsave_len = info.xsave_len;
xcr0 = info.xsave_mask;
@@ -338,7 +336,8 @@ i386_fbsd_nat_target::read_description ()
char xmmregs[I387_SIZEOF_FXSAVE];
if (ptrace (PT_GETXMMREGS, inferior_ptid.pid (),
- (PTRACE_TYPE_ARG3) xmmregs, 0) == 0)
+ (PTRACE_TYPE_ARG3) xmmregs, 0)
+ == 0)
have_ptrace_xmmregs = 1;
xmm_probed = 1;
}
@@ -350,6 +349,7 @@ i386_fbsd_nat_target::read_description ()
}
void _initialize_i386fbsd_nat ();
+
void
_initialize_i386fbsd_nat ()
{
diff --git a/gdb/i386-fbsd-tdep.c b/gdb/i386-fbsd-tdep.c
index 3719a69845c..a7d61ccf24c 100644
--- a/gdb/i386-fbsd-tdep.c
+++ b/gdb/i386-fbsd-tdep.c
@@ -33,90 +33,79 @@
#include "inferior.h"
/* The general-purpose regset consists of 19 32-bit slots. */
-#define I386_FBSD_SIZEOF_GREGSET (19 * 4)
+#define I386_FBSD_SIZEOF_GREGSET (19 * 4)
/* The segment base register set consists of 2 32-bit registers. */
-#define I386_FBSD_SIZEOF_SEGBASES_REGSET (2 * 4)
+#define I386_FBSD_SIZEOF_SEGBASES_REGSET (2 * 4)
/* Register maps. */
-static const struct regcache_map_entry i386_fbsd_gregmap[] =
-{
- { 1, I386_FS_REGNUM, 4 },
- { 1, I386_ES_REGNUM, 4 },
- { 1, I386_DS_REGNUM, 4 },
- { 1, I386_EDI_REGNUM, 0 },
- { 1, I386_ESI_REGNUM, 0 },
- { 1, I386_EBP_REGNUM, 0 },
- { 1, REGCACHE_MAP_SKIP, 4 }, /* isp */
- { 1, I386_EBX_REGNUM, 0 },
- { 1, I386_EDX_REGNUM, 0 },
- { 1, I386_ECX_REGNUM, 0 },
- { 1, I386_EAX_REGNUM, 0 },
- { 1, REGCACHE_MAP_SKIP, 4 }, /* trapno */
- { 1, REGCACHE_MAP_SKIP, 4 }, /* err */
- { 1, I386_EIP_REGNUM, 0 },
- { 1, I386_CS_REGNUM, 4 },
- { 1, I386_EFLAGS_REGNUM, 0 },
- { 1, I386_ESP_REGNUM, 0 },
- { 1, I386_SS_REGNUM, 4 },
- { 1, I386_GS_REGNUM, 4 },
- { 0 }
-};
-
-static const struct regcache_map_entry i386_fbsd_segbases_regmap[] =
-{
- { 1, I386_FSBASE_REGNUM, 0 },
- { 1, I386_GSBASE_REGNUM, 0 },
- { 0 }
-};
+static const struct regcache_map_entry i386_fbsd_gregmap[]
+ = { { 1, I386_FS_REGNUM, 4 },
+ { 1, I386_ES_REGNUM, 4 },
+ { 1, I386_DS_REGNUM, 4 },
+ { 1, I386_EDI_REGNUM, 0 },
+ { 1, I386_ESI_REGNUM, 0 },
+ { 1, I386_EBP_REGNUM, 0 },
+ { 1, REGCACHE_MAP_SKIP, 4 }, /* isp */
+ { 1, I386_EBX_REGNUM, 0 },
+ { 1, I386_EDX_REGNUM, 0 },
+ { 1, I386_ECX_REGNUM, 0 },
+ { 1, I386_EAX_REGNUM, 0 },
+ { 1, REGCACHE_MAP_SKIP, 4 }, /* trapno */
+ { 1, REGCACHE_MAP_SKIP, 4 }, /* err */
+ { 1, I386_EIP_REGNUM, 0 },
+ { 1, I386_CS_REGNUM, 4 },
+ { 1, I386_EFLAGS_REGNUM, 0 },
+ { 1, I386_ESP_REGNUM, 0 },
+ { 1, I386_SS_REGNUM, 4 },
+ { 1, I386_GS_REGNUM, 4 },
+ { 0 } };
+
+static const struct regcache_map_entry i386_fbsd_segbases_regmap[]
+ = { { 1, I386_FSBASE_REGNUM, 0 }, { 1, I386_GSBASE_REGNUM, 0 }, { 0 } };
/* This layout including fsbase and gsbase was adopted in FreeBSD
8.0. */
-static const struct regcache_map_entry i386_fbsd_mcregmap[] =
-{
- { 1, REGCACHE_MAP_SKIP, 4 }, /* mc_onstack */
- { 1, I386_GS_REGNUM, 4 },
- { 1, I386_FS_REGNUM, 4 },
- { 1, I386_ES_REGNUM, 4 },
- { 1, I386_DS_REGNUM, 4 },
- { 1, I386_EDI_REGNUM, 0 },
- { 1, I386_ESI_REGNUM, 0 },
- { 1, I386_EBP_REGNUM, 0 },
- { 1, REGCACHE_MAP_SKIP, 4 }, /* isp */
- { 1, I386_EBX_REGNUM, 0 },
- { 1, I386_EDX_REGNUM, 0 },
- { 1, I386_ECX_REGNUM, 0 },
- { 1, I386_EAX_REGNUM, 0 },
- { 1, REGCACHE_MAP_SKIP, 4 }, /* mc_trapno */
- { 1, REGCACHE_MAP_SKIP, 4 }, /* mc_err */
- { 1, I386_EIP_REGNUM, 0 },
- { 1, I386_CS_REGNUM, 4 },
- { 1, I386_EFLAGS_REGNUM, 0 },
- { 1, I386_ESP_REGNUM, 0 },
- { 1, I386_SS_REGNUM, 4 },
- { 1, REGCACHE_MAP_SKIP, 4 }, /* mc_len */
- { 1, REGCACHE_MAP_SKIP, 4 }, /* mc_fpformat */
- { 1, REGCACHE_MAP_SKIP, 4 }, /* mc_ownedfp */
- { 1, REGCACHE_MAP_SKIP, 4 }, /* mc_flags */
- { 128, REGCACHE_MAP_SKIP, 4 },/* mc_fpstate */
- { 1, I386_FSBASE_REGNUM, 0 },
- { 1, I386_GSBASE_REGNUM, 0 },
- { 0 }
-};
+static const struct regcache_map_entry i386_fbsd_mcregmap[]
+ = { { 1, REGCACHE_MAP_SKIP, 4 }, /* mc_onstack */
+ { 1, I386_GS_REGNUM, 4 },
+ { 1, I386_FS_REGNUM, 4 },
+ { 1, I386_ES_REGNUM, 4 },
+ { 1, I386_DS_REGNUM, 4 },
+ { 1, I386_EDI_REGNUM, 0 },
+ { 1, I386_ESI_REGNUM, 0 },
+ { 1, I386_EBP_REGNUM, 0 },
+ { 1, REGCACHE_MAP_SKIP, 4 }, /* isp */
+ { 1, I386_EBX_REGNUM, 0 },
+ { 1, I386_EDX_REGNUM, 0 },
+ { 1, I386_ECX_REGNUM, 0 },
+ { 1, I386_EAX_REGNUM, 0 },
+ { 1, REGCACHE_MAP_SKIP, 4 }, /* mc_trapno */
+ { 1, REGCACHE_MAP_SKIP, 4 }, /* mc_err */
+ { 1, I386_EIP_REGNUM, 0 },
+ { 1, I386_CS_REGNUM, 4 },
+ { 1, I386_EFLAGS_REGNUM, 0 },
+ { 1, I386_ESP_REGNUM, 0 },
+ { 1, I386_SS_REGNUM, 4 },
+ { 1, REGCACHE_MAP_SKIP, 4 }, /* mc_len */
+ { 1, REGCACHE_MAP_SKIP, 4 }, /* mc_fpformat */
+ { 1, REGCACHE_MAP_SKIP, 4 }, /* mc_ownedfp */
+ { 1, REGCACHE_MAP_SKIP, 4 }, /* mc_flags */
+ { 128, REGCACHE_MAP_SKIP, 4 }, /* mc_fpstate */
+ { 1, I386_FSBASE_REGNUM, 0 },
+ { 1, I386_GSBASE_REGNUM, 0 },
+ { 0 } };
/* Register set definitions. */
-const struct regset i386_fbsd_gregset =
-{
- i386_fbsd_gregmap, regcache_supply_regset, regcache_collect_regset
-};
+const struct regset i386_fbsd_gregset
+ = { i386_fbsd_gregmap, regcache_supply_regset, regcache_collect_regset };
-const struct regset i386_fbsd_segbases_regset =
-{
- i386_fbsd_segbases_regmap, regcache_supply_regset, regcache_collect_regset
-};
+const struct regset i386_fbsd_segbases_regset
+ = { i386_fbsd_segbases_regmap, regcache_supply_regset,
+ regcache_collect_regset };
/* Support for signal handlers. */
@@ -148,23 +137,20 @@ const struct regset i386_fbsd_segbases_regset =
as the floating point or XSAVE state. */
/* NB: There is a 12 byte padding hole between sf_ahu and sf_uc. */
-#define I386_SIGFRAME_UCONTEXT_OFFSET 32
-#define I386_UCONTEXT_MCONTEXT_OFFSET 16
-#define I386_SIZEOF_MCONTEXT_T 640
+#define I386_SIGFRAME_UCONTEXT_OFFSET 32
+#define I386_UCONTEXT_MCONTEXT_OFFSET 16
+#define I386_SIZEOF_MCONTEXT_T 640
/* Implement the "init" method of struct tramp_frame. */
static void
i386_fbsd_sigframe_init (const struct tramp_frame *self,
frame_info_ptr this_frame,
- struct trad_frame_cache *this_cache,
- CORE_ADDR func)
+ struct trad_frame_cache *this_cache, CORE_ADDR func)
{
CORE_ADDR sp = get_frame_register_unsigned (this_frame, I386_ESP_REGNUM);
CORE_ADDR mcontext_addr
- = (sp
- + I386_SIGFRAME_UCONTEXT_OFFSET
- + I386_UCONTEXT_MCONTEXT_OFFSET);
+ = (sp + I386_SIGFRAME_UCONTEXT_OFFSET + I386_UCONTEXT_MCONTEXT_OFFSET);
trad_frame_set_reg_regmap (this_cache, i386_fbsd_mcregmap, mcontext_addr,
I386_SIZEOF_MCONTEXT_T);
@@ -178,68 +164,60 @@ i386_fbsd_sigframe_init (const struct tramp_frame *self,
trad_frame_set_id (this_cache, frame_id_build (sp, func));
}
-static const struct tramp_frame i386_fbsd_sigframe =
-{
- SIGTRAMP_FRAME,
- 1,
- {
- {0x8d, ULONGEST_MAX}, /* lea SIGF_UC(%esp),%eax */
- {0x44, ULONGEST_MAX},
- {0x24, ULONGEST_MAX},
- {0x20, ULONGEST_MAX},
- {0x50, ULONGEST_MAX}, /* pushl %eax */
- {0xf7, ULONGEST_MAX}, /* testl $PSL_VM,UC_EFLAGS(%eax) */
- {0x40, ULONGEST_MAX},
- {0x54, ULONGEST_MAX},
- {0x00, ULONGEST_MAX},
- {0x00, ULONGEST_MAX},
- {0x02, ULONGEST_MAX},
- {0x00, ULONGEST_MAX},
- {0x75, ULONGEST_MAX}, /* jne +3 */
- {0x03, ULONGEST_MAX},
- {0x8e, ULONGEST_MAX}, /* mov UC_GS(%eax),%gs */
- {0x68, ULONGEST_MAX},
- {0x14, ULONGEST_MAX},
- {0xb8, ULONGEST_MAX}, /* movl $SYS_sigreturn,%eax */
- {0xa1, ULONGEST_MAX},
- {0x01, ULONGEST_MAX},
- {0x00, ULONGEST_MAX},
- {0x00, ULONGEST_MAX},
- {0x50, ULONGEST_MAX}, /* pushl %eax */
- {0xcd, ULONGEST_MAX}, /* int $0x80 */
- {0x80, ULONGEST_MAX},
- {TRAMP_SENTINEL_INSN, ULONGEST_MAX}
- },
- i386_fbsd_sigframe_init
-};
+static const struct tramp_frame i386_fbsd_sigframe
+ = { SIGTRAMP_FRAME,
+ 1,
+ { { 0x8d, ULONGEST_MAX }, /* lea SIGF_UC(%esp),%eax */
+ { 0x44, ULONGEST_MAX },
+ { 0x24, ULONGEST_MAX },
+ { 0x20, ULONGEST_MAX },
+ { 0x50, ULONGEST_MAX }, /* pushl %eax */
+ { 0xf7, ULONGEST_MAX }, /* testl $PSL_VM,UC_EFLAGS(%eax) */
+ { 0x40, ULONGEST_MAX },
+ { 0x54, ULONGEST_MAX },
+ { 0x00, ULONGEST_MAX },
+ { 0x00, ULONGEST_MAX },
+ { 0x02, ULONGEST_MAX },
+ { 0x00, ULONGEST_MAX },
+ { 0x75, ULONGEST_MAX }, /* jne +3 */
+ { 0x03, ULONGEST_MAX },
+ { 0x8e, ULONGEST_MAX }, /* mov UC_GS(%eax),%gs */
+ { 0x68, ULONGEST_MAX },
+ { 0x14, ULONGEST_MAX },
+ { 0xb8, ULONGEST_MAX }, /* movl $SYS_sigreturn,%eax */
+ { 0xa1, ULONGEST_MAX },
+ { 0x01, ULONGEST_MAX },
+ { 0x00, ULONGEST_MAX },
+ { 0x00, ULONGEST_MAX },
+ { 0x50, ULONGEST_MAX }, /* pushl %eax */
+ { 0xcd, ULONGEST_MAX }, /* int $0x80 */
+ { 0x80, ULONGEST_MAX },
+ { TRAMP_SENTINEL_INSN, ULONGEST_MAX } },
+ i386_fbsd_sigframe_init };
/* FreeBSD/i386 binaries running under an amd64 kernel use a different
trampoline. This trampoline differs from the i386 kernel trampoline
in that it omits a middle section that conditionally restores
%gs. */
-static const struct tramp_frame i386_fbsd64_sigframe =
-{
- SIGTRAMP_FRAME,
- 1,
- {
- {0x8d, ULONGEST_MAX}, /* lea SIGF_UC(%esp),%eax */
- {0x44, ULONGEST_MAX},
- {0x24, ULONGEST_MAX},
- {0x20, ULONGEST_MAX},
- {0x50, ULONGEST_MAX}, /* pushl %eax */
- {0xb8, ULONGEST_MAX}, /* movl $SYS_sigreturn,%eax */
- {0xa1, ULONGEST_MAX},
- {0x01, ULONGEST_MAX},
- {0x00, ULONGEST_MAX},
- {0x00, ULONGEST_MAX},
- {0x50, ULONGEST_MAX}, /* pushl %eax */
- {0xcd, ULONGEST_MAX}, /* int $0x80 */
- {0x80, ULONGEST_MAX},
- {TRAMP_SENTINEL_INSN, ULONGEST_MAX}
- },
- i386_fbsd_sigframe_init
-};
+static const struct tramp_frame i386_fbsd64_sigframe
+ = { SIGTRAMP_FRAME,
+ 1,
+ { { 0x8d, ULONGEST_MAX }, /* lea SIGF_UC(%esp),%eax */
+ { 0x44, ULONGEST_MAX },
+ { 0x24, ULONGEST_MAX },
+ { 0x20, ULONGEST_MAX },
+ { 0x50, ULONGEST_MAX }, /* pushl %eax */
+ { 0xb8, ULONGEST_MAX }, /* movl $SYS_sigreturn,%eax */
+ { 0xa1, ULONGEST_MAX },
+ { 0x01, ULONGEST_MAX },
+ { 0x00, ULONGEST_MAX },
+ { 0x00, ULONGEST_MAX },
+ { 0x50, ULONGEST_MAX }, /* pushl %eax */
+ { 0xcd, ULONGEST_MAX }, /* int $0x80 */
+ { 0x80, ULONGEST_MAX },
+ { TRAMP_SENTINEL_INSN, ULONGEST_MAX } },
+ i386_fbsd_sigframe_init };
/* Get XSAVE extended state xcr0 from core dump. */
@@ -260,12 +238,11 @@ i386fbsd_core_read_xcr0 (bfd *abfd)
{
char contents[8];
- if (! bfd_get_section_contents (abfd, xstate, contents,
- I386_FBSD_XSAVE_XCR0_OFFSET,
- 8))
+ if (!bfd_get_section_contents (abfd, xstate, contents,
+ I386_FBSD_XSAVE_XCR0_OFFSET, 8))
{
- warning (_("Couldn't read `xcr0' bytes from "
- "`.reg-xstate' section in core file."));
+ warning (_ ("Couldn't read `xcr0' bytes from "
+ "`.reg-xstate' section in core file."));
return X86_XSTATE_SSE_MASK;
}
@@ -282,8 +259,7 @@ i386fbsd_core_read_xcr0 (bfd *abfd)
static const struct target_desc *
i386fbsd_core_read_description (struct gdbarch *gdbarch,
- struct target_ops *target,
- bfd *abfd)
+ struct target_ops *target, bfd *abfd)
{
return i386_target_description (i386fbsd_core_read_xcr0 (abfd), true);
}
@@ -302,20 +278,16 @@ i386fbsd_supply_xstateregset (const struct regset *regset,
static void
i386fbsd_collect_xstateregset (const struct regset *regset,
- const struct regcache *regcache,
- int regnum, void *xstateregs, size_t len)
+ const struct regcache *regcache, int regnum,
+ void *xstateregs, size_t len)
{
i387_collect_xsave (regcache, regnum, xstateregs, 1);
}
/* Register set definitions. */
-static const struct regset i386fbsd_xstateregset =
- {
- NULL,
- i386fbsd_supply_xstateregset,
- i386fbsd_collect_xstateregset
- };
+static const struct regset i386fbsd_xstateregset
+ = { NULL, i386fbsd_supply_xstateregset, i386fbsd_collect_xstateregset };
/* Iterate over core file register note sections. */
@@ -356,7 +328,7 @@ i386fbsd_get_thread_local_address (struct gdbarch *gdbarch, ptid_t ptid,
ULONGEST gsbase;
if (regcache->cooked_read (I386_GSBASE_REGNUM, &gsbase) != REG_VALID)
- error (_("Unable to fetch %%gsbase"));
+ error (_ ("Unable to fetch %%gsbase"));
CORE_ADDR dtv_addr = gsbase + gdbarch_ptr_bit (gdbarch) / 8;
return fbsd_get_thread_local_address (gdbarch, dtv_addr, lm_addr, offset);
@@ -388,15 +360,14 @@ i386fbsd_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
tdep->xsave_xcr0_offset = I386_FBSD_XSAVE_XCR0_OFFSET;
/* Iterate over core file register note sections. */
- set_gdbarch_iterate_over_regset_sections
- (gdbarch, i386fbsd_iterate_over_regset_sections);
+ set_gdbarch_iterate_over_regset_sections (
+ gdbarch, i386fbsd_iterate_over_regset_sections);
- set_gdbarch_core_read_description (gdbarch,
- i386fbsd_core_read_description);
+ set_gdbarch_core_read_description (gdbarch, i386fbsd_core_read_description);
/* FreeBSD uses SVR4-style shared libraries. */
- set_solib_svr4_fetch_link_map_offsets
- (gdbarch, svr4_ilp32_fetch_link_map_offsets);
+ set_solib_svr4_fetch_link_map_offsets (gdbarch,
+ svr4_ilp32_fetch_link_map_offsets);
set_gdbarch_fetch_tls_load_module_address (gdbarch,
svr4_fetch_objfile_link_map);
@@ -405,6 +376,7 @@ i386fbsd_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
}
void _initialize_i386fbsd_tdep ();
+
void
_initialize_i386fbsd_tdep ()
{
diff --git a/gdb/i386-gnu-nat.c b/gdb/i386-gnu-nat.c
index 03093bee7b7..67e5d7b0790 100644
--- a/gdb/i386-gnu-nat.c
+++ b/gdb/i386-gnu-nat.c
@@ -45,17 +45,13 @@ extern "C"
/* At REG_OFFSET[N] is the offset to the thread_state_t location where
the GDB register N is stored. */
-static int reg_offset[] =
-{
- REG_OFFSET (eax), REG_OFFSET (ecx), REG_OFFSET (edx), REG_OFFSET (ebx),
- REG_OFFSET (uesp), REG_OFFSET (ebp), REG_OFFSET (esi), REG_OFFSET (edi),
- REG_OFFSET (eip), REG_OFFSET (efl), REG_OFFSET (cs), REG_OFFSET (ss),
- REG_OFFSET (ds), REG_OFFSET (es), REG_OFFSET (fs), REG_OFFSET (gs)
-};
+static int reg_offset[]
+ = { REG_OFFSET (eax), REG_OFFSET (ecx), REG_OFFSET (edx), REG_OFFSET (ebx),
+ REG_OFFSET (uesp), REG_OFFSET (ebp), REG_OFFSET (esi), REG_OFFSET (edi),
+ REG_OFFSET (eip), REG_OFFSET (efl), REG_OFFSET (cs), REG_OFFSET (ss),
+ REG_OFFSET (ds), REG_OFFSET (es), REG_OFFSET (fs), REG_OFFSET (gs) };
-#define REG_ADDR(state, regnum) ((char *)(state) + reg_offset[regnum])
-
-
+#define REG_ADDR(state, regnum) ((char *) (state) + reg_offset[regnum])
/* The i386 GNU Hurd target. */
@@ -87,7 +83,7 @@ fetch_fpregs (struct regcache *regcache, struct proc *thread)
(thread_state_t) &state, &count);
if (err)
{
- warning (_("Couldn't fetch floating-point state from %s"),
+ warning (_ ("Couldn't fetch floating-point state from %s"),
proc_string (thread));
return;
}
@@ -116,7 +112,7 @@ i386_gnu_nat_target::fetch_registers (struct regcache *regcache, int regno)
thread = inf_tid_to_thread (gnu_current_inf, ptid.lwp ());
if (!thread)
- error (_("Can't fetch registers from thread %s: No such thread"),
+ error (_ ("Can't fetch registers from thread %s: No such thread"),
target_pid_to_str (ptid).c_str ());
if (regno < I386_NUM_GREGS || regno == -1)
@@ -127,7 +123,7 @@ i386_gnu_nat_target::fetch_registers (struct regcache *regcache, int regno)
state = proc_get_state (thread, 0);
if (!state)
{
- warning (_("Couldn't fetch registers from %s"),
+ warning (_ ("Couldn't fetch registers from %s"),
proc_string (thread));
return;
}
@@ -145,8 +141,7 @@ i386_gnu_nat_target::fetch_registers (struct regcache *regcache, int regno)
else
{
proc_debug (thread, "fetching register %s",
- gdbarch_register_name (regcache->arch (),
- regno));
+ gdbarch_register_name (regcache->arch (), regno));
regcache->raw_supply (regno, REG_ADDR (state, regno));
thread->fetched_regs |= (1 << regno);
@@ -160,7 +155,6 @@ i386_gnu_nat_target::fetch_registers (struct regcache *regcache, int regno)
fetch_fpregs (regcache, thread);
}
}
-
/* Store the whole floating-point state into THREAD using information
from the corresponding (pseudo) registers. */
@@ -175,7 +169,7 @@ store_fpregs (const struct regcache *regcache, struct proc *thread, int regno)
(thread_state_t) &state, &count);
if (err)
{
- warning (_("Couldn't fetch floating-point state from %s"),
+ warning (_ ("Couldn't fetch floating-point state from %s"),
proc_string (thread));
return;
}
@@ -188,7 +182,7 @@ store_fpregs (const struct regcache *regcache, struct proc *thread, int regno)
(thread_state_t) &state, i386_FLOAT_STATE_COUNT);
if (err)
{
- warning (_("Couldn't store floating-point state into %s"),
+ warning (_ ("Couldn't store floating-point state into %s"),
proc_string (thread));
return;
}
@@ -207,7 +201,7 @@ i386_gnu_nat_target::store_registers (struct regcache *regcache, int regno)
thread = inf_tid_to_thread (gnu_current_inf, ptid.lwp ());
if (!thread)
- error (_("Couldn't store registers into thread %s: No such thread"),
+ error (_ ("Couldn't store registers into thread %s: No such thread"),
target_pid_to_str (ptid).c_str ());
if (regno < I386_NUM_GREGS || regno == -1)
@@ -224,14 +218,14 @@ i386_gnu_nat_target::store_registers (struct regcache *regcache, int regno)
state = proc_get_state (thread, 1);
if (!state)
{
- warning (_("Couldn't store registers into %s"),
+ warning (_ ("Couldn't store registers into %s"),
proc_string (thread));
return;
}
/* Save the T bit. We might try to restore the %eflags register
below, but changing the T bit would seriously confuse GDB. */
- trace = ((struct i386_thread_state *)state)->efl & 0x100;
+ trace = ((struct i386_thread_state *) state)->efl & 0x100;
if (!was_aborted && was_valid)
/* See which registers have changed after aborting the thread. */
@@ -245,15 +239,16 @@ i386_gnu_nat_target::store_registers (struct regcache *regcache, int regno)
register_size (gdbarch, check_regno)))
/* Register CHECK_REGNO has changed! Ack! */
{
- warning (_("Register %s changed after the thread was aborted"),
- gdbarch_register_name (gdbarch, check_regno));
+ warning (
+ _ ("Register %s changed after the thread was aborted"),
+ gdbarch_register_name (gdbarch, check_regno));
if (regno >= 0 && regno != check_regno)
/* Update GDB's copy of the register. */
regcache->raw_supply (check_regno,
REG_ADDR (state, check_regno));
else
- warning (_("... also writing this register! "
- "Suspicious..."));
+ warning (_ ("... also writing this register! "
+ "Suspicious..."));
}
}
@@ -277,8 +272,8 @@ i386_gnu_nat_target::store_registers (struct regcache *regcache, int regno)
}
/* Restore the T bit. */
- ((struct i386_thread_state *)state)->efl &= ~0x100;
- ((struct i386_thread_state *)state)->efl |= trace;
+ ((struct i386_thread_state *) state)->efl &= ~0x100;
+ ((struct i386_thread_state *) state)->efl |= trace;
}
if (regno >= I386_NUM_GREGS || regno == -1)
@@ -289,7 +284,6 @@ i386_gnu_nat_target::store_registers (struct regcache *regcache, int regno)
}
}
-
/* Support for debug registers. */
#ifdef i386_DEBUG_STATE
@@ -304,8 +298,7 @@ i386_gnu_dr_get (struct i386_debug_state *regs, struct proc *thread)
err = thread_get_state (thread->port, i386_DEBUG_STATE,
(thread_state_t) regs, &count);
if (err != 0 || count != i386_DEBUG_STATE_COUNT)
- warning (_("Couldn't fetch debug state from %s"),
- proc_string (thread));
+ warning (_ ("Couldn't fetch debug state from %s"), proc_string (thread));
}
/* Set debug registers for thread THREAD. */
@@ -318,8 +311,7 @@ i386_gnu_dr_set (const struct i386_debug_state *regs, struct proc *thread)
err = thread_set_state (thread->port, i386_DEBUG_STATE,
(thread_state_t) regs, i386_DEBUG_STATE_COUNT);
if (err != 0)
- warning (_("Couldn't store debug state into %s"),
- proc_string (thread));
+ warning (_ ("Couldn't store debug state into %s"), proc_string (thread));
}
/* Set DR_CONTROL in THREAD. */
@@ -348,8 +340,8 @@ i386_gnu_dr_set_control (unsigned long control)
struct reg_addr
{
- int regnum; /* Register number (zero based). */
- CORE_ADDR addr; /* Address. */
+ int regnum; /* Register number (zero based). */
+ CORE_ADDR addr; /* Address. */
};
/* Set address REGNUM (zero based) to ADDR in THREAD. */
@@ -426,6 +418,7 @@ i386_gnu_dr_get_control (void)
#endif /* i386_DEBUG_STATE */
void _initialize_i386gnu_nat ();
+
void
_initialize_i386gnu_nat ()
{
diff --git a/gdb/i386-gnu-tdep.c b/gdb/i386-gnu-tdep.c
index ff212f833d9..292b96bcf42 100644
--- a/gdb/i386-gnu-tdep.c
+++ b/gdb/i386-gnu-tdep.c
@@ -31,26 +31,25 @@
If the trampoline function name can not be identified, we resort to reading
memory from the process in order to identify it. */
-static const gdb_byte gnu_sigtramp_code[] =
-{
-/* rpc_wait_trampoline: */
- 0xb8, 0xe7, 0xff, 0xff, 0xff, /* mov $-25,%eax */
- 0x9a, 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, /* lcall $7,$0 */
- 0x89, 0x01, /* movl %eax, (%ecx) */
- 0x89, 0xdc, /* movl %ebx, %esp */
-
-/* trampoline: */
- 0xff, 0xd2, /* call *%edx */
-/* RA HERE */
- 0x83, 0xc4, 0x0c, /* addl $12, %esp */
- 0xc3, /* ret */
-
-/* firewall: */
- 0xf4, /* hlt */
+static const gdb_byte gnu_sigtramp_code[] = {
+ /* rpc_wait_trampoline: */
+ 0xb8, 0xe7, 0xff, 0xff, 0xff, /* mov $-25,%eax */
+ 0x9a, 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, /* lcall $7,$0 */
+ 0x89, 0x01, /* movl %eax, (%ecx) */
+ 0x89, 0xdc, /* movl %ebx, %esp */
+
+ /* trampoline: */
+ 0xff, 0xd2, /* call *%edx */
+ /* RA HERE */
+ 0x83, 0xc4, 0x0c, /* addl $12, %esp */
+ 0xc3, /* ret */
+
+ /* firewall: */
+ 0xf4, /* hlt */
};
#define GNU_SIGTRAMP_LEN (sizeof gnu_sigtramp_code)
-#define GNU_SIGTRAMP_TAIL 5 /* length of tail after RA */
+#define GNU_SIGTRAMP_TAIL 5 /* length of tail after RA */
/* If THIS_FRAME is a sigtramp routine, return the address of the
start of the routine. Otherwise, return 0. */
@@ -120,7 +119,7 @@ i386_gnu_sigcontext_addr (frame_info_ptr this_frame)
return sigcontext_addr + I386_GNU_SIGCONTEXT_THREAD_STATE_OFFSET;
}
- error (_("Couldn't recognize signal trampoline."));
+ error (_ ("Couldn't recognize signal trampoline."));
return 0;
}
@@ -129,45 +128,43 @@ i386_gnu_sigcontext_addr (frame_info_ptr this_frame)
and GDB's register cache layout. */
/* From <bits/sigcontext.h>. */
-static int i386_gnu_sc_reg_offset[] =
-{
- 11 * 4, /* %eax */
- 10 * 4, /* %ecx */
- 9 * 4, /* %edx */
- 8 * 4, /* %ebx */
- 7 * 4, /* %esp */
- 6 * 4, /* %ebp */
- 5 * 4, /* %esi */
- 4 * 4, /* %edi */
- 12 * 4, /* %eip */
- 14 * 4, /* %eflags */
- 13 * 4, /* %cs */
- 16 * 4, /* %ss */
- 3 * 4, /* %ds */
- 2 * 4, /* %es */
- 1 * 4, /* %fs */
- 0 * 4 /* %gs */
+static int i386_gnu_sc_reg_offset[] = {
+ 11 * 4, /* %eax */
+ 10 * 4, /* %ecx */
+ 9 * 4, /* %edx */
+ 8 * 4, /* %ebx */
+ 7 * 4, /* %esp */
+ 6 * 4, /* %ebp */
+ 5 * 4, /* %esi */
+ 4 * 4, /* %edi */
+ 12 * 4, /* %eip */
+ 14 * 4, /* %eflags */
+ 13 * 4, /* %cs */
+ 16 * 4, /* %ss */
+ 3 * 4, /* %ds */
+ 2 * 4, /* %es */
+ 1 * 4, /* %fs */
+ 0 * 4 /* %gs */
};
/* From <sys/ucontext.h>. */
-static int i386gnu_gregset_reg_offset[] =
-{
- 11 * 4, /* %eax */
- 10 * 4, /* %ecx */
- 9 * 4, /* %edx */
- 8 * 4, /* %ebx */
- 17 * 4, /* %uesp */
- 6 * 4, /* %ebp */
- 5 * 4, /* %esi */
- 4 * 4, /* %edi */
- 14 * 4, /* %eip */
- 16 * 4, /* %efl */
- 15 * 4, /* %cs */
- 18 * 4, /* %ss */
- 3 * 4, /* %ds */
- 2 * 4, /* %es */
- 1 * 4, /* %fs */
- 0 * 4, /* %gs */
+static int i386gnu_gregset_reg_offset[] = {
+ 11 * 4, /* %eax */
+ 10 * 4, /* %ecx */
+ 9 * 4, /* %edx */
+ 8 * 4, /* %ebx */
+ 17 * 4, /* %uesp */
+ 6 * 4, /* %ebp */
+ 5 * 4, /* %esi */
+ 4 * 4, /* %edi */
+ 14 * 4, /* %eip */
+ 16 * 4, /* %efl */
+ 15 * 4, /* %cs */
+ 18 * 4, /* %ss */
+ 3 * 4, /* %ds */
+ 2 * 4, /* %es */
+ 1 * 4, /* %fs */
+ 0 * 4, /* %gs */
};
static void
@@ -178,14 +175,14 @@ i386gnu_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
/* GNU uses ELF. */
i386_elf_init_abi (info, gdbarch);
- set_solib_svr4_fetch_link_map_offsets
- (gdbarch, svr4_ilp32_fetch_link_map_offsets);
+ set_solib_svr4_fetch_link_map_offsets (gdbarch,
+ svr4_ilp32_fetch_link_map_offsets);
tdep->gregset_reg_offset = i386gnu_gregset_reg_offset;
tdep->gregset_num_regs = ARRAY_SIZE (i386gnu_gregset_reg_offset);
tdep->sizeof_gregset = 19 * 4;
- tdep->jb_pc_offset = 20; /* From <bits/setjmp.h>. */
+ tdep->jb_pc_offset = 20; /* From <bits/setjmp.h>. */
tdep->sigtramp_p = i386_gnu_sigtramp_p;
tdep->sigcontext_addr = i386_gnu_sigcontext_addr;
@@ -194,6 +191,7 @@ i386gnu_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
}
void _initialize_i386gnu_tdep ();
+
void
_initialize_i386gnu_tdep ()
{
diff --git a/gdb/i386-go32-tdep.c b/gdb/i386-go32-tdep.c
index dc1ad2ae921..56815c6f4fa 100644
--- a/gdb/i386-go32-tdep.c
+++ b/gdb/i386-go32-tdep.c
@@ -49,7 +49,6 @@ i386_go32_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
set_gdbarch_wchar_bit (gdbarch, 16);
set_gdbarch_wchar_signed (gdbarch, 0);
}
-
static enum gdb_osabi
i386_coff_osabi_sniffer (bfd *abfd)
@@ -60,9 +59,9 @@ i386_coff_osabi_sniffer (bfd *abfd)
return GDB_OSABI_UNKNOWN;
}
-
void _initialize_i386_go32_tdep ();
+
void
_initialize_i386_go32_tdep ()
{
diff --git a/gdb/i386-linux-nat.c b/gdb/i386-linux-nat.c
index a524fdc9a1d..a3995c392b4 100644
--- a/gdb/i386-linux-nat.c
+++ b/gdb/i386-linux-nat.c
@@ -80,7 +80,7 @@ int have_ptrace_getregs =
#else
0
#endif
-;
+ ;
/* Does the current host support the GETFPXREGS request? The header
file may or may not define it, and even if it is defined, the
@@ -96,8 +96,7 @@ int have_ptrace_getfpxregs =
#else
0
#endif
-;
-
+ ;
/* Accessing registers through the U area, one at a time. */
@@ -119,12 +118,11 @@ fetch_register (struct regcache *regcache, int regno)
tid = get_ptrace_pid (regcache->ptid ());
errno = 0;
- val = ptrace (PTRACE_PEEKUSER, tid,
- i386_linux_gregset_reg_offset[regno], 0);
+ val = ptrace (PTRACE_PEEKUSER, tid, i386_linux_gregset_reg_offset[regno], 0);
if (errno != 0)
- error (_("Couldn't read register %s (#%d): %s."),
- gdbarch_register_name (regcache->arch (), regno),
- regno, safe_strerror (errno));
+ error (_ ("Couldn't read register %s (#%d): %s."),
+ gdbarch_register_name (regcache->arch (), regno), regno,
+ safe_strerror (errno));
regcache->raw_supply (regno, &val);
}
@@ -145,14 +143,12 @@ store_register (const struct regcache *regcache, int regno)
errno = 0;
regcache->raw_collect (regno, &val);
- ptrace (PTRACE_POKEUSER, tid,
- i386_linux_gregset_reg_offset[regno], val);
+ ptrace (PTRACE_POKEUSER, tid, i386_linux_gregset_reg_offset[regno], val);
if (errno != 0)
- error (_("Couldn't write register %s (#%d): %s."),
- gdbarch_register_name (regcache->arch (), regno),
- regno, safe_strerror (errno));
+ error (_ ("Couldn't write register %s (#%d): %s."),
+ gdbarch_register_name (regcache->arch (), regno), regno,
+ safe_strerror (errno));
}
-
/* Transfering the general-purpose registers between GDB, inferiors
and core files. */
@@ -169,11 +165,10 @@ supply_gregset (struct regcache *regcache, const elf_gregset_t *gregsetp)
for (i = 0; i < I386_NUM_GREGS; i++)
regcache->raw_supply (i, regp + i386_linux_gregset_reg_offset[i]);
- if (I386_LINUX_ORIG_EAX_REGNUM
- < gdbarch_num_regs (regcache->arch ()))
- regcache->raw_supply
- (I386_LINUX_ORIG_EAX_REGNUM,
- regp + i386_linux_gregset_reg_offset[I386_LINUX_ORIG_EAX_REGNUM]);
+ if (I386_LINUX_ORIG_EAX_REGNUM < gdbarch_num_regs (regcache->arch ()))
+ regcache->raw_supply (
+ I386_LINUX_ORIG_EAX_REGNUM,
+ regp + i386_linux_gregset_reg_offset[I386_LINUX_ORIG_EAX_REGNUM]);
}
/* Fill register REGNO (if it is a general-purpose register) in
@@ -181,8 +176,8 @@ supply_gregset (struct regcache *regcache, const elf_gregset_t *gregsetp)
do this for all registers. */
void
-fill_gregset (const struct regcache *regcache,
- elf_gregset_t *gregsetp, int regno)
+fill_gregset (const struct regcache *regcache, elf_gregset_t *gregsetp,
+ int regno)
{
gdb_byte *regp = (gdb_byte *) gregsetp;
int i;
@@ -192,11 +187,10 @@ fill_gregset (const struct regcache *regcache,
regcache->raw_collect (i, regp + i386_linux_gregset_reg_offset[i]);
if ((regno == -1 || regno == I386_LINUX_ORIG_EAX_REGNUM)
- && I386_LINUX_ORIG_EAX_REGNUM
- < gdbarch_num_regs (regcache->arch ()))
- regcache->raw_collect
- (I386_LINUX_ORIG_EAX_REGNUM,
- regp + i386_linux_gregset_reg_offset[I386_LINUX_ORIG_EAX_REGNUM]);
+ && I386_LINUX_ORIG_EAX_REGNUM < gdbarch_num_regs (regcache->arch ()))
+ regcache->raw_collect (
+ I386_LINUX_ORIG_EAX_REGNUM,
+ regp + i386_linux_gregset_reg_offset[I386_LINUX_ORIG_EAX_REGNUM]);
}
#ifdef HAVE_PTRACE_GETREGS
@@ -220,7 +214,7 @@ fetch_regs (struct regcache *regcache, int tid)
return;
}
- perror_with_name (_("Couldn't get registers"));
+ perror_with_name (_ ("Couldn't get registers"));
}
supply_gregset (regcache, (const elf_gregset_t *) regs_p);
@@ -235,28 +229,34 @@ store_regs (const struct regcache *regcache, int tid, int regno)
elf_gregset_t regs;
if (ptrace (PTRACE_GETREGS, tid, 0, (int) &regs) < 0)
- perror_with_name (_("Couldn't get registers"));
+ perror_with_name (_ ("Couldn't get registers"));
fill_gregset (regcache, &regs, regno);
-
+
if (ptrace (PTRACE_SETREGS, tid, 0, (int) &regs) < 0)
- perror_with_name (_("Couldn't write registers"));
+ perror_with_name (_ ("Couldn't write registers"));
}
#else
-static void fetch_regs (struct regcache *regcache, int tid) {}
-static void store_regs (const struct regcache *regcache, int tid, int regno) {}
+static void
+fetch_regs (struct regcache *regcache, int tid)
+{
+}
+
+static void
+store_regs (const struct regcache *regcache, int tid, int regno)
+{
+}
#endif
-
/* Transfering floating-point registers between GDB, inferiors and cores. */
/* Fill GDB's register array with the floating-point register values in
*FPREGSETP. */
-void
+void
supply_fpregset (struct regcache *regcache, const elf_fpregset_t *fpregsetp)
{
i387_supply_fsave (regcache, -1, fpregsetp);
@@ -267,8 +267,8 @@ supply_fpregset (struct regcache *regcache, const elf_fpregset_t *fpregsetp)
do this for all registers. */
void
-fill_fpregset (const struct regcache *regcache,
- elf_fpregset_t *fpregsetp, int regno)
+fill_fpregset (const struct regcache *regcache, elf_fpregset_t *fpregsetp,
+ int regno)
{
i387_collect_fsave (regcache, regno, fpregsetp);
}
@@ -284,7 +284,7 @@ fetch_fpregs (struct regcache *regcache, int tid)
elf_fpregset_t fpregs;
if (ptrace (PTRACE_GETFPREGS, tid, 0, (int) &fpregs) < 0)
- perror_with_name (_("Couldn't get floating point status"));
+ perror_with_name (_ ("Couldn't get floating point status"));
supply_fpregset (regcache, (const elf_fpregset_t *) &fpregs);
}
@@ -298,12 +298,12 @@ store_fpregs (const struct regcache *regcache, int tid, int regno)
elf_fpregset_t fpregs;
if (ptrace (PTRACE_GETFPREGS, tid, 0, (int) &fpregs) < 0)
- perror_with_name (_("Couldn't get floating point status"));
+ perror_with_name (_ ("Couldn't get floating point status"));
fill_fpregset (regcache, &fpregs, regno);
if (ptrace (PTRACE_SETFPREGS, tid, 0, (int) &fpregs) < 0)
- perror_with_name (_("Couldn't write floating point status"));
+ perror_with_name (_ ("Couldn't write floating point status"));
}
#else
@@ -319,7 +319,6 @@ store_fpregs (const struct regcache *regcache, int tid, int regno)
}
#endif
-
/* Transfering floating-point and SSE registers to and from GDB. */
@@ -337,10 +336,9 @@ fetch_xstateregs (struct regcache *regcache, int tid)
return 0;
iov.iov_base = xstateregs;
- iov.iov_len = sizeof(xstateregs);
- if (ptrace (PTRACE_GETREGSET, tid, (unsigned int) NT_X86_XSTATE,
- &iov) < 0)
- perror_with_name (_("Couldn't read extended state status"));
+ iov.iov_len = sizeof (xstateregs);
+ if (ptrace (PTRACE_GETREGSET, tid, (unsigned int) NT_X86_XSTATE, &iov) < 0)
+ perror_with_name (_ ("Couldn't read extended state status"));
i387_supply_xsave (regcache, -1, xstateregs);
return 1;
@@ -358,18 +356,17 @@ store_xstateregs (const struct regcache *regcache, int tid, int regno)
if (have_ptrace_getregset != TRIBOOL_TRUE)
return 0;
-
+
iov.iov_base = xstateregs;
- iov.iov_len = sizeof(xstateregs);
- if (ptrace (PTRACE_GETREGSET, tid, (unsigned int) NT_X86_XSTATE,
- &iov) < 0)
- perror_with_name (_("Couldn't read extended state status"));
+ iov.iov_len = sizeof (xstateregs);
+ if (ptrace (PTRACE_GETREGSET, tid, (unsigned int) NT_X86_XSTATE, &iov) < 0)
+ perror_with_name (_ ("Couldn't read extended state status"));
i387_collect_xsave (regcache, regno, xstateregs, 0);
- if (ptrace (PTRACE_SETREGSET, tid, (unsigned int) NT_X86_XSTATE,
- (int) &iov) < 0)
- perror_with_name (_("Couldn't write extended state status"));
+ if (ptrace (PTRACE_SETREGSET, tid, (unsigned int) NT_X86_XSTATE, (int) &iov)
+ < 0)
+ perror_with_name (_ ("Couldn't write extended state status"));
return 1;
}
@@ -385,7 +382,7 @@ fetch_fpxregs (struct regcache *regcache, int tid)
{
elf_fpxregset_t fpxregs;
- if (! have_ptrace_getfpxregs)
+ if (!have_ptrace_getfpxregs)
return 0;
if (ptrace (PTRACE_GETFPXREGS, tid, 0, (int) &fpxregs) < 0)
@@ -396,7 +393,7 @@ fetch_fpxregs (struct regcache *regcache, int tid)
return 0;
}
- perror_with_name (_("Couldn't read floating-point and SSE registers"));
+ perror_with_name (_ ("Couldn't read floating-point and SSE registers"));
}
i387_supply_fxsave (regcache, -1, (const elf_fpxregset_t *) &fpxregs);
@@ -412,9 +409,9 @@ store_fpxregs (const struct regcache *regcache, int tid, int regno)
{
elf_fpxregset_t fpxregs;
- if (! have_ptrace_getfpxregs)
+ if (!have_ptrace_getfpxregs)
return 0;
-
+
if (ptrace (PTRACE_GETFPXREGS, tid, 0, &fpxregs) == -1)
{
if (errno == EIO)
@@ -423,13 +420,13 @@ store_fpxregs (const struct regcache *regcache, int tid, int regno)
return 0;
}
- perror_with_name (_("Couldn't read floating-point and SSE registers"));
+ perror_with_name (_ ("Couldn't read floating-point and SSE registers"));
}
i387_collect_fxsave (regcache, regno, &fpxregs);
if (ptrace (PTRACE_SETFPXREGS, tid, 0, &fpxregs) == -1)
- perror_with_name (_("Couldn't write floating-point and SSE registers"));
+ perror_with_name (_ ("Couldn't write floating-point and SSE registers"));
return 1;
}
@@ -449,7 +446,6 @@ store_fpxregs (const struct regcache *regcache, int tid, int regno)
}
#endif /* HAVE_PTRACE_GETFPXREGS */
-
/* Transferring arbitrary registers between GDB and inferior. */
@@ -527,7 +523,7 @@ i386_linux_nat_target::fetch_registers (struct regcache *regcache, int regno)
return;
}
- internal_error (_("Got request for bad register number %d."), regno);
+ internal_error (_ ("Got request for bad register number %d."), regno);
}
/* Store register REGNO back into the child process. If REGNO is -1,
@@ -591,16 +587,15 @@ i386_linux_nat_target::store_registers (struct regcache *regcache, int regno)
return;
}
- internal_error (_("Got request to store bad register number %d."), regno);
+ internal_error (_ ("Got request to store bad register number %d."), regno);
}
-
/* Called by libthread_db. Returns a pointer to the thread local
storage (or its descriptor). */
ps_err_e
-ps_get_thread_area (struct ps_prochandle *ph,
- lwpid_t lwpid, int idx, void **base)
+ps_get_thread_area (struct ps_prochandle *ph, lwpid_t lwpid, int idx,
+ void **base)
{
unsigned int base_addr;
ps_err_e result;
@@ -612,7 +607,6 @@ ps_get_thread_area (struct ps_prochandle *ph,
return result;
}
-
/* The instruction for a GNU/Linux system call is:
int $0x80
@@ -629,10 +623,10 @@ static const unsigned char linux_syscall[] = { 0xcd, 0x80 };
system calls. */
#ifndef SYS_sigreturn
-#define SYS_sigreturn 0x77
+#define SYS_sigreturn 0x77
#endif
#ifndef SYS_rt_sigreturn
-#define SYS_rt_sigreturn 0xad
+#define SYS_rt_sigreturn 0xad
#endif
/* Offset to saved processor flags, from <asm/sigcontext.h>. */
@@ -643,13 +637,14 @@ static const unsigned char linux_syscall[] = { 0xcd, 0x80 };
If SIGNAL is nonzero, give it that signal. */
void
-i386_linux_nat_target::low_resume (ptid_t ptid, int step, enum gdb_signal signal)
+i386_linux_nat_target::low_resume (ptid_t ptid, int step,
+ enum gdb_signal signal)
{
int pid = ptid.lwp ();
int request;
if (catch_syscall_enabled () > 0)
- request = PTRACE_SYSCALL;
+ request = PTRACE_SYSCALL;
else
request = PTRACE_CONT;
@@ -663,8 +658,8 @@ i386_linux_nat_target::low_resume (ptid_t ptid, int step, enum gdb_signal signal
request = PTRACE_SINGLESTEP;
- regcache_cooked_read_unsigned (regcache,
- gdbarch_pc_regnum (gdbarch), &pc);
+ regcache_cooked_read_unsigned (regcache, gdbarch_pc_regnum (gdbarch),
+ &pc);
/* Returning from a signal trampoline is done by calling a
special system call (sigreturn or rt_sigreturn, see
@@ -679,8 +674,8 @@ i386_linux_nat_target::low_resume (ptid_t ptid, int step, enum gdb_signal signal
&& memcmp (buf, linux_syscall, LINUX_SYSCALL_LEN) == 0)
{
ULONGEST syscall;
- regcache_cooked_read_unsigned (regcache,
- LINUX_SYSCALL_REGNUM, &syscall);
+ regcache_cooked_read_unsigned (regcache, LINUX_SYSCALL_REGNUM,
+ &syscall);
/* Then check the system call number. */
if (syscall == SYS_sigreturn || syscall == SYS_rt_sigreturn)
@@ -690,8 +685,8 @@ i386_linux_nat_target::low_resume (ptid_t ptid, int step, enum gdb_signal signal
regcache_cooked_read_unsigned (regcache, I386_ESP_REGNUM, &sp);
if (syscall == SYS_rt_sigreturn)
- addr = read_memory_unsigned_integer (sp + 8, 4, byte_order)
- + 20;
+ addr
+ = read_memory_unsigned_integer (sp + 8, 4, byte_order) + 20;
else
addr = sp;
@@ -710,6 +705,7 @@ i386_linux_nat_target::low_resume (ptid_t ptid, int step, enum gdb_signal signal
}
void _initialize_i386_linux_nat ();
+
void
_initialize_i386_linux_nat ()
{
diff --git a/gdb/i386-linux-tdep.c b/gdb/i386-linux-tdep.c
index ad0377de5a6..1963c8a2002 100644
--- a/gdb/i386-linux-tdep.c
+++ b/gdb/i386-linux-tdep.c
@@ -57,13 +57,11 @@ i386_linux_register_reggroup_p (struct gdbarch *gdbarch, int regnum,
const struct reggroup *group)
{
if (regnum == I386_LINUX_ORIG_EAX_REGNUM)
- return (group == system_reggroup
- || group == save_reggroup
+ return (group == system_reggroup || group == save_reggroup
|| group == restore_reggroup);
return i386_register_reggroup_p (gdbarch, regnum, group);
}
-
/* Recognizing signal handler frames. */
/* GNU/Linux has two flavors of signals. Normal signal handlers, and
@@ -102,18 +100,17 @@ i386_linux_register_reggroup_p (struct gdbarch *gdbarch, int regnum,
to the ones used by the kernel. Therefore, these trampolines are
supported too. */
-#define LINUX_SIGTRAMP_INSN0 0x58 /* pop %eax */
-#define LINUX_SIGTRAMP_OFFSET0 0
-#define LINUX_SIGTRAMP_INSN1 0xb8 /* mov $NNNN, %eax */
-#define LINUX_SIGTRAMP_OFFSET1 1
-#define LINUX_SIGTRAMP_INSN2 0xcd /* int */
-#define LINUX_SIGTRAMP_OFFSET2 6
-
-static const gdb_byte linux_sigtramp_code[] =
-{
- LINUX_SIGTRAMP_INSN0, /* pop %eax */
- LINUX_SIGTRAMP_INSN1, 0x77, 0x00, 0x00, 0x00, /* mov $0x77, %eax */
- LINUX_SIGTRAMP_INSN2, 0x80 /* int $0x80 */
+#define LINUX_SIGTRAMP_INSN0 0x58 /* pop %eax */
+#define LINUX_SIGTRAMP_OFFSET0 0
+#define LINUX_SIGTRAMP_INSN1 0xb8 /* mov $NNNN, %eax */
+#define LINUX_SIGTRAMP_OFFSET1 1
+#define LINUX_SIGTRAMP_INSN2 0xcd /* int */
+#define LINUX_SIGTRAMP_OFFSET2 6
+
+static const gdb_byte linux_sigtramp_code[] = {
+ LINUX_SIGTRAMP_INSN0, /* pop %eax */
+ LINUX_SIGTRAMP_INSN1, 0x77, 0x00, 0x00, 0x00, /* mov $0x77, %eax */
+ LINUX_SIGTRAMP_INSN2, 0x80 /* int $0x80 */
};
#define LINUX_SIGTRAMP_LEN (sizeof linux_sigtramp_code)
@@ -173,15 +170,14 @@ i386_linux_sigtramp_start (frame_info_ptr this_frame)
The effect is to call the system call rt_sigreturn. */
-#define LINUX_RT_SIGTRAMP_INSN0 0xb8 /* mov $NNNN, %eax */
-#define LINUX_RT_SIGTRAMP_OFFSET0 0
-#define LINUX_RT_SIGTRAMP_INSN1 0xcd /* int */
-#define LINUX_RT_SIGTRAMP_OFFSET1 5
+#define LINUX_RT_SIGTRAMP_INSN0 0xb8 /* mov $NNNN, %eax */
+#define LINUX_RT_SIGTRAMP_OFFSET0 0
+#define LINUX_RT_SIGTRAMP_INSN1 0xcd /* int */
+#define LINUX_RT_SIGTRAMP_OFFSET1 5
-static const gdb_byte linux_rt_sigtramp_code[] =
-{
- LINUX_RT_SIGTRAMP_INSN0, 0xad, 0x00, 0x00, 0x00, /* mov $0xad, %eax */
- LINUX_RT_SIGTRAMP_INSN1, 0x80 /* int $0x80 */
+static const gdb_byte linux_rt_sigtramp_code[] = {
+ LINUX_RT_SIGTRAMP_INSN0, 0xad, 0x00, 0x00, 0x00, /* mov $0xad, %eax */
+ LINUX_RT_SIGTRAMP_INSN1, 0x80 /* int $0x80 */
};
#define LINUX_RT_SIGTRAMP_LEN (sizeof linux_rt_sigtramp_code)
@@ -212,8 +208,7 @@ i386_linux_rt_sigtramp_start (frame_info_ptr this_frame)
pc -= LINUX_RT_SIGTRAMP_OFFSET1;
- if (!safe_frame_unwind_memory (this_frame, pc,
- buf))
+ if (!safe_frame_unwind_memory (this_frame, pc, buf))
return 0;
}
@@ -261,8 +256,9 @@ i386_linux_dwarf_signal_frame_p (struct gdbarch *gdbarch,
/* If a vsyscall DSO is in use, the signal trampolines may have these
names. */
- if (name && (strcmp (name, "__kernel_sigreturn") == 0
- || strcmp (name, "__kernel_rt_sigreturn") == 0))
+ if (name
+ && (strcmp (name, "__kernel_sigreturn") == 0
+ || strcmp (name, "__kernel_rt_sigreturn") == 0))
return 1;
return 0;
@@ -313,7 +309,7 @@ i386_linux_sigcontext_addr (frame_info_ptr this_frame)
return ucontext_addr + I386_LINUX_UCONTEXT_SIGCONTEXT_OFFSET;
}
- error (_("Couldn't recognize signal trampoline."));
+ error (_ ("Couldn't recognize signal trampoline."));
return 0;
}
@@ -376,7 +372,10 @@ i386_all_but_ip_registers_record (struct regcache *regcache)
static enum gdb_syscall
i386_canonicalize_syscall (int syscall)
{
- enum { i386_syscall_max = 499 };
+ enum
+ {
+ i386_syscall_max = 499
+ };
if (syscall <= i386_syscall_max)
return (enum gdb_syscall) syscall;
@@ -408,12 +407,11 @@ i386_linux_report_signal_info (struct gdbarch *gdbarch, struct ui_out *uiout,
/* Sigcode evaluates if the actual segfault is a boundary violation. */
sig_code = parse_and_eval_long ("$_siginfo.si_code\n");
- lower_bound
- = parse_and_eval_long ("$_siginfo._sifields._sigfault._addr_bnd._lower");
- upper_bound
- = parse_and_eval_long ("$_siginfo._sifields._sigfault._addr_bnd._upper");
- access
- = parse_and_eval_long ("$_siginfo._sifields._sigfault.si_addr");
+ lower_bound = parse_and_eval_long (
+ "$_siginfo._sifields._sigfault._addr_bnd._lower");
+ upper_bound = parse_and_eval_long (
+ "$_siginfo._sifields._sigfault._addr_bnd._upper");
+ access = parse_and_eval_long ("$_siginfo._sifields._sigfault.si_addr");
}
catch (const gdb_exception &exception)
{
@@ -428,20 +426,20 @@ i386_linux_report_signal_info (struct gdbarch *gdbarch, struct ui_out *uiout,
uiout->text ("\n");
if (is_upper)
- uiout->field_string ("sigcode-meaning", _("Upper bound violation"));
+ uiout->field_string ("sigcode-meaning", _ ("Upper bound violation"));
else
- uiout->field_string ("sigcode-meaning", _("Lower bound violation"));
+ uiout->field_string ("sigcode-meaning", _ ("Lower bound violation"));
- uiout->text (_(" while accessing address "));
+ uiout->text (_ (" while accessing address "));
uiout->field_core_addr ("bound-access", gdbarch, access);
- uiout->text (_("\nBounds: [lower = "));
+ uiout->text (_ ("\nBounds: [lower = "));
uiout->field_core_addr ("lower-bound", gdbarch, lower_bound);
- uiout->text (_(", upper = "));
+ uiout->text (_ (", upper = "));
uiout->field_core_addr ("upper-bound", gdbarch, upper_bound);
- uiout->text (_("]"));
+ uiout->text (_ ("]"));
}
/* Parse the arguments of current system call instruction and record
@@ -467,19 +465,18 @@ i386_linux_intx80_sysenter_syscall_record (struct regcache *regcache)
if (syscall_gdb < 0)
{
gdb_printf (gdb_stderr,
- _("Process record and replay target doesn't "
- "support syscall number %s\n"),
+ _ ("Process record and replay target doesn't "
+ "support syscall number %s\n"),
plongest (syscall_native));
return -1;
}
- if (syscall_gdb == gdb_sys_sigreturn
- || syscall_gdb == gdb_sys_rt_sigreturn)
- {
- if (i386_all_but_ip_registers_record (regcache))
- return -1;
- return 0;
- }
+ if (syscall_gdb == gdb_sys_sigreturn || syscall_gdb == gdb_sys_rt_sigreturn)
+ {
+ if (i386_all_but_ip_registers_record (regcache))
+ return -1;
+ return 0;
+ }
ret = record_linux_system_call (syscall_gdb, regcache,
&i386_linux_record_tdep);
@@ -493,12 +490,11 @@ i386_linux_intx80_sysenter_syscall_record (struct regcache *regcache)
return 0;
}
-#define I386_LINUX_xstate 270
-#define I386_LINUX_frame_size 732
+#define I386_LINUX_xstate 270
+#define I386_LINUX_frame_size 732
static int
-i386_linux_record_signal (struct gdbarch *gdbarch,
- struct regcache *regcache,
+i386_linux_record_signal (struct gdbarch *gdbarch, struct regcache *regcache,
enum gdb_signal signal)
{
ULONGEST esp;
@@ -517,8 +513,8 @@ i386_linux_record_signal (struct gdbarch *gdbarch,
/* This is for frame_size.
sp -= sizeof (struct rt_sigframe); */
esp -= I386_LINUX_frame_size;
- if (record_full_arch_list_add_mem (esp,
- I386_LINUX_xstate + I386_LINUX_frame_size))
+ if (record_full_arch_list_add_mem (esp, I386_LINUX_xstate
+ + I386_LINUX_frame_size))
return -1;
if (record_full_arch_list_add_end ())
@@ -526,7 +522,6 @@ i386_linux_record_signal (struct gdbarch *gdbarch,
return 0;
}
-
/* Core of the implementation for gdbarch get_syscall_number. Get pending
syscall number from REGCACHE. If there is no pending syscall -1 will be
@@ -559,8 +554,7 @@ i386_linux_get_syscall_number_from_regcache (struct regcache *regcache)
compatible with gdbarch get_syscall_number method prototype. */
static LONGEST
-i386_linux_get_syscall_number (struct gdbarch *gdbarch,
- thread_info *thread)
+i386_linux_get_syscall_number (struct gdbarch *gdbarch, thread_info *thread)
{
struct regcache *regcache = get_thread_regcache (thread);
@@ -583,59 +577,54 @@ i386_linux_get_syscall_number (struct gdbarch *gdbarch,
format and GDB's register cache layout. */
/* From <sys/reg.h>. */
-int i386_linux_gregset_reg_offset[] =
-{
- 6 * 4, /* %eax */
- 1 * 4, /* %ecx */
- 2 * 4, /* %edx */
- 0 * 4, /* %ebx */
- 15 * 4, /* %esp */
- 5 * 4, /* %ebp */
- 3 * 4, /* %esi */
- 4 * 4, /* %edi */
- 12 * 4, /* %eip */
- 14 * 4, /* %eflags */
- 13 * 4, /* %cs */
- 16 * 4, /* %ss */
- 7 * 4, /* %ds */
- 8 * 4, /* %es */
- 9 * 4, /* %fs */
- 10 * 4, /* %gs */
- -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1,
- -1,
- -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, /* MPX registers BND0 ... BND3. */
- -1, -1, /* MPX registers BNDCFGU, BNDSTATUS. */
- -1, -1, -1, -1, -1, -1, -1, -1, /* k0 ... k7 (AVX512) */
- -1, -1, -1, -1, -1, -1, -1, -1, /* zmm0 ... zmm7 (AVX512) */
- -1, /* PKRU register */
- 11 * 4, /* "orig_eax" */
+int i386_linux_gregset_reg_offset[] = {
+ 6 * 4, /* %eax */
+ 1 * 4, /* %ecx */
+ 2 * 4, /* %edx */
+ 0 * 4, /* %ebx */
+ 15 * 4, /* %esp */
+ 5 * 4, /* %ebp */
+ 3 * 4, /* %esi */
+ 4 * 4, /* %edi */
+ 12 * 4, /* %eip */
+ 14 * 4, /* %eflags */
+ 13 * 4, /* %cs */
+ 16 * 4, /* %ss */
+ 7 * 4, /* %ds */
+ 8 * 4, /* %es */
+ 9 * 4, /* %fs */
+ 10 * 4, /* %gs */
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, /* MPX registers BND0 ... BND3. */
+ -1, -1, /* MPX registers BNDCFGU, BNDSTATUS. */
+ -1, -1, -1, -1, -1, -1, -1, -1, /* k0 ... k7 (AVX512) */
+ -1, -1, -1, -1, -1, -1, -1, -1, /* zmm0 ... zmm7 (AVX512) */
+ -1, /* PKRU register */
+ 11 * 4, /* "orig_eax" */
};
/* Mapping between the general-purpose registers in `struct
sigcontext' format and GDB's register cache layout. */
/* From <asm/sigcontext.h>. */
-static int i386_linux_sc_reg_offset[] =
-{
- 11 * 4, /* %eax */
- 10 * 4, /* %ecx */
- 9 * 4, /* %edx */
- 8 * 4, /* %ebx */
- 7 * 4, /* %esp */
- 6 * 4, /* %ebp */
- 5 * 4, /* %esi */
- 4 * 4, /* %edi */
- 14 * 4, /* %eip */
- 16 * 4, /* %eflags */
- 15 * 4, /* %cs */
- 18 * 4, /* %ss */
- 3 * 4, /* %ds */
- 2 * 4, /* %es */
- 1 * 4, /* %fs */
- 0 * 4 /* %gs */
+static int i386_linux_sc_reg_offset[] = {
+ 11 * 4, /* %eax */
+ 10 * 4, /* %ecx */
+ 9 * 4, /* %edx */
+ 8 * 4, /* %ebx */
+ 7 * 4, /* %esp */
+ 6 * 4, /* %ebp */
+ 5 * 4, /* %esi */
+ 4 * 4, /* %edi */
+ 14 * 4, /* %eip */
+ 16 * 4, /* %eflags */
+ 15 * 4, /* %cs */
+ 18 * 4, /* %ss */
+ 3 * 4, /* %ds */
+ 2 * 4, /* %es */
+ 1 * 4, /* %fs */
+ 0 * 4 /* %gs */
};
/* Get XSAVE extended state xcr0 from core dump. */
@@ -657,12 +646,11 @@ i386_linux_core_read_xcr0 (bfd *abfd)
{
char contents[8];
- if (! bfd_get_section_contents (abfd, xstate, contents,
- I386_LINUX_XSAVE_XCR0_OFFSET,
- 8))
+ if (!bfd_get_section_contents (abfd, xstate, contents,
+ I386_LINUX_XSAVE_XCR0_OFFSET, 8))
{
- warning (_("Couldn't read `xcr0' bytes from "
- "`.reg-xstate' section in core file."));
+ warning (_ ("Couldn't read `xcr0' bytes from "
+ "`.reg-xstate' section in core file."));
return 0;
}
@@ -683,16 +671,17 @@ i386_linux_read_description (uint64_t xcr0)
if (xcr0 == 0)
return NULL;
- static struct target_desc *i386_linux_tdescs \
- [2/*X87*/][2/*SSE*/][2/*AVX*/][2/*MPX*/][2/*AVX512*/][2/*PKRU*/] = {};
+ static struct target_desc
+ *i386_linux_tdescs[2 /*X87*/][2 /*SSE*/][2 /*AVX*/][2 /*MPX*/]
+ [2 /*AVX512*/][2 /*PKRU*/]
+ = {};
struct target_desc **tdesc;
- tdesc = &i386_linux_tdescs[(xcr0 & X86_XSTATE_X87) ? 1 : 0]
- [(xcr0 & X86_XSTATE_SSE) ? 1 : 0]
- [(xcr0 & X86_XSTATE_AVX) ? 1 : 0]
- [(xcr0 & X86_XSTATE_MPX) ? 1 : 0]
- [(xcr0 & X86_XSTATE_AVX512) ? 1 : 0]
- [(xcr0 & X86_XSTATE_PKRU) ? 1 : 0];
+ tdesc
+ = &i386_linux_tdescs
+ [(xcr0 & X86_XSTATE_X87) ? 1 : 0][(xcr0 & X86_XSTATE_SSE) ? 1 : 0]
+ [(xcr0 & X86_XSTATE_AVX) ? 1 : 0][(xcr0 & X86_XSTATE_MPX) ? 1 : 0]
+ [(xcr0 & X86_XSTATE_AVX512) ? 1 : 0][(xcr0 & X86_XSTATE_PKRU) ? 1 : 0];
if (*tdesc == NULL)
*tdesc = i386_create_target_description (xcr0, true, false);
@@ -704,8 +693,7 @@ i386_linux_read_description (uint64_t xcr0)
static const struct target_desc *
i386_linux_core_read_description (struct gdbarch *gdbarch,
- struct target_ops *target,
- bfd *abfd)
+ struct target_ops *target, bfd *abfd)
{
/* Linux/i386. */
uint64_t xcr0 = i386_linux_core_read_xcr0 (abfd);
@@ -733,27 +721,24 @@ i386_linux_supply_xstateregset (const struct regset *regset,
struct type *
x86_linux_get_siginfo_type (struct gdbarch *gdbarch)
{
- return linux_get_siginfo_type_with_fields (gdbarch, LINUX_SIGINFO_FIELD_ADDR_BND);
+ return linux_get_siginfo_type_with_fields (gdbarch,
+ LINUX_SIGINFO_FIELD_ADDR_BND);
}
/* Similar to i386_collect_fpregset, but use XSAVE extended state. */
static void
i386_linux_collect_xstateregset (const struct regset *regset,
- const struct regcache *regcache,
- int regnum, void *xstateregs, size_t len)
+ const struct regcache *regcache, int regnum,
+ void *xstateregs, size_t len)
{
i387_collect_xsave (regcache, regnum, xstateregs, 1);
}
/* Register set definitions. */
-static const struct regset i386_linux_xstateregset =
- {
- NULL,
- i386_linux_supply_xstateregset,
- i386_linux_collect_xstateregset
- };
+static const struct regset i386_linux_xstateregset
+ = { NULL, i386_linux_supply_xstateregset, i386_linux_collect_xstateregset };
/* Iterate over core file register note sections. */
@@ -801,12 +786,11 @@ i386_linux_iterate_over_regset_sections (struct gdbarch *gdbarch,
there instead. */
static displaced_step_copy_insn_closure_up
-i386_linux_displaced_step_copy_insn (struct gdbarch *gdbarch,
- CORE_ADDR from, CORE_ADDR to,
- struct regcache *regs)
+i386_linux_displaced_step_copy_insn (struct gdbarch *gdbarch, CORE_ADDR from,
+ CORE_ADDR to, struct regcache *regs)
{
displaced_step_copy_insn_closure_up closure_
- = i386_displaced_step_copy_insn (gdbarch, from, to, regs);
+ = i386_displaced_step_copy_insn (gdbarch, from, to, regs);
if (i386_linux_get_syscall_number_from_regcache (regs) != -1)
{
@@ -841,7 +825,7 @@ i386_linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
/* Reserve a number for orig_eax. */
set_gdbarch_num_regs (gdbarch, I386_LINUX_NUM_REGS);
- if (! tdesc_has_registers (tdesc))
+ if (!tdesc_has_registers (tdesc))
tdesc = i386_linux_read_description (X86_XSTATE_SSE_MASK);
tdep->tdesc = tdesc;
@@ -850,8 +834,7 @@ i386_linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
return;
valid_p = tdesc_numbered_register (feature, tdesc_data,
- I386_LINUX_ORIG_EAX_REGNUM,
- "orig_eax");
+ I386_LINUX_ORIG_EAX_REGNUM, "orig_eax");
if (!valid_p)
return;
@@ -864,7 +847,7 @@ i386_linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
tdep->gregset_num_regs = ARRAY_SIZE (i386_linux_gregset_reg_offset);
tdep->sizeof_gregset = 17 * 4;
- tdep->jb_pc_offset = 20; /* From <bits/setjmp.h>. */
+ tdep->jb_pc_offset = 20; /* From <bits/setjmp.h>. */
tdep->sigtramp_p = i386_linux_sigtramp_p;
tdep->sigcontext_addr = i386_linux_sigcontext_addr;
@@ -1044,8 +1027,8 @@ i386_linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
/* GNU/Linux uses SVR4-style shared libraries. */
set_gdbarch_skip_trampoline_code (gdbarch, find_solib_trampoline_target);
- set_solib_svr4_fetch_link_map_offsets
- (gdbarch, linux_ilp32_fetch_link_map_offsets);
+ set_solib_svr4_fetch_link_map_offsets (gdbarch,
+ linux_ilp32_fetch_link_map_offsets);
/* GNU/Linux uses the dynamic linker included in the GNU C Library. */
set_gdbarch_skip_solib_resolver (gdbarch, glibc_skip_solib_resolver);
@@ -1057,8 +1040,8 @@ i386_linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
svr4_fetch_objfile_link_map);
/* Core file support. */
- set_gdbarch_iterate_over_regset_sections
- (gdbarch, i386_linux_iterate_over_regset_sections);
+ set_gdbarch_iterate_over_regset_sections (
+ gdbarch, i386_linux_iterate_over_regset_sections);
set_gdbarch_core_read_description (gdbarch,
i386_linux_core_read_description);
@@ -1069,14 +1052,14 @@ i386_linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
/* Functions for 'catch syscall'. */
set_xml_syscall_file_name (gdbarch, XML_SYSCALL_FILENAME_I386);
- set_gdbarch_get_syscall_number (gdbarch,
- i386_linux_get_syscall_number);
+ set_gdbarch_get_syscall_number (gdbarch, i386_linux_get_syscall_number);
set_gdbarch_get_siginfo_type (gdbarch, x86_linux_get_siginfo_type);
set_gdbarch_report_signal_info (gdbarch, i386_linux_report_signal_info);
}
void _initialize_i386_linux_tdep ();
+
void
_initialize_i386_linux_tdep ()
{
diff --git a/gdb/i386-linux-tdep.h b/gdb/i386-linux-tdep.h
index c0fd1f7f300..9ab09462607 100644
--- a/gdb/i386-linux-tdep.h
+++ b/gdb/i386-linux-tdep.h
@@ -70,7 +70,7 @@ extern const struct target_desc *i386_linux_read_description (uint64_t xcr0);
0 (the XFEATURE_ENABLED_MASK register), XCR0. We can use this mask
together with the mask saved in the xstate_hdr_bytes to determine what
states the processor/OS supports and what state, used or initialized,
- the process/thread is in. */
+ the process/thread is in. */
#define I386_LINUX_XSAVE_XCR0_OFFSET 464
extern int i386_linux_gregset_reg_offset[];
diff --git a/gdb/i386-netbsd-nat.c b/gdb/i386-netbsd-nat.c
index 2268378b023..7717d6f4d22 100644
--- a/gdb/i386-netbsd-nat.c
+++ b/gdb/i386-netbsd-nat.c
@@ -59,7 +59,7 @@ i386nbsd_supply_pcb (struct regcache *regcache, struct pcb *pcb)
if (pcb->pcb_esp == 0)
return 0;
- read_memory (pcb->pcb_esp, (gdb_byte *)&sf, sizeof sf);
+ read_memory (pcb->pcb_esp, (gdb_byte *) &sf, sizeof sf);
pcb->pcb_esp += sizeof (struct switchframe);
regcache->raw_supply (I386_EDI_REGNUM, &sf.sf_edi);
regcache->raw_supply (I386_ESI_REGNUM, &sf.sf_esi);
@@ -74,6 +74,7 @@ i386nbsd_supply_pcb (struct regcache *regcache, struct pcb *pcb)
static i386_bsd_nat_target<nbsd_nat_target> the_i386_nbsd_nat_target;
void _initialize_i386nbsd_nat ();
+
void
_initialize_i386nbsd_nat ()
{
diff --git a/gdb/i386-netbsd-tdep.c b/gdb/i386-netbsd-tdep.c
index 649785eb71b..355cb71a889 100644
--- a/gdb/i386-netbsd-tdep.c
+++ b/gdb/i386-netbsd-tdep.c
@@ -34,66 +34,63 @@
#include "solib-svr4.h"
/* From <machine/reg.h>. */
-static int i386nbsd_r_reg_offset[] =
-{
- 0 * 4, /* %eax */
- 1 * 4, /* %ecx */
- 2 * 4, /* %edx */
- 3 * 4, /* %ebx */
- 4 * 4, /* %esp */
- 5 * 4, /* %ebp */
- 6 * 4, /* %esi */
- 7 * 4, /* %edi */
- 8 * 4, /* %eip */
- 9 * 4, /* %eflags */
- 10 * 4, /* %cs */
- 11 * 4, /* %ss */
- 12 * 4, /* %ds */
- 13 * 4, /* %es */
- 14 * 4, /* %fs */
- 15 * 4 /* %gs */
+static int i386nbsd_r_reg_offset[] = {
+ 0 * 4, /* %eax */
+ 1 * 4, /* %ecx */
+ 2 * 4, /* %edx */
+ 3 * 4, /* %ebx */
+ 4 * 4, /* %esp */
+ 5 * 4, /* %ebp */
+ 6 * 4, /* %esi */
+ 7 * 4, /* %edi */
+ 8 * 4, /* %eip */
+ 9 * 4, /* %eflags */
+ 10 * 4, /* %cs */
+ 11 * 4, /* %ss */
+ 12 * 4, /* %ds */
+ 13 * 4, /* %es */
+ 14 * 4, /* %fs */
+ 15 * 4 /* %gs */
};
/* From <machine/signal.h>. */
-static int i386nbsd_sc_reg_offset[] =
-{
- 10 * 4, /* %eax */
- 9 * 4, /* %ecx */
- 8 * 4, /* %edx */
- 7 * 4, /* %ebx */
- 14 * 4, /* %esp */
- 6 * 4, /* %ebp */
- 5 * 4, /* %esi */
- 4 * 4, /* %edi */
- 11 * 4, /* %eip */
- 13 * 4, /* %eflags */
- 12 * 4, /* %cs */
- 15 * 4, /* %ss */
- 3 * 4, /* %ds */
- 2 * 4, /* %es */
- 1 * 4, /* %fs */
- 0 * 4 /* %gs */
+static int i386nbsd_sc_reg_offset[] = {
+ 10 * 4, /* %eax */
+ 9 * 4, /* %ecx */
+ 8 * 4, /* %edx */
+ 7 * 4, /* %ebx */
+ 14 * 4, /* %esp */
+ 6 * 4, /* %ebp */
+ 5 * 4, /* %esi */
+ 4 * 4, /* %edi */
+ 11 * 4, /* %eip */
+ 13 * 4, /* %eflags */
+ 12 * 4, /* %cs */
+ 15 * 4, /* %ss */
+ 3 * 4, /* %ds */
+ 2 * 4, /* %es */
+ 1 * 4, /* %fs */
+ 0 * 4 /* %gs */
};
/* From <machine/mcontext.h>. */
-static int i386nbsd_mc_reg_offset[] =
-{
- 11 * 4, /* %eax */
- 10 * 4, /* %ecx */
- 9 * 4, /* %edx */
- 8 * 4, /* %ebx */
- 7 * 4, /* %esp */
- 6 * 4, /* %ebp */
- 5 * 4, /* %esi */
- 4 * 4, /* %edi */
- 14 * 4, /* %eip */
- 16 * 4, /* %eflags */
- 15 * 4, /* %cs */
- 18 * 4, /* %ss */
- 3 * 4, /* %ds */
- 2 * 4, /* %es */
- 1 * 4, /* %fs */
- 0 * 4 /* %gs */
+static int i386nbsd_mc_reg_offset[] = {
+ 11 * 4, /* %eax */
+ 10 * 4, /* %ecx */
+ 9 * 4, /* %edx */
+ 8 * 4, /* %ebx */
+ 7 * 4, /* %esp */
+ 6 * 4, /* %ebp */
+ 5 * 4, /* %esi */
+ 4 * 4, /* %edi */
+ 14 * 4, /* %eip */
+ 16 * 4, /* %eflags */
+ 15 * 4, /* %cs */
+ 18 * 4, /* %ss */
+ 3 * 4, /* %ds */
+ 2 * 4, /* %es */
+ 1 * 4, /* %fs */
+ 0 * 4 /* %gs */
};
static void i386nbsd_sigtramp_cache_init (const struct tramp_frame *,
@@ -101,231 +98,211 @@ static void i386nbsd_sigtramp_cache_init (const struct tramp_frame *,
struct trad_frame_cache *,
CORE_ADDR);
-static const struct tramp_frame i386nbsd_sigtramp_sc16 =
-{
- SIGTRAMP_FRAME,
- 1,
- {
- /* leal 0x10(%esp), %eax */
- { 0x8d, ULONGEST_MAX },
- { 0x44, ULONGEST_MAX },
- { 0x24, ULONGEST_MAX },
- { 0x10, ULONGEST_MAX },
-
- /* pushl %eax */
- { 0x50, ULONGEST_MAX },
-
- /* pushl %eax */
- { 0x50, ULONGEST_MAX },
-
- /* movl $0x127, %eax # __sigreturn14 */
- { 0xb8, ULONGEST_MAX },
- { 0x27, ULONGEST_MAX },
- {0x01, ULONGEST_MAX },
- {0x00, ULONGEST_MAX },
- {0x00, ULONGEST_MAX },
-
- /* int $0x80 */
- { 0xcd, ULONGEST_MAX },
- { 0x80, ULONGEST_MAX},
-
- /* movl $0x1, %eax # exit */
- { 0xb8, ULONGEST_MAX },
- { 0x01, ULONGEST_MAX },
- {0x00, ULONGEST_MAX },
- {0x00, ULONGEST_MAX },
- {0x00, ULONGEST_MAX },
-
- /* int $0x80 */
- { 0xcd, ULONGEST_MAX },
- { 0x80, ULONGEST_MAX},
-
- { TRAMP_SENTINEL_INSN, ULONGEST_MAX }
- },
- i386nbsd_sigtramp_cache_init
-};
-
-static const struct tramp_frame i386nbsd_sigtramp_sc2 =
-{
- SIGTRAMP_FRAME,
- 1,
- {
- /* leal 0x0c(%esp), %eax */
- { 0x8d, ULONGEST_MAX },
- { 0x44, ULONGEST_MAX },
- { 0x24, ULONGEST_MAX },
- { 0x0c, ULONGEST_MAX },
- /* movl %eax, 0x4(%esp) */
- { 0x89, ULONGEST_MAX },
- { 0x44, ULONGEST_MAX },
- { 0x24, ULONGEST_MAX },
- { 0x04, ULONGEST_MAX },
- /* movl $0x127, %eax # __sigreturn14 */
- { 0xb8, ULONGEST_MAX },
- { 0x27, ULONGEST_MAX },
- {0x01, ULONGEST_MAX },
- {0x00, ULONGEST_MAX },
- {0x00, ULONGEST_MAX },
- /* int $0x80 */
- { 0xcd, ULONGEST_MAX },
- { 0x80, ULONGEST_MAX},
- /* movl %eax, 0x4(%esp) */
- { 0x89, ULONGEST_MAX },
- { 0x44, ULONGEST_MAX },
- { 0x24, ULONGEST_MAX },
- { 0x04, ULONGEST_MAX },
- /* movl $0x1, %eax */
- { 0xb8, ULONGEST_MAX },
- { 0x01, ULONGEST_MAX },
- {0x00, ULONGEST_MAX },
- {0x00, ULONGEST_MAX },
- {0x00, ULONGEST_MAX },
- /* int $0x80 */
- { 0xcd, ULONGEST_MAX },
- { 0x80, ULONGEST_MAX},
- { TRAMP_SENTINEL_INSN, ULONGEST_MAX }
- },
- i386nbsd_sigtramp_cache_init
-};
-
-static const struct tramp_frame i386nbsd_sigtramp_si2 =
-{
- SIGTRAMP_FRAME,
- 1,
- {
- /* movl 8(%esp),%eax */
- { 0x8b, ULONGEST_MAX },
- { 0x44, ULONGEST_MAX },
- { 0x24, ULONGEST_MAX },
- { 0x08, ULONGEST_MAX },
- /* movl %eax, 0x4(%esp) */
- { 0x89, ULONGEST_MAX },
- { 0x44, ULONGEST_MAX },
- { 0x24, ULONGEST_MAX },
- { 0x04, ULONGEST_MAX },
- /* movl $0x134, %eax # setcontext */
- { 0xb8, ULONGEST_MAX },
- { 0x34, ULONGEST_MAX },
- { 0x01, ULONGEST_MAX },
- { 0x00, ULONGEST_MAX },
- { 0x00, ULONGEST_MAX },
- /* int $0x80 */
- { 0xcd, ULONGEST_MAX },
- { 0x80, ULONGEST_MAX },
- /* movl %eax, 0x4(%esp) */
- { 0x89, ULONGEST_MAX },
- { 0x44, ULONGEST_MAX },
- { 0x24, ULONGEST_MAX },
- { 0x04, ULONGEST_MAX },
- /* movl $0x1, %eax */
- { 0xb8, ULONGEST_MAX },
- { 0x01, ULONGEST_MAX },
- { 0x00, ULONGEST_MAX },
- { 0x00, ULONGEST_MAX },
- { 0x00, ULONGEST_MAX },
- /* int $0x80 */
- { 0xcd, ULONGEST_MAX },
- { 0x80, ULONGEST_MAX },
- { TRAMP_SENTINEL_INSN, ULONGEST_MAX }
- },
- i386nbsd_sigtramp_cache_init
-};
-
-static const struct tramp_frame i386nbsd_sigtramp_si31 =
-{
- SIGTRAMP_FRAME,
- 1,
- {
- /* leal 0x8c(%esp), %eax */
- { 0x8d, ULONGEST_MAX },
- { 0x84, ULONGEST_MAX },
- { 0x24, ULONGEST_MAX },
- { 0x8c, ULONGEST_MAX },
- { 0x00, ULONGEST_MAX },
- { 0x00, ULONGEST_MAX },
- { 0x00, ULONGEST_MAX },
- /* movl %eax, 0x4(%esp) */
- { 0x89, ULONGEST_MAX },
- { 0x44, ULONGEST_MAX },
- { 0x24, ULONGEST_MAX },
- { 0x04, ULONGEST_MAX },
- /* movl $0x134, %eax # setcontext */
- { 0xb8, ULONGEST_MAX },
- { 0x34, ULONGEST_MAX },
- { 0x01, ULONGEST_MAX },
- { 0x00, ULONGEST_MAX },
- { 0x00, ULONGEST_MAX },
- /* int $0x80 */
- { 0xcd, ULONGEST_MAX },
- { 0x80, ULONGEST_MAX},
- /* movl %eax, 0x4(%esp) */
- { 0x89, ULONGEST_MAX },
- { 0x44, ULONGEST_MAX },
- { 0x24, ULONGEST_MAX },
- { 0x04, ULONGEST_MAX },
- /* movl $0x1, %eax */
- { 0xb8, ULONGEST_MAX },
- { 0x01, ULONGEST_MAX },
- {0x00, ULONGEST_MAX },
- {0x00, ULONGEST_MAX },
- {0x00, ULONGEST_MAX },
- /* int $0x80 */
- { 0xcd, ULONGEST_MAX },
- { 0x80, ULONGEST_MAX},
- { TRAMP_SENTINEL_INSN, ULONGEST_MAX }
- },
- i386nbsd_sigtramp_cache_init
-};
-
-static const struct tramp_frame i386nbsd_sigtramp_si4 =
-{
- SIGTRAMP_FRAME,
- 1,
- {
- /* leal 0x8c(%esp), %eax */
- { 0x8d, ULONGEST_MAX },
- { 0x84, ULONGEST_MAX },
- { 0x24, ULONGEST_MAX },
- { 0x8c, ULONGEST_MAX },
- { 0x00, ULONGEST_MAX },
- { 0x00, ULONGEST_MAX },
- { 0x00, ULONGEST_MAX },
- /* movl %eax, 0x4(%esp) */
- { 0x89, ULONGEST_MAX },
- { 0x44, ULONGEST_MAX },
- { 0x24, ULONGEST_MAX },
- { 0x04, ULONGEST_MAX },
- /* movl $0x134, %eax # setcontext */
- { 0xb8, ULONGEST_MAX },
- { 0x34, ULONGEST_MAX },
- { 0x01, ULONGEST_MAX },
- { 0x00, ULONGEST_MAX },
- { 0x00, ULONGEST_MAX },
- /* int $0x80 */
- { 0xcd, ULONGEST_MAX },
- { 0x80, ULONGEST_MAX},
- /* movl $0xffffffff,0x4(%esp) */
- { 0xc7, ULONGEST_MAX },
- { 0x44, ULONGEST_MAX },
- { 0x24, ULONGEST_MAX },
- { 0x04, ULONGEST_MAX },
- { 0xff, ULONGEST_MAX },
- { 0xff, ULONGEST_MAX },
- { 0xff, ULONGEST_MAX },
- { 0xff, ULONGEST_MAX },
- /* movl $0x1, %eax */
- { 0xb8, ULONGEST_MAX },
- { 0x01, ULONGEST_MAX },
- {0x00, ULONGEST_MAX },
- {0x00, ULONGEST_MAX },
- {0x00, ULONGEST_MAX },
- /* int $0x80 */
- { 0xcd, ULONGEST_MAX },
- { 0x80, ULONGEST_MAX},
- { TRAMP_SENTINEL_INSN, ULONGEST_MAX }
- },
- i386nbsd_sigtramp_cache_init
-};
+static const struct tramp_frame i386nbsd_sigtramp_sc16
+ = { SIGTRAMP_FRAME,
+ 1,
+ { /* leal 0x10(%esp), %eax */
+ { 0x8d, ULONGEST_MAX },
+ { 0x44, ULONGEST_MAX },
+ { 0x24, ULONGEST_MAX },
+ { 0x10, ULONGEST_MAX },
+
+ /* pushl %eax */
+ { 0x50, ULONGEST_MAX },
+
+ /* pushl %eax */
+ { 0x50, ULONGEST_MAX },
+
+ /* movl $0x127, %eax # __sigreturn14 */
+ { 0xb8, ULONGEST_MAX },
+ { 0x27, ULONGEST_MAX },
+ { 0x01, ULONGEST_MAX },
+ { 0x00, ULONGEST_MAX },
+ { 0x00, ULONGEST_MAX },
+
+ /* int $0x80 */
+ { 0xcd, ULONGEST_MAX },
+ { 0x80, ULONGEST_MAX },
+
+ /* movl $0x1, %eax # exit */
+ { 0xb8, ULONGEST_MAX },
+ { 0x01, ULONGEST_MAX },
+ { 0x00, ULONGEST_MAX },
+ { 0x00, ULONGEST_MAX },
+ { 0x00, ULONGEST_MAX },
+
+ /* int $0x80 */
+ { 0xcd, ULONGEST_MAX },
+ { 0x80, ULONGEST_MAX },
+
+ { TRAMP_SENTINEL_INSN, ULONGEST_MAX } },
+ i386nbsd_sigtramp_cache_init };
+
+static const struct tramp_frame i386nbsd_sigtramp_sc2
+ = { SIGTRAMP_FRAME,
+ 1,
+ { /* leal 0x0c(%esp), %eax */
+ { 0x8d, ULONGEST_MAX },
+ { 0x44, ULONGEST_MAX },
+ { 0x24, ULONGEST_MAX },
+ { 0x0c, ULONGEST_MAX },
+ /* movl %eax, 0x4(%esp) */
+ { 0x89, ULONGEST_MAX },
+ { 0x44, ULONGEST_MAX },
+ { 0x24, ULONGEST_MAX },
+ { 0x04, ULONGEST_MAX },
+ /* movl $0x127, %eax # __sigreturn14 */
+ { 0xb8, ULONGEST_MAX },
+ { 0x27, ULONGEST_MAX },
+ { 0x01, ULONGEST_MAX },
+ { 0x00, ULONGEST_MAX },
+ { 0x00, ULONGEST_MAX },
+ /* int $0x80 */
+ { 0xcd, ULONGEST_MAX },
+ { 0x80, ULONGEST_MAX },
+ /* movl %eax, 0x4(%esp) */
+ { 0x89, ULONGEST_MAX },
+ { 0x44, ULONGEST_MAX },
+ { 0x24, ULONGEST_MAX },
+ { 0x04, ULONGEST_MAX },
+ /* movl $0x1, %eax */
+ { 0xb8, ULONGEST_MAX },
+ { 0x01, ULONGEST_MAX },
+ { 0x00, ULONGEST_MAX },
+ { 0x00, ULONGEST_MAX },
+ { 0x00, ULONGEST_MAX },
+ /* int $0x80 */
+ { 0xcd, ULONGEST_MAX },
+ { 0x80, ULONGEST_MAX },
+ { TRAMP_SENTINEL_INSN, ULONGEST_MAX } },
+ i386nbsd_sigtramp_cache_init };
+
+static const struct tramp_frame i386nbsd_sigtramp_si2
+ = { SIGTRAMP_FRAME,
+ 1,
+ { /* movl 8(%esp),%eax */
+ { 0x8b, ULONGEST_MAX },
+ { 0x44, ULONGEST_MAX },
+ { 0x24, ULONGEST_MAX },
+ { 0x08, ULONGEST_MAX },
+ /* movl %eax, 0x4(%esp) */
+ { 0x89, ULONGEST_MAX },
+ { 0x44, ULONGEST_MAX },
+ { 0x24, ULONGEST_MAX },
+ { 0x04, ULONGEST_MAX },
+ /* movl $0x134, %eax # setcontext */
+ { 0xb8, ULONGEST_MAX },
+ { 0x34, ULONGEST_MAX },
+ { 0x01, ULONGEST_MAX },
+ { 0x00, ULONGEST_MAX },
+ { 0x00, ULONGEST_MAX },
+ /* int $0x80 */
+ { 0xcd, ULONGEST_MAX },
+ { 0x80, ULONGEST_MAX },
+ /* movl %eax, 0x4(%esp) */
+ { 0x89, ULONGEST_MAX },
+ { 0x44, ULONGEST_MAX },
+ { 0x24, ULONGEST_MAX },
+ { 0x04, ULONGEST_MAX },
+ /* movl $0x1, %eax */
+ { 0xb8, ULONGEST_MAX },
+ { 0x01, ULONGEST_MAX },
+ { 0x00, ULONGEST_MAX },
+ { 0x00, ULONGEST_MAX },
+ { 0x00, ULONGEST_MAX },
+ /* int $0x80 */
+ { 0xcd, ULONGEST_MAX },
+ { 0x80, ULONGEST_MAX },
+ { TRAMP_SENTINEL_INSN, ULONGEST_MAX } },
+ i386nbsd_sigtramp_cache_init };
+
+static const struct tramp_frame i386nbsd_sigtramp_si31
+ = { SIGTRAMP_FRAME,
+ 1,
+ { /* leal 0x8c(%esp), %eax */
+ { 0x8d, ULONGEST_MAX },
+ { 0x84, ULONGEST_MAX },
+ { 0x24, ULONGEST_MAX },
+ { 0x8c, ULONGEST_MAX },
+ { 0x00, ULONGEST_MAX },
+ { 0x00, ULONGEST_MAX },
+ { 0x00, ULONGEST_MAX },
+ /* movl %eax, 0x4(%esp) */
+ { 0x89, ULONGEST_MAX },
+ { 0x44, ULONGEST_MAX },
+ { 0x24, ULONGEST_MAX },
+ { 0x04, ULONGEST_MAX },
+ /* movl $0x134, %eax # setcontext */
+ { 0xb8, ULONGEST_MAX },
+ { 0x34, ULONGEST_MAX },
+ { 0x01, ULONGEST_MAX },
+ { 0x00, ULONGEST_MAX },
+ { 0x00, ULONGEST_MAX },
+ /* int $0x80 */
+ { 0xcd, ULONGEST_MAX },
+ { 0x80, ULONGEST_MAX },
+ /* movl %eax, 0x4(%esp) */
+ { 0x89, ULONGEST_MAX },
+ { 0x44, ULONGEST_MAX },
+ { 0x24, ULONGEST_MAX },
+ { 0x04, ULONGEST_MAX },
+ /* movl $0x1, %eax */
+ { 0xb8, ULONGEST_MAX },
+ { 0x01, ULONGEST_MAX },
+ { 0x00, ULONGEST_MAX },
+ { 0x00, ULONGEST_MAX },
+ { 0x00, ULONGEST_MAX },
+ /* int $0x80 */
+ { 0xcd, ULONGEST_MAX },
+ { 0x80, ULONGEST_MAX },
+ { TRAMP_SENTINEL_INSN, ULONGEST_MAX } },
+ i386nbsd_sigtramp_cache_init };
+
+static const struct tramp_frame i386nbsd_sigtramp_si4
+ = { SIGTRAMP_FRAME,
+ 1,
+ { /* leal 0x8c(%esp), %eax */
+ { 0x8d, ULONGEST_MAX },
+ { 0x84, ULONGEST_MAX },
+ { 0x24, ULONGEST_MAX },
+ { 0x8c, ULONGEST_MAX },
+ { 0x00, ULONGEST_MAX },
+ { 0x00, ULONGEST_MAX },
+ { 0x00, ULONGEST_MAX },
+ /* movl %eax, 0x4(%esp) */
+ { 0x89, ULONGEST_MAX },
+ { 0x44, ULONGEST_MAX },
+ { 0x24, ULONGEST_MAX },
+ { 0x04, ULONGEST_MAX },
+ /* movl $0x134, %eax # setcontext */
+ { 0xb8, ULONGEST_MAX },
+ { 0x34, ULONGEST_MAX },
+ { 0x01, ULONGEST_MAX },
+ { 0x00, ULONGEST_MAX },
+ { 0x00, ULONGEST_MAX },
+ /* int $0x80 */
+ { 0xcd, ULONGEST_MAX },
+ { 0x80, ULONGEST_MAX },
+ /* movl $0xffffffff,0x4(%esp) */
+ { 0xc7, ULONGEST_MAX },
+ { 0x44, ULONGEST_MAX },
+ { 0x24, ULONGEST_MAX },
+ { 0x04, ULONGEST_MAX },
+ { 0xff, ULONGEST_MAX },
+ { 0xff, ULONGEST_MAX },
+ { 0xff, ULONGEST_MAX },
+ { 0xff, ULONGEST_MAX },
+ /* movl $0x1, %eax */
+ { 0xb8, ULONGEST_MAX },
+ { 0x01, ULONGEST_MAX },
+ { 0x00, ULONGEST_MAX },
+ { 0x00, ULONGEST_MAX },
+ { 0x00, ULONGEST_MAX },
+ /* int $0x80 */
+ { 0xcd, ULONGEST_MAX },
+ { 0x80, ULONGEST_MAX },
+ { TRAMP_SENTINEL_INSN, ULONGEST_MAX } },
+ i386nbsd_sigtramp_cache_init };
static void
i386nbsd_sigtramp_cache_init (const struct tramp_frame *self,
@@ -367,9 +344,8 @@ i386nbsd_sigtramp_cache_init (const struct tramp_frame *self,
/* Construct the frame ID using the function start. */
trad_frame_set_id (this_cache, frame_id_build (sp, func));
}
-
-static void
+static void
i386nbsd_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
{
i386_gdbarch_tdep *tdep = gdbarch_tdep<i386_gdbarch_tdep> (gdbarch);
@@ -388,7 +364,7 @@ i386nbsd_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
tdep->struct_return = reg_struct_return;
/* NetBSD uses tramp_frame sniffers for signal trampolines. */
- tdep->sigcontext_addr= 0;
+ tdep->sigcontext_addr = 0;
tdep->sigtramp_start = 0;
tdep->sigtramp_end = 0;
tdep->sigtramp_p = 0;
@@ -416,14 +392,15 @@ i386nbsdelf_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
i386_elf_init_abi (info, gdbarch);
/* NetBSD ELF uses SVR4-style shared libraries. */
- set_solib_svr4_fetch_link_map_offsets
- (gdbarch, svr4_ilp32_fetch_link_map_offsets);
+ set_solib_svr4_fetch_link_map_offsets (gdbarch,
+ svr4_ilp32_fetch_link_map_offsets);
/* NetBSD ELF uses -fpcc-struct-return by default. */
tdep->struct_return = pcc_struct_return;
}
void _initialize_i386nbsd_tdep ();
+
void
_initialize_i386nbsd_tdep ()
{
diff --git a/gdb/i386-nto-tdep.c b/gdb/i386-nto-tdep.c
index b5d5ac1c293..74dc35aa2ee 100644
--- a/gdb/i386-nto-tdep.c
+++ b/gdb/i386-nto-tdep.c
@@ -44,21 +44,20 @@
format and GDB's register cache layout. */
/* From <x86/context.h>. */
-static int i386nto_gregset_reg_offset[] =
-{
- 7 * 4, /* %eax */
- 6 * 4, /* %ecx */
- 5 * 4, /* %edx */
- 4 * 4, /* %ebx */
- 11 * 4, /* %esp */
- 2 * 4, /* %epb */
- 1 * 4, /* %esi */
- 0 * 4, /* %edi */
- 8 * 4, /* %eip */
- 10 * 4, /* %eflags */
- 9 * 4, /* %cs */
- 12 * 4, /* %ss */
- -1 /* filler */
+static int i386nto_gregset_reg_offset[] = {
+ 7 * 4, /* %eax */
+ 6 * 4, /* %ecx */
+ 5 * 4, /* %edx */
+ 4 * 4, /* %ebx */
+ 11 * 4, /* %esp */
+ 2 * 4, /* %epb */
+ 1 * 4, /* %esi */
+ 0 * 4, /* %edi */
+ 8 * 4, /* %eip */
+ 10 * 4, /* %eflags */
+ 9 * 4, /* %cs */
+ 12 * 4, /* %ss */
+ -1 /* filler */
};
/* Given a GDB register number REGNUM, return the offset into
@@ -80,8 +79,8 @@ i386nto_supply_gregset (struct regcache *regcache, char *gpregs)
i386_gdbarch_tdep *tdep = gdbarch_tdep<i386_gdbarch_tdep> (gdbarch);
gdb_assert (tdep->gregset_reg_offset == i386nto_gregset_reg_offset);
- i386_gregset.supply_regset (&i386_gregset, regcache, -1,
- gpregs, NUM_GPREGS * 4);
+ i386_gregset.supply_regset (&i386_gregset, regcache, -1, gpregs,
+ NUM_GPREGS * 4);
}
static void
@@ -119,12 +118,12 @@ i386nto_regset_id (int regno)
else if (regno < I386_SSE_NUM_REGS)
return NTO_REG_FLOAT; /* We store xmm registers in fxsave_area. */
- return -1; /* Error. */
+ return -1; /* Error. */
}
static int
-i386nto_register_area (struct gdbarch *gdbarch,
- int regno, int regset, unsigned *off)
+i386nto_register_area (struct gdbarch *gdbarch, int regno, int regset,
+ unsigned *off)
{
i386_gdbarch_tdep *tdep = gdbarch_tdep<i386_gdbarch_tdep> (gdbarch);
@@ -308,8 +307,7 @@ init_i386nto_ops (void)
nto_supply_regset = i386nto_supply_regset;
nto_register_area = i386nto_register_area;
nto_regset_fill = i386nto_regset_fill;
- nto_fetch_link_map_offsets =
- svr4_ilp32_fetch_link_map_offsets;
+ nto_fetch_link_map_offsets = svr4_ilp32_fetch_link_map_offsets;
}
static void
@@ -338,10 +336,10 @@ i386nto_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
tdep->sc_num_regs = ARRAY_SIZE (i386nto_gregset_reg_offset);
/* Setjmp()'s return PC saved in EDX (5). */
- tdep->jb_pc_offset = 20; /* 5x32 bit ints in. */
+ tdep->jb_pc_offset = 20; /* 5x32 bit ints in. */
- set_solib_svr4_fetch_link_map_offsets
- (gdbarch, svr4_ilp32_fetch_link_map_offsets);
+ set_solib_svr4_fetch_link_map_offsets (gdbarch,
+ svr4_ilp32_fetch_link_map_offsets);
/* Initialize this lazily, to avoid an initialization order
dependency on solib-svr4.c's _initialize routine. */
@@ -354,12 +352,10 @@ i386nto_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
= nto_relocate_section_addresses;
/* Supply a nice function to find our solibs. */
- nto_svr4_so_ops.find_and_open_solib
- = nto_find_and_open_solib;
+ nto_svr4_so_ops.find_and_open_solib = nto_find_and_open_solib;
/* Our linker code is in libc. */
- nto_svr4_so_ops.in_dynsym_resolve_code
- = nto_in_dynsym_resolve_code;
+ nto_svr4_so_ops.in_dynsym_resolve_code = nto_in_dynsym_resolve_code;
}
set_gdbarch_so_ops (gdbarch, &nto_svr4_so_ops);
@@ -368,6 +364,7 @@ i386nto_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
}
void _initialize_i386nto_tdep ();
+
void
_initialize_i386nto_tdep ()
{
diff --git a/gdb/i386-obsd-nat.c b/gdb/i386-obsd-nat.c
index 4b70e6df770..61709ae90cd 100644
--- a/gdb/i386-obsd-nat.c
+++ b/gdb/i386-obsd-nat.c
@@ -58,7 +58,7 @@ i386obsd_supply_pcb (struct regcache *regcache, struct pcb *pcb)
if (pcb->pcb_esp == 0)
return 0;
- /* Read the stack frame, and check its validity. We do this by
+ /* Read the stack frame, and check its validity. We do this by
checking if the saved interrupt priority level in the stack frame
looks reasonable.. */
#ifdef PCB_SAVECTX
@@ -77,8 +77,8 @@ i386obsd_supply_pcb (struct regcache *regcache, struct pcb *pcb)
{
/* No, the pcb must have been last updated by savectx(). */
pcb->pcb_esp = pcb->pcb_ebp;
- pcb->pcb_ebp = read_memory_integer(pcb->pcb_esp, 4, byte_order);
- sf.sf_eip = read_memory_integer(pcb->pcb_esp + 4, 4, byte_order);
+ pcb->pcb_ebp = read_memory_integer (pcb->pcb_esp, 4, byte_order);
+ sf.sf_eip = read_memory_integer (pcb->pcb_esp + 4, 4, byte_order);
regcache->raw_supply (I386_EIP_REGNUM, &sf.sf_eip);
}
@@ -91,6 +91,7 @@ i386obsd_supply_pcb (struct regcache *regcache, struct pcb *pcb)
static i386_bsd_nat_target<obsd_nat_target> the_i386_obsd_nat_target;
void _initialize_i386obsd_nat ();
+
void
_initialize_i386obsd_nat ()
{
diff --git a/gdb/i386-obsd-tdep.c b/gdb/i386-obsd-tdep.c
index c8fc663cafa..14e768841ae 100644
--- a/gdb/i386-obsd-tdep.c
+++ b/gdb/i386-obsd-tdep.c
@@ -53,12 +53,10 @@
static const int i386obsd_page_size = 4096;
/* Offset for sigreturn(2). */
-static const int i386obsd_sigreturn_offset[] = {
- 0x0a, /* OpenBSD 3.2 */
- 0x14, /* OpenBSD 3.6 */
- 0x3a, /* OpenBSD 3.8 */
- -1
-};
+static const int i386obsd_sigreturn_offset[] = { 0x0a, /* OpenBSD 3.2 */
+ 0x14, /* OpenBSD 3.6 */
+ 0x3a, /* OpenBSD 3.8 */
+ -1 };
/* Return whether THIS_FRAME corresponds to an OpenBSD sigtramp
routine. */
@@ -69,11 +67,9 @@ i386obsd_sigtramp_p (frame_info_ptr this_frame)
CORE_ADDR pc = get_frame_pc (this_frame);
CORE_ADDR start_pc = (pc & ~(i386obsd_page_size - 1));
/* The call sequence invoking sigreturn(2). */
- const gdb_byte sigreturn[] =
- {
- 0xb8,
- 0x67, 0x00, 0x00, 0x00, /* movl $SYS_sigreturn, %eax */
- 0xcd, 0x80 /* int $0x80 */
+ const gdb_byte sigreturn[] = {
+ 0xb8, 0x67, 0x00, 0x00, 0x00, /* movl $SYS_sigreturn, %eax */
+ 0xcd, 0x80 /* int $0x80 */
};
size_t buflen = sizeof sigreturn;
const int *offset;
@@ -99,7 +95,7 @@ i386obsd_sigtramp_p (frame_info_ptr this_frame)
{
/* If we can't read the instructions, return zero. */
if (!safe_frame_unwind_memory (this_frame, start_pc + *offset,
- {buf, buflen}))
+ { buf, buflen }))
return 0;
/* Check for sigreturn(2). */
@@ -109,86 +105,80 @@ i386obsd_sigtramp_p (frame_info_ptr this_frame)
return 0;
}
-
+
/* Mapping between the general-purpose registers in `struct reg'
format and GDB's register cache layout. */
/* From <machine/reg.h>. */
-static int i386obsd_r_reg_offset[] =
-{
- 0 * 4, /* %eax */
- 1 * 4, /* %ecx */
- 2 * 4, /* %edx */
- 3 * 4, /* %ebx */
- 4 * 4, /* %esp */
- 5 * 4, /* %ebp */
- 6 * 4, /* %esi */
- 7 * 4, /* %edi */
- 8 * 4, /* %eip */
- 9 * 4, /* %eflags */
- 10 * 4, /* %cs */
- 11 * 4, /* %ss */
- 12 * 4, /* %ds */
- 13 * 4, /* %es */
- 14 * 4, /* %fs */
- 15 * 4 /* %gs */
+static int i386obsd_r_reg_offset[] = {
+ 0 * 4, /* %eax */
+ 1 * 4, /* %ecx */
+ 2 * 4, /* %edx */
+ 3 * 4, /* %ebx */
+ 4 * 4, /* %esp */
+ 5 * 4, /* %ebp */
+ 6 * 4, /* %esi */
+ 7 * 4, /* %edi */
+ 8 * 4, /* %eip */
+ 9 * 4, /* %eflags */
+ 10 * 4, /* %cs */
+ 11 * 4, /* %ss */
+ 12 * 4, /* %ds */
+ 13 * 4, /* %es */
+ 14 * 4, /* %fs */
+ 15 * 4 /* %gs */
};
-
-
/* Sigtramp routine location for OpenBSD 3.1 and earlier releases. */
CORE_ADDR i386obsd_sigtramp_start_addr = 0xbfbfdf20;
CORE_ADDR i386obsd_sigtramp_end_addr = 0xbfbfdff0;
/* From <machine/signal.h>. */
-int i386obsd_sc_reg_offset[I386_NUM_GREGS] =
-{
- 10 * 4, /* %eax */
- 9 * 4, /* %ecx */
- 8 * 4, /* %edx */
- 7 * 4, /* %ebx */
- 14 * 4, /* %esp */
- 6 * 4, /* %ebp */
- 5 * 4, /* %esi */
- 4 * 4, /* %edi */
- 11 * 4, /* %eip */
- 13 * 4, /* %eflags */
- 12 * 4, /* %cs */
- 15 * 4, /* %ss */
- 3 * 4, /* %ds */
- 2 * 4, /* %es */
- 1 * 4, /* %fs */
- 0 * 4 /* %gs */
+int i386obsd_sc_reg_offset[I386_NUM_GREGS] = {
+ 10 * 4, /* %eax */
+ 9 * 4, /* %ecx */
+ 8 * 4, /* %edx */
+ 7 * 4, /* %ebx */
+ 14 * 4, /* %esp */
+ 6 * 4, /* %ebp */
+ 5 * 4, /* %esi */
+ 4 * 4, /* %edi */
+ 11 * 4, /* %eip */
+ 13 * 4, /* %eflags */
+ 12 * 4, /* %cs */
+ 15 * 4, /* %ss */
+ 3 * 4, /* %ds */
+ 2 * 4, /* %es */
+ 1 * 4, /* %fs */
+ 0 * 4 /* %gs */
};
/* From /usr/src/lib/libpthread/arch/i386/uthread_machdep.c. */
-static int i386obsd_uthread_reg_offset[] =
-{
- 11 * 4, /* %eax */
- 10 * 4, /* %ecx */
- 9 * 4, /* %edx */
- 8 * 4, /* %ebx */
- -1, /* %esp */
- 6 * 4, /* %ebp */
- 5 * 4, /* %esi */
- 4 * 4, /* %edi */
- 12 * 4, /* %eip */
- -1, /* %eflags */
- 13 * 4, /* %cs */
- -1, /* %ss */
- 3 * 4, /* %ds */
- 2 * 4, /* %es */
- 1 * 4, /* %fs */
- 0 * 4 /* %gs */
+static int i386obsd_uthread_reg_offset[] = {
+ 11 * 4, /* %eax */
+ 10 * 4, /* %ecx */
+ 9 * 4, /* %edx */
+ 8 * 4, /* %ebx */
+ -1, /* %esp */
+ 6 * 4, /* %ebp */
+ 5 * 4, /* %esi */
+ 4 * 4, /* %edi */
+ 12 * 4, /* %eip */
+ -1, /* %eflags */
+ 13 * 4, /* %cs */
+ -1, /* %ss */
+ 3 * 4, /* %ds */
+ 2 * 4, /* %es */
+ 1 * 4, /* %fs */
+ 0 * 4 /* %gs */
};
/* Offset within the thread structure where we can find the saved
stack pointer (%esp). */
-#define I386OBSD_UTHREAD_ESP_OFFSET 176
+#define I386OBSD_UTHREAD_ESP_OFFSET 176
static void
-i386obsd_supply_uthread (struct regcache *regcache,
- int regnum, CORE_ADDR addr)
+i386obsd_supply_uthread (struct regcache *regcache, int regnum, CORE_ADDR addr)
{
struct gdbarch *gdbarch = regcache->arch ();
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
@@ -231,8 +221,8 @@ i386obsd_supply_uthread (struct regcache *regcache,
}
static void
-i386obsd_collect_uthread (const struct regcache *regcache,
- int regnum, CORE_ADDR addr)
+i386obsd_collect_uthread (const struct regcache *regcache, int regnum,
+ CORE_ADDR addr)
{
struct gdbarch *gdbarch = regcache->arch ();
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
@@ -277,29 +267,28 @@ i386obsd_collect_uthread (const struct regcache *regcache,
}
}
}
-
+
/* Kernel debugging support. */
/* From <machine/frame.h>. Note that %esp and %ess are only saved in
a trap frame when entering the kernel from user space. */
-static int i386obsd_tf_reg_offset[] =
-{
- 10 * 4, /* %eax */
- 9 * 4, /* %ecx */
- 8 * 4, /* %edx */
- 7 * 4, /* %ebx */
- -1, /* %esp */
- 6 * 4, /* %ebp */
- 5 * 4, /* %esi */
- 4 * 4, /* %edi */
- 13 * 4, /* %eip */
- 15 * 4, /* %eflags */
- 14 * 4, /* %cs */
- -1, /* %ss */
- 3 * 4, /* %ds */
- 2 * 4, /* %es */
- 0 * 4, /* %fs */
- 1 * 4 /* %gs */
+static int i386obsd_tf_reg_offset[] = {
+ 10 * 4, /* %eax */
+ 9 * 4, /* %ecx */
+ 8 * 4, /* %edx */
+ 7 * 4, /* %ebx */
+ -1, /* %esp */
+ 6 * 4, /* %ebp */
+ 5 * 4, /* %esi */
+ 4 * 4, /* %edi */
+ 13 * 4, /* %eip */
+ 15 * 4, /* %eflags */
+ 14 * 4, /* %cs */
+ -1, /* %ss */
+ 3 * 4, /* %ds */
+ 2 * 4, /* %es */
+ 0 * 4, /* %fs */
+ 1 * 4 /* %gs */
};
static struct trad_frame_cache *
@@ -324,7 +313,7 @@ i386obsd_trapframe_cache (frame_info_ptr this_frame, void **this_cache)
find_pc_partial_function (func, &name, NULL, NULL);
if (name && startswith (name, "Xintr"))
- addr = sp + 8; /* It's an interrupt frame. */
+ addr = sp + 8; /* It's an interrupt frame. */
else
addr = sp;
@@ -350,21 +339,21 @@ i386obsd_trapframe_cache (frame_info_ptr this_frame, void **this_cache)
}
static void
-i386obsd_trapframe_this_id (frame_info_ptr this_frame,
- void **this_cache, struct frame_id *this_id)
+i386obsd_trapframe_this_id (frame_info_ptr this_frame, void **this_cache,
+ struct frame_id *this_id)
{
- struct trad_frame_cache *cache =
- i386obsd_trapframe_cache (this_frame, this_cache);
-
+ struct trad_frame_cache *cache
+ = i386obsd_trapframe_cache (this_frame, this_cache);
+
trad_frame_get_id (cache, this_id);
}
static struct value *
-i386obsd_trapframe_prev_register (frame_info_ptr this_frame,
- void **this_cache, int regnum)
+i386obsd_trapframe_prev_register (frame_info_ptr this_frame, void **this_cache,
+ int regnum)
{
- struct trad_frame_cache *cache =
- i386obsd_trapframe_cache (this_frame, this_cache);
+ struct trad_frame_cache *cache
+ = i386obsd_trapframe_cache (this_frame, this_cache);
return trad_frame_get_register (cache, this_frame, regnum);
}
@@ -384,27 +373,21 @@ i386obsd_trapframe_sniffer (const struct frame_unwind *self,
return 0;
find_pc_partial_function (get_frame_pc (this_frame), &name, NULL, NULL);
- return (name && (strcmp (name, "calltrap") == 0
- || strcmp (name, "syscall1") == 0
- || startswith (name, "Xintr")
- || startswith (name, "Xsoft")));
+ return (name
+ && (strcmp (name, "calltrap") == 0 || strcmp (name, "syscall1") == 0
+ || startswith (name, "Xintr") || startswith (name, "Xsoft")));
}
-static const struct frame_unwind i386obsd_trapframe_unwind = {
- "i386 openbsd trap",
- /* FIXME: kettenis/20051219: This really is more like an interrupt
+static const struct frame_unwind i386obsd_trapframe_unwind
+ = { "i386 openbsd trap",
+ /* FIXME: kettenis/20051219: This really is more like an interrupt
frame, but SIGTRAMP_FRAME would print <signal handler called>,
which really is not what we want here. */
- NORMAL_FRAME,
- default_frame_unwind_stop_reason,
- i386obsd_trapframe_this_id,
- i386obsd_trapframe_prev_register,
- NULL,
- i386obsd_trapframe_sniffer
-};
-
+ NORMAL_FRAME, default_frame_unwind_stop_reason,
+ i386obsd_trapframe_this_id, i386obsd_trapframe_prev_register, NULL,
+ i386obsd_trapframe_sniffer };
-static void
+static void
i386obsd_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
{
i386_gdbarch_tdep *tdep = gdbarch_tdep<i386_gdbarch_tdep> (gdbarch);
@@ -440,11 +423,12 @@ i386obsd_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
frame_unwind_prepend_unwinder (gdbarch, &i386obsd_trapframe_unwind);
/* OpenBSD ELF uses SVR4-style shared libraries. */
- set_solib_svr4_fetch_link_map_offsets
- (gdbarch, svr4_ilp32_fetch_link_map_offsets);
+ set_solib_svr4_fetch_link_map_offsets (gdbarch,
+ svr4_ilp32_fetch_link_map_offsets);
}
void _initialize_i386obsd_tdep ();
+
void
_initialize_i386obsd_tdep ()
{
diff --git a/gdb/i386-sol2-nat.c b/gdb/i386-sol2-nat.c
index 2f01ac6e4bb..277e8ddf193 100644
--- a/gdb/i386-sol2-nat.c
+++ b/gdb/i386-sol2-nat.c
@@ -52,51 +52,45 @@
/* From <sys/regset.h>. */
static int amd64_sol2_gregset64_reg_offset[] = {
- 14 * 8, /* %rax */
- 11 * 8, /* %rbx */
- 13 * 8, /* %rcx */
- 12 * 8, /* %rdx */
- 9 * 8, /* %rsi */
- 8 * 8, /* %rdi */
- 10 * 8, /* %rbp */
- 20 * 8, /* %rsp */
- 7 * 8, /* %r8 ... */
- 6 * 8,
- 5 * 8,
- 4 * 8,
- 3 * 8,
- 2 * 8,
- 1 * 8,
- 0 * 8, /* ... %r15 */
- 17 * 8, /* %rip */
- 19 * 8, /* %eflags */
- 18 * 8, /* %cs */
- 21 * 8, /* %ss */
- 25 * 8, /* %ds */
- 24 * 8, /* %es */
- 22 * 8, /* %fs */
- 23 * 8 /* %gs */
+ 14 * 8, /* %rax */
+ 11 * 8, /* %rbx */
+ 13 * 8, /* %rcx */
+ 12 * 8, /* %rdx */
+ 9 * 8, /* %rsi */
+ 8 * 8, /* %rdi */
+ 10 * 8, /* %rbp */
+ 20 * 8, /* %rsp */
+ 7 * 8, /* %r8 ... */
+ 6 * 8, 5 * 8, 4 * 8, 3 * 8, 2 * 8, 1 * 8, 0 * 8, /* ... %r15 */
+ 17 * 8, /* %rip */
+ 19 * 8, /* %eflags */
+ 18 * 8, /* %cs */
+ 21 * 8, /* %ss */
+ 25 * 8, /* %ds */
+ 24 * 8, /* %es */
+ 22 * 8, /* %fs */
+ 23 * 8 /* %gs */
};
/* 32-bit registers are provided by Solaris in 64-bit format, so just
give a subset of the list above. */
static int amd64_sol2_gregset32_reg_offset[] = {
- 14 * 8, /* %eax */
- 13 * 8, /* %ecx */
- 12 * 8, /* %edx */
- 11 * 8, /* %ebx */
- 20 * 8, /* %esp */
- 10 * 8, /* %ebp */
- 9 * 8, /* %esi */
- 8 * 8, /* %edi */
- 17 * 8, /* %eip */
- 19 * 8, /* %eflags */
- 18 * 8, /* %cs */
- 21 * 8, /* %ss */
- 25 * 8, /* %ds */
- 24 * 8, /* %es */
- 22 * 8, /* %fs */
- 23 * 8 /* %gs */
+ 14 * 8, /* %eax */
+ 13 * 8, /* %ecx */
+ 12 * 8, /* %edx */
+ 11 * 8, /* %ebx */
+ 20 * 8, /* %esp */
+ 10 * 8, /* %ebp */
+ 9 * 8, /* %esi */
+ 8 * 8, /* %edi */
+ 17 * 8, /* %eip */
+ 19 * 8, /* %eflags */
+ 18 * 8, /* %cs */
+ 21 * 8, /* %ss */
+ 25 * 8, /* %ds */
+ 24 * 8, /* %es */
+ 22 * 8, /* %fs */
+ 23 * 8 /* %gs */
};
void
@@ -112,15 +106,14 @@ supply_fpregset (struct regcache *regcache, const prfpregset_t *fpregs)
}
void
-fill_gregset (const struct regcache *regcache,
- prgregset_t *gregs, int regnum)
+fill_gregset (const struct regcache *regcache, prgregset_t *gregs, int regnum)
{
amd64_collect_native_gregset (regcache, gregs, regnum);
}
void
-fill_fpregset (const struct regcache *regcache,
- prfpregset_t *fpregs, int regnum)
+fill_fpregset (const struct regcache *regcache, prfpregset_t *fpregs,
+ int regnum)
{
amd64_collect_fxsave (regcache, regnum, fpregs);
}
@@ -176,24 +169,11 @@ fill_fpregset (const struct regcache *regcache,
/* Mapping between the general-purpose registers in `/proc'
format and GDB's register array layout. */
-static int regmap[] =
-{
- 11 /* EAX */,
- 10 /* ECX */,
- 9 /* EDX */,
- 8 /* EBX */,
- 17 /* UESP */,
- 6 /* EBP */,
- 5 /* ESI */,
- 4 /* EDI */,
- 14 /* EIP */,
- 16 /* EFL */,
- 15 /* CS */,
- 18 /* SS */,
- 3 /* DS */,
- 2 /* ES */,
- 1 /* FS */,
- 0 /* GS */
+static int regmap[] = {
+ 11 /* EAX */, 10 /* ECX */, 9 /* EDX */, 8 /* EBX */,
+ 17 /* UESP */, 6 /* EBP */, 5 /* ESI */, 4 /* EDI */,
+ 14 /* EIP */, 16 /* EFL */, 15 /* CS */, 18 /* SS */,
+ 3 /* DS */, 2 /* ES */, 1 /* FS */, 0 /* GS */
};
/* Fill GDB's register array with the general-purpose register values
@@ -214,8 +194,7 @@ supply_gregset (struct regcache *regcache, const gregset_t *gregsetp)
do this for all registers. */
void
-fill_gregset (const struct regcache *regcache,
- gregset_t *gregsetp, int regnum)
+fill_gregset (const struct regcache *regcache, gregset_t *gregsetp, int regnum)
{
greg_t *regp = (greg_t *) gregsetp;
int i;
@@ -242,8 +221,8 @@ supply_fpregset (struct regcache *regcache, const fpregset_t *fpregsetp)
do this for all registers. */
void
-fill_fpregset (const struct regcache *regcache,
- fpregset_t *fpregsetp, int regno)
+fill_fpregset (const struct regcache *regcache, fpregset_t *fpregsetp,
+ int regno)
{
if (gdbarch_fp0_regnum (regcache->arch ()) == 0)
return;
@@ -254,15 +233,16 @@ fill_fpregset (const struct regcache *regcache,
#endif
void _initialize_amd64_sol2_nat ();
+
void
_initialize_amd64_sol2_nat ()
{
#if PR_MODEL_NATIVE == PR_MODEL_LP64
amd64_native_gregset32_reg_offset = amd64_sol2_gregset32_reg_offset;
- amd64_native_gregset32_num_regs =
- ARRAY_SIZE (amd64_sol2_gregset32_reg_offset);
+ amd64_native_gregset32_num_regs
+ = ARRAY_SIZE (amd64_sol2_gregset32_reg_offset);
amd64_native_gregset64_reg_offset = amd64_sol2_gregset64_reg_offset;
- amd64_native_gregset64_num_regs =
- ARRAY_SIZE (amd64_sol2_gregset64_reg_offset);
+ amd64_native_gregset64_num_regs
+ = ARRAY_SIZE (amd64_sol2_gregset64_reg_offset);
#endif
}
diff --git a/gdb/i386-sol2-tdep.c b/gdb/i386-sol2-tdep.c
index 5269804afee..d290e05a8d0 100644
--- a/gdb/i386-sol2-tdep.c
+++ b/gdb/i386-sol2-tdep.c
@@ -26,24 +26,23 @@
#include "solib-svr4.h"
/* From <ia32/sys/reg.h>. */
-static int i386_sol2_gregset_reg_offset[] =
-{
- 11 * 4, /* %eax */
- 10 * 4, /* %ecx */
- 9 * 4, /* %edx */
- 8 * 4, /* %ebx */
- 17 * 4, /* %esp */
- 6 * 4, /* %ebp */
- 5 * 4, /* %esi */
- 4 * 4, /* %edi */
- 14 * 4, /* %eip */
- 16 * 4, /* %eflags */
- 15 * 4, /* %cs */
- 18 * 4, /* %ss */
- 3 * 4, /* %ds */
- 2 * 4, /* %es */
- 1 * 4, /* %fs */
- 0 * 4 /* %gs */
+static int i386_sol2_gregset_reg_offset[] = {
+ 11 * 4, /* %eax */
+ 10 * 4, /* %ecx */
+ 9 * 4, /* %edx */
+ 8 * 4, /* %ebx */
+ 17 * 4, /* %esp */
+ 6 * 4, /* %ebp */
+ 5 * 4, /* %esi */
+ 4 * 4, /* %edi */
+ 14 * 4, /* %eip */
+ 16 * 4, /* %eflags */
+ 15 * 4, /* %cs */
+ 18 * 4, /* %ss */
+ 3 * 4, /* %ds */
+ 2 * 4, /* %es */
+ 1 * 4, /* %fs */
+ 0 * 4 /* %gs */
};
/* Solaris doesn't have a `struct sigcontext', but it does have a
@@ -87,10 +86,9 @@ i386_sol2_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
tdep->sc_num_regs = tdep->gregset_num_regs;
/* Solaris has SVR4-style shared libraries. */
- set_solib_svr4_fetch_link_map_offsets
- (gdbarch, svr4_ilp32_fetch_link_map_offsets);
+ set_solib_svr4_fetch_link_map_offsets (gdbarch,
+ svr4_ilp32_fetch_link_map_offsets);
}
-
static enum gdb_osabi
i386_sol2_osabi_sniffer (bfd *abfd)
@@ -104,6 +102,7 @@ i386_sol2_osabi_sniffer (bfd *abfd)
}
void _initialize_i386_sol2_tdep ();
+
void
_initialize_i386_sol2_tdep ()
{
diff --git a/gdb/i386-tdep.c b/gdb/i386-tdep.c
index 580664d2ce5..2bee6e971c1 100644
--- a/gdb/i386-tdep.c
+++ b/gdb/i386-tdep.c
@@ -72,91 +72,54 @@
/* Register names. */
-static const char * const i386_register_names[] =
-{
- "eax", "ecx", "edx", "ebx",
- "esp", "ebp", "esi", "edi",
- "eip", "eflags", "cs", "ss",
- "ds", "es", "fs", "gs",
- "st0", "st1", "st2", "st3",
- "st4", "st5", "st6", "st7",
- "fctrl", "fstat", "ftag", "fiseg",
- "fioff", "foseg", "fooff", "fop",
- "xmm0", "xmm1", "xmm2", "xmm3",
- "xmm4", "xmm5", "xmm6", "xmm7",
- "mxcsr"
-};
+static const char *const i386_register_names[]
+ = { "eax", "ecx", "edx", "ebx", "esp", "ebp", "esi",
+ "edi", "eip", "eflags", "cs", "ss", "ds", "es",
+ "fs", "gs", "st0", "st1", "st2", "st3", "st4",
+ "st5", "st6", "st7", "fctrl", "fstat", "ftag", "fiseg",
+ "fioff", "foseg", "fooff", "fop", "xmm0", "xmm1", "xmm2",
+ "xmm3", "xmm4", "xmm5", "xmm6", "xmm7", "mxcsr" };
-static const char * const i386_zmm_names[] =
-{
- "zmm0", "zmm1", "zmm2", "zmm3",
- "zmm4", "zmm5", "zmm6", "zmm7"
-};
+static const char *const i386_zmm_names[]
+ = { "zmm0", "zmm1", "zmm2", "zmm3", "zmm4", "zmm5", "zmm6", "zmm7" };
-static const char * const i386_zmmh_names[] =
-{
- "zmm0h", "zmm1h", "zmm2h", "zmm3h",
- "zmm4h", "zmm5h", "zmm6h", "zmm7h"
-};
+static const char *const i386_zmmh_names[]
+ = { "zmm0h", "zmm1h", "zmm2h", "zmm3h", "zmm4h", "zmm5h", "zmm6h", "zmm7h" };
-static const char * const i386_k_names[] =
-{
- "k0", "k1", "k2", "k3",
- "k4", "k5", "k6", "k7"
-};
+static const char *const i386_k_names[]
+ = { "k0", "k1", "k2", "k3", "k4", "k5", "k6", "k7" };
-static const char * const i386_ymm_names[] =
-{
- "ymm0", "ymm1", "ymm2", "ymm3",
- "ymm4", "ymm5", "ymm6", "ymm7",
+static const char *const i386_ymm_names[] = {
+ "ymm0", "ymm1", "ymm2", "ymm3", "ymm4", "ymm5", "ymm6", "ymm7",
};
-static const char * const i386_ymmh_names[] =
-{
- "ymm0h", "ymm1h", "ymm2h", "ymm3h",
- "ymm4h", "ymm5h", "ymm6h", "ymm7h",
+static const char *const i386_ymmh_names[] = {
+ "ymm0h", "ymm1h", "ymm2h", "ymm3h", "ymm4h", "ymm5h", "ymm6h", "ymm7h",
};
-static const char * const i386_mpx_names[] =
-{
- "bnd0raw", "bnd1raw", "bnd2raw", "bnd3raw", "bndcfgu", "bndstatus"
-};
+static const char *const i386_mpx_names[]
+ = { "bnd0raw", "bnd1raw", "bnd2raw", "bnd3raw", "bndcfgu", "bndstatus" };
-static const char * const i386_pkeys_names[] =
-{
- "pkru"
-};
+static const char *const i386_pkeys_names[] = { "pkru" };
/* Register names for MPX pseudo-registers. */
-static const char * const i386_bnd_names[] =
-{
- "bnd0", "bnd1", "bnd2", "bnd3"
-};
+static const char *const i386_bnd_names[] = { "bnd0", "bnd1", "bnd2", "bnd3" };
/* Register names for MMX pseudo-registers. */
-static const char * const i386_mmx_names[] =
-{
- "mm0", "mm1", "mm2", "mm3",
- "mm4", "mm5", "mm6", "mm7"
-};
+static const char *const i386_mmx_names[]
+ = { "mm0", "mm1", "mm2", "mm3", "mm4", "mm5", "mm6", "mm7" };
/* Register names for byte pseudo-registers. */
-static const char * const i386_byte_names[] =
-{
- "al", "cl", "dl", "bl",
- "ah", "ch", "dh", "bh"
-};
+static const char *const i386_byte_names[]
+ = { "al", "cl", "dl", "bl", "ah", "ch", "dh", "bh" };
/* Register names for word pseudo-registers. */
-static const char * const i386_word_names[] =
-{
- "ax", "cx", "dx", "bx",
- "", "bp", "si", "di"
-};
+static const char *const i386_word_names[]
+ = { "ax", "cx", "dx", "bx", "", "bp", "si", "di" };
/* Constant used for reading/writing pseudo registers. In 64-bit mode, we have
16 lower ZMM regs that extend corresponding xmm/ymm registers. In addition,
@@ -389,7 +352,7 @@ i386_fpc_regnum_p (struct gdbarch *gdbarch, int regnum)
if (I387_ST0_REGNUM (tdep) < 0)
return 0;
- return (I387_FCTRL_REGNUM (tdep) <= regnum
+ return (I387_FCTRL_REGNUM (tdep) <= regnum
&& regnum < I387_XMM0_REGNUM (tdep));
}
@@ -400,8 +363,8 @@ i386_bndr_regnum_p (struct gdbarch *gdbarch, int regnum)
{
i386_gdbarch_tdep *tdep = gdbarch_tdep<i386_gdbarch_tdep> (gdbarch);
- if (I387_BND0R_REGNUM (tdep) < 0)
- return 0;
+ if (I387_BND0R_REGNUM (tdep) < 0)
+ return 0;
regnum -= tdep->bnd0r_regnum;
return regnum >= 0 && regnum < I387_NUM_BND_REGS;
@@ -414,8 +377,8 @@ i386_mpx_ctrl_regnum_p (struct gdbarch *gdbarch, int regnum)
{
i386_gdbarch_tdep *tdep = gdbarch_tdep<i386_gdbarch_tdep> (gdbarch);
- if (I387_BNDCFGU_REGNUM (tdep) < 0)
- return 0;
+ if (I387_BNDCFGU_REGNUM (tdep) < 0)
+ return 0;
regnum -= I387_BNDCFGU_REGNUM (tdep);
return regnum >= 0 && regnum < I387_NUM_MPX_CTRL_REGS;
@@ -476,7 +439,7 @@ i386_pseudo_register_name (struct gdbarch *gdbarch, int regnum)
else if (i386_word_regnum_p (gdbarch, regnum))
return i386_word_names[regnum - tdep->ax_regnum];
- internal_error (_("invalid regnum"));
+ internal_error (_ ("invalid regnum"));
}
/* Convert a dbx register number REG to the appropriate register
@@ -498,7 +461,8 @@ i386_dbx_reg_to_regnum (struct gdbarch *gdbarch, int reg)
return 5;
else if (reg == 5)
return 4;
- else return reg;
+ else
+ return reg;
}
else if (reg >= 12 && reg <= 19)
{
@@ -510,8 +474,7 @@ i386_dbx_reg_to_regnum (struct gdbarch *gdbarch, int reg)
/* SSE registers. */
int ymm0_regnum = tdep->ymm0_regnum;
- if (ymm0_regnum >= 0
- && i386_xmm_regnum_p (gdbarch, reg))
+ if (ymm0_regnum >= 0 && i386_xmm_regnum_p (gdbarch, reg))
return reg - 21 + ymm0_regnum;
else
return reg - 21 + I387_XMM0_REGNUM (tdep);
@@ -557,15 +520,24 @@ i386_svr4_dwarf_reg_to_regnum (struct gdbarch *gdbarch, int reg)
switch (reg)
{
- case 37: return I387_FCTRL_REGNUM (tdep);
- case 38: return I387_FSTAT_REGNUM (tdep);
- case 39: return I387_MXCSR_REGNUM (tdep);
- case 40: return I386_ES_REGNUM;
- case 41: return I386_CS_REGNUM;
- case 42: return I386_SS_REGNUM;
- case 43: return I386_DS_REGNUM;
- case 44: return I386_FS_REGNUM;
- case 45: return I386_GS_REGNUM;
+ case 37:
+ return I387_FCTRL_REGNUM (tdep);
+ case 38:
+ return I387_FSTAT_REGNUM (tdep);
+ case 39:
+ return I387_MXCSR_REGNUM (tdep);
+ case 40:
+ return I386_ES_REGNUM;
+ case 41:
+ return I386_CS_REGNUM;
+ case 42:
+ return I386_SS_REGNUM;
+ case 43:
+ return I386_DS_REGNUM;
+ case 44:
+ return I386_FS_REGNUM;
+ case 45:
+ return I386_GS_REGNUM;
}
return -1;
@@ -584,20 +556,12 @@ i386_svr4_reg_to_regnum (struct gdbarch *gdbarch, int reg)
return regnum;
}
-
-
/* This is the variable that is set with "set disassembly-flavor", and
its legitimate values. */
static const char att_flavor[] = "att";
static const char intel_flavor[] = "intel";
-static const char *const valid_flavors[] =
-{
- att_flavor,
- intel_flavor,
- NULL
-};
+static const char *const valid_flavors[] = { att_flavor, intel_flavor, NULL };
static const char *disassembly_flavor = att_flavor;
-
/* Use the program counter to determine the contents and size of a
breakpoint instruction. Return a pointer to a string of bytes that
@@ -614,7 +578,6 @@ constexpr gdb_byte i386_break_insn[] = { 0xcc }; /* int 3 */
typedef BP_MANIPULATION (i386_break_insn) i386_breakpoint;
-
/* Displaced instruction handling. */
/* Skip the legacy instruction prefixes in INSN.
@@ -803,13 +766,12 @@ i386_insn_is_jump (struct gdbarch *gdbarch, CORE_ADDR addr)
/* Some kernels may run one past a syscall insn, so we have to cope. */
displaced_step_copy_insn_closure_up
-i386_displaced_step_copy_insn (struct gdbarch *gdbarch,
- CORE_ADDR from, CORE_ADDR to,
- struct regcache *regs)
+i386_displaced_step_copy_insn (struct gdbarch *gdbarch, CORE_ADDR from,
+ CORE_ADDR to, struct regcache *regs)
{
size_t len = gdbarch_max_insn_length (gdbarch);
- std::unique_ptr<i386_displaced_step_copy_insn_closure> closure
- (new i386_displaced_step_copy_insn_closure (len));
+ std::unique_ptr<i386_displaced_step_copy_insn_closure> closure (
+ new i386_displaced_step_copy_insn_closure (len));
gdb_byte *buf = closure->buf.data ();
read_memory (from, buf, len);
@@ -828,8 +790,8 @@ i386_displaced_step_copy_insn (struct gdbarch *gdbarch,
write_memory (to, buf, len);
- displaced_debug_printf ("%s->%s: %s",
- paddress (gdbarch, from), paddress (gdbarch, to),
+ displaced_debug_printf ("%s->%s: %s", paddress (gdbarch, from),
+ paddress (gdbarch, to),
displaced_step_dump_bytes (buf, len).c_str ());
/* This is a work around for a problem with g++ 4.8. */
@@ -842,8 +804,7 @@ i386_displaced_step_copy_insn (struct gdbarch *gdbarch,
void
i386_displaced_step_fixup (struct gdbarch *gdbarch,
struct displaced_step_copy_insn_closure *closure_,
- CORE_ADDR from, CORE_ADDR to,
- struct regcache *regs)
+ CORE_ADDR from, CORE_ADDR to, struct regcache *regs)
{
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
@@ -886,9 +847,8 @@ i386_displaced_step_fixup (struct gdbarch *gdbarch,
the displaced instruction; make it relative. Well, signal
handler returns don't need relocation either, but we use the
value of %eip to recognize those; see below. */
- if (! i386_absolute_jmp_p (insn)
- && ! i386_absolute_call_p (insn)
- && ! i386_ret_p (insn))
+ if (!i386_absolute_jmp_p (insn) && !i386_absolute_call_p (insn)
+ && !i386_ret_p (insn))
{
ULONGEST orig_eip;
int insn_len;
@@ -966,8 +926,8 @@ append_insns (CORE_ADDR *to, ULONGEST len, const gdb_byte *buf)
}
static void
-i386_relocate_instruction (struct gdbarch *gdbarch,
- CORE_ADDR *to, CORE_ADDR oldloc)
+i386_relocate_instruction (struct gdbarch *gdbarch, CORE_ADDR *to,
+ CORE_ADDR oldloc)
{
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
gdb_byte buf[I386_MAX_INSN_LEN];
@@ -977,8 +937,8 @@ i386_relocate_instruction (struct gdbarch *gdbarch,
read_memory (oldloc, buf, I386_MAX_INSN_LEN);
- insn_length = gdb_buffered_insn_length (gdbarch, insn,
- I386_MAX_INSN_LEN, oldloc);
+ insn_length
+ = gdb_buffered_insn_length (gdbarch, insn, I386_MAX_INSN_LEN, oldloc);
/* Get past the prefixes. */
insn = i386_skip_prefixes (insn, I386_MAX_INSN_LEN);
@@ -1038,7 +998,6 @@ i386_relocate_instruction (struct gdbarch *gdbarch,
append_insns (to, insn_length, buf);
}
-
#ifdef I386_REGNO_TO_SYMMETRY
#error "The Sequent Symmetry is no longer supported."
#endif
@@ -1049,7 +1008,7 @@ i386_relocate_instruction (struct gdbarch *gdbarch,
/* The maximum number of saved registers. This should include all
registers mentioned above, and %eip. */
-#define I386_NUM_SAVED_REGS I386_NUM_GREGS
+#define I386_NUM_SAVED_REGS I386_NUM_GREGS
struct i386_frame_cache
{
@@ -1182,7 +1141,7 @@ i386_analyze_struct_return (CORE_ADDR pc, CORE_ADDR current_pc,
if (target_read_code (pc, &op, 1))
return pc;
- if (op != 0x58) /* popl %eax */
+ if (op != 0x58) /* popl %eax */
return pc;
if (target_read_code (pc + 1, buf, 4))
@@ -1202,7 +1161,7 @@ i386_analyze_struct_return (CORE_ADDR pc, CORE_ADDR current_pc,
cache->pc_in_eax = 1;
return current_pc;
}
-
+
if (buf[1] == proto1[1])
return pc + 4;
else
@@ -1286,14 +1245,14 @@ i386_analyze_stack_align (CORE_ADDR pc, CORE_ADDR current_pc,
int reg;
int offset, offset_and;
static int regnums[8] = {
- I386_EAX_REGNUM, /* %eax */
- I386_ECX_REGNUM, /* %ecx */
- I386_EDX_REGNUM, /* %edx */
- I386_EBX_REGNUM, /* %ebx */
- I386_ESP_REGNUM, /* %esp */
- I386_EBP_REGNUM, /* %ebp */
- I386_ESI_REGNUM, /* %esi */
- I386_EDI_REGNUM /* %edi */
+ I386_EAX_REGNUM, /* %eax */
+ I386_ECX_REGNUM, /* %ecx */
+ I386_EDX_REGNUM, /* %edx */
+ I386_EBX_REGNUM, /* %ebx */
+ I386_ESP_REGNUM, /* %esp */
+ I386_EBP_REGNUM, /* %ebp */
+ I386_ESI_REGNUM, /* %esi */
+ I386_EDI_REGNUM /* %edi */
};
if (target_read_code (pc, buf, sizeof buf))
@@ -1328,7 +1287,7 @@ i386_analyze_stack_align (CORE_ADDR pc, CORE_ADDR current_pc,
/* MOD must be binary 10 and R/M must be binary 100. */
if ((buf[2] & 0xc7) != 0x44)
return pc;
-
+
/* REG has register number. Registers in pushl and leal have to
be the same. */
if (reg != ((buf[2] >> 3) & 7))
@@ -1342,8 +1301,7 @@ i386_analyze_stack_align (CORE_ADDR pc, CORE_ADDR current_pc,
return pc;
/* The next instruction has to be "andl $-XXX, %esp". */
- if (buf[offset + 1] != 0xe4
- || (buf[offset] != 0x81 && buf[offset] != 0x83))
+ if (buf[offset + 1] != 0xe4 || (buf[offset] != 0x81 && buf[offset] != 0x83))
return pc;
offset_and = offset;
@@ -1351,8 +1309,7 @@ i386_analyze_stack_align (CORE_ADDR pc, CORE_ADDR current_pc,
/* The next instruction has to be "pushl -4(%reg)". 8bit -4 is
0xfc. REG must be binary 110 and MOD must be binary 01. */
- if (buf[offset] != 0xff
- || buf[offset + 2] != 0xfc
+ if (buf[offset] != 0xff || buf[offset + 2] != 0xfc
|| (buf[offset + 1] & 0xf8) != 0x70)
return pc;
@@ -1368,7 +1325,7 @@ i386_analyze_stack_align (CORE_ADDR pc, CORE_ADDR current_pc,
}
/* Maximum instruction length we need to handle. */
-#define I386_MAX_MATCHED_INSN_LEN 6
+#define I386_MAX_MATCHED_INSN_LEN 6
/* Instruction description. */
struct i386_insn
@@ -1470,8 +1427,7 @@ i386_match_insn_block (CORE_ADDR pc, struct i386_insn *insn_patterns)
yet, and only the scratch registers %eax, %ecx and %edx can be
touched. */
-static i386_insn i386_frame_setup_skip_insns[] =
-{
+static i386_insn i386_frame_setup_skip_insns[] = {
/* Check for `movb imm8, r' and `movl imm32, r'.
??? Should we handle 16-bit operand-sizes here? */
@@ -1495,9 +1451,9 @@ static i386_insn i386_frame_setup_skip_insns[] =
/* `movl m32, %eax' */
{ 5, { 0xa1 }, { 0xff } },
/* `movl m32, %eax' and `mov; m32, %ecx' */
- { 6, { 0x89, 0x05 }, {0xff, 0xf7 } },
+ { 6, { 0x89, 0x05 }, { 0xff, 0xf7 } },
/* `movl m32, %edx' */
- { 6, { 0x89, 0x15 }, {0xff, 0xff } },
+ { 6, { 0x89, 0x15 }, { 0xff, 0xff } },
/* Check for `xorl r32, r32' and the equivalent `subl r32, r32'.
Because of the symmetry, there are actually two ways to encode
@@ -1548,11 +1504,11 @@ i386_skip_noop (CORE_ADDR pc)
if (target_read_code (pc, &op, 1))
return pc;
- while (check)
+ while (check)
{
check = 0;
/* Ignore `nop' instruction. */
- if (op == 0x90)
+ if (op == 0x90)
{
pc += 1;
if (target_read_code (pc, &op, 1))
@@ -1585,7 +1541,7 @@ i386_skip_noop (CORE_ADDR pc)
}
}
}
- return pc;
+ return pc;
}
/* Check whether PC points at a code that sets up a new stack frame.
@@ -1594,9 +1550,8 @@ i386_skip_noop (CORE_ADDR pc)
whichever is smaller. If we don't recognize the code, return PC. */
static CORE_ADDR
-i386_analyze_frame_setup (struct gdbarch *gdbarch,
- CORE_ADDR pc, CORE_ADDR limit,
- struct i386_frame_cache *cache)
+i386_analyze_frame_setup (struct gdbarch *gdbarch, CORE_ADDR pc,
+ CORE_ADDR limit, struct i386_frame_cache *cache)
{
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
struct i386_insn *insn;
@@ -1609,7 +1564,7 @@ i386_analyze_frame_setup (struct gdbarch *gdbarch,
if (target_read_code (pc, &op, 1))
return pc;
- if (op == 0x55) /* pushl %ebp */
+ if (op == 0x55) /* pushl %ebp */
{
/* Take into account that we've executed the `pushl %ebp' that
starts this instruction sequence. */
@@ -1742,7 +1697,7 @@ i386_analyze_frame_setup (struct gdbarch *gdbarch,
return pc;
}
}
- else if (op == 0xc8) /* enter */
+ else if (op == 0xc8) /* enter */
{
cache->locals = read_code_unsigned_integer (pc + 1, 2, byte_order);
return pc + 4;
@@ -1810,9 +1765,8 @@ i386_analyze_register_saves (CORE_ADDR pc, CORE_ADDR current_pc,
instruction will be a branch back to the start. */
static CORE_ADDR
-i386_analyze_prologue (struct gdbarch *gdbarch,
- CORE_ADDR pc, CORE_ADDR current_pc,
- struct i386_frame_cache *cache)
+i386_analyze_prologue (struct gdbarch *gdbarch, CORE_ADDR pc,
+ CORE_ADDR current_pc, struct i386_frame_cache *cache)
{
pc = i386_skip_endbr (pc);
pc = i386_skip_noop (pc);
@@ -1831,10 +1785,9 @@ i386_skip_prologue (struct gdbarch *gdbarch, CORE_ADDR start_pc)
{
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
- static gdb_byte pic_pat[6] =
- {
- 0xe8, 0, 0, 0, 0, /* call 0x0 */
- 0x5b, /* popl %ebx */
+ static gdb_byte pic_pat[6] = {
+ 0xe8, 0, 0, 0, 0, /* call 0x0 */
+ 0x5b, /* popl %ebx */
};
struct i386_frame_cache cache;
CORE_ADDR pc;
@@ -1852,13 +1805,12 @@ i386_skip_prologue (struct gdbarch *gdbarch, CORE_ADDR start_pc)
prologue and another one after. We trust clang and newer Intel
compilers to emit usable line notes. */
if (post_prologue_pc
- && (cust != NULL
- && cust->producer () != NULL
+ && (cust != NULL && cust->producer () != NULL
&& (producer_is_llvm (cust->producer ())
- || producer_is_icc_ge_19 (cust->producer ()))))
- return std::max (start_pc, post_prologue_pc);
+ || producer_is_icc_ge_19 (cust->producer ()))))
+ return std::max (start_pc, post_prologue_pc);
}
-
+
cache.locals = -1;
pc = i386_analyze_prologue (gdbarch, start_pc, 0xffffffff, &cache);
if (cache.locals < 0)
@@ -1894,15 +1846,15 @@ i386_skip_prologue (struct gdbarch *gdbarch, CORE_ADDR start_pc)
if (target_read_code (pc + delta, &op, 1))
return pc;
- if (op == 0x89) /* movl %ebx, x(%ebp) */
+ if (op == 0x89) /* movl %ebx, x(%ebp) */
{
op = read_code_unsigned_integer (pc + delta + 1, 1, byte_order);
- if (op == 0x5d) /* One byte offset from %ebp. */
+ if (op == 0x5d) /* One byte offset from %ebp. */
delta += 3;
- else if (op == 0x9d) /* Four byte offset from %ebp. */
+ else if (op == 0x9d) /* Four byte offset from %ebp. */
delta += 6;
- else /* Unexpected instruction. */
+ else /* Unexpected instruction. */
delta = 0;
if (target_read_code (pc + delta, &op, 1))
@@ -1912,7 +1864,7 @@ i386_skip_prologue (struct gdbarch *gdbarch, CORE_ADDR start_pc)
/* addl y,%ebx */
if (delta > 0 && op == 0x81
&& read_code_unsigned_integer (pc + delta + 1, 1, byte_order)
- == 0xc3)
+ == 0xc3)
{
pc += delta + 6;
}
@@ -1952,8 +1904,7 @@ i386_skip_main_prologue (struct gdbarch *gdbarch, CORE_ADDR pc)
call_dest = pc + 5 + extract_signed_integer (buf, 4, byte_order);
call_dest = call_dest & 0xffffffffU;
s = lookup_minimal_symbol_by_pc (call_dest);
- if (s.minsym != NULL
- && s.minsym->linkage_name () != NULL
+ if (s.minsym != NULL && s.minsym->linkage_name () != NULL
&& strcmp (s.minsym->linkage_name (), "__main") == 0)
pc += 5;
}
@@ -1972,13 +1923,11 @@ i386_unwind_pc (struct gdbarch *gdbarch, frame_info_ptr next_frame)
frame_unwind_register (next_frame, gdbarch_pc_regnum (gdbarch), buf);
return extract_typed_address (buf, builtin_type (gdbarch)->builtin_func_ptr);
}
-
/* Normal frames. */
static void
-i386_frame_cache_1 (frame_info_ptr this_frame,
- struct i386_frame_cache *cache)
+i386_frame_cache_1 (frame_info_ptr this_frame, struct i386_frame_cache *cache)
{
struct gdbarch *gdbarch = get_frame_arch (this_frame);
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
@@ -2043,8 +1992,8 @@ i386_frame_cache_1 (frame_info_ptr this_frame,
address; in that case there is definitely no new
frame in %ebp. */
get_frame_register (this_frame, I386_ESP_REGNUM, buf);
- cache->base = extract_unsigned_integer (buf, 4, byte_order)
- + cache->sp_offset;
+ cache->base
+ = extract_unsigned_integer (buf, 4, byte_order) + cache->sp_offset;
}
else
/* We're in an unknown function. We could not find the start
@@ -2059,8 +2008,8 @@ i386_frame_cache_1 (frame_info_ptr this_frame,
/* Saved stack pointer has been saved (but the SAVED_SP_REG
register may be unavailable). */
if (cache->saved_sp == 0
- && deprecated_frame_register_read (this_frame,
- cache->saved_sp_reg, buf))
+ && deprecated_frame_register_read (this_frame, cache->saved_sp_reg,
+ buf))
cache->saved_sp = extract_unsigned_integer (buf, 4, byte_order);
}
/* Now that we have the base address for the stack frame we can
@@ -2121,8 +2070,7 @@ i386_frame_this_id (frame_info_ptr this_frame, void **this_cache,
}
static enum unwind_stop_reason
-i386_frame_unwind_stop_reason (frame_info_ptr this_frame,
- void **this_cache)
+i386_frame_unwind_stop_reason (frame_info_ptr this_frame, void **this_cache)
{
struct i386_frame_cache *cache = i386_frame_cache (this_frame, this_cache);
@@ -2185,8 +2133,7 @@ i386_frame_prev_register (frame_info_ptr this_frame, void **this_cache,
return frame_unwind_got_register (this_frame, regnum,
cache->saved_sp_reg);
else
- return frame_unwind_got_constant (this_frame, regnum,
- cache->saved_sp);
+ return frame_unwind_got_constant (this_frame, regnum, cache->saved_sp);
}
if (regnum < I386_NUM_SAVED_REGS && cache->saved_regs[regnum] != -1)
@@ -2196,16 +2143,14 @@ i386_frame_prev_register (frame_info_ptr this_frame, void **this_cache,
return frame_unwind_got_register (this_frame, regnum, regnum);
}
-static const struct frame_unwind i386_frame_unwind =
-{
- "i386 prologue",
- NORMAL_FRAME,
- i386_frame_unwind_stop_reason,
- i386_frame_this_id,
- i386_frame_prev_register,
- NULL,
- default_frame_sniffer
-};
+static const struct frame_unwind i386_frame_unwind
+ = { "i386 prologue",
+ NORMAL_FRAME,
+ i386_frame_unwind_stop_reason,
+ i386_frame_this_id,
+ i386_frame_prev_register,
+ NULL,
+ default_frame_sniffer };
/* Normal frames, but in a function epilogue. */
@@ -2226,9 +2171,9 @@ i386_stack_frame_destroyed_p (struct gdbarch *gdbarch, CORE_ADDR pc)
return 0;
if (target_read_memory (pc, &insn, 1))
- return 0; /* Can't read memory at pc. */
+ return 0; /* Can't read memory at pc. */
- if (insn != 0xc3) /* 'ret' instruction. */
+ if (insn != 0xc3) /* 'ret' instruction. */
return 0;
return 1;
@@ -2285,8 +2230,8 @@ static enum unwind_stop_reason
i386_epilogue_frame_unwind_stop_reason (frame_info_ptr this_frame,
void **this_cache)
{
- struct i386_frame_cache *cache =
- i386_epilogue_frame_cache (this_frame, this_cache);
+ struct i386_frame_cache *cache
+ = i386_epilogue_frame_cache (this_frame, this_cache);
if (!cache->base_p)
return UNWIND_UNAVAILABLE;
@@ -2295,12 +2240,11 @@ i386_epilogue_frame_unwind_stop_reason (frame_info_ptr this_frame,
}
static void
-i386_epilogue_frame_this_id (frame_info_ptr this_frame,
- void **this_cache,
+i386_epilogue_frame_this_id (frame_info_ptr this_frame, void **this_cache,
struct frame_id *this_id)
{
- struct i386_frame_cache *cache =
- i386_epilogue_frame_cache (this_frame, this_cache);
+ struct i386_frame_cache *cache
+ = i386_epilogue_frame_cache (this_frame, this_cache);
if (!cache->base_p)
(*this_id) = frame_id_build_unavailable_stack (cache->pc);
@@ -2318,17 +2262,14 @@ i386_epilogue_frame_prev_register (frame_info_ptr this_frame,
return i386_frame_prev_register (this_frame, this_cache, regnum);
}
-static const struct frame_unwind i386_epilogue_frame_unwind =
-{
- "i386 epilogue",
- NORMAL_FRAME,
- i386_epilogue_frame_unwind_stop_reason,
- i386_epilogue_frame_this_id,
- i386_epilogue_frame_prev_register,
- NULL,
- i386_epilogue_frame_sniffer
-};
-
+static const struct frame_unwind i386_epilogue_frame_unwind
+ = { "i386 epilogue",
+ NORMAL_FRAME,
+ i386_epilogue_frame_unwind_stop_reason,
+ i386_epilogue_frame_this_id,
+ i386_epilogue_frame_prev_register,
+ NULL,
+ i386_epilogue_frame_sniffer };
/* Stack-based trampolines. */
@@ -2339,28 +2280,26 @@ static const struct frame_unwind i386_epilogue_frame_unwind =
/* Static chain passed in register. */
-static i386_insn i386_tramp_chain_in_reg_insns[] =
-{
+static i386_insn i386_tramp_chain_in_reg_insns[] = {
/* `movl imm32, %eax' and `movl imm32, %ecx' */
{ 5, { 0xb8 }, { 0xfe } },
/* `jmp imm32' */
{ 5, { 0xe9 }, { 0xff } },
- {0}
+ { 0 }
};
/* Static chain passed on stack (when regparm=3). */
-static i386_insn i386_tramp_chain_on_stack_insns[] =
-{
+static i386_insn i386_tramp_chain_on_stack_insns[] = {
/* `push imm32' */
{ 5, { 0x68 }, { 0xff } },
/* `jmp imm32' */
{ 5, { 0xe9 }, { 0xff } },
- {0}
+ { 0 }
};
/* Return whether PC points inside a stack trampoline. */
@@ -2391,8 +2330,7 @@ i386_in_stack_tramp_p (CORE_ADDR pc)
static int
i386_stack_tramp_frame_sniffer (const struct frame_unwind *self,
- frame_info_ptr this_frame,
- void **this_cache)
+ frame_info_ptr this_frame, void **this_cache)
{
if (frame_relative_level (this_frame) == 0)
return i386_in_stack_tramp_p (get_frame_pc (this_frame));
@@ -2400,23 +2338,20 @@ i386_stack_tramp_frame_sniffer (const struct frame_unwind *self,
return 0;
}
-static const struct frame_unwind i386_stack_tramp_frame_unwind =
-{
- "i386 stack tramp",
- NORMAL_FRAME,
- i386_epilogue_frame_unwind_stop_reason,
- i386_epilogue_frame_this_id,
- i386_epilogue_frame_prev_register,
- NULL,
- i386_stack_tramp_frame_sniffer
-};
-
+static const struct frame_unwind i386_stack_tramp_frame_unwind
+ = { "i386 stack tramp",
+ NORMAL_FRAME,
+ i386_epilogue_frame_unwind_stop_reason,
+ i386_epilogue_frame_this_id,
+ i386_epilogue_frame_prev_register,
+ NULL,
+ i386_stack_tramp_frame_sniffer };
+
/* Generate a bytecode expression to get the value of the saved PC. */
static void
-i386_gen_return_address (struct gdbarch *gdbarch,
- struct agent_expr *ax, struct axs_value *value,
- CORE_ADDR scope)
+i386_gen_return_address (struct gdbarch *gdbarch, struct agent_expr *ax,
+ struct axs_value *value, CORE_ADDR scope)
{
/* The following sequence assumes the traditional use of the base
register. */
@@ -2426,7 +2361,6 @@ i386_gen_return_address (struct gdbarch *gdbarch,
value->type = register_type (gdbarch, I386_EIP_REGNUM);
value->kind = axs_lvalue_memory;
}
-
/* Signal trampolines. */
@@ -2483,8 +2417,8 @@ static enum unwind_stop_reason
i386_sigtramp_frame_unwind_stop_reason (frame_info_ptr this_frame,
void **this_cache)
{
- struct i386_frame_cache *cache =
- i386_sigtramp_frame_cache (this_frame, this_cache);
+ struct i386_frame_cache *cache
+ = i386_sigtramp_frame_cache (this_frame, this_cache);
if (!cache->base_p)
return UNWIND_UNAVAILABLE;
@@ -2496,8 +2430,8 @@ static void
i386_sigtramp_frame_this_id (frame_info_ptr this_frame, void **this_cache,
struct frame_id *this_id)
{
- struct i386_frame_cache *cache =
- i386_sigtramp_frame_cache (this_frame, this_cache);
+ struct i386_frame_cache *cache
+ = i386_sigtramp_frame_cache (this_frame, this_cache);
if (!cache->base_p)
(*this_id) = frame_id_build_unavailable_stack (get_frame_pc (this_frame));
@@ -2549,17 +2483,14 @@ i386_sigtramp_frame_sniffer (const struct frame_unwind *self,
return 0;
}
-static const struct frame_unwind i386_sigtramp_frame_unwind =
-{
- "i386 sigtramp",
- SIGTRAMP_FRAME,
- i386_sigtramp_frame_unwind_stop_reason,
- i386_sigtramp_frame_this_id,
- i386_sigtramp_frame_prev_register,
- NULL,
- i386_sigtramp_frame_sniffer
-};
-
+static const struct frame_unwind i386_sigtramp_frame_unwind
+ = { "i386 sigtramp",
+ SIGTRAMP_FRAME,
+ i386_sigtramp_frame_unwind_stop_reason,
+ i386_sigtramp_frame_this_id,
+ i386_sigtramp_frame_prev_register,
+ NULL,
+ i386_sigtramp_frame_sniffer };
static CORE_ADDR
i386_frame_base_address (frame_info_ptr this_frame, void **this_cache)
@@ -2569,13 +2500,9 @@ i386_frame_base_address (frame_info_ptr this_frame, void **this_cache)
return cache->base;
}
-static const struct frame_base i386_frame_base =
-{
- &i386_frame_unwind,
- i386_frame_base_address,
- i386_frame_base_address,
- i386_frame_base_address
-};
+static const struct frame_base i386_frame_base
+ = { &i386_frame_unwind, i386_frame_base_address, i386_frame_base_address,
+ i386_frame_base_address };
static struct frame_id
i386_dummy_id (struct gdbarch *gdbarch, frame_info_ptr this_frame)
@@ -2594,9 +2521,8 @@ i386_dummy_id (struct gdbarch *gdbarch, frame_info_ptr this_frame)
static CORE_ADDR
i386_frame_align (struct gdbarch *gdbarch, CORE_ADDR sp)
{
- return sp & -(CORE_ADDR)16;
+ return sp & -(CORE_ADDR) 16;
}
-
/* Figure out where the longjmp will land. Slurp the args out of the
stack. We expect the first arg to be a pointer to the jmp_buf
@@ -2631,7 +2557,6 @@ i386_get_longjmp_target (frame_info_ptr frame, CORE_ADDR *pc)
*pc = extract_unsigned_integer (buf, 4, byte_order);
return 1;
}
-
/* Check whether TYPE must be 16-byte-aligned when passed as a
function argument. 16-byte vectors, _Decimal128 and structures or
@@ -2648,8 +2573,7 @@ i386_16_byte_align_p (struct type *type)
return 1;
if (type->code () == TYPE_CODE_ARRAY)
return i386_16_byte_align_p (type->target_type ());
- if (type->code () == TYPE_CODE_STRUCT
- || type->code () == TYPE_CODE_UNION)
+ if (type->code () == TYPE_CODE_STRUCT || type->code () == TYPE_CODE_UNION)
{
int i;
for (i = 0; i < type->num_fields (); i++)
@@ -2806,8 +2730,8 @@ i386_thiscall_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
if (asect != nullptr)
/* Translate asection to obj_section. */
- osect = maint_obj_section_from_bfd_section (objf->obfd.get (),
- asect, objf);
+ osect = maint_obj_section_from_bfd_section (objf->obfd.get (), asect,
+ objf);
if (osect != nullptr)
{
@@ -2851,8 +2775,8 @@ i386_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
/* These registers are used for returning integers (and on some
targets also for returning `struct' and `union' values when their
size and alignment match an integer type). */
-#define LOW_RETURN_REGNUM I386_EAX_REGNUM /* %eax */
-#define HIGH_RETURN_REGNUM I386_EDX_REGNUM /* %edx */
+#define LOW_RETURN_REGNUM I386_EAX_REGNUM /* %eax */
+#define HIGH_RETURN_REGNUM I386_EDX_REGNUM /* %edx */
/* Read, for architecture GDBARCH, a function return value of TYPE
from REGCACHE, and copy that into VALBUF. */
@@ -2869,14 +2793,14 @@ i386_extract_return_value (struct gdbarch *gdbarch, struct type *type,
if (((type->code () == TYPE_CODE_FLT) && len == 2)
|| ((type->code () == TYPE_CODE_COMPLEX) && len == 4))
{
- regcache->raw_read (I387_XMM0_REGNUM (tdep), valbuf);
- return;
+ regcache->raw_read (I387_XMM0_REGNUM (tdep), valbuf);
+ return;
}
else if (type->code () == TYPE_CODE_FLT)
{
if (tdep->st0_regnum < 0)
{
- warning (_("Cannot find floating-point return value."));
+ warning (_ ("Cannot find floating-point return value."));
memset (valbuf, 0, len);
return;
}
@@ -2906,7 +2830,7 @@ i386_extract_return_value (struct gdbarch *gdbarch, struct type *type,
memcpy (valbuf + low_size, buf, len - low_size);
}
else
- internal_error (_("Cannot extract return value of %d bytes long."),
+ internal_error (_ ("Cannot extract return value of %d bytes long."),
len);
}
}
@@ -2928,7 +2852,7 @@ i386_store_return_value (struct gdbarch *gdbarch, struct type *type,
if (tdep->st0_regnum < 0)
{
- warning (_("Cannot set floating-point return value."));
+ warning (_ ("Cannot set floating-point return value."));
return;
}
@@ -2970,23 +2894,19 @@ i386_store_return_value (struct gdbarch *gdbarch, struct type *type,
valbuf + low_size);
}
else
- internal_error (_("Cannot store return value of %d bytes long."), len);
+ internal_error (_ ("Cannot store return value of %d bytes long."),
+ len);
}
}
-
/* This is the variable that is set with "set struct-convention", and
its legitimate values. */
static const char default_struct_convention[] = "default";
static const char pcc_struct_convention[] = "pcc";
static const char reg_struct_convention[] = "reg";
-static const char *const valid_conventions[] =
-{
- default_struct_convention,
- pcc_struct_convention,
- reg_struct_convention,
- NULL
-};
+static const char *const valid_conventions[]
+ = { default_struct_convention, pcc_struct_convention, reg_struct_convention,
+ NULL };
static const char *struct_convention = default_struct_convention;
/* Return non-zero if TYPE, which is assumed to be a structure,
@@ -3000,8 +2920,7 @@ i386_reg_struct_return_p (struct gdbarch *gdbarch, struct type *type)
enum type_code code = type->code ();
int len = type->length ();
- gdb_assert (code == TYPE_CODE_STRUCT
- || code == TYPE_CODE_UNION
+ gdb_assert (code == TYPE_CODE_STRUCT || code == TYPE_CODE_UNION
|| code == TYPE_CODE_ARRAY);
if (struct_convention == pcc_struct_convention
@@ -3035,8 +2954,7 @@ i386_return_value (struct gdbarch *gdbarch, struct value *function,
{
enum type_code code = type->code ();
- if (((code == TYPE_CODE_STRUCT
- || code == TYPE_CODE_UNION
+ if (((code == TYPE_CODE_STRUCT || code == TYPE_CODE_UNION
|| code == TYPE_CODE_ARRAY)
&& !i386_reg_struct_return_p (gdbarch, type))
/* Complex double and long double uses the struct return convention. */
@@ -3102,7 +3020,6 @@ i386_return_value (struct gdbarch *gdbarch, struct value *function,
return RETURN_VALUE_REGISTER_CONVENTION;
}
-
struct type *
i387_ext_type (struct gdbarch *gdbarch)
@@ -3127,7 +3044,6 @@ i386_bnd_type (struct gdbarch *gdbarch)
{
i386_gdbarch_tdep *tdep = gdbarch_tdep<i386_gdbarch_tdep> (gdbarch);
-
if (!tdep->i386_bnd_type)
{
struct type *t;
@@ -3142,8 +3058,8 @@ i386_bnd_type (struct gdbarch *gdbarch)
};
#endif
- t = arch_composite_type (gdbarch,
- "__gdb_builtin_type_bound128", TYPE_CODE_STRUCT);
+ t = arch_composite_type (gdbarch, "__gdb_builtin_type_bound128",
+ TYPE_CODE_STRUCT);
append_composite_type_field (t, "lbound", bt->builtin_data_ptr);
append_composite_type_field (t, "ubound", bt->builtin_data_ptr);
@@ -3185,10 +3101,11 @@ i386_zmm_type (struct gdbarch *gdbarch)
struct type *t;
- t = arch_composite_type (gdbarch,
- "__gdb_builtin_type_vec512i", TYPE_CODE_UNION);
+ t = arch_composite_type (gdbarch, "__gdb_builtin_type_vec512i",
+ TYPE_CODE_UNION);
append_composite_type_field (t, "v32_bfloat16",
- init_vector_type (bt->builtin_bfloat16, 32));
+ init_vector_type (bt->builtin_bfloat16,
+ 32));
append_composite_type_field (t, "v32_half",
init_vector_type (bt->builtin_half, 32));
append_composite_type_field (t, "v16_float",
@@ -3244,10 +3161,11 @@ i386_ymm_type (struct gdbarch *gdbarch)
struct type *t;
- t = arch_composite_type (gdbarch,
- "__gdb_builtin_type_vec256i", TYPE_CODE_UNION);
+ t = arch_composite_type (gdbarch, "__gdb_builtin_type_vec256i",
+ TYPE_CODE_UNION);
append_composite_type_field (t, "v16_bfloat16",
- init_vector_type (bt->builtin_bfloat16, 16));
+ init_vector_type (bt->builtin_bfloat16,
+ 16));
append_composite_type_field (t, "v16_half",
init_vector_type (bt->builtin_half, 16));
append_composite_type_field (t, "v8_float",
@@ -3296,8 +3214,8 @@ i386_mmx_type (struct gdbarch *gdbarch)
struct type *t;
- t = arch_composite_type (gdbarch,
- "__gdb_builtin_type_vec64i", TYPE_CODE_UNION);
+ t = arch_composite_type (gdbarch, "__gdb_builtin_type_vec64i",
+ TYPE_CODE_UNION);
append_composite_type_field (t, "uint64", bt->builtin_int64);
append_composite_type_field (t, "v2_int32",
@@ -3344,7 +3262,7 @@ i386_pseudo_register_type (struct gdbarch *gdbarch, int regnum)
return bt->builtin_int64;
}
- internal_error (_("invalid regnum"));
+ internal_error (_ ("invalid regnum"));
}
/* Map a cooked register onto a raw register or memory. For the i386,
@@ -3373,8 +3291,7 @@ i386_mmx_regnum_to_fp_regnum (readable_regcache *regcache, int regnum)
void
i386_pseudo_register_read_into_value (struct gdbarch *gdbarch,
- readable_regcache *regcache,
- int regnum,
+ readable_regcache *regcache, int regnum,
struct value *result_value)
{
gdb_byte raw_buf[I386_MAX_REGISTER_SIZE];
@@ -3401,13 +3318,14 @@ i386_pseudo_register_read_into_value (struct gdbarch *gdbarch,
regnum -= tdep->bnd0_regnum;
/* Extract (always little endian). Read lower 128bits. */
- status = regcache->raw_read (I387_BND0R_REGNUM (tdep) + regnum,
- raw_buf);
+ status
+ = regcache->raw_read (I387_BND0R_REGNUM (tdep) + regnum, raw_buf);
if (status != REG_VALID)
mark_value_bytes_unavailable (result_value, 0, 16);
else
{
- enum bfd_endian byte_order = gdbarch_byte_order (target_gdbarch ());
+ enum bfd_endian byte_order
+ = gdbarch_byte_order (target_gdbarch ());
LONGEST upper, lower;
int size = builtin_type (gdbarch)->builtin_data_ptr->length ();
@@ -3445,8 +3363,8 @@ i386_pseudo_register_read_into_value (struct gdbarch *gdbarch,
memcpy (buf, raw_buf, 16);
/* Extract (always little endian). Read upper 128bits. */
- status = regcache->raw_read (tdep->ymm0h_regnum + regnum,
- raw_buf);
+ status
+ = regcache->raw_read (tdep->ymm0h_regnum + regnum, raw_buf);
if (status != REG_VALID)
mark_value_bytes_unavailable (result_value, 16, 16);
else
@@ -3456,7 +3374,7 @@ i386_pseudo_register_read_into_value (struct gdbarch *gdbarch,
{
/* Extract (always little endian). Read lower 128bits. */
status = regcache->raw_read (I387_XMM16_REGNUM (tdep) + regnum
- - num_lower_zmm_regs,
+ - num_lower_zmm_regs,
raw_buf);
if (status != REG_VALID)
mark_value_bytes_unavailable (result_value, 0, 16);
@@ -3465,7 +3383,7 @@ i386_pseudo_register_read_into_value (struct gdbarch *gdbarch,
/* Extract (always little endian). Read upper 128bits. */
status = regcache->raw_read (I387_YMM16H_REGNUM (tdep) + regnum
- - num_lower_zmm_regs,
+ - num_lower_zmm_regs,
raw_buf);
if (status != REG_VALID)
mark_value_bytes_unavailable (result_value, 16, 16);
@@ -3474,8 +3392,7 @@ i386_pseudo_register_read_into_value (struct gdbarch *gdbarch,
}
/* Read upper 256bits. */
- status = regcache->raw_read (tdep->zmm0h_regnum + regnum,
- raw_buf);
+ status = regcache->raw_read (tdep->zmm0h_regnum + regnum, raw_buf);
if (status != REG_VALID)
mark_value_bytes_unavailable (result_value, 32, 32);
else
@@ -3486,15 +3403,14 @@ i386_pseudo_register_read_into_value (struct gdbarch *gdbarch,
regnum -= tdep->ymm0_regnum;
/* Extract (always little endian). Read lower 128bits. */
- status = regcache->raw_read (I387_XMM0_REGNUM (tdep) + regnum,
- raw_buf);
+ status
+ = regcache->raw_read (I387_XMM0_REGNUM (tdep) + regnum, raw_buf);
if (status != REG_VALID)
mark_value_bytes_unavailable (result_value, 0, 16);
else
memcpy (buf, raw_buf, 16);
/* Read upper 128bits. */
- status = regcache->raw_read (tdep->ymm0h_regnum + regnum,
- raw_buf);
+ status = regcache->raw_read (tdep->ymm0h_regnum + regnum, raw_buf);
if (status != REG_VALID)
mark_value_bytes_unavailable (result_value, 16, 32);
else
@@ -3504,15 +3420,14 @@ i386_pseudo_register_read_into_value (struct gdbarch *gdbarch,
{
regnum -= tdep->ymm16_regnum;
/* Extract (always little endian). Read lower 128bits. */
- status = regcache->raw_read (I387_XMM16_REGNUM (tdep) + regnum,
- raw_buf);
+ status
+ = regcache->raw_read (I387_XMM16_REGNUM (tdep) + regnum, raw_buf);
if (status != REG_VALID)
mark_value_bytes_unavailable (result_value, 0, 16);
else
memcpy (buf, raw_buf, 16);
/* Read upper 128bits. */
- status = regcache->raw_read (tdep->ymm16h_regnum + regnum,
- raw_buf);
+ status = regcache->raw_read (tdep->ymm16h_regnum + regnum, raw_buf);
if (status != REG_VALID)
mark_value_bytes_unavailable (result_value, 16, 16);
else
@@ -3525,8 +3440,8 @@ i386_pseudo_register_read_into_value (struct gdbarch *gdbarch,
/* Extract (always little endian). */
status = regcache->raw_read (gpnum, raw_buf);
if (status != REG_VALID)
- mark_value_bytes_unavailable (result_value, 0,
- value_type (result_value)->length ());
+ mark_value_bytes_unavailable (
+ result_value, 0, value_type (result_value)->length ());
else
memcpy (buf, raw_buf, 2);
}
@@ -3538,22 +3453,21 @@ i386_pseudo_register_read_into_value (struct gdbarch *gdbarch,
upper registers. */
status = regcache->raw_read (gpnum % 4, raw_buf);
if (status != REG_VALID)
- mark_value_bytes_unavailable (result_value, 0,
- value_type (result_value)->length ());
+ mark_value_bytes_unavailable (
+ result_value, 0, value_type (result_value)->length ());
else if (gpnum >= 4)
memcpy (buf, raw_buf + 1, 1);
else
memcpy (buf, raw_buf, 1);
}
else
- internal_error (_("invalid regnum"));
+ internal_error (_ ("invalid regnum"));
}
}
static struct value *
i386_pseudo_register_read_value (struct gdbarch *gdbarch,
- readable_regcache *regcache,
- int regnum)
+ readable_regcache *regcache, int regnum)
{
struct value *result;
@@ -3599,8 +3513,7 @@ i386_pseudo_register_write (struct gdbarch *gdbarch, struct regcache *regcache,
upper = extract_unsigned_integer (buf + size, size, byte_order);
/* Fetching register buffer. */
- regcache->raw_read (I387_BND0R_REGNUM (tdep) + regnum,
- raw_buf);
+ regcache->raw_read (I387_BND0R_REGNUM (tdep) + regnum, raw_buf);
upper = ~upper;
@@ -3631,10 +3544,12 @@ i386_pseudo_register_write (struct gdbarch *gdbarch, struct regcache *regcache,
{
/* Write lower 128bits. */
regcache->raw_write (I387_XMM16_REGNUM (tdep) + regnum
- - num_lower_zmm_regs, buf);
+ - num_lower_zmm_regs,
+ buf);
/* Write upper 128bits. */
regcache->raw_write (I387_YMM16H_REGNUM (tdep) + regnum
- - num_lower_zmm_regs, buf + 16);
+ - num_lower_zmm_regs,
+ buf + 16);
}
/* Write upper 256bits. */
regcache->raw_write (tdep->zmm0h_regnum + regnum, buf + 32);
@@ -3683,7 +3598,7 @@ i386_pseudo_register_write (struct gdbarch *gdbarch, struct regcache *regcache,
regcache->raw_write (gpnum % 4, raw_buf);
}
else
- internal_error (_("invalid regnum"));
+ internal_error (_ ("invalid regnum"));
}
}
@@ -3728,10 +3643,10 @@ i386_ax_pseudo_register_collect (struct gdbarch *gdbarch,
}
else
{
- ax_reg_mask (ax, I387_XMM16_REGNUM (tdep) + regnum
- - num_lower_zmm_regs);
+ ax_reg_mask (ax,
+ I387_XMM16_REGNUM (tdep) + regnum - num_lower_zmm_regs);
ax_reg_mask (ax, I387_YMM16H_REGNUM (tdep) + regnum
- - num_lower_zmm_regs);
+ - num_lower_zmm_regs);
}
ax_reg_mask (ax, tdep->zmm0h_regnum + regnum);
return 0;
@@ -3765,10 +3680,9 @@ i386_ax_pseudo_register_collect (struct gdbarch *gdbarch,
return 0;
}
else
- internal_error (_("invalid regnum"));
+ internal_error (_ ("invalid regnum"));
return 1;
}
-
/* Return the register number of the register allocated by GCC after
REGNUM, or -1 if there is no such register. */
@@ -3782,15 +3696,15 @@ i386_next_regnum (int regnum)
Since storing a variable in %esp doesn't make any sense we return
-1 for %ebp and for %esp itself. */
- static int next_regnum[] =
- {
- I386_EDX_REGNUM, /* Slot for %eax. */
- I386_EBX_REGNUM, /* Slot for %ecx. */
- I386_ECX_REGNUM, /* Slot for %edx. */
- I386_ESI_REGNUM, /* Slot for %ebx. */
- -1, -1, /* Slots for %esp and %ebp. */
- I386_EDI_REGNUM, /* Slot for %esi. */
- I386_EBP_REGNUM /* Slot for %edi. */
+ static int next_regnum[] = {
+ I386_EDX_REGNUM, /* Slot for %eax. */
+ I386_EBX_REGNUM, /* Slot for %ecx. */
+ I386_ECX_REGNUM, /* Slot for %edx. */
+ I386_ESI_REGNUM, /* Slot for %ebx. */
+ -1,
+ -1, /* Slots for %esp and %ebp. */
+ I386_EDI_REGNUM, /* Slot for %esi. */
+ I386_EBP_REGNUM /* Slot for %edi. */
};
if (regnum >= 0 && regnum < sizeof (next_regnum) / sizeof (next_regnum[0]))
@@ -3803,8 +3717,8 @@ i386_next_regnum (int regnum)
needs any special handling. */
static int
-i386_convert_register_p (struct gdbarch *gdbarch,
- int regnum, struct type *type)
+i386_convert_register_p (struct gdbarch *gdbarch, int regnum,
+ struct type *type)
{
int len = type->length ();
@@ -3834,16 +3748,15 @@ i386_convert_register_p (struct gdbarch *gdbarch,
return its contents in TO. */
static int
-i386_register_to_value (frame_info_ptr frame, int regnum,
- struct type *type, gdb_byte *to,
- int *optimizedp, int *unavailablep)
+i386_register_to_value (frame_info_ptr frame, int regnum, struct type *type,
+ gdb_byte *to, int *optimizedp, int *unavailablep)
{
struct gdbarch *gdbarch = get_frame_arch (frame);
int len = type->length ();
if (i386_fp_regnum_p (gdbarch, regnum))
- return i387_register_to_value (frame, regnum, type, to,
- optimizedp, unavailablep);
+ return i387_register_to_value (frame, regnum, type, to, optimizedp,
+ unavailablep);
/* Read a value spread across multiple registers. */
@@ -3854,11 +3767,10 @@ i386_register_to_value (frame_info_ptr frame, int regnum,
gdb_assert (regnum != -1);
gdb_assert (register_size (gdbarch, regnum) == 4);
- if (!get_frame_register_bytes (frame, regnum, 0,
- gdb::make_array_view (to,
- register_size (gdbarch,
- regnum)),
- optimizedp, unavailablep))
+ if (!get_frame_register_bytes (
+ frame, regnum, 0,
+ gdb::make_array_view (to, register_size (gdbarch, regnum)),
+ optimizedp, unavailablep))
return 0;
regnum = i386_next_regnum (regnum);
@@ -3874,8 +3786,8 @@ i386_register_to_value (frame_info_ptr frame, int regnum,
REGNUM in frame FRAME. */
static void
-i386_value_to_register (frame_info_ptr frame, int regnum,
- struct type *type, const gdb_byte *from)
+i386_value_to_register (frame_info_ptr frame, int regnum, struct type *type,
+ const gdb_byte *from)
{
int len = type->length ();
@@ -3900,7 +3812,7 @@ i386_value_to_register (frame_info_ptr frame, int regnum,
from += 4;
}
}
-
+
/* Supply register REGNUM from the buffer specified by GREGS and LEN
in the general-purpose register set REGSET to register cache
REGCACHE. If REGNUM is -1, do this for all registers in REGSET. */
@@ -3918,8 +3830,7 @@ i386_supply_gregset (const struct regset *regset, struct regcache *regcache,
for (i = 0; i < tdep->gregset_num_regs; i++)
{
- if ((regnum == i || regnum == -1)
- && tdep->gregset_reg_offset[i] != -1)
+ if ((regnum == i || regnum == -1) && tdep->gregset_reg_offset[i] != -1)
regcache->raw_supply (i, regs + tdep->gregset_reg_offset[i]);
}
}
@@ -3931,8 +3842,8 @@ i386_supply_gregset (const struct regset *regset, struct regcache *regcache,
static void
i386_collect_gregset (const struct regset *regset,
- const struct regcache *regcache,
- int regnum, void *gregs, size_t len)
+ const struct regcache *regcache, int regnum, void *gregs,
+ size_t len)
{
struct gdbarch *gdbarch = regcache->arch ();
const i386_gdbarch_tdep *tdep = gdbarch_tdep<i386_gdbarch_tdep> (gdbarch);
@@ -3943,8 +3854,7 @@ i386_collect_gregset (const struct regset *regset,
for (i = 0; i < tdep->gregset_num_regs; i++)
{
- if ((regnum == i || regnum == -1)
- && tdep->gregset_reg_offset[i] != -1)
+ if ((regnum == i || regnum == -1) && tdep->gregset_reg_offset[i] != -1)
regcache->raw_collect (i, regs + tdep->gregset_reg_offset[i]);
}
}
@@ -3977,8 +3887,8 @@ i386_supply_fpregset (const struct regset *regset, struct regcache *regcache,
static void
i386_collect_fpregset (const struct regset *regset,
- const struct regcache *regcache,
- int regnum, void *fpregs, size_t len)
+ const struct regcache *regcache, int regnum,
+ void *fpregs, size_t len)
{
struct gdbarch *gdbarch = regcache->arch ();
const i386_gdbarch_tdep *tdep = gdbarch_tdep<i386_gdbarch_tdep> (gdbarch);
@@ -3995,15 +3905,11 @@ i386_collect_fpregset (const struct regset *regset,
/* Register set definitions. */
-const struct regset i386_gregset =
- {
- NULL, i386_supply_gregset, i386_collect_gregset
- };
+const struct regset i386_gregset
+ = { NULL, i386_supply_gregset, i386_collect_gregset };
-const struct regset i386_fpregset =
- {
- NULL, i386_supply_fpregset, i386_collect_fpregset
- };
+const struct regset i386_fpregset
+ = { NULL, i386_supply_fpregset, i386_collect_fpregset };
/* Default iterator over core file register note sections. */
@@ -4021,13 +3927,11 @@ i386_iterate_over_regset_sections (struct gdbarch *gdbarch,
cb (".reg2", tdep->sizeof_fpregset, tdep->sizeof_fpregset, tdep->fpregset,
NULL, cb_data);
}
-
/* Stuff for WIN32 PE style DLL's but is pretty generic really. */
CORE_ADDR
-i386_pe_skip_trampoline_code (frame_info_ptr frame,
- CORE_ADDR pc, char *name)
+i386_pe_skip_trampoline_code (frame_info_ptr frame, CORE_ADDR pc, char *name)
{
struct gdbarch *gdbarch = get_frame_arch (frame);
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
@@ -4035,23 +3939,22 @@ i386_pe_skip_trampoline_code (frame_info_ptr frame,
/* jmp *(dest) */
if (pc && read_memory_unsigned_integer (pc, 2, byte_order) == 0x25ff)
{
- unsigned long indirect =
- read_memory_unsigned_integer (pc + 2, 4, byte_order);
- struct minimal_symbol *indsym =
- indirect ? lookup_minimal_symbol_by_pc (indirect).minsym : 0;
+ unsigned long indirect
+ = read_memory_unsigned_integer (pc + 2, 4, byte_order);
+ struct minimal_symbol *indsym
+ = indirect ? lookup_minimal_symbol_by_pc (indirect).minsym : 0;
const char *symname = indsym ? indsym->linkage_name () : 0;
if (symname)
{
- if (startswith (symname, "__imp_")
- || startswith (symname, "_imp_"))
- return name ? 1 :
- read_memory_unsigned_integer (indirect, 4, byte_order);
+ if (startswith (symname, "__imp_") || startswith (symname, "_imp_"))
+ return name
+ ? 1
+ : read_memory_unsigned_integer (indirect, 4, byte_order);
}
}
- return 0; /* Not a trampoline. */
+ return 0; /* Not a trampoline. */
}
-
/* Return whether the THIS_FRAME corresponds to a sigtramp
routine. */
@@ -4065,7 +3968,6 @@ i386_sigtramp_p (frame_info_ptr this_frame)
find_pc_partial_function (pc, &name, NULL, NULL);
return (name && strcmp ("_sigtramp", name) == 0);
}
-
/* We have two flavours of disassembly. The machinery on this page
deals with switching between those. */
@@ -4080,7 +3982,6 @@ i386_print_insn (bfd_vma pc, struct disassemble_info *info)
return default_print_insn (pc, info);
}
-
/* There are a few i386 architecture variants that differ only
slightly from the generic i386 target. For now, we don't give them
@@ -4100,8 +4001,9 @@ i386_svr4_sigtramp_p (frame_info_ptr this_frame)
/* The origin of these symbols is currently unknown. */
find_pc_partial_function (pc, &name, NULL, NULL);
- return (name && (strcmp ("_sigreturn", name) == 0
- || strcmp ("sigvechandler", name) == 0));
+ return (name
+ && (strcmp ("_sigreturn", name) == 0
+ || strcmp ("sigvechandler", name) == 0));
}
/* Assuming THIS_FRAME is for a SVR4 sigtramp routine, return the
@@ -4121,8 +4023,6 @@ i386_svr4_sigcontext_addr (frame_info_ptr this_frame)
return read_memory_unsigned_integer (sp + 8, 4, byte_order);
}
-
-
/* Implementation of `gdbarch_stap_is_single_operand', as defined in
gdbarch.h. */
@@ -4131,7 +4031,7 @@ i386_stap_is_single_operand (struct gdbarch *gdbarch, const char *s)
{
return (*s == '$' /* Literal number. */
|| (isdigit (*s) && s[1] == '(' && s[2] == '%') /* Displacement. */
- || (*s == '(' && s[1] == '%') /* Register indirection. */
+ || (*s == '(' && s[1] == '%') /* Register indirection. */
|| (*s == '%' && isalpha (s[1]))); /* Register access. */
}
@@ -4231,7 +4131,7 @@ i386_stap_parse_special_token_triplet (struct gdbarch *gdbarch,
std::string regname (start, len);
if (user_reg_map_name_to_regnum (gdbarch, regname.c_str (), len) == -1)
- error (_("Invalid register name `%s' on expression `%s'."),
+ error (_ ("Invalid register name `%s' on expression `%s'."),
regname.c_str (), p->saved_arg);
LONGEST value = 0;
@@ -4259,8 +4159,8 @@ i386_stap_parse_special_token_triplet (struct gdbarch *gdbarch,
operation_up sum
= make_operation<add_operation> (std::move (reg), std::move (offset));
struct type *arg_ptr_type = lookup_pointer_type (p->arg_type);
- sum = make_operation<unop_cast_operation> (std::move (sum),
- arg_ptr_type);
+ sum
+ = make_operation<unop_cast_operation> (std::move (sum), arg_ptr_type);
return make_operation<unop_ind_operation> (std::move (sum));
}
@@ -4327,7 +4227,7 @@ i386_stap_parse_special_token_three_arg_disp (struct gdbarch *gdbarch,
std::string base (start, len_base);
if (user_reg_map_name_to_regnum (gdbarch, base.c_str (), len_base) == -1)
- error (_("Invalid register name `%s' on expression `%s'."),
+ error (_ ("Invalid register name `%s' on expression `%s'."),
base.c_str (), p->saved_arg);
s += 2;
@@ -4339,9 +4239,9 @@ i386_stap_parse_special_token_three_arg_disp (struct gdbarch *gdbarch,
len_index = s - start;
std::string index (start, len_index);
- if (user_reg_map_name_to_regnum (gdbarch, index.c_str (),
- len_index) == -1)
- error (_("Invalid register name `%s' on expression `%s'."),
+ if (user_reg_map_name_to_regnum (gdbarch, index.c_str (), len_index)
+ == -1)
+ error (_ ("Invalid register name `%s' on expression `%s'."),
index.c_str (), p->saved_arg);
if (*s != ',' && *s != ')')
@@ -4399,12 +4299,11 @@ i386_stap_parse_special_token_three_arg_disp (struct gdbarch *gdbarch,
}
operation_up sum
- = make_operation<add_operation> (std::move (reg),
- std::move (ind_reg));
+ = make_operation<add_operation> (std::move (reg), std::move (ind_reg));
struct type *arg_ptr_type = lookup_pointer_type (p->arg_type);
- sum = make_operation<unop_cast_operation> (std::move (sum),
- arg_ptr_type);
+ sum
+ = make_operation<unop_cast_operation> (std::move (sum), arg_ptr_type);
return make_operation<unop_ind_operation> (std::move (sum));
}
@@ -4443,8 +4342,7 @@ i386_stap_adjust_register (struct gdbarch *gdbarch, struct stap_parse_info *p,
const std::string &regname, int regnum)
{
static const std::unordered_set<std::string> reg_assoc
- = { "ax", "bx", "cx", "dx",
- "si", "di", "bp", "sp" };
+ = { "ax", "bx", "cx", "dx", "si", "di", "bp", "sp" };
/* If we are dealing with a register whose size is less than the size
specified by the "[-]N@" prefix, and it is one of the registers that
@@ -4458,8 +4356,6 @@ i386_stap_adjust_register (struct gdbarch *gdbarch, struct stap_parse_info *p,
return regname;
}
-
-
/* gdbarch gnu_triplet_regexp method. Both arches are acceptable as GDB always
also supplies -m64 or -m32 by gdbarch_gcc_target_options. */
@@ -4469,8 +4365,6 @@ i386_gnu_triplet_regexp (struct gdbarch *gdbarch)
return "(x86_64|i.86)";
}
-
-
/* Implement the "in_indirect_branch_thunk" gdbarch function. */
static bool
@@ -4487,10 +4381,10 @@ i386_elf_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
{
static const char *const stap_integer_prefixes[] = { "$", NULL };
static const char *const stap_register_prefixes[] = { "%", NULL };
- static const char *const stap_register_indirection_prefixes[] = { "(",
- NULL };
- static const char *const stap_register_indirection_suffixes[] = { ")",
- NULL };
+ static const char *const stap_register_indirection_prefixes[]
+ = { "(", NULL };
+ static const char *const stap_register_indirection_suffixes[]
+ = { ")", NULL };
/* We typically use stabs-in-ELF with the SVR4 register numbering. */
set_gdbarch_stab_reg_to_regnum (gdbarch, i386_svr4_reg_to_regnum);
@@ -4498,16 +4392,14 @@ i386_elf_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
/* Registering SystemTap handlers. */
set_gdbarch_stap_integer_prefixes (gdbarch, stap_integer_prefixes);
set_gdbarch_stap_register_prefixes (gdbarch, stap_register_prefixes);
- set_gdbarch_stap_register_indirection_prefixes (gdbarch,
- stap_register_indirection_prefixes);
- set_gdbarch_stap_register_indirection_suffixes (gdbarch,
- stap_register_indirection_suffixes);
- set_gdbarch_stap_is_single_operand (gdbarch,
- i386_stap_is_single_operand);
+ set_gdbarch_stap_register_indirection_prefixes (
+ gdbarch, stap_register_indirection_prefixes);
+ set_gdbarch_stap_register_indirection_suffixes (
+ gdbarch, stap_register_indirection_suffixes);
+ set_gdbarch_stap_is_single_operand (gdbarch, i386_stap_is_single_operand);
set_gdbarch_stap_parse_special_token (gdbarch,
i386_stap_parse_special_token);
- set_gdbarch_stap_adjust_register (gdbarch,
- i386_stap_adjust_register);
+ set_gdbarch_stap_adjust_register (gdbarch, i386_stap_adjust_register);
set_gdbarch_in_indirect_branch_thunk (gdbarch,
i386_in_indirect_branch_thunk);
@@ -4534,8 +4426,6 @@ i386_svr4_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
tdep->jb_pc_offset = 20;
}
-
-
/* i386 register groups. In addition to the normal groups, add "mmx"
and "sse". */
@@ -4561,11 +4451,10 @@ i386_register_reggroup_p (struct gdbarch *gdbarch, int regnum,
const struct reggroup *group)
{
const i386_gdbarch_tdep *tdep = gdbarch_tdep<i386_gdbarch_tdep> (gdbarch);
- int fp_regnum_p, mmx_regnum_p, xmm_regnum_p, mxcsr_regnum_p,
- ymm_regnum_p, ymmh_regnum_p, ymm_avx512_regnum_p, ymmh_avx512_regnum_p,
- bndr_regnum_p, bnd_regnum_p, zmm_regnum_p, zmmh_regnum_p,
- mpx_ctrl_regnum_p, xmm_avx512_regnum_p,
- avx512_p, avx_p, sse_p, pkru_regnum_p;
+ int fp_regnum_p, mmx_regnum_p, xmm_regnum_p, mxcsr_regnum_p, ymm_regnum_p,
+ ymmh_regnum_p, ymm_avx512_regnum_p, ymmh_avx512_regnum_p, bndr_regnum_p,
+ bnd_regnum_p, zmm_regnum_p, zmmh_regnum_p, mpx_ctrl_regnum_p,
+ xmm_avx512_regnum_p, avx512_p, avx_p, sse_p, pkru_regnum_p;
/* Don't include pseudo registers, except for MMX, in any register
groups. */
@@ -4582,7 +4471,7 @@ i386_register_reggroup_p (struct gdbarch *gdbarch, int regnum,
if (group == i386_mmx_reggroup)
return mmx_regnum_p;
- pkru_regnum_p = i386_pkru_regnum_p(gdbarch, regnum);
+ pkru_regnum_p = i386_pkru_regnum_p (gdbarch, regnum);
xmm_regnum_p = i386_xmm_regnum_p (gdbarch, regnum);
xmm_avx512_regnum_p = i386_xmm_avx512_regnum_p (gdbarch, regnum);
mxcsr_regnum_p = i386_mxcsr_regnum_p (gdbarch, regnum);
@@ -4595,14 +4484,13 @@ i386_register_reggroup_p (struct gdbarch *gdbarch, int regnum,
avx512_p = ((tdep->xcr0 & X86_XSTATE_AVX_AVX512_MASK)
== X86_XSTATE_AVX_AVX512_MASK);
- avx_p = ((tdep->xcr0 & X86_XSTATE_AVX_AVX512_MASK)
- == X86_XSTATE_AVX_MASK) && !avx512_p;
- sse_p = ((tdep->xcr0 & X86_XSTATE_AVX_AVX512_MASK)
- == X86_XSTATE_SSE_MASK) && !avx512_p && ! avx_p;
+ avx_p = ((tdep->xcr0 & X86_XSTATE_AVX_AVX512_MASK) == X86_XSTATE_AVX_MASK)
+ && !avx512_p;
+ sse_p = ((tdep->xcr0 & X86_XSTATE_AVX_AVX512_MASK) == X86_XSTATE_SSE_MASK)
+ && !avx512_p && !avx_p;
if (group == vector_reggroup)
- return (mmx_regnum_p
- || (zmm_regnum_p && avx512_p)
+ return (mmx_regnum_p || (zmm_regnum_p && avx512_p)
|| ((ymm_regnum_p || ymm_avx512_regnum_p) && avx_p)
|| ((xmm_regnum_p || xmm_avx512_regnum_p) && sse_p)
|| mxcsr_regnum_p);
@@ -4619,10 +4507,8 @@ i386_register_reggroup_p (struct gdbarch *gdbarch, int regnum,
zmmh_regnum_p = i386_zmmh_regnum_p (gdbarch, regnum);
if (group == all_reggroup
&& (((xmm_regnum_p || xmm_avx512_regnum_p) && !sse_p)
- || ((ymm_regnum_p || ymm_avx512_regnum_p) && !avx_p)
- || ymmh_regnum_p
- || ymmh_avx512_regnum_p
- || zmmh_regnum_p))
+ || ((ymm_regnum_p || ymm_avx512_regnum_p) && !avx_p) || ymmh_regnum_p
+ || ymmh_avx512_regnum_p || zmmh_regnum_p))
return 0;
bnd_regnum_p = i386_bnd_regnum_p (gdbarch, regnum);
@@ -4641,31 +4527,19 @@ i386_register_reggroup_p (struct gdbarch *gdbarch, int regnum,
return mpx_ctrl_regnum_p;
if (group == general_reggroup)
- return (!fp_regnum_p
- && !mmx_regnum_p
- && !mxcsr_regnum_p
- && !xmm_regnum_p
- && !xmm_avx512_regnum_p
- && !ymm_regnum_p
- && !ymmh_regnum_p
- && !ymm_avx512_regnum_p
- && !ymmh_avx512_regnum_p
- && !bndr_regnum_p
- && !bnd_regnum_p
- && !mpx_ctrl_regnum_p
- && !zmm_regnum_p
- && !zmmh_regnum_p
- && !pkru_regnum_p);
+ return (!fp_regnum_p && !mmx_regnum_p && !mxcsr_regnum_p && !xmm_regnum_p
+ && !xmm_avx512_regnum_p && !ymm_regnum_p && !ymmh_regnum_p
+ && !ymm_avx512_regnum_p && !ymmh_avx512_regnum_p && !bndr_regnum_p
+ && !bnd_regnum_p && !mpx_ctrl_regnum_p && !zmm_regnum_p
+ && !zmmh_regnum_p && !pkru_regnum_p);
return default_register_reggroup_p (gdbarch, regnum, group);
}
-
/* Get the ARGIth function argument for the current function. */
static CORE_ADDR
-i386_fetch_pointer_argument (frame_info_ptr frame, int argi,
- struct type *type)
+i386_fetch_pointer_argument (frame_info_ptr frame, int argi, struct type *type)
{
struct gdbarch *gdbarch = get_frame_arch (frame);
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
@@ -4673,11 +4547,11 @@ i386_fetch_pointer_argument (frame_info_ptr frame, int argi,
return read_memory_unsigned_integer (sp + (4 * (argi + 1)), 4, byte_order);
}
-#define PREFIX_REPZ 0x01
-#define PREFIX_REPNZ 0x02
-#define PREFIX_LOCK 0x04
-#define PREFIX_DATA 0x08
-#define PREFIX_ADDR 0x10
+#define PREFIX_REPZ 0x01
+#define PREFIX_REPNZ 0x02
+#define PREFIX_LOCK 0x04
+#define PREFIX_DATA 0x08
+#define PREFIX_ADDR 0x10
/* operand size */
enum
@@ -4830,7 +4704,7 @@ i386_record_lea_modrm_addr (struct i386_record_s *irp, uint64_t *addr)
{
/* Since we are in 64-bit mode with ADDR32 prefix, zero-extend
address from 32-bit to 64-bit. */
- *addr = (uint32_t) *addr;
+ *addr = (uint32_t) *addr;
}
}
else
@@ -4933,7 +4807,7 @@ i386_record_lea_modrm_addr (struct i386_record_s *irp, uint64_t *addr)
*addr &= 0xffff;
}
- no_rm:
+no_rm:
return 0;
}
@@ -4951,7 +4825,7 @@ i386_record_lea_modrm (struct i386_record_s *irp)
{
if (record_full_memory_query)
{
- if (yquery (_("\
+ if (yquery (_ ("\
Process record ignores the memory change of instruction at address %s\n\
because it can't get the value of the segment register.\n\
Do you want to stop the program?"),
@@ -4983,27 +4857,25 @@ i386_record_push (struct i386_record_s *irp, int size)
irp->regmap[X86_RECORD_RESP_REGNUM]))
return -1;
regcache_raw_read_unsigned (irp->regcache,
- irp->regmap[X86_RECORD_RESP_REGNUM],
- &addr);
+ irp->regmap[X86_RECORD_RESP_REGNUM], &addr);
if (record_full_arch_list_add_mem ((CORE_ADDR) addr - size, size))
return -1;
return 0;
}
-
/* Defines contents to record. */
-#define I386_SAVE_FPU_REGS 0xfffd
-#define I386_SAVE_FPU_ENV 0xfffe
-#define I386_SAVE_FPU_ENV_REG_STACK 0xffff
+#define I386_SAVE_FPU_REGS 0xfffd
+#define I386_SAVE_FPU_ENV 0xfffe
+#define I386_SAVE_FPU_ENV_REG_STACK 0xffff
/* Record the values of the floating point registers which will be
changed by the current instruction. Returns -1 if something is
wrong, 0 otherwise. */
-static int i386_record_floats (struct gdbarch *gdbarch,
- struct i386_record_s *ir,
- uint32_t iregnum)
+static int
+i386_record_floats (struct gdbarch *gdbarch, struct i386_record_s *ir,
+ uint32_t iregnum)
{
i386_gdbarch_tdep *tdep = gdbarch_tdep<i386_gdbarch_tdep> (gdbarch);
int i;
@@ -5024,10 +4896,10 @@ static int i386_record_floats (struct gdbarch *gdbarch,
else if (I386_SAVE_FPU_ENV == iregnum)
{
for (i = I387_FCTRL_REGNUM (tdep); i <= I387_FOP_REGNUM (tdep); i++)
- {
- if (record_full_arch_list_add_reg (ir->regcache, i))
- return -1;
- }
+ {
+ if (record_full_arch_list_add_reg (ir->regcache, i))
+ return -1;
+ }
}
else if (I386_SAVE_FPU_ENV_REG_STACK == iregnum)
{
@@ -5035,10 +4907,10 @@ static int i386_record_floats (struct gdbarch *gdbarch,
if (record_full_arch_list_add_reg (ir->regcache, i))
return -1;
}
- else if ((iregnum >= I387_ST0_REGNUM (tdep)) &&
- (iregnum <= I387_FOP_REGNUM (tdep)))
+ else if ((iregnum >= I387_ST0_REGNUM (tdep))
+ && (iregnum <= I387_FOP_REGNUM (tdep)))
{
- if (record_full_arch_list_add_reg (ir->regcache,iregnum))
+ if (record_full_arch_list_add_reg (ir->regcache, iregnum))
return -1;
}
else
@@ -5046,13 +4918,13 @@ static int i386_record_floats (struct gdbarch *gdbarch,
/* Parameter error. */
return -1;
}
- if(I386_SAVE_FPU_ENV != iregnum)
+ if (I386_SAVE_FPU_ENV != iregnum)
{
- for (i = I387_FCTRL_REGNUM (tdep); i <= I387_FOP_REGNUM (tdep); i++)
- {
- if (record_full_arch_list_add_reg (ir->regcache, i))
- return -1;
- }
+ for (i = I387_FCTRL_REGNUM (tdep); i <= I387_FOP_REGNUM (tdep); i++)
+ {
+ if (record_full_arch_list_add_reg (ir->regcache, i))
+ return -1;
+ }
}
return 0;
}
@@ -5062,7 +4934,7 @@ static int i386_record_floats (struct gdbarch *gdbarch,
instruction. Returns -1 if something goes wrong, 0 otherwise. */
#define I386_RECORD_FULL_ARCH_LIST_ADD_REG(regnum) \
- record_full_arch_list_add_reg (ir.regcache, ir.regmap[(regnum)])
+ record_full_arch_list_add_reg (ir.regcache, ir.regmap[(regnum)])
int
i386_process_record (struct gdbarch *gdbarch, struct regcache *regcache,
@@ -5092,7 +4964,8 @@ i386_process_record (struct gdbarch *gdbarch, struct regcache *regcache,
ir.gdbarch = gdbarch;
if (record_debug > 1)
- gdb_printf (gdb_stdlog, "Process record: i386_process_record "
+ gdb_printf (gdb_stdlog,
+ "Process record: i386_process_record "
"addr = %s\n",
paddress (gdbarch, ir.addr));
@@ -5102,7 +4975,7 @@ i386_process_record (struct gdbarch *gdbarch, struct regcache *regcache,
if (record_read_memory (gdbarch, ir.addr, &opcode8, 1))
return -1;
ir.addr++;
- switch (opcode8) /* Instruction prefixes */
+ switch (opcode8) /* Instruction prefixes */
{
case REPE_PREFIX_OPCODE:
prefixes |= PREFIX_REPZ;
@@ -5137,31 +5010,31 @@ i386_process_record (struct gdbarch *gdbarch, struct regcache *regcache,
case ADDR_PREFIX_OPCODE:
prefixes |= PREFIX_ADDR;
break;
- case 0x40: /* i386 inc %eax */
- case 0x41: /* i386 inc %ecx */
- case 0x42: /* i386 inc %edx */
- case 0x43: /* i386 inc %ebx */
- case 0x44: /* i386 inc %esp */
- case 0x45: /* i386 inc %ebp */
- case 0x46: /* i386 inc %esi */
- case 0x47: /* i386 inc %edi */
- case 0x48: /* i386 dec %eax */
- case 0x49: /* i386 dec %ecx */
- case 0x4a: /* i386 dec %edx */
- case 0x4b: /* i386 dec %ebx */
- case 0x4c: /* i386 dec %esp */
- case 0x4d: /* i386 dec %ebp */
- case 0x4e: /* i386 dec %esi */
- case 0x4f: /* i386 dec %edi */
- if (ir.regmap[X86_RECORD_R8_REGNUM]) /* 64 bit target */
+ case 0x40: /* i386 inc %eax */
+ case 0x41: /* i386 inc %ecx */
+ case 0x42: /* i386 inc %edx */
+ case 0x43: /* i386 inc %ebx */
+ case 0x44: /* i386 inc %esp */
+ case 0x45: /* i386 inc %ebp */
+ case 0x46: /* i386 inc %esi */
+ case 0x47: /* i386 inc %edi */
+ case 0x48: /* i386 dec %eax */
+ case 0x49: /* i386 dec %ecx */
+ case 0x4a: /* i386 dec %edx */
+ case 0x4b: /* i386 dec %ebx */
+ case 0x4c: /* i386 dec %esp */
+ case 0x4d: /* i386 dec %ebp */
+ case 0x4e: /* i386 dec %esi */
+ case 0x4f: /* i386 dec %edi */
+ if (ir.regmap[X86_RECORD_R8_REGNUM]) /* 64 bit target */
{
- /* REX */
- rex_w = (opcode8 >> 3) & 1;
- rex_r = (opcode8 & 0x4) << 1;
- ir.rex_x = (opcode8 & 0x2) << 2;
- ir.rex_b = (opcode8 & 0x1) << 3;
+ /* REX */
+ rex_w = (opcode8 >> 3) & 1;
+ rex_r = (opcode8 & 0x4) << 1;
+ ir.rex_x = (opcode8 & 0x2) << 2;
+ ir.rex_b = (opcode8 & 0x1) << 3;
}
- else /* 32 bit target */
+ else /* 32 bit target */
goto out_prefixes;
break;
default:
@@ -5169,7 +5042,7 @@ i386_process_record (struct gdbarch *gdbarch, struct regcache *regcache,
break;
}
}
- out_prefixes:
+out_prefixes:
if (ir.regmap[X86_RECORD_R8_REGNUM] && rex_w == 1)
{
ir.dflag = 2;
@@ -5186,7 +5059,7 @@ i386_process_record (struct gdbarch *gdbarch, struct regcache *regcache,
/* Now check op code. */
opcode = (uint32_t) opcode8;
- reswitch:
+reswitch:
switch (opcode)
{
case 0x0f:
@@ -5197,7 +5070,7 @@ i386_process_record (struct gdbarch *gdbarch, struct regcache *regcache,
goto reswitch;
break;
- case 0x00: /* arith & logic */
+ case 0x00: /* arith & logic */
case 0x01:
case 0x02:
case 0x03:
@@ -5254,7 +5127,7 @@ i386_process_record (struct gdbarch *gdbarch, struct regcache *regcache,
switch ((opcode >> 1) & 3)
{
- case 0: /* OP Ev, Gv */
+ case 0: /* OP Ev, Gv */
if (i386_record_modrm (&ir))
return -1;
if (ir.mod != 3)
@@ -5270,7 +5143,7 @@ i386_process_record (struct gdbarch *gdbarch, struct regcache *regcache,
I386_RECORD_FULL_ARCH_LIST_ADD_REG (ir.rm);
}
break;
- case 1: /* OP Gv, Ev */
+ case 1: /* OP Gv, Ev */
if (i386_record_modrm (&ir))
return -1;
ir.reg |= rex_r;
@@ -5278,7 +5151,7 @@ i386_process_record (struct gdbarch *gdbarch, struct regcache *regcache,
ir.reg &= 0x3;
I386_RECORD_FULL_ARCH_LIST_ADD_REG (ir.reg);
break;
- case 2: /* OP A, Iv */
+ case 2: /* OP A, Iv */
I386_RECORD_FULL_ARCH_LIST_ADD_REG (X86_RECORD_REAX_REGNUM);
break;
}
@@ -5286,7 +5159,7 @@ i386_process_record (struct gdbarch *gdbarch, struct regcache *regcache,
I386_RECORD_FULL_ARCH_LIST_ADD_REG (X86_RECORD_EFLAGS_REGNUM);
break;
- case 0x80: /* GRP1 */
+ case 0x80: /* GRP1 */
case 0x81:
case 0x82:
case 0x83:
@@ -5315,7 +5188,7 @@ i386_process_record (struct gdbarch *gdbarch, struct regcache *regcache,
I386_RECORD_FULL_ARCH_LIST_ADD_REG (X86_RECORD_EFLAGS_REGNUM);
break;
- case 0x40: /* inc */
+ case 0x40: /* inc */
case 0x41:
case 0x42:
case 0x43:
@@ -5324,7 +5197,7 @@ i386_process_record (struct gdbarch *gdbarch, struct regcache *regcache,
case 0x46:
case 0x47:
- case 0x48: /* dec */
+ case 0x48: /* dec */
case 0x49:
case 0x4a:
case 0x4b:
@@ -5337,7 +5210,7 @@ i386_process_record (struct gdbarch *gdbarch, struct regcache *regcache,
I386_RECORD_FULL_ARCH_LIST_ADD_REG (X86_RECORD_EFLAGS_REGNUM);
break;
- case 0xf6: /* GRP3 */
+ case 0xf6: /* GRP3 */
case 0xf7:
if ((opcode & 1) == 0)
ir.ot = OT_BYTE;
@@ -5351,11 +5224,11 @@ i386_process_record (struct gdbarch *gdbarch, struct regcache *regcache,
switch (ir.reg)
{
- case 0: /* test */
+ case 0: /* test */
I386_RECORD_FULL_ARCH_LIST_ADD_REG (X86_RECORD_EFLAGS_REGNUM);
break;
- case 2: /* not */
- case 3: /* neg */
+ case 2: /* not */
+ case 3: /* neg */
if (ir.mod != 3)
{
if (i386_record_lea_modrm (&ir))
@@ -5368,13 +5241,13 @@ i386_process_record (struct gdbarch *gdbarch, struct regcache *regcache,
ir.rm &= 0x3;
I386_RECORD_FULL_ARCH_LIST_ADD_REG (ir.rm);
}
- if (ir.reg == 3) /* neg */
+ if (ir.reg == 3) /* neg */
I386_RECORD_FULL_ARCH_LIST_ADD_REG (X86_RECORD_EFLAGS_REGNUM);
break;
- case 4: /* mul */
- case 5: /* imul */
- case 6: /* div */
- case 7: /* idiv */
+ case 4: /* mul */
+ case 5: /* imul */
+ case 6: /* div */
+ case 7: /* idiv */
I386_RECORD_FULL_ARCH_LIST_ADD_REG (X86_RECORD_REAX_REGNUM);
if (ir.ot != OT_BYTE)
I386_RECORD_FULL_ARCH_LIST_ADD_REG (X86_RECORD_REDX_REGNUM);
@@ -5388,8 +5261,8 @@ i386_process_record (struct gdbarch *gdbarch, struct regcache *regcache,
}
break;
- case 0xfe: /* GRP4 */
- case 0xff: /* GRP5 */
+ case 0xfe: /* GRP4 */
+ case 0xff: /* GRP5 */
if (i386_record_modrm (&ir))
return -1;
if (ir.reg >= 2 && opcode == 0xfe)
@@ -5400,8 +5273,8 @@ i386_process_record (struct gdbarch *gdbarch, struct regcache *regcache,
}
switch (ir.reg)
{
- case 0: /* inc */
- case 1: /* dec */
+ case 0: /* inc */
+ case 1: /* dec */
if ((opcode & 1) == 0)
ir.ot = OT_BYTE;
else
@@ -5420,24 +5293,24 @@ i386_process_record (struct gdbarch *gdbarch, struct regcache *regcache,
}
I386_RECORD_FULL_ARCH_LIST_ADD_REG (X86_RECORD_EFLAGS_REGNUM);
break;
- case 2: /* call */
+ case 2: /* call */
if (ir.regmap[X86_RECORD_R8_REGNUM] && ir.dflag)
ir.dflag = 2;
if (i386_record_push (&ir, 1 << (ir.dflag + 1)))
return -1;
I386_RECORD_FULL_ARCH_LIST_ADD_REG (X86_RECORD_EFLAGS_REGNUM);
break;
- case 3: /* lcall */
+ case 3: /* lcall */
I386_RECORD_FULL_ARCH_LIST_ADD_REG (X86_RECORD_CS_REGNUM);
if (i386_record_push (&ir, 1 << (ir.dflag + 1)))
return -1;
I386_RECORD_FULL_ARCH_LIST_ADD_REG (X86_RECORD_EFLAGS_REGNUM);
break;
- case 4: /* jmp */
- case 5: /* ljmp */
+ case 4: /* jmp */
+ case 5: /* ljmp */
I386_RECORD_FULL_ARCH_LIST_ADD_REG (X86_RECORD_EFLAGS_REGNUM);
break;
- case 6: /* push */
+ case 6: /* push */
if (ir.regmap[X86_RECORD_R8_REGNUM] && ir.dflag)
ir.dflag = 2;
if (i386_record_push (&ir, 1 << (ir.dflag + 1)))
@@ -5451,23 +5324,23 @@ i386_process_record (struct gdbarch *gdbarch, struct regcache *regcache,
}
break;
- case 0x84: /* test */
+ case 0x84: /* test */
case 0x85:
case 0xa8:
case 0xa9:
I386_RECORD_FULL_ARCH_LIST_ADD_REG (X86_RECORD_EFLAGS_REGNUM);
break;
- case 0x98: /* CWDE/CBW */
+ case 0x98: /* CWDE/CBW */
I386_RECORD_FULL_ARCH_LIST_ADD_REG (X86_RECORD_REAX_REGNUM);
break;
- case 0x99: /* CDQ/CWD */
+ case 0x99: /* CDQ/CWD */
I386_RECORD_FULL_ARCH_LIST_ADD_REG (X86_RECORD_REAX_REGNUM);
I386_RECORD_FULL_ARCH_LIST_ADD_REG (X86_RECORD_REDX_REGNUM);
break;
- case 0x0faf: /* imul */
+ case 0x0faf: /* imul */
case 0x69:
case 0x6b:
ir.ot = ir.dflag + OT_WORD;
@@ -5484,7 +5357,7 @@ i386_process_record (struct gdbarch *gdbarch, struct regcache *regcache,
I386_RECORD_FULL_ARCH_LIST_ADD_REG (X86_RECORD_EFLAGS_REGNUM);
break;
- case 0x0fc0: /* xadd */
+ case 0x0fc0: /* xadd */
case 0x0fc1:
if ((opcode & 1) == 0)
ir.ot = OT_BYTE;
@@ -5513,7 +5386,7 @@ i386_process_record (struct gdbarch *gdbarch, struct regcache *regcache,
I386_RECORD_FULL_ARCH_LIST_ADD_REG (X86_RECORD_EFLAGS_REGNUM);
break;
- case 0x0fb0: /* cmpxchg */
+ case 0x0fb0: /* cmpxchg */
case 0x0fb1:
if ((opcode & 1) == 0)
ir.ot = OT_BYTE;
@@ -5538,7 +5411,7 @@ i386_process_record (struct gdbarch *gdbarch, struct regcache *regcache,
I386_RECORD_FULL_ARCH_LIST_ADD_REG (X86_RECORD_EFLAGS_REGNUM);
break;
- case 0x0fc7: /* cmpxchg8b / rdrand / rdseed */
+ case 0x0fc7: /* cmpxchg8b / rdrand / rdseed */
if (i386_record_modrm (&ir))
return -1;
if (ir.mod == 3)
@@ -5576,7 +5449,7 @@ i386_process_record (struct gdbarch *gdbarch, struct regcache *regcache,
I386_RECORD_FULL_ARCH_LIST_ADD_REG (X86_RECORD_EFLAGS_REGNUM);
break;
- case 0x50: /* push */
+ case 0x50: /* push */
case 0x51:
case 0x52:
case 0x53:
@@ -5592,10 +5465,10 @@ i386_process_record (struct gdbarch *gdbarch, struct regcache *regcache,
return -1;
break;
- case 0x06: /* push es */
- case 0x0e: /* push cs */
- case 0x16: /* push ss */
- case 0x1e: /* push ds */
+ case 0x06: /* push es */
+ case 0x0e: /* push cs */
+ case 0x16: /* push ss */
+ case 0x1e: /* push ds */
if (ir.regmap[X86_RECORD_R8_REGNUM])
{
ir.addr -= 1;
@@ -5605,8 +5478,8 @@ i386_process_record (struct gdbarch *gdbarch, struct regcache *regcache,
return -1;
break;
- case 0x0fa0: /* push fs */
- case 0x0fa8: /* push gs */
+ case 0x0fa0: /* push fs */
+ case 0x0fa8: /* push gs */
if (ir.regmap[X86_RECORD_R8_REGNUM])
{
ir.addr -= 2;
@@ -5616,7 +5489,7 @@ i386_process_record (struct gdbarch *gdbarch, struct regcache *regcache,
return -1;
break;
- case 0x60: /* pusha */
+ case 0x60: /* pusha */
if (ir.regmap[X86_RECORD_R8_REGNUM])
{
ir.addr -= 1;
@@ -5626,7 +5499,7 @@ i386_process_record (struct gdbarch *gdbarch, struct regcache *regcache,
return -1;
break;
- case 0x58: /* pop */
+ case 0x58: /* pop */
case 0x59:
case 0x5a:
case 0x5b:
@@ -5638,19 +5511,18 @@ i386_process_record (struct gdbarch *gdbarch, struct regcache *regcache,
I386_RECORD_FULL_ARCH_LIST_ADD_REG ((opcode & 0x7) | ir.rex_b);
break;
- case 0x61: /* popa */
+ case 0x61: /* popa */
if (ir.regmap[X86_RECORD_R8_REGNUM])
{
ir.addr -= 1;
goto no_support;
}
- for (regnum = X86_RECORD_REAX_REGNUM;
- regnum <= X86_RECORD_REDI_REGNUM;
+ for (regnum = X86_RECORD_REAX_REGNUM; regnum <= X86_RECORD_REDI_REGNUM;
regnum++)
I386_RECORD_FULL_ARCH_LIST_ADD_REG (regnum);
break;
- case 0x8f: /* pop */
+ case 0x8f: /* pop */
if (ir.regmap[X86_RECORD_R8_REGNUM])
ir.ot = ir.dflag ? OT_QUAD : OT_WORD;
else
@@ -5668,7 +5540,7 @@ i386_process_record (struct gdbarch *gdbarch, struct regcache *regcache,
I386_RECORD_FULL_ARCH_LIST_ADD_REG (X86_RECORD_RESP_REGNUM);
break;
- case 0xc8: /* enter */
+ case 0xc8: /* enter */
I386_RECORD_FULL_ARCH_LIST_ADD_REG (X86_RECORD_REBP_REGNUM);
if (ir.regmap[X86_RECORD_R8_REGNUM] && ir.dflag)
ir.dflag = 2;
@@ -5676,12 +5548,12 @@ i386_process_record (struct gdbarch *gdbarch, struct regcache *regcache,
return -1;
break;
- case 0xc9: /* leave */
+ case 0xc9: /* leave */
I386_RECORD_FULL_ARCH_LIST_ADD_REG (X86_RECORD_RESP_REGNUM);
I386_RECORD_FULL_ARCH_LIST_ADD_REG (X86_RECORD_REBP_REGNUM);
break;
- case 0x07: /* pop es */
+ case 0x07: /* pop es */
if (ir.regmap[X86_RECORD_R8_REGNUM])
{
ir.addr -= 1;
@@ -5692,7 +5564,7 @@ i386_process_record (struct gdbarch *gdbarch, struct regcache *regcache,
I386_RECORD_FULL_ARCH_LIST_ADD_REG (X86_RECORD_EFLAGS_REGNUM);
break;
- case 0x17: /* pop ss */
+ case 0x17: /* pop ss */
if (ir.regmap[X86_RECORD_R8_REGNUM])
{
ir.addr -= 1;
@@ -5703,7 +5575,7 @@ i386_process_record (struct gdbarch *gdbarch, struct regcache *regcache,
I386_RECORD_FULL_ARCH_LIST_ADD_REG (X86_RECORD_EFLAGS_REGNUM);
break;
- case 0x1f: /* pop ds */
+ case 0x1f: /* pop ds */
if (ir.regmap[X86_RECORD_R8_REGNUM])
{
ir.addr -= 1;
@@ -5714,19 +5586,19 @@ i386_process_record (struct gdbarch *gdbarch, struct regcache *regcache,
I386_RECORD_FULL_ARCH_LIST_ADD_REG (X86_RECORD_EFLAGS_REGNUM);
break;
- case 0x0fa1: /* pop fs */
+ case 0x0fa1: /* pop fs */
I386_RECORD_FULL_ARCH_LIST_ADD_REG (X86_RECORD_RESP_REGNUM);
I386_RECORD_FULL_ARCH_LIST_ADD_REG (X86_RECORD_FS_REGNUM);
I386_RECORD_FULL_ARCH_LIST_ADD_REG (X86_RECORD_EFLAGS_REGNUM);
break;
- case 0x0fa9: /* pop gs */
+ case 0x0fa9: /* pop gs */
I386_RECORD_FULL_ARCH_LIST_ADD_REG (X86_RECORD_RESP_REGNUM);
I386_RECORD_FULL_ARCH_LIST_ADD_REG (X86_RECORD_GS_REGNUM);
I386_RECORD_FULL_ARCH_LIST_ADD_REG (X86_RECORD_EFLAGS_REGNUM);
break;
- case 0x88: /* mov */
+ case 0x88: /* mov */
case 0x89:
case 0xc6:
case 0xc7:
@@ -5755,7 +5627,7 @@ i386_process_record (struct gdbarch *gdbarch, struct regcache *regcache,
}
break;
- case 0x8a: /* mov */
+ case 0x8a: /* mov */
case 0x8b:
if ((opcode & 1) == 0)
ir.ot = OT_BYTE;
@@ -5769,7 +5641,7 @@ i386_process_record (struct gdbarch *gdbarch, struct regcache *regcache,
I386_RECORD_FULL_ARCH_LIST_ADD_REG (ir.reg);
break;
- case 0x8c: /* mov seg */
+ case 0x8c: /* mov seg */
if (i386_record_modrm (&ir))
return -1;
if (ir.reg > 5)
@@ -5789,7 +5661,7 @@ i386_process_record (struct gdbarch *gdbarch, struct regcache *regcache,
}
break;
- case 0x8e: /* mov seg */
+ case 0x8e: /* mov seg */
if (i386_record_modrm (&ir))
return -1;
switch (ir.reg)
@@ -5819,16 +5691,16 @@ i386_process_record (struct gdbarch *gdbarch, struct regcache *regcache,
I386_RECORD_FULL_ARCH_LIST_ADD_REG (X86_RECORD_EFLAGS_REGNUM);
break;
- case 0x0fb6: /* movzbS */
- case 0x0fb7: /* movzwS */
- case 0x0fbe: /* movsbS */
- case 0x0fbf: /* movswS */
+ case 0x0fb6: /* movzbS */
+ case 0x0fb7: /* movzwS */
+ case 0x0fbe: /* movsbS */
+ case 0x0fbf: /* movswS */
if (i386_record_modrm (&ir))
return -1;
I386_RECORD_FULL_ARCH_LIST_ADD_REG (ir.reg | rex_r);
break;
- case 0x8d: /* lea */
+ case 0x8d: /* lea */
if (i386_record_modrm (&ir))
return -1;
if (ir.mod == 3)
@@ -5844,20 +5716,20 @@ i386_process_record (struct gdbarch *gdbarch, struct regcache *regcache,
I386_RECORD_FULL_ARCH_LIST_ADD_REG (ir.reg);
break;
- case 0xa0: /* mov EAX */
+ case 0xa0: /* mov EAX */
case 0xa1:
- case 0xd7: /* xlat */
+ case 0xd7: /* xlat */
I386_RECORD_FULL_ARCH_LIST_ADD_REG (X86_RECORD_REAX_REGNUM);
break;
- case 0xa2: /* mov EAX */
+ case 0xa2: /* mov EAX */
case 0xa3:
if (ir.override >= 0)
{
if (record_full_memory_query)
{
- if (yquery (_("\
+ if (yquery (_ ("\
Process record ignores the memory change of instruction at address %s\n\
because it can't get the value of the segment register.\n\
Do you want to stop the program?"),
@@ -5897,7 +5769,7 @@ Do you want to stop the program?"),
}
break;
- case 0xb0: /* mov R, Ib */
+ case 0xb0: /* mov R, Ib */
case 0xb1:
case 0xb2:
case 0xb3:
@@ -5906,11 +5778,11 @@ Do you want to stop the program?"),
case 0xb6:
case 0xb7:
I386_RECORD_FULL_ARCH_LIST_ADD_REG ((ir.regmap[X86_RECORD_R8_REGNUM])
- ? ((opcode & 0x7) | ir.rex_b)
- : ((opcode & 0x7) & 0x3));
+ ? ((opcode & 0x7) | ir.rex_b)
+ : ((opcode & 0x7) & 0x3));
break;
- case 0xb8: /* mov R, Iv */
+ case 0xb8: /* mov R, Iv */
case 0xb9:
case 0xba:
case 0xbb:
@@ -5921,7 +5793,7 @@ Do you want to stop the program?"),
I386_RECORD_FULL_ARCH_LIST_ADD_REG ((opcode & 0x7) | ir.rex_b);
break;
- case 0x91: /* xchg R, EAX */
+ case 0x91: /* xchg R, EAX */
case 0x92:
case 0x93:
case 0x94:
@@ -5932,7 +5804,7 @@ Do you want to stop the program?"),
I386_RECORD_FULL_ARCH_LIST_ADD_REG (opcode & 0x7);
break;
- case 0x86: /* xchg Ev, Gv */
+ case 0x86: /* xchg Ev, Gv */
case 0x87:
if ((opcode & 1) == 0)
ir.ot = OT_BYTE;
@@ -5958,17 +5830,17 @@ Do you want to stop the program?"),
I386_RECORD_FULL_ARCH_LIST_ADD_REG (ir.reg);
break;
- case 0xc4: /* les Gv */
- case 0xc5: /* lds Gv */
+ case 0xc4: /* les Gv */
+ case 0xc5: /* lds Gv */
if (ir.regmap[X86_RECORD_R8_REGNUM])
{
ir.addr -= 1;
goto no_support;
}
/* FALLTHROUGH */
- case 0x0fb2: /* lss Gv */
- case 0x0fb4: /* lfs Gv */
- case 0x0fb5: /* lgs Gv */
+ case 0x0fb2: /* lss Gv */
+ case 0x0fb4: /* lfs Gv */
+ case 0x0fb5: /* lgs Gv */
if (i386_record_modrm (&ir))
return -1;
if (ir.mod == 3)
@@ -5982,19 +5854,19 @@ Do you want to stop the program?"),
}
switch (opcode)
{
- case 0xc4: /* les Gv */
+ case 0xc4: /* les Gv */
regnum = X86_RECORD_ES_REGNUM;
break;
- case 0xc5: /* lds Gv */
+ case 0xc5: /* lds Gv */
regnum = X86_RECORD_DS_REGNUM;
break;
- case 0x0fb2: /* lss Gv */
+ case 0x0fb2: /* lss Gv */
regnum = X86_RECORD_SS_REGNUM;
break;
- case 0x0fb4: /* lfs Gv */
+ case 0x0fb4: /* lfs Gv */
regnum = X86_RECORD_FS_REGNUM;
break;
- case 0x0fb5: /* lgs Gv */
+ case 0x0fb5: /* lgs Gv */
regnum = X86_RECORD_GS_REGNUM;
break;
}
@@ -6003,7 +5875,7 @@ Do you want to stop the program?"),
I386_RECORD_FULL_ARCH_LIST_ADD_REG (X86_RECORD_EFLAGS_REGNUM);
break;
- case 0xc0: /* shifts */
+ case 0xc0: /* shifts */
case 0xc1:
case 0xd0:
case 0xd1:
@@ -6048,7 +5920,7 @@ Do you want to stop the program?"),
}
break;
- case 0xd8: /* Floats. */
+ case 0xd8: /* Floats. */
case 0xd9:
case 0xda:
case 0xdb:
@@ -6173,8 +6045,7 @@ Do you want to stop the program?"),
case 1:
if (record_full_arch_list_add_mem (addr64, 4))
return -1;
- if ((3 == (ir.reg & 7))
- || (5 == (ir.reg & 7))
+ if ((3 == (ir.reg & 7)) || (5 == (ir.reg & 7))
|| (7 == (ir.reg & 7)))
{
/* For fstp insn. */
@@ -6315,8 +6186,9 @@ Do you want to stop the program?"),
if ((ir.modrm & 0x0f) - 0x08)
{
if (i386_record_floats (gdbarch, &ir,
- I387_ST0_REGNUM (tdep) +
- ((ir.modrm & 0x0f) - 0x08)))
+ I387_ST0_REGNUM (tdep)
+ + ((ir.modrm & 0x0f)
+ - 0x08)))
return -1;
}
}
@@ -6382,15 +6254,15 @@ Do you want to stop the program?"),
if (((ir.modrm & 0x0f) > 0) && ((ir.modrm & 0x0f) <= 7))
{
if (i386_record_floats (gdbarch, &ir,
- I387_ST0_REGNUM (tdep) +
- (ir.modrm & 0x0f)))
+ I387_ST0_REGNUM (tdep)
+ + (ir.modrm & 0x0f)))
return -1;
}
else if ((ir.modrm & 0x0f) - 0x08)
{
if (i386_record_floats (gdbarch, &ir,
- I387_ST0_REGNUM (tdep) +
- ((ir.modrm & 0x0f) - 0x08)))
+ I387_ST0_REGNUM (tdep)
+ + ((ir.modrm & 0x0f) - 0x08)))
return -1;
}
}
@@ -6409,36 +6281,35 @@ Do you want to stop the program?"),
if (((ir.modrm & 0x0f) > 0) && ((ir.modrm & 0x0f) <= 7))
{
if (i386_record_floats (gdbarch, &ir,
- I387_ST0_REGNUM (tdep) +
- (ir.modrm & 0x0f)))
+ I387_ST0_REGNUM (tdep)
+ + (ir.modrm & 0x0f)))
return -1;
}
else if ((ir.modrm & 0x0f) - 0x08)
{
if (i386_record_floats (gdbarch, &ir,
- I387_ST0_REGNUM (tdep) +
- ((ir.modrm & 0x0f) - 0x08)))
+ I387_ST0_REGNUM (tdep)
+ + ((ir.modrm & 0x0f) - 0x08)))
return -1;
}
}
break;
case 0xdc:
- if ((0x0c == ir.modrm >> 4)
- || (0x0d == ir.modrm >> 4)
+ if ((0x0c == ir.modrm >> 4) || (0x0d == ir.modrm >> 4)
|| (0x0f == ir.modrm >> 4))
{
if ((ir.modrm & 0x0f) <= 7)
{
if (i386_record_floats (gdbarch, &ir,
- I387_ST0_REGNUM (tdep) +
- (ir.modrm & 0x0f)))
+ I387_ST0_REGNUM (tdep)
+ + (ir.modrm & 0x0f)))
return -1;
}
else
{
if (i386_record_floats (gdbarch, &ir,
- I387_ST0_REGNUM (tdep) +
- ((ir.modrm & 0x0f) - 0x08)))
+ I387_ST0_REGNUM (tdep)
+ + ((ir.modrm & 0x0f) - 0x08)))
return -1;
}
}
@@ -6455,8 +6326,8 @@ Do you want to stop the program?"),
if ((ir.modrm & 0x0f) <= 7)
{
if (i386_record_floats (gdbarch, &ir,
- I387_ST0_REGNUM (tdep) +
- (ir.modrm & 0x0f)))
+ I387_ST0_REGNUM (tdep)
+ + (ir.modrm & 0x0f)))
return -1;
}
else
@@ -6468,10 +6339,8 @@ Do you want to stop the program?"),
}
break;
case 0xde:
- if ((0x0c == ir.modrm >> 4)
- || (0x0e == ir.modrm >> 4)
- || (0x0f == ir.modrm >> 4)
- || (0xd9 == ir.modrm))
+ if ((0x0c == ir.modrm >> 4) || (0x0e == ir.modrm >> 4)
+ || (0x0f == ir.modrm >> 4) || (0xd9 == ir.modrm))
{
if (i386_record_floats (gdbarch, &ir, I386_SAVE_FPU_REGS))
return -1;
@@ -6494,15 +6363,14 @@ Do you want to stop the program?"),
}
break;
/* string ops */
- case 0xa4: /* movsS */
+ case 0xa4: /* movsS */
case 0xa5:
- case 0xaa: /* stosS */
+ case 0xaa: /* stosS */
case 0xab:
- case 0x6c: /* insS */
+ case 0x6c: /* insS */
case 0x6d:
regcache_raw_read_unsigned (ir.regcache,
- ir.regmap[X86_RECORD_RECX_REGNUM],
- &addr);
+ ir.regmap[X86_RECORD_RECX_REGNUM], &addr);
if (addr)
{
ULONGEST es, ds;
@@ -6516,17 +6384,15 @@ Do you want to stop the program?"),
&addr);
regcache_raw_read_unsigned (ir.regcache,
- ir.regmap[X86_RECORD_ES_REGNUM],
- &es);
+ ir.regmap[X86_RECORD_ES_REGNUM], &es);
regcache_raw_read_unsigned (ir.regcache,
- ir.regmap[X86_RECORD_DS_REGNUM],
- &ds);
+ ir.regmap[X86_RECORD_DS_REGNUM], &ds);
if (ir.aflag && (es != ds))
{
/* addr += ((uint32_t) read_register (I386_ES_REGNUM)) << 4; */
if (record_full_memory_query)
{
- if (yquery (_("\
+ if (yquery (_ ("\
Process record ignores the memory change of instruction at address %s\n\
because it can't get the value of the segment register.\n\
Do you want to stop the program?"),
@@ -6549,7 +6415,7 @@ Do you want to stop the program?"),
}
break;
- case 0xa6: /* cmpsS */
+ case 0xa6: /* cmpsS */
case 0xa7:
I386_RECORD_FULL_ARCH_LIST_ADD_REG (X86_RECORD_REDI_REGNUM);
I386_RECORD_FULL_ARCH_LIST_ADD_REG (X86_RECORD_RESI_REGNUM);
@@ -6558,7 +6424,7 @@ Do you want to stop the program?"),
I386_RECORD_FULL_ARCH_LIST_ADD_REG (X86_RECORD_EFLAGS_REGNUM);
break;
- case 0xac: /* lodsS */
+ case 0xac: /* lodsS */
case 0xad:
I386_RECORD_FULL_ARCH_LIST_ADD_REG (X86_RECORD_REAX_REGNUM);
I386_RECORD_FULL_ARCH_LIST_ADD_REG (X86_RECORD_RESI_REGNUM);
@@ -6567,7 +6433,7 @@ Do you want to stop the program?"),
I386_RECORD_FULL_ARCH_LIST_ADD_REG (X86_RECORD_EFLAGS_REGNUM);
break;
- case 0xae: /* scasS */
+ case 0xae: /* scasS */
case 0xaf:
I386_RECORD_FULL_ARCH_LIST_ADD_REG (X86_RECORD_REDI_REGNUM);
if (prefixes & (PREFIX_REPZ | PREFIX_REPNZ))
@@ -6575,7 +6441,7 @@ Do you want to stop the program?"),
I386_RECORD_FULL_ARCH_LIST_ADD_REG (X86_RECORD_EFLAGS_REGNUM);
break;
- case 0x6e: /* outsS */
+ case 0x6e: /* outsS */
case 0x6f:
I386_RECORD_FULL_ARCH_LIST_ADD_REG (X86_RECORD_RESI_REGNUM);
if (prefixes & (PREFIX_REPZ | PREFIX_REPNZ))
@@ -6583,7 +6449,7 @@ Do you want to stop the program?"),
I386_RECORD_FULL_ARCH_LIST_ADD_REG (X86_RECORD_EFLAGS_REGNUM);
break;
- case 0xe4: /* port I/O */
+ case 0xe4: /* port I/O */
case 0xe5:
case 0xec:
case 0xed:
@@ -6598,28 +6464,28 @@ Do you want to stop the program?"),
break;
/* control */
- case 0xc2: /* ret im */
- case 0xc3: /* ret */
+ case 0xc2: /* ret im */
+ case 0xc3: /* ret */
I386_RECORD_FULL_ARCH_LIST_ADD_REG (X86_RECORD_RESP_REGNUM);
I386_RECORD_FULL_ARCH_LIST_ADD_REG (X86_RECORD_EFLAGS_REGNUM);
break;
- case 0xca: /* lret im */
- case 0xcb: /* lret */
- case 0xcf: /* iret */
+ case 0xca: /* lret im */
+ case 0xcb: /* lret */
+ case 0xcf: /* iret */
I386_RECORD_FULL_ARCH_LIST_ADD_REG (X86_RECORD_CS_REGNUM);
I386_RECORD_FULL_ARCH_LIST_ADD_REG (X86_RECORD_RESP_REGNUM);
I386_RECORD_FULL_ARCH_LIST_ADD_REG (X86_RECORD_EFLAGS_REGNUM);
break;
- case 0xe8: /* call im */
+ case 0xe8: /* call im */
if (ir.regmap[X86_RECORD_R8_REGNUM] && ir.dflag)
ir.dflag = 2;
if (i386_record_push (&ir, 1 << (ir.dflag + 1)))
return -1;
break;
- case 0x9a: /* lcall im */
+ case 0x9a: /* lcall im */
if (ir.regmap[X86_RECORD_R8_REGNUM])
{
ir.addr -= 1;
@@ -6630,10 +6496,10 @@ Do you want to stop the program?"),
return -1;
break;
- case 0xe9: /* jmp im */
- case 0xea: /* ljmp im */
- case 0xeb: /* jmp Jb */
- case 0x70: /* jcc Jb */
+ case 0xe9: /* jmp im */
+ case 0xea: /* ljmp im */
+ case 0xeb: /* jmp Jb */
+ case 0x70: /* jcc Jb */
case 0x71:
case 0x72:
case 0x73:
@@ -6649,7 +6515,7 @@ Do you want to stop the program?"),
case 0x7d:
case 0x7e:
case 0x7f:
- case 0x0f80: /* jcc Jv */
+ case 0x0f80: /* jcc Jv */
case 0x0f81:
case 0x0f82:
case 0x0f83:
@@ -6667,7 +6533,7 @@ Do you want to stop the program?"),
case 0x0f8f:
break;
- case 0x0f90: /* setcc Gv */
+ case 0x0f90: /* setcc Gv */
case 0x0f91:
case 0x0f92:
case 0x0f93:
@@ -6689,7 +6555,7 @@ Do you want to stop the program?"),
return -1;
if (ir.mod == 3)
I386_RECORD_FULL_ARCH_LIST_ADD_REG (ir.rex_b ? (ir.rm | ir.rex_b)
- : (ir.rm & 0x3));
+ : (ir.rm & 0x3));
else
{
if (i386_record_lea_modrm (&ir))
@@ -6697,7 +6563,7 @@ Do you want to stop the program?"),
}
break;
- case 0x0f40: /* cmov Gv, Ev */
+ case 0x0f40: /* cmov Gv, Ev */
case 0x0f41:
case 0x0f42:
case 0x0f43:
@@ -6722,7 +6588,7 @@ Do you want to stop the program?"),
break;
/* flags */
- case 0x9c: /* pushf */
+ case 0x9c: /* pushf */
I386_RECORD_FULL_ARCH_LIST_ADD_REG (X86_RECORD_EFLAGS_REGNUM);
if (ir.regmap[X86_RECORD_R8_REGNUM] && ir.dflag)
ir.dflag = 2;
@@ -6730,27 +6596,27 @@ Do you want to stop the program?"),
return -1;
break;
- case 0x9d: /* popf */
+ case 0x9d: /* popf */
I386_RECORD_FULL_ARCH_LIST_ADD_REG (X86_RECORD_RESP_REGNUM);
I386_RECORD_FULL_ARCH_LIST_ADD_REG (X86_RECORD_EFLAGS_REGNUM);
break;
- case 0x9e: /* sahf */
+ case 0x9e: /* sahf */
if (ir.regmap[X86_RECORD_R8_REGNUM])
{
ir.addr -= 1;
goto no_support;
}
/* FALLTHROUGH */
- case 0xf5: /* cmc */
- case 0xf8: /* clc */
- case 0xf9: /* stc */
- case 0xfc: /* cld */
- case 0xfd: /* std */
+ case 0xf5: /* cmc */
+ case 0xf8: /* clc */
+ case 0xf9: /* stc */
+ case 0xfc: /* cld */
+ case 0xfd: /* std */
I386_RECORD_FULL_ARCH_LIST_ADD_REG (X86_RECORD_EFLAGS_REGNUM);
break;
- case 0x9f: /* lahf */
+ case 0x9f: /* lahf */
if (ir.regmap[X86_RECORD_R8_REGNUM])
{
ir.addr -= 1;
@@ -6761,7 +6627,7 @@ Do you want to stop the program?"),
break;
/* bit operations */
- case 0x0fba: /* bt/bts/btr/btc Gv, im */
+ case 0x0fba: /* bt/bts/btr/btc Gv, im */
ir.ot = ir.dflag + OT_WORD;
if (i386_record_modrm (&ir))
return -1;
@@ -6784,13 +6650,13 @@ Do you want to stop the program?"),
I386_RECORD_FULL_ARCH_LIST_ADD_REG (X86_RECORD_EFLAGS_REGNUM);
break;
- case 0x0fa3: /* bt Gv, Ev */
+ case 0x0fa3: /* bt Gv, Ev */
I386_RECORD_FULL_ARCH_LIST_ADD_REG (X86_RECORD_EFLAGS_REGNUM);
break;
- case 0x0fab: /* bts */
- case 0x0fb3: /* btr */
- case 0x0fbb: /* btc */
+ case 0x0fab: /* bts */
+ case 0x0fb3: /* btr */
+ case 0x0fbb: /* btc */
ir.ot = ir.dflag + OT_WORD;
if (i386_record_modrm (&ir))
return -1;
@@ -6801,8 +6667,7 @@ Do you want to stop the program?"),
uint64_t addr64;
if (i386_record_lea_modrm_addr (&ir, &addr64))
return -1;
- regcache_raw_read_unsigned (ir.regcache,
- ir.regmap[ir.reg | rex_r],
+ regcache_raw_read_unsigned (ir.regcache, ir.regmap[ir.reg | rex_r],
&addr);
switch (ir.dflag)
{
@@ -6824,19 +6689,19 @@ Do you want to stop the program?"),
I386_RECORD_FULL_ARCH_LIST_ADD_REG (X86_RECORD_EFLAGS_REGNUM);
break;
- case 0x0fbc: /* bsf */
- case 0x0fbd: /* bsr */
+ case 0x0fbc: /* bsf */
+ case 0x0fbd: /* bsr */
I386_RECORD_FULL_ARCH_LIST_ADD_REG (ir.reg | rex_r);
I386_RECORD_FULL_ARCH_LIST_ADD_REG (X86_RECORD_EFLAGS_REGNUM);
break;
/* bcd */
- case 0x27: /* daa */
- case 0x2f: /* das */
- case 0x37: /* aaa */
- case 0x3f: /* aas */
- case 0xd4: /* aam */
- case 0xd5: /* aad */
+ case 0x27: /* daa */
+ case 0x2f: /* das */
+ case 0x37: /* aaa */
+ case 0x3f: /* aas */
+ case 0xd4: /* aam */
+ case 0xd5: /* aad */
if (ir.regmap[X86_RECORD_R8_REGNUM])
{
ir.addr -= 1;
@@ -6847,7 +6712,7 @@ Do you want to stop the program?"),
break;
/* misc */
- case 0x90: /* nop */
+ case 0x90: /* nop */
if (prefixes & PREFIX_LOCK)
{
ir.addr -= 1;
@@ -6855,7 +6720,7 @@ Do you want to stop the program?"),
}
break;
- case 0x9b: /* fwait */
+ case 0x9b: /* fwait */
if (record_read_memory (gdbarch, ir.addr, &opcode8, 1))
return -1;
opcode = (uint32_t) opcode8;
@@ -6864,28 +6729,26 @@ Do you want to stop the program?"),
break;
/* XXX */
- case 0xcc: /* int3 */
- gdb_printf (gdb_stderr,
- _("Process record does not support instruction "
- "int3.\n"));
+ case 0xcc: /* int3 */
+ gdb_printf (gdb_stderr, _ ("Process record does not support instruction "
+ "int3.\n"));
ir.addr -= 1;
goto no_support;
break;
/* XXX */
- case 0xcd: /* int */
+ case 0xcd: /* int */
{
int ret;
uint8_t interrupt;
if (record_read_memory (gdbarch, ir.addr, &interrupt, 1))
return -1;
ir.addr++;
- if (interrupt != 0x80
- || tdep->i386_intx80_record == NULL)
+ if (interrupt != 0x80 || tdep->i386_intx80_record == NULL)
{
gdb_printf (gdb_stderr,
- _("Process record does not support "
- "instruction int 0x%02x.\n"),
+ _ ("Process record does not support "
+ "instruction int 0x%02x.\n"),
interrupt);
ir.addr -= 2;
goto no_support;
@@ -6897,27 +6760,25 @@ Do you want to stop the program?"),
break;
/* XXX */
- case 0xce: /* into */
- gdb_printf (gdb_stderr,
- _("Process record does not support "
- "instruction into.\n"));
+ case 0xce: /* into */
+ gdb_printf (gdb_stderr, _ ("Process record does not support "
+ "instruction into.\n"));
ir.addr -= 1;
goto no_support;
break;
- case 0xfa: /* cli */
- case 0xfb: /* sti */
+ case 0xfa: /* cli */
+ case 0xfb: /* sti */
break;
- case 0x62: /* bound */
- gdb_printf (gdb_stderr,
- _("Process record does not support "
- "instruction bound.\n"));
+ case 0x62: /* bound */
+ gdb_printf (gdb_stderr, _ ("Process record does not support "
+ "instruction bound.\n"));
ir.addr -= 1;
goto no_support;
break;
- case 0x0fc8: /* bswap reg */
+ case 0x0fc8: /* bswap reg */
case 0x0fc9:
case 0x0fca:
case 0x0fcb:
@@ -6928,7 +6789,7 @@ Do you want to stop the program?"),
I386_RECORD_FULL_ARCH_LIST_ADD_REG ((opcode & 7) | ir.rex_b);
break;
- case 0xd6: /* salc */
+ case 0xd6: /* salc */
if (ir.regmap[X86_RECORD_R8_REGNUM])
{
ir.addr -= 1;
@@ -6938,36 +6799,34 @@ Do you want to stop the program?"),
I386_RECORD_FULL_ARCH_LIST_ADD_REG (X86_RECORD_EFLAGS_REGNUM);
break;
- case 0xe0: /* loopnz */
- case 0xe1: /* loopz */
- case 0xe2: /* loop */
- case 0xe3: /* jecxz */
+ case 0xe0: /* loopnz */
+ case 0xe1: /* loopz */
+ case 0xe2: /* loop */
+ case 0xe3: /* jecxz */
I386_RECORD_FULL_ARCH_LIST_ADD_REG (X86_RECORD_RECX_REGNUM);
I386_RECORD_FULL_ARCH_LIST_ADD_REG (X86_RECORD_EFLAGS_REGNUM);
break;
- case 0x0f30: /* wrmsr */
- gdb_printf (gdb_stderr,
- _("Process record does not support "
- "instruction wrmsr.\n"));
+ case 0x0f30: /* wrmsr */
+ gdb_printf (gdb_stderr, _ ("Process record does not support "
+ "instruction wrmsr.\n"));
ir.addr -= 2;
goto no_support;
break;
- case 0x0f32: /* rdmsr */
- gdb_printf (gdb_stderr,
- _("Process record does not support "
- "instruction rdmsr.\n"));
+ case 0x0f32: /* rdmsr */
+ gdb_printf (gdb_stderr, _ ("Process record does not support "
+ "instruction rdmsr.\n"));
ir.addr -= 2;
goto no_support;
break;
- case 0x0f31: /* rdtsc */
+ case 0x0f31: /* rdtsc */
I386_RECORD_FULL_ARCH_LIST_ADD_REG (X86_RECORD_REAX_REGNUM);
I386_RECORD_FULL_ARCH_LIST_ADD_REG (X86_RECORD_REDX_REGNUM);
break;
- case 0x0f34: /* sysenter */
+ case 0x0f34: /* sysenter */
{
int ret;
if (ir.regmap[X86_RECORD_R8_REGNUM])
@@ -6977,9 +6836,8 @@ Do you want to stop the program?"),
}
if (tdep->i386_sysenter_record == NULL)
{
- gdb_printf (gdb_stderr,
- _("Process record does not support "
- "instruction sysenter.\n"));
+ gdb_printf (gdb_stderr, _ ("Process record does not support "
+ "instruction sysenter.\n"));
ir.addr -= 2;
goto no_support;
}
@@ -6989,22 +6847,20 @@ Do you want to stop the program?"),
}
break;
- case 0x0f35: /* sysexit */
- gdb_printf (gdb_stderr,
- _("Process record does not support "
- "instruction sysexit.\n"));
+ case 0x0f35: /* sysexit */
+ gdb_printf (gdb_stderr, _ ("Process record does not support "
+ "instruction sysexit.\n"));
ir.addr -= 2;
goto no_support;
break;
- case 0x0f05: /* syscall */
+ case 0x0f05: /* syscall */
{
int ret;
if (tdep->i386_syscall_record == NULL)
{
- gdb_printf (gdb_stderr,
- _("Process record does not support "
- "instruction syscall.\n"));
+ gdb_printf (gdb_stderr, _ ("Process record does not support "
+ "instruction syscall.\n"));
ir.addr -= 2;
goto no_support;
}
@@ -7014,25 +6870,23 @@ Do you want to stop the program?"),
}
break;
- case 0x0f07: /* sysret */
- gdb_printf (gdb_stderr,
- _("Process record does not support "
- "instruction sysret.\n"));
+ case 0x0f07: /* sysret */
+ gdb_printf (gdb_stderr, _ ("Process record does not support "
+ "instruction sysret.\n"));
ir.addr -= 2;
goto no_support;
break;
- case 0x0fa2: /* cpuid */
+ case 0x0fa2: /* cpuid */
I386_RECORD_FULL_ARCH_LIST_ADD_REG (X86_RECORD_REAX_REGNUM);
I386_RECORD_FULL_ARCH_LIST_ADD_REG (X86_RECORD_RECX_REGNUM);
I386_RECORD_FULL_ARCH_LIST_ADD_REG (X86_RECORD_REDX_REGNUM);
I386_RECORD_FULL_ARCH_LIST_ADD_REG (X86_RECORD_REBX_REGNUM);
break;
- case 0xf4: /* hlt */
- gdb_printf (gdb_stderr,
- _("Process record does not support "
- "instruction hlt.\n"));
+ case 0xf4: /* hlt */
+ gdb_printf (gdb_stderr, _ ("Process record does not support "
+ "instruction hlt.\n"));
ir.addr -= 1;
goto no_support;
break;
@@ -7042,8 +6896,8 @@ Do you want to stop the program?"),
return -1;
switch (ir.reg)
{
- case 0: /* sldt */
- case 1: /* str */
+ case 0: /* sldt */
+ case 1: /* str */
if (ir.mod == 3)
I386_RECORD_FULL_ARCH_LIST_ADD_REG (ir.rm | ir.rex_b);
else
@@ -7053,11 +6907,11 @@ Do you want to stop the program?"),
return -1;
}
break;
- case 2: /* lldt */
- case 3: /* ltr */
+ case 2: /* lldt */
+ case 3: /* ltr */
break;
- case 4: /* verr */
- case 5: /* verw */
+ case 4: /* verr */
+ case 5: /* verw */
I386_RECORD_FULL_ARCH_LIST_ADD_REG (X86_RECORD_EFLAGS_REGNUM);
break;
default:
@@ -7073,7 +6927,7 @@ Do you want to stop the program?"),
return -1;
switch (ir.reg)
{
- case 0: /* sgdt */
+ case 0: /* sgdt */
{
uint64_t addr64;
@@ -7087,7 +6941,7 @@ Do you want to stop the program?"),
{
if (record_full_memory_query)
{
- if (yquery (_("\
+ if (yquery (_ ("\
Process record ignores the memory change of instruction at address %s\n\
because it can't get the value of the segment register.\n\
Do you want to stop the program?"),
@@ -7120,10 +6974,11 @@ Do you want to stop the program?"),
{
switch (ir.rm)
{
- case 0: /* monitor */
+ case 0: /* monitor */
break;
- case 1: /* mwait */
- I386_RECORD_FULL_ARCH_LIST_ADD_REG (X86_RECORD_EFLAGS_REGNUM);
+ case 1: /* mwait */
+ I386_RECORD_FULL_ARCH_LIST_ADD_REG (
+ X86_RECORD_EFLAGS_REGNUM);
break;
default:
ir.addr -= 3;
@@ -7139,7 +6994,7 @@ Do you want to stop the program?"),
{
if (record_full_memory_query)
{
- if (yquery (_("\
+ if (yquery (_ ("\
Process record ignores the memory change of instruction at address %s\n\
because it can't get the value of the segment register.\n\
Do you want to stop the program?"),
@@ -7169,7 +7024,7 @@ Do you want to stop the program?"),
}
}
break;
- case 2: /* lgdt */
+ case 2: /* lgdt */
if (ir.mod == 3)
{
/* xgetbv */
@@ -7184,7 +7039,7 @@ Do you want to stop the program?"),
break;
}
/* Fall through. */
- case 3: /* lidt */
+ case 3: /* lidt */
if (ir.mod == 3)
{
ir.addr -= 3;
@@ -7192,10 +7047,11 @@ Do you want to stop the program?"),
goto no_support;
}
break;
- case 4: /* smsw */
+ case 4: /* smsw */
if (ir.mod == 3)
{
- if (record_full_arch_list_add_reg (ir.regcache, ir.rm | ir.rex_b))
+ if (record_full_arch_list_add_reg (ir.regcache,
+ ir.rm | ir.rex_b))
return -1;
}
else
@@ -7206,10 +7062,10 @@ Do you want to stop the program?"),
}
I386_RECORD_FULL_ARCH_LIST_ADD_REG (X86_RECORD_EFLAGS_REGNUM);
break;
- case 6: /* lmsw */
+ case 6: /* lmsw */
I386_RECORD_FULL_ARCH_LIST_ADD_REG (X86_RECORD_EFLAGS_REGNUM);
break;
- case 7: /* invlpg */
+ case 7: /* invlpg */
if (ir.mod == 3)
{
if (ir.rm == 0 && ir.regmap[X86_RECORD_R8_REGNUM])
@@ -7232,17 +7088,18 @@ Do you want to stop the program?"),
}
break;
- case 0x0f08: /* invd */
- case 0x0f09: /* wbinvd */
+ case 0x0f08: /* invd */
+ case 0x0f09: /* wbinvd */
break;
- case 0x63: /* arpl */
+ case 0x63: /* arpl */
if (i386_record_modrm (&ir))
return -1;
if (ir.mod == 3 || ir.regmap[X86_RECORD_R8_REGNUM])
{
I386_RECORD_FULL_ARCH_LIST_ADD_REG (ir.regmap[X86_RECORD_R8_REGNUM]
- ? (ir.reg | rex_r) : ir.rm);
+ ? (ir.reg | rex_r)
+ : ir.rm);
}
else
{
@@ -7254,8 +7111,8 @@ Do you want to stop the program?"),
I386_RECORD_FULL_ARCH_LIST_ADD_REG (X86_RECORD_EFLAGS_REGNUM);
break;
- case 0x0f02: /* lar */
- case 0x0f03: /* lsl */
+ case 0x0f02: /* lar */
+ case 0x0f03: /* lsl */
if (i386_record_modrm (&ir))
return -1;
I386_RECORD_FULL_ARCH_LIST_ADD_REG (ir.reg | rex_r);
@@ -7283,8 +7140,8 @@ Do you want to stop the program?"),
/* nop (multi byte) */
break;
- case 0x0f20: /* mov reg, crN */
- case 0x0f22: /* mov crN, reg */
+ case 0x0f20: /* mov reg, crN */
+ case 0x0f22: /* mov crN, reg */
if (i386_record_modrm (&ir))
return -1;
if ((ir.modrm & 0xc0) != 0xc0)
@@ -7313,12 +7170,12 @@ Do you want to stop the program?"),
}
break;
- case 0x0f21: /* mov reg, drN */
- case 0x0f23: /* mov drN, reg */
+ case 0x0f21: /* mov reg, drN */
+ case 0x0f23: /* mov drN, reg */
if (i386_record_modrm (&ir))
return -1;
- if ((ir.modrm & 0xc0) != 0xc0 || ir.reg == 4
- || ir.reg == 5 || ir.reg >= 8)
+ if ((ir.modrm & 0xc0) != 0xc0 || ir.reg == 4 || ir.reg == 5
+ || ir.reg >= 8)
{
ir.addr -= 3;
opcode = opcode << 8 | ir.modrm;
@@ -7330,23 +7187,23 @@ Do you want to stop the program?"),
I386_RECORD_FULL_ARCH_LIST_ADD_REG (ir.rm | ir.rex_b);
break;
- case 0x0f06: /* clts */
+ case 0x0f06: /* clts */
I386_RECORD_FULL_ARCH_LIST_ADD_REG (X86_RECORD_EFLAGS_REGNUM);
break;
- /* MMX 3DNow! SSE SSE2 SSE3 SSSE3 SSE4 */
+ /* MMX 3DNow! SSE SSE2 SSE3 SSSE3 SSE4 */
- case 0x0f0d: /* 3DNow! prefetch */
+ case 0x0f0d: /* 3DNow! prefetch */
break;
- case 0x0f0e: /* 3DNow! femms */
- case 0x0f77: /* emms */
- if (i386_fpc_regnum_p (gdbarch, I387_FTAG_REGNUM(tdep)))
+ case 0x0f0e: /* 3DNow! femms */
+ case 0x0f77: /* emms */
+ if (i386_fpc_regnum_p (gdbarch, I387_FTAG_REGNUM (tdep)))
goto no_support;
- record_full_arch_list_add_reg (ir.regcache, I387_FTAG_REGNUM(tdep));
+ record_full_arch_list_add_reg (ir.regcache, I387_FTAG_REGNUM (tdep));
break;
- case 0x0f0f: /* 3DNow! data */
+ case 0x0f0f: /* 3DNow! data */
if (i386_record_modrm (&ir))
return -1;
if (record_read_memory (gdbarch, ir.addr, &opcode8, 1))
@@ -7354,44 +7211,44 @@ Do you want to stop the program?"),
ir.addr++;
switch (opcode8)
{
- case 0x0c: /* 3DNow! pi2fw */
- case 0x0d: /* 3DNow! pi2fd */
- case 0x1c: /* 3DNow! pf2iw */
- case 0x1d: /* 3DNow! pf2id */
- case 0x8a: /* 3DNow! pfnacc */
- case 0x8e: /* 3DNow! pfpnacc */
- case 0x90: /* 3DNow! pfcmpge */
- case 0x94: /* 3DNow! pfmin */
- case 0x96: /* 3DNow! pfrcp */
- case 0x97: /* 3DNow! pfrsqrt */
- case 0x9a: /* 3DNow! pfsub */
- case 0x9e: /* 3DNow! pfadd */
- case 0xa0: /* 3DNow! pfcmpgt */
- case 0xa4: /* 3DNow! pfmax */
- case 0xa6: /* 3DNow! pfrcpit1 */
- case 0xa7: /* 3DNow! pfrsqit1 */
- case 0xaa: /* 3DNow! pfsubr */
- case 0xae: /* 3DNow! pfacc */
- case 0xb0: /* 3DNow! pfcmpeq */
- case 0xb4: /* 3DNow! pfmul */
- case 0xb6: /* 3DNow! pfrcpit2 */
- case 0xb7: /* 3DNow! pmulhrw */
- case 0xbb: /* 3DNow! pswapd */
- case 0xbf: /* 3DNow! pavgusb */
+ case 0x0c: /* 3DNow! pi2fw */
+ case 0x0d: /* 3DNow! pi2fd */
+ case 0x1c: /* 3DNow! pf2iw */
+ case 0x1d: /* 3DNow! pf2id */
+ case 0x8a: /* 3DNow! pfnacc */
+ case 0x8e: /* 3DNow! pfpnacc */
+ case 0x90: /* 3DNow! pfcmpge */
+ case 0x94: /* 3DNow! pfmin */
+ case 0x96: /* 3DNow! pfrcp */
+ case 0x97: /* 3DNow! pfrsqrt */
+ case 0x9a: /* 3DNow! pfsub */
+ case 0x9e: /* 3DNow! pfadd */
+ case 0xa0: /* 3DNow! pfcmpgt */
+ case 0xa4: /* 3DNow! pfmax */
+ case 0xa6: /* 3DNow! pfrcpit1 */
+ case 0xa7: /* 3DNow! pfrsqit1 */
+ case 0xaa: /* 3DNow! pfsubr */
+ case 0xae: /* 3DNow! pfacc */
+ case 0xb0: /* 3DNow! pfcmpeq */
+ case 0xb4: /* 3DNow! pfmul */
+ case 0xb6: /* 3DNow! pfrcpit2 */
+ case 0xb7: /* 3DNow! pmulhrw */
+ case 0xbb: /* 3DNow! pswapd */
+ case 0xbf: /* 3DNow! pavgusb */
if (!i386_mmx_regnum_p (gdbarch, I387_MM0_REGNUM (tdep) + ir.reg))
goto no_support_3dnow_data;
record_full_arch_list_add_reg (ir.regcache, ir.reg);
break;
default:
-no_support_3dnow_data:
+ no_support_3dnow_data:
opcode = (opcode << 8) | opcode8;
goto no_support;
break;
}
break;
- case 0x0faa: /* rsm */
+ case 0x0faa: /* rsm */
I386_RECORD_FULL_ARCH_LIST_ADD_REG (X86_RECORD_EFLAGS_REGNUM);
I386_RECORD_FULL_ARCH_LIST_ADD_REG (X86_RECORD_REAX_REGNUM);
I386_RECORD_FULL_ARCH_LIST_ADD_REG (X86_RECORD_RECX_REGNUM);
@@ -7406,9 +7263,9 @@ no_support_3dnow_data:
case 0x0fae:
if (i386_record_modrm (&ir))
return -1;
- switch(ir.reg)
+ switch (ir.reg)
{
- case 0: /* fxsave */
+ case 0: /* fxsave */
{
uint64_t tmpu64;
@@ -7420,49 +7277,50 @@ no_support_3dnow_data:
}
break;
- case 1: /* fxrstor */
+ case 1: /* fxrstor */
{
int i;
I386_RECORD_FULL_ARCH_LIST_ADD_REG (X86_RECORD_EFLAGS_REGNUM);
- for (i = I387_MM0_REGNUM (tdep);
- i386_mmx_regnum_p (gdbarch, i); i++)
+ for (i = I387_MM0_REGNUM (tdep); i386_mmx_regnum_p (gdbarch, i);
+ i++)
record_full_arch_list_add_reg (ir.regcache, i);
- for (i = I387_XMM0_REGNUM (tdep);
- i386_xmm_regnum_p (gdbarch, i); i++)
+ for (i = I387_XMM0_REGNUM (tdep); i386_xmm_regnum_p (gdbarch, i);
+ i++)
record_full_arch_list_add_reg (ir.regcache, i);
- if (i386_mxcsr_regnum_p (gdbarch, I387_MXCSR_REGNUM(tdep)))
+ if (i386_mxcsr_regnum_p (gdbarch, I387_MXCSR_REGNUM (tdep)))
record_full_arch_list_add_reg (ir.regcache,
- I387_MXCSR_REGNUM(tdep));
+ I387_MXCSR_REGNUM (tdep));
- for (i = I387_ST0_REGNUM (tdep);
- i386_fp_regnum_p (gdbarch, i); i++)
+ for (i = I387_ST0_REGNUM (tdep); i386_fp_regnum_p (gdbarch, i);
+ i++)
record_full_arch_list_add_reg (ir.regcache, i);
- for (i = I387_FCTRL_REGNUM (tdep);
- i386_fpc_regnum_p (gdbarch, i); i++)
+ for (i = I387_FCTRL_REGNUM (tdep); i386_fpc_regnum_p (gdbarch, i);
+ i++)
record_full_arch_list_add_reg (ir.regcache, i);
}
break;
- case 2: /* ldmxcsr */
- if (!i386_mxcsr_regnum_p (gdbarch, I387_MXCSR_REGNUM(tdep)))
+ case 2: /* ldmxcsr */
+ if (!i386_mxcsr_regnum_p (gdbarch, I387_MXCSR_REGNUM (tdep)))
goto no_support;
- record_full_arch_list_add_reg (ir.regcache, I387_MXCSR_REGNUM(tdep));
+ record_full_arch_list_add_reg (ir.regcache,
+ I387_MXCSR_REGNUM (tdep));
break;
- case 3: /* stmxcsr */
+ case 3: /* stmxcsr */
ir.ot = OT_LONG;
if (i386_record_lea_modrm (&ir))
return -1;
break;
- case 5: /* lfence */
- case 6: /* mfence */
- case 7: /* sfence clflush */
+ case 5: /* lfence */
+ case 6: /* mfence */
+ case 7: /* sfence clflush */
break;
default:
@@ -7472,7 +7330,7 @@ no_support_3dnow_data:
}
break;
- case 0x0fc3: /* movnti */
+ case 0x0fc3: /* movnti */
ir.ot = (ir.dflag == 2) ? OT_QUAD : OT_LONG;
if (i386_record_modrm (&ir))
return -1;
@@ -7611,7 +7469,7 @@ no_support_3dnow_data:
opcode |= 0xf30000;
break;
}
-reswitch_prefix_add:
+ reswitch_prefix_add:
switch (opcode)
{
case 0x0f38:
@@ -7626,205 +7484,205 @@ reswitch_prefix_add:
goto reswitch_prefix_add;
break;
- case 0x0f10: /* movups */
- case 0x660f10: /* movupd */
- case 0xf30f10: /* movss */
- case 0xf20f10: /* movsd */
- case 0x0f12: /* movlps */
- case 0x660f12: /* movlpd */
- case 0xf30f12: /* movsldup */
- case 0xf20f12: /* movddup */
- case 0x0f14: /* unpcklps */
- case 0x660f14: /* unpcklpd */
- case 0x0f15: /* unpckhps */
- case 0x660f15: /* unpckhpd */
- case 0x0f16: /* movhps */
- case 0x660f16: /* movhpd */
- case 0xf30f16: /* movshdup */
- case 0x0f28: /* movaps */
- case 0x660f28: /* movapd */
- case 0x0f2a: /* cvtpi2ps */
- case 0x660f2a: /* cvtpi2pd */
- case 0xf30f2a: /* cvtsi2ss */
- case 0xf20f2a: /* cvtsi2sd */
- case 0x0f2c: /* cvttps2pi */
- case 0x660f2c: /* cvttpd2pi */
- case 0x0f2d: /* cvtps2pi */
- case 0x660f2d: /* cvtpd2pi */
- case 0x660f3800: /* pshufb */
- case 0x660f3801: /* phaddw */
- case 0x660f3802: /* phaddd */
- case 0x660f3803: /* phaddsw */
- case 0x660f3804: /* pmaddubsw */
- case 0x660f3805: /* phsubw */
- case 0x660f3806: /* phsubd */
- case 0x660f3807: /* phsubsw */
- case 0x660f3808: /* psignb */
- case 0x660f3809: /* psignw */
- case 0x660f380a: /* psignd */
- case 0x660f380b: /* pmulhrsw */
- case 0x660f3810: /* pblendvb */
- case 0x660f3814: /* blendvps */
- case 0x660f3815: /* blendvpd */
- case 0x660f381c: /* pabsb */
- case 0x660f381d: /* pabsw */
- case 0x660f381e: /* pabsd */
- case 0x660f3820: /* pmovsxbw */
- case 0x660f3821: /* pmovsxbd */
- case 0x660f3822: /* pmovsxbq */
- case 0x660f3823: /* pmovsxwd */
- case 0x660f3824: /* pmovsxwq */
- case 0x660f3825: /* pmovsxdq */
- case 0x660f3828: /* pmuldq */
- case 0x660f3829: /* pcmpeqq */
- case 0x660f382a: /* movntdqa */
- case 0x660f3a08: /* roundps */
- case 0x660f3a09: /* roundpd */
- case 0x660f3a0a: /* roundss */
- case 0x660f3a0b: /* roundsd */
- case 0x660f3a0c: /* blendps */
- case 0x660f3a0d: /* blendpd */
- case 0x660f3a0e: /* pblendw */
- case 0x660f3a0f: /* palignr */
- case 0x660f3a20: /* pinsrb */
- case 0x660f3a21: /* insertps */
- case 0x660f3a22: /* pinsrd pinsrq */
- case 0x660f3a40: /* dpps */
- case 0x660f3a41: /* dppd */
- case 0x660f3a42: /* mpsadbw */
- case 0x660f3a60: /* pcmpestrm */
- case 0x660f3a61: /* pcmpestri */
- case 0x660f3a62: /* pcmpistrm */
- case 0x660f3a63: /* pcmpistri */
- case 0x0f51: /* sqrtps */
- case 0x660f51: /* sqrtpd */
- case 0xf20f51: /* sqrtsd */
- case 0xf30f51: /* sqrtss */
- case 0x0f52: /* rsqrtps */
- case 0xf30f52: /* rsqrtss */
- case 0x0f53: /* rcpps */
- case 0xf30f53: /* rcpss */
- case 0x0f54: /* andps */
- case 0x660f54: /* andpd */
- case 0x0f55: /* andnps */
- case 0x660f55: /* andnpd */
- case 0x0f56: /* orps */
- case 0x660f56: /* orpd */
- case 0x0f57: /* xorps */
- case 0x660f57: /* xorpd */
- case 0x0f58: /* addps */
- case 0x660f58: /* addpd */
- case 0xf20f58: /* addsd */
- case 0xf30f58: /* addss */
- case 0x0f59: /* mulps */
- case 0x660f59: /* mulpd */
- case 0xf20f59: /* mulsd */
- case 0xf30f59: /* mulss */
- case 0x0f5a: /* cvtps2pd */
- case 0x660f5a: /* cvtpd2ps */
- case 0xf20f5a: /* cvtsd2ss */
- case 0xf30f5a: /* cvtss2sd */
- case 0x0f5b: /* cvtdq2ps */
- case 0x660f5b: /* cvtps2dq */
- case 0xf30f5b: /* cvttps2dq */
- case 0x0f5c: /* subps */
- case 0x660f5c: /* subpd */
- case 0xf20f5c: /* subsd */
- case 0xf30f5c: /* subss */
- case 0x0f5d: /* minps */
- case 0x660f5d: /* minpd */
- case 0xf20f5d: /* minsd */
- case 0xf30f5d: /* minss */
- case 0x0f5e: /* divps */
- case 0x660f5e: /* divpd */
- case 0xf20f5e: /* divsd */
- case 0xf30f5e: /* divss */
- case 0x0f5f: /* maxps */
- case 0x660f5f: /* maxpd */
- case 0xf20f5f: /* maxsd */
- case 0xf30f5f: /* maxss */
- case 0x660f60: /* punpcklbw */
- case 0x660f61: /* punpcklwd */
- case 0x660f62: /* punpckldq */
- case 0x660f63: /* packsswb */
- case 0x660f64: /* pcmpgtb */
- case 0x660f65: /* pcmpgtw */
- case 0x660f66: /* pcmpgtd */
- case 0x660f67: /* packuswb */
- case 0x660f68: /* punpckhbw */
- case 0x660f69: /* punpckhwd */
- case 0x660f6a: /* punpckhdq */
- case 0x660f6b: /* packssdw */
- case 0x660f6c: /* punpcklqdq */
- case 0x660f6d: /* punpckhqdq */
- case 0x660f6e: /* movd */
- case 0x660f6f: /* movdqa */
- case 0xf30f6f: /* movdqu */
- case 0x660f70: /* pshufd */
- case 0xf20f70: /* pshuflw */
- case 0xf30f70: /* pshufhw */
- case 0x660f74: /* pcmpeqb */
- case 0x660f75: /* pcmpeqw */
- case 0x660f76: /* pcmpeqd */
- case 0x660f7c: /* haddpd */
- case 0xf20f7c: /* haddps */
- case 0x660f7d: /* hsubpd */
- case 0xf20f7d: /* hsubps */
- case 0xf30f7e: /* movq */
- case 0x0fc2: /* cmpps */
- case 0x660fc2: /* cmppd */
- case 0xf20fc2: /* cmpsd */
- case 0xf30fc2: /* cmpss */
- case 0x660fc4: /* pinsrw */
- case 0x0fc6: /* shufps */
- case 0x660fc6: /* shufpd */
- case 0x660fd0: /* addsubpd */
- case 0xf20fd0: /* addsubps */
- case 0x660fd1: /* psrlw */
- case 0x660fd2: /* psrld */
- case 0x660fd3: /* psrlq */
- case 0x660fd4: /* paddq */
- case 0x660fd5: /* pmullw */
- case 0xf30fd6: /* movq2dq */
- case 0x660fd8: /* psubusb */
- case 0x660fd9: /* psubusw */
- case 0x660fda: /* pminub */
- case 0x660fdb: /* pand */
- case 0x660fdc: /* paddusb */
- case 0x660fdd: /* paddusw */
- case 0x660fde: /* pmaxub */
- case 0x660fdf: /* pandn */
- case 0x660fe0: /* pavgb */
- case 0x660fe1: /* psraw */
- case 0x660fe2: /* psrad */
- case 0x660fe3: /* pavgw */
- case 0x660fe4: /* pmulhuw */
- case 0x660fe5: /* pmulhw */
- case 0x660fe6: /* cvttpd2dq */
- case 0xf20fe6: /* cvtpd2dq */
- case 0xf30fe6: /* cvtdq2pd */
- case 0x660fe8: /* psubsb */
- case 0x660fe9: /* psubsw */
- case 0x660fea: /* pminsw */
- case 0x660feb: /* por */
- case 0x660fec: /* paddsb */
- case 0x660fed: /* paddsw */
- case 0x660fee: /* pmaxsw */
- case 0x660fef: /* pxor */
- case 0xf20ff0: /* lddqu */
- case 0x660ff1: /* psllw */
- case 0x660ff2: /* pslld */
- case 0x660ff3: /* psllq */
- case 0x660ff4: /* pmuludq */
- case 0x660ff5: /* pmaddwd */
- case 0x660ff6: /* psadbw */
- case 0x660ff8: /* psubb */
- case 0x660ff9: /* psubw */
- case 0x660ffa: /* psubd */
- case 0x660ffb: /* psubq */
- case 0x660ffc: /* paddb */
- case 0x660ffd: /* paddw */
- case 0x660ffe: /* paddd */
+ case 0x0f10: /* movups */
+ case 0x660f10: /* movupd */
+ case 0xf30f10: /* movss */
+ case 0xf20f10: /* movsd */
+ case 0x0f12: /* movlps */
+ case 0x660f12: /* movlpd */
+ case 0xf30f12: /* movsldup */
+ case 0xf20f12: /* movddup */
+ case 0x0f14: /* unpcklps */
+ case 0x660f14: /* unpcklpd */
+ case 0x0f15: /* unpckhps */
+ case 0x660f15: /* unpckhpd */
+ case 0x0f16: /* movhps */
+ case 0x660f16: /* movhpd */
+ case 0xf30f16: /* movshdup */
+ case 0x0f28: /* movaps */
+ case 0x660f28: /* movapd */
+ case 0x0f2a: /* cvtpi2ps */
+ case 0x660f2a: /* cvtpi2pd */
+ case 0xf30f2a: /* cvtsi2ss */
+ case 0xf20f2a: /* cvtsi2sd */
+ case 0x0f2c: /* cvttps2pi */
+ case 0x660f2c: /* cvttpd2pi */
+ case 0x0f2d: /* cvtps2pi */
+ case 0x660f2d: /* cvtpd2pi */
+ case 0x660f3800: /* pshufb */
+ case 0x660f3801: /* phaddw */
+ case 0x660f3802: /* phaddd */
+ case 0x660f3803: /* phaddsw */
+ case 0x660f3804: /* pmaddubsw */
+ case 0x660f3805: /* phsubw */
+ case 0x660f3806: /* phsubd */
+ case 0x660f3807: /* phsubsw */
+ case 0x660f3808: /* psignb */
+ case 0x660f3809: /* psignw */
+ case 0x660f380a: /* psignd */
+ case 0x660f380b: /* pmulhrsw */
+ case 0x660f3810: /* pblendvb */
+ case 0x660f3814: /* blendvps */
+ case 0x660f3815: /* blendvpd */
+ case 0x660f381c: /* pabsb */
+ case 0x660f381d: /* pabsw */
+ case 0x660f381e: /* pabsd */
+ case 0x660f3820: /* pmovsxbw */
+ case 0x660f3821: /* pmovsxbd */
+ case 0x660f3822: /* pmovsxbq */
+ case 0x660f3823: /* pmovsxwd */
+ case 0x660f3824: /* pmovsxwq */
+ case 0x660f3825: /* pmovsxdq */
+ case 0x660f3828: /* pmuldq */
+ case 0x660f3829: /* pcmpeqq */
+ case 0x660f382a: /* movntdqa */
+ case 0x660f3a08: /* roundps */
+ case 0x660f3a09: /* roundpd */
+ case 0x660f3a0a: /* roundss */
+ case 0x660f3a0b: /* roundsd */
+ case 0x660f3a0c: /* blendps */
+ case 0x660f3a0d: /* blendpd */
+ case 0x660f3a0e: /* pblendw */
+ case 0x660f3a0f: /* palignr */
+ case 0x660f3a20: /* pinsrb */
+ case 0x660f3a21: /* insertps */
+ case 0x660f3a22: /* pinsrd pinsrq */
+ case 0x660f3a40: /* dpps */
+ case 0x660f3a41: /* dppd */
+ case 0x660f3a42: /* mpsadbw */
+ case 0x660f3a60: /* pcmpestrm */
+ case 0x660f3a61: /* pcmpestri */
+ case 0x660f3a62: /* pcmpistrm */
+ case 0x660f3a63: /* pcmpistri */
+ case 0x0f51: /* sqrtps */
+ case 0x660f51: /* sqrtpd */
+ case 0xf20f51: /* sqrtsd */
+ case 0xf30f51: /* sqrtss */
+ case 0x0f52: /* rsqrtps */
+ case 0xf30f52: /* rsqrtss */
+ case 0x0f53: /* rcpps */
+ case 0xf30f53: /* rcpss */
+ case 0x0f54: /* andps */
+ case 0x660f54: /* andpd */
+ case 0x0f55: /* andnps */
+ case 0x660f55: /* andnpd */
+ case 0x0f56: /* orps */
+ case 0x660f56: /* orpd */
+ case 0x0f57: /* xorps */
+ case 0x660f57: /* xorpd */
+ case 0x0f58: /* addps */
+ case 0x660f58: /* addpd */
+ case 0xf20f58: /* addsd */
+ case 0xf30f58: /* addss */
+ case 0x0f59: /* mulps */
+ case 0x660f59: /* mulpd */
+ case 0xf20f59: /* mulsd */
+ case 0xf30f59: /* mulss */
+ case 0x0f5a: /* cvtps2pd */
+ case 0x660f5a: /* cvtpd2ps */
+ case 0xf20f5a: /* cvtsd2ss */
+ case 0xf30f5a: /* cvtss2sd */
+ case 0x0f5b: /* cvtdq2ps */
+ case 0x660f5b: /* cvtps2dq */
+ case 0xf30f5b: /* cvttps2dq */
+ case 0x0f5c: /* subps */
+ case 0x660f5c: /* subpd */
+ case 0xf20f5c: /* subsd */
+ case 0xf30f5c: /* subss */
+ case 0x0f5d: /* minps */
+ case 0x660f5d: /* minpd */
+ case 0xf20f5d: /* minsd */
+ case 0xf30f5d: /* minss */
+ case 0x0f5e: /* divps */
+ case 0x660f5e: /* divpd */
+ case 0xf20f5e: /* divsd */
+ case 0xf30f5e: /* divss */
+ case 0x0f5f: /* maxps */
+ case 0x660f5f: /* maxpd */
+ case 0xf20f5f: /* maxsd */
+ case 0xf30f5f: /* maxss */
+ case 0x660f60: /* punpcklbw */
+ case 0x660f61: /* punpcklwd */
+ case 0x660f62: /* punpckldq */
+ case 0x660f63: /* packsswb */
+ case 0x660f64: /* pcmpgtb */
+ case 0x660f65: /* pcmpgtw */
+ case 0x660f66: /* pcmpgtd */
+ case 0x660f67: /* packuswb */
+ case 0x660f68: /* punpckhbw */
+ case 0x660f69: /* punpckhwd */
+ case 0x660f6a: /* punpckhdq */
+ case 0x660f6b: /* packssdw */
+ case 0x660f6c: /* punpcklqdq */
+ case 0x660f6d: /* punpckhqdq */
+ case 0x660f6e: /* movd */
+ case 0x660f6f: /* movdqa */
+ case 0xf30f6f: /* movdqu */
+ case 0x660f70: /* pshufd */
+ case 0xf20f70: /* pshuflw */
+ case 0xf30f70: /* pshufhw */
+ case 0x660f74: /* pcmpeqb */
+ case 0x660f75: /* pcmpeqw */
+ case 0x660f76: /* pcmpeqd */
+ case 0x660f7c: /* haddpd */
+ case 0xf20f7c: /* haddps */
+ case 0x660f7d: /* hsubpd */
+ case 0xf20f7d: /* hsubps */
+ case 0xf30f7e: /* movq */
+ case 0x0fc2: /* cmpps */
+ case 0x660fc2: /* cmppd */
+ case 0xf20fc2: /* cmpsd */
+ case 0xf30fc2: /* cmpss */
+ case 0x660fc4: /* pinsrw */
+ case 0x0fc6: /* shufps */
+ case 0x660fc6: /* shufpd */
+ case 0x660fd0: /* addsubpd */
+ case 0xf20fd0: /* addsubps */
+ case 0x660fd1: /* psrlw */
+ case 0x660fd2: /* psrld */
+ case 0x660fd3: /* psrlq */
+ case 0x660fd4: /* paddq */
+ case 0x660fd5: /* pmullw */
+ case 0xf30fd6: /* movq2dq */
+ case 0x660fd8: /* psubusb */
+ case 0x660fd9: /* psubusw */
+ case 0x660fda: /* pminub */
+ case 0x660fdb: /* pand */
+ case 0x660fdc: /* paddusb */
+ case 0x660fdd: /* paddusw */
+ case 0x660fde: /* pmaxub */
+ case 0x660fdf: /* pandn */
+ case 0x660fe0: /* pavgb */
+ case 0x660fe1: /* psraw */
+ case 0x660fe2: /* psrad */
+ case 0x660fe3: /* pavgw */
+ case 0x660fe4: /* pmulhuw */
+ case 0x660fe5: /* pmulhw */
+ case 0x660fe6: /* cvttpd2dq */
+ case 0xf20fe6: /* cvtpd2dq */
+ case 0xf30fe6: /* cvtdq2pd */
+ case 0x660fe8: /* psubsb */
+ case 0x660fe9: /* psubsw */
+ case 0x660fea: /* pminsw */
+ case 0x660feb: /* por */
+ case 0x660fec: /* paddsb */
+ case 0x660fed: /* paddsw */
+ case 0x660fee: /* pmaxsw */
+ case 0x660fef: /* pxor */
+ case 0xf20ff0: /* lddqu */
+ case 0x660ff1: /* psllw */
+ case 0x660ff2: /* pslld */
+ case 0x660ff3: /* psllq */
+ case 0x660ff4: /* pmuludq */
+ case 0x660ff5: /* pmaddwd */
+ case 0x660ff6: /* psadbw */
+ case 0x660ff8: /* psubb */
+ case 0x660ff9: /* psubw */
+ case 0x660ffa: /* psubd */
+ case 0x660ffb: /* psubq */
+ case 0x660ffc: /* paddb */
+ case 0x660ffd: /* paddw */
+ case 0x660ffe: /* paddd */
if (i386_record_modrm (&ir))
return -1;
ir.reg |= rex_r;
@@ -7836,28 +7694,28 @@ reswitch_prefix_add:
I386_RECORD_FULL_ARCH_LIST_ADD_REG (X86_RECORD_EFLAGS_REGNUM);
break;
- case 0x0f11: /* movups */
- case 0x660f11: /* movupd */
- case 0xf30f11: /* movss */
- case 0xf20f11: /* movsd */
- case 0x0f13: /* movlps */
- case 0x660f13: /* movlpd */
- case 0x0f17: /* movhps */
- case 0x660f17: /* movhpd */
- case 0x0f29: /* movaps */
- case 0x660f29: /* movapd */
- case 0x660f3a14: /* pextrb */
- case 0x660f3a15: /* pextrw */
- case 0x660f3a16: /* pextrd pextrq */
- case 0x660f3a17: /* extractps */
- case 0x660f7f: /* movdqa */
- case 0xf30f7f: /* movdqu */
+ case 0x0f11: /* movups */
+ case 0x660f11: /* movupd */
+ case 0xf30f11: /* movss */
+ case 0xf20f11: /* movsd */
+ case 0x0f13: /* movlps */
+ case 0x660f13: /* movlpd */
+ case 0x0f17: /* movhps */
+ case 0x660f17: /* movhpd */
+ case 0x0f29: /* movaps */
+ case 0x660f29: /* movapd */
+ case 0x660f3a14: /* pextrb */
+ case 0x660f3a15: /* pextrw */
+ case 0x660f3a16: /* pextrd pextrq */
+ case 0x660f3a17: /* extractps */
+ case 0x660f7f: /* movdqa */
+ case 0xf30f7f: /* movdqu */
if (i386_record_modrm (&ir))
return -1;
if (ir.mod == 3)
{
- if (opcode == 0x0f13 || opcode == 0x660f13
- || opcode == 0x0f17 || opcode == 0x660f17)
+ if (opcode == 0x0f13 || opcode == 0x660f13 || opcode == 0x0f17
+ || opcode == 0x660f17)
goto no_support;
ir.rm |= ir.rex_b;
if (!i386_xmm_regnum_p (gdbarch,
@@ -7870,31 +7728,31 @@ reswitch_prefix_add:
{
switch (opcode)
{
- case 0x660f3a14:
- ir.ot = OT_BYTE;
- break;
- case 0x660f3a15:
- ir.ot = OT_WORD;
- break;
- case 0x660f3a16:
- ir.ot = OT_LONG;
- break;
- case 0x660f3a17:
- ir.ot = OT_QUAD;
- break;
- default:
- ir.ot = OT_DQUAD;
- break;
+ case 0x660f3a14:
+ ir.ot = OT_BYTE;
+ break;
+ case 0x660f3a15:
+ ir.ot = OT_WORD;
+ break;
+ case 0x660f3a16:
+ ir.ot = OT_LONG;
+ break;
+ case 0x660f3a17:
+ ir.ot = OT_QUAD;
+ break;
+ default:
+ ir.ot = OT_DQUAD;
+ break;
}
if (i386_record_lea_modrm (&ir))
return -1;
}
break;
- case 0x0f2b: /* movntps */
- case 0x660f2b: /* movntpd */
- case 0x0fe7: /* movntq */
- case 0x660fe7: /* movntdq */
+ case 0x0f2b: /* movntps */
+ case 0x660f2b: /* movntpd */
+ case 0x0fe7: /* movntq */
+ case 0x660fe7: /* movntdq */
if (ir.mod == 3)
goto no_support;
if (opcode == 0x0fe7)
@@ -7905,115 +7763,115 @@ reswitch_prefix_add:
return -1;
break;
- case 0xf30f2c: /* cvttss2si */
- case 0xf20f2c: /* cvttsd2si */
- case 0xf30f2d: /* cvtss2si */
- case 0xf20f2d: /* cvtsd2si */
- case 0xf20f38f0: /* crc32 */
- case 0xf20f38f1: /* crc32 */
- case 0x0f50: /* movmskps */
- case 0x660f50: /* movmskpd */
- case 0x0fc5: /* pextrw */
- case 0x660fc5: /* pextrw */
- case 0x0fd7: /* pmovmskb */
- case 0x660fd7: /* pmovmskb */
+ case 0xf30f2c: /* cvttss2si */
+ case 0xf20f2c: /* cvttsd2si */
+ case 0xf30f2d: /* cvtss2si */
+ case 0xf20f2d: /* cvtsd2si */
+ case 0xf20f38f0: /* crc32 */
+ case 0xf20f38f1: /* crc32 */
+ case 0x0f50: /* movmskps */
+ case 0x660f50: /* movmskpd */
+ case 0x0fc5: /* pextrw */
+ case 0x660fc5: /* pextrw */
+ case 0x0fd7: /* pmovmskb */
+ case 0x660fd7: /* pmovmskb */
I386_RECORD_FULL_ARCH_LIST_ADD_REG (ir.reg | rex_r);
break;
- case 0x0f3800: /* pshufb */
- case 0x0f3801: /* phaddw */
- case 0x0f3802: /* phaddd */
- case 0x0f3803: /* phaddsw */
- case 0x0f3804: /* pmaddubsw */
- case 0x0f3805: /* phsubw */
- case 0x0f3806: /* phsubd */
- case 0x0f3807: /* phsubsw */
- case 0x0f3808: /* psignb */
- case 0x0f3809: /* psignw */
- case 0x0f380a: /* psignd */
- case 0x0f380b: /* pmulhrsw */
- case 0x0f381c: /* pabsb */
- case 0x0f381d: /* pabsw */
- case 0x0f381e: /* pabsd */
- case 0x0f382b: /* packusdw */
- case 0x0f3830: /* pmovzxbw */
- case 0x0f3831: /* pmovzxbd */
- case 0x0f3832: /* pmovzxbq */
- case 0x0f3833: /* pmovzxwd */
- case 0x0f3834: /* pmovzxwq */
- case 0x0f3835: /* pmovzxdq */
- case 0x0f3837: /* pcmpgtq */
- case 0x0f3838: /* pminsb */
- case 0x0f3839: /* pminsd */
- case 0x0f383a: /* pminuw */
- case 0x0f383b: /* pminud */
- case 0x0f383c: /* pmaxsb */
- case 0x0f383d: /* pmaxsd */
- case 0x0f383e: /* pmaxuw */
- case 0x0f383f: /* pmaxud */
- case 0x0f3840: /* pmulld */
- case 0x0f3841: /* phminposuw */
- case 0x0f3a0f: /* palignr */
- case 0x0f60: /* punpcklbw */
- case 0x0f61: /* punpcklwd */
- case 0x0f62: /* punpckldq */
- case 0x0f63: /* packsswb */
- case 0x0f64: /* pcmpgtb */
- case 0x0f65: /* pcmpgtw */
- case 0x0f66: /* pcmpgtd */
- case 0x0f67: /* packuswb */
- case 0x0f68: /* punpckhbw */
- case 0x0f69: /* punpckhwd */
- case 0x0f6a: /* punpckhdq */
- case 0x0f6b: /* packssdw */
- case 0x0f6e: /* movd */
- case 0x0f6f: /* movq */
- case 0x0f70: /* pshufw */
- case 0x0f74: /* pcmpeqb */
- case 0x0f75: /* pcmpeqw */
- case 0x0f76: /* pcmpeqd */
- case 0x0fc4: /* pinsrw */
- case 0x0fd1: /* psrlw */
- case 0x0fd2: /* psrld */
- case 0x0fd3: /* psrlq */
- case 0x0fd4: /* paddq */
- case 0x0fd5: /* pmullw */
- case 0xf20fd6: /* movdq2q */
- case 0x0fd8: /* psubusb */
- case 0x0fd9: /* psubusw */
- case 0x0fda: /* pminub */
- case 0x0fdb: /* pand */
- case 0x0fdc: /* paddusb */
- case 0x0fdd: /* paddusw */
- case 0x0fde: /* pmaxub */
- case 0x0fdf: /* pandn */
- case 0x0fe0: /* pavgb */
- case 0x0fe1: /* psraw */
- case 0x0fe2: /* psrad */
- case 0x0fe3: /* pavgw */
- case 0x0fe4: /* pmulhuw */
- case 0x0fe5: /* pmulhw */
- case 0x0fe8: /* psubsb */
- case 0x0fe9: /* psubsw */
- case 0x0fea: /* pminsw */
- case 0x0feb: /* por */
- case 0x0fec: /* paddsb */
- case 0x0fed: /* paddsw */
- case 0x0fee: /* pmaxsw */
- case 0x0fef: /* pxor */
- case 0x0ff1: /* psllw */
- case 0x0ff2: /* pslld */
- case 0x0ff3: /* psllq */
- case 0x0ff4: /* pmuludq */
- case 0x0ff5: /* pmaddwd */
- case 0x0ff6: /* psadbw */
- case 0x0ff8: /* psubb */
- case 0x0ff9: /* psubw */
- case 0x0ffa: /* psubd */
- case 0x0ffb: /* psubq */
- case 0x0ffc: /* paddb */
- case 0x0ffd: /* paddw */
- case 0x0ffe: /* paddd */
+ case 0x0f3800: /* pshufb */
+ case 0x0f3801: /* phaddw */
+ case 0x0f3802: /* phaddd */
+ case 0x0f3803: /* phaddsw */
+ case 0x0f3804: /* pmaddubsw */
+ case 0x0f3805: /* phsubw */
+ case 0x0f3806: /* phsubd */
+ case 0x0f3807: /* phsubsw */
+ case 0x0f3808: /* psignb */
+ case 0x0f3809: /* psignw */
+ case 0x0f380a: /* psignd */
+ case 0x0f380b: /* pmulhrsw */
+ case 0x0f381c: /* pabsb */
+ case 0x0f381d: /* pabsw */
+ case 0x0f381e: /* pabsd */
+ case 0x0f382b: /* packusdw */
+ case 0x0f3830: /* pmovzxbw */
+ case 0x0f3831: /* pmovzxbd */
+ case 0x0f3832: /* pmovzxbq */
+ case 0x0f3833: /* pmovzxwd */
+ case 0x0f3834: /* pmovzxwq */
+ case 0x0f3835: /* pmovzxdq */
+ case 0x0f3837: /* pcmpgtq */
+ case 0x0f3838: /* pminsb */
+ case 0x0f3839: /* pminsd */
+ case 0x0f383a: /* pminuw */
+ case 0x0f383b: /* pminud */
+ case 0x0f383c: /* pmaxsb */
+ case 0x0f383d: /* pmaxsd */
+ case 0x0f383e: /* pmaxuw */
+ case 0x0f383f: /* pmaxud */
+ case 0x0f3840: /* pmulld */
+ case 0x0f3841: /* phminposuw */
+ case 0x0f3a0f: /* palignr */
+ case 0x0f60: /* punpcklbw */
+ case 0x0f61: /* punpcklwd */
+ case 0x0f62: /* punpckldq */
+ case 0x0f63: /* packsswb */
+ case 0x0f64: /* pcmpgtb */
+ case 0x0f65: /* pcmpgtw */
+ case 0x0f66: /* pcmpgtd */
+ case 0x0f67: /* packuswb */
+ case 0x0f68: /* punpckhbw */
+ case 0x0f69: /* punpckhwd */
+ case 0x0f6a: /* punpckhdq */
+ case 0x0f6b: /* packssdw */
+ case 0x0f6e: /* movd */
+ case 0x0f6f: /* movq */
+ case 0x0f70: /* pshufw */
+ case 0x0f74: /* pcmpeqb */
+ case 0x0f75: /* pcmpeqw */
+ case 0x0f76: /* pcmpeqd */
+ case 0x0fc4: /* pinsrw */
+ case 0x0fd1: /* psrlw */
+ case 0x0fd2: /* psrld */
+ case 0x0fd3: /* psrlq */
+ case 0x0fd4: /* paddq */
+ case 0x0fd5: /* pmullw */
+ case 0xf20fd6: /* movdq2q */
+ case 0x0fd8: /* psubusb */
+ case 0x0fd9: /* psubusw */
+ case 0x0fda: /* pminub */
+ case 0x0fdb: /* pand */
+ case 0x0fdc: /* paddusb */
+ case 0x0fdd: /* paddusw */
+ case 0x0fde: /* pmaxub */
+ case 0x0fdf: /* pandn */
+ case 0x0fe0: /* pavgb */
+ case 0x0fe1: /* psraw */
+ case 0x0fe2: /* psrad */
+ case 0x0fe3: /* pavgw */
+ case 0x0fe4: /* pmulhuw */
+ case 0x0fe5: /* pmulhw */
+ case 0x0fe8: /* psubsb */
+ case 0x0fe9: /* psubsw */
+ case 0x0fea: /* pminsw */
+ case 0x0feb: /* por */
+ case 0x0fec: /* paddsb */
+ case 0x0fed: /* paddsw */
+ case 0x0fee: /* pmaxsw */
+ case 0x0fef: /* pxor */
+ case 0x0ff1: /* psllw */
+ case 0x0ff2: /* pslld */
+ case 0x0ff3: /* psllq */
+ case 0x0ff4: /* pmuludq */
+ case 0x0ff5: /* pmaddwd */
+ case 0x0ff6: /* psadbw */
+ case 0x0ff8: /* psubb */
+ case 0x0ff9: /* psubw */
+ case 0x0ffa: /* psubd */
+ case 0x0ffb: /* psubq */
+ case 0x0ffc: /* paddb */
+ case 0x0ffd: /* paddw */
+ case 0x0ffe: /* paddd */
if (i386_record_modrm (&ir))
return -1;
if (!i386_mmx_regnum_p (gdbarch, I387_MM0_REGNUM (tdep) + ir.reg))
@@ -8022,9 +7880,9 @@ reswitch_prefix_add:
I387_MM0_REGNUM (tdep) + ir.reg);
break;
- case 0x0f71: /* psllw */
- case 0x0f72: /* pslld */
- case 0x0f73: /* psllq */
+ case 0x0f71: /* psllw */
+ case 0x0f72: /* pslld */
+ case 0x0f73: /* psllq */
if (i386_record_modrm (&ir))
return -1;
if (!i386_mmx_regnum_p (gdbarch, I387_MM0_REGNUM (tdep) + ir.rm))
@@ -8033,9 +7891,9 @@ reswitch_prefix_add:
I387_MM0_REGNUM (tdep) + ir.rm);
break;
- case 0x660f71: /* psllw */
- case 0x660f72: /* pslld */
- case 0x660f73: /* psllq */
+ case 0x660f71: /* psllw */
+ case 0x660f72: /* pslld */
+ case 0x660f73: /* psllq */
if (i386_record_modrm (&ir))
return -1;
ir.rm |= ir.rex_b;
@@ -8045,8 +7903,8 @@ reswitch_prefix_add:
I387_XMM0_REGNUM (tdep) + ir.rm);
break;
- case 0x0f7e: /* movd */
- case 0x660f7e: /* movd */
+ case 0x0f7e: /* movd */
+ case 0x660f7e: /* movd */
if (i386_record_modrm (&ir))
return -1;
if (ir.mod == 3)
@@ -8062,7 +7920,7 @@ reswitch_prefix_add:
}
break;
- case 0x0f7f: /* movq */
+ case 0x0f7f: /* movq */
if (i386_record_modrm (&ir))
return -1;
if (ir.mod == 3)
@@ -8080,14 +7938,14 @@ reswitch_prefix_add:
}
break;
- case 0xf30fb8: /* popcnt */
+ case 0xf30fb8: /* popcnt */
if (i386_record_modrm (&ir))
return -1;
I386_RECORD_FULL_ARCH_LIST_ADD_REG (ir.reg);
I386_RECORD_FULL_ARCH_LIST_ADD_REG (X86_RECORD_EFLAGS_REGNUM);
break;
- case 0x660fd6: /* movq */
+ case 0x660fd6: /* movq */
if (i386_record_modrm (&ir))
return -1;
if (ir.mod == 3)
@@ -8107,15 +7965,15 @@ reswitch_prefix_add:
}
break;
- case 0x660f3817: /* ptest */
- case 0x0f2e: /* ucomiss */
- case 0x660f2e: /* ucomisd */
- case 0x0f2f: /* comiss */
- case 0x660f2f: /* comisd */
+ case 0x660f3817: /* ptest */
+ case 0x0f2e: /* ucomiss */
+ case 0x660f2e: /* ucomisd */
+ case 0x0f2f: /* comiss */
+ case 0x660f2f: /* comisd */
I386_RECORD_FULL_ARCH_LIST_ADD_REG (X86_RECORD_EFLAGS_REGNUM);
break;
- case 0x0ff7: /* maskmovq */
+ case 0x0ff7: /* maskmovq */
regcache_raw_read_unsigned (ir.regcache,
ir.regmap[X86_RECORD_REDI_REGNUM],
&addr);
@@ -8123,7 +7981,7 @@ reswitch_prefix_add:
return -1;
break;
- case 0x660ff7: /* maskmovdqu */
+ case 0x660ff7: /* maskmovdqu */
regcache_raw_read_unsigned (ir.regcache,
ir.regmap[X86_RECORD_REDI_REGNUM],
&addr);
@@ -8149,23 +8007,38 @@ reswitch_prefix_add:
return 0;
- no_support:
+no_support:
gdb_printf (gdb_stderr,
- _("Process record does not support instruction 0x%02x "
- "at address %s.\n"),
- (unsigned int) (opcode),
- paddress (gdbarch, ir.orig_addr));
+ _ ("Process record does not support instruction 0x%02x "
+ "at address %s.\n"),
+ (unsigned int) (opcode), paddress (gdbarch, ir.orig_addr));
return -1;
}
-static const int i386_record_regmap[] =
-{
- I386_EAX_REGNUM, I386_ECX_REGNUM, I386_EDX_REGNUM, I386_EBX_REGNUM,
- I386_ESP_REGNUM, I386_EBP_REGNUM, I386_ESI_REGNUM, I386_EDI_REGNUM,
- 0, 0, 0, 0, 0, 0, 0, 0,
- I386_EIP_REGNUM, I386_EFLAGS_REGNUM, I386_CS_REGNUM, I386_SS_REGNUM,
- I386_DS_REGNUM, I386_ES_REGNUM, I386_FS_REGNUM, I386_GS_REGNUM
-};
+static const int i386_record_regmap[] = { I386_EAX_REGNUM,
+ I386_ECX_REGNUM,
+ I386_EDX_REGNUM,
+ I386_EBX_REGNUM,
+ I386_ESP_REGNUM,
+ I386_EBP_REGNUM,
+ I386_ESI_REGNUM,
+ I386_EDI_REGNUM,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ I386_EIP_REGNUM,
+ I386_EFLAGS_REGNUM,
+ I386_CS_REGNUM,
+ I386_SS_REGNUM,
+ I386_DS_REGNUM,
+ I386_ES_REGNUM,
+ I386_FS_REGNUM,
+ I386_GS_REGNUM };
/* Check that the given address appears suitable for a fast
tracepoint, which on x86-64 means that we need an instruction of at
@@ -8212,8 +8085,8 @@ i386_fast_tracepoint_valid_at (struct gdbarch *gdbarch, CORE_ADDR addr,
/* Return a bit of target-specific detail to add to the caller's
generic failure message. */
if (msg)
- *msg = string_printf (_("; instruction is only %d bytes long, "
- "need at least %d bytes for the jump"),
+ *msg = string_printf (_ ("; instruction is only %d bytes long, "
+ "need at least %d bytes for the jump"),
len, jumplen);
return 0;
}
@@ -8230,19 +8103,15 @@ i386_fast_tracepoint_valid_at (struct gdbarch *gdbarch, CORE_ADDR addr,
If no suitable type is found, return NULL. */
static const struct floatformat **
-i386_floatformat_for_type (struct gdbarch *gdbarch,
- const char *name, int len)
+i386_floatformat_for_type (struct gdbarch *gdbarch, const char *name, int len)
{
if (len == 128 && name)
- if (strcmp (name, "__float128") == 0
- || strcmp (name, "_Float128") == 0
+ if (strcmp (name, "__float128") == 0 || strcmp (name, "_Float128") == 0
|| strcmp (name, "complex _Float128") == 0
|| strcmp (name, "complex(kind=16)") == 0
- || strcmp (name, "complex*32") == 0
- || strcmp (name, "COMPLEX*32") == 0
+ || strcmp (name, "complex*32") == 0 || strcmp (name, "COMPLEX*32") == 0
|| strcmp (name, "quad complex") == 0
- || strcmp (name, "real(kind=16)") == 0
- || strcmp (name, "real*16") == 0
+ || strcmp (name, "real(kind=16)") == 0 || strcmp (name, "real*16") == 0
|| strcmp (name, "REAL*16") == 0)
return floatformats_ieee_quad;
@@ -8257,10 +8126,10 @@ i386_validate_tdesc_p (i386_gdbarch_tdep *tdep,
const struct tdesc_feature *feature_core;
const struct tdesc_feature *feature_sse, *feature_avx, *feature_mpx,
- *feature_avx512, *feature_pkeys, *feature_segments;
+ *feature_avx512, *feature_pkeys, *feature_segments;
int i, num_regs, valid_p;
- if (! tdesc_has_registers (tdesc))
+ if (!tdesc_has_registers (tdesc))
return 0;
/* Get core registers. */
@@ -8305,9 +8174,9 @@ i386_validate_tdesc_p (i386_gdbarch_tdep *tdep,
}
for (i = 0; i < I387_NUM_K_REGS; i++)
- valid_p &= tdesc_numbered_register (feature_avx512, tdesc_data,
- tdep->k0_regnum + i,
- i386_k_names[i]);
+ valid_p
+ &= tdesc_numbered_register (feature_avx512, tdesc_data,
+ tdep->k0_regnum + i, i386_k_names[i]);
if (tdep->num_zmm_regs == 0)
{
@@ -8322,9 +8191,10 @@ i386_validate_tdesc_p (i386_gdbarch_tdep *tdep,
tdep->zmmh_register_names[i]);
for (i = 0; i < tdep->num_xmm_avx512_regs; i++)
- valid_p &= tdesc_numbered_register (feature_avx512, tdesc_data,
- tdep->xmm16_regnum + i,
- tdep->xmm_avx512_register_names[i]);
+ valid_p
+ &= tdesc_numbered_register (feature_avx512, tdesc_data,
+ tdep->xmm16_regnum + i,
+ tdep->xmm_avx512_register_names[i]);
for (i = 0; i < tdep->num_ymm_avx512_regs; i++)
valid_p &= tdesc_numbered_register (feature_avx512, tdesc_data,
@@ -8388,8 +8258,8 @@ i386_validate_tdesc_p (i386_gdbarch_tdep *tdep,
for (i = 0; i < I387_NUM_MPX_REGS; i++)
valid_p &= tdesc_numbered_register (feature_mpx, tdesc_data,
- I387_BND0R_REGNUM (tdep) + i,
- tdep->mpx_register_names[i]);
+ I387_BND0R_REGNUM (tdep) + i,
+ tdep->mpx_register_names[i]);
}
if (feature_segments)
@@ -8421,8 +8291,6 @@ i386_validate_tdesc_p (i386_gdbarch_tdep *tdep,
return valid_p;
}
-
-
/* Implement the type_align gdbarch function. */
static ULONGEST
@@ -8432,8 +8300,7 @@ i386_type_align (struct gdbarch *gdbarch, struct type *type)
if (gdbarch_ptr_bit (gdbarch) == 32)
{
- if ((type->code () == TYPE_CODE_INT
- || type->code () == TYPE_CODE_FLT)
+ if ((type->code () == TYPE_CODE_INT || type->code () == TYPE_CODE_FLT)
&& type->length () > 4)
return 4;
@@ -8446,7 +8313,6 @@ i386_type_align (struct gdbarch *gdbarch, struct type *type)
return 0;
}
-
/* Note: This is called for both i386 and amd64. */
static struct gdbarch *
@@ -8522,10 +8388,10 @@ i386_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
set_gdbarch_floatformat_for_type (gdbarch, i386_floatformat_for_type);
/* Register numbers of various important registers. */
- set_gdbarch_sp_regnum (gdbarch, I386_ESP_REGNUM); /* %esp */
- set_gdbarch_pc_regnum (gdbarch, I386_EIP_REGNUM); /* %eip */
+ set_gdbarch_sp_regnum (gdbarch, I386_ESP_REGNUM); /* %esp */
+ set_gdbarch_pc_regnum (gdbarch, I386_EIP_REGNUM); /* %eip */
set_gdbarch_ps_regnum (gdbarch, I386_EFLAGS_REGNUM); /* %eflags */
- set_gdbarch_fp0_regnum (gdbarch, I386_ST0_REGNUM); /* %st(0) */
+ set_gdbarch_fp0_regnum (gdbarch, I386_ST0_REGNUM); /* %st(0) */
/* NOTE: kettenis/20040418: GCC does have two possible register
numbering schemes on the i386: dbx and SVR4. These schemes
@@ -8578,7 +8444,7 @@ i386_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
set_gdbarch_frame_align (gdbarch, i386_frame_align);
set_gdbarch_convert_register_p (gdbarch, i386_convert_register_p);
- set_gdbarch_register_to_value (gdbarch, i386_register_to_value);
+ set_gdbarch_register_to_value (gdbarch, i386_register_to_value);
set_gdbarch_value_to_register (gdbarch, i386_value_to_register);
set_gdbarch_return_value_as_value (gdbarch, i386_return_value);
@@ -8645,7 +8511,7 @@ i386_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
/* Get the x86 target description from INFO. */
tdesc = info.target_desc;
- if (! tdesc_has_registers (tdesc))
+ if (!tdesc_has_registers (tdesc))
tdesc = i386_target_description (X86_XSTATE_SSE_MASK, false);
tdep->tdesc = tdesc;
@@ -8717,14 +8583,10 @@ i386_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
/* Wire in pseudo registers. Number of pseudo registers may be
changed. */
- set_gdbarch_num_pseudo_regs (gdbarch, (tdep->num_byte_regs
- + tdep->num_word_regs
- + tdep->num_dword_regs
- + tdep->num_mmx_regs
- + tdep->num_ymm_regs
- + num_bnd_cooked
- + tdep->num_ymm_avx512_regs
- + tdep->num_zmm_regs));
+ set_gdbarch_num_pseudo_regs (
+ gdbarch, (tdep->num_byte_regs + tdep->num_word_regs + tdep->num_dword_regs
+ + tdep->num_mmx_regs + tdep->num_ymm_regs + num_bnd_cooked
+ + tdep->num_ymm_avx512_regs + tdep->num_zmm_regs));
/* Target description may be changed. */
tdesc = tdep->tdesc;
@@ -8787,9 +8649,9 @@ i386_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
tdep->mm0_regnum = -1;
if (tdep->bnd0r_regnum > 0)
- tdep->bnd0_regnum = bnd0_regnum;
+ tdep->bnd0_regnum = bnd0_regnum;
else
- tdep-> bnd0_regnum = -1;
+ tdep->bnd0_regnum = -1;
/* Hook in the legacy prologue-based unwinders last (fallback). */
frame_unwind_append_unwinder (gdbarch, &i386_stack_tramp_frame_unwind);
@@ -8800,8 +8662,8 @@ i386_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
support, unless it has already been enabled. */
if (tdep->gregset_reg_offset
&& !gdbarch_iterate_over_regset_sections_p (gdbarch))
- set_gdbarch_iterate_over_regset_sections
- (gdbarch, i386_iterate_over_regset_sections);
+ set_gdbarch_iterate_over_regset_sections (
+ gdbarch, i386_iterate_over_regset_sections);
set_gdbarch_fast_tracepoint_valid_at (gdbarch,
i386_fast_tracepoint_valid_at);
@@ -8809,23 +8671,21 @@ i386_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
return gdbarch;
}
-
-
/* Return the target description for a specified XSAVE feature mask. */
const struct target_desc *
i386_target_description (uint64_t xcr0, bool segments)
{
- static target_desc *i386_tdescs \
- [2/*SSE*/][2/*AVX*/][2/*MPX*/][2/*AVX512*/][2/*PKRU*/][2/*segments*/] = {};
+ static target_desc *i386_tdescs[2 /*SSE*/][2 /*AVX*/][2 /*MPX*/]
+ [2 /*AVX512*/][2 /*PKRU*/][2 /*segments*/]
+ = {};
target_desc **tdesc;
tdesc = &i386_tdescs[(xcr0 & X86_XSTATE_SSE) ? 1 : 0]
- [(xcr0 & X86_XSTATE_AVX) ? 1 : 0]
- [(xcr0 & X86_XSTATE_MPX) ? 1 : 0]
- [(xcr0 & X86_XSTATE_AVX512) ? 1 : 0]
- [(xcr0 & X86_XSTATE_PKRU) ? 1 : 0]
- [segments ? 1 : 0];
+ [(xcr0 & X86_XSTATE_AVX) ? 1 : 0]
+ [(xcr0 & X86_XSTATE_MPX) ? 1 : 0]
+ [(xcr0 & X86_XSTATE_AVX512) ? 1 : 0]
+ [(xcr0 & X86_XSTATE_PKRU) ? 1 : 0][segments ? 1 : 0];
if (*tdesc == NULL)
*tdesc = i386_create_target_description (xcr0, false, segments);
@@ -8851,7 +8711,7 @@ i386_mpx_bd_base (void)
regstatus = regcache_raw_read_unsigned (rcache, tdep->bndcfgu_regnum, &ret);
if (regstatus != REG_VALID)
- error (_("BNDCFGU register invalid, read status %d."), regstatus);
+ error (_ ("BNDCFGU register invalid, read status %d."), regstatus);
return ret & MPX_BASE_MASK;
}
@@ -8866,10 +8726,10 @@ i386_mpx_enabled (void)
return (tdesc_find_feature (tdesc, "org.gnu.gdb.i386.mpx") != NULL);
}
-#define MPX_BD_MASK 0xfffffff00000ULL /* select bits [47:20] */
-#define MPX_BT_MASK 0x0000000ffff8 /* select bits [19:3] */
-#define MPX_BD_MASK_32 0xfffff000 /* select bits [31:12] */
-#define MPX_BT_MASK_32 0x00000ffc /* select bits [11:2] */
+#define MPX_BD_MASK 0xfffffff00000ULL /* select bits [47:20] */
+#define MPX_BT_MASK 0x0000000ffff8 /* select bits [19:3] */
+#define MPX_BD_MASK_32 0xfffff000 /* select bits [31:12] */
+#define MPX_BT_MASK_32 0x00000ffc /* select bits [11:2] */
/* Find the bound table entry given the pointer location and the base
address of the table. */
@@ -8887,7 +8747,6 @@ i386_mpx_get_bt_entry (CORE_ADDR ptr, CORE_ADDR bd_base)
struct gdbarch *gdbarch = get_current_arch ();
struct type *data_ptr_type = builtin_type (gdbarch)->builtin_data_ptr;
-
if (gdbarch_ptr_bit (gdbarch) == 64)
{
mpx_bd_mask = (CORE_ADDR) MPX_BD_MASK;
@@ -8897,8 +8756,8 @@ i386_mpx_get_bt_entry (CORE_ADDR ptr, CORE_ADDR bd_base)
bt_select_l_shift = 5;
bt_mask = (CORE_ADDR) MPX_BT_MASK;
- if ( sizeof (CORE_ADDR) == 4)
- error (_("bound table examination not supported\
+ if (sizeof (CORE_ADDR) == 4)
+ error (_ ("bound table examination not supported\
for 64-bit process with 32-bit GDB"));
}
else
@@ -8916,7 +8775,7 @@ i386_mpx_get_bt_entry (CORE_ADDR ptr, CORE_ADDR bd_base)
bd_entry = read_memory_typed_address (bd_entry_addr, data_ptr_type);
if ((bd_entry & 0x1) == 0)
- error (_("Invalid bounds directory entry at %s."),
+ error (_ ("Invalid bounds directory entry at %s."),
paddress (get_current_arch (), bd_entry_addr));
/* Clearing status bit. */
@@ -8958,9 +8817,9 @@ i386_mpx_print_bounds (const CORE_ADDR bt_entry[4])
uiout->field_core_addr ("pointer-value", gdbarch, bt_entry[2]);
if (gdbarch_ptr_bit (gdbarch) == 64)
- size = ( (~(int64_t) bt_entry[1]) - (int64_t) bt_entry[0]);
+ size = ((~(int64_t) bt_entry[1]) - (int64_t) bt_entry[0]);
else
- size = ( ~((int32_t) bt_entry[1]) - (int32_t) bt_entry[0]);
+ size = (~((int32_t) bt_entry[1]) - (int32_t) bt_entry[0]);
/* In case the bounds are 0x0 and 0xffff... the difference will be -1.
-1 represents in this sense full memory access, and there is no need
@@ -8992,14 +8851,14 @@ i386_mpx_info_bounds (const char *args, int from_tty)
if (gdbarch_bfd_arch_info (gdbarch)->arch != bfd_arch_i386
|| !i386_mpx_enabled ())
{
- gdb_printf (_("Intel Memory Protection Extensions not "
- "supported on this target.\n"));
+ gdb_printf (_ ("Intel Memory Protection Extensions not "
+ "supported on this target.\n"));
return;
}
if (args == NULL)
{
- gdb_printf (_("Address of pointer variable expected.\n"));
+ gdb_printf (_ ("Address of pointer variable expected.\n"));
return;
}
@@ -9012,7 +8871,7 @@ i386_mpx_info_bounds (const char *args, int from_tty)
for (i = 0; i < 4; i++)
bt_entry[i] = read_memory_typed_address (bt_entry_addr
- + i * data_ptr_type->length (),
+ + i * data_ptr_type->length (),
data_ptr_type);
i386_mpx_print_bounds (bt_entry);
@@ -9035,38 +8894,38 @@ i386_mpx_set_bounds (const char *args, int from_tty)
if (gdbarch_bfd_arch_info (gdbarch)->arch != bfd_arch_i386
|| !i386_mpx_enabled ())
- error (_("Intel Memory Protection Extensions not supported\
+ error (_ ("Intel Memory Protection Extensions not supported\
on this target."));
if (args == NULL)
- error (_("Pointer value expected."));
+ error (_ ("Pointer value expected."));
addr = value_as_address (parse_to_comma_and_eval (&input));
if (input[0] == ',')
++input;
if (input[0] == '\0')
- error (_("wrong number of arguments: missing lower and upper bound."));
+ error (_ ("wrong number of arguments: missing lower and upper bound."));
lower = value_as_address (parse_to_comma_and_eval (&input));
if (input[0] == ',')
++input;
if (input[0] == '\0')
- error (_("Wrong number of arguments; Missing upper bound."));
+ error (_ ("Wrong number of arguments; Missing upper bound."));
upper = value_as_address (parse_to_comma_and_eval (&input));
bd_base = i386_mpx_bd_base ();
bt_entry_addr = i386_mpx_get_bt_entry (addr, bd_base);
for (i = 0; i < 2; i++)
bt_entry[i] = read_memory_typed_address (bt_entry_addr
- + i * data_ptr_type->length (),
+ + i * data_ptr_type->length (),
data_ptr_type);
bt_entry[0] = (uint64_t) lower;
bt_entry[1] = ~(uint64_t) upper;
for (i = 0; i < 2; i++)
write_memory_unsigned_integer (bt_entry_addr
- + i * data_ptr_type->length (),
+ + i * data_ptr_type->length (),
data_ptr_type->length (), byte_order,
bt_entry[i]);
}
@@ -9074,6 +8933,7 @@ i386_mpx_set_bounds (const char *args, int from_tty)
static struct cmd_list_element *mpx_set_cmdlist, *mpx_show_cmdlist;
void _initialize_i386_tdep ();
+
void
_initialize_i386_tdep ()
{
@@ -9081,33 +8941,35 @@ _initialize_i386_tdep ()
/* Add the variable that controls the disassembly flavor. */
add_setshow_enum_cmd ("disassembly-flavor", no_class, valid_flavors,
- &disassembly_flavor, _("\
-Set the disassembly flavor."), _("\
-Show the disassembly flavor."), _("\
+ &disassembly_flavor, _ ("\
+Set the disassembly flavor."),
+ _ ("\
+Show the disassembly flavor."),
+ _ ("\
The valid values are \"att\" and \"intel\", and the default value is \"att\"."),
- NULL,
- NULL, /* FIXME: i18n: */
+ NULL, NULL, /* FIXME: i18n: */
&setlist, &showlist);
/* Add the variable that controls the convention for returning
structs. */
add_setshow_enum_cmd ("struct-convention", no_class, valid_conventions,
- &struct_convention, _("\
-Set the convention for returning small structs."), _("\
-Show the convention for returning small structs."), _("\
+ &struct_convention, _ ("\
+Set the convention for returning small structs."),
+ _ ("\
+Show the convention for returning small structs."),
+ _ ("\
Valid values are \"default\", \"pcc\" and \"reg\", and the default value\n\
is \"default\"."),
- NULL,
- NULL, /* FIXME: i18n: */
+ NULL, NULL, /* FIXME: i18n: */
&setlist, &showlist);
/* Add "mpx" prefix for the set and show commands. */
- add_setshow_prefix_cmd
- ("mpx", class_support,
- _("Set Intel Memory Protection Extensions specific variables."),
- _("Show Intel Memory Protection Extensions specific variables."),
- &mpx_set_cmdlist, &mpx_show_cmdlist, &setlist, &showlist);
+ add_setshow_prefix_cmd (
+ "mpx", class_support,
+ _ ("Set Intel Memory Protection Extensions specific variables."),
+ _ ("Show Intel Memory Protection Extensions specific variables."),
+ &mpx_set_cmdlist, &mpx_show_cmdlist, &setlist, &showlist);
/* Add "bound" command for the show mpx commands list. */
diff --git a/gdb/i386-tdep.h b/gdb/i386-tdep.h
index 371bce72369..f4a0677cf31 100644
--- a/gdb/i386-tdep.h
+++ b/gdb/i386-tdep.h
@@ -52,8 +52,8 @@ struct regcache;
enum struct_return
{
- pcc_struct_return, /* Return "short" structures in memory. */
- reg_struct_return /* Return "short" structures in registers. */
+ pcc_struct_return, /* Return "short" structures in memory. */
+ reg_struct_return /* Return "short" structures in registers. */
};
/* i386 architecture specific information. */
@@ -146,21 +146,21 @@ struct i386_gdbarch_tdep : gdbarch_tdep_base
int xsave_xcr0_offset = 0;
/* Register names. */
- const char * const *register_names = nullptr;
+ const char *const *register_names = nullptr;
/* Register number for %ymm0h. Set this to -1 to indicate the absence
of upper YMM register support. */
int ymm0h_regnum = 0;
/* Upper YMM register names. Only used for tdesc_numbered_register. */
- const char * const *ymmh_register_names = nullptr;
+ const char *const *ymmh_register_names = nullptr;
/* Register number for %ymm16h. Set this to -1 to indicate the absence
of support for YMM16-31. */
int ymm16h_regnum = 0;
/* YMM16-31 register names. Only used for tdesc_numbered_register. */
- const char * const *ymm16h_register_names = nullptr;
+ const char *const *ymm16h_register_names = nullptr;
/* Register number for %bnd0r. Set this to -1 to indicate the absence
bound registers. */
@@ -175,23 +175,23 @@ struct i386_gdbarch_tdep : gdbarch_tdep_base
int bndcfgu_regnum = 0;
/* MPX register names. Only used for tdesc_numbered_register. */
- const char * const *mpx_register_names = nullptr;
+ const char *const *mpx_register_names = nullptr;
/* Register number for %zmm0h. Set this to -1 to indicate the absence
of ZMM_HI256 register support. */
int zmm0h_regnum = 0;
/* OpMask register names. */
- const char * const *k_register_names = nullptr;
+ const char *const *k_register_names = nullptr;
/* ZMM register names. Only used for tdesc_numbered_register. */
- const char * const *zmmh_register_names = nullptr;
+ const char *const *zmmh_register_names = nullptr;
/* XMM16-31 register names. Only used for tdesc_numbered_register. */
- const char * const *xmm_avx512_register_names = nullptr;
+ const char *const *xmm_avx512_register_names = nullptr;
/* YMM16-31 register names. Only used for tdesc_numbered_register. */
- const char * const *ymm_avx512_register_names = nullptr;
+ const char *const *ymm_avx512_register_names = nullptr;
/* Number of PKEYS registers. */
int num_pkeys_regs = 0;
@@ -200,7 +200,7 @@ struct i386_gdbarch_tdep : gdbarch_tdep_base
int pkru_regnum = 0;
/* PKEYS register names. */
- const char * const *pkeys_register_names = nullptr;
+ const char *const *pkeys_register_names = nullptr;
/* Register number for %fsbase. Set this to -1 to indicate the
absence of segment base registers. */
@@ -216,7 +216,9 @@ struct i386_gdbarch_tdep : gdbarch_tdep_base
int jb_pc_offset = 0;
/* Convention for returning structures. */
- enum struct_return struct_return {};
+ enum struct_return struct_return
+ {
+ };
/* Address range where sigtramp lives. */
CORE_ADDR sigtramp_start = 0;
@@ -274,33 +276,33 @@ extern int i386_fpc_regnum_p (struct gdbarch *, int);
enum i386_regnum
{
- I386_EAX_REGNUM, /* %eax */
- I386_ECX_REGNUM, /* %ecx */
- I386_EDX_REGNUM, /* %edx */
- I386_EBX_REGNUM, /* %ebx */
- I386_ESP_REGNUM, /* %esp */
- I386_EBP_REGNUM, /* %ebp */
- I386_ESI_REGNUM, /* %esi */
- I386_EDI_REGNUM, /* %edi */
- I386_EIP_REGNUM, /* %eip */
- I386_EFLAGS_REGNUM, /* %eflags */
- I386_CS_REGNUM, /* %cs */
- I386_SS_REGNUM, /* %ss */
- I386_DS_REGNUM, /* %ds */
- I386_ES_REGNUM, /* %es */
- I386_FS_REGNUM, /* %fs */
- I386_GS_REGNUM, /* %gs */
- I386_ST0_REGNUM, /* %st(0) */
- I386_MXCSR_REGNUM = 40, /* %mxcsr */
- I386_YMM0H_REGNUM, /* %ymm0h */
+ I386_EAX_REGNUM, /* %eax */
+ I386_ECX_REGNUM, /* %ecx */
+ I386_EDX_REGNUM, /* %edx */
+ I386_EBX_REGNUM, /* %ebx */
+ I386_ESP_REGNUM, /* %esp */
+ I386_EBP_REGNUM, /* %ebp */
+ I386_ESI_REGNUM, /* %esi */
+ I386_EDI_REGNUM, /* %edi */
+ I386_EIP_REGNUM, /* %eip */
+ I386_EFLAGS_REGNUM, /* %eflags */
+ I386_CS_REGNUM, /* %cs */
+ I386_SS_REGNUM, /* %ss */
+ I386_DS_REGNUM, /* %ds */
+ I386_ES_REGNUM, /* %es */
+ I386_FS_REGNUM, /* %fs */
+ I386_GS_REGNUM, /* %gs */
+ I386_ST0_REGNUM, /* %st(0) */
+ I386_MXCSR_REGNUM = 40, /* %mxcsr */
+ I386_YMM0H_REGNUM, /* %ymm0h */
I386_YMM7H_REGNUM = I386_YMM0H_REGNUM + 7,
I386_BND0R_REGNUM,
I386_BND3R_REGNUM = I386_BND0R_REGNUM + 3,
I386_BNDCFGU_REGNUM,
I386_BNDSTATUS_REGNUM,
- I386_K0_REGNUM, /* %k0 */
+ I386_K0_REGNUM, /* %k0 */
I386_K7_REGNUM = I386_K0_REGNUM + 7,
- I386_ZMM0H_REGNUM, /* %zmm0h */
+ I386_ZMM0H_REGNUM, /* %zmm0h */
I386_ZMM7H_REGNUM = I386_ZMM0H_REGNUM + 7,
I386_PKRU_REGNUM,
I386_FSBASE_REGNUM,
@@ -337,18 +339,18 @@ enum record_i386_regnum
X86_RECORD_GS_REGNUM,
};
-#define I386_NUM_GREGS 16
-#define I386_NUM_XREGS 9
+#define I386_NUM_GREGS 16
+#define I386_NUM_XREGS 9
-#define I386_SSE_NUM_REGS (I386_MXCSR_REGNUM + 1)
-#define I386_AVX_NUM_REGS (I386_YMM7H_REGNUM + 1)
-#define I386_MPX_NUM_REGS (I386_BNDSTATUS_REGNUM + 1)
-#define I386_AVX512_NUM_REGS (I386_ZMM7H_REGNUM + 1)
-#define I386_PKEYS_NUM_REGS (I386_PKRU_REGNUM + 1)
-#define I386_NUM_REGS (I386_GSBASE_REGNUM + 1)
+#define I386_SSE_NUM_REGS (I386_MXCSR_REGNUM + 1)
+#define I386_AVX_NUM_REGS (I386_YMM7H_REGNUM + 1)
+#define I386_MPX_NUM_REGS (I386_BNDSTATUS_REGNUM + 1)
+#define I386_AVX512_NUM_REGS (I386_ZMM7H_REGNUM + 1)
+#define I386_PKEYS_NUM_REGS (I386_PKRU_REGNUM + 1)
+#define I386_NUM_REGS (I386_GSBASE_REGNUM + 1)
/* Size of the largest register. */
-#define I386_MAX_REGISTER_SIZE 64
+#define I386_MAX_REGISTER_SIZE 64
/* Types for i386-specific registers. */
extern struct type *i387_ext_type (struct gdbarch *gdbarch);
@@ -358,7 +360,7 @@ extern int i386_byte_regnum_p (struct gdbarch *gdbarch, int regnum);
extern int i386_word_regnum_p (struct gdbarch *gdbarch, int regnum);
extern int i386_dword_regnum_p (struct gdbarch *gdbarch, int regnum);
extern int i386_xmm_regnum_p (struct gdbarch *gdbarch, int regnum);
-extern int i386_xmm_avx512_regnum_p (struct gdbarch * gdbarch, int regnum);
+extern int i386_xmm_avx512_regnum_p (struct gdbarch *gdbarch, int regnum);
extern int i386_ymm_regnum_p (struct gdbarch *gdbarch, int regnum);
extern int i386_ymm_avx512_regnum_p (struct gdbarch *gdbarch, int regnum);
extern int i386_bnd_regnum_p (struct gdbarch *gdbarch, int regnum);
@@ -378,17 +380,16 @@ extern void i386_pseudo_register_read_into_value (struct gdbarch *gdbarch,
struct value *result);
extern void i386_pseudo_register_write (struct gdbarch *gdbarch,
- struct regcache *regcache,
- int regnum, const gdb_byte *buf);
+ struct regcache *regcache, int regnum,
+ const gdb_byte *buf);
extern int i386_ax_pseudo_register_collect (struct gdbarch *gdbarch,
- struct agent_expr *ax,
- int regnum);
+ struct agent_expr *ax, int regnum);
/* Segment selectors. */
-#define I386_SEL_RPL 0x0003 /* Requester's Privilege Level mask. */
-#define I386_SEL_UPL 0x0003 /* User Privilige Level. */
-#define I386_SEL_KPL 0x0000 /* Kernel Privilige Level. */
+#define I386_SEL_RPL 0x0003 /* Requester's Privilege Level mask. */
+#define I386_SEL_UPL 0x0003 /* User Privilige Level. */
+#define I386_SEL_KPL 0x0000 /* Kernel Privilige Level. */
/* The length of the longest i386 instruction (according to
include/asm-i386/kprobes.h in Linux 2.6. */
@@ -402,16 +403,12 @@ extern CORE_ADDR i386_skip_main_prologue (struct gdbarch *gdbarch,
/* The "push_dummy_call" gdbarch method, optionally with the thiscall
calling convention. */
-extern CORE_ADDR i386_thiscall_push_dummy_call (struct gdbarch *gdbarch,
- struct value *function,
- struct regcache *regcache,
- CORE_ADDR bp_addr,
- int nargs, struct value **args,
- CORE_ADDR sp,
- function_call_return_method
- return_method,
- CORE_ADDR struct_addr,
- bool thiscall);
+extern CORE_ADDR
+i386_thiscall_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
+ struct regcache *regcache, CORE_ADDR bp_addr,
+ int nargs, struct value **args, CORE_ADDR sp,
+ function_call_return_method return_method,
+ CORE_ADDR struct_addr, bool thiscall);
/* Return whether the THIS_FRAME corresponds to a sigtramp routine. */
extern int i386_sigtramp_p (frame_info_ptr this_frame);
@@ -434,21 +431,20 @@ extern const struct regset i386_gregset;
extern const struct regset i386_fpregset;
/* Default iterator over core file register note sections. */
-extern void
- i386_iterate_over_regset_sections (struct gdbarch *gdbarch,
- iterate_over_regset_sections_cb *cb,
- void *cb_data,
- const struct regcache *regcache);
+extern void i386_iterate_over_regset_sections (
+ struct gdbarch *gdbarch, iterate_over_regset_sections_cb *cb, void *cb_data,
+ const struct regcache *regcache);
typedef buf_displaced_step_copy_insn_closure
i386_displaced_step_copy_insn_closure;
-extern displaced_step_copy_insn_closure_up i386_displaced_step_copy_insn
- (struct gdbarch *gdbarch, CORE_ADDR from, CORE_ADDR to,
- struct regcache *regs);
-extern void i386_displaced_step_fixup
- (struct gdbarch *gdbarch, displaced_step_copy_insn_closure *closure,
- CORE_ADDR from, CORE_ADDR to, regcache *regs);
+extern displaced_step_copy_insn_closure_up
+i386_displaced_step_copy_insn (struct gdbarch *gdbarch, CORE_ADDR from,
+ CORE_ADDR to, struct regcache *regs);
+extern void
+i386_displaced_step_fixup (struct gdbarch *gdbarch,
+ displaced_step_copy_insn_closure *closure,
+ CORE_ADDR from, CORE_ADDR to, regcache *regs);
/* Initialize a basic ELF architecture variant. */
extern void i386_elf_init_abi (struct gdbarch_info, struct gdbarch *);
@@ -467,7 +463,6 @@ extern const struct target_desc *i386_target_description (uint64_t xcr0,
/* Return true iff the current target is MPX enabled. */
extern int i386_mpx_enabled (void);
-
/* Functions and variables exported from i386-bsd-tdep.c. */
@@ -482,7 +477,8 @@ extern int i386bsd_sc_reg_offset[];
extern int i386_stap_is_single_operand (struct gdbarch *gdbarch,
const char *s);
-extern expr::operation_up i386_stap_parse_special_token
- (struct gdbarch *gdbarch, struct stap_parse_info *p);
+extern expr::operation_up
+i386_stap_parse_special_token (struct gdbarch *gdbarch,
+ struct stap_parse_info *p);
#endif /* i386-tdep.h */
diff --git a/gdb/i386-windows-nat.c b/gdb/i386-windows-nat.c
index efb23cf9889..7dc8f0da1f7 100644
--- a/gdb/i386-windows-nat.c
+++ b/gdb/i386-windows-nat.c
@@ -25,53 +25,40 @@
#ifdef __x86_64__
#define CONTEXT WOW64_CONTEXT
#endif
-#define context_offset(x) ((int)(size_t)&(((CONTEXT *)NULL)->x))
-const int i386_mappings[] =
-{
- context_offset (Eax),
- context_offset (Ecx),
- context_offset (Edx),
- context_offset (Ebx),
- context_offset (Esp),
- context_offset (Ebp),
- context_offset (Esi),
- context_offset (Edi),
- context_offset (Eip),
- context_offset (EFlags),
- context_offset (SegCs),
- context_offset (SegSs),
- context_offset (SegDs),
- context_offset (SegEs),
- context_offset (SegFs),
- context_offset (SegGs),
- context_offset (FloatSave.RegisterArea[0 * 10]),
- context_offset (FloatSave.RegisterArea[1 * 10]),
- context_offset (FloatSave.RegisterArea[2 * 10]),
- context_offset (FloatSave.RegisterArea[3 * 10]),
- context_offset (FloatSave.RegisterArea[4 * 10]),
- context_offset (FloatSave.RegisterArea[5 * 10]),
- context_offset (FloatSave.RegisterArea[6 * 10]),
- context_offset (FloatSave.RegisterArea[7 * 10]),
- context_offset (FloatSave.ControlWord),
- context_offset (FloatSave.StatusWord),
- context_offset (FloatSave.TagWord),
- context_offset (FloatSave.ErrorSelector),
- context_offset (FloatSave.ErrorOffset),
- context_offset (FloatSave.DataSelector),
- context_offset (FloatSave.DataOffset),
- context_offset (FloatSave.ErrorSelector)
- /* XMM0-7 */ ,
- context_offset (ExtendedRegisters[10*16]),
- context_offset (ExtendedRegisters[11*16]),
- context_offset (ExtendedRegisters[12*16]),
- context_offset (ExtendedRegisters[13*16]),
- context_offset (ExtendedRegisters[14*16]),
- context_offset (ExtendedRegisters[15*16]),
- context_offset (ExtendedRegisters[16*16]),
- context_offset (ExtendedRegisters[17*16]),
- /* MXCSR */
- context_offset (ExtendedRegisters[24])
-};
+#define context_offset(x) ((int) (size_t) & (((CONTEXT *) NULL)->x))
+const int i386_mappings[]
+ = { context_offset (Eax), context_offset (Ecx), context_offset (Edx),
+ context_offset (Ebx), context_offset (Esp), context_offset (Ebp),
+ context_offset (Esi), context_offset (Edi), context_offset (Eip),
+ context_offset (EFlags), context_offset (SegCs), context_offset (SegSs),
+ context_offset (SegDs), context_offset (SegEs), context_offset (SegFs),
+ context_offset (SegGs), context_offset (FloatSave.RegisterArea[0 * 10]),
+ context_offset (FloatSave.RegisterArea[1 * 10]),
+ context_offset (FloatSave.RegisterArea[2 * 10]),
+ context_offset (FloatSave.RegisterArea[3 * 10]),
+ context_offset (FloatSave.RegisterArea[4 * 10]),
+ context_offset (FloatSave.RegisterArea[5 * 10]),
+ context_offset (FloatSave.RegisterArea[6 * 10]),
+ context_offset (FloatSave.RegisterArea[7 * 10]),
+ context_offset (FloatSave.ControlWord),
+ context_offset (FloatSave.StatusWord),
+ context_offset (FloatSave.TagWord),
+ context_offset (FloatSave.ErrorSelector),
+ context_offset (FloatSave.ErrorOffset),
+ context_offset (FloatSave.DataSelector),
+ context_offset (FloatSave.DataOffset),
+ context_offset (FloatSave.ErrorSelector)
+ /* XMM0-7 */,
+ context_offset (ExtendedRegisters[10 * 16]),
+ context_offset (ExtendedRegisters[11 * 16]),
+ context_offset (ExtendedRegisters[12 * 16]),
+ context_offset (ExtendedRegisters[13 * 16]),
+ context_offset (ExtendedRegisters[14 * 16]),
+ context_offset (ExtendedRegisters[15 * 16]),
+ context_offset (ExtendedRegisters[16 * 16]),
+ context_offset (ExtendedRegisters[17 * 16]),
+ /* MXCSR */
+ context_offset (ExtendedRegisters[24]) };
#undef context_offset
#undef CONTEXT
@@ -84,6 +71,7 @@ i386_windows_segment_register_p (int regnum)
}
void _initialize_i386_windows_nat ();
+
void
_initialize_i386_windows_nat ()
{
diff --git a/gdb/i386-windows-tdep.c b/gdb/i386-windows-tdep.c
index 595c58e70f5..ebcb55df154 100644
--- a/gdb/i386-windows-tdep.c
+++ b/gdb/i386-windows-tdep.c
@@ -33,8 +33,7 @@
/* This vector maps GDB's idea of a register's number into an address
in the windows exception context vector. */
-static int i386_windows_gregset_reg_offset[] =
-{
+static int i386_windows_gregset_reg_offset[] = {
176, /* eax */
172, /* ecx */
168, /* edx */
@@ -55,11 +54,11 @@ static int i386_windows_gregset_reg_offset[] =
144, /* fs */
140, /* gs */
- 56, /* FloatSave.RegisterArea[0 * 10] */
- 66, /* FloatSave.RegisterArea[1 * 10] */
- 76, /* FloatSave.RegisterArea[2 * 10] */
- 86, /* FloatSave.RegisterArea[3 * 10] */
- 96, /* FloatSave.RegisterArea[4 * 10] */
+ 56, /* FloatSave.RegisterArea[0 * 10] */
+ 66, /* FloatSave.RegisterArea[1 * 10] */
+ 76, /* FloatSave.RegisterArea[2 * 10] */
+ 86, /* FloatSave.RegisterArea[3 * 10] */
+ 96, /* FloatSave.RegisterArea[4 * 10] */
106, /* FloatSave.RegisterArea[5 * 10] */
116, /* FloatSave.RegisterArea[6 * 10] */
126, /* FloatSave.RegisterArea[7 * 10] */
@@ -120,8 +119,7 @@ i386_windows_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
/* read_subroutine_type sets for non-static member functions the
artificial flag of the first parameter ('this' pointer). */
- if (type->code () == TYPE_CODE_METHOD
- && type->num_fields () > 0
+ if (type->code () == TYPE_CODE_METHOD && type->num_fields () > 0
&& TYPE_FIELD_ARTIFICIAL (type, 0)
&& type->field (0).type ()->code () == TYPE_CODE_PTR)
thiscall = 1;
@@ -134,11 +132,13 @@ i386_windows_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
/* Common parts for gdbarch initialization for Windows and Cygwin on i386. */
static void
-i386_windows_init_abi_common (struct gdbarch_info info, struct gdbarch *gdbarch)
+i386_windows_init_abi_common (struct gdbarch_info info,
+ struct gdbarch *gdbarch)
{
i386_gdbarch_tdep *tdep = gdbarch_tdep<i386_gdbarch_tdep> (gdbarch);
- set_gdbarch_skip_trampoline_code (gdbarch, i386_windows_skip_trampoline_code);
+ set_gdbarch_skip_trampoline_code (gdbarch,
+ i386_windows_skip_trampoline_code);
set_gdbarch_skip_main_prologue (gdbarch, i386_skip_main_prologue);
@@ -151,8 +151,8 @@ i386_windows_init_abi_common (struct gdbarch_info info, struct gdbarch *gdbarch)
tdep->sizeof_fpregset = 0;
/* Core file support. */
- set_gdbarch_core_xfer_shared_libraries
- (gdbarch, windows_core_xfer_shared_libraries);
+ set_gdbarch_core_xfer_shared_libraries (gdbarch,
+ windows_core_xfer_shared_libraries);
set_gdbarch_core_pid_to_str (gdbarch, windows_core_pid_to_str);
set_gdbarch_auto_wide_charset (gdbarch, i386_windows_auto_wide_charset);
@@ -211,6 +211,7 @@ i386_cygwin_core_osabi_sniffer (bfd *abfd)
}
void _initialize_i386_windows_tdep ();
+
void
_initialize_i386_windows_tdep ()
{
diff --git a/gdb/i387-tdep.c b/gdb/i387-tdep.c
index 04bbf71952b..7fed5f040e8 100644
--- a/gdb/i387-tdep.c
+++ b/gdb/i387-tdep.c
@@ -33,8 +33,8 @@
/* Print the floating point number specified by RAW. */
static void
-print_i387_value (struct gdbarch *gdbarch,
- const gdb_byte *raw, struct ui_file *file)
+print_i387_value (struct gdbarch *gdbarch, const gdb_byte *raw,
+ struct ui_file *file)
{
/* We try to print 19 digits. The last digit may or may not contain
garbage, but we'd better print one too many. We need enough room
@@ -48,8 +48,8 @@ print_i387_value (struct gdbarch *gdbarch,
/* Print the classification for the register contents RAW. */
static void
-print_i387_ext (struct gdbarch *gdbarch,
- const gdb_byte *raw, struct ui_file *file)
+print_i387_ext (struct gdbarch *gdbarch, const gdb_byte *raw,
+ struct ui_file *file)
{
int sign;
int integer;
@@ -60,8 +60,8 @@ print_i387_ext (struct gdbarch *gdbarch,
integer = raw[7] & 0x80;
exponent = (((raw[9] & 0x7f) << 8) | raw[8]);
fraction[0] = ((raw[3] << 24) | (raw[2] << 16) | (raw[1] << 8) | raw[0]);
- fraction[1] = (((raw[7] & 0x7f) << 24) | (raw[6] << 16)
- | (raw[5] << 8) | raw[4]);
+ fraction[1]
+ = (((raw[7] & 0x7f) << 24) | (raw[6] << 16) | (raw[5] << 8) | raw[4]);
if (exponent == 0x7fff && integer)
{
@@ -85,7 +85,7 @@ print_i387_ext (struct gdbarch *gdbarch,
{
/* Denormal or zero. */
print_i387_value (gdbarch, raw, file);
-
+
if (integer)
/* Pseudo-denormal. */
gdb_puts (" Pseudo-denormal", file);
@@ -102,13 +102,13 @@ print_i387_ext (struct gdbarch *gdbarch,
was unavailable. */
static void
-print_i387_status_word (int status_p,
- unsigned int status, struct ui_file *file)
+print_i387_status_word (int status_p, unsigned int status,
+ struct ui_file *file)
{
gdb_printf (file, "Status Word: ");
if (!status_p)
{
- gdb_printf (file, "%s\n", _("<unavailable>"));
+ gdb_printf (file, "%s\n", _ ("<unavailable>"));
return;
}
@@ -132,21 +132,20 @@ print_i387_status_word (int status_p,
gdb_puts ("\n", file);
- gdb_printf (file,
- " TOP: %d\n", ((status >> 11) & 7));
+ gdb_printf (file, " TOP: %d\n", ((status >> 11) & 7));
}
/* Print the control word CONTROL. If CONTROL_P is false, then
CONTROL was unavailable. */
static void
-print_i387_control_word (int control_p,
- unsigned int control, struct ui_file *file)
+print_i387_control_word (int control_p, unsigned int control,
+ struct ui_file *file)
{
gdb_printf (file, "Control Word: ");
if (!control_p)
{
- gdb_printf (file, "%s\n", _("<unavailable>"));
+ gdb_printf (file, "%s\n", _ ("<unavailable>"));
return;
}
@@ -177,7 +176,7 @@ print_i387_control_word (int control_p,
gdb_puts ("Extended Precision (64-bits)\n", file);
break;
}
-
+
gdb_puts (" RC: ", file);
switch ((control >> 10) & 3)
{
@@ -226,22 +225,21 @@ i387_print_float_info (struct gdbarch *gdbarch, struct ui_file *file,
gdb_assert (gdbarch == get_frame_arch (frame));
- fctrl_p = read_frame_register_unsigned (frame,
- I387_FCTRL_REGNUM (tdep), &fctrl);
- fstat_p = read_frame_register_unsigned (frame,
- I387_FSTAT_REGNUM (tdep), &fstat);
- ftag_p = read_frame_register_unsigned (frame,
- I387_FTAG_REGNUM (tdep), &ftag);
- fiseg_p = read_frame_register_unsigned (frame,
- I387_FISEG_REGNUM (tdep), &fiseg);
- fioff_p = read_frame_register_unsigned (frame,
- I387_FIOFF_REGNUM (tdep), &fioff);
- foseg_p = read_frame_register_unsigned (frame,
- I387_FOSEG_REGNUM (tdep), &foseg);
- fooff_p = read_frame_register_unsigned (frame,
- I387_FOOFF_REGNUM (tdep), &fooff);
- fop_p = read_frame_register_unsigned (frame,
- I387_FOP_REGNUM (tdep), &fop);
+ fctrl_p
+ = read_frame_register_unsigned (frame, I387_FCTRL_REGNUM (tdep), &fctrl);
+ fstat_p
+ = read_frame_register_unsigned (frame, I387_FSTAT_REGNUM (tdep), &fstat);
+ ftag_p
+ = read_frame_register_unsigned (frame, I387_FTAG_REGNUM (tdep), &ftag);
+ fiseg_p
+ = read_frame_register_unsigned (frame, I387_FISEG_REGNUM (tdep), &fiseg);
+ fioff_p
+ = read_frame_register_unsigned (frame, I387_FIOFF_REGNUM (tdep), &fioff);
+ foseg_p
+ = read_frame_register_unsigned (frame, I387_FOSEG_REGNUM (tdep), &foseg);
+ fooff_p
+ = read_frame_register_unsigned (frame, I387_FOOFF_REGNUM (tdep), &fooff);
+ fop_p = read_frame_register_unsigned (frame, I387_FOP_REGNUM (tdep), &fop);
if (fstat_p)
{
@@ -294,7 +292,7 @@ i387_print_float_info (struct gdbarch *gdbarch, struct ui_file *file,
print_i387_ext (gdbarch, raw, file);
}
else
- gdb_printf (file, "%s", _("<unavailable>"));
+ gdb_printf (file, "%s", _ ("<unavailable>"));
gdb_puts ("\n", file);
}
@@ -304,21 +302,19 @@ i387_print_float_info (struct gdbarch *gdbarch, struct ui_file *file,
print_i387_status_word (fstat_p, fstat, file);
print_i387_control_word (fctrl_p, fctrl, file);
gdb_printf (file, "Tag Word: %s\n",
- ftag_p ? hex_string_custom (ftag, 4) : _("<unavailable>"));
+ ftag_p ? hex_string_custom (ftag, 4) : _ ("<unavailable>"));
gdb_printf (file, "Instruction Pointer: %s:",
- fiseg_p ? hex_string_custom (fiseg, 2) : _("<unavailable>"));
+ fiseg_p ? hex_string_custom (fiseg, 2) : _ ("<unavailable>"));
gdb_printf (file, "%s\n",
- fioff_p ? hex_string_custom (fioff, 8) : _("<unavailable>"));
+ fioff_p ? hex_string_custom (fioff, 8) : _ ("<unavailable>"));
gdb_printf (file, "Operand Pointer: %s:",
- foseg_p ? hex_string_custom (foseg, 2) : _("<unavailable>"));
+ foseg_p ? hex_string_custom (foseg, 2) : _ ("<unavailable>"));
gdb_printf (file, "%s\n",
- fooff_p ? hex_string_custom (fooff, 8) : _("<unavailable>"));
+ fooff_p ? hex_string_custom (fooff, 8) : _ ("<unavailable>"));
gdb_printf (file, "Opcode: %s\n",
- fop_p
- ? (hex_string_custom (fop ? (fop | 0xd800) : 0, 4))
- : _("<unavailable>"));
+ fop_p ? (hex_string_custom (fop ? (fop | 0xd800) : 0, 4))
+ : _ ("<unavailable>"));
}
-
/* Return nonzero if a value of type TYPE stored in register REGNUM
needs any special handling. */
@@ -331,8 +327,7 @@ i387_convert_register_p (struct gdbarch *gdbarch, int regnum,
{
/* Floating point registers must be converted unless we are
accessing them in their hardware type or TYPE is not float. */
- if (type == i387_ext_type (gdbarch)
- || type->code () != TYPE_CODE_FLT)
+ if (type == i387_ext_type (gdbarch) || type->code () != TYPE_CODE_FLT)
return 0;
else
return 1;
@@ -345,9 +340,8 @@ i387_convert_register_p (struct gdbarch *gdbarch, int regnum,
return its contents in TO. */
int
-i387_register_to_value (frame_info_ptr frame, int regnum,
- struct type *type, gdb_byte *to,
- int *optimizedp, int *unavailablep)
+i387_register_to_value (frame_info_ptr frame, int regnum, struct type *type,
+ gdb_byte *to, int *optimizedp, int *unavailablep)
{
struct gdbarch *gdbarch = get_frame_arch (frame);
gdb_byte from[I386_MAX_REGISTER_SIZE];
@@ -357,18 +351,17 @@ i387_register_to_value (frame_info_ptr frame, int regnum,
/* We only support floating-point values. */
if (type->code () != TYPE_CODE_FLT)
{
- warning (_("Cannot convert floating-point register value "
- "to non-floating-point type."));
+ warning (_ ("Cannot convert floating-point register value "
+ "to non-floating-point type."));
*optimizedp = *unavailablep = 0;
return 0;
}
/* Convert to TYPE. */
- if (!get_frame_register_bytes (frame, regnum, 0,
- gdb::make_array_view (from,
- register_size (gdbarch,
- regnum)),
- optimizedp, unavailablep))
+ if (!get_frame_register_bytes (
+ frame, regnum, 0,
+ gdb::make_array_view (from, register_size (gdbarch, regnum)),
+ optimizedp, unavailablep))
return 0;
target_float_convert (from, i387_ext_type (gdbarch), to, type);
@@ -380,8 +373,8 @@ i387_register_to_value (frame_info_ptr frame, int regnum,
REGNUM in frame FRAME. */
void
-i387_value_to_register (frame_info_ptr frame, int regnum,
- struct type *type, const gdb_byte *from)
+i387_value_to_register (frame_info_ptr frame, int regnum, struct type *type,
+ const gdb_byte *from)
{
struct gdbarch *gdbarch = get_frame_arch (frame);
gdb_byte to[I386_MAX_REGISTER_SIZE];
@@ -391,8 +384,8 @@ i387_value_to_register (frame_info_ptr frame, int regnum,
/* We only support floating-point values. */
if (type->code () != TYPE_CODE_FLT)
{
- warning (_("Cannot convert non-floating-point type "
- "to floating-point register value."));
+ warning (_ ("Cannot convert non-floating-point type "
+ "to floating-point register value."));
return;
}
@@ -400,7 +393,6 @@ i387_value_to_register (frame_info_ptr frame, int regnum,
target_float_convert (from, type, to, i387_ext_type (gdbarch));
put_frame_register (frame, regnum, to);
}
-
/* Handle FSAVE and FXSAVE formats. */
@@ -408,29 +400,22 @@ i387_value_to_register (frame_info_ptr frame, int regnum,
the data structure used by the "fsave" instruction where GDB
register REGNUM is stored. */
-static int fsave_offset[] =
-{
- 28 + 0 * 10, /* %st(0) ... */
- 28 + 1 * 10,
- 28 + 2 * 10,
- 28 + 3 * 10,
- 28 + 4 * 10,
- 28 + 5 * 10,
- 28 + 6 * 10,
- 28 + 7 * 10, /* ... %st(7). */
- 0, /* `fctrl' (16 bits). */
- 4, /* `fstat' (16 bits). */
- 8, /* `ftag' (16 bits). */
- 16, /* `fiseg' (16 bits). */
- 12, /* `fioff'. */
- 24, /* `foseg' (16 bits). */
- 20, /* `fooff'. */
- 18 /* `fop' (bottom 11 bits). */
+static int fsave_offset[] = {
+ 28 + 0 * 10, /* %st(0) ... */
+ 28 + 1 * 10, 28 + 2 * 10, 28 + 3 * 10, 28 + 4 * 10,
+ 28 + 5 * 10, 28 + 6 * 10, 28 + 7 * 10, /* ... %st(7). */
+ 0, /* `fctrl' (16 bits). */
+ 4, /* `fstat' (16 bits). */
+ 8, /* `ftag' (16 bits). */
+ 16, /* `fiseg' (16 bits). */
+ 12, /* `fioff'. */
+ 24, /* `foseg' (16 bits). */
+ 20, /* `fooff'. */
+ 18 /* `fop' (bottom 11 bits). */
};
#define FSAVE_ADDR(tdep, fsave, regnum) \
(fsave + fsave_offset[regnum - I387_ST0_REGNUM (tdep)])
-
/* Fill register REGNUM in REGCACHE with the appropriate value from
*FSAVE. This function masks off any of the reserved bits in
@@ -458,8 +443,8 @@ i387_supply_fsave (struct regcache *regcache, int regnum, const void *fsave)
/* Most of the FPU control registers occupy only 16 bits in the
fsave area. Give those a special treatment. */
- if (i >= I387_FCTRL_REGNUM (tdep)
- && i != I387_FIOFF_REGNUM (tdep) && i != I387_FOOFF_REGNUM (tdep))
+ if (i >= I387_FCTRL_REGNUM (tdep) && i != I387_FIOFF_REGNUM (tdep)
+ && i != I387_FOOFF_REGNUM (tdep))
{
gdb_byte val[4];
@@ -506,8 +491,8 @@ i387_collect_fsave (const struct regcache *regcache, int regnum, void *fsave)
{
/* Most of the FPU control registers occupy only 16 bits in
the fsave area. Give those a special treatment. */
- if (i >= I387_FCTRL_REGNUM (tdep)
- && i != I387_FIOFF_REGNUM (tdep) && i != I387_FOOFF_REGNUM (tdep))
+ if (i >= I387_FCTRL_REGNUM (tdep) && i != I387_FIOFF_REGNUM (tdep)
+ && i != I387_FOOFF_REGNUM (tdep))
{
gdb_byte buf[4];
@@ -526,31 +511,29 @@ i387_collect_fsave (const struct regcache *regcache, int regnum, void *fsave)
regcache->raw_collect (i, FSAVE_ADDR (tdep, regs, i));
}
}
-
/* At fxsave_offset[REGNUM] you'll find the offset to the location in
the data structure used by the "fxsave" instruction where GDB
register REGNUM is stored. */
-static int fxsave_offset[] =
-{
- 32, /* %st(0) through ... */
+static int fxsave_offset[] = {
+ 32, /* %st(0) through ... */
48,
64,
80,
96,
112,
128,
- 144, /* ... %st(7) (80 bits each). */
- 0, /* `fctrl' (16 bits). */
- 2, /* `fstat' (16 bits). */
- 4, /* `ftag' (16 bits). */
- 12, /* `fiseg' (16 bits). */
- 8, /* `fioff'. */
- 20, /* `foseg' (16 bits). */
- 16, /* `fooff'. */
- 6, /* `fop' (bottom 11 bits). */
- 160 + 0 * 16, /* %xmm0 through ... */
+ 144, /* ... %st(7) (80 bits each). */
+ 0, /* `fctrl' (16 bits). */
+ 2, /* `fstat' (16 bits). */
+ 4, /* `ftag' (16 bits). */
+ 12, /* `fiseg' (16 bits). */
+ 8, /* `fioff'. */
+ 20, /* `foseg' (16 bits). */
+ 16, /* `fooff'. */
+ 6, /* `fop' (bottom 11 bits). */
+ 160 + 0 * 16, /* %xmm0 through ... */
160 + 1 * 16,
160 + 2 * 16,
160 + 3 * 16,
@@ -565,7 +548,7 @@ static int fxsave_offset[] =
160 + 12 * 16,
160 + 13 * 16,
160 + 14 * 16,
- 160 + 15 * 16, /* ... %xmm15 (128 bits each). */
+ 160 + 15 * 16, /* ... %xmm15 (128 bits each). */
};
#define FXSAVE_ADDR(tdep, fxsave, regnum) \
@@ -579,7 +562,6 @@ static int fxsave_offset[] =
#define FXSAVE_MXCSR_ADDR(fxsave) (fxsave + 24)
static int i387_tag (const gdb_byte *raw);
-
/* Fill register REGNUM in REGCACHE with the appropriate
floating-point or SSE register value from *FXSAVE. This function
@@ -616,7 +598,7 @@ i387_supply_fxsave (struct regcache *regcache, int regnum, const void *fxsave)
val[2] = val[3] = 0;
if (i == I387_FOP_REGNUM (tdep))
val[1] &= ((1 << 3) - 1);
- else if (i== I387_FTAG_REGNUM (tdep))
+ else if (i == I387_FTAG_REGNUM (tdep))
{
/* The fxsave area contains a simplified version of
the tag word. We have to look at the actual 80-bit
@@ -626,8 +608,8 @@ i387_supply_fxsave (struct regcache *regcache, int regnum, const void *fxsave)
int fpreg;
int top;
- top = ((FXSAVE_ADDR (tdep, regs,
- I387_FSTAT_REGNUM (tdep)))[1] >> 3);
+ top = ((FXSAVE_ADDR (tdep, regs, I387_FSTAT_REGNUM (tdep)))[1]
+ >> 3);
top &= 0x7;
for (fpreg = 7; fpreg >= 0; fpreg--)
@@ -636,12 +618,12 @@ i387_supply_fxsave (struct regcache *regcache, int regnum, const void *fxsave)
if (val[0] & (1 << fpreg))
{
- int thisreg = (fpreg + 8 - top) % 8
- + I387_ST0_REGNUM (tdep);
+ int thisreg
+ = (fpreg + 8 - top) % 8 + I387_ST0_REGNUM (tdep);
tag = i387_tag (FXSAVE_ADDR (tdep, regs, thisreg));
}
else
- tag = 3; /* Empty */
+ tag = 3; /* Empty */
ftag |= tag << (2 * fpreg);
}
@@ -660,7 +642,7 @@ i387_supply_fxsave (struct regcache *regcache, int regnum, const void *fxsave)
regcache->raw_supply (I387_MXCSR_REGNUM (tdep), NULL);
else
regcache->raw_supply (I387_MXCSR_REGNUM (tdep),
- FXSAVE_MXCSR_ADDR (regs));
+ FXSAVE_MXCSR_ADDR (regs));
}
}
@@ -725,8 +707,7 @@ i387_collect_fxsave (const struct regcache *regcache, int regnum, void *fxsave)
}
if (regnum == I387_MXCSR_REGNUM (tdep) || regnum == -1)
- regcache->raw_collect (I387_MXCSR_REGNUM (tdep),
- FXSAVE_MXCSR_ADDR (regs));
+ regcache->raw_collect (I387_MXCSR_REGNUM (tdep), FXSAVE_MXCSR_ADDR (regs));
}
/* `xstate_bv' is at byte offset 512. */
@@ -736,24 +717,12 @@ i387_collect_fxsave (const struct regcache *regcache, int regnum, void *fxsave)
the upper 128bit of AVX register data structure used by the "xsave"
instruction where GDB register REGNUM is stored. */
-static int xsave_avxh_offset[] =
-{
- 576 + 0 * 16, /* Upper 128bit of %ymm0 through ... */
- 576 + 1 * 16,
- 576 + 2 * 16,
- 576 + 3 * 16,
- 576 + 4 * 16,
- 576 + 5 * 16,
- 576 + 6 * 16,
- 576 + 7 * 16,
- 576 + 8 * 16,
- 576 + 9 * 16,
- 576 + 10 * 16,
- 576 + 11 * 16,
- 576 + 12 * 16,
- 576 + 13 * 16,
- 576 + 14 * 16,
- 576 + 15 * 16 /* Upper 128bit of ... %ymm15 (128 bits each). */
+static int xsave_avxh_offset[] = {
+ 576 + 0 * 16, /* Upper 128bit of %ymm0 through ... */
+ 576 + 1 * 16, 576 + 2 * 16, 576 + 3 * 16, 576 + 4 * 16,
+ 576 + 5 * 16, 576 + 6 * 16, 576 + 7 * 16, 576 + 8 * 16,
+ 576 + 9 * 16, 576 + 10 * 16, 576 + 11 * 16, 576 + 12 * 16,
+ 576 + 13 * 16, 576 + 14 * 16, 576 + 15 * 16 /* Upper 128bit of ... %ymm15 (128 bits each). */
};
#define XSAVE_AVXH_ADDR(tdep, xsave, regnum) \
@@ -763,79 +732,51 @@ static int xsave_avxh_offset[] =
the upper 128bit of ZMM register data structure used by the "xsave"
instruction where GDB register REGNUM is stored. */
-static int xsave_ymm_avx512_offset[] =
-{
+static int xsave_ymm_avx512_offset[] = {
/* HI16_ZMM_area + 16 bytes + regnum* 64 bytes. */
- 1664 + 16 + 0 * 64, /* %ymm16 through... */
- 1664 + 16 + 1 * 64,
- 1664 + 16 + 2 * 64,
- 1664 + 16 + 3 * 64,
- 1664 + 16 + 4 * 64,
- 1664 + 16 + 5 * 64,
- 1664 + 16 + 6 * 64,
- 1664 + 16 + 7 * 64,
- 1664 + 16 + 8 * 64,
- 1664 + 16 + 9 * 64,
- 1664 + 16 + 10 * 64,
- 1664 + 16 + 11 * 64,
- 1664 + 16 + 12 * 64,
- 1664 + 16 + 13 * 64,
- 1664 + 16 + 14 * 64,
- 1664 + 16 + 15 * 64 /* ... %ymm31 (128 bits each). */
+ 1664 + 16 + 0 * 64, /* %ymm16 through... */
+ 1664 + 16 + 1 * 64, 1664 + 16 + 2 * 64,
+ 1664 + 16 + 3 * 64, 1664 + 16 + 4 * 64,
+ 1664 + 16 + 5 * 64, 1664 + 16 + 6 * 64,
+ 1664 + 16 + 7 * 64, 1664 + 16 + 8 * 64,
+ 1664 + 16 + 9 * 64, 1664 + 16 + 10 * 64,
+ 1664 + 16 + 11 * 64, 1664 + 16 + 12 * 64,
+ 1664 + 16 + 13 * 64, 1664 + 16 + 14 * 64,
+ 1664 + 16 + 15 * 64 /* ... %ymm31 (128 bits each). */
};
#define XSAVE_YMM_AVX512_ADDR(tdep, xsave, regnum) \
(xsave + xsave_ymm_avx512_offset[regnum - I387_YMM16H_REGNUM (tdep)])
-static int xsave_xmm_avx512_offset[] =
-{
- 1664 + 0 * 64, /* %ymm16 through... */
- 1664 + 1 * 64,
- 1664 + 2 * 64,
- 1664 + 3 * 64,
- 1664 + 4 * 64,
- 1664 + 5 * 64,
- 1664 + 6 * 64,
- 1664 + 7 * 64,
- 1664 + 8 * 64,
- 1664 + 9 * 64,
- 1664 + 10 * 64,
- 1664 + 11 * 64,
- 1664 + 12 * 64,
- 1664 + 13 * 64,
- 1664 + 14 * 64,
- 1664 + 15 * 64 /* ... %ymm31 (128 bits each). */
+static int xsave_xmm_avx512_offset[] = {
+ 1664 + 0 * 64, /* %ymm16 through... */
+ 1664 + 1 * 64, 1664 + 2 * 64, 1664 + 3 * 64, 1664 + 4 * 64,
+ 1664 + 5 * 64, 1664 + 6 * 64, 1664 + 7 * 64, 1664 + 8 * 64,
+ 1664 + 9 * 64, 1664 + 10 * 64, 1664 + 11 * 64, 1664 + 12 * 64,
+ 1664 + 13 * 64, 1664 + 14 * 64, 1664 + 15 * 64 /* ... %ymm31 (128 bits each). */
};
#define XSAVE_XMM_AVX512_ADDR(tdep, xsave, regnum) \
(xsave + xsave_xmm_avx512_offset[regnum - I387_XMM16_REGNUM (tdep)])
static int xsave_mpx_offset[] = {
- 960 + 0 * 16, /* bnd0r...bnd3r registers. */
- 960 + 1 * 16,
- 960 + 2 * 16,
- 960 + 3 * 16,
- 1024 + 0 * 8, /* bndcfg ... bndstatus. */
+ 960 + 0 * 16, /* bnd0r...bnd3r registers. */
+ 960 + 1 * 16, 960 + 2 * 16,
+ 960 + 3 * 16, 1024 + 0 * 8, /* bndcfg ... bndstatus. */
1024 + 1 * 8,
};
#define XSAVE_MPX_ADDR(tdep, xsave, regnum) \
(xsave + xsave_mpx_offset[regnum - I387_BND0R_REGNUM (tdep)])
- /* At xsave_avx512__h_offset[REGNUM] you find the offset to the location
+/* At xsave_avx512__h_offset[REGNUM] you find the offset to the location
of the AVX512 opmask register data structure used by the "xsave"
instruction where GDB register REGNUM is stored. */
-static int xsave_avx512_k_offset[] =
-{
- 1088 + 0 * 8, /* %k0 through... */
- 1088 + 1 * 8,
- 1088 + 2 * 8,
- 1088 + 3 * 8,
- 1088 + 4 * 8,
- 1088 + 5 * 8,
- 1088 + 6 * 8,
- 1088 + 7 * 8 /* %k7 (64 bits each). */
+static int xsave_avx512_k_offset[] = {
+ 1088 + 0 * 8, /* %k0 through... */
+ 1088 + 1 * 8, 1088 + 2 * 8, 1088 + 3 * 8, 1088 + 4 * 8,
+ 1088 + 5 * 8, 1088 + 6 * 8, 1088 + 7 * 8 /* %k7 (64 bits each). */
};
#define XSAVE_AVX512_K_ADDR(tdep, xsave, regnum) \
@@ -845,10 +786,9 @@ static int xsave_avx512_k_offset[] =
the upper 256bit of AVX512 ZMMH register data structure used by the "xsave"
instruction where GDB register REGNUM is stored. */
-static int xsave_avx512_zmm_h_offset[] =
-{
+static int xsave_avx512_zmm_h_offset[] = {
1152 + 0 * 32,
- 1152 + 1 * 32, /* Upper 256bit of %zmmh0 through... */
+ 1152 + 1 * 32, /* Upper 256bit of %zmmh0 through... */
1152 + 2 * 32,
1152 + 3 * 32,
1152 + 4 * 32,
@@ -862,8 +802,8 @@ static int xsave_avx512_zmm_h_offset[] =
1152 + 12 * 32,
1152 + 13 * 32,
1152 + 14 * 32,
- 1152 + 15 * 32, /* Upper 256bit of... %zmmh15 (256 bits each). */
- 1664 + 32 + 0 * 64, /* Upper 256bit of... %zmmh16 (256 bits each). */
+ 1152 + 15 * 32, /* Upper 256bit of... %zmmh15 (256 bits each). */
+ 1664 + 32 + 0 * 64, /* Upper 256bit of... %zmmh16 (256 bits each). */
1664 + 32 + 1 * 64,
1664 + 32 + 2 * 64,
1664 + 32 + 3 * 64,
@@ -878,7 +818,7 @@ static int xsave_avx512_zmm_h_offset[] =
1664 + 32 + 12 * 64,
1664 + 32 + 13 * 64,
1664 + 32 + 14 * 64,
- 1664 + 32 + 15 * 64 /* Upper 256bit of... %zmmh31 (256 bits each). */
+ 1664 + 32 + 15 * 64 /* Upper 256bit of... %zmmh31 (256 bits each). */
};
#define XSAVE_AVX512_ZMM_H_ADDR(tdep, xsave, regnum) \
@@ -888,16 +828,14 @@ static int xsave_avx512_zmm_h_offset[] =
of the PKRU register data structure used by the "xsave"
instruction where GDB register REGNUM is stored. */
-static int xsave_pkeys_offset[] =
-{
-2688 + 0 * 8 /* %pkru (64 bits in XSTATE, 32-bit actually used by
+static int xsave_pkeys_offset[] = {
+ 2688 + 0 * 8 /* %pkru (64 bits in XSTATE, 32-bit actually used by
instructions and applications). */
};
#define XSAVE_PKEYS_ADDR(tdep, xsave, regnum) \
(xsave + xsave_pkeys_offset[regnum - I387_PKRU_REGNUM (tdep)])
-
/* Extract from XSAVE a bitset of the features that are available on the
target, but which have not yet been enabled. */
@@ -909,8 +847,8 @@ i387_xsave_get_clear_bv (struct gdbarch *gdbarch, const void *xsave)
i386_gdbarch_tdep *tdep = gdbarch_tdep<i386_gdbarch_tdep> (gdbarch);
/* Get `xstat_bv'. The supported bits in `xstat_bv' are 8 bytes. */
- ULONGEST xstate_bv = extract_unsigned_integer (XSAVE_XSTATE_BV_ADDR (regs),
- 8, byte_order);
+ ULONGEST xstate_bv
+ = extract_unsigned_integer (XSAVE_XSTATE_BV_ADDR (regs), 8, byte_order);
/* Clear part in vector registers if its bit in xstat_bv is zero. */
ULONGEST clear_bv = (~(xstate_bv)) & tdep->xcr0;
@@ -921,8 +859,7 @@ i387_xsave_get_clear_bv (struct gdbarch *gdbarch, const void *xsave)
/* Similar to i387_supply_fxsave, but use XSAVE extended state. */
void
-i387_supply_xsave (struct regcache *regcache, int regnum,
- const void *xsave)
+i387_supply_xsave (struct regcache *regcache, int regnum, const void *xsave)
{
struct gdbarch *gdbarch = regcache->arch ();
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
@@ -933,25 +870,26 @@ i387_supply_xsave (struct regcache *regcache, int regnum,
ZMM16. Outside of 64-bit mode there are no "high" ZMM registers at all.
Precalculate the number to be used for the split point, with the all
registers in the "low" portion outside of 64-bit mode. */
- unsigned int zmm_endlo_regnum = I387_ZMM0H_REGNUM (tdep)
- + std::min (tdep->num_zmm_regs, 16);
+ unsigned int zmm_endlo_regnum
+ = I387_ZMM0H_REGNUM (tdep) + std::min (tdep->num_zmm_regs, 16);
ULONGEST clear_bv;
static const gdb_byte zero[I386_MAX_REGISTER_SIZE] = { 0 };
+
enum
- {
- none = 0x0,
- x87 = 0x1,
- sse = 0x2,
- avxh = 0x4,
- mpx = 0x8,
- avx512_k = 0x10,
- avx512_zmm_h = 0x20,
- avx512_ymmh_avx512 = 0x40,
- avx512_xmm_avx512 = 0x80,
- pkeys = 0x100,
- all = x87 | sse | avxh | mpx | avx512_k | avx512_zmm_h
- | avx512_ymmh_avx512 | avx512_xmm_avx512 | pkeys
- } regclass;
+ {
+ none = 0x0,
+ x87 = 0x1,
+ sse = 0x2,
+ avxh = 0x4,
+ mpx = 0x8,
+ avx512_k = 0x10,
+ avx512_zmm_h = 0x20,
+ avx512_ymmh_avx512 = 0x40,
+ avx512_xmm_avx512 = 0x80,
+ pkeys = 0x100,
+ all = x87 | sse | avxh | mpx | avx512_k | avx512_zmm_h | avx512_ymmh_avx512
+ | avx512_xmm_avx512 | pkeys
+ } regclass;
gdb_assert (regs != NULL);
gdb_assert (tdep->st0_regnum >= I386_ST0_REGNUM);
@@ -965,8 +903,7 @@ i387_supply_xsave (struct regcache *regcache, int regnum,
else if (regnum >= I387_ZMM0H_REGNUM (tdep)
&& regnum < I387_ZMMENDH_REGNUM (tdep))
regclass = avx512_zmm_h;
- else if (regnum >= I387_K0_REGNUM (tdep)
- && regnum < I387_KEND_REGNUM (tdep))
+ else if (regnum >= I387_K0_REGNUM (tdep) && regnum < I387_KEND_REGNUM (tdep))
regclass = avx512_k;
else if (regnum >= I387_YMM16H_REGNUM (tdep)
&& regnum < I387_YMMH_AVX512_END_REGNUM (tdep))
@@ -1013,8 +950,8 @@ i387_supply_xsave (struct regcache *regcache, int regnum,
return;
case avx512_zmm_h:
- if ((clear_bv & (regnum < zmm_endlo_regnum ? X86_XSTATE_ZMM_H
- : X86_XSTATE_ZMM)))
+ if ((clear_bv
+ & (regnum < zmm_endlo_regnum ? X86_XSTATE_ZMM_H : X86_XSTATE_ZMM)))
regcache->raw_supply (regnum, zero);
else
regcache->raw_supply (regnum,
@@ -1025,7 +962,8 @@ i387_supply_xsave (struct regcache *regcache, int regnum,
if ((clear_bv & X86_XSTATE_K))
regcache->raw_supply (regnum, zero);
else
- regcache->raw_supply (regnum, XSAVE_AVX512_K_ADDR (tdep, regs, regnum));
+ regcache->raw_supply (regnum,
+ XSAVE_AVX512_K_ADDR (tdep, regs, regnum));
return;
case avx512_ymmh_avx512:
@@ -1079,15 +1017,13 @@ i387_supply_xsave (struct regcache *regcache, int regnum,
if ((clear_bv & X86_XSTATE_PKRU))
{
for (i = I387_PKRU_REGNUM (tdep);
- i < I387_PKEYSEND_REGNUM (tdep);
- i++)
+ i < I387_PKEYSEND_REGNUM (tdep); i++)
regcache->raw_supply (i, zero);
}
else
{
for (i = I387_PKRU_REGNUM (tdep);
- i < I387_PKEYSEND_REGNUM (tdep);
- i++)
+ i < I387_PKEYSEND_REGNUM (tdep); i++)
regcache->raw_supply (i, XSAVE_PKEYS_ADDR (tdep, regs, i));
}
}
@@ -1113,16 +1049,12 @@ i387_supply_xsave (struct regcache *regcache, int regnum,
{
if ((clear_bv & X86_XSTATE_K))
{
- for (i = I387_K0_REGNUM (tdep);
- i < I387_KEND_REGNUM (tdep);
- i++)
+ for (i = I387_K0_REGNUM (tdep); i < I387_KEND_REGNUM (tdep); i++)
regcache->raw_supply (i, zero);
}
else
{
- for (i = I387_K0_REGNUM (tdep);
- i < I387_KEND_REGNUM (tdep);
- i++)
+ for (i = I387_K0_REGNUM (tdep); i < I387_KEND_REGNUM (tdep); i++)
regcache->raw_supply (i, XSAVE_AVX512_K_ADDR (tdep, regs, i));
}
}
@@ -1135,12 +1067,10 @@ i387_supply_xsave (struct regcache *regcache, int regnum,
for (i = zmm_endlo_regnum; i < I387_ZMMENDH_REGNUM (tdep); i++)
regcache->raw_supply (i, zero);
for (i = I387_YMM16H_REGNUM (tdep);
- i < I387_YMMH_AVX512_END_REGNUM (tdep);
- i++)
+ i < I387_YMMH_AVX512_END_REGNUM (tdep); i++)
regcache->raw_supply (i, zero);
for (i = I387_XMM16_REGNUM (tdep);
- i < I387_XMM_AVX512_END_REGNUM (tdep);
- i++)
+ i < I387_XMM_AVX512_END_REGNUM (tdep); i++)
regcache->raw_supply (i, zero);
}
else
@@ -1149,13 +1079,13 @@ i387_supply_xsave (struct regcache *regcache, int regnum,
regcache->raw_supply (i,
XSAVE_AVX512_ZMM_H_ADDR (tdep, regs, i));
for (i = I387_YMM16H_REGNUM (tdep);
- i < I387_YMMH_AVX512_END_REGNUM (tdep);
- i++)
- regcache->raw_supply (i, XSAVE_YMM_AVX512_ADDR (tdep, regs, i));
+ i < I387_YMMH_AVX512_END_REGNUM (tdep); i++)
+ regcache->raw_supply (i,
+ XSAVE_YMM_AVX512_ADDR (tdep, regs, i));
for (i = I387_XMM16_REGNUM (tdep);
- i < I387_XMM_AVX512_END_REGNUM (tdep);
- i++)
- regcache->raw_supply (i, XSAVE_XMM_AVX512_ADDR (tdep, regs, i));
+ i < I387_XMM_AVX512_END_REGNUM (tdep); i++)
+ regcache->raw_supply (i,
+ XSAVE_XMM_AVX512_ADDR (tdep, regs, i));
}
}
/* Handle the upper YMM registers. */
@@ -1164,15 +1094,13 @@ i387_supply_xsave (struct regcache *regcache, int regnum,
if ((clear_bv & X86_XSTATE_AVX))
{
for (i = I387_YMM0H_REGNUM (tdep);
- i < I387_YMMENDH_REGNUM (tdep);
- i++)
+ i < I387_YMMENDH_REGNUM (tdep); i++)
regcache->raw_supply (i, zero);
}
else
{
for (i = I387_YMM0H_REGNUM (tdep);
- i < I387_YMMENDH_REGNUM (tdep);
- i++)
+ i < I387_YMMENDH_REGNUM (tdep); i++)
regcache->raw_supply (i, XSAVE_AVXH_ADDR (tdep, regs, i));
}
}
@@ -1216,15 +1144,14 @@ i387_supply_xsave (struct regcache *regcache, int regnum,
{
if ((clear_bv & X86_XSTATE_SSE))
{
- for (i = I387_XMM0_REGNUM (tdep);
- i < I387_MXCSR_REGNUM (tdep);
+ for (i = I387_XMM0_REGNUM (tdep); i < I387_MXCSR_REGNUM (tdep);
i++)
regcache->raw_supply (i, zero);
}
else
{
- for (i = I387_XMM0_REGNUM (tdep);
- i < I387_MXCSR_REGNUM (tdep); i++)
+ for (i = I387_XMM0_REGNUM (tdep); i < I387_MXCSR_REGNUM (tdep);
+ i++)
regcache->raw_supply (i, FXSAVE_ADDR (tdep, regs, i));
}
}
@@ -1234,15 +1161,13 @@ i387_supply_xsave (struct regcache *regcache, int regnum,
{
if ((clear_bv & X86_XSTATE_X87))
{
- for (i = I387_ST0_REGNUM (tdep);
- i < I387_FCTRL_REGNUM (tdep);
+ for (i = I387_ST0_REGNUM (tdep); i < I387_FCTRL_REGNUM (tdep);
i++)
regcache->raw_supply (i, zero);
}
else
{
- for (i = I387_ST0_REGNUM (tdep);
- i < I387_FCTRL_REGNUM (tdep);
+ for (i = I387_ST0_REGNUM (tdep); i < I387_FCTRL_REGNUM (tdep);
i++)
regcache->raw_supply (i, FXSAVE_ADDR (tdep, regs, i));
}
@@ -1295,8 +1220,8 @@ i387_supply_xsave (struct regcache *regcache, int regnum,
int fpreg;
int top;
- top = ((FXSAVE_ADDR (tdep, regs,
- I387_FSTAT_REGNUM (tdep)))[1] >> 3);
+ top = ((FXSAVE_ADDR (tdep, regs, I387_FSTAT_REGNUM (tdep)))[1]
+ >> 3);
top &= 0x7;
for (fpreg = 7; fpreg >= 0; fpreg--)
@@ -1305,12 +1230,12 @@ i387_supply_xsave (struct regcache *regcache, int regnum,
if (val[0] & (1 << fpreg))
{
- int thisreg = (fpreg + 8 - top) % 8
- + I387_ST0_REGNUM (tdep);
+ int thisreg
+ = (fpreg + 8 - top) % 8 + I387_ST0_REGNUM (tdep);
tag = i387_tag (FXSAVE_ADDR (tdep, regs, thisreg));
}
else
- tag = 3; /* Empty */
+ tag = 3; /* Empty */
ftag |= tag << (2 * fpreg);
}
@@ -1344,8 +1269,8 @@ i387_supply_xsave (struct regcache *regcache, int regnum,
/* Similar to i387_collect_fxsave, but use XSAVE extended state. */
void
-i387_collect_xsave (const struct regcache *regcache, int regnum,
- void *xsave, int gcore)
+i387_collect_xsave (const struct regcache *regcache, int regnum, void *xsave,
+ int gcore)
{
struct gdbarch *gdbarch = regcache->arch ();
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
@@ -1355,23 +1280,24 @@ i387_collect_xsave (const struct regcache *regcache, int regnum,
ULONGEST initial_xstate_bv, clear_bv, xstate_bv = 0;
unsigned int i;
/* See the comment in i387_supply_xsave(). */
- unsigned int zmm_endlo_regnum = I387_ZMM0H_REGNUM (tdep)
- + std::min (tdep->num_zmm_regs, 16);
+ unsigned int zmm_endlo_regnum
+ = I387_ZMM0H_REGNUM (tdep) + std::min (tdep->num_zmm_regs, 16);
+
enum
- {
- x87_ctrl_or_mxcsr = 0x1,
- x87 = 0x2,
- sse = 0x4,
- avxh = 0x8,
- mpx = 0x10,
- avx512_k = 0x20,
- avx512_zmm_h = 0x40,
- avx512_ymmh_avx512 = 0x80,
- avx512_xmm_avx512 = 0x100,
- pkeys = 0x200,
- all = x87 | sse | avxh | mpx | avx512_k | avx512_zmm_h
- | avx512_ymmh_avx512 | avx512_xmm_avx512 | pkeys
- } regclass;
+ {
+ x87_ctrl_or_mxcsr = 0x1,
+ x87 = 0x2,
+ sse = 0x4,
+ avxh = 0x8,
+ mpx = 0x10,
+ avx512_k = 0x20,
+ avx512_zmm_h = 0x40,
+ avx512_ymmh_avx512 = 0x80,
+ avx512_xmm_avx512 = 0x100,
+ pkeys = 0x200,
+ all = x87 | sse | avxh | mpx | avx512_k | avx512_zmm_h | avx512_ymmh_avx512
+ | avx512_xmm_avx512 | pkeys
+ } regclass;
gdb_assert (tdep->st0_regnum >= I386_ST0_REGNUM);
gdb_assert (tdep->num_xmm_regs > 0);
@@ -1384,8 +1310,7 @@ i387_collect_xsave (const struct regcache *regcache, int regnum,
else if (regnum >= I387_ZMM0H_REGNUM (tdep)
&& regnum < I387_ZMMENDH_REGNUM (tdep))
regclass = avx512_zmm_h;
- else if (regnum >= I387_K0_REGNUM (tdep)
- && regnum < I387_KEND_REGNUM (tdep))
+ else if (regnum >= I387_K0_REGNUM (tdep) && regnum < I387_KEND_REGNUM (tdep))
regclass = avx512_k;
else if (regnum >= I387_YMM16H_REGNUM (tdep)
&& regnum < I387_YMMH_AVX512_END_REGNUM (tdep))
@@ -1410,7 +1335,7 @@ i387_collect_xsave (const struct regcache *regcache, int regnum,
|| regnum == I387_MXCSR_REGNUM (tdep))
regclass = x87_ctrl_or_mxcsr;
else
- internal_error (_("invalid i387 regnum %d"), regnum);
+ internal_error (_ ("invalid i387 regnum %d"), regnum);
if (gcore)
{
@@ -1424,8 +1349,8 @@ i387_collect_xsave (const struct regcache *regcache, int regnum,
}
/* The supported bits in `xstat_bv' are 8 bytes. */
- initial_xstate_bv = extract_unsigned_integer (XSAVE_XSTATE_BV_ADDR (regs),
- 8, byte_order);
+ initial_xstate_bv
+ = extract_unsigned_integer (XSAVE_XSTATE_BV_ADDR (regs), 8, byte_order);
clear_bv = (~(initial_xstate_bv)) & tdep->xcr0;
/* The XSAVE buffer was filled lazily by the kernel. Only those
@@ -1443,18 +1368,16 @@ i387_collect_xsave (const struct regcache *regcache, int regnum,
if (clear_bv)
{
if ((clear_bv & X86_XSTATE_PKRU))
- for (i = I387_PKRU_REGNUM (tdep);
- i < I387_PKEYSEND_REGNUM (tdep); i++)
+ for (i = I387_PKRU_REGNUM (tdep); i < I387_PKEYSEND_REGNUM (tdep); i++)
memset (XSAVE_PKEYS_ADDR (tdep, regs, i), 0, 4);
if ((clear_bv & X86_XSTATE_BNDREGS))
- for (i = I387_BND0R_REGNUM (tdep);
- i < I387_BNDCFGU_REGNUM (tdep); i++)
+ for (i = I387_BND0R_REGNUM (tdep); i < I387_BNDCFGU_REGNUM (tdep); i++)
memset (XSAVE_MPX_ADDR (tdep, regs, i), 0, 16);
if ((clear_bv & X86_XSTATE_BNDCFG))
- for (i = I387_BNDCFGU_REGNUM (tdep);
- i < I387_MPXEND_REGNUM (tdep); i++)
+ for (i = I387_BNDCFGU_REGNUM (tdep); i < I387_MPXEND_REGNUM (tdep);
+ i++)
memset (XSAVE_MPX_ADDR (tdep, regs, i), 0, 8);
if ((clear_bv & X86_XSTATE_ZMM_H))
@@ -1462,8 +1385,7 @@ i387_collect_xsave (const struct regcache *regcache, int regnum,
memset (XSAVE_AVX512_ZMM_H_ADDR (tdep, regs, i), 0, 32);
if ((clear_bv & X86_XSTATE_K))
- for (i = I387_K0_REGNUM (tdep);
- i < I387_KEND_REGNUM (tdep); i++)
+ for (i = I387_K0_REGNUM (tdep); i < I387_KEND_REGNUM (tdep); i++)
memset (XSAVE_AVX512_K_ADDR (tdep, regs, i), 0, 8);
if ((clear_bv & X86_XSTATE_ZMM))
@@ -1479,13 +1401,11 @@ i387_collect_xsave (const struct regcache *regcache, int regnum,
}
if ((clear_bv & X86_XSTATE_AVX))
- for (i = I387_YMM0H_REGNUM (tdep);
- i < I387_YMMENDH_REGNUM (tdep); i++)
+ for (i = I387_YMM0H_REGNUM (tdep); i < I387_YMMENDH_REGNUM (tdep); i++)
memset (XSAVE_AVXH_ADDR (tdep, regs, i), 0, 16);
if ((clear_bv & X86_XSTATE_SSE))
- for (i = I387_XMM0_REGNUM (tdep);
- i < I387_MXCSR_REGNUM (tdep); i++)
+ for (i = I387_XMM0_REGNUM (tdep); i < I387_MXCSR_REGNUM (tdep); i++)
memset (FXSAVE_ADDR (tdep, regs, i), 0, 16);
/* The mxcsr register is written into the xsave buffer if either AVX
@@ -1498,12 +1418,10 @@ i387_collect_xsave (const struct regcache *regcache, int regnum,
if ((clear_bv & X86_XSTATE_X87))
{
- for (i = I387_ST0_REGNUM (tdep);
- i < I387_FCTRL_REGNUM (tdep); i++)
+ for (i = I387_ST0_REGNUM (tdep); i < I387_FCTRL_REGNUM (tdep); i++)
memset (FXSAVE_ADDR (tdep, regs, i), 0, 10);
- for (i = I387_FCTRL_REGNUM (tdep);
- i < I387_XMM0_REGNUM (tdep); i++)
+ for (i = I387_FCTRL_REGNUM (tdep); i < I387_XMM0_REGNUM (tdep); i++)
{
if (i == I387_FCTRL_REGNUM (tdep))
store_unsigned_integer (FXSAVE_ADDR (tdep, regs, i), 2,
@@ -1519,8 +1437,7 @@ i387_collect_xsave (const struct regcache *regcache, int regnum,
{
/* Check if any PKEYS registers are changed. */
if ((tdep->xcr0 & X86_XSTATE_PKRU))
- for (i = I387_PKRU_REGNUM (tdep);
- i < I387_PKEYSEND_REGNUM (tdep); i++)
+ for (i = I387_PKRU_REGNUM (tdep); i < I387_PKEYSEND_REGNUM (tdep); i++)
{
regcache->raw_collect (i, raw);
p = XSAVE_PKEYS_ADDR (tdep, regs, i);
@@ -1533,8 +1450,7 @@ i387_collect_xsave (const struct regcache *regcache, int regnum,
/* Check if any ZMMH registers are changed. */
if ((tdep->xcr0 & (X86_XSTATE_ZMM_H | X86_XSTATE_ZMM)))
- for (i = I387_ZMM0H_REGNUM (tdep);
- i < I387_ZMMENDH_REGNUM (tdep); i++)
+ for (i = I387_ZMM0H_REGNUM (tdep); i < I387_ZMMENDH_REGNUM (tdep); i++)
{
regcache->raw_collect (i, raw);
p = XSAVE_AVX512_ZMM_H_ADDR (tdep, regs, i);
@@ -1547,8 +1463,7 @@ i387_collect_xsave (const struct regcache *regcache, int regnum,
/* Check if any K registers are changed. */
if ((tdep->xcr0 & X86_XSTATE_K))
- for (i = I387_K0_REGNUM (tdep);
- i < I387_KEND_REGNUM (tdep); i++)
+ for (i = I387_K0_REGNUM (tdep); i < I387_KEND_REGNUM (tdep); i++)
{
regcache->raw_collect (i, raw);
p = XSAVE_AVX512_K_ADDR (tdep, regs, i);
@@ -1588,8 +1503,7 @@ i387_collect_xsave (const struct regcache *regcache, int regnum,
/* Check if any upper MPX registers are changed. */
if ((tdep->xcr0 & X86_XSTATE_BNDREGS))
- for (i = I387_BND0R_REGNUM (tdep);
- i < I387_BNDCFGU_REGNUM (tdep); i++)
+ for (i = I387_BND0R_REGNUM (tdep); i < I387_BNDCFGU_REGNUM (tdep); i++)
{
regcache->raw_collect (i, raw);
p = XSAVE_MPX_ADDR (tdep, regs, i);
@@ -1602,8 +1516,8 @@ i387_collect_xsave (const struct regcache *regcache, int regnum,
/* Check if any upper MPX registers are changed. */
if ((tdep->xcr0 & X86_XSTATE_BNDCFG))
- for (i = I387_BNDCFGU_REGNUM (tdep);
- i < I387_MPXEND_REGNUM (tdep); i++)
+ for (i = I387_BNDCFGU_REGNUM (tdep); i < I387_MPXEND_REGNUM (tdep);
+ i++)
{
regcache->raw_collect (i, raw);
p = XSAVE_MPX_ADDR (tdep, regs, i);
@@ -1616,8 +1530,7 @@ i387_collect_xsave (const struct regcache *regcache, int regnum,
/* Check if any upper YMM registers are changed. */
if ((tdep->xcr0 & X86_XSTATE_AVX))
- for (i = I387_YMM0H_REGNUM (tdep);
- i < I387_YMMENDH_REGNUM (tdep); i++)
+ for (i = I387_YMM0H_REGNUM (tdep); i < I387_YMMENDH_REGNUM (tdep); i++)
{
regcache->raw_collect (i, raw);
p = XSAVE_AVXH_ADDR (tdep, regs, i);
@@ -1630,8 +1543,7 @@ i387_collect_xsave (const struct regcache *regcache, int regnum,
/* Check if any SSE registers are changed. */
if ((tdep->xcr0 & X86_XSTATE_SSE))
- for (i = I387_XMM0_REGNUM (tdep);
- i < I387_MXCSR_REGNUM (tdep); i++)
+ for (i = I387_XMM0_REGNUM (tdep); i < I387_MXCSR_REGNUM (tdep); i++)
{
regcache->raw_collect (i, raw);
p = FXSAVE_ADDR (tdep, regs, i);
@@ -1663,8 +1575,7 @@ i387_collect_xsave (const struct regcache *regcache, int regnum,
registers are handled here, the control registers are all handled
later on in this function. */
if ((tdep->xcr0 & X86_XSTATE_X87))
- for (i = I387_ST0_REGNUM (tdep);
- i < I387_FCTRL_REGNUM (tdep); i++)
+ for (i = I387_ST0_REGNUM (tdep); i < I387_FCTRL_REGNUM (tdep); i++)
{
regcache->raw_collect (i, raw);
p = FXSAVE_ADDR (tdep, regs, i);
@@ -1683,7 +1594,7 @@ i387_collect_xsave (const struct regcache *regcache, int regnum,
switch (regclass)
{
default:
- internal_error (_("invalid i387 regclass"));
+ internal_error (_ ("invalid i387 regclass"));
case pkeys:
/* This is a PKEYS register. */
@@ -1796,8 +1707,8 @@ i387_collect_xsave (const struct regcache *regcache, int regnum,
If they are then we'll attribute this changed MXCSR to
that feature. If neither feature is enabled, then
we'll attribute this change to the SSE feature. */
- xstate_bv |= (initial_xstate_bv
- & (X86_XSTATE_AVX | X86_XSTATE_SSE));
+ xstate_bv
+ |= (initial_xstate_bv & (X86_XSTATE_AVX | X86_XSTATE_SSE));
if ((xstate_bv & (X86_XSTATE_AVX | X86_XSTATE_SSE)) == 0)
xstate_bv |= X86_XSTATE_SSE;
memcpy (p, raw, 2);
@@ -1812,8 +1723,7 @@ i387_collect_xsave (const struct regcache *regcache, int regnum,
{
/* Most of the FPU control registers occupy only 16 bits in
the xsave extended state. Give those a special treatment. */
- if (i != I387_FIOFF_REGNUM (tdep)
- && i != I387_FOOFF_REGNUM (tdep))
+ if (i != I387_FIOFF_REGNUM (tdep) && i != I387_FOOFF_REGNUM (tdep))
{
gdb_byte buf[4];
@@ -1873,8 +1783,7 @@ i387_collect_xsave (const struct regcache *regcache, int regnum,
{
/* The supported bits in `xstat_bv' are 8 bytes. */
initial_xstate_bv |= xstate_bv;
- store_unsigned_integer (XSAVE_XSTATE_BV_ADDR (regs),
- 8, byte_order,
+ store_unsigned_integer (XSAVE_XSTATE_BV_ADDR (regs), 8, byte_order,
initial_xstate_bv);
}
}
@@ -1892,8 +1801,8 @@ i387_tag (const gdb_byte *raw)
integer = raw[7] & 0x80;
exponent = (((raw[9] & 0x7f) << 8) | raw[8]);
fraction[0] = ((raw[3] << 24) | (raw[2] << 16) | (raw[1] << 8) | raw[0]);
- fraction[1] = (((raw[7] & 0x7f) << 24) | (raw[6] << 16)
- | (raw[5] << 8) | raw[4]);
+ fraction[1]
+ = (((raw[7] & 0x7f) << 24) | (raw[6] << 16) | (raw[5] << 8) | raw[4]);
if (exponent == 0x7fff)
{
@@ -1948,7 +1857,6 @@ i387_return_value (struct gdbarch *gdbarch, struct regcache *regcache)
floating-point register stack to 7, the appropriate value for the
tag word is 0x3fff. */
regcache_raw_write_unsigned (regcache, I387_FTAG_REGNUM (tdep), 0x3fff);
-
}
/* See i387-tdep.h. */
diff --git a/gdb/i387-tdep.h b/gdb/i387-tdep.h
index 2e890e71a2b..24bf6fc3b76 100644
--- a/gdb/i387-tdep.h
+++ b/gdb/i387-tdep.h
@@ -27,7 +27,7 @@ struct type;
struct ui_file;
/* Number of i387 floating point registers. */
-#define I387_NUM_REGS 16
+#define I387_NUM_REGS 16
#define I387_ST0_REGNUM(tdep) ((tdep)->st0_regnum)
#define I387_NUM_XMM_REGS(tdep) ((tdep)->num_xmm_regs)
@@ -65,15 +65,13 @@ struct ui_file;
#define I387_XMM16_REGNUM(tdep) ((tdep)->xmm16_regnum)
#define I387_MXCSR_REGNUM(tdep) \
(I387_XMM0_REGNUM (tdep) + I387_NUM_XMM_REGS (tdep))
-#define I387_YMM0_REGNUM(tdep) (I387_MXCSR_REGNUM(tdep) + 1)
+#define I387_YMM0_REGNUM(tdep) (I387_MXCSR_REGNUM (tdep) + 1)
#define I387_YMMENDH_REGNUM(tdep) \
(I387_YMM0H_REGNUM (tdep) + I387_NUM_YMM_REGS (tdep))
-#define I387_MPXEND_REGNUM(tdep) \
- (I387_BND0R_REGNUM (tdep) + I387_NUM_MPX_REGS)
+#define I387_MPXEND_REGNUM(tdep) (I387_BND0R_REGNUM (tdep) + I387_NUM_MPX_REGS)
-#define I387_KEND_REGNUM(tdep) \
- (I387_K0_REGNUM (tdep) + I387_NUM_K_REGS)
+#define I387_KEND_REGNUM(tdep) (I387_K0_REGNUM (tdep) + I387_NUM_K_REGS)
#define I387_ZMMENDH_REGNUM(tdep) \
(I387_ZMM0H_REGNUM (tdep) + I387_NUM_ZMMH_REGS (tdep))
#define I387_YMMH_AVX512_END_REGNUM(tdep) \
@@ -87,8 +85,7 @@ struct ui_file;
/* Print out the i387 floating point state. */
extern void i387_print_float_info (struct gdbarch *gdbarch,
- struct ui_file *file,
- frame_info_ptr frame,
+ struct ui_file *file, frame_info_ptr frame,
const char *args);
/* Return nonzero if a value of type TYPE stored in register REGNUM
@@ -109,12 +106,11 @@ extern int i387_register_to_value (frame_info_ptr frame, int regnum,
extern void i387_value_to_register (frame_info_ptr frame, int regnum,
struct type *type, const gdb_byte *from);
-
/* Size of the memory area use by the 'fsave' and 'fxsave'
instructions. */
-#define I387_SIZEOF_FSAVE 108
-#define I387_SIZEOF_FXSAVE 512
+#define I387_SIZEOF_FSAVE 108
+#define I387_SIZEOF_FXSAVE 512
/* Fill register REGNUM in REGCACHE with the appropriate value from
*FSAVE. This function masks off any of the reserved bits in
@@ -153,8 +149,8 @@ extern void i387_collect_fxsave (const struct regcache *regcache, int regnum,
/* Similar to i387_collect_fxsave, but use XSAVE extended state. */
-extern void i387_collect_xsave (const struct regcache *regcache,
- int regnum, void *xsave, int gcore);
+extern void i387_collect_xsave (const struct regcache *regcache, int regnum,
+ void *xsave, int gcore);
/* Extract a bitset from XSAVE indicating which features are available in
the inferior, but not yet initialised. */
diff --git a/gdb/ia64-libunwind-tdep.c b/gdb/ia64-libunwind-tdep.c
index c3a61bc6e0b..8b7506acb3a 100644
--- a/gdb/ia64-libunwind-tdep.c
+++ b/gdb/ia64-libunwind-tdep.c
@@ -52,7 +52,7 @@
#define __LITTLE_ENDIAN 1234
#endif
#ifndef __BIG_ENDIAN
-#define __BIG_ENDIAN 4321
+#define __BIG_ENDIAN 4321
#endif
static int libunwind_initialized;
@@ -87,7 +87,6 @@ typedef unw_word_t (unw_find_dyn_list_p_ftype) (unw_addr_space_t,
unw_dyn_info_t *, void *);
static unw_find_dyn_list_p_ftype *unw_find_dyn_list_p;
-
struct libunwind_frame_cache
{
CORE_ADDR base;
@@ -103,26 +102,27 @@ struct libunwind_frame_cache
#ifndef LIBUNWIND_SO
/* Use the stable ABI major version number. `libunwind-ia64.so' is a link time
only library, not a runtime one. */
-#define LIBUNWIND_SO "libunwind-" STRINGIFY(UNW_TARGET) ".so.8"
+#define LIBUNWIND_SO "libunwind-" STRINGIFY (UNW_TARGET) ".so.8"
/* Provide also compatibility with older .so. The two APIs are compatible, .8
is only extended a bit, GDB does not use the extended API at all. */
-#define LIBUNWIND_SO_7 "libunwind-" STRINGIFY(UNW_TARGET) ".so.7"
+#define LIBUNWIND_SO_7 "libunwind-" STRINGIFY (UNW_TARGET) ".so.7"
#endif
-static const char *get_reg_name = STRINGIFY(UNW_OBJ(get_reg));
-static const char *get_fpreg_name = STRINGIFY(UNW_OBJ(get_fpreg));
-static const char *get_saveloc_name = STRINGIFY(UNW_OBJ(get_save_loc));
-static const char *is_signal_frame_name = STRINGIFY(UNW_OBJ(is_signal_frame));
-static const char *step_name = STRINGIFY(UNW_OBJ(step));
-static const char *init_remote_name = STRINGIFY(UNW_OBJ(init_remote));
+static const char *get_reg_name = STRINGIFY (UNW_OBJ (get_reg));
+static const char *get_fpreg_name = STRINGIFY (UNW_OBJ (get_fpreg));
+static const char *get_saveloc_name = STRINGIFY (UNW_OBJ (get_save_loc));
+static const char *is_signal_frame_name
+ = STRINGIFY (UNW_OBJ (is_signal_frame));
+static const char *step_name = STRINGIFY (UNW_OBJ (step));
+static const char *init_remote_name = STRINGIFY (UNW_OBJ (init_remote));
static const char *create_addr_space_name
- = STRINGIFY(UNW_OBJ(create_addr_space));
+ = STRINGIFY (UNW_OBJ (create_addr_space));
static const char *destroy_addr_space_name
- = STRINGIFY(UNW_OBJ(destroy_addr_space));
+ = STRINGIFY (UNW_OBJ (destroy_addr_space));
static const char *search_unwind_table_name
- = STRINGIFY(UNW_OBJ(search_unwind_table));
-static const char *find_dyn_list_name = STRINGIFY(UNW_OBJ(find_dyn_list));
+ = STRINGIFY (UNW_OBJ (search_unwind_table));
+static const char *find_dyn_list_name = STRINGIFY (UNW_OBJ (find_dyn_list));
static struct libunwind_descr *
libunwind_descr (struct gdbarch *gdbarch)
@@ -198,11 +198,10 @@ libunwind_frame_cache (frame_info_ptr this_frame, void **this_cache)
interface which will invoke libunwind's special logic. */
descr = libunwind_descr (gdbarch);
acc = (unw_accessors_t *) descr->accessors;
- as = unw_create_addr_space_p (acc,
- gdbarch_byte_order (gdbarch)
- == BFD_ENDIAN_BIG
- ? __BIG_ENDIAN
- : __LITTLE_ENDIAN);
+ as = unw_create_addr_space_p (acc,
+ gdbarch_byte_order (gdbarch) == BFD_ENDIAN_BIG
+ ? __BIG_ENDIAN
+ : __LITTLE_ENDIAN);
unw_init_remote_p (&cache->cursor, as, this_frame);
if (unw_step_p (&cache->cursor) < 0)
@@ -217,10 +216,10 @@ libunwind_frame_cache (frame_info_ptr this_frame, void **this_cache)
if (ret < 0)
{
unw_destroy_addr_space_p (as);
- error (_("Can't get libunwind sp register."));
+ error (_ ("Can't get libunwind sp register."));
}
- cache->base = (CORE_ADDR)fp;
+ cache->base = (CORE_ADDR) fp;
cache->as = as;
*this_cache = cache;
@@ -264,11 +263,10 @@ libunwind_frame_sniffer (const struct frame_unwind *self,
descr = libunwind_descr (gdbarch);
acc = (unw_accessors_t *) descr->accessors;
- as = unw_create_addr_space_p (acc,
- gdbarch_byte_order (gdbarch)
- == BFD_ENDIAN_BIG
- ? __BIG_ENDIAN
- : __LITTLE_ENDIAN);
+ as = unw_create_addr_space_p (acc,
+ gdbarch_byte_order (gdbarch) == BFD_ENDIAN_BIG
+ ? __BIG_ENDIAN
+ : __LITTLE_ENDIAN);
ret = unw_init_remote_p (&cursor, as, this_frame);
@@ -278,7 +276,6 @@ libunwind_frame_sniffer (const struct frame_unwind *self,
return 0;
}
-
/* Check to see if we have libunwind info by checking if we are in a
signal frame. If it doesn't return an error, we have libunwind info
and can use libunwind. */
@@ -295,19 +292,19 @@ void
libunwind_frame_this_id (frame_info_ptr this_frame, void **this_cache,
struct frame_id *this_id)
{
- struct libunwind_frame_cache *cache =
- libunwind_frame_cache (this_frame, this_cache);
+ struct libunwind_frame_cache *cache
+ = libunwind_frame_cache (this_frame, this_cache);
if (cache != NULL)
(*this_id) = frame_id_build (cache->base, cache->func_addr);
}
struct value *
-libunwind_frame_prev_register (frame_info_ptr this_frame,
- void **this_cache, int regnum)
+libunwind_frame_prev_register (frame_info_ptr this_frame, void **this_cache,
+ int regnum)
{
- struct libunwind_frame_cache *cache =
- libunwind_frame_cache (this_frame, this_cache);
+ struct libunwind_frame_cache *cache
+ = libunwind_frame_cache (this_frame, this_cache);
unw_save_loc_t sl;
int ret;
@@ -319,7 +316,7 @@ libunwind_frame_prev_register (frame_info_ptr this_frame,
if (cache == NULL)
return frame_unwind_got_constant (this_frame, regnum, 0);
-
+
/* Convert from gdb register number to libunwind register number. */
descr = libunwind_descr (get_frame_arch (this_frame));
uw_regnum = descr->gdb2uw (regnum);
@@ -327,7 +324,7 @@ libunwind_frame_prev_register (frame_info_ptr this_frame,
gdb_assert (regnum >= 0);
if (!target_has_registers ())
- error (_("No registers."));
+ error (_ ("No registers."));
if (uw_regnum < 0)
return frame_unwind_got_constant (this_frame, regnum, 0);
@@ -370,13 +367,13 @@ libunwind_frame_prev_register (frame_info_ptr this_frame,
}
return val;
-}
+}
/* The following is a glue routine to call the libunwind unwind table
- search function to get unwind information for a specified ip address. */
+ search function to get unwind information for a specified ip address. */
int
-libunwind_search_unwind_table (void *as, long ip, void *di,
- void *pi, int need_unwind_info, void *args)
+libunwind_search_unwind_table (void *as, long ip, void *di, void *pi,
+ int need_unwind_info, void *args)
{
return unw_search_unwind_table_p (*(unw_addr_space_t *) as, (unw_word_t) ip,
(unw_dyn_info_t *) di,
@@ -387,8 +384,7 @@ libunwind_search_unwind_table (void *as, long ip, void *di,
/* Verify if we are in a sigtramp frame and we can use libunwind to unwind. */
int
libunwind_sigtramp_frame_sniffer (const struct frame_unwind *self,
- frame_info_ptr this_frame,
- void **this_cache)
+ frame_info_ptr this_frame, void **this_cache)
{
unw_cursor_t cursor;
unw_accessors_t *acc;
@@ -406,11 +402,10 @@ libunwind_sigtramp_frame_sniffer (const struct frame_unwind *self,
descr = libunwind_descr (gdbarch);
acc = (unw_accessors_t *) descr->accessors;
- as = unw_create_addr_space_p (acc,
- gdbarch_byte_order (gdbarch)
- == BFD_ENDIAN_BIG
- ? __BIG_ENDIAN
- : __LITTLE_ENDIAN);
+ as = unw_create_addr_space_p (acc,
+ gdbarch_byte_order (gdbarch) == BFD_ENDIAN_BIG
+ ? __BIG_ENDIAN
+ : __LITTLE_ENDIAN);
ret = unw_init_remote_p (&cursor, as, this_frame);
@@ -435,8 +430,8 @@ libunwind_sigtramp_frame_sniffer (const struct frame_unwind *self,
are usually located at BOF, this is not always true and only the libunwind
info can decipher where they actually are. */
int
-libunwind_get_reg_special (struct gdbarch *gdbarch, readable_regcache *regcache,
- int regnum, void *buf)
+libunwind_get_reg_special (struct gdbarch *gdbarch,
+ readable_regcache *regcache, int regnum, void *buf)
{
unw_cursor_t cursor;
unw_accessors_t *acc;
@@ -448,14 +443,12 @@ libunwind_get_reg_special (struct gdbarch *gdbarch, readable_regcache *regcache,
unw_fpreg_t fpval;
void *ptr;
-
descr = libunwind_descr (gdbarch);
acc = (unw_accessors_t *) descr->special_accessors;
- as = unw_create_addr_space_p (acc,
- gdbarch_byte_order (gdbarch)
- == BFD_ENDIAN_BIG
- ? __BIG_ENDIAN
- : __LITTLE_ENDIAN);
+ as = unw_create_addr_space_p (acc,
+ gdbarch_byte_order (gdbarch) == BFD_ENDIAN_BIG
+ ? __BIG_ENDIAN
+ : __LITTLE_ENDIAN);
ret = unw_init_remote_p (&cursor, as, regcache);
if (ret < 0)
@@ -487,7 +480,7 @@ libunwind_get_reg_special (struct gdbarch *gdbarch, readable_regcache *regcache,
return 0;
}
-
+
static int
libunwind_load (void)
{
@@ -504,10 +497,10 @@ libunwind_load (void)
}
if (handle == NULL)
{
- gdb_printf (gdb_stderr, _("[GDB failed to load %s: %s]\n"),
+ gdb_printf (gdb_stderr, _ ("[GDB failed to load %s: %s]\n"),
LIBUNWIND_SO, so_error);
#ifdef LIBUNWIND_SO_7
- gdb_printf (gdb_stderr, _("[GDB failed to load %s: %s]\n"),
+ gdb_printf (gdb_stderr, _ ("[GDB failed to load %s: %s]\n"),
LIBUNWIND_SO_7, dlerror ());
#endif /* LIBUNWIND_SO_7 */
}
@@ -565,7 +558,7 @@ libunwind_load (void)
= (unw_find_dyn_list_p_ftype *) dlsym (handle, find_dyn_list_name);
if (unw_find_dyn_list_p == NULL)
return 0;
-
+
return 1;
}
@@ -576,6 +569,7 @@ libunwind_is_initialized (void)
}
void _initialize_libunwind_frame ();
+
void
_initialize_libunwind_frame ()
{
diff --git a/gdb/ia64-libunwind-tdep.h b/gdb/ia64-libunwind-tdep.h
index 6603defe250..29a7f3918bb 100644
--- a/gdb/ia64-libunwind-tdep.h
+++ b/gdb/ia64-libunwind-tdep.h
@@ -48,9 +48,8 @@ struct libunwind_descr
};
int libunwind_frame_sniffer (const struct frame_unwind *self,
- frame_info_ptr this_frame,
- void **this_cache);
-
+ frame_info_ptr this_frame, void **this_cache);
+
int libunwind_sigtramp_frame_sniffer (const struct frame_unwind *self,
frame_info_ptr this_frame,
void **this_cache);
@@ -66,14 +65,14 @@ void libunwind_frame_dealloc_cache (frame_info_ptr self, void *cache);
int libunwind_is_initialized (void);
-int libunwind_search_unwind_table (void *as, long ip, void *di,
- void *pi, int need_unwind_info, void *args);
+int libunwind_search_unwind_table (void *as, long ip, void *di, void *pi,
+ int need_unwind_info, void *args);
unw_word_t libunwind_find_dyn_list (unw_addr_space_t, unw_dyn_info_t *,
void *);
int libunwind_get_reg_special (struct gdbarch *gdbarch,
- readable_regcache *regcache,
- int regnum, void *buf);
+ readable_regcache *regcache, int regnum,
+ void *buf);
#endif /* IA64_LIBUNWIND_TDEP_H */
diff --git a/gdb/ia64-linux-nat.c b/gdb/ia64-linux-nat.c
index f9f21d8e067..2d8045f76ee 100644
--- a/gdb/ia64-linux-nat.c
+++ b/gdb/ia64-linux-nat.c
@@ -47,13 +47,13 @@
class ia64_linux_nat_target final : public linux_nat_target
{
public:
+
/* Add our register access methods. */
void fetch_registers (struct regcache *, int) override;
void store_registers (struct regcache *, int) override;
enum target_xfer_status xfer_partial (enum target_object object,
- const char *annex,
- gdb_byte *readbuf,
+ const char *annex, gdb_byte *readbuf,
const gdb_byte *writebuf,
ULONGEST offset, ULONGEST len,
ULONGEST *xfered_len) override;
@@ -92,258 +92,609 @@ static ia64_linux_nat_target the_ia64_linux_nat_target;
Some sort of lookup table is needed because the offsets associated
with the registers are all over the board. */
-static int u_offsets[] =
- {
- /* general registers */
- -1, /* gr0 not available; i.e, it's always zero. */
- PT_R1,
- PT_R2,
- PT_R3,
- PT_R4,
- PT_R5,
- PT_R6,
- PT_R7,
- PT_R8,
- PT_R9,
- PT_R10,
- PT_R11,
- PT_R12,
- PT_R13,
- PT_R14,
- PT_R15,
- PT_R16,
- PT_R17,
- PT_R18,
- PT_R19,
- PT_R20,
- PT_R21,
- PT_R22,
- PT_R23,
- PT_R24,
- PT_R25,
- PT_R26,
- PT_R27,
- PT_R28,
- PT_R29,
- PT_R30,
- PT_R31,
- /* gr32 through gr127 not directly available via the ptrace interface. */
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- /* Floating point registers */
- -1, -1, /* f0 and f1 not available (f0 is +0.0 and f1 is +1.0). */
- PT_F2,
- PT_F3,
- PT_F4,
- PT_F5,
- PT_F6,
- PT_F7,
- PT_F8,
- PT_F9,
- PT_F10,
- PT_F11,
- PT_F12,
- PT_F13,
- PT_F14,
- PT_F15,
- PT_F16,
- PT_F17,
- PT_F18,
- PT_F19,
- PT_F20,
- PT_F21,
- PT_F22,
- PT_F23,
- PT_F24,
- PT_F25,
- PT_F26,
- PT_F27,
- PT_F28,
- PT_F29,
- PT_F30,
- PT_F31,
- PT_F32,
- PT_F33,
- PT_F34,
- PT_F35,
- PT_F36,
- PT_F37,
- PT_F38,
- PT_F39,
- PT_F40,
- PT_F41,
- PT_F42,
- PT_F43,
- PT_F44,
- PT_F45,
- PT_F46,
- PT_F47,
- PT_F48,
- PT_F49,
- PT_F50,
- PT_F51,
- PT_F52,
- PT_F53,
- PT_F54,
- PT_F55,
- PT_F56,
- PT_F57,
- PT_F58,
- PT_F59,
- PT_F60,
- PT_F61,
- PT_F62,
- PT_F63,
- PT_F64,
- PT_F65,
- PT_F66,
- PT_F67,
- PT_F68,
- PT_F69,
- PT_F70,
- PT_F71,
- PT_F72,
- PT_F73,
- PT_F74,
- PT_F75,
- PT_F76,
- PT_F77,
- PT_F78,
- PT_F79,
- PT_F80,
- PT_F81,
- PT_F82,
- PT_F83,
- PT_F84,
- PT_F85,
- PT_F86,
- PT_F87,
- PT_F88,
- PT_F89,
- PT_F90,
- PT_F91,
- PT_F92,
- PT_F93,
- PT_F94,
- PT_F95,
- PT_F96,
- PT_F97,
- PT_F98,
- PT_F99,
- PT_F100,
- PT_F101,
- PT_F102,
- PT_F103,
- PT_F104,
- PT_F105,
- PT_F106,
- PT_F107,
- PT_F108,
- PT_F109,
- PT_F110,
- PT_F111,
- PT_F112,
- PT_F113,
- PT_F114,
- PT_F115,
- PT_F116,
- PT_F117,
- PT_F118,
- PT_F119,
- PT_F120,
- PT_F121,
- PT_F122,
- PT_F123,
- PT_F124,
- PT_F125,
- PT_F126,
- PT_F127,
- /* Predicate registers - we don't fetch these individually. */
- -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1,
- /* branch registers */
- PT_B0,
- PT_B1,
- PT_B2,
- PT_B3,
- PT_B4,
- PT_B5,
- PT_B6,
- PT_B7,
- /* Virtual frame pointer and virtual return address pointer. */
- -1, -1,
- /* other registers */
- PT_PR,
- PT_CR_IIP, /* ip */
- PT_CR_IPSR, /* psr */
- PT_CFM, /* cfm */
- /* kernel registers not visible via ptrace interface (?) */
- -1, -1, -1, -1, -1, -1, -1, -1,
- /* hole */
- -1, -1, -1, -1, -1, -1, -1, -1,
- PT_AR_RSC,
- PT_AR_BSP,
- PT_AR_BSPSTORE,
- PT_AR_RNAT,
- -1,
- -1, /* Not available: FCR, IA32 floating control register. */
- -1, -1,
- -1, /* Not available: EFLAG */
- -1, /* Not available: CSD */
- -1, /* Not available: SSD */
- -1, /* Not available: CFLG */
- -1, /* Not available: FSR */
- -1, /* Not available: FIR */
- -1, /* Not available: FDR */
- -1,
- PT_AR_CCV,
- -1, -1, -1,
- PT_AR_UNAT,
- -1, -1, -1,
- PT_AR_FPSR,
- -1, -1, -1,
- -1, /* Not available: ITC */
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1,
- PT_AR_PFS,
- PT_AR_LC,
- PT_AR_EC,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1,
- /* nat bits - not fetched directly; instead we obtain these bits from
+static int u_offsets[] = {
+ /* general registers */
+ -1, /* gr0 not available; i.e, it's always zero. */
+ PT_R1,
+ PT_R2,
+ PT_R3,
+ PT_R4,
+ PT_R5,
+ PT_R6,
+ PT_R7,
+ PT_R8,
+ PT_R9,
+ PT_R10,
+ PT_R11,
+ PT_R12,
+ PT_R13,
+ PT_R14,
+ PT_R15,
+ PT_R16,
+ PT_R17,
+ PT_R18,
+ PT_R19,
+ PT_R20,
+ PT_R21,
+ PT_R22,
+ PT_R23,
+ PT_R24,
+ PT_R25,
+ PT_R26,
+ PT_R27,
+ PT_R28,
+ PT_R29,
+ PT_R30,
+ PT_R31,
+ /* gr32 through gr127 not directly available via the ptrace interface. */
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ /* Floating point registers */
+ -1,
+ -1, /* f0 and f1 not available (f0 is +0.0 and f1 is +1.0). */
+ PT_F2,
+ PT_F3,
+ PT_F4,
+ PT_F5,
+ PT_F6,
+ PT_F7,
+ PT_F8,
+ PT_F9,
+ PT_F10,
+ PT_F11,
+ PT_F12,
+ PT_F13,
+ PT_F14,
+ PT_F15,
+ PT_F16,
+ PT_F17,
+ PT_F18,
+ PT_F19,
+ PT_F20,
+ PT_F21,
+ PT_F22,
+ PT_F23,
+ PT_F24,
+ PT_F25,
+ PT_F26,
+ PT_F27,
+ PT_F28,
+ PT_F29,
+ PT_F30,
+ PT_F31,
+ PT_F32,
+ PT_F33,
+ PT_F34,
+ PT_F35,
+ PT_F36,
+ PT_F37,
+ PT_F38,
+ PT_F39,
+ PT_F40,
+ PT_F41,
+ PT_F42,
+ PT_F43,
+ PT_F44,
+ PT_F45,
+ PT_F46,
+ PT_F47,
+ PT_F48,
+ PT_F49,
+ PT_F50,
+ PT_F51,
+ PT_F52,
+ PT_F53,
+ PT_F54,
+ PT_F55,
+ PT_F56,
+ PT_F57,
+ PT_F58,
+ PT_F59,
+ PT_F60,
+ PT_F61,
+ PT_F62,
+ PT_F63,
+ PT_F64,
+ PT_F65,
+ PT_F66,
+ PT_F67,
+ PT_F68,
+ PT_F69,
+ PT_F70,
+ PT_F71,
+ PT_F72,
+ PT_F73,
+ PT_F74,
+ PT_F75,
+ PT_F76,
+ PT_F77,
+ PT_F78,
+ PT_F79,
+ PT_F80,
+ PT_F81,
+ PT_F82,
+ PT_F83,
+ PT_F84,
+ PT_F85,
+ PT_F86,
+ PT_F87,
+ PT_F88,
+ PT_F89,
+ PT_F90,
+ PT_F91,
+ PT_F92,
+ PT_F93,
+ PT_F94,
+ PT_F95,
+ PT_F96,
+ PT_F97,
+ PT_F98,
+ PT_F99,
+ PT_F100,
+ PT_F101,
+ PT_F102,
+ PT_F103,
+ PT_F104,
+ PT_F105,
+ PT_F106,
+ PT_F107,
+ PT_F108,
+ PT_F109,
+ PT_F110,
+ PT_F111,
+ PT_F112,
+ PT_F113,
+ PT_F114,
+ PT_F115,
+ PT_F116,
+ PT_F117,
+ PT_F118,
+ PT_F119,
+ PT_F120,
+ PT_F121,
+ PT_F122,
+ PT_F123,
+ PT_F124,
+ PT_F125,
+ PT_F126,
+ PT_F127,
+ /* Predicate registers - we don't fetch these individually. */
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ /* branch registers */
+ PT_B0,
+ PT_B1,
+ PT_B2,
+ PT_B3,
+ PT_B4,
+ PT_B5,
+ PT_B6,
+ PT_B7,
+ /* Virtual frame pointer and virtual return address pointer. */
+ -1,
+ -1,
+ /* other registers */
+ PT_PR,
+ PT_CR_IIP, /* ip */
+ PT_CR_IPSR, /* psr */
+ PT_CFM, /* cfm */
+ /* kernel registers not visible via ptrace interface (?) */
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ /* hole */
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ PT_AR_RSC,
+ PT_AR_BSP,
+ PT_AR_BSPSTORE,
+ PT_AR_RNAT,
+ -1,
+ -1, /* Not available: FCR, IA32 floating control register. */
+ -1,
+ -1,
+ -1, /* Not available: EFLAG */
+ -1, /* Not available: CSD */
+ -1, /* Not available: SSD */
+ -1, /* Not available: CFLG */
+ -1, /* Not available: FSR */
+ -1, /* Not available: FIR */
+ -1, /* Not available: FDR */
+ -1,
+ PT_AR_CCV,
+ -1,
+ -1,
+ -1,
+ PT_AR_UNAT,
+ -1,
+ -1,
+ -1,
+ PT_AR_FPSR,
+ -1,
+ -1,
+ -1,
+ -1, /* Not available: ITC */
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ PT_AR_PFS,
+ PT_AR_LC,
+ PT_AR_EC,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ /* nat bits - not fetched directly; instead we obtain these bits from
either rnat or unat or from memory. */
- -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1,
- };
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+};
static CORE_ADDR
ia64_register_addr (struct gdbarch *gdbarch, int regno)
@@ -351,7 +702,7 @@ ia64_register_addr (struct gdbarch *gdbarch, int regno)
CORE_ADDR addr;
if (regno < 0 || regno >= gdbarch_num_regs (gdbarch))
- error (_("Invalid register number %d."), regno);
+ error (_ ("Invalid register number %d."), regno);
if (u_offsets[regno] == -1)
addr = 0;
@@ -364,8 +715,7 @@ ia64_register_addr (struct gdbarch *gdbarch, int regno)
static int
ia64_cannot_fetch_register (struct gdbarch *gdbarch, int regno)
{
- return regno < 0
- || regno >= gdbarch_num_regs (gdbarch)
+ return regno < 0 || regno >= gdbarch_num_regs (gdbarch)
|| u_offsets[regno] == -1;
}
@@ -401,10 +751,8 @@ ia64_cannot_store_register (struct gdbarch *gdbarch, int regno)
were previously read from the inferior process to be written
back.) */
- return regno < 0
- || regno >= gdbarch_num_regs (gdbarch)
- || u_offsets[regno] == -1
- || regno == IA64_BSPSTORE_REGNUM;
+ return regno < 0 || regno >= gdbarch_num_regs (gdbarch)
+ || u_offsets[regno] == -1 || regno == IA64_BSPSTORE_REGNUM;
}
void
@@ -449,9 +797,9 @@ fill_gregset (const struct regcache *regcache, gregset_t *gregsetp, int regno)
int regi;
greg_t *regp = (greg_t *) gregsetp;
-#define COPY_REG(_idx_,_regi_) \
+#define COPY_REG(_idx_, _regi_) \
if ((regno == -1) || regno == _regi_) \
- regcache->raw_collect (_regi_, regp + _idx_)
+ regcache->raw_collect (_regi_, regp + _idx_)
for (regi = IA64_GR0_REGNUM; regi <= IA64_GR31_REGNUM; regi++)
{
@@ -492,8 +840,8 @@ supply_fpregset (struct regcache *regcache, const fpregset_t *fpregsetp)
int regi;
const char *from;
const gdb_byte f_zero[16] = { 0 };
- const gdb_byte f_one[16] =
- { 0, 0, 0, 0, 0, 0, 0, 0x80, 0xff, 0xff, 0, 0, 0, 0, 0, 0 };
+ const gdb_byte f_one[16]
+ = { 0, 0, 0, 0, 0, 0, 0, 0x80, 0xff, 0xff, 0, 0, 0, 0, 0, 0 };
/* Kernel generated cores have fr1==0 instead of 1.0. Older GDBs
did the same. So ignore whatever might be recorded in fpregset_t
@@ -517,8 +865,8 @@ supply_fpregset (struct regcache *regcache, const fpregset_t *fpregsetp)
them all. */
void
-fill_fpregset (const struct regcache *regcache,
- fpregset_t *fpregsetp, int regno)
+fill_fpregset (const struct regcache *regcache, fpregset_t *fpregsetp,
+ int regno)
{
int regi;
@@ -541,7 +889,7 @@ ia64_linux_nat_target::enable_watchpoints_in_psr (ptid_t ptid)
regcache_cooked_read_unsigned (regcache, IA64_PSR_REGNUM, &psr);
if (!(psr & IA64_PSR_DB))
{
- psr |= IA64_PSR_DB; /* Set the db bit - this enables hardware
+ psr |= IA64_PSR_DB; /* Set the db bit - this enables hardware
watchpoints and breakpoints. */
regcache_cooked_write_unsigned (regcache, IA64_PSR_REGNUM, psr);
}
@@ -610,18 +958,18 @@ ia64_linux_nat_target::insert_watchpoint (CORE_ADDR addr, int len,
return -1;
dbr_addr = (long) addr;
- dbr_mask = (~(len - 1) & 0x00ffffffffffffffL); /* construct mask to match */
- dbr_mask |= 0x0800000000000000L; /* Only match privilege level 3 */
+ dbr_mask = (~(len - 1) & 0x00ffffffffffffffL); /* construct mask to match */
+ dbr_mask |= 0x0800000000000000L; /* Only match privilege level 3 */
switch (type)
{
case hw_write:
- dbr_mask |= (1L << 62); /* Set w bit */
+ dbr_mask |= (1L << 62); /* Set w bit */
break;
case hw_read:
- dbr_mask |= (1L << 63); /* Set r bit */
+ dbr_mask |= (1L << 63); /* Set r bit */
break;
case hw_access:
- dbr_mask |= (3L << 62); /* Set both r and w bits */
+ dbr_mask |= (3L << 62); /* Set both r and w bits */
break;
default:
return -1;
@@ -703,7 +1051,7 @@ ia64_linux_nat_target::stopped_data_address (CORE_ADDR *addr_p)
return false;
regcache_cooked_read_unsigned (regcache, IA64_PSR_REGNUM, &psr);
- psr |= IA64_PSR_DD; /* Set the dd bit - this will disable the watchpoint
+ psr |= IA64_PSR_DD; /* Set the dd bit - this will disable the watchpoint
for the next instruction. */
regcache_cooked_write_unsigned (regcache, IA64_PSR_REGNUM, psr);
@@ -719,13 +1067,12 @@ ia64_linux_nat_target::stopped_by_watchpoint ()
}
int
-ia64_linux_nat_target::can_use_hw_breakpoint (enum bptype type,
- int cnt, int othertype)
+ia64_linux_nat_target::can_use_hw_breakpoint (enum bptype type, int cnt,
+ int othertype)
{
return 1;
}
-
/* Fetch register REGNUM from the inferior. */
static void
@@ -761,8 +1108,8 @@ ia64_linux_fetch_register (struct regcache *regcache, int regnum)
/* fr1 cannot be fetched but is always one (1.0). */
if (regnum == IA64_FR1_REGNUM)
{
- const gdb_byte f_one[16] =
- { 0, 0, 0, 0, 0, 0, 0, 0x80, 0xff, 0xff, 0, 0, 0, 0, 0, 0 };
+ const gdb_byte f_one[16]
+ = { 0, 0, 0, 0, 0, 0, 0, 0x80, 0xff, 0xff, 0, 0, 0, 0, 0, 0 };
gdb_assert (sizeof (f_one) == register_size (gdbarch, regnum));
regcache->raw_supply (regnum, f_one);
@@ -788,11 +1135,11 @@ ia64_linux_fetch_register (struct regcache *regcache, int regnum)
for (i = 0; i < size / sizeof (PTRACE_TYPE_RET); i++)
{
errno = 0;
- buf[i] = ptrace (PT_READ_U, pid, (PTRACE_TYPE_ARG3)addr, 0);
+ buf[i] = ptrace (PT_READ_U, pid, (PTRACE_TYPE_ARG3) addr, 0);
if (errno != 0)
- error (_("Couldn't read register %s (#%d): %s."),
- gdbarch_register_name (gdbarch, regnum),
- regnum, safe_strerror (errno));
+ error (_ ("Couldn't read register %s (#%d): %s."),
+ gdbarch_register_name (gdbarch, regnum), regnum,
+ safe_strerror (errno));
addr += sizeof (PTRACE_TYPE_RET);
}
@@ -806,9 +1153,7 @@ void
ia64_linux_nat_target::fetch_registers (struct regcache *regcache, int regnum)
{
if (regnum == -1)
- for (regnum = 0;
- regnum < gdbarch_num_regs (regcache->arch ());
- regnum++)
+ for (regnum = 0; regnum < gdbarch_num_regs (regcache->arch ()); regnum++)
ia64_linux_fetch_register (regcache, regnum);
else
ia64_linux_fetch_register (regcache, regnum);
@@ -843,11 +1188,11 @@ ia64_linux_store_register (const struct regcache *regcache, int regnum)
for (i = 0; i < size / sizeof (PTRACE_TYPE_RET); i++)
{
errno = 0;
- ptrace (PT_WRITE_U, pid, (PTRACE_TYPE_ARG3)addr, buf[i]);
+ ptrace (PT_WRITE_U, pid, (PTRACE_TYPE_ARG3) addr, buf[i]);
if (errno != 0)
- error (_("Couldn't write register %s (#%d): %s."),
- gdbarch_register_name (gdbarch, regnum),
- regnum, safe_strerror (errno));
+ error (_ ("Couldn't write register %s (#%d): %s."),
+ gdbarch_register_name (gdbarch, regnum), regnum,
+ safe_strerror (errno));
addr += sizeof (PTRACE_TYPE_RET);
}
@@ -860,9 +1205,7 @@ void
ia64_linux_nat_target::store_registers (struct regcache *regcache, int regnum)
{
if (regnum == -1)
- for (regnum = 0;
- regnum < gdbarch_num_regs (regcache->arch ());
- regnum++)
+ for (regnum = 0; regnum < gdbarch_num_regs (regcache->arch ()); regnum++)
ia64_linux_store_register (regcache, regnum);
else
ia64_linux_store_register (regcache, regnum);
@@ -872,10 +1215,9 @@ ia64_linux_nat_target::store_registers (struct regcache *regcache, int regnum)
enum target_xfer_status
ia64_linux_nat_target::xfer_partial (enum target_object object,
- const char *annex,
- gdb_byte *readbuf, const gdb_byte *writebuf,
- ULONGEST offset, ULONGEST len,
- ULONGEST *xfered_len)
+ const char *annex, gdb_byte *readbuf,
+ const gdb_byte *writebuf, ULONGEST offset,
+ ULONGEST len, ULONGEST *xfered_len)
{
if (object == TARGET_OBJECT_UNWIND_TABLE && readbuf != NULL)
{
@@ -918,11 +1260,12 @@ ia64_linux_nat_target::xfer_partial (enum target_object object,
bool
ia64_linux_nat_target::low_status_is_event (int status)
{
- return WIFSTOPPED (status) && (WSTOPSIG (status) == SIGTRAP
- || WSTOPSIG (status) == SIGILL);
+ return WIFSTOPPED (status)
+ && (WSTOPSIG (status) == SIGTRAP || WSTOPSIG (status) == SIGILL);
}
void _initialize_ia64_linux_nat ();
+
void
_initialize_ia64_linux_nat ()
{
diff --git a/gdb/ia64-linux-tdep.c b/gdb/ia64-linux-tdep.c
index 1bd1dfb5b3b..c855d7b3d00 100644
--- a/gdb/ia64-linux-tdep.c
+++ b/gdb/ia64-linux-tdep.c
@@ -36,7 +36,7 @@
overly generous to allow for different pages sizes. */
#define GATE_AREA_START 0xa000000000000100LL
-#define GATE_AREA_END 0xa000000000020000LL
+#define GATE_AREA_END 0xa000000000020000LL
/* Offset to sigcontext structure from frame of handler. */
#define IA64_LINUX_SIGCONTEXT_OFFSET 192
@@ -53,8 +53,8 @@ ia64_linux_pc_in_sigtramp (CORE_ADDR pc)
sigcontext structure. */
static CORE_ADDR
-ia64_linux_sigcontext_register_address (struct gdbarch *gdbarch,
- CORE_ADDR sp, int regno)
+ia64_linux_sigcontext_register_address (struct gdbarch *gdbarch, CORE_ADDR sp,
+ int regno)
{
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
gdb_byte buf[8];
@@ -74,32 +74,32 @@ ia64_linux_sigcontext_register_address (struct gdbarch *gdbarch,
else
switch (regno)
{
- case IA64_IP_REGNUM :
+ case IA64_IP_REGNUM:
return sigcontext_addr + 40;
- case IA64_CFM_REGNUM :
+ case IA64_CFM_REGNUM:
return sigcontext_addr + 48;
- case IA64_PSR_REGNUM :
- return sigcontext_addr + 56; /* user mask only */
+ case IA64_PSR_REGNUM:
+ return sigcontext_addr + 56; /* user mask only */
/* sc_ar_rsc is provided, from which we could compute bspstore, but
I don't think it's worth it. Anyway, if we want it, it's at offset
64. */
- case IA64_BSP_REGNUM :
+ case IA64_BSP_REGNUM:
return sigcontext_addr + 72;
- case IA64_RNAT_REGNUM :
+ case IA64_RNAT_REGNUM:
return sigcontext_addr + 80;
- case IA64_CCV_REGNUM :
+ case IA64_CCV_REGNUM:
return sigcontext_addr + 88;
- case IA64_UNAT_REGNUM :
+ case IA64_UNAT_REGNUM:
return sigcontext_addr + 96;
- case IA64_FPSR_REGNUM :
+ case IA64_FPSR_REGNUM:
return sigcontext_addr + 104;
- case IA64_PFS_REGNUM :
+ case IA64_PFS_REGNUM:
return sigcontext_addr + 112;
- case IA64_LC_REGNUM :
+ case IA64_LC_REGNUM:
return sigcontext_addr + 120;
- case IA64_PR_REGNUM :
+ case IA64_PR_REGNUM:
return sigcontext_addr + 128;
- default :
+ default:
return 0;
}
}
@@ -128,55 +128,43 @@ static int
ia64_linux_stap_is_single_operand (struct gdbarch *gdbarch, const char *s)
{
return ((isdigit (*s) && s[1] == '[' && s[2] == 'r') /* Displacement. */
- || *s == 'r' /* Register value. */
- || isdigit (*s)); /* Literal number. */
+ || *s == 'r' /* Register value. */
+ || isdigit (*s)); /* Literal number. */
}
/* Core file support. */
-static const struct regcache_map_entry ia64_linux_gregmap[] =
- {
- { 32, IA64_GR0_REGNUM, 8 }, /* r0 ... r31 */
- { 1, REGCACHE_MAP_SKIP, 8 }, /* FIXME: NAT collection bits? */
- { 1, IA64_PR_REGNUM, 8 },
- { 8, IA64_BR0_REGNUM, 8 }, /* b0 ... b7 */
- { 1, IA64_IP_REGNUM, 8 },
- { 1, IA64_CFM_REGNUM, 8 },
- { 1, IA64_PSR_REGNUM, 8 },
- { 1, IA64_RSC_REGNUM, 8 },
- { 1, IA64_BSP_REGNUM, 8 },
- { 1, IA64_BSPSTORE_REGNUM, 8 },
- { 1, IA64_RNAT_REGNUM, 8 },
- { 1, IA64_CCV_REGNUM, 8 },
- { 1, IA64_UNAT_REGNUM, 8 },
- { 1, IA64_FPSR_REGNUM, 8 },
- { 1, IA64_PFS_REGNUM, 8 },
- { 1, IA64_LC_REGNUM, 8 },
- { 1, IA64_EC_REGNUM, 8 },
- { 0 }
- };
+static const struct regcache_map_entry ia64_linux_gregmap[]
+ = { { 32, IA64_GR0_REGNUM, 8 }, /* r0 ... r31 */
+ { 1, REGCACHE_MAP_SKIP, 8 }, /* FIXME: NAT collection bits? */
+ { 1, IA64_PR_REGNUM, 8 }, { 8, IA64_BR0_REGNUM, 8 }, /* b0 ... b7 */
+ { 1, IA64_IP_REGNUM, 8 }, { 1, IA64_CFM_REGNUM, 8 },
+ { 1, IA64_PSR_REGNUM, 8 }, { 1, IA64_RSC_REGNUM, 8 },
+ { 1, IA64_BSP_REGNUM, 8 }, { 1, IA64_BSPSTORE_REGNUM, 8 },
+ { 1, IA64_RNAT_REGNUM, 8 }, { 1, IA64_CCV_REGNUM, 8 },
+ { 1, IA64_UNAT_REGNUM, 8 }, { 1, IA64_FPSR_REGNUM, 8 },
+ { 1, IA64_PFS_REGNUM, 8 }, { 1, IA64_LC_REGNUM, 8 },
+ { 1, IA64_EC_REGNUM, 8 }, { 0 } };
/* Size of 'gregset_t', as defined by the Linux kernel. Note that
this is more than actually mapped in the regmap above. */
#define IA64_LINUX_GREGS_SIZE (128 * 8)
-static const struct regcache_map_entry ia64_linux_fpregmap[] =
- {
- { 128, IA64_FR0_REGNUM, 16 }, /* f0 ... f127 */
- { 0 }
- };
+static const struct regcache_map_entry ia64_linux_fpregmap[]
+ = { { 128, IA64_FR0_REGNUM, 16 }, /* f0 ... f127 */
+ { 0 } };
#define IA64_LINUX_FPREGS_SIZE (128 * 16)
static void
ia64_linux_supply_fpregset (const struct regset *regset,
- struct regcache *regcache,
- int regnum, const void *regs, size_t len)
+ struct regcache *regcache, int regnum,
+ const void *regs, size_t len)
{
const gdb_byte f_zero[16] = { 0 };
- const gdb_byte f_one[16] =
- { 0, 0, 0, 0, 0, 0, 0, 0x80, 0xff, 0xff, 0, 0, 0, 0, 0, 0 };
+ const gdb_byte f_one[16]
+ = { 0, 0, 0, 0, 0, 0, 0, 0x80, 0xff, 0xff, 0, 0, 0, 0, 0, 0 };
regcache_supply_regset (regset, regcache, regnum, regs, len);
@@ -189,17 +177,12 @@ ia64_linux_supply_fpregset (const struct regset *regset,
regcache->raw_supply (IA64_FR1_REGNUM, f_one);
}
-static const struct regset ia64_linux_gregset =
- {
- ia64_linux_gregmap,
- regcache_supply_regset, regcache_collect_regset
- };
+static const struct regset ia64_linux_gregset
+ = { ia64_linux_gregmap, regcache_supply_regset, regcache_collect_regset };
-static const struct regset ia64_linux_fpregset =
- {
- ia64_linux_fpregmap,
- ia64_linux_supply_fpregset, regcache_collect_regset
- };
+static const struct regset ia64_linux_fpregset
+ = { ia64_linux_fpregmap, ia64_linux_supply_fpregset,
+ regcache_collect_regset };
static void
ia64_linux_iterate_over_regset_sections (struct gdbarch *gdbarch,
@@ -207,8 +190,8 @@ ia64_linux_iterate_over_regset_sections (struct gdbarch *gdbarch,
void *cb_data,
const struct regcache *regcache)
{
- cb (".reg", IA64_LINUX_GREGS_SIZE, IA64_LINUX_GREGS_SIZE, &ia64_linux_gregset,
- NULL, cb_data);
+ cb (".reg", IA64_LINUX_GREGS_SIZE, IA64_LINUX_GREGS_SIZE,
+ &ia64_linux_gregset, NULL, cb_data);
cb (".reg2", IA64_LINUX_FPREGS_SIZE, IA64_LINUX_FPREGS_SIZE,
&ia64_linux_fpregset, NULL, cb_data);
}
@@ -218,10 +201,10 @@ ia64_linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
{
ia64_gdbarch_tdep *tdep = gdbarch_tdep<ia64_gdbarch_tdep> (gdbarch);
static const char *const stap_register_prefixes[] = { "r", NULL };
- static const char *const stap_register_indirection_prefixes[] = { "[",
- NULL };
- static const char *const stap_register_indirection_suffixes[] = { "]",
- NULL };
+ static const char *const stap_register_indirection_prefixes[]
+ = { "[", NULL };
+ static const char *const stap_register_indirection_suffixes[]
+ = { "]", NULL };
linux_init_abi (info, gdbarch, 0);
@@ -236,29 +219,30 @@ ia64_linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
set_gdbarch_skip_trampoline_code (gdbarch, find_solib_trampoline_target);
- set_solib_svr4_fetch_link_map_offsets
- (gdbarch, linux_lp64_fetch_link_map_offsets);
+ set_solib_svr4_fetch_link_map_offsets (gdbarch,
+ linux_lp64_fetch_link_map_offsets);
/* Enable TLS support. */
set_gdbarch_fetch_tls_load_module_address (gdbarch,
svr4_fetch_objfile_link_map);
/* Core file support. */
- set_gdbarch_iterate_over_regset_sections
- (gdbarch, ia64_linux_iterate_over_regset_sections);
+ set_gdbarch_iterate_over_regset_sections (
+ gdbarch, ia64_linux_iterate_over_regset_sections);
/* SystemTap related. */
set_gdbarch_stap_register_prefixes (gdbarch, stap_register_prefixes);
- set_gdbarch_stap_register_indirection_prefixes (gdbarch,
- stap_register_indirection_prefixes);
- set_gdbarch_stap_register_indirection_suffixes (gdbarch,
- stap_register_indirection_suffixes);
+ set_gdbarch_stap_register_indirection_prefixes (
+ gdbarch, stap_register_indirection_prefixes);
+ set_gdbarch_stap_register_indirection_suffixes (
+ gdbarch, stap_register_indirection_suffixes);
set_gdbarch_stap_gdb_register_prefix (gdbarch, "r");
set_gdbarch_stap_is_single_operand (gdbarch,
ia64_linux_stap_is_single_operand);
}
void _initialize_ia64_linux_tdep ();
+
void
_initialize_ia64_linux_tdep ()
{
diff --git a/gdb/ia64-tdep.c b/gdb/ia64-tdep.c
index f446c41c411..ff6e57e8575 100644
--- a/gdb/ia64-tdep.c
+++ b/gdb/ia64-tdep.c
@@ -31,7 +31,7 @@
#include "target-float.h"
#include "value.h"
#include "objfiles.h"
-#include "elf/common.h" /* for DT_PLTGOT value */
+#include "elf/common.h" /* for DT_PLTGOT value */
#include "elf-bfd.h"
#include "dis-asm.h"
#include "infcall.h"
@@ -40,7 +40,7 @@
#include "cp-abi.h"
#ifdef HAVE_LIBUNWIND_IA64_H
-#include "elf/ia64.h" /* for PT_IA_64_UNWIND value */
+#include "elf/ia64.h" /* for PT_IA_64_UNWIND value */
#include "ia64-libunwind-tdep.h"
/* Note: KERNEL_START is supposed to be an address which is not going
@@ -61,12 +61,13 @@
#define KERNEL_START 0xc000000000000000ULL
static size_t ktab_size = 0;
+
struct ia64_table_entry
- {
- uint64_t start_offset;
- uint64_t end_offset;
- uint64_t info_offset;
- };
+{
+ uint64_t start_offset;
+ uint64_t end_offset;
+ uint64_t info_offset;
+};
static struct ia64_table_entry *ktab = NULL;
static gdb::optional<gdb::byte_vector> ktab_buf;
@@ -77,14 +78,14 @@ static gdb::optional<gdb::byte_vector> ktab_buf;
enum ia64_instruction_type
{
- A, /* Integer ALU ; I-unit or M-unit */
- I, /* Non-ALU integer; I-unit */
- M, /* Memory ; M-unit */
- F, /* Floating-point ; F-unit */
- B, /* Branch ; B-unit */
- L, /* Extended (L+X) ; I-unit */
- X, /* Extended (L+X) ; I-unit */
- undefined /* undefined or reserved */
+ A, /* Integer ALU ; I-unit or M-unit */
+ I, /* Non-ALU integer; I-unit */
+ M, /* Memory ; M-unit */
+ F, /* Floating-point ; F-unit */
+ B, /* Branch ; B-unit */
+ L, /* Extended (L+X) ; I-unit */
+ X, /* Extended (L+X) ; I-unit */
+ undefined /* undefined or reserved */
};
/* We represent IA-64 PC addresses as the value of the instruction
@@ -111,7 +112,7 @@ enum ia64_instruction_type
/* See the saved memory layout comment for ia64_memory_insert_breakpoint. */
#if BREAKPOINT_MAX < BUNDLE_LEN - 2
-# error "BREAKPOINT_MAX < BUNDLE_LEN - 2"
+#error "BREAKPOINT_MAX < BUNDLE_LEN - 2"
#endif
static gdbarch_init_ftype ia64_gdbarch_init;
@@ -135,136 +136,159 @@ static int sp_regnum = IA64_GR12_REGNUM;
pseudo-registers because they may not be accessible via the ptrace
register get/set interfaces. */
-enum pseudo_regs { FIRST_PSEUDO_REGNUM = NUM_IA64_RAW_REGS,
- VBOF_REGNUM = IA64_NAT127_REGNUM + 1, V32_REGNUM,
- V127_REGNUM = V32_REGNUM + 95,
- VP0_REGNUM, VP16_REGNUM = VP0_REGNUM + 16,
- VP63_REGNUM = VP0_REGNUM + 63, LAST_PSEUDO_REGNUM };
+enum pseudo_regs
+{
+ FIRST_PSEUDO_REGNUM = NUM_IA64_RAW_REGS,
+ VBOF_REGNUM = IA64_NAT127_REGNUM + 1,
+ V32_REGNUM,
+ V127_REGNUM = V32_REGNUM + 95,
+ VP0_REGNUM,
+ VP16_REGNUM = VP0_REGNUM + 16,
+ VP63_REGNUM = VP0_REGNUM + 63,
+ LAST_PSEUDO_REGNUM
+};
/* Array of register names; There should be ia64_num_regs strings in
the initializer. */
-static const char * const ia64_register_names[] =
-{ "r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7",
- "r8", "r9", "r10", "r11", "r12", "r13", "r14", "r15",
- "r16", "r17", "r18", "r19", "r20", "r21", "r22", "r23",
- "r24", "r25", "r26", "r27", "r28", "r29", "r30", "r31",
- "", "", "", "", "", "", "", "",
- "", "", "", "", "", "", "", "",
- "", "", "", "", "", "", "", "",
- "", "", "", "", "", "", "", "",
- "", "", "", "", "", "", "", "",
- "", "", "", "", "", "", "", "",
- "", "", "", "", "", "", "", "",
- "", "", "", "", "", "", "", "",
- "", "", "", "", "", "", "", "",
- "", "", "", "", "", "", "", "",
- "", "", "", "", "", "", "", "",
- "", "", "", "", "", "", "", "",
-
- "f0", "f1", "f2", "f3", "f4", "f5", "f6", "f7",
- "f8", "f9", "f10", "f11", "f12", "f13", "f14", "f15",
- "f16", "f17", "f18", "f19", "f20", "f21", "f22", "f23",
- "f24", "f25", "f26", "f27", "f28", "f29", "f30", "f31",
- "f32", "f33", "f34", "f35", "f36", "f37", "f38", "f39",
- "f40", "f41", "f42", "f43", "f44", "f45", "f46", "f47",
- "f48", "f49", "f50", "f51", "f52", "f53", "f54", "f55",
- "f56", "f57", "f58", "f59", "f60", "f61", "f62", "f63",
- "f64", "f65", "f66", "f67", "f68", "f69", "f70", "f71",
- "f72", "f73", "f74", "f75", "f76", "f77", "f78", "f79",
- "f80", "f81", "f82", "f83", "f84", "f85", "f86", "f87",
- "f88", "f89", "f90", "f91", "f92", "f93", "f94", "f95",
- "f96", "f97", "f98", "f99", "f100", "f101", "f102", "f103",
- "f104", "f105", "f106", "f107", "f108", "f109", "f110", "f111",
- "f112", "f113", "f114", "f115", "f116", "f117", "f118", "f119",
- "f120", "f121", "f122", "f123", "f124", "f125", "f126", "f127",
-
- "", "", "", "", "", "", "", "",
- "", "", "", "", "", "", "", "",
- "", "", "", "", "", "", "", "",
- "", "", "", "", "", "", "", "",
- "", "", "", "", "", "", "", "",
- "", "", "", "", "", "", "", "",
- "", "", "", "", "", "", "", "",
- "", "", "", "", "", "", "", "",
-
- "b0", "b1", "b2", "b3", "b4", "b5", "b6", "b7",
-
- "vfp", "vrap",
-
- "pr", "ip", "psr", "cfm",
-
- "kr0", "kr1", "kr2", "kr3", "kr4", "kr5", "kr6", "kr7",
- "", "", "", "", "", "", "", "",
- "rsc", "bsp", "bspstore", "rnat",
- "", "fcr", "", "",
- "eflag", "csd", "ssd", "cflg", "fsr", "fir", "fdr", "",
- "ccv", "", "", "", "unat", "", "", "",
- "fpsr", "", "", "", "itc",
- "", "", "", "", "", "", "", "", "", "",
- "", "", "", "", "", "", "", "", "",
- "pfs", "lc", "ec",
- "", "", "", "", "", "", "", "", "", "",
- "", "", "", "", "", "", "", "", "", "",
- "", "", "", "", "", "", "", "", "", "",
- "", "", "", "", "", "", "", "", "", "",
- "", "", "", "", "", "", "", "", "", "",
- "", "", "", "", "", "", "", "", "", "",
+static const char *const ia64_register_names[] = {
+ "r0", "r1", "r2", "r3", "r4", "r5", "r6",
+ "r7", "r8", "r9", "r10", "r11", "r12", "r13",
+ "r14", "r15", "r16", "r17", "r18", "r19", "r20",
+ "r21", "r22", "r23", "r24", "r25", "r26", "r27",
+ "r28", "r29", "r30", "r31", "", "", "",
+ "", "", "", "", "", "", "",
+ "", "", "", "", "", "", "",
+ "", "", "", "", "", "", "",
+ "", "", "", "", "", "", "",
+ "", "", "", "", "", "", "",
+ "", "", "", "", "", "", "",
+ "", "", "", "", "", "", "",
+ "", "", "", "", "", "", "",
+ "", "", "", "", "", "", "",
+ "", "", "", "", "", "", "",
+ "", "", "", "", "", "", "",
+ "", "", "", "", "", "", "",
+ "", "", "", "", "", "", "",
+ "", "",
+
+ "f0", "f1", "f2", "f3", "f4", "f5", "f6",
+ "f7", "f8", "f9", "f10", "f11", "f12", "f13",
+ "f14", "f15", "f16", "f17", "f18", "f19", "f20",
+ "f21", "f22", "f23", "f24", "f25", "f26", "f27",
+ "f28", "f29", "f30", "f31", "f32", "f33", "f34",
+ "f35", "f36", "f37", "f38", "f39", "f40", "f41",
+ "f42", "f43", "f44", "f45", "f46", "f47", "f48",
+ "f49", "f50", "f51", "f52", "f53", "f54", "f55",
+ "f56", "f57", "f58", "f59", "f60", "f61", "f62",
+ "f63", "f64", "f65", "f66", "f67", "f68", "f69",
+ "f70", "f71", "f72", "f73", "f74", "f75", "f76",
+ "f77", "f78", "f79", "f80", "f81", "f82", "f83",
+ "f84", "f85", "f86", "f87", "f88", "f89", "f90",
+ "f91", "f92", "f93", "f94", "f95", "f96", "f97",
+ "f98", "f99", "f100", "f101", "f102", "f103", "f104",
+ "f105", "f106", "f107", "f108", "f109", "f110", "f111",
+ "f112", "f113", "f114", "f115", "f116", "f117", "f118",
+ "f119", "f120", "f121", "f122", "f123", "f124", "f125",
+ "f126", "f127",
+
+ "", "", "", "", "", "", "",
+ "", "", "", "", "", "", "",
+ "", "", "", "", "", "", "",
+ "", "", "", "", "", "", "",
+ "", "", "", "", "", "", "",
+ "", "", "", "", "", "", "",
+ "", "", "", "", "", "", "",
+ "", "", "", "", "", "", "",
+ "", "", "", "", "", "", "",
"",
- "nat0", "nat1", "nat2", "nat3", "nat4", "nat5", "nat6", "nat7",
- "nat8", "nat9", "nat10", "nat11", "nat12", "nat13", "nat14", "nat15",
- "nat16", "nat17", "nat18", "nat19", "nat20", "nat21", "nat22", "nat23",
- "nat24", "nat25", "nat26", "nat27", "nat28", "nat29", "nat30", "nat31",
- "nat32", "nat33", "nat34", "nat35", "nat36", "nat37", "nat38", "nat39",
- "nat40", "nat41", "nat42", "nat43", "nat44", "nat45", "nat46", "nat47",
- "nat48", "nat49", "nat50", "nat51", "nat52", "nat53", "nat54", "nat55",
- "nat56", "nat57", "nat58", "nat59", "nat60", "nat61", "nat62", "nat63",
- "nat64", "nat65", "nat66", "nat67", "nat68", "nat69", "nat70", "nat71",
- "nat72", "nat73", "nat74", "nat75", "nat76", "nat77", "nat78", "nat79",
- "nat80", "nat81", "nat82", "nat83", "nat84", "nat85", "nat86", "nat87",
- "nat88", "nat89", "nat90", "nat91", "nat92", "nat93", "nat94", "nat95",
- "nat96", "nat97", "nat98", "nat99", "nat100","nat101","nat102","nat103",
- "nat104","nat105","nat106","nat107","nat108","nat109","nat110","nat111",
- "nat112","nat113","nat114","nat115","nat116","nat117","nat118","nat119",
- "nat120","nat121","nat122","nat123","nat124","nat125","nat126","nat127",
+
+ "b0", "b1", "b2", "b3", "b4", "b5", "b6",
+ "b7",
+
+ "vfp", "vrap",
+
+ "pr", "ip", "psr", "cfm",
+
+ "kr0", "kr1", "kr2", "kr3", "kr4", "kr5", "kr6",
+ "kr7", "", "", "", "", "", "",
+ "", "", "rsc", "bsp", "bspstore", "rnat", "",
+ "fcr", "", "", "eflag", "csd", "ssd", "cflg",
+ "fsr", "fir", "fdr", "", "ccv", "", "",
+ "", "unat", "", "", "", "fpsr", "",
+ "", "", "itc", "", "", "", "",
+ "", "", "", "", "", "", "",
+ "", "", "", "", "", "", "",
+ "", "pfs", "lc", "ec", "", "", "",
+ "", "", "", "", "", "", "",
+ "", "", "", "", "", "", "",
+ "", "", "", "", "", "", "",
+ "", "", "", "", "", "", "",
+ "", "", "", "", "", "", "",
+ "", "", "", "", "", "", "",
+ "", "", "", "", "", "", "",
+ "", "", "", "", "", "", "",
+ "", "", "nat0", "nat1", "nat2", "nat3", "nat4",
+ "nat5", "nat6", "nat7", "nat8", "nat9", "nat10", "nat11",
+ "nat12", "nat13", "nat14", "nat15", "nat16", "nat17", "nat18",
+ "nat19", "nat20", "nat21", "nat22", "nat23", "nat24", "nat25",
+ "nat26", "nat27", "nat28", "nat29", "nat30", "nat31", "nat32",
+ "nat33", "nat34", "nat35", "nat36", "nat37", "nat38", "nat39",
+ "nat40", "nat41", "nat42", "nat43", "nat44", "nat45", "nat46",
+ "nat47", "nat48", "nat49", "nat50", "nat51", "nat52", "nat53",
+ "nat54", "nat55", "nat56", "nat57", "nat58", "nat59", "nat60",
+ "nat61", "nat62", "nat63", "nat64", "nat65", "nat66", "nat67",
+ "nat68", "nat69", "nat70", "nat71", "nat72", "nat73", "nat74",
+ "nat75", "nat76", "nat77", "nat78", "nat79", "nat80", "nat81",
+ "nat82", "nat83", "nat84", "nat85", "nat86", "nat87", "nat88",
+ "nat89", "nat90", "nat91", "nat92", "nat93", "nat94", "nat95",
+ "nat96", "nat97", "nat98", "nat99", "nat100", "nat101", "nat102",
+ "nat103", "nat104", "nat105", "nat106", "nat107", "nat108", "nat109",
+ "nat110", "nat111", "nat112", "nat113", "nat114", "nat115", "nat116",
+ "nat117", "nat118", "nat119", "nat120", "nat121", "nat122", "nat123",
+ "nat124", "nat125", "nat126", "nat127",
"bof",
-
- "r32", "r33", "r34", "r35", "r36", "r37", "r38", "r39",
- "r40", "r41", "r42", "r43", "r44", "r45", "r46", "r47",
- "r48", "r49", "r50", "r51", "r52", "r53", "r54", "r55",
- "r56", "r57", "r58", "r59", "r60", "r61", "r62", "r63",
- "r64", "r65", "r66", "r67", "r68", "r69", "r70", "r71",
- "r72", "r73", "r74", "r75", "r76", "r77", "r78", "r79",
- "r80", "r81", "r82", "r83", "r84", "r85", "r86", "r87",
- "r88", "r89", "r90", "r91", "r92", "r93", "r94", "r95",
- "r96", "r97", "r98", "r99", "r100", "r101", "r102", "r103",
- "r104", "r105", "r106", "r107", "r108", "r109", "r110", "r111",
- "r112", "r113", "r114", "r115", "r116", "r117", "r118", "r119",
- "r120", "r121", "r122", "r123", "r124", "r125", "r126", "r127",
-
- "p0", "p1", "p2", "p3", "p4", "p5", "p6", "p7",
- "p8", "p9", "p10", "p11", "p12", "p13", "p14", "p15",
- "p16", "p17", "p18", "p19", "p20", "p21", "p22", "p23",
- "p24", "p25", "p26", "p27", "p28", "p29", "p30", "p31",
- "p32", "p33", "p34", "p35", "p36", "p37", "p38", "p39",
- "p40", "p41", "p42", "p43", "p44", "p45", "p46", "p47",
- "p48", "p49", "p50", "p51", "p52", "p53", "p54", "p55",
- "p56", "p57", "p58", "p59", "p60", "p61", "p62", "p63",
+
+ "r32", "r33", "r34", "r35", "r36", "r37", "r38",
+ "r39", "r40", "r41", "r42", "r43", "r44", "r45",
+ "r46", "r47", "r48", "r49", "r50", "r51", "r52",
+ "r53", "r54", "r55", "r56", "r57", "r58", "r59",
+ "r60", "r61", "r62", "r63", "r64", "r65", "r66",
+ "r67", "r68", "r69", "r70", "r71", "r72", "r73",
+ "r74", "r75", "r76", "r77", "r78", "r79", "r80",
+ "r81", "r82", "r83", "r84", "r85", "r86", "r87",
+ "r88", "r89", "r90", "r91", "r92", "r93", "r94",
+ "r95", "r96", "r97", "r98", "r99", "r100", "r101",
+ "r102", "r103", "r104", "r105", "r106", "r107", "r108",
+ "r109", "r110", "r111", "r112", "r113", "r114", "r115",
+ "r116", "r117", "r118", "r119", "r120", "r121", "r122",
+ "r123", "r124", "r125", "r126", "r127",
+
+ "p0", "p1", "p2", "p3", "p4", "p5", "p6",
+ "p7", "p8", "p9", "p10", "p11", "p12", "p13",
+ "p14", "p15", "p16", "p17", "p18", "p19", "p20",
+ "p21", "p22", "p23", "p24", "p25", "p26", "p27",
+ "p28", "p29", "p30", "p31", "p32", "p33", "p34",
+ "p35", "p36", "p37", "p38", "p39", "p40", "p41",
+ "p42", "p43", "p44", "p45", "p46", "p47", "p48",
+ "p49", "p50", "p51", "p52", "p53", "p54", "p55",
+ "p56", "p57", "p58", "p59", "p60", "p61", "p62",
+ "p63",
};
struct ia64_frame_cache
{
- CORE_ADDR base; /* frame pointer base for frame */
- CORE_ADDR pc; /* function start pc for frame */
- CORE_ADDR saved_sp; /* stack pointer for frame */
- CORE_ADDR bsp; /* points at r32 for the current frame */
- CORE_ADDR cfm; /* cfm value for current frame */
- CORE_ADDR prev_cfm; /* cfm value for previous frame */
- int frameless;
- int sof; /* Size of frame (decoded from cfm value). */
- int sol; /* Size of locals (decoded from cfm value). */
- int sor; /* Number of rotating registers (decoded from
+ CORE_ADDR base; /* frame pointer base for frame */
+ CORE_ADDR pc; /* function start pc for frame */
+ CORE_ADDR saved_sp; /* stack pointer for frame */
+ CORE_ADDR bsp; /* points at r32 for the current frame */
+ CORE_ADDR cfm; /* cfm value for current frame */
+ CORE_ADDR prev_cfm; /* cfm value for previous frame */
+ int frameless;
+ int sof; /* Size of frame (decoded from cfm value). */
+ int sol; /* Size of locals (decoded from cfm value). */
+ int sor; /* Number of rotating registers (decoded from
cfm value). */
CORE_ADDR after_prologue;
/* Address of first instruction after the last
@@ -274,13 +298,12 @@ struct ia64_frame_cache
int mem_stack_frame_size;
/* Size of the memory stack frame (may be zero),
or -1 if it has not been determined yet. */
- int fp_reg; /* Register number (if any) used a frame pointer
+ int fp_reg; /* Register number (if any) used a frame pointer
for this frame. 0 if no register is being used
as the frame pointer. */
-
+
/* Saved registers. */
CORE_ADDR saved_regs[NUM_IA64_RAW_REGS];
-
};
static int
@@ -289,23 +312,37 @@ floatformat_valid (const struct floatformat *fmt, const void *from)
return 1;
}
-static const struct floatformat floatformat_ia64_ext_little =
-{
- floatformat_little, 82, 0, 1, 17, 65535, 0x1ffff, 18, 64,
- floatformat_intbit_yes, "floatformat_ia64_ext_little", floatformat_valid, NULL
-};
-
-static const struct floatformat floatformat_ia64_ext_big =
-{
- floatformat_big, 82, 46, 47, 17, 65535, 0x1ffff, 64, 64,
- floatformat_intbit_yes, "floatformat_ia64_ext_big", floatformat_valid
-};
-
-static const struct floatformat *floatformats_ia64_ext[2] =
-{
- &floatformat_ia64_ext_big,
- &floatformat_ia64_ext_little
-};
+static const struct floatformat floatformat_ia64_ext_little
+ = { floatformat_little,
+ 82,
+ 0,
+ 1,
+ 17,
+ 65535,
+ 0x1ffff,
+ 18,
+ 64,
+ floatformat_intbit_yes,
+ "floatformat_ia64_ext_little",
+ floatformat_valid,
+ NULL };
+
+static const struct floatformat floatformat_ia64_ext_big
+ = { floatformat_big,
+ 82,
+ 46,
+ 47,
+ 17,
+ 65535,
+ 0x1ffff,
+ 64,
+ 64,
+ floatformat_intbit_yes,
+ "floatformat_ia64_ext_big",
+ floatformat_valid };
+
+static const struct floatformat *floatformats_ia64_ext[2]
+ = { &floatformat_ia64_ext_big, &floatformat_ia64_ext_little };
static struct type *
ia64_ext_type (struct gdbarch *gdbarch)
@@ -339,7 +376,7 @@ ia64_register_reggroup_p (struct gdbarch *gdbarch, int regnum,
if (group == general_reggroup)
return (!vector_p && !float_p);
if (group == save_reggroup || group == restore_reggroup)
- return raw_p;
+ return raw_p;
return 0;
}
@@ -366,7 +403,6 @@ ia64_dwarf_reg_to_regnum (struct gdbarch *gdbarch, int reg)
return reg;
}
-
/* Extract ``len'' bits from an instruction bundle starting at
bit ``from''. */
@@ -388,7 +424,7 @@ extract_bit_field (const gdb_byte *bundle, int from, int len)
result = c >> (from % 8);
lshift = 8 - (from % 8);
- for (i = from_byte+1; i < to_byte; i++)
+ for (i = from_byte + 1; i < to_byte; i++)
{
result |= ((long long) b[i]) << lshift;
lshift += 8;
@@ -435,7 +471,7 @@ replace_bit_field (gdb_byte *bundle, long long val, int from, int len)
b[from_byte] = c;
val >>= 8 - from % 8;
- for (i = from_byte+1; i < to_byte; i++)
+ for (i = from_byte + 1; i < to_byte; i++)
{
c = val & 0xff;
val >>= 8;
@@ -459,7 +495,7 @@ replace_bit_field (gdb_byte *bundle, long long val, int from, int len)
static long long
slotN_contents (gdb_byte *bundle, int slotnum)
{
- return extract_bit_field (bundle, 5+41*slotnum, 41);
+ return extract_bit_field (bundle, 5 + 41 * slotnum, 41);
}
/* Store an instruction in an instruction bundle. */
@@ -467,43 +503,42 @@ slotN_contents (gdb_byte *bundle, int slotnum)
static void
replace_slotN_contents (gdb_byte *bundle, long long instr, int slotnum)
{
- replace_bit_field (bundle, instr, 5+41*slotnum, 41);
-}
-
-static const enum ia64_instruction_type template_encoding_table[32][3] =
-{
- { M, I, I }, /* 00 */
- { M, I, I }, /* 01 */
- { M, I, I }, /* 02 */
- { M, I, I }, /* 03 */
- { M, L, X }, /* 04 */
- { M, L, X }, /* 05 */
- { undefined, undefined, undefined }, /* 06 */
- { undefined, undefined, undefined }, /* 07 */
- { M, M, I }, /* 08 */
- { M, M, I }, /* 09 */
- { M, M, I }, /* 0A */
- { M, M, I }, /* 0B */
- { M, F, I }, /* 0C */
- { M, F, I }, /* 0D */
- { M, M, F }, /* 0E */
- { M, M, F }, /* 0F */
- { M, I, B }, /* 10 */
- { M, I, B }, /* 11 */
- { M, B, B }, /* 12 */
- { M, B, B }, /* 13 */
- { undefined, undefined, undefined }, /* 14 */
- { undefined, undefined, undefined }, /* 15 */
- { B, B, B }, /* 16 */
- { B, B, B }, /* 17 */
- { M, M, B }, /* 18 */
- { M, M, B }, /* 19 */
- { undefined, undefined, undefined }, /* 1A */
- { undefined, undefined, undefined }, /* 1B */
- { M, F, B }, /* 1C */
- { M, F, B }, /* 1D */
- { undefined, undefined, undefined }, /* 1E */
- { undefined, undefined, undefined }, /* 1F */
+ replace_bit_field (bundle, instr, 5 + 41 * slotnum, 41);
+}
+
+static const enum ia64_instruction_type template_encoding_table[32][3] = {
+ { M, I, I }, /* 00 */
+ { M, I, I }, /* 01 */
+ { M, I, I }, /* 02 */
+ { M, I, I }, /* 03 */
+ { M, L, X }, /* 04 */
+ { M, L, X }, /* 05 */
+ { undefined, undefined, undefined }, /* 06 */
+ { undefined, undefined, undefined }, /* 07 */
+ { M, M, I }, /* 08 */
+ { M, M, I }, /* 09 */
+ { M, M, I }, /* 0A */
+ { M, M, I }, /* 0B */
+ { M, F, I }, /* 0C */
+ { M, F, I }, /* 0D */
+ { M, M, F }, /* 0E */
+ { M, M, F }, /* 0F */
+ { M, I, B }, /* 10 */
+ { M, I, B }, /* 11 */
+ { M, B, B }, /* 12 */
+ { M, B, B }, /* 13 */
+ { undefined, undefined, undefined }, /* 14 */
+ { undefined, undefined, undefined }, /* 15 */
+ { B, B, B }, /* 16 */
+ { B, B, B }, /* 17 */
+ { M, M, B }, /* 18 */
+ { M, M, B }, /* 19 */
+ { undefined, undefined, undefined }, /* 1A */
+ { undefined, undefined, undefined }, /* 1B */
+ { M, F, B }, /* 1C */
+ { M, F, B }, /* 1D */
+ { undefined, undefined, undefined }, /* 1E */
+ { undefined, undefined, undefined }, /* 1F */
};
/* Fetch and (partially) decode an instruction at ADDR and return the
@@ -532,8 +567,8 @@ fetch_instruction (CORE_ADDR addr, ia64_instruction_type *it, long long *instr)
at the assembly language level. */
if (slotnum > 2)
{
- warning (_("Can't fetch instructions for slot numbers greater than 2.\n"
- "Using slot 0 instead"));
+ warning (_ ("Can't fetch instructions for slot numbers greater than 2.\n"
+ "Using slot 0 instead"));
slotnum = 0;
}
@@ -546,7 +581,7 @@ fetch_instruction (CORE_ADDR addr, ia64_instruction_type *it, long long *instr)
*instr = slotN_contents (bundle, slotnum);
templ = extract_bit_field (bundle, 0, 5);
- *it = template_encoding_table[(int)templ][slotnum];
+ *it = template_encoding_table[(int) templ][slotnum];
if (slotnum == 2 || (slotnum == 1 && *it == L))
addr += 16;
@@ -647,7 +682,7 @@ ia64_memory_insert_breakpoint (struct gdbarch *gdbarch,
int templ;
if (slotnum > 2)
- error (_("Can't insert breakpoint for slot numbers greater than 2."));
+ error (_ ("Can't insert breakpoint for slot numbers greater than 2."));
addr &= ~0x0f;
@@ -678,7 +713,7 @@ ia64_memory_insert_breakpoint (struct gdbarch *gdbarch,
address, as this is the second half of an instruction that
lives in slot 1 of that bundle. */
gdb_assert (slotnum == 2);
- error (_("Can't insert breakpoint for non-existing slot X"));
+ error (_ ("Can't insert breakpoint for non-existing slot X"));
}
if (template_encoding_table[templ][slotnum] == L)
{
@@ -713,7 +748,7 @@ ia64_memory_insert_breakpoint (struct gdbarch *gdbarch,
a single instance by update_global_location_list. */
instr_breakpoint = slotN_contents (bundle, slotnum);
if (instr_breakpoint == IA64_BREAKPOINT)
- internal_error (_("Address %s already contains a breakpoint."),
+ internal_error (_ ("Address %s already contains a breakpoint."),
paddress (gdbarch, bp_tgt->placed_address));
replace_slotN_contents (bundle, IA64_BREAKPOINT, slotnum);
@@ -760,8 +795,8 @@ ia64_memory_remove_breakpoint (struct gdbarch *gdbarch,
for us attempting to remove one there, except if the program's
code somehow got modified in memory. */
gdb_assert (slotnum == 2);
- warning (_("Cannot remove breakpoint at address %s from non-existing "
- "X-type slot, memory has changed underneath"),
+ warning (_ ("Cannot remove breakpoint at address %s from non-existing "
+ "X-type slot, memory has changed underneath"),
paddress (gdbarch, bp_tgt->placed_address));
return -1;
}
@@ -779,8 +814,8 @@ ia64_memory_remove_breakpoint (struct gdbarch *gdbarch,
instr_breakpoint = slotN_contents (bundle_mem, slotnum);
if (instr_breakpoint != IA64_BREAKPOINT)
{
- warning (_("Cannot remove breakpoint at address %s, "
- "no break instruction at such address."),
+ warning (_ ("Cannot remove breakpoint at address %s, "
+ "no break instruction at such address."),
paddress (gdbarch, bp_tgt->placed_address));
return -1;
}
@@ -816,8 +851,8 @@ ia64_breakpoint_kind_from_pc (struct gdbarch *gdbarch, CORE_ADDR *pcptr)
make a match for permanent breakpoints. */
static const gdb_byte *
-ia64_breakpoint_from_pc (struct gdbarch *gdbarch,
- CORE_ADDR *pcptr, int *lenptr)
+ia64_breakpoint_from_pc (struct gdbarch *gdbarch, CORE_ADDR *pcptr,
+ int *lenptr)
{
CORE_ADDR addr = *pcptr;
static gdb_byte bundle[BUNDLE_LEN];
@@ -827,7 +862,7 @@ ia64_breakpoint_from_pc (struct gdbarch *gdbarch,
int templ;
if (slotnum > 2)
- error (_("Can't insert breakpoint for slot numbers greater than 2."));
+ error (_ ("Can't insert breakpoint for slot numbers greater than 2."));
addr &= ~0x0f;
@@ -857,7 +892,7 @@ ia64_breakpoint_from_pc (struct gdbarch *gdbarch,
if (template_encoding_table[templ][slotnum] == X)
{
gdb_assert (slotnum == 2);
- error (_("Can't insert breakpoint for non-existing slot X"));
+ error (_ ("Can't insert breakpoint for non-existing slot X"));
}
if (template_encoding_table[templ][slotnum] == L)
{
@@ -896,7 +931,7 @@ ia64_write_pc (struct regcache *regcache, CORE_ADDR new_pc)
regcache_cooked_read_unsigned (regcache, IA64_PSR_REGNUM, &psr_value);
psr_value &= ~(3LL << 41);
- psr_value |= (ULONGEST)(slot_num & 0x3) << 41;
+ psr_value |= (ULONGEST) (slot_num & 0x3) << 41;
new_pc &= ~0xfLL;
@@ -909,7 +944,7 @@ ia64_write_pc (struct regcache *regcache, CORE_ADDR new_pc)
/* Returns the address of the slot that's NSLOTS slots away from
the address ADDR. NSLOTS may be positive or negative. */
static CORE_ADDR
-rse_address_add(CORE_ADDR addr, int nslots)
+rse_address_add (CORE_ADDR addr, int nslots)
{
CORE_ADDR new_addr;
int mandatory_nat_slots = nslots / 63;
@@ -917,18 +952,19 @@ rse_address_add(CORE_ADDR addr, int nslots)
new_addr = addr + 8 * (nslots + mandatory_nat_slots);
- if ((new_addr >> 9) != ((addr + 8 * 64 * mandatory_nat_slots) >> 9))
+ if ((new_addr >> 9) != ((addr + 8 * 64 * mandatory_nat_slots) >> 9))
new_addr += 8 * direction;
- if (IS_NaT_COLLECTION_ADDR(new_addr))
+ if (IS_NaT_COLLECTION_ADDR (new_addr))
new_addr += 8 * direction;
return new_addr;
}
static enum register_status
-ia64_pseudo_register_read (struct gdbarch *gdbarch, readable_regcache *regcache,
- int regnum, gdb_byte *buf)
+ia64_pseudo_register_read (struct gdbarch *gdbarch,
+ readable_regcache *regcache, int regnum,
+ gdb_byte *buf)
{
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
enum register_status status;
@@ -962,11 +998,11 @@ ia64_pseudo_register_read (struct gdbarch *gdbarch, readable_regcache *regcache,
subtract the size of frame from it to get start of
register frame. */
bsp = rse_address_add (bsp, -(cfm & 0x7f));
-
- if ((cfm & 0x7f) > regnum - V32_REGNUM)
+
+ if ((cfm & 0x7f) > regnum - V32_REGNUM)
{
ULONGEST reg_addr = rse_address_add (bsp, (regnum - V32_REGNUM));
- reg = read_memory_integer ((CORE_ADDR)reg_addr, 8, byte_order);
+ reg = read_memory_integer ((CORE_ADDR) reg_addr, 8, byte_order);
store_unsigned_integer (buf, register_size (gdbarch, regnum),
byte_order, reg);
}
@@ -984,8 +1020,8 @@ ia64_pseudo_register_read (struct gdbarch *gdbarch, readable_regcache *regcache,
if (status != REG_VALID)
return status;
unatN_val = (unat & (1LL << (regnum - IA64_NAT0_REGNUM))) != 0;
- store_unsigned_integer (buf, register_size (gdbarch, regnum),
- byte_order, unatN_val);
+ store_unsigned_integer (buf, register_size (gdbarch, regnum), byte_order,
+ unatN_val);
}
else if (IA64_NAT32_REGNUM <= regnum && regnum <= IA64_NAT127_REGNUM)
{
@@ -1005,10 +1041,10 @@ ia64_pseudo_register_read (struct gdbarch *gdbarch, readable_regcache *regcache,
/* The bsp points at the end of the register frame so we
subtract the size of frame from it to get start of register frame. */
bsp = rse_address_add (bsp, -(cfm & 0x7f));
-
- if ((cfm & 0x7f) > regnum - V32_REGNUM)
+
+ if ((cfm & 0x7f) > regnum - V32_REGNUM)
gr_addr = rse_address_add (bsp, (regnum - V32_REGNUM));
-
+
if (gr_addr != 0)
{
/* Compute address of nat collection bits. */
@@ -1025,9 +1061,9 @@ ia64_pseudo_register_read (struct gdbarch *gdbarch, readable_regcache *regcache,
nat_bit = (gr_addr >> 3) & 0x3f;
natN_val = (nat_collection >> nat_bit) & 1;
}
-
- store_unsigned_integer (buf, register_size (gdbarch, regnum),
- byte_order, natN_val);
+
+ store_unsigned_integer (buf, register_size (gdbarch, regnum), byte_order,
+ natN_val);
}
else if (regnum == VBOF_REGNUM)
{
@@ -1046,8 +1082,8 @@ ia64_pseudo_register_read (struct gdbarch *gdbarch, readable_regcache *regcache,
/* The bsp points at the end of the register frame so we
subtract the size of frame from it to get beginning of frame. */
vbsp = rse_address_add (bsp, -(cfm & 0x7f));
- store_unsigned_integer (buf, register_size (gdbarch, regnum),
- byte_order, vbsp);
+ store_unsigned_integer (buf, register_size (gdbarch, regnum), byte_order,
+ vbsp);
}
else if (VP0_REGNUM <= regnum && regnum <= VP63_REGNUM)
{
@@ -1069,12 +1105,11 @@ ia64_pseudo_register_read (struct gdbarch *gdbarch, readable_regcache *regcache,
int rrb_pr = (cfm >> 32) & 0x3f;
/* Adjust the register number to account for register rotation. */
- regnum = VP16_REGNUM
- + ((regnum - VP16_REGNUM) + rrb_pr) % 48;
+ regnum = VP16_REGNUM + ((regnum - VP16_REGNUM) + rrb_pr) % 48;
}
prN_val = (pr & (1LL << (regnum - VP0_REGNUM))) != 0;
- store_unsigned_integer (buf, register_size (gdbarch, regnum),
- byte_order, prN_val);
+ store_unsigned_integer (buf, register_size (gdbarch, regnum), byte_order,
+ prN_val);
}
else
memset (buf, 0, register_size (gdbarch, regnum));
@@ -1096,8 +1131,8 @@ ia64_pseudo_register_write (struct gdbarch *gdbarch, struct regcache *regcache,
regcache_cooked_read_unsigned (regcache, IA64_CFM_REGNUM, &cfm);
bsp = rse_address_add (bsp, -(cfm & 0x7f));
-
- if ((cfm & 0x7f) > regnum - V32_REGNUM)
+
+ if ((cfm & 0x7f) > regnum - V32_REGNUM)
{
ULONGEST reg_addr = rse_address_add (bsp, (regnum - V32_REGNUM));
write_memory (reg_addr, buf, 8);
@@ -1107,9 +1142,9 @@ ia64_pseudo_register_write (struct gdbarch *gdbarch, struct regcache *regcache,
{
ULONGEST unatN_val, unat, unatN_mask;
regcache_cooked_read_unsigned (regcache, IA64_UNAT_REGNUM, &unat);
- unatN_val = extract_unsigned_integer (buf, register_size (gdbarch,
- regnum),
- byte_order);
+ unatN_val
+ = extract_unsigned_integer (buf, register_size (gdbarch, regnum),
+ byte_order);
unatN_mask = (1LL << (regnum - IA64_NAT0_REGNUM));
if (unatN_val == 0)
unat &= ~unatN_mask;
@@ -1129,13 +1164,13 @@ ia64_pseudo_register_write (struct gdbarch *gdbarch, struct regcache *regcache,
/* The bsp points at the end of the register frame so we
subtract the size of frame from it to get start of register frame. */
bsp = rse_address_add (bsp, -(cfm & 0x7f));
-
- if ((cfm & 0x7f) > regnum - V32_REGNUM)
+
+ if ((cfm & 0x7f) > regnum - V32_REGNUM)
gr_addr = rse_address_add (bsp, (regnum - V32_REGNUM));
-
- natN_val = extract_unsigned_integer (buf, register_size (gdbarch,
- regnum),
- byte_order);
+
+ natN_val
+ = extract_unsigned_integer (buf, register_size (gdbarch, regnum),
+ byte_order);
if (gr_addr != 0 && (natN_val == 0 || natN_val == 1))
{
@@ -1149,8 +1184,7 @@ ia64_pseudo_register_write (struct gdbarch *gdbarch, struct regcache *regcache,
collection from the computed address. */
if (nat_addr >= bsp)
{
- regcache_cooked_read_unsigned (regcache,
- IA64_RNAT_REGNUM,
+ regcache_cooked_read_unsigned (regcache, IA64_RNAT_REGNUM,
&nat_collection);
if (natN_val)
nat_collection |= natN_mask;
@@ -1190,8 +1224,7 @@ ia64_pseudo_register_write (struct gdbarch *gdbarch, struct regcache *regcache,
int rrb_pr = (cfm >> 32) & 0x3f;
/* Adjust the register number to account for register rotation. */
- regnum = VP16_REGNUM
- + ((regnum - VP16_REGNUM) + rrb_pr) % 48;
+ regnum = VP16_REGNUM + ((regnum - VP16_REGNUM) + rrb_pr) % 48;
}
prN_val = extract_unsigned_integer (buf, register_size (gdbarch, regnum),
byte_order);
@@ -1216,19 +1249,17 @@ ia64_convert_register_p (struct gdbarch *gdbarch, int regno, struct type *type)
}
static int
-ia64_register_to_value (frame_info_ptr frame, int regnum,
- struct type *valtype, gdb_byte *out,
- int *optimizedp, int *unavailablep)
+ia64_register_to_value (frame_info_ptr frame, int regnum, struct type *valtype,
+ gdb_byte *out, int *optimizedp, int *unavailablep)
{
struct gdbarch *gdbarch = get_frame_arch (frame);
gdb_byte in[IA64_FP_REGISTER_SIZE];
/* Convert to TYPE. */
- if (!get_frame_register_bytes (frame, regnum, 0,
- gdb::make_array_view (in,
- register_size (gdbarch,
- regnum)),
- optimizedp, unavailablep))
+ if (!get_frame_register_bytes (
+ frame, regnum, 0,
+ gdb::make_array_view (in, register_size (gdbarch, regnum)), optimizedp,
+ unavailablep))
return 0;
target_float_convert (in, ia64_ext_type (gdbarch), out, valtype);
@@ -1237,8 +1268,8 @@ ia64_register_to_value (frame_info_ptr frame, int regnum,
}
static void
-ia64_value_to_register (frame_info_ptr frame, int regnum,
- struct type *valtype, const gdb_byte *in)
+ia64_value_to_register (frame_info_ptr frame, int regnum, struct type *valtype,
+ const gdb_byte *in)
{
struct gdbarch *gdbarch = get_frame_arch (frame);
gdb_byte out[IA64_FP_REGISTER_SIZE];
@@ -1246,7 +1277,6 @@ ia64_value_to_register (frame_info_ptr frame, int regnum,
put_frame_register (frame, regnum, out);
}
-
/* Limit the number of skipped non-prologue instructions since examining
of the prologue is expensive. */
static int max_skip_non_prologue_insns = 40;
@@ -1292,16 +1322,15 @@ refine_prologue_limit (CORE_ADDR pc, CORE_ADDR lim_pc, int *trust_limit)
found for the function. (It can be less than when the
scheduler puts a body instruction before the first prologue
instruction.) */
- for (i = 2 * max_skip_non_prologue_insns;
- i > 0 && (lim_pc == 0 || addr < lim_pc);
- i--)
+ for (i = 2 * max_skip_non_prologue_insns;
+ i > 0 && (lim_pc == 0 || addr < lim_pc); i--)
{
struct symtab_and_line sal;
sal = find_pc_line (addr, 0);
if (sal.line == 0)
break;
- if (sal.line <= prologue_sal.line
+ if (sal.line <= prologue_sal.line
&& sal.symtab == prologue_sal.symtab)
{
prologue_sal = sal;
@@ -1319,13 +1348,14 @@ refine_prologue_limit (CORE_ADDR pc, CORE_ADDR lim_pc, int *trust_limit)
return lim_pc;
}
-#define isScratch(_regnum_) ((_regnum_) == 2 || (_regnum_) == 3 \
- || (8 <= (_regnum_) && (_regnum_) <= 11) \
- || (14 <= (_regnum_) && (_regnum_) <= 31))
-#define imm9(_instr_) \
- ( ((((_instr_) & 0x01000000000LL) ? -1 : 0) << 8) \
- | (((_instr_) & 0x00008000000LL) >> 20) \
- | (((_instr_) & 0x00000001fc0LL) >> 6))
+#define isScratch(_regnum_) \
+ ((_regnum_) == 2 || (_regnum_) == 3 \
+ || (8 <= (_regnum_) && (_regnum_) <= 11) \
+ || (14 <= (_regnum_) && (_regnum_) <= 31))
+#define imm9(_instr_) \
+ (((((_instr_) &0x01000000000LL) ? -1 : 0) << 8) \
+ | (((_instr_) &0x00008000000LL) >> 20) \
+ | (((_instr_) &0x00000001fc0LL) >> 6))
/* Allocate and initialize a frame cache. */
@@ -1356,21 +1386,20 @@ ia64_alloc_frame_cache (void)
}
static CORE_ADDR
-examine_prologue (CORE_ADDR pc, CORE_ADDR lim_pc,
- frame_info_ptr this_frame,
+examine_prologue (CORE_ADDR pc, CORE_ADDR lim_pc, frame_info_ptr this_frame,
struct ia64_frame_cache *cache)
{
CORE_ADDR next_pc;
CORE_ADDR last_prologue_pc = pc;
ia64_instruction_type it;
long long instr;
- int cfm_reg = 0;
- int ret_reg = 0;
- int fp_reg = 0;
+ int cfm_reg = 0;
+ int ret_reg = 0;
+ int fp_reg = 0;
int unat_save_reg = 0;
int pr_save_reg = 0;
int mem_stack_frame_size = 0;
- int spill_reg = 0;
+ int spill_reg = 0;
CORE_ADDR spill_addr = 0;
char instores[8];
char infpstores[8];
@@ -1386,8 +1415,7 @@ examine_prologue (CORE_ADDR pc, CORE_ADDR lim_pc,
memset (infpstores, 0, sizeof infpstores);
memset (reg_contents, 0, sizeof reg_contents);
- if (cache->after_prologue != 0
- && cache->after_prologue <= lim_pc)
+ if (cache->after_prologue != 0 && cache->after_prologue <= lim_pc)
return cache->after_prologue;
lim_pc = refine_prologue_limit (pc, lim_pc, &trust_limit);
@@ -1395,8 +1423,8 @@ examine_prologue (CORE_ADDR pc, CORE_ADDR lim_pc,
/* We want to check if we have a recognizable function start before we
look ahead for a prologue. */
- if (pc < lim_pc && next_pc
- && it == M && ((instr & 0x1ee0000003fLL) == 0x02c00000000LL))
+ if (pc < lim_pc && next_pc && it == M
+ && ((instr & 0x1ee0000003fLL) == 0x02c00000000LL))
{
/* alloc - start of a regular function. */
int sol_bits = (int) ((instr & 0x00007f00000LL) >> 20);
@@ -1408,9 +1436,9 @@ examine_prologue (CORE_ADDR pc, CORE_ADDR lim_pc,
we do not want to interpret the prologue and calculate the
addresses of various registers such as the return address.
We will instead treat the frame as frameless. */
- if (!this_frame ||
- (sof_bits == (cache->cfm & 0x7f) &&
- sol_bits == ((cache->cfm >> 7) & 0x7f)))
+ if (!this_frame
+ || (sof_bits == (cache->cfm & 0x7f)
+ && sol_bits == ((cache->cfm >> 7) & 0x7f)))
frameless = 0;
cfm_reg = rN;
@@ -1420,12 +1448,11 @@ examine_prologue (CORE_ADDR pc, CORE_ADDR lim_pc,
else
{
/* Look for a leaf routine. */
- if (pc < lim_pc && next_pc
- && (it == I || it == M)
+ if (pc < lim_pc && next_pc && (it == I || it == M)
&& ((instr & 0x1ee00000000LL) == 0x10800000000LL))
{
/* adds rN = imm14, rM (or mov rN, rM when imm14 is 0) */
- int imm = (int) ((((instr & 0x01000000000LL) ? -1 : 0) << 13)
+ int imm = (int) ((((instr & 0x01000000000LL) ? -1 : 0) << 13)
| ((instr & 0x001f8000000LL) >> 20)
| ((instr & 0x000000fe000LL) >> 13));
int rM = (int) ((instr & 0x00007f00000LL) >> 20);
@@ -1437,13 +1464,13 @@ examine_prologue (CORE_ADDR pc, CORE_ADDR lim_pc,
fp_reg = rN;
last_prologue_pc = next_pc;
}
- }
+ }
/* If we don't recognize a regular function or leaf routine, we are
done. */
if (!fp_reg)
{
- pc = lim_pc;
+ pc = lim_pc;
if (trust_limit)
last_prologue_pc = lim_pc;
}
@@ -1459,16 +1486,15 @@ examine_prologue (CORE_ADDR pc, CORE_ADDR lim_pc,
if (it == B && ((instr & 0x1e1f800003fLL) != 0x04000000000LL))
{
- /* Exit loop upon hitting a non-nop branch instruction. */
+ /* Exit loop upon hitting a non-nop branch instruction. */
if (trust_limit)
lim_pc = pc;
break;
}
- else if (((instr & 0x3fLL) != 0LL) &&
- (frameless || ret_reg != 0))
+ else if (((instr & 0x3fLL) != 0LL) && (frameless || ret_reg != 0))
{
/* Exit loop upon hitting a predicated instruction if
- we already have the return register or if we are frameless. */
+ we already have the return register or if we are frameless. */
if (trust_limit)
lim_pc = pc;
break;
@@ -1486,11 +1512,11 @@ examine_prologue (CORE_ADDR pc, CORE_ADDR lim_pc,
last_prologue_pc = next_pc;
}
}
- else if ((it == I || it == M)
- && ((instr & 0x1ee00000000LL) == 0x10800000000LL))
+ else if ((it == I || it == M)
+ && ((instr & 0x1ee00000000LL) == 0x10800000000LL))
{
/* adds rN = imm14, rM (or mov rN, rM when imm14 is 0) */
- int imm = (int) ((((instr & 0x01000000000LL) ? -1 : 0) << 13)
+ int imm = (int) ((((instr & 0x01000000000LL) ? -1 : 0) << 13)
| ((instr & 0x001f8000000LL) >> 20)
| ((instr & 0x000000fe000LL) >> 13));
int rM = (int) ((instr & 0x00007f00000LL) >> 20);
@@ -1509,8 +1535,8 @@ examine_prologue (CORE_ADDR pc, CORE_ADDR lim_pc,
mem_stack_frame_size -= imm;
last_prologue_pc = next_pc;
}
- else if (qp == 0 && rN == 2
- && ((rM == fp_reg && fp_reg != 0) || rM == 12))
+ else if (qp == 0 && rN == 2
+ && ((rM == fp_reg && fp_reg != 0) || rM == 12))
{
CORE_ADDR saved_sp = 0;
/* adds r2, spilloffset, rFramePointer
@@ -1526,38 +1552,35 @@ examine_prologue (CORE_ADDR pc, CORE_ADDR lim_pc,
where the pc is. If it's still early in the prologue
this'll be wrong. FIXME */
if (this_frame)
- saved_sp = get_frame_register_unsigned (this_frame,
- sp_regnum);
- spill_addr = saved_sp
- + (rM == 12 ? 0 : mem_stack_frame_size)
- + imm;
- spill_reg = rN;
+ saved_sp = get_frame_register_unsigned (this_frame, sp_regnum);
+ spill_addr
+ = saved_sp + (rM == 12 ? 0 : mem_stack_frame_size) + imm;
+ spill_reg = rN;
last_prologue_pc = next_pc;
}
- else if (qp == 0 && rM >= 32 && rM < 40 && !instores[rM-32] &&
- rN < 256 && imm == 0)
+ else if (qp == 0 && rM >= 32 && rM < 40 && !instores[rM - 32]
+ && rN < 256 && imm == 0)
{
/* mov rN, rM where rM is an input register. */
reg_contents[rN] = rM;
last_prologue_pc = next_pc;
}
- else if (frameless && qp == 0 && rN == fp_reg && imm == 0 &&
- rM == 2)
+ else if (frameless && qp == 0 && rN == fp_reg && imm == 0 && rM == 2)
{
/* mov r12, r2 */
last_prologue_pc = next_pc;
break;
}
}
- else if (it == M
- && ( ((instr & 0x1efc0000000LL) == 0x0eec0000000LL)
- || ((instr & 0x1ffc8000000LL) == 0x0cec0000000LL) ))
+ else if (it == M
+ && (((instr & 0x1efc0000000LL) == 0x0eec0000000LL)
+ || ((instr & 0x1ffc8000000LL) == 0x0cec0000000LL)))
{
/* stf.spill [rN] = fM, imm9
or
stf.spill [rN] = fM */
- int imm = imm9(instr);
+ int imm = imm9 (instr);
int rN = (int) ((instr & 0x00007f00000LL) >> 20);
int fM = (int) ((instr & 0x000000fe000LL) >> 13);
int qp = (int) (instr & 0x0000000003fLL);
@@ -1569,20 +1592,20 @@ examine_prologue (CORE_ADDR pc, CORE_ADDR lim_pc,
if ((instr & 0x1efc0000000LL) == 0x0eec0000000LL)
spill_addr += imm;
else
- spill_addr = 0; /* last one; must be done. */
+ spill_addr = 0; /* last one; must be done. */
last_prologue_pc = next_pc;
}
}
else if ((it == M && ((instr & 0x1eff8000000LL) == 0x02110000000LL))
- || (it == I && ((instr & 0x1eff8000000LL) == 0x00050000000LL)) )
+ || (it == I && ((instr & 0x1eff8000000LL) == 0x00050000000LL)))
{
/* mov.m rN = arM
or
mov.i rN = arM */
int arM = (int) ((instr & 0x00007f00000LL) >> 20);
- int rN = (int) ((instr & 0x00000001fc0LL) >> 6);
- int qp = (int) (instr & 0x0000000003fLL);
+ int rN = (int) ((instr & 0x00000001fc0LL) >> 6);
+ int qp = (int) (instr & 0x0000000003fLL);
if (qp == 0 && isScratch (rN) && arM == 36 /* ar.unat */)
{
/* We have something like "mov.m r3 = ar.unat". Remember the
@@ -1594,17 +1617,17 @@ examine_prologue (CORE_ADDR pc, CORE_ADDR lim_pc,
else if (it == I && ((instr & 0x1eff8000000LL) == 0x00198000000LL))
{
/* mov rN = pr */
- int rN = (int) ((instr & 0x00000001fc0LL) >> 6);
- int qp = (int) (instr & 0x0000000003fLL);
+ int rN = (int) ((instr & 0x00000001fc0LL) >> 6);
+ int qp = (int) (instr & 0x0000000003fLL);
if (qp == 0 && isScratch (rN))
{
pr_save_reg = rN;
last_prologue_pc = next_pc;
}
}
- else if (it == M
- && ( ((instr & 0x1ffc8000000LL) == 0x08cc0000000LL)
- || ((instr & 0x1efc0000000LL) == 0x0acc0000000LL)))
+ else if (it == M
+ && (((instr & 0x1ffc8000000LL) == 0x08cc0000000LL)
+ || ((instr & 0x1efc0000000LL) == 0x0acc0000000LL)))
{
/* st8 [rN] = rM
or
@@ -1634,22 +1657,22 @@ examine_prologue (CORE_ADDR pc, CORE_ADDR lim_pc,
}
if ((instr & 0x1efc0000000LL) == 0x0acc0000000LL)
/* st8 [rN] = rM, imm9 */
- spill_addr += imm9(instr);
+ spill_addr += imm9 (instr);
else
- spill_addr = 0; /* Must be done spilling. */
+ spill_addr = 0; /* Must be done spilling. */
last_prologue_pc = next_pc;
}
- else if (qp == 0 && 32 <= rM && rM < 40 && !instores[rM-32])
+ else if (qp == 0 && 32 <= rM && rM < 40 && !instores[rM - 32])
{
/* Allow up to one store of each input register. */
- instores[rM-32] = 1;
+ instores[rM - 32] = 1;
last_prologue_pc = next_pc;
}
- else if (qp == 0 && 32 <= indirect && indirect < 40 &&
- !instores[indirect-32])
+ else if (qp == 0 && 32 <= indirect && indirect < 40
+ && !instores[indirect - 32])
{
/* Allow an indirect store of an input register. */
- instores[indirect-32] = 1;
+ instores[indirect - 32] = 1;
last_prologue_pc = next_pc;
}
}
@@ -1667,16 +1690,16 @@ examine_prologue (CORE_ADDR pc, CORE_ADDR lim_pc,
int rM = (int) ((instr & 0x000000fe000LL) >> 13);
int qp = (int) (instr & 0x0000000003fLL);
int indirect = rM < 256 ? reg_contents[rM] : 0;
- if (qp == 0 && 32 <= rM && rM < 40 && !instores[rM-32])
+ if (qp == 0 && 32 <= rM && rM < 40 && !instores[rM - 32])
{
- instores[rM-32] = 1;
+ instores[rM - 32] = 1;
last_prologue_pc = next_pc;
}
- else if (qp == 0 && 32 <= indirect && indirect < 40 &&
- !instores[indirect-32])
+ else if (qp == 0 && 32 <= indirect && indirect < 40
+ && !instores[indirect - 32])
{
/* Allow an indirect store of an input register. */
- instores[indirect-32] = 1;
+ instores[indirect - 32] = 1;
last_prologue_pc = next_pc;
}
}
@@ -1693,13 +1716,13 @@ examine_prologue (CORE_ADDR pc, CORE_ADDR lim_pc,
int qp = (int) (instr & 0x0000000003fLL);
if (qp == 0 && 8 <= fM && fM < 16 && !infpstores[fM - 8])
{
- infpstores[fM-8] = 1;
+ infpstores[fM - 8] = 1;
last_prologue_pc = next_pc;
}
}
else if (it == M
- && ( ((instr & 0x1ffc8000000LL) == 0x08ec0000000LL)
- || ((instr & 0x1efc0000000LL) == 0x0aec0000000LL)))
+ && (((instr & 0x1ffc8000000LL) == 0x08ec0000000LL)
+ || ((instr & 0x1efc0000000LL) == 0x0aec0000000LL)))
{
/* st8.spill [rN] = rM
or
@@ -1715,9 +1738,9 @@ examine_prologue (CORE_ADDR pc, CORE_ADDR lim_pc,
cache->saved_regs[IA64_GR0_REGNUM + rM] = spill_addr;
if ((instr & 0x1efc0000000LL) == 0x0aec0000000LL)
/* st8.spill [rN] = rM, imm9 */
- spill_addr += imm9(instr);
+ spill_addr += imm9 (instr);
else
- spill_addr = 0; /* Done spilling. */
+ spill_addr = 0; /* Done spilling. */
last_prologue_pc = next_pc;
}
}
@@ -1745,20 +1768,18 @@ examine_prologue (CORE_ADDR pc, CORE_ADDR lim_pc,
/* Find the bof (beginning of frame). */
bof = rse_address_add (cache->bsp, -sof);
-
- for (i = 0, addr = bof;
- i < sof;
- i++, addr += 8)
+
+ for (i = 0, addr = bof; i < sof; i++, addr += 8)
{
if (IS_NaT_COLLECTION_ADDR (addr))
{
addr += 8;
}
- if (i+32 == cfm_reg)
+ if (i + 32 == cfm_reg)
cache->saved_regs[IA64_CFM_REGNUM] = addr;
- if (i+32 == ret_reg)
+ if (i + 32 == ret_reg)
cache->saved_regs[IA64_VRAP_REGNUM] = addr;
- if (i+32 == fp_reg)
+ if (i + 32 == fp_reg)
cache->saved_regs[IA64_VFP_REGNUM] = addr;
}
@@ -1767,8 +1788,8 @@ examine_prologue (CORE_ADDR pc, CORE_ADDR lim_pc,
cfm = 0;
if (cache->saved_regs[IA64_CFM_REGNUM] != 0)
{
- cfm = read_memory_integer (cache->saved_regs[IA64_CFM_REGNUM],
- 8, byte_order);
+ cfm = read_memory_integer (cache->saved_regs[IA64_CFM_REGNUM], 8,
+ byte_order);
}
else if (cfm_reg != 0)
{
@@ -1776,7 +1797,7 @@ examine_prologue (CORE_ADDR pc, CORE_ADDR lim_pc,
cfm = extract_unsigned_integer (buf, 8, byte_order);
}
cache->prev_cfm = cfm;
-
+
if (cfm != 0)
{
sor = ((cfm >> 14) & 0xf) * 8;
@@ -1788,26 +1809,23 @@ examine_prologue (CORE_ADDR pc, CORE_ADDR lim_pc,
locals) due to the overlap between output and input of
subsequent frames. */
bof = rse_address_add (bof, -sol);
-
- for (i = 0, addr = bof;
- i < sof;
- i++, addr += 8)
+
+ for (i = 0, addr = bof; i < sof; i++, addr += 8)
{
if (IS_NaT_COLLECTION_ADDR (addr))
{
addr += 8;
}
if (i < sor)
- cache->saved_regs[IA64_GR32_REGNUM
- + ((i + (sor - rrb_gr)) % sor)]
+ cache
+ ->saved_regs[IA64_GR32_REGNUM + ((i + (sor - rrb_gr)) % sor)]
= addr;
else
cache->saved_regs[IA64_GR32_REGNUM + i] = addr;
}
-
}
}
-
+
/* Try and trust the lim_pc value whenever possible. */
if (trust_limit && lim_pc >= last_prologue_pc)
last_prologue_pc = lim_pc;
@@ -1831,10 +1849,9 @@ ia64_skip_prologue (struct gdbarch *gdbarch, CORE_ADDR pc)
/* Call examine_prologue with - as third argument since we don't
have a next frame pointer to send. */
- return examine_prologue (pc, pc+1024, 0, &cache);
+ return examine_prologue (pc, pc + 1024, 0, &cache);
}
-
/* Normal frames. */
static struct ia64_frame_cache *
@@ -1860,7 +1877,7 @@ ia64_frame_cache (frame_info_ptr this_frame, void **this_cache)
by subtracting frame size. */
get_frame_register (this_frame, IA64_BSP_REGNUM, buf);
cache->bsp = extract_unsigned_integer (buf, 8, byte_order);
-
+
get_frame_register (this_frame, IA64_PSR_REGNUM, buf);
get_frame_register (this_frame, IA64_CFM_REGNUM, buf);
@@ -1876,7 +1893,7 @@ ia64_frame_cache (frame_info_ptr this_frame, void **this_cache)
if (cache->pc != 0)
examine_prologue (cache->pc, get_frame_pc (this_frame), this_frame, cache);
-
+
cache->base = cache->saved_sp + cache->mem_stack_frame_size;
return cache;
@@ -1887,8 +1904,7 @@ ia64_frame_this_id (frame_info_ptr this_frame, void **this_cache,
struct frame_id *this_id)
{
struct gdbarch *gdbarch = get_frame_arch (this_frame);
- struct ia64_frame_cache *cache =
- ia64_frame_cache (this_frame, this_cache);
+ struct ia64_frame_cache *cache = ia64_frame_cache (this_frame, this_cache);
/* If outermost frame, mark with null frame id. */
if (cache->base != 0)
@@ -1915,7 +1931,7 @@ ia64_frame_prev_register (frame_info_ptr this_frame, void **this_cache,
gdb_assert (regnum >= 0);
if (!target_has_registers ())
- error (_("No registers."));
+ error (_ ("No registers."));
if (regnum == gdbarch_sp_regnum (gdbarch))
return frame_unwind_got_constant (this_frame, regnum, cache->base);
@@ -1934,11 +1950,11 @@ ia64_frame_prev_register (frame_info_ptr this_frame, void **this_cache,
that frame by adding the size of output:
(sof (size of frame) - sol (size of locals)). */
val = ia64_frame_prev_register (this_frame, this_cache, IA64_CFM_REGNUM);
- prev_cfm = extract_unsigned_integer (value_contents_all (val).data (),
- 8, byte_order);
+ prev_cfm = extract_unsigned_integer (value_contents_all (val).data (), 8,
+ byte_order);
bsp = rse_address_add (cache->bsp, -(cache->sof));
- prev_bsp =
- rse_address_add (bsp, (prev_cfm & 0x7f) - ((prev_cfm >> 7) & 0x7f));
+ prev_bsp
+ = rse_address_add (bsp, (prev_cfm & 0x7f) - ((prev_cfm >> 7) & 0x7f));
return frame_unwind_got_constant (this_frame, regnum, prev_bsp);
}
@@ -1946,7 +1962,7 @@ ia64_frame_prev_register (frame_info_ptr this_frame, void **this_cache,
else if (regnum == IA64_CFM_REGNUM)
{
CORE_ADDR addr = cache->saved_regs[IA64_CFM_REGNUM];
-
+
if (addr != 0)
return frame_unwind_got_memory (this_frame, regnum, addr);
@@ -1972,9 +1988,9 @@ ia64_frame_prev_register (frame_info_ptr this_frame, void **this_cache,
{
struct value *pr_val;
ULONGEST prN;
-
- pr_val = ia64_frame_prev_register (this_frame, this_cache,
- IA64_PR_REGNUM);
+
+ pr_val
+ = ia64_frame_prev_register (this_frame, this_cache, IA64_PR_REGNUM);
if (VP16_REGNUM <= regnum && regnum <= VP63_REGNUM)
{
/* Fetch predicate register rename base from current frame
@@ -1993,8 +2009,8 @@ ia64_frame_prev_register (frame_info_ptr this_frame, void **this_cache,
{
struct value *unat_val;
ULONGEST unatN;
- unat_val = ia64_frame_prev_register (this_frame, this_cache,
- IA64_UNAT_REGNUM);
+ unat_val
+ = ia64_frame_prev_register (this_frame, this_cache, IA64_UNAT_REGNUM);
unatN = extract_bit_field (value_contents_all (unat_val).data (),
regnum - IA64_NAT0_REGNUM, 1);
return frame_unwind_got_constant (this_frame, regnum, unatN);
@@ -2081,7 +2097,7 @@ ia64_frame_prev_register (frame_info_ptr this_frame, void **this_cache,
}
psr &= ~(3LL << 41);
slot_num = pc & 0x3LL;
- psr |= (CORE_ADDR)slot_num << 41;
+ psr |= (CORE_ADDR) slot_num << 41;
return frame_unwind_got_constant (this_frame, regnum, psr);
}
@@ -2117,18 +2133,20 @@ ia64_frame_prev_register (frame_info_ptr this_frame, void **this_cache,
regnum = IA64_GR32_REGNUM + (regnum - V32_REGNUM);
reg_val = ia64_frame_prev_register (this_frame, this_cache,
IA64_CFM_REGNUM);
- prev_cfm = extract_unsigned_integer
- (value_contents_all (reg_val).data (), 8, byte_order);
+ prev_cfm
+ = extract_unsigned_integer (value_contents_all (reg_val).data (),
+ 8, byte_order);
reg_val = ia64_frame_prev_register (this_frame, this_cache,
IA64_BSP_REGNUM);
- prev_bsp = extract_unsigned_integer
- (value_contents_all (reg_val).data (), 8, byte_order);
+ prev_bsp
+ = extract_unsigned_integer (value_contents_all (reg_val).data (),
+ 8, byte_order);
prev_bof = rse_address_add (prev_bsp, -(prev_cfm & 0x7f));
addr = rse_address_add (prev_bof, (regnum - IA64_GR32_REGNUM));
return frame_unwind_got_memory (this_frame, regnum, addr);
}
-
+
return frame_unwind_got_constant (this_frame, regnum, 0);
}
@@ -2144,8 +2162,8 @@ ia64_frame_prev_register (frame_info_ptr this_frame, void **this_cache,
/* Adjust the floating point register number to account for
register rotation. */
- regnum = IA64_FR32_REGNUM
- + ((regnum - IA64_FR32_REGNUM) + rrb_fr) % 96;
+ regnum
+ = IA64_FR32_REGNUM + ((regnum - IA64_FR32_REGNUM) + rrb_fr) % 96;
}
/* If we have stored a memory address, access the register. */
@@ -2153,21 +2171,19 @@ ia64_frame_prev_register (frame_info_ptr this_frame, void **this_cache,
if (addr != 0)
return frame_unwind_got_memory (this_frame, regnum, addr);
/* Otherwise, punt and get the current value of the register. */
- else
+ else
return frame_unwind_got_register (this_frame, regnum, regnum);
}
}
-
-static const struct frame_unwind ia64_frame_unwind =
-{
- "ia64 prologue",
- NORMAL_FRAME,
- default_frame_unwind_stop_reason,
- &ia64_frame_this_id,
- &ia64_frame_prev_register,
- NULL,
- default_frame_sniffer
-};
+
+static const struct frame_unwind ia64_frame_unwind
+ = { "ia64 prologue",
+ NORMAL_FRAME,
+ default_frame_unwind_stop_reason,
+ &ia64_frame_this_id,
+ &ia64_frame_prev_register,
+ NULL,
+ default_frame_sniffer };
/* Signal trampolines. */
@@ -2214,14 +2230,14 @@ ia64_sigtramp_frame_init_saved_regs (frame_info_ptr this_frame,
IA64_LC_REGNUM);
for (regno = IA64_GR1_REGNUM; regno <= IA64_GR31_REGNUM; regno++)
- cache->saved_regs[regno] =
- tdep->sigcontext_register_address (gdbarch, cache->base, regno);
+ cache->saved_regs[regno]
+ = tdep->sigcontext_register_address (gdbarch, cache->base, regno);
for (regno = IA64_BR0_REGNUM; regno <= IA64_BR7_REGNUM; regno++)
- cache->saved_regs[regno] =
- tdep->sigcontext_register_address (gdbarch, cache->base, regno);
+ cache->saved_regs[regno]
+ = tdep->sigcontext_register_address (gdbarch, cache->base, regno);
for (regno = IA64_FR2_REGNUM; regno <= IA64_FR31_REGNUM; regno++)
- cache->saved_regs[regno] =
- tdep->sigcontext_register_address (gdbarch, cache->base, regno);
+ cache->saved_regs[regno]
+ = tdep->sigcontext_register_address (gdbarch, cache->base, regno);
}
}
@@ -2257,15 +2273,14 @@ ia64_sigtramp_frame_cache (frame_info_ptr this_frame, void **this_cache)
}
static void
-ia64_sigtramp_frame_this_id (frame_info_ptr this_frame,
- void **this_cache, struct frame_id *this_id)
+ia64_sigtramp_frame_this_id (frame_info_ptr this_frame, void **this_cache,
+ struct frame_id *this_id)
{
struct gdbarch *gdbarch = get_frame_arch (this_frame);
- struct ia64_frame_cache *cache =
- ia64_sigtramp_frame_cache (this_frame, this_cache);
+ struct ia64_frame_cache *cache
+ = ia64_sigtramp_frame_cache (this_frame, this_cache);
- (*this_id) = frame_id_build_special (cache->base,
- get_frame_pc (this_frame),
+ (*this_id) = frame_id_build_special (cache->base, get_frame_pc (this_frame),
cache->bsp);
if (gdbarch_debug >= 1)
gdb_printf (gdb_stdlog,
@@ -2281,13 +2296,13 @@ static struct value *
ia64_sigtramp_frame_prev_register (frame_info_ptr this_frame,
void **this_cache, int regnum)
{
- struct ia64_frame_cache *cache =
- ia64_sigtramp_frame_cache (this_frame, this_cache);
+ struct ia64_frame_cache *cache
+ = ia64_sigtramp_frame_cache (this_frame, this_cache);
gdb_assert (regnum >= 0);
if (!target_has_registers ())
- error (_("No registers."));
+ error (_ ("No registers."));
if (regnum == IA64_IP_REGNUM)
{
@@ -2318,7 +2333,7 @@ ia64_sigtramp_frame_prev_register (frame_info_ptr this_frame,
return frame_unwind_got_constant (this_frame, regnum, 0);
}
- else /* All other registers not listed above. */
+ else /* All other registers not listed above. */
{
CORE_ADDR addr = cache->saved_regs[regnum];
@@ -2331,8 +2346,7 @@ ia64_sigtramp_frame_prev_register (frame_info_ptr this_frame,
static int
ia64_sigtramp_frame_sniffer (const struct frame_unwind *self,
- frame_info_ptr this_frame,
- void **this_cache)
+ frame_info_ptr this_frame, void **this_cache)
{
gdbarch *arch = get_frame_arch (this_frame);
ia64_gdbarch_tdep *tdep = gdbarch_tdep<ia64_gdbarch_tdep> (arch);
@@ -2347,18 +2361,14 @@ ia64_sigtramp_frame_sniffer (const struct frame_unwind *self,
return 0;
}
-static const struct frame_unwind ia64_sigtramp_frame_unwind =
-{
- "ia64 sigtramp",
- SIGTRAMP_FRAME,
- default_frame_unwind_stop_reason,
- ia64_sigtramp_frame_this_id,
- ia64_sigtramp_frame_prev_register,
- NULL,
- ia64_sigtramp_frame_sniffer
-};
-
-
+static const struct frame_unwind ia64_sigtramp_frame_unwind
+ = { "ia64 sigtramp",
+ SIGTRAMP_FRAME,
+ default_frame_unwind_stop_reason,
+ ia64_sigtramp_frame_this_id,
+ ia64_sigtramp_frame_prev_register,
+ NULL,
+ ia64_sigtramp_frame_sniffer };
static CORE_ADDR
ia64_frame_base_address (frame_info_ptr this_frame, void **this_cache)
@@ -2368,22 +2378,18 @@ ia64_frame_base_address (frame_info_ptr this_frame, void **this_cache)
return cache->base;
}
-static const struct frame_base ia64_frame_base =
-{
- &ia64_frame_unwind,
- ia64_frame_base_address,
- ia64_frame_base_address,
- ia64_frame_base_address
-};
+static const struct frame_base ia64_frame_base
+ = { &ia64_frame_unwind, ia64_frame_base_address, ia64_frame_base_address,
+ ia64_frame_base_address };
#ifdef HAVE_LIBUNWIND_IA64_H
struct ia64_unwind_table_entry
- {
- unw_word_t start_offset;
- unw_word_t end_offset;
- unw_word_t info_offset;
- };
+{
+ unw_word_t start_offset;
+ unw_word_t end_offset;
+ unw_word_t info_offset;
+};
static __inline__ uint64_t
ia64_rse_slot_num (uint64_t addr)
@@ -2396,13 +2402,13 @@ ia64_rse_slot_num (uint64_t addr)
static __inline__ uint64_t
ia64_rse_skip_regs (uint64_t addr, long num_regs)
{
- long delta = ia64_rse_slot_num(addr) + num_regs;
+ long delta = ia64_rse_slot_num (addr) + num_regs;
if (num_regs < 0)
delta -= 0x3e;
- return addr + ((num_regs + delta/0x3f) << 3);
+ return addr + ((num_regs + delta / 0x3f) << 3);
}
-
+
/* Gdb ia64-libunwind-tdep callback function to convert from an ia64 gdb
register number to a libunwind register number. */
static int
@@ -2435,7 +2441,7 @@ ia64_gdb2uw_regnum (int regnum)
else
return -1;
}
-
+
/* Gdb ia64-libunwind-tdep callback function to convert from a libunwind
register number to a ia64 gdb register number. */
static int
@@ -2477,7 +2483,7 @@ ia64_is_fpreg (int uw_regnum)
/* Libunwind callback accessor function for general registers. */
static int
-ia64_access_reg (unw_addr_space_t as, unw_regnum_t uw_regnum, unw_word_t *val,
+ia64_access_reg (unw_addr_space_t as, unw_regnum_t uw_regnum, unw_word_t *val,
int write, void *arg)
{
int regnum = ia64_uw2gdb_regnum (uw_regnum);
@@ -2485,48 +2491,48 @@ ia64_access_reg (unw_addr_space_t as, unw_regnum_t uw_regnum, unw_word_t *val,
struct frame_info *this_frame = (frame_info *) arg;
struct gdbarch *gdbarch = get_frame_arch (this_frame);
ia64_gdbarch_tdep *tdep = gdbarch_tdep<ia64_gdbarch_tdep> (gdbarch);
-
+
/* We never call any libunwind routines that need to write registers. */
gdb_assert (!write);
switch (uw_regnum)
{
- case UNW_REG_IP:
- /* Libunwind expects to see the pc value which means the slot number
+ case UNW_REG_IP:
+ /* Libunwind expects to see the pc value which means the slot number
from the psr must be merged with the ip word address. */
- ip = get_frame_register_unsigned (this_frame, IA64_IP_REGNUM);
- psr = get_frame_register_unsigned (this_frame, IA64_PSR_REGNUM);
- *val = ip | ((psr >> 41) & 0x3);
- break;
-
- case UNW_IA64_AR_BSP:
- /* Libunwind expects to see the beginning of the current
+ ip = get_frame_register_unsigned (this_frame, IA64_IP_REGNUM);
+ psr = get_frame_register_unsigned (this_frame, IA64_PSR_REGNUM);
+ *val = ip | ((psr >> 41) & 0x3);
+ break;
+
+ case UNW_IA64_AR_BSP:
+ /* Libunwind expects to see the beginning of the current
register frame so we must account for the fact that
ptrace() will return a value for bsp that points *after*
the current register frame. */
- bsp = get_frame_register_unsigned (this_frame, IA64_BSP_REGNUM);
- cfm = get_frame_register_unsigned (this_frame, IA64_CFM_REGNUM);
- sof = tdep->size_of_register_frame (this_frame, cfm);
- *val = ia64_rse_skip_regs (bsp, -sof);
- break;
+ bsp = get_frame_register_unsigned (this_frame, IA64_BSP_REGNUM);
+ cfm = get_frame_register_unsigned (this_frame, IA64_CFM_REGNUM);
+ sof = tdep->size_of_register_frame (this_frame, cfm);
+ *val = ia64_rse_skip_regs (bsp, -sof);
+ break;
- case UNW_IA64_AR_BSPSTORE:
- /* Libunwind wants bspstore to be after the current register frame.
+ case UNW_IA64_AR_BSPSTORE:
+ /* Libunwind wants bspstore to be after the current register frame.
This is what ptrace() and gdb treats as the regular bsp value. */
- *val = get_frame_register_unsigned (this_frame, IA64_BSP_REGNUM);
- break;
+ *val = get_frame_register_unsigned (this_frame, IA64_BSP_REGNUM);
+ break;
- default:
- /* For all other registers, just unwind the value directly. */
- *val = get_frame_register_unsigned (this_frame, regnum);
- break;
+ default:
+ /* For all other registers, just unwind the value directly. */
+ *val = get_frame_register_unsigned (this_frame, regnum);
+ break;
}
-
+
if (gdbarch_debug >= 1)
- gdb_printf (gdb_stdlog,
- " access_reg: from cache: %4s=%s\n",
+ gdb_printf (gdb_stdlog, " access_reg: from cache: %4s=%s\n",
(((unsigned) regnum <= IA64_NAT127_REGNUM)
- ? ia64_register_names[regnum] : "r??"),
+ ? ia64_register_names[regnum]
+ : "r??"),
paddress (gdbarch, *val));
return 0;
}
@@ -2538,7 +2544,7 @@ ia64_access_fpreg (unw_addr_space_t as, unw_regnum_t uw_regnum,
{
int regnum = ia64_uw2gdb_regnum (uw_regnum);
frame_info_ptr this_frame = (frame_info_ptr) arg;
-
+
/* We never call any libunwind routines that need to write registers. */
gdb_assert (!write);
@@ -2556,48 +2562,48 @@ ia64_access_rse_reg (unw_addr_space_t as, unw_regnum_t uw_regnum,
unw_word_t bsp, sof, cfm, psr, ip;
struct regcache *regcache = (struct regcache *) arg;
struct gdbarch *gdbarch = regcache->arch ();
-
+
/* We never call any libunwind routines that need to write registers. */
gdb_assert (!write);
switch (uw_regnum)
{
- case UNW_REG_IP:
- /* Libunwind expects to see the pc value which means the slot number
+ case UNW_REG_IP:
+ /* Libunwind expects to see the pc value which means the slot number
from the psr must be merged with the ip word address. */
- regcache_cooked_read_unsigned (regcache, IA64_IP_REGNUM, &ip);
- regcache_cooked_read_unsigned (regcache, IA64_PSR_REGNUM, &psr);
- *val = ip | ((psr >> 41) & 0x3);
- break;
-
- case UNW_IA64_AR_BSP:
- /* Libunwind expects to see the beginning of the current
+ regcache_cooked_read_unsigned (regcache, IA64_IP_REGNUM, &ip);
+ regcache_cooked_read_unsigned (regcache, IA64_PSR_REGNUM, &psr);
+ *val = ip | ((psr >> 41) & 0x3);
+ break;
+
+ case UNW_IA64_AR_BSP:
+ /* Libunwind expects to see the beginning of the current
register frame so we must account for the fact that
ptrace() will return a value for bsp that points *after*
the current register frame. */
- regcache_cooked_read_unsigned (regcache, IA64_BSP_REGNUM, &bsp);
- regcache_cooked_read_unsigned (regcache, IA64_CFM_REGNUM, &cfm);
- sof = (cfm & 0x7f);
- *val = ia64_rse_skip_regs (bsp, -sof);
- break;
-
- case UNW_IA64_AR_BSPSTORE:
- /* Libunwind wants bspstore to be after the current register frame.
+ regcache_cooked_read_unsigned (regcache, IA64_BSP_REGNUM, &bsp);
+ regcache_cooked_read_unsigned (regcache, IA64_CFM_REGNUM, &cfm);
+ sof = (cfm & 0x7f);
+ *val = ia64_rse_skip_regs (bsp, -sof);
+ break;
+
+ case UNW_IA64_AR_BSPSTORE:
+ /* Libunwind wants bspstore to be after the current register frame.
This is what ptrace() and gdb treats as the regular bsp value. */
- regcache_cooked_read_unsigned (regcache, IA64_BSP_REGNUM, val);
- break;
+ regcache_cooked_read_unsigned (regcache, IA64_BSP_REGNUM, val);
+ break;
- default:
- /* For all other registers, just unwind the value directly. */
- regcache_cooked_read_unsigned (regcache, regnum, val);
- break;
+ default:
+ /* For all other registers, just unwind the value directly. */
+ regcache_cooked_read_unsigned (regcache, regnum, val);
+ break;
}
-
+
if (gdbarch_debug >= 1)
- gdb_printf (gdb_stdlog,
- " access_rse_reg: from cache: %4s=%s\n",
+ gdb_printf (gdb_stdlog, " access_rse_reg: from cache: %4s=%s\n",
(((unsigned) regnum <= IA64_NAT127_REGNUM)
- ? ia64_register_names[regnum] : "r??"),
+ ? ia64_register_names[regnum]
+ : "r??"),
paddress (gdbarch, *val));
return 0;
@@ -2610,7 +2616,7 @@ ia64_access_rse_fpreg (unw_addr_space_t as, unw_regnum_t uw_regnum,
{
int regnum = ia64_uw2gdb_regnum (uw_regnum);
struct regcache *regcache = (struct regcache *) arg;
-
+
/* We never call any libunwind routines that need to write registers. */
gdb_assert (!write);
@@ -2621,18 +2627,17 @@ ia64_access_rse_fpreg (unw_addr_space_t as, unw_regnum_t uw_regnum,
/* Libunwind callback accessor function for accessing memory. */
static int
-ia64_access_mem (unw_addr_space_t as,
- unw_word_t addr, unw_word_t *val,
+ia64_access_mem (unw_addr_space_t as, unw_word_t addr, unw_word_t *val,
int write, void *arg)
{
if (addr - KERNEL_START < ktab_size)
{
- unw_word_t *laddr = (unw_word_t*) ((char *) ktab
- + (addr - KERNEL_START));
-
+ unw_word_t *laddr
+ = (unw_word_t *) ((char *) ktab + (addr - KERNEL_START));
+
if (write)
- *laddr = *val;
- else
+ *laddr = *val;
+ else
*val = *laddr;
return 0;
}
@@ -2660,13 +2665,13 @@ getunwind_table ()
TARGET_OBJECT_UNWIND_TABLE, NULL);
}
-/* Get the kernel unwind table. */
+/* Get the kernel unwind table. */
static int
get_kernel_table (unw_word_t ip, unw_dyn_info_t *di)
{
static struct ia64_table_entry *etab;
- if (!ktab)
+ if (!ktab)
{
ktab_buf = getunwind_table ();
if (!ktab_buf)
@@ -2678,10 +2683,10 @@ get_kernel_table (unw_word_t ip, unw_dyn_info_t *di)
for (etab = ktab; etab->start_offset; ++etab)
etab->info_offset += KERNEL_START;
}
-
+
if (ip < ktab[0].start_offset || ip >= etab[-1].end_offset)
return -UNW_ENOINFO;
-
+
di->format = UNW_INFO_FORMAT_TABLE;
di->gp = 0;
di->start_ip = ktab[0].start_offset;
@@ -2690,14 +2695,13 @@ get_kernel_table (unw_word_t ip, unw_dyn_info_t *di)
di->u.ti.segbase = 0;
di->u.ti.table_len = ((char *) etab - (char *) ktab) / sizeof (unw_word_t);
di->u.ti.table_data = (unw_word_t *) ktab;
-
+
if (gdbarch_debug >= 1)
- gdb_printf (gdb_stdlog, "get_kernel_table: found table `%s': "
+ gdb_printf (gdb_stdlog,
+ "get_kernel_table: found table `%s': "
"segbase=%s, length=%s, gp=%s\n",
- (char *) di->u.ti.name_ptr,
- hex_string (di->u.ti.segbase),
- pulongest (di->u.ti.table_len),
- hex_string (di->gp));
+ (char *) di->u.ti.name_ptr, hex_string (di->u.ti.segbase),
+ pulongest (di->u.ti.table_len), hex_string (di->gp));
return 0;
}
@@ -2714,7 +2718,7 @@ ia64_find_unwind_table (struct objfile *objfile, unw_word_t ip,
int i;
bfd = objfile->obfd;
-
+
ehdr = elf_tdata (bfd)->elf_header;
phdr = elf_tdata (bfd)->phdr;
@@ -2798,15 +2802,15 @@ ia64_find_proc_info_x (unw_addr_space_t as, unw_word_t ip, unw_proc_info_t *pi,
return -UNW_ENOINFO;
if (gdbarch_debug >= 1)
- gdb_printf (gdb_stdlog, "ia64_find_proc_info_x: %s -> "
+ gdb_printf (gdb_stdlog,
+ "ia64_find_proc_info_x: %s -> "
"(name=`%s',segbase=%s,start=%s,end=%s,gp=%s,"
"length=%s,data=%s)\n",
- hex_string (ip), (char *)di.u.ti.name_ptr,
- hex_string (di.u.ti.segbase),
- hex_string (di.start_ip), hex_string (di.end_ip),
- hex_string (di.gp),
- pulongest (di.u.ti.table_len),
- hex_string ((CORE_ADDR)di.u.ti.table_data));
+ hex_string (ip), (char *) di.u.ti.name_ptr,
+ hex_string (di.u.ti.segbase), hex_string (di.start_ip),
+ hex_string (di.end_ip), hex_string (di.gp),
+ pulongest (di.u.ti.table_len),
+ hex_string ((CORE_ADDR) di.u.ti.table_data));
}
else
{
@@ -2815,19 +2819,19 @@ ia64_find_proc_info_x (unw_addr_space_t as, unw_word_t ip, unw_proc_info_t *pi,
return ret;
if (gdbarch_debug >= 1)
- gdb_printf (gdb_stdlog, "ia64_find_proc_info_x: %s -> "
+ gdb_printf (gdb_stdlog,
+ "ia64_find_proc_info_x: %s -> "
"(name=`%s',segbase=%s,start=%s,end=%s,gp=%s,"
"length=%s,data=%s)\n",
- hex_string (ip), (char *)di.u.rti.name_ptr,
- hex_string (di.u.rti.segbase),
- hex_string (di.start_ip), hex_string (di.end_ip),
- hex_string (di.gp),
- pulongest (di.u.rti.table_len),
+ hex_string (ip), (char *) di.u.rti.name_ptr,
+ hex_string (di.u.rti.segbase), hex_string (di.start_ip),
+ hex_string (di.end_ip), hex_string (di.gp),
+ pulongest (di.u.rti.table_len),
hex_string (di.u.rti.table_data));
}
- ret = libunwind_search_unwind_table (&as, ip, &di, pi, need_unwind_info,
- arg);
+ ret
+ = libunwind_search_unwind_table (&as, ip, &di, pi, need_unwind_info, arg);
/* We no longer need the dyn info storage so free it. */
xfree (buf);
@@ -2837,17 +2841,15 @@ ia64_find_proc_info_x (unw_addr_space_t as, unw_word_t ip, unw_proc_info_t *pi,
/* Libunwind callback accessor function for cleanup. */
static void
-ia64_put_unwind_info (unw_addr_space_t as,
- unw_proc_info_t *pip, void *arg)
+ia64_put_unwind_info (unw_addr_space_t as, unw_proc_info_t *pip, void *arg)
{
/* Nothing required for now. */
}
/* Libunwind callback accessor function to get head of the dynamic
- unwind-info registration list. */
+ unwind-info registration list. */
static int
-ia64_get_dyn_info_list (unw_addr_space_t as,
- unw_word_t *dilap, void *arg)
+ia64_get_dyn_info_list (unw_addr_space_t as, unw_word_t *dilap, void *arg)
{
struct obj_section *text_sec;
unw_word_t ip, addr;
@@ -2886,7 +2888,6 @@ ia64_get_dyn_info_list (unw_addr_space_t as,
return -UNW_ENOINFO;
}
-
/* Frame interface functions for libunwind. */
static void
@@ -2918,8 +2919,7 @@ ia64_libunwind_frame_this_id (frame_info_ptr this_frame, void **this_cache,
"libunwind frame id: code %s, stack %s, "
"special %s, this_frame %s\n",
paddress (gdbarch, id.code_addr),
- paddress (gdbarch, id.stack_addr),
- paddress (gdbarch, bsp),
+ paddress (gdbarch, id.stack_addr), paddress (gdbarch, bsp),
host_address_to_string (this_frame));
}
@@ -2953,7 +2953,7 @@ ia64_libunwind_frame_prev_register (frame_info_ptr this_frame,
marker for this frame. */
cfm = get_frame_register_unsigned (this_frame, IA64_CFM_REGNUM);
rrb_pr = (cfm >> 32) & 0x3f;
-
+
/* Adjust the register number to account for register rotation. */
regnum = VP16_REGNUM + ((regnum - VP16_REGNUM) + rrb_pr) % 48;
}
@@ -2981,12 +2981,13 @@ ia64_libunwind_frame_prev_register (frame_info_ptr this_frame,
register will be if we pop the frame back which is why we might
have been called. We know that libunwind will pass us back the
beginning of the current frame so we should just add sof to it. */
- prev_bsp = extract_unsigned_integer (value_contents_all (val).data (),
- 8, byte_order);
+ prev_bsp = extract_unsigned_integer (value_contents_all (val).data (), 8,
+ byte_order);
cfm_val = libunwind_frame_prev_register (this_frame, this_cache,
IA64_CFM_REGNUM);
- prev_cfm = extract_unsigned_integer (value_contents_all (cfm_val).data (),
- 8, byte_order);
+ prev_cfm
+ = extract_unsigned_integer (value_contents_all (cfm_val).data (), 8,
+ byte_order);
prev_bsp = rse_address_add (prev_bsp, (prev_cfm & 0x7f));
return frame_unwind_got_constant (this_frame, regnum, prev_bsp);
@@ -2997,8 +2998,7 @@ ia64_libunwind_frame_prev_register (frame_info_ptr this_frame,
static int
ia64_libunwind_frame_sniffer (const struct frame_unwind *self,
- frame_info_ptr this_frame,
- void **this_cache)
+ frame_info_ptr this_frame, void **this_cache)
{
if (libunwind_is_initialized ()
&& libunwind_frame_sniffer (self, this_frame, this_cache))
@@ -3007,17 +3007,15 @@ ia64_libunwind_frame_sniffer (const struct frame_unwind *self,
return 0;
}
-static const struct frame_unwind ia64_libunwind_frame_unwind =
-{
- "ia64 libunwind",
- NORMAL_FRAME,
- default_frame_unwind_stop_reason,
- ia64_libunwind_frame_this_id,
- ia64_libunwind_frame_prev_register,
- NULL,
- ia64_libunwind_frame_sniffer,
- libunwind_frame_dealloc_cache
-};
+static const struct frame_unwind ia64_libunwind_frame_unwind
+ = { "ia64 libunwind",
+ NORMAL_FRAME,
+ default_frame_unwind_stop_reason,
+ ia64_libunwind_frame_this_id,
+ ia64_libunwind_frame_prev_register,
+ NULL,
+ ia64_libunwind_frame_sniffer,
+ libunwind_frame_dealloc_cache };
static void
ia64_libunwind_sigtramp_frame_this_id (frame_info_ptr this_frame,
@@ -3050,8 +3048,7 @@ ia64_libunwind_sigtramp_frame_this_id (frame_info_ptr this_frame,
"libunwind sigtramp frame id: code %s, "
"stack %s, special %s, this_frame %s\n",
paddress (gdbarch, id.code_addr),
- paddress (gdbarch, id.stack_addr),
- paddress (gdbarch, bsp),
+ paddress (gdbarch, id.stack_addr), paddress (gdbarch, bsp),
host_address_to_string (this_frame));
}
@@ -3066,8 +3063,8 @@ ia64_libunwind_sigtramp_frame_prev_register (frame_info_ptr this_frame,
/* If the previous frame pc value is 0, then we want to use the SIGCONTEXT
method of getting previous registers. */
- prev_ip_val = libunwind_frame_prev_register (this_frame, this_cache,
- IA64_IP_REGNUM);
+ prev_ip_val
+ = libunwind_frame_prev_register (this_frame, this_cache, IA64_IP_REGNUM);
prev_ip = extract_unsigned_integer (value_contents_all (prev_ip_val).data (),
8, byte_order);
@@ -3096,26 +3093,19 @@ ia64_libunwind_sigtramp_frame_sniffer (const struct frame_unwind *self,
return ia64_sigtramp_frame_sniffer (self, this_frame, this_cache);
}
-static const struct frame_unwind ia64_libunwind_sigtramp_frame_unwind =
-{
- "ia64 libunwind sigtramp",
- SIGTRAMP_FRAME,
- default_frame_unwind_stop_reason,
- ia64_libunwind_sigtramp_frame_this_id,
- ia64_libunwind_sigtramp_frame_prev_register,
- NULL,
- ia64_libunwind_sigtramp_frame_sniffer
-};
+static const struct frame_unwind ia64_libunwind_sigtramp_frame_unwind
+ = { "ia64 libunwind sigtramp",
+ SIGTRAMP_FRAME,
+ default_frame_unwind_stop_reason,
+ ia64_libunwind_sigtramp_frame_this_id,
+ ia64_libunwind_sigtramp_frame_prev_register,
+ NULL,
+ ia64_libunwind_sigtramp_frame_sniffer };
/* Set of libunwind callback acccessor functions. */
-unw_accessors_t ia64_unw_accessors =
-{
- ia64_find_proc_info_x,
- ia64_put_unwind_info,
- ia64_get_dyn_info_list,
- ia64_access_mem,
- ia64_access_reg,
- ia64_access_fpreg,
+unw_accessors_t ia64_unw_accessors = {
+ ia64_find_proc_info_x, ia64_put_unwind_info, ia64_get_dyn_info_list,
+ ia64_access_mem, ia64_access_reg, ia64_access_fpreg,
/* resume */
/* get_proc_name */
};
@@ -3124,27 +3114,18 @@ unw_accessors_t ia64_unw_accessors =
the rse registers. At the top of the stack, we want libunwind to figure out
how to read r32 - r127. Though usually they are found sequentially in
memory starting from $bof, this is not always true. */
-unw_accessors_t ia64_unw_rse_accessors =
-{
- ia64_find_proc_info_x,
- ia64_put_unwind_info,
- ia64_get_dyn_info_list,
- ia64_access_mem,
- ia64_access_rse_reg,
- ia64_access_rse_fpreg,
+unw_accessors_t ia64_unw_rse_accessors = {
+ ia64_find_proc_info_x, ia64_put_unwind_info, ia64_get_dyn_info_list,
+ ia64_access_mem, ia64_access_rse_reg, ia64_access_rse_fpreg,
/* resume */
/* get_proc_name */
};
/* Set of ia64-libunwind-tdep gdb callbacks and data for generic
ia64-libunwind-tdep code to use. */
-struct libunwind_descr ia64_libunwind_descr =
-{
- ia64_gdb2uw_regnum,
- ia64_uw2gdb_regnum,
- ia64_is_fpreg,
- &ia64_unw_accessors,
- &ia64_unw_rse_accessors,
+struct libunwind_descr ia64_libunwind_descr = {
+ ia64_gdb2uw_regnum, ia64_uw2gdb_regnum, ia64_is_fpreg,
+ &ia64_unw_accessors, &ia64_unw_rse_accessors,
};
#endif /* HAVE_LIBUNWIND_IA64_H */
@@ -3156,8 +3137,7 @@ ia64_use_struct_convention (struct type *type)
/* Don't use the struct convention for anything but structure,
union, or array types. */
- if (!(type->code () == TYPE_CODE_STRUCT
- || type->code () == TYPE_CODE_UNION
+ if (!(type->code () == TYPE_CODE_STRUCT || type->code () == TYPE_CODE_UNION
|| type->code () == TYPE_CODE_ARRAY))
return 0;
@@ -3202,8 +3182,8 @@ ia64_extract_return_value (struct type *type, struct regcache *regcache,
while (n-- > 0)
{
regcache->cooked_read (regnum, from);
- target_float_convert (from, ia64_ext_type (gdbarch),
- valbuf + offset, float_elt_type);
+ target_float_convert (from, ia64_ext_type (gdbarch), valbuf + offset,
+ float_elt_type);
offset += float_elt_type->length ();
regnum++;
}
@@ -3236,7 +3216,7 @@ ia64_extract_return_value (struct type *type, struct regcache *regcache,
{
ULONGEST regval;
regcache_cooked_read_unsigned (regcache, regnum, &regval);
- memcpy ((char *)valbuf + offset, &regval, reglen);
+ memcpy ((char *) valbuf + offset, &regval, reglen);
offset += reglen;
regnum++;
}
@@ -3244,13 +3224,13 @@ ia64_extract_return_value (struct type *type, struct regcache *regcache,
if (m)
{
regcache_cooked_read_unsigned (regcache, regnum, &val);
- memcpy ((char *)valbuf + offset, &val, m);
+ memcpy ((char *) valbuf + offset, &val, m);
}
}
}
static void
-ia64_store_return_value (struct type *type, struct regcache *regcache,
+ia64_store_return_value (struct type *type, struct regcache *regcache,
const gdb_byte *valbuf)
{
struct gdbarch *gdbarch = regcache->arch ();
@@ -3266,8 +3246,8 @@ ia64_store_return_value (struct type *type, struct regcache *regcache,
while (n-- > 0)
{
- target_float_convert (valbuf + offset, float_elt_type,
- to, ia64_ext_type (gdbarch));
+ target_float_convert (valbuf + offset, float_elt_type, to,
+ ia64_ext_type (gdbarch));
regcache->cooked_write (regnum, to);
offset += float_elt_type->length ();
regnum++;
@@ -3284,7 +3264,7 @@ ia64_store_return_value (struct type *type, struct regcache *regcache,
while (n-- > 0)
{
ULONGEST val;
- memcpy (&val, (char *)valbuf + offset, reglen);
+ memcpy (&val, (char *) valbuf + offset, reglen);
regcache_cooked_write_unsigned (regcache, regnum, val);
offset += reglen;
regnum++;
@@ -3293,12 +3273,12 @@ ia64_store_return_value (struct type *type, struct regcache *regcache,
if (m)
{
ULONGEST val;
- memcpy (&val, (char *)valbuf + offset, m);
+ memcpy (&val, (char *) valbuf + offset, m);
regcache_cooked_write_unsigned (regcache, regnum, val);
}
}
}
-
+
static enum return_value_convention
ia64_return_value (struct gdbarch *gdbarch, struct value *function,
struct type *valtype, struct regcache *regcache,
@@ -3339,17 +3319,16 @@ is_float_or_hfa_type_recurse (struct type *t, struct type **etp)
}
break;
case TYPE_CODE_ARRAY:
- return
- is_float_or_hfa_type_recurse (check_typedef (t->target_type ()),
- etp);
+ return is_float_or_hfa_type_recurse (check_typedef (t->target_type ()),
+ etp);
break;
case TYPE_CODE_STRUCT:
{
int i;
for (i = 0; i < t->num_fields (); i++)
- if (!is_float_or_hfa_type_recurse
- (check_typedef (t->field (i).type ()), etp))
+ if (!is_float_or_hfa_type_recurse (
+ check_typedef (t->field (i).type ()), etp))
return 0;
return 1;
}
@@ -3373,7 +3352,6 @@ is_float_or_hfa_type (struct type *t)
return is_float_or_hfa_type_recurse (t, &et) ? et : 0;
}
-
/* Return 1 if the alignment of T is such that the next even slot
should be used. Return 0, if the next available slot should
be used. (See section 8.5.1 of the IA-64 Software Conventions
@@ -3391,15 +3369,14 @@ slot_alignment_is_next_even (struct type *t)
else
return 0;
case TYPE_CODE_ARRAY:
- return
- slot_alignment_is_next_even (check_typedef (t->target_type ()));
+ return slot_alignment_is_next_even (check_typedef (t->target_type ()));
case TYPE_CODE_STRUCT:
{
int i;
for (i = 0; i < t->num_fields (); i++)
- if (slot_alignment_is_next_even
- (check_typedef (t->field (i).type ())))
+ if (
+ slot_alignment_is_next_even (check_typedef (t->field (i).type ())))
return 1;
return 0;
}
@@ -3424,7 +3401,7 @@ ia64_find_global_pointer_from_dynamic_section (struct gdbarch *gdbarch,
{
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
struct obj_section *faddr_sect;
-
+
faddr_sect = find_pc_section (faddr);
if (faddr_sect != NULL)
{
@@ -3459,8 +3436,8 @@ ia64_find_global_pointer_from_dynamic_section (struct gdbarch *gdbarch,
status = target_read_memory (addr + 8, buf, sizeof (buf));
if (status != 0)
break;
- global_pointer = extract_unsigned_integer (buf, sizeof (buf),
- byte_order);
+ global_pointer
+ = extract_unsigned_integer (buf, sizeof (buf), byte_order);
/* The payoff... */
return global_pointer;
@@ -3567,8 +3544,8 @@ find_func_descr (struct regcache *regcache, CORE_ADDR faddr, CORE_ADDR *fdaptr)
global_pointer = ia64_find_global_pointer (gdbarch, faddr);
if (global_pointer == 0)
- regcache_cooked_read_unsigned (regcache,
- IA64_GR1_REGNUM, &global_pointer);
+ regcache_cooked_read_unsigned (regcache, IA64_GR1_REGNUM,
+ &global_pointer);
store_unsigned_integer (buf, 8, byte_order, faddr);
store_unsigned_integer (buf + 8, 8, byte_order, global_pointer);
@@ -3576,7 +3553,7 @@ find_func_descr (struct regcache *regcache, CORE_ADDR faddr, CORE_ADDR *fdaptr)
write_memory (fdesc, buf, 16);
}
- return fdesc;
+ return fdesc;
}
/* Use the following routine when printing out function pointers
@@ -3618,8 +3595,7 @@ ia64_convert_from_func_ptr_addr (struct gdbarch *gdbarch, CORE_ADDR addr,
minsym = lookup_minimal_symbol_by_pc (addr);
- if (minsym.minsym
- && is_vtable_name (minsym.minsym->linkage_name ()))
+ if (minsym.minsym && is_vtable_name (minsym.minsym->linkage_name ()))
return read_memory_unsigned_integer (addr, 8, byte_order);
}
@@ -3674,8 +3650,8 @@ ia64_set_function_addr (struct regcache *regcache, CORE_ADDR func_addr)
static CORE_ADDR
ia64_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
- struct regcache *regcache, CORE_ADDR bp_addr,
- int nargs, struct value **args, CORE_ADDR sp,
+ struct regcache *regcache, CORE_ADDR bp_addr, int nargs,
+ struct value **args, CORE_ADDR sp,
function_call_return_method return_method,
CORE_ADDR struct_addr)
{
@@ -3716,7 +3692,7 @@ ia64_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
/* Allocate a new RSE frame. */
regcache_cooked_read_unsigned (regcache, IA64_BSP_REGNUM, &bsp);
tdep->infcall_ops.allocate_new_rse_frame (regcache, bsp, rseslots);
-
+
/* We will attempt to find function descriptors in the .opd segment,
but if we can't we'll construct them ourselves. That being the
case, we'll need to reserve space on the stack for them. */
@@ -3727,7 +3703,7 @@ ia64_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
require us to have 16 bytes of scratch, plus whatever space is
necessary for the memory slots and our function descriptors. */
sp = sp - 16 - (memslots + nfuncargs) * 8;
- sp &= ~0xfLL; /* Maintain 16 byte alignment. */
+ sp &= ~0xfLL; /* Maintain 16 byte alignment. */
/* Place the arguments where they belong. The arguments will be
either placed in the RSE backing store or on the memory stack.
@@ -3744,19 +3720,19 @@ ia64_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
len = type->length ();
/* Special handling for function parameters. */
- if (len == 8
- && type->code () == TYPE_CODE_PTR
+ if (len == 8 && type->code () == TYPE_CODE_PTR
&& type->target_type ()->code () == TYPE_CODE_FUNC)
{
gdb_byte val_buf[8];
- ULONGEST faddr = extract_unsigned_integer
- (value_contents (arg).data (), 8, byte_order);
+ ULONGEST faddr
+ = extract_unsigned_integer (value_contents (arg).data (), 8,
+ byte_order);
store_unsigned_integer (val_buf, 8, byte_order,
find_func_descr (regcache, faddr,
&funcdescaddr));
if (slotnum < rseslots)
- tdep->infcall_ops.store_argument_in_slot (regcache, bsp,
- slotnum, val_buf);
+ tdep->infcall_ops.store_argument_in_slot (regcache, bsp, slotnum,
+ val_buf);
else
write_memory (sp + 16 + 8 * (slotnum - rseslots), val_buf, 8);
slotnum++;
@@ -3780,10 +3756,10 @@ ia64_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
/* Integral types are LSB-aligned, so we have to be careful
to insert the argument on the correct side of the buffer.
This is why we use store_unsigned_integer. */
- store_unsigned_integer
- (val_buf, 8, byte_order,
- extract_unsigned_integer (value_contents (arg).data (), len,
- byte_order));
+ store_unsigned_integer (
+ val_buf, 8, byte_order,
+ extract_unsigned_integer (value_contents (arg).data (), len,
+ byte_order));
}
else
{
@@ -3801,8 +3777,8 @@ ia64_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
}
if (slotnum < rseslots)
- tdep->infcall_ops.store_argument_in_slot (regcache, bsp,
- slotnum, val_buf);
+ tdep->infcall_ops.store_argument_in_slot (regcache, bsp, slotnum,
+ val_buf);
else
write_memory (sp + 16 + 8 * (slotnum - rseslots), val_buf, 8);
@@ -3855,12 +3831,9 @@ ia64_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
return sp;
}
-static const struct ia64_infcall_ops ia64_infcall_ops =
-{
- ia64_allocate_new_rse_frame,
- ia64_store_argument_in_slot,
- ia64_set_function_addr
-};
+static const struct ia64_infcall_ops ia64_infcall_ops
+ = { ia64_allocate_new_rse_frame, ia64_store_argument_in_slot,
+ ia64_set_function_addr };
static struct frame_id
ia64_dummy_id (struct gdbarch *gdbarch, frame_info_ptr this_frame)
@@ -3876,15 +3849,14 @@ ia64_dummy_id (struct gdbarch *gdbarch, frame_info_ptr this_frame)
bsp = extract_unsigned_integer (buf, 8, byte_order);
if (gdbarch_debug >= 1)
- gdb_printf (gdb_stdlog,
- "dummy frame id: code %s, stack %s, special %s\n",
+ gdb_printf (gdb_stdlog, "dummy frame id: code %s, stack %s, special %s\n",
paddress (gdbarch, get_frame_pc (this_frame)),
paddress (gdbarch, sp), paddress (gdbarch, bsp));
return frame_id_build_special (sp, get_frame_pc (this_frame), bsp);
}
-static CORE_ADDR
+static CORE_ADDR
ia64_unwind_pc (struct gdbarch *gdbarch, frame_info_ptr next_frame)
{
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
@@ -3895,7 +3867,7 @@ ia64_unwind_pc (struct gdbarch *gdbarch, frame_info_ptr next_frame)
ip = extract_unsigned_integer (buf, 8, byte_order);
frame_unwind_register (next_frame, IA64_PSR_REGNUM, buf);
psr = extract_unsigned_integer (buf, 8, byte_order);
-
+
pc = (ip & ~0xf) | ((psr >> 41) & 3);
return pc;
}
@@ -4015,6 +3987,7 @@ ia64_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
}
void _initialize_ia64_tdep ();
+
void
_initialize_ia64_tdep ()
{
diff --git a/gdb/ia64-tdep.h b/gdb/ia64-tdep.h
index ec7715d6404..ceed944aca9 100644
--- a/gdb/ia64-tdep.h
+++ b/gdb/ia64-tdep.h
@@ -31,175 +31,175 @@
/* General registers; there are 128 of these 64 bit wide registers.
The first 32 are static and the last 96 are stacked. */
-#define IA64_GR0_REGNUM 0
-#define IA64_GR1_REGNUM (IA64_GR0_REGNUM + 1)
-#define IA64_GR2_REGNUM (IA64_GR0_REGNUM + 2)
-#define IA64_GR3_REGNUM (IA64_GR0_REGNUM + 3)
-#define IA64_GR4_REGNUM (IA64_GR0_REGNUM + 4)
-#define IA64_GR5_REGNUM (IA64_GR0_REGNUM + 5)
-#define IA64_GR6_REGNUM (IA64_GR0_REGNUM + 6)
-#define IA64_GR7_REGNUM (IA64_GR0_REGNUM + 7)
-#define IA64_GR8_REGNUM (IA64_GR0_REGNUM + 8)
-#define IA64_GR9_REGNUM (IA64_GR0_REGNUM + 9)
-#define IA64_GR10_REGNUM (IA64_GR0_REGNUM + 10)
-#define IA64_GR11_REGNUM (IA64_GR0_REGNUM + 11)
-#define IA64_GR12_REGNUM (IA64_GR0_REGNUM + 12)
-#define IA64_GR31_REGNUM (IA64_GR0_REGNUM + 31)
-#define IA64_GR32_REGNUM (IA64_GR0_REGNUM + 32)
-#define IA64_GR127_REGNUM (IA64_GR0_REGNUM + 127)
+#define IA64_GR0_REGNUM 0
+#define IA64_GR1_REGNUM (IA64_GR0_REGNUM + 1)
+#define IA64_GR2_REGNUM (IA64_GR0_REGNUM + 2)
+#define IA64_GR3_REGNUM (IA64_GR0_REGNUM + 3)
+#define IA64_GR4_REGNUM (IA64_GR0_REGNUM + 4)
+#define IA64_GR5_REGNUM (IA64_GR0_REGNUM + 5)
+#define IA64_GR6_REGNUM (IA64_GR0_REGNUM + 6)
+#define IA64_GR7_REGNUM (IA64_GR0_REGNUM + 7)
+#define IA64_GR8_REGNUM (IA64_GR0_REGNUM + 8)
+#define IA64_GR9_REGNUM (IA64_GR0_REGNUM + 9)
+#define IA64_GR10_REGNUM (IA64_GR0_REGNUM + 10)
+#define IA64_GR11_REGNUM (IA64_GR0_REGNUM + 11)
+#define IA64_GR12_REGNUM (IA64_GR0_REGNUM + 12)
+#define IA64_GR31_REGNUM (IA64_GR0_REGNUM + 31)
+#define IA64_GR32_REGNUM (IA64_GR0_REGNUM + 32)
+#define IA64_GR127_REGNUM (IA64_GR0_REGNUM + 127)
/* Floating point registers; 128 82-bit wide registers. */
-#define IA64_FR0_REGNUM 128
-#define IA64_FR1_REGNUM (IA64_FR0_REGNUM + 1)
-#define IA64_FR2_REGNUM (IA64_FR0_REGNUM + 2)
-#define IA64_FR8_REGNUM (IA64_FR0_REGNUM + 8)
-#define IA64_FR9_REGNUM (IA64_FR0_REGNUM + 9)
-#define IA64_FR10_REGNUM (IA64_FR0_REGNUM + 10)
-#define IA64_FR11_REGNUM (IA64_FR0_REGNUM + 11)
-#define IA64_FR12_REGNUM (IA64_FR0_REGNUM + 12)
-#define IA64_FR13_REGNUM (IA64_FR0_REGNUM + 13)
-#define IA64_FR14_REGNUM (IA64_FR0_REGNUM + 14)
-#define IA64_FR15_REGNUM (IA64_FR0_REGNUM + 15)
-#define IA64_FR16_REGNUM (IA64_FR0_REGNUM + 16)
-#define IA64_FR31_REGNUM (IA64_FR0_REGNUM + 31)
-#define IA64_FR32_REGNUM (IA64_FR0_REGNUM + 32)
-#define IA64_FR127_REGNUM (IA64_FR0_REGNUM + 127)
+#define IA64_FR0_REGNUM 128
+#define IA64_FR1_REGNUM (IA64_FR0_REGNUM + 1)
+#define IA64_FR2_REGNUM (IA64_FR0_REGNUM + 2)
+#define IA64_FR8_REGNUM (IA64_FR0_REGNUM + 8)
+#define IA64_FR9_REGNUM (IA64_FR0_REGNUM + 9)
+#define IA64_FR10_REGNUM (IA64_FR0_REGNUM + 10)
+#define IA64_FR11_REGNUM (IA64_FR0_REGNUM + 11)
+#define IA64_FR12_REGNUM (IA64_FR0_REGNUM + 12)
+#define IA64_FR13_REGNUM (IA64_FR0_REGNUM + 13)
+#define IA64_FR14_REGNUM (IA64_FR0_REGNUM + 14)
+#define IA64_FR15_REGNUM (IA64_FR0_REGNUM + 15)
+#define IA64_FR16_REGNUM (IA64_FR0_REGNUM + 16)
+#define IA64_FR31_REGNUM (IA64_FR0_REGNUM + 31)
+#define IA64_FR32_REGNUM (IA64_FR0_REGNUM + 32)
+#define IA64_FR127_REGNUM (IA64_FR0_REGNUM + 127)
/* Predicate registers; There are 64 of these one bit registers. It'd
be more convenient (implementation-wise) to use a single 64 bit
word with all of these register in them. Note that there's also a
IA64_PR_REGNUM below which contains all the bits and is used for
communicating the actual values to the target. */
-#define IA64_PR0_REGNUM 256
-#define IA64_PR1_REGNUM (IA64_PR0_REGNUM + 1)
-#define IA64_PR2_REGNUM (IA64_PR0_REGNUM + 2)
-#define IA64_PR3_REGNUM (IA64_PR0_REGNUM + 3)
-#define IA64_PR4_REGNUM (IA64_PR0_REGNUM + 4)
-#define IA64_PR5_REGNUM (IA64_PR0_REGNUM + 5)
-#define IA64_PR6_REGNUM (IA64_PR0_REGNUM + 6)
-#define IA64_PR7_REGNUM (IA64_PR0_REGNUM + 7)
-#define IA64_PR8_REGNUM (IA64_PR0_REGNUM + 8)
-#define IA64_PR9_REGNUM (IA64_PR0_REGNUM + 9)
-#define IA64_PR10_REGNUM (IA64_PR0_REGNUM + 10)
-#define IA64_PR11_REGNUM (IA64_PR0_REGNUM + 11)
-#define IA64_PR12_REGNUM (IA64_PR0_REGNUM + 12)
-#define IA64_PR13_REGNUM (IA64_PR0_REGNUM + 13)
-#define IA64_PR14_REGNUM (IA64_PR0_REGNUM + 14)
-#define IA64_PR15_REGNUM (IA64_PR0_REGNUM + 15)
-#define IA64_PR16_REGNUM (IA64_PR0_REGNUM + 16)
-#define IA64_PR17_REGNUM (IA64_PR0_REGNUM + 17)
-#define IA64_PR18_REGNUM (IA64_PR0_REGNUM + 18)
-#define IA64_PR19_REGNUM (IA64_PR0_REGNUM + 19)
-#define IA64_PR20_REGNUM (IA64_PR0_REGNUM + 20)
-#define IA64_PR21_REGNUM (IA64_PR0_REGNUM + 21)
-#define IA64_PR22_REGNUM (IA64_PR0_REGNUM + 22)
-#define IA64_PR23_REGNUM (IA64_PR0_REGNUM + 23)
-#define IA64_PR24_REGNUM (IA64_PR0_REGNUM + 24)
-#define IA64_PR25_REGNUM (IA64_PR0_REGNUM + 25)
-#define IA64_PR26_REGNUM (IA64_PR0_REGNUM + 26)
-#define IA64_PR27_REGNUM (IA64_PR0_REGNUM + 27)
-#define IA64_PR28_REGNUM (IA64_PR0_REGNUM + 28)
-#define IA64_PR29_REGNUM (IA64_PR0_REGNUM + 29)
-#define IA64_PR30_REGNUM (IA64_PR0_REGNUM + 30)
-#define IA64_PR31_REGNUM (IA64_PR0_REGNUM + 31)
-#define IA64_PR32_REGNUM (IA64_PR0_REGNUM + 32)
-#define IA64_PR33_REGNUM (IA64_PR0_REGNUM + 33)
-#define IA64_PR34_REGNUM (IA64_PR0_REGNUM + 34)
-#define IA64_PR35_REGNUM (IA64_PR0_REGNUM + 35)
-#define IA64_PR36_REGNUM (IA64_PR0_REGNUM + 36)
-#define IA64_PR37_REGNUM (IA64_PR0_REGNUM + 37)
-#define IA64_PR38_REGNUM (IA64_PR0_REGNUM + 38)
-#define IA64_PR39_REGNUM (IA64_PR0_REGNUM + 39)
-#define IA64_PR40_REGNUM (IA64_PR0_REGNUM + 40)
-#define IA64_PR41_REGNUM (IA64_PR0_REGNUM + 41)
-#define IA64_PR42_REGNUM (IA64_PR0_REGNUM + 42)
-#define IA64_PR43_REGNUM (IA64_PR0_REGNUM + 43)
-#define IA64_PR44_REGNUM (IA64_PR0_REGNUM + 44)
-#define IA64_PR45_REGNUM (IA64_PR0_REGNUM + 45)
-#define IA64_PR46_REGNUM (IA64_PR0_REGNUM + 46)
-#define IA64_PR47_REGNUM (IA64_PR0_REGNUM + 47)
-#define IA64_PR48_REGNUM (IA64_PR0_REGNUM + 48)
-#define IA64_PR49_REGNUM (IA64_PR0_REGNUM + 49)
-#define IA64_PR50_REGNUM (IA64_PR0_REGNUM + 50)
-#define IA64_PR51_REGNUM (IA64_PR0_REGNUM + 51)
-#define IA64_PR52_REGNUM (IA64_PR0_REGNUM + 52)
-#define IA64_PR53_REGNUM (IA64_PR0_REGNUM + 53)
-#define IA64_PR54_REGNUM (IA64_PR0_REGNUM + 54)
-#define IA64_PR55_REGNUM (IA64_PR0_REGNUM + 55)
-#define IA64_PR56_REGNUM (IA64_PR0_REGNUM + 56)
-#define IA64_PR57_REGNUM (IA64_PR0_REGNUM + 57)
-#define IA64_PR58_REGNUM (IA64_PR0_REGNUM + 58)
-#define IA64_PR59_REGNUM (IA64_PR0_REGNUM + 59)
-#define IA64_PR60_REGNUM (IA64_PR0_REGNUM + 60)
-#define IA64_PR61_REGNUM (IA64_PR0_REGNUM + 61)
-#define IA64_PR62_REGNUM (IA64_PR0_REGNUM + 62)
-#define IA64_PR63_REGNUM (IA64_PR0_REGNUM + 63)
+#define IA64_PR0_REGNUM 256
+#define IA64_PR1_REGNUM (IA64_PR0_REGNUM + 1)
+#define IA64_PR2_REGNUM (IA64_PR0_REGNUM + 2)
+#define IA64_PR3_REGNUM (IA64_PR0_REGNUM + 3)
+#define IA64_PR4_REGNUM (IA64_PR0_REGNUM + 4)
+#define IA64_PR5_REGNUM (IA64_PR0_REGNUM + 5)
+#define IA64_PR6_REGNUM (IA64_PR0_REGNUM + 6)
+#define IA64_PR7_REGNUM (IA64_PR0_REGNUM + 7)
+#define IA64_PR8_REGNUM (IA64_PR0_REGNUM + 8)
+#define IA64_PR9_REGNUM (IA64_PR0_REGNUM + 9)
+#define IA64_PR10_REGNUM (IA64_PR0_REGNUM + 10)
+#define IA64_PR11_REGNUM (IA64_PR0_REGNUM + 11)
+#define IA64_PR12_REGNUM (IA64_PR0_REGNUM + 12)
+#define IA64_PR13_REGNUM (IA64_PR0_REGNUM + 13)
+#define IA64_PR14_REGNUM (IA64_PR0_REGNUM + 14)
+#define IA64_PR15_REGNUM (IA64_PR0_REGNUM + 15)
+#define IA64_PR16_REGNUM (IA64_PR0_REGNUM + 16)
+#define IA64_PR17_REGNUM (IA64_PR0_REGNUM + 17)
+#define IA64_PR18_REGNUM (IA64_PR0_REGNUM + 18)
+#define IA64_PR19_REGNUM (IA64_PR0_REGNUM + 19)
+#define IA64_PR20_REGNUM (IA64_PR0_REGNUM + 20)
+#define IA64_PR21_REGNUM (IA64_PR0_REGNUM + 21)
+#define IA64_PR22_REGNUM (IA64_PR0_REGNUM + 22)
+#define IA64_PR23_REGNUM (IA64_PR0_REGNUM + 23)
+#define IA64_PR24_REGNUM (IA64_PR0_REGNUM + 24)
+#define IA64_PR25_REGNUM (IA64_PR0_REGNUM + 25)
+#define IA64_PR26_REGNUM (IA64_PR0_REGNUM + 26)
+#define IA64_PR27_REGNUM (IA64_PR0_REGNUM + 27)
+#define IA64_PR28_REGNUM (IA64_PR0_REGNUM + 28)
+#define IA64_PR29_REGNUM (IA64_PR0_REGNUM + 29)
+#define IA64_PR30_REGNUM (IA64_PR0_REGNUM + 30)
+#define IA64_PR31_REGNUM (IA64_PR0_REGNUM + 31)
+#define IA64_PR32_REGNUM (IA64_PR0_REGNUM + 32)
+#define IA64_PR33_REGNUM (IA64_PR0_REGNUM + 33)
+#define IA64_PR34_REGNUM (IA64_PR0_REGNUM + 34)
+#define IA64_PR35_REGNUM (IA64_PR0_REGNUM + 35)
+#define IA64_PR36_REGNUM (IA64_PR0_REGNUM + 36)
+#define IA64_PR37_REGNUM (IA64_PR0_REGNUM + 37)
+#define IA64_PR38_REGNUM (IA64_PR0_REGNUM + 38)
+#define IA64_PR39_REGNUM (IA64_PR0_REGNUM + 39)
+#define IA64_PR40_REGNUM (IA64_PR0_REGNUM + 40)
+#define IA64_PR41_REGNUM (IA64_PR0_REGNUM + 41)
+#define IA64_PR42_REGNUM (IA64_PR0_REGNUM + 42)
+#define IA64_PR43_REGNUM (IA64_PR0_REGNUM + 43)
+#define IA64_PR44_REGNUM (IA64_PR0_REGNUM + 44)
+#define IA64_PR45_REGNUM (IA64_PR0_REGNUM + 45)
+#define IA64_PR46_REGNUM (IA64_PR0_REGNUM + 46)
+#define IA64_PR47_REGNUM (IA64_PR0_REGNUM + 47)
+#define IA64_PR48_REGNUM (IA64_PR0_REGNUM + 48)
+#define IA64_PR49_REGNUM (IA64_PR0_REGNUM + 49)
+#define IA64_PR50_REGNUM (IA64_PR0_REGNUM + 50)
+#define IA64_PR51_REGNUM (IA64_PR0_REGNUM + 51)
+#define IA64_PR52_REGNUM (IA64_PR0_REGNUM + 52)
+#define IA64_PR53_REGNUM (IA64_PR0_REGNUM + 53)
+#define IA64_PR54_REGNUM (IA64_PR0_REGNUM + 54)
+#define IA64_PR55_REGNUM (IA64_PR0_REGNUM + 55)
+#define IA64_PR56_REGNUM (IA64_PR0_REGNUM + 56)
+#define IA64_PR57_REGNUM (IA64_PR0_REGNUM + 57)
+#define IA64_PR58_REGNUM (IA64_PR0_REGNUM + 58)
+#define IA64_PR59_REGNUM (IA64_PR0_REGNUM + 59)
+#define IA64_PR60_REGNUM (IA64_PR0_REGNUM + 60)
+#define IA64_PR61_REGNUM (IA64_PR0_REGNUM + 61)
+#define IA64_PR62_REGNUM (IA64_PR0_REGNUM + 62)
+#define IA64_PR63_REGNUM (IA64_PR0_REGNUM + 63)
/* Branch registers: 8 64-bit registers for holding branch targets. */
-#define IA64_BR0_REGNUM 320
-#define IA64_BR1_REGNUM (IA64_BR0_REGNUM + 1)
-#define IA64_BR2_REGNUM (IA64_BR0_REGNUM + 2)
-#define IA64_BR3_REGNUM (IA64_BR0_REGNUM + 3)
-#define IA64_BR4_REGNUM (IA64_BR0_REGNUM + 4)
-#define IA64_BR5_REGNUM (IA64_BR0_REGNUM + 5)
-#define IA64_BR6_REGNUM (IA64_BR0_REGNUM + 6)
-#define IA64_BR7_REGNUM (IA64_BR0_REGNUM + 7)
+#define IA64_BR0_REGNUM 320
+#define IA64_BR1_REGNUM (IA64_BR0_REGNUM + 1)
+#define IA64_BR2_REGNUM (IA64_BR0_REGNUM + 2)
+#define IA64_BR3_REGNUM (IA64_BR0_REGNUM + 3)
+#define IA64_BR4_REGNUM (IA64_BR0_REGNUM + 4)
+#define IA64_BR5_REGNUM (IA64_BR0_REGNUM + 5)
+#define IA64_BR6_REGNUM (IA64_BR0_REGNUM + 6)
+#define IA64_BR7_REGNUM (IA64_BR0_REGNUM + 7)
/* Virtual frame pointer; this matches IA64_FRAME_POINTER_REGNUM in
gcc/config/ia64/ia64.h. */
-#define IA64_VFP_REGNUM 328
+#define IA64_VFP_REGNUM 328
/* Virtual return address pointer; this matches
IA64_RETURN_ADDRESS_POINTER_REGNUM in gcc/config/ia64/ia64.h. */
-#define IA64_VRAP_REGNUM 329
+#define IA64_VRAP_REGNUM 329
/* Predicate registers: There are 64 of these 1-bit registers. We
define a single register which is used to communicate these values
to/from the target. We will somehow contrive to make it appear
that IA64_PR0_REGNUM thru IA64_PR63_REGNUM hold the actual values. */
-#define IA64_PR_REGNUM 330
+#define IA64_PR_REGNUM 330
/* Instruction pointer: 64 bits wide. */
-#define IA64_IP_REGNUM 331
+#define IA64_IP_REGNUM 331
/* Process Status Register. */
-#define IA64_PSR_REGNUM 332
+#define IA64_PSR_REGNUM 332
/* Current Frame Marker (raw form may be the cr.ifs). */
-#define IA64_CFM_REGNUM 333
+#define IA64_CFM_REGNUM 333
/* Application registers; 128 64-bit wide registers possible, but some
of them are reserved. */
-#define IA64_AR0_REGNUM 334
-#define IA64_KR0_REGNUM (IA64_AR0_REGNUM + 0)
-#define IA64_KR7_REGNUM (IA64_KR0_REGNUM + 7)
-
-#define IA64_RSC_REGNUM (IA64_AR0_REGNUM + 16)
-#define IA64_BSP_REGNUM (IA64_AR0_REGNUM + 17)
-#define IA64_BSPSTORE_REGNUM (IA64_AR0_REGNUM + 18)
-#define IA64_RNAT_REGNUM (IA64_AR0_REGNUM + 19)
-#define IA64_FCR_REGNUM (IA64_AR0_REGNUM + 21)
-#define IA64_EFLAG_REGNUM (IA64_AR0_REGNUM + 24)
-#define IA64_CSD_REGNUM (IA64_AR0_REGNUM + 25)
-#define IA64_SSD_REGNUM (IA64_AR0_REGNUM + 26)
-#define IA64_CFLG_REGNUM (IA64_AR0_REGNUM + 27)
-#define IA64_FSR_REGNUM (IA64_AR0_REGNUM + 28)
-#define IA64_FIR_REGNUM (IA64_AR0_REGNUM + 29)
-#define IA64_FDR_REGNUM (IA64_AR0_REGNUM + 30)
-#define IA64_CCV_REGNUM (IA64_AR0_REGNUM + 32)
-#define IA64_UNAT_REGNUM (IA64_AR0_REGNUM + 36)
-#define IA64_FPSR_REGNUM (IA64_AR0_REGNUM + 40)
-#define IA64_ITC_REGNUM (IA64_AR0_REGNUM + 44)
-#define IA64_PFS_REGNUM (IA64_AR0_REGNUM + 64)
-#define IA64_LC_REGNUM (IA64_AR0_REGNUM + 65)
-#define IA64_EC_REGNUM (IA64_AR0_REGNUM + 66)
+#define IA64_AR0_REGNUM 334
+#define IA64_KR0_REGNUM (IA64_AR0_REGNUM + 0)
+#define IA64_KR7_REGNUM (IA64_KR0_REGNUM + 7)
+
+#define IA64_RSC_REGNUM (IA64_AR0_REGNUM + 16)
+#define IA64_BSP_REGNUM (IA64_AR0_REGNUM + 17)
+#define IA64_BSPSTORE_REGNUM (IA64_AR0_REGNUM + 18)
+#define IA64_RNAT_REGNUM (IA64_AR0_REGNUM + 19)
+#define IA64_FCR_REGNUM (IA64_AR0_REGNUM + 21)
+#define IA64_EFLAG_REGNUM (IA64_AR0_REGNUM + 24)
+#define IA64_CSD_REGNUM (IA64_AR0_REGNUM + 25)
+#define IA64_SSD_REGNUM (IA64_AR0_REGNUM + 26)
+#define IA64_CFLG_REGNUM (IA64_AR0_REGNUM + 27)
+#define IA64_FSR_REGNUM (IA64_AR0_REGNUM + 28)
+#define IA64_FIR_REGNUM (IA64_AR0_REGNUM + 29)
+#define IA64_FDR_REGNUM (IA64_AR0_REGNUM + 30)
+#define IA64_CCV_REGNUM (IA64_AR0_REGNUM + 32)
+#define IA64_UNAT_REGNUM (IA64_AR0_REGNUM + 36)
+#define IA64_FPSR_REGNUM (IA64_AR0_REGNUM + 40)
+#define IA64_ITC_REGNUM (IA64_AR0_REGNUM + 44)
+#define IA64_PFS_REGNUM (IA64_AR0_REGNUM + 64)
+#define IA64_LC_REGNUM (IA64_AR0_REGNUM + 65)
+#define IA64_EC_REGNUM (IA64_AR0_REGNUM + 66)
/* NAT (Not A Thing) Bits for the general registers; there are 128 of
these. */
-#define IA64_NAT0_REGNUM 462
-#define IA64_NAT31_REGNUM (IA64_NAT0_REGNUM + 31)
-#define IA64_NAT32_REGNUM (IA64_NAT0_REGNUM + 32)
-#define IA64_NAT127_REGNUM (IA64_NAT0_REGNUM + 127)
+#define IA64_NAT0_REGNUM 462
+#define IA64_NAT31_REGNUM (IA64_NAT0_REGNUM + 31)
+#define IA64_NAT32_REGNUM (IA64_NAT0_REGNUM + 32)
+#define IA64_NAT127_REGNUM (IA64_NAT0_REGNUM + 127)
class frame_info_ptr;
struct regcache;
@@ -231,8 +231,8 @@ struct ia64_infcall_ops
struct ia64_gdbarch_tdep : gdbarch_tdep_base
{
- CORE_ADDR (*sigcontext_register_address) (struct gdbarch *, CORE_ADDR, int)
- = nullptr;
+ CORE_ADDR (*sigcontext_register_address)
+ (struct gdbarch *, CORE_ADDR, int) = nullptr;
int (*pc_in_sigtramp) (CORE_ADDR) = nullptr;
/* Return the total size of THIS_FRAME's register frame.
@@ -248,13 +248,15 @@ struct ia64_gdbarch_tdep : gdbarch_tdep_base
library was found to contain that function, then return zero.
This pointer may be NULL. */
- CORE_ADDR (*find_global_pointer_from_solib) (struct gdbarch *gdbarch,
- CORE_ADDR faddr) = nullptr;
+ CORE_ADDR (*find_global_pointer_from_solib)
+ (struct gdbarch *gdbarch, CORE_ADDR faddr) = nullptr;
/* ISA-specific data types. */
struct type *ia64_ext_type = nullptr;
- struct ia64_infcall_ops infcall_ops {};
+ struct ia64_infcall_ops infcall_ops
+ {
+ };
};
extern void ia64_write_pc (struct regcache *, CORE_ADDR);
diff --git a/gdb/ia64-vms-tdep.c b/gdb/ia64-vms-tdep.c
index 1ed0d2dfb71..c85707934ff 100644
--- a/gdb/ia64-vms-tdep.c
+++ b/gdb/ia64-vms-tdep.c
@@ -31,8 +31,8 @@
static int
ia64_vms_find_proc_info_x (unw_addr_space_t as, unw_word_t ip,
- unw_proc_info_t *pi,
- int need_unwind_info, void *arg)
+ unw_proc_info_t *pi, int need_unwind_info,
+ void *arg)
{
enum bfd_endian byte_order = gdbarch_byte_order (target_gdbarch ());
gdb_byte buf[32];
@@ -41,9 +41,9 @@ ia64_vms_find_proc_info_x (unw_addr_space_t as, unw_word_t ip,
CORE_ADDR table_addr;
unsigned int info_len;
- res = target_read (current_inferior ()->top_target (),
- TARGET_OBJECT_OPENVMS_UIB,
- annex + 2, buf, 0, sizeof (buf));
+ res
+ = target_read (current_inferior ()->top_target (),
+ TARGET_OBJECT_OPENVMS_UIB, annex + 2, buf, 0, sizeof (buf));
if (res != sizeof (buf))
return -UNW_ENOINFO;
@@ -75,8 +75,8 @@ ia64_vms_find_proc_info_x (unw_addr_space_t as, unw_word_t ip,
/* Read info. */
pi->unwind_info = xmalloc (pi->unwind_info_size);
- res = target_read_memory (table_addr + 8,
- (gdb_byte *) pi->unwind_info, pi->unwind_info_size);
+ res = target_read_memory (table_addr + 8, (gdb_byte *) pi->unwind_info,
+ pi->unwind_info_size);
if (res != 0)
{
xfree (pi->unwind_info);
@@ -103,8 +103,7 @@ ia64_vms_find_proc_info_x (unw_addr_space_t as, unw_word_t ip,
/* Libunwind callback accessor function for cleanup. */
static void
-ia64_vms_put_unwind_info (unw_addr_space_t as,
- unw_proc_info_t *pip, void *arg)
+ia64_vms_put_unwind_info (unw_addr_space_t as, unw_proc_info_t *pip, void *arg)
{
/* Nothing required for now. */
}
@@ -113,8 +112,7 @@ ia64_vms_put_unwind_info (unw_addr_space_t as,
unwind-info registration list. */
static int
-ia64_vms_get_dyn_info_list (unw_addr_space_t as,
- unw_word_t *dilap, void *arg)
+ia64_vms_get_dyn_info_list (unw_addr_space_t as, unw_word_t *dilap, void *arg)
{
return -UNW_ENOINFO;
}
@@ -144,7 +142,8 @@ ia64_openvms_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
ia64_vms_unw_rse_accessors = ia64_unw_rse_accessors;
ia64_vms_unw_rse_accessors.find_proc_info = ia64_vms_find_proc_info_x;
ia64_vms_unw_rse_accessors.put_unwind_info = ia64_vms_put_unwind_info;
- ia64_vms_unw_rse_accessors.get_dyn_info_list_addr = ia64_vms_get_dyn_info_list;
+ ia64_vms_unw_rse_accessors.get_dyn_info_list_addr
+ = ia64_vms_get_dyn_info_list;
ia64_vms_libunwind_descr = ia64_libunwind_descr;
ia64_vms_libunwind_descr.accessors = &ia64_vms_unw_accessors;
@@ -155,6 +154,7 @@ ia64_openvms_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
}
void _initialize_ia64_vms_tdep ();
+
void
_initialize_ia64_vms_tdep ()
{
diff --git a/gdb/inf-child.c b/gdb/inf-child.c
index 42ff2aced79..f1d018d29ae 100644
--- a/gdb/inf-child.c
+++ b/gdb/inf-child.c
@@ -39,11 +39,9 @@
#include <fcntl.h>
#include <unistd.h>
-static const target_info inf_child_target_info = {
- "native",
- N_("Native process"),
- N_("Native process (started by the \"run\" command).")
-};
+static const target_info inf_child_target_info
+ = { "native", N_ ("Native process"),
+ N_ ("Native process (started by the \"run\" command).") };
const target_info &
inf_child_target::info () const
@@ -59,15 +57,14 @@ host_status_to_waitstatus (int hoststatus)
if (WIFEXITED (hoststatus))
return target_waitstatus ().set_exited (WEXITSTATUS (hoststatus));
else if (!WIFSTOPPED (hoststatus))
- return target_waitstatus ().set_signalled
- (gdb_signal_from_host (WTERMSIG (hoststatus)));
+ return target_waitstatus ().set_signalled (
+ gdb_signal_from_host (WTERMSIG (hoststatus)));
else
- return target_waitstatus ().set_stopped
- (gdb_signal_from_host (WSTOPSIG (hoststatus)));
+ return target_waitstatus ().set_stopped (
+ gdb_signal_from_host (WSTOPSIG (hoststatus)));
}
-inf_child_target::~inf_child_target ()
-{}
+inf_child_target::~inf_child_target () {}
void
inf_child_target::post_attach (int pid)
@@ -170,7 +167,7 @@ void
inf_child_target::disconnect (const char *args, int from_tty)
{
if (args != NULL)
- error (_("Argument given to \"disconnect\"."));
+ error (_ ("Argument given to \"disconnect\"."));
/* This offers to detach/kill current inferiors, and then pops all
targets. */
@@ -310,7 +307,8 @@ inf_child_target::fileio_pread (int fd, gdb_byte *read_buf, int len,
/* Implementation of to_fileio_fstat. */
int
-inf_child_target::fileio_fstat (int fd, struct stat *sb, fileio_error *target_errno)
+inf_child_target::fileio_fstat (int fd, struct stat *sb,
+ fileio_error *target_errno)
{
int ret;
@@ -358,7 +356,7 @@ inf_child_target::fileio_readlink (struct inferior *inf, const char *filename,
{
/* We support readlink only on systems that also provide a compile-time
maximum path length (PATH_MAX), at least for now. */
-#if defined (PATH_MAX)
+#if defined(PATH_MAX)
char buf[PATH_MAX];
int len;
diff --git a/gdb/inf-child.h b/gdb/inf-child.h
index 017e8e35680..f0a383d7cb1 100644
--- a/gdb/inf-child.h
+++ b/gdb/inf-child.h
@@ -30,6 +30,7 @@ class inf_child_target
: public memory_breakpoint_target<process_stratum_target>
{
public:
+
inf_child_target () = default;
~inf_child_target () override = 0;
@@ -63,8 +64,9 @@ public:
bool can_run () override;
bool can_create_inferior () override;
- void create_inferior (const char *, const std::string &,
- char **, int) override = 0;
+ void create_inferior (const char *, const std::string &, char **,
+ int) override
+ = 0;
bool can_attach () override;
void attach (const char *, int) override = 0;
@@ -73,26 +75,27 @@ public:
const char *pid_to_exec_file (int pid) override;
- int fileio_open (struct inferior *inf, const char *filename,
- int flags, int mode, int warn_if_slow,
+ int fileio_open (struct inferior *inf, const char *filename, int flags,
+ int mode, int warn_if_slow,
fileio_error *target_errno) override;
int fileio_pwrite (int fd, const gdb_byte *write_buf, int len,
ULONGEST offset, fileio_error *target_errno) override;
- int fileio_pread (int fd, gdb_byte *read_buf, int len,
- ULONGEST offset, fileio_error *target_errno) override;
- int fileio_fstat (int fd, struct stat *sb, fileio_error *target_errno) override;
+ int fileio_pread (int fd, gdb_byte *read_buf, int len, ULONGEST offset,
+ fileio_error *target_errno) override;
+ int fileio_fstat (int fd, struct stat *sb,
+ fileio_error *target_errno) override;
int fileio_close (int fd, fileio_error *target_errno) override;
- int fileio_unlink (struct inferior *inf,
- const char *filename,
+ int fileio_unlink (struct inferior *inf, const char *filename,
fileio_error *target_errno) override;
- gdb::optional<std::string> fileio_readlink (struct inferior *inf,
- const char *filename,
- fileio_error *target_errno) override;
+ gdb::optional<std::string>
+ fileio_readlink (struct inferior *inf, const char *filename,
+ fileio_error *target_errno) override;
bool use_agent (bool use) override;
bool can_use_agent () override;
protected:
+
/* Unpush the target if it wasn't explicitly open with "target native"
and there are no live inferiors left. Note: if calling this as a
result of a mourn or detach, the current inferior shall already
diff --git a/gdb/inf-loop.c b/gdb/inf-loop.c
index f49d1c3c872..fe864999931 100644
--- a/gdb/inf-loop.c
+++ b/gdb/inf-loop.c
@@ -85,7 +85,7 @@ inferior_event_handler (enum inferior_event_type event_type)
break;
default:
- gdb_printf (gdb_stderr, _("Event type not recognized.\n"));
+ gdb_printf (gdb_stderr, _ ("Event type not recognized.\n"));
break;
}
}
diff --git a/gdb/inf-loop.h b/gdb/inf-loop.h
index c2f6d6c43de..fed40230de0 100644
--- a/gdb/inf-loop.h
+++ b/gdb/inf-loop.h
@@ -20,7 +20,7 @@
#ifndef INF_LOOP_H
#define INF_LOOP_H
-#include "target.h" /* For enum inferior_event_type. */
+#include "target.h" /* For enum inferior_event_type. */
extern void inferior_event_handler (enum inferior_event_type event_type);
diff --git a/gdb/inf-ptrace.c b/gdb/inf-ptrace.c
index a3351658705..8864bdfeec3 100644
--- a/gdb/inf-ptrace.c
+++ b/gdb/inf-ptrace.c
@@ -34,8 +34,6 @@
#include "utils.h"
#include "gdbarch.h"
-
-
static PTRACE_TYPE_RET
gdb_ptrace (PTRACE_TYPE_ARG1 request, ptid_t ptid, PTRACE_TYPE_ARG3 addr,
PTRACE_TYPE_ARG4 data)
@@ -51,10 +49,7 @@ gdb_ptrace (PTRACE_TYPE_ARG1 request, ptid_t ptid, PTRACE_TYPE_ARG3 addr,
/* The event pipe registered as a waitable file in the event loop. */
event_pipe inf_ptrace_target::m_event_pipe;
-inf_ptrace_target::~inf_ptrace_target ()
-{}
-
-
+inf_ptrace_target::~inf_ptrace_target () {}
/* Prepare to be traced. */
@@ -73,8 +68,8 @@ inf_ptrace_me (void)
void
inf_ptrace_target::create_inferior (const char *exec_file,
- const std::string &allargs,
- char **env, int from_tty)
+ const std::string &allargs, char **env,
+ int from_tty)
{
inferior *inf = current_inferior ();
@@ -83,7 +78,7 @@ inf_ptrace_target::create_inferior (const char *exec_file,
int ops_already_pushed = inf->target_is_pushed (this);
target_unpush_up unpusher;
- if (! ops_already_pushed)
+ if (!ops_already_pushed)
{
/* Clear possible core file with its process_stratum. */
inf->push_target (this);
@@ -139,11 +134,11 @@ inf_ptrace_target::attach (const char *args, int from_tty)
pid_t pid = parse_pid_to_attach (args);
- if (pid == getpid ()) /* Trying to masturbate? */
- error (_("I refuse to debug myself!"));
+ if (pid == getpid ()) /* Trying to masturbate? */
+ error (_ ("I refuse to debug myself!"));
target_unpush_up unpusher;
- if (! ops_already_pushed)
+ if (!ops_already_pushed)
{
/* target_pid_to_str already uses the target. Also clear possible core
file with its process_stratum. */
@@ -155,11 +150,11 @@ inf_ptrace_target::attach (const char *args, int from_tty)
#ifdef PT_ATTACH
errno = 0;
- ptrace (PT_ATTACH, pid, (PTRACE_TYPE_ARG3)0, 0);
+ ptrace (PT_ATTACH, pid, (PTRACE_TYPE_ARG3) 0, 0);
if (errno != 0)
perror_with_name (("ptrace"));
#else
- error (_("This system does not support attaching to a process"));
+ error (_ ("This system does not support attaching to a process"));
#endif
inferior_appeared (inf, pid);
@@ -192,11 +187,11 @@ inf_ptrace_target::detach (inferior *inf, int from_tty)
previously attached to the inferior. It *might* work if we
started the process ourselves. */
errno = 0;
- ptrace (PT_DETACH, pid, (PTRACE_TYPE_ARG3)1, 0);
+ ptrace (PT_DETACH, pid, (PTRACE_TYPE_ARG3) 1, 0);
if (errno != 0)
perror_with_name (("ptrace"));
#else
- error (_("This system does not support detaching from a process"));
+ error (_ ("This system does not support detaching from a process"));
#endif
detach_success (inf);
@@ -224,7 +219,7 @@ inf_ptrace_target::kill ()
if (pid == 0)
return;
- ptrace (PT_KILL, pid, (PTRACE_TYPE_ARG3)0, 0);
+ ptrace (PT_KILL, pid, (PTRACE_TYPE_ARG3) 0, 0);
waitpid (pid, &status, 0);
target_mourn_inferior (inferior_ptid);
@@ -281,7 +276,8 @@ inf_ptrace_target::resume (ptid_t ptid, int step, enum gdb_signal signal)
where it was. If GDB wanted it to start some other way, we have
already written a new program counter value to the child. */
errno = 0;
- gdb_ptrace (request, ptid, (PTRACE_TYPE_ARG3)1, gdb_signal_to_host (signal));
+ gdb_ptrace (request, ptid, (PTRACE_TYPE_ARG3) 1,
+ gdb_signal_to_host (signal));
if (errno != 0)
perror_with_name (("ptrace"));
}
@@ -334,7 +330,7 @@ inf_ptrace_target::wait (ptid_t ptid, struct target_waitstatus *ourstatus,
}
gdb_printf (gdb_stderr,
- _("Child process unexpectedly missing: %s.\n"),
+ _ ("Child process unexpectedly missing: %s.\n"),
safe_strerror (save_errno));
ourstatus->set_ignore ();
@@ -358,8 +354,7 @@ inf_ptrace_target::wait (ptid_t ptid, struct target_waitstatus *ourstatus,
be non-null. Return the number of transferred bytes. */
static ULONGEST
-inf_ptrace_peek_poke (ptid_t ptid, gdb_byte *readbuf,
- const gdb_byte *writebuf,
+inf_ptrace_peek_poke (ptid_t ptid, gdb_byte *readbuf, const gdb_byte *writebuf,
ULONGEST addr, ULONGEST len)
{
ULONGEST n;
@@ -371,9 +366,7 @@ inf_ptrace_peek_poke (ptid_t ptid, gdb_byte *readbuf,
ULONGEST skip = addr & (sizeof (PTRACE_TYPE_RET) - 1);
addr -= skip;
- for (n = 0;
- n < len;
- n += chunk, addr += sizeof (PTRACE_TYPE_RET), skip = 0)
+ for (n = 0; n < len; n += chunk, addr += sizeof (PTRACE_TYPE_RET), skip = 0)
{
/* Restrict to a chunk that fits in the current word. */
chunk = std::min (sizeof (PTRACE_TYPE_RET) - skip, len - n);
@@ -390,7 +383,7 @@ inf_ptrace_peek_poke (ptid_t ptid, gdb_byte *readbuf,
{
errno = 0;
buf.word = gdb_ptrace (PT_READ_I, ptid,
- (PTRACE_TYPE_ARG3)(uintptr_t) addr, 0);
+ (PTRACE_TYPE_ARG3) (uintptr_t) addr, 0);
if (errno != 0)
break;
if (readbuf != NULL)
@@ -400,15 +393,15 @@ inf_ptrace_peek_poke (ptid_t ptid, gdb_byte *readbuf,
{
memcpy (buf.byte + skip, writebuf + n, chunk);
errno = 0;
- gdb_ptrace (PT_WRITE_D, ptid, (PTRACE_TYPE_ARG3)(uintptr_t) addr,
- buf.word);
+ gdb_ptrace (PT_WRITE_D, ptid, (PTRACE_TYPE_ARG3) (uintptr_t) addr,
+ buf.word);
if (errno != 0)
{
/* Using the appropriate one (I or D) is necessary for
Gould NP1, at least. */
errno = 0;
- gdb_ptrace (PT_WRITE_I, ptid, (PTRACE_TYPE_ARG3)(uintptr_t) addr,
- buf.word);
+ gdb_ptrace (PT_WRITE_I, ptid,
+ (PTRACE_TYPE_ARG3) (uintptr_t) addr, buf.word);
if (errno != 0)
break;
}
@@ -421,10 +414,10 @@ inf_ptrace_peek_poke (ptid_t ptid, gdb_byte *readbuf,
/* Implement the to_xfer_partial target_ops method. */
enum target_xfer_status
-inf_ptrace_target::xfer_partial (enum target_object object,
- const char *annex, gdb_byte *readbuf,
- const gdb_byte *writebuf,
- ULONGEST offset, ULONGEST len, ULONGEST *xfered_len)
+inf_ptrace_target::xfer_partial (enum target_object object, const char *annex,
+ gdb_byte *readbuf, const gdb_byte *writebuf,
+ ULONGEST offset, ULONGEST len,
+ ULONGEST *xfered_len)
{
ptid_t ptid = inferior_ptid;
@@ -450,7 +443,7 @@ inf_ptrace_target::xfer_partial (enum target_object object,
piod.piod_len = len;
errno = 0;
- if (gdb_ptrace (PT_IO, ptid, (caddr_t)&piod, 0) == 0)
+ if (gdb_ptrace (PT_IO, ptid, (caddr_t) &piod, 0) == 0)
{
/* Return the actual number of bytes read or written. */
*xfered_len = piod.piod_len;
@@ -463,15 +456,15 @@ inf_ptrace_target::xfer_partial (enum target_object object,
return TARGET_XFER_EOF;
}
#endif
- *xfered_len = inf_ptrace_peek_poke (ptid, readbuf, writebuf,
- offset, len);
+ *xfered_len
+ = inf_ptrace_peek_poke (ptid, readbuf, writebuf, offset, len);
return *xfered_len != 0 ? TARGET_XFER_OK : TARGET_XFER_EOF;
case TARGET_OBJECT_UNWIND_TABLE:
return TARGET_XFER_E_IO;
case TARGET_OBJECT_AUXV:
-#if defined (PT_IO) && defined (PIOD_READ_AUXV)
+#if defined(PT_IO) && defined(PIOD_READ_AUXV)
/* OpenBSD 4.5 has a new PIOD_READ_AUXV operation for the PT_IO
request that allows us to read the auxilliary vector. Other
BSD's may follow if they feel the need to support PIE. */
@@ -486,7 +479,7 @@ inf_ptrace_target::xfer_partial (enum target_object object,
piod.piod_len = len;
errno = 0;
- if (gdb_ptrace (PT_IO, ptid, (caddr_t)&piod, 0) == 0)
+ if (gdb_ptrace (PT_IO, ptid, (caddr_t) &piod, 0) == 0)
{
/* Return the actual number of bytes read or written. */
*xfered_len = piod.piod_len;
@@ -520,7 +513,7 @@ inf_ptrace_target::files_info ()
{
struct inferior *inf = current_inferior ();
- gdb_printf (_("\tUsing the running image of %s %s.\n"),
+ gdb_printf (_ ("\tUsing the running image of %s %s.\n"),
inf->attach_flag ? "attached" : "child",
target_pid_to_str (inferior_ptid).c_str ());
}
diff --git a/gdb/inf-ptrace.h b/gdb/inf-ptrace.h
index 96fd4d71381..011f09551cc 100644
--- a/gdb/inf-ptrace.h
+++ b/gdb/inf-ptrace.h
@@ -44,8 +44,8 @@ struct inf_ptrace_target : public inf_child_target
void kill () override;
- void create_inferior (const char *, const std::string &,
- char **, int) override;
+ void create_inferior (const char *, const std::string &, char **,
+ int) override;
void mourn_inferior () override;
@@ -54,17 +54,14 @@ struct inf_ptrace_target : public inf_child_target
std::string pid_to_str (ptid_t) override;
enum target_xfer_status xfer_partial (enum target_object object,
- const char *annex,
- gdb_byte *readbuf,
+ const char *annex, gdb_byte *readbuf,
const gdb_byte *writebuf,
ULONGEST offset, ULONGEST len,
ULONGEST *xfered_len) override;
- bool is_async_p () override
- { return m_event_pipe.is_open (); }
+ bool is_async_p () override { return m_event_pipe.is_open (); }
- int async_wait_fd () override
- { return m_event_pipe.event_fd (); }
+ int async_wait_fd () override { return m_event_pipe.event_fd (); }
/* Helper routine used from SIGCHLD handlers to signal the async
event pipe. */
@@ -75,15 +72,15 @@ struct inf_ptrace_target : public inf_child_target
}
protected:
+
/* Helper routines for interacting with the async event pipe. */
- bool async_file_open ()
- { return m_event_pipe.open_pipe (); }
- void async_file_close ()
- { m_event_pipe.close_pipe (); }
- void async_file_flush ()
- { m_event_pipe.flush (); }
- void async_file_mark ()
- { m_event_pipe.mark (); }
+ bool async_file_open () { return m_event_pipe.open_pipe (); }
+
+ void async_file_close () { m_event_pipe.close_pipe (); }
+
+ void async_file_flush () { m_event_pipe.flush (); }
+
+ void async_file_mark () { m_event_pipe.mark (); }
/* Cleanup the inferior after a successful ptrace detach. */
void detach_success (inferior *inf);
@@ -100,6 +97,7 @@ protected:
virtual void post_startup_inferior (ptid_t ptid) = 0;
private:
+
static event_pipe m_event_pipe;
};
diff --git a/gdb/infcall.c b/gdb/infcall.c
index 4c2a4e4f400..28968d254cd 100644
--- a/gdb/infcall.c
+++ b/gdb/infcall.c
@@ -67,16 +67,16 @@ static bool debug_infcall = false;
static void
show_debug_infcall (struct ui_file *file, int from_tty,
- struct cmd_list_element *c, const char *value)
+ struct cmd_list_element *c, const char *value)
{
- gdb_printf (file, _("Inferior call debugging is %s.\n"), value);
+ gdb_printf (file, _ ("Inferior call debugging is %s.\n"), value);
}
/* If we can't find a function's name from its address,
we print this instead. */
#define RAW_FUNCTION_ADDRESS_FORMAT "at 0x%s"
-#define RAW_FUNCTION_ADDRESS_SIZE (sizeof (RAW_FUNCTION_ADDRESS_FORMAT) \
- + 2 * sizeof (CORE_ADDR))
+#define RAW_FUNCTION_ADDRESS_SIZE \
+ (sizeof (RAW_FUNCTION_ADDRESS_FORMAT) + 2 * sizeof (CORE_ADDR))
/* NOTE: cagney/2003-04-16: What's the future of this code?
@@ -85,13 +85,12 @@ show_debug_infcall (struct ui_file *file, int from_tty,
turn means restructuring the code so that it is event driven. */
static bool may_call_functions_p = true;
+
static void
show_may_call_functions_p (struct ui_file *file, int from_tty,
- struct cmd_list_element *c,
- const char *value)
+ struct cmd_list_element *c, const char *value)
{
- gdb_printf (file,
- _("Permission to call functions in the program is %s.\n"),
+ gdb_printf (file, _ ("Permission to call functions in the program is %s.\n"),
value);
}
@@ -116,13 +115,14 @@ show_may_call_functions_p (struct ui_file *file, int from_tty,
with "set coerce-float-to-double 0". */
static bool coerce_float_to_double_p = true;
+
static void
show_coerce_float_to_double_p (struct ui_file *file, int from_tty,
struct cmd_list_element *c, const char *value)
{
gdb_printf (file,
- _("Coercion of floats to doubles "
- "when calling functions is %s.\n"),
+ _ ("Coercion of floats to doubles "
+ "when calling functions is %s.\n"),
value);
}
@@ -134,13 +134,14 @@ show_coerce_float_to_double_p (struct ui_file *file, int from_tty,
The default is to stop in the frame where the signal was received. */
static bool unwind_on_signal_p = false;
+
static void
show_unwind_on_signal_p (struct ui_file *file, int from_tty,
struct cmd_list_element *c, const char *value)
{
gdb_printf (file,
- _("Unwinding of stack if a signal is "
- "received while in a call dummy is %s.\n"),
+ _ ("Unwinding of stack if a signal is "
+ "received while in a call dummy is %s.\n"),
value);
}
@@ -165,8 +166,8 @@ show_unwind_on_terminating_exception_p (struct ui_file *file, int from_tty,
{
gdb_printf (file,
- _("Unwind stack if a C++ exception is "
- "unhandled while in a call dummy is %s.\n"),
+ _ ("Unwind stack if a C++ exception is "
+ "unhandled while in a call dummy is %s.\n"),
value);
}
@@ -182,8 +183,7 @@ value_arg_coerce (struct gdbarch *gdbarch, struct value *arg,
{
const struct builtin_type *builtin = builtin_type (gdbarch);
struct type *arg_type = check_typedef (value_type (arg));
- struct type *type
- = param_type ? check_typedef (param_type) : arg_type;
+ struct type *type = param_type ? check_typedef (param_type) : arg_type;
/* Perform any Ada- and Fortran-specific coercion first. */
if (current_language->la_language == language_ada)
@@ -274,8 +274,7 @@ value_arg_coerce (struct gdbarch *gdbarch, struct value *arg,
/* See infcall.h. */
CORE_ADDR
-find_function_addr (struct value *function,
- struct type **retval_type,
+find_function_addr (struct value *function, struct type **retval_type,
struct type **function_type)
{
struct type *ftype = check_typedef (value_type (function));
@@ -288,8 +287,7 @@ find_function_addr (struct value *function,
part of it. */
/* Determine address to call. */
- if (ftype->code () == TYPE_CODE_FUNC
- || ftype->code () == TYPE_CODE_METHOD)
+ if (ftype->code () == TYPE_CODE_FUNC || ftype->code () == TYPE_CODE_METHOD)
funaddr = value_address (function);
else if (ftype->code () == TYPE_CODE_PTR)
{
@@ -297,11 +295,10 @@ find_function_addr (struct value *function,
ftype = check_typedef (ftype->target_type ());
if (ftype->code () == TYPE_CODE_FUNC
|| ftype->code () == TYPE_CODE_METHOD)
- funaddr = gdbarch_convert_from_func_ptr_addr
- (gdbarch, funaddr, current_inferior ()->top_target());
+ funaddr = gdbarch_convert_from_func_ptr_addr (
+ gdbarch, funaddr, current_inferior ()->top_target ());
}
- if (ftype->code () == TYPE_CODE_FUNC
- || ftype->code () == TYPE_CODE_METHOD)
+ if (ftype->code () == TYPE_CODE_FUNC || ftype->code () == TYPE_CODE_METHOD)
{
if (ftype->is_gnu_ifunc ())
{
@@ -342,15 +339,15 @@ find_function_addr (struct value *function,
/* Handle function descriptors lacking debug info. */
int found_descriptor = 0;
- funaddr = 0; /* pacify "gcc -Werror" */
+ funaddr = 0; /* pacify "gcc -Werror" */
if (VALUE_LVAL (function) == lval_memory)
{
CORE_ADDR nfunaddr;
funaddr = value_as_address (value_addr (function));
nfunaddr = funaddr;
- funaddr = gdbarch_convert_from_func_ptr_addr
- (gdbarch, funaddr, current_inferior ()->top_target ());
+ funaddr = gdbarch_convert_from_func_ptr_addr (
+ gdbarch, funaddr, current_inferior ()->top_target ());
if (funaddr != nfunaddr)
found_descriptor = 1;
}
@@ -360,7 +357,7 @@ find_function_addr (struct value *function,
}
}
else
- error (_("Invalid data type for function to be called."));
+ error (_ ("Invalid data type for function to be called."));
if (retval_type != NULL)
*retval_type = value_type;
@@ -373,18 +370,15 @@ find_function_addr (struct value *function,
function returns to. */
static CORE_ADDR
-push_dummy_code (struct gdbarch *gdbarch,
- CORE_ADDR sp, CORE_ADDR funaddr,
- gdb::array_view<value *> args,
- struct type *value_type,
+push_dummy_code (struct gdbarch *gdbarch, CORE_ADDR sp, CORE_ADDR funaddr,
+ gdb::array_view<value *> args, struct type *value_type,
CORE_ADDR *real_pc, CORE_ADDR *bp_addr,
struct regcache *regcache)
{
gdb_assert (gdbarch_push_dummy_code_p (gdbarch));
- return gdbarch_push_dummy_code (gdbarch, sp, funaddr,
- args.data (), args.size (),
- value_type, real_pc, bp_addr,
+ return gdbarch_push_dummy_code (gdbarch, sp, funaddr, args.data (),
+ args.size (), value_type, real_pc, bp_addr,
regcache);
}
@@ -394,12 +388,12 @@ void
error_call_unknown_return_type (const char *func_name)
{
if (func_name != NULL)
- error (_("'%s' has unknown return type; "
- "cast the call to its declared return type"),
+ error (_ ("'%s' has unknown return type; "
+ "cast the call to its declared return type"),
func_name);
else
- error (_("function has unknown return type; "
- "cast the call to its declared return type"));
+ error (_ ("function has unknown return type; "
+ "cast the call to its declared return type"));
}
/* Fetch the name of the function at FUNADDR.
@@ -420,15 +414,16 @@ get_function_name (CORE_ADDR funaddr, char *buf, int buf_size)
{
/* Try the minimal symbols. */
- struct bound_minimal_symbol msymbol = lookup_minimal_symbol_by_pc (funaddr);
+ struct bound_minimal_symbol msymbol
+ = lookup_minimal_symbol_by_pc (funaddr);
if (msymbol.minsym)
return msymbol.minsym->print_name ();
}
{
- std::string tmp = string_printf (_(RAW_FUNCTION_ADDRESS_FORMAT),
- hex_string (funaddr));
+ std::string tmp
+ = string_printf (_ (RAW_FUNCTION_ADDRESS_FORMAT), hex_string (funaddr));
gdb_assert (tmp.length () + 1 <= buf_size);
return strcpy (buf, tmp.c_str ());
@@ -481,8 +476,7 @@ get_call_return_value (struct call_return_meta_info *ri)
else
{
gdbarch_return_value_as_value (ri->gdbarch, ri->function, ri->value_type,
- get_current_regcache (),
- &retval, NULL);
+ get_current_regcache (), &retval, NULL);
if (stack_temporaries && class_or_union_p (ri->value_type))
{
/* Values of class type returned in registers are copied onto
@@ -520,8 +514,8 @@ struct call_thread_fsm : public thread_fsm
call_thread_fsm (struct ui *waiting_ui, struct interp *cmd_interp,
struct gdbarch *gdbarch, struct value *function,
- struct type *value_type,
- int struct_return_p, CORE_ADDR struct_addr);
+ struct type *value_type, int struct_return_p,
+ CORE_ADDR struct_addr);
bool should_stop (struct thread_info *thread) override;
@@ -534,8 +528,8 @@ call_thread_fsm::call_thread_fsm (struct ui *waiting_ui,
struct interp *cmd_interp,
struct gdbarch *gdbarch,
struct value *function,
- struct type *value_type,
- int struct_return_p, CORE_ADDR struct_addr)
+ struct type *value_type, int struct_return_p,
+ CORE_ADDR struct_addr)
: thread_fsm (cmd_interp),
waiting_ui (waiting_ui)
{
@@ -609,8 +603,7 @@ run_inferior_call (std::unique_ptr<call_thread_fsm> sm,
infcall_debug_printf ("call function at %s in thread %s, was_running = %d",
core_addr_to_string (real_pc),
- call_thread_ptid.to_string ().c_str (),
- was_running);
+ call_thread_ptid.to_string ().c_str (), was_running);
current_ui->unregister_file_handler ();
@@ -641,8 +634,9 @@ run_inferior_call (std::unique_ptr<call_thread_fsm> sm,
proceed (real_pc, GDB_SIGNAL_0);
- infrun_debug_show_threads ("non-exited threads after proceed for inferior-call",
- all_non_exited_threads ());
+ infrun_debug_show_threads (
+ "non-exited threads after proceed for inferior-call",
+ all_non_exited_threads ());
/* Inferior function calls are always synchronous, even if the
target supports asynchronous execution. */
@@ -684,8 +678,7 @@ run_inferior_call (std::unique_ptr<call_thread_fsm> sm,
marked running). In this example, whether the condition
evaluates true and thus we'll present a user-visible stop is
decided elsewhere. */
- if (!was_running
- && call_thread_ptid == inferior_ptid
+ if (!was_running && call_thread_ptid == inferior_ptid
&& stop_stack_dummy == STOP_STACK_DUMMY)
finish_thread_state (call_thread->inf->process_target (),
user_visible_resume_ptid (0));
@@ -748,13 +741,15 @@ reserve_stack_space (const type *values_type, CORE_ADDR &sp)
struct destructor_info
{
destructor_info (struct value *function, struct value *self)
- : function (function), self (self) { }
+ : function (function),
+ self (self)
+ {
+ }
struct value *function;
struct value *self;
};
-
/* Auxiliary function that takes a list of destructor functions
with their 'this' parameters, and invokes the functions. */
@@ -772,12 +767,11 @@ call_destructors (const std::list<destructor_info> &dtors_to_invoke,
/* See infcall.h. */
struct value *
-call_function_by_hand (struct value *function,
- type *default_return_type,
+call_function_by_hand (struct value *function, type *default_return_type,
gdb::array_view<value *> args)
{
- return call_function_by_hand_dummy (function, default_return_type,
- args, NULL, NULL);
+ return call_function_by_hand_dummy (function, default_return_type, args,
+ NULL, NULL);
}
/* All this stuff with a dummy frame may seem unnecessarily complicated
@@ -799,8 +793,7 @@ call_function_by_hand (struct value *function,
ARGS is modified to contain coerced values. */
struct value *
-call_function_by_hand_dummy (struct value *function,
- type *default_return_type,
+call_function_by_hand_dummy (struct value *function, type *default_return_type,
gdb::array_view<value *> args,
dummy_frame_dtor_ftype *dummy_dtor,
void *dummy_dtor_data)
@@ -821,17 +814,17 @@ call_function_by_hand_dummy (struct value *function,
char name_buf[RAW_FUNCTION_ADDRESS_SIZE];
if (!may_call_functions_p)
- error (_("Cannot call functions in the program: "
- "may-call-functions is off."));
+ error (_ ("Cannot call functions in the program: "
+ "may-call-functions is off."));
if (!target_has_execution ())
noprocess ();
if (get_traceframe_number () >= 0)
- error (_("May not call functions while looking at trace frames."));
+ error (_ ("May not call functions while looking at trace frames."));
if (execution_direction == EXEC_REVERSE)
- error (_("Cannot call functions in reverse mode."));
+ error (_ ("Cannot call functions in reverse mode."));
/* We're going to run the target, and inspect the thread's state
afterwards. Hold a strong reference so that the pointer remains
@@ -839,13 +832,14 @@ call_function_by_hand_dummy (struct value *function,
thread_info_ref call_thread
= thread_info_ref::new_reference (inferior_thread ());
- bool stack_temporaries = thread_stack_temporaries_enabled_p (call_thread.get ());
+ bool stack_temporaries
+ = thread_stack_temporaries_enabled_p (call_thread.get ());
frame = get_current_frame ();
gdbarch = get_frame_arch (frame);
if (!gdbarch_push_dummy_call_p (gdbarch))
- error (_("This target does not support function calls."));
+ error (_ ("This target does not support function calls."));
/* Find the function type and do a sanity check. */
type *ftype;
@@ -853,25 +847,25 @@ call_function_by_hand_dummy (struct value *function,
CORE_ADDR funaddr = find_function_addr (function, &values_type, &ftype);
if (is_nocall_function (ftype))
- error (_("Cannot call the function '%s' which does not follow the "
- "target calling convention."),
+ error (_ ("Cannot call the function '%s' which does not follow the "
+ "target calling convention."),
get_function_name (funaddr, name_buf, sizeof (name_buf)));
if (values_type == NULL || values_type->is_stub ())
values_type = default_return_type;
if (values_type == NULL)
{
- const char *name = get_function_name (funaddr,
- name_buf, sizeof (name_buf));
- error (_("'%s' has unknown return type; "
- "cast the call to its declared return type"),
+ const char *name
+ = get_function_name (funaddr, name_buf, sizeof (name_buf));
+ error (_ ("'%s' has unknown return type; "
+ "cast the call to its declared return type"),
name);
}
values_type = check_typedef (values_type);
if (args.size () < ftype->num_fields ())
- error (_("Too few arguments in function call."));
+ error (_ ("Too few arguments in function call."));
infcall_debug_printf ("calling %s", get_function_name (funaddr, name_buf,
sizeof (name_buf)));
@@ -1017,9 +1011,8 @@ call_function_by_hand_dummy (struct value *function,
/* Be careful BP_ADDR is in inferior PC encoding while
BP_ADDR_AS_ADDRESS is a plain memory address. */
- sp = push_dummy_code (gdbarch, sp, funaddr, args,
- target_values_type, &real_pc, &bp_addr,
- get_current_regcache ());
+ sp = push_dummy_code (gdbarch, sp, funaddr, args, target_values_type,
+ &real_pc, &bp_addr, get_current_regcache ());
/* Write a legitimate instruction at the point where the infcall
breakpoint is going to be inserted. While this instruction
@@ -1055,7 +1048,7 @@ call_function_by_hand_dummy (struct value *function,
break;
}
default:
- internal_error (_("bad switch"));
+ internal_error (_ ("bad switch"));
}
/* Coerce the arguments and handle pass-by-reference.
@@ -1099,20 +1092,21 @@ call_function_by_hand_dummy (struct value *function,
param_type = NULL;
value *original_arg = args[i];
- args[i] = value_arg_coerce (gdbarch, args[i],
- param_type, prototyped);
+ args[i] = value_arg_coerce (gdbarch, args[i], param_type, prototyped);
if (param_type == NULL)
continue;
auto info = language_pass_by_reference (param_type);
if (!info.copy_constructible)
- error (_("expression cannot be evaluated because the type '%s' "
- "is not copy constructible"), param_type->name ());
+ error (_ ("expression cannot be evaluated because the type '%s' "
+ "is not copy constructible"),
+ param_type->name ());
if (!info.destructible)
- error (_("expression cannot be evaluated because the type '%s' "
- "is not destructible"), param_type->name ());
+ error (_ ("expression cannot be evaluated because the type '%s' "
+ "is not destructible"),
+ param_type->name ());
if (info.trivially_copyable)
continue;
@@ -1137,14 +1131,15 @@ call_function_by_hand_dummy (struct value *function,
value *copy_ctor;
value *cctor_args[2] = { clone_ptr, original_arg };
find_overload_match (gdb::make_array_view (cctor_args, 2),
- param_type->name (), METHOD,
- &clone_ptr, nullptr, &copy_ctor, nullptr,
- nullptr, 0, EVAL_NORMAL);
+ param_type->name (), METHOD, &clone_ptr,
+ nullptr, &copy_ctor, nullptr, nullptr, 0,
+ EVAL_NORMAL);
if (copy_ctor == nullptr)
- error (_("expression cannot be evaluated because a copy "
- "constructor for the type '%s' could not be found "
- "(maybe inlined?)"), param_type->name ());
+ error (_ ("expression cannot be evaluated because a copy "
+ "constructor for the type '%s' could not be found "
+ "(maybe inlined?)"),
+ param_type->name ());
call_function_by_hand (copy_ctor, default_return_type,
gdb::make_array_view (cctor_args, 2));
@@ -1160,12 +1155,10 @@ call_function_by_hand_dummy (struct value *function,
the function by using the "~" name. This should be OK
because there can be only one dtor definition. */
const char *dtor_name = nullptr;
- for (int fieldnum = 0;
- fieldnum < TYPE_NFN_FIELDS (param_type);
+ for (int fieldnum = 0; fieldnum < TYPE_NFN_FIELDS (param_type);
fieldnum++)
{
- fn_field *fn
- = TYPE_FN_FIELDLIST1 (param_type, fieldnum);
+ fn_field *fn = TYPE_FN_FIELDLIST1 (param_type, fieldnum);
const char *field_name
= TYPE_FN_FIELDLIST_NAME (param_type, fieldnum);
@@ -1174,12 +1167,12 @@ call_function_by_hand_dummy (struct value *function,
}
if (dtor_name == nullptr)
- error (_("expression cannot be evaluated because a destructor "
- "for the type '%s' could not be found "
- "(maybe inlined?)"), param_type->name ());
+ error (_ ("expression cannot be evaluated because a destructor "
+ "for the type '%s' could not be found "
+ "(maybe inlined?)"),
+ param_type->name ());
- value *dtor
- = find_function_in_inferior (dtor_name, 0);
+ value *dtor = find_function_in_inferior (dtor_name, 0);
/* Insert the dtor to the front of the list to call them
in reverse order later. */
@@ -1212,8 +1205,8 @@ call_function_by_hand_dummy (struct value *function,
{
/* Add the new argument to the front of the argument list. */
new_args.reserve (args.size ());
- new_args.push_back
- (value_from_pointer (lookup_pointer_type (values_type), struct_addr));
+ new_args.push_back (
+ value_from_pointer (lookup_pointer_type (values_type), struct_addr));
new_args.insert (new_args.end (), args.begin (), args.end ());
args = new_args;
}
@@ -1222,8 +1215,8 @@ call_function_by_hand_dummy (struct value *function,
presumably, the ABI code knows where, in the call dummy, the
return address should be pointed. */
sp = gdbarch_push_dummy_call (gdbarch, function, get_current_regcache (),
- bp_addr, args.size (), args.data (),
- sp, return_method, struct_addr);
+ bp_addr, args.size (), args.data (), sp,
+ return_method, struct_addr);
/* Set up a frame ID for the dummy frame so we can pass it to
set_momentary_breakpoint. We need to give the breakpoint a frame
@@ -1247,8 +1240,8 @@ call_function_by_hand_dummy (struct value *function,
PUSH_DUMMY_CALL, saved as the dummy-frame TOS, and used by
dummy_id to form the frame ID's stack address. */
breakpoint *bpt
- = set_momentary_breakpoint (gdbarch, sal,
- dummy_id, bp_call_dummy).release ();
+ = set_momentary_breakpoint (gdbarch, sal, dummy_id, bp_call_dummy)
+ .release ();
/* set_momentary_breakpoint invalidates FRAME. */
frame = NULL;
@@ -1287,11 +1280,14 @@ call_function_by_hand_dummy (struct value *function,
stack. */
dummy_frame_push (caller_state.release (), &dummy_id, call_thread.get ());
if (dummy_dtor != NULL)
- register_dummy_frame_dtor (dummy_id, call_thread.get (),
- dummy_dtor, dummy_dtor_data);
+ register_dummy_frame_dtor (dummy_id, call_thread.get (), dummy_dtor,
+ dummy_dtor_data);
/* Register a clean-up for unwind_on_terminating_exception_breakpoint. */
- SCOPE_EXIT { delete_std_terminate_breakpoint (); };
+ SCOPE_EXIT
+ {
+ delete_std_terminate_breakpoint ();
+ };
/* - SNIP - SNIP - SNIP - SNIP - SNIP - SNIP - SNIP - SNIP - SNIP -
If you're looking to implement asynchronous dummy-frames, then
@@ -1312,8 +1308,7 @@ call_function_by_hand_dummy (struct value *function,
not report the stop to the user, and captures the return value
before the dummy frame is popped. run_inferior_call registers
it with the thread ASAP. */
- sm = new call_thread_fsm (current_ui, command_interp (),
- gdbarch, function,
+ sm = new call_thread_fsm (current_ui, command_interp (), gdbarch, function,
values_type,
return_method != return_method_normal,
struct_addr);
@@ -1390,8 +1385,8 @@ call_function_by_hand_dummy (struct value *function,
if (e.reason < 0)
{
- const char *name = get_function_name (funaddr,
- name_buf, sizeof (name_buf));
+ const char *name
+ = get_function_name (funaddr, name_buf, sizeof (name_buf));
discard_infcall_control_state (inf_status.release ());
@@ -1402,7 +1397,7 @@ call_function_by_hand_dummy (struct value *function,
switch (e.reason)
{
case RETURN_ERROR:
- throw_error (e.error, _("%s\n\
+ throw_error (e.error, _ ("%s\n\
An error occurred while in a function called from GDB.\n\
Evaluation of the expression containing the function\n\
(%s) will be abandoned.\n\
@@ -1417,10 +1412,10 @@ When the function is done executing, GDB will silently stop."),
/* If the program has exited, or we stopped at a different thread,
exit and inform the user. */
- if (! target_has_execution ())
+ if (!target_has_execution ())
{
- const char *name = get_function_name (funaddr,
- name_buf, sizeof (name_buf));
+ const char *name
+ = get_function_name (funaddr, name_buf, sizeof (name_buf));
/* If we try to restore the inferior status,
we'll crash as the inferior is no longer running. */
@@ -1430,17 +1425,17 @@ When the function is done executing, GDB will silently stop."),
but it will get garbage collected the next time the program is
run anyway. */
- error (_("The program being debugged exited while in a function "
- "called from GDB.\n"
- "Evaluation of the expression containing the function\n"
- "(%s) will be abandoned."),
+ error (_ ("The program being debugged exited while in a function "
+ "called from GDB.\n"
+ "Evaluation of the expression containing the function\n"
+ "(%s) will be abandoned."),
name);
}
if (call_thread_ptid != inferior_ptid)
{
- const char *name = get_function_name (funaddr,
- name_buf, sizeof (name_buf));
+ const char *name
+ = get_function_name (funaddr, name_buf, sizeof (name_buf));
/* We've switched threads. This can happen if another thread gets a
signal or breakpoint while our thread was running.
@@ -1450,7 +1445,7 @@ When the function is done executing, GDB will silently stop."),
/* Keep the dummy frame record, if the user switches back to the
thread with the hand-call, we'll need it. */
if (stopped_by_random_signal)
- error (_("\
+ error (_ ("\
The program received a signal in another thread while\n\
making a function call from GDB.\n\
Evaluation of the expression containing the function\n\
@@ -1458,7 +1453,7 @@ Evaluation of the expression containing the function\n\
When the function is done executing, GDB will silently stop."),
name);
else
- error (_("\
+ error (_ ("\
The program stopped in another thread while making a function call from GDB.\n\
Evaluation of the expression containing the function\n\
(%s) will be abandoned.\n\
@@ -1466,71 +1461,71 @@ When the function is done executing, GDB will silently stop."),
name);
}
- {
- /* Make a copy as NAME may be in an objfile freed by dummy_frame_pop. */
- std::string name = get_function_name (funaddr, name_buf,
- sizeof (name_buf));
+ {
+ /* Make a copy as NAME may be in an objfile freed by dummy_frame_pop. */
+ std::string name
+ = get_function_name (funaddr, name_buf, sizeof (name_buf));
- if (stopped_by_random_signal)
- {
- /* We stopped inside the FUNCTION because of a random
+ if (stopped_by_random_signal)
+ {
+ /* We stopped inside the FUNCTION because of a random
signal. Further execution of the FUNCTION is not
allowed. */
- if (unwind_on_signal_p)
- {
- /* The user wants the context restored. */
+ if (unwind_on_signal_p)
+ {
+ /* The user wants the context restored. */
- /* We must get back to the frame we were before the
+ /* We must get back to the frame we were before the
dummy call. */
- dummy_frame_pop (dummy_id, call_thread.get ());
+ dummy_frame_pop (dummy_id, call_thread.get ());
- /* We also need to restore inferior status to that before the
+ /* We also need to restore inferior status to that before the
dummy call. */
- restore_infcall_control_state (inf_status.release ());
+ restore_infcall_control_state (inf_status.release ());
- /* FIXME: Insert a bunch of wrap_here; name can be very
+ /* FIXME: Insert a bunch of wrap_here; name can be very
long if it's a C++ name with arguments and stuff. */
- error (_("\
+ error (_ ("\
The program being debugged was signaled while in a function called from GDB.\n\
GDB has restored the context to what it was before the call.\n\
To change this behavior use \"set unwindonsignal off\".\n\
Evaluation of the expression containing the function\n\
(%s) will be abandoned."),
- name.c_str ());
- }
- else
- {
- /* The user wants to stay in the frame where we stopped
+ name.c_str ());
+ }
+ else
+ {
+ /* The user wants to stay in the frame where we stopped
(default).
Discard inferior status, we're not at the same point
we started at. */
- discard_infcall_control_state (inf_status.release ());
+ discard_infcall_control_state (inf_status.release ());
- /* FIXME: Insert a bunch of wrap_here; name can be very
+ /* FIXME: Insert a bunch of wrap_here; name can be very
long if it's a C++ name with arguments and stuff. */
- error (_("\
+ error (_ ("\
The program being debugged was signaled while in a function called from GDB.\n\
GDB remains in the frame where the signal was received.\n\
To change this behavior use \"set unwindonsignal on\".\n\
Evaluation of the expression containing the function\n\
(%s) will be abandoned.\n\
When the function is done executing, GDB will silently stop."),
- name.c_str ());
- }
- }
+ name.c_str ());
+ }
+ }
- if (stop_stack_dummy == STOP_STD_TERMINATE)
- {
- /* We must get back to the frame we were before the dummy
+ if (stop_stack_dummy == STOP_STD_TERMINATE)
+ {
+ /* We must get back to the frame we were before the dummy
call. */
- dummy_frame_pop (dummy_id, call_thread.get ());
+ dummy_frame_pop (dummy_id, call_thread.get ());
- /* We also need to restore inferior status to that before
+ /* We also need to restore inferior status to that before
the dummy call. */
- restore_infcall_control_state (inf_status.release ());
+ restore_infcall_control_state (inf_status.release ());
- error (_("\
+ error (_ ("\
The program being debugged entered a std::terminate call, most likely\n\
caused by an unhandled C++ exception. GDB blocked this call in order\n\
to prevent the program from being terminated, and has restored the\n\
@@ -1538,58 +1533,60 @@ context to its original state before the call.\n\
To change this behaviour use \"set unwind-on-terminating-exception off\".\n\
Evaluation of the expression containing the function (%s)\n\
will be abandoned."),
- name.c_str ());
- }
- else if (stop_stack_dummy == STOP_NONE)
- {
-
- /* We hit a breakpoint inside the FUNCTION.
+ name.c_str ());
+ }
+ else if (stop_stack_dummy == STOP_NONE)
+ {
+ /* We hit a breakpoint inside the FUNCTION.
Keep the dummy frame, the user may want to examine its state.
Discard inferior status, we're not at the same point
we started at. */
- discard_infcall_control_state (inf_status.release ());
+ discard_infcall_control_state (inf_status.release ());
- /* The following error message used to say "The expression
+ /* The following error message used to say "The expression
which contained the function call has been discarded."
It is a hard concept to explain in a few words. Ideally,
GDB would be able to resume evaluation of the expression
when the function finally is done executing. Perhaps
someday this will be implemented (it would not be easy). */
- /* FIXME: Insert a bunch of wrap_here; name can be very long if it's
+ /* FIXME: Insert a bunch of wrap_here; name can be very long if it's
a C++ name with arguments and stuff. */
- error (_("\
+ error (_ ("\
The program being debugged stopped while in a function called from GDB.\n\
Evaluation of the expression containing the function\n\
(%s) will be abandoned.\n\
When the function is done executing, GDB will silently stop."),
- name.c_str ());
- }
-
- }
+ name.c_str ());
+ }
+ }
/* The above code errors out, so ... */
gdb_assert_not_reached ("... should not be here");
}
void _initialize_infcall ();
+
void
_initialize_infcall ()
{
add_setshow_boolean_cmd ("may-call-functions", no_class,
- &may_call_functions_p, _("\
-Set permission to call functions in the program."), _("\
-Show permission to call functions in the program."), _("\
+ &may_call_functions_p, _ ("\
+Set permission to call functions in the program."),
+ _ ("\
+Show permission to call functions in the program."),
+ _ ("\
When this permission is on, GDB may call functions in the program.\n\
Otherwise, any sort of attempt to call a function in the program\n\
will result in an error."),
- NULL,
- show_may_call_functions_p,
- &setlist, &showlist);
+ NULL, show_may_call_functions_p, &setlist,
+ &showlist);
add_setshow_boolean_cmd ("coerce-float-to-double", class_obscure,
- &coerce_float_to_double_p, _("\
-Set coercion of floats to doubles when calling functions."), _("\
-Show coercion of floats to doubles when calling functions."), _("\
+ &coerce_float_to_double_p, _ ("\
+Set coercion of floats to doubles when calling functions."),
+ _ ("\
+Show coercion of floats to doubles when calling functions."),
+ _ ("\
Variables of type float should generally be converted to doubles before\n\
calling an unprototyped function, and left alone when calling a prototyped\n\
function. However, some older debug info formats do not provide enough\n\
@@ -1597,41 +1594,39 @@ information to determine that a function is prototyped. If this flag is\n\
set, GDB will perform the conversion for a function it considers\n\
unprototyped.\n\
The default is to perform the conversion."),
- NULL,
- show_coerce_float_to_double_p,
- &setlist, &showlist);
-
- add_setshow_boolean_cmd ("unwindonsignal", no_class,
- &unwind_on_signal_p, _("\
-Set unwinding of stack if a signal is received while in a call dummy."), _("\
-Show unwinding of stack if a signal is received while in a call dummy."), _("\
+ NULL, show_coerce_float_to_double_p, &setlist,
+ &showlist);
+
+ add_setshow_boolean_cmd ("unwindonsignal", no_class, &unwind_on_signal_p,
+ _ ("\
+Set unwinding of stack if a signal is received while in a call dummy."),
+ _ ("\
+Show unwinding of stack if a signal is received while in a call dummy."),
+ _ ("\
The unwindonsignal lets the user determine what gdb should do if a signal\n\
is received while in a function called from gdb (call dummy). If set, gdb\n\
unwinds the stack and restore the context to what as it was before the call.\n\
The default is to stop in the frame where the signal was received."),
- NULL,
- show_unwind_on_signal_p,
- &setlist, &showlist);
+ NULL, show_unwind_on_signal_p, &setlist, &showlist);
add_setshow_boolean_cmd ("unwind-on-terminating-exception", no_class,
- &unwind_on_terminating_exception_p, _("\
-Set unwinding of stack if std::terminate is called while in call dummy."), _("\
+ &unwind_on_terminating_exception_p, _ ("\
+Set unwinding of stack if std::terminate is called while in call dummy."),
+ _ ("\
Show unwinding of stack if std::terminate() is called while in a call dummy."),
- _("\
+ _ ("\
The unwind on terminating exception flag lets the user determine\n\
what gdb should do if a std::terminate() call is made from the\n\
default exception handler. If set, gdb unwinds the stack and restores\n\
the context to what it was before the call. If unset, gdb allows the\n\
std::terminate call to proceed.\n\
The default is to unwind the frame."),
- NULL,
- show_unwind_on_terminating_exception_p,
+ NULL, show_unwind_on_terminating_exception_p,
&setlist, &showlist);
- add_setshow_boolean_cmd
- ("infcall", class_maintenance, &debug_infcall,
- _("Set inferior call debugging."),
- _("Show inferior call debugging."),
- _("When on, inferior function call specific debugging is enabled."),
- NULL, show_debug_infcall, &setdebuglist, &showdebuglist);
+ add_setshow_boolean_cmd (
+ "infcall", class_maintenance, &debug_infcall,
+ _ ("Set inferior call debugging."), _ ("Show inferior call debugging."),
+ _ ("When on, inferior function call specific debugging is enabled."), NULL,
+ show_debug_infcall, &setdebuglist, &showdebuglist);
}
diff --git a/gdb/infcall.h b/gdb/infcall.h
index 81b0c8d3433..83c766af989 100644
--- a/gdb/infcall.h
+++ b/gdb/infcall.h
@@ -32,7 +32,7 @@ struct type;
type, and *RETVAL_TYPE to the target function's return type.
Calls error() if the function is not valid for calling. */
-extern CORE_ADDR find_function_addr (struct value *function,
+extern CORE_ADDR find_function_addr (struct value *function,
struct type **retval_type,
struct type **function_type = NULL);
@@ -58,11 +58,10 @@ extern struct value *call_function_by_hand (struct value *function,
created inferior call dummy frame. */
extern struct value *
- call_function_by_hand_dummy (struct value *function,
- type *default_return_type,
- gdb::array_view<value *> args,
- dummy_frame_dtor_ftype *dummy_dtor,
- void *dummy_dtor_data);
+call_function_by_hand_dummy (struct value *function, type *default_return_type,
+ gdb::array_view<value *> args,
+ dummy_frame_dtor_ftype *dummy_dtor,
+ void *dummy_dtor_data);
/* Throw an error indicating that the user tried to call a function
that has unknown return type. FUNC_NAME is the name of the
diff --git a/gdb/infcmd.c b/gdb/infcmd.c
index 77206fcbfe8..2849d08b6ad 100644
--- a/gdb/infcmd.c
+++ b/gdb/infcmd.c
@@ -63,8 +63,9 @@ static void until_next_command (int);
static void step_1 (int, int, const char *);
-#define ERROR_NO_INFERIOR \
- if (!target_has_execution ()) error (_("The program is not being run."));
+#define ERROR_NO_INFERIOR \
+ if (!target_has_execution ()) \
+ error (_ ("The program is not being run."));
/* Scratch area where string containing arguments to give to the
program will be stored by 'set args'. As soon as anything is
@@ -99,13 +100,10 @@ enum stop_stack_kind stop_stack_dummy;
int stopped_by_random_signal;
-
/* Whether "finish" should print the value. */
static bool finish_print = true;
-
-
static void
set_inferior_tty_command (const char *args, int from_tty,
struct cmd_list_element *c)
@@ -124,14 +122,15 @@ show_inferior_tty_command (struct ui_file *file, int from_tty,
const std::string &inferior_tty = current_inferior ()->tty ();
gdb_printf (file,
- _("Terminal for future runs of program being debugged "
- "is \"%s\".\n"), inferior_tty.c_str ());
+ _ ("Terminal for future runs of program being debugged "
+ "is \"%s\".\n"),
+ inferior_tty.c_str ());
}
void
set_inferior_args_vector (int argc, char **argv)
{
- gdb::array_view<char * const> args (argv, argc);
+ gdb::array_view<char *const> args (argv, argc);
std::string n = construct_inferior_arguments (args);
current_inferior ()->set_args (std::move (n));
}
@@ -183,19 +182,17 @@ show_cwd_command (struct ui_file *file, int from_tty,
const std::string &cwd = current_inferior ()->cwd ();
if (cwd.empty ())
- gdb_printf (file,
- _("\
+ gdb_printf (file, _ ("\
You have not set the inferior's current working directory.\n\
The inferior will inherit GDB's cwd if native debugging, or the remote\n\
server's cwd if remote debugging.\n"));
else
gdb_printf (file,
- _("Current working directory that will be used "
- "when starting the inferior is \"%s\".\n"),
+ _ ("Current working directory that will be used "
+ "when starting the inferior is \"%s\".\n"),
cwd.c_str ());
}
-
/* This function strips the '&' character (indicating background
execution) that is added as *the last* of the arguments ARGS of a
command. A copy of the incoming ARGS without the '&' is returned,
@@ -223,8 +220,7 @@ strip_bg_char (const char *args, int *bg_char_p)
*bg_char_p = 1;
if (p != args)
- return gdb::unique_xmalloc_ptr<char>
- (savestring (args, p - args));
+ return gdb::unique_xmalloc_ptr<char> (savestring (args, p - args));
else
return gdb::unique_xmalloc_ptr<char> (nullptr);
}
@@ -240,8 +236,7 @@ strip_bg_char (const char *args, int *bg_char_p)
void
post_create_inferior (int from_tty)
{
-
- /* Be sure we own the terminal in case write operations are performed. */
+ /* Be sure we own the terminal in case write operations are performed. */
target_terminal::ours_for_output ();
infrun_debug_show_threads ("threads in the newly created inferior",
@@ -291,8 +286,8 @@ post_create_inferior (int from_tty)
target has been initialized by solib_create_inferior_hook. */
if (info_verbose)
- warning (_("platform-specific solib_create_inferior_hook did "
- "not load initial shared libraries."));
+ warning (_ ("platform-specific solib_create_inferior_hook did "
+ "not load initial shared libraries."));
/* If the solist is global across processes, there's no need to
refetch it here. */
@@ -330,10 +325,11 @@ kill_if_already_running (int from_tty)
restart it. */
target_require_runnable ();
- if (from_tty
- && !query (_("The program being debugged has been started already.\n\
+ if (
+ from_tty
+ && !query (_ ("The program being debugged has been started already.\n\
Start it from the beginning? ")))
- error (_("Program not restarted."));
+ error (_ ("Program not restarted."));
target_kill ();
}
}
@@ -346,7 +342,7 @@ prepare_execution_command (struct target_ops *target, int background)
/* If we get a request for running in the bg but the target
doesn't support it, error out. */
if (background && !target_can_async_p (target))
- error (_("Asynchronous execution not supported on this target."));
+ error (_ ("Asynchronous execution not supported on this target."));
if (!background)
{
@@ -361,16 +357,16 @@ prepare_execution_command (struct target_ops *target, int background)
/* Determine how the new inferior will behave. */
enum run_how
- {
- /* Run program without any explicit stop during startup. */
- RUN_NORMAL,
+{
+ /* Run program without any explicit stop during startup. */
+ RUN_NORMAL,
- /* Stop at the beginning of the program's main function. */
- RUN_STOP_AT_MAIN,
+ /* Stop at the beginning of the program's main function. */
+ RUN_STOP_AT_MAIN,
- /* Stop at the first instruction of the program. */
- RUN_STOP_AT_FIRST_INSN
- };
+ /* Stop at the first instruction of the program. */
+ RUN_STOP_AT_FIRST_INSN
+};
/* Implement the "run" command. Force a stop during program start if
requested by RUN_HOW. */
@@ -417,7 +413,7 @@ run_command_1 (const char *args, int from_tty, enum run_how run_how)
prepare_execution_command (run_target, async_exec);
if (non_stop && !run_target->supports_non_stop ())
- error (_("The target does not support running in non-stop mode."));
+ error (_ ("The target does not support running in non-stop mode."));
/* Done. Can now set breakpoints, change inferior args, etc. */
@@ -429,13 +425,14 @@ run_command_1 (const char *args, int from_tty, enum run_how run_how)
have proper inferior-specific breakpoint support, in the breakpoint
machinery. We could then avoid inserting a breakpoint in the program
spaces unrelated to this inferior. */
- const char *op
- = ((current_language->la_language == language_ada
- || current_language->la_language == language_pascal
- || current_language->la_language == language_m2) ? "=" : "==");
- std::string arg = string_printf
- ("-qualified %s if $_inferior %s %d", main_name (), op,
- current_inferior ()->num);
+ const char *op = ((current_language->la_language == language_ada
+ || current_language->la_language == language_pascal
+ || current_language->la_language == language_m2)
+ ? "="
+ : "==");
+ std::string arg
+ = string_printf ("-qualified %s if $_inferior %s %d", main_name (), op,
+ current_inferior ()->num);
tbreak_command (arg.c_str (), 0);
}
@@ -458,16 +455,14 @@ run_command_1 (const char *args, int from_tty, enum run_how run_how)
uiout->field_string (nullptr, "Starting program");
uiout->text (": ");
if (exec_file)
- uiout->field_string ("execfile", exec_file,
- file_name_style.style ());
+ uiout->field_string ("execfile", exec_file, file_name_style.style ());
uiout->spaces (1);
uiout->field_string ("infargs", current_inferior ()->args ());
uiout->text ("\n");
uiout->flush ();
}
- run_target->create_inferior (exec_file,
- current_inferior ()->args (),
+ run_target->create_inferior (exec_file, current_inferior ()->args (),
current_inferior ()->environment.envp (),
from_tty);
/* to_create_inferior should push the target, so after this point we
@@ -537,7 +532,7 @@ start_command (const char *args, int from_tty)
minimal symbols for the location where to put the temporary
breakpoint before starting. */
if (!have_minimal_symbols ())
- error (_("No symbol table loaded. Use the \"file\" command."));
+ error (_ ("No symbol table loaded. Use the \"file\" command."));
/* Run the program until reaching the main procedure... */
run_command_1 (args, from_tty, RUN_STOP_AT_MAIN);
@@ -550,7 +545,7 @@ static void
starti_command (const char *args, int from_tty)
{
run_command_1 (args, from_tty, RUN_STOP_AT_FIRST_INSN);
-}
+}
static int
proceed_thread_callback (struct thread_info *thread, void *arg)
@@ -579,9 +574,8 @@ proceed_thread_callback (struct thread_info *thread, void *arg)
static void
ensure_valid_thread (void)
{
- if (inferior_ptid == null_ptid
- || inferior_thread ()->state == THREAD_EXITED)
- error (_("Cannot execute this command without a live selected thread."));
+ if (inferior_ptid == null_ptid || inferior_thread ()->state == THREAD_EXITED)
+ error (_ ("Cannot execute this command without a live selected thread."));
}
/* If the user is looking at trace frames, any resumption of execution
@@ -592,7 +586,7 @@ static void
ensure_not_tfind_mode (void)
{
if (get_traceframe_number () >= 0)
- error (_("Cannot execute this command while looking at trace frames."));
+ error (_ ("Cannot execute this command while looking at trace frames."));
}
/* Throw an error indicating the current thread is running. */
@@ -600,8 +594,8 @@ ensure_not_tfind_mode (void)
static void
error_is_running (void)
{
- error (_("Cannot execute this command while "
- "the selected thread is running."));
+ error (_ ("Cannot execute this command while "
+ "the selected thread is running."));
}
/* Calls error_is_running if the current thread is running. */
@@ -627,8 +621,8 @@ continue_1 (int all_threads)
/* Backup current thread and selected frame and restore on scope
exit. */
scoped_restore_current_thread restore_thread;
- scoped_disable_commit_resumed disable_commit_resumed
- ("continue all threads in non-stop");
+ scoped_disable_commit_resumed disable_commit_resumed (
+ "continue all threads in non-stop");
iterate_over_threads (proceed_thread_callback, nullptr);
@@ -687,11 +681,11 @@ continue_command (const char *args, int from_tty)
}
if (!non_stop && all_threads_p)
- error (_("`-a' is meaningless in all-stop mode."));
+ error (_ ("`-a' is meaningless in all-stop mode."));
if (args != nullptr && all_threads_p)
- error (_("Can't resume all threads and specify "
- "proceed count simultaneously."));
+ error (_ ("Can't resume all threads and specify "
+ "proceed count simultaneously."));
/* If we have an argument left, set proceed count of breakpoint we
stopped at. */
@@ -718,9 +712,7 @@ continue_command (const char *args, int from_tty)
while ((stat = bpstat_num (&bs, &num)) != 0)
if (stat > 0)
{
- set_ignore_count (num,
- parse_and_eval_long (args) - 1,
- from_tty);
+ set_ignore_count (num, parse_and_eval_long (args) - 1, from_tty);
/* set_ignore_count prints a message ending with a period.
So print two spaces before "Continuing.". */
if (from_tty)
@@ -730,8 +722,7 @@ continue_command (const char *args, int from_tty)
if (!stopped && from_tty)
{
- gdb_printf
- ("Not stopped at any breakpoint; argument ignored.\n");
+ gdb_printf ("Not stopped at any breakpoint; argument ignored.\n");
}
}
@@ -747,11 +738,11 @@ continue_command (const char *args, int from_tty)
prepare_execution_command (current_inferior ()->top_target (), async_exec);
if (from_tty)
- gdb_printf (_("Continuing.\n"));
+ gdb_printf (_ ("Continuing.\n"));
continue_1 (all_threads_p);
}
-
+
/* Record in TP the starting point of a "step" or "next" command. */
static void
@@ -828,9 +819,9 @@ struct step_command_fsm : public thread_fsm
allocated here is undone in the FSM's clean_up method. */
static void
-step_command_fsm_prepare (struct step_command_fsm *sm,
- int skip_subroutines, int single_inst,
- int count, struct thread_info *thread)
+step_command_fsm_prepare (struct step_command_fsm *sm, int skip_subroutines,
+ int single_inst, int count,
+ struct thread_info *thread)
{
sm->skip_subroutines = skip_subroutines;
sm->single_inst = single_inst;
@@ -874,8 +865,8 @@ step_1 (int skip_subroutines, int single_inst, const char *count_string)
step_sm = new step_command_fsm (command_interp ());
thr->set_thread_fsm (std::unique_ptr<thread_fsm> (step_sm));
- step_command_fsm_prepare (step_sm, skip_subroutines,
- single_inst, count, thr);
+ step_command_fsm_prepare (step_sm, skip_subroutines, single_inst, count,
+ thr);
/* Do only one step for now, before returning control to the event
loop. Let the continuation figure out how many other steps we
@@ -958,8 +949,7 @@ prepare_one_step (thread_info *tp, struct step_command_fsm *sm)
CORE_ADDR pc;
/* Step at an inlined function behaves like "down". */
- if (!sm->skip_subroutines
- && inline_skipped_frames (tp))
+ if (!sm->skip_subroutines && inline_skipped_frames (tp))
{
ptid_t resume_ptid;
const char *fn = nullptr;
@@ -979,8 +969,7 @@ prepare_one_step (thread_info *tp, struct step_command_fsm *sm)
if (sym != nullptr)
fn = sym->print_name ();
- if (sal.line == 0
- || !function_name_is_marked_for_skip (fn, sal))
+ if (sal.line == 0 || !function_name_is_marked_for_skip (fn, sal))
{
sm->count--;
return prepare_one_step (tp, sm);
@@ -988,8 +977,7 @@ prepare_one_step (thread_info *tp, struct step_command_fsm *sm)
}
pc = get_frame_pc (frame);
- find_pc_line_pc_range (pc,
- &tp->control.step_range_start,
+ find_pc_line_pc_range (pc, &tp->control.step_range_start,
&tp->control.step_range_end);
/* There's a problem in gcc (PR gcc/98780) that causes missing line
@@ -1020,12 +1008,13 @@ prepare_one_step (thread_info *tp, struct step_command_fsm *sm)
if (find_pc_partial_function (pc, &name,
&tp->control.step_range_start,
- &tp->control.step_range_end) == 0)
- error (_("Cannot find bounds of current function"));
+ &tp->control.step_range_end)
+ == 0)
+ error (_ ("Cannot find bounds of current function"));
target_terminal::ours_for_output ();
- gdb_printf (_("Single stepping until exit from function %s,"
- "\nwhich has no line number information.\n"),
+ gdb_printf (_ ("Single stepping until exit from function %s,"
+ "\nwhich has no line number information.\n"),
name);
}
}
@@ -1051,7 +1040,6 @@ prepare_one_step (thread_info *tp, struct step_command_fsm *sm)
return 1;
}
-
/* Continue program at specified address. */
static void
@@ -1075,29 +1063,29 @@ jump_command (const char *arg, int from_tty)
prepare_execution_command (current_inferior ()->top_target (), async_exec);
if (!arg)
- error_no_arg (_("starting address"));
+ error_no_arg (_ ("starting address"));
std::vector<symtab_and_line> sals
= decode_line_with_last_displayed (arg, DECODE_LINE_FUNFIRSTLINE);
if (sals.size () != 1)
- error (_("Unreasonable jump request"));
+ error (_ ("Unreasonable jump request"));
symtab_and_line &sal = sals[0];
if (sal.symtab == 0 && sal.pc == 0)
- error (_("No source file has been specified."));
+ error (_ ("No source file has been specified."));
- resolve_sal_pc (&sal); /* May error out. */
+ resolve_sal_pc (&sal); /* May error out. */
/* See if we are trying to jump to another function. */
fn = get_frame_function (get_current_frame ());
sfn = find_pc_function (sal.pc);
if (fn != nullptr && sfn != fn)
{
- if (!query (_("Line %d is not in `%s'. Jump anyway? "), sal.line,
+ if (!query (_ ("Line %d is not in `%s'. Jump anyway? "), sal.line,
fn->print_name ()))
{
- error (_("Not confirmed."));
+ error (_ ("Not confirmed."));
/* NOTREACHED */
}
}
@@ -1107,13 +1095,12 @@ jump_command (const char *arg, int from_tty)
struct obj_section *section;
section = sfn->obj_section (sfn->objfile ());
- if (section_is_overlay (section)
- && !section_is_mapped (section))
+ if (section_is_overlay (section) && !section_is_mapped (section))
{
- if (!query (_("WARNING!!! Destination is in "
- "unmapped overlay! Jump anyway? ")))
+ if (!query (_ ("WARNING!!! Destination is in "
+ "unmapped overlay! Jump anyway? ")))
{
- error (_("Not confirmed."));
+ error (_ ("Not confirmed."));
/* NOTREACHED */
}
}
@@ -1123,7 +1110,7 @@ jump_command (const char *arg, int from_tty)
if (from_tty)
{
- gdb_printf (_("Continuing at "));
+ gdb_printf (_ ("Continuing at "));
gdb_puts (paddress (gdbarch, addr));
gdb_printf (".\n");
}
@@ -1131,7 +1118,7 @@ jump_command (const char *arg, int from_tty)
clear_proceed_status (0);
proceed (addr, GDB_SIGNAL_0);
}
-
+
/* Continue program giving it specified signal. */
static void
@@ -1140,7 +1127,7 @@ signal_command (const char *signum_exp, int from_tty)
enum gdb_signal oursig;
int async_exec;
- dont_repeat (); /* Too dangerous. */
+ dont_repeat (); /* Too dangerous. */
ERROR_NO_INFERIOR;
ensure_not_tfind_mode ();
ensure_valid_thread ();
@@ -1154,7 +1141,7 @@ signal_command (const char *signum_exp, int from_tty)
prepare_execution_command (current_inferior ()->top_target (), async_exec);
if (!signum_exp)
- error_no_arg (_("signal number"));
+ error_no_arg (_ ("signal number"));
/* It would be even slicker to make signal names be valid expressions,
(the type could be "enum $signal" or some such), then the user could
@@ -1190,7 +1177,8 @@ signal_command (const char *signum_exp, int from_tty)
thread_info *current = inferior_thread ();
- for (thread_info *tp : all_non_exited_threads (resume_target, resume_ptid))
+ for (thread_info *tp :
+ all_non_exited_threads (resume_target, resume_ptid))
{
if (tp == current)
continue;
@@ -1199,29 +1187,31 @@ signal_command (const char *signum_exp, int from_tty)
&& signal_pass_state (tp->stop_signal ()))
{
if (!must_confirm)
- gdb_printf (_("Note:\n"));
- gdb_printf (_(" Thread %s previously stopped with signal %s, %s.\n"),
- print_thread_id (tp),
- gdb_signal_to_name (tp->stop_signal ()),
- gdb_signal_to_string (tp->stop_signal ()));
+ gdb_printf (_ ("Note:\n"));
+ gdb_printf (
+ _ (" Thread %s previously stopped with signal %s, %s.\n"),
+ print_thread_id (tp), gdb_signal_to_name (tp->stop_signal ()),
+ gdb_signal_to_string (tp->stop_signal ()));
must_confirm = 1;
}
}
if (must_confirm
- && !query (_("Continuing thread %s (the current thread) with specified signal will\n"
- "still deliver the signals noted above to their respective threads.\n"
- "Continue anyway? "),
+ && !query (_ ("Continuing thread %s (the current thread) with "
+ "specified signal will\n"
+ "still deliver the signals noted above to their "
+ "respective threads.\n"
+ "Continue anyway? "),
print_thread_id (inferior_thread ())))
- error (_("Not confirmed."));
+ error (_ ("Not confirmed."));
}
if (from_tty)
{
if (oursig == GDB_SIGNAL_0)
- gdb_printf (_("Continuing with no signal.\n"));
+ gdb_printf (_ ("Continuing with no signal.\n"));
else
- gdb_printf (_("Continuing with signal %s.\n"),
+ gdb_printf (_ ("Continuing with signal %s.\n"),
gdb_signal_to_name (oursig));
}
@@ -1243,7 +1233,7 @@ queue_signal_command (const char *signum_exp, int from_tty)
ensure_not_running ();
if (signum_exp == nullptr)
- error_no_arg (_("signal number"));
+ error_no_arg (_ ("signal number"));
/* It would be even slicker to make signal names be valid expressions,
(the type could be "enum $signal" or some such), then the user could
@@ -1261,9 +1251,8 @@ queue_signal_command (const char *signum_exp, int from_tty)
oursig = gdb_signal_from_command (num);
}
- if (oursig != GDB_SIGNAL_0
- && !signal_pass_state (oursig))
- error (_("Signal handling set to not pass this signal to the program."));
+ if (oursig != GDB_SIGNAL_0 && !signal_pass_state (oursig))
+ error (_ ("Signal handling set to not pass this signal to the program."));
tp = inferior_thread ();
tp->set_stop_signal (oursig);
@@ -1354,7 +1343,7 @@ until_next_command (int from_tty)
struct bound_minimal_symbol msymbol = lookup_minimal_symbol_by_pc (pc);
if (msymbol.minsym == nullptr)
- error (_("Execution is not within a known function."));
+ error (_ ("Execution is not within a known function."));
tp->control.step_range_start = msymbol.value_address ();
/* The upper-bound of step_range is exclusive. In order to make PC
@@ -1454,7 +1443,7 @@ advance_command (const char *arg, int from_tty)
ensure_not_running ();
if (arg == nullptr)
- error_no_arg (_("a location"));
+ error_no_arg (_ ("a location"));
/* Find out whether we must run in the background. */
gdb::unique_xmalloc_ptr<char> stripped = strip_bg_char (arg, &async_exec);
@@ -1464,7 +1453,7 @@ advance_command (const char *arg, int from_tty)
until_break_command (arg, from_tty, 1);
}
-
+
/* See inferior.h. */
struct value *
@@ -1480,8 +1469,8 @@ get_return_value (struct symbol *func_symbol, struct value *function)
if (is_nocall_function (check_typedef (::value_type (function))))
{
- warning (_("Function '%s' does not follow the target calling "
- "convention, cannot determine its returned value."),
+ warning (_ ("Function '%s' does not follow the target calling "
+ "convention, cannot determine its returned value."),
func_symbol->print_name ());
return nullptr;
@@ -1507,7 +1496,7 @@ get_return_value (struct symbol *func_symbol, struct value *function)
value = nullptr;
break;
default:
- internal_error (_("bad switch"));
+ internal_error (_ ("bad switch"));
}
return value;
@@ -1539,8 +1528,7 @@ print_return_value_1 (struct ui_out *uiout, struct return_value_info *rv)
{
/* Print it. */
uiout->text ("Value returned is ");
- uiout->field_fmt ("gdb-result-var", "$%d",
- rv->value_history_index);
+ uiout->field_fmt ("gdb-result-var", "$%d", rv->value_history_index);
uiout->text (" = ");
if (finish_print)
@@ -1553,7 +1541,7 @@ print_return_value_1 (struct ui_out *uiout, struct return_value_info *rv)
uiout->field_stream ("return-value", stb);
}
else
- uiout->field_string ("return-value", _("<not displayed>"),
+ uiout->field_string ("return-value", _ ("<not displayed>"),
metadata_style.style ());
uiout->text ("\n");
}
@@ -1604,7 +1592,9 @@ struct finish_command_fsm : public thread_fsm
/* If the FSM finishes successfully, this stores the function's
return value. */
- struct return_value_info return_value_info {};
+ struct return_value_info return_value_info
+ {
+ };
/* If the current function uses the "struct return convention",
this holds the address at which the value being returned will
@@ -1634,15 +1624,15 @@ finish_command_fsm::should_stop (struct thread_info *tp)
struct return_value_info *rv = &return_value_info;
if (function != nullptr
- && bpstat_find_breakpoint (tp->control.stop_bpstat,
- breakpoint.get ()) != nullptr)
+ && bpstat_find_breakpoint (tp->control.stop_bpstat, breakpoint.get ())
+ != nullptr)
{
/* We're done. */
set_finished ();
rv->type = function->type ()->target_type ();
if (rv->type == nullptr)
- internal_error (_("finish_command: function has no target type"));
+ internal_error (_ ("finish_command: function has no target type"));
if (check_typedef (rv->type)->code () != TYPE_CODE_VOID)
{
@@ -1652,9 +1642,9 @@ finish_command_fsm::should_stop (struct thread_info *tp)
if (return_buf != 0)
/* Retrieve return value from the buffer where it was saved. */
- rv->value = value_at (rv->type, return_buf);
+ rv->value = value_at (rv->type, return_buf);
else
- rv->value = get_return_value (function, func);
+ rv->value = get_return_value (function, func);
if (rv->value != nullptr)
rv->value_history_index = record_latest_value (rv->value);
@@ -1714,7 +1704,7 @@ finish_backward (struct finish_command_fsm *sm)
pc = get_frame_pc (get_current_frame ());
if (find_pc_partial_function (pc, nullptr, &func_addr, nullptr) == 0)
- error (_("Cannot find bounds of current function"));
+ error (_ ("Cannot find bounds of current function"));
sal = find_pc_line (func_addr, 0);
@@ -1738,8 +1728,7 @@ finish_backward (struct finish_command_fsm *sm)
symtab_and_line sr_sal;
sr_sal.pc = sal.pc;
sr_sal.pspace = get_frame_program_space (frame);
- insert_step_resume_breakpoint_at_sal (gdbarch,
- sr_sal, null_frame_id);
+ insert_step_resume_breakpoint_at_sal (gdbarch, sr_sal, null_frame_id);
proceed ((CORE_ADDR) -1, GDB_SIGNAL_DEFAULT);
}
@@ -1766,9 +1755,9 @@ finish_forward (struct finish_command_fsm *sm, frame_info_ptr frame)
sal = find_pc_line (get_frame_pc (frame), 0);
sal.pc = get_frame_pc (frame);
- sm->breakpoint = set_momentary_breakpoint (gdbarch, sal,
- get_stack_frame_id (frame),
- bp_finish);
+ sm->breakpoint
+ = set_momentary_breakpoint (gdbarch, sal, get_stack_frame_id (frame),
+ bp_finish);
/* set_momentary_breakpoint invalidates FRAME. */
frame = nullptr;
@@ -1828,11 +1817,11 @@ finish_command (const char *arg, int from_tty)
prepare_execution_command (current_inferior ()->top_target (), async_exec);
if (arg)
- error (_("The \"finish\" command does not take any arguments."));
+ error (_ ("The \"finish\" command does not take any arguments."));
- frame = get_prev_frame (get_selected_frame (_("No selected frame.")));
+ frame = get_prev_frame (get_selected_frame (_ ("No selected frame.")));
if (frame == 0)
- error (_("\"finish\" not meaningful in the outermost frame."));
+ error (_ ("\"finish\" not meaningful in the outermost frame."));
clear_proceed_status (0);
@@ -1844,7 +1833,7 @@ finish_command (const char *arg, int from_tty)
/* Finishing from an inline frame is completely different. We don't
try to show the "return value" - no way to locate it. */
- if (get_frame_type (get_selected_frame (_("No selected frame.")))
+ if (get_frame_type (get_selected_frame (_ ("No selected frame.")))
== INLINE_FRAME)
{
/* Claim we are stepping in the calling frame. An empty step
@@ -1861,7 +1850,7 @@ finish_command (const char *arg, int from_tty)
source. */
if (from_tty)
{
- gdb_printf (_("Run till exit from "));
+ gdb_printf (_ ("Run till exit from "));
print_stack_frame (get_selected_frame (nullptr), 1, LOCATION, 0);
}
@@ -1872,7 +1861,7 @@ finish_command (const char *arg, int from_tty)
/* Find the function we will return from. */
frame_info_ptr callee_frame = get_selected_frame (nullptr);
sm->function = find_pc_function (get_frame_pc (callee_frame));
- sm->return_buf = 0; /* Initialize buffer address is not available. */
+ sm->return_buf = 0; /* Initialize buffer address is not available. */
/* Determine the return convention. If it is RETURN_VALUE_STRUCT_CONVENTION,
attempt to determine the address of the return buffer. */
@@ -1881,7 +1870,7 @@ finish_command (const char *arg, int from_tty)
enum return_value_convention return_value;
struct gdbarch *gdbarch = get_frame_arch (callee_frame);
- struct type * val_type
+ struct type *val_type
= check_typedef (sm->function->type ()->target_type ());
return_value
@@ -1892,8 +1881,8 @@ finish_command (const char *arg, int from_tty)
if (return_value == RETURN_VALUE_STRUCT_CONVENTION
&& val_type->code () != TYPE_CODE_VOID)
- sm->return_buf = gdbarch_get_return_buf_addr (gdbarch, val_type,
- callee_frame);
+ sm->return_buf
+ = gdbarch_get_return_buf_addr (gdbarch, val_type, callee_frame);
}
/* Print info on the selected frame, including level number but not
@@ -1901,15 +1890,15 @@ finish_command (const char *arg, int from_tty)
if (from_tty)
{
if (execution_direction == EXEC_REVERSE)
- gdb_printf (_("Run back to call of "));
+ gdb_printf (_ ("Run back to call of "));
else
{
if (sm->function != nullptr && TYPE_NO_RETURN (sm->function->type ())
- && !query (_("warning: Function %s does not return normally.\n"
- "Try to finish anyway? "),
+ && !query (_ ("warning: Function %s does not return normally.\n"
+ "Try to finish anyway? "),
sm->function->print_name ()))
- error (_("Not confirmed."));
- gdb_printf (_("Run till exit from "));
+ error (_ ("Not confirmed."));
+ gdb_printf (_ ("Run till exit from "));
}
print_stack_frame (callee_frame, 1, LOCATION, 0);
@@ -1922,12 +1911,11 @@ finish_command (const char *arg, int from_tty)
frame = skip_finish_frames (frame);
if (frame == nullptr)
- error (_("Cannot find the caller frame."));
+ error (_ ("Cannot find the caller frame."));
finish_forward (sm, frame);
}
}
-
static void
info_program_command (const char *args, int from_tty)
@@ -1939,7 +1927,7 @@ info_program_command (const char *args, int from_tty)
if (!target_has_execution ())
{
- gdb_printf (_("The program being debugged is not being run.\n"));
+ gdb_printf (_ ("The program being debugged is not being run.\n"));
return;
}
@@ -1952,23 +1940,23 @@ info_program_command (const char *args, int from_tty)
get_last_target_status (&proc_target, &ptid, nullptr);
if (ptid == null_ptid || ptid == minus_one_ptid)
- error (_("No selected thread."));
+ error (_ ("No selected thread."));
thread_info *tp = find_thread_ptid (proc_target, ptid);
if (tp->state == THREAD_EXITED)
- error (_("Invalid selected thread."));
+ error (_ ("Invalid selected thread."));
else if (tp->state == THREAD_RUNNING)
- error (_("Selected thread is running."));
+ error (_ ("Selected thread is running."));
bs = tp->control.stop_bpstat;
stat = bpstat_num (&bs, &num);
target_files_info ();
- gdb_printf (_("Program stopped at %s.\n"),
+ gdb_printf (_ ("Program stopped at %s.\n"),
paddress (target_gdbarch (), tp->stop_pc ()));
if (tp->control.stop_step)
- gdb_printf (_("It stopped after being stepped.\n"));
+ gdb_printf (_ ("It stopped after being stepped.\n"));
else if (stat != 0)
{
/* There may be several breakpoints in the same place, so this
@@ -1977,28 +1965,28 @@ info_program_command (const char *args, int from_tty)
{
if (stat < 0)
{
- gdb_printf (_("It stopped at a breakpoint "
- "that has since been deleted.\n"));
+ gdb_printf (_ ("It stopped at a breakpoint "
+ "that has since been deleted.\n"));
}
else
- gdb_printf (_("It stopped at breakpoint %d.\n"), num);
+ gdb_printf (_ ("It stopped at breakpoint %d.\n"), num);
stat = bpstat_num (&bs, &num);
}
}
else if (tp->stop_signal () != GDB_SIGNAL_0)
{
- gdb_printf (_("It stopped with signal %s, %s.\n"),
+ gdb_printf (_ ("It stopped with signal %s, %s.\n"),
gdb_signal_to_name (tp->stop_signal ()),
gdb_signal_to_string (tp->stop_signal ()));
}
if (from_tty)
{
- gdb_printf (_("Type \"info stack\" or \"info "
- "registers\" for more information.\n"));
+ gdb_printf (_ ("Type \"info stack\" or \"info "
+ "registers\" for more information.\n"));
}
}
-
+
static void
environment_info (const char *var, int from_tty)
{
@@ -2039,7 +2027,7 @@ set_environment_command (const char *arg, int from_tty)
int nullset = 0;
if (arg == 0)
- error_no_arg (_("environment variable and value"));
+ error_no_arg (_ ("environment variable and value"));
/* Find separation between variable name and value. */
p = (char *) strchr (arg, '=');
@@ -2063,13 +2051,13 @@ set_environment_command (const char *arg, int from_tty)
p = val;
if (p == arg)
- error_no_arg (_("environment variable to set"));
+ error_no_arg (_ ("environment variable to set"));
if (p == 0 || p[1] == 0)
{
nullset = 1;
if (p == 0)
- p = arg + strlen (arg); /* So that savestring below will work. */
+ p = arg + strlen (arg); /* So that savestring below will work. */
}
else
{
@@ -2085,8 +2073,8 @@ set_environment_command (const char *arg, int from_tty)
std::string var (arg, p - arg);
if (nullset)
{
- gdb_printf (_("Setting environment variable "
- "\"%s\" to null value.\n"),
+ gdb_printf (_ ("Setting environment variable "
+ "\"%s\" to null value.\n"),
var.c_str ());
current_inferior ()->environment.set (var.c_str (), "");
}
@@ -2101,7 +2089,7 @@ unset_environment_command (const char *var, int from_tty)
{
/* If there is no argument, delete all environment variables.
Ask for confirmation if reading from the terminal. */
- if (!from_tty || query (_("Delete all environment variables? ")))
+ if (!from_tty || query (_ ("Delete all environment variables? ")))
current_inferior ()->environment.clear ();
}
else
@@ -2138,7 +2126,6 @@ path_command (const char *dirname, int from_tty)
if (from_tty)
path_info (nullptr, from_tty);
}
-
static void
pad_to_column (string_file &stream, int col)
@@ -2154,26 +2141,26 @@ pad_to_column (string_file &stream, int col)
fashion. */
static void
-default_print_one_register_info (struct ui_file *file,
- const char *name,
+default_print_one_register_info (struct ui_file *file, const char *name,
struct value *val)
{
struct type *regtype = value_type (val);
int print_raw_format;
string_file format_stream;
+
enum tab_stops
- {
- value_column_1 = 15,
- /* Give enough room for "0x", 16 hex digits and two spaces in
+ {
+ value_column_1 = 15,
+ /* Give enough room for "0x", 16 hex digits and two spaces in
preceding column. */
- value_column_2 = value_column_1 + 2 + 16 + 2,
- };
+ value_column_2 = value_column_1 + 2 + 16 + 2,
+ };
format_stream.puts (name);
pad_to_column (format_stream, value_column_1);
- print_raw_format = (value_entirely_available (val)
- && !value_optimized_out (val));
+ print_raw_format
+ = (value_entirely_available (val) && !value_optimized_out (val));
/* If virtual format is floating, print it that way, and in raw
hex. */
@@ -2233,10 +2220,8 @@ default_print_one_register_info (struct ui_file *file,
provide that format. */
void
-default_print_registers_info (struct gdbarch *gdbarch,
- struct ui_file *file,
- frame_info_ptr frame,
- int regnum, int print_all)
+default_print_registers_info (struct gdbarch *gdbarch, struct ui_file *file,
+ frame_info_ptr frame, int regnum, int print_all)
{
int i;
const int numregs = gdbarch_num_cooked_regs (gdbarch);
@@ -2282,14 +2267,13 @@ registers_info (const char *addr_exp, int fpregs)
struct gdbarch *gdbarch;
if (!target_has_registers ())
- error (_("The program has no registers now."));
+ error (_ ("The program has no registers now."));
frame = get_selected_frame (nullptr);
gdbarch = get_frame_arch (frame);
if (!addr_exp)
{
- gdbarch_print_registers_info (gdbarch, gdb_stdout,
- frame, -1, fpregs);
+ gdbarch_print_registers_info (gdbarch, gdb_stdout, frame, -1, fpregs);
return;
}
@@ -2306,7 +2290,7 @@ registers_info (const char *addr_exp, int fpregs)
if (addr_exp[0] == '$')
addr_exp++;
if (isspace ((*addr_exp)) || (*addr_exp) == '\0')
- error (_("Missing register name"));
+ error (_ ("Missing register name"));
/* Find the start/end of this register name/num/group. */
start = addr_exp;
@@ -2328,19 +2312,17 @@ registers_info (const char *addr_exp, int fpregs)
if (regnum >= gdbarch_num_cooked_regs (gdbarch))
{
struct value *regval = value_of_user_reg (regnum, frame);
- const char *regname = user_reg_map_regnum_to_name (gdbarch,
- regnum);
+ const char *regname
+ = user_reg_map_regnum_to_name (gdbarch, regnum);
/* Print in the same fashion
gdbarch_print_registers_info's default
implementation prints. */
- default_print_one_register_info (gdb_stdout,
- regname,
- regval);
+ default_print_one_register_info (gdb_stdout, regname, regval);
}
else
- gdbarch_print_registers_info (gdbarch, gdb_stdout,
- frame, regnum, fpregs);
+ gdbarch_print_registers_info (gdbarch, gdb_stdout, frame, regnum,
+ fpregs);
continue;
}
}
@@ -2363,13 +2345,11 @@ registers_info (const char *addr_exp, int fpregs)
{
int regnum;
- for (regnum = 0;
- regnum < gdbarch_num_cooked_regs (gdbarch);
+ for (regnum = 0; regnum < gdbarch_num_cooked_regs (gdbarch);
regnum++)
{
if (gdbarch_register_reggroup_p (gdbarch, regnum, group))
- gdbarch_print_registers_info (gdbarch,
- gdb_stdout, frame,
+ gdbarch_print_registers_info (gdbarch, gdb_stdout, frame,
regnum, fpregs);
}
continue;
@@ -2377,7 +2357,7 @@ registers_info (const char *addr_exp, int fpregs)
}
/* Nothing matched. */
- error (_("Invalid register `%.*s'"), (int) (end - start), start);
+ error (_ ("Invalid register `%.*s'"), (int) (end - start), start);
}
}
@@ -2394,8 +2374,8 @@ info_registers_command (const char *addr_exp, int from_tty)
}
static void
-print_vector_info (struct ui_file *file,
- frame_info_ptr frame, const char *args)
+print_vector_info (struct ui_file *file, frame_info_ptr frame,
+ const char *args)
{
struct gdbarch *gdbarch = get_frame_arch (frame);
@@ -2423,11 +2403,11 @@ static void
info_vector_command (const char *args, int from_tty)
{
if (!target_has_registers ())
- error (_("The program has no registers now."));
+ error (_ ("The program has no registers now."));
print_vector_info (gdb_stdout, get_selected_frame (nullptr), args);
}
-
+
/* Kill the inferior process. Make us have no inferior. */
static void
@@ -2438,9 +2418,9 @@ kill_command (const char *arg, int from_tty)
some targets don't have processes! */
if (inferior_ptid == null_ptid)
- error (_("The program is not being run."));
- if (!query (_("Kill the program being debugged? ")))
- error (_("Not confirmed."));
+ error (_ ("The program is not being run."));
+ if (!query (_ ("Kill the program being debugged? ")))
+ error (_ ("Not confirmed."));
int pid = current_inferior ()->pid;
/* Save the pid as a string before killing the inferior, since that
@@ -2452,8 +2432,7 @@ kill_command (const char *arg, int from_tty)
bfd_cache_close_all ();
if (print_inferior_events)
- gdb_printf (_("[Inferior %d (%s) killed]\n"),
- infnum, pid_str.c_str ());
+ gdb_printf (_ ("[Inferior %d (%s) killed]\n"), infnum, pid_str.c_str ());
}
/* Used in `attach&' command. Proceed threads of inferior INF iff
@@ -2471,8 +2450,7 @@ proceed_after_attach (inferior *inf)
scoped_restore_current_thread restore_thread;
for (thread_info *thread : inf->non_exited_threads ())
- if (!thread->executing ()
- && !thread->stop_requested
+ if (!thread->executing () && !thread->stop_requested
&& thread->stop_signal () == GDB_SIGNAL_0)
{
switch_to_thread (thread);
@@ -2579,7 +2557,8 @@ attach_post_wait (int from_tty, enum attach_post_wait_mode mode)
stop. For consistency, always select the thread with
lowest GDB number, which should be the main thread, if it
still exists. */
- for (thread_info *thread : current_inferior ()->non_exited_threads ())
+ for (thread_info *thread :
+ current_inferior ()->non_exited_threads ())
if (thread->inf->num < lowest->inf->num
|| thread->per_inf_num < lowest->per_inf_num)
lowest = thread;
@@ -2606,7 +2585,7 @@ attach_command (const char *args, int from_tty)
struct inferior *inferior = current_inferior ();
enum attach_post_wait_mode mode;
- dont_repeat (); /* Not for the faint of heart */
+ dont_repeat (); /* Not for the faint of heart */
scoped_disable_commit_resumed disable_commit_resumed ("attaching");
@@ -2616,10 +2595,10 @@ attach_command (const char *args, int from_tty)
;
else if (target_has_execution ())
{
- if (query (_("A program is being debugged already. Kill it? ")))
+ if (query (_ ("A program is being debugged already. Kill it? ")))
target_kill ();
else
- error (_("Not killed."));
+ error (_ ("Not killed."));
}
/* Clean up any leftovers from other runs. Some other things from
@@ -2634,7 +2613,7 @@ attach_command (const char *args, int from_tty)
prepare_execution_command (attach_target, async_exec);
if (non_stop && !attach_target->supports_non_stop ())
- error (_("Cannot attach to this target in non-stop mode"));
+ error (_ ("Cannot attach to this target in non-stop mode"));
attach_target->attach (args, from_tty);
/* to_attach should push the target, so after this point we
@@ -2706,10 +2685,9 @@ attach_command (const char *args, int from_tty)
inferior->control.stop_soon = STOP_QUIETLY_NO_SIGSTOP;
/* Wait for stop. */
- inferior->add_continuation ([=] ()
- {
- attach_post_wait (from_tty, mode);
- });
+ inferior->add_continuation ([=] () {
+ attach_post_wait (from_tty, mode);
+ });
/* Let infrun consider waiting for events out of this
target. */
@@ -2763,10 +2741,9 @@ notice_new_inferior (thread_info *thr, bool leave_running, int from_tty)
inferior->control.stop_soon = STOP_QUIETLY_REMOTE;
/* Wait for stop before proceeding. */
- inferior->add_continuation ([=] ()
- {
- attach_post_wait (from_tty, mode);
- });
+ inferior->add_continuation ([=] () {
+ attach_post_wait (from_tty, mode);
+ });
return;
}
@@ -2788,10 +2765,10 @@ notice_new_inferior (thread_info *thr, bool leave_running, int from_tty)
void
detach_command (const char *args, int from_tty)
{
- dont_repeat (); /* Not for the faint of heart. */
+ dont_repeat (); /* Not for the faint of heart. */
if (inferior_ptid == null_ptid)
- error (_("The program is not being run."));
+ error (_ ("The program is not being run."));
scoped_disable_commit_resumed disable_commit_resumed ("detaching");
@@ -2827,7 +2804,8 @@ detach_command (const char *args, int from_tty)
deprecated_detach_hook ();
if (!was_non_stop_p)
- restart_after_all_stop_detach (as_process_stratum_target (target_ref.get ()));
+ restart_after_all_stop_detach (
+ as_process_stratum_target (target_ref.get ()));
disable_commit_resumed.reset_and_commit ();
}
@@ -2843,7 +2821,7 @@ detach_command (const char *args, int from_tty)
static void
disconnect_command (const char *args, int from_tty)
{
- dont_repeat (); /* Not for the faint of heart. */
+ dont_repeat (); /* Not for the faint of heart. */
query_if_trace_running (from_tty);
disconnect_tracing ();
target_disconnect (args, from_tty);
@@ -2869,8 +2847,7 @@ stop_current_target_threads_ns (ptid_t ptid)
non-stop mode, as when debugging a multi-threaded application in
all-stop mode, we will only get one stop event --- it's undefined
which thread will report the event. */
- set_stop_requested (current_inferior ()->process_target (),
- ptid, 1);
+ set_stop_requested (current_inferior ()->process_target (), ptid, 1);
}
/* See inferior.h. */
@@ -2914,10 +2891,9 @@ interrupt_command (const char *args, int from_tty)
{
int all_threads = 0;
- dont_repeat (); /* Not for the faint of heart. */
+ dont_repeat (); /* Not for the faint of heart. */
- if (args != nullptr
- && startswith (args, "-a"))
+ if (args != nullptr && startswith (args, "-a"))
all_threads = 1;
interrupt_target_1 (all_threads);
@@ -2943,7 +2919,7 @@ default_print_float_info (struct gdbarch *gdbarch, struct ui_file *file,
}
if (!printed_something)
gdb_printf (file, "No floating-point info "
- "available for this processor.\n");
+ "available for this processor.\n");
}
static void
@@ -2952,12 +2928,12 @@ info_float_command (const char *args, int from_tty)
frame_info_ptr frame;
if (!target_has_registers ())
- error (_("The program has no registers now."));
+ error (_ ("The program has no registers now."));
frame = get_selected_frame (nullptr);
gdbarch_print_float_info (get_frame_arch (frame), gdb_stdout, frame, args);
}
-
+
/* Implement `info proc' family of commands. */
static void
@@ -2970,7 +2946,7 @@ info_proc_cmd_1 (const char *args, enum info_proc_what what, int from_tty)
if (gdbarch_info_proc_p (gdbarch))
gdbarch_info_proc (gdbarch, args, what);
else
- error (_("Not supported on this target."));
+ error (_ ("Not supported on this target."));
}
}
@@ -3050,20 +3026,18 @@ info_proc_cmd_all (const char *args, int from_tty)
static void
show_print_finish (struct ui_file *file, int from_tty,
- struct cmd_list_element *c,
- const char *value)
+ struct cmd_list_element *c, const char *value)
{
- gdb_printf (file, _("\
+ gdb_printf (file, _ ("\
Printing of return value after `finish' is %s.\n"),
value);
}
-
/* This help string is used for the run, start, and starti commands.
It is defined as a macro to prevent duplication. */
#define RUN_ARGS_HELP \
-"You may specify arguments to give it.\n\
+ "You may specify arguments to give it.\n\
Args may include \"*\", or \"[...]\"; they are expanded using the\n\
shell that will start the program (specified by the \"$SHELL\" environment\n\
variable). Input and output redirection with \">\", \"<\", or \">>\"\n\
@@ -3076,6 +3050,7 @@ use \"set args\" without arguments.\n\
To start the inferior without using a shell, use \"set startup-with-shell off\"."
void _initialize_infcmd ();
+
void
_initialize_infcmd ()
{
@@ -3085,70 +3060,73 @@ _initialize_infcmd ()
/* Add the filename of the terminal connected to inferior I/O. */
add_setshow_optional_filename_cmd ("inferior-tty", class_run,
- &inferior_io_terminal_scratch, _("\
-Set terminal for future runs of program being debugged."), _("\
-Show terminal for future runs of program being debugged."), _("\
+ &inferior_io_terminal_scratch, _ ("\
+Set terminal for future runs of program being debugged."),
+ _ ("\
+Show terminal for future runs of program being debugged."),
+ _ ("\
Usage: set inferior-tty [TTY]\n\n\
If TTY is omitted, the default behavior of using the same terminal as GDB\n\
is restored."),
set_inferior_tty_command,
- show_inferior_tty_command,
- &setlist, &showlist);
+ show_inferior_tty_command, &setlist,
+ &showlist);
cmd_name = "inferior-tty";
c = lookup_cmd (&cmd_name, setlist, "", nullptr, -1, 1);
gdb_assert (c != nullptr);
add_alias_cmd ("tty", c, class_run, 0, &cmdlist);
cmd_name = "args";
- add_setshow_string_noescape_cmd (cmd_name, class_run,
- &inferior_args_scratch, _("\
-Set argument list to give program being debugged when it is started."), _("\
-Show argument list to give program being debugged when it is started."), _("\
+ add_setshow_string_noescape_cmd (cmd_name, class_run, &inferior_args_scratch,
+ _ ("\
+Set argument list to give program being debugged when it is started."),
+ _ ("\
+Show argument list to give program being debugged when it is started."),
+ _ ("\
Follow this command with any number of args, to be passed to the program."),
- set_args_command,
- show_args_command,
+ set_args_command, show_args_command,
&setlist, &showlist);
c = lookup_cmd (&cmd_name, setlist, "", nullptr, -1, 1);
gdb_assert (c != nullptr);
set_cmd_completer (c, filename_completer);
cmd_name = "cwd";
- add_setshow_string_noescape_cmd (cmd_name, class_run,
- &inferior_cwd_scratch, _("\
+ add_setshow_string_noescape_cmd (cmd_name, class_run, &inferior_cwd_scratch,
+ _ ("\
Set the current working directory to be used when the inferior is started.\n\
Changing this setting does not have any effect on inferiors that are\n\
already running."),
- _("\
+ _ ("\
Show the current working directory that is used when the inferior is started."),
- _("\
+ _ ("\
Use this command to change the current working directory that will be used\n\
when the inferior is started. This setting does not affect GDB's current\n\
working directory."),
- set_cwd_command,
- show_cwd_command,
- &setlist, &showlist);
+ set_cwd_command, show_cwd_command, &setlist,
+ &showlist);
c = lookup_cmd (&cmd_name, setlist, "", nullptr, -1, 1);
gdb_assert (c != nullptr);
set_cmd_completer (c, filename_completer);
- c = add_cmd ("environment", no_class, environment_info, _("\
+ c = add_cmd ("environment", no_class, environment_info, _ ("\
The environment to give the program, or one variable's value.\n\
With an argument VAR, prints the value of environment variable VAR to\n\
give the program being debugged. With no arguments, prints the entire\n\
-environment to be given to the program."), &showlist);
+environment to be given to the program."),
+ &showlist);
set_cmd_completer (c, noop_completer);
add_basic_prefix_cmd ("unset", no_class,
- _("Complement to certain \"set\" commands."),
+ _ ("Complement to certain \"set\" commands."),
&unsetlist, 0, &cmdlist);
- c = add_cmd ("environment", class_run, unset_environment_command, _("\
+ c = add_cmd ("environment", class_run, unset_environment_command, _ ("\
Cancel environment variable VAR for the program.\n\
This does not affect the program until the next \"run\" command."),
&unsetlist);
set_cmd_completer (c, noop_completer);
- c = add_cmd ("environment", class_run, set_environment_command, _("\
+ c = add_cmd ("environment", class_run, set_environment_command, _ ("\
Set environment variable value to give the program.\n\
Arguments are VAR VALUE where VAR is variable name and VALUE is value.\n\
VALUES of environment variables are uninterpreted strings.\n\
@@ -3156,7 +3134,7 @@ This does not affect the program until the next \"run\" command."),
&setlist);
set_cmd_completer (c, noop_completer);
- c = add_com ("path", class_files, path_command, _("\
+ c = add_com ("path", class_files, path_command, _ ("\
Add directory DIR(s) to beginning of search path for object files.\n\
$cwd in the path means the current working directory.\n\
This path is equivalent to the $PATH shell variable. It is a list of\n\
@@ -3165,7 +3143,7 @@ fully linked executable files and separately compiled object files as \
needed."));
set_cmd_completer (c, filename_completer);
- c = add_cmd ("paths", no_class, path_info, _("\
+ c = add_cmd ("paths", no_class, path_info, _ ("\
Current search path for finding object files.\n\
$cwd in the path means the current working directory.\n\
This path is equivalent to the $PATH shell variable. It is a list of\n\
@@ -3176,10 +3154,10 @@ needed."),
set_cmd_completer (c, noop_completer);
add_prefix_cmd ("kill", class_run, kill_command,
- _("Kill execution of program being debugged."),
- &killlist, 0, &cmdlist);
+ _ ("Kill execution of program being debugged."), &killlist,
+ 0, &cmdlist);
- add_com ("attach", class_run, attach_command, _("\
+ add_com ("attach", class_run, attach_command, _ ("\
Attach to a process or file outside of GDB.\n\
This command attaches to another target, of the same type as your last\n\
\"target\" command (\"info files\" will show your target stack).\n\
@@ -3192,18 +3170,18 @@ directory, or (if not found there) using the source file search path\n\
(see the \"directory\" command). You can also use the \"file\" command\n\
to specify the program, and to load its symbol table."));
- add_prefix_cmd ("detach", class_run, detach_command, _("\
+ add_prefix_cmd ("detach", class_run, detach_command, _ ("\
Detach a process or file previously attached.\n\
If a process, it is no longer traced, and it continues its execution. If\n\
you were debugging a file, the file is closed and gdb no longer accesses it."),
&detachlist, 0, &cmdlist);
- add_com ("disconnect", class_run, disconnect_command, _("\
+ add_com ("disconnect", class_run, disconnect_command, _ ("\
Disconnect from a target.\n\
The target will wait for another debugger to connect. Not available for\n\
all targets."));
- c = add_com ("signal", class_run, signal_command, _("\
+ c = add_com ("signal", class_run, signal_command, _ ("\
Continue program with the specified signal.\n\
Usage: signal SIGNAL\n\
The SIGNAL argument is processed the same as the handle command.\n\
@@ -3216,7 +3194,7 @@ In a multi-threaded program the signal is delivered to, or discarded from,\n\
the current thread only."));
set_cmd_completer (c, signal_completer);
- c = add_com ("queue-signal", class_run, queue_signal_command, _("\
+ c = add_com ("queue-signal", class_run, queue_signal_command, _ ("\
Queue a signal to be delivered to the current thread when it is resumed.\n\
Usage: queue-signal SIGNAL\n\
The SIGNAL argument is processed the same as the handle command.\n\
@@ -3231,7 +3209,7 @@ the current thread only."));
set_cmd_completer (c, signal_completer);
cmd_list_element *stepi_cmd
- = add_com ("stepi", class_run, stepi_command, _("\
+ = add_com ("stepi", class_run, stepi_command, _ ("\
Step one instruction exactly.\n\
Usage: stepi [N]\n\
Argument N means step N times (or till program stops for another \
@@ -3239,7 +3217,7 @@ reason)."));
add_com_alias ("si", stepi_cmd, class_run, 0);
cmd_list_element *nexti_cmd
- = add_com ("nexti", class_run, nexti_command, _("\
+ = add_com ("nexti", class_run, nexti_command, _ ("\
Step one instruction, but proceed through subroutine calls.\n\
Usage: nexti [N]\n\
Argument N means step N times (or till program stops for another \
@@ -3247,14 +3225,13 @@ reason)."));
add_com_alias ("ni", nexti_cmd, class_run, 0);
cmd_list_element *finish_cmd
- = add_com ("finish", class_run, finish_command, _("\
+ = add_com ("finish", class_run, finish_command, _ ("\
Execute until selected stack frame returns.\n\
Usage: finish\n\
Upon return, the value returned is printed and put in the value history."));
add_com_alias ("fin", finish_cmd, class_run, 1);
- cmd_list_element *next_cmd
- = add_com ("next", class_run, next_command, _("\
+ cmd_list_element *next_cmd = add_com ("next", class_run, next_command, _ ("\
Step program, proceeding through subroutine calls.\n\
Usage: next [N]\n\
Unlike \"step\", if the current source line calls a subroutine,\n\
@@ -3262,8 +3239,7 @@ this command does not enter the subroutine, but instead steps over\n\
the call, in effect treating it as a single source line."));
add_com_alias ("n", next_cmd, class_run, 1);
- cmd_list_element *step_cmd
- = add_com ("step", class_run, step_command, _("\
+ cmd_list_element *step_cmd = add_com ("step", class_run, step_command, _ ("\
Step program until it reaches a different source line.\n\
Usage: step [N]\n\
Argument N means step N times (or till program stops for another \
@@ -3271,7 +3247,7 @@ reason)."));
add_com_alias ("s", step_cmd, class_run, 1);
cmd_list_element *until_cmd
- = add_com ("until", class_run, until_command, _("\
+ = add_com ("until", class_run, until_command, _ ("\
Execute until past the current line or past a LOCATION.\n\
Execute until the program reaches a source line greater than the current\n\
or a specified location (same args as break command) within the current \
@@ -3279,14 +3255,13 @@ frame."));
set_cmd_completer (until_cmd, location_completer);
add_com_alias ("u", until_cmd, class_run, 1);
- c = add_com ("advance", class_run, advance_command, _("\
+ c = add_com ("advance", class_run, advance_command, _ ("\
Continue the program up to the given location (same form as args for break \
command).\n\
Execution will also stop upon exit from the current stack frame."));
set_cmd_completer (c, location_completer);
- cmd_list_element *jump_cmd
- = add_com ("jump", class_run, jump_command, _("\
+ cmd_list_element *jump_cmd = add_com ("jump", class_run, jump_command, _ ("\
Continue program being debugged at specified line or address.\n\
Usage: jump LOCATION\n\
Give as argument either LINENUM or *ADDR, where ADDR is an expression\n\
@@ -3295,7 +3270,7 @@ for an address to start at."));
add_com_alias ("j", jump_cmd, class_run, 1);
cmd_list_element *continue_cmd
- = add_com ("continue", class_run, continue_command, _("\
+ = add_com ("continue", class_run, continue_command, _ ("\
Continue program being debugged, after signal or breakpoint.\n\
Usage: continue [N]\n\
If proceeding from breakpoint, a number N may be used as an argument,\n\
@@ -3309,31 +3284,27 @@ Specifying -a and an ignore count simultaneously is an error."));
add_com_alias ("c", continue_cmd, class_run, 1);
add_com_alias ("fg", continue_cmd, class_run, 1);
- cmd_list_element *run_cmd
- = add_com ("run", class_run, run_command, _("\
-Start debugged program.\n"
-RUN_ARGS_HELP));
+ cmd_list_element *run_cmd = add_com ("run", class_run, run_command, _ ("\
+Start debugged program.\n" RUN_ARGS_HELP));
set_cmd_completer (run_cmd, filename_completer);
add_com_alias ("r", run_cmd, class_run, 1);
- c = add_com ("start", class_run, start_command, _("\
-Start the debugged program stopping at the beginning of the main procedure.\n"
-RUN_ARGS_HELP));
+ c = add_com ("start", class_run, start_command, _ ("\
+Start the debugged program stopping at the beginning of the main procedure.\n" RUN_ARGS_HELP));
set_cmd_completer (c, filename_completer);
- c = add_com ("starti", class_run, starti_command, _("\
-Start the debugged program stopping at the first instruction.\n"
-RUN_ARGS_HELP));
+ c = add_com ("starti", class_run, starti_command, _ ("\
+Start the debugged program stopping at the first instruction.\n" RUN_ARGS_HELP));
set_cmd_completer (c, filename_completer);
add_com ("interrupt", class_run, interrupt_command,
- _("Interrupt the execution of the debugged program.\n\
+ _ ("Interrupt the execution of the debugged program.\n\
If non-stop mode is enabled, interrupt only the current thread,\n\
otherwise all the threads in the program are stopped. To \n\
interrupt all running threads in non-stop mode, use the -a option."));
cmd_list_element *info_registers_cmd
- = add_info ("registers", info_registers_command, _("\
+ = add_info ("registers", info_registers_command, _ ("\
List of integer registers and their contents, for selected stack frame.\n\
One or more register names as argument means describe the given registers.\n\
One or more register group names as argument means describe the registers\n\
@@ -3341,7 +3312,7 @@ in the named register groups."));
add_info_alias ("r", info_registers_cmd, 1);
set_cmd_completer (info_registers_cmd, reg_or_group_completer);
- c = add_info ("all-registers", info_all_registers_command, _("\
+ c = add_info ("all-registers", info_all_registers_command, _ ("\
List of all registers and their contents, for selected stack frame.\n\
One or more register names as argument means describe the given registers.\n\
One or more register group names as argument means describe the registers\n\
@@ -3349,58 +3320,55 @@ in the named register groups."));
set_cmd_completer (c, reg_or_group_completer);
add_info ("program", info_program_command,
- _("Execution status of the program."));
+ _ ("Execution status of the program."));
add_info ("float", info_float_command,
- _("Print the status of the floating point unit."));
+ _ ("Print the status of the floating point unit."));
add_info ("vector", info_vector_command,
- _("Print the status of the vector unit."));
+ _ ("Print the status of the vector unit."));
- add_prefix_cmd ("proc", class_info, info_proc_cmd,
- _("\
+ add_prefix_cmd ("proc", class_info, info_proc_cmd, _ ("\
Show additional information about a process.\n\
Specify any process id, or use the program being debugged by default."),
- &info_proc_cmdlist,
- 1/*allow-unknown*/, &infolist);
+ &info_proc_cmdlist, 1 /*allow-unknown*/, &infolist);
- add_cmd ("mappings", class_info, info_proc_cmd_mappings, _("\
+ add_cmd ("mappings", class_info, info_proc_cmd_mappings, _ ("\
List memory regions mapped by the specified process."),
&info_proc_cmdlist);
- add_cmd ("stat", class_info, info_proc_cmd_stat, _("\
+ add_cmd ("stat", class_info, info_proc_cmd_stat, _ ("\
List process info from /proc/PID/stat."),
&info_proc_cmdlist);
- add_cmd ("status", class_info, info_proc_cmd_status, _("\
+ add_cmd ("status", class_info, info_proc_cmd_status, _ ("\
List process info from /proc/PID/status."),
&info_proc_cmdlist);
- add_cmd ("cwd", class_info, info_proc_cmd_cwd, _("\
+ add_cmd ("cwd", class_info, info_proc_cmd_cwd, _ ("\
List current working directory of the specified process."),
&info_proc_cmdlist);
- add_cmd ("cmdline", class_info, info_proc_cmd_cmdline, _("\
+ add_cmd ("cmdline", class_info, info_proc_cmd_cmdline, _ ("\
List command line arguments of the specified process."),
&info_proc_cmdlist);
- add_cmd ("exe", class_info, info_proc_cmd_exe, _("\
+ add_cmd ("exe", class_info, info_proc_cmd_exe, _ ("\
List absolute filename for executable of the specified process."),
&info_proc_cmdlist);
- add_cmd ("files", class_info, info_proc_cmd_files, _("\
+ add_cmd ("files", class_info, info_proc_cmd_files, _ ("\
List files opened by the specified process."),
&info_proc_cmdlist);
- add_cmd ("all", class_info, info_proc_cmd_all, _("\
+ add_cmd ("all", class_info, info_proc_cmd_all, _ ("\
List all available info about the specified process."),
&info_proc_cmdlist);
- add_setshow_boolean_cmd ("finish", class_support,
- &finish_print, _("\
-Set whether `finish' prints the return value."), _("\
-Show whether `finish' prints the return value."), nullptr,
- nullptr,
- show_print_finish,
- &setprintlist, &showprintlist);
+ add_setshow_boolean_cmd ("finish", class_support, &finish_print, _ ("\
+Set whether `finish' prints the return value."),
+ _ ("\
+Show whether `finish' prints the return value."),
+ nullptr, nullptr, show_print_finish, &setprintlist,
+ &showprintlist);
}
diff --git a/gdb/inferior-iter.h b/gdb/inferior-iter.h
index c08ad71da9e..0c12e2feb6e 100644
--- a/gdb/inferior-iter.h
+++ b/gdb/inferior-iter.h
@@ -28,6 +28,7 @@
class all_inferiors_iterator
{
public:
+
typedef all_inferiors_iterator self_type;
typedef struct inferior *value_type;
typedef struct inferior *&reference;
@@ -38,7 +39,8 @@ public:
/* Create an iterator pointing at HEAD. */
all_inferiors_iterator (process_stratum_target *proc_target,
const intrusive_list<inferior> &list)
- : m_proc_target (proc_target), m_inf_iter (list.begin ())
+ : m_proc_target (proc_target),
+ m_inf_iter (list.begin ())
{
intrusive_list<inferior>::iterator end;
@@ -51,7 +53,8 @@ public:
/* Create a one-past-end iterator. */
all_inferiors_iterator ()
: m_proc_target (nullptr)
- {}
+ {
+ }
all_inferiors_iterator &operator++ ()
{
@@ -59,13 +62,15 @@ public:
return *this;
}
- inferior *operator* () const
- { return &*m_inf_iter; }
+ inferior *operator* () const { return &*m_inf_iter; }
bool operator!= (const all_inferiors_iterator &other) const
- { return m_inf_iter != other.m_inf_iter; }
+ {
+ return m_inf_iter != other.m_inf_iter;
+ }
private:
+
/* Advance to next inferior, skipping filtered inferiors. */
void advance ()
{
@@ -104,10 +109,7 @@ using all_inferiors_range = iterator_range<all_inferiors_iterator>;
struct exited_inferior_filter
{
- bool operator() (inferior *inf)
- {
- return inf->pid != 0;
- }
+ bool operator() (inferior *inf) { return inf->pid != 0; }
};
/* Iterate over all non-exited inferiors. */
diff --git a/gdb/inferior.c b/gdb/inferior.c
index a1e3c79d8a2..6131a06daf9 100644
--- a/gdb/inferior.c
+++ b/gdb/inferior.c
@@ -50,7 +50,7 @@ bool print_inferior_events = true;
incremented. */
static inferior_ref current_inferior_;
-struct inferior*
+struct inferior *
current_inferior (void)
{
return current_inferior_.get ();
@@ -204,11 +204,10 @@ add_inferior (int pid)
if (print_inferior_events)
{
if (pid != 0)
- gdb_printf (_("[New inferior %d (%s)]\n"),
- inf->num,
+ gdb_printf (_ ("[New inferior %d (%s)]\n"), inf->num,
target_pid_to_str (ptid_t (pid)).c_str ());
else
- gdb_printf (_("[New inferior %d]\n"), inf->num);
+ gdb_printf (_ ("[New inferior %d]\n"), inf->num);
}
return inf;
@@ -219,14 +218,13 @@ add_inferior (int pid)
void
inferior::clear_thread_list (bool silent)
{
- thread_list.clear_and_dispose ([=] (thread_info *thr)
- {
- threads_debug_printf ("deleting thread %s, silent = %d",
- thr->ptid.to_string ().c_str (), silent);
- set_thread_exited (thr, silent);
- if (thr->deletable ())
- delete thr;
- });
+ thread_list.clear_and_dispose ([=] (thread_info *thr) {
+ threads_debug_printf ("deleting thread %s, silent = %d",
+ thr->ptid.to_string ().c_str (), silent);
+ set_thread_exited (thr, silent);
+ if (thr->deletable ())
+ delete thr;
+ });
ptid_thread_map.clear ();
}
@@ -310,8 +308,7 @@ detach_inferior (inferior *inf)
exit_inferior_1 (inf, 0);
if (print_inferior_events)
- gdb_printf (_("[Inferior %d (%s) detached]\n"),
- inf->num,
+ gdb_printf (_ ("[Inferior %d (%s) detached]\n"), inf->num,
target_pid_to_str (ptid_t (pid)).c_str ());
}
@@ -428,9 +425,7 @@ prune_inferiors (void)
{
for (inferior *inf : all_inferiors_safe ())
{
- if (!inf->deletable ()
- || !inf->removable
- || inf->pid != 0)
+ if (!inf->deletable () || !inf->removable || inf->pid != 0)
continue;
delete_inferior (inf);
@@ -455,7 +450,7 @@ inferior_pid_to_str (int pid)
if (pid != 0)
return target_pid_to_str (ptid_t (pid));
else
- return _("<null>");
+ return _ ("<null>");
}
/* See inferior.h. */
@@ -467,10 +462,10 @@ print_selected_inferior (struct ui_out *uiout)
const char *filename = inf->pspace->exec_filename.get ();
if (filename == NULL)
- filename = _("<noexec>");
+ filename = _ ("<noexec>");
- uiout->message (_("[Switching to inferior %d [%s] (%s)]\n"),
- inf->num, inferior_pid_to_str (inf->pid).c_str (), filename);
+ uiout->message (_ ("[Switching to inferior %d [%s] (%s)]\n"), inf->num,
+ inferior_pid_to_str (inf->pid).c_str (), filename);
}
/* Helper for print_inferior. Returns the 'connection-id' string for
@@ -525,8 +520,8 @@ print_inferior (struct ui_out *uiout, const char *requested_inferiors)
uiout->table_header (1, ui_left, "current", "");
uiout->table_header (4, ui_left, "number", "Num");
uiout->table_header (17, ui_left, "target-id", "Description");
- uiout->table_header (connection_id_len, ui_left,
- "connection-id", "Connection");
+ uiout->table_header (connection_id_len, ui_left, "connection-id",
+ "Connection");
uiout->table_header (17, ui_left, "exec", "Executable");
uiout->table_body ();
@@ -569,12 +564,12 @@ print_inferior (struct ui_out *uiout, const char *requested_inferiors)
relationships, if any. */
if (inf->vfork_parent)
{
- uiout->text (_("\n\tis vfork child of inferior "));
+ uiout->text (_ ("\n\tis vfork child of inferior "));
uiout->field_signed ("vfork-parent", inf->vfork_parent->num);
}
if (inf->vfork_child)
{
- uiout->text (_("\n\tis vfork parent of inferior "));
+ uiout->text (_ ("\n\tis vfork parent of inferior "));
uiout->field_signed ("vfork-child", inf->vfork_child->num);
}
@@ -586,7 +581,7 @@ static void
detach_inferior_command (const char *args, int from_tty)
{
if (!args || !*args)
- error (_("Requires argument (inferior id(s) to detach)"));
+ error (_ ("Requires argument (inferior id(s) to detach)"));
scoped_restore_current_thread restore_thread;
@@ -598,20 +593,20 @@ detach_inferior_command (const char *args, int from_tty)
inferior *inf = find_inferior_id (num);
if (inf == NULL)
{
- warning (_("Inferior ID %d not known."), num);
+ warning (_ ("Inferior ID %d not known."), num);
continue;
}
if (inf->pid == 0)
{
- warning (_("Inferior ID %d is not running."), num);
+ warning (_ ("Inferior ID %d is not running."), num);
continue;
}
thread_info *tp = any_thread_of_inferior (inf);
if (tp == NULL)
{
- warning (_("Inferior ID %d has no threads."), num);
+ warning (_ ("Inferior ID %d has no threads."), num);
continue;
}
@@ -625,7 +620,7 @@ static void
kill_inferior_command (const char *args, int from_tty)
{
if (!args || !*args)
- error (_("Requires argument (inferior id(s) to kill)"));
+ error (_ ("Requires argument (inferior id(s) to kill)"));
scoped_restore_current_thread restore_thread;
@@ -637,20 +632,20 @@ kill_inferior_command (const char *args, int from_tty)
inferior *inf = find_inferior_id (num);
if (inf == NULL)
{
- warning (_("Inferior ID %d not known."), num);
+ warning (_ ("Inferior ID %d not known."), num);
continue;
}
if (inf->pid == 0)
{
- warning (_("Inferior ID %d is not running."), num);
+ warning (_ ("Inferior ID %d is not running."), num);
continue;
}
thread_info *tp = any_thread_of_inferior (inf);
if (tp == NULL)
{
- warning (_("Inferior ID %d has no threads."), num);
+ warning (_ ("Inferior ID %d has no threads."), num);
continue;
}
@@ -685,11 +680,10 @@ inferior_command (const char *args, int from_tty)
const char *filename = inf->pspace->exec_filename.get ();
if (filename == nullptr)
- filename = _("<noexec>");
+ filename = _ ("<noexec>");
- gdb_printf (_("[Current inferior is %d [%s] (%s)]\n"),
- inf->num, inferior_pid_to_str (inf->pid).c_str (),
- filename);
+ gdb_printf (_ ("[Current inferior is %d [%s] (%s)]\n"), inf->num,
+ inferior_pid_to_str (inf->pid).c_str (), filename);
}
else
{
@@ -697,7 +691,7 @@ inferior_command (const char *args, int from_tty)
inf = find_inferior_id (num);
if (inf == NULL)
- error (_("Inferior ID %d not known."), num);
+ error (_ ("Inferior ID %d not known."), num);
if (inf->pid != 0)
{
@@ -705,22 +699,21 @@ inferior_command (const char *args, int from_tty)
{
thread_info *tp = any_thread_of_inferior (inf);
if (tp == NULL)
- error (_("Inferior has no threads."));
+ error (_ ("Inferior has no threads."));
switch_to_thread (tp);
}
- gdb::observers::user_selected_context_changed.notify
- (USER_SELECTED_INFERIOR
- | USER_SELECTED_THREAD
- | USER_SELECTED_FRAME);
+ gdb::observers::user_selected_context_changed.notify (
+ USER_SELECTED_INFERIOR | USER_SELECTED_THREAD
+ | USER_SELECTED_FRAME);
}
else
{
switch_to_inferior_no_thread (inf);
- gdb::observers::user_selected_context_changed.notify
- (USER_SELECTED_INFERIOR);
+ gdb::observers::user_selected_context_changed.notify (
+ USER_SELECTED_INFERIOR);
}
}
}
@@ -739,7 +732,7 @@ static void
remove_inferior_command (const char *args, int from_tty)
{
if (args == NULL || *args == '\0')
- error (_("Requires an argument (inferior id(s) to remove)"));
+ error (_ ("Requires an argument (inferior id(s) to remove)"));
number_or_range_parser parser (args);
while (!parser.finished ())
@@ -749,19 +742,19 @@ remove_inferior_command (const char *args, int from_tty)
if (inf == NULL)
{
- warning (_("Inferior ID %d not known."), num);
+ warning (_ ("Inferior ID %d not known."), num);
continue;
}
if (!inf->deletable ())
{
- warning (_("Can not remove current inferior %d."), num);
+ warning (_ ("Can not remove current inferior %d."), num);
continue;
}
-
+
if (inf->pid != 0)
{
- warning (_("Can not remove active inferior %d."), num);
+ warning (_ ("Can not remove active inferior %d."), num);
continue;
}
@@ -799,8 +792,8 @@ add_inferior_with_spaces (void)
/* See inferior.h. */
void
-switch_to_inferior_and_push_target (inferior *new_inf,
- bool no_connection, inferior *org_inf)
+switch_to_inferior_and_push_target (inferior *new_inf, bool no_connection,
+ inferior *org_inf)
{
process_stratum_target *proc_target = org_inf->process_target ();
@@ -812,13 +805,12 @@ switch_to_inferior_and_push_target (inferior *new_inf,
if (!no_connection && proc_target != NULL)
{
new_inf->push_target (proc_target);
- gdb_printf (_("Added inferior %d on connection %d (%s)\n"),
- new_inf->num,
- proc_target->connection_number,
+ gdb_printf (_ ("Added inferior %d on connection %d (%s)\n"),
+ new_inf->num, proc_target->connection_number,
make_target_connection_string (proc_target).c_str ());
}
else
- gdb_printf (_("Added inferior %d\n"), new_inf->num);
+ gdb_printf (_ ("Added inferior %d\n"), new_inf->num);
}
/* add-inferior [-copies N] [-exec FILENAME] [-no-connection] */
@@ -846,7 +838,7 @@ add_inferior_command (const char *args, int from_tty)
{
++argv;
if (!*argv)
- error (_("No argument to -copies"));
+ error (_ ("No argument to -copies"));
copies = parse_and_eval_long (*argv);
}
else if (strcmp (*argv, "-no-connection") == 0)
@@ -855,12 +847,12 @@ add_inferior_command (const char *args, int from_tty)
{
++argv;
if (!*argv)
- error (_("No argument to -exec"));
+ error (_ ("No argument to -exec"));
exec.reset (tilde_expand (*argv));
}
}
else
- error (_("Invalid argument"));
+ error (_ ("Invalid argument"));
}
}
@@ -904,11 +896,11 @@ clone_inferior_command (const char *args, int from_tty)
{
++argv;
if (!*argv)
- error (_("No argument to -copies"));
+ error (_ ("No argument to -copies"));
copies = parse_and_eval_long (*argv);
if (copies < 0)
- error (_("Invalid copies number"));
+ error (_ ("Invalid copies number"));
}
else if (strcmp (*argv, "-no-connection") == 0)
no_connection = true;
@@ -925,11 +917,11 @@ clone_inferior_command (const char *args, int from_tty)
orginf = find_inferior_id (num);
if (orginf == NULL)
- error (_("Inferior ID %d not known."), num);
+ error (_ ("Inferior ID %d not known."), num);
continue;
}
else
- error (_("Invalid argument"));
+ error (_ ("Invalid argument"));
}
}
}
@@ -976,11 +968,11 @@ clone_inferior_command (const char *args, int from_tty)
const std::string::size_type pos = set_var.find ('=');
gdb_assert (pos != std::string::npos);
const std::string varname = set_var.substr (0, pos);
- inf->environment.set
- (varname.c_str (), orginf->environment.get (varname.c_str ()));
+ inf->environment.set (varname.c_str (),
+ orginf->environment.get (varname.c_str ()));
}
- for (const std::string &unset_var
- : orginf->environment.user_unset_env ())
+ for (const std::string &unset_var :
+ orginf->environment.user_unset_env ())
inf->environment.unset (unset_var.c_str ());
}
}
@@ -988,9 +980,9 @@ clone_inferior_command (const char *args, int from_tty)
/* Print notices when new inferiors are created and die. */
static void
show_print_inferior_events (struct ui_file *file, int from_tty,
- struct cmd_list_element *c, const char *value)
+ struct cmd_list_element *c, const char *value)
{
- gdb_printf (file, _("Printing of inferior events is %s.\n"), value);
+ gdb_printf (file, _ ("Printing of inferior events is %s.\n"), value);
}
/* Return a new value for the selected inferior's id. */
@@ -1006,14 +998,11 @@ inferior_id_make_value (struct gdbarch *gdbarch, struct internalvar *var,
/* Implementation of `$_inferior' variable. */
-static const struct internalvar_funcs inferior_funcs =
-{
+static const struct internalvar_funcs inferior_funcs = {
inferior_id_make_value,
NULL,
};
-
-
void
initialize_inferiors (void)
{
@@ -1032,12 +1021,12 @@ initialize_inferiors (void)
initialize_current_architecture. */
add_info ("inferiors", info_inferiors_command,
- _("Print a list of inferiors being managed.\n\
+ _ ("Print a list of inferiors being managed.\n\
Usage: info inferiors [ID]...\n\
If IDs are specified, the list is limited to just those inferiors.\n\
By default all inferiors are displayed."));
- c = add_com ("add-inferior", no_class, add_inferior_command, _("\
+ c = add_com ("add-inferior", no_class, add_inferior_command, _ ("\
Add a new inferior.\n\
Usage: add-inferior [-copies N] [-exec FILENAME] [-no-connection]\n\
N is the optional number of inferiors to add, default is 1.\n\
@@ -1048,11 +1037,11 @@ If -no-connection is specified, the new inferior begins with\n\
no target connection yet."));
set_cmd_completer (c, filename_completer);
- add_com ("remove-inferiors", no_class, remove_inferior_command, _("\
+ add_com ("remove-inferiors", no_class, remove_inferior_command, _ ("\
Remove inferior ID (or list of IDs).\n\
Usage: remove-inferiors ID..."));
- add_com ("clone-inferior", no_class, clone_inferior_command, _("\
+ add_com ("clone-inferior", no_class, clone_inferior_command, _ ("\
Clone inferior ID.\n\
Usage: clone-inferior [-copies N] [-no-connection] [ID]\n\
Add N copies of inferior ID. The new inferiors have the same\n\
@@ -1063,29 +1052,29 @@ By default, the new inferiors inherit the copied inferior's connection.\n\
If -no-connection is specified, the new inferiors begin with\n\
no target connection yet."));
- add_cmd ("inferiors", class_run, detach_inferior_command, _("\
+ add_cmd ("inferiors", class_run, detach_inferior_command, _ ("\
Detach from inferior ID (or list of IDS).\n\
Usage; detach inferiors ID..."),
&detachlist);
- add_cmd ("inferiors", class_run, kill_inferior_command, _("\
+ add_cmd ("inferiors", class_run, kill_inferior_command, _ ("\
Kill inferior ID (or list of IDs).\n\
Usage: kill inferiors ID..."),
&killlist);
- add_cmd ("inferior", class_run, inferior_command, _("\
+ add_cmd ("inferior", class_run, inferior_command, _ ("\
Use this command to switch between inferiors.\n\
Usage: inferior ID\n\
The new inferior ID must be currently known."),
&cmdlist);
- add_setshow_boolean_cmd ("inferior-events", no_class,
- &print_inferior_events, _("\
-Set printing of inferior events (such as inferior start and exit)."), _("\
-Show printing of inferior events (such as inferior start and exit)."), NULL,
- NULL,
- show_print_inferior_events,
- &setprintlist, &showprintlist);
+ add_setshow_boolean_cmd ("inferior-events", no_class, &print_inferior_events,
+ _ ("\
+Set printing of inferior events (such as inferior start and exit)."),
+ _ ("\
+Show printing of inferior events (such as inferior start and exit)."),
+ NULL, NULL, show_print_inferior_events,
+ &setprintlist, &showprintlist);
create_internalvar_type_lazy ("_inferior", &inferior_funcs, NULL);
}
diff --git a/gdb/inferior.h b/gdb/inferior.h
index 72034cc4ffb..30ddbb3a3d0 100644
--- a/gdb/inferior.h
+++ b/gdb/inferior.h
@@ -18,7 +18,7 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
-#if !defined (INFERIOR_H)
+#if !defined(INFERIOR_H)
#define INFERIOR_H 1
#include <exception>
@@ -93,14 +93,14 @@ struct infcall_suspend_state_deleter
unwinding = std::uncaught_exception ();
#endif
if (!unwinding)
- warning (_("Failed to restore inferior state: %s"), e.what ());
+ warning (_ ("Failed to restore inferior state: %s"), e.what ());
}
}
};
/* A unique_ptr specialization for infcall_suspend_state. */
typedef std::unique_ptr<infcall_suspend_state, infcall_suspend_state_deleter>
- infcall_suspend_state_up;
+ infcall_suspend_state_up;
extern infcall_suspend_state_up save_infcall_suspend_state ();
@@ -116,7 +116,7 @@ struct infcall_control_state_deleter
/* A unique_ptr specialization for infcall_control_state. */
typedef std::unique_ptr<infcall_control_state, infcall_control_state_deleter>
- infcall_control_state_up;
+ infcall_control_state_up;
extern infcall_control_state_up save_infcall_control_state ();
@@ -124,7 +124,7 @@ extern void discard_infcall_suspend_state (struct infcall_suspend_state *);
extern void discard_infcall_control_state (struct infcall_control_state *);
extern readonly_detached_regcache *
- get_infcall_suspend_state_regcache (struct infcall_suspend_state *);
+get_infcall_suspend_state_regcache (struct infcall_suspend_state *);
extern void set_sigint_trap (void);
@@ -156,16 +156,15 @@ extern void reopen_exec_file (void);
extern void default_print_registers_info (struct gdbarch *gdbarch,
struct ui_file *file,
- frame_info_ptr frame,
- int regnum, int all);
+ frame_info_ptr frame, int regnum,
+ int all);
/* Default implementation of gdbarch_print_float_info. Print
the values of all floating point registers. */
extern void default_print_float_info (struct gdbarch *gdbarch,
struct ui_file *file,
- frame_info_ptr frame,
- const char *args);
+ frame_info_ptr frame, const char *args);
/* Try to determine whether TTY is GDB's input terminal. Returns
TRIBOOL_UNKNOWN if we can't tell. */
@@ -295,14 +294,12 @@ extern bool print_inferior_events;
is not passed back down to the kernel. */
enum stop_kind
- {
- NO_STOP_QUIETLY = 0,
- STOP_QUIETLY,
- STOP_QUIETLY_REMOTE,
- STOP_QUIETLY_NO_SIGSTOP
- };
-
-
+{
+ NO_STOP_QUIETLY = 0,
+ STOP_QUIETLY,
+ STOP_QUIETLY_REMOTE,
+ STOP_QUIETLY_NO_SIGSTOP
+};
/* Base class for target-specific inferior data. */
@@ -347,8 +344,7 @@ struct target_desc_info
{
/* Returns true if this target description information has been supplied by
the user. */
- bool from_user_p ()
- { return !this->filename.empty (); }
+ bool from_user_p () { return !this->filename.empty (); }
/* A flag indicating that a description has already been fetched
from the target, so it should not be queried again. */
@@ -390,10 +386,10 @@ struct target_desc_info
listed exactly once in the inferior list, so placing an inferior in
the inferior list is an implicit, not counted strong reference. */
-class inferior : public refcounted_object,
- public intrusive_list_node<inferior>
+class inferior : public refcounted_object, public intrusive_list_node<inferior>
{
public:
+
explicit inferior (int pid);
~inferior ();
@@ -401,8 +397,7 @@ public:
bool deletable () const { return refcount () == 0; }
/* Push T in this inferior's target stack. */
- void push_target (struct target_ops *t)
- { m_target_stack.push (t); }
+ void push_target (struct target_ops *t) { m_target_stack.push (t); }
/* An overload that deletes the target on failure. */
void push_target (target_ops_up &&t)
@@ -416,21 +411,23 @@ public:
/* Returns true if T is pushed in this inferior's target stack. */
bool target_is_pushed (const target_ops *t) const
- { return m_target_stack.is_pushed (t); }
+ {
+ return m_target_stack.is_pushed (t);
+ }
/* Find the target beneath T in this inferior's target stack. */
target_ops *find_target_beneath (const target_ops *t)
- { return m_target_stack.find_beneath (t); }
+ {
+ return m_target_stack.find_beneath (t);
+ }
/* Return the target at the top of this inferior's target stack. */
- target_ops *top_target ()
- { return m_target_stack.top (); }
+ target_ops *top_target () { return m_target_stack.top (); }
/* Unpush all targets except the dummy target from m_target_stack. As
targets are removed from m_target_stack their reference count is
decremented, which may cause a target to close. */
- void pop_all_targets ()
- { pop_all_targets_above (dummy_stratum); }
+ void pop_all_targets () { pop_all_targets_above (dummy_stratum); }
/* Unpush all targets above STRATUM from m_target_stack. As targets are
removed from m_target_stack their reference count is decremented,
@@ -445,14 +442,17 @@ public:
/* Return the target at process_stratum level in this inferior's
target stack. */
struct process_stratum_target *process_target ()
- { return (process_stratum_target *) m_target_stack.at (process_stratum); }
+ {
+ return (process_stratum_target *) m_target_stack.at (process_stratum);
+ }
/* Return the target at STRATUM in this inferior's target stack. */
target_ops *target_at (enum strata stratum)
- { return m_target_stack.at (stratum); }
+ {
+ return m_target_stack.at (stratum);
+ }
- bool has_execution ()
- { return target_has_execution (this); }
+ bool has_execution () { return target_has_execution (this); }
/* This inferior's thread list, sorted by creation order. */
intrusive_list<thread_info> thread_list;
@@ -468,7 +468,9 @@ public:
{ .... }
*/
inf_threads_range threads ()
- { return inf_threads_range (this->thread_list.begin ()); }
+ {
+ return inf_threads_range (this->thread_list.begin ());
+ }
/* Returns a range adapter covering the inferior's non-exited
threads. Used like this:
@@ -477,7 +479,9 @@ public:
{ .... }
*/
inf_non_exited_threads_range non_exited_threads ()
- { return inf_non_exited_threads_range (this->thread_list.begin ()); }
+ {
+ return inf_non_exited_threads_range (this->thread_list.begin ());
+ }
/* Like inferior::threads(), but returns a range adapter that can be
used with range-for, safely. I.e., it is safe to delete the
@@ -488,7 +492,9 @@ public:
delete f;
*/
inline safe_inf_threads_range threads_safe ()
- { return safe_inf_threads_range (this->thread_list.begin ()); }
+ {
+ return safe_inf_threads_range (this->thread_list.begin ());
+ }
/* Delete all threads in the thread list. If SILENT, exit threads
silently. */
@@ -515,35 +521,23 @@ public:
/* Set the argument string to use when running this inferior.
An empty string can be used to represent "no arguments". */
- void set_args (std::string args)
- {
- m_args = std::move (args);
- };
+ void set_args (std::string args) { m_args = std::move (args); };
/* Get the argument string to use when running this inferior.
No arguments is represented by an empty string. */
- const std::string &args () const
- {
- return m_args;
- }
+ const std::string &args () const { return m_args; }
/* Set the inferior current working directory.
If CWD is empty, unset the directory. */
- void set_cwd (std::string cwd)
- {
- m_cwd = std::move (cwd);
- }
+ void set_cwd (std::string cwd) { m_cwd = std::move (cwd); }
/* Get the inferior current working directory.
Return an empty string if the current working directory is not
specified. */
- const std::string &cwd () const
- {
- return m_cwd;
- }
+ const std::string &cwd () const { return m_cwd; }
/* Convenient handle (GDB inferior id). Unique across all
inferiors. */
@@ -719,7 +713,7 @@ extern struct inferior *find_inferior_id (int num);
/* Find an inferior bound to PSPACE, giving preference to the current
inferior. */
extern struct inferior *
- find_inferior_for_program_space (struct program_space *pspace);
+find_inferior_for_program_space (struct program_space *pspace);
/* Returns true if the inferior list is not empty. */
extern int have_inferiors (void);
@@ -737,20 +731,21 @@ extern int have_live_inferiors (void);
class scoped_restore_current_inferior
{
public:
+
scoped_restore_current_inferior ()
: m_saved_inf (current_inferior ())
- {}
+ {
+ }
- ~scoped_restore_current_inferior ()
- { set_current_inferior (m_saved_inf); }
+ ~scoped_restore_current_inferior () { set_current_inferior (m_saved_inf); }
DISABLE_COPY_AND_ASSIGN (scoped_restore_current_inferior);
private:
+
inferior *m_saved_inf;
};
-
/* Traverse all inferiors. */
extern intrusive_list<inferior> inferior_list;
@@ -812,7 +807,8 @@ extern void print_selected_inferior (struct ui_out *uiout);
NO_CONNECTION is true, push the process_stratum_target of ORG_INF
to NEW_INF. */
-extern void switch_to_inferior_and_push_target
- (inferior *new_inf, bool no_connection, inferior *org_inf);
+extern void switch_to_inferior_and_push_target (inferior *new_inf,
+ bool no_connection,
+ inferior *org_inf);
#endif /* !defined (INFERIOR_H) */
diff --git a/gdb/inflow.c b/gdb/inflow.c
index 767cfd02c48..e5c8620e817 100644
--- a/gdb/inflow.c
+++ b/gdb/inflow.c
@@ -47,7 +47,7 @@
static void pass_signal (int);
static void child_terminal_ours_1 (target_terminal_state);
-
+
/* Record terminal status separately for debugger and inferior. */
static struct serial *stdin_serial;
@@ -170,10 +170,10 @@ gdb_has_a_terminal (void)
/* Macro for printing errors from ioctl operations */
-#define OOPSY(what) \
- if (result == -1) \
- gdb_printf(gdb_stderr, "[%s failed in terminal_inferior: %s]\n", \
- what, safe_strerror (errno))
+#define OOPSY(what) \
+ if (result == -1) \
+ gdb_printf (gdb_stderr, "[%s failed in terminal_inferior: %s]\n", what, \
+ safe_strerror (errno))
/* Initialize the terminal settings we record for the inferior,
before we actually run the inferior. */
@@ -231,8 +231,8 @@ is_gdb_terminal (const char *tty)
return ((gdb_tty.st_dev == other_tty.st_dev
&& gdb_tty.st_ino == other_tty.st_ino)
- ? TRIBOOL_TRUE
- : TRIBOOL_FALSE);
+ ? TRIBOOL_TRUE
+ : TRIBOOL_FALSE);
}
/* Return true if the inferior is using the same TTY for input as GDB
@@ -311,8 +311,7 @@ child_terminal_inferior (struct target_ops *self)
inferior *inf = current_inferior ();
terminal_info *tinfo = get_inflow_inferior_data (inf);
- if (gdb_has_a_terminal ()
- && tinfo->ttystate != NULL
+ if (gdb_has_a_terminal () && tinfo->ttystate != NULL
&& sharing_input_terminal (inf))
{
int result;
@@ -664,7 +663,7 @@ child_terminal_info (struct target_ops *self, const char *args, int from_tty)
if (!gdb_has_a_terminal ())
{
- gdb_printf (_("This GDB does not control a terminal.\n"));
+ gdb_printf (_ ("This GDB does not control a terminal.\n"));
return;
}
@@ -674,8 +673,8 @@ child_terminal_info (struct target_ops *self, const char *args, int from_tty)
inf = current_inferior ();
tinfo = get_inflow_inferior_data (inf);
- gdb_printf (_("Inferior's terminal status "
- "(currently saved by GDB):\n"));
+ gdb_printf (_ ("Inferior's terminal status "
+ "(currently saved by GDB):\n"));
/* First the fcntl flags. */
{
@@ -709,7 +708,7 @@ child_terminal_info (struct target_ops *self, const char *args, int from_tty)
flags &= ~O_NONBLOCK;
#endif
-#if defined (O_NDELAY)
+#if defined(O_NDELAY)
/* If O_NDELAY and O_NONBLOCK are defined to the same thing, we will
print it as O_NONBLOCK, which is good cause that is what POSIX
has, and the flag will already be cleared by the time we get here. */
@@ -722,7 +721,7 @@ child_terminal_info (struct target_ops *self, const char *args, int from_tty)
gdb_printf (" | O_APPEND");
flags &= ~O_APPEND;
-#if defined (O_BINARY)
+#if defined(O_BINARY)
if (flags & O_BINARY)
gdb_printf (" | O_BINARY");
flags &= ~O_BINARY;
@@ -739,7 +738,7 @@ child_terminal_info (struct target_ops *self, const char *args, int from_tty)
serial_print_tty_state (stdin_serial, tinfo->ttystate, gdb_stdout);
}
-
+
/* NEW_TTY_PREFORK is called before forking a new child process,
so we can record the state of ttys in the child to be formed.
TTYNAME is empty if we are to share the terminal with gdb;
@@ -820,7 +819,7 @@ new_tty (void)
if (ioctl (tty, TIOCSCTTY, 0) == -1)
/* Mention GDB in warning because it will appear in the inferior's
terminal instead of GDB's. */
- warning (_("GDB: Failed to set controlling terminal: %s"),
+ warning (_ ("GDB: Failed to set controlling terminal: %s"),
safe_strerror (errno));
#endif
@@ -846,7 +845,6 @@ new_tty_postfork (void)
inferior_thisrun_terminal.clear ();
}
-
/* Call set_sigint_trap when you need to pass a signal on to an attached
process when handling SIGINT. */
@@ -885,7 +883,6 @@ clear_sigint_trap (void)
osig_set = 0;
}
}
-
/* Create a new session if the inferior will run in a different tty.
A session is UNIX's way of grouping processes that share a controlling
@@ -905,7 +902,7 @@ create_tty_session (void)
ret = setsid ();
if (ret == -1)
- warning (_("Failed to create new terminal session: setsid: %s"),
+ warning (_ ("Failed to create new terminal session: setsid: %s"),
safe_strerror (errno));
return ret;
@@ -927,11 +924,12 @@ initialize_stdin_serial (void)
}
void _initialize_inflow ();
+
void
_initialize_inflow ()
{
add_info ("terminal", info_terminal_command,
- _("Print inferior's saved terminal status."));
+ _ ("Print inferior's saved terminal status."));
/* OK, figure out whether we have job control. */
have_job_control ();
diff --git a/gdb/infrun.c b/gdb/infrun.c
index 87ab73c47a4..4080dbc2253 100644
--- a/gdb/infrun.c
+++ b/gdb/infrun.c
@@ -141,11 +141,12 @@ mark_infrun_async_event_handler (void)
no line number information. The normal behavior is that we step
over such function. */
bool step_stop_if_no_debug = false;
+
static void
show_step_stop_if_no_debug (struct ui_file *file, int from_tty,
struct cmd_list_element *c, const char *value)
{
- gdb_printf (file, _("Mode of the step operation is %s.\n"), value);
+ gdb_printf (file, _ ("Mode of the step operation is %s.\n"), value);
}
/* proceed and normal_stop use this to notify the user when the
@@ -162,11 +163,12 @@ static ptid_t previous_inferior_ptid;
static bool detach_fork = true;
bool debug_infrun = false;
+
static void
show_debug_infrun (struct ui_file *file, int from_tty,
struct cmd_list_element *c, const char *value)
{
- gdb_printf (file, _("Inferior debugging is %s.\n"), value);
+ gdb_printf (file, _ ("Inferior debugging is %s.\n"), value);
}
/* Support for disabling address space randomization. */
@@ -179,13 +181,14 @@ show_disable_randomization (struct ui_file *file, int from_tty,
{
if (target_supports_disable_randomization ())
gdb_printf (file,
- _("Disabling randomization of debuggee's "
- "virtual address space is %s.\n"),
+ _ ("Disabling randomization of debuggee's "
+ "virtual address space is %s.\n"),
value);
else
- gdb_puts (_("Disabling randomization of debuggee's "
- "virtual address space is unsupported on\n"
- "this platform.\n"), file);
+ gdb_puts (_ ("Disabling randomization of debuggee's "
+ "virtual address space is unsupported on\n"
+ "this platform.\n"),
+ file);
}
static void
@@ -193,9 +196,9 @@ set_disable_randomization (const char *args, int from_tty,
struct cmd_list_element *c)
{
if (!target_supports_disable_randomization ())
- error (_("Disabling randomization of debuggee's "
- "virtual address space is unsupported on\n"
- "this platform."));
+ error (_ ("Disabling randomization of debuggee's "
+ "virtual address space is unsupported on\n"
+ "this platform."));
}
/* User interface for non-stop mode. */
@@ -204,24 +207,22 @@ bool non_stop = false;
static bool non_stop_1 = false;
static void
-set_non_stop (const char *args, int from_tty,
- struct cmd_list_element *c)
+set_non_stop (const char *args, int from_tty, struct cmd_list_element *c)
{
if (target_has_execution ())
{
non_stop_1 = non_stop;
- error (_("Cannot change this setting while the inferior is running."));
+ error (_ ("Cannot change this setting while the inferior is running."));
}
non_stop = non_stop_1;
}
static void
-show_non_stop (struct ui_file *file, int from_tty,
- struct cmd_list_element *c, const char *value)
+show_non_stop (struct ui_file *file, int from_tty, struct cmd_list_element *c,
+ const char *value)
{
- gdb_printf (file,
- _("Controlling the inferior in non-stop mode is %s.\n"),
+ gdb_printf (file, _ ("Controlling the inferior in non-stop mode is %s.\n"),
value);
}
@@ -233,13 +234,12 @@ static bool observer_mode = false;
static bool observer_mode_1 = false;
static void
-set_observer_mode (const char *args, int from_tty,
- struct cmd_list_element *c)
+set_observer_mode (const char *args, int from_tty, struct cmd_list_element *c)
{
if (target_has_execution ())
{
observer_mode_1 = observer_mode;
- error (_("Cannot change this setting while the inferior is running."));
+ error (_ ("Cannot change this setting while the inferior is running."));
}
observer_mode = observer_mode_1;
@@ -264,7 +264,7 @@ set_observer_mode (const char *args, int from_tty,
}
if (from_tty)
- gdb_printf (_("Observer mode is now %s.\n"),
+ gdb_printf (_ ("Observer mode is now %s.\n"),
(observer_mode ? "on" : "off"));
}
@@ -272,7 +272,7 @@ static void
show_observer_mode (struct ui_file *file, int from_tty,
struct cmd_list_element *c, const char *value)
{
- gdb_printf (file, _("Observer mode is %s.\n"), value);
+ gdb_printf (file, _ ("Observer mode is %s.\n"), value);
}
/* This updates the value of observer mode based on changes in
@@ -284,16 +284,12 @@ show_observer_mode (struct ui_file *file, int from_tty,
void
update_observer_mode (void)
{
- bool newval = (!may_insert_breakpoints
- && !may_insert_tracepoints
- && may_insert_fast_tracepoints
- && !may_stop
- && non_stop);
+ bool newval = (!may_insert_breakpoints && !may_insert_tracepoints
+ && may_insert_fast_tracepoints && !may_stop && non_stop);
/* Let the user know if things change. */
if (newval != observer_mode)
- gdb_printf (_("Observer mode is now %s.\n"),
- (newval ? "on" : "off"));
+ gdb_printf (_ ("Observer mode is now %s.\n"), (newval ? "on" : "off"));
observer_mode = observer_mode_1 = newval;
}
@@ -314,21 +310,25 @@ static unsigned char signal_catch[GDB_SIGNAL_LAST];
and simply cached here. */
static unsigned char signal_pass[GDB_SIGNAL_LAST];
-#define SET_SIGS(nsigs,sigs,flags) \
- do { \
- int signum = (nsigs); \
- while (signum-- > 0) \
- if ((sigs)[signum]) \
- (flags)[signum] = 1; \
- } while (0)
-
-#define UNSET_SIGS(nsigs,sigs,flags) \
- do { \
- int signum = (nsigs); \
- while (signum-- > 0) \
- if ((sigs)[signum]) \
- (flags)[signum] = 0; \
- } while (0)
+#define SET_SIGS(nsigs, sigs, flags) \
+ do \
+ { \
+ int signum = (nsigs); \
+ while (signum-- > 0) \
+ if ((sigs)[signum]) \
+ (flags)[signum] = 1; \
+ } \
+ while (0)
+
+#define UNSET_SIGS(nsigs, sigs, flags) \
+ do \
+ { \
+ int signum = (nsigs); \
+ while (signum-- > 0) \
+ if ((sigs)[signum]) \
+ (flags)[signum] = 0; \
+ } \
+ while (0)
/* Update the target's copy of SIGNAL_PROGRAM. The sole purpose of
this function is to avoid exporting `signal_program'. */
@@ -355,8 +355,8 @@ int stop_on_solib_events;
as appropriate when the above flag is changed. */
static void
-set_stop_on_solib_events (const char *args,
- int from_tty, struct cmd_list_element *c)
+set_stop_on_solib_events (const char *args, int from_tty,
+ struct cmd_list_element *c)
{
update_solib_breakpoints ();
}
@@ -365,8 +365,7 @@ static void
show_stop_on_solib_events (struct ui_file *file, int from_tty,
struct cmd_list_element *c, const char *value)
{
- gdb_printf (file, _("Stopping for shared library events is %s.\n"),
- value);
+ gdb_printf (file, _ ("Stopping for shared library events is %s.\n"), value);
}
/* True after stop if current stack frame should be printed. */
@@ -385,23 +384,20 @@ void init_thread_stepping_state (struct thread_info *tss);
static const char follow_fork_mode_child[] = "child";
static const char follow_fork_mode_parent[] = "parent";
-static const char *const follow_fork_mode_kind_names[] = {
- follow_fork_mode_child,
- follow_fork_mode_parent,
- nullptr
-};
+static const char *const follow_fork_mode_kind_names[]
+ = { follow_fork_mode_child, follow_fork_mode_parent, nullptr };
static const char *follow_fork_mode_string = follow_fork_mode_parent;
+
static void
show_follow_fork_mode_string (struct ui_file *file, int from_tty,
struct cmd_list_element *c, const char *value)
{
gdb_printf (file,
- _("Debugger response to a program "
- "call of fork or vfork is \"%s\".\n"),
+ _ ("Debugger response to a program "
+ "call of fork or vfork is \"%s\".\n"),
value);
}
-
/* Handle changes to the inferior list based on the type of fork,
which process is being followed, and whether the other process
@@ -419,8 +415,7 @@ follow_fork_inferior (bool follow_child, bool detach_fork)
ptid_t parent_ptid = inferior_ptid;
ptid_t child_ptid = inferior_thread ()->pending_follow.child_ptid ();
- if (has_vforked
- && !non_stop /* Non-stop always resumes both branches. */
+ if (has_vforked && !non_stop /* Non-stop always resumes both branches. */
&& current_ui->prompt_state == PROMPT_BLOCKED
&& !(follow_child || detach_fork || sched_multi))
{
@@ -429,7 +424,7 @@ follow_fork_inferior (bool follow_child, bool detach_fork)
the parent stays blocked. If we're telling the parent to run
in the foreground, the user will not be able to ctrl-c to get
back the terminal, effectively hanging the debug session. */
- gdb_printf (gdb_stderr, _("\
+ gdb_printf (gdb_stderr, _ ("\
Can not resume the parent process over vfork in the foreground while\n\
holding the child stopped. Try \"set detach-on-fork\" or \
\"set schedule-multiple\".\n"));
@@ -465,7 +460,7 @@ holding the child stopped. Try \"set detach-on-fork\" or \
ptid_t process_ptid = ptid_t (child_ptid.pid ());
target_terminal::ours_for_output ();
- gdb_printf (_("[Detaching after %s from child %s]\n"),
+ gdb_printf (_ ("[Detaching after %s from child %s]\n"),
has_vforked ? "vfork" : "fork",
target_pid_to_str (process_ptid).c_str ());
}
@@ -532,9 +527,8 @@ holding the child stopped. Try \"set detach-on-fork\" or \
std::string child_pid = target_pid_to_str (child_ptid);
target_terminal::ours_for_output ();
- gdb_printf (_("[Attaching after %s %s to child %s]\n"),
- parent_pid.c_str (),
- has_vforked ? "vfork" : "fork",
+ gdb_printf (_ ("[Attaching after %s %s to child %s]\n"),
+ parent_pid.c_str (), has_vforked ? "vfork" : "fork",
child_pid.c_str ());
}
@@ -659,8 +653,8 @@ holding the child stopped. Try \"set detach-on-fork\" or \
ptid_t process_ptid = ptid_t (parent_ptid.pid ());
target_terminal::ours_for_output ();
- gdb_printf (_("[Detaching after fork from "
- "parent %s]\n"),
+ gdb_printf (_ ("[Detaching after fork from "
+ "parent %s]\n"),
target_pid_to_str (process_ptid).c_str ());
}
@@ -755,15 +749,15 @@ follow_fork ()
preserve the stepping state in the fork child. */
if (follow_child && should_resume)
{
- step_resume_breakpoint = clone_momentary_breakpoint
- (tp->control.step_resume_breakpoint);
+ step_resume_breakpoint = clone_momentary_breakpoint (
+ tp->control.step_resume_breakpoint);
step_range_start = tp->control.step_range_start;
step_range_end = tp->control.step_range_end;
current_line = tp->current_line;
current_symtab = tp->current_symtab;
step_frame_id = tp->control.step_frame_id;
- exception_resume_breakpoint
- = clone_momentary_breakpoint (tp->control.exception_resume_breakpoint);
+ exception_resume_breakpoint = clone_momentary_breakpoint (
+ tp->control.exception_resume_breakpoint);
thread_fsm = tp->release_thread_fsm ();
/* For now, delete the parent's sr breakpoint, otherwise,
@@ -833,8 +827,8 @@ follow_fork ()
forked. In that case, the resume command
issued is most likely not applicable to the
child, so just warn, and refuse to resume. */
- warning (_("Not resuming: switched threads "
- "before following fork child."));
+ warning (_ ("Not resuming: switched threads "
+ "before following fork child."));
}
/* Reset breakpoints in the child as appropriate. */
@@ -901,10 +895,8 @@ follow_inferior_reset_breakpoints (void)
static void
proceed_after_vfork_done (thread_info *thread)
{
- if (thread->state == THREAD_RUNNING
- && !thread->executing ()
- && !thread->stop_requested
- && thread->stop_signal () == GDB_SIGNAL_0)
+ if (thread->state == THREAD_RUNNING && !thread->executing ()
+ && !thread->stop_requested && thread->stop_signal () == GDB_SIGNAL_0)
{
infrun_debug_printf ("resuming vfork parent thread %s",
thread->ptid.to_string ().c_str ());
@@ -976,13 +968,15 @@ handle_vfork_child_exec_or_exit (int exec)
if (exec)
{
- gdb_printf (_("[Detaching vfork parent %s "
- "after child exec]\n"), pidstr.c_str ());
+ gdb_printf (_ ("[Detaching vfork parent %s "
+ "after child exec]\n"),
+ pidstr.c_str ());
}
else
{
- gdb_printf (_("[Detaching vfork parent %s "
- "after child exit]\n"), pidstr.c_str ());
+ gdb_printf (_ ("[Detaching vfork parent %s "
+ "after child exit]\n"),
+ pidstr.c_str ());
}
}
@@ -1074,7 +1068,8 @@ handle_vfork_done (thread_info *event_thread)
possible for another thread to have reported a vfork during that window.
If THREAD_WAITING_FOR_VFORK_DONE is set, it has to be the same thread whose
vfork-done we are handling right now. */
- gdb_assert (event_thread->inf->thread_waiting_for_vfork_done == event_thread);
+ gdb_assert (event_thread->inf->thread_waiting_for_vfork_done
+ == event_thread);
event_thread->inf->thread_waiting_for_vfork_done = nullptr;
event_thread->inf->pspace->breakpoints_not_allowed = 0;
@@ -1100,19 +1095,19 @@ handle_vfork_done (thread_info *event_thread)
static const char follow_exec_mode_new[] = "new";
static const char follow_exec_mode_same[] = "same";
-static const char *const follow_exec_mode_names[] =
-{
+static const char *const follow_exec_mode_names[] = {
follow_exec_mode_new,
follow_exec_mode_same,
nullptr,
};
static const char *follow_exec_mode_string = follow_exec_mode_same;
+
static void
show_follow_exec_mode_string (struct ui_file *file, int from_tty,
struct cmd_list_element *c, const char *value)
{
- gdb_printf (file, _("Follow exec mode is \"%s\".\n"), value);
+ gdb_printf (file, _ ("Follow exec mode is \"%s\".\n"), value);
}
/* EXEC_FILE_TARGET is assumed to be non-NULL. */
@@ -1193,9 +1188,8 @@ follow_exec (ptid_t ptid, const char *exec_file_target)
/* What is this a.out's name? */
process_ptid = ptid_t (pid);
- gdb_printf (_("%s is executing new program: %s\n"),
- target_pid_to_str (process_ptid).c_str (),
- exec_file_target);
+ gdb_printf (_ ("%s is executing new program: %s\n"),
+ target_pid_to_str (process_ptid).c_str (), exec_file_target);
/* We've followed the inferior through an exec. Therefore, the
inferior has essentially been killed & reborn. */
@@ -1210,8 +1204,8 @@ follow_exec (ptid_t ptid, const char *exec_file_target)
is confusing. Maybe it would even be better to stop at this point
so that the user can specify a file manually before continuing. */
if (exec_file_host == nullptr)
- warning (_("Could not load symbols for executable %s.\n"
- "Do you need \"set sysroot\"?"),
+ warning (_ ("Could not load symbols for executable %s.\n"
+ "Do you need \"set sysroot\"?"),
exec_file_target);
/* Reset the shared library package. This ensures that we get a
@@ -1301,15 +1295,16 @@ thread_step_over_list global_thread_step_over_list;
/* Bit flags indicating what the thread needs to step over. */
enum step_over_what_flag
- {
- /* Step over a breakpoint. */
- STEP_OVER_BREAKPOINT = 1,
+{
+ /* Step over a breakpoint. */
+ STEP_OVER_BREAKPOINT = 1,
- /* Step past a non-continuable watchpoint, in order to let the
+ /* Step past a non-continuable watchpoint, in order to let the
instruction execute so we can evaluate the watchpoint
expression. */
- STEP_OVER_WATCHPOINT = 2
- };
+ STEP_OVER_WATCHPOINT = 2
+};
+
DEF_ENUM_FLAGS_TYPE (enum step_over_what_flag, step_over_what);
/* Info about an instruction that is being stepped over. */
@@ -1364,8 +1359,7 @@ static struct step_over_info step_over_info;
static void
set_step_over_info (const address_space *aspace, CORE_ADDR address,
- int nonsteppable_watchpoint_p,
- int thread)
+ int nonsteppable_watchpoint_p, int thread)
{
step_over_info.aspace = aspace;
step_over_info.address = address;
@@ -1389,12 +1383,10 @@ clear_step_over_info (void)
/* See infrun.h. */
int
-stepping_past_instruction_at (struct address_space *aspace,
- CORE_ADDR address)
+stepping_past_instruction_at (struct address_space *aspace, CORE_ADDR address)
{
return (step_over_info.aspace != nullptr
- && breakpoint_address_match (aspace, address,
- step_over_info.aspace,
+ && breakpoint_address_match (aspace, address, step_over_info.aspace,
step_over_info.address));
}
@@ -1403,8 +1395,7 @@ stepping_past_instruction_at (struct address_space *aspace,
int
thread_is_stepping_over_breakpoint (int thread)
{
- return (step_over_info.thread != -1
- && thread == step_over_info.thread);
+ return (step_over_info.thread != -1 && thread == step_over_info.thread);
}
/* See infrun.h. */
@@ -1424,7 +1415,6 @@ step_over_info_valid_p (void)
|| stepping_past_nonsteppable_watchpoint ());
}
-
/* Displaced stepping. */
/* In non-stop debugging mode, we must take special care to manage
@@ -1581,18 +1571,18 @@ static enum auto_boolean can_use_displaced_stepping = AUTO_BOOLEAN_AUTO;
static void
show_can_use_displaced_stepping (struct ui_file *file, int from_tty,
- struct cmd_list_element *c,
- const char *value)
+ struct cmd_list_element *c, const char *value)
{
if (can_use_displaced_stepping == AUTO_BOOLEAN_AUTO)
gdb_printf (file,
- _("Debugger's willingness to use displaced stepping "
- "to step over breakpoints is %s (currently %s).\n"),
+ _ ("Debugger's willingness to use displaced stepping "
+ "to step over breakpoints is %s (currently %s).\n"),
value, target_is_non_stop_p () ? "on" : "off");
else
gdb_printf (file,
- _("Debugger's willingness to use displaced stepping "
- "to step over breakpoints is %s.\n"), value);
+ _ ("Debugger's willingness to use displaced stepping "
+ "to step over breakpoints is %s.\n"),
+ value);
}
/* Return true if the gdbarch implements the required methods to use
@@ -1784,8 +1774,7 @@ displaced_step_prepare_throw (thread_info *tp)
static displaced_step_prepare_status
displaced_step_prepare (thread_info *thread)
{
- displaced_step_prepare_status status
- = DISPLACED_STEP_PREPARE_STATUS_CANT;
+ displaced_step_prepare_status status = DISPLACED_STEP_PREPARE_STATUS_CANT;
try
{
@@ -1793,19 +1782,17 @@ displaced_step_prepare (thread_info *thread)
}
catch (const gdb_exception_error &ex)
{
- if (ex.error != MEMORY_ERROR
- && ex.error != NOT_SUPPORTED_ERROR)
+ if (ex.error != MEMORY_ERROR && ex.error != NOT_SUPPORTED_ERROR)
throw;
- infrun_debug_printf ("caught exception, disabling displaced stepping: %s",
- ex.what ());
+ infrun_debug_printf (
+ "caught exception, disabling displaced stepping: %s", ex.what ());
/* Be verbose if "set displaced-stepping" is "on", silent if
"auto". */
if (can_use_displaced_stepping == AUTO_BOOLEAN_TRUE)
{
- warning (_("disabling displaced stepping: %s"),
- ex.what ());
+ warning (_ ("disabling displaced stepping: %s"), ex.what ());
}
/* Disable further displaced stepping attempts. */
@@ -1914,18 +1901,18 @@ start_step_over (void)
threads left in the THREADS_TO_STEP chain, put back these threads in the
global list. */
SCOPE_EXIT
- {
- if (threads_to_step.empty ())
- infrun_debug_printf ("step-over queue now empty");
- else
- {
- infrun_debug_printf ("putting back %d threads to step in global queue",
- thread_step_over_chain_length (threads_to_step));
+ {
+ if (threads_to_step.empty ())
+ infrun_debug_printf ("step-over queue now empty");
+ else
+ {
+ infrun_debug_printf ("putting back %d threads to step in global queue",
+ thread_step_over_chain_length (threads_to_step));
- global_thread_step_over_chain_enqueue_chain
- (std::move (threads_to_step));
- }
- };
+ global_thread_step_over_chain_enqueue_chain (
+ std::move (threads_to_step));
+ }
+ };
thread_step_over_list_safe_range range
= make_thread_step_over_list_safe_range (threads_to_step);
@@ -1977,15 +1964,12 @@ start_step_over (void)
continue;
}
- if (tp->control.trap_expected
- || tp->resumed ()
- || tp->executing ())
+ if (tp->control.trap_expected || tp->resumed () || tp->executing ())
{
internal_error ("[%s] has inconsistent state: "
"trap_expected=%d, resumed=%d, executing=%d\n",
tp->ptid.to_string ().c_str (),
- tp->control.trap_expected,
- tp->resumed (),
+ tp->control.trap_expected, tp->resumed (),
tp->executing ());
}
@@ -2006,11 +1990,11 @@ start_step_over (void)
keep_going_pass_signal (&ecs);
if (!ecs.wait_some_more)
- error (_("Command aborted."));
+ error (_ ("Command aborted."));
/* If the thread's step over could not be initiated because no buffers
were available, it was re-added to the global step over chain. */
- if (tp->resumed ())
+ if (tp->resumed ())
{
infrun_debug_printf ("[%s] was resumed.",
tp->ptid.to_string ().c_str ());
@@ -2057,35 +2041,29 @@ start_step_over (void)
/* Update global variables holding ptids to hold NEW_PTID if they were
holding OLD_PTID. */
static void
-infrun_thread_ptid_changed (process_stratum_target *target,
- ptid_t old_ptid, ptid_t new_ptid)
+infrun_thread_ptid_changed (process_stratum_target *target, ptid_t old_ptid,
+ ptid_t new_ptid)
{
if (inferior_ptid == old_ptid
&& current_inferior ()->process_target () == target)
inferior_ptid = new_ptid;
}
-
-
static const char schedlock_off[] = "off";
static const char schedlock_on[] = "on";
static const char schedlock_step[] = "step";
static const char schedlock_replay[] = "replay";
-static const char *const scheduler_enums[] = {
- schedlock_off,
- schedlock_on,
- schedlock_step,
- schedlock_replay,
- nullptr
-};
+static const char *const scheduler_enums[]
+ = { schedlock_off, schedlock_on, schedlock_step, schedlock_replay, nullptr };
static const char *scheduler_mode = schedlock_replay;
+
static void
show_scheduler_mode (struct ui_file *file, int from_tty,
struct cmd_list_element *c, const char *value)
{
gdb_printf (file,
- _("Mode for locking scheduler "
- "during execution is \"%s\".\n"),
+ _ ("Mode for locking scheduler "
+ "during execution is \"%s\".\n"),
value);
}
@@ -2095,7 +2073,7 @@ set_schedlock_func (const char *args, int from_tty, struct cmd_list_element *c)
if (!target_can_lock_scheduler ())
{
scheduler_mode = schedlock_off;
- error (_("Target '%s' cannot support this command."),
+ error (_ ("Target '%s' cannot support this command."),
target_shortname ());
}
}
@@ -2170,8 +2148,8 @@ process_stratum_target *
user_visible_resume_target (ptid_t resume_ptid)
{
return (resume_ptid == minus_one_ptid && sched_multi
- ? nullptr
- : current_inferior ()->process_target ());
+ ? nullptr
+ : current_inferior ()->process_target ());
}
/* Return a ptid representing the set of threads that we will resume,
@@ -2262,15 +2240,14 @@ do_target_resume (ptid_t resume_ptid, bool step, enum gdb_signal sig)
- when the thread is later resumed, the signal handler would
return to the scratch pad area, which would no longer be
valid. */
- if (step_over_info_valid_p ()
- || displaced_step_in_progress (tp->inf))
+ if (step_over_info_valid_p () || displaced_step_in_progress (tp->inf))
target_pass_signals ({});
else
target_pass_signals (signal_pass);
infrun_debug_printf ("resume_ptid=%s, step=%d, sig=%s",
- resume_ptid.to_string ().c_str (),
- step, gdb_signal_to_symbol_string (sig));
+ resume_ptid.to_string ().c_str (), step,
+ gdb_signal_to_symbol_string (sig));
target_resume (resume_ptid, step, sig);
}
@@ -2302,12 +2279,11 @@ resume_1 (enum gdb_signal sig)
if (tp->has_pending_waitstatus ())
{
- infrun_debug_printf
- ("thread %s has pending wait "
- "status %s (currently_stepping=%d).",
- tp->ptid.to_string ().c_str (),
- tp->pending_waitstatus ().to_string ().c_str (),
- currently_stepping (tp));
+ infrun_debug_printf ("thread %s has pending wait "
+ "status %s (currently_stepping=%d).",
+ tp->ptid.to_string ().c_str (),
+ tp->pending_waitstatus ().to_string ().c_str (),
+ currently_stepping (tp));
tp->inf->process_target ()->threads_executing = true;
tp->set_resumed (true);
@@ -2317,9 +2293,8 @@ resume_1 (enum gdb_signal sig)
pending signals to deliver. */
if (sig != GDB_SIGNAL_0)
{
- warning (_("Couldn't deliver signal %s to %s."),
- gdb_signal_to_name (sig),
- tp->ptid.to_string ().c_str ());
+ warning (_ ("Couldn't deliver signal %s to %s."),
+ gdb_signal_to_name (sig), tp->ptid.to_string ().c_str ());
}
tp->set_stop_signal (GDB_SIGNAL_0);
@@ -2454,10 +2429,8 @@ resume_1 (enum gdb_signal sig)
We can't use displaced stepping when we are waiting for vfork_done
event, displaced stepping breaks the vfork child similarly as single
step software breakpoint. */
- if (tp->control.trap_expected
- && use_displaced_stepping (tp)
- && !step_over_info_valid_p ()
- && sig == GDB_SIGNAL_0
+ if (tp->control.trap_expected && use_displaced_stepping (tp)
+ && !step_over_info_valid_p () && sig == GDB_SIGNAL_0
&& current_inferior ()->thread_waiting_for_vfork_done == nullptr)
{
displaced_step_prepare_status prepare_status
@@ -2475,10 +2448,11 @@ resume_1 (enum gdb_signal sig)
/* Fallback to stepping over the breakpoint in-line. */
if (target_is_non_stop_p ())
- stop_all_threads ("displaced stepping falling back on inline stepping");
+ stop_all_threads (
+ "displaced stepping falling back on inline stepping");
- set_step_over_info (regcache->aspace (),
- regcache_read_pc (regcache), 0, tp->global_num);
+ set_step_over_info (regcache->aspace (), regcache_read_pc (regcache),
+ 0, tp->global_num);
step = maybe_software_singlestep (gdbarch);
@@ -2525,8 +2499,7 @@ resume_1 (enum gdb_signal sig)
at the current address, deliver the signal without stepping, and
once we arrive back at the step-resume breakpoint, actually step
over the breakpoint we originally wanted to step over. */
- if (thread_has_single_step_breakpoints_set (tp)
- && sig != GDB_SIGNAL_0
+ if (thread_has_single_step_breakpoints_set (tp) && sig != GDB_SIGNAL_0
&& step_over_info_valid_p ())
{
/* If we have nested signals or a pending signal is delivered
@@ -2570,8 +2543,8 @@ resume_1 (enum gdb_signal sig)
else
resume_ptid = internal_resume_ptid (user_step);
- if (execution_direction != EXEC_REVERSE
- && step && breakpoint_inserted_here_p (aspace, pc))
+ if (execution_direction != EXEC_REVERSE && step
+ && breakpoint_inserted_here_p (aspace, pc))
{
/* There are two cases where we currently need to step a
breakpoint instruction when we have a signal to deliver:
@@ -2613,10 +2586,8 @@ resume_1 (enum gdb_signal sig)
step = false;
}
- if (debug_displaced
- && tp->control.trap_expected
- && use_displaced_stepping (tp)
- && !step_over_info_valid_p ())
+ if (debug_displaced && tp->control.trap_expected
+ && use_displaced_stepping (tp) && !step_over_info_valid_p ())
{
struct regcache *resume_regcache = get_thread_regcache (tp);
struct gdbarch *resume_gdbarch = resume_regcache->arch ();
@@ -2624,10 +2595,9 @@ resume_1 (enum gdb_signal sig)
gdb_byte buf[4];
read_memory (actual_pc, buf, sizeof (buf));
- displaced_debug_printf ("run %s: %s",
- paddress (resume_gdbarch, actual_pc),
- displaced_step_dump_bytes
- (buf, sizeof (buf)).c_str ());
+ displaced_debug_printf (
+ "run %s: %s", paddress (resume_gdbarch, actual_pc),
+ displaced_step_dump_bytes (buf, sizeof (buf)).c_str ());
}
if (tp->control.may_range_step)
@@ -2668,7 +2638,6 @@ resume (gdb_signal sig)
}
}
-
/* Proceeding. */
/* See infrun.h. */
@@ -2721,11 +2690,11 @@ clear_proceed_status_thread (struct thread_info *tp)
}
else
{
- infrun_debug_printf
- ("thread %s has pending wait status %s (currently_stepping=%d).",
- tp->ptid.to_string ().c_str (),
- tp->pending_waitstatus ().to_string ().c_str (),
- currently_stepping (tp));
+ infrun_debug_printf (
+ "thread %s has pending wait status %s (currently_stepping=%d).",
+ tp->ptid.to_string ().c_str (),
+ tp->pending_waitstatus ().to_string ().c_str (),
+ currently_stepping (tp));
}
}
@@ -2779,7 +2748,8 @@ clear_proceed_status (int step)
/* In all-stop mode, delete the per-thread status of all threads
we're about to resume, implicitly and explicitly. */
- for (thread_info *tp : all_non_exited_threads (resume_target, resume_ptid))
+ for (thread_info *tp :
+ all_non_exited_threads (resume_target, resume_ptid))
clear_proceed_status_thread (tp);
}
@@ -2812,8 +2782,7 @@ thread_still_needs_step_over_bp (struct thread_info *tp)
{
struct regcache *regcache = get_thread_regcache (tp);
- if (breakpoint_here_p (regcache->aspace (),
- regcache_read_pc (regcache))
+ if (breakpoint_here_p (regcache->aspace (), regcache_read_pc (regcache))
== ordinary_breakpoint_here)
return true;
@@ -2835,8 +2804,7 @@ thread_still_needs_step_over (struct thread_info *tp)
if (thread_still_needs_step_over_bp (tp))
what |= STEP_OVER_BREAKPOINT;
- if (tp->stepping_over_watchpoint
- && !target_have_steppable_watchpoint ())
+ if (tp->stepping_over_watchpoint && !target_have_steppable_watchpoint ())
what |= STEP_OVER_WATCHPOINT;
return what;
@@ -2849,8 +2817,7 @@ static bool
schedlock_applies (struct thread_info *tp)
{
return (scheduler_mode == schedlock_on
- || (scheduler_mode == schedlock_step
- && tp->control.stepping_command)
+ || (scheduler_mode == schedlock_step && tp->control.stepping_command)
|| (scheduler_mode == schedlock_replay
&& target_record_will_replay (minus_one_ptid,
execution_direction)));
@@ -2932,7 +2899,7 @@ maybe_call_commit_resumed_all_targets ()
switch_to_inferior_no_thread (inf);
infrun_debug_printf ("calling commit_resumed for target %s",
- proc_target->shortname());
+ proc_target->shortname ());
target_commit_resumed ();
}
@@ -2945,8 +2912,8 @@ static bool enable_commit_resumed = true;
/* See infrun.h. */
-scoped_disable_commit_resumed::scoped_disable_commit_resumed
- (const char *reason)
+scoped_disable_commit_resumed::scoped_disable_commit_resumed (
+ const char *reason)
: m_reason (reason),
m_prev_enable_commit_resumed (enable_commit_resumed)
{
@@ -3025,8 +2992,7 @@ scoped_disable_commit_resumed::reset_and_commit ()
/* See infrun.h. */
-scoped_enable_commit_resumed::scoped_enable_commit_resumed
- (const char *reason)
+scoped_enable_commit_resumed::scoped_enable_commit_resumed (const char *reason)
: m_reason (reason),
m_prev_enable_commit_resumed (enable_commit_resumed)
{
@@ -3097,7 +3063,7 @@ check_multi_target_resumption (process_stratum_target *resume_target)
continue;
process_stratum_target *proc_target
- = current_inferior ()->process_target();
+ = current_inferior ()->process_target ();
if (!target_is_non_stop_p ())
first_not_non_stop = inf;
@@ -3109,10 +3075,10 @@ check_multi_target_resumption (process_stratum_target *resume_target)
{
switch_to_inferior_no_thread (first_not_non_stop);
- proc_target = current_inferior ()->process_target();
+ proc_target = current_inferior ()->process_target ();
- error (_("Connection %d (%s) does not support "
- "multi-target resumption."),
+ error (_ ("Connection %d (%s) does not support "
+ "multi-target resumption."),
proc_target->connection_number,
make_target_connection_string (proc_target).c_str ());
}
@@ -3174,8 +3140,7 @@ proceed (CORE_ADDR addr, enum gdb_signal siggnal)
if (addr == (CORE_ADDR) -1)
{
- if (cur_thr->stop_pc_p ()
- && pc == cur_thr->stop_pc ()
+ if (cur_thr->stop_pc_p () && pc == cur_thr->stop_pc ()
&& breakpoint_here_p (aspace, pc) == ordinary_breakpoint_here
&& execution_direction != EXEC_REVERSE)
/* There is a breakpoint at the address we will resume at,
@@ -3246,8 +3211,8 @@ proceed (CORE_ADDR addr, enum gdb_signal siggnal)
threads. */
if (!non_stop && !schedlock_applies (cur_thr))
{
- for (thread_info *tp : all_non_exited_threads (resume_target,
- resume_ptid))
+ for (thread_info *tp :
+ all_non_exited_threads (resume_target, resume_ptid))
{
switch_to_thread_no_regs (tp);
@@ -3299,13 +3264,13 @@ proceed (CORE_ADDR addr, enum gdb_signal siggnal)
}
else if (!non_stop && target_is_non_stop_p ())
{
- INFRUN_SCOPED_DEBUG_START_END
- ("resuming threads, all-stop-on-top-of-non-stop");
+ INFRUN_SCOPED_DEBUG_START_END (
+ "resuming threads, all-stop-on-top-of-non-stop");
/* In all-stop, but the target is always in non-stop mode.
Start all other threads that are implicitly resumed too. */
- for (thread_info *tp : all_non_exited_threads (resume_target,
- resume_ptid))
+ for (thread_info *tp :
+ all_non_exited_threads (resume_target, resume_ptid))
{
switch_to_thread_no_regs (tp);
@@ -3351,7 +3316,7 @@ proceed (CORE_ADDR addr, enum gdb_signal siggnal)
switch_to_thread (tp);
keep_going_pass_signal (&ecs);
if (!ecs.wait_some_more)
- error (_("Command aborted."));
+ error (_ ("Command aborted."));
}
}
else if (!cur_thr->resumed ()
@@ -3367,7 +3332,7 @@ proceed (CORE_ADDR addr, enum gdb_signal siggnal)
switch_to_thread (cur_thr);
keep_going_pass_signal (&ecs);
if (!ecs.wait_some_more)
- error (_("Command aborted."));
+ error (_ ("Command aborted."));
}
disable_commit_resumed.reset_and_commit ();
@@ -3386,7 +3351,6 @@ proceed (CORE_ADDR addr, enum gdb_signal siggnal)
if (!target_can_async_p ())
mark_async_event_handler (infrun_async_inferior_event_token);
}
-
/* Start remote-debugging of a machine over a serial link. */
@@ -3436,14 +3400,13 @@ init_wait_for_inferior (void)
previous_inferior_ptid = inferior_ptid;
}
-
-
static void handle_inferior_event (struct execution_control_state *ecs);
static void handle_step_into_function (struct gdbarch *gdbarch,
struct execution_control_state *ecs);
-static void handle_step_into_function_backward (struct gdbarch *gdbarch,
- struct execution_control_state *ecs);
+static void
+handle_step_into_function_backward (struct gdbarch *gdbarch,
+ struct execution_control_state *ecs);
static void handle_signal_stop (struct execution_control_state *ecs);
static void check_exception_resume (struct execution_control_state *,
frame_info_ptr);
@@ -3452,7 +3415,8 @@ static void end_stepping_range (struct execution_control_state *ecs);
static void stop_waiting (struct execution_control_state *ecs);
static void keep_going (struct execution_control_state *ecs);
static void process_event_stop_test (struct execution_control_state *ecs);
-static bool switch_back_to_stepped_thread (struct execution_control_state *ecs);
+static bool
+switch_back_to_stepped_thread (struct execution_control_state *ecs);
/* This function is attached as a "thread_stop_requested" observer.
Cleanup local state that assumed the PTID was to be resumed, and
@@ -3532,8 +3496,8 @@ delete_thread_infrun_breakpoints (struct thread_info *tp)
just stopped. In all-stop, that's all the non-exited threads; in
non-stop, that's the current thread, only. */
-typedef void (*for_each_just_stopped_thread_callback_func)
- (struct thread_info *tp);
+typedef void (*for_each_just_stopped_thread_callback_func) (
+ struct thread_info *tp);
static void
for_each_just_stopped_thread (for_each_just_stopped_thread_callback_func func)
@@ -3581,8 +3545,7 @@ print_target_wait_results (ptid_t waiton_ptid, ptid_t result_ptid,
infrun_debug_printf ("target_wait (%s [%s], status) =",
waiton_ptid.to_string ().c_str (),
target_pid_to_str (waiton_ptid).c_str ());
- infrun_debug_printf (" %s [%s],",
- result_ptid.to_string ().c_str (),
+ infrun_debug_printf (" %s [%s],", result_ptid.to_string ().c_str (),
target_pid_to_str (result_ptid).c_str ());
infrun_debug_printf (" %s", ws.to_string ().c_str ());
}
@@ -3616,8 +3579,8 @@ random_pending_event_thread (inferior *inf, ptid_t waiton_ptid)
on. */
static ptid_t
-do_target_wait_1 (inferior *inf, ptid_t ptid,
- target_waitstatus *status, target_wait_flags options)
+do_target_wait_1 (inferior *inf, ptid_t ptid, target_waitstatus *status,
+ target_wait_flags options)
{
struct thread_info *tp;
@@ -3751,10 +3714,8 @@ do_target_wait (execution_control_state *ecs, target_wait_flags options)
polling the rest of the inferior list starting from that one in a
circular fashion until the whole list is polled once. */
- auto inferior_matches = [] (inferior *inf)
- {
- return inf->process_target () != nullptr;
- };
+ auto inferior_matches
+ = [] (inferior *inf) { return inf->process_target () != nullptr; };
/* First see how many matching inferiors we have. */
for (inferior *inf : all_inferiors ())
@@ -3768,12 +3729,12 @@ do_target_wait (execution_control_state *ecs, target_wait_flags options)
}
/* Now randomly pick an inferior out of those that matched. */
- random_selector = (int)
- ((num_inferiors * (double) rand ()) / (RAND_MAX + 1.0));
+ random_selector
+ = (int) ((num_inferiors * (double) rand ()) / (RAND_MAX + 1.0));
if (num_inferiors > 1)
- infrun_debug_printf ("Found %d inferiors, starting at #%d",
- num_inferiors, random_selector);
+ infrun_debug_printf ("Found %d inferiors, starting at #%d", num_inferiors,
+ random_selector);
/* Select the Nth inferior that matched. */
@@ -3790,8 +3751,7 @@ do_target_wait (execution_control_state *ecs, target_wait_flags options)
/* Now poll for events out of each of the matching inferior's
targets, starting from the selected one. */
- auto do_wait = [&] (inferior *inf)
- {
+ auto do_wait = [&] (inferior *inf) {
ecs->ptid = do_target_wait_1 (inf, minus_one_ptid, &ecs->ws, options);
ecs->target = inf->process_target ();
return (ecs->ws.kind () != TARGET_WAITKIND_IGNORE);
@@ -3806,8 +3766,7 @@ do_target_wait (execution_control_state *ecs, target_wait_flags options)
= inferior_list.iterator_to (*selected);
for (intrusive_list_iterator<inferior> it = start;
- it != inferior_list.end ();
- ++it)
+ it != inferior_list.end (); ++it)
{
inferior *inf = &*it;
@@ -3816,8 +3775,7 @@ do_target_wait (execution_control_state *ecs, target_wait_flags options)
}
for (intrusive_list_iterator<inferior> it = inferior_list.begin ();
- it != start;
- ++it)
+ it != start; ++it)
{
inferior *inf = &*it;
@@ -3857,7 +3815,8 @@ prepare_for_detach (void)
ptid_t pid_ptid = ptid_t (inf->pid);
scoped_restore_current_thread restore_thread;
- scoped_restore restore_detaching = make_scoped_restore (&inf->detaching, true);
+ scoped_restore restore_detaching
+ = make_scoped_restore (&inf->detaching, true);
/* Remove all threads of INF from the global step-over chain. We
want to stop any ongoing step-over, not start any new one. */
@@ -3964,13 +3923,16 @@ wait_for_inferior (inferior *inf)
{
infrun_debug_printf ("wait_for_inferior ()");
- SCOPE_EXIT { delete_just_stopped_threads_infrun_breakpoints (); };
+ SCOPE_EXIT
+ {
+ delete_just_stopped_threads_infrun_breakpoints ();
+ };
/* If an error happens while handling the event, propagate GDB's
knowledge of the executing state to the frontend/user running
state. */
- scoped_finish_thread_state finish_state
- (inf->process_target (), minus_one_ptid);
+ scoped_finish_thread_state finish_state (inf->process_target (),
+ minus_one_ptid);
while (1)
{
@@ -4072,8 +4034,7 @@ check_curr_ui_sync_execution_done (void)
{
struct ui *ui = current_ui;
- if (ui->prompt_state == PROMPT_NEEDED
- && ui->async
+ if (ui->prompt_state == PROMPT_NEEDED && ui->async
&& !gdb_in_secondary_prompt_p (ui))
{
target_terminal::ours ();
@@ -4088,9 +4049,9 @@ void
all_uis_check_sync_execution_done (void)
{
SWITCH_THRU_ALL_UIS ()
- {
- check_curr_ui_sync_execution_done ();
- }
+ {
+ check_curr_ui_sync_execution_done ();
+ }
}
/* See infrun.h. */
@@ -4099,10 +4060,10 @@ void
all_uis_on_sync_execution_starting (void)
{
SWITCH_THRU_ALL_UIS ()
- {
- if (current_ui->prompt_state == PROMPT_NEEDED)
- async_disable_stdin ();
- }
+ {
+ if (current_ui->prompt_state == PROMPT_NEEDED)
+ async_disable_stdin ();
+ }
}
/* Asynchronous version of wait_for_inferior. It is called by the
@@ -4135,7 +4096,10 @@ fetch_inferior_event ()
/* End up with readline processing input, if necessary. */
{
- SCOPE_EXIT { reinstall_readline_callback_handler_cleanup (); };
+ SCOPE_EXIT
+ {
+ reinstall_readline_callback_handler_cleanup ();
+ };
/* We're handling a live event, so make sure we're doing live
debugging. If we're looking at traceframes while the target is
@@ -4193,8 +4157,7 @@ fetch_inferior_event ()
/* Get executed before scoped_restore_current_thread above to apply
still for the thread which has thrown the exception. */
- auto defer_bpstat_clear
- = make_scope_exit (bpstat_clear_actions);
+ auto defer_bpstat_clear = make_scope_exit (bpstat_clear_actions);
auto defer_delete_threads
= make_scope_exit (delete_just_stopped_threads_infrun_breakpoints);
@@ -4226,13 +4189,13 @@ fetch_inferior_event ()
clean_up_just_stopped_threads_fsms (&ecs);
if (thr != nullptr && thr->thread_fsm () != nullptr)
- should_notify_stop
- = thr->thread_fsm ()->should_notify_stop ();
+ should_notify_stop = thr->thread_fsm ()->should_notify_stop ();
if (should_notify_stop)
{
/* We may not find an inferior if this was a process exit. */
- if (inf == nullptr || inf->control.stop_soon == NO_STOP_QUIETLY)
+ if (inf == nullptr
+ || inf->control.stop_soon == NO_STOP_QUIETLY)
proceeded = normal_stop ();
}
@@ -4250,8 +4213,7 @@ fetch_inferior_event ()
this, "info threads" says "The current thread <Thread
ID 2> has terminated." instead of "No thread
selected.". */
- if (!non_stop
- && cmd_done
+ if (!non_stop && cmd_done
&& ecs.ws.kind () != TARGET_WAITKIND_NO_RESUMED)
restore_thread.dont_restore ();
}
@@ -4286,11 +4248,10 @@ fetch_inferior_event ()
ready for input). */
all_uis_check_sync_execution_done ();
- if (cmd_done
- && exec_done_display_p
+ if (cmd_done && exec_done_display_p
&& (inferior_ptid == null_ptid
|| inferior_thread ()->state != THREAD_RUNNING))
- gdb_printf (_("completed.\n"));
+ gdb_printf (_ ("completed.\n"));
}
/* See infrun.h. */
@@ -4309,12 +4270,11 @@ set_step_info (thread_info *tp, frame_info_ptr frame,
tp->current_symtab = sal.symtab;
tp->current_line = sal.line;
- infrun_debug_printf
- ("symtab = %s, line = %d, step_frame_id = %s, step_stack_frame_id = %s",
- tp->current_symtab != nullptr ? tp->current_symtab->filename : "<null>",
- tp->current_line,
- tp->control.step_frame_id.to_string ().c_str (),
- tp->control.step_stack_frame_id.to_string ().c_str ());
+ infrun_debug_printf (
+ "symtab = %s, line = %d, step_frame_id = %s, step_stack_frame_id = %s",
+ tp->current_symtab != nullptr ? tp->current_symtab->filename : "<null>",
+ tp->current_line, tp->control.step_frame_id.to_string ().c_str (),
+ tp->control.step_stack_frame_id.to_string ().c_str ());
}
/* Clear context switchable stepping state. */
@@ -4386,8 +4346,7 @@ context_switch (execution_control_state *ecs)
adjust the PC, per gdbarch_decr_pc_after_break. */
static void
-adjust_pc_after_break (struct thread_info *thread,
- const target_waitstatus &ws)
+adjust_pc_after_break (struct thread_info *thread, const target_waitstatus &ws)
{
struct regcache *regcache;
struct gdbarch *gdbarch;
@@ -4499,8 +4458,8 @@ adjust_pc_after_break (struct thread_info *thread,
gdb::optional<scoped_restore_tmpl<int>> restore_operation_disable;
if (record_full_is_used ())
- restore_operation_disable.emplace
- (record_full_gdb_operation_disable_set ());
+ restore_operation_disable.emplace (
+ record_full_gdb_operation_disable_set ());
/* When using hardware single-step, a SIGTRAP is reported for both
a completed single-step and a software breakpoint. Need to
@@ -4521,8 +4480,7 @@ adjust_pc_after_break (struct thread_info *thread,
if (thread_has_single_step_breakpoints_set (thread)
|| !currently_stepping (thread)
- || (thread->stepped_breakpoint
- && thread->prev_pc == breakpoint_pc))
+ || (thread->stepped_breakpoint && thread->prev_pc == breakpoint_pc))
regcache_write_pc (regcache, breakpoint_pc);
}
}
@@ -4530,8 +4488,7 @@ adjust_pc_after_break (struct thread_info *thread,
static bool
stepped_in_from (frame_info_ptr frame, struct frame_id step_frame_id)
{
- for (frame = get_prev_frame (frame);
- frame != nullptr;
+ for (frame = get_prev_frame (frame); frame != nullptr;
frame = get_prev_frame (frame))
{
if (get_frame_id (frame) == step_frame_id)
@@ -4575,8 +4532,7 @@ inline_frame_is_marked_for_skip (bool prev_frame, struct thread_info *tp)
if (sym != nullptr)
fn = sym->print_name ();
- if (sal.line != 0
- && function_name_is_marked_for_skip (fn, sal))
+ if (sal.line != 0 && function_name_is_marked_for_skip (fn, sal))
return true;
}
@@ -4616,8 +4572,7 @@ handle_syscall_event (struct execution_control_state *ecs)
syscall_number = ecs->ws.syscall_number ();
ecs->event_thread->set_stop_pc (regcache_read_pc (regcache));
- if (catch_syscall_enabled () > 0
- && catching_syscall_number (syscall_number))
+ if (catch_syscall_enabled () > 0 && catching_syscall_number (syscall_number))
{
infrun_debug_printf ("syscall number=%d", syscall_number);
@@ -4658,10 +4613,8 @@ fill_in_stop_func (struct gdbarch *gdbarch,
/* Don't care about return value; stop_func_start and stop_func_name
will both be 0 if it doesn't work. */
- find_pc_partial_function_sym (ecs->event_thread->stop_pc (),
- &gsi,
- &ecs->stop_func_start,
- &ecs->stop_func_end,
+ find_pc_partial_function_sym (ecs->event_thread->stop_pc (), &gsi,
+ &ecs->stop_func_start, &ecs->stop_func_end,
&block);
ecs->stop_func_name = gsi == nullptr ? nullptr : gsi->print_name ();
@@ -4673,8 +4626,7 @@ fill_in_stop_func (struct gdbarch *gdbarch,
the function's start offset and entrypoint. Note that
stop_func_start is NOT advanced when in a range of a
non-contiguous block that does not contain the entry pc. */
- if (block != nullptr
- && ecs->stop_func_start <= block->entry_pc ()
+ if (block != nullptr && ecs->stop_func_start <= block->entry_pc ()
&& block->entry_pc () < ecs->stop_func_end)
{
ecs->stop_func_start
@@ -4689,7 +4641,6 @@ fill_in_stop_func (struct gdbarch *gdbarch,
}
}
-
/* Return the STOP_SOON field of the inferior pointed at by ECS. */
static enum stop_kind
@@ -4735,8 +4686,7 @@ wait_one ()
for (inferior *inf : all_inferiors ())
{
process_stratum_target *target = inf->process_target ();
- if (target == nullptr
- || !target->is_async_p ()
+ if (target == nullptr || !target->is_async_p ()
|| !target->threads_executing)
continue;
@@ -4766,8 +4716,7 @@ wait_one ()
for (inferior *inf : all_inferiors ())
{
process_stratum_target *target = inf->process_target ();
- if (target == nullptr
- || !target->is_async_p ()
+ if (target == nullptr || !target->is_async_p ()
|| !target->threads_executing)
continue;
@@ -4782,7 +4731,7 @@ wait_one ()
/* No waitable targets left. All must be stopped. */
target_waitstatus ws;
ws.set_no_resumed ();
- return {nullptr, minus_one_ptid, std::move (ws)};
+ return { nullptr, minus_one_ptid, std::move (ws) };
}
QUIT;
@@ -4803,15 +4752,13 @@ wait_one ()
static void
save_waitstatus (struct thread_info *tp, const target_waitstatus &ws)
{
- infrun_debug_printf ("saving status %s for %s",
- ws.to_string ().c_str (),
+ infrun_debug_printf ("saving status %s for %s", ws.to_string ().c_str (),
tp->ptid.to_string ().c_str ());
/* Record for later. */
tp->set_pending_waitstatus (ws);
- if (ws.kind () == TARGET_WAITKIND_STOPPED
- && ws.sig () == GDB_SIGNAL_TRAP)
+ if (ws.kind () == TARGET_WAITKIND_STOPPED && ws.sig () == GDB_SIGNAL_TRAP)
{
struct regcache *regcache = get_thread_regcache (tp);
const address_space *aspace = regcache->aspace ();
@@ -4847,8 +4794,7 @@ save_waitstatus (struct thread_info *tp, const target_waitstatus &ws)
reported. In non-stop mode, only the event thread stops. */
static void
-mark_non_executing_threads (process_stratum_target *target,
- ptid_t event_ptid,
+mark_non_executing_threads (process_stratum_target *target, ptid_t event_ptid,
const target_waitstatus &ws)
{
ptid_t mark_ptid;
@@ -4894,9 +4840,8 @@ mark_non_executing_threads (process_stratum_target *target,
static bool
handle_one (const wait_one_event &event)
{
- infrun_debug_printf
- ("%s %s", event.ws.to_string ().c_str (),
- event.ptid.to_string ().c_str ());
+ infrun_debug_printf ("%s %s", event.ws.to_string ().c_str (),
+ event.ptid.to_string ().c_str ());
if (event.ws.kind () == TARGET_WAITKIND_NO_RESUMED)
{
@@ -4915,7 +4860,7 @@ handle_one (const wait_one_event &event)
the first non-exited thread. */
if (event.ptid.is_pid ())
{
- int pid = event.ptid.pid ();
+ int pid = event.ptid.pid ();
inferior *inf = find_inferior_pid (event.target, pid);
for (thread_info *tp : inf->non_exited_threads ())
{
@@ -4931,8 +4876,7 @@ handle_one (const wait_one_event &event)
of going into an infinite loop. */
gdb_assert (t != nullptr);
- infrun_debug_printf
- ("using %s", t->ptid.to_string ().c_str ());
+ infrun_debug_printf ("using %s", t->ptid.to_string ().c_str ());
}
else
{
@@ -4949,8 +4893,7 @@ handle_one (const wait_one_event &event)
/* Set the threads as non-executing to avoid
another stop attempt on them. */
switch_to_thread_no_regs (t);
- mark_non_executing_threads (event.target, event.ptid,
- event.ws);
+ mark_non_executing_threads (event.target, event.ptid, event.ws);
save_waitstatus (t, event.ws);
t->stop_requested = false;
}
@@ -4984,9 +4927,8 @@ handle_one (const wait_one_event &event)
== DISPLACED_STEP_FINISH_STATUS_NOT_EXECUTED)
{
/* Add it back to the step-over queue. */
- infrun_debug_printf
- ("displaced-step of %s canceled",
- t->ptid.to_string ().c_str ());
+ infrun_debug_printf ("displaced-step of %s canceled",
+ t->ptid.to_string ().c_str ());
t->control.trap_expected = 0;
if (!t->inf->detaching)
@@ -4998,16 +4940,15 @@ handle_one (const wait_one_event &event)
enum gdb_signal sig;
struct regcache *regcache;
- infrun_debug_printf
- ("target_wait %s, saving status for %s",
- event.ws.to_string ().c_str (),
- t->ptid.to_string ().c_str ());
+ infrun_debug_printf ("target_wait %s, saving status for %s",
+ event.ws.to_string ().c_str (),
+ t->ptid.to_string ().c_str ());
/* Record for later. */
save_waitstatus (t, event.ws);
- sig = (event.ws.kind () == TARGET_WAITKIND_STOPPED
- ? event.ws.sig () : GDB_SIGNAL_0);
+ sig = (event.ws.kind () == TARGET_WAITKIND_STOPPED ? event.ws.sig ()
+ : GDB_SIGNAL_0);
if (displaced_step_finish (t, sig)
== DISPLACED_STEP_FINISH_STATUS_NOT_EXECUTED)
@@ -5046,8 +4987,7 @@ stop_all_threads (const char *reason, inferior *inf)
INFRUN_SCOPED_DEBUG_START_END ("reason=%s, inf=%d", reason,
inf != nullptr ? inf->num : -1);
- infrun_debug_show_threads ("non-exited threads",
- all_non_exited_threads ());
+ infrun_debug_show_threads ("non-exited threads", all_non_exited_threads ());
scoped_restore_current_thread restore_thread;
@@ -5062,22 +5002,22 @@ stop_all_threads (const char *reason, inferior *inf)
}
SCOPE_EXIT
- {
- /* Disable thread events on relevant targets. */
- for (auto *target : all_non_exited_process_targets ())
- {
- if (inf != nullptr && inf->process_target () != target)
- continue;
+ {
+ /* Disable thread events on relevant targets. */
+ for (auto *target : all_non_exited_process_targets ())
+ {
+ if (inf != nullptr && inf->process_target () != target)
+ continue;
- switch_to_target_no_thread (target);
- target_thread_events (false);
- }
+ switch_to_target_no_thread (target);
+ target_thread_events (false);
+ }
- /* Use debug_prefixed_printf directly to get a meaningful function
+ /* Use debug_prefixed_printf directly to get a meaningful function
name. */
- if (debug_infrun)
- debug_prefixed_printf ("infrun", "stop_all_threads", "done");
- };
+ if (debug_infrun)
+ debug_prefixed_printf ("infrun", "stop_all_threads", "done");
+ };
/* Request threads to stop, and then wait for the stops. Because
threads we already know about can spawn more threads while we're
@@ -5340,8 +5280,7 @@ handle_inferior_event (struct execution_control_state *ecs)
return;
}
- if (ecs->ws.kind () == TARGET_WAITKIND_NO_RESUMED
- && handle_no_resumed (ecs))
+ if (ecs->ws.kind () == TARGET_WAITKIND_NO_RESUMED && handle_no_resumed (ecs))
return;
/* Cache the last target/ptid/waitstatus. */
@@ -5391,8 +5330,7 @@ handle_inferior_event (struct execution_control_state *ecs)
for architectures like SPARC that place call dummies on the
stack. */
if (ecs->ws.kind () == TARGET_WAITKIND_STOPPED
- && (ecs->ws.sig () == GDB_SIGNAL_ILL
- || ecs->ws.sig () == GDB_SIGNAL_SEGV
+ && (ecs->ws.sig () == GDB_SIGNAL_ILL || ecs->ws.sig () == GDB_SIGNAL_SEGV
|| ecs->ws.sig () == GDB_SIGNAL_EMT))
{
struct regcache *regcache = get_thread_regcache (ecs->event_thread);
@@ -5484,7 +5422,7 @@ handle_inferior_event (struct execution_control_state *ecs)
return;
}
- internal_error (_("unhandled stop_soon: %d"), (int) stop_soon);
+ internal_error (_ ("unhandled stop_soon: %d"), (int) stop_soon);
}
case TARGET_WAITKIND_SPURIOUS:
@@ -5521,7 +5459,7 @@ handle_inferior_event (struct execution_control_state *ecs)
}
}
handle_vfork_child_exec_or_exit (0);
- target_terminal::ours (); /* Must do this before mourn anyway. */
+ target_terminal::ours (); /* Must do this before mourn anyway. */
/* Clearing any previous state of convenience variables. */
clear_exit_convenience_vars ();
@@ -5550,9 +5488,9 @@ handle_inferior_event (struct execution_control_state *ecs)
{
/* Set the value of the internal variable $_exitsignal,
which holds the signal uncaught by the inferior. */
- set_internalvar_integer (lookup_internalvar ("_exitsignal"),
- gdbarch_gdb_signal_to_target (gdbarch,
- ecs->ws.sig ()));
+ set_internalvar_integer (
+ lookup_internalvar ("_exitsignal"),
+ gdbarch_gdb_signal_to_target (gdbarch, ecs->ws.sig ()));
}
else
{
@@ -5596,8 +5534,8 @@ handle_inferior_event (struct execution_control_state *ecs)
which support displaced stepping but not forks. */
if (ecs->ws.kind () == TARGET_WAITKIND_FORKED
&& gdbarch_supports_displaced_stepping (gdbarch))
- gdbarch_displaced_step_restore_all_in_ptid
- (gdbarch, parent_inf, ecs->ws.child_ptid ());
+ gdbarch_displaced_step_restore_all_in_ptid (gdbarch, parent_inf,
+ ecs->ws.child_ptid ());
/* If displaced stepping is supported, and thread ecs->ptid is
displaced stepping. */
@@ -5626,15 +5564,14 @@ handle_inferior_event (struct execution_control_state *ecs)
child_regcache
= get_thread_arch_aspace_regcache (parent_inf->process_target (),
ecs->ws.child_ptid (),
- gdbarch,
- parent_inf->aspace);
+ gdbarch, parent_inf->aspace);
/* Read PC value of parent process. */
parent_pc = regcache_read_pc (regcache);
- displaced_debug_printf ("write child pc from %s to %s",
- paddress (gdbarch,
- regcache_read_pc (child_regcache)),
- paddress (gdbarch, parent_pc));
+ displaced_debug_printf (
+ "write child pc from %s to %s",
+ paddress (gdbarch, regcache_read_pc (child_regcache)),
+ paddress (gdbarch, parent_pc));
regcache_write_pc (child_regcache, parent_pc);
}
@@ -5668,8 +5605,8 @@ handle_inferior_event (struct execution_control_state *ecs)
and not immediately. */
ecs->event_thread->pending_follow = ecs->ws;
- ecs->event_thread->set_stop_pc
- (regcache_read_pc (get_thread_regcache (ecs->event_thread)));
+ ecs->event_thread->set_stop_pc (
+ regcache_read_pc (get_thread_regcache (ecs->event_thread)));
ecs->event_thread->control.stop_bpstat
= bpstat_stop_status_nowatch (get_current_regcache ()->aspace (),
@@ -5712,8 +5649,8 @@ handle_inferior_event (struct execution_control_state *ecs)
child->set_running (true);
/* In non-stop mode, also resume the other branch. */
- if (!detach_fork && (non_stop
- || (sched_multi && target_is_non_stop_p ())))
+ if (!detach_fork
+ && (non_stop || (sched_multi && target_is_non_stop_p ())))
{
if (follow_child)
switch_to_thread (parent);
@@ -5740,8 +5677,7 @@ handle_inferior_event (struct execution_control_state *ecs)
exit). We will resume only the vforking thread for the purpose
of collecting the vfork-done event, and we will restart any
step once the critical shared address space window is done. */
- if ((!follow_child
- && detach_fork
+ if ((!follow_child && detach_fork
&& parent->inf->thread_waiting_for_vfork_done != nullptr)
|| !switch_back_to_stepped_thread (ecs))
keep_going (ecs);
@@ -5794,8 +5730,8 @@ handle_inferior_event (struct execution_control_state *ecs)
execd thread for that case (this is a nop otherwise). */
ecs->event_thread = inferior_thread ();
- ecs->event_thread->set_stop_pc
- (regcache_read_pc (get_thread_regcache (ecs->event_thread)));
+ ecs->event_thread->set_stop_pc (
+ regcache_read_pc (get_thread_regcache (ecs->event_thread)));
ecs->event_thread->control.stop_bpstat
= bpstat_stop_status_nowatch (get_current_regcache ()->aspace (),
@@ -5845,8 +5781,8 @@ handle_inferior_event (struct execution_control_state *ecs)
infrun_debug_printf ("stopped");
delete_just_stopped_threads_single_step_breakpoints ();
- ecs->event_thread->set_stop_pc
- (regcache_read_pc (get_thread_regcache (inferior_thread ())));
+ ecs->event_thread->set_stop_pc (
+ regcache_read_pc (get_thread_regcache (inferior_thread ())));
if (handle_stop_requested (ecs))
return;
@@ -5906,7 +5842,7 @@ restart_threads (struct thread_info *event_thread, inferior *inf)
if (tp->resumed ())
{
infrun_debug_printf ("restart threads: [%s] resumed",
- tp->ptid.to_string ().c_str ());
+ tp->ptid.to_string ().c_str ());
gdb_assert (tp->executing () || tp->has_pending_waitstatus ());
continue;
}
@@ -5919,7 +5855,6 @@ restart_threads (struct thread_info *event_thread, inferior *inf)
continue;
}
-
if (tp->has_pending_waitstatus ())
{
infrun_debug_printf ("restart threads: [%s] has pending status",
@@ -5961,8 +5896,7 @@ restart_threads (struct thread_info *event_thread, inferior *inf)
a pending waitstatus. */
static int
-resumed_thread_with_pending_status (struct thread_info *tp,
- void *arg)
+resumed_thread_with_pending_status (struct thread_info *tp, void *arg)
{
return tp->resumed () && tp->has_pending_waitstatus ();
}
@@ -6031,8 +5965,8 @@ finish_step_over (struct execution_control_state *ecs)
if (ecs->event_thread->stepping_over_watchpoint)
return 0;
- pending = iterate_over_threads (resumed_thread_with_pending_status,
- nullptr);
+ pending
+ = iterate_over_threads (resumed_thread_with_pending_status, nullptr);
if (pending != nullptr)
{
struct thread_info *tp = ecs->event_thread;
@@ -6105,8 +6039,8 @@ handle_signal_stop (struct execution_control_state *ecs)
&& ecs->event_thread->stop_signal () == GDB_SIGNAL_TRAP)
ecs->event_thread->set_stop_signal (GDB_SIGNAL_0);
- ecs->event_thread->set_stop_pc
- (regcache_read_pc (get_thread_regcache (ecs->event_thread)));
+ ecs->event_thread->set_stop_pc (
+ regcache_read_pc (get_thread_regcache (ecs->event_thread)));
context_switch (ecs);
@@ -6118,8 +6052,9 @@ handle_signal_stop (struct execution_control_state *ecs)
struct regcache *regcache = get_thread_regcache (ecs->event_thread);
struct gdbarch *reg_gdbarch = regcache->arch ();
- infrun_debug_printf
- ("stop_pc=%s", paddress (reg_gdbarch, ecs->event_thread->stop_pc ()));
+ infrun_debug_printf ("stop_pc=%s",
+ paddress (reg_gdbarch,
+ ecs->event_thread->stop_pc ()));
if (target_stopped_by_watchpoint ())
{
CORE_ADDR addr;
@@ -6195,8 +6130,8 @@ handle_signal_stop (struct execution_control_state *ecs)
/* However, before doing so, if this single-step breakpoint was
actually for another thread, set this thread up for moving
past it. */
- if (!thread_has_single_step_breakpoint_here (ecs->event_thread,
- aspace, pc))
+ if (!thread_has_single_step_breakpoint_here (ecs->event_thread, aspace,
+ pc))
{
if (single_step_breakpoint_inserted_here_p (aspace, pc))
{
@@ -6290,8 +6225,7 @@ handle_signal_stop (struct execution_control_state *ecs)
user had set a breakpoint on that inlined code, the missing
skip_inline_frames call would break things. Fortunately
that's an extremely unlikely scenario. */
- if (!pc_at_non_inline_function (aspace,
- ecs->event_thread->stop_pc (),
+ if (!pc_at_non_inline_function (aspace, ecs->event_thread->stop_pc (),
ecs->ws)
&& !(ecs->event_thread->stop_signal () == GDB_SIGNAL_TRAP
&& ecs->event_thread->control.trap_expected
@@ -6299,9 +6233,9 @@ handle_signal_stop (struct execution_control_state *ecs)
ecs->event_thread->prev_pc,
ecs->ws)))
{
- stop_chain = build_bpstat_chain (aspace,
- ecs->event_thread->stop_pc (),
- ecs->ws);
+ stop_chain
+ = build_bpstat_chain (aspace, ecs->event_thread->stop_pc (),
+ ecs->ws);
skip_inline_frames (ecs->event_thread, stop_chain);
/* Re-fetch current thread's frame in case that invalidated
@@ -6327,14 +6261,13 @@ handle_signal_stop (struct execution_control_state *ecs)
if (step_through_delay)
infrun_debug_printf ("step through delay");
- if (ecs->event_thread->control.step_range_end == 0
- && step_through_delay)
+ if (ecs->event_thread->control.step_range_end == 0 && step_through_delay)
{
/* The user issued a continue when stopped at a breakpoint.
Set up for another trap and get out of here. */
- ecs->event_thread->stepping_over_breakpoint = 1;
- keep_going (ecs);
- return;
+ ecs->event_thread->stepping_over_breakpoint = 1;
+ keep_going (ecs);
+ return;
}
else if (step_through_delay)
{
@@ -6352,8 +6285,8 @@ handle_signal_stop (struct execution_control_state *ecs)
handles this event. */
ecs->event_thread->control.stop_bpstat
= bpstat_stop_status (get_current_regcache ()->aspace (),
- ecs->event_thread->stop_pc (),
- ecs->event_thread, ecs->ws, stop_chain);
+ ecs->event_thread->stop_pc (), ecs->event_thread,
+ ecs->ws, stop_chain);
/* Following in case break condition called a
function. */
@@ -6421,8 +6354,8 @@ handle_signal_stop (struct execution_control_state *ecs)
restore_operation_disable;
if (record_full_is_used ())
- restore_operation_disable.emplace
- (record_full_gdb_operation_disable_set ());
+ restore_operation_disable.emplace (
+ record_full_gdb_operation_disable_set ());
regcache_write_pc (regcache,
ecs->event_thread->stop_pc () + decr_pc);
@@ -6485,8 +6418,7 @@ handle_signal_stop (struct execution_control_state *ecs)
/* Always stop on signals if we're either just gaining control
of the program, or the user explicitly requested this thread
to remain stopped. */
- if (stop_soon != NO_STOP_QUIETLY
- || ecs->event_thread->stop_requested
+ if (stop_soon != NO_STOP_QUIETLY || ecs->event_thread->stop_requested
|| signal_stop_state (ecs->event_thread->stop_signal ()))
{
stop_waiting (ecs);
@@ -6500,7 +6432,8 @@ handle_signal_stop (struct execution_control_state *ecs)
{
/* The signal table tells us to print about this signal. */
target_terminal::ours_for_output ();
- gdb::observers::signal_received.notify (ecs->event_thread->stop_signal ());
+ gdb::observers::signal_received.notify (
+ ecs->event_thread->stop_signal ());
target_terminal::inferior ();
}
@@ -6522,7 +6455,8 @@ handle_signal_stop (struct execution_control_state *ecs)
code paths as single-step - set a breakpoint at the
signal return address and then, once hit, step off that
breakpoint. */
- infrun_debug_printf ("signal arrived while stepping over breakpoint");
+ infrun_debug_printf (
+ "signal arrived while stepping over breakpoint");
insert_hp_step_resume_breakpoint_at_frame (frame);
ecs->event_thread->step_after_step_resume_breakpoint = 1;
@@ -6645,8 +6579,8 @@ process_event_stop_test (struct execution_control_state *ecs)
jmp_buf_pc = gdbarch_addr_bits_remove (gdbarch, jmp_buf_pc);
}
else if (!gdbarch_get_longjmp_target_p (gdbarch)
- || !gdbarch_get_longjmp_target (gdbarch,
- frame, &jmp_buf_pc))
+ || !gdbarch_get_longjmp_target (gdbarch, frame,
+ &jmp_buf_pc))
{
infrun_debug_printf ("BPSTAT_WHAT_SET_LONGJMP_RESUME "
"(!gdbarch_get_longjmp_target)");
@@ -6706,8 +6640,7 @@ process_event_stop_test (struct execution_control_state *ecs)
if (init_frame)
{
- struct frame_id current_id
- = get_frame_id (get_current_frame ());
+ struct frame_id current_id = get_frame_id (get_current_frame ());
if (current_id == ecs->event_thread->initiating_frame)
{
/* Case 2. Fall through. */
@@ -6821,12 +6754,12 @@ process_event_stop_test (struct execution_control_state *ecs)
struct breakpoint *sr_bp
= ecs->event_thread->control.step_resume_breakpoint;
- if (sr_bp != nullptr
- && sr_bp->loc->permanent
+ if (sr_bp != nullptr && sr_bp->loc->permanent
&& sr_bp->type == bp_hp_step_resume
&& sr_bp->loc->address == ecs->event_thread->prev_pc)
{
- infrun_debug_printf ("stepped permanent breakpoint, stopped in handler");
+ infrun_debug_printf (
+ "stepped permanent breakpoint, stopped in handler");
delete_step_resume_breakpoint (ecs->event_thread);
ecs->event_thread->step_after_step_resume_breakpoint = 0;
}
@@ -6883,10 +6816,10 @@ process_event_stop_test (struct execution_control_state *ecs)
&& (execution_direction != EXEC_REVERSE
|| get_frame_id (frame) == ecs->event_thread->control.step_frame_id))
{
- infrun_debug_printf
- ("stepping inside range [%s-%s]",
- paddress (gdbarch, ecs->event_thread->control.step_range_start),
- paddress (gdbarch, ecs->event_thread->control.step_range_end));
+ infrun_debug_printf (
+ "stepping inside range [%s-%s]",
+ paddress (gdbarch, ecs->event_thread->control.step_range_start),
+ paddress (gdbarch, ecs->event_thread->control.step_range_end));
/* Tentatively re-enable range stepping; `resume' disables it if
necessary (e.g., if we're stepping over a breakpoint or we
@@ -6926,11 +6859,11 @@ process_event_stop_test (struct execution_control_state *ecs)
&& in_solib_dynsym_resolve_code (ecs->event_thread->stop_pc ())
&& (ecs->event_thread->control.step_start_function == nullptr
|| !in_solib_dynsym_resolve_code (
- ecs->event_thread->control.step_start_function->value_block ()
- ->entry_pc ())))
+ ecs->event_thread->control.step_start_function->value_block ()
+ ->entry_pc ())))
{
- CORE_ADDR pc_after_resolver =
- gdbarch_skip_solib_resolver (gdbarch, ecs->event_thread->stop_pc ());
+ CORE_ADDR pc_after_resolver
+ = gdbarch_skip_solib_resolver (gdbarch, ecs->event_thread->stop_pc ());
infrun_debug_printf ("stepped into dynsym resolve code");
@@ -6942,8 +6875,8 @@ process_event_stop_test (struct execution_control_state *ecs)
sr_sal.pc = pc_after_resolver;
sr_sal.pspace = get_frame_program_space (frame);
- insert_step_resume_breakpoint_at_sal (gdbarch,
- sr_sal, null_frame_id);
+ insert_step_resume_breakpoint_at_sal (gdbarch, sr_sal,
+ null_frame_id);
}
keep_going (ecs);
@@ -7004,8 +6937,8 @@ process_event_stop_test (struct execution_control_state *ecs)
/* Do not specify what the fp should be when we stop since
on some machines the prologue is where the new fp value
is established. */
- insert_step_resume_breakpoint_at_sal (gdbarch,
- sr_sal, null_frame_id);
+ insert_step_resume_breakpoint_at_sal (gdbarch, sr_sal,
+ null_frame_id);
/* Restart without fiddling with the step ranges or
other state. */
@@ -7098,8 +7031,8 @@ process_event_stop_test (struct execution_control_state *ecs)
symtab_and_line sr_sal;
sr_sal.pc = ecs->stop_func_start;
sr_sal.pspace = get_frame_program_space (frame);
- insert_step_resume_breakpoint_at_sal (gdbarch,
- sr_sal, get_stack_frame_id (frame));
+ insert_step_resume_breakpoint_at_sal (
+ gdbarch, sr_sal, get_stack_frame_id (frame));
}
}
else
@@ -7126,8 +7059,8 @@ process_event_stop_test (struct execution_control_state *ecs)
sr_sal.pc = ecs->stop_func_start;
sr_sal.pspace = get_frame_program_space (frame);
- insert_step_resume_breakpoint_at_sal (gdbarch,
- sr_sal, null_frame_id);
+ insert_step_resume_breakpoint_at_sal (gdbarch, sr_sal,
+ null_frame_id);
keep_going (ecs);
return;
}
@@ -7144,8 +7077,7 @@ process_event_stop_test (struct execution_control_state *ecs)
tmp_sal = find_pc_line (ecs->stop_func_start, 0);
if (tmp_sal.line != 0
- && !function_name_is_marked_for_skip (ecs->stop_func_name,
- tmp_sal)
+ && !function_name_is_marked_for_skip (ecs->stop_func_name, tmp_sal)
&& !inline_frame_is_marked_for_skip (true, ecs->event_thread))
{
if (execution_direction == EXEC_REVERSE)
@@ -7180,8 +7112,8 @@ process_event_stop_test (struct execution_control_state *ecs)
symtab_and_line sr_sal;
sr_sal.pc = ecs->stop_func_start;
sr_sal.pspace = get_frame_program_space (frame);
- insert_step_resume_breakpoint_at_sal (gdbarch,
- sr_sal, null_frame_id);
+ insert_step_resume_breakpoint_at_sal (gdbarch, sr_sal,
+ null_frame_id);
}
}
else
@@ -7220,8 +7152,8 @@ process_event_stop_test (struct execution_control_state *ecs)
symtab_and_line sr_sal;
sr_sal.pc = ecs->stop_func_start;
sr_sal.pspace = get_frame_program_space (frame);
- insert_step_resume_breakpoint_at_sal (gdbarch,
- sr_sal, null_frame_id);
+ insert_step_resume_breakpoint_at_sal (gdbarch, sr_sal,
+ null_frame_id);
keep_going (ecs);
return;
}
@@ -7237,8 +7169,7 @@ process_event_stop_test (struct execution_control_state *ecs)
the trampoline processing logic, however, there are some trampolines
that have no names, so we should do trampoline handling first. */
if (ecs->event_thread->control.step_over_calls == STEP_OVER_UNDEBUGGABLE
- && ecs->stop_func_name == nullptr
- && stop_pc_sal.line == 0)
+ && ecs->stop_func_name == nullptr && stop_pc_sal.line == 0)
{
infrun_debug_printf ("stepped into undebuggable function");
@@ -7376,7 +7307,7 @@ process_event_stop_test (struct execution_control_state *ecs)
return;
}
else if (get_frame_id (get_current_frame ())
- == ecs->event_thread->control.step_frame_id)
+ == ecs->event_thread->control.step_frame_id)
{
/* We are not at the start of a statement, and we have not changed
frame.
@@ -7419,11 +7350,11 @@ process_event_stop_test (struct execution_control_state *ecs)
ecs->event_thread->control.step_range_start = stop_pc_sal.pc;
ecs->event_thread->control.step_range_end = stop_pc_sal.end;
ecs->event_thread->control.may_range_step = 1;
- infrun_debug_printf
- ("updated step range, start = %s, end = %s, may_range_step = %d",
- paddress (gdbarch, ecs->event_thread->control.step_range_start),
- paddress (gdbarch, ecs->event_thread->control.step_range_end),
- ecs->event_thread->control.may_range_step);
+ infrun_debug_printf (
+ "updated step range, start = %s, end = %s, may_range_step = %d",
+ paddress (gdbarch, ecs->event_thread->control.step_range_start),
+ paddress (gdbarch, ecs->event_thread->control.step_range_end),
+ ecs->event_thread->control.may_range_step);
if (refresh_step_info)
set_step_info (ecs->event_thread, frame, stop_pc_sal);
@@ -7460,9 +7391,8 @@ switch_back_to_stepped_thread (struct execution_control_state *ecs)
if (ecs->event_thread->control.trap_expected
&& ecs->event_thread->stop_signal () != GDB_SIGNAL_TRAP)
{
- infrun_debug_printf
- ("need to finish step-over of [%s]",
- ecs->event_thread->ptid.to_string ().c_str ());
+ infrun_debug_printf ("need to finish step-over of [%s]",
+ ecs->event_thread->ptid.to_string ().c_str ());
keep_going (ecs);
return true;
}
@@ -7470,21 +7400,20 @@ switch_back_to_stepped_thread (struct execution_control_state *ecs)
/* Check if the current thread is blocked by a single-step
breakpoint of another thread. */
if (ecs->hit_singlestep_breakpoint)
- {
- infrun_debug_printf ("need to step [%s] over single-step breakpoint",
- ecs->ptid.to_string ().c_str ());
- keep_going (ecs);
- return true;
- }
+ {
+ infrun_debug_printf ("need to step [%s] over single-step breakpoint",
+ ecs->ptid.to_string ().c_str ());
+ keep_going (ecs);
+ return true;
+ }
/* If this thread needs yet another step-over (e.g., stepping
through a delay slot), do it first before moving on to
another thread. */
if (thread_still_needs_step_over (ecs->event_thread))
{
- infrun_debug_printf
- ("thread [%s] still needs step-over",
- ecs->event_thread->ptid.to_string ().c_str ());
+ infrun_debug_printf ("thread [%s] still needs step-over",
+ ecs->event_thread->ptid.to_string ().c_str ());
keep_going (ecs);
return true;
}
@@ -7737,8 +7666,7 @@ currently_stepping (struct thread_info *tp)
{
return ((tp->control.step_range_end
&& tp->control.step_resume_breakpoint == nullptr)
- || tp->control.trap_expected
- || tp->stepped_breakpoint
+ || tp->control.trap_expected || tp->stepped_breakpoint
|| bpstat_should_step ());
}
@@ -7765,8 +7693,7 @@ handle_step_into_function (struct gdbarch *gdbarch,
/* If the prologue ends in the middle of a source line, continue to
the end of that source line (if it is still within the function).
Otherwise, just go to end of prologue. */
- if (stop_func_sal.end
- && stop_func_sal.pc != ecs->stop_func_start
+ if (stop_func_sal.end && stop_func_sal.pc != ecs->stop_func_start
&& stop_func_sal.end < ecs->stop_func_end)
ecs->stop_func_start = stop_func_sal.end;
@@ -7789,8 +7716,7 @@ handle_step_into_function (struct gdbarch *gdbarch,
if (gdbarch_adjust_breakpoint_address_p (gdbarch))
{
ecs->stop_func_start
- = gdbarch_adjust_breakpoint_address (gdbarch,
- ecs->stop_func_start);
+ = gdbarch_adjust_breakpoint_address (gdbarch, ecs->stop_func_start);
}
if (ecs->stop_func_start == ecs->event_thread->stop_pc ())
@@ -7884,8 +7810,7 @@ insert_step_resume_breakpoint_at_sal (struct gdbarch *gdbarch,
struct symtab_and_line sr_sal,
struct frame_id sr_id)
{
- insert_step_resume_breakpoint_at_sal_1 (gdbarch,
- sr_sal, sr_id,
+ insert_step_resume_breakpoint_at_sal_1 (gdbarch, sr_sal, sr_id,
bp_step_resume);
}
@@ -7937,8 +7862,8 @@ insert_step_resume_breakpoint_at_caller (frame_info_ptr next_frame)
struct gdbarch *gdbarch = frame_unwind_caller_arch (next_frame);
symtab_and_line sr_sal;
- sr_sal.pc = gdbarch_addr_bits_remove (gdbarch,
- frame_unwind_caller_pc (next_frame));
+ sr_sal.pc
+ = gdbarch_addr_bits_remove (gdbarch, frame_unwind_caller_pc (next_frame));
sr_sal.section = find_pc_overlay (sr_sal.pc);
sr_sal.pspace = frame_unwind_program_space (next_frame);
@@ -7957,13 +7882,15 @@ insert_longjmp_resume_breakpoint (struct gdbarch *gdbarch, CORE_ADDR pc)
/* There should never be more than one longjmp-resume breakpoint per
thread, so we should never be setting a new
longjmp_resume_breakpoint when one is already active. */
- gdb_assert (inferior_thread ()->control.exception_resume_breakpoint == nullptr);
+ gdb_assert (inferior_thread ()->control.exception_resume_breakpoint
+ == nullptr);
infrun_debug_printf ("inserting longjmp-resume breakpoint at %s",
paddress (gdbarch, pc));
- inferior_thread ()->control.exception_resume_breakpoint =
- set_momentary_breakpoint_at_pc (gdbarch, pc, bp_longjmp_resume).release ();
+ inferior_thread ()->control.exception_resume_breakpoint
+ = set_momentary_breakpoint_at_pc (gdbarch, pc, bp_longjmp_resume)
+ .release ();
}
/* Insert an exception resume breakpoint. TP is the thread throwing
@@ -7975,8 +7902,7 @@ insert_longjmp_resume_breakpoint (struct gdbarch *gdbarch, CORE_ADDR pc)
static void
insert_exception_resume_breakpoint (struct thread_info *tp,
const struct block *b,
- frame_info_ptr frame,
- struct symbol *sym)
+ frame_info_ptr frame, struct symbol *sym)
{
try
{
@@ -7985,20 +7911,19 @@ insert_exception_resume_breakpoint (struct thread_info *tp,
CORE_ADDR handler;
struct breakpoint *bp;
- vsym = lookup_symbol_search_name (sym->search_name (),
- b, VAR_DOMAIN);
+ vsym = lookup_symbol_search_name (sym->search_name (), b, VAR_DOMAIN);
value = read_var_value (vsym.symbol, vsym.block, frame);
/* If the value was optimized out, revert to the old behavior. */
- if (! value_optimized_out (value))
+ if (!value_optimized_out (value))
{
handler = value_as_address (value);
infrun_debug_printf ("exception resume at %lx",
(unsigned long) handler);
- bp = set_momentary_breakpoint_at_pc (get_frame_arch (frame),
- handler,
- bp_exception_resume).release ();
+ bp = set_momentary_breakpoint_at_pc (get_frame_arch (frame), handler,
+ bp_exception_resume)
+ .release ();
/* set_momentary_breakpoint_at_pc invalidates FRAME. */
frame = nullptr;
@@ -8034,8 +7959,9 @@ insert_exception_resume_from_probe (struct thread_info *tp,
infrun_debug_printf ("exception resume at %s",
paddress (probe->objfile->arch (), handler));
- bp = set_momentary_breakpoint_at_pc (get_frame_arch (frame),
- handler, bp_exception_resume).release ();
+ bp = set_momentary_breakpoint_at_pc (get_frame_arch (frame), handler,
+ bp_exception_resume)
+ .release ();
bp->thread = tp->global_num;
inferior_thread ()->control.exception_resume_breakpoint = bp;
}
@@ -8097,8 +8023,8 @@ check_exception_resume (struct execution_control_state *ecs,
++argno;
else
{
- insert_exception_resume_breakpoint (ecs->event_thread,
- b, frame, sym);
+ insert_exception_resume_breakpoint (ecs->event_thread, b, frame,
+ sym);
break;
}
}
@@ -8151,8 +8077,7 @@ keep_going_pass_signal (struct execution_control_state *ecs)
either case, this resume must be deferred for later. */
struct thread_info *tp = ecs->event_thread;
- if (ecs->hit_singlestep_breakpoint
- || thread_still_needs_step_over (tp))
+ if (ecs->hit_singlestep_breakpoint || thread_still_needs_step_over (tp))
{
infrun_debug_printf ("step-over already in progress: "
"step-over for %s deferred",
@@ -8201,9 +8126,8 @@ keep_going_pass_signal (struct execution_control_state *ecs)
if (remove_bp
&& (remove_wps || !use_displaced_stepping (ecs->event_thread)))
{
- set_step_over_info (regcache->aspace (),
- regcache_read_pc (regcache), remove_wps,
- ecs->event_thread->global_num);
+ set_step_over_info (regcache->aspace (), regcache_read_pc (regcache),
+ remove_wps, ecs->event_thread->global_num);
}
else if (remove_wps)
set_step_over_info (nullptr, 0, remove_wps, -1);
@@ -8300,8 +8224,8 @@ print_end_stepping_range_reason (struct ui_out *uiout)
if (uiout->is_mi_like_p ())
{
- uiout->field_string ("reason",
- async_reason_lookup (EXEC_ASYNC_END_STEPPING_RANGE));
+ uiout->field_string (
+ "reason", async_reason_lookup (EXEC_ASYNC_END_STEPPING_RANGE));
}
}
@@ -8310,17 +8234,15 @@ print_signal_exited_reason (struct ui_out *uiout, enum gdb_signal siggnal)
{
annotate_signalled ();
if (uiout->is_mi_like_p ())
- uiout->field_string
- ("reason", async_reason_lookup (EXEC_ASYNC_EXITED_SIGNALLED));
+ uiout->field_string ("reason",
+ async_reason_lookup (EXEC_ASYNC_EXITED_SIGNALLED));
uiout->text ("\nProgram terminated with signal ");
annotate_signal_name ();
- uiout->field_string ("signal-name",
- gdb_signal_to_name (siggnal));
+ uiout->field_string ("signal-name", gdb_signal_to_name (siggnal));
annotate_signal_name_end ();
uiout->text (", ");
annotate_signal_string ();
- uiout->field_string ("signal-meaning",
- gdb_signal_to_string (siggnal));
+ uiout->field_string ("signal-meaning", gdb_signal_to_string (siggnal));
annotate_signal_string_end ();
uiout->text (".\n");
uiout->text ("The program no longer exists.\n");
@@ -8336,7 +8258,8 @@ print_exited_reason (struct ui_out *uiout, int exitstatus)
if (exitstatus)
{
if (uiout->is_mi_like_p ())
- uiout->field_string ("reason", async_reason_lookup (EXEC_ASYNC_EXITED));
+ uiout->field_string ("reason",
+ async_reason_lookup (EXEC_ASYNC_EXITED));
std::string exit_code_str
= string_printf ("0%o", (unsigned int) exitstatus);
uiout->message ("[Inferior %s (%s) exited with code %pF]\n",
@@ -8346,8 +8269,8 @@ print_exited_reason (struct ui_out *uiout, int exitstatus)
else
{
if (uiout->is_mi_like_p ())
- uiout->field_string
- ("reason", async_reason_lookup (EXEC_ASYNC_EXITED_NORMALLY));
+ uiout->field_string ("reason",
+ async_reason_lookup (EXEC_ASYNC_EXITED_NORMALLY));
uiout->message ("[Inferior %s (%s) exited normally]\n",
plongest (inf->num), pidstr.c_str ());
}
@@ -8387,8 +8310,8 @@ print_signal_received_reason (struct ui_out *uiout, enum gdb_signal siggnal)
uiout->text (" received signal ");
annotate_signal_name ();
if (uiout->is_mi_like_p ())
- uiout->field_string
- ("reason", async_reason_lookup (EXEC_ASYNC_SIGNAL_RECEIVED));
+ uiout->field_string ("reason",
+ async_reason_lookup (EXEC_ASYNC_SIGNAL_RECEIVED));
uiout->field_string ("signal-name", gdb_signal_to_name (siggnal));
annotate_signal_name_end ();
uiout->text (", ");
@@ -8409,7 +8332,8 @@ void
print_no_history_reason (struct ui_out *uiout)
{
if (uiout->is_mi_like_p ())
- uiout->field_string ("reason", async_reason_lookup (EXEC_ASYNC_NO_HISTORY));
+ uiout->field_string ("reason",
+ async_reason_lookup (EXEC_ASYNC_NO_HISTORY));
else
uiout->text ("\nNo more reverse-execution history.\n");
}
@@ -8435,8 +8359,7 @@ print_stop_location (const target_waitstatus &ws)
should) carry around the function and does (or should) use
that when doing a frame comparison. */
if (tp->control.stop_step
- && (tp->control.step_frame_id
- == get_frame_id (get_current_frame ()))
+ && (tp->control.step_frame_id == get_frame_id (get_current_frame ()))
&& (tp->control.step_start_function
== find_pc_function (tp->stop_pc ())))
{
@@ -8462,7 +8385,7 @@ print_stop_location (const target_waitstatus &ws)
do_frame_printing = 0;
break;
default:
- internal_error (_("Unknown value."));
+ internal_error (_ ("Unknown value."));
}
/* The behavior of this routine with respect to the source
@@ -8495,8 +8418,7 @@ print_stop_event (struct ui_out *uiout, bool displays)
}
tp = inferior_thread ();
- if (tp->thread_fsm () != nullptr
- && tp->thread_fsm ()->finished_p ())
+ if (tp->thread_fsm () != nullptr && tp->thread_fsm ()->finished_p ())
{
struct return_value_info *rv;
@@ -8516,9 +8438,9 @@ maybe_remove_breakpoints (void)
if (remove_breakpoints ())
{
target_terminal::ours_for_output ();
- gdb_printf (_("Cannot remove breakpoints because "
- "program is no longer writable.\nFurther "
- "execution is probably impossible.\n"));
+ gdb_printf (_ ("Cannot remove breakpoints because "
+ "program is no longer writable.\nFurther "
+ "execution is probably impossible.\n"));
}
}
}
@@ -8619,8 +8541,8 @@ normal_stop ()
gdb::optional<scoped_finish_thread_state> maybe_finish_thread_state;
if (finish_ptid != null_ptid)
{
- maybe_finish_thread_state.emplace
- (user_visible_resume_target (finish_ptid), finish_ptid);
+ maybe_finish_thread_state.emplace (
+ user_visible_resume_target (finish_ptid), finish_ptid);
}
/* As we're presenting a stop, and potentially removing breakpoints,
@@ -8634,7 +8556,8 @@ normal_stop ()
update_thread_list ();
if (last.kind () == TARGET_WAITKIND_STOPPED && stopped_by_random_signal)
- gdb::observers::signal_received.notify (inferior_thread ()->stop_signal ());
+ gdb::observers::signal_received.notify (
+ inferior_thread ()->stop_signal ());
/* As with the notification of thread events, we want to delay
notifying the user that we've switched thread context until
@@ -8652,31 +8575,29 @@ normal_stop ()
the current thread back to the thread the user had selected right
after this event is handled, so we're not really switching, only
informing of a stop. */
- if (!non_stop
- && previous_inferior_ptid != inferior_ptid
- && target_has_execution ()
- && last.kind () != TARGET_WAITKIND_SIGNALLED
+ if (!non_stop && previous_inferior_ptid != inferior_ptid
+ && target_has_execution () && last.kind () != TARGET_WAITKIND_SIGNALLED
&& last.kind () != TARGET_WAITKIND_EXITED
&& last.kind () != TARGET_WAITKIND_NO_RESUMED)
{
SWITCH_THRU_ALL_UIS ()
- {
- target_terminal::ours_for_output ();
- gdb_printf (_("[Switching to %s]\n"),
- target_pid_to_str (inferior_ptid).c_str ());
- annotate_thread_changed ();
- }
+ {
+ target_terminal::ours_for_output ();
+ gdb_printf (_ ("[Switching to %s]\n"),
+ target_pid_to_str (inferior_ptid).c_str ());
+ annotate_thread_changed ();
+ }
previous_inferior_ptid = inferior_ptid;
}
if (last.kind () == TARGET_WAITKIND_NO_RESUMED)
{
SWITCH_THRU_ALL_UIS ()
- if (current_ui->prompt_state == PROMPT_BLOCKED)
- {
- target_terminal::ours_for_output ();
- gdb_printf (_("No unwaited-for children left.\n"));
- }
+ if (current_ui->prompt_state == PROMPT_BLOCKED)
+ {
+ target_terminal::ours_for_output ();
+ gdb_printf (_ ("No unwaited-for children left.\n"));
+ }
}
/* Note: this depends on the update_thread_list call above. */
@@ -8689,9 +8610,9 @@ normal_stop ()
disable_current_display ();
SWITCH_THRU_ALL_UIS ()
- {
- async_enable_stdin ();
- }
+ {
+ async_enable_stdin ();
+ }
/* Let the user/frontend see the threads as stopped. */
maybe_finish_thread_state.reset ();
@@ -8734,8 +8655,7 @@ normal_stop ()
}
catch (const gdb_exception &ex)
{
- exception_fprintf (gdb_stderr, ex,
- "Error while running hook_stop:\n");
+ exception_fprintf (gdb_stderr, ex, "Error while running hook_stop:\n");
}
/* If the stop hook resumes the target, then there's no point in
@@ -8749,8 +8669,8 @@ normal_stop ()
/* Notify observers about the stop. This is where the interpreters
print the stop event. */
if (inferior_ptid != null_ptid)
- gdb::observers::normal_stop.notify (inferior_thread ()->control.stop_bpstat,
- stop_print_frame);
+ gdb::observers::normal_stop.notify (
+ inferior_thread ()->control.stop_bpstat, stop_print_frame);
else
gdb::observers::normal_stop.notify (nullptr, stop_print_frame);
@@ -8768,7 +8688,7 @@ normal_stop ()
return false;
}
-
+
int
signal_stop_state (int signo)
{
@@ -8798,10 +8718,9 @@ signal_cache_update (int signo)
return;
}
- signal_pass[signo] = (signal_stop[signo] == 0
- && signal_print[signo] == 0
- && signal_program[signo] == 1
- && signal_catch[signo] == 0);
+ signal_pass[signo]
+ = (signal_stop[signo] == 0 && signal_print[signo] == 0
+ && signal_program[signo] == 1 && signal_catch[signo] == 0);
}
int
@@ -8851,8 +8770,8 @@ signal_catch_update (const unsigned int *info)
static void
sig_print_header (void)
{
- gdb_printf (_("Signal Stop\tPrint\tPass "
- "to program\tDescription\n"));
+ gdb_printf (_ ("Signal Stop\tPrint\tPass "
+ "to program\tDescription\n"));
}
static void
@@ -8884,7 +8803,7 @@ handle_command (const char *args, int from_tty)
if (args == nullptr)
{
- error_no_arg (_("signal to handle"));
+ error_no_arg (_ ("signal to handle"));
}
/* Allocate and zero an array of flags for which signals to handle. */
@@ -8905,7 +8824,8 @@ handle_command (const char *args, int from_tty)
{
wordlen = strlen (arg);
for (digits = 0; isdigit (arg[digits]); digits++)
- {;
+ {
+ ;
}
allsigs = 0;
sigfirst = siglast = -1;
@@ -8960,12 +8880,11 @@ handle_command (const char *args, int from_tty)
using symbolic names anyway, and the common ones like
SIGHUP, SIGINT, SIGALRM, etc. will work right anyway. */
- sigfirst = siglast = (int)
- gdb_signal_from_command (atoi (arg));
+ sigfirst = siglast = (int) gdb_signal_from_command (atoi (arg));
if (arg[digits] == '-')
{
- siglast = (int)
- gdb_signal_from_command (atoi (arg + digits + 1));
+ siglast
+ = (int) gdb_signal_from_command (atoi (arg + digits + 1));
}
if (sigfirst > siglast)
{
@@ -8983,7 +8902,7 @@ handle_command (const char *args, int from_tty)
else
{
/* Not a number and not a recognized flag word => complain. */
- error (_("Unrecognized or ambiguous flag word: \"%s\"."), arg);
+ error (_ ("Unrecognized or ambiguous flag word: \"%s\"."), arg);
}
}
@@ -8998,14 +8917,14 @@ handle_command (const char *args, int from_tty)
case GDB_SIGNAL_INT:
if (!allsigs && !sigs[signum])
{
- if (query (_("%s is used by the debugger.\n\
+ if (query (_ ("%s is used by the debugger.\n\
Are you sure you want to change it? "),
gdb_signal_to_name ((enum gdb_signal) signum)))
{
sigs[signum] = 1;
}
else
- gdb_printf (_("Not confirmed, unchanged.\n"));
+ gdb_printf (_ ("Not confirmed, unchanged.\n"));
}
break;
case GDB_SIGNAL_0:
@@ -9043,23 +8962,13 @@ Are you sure you want to change it? "),
/* Complete the "handle" command. */
static void
-handle_completer (struct cmd_list_element *ignore,
- completion_tracker &tracker,
+handle_completer (struct cmd_list_element *ignore, completion_tracker &tracker,
const char *text, const char *word)
{
- static const char * const keywords[] =
- {
- "all",
- "stop",
- "ignore",
- "print",
- "pass",
- "nostop",
- "noignore",
- "noprint",
- "nopass",
- nullptr,
- };
+ static const char *const keywords[] = {
+ "all", "stop", "ignore", "print", "pass",
+ "nostop", "noignore", "noprint", "nopass", nullptr,
+ };
signal_completer (ignore, tracker, text, word);
complete_on_enum (tracker, keywords, word, word);
@@ -9070,7 +8979,7 @@ gdb_signal_from_command (int num)
{
if (num >= 1 && num <= 15)
return (enum gdb_signal) num;
- error (_("Only signals 1-15 are valid as numeric signals.\n\
+ error (_ ("Only signals 1-15 are valid as numeric signals.\n\
Use \"info signals\" for a list of symbolic signals."));
}
@@ -9093,8 +9002,7 @@ info_signals_command (const char *signum_exp, int from_tty)
if (oursig == GDB_SIGNAL_UNKNOWN)
{
/* No, try numeric. */
- oursig =
- gdb_signal_from_command (parse_and_eval_long (signum_exp));
+ oursig = gdb_signal_from_command (parse_and_eval_long (signum_exp));
}
sig_print_info (oursig);
return;
@@ -9102,19 +9010,18 @@ info_signals_command (const char *signum_exp, int from_tty)
gdb_printf ("\n");
/* These ugly casts brought to you by the native VAX compiler. */
- for (oursig = GDB_SIGNAL_FIRST;
- (int) oursig < (int) GDB_SIGNAL_LAST;
+ for (oursig = GDB_SIGNAL_FIRST; (int) oursig < (int) GDB_SIGNAL_LAST;
oursig = (enum gdb_signal) ((int) oursig + 1))
{
QUIT;
- if (oursig != GDB_SIGNAL_UNKNOWN
- && oursig != GDB_SIGNAL_DEFAULT && oursig != GDB_SIGNAL_0)
+ if (oursig != GDB_SIGNAL_UNKNOWN && oursig != GDB_SIGNAL_DEFAULT
+ && oursig != GDB_SIGNAL_0)
sig_print_info (oursig);
}
- gdb_printf (_("\nUse the \"handle\" command "
- "to change these tables.\n"));
+ gdb_printf (_ ("\nUse the \"handle\" command "
+ "to change these tables.\n"));
}
/* The $_siginfo convenience variable is a bit special. We don't know
@@ -9139,16 +9046,13 @@ siginfo_value_read (struct value *v)
vice versa. */
validate_registers_access ();
- transferred =
- target_read (current_inferior ()->top_target (),
- TARGET_OBJECT_SIGNAL_INFO,
- nullptr,
- value_contents_all_raw (v).data (),
- value_offset (v),
- value_type (v)->length ());
+ transferred = target_read (current_inferior ()->top_target (),
+ TARGET_OBJECT_SIGNAL_INFO, nullptr,
+ value_contents_all_raw (v).data (),
+ value_offset (v), value_type (v)->length ());
if (transferred != value_type (v)->length ())
- error (_("Unable to read siginfo"));
+ error (_ ("Unable to read siginfo"));
}
/* This function implements the lval_computed support for writing a
@@ -9163,22 +9067,18 @@ siginfo_value_write (struct value *v, struct value *fromval)
vice versa. */
validate_registers_access ();
- transferred = target_write (current_inferior ()->top_target (),
- TARGET_OBJECT_SIGNAL_INFO,
- nullptr,
- value_contents_all_raw (fromval).data (),
- value_offset (v),
- value_type (fromval)->length ());
+ transferred
+ = target_write (current_inferior ()->top_target (),
+ TARGET_OBJECT_SIGNAL_INFO, nullptr,
+ value_contents_all_raw (fromval).data (), value_offset (v),
+ value_type (fromval)->length ());
if (transferred != value_type (fromval)->length ())
- error (_("Unable to write siginfo"));
+ error (_ ("Unable to write siginfo"));
}
-static const struct lval_funcs siginfo_value_funcs =
- {
- siginfo_value_read,
- siginfo_value_write
- };
+static const struct lval_funcs siginfo_value_funcs
+ = { siginfo_value_read, siginfo_value_write };
/* Return a new value with the correct type for the siginfo object of
the current thread using architecture GDBARCH. Return a void value
@@ -9188,8 +9088,7 @@ static struct value *
siginfo_make_value (struct gdbarch *gdbarch, struct internalvar *var,
void *ignore)
{
- if (target_has_stack ()
- && inferior_ptid != null_ptid
+ if (target_has_stack () && inferior_ptid != null_ptid
&& gdbarch_get_siginfo_type_p (gdbarch))
{
struct type *type = gdbarch_get_siginfo_type (gdbarch);
@@ -9200,7 +9099,6 @@ siginfo_make_value (struct gdbarch *gdbarch, struct internalvar *var,
return allocate_value (builtin_type (gdbarch)->builtin_void);
}
-
/* infcall_suspend_state contains state about the program itself like its
registers and any signal it received when it last stopped.
This state must be restored regardless of how the inferior function call
@@ -9210,10 +9108,10 @@ siginfo_make_value (struct gdbarch *gdbarch, struct internalvar *var,
class infcall_suspend_state
{
public:
+
/* Capture state from GDBARCH, TP, and REGCACHE that must be restored
once the inferior function call has finished. */
- infcall_suspend_state (struct gdbarch *gdbarch,
- const struct thread_info *tp,
+ infcall_suspend_state (struct gdbarch *gdbarch, const struct thread_info *tp,
struct regcache *regcache)
: m_registers (new readonly_detached_regcache (*regcache))
{
@@ -9230,7 +9128,8 @@ public:
if (target_read (current_inferior ()->top_target (),
TARGET_OBJECT_SIGNAL_INFO, nullptr,
- siginfo_data.get (), 0, len) != len)
+ siginfo_data.get (), 0, len)
+ != len)
{
/* Errors ignored. */
siginfo_data.reset (nullptr);
@@ -9246,15 +9145,11 @@ public:
/* Return a pointer to the stored register state. */
- readonly_detached_regcache *registers () const
- {
- return m_registers.get ();
- }
+ readonly_detached_regcache *registers () const { return m_registers.get (); }
/* Restores the stored state into GDBARCH, TP, and REGCACHE. */
- void restore (struct gdbarch *gdbarch,
- struct thread_info *tp,
+ void restore (struct gdbarch *gdbarch, struct thread_info *tp,
struct regcache *regcache) const
{
tp->restore_suspend_from (m_thread_suspend);
@@ -9277,6 +9172,7 @@ public:
}
private:
+
/* How the current thread stopped before the inferior function call was
executed. */
struct thread_suspend_state m_thread_suspend;
@@ -9300,8 +9196,8 @@ save_infcall_suspend_state ()
struct regcache *regcache = get_current_regcache ();
struct gdbarch *gdbarch = regcache->arch ();
- infcall_suspend_state_up inf_state
- (new struct infcall_suspend_state (gdbarch, tp, regcache));
+ infcall_suspend_state_up inf_state (
+ new struct infcall_suspend_state (gdbarch, tp, regcache));
/* Having saved the current state, adjust the thread state, discarding
any stop signal information. The stop signal is not useful when
@@ -9352,7 +9248,10 @@ struct infcall_control_state
/* ID and level of the selected frame when the inferior function
call was made. */
- struct frame_id selected_frame_id {};
+ struct frame_id selected_frame_id
+ {
+ };
+
int selected_frame_level = -1;
};
@@ -9438,7 +9337,7 @@ discard_infcall_control_state (struct infcall_control_state *inf_status)
delete inf_status;
}
-
+
/* See infrun.h. */
void
@@ -9447,7 +9346,6 @@ clear_exit_convenience_vars (void)
clear_internalvar (lookup_internalvar ("_exitsignal"));
clear_internalvar (lookup_internalvar ("_exitcode"));
}
-
/* User interface for reverse debugging:
Set exec-direction / show exec-direction commands
@@ -9457,11 +9355,8 @@ enum exec_direction_kind execution_direction = EXEC_FORWARD;
static const char exec_forward[] = "forward";
static const char exec_reverse[] = "reverse";
static const char *exec_direction = exec_forward;
-static const char *const exec_direction_names[] = {
- exec_forward,
- exec_reverse,
- nullptr
-};
+static const char *const exec_direction_names[]
+ = { exec_forward, exec_reverse, nullptr };
static void
set_exec_direction_func (const char *args, int from_tty,
@@ -9477,7 +9372,7 @@ set_exec_direction_func (const char *args, int from_tty,
else
{
exec_direction = exec_forward;
- error (_("Target does not support this operation."));
+ error (_ ("Target does not support this operation."));
}
}
@@ -9485,31 +9380,33 @@ static void
show_exec_direction_func (struct ui_file *out, int from_tty,
struct cmd_list_element *cmd, const char *value)
{
- switch (execution_direction) {
- case EXEC_FORWARD:
- gdb_printf (out, _("Forward.\n"));
- break;
- case EXEC_REVERSE:
- gdb_printf (out, _("Reverse.\n"));
- break;
- default:
- internal_error (_("bogus execution_direction value: %d"),
- (int) execution_direction);
- }
+ switch (execution_direction)
+ {
+ case EXEC_FORWARD:
+ gdb_printf (out, _ ("Forward.\n"));
+ break;
+ case EXEC_REVERSE:
+ gdb_printf (out, _ ("Reverse.\n"));
+ break;
+ default:
+ internal_error (_ ("bogus execution_direction value: %d"),
+ (int) execution_direction);
+ }
}
static void
show_schedule_multiple (struct ui_file *file, int from_tty,
struct cmd_list_element *c, const char *value)
{
- gdb_printf (file, _("Resuming the execution of threads "
- "of all processes is %s.\n"), value);
+ gdb_printf (file,
+ _ ("Resuming the execution of threads "
+ "of all processes is %s.\n"),
+ value);
}
/* Implementation of `siginfo' variable. */
-static const struct internalvar_funcs siginfo_funcs =
-{
+static const struct internalvar_funcs siginfo_funcs = {
siginfo_make_value,
nullptr,
};
@@ -9557,7 +9454,8 @@ infrun_thread_ptid_changed ()
target2.mock_inferior.ptid_thread_map.clear ();
target2.mock_inferior.ptid_thread_map[old_ptid] = &target2.mock_thread;
- auto restore_inferior_ptid = make_scoped_restore (&inferior_ptid, old_ptid);
+ auto restore_inferior_ptid
+ = make_scoped_restore (&inferior_ptid, old_ptid);
set_current_inferior (&target1.mock_inferior);
thread_change_ptid (&target1.mock_target, old_ptid, new_ptid);
@@ -9586,7 +9484,8 @@ infrun_thread_ptid_changed ()
target2.mock_inferior.ptid_thread_map.clear ();
target2.mock_inferior.ptid_thread_map[old_ptid] = &target2.mock_thread;
- auto restore_inferior_ptid = make_scoped_restore (&inferior_ptid, old_ptid);
+ auto restore_inferior_ptid
+ = make_scoped_restore (&inferior_ptid, old_ptid);
set_current_inferior (&target2.mock_inferior);
thread_change_ptid (&target1.mock_target, old_ptid, new_ptid);
@@ -9600,6 +9499,7 @@ infrun_thread_ptid_changed ()
#endif /* GDB_SELF_TEST */
void _initialize_infrun ();
+
void
_initialize_infrun ()
{
@@ -9611,12 +9511,12 @@ _initialize_infrun ()
"infrun");
cmd_list_element *info_signals_cmd
- = add_info ("signals", info_signals_command, _("\
+ = add_info ("signals", info_signals_command, _ ("\
What debugger does when program gets various signals.\n\
Specify a signal as argument to print info on that signal only."));
add_info_alias ("handle", info_signals_cmd, 0);
- c = add_com ("handle", class_run, handle_command, _("\
+ c = add_com ("handle", class_run, handle_command, _ ("\
Specify how to handle signals.\n\
Usage: handle SIGNAL [ACTIONS]\n\
Args are signals and actions to apply to those signals.\n\
@@ -9642,23 +9542,24 @@ may be interspersed with actions, with the actions being performed for\n\
all signals cumulatively specified."));
set_cmd_completer (c, handle_completer);
- stop_command = add_cmd ("stop", class_obscure,
- not_just_help_class_command, _("\
+ stop_command
+ = add_cmd ("stop", class_obscure, not_just_help_class_command, _ ("\
There is no `stop' command, but you can set a hook on `stop'.\n\
This allows you to set a list of commands to be run each time execution\n\
-of the program stops."), &cmdlist);
-
- add_setshow_boolean_cmd
- ("infrun", class_maintenance, &debug_infrun,
- _("Set inferior debugging."),
- _("Show inferior debugging."),
- _("When non-zero, inferior specific debugging is enabled."),
- nullptr, show_debug_infrun, &setdebuglist, &showdebuglist);
-
- add_setshow_boolean_cmd ("non-stop", no_class,
- &non_stop_1, _("\
-Set whether gdb controls the inferior in non-stop mode."), _("\
-Show whether gdb controls the inferior in non-stop mode."), _("\
+of the program stops."),
+ &cmdlist);
+
+ add_setshow_boolean_cmd (
+ "infrun", class_maintenance, &debug_infrun, _ ("Set inferior debugging."),
+ _ ("Show inferior debugging."),
+ _ ("When non-zero, inferior specific debugging is enabled."), nullptr,
+ show_debug_infrun, &setdebuglist, &showdebuglist);
+
+ add_setshow_boolean_cmd ("non-stop", no_class, &non_stop_1, _ ("\
+Set whether gdb controls the inferior in non-stop mode."),
+ _ ("\
+Show whether gdb controls the inferior in non-stop mode."),
+ _ ("\
When debugging a multi-threaded program and this setting is\n\
off (the default, also called all-stop mode), when one thread stops\n\
(for a breakpoint, watchpoint, exception, or similar events), GDB stops\n\
@@ -9670,10 +9571,7 @@ thread's state, all threads stop.\n\
In non-stop mode, when one thread stops, other threads can continue\n\
to run freely. You'll be able to step each thread independently,\n\
leave it stopped or free to run as needed."),
- set_non_stop,
- show_non_stop,
- &setlist,
- &showlist);
+ set_non_stop, show_non_stop, &setlist, &showlist);
for (size_t i = 0; i < GDB_SIGNAL_LAST; i++)
{
@@ -9736,35 +9634,38 @@ leave it stopped or free to run as needed."),
signal_cache_update (-1);
add_setshow_zinteger_cmd ("stop-on-solib-events", class_support,
- &stop_on_solib_events, _("\
-Set stopping for shared library events."), _("\
-Show stopping for shared library events."), _("\
+ &stop_on_solib_events, _ ("\
+Set stopping for shared library events."),
+ _ ("\
+Show stopping for shared library events."),
+ _ ("\
If nonzero, gdb will give control to the user when the dynamic linker\n\
notifies gdb of shared library events. The most common event of interest\n\
to the user would be loading/unloading of a new library."),
set_stop_on_solib_events,
- show_stop_on_solib_events,
- &setlist, &showlist);
+ show_stop_on_solib_events, &setlist, &showlist);
add_setshow_enum_cmd ("follow-fork-mode", class_run,
- follow_fork_mode_kind_names,
- &follow_fork_mode_string, _("\
-Set debugger response to a program call of fork or vfork."), _("\
-Show debugger response to a program call of fork or vfork."), _("\
+ follow_fork_mode_kind_names, &follow_fork_mode_string,
+ _ ("\
+Set debugger response to a program call of fork or vfork."),
+ _ ("\
+Show debugger response to a program call of fork or vfork."),
+ _ ("\
A fork or vfork creates a new process. follow-fork-mode can be:\n\
parent - the original process is debugged after a fork\n\
child - the new process is debugged after a fork\n\
The unfollowed process will continue to run.\n\
By default, the debugger will follow the parent process."),
- nullptr,
- show_follow_fork_mode_string,
- &setlist, &showlist);
-
- add_setshow_enum_cmd ("follow-exec-mode", class_run,
- follow_exec_mode_names,
- &follow_exec_mode_string, _("\
-Set debugger response to a program call of exec."), _("\
-Show debugger response to a program call of exec."), _("\
+ nullptr, show_follow_fork_mode_string, &setlist,
+ &showlist);
+
+ add_setshow_enum_cmd ("follow-exec-mode", class_run, follow_exec_mode_names,
+ &follow_exec_mode_string, _ ("\
+Set debugger response to a program call of exec."),
+ _ ("\
+Show debugger response to a program call of exec."),
+ _ ("\
An exec call replaces the program image of a process.\n\
\n\
follow-exec-mode can be:\n\
@@ -9780,14 +9681,15 @@ the inferior. Restarting the inferior after the exec call restarts\n\
the executable the process was running after the exec call.\n\
\n\
By default, the debugger will use the same inferior."),
- nullptr,
- show_follow_exec_mode_string,
- &setlist, &showlist);
-
- add_setshow_enum_cmd ("scheduler-locking", class_run,
- scheduler_enums, &scheduler_mode, _("\
-Set mode for locking scheduler during execution."), _("\
-Show mode for locking scheduler during execution."), _("\
+ nullptr, show_follow_exec_mode_string, &setlist,
+ &showlist);
+
+ add_setshow_enum_cmd ("scheduler-locking", class_run, scheduler_enums,
+ &scheduler_mode, _ ("\
+Set mode for locking scheduler during execution."),
+ _ ("\
+Show mode for locking scheduler during execution."),
+ _ ("\
off == no locking (threads may preempt at any time)\n\
on == full locking (no thread except the current thread may run)\n\
This applies to both normal execution and replay mode.\n\
@@ -9795,74 +9697,80 @@ step == scheduler locked during stepping commands (step, next, stepi, nexti).\
In this mode, other threads may run during other commands.\n\
This applies to both normal execution and replay mode.\n\
replay == scheduler locked in replay mode and unlocked during normal execution."),
- set_schedlock_func, /* traps on target vector */
- show_scheduler_mode,
- &setlist, &showlist);
-
- add_setshow_boolean_cmd ("schedule-multiple", class_run, &sched_multi, _("\
-Set mode for resuming threads of all processes."), _("\
-Show mode for resuming threads of all processes."), _("\
+ set_schedlock_func, /* traps on target vector */
+ show_scheduler_mode, &setlist, &showlist);
+
+ add_setshow_boolean_cmd ("schedule-multiple", class_run, &sched_multi, _ ("\
+Set mode for resuming threads of all processes."),
+ _ ("\
+Show mode for resuming threads of all processes."),
+ _ ("\
When on, execution commands (such as 'continue' or 'next') resume all\n\
threads of all processes. When off (which is the default), execution\n\
commands only resume the threads of the current process. The set of\n\
threads that are resumed is further refined by the scheduler-locking\n\
mode (see help set scheduler-locking)."),
- nullptr,
- show_schedule_multiple,
- &setlist, &showlist);
+ nullptr, show_schedule_multiple, &setlist,
+ &showlist);
- add_setshow_boolean_cmd ("step-mode", class_run, &step_stop_if_no_debug, _("\
-Set mode of the step operation."), _("\
-Show mode of the step operation."), _("\
+ add_setshow_boolean_cmd ("step-mode", class_run, &step_stop_if_no_debug,
+ _ ("\
+Set mode of the step operation."),
+ _ ("\
+Show mode of the step operation."),
+ _ ("\
When set, doing a step over a function without debug line information\n\
will stop at the first instruction of that function. Otherwise, the\n\
function is skipped and the step command stops at a different source line."),
- nullptr,
- show_step_stop_if_no_debug,
- &setlist, &showlist);
+ nullptr, show_step_stop_if_no_debug, &setlist,
+ &showlist);
add_setshow_auto_boolean_cmd ("displaced-stepping", class_run,
- &can_use_displaced_stepping, _("\
-Set debugger's willingness to use displaced stepping."), _("\
-Show debugger's willingness to use displaced stepping."), _("\
+ &can_use_displaced_stepping, _ ("\
+Set debugger's willingness to use displaced stepping."),
+ _ ("\
+Show debugger's willingness to use displaced stepping."),
+ _ ("\
If on, gdb will use displaced stepping to step over breakpoints if it is\n\
supported by the target architecture. If off, gdb will not use displaced\n\
stepping to step over breakpoints, even if such is supported by the target\n\
architecture. If auto (which is the default), gdb will use displaced stepping\n\
if the target architecture supports it and non-stop mode is active, but will not\n\
use it in all-stop mode (see help set non-stop)."),
- nullptr,
- show_can_use_displaced_stepping,
+ nullptr, show_can_use_displaced_stepping,
&setlist, &showlist);
- add_setshow_enum_cmd ("exec-direction", class_run, exec_direction_names,
- &exec_direction, _("Set direction of execution.\n\
+ add_setshow_enum_cmd (
+ "exec-direction", class_run, exec_direction_names, &exec_direction,
+ _ ("Set direction of execution.\n\
Options are 'forward' or 'reverse'."),
- _("Show direction of execution (forward/reverse)."),
- _("Tells gdb whether to execute forward or backward."),
- set_exec_direction_func, show_exec_direction_func,
- &setlist, &showlist);
+ _ ("Show direction of execution (forward/reverse)."),
+ _ ("Tells gdb whether to execute forward or backward."),
+ set_exec_direction_func, show_exec_direction_func, &setlist, &showlist);
/* Set/show detach-on-fork: user-settable mode. */
- add_setshow_boolean_cmd ("detach-on-fork", class_run, &detach_fork, _("\
-Set whether gdb will detach the child of a fork."), _("\
-Show whether gdb will detach the child of a fork."), _("\
+ add_setshow_boolean_cmd ("detach-on-fork", class_run, &detach_fork, _ ("\
+Set whether gdb will detach the child of a fork."),
+ _ ("\
+Show whether gdb will detach the child of a fork."),
+ _ ("\
Tells gdb whether to detach the child of a fork."),
nullptr, nullptr, &setlist, &showlist);
/* Set/show disable address space randomization mode. */
add_setshow_boolean_cmd ("disable-randomization", class_support,
- &disable_randomization, _("\
-Set disabling of debuggee's virtual address space randomization."), _("\
-Show disabling of debuggee's virtual address space randomization."), _("\
+ &disable_randomization, _ ("\
+Set disabling of debuggee's virtual address space randomization."),
+ _ ("\
+Show disabling of debuggee's virtual address space randomization."),
+ _ ("\
When this mode is on (which is the default), randomization of the virtual\n\
address space is disabled. Standalone programs run with the randomization\n\
enabled by default on some platforms."),
&set_disable_randomization,
- &show_disable_randomization,
- &setlist, &showlist);
+ &show_disable_randomization, &setlist, &showlist);
/* ptid initializations */
inferior_ptid = null_ptid;
@@ -9882,17 +9790,16 @@ enabled by default on some platforms."),
isn't another convenience variable of the same name. */
create_internalvar_type_lazy ("_siginfo", &siginfo_funcs, nullptr);
- add_setshow_boolean_cmd ("observer", no_class,
- &observer_mode_1, _("\
-Set whether gdb controls the inferior in observer mode."), _("\
-Show whether gdb controls the inferior in observer mode."), _("\
+ add_setshow_boolean_cmd ("observer", no_class, &observer_mode_1, _ ("\
+Set whether gdb controls the inferior in observer mode."),
+ _ ("\
+Show whether gdb controls the inferior in observer mode."),
+ _ ("\
In observer mode, GDB can get data from the inferior, but not\n\
affect its execution. Registers and memory may not be changed,\n\
breakpoints may not be set, and the program cannot be interrupted\n\
or signalled."),
- set_observer_mode,
- show_observer_mode,
- &setlist,
+ set_observer_mode, show_observer_mode, &setlist,
&showlist);
#if GDB_SELF_TEST
diff --git a/gdb/infrun.h b/gdb/infrun.h
index 43fd1b44f5a..d7c523a9172 100644
--- a/gdb/infrun.h
+++ b/gdb/infrun.h
@@ -69,13 +69,11 @@ infrun_debug_show_threads (const char *title, ThreadRange threads)
infrun_debug_printf (" thread %s, executing = %d, resumed = %d, "
"state = %s",
thread->ptid.to_string ().c_str (),
- thread->executing (),
- thread->resumed (),
+ thread->executing (), thread->resumed (),
thread_state_string (thread->state));
}
}
-
/* Nonzero if we want to give control to the user when we're notified
of shared library events by the dynamic linker. */
extern int stop_on_solib_events;
@@ -109,10 +107,10 @@ extern ULONGEST get_stop_id (void);
/* Reverse execution. */
enum exec_direction_kind
- {
- EXEC_FORWARD,
- EXEC_REVERSE
- };
+{
+ EXEC_FORWARD,
+ EXEC_REVERSE
+};
/* The current execution direction. */
extern enum exec_direction_kind execution_direction;
@@ -159,7 +157,8 @@ extern void get_last_target_status (process_stratum_target **target,
struct target_waitstatus *status);
/* Set the cached copy of the last target/ptid/waitstatus. */
-extern void set_last_target_status (process_stratum_target *target, ptid_t ptid,
+extern void set_last_target_status (process_stratum_target *target,
+ ptid_t ptid,
const target_waitstatus &status);
/* Clear the cached copy of the last ptid/waitstatus returned by
@@ -182,7 +181,7 @@ extern void fetch_inferior_event ();
extern void init_wait_for_inferior (void);
extern void insert_step_resume_breakpoint_at_sal (struct gdbarch *,
- struct symtab_and_line ,
+ struct symtab_and_line,
struct frame_id);
/* Returns true if we're trying to step past the instruction at
@@ -199,8 +198,7 @@ extern int thread_is_stepping_over_breakpoint (int thread);
extern int stepping_past_nonsteppable_watchpoint (void);
/* Record in TP the frame and location we're currently stepping through. */
-extern void set_step_info (thread_info *tp,
- frame_info_ptr frame,
+extern void set_step_info (thread_info *tp, frame_info_ptr frame,
struct symtab_and_line sal);
/* Several print_*_reason helper functions to print why the inferior
@@ -306,7 +304,8 @@ extern void all_uis_on_sync_execution_starting (void);
/* In all-stop, restart the target if it had to be stopped to
detach. */
-extern void restart_after_all_stop_detach (process_stratum_target *proc_target);
+extern void
+restart_after_all_stop_detach (process_stratum_target *proc_target);
/* RAII object to temporarily disable the requirement for target
stacks to commit their resumed threads.
@@ -372,6 +371,7 @@ struct scoped_disable_commit_resumed
void reset_and_commit ();
private:
+
/* Undoes the disabling done by the ctor. */
void reset ();
@@ -401,9 +401,9 @@ struct scoped_enable_commit_resumed
DISABLE_COPY_AND_ASSIGN (scoped_enable_commit_resumed);
private:
+
const char *m_reason;
bool m_prev_enable_commit_resumed;
};
-
#endif /* INFRUN_H */
diff --git a/gdb/inline-frame.c b/gdb/inline-frame.c
index f02f6353c64..b6555721b09 100644
--- a/gdb/inline-frame.c
+++ b/gdb/inline-frame.c
@@ -38,9 +38,12 @@ struct inline_state
{
inline_state (thread_info *thread_, int skipped_frames_, CORE_ADDR saved_pc_,
std::vector<symbol *> &&skipped_symbols_)
- : thread (thread_), skipped_frames (skipped_frames_), saved_pc (saved_pc_),
+ : thread (thread_),
+ skipped_frames (skipped_frames_),
+ saved_pc (saved_pc_),
skipped_symbols (std::move (skipped_symbols_))
- {}
+ {
+ }
/* The thread this data relates to. It should be a currently
stopped thread. */
@@ -71,10 +74,9 @@ static struct inline_state *
find_inline_frame_state (thread_info *thread)
{
auto state_it = std::find_if (inline_states.begin (), inline_states.end (),
- [thread] (const inline_state &state)
- {
- return state.thread == thread;
- });
+ [thread] (const inline_state &state) {
+ return state.thread == thread;
+ });
if (state_it == inline_states.end ())
return nullptr;
@@ -104,12 +106,11 @@ clear_inline_frame_state (process_stratum_target *target, ptid_t filter_ptid)
if (filter_ptid == minus_one_ptid || filter_ptid.is_pid ())
{
- auto matcher = [target, &filter_ptid] (const inline_state &state)
- {
- thread_info *t = state.thread;
- return (t->inf->process_target () == target
- && t->ptid.matches (filter_ptid));
- };
+ auto matcher = [target, &filter_ptid] (const inline_state &state) {
+ thread_info *t = state.thread;
+ return (t->inf->process_target () == target
+ && t->ptid.matches (filter_ptid));
+ };
auto it = std::remove_if (inline_states.begin (), inline_states.end (),
matcher);
@@ -119,16 +120,13 @@ clear_inline_frame_state (process_stratum_target *target, ptid_t filter_ptid)
return;
}
+ auto matcher = [target, &filter_ptid] (const inline_state &state) {
+ thread_info *t = state.thread;
+ return (t->inf->process_target () == target && filter_ptid == t->ptid);
+ };
- auto matcher = [target, &filter_ptid] (const inline_state &state)
- {
- thread_info *t = state.thread;
- return (t->inf->process_target () == target
- && filter_ptid == t->ptid);
- };
-
- auto it = std::find_if (inline_states.begin (), inline_states.end (),
- matcher);
+ auto it
+ = std::find_if (inline_states.begin (), inline_states.end (), matcher);
if (it != inline_states.end ())
unordered_remove (inline_states, it);
@@ -140,18 +138,16 @@ void
clear_inline_frame_state (thread_info *thread)
{
auto it = std::find_if (inline_states.begin (), inline_states.end (),
- [thread] (const inline_state &state)
- {
- return thread == state.thread;
- });
+ [thread] (const inline_state &state) {
+ return thread == state.thread;
+ });
if (it != inline_states.end ())
unordered_remove (inline_states, it);
}
static void
-inline_frame_this_id (frame_info_ptr this_frame,
- void **this_cache,
+inline_frame_this_id (frame_info_ptr this_frame, void **this_cache,
struct frame_id *this_id)
{
struct symbol *func;
@@ -165,7 +161,7 @@ inline_frame_this_id (frame_info_ptr this_frame,
comments in get_prev_frame_always_1. */
frame_info_ptr prev_frame = get_prev_frame_always (this_frame);
if (prev_frame == nullptr)
- error (_("failed to find previous frame when computing inline frame id"));
+ error (_ ("failed to find previous frame when computing inline frame id"));
*this_id = get_frame_id (prev_frame);
/* We need a valid frame ID, so we need to be based on a valid
@@ -208,8 +204,7 @@ inline_frame_prev_register (frame_info_ptr this_frame, void **this_cache,
static int
inline_frame_sniffer (const struct frame_unwind *self,
- frame_info_ptr this_frame,
- void **this_cache)
+ frame_info_ptr this_frame, void **this_cache)
{
CORE_ADDR this_pc;
const struct block *frame_block, *cur_block;
@@ -265,15 +260,14 @@ inline_frame_sniffer (const struct frame_unwind *self,
return 1;
}
-const struct frame_unwind inline_frame_unwind = {
- "inline",
- INLINE_FRAME,
- default_frame_unwind_stop_reason,
- inline_frame_this_id,
- inline_frame_prev_register,
- NULL,
- inline_frame_sniffer
-};
+const struct frame_unwind inline_frame_unwind
+ = { "inline",
+ INLINE_FRAME,
+ default_frame_unwind_stop_reason,
+ inline_frame_this_id,
+ inline_frame_prev_register,
+ NULL,
+ inline_frame_sniffer };
/* Return non-zero if BLOCK, an inlined function block containing PC,
has a group of contiguous instructions starting at PC (but not
@@ -313,8 +307,7 @@ stopped_by_user_bp_inline_frame (const block *frame_block, bpstat *stop_chain)
{
struct breakpoint *bpt = s->breakpoint_at;
- if (bpt != NULL
- && (user_breakpoint_p (bpt) || bpt->type == bp_until))
+ if (bpt != NULL && (user_breakpoint_p (bpt) || bpt->type == bp_until))
{
bp_location *loc = s->bp_location_at.get ();
enum bp_loc_type t = loc->loc_type;
diff --git a/gdb/inline-frame.h b/gdb/inline-frame.h
index 6ed413ed881..e146571b0be 100644
--- a/gdb/inline-frame.h
+++ b/gdb/inline-frame.h
@@ -17,7 +17,7 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
-#if !defined (INLINE_FRAME_H)
+#if !defined(INLINE_FRAME_H)
#define INLINE_FRAME_H 1
class frame_info_ptr;
diff --git a/gdb/interps.c b/gdb/interps.c
index 9c7908bde1c..f77d3acc4b6 100644
--- a/gdb/interps.c
+++ b/gdb/interps.c
@@ -36,7 +36,7 @@
#include "event-top.h"
#include "interps.h"
#include "completer.h"
-#include "top.h" /* For command_loop. */
+#include "top.h" /* For command_loop. */
#include "main.h"
#include "gdbsupport/buildargv.h"
#include "gdbsupport/scope-exit.h"
@@ -76,17 +76,14 @@ get_current_interp_info (void)
/* The magic initialization routine for this module. */
-static struct interp *interp_lookup_existing (struct ui *ui,
- const char *name);
+static struct interp *interp_lookup_existing (struct ui *ui, const char *name);
interp::interp (const char *name)
: m_name (make_unique_xstrdup (name))
{
}
-interp::~interp ()
-{
-}
+interp::~interp () {}
/* An interpreter factory. Maps an interpreter name to the factory
function that instantiates an interpreter by that name. */
@@ -94,8 +91,10 @@ interp::~interp ()
struct interp_factory
{
interp_factory (const char *name_, interp_factory_func func_)
- : name (name_), func (func_)
- {}
+ : name (name_),
+ func (func_)
+ {
+ }
/* This is the name in "-i=INTERP" and "interpreter-exec INTERP". */
const char *name;
@@ -116,7 +115,7 @@ interp_factory_register (const char *name, interp_factory_func func)
for (const interp_factory &f : interpreter_factories)
if (strcmp (f.name, name) == 0)
{
- internal_error (_("interpreter factory already registered: \"%s\"\n"),
+ internal_error (_ ("interpreter factory already registered: \"%s\"\n"),
name);
}
@@ -192,9 +191,9 @@ interp_set (struct interp *interp, bool top_level)
interp->resume ();
if (warn_about_mi1)
- warning (_("MI version 1 is deprecated in GDB 13 and "
- "will be removed in GDB 14. Please upgrade "
- "to a newer version of MI."));
+ warning (_ ("MI version 1 is deprecated in GDB 13 and "
+ "will be removed in GDB 14. Please upgrade "
+ "to a newer version of MI."));
}
/* Look up the interpreter for NAME. If no such interpreter exists,
@@ -206,9 +205,7 @@ interp_lookup_existing (struct ui *ui, const char *name)
struct ui_interp_info *ui_interp = get_interp_info (ui);
struct interp *interp;
- for (interp = ui_interp->interp_list;
- interp != NULL;
- interp = interp->next)
+ for (interp = ui_interp->interp_list; interp != NULL; interp = interp->next)
{
if (strcmp (interp->name (), name) == 0)
return interp;
@@ -250,7 +247,7 @@ set_top_level_interpreter (const char *name)
struct interp *interp = interp_lookup (current_ui, name);
if (interp == NULL)
- error (_("Interpreter `%s' unrecognized"), name);
+ error (_ ("Interpreter `%s' unrecognized"), name);
/* Install it. */
interp_set (interp, true);
}
@@ -379,25 +376,25 @@ interpreter_exec_cmd (const char *args, int from_tty)
scoped_restore save_stdtargerr = make_scoped_restore (&gdb_stdtargerr);
if (args == NULL)
- error_no_arg (_("interpreter-exec command"));
+ error_no_arg (_ ("interpreter-exec command"));
gdb_argv prules (args);
nrules = prules.count ();
if (nrules < 2)
- error (_("Usage: interpreter-exec INTERPRETER COMMAND..."));
+ error (_ ("Usage: interpreter-exec INTERPRETER COMMAND..."));
old_interp = ui_interp->current_interpreter;
interp_to_use = interp_lookup (current_ui, prules[0]);
if (interp_to_use == NULL)
- error (_("Could not find interpreter \"%s\"."), prules[0]);
+ error (_ ("Could not find interpreter \"%s\"."), prules[0]);
interp_set (interp_to_use, false);
SCOPE_EXIT
- {
- interp_set (old_interp, false);
- };
+ {
+ interp_set (old_interp, false);
+ };
for (i = 1; i < nrules; i++)
interp_exec (interp_to_use, prules[i]);
@@ -407,8 +404,8 @@ interpreter_exec_cmd (const char *args, int from_tty)
void
interpreter_completer (struct cmd_list_element *ignore,
- completion_tracker &tracker,
- const char *text, const char *word)
+ completion_tracker &tracker, const char *text,
+ const char *word)
{
int textlen = strlen (text);
@@ -416,8 +413,8 @@ interpreter_completer (struct cmd_list_element *ignore,
{
if (strncmp (interp.name, text, textlen) == 0)
{
- tracker.add_completion
- (make_completion_match_str (interp.name, text, word));
+ tracker.add_completion (make_completion_match_str (interp.name, text,
+ word));
}
}
}
@@ -442,19 +439,20 @@ current_interpreter (void)
/* This just adds the "interpreter-exec" command. */
void _initialize_interpreter ();
+
void
_initialize_interpreter ()
{
struct cmd_list_element *c;
- c = add_cmd ("interpreter-exec", class_support,
- interpreter_exec_cmd, _("\
+ c = add_cmd ("interpreter-exec", class_support, interpreter_exec_cmd, _ ("\
Execute a command in an interpreter.\n\
Usage: interpreter-exec INTERPRETER COMMAND...\n\
The first argument is the name of the interpreter to use.\n\
The following arguments are the commands to execute.\n\
A command can have arguments, separated by spaces.\n\
These spaces must be escaped using \\ or the command\n\
-and its arguments must be enclosed in double quotes."), &cmdlist);
+and its arguments must be enclosed in double quotes."),
+ &cmdlist);
set_cmd_completer (c, interpreter_completer);
}
diff --git a/gdb/interps.h b/gdb/interps.h
index 01bec47550d..f824d9388b8 100644
--- a/gdb/interps.h
+++ b/gdb/interps.h
@@ -41,11 +41,11 @@ extern void interp_exec (struct interp *interp, const char *command);
class interp
{
public:
+
explicit interp (const char *name);
virtual ~interp () = 0;
- virtual void init (bool top_level)
- {}
+ virtual void init (bool top_level) {}
virtual void resume () = 0;
virtual void suspend () = 0;
@@ -62,29 +62,27 @@ public:
setup/cleanup that they might need when logging is enabled or
disabled. */
virtual void set_logging (ui_file_up logfile, bool logging_redirect,
- bool debug_redirect) = 0;
+ bool debug_redirect)
+ = 0;
/* Called before starting an event loop, to give the interpreter a
chance to e.g., print a prompt. */
- virtual void pre_command_loop ()
- {}
+ virtual void pre_command_loop () {}
/* Returns true if this interpreter supports using the readline
library; false if it uses GDB's own simplified readline
emulation. */
- virtual bool supports_command_editing ()
- { return false; }
+ virtual bool supports_command_editing () { return false; }
- const char *name () const
- {
- return m_name.get ();
- }
+ const char *name () const { return m_name.get (); }
private:
+
/* This is the name in "-i=" and "set interpreter". */
gdb::unique_xmalloc_ptr<char> m_name;
public:
+
/* Interpreters are stored in a linked list, this is the next
one... */
struct interp *next;
@@ -115,10 +113,7 @@ public:
{
}
- ~scoped_restore_interp ()
- {
- set_interp (m_interp->name ());
- }
+ ~scoped_restore_interp () { set_interp (m_interp->name ()); }
scoped_restore_interp (const scoped_restore_interp &) = delete;
scoped_restore_interp &operator= (const scoped_restore_interp &) = delete;
@@ -169,16 +164,15 @@ extern void interp_pre_command_loop (struct interp *interp);
text. */
extern void interpreter_completer (struct cmd_list_element *ignore,
completion_tracker &tracker,
- const char *text,
- const char *word);
+ const char *text, const char *word);
/* well-known interpreters */
-#define INTERP_CONSOLE "console"
-#define INTERP_MI2 "mi2"
-#define INTERP_MI3 "mi3"
-#define INTERP_MI4 "mi4"
-#define INTERP_MI "mi"
-#define INTERP_TUI "tui"
-#define INTERP_INSIGHT "insight"
+#define INTERP_CONSOLE "console"
+#define INTERP_MI2 "mi2"
+#define INTERP_MI3 "mi3"
+#define INTERP_MI4 "mi4"
+#define INTERP_MI "mi"
+#define INTERP_TUI "tui"
+#define INTERP_INSIGHT "insight"
#endif
diff --git a/gdb/iq2000-tdep.c b/gdb/iq2000-tdep.c
index b80ee61e437..992838c19f6 100644
--- a/gdb/iq2000-tdep.c
+++ b/gdb/iq2000-tdep.c
@@ -35,48 +35,75 @@
enum gdb_regnum
{
- E_R0_REGNUM, E_R1_REGNUM, E_R2_REGNUM, E_R3_REGNUM,
- E_R4_REGNUM, E_R5_REGNUM, E_R6_REGNUM, E_R7_REGNUM,
- E_R8_REGNUM, E_R9_REGNUM, E_R10_REGNUM, E_R11_REGNUM,
- E_R12_REGNUM, E_R13_REGNUM, E_R14_REGNUM, E_R15_REGNUM,
- E_R16_REGNUM, E_R17_REGNUM, E_R18_REGNUM, E_R19_REGNUM,
- E_R20_REGNUM, E_R21_REGNUM, E_R22_REGNUM, E_R23_REGNUM,
- E_R24_REGNUM, E_R25_REGNUM, E_R26_REGNUM, E_R27_REGNUM,
- E_R28_REGNUM, E_R29_REGNUM, E_R30_REGNUM, E_R31_REGNUM,
- E_PC_REGNUM,
- E_LR_REGNUM = E_R31_REGNUM, /* Link register. */
- E_SP_REGNUM = E_R29_REGNUM, /* Stack pointer. */
- E_FP_REGNUM = E_R27_REGNUM, /* Frame pointer. */
- E_FN_RETURN_REGNUM = E_R2_REGNUM, /* Function return value register. */
- E_1ST_ARGREG = E_R4_REGNUM, /* 1st function arg register. */
- E_LAST_ARGREG = E_R11_REGNUM, /* Last function arg register. */
- E_NUM_REGS = E_PC_REGNUM + 1
+ E_R0_REGNUM,
+ E_R1_REGNUM,
+ E_R2_REGNUM,
+ E_R3_REGNUM,
+ E_R4_REGNUM,
+ E_R5_REGNUM,
+ E_R6_REGNUM,
+ E_R7_REGNUM,
+ E_R8_REGNUM,
+ E_R9_REGNUM,
+ E_R10_REGNUM,
+ E_R11_REGNUM,
+ E_R12_REGNUM,
+ E_R13_REGNUM,
+ E_R14_REGNUM,
+ E_R15_REGNUM,
+ E_R16_REGNUM,
+ E_R17_REGNUM,
+ E_R18_REGNUM,
+ E_R19_REGNUM,
+ E_R20_REGNUM,
+ E_R21_REGNUM,
+ E_R22_REGNUM,
+ E_R23_REGNUM,
+ E_R24_REGNUM,
+ E_R25_REGNUM,
+ E_R26_REGNUM,
+ E_R27_REGNUM,
+ E_R28_REGNUM,
+ E_R29_REGNUM,
+ E_R30_REGNUM,
+ E_R31_REGNUM,
+ E_PC_REGNUM,
+ E_LR_REGNUM = E_R31_REGNUM, /* Link register. */
+ E_SP_REGNUM = E_R29_REGNUM, /* Stack pointer. */
+ E_FP_REGNUM = E_R27_REGNUM, /* Frame pointer. */
+ E_FN_RETURN_REGNUM = E_R2_REGNUM, /* Function return value register. */
+ E_1ST_ARGREG = E_R4_REGNUM, /* 1st function arg register. */
+ E_LAST_ARGREG = E_R11_REGNUM, /* Last function arg register. */
+ E_NUM_REGS = E_PC_REGNUM + 1
};
/* Use an invalid address value as 'not available' marker. */
-enum { REG_UNAVAIL = (CORE_ADDR) -1 };
+enum
+{
+ REG_UNAVAIL = (CORE_ADDR) -1
+};
struct iq2000_frame_cache
{
/* Base address. */
- CORE_ADDR base;
- CORE_ADDR pc;
- LONGEST framesize;
- int using_fp;
- CORE_ADDR saved_sp;
- CORE_ADDR saved_regs [E_NUM_REGS];
+ CORE_ADDR base;
+ CORE_ADDR pc;
+ LONGEST framesize;
+ int using_fp;
+ CORE_ADDR saved_sp;
+ CORE_ADDR saved_regs[E_NUM_REGS];
};
/* Harvard methods: */
static CORE_ADDR
-insn_ptr_from_addr (CORE_ADDR addr) /* CORE_ADDR to target pointer. */
+insn_ptr_from_addr (CORE_ADDR addr) /* CORE_ADDR to target pointer. */
{
return addr & 0x7fffffffL;
}
static CORE_ADDR
-insn_addr_from_ptr (CORE_ADDR ptr) /* target_pointer to CORE_ADDR. */
+insn_addr_from_ptr (CORE_ADDR ptr) /* target_pointer to CORE_ADDR. */
{
return (ptr & 0x7fffffffL) | 0x80000000L;
}
@@ -85,16 +112,14 @@ insn_addr_from_ptr (CORE_ADDR ptr) /* target_pointer to CORE_ADDR. */
Convert a target pointer to an address in host (CORE_ADDR) format. */
static CORE_ADDR
-iq2000_pointer_to_address (struct gdbarch *gdbarch,
- struct type * type, const gdb_byte * buf)
+iq2000_pointer_to_address (struct gdbarch *gdbarch, struct type *type,
+ const gdb_byte *buf)
{
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
enum type_code target = type->target_type ()->code ();
- CORE_ADDR addr
- = extract_unsigned_integer (buf, type->length (), byte_order);
+ CORE_ADDR addr = extract_unsigned_integer (buf, type->length (), byte_order);
- if (target == TYPE_CODE_FUNC
- || target == TYPE_CODE_METHOD
+ if (target == TYPE_CODE_FUNC || target == TYPE_CODE_METHOD
|| TYPE_CODE_SPACE (type->target_type ()))
addr = insn_addr_from_ptr (addr);
@@ -105,8 +130,8 @@ iq2000_pointer_to_address (struct gdbarch *gdbarch,
Convert a host-format address (CORE_ADDR) into a target pointer. */
static void
-iq2000_address_to_pointer (struct gdbarch *gdbarch,
- struct type *type, gdb_byte *buf, CORE_ADDR addr)
+iq2000_address_to_pointer (struct gdbarch *gdbarch, struct type *type,
+ gdb_byte *buf, CORE_ADDR addr)
{
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
enum type_code target = type->target_type ()->code ();
@@ -124,17 +149,11 @@ iq2000_address_to_pointer (struct gdbarch *gdbarch,
static const char *
iq2000_register_name (struct gdbarch *gdbarch, int regnum)
{
- static const char * names[E_NUM_REGS] =
- {
- "r0", "r1", "r2", "r3", "r4",
- "r5", "r6", "r7", "r8", "r9",
- "r10", "r11", "r12", "r13", "r14",
- "r15", "r16", "r17", "r18", "r19",
- "r20", "r21", "r22", "r23", "r24",
- "r25", "r26", "r27", "r28", "r29",
- "r30", "r31",
- "pc"
- };
+ static const char *names[E_NUM_REGS]
+ = { "r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7", "r8",
+ "r9", "r10", "r11", "r12", "r13", "r14", "r15", "r16", "r17",
+ "r18", "r19", "r20", "r21", "r22", "r23", "r24", "r25", "r26",
+ "r27", "r28", "r29", "r30", "r31", "pc" };
gdb_static_assert (ARRAY_SIZE (names) == E_NUM_REGS);
return names[regnum];
}
@@ -142,21 +161,21 @@ iq2000_register_name (struct gdbarch *gdbarch, int regnum)
/* Prologue analysis methods: */
/* ADDIU insn (001001 rs(5) rt(5) imm(16)). */
-#define INSN_IS_ADDIU(X) (((X) & 0xfc000000) == 0x24000000)
-#define ADDIU_REG_SRC(X) (((X) & 0x03e00000) >> 21)
-#define ADDIU_REG_TGT(X) (((X) & 0x001f0000) >> 16)
-#define ADDIU_IMMEDIATE(X) ((signed short) ((X) & 0x0000ffff))
+#define INSN_IS_ADDIU(X) (((X) &0xfc000000) == 0x24000000)
+#define ADDIU_REG_SRC(X) (((X) &0x03e00000) >> 21)
+#define ADDIU_REG_TGT(X) (((X) &0x001f0000) >> 16)
+#define ADDIU_IMMEDIATE(X) ((signed short) ((X) &0x0000ffff))
/* "MOVE" (OR) insn (000000 rs(5) rt(5) rd(5) 00000 100101). */
-#define INSN_IS_MOVE(X) (((X) & 0xffe007ff) == 0x00000025)
-#define MOVE_REG_SRC(X) (((X) & 0x001f0000) >> 16)
-#define MOVE_REG_TGT(X) (((X) & 0x0000f800) >> 11)
+#define INSN_IS_MOVE(X) (((X) &0xffe007ff) == 0x00000025)
+#define MOVE_REG_SRC(X) (((X) &0x001f0000) >> 16)
+#define MOVE_REG_TGT(X) (((X) &0x0000f800) >> 11)
/* STORE WORD insn (101011 rs(5) rt(5) offset(16)). */
-#define INSN_IS_STORE_WORD(X) (((X) & 0xfc000000) == 0xac000000)
-#define SW_REG_INDEX(X) (((X) & 0x03e00000) >> 21)
-#define SW_REG_SRC(X) (((X) & 0x001f0000) >> 16)
-#define SW_OFFSET(X) ((signed short) ((X) & 0x0000ffff))
+#define INSN_IS_STORE_WORD(X) (((X) &0xfc000000) == 0xac000000)
+#define SW_REG_INDEX(X) (((X) &0x03e00000) >> 21)
+#define SW_REG_SRC(X) (((X) &0x001f0000) >> 16)
+#define SW_OFFSET(X) ((signed short) ((X) &0x0000ffff))
/* Function: find_last_line_symbol
@@ -195,10 +214,8 @@ find_last_line_symbol (CORE_ADDR start, CORE_ADDR end, int notcurrent)
Returns the address of the first instruction after the prologue. */
static CORE_ADDR
-iq2000_scan_prologue (struct gdbarch *gdbarch,
- CORE_ADDR scan_start,
- CORE_ADDR scan_end,
- frame_info_ptr fi,
+iq2000_scan_prologue (struct gdbarch *gdbarch, CORE_ADDR scan_start,
+ CORE_ADDR scan_end, frame_info_ptr fi,
struct iq2000_frame_cache *cache)
{
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
@@ -220,7 +237,7 @@ iq2000_scan_prologue (struct gdbarch *gdbarch,
if (fi)
sal = find_last_line_symbol (scan_start, scan_end, 0);
else
- sal.end = 0; /* Avoid GCC false warning. */
+ sal.end = 0; /* Avoid GCC false warning. */
}
/* Saved registers:
@@ -229,7 +246,7 @@ iq2000_scan_prologue (struct gdbarch *gdbarch,
offset can be zero, we must first initialize all the
saved regs to minus one (so we can later distinguish
between one that's not saved, and one that's saved at zero). */
- for (srcreg = 0; srcreg < E_NUM_REGS; srcreg ++)
+ for (srcreg = 0; srcreg < E_NUM_REGS; srcreg++)
cache->saved_regs[srcreg] = -1;
cache->using_fp = 0;
cache->framesize = 0;
@@ -335,9 +352,9 @@ iq2000_init_frame_cache (struct iq2000_frame_cache *cache)
static CORE_ADDR
iq2000_skip_prologue (struct gdbarch *gdbarch, CORE_ADDR pc)
{
- CORE_ADDR func_addr = 0 , func_end = 0;
+ CORE_ADDR func_addr = 0, func_end = 0;
- if (find_pc_partial_function (pc, NULL, & func_addr, & func_end))
+ if (find_pc_partial_function (pc, NULL, &func_addr, &func_end))
{
struct symtab_and_line sal;
struct iq2000_frame_cache cache;
@@ -394,8 +411,8 @@ static struct value *
iq2000_frame_prev_register (frame_info_ptr this_frame, void **this_cache,
int regnum)
{
- struct iq2000_frame_cache *cache = iq2000_frame_cache (this_frame,
- this_cache);
+ struct iq2000_frame_cache *cache
+ = iq2000_frame_cache (this_frame, this_cache);
if (regnum == E_SP_REGNUM && cache->saved_sp)
return frame_unwind_got_constant (this_frame, regnum, cache->saved_sp);
@@ -414,47 +431,43 @@ static void
iq2000_frame_this_id (frame_info_ptr this_frame, void **this_cache,
struct frame_id *this_id)
{
- struct iq2000_frame_cache *cache = iq2000_frame_cache (this_frame,
- this_cache);
+ struct iq2000_frame_cache *cache
+ = iq2000_frame_cache (this_frame, this_cache);
/* This marks the outermost frame. */
- if (cache->base == 0)
+ if (cache->base == 0)
return;
*this_id = frame_id_build (cache->saved_sp, cache->pc);
}
-static const struct frame_unwind iq2000_frame_unwind = {
- "iq2000 prologue",
- NORMAL_FRAME,
- default_frame_unwind_stop_reason,
- iq2000_frame_this_id,
- iq2000_frame_prev_register,
- NULL,
- default_frame_sniffer
-};
+static const struct frame_unwind iq2000_frame_unwind
+ = { "iq2000 prologue",
+ NORMAL_FRAME,
+ default_frame_unwind_stop_reason,
+ iq2000_frame_this_id,
+ iq2000_frame_prev_register,
+ NULL,
+ default_frame_sniffer };
static CORE_ADDR
iq2000_frame_base_address (frame_info_ptr this_frame, void **this_cache)
{
- struct iq2000_frame_cache *cache = iq2000_frame_cache (this_frame,
- this_cache);
+ struct iq2000_frame_cache *cache
+ = iq2000_frame_cache (this_frame, this_cache);
return cache->base;
}
-
-static const struct frame_base iq2000_frame_base = {
- &iq2000_frame_unwind,
- iq2000_frame_base_address,
- iq2000_frame_base_address,
- iq2000_frame_base_address
-};
+
+static const struct frame_base iq2000_frame_base
+ = { &iq2000_frame_unwind, iq2000_frame_base_address,
+ iq2000_frame_base_address, iq2000_frame_base_address };
static int
iq2000_breakpoint_kind_from_pc (struct gdbarch *gdbarch, CORE_ADDR *pcptr)
{
if ((*pcptr & 3) != 0)
- error (_("breakpoint_from_pc: invalid breakpoint address 0x%lx"),
+ error (_ ("breakpoint_from_pc: invalid breakpoint address 0x%lx"),
(long) *pcptr);
return 4;
@@ -467,8 +480,8 @@ iq2000_sw_breakpoint_from_kind (struct gdbarch *gdbarch, int kind, int *size)
static const unsigned char little_breakpoint[] = { 0x0d, 0x00, 0x00, 0x00 };
*size = kind;
- return (gdbarch_byte_order (gdbarch)
- == BFD_ENDIAN_BIG) ? big_breakpoint : little_breakpoint;
+ return (gdbarch_byte_order (gdbarch) == BFD_ENDIAN_BIG) ? big_breakpoint
+ : little_breakpoint;
}
/* Target function return value methods: */
@@ -600,8 +613,7 @@ iq2000_pass_8bytetype_by_address (struct type *type)
while (type->code () == TYPE_CODE_TYPEDEF)
type = type->target_type ();
/* Non-struct and non-union types are always passed by value. */
- if (type->code () != TYPE_CODE_STRUCT
- && type->code () != TYPE_CODE_UNION)
+ if (type->code () != TYPE_CODE_STRUCT && type->code () != TYPE_CODE_UNION)
return 0;
/* Structs with more than 1 field are always passed by address. */
if (type->num_fields () != 1)
@@ -615,8 +627,7 @@ iq2000_pass_8bytetype_by_address (struct type *type)
while (ftype->code () == TYPE_CODE_TYPEDEF)
ftype = ftype->target_type ();
/* If field is int or float, pass by value. */
- if (ftype->code () == TYPE_CODE_FLT
- || ftype->code () == TYPE_CODE_INT)
+ if (ftype->code () == TYPE_CODE_FLT || ftype->code () == TYPE_CODE_INT)
return 0;
/* Everything else, pass by address. */
return 1;
@@ -640,8 +651,7 @@ iq2000_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
/* First determine how much stack space we will need. */
for (i = 0, argreg = E_1ST_ARGREG + (return_method == return_method_struct);
- i < nargs;
- i++)
+ i < nargs; i++)
{
type = value_type (args[i]);
typelen = type->length ();
@@ -665,12 +675,12 @@ iq2000_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
/* 8-byte arg goes into a register pair
(must start with an even-numbered reg). */
if (((argreg - E_1ST_ARGREG) % 2) != 0)
- argreg ++;
+ argreg++;
argreg += 2;
}
else
{
- argreg = E_LAST_ARGREG + 1; /* no more argregs. */
+ argreg = E_LAST_ARGREG + 1; /* no more argregs. */
/* 8-byte arg goes on stack, must be 8-byte aligned. */
stackspace = ((stackspace + 7) & ~7);
stackspace += 8;
@@ -693,10 +703,10 @@ iq2000_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
/* Now copy params, in ascending order, into their assigned location
(either in a register or on the stack). */
- sp -= (sp % 8); /* align */
+ sp -= (sp % 8); /* align */
struct_ptr = sp;
sp -= stackspace;
- sp -= (sp % 8); /* align again */
+ sp -= (sp % 8); /* align again */
stackspace = 0;
argreg = E_1ST_ARGREG;
@@ -746,7 +756,7 @@ iq2000_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
else
{
/* 8-byte arg goes on stack, must be 8-byte aligned. */
- argreg = E_LAST_ARGREG + 1; /* no more argregs. */
+ argreg = E_LAST_ARGREG + 1; /* no more argregs. */
stackspace = ((stackspace + 7) & ~7);
write_memory (sp + stackspace, val, typelen);
stackspace += 8;
@@ -796,32 +806,32 @@ iq2000_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
gdbarch = gdbarch_alloc (&info, NULL);
- set_gdbarch_num_regs (gdbarch, E_NUM_REGS);
- set_gdbarch_num_pseudo_regs (gdbarch, 0);
- set_gdbarch_sp_regnum (gdbarch, E_SP_REGNUM);
- set_gdbarch_pc_regnum (gdbarch, E_PC_REGNUM);
- set_gdbarch_register_name (gdbarch, iq2000_register_name);
- set_gdbarch_address_to_pointer (gdbarch, iq2000_address_to_pointer);
- set_gdbarch_pointer_to_address (gdbarch, iq2000_pointer_to_address);
- set_gdbarch_ptr_bit (gdbarch, 4 * TARGET_CHAR_BIT);
- set_gdbarch_short_bit (gdbarch, 2 * TARGET_CHAR_BIT);
- set_gdbarch_int_bit (gdbarch, 4 * TARGET_CHAR_BIT);
- set_gdbarch_long_bit (gdbarch, 4 * TARGET_CHAR_BIT);
- set_gdbarch_long_long_bit (gdbarch, 8 * TARGET_CHAR_BIT);
- set_gdbarch_float_bit (gdbarch, 4 * TARGET_CHAR_BIT);
- set_gdbarch_double_bit (gdbarch, 8 * TARGET_CHAR_BIT);
- set_gdbarch_long_double_bit (gdbarch, 8 * TARGET_CHAR_BIT);
- set_gdbarch_float_format (gdbarch, floatformats_ieee_single);
- set_gdbarch_double_format (gdbarch, floatformats_ieee_double);
- set_gdbarch_long_double_format (gdbarch, floatformats_ieee_double);
- set_gdbarch_return_value (gdbarch, iq2000_return_value);
+ set_gdbarch_num_regs (gdbarch, E_NUM_REGS);
+ set_gdbarch_num_pseudo_regs (gdbarch, 0);
+ set_gdbarch_sp_regnum (gdbarch, E_SP_REGNUM);
+ set_gdbarch_pc_regnum (gdbarch, E_PC_REGNUM);
+ set_gdbarch_register_name (gdbarch, iq2000_register_name);
+ set_gdbarch_address_to_pointer (gdbarch, iq2000_address_to_pointer);
+ set_gdbarch_pointer_to_address (gdbarch, iq2000_pointer_to_address);
+ set_gdbarch_ptr_bit (gdbarch, 4 * TARGET_CHAR_BIT);
+ set_gdbarch_short_bit (gdbarch, 2 * TARGET_CHAR_BIT);
+ set_gdbarch_int_bit (gdbarch, 4 * TARGET_CHAR_BIT);
+ set_gdbarch_long_bit (gdbarch, 4 * TARGET_CHAR_BIT);
+ set_gdbarch_long_long_bit (gdbarch, 8 * TARGET_CHAR_BIT);
+ set_gdbarch_float_bit (gdbarch, 4 * TARGET_CHAR_BIT);
+ set_gdbarch_double_bit (gdbarch, 8 * TARGET_CHAR_BIT);
+ set_gdbarch_long_double_bit (gdbarch, 8 * TARGET_CHAR_BIT);
+ set_gdbarch_float_format (gdbarch, floatformats_ieee_single);
+ set_gdbarch_double_format (gdbarch, floatformats_ieee_double);
+ set_gdbarch_long_double_format (gdbarch, floatformats_ieee_double);
+ set_gdbarch_return_value (gdbarch, iq2000_return_value);
set_gdbarch_breakpoint_kind_from_pc (gdbarch,
iq2000_breakpoint_kind_from_pc);
set_gdbarch_sw_breakpoint_from_kind (gdbarch,
iq2000_sw_breakpoint_from_kind);
- set_gdbarch_frame_args_skip (gdbarch, 0);
- set_gdbarch_skip_prologue (gdbarch, iq2000_skip_prologue);
- set_gdbarch_inner_than (gdbarch, core_addr_lessthan);
+ set_gdbarch_frame_args_skip (gdbarch, 0);
+ set_gdbarch_skip_prologue (gdbarch, iq2000_skip_prologue);
+ set_gdbarch_inner_than (gdbarch, core_addr_lessthan);
set_gdbarch_register_type (gdbarch, iq2000_register_type);
set_gdbarch_frame_align (gdbarch, iq2000_frame_align);
frame_base_set_default (gdbarch, &iq2000_frame_base);
@@ -840,6 +850,7 @@ iq2000_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
Called by gdb at start-up. */
void _initialize_iq2000_tdep ();
+
void
_initialize_iq2000_tdep ()
{
diff --git a/gdb/jit.c b/gdb/jit.c
index 48bfef0a026..dee9ebb3ad9 100644
--- a/gdb/jit.c
+++ b/gdb/jit.c
@@ -62,10 +62,10 @@ static bool jit_debug = false;
debug_prefixed_printf_cond (jit_debug, "jit", fmt, ##__VA_ARGS__)
static void
-show_jit_debug (struct ui_file *file, int from_tty,
- struct cmd_list_element *c, const char *value)
+show_jit_debug (struct ui_file *file, int from_tty, struct cmd_list_element *c,
+ const char *value)
{
- gdb_printf (file, _("JIT debugging is %s.\n"), value);
+ gdb_printf (file, _ ("JIT debugging is %s.\n"), value);
}
/* Implementation of the "maintenance info jit" command. */
@@ -99,8 +99,8 @@ maint_info_jit_cmd (const char *args, int from_tty)
"jit_code_entry address");
current_uiout->table_header (std::max (addr_width, 15), ui_left,
"symfile-address", "symfile address");
- current_uiout->table_header (20, ui_left,
- "symfile-size", "symfile size");
+ current_uiout->table_header (20, ui_left, "symfile-size",
+ "symfile size");
current_uiout->table_body ();
printed_header = true;
@@ -113,7 +113,7 @@ maint_info_jit_cmd (const char *args, int from_tty)
current_uiout->field_core_addr ("symfile-address", obj->arch (),
obj->jited_data->symfile_addr);
current_uiout->field_unsigned ("symfile-size",
- obj->jited_data->symfile_size);
+ obj->jited_data->symfile_size);
current_uiout->text ("\n");
}
}
@@ -121,14 +121,12 @@ maint_info_jit_cmd (const char *args, int from_tty)
struct jit_reader
{
jit_reader (struct gdb_reader_funcs *f, gdb_dlhandle_up &&h)
- : functions (f), handle (std::move (h))
+ : functions (f),
+ handle (std::move (h))
{
}
- ~jit_reader ()
- {
- functions->destroy (functions);
- }
+ ~jit_reader () { functions->destroy (functions); }
DISABLE_COPY_AND_ASSIGN (jit_reader);
@@ -141,7 +139,7 @@ struct jit_reader
static struct jit_reader *loaded_jit_reader = NULL;
-typedef struct gdb_reader_funcs * (reader_init_fn_type) (void);
+typedef struct gdb_reader_funcs *(reader_init_fn_type) (void);
static const char reader_init_fn_sym[] = "gdb_init_reader";
/* Try to load FILE_NAME as a JIT debug info reader. */
@@ -158,15 +156,15 @@ jit_reader_load (const char *file_name)
init_fn = (reader_init_fn_type *) gdb_dlsym (so, reader_init_fn_sym);
if (!init_fn)
- error (_("Could not locate initialization function: %s."),
+ error (_ ("Could not locate initialization function: %s."),
reader_init_fn_sym);
if (gdb_dlsym (so, "plugin_is_GPL_compatible") == NULL)
- error (_("Reader not GPL compatible."));
+ error (_ ("Reader not GPL compatible."));
funcs = init_fn ();
if (funcs->reader_version != GDB_READER_INTERFACE_VERSION)
- error (_("Reader version does not match GDB version."));
+ error (_ ("Reader version does not match GDB version."));
return new jit_reader (funcs, std::move (so));
}
@@ -177,15 +175,15 @@ static void
jit_reader_load_command (const char *args, int from_tty)
{
if (args == NULL)
- error (_("No reader name provided."));
+ error (_ ("No reader name provided."));
gdb::unique_xmalloc_ptr<char> file (tilde_expand (args));
if (loaded_jit_reader != NULL)
- error (_("JIT reader already loaded. Run jit-reader-unload first."));
+ error (_ ("JIT reader already loaded. Run jit-reader-unload first."));
if (!IS_ABSOLUTE_PATH (file.get ()))
- file = xstrprintf ("%s%s%s", jit_reader_dir.c_str (),
- SLASH_STRING, file.get ());
+ file = xstrprintf ("%s%s%s", jit_reader_dir.c_str (), SLASH_STRING,
+ file.get ());
loaded_jit_reader = jit_reader_load (file.get ());
reinit_frame_cache ();
@@ -198,7 +196,7 @@ static void
jit_reader_unload_command (const char *args, int from_tty)
{
if (!loaded_jit_reader)
- error (_("No JIT reader loaded."));
+ error (_ ("No JIT reader loaded."));
reinit_frame_cache ();
jit_inferior_exit_hook (current_inferior ());
@@ -244,8 +242,7 @@ add_objfile_entry (struct objfile *objfile, CORE_ADDR entry,
memory. Returns true if all went well, false otherwise. */
static bool
-jit_read_descriptor (gdbarch *gdbarch,
- jit_descriptor *descriptor,
+jit_read_descriptor (gdbarch *gdbarch, jit_descriptor *descriptor,
objfile *jiter)
{
int err;
@@ -266,25 +263,25 @@ jit_read_descriptor (gdbarch *gdbarch,
/* Figure out how big the descriptor is on the remote and how to read it. */
ptr_type = builtin_type (gdbarch)->builtin_data_ptr;
ptr_size = ptr_type->length ();
- desc_size = 8 + 2 * ptr_size; /* Two 32-bit ints and two pointers. */
+ desc_size = 8 + 2 * ptr_size; /* Two 32-bit ints and two pointers. */
desc_buf = (gdb_byte *) alloca (desc_size);
/* Read the descriptor. */
err = target_read_memory (addr, desc_buf, desc_size);
if (err)
{
- gdb_printf (gdb_stderr, _("Unable to read JIT descriptor from "
- "remote memory\n"));
+ gdb_printf (gdb_stderr, _ ("Unable to read JIT descriptor from "
+ "remote memory\n"));
return false;
}
/* Fix the endianness to match the host. */
descriptor->version = extract_unsigned_integer (&desc_buf[0], 4, byte_order);
- descriptor->action_flag =
- extract_unsigned_integer (&desc_buf[4], 4, byte_order);
+ descriptor->action_flag
+ = extract_unsigned_integer (&desc_buf[4], 4, byte_order);
descriptor->relevant_entry = extract_typed_address (&desc_buf[8], ptr_type);
- descriptor->first_entry =
- extract_typed_address (&desc_buf[8 + ptr_size], ptr_type);
+ descriptor->first_entry
+ = extract_typed_address (&desc_buf[8 + ptr_size], ptr_type);
return true;
}
@@ -292,8 +289,8 @@ jit_read_descriptor (gdbarch *gdbarch,
/* Helper function for reading a JITed code entry from remote memory. */
static void
-jit_read_code_entry (struct gdbarch *gdbarch,
- CORE_ADDR code_addr, struct jit_code_entry *code_entry)
+jit_read_code_entry (struct gdbarch *gdbarch, CORE_ADDR code_addr,
+ struct jit_code_entry *code_entry)
{
int err, off;
struct type *ptr_type;
@@ -312,23 +309,23 @@ jit_read_code_entry (struct gdbarch *gdbarch,
off = 3 * ptr_size;
off = (off + (align_bytes - 1)) & ~(align_bytes - 1);
- entry_size = off + 8; /* Three pointers and one 64-bit int. */
+ entry_size = off + 8; /* Three pointers and one 64-bit int. */
entry_buf = (gdb_byte *) alloca (entry_size);
/* Read the entry. */
err = target_read_memory (code_addr, entry_buf, entry_size);
if (err)
- error (_("Unable to read JIT code entry from remote memory!"));
+ error (_ ("Unable to read JIT code entry from remote memory!"));
/* Fix the endianness to match the host. */
ptr_type = builtin_type (gdbarch)->builtin_data_ptr;
code_entry->next_entry = extract_typed_address (&entry_buf[0], ptr_type);
- code_entry->prev_entry =
- extract_typed_address (&entry_buf[ptr_size], ptr_type);
- code_entry->symfile_addr =
- extract_typed_address (&entry_buf[2 * ptr_size], ptr_type);
- code_entry->symfile_size =
- extract_unsigned_integer (&entry_buf[off], 8, byte_order);
+ code_entry->prev_entry
+ = extract_typed_address (&entry_buf[ptr_size], ptr_type);
+ code_entry->symfile_addr
+ = extract_typed_address (&entry_buf[2 * ptr_size], ptr_type);
+ code_entry->symfile_size
+ = extract_unsigned_integer (&entry_buf[off], 8, byte_order);
}
/* Proxy object for building a block. */
@@ -341,7 +338,8 @@ struct gdb_block
begin (begin),
end (end),
name (name != nullptr ? xstrdup (name) : nullptr)
- {}
+ {
+ }
/* The parent of this block. */
struct gdb_block *parent;
@@ -365,7 +363,8 @@ struct gdb_symtab
{
explicit gdb_symtab (const char *file_name)
: file_name (file_name != nullptr ? file_name : "")
- {}
+ {
+ }
/* The list of blocks in this symtab. These will eventually be
converted to real blocks.
@@ -419,8 +418,8 @@ struct jit_dbg_reader_data
static enum gdb_status
jit_target_read_impl (GDB_CORE_ADDR target_mem, void *gdb_buf, int len)
{
- int result = target_read_memory ((CORE_ADDR) target_mem,
- (gdb_byte *) gdb_buf, len);
+ int result
+ = target_read_memory ((CORE_ADDR) target_mem, (gdb_byte *) gdb_buf, len);
if (result == 0)
return GDB_SUCCESS;
else
@@ -445,8 +444,7 @@ jit_object_open_impl (struct gdb_symbol_callbacks *cb)
static struct gdb_symtab *
jit_symtab_open_impl (struct gdb_symbol_callbacks *cb,
- struct gdb_object *object,
- const char *file_name)
+ struct gdb_object *object, const char *file_name)
{
/* CB stays unused. See comment in jit_object_open_impl. */
@@ -522,13 +520,12 @@ finalize_symtab (struct gdb_symtab *stab, struct objfile *objfile)
int actual_nblocks = FIRST_LOCAL_BLOCK + stab->nblocks;
/* Sort the blocks in the order they should appear in the blockvector. */
- stab->blocks.sort([] (const gdb_block &a, const gdb_block &b)
- {
- if (a.begin != b.begin)
- return a.begin < b.begin;
+ stab->blocks.sort ([] (const gdb_block &a, const gdb_block &b) {
+ if (a.begin != b.begin)
+ return a.begin < b.begin;
- return a.end > b.end;
- });
+ return a.end > b.end;
+ });
cust = allocate_compunit_symtab (objfile, stab->file_name.c_str ());
symtab *filetab = allocate_symtab (cust, stab->file_name.c_str ());
@@ -540,11 +537,11 @@ finalize_symtab (struct gdb_symtab *stab, struct objfile *objfile)
/* Copy over the linetable entry if one was provided. */
if (stab->linetable)
{
- size_t size = ((stab->linetable->nitems - 1)
- * sizeof (struct linetable_entry)
- + sizeof (struct linetable));
- filetab->set_linetable ((struct linetable *)
- obstack_alloc (&objfile->objfile_obstack, size));
+ size_t size
+ = ((stab->linetable->nitems - 1) * sizeof (struct linetable_entry)
+ + sizeof (struct linetable));
+ filetab->set_linetable (
+ (struct linetable *) obstack_alloc (&objfile->objfile_obstack, size));
memcpy (filetab->linetable (), stab->linetable.get (), size);
}
@@ -569,13 +566,11 @@ finalize_symtab (struct gdb_symtab *stab, struct objfile *objfile)
{
struct block *new_block = allocate_block (&objfile->objfile_obstack);
struct symbol *block_name = new (&objfile->objfile_obstack) symbol;
- struct type *block_type = arch_type (objfile->arch (),
- TYPE_CODE_VOID,
- TARGET_CHAR_BIT,
- "void");
+ struct type *block_type = arch_type (objfile->arch (), TYPE_CODE_VOID,
+ TARGET_CHAR_BIT, "void");
- new_block->set_multidict
- (mdict_create_linear (&objfile->objfile_obstack, NULL));
+ new_block->set_multidict (mdict_create_linear (&objfile->objfile_obstack,
+ NULL));
/* The address range. */
new_block->set_start (gdb_block_iter.begin);
new_block->set_end (gdb_block_iter.end);
@@ -610,10 +605,10 @@ finalize_symtab (struct gdb_symtab *stab, struct objfile *objfile)
struct block *new_block;
new_block = (i == GLOBAL_BLOCK
- ? allocate_global_block (&objfile->objfile_obstack)
- : allocate_block (&objfile->objfile_obstack));
- new_block->set_multidict
- (mdict_create_linear (&objfile->objfile_obstack, NULL));
+ ? allocate_global_block (&objfile->objfile_obstack)
+ : allocate_block (&objfile->objfile_obstack));
+ new_block->set_multidict (mdict_create_linear (&objfile->objfile_obstack,
+ NULL));
new_block->set_superblock (block_iter);
block_iter = new_block;
@@ -634,9 +629,8 @@ finalize_symtab (struct gdb_symtab *stab, struct objfile *objfile)
{
/* If the plugin specifically mentioned a parent block, we
use that. */
- gdb_block_iter.real_block->set_superblock
- (gdb_block_iter.parent->real_block);
-
+ gdb_block_iter.real_block->set_superblock (
+ gdb_block_iter.parent->real_block);
}
else
{
@@ -650,8 +644,7 @@ finalize_symtab (struct gdb_symtab *stab, struct objfile *objfile)
objfile. */
static void
-jit_object_close_impl (struct gdb_symbol_callbacks *cb,
- struct gdb_object *obj)
+jit_object_close_impl (struct gdb_symbol_callbacks *cb, struct gdb_object *obj)
{
jit_dbg_reader_data *priv_data = (jit_dbg_reader_data *) cb->priv_data;
std::string objfile_name
@@ -659,8 +652,8 @@ jit_object_close_impl (struct gdb_symbol_callbacks *cb,
paddress (priv_data->gdbarch,
priv_data->entry.symfile_addr));
- objfile *objfile = objfile::make (nullptr, objfile_name.c_str (),
- OBJF_NOT_FILENAME);
+ objfile *objfile
+ = objfile::make (nullptr, objfile_name.c_str (), OBJF_NOT_FILENAME);
objfile->per_bfd->gdbarch = priv_data->gdbarch;
for (gdb_symtab &symtab : obj->symtabs)
@@ -682,26 +675,18 @@ jit_reader_try_read_symtab (gdbarch *gdbarch, jit_code_entry *code_entry,
CORE_ADDR entry_addr)
{
int status;
- jit_dbg_reader_data priv_data
- {
- entry_addr,
- *code_entry,
- gdbarch
- };
+ jit_dbg_reader_data priv_data { entry_addr, *code_entry, gdbarch };
struct gdb_reader_funcs *funcs;
- struct gdb_symbol_callbacks callbacks =
- {
- jit_object_open_impl,
- jit_symtab_open_impl,
- jit_block_open_impl,
- jit_symtab_close_impl,
- jit_object_close_impl,
+ struct gdb_symbol_callbacks callbacks = { jit_object_open_impl,
+ jit_symtab_open_impl,
+ jit_block_open_impl,
+ jit_symtab_close_impl,
+ jit_object_close_impl,
- jit_symtab_line_mapping_add_impl,
- jit_target_read_impl,
+ jit_symtab_line_mapping_add_impl,
+ jit_target_read_impl,
- &priv_data
- };
+ &priv_data };
if (!loaded_jit_reader)
return 0;
@@ -740,8 +725,7 @@ jit_reader_try_read_symtab (gdbarch *gdbarch, jit_code_entry *code_entry,
static void
jit_bfd_try_read_symtab (struct jit_code_entry *code_entry,
- CORE_ADDR entry_addr,
- struct gdbarch *gdbarch)
+ CORE_ADDR entry_addr, struct gdbarch *gdbarch)
{
struct bfd_section *sec;
struct objfile *objfile;
@@ -751,11 +735,11 @@ jit_bfd_try_read_symtab (struct jit_code_entry *code_entry,
paddress (gdbarch, code_entry->symfile_addr),
pulongest (code_entry->symfile_size));
- gdb_bfd_ref_ptr nbfd (gdb_bfd_open_from_target_memory
- (code_entry->symfile_addr, code_entry->symfile_size, gnutarget));
+ gdb_bfd_ref_ptr nbfd (gdb_bfd_open_from_target_memory (
+ code_entry->symfile_addr, code_entry->symfile_size, gnutarget));
if (nbfd == NULL)
{
- gdb_puts (_("Error opening JITed symbol file, ignoring it.\n"),
+ gdb_puts (_ ("Error opening JITed symbol file, ignoring it.\n"),
gdb_stderr);
return;
}
@@ -764,7 +748,7 @@ jit_bfd_try_read_symtab (struct jit_code_entry *code_entry,
We would segfault later without this line. */
if (!bfd_check_format (nbfd.get (), bfd_object))
{
- gdb_printf (gdb_stderr, _("\
+ gdb_printf (gdb_stderr, _ ("\
JITed symbol file is not an object file, ignoring it.\n"));
return;
}
@@ -772,8 +756,8 @@ JITed symbol file is not an object file, ignoring it.\n"));
/* Check bfd arch. */
b = gdbarch_bfd_arch_info (gdbarch);
if (b->compatible (b, bfd_get_arch_info (nbfd.get ())) != b)
- warning (_("JITed object file architecture %s is not compatible "
- "with target architecture %s."),
+ warning (_ ("JITed object file architecture %s is not compatible "
+ "with target architecture %s."),
bfd_get_arch_info (nbfd.get ())->printable_name,
b->printable_name);
@@ -782,20 +766,18 @@ JITed symbol file is not an object file, ignoring it.\n"));
addresses that we care about. */
section_addr_info sai;
for (sec = nbfd->sections; sec != NULL; sec = sec->next)
- if ((bfd_section_flags (sec) & (SEC_ALLOC|SEC_LOAD)) != 0)
+ if ((bfd_section_flags (sec) & (SEC_ALLOC | SEC_LOAD)) != 0)
{
/* We assume that these virtual addresses are absolute, and do not
treat them as offsets. */
- sai.emplace_back (bfd_section_vma (sec),
- bfd_section_name (sec),
+ sai.emplace_back (bfd_section_vma (sec), bfd_section_name (sec),
sec->index);
}
/* This call does not take ownership of SAI. */
- objfile = symbol_file_add_from_bfd (nbfd,
- bfd_get_filename (nbfd.get ()), 0,
- &sai,
- OBJF_SHARED | OBJF_NOT_FILENAME, NULL);
+ objfile
+ = symbol_file_add_from_bfd (nbfd, bfd_get_filename (nbfd.get ()), 0, &sai,
+ OBJF_SHARED | OBJF_NOT_FILENAME, NULL);
add_objfile_entry (objfile, entry_addr, code_entry->symfile_addr,
code_entry->symfile_size);
@@ -807,8 +789,8 @@ JITed symbol file is not an object file, ignoring it.\n"));
a symbol file added by the user. */
static void
-jit_register_code (struct gdbarch *gdbarch,
- CORE_ADDR entry_addr, struct jit_code_entry *code_entry)
+jit_register_code (struct gdbarch *gdbarch, CORE_ADDR entry_addr,
+ struct jit_code_entry *code_entry)
{
int success;
@@ -880,8 +862,7 @@ jit_breakpoint_re_set_internal (struct gdbarch *gdbarch, program_space *pspace)
assume we are not attached to a JIT. */
bound_minimal_symbol reg_symbol
= lookup_minimal_symbol (jit_break_name, nullptr, the_objfile);
- if (reg_symbol.minsym == NULL
- || reg_symbol.value_address () == 0)
+ if (reg_symbol.minsym == NULL || reg_symbol.value_address () == 0)
{
/* No need to repeat the lookup the next time. */
the_objfile->skip_jit_symbol_lookup = true;
@@ -890,16 +871,14 @@ jit_breakpoint_re_set_internal (struct gdbarch *gdbarch, program_space *pspace)
bound_minimal_symbol desc_symbol
= lookup_minimal_symbol (jit_descriptor_name, NULL, the_objfile);
- if (desc_symbol.minsym == NULL
- || desc_symbol.value_address () == 0)
+ if (desc_symbol.minsym == NULL || desc_symbol.value_address () == 0)
{
/* No need to repeat the lookup the next time. */
the_objfile->skip_jit_symbol_lookup = true;
continue;
}
- jiter_objfile_data *objf_data
- = get_jiter_objfile_data (the_objfile);
+ jiter_objfile_data *objf_data = get_jiter_objfile_data (the_objfile);
objf_data->register_code = reg_symbol.minsym;
objf_data->descriptor = desc_symbol.minsym;
@@ -978,10 +957,10 @@ jit_unwind_reg_get_impl (struct gdb_unwind_callbacks *cb, int regnum)
gdb_reg = gdbarch_dwarf2_reg_to_regnum (frame_arch, regnum);
size = register_size (frame_arch, gdb_reg);
- value = ((struct gdb_reg_value *)
- xmalloc (sizeof (struct gdb_reg_value) + size - 1));
- value->defined = deprecated_frame_register_read (priv->this_frame, gdb_reg,
- value->value);
+ value = ((struct gdb_reg_value *) xmalloc (sizeof (struct gdb_reg_value)
+ + size - 1));
+ value->defined
+ = deprecated_frame_register_read (priv->this_frame, gdb_reg, value->value);
value->size = size;
value->free = reg_value_free_impl;
return value;
@@ -1006,8 +985,8 @@ jit_dealloc_cache (frame_info *this_frame, void *cache)
register values. */
static int
-jit_frame_sniffer (const struct frame_unwind *self,
- frame_info_ptr this_frame, void **cache)
+jit_frame_sniffer (const struct frame_unwind *self, frame_info_ptr this_frame,
+ void **cache)
{
struct jit_unwind_private *priv_data;
struct gdb_unwind_callbacks callbacks;
@@ -1027,8 +1006,8 @@ jit_frame_sniffer (const struct frame_unwind *self,
priv_data = new struct jit_unwind_private;
*cache = priv_data;
/* Take a snapshot of current regcache. */
- priv_data->regcache.reset
- (new detached_regcache (get_frame_arch (this_frame), true));
+ priv_data->regcache.reset (
+ new detached_regcache (get_frame_arch (this_frame), true));
priv_data->this_frame = this_frame;
callbacks.priv_data = priv_data;
@@ -1048,7 +1027,6 @@ jit_frame_sniffer (const struct frame_unwind *self,
return 0;
}
-
/* The frame_id function for the pseudo unwinder. Relays the call to
the loaded plugin. */
@@ -1103,18 +1081,15 @@ jit_frame_prev_register (frame_info_ptr this_frame, void **cache, int reg)
/* Relay everything back to the unwinder registered by the JIT debug
info reader.*/
-static const struct frame_unwind jit_frame_unwind =
-{
- "jit",
- NORMAL_FRAME,
- default_frame_unwind_stop_reason,
- jit_frame_this_id,
- jit_frame_prev_register,
- NULL,
- jit_frame_sniffer,
- jit_dealloc_cache
-};
-
+static const struct frame_unwind jit_frame_unwind
+ = { "jit",
+ NORMAL_FRAME,
+ default_frame_unwind_stop_reason,
+ jit_frame_this_id,
+ jit_frame_prev_register,
+ NULL,
+ jit_frame_sniffer,
+ jit_dealloc_cache };
/* This is the information that is stored at jit_gdbarch_data for each
architecture. */
@@ -1178,8 +1153,8 @@ jit_inferior_init (inferior *inf)
if (descriptor.version != 1)
{
gdb_printf (gdb_stderr,
- _("Unsupported JIT protocol version %ld "
- "in descriptor (expected 1)\n"),
+ _ ("Unsupported JIT protocol version %ld "
+ "in descriptor (expected 1)\n"),
(long) descriptor.version);
continue;
}
@@ -1187,8 +1162,7 @@ jit_inferior_init (inferior *inf)
/* If we've attached to a running program, we need to check the
descriptor to register any functions that were already
generated. */
- for (cur_entry_addr = descriptor.first_entry;
- cur_entry_addr != 0;
+ for (cur_entry_addr = descriptor.first_entry; cur_entry_addr != 0;
cur_entry_addr = cur_entry.next_entry)
{
jit_read_code_entry (gdbarch, cur_entry_addr, &cur_entry);
@@ -1270,8 +1244,8 @@ jit_event_handler (gdbarch *gdbarch, objfile *jiter)
objfile *jited = jit_find_objf_with_entry_addr (entry_addr);
if (jited == nullptr)
gdb_printf (gdb_stderr,
- _("Unable to find JITed code "
- "entry at address: %s\n"),
+ _ ("Unable to find JITed code "
+ "entry at address: %s\n"),
paddress (gdbarch, entry_addr));
else
jited->unlink ();
@@ -1280,27 +1254,25 @@ jit_event_handler (gdbarch *gdbarch, objfile *jiter)
}
default:
- error (_("Unknown action_flag value in JIT descriptor!"));
+ error (_ ("Unknown action_flag value in JIT descriptor!"));
break;
}
}
void _initialize_jit ();
+
void
_initialize_jit ()
{
- jit_reader_dir = relocate_gdb_directory (JIT_READER_DIR,
- JIT_READER_DIR_RELOCATABLE);
+ jit_reader_dir
+ = relocate_gdb_directory (JIT_READER_DIR, JIT_READER_DIR_RELOCATABLE);
add_setshow_boolean_cmd ("jit", class_maintenance, &jit_debug,
- _("Set JIT debugging."),
- _("Show JIT debugging."),
- _("When set, JIT debugging is enabled."),
- NULL,
- show_jit_debug,
- &setdebuglist, &showdebuglist);
+ _ ("Set JIT debugging."), _ ("Show JIT debugging."),
+ _ ("When set, JIT debugging is enabled."), NULL,
+ show_jit_debug, &setdebuglist, &showdebuglist);
add_cmd ("jit", class_maintenance, maint_info_jit_cmd,
- _("Print information about JIT-ed code objects."),
+ _ ("Print information about JIT-ed code objects."),
&maintenanceinfolist);
gdb::observers::inferior_created.attach (jit_inferior_created_hook, "jit");
@@ -1312,7 +1284,7 @@ _initialize_jit ()
{
struct cmd_list_element *c;
- c = add_com ("jit-reader-load", no_class, jit_reader_load_command, _("\
+ c = add_com ("jit-reader-load", no_class, jit_reader_load_command, _ ("\
Load FILE as debug info reader and unwinder for JIT compiled code.\n\
Usage: jit-reader-load FILE\n\
Try to load file FILE as a debug info reader (and unwinder) for\n\
@@ -1320,8 +1292,8 @@ JIT compiled code. The file is loaded from " JIT_READER_DIR ",\n\
relocated relative to the GDB executable if required."));
set_cmd_completer (c, filename_completer);
- c = add_com ("jit-reader-unload", no_class,
- jit_reader_unload_command, _("\
+ c = add_com ("jit-reader-unload", no_class, jit_reader_unload_command,
+ _ ("\
Unload the currently loaded JIT debug info reader.\n\
Usage: jit-reader-unload\n\n\
Do \"help jit-reader-load\" for info on loading debug info readers."));
diff --git a/gdb/jit.h b/gdb/jit.h
index 6b6f22eaa97..c37104395f9 100644
--- a/gdb/jit.h
+++ b/gdb/jit.h
@@ -100,7 +100,8 @@ struct jited_objfile_data
: addr (addr),
symfile_addr (symfile_addr),
symfile_size (symfile_size)
- {}
+ {
+ }
/* Address of struct jit_code_entry for this objfile. */
CORE_ADDR addr;
diff --git a/gdb/language.c b/gdb/language.c
index 50a53c647f5..5943387c5ac 100644
--- a/gdb/language.c
+++ b/gdb/language.c
@@ -54,18 +54,20 @@ static void set_range_case (void);
range_mode_manual: range_check set manually by user. */
enum range_mode
- {
- range_mode_auto, range_mode_manual
- };
+{
+ range_mode_auto,
+ range_mode_manual
+};
/* case_mode ==
case_mode_auto: case_sensitivity set upon selection of scope.
case_mode_manual: case_sensitivity set only by user. */
enum case_mode
- {
- case_mode_auto, case_mode_manual
- };
+{
+ case_mode_auto,
+ case_mode_manual
+};
/* The current (default at startup) state of type and range checking.
(If the modes are set to "auto", though, these are changed based
@@ -98,9 +100,9 @@ static const char *range;
static const char *case_sensitive;
/* See language.h. */
-const char lang_frame_mismatch_warn[] =
-N_("Warning: the current language does not match this frame.");
-
+const char lang_frame_mismatch_warn[]
+ = N_ ("Warning: the current language does not match this frame.");
+
/* This page contains the functions corresponding to GDB commands
and their helpers. */
@@ -110,16 +112,15 @@ static void
show_language_command (struct ui_file *file, int from_tty,
struct cmd_list_element *c, const char *value)
{
- enum language flang; /* The language of the frame. */
+ enum language flang; /* The language of the frame. */
if (language_mode == language_mode_auto)
gdb_printf (file,
- _("The current source language is "
- "\"auto; currently %s\".\n"),
+ _ ("The current source language is "
+ "\"auto; currently %s\".\n"),
current_language->name ());
else
- gdb_printf (file,
- _("The current source language is \"%s\".\n"),
+ gdb_printf (file, _ ("The current source language is \"%s\".\n"),
current_language->name ());
if (has_stack_frames ())
@@ -128,17 +129,16 @@ show_language_command (struct ui_file *file, int from_tty,
frame = get_selected_frame (NULL);
flang = get_frame_language (frame);
- if (flang != language_unknown
- && language_mode == language_mode_manual
+ if (flang != language_unknown && language_mode == language_mode_manual
&& current_language->la_language != flang)
- gdb_printf (file, "%s\n", _(lang_frame_mismatch_warn));
+ gdb_printf (file, "%s\n", _ (lang_frame_mismatch_warn));
}
}
/* Set command. Change the current working language. */
static void
-set_language_command (const char *ignore,
- int from_tty, struct cmd_list_element *c)
+set_language_command (const char *ignore, int from_tty,
+ struct cmd_list_element *c)
{
enum language flang = language_unknown;
@@ -217,25 +217,23 @@ show_range_command (struct ui_file *file, int from_tty,
internal_error ("Unrecognized range check setting.");
}
- gdb_printf (file,
- _("Range checking is \"auto; currently %s\".\n"),
+ gdb_printf (file, _ ("Range checking is \"auto; currently %s\".\n"),
tmp);
}
else
- gdb_printf (file, _("Range checking is \"%s\".\n"),
- value);
+ gdb_printf (file, _ ("Range checking is \"%s\".\n"), value);
if (range_check == range_check_warn
|| ((range_check == range_check_on)
!= current_language->range_checking_on_by_default ()))
- warning (_("the current range check setting "
- "does not match the language.\n"));
+ warning (_ ("the current range check setting "
+ "does not match the language.\n"));
}
/* Set command. Change the setting for range checking. */
static void
-set_range_command (const char *ignore,
- int from_tty, struct cmd_list_element *c)
+set_range_command (const char *ignore, int from_tty,
+ struct cmd_list_element *c)
{
if (strcmp (range, "on") == 0)
{
@@ -260,13 +258,13 @@ set_range_command (const char *ignore,
}
else
{
- internal_error (_("Unrecognized range check setting: \"%s\""), range);
+ internal_error (_ ("Unrecognized range check setting: \"%s\""), range);
}
if (range_check == range_check_warn
|| ((range_check == range_check_on)
!= current_language->range_checking_on_by_default ()))
- warning (_("the current range check setting "
- "does not match the language.\n"));
+ warning (_ ("the current range check setting "
+ "does not match the language.\n"));
}
/* Show command. Display a warning if the case sensitivity setting does
@@ -292,18 +290,17 @@ show_case_command (struct ui_file *file, int from_tty,
}
gdb_printf (file,
- _("Case sensitivity in "
- "name search is \"auto; currently %s\".\n"),
+ _ ("Case sensitivity in "
+ "name search is \"auto; currently %s\".\n"),
tmp);
}
else
- gdb_printf (file,
- _("Case sensitivity in name search is \"%s\".\n"),
+ gdb_printf (file, _ ("Case sensitivity in name search is \"%s\".\n"),
value);
if (case_sensitivity != current_language->case_sensitivity ())
- warning (_("the current case sensitivity setting does not match "
- "the language.\n"));
+ warning (_ ("the current case sensitivity setting does not match "
+ "the language.\n"));
}
/* Set command. Change the setting for case sensitivity. */
@@ -311,30 +308,30 @@ show_case_command (struct ui_file *file, int from_tty,
static void
set_case_command (const char *ignore, int from_tty, struct cmd_list_element *c)
{
- if (strcmp (case_sensitive, "on") == 0)
- {
- case_sensitivity = case_sensitive_on;
- case_mode = case_mode_manual;
- }
- else if (strcmp (case_sensitive, "off") == 0)
- {
- case_sensitivity = case_sensitive_off;
- case_mode = case_mode_manual;
- }
- else if (strcmp (case_sensitive, "auto") == 0)
- {
- case_mode = case_mode_auto;
- set_range_case ();
- return;
- }
- else
- {
- internal_error ("Unrecognized case-sensitive setting: \"%s\"",
- case_sensitive);
- }
-
- if (case_sensitivity != current_language->case_sensitivity ())
- warning (_("the current case sensitivity setting does not match "
+ if (strcmp (case_sensitive, "on") == 0)
+ {
+ case_sensitivity = case_sensitive_on;
+ case_mode = case_mode_manual;
+ }
+ else if (strcmp (case_sensitive, "off") == 0)
+ {
+ case_sensitivity = case_sensitive_off;
+ case_mode = case_mode_manual;
+ }
+ else if (strcmp (case_sensitive, "auto") == 0)
+ {
+ case_mode = case_mode_auto;
+ set_range_case ();
+ return;
+ }
+ else
+ {
+ internal_error ("Unrecognized case-sensitive setting: \"%s\"",
+ case_sensitive);
+ }
+
+ if (case_sensitivity != current_language->case_sensitivity ())
+ warning (_ ("the current case sensitivity setting does not match "
"the language.\n"));
}
@@ -346,8 +343,9 @@ static void
set_range_case (void)
{
if (range_mode == range_mode_auto)
- range_check = (current_language->range_checking_on_by_default ()
- ? range_check_on : range_check_off);
+ range_check
+ = (current_language->range_checking_on_by_default () ? range_check_on
+ : range_check_off);
if (case_mode == case_mode_auto)
case_sensitivity = current_language->case_sensitivity ();
@@ -366,7 +364,6 @@ set_language (enum language lang)
set_range_case ();
return prev_language;
}
-
/* See language.h. */
@@ -377,10 +374,10 @@ language_info ()
return;
expected_language = current_language;
- gdb_printf (_("Current language: %s\n"), language);
+ gdb_printf (_ ("Current language: %s\n"), language);
show_language_command (gdb_stdout, 1, NULL, NULL);
}
-
+
/* This page contains functions for the printing out of
error messages that occur during type- and range-
checking. */
@@ -392,7 +389,7 @@ language_info ()
otherwise just the message. */
void
-range_error (const char *string,...)
+range_error (const char *string, ...)
{
va_list args;
@@ -412,11 +409,10 @@ range_error (const char *string,...)
gdb_printf (gdb_stderr, "\n");
break;
default:
- internal_error (_("bad switch"));
+ internal_error (_ ("bad switch"));
}
va_end (args);
}
-
/* This page contains miscellaneous functions. */
@@ -453,8 +449,6 @@ language_str (enum language lang)
return language_def (lang)->name ();
}
-
-
/* Build and install the "set language LANG" command. */
static void
@@ -488,15 +482,15 @@ add_set_language_command ()
/* Add the filename extensions. */
for (const auto &lang : language_defn::languages)
- for (const char * const &ext : lang->filename_extensions ())
+ for (const char *const &ext : lang->filename_extensions ())
add_filename_language (ext, lang->la_language);
/* Build the "help set language" docs. */
string_file doc;
- doc.printf (_("Set the current source language.\n"
- "The currently understood settings are:\n\nlocal or "
- "auto Automatic setting based on source file"));
+ doc.printf (_ ("Set the current source language.\n"
+ "The currently understood settings are:\n\nlocal or "
+ "auto Automatic setting based on source file"));
for (const auto &lang : language_defn::languages)
{
@@ -507,18 +501,13 @@ add_set_language_command ()
/* Note that we add the newline at the front, so we don't wind
up with a trailing newline. */
- doc.printf ("\n%-16s Use the %s language",
- lang->name (),
+ doc.printf ("\n%-16s Use the %s language", lang->name (),
lang->natural_name ());
}
- add_setshow_enum_cmd ("language", class_support,
- language_names,
- &language,
- doc.c_str (),
- _("Show the current source language."),
- NULL, set_language_command,
- show_language_command,
+ add_setshow_enum_cmd ("language", class_support, language_names, &language,
+ doc.c_str (), _ ("Show the current source language."),
+ NULL, set_language_command, show_language_command,
&setlist, &showlist);
}
@@ -526,7 +515,7 @@ add_set_language_command ()
any non-NULL struct language_defn.skip_trampoline() functions.
Return the result from the first that returns non-zero, or 0 if all
`fail'. */
-CORE_ADDR
+CORE_ADDR
skip_language_trampoline (frame_info_ptr frame, CORE_ADDR pc)
{
for (const auto &lang : language_defn::languages)
@@ -547,8 +536,8 @@ skip_language_trampoline (frame_info_ptr frame, CORE_ADDR pc)
FIXME: Sometimes the demangler is invoked when we don't know the
language, so we can't use this everywhere. */
gdb::unique_xmalloc_ptr<char>
-language_demangle (const struct language_defn *current_language,
- const char *mangled, int options)
+language_demangle (const struct language_defn *current_language,
+ const char *mangled, int options)
{
if (current_language != NULL)
return current_language->demangle_symbol (mangled, options);
@@ -604,7 +593,7 @@ language_defn::watch_location_expression (struct type *type,
void
language_defn::value_print (struct value *val, struct ui_file *stream,
- const struct value_print_options *options) const
+ const struct value_print_options *options) const
{
return c_value_print (val, stream, options);
}
@@ -620,9 +609,9 @@ language_defn::parser (struct parser_state *ps) const
/* See language.h. */
void
-language_defn::value_print_inner
- (struct value *val, struct ui_file *stream, int recurse,
- const struct value_print_options *options) const
+language_defn::value_print_inner (
+ struct value *val, struct ui_file *stream, int recurse,
+ const struct value_print_options *options) const
{
return c_value_print_inner (val, stream, recurse, options);
}
@@ -663,12 +652,13 @@ default_symbol_name_matcher (const char *symbol_search_name,
gdb::string_view name = lookup_name.name ();
completion_match_for_lcd *match_for_lcd
= (comp_match_res != NULL ? &comp_match_res->match_for_lcd : NULL);
- strncmp_iw_mode mode = (lookup_name.completion_mode ()
- ? strncmp_iw_mode::NORMAL
- : strncmp_iw_mode::MATCH_PARAMS);
+ strncmp_iw_mode mode
+ = (lookup_name.completion_mode () ? strncmp_iw_mode::NORMAL
+ : strncmp_iw_mode::MATCH_PARAMS);
if (strncmp_iw_with_mode (symbol_search_name, name.data (), name.size (),
- mode, language_minimal, match_for_lcd) == 0)
+ mode, language_minimal, match_for_lcd)
+ == 0)
{
if (comp_match_res != NULL)
comp_match_res->set_match (symbol_search_name);
@@ -681,8 +671,8 @@ default_symbol_name_matcher (const char *symbol_search_name,
/* See language.h. */
symbol_name_matcher_ftype *
-language_defn::get_symbol_name_matcher
- (const lookup_name_info &lookup_name) const
+language_defn::get_symbol_name_matcher (
+ const lookup_name_info &lookup_name) const
{
/* If currently in Ada mode, and the lookup name is wrapped in
'<...>', hijack all symbol name comparisons using the Ada
@@ -697,8 +687,8 @@ language_defn::get_symbol_name_matcher
/* See language.h. */
symbol_name_matcher_ftype *
-language_defn::get_symbol_name_matcher_inner
- (const lookup_name_info &lookup_name) const
+language_defn::get_symbol_name_matcher_inner (
+ const lookup_name_info &lookup_name) const
{
return default_symbol_name_matcher;
}
@@ -720,9 +710,11 @@ language_defn::varobj_ops () const
class auto_or_unknown_language : public language_defn
{
public:
+
auto_or_unknown_language (enum language lang)
: language_defn (lang)
- { /* Nothing. */ }
+ { /* Nothing. */
+ }
/* See language.h. */
void language_arch_info (struct gdbarch *gdbarch,
@@ -738,7 +730,7 @@ public:
struct ui_file *stream, int show, int level,
const struct type_print_options *flags) const override
{
- error (_("type printing not implemented for language \"%s\""),
+ error (_ ("type printing not implemented for language \"%s\""),
natural_name ());
}
@@ -756,17 +748,17 @@ public:
void value_print (struct value *val, struct ui_file *stream,
const struct value_print_options *options) const override
{
- error (_("value printing not implemented for language \"%s\""),
+ error (_ ("value printing not implemented for language \"%s\""),
natural_name ());
}
/* See language.h. */
- void value_print_inner
- (struct value *val, struct ui_file *stream, int recurse,
- const struct value_print_options *options) const override
+ void
+ value_print_inner (struct value *val, struct ui_file *stream, int recurse,
+ const struct value_print_options *options) const override
{
- error (_("inner value printing not implemented for language \"%s\""),
+ error (_ ("inner value printing not implemented for language \"%s\""),
natural_name ());
}
@@ -774,16 +766,16 @@ public:
int parser (struct parser_state *ps) const override
{
- error (_("expression parsing not implemented for language \"%s\""),
+ error (_ ("expression parsing not implemented for language \"%s\""),
natural_name ());
}
/* See language.h. */
- void emitchar (int ch, struct type *chtype,
- struct ui_file *stream, int quoter) const override
+ void emitchar (int ch, struct type *chtype, struct ui_file *stream,
+ int quoter) const override
{
- error (_("emit character not implemented for language \"%s\""),
+ error (_ ("emit character not implemented for language \"%s\""),
natural_name ());
}
@@ -792,7 +784,7 @@ public:
void printchar (int ch, struct type *chtype,
struct ui_file *stream) const override
{
- error (_("print character not implemented for language \"%s\""),
+ error (_ ("print character not implemented for language \"%s\""),
natural_name ());
}
@@ -803,7 +795,7 @@ public:
const char *encoding, int force_ellipses,
const struct value_print_options *options) const override
{
- error (_("print string not implemented for language \"%s\""),
+ error (_ ("print string not implemented for language \"%s\""),
natural_name ());
}
@@ -812,7 +804,7 @@ public:
void print_typedef (struct type *type, struct symbol *new_symbol,
struct ui_file *stream) const override
{
- error (_("print typedef not implemented for language \"%s\""),
+ error (_ ("print typedef not implemented for language \"%s\""),
natural_name ());
}
@@ -831,8 +823,7 @@ public:
/* See language.h. */
- const char *name_of_this () const override
- { return "this"; }
+ const char *name_of_this () const override { return "this"; }
};
/* Class representing the fake "auto" language. */
@@ -840,19 +831,19 @@ public:
class auto_language : public auto_or_unknown_language
{
public:
+
auto_language ()
: auto_or_unknown_language (language_auto)
- { /* Nothing. */ }
+ { /* Nothing. */
+ }
/* See language.h. */
- const char *name () const override
- { return "auto"; }
+ const char *name () const override { return "auto"; }
/* See language.h. */
- const char *natural_name () const override
- { return "Auto"; }
+ const char *natural_name () const override { return "Auto"; }
};
/* Single instance of the fake "auto" language. */
@@ -864,31 +855,29 @@ static auto_language auto_language_defn;
class unknown_language : public auto_or_unknown_language
{
public:
+
unknown_language ()
: auto_or_unknown_language (language_unknown)
- { /* Nothing. */ }
+ { /* Nothing. */
+ }
/* See language.h. */
- const char *name () const override
- { return "unknown"; }
+ const char *name () const override { return "unknown"; }
/* See language.h. */
- const char *natural_name () const override
- { return "Unknown"; }
+ const char *natural_name () const override { return "Unknown"; }
/* See language.h. */
- bool store_sym_names_in_linkage_form_p () const override
- { return true; }
+ bool store_sym_names_in_linkage_form_p () const override { return true; }
};
/* Single instance of the unknown language class. */
static unknown_language unknown_language_defn;
-
/* Per-architecture language information. */
struct language_gdbarch
@@ -931,8 +920,7 @@ language_string_char_type (const struct language_defn *la,
/* See language.h. */
struct type *
-language_bool_type (const struct language_defn *la,
- struct gdbarch *gdbarch)
+language_bool_type (const struct language_defn *la, struct gdbarch *gdbarch)
{
struct language_gdbarch *ld = get_language_gdbarch (gdbarch);
return ld->arch_info[la->la_language].bool_type ();
@@ -962,8 +950,8 @@ language_arch_info::bool_type () const
/* See language.h. */
struct symbol *
-language_arch_info::type_and_symbol::alloc_type_symbol
- (enum language lang, struct type *type)
+language_arch_info::type_and_symbol::alloc_type_symbol (enum language lang,
+ struct type *type)
{
struct symbol *symbol;
struct gdbarch *gdbarch;
@@ -1009,8 +997,8 @@ language_arch_info::lookup_primitive_type (const char *name)
/* See language.h. */
struct type *
-language_arch_info::lookup_primitive_type
- (gdb::function_view<bool (struct type *)> filter)
+language_arch_info::lookup_primitive_type (
+ gdb::function_view<bool (struct type *)> filter)
{
for (struct type_and_symbol &tas : primitive_types_and_symbols)
{
@@ -1039,8 +1027,7 @@ language_arch_info::lookup_primitive_type_as_symbol (const char *name,
template<typename T>
static struct type *
language_lookup_primitive_type_1 (const struct language_defn *la,
- struct gdbarch *gdbarch,
- T arg)
+ struct gdbarch *gdbarch, T arg)
{
struct language_gdbarch *ld = get_language_gdbarch (gdbarch);
return ld->arch_info[la->la_language].lookup_primitive_type (arg);
@@ -1050,8 +1037,7 @@ language_lookup_primitive_type_1 (const struct language_defn *la,
struct type *
language_lookup_primitive_type (const struct language_defn *la,
- struct gdbarch *gdbarch,
- const char *name)
+ struct gdbarch *gdbarch, const char *name)
{
return language_lookup_primitive_type_1 (la, gdbarch, name);
}
@@ -1059,9 +1045,9 @@ language_lookup_primitive_type (const struct language_defn *la,
/* See language.h. */
struct type *
-language_lookup_primitive_type (const struct language_defn *la,
- struct gdbarch *gdbarch,
- gdb::function_view<bool (struct type *)> filter)
+language_lookup_primitive_type (
+ const struct language_defn *la, struct gdbarch *gdbarch,
+ gdb::function_view<bool (struct type *)> filter)
{
return language_lookup_primitive_type_1 (la, gdbarch, filter);
}
@@ -1076,9 +1062,9 @@ language_lookup_primitive_type_as_symbol (const struct language_defn *la,
struct language_gdbarch *ld = get_language_gdbarch (gdbarch);
struct language_arch_info *lai = &ld->arch_info[la->la_language];
- symbol_lookup_debug_printf
- ("language = \"%s\", gdbarch @ %s, type = \"%s\")",
- la->name (), host_address_to_string (gdbarch), name);
+ symbol_lookup_debug_printf (
+ "language = \"%s\", gdbarch @ %s, type = \"%s\")", la->name (),
+ host_address_to_string (gdbarch), name);
struct symbol *sym
= lai->lookup_primitive_type_as_symbol (name, la->la_language);
@@ -1097,6 +1083,7 @@ language_lookup_primitive_type_as_symbol (const struct language_defn *la,
/* Initialize the language routines. */
void _initialize_language ();
+
void
_initialize_language ()
{
@@ -1110,10 +1097,10 @@ _initialize_language ()
set_show_commands setshow_check_cmds
= add_setshow_prefix_cmd ("check", no_class,
- _("Set the status of the type/range checker."),
- _("Show the status of the type/range checker."),
- &setchecklist, &showchecklist,
- &setlist, &showlist);
+ _ ("Set the status of the type/range checker."),
+ _ ("Show the status of the type/range checker."),
+ &setchecklist, &showchecklist, &setlist,
+ &showlist);
add_alias_cmd ("c", setshow_check_cmds.set, no_class, 1, &setlist);
add_alias_cmd ("ch", setshow_check_cmds.set, no_class, 1, &setlist);
add_alias_cmd ("c", setshow_check_cmds.show, no_class, 1, &showlist);
@@ -1121,24 +1108,23 @@ _initialize_language ()
range = type_or_range_names[3];
gdb_assert (strcmp (range, "auto") == 0);
- add_setshow_enum_cmd ("range", class_support, type_or_range_names,
- &range,
- _("Set range checking (on/warn/off/auto)."),
- _("Show range checking (on/warn/off/auto)."),
- NULL, set_range_command,
- show_range_command,
- &setchecklist, &showchecklist);
+ add_setshow_enum_cmd ("range", class_support, type_or_range_names, &range,
+ _ ("Set range checking (on/warn/off/auto)."),
+ _ ("Show range checking (on/warn/off/auto)."), NULL,
+ set_range_command, show_range_command, &setchecklist,
+ &showchecklist);
case_sensitive = case_sensitive_names[2];
gdb_assert (strcmp (case_sensitive, "auto") == 0);
add_setshow_enum_cmd ("case-sensitive", class_support, case_sensitive_names,
- &case_sensitive, _("\
-Set case sensitivity in name search (on/off/auto)."), _("\
-Show case sensitivity in name search (on/off/auto)."), _("\
+ &case_sensitive, _ ("\
+Set case sensitivity in name search (on/off/auto)."),
+ _ ("\
+Show case sensitivity in name search (on/off/auto)."),
+ _ ("\
For Fortran the default is off; for other languages the default is on."),
- set_case_command,
- show_case_command,
- &setlist, &showlist);
+ set_case_command, show_case_command, &setlist,
+ &showlist);
/* In order to call SET_LANGUAGE (below) we need to make sure that
CURRENT_LANGUAGE is not NULL. So first set the language to unknown,
diff --git a/gdb/language.h b/gdb/language.h
index a51ddf97381..6e681d95947 100644
--- a/gdb/language.h
+++ b/gdb/language.h
@@ -20,7 +20,7 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
-#if !defined (LANGUAGE_H)
+#if !defined(LANGUAGE_H)
#define LANGUAGE_H 1
#include "symtab.h"
@@ -40,51 +40,47 @@ class compile_instance;
struct completion_match_for_lcd;
class innermost_block_tracker;
-#define MAX_FORTRAN_DIMS 7 /* Maximum number of F77 array dims. */
+#define MAX_FORTRAN_DIMS 7 /* Maximum number of F77 array dims. */
/* range_check ==
range_check_on: Ranges are checked in GDB expressions, producing errors.
range_check_warn: Ranges are checked, producing warnings.
range_check_off: Ranges are not checked in GDB expressions. */
-extern enum range_check
- {
- range_check_off, range_check_warn, range_check_on
- }
-range_check;
+extern enum range_check {
+ range_check_off,
+ range_check_warn,
+ range_check_on
+} range_check;
/* array_ordering ==
array_row_major: Arrays are in row major order.
array_column_major: Arrays are in column major order. */
-extern enum array_ordering
- {
- array_row_major, array_column_major
- }
-array_ordering;
-
+extern enum array_ordering {
+ array_row_major,
+ array_column_major
+} array_ordering;
/* case_sensitivity ==
case_sensitive_on: Case sensitivity in name matching is used.
case_sensitive_off: Case sensitivity in name matching is not used. */
-extern enum case_sensitivity
- {
- case_sensitive_on, case_sensitive_off
- }
-case_sensitivity;
-
+extern enum case_sensitivity {
+ case_sensitive_on,
+ case_sensitive_off
+} case_sensitivity;
/* macro_expansion ==
macro_expansion_no: No macro expansion is available.
macro_expansion_c: C-like macro expansion is available. */
enum macro_expansion
- {
- macro_expansion_no, macro_expansion_c
- };
+{
+ macro_expansion_no,
+ macro_expansion_c
+};
-
/* Per architecture (OS/ABI) language information. */
struct language_arch_info
@@ -119,8 +115,7 @@ struct language_arch_info
}
/* Return the type for characters within a string. */
- struct type *string_char_type () const
- { return m_string_char_type; }
+ struct type *string_char_type () const { return m_string_char_type; }
/* Return the type to be used for booleans. */
struct type *bool_type () const;
@@ -139,13 +134,14 @@ struct language_arch_info
/* Lookup a primitive type for which FILTER returns true. Will return
nullptr if no matching type is found. */
- struct type *lookup_primitive_type
- (gdb::function_view<bool (struct type *)> filter);
+ struct type *
+ lookup_primitive_type (gdb::function_view<bool (struct type *)> filter);
/* Lookup a primitive type called NAME and return the type as a symbol.
LANG is the language for which type is being looked up. */
struct symbol *lookup_primitive_type_as_symbol (const char *name,
enum language lang);
+
private:
/* A structure storing a type and a corresponding symbol. The type is
@@ -156,16 +152,16 @@ private:
/* Constructor. */
explicit type_and_symbol (struct type *type)
: m_type (type)
- { /* Nothing. */ }
+ { /* Nothing. */
+ }
/* Default move constructor. */
- type_and_symbol (type_and_symbol&&) = default;
+ type_and_symbol (type_and_symbol &&) = default;
DISABLE_COPY_AND_ASSIGN (type_and_symbol);
/* Return the type from this object. */
- struct type *type () const
- { return m_type; }
+ struct type *type () const { return m_type; }
/* Create and return a symbol wrapping M_TYPE from this object. */
struct symbol *symbol (enum language lang)
@@ -176,6 +172,7 @@ private:
}
private:
+
/* The type primitive type. */
struct type *m_type = nullptr;
@@ -284,10 +281,7 @@ struct language_defn
/* Digit separator of the language. */
- virtual const char *get_digit_separator () const
- {
- return " ";
- }
+ virtual const char *get_digit_separator () const { return " "; }
/* Return a vector of file extensions for this language. The extension
must include the ".", like ".c". If this language doesn't need to
@@ -303,8 +297,7 @@ struct language_defn
/* Print the index of an element of an array. This default
implementation prints using C99 syntax. */
- virtual void print_array_index (struct type *index_type,
- LONGEST index_value,
+ virtual void print_array_index (struct type *index_type, LONGEST index_value,
struct ui_file *stream,
const value_print_options *options) const;
@@ -328,8 +321,8 @@ struct language_defn
implementation returns a LANGUAGE_PASS_BY_REF_INFO initialised in its
default state. */
- virtual struct language_pass_by_ref_info pass_by_reference_info
- (struct type *type) const
+ virtual struct language_pass_by_ref_info
+ pass_by_reference_info (struct type *type) const
{
return {};
}
@@ -345,7 +338,8 @@ struct language_defn
/* The per-architecture (OS/ABI) language information. */
virtual void language_arch_info (struct gdbarch *,
- struct language_arch_info *) const = 0;
+ struct language_arch_info *) const
+ = 0;
/* Find the definition of the type with the given name. */
@@ -367,10 +361,10 @@ struct language_defn
This field may not be NULL. If the language does not need any
special processing here, 'iterate_over_symbols' should be
used as the definition. */
- virtual bool iterate_over_symbols
- (const struct block *block, const lookup_name_info &name,
- domain_enum domain,
- gdb::function_view<symbol_found_callback_ftype> callback) const
+ virtual bool iterate_over_symbols (
+ const struct block *block, const lookup_name_info &name,
+ domain_enum domain,
+ gdb::function_view<symbol_found_callback_ftype> callback) const
{
return ::iterate_over_symbols (block, name, domain, callback);
}
@@ -386,8 +380,8 @@ struct language_defn
cases, then this method is a non-overridable interface. Languages
should override GET_SYMBOL_NAME_MATCHER_INNER if they need to. */
- symbol_name_matcher_ftype *get_symbol_name_matcher
- (const lookup_name_info &lookup_name) const;
+ symbol_name_matcher_ftype *
+ get_symbol_name_matcher (const lookup_name_info &lookup_name) const;
/* If this language allows compilation from the gdb command line,
then this method will return an instance of struct gcc_context
@@ -437,8 +431,9 @@ struct language_defn
The resulting string should be of the form that will be
installed into a symbol. */
- virtual bool sniff_from_mangled_name
- (const char *mangled, gdb::unique_xmalloc_ptr<char> *demangled) const
+ virtual bool
+ sniff_from_mangled_name (const char *mangled,
+ gdb::unique_xmalloc_ptr<char> *demangled) const
{
*demangled = nullptr;
return false;
@@ -453,10 +448,7 @@ struct language_defn
/* Return true if this class' implementation of print_type can
handle the /o modifier. */
- virtual bool can_print_type_offsets () const
- {
- return false;
- }
+ virtual bool can_print_type_offsets () const { return false; }
/* Print TYPE to STREAM using syntax appropriate for this language.
LEVEL is the depth to indent lines by. VARSTRING, if not NULL or the
@@ -465,7 +457,8 @@ struct language_defn
virtual void print_type (struct type *type, const char *varstring,
struct ui_file *stream, int show, int level,
- const struct type_print_options *flags) const = 0;
+ const struct type_print_options *flags) const
+ = 0;
/* PC is possibly an unknown languages trampoline.
If that PC falls in a trampoline belonging to this language, return
@@ -494,32 +487,30 @@ struct language_defn
symbols should be examined; otherwise, only STRUCT_DOMAIN symbols
whose type has a code of CODE should be matched. */
- virtual void collect_symbol_completion_matches
- (completion_tracker &tracker,
- complete_symbol_mode mode,
- symbol_name_match_type name_match_type,
- const char *text,
- const char *word,
- enum type_code code) const
+ virtual void collect_symbol_completion_matches (
+ completion_tracker &tracker, complete_symbol_mode mode,
+ symbol_name_match_type name_match_type, const char *text, const char *word,
+ enum type_code code) const
{
- return default_collect_symbol_completion_matches_break_on
- (tracker, mode, name_match_type, text, word, "", code);
+ return default_collect_symbol_completion_matches_break_on (tracker, mode,
+ name_match_type,
+ text, word, "",
+ code);
}
/* This is a function that lookup_symbol will call when it gets to
the part of symbol lookup where C looks up static and global
variables. This default implements the basic C lookup rules. */
- virtual struct block_symbol lookup_symbol_nonlocal
- (const char *name,
- const struct block *block,
- const domain_enum domain) const;
+ virtual struct block_symbol
+ lookup_symbol_nonlocal (const char *name, const struct block *block,
+ const domain_enum domain) const;
/* Return an expression that can be used for a location
watchpoint. TYPE is a pointer type that points to the memory
to watch, and ADDR is the address of the watched memory. */
- virtual gdb::unique_xmalloc_ptr<char> watch_location_expression
- (struct type *type, CORE_ADDR addr) const;
+ virtual gdb::unique_xmalloc_ptr<char>
+ watch_location_expression (struct type *type, CORE_ADDR addr) const;
/* List of all known languages. */
static const struct language_defn *languages[nr_languages];
@@ -530,9 +521,9 @@ struct language_defn
/* Print a value using syntax appropriate for this language. RECURSE is
the recursion depth. It is zero-based. */
- virtual void value_print_inner
- (struct value *val, struct ui_file *stream, int recurse,
- const struct value_print_options *options) const;
+ virtual void
+ value_print_inner (struct value *val, struct ui_file *stream, int recurse,
+ const struct value_print_options *options) const;
/* Parser function. */
@@ -541,13 +532,13 @@ struct language_defn
/* Print the character CH (of type CHTYPE) on STREAM as part of the
contents of a literal string whose delimiter is QUOTER. */
- virtual void emitchar (int ch, struct type *chtype,
- struct ui_file *stream, int quoter) const;
+ virtual void emitchar (int ch, struct type *chtype, struct ui_file *stream,
+ int quoter) const;
virtual void printchar (int ch, struct type *chtype,
- struct ui_file * stream) const;
+ struct ui_file *stream) const;
-/* Print the character string STRING, printing at most LENGTH characters.
+ /* Print the character string STRING, printing at most LENGTH characters.
Printing stops early if the number hits print_max_chars; repeat counts
are printed as appropriate. Print ellipses at the end if we
had to stop before printing LENGTH characters, or if FORCE_ELLIPSES. */
@@ -557,7 +548,6 @@ struct language_defn
const char *encoding, int force_ellipses,
const struct value_print_options *options) const;
-
/* Print a typedef using syntax appropriate for this language.
TYPE is the underlying type. NEW_SYMBOL is the symbol naming
the type. STREAM is the output stream on which to print. */
@@ -575,24 +565,21 @@ struct language_defn
ideally be similar in style to the default; an opener, three '.', and
a closer. */
- virtual const char *struct_too_deep_ellipsis () const
- { return "{...}"; }
+ virtual const char *struct_too_deep_ellipsis () const { return "{...}"; }
/* If this returns non-NULL then the string returned specifies the name
of the implicit local variable that refers to the current object
instance. Return NULL (the default) for languages that have no name
for the current object instance. */
- virtual const char *name_of_this () const
- { return nullptr; }
+ virtual const char *name_of_this () const { return nullptr; }
/* Return false if the language has first-class arrays. Return true if
there are no array values, and array objects decay to pointers, as in
C. The default is true as currently most supported languages behave
in this manner. */
- virtual bool c_style_arrays_p () const
- { return true; }
+ virtual bool c_style_arrays_p () const { return true; }
/* Return the index to use for extracting the first element of a string,
or as the lower bound when creating a new string. The default of
@@ -600,7 +587,9 @@ struct language_defn
supported languages except Modula-2. */
virtual char string_lower_bound () const
- { return c_style_arrays_p () ? 0 : 1; }
+ {
+ return c_style_arrays_p () ? 0 : 1;
+ }
/* Returns true if the symbols names should be stored in GDB's data
structures for minimal/partial/full symbols using their linkage (aka
@@ -620,34 +609,37 @@ struct language_defn
this function and return true, to prevent any accidental demangling
through an unrelated language's demangler. */
- virtual bool store_sym_names_in_linkage_form_p () const
- { return false; }
+ virtual bool store_sym_names_in_linkage_form_p () const { return false; }
/* Default range checking preference. The return value from this
function provides the automatic setting for 'set check range'. As a
consequence a user is free to override this setting if they want. */
- virtual bool range_checking_on_by_default () const
- { return false; }
+ virtual bool range_checking_on_by_default () const { return false; }
/* Is this language case sensitive? The return value from this function
provides the automativ setting for 'set case-sensitive', as a
consequence, a user is free to override this setting if they want. */
virtual enum case_sensitivity case_sensitivity () const
- { return case_sensitive_on; }
-
+ {
+ return case_sensitive_on;
+ }
/* Multi-dimensional array ordering. */
virtual enum array_ordering array_ordering () const
- { return array_row_major; }
+ {
+ return array_row_major;
+ }
/* Style of macro expansion, if any, supported by this language. The
default is no macro expansion. */
virtual enum macro_expansion macro_expansion () const
- { return macro_expansion_no; }
+ {
+ return macro_expansion_no;
+ }
/* Return a structure containing various operations on varobj specific
for this language. */
@@ -659,8 +651,8 @@ protected:
/* This is the overridable part of the GET_SYMBOL_NAME_MATCHER method.
See that method for a description of the arguments. */
- virtual symbol_name_matcher_ftype *get_symbol_name_matcher_inner
- (const lookup_name_info &lookup_name) const;
+ virtual symbol_name_matcher_ftype *
+ get_symbol_name_matcher_inner (const lookup_name_info &lookup_name) const;
};
/* Pointer to the language_defn for our current language. This pointer
@@ -696,11 +688,10 @@ extern const char lang_frame_mismatch_warn[];
of scope (e.g. stack frame)
language_mode_manual: current_language set only by user. */
-extern enum language_mode
- {
- language_mode_auto, language_mode_manual
- }
-language_mode;
+extern enum language_mode {
+ language_mode_auto,
+ language_mode_manual
+} language_mode;
/* Return the type that should be used for booleans for language L in
GDBARCH. */
@@ -730,20 +721,16 @@ struct type *language_lookup_primitive_type (const struct language_defn *l,
lookup_primitive_type member function inside the language_arch_info
class. */
-struct type *language_lookup_primitive_type
- (const struct language_defn *la,
- struct gdbarch *gdbarch,
- gdb::function_view<bool (struct type *)> filter);
+struct type *language_lookup_primitive_type (
+ const struct language_defn *la, struct gdbarch *gdbarch,
+ gdb::function_view<bool (struct type *)> filter);
/* Wrapper around language_lookup_primitive_type to return the
corresponding symbol. */
-struct symbol *
- language_lookup_primitive_type_as_symbol (const struct language_defn *l,
- struct gdbarch *gdbarch,
- const char *name);
+struct symbol *language_lookup_primitive_type_as_symbol (
+ const struct language_defn *l, struct gdbarch *gdbarch, const char *name);
-
/* These macros define the behaviour of the expression
evaluator. */
@@ -752,9 +739,9 @@ struct symbol *
/* "cast" really means conversion. */
/* FIXME -- should be a setting in language_defn. */
-#define CAST_IS_CONVERSION(LANG) ((LANG)->la_language == language_c || \
- (LANG)->la_language == language_cplus || \
- (LANG)->la_language == language_objc)
+#define CAST_IS_CONVERSION(LANG) \
+ ((LANG)->la_language == language_c || (LANG)->la_language == language_cplus \
+ || (LANG)->la_language == language_objc)
/* Print out the current language settings: language, range and
type checking. */
@@ -762,7 +749,6 @@ struct symbol *
extern void language_info ();
extern enum language set_language (enum language);
-
/* Test a character to decide whether it can be printed in literal form
or needs to be printed in another representation. For example,
@@ -770,9 +756,8 @@ extern enum language set_language (enum language);
and the "other representation" is '\141'. The "other representation"
is program language dependent. */
-#define PRINT_LITERAL_FORM(c) \
- ((c) >= 0x20 \
- && ((c) < 0x7F || (c) >= 0xA0) \
+#define PRINT_LITERAL_FORM(c) \
+ ((c) >= 0x20 && ((c) < 0x7F || (c) >= 0xA0) \
&& (!sevenbit_strings || (c) < 0x80))
/* Error messages */
@@ -792,26 +777,27 @@ extern const char *language_str (enum language);
extern CORE_ADDR skip_language_trampoline (frame_info_ptr, CORE_ADDR pc);
/* Return demangled language symbol, or NULL. */
-extern gdb::unique_xmalloc_ptr<char> language_demangle
- (const struct language_defn *current_language,
- const char *mangled, int options);
+extern gdb::unique_xmalloc_ptr<char>
+language_demangle (const struct language_defn *current_language,
+ const char *mangled, int options);
/* Return information about whether TYPE should be passed
(and returned) by reference at the language level. */
-struct language_pass_by_ref_info language_pass_by_reference (struct type *type);
+struct language_pass_by_ref_info
+language_pass_by_reference (struct type *type);
void c_get_string (struct value *value,
- gdb::unique_xmalloc_ptr<gdb_byte> *buffer,
- int *length, struct type **char_type,
- const char **charset);
+ gdb::unique_xmalloc_ptr<gdb_byte> *buffer, int *length,
+ struct type **char_type, const char **charset);
/* Get LANG's symbol_name_matcher method for LOOKUP_NAME. Returns
default_symbol_name_matcher if not set. LANG is used as a hint;
the function may ignore it depending on the current language and
LOOKUP_NAME. Specifically, if the current language is Ada, this
may return an Ada matcher regardless of LANG. */
-symbol_name_matcher_ftype *get_symbol_name_matcher
- (const language_defn *lang, const lookup_name_info &lookup_name);
+symbol_name_matcher_ftype *
+get_symbol_name_matcher (const language_defn *lang,
+ const lookup_name_info &lookup_name);
/* Save the current language and restore it upon destruction. */
@@ -824,15 +810,13 @@ public:
{
}
- ~scoped_restore_current_language ()
- {
- set_language (m_lang);
- }
+ ~scoped_restore_current_language () { set_language (m_lang); }
scoped_restore_current_language (const scoped_restore_current_language &)
- = delete;
- scoped_restore_current_language &operator=
- (const scoped_restore_current_language &) = delete;
+ = delete;
+ scoped_restore_current_language &
+ operator= (const scoped_restore_current_language &)
+ = delete;
private:
@@ -875,6 +859,7 @@ public:
DISABLE_COPY_AND_ASSIGN (scoped_switch_to_sym_language_if_auto);
private:
+
bool m_switched;
enum language m_lang;
};
diff --git a/gdb/linespec.c b/gdb/linespec.c
index d3def7ae070..8134893228c 100644
--- a/gdb/linespec.c
+++ b/gdb/linespec.c
@@ -213,8 +213,7 @@ collect_info::add_symbol (block_symbol *bsym)
/* Custom collect_info for symbol_searcher. */
-struct symbol_searcher_collect_info
- : collect_info
+struct symbol_searcher_collect_info : collect_info
{
bool add_symbol (block_symbol *bsym) override
{
@@ -254,7 +253,8 @@ enum linespec_token_type
/* List of keywords. This is NULL-terminated so that it can be used
as enum completer. */
-const char * const linespec_keywords[] = { "if", "thread", "task", "-force-condition", NULL };
+const char *const linespec_keywords[]
+ = { "if", "thread", "task", "-force-condition", NULL };
#define IF_KEYWORD_INDEX 0
#define FORCE_KEYWORD_INDEX 3
@@ -285,8 +285,7 @@ struct linespec_parser
{
linespec_parser (int flags, const struct language_defn *language,
struct program_space *search_pspace,
- struct symtab *default_symtab,
- int default_line,
+ struct symtab *default_symtab, int default_line,
struct linespec_result *canonical);
~linespec_parser ();
@@ -311,7 +310,10 @@ struct linespec_parser
int is_quote_enclosed = 0;
/* The state of the parse. */
- struct linespec_state state {};
+ struct linespec_state state
+ {
+ };
+
#define PARSER_STATE(PPTR) (&(PPTR)->state)
/* The result of the parse. */
@@ -348,28 +350,26 @@ struct linespec_parser
/* Prototypes for local functions. */
-static void iterate_over_file_blocks
- (struct symtab *symtab, const lookup_name_info &name,
- domain_enum domain,
- gdb::function_view<symbol_found_callback_ftype> callback);
+static void iterate_over_file_blocks (
+ struct symtab *symtab, const lookup_name_info &name, domain_enum domain,
+ gdb::function_view<symbol_found_callback_ftype> callback);
static void initialize_defaults (struct symtab **default_symtab,
int *default_line);
CORE_ADDR linespec_expression_to_pc (const char **exp_ptr);
-static std::vector<symtab_and_line> decode_objc (struct linespec_state *self,
- linespec *ls,
- const char *arg);
+static std::vector<symtab_and_line>
+decode_objc (struct linespec_state *self, linespec *ls, const char *arg);
-static std::vector<symtab *> symtabs_from_filename
- (const char *, struct program_space *pspace);
+static std::vector<symtab *>
+symtabs_from_filename (const char *, struct program_space *pspace);
-static std::vector<block_symbol> find_label_symbols
- (struct linespec_state *self,
- const std::vector<block_symbol> &function_symbols,
- std::vector<block_symbol> *label_funcs_ret,
- const char *name, bool completion_mode = false);
+static std::vector<block_symbol>
+find_label_symbols (struct linespec_state *self,
+ const std::vector<block_symbol> &function_symbols,
+ std::vector<block_symbol> *label_funcs_ret,
+ const char *name, bool completion_mode = false);
static void find_linespec_symbols (struct linespec_state *self,
const std::vector<symtab *> &file_symtabs,
@@ -378,37 +378,31 @@ static void find_linespec_symbols (struct linespec_state *self,
std::vector<block_symbol> *symbols,
std::vector<bound_minimal_symbol> *minsyms);
-static struct line_offset
- linespec_parse_variable (struct linespec_state *self,
- const char *variable);
+static struct line_offset linespec_parse_variable (struct linespec_state *self,
+ const char *variable);
-static int symbol_to_sal (struct symtab_and_line *result,
- int funfirstline, struct symbol *sym);
+static int symbol_to_sal (struct symtab_and_line *result, int funfirstline,
+ struct symbol *sym);
-static void add_matching_symbols_to_info (const char *name,
- symbol_name_match_type name_match_type,
- enum search_domain search_domain,
- struct collect_info *info,
- struct program_space *pspace);
+static void add_matching_symbols_to_info (
+ const char *name, symbol_name_match_type name_match_type,
+ enum search_domain search_domain, struct collect_info *info,
+ struct program_space *pspace);
-static void add_all_symbol_names_from_pspace
- (struct collect_info *info, struct program_space *pspace,
- const std::vector<const char *> &names, enum search_domain search_domain);
+static void add_all_symbol_names_from_pspace (
+ struct collect_info *info, struct program_space *pspace,
+ const std::vector<const char *> &names, enum search_domain search_domain);
static std::vector<symtab *>
- collect_symtabs_from_filename (const char *file,
- struct program_space *pspace);
+collect_symtabs_from_filename (const char *file, struct program_space *pspace);
-static std::vector<symtab_and_line> decode_digits_ordinary
- (struct linespec_state *self,
- linespec *ls,
- int line,
- linetable_entry **best_entry);
+static std::vector<symtab_and_line>
+decode_digits_ordinary (struct linespec_state *self, linespec *ls, int line,
+ linetable_entry **best_entry);
-static std::vector<symtab_and_line> decode_digits_list_mode
- (struct linespec_state *self,
- linespec *ls,
- struct symtab_and_line val);
+static std::vector<symtab_and_line>
+decode_digits_list_mode (struct linespec_state *self, linespec *ls,
+ struct symtab_and_line val);
static void minsym_found (struct linespec_state *self, struct objfile *objfile,
struct minimal_symbol *msymbol,
@@ -453,9 +447,8 @@ linespec_lexer_lex_number (linespec_parser *parser, linespec_token *tokenp)
/* If the next character in the input buffer is not a space, comma,
quote, or colon, this input does not represent a number. */
- if (*PARSER_STREAM (parser) != '\0'
- && !isspace (*PARSER_STREAM (parser)) && *PARSER_STREAM (parser) != ','
- && *PARSER_STREAM (parser) != ':'
+ if (*PARSER_STREAM (parser) != '\0' && !isspace (*PARSER_STREAM (parser))
+ && *PARSER_STREAM (parser) != ',' && *PARSER_STREAM (parser) != ':'
&& !strchr (linespec_quote_characters, *PARSER_STREAM (parser)))
{
PARSER_STREAM (parser) = LS_TOKEN_STOKEN (*tokenp).ptr;
@@ -545,8 +538,8 @@ is_ada_operator (const char *string)
const struct ada_opname_map *mapping;
for (mapping = ada_opname_table;
- mapping->encoded != NULL
- && !startswith (string, mapping->decoded); ++mapping)
+ mapping->encoded != NULL && !startswith (string, mapping->decoded);
+ ++mapping)
;
return mapping->decoded == NULL ? 0 : strlen (mapping->decoded);
@@ -643,7 +636,7 @@ find_parameter_list_end (const char *input)
otherwise. */
static size_t
-string_find_incomplete_keyword_at_end (const char * const *keywords,
+string_find_incomplete_keyword_at_end (const char *const *keywords,
const char *string, size_t string_len)
{
const char *end = string + string_len;
@@ -719,7 +712,7 @@ linespec_lexer_lex_string (linespec_parser *parser)
if (end == NULL)
{
if (parser->completion_tracker == NULL)
- error (_("unmatched quote"));
+ error (_ ("unmatched quote"));
/* In completion mode, we'll try to complete the incomplete
token. */
@@ -845,7 +838,8 @@ linespec_lexer_lex_string (linespec_parser *parser)
}
}
- const char *end = find_parameter_list_end (PARSER_STREAM (parser));
+ const char *end
+ = find_parameter_list_end (PARSER_STREAM (parser));
PARSER_STREAM (parser) = end;
/* Don't loop around to the normal \0 case above because
@@ -929,11 +923,20 @@ linespec_lexer_lex_one (linespec_parser *parser)
parser->lexer.current.type = LSTOKEN_EOI;
break;
- case '+': case '-':
- case '0': case '1': case '2': case '3': case '4':
- case '5': case '6': case '7': case '8': case '9':
- if (!linespec_lexer_lex_number (parser, &(parser->lexer.current)))
- parser->lexer.current = linespec_lexer_lex_string (parser);
+ case '+':
+ case '-':
+ case '0':
+ case '1':
+ case '2':
+ case '3':
+ case '4':
+ case '5':
+ case '6':
+ case '7':
+ case '8':
+ case '9':
+ if (!linespec_lexer_lex_number (parser, &(parser->lexer.current)))
+ parser->lexer.current = linespec_lexer_lex_string (parser);
break;
case ':':
@@ -948,7 +951,8 @@ linespec_lexer_lex_one (linespec_parser *parser)
}
break;
- case '\'': case '\"':
+ case '\'':
+ case '\"':
/* Special case: permit quote-enclosed linespecs. */
if (parser->is_quote_enclosed
&& is_closing_quote_enclosed (PARSER_STREAM (parser)))
@@ -962,8 +966,7 @@ linespec_lexer_lex_one (linespec_parser *parser)
case ',':
parser->lexer.current.type = LSTOKEN_COMMA;
- LS_TOKEN_STOKEN (parser->lexer.current).ptr
- = PARSER_STREAM (parser);
+ LS_TOKEN_STOKEN (parser->lexer.current).ptr = PARSER_STREAM (parser);
LS_TOKEN_STOKEN (parser->lexer.current).length = 1;
++(PARSER_STREAM (parser));
break;
@@ -1002,7 +1005,8 @@ linespec_lexer_consume_token (linespec_parser *parser)
if (*PARSER_STREAM (parser) != '\0')
{
parser->completion_quote_char = '\0';
- parser->completion_quote_end = NULL;;
+ parser->completion_quote_end = NULL;
+ ;
}
}
@@ -1057,8 +1061,8 @@ linespec_lexer_peek_token (linespec_parser *parser)
static void
add_sal_to_sals (struct linespec_state *self,
std::vector<symtab_and_line> *sals,
- struct symtab_and_line *sal,
- const char *symname, int literal_canonical)
+ struct symtab_and_line *sal, const char *symname,
+ int literal_canonical)
{
sals->push_back (*sal);
@@ -1066,9 +1070,9 @@ add_sal_to_sals (struct linespec_state *self,
{
struct linespec_canonical_name *canonical;
- self->canonical_names = XRESIZEVEC (struct linespec_canonical_name,
- self->canonical_names,
- sals->size ());
+ self->canonical_names
+ = XRESIZEVEC (struct linespec_canonical_name, self->canonical_names,
+ sals->size ());
canonical = &self->canonical_names[sals->size () - 1];
if (!literal_canonical && sal->symtab)
{
@@ -1079,8 +1083,8 @@ add_sal_to_sals (struct linespec_state *self,
the time being. */
if (symname != NULL && sal->line != 0
&& self->language->la_language == language_ada)
- canonical->suffix = xstrprintf ("%s:%d", symname,
- sal->line).release ();
+ canonical->suffix
+ = xstrprintf ("%s:%d", symname, sal->line).release ();
else if (symname != NULL)
canonical->suffix = xstrdup (symname);
else
@@ -1151,13 +1155,11 @@ maybe_add_address (htab_t set, struct program_space *pspace, CORE_ADDR addr)
inlined instances of functions will be included in the result. */
static void
-iterate_over_all_matching_symtabs
- (struct linespec_state *state,
- const lookup_name_info &lookup_name,
- const domain_enum name_domain,
- enum search_domain search_domain,
- struct program_space *search_pspace, bool include_inline,
- gdb::function_view<symbol_found_callback_ftype> callback)
+iterate_over_all_matching_symtabs (
+ struct linespec_state *state, const lookup_name_info &lookup_name,
+ const domain_enum name_domain, enum search_domain search_domain,
+ struct program_space *search_pspace, bool include_inline,
+ gdb::function_view<symbol_found_callback_ftype> callback)
{
for (struct program_space *pspace : program_spaces)
{
@@ -1173,8 +1175,7 @@ iterate_over_all_matching_symtabs
objfile->expand_symtabs_matching (NULL, &lookup_name, NULL, NULL,
(SEARCH_GLOBAL_BLOCK
| SEARCH_STATIC_BLOCK),
- UNDEF_DOMAIN,
- search_domain);
+ UNDEF_DOMAIN, search_domain);
for (compunit_symtab *cu : objfile->compunits ())
{
@@ -1192,16 +1193,15 @@ iterate_over_all_matching_symtabs
for (i = FIRST_LOCAL_BLOCK; i < bv->num_blocks (); i++)
{
block = bv->block (i);
- state->language->iterate_over_symbols
- (block, lookup_name, name_domain,
- [&] (block_symbol *bsym)
- {
- /* Restrict calls to CALLBACK to symbols
+ state->language->iterate_over_symbols (
+ block, lookup_name, name_domain,
+ [&] (block_symbol *bsym) {
+ /* Restrict calls to CALLBACK to symbols
representing inline symbols only. */
- if (bsym->symbol->is_inlined ())
- return callback (bsym);
- return true;
- });
+ if (bsym->symbol->is_inlined ())
+ return callback (bsym);
+ return true;
+ });
}
}
}
@@ -1224,15 +1224,14 @@ get_current_search_block (void)
/* Iterate over static and global blocks. */
static void
-iterate_over_file_blocks
- (struct symtab *symtab, const lookup_name_info &name,
- domain_enum domain, gdb::function_view<symbol_found_callback_ftype> callback)
+iterate_over_file_blocks (
+ struct symtab *symtab, const lookup_name_info &name, domain_enum domain,
+ gdb::function_view<symbol_found_callback_ftype> callback)
{
const struct block *block;
for (block = symtab->compunit ()->blockvector ()->static_block ();
- block != NULL;
- block = block->superblock ())
+ block != NULL; block = block->superblock ())
current_language->iterate_over_symbols (block, name, domain, callback);
}
@@ -1264,8 +1263,7 @@ find_methods (struct type *t, enum language t_lang, const char *name,
are counted as a single name. There is an inner loop which loops over
each overload. */
- for (method_counter = TYPE_NFN_FIELDS (t) - 1;
- method_counter >= 0;
+ for (method_counter = TYPE_NFN_FIELDS (t) - 1; method_counter >= 0;
--method_counter)
{
const char *method_name = TYPE_FN_FIELDLIST_NAME (t, method_counter);
@@ -1274,10 +1272,9 @@ find_methods (struct type *t, enum language t_lang, const char *name,
{
int field_counter;
- for (field_counter = (TYPE_FN_FIELDLIST_LENGTH (t, method_counter)
- - 1);
- field_counter >= 0;
- --field_counter)
+ for (field_counter
+ = (TYPE_FN_FIELDLIST_LENGTH (t, method_counter) - 1);
+ field_counter >= 0; --field_counter)
{
struct fn_field *f;
const char *phys_name;
@@ -1431,8 +1428,7 @@ decode_line_2_compare_items (const decode_line_2_item &a,
static void
decode_line_2 (struct linespec_state *self,
- std::vector<symtab_and_line> *result,
- const char *select_mode)
+ std::vector<symtab_and_line> *result, const char *select_mode)
{
const char *args;
const char *prompt;
@@ -1462,8 +1458,8 @@ decode_line_2 (struct linespec_state *self,
const char *fn_for_display;
fn_for_display = symtab_to_filename_for_display (canonical->symtab);
- displayform = string_printf ("%s:%s", fn_for_display,
- canonical->suffix);
+ displayform
+ = string_printf ("%s:%s", fn_for_display, canonical->suffix);
}
items.emplace_back (std::move (fullform), std::move (displayform),
@@ -1474,25 +1470,25 @@ decode_line_2 (struct linespec_state *self,
std::sort (items.begin (), items.end (), decode_line_2_compare_items);
/* Remove entries with the same FULLFORM. */
- items.erase (std::unique (items.begin (), items.end (),
- [] (const struct decode_line_2_item &a,
- const struct decode_line_2_item &b)
- {
- return a.fullform == b.fullform;
- }),
+ items.erase (std::unique (
+ items.begin (), items.end (),
+ [] (const struct decode_line_2_item &a,
+ const struct decode_line_2_item &b) {
+ return a.fullform == b.fullform;
+ }),
items.end ());
if (select_mode == multiple_symbols_cancel && items.size () > 1)
- error (_("canceled because the command is ambiguous\n"
- "See set/show multiple-symbol."));
-
+ error (_ ("canceled because the command is ambiguous\n"
+ "See set/show multiple-symbol."));
+
if (select_mode == multiple_symbols_all || items.size () == 1)
{
convert_results_to_lsals (self, result);
return;
}
- printf_unfiltered (_("[0] cancel\n[1] all\n"));
+ printf_unfiltered (_ ("[0] cancel\n[1] all\n"));
for (i = 0; i < items.size (); i++)
printf_unfiltered ("[%d] %s\n", i + 2, items[i].displayform.c_str ());
@@ -1506,7 +1502,7 @@ decode_line_2 (struct linespec_state *self,
args = command_line_input (buffer, prompt, "overload-choice");
if (args == 0 || *args == 0)
- error_no_arg (_("one or more choice numbers"));
+ error_no_arg (_ ("one or more choice numbers"));
number_or_range_parser parser (args);
while (!parser.finished ())
@@ -1514,7 +1510,7 @@ decode_line_2 (struct linespec_state *self,
int num = parser.get_number ();
if (num == 0)
- error (_("canceled"));
+ error (_ ("canceled"));
else if (num == 1)
{
/* We intentionally make this result in a single breakpoint,
@@ -1529,7 +1525,7 @@ decode_line_2 (struct linespec_state *self,
num -= 2;
if (num >= items.size ())
- printf_unfiltered (_("No choice number %d.\n"), num);
+ printf_unfiltered (_ ("No choice number %d.\n"), num);
else
{
struct decode_line_2_item *item = &items[num];
@@ -1541,7 +1537,7 @@ decode_line_2 (struct linespec_state *self,
}
else
{
- printf_unfiltered (_("duplicate request for %d ignored.\n"),
+ printf_unfiltered (_ ("duplicate request for %d ignored.\n"),
num + 2);
}
}
@@ -1550,8 +1546,6 @@ decode_line_2 (struct linespec_state *self,
filter_results (self, result, filters);
}
-
-
/* The parser of linespec itself. */
/* Throw an appropriate error when SYMBOL is not found (optionally in
@@ -1563,11 +1557,10 @@ symbol_not_found_error (const char *symbol, const char *filename)
if (symbol == NULL)
symbol = "";
- if (!have_full_symbols ()
- && !have_partial_symbols ()
+ if (!have_full_symbols () && !have_partial_symbols ()
&& !have_minimal_symbols ())
throw_error (NOT_FOUND_ERROR,
- _("No symbol table is loaded. Use the \"file\" command."));
+ _ ("No symbol table is loaded. Use the \"file\" command."));
/* If SYMBOL starts with '$', the user attempted to either lookup
a function/variable in his code starting with '$' or an internal
@@ -1577,22 +1570,24 @@ symbol_not_found_error (const char *symbol, const char *filename)
{
if (filename)
throw_error (NOT_FOUND_ERROR,
- _("Undefined convenience variable or function \"%s\" "
- "not defined in \"%s\"."), symbol, filename);
+ _ ("Undefined convenience variable or function \"%s\" "
+ "not defined in \"%s\"."),
+ symbol, filename);
else
throw_error (NOT_FOUND_ERROR,
- _("Undefined convenience variable or function \"%s\" "
- "not defined."), symbol);
+ _ ("Undefined convenience variable or function \"%s\" "
+ "not defined."),
+ symbol);
}
else
{
if (filename)
throw_error (NOT_FOUND_ERROR,
- _("Function \"%s\" not defined in \"%s\"."),
- symbol, filename);
+ _ ("Function \"%s\" not defined in \"%s\"."), symbol,
+ filename);
else
- throw_error (NOT_FOUND_ERROR,
- _("Function \"%s\" not defined."), symbol);
+ throw_error (NOT_FOUND_ERROR, _ ("Function \"%s\" not defined."),
+ symbol);
}
}
@@ -1603,8 +1598,8 @@ static void ATTRIBUTE_NORETURN
unexpected_linespec_error (linespec_parser *parser)
{
linespec_token token;
- static const char * token_type_strings[]
- = {"keyword", "colon", "string", "number", "comma", "end of input"};
+ static const char *token_type_strings[]
+ = { "keyword", "colon", "string", "number", "comma", "end of input" };
/* Get the token that generated the error. */
token = linespec_lexer_lex_one (parser);
@@ -1615,12 +1610,11 @@ unexpected_linespec_error (linespec_parser *parser)
{
gdb::unique_xmalloc_ptr<char> string = copy_token_string (token);
throw_error (GENERIC_ERROR,
- _("malformed linespec error: unexpected %s, \"%s\""),
+ _ ("malformed linespec error: unexpected %s, \"%s\""),
token_type_strings[token.type], string.get ());
}
else
- throw_error (GENERIC_ERROR,
- _("malformed linespec error: unexpected %s"),
+ throw_error (GENERIC_ERROR, _ ("malformed linespec error: unexpected %s"),
token_type_strings[token.type]);
}
@@ -1631,12 +1625,11 @@ undefined_label_error (const char *function, const char *label)
{
if (function != NULL)
throw_error (NOT_FOUND_ERROR,
- _("No label \"%s\" defined in function \"%s\"."),
- label, function);
+ _ ("No label \"%s\" defined in function \"%s\"."), label,
+ function);
else
throw_error (NOT_FOUND_ERROR,
- _("No label \"%s\" defined in current function."),
- label);
+ _ ("No label \"%s\" defined in current function."), label);
}
/* Throw a source file not found error. */
@@ -1644,7 +1637,7 @@ undefined_label_error (const char *function, const char *label)
static void ATTRIBUTE_NORETURN
source_file_not_found_error (const char *name)
{
- throw_error (NOT_FOUND_ERROR, _("No source file named %s."), name);
+ throw_error (NOT_FOUND_ERROR, _ ("No source file named %s."), name);
}
/* Unless at EIO, save the current stream position as completion word
@@ -1680,7 +1673,7 @@ linespec_parse_line_offset (const char *string)
line_offset.sign = LINE_OFFSET_NONE;
if (*string != '\0' && !isdigit (*string))
- error (_("malformed line offset: \"%s\""), start);
+ error (_ ("malformed line offset: \"%s\""), start);
/* Right now, we only allow base 10 for offsets. */
line_offset.offset = atoi (string);
@@ -1790,10 +1783,8 @@ linespec_parse_basic (linespec_parser *parser)
symbol_name_match_type match_type
= PARSER_EXPLICIT (parser)->func_name_match_type;
- linespec_complete_function (tmp_tracker,
- parser->completion_word,
- match_type,
- source_filename);
+ linespec_complete_function (tmp_tracker, parser->completion_word,
+ match_type, source_filename);
if (tmp_tracker.have_completions ())
{
@@ -1822,7 +1813,8 @@ linespec_parse_basic (linespec_parser *parser)
if (!symbols.empty () || !minimal_symbols.empty ())
{
PARSER_RESULT (parser)->function_symbols = std::move (symbols);
- PARSER_RESULT (parser)->minimal_symbols = std::move (minimal_symbols);
+ PARSER_RESULT (parser)->minimal_symbols
+ = std::move (minimal_symbols);
PARSER_EXPLICIT (parser)->function_name = name.release ();
}
else
@@ -1835,9 +1827,10 @@ linespec_parse_basic (linespec_parser *parser)
if (!labels.empty ())
{
- PARSER_RESULT (parser)->labels.label_symbols = std::move (labels);
+ PARSER_RESULT (parser)->labels.label_symbols
+ = std::move (labels);
PARSER_RESULT (parser)->labels.function_symbols
- = std::move (symbols);
+ = std::move (symbols);
PARSER_EXPLICIT (parser)->label_name = name.release ();
}
else if (token.type == LSTOKEN_STRING
@@ -1847,7 +1840,8 @@ linespec_parse_basic (linespec_parser *parser)
PARSER_EXPLICIT (parser)->line_offset
= linespec_parse_variable (PARSER_STATE (parser), name.get ());
- if (PARSER_EXPLICIT (parser)->line_offset.sign == LINE_OFFSET_UNKNOWN)
+ if (PARSER_EXPLICIT (parser)->line_offset.sign
+ == LINE_OFFSET_UNKNOWN)
{
/* The user-specified variable was not valid. Do not
throw an error here. parse_linespec will do it for us. */
@@ -1886,7 +1880,8 @@ linespec_parse_basic (linespec_parser *parser)
{
/* User specified an offset. Record the line offset and
get the next token. */
- set_completion_after_number (parser, linespec_complete_what::KEYWORD);
+ set_completion_after_number (parser,
+ linespec_complete_what::KEYWORD);
name = copy_token_string (token);
PARSER_EXPLICIT (parser)->line_offset
@@ -1952,10 +1947,9 @@ linespec_parse_basic (linespec_parser *parser)
else
{
/* We don't know what it was, but it isn't a label. */
- undefined_label_error
- (PARSER_EXPLICIT (parser)->function_name, name.get ());
+ undefined_label_error (
+ PARSER_EXPLICIT (parser)->function_name, name.get ());
}
-
}
/* Check for a line offset. */
@@ -2025,8 +2019,7 @@ canonicalize_linespec (struct linespec_state *state, const linespec *ls)
/* Given a line offset in LS, construct the relevant SALs. */
static std::vector<symtab_and_line>
-create_sals_line_offset (struct linespec_state *self,
- linespec *ls)
+create_sals_line_offset (struct linespec_state *self, linespec *ls)
{
int use_default = 0;
@@ -2036,8 +2029,7 @@ create_sals_line_offset (struct linespec_state *self,
set_default_source_symtab_and_line uses
select_source_symtab that calls us with such an argument. */
- if (ls->file_symtabs.size () == 1
- && ls->file_symtabs.front () == nullptr)
+ if (ls->file_symtabs.size () == 1 && ls->file_symtabs.front () == nullptr)
{
set_current_program_space (self->program_space);
@@ -2071,7 +2063,7 @@ create_sals_line_offset (struct linespec_state *self,
break;
case LINE_OFFSET_NONE:
- break; /* No need to adjust val.line. */
+ break; /* No need to adjust val.line. */
}
std::vector<symtab_and_line> values;
@@ -2085,9 +2077,8 @@ create_sals_line_offset (struct linespec_state *self,
std::vector<symtab_and_line> intermediate_results
= decode_digits_ordinary (self, ls, val.line, &best_entry);
if (intermediate_results.empty () && best_entry != NULL)
- intermediate_results = decode_digits_ordinary (self, ls,
- best_entry->line,
- &best_entry);
+ intermediate_results
+ = decode_digits_ordinary (self, ls, best_entry->line, &best_entry);
/* For optimized code, the compiler can scatter one source line
across disjoint ranges of PC values, even when no duplicate
@@ -2127,9 +2118,8 @@ create_sals_line_offset (struct linespec_state *self,
for (i = 0; i < intermediate_results.size (); ++i)
if (filter[i])
{
- struct symbol *sym = (blocks[i]
- ? block_containing_function (blocks[i])
- : NULL);
+ struct symbol *sym
+ = (blocks[i] ? block_containing_function (blocks[i]) : NULL);
if (self->funfirstline)
skip_prologue_sal (&intermediate_results[i]);
@@ -2142,10 +2132,10 @@ create_sals_line_offset (struct linespec_state *self,
if (values.empty ())
{
if (ls->explicit_loc.source_filename)
- throw_error (NOT_FOUND_ERROR, _("No line %d in file \"%s\"."),
+ throw_error (NOT_FOUND_ERROR, _ ("No line %d in file \"%s\"."),
val.line, ls->explicit_loc.source_filename);
else
- throw_error (NOT_FOUND_ERROR, _("No line %d in the current file."),
+ throw_error (NOT_FOUND_ERROR, _ ("No line %d in the current file."),
val.line);
}
@@ -2189,8 +2179,8 @@ convert_linespec_to_sals (struct linespec_state *state, linespec *ls)
if (symbol_to_sal (&sal, state->funfirstline, sym.symbol)
&& maybe_add_address (state->addr_set, pspace, sal.pc))
- add_sal_to_sals (state, &sals, &sal,
- sym.symbol->natural_name (), 0);
+ add_sal_to_sals (state, &sals, &sal, sym.symbol->natural_name (),
+ 0);
}
}
else if (!ls->function_symbols.empty () || !ls->minimal_symbols.empty ())
@@ -2201,8 +2191,7 @@ convert_linespec_to_sals (struct linespec_state *state, linespec *ls)
/* Sort symbols so that symbols with the same program space are next
to each other. */
std::sort (ls->function_symbols.begin (),
- ls->function_symbols.end (),
- compare_symbols);
+ ls->function_symbols.end (), compare_symbols);
for (const auto &sym : ls->function_symbols)
{
@@ -2216,9 +2205,8 @@ convert_linespec_to_sals (struct linespec_state *state, linespec *ls)
resolver with the same name as the ifunc itself. */
bool found_ifunc = false;
- if (state->funfirstline
- && !ls->minimal_symbols.empty ()
- && sym.symbol->aclass () == LOC_BLOCK)
+ if (state->funfirstline && !ls->minimal_symbols.empty ()
+ && sym.symbol->aclass () == LOC_BLOCK)
{
const CORE_ADDR addr
= sym.symbol->value_block ()->entry_pc ();
@@ -2231,13 +2219,10 @@ convert_linespec_to_sals (struct linespec_state *state, linespec *ls)
CORE_ADDR msym_addr = elem.value_address ();
if (elem.minsym->type () == mst_data_gnu_ifunc)
{
- struct gdbarch *gdbarch
- = elem.objfile->arch ();
- msym_addr
- = (gdbarch_convert_from_func_ptr_addr
- (gdbarch,
- msym_addr,
- current_inferior ()->top_target ()));
+ struct gdbarch *gdbarch = elem.objfile->arch ();
+ msym_addr = (gdbarch_convert_from_func_ptr_addr (
+ gdbarch, msym_addr,
+ current_inferior ()->top_target ()));
}
if (msym_addr == addr)
@@ -2263,8 +2248,7 @@ convert_linespec_to_sals (struct linespec_state *state, linespec *ls)
if (!ls->minimal_symbols.empty ())
{
/* Sort minimal symbols by program space, too */
- std::sort (ls->minimal_symbols.begin (),
- ls->minimal_symbols.end (),
+ std::sort (ls->minimal_symbols.begin (), ls->minimal_symbols.end (),
compare_msymbols);
for (const auto &elem : ls->minimal_symbols)
@@ -2278,19 +2262,19 @@ convert_linespec_to_sals (struct linespec_state *state, linespec *ls)
else if (ls->explicit_loc.line_offset.sign != LINE_OFFSET_UNKNOWN)
{
/* Only an offset was specified. */
- sals = create_sals_line_offset (state, ls);
+ sals = create_sals_line_offset (state, ls);
- /* Make sure we have a filename for canonicalization. */
- if (ls->explicit_loc.source_filename == NULL)
- {
- const char *filename = state->default_symtab->filename;
+ /* Make sure we have a filename for canonicalization. */
+ if (ls->explicit_loc.source_filename == NULL)
+ {
+ const char *filename = state->default_symtab->filename;
- /* It may be more appropriate to keep DEFAULT_SYMTAB in its symtab
+ /* It may be more appropriate to keep DEFAULT_SYMTAB in its symtab
form so that displaying SOURCE_FILENAME can follow the current
FILENAME_DISPLAY_STRING setting. But as it is used only rarely
it has been kept for code simplicity only in absolute form. */
- ls->explicit_loc.source_filename = xstrdup (filename);
- }
+ ls->explicit_loc.source_filename = xstrdup (filename);
+ }
}
else
{
@@ -2310,14 +2294,10 @@ convert_linespec_to_sals (struct linespec_state *state, linespec *ls)
SOURCE_FILENAME, FUNCTION_NAME, LABEL_NAME and LINE_OFFSET. */
static void
-convert_explicit_location_spec_to_linespec
- (struct linespec_state *self,
- linespec *result,
- const char *source_filename,
- const char *function_name,
- symbol_name_match_type fname_match_type,
- const char *label_name,
- struct line_offset line_offset)
+convert_explicit_location_spec_to_linespec (
+ struct linespec_state *self, linespec *result, const char *source_filename,
+ const char *function_name, symbol_name_match_type fname_match_type,
+ const char *label_name, struct line_offset line_offset)
{
std::vector<bound_minimal_symbol> minimal_symbols;
@@ -2346,9 +2326,8 @@ convert_explicit_location_spec_to_linespec
{
std::vector<block_symbol> symbols;
- find_linespec_symbols (self, result->file_symtabs,
- function_name, fname_match_type,
- &symbols, &minimal_symbols);
+ find_linespec_symbols (self, result->file_symtabs, function_name,
+ fname_match_type, &symbols, &minimal_symbols);
if (symbols.empty () && minimal_symbols.empty ())
symbol_not_found_error (function_name,
@@ -2363,12 +2342,11 @@ convert_explicit_location_spec_to_linespec
{
std::vector<block_symbol> symbols;
std::vector<block_symbol> labels
- = find_label_symbols (self, result->function_symbols,
- &symbols, label_name);
+ = find_label_symbols (self, result->function_symbols, &symbols,
+ label_name);
if (labels.empty ())
- undefined_label_error (result->explicit_loc.function_name,
- label_name);
+ undefined_label_error (result->explicit_loc.function_name, label_name);
result->explicit_loc.label_name = xstrdup (label_name);
result->labels.label_symbols = labels;
@@ -2382,17 +2360,14 @@ convert_explicit_location_spec_to_linespec
/* Convert the explicit location EXPLICIT_LOC into SaLs. */
static std::vector<symtab_and_line>
-convert_explicit_location_spec_to_sals
- (struct linespec_state *self,
- linespec *result,
- const explicit_location_spec *explicit_spec)
+convert_explicit_location_spec_to_sals (
+ struct linespec_state *self, linespec *result,
+ const explicit_location_spec *explicit_spec)
{
- convert_explicit_location_spec_to_linespec (self, result,
- explicit_spec->source_filename,
- explicit_spec->function_name,
- explicit_spec->func_name_match_type,
- explicit_spec->label_name,
- explicit_spec->line_offset);
+ convert_explicit_location_spec_to_linespec (
+ self, result, explicit_spec->source_filename, explicit_spec->function_name,
+ explicit_spec->func_name_match_type, explicit_spec->label_name,
+ explicit_spec->line_offset);
return convert_linespec_to_sals (self, result);
}
@@ -2459,10 +2434,8 @@ parse_linespec (linespec_parser *parser, const char *arg,
IDEs to work around bugs in the previous parser by quoting
the entire linespec, so we attempt to deal with this nicely. */
parser->is_quote_enclosed = 0;
- if (parser->completion_tracker == NULL
- && !is_ada_operator (arg)
- && *arg != '\0'
- && strchr (linespec_quote_characters, *arg) != NULL)
+ if (parser->completion_tracker == NULL && !is_ada_operator (arg)
+ && *arg != '\0' && strchr (linespec_quote_characters, *arg) != NULL)
{
const char *end = skip_quote_char (arg + 1, *arg);
if (end != NULL && is_closing_quote_enclosed (end))
@@ -2614,7 +2587,7 @@ parse_linespec (linespec_parser *parser, const char *arg,
PARSER_EXPLICIT (parser)->source_filename);
}
- convert_to_sals:
+convert_to_sals:
/* Get the last token and record how much of the input was parsed,
if necessary. */
@@ -2639,15 +2612,13 @@ parse_linespec (linespec_parser *parser, const char *arg,
return {};
}
-
/* A constructor for linespec_state. */
static void
-linespec_state_constructor (struct linespec_state *self,
- int flags, const struct language_defn *language,
+linespec_state_constructor (struct linespec_state *self, int flags,
+ const struct language_defn *language,
struct program_space *search_pspace,
- struct symtab *default_symtab,
- int default_line,
+ struct symtab *default_symtab, int default_line,
struct linespec_result *canonical)
{
memset (self, 0, sizeof (*self));
@@ -2674,12 +2645,11 @@ linespec_parser::linespec_parser (int flags,
struct linespec_result *canonical)
{
lexer.current.type = LSTOKEN_CONSUMED;
- PARSER_EXPLICIT (this)->func_name_match_type
- = symbol_name_match_type::WILD;
+ PARSER_EXPLICIT (this)->func_name_match_type = symbol_name_match_type::WILD;
PARSER_EXPLICIT (this)->line_offset.sign = LINE_OFFSET_UNKNOWN;
linespec_state_constructor (PARSER_STATE (this), flags, language,
- search_pspace,
- default_symtab, default_line, canonical);
+ search_pspace, default_symtab, default_line,
+ canonical);
}
/* A destructor for linespec_state. */
@@ -2730,8 +2700,7 @@ linespec_lex_to_end (const char **stringp)
/* See linespec.h. */
void
-linespec_complete_function (completion_tracker &tracker,
- const char *function,
+linespec_complete_function (completion_tracker &tracker, const char *function,
symbol_name_match_type func_match_type,
const char *source_filename)
{
@@ -2740,13 +2709,13 @@ linespec_complete_function (completion_tracker &tracker,
if (source_filename != NULL)
{
collect_file_symbol_completion_matches (tracker, mode, func_match_type,
- function, function, source_filename);
+ function, function,
+ source_filename);
}
else
{
collect_symbol_completion_matches (tracker, mode, func_match_type,
function, function);
-
}
}
@@ -2755,8 +2724,7 @@ linespec_complete_function (completion_tracker &tracker,
static void
complete_linespec_component (linespec_parser *parser,
- completion_tracker &tracker,
- const char *text,
+ completion_tracker &tracker, const char *text,
linespec_complete_what component,
const char *source_filename)
{
@@ -2818,16 +2786,14 @@ complete_linespec_component (linespec_parser *parser,
them to the tracker. */
static void
-complete_label (completion_tracker &tracker,
- linespec_parser *parser,
+complete_label (completion_tracker &tracker, linespec_parser *parser,
const char *label_name)
{
std::vector<block_symbol> label_function_symbols;
std::vector<block_symbol> labels
= find_label_symbols (PARSER_STATE (parser),
PARSER_RESULT (parser)->function_symbols,
- &label_function_symbols,
- label_name, true);
+ &label_function_symbols, label_name, true);
for (const auto &label : labels)
{
@@ -2852,12 +2818,9 @@ linespec_complete_label (completion_tracker &tracker,
try
{
- convert_explicit_location_spec_to_linespec (PARSER_STATE (&parser),
- PARSER_RESULT (&parser),
- source_filename,
- function_name,
- func_name_match_type,
- NULL, unknown_offset);
+ convert_explicit_location_spec_to_linespec (
+ PARSER_STATE (&parser), PARSER_RESULT (&parser), source_filename,
+ function_name, func_name_match_type, NULL, unknown_offset);
}
catch (const gdb_exception_error &ex)
{
@@ -2917,8 +2880,8 @@ linespec_complete (completion_tracker &tracker, const char *text,
parser.complete_what = linespec_complete_what::NOTHING;
parser.completion_quote_char = '\0';
- gdb::unique_xmalloc_ptr<char> text_copy
- (xstrdup (parser.completion_word));
+ gdb::unique_xmalloc_ptr<char> text_copy (
+ xstrdup (parser.completion_word));
tracker.add_completion (std::move (text_copy));
}
@@ -2933,9 +2896,8 @@ linespec_complete (completion_tracker &tracker, const char *text,
std::vector<block_symbol> function_symbols;
std::vector<bound_minimal_symbol> minimal_symbols;
find_linespec_symbols (PARSER_STATE (&parser),
- PARSER_RESULT (&parser)->file_symtabs,
- func_name, match_type,
- &function_symbols, &minimal_symbols);
+ PARSER_RESULT (&parser)->file_symtabs, func_name,
+ match_type, &function_symbols, &minimal_symbols);
PARSER_RESULT (&parser)->function_symbols = std::move (function_symbols);
PARSER_RESULT (&parser)->minimal_symbols = std::move (minimal_symbols);
@@ -2985,8 +2947,7 @@ linespec_complete (completion_tracker &tracker, const char *text,
const char *word = parser.completion_word;
- complete_linespec_component (&parser, tracker,
- parser.completion_word,
+ complete_linespec_component (&parser, tracker, parser.completion_word,
linespec_complete_what::FUNCTION,
PARSER_EXPLICIT (&parser)->source_filename);
@@ -3010,8 +2971,7 @@ linespec_complete (completion_tracker &tracker, const char *text,
wordlen);
if (key_start != -1
- || (wordlen > 0
- && parser.completion_word[wordlen - 1] == ' '))
+ || (wordlen > 0 && parser.completion_word[wordlen - 1] == ' '))
{
parser.completion_word += key_start;
parser.complete_what = linespec_complete_what::KEYWORD;
@@ -3028,8 +2988,7 @@ linespec_complete (completion_tracker &tracker, const char *text,
tracker.advance_custom_word_point_by (parser.completion_word - orig);
- complete_linespec_component (&parser, tracker,
- parser.completion_word,
+ complete_linespec_component (&parser, tracker, parser.completion_word,
parser.complete_what,
PARSER_EXPLICIT (&parser)->source_filename);
@@ -3051,8 +3010,7 @@ linespec_complete (completion_tracker &tracker, const char *text,
tracker.advance_custom_word_point_by (end - parser.completion_word);
complete_linespec_component (&parser, tracker, end,
- linespec_complete_what::KEYWORD,
- NULL);
+ linespec_complete_what::KEYWORD, NULL);
}
}
}
@@ -3061,8 +3019,7 @@ linespec_complete (completion_tracker &tracker, const char *text,
turn LOCSPEC into std::vector<symtab_and_line>. */
static std::vector<symtab_and_line>
-location_spec_to_sals (linespec_parser *parser,
- const location_spec *locspec)
+location_spec_to_sals (linespec_parser *parser, const location_spec *locspec)
{
std::vector<symtab_and_line> result;
@@ -3087,13 +3044,13 @@ location_spec_to_sals (linespec_parser *parser,
{
addr = linespec_expression_to_pc (&addr_string);
if (PARSER_STATE (parser)->canonical != NULL)
- PARSER_STATE (parser)->canonical->locspec = locspec->clone ();
+ PARSER_STATE (parser)->canonical->locspec = locspec->clone ();
}
else
addr = addr_spec->address;
- result = convert_address_location_to_sals (PARSER_STATE (parser),
- addr);
+ result
+ = convert_address_location_to_sals (PARSER_STATE (parser), addr);
}
break;
@@ -3101,9 +3058,10 @@ location_spec_to_sals (linespec_parser *parser,
{
const explicit_location_spec *explicit_locspec
= as_explicit_location_spec (locspec);
- result = convert_explicit_location_spec_to_sals (PARSER_STATE (parser),
- PARSER_RESULT (parser),
- explicit_locspec);
+ result
+ = convert_explicit_location_spec_to_sals (PARSER_STATE (parser),
+ PARSER_RESULT (parser),
+ explicit_locspec);
}
break;
@@ -3124,9 +3082,8 @@ location_spec_to_sals (linespec_parser *parser,
void
decode_line_full (struct location_spec *locspec, int flags,
struct program_space *search_pspace,
- struct symtab *default_symtab,
- int default_line, struct linespec_result *canonical,
- const char *select_mode,
+ struct symtab *default_symtab, int default_line,
+ struct linespec_result *canonical, const char *select_mode,
const char *filter)
{
std::vector<const char *> filters;
@@ -3135,24 +3092,22 @@ decode_line_full (struct location_spec *locspec, int flags,
gdb_assert (canonical != NULL);
/* The filter only makes sense for 'all'. */
gdb_assert (filter == NULL || select_mode == multiple_symbols_all);
- gdb_assert (select_mode == NULL
- || select_mode == multiple_symbols_all
+ gdb_assert (select_mode == NULL || select_mode == multiple_symbols_all
|| select_mode == multiple_symbols_ask
|| select_mode == multiple_symbols_cancel);
gdb_assert ((flags & DECODE_LINE_LIST_MODE) == 0);
- linespec_parser parser (flags, current_language,
- search_pspace, default_symtab,
- default_line, canonical);
+ linespec_parser parser (flags, current_language, search_pspace,
+ default_symtab, default_line, canonical);
scoped_restore_current_program_space restore_pspace;
- std::vector<symtab_and_line> result = location_spec_to_sals (&parser,
- locspec);
+ std::vector<symtab_and_line> result
+ = location_spec_to_sals (&parser, locspec);
state = PARSER_STATE (&parser);
if (result.size () == 0)
- throw_error (NOT_SUPPORTED_ERROR, _("Location %s not available"),
+ throw_error (NOT_SUPPORTED_ERROR, _ ("Location %s not available"),
locspec->to_string ());
gdb_assert (result.size () == 1 || canonical->pre_expanded);
@@ -3193,12 +3148,10 @@ decode_line_full (struct location_spec *locspec, int flags,
std::vector<symtab_and_line>
decode_line_1 (const location_spec *locspec, int flags,
struct program_space *search_pspace,
- struct symtab *default_symtab,
- int default_line)
+ struct symtab *default_symtab, int default_line)
{
- linespec_parser parser (flags, current_language,
- search_pspace, default_symtab,
- default_line, NULL);
+ linespec_parser parser (flags, current_language, search_pspace,
+ default_symtab, default_line, NULL);
scoped_restore_current_program_space restore_pspace;
@@ -3211,19 +3164,19 @@ std::vector<symtab_and_line>
decode_line_with_current_source (const char *string, int flags)
{
if (string == 0)
- error (_("Empty line specification."));
+ error (_ ("Empty line specification."));
/* We use whatever is set as the current source line. We do not try
and get a default source symtab+line or it will recursively call us! */
symtab_and_line cursal = get_current_source_symtab_and_line ();
- location_spec_up locspec = string_to_location_spec (&string,
- current_language);
+ location_spec_up locspec
+ = string_to_location_spec (&string, current_language);
std::vector<symtab_and_line> sals
= decode_line_1 (locspec.get (), flags, NULL, cursal.symtab, cursal.line);
if (*string)
- error (_("Junk at end of line specification: %s"), string);
+ error (_ ("Junk at end of line specification: %s"), string);
return sals;
}
@@ -3234,25 +3187,23 @@ std::vector<symtab_and_line>
decode_line_with_last_displayed (const char *string, int flags)
{
if (string == 0)
- error (_("Empty line specification."));
+ error (_ ("Empty line specification."));
- location_spec_up locspec = string_to_location_spec (&string,
- current_language);
+ location_spec_up locspec
+ = string_to_location_spec (&string, current_language);
std::vector<symtab_and_line> sals
= (last_displayed_sal_is_valid ()
- ? decode_line_1 (locspec.get (), flags, NULL,
- get_last_displayed_symtab (),
- get_last_displayed_line ())
- : decode_line_1 (locspec.get (), flags, NULL, NULL, 0));
+ ? decode_line_1 (locspec.get (), flags, NULL,
+ get_last_displayed_symtab (),
+ get_last_displayed_line ())
+ : decode_line_1 (locspec.get (), flags, NULL, NULL, 0));
if (*string)
- error (_("Junk at end of line specification: %s"), string);
+ error (_ ("Junk at end of line specification: %s"), string);
return sals;
}
-
-
/* First, some functions to initialize stuff at the beginning of the
function. */
@@ -3264,16 +3215,13 @@ initialize_defaults (struct symtab **default_symtab, int *default_line)
/* Use whatever we have for the default source line. We don't use
get_current_or_default_symtab_and_line as it can recurse and call
us back! */
- struct symtab_and_line cursal =
- get_current_source_symtab_and_line ();
-
+ struct symtab_and_line cursal = get_current_source_symtab_and_line ();
+
*default_symtab = cursal.symtab;
*default_line = cursal.line;
}
}
-
-
/* Evaluate the expression pointed to by EXP_PTR into a CORE_ADDR,
advancing EXP_PTR past any parsed text. */
@@ -3283,15 +3231,13 @@ linespec_expression_to_pc (const char **exp_ptr)
if (current_program_space->executing_startup)
/* The error message doesn't really matter, because this case
should only hit during breakpoint reset. */
- throw_error (NOT_FOUND_ERROR, _("cannot evaluate expressions while "
- "program space is in startup"));
+ throw_error (NOT_FOUND_ERROR, _ ("cannot evaluate expressions while "
+ "program space is in startup"));
(*exp_ptr)++;
return value_as_address (parse_to_comma_and_eval (exp_ptr));
}
-
-
/* Here's where we recognise an Objective-C Selector. An Objective C
selector may be implemented by more than one class, therefore it
may represent more than one method/function. This gives us a
@@ -3347,9 +3293,9 @@ decode_objc (struct linespec_state *self, linespec *ls, const char *arg)
if (ls->explicit_loc.source_filename)
{
- holder = string_printf ("%s:%s",
- ls->explicit_loc.source_filename,
- saved_arg);
+ holder
+ = string_printf ("%s:%s", ls->explicit_loc.source_filename,
+ saved_arg);
str = holder.c_str ();
}
else
@@ -3363,7 +3309,8 @@ decode_objc (struct linespec_state *self, linespec *ls, const char *arg)
return values;
}
-namespace {
+namespace
+{
/* A function object that serves as symbol_found_callback_ftype
callback for iterate_over_symbols. This is used by
@@ -3371,10 +3318,10 @@ namespace {
class decode_compound_collector
{
public:
+
decode_compound_collector ()
- : m_unique_syms (htab_create_alloc (1, htab_hash_pointer,
- htab_eq_pointer, NULL,
- xcalloc, xfree))
+ : m_unique_syms (htab_create_alloc (1, htab_hash_pointer, htab_eq_pointer,
+ NULL, xcalloc, xfree))
{
}
@@ -3385,19 +3332,20 @@ public:
}
/* Callable as a symbol_found_callback_ftype callback. */
- bool operator () (block_symbol *bsym);
+ bool operator() (block_symbol *bsym);
private:
+
/* A hash table of all symbols we found. We use this to avoid
adding any symbol more than once. */
htab_up m_unique_syms;
/* The result vector. */
- std::vector<block_symbol> m_symbols;
+ std::vector<block_symbol> m_symbols;
};
bool
-decode_compound_collector::operator () (block_symbol *bsym)
+decode_compound_collector::operator() (block_symbol *bsym)
{
void **slot;
struct type *t;
@@ -3408,8 +3356,7 @@ decode_compound_collector::operator () (block_symbol *bsym)
t = sym->type ();
t = check_typedef (t);
- if (t->code () != TYPE_CODE_STRUCT
- && t->code () != TYPE_CODE_UNION
+ if (t->code () != TYPE_CODE_STRUCT && t->code () != TYPE_CODE_UNION
&& t->code () != TYPE_CODE_NAMESPACE)
return true; /* Continue iterating. */
@@ -3440,12 +3387,12 @@ lookup_prefix_sym (struct linespec_state *state,
{
if (elt == nullptr)
{
- iterate_over_all_matching_symtabs (state, lookup_name,
- STRUCT_DOMAIN, ALL_DOMAIN,
- NULL, false, collector);
- iterate_over_all_matching_symtabs (state, lookup_name,
- VAR_DOMAIN, ALL_DOMAIN,
- NULL, false, collector);
+ iterate_over_all_matching_symtabs (state, lookup_name, STRUCT_DOMAIN,
+ ALL_DOMAIN, NULL, false,
+ collector);
+ iterate_over_all_matching_symtabs (state, lookup_name, VAR_DOMAIN,
+ ALL_DOMAIN, NULL, false,
+ collector);
}
else
{
@@ -3455,7 +3402,8 @@ lookup_prefix_sym (struct linespec_state *state,
gdb_assert (!pspace->executing_startup);
set_current_program_space (pspace);
- iterate_over_file_blocks (elt, lookup_name, STRUCT_DOMAIN, collector);
+ iterate_over_file_blocks (elt, lookup_name, STRUCT_DOMAIN,
+ collector);
iterate_over_file_blocks (elt, lookup_name, VAR_DOMAIN, collector);
}
}
@@ -3525,8 +3473,7 @@ add_all_symbol_names_from_pspace (struct collect_info *info,
enum search_domain search_domain)
{
for (const char *iter : names)
- add_matching_symbols_to_info (iter,
- symbol_name_match_type::FULL,
+ add_matching_symbols_to_info (iter, symbol_name_match_type::FULL,
search_domain, info, pspace);
}
@@ -3557,9 +3504,8 @@ find_superclass_methods (std::vector<struct type *> &&superclasses,
static void
find_method (struct linespec_state *self,
- const std::vector<symtab *> &file_symtabs,
- const char *class_name, const char *method_name,
- std::vector<block_symbol> *sym_classes,
+ const std::vector<symtab *> &file_symtabs, const char *class_name,
+ const char *method_name, std::vector<block_symbol> *sym_classes,
std::vector<block_symbol> *symbols,
std::vector<bound_minimal_symbol> *minsyms)
{
@@ -3570,8 +3516,7 @@ find_method (struct linespec_state *self,
/* Sort symbols so that symbols with the same program space are next
to each other. */
- std::sort (sym_classes->begin (), sym_classes->end (),
- compare_symbols);
+ std::sort (sym_classes->begin (), sym_classes->end (), compare_symbols);
info.state = self;
info.file_symtabs = &file_symtabs;
@@ -3601,15 +3546,18 @@ find_method (struct linespec_state *self,
gdb_assert (!pspace->executing_startup);
set_current_program_space (pspace);
t = check_typedef (sym->type ());
- find_methods (t, sym->language (),
- method_name, &result_names, &superclass_vec);
+ find_methods (t, sym->language (), method_name, &result_names,
+ &superclass_vec);
/* Handle all items from a single program space at once; and be
sure not to miss the last batch. */
if (ix == sym_classes->size () - 1
|| (pspace
- != (sym_classes->at (ix + 1).symbol->symtab ()
- ->compunit ()->objfile ()->pspace)))
+ != (sym_classes->at (ix + 1)
+ .symbol->symtab ()
+ ->compunit ()
+ ->objfile ()
+ ->pspace)))
{
/* If we did not find a direct implementation anywhere in
this program space, consider superclasses. */
@@ -3633,12 +3581,11 @@ find_method (struct linespec_state *self,
/* Throw an NOT_FOUND_ERROR. This will be caught by the caller
and other attempts to locate the symbol will be made. */
- throw_error (NOT_FOUND_ERROR, _("see caller, this text doesn't matter"));
+ throw_error (NOT_FOUND_ERROR, _ ("see caller, this text doesn't matter"));
}
-
-
-namespace {
+namespace
+{
/* This function object is a callback for iterate_over_symtabs, used
when collecting all matching symtabs. */
@@ -3646,6 +3593,7 @@ namespace {
class symtab_collector
{
public:
+
symtab_collector ()
: m_symtab_table (htab_create (1, htab_hash_pointer, htab_eq_pointer,
NULL))
@@ -3653,15 +3601,13 @@ public:
}
/* Callable as a symbol_found_callback_ftype callback. */
- bool operator () (symtab *sym);
+ bool operator() (symtab *sym);
/* Return an rvalue reference to the collected symtabs. */
- std::vector<symtab *> &&release_symtabs ()
- {
- return std::move (m_symtabs);
- }
+ std::vector<symtab *> &&release_symtabs () { return std::move (m_symtabs); }
private:
+
/* The result vector of symtabs. */
std::vector<symtab *> m_symtabs;
@@ -3670,7 +3616,7 @@ private:
};
bool
-symtab_collector::operator () (struct symtab *symtab)
+symtab_collector::operator() (struct symtab *symtab)
{
void **slot;
@@ -3730,9 +3676,8 @@ symtabs_from_filename (const char *filename,
if (result.empty ())
{
if (!have_full_symbols () && !have_partial_symbols ())
- throw_error (NOT_FOUND_ERROR,
- _("No symbol table is loaded. "
- "Use the \"file\" command."));
+ throw_error (NOT_FOUND_ERROR, _ ("No symbol table is loaded. "
+ "Use the \"file\" command."));
source_file_not_found_error (filename);
}
@@ -3775,7 +3720,8 @@ symbol_searcher::find_all_symbols (const std::string &name,
static void
find_function_symbols (struct linespec_state *state,
- const std::vector<symtab *> &file_symtabs, const char *name,
+ const std::vector<symtab *> &file_symtabs,
+ const char *name,
symbol_name_match_type name_match_type,
std::vector<block_symbol> *symbols,
std::vector<bound_minimal_symbol> *minsyms)
@@ -3806,7 +3752,7 @@ find_linespec_symbols (struct linespec_state *state,
const std::vector<symtab *> &file_symtabs,
const char *lookup_name,
symbol_name_match_type name_match_type,
- std::vector <block_symbol> *symbols,
+ std::vector<block_symbol> *symbols,
std::vector<bound_minimal_symbol> *minsyms)
{
gdb::unique_xmalloc_ptr<char> canon
@@ -3823,8 +3769,8 @@ find_linespec_symbols (struct linespec_state *state,
1) break (anonymous namespace)::foo
2) break class::method where method is in class (and not a baseclass) */
- find_function_symbols (state, file_symtabs, lookup_name,
- name_match_type, symbols, minsyms);
+ find_function_symbols (state, file_symtabs, lookup_name, name_match_type,
+ symbols, minsyms);
/* If we were unable to locate a symbol of the same name, try dividing
the name into class and method names and searching the class and its
@@ -3868,9 +3814,8 @@ find_linespec_symbols (struct linespec_state *state,
/* Now locate a list of suitable methods named METHOD. */
try
{
- find_method (state, file_symtabs,
- klass.c_str (), method.c_str (),
- &classes, symbols, minsyms);
+ find_method (state, file_symtabs, klass.c_str (),
+ method.c_str (), &classes, symbols, minsyms);
}
/* If successful, we're done. If NOT_FOUND_ERROR
@@ -3892,9 +3837,8 @@ find_linespec_symbols (struct linespec_state *state,
exactly NAME match. */
static void
-find_label_symbols_in_block (const struct block *block,
- const char *name, struct symbol *fn_sym,
- bool completion_mode,
+find_label_symbols_in_block (const struct block *block, const char *name,
+ struct symbol *fn_sym, bool completion_mode,
std::vector<block_symbol> *result,
std::vector<block_symbol> *label_funcs_ret)
{
@@ -3909,12 +3853,12 @@ find_label_symbols_in_block (const struct block *block,
ALL_BLOCK_SYMBOLS (block, iter, sym)
{
- if (symbol_matches_domain (sym->language (),
- sym->domain (), LABEL_DOMAIN)
+ if (symbol_matches_domain (sym->language (), sym->domain (),
+ LABEL_DOMAIN)
&& cmp (sym->search_name (), name, name_len) == 0)
{
- result->push_back ({sym, block});
- label_funcs_ret->push_back ({fn_sym, block});
+ result->push_back ({ sym, block });
+ label_funcs_ret->push_back ({ fn_sym, block });
}
}
}
@@ -3926,7 +3870,7 @@ find_label_symbols_in_block (const struct block *block,
if (label_sym.symbol != NULL)
{
result->push_back (label_sym);
- label_funcs_ret->push_back ({fn_sym, block});
+ label_funcs_ret->push_back ({ fn_sym, block });
}
}
}
@@ -3938,13 +3882,11 @@ find_label_symbols_in_block (const struct block *block,
interpreted as a label name prefix. Otherwise, only labels named
exactly NAME match. */
-
static std::vector<block_symbol>
find_label_symbols (struct linespec_state *self,
const std::vector<block_symbol> &function_symbols,
std::vector<block_symbol> *label_funcs_ret,
- const char *name,
- bool completion_mode)
+ const char *name, bool completion_mode)
{
const struct block *block;
struct symbol *fn_sym;
@@ -3955,9 +3897,7 @@ find_label_symbols (struct linespec_state *self,
set_current_program_space (self->program_space);
block = get_current_search_block ();
- for (;
- block && !block->function ();
- block = block->superblock ())
+ for (; block && !block->function (); block = block->superblock ())
;
if (!block)
@@ -3973,8 +3913,8 @@ find_label_symbols (struct linespec_state *self,
for (const auto &elt : function_symbols)
{
fn_sym = elt.symbol;
- set_current_program_space
- (fn_sym->symtab ()->compunit ()->objfile ()->pspace);
+ set_current_program_space (
+ fn_sym->symtab ()->compunit ()->objfile ()->pspace);
block = fn_sym->value_block ();
find_label_symbols_in_block (block, name, fn_sym, completion_mode,
@@ -3985,13 +3925,10 @@ find_label_symbols (struct linespec_state *self,
return result;
}
-
-
/* A helper for create_sals_line_offset that handles the 'list_mode' case. */
static std::vector<symtab_and_line>
-decode_digits_list_mode (struct linespec_state *self,
- linespec *ls,
+decode_digits_list_mode (struct linespec_state *self, linespec *ls,
struct symtab_and_line val)
{
gdb_assert (self->list_mode);
@@ -4025,9 +3962,7 @@ decode_digits_list_mode (struct linespec_state *self,
structures. */
static std::vector<symtab_and_line>
-decode_digits_ordinary (struct linespec_state *self,
- linespec *ls,
- int line,
+decode_digits_ordinary (struct linespec_state *self, linespec *ls, int line,
struct linetable_entry **best_entry)
{
std::vector<symtab_and_line> sals;
@@ -4057,8 +3992,6 @@ decode_digits_ordinary (struct linespec_state *self,
return sals;
}
-
-
/* Return the line offset represented by VARIABLE. */
static struct line_offset
@@ -4073,17 +4006,18 @@ linespec_parse_variable (struct linespec_state *self, const char *variable)
++p;
while (*p >= '0' && *p <= '9')
++p;
- if (!*p) /* Reached end of token without hitting non-digit. */
+ if (!*p) /* Reached end of token without hitting non-digit. */
{
/* We have a value history reference. */
struct value *val_history;
- sscanf ((variable[1] == '$') ? variable + 2 : variable + 1, "%d", &index);
+ sscanf ((variable[1] == '$') ? variable + 2 : variable + 1, "%d",
+ &index);
val_history
= access_value_history ((variable[1] == '$') ? -index : index);
if (value_type (val_history)->code () != TYPE_CODE_INT)
- error (_("History values used in line "
- "specs must have integer values."));
+ error (_ ("History values used in line "
+ "specs must have integer values."));
offset.offset = value_as_long (val_history);
offset.sign = LINE_OFFSET_NONE;
}
@@ -4097,7 +4031,7 @@ linespec_parse_variable (struct linespec_state *self, const char *variable)
/* Try it as a convenience variable. If it is not a convenience
variable, return and allow normal symbol lookup to occur. */
ivar = lookup_only_internalvar (variable + 1);
- /* If there's no internal variable with that name, let the
+ /* If there's no internal variable with that name, let the
offset remain as unknown to allow the name to be looked up
as a symbol. */
if (ivar != nullptr)
@@ -4105,8 +4039,8 @@ linespec_parse_variable (struct linespec_state *self, const char *variable)
/* We found a valid variable name. If it is not an integer,
throw an error. */
if (!get_internalvar_integer (ivar, &valx))
- error (_("Convenience variables used in line "
- "specs must have integer values."));
+ error (_ ("Convenience variables used in line "
+ "specs must have integer values."));
else
{
offset.offset = valx;
@@ -4117,7 +4051,6 @@ linespec_parse_variable (struct linespec_state *self, const char *variable)
return offset;
}
-
/* We've found a minimal symbol MSYMBOL in OBJFILE to associate with our
linespec; return the SAL in RESULT. This function should return SALs
@@ -4227,13 +4160,11 @@ search_minsyms_for_name (struct collect_info *info,
for (objfile *objfile : current_program_space->objfiles ())
{
iterate_over_minimal_symbols (objfile, name,
- [&] (struct minimal_symbol *msym)
- {
- add_minsym (msym, objfile, nullptr,
- info->state->list_mode,
- &minsyms);
- return false;
- });
+ [&] (struct minimal_symbol *msym) {
+ add_minsym (msym, objfile, nullptr, info->state->list_mode,
+ &minsyms);
+ return false;
+ });
}
}
}
@@ -4244,30 +4175,27 @@ search_minsyms_for_name (struct collect_info *info,
if (search_pspace == NULL || pspace == search_pspace)
{
set_current_program_space (pspace);
- iterate_over_minimal_symbols
- (symtab->compunit ()->objfile (), name,
- [&] (struct minimal_symbol *msym)
- {
- add_minsym (msym, symtab->compunit ()->objfile (), symtab,
- info->state->list_mode, &minsyms);
- return false;
- });
+ iterate_over_minimal_symbols (symtab->compunit ()->objfile (), name,
+ [&] (struct minimal_symbol *msym) {
+ add_minsym (msym, symtab->compunit ()->objfile (), symtab,
+ info->state->list_mode, &minsyms);
+ return false;
+ });
}
}
/* Return true if TYPE is a static symbol. */
- auto msymbol_type_is_static = [] (enum minimal_symbol_type type)
- {
- switch (type)
- {
- case mst_file_text:
- case mst_file_data:
- case mst_file_bss:
+ auto msymbol_type_is_static = [] (enum minimal_symbol_type type) {
+ switch (type)
+ {
+ case mst_file_text:
+ case mst_file_data:
+ case mst_file_bss:
return true;
- default:
+ default:
return false;
- }
- };
+ }
+ };
/* Add minsyms to the result set, but filter out trampoline symbols
if we also found extern symbols with the same name. I.e., don't
@@ -4289,7 +4217,8 @@ search_minsyms_for_name (struct collect_info *info,
continue;
if (strcmp (item.minsym->linkage_name (),
- item2.minsym->linkage_name ()) != 0)
+ item2.minsym->linkage_name ())
+ != 0)
continue;
/* Found a global minsym with the same name as the
@@ -4323,13 +4252,14 @@ add_matching_symbols_to_info (const char *name,
if (elt == nullptr)
{
iterate_over_all_matching_symtabs (info->state, lookup_name,
- VAR_DOMAIN, search_domain,
- pspace, true,
- [&] (block_symbol *bsym)
- { return info->add_symbol (bsym); });
+ VAR_DOMAIN, search_domain, pspace,
+ true, [&] (block_symbol *bsym) {
+ return info->add_symbol (bsym);
+ });
search_minsyms_for_name (info, lookup_name, pspace, NULL);
}
- else if (pspace == NULL || pspace == elt->compunit ()->objfile ()->pspace)
+ else if (pspace == NULL
+ || pspace == elt->compunit ()->objfile ()->pspace)
{
int prev_len = info->result.symbols->size ();
@@ -4339,8 +4269,9 @@ add_matching_symbols_to_info (const char *name,
gdb_assert (!elt_pspace->executing_startup);
set_current_program_space (elt_pspace);
iterate_over_file_blocks (elt, lookup_name, VAR_DOMAIN,
- [&] (block_symbol *bsym)
- { return info->add_symbol (bsym); });
+ [&] (block_symbol *bsym) {
+ return info->add_symbol (bsym);
+ });
/* If no new symbols were found in this iteration and this symtab
is in assembler, we might actually be looking for a label for
@@ -4353,14 +4284,12 @@ add_matching_symbols_to_info (const char *name,
}
}
-
-
/* Now come some functions that are called from multiple places within
decode_line_1. */
static int
-symbol_to_sal (struct symtab_and_line *result,
- int funfirstline, struct symbol *sym)
+symbol_to_sal (struct symtab_and_line *result, int funfirstline,
+ struct symbol *sym)
{
if (sym->aclass () == LOC_BLOCK)
{
diff --git a/gdb/linespec.h b/gdb/linespec.h
index d5e7334fe2d..351e1b603a8 100644
--- a/gdb/linespec.h
+++ b/gdb/linespec.h
@@ -14,7 +14,7 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
-#if !defined (LINESPEC_H)
+#if !defined(LINESPEC_H)
#define LINESPEC_H 1
struct symtab;
@@ -24,16 +24,16 @@ struct symtab;
/* Flags to pass to decode_line_1 and decode_line_full. */
enum decode_line_flags
- {
- /* Set this flag if you want the resulting SALs to describe the
+{
+ /* Set this flag if you want the resulting SALs to describe the
first line of indicated functions. */
- DECODE_LINE_FUNFIRSTLINE = 1,
+ DECODE_LINE_FUNFIRSTLINE = 1,
- /* Set this flag if you want "list mode". In this mode, a
+ /* Set this flag if you want "list mode". In this mode, a
FILE:LINE linespec will always return a result, and such
linespecs will not be expanded to all matches. */
- DECODE_LINE_LIST_MODE = 2
- };
+ DECODE_LINE_LIST_MODE = 2
+};
/* decode_line_full returns a vector of these. */
@@ -81,9 +81,9 @@ struct linespec_result
/* Decode a linespec using the provided default symtab and line. */
extern std::vector<symtab_and_line>
- decode_line_1 (const location_spec *locspec, int flags,
- struct program_space *search_pspace,
- struct symtab *default_symtab, int default_line);
+decode_line_1 (const location_spec *locspec, int flags,
+ struct program_space *search_pspace,
+ struct symtab *default_symtab, int default_line);
/* Parse LOCSPEC and return results. This is the "full"
interface to this module, which handles multiple results
@@ -128,21 +128,20 @@ extern void decode_line_full (struct location_spec *locspec, int flags,
struct program_space *search_pspace,
struct symtab *default_symtab, int default_line,
struct linespec_result *canonical,
- const char *select_mode,
- const char *filter);
+ const char *select_mode, const char *filter);
/* Given a string, return the line specified by it, using the current
source symtab and line as defaults.
This is for commands like "list" and "breakpoint". */
-extern std::vector<symtab_and_line> decode_line_with_current_source
- (const char *, int);
+extern std::vector<symtab_and_line>
+decode_line_with_current_source (const char *, int);
/* Given a string, return the line specified by it, using the last displayed
codepoint's values as defaults, or nothing if they aren't valid. */
-extern std::vector<symtab_and_line> decode_line_with_last_displayed
- (const char *, int);
+extern std::vector<symtab_and_line>
+decode_line_with_last_displayed (const char *, int);
/* Does P represent one of the keywords? If so, return
the keyword. If not, return NULL. */
@@ -167,12 +166,11 @@ extern int is_ada_operator (const char *string);
extern void linespec_lex_to_end (const char **stringp);
-extern const char * const linespec_keywords[];
+extern const char *const linespec_keywords[];
/* Complete a linespec. */
-extern void linespec_complete (completion_tracker &tracker,
- const char *text,
+extern void linespec_complete (completion_tracker &tracker, const char *text,
symbol_name_match_type match_type);
/* Complete a function symbol, in linespec mode, according to
diff --git a/gdb/linux-fork.c b/gdb/linux-fork.c
index 61545b859ea..a14df69243f 100644
--- a/gdb/linux-fork.c
+++ b/gdb/linux-fork.c
@@ -204,8 +204,8 @@ call_lseek (int fd, off_t offset, int whence)
{
char exp[80];
- snprintf (&exp[0], sizeof (exp), "(long) lseek (%d, %ld, %d)",
- fd, (long) offset, whence);
+ snprintf (&exp[0], sizeof (exp), "(long) lseek (%d, %ld, %d)", fd,
+ (long) offset, whence);
return (off_t) parse_and_eval_long (&exp[0]);
}
@@ -305,15 +305,17 @@ linux_fork_killall (void)
pid_t pid = fi.ptid.pid ();
int status;
pid_t ret;
- do {
- /* Use SIGKILL instead of PTRACE_KILL because the former works even
+ do
+ {
+ /* Use SIGKILL instead of PTRACE_KILL because the former works even
if the thread is running, while the later doesn't. */
- kill (pid, SIGKILL);
- ret = waitpid (pid, &status, 0);
- /* We might get a SIGCHLD instead of an exit status. This is
+ kill (pid, SIGKILL);
+ ret = waitpid (pid, &status, 0);
+ /* We might get a SIGCHLD instead of an exit status. This is
aggravated by the first kill above - a child has just
died. MVS comment cut-and-pasted from linux-nat. */
- } while (ret == pid && WIFSTOPPED (status));
+ }
+ while (ret == pid && WIFSTOPPED (status));
}
/* Clear list, prepare to start fresh. */
@@ -348,7 +350,7 @@ linux_fork_mourn_inferior (void)
last = find_last_fork ();
fork_load_infrun_state (last);
- gdb_printf (_("[Switching to %s]\n"),
+ gdb_printf (_ ("[Switching to %s]\n"),
target_pid_to_str (inferior_ptid).c_str ());
/* If there's only one fork, switch back to non-fork mode. */
@@ -368,7 +370,7 @@ linux_fork_detach (int from_tty)
fork. */
if (ptrace (PTRACE_DETACH, inferior_ptid.pid (), 0, 0))
- error (_("Unable to detach %s"),
+ error (_ ("Unable to detach %s"),
target_pid_to_str (inferior_ptid).c_str ());
delete_fork (inferior_ptid);
@@ -381,7 +383,7 @@ linux_fork_detach (int from_tty)
fork_load_infrun_state (&fork_list.front ());
if (from_tty)
- gdb_printf (_("[Switching to %s]\n"),
+ gdb_printf (_ ("[Switching to %s]\n"),
target_pid_to_str (inferior_ptid).c_str ());
/* If there's only one fork, switch back to non-fork mode. */
@@ -396,6 +398,7 @@ linux_fork_detach (int from_tty)
class scoped_switch_fork_info
{
public:
+
/* Switch to the infrun state held on the fork_info identified by
PPTID. If PPTID is the current inferior then no switch is done. */
explicit scoped_switch_fork_info (ptid_t pptid)
@@ -432,9 +435,8 @@ public:
}
catch (const gdb_exception &ex)
{
- warning (_("Couldn't restore checkpoint state in %s: %s"),
- target_pid_to_str (m_oldfp->ptid).c_str (),
- ex.what ());
+ warning (_ ("Couldn't restore checkpoint state in %s: %s"),
+ target_pid_to_str (m_oldfp->ptid).c_str (), ex.what ());
}
}
}
@@ -442,6 +444,7 @@ public:
DISABLE_COPY_AND_ASSIGN (scoped_switch_fork_info);
private:
+
/* The fork_info for the previously selected infrun state, or nullptr if
we were already in the desired state, and nothing needs to be
restored. */
@@ -470,7 +473,8 @@ inferior_call_waitpid (ptid_t pptid, int pid)
/* Get the argv. */
argv[0] = value_from_longest (builtin_type (gdbarch)->builtin_int, pid);
- argv[1] = value_from_pointer (builtin_type (gdbarch)->builtin_data_ptr, 0);
+ argv[1]
+ = value_from_pointer (builtin_type (gdbarch)->builtin_data_ptr, 0);
argv[2] = value_from_longest (builtin_type (gdbarch)->builtin_int, 0);
retv = call_function_by_hand (waitpid_fn, NULL, argv);
@@ -491,25 +495,25 @@ delete_checkpoint_command (const char *args, int from_tty)
struct fork_info *fi;
if (!args || !*args)
- error (_("Requires argument (checkpoint id to delete)"));
+ error (_ ("Requires argument (checkpoint id to delete)"));
ptid = fork_id_to_ptid (parse_and_eval_long (args));
if (ptid == minus_one_ptid)
- error (_("No such checkpoint id, %s"), args);
+ error (_ ("No such checkpoint id, %s"), args);
if (ptid == inferior_ptid)
- error (_("\
+ error (_ ("\
Please switch to another checkpoint before deleting the current one"));
if (ptrace (PTRACE_KILL, ptid.pid (), 0, 0))
- error (_("Unable to kill pid %s"), target_pid_to_str (ptid).c_str ());
+ error (_ ("Unable to kill pid %s"), target_pid_to_str (ptid).c_str ());
fi = find_fork_ptid (ptid);
gdb_assert (fi);
pptid = fi->parent_ptid;
if (from_tty)
- gdb_printf (_("Killed %s\n"), target_pid_to_str (ptid).c_str ());
+ gdb_printf (_ ("Killed %s\n"), target_pid_to_str (ptid).c_str ());
delete_fork (ptid);
@@ -522,7 +526,7 @@ Please switch to another checkpoint before deleting the current one"));
|| (parent != NULL && parent->state == THREAD_STOPPED))
{
if (inferior_call_waitpid (pptid, ptid.pid ()))
- warning (_("Unable to wait pid %s"),
+ warning (_ ("Unable to wait pid %s"),
target_pid_to_str (ptid).c_str ());
}
}
@@ -533,21 +537,21 @@ detach_checkpoint_command (const char *args, int from_tty)
ptid_t ptid;
if (!args || !*args)
- error (_("Requires argument (checkpoint id to detach)"));
+ error (_ ("Requires argument (checkpoint id to detach)"));
ptid = fork_id_to_ptid (parse_and_eval_long (args));
if (ptid == minus_one_ptid)
- error (_("No such checkpoint id, %s"), args);
+ error (_ ("No such checkpoint id, %s"), args);
if (ptid == inferior_ptid)
- error (_("\
+ error (_ ("\
Please switch to another checkpoint before detaching the current one"));
if (ptrace (PTRACE_DETACH, ptid.pid (), 0, 0))
- error (_("Unable to detach %s"), target_pid_to_str (ptid).c_str ());
+ error (_ ("Unable to detach %s"), target_pid_to_str (ptid).c_str ());
if (from_tty)
- gdb_printf (_("Detached %s\n"), target_pid_to_str (ptid).c_str ());
+ gdb_printf (_ ("Detached %s\n"), target_pid_to_str (ptid).c_str ());
delete_fork (ptid);
}
@@ -578,16 +582,16 @@ info_checkpoints_command (const char *arg, int from_tty)
ULONGEST pc = fi.pc;
gdb_printf ("%d %s", fi.num, target_pid_to_str (fi.ptid).c_str ());
if (fi.num == 0)
- gdb_printf (_(" (main process)"));
- gdb_printf (_(" at "));
+ gdb_printf (_ (" (main process)"));
+ gdb_printf (_ (" at "));
gdb_puts (paddress (gdbarch, pc));
symtab_and_line sal = find_pc_line (pc, 0);
if (sal.symtab)
- gdb_printf (_(", file %s"),
+ gdb_printf (_ (", file %s"),
symtab_to_filename_for_display (sal.symtab));
if (sal.line)
- gdb_printf (_(", line %d"), sal.line);
+ gdb_printf (_ (", line %d"), sal.line);
if (!sal.symtab && !sal.line)
{
struct bound_minimal_symbol msym;
@@ -602,9 +606,9 @@ info_checkpoints_command (const char *arg, int from_tty)
if (printed == NULL)
{
if (requested > 0)
- gdb_printf (_("No checkpoint number %d.\n"), requested);
+ gdb_printf (_ ("No checkpoint number %d.\n"), requested);
else
- gdb_printf (_("No checkpoints.\n"));
+ gdb_printf (_ ("No checkpoints.\n"));
}
}
@@ -644,14 +648,14 @@ checkpoint_command (const char *args, int from_tty)
struct fork_info *fp;
pid_t retpid;
- if (!target_has_execution ())
- error (_("The program is not being run."));
+ if (!target_has_execution ())
+ error (_ ("The program is not being run."));
/* Ensure that the inferior is not multithreaded. */
update_thread_list ();
if (inf_has_multiple_threads ())
- error (_("checkpoint: can't checkpoint multiple threads."));
-
+ error (_ ("checkpoint: can't checkpoint multiple threads."));
+
/* Make the inferior fork, record its (and gdb's) state. */
if (lookup_minimal_symbol ("fork", NULL, NULL).minsym != NULL)
@@ -660,7 +664,7 @@ checkpoint_command (const char *args, int from_tty)
if (lookup_minimal_symbol ("_fork", NULL, NULL).minsym != NULL)
fork_fn = find_function_in_inferior ("fork", &fork_objf);
if (!fork_fn)
- error (_("checkpoint: can't find fork function in inferior."));
+ error (_ ("checkpoint: can't find fork function in inferior."));
gdbarch = fork_objf->arch ();
ret = value_from_longest (builtin_type (gdbarch)->builtin_int, 0);
@@ -673,8 +677,8 @@ checkpoint_command (const char *args, int from_tty)
ret = call_function_by_hand (fork_fn, NULL, {});
}
- if (!ret) /* Probably can't happen. */
- error (_("checkpoint: call_function_by_hand returned null."));
+ if (!ret) /* Probably can't happen. */
+ error (_ ("checkpoint: call_function_by_hand returned null."));
retpid = value_as_long (ret);
get_last_target_status (nullptr, &last_target_ptid, &last_target_waitstatus);
@@ -685,20 +689,19 @@ checkpoint_command (const char *args, int from_tty)
{
int parent_pid;
- gdb_printf (_("checkpoint %d: fork returned pid %ld.\n"),
+ gdb_printf (_ ("checkpoint %d: fork returned pid %ld.\n"),
fp != NULL ? fp->num : -1, (long) retpid);
if (info_verbose)
{
parent_pid = last_target_ptid.lwp ();
if (parent_pid == 0)
parent_pid = last_target_ptid.pid ();
- gdb_printf (_(" gdb says parent = %ld.\n"),
- (long) parent_pid);
+ gdb_printf (_ (" gdb says parent = %ld.\n"), (long) parent_pid);
}
}
if (!fp)
- error (_("Failed to find new fork"));
+ error (_ ("Failed to find new fork"));
if (one_fork_p ())
{
@@ -728,7 +731,7 @@ linux_fork_context (struct fork_info *newfp, int from_tty)
fork_load_infrun_state (newfp);
insert_breakpoints ();
- gdb_printf (_("Switching to %s\n"),
+ gdb_printf (_ ("Switching to %s\n"),
target_pid_to_str (inferior_ptid).c_str ());
print_stack_frame (get_selected_frame (NULL), 1, SRC_AND_LOC, 1);
@@ -741,28 +744,29 @@ restart_command (const char *args, int from_tty)
struct fork_info *fp;
if (!args || !*args)
- error (_("Requires argument (checkpoint id to restart)"));
+ error (_ ("Requires argument (checkpoint id to restart)"));
if ((fp = find_fork_id (parse_and_eval_long (args))) == NULL)
- error (_("Not found: checkpoint id %s"), args);
+ error (_ ("Not found: checkpoint id %s"), args);
linux_fork_context (fp, from_tty);
}
void _initialize_linux_fork ();
+
void
_initialize_linux_fork ()
{
/* Checkpoint command: create a fork of the inferior process
and set it aside for later debugging. */
- add_com ("checkpoint", class_obscure, checkpoint_command, _("\
+ add_com ("checkpoint", class_obscure, checkpoint_command, _ ("\
Fork a duplicate process (experimental)."));
/* Restart command: restore the context of a specified checkpoint
process. */
- add_com ("restart", class_obscure, restart_command, _("\
+ add_com ("restart", class_obscure, restart_command, _ ("\
Restore program context from a checkpoint.\n\
Usage: restart N\n\
Argument N is checkpoint ID, as displayed by 'info checkpoints'."));
@@ -770,14 +774,14 @@ Argument N is checkpoint ID, as displayed by 'info checkpoints'."));
/* Delete checkpoint command: kill the process and remove it from
the fork list. */
- add_cmd ("checkpoint", class_obscure, delete_checkpoint_command, _("\
+ add_cmd ("checkpoint", class_obscure, delete_checkpoint_command, _ ("\
Delete a checkpoint (experimental)."),
&deletelist);
/* Detach checkpoint command: release the process to run independently,
and remove it from the fork list. */
- add_cmd ("checkpoint", class_obscure, detach_checkpoint_command, _("\
+ add_cmd ("checkpoint", class_obscure, detach_checkpoint_command, _ ("\
Detach from a checkpoint (experimental)."),
&detachlist);
@@ -785,5 +789,5 @@ Detach from a checkpoint (experimental)."),
currently under gdb's control. */
add_info ("checkpoints", info_checkpoints_command,
- _("IDs of currently known checkpoints."));
+ _ ("IDs of currently known checkpoints."));
}
diff --git a/gdb/linux-nat-trad.c b/gdb/linux-nat-trad.c
index 8204f3883f5..09acc649fe2 100644
--- a/gdb/linux-nat-trad.c
+++ b/gdb/linux-nat-trad.c
@@ -39,7 +39,7 @@ linux_nat_trad_target::fetch_register (struct regcache *regcache, int regnum)
/* This isn't really an address, but ptrace thinks of it as one. */
addr = register_u_offset (gdbarch, regnum, 0);
- if (addr == (CORE_ADDR)-1
+ if (addr == (CORE_ADDR) -1
|| gdbarch_cannot_fetch_register (gdbarch, regnum))
{
regcache->raw_supply (regnum, NULL);
@@ -60,9 +60,9 @@ linux_nat_trad_target::fetch_register (struct regcache *regcache, int regnum)
errno = 0;
val = ptrace (PT_READ_U, pid, (PTRACE_TYPE_ARG3) (uintptr_t) addr, 0);
if (errno != 0)
- error (_("Couldn't read register %s (#%d): %s."),
- gdbarch_register_name (gdbarch, regnum),
- regnum, safe_strerror (errno));
+ error (_ ("Couldn't read register %s (#%d): %s."),
+ gdbarch_register_name (gdbarch, regnum), regnum,
+ safe_strerror (errno));
store_unsigned_integer (buf + i, chunk, byte_order, val);
addr += sizeof (PTRACE_TYPE_RET);
@@ -77,9 +77,7 @@ void
linux_nat_trad_target::fetch_registers (struct regcache *regcache, int regnum)
{
if (regnum == -1)
- for (regnum = 0;
- regnum < gdbarch_num_regs (regcache->arch ());
- regnum++)
+ for (regnum = 0; regnum < gdbarch_num_regs (regcache->arch ()); regnum++)
fetch_register (regcache, regnum);
else
fetch_register (regcache, regnum);
@@ -101,7 +99,7 @@ linux_nat_trad_target::store_register (const struct regcache *regcache,
/* This isn't really an address, but ptrace thinks of it as one. */
addr = register_u_offset (gdbarch, regnum, 1);
- if (addr == (CORE_ADDR)-1
+ if (addr == (CORE_ADDR) -1
|| gdbarch_cannot_store_register (gdbarch, regnum))
return;
@@ -121,9 +119,9 @@ linux_nat_trad_target::store_register (const struct regcache *regcache,
errno = 0;
ptrace (PT_WRITE_U, pid, (PTRACE_TYPE_ARG3) (uintptr_t) addr, val);
if (errno != 0)
- error (_("Couldn't write register %s (#%d): %s."),
- gdbarch_register_name (gdbarch, regnum),
- regnum, safe_strerror (errno));
+ error (_ ("Couldn't write register %s (#%d): %s."),
+ gdbarch_register_name (gdbarch, regnum), regnum,
+ safe_strerror (errno));
addr += sizeof (PTRACE_TYPE_RET);
}
@@ -136,9 +134,7 @@ void
linux_nat_trad_target::store_registers (struct regcache *regcache, int regnum)
{
if (regnum == -1)
- for (regnum = 0;
- regnum < gdbarch_num_regs (regcache->arch ());
- regnum++)
+ for (regnum = 0; regnum < gdbarch_num_regs (regcache->arch ()); regnum++)
store_register (regcache, regnum);
else
store_register (regcache, regnum);
diff --git a/gdb/linux-nat-trad.h b/gdb/linux-nat-trad.h
index ea6de24805a..e99855b5c80 100644
--- a/gdb/linux-nat-trad.h
+++ b/gdb/linux-nat-trad.h
@@ -28,16 +28,20 @@
class linux_nat_trad_target : public linux_nat_target
{
public:
+
void fetch_registers (struct regcache *, int) override;
void store_registers (struct regcache *, int) override;
protected:
+
/* Return the offset within the user area where a particular
register is stored. */
- virtual CORE_ADDR register_u_offset (struct gdbarch *gdbarch,
- int regnum, int store) = 0;
+ virtual CORE_ADDR register_u_offset (struct gdbarch *gdbarch, int regnum,
+ int store)
+ = 0;
private:
+
/* Helpers. See definition. */
void fetch_register (struct regcache *regcache, int regnum);
void store_register (const struct regcache *regcache, int regnum);
diff --git a/gdb/linux-nat.c b/gdb/linux-nat.c
index 2b206a4ec1e..b81875c22e1 100644
--- a/gdb/linux-nat.c
+++ b/gdb/linux-nat.c
@@ -39,13 +39,13 @@
#include "inf-child.h"
#include "inf-ptrace.h"
#include "auxv.h"
-#include <sys/procfs.h> /* for elf_gregset etc. */
-#include "elf-bfd.h" /* for elfcore_write_* */
-#include "gregset.h" /* for gregset */
-#include "gdbcore.h" /* for get_exec_file */
-#include <ctype.h> /* for isdigit */
-#include <sys/stat.h> /* for struct stat */
-#include <fcntl.h> /* for O_RDONLY */
+#include <sys/procfs.h> /* for elf_gregset etc. */
+#include "elf-bfd.h" /* for elfcore_write_* */
+#include "gregset.h" /* for gregset */
+#include "gdbcore.h" /* for get_exec_file */
+#include <ctype.h> /* for isdigit */
+#include <sys/stat.h> /* for struct stat */
+#include <fcntl.h> /* for O_RDONLY */
#include "inf-loop.h"
#include "gdbsupport/event-loop.h"
#include "event-top.h"
@@ -202,7 +202,7 @@ static void
show_debug_linux_nat (struct ui_file *file, int from_tty,
struct cmd_list_element *c, const char *value)
{
- gdb_printf (file, _("Debugging of GNU/Linux native targets is %s.\n"),
+ gdb_printf (file, _ ("Debugging of GNU/Linux native targets is %s.\n"),
value);
}
@@ -256,7 +256,6 @@ is_leader (lwp_info *lp)
return lp->ptid.pid () == lp->ptid.lwp ();
}
-
/* LWP accessors. */
/* See nat/linux-nat.h. */
@@ -270,8 +269,7 @@ ptid_of_lwp (struct lwp_info *lwp)
/* See nat/linux-nat.h. */
void
-lwp_set_arch_private_info (struct lwp_info *lwp,
- struct arch_lwp_info *info)
+lwp_set_arch_private_info (struct lwp_info *lwp, struct arch_lwp_info *info)
{
lwp->arch_private = info;
}
@@ -308,7 +306,6 @@ lwp_is_stepping (struct lwp_info *lwp)
return lwp->step;
}
-
/* Trivial list manipulation functions to keep track of a list of
new stopped processes. */
static void
@@ -350,11 +347,8 @@ linux_nat_ptrace_options (int attached)
if (!attached)
options |= PTRACE_O_EXITKILL;
- options |= (PTRACE_O_TRACESYSGOOD
- | PTRACE_O_TRACEVFORKDONE
- | PTRACE_O_TRACEVFORK
- | PTRACE_O_TRACEFORK
- | PTRACE_O_TRACEEXEC);
+ options |= (PTRACE_O_TRACESYSGOOD | PTRACE_O_TRACEVFORKDONE
+ | PTRACE_O_TRACEVFORK | PTRACE_O_TRACEFORK | PTRACE_O_TRACEEXEC);
return options;
}
@@ -375,8 +369,7 @@ linux_init_ptrace_procfs (pid_t pid, int attached)
proc_mem_file_is_writable ();
}
-linux_nat_target::~linux_nat_target ()
-{}
+linux_nat_target::~linux_nat_target () {}
void
linux_nat_target::post_attach (int pid)
@@ -410,10 +403,7 @@ num_lwps (int pid)
struct lwp_deleter
{
- void operator() (struct lwp_info *lwp) const
- {
- delete_lwp (lwp->ptid);
- }
+ void operator() (struct lwp_info *lwp) const { delete_lwp (lwp->ptid); }
};
/* A unique_ptr specialisation for lwp_info. */
@@ -466,16 +456,16 @@ linux_nat_target::follow_fork (inferior *child_inf, ptid_t child_ptid,
/* Note that we consult the parent's architecture instead of
the child's because there's no inferior for the child at
this point. */
- if (!gdbarch_software_single_step_p (target_thread_architecture
- (parent_ptid)))
+ if (!gdbarch_software_single_step_p (
+ target_thread_architecture (parent_ptid)))
{
int status;
linux_disable_event_reporting (child_pid);
if (ptrace (PTRACE_SINGLESTEP, child_pid, 0, 0) < 0)
- perror_with_name (_("Couldn't do single step"));
+ perror_with_name (_ ("Couldn't do single step"));
if (my_waitpid (child_pid, &status, 0) < 0)
- perror_with_name (_("Couldn't wait vfork process"));
+ perror_with_name (_ ("Couldn't wait vfork process"));
else
{
detach_child = WIFSTOPPED (status);
@@ -516,7 +506,6 @@ linux_nat_target::follow_fork (inferior *child_inf, ptid_t child_ptid,
}
}
-
int
linux_nat_target::insert_fork_catchpoint (int pid)
{
@@ -554,8 +543,9 @@ linux_nat_target::remove_exec_catchpoint (int pid)
}
int
-linux_nat_target::set_syscall_catchpoint (int pid, bool needed, int any_count,
- gdb::array_view<const int> syscall_counts)
+linux_nat_target::set_syscall_catchpoint (
+ int pid, bool needed, int any_count,
+ gdb::array_view<const int> syscall_counts)
{
/* On GNU/Linux, we ignore the arguments. It means that we only
enable the syscall catchpoints, but do not disable them.
@@ -654,8 +644,6 @@ lwp_list_remove (struct lwp_info *lp)
lwp_list.erase (lwp_list.iterator_to (*lp));
}
-
-
/* Signal mask for use with sigsuspend in linux_nat_wait, initialized in
_initialize_linux_nat. */
static sigset_t suspend_mask;
@@ -693,8 +681,8 @@ static sigset_t pass_mask;
/* Update signals to pass to the inferior. */
void
-linux_nat_target::pass_signals
- (gdb::array_view<const unsigned char> pass_signals)
+linux_nat_target::pass_signals (
+ gdb::array_view<const unsigned char> pass_signals)
{
int signo;
@@ -708,15 +696,12 @@ linux_nat_target::pass_signals
}
}
-
-
/* Prototypes for local functions. */
static int stop_wait_callback (struct lwp_info *lp);
-static int resume_stopped_resumed_lwps (struct lwp_info *lp, const ptid_t wait_ptid);
+static int resume_stopped_resumed_lwps (struct lwp_info *lp,
+ const ptid_t wait_ptid);
static int check_ptrace_stopped_lwp_gone (struct lwp_info *lp);
-
-
/* Destroy and free LP. */
lwp_info::~lwp_info ()
@@ -772,7 +757,6 @@ add_initial_lwp (ptid_t ptid)
lwp_info *lp = new lwp_info (ptid);
-
/* Add to sorted-by-reverse-creation-order list. */
lwp_list_add (lp);
@@ -896,7 +880,7 @@ exit_lwp (struct lwp_info *lp)
if (th)
{
if (print_thread_events)
- gdb_printf (_("[%s exited]\n"),
+ gdb_printf (_ ("[%s exited]\n"),
target_pid_to_str (lp->ptid).c_str ());
delete_thread (th);
@@ -964,11 +948,11 @@ linux_nat_post_attach_wait (ptid_t ptid, int *signalled)
void
linux_nat_target::create_inferior (const char *exec_file,
- const std::string &allargs,
- char **env, int from_tty)
+ const std::string &allargs, char **env,
+ int from_tty)
{
- maybe_disable_address_space_randomization restore_personality
- (disable_randomization);
+ maybe_disable_address_space_randomization restore_personality (
+ disable_randomization);
/* The fork_child mechanism is synchronous and calls target_wait, so
we have to mask the async mode. */
@@ -1005,21 +989,19 @@ attach_proc_task_lwp_callback (ptid_t ptid)
is marked as exited or zombie, as well as other
conditions, so in that case, confirm the status in
/proc/PID/status. */
- if (err == ESRCH
- || (err == EPERM && linux_proc_pid_is_gone (lwpid)))
+ if (err == ESRCH || (err == EPERM && linux_proc_pid_is_gone (lwpid)))
{
- linux_nat_debug_printf
- ("Cannot attach to lwp %d: thread is gone (%d: %s)",
- lwpid, err, safe_strerror (err));
-
+ linux_nat_debug_printf (
+ "Cannot attach to lwp %d: thread is gone (%d: %s)", lwpid, err,
+ safe_strerror (err));
}
else
{
std::string reason
= linux_ptrace_attach_fail_reason_string (ptid, err);
- warning (_("Cannot attach to lwp %d: %s"),
- lwpid, reason.c_str ());
+ warning (_ ("Cannot attach to lwp %d: %s"), lwpid,
+ reason.c_str ());
}
}
else
@@ -1073,16 +1055,14 @@ linux_nat_target::attach (const char *args, int from_tty)
std::string reason = linux_ptrace_attach_fail_reason (pid);
if (!reason.empty ())
- throw_error (ex.error, "warning: %s\n%s", reason.c_str (),
- ex.what ());
+ throw_error (ex.error, "warning: %s\n%s", reason.c_str (), ex.what ());
else
throw_error (ex.error, "%s", ex.what ());
}
/* The ptrace base target adds the main thread with (pid,0,0)
format. Decorate it with lwp info. */
- ptid = ptid_t (inferior_ptid.pid (),
- inferior_ptid.pid ());
+ ptid = ptid_t (inferior_ptid.pid (), inferior_ptid.pid ());
thread_change_ptid (linux_target, inferior_ptid, ptid);
/* Add the initial process as the first LWP to the list. */
@@ -1098,9 +1078,9 @@ linux_nat_target::attach (const char *args, int from_tty)
target_terminal::ours ();
target_mourn_inferior (inferior_ptid);
if (exit_code == 0)
- error (_("Unable to attach: program exited normally."));
+ error (_ ("Unable to attach: program exited normally."));
else
- error (_("Unable to attach: program exited with code %d."),
+ error (_ ("Unable to attach: program exited with code %d."),
exit_code);
}
else if (WIFSIGNALED (status))
@@ -1111,14 +1091,13 @@ linux_nat_target::attach (const char *args, int from_tty)
target_mourn_inferior (inferior_ptid);
signo = gdb_signal_from_host (WTERMSIG (status));
- error (_("Unable to attach: program terminated with signal "
- "%s, %s."),
- gdb_signal_to_name (signo),
- gdb_signal_to_string (signo));
+ error (_ ("Unable to attach: program terminated with signal "
+ "%s, %s."),
+ gdb_signal_to_name (signo), gdb_signal_to_string (signo));
}
- internal_error (_("unexpected status %d for PID %ld"),
- status, (long) ptid.lwp ());
+ internal_error (_ ("unexpected status %d for PID %ld"), status,
+ (long) ptid.lwp ());
}
lp->stopped = 1;
@@ -1164,23 +1143,22 @@ detach_one_pid (int pid, int signo)
ret = my_waitpid (pid, &status, __WALL);
if (ret == -1)
{
- warning (_("Couldn't reap LWP %d while detaching: %s"),
- pid, safe_strerror (errno));
+ warning (_ ("Couldn't reap LWP %d while detaching: %s"), pid,
+ safe_strerror (errno));
}
else if (!WIFEXITED (status) && !WIFSIGNALED (status))
{
- warning (_("Reaping LWP %d while detaching "
- "returned unexpected status 0x%x"),
+ warning (_ ("Reaping LWP %d while detaching "
+ "returned unexpected status 0x%x"),
pid, status);
}
}
else
- error (_("Can't detach %d: %s"),
- pid, safe_strerror (save_errno));
+ error (_ ("Can't detach %d: %s"), pid, safe_strerror (save_errno));
}
else
- linux_nat_debug_printf ("PTRACE_DETACH (%d, %s, 0) (OK)",
- pid, strsignal (signo));
+ linux_nat_debug_printf ("PTRACE_DETACH (%d, %s, 0) (OK)", pid,
+ strsignal (signo));
}
/* Get pending signal of THREAD as a host signal number, for detaching
@@ -1258,9 +1236,9 @@ get_detach_signal (struct lwp_info *lp)
}
else if (!signal_pass_state (signo))
{
- linux_nat_debug_printf
- ("lwp %s had signal %s but it is in no pass state",
- lp->ptid.to_string ().c_str (), gdb_signal_to_string (signo));
+ linux_nat_debug_printf (
+ "lwp %s had signal %s but it is in no pass state",
+ lp->ptid.to_string ().c_str (), gdb_signal_to_string (signo));
}
else
{
@@ -1298,11 +1276,12 @@ detach_one_lwp (struct lwp_info *lp, int *signo_p)
if (event == PTRACE_EVENT_FORK || event == PTRACE_EVENT_VFORK)
{
unsigned long child_pid;
- int ret = ptrace (PTRACE_GETEVENTMSG, lp->ptid.lwp (), 0, &child_pid);
+ int ret
+ = ptrace (PTRACE_GETEVENTMSG, lp->ptid.lwp (), 0, &child_pid);
if (ret == 0)
detach_one_pid (child_pid, 0);
else
- perror_warning_with_name (_("Failed to detach fork child"));
+ perror_warning_with_name (_ ("Failed to detach fork child"));
}
}
@@ -1311,7 +1290,6 @@ detach_one_lwp (struct lwp_info *lp, int *signo_p)
|| lp->waitstatus.kind () == TARGET_WAITKIND_FORKED)
detach_one_pid (lp->waitstatus.child_ptid ().pid (), 0);
-
/* Check in thread_info::pending_waitstatus. */
thread_info *tp = find_thread_ptid (linux_target, lp->ptid);
if (tp->has_pending_waitstatus ())
@@ -1535,8 +1513,8 @@ resume_lwp (struct lwp_info *lp, int step, enum gdb_signal signo)
linux_nat_debug_printf ("Resuming sibling %s, %s, %s",
lp->ptid.to_string ().c_str (),
(signo != GDB_SIGNAL_0
- ? strsignal (gdb_signal_to_host (signo))
- : "0"),
+ ? strsignal (gdb_signal_to_host (signo))
+ : "0"),
step ? "step" : "resume");
linux_resume_one_lwp (lp, step, signo);
@@ -1600,12 +1578,11 @@ linux_nat_target::resume (ptid_t scope_ptid, int step, enum gdb_signal signo)
{
struct lwp_info *lp;
- linux_nat_debug_printf ("Preparing to %s %s, %s, inferior_ptid %s",
- step ? "step" : "resume",
- scope_ptid.to_string ().c_str (),
- (signo != GDB_SIGNAL_0
- ? strsignal (gdb_signal_to_host (signo)) : "0"),
- inferior_ptid.to_string ().c_str ());
+ linux_nat_debug_printf (
+ "Preparing to %s %s, %s, inferior_ptid %s", step ? "step" : "resume",
+ scope_ptid.to_string ().c_str (),
+ (signo != GDB_SIGNAL_0 ? strsignal (gdb_signal_to_host (signo)) : "0"),
+ inferior_ptid.to_string ().c_str ());
/* Mark the lwps we're resuming as resumed and update their
last_resume_kind to resume_continue. */
@@ -1627,12 +1604,11 @@ linux_nat_target::resume (ptid_t scope_ptid, int step, enum gdb_signal signo)
if (lp->status && WIFSTOPPED (lp->status))
{
- if (!lp->step
- && WSTOPSIG (lp->status)
+ if (!lp->step && WSTOPSIG (lp->status)
&& sigismember (&pass_mask, WSTOPSIG (lp->status)))
{
- linux_nat_debug_printf
- ("Not short circuiting for ignored status 0x%x", lp->status);
+ linux_nat_debug_printf (
+ "Not short circuiting for ignored status 0x%x", lp->status);
/* FIXME: What should we do if we are supposed to continue
this thread with a signal? */
@@ -1648,8 +1624,7 @@ linux_nat_target::resume (ptid_t scope_ptid, int step, enum gdb_signal signo)
this thread with a signal? */
gdb_assert (signo == GDB_SIGNAL_0);
- linux_nat_debug_printf ("Short circuiting for status 0x%x",
- lp->status);
+ linux_nat_debug_printf ("Short circuiting for status 0x%x", lp->status);
if (target_can_async_p ())
{
@@ -1662,16 +1637,14 @@ linux_nat_target::resume (ptid_t scope_ptid, int step, enum gdb_signal signo)
/* No use iterating unless we're resuming other threads. */
if (scope_ptid != lp->ptid)
- iterate_over_lwps (scope_ptid, [=] (struct lwp_info *info)
- {
- return linux_nat_resume_callback (info, lp);
- });
+ iterate_over_lwps (scope_ptid, [=] (struct lwp_info *info) {
+ return linux_nat_resume_callback (info, lp);
+ });
- linux_nat_debug_printf ("%s %s, %s (resume event thread)",
- step ? "PTRACE_SINGLESTEP" : "PTRACE_CONT",
- lp->ptid.to_string ().c_str (),
- (signo != GDB_SIGNAL_0
- ? strsignal (gdb_signal_to_host (signo)) : "0"));
+ linux_nat_debug_printf (
+ "%s %s, %s (resume event thread)",
+ step ? "PTRACE_SINGLESTEP" : "PTRACE_CONT", lp->ptid.to_string ().c_str (),
+ (signo != GDB_SIGNAL_0 ? strsignal (gdb_signal_to_host (signo)) : "0"));
linux_resume_one_lwp (lp, step, signo);
}
@@ -1730,9 +1703,10 @@ linux_handle_syscall_trap (struct lwp_info *lp, int stopping)
actually get to execute. It seems it would be even more
confusing to the user. */
- linux_nat_debug_printf
- ("ignoring syscall %d for LWP %ld (stopping threads), resuming with "
- "PTRACE_CONT for SIGSTOP", syscall_number, lp->ptid.lwp ());
+ linux_nat_debug_printf (
+ "ignoring syscall %d for LWP %ld (stopping threads), resuming with "
+ "PTRACE_CONT for SIGSTOP",
+ syscall_number, lp->ptid.lwp ());
lp->syscall_state = TARGET_WAITKIND_IGNORE;
ptrace (PTRACE_CONT, lp->ptid.lwp (), 0, 0);
@@ -1746,8 +1720,8 @@ linux_handle_syscall_trap (struct lwp_info *lp, int stopping)
between syscall enter/return, and we'll need to know to
report a syscall return if that happens. */
lp->syscall_state = (lp->syscall_state == TARGET_WAITKIND_SYSCALL_ENTRY
- ? TARGET_WAITKIND_SYSCALL_RETURN
- : TARGET_WAITKIND_SYSCALL_ENTRY);
+ ? TARGET_WAITKIND_SYSCALL_RETURN
+ : TARGET_WAITKIND_SYSCALL_ENTRY);
if (catch_syscall_enabled ())
{
@@ -1761,18 +1735,22 @@ linux_handle_syscall_trap (struct lwp_info *lp, int stopping)
else
gdb_assert_not_reached ("unexpected syscall state");
- linux_nat_debug_printf
- ("stopping for %s of syscall %d for LWP %ld",
- (lp->syscall_state == TARGET_WAITKIND_SYSCALL_ENTRY
- ? "entry" : "return"), syscall_number, lp->ptid.lwp ());
+ linux_nat_debug_printf ("stopping for %s of syscall %d for LWP %ld",
+ (lp->syscall_state
+ == TARGET_WAITKIND_SYSCALL_ENTRY
+ ? "entry"
+ : "return"),
+ syscall_number, lp->ptid.lwp ());
return 0;
}
- linux_nat_debug_printf
- ("ignoring %s of syscall %d for LWP %ld",
- (lp->syscall_state == TARGET_WAITKIND_SYSCALL_ENTRY
- ? "entry" : "return"), syscall_number, lp->ptid.lwp ());
+ linux_nat_debug_printf ("ignoring %s of syscall %d for LWP %ld",
+ (lp->syscall_state
+ == TARGET_WAITKIND_SYSCALL_ENTRY
+ ? "entry"
+ : "return"),
+ syscall_number, lp->ptid.lwp ());
}
else
{
@@ -1792,9 +1770,10 @@ linux_handle_syscall_trap (struct lwp_info *lp, int stopping)
The points above mean that the next resume, be it PT_STEP or
PT_CONTINUE, can not trigger a syscall trace event. */
- linux_nat_debug_printf
- ("caught syscall event with no syscall catchpoints. %d for LWP %ld, "
- "ignoring", syscall_number, lp->ptid.lwp ());
+ linux_nat_debug_printf (
+ "caught syscall event with no syscall catchpoints. %d for LWP %ld, "
+ "ignoring",
+ syscall_number, lp->ptid.lwp ());
lp->syscall_state = TARGET_WAITKIND_IGNORE;
}
@@ -1836,17 +1815,18 @@ linux_handle_extended_wait (struct lwp_info *lp, int status)
ptrace (PTRACE_GETEVENTMSG, pid, 0, &new_pid);
/* If we haven't already seen the new PID stop, wait for it now. */
- if (! pull_pid_from_list (&stopped_pids, new_pid, &status))
+ if (!pull_pid_from_list (&stopped_pids, new_pid, &status))
{
/* The new child has a pending SIGSTOP. We can't affect it until it
hits the SIGSTOP, but we're already attached. */
ret = my_waitpid (new_pid, &status, __WALL);
if (ret == -1)
- perror_with_name (_("waiting for new child"));
+ perror_with_name (_ ("waiting for new child"));
else if (ret != new_pid)
- internal_error (_("wait returned unexpected PID %d"), ret);
+ internal_error (_ ("wait returned unexpected PID %d"), ret);
else if (!WIFSTOPPED (status))
- internal_error (_("wait returned unexpected status 0x%x"), status);
+ internal_error (_ ("wait returned unexpected status 0x%x"),
+ status);
}
ptid_t child_ptid (new_pid, new_pid);
@@ -1899,8 +1879,8 @@ linux_handle_extended_wait (struct lwp_info *lp, int status)
ourstatus->set_ignore ();
- linux_nat_debug_printf
- ("Got clone event from LWP %d, new child is LWP %ld", pid, new_pid);
+ linux_nat_debug_printf (
+ "Got clone event from LWP %d, new child is LWP %ld", pid, new_pid);
new_lp = add_lwp (ptid_t (lp->ptid.pid (), new_pid));
new_lp->stopped = 1;
@@ -1938,9 +1918,9 @@ linux_handle_extended_wait (struct lwp_info *lp, int status)
gdb_assert (new_lp->status == 0);
/* Save the wait status to report later. */
- linux_nat_debug_printf
- ("waitpid of new LWP %ld, saving status %s",
- (long) new_lp->ptid.lwp (), status_to_str (status).c_str ());
+ linux_nat_debug_printf (
+ "waitpid of new LWP %ld, saving status %s",
+ (long) new_lp->ptid.lwp (), status_to_str (status).c_str ());
new_lp->status = status;
}
else if (report_thread_events)
@@ -1967,8 +1947,8 @@ linux_handle_extended_wait (struct lwp_info *lp, int status)
/* Open a new file for the new address space. */
open_proc_mem_file (lp->ptid);
- ourstatus->set_execd
- (make_unique_xstrdup (linux_proc_pid_to_exec_file (pid)));
+ ourstatus->set_execd (
+ make_unique_xstrdup (linux_proc_pid_to_exec_file (pid)));
/* The thread that execed must have been resumed, but, when a
thread execs, it changes its tid to the tgid, and the old
@@ -1979,14 +1959,13 @@ linux_handle_extended_wait (struct lwp_info *lp, int status)
if (event == PTRACE_EVENT_VFORK_DONE)
{
- linux_nat_debug_printf
- ("Got PTRACE_EVENT_VFORK_DONE from LWP %ld",
- lp->ptid.lwp ());
- ourstatus->set_vfork_done ();
- return 0;
+ linux_nat_debug_printf ("Got PTRACE_EVENT_VFORK_DONE from LWP %ld",
+ lp->ptid.lwp ());
+ ourstatus->set_vfork_done ();
+ return 0;
}
- internal_error (_("unknown ptrace event %d"), event);
+ internal_error (_ ("unknown ptrace event %d"), event);
}
/* Suspend waiting for a signal. We're mostly interested in
@@ -2090,8 +2069,7 @@ wait_lwp (struct lwp_info *lp)
/* Check if the thread has exited. */
if (WIFEXITED (status) || WIFSIGNALED (status))
{
- if (report_thread_events
- || lp->ptid.pid () == lp->ptid.lwp ())
+ if (report_thread_events || lp->ptid.pid () == lp->ptid.lwp ())
{
linux_nat_debug_printf ("LWP %d exited.", lp->ptid.pid ());
@@ -2207,11 +2185,9 @@ linux_stop_and_wait_all_lwps (void)
void
linux_unstop_all_lwps (void)
{
- iterate_over_lwps (minus_one_ptid,
- [] (struct lwp_info *info)
- {
- return resume_stopped_resumed_lwps (info, minus_one_ptid);
- });
+ iterate_over_lwps (minus_one_ptid, [] (struct lwp_info *info) {
+ return resume_stopped_resumed_lwps (info, minus_one_ptid);
+ });
}
/* Return non-zero if LWP PID has a pending SIGINT. */
@@ -2223,8 +2199,7 @@ linux_nat_has_pending_sigint (int pid)
linux_proc_pending_signals (pid, &pending, &blocked, &ignored);
- if (sigismember (&pending, SIGINT)
- && !sigismember (&ignored, SIGINT))
+ if (sigismember (&pending, SIGINT) && !sigismember (&ignored, SIGINT))
return 1;
return 0;
@@ -2357,10 +2332,10 @@ stop_wait_callback (struct lwp_info *lp)
errno = 0;
ptrace (PTRACE_CONT, lp->ptid.lwp (), 0, 0);
lp->stopped = 0;
- linux_nat_debug_printf
- ("PTRACE_CONT %s, 0, 0 (%s) (discarding SIGINT)",
- lp->ptid.to_string ().c_str (),
- errno ? safe_strerror (errno) : "OK");
+ linux_nat_debug_printf (
+ "PTRACE_CONT %s, 0, 0 (%s) (discarding SIGINT)",
+ lp->ptid.to_string ().c_str (),
+ errno ? safe_strerror (errno) : "OK");
return stop_wait_callback (lp);
}
@@ -2480,8 +2455,7 @@ count_events_callback (struct lwp_info *lp, int *count)
static int
select_singlestep_lwp_callback (struct lwp_info *lp)
{
- if (lp->last_resume_kind == resume_step
- && lp->status != 0)
+ if (lp->last_resume_kind == resume_step && lp->status != 0)
return 1;
else
return 0;
@@ -2591,8 +2565,7 @@ save_stop_reason (struct lwp_info *lp)
}
#else
if ((!lp->step || lp->stop_pc == sw_bp_pc)
- && software_breakpoint_inserted_here_p (regcache->aspace (),
- sw_bp_pc))
+ && software_breakpoint_inserted_here_p (regcache->aspace (), sw_bp_pc))
{
/* The LWP was either continued, or stepped a software
breakpoint instruction. */
@@ -2632,7 +2605,6 @@ save_stop_reason (struct lwp_info *lp)
lp->stop_pc = pc;
}
-
/* Returns true if the LWP had stopped for a software breakpoint. */
bool
@@ -2710,30 +2682,23 @@ select_event_lwp (ptid_t filter, struct lwp_info **orig_lp, int *status)
/* Pick one at random, out of those which have had events. */
/* First see how many events we have. */
- iterate_over_lwps (filter,
- [&] (struct lwp_info *info)
- {
- return count_events_callback (info, &num_events);
- });
+ iterate_over_lwps (filter, [&] (struct lwp_info *info) {
+ return count_events_callback (info, &num_events);
+ });
gdb_assert (num_events > 0);
/* Now randomly pick a LWP out of those that have had
events. */
- random_selector = (int)
- ((num_events * (double) rand ()) / (RAND_MAX + 1.0));
+ random_selector
+ = (int) ((num_events * (double) rand ()) / (RAND_MAX + 1.0));
if (num_events > 1)
- linux_nat_debug_printf ("Found %d events, selecting #%d",
- num_events, random_selector);
+ linux_nat_debug_printf ("Found %d events, selecting #%d", num_events,
+ random_selector);
- event_lp
- = (iterate_over_lwps
- (filter,
- [&] (struct lwp_info *info)
- {
- return select_event_lwp_callback (info,
- &random_selector);
- }));
+ event_lp = (iterate_over_lwps (filter, [&] (struct lwp_info *info) {
+ return select_event_lwp_callback (info, &random_selector);
+ }));
}
if (event_lp != NULL)
@@ -2778,9 +2743,8 @@ linux_nat_filter_event (int lwpid, int status)
leader zombie, and removed it from our lists (in
check_zombie_leaders). The non-leader thread changes
its tid to the tgid. */
- linux_nat_debug_printf
- ("Re-adding thread group leader LWP %d after exec.",
- lwpid);
+ linux_nat_debug_printf (
+ "Re-adding thread group leader LWP %d after exec.", lwpid);
lp = add_lwp (ptid_t (lwpid, lwpid));
lp->stopped = 1;
@@ -2794,9 +2758,9 @@ linux_nat_filter_event (int lwpid, int status)
its PID and go back to waiting for the fork event to
be reported - the stopped process might be returned
from waitpid before or after the fork event is. */
- linux_nat_debug_printf
- ("Saving LWP %d status %s in stopped_pids list",
- lwpid, status_to_str (status).c_str ());
+ linux_nat_debug_printf (
+ "Saving LWP %d status %s in stopped_pids list", lwpid,
+ status_to_str (status).c_str ());
add_to_pid_list (&stopped_pids, lwpid, status);
}
}
@@ -2812,9 +2776,8 @@ linux_nat_filter_event (int lwpid, int status)
{
if (inf->pid == lwpid)
{
- linux_nat_debug_printf
- ("Re-adding thread group leader LWP %d after exit.",
- lwpid);
+ linux_nat_debug_printf (
+ "Re-adding thread group leader LWP %d after exit.", lwpid);
lp = add_lwp (ptid_t (lwpid, lwpid));
lp->resumed = 1;
@@ -2888,8 +2851,8 @@ linux_nat_filter_event (int lwpid, int status)
exit, if e.g., some other thread brings down the whole
process (calls `exit'). So don't assert that the lwp is
resumed. */
- linux_nat_debug_printf ("LWP %ld exited (resumed=%d)",
- lp->ptid.lwp (), lp->resumed);
+ linux_nat_debug_printf ("LWP %ld exited (resumed=%d)", lp->ptid.lwp (),
+ lp->resumed);
/* Dead LWP's aren't expected to reported a pending sigstop. */
lp->signalled = 0;
@@ -2902,8 +2865,7 @@ linux_nat_filter_event (int lwpid, int status)
/* Make sure we don't report a SIGSTOP that we sent ourselves in
an attempt to stop an LWP. */
- if (lp->signalled
- && WIFSTOPPED (status) && WSTOPSIG (status) == SIGSTOP)
+ if (lp->signalled && WIFSTOPPED (status) && WSTOPSIG (status) == SIGSTOP)
{
lp->signalled = 0;
@@ -2916,10 +2878,10 @@ linux_nat_filter_event (int lwpid, int status)
{
/* This is a delayed SIGSTOP. Filter out the event. */
- linux_nat_debug_printf
- ("%s %s, 0, 0 (discard delayed SIGSTOP)",
- lp->step ? "PTRACE_SINGLESTEP" : "PTRACE_CONT",
- lp->ptid.to_string ().c_str ());
+ linux_nat_debug_printf ("%s %s, 0, 0 (discard delayed SIGSTOP)",
+ lp->step ? "PTRACE_SINGLESTEP"
+ : "PTRACE_CONT",
+ lp->ptid.to_string ().c_str ());
linux_resume_one_lwp (lp, lp->step, GDB_SIGNAL_0);
gdb_assert (lp->resumed);
@@ -2929,8 +2891,7 @@ linux_nat_filter_event (int lwpid, int status)
/* Make sure we don't report a SIGINT that we have already displayed
for another thread. */
- if (lp->ignore_sigint
- && WIFSTOPPED (status) && WSTOPSIG (status) == SIGINT)
+ if (lp->ignore_sigint && WIFSTOPPED (status) && WSTOPSIG (status) == SIGINT)
{
linux_nat_debug_printf ("Delayed SIGINT caught for %s.",
lp->ptid.to_string ().c_str ());
@@ -2981,19 +2942,20 @@ linux_nat_filter_event (int lwpid, int status)
Otherwise, signals in pass_mask may be short-circuited
except signals that might be caused by a breakpoint, or SIGSTOP
if we sent the SIGSTOP and are waiting for it to arrive. */
- if (!lp->step
- && WSTOPSIG (status) && sigismember (&pass_mask, WSTOPSIG (status))
+ if (!lp->step && WSTOPSIG (status)
+ && sigismember (&pass_mask, WSTOPSIG (status))
&& (WSTOPSIG (status) != SIGSTOP
|| !find_thread_ptid (linux_target, lp->ptid)->stop_requested)
&& !linux_wstatus_maybe_breakpoint (status))
{
linux_resume_one_lwp (lp, lp->step, signo);
- linux_nat_debug_printf
- ("%s %s, %s (preempt 'handle')",
- lp->step ? "PTRACE_SINGLESTEP" : "PTRACE_CONT",
- lp->ptid.to_string ().c_str (),
- (signo != GDB_SIGNAL_0
- ? strsignal (gdb_signal_to_host (signo)) : "0"));
+ linux_nat_debug_printf ("%s %s, %s (preempt 'handle')",
+ lp->step ? "PTRACE_SINGLESTEP"
+ : "PTRACE_CONT",
+ lp->ptid.to_string ().c_str (),
+ (signo != GDB_SIGNAL_0
+ ? strsignal (gdb_signal_to_host (signo))
+ : "0"));
return;
}
}
@@ -3025,8 +2987,7 @@ check_zombie_leaders (void)
multi-threaded and is exiting, it may be we see the
leader as zombie before we reap all the non-leader
threads. See comments below. */
- && num_lwps (inf->pid) > 1
- && linux_proc_pid_is_zombie (inf->pid))
+ && num_lwps (inf->pid) > 1 && linux_proc_pid_is_zombie (inf->pid))
{
/* A zombie leader in a multi-threaded program can mean one
of three things:
@@ -3164,16 +3125,14 @@ linux_nat_wait_1 (ptid_t ptid, struct target_waitstatus *ourstatus,
the TGID pid. */
errno = 0;
- lwpid = my_waitpid (-1, &status, __WALL | WNOHANG);
+ lwpid = my_waitpid (-1, &status, __WALL | WNOHANG);
- linux_nat_debug_printf ("waitpid(-1, ...) returned %d, %s",
- lwpid,
+ linux_nat_debug_printf ("waitpid(-1, ...) returned %d, %s", lwpid,
errno ? safe_strerror (errno) : "ERRNO-OK");
if (lwpid > 0)
{
- linux_nat_debug_printf ("waitpid %ld received %s",
- (long) lwpid,
+ linux_nat_debug_printf ("waitpid %ld received %s", (long) lwpid,
status_to_str (status).c_str ());
linux_nat_filter_event (lwpid, status);
@@ -3184,11 +3143,9 @@ linux_nat_wait_1 (ptid_t ptid, struct target_waitstatus *ourstatus,
/* Now that we've pulled all events out of the kernel, resume
LWPs that don't have an interesting event to report. */
- iterate_over_lwps (minus_one_ptid,
- [] (struct lwp_info *info)
- {
- return resume_stopped_resumed_lwps (info, minus_one_ptid);
- });
+ iterate_over_lwps (minus_one_ptid, [] (struct lwp_info *info) {
+ return resume_stopped_resumed_lwps (info, minus_one_ptid);
+ });
/* ... and find an LWP with a status to report to the core, if
any. */
@@ -3369,10 +3326,10 @@ resume_stopped_resumed_lwps (struct lwp_info *lp, const ptid_t wait_ptid)
if (!leave_stopped)
{
- linux_nat_debug_printf
- ("resuming stopped-resumed LWP %s at %s: step=%d",
- lp->ptid.to_string ().c_str (), paddress (gdbarch, pc),
- lp->step);
+ linux_nat_debug_printf (
+ "resuming stopped-resumed LWP %s at %s: step=%d",
+ lp->ptid.to_string ().c_str (), paddress (gdbarch, pc),
+ lp->step);
linux_resume_one_lwp_throw (lp, lp->step, GDB_SIGNAL_0);
}
@@ -3408,11 +3365,9 @@ linux_nat_target::wait (ptid_t ptid, struct target_waitstatus *ourstatus,
meanwhile the event became uninteresting. Don't bother resuming
LWPs we're not going to wait for if they'd stop immediately. */
if (target_is_non_stop_p ())
- iterate_over_lwps (minus_one_ptid,
- [=] (struct lwp_info *info)
- {
- return resume_stopped_resumed_lwps (info, ptid);
- });
+ iterate_over_lwps (minus_one_ptid, [=] (struct lwp_info *info) {
+ return resume_stopped_resumed_lwps (info, ptid);
+ });
event_ptid = linux_nat_wait_1 (ptid, ourstatus, target_options);
@@ -3442,9 +3397,9 @@ kill_one_lwp (pid_t pid)
{
int save_errno = errno;
- linux_nat_debug_printf
- ("kill (SIGKILL) %ld, 0, 0 (%s)", (long) pid,
- save_errno != 0 ? safe_strerror (save_errno) : "OK");
+ linux_nat_debug_printf ("kill (SIGKILL) %ld, 0, 0 (%s)", (long) pid,
+ save_errno != 0 ? safe_strerror (save_errno)
+ : "OK");
}
/* Some kernels ignore even SIGKILL for processes under ptrace. */
@@ -3455,9 +3410,8 @@ kill_one_lwp (pid_t pid)
{
int save_errno = errno;
- linux_nat_debug_printf
- ("PTRACE_KILL %ld, 0, 0 (%s)", (long) pid,
- save_errno ? safe_strerror (save_errno) : "OK");
+ linux_nat_debug_printf ("PTRACE_KILL %ld, 0, 0 (%s)", (long) pid,
+ save_errno ? safe_strerror (save_errno) : "OK");
}
}
@@ -3576,7 +3530,7 @@ linux_nat_target::mourn_inferior ()
close_proc_mem_file (pid);
- if (! forks_exist_p ())
+ if (!forks_exist_p ())
/* Normal case, no other forks available. */
inf_ptrace_target::mourn_inferior ();
else
@@ -3607,10 +3561,9 @@ siginfo_fixup (siginfo_t *siginfo, gdb_byte *inf_siginfo, int direction)
}
static enum target_xfer_status
-linux_xfer_siginfo (ptid_t ptid, enum target_object object,
- const char *annex, gdb_byte *readbuf,
- const gdb_byte *writebuf, ULONGEST offset, ULONGEST len,
- ULONGEST *xfered_len)
+linux_xfer_siginfo (ptid_t ptid, enum target_object object, const char *annex,
+ gdb_byte *readbuf, const gdb_byte *writebuf,
+ ULONGEST offset, ULONGEST len, ULONGEST *xfered_len)
{
siginfo_t siginfo;
gdb_byte inf_siginfo[sizeof (siginfo_t)];
@@ -3656,10 +3609,9 @@ linux_xfer_siginfo (ptid_t ptid, enum target_object object,
}
static enum target_xfer_status
-linux_nat_xfer_osdata (enum target_object object,
- const char *annex, gdb_byte *readbuf,
- const gdb_byte *writebuf, ULONGEST offset, ULONGEST len,
- ULONGEST *xfered_len);
+linux_nat_xfer_osdata (enum target_object object, const char *annex,
+ gdb_byte *readbuf, const gdb_byte *writebuf,
+ ULONGEST offset, ULONGEST len, ULONGEST *xfered_len);
static enum target_xfer_status
linux_proc_xfer_memory_partial (int pid, gdb_byte *readbuf,
@@ -3667,10 +3619,10 @@ linux_proc_xfer_memory_partial (int pid, gdb_byte *readbuf,
LONGEST len, ULONGEST *xfered_len);
enum target_xfer_status
-linux_nat_target::xfer_partial (enum target_object object,
- const char *annex, gdb_byte *readbuf,
- const gdb_byte *writebuf,
- ULONGEST offset, ULONGEST len, ULONGEST *xfered_len)
+linux_nat_target::xfer_partial (enum target_object object, const char *annex,
+ gdb_byte *readbuf, const gdb_byte *writebuf,
+ ULONGEST offset, ULONGEST len,
+ ULONGEST *xfered_len)
{
if (object == TARGET_OBJECT_SIGNAL_INFO)
return linux_xfer_siginfo (inferior_ptid, object, annex, readbuf, writebuf,
@@ -3683,12 +3635,12 @@ linux_nat_target::xfer_partial (enum target_object object,
return TARGET_XFER_EOF;
if (object == TARGET_OBJECT_AUXV)
- return memory_xfer_auxv (this, object, annex, readbuf, writebuf,
- offset, len, xfered_len);
+ return memory_xfer_auxv (this, object, annex, readbuf, writebuf, offset,
+ len, xfered_len);
if (object == TARGET_OBJECT_OSDATA)
- return linux_nat_xfer_osdata (object, annex, readbuf, writebuf,
- offset, len, xfered_len);
+ return linux_nat_xfer_osdata (object, annex, readbuf, writebuf, offset,
+ len, xfered_len);
if (object == TARGET_OBJECT_MEMORY)
{
@@ -3752,8 +3704,7 @@ std::string
linux_nat_target::pid_to_str (ptid_t ptid)
{
if (ptid.lwp_p ()
- && (ptid.pid () != ptid.lwp ()
- || num_lwps (ptid.pid ()) > 1))
+ && (ptid.pid () != ptid.lwp () || num_lwps (ptid.pid ()) > 1))
return string_printf ("LWP %ld", ptid.lwp ());
return normal_pid_to_str (ptid);
@@ -3800,27 +3751,27 @@ linux_nat_target::pid_to_exec_file (int pid)
class proc_mem_file
{
public:
+
proc_mem_file (ptid_t ptid, int fd)
- : m_ptid (ptid), m_fd (fd)
+ : m_ptid (ptid),
+ m_fd (fd)
{
gdb_assert (m_fd != -1);
}
~proc_mem_file ()
{
- linux_nat_debug_printf ("closing fd %d for /proc/%d/task/%ld/mem",
- m_fd, m_ptid.pid (), m_ptid.lwp ());
+ linux_nat_debug_printf ("closing fd %d for /proc/%d/task/%ld/mem", m_fd,
+ m_ptid.pid (), m_ptid.lwp ());
close (m_fd);
}
DISABLE_COPY_AND_ASSIGN (proc_mem_file);
- int fd ()
- {
- return m_fd;
- }
+ int fd () { return m_fd; }
private:
+
/* The LWP this file was opened for. Just for debugging
purposes. */
ptid_t m_ptid;
@@ -3861,16 +3812,15 @@ open_proc_mem_file (ptid_t ptid)
gdb_assert (iter == proc_mem_file_map.end ());
char filename[64];
- xsnprintf (filename, sizeof filename,
- "/proc/%d/task/%ld/mem", ptid.pid (), ptid.lwp ());
+ xsnprintf (filename, sizeof filename, "/proc/%d/task/%ld/mem", ptid.pid (),
+ ptid.lwp ());
int fd = gdb_open_cloexec (filename, O_RDWR | O_LARGEFILE, 0).release ();
if (fd == -1)
{
- warning (_("opening /proc/PID/mem file for lwp %d.%ld failed: %s (%d)"),
- ptid.pid (), ptid.lwp (),
- safe_strerror (errno), errno);
+ warning (_ ("opening /proc/PID/mem file for lwp %d.%ld failed: %s (%d)"),
+ ptid.pid (), ptid.lwp (), safe_strerror (errno), errno);
return;
}
@@ -3878,8 +3828,8 @@ open_proc_mem_file (ptid_t ptid)
std::forward_as_tuple (ptid.pid ()),
std::forward_as_tuple (ptid, fd));
- linux_nat_debug_printf ("opened fd %d for lwp %d.%ld",
- fd, ptid.pid (), ptid.lwp ());
+ linux_nat_debug_printf ("opened fd %d for lwp %d.%ld", fd, ptid.pid (),
+ ptid.lwp ());
}
/* Helper for linux_proc_xfer_memory_partial and
@@ -3888,10 +3838,9 @@ open_proc_mem_file (ptid_t ptid)
the arguments are like linux_proc_xfer_memory_partial's. */
static enum target_xfer_status
-linux_proc_xfer_memory_partial_fd (int fd, int pid,
- gdb_byte *readbuf, const gdb_byte *writebuf,
- ULONGEST offset, LONGEST len,
- ULONGEST *xfered_len)
+linux_proc_xfer_memory_partial_fd (int fd, int pid, gdb_byte *readbuf,
+ const gdb_byte *writebuf, ULONGEST offset,
+ LONGEST len, ULONGEST *xfered_len)
{
ssize_t ret;
@@ -3902,26 +3851,24 @@ linux_proc_xfer_memory_partial_fd (int fd, int pid,
debugging a SPARC64 application). */
#ifdef HAVE_PREAD64
ret = (readbuf ? pread64 (fd, readbuf, len, offset)
- : pwrite64 (fd, writebuf, len, offset));
+ : pwrite64 (fd, writebuf, len, offset));
#else
ret = lseek (fd, offset, SEEK_SET);
if (ret != -1)
- ret = (readbuf ? read (fd, readbuf, len)
- : write (fd, writebuf, len));
+ ret = (readbuf ? read (fd, readbuf, len) : write (fd, writebuf, len));
#endif
if (ret == -1)
{
- linux_nat_debug_printf ("accessing fd %d for pid %d failed: %s (%d)",
- fd, pid, safe_strerror (errno), errno);
+ linux_nat_debug_printf ("accessing fd %d for pid %d failed: %s (%d)", fd,
+ pid, safe_strerror (errno), errno);
return TARGET_XFER_E_IO;
}
else if (ret == 0)
{
/* EOF means the address space is gone, the whole process exited
or execed. */
- linux_nat_debug_printf ("accessing fd %d for pid %d got EOF",
- fd, pid);
+ linux_nat_debug_printf ("accessing fd %d for pid %d got EOF", fd, pid);
return TARGET_XFER_EOF;
}
else
@@ -3975,21 +3922,25 @@ proc_mem_file_is_writable ()
/* We check whether /proc/pid/mem is writable by trying to write to
one of our variables via /proc/self/mem. */
- int fd = gdb_open_cloexec ("/proc/self/mem", O_RDWR | O_LARGEFILE, 0).release ();
+ int fd
+ = gdb_open_cloexec ("/proc/self/mem", O_RDWR | O_LARGEFILE, 0).release ();
if (fd == -1)
{
- warning (_("opening /proc/self/mem file failed: %s (%d)"),
+ warning (_ ("opening /proc/self/mem file failed: %s (%d)"),
safe_strerror (errno), errno);
return *writable;
}
- SCOPE_EXIT { close (fd); };
+ SCOPE_EXIT
+ {
+ close (fd);
+ };
/* This is the variable we try to write to. Note OFFSET below. */
volatile gdb_byte test_var = 0;
- gdb_byte writebuf[] = {0x55};
+ gdb_byte writebuf[] = { 0x55 };
ULONGEST offset = (uintptr_t) &test_var;
ULONGEST xfered_len;
@@ -4018,7 +3969,7 @@ add_line_to_sigset (const char *line, sigset_t *sigs)
int signum;
if (line[len] != '\n')
- error (_("Could not parse signal set: %s"), line);
+ error (_ ("Could not parse signal set: %s"), line);
p = line;
signum = len * 4;
@@ -4031,7 +3982,7 @@ add_line_to_sigset (const char *line, sigset_t *sigs)
else if (*p >= 'a' && *p <= 'f')
digit = *p - 'a' + 10;
else
- error (_("Could not parse signal set: %s"), line);
+ error (_ ("Could not parse signal set: %s"), line);
signum -= 4;
@@ -4052,8 +4003,8 @@ add_line_to_sigset (const char *line, sigset_t *sigs)
SIGS to match. */
void
-linux_proc_pending_signals (int pid, sigset_t *pending,
- sigset_t *blocked, sigset_t *ignored)
+linux_proc_pending_signals (int pid, sigset_t *pending, sigset_t *blocked,
+ sigset_t *ignored)
{
char buffer[PATH_MAX], fname[PATH_MAX];
@@ -4063,7 +4014,7 @@ linux_proc_pending_signals (int pid, sigset_t *pending,
xsnprintf (fname, sizeof fname, "/proc/%d/status", pid);
gdb_file_up procfile = gdb_fopen_cloexec (fname, "r");
if (procfile == NULL)
- error (_("Could not open %s"), fname);
+ error (_ ("Could not open %s"), fname);
while (fgets (buffer, PATH_MAX, procfile.get ()) != NULL)
{
@@ -4087,10 +4038,9 @@ linux_proc_pending_signals (int pid, sigset_t *pending,
}
static enum target_xfer_status
-linux_nat_xfer_osdata (enum target_object object,
- const char *annex, gdb_byte *readbuf,
- const gdb_byte *writebuf, ULONGEST offset, ULONGEST len,
- ULONGEST *xfered_len)
+linux_nat_xfer_osdata (enum target_object object, const char *annex,
+ gdb_byte *readbuf, const gdb_byte *writebuf,
+ ULONGEST offset, ULONGEST len, ULONGEST *xfered_len)
{
gdb_assert (object == TARGET_OBJECT_OSDATA);
@@ -4120,7 +4070,10 @@ linux_nat_target::static_tracepoint_markers_by_strid (const char *strid)
agent_run_command (pid, s, strlen (s) + 1);
/* Unpause all. */
- SCOPE_EXIT { target_continue_no_signal (ptid); };
+ SCOPE_EXIT
+ {
+ target_continue_no_signal (ptid);
+ };
while (*p++ == 'm')
{
@@ -4131,7 +4084,7 @@ linux_nat_target::static_tracepoint_markers_by_strid (const char *strid)
if (strid == NULL || marker.str_id == strid)
markers.push_back (std::move (marker));
}
- while (*p++ == ','); /* comma-separated list */
+ while (*p++ == ','); /* comma-separated list */
memcpy (s, "qTsSTM", sizeof ("qTsSTM"));
s[sizeof ("qTsSTM")] = 0;
@@ -4149,7 +4102,7 @@ linux_nat_target::can_async_p ()
{
/* This flag should be checked in the common target.c code. */
gdb_assert (target_async_permitted);
-
+
/* Otherwise, this targets is always able to support async mode. */
return true;
}
@@ -4252,7 +4205,6 @@ linux_nat_stop_lwp (struct lwp_info *lwp)
linux_nat_debug_printf ("running -> suspending %s",
lwp->ptid.to_string ().c_str ());
-
if (lwp->last_resume_kind == resume_stop)
{
linux_nat_debug_printf ("already stopping LWP %ld at GDB's request",
@@ -4379,8 +4331,8 @@ linux_nat_target::fileio_open (struct inferior *inf, const char *filename,
return -1;
}
- fd = linux_mntns_open_cloexec (linux_nat_fileio_pid_of (inf),
- filename, nat_flags, nat_mode);
+ fd = linux_mntns_open_cloexec (linux_nat_fileio_pid_of (inf), filename,
+ nat_flags, nat_mode);
if (fd == -1)
*target_errno = host_to_fileio_error (errno);
@@ -4396,8 +4348,8 @@ linux_nat_target::fileio_readlink (struct inferior *inf, const char *filename,
char buf[PATH_MAX];
int len;
- len = linux_mntns_readlink (linux_nat_fileio_pid_of (inf),
- filename, buf, sizeof (buf));
+ len = linux_mntns_readlink (linux_nat_fileio_pid_of (inf), filename, buf,
+ sizeof (buf));
if (len < 0)
{
*target_errno = host_to_fileio_error (errno);
@@ -4415,8 +4367,7 @@ linux_nat_target::fileio_unlink (struct inferior *inf, const char *filename,
{
int ret;
- ret = linux_mntns_unlink (linux_nat_fileio_pid_of (inf),
- filename);
+ ret = linux_mntns_unlink (linux_nat_fileio_pid_of (inf), filename);
if (ret == -1)
*target_errno = host_to_fileio_error (errno);
@@ -4459,26 +4410,28 @@ current_lwp_ptid (void)
}
void _initialize_linux_nat ();
+
void
_initialize_linux_nat ()
{
- add_setshow_boolean_cmd ("linux-nat", class_maintenance,
- &debug_linux_nat, _("\
-Set debugging of GNU/Linux native target."), _(" \
-Show debugging of GNU/Linux native target."), _(" \
+ add_setshow_boolean_cmd ("linux-nat", class_maintenance, &debug_linux_nat,
+ _ ("\
+Set debugging of GNU/Linux native target."),
+ _ (" \
+Show debugging of GNU/Linux native target."),
+ _ (" \
When on, print debug messages relating to the GNU/Linux native target."),
- nullptr,
- show_debug_linux_nat,
- &setdebuglist, &showdebuglist);
+ nullptr, show_debug_linux_nat, &setdebuglist,
+ &showdebuglist);
add_setshow_boolean_cmd ("linux-namespaces", class_maintenance,
- &debug_linux_namespaces, _("\
-Set debugging of GNU/Linux namespaces module."), _("\
-Show debugging of GNU/Linux namespaces module."), _("\
+ &debug_linux_namespaces, _ ("\
+Set debugging of GNU/Linux namespaces module."),
+ _ ("\
+Show debugging of GNU/Linux namespaces module."),
+ _ ("\
Enables printf debugging output."),
- NULL,
- NULL,
- &setdebuglist, &showdebuglist);
+ NULL, NULL, &setdebuglist, &showdebuglist);
/* Install a SIGCHLD handler. */
sigchld_action.sa_handler = sigchld_handler;
@@ -4496,7 +4449,6 @@ Enables printf debugging output."),
lwp_lwpid_htab_create ();
}
-
/* FIXME: kettenis/2000-08-26: The stuff on this page is specific to
the GNU/Linux Threads library and therefore doesn't really belong
diff --git a/gdb/linux-nat.h b/gdb/linux-nat.h
index 45534c92386..0a178512e92 100644
--- a/gdb/linux-nat.h
+++ b/gdb/linux-nat.h
@@ -31,14 +31,17 @@
class linux_nat_target : public inf_ptrace_target
{
public:
+
linux_nat_target ();
~linux_nat_target () override = 0;
thread_control_capabilities get_thread_control_capabilities () override
- { return tc_schedlock; }
+ {
+ return tc_schedlock;
+ }
- void create_inferior (const char *, const std::string &,
- char **, int) override;
+ void create_inferior (const char *, const std::string &, char **,
+ int) override;
void attach (const char *, int) override;
@@ -51,8 +54,7 @@ public:
void pass_signals (gdb::array_view<const unsigned char>) override;
enum target_xfer_status xfer_partial (enum target_object object,
- const char *annex,
- gdb_byte *readbuf,
+ const char *annex, gdb_byte *readbuf,
const gdb_byte *writebuf,
ULONGEST offset, ULONGEST len,
ULONGEST *xfered_len) override;
@@ -99,17 +101,15 @@ public:
bool filesystem_is_local () override;
- int fileio_open (struct inferior *inf, const char *filename,
- int flags, int mode, int warn_if_slow,
+ int fileio_open (struct inferior *inf, const char *filename, int flags,
+ int mode, int warn_if_slow,
fileio_error *target_errno) override;
gdb::optional<std::string>
- fileio_readlink (struct inferior *inf,
- const char *filename,
- fileio_error *target_errno) override;
+ fileio_readlink (struct inferior *inf, const char *filename,
+ fileio_error *target_errno) override;
- int fileio_unlink (struct inferior *inf,
- const char *filename,
+ int fileio_unlink (struct inferior *inf, const char *filename,
fileio_error *target_errno) override;
int insert_fork_catchpoint (int) override;
@@ -120,8 +120,9 @@ public:
int insert_exec_catchpoint (int) override;
int remove_exec_catchpoint (int) override;
- int set_syscall_catchpoint (int pid, bool needed, int any_count,
- gdb::array_view<const int> syscall_counts) override;
+ int
+ set_syscall_catchpoint (int pid, bool needed, int any_count,
+ gdb::array_view<const int> syscall_counts) override;
const char *pid_to_exec_file (int pid) override;
@@ -130,23 +131,22 @@ public:
void follow_fork (inferior *, ptid_t, target_waitkind, bool, bool) override;
std::vector<static_tracepoint_marker>
- static_tracepoint_markers_by_strid (const char *id) override;
+ static_tracepoint_markers_by_strid (const char *id) override;
/* Methods that are meant to overridden by the concrete
arch-specific target instance. */
virtual void low_resume (ptid_t ptid, int step, enum gdb_signal sig)
- { inf_ptrace_target::resume (ptid, step, sig); }
+ {
+ inf_ptrace_target::resume (ptid, step, sig);
+ }
- virtual bool low_stopped_by_watchpoint ()
- { return false; }
+ virtual bool low_stopped_by_watchpoint () { return false; }
- virtual bool low_stopped_data_address (CORE_ADDR *addr_p)
- { return false; }
+ virtual bool low_stopped_data_address (CORE_ADDR *addr_p) { return false; }
/* The method to call, if any, when a new thread is attached. */
- virtual void low_new_thread (struct lwp_info *)
- {}
+ virtual void low_new_thread (struct lwp_info *) {}
/* The method to call, if any, when a thread is destroyed. */
virtual void low_delete_thread (struct arch_lwp_info *lp)
@@ -155,21 +155,17 @@ public:
}
/* The method to call, if any, when a new fork is attached. */
- virtual void low_new_fork (struct lwp_info *parent, pid_t child_pid)
- {}
+ virtual void low_new_fork (struct lwp_info *parent, pid_t child_pid) {}
/* The method to call, if any, when a new clone event is detected. */
- virtual void low_new_clone (struct lwp_info *parent, pid_t child_lwp)
- {}
+ virtual void low_new_clone (struct lwp_info *parent, pid_t child_lwp) {}
/* The method to call, if any, when a process is no longer
attached. */
- virtual void low_forget_process (pid_t pid)
- {}
+ virtual void low_forget_process (pid_t pid) {}
/* Hook to call prior to resuming a thread. */
- virtual void low_prepare_to_resume (struct lwp_info *)
- {}
+ virtual void low_prepare_to_resume (struct lwp_info *) {}
/* Convert a ptrace/host siginfo object, into/from the siginfo in
the layout of the inferiors' architecture. Returns true if any
@@ -178,7 +174,9 @@ public:
PTRACE. If DIRECTION is 0, copy from PTRACE to INF. */
virtual bool low_siginfo_fixup (siginfo_t *ptrace, gdb_byte *inf,
int direction)
- { return false; }
+ {
+ return false;
+ }
/* SIGTRAP-like breakpoint status events recognizer. The default
recognizes SIGTRAP only. */
@@ -186,7 +184,7 @@ public:
protected:
- void post_startup_inferior (ptid_t) override;
+ void post_startup_inferior (ptid_t) override;
};
/* The final/concrete instance. */
@@ -200,7 +198,8 @@ struct lwp_info : intrusive_list_node<lwp_info>
{
lwp_info (ptid_t ptid)
: ptid (ptid)
- {}
+ {
+ }
~lwp_info ();
@@ -311,8 +310,8 @@ extern unsigned int lin_thread_get_thread_signal_num (void);
extern int lin_thread_get_thread_signal (unsigned int i);
/* Find process PID's pending signal set from /proc/pid/status. */
-void linux_proc_pending_signals (int pid, sigset_t *pending,
- sigset_t *blocked, sigset_t *ignored);
+void linux_proc_pending_signals (int pid, sigset_t *pending, sigset_t *blocked,
+ sigset_t *ignored);
/* For linux_stop_lwp see nat/linux-nat.h. */
diff --git a/gdb/linux-record.c b/gdb/linux-record.c
index 46ab21467b7..72bbccd6d1f 100644
--- a/gdb/linux-record.c
+++ b/gdb/linux-record.c
@@ -30,61 +30,61 @@
"sys_ptrace". The values of these macros were obtained from Linux
Kernel source. */
-#define RECORD_PTRACE_PEEKTEXT 1
-#define RECORD_PTRACE_PEEKDATA 2
-#define RECORD_PTRACE_PEEKUSR 3
+#define RECORD_PTRACE_PEEKTEXT 1
+#define RECORD_PTRACE_PEEKDATA 2
+#define RECORD_PTRACE_PEEKUSR 3
/* These macros are the values of the first argument of system call
"sys_socketcall". The values of these macros were obtained from
Linux Kernel source. */
-#define RECORD_SYS_SOCKET 1
-#define RECORD_SYS_BIND 2
-#define RECORD_SYS_CONNECT 3
-#define RECORD_SYS_LISTEN 4
-#define RECORD_SYS_ACCEPT 5
-#define RECORD_SYS_GETSOCKNAME 6
-#define RECORD_SYS_GETPEERNAME 7
-#define RECORD_SYS_SOCKETPAIR 8
-#define RECORD_SYS_SEND 9
-#define RECORD_SYS_RECV 10
-#define RECORD_SYS_SENDTO 11
-#define RECORD_SYS_RECVFROM 12
-#define RECORD_SYS_SHUTDOWN 13
-#define RECORD_SYS_SETSOCKOPT 14
-#define RECORD_SYS_GETSOCKOPT 15
-#define RECORD_SYS_SENDMSG 16
-#define RECORD_SYS_RECVMSG 17
+#define RECORD_SYS_SOCKET 1
+#define RECORD_SYS_BIND 2
+#define RECORD_SYS_CONNECT 3
+#define RECORD_SYS_LISTEN 4
+#define RECORD_SYS_ACCEPT 5
+#define RECORD_SYS_GETSOCKNAME 6
+#define RECORD_SYS_GETPEERNAME 7
+#define RECORD_SYS_SOCKETPAIR 8
+#define RECORD_SYS_SEND 9
+#define RECORD_SYS_RECV 10
+#define RECORD_SYS_SENDTO 11
+#define RECORD_SYS_RECVFROM 12
+#define RECORD_SYS_SHUTDOWN 13
+#define RECORD_SYS_SETSOCKOPT 14
+#define RECORD_SYS_GETSOCKOPT 15
+#define RECORD_SYS_SENDMSG 16
+#define RECORD_SYS_RECVMSG 17
/* These macros are the values of the first argument of system call
"sys_ipc". The values of these macros were obtained from Linux
Kernel source. */
-#define RECORD_SEMOP 1
-#define RECORD_SEMGET 2
-#define RECORD_SEMCTL 3
-#define RECORD_SEMTIMEDOP 4
-#define RECORD_MSGSND 11
-#define RECORD_MSGRCV 12
-#define RECORD_MSGGET 13
-#define RECORD_MSGCTL 14
-#define RECORD_SHMAT 21
-#define RECORD_SHMDT 22
-#define RECORD_SHMGET 23
-#define RECORD_SHMCTL 24
+#define RECORD_SEMOP 1
+#define RECORD_SEMGET 2
+#define RECORD_SEMCTL 3
+#define RECORD_SEMTIMEDOP 4
+#define RECORD_MSGSND 11
+#define RECORD_MSGRCV 12
+#define RECORD_MSGGET 13
+#define RECORD_MSGCTL 14
+#define RECORD_SHMAT 21
+#define RECORD_SHMDT 22
+#define RECORD_SHMGET 23
+#define RECORD_SHMCTL 24
/* These macros are the values of the first argument of system call
"sys_quotactl". The values of these macros were obtained from Linux
Kernel source. */
-#define RECORD_Q_GETFMT 0x800004
-#define RECORD_Q_GETINFO 0x800005
-#define RECORD_Q_GETQUOTA 0x800007
-#define RECORD_Q_XGETQSTAT (('5' << 8) + 5)
-#define RECORD_Q_XGETQUOTA (('3' << 8) + 3)
+#define RECORD_Q_GETFMT 0x800004
+#define RECORD_Q_GETINFO 0x800005
+#define RECORD_Q_GETQUOTA 0x800007
+#define RECORD_Q_XGETQSTAT (('5' << 8) + 5)
+#define RECORD_Q_XGETQUOTA (('3' << 8) + 3)
-#define OUTPUT_REG(val, num) phex_nz ((val), \
- gdbarch_register_type (regcache->arch (), (num))->length ())
+#define OUTPUT_REG(val, num) \
+ phex_nz ((val), gdbarch_register_type (regcache->arch (), (num))->length ())
/* Record a memory area of length LEN pointed to by register
REGNUM. */
@@ -123,8 +123,7 @@ record_linux_sockaddr (struct regcache *regcache,
gdb_printf (gdb_stdlog,
"Process record: error reading "
"memory at addr = 0x%s len = %d.\n",
- phex_nz (len, tdep->size_pointer),
- tdep->size_int);
+ phex_nz (len, tdep->size_pointer), tdep->size_int);
return -1;
}
addrlen = (int) extract_unsigned_integer (a, tdep->size_int, byte_order);
@@ -138,8 +137,8 @@ record_linux_sockaddr (struct regcache *regcache,
}
static int
-record_linux_msghdr (struct regcache *regcache,
- struct linux_record_tdep *tdep, ULONGEST addr)
+record_linux_msghdr (struct regcache *regcache, struct linux_record_tdep *tdep,
+ ULONGEST addr)
{
gdb_byte *a;
struct gdbarch *gdbarch = regcache->arch ();
@@ -161,19 +160,16 @@ record_linux_msghdr (struct regcache *regcache,
"Process record: error reading "
"memory at addr = 0x%s "
"len = %d.\n",
- phex_nz (addr, tdep->size_pointer),
- tdep->size_msghdr);
+ phex_nz (addr, tdep->size_pointer), tdep->size_msghdr);
return -1;
}
/* msg_name msg_namelen */
addr = extract_unsigned_integer (a, tdep->size_pointer, byte_order);
a += tdep->size_pointer;
- if (record_full_arch_list_add_mem
- ((CORE_ADDR) addr,
- (int) extract_unsigned_integer (a,
- tdep->size_int,
- byte_order)))
+ if (record_full_arch_list_add_mem (
+ (CORE_ADDR) addr,
+ (int) extract_unsigned_integer (a, tdep->size_int, byte_order)))
return -1;
/* We have read an int, but skip size_pointer bytes to account for alignment
of the next field on 64-bit targets. */
@@ -185,8 +181,8 @@ record_linux_msghdr (struct regcache *regcache,
if (addr)
{
ULONGEST i;
- ULONGEST len = extract_unsigned_integer (a, tdep->size_size_t,
- byte_order);
+ ULONGEST len
+ = extract_unsigned_integer (a, tdep->size_size_t, byte_order);
gdb_byte *iov = (gdb_byte *) alloca (tdep->size_iovec);
for (i = 0; i < len; i++)
@@ -199,16 +195,16 @@ record_linux_msghdr (struct regcache *regcache,
"reading memory at "
"addr = 0x%s "
"len = %d.\n",
- phex_nz (addr,tdep->size_pointer),
+ phex_nz (addr, tdep->size_pointer),
tdep->size_iovec);
return -1;
}
- tmpaddr = (CORE_ADDR) extract_unsigned_integer (iov,
- tdep->size_pointer,
- byte_order);
- tmpint = (int) extract_unsigned_integer (iov + tdep->size_pointer,
- tdep->size_size_t,
- byte_order);
+ tmpaddr
+ = (CORE_ADDR) extract_unsigned_integer (iov, tdep->size_pointer,
+ byte_order);
+ tmpint
+ = (int) extract_unsigned_integer (iov + tdep->size_pointer,
+ tdep->size_size_t, byte_order);
if (record_full_arch_list_add_mem (tmpaddr, tmpint))
return -1;
addr += tdep->size_iovec;
@@ -239,8 +235,7 @@ record_linux_msghdr (struct regcache *regcache,
Return -1 if something wrong. */
int
-record_linux_system_call (enum gdb_syscall syscall,
- struct regcache *regcache,
+record_linux_system_call (enum gdb_syscall syscall, struct regcache *regcache,
struct linux_record_tdep *tdep)
{
struct gdbarch *gdbarch = regcache->arch ();
@@ -255,9 +250,9 @@ record_linux_system_call (enum gdb_syscall syscall,
break;
case gdb_sys_exit:
- if (yquery (_("The next instruction is syscall exit. "
- "It will make the program exit. "
- "Do you want to stop the program?")))
+ if (yquery (_ ("The next instruction is syscall exit. "
+ "It will make the program exit. "
+ "Do you want to stop the program?")))
return 1;
break;
@@ -433,8 +428,7 @@ record_linux_system_call (enum gdb_syscall syscall,
|| tmpulongest == tdep->ioctl_TCGETA
|| tmpulongest == tdep->ioctl_TIOCGLCKTRMIOS)
{
- if (record_mem_at_reg (regcache, tdep->arg3,
- tdep->size_termios))
+ if (record_mem_at_reg (regcache, tdep->arg3, tdep->size_termios))
return -1;
}
else if (tmpulongest == tdep->ioctl_TIOCGPGRP
@@ -457,8 +451,7 @@ record_linux_system_call (enum gdb_syscall syscall,
}
else if (tmpulongest == tdep->ioctl_TIOCGWINSZ)
{
- if (record_mem_at_reg (regcache, tdep->arg3,
- tdep->size_winsize))
+ if (record_mem_at_reg (regcache, tdep->arg3, tdep->size_winsize))
return -1;
}
else if (tmpulongest == tdep->ioctl_TIOCLINUX)
@@ -475,8 +468,7 @@ record_linux_system_call (enum gdb_syscall syscall,
}
else if (tmpulongest == tdep->ioctl_TCGETS2)
{
- if (record_mem_at_reg (regcache, tdep->arg3,
- tdep->size_termios2))
+ if (record_mem_at_reg (regcache, tdep->arg3, tdep->size_termios2))
return -1;
}
else if (tmpulongest == tdep->ioctl_FIOQSIZE)
@@ -499,15 +491,15 @@ record_linux_system_call (enum gdb_syscall syscall,
else if (tmpulongest == tdep->ioctl_TIOCSERGSTRUCT)
{
gdb_printf (gdb_stderr,
- _("Process record and replay target doesn't "
- "support ioctl request TIOCSERGSTRUCT\n"));
+ _ ("Process record and replay target doesn't "
+ "support ioctl request TIOCSERGSTRUCT\n"));
return 1;
}
else
{
gdb_printf (gdb_stderr,
- _("Process record and replay target doesn't "
- "support ioctl request 0x%s.\n"),
+ _ ("Process record and replay target doesn't "
+ "support ioctl request 0x%s.\n"),
OUTPUT_REG (tmpulongest, tdep->arg2));
return 1;
}
@@ -530,8 +522,7 @@ record_linux_system_call (enum gdb_syscall syscall,
break;
case gdb_sys_olduname:
- if (record_mem_at_reg (regcache, tdep->arg1,
- tdep->size_oldold_utsname))
+ if (record_mem_at_reg (regcache, tdep->arg1, tdep->size_oldold_utsname))
return -1;
break;
@@ -551,8 +542,7 @@ record_linux_system_call (enum gdb_syscall syscall,
break;
case gdb_sys_sigaction:
- if (record_mem_at_reg (regcache, tdep->arg3,
- tdep->size_old_sigaction))
+ if (record_mem_at_reg (regcache, tdep->arg3, tdep->size_old_sigaction))
return -1;
break;
@@ -564,8 +554,7 @@ record_linux_system_call (enum gdb_syscall syscall,
break;
case gdb_sys_sigpending:
- if (record_mem_at_reg (regcache, tdep->arg1,
- tdep->size_old_sigset_t))
+ if (record_mem_at_reg (regcache, tdep->arg1, tdep->size_old_sigset_t))
return -1;
break;
@@ -598,8 +587,7 @@ record_linux_system_call (enum gdb_syscall syscall,
{
ULONGEST gidsetsize;
- regcache_raw_read_unsigned (regcache, tdep->arg1,
- &gidsetsize);
+ regcache_raw_read_unsigned (regcache, tdep->arg1, &gidsetsize);
tmpint = tdep->size_old_gid_t * (int) gidsetsize;
if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest, tmpint))
return -1;
@@ -615,8 +603,7 @@ record_linux_system_call (enum gdb_syscall syscall,
gdb_byte *a = (gdb_byte *) alloca (sz_sel_arg);
CORE_ADDR inp, outp, exp, tvp;
- regcache_raw_read_unsigned (regcache, tdep->arg1,
- &tmpulongest);
+ regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
if (tmpulongest)
{
if (target_read_memory (tmpulongest, a, sz_sel_arg))
@@ -633,7 +620,8 @@ record_linux_system_call (enum gdb_syscall syscall,
a += tdep->size_long;
inp = extract_unsigned_integer (a, tdep->size_pointer, byte_order);
a += tdep->size_pointer;
- outp = extract_unsigned_integer (a, tdep->size_pointer, byte_order);
+ outp
+ = extract_unsigned_integer (a, tdep->size_pointer, byte_order);
a += tdep->size_pointer;
exp = extract_unsigned_integer (a, tdep->size_pointer, byte_order);
a += tdep->size_pointer;
@@ -662,9 +650,9 @@ record_linux_system_call (enum gdb_syscall syscall,
break;
case gdb_sys_reboot:
- if (yquery (_("The next instruction is syscall reboot. "
- "It will restart the computer. "
- "Do you want to stop the program?")))
+ if (yquery (_ ("The next instruction is syscall reboot. "
+ "It will restart the computer. "
+ "Do you want to stop the program?")))
return 1;
break;
@@ -680,12 +668,11 @@ record_linux_system_call (enum gdb_syscall syscall,
{
ULONGEST len;
- regcache_raw_read_unsigned (regcache, tdep->arg1,
- &tmpulongest);
+ regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
regcache_raw_read_unsigned (regcache, tdep->arg2, &len);
if (record_full_memory_query)
{
- if (yquery (_("\
+ if (yquery (_ ("\
The next instruction is syscall munmap.\n\
It will free the memory addr = 0x%s len = %u.\n\
It will make record target cannot record some memory change.\n\
@@ -802,8 +789,7 @@ Do you want to stop the program?"),
case RECORD_SYS_GETSOCKNAME:
case RECORD_SYS_GETPEERNAME:
{
- regcache_raw_read_unsigned (regcache, tdep->arg2,
- &tmpulongest);
+ regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
if (tmpulongest)
{
gdb_byte *a = (gdb_byte *) alloca (tdep->size_ulong * 2);
@@ -821,9 +807,8 @@ Do you want to stop the program?"),
tdep->size_ulong * 2);
return -1;
}
- tmpulongest = extract_unsigned_integer (a,
- tdep->size_ulong,
- byte_order);
+ tmpulongest
+ = extract_unsigned_integer (a, tdep->size_ulong, byte_order);
len = extract_unsigned_integer (a + tdep->size_ulong,
tdep->size_ulong, byte_order);
if (record_linux_sockaddr (regcache, tdep, tmpulongest, len))
@@ -836,8 +821,7 @@ Do you want to stop the program?"),
{
gdb_byte *a = (gdb_byte *) alloca (tdep->size_ulong);
- regcache_raw_read_unsigned (regcache, tdep->arg2,
- &tmpulongest);
+ regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
if (tmpulongest)
{
tmpulongest += tdep->size_ulong * 3;
@@ -864,8 +848,7 @@ Do you want to stop the program?"),
case RECORD_SYS_SENDTO:
break;
case RECORD_SYS_RECVFROM:
- regcache_raw_read_unsigned (regcache, tdep->arg2,
- &tmpulongest);
+ regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
if (tmpulongest)
{
gdb_byte *a = (gdb_byte *) alloca (tdep->size_ulong * 2);
@@ -883,8 +866,8 @@ Do you want to stop the program?"),
tdep->size_ulong * 2);
return -1;
}
- tmpulongest = extract_unsigned_integer (a, tdep->size_ulong,
- byte_order);
+ tmpulongest
+ = extract_unsigned_integer (a, tdep->size_ulong, byte_order);
len = extract_unsigned_integer (a + tdep->size_ulong,
tdep->size_ulong, byte_order);
if (record_linux_sockaddr (regcache, tdep, tmpulongest, len))
@@ -892,8 +875,7 @@ Do you want to stop the program?"),
}
break;
case RECORD_SYS_RECV:
- regcache_raw_read_unsigned (regcache, tdep->arg2,
- &tmpulongest);
+ regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
if (tmpulongest)
{
gdb_byte *a = (gdb_byte *) alloca (tdep->size_ulong * 2);
@@ -910,8 +892,8 @@ Do you want to stop the program?"),
tdep->size_ulong);
return -1;
}
- tmpulongest = extract_unsigned_integer (a, tdep->size_ulong,
- byte_order);
+ tmpulongest
+ = extract_unsigned_integer (a, tdep->size_ulong, byte_order);
if (tmpulongest)
{
a += tdep->size_ulong;
@@ -931,8 +913,7 @@ Do you want to stop the program?"),
gdb_byte *a = (gdb_byte *) alloca (tdep->size_ulong * 2);
gdb_byte *av = (gdb_byte *) alloca (tdep->size_int);
- regcache_raw_read_unsigned (regcache, tdep->arg2,
- &tmpulongest);
+ regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
if (tmpulongest)
{
tmpulongest += tdep->size_ulong * 3;
@@ -947,9 +928,9 @@ Do you want to stop the program?"),
tdep->size_ulong * 2);
return -1;
}
- tmpulongest = extract_unsigned_integer (a + tdep->size_ulong,
- tdep->size_ulong,
- byte_order);
+ tmpulongest
+ = extract_unsigned_integer (a + tdep->size_ulong,
+ tdep->size_ulong, byte_order);
if (tmpulongest)
{
if (target_read_memory ((CORE_ADDR) tmpulongest, av,
@@ -960,8 +941,7 @@ Do you want to stop the program?"),
"Process record: error reading "
"memory at addr = 0x%s "
"len = %d.\n",
- phex_nz (tmpulongest,
- tdep->size_ulong),
+ phex_nz (tmpulongest, tdep->size_ulong),
tdep->size_int);
return -1;
}
@@ -969,9 +949,9 @@ Do you want to stop the program?"),
= (CORE_ADDR) extract_unsigned_integer (a,
tdep->size_ulong,
byte_order);
- tmpint = (int) extract_unsigned_integer (av,
- tdep->size_int,
- byte_order);
+ tmpint
+ = (int) extract_unsigned_integer (av, tdep->size_int,
+ byte_order);
if (record_full_arch_list_add_mem (tmpaddr, tmpint))
return -1;
a += tdep->size_ulong;
@@ -992,8 +972,7 @@ Do you want to stop the program?"),
{
gdb_byte *a = (gdb_byte *) alloca (tdep->size_ulong);
- regcache_raw_read_unsigned (regcache, tdep->arg2,
- &tmpulongest);
+ regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
if (tmpulongest)
{
tmpulongest += tdep->size_ulong;
@@ -1008,8 +987,8 @@ Do you want to stop the program?"),
tdep->size_ulong);
return -1;
}
- tmpulongest = extract_unsigned_integer (a, tdep->size_ulong,
- byte_order);
+ tmpulongest
+ = extract_unsigned_integer (a, tdep->size_ulong, byte_order);
if (record_linux_msghdr (regcache, tdep, tmpulongest))
return -1;
}
@@ -1017,8 +996,8 @@ Do you want to stop the program?"),
break;
default:
gdb_printf (gdb_stderr,
- _("Process record and replay target "
- "doesn't support socketcall call 0x%s\n"),
+ _ ("Process record and replay target "
+ "doesn't support socketcall call 0x%s\n"),
OUTPUT_REG (tmpulongest, tdep->arg1));
return -1;
break;
@@ -1059,8 +1038,7 @@ Do you want to stop the program?"),
break;
case gdb_sys_uname:
- if (record_mem_at_reg (regcache, tdep->arg1,
- tdep->size_old_utsname))
+ if (record_mem_at_reg (regcache, tdep->arg1, tdep->size_old_utsname))
return -1;
break;
@@ -1148,8 +1126,7 @@ Do you want to stop the program?"),
}
break;
case RECORD_MSGCTL:
- if (record_mem_at_reg (regcache, tdep->arg5,
- tdep->size_msqid_ds))
+ if (record_mem_at_reg (regcache, tdep->arg5, tdep->size_msqid_ds))
return -1;
break;
case RECORD_SHMAT:
@@ -1157,15 +1134,14 @@ Do you want to stop the program?"),
return -1;
break;
case RECORD_SHMCTL:
- if (record_mem_at_reg (regcache, tdep->arg5,
- tdep->size_shmid_ds))
+ if (record_mem_at_reg (regcache, tdep->arg5, tdep->size_shmid_ds))
return -1;
break;
default:
/* XXX RECORD_SEMCTL still not supported. */
gdb_printf (gdb_stderr,
- _("Process record and replay target doesn't "
- "support ipc number %s\n"),
+ _ ("Process record and replay target doesn't "
+ "support ipc number %s\n"),
pulongest (tmpulongest));
break;
}
@@ -1178,8 +1154,7 @@ Do you want to stop the program?"),
break;
case gdb_sys_newuname:
- if (record_mem_at_reg (regcache, tdep->arg1,
- tdep->size_new_utsname))
+ if (record_mem_at_reg (regcache, tdep->arg1, tdep->size_new_utsname))
return -1;
break;
@@ -1204,8 +1179,7 @@ Do you want to stop the program?"),
break;
case gdb_sys_sigprocmask:
- if (record_mem_at_reg (regcache, tdep->arg3,
- tdep->size_old_sigset_t))
+ if (record_mem_at_reg (regcache, tdep->arg3, tdep->size_old_sigset_t))
return -1;
break;
@@ -1225,13 +1199,11 @@ Do you want to stop the program?"),
return -1;
break;
case RECORD_Q_GETINFO:
- if (record_mem_at_reg (regcache, tdep->arg4,
- tdep->size_mem_dqinfo))
+ if (record_mem_at_reg (regcache, tdep->arg4, tdep->size_mem_dqinfo))
return -1;
break;
case RECORD_Q_GETQUOTA:
- if (record_mem_at_reg (regcache, tdep->arg4,
- tdep->size_if_dqblk))
+ if (record_mem_at_reg (regcache, tdep->arg4, tdep->size_if_dqblk))
return -1;
break;
case RECORD_Q_XGETQSTAT:
@@ -1362,10 +1334,8 @@ Do you want to stop the program?"),
case gdb_sys_getresuid16:
if (record_mem_at_reg (regcache, tdep->arg1, tdep->size_old_uid_t)
- || record_mem_at_reg (regcache, tdep->arg2,
- tdep->size_old_uid_t)
- || record_mem_at_reg (regcache, tdep->arg3,
- tdep->size_old_uid_t))
+ || record_mem_at_reg (regcache, tdep->arg2, tdep->size_old_uid_t)
+ || record_mem_at_reg (regcache, tdep->arg3, tdep->size_old_uid_t))
return -1;
break;
@@ -1406,10 +1376,8 @@ Do you want to stop the program?"),
case gdb_sys_getresgid16:
if (record_mem_at_reg (regcache, tdep->arg1, tdep->size_old_gid_t)
- || record_mem_at_reg (regcache, tdep->arg2,
- tdep->size_old_gid_t)
- || record_mem_at_reg (regcache, tdep->arg3,
- tdep->size_old_gid_t))
+ || record_mem_at_reg (regcache, tdep->arg2, tdep->size_old_gid_t)
+ || record_mem_at_reg (regcache, tdep->arg3, tdep->size_old_gid_t))
return -1;
break;
@@ -1448,7 +1416,7 @@ Do you want to stop the program?"),
{
ULONGEST sigsetsize;
- regcache_raw_read_unsigned (regcache, tdep->arg2,&sigsetsize);
+ regcache_raw_read_unsigned (regcache, tdep->arg2, &sigsetsize);
if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
(int) sigsetsize))
return -1;
@@ -1470,7 +1438,7 @@ Do you want to stop the program?"),
{
ULONGEST count;
- regcache_raw_read_unsigned (regcache, tdep->arg3,&count);
+ regcache_raw_read_unsigned (regcache, tdep->arg3, &count);
if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
(int) count))
return -1;
@@ -1495,8 +1463,7 @@ Do you want to stop the program?"),
break;
case gdb_sys_capget:
- if (record_mem_at_reg (regcache, tdep->arg2,
- tdep->size_cap_user_data_t))
+ if (record_mem_at_reg (regcache, tdep->arg2, tdep->size_cap_user_data_t))
return -1;
break;
@@ -1552,8 +1519,7 @@ Do you want to stop the program?"),
{
ULONGEST gidsetsize;
- regcache_raw_read_unsigned (regcache, tdep->arg1,
- &gidsetsize);
+ regcache_raw_read_unsigned (regcache, tdep->arg1, &gidsetsize);
tmpint = tdep->size_gid_t * (int) gidsetsize;
if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest, tmpint))
return -1;
@@ -1602,8 +1568,7 @@ Do you want to stop the program?"),
regcache_raw_read_unsigned (regcache, tdep->arg2, &tmpulongest);
if (tmpulongest == tdep->fcntl_F_GETLK64)
{
- if (record_mem_at_reg (regcache, tdep->arg3,
- tdep->size_flock64))
+ if (record_mem_at_reg (regcache, tdep->arg3, tdep->size_flock64))
return -1;
}
else if (tmpulongest != tdep->fcntl_F_SETLK64
@@ -1754,9 +1719,9 @@ Do you want to stop the program?"),
break;
case gdb_sys_exit_group:
- if (yquery (_("The next instruction is syscall exit_group. "
- "It will make the program exit. "
- "Do you want to stop the program?")))
+ if (yquery (_ ("The next instruction is syscall exit_group. "
+ "It will make the program exit. "
+ "Do you want to stop the program?")))
return 1;
break;
@@ -1784,9 +1749,8 @@ Do you want to stop the program?"),
ULONGEST maxevents;
regcache_raw_read_unsigned (regcache, tdep->arg3, &maxevents);
- if (record_full_arch_list_add_mem ((CORE_ADDR) tmpulongest,
- (maxevents
- * tdep->size_epoll_event)))
+ if (record_full_arch_list_add_mem (
+ (CORE_ADDR) tmpulongest, (maxevents * tdep->size_epoll_event)))
return -1;
}
break;
@@ -1905,8 +1869,7 @@ Do you want to stop the program?"),
regcache_raw_read_unsigned (regcache, tdep->arg1, &tmpulongest);
if (tmpulongest == 6 || tmpulongest == 11)
{
- regcache_raw_read_unsigned (regcache, tdep->arg3,
- &tmpulongest);
+ regcache_raw_read_unsigned (regcache, tdep->arg3, &tmpulongest);
if (tmpulongest)
{
ULONGEST buflen;
@@ -2020,8 +1983,7 @@ Do you want to stop the program?"),
case gdb_sys_getcpu:
if (record_mem_at_reg (regcache, tdep->arg1, tdep->size_int)
|| record_mem_at_reg (regcache, tdep->arg2, tdep->size_int)
- || record_mem_at_reg (regcache, tdep->arg3,
- tdep->size_ulong * 2))
+ || record_mem_at_reg (regcache, tdep->arg3, tdep->size_ulong * 2))
return -1;
break;
@@ -2049,8 +2011,9 @@ Do you want to stop the program?"),
default:
gdb_printf (gdb_stderr,
- _("Process record and replay target doesn't "
- "support syscall number %d\n"), syscall);
+ _ ("Process record and replay target doesn't "
+ "support syscall number %d\n"),
+ syscall);
return -1;
break;
}
diff --git a/gdb/linux-record.h b/gdb/linux-record.h
index cb2fe1bc727..b18e6301f73 100644
--- a/gdb/linux-record.h
+++ b/gdb/linux-record.h
@@ -180,7 +180,8 @@ struct linux_record_tdep
Different architectures will have different sets of syscall ids, and
each must provide a mapping from their set to this one. */
-enum gdb_syscall {
+enum gdb_syscall
+{
/* An unknown GDB syscall, not a real syscall. */
gdb_sys_no_syscall = -1,
@@ -545,7 +546,7 @@ enum gdb_syscall {
/* Record a linux syscall. */
-extern int record_linux_system_call (enum gdb_syscall num,
+extern int record_linux_system_call (enum gdb_syscall num,
struct regcache *regcache,
struct linux_record_tdep *tdep);
diff --git a/gdb/linux-tdep.c b/gdb/linux-tdep.c
index e6ce13a1c67..0e7e772a458 100644
--- a/gdb/linux-tdep.c
+++ b/gdb/linux-tdep.c
@@ -27,7 +27,7 @@
#include "regcache.h"
#include "regset.h"
#include "elf/common.h"
-#include "elf-bfd.h" /* for elfcore_write_* */
+#include "elf-bfd.h" /* for elfcore_write_* */
#include "inferior.h"
#include "cli/cli-utils.h"
#include "arch-utils.h"
@@ -54,48 +54,49 @@
tree. */
enum filter_flag
- {
- COREFILTER_ANON_PRIVATE = 1 << 0,
- COREFILTER_ANON_SHARED = 1 << 1,
- COREFILTER_MAPPED_PRIVATE = 1 << 2,
- COREFILTER_MAPPED_SHARED = 1 << 3,
- COREFILTER_ELF_HEADERS = 1 << 4,
- COREFILTER_HUGETLB_PRIVATE = 1 << 5,
- COREFILTER_HUGETLB_SHARED = 1 << 6,
- };
+{
+ COREFILTER_ANON_PRIVATE = 1 << 0,
+ COREFILTER_ANON_SHARED = 1 << 1,
+ COREFILTER_MAPPED_PRIVATE = 1 << 2,
+ COREFILTER_MAPPED_SHARED = 1 << 3,
+ COREFILTER_ELF_HEADERS = 1 << 4,
+ COREFILTER_HUGETLB_PRIVATE = 1 << 5,
+ COREFILTER_HUGETLB_SHARED = 1 << 6,
+};
+
DEF_ENUM_FLAGS_TYPE (enum filter_flag, filter_flags);
/* This struct is used to map flags found in the "VmFlags:" field (in
the /proc/<PID>/smaps file). */
struct smaps_vmflags
- {
- /* Zero if this structure has not been initialized yet. It
+{
+ /* Zero if this structure has not been initialized yet. It
probably means that the Linux kernel being used does not emit
the "VmFlags:" field on "/proc/PID/smaps". */
- unsigned int initialized_p : 1;
+ unsigned int initialized_p : 1;
- /* Memory mapped I/O area (VM_IO, "io"). */
+ /* Memory mapped I/O area (VM_IO, "io"). */
- unsigned int io_page : 1;
+ unsigned int io_page : 1;
- /* Area uses huge TLB pages (VM_HUGETLB, "ht"). */
+ /* Area uses huge TLB pages (VM_HUGETLB, "ht"). */
- unsigned int uses_huge_tlb : 1;
+ unsigned int uses_huge_tlb : 1;
- /* Do not include this memory region on the coredump (VM_DONTDUMP, "dd"). */
+ /* Do not include this memory region on the coredump (VM_DONTDUMP, "dd"). */
- unsigned int exclude_coredump : 1;
+ unsigned int exclude_coredump : 1;
- /* Is this a MAP_SHARED mapping (VM_SHARED, "sh"). */
+ /* Is this a MAP_SHARED mapping (VM_SHARED, "sh"). */
- unsigned int shared_mapping : 1;
+ unsigned int shared_mapping : 1;
- /* Memory map has memory tagging enabled. */
+ /* Memory map has memory tagging enabled. */
- unsigned int memory_tagging : 1;
- };
+ unsigned int memory_tagging : 1;
+};
/* Data structure that holds the information contained in the
/proc/<pid>/smaps file. */
@@ -153,45 +154,45 @@ static bool dump_excluded_mappings = false;
tree. */
enum
- {
- LINUX_SIGHUP = 1,
- LINUX_SIGINT = 2,
- LINUX_SIGQUIT = 3,
- LINUX_SIGILL = 4,
- LINUX_SIGTRAP = 5,
- LINUX_SIGABRT = 6,
- LINUX_SIGIOT = 6,
- LINUX_SIGBUS = 7,
- LINUX_SIGFPE = 8,
- LINUX_SIGKILL = 9,
- LINUX_SIGUSR1 = 10,
- LINUX_SIGSEGV = 11,
- LINUX_SIGUSR2 = 12,
- LINUX_SIGPIPE = 13,
- LINUX_SIGALRM = 14,
- LINUX_SIGTERM = 15,
- LINUX_SIGSTKFLT = 16,
- LINUX_SIGCHLD = 17,
- LINUX_SIGCONT = 18,
- LINUX_SIGSTOP = 19,
- LINUX_SIGTSTP = 20,
- LINUX_SIGTTIN = 21,
- LINUX_SIGTTOU = 22,
- LINUX_SIGURG = 23,
- LINUX_SIGXCPU = 24,
- LINUX_SIGXFSZ = 25,
- LINUX_SIGVTALRM = 26,
- LINUX_SIGPROF = 27,
- LINUX_SIGWINCH = 28,
- LINUX_SIGIO = 29,
- LINUX_SIGPOLL = LINUX_SIGIO,
- LINUX_SIGPWR = 30,
- LINUX_SIGSYS = 31,
- LINUX_SIGUNUSED = 31,
-
- LINUX_SIGRTMIN = 32,
- LINUX_SIGRTMAX = 64,
- };
+{
+ LINUX_SIGHUP = 1,
+ LINUX_SIGINT = 2,
+ LINUX_SIGQUIT = 3,
+ LINUX_SIGILL = 4,
+ LINUX_SIGTRAP = 5,
+ LINUX_SIGABRT = 6,
+ LINUX_SIGIOT = 6,
+ LINUX_SIGBUS = 7,
+ LINUX_SIGFPE = 8,
+ LINUX_SIGKILL = 9,
+ LINUX_SIGUSR1 = 10,
+ LINUX_SIGSEGV = 11,
+ LINUX_SIGUSR2 = 12,
+ LINUX_SIGPIPE = 13,
+ LINUX_SIGALRM = 14,
+ LINUX_SIGTERM = 15,
+ LINUX_SIGSTKFLT = 16,
+ LINUX_SIGCHLD = 17,
+ LINUX_SIGCONT = 18,
+ LINUX_SIGSTOP = 19,
+ LINUX_SIGTSTP = 20,
+ LINUX_SIGTTIN = 21,
+ LINUX_SIGTTOU = 22,
+ LINUX_SIGURG = 23,
+ LINUX_SIGXCPU = 24,
+ LINUX_SIGXFSZ = 25,
+ LINUX_SIGVTALRM = 26,
+ LINUX_SIGPROF = 27,
+ LINUX_SIGWINCH = 28,
+ LINUX_SIGIO = 29,
+ LINUX_SIGPOLL = LINUX_SIGIO,
+ LINUX_SIGPWR = 30,
+ LINUX_SIGSYS = 31,
+ LINUX_SIGUNUSED = 31,
+
+ LINUX_SIGRTMIN = 32,
+ LINUX_SIGRTMAX = 64,
+};
struct linux_gdbarch_data
{
@@ -200,7 +201,7 @@ struct linux_gdbarch_data
};
static const registry<gdbarch>::key<linux_gdbarch_data>
- linux_gdbarch_data_handle;
+ linux_gdbarch_data_handle;
static struct linux_gdbarch_data *
get_linux_gdbarch_data (struct gdbarch *gdbarch)
@@ -221,7 +222,9 @@ struct linux_info
at this info requires an auxv lookup (which is itself cached),
and looking through the inferior's mappings (which change
throughout execution and therefore cannot be cached). */
- struct mem_range vsyscall_range {};
+ struct mem_range vsyscall_range
+ {
+ };
/* Zero if we haven't tried looking up the vsyscall's range before
yet. Positive if we tried looking it up, and found it. Negative
@@ -275,14 +278,13 @@ linux_get_siginfo_type_with_fields (struct gdbarch *gdbarch,
if (linux_gdbarch_data->siginfo_type != NULL)
return linux_gdbarch_data->siginfo_type;
- int_type = arch_integer_type (gdbarch, gdbarch_int_bit (gdbarch),
- 0, "int");
- uint_type = arch_integer_type (gdbarch, gdbarch_int_bit (gdbarch),
- 1, "unsigned int");
- long_type = arch_integer_type (gdbarch, gdbarch_long_bit (gdbarch),
- 0, "long");
- short_type = arch_integer_type (gdbarch, gdbarch_long_bit (gdbarch),
- 0, "short");
+ int_type = arch_integer_type (gdbarch, gdbarch_int_bit (gdbarch), 0, "int");
+ uint_type = arch_integer_type (gdbarch, gdbarch_int_bit (gdbarch), 1,
+ "unsigned int");
+ long_type
+ = arch_integer_type (gdbarch, gdbarch_long_bit (gdbarch), 0, "long");
+ short_type
+ = arch_integer_type (gdbarch, gdbarch_long_bit (gdbarch), 0, "short");
void_ptr_type = lookup_pointer_type (builtin_type (gdbarch)->builtin_void);
/* sival_t */
@@ -305,8 +307,7 @@ linux_get_siginfo_type_with_fields (struct gdbarch *gdbarch,
/* __clock_t */
clock_type = arch_type (gdbarch, TYPE_CODE_TYPEDEF,
- long_type->length () * TARGET_CHAR_BIT,
- "__clock_t");
+ long_type->length () * TARGET_CHAR_BIT, "__clock_t");
clock_type->set_target_type (long_type);
clock_type->set_target_is_stub (true);
@@ -366,9 +367,12 @@ linux_get_siginfo_type_with_fields (struct gdbarch *gdbarch,
struct type *sigfault_bnd_fields;
append_composite_type_field (type, "_addr_lsb", short_type);
- sigfault_bnd_fields = arch_composite_type (gdbarch, NULL, TYPE_CODE_STRUCT);
- append_composite_type_field (sigfault_bnd_fields, "_lower", void_ptr_type);
- append_composite_type_field (sigfault_bnd_fields, "_upper", void_ptr_type);
+ sigfault_bnd_fields
+ = arch_composite_type (gdbarch, NULL, TYPE_CODE_STRUCT);
+ append_composite_type_field (sigfault_bnd_fields, "_lower",
+ void_ptr_type);
+ append_composite_type_field (sigfault_bnd_fields, "_upper",
+ void_ptr_type);
append_composite_type_field (type, "_addr_bnd", sigfault_bnd_fields);
}
append_composite_type_field (sifields_type, "_sigfault", type);
@@ -392,9 +396,8 @@ linux_get_siginfo_type_with_fields (struct gdbarch *gdbarch,
append_composite_type_field (siginfo_type, "si_signo", int_type);
append_composite_type_field (siginfo_type, "si_errno", int_type);
append_composite_type_field (siginfo_type, "si_code", int_type);
- append_composite_type_field_aligned (siginfo_type,
- "_sifields", sifields_type,
- long_type->length ());
+ append_composite_type_field_aligned (siginfo_type, "_sifields",
+ sifields_type, long_type->length ());
linux_gdbarch_data->siginfo_type = siginfo_type;
@@ -472,7 +475,8 @@ read_mapping (const char *line)
const char *permissions_start = p;
while (*p && !isspace (*p))
p++;
- mapping.permissions = {permissions_start, (size_t) (p - permissions_start)};
+ mapping.permissions
+ = { permissions_start, (size_t) (p - permissions_start) };
mapping.offset = strtoulst (p, &p, 16);
@@ -480,7 +484,7 @@ read_mapping (const char *line)
const char *device_start = p;
while (*p && !isspace (*p))
p++;
- mapping.device = {device_start, (size_t) (p - device_start)};
+ mapping.device = { device_start, (size_t) (p - device_start) };
mapping.inode = strtoulst (p, &p, 10);
@@ -509,8 +513,7 @@ decode_vmflags (char *p, struct smaps_vmflags *v)
p = skip_to_space (p);
p = skip_spaces (p);
- for (s = strtok_r (p, " ", &saveptr);
- s != NULL;
+ for (s = strtok_r (p, " ", &saveptr); s != NULL;
s = strtok_r (NULL, " ", &saveptr))
{
if (strcmp (s, "io") == 0)
@@ -535,17 +538,19 @@ struct mapping_regexes
string in the end). We know for sure, based on the Linux kernel
code, that memory mappings whose associated filename is
"/dev/zero" are guaranteed to be MAP_ANONYMOUS. */
- compiled_regex dev_zero
- {"^/dev/zero\\( (deleted)\\)\\?$", REG_NOSUB,
- _("Could not compile regex to match /dev/zero filename")};
+ compiled_regex dev_zero {
+ "^/dev/zero\\( (deleted)\\)\\?$", REG_NOSUB,
+ _ ("Could not compile regex to match /dev/zero filename")
+ };
/* Matches "/SYSV%08x" filenames (with or without the "(deleted)"
string in the end). These filenames refer to shared memory
(shmem), and memory mappings associated with them are
MAP_ANONYMOUS as well. */
- compiled_regex shmem_file
- {"^/\\?SYSV[0-9a-fA-F]\\{8\\}\\( (deleted)\\)\\?$", REG_NOSUB,
- _("Could not compile regex to match shmem filenames")};
+ compiled_regex shmem_file {
+ "^/\\?SYSV[0-9a-fA-F]\\{8\\}\\( (deleted)\\)\\?$", REG_NOSUB,
+ _ ("Could not compile regex to match shmem filenames")
+ };
/* A heuristic we use to try to mimic the Linux kernel's 'n_link ==
0' code, which is responsible to decide if it is dealing with a
@@ -559,9 +564,10 @@ struct mapping_regexes
when using the default value of coredump_filter (0x33), while the
Linux kernel will not dump those pages. But we can live with
that. */
- compiled_regex file_deleted
- {" (deleted)$", REG_NOSUB,
- _("Could not compile regex to match '<file> (deleted)'")};
+ compiled_regex file_deleted {
+ " (deleted)$", REG_NOSUB,
+ _ ("Could not compile regex to match '<file> (deleted)'")
+ };
};
/* Return 1 if the memory mapping is anonymous, 0 otherwise.
@@ -607,8 +613,7 @@ mapping_is_anonymous_p (const char *filename)
&& strcmp (filename + filename_len - del_len, deleted) == 0);
}
- if (*filename == '\0'
- || regexes->dev_zero.exec (filename, 0, NULL, 0) == 0
+ if (*filename == '\0' || regexes->dev_zero.exec (filename, 0, NULL, 0) == 0
|| regexes->shmem_file.exec (filename, 0, NULL, 0) == 0
|| regexes->file_deleted.exec (filename, 0, NULL, 0) == 0)
return 1;
@@ -681,8 +686,7 @@ dump_mapping_p (filter_flags filterflags, const struct smaps_vmflags *v,
/* We always dump vDSO and vsyscall mappings, because it's likely that
there'll be no file to read the contents from at core load time.
The kernel does the same. */
- if (strcmp ("[vdso]", filename) == 0
- || strcmp ("[vsyscall]", filename) == 0)
+ if (strcmp ("[vdso]", filename) == 0 || strcmp ("[vsyscall]", filename) == 0)
return 1;
if (v->initialized_p)
@@ -782,13 +786,12 @@ dump_mapping_p (filter_flags filterflags, const struct smaps_vmflags *v,
static int
dump_note_entry_p (filter_flags filterflags, const struct smaps_vmflags *v,
- int maybe_private_p, int mapping_anon_p, int mapping_file_p,
- const char *filename, ULONGEST addr, ULONGEST offset)
+ int maybe_private_p, int mapping_anon_p, int mapping_file_p,
+ const char *filename, ULONGEST addr, ULONGEST offset)
{
/* vDSO and vsyscall mappings will end up in the core file. Don't
put them in the NT_FILE note. */
- if (strcmp ("[vdso]", filename) == 0
- || strcmp ("[vsyscall]", filename) == 0)
+ if (strcmp ("[vdso]", filename) == 0 || strcmp ("[vsyscall]", filename) == 0)
return 0;
/* Otherwise, any other file-based mapping should be placed in the
@@ -824,18 +827,19 @@ linux_info_proc (struct gdbarch *gdbarch, const char *args,
else
{
if (!target_has_execution ())
- error (_("No current process: you must name one."));
+ error (_ ("No current process: you must name one."));
if (current_inferior ()->fake_pid_p)
- error (_("Can't determine the current process's PID: you must name one."));
+ error (
+ _ ("Can't determine the current process's PID: you must name one."));
pid = current_inferior ()->pid;
}
args = skip_spaces (args);
if (args && args[0])
- error (_("Too many parameters: %s"), args);
+ error (_ ("Too many parameters: %s"), args);
- gdb_printf (_("process %ld\n"), pid);
+ gdb_printf (_ ("process %ld\n"), pid);
if (cmdline_f)
{
xsnprintf (filename, sizeof filename, "/proc/%ld/cmdline", pid);
@@ -856,7 +860,7 @@ linux_info_proc (struct gdbarch *gdbarch, const char *args,
gdb_printf ("cmdline = '%s'\n", buffer);
}
else
- warning (_("unable to open /proc file '%s'"), filename);
+ warning (_ ("unable to open /proc file '%s'"), filename);
}
if (cwd_f)
{
@@ -866,7 +870,7 @@ linux_info_proc (struct gdbarch *gdbarch, const char *args,
if (contents.has_value ())
gdb_printf ("cwd = '%s'\n", contents->c_str ());
else
- warning (_("unable to read link '%s'"), filename);
+ warning (_ ("unable to read link '%s'"), filename);
}
if (exe_f)
{
@@ -876,7 +880,7 @@ linux_info_proc (struct gdbarch *gdbarch, const char *args,
if (contents.has_value ())
gdb_printf ("exe = '%s'\n", contents->c_str ());
else
- warning (_("unable to read link '%s'"), filename);
+ warning (_ ("unable to read link '%s'"), filename);
}
if (mappings_f)
{
@@ -887,23 +891,22 @@ linux_info_proc (struct gdbarch *gdbarch, const char *args,
{
char *line;
- gdb_printf (_("Mapped address spaces:\n\n"));
+ gdb_printf (_ ("Mapped address spaces:\n\n"));
if (gdbarch_addr_bit (gdbarch) == 32)
{
- gdb_printf ("\t%10s %10s %10s %10s %s %s\n",
- "Start Addr", " End Addr", " Size",
- " Offset", "Perms ", "objfile");
+ gdb_printf ("\t%10s %10s %10s %10s %s %s\n", "Start Addr",
+ " End Addr", " Size", " Offset", "Perms ",
+ "objfile");
}
else
{
- gdb_printf (" %18s %18s %10s %10s %s %s\n",
- "Start Addr", " End Addr", " Size",
- " Offset", "Perms ", "objfile");
+ gdb_printf (" %18s %18s %10s %10s %s %s\n", "Start Addr",
+ " End Addr", " Size", " Offset", "Perms ",
+ "objfile");
}
char *saveptr;
- for (line = strtok_r (map.get (), "\n", &saveptr);
- line;
+ for (line = strtok_r (map.get (), "\n", &saveptr); line;
line = strtok_r (NULL, "\n", &saveptr))
{
struct mapping m = read_mapping (line);
@@ -916,8 +919,7 @@ linux_info_proc (struct gdbarch *gdbarch, const char *args,
hex_string (m.endaddr - m.addr),
hex_string (m.offset),
(int) m.permissions.size (),
- m.permissions.data (),
- m.filename);
+ m.permissions.data (), m.filename);
}
else
{
@@ -927,13 +929,12 @@ linux_info_proc (struct gdbarch *gdbarch, const char *args,
hex_string (m.endaddr - m.addr),
hex_string (m.offset),
(int) m.permissions.size (),
- m.permissions.data (),
- m.filename);
+ m.permissions.data (), m.filename);
}
}
}
else
- warning (_("unable to open /proc file '%s'"), filename);
+ warning (_ ("unable to open /proc file '%s'"), filename);
}
if (status_f)
{
@@ -943,7 +944,7 @@ linux_info_proc (struct gdbarch *gdbarch, const char *args,
if (status)
gdb_puts (status.get ());
else
- warning (_("unable to open /proc file '%s'"), filename);
+ warning (_ ("unable to open /proc file '%s'"), filename);
}
if (stat_f)
{
@@ -954,8 +955,7 @@ linux_info_proc (struct gdbarch *gdbarch, const char *args,
{
const char *p = statstr.get ();
- gdb_printf (_("Process: %s\n"),
- pulongest (strtoulst (p, &p, 10)));
+ gdb_printf (_ ("Process: %s\n"), pulongest (strtoulst (p, &p, 10)));
p = skip_spaces (p);
if (*p == '(')
@@ -965,95 +965,89 @@ linux_info_proc (struct gdbarch *gdbarch, const char *args,
const char *ep = strrchr (p, ')');
if (ep != NULL)
{
- gdb_printf ("Exec file: %.*s\n",
- (int) (ep - p - 1), p + 1);
+ gdb_printf ("Exec file: %.*s\n", (int) (ep - p - 1), p + 1);
p = ep + 1;
}
}
p = skip_spaces (p);
if (*p)
- gdb_printf (_("State: %c\n"), *p++);
+ gdb_printf (_ ("State: %c\n"), *p++);
if (*p)
- gdb_printf (_("Parent process: %s\n"),
+ gdb_printf (_ ("Parent process: %s\n"),
pulongest (strtoulst (p, &p, 10)));
if (*p)
- gdb_printf (_("Process group: %s\n"),
+ gdb_printf (_ ("Process group: %s\n"),
pulongest (strtoulst (p, &p, 10)));
if (*p)
- gdb_printf (_("Session id: %s\n"),
+ gdb_printf (_ ("Session id: %s\n"),
pulongest (strtoulst (p, &p, 10)));
if (*p)
- gdb_printf (_("TTY: %s\n"),
- pulongest (strtoulst (p, &p, 10)));
+ gdb_printf (_ ("TTY: %s\n"), pulongest (strtoulst (p, &p, 10)));
if (*p)
- gdb_printf (_("TTY owner process group: %s\n"),
+ gdb_printf (_ ("TTY owner process group: %s\n"),
pulongest (strtoulst (p, &p, 10)));
if (*p)
- gdb_printf (_("Flags: %s\n"),
- hex_string (strtoulst (p, &p, 10)));
+ gdb_printf (_ ("Flags: %s\n"), hex_string (strtoulst (p, &p, 10)));
if (*p)
- gdb_printf (_("Minor faults (no memory page): %s\n"),
+ gdb_printf (_ ("Minor faults (no memory page): %s\n"),
pulongest (strtoulst (p, &p, 10)));
if (*p)
- gdb_printf (_("Minor faults, children: %s\n"),
+ gdb_printf (_ ("Minor faults, children: %s\n"),
pulongest (strtoulst (p, &p, 10)));
if (*p)
- gdb_printf (_("Major faults (memory page faults): %s\n"),
+ gdb_printf (_ ("Major faults (memory page faults): %s\n"),
pulongest (strtoulst (p, &p, 10)));
if (*p)
- gdb_printf (_("Major faults, children: %s\n"),
+ gdb_printf (_ ("Major faults, children: %s\n"),
pulongest (strtoulst (p, &p, 10)));
if (*p)
- gdb_printf (_("utime: %s\n"),
- pulongest (strtoulst (p, &p, 10)));
+ gdb_printf (_ ("utime: %s\n"), pulongest (strtoulst (p, &p, 10)));
if (*p)
- gdb_printf (_("stime: %s\n"),
- pulongest (strtoulst (p, &p, 10)));
+ gdb_printf (_ ("stime: %s\n"), pulongest (strtoulst (p, &p, 10)));
if (*p)
- gdb_printf (_("utime, children: %s\n"),
+ gdb_printf (_ ("utime, children: %s\n"),
pulongest (strtoulst (p, &p, 10)));
if (*p)
- gdb_printf (_("stime, children: %s\n"),
+ gdb_printf (_ ("stime, children: %s\n"),
pulongest (strtoulst (p, &p, 10)));
if (*p)
- gdb_printf (_("jiffies remaining in current "
- "time slice: %s\n"),
+ gdb_printf (_ ("jiffies remaining in current "
+ "time slice: %s\n"),
pulongest (strtoulst (p, &p, 10)));
if (*p)
- gdb_printf (_("'nice' value: %s\n"),
+ gdb_printf (_ ("'nice' value: %s\n"),
pulongest (strtoulst (p, &p, 10)));
if (*p)
- gdb_printf (_("jiffies until next timeout: %s\n"),
+ gdb_printf (_ ("jiffies until next timeout: %s\n"),
pulongest (strtoulst (p, &p, 10)));
if (*p)
- gdb_printf (_("jiffies until next SIGALRM: %s\n"),
+ gdb_printf (_ ("jiffies until next SIGALRM: %s\n"),
pulongest (strtoulst (p, &p, 10)));
if (*p)
- gdb_printf (_("start time (jiffies since "
- "system boot): %s\n"),
+ gdb_printf (_ ("start time (jiffies since "
+ "system boot): %s\n"),
pulongest (strtoulst (p, &p, 10)));
if (*p)
- gdb_printf (_("Virtual memory size: %s\n"),
+ gdb_printf (_ ("Virtual memory size: %s\n"),
pulongest (strtoulst (p, &p, 10)));
if (*p)
- gdb_printf (_("Resident set size: %s\n"),
+ gdb_printf (_ ("Resident set size: %s\n"),
pulongest (strtoulst (p, &p, 10)));
if (*p)
- gdb_printf (_("rlim: %s\n"),
- pulongest (strtoulst (p, &p, 10)));
+ gdb_printf (_ ("rlim: %s\n"), pulongest (strtoulst (p, &p, 10)));
if (*p)
- gdb_printf (_("Start of text: %s\n"),
+ gdb_printf (_ ("Start of text: %s\n"),
hex_string (strtoulst (p, &p, 10)));
if (*p)
- gdb_printf (_("End of text: %s\n"),
+ gdb_printf (_ ("End of text: %s\n"),
hex_string (strtoulst (p, &p, 10)));
if (*p)
- gdb_printf (_("Start of stack: %s\n"),
+ gdb_printf (_ ("Start of stack: %s\n"),
hex_string (strtoulst (p, &p, 10)));
-#if 0 /* Don't know how architecture-dependent the rest is...
+#if 0 /* Don't know how architecture-dependent the rest is...
Anyway the signal bitmap info is available from "status". */
if (*p)
gdb_printf (_("Kernel stack pointer: %s\n"),
@@ -1079,7 +1073,7 @@ linux_info_proc (struct gdbarch *gdbarch, const char *args,
#endif
}
else
- warning (_("unable to open /proc file '%s'"), filename);
+ warning (_ ("unable to open /proc file '%s'"), filename);
}
}
@@ -1110,11 +1104,10 @@ linux_info_proc (struct gdbarch *gdbarch, const char *args,
for each mapping. */
static void
-linux_read_core_file_mappings
- (struct gdbarch *gdbarch,
- struct bfd *cbfd,
- read_core_file_mappings_pre_loop_ftype pre_loop_cb,
- read_core_file_mappings_loop_ftype loop_cb)
+linux_read_core_file_mappings (
+ struct gdbarch *gdbarch, struct bfd *cbfd,
+ read_core_file_mappings_pre_loop_ftype pre_loop_cb,
+ read_core_file_mappings_loop_ftype loop_cb)
{
/* Ensure that ULONGEST is big enough for reading 64-bit core files. */
gdb_static_assert (sizeof (ULONGEST) >= 8);
@@ -1132,15 +1125,15 @@ linux_read_core_file_mappings
if (note_size < 2 * addr_size)
{
- warning (_("malformed core note - too short for header"));
+ warning (_ ("malformed core note - too short for header"));
return;
}
gdb::def_vector<gdb_byte> contents (note_size);
- if (!bfd_get_section_contents (core_bfd, section, contents.data (),
- 0, note_size))
+ if (!bfd_get_section_contents (core_bfd, section, contents.data (), 0,
+ note_size))
{
- warning (_("could not get core note contents"));
+ warning (_ ("could not get core note contents"));
return;
}
@@ -1149,7 +1142,7 @@ linux_read_core_file_mappings
if (descdata[note_size - 1] != '\0')
{
- warning (_("malformed note - does not end with \\0"));
+ warning (_ ("malformed note - does not end with \\0"));
return;
}
@@ -1161,7 +1154,7 @@ linux_read_core_file_mappings
if (note_size < 2 * addr_size + count * 3 * addr_size)
{
- warning (_("malformed note - too short for supplied file count"));
+ warning (_ ("malformed note - too short for supplied file count"));
return;
}
@@ -1174,14 +1167,14 @@ linux_read_core_file_mappings
{
if (f >= descend)
{
- warning (_("malformed note - filename area is too small"));
+ warning (_ ("malformed note - filename area is too small"));
return;
}
f += strnlen (f, descend - f) + 1;
}
/* Complain, but don't return early if the filename area is too big. */
if (f != descend)
- warning (_("malformed note - filename area is too big"));
+ warning (_ ("malformed note - filename area is too big"));
const bfd_build_id *orig_build_id = cbfd->build_id;
std::unordered_map<ULONGEST, const bfd_build_id *> vma_map;
@@ -1193,8 +1186,8 @@ linux_read_core_file_mappings
cbfd->build_id = nullptr;
if (sec->flags & SEC_LOAD
- && (get_elf_backend_data (cbfd)->elf_backend_core_find_build_id
- (cbfd, (bfd_vma) sec->filepos)))
+ && (get_elf_backend_data (cbfd)->elf_backend_core_find_build_id (
+ cbfd, (bfd_vma) sec->filepos)))
vma_map[sec->vma] = cbfd->build_id;
}
@@ -1210,7 +1203,7 @@ linux_read_core_file_mappings
ULONGEST file_ofs
= bfd_get (addr_size_bits, core_bfd, descdata) * page_size;
descdata += addr_size;
- char * filename = filenames;
+ char *filename = filenames;
filenames += strlen ((char *) filenames) + 1;
const bfd_build_id *build_id = nullptr;
auto vma_map_it = vma_map.find (start);
@@ -1227,43 +1220,32 @@ linux_read_core_file_mappings
static void
linux_core_info_proc_mappings (struct gdbarch *gdbarch, const char *args)
{
- linux_read_core_file_mappings (gdbarch, core_bfd,
- [=] (ULONGEST count)
+ linux_read_core_file_mappings (
+ gdbarch, core_bfd,
+ [=] (ULONGEST count) {
+ gdb_printf (_ ("Mapped address spaces:\n\n"));
+ if (gdbarch_addr_bit (gdbarch) == 32)
{
- gdb_printf (_("Mapped address spaces:\n\n"));
- if (gdbarch_addr_bit (gdbarch) == 32)
- {
- gdb_printf ("\t%10s %10s %10s %10s %s\n",
- "Start Addr",
- " End Addr",
- " Size", " Offset", "objfile");
- }
- else
- {
- gdb_printf (" %18s %18s %10s %10s %s\n",
- "Start Addr",
- " End Addr",
- " Size", " Offset", "objfile");
- }
- },
- [=] (int num, ULONGEST start, ULONGEST end, ULONGEST file_ofs,
- const char *filename, const bfd_build_id *build_id)
+ gdb_printf ("\t%10s %10s %10s %10s %s\n", "Start Addr", " End Addr",
+ " Size", " Offset", "objfile");
+ }
+ else
{
- if (gdbarch_addr_bit (gdbarch) == 32)
- gdb_printf ("\t%10s %10s %10s %10s %s\n",
- paddress (gdbarch, start),
- paddress (gdbarch, end),
- hex_string (end - start),
- hex_string (file_ofs),
- filename);
- else
- gdb_printf (" %18s %18s %10s %10s %s\n",
- paddress (gdbarch, start),
- paddress (gdbarch, end),
- hex_string (end - start),
- hex_string (file_ofs),
- filename);
- });
+ gdb_printf (" %18s %18s %10s %10s %s\n", "Start Addr", " End Addr",
+ " Size", " Offset", "objfile");
+ }
+ },
+ [=] (int num, ULONGEST start, ULONGEST end, ULONGEST file_ofs,
+ const char *filename, const bfd_build_id *build_id) {
+ if (gdbarch_addr_bit (gdbarch) == 32)
+ gdb_printf ("\t%10s %10s %10s %10s %s\n", paddress (gdbarch, start),
+ paddress (gdbarch, end), hex_string (end - start),
+ hex_string (file_ofs), filename);
+ else
+ gdb_printf (" %18s %18s %10s %10s %s\n", paddress (gdbarch, start),
+ paddress (gdbarch, end), hex_string (end - start),
+ hex_string (file_ofs), filename);
+ });
}
/* Implement "info proc" for a corefile. */
@@ -1283,14 +1265,14 @@ linux_core_info_proc (struct gdbarch *gdbarch, const char *args,
if (exe != NULL)
gdb_printf ("exe = '%s'\n", exe);
else
- warning (_("unable to find command name in core file"));
+ warning (_ ("unable to find command name in core file"));
}
if (mappings_f)
linux_core_info_proc_mappings (gdbarch, args);
if (!exe_f && !mappings_f)
- error (_("unable to handle request"));
+ error (_ ("unable to handle request"));
}
/* Read siginfo data from the core, if possible. Returns -1 on
@@ -1303,7 +1285,8 @@ linux_core_xfer_siginfo (struct gdbarch *gdbarch, gdb_byte *readbuf,
ULONGEST offset, ULONGEST len)
{
thread_section_name section_name (".note.linuxcore.siginfo", inferior_ptid);
- asection *section = bfd_get_section_by_name (core_bfd, section_name.c_str ());
+ asection *section
+ = bfd_get_section_by_name (core_bfd, section_name.c_str ());
if (section == NULL)
return -1;
@@ -1315,19 +1298,15 @@ linux_core_xfer_siginfo (struct gdbarch *gdbarch, gdb_byte *readbuf,
typedef int linux_find_memory_region_ftype (ULONGEST vaddr, ULONGEST size,
ULONGEST offset, ULONGEST inode,
- int read, int write,
- int exec, int modified,
- bool memory_tagged,
- const char *filename,
- void *data);
+ int read, int write, int exec,
+ int modified, bool memory_tagged,
+ const char *filename, void *data);
typedef int linux_dump_mapping_p_ftype (filter_flags filterflags,
const struct smaps_vmflags *v,
int maybe_private_p,
- int mapping_anon_p,
- int mapping_file_p,
- const char *filename,
- ULONGEST addr,
+ int mapping_anon_p, int mapping_file_p,
+ const char *filename, ULONGEST addr,
ULONGEST offset);
/* Helper function to parse the contents of /proc/<pid>/smaps into a data
@@ -1337,8 +1316,7 @@ typedef int linux_dump_mapping_p_ftype (filter_flags filterflags,
into the SMAPS vector. */
static std::vector<struct smaps_data>
-parse_smaps_data (const char *data,
- const std::string maps_filename)
+parse_smaps_data (const char *data, const std::string maps_filename)
{
char *line, *t;
@@ -1371,8 +1349,9 @@ parse_smaps_data (const char *data,
mapping_file_p = !mapping_anon_p;
/* Decode permissions. */
- auto has_perm = [&m] (char c)
- { return m.permissions.find (c) != gdb::string_view::npos; };
+ auto has_perm = [&m] (char c) {
+ return m.permissions.find (c) != gdb::string_view::npos;
+ };
read = has_perm ('r');
write = has_perm ('w');
exec = has_perm ('x');
@@ -1398,7 +1377,7 @@ parse_smaps_data (const char *data,
if (sscanf (line, "%64s", keyword) != 1)
{
- warning (_("Error parsing {s,}maps file '%s'"),
+ warning (_ ("Error parsing {s,}maps file '%s'"),
maps_filename.c_str ());
break;
}
@@ -1419,7 +1398,7 @@ parse_smaps_data (const char *data,
if (sscanf (line, "%*s%lu", &number) != 1)
{
- warning (_("Error parsing {s,}maps file '%s' number"),
+ warning (_ ("Error parsing {s,}maps file '%s' number"),
maps_filename.c_str ());
break;
}
@@ -1446,23 +1425,23 @@ parse_smaps_data (const char *data,
}
}
/* Save the smaps entry to the vector. */
- struct smaps_data map;
-
- map.start_address = m.addr;
- map.end_address = m.endaddr;
- map.filename = m.filename;
- map.vmflags = v;
- map.read = read? true : false;
- map.write = write? true : false;
- map.exec = exec? true : false;
- map.priv = priv? true : false;
- map.has_anonymous = has_anonymous;
- map.mapping_anon_p = mapping_anon_p? true : false;
- map.mapping_file_p = mapping_file_p? true : false;
- map.offset = m.offset;
- map.inode = m.inode;
-
- smaps.emplace_back (map);
+ struct smaps_data map;
+
+ map.start_address = m.addr;
+ map.end_address = m.endaddr;
+ map.filename = m.filename;
+ map.vmflags = v;
+ map.read = read ? true : false;
+ map.write = write ? true : false;
+ map.exec = exec ? true : false;
+ map.priv = priv ? true : false;
+ map.has_anonymous = has_anonymous;
+ map.mapping_anon_p = mapping_anon_p ? true : false;
+ map.mapping_file_p = mapping_file_p ? true : false;
+ map.offset = m.offset;
+ map.inode = m.inode;
+
+ smaps.emplace_back (map);
}
return smaps;
@@ -1495,8 +1474,7 @@ linux_process_address_in_memtag_page (CORE_ADDR address)
{
/* Is the address within [start_address, end_address) in a page
mapped with memory tagging? */
- if (address >= map.start_address
- && address < map.end_address
+ if (address >= map.start_address && address < map.end_address
&& map.vmflags.memory_tagging)
return true;
}
@@ -1531,19 +1509,17 @@ linux_address_in_memtag_page (CORE_ADDR address)
/* List memory regions in the inferior for a corefile. */
static int
-linux_find_memory_regions_full (struct gdbarch *gdbarch,
- linux_dump_mapping_p_ftype *should_dump_mapping_p,
- linux_find_memory_region_ftype *func,
- void *obfd)
+linux_find_memory_regions_full (
+ struct gdbarch *gdbarch, linux_dump_mapping_p_ftype *should_dump_mapping_p,
+ linux_find_memory_region_ftype *func, void *obfd)
{
pid_t pid;
/* Default dump behavior of coredump_filter (0x33), according to
Documentation/filesystems/proc.txt from the Linux kernel
tree. */
- filter_flags filterflags = (COREFILTER_ANON_PRIVATE
- | COREFILTER_ANON_SHARED
- | COREFILTER_ELF_HEADERS
- | COREFILTER_HUGETLB_PRIVATE);
+ filter_flags filterflags
+ = (COREFILTER_ANON_PRIVATE | COREFILTER_ANON_SHARED
+ | COREFILTER_ELF_HEADERS | COREFILTER_HUGETLB_PRIVATE);
/* We need to know the real target PID to access /proc. */
if (current_inferior ()->fake_pid_p)
@@ -1594,12 +1570,9 @@ linux_find_memory_regions_full (struct gdbarch *gdbarch,
if (map.has_anonymous)
{
should_dump_p
- = should_dump_mapping_p (filterflags, &map.vmflags,
- map.priv,
- map.mapping_anon_p,
- map.mapping_file_p,
- map.filename.c_str (),
- map.start_address,
+ = should_dump_mapping_p (filterflags, &map.vmflags, map.priv,
+ map.mapping_anon_p, map.mapping_file_p,
+ map.filename.c_str (), map.start_address,
map.offset);
}
else
@@ -1616,8 +1589,7 @@ linux_find_memory_regions_full (struct gdbarch *gdbarch,
map.offset, map.inode, map.read, map.write, map.exec,
1, /* MODIFIED is true because we want to dump
the mapping. */
- map.vmflags.memory_tagging != 0,
- map.filename.c_str (), obfd);
+ map.vmflags.memory_tagging != 0, map.filename.c_str (), obfd);
}
}
@@ -1643,10 +1615,10 @@ struct linux_find_memory_regions_data
static int
linux_find_memory_regions_thunk (ULONGEST vaddr, ULONGEST size,
- ULONGEST offset, ULONGEST inode,
- int read, int write, int exec, int modified,
- bool memory_tagged,
- const char *filename, void *arg)
+ ULONGEST offset, ULONGEST inode, int read,
+ int write, int exec, int modified,
+ bool memory_tagged, const char *filename,
+ void *arg)
{
struct linux_find_memory_regions_data *data
= (struct linux_find_memory_regions_data *) arg;
@@ -1667,8 +1639,7 @@ linux_find_memory_regions (struct gdbarch *gdbarch,
data.func = func;
data.obfd = obfd;
- return linux_find_memory_regions_full (gdbarch,
- dump_mapping_p,
+ return linux_find_memory_regions_full (gdbarch, dump_mapping_p,
linux_find_memory_regions_thunk,
&data);
}
@@ -1701,10 +1672,9 @@ static linux_find_memory_region_ftype linux_make_mappings_callback;
otherwise. */
static int
-linux_make_mappings_callback (ULONGEST vaddr, ULONGEST size,
- ULONGEST offset, ULONGEST inode,
- int read, int write, int exec, int modified,
- bool memory_tagged,
+linux_make_mappings_callback (ULONGEST vaddr, ULONGEST size, ULONGEST offset,
+ ULONGEST inode, int read, int write, int exec,
+ int modified, bool memory_tagged,
const char *filename, void *data)
{
struct linux_make_mappings_data *map_data
@@ -1756,25 +1726,22 @@ linux_make_mappings_corefile_notes (struct gdbarch *gdbarch, bfd *obfd,
pack_long (buf, long_type, 1);
obstack_grow (&data_obstack, buf, long_type->length ());
- linux_find_memory_regions_full (gdbarch,
- dump_note_entry_p,
- linux_make_mappings_callback,
- &mapping_data);
+ linux_find_memory_regions_full (gdbarch, dump_note_entry_p,
+ linux_make_mappings_callback, &mapping_data);
if (mapping_data.file_count != 0)
{
/* Write the count to the obstack. */
- pack_long ((gdb_byte *) obstack_base (&data_obstack),
- long_type, mapping_data.file_count);
+ pack_long ((gdb_byte *) obstack_base (&data_obstack), long_type,
+ mapping_data.file_count);
/* Copy the filenames to the data obstack. */
int size = obstack_object_size (&filename_obstack);
- obstack_grow (&data_obstack, obstack_base (&filename_obstack),
- size);
+ obstack_grow (&data_obstack, obstack_base (&filename_obstack), size);
- note_data.reset (elfcore_write_file_note (obfd, note_data.release (), note_size,
- obstack_base (&data_obstack),
- obstack_object_size (&data_obstack)));
+ note_data.reset (elfcore_write_file_note (
+ obfd, note_data.release (), note_size, obstack_base (&data_obstack),
+ obstack_object_size (&data_obstack)));
}
}
@@ -1799,8 +1766,8 @@ linux_get_siginfo_data (thread_info *thread, struct gdbarch *gdbarch)
gdb::byte_vector buf (siginfo_type->length ());
bytes_read = target_read (current_inferior ()->top_target (),
- TARGET_OBJECT_SIGNAL_INFO, NULL,
- buf.data (), 0, siginfo_type->length ());
+ TARGET_OBJECT_SIGNAL_INFO, NULL, buf.data (), 0,
+ siginfo_type->length ());
if (bytes_read != siginfo_type->length ())
buf.clear ();
@@ -1812,9 +1779,13 @@ struct linux_corefile_thread_data
linux_corefile_thread_data (struct gdbarch *gdbarch, bfd *obfd,
gdb::unique_xmalloc_ptr<char> &note_data,
int *note_size, gdb_signal stop_signal)
- : gdbarch (gdbarch), obfd (obfd), note_data (note_data),
- note_size (note_size), stop_signal (stop_signal)
- {}
+ : gdbarch (gdbarch),
+ obfd (obfd),
+ note_data (note_data),
+ note_size (note_size),
+ stop_signal (stop_signal)
+ {
+ }
struct gdbarch *gdbarch;
bfd *obfd;
@@ -1831,9 +1802,8 @@ linux_corefile_thread (struct thread_info *info,
struct linux_corefile_thread_data *args)
{
gcore_elf_build_thread_register_notes (args->gdbarch, info,
- args->stop_signal,
- args->obfd, &args->note_data,
- args->note_size);
+ args->stop_signal, args->obfd,
+ &args->note_data, args->note_size);
/* Don't return anything if we got no register information above,
such a core file is useless. */
@@ -1842,12 +1812,9 @@ linux_corefile_thread (struct thread_info *info,
gdb::byte_vector siginfo_data
= linux_get_siginfo_data (info, args->gdbarch);
if (!siginfo_data.empty ())
- args->note_data.reset (elfcore_write_note (args->obfd,
- args->note_data.release (),
- args->note_size,
- "CORE", NT_SIGINFO,
- siginfo_data.data (),
- siginfo_data.size ()));
+ args->note_data.reset (elfcore_write_note (
+ args->obfd, args->note_data.release (), args->note_size, "CORE",
+ NT_SIGINFO, siginfo_data.data (), siginfo_data.size ()));
}
}
@@ -1957,19 +1924,17 @@ linux_fill_prpsinfo (struct elf_internal_linux_prpsinfo *p)
proc_stat = skip_spaces (proc_stat);
n_fields = sscanf (proc_stat,
- "%c" /* Process state. */
- "%d%d%d" /* Parent PID, group ID, session ID. */
- "%*d%*d" /* tty_nr, tpgid (not used). */
- "%u" /* Flags. */
- "%*s%*s%*s%*s" /* minflt, cminflt, majflt,
+ "%c" /* Process state. */
+ "%d%d%d" /* Parent PID, group ID, session ID. */
+ "%*d%*d" /* tty_nr, tpgid (not used). */
+ "%u" /* Flags. */
+ "%*s%*s%*s%*s" /* minflt, cminflt, majflt,
cmajflt (not used). */
- "%*s%*s%*s%*s" /* utime, stime, cutime,
+ "%*s%*s%*s%*s" /* utime, stime, cutime,
cstime (not used). */
- "%*s" /* Priority (not used). */
- "%ld", /* Nice. */
- &pr_sname,
- &p->pr_ppid, &p->pr_pgrp, &p->pr_sid,
- &pr_flag,
+ "%*s" /* Priority (not used). */
+ "%ld", /* Nice. */
+ &pr_sname, &p->pr_ppid, &p->pr_pgrp, &p->pr_sid, &pr_flag,
&pr_nice);
if (n_fields != 6)
@@ -2047,19 +2012,17 @@ linux_make_corefile_notes (struct gdbarch *gdbarch, bfd *obfd, int *note_size)
struct elf_internal_linux_prpsinfo prpsinfo;
gdb::unique_xmalloc_ptr<char> note_data;
- if (! gdbarch_iterate_over_regset_sections_p (gdbarch))
+ if (!gdbarch_iterate_over_regset_sections_p (gdbarch))
return NULL;
if (linux_fill_prpsinfo (&prpsinfo))
{
if (gdbarch_ptr_bit (gdbarch) == 64)
- note_data.reset (elfcore_write_linux_prpsinfo64 (obfd,
- note_data.release (),
- note_size, &prpsinfo));
+ note_data.reset (elfcore_write_linux_prpsinfo64 (
+ obfd, note_data.release (), note_size, &prpsinfo));
else
- note_data.reset (elfcore_write_linux_prpsinfo32 (obfd,
- note_data.release (),
- note_size, &prpsinfo));
+ note_data.reset (elfcore_write_linux_prpsinfo32 (
+ obfd, note_data.release (), note_size, &prpsinfo));
}
/* Thread register information. */
@@ -2099,9 +2062,9 @@ linux_make_corefile_notes (struct gdbarch *gdbarch, bfd *obfd, int *note_size)
return NULL;
/* Auxillary vector. */
- gdb::optional<gdb::byte_vector> auxv =
- target_read_alloc (current_inferior ()->top_target (),
- TARGET_OBJECT_AUXV, NULL);
+ gdb::optional<gdb::byte_vector> auxv
+ = target_read_alloc (current_inferior ()->top_target (),
+ TARGET_OBJECT_AUXV, NULL);
if (auxv && !auxv->empty ())
{
note_data.reset (elfcore_write_note (obfd, note_data.release (),
@@ -2249,8 +2212,7 @@ linux_gdb_signal_from_target (struct gdbarch *gdbarch, int signal)
other -tdep files. */
int
-linux_gdb_signal_to_target (struct gdbarch *gdbarch,
- enum gdb_signal signal)
+linux_gdb_signal_to_target (struct gdbarch *gdbarch, enum gdb_signal signal)
{
switch (signal)
{
@@ -2361,8 +2323,7 @@ linux_gdb_signal_to_target (struct gdbarch *gdbarch,
}
/* GDB_SIGNAL_REALTIME_33 to _64 are continuous. */
- if (signal >= GDB_SIGNAL_REALTIME_33
- && signal <= GDB_SIGNAL_REALTIME_63)
+ if (signal >= GDB_SIGNAL_REALTIME_33 && signal <= GDB_SIGNAL_REALTIME_63)
{
int offset = signal - GDB_SIGNAL_REALTIME_33;
@@ -2396,8 +2357,8 @@ linux_vsyscall_range_raw (struct gdbarch *gdbarch, struct mem_range *range)
if (phdrs_size == -1)
return 0;
- gdb::unique_xmalloc_ptr<Elf_Internal_Phdr>
- phdrs ((Elf_Internal_Phdr *) xmalloc (phdrs_size));
+ gdb::unique_xmalloc_ptr<Elf_Internal_Phdr> phdrs (
+ (Elf_Internal_Phdr *) xmalloc (phdrs_size));
num_phdrs = bfd_get_elf_phdrs (core_bfd, phdrs.get ());
if (num_phdrs == -1)
return 0;
@@ -2435,8 +2396,7 @@ linux_vsyscall_range_raw (struct gdbarch *gdbarch, struct mem_range *range)
char *line;
char *saveptr = NULL;
- for (line = strtok_r (data.get (), "\n", &saveptr);
- line != NULL;
+ for (line = strtok_r (data.get (), "\n", &saveptr); line != NULL;
line = strtok_r (NULL, "\n", &saveptr))
{
ULONGEST addr, endaddr;
@@ -2454,7 +2414,7 @@ linux_vsyscall_range_raw (struct gdbarch *gdbarch, struct mem_range *range)
}
}
else
- warning (_("unable to open /proc file '%s'"), filename);
+ warning (_ ("unable to open /proc file '%s'"), filename);
return 0;
}
@@ -2484,8 +2444,8 @@ linux_vsyscall_range (struct gdbarch *gdbarch, struct mem_range *range)
/* Symbols for linux_infcall_mmap's ARG_FLAGS; their Linux MAP_* system
definitions would be dependent on compilation host. */
-#define GDB_MMAP_MAP_PRIVATE 0x02 /* Changes are private. */
-#define GDB_MMAP_MAP_ANONYMOUS 0x20 /* Don't use a file. */
+#define GDB_MMAP_MAP_PRIVATE 0x02 /* Changes are private. */
+#define GDB_MMAP_MAP_ANONYMOUS 0x20 /* Don't use a file. */
/* See gdbarch.sh 'infcall_mmap'. */
@@ -2499,31 +2459,40 @@ linux_infcall_mmap (CORE_ADDR size, unsigned prot)
struct value *addr_val;
struct gdbarch *gdbarch = objf->arch ();
CORE_ADDR retval;
+
enum
- {
- ARG_ADDR, ARG_LENGTH, ARG_PROT, ARG_FLAGS, ARG_FD, ARG_OFFSET, ARG_LAST
- };
+ {
+ ARG_ADDR,
+ ARG_LENGTH,
+ ARG_PROT,
+ ARG_FLAGS,
+ ARG_FD,
+ ARG_OFFSET,
+ ARG_LAST
+ };
struct value *arg[ARG_LAST];
- arg[ARG_ADDR] = value_from_pointer (builtin_type (gdbarch)->builtin_data_ptr,
- 0);
+ arg[ARG_ADDR]
+ = value_from_pointer (builtin_type (gdbarch)->builtin_data_ptr, 0);
/* Assuming sizeof (unsigned long) == sizeof (size_t). */
- arg[ARG_LENGTH] = value_from_ulongest
- (builtin_type (gdbarch)->builtin_unsigned_long, size);
- gdb_assert ((prot & ~(GDB_MMAP_PROT_READ | GDB_MMAP_PROT_WRITE
- | GDB_MMAP_PROT_EXEC))
- == 0);
- arg[ARG_PROT] = value_from_longest (builtin_type (gdbarch)->builtin_int, prot);
- arg[ARG_FLAGS] = value_from_longest (builtin_type (gdbarch)->builtin_int,
- GDB_MMAP_MAP_PRIVATE
- | GDB_MMAP_MAP_ANONYMOUS);
+ arg[ARG_LENGTH]
+ = value_from_ulongest (builtin_type (gdbarch)->builtin_unsigned_long,
+ size);
+ gdb_assert (
+ (prot & ~(GDB_MMAP_PROT_READ | GDB_MMAP_PROT_WRITE | GDB_MMAP_PROT_EXEC))
+ == 0);
+ arg[ARG_PROT]
+ = value_from_longest (builtin_type (gdbarch)->builtin_int, prot);
+ arg[ARG_FLAGS]
+ = value_from_longest (builtin_type (gdbarch)->builtin_int,
+ GDB_MMAP_MAP_PRIVATE | GDB_MMAP_MAP_ANONYMOUS);
arg[ARG_FD] = value_from_longest (builtin_type (gdbarch)->builtin_int, -1);
- arg[ARG_OFFSET] = value_from_longest (builtin_type (gdbarch)->builtin_int64,
- 0);
+ arg[ARG_OFFSET]
+ = value_from_longest (builtin_type (gdbarch)->builtin_int64, 0);
addr_val = call_function_by_hand (mmap_val, NULL, arg);
retval = value_as_address (addr_val);
if (retval == (CORE_ADDR) -1)
- error (_("Failed inferior mmap call for %s bytes, errno is changed."),
+ error (_ ("Failed inferior mmap call for %s bytes, errno is changed."),
pulongest (size));
return retval;
}
@@ -2538,22 +2507,26 @@ linux_infcall_munmap (CORE_ADDR addr, CORE_ADDR size)
struct value *retval_val;
struct gdbarch *gdbarch = objf->arch ();
LONGEST retval;
+
enum
- {
- ARG_ADDR, ARG_LENGTH, ARG_LAST
- };
+ {
+ ARG_ADDR,
+ ARG_LENGTH,
+ ARG_LAST
+ };
struct value *arg[ARG_LAST];
- arg[ARG_ADDR] = value_from_pointer (builtin_type (gdbarch)->builtin_data_ptr,
- addr);
+ arg[ARG_ADDR]
+ = value_from_pointer (builtin_type (gdbarch)->builtin_data_ptr, addr);
/* Assuming sizeof (unsigned long) == sizeof (size_t). */
- arg[ARG_LENGTH] = value_from_ulongest
- (builtin_type (gdbarch)->builtin_unsigned_long, size);
+ arg[ARG_LENGTH]
+ = value_from_ulongest (builtin_type (gdbarch)->builtin_unsigned_long,
+ size);
retval_val = call_function_by_hand (munmap_val, NULL, arg);
retval = value_as_long (retval_val);
if (retval != 0)
- warning (_("Failed inferior munmap call at %s for %s bytes, "
- "errno is changed."),
+ warning (_ ("Failed inferior munmap call at %s for %s bytes, "
+ "errno is changed."),
hex_string (addr), pulongest (size));
}
@@ -2573,12 +2546,13 @@ linux_displaced_step_location (struct gdbarch *gdbarch)
point address instead. */
if (target_auxv_search (AT_ENTRY, &addr) <= 0)
throw_error (NOT_SUPPORTED_ERROR,
- _("Cannot find AT_ENTRY auxiliary vector entry."));
+ _ ("Cannot find AT_ENTRY auxiliary vector entry."));
/* Make certain that the address points at real code, and not a
function descriptor. */
- addr = gdbarch_convert_from_func_ptr_addr
- (gdbarch, addr, current_inferior ()->top_target ());
+ addr
+ = gdbarch_convert_from_func_ptr_addr (gdbarch, addr,
+ current_inferior ()->top_target ());
/* Inferior calls also use the entry point as a breakpoint location.
We don't want displaced stepping to interfere with those
@@ -2621,7 +2595,8 @@ linux_displaced_step_prepare (gdbarch *arch, thread_info *thread,
/* See linux-tdep.h. */
displaced_step_finish_status
-linux_displaced_step_finish (gdbarch *arch, thread_info *thread, gdb_signal sig)
+linux_displaced_step_finish (gdbarch *arch, thread_info *thread,
+ gdb_signal sig)
{
linux_info *per_inferior = get_linux_inferior_data (thread->inf);
@@ -2637,8 +2612,7 @@ linux_displaced_step_copy_insn_closure_by_addr (inferior *inf, CORE_ADDR addr)
{
linux_info *per_inferior = linux_inferior_data.get (inf);
- if (per_inferior == nullptr
- || !per_inferior->disp_step_bufs.has_value ())
+ if (per_inferior == nullptr || !per_inferior->disp_step_bufs.has_value ())
return nullptr;
return per_inferior->disp_step_bufs->copy_insn_closure_by_addr (addr);
@@ -2651,8 +2625,7 @@ linux_displaced_step_restore_all_in_ptid (inferior *parent_inf, ptid_t ptid)
{
linux_info *per_inferior = linux_inferior_data.get (parent_inf);
- if (per_inferior == nullptr
- || !per_inferior->disp_step_bufs.has_value ())
+ if (per_inferior == nullptr || !per_inferior->disp_step_bufs.has_value ())
return;
per_inferior->disp_step_bufs->restore_in_ptid (ptid);
@@ -2716,8 +2689,10 @@ static void
show_use_coredump_filter (struct ui_file *file, int from_tty,
struct cmd_list_element *c, const char *value)
{
- gdb_printf (file, _("Use of /proc/PID/coredump_filter file to generate"
- " corefiles is %s.\n"), value);
+ gdb_printf (file,
+ _ ("Use of /proc/PID/coredump_filter file to generate"
+ " corefiles is %s.\n"),
+ value);
}
/* Display whether the gcore command is dumping mappings marked with
@@ -2727,8 +2702,10 @@ static void
show_dump_excluded_mappings (struct ui_file *file, int from_tty,
struct cmd_list_element *c, const char *value)
{
- gdb_printf (file, _("Dumping of mappings marked with the VM_DONTDUMP"
- " flag is %s.\n"), value);
+ gdb_printf (file,
+ _ ("Dumping of mappings marked with the VM_DONTDUMP"
+ " flag is %s.\n"),
+ value);
}
/* To be called from the various GDB_OSABI_LINUX handlers for the
@@ -2749,10 +2726,10 @@ linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch,
set_gdbarch_displaced_step_prepare (gdbarch,
linux_displaced_step_prepare);
set_gdbarch_displaced_step_finish (gdbarch, linux_displaced_step_finish);
- set_gdbarch_displaced_step_copy_insn_closure_by_addr
- (gdbarch, linux_displaced_step_copy_insn_closure_by_addr);
- set_gdbarch_displaced_step_restore_all_in_ptid
- (gdbarch, linux_displaced_step_restore_all_in_ptid);
+ set_gdbarch_displaced_step_copy_insn_closure_by_addr (
+ gdbarch, linux_displaced_step_copy_insn_closure_by_addr);
+ set_gdbarch_displaced_step_restore_all_in_ptid (
+ gdbarch, linux_displaced_step_restore_all_in_ptid);
}
set_gdbarch_core_pid_to_str (gdbarch, linux_core_pid_to_str);
@@ -2764,10 +2741,8 @@ linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch,
set_gdbarch_make_corefile_notes (gdbarch, linux_make_corefile_notes);
set_gdbarch_has_shared_address_space (gdbarch,
linux_has_shared_address_space);
- set_gdbarch_gdb_signal_from_target (gdbarch,
- linux_gdb_signal_from_target);
- set_gdbarch_gdb_signal_to_target (gdbarch,
- linux_gdb_signal_to_target);
+ set_gdbarch_gdb_signal_from_target (gdbarch, linux_gdb_signal_from_target);
+ set_gdbarch_gdb_signal_to_target (gdbarch, linux_gdb_signal_to_target);
set_gdbarch_vsyscall_range (gdbarch, linux_vsyscall_range);
set_gdbarch_infcall_mmap (gdbarch, linux_infcall_mmap);
set_gdbarch_infcall_munmap (gdbarch, linux_infcall_munmap);
@@ -2775,6 +2750,7 @@ linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch,
}
void _initialize_linux_tdep ();
+
void
_initialize_linux_tdep ()
{
@@ -2787,28 +2763,28 @@ _initialize_linux_tdep ()
"linux-tdep");
add_setshow_boolean_cmd ("use-coredump-filter", class_files,
- &use_coredump_filter, _("\
+ &use_coredump_filter, _ ("\
Set whether gcore should consider /proc/PID/coredump_filter."),
- _("\
+ _ ("\
Show whether gcore should consider /proc/PID/coredump_filter."),
- _("\
+ _ ("\
Use this command to set whether gcore should consider the contents\n\
of /proc/PID/coredump_filter when generating the corefile. For more information\n\
about this file, refer to the manpage of core(5)."),
- NULL, show_use_coredump_filter,
- &setlist, &showlist);
+ NULL, show_use_coredump_filter, &setlist,
+ &showlist);
add_setshow_boolean_cmd ("dump-excluded-mappings", class_files,
- &dump_excluded_mappings, _("\
+ &dump_excluded_mappings, _ ("\
Set whether gcore should dump mappings marked with the VM_DONTDUMP flag."),
- _("\
+ _ ("\
Show whether gcore should dump mappings marked with the VM_DONTDUMP flag."),
- _("\
+ _ ("\
Use this command to set whether gcore should dump mappings marked with the\n\
VM_DONTDUMP flag (\"dd\" in /proc/PID/smaps) when generating the corefile. For\n\
more information about this file, refer to the manpage of proc(5) and core(5)."),
- NULL, show_dump_excluded_mappings,
- &setlist, &showlist);
+ NULL, show_dump_excluded_mappings, &setlist,
+ &showlist);
}
/* Fetch (and possibly build) an appropriate `link_map_offsets' for
diff --git a/gdb/linux-tdep.h b/gdb/linux-tdep.h
index 16e1b806b26..4b123a0ceb9 100644
--- a/gdb/linux-tdep.h
+++ b/gdb/linux-tdep.h
@@ -48,9 +48,8 @@ struct type *linux_get_siginfo_type_with_fields (struct gdbarch *gdbarch,
bool linux_address_in_memtag_page (CORE_ADDR address);
typedef char *(*linux_collect_thread_registers_ftype) (const struct regcache *,
- ptid_t,
- bfd *, char *, int *,
- enum gdb_signal);
+ ptid_t, bfd *, char *,
+ int *, enum gdb_signal);
extern enum gdb_signal linux_gdb_signal_from_target (struct gdbarch *gdbarch,
int signal);
@@ -63,22 +62,22 @@ extern int linux_gdb_signal_to_target (struct gdbarch *gdbarch,
the target auxiliary vector. */
extern CORE_ADDR linux_displaced_step_location (struct gdbarch *gdbarch);
-
/* Implementation of gdbarch_displaced_step_prepare. */
-extern displaced_step_prepare_status linux_displaced_step_prepare
- (gdbarch *arch, thread_info *thread, CORE_ADDR &displaced_pc);
+extern displaced_step_prepare_status
+linux_displaced_step_prepare (gdbarch *arch, thread_info *thread,
+ CORE_ADDR &displaced_pc);
/* Implementation of gdbarch_displaced_step_finish. */
-extern displaced_step_finish_status linux_displaced_step_finish
- (gdbarch *arch, thread_info *thread, gdb_signal sig);
+extern displaced_step_finish_status
+linux_displaced_step_finish (gdbarch *arch, thread_info *thread,
+ gdb_signal sig);
/* Implementation of gdbarch_displaced_step_copy_insn_closure_by_addr. */
extern const displaced_step_copy_insn_closure *
- linux_displaced_step_copy_insn_closure_by_addr
- (inferior *inf, CORE_ADDR addr);
+linux_displaced_step_copy_insn_closure_by_addr (inferior *inf, CORE_ADDR addr);
/* Implementation of gdbarch_displaced_step_restore_all_in_ptid. */
@@ -106,7 +105,8 @@ extern CORE_ADDR linux_get_hwcap ();
On error, 0 is returned. */
extern CORE_ADDR linux_get_hwcap2 (const gdb::optional<gdb::byte_vector> &auxv,
- struct target_ops *target, gdbarch *gdbarch);
+ struct target_ops *target,
+ gdbarch *gdbarch);
/* Same as the above, but obtain all the inputs from the current inferior. */
diff --git a/gdb/linux-thread-db.c b/gdb/linux-thread-db.c
index 2bd3b8a8a24..f324c6848c8 100644
--- a/gdb/linux-thread-db.c
+++ b/gdb/linux-thread-db.c
@@ -77,17 +77,15 @@
of the ptid_t prevents thread IDs changing when libpthread is
loaded or unloaded. */
-static const target_info thread_db_target_info = {
- "multi-thread",
- N_("multi-threaded child process."),
- N_("Threads and pthreads support.")
-};
+static const target_info thread_db_target_info
+ = { "multi-thread", N_ ("multi-threaded child process."),
+ N_ ("Threads and pthreads support.") };
class thread_db_target final : public target_ops
{
public:
- const target_info &info () const override
- { return thread_db_target_info; }
+
+ const target_info &info () const override { return thread_db_target_info; }
strata stratum () const override { return thread_stratum; }
@@ -98,8 +96,7 @@ public:
void follow_exec (inferior *, ptid_t, const char *) override;
void update_thread_list () override;
std::string pid_to_str (ptid_t) override;
- CORE_ADDR get_thread_local_address (ptid_t ptid,
- CORE_ADDR load_module_addr,
+ CORE_ADDR get_thread_local_address (ptid_t ptid, CORE_ADDR load_module_addr,
CORE_ADDR offset) override;
const char *extra_thread_info (struct thread_info *) override;
ptid_t get_ada_task_ptid (long lwp, ULONGEST thread) override;
@@ -107,7 +104,8 @@ public:
thread_info *thread_handle_to_thread_info (const gdb_byte *thread_handle,
int handle_len,
inferior *inf) override;
- gdb::byte_vector thread_info_to_thread_handle (struct thread_info *) override;
+ gdb::byte_vector
+ thread_info_to_thread_handle (struct thread_info *) override;
};
static std::string libthread_db_search_path = LIBTHREAD_DB_SEARCH_PATH;
@@ -126,8 +124,9 @@ static void
show_auto_load_thread_db (struct ui_file *file, int from_tty,
struct cmd_list_element *c, const char *value)
{
- gdb_printf (file, _("Auto-loading of inferior specific libthread_db "
- "is %s.\n"),
+ gdb_printf (file,
+ _ ("Auto-loading of inferior specific libthread_db "
+ "is %s.\n"),
value);
}
@@ -147,7 +146,7 @@ static void
show_libthread_db_debug (struct ui_file *file, int from_tty,
struct cmd_list_element *c, const char *value)
{
- gdb_printf (file, _("libthread-db debugging is %s.\n"), value);
+ gdb_printf (file, _ ("libthread-db debugging is %s.\n"), value);
}
/* If we're running on GNU/Linux, we must explicitly attach to any new
@@ -213,9 +212,10 @@ static void thread_db_find_new_threads_2 (thread_info *stopped,
static void check_thread_signals (void);
-static struct thread_info *record_thread
- (struct thread_db_info *info, struct thread_info *tp,
- ptid_t ptid, const td_thrhandle_t *th_p, const td_thrinfo_t *ti_p);
+static struct thread_info *record_thread (struct thread_db_info *info,
+ struct thread_info *tp, ptid_t ptid,
+ const td_thrhandle_t *th_p,
+ const td_thrinfo_t *ti_p);
/* Add the current inferior to the list of processes using libpthread.
Return a pointer to the newly allocated object that was added to
@@ -283,8 +283,8 @@ delete_thread_db_info (process_stratum_target *targ, int pid)
td_err_e err = info->td_ta_delete_p (info->thread_agent);
if (err != TD_OK)
- warning (_("Cannot deregister process %d from libthread_db: %s"),
- pid, thread_db_err_str (err));
+ warning (_ ("Cannot deregister process %d from libthread_db: %s"), pid,
+ thread_db_err_str (err));
info->thread_agent = NULL;
}
@@ -317,7 +317,8 @@ struct thread_db_thread_info : public private_thread_info
static thread_db_thread_info *
get_thread_db_thread_info (thread_info *thread)
{
- return gdb::checked_static_cast<thread_db_thread_info *> (thread->priv.get ());
+ return gdb::checked_static_cast<thread_db_thread_info *> (
+ thread->priv.get ());
}
static const char *
@@ -410,22 +411,20 @@ thread_from_lwp (thread_info *stopped, ptid_t ptid)
/* Access an lwp we know is stopped. */
info->proc_handle.thread = stopped;
- err = info->td_ta_map_lwp2thr_p (info->thread_agent, ptid.lwp (),
- &th);
+ err = info->td_ta_map_lwp2thr_p (info->thread_agent, ptid.lwp (), &th);
if (err != TD_OK)
- error (_("Cannot find user-level thread for LWP %ld: %s"),
- ptid.lwp (), thread_db_err_str (err));
+ error (_ ("Cannot find user-level thread for LWP %ld: %s"), ptid.lwp (),
+ thread_db_err_str (err));
err = info->td_thr_get_info_p (&th, &ti);
if (err != TD_OK)
- error (_("thread_get_info_callback: cannot get thread info: %s"),
+ error (_ ("thread_get_info_callback: cannot get thread info: %s"),
thread_db_err_str (err));
/* Fill the cache. */
tp = find_thread_ptid (stopped->inf->process_target (), ptid);
return record_thread (info, tp, ptid, &th, &ti);
}
-
/* See linux-nat.h. */
@@ -454,8 +453,8 @@ verbose_dlsym (void *handle, const char *name)
{
void *sym = dlsym (handle, name);
if (sym == NULL)
- warning (_("Symbol \"%s\" not found in libthread_db: %s"),
- name, dlerror ());
+ warning (_ ("Symbol \"%s\" not found in libthread_db: %s"), name,
+ dlerror ());
return sym;
}
@@ -499,7 +498,6 @@ inferior_has_bug (const char *ver_symbol, int ver_major_min, int ver_minor_min)
static int
thread_db_find_new_threads_silently (thread_info *stopped)
{
-
try
{
thread_db_find_new_threads_2 (stopped, true);
@@ -530,8 +528,8 @@ thread_db_find_new_threads_silently (thread_info *stopped)
if (!target_has_execution () || !inferior_has_bug ("nptl_version", 2, 7))
{
exception_fprintf (gdb_stderr, except,
- _("Warning: couldn't activate thread debugging "
- "using libthread_db: "));
+ _ ("Warning: couldn't activate thread debugging "
+ "using libthread_db: "));
return 1;
}
}
@@ -583,52 +581,49 @@ check_thread_db_callback (const td_thrhandle_t *th, void *arg)
gdb_assert (tdb_testinfo != NULL);
tdb_testinfo->threads_seen = true;
-#define LOG(fmt, args...) \
- do \
- { \
- if (tdb_testinfo->log_progress) \
- { \
- debug_printf (fmt, ## args); \
- gdb_flush (gdb_stdlog); \
- } \
- } \
+#define LOG(fmt, args...) \
+ do \
+ { \
+ if (tdb_testinfo->log_progress) \
+ { \
+ debug_printf (fmt, ##args); \
+ gdb_flush (gdb_stdlog); \
+ } \
+ } \
while (0)
-#define CHECK_1(expr, args...) \
- do \
- { \
- if (!(expr)) \
- { \
- LOG (" ... FAIL!\n"); \
- error (args); \
- } \
- } \
+#define CHECK_1(expr, args...) \
+ do \
+ { \
+ if (!(expr)) \
+ { \
+ LOG (" ... FAIL!\n"); \
+ error (args); \
+ } \
+ } \
while (0)
-#define CHECK(expr) \
- CHECK_1 (expr, "(%s) == false", #expr)
+#define CHECK(expr) CHECK_1 (expr, "(%s) == false", #expr)
-#define CALL_UNCHECKED(func, args...) \
- do \
- { \
- tdb_testinfo->last_call = #func; \
- tdb_testinfo->last_result \
- = tdb_testinfo->info->func ## _p (args); \
- } \
+#define CALL_UNCHECKED(func, args...) \
+ do \
+ { \
+ tdb_testinfo->last_call = #func; \
+ tdb_testinfo->last_result = tdb_testinfo->info->func##_p (args); \
+ } \
while (0)
-#define CHECK_CALL() \
- CHECK_1 (tdb_testinfo->last_result == TD_OK, \
- _("%s failed: %s"), \
- tdb_testinfo->last_call, \
- thread_db_err_str (tdb_testinfo->last_result)) \
-
-#define CALL(func, args...) \
- do \
- { \
- CALL_UNCHECKED (func, args); \
- CHECK_CALL (); \
- } \
+#define CHECK_CALL() \
+ CHECK_1 (tdb_testinfo->last_result == TD_OK, _ ("%s failed: %s"), \
+ tdb_testinfo->last_call, \
+ thread_db_err_str (tdb_testinfo->last_result))
+
+#define CALL(func, args...) \
+ do \
+ { \
+ CALL_UNCHECKED (func, args); \
+ CHECK_CALL (); \
+ } \
while (0)
LOG (" Got thread");
@@ -657,7 +652,7 @@ check_thread_db_callback (const td_thrhandle_t *th, void *arg)
if (tdb_testinfo->last_result == TD_ERR && !target_has_execution ())
{
/* Some platforms require execution for td_ta_map_lwp2thr. */
- LOG (_("; can't map_lwp2thr"));
+ LOG (_ ("; can't map_lwp2thr"));
}
else
{
@@ -729,7 +724,7 @@ check_thread_db (struct thread_db_info *info, bool log_progress)
bool test_passed = true;
if (log_progress)
- debug_printf (_("Running libthread_db integrity checks:\n"));
+ debug_printf (_ ("Running libthread_db integrity checks:\n"));
/* GDB avoids using td_ta_thr_iter wherever possible (see comment
in try_thread_db_load_1 below) so in order to test it we may
@@ -761,19 +756,17 @@ check_thread_db (struct thread_db_info *info, bool log_progress)
try
{
- td_err_e err = td_ta_thr_iter_p (info->thread_agent,
- check_thread_db_callback,
- tdb_testinfo,
- TD_THR_ANY_STATE,
- TD_THR_LOWEST_PRIORITY,
- TD_SIGNO_MASK,
- TD_THR_ANY_USER_FLAGS);
+ td_err_e err
+ = td_ta_thr_iter_p (info->thread_agent, check_thread_db_callback,
+ tdb_testinfo, TD_THR_ANY_STATE,
+ TD_THR_LOWEST_PRIORITY, TD_SIGNO_MASK,
+ TD_THR_ANY_USER_FLAGS);
if (err != TD_OK)
- error (_("td_ta_thr_iter failed: %s"), thread_db_err_str (err));
+ error (_ ("td_ta_thr_iter failed: %s"), thread_db_err_str (err));
if (!tdb_testinfo->threads_seen)
- error (_("no threads seen"));
+ error (_ ("no threads seen"));
}
catch (const gdb_exception_error &except)
{
@@ -781,13 +774,13 @@ check_thread_db (struct thread_db_info *info, bool log_progress)
gdb_puts (warning_pre_print, gdb_stderr);
exception_fprintf (gdb_stderr, except,
- _("libthread_db integrity checks failed: "));
+ _ ("libthread_db integrity checks failed: "));
test_passed = false;
}
if (test_passed && log_progress)
- debug_printf (_("libthread_db integrity checks passed.\n"));
+ debug_printf (_ ("libthread_db integrity checks passed.\n"));
tdb_testinfo = NULL;
@@ -809,9 +802,8 @@ static bool
libpthread_objfile_p (objfile *obj)
{
return (libpthread_name_p (objfile_name (obj))
- && lookup_minimal_symbol ("pthread_create",
- NULL,
- obj).minsym != NULL);
+ && lookup_minimal_symbol ("pthread_create", NULL, obj).minsym
+ != NULL);
}
/* Attempt to initialize dlopen()ed libthread_db, described by INFO.
@@ -828,25 +820,26 @@ try_thread_db_load_1 (struct thread_db_info *info)
/* Initialize pointers to the dynamic library functions we will use.
Essential functions first. */
-#define TDB_VERBOSE_DLSYM(info, func) \
- info->func ## _p = (func ## _ftype *) verbose_dlsym (info->handle, #func)
+#define TDB_VERBOSE_DLSYM(info, func) \
+ info->func##_p = (func##_ftype *) verbose_dlsym (info->handle, #func)
-#define TDB_DLSYM(info, func) \
- info->func ## _p = (func ## _ftype *) dlsym (info->handle, #func)
+#define TDB_DLSYM(info, func) \
+ info->func##_p = (func##_ftype *) dlsym (info->handle, #func)
-#define CHK(a) \
- do \
- { \
- if ((a) == NULL) \
- return false; \
- } while (0)
+#define CHK(a) \
+ do \
+ { \
+ if ((a) == NULL) \
+ return false; \
+ } \
+ while (0)
CHK (TDB_VERBOSE_DLSYM (info, td_init));
err = info->td_init_p ();
if (err != TD_OK)
{
- warning (_("Cannot initialize libthread_db: %s"),
+ warning (_ ("Cannot initialize libthread_db: %s"),
thread_db_err_str (err));
return false;
}
@@ -861,21 +854,21 @@ try_thread_db_load_1 (struct thread_db_info *info)
if (err != TD_OK)
{
if (libthread_db_debug)
- gdb_printf (gdb_stdlog, _("td_ta_new failed: %s\n"),
+ gdb_printf (gdb_stdlog, _ ("td_ta_new failed: %s\n"),
thread_db_err_str (err));
else
switch (err)
{
- case TD_NOLIBTHREAD:
+ case TD_NOLIBTHREAD:
#ifdef THREAD_DB_HAS_TD_VERSION
- case TD_VERSION:
+ case TD_VERSION:
#endif
- /* The errors above are not unexpected and silently ignored:
+ /* The errors above are not unexpected and silently ignored:
they just mean we haven't found correct version of
libthread_db yet. */
- break;
- default:
- warning (_("td_ta_new failed: %s"), thread_db_err_str (err));
+ break;
+ default:
+ warning (_ ("td_ta_new failed: %s"), thread_db_err_str (err));
}
return false;
}
@@ -936,7 +929,7 @@ try_thread_db_load_1 (struct thread_db_info *info)
return false;
}
- gdb_printf (_("[Thread debugging using libthread_db enabled]\n"));
+ gdb_printf (_ ("[Thread debugging using libthread_db enabled]\n"));
if (!libthread_db_search_path.empty () || libthread_db_debug)
{
@@ -946,7 +939,7 @@ try_thread_db_load_1 (struct thread_db_info *info)
if (library == NULL)
library = LIBTHREAD_DB_SO;
- gdb_printf (_("Using host libthread_db library \"%ps\".\n"),
+ gdb_printf (_ ("Using host libthread_db library \"%ps\".\n"),
styled_string (file_name_style.style (), library));
}
@@ -966,8 +959,7 @@ try_thread_db_load (const char *library, bool check_auto_load_safe)
struct thread_db_info *info;
if (libthread_db_debug)
- gdb_printf (gdb_stdlog,
- _("Trying host libthread_db library: %s.\n"),
+ gdb_printf (gdb_stdlog, _ ("Trying host libthread_db library: %s.\n"),
library);
if (check_auto_load_safe)
@@ -977,14 +969,14 @@ try_thread_db_load (const char *library, bool check_auto_load_safe)
/* Do not print warnings by file_is_auto_load_safe if the library does
not exist at this place. */
if (libthread_db_debug)
- gdb_printf (gdb_stdlog, _("open failed: %s.\n"),
+ gdb_printf (gdb_stdlog, _ ("open failed: %s.\n"),
safe_strerror (errno));
return false;
}
- auto_load_debug_printf
- ("Loading libthread-db library \"%s\" from explicit directory.",
- library);
+ auto_load_debug_printf (
+ "Loading libthread-db library \"%s\" from explicit directory.",
+ library);
if (!file_is_auto_load_safe (library))
return false;
@@ -994,7 +986,7 @@ try_thread_db_load (const char *library, bool check_auto_load_safe)
if (handle == NULL)
{
if (libthread_db_debug)
- gdb_printf (gdb_stdlog, _("dlopen failed: %s.\n"), dlerror ());
+ gdb_printf (gdb_stdlog, _ ("dlopen failed: %s.\n"), dlerror ());
return false;
}
@@ -1008,8 +1000,8 @@ try_thread_db_load (const char *library, bool check_auto_load_safe)
const char *const libpath = dladdr_to_soname (td_init);
if (libpath != NULL)
- gdb_printf (gdb_stdlog, _("Host %s resolved to: %s.\n"),
- library, libpath);
+ gdb_printf (gdb_stdlog, _ ("Host %s resolved to: %s.\n"), library,
+ libpath);
}
}
@@ -1049,8 +1041,8 @@ try_thread_db_load_from_pdir_1 (struct objfile *obj, const char *subdir)
if (obj_name[0] != '/')
{
- warning (_("Expected absolute pathname for libpthread in the"
- " inferior, but got %ps."),
+ warning (_ ("Expected absolute pathname for libpthread in the"
+ " inferior, but got %ps."),
styled_string (file_name_style.style (), obj_name));
return false;
}
@@ -1088,8 +1080,8 @@ try_thread_db_load_from_pdir (const char *subdir)
libpthread, and it may live in a directory without a matching
libthread_db. */
if (obj->separate_debug_objfile_backlink != NULL)
- return try_thread_db_load_from_pdir_1 (obj->separate_debug_objfile_backlink,
- subdir);
+ return try_thread_db_load_from_pdir_1 (
+ obj->separate_debug_objfile_backlink, subdir);
return false;
}
@@ -1143,8 +1135,7 @@ thread_db_load_search (void)
this_dir_len = strlen (this_dir);
if (strncmp (this_dir, "$pdir", pdir_len) == 0
- && (this_dir[pdir_len] == '\0'
- || this_dir[pdir_len] == '/'))
+ && (this_dir[pdir_len] == '\0' || this_dir[pdir_len] == '/'))
{
const char *subdir = NULL;
@@ -1177,8 +1168,7 @@ thread_db_load_search (void)
}
if (libthread_db_debug)
- gdb_printf (gdb_stdlog,
- _("thread_db_load_search returning %d\n"), rc);
+ gdb_printf (gdb_stdlog, _ ("thread_db_load_search returning %d\n"), rc);
return rc;
}
@@ -1207,8 +1197,8 @@ thread_db_load (void)
if (inf->in_initial_library_scan)
return false;
- thread_db_info *info = get_thread_db_info (inf->process_target (),
- inferior_ptid.pid ());
+ thread_db_info *info
+ = get_thread_db_info (inf->process_target (), inferior_ptid.pid ());
if (info != NULL)
return true;
@@ -1229,8 +1219,8 @@ thread_db_load (void)
If the inferior has a libpthread warn the user. */
if (has_libpthread ())
{
- warning (_("Unable to find libthread_db matching inferior's thread"
- " library, thread debugging will not be available."));
+ warning (_ ("Unable to find libthread_db matching inferior's thread"
+ " library, thread debugging will not be available."));
return false;
}
@@ -1332,11 +1322,10 @@ thread_db_inferior_created (inferior *inf)
from libthread_db thread state information. */
static void
-update_thread_state (thread_db_thread_info *priv,
- const td_thrinfo_t *ti_p)
+update_thread_state (thread_db_thread_info *priv, const td_thrinfo_t *ti_p)
{
- priv->dying = (ti_p->ti_state == TD_THR_UNKNOWN
- || ti_p->ti_state == TD_THR_ZOMBIE);
+ priv->dying
+ = (ti_p->ti_state == TD_THR_UNKNOWN || ti_p->ti_state == TD_THR_ZOMBIE);
}
/* Record a new thread in GDB's thread list. Creates the thread's
@@ -1344,8 +1333,7 @@ update_thread_state (thread_db_thread_info *priv,
creates a new thread. Otherwise, uses TP. */
static struct thread_info *
-record_thread (struct thread_db_info *info,
- struct thread_info *tp,
+record_thread (struct thread_db_info *info, struct thread_info *tp,
ptid_t ptid, const td_thrhandle_t *th_p,
const td_thrinfo_t *ti_p)
{
@@ -1466,7 +1454,7 @@ find_new_threads_callback (const td_thrhandle_t *th_p, void *data)
err = info->td_thr_get_info_p (th_p, &ti);
if (err != TD_OK)
- error (_("find_new_threads_callback: cannot get thread info: %s"),
+ error (_ ("find_new_threads_callback: cannot get thread info: %s"),
thread_db_err_str (err));
if (ti.ti_lid == -1)
@@ -1538,12 +1526,9 @@ find_new_threads_once (struct thread_db_info *info, int iteration,
{
/* Iterate over all user-space threads to discover new threads. */
err = info->td_ta_thr_iter_p (info->thread_agent,
- find_new_threads_callback,
- &data,
- TD_THR_ANY_STATE,
- TD_THR_LOWEST_PRIORITY,
- TD_SIGNO_MASK,
- TD_THR_ANY_USER_FLAGS);
+ find_new_threads_callback, &data,
+ TD_THR_ANY_STATE, TD_THR_LOWEST_PRIORITY,
+ TD_SIGNO_MASK, TD_THR_ANY_USER_FLAGS);
}
catch (const gdb_exception_error &except)
{
@@ -1556,8 +1541,7 @@ find_new_threads_once (struct thread_db_info *info, int iteration,
if (libthread_db_debug)
{
- gdb_printf (gdb_stdlog,
- _("Found %d new threads in iteration %d.\n"),
+ gdb_printf (gdb_stdlog, _ ("Found %d new threads in iteration %d.\n"),
data.new_threads, iteration);
}
@@ -1601,7 +1585,7 @@ thread_db_find_new_threads_2 (thread_info *stopped, bool until_no_new)
find_new_threads_once (info, 0, &err);
if (err != TD_OK)
- error (_("Cannot find new threads: %s"), thread_db_err_str (err));
+ error (_ ("Cannot find new threads: %s"), thread_db_err_str (err));
}
static void
@@ -1690,8 +1674,7 @@ thread_db_target::extra_thread_info (thread_info *info)
thread_info *
thread_db_target::thread_handle_to_thread_info (const gdb_byte *thread_handle,
- int handle_len,
- inferior *inf)
+ int handle_len, inferior *inf)
{
thread_t handle_tid;
@@ -1705,9 +1688,9 @@ thread_db_target::thread_handle_to_thread_info (const gdb_byte *thread_handle,
if (handle_len == 4 && sizeof (handle_tid) == 8)
handle_tid = (thread_t) * (const uint32_t *) thread_handle;
else if (handle_len == sizeof (handle_tid))
- handle_tid = * (const thread_t *) thread_handle;
+ handle_tid = *(const thread_t *) thread_handle;
else
- error (_("Thread handle size mismatch: %d vs %zu (from libthread_db)"),
+ error (_ ("Thread handle size mismatch: %d vs %zu (from libthread_db)"),
handle_len, sizeof (handle_tid));
for (thread_info *tp : inf->non_exited_threads ())
@@ -1743,8 +1726,7 @@ thread_db_target::thread_info_to_thread_handle (struct thread_info *tp)
is stored at OFFSET within the thread local storage for thread PTID. */
CORE_ADDR
-thread_db_target::get_thread_local_address (ptid_t ptid,
- CORE_ADDR lm,
+thread_db_target::get_thread_local_address (ptid_t ptid, CORE_ADDR lm,
CORE_ADDR offset)
{
struct thread_info *thread_info;
@@ -1770,14 +1752,14 @@ thread_db_target::get_thread_local_address (ptid_t ptid,
/* glibc doesn't provide the needed interface. */
if (!info->td_thr_tls_get_addr_p)
throw_error (TLS_NO_LIBRARY_SUPPORT_ERROR,
- _("No TLS library support"));
+ _ ("No TLS library support"));
/* Note the cast through uintptr_t: this interface only works if
a target address fits in a psaddr_t, which is a host pointer.
So a 32-bit debugger can not access 64-bit TLS through this. */
err = info->td_thr_tls_get_addr_p (&priv->th,
- (psaddr_t)(uintptr_t) lm,
- offset, &address);
+ (psaddr_t) (uintptr_t) lm, offset,
+ &address);
}
else
{
@@ -1785,7 +1767,7 @@ thread_db_target::get_thread_local_address (ptid_t ptid,
that LM is zero - normally cases it should not be. */
if (!info->td_thr_tlsbase_p)
throw_error (TLS_LOAD_MODULE_NOT_FOUND_ERROR,
- _("TLS load module not found"));
+ _ ("TLS load module not found"));
/* This code path handles the case of -static -pthread executables:
https://sourceware.org/ml/libc-help/2014-03/msg00024.html
@@ -1800,24 +1782,22 @@ thread_db_target::get_thread_local_address (ptid_t ptid,
#ifdef THREAD_DB_HAS_TD_NOTALLOC
/* The memory hasn't been allocated, yet. */
if (err == TD_NOTALLOC)
- /* Now, if libthread_db provided the initialization image's
+ /* Now, if libthread_db provided the initialization image's
address, we *could* try to build a non-lvalue value from
the initialization image. */
- throw_error (TLS_NOT_ALLOCATED_YET_ERROR,
- _("TLS not allocated yet"));
+ throw_error (TLS_NOT_ALLOCATED_YET_ERROR, _ ("TLS not allocated yet"));
#endif
/* Something else went wrong. */
if (err != TD_OK)
- throw_error (TLS_GENERIC_ERROR,
- (("%s")), thread_db_err_str (err));
+ throw_error (TLS_GENERIC_ERROR, (("%s")), thread_db_err_str (err));
/* Cast assuming host == target. Joy. */
/* Do proper sign extension for the target. */
gdb_assert (current_program_space->exec_bfd ());
return (bfd_get_sign_extend_vma (current_program_space->exec_bfd ()) > 0
- ? (CORE_ADDR) (intptr_t) address
- : (CORE_ADDR) (uintptr_t) address);
+ ? (CORE_ADDR) (intptr_t) address
+ : (CORE_ADDR) (uintptr_t) address);
}
return beneath->get_thread_local_address (ptid, lm, offset);
@@ -1838,10 +1818,9 @@ thread_db_target::resume (ptid_t ptid, int step, enum gdb_signal signo)
process_stratum_target *beneath
= as_process_stratum_target (this->beneath ());
- thread_db_info *info
- = get_thread_db_info (beneath, (ptid == minus_one_ptid
- ? inferior_ptid.pid ()
- : ptid.pid ()));
+ thread_db_info *info = get_thread_db_info (beneath, (ptid == minus_one_ptid
+ ? inferior_ptid.pid ()
+ : ptid.pid ()));
/* This workaround is only needed for child fork lwps stopped in a
PTRACE_O_TRACEFORK event. When the inferior is resumed, the
@@ -1883,7 +1862,7 @@ info_auto_load_libthread_db (const char *args, int from_tty)
cs = skip_spaces (cs);
if (*cs)
- error (_("'info auto-load libthread-db' does not accept any parameters"));
+ error (_ ("'info auto-load libthread-db' does not accept any parameters"));
std::vector<struct thread_db_info *> array;
for (info = thread_db_list; info; info = info->next)
@@ -1911,8 +1890,8 @@ info_auto_load_libthread_db (const char *args, int from_tty)
if (i == 0 || strcmp (array[i - 1]->filename, array[i]->filename) != 0)
{
unique_filenames++;
- max_filename_len = std::max (max_filename_len,
- strlen (array[i]->filename));
+ max_filename_len
+ = std::max (max_filename_len, strlen (array[i]->filename));
if (i > 0)
pids_len -= strlen (", ");
@@ -1946,8 +1925,8 @@ info_auto_load_libthread_db (const char *args, int from_tty)
file_name_style.style ());
std::string pids;
- while (i < array.size () && strcmp (info->filename,
- array[i]->filename) == 0)
+ while (i < array.size ()
+ && strcmp (info->filename, array[i]->filename) == 0)
{
if (!pids.empty ())
pids += ", ";
@@ -1962,7 +1941,7 @@ info_auto_load_libthread_db (const char *args, int from_tty)
}
if (array.empty ())
- uiout->message (_("No auto-loaded libthread-db.\n"));
+ uiout->message (_ ("No auto-loaded libthread-db.\n"));
}
/* Implement 'maintenance check libthread-db'. */
@@ -1974,17 +1953,18 @@ maintenance_check_libthread_db (const char *args, int from_tty)
struct thread_db_info *info;
if (inferior_pid == 0)
- error (_("No inferior running"));
+ error (_ ("No inferior running"));
info = get_thread_db_info (current_inferior ()->process_target (),
inferior_pid);
if (info == NULL)
- error (_("No libthread_db loaded"));
+ error (_ ("No libthread_db loaded"));
check_thread_db (info, true);
}
void _initialize_thread_db ();
+
void
_initialize_thread_db ()
{
@@ -1994,32 +1974,35 @@ _initialize_thread_db ()
and until there is a running inferior, we can't tell which
libthread_db is the correct one to load. */
- add_setshow_optional_filename_cmd ("libthread-db-search-path",
- class_support,
- &libthread_db_search_path, _("\
-Set search path for libthread_db."), _("\
-Show the current search path or libthread_db."), _("\
+ add_setshow_optional_filename_cmd ("libthread-db-search-path", class_support,
+ &libthread_db_search_path, _ ("\
+Set search path for libthread_db."),
+ _ ("\
+Show the current search path or libthread_db."),
+ _ ("\
This path is used to search for libthread_db to be loaded into \
gdb itself.\n\
Its value is a colon (':') separate list of directories to search.\n\
Setting the search path to an empty list resets it to its default value."),
- set_libthread_db_search_path,
- NULL,
- &setlist, &showlist);
+ set_libthread_db_search_path, NULL,
+ &setlist, &showlist);
add_setshow_zuinteger_cmd ("libthread-db", class_maintenance,
- &libthread_db_debug, _("\
-Set libthread-db debugging."), _("\
-Show libthread-db debugging."), _("\
+ &libthread_db_debug, _ ("\
+Set libthread-db debugging."),
+ _ ("\
+Show libthread-db debugging."),
+ _ ("\
When non-zero, libthread-db debugging is enabled."),
- NULL,
- show_libthread_db_debug,
- &setdebuglist, &showdebuglist);
-
- add_setshow_boolean_cmd ("libthread-db", class_support,
- &auto_load_thread_db, _("\
-Enable or disable auto-loading of inferior specific libthread_db."), _("\
-Show whether auto-loading inferior specific libthread_db is enabled."), _("\
+ NULL, show_libthread_db_debug, &setdebuglist,
+ &showdebuglist);
+
+ add_setshow_boolean_cmd ("libthread-db", class_support, &auto_load_thread_db,
+ _ ("\
+Enable or disable auto-loading of inferior specific libthread_db."),
+ _ ("\
+Show whether auto-loading inferior specific libthread_db is enabled."),
+ _ ("\
If enabled, libthread_db will be searched in 'set libthread-db-search-path'\n\
locations to load libthread_db compatible with the inferior.\n\
Standard system libthread_db still gets loaded even with this option off.\n\
@@ -2029,29 +2012,29 @@ This option has security implications for untrusted inferiors."),
auto_load_show_cmdlist_get ());
add_cmd ("libthread-db", class_info, info_auto_load_libthread_db,
- _("Print the list of loaded inferior specific libthread_db.\n\
+ _ ("Print the list of loaded inferior specific libthread_db.\n\
Usage: info auto-load libthread-db"),
auto_load_info_cmdlist_get ());
- add_cmd ("libthread-db", class_maintenance,
- maintenance_check_libthread_db, _("\
+ add_cmd ("libthread-db", class_maintenance, maintenance_check_libthread_db,
+ _ ("\
Run integrity checks on the current inferior's libthread_db."),
&maintenancechecklist);
- add_setshow_boolean_cmd ("check-libthread-db",
- class_maintenance,
- &check_thread_db_on_load, _("\
-Set whether to check libthread_db at load time."), _("\
-Show whether to check libthread_db at load time."), _("\
+ add_setshow_boolean_cmd ("check-libthread-db", class_maintenance,
+ &check_thread_db_on_load, _ ("\
+Set whether to check libthread_db at load time."),
+ _ ("\
+Show whether to check libthread_db at load time."),
+ _ ("\
If enabled GDB will run integrity checks on inferior specific libthread_db\n\
as they are loaded."),
- NULL,
- NULL,
- &maintenance_set_cmdlist,
+ NULL, NULL, &maintenance_set_cmdlist,
&maintenance_show_cmdlist);
/* Add ourselves to objfile event chain. */
- gdb::observers::new_objfile.attach (thread_db_new_objfile, "linux-thread-db");
+ gdb::observers::new_objfile.attach (thread_db_new_objfile,
+ "linux-thread-db");
/* Add ourselves to inferior_created event chain.
This is needed to handle debugging statically linked programs where
diff --git a/gdb/lm32-tdep.c b/gdb/lm32-tdep.c
index 5b69bd06a19..2c5637dcb67 100644
--- a/gdb/lm32-tdep.c
+++ b/gdb/lm32-tdep.c
@@ -37,11 +37,11 @@
#include "gdbarch.h"
/* Macros to extract fields from an instruction. */
-#define LM32_OPCODE(insn) ((insn >> 26) & 0x3f)
-#define LM32_REG0(insn) ((insn >> 21) & 0x1f)
-#define LM32_REG1(insn) ((insn >> 16) & 0x1f)
-#define LM32_REG2(insn) ((insn >> 11) & 0x1f)
-#define LM32_IMM16(insn) ((((long)insn & 0xffff) << 16) >> 16)
+#define LM32_OPCODE(insn) ((insn >> 26) & 0x3f)
+#define LM32_REG0(insn) ((insn >> 21) & 0x1f)
+#define LM32_REG1(insn) ((insn >> 16) & 0x1f)
+#define LM32_REG2(insn) ((insn >> 11) & 0x1f)
+#define LM32_IMM16(insn) ((((long) insn & 0xffff) << 16) >> 16)
struct lm32_gdbarch_tdep : gdbarch_tdep_base
{
@@ -67,10 +67,11 @@ lm32_register_reggroup_p (struct gdbarch *gdbarch, int regnum,
{
if (group == general_reggroup)
return ((regnum >= SIM_LM32_R0_REGNUM) && (regnum <= SIM_LM32_RA_REGNUM))
- || (regnum == SIM_LM32_PC_REGNUM);
+ || (regnum == SIM_LM32_PC_REGNUM);
else if (group == system_reggroup)
return ((regnum >= SIM_LM32_BA_REGNUM) && (regnum <= SIM_LM32_EA_REGNUM))
- || ((regnum >= SIM_LM32_EID_REGNUM) && (regnum <= SIM_LM32_IP_REGNUM));
+ || ((regnum >= SIM_LM32_EID_REGNUM)
+ && (regnum <= SIM_LM32_IP_REGNUM));
return default_register_reggroup_p (gdbarch, regnum, group);
}
@@ -79,13 +80,11 @@ lm32_register_reggroup_p (struct gdbarch *gdbarch, int regnum,
static const char *
lm32_register_name (struct gdbarch *gdbarch, int reg_nr)
{
- static const char *register_names[] = {
- "r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7",
- "r8", "r9", "r10", "r11", "r12", "r13", "r14", "r15",
- "r16", "r17", "r18", "r19", "r20", "r21", "r22", "r23",
- "r24", "r25", "gp", "fp", "sp", "ra", "ea", "ba",
- "PC", "EID", "EBA", "DEBA", "IE", "IM", "IP"
- };
+ static const char *register_names[]
+ = { "r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7", "r8", "r9",
+ "r10", "r11", "r12", "r13", "r14", "r15", "r16", "r17", "r18", "r19",
+ "r20", "r21", "r22", "r23", "r24", "r25", "gp", "fp", "sp", "ra",
+ "ea", "ba", "PC", "EID", "EBA", "DEBA", "IE", "IM", "IP" };
gdb_static_assert (ARRAY_SIZE (register_names) == SIM_LM32_NUM_REGS);
return register_names[reg_nr];
@@ -110,8 +109,7 @@ lm32_cannot_store_register (struct gdbarch *gdbarch, int regno)
/* Analyze a function's prologue. */
static CORE_ADDR
-lm32_analyze_prologue (struct gdbarch *gdbarch,
- CORE_ADDR pc, CORE_ADDR limit,
+lm32_analyze_prologue (struct gdbarch *gdbarch, CORE_ADDR pc, CORE_ADDR limit,
struct lm32_frame_cache *info)
{
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
@@ -122,7 +120,6 @@ lm32_analyze_prologue (struct gdbarch *gdbarch,
info->size = 0;
for (; pc < limit; pc += 4)
{
-
/* Read an instruction. */
instruction = read_memory_integer (pc, 4, byte_order);
@@ -132,7 +129,8 @@ lm32_analyze_prologue (struct gdbarch *gdbarch,
/* Any stack displaced store is likely part of the prologue.
Record that the register is being saved, and the offset
into the stack. */
- info->saved_regs[LM32_REG1 (instruction)].set_addr (LM32_IMM16 (instruction));
+ info->saved_regs[LM32_REG1 (instruction)].set_addr (
+ LM32_IMM16 (instruction));
}
else if ((LM32_OPCODE (instruction) == OP_ADDI)
&& (LM32_REG1 (instruction) == SIM_LM32_SP_REGNUM))
@@ -141,15 +139,15 @@ lm32_analyze_prologue (struct gdbarch *gdbarch,
Adjust stack size by whatever the instruction adds to the sp. */
info->size -= LM32_IMM16 (instruction);
}
- else if ( /* add fp,fp,sp */
- ((LM32_OPCODE (instruction) == OP_ADD)
- && (LM32_REG2 (instruction) == SIM_LM32_FP_REGNUM)
- && (LM32_REG0 (instruction) == SIM_LM32_FP_REGNUM)
- && (LM32_REG1 (instruction) == SIM_LM32_SP_REGNUM))
- /* mv fp,imm */
- || ((LM32_OPCODE (instruction) == OP_ADDI)
- && (LM32_REG1 (instruction) == SIM_LM32_FP_REGNUM)
- && (LM32_REG0 (instruction) == SIM_LM32_R0_REGNUM)))
+ else if (/* add fp,fp,sp */
+ ((LM32_OPCODE (instruction) == OP_ADD)
+ && (LM32_REG2 (instruction) == SIM_LM32_FP_REGNUM)
+ && (LM32_REG0 (instruction) == SIM_LM32_FP_REGNUM)
+ && (LM32_REG1 (instruction) == SIM_LM32_SP_REGNUM))
+ /* mv fp,imm */
+ || ((LM32_OPCODE (instruction) == OP_ADDI)
+ && (LM32_REG1 (instruction) == SIM_LM32_FP_REGNUM)
+ && (LM32_REG0 (instruction) == SIM_LM32_R0_REGNUM)))
{
/* Likely to be in the prologue for functions that require
a frame pointer. */
@@ -194,7 +192,7 @@ lm32_skip_prologue (struct gdbarch *gdbarch, CORE_ADDR pc)
that bound, then use an arbitrary large number as the upper bound. */
limit_pc = skip_prologue_using_sal (gdbarch, pc);
if (limit_pc == 0)
- limit_pc = pc + 100; /* Magic. */
+ limit_pc = pc + 100; /* Magic. */
frame_info.saved_regs = saved_regs;
return lm32_analyze_prologue (gdbarch, pc, limit_pc, &frame_info);
@@ -205,14 +203,13 @@ constexpr gdb_byte lm32_break_insn[4] = { OP_RAISE << 2, 0, 0, 2 };
typedef BP_MANIPULATION (lm32_break_insn) lm32_breakpoint;
-
/* Setup registers and stack for faking a call to a function in the
inferior. */
static CORE_ADDR
lm32_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
- struct regcache *regcache, CORE_ADDR bp_addr,
- int nargs, struct value **args, CORE_ADDR sp,
+ struct regcache *regcache, CORE_ADDR bp_addr, int nargs,
+ struct value **args, CORE_ADDR sp,
function_call_return_method return_method,
CORE_ADDR struct_addr)
{
@@ -261,8 +258,8 @@ lm32_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
/* FIXME: Handle structures. */
contents = (gdb_byte *) value_contents (arg).data ();
- val = extract_unsigned_integer (contents, arg_type->length (),
- byte_order);
+ val
+ = extract_unsigned_integer (contents, arg_type->length (), byte_order);
/* First num_arg_regs parameters are passed by registers,
and the rest are passed on the stack. */
@@ -294,8 +291,7 @@ lm32_extract_return_value (struct type *type, struct regcache *regcache,
ULONGEST l;
CORE_ADDR return_buffer;
- if (type->code () != TYPE_CODE_STRUCT
- && type->code () != TYPE_CODE_UNION
+ if (type->code () != TYPE_CODE_STRUCT && type->code () != TYPE_CODE_UNION
&& type->code () != TYPE_CODE_ARRAY && type->length () <= 4)
{
/* Return value is returned in a single register. */
@@ -344,7 +340,7 @@ lm32_store_return_value (struct type *type, struct regcache *regcache,
regcache_cooked_write_unsigned (regcache, SIM_LM32_R2_REGNUM, val);
}
else
- error (_("lm32_store_return_value: type length too large."));
+ error (_ ("lm32_store_return_value: type length too large."));
}
/* Determine whether a functions return value is in a register or memory. */
@@ -355,8 +351,7 @@ lm32_return_value (struct gdbarch *gdbarch, struct value *function,
{
enum type_code code = valtype->code ();
- if (code == TYPE_CODE_STRUCT
- || code == TYPE_CODE_UNION
+ if (code == TYPE_CODE_STRUCT || code == TYPE_CODE_UNION
|| code == TYPE_CODE_ARRAY || valtype->length () > 8)
return RETURN_VALUE_STRUCT_CONVENTION;
@@ -392,8 +387,8 @@ lm32_frame_cache (frame_info_ptr this_frame, void **this_prologue_cache)
info->pc = get_frame_func (this_frame);
current_pc = get_frame_pc (this_frame);
- lm32_analyze_prologue (get_frame_arch (this_frame),
- info->pc, current_pc, info);
+ lm32_analyze_prologue (get_frame_arch (this_frame), info->pc, current_pc,
+ info);
/* Compute the frame's base, and the previous frame's SP. */
this_base = get_frame_register_unsigned (this_frame, SIM_LM32_SP_REGNUM);
@@ -443,15 +438,14 @@ lm32_frame_prev_register (frame_info_ptr this_frame,
return trad_frame_get_prev_register (this_frame, info->saved_regs, regnum);
}
-static const struct frame_unwind lm32_frame_unwind = {
- "lm32 prologue",
- NORMAL_FRAME,
- default_frame_unwind_stop_reason,
- lm32_frame_this_id,
- lm32_frame_prev_register,
- NULL,
- default_frame_sniffer
-};
+static const struct frame_unwind lm32_frame_unwind
+ = { "lm32 prologue",
+ NORMAL_FRAME,
+ default_frame_unwind_stop_reason,
+ lm32_frame_this_id,
+ lm32_frame_prev_register,
+ NULL,
+ default_frame_sniffer };
static CORE_ADDR
lm32_frame_base_address (frame_info_ptr this_frame, void **this_cache)
@@ -461,12 +455,9 @@ lm32_frame_base_address (frame_info_ptr this_frame, void **this_cache)
return info->base;
}
-static const struct frame_base lm32_frame_base = {
- &lm32_frame_unwind,
- lm32_frame_base_address,
- lm32_frame_base_address,
- lm32_frame_base_address
-};
+static const struct frame_base lm32_frame_base
+ = { &lm32_frame_unwind, lm32_frame_base_address, lm32_frame_base_address,
+ lm32_frame_base_address };
static CORE_ADDR
lm32_frame_align (struct gdbarch *gdbarch, CORE_ADDR sp)
@@ -532,6 +523,7 @@ lm32_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
}
void _initialize_lm32_tdep ();
+
void
_initialize_lm32_tdep ()
{
diff --git a/gdb/location.c b/gdb/location.c
index 236bf3bb6f8..73ba5977261 100644
--- a/gdb/location.c
+++ b/gdb/location.c
@@ -31,8 +31,8 @@
#include <string.h>
static std::string
- explicit_to_string_internal (bool as_linespec,
- const explicit_location_spec *explicit_loc);
+explicit_to_string_internal (bool as_linespec,
+ const explicit_location_spec *explicit_loc);
/* Return a xstrdup of STR if not NULL, otherwise return NULL. */
@@ -59,14 +59,15 @@ probe_location_spec::empty_p () const
return false;
}
-std::string probe_location_spec::compute_string () const
+std::string
+probe_location_spec::compute_string () const
{
return std::move (m_as_string);
}
/* A "normal" linespec. */
-linespec_location_spec::linespec_location_spec
- (const char **linespec, symbol_name_match_type match_type_)
+linespec_location_spec::linespec_location_spec (
+ const char **linespec, symbol_name_match_type match_type_)
: location_spec (LINESPEC_LOCATION_SPEC),
match_type (match_type_)
{
@@ -104,8 +105,8 @@ linespec_location_spec::empty_p () const
return false;
}
-linespec_location_spec::linespec_location_spec
- (const linespec_location_spec &other)
+linespec_location_spec::linespec_location_spec (
+ const linespec_location_spec &other)
: location_spec (other),
match_type (other.match_type),
spec_string (maybe_xstrdup (other.spec_string))
@@ -147,8 +148,8 @@ address_location_spec::empty_p () const
return false;
}
-address_location_spec::address_location_spec
- (const address_location_spec &other)
+address_location_spec::address_location_spec (
+ const address_location_spec &other)
: location_spec (other),
address (other.address)
{
@@ -173,8 +174,8 @@ explicit_location_spec::~explicit_location_spec ()
xfree (label_name);
}
-explicit_location_spec::explicit_location_spec
- (const explicit_location_spec &other)
+explicit_location_spec::explicit_location_spec (
+ const explicit_location_spec &other)
: location_spec (other),
source_filename (maybe_xstrdup (other.source_filename)),
function_name (maybe_xstrdup (other.function_name)),
@@ -193,10 +194,8 @@ explicit_location_spec::clone () const
bool
explicit_location_spec::empty_p () const
{
- return (source_filename == nullptr
- && function_name == nullptr
- && label_name == nullptr
- && line_offset.sign == LINE_OFFSET_UNKNOWN);
+ return (source_filename == nullptr && function_name == nullptr
+ && label_name == nullptr && line_offset.sign == LINE_OFFSET_UNKNOWN);
}
std::string
@@ -211,8 +210,7 @@ location_spec_up
new_linespec_location_spec (const char **linespec,
symbol_name_match_type match_type)
{
- return location_spec_up (new linespec_location_spec (linespec,
- match_type));
+ return location_spec_up (new linespec_location_spec (linespec, match_type));
}
/* See description in location.h. */
@@ -328,11 +326,12 @@ explicit_to_string_internal (bool as_linespec,
buf.putc (space);
if (!as_linespec)
buf.puts ("-line ");
- buf.printf ("%s%d",
- (explicit_loc->line_offset.sign == LINE_OFFSET_NONE ? ""
- : (explicit_loc->line_offset.sign
- == LINE_OFFSET_PLUS ? "+" : "-")),
- explicit_loc->line_offset.offset);
+ buf.printf (
+ "%s%d",
+ (explicit_loc->line_offset.sign == LINE_OFFSET_NONE
+ ? ""
+ : (explicit_loc->line_offset.sign == LINE_OFFSET_PLUS ? "+" : "-")),
+ explicit_loc->line_offset.offset);
}
return buf.release ();
@@ -401,7 +400,7 @@ explicit_location_spec_lex_one (const char **inp,
if (end == NULL)
{
if (completion_info == NULL)
- error (_("Unmatched quote, %s."), start);
+ error (_ ("Unmatched quote, %s."), start);
end = start + strlen (start);
*inp = end;
@@ -435,8 +434,7 @@ explicit_location_spec_lex_one (const char **inp,
/* Otherwise stop at the next occurrence of whitespace, '\0',
keyword, or ','. */
*inp = start;
- while ((*inp)[0]
- && (*inp)[0] != ','
+ while ((*inp)[0] && (*inp)[0] != ','
&& !(isspace ((*inp)[0])
|| linespec_lexer_lex_keyword (&(*inp)[1])))
{
@@ -461,8 +459,7 @@ explicit_location_spec_lex_one (const char **inp,
static bool
is_cp_operator (const char *start, const char *comma)
{
- if (comma != NULL
- && (comma - start) >= CP_OPERATOR_LEN)
+ if (comma != NULL && (comma - start) >= CP_OPERATOR_LEN)
{
const char *p = comma;
@@ -472,8 +469,7 @@ is_cp_operator (const char *start, const char *comma)
{
p -= CP_OPERATOR_LEN;
if (strncmp (p, CP_OPERATOR_STR, CP_OPERATOR_LEN) == 0
- && (p == start
- || !(isalnum (p[-1]) || p[-1] == '_')))
+ && (p == start || !(isalnum (p[-1]) || p[-1] == '_')))
{
return true;
}
@@ -532,10 +528,9 @@ first_of (const char *first, const char *new_tok)
lexing was done. */
static gdb::unique_xmalloc_ptr<char>
-explicit_location_spec_lex_one_function
- (const char **inp,
- const struct language_defn *language,
- explicit_completion_info *completion_info)
+explicit_location_spec_lex_one_function (
+ const char **inp, const struct language_defn *language,
+ explicit_completion_info *completion_info)
{
const char *start = *inp;
@@ -549,8 +544,8 @@ explicit_location_spec_lex_one_function
/* If the input is not an Ada operator, skip to the matching
closing quote and return the string. */
- if (!(language->la_language == language_ada
- && quote_char == '\"' && is_ada_operator (start)))
+ if (!(language->la_language == language_ada && quote_char == '\"'
+ && is_ada_operator (start)))
{
if (completion_info != NULL)
completion_info->quoted_arg_start = start;
@@ -560,7 +555,7 @@ explicit_location_spec_lex_one_function
if (end == NULL)
{
if (completion_info == NULL)
- error (_("Unmatched quote, %s."), start);
+ error (_ ("Unmatched quote, %s."), start);
end = start + strlen (start);
*inp = end;
@@ -584,10 +579,8 @@ explicit_location_spec_lex_one_function
it is an hyphen. Don't skip the first char always, because we
may have C++ "operator<", and find_toplevel_char needs to see the
'o' in that case. */
- const char *hyphen
- = (*start == '-'
- ? find_toplevel_char (start + 1, '-')
- : find_toplevel_char (start, '-'));
+ const char *hyphen = (*start == '-' ? find_toplevel_char (start + 1, '-')
+ : find_toplevel_char (start, '-'));
/* Check for C++ "operator," and "operator-". */
comma = skip_op_false_positives (start, comma);
@@ -633,15 +626,12 @@ string_to_explicit_location_spec (const char **argp,
/* It is assumed that input beginning with '-' and a non-digit
character is an explicit location. "-p" is reserved, though,
for probe locations. */
- if (argp == NULL
- || *argp == NULL
- || *argp[0] != '-'
- || !isalpha ((*argp)[1])
+ if (argp == NULL || *argp == NULL || *argp[0] != '-' || !isalpha ((*argp)[1])
|| ((*argp)[0] == '-' && (*argp)[1] == 'p'))
return NULL;
- std::unique_ptr<explicit_location_spec> locspec
- (new explicit_location_spec ());
+ std::unique_ptr<explicit_location_spec> locspec (
+ new explicit_location_spec ());
/* Process option/argument pairs. dprintf_command
requires that processing stop on ','. */
@@ -692,19 +682,18 @@ string_to_explicit_location_spec (const char **argp,
/* Convenience to consistently set both OARG/HAVE_OARG from
ARG. */
- auto set_oarg = [&] (gdb::unique_xmalloc_ptr<char> arg)
- {
- if (completion_info != NULL)
- {
- /* We do this here because the set of options that take
+ auto set_oarg = [&] (gdb::unique_xmalloc_ptr<char> arg) {
+ if (completion_info != NULL)
+ {
+ /* We do this here because the set of options that take
arguments matches the set of explicit location
options. */
- completion_info->saw_explicit_location_spec_option = true;
- }
- oarg = std::move (arg);
- have_oarg = oarg != NULL;
- need_oarg = true;
- };
+ completion_info->saw_explicit_location_spec_option = true;
+ }
+ oarg = std::move (arg);
+ have_oarg = oarg != NULL;
+ need_oarg = true;
+ };
if (strncmp (opt.get (), "-source", len) == 0)
{
@@ -743,7 +732,8 @@ string_to_explicit_location_spec (const char **argp,
else if (opt.get ()[0] == '-' && !isdigit (opt.get ()[1]))
{
if (completion_info == NULL)
- error (_("invalid explicit location argument, \"%s\""), opt.get ());
+ error (_ ("invalid explicit location argument, \"%s\""),
+ opt.get ());
}
else
{
@@ -761,19 +751,18 @@ string_to_explicit_location_spec (const char **argp,
the "invalid argument" error before any missing
argument error. */
if (need_oarg && !have_oarg && completion_info == NULL)
- error (_("missing argument for \"%s\""), opt.get ());
+ error (_ ("missing argument for \"%s\""), opt.get ());
}
/* One special error check: If a source filename was given
without offset, function, or label, issue an error. */
- if (locspec->source_filename != NULL
- && locspec->function_name == NULL
+ if (locspec->source_filename != NULL && locspec->function_name == NULL
&& locspec->label_name == NULL
&& (locspec->line_offset.sign == LINE_OFFSET_UNKNOWN)
&& completion_info == NULL)
{
- error (_("Source filename requires function, label, or "
- "line offset."));
+ error (_ ("Source filename requires function, label, or "
+ "line offset."));
}
return location_spec_up (locspec.release ());
diff --git a/gdb/location.h b/gdb/location.h
index c2083ae7fc7..2e2ebaf253b 100644
--- a/gdb/location.h
+++ b/gdb/location.h
@@ -99,16 +99,10 @@ struct location_spec
}
/* Set this location spec's string representation. */
- void set_string (std::string &&string)
- {
- m_as_string = std::move (string);
- }
+ void set_string (std::string &&string) { m_as_string = std::move (string); }
/* Return this location spec's type. */
- enum location_spec_type type () const
- {
- return m_type;
- }
+ enum location_spec_type type () const { return m_type; }
protected:
@@ -138,6 +132,7 @@ protected:
mutable std::string m_as_string;
private:
+
/* The type of this location specification. */
enum location_spec_type m_type;
};
@@ -162,6 +157,7 @@ struct linespec_location_spec : public location_spec
char *spec_string = nullptr;
protected:
+
linespec_location_spec (const linespec_location_spec &other);
std::string compute_string () const override;
@@ -180,6 +176,7 @@ struct address_location_spec : public location_spec
CORE_ADDR address;
protected:
+
address_location_spec (const address_location_spec &other);
std::string compute_string () const override;
@@ -212,8 +209,7 @@ struct explicit_location_spec : public location_spec
char *function_name = nullptr;
/* Whether the function name is fully-qualified or not. */
- symbol_name_match_type func_name_match_type
- = symbol_name_match_type::WILD;
+ symbol_name_match_type func_name_match_type = symbol_name_match_type::WILD;
/* The name of a label. Malloc'd. */
char *label_name = nullptr;
@@ -224,6 +220,7 @@ struct explicit_location_spec : public location_spec
struct line_offset line_offset;
protected:
+
explicit_location_spec (const explicit_location_spec &other);
std::string compute_string () const override;
@@ -239,6 +236,7 @@ struct probe_location_spec : public location_spec
bool empty_p () const override;
protected:
+
probe_location_spec (const probe_location_spec &other) = default;
std::string compute_string () const override;
@@ -246,14 +244,15 @@ protected:
/* Create a new linespec location spec. */
-extern location_spec_up new_linespec_location_spec
- (const char **linespec, symbol_name_match_type match_type);
+extern location_spec_up
+new_linespec_location_spec (const char **linespec,
+ symbol_name_match_type match_type);
/* Return the given location_spec as a linespec_location_spec.
LOCSPEC must be of type LINESPEC_LOCATION_SPEC. */
extern const linespec_location_spec *
- as_linespec_location_spec (const location_spec *locspec);
+as_linespec_location_spec (const location_spec *locspec);
/* Create a new address location spec.
ADDR is the address corresponding to this location_spec.
@@ -268,7 +267,7 @@ extern location_spec_up new_address_location_spec (CORE_ADDR addr,
LOCSPEC must be of type ADDRESS_LOCATION_SPEC. */
const address_location_spec *
- as_address_location_spec (const location_spec *locspec);
+as_address_location_spec (const location_spec *locspec);
/* Create a new probe location. */
@@ -278,7 +277,7 @@ extern location_spec_up new_probe_location_spec (std::string &&probe);
cast to probe_location_spec. */
const probe_location_spec *
- as_probe_location_spec (const location_spec *locspec);
+as_probe_location_spec (const location_spec *locspec);
/* Create a new explicit location with explicit FUNCTION_NAME. All
other fields are defaulted. */
@@ -286,8 +285,7 @@ const probe_location_spec *
static inline location_spec_up
new_explicit_location_spec_function (const char *function_name)
{
- explicit_location_spec *spec
- = new explicit_location_spec ();
+ explicit_location_spec *spec = new explicit_location_spec ();
spec->function_name
= (function_name != nullptr ? xstrdup (function_name) : nullptr);
return location_spec_up (spec);
@@ -297,9 +295,8 @@ new_explicit_location_spec_function (const char *function_name)
cast to explicit_location_spec. */
const explicit_location_spec *
- as_explicit_location_spec (const location_spec *locspec);
-explicit_location_spec *
- as_explicit_location_spec (location_spec *locspec);
+as_explicit_location_spec (const location_spec *locspec);
+explicit_location_spec *as_explicit_location_spec (location_spec *locspec);
/* Attempt to convert the input string in *ARGP into a location_spec.
ARGP is advanced past any processed input. Always returns a non-nullptr
@@ -317,18 +314,18 @@ explicit_location_spec *
MATCH_TYPE should be either WILD or FULL. If -q/--qualified is specified
in the input string, it will take precedence over this parameter. */
-extern location_spec_up string_to_location_spec
- (const char **argp, const struct language_defn *language,
- symbol_name_match_type match_type = symbol_name_match_type::WILD);
+extern location_spec_up string_to_location_spec (
+ const char **argp, const struct language_defn *language,
+ symbol_name_match_type match_type = symbol_name_match_type::WILD);
/* Like string_to_location_spec, but does not attempt to parse
explicit location specs. MATCH_TYPE indicates how function names
should be matched. */
extern location_spec_up
- string_to_location_spec_basic (const char **argp,
- const struct language_defn *language,
- symbol_name_match_type match_type);
+string_to_location_spec_basic (const char **argp,
+ const struct language_defn *language,
+ symbol_name_match_type match_type);
/* Structure filled in by string_to_explicit_location_spec to aid the
completer. */
@@ -363,8 +360,8 @@ struct explicit_completion_info
is not NULL, this function will not throw any exceptions. */
extern location_spec_up
- string_to_explicit_location_spec (const char **argp,
- const struct language_defn *language,
- explicit_completion_info *completion_info);
+string_to_explicit_location_spec (const char **argp,
+ const struct language_defn *language,
+ explicit_completion_info *completion_info);
#endif /* LOCATION_H */
diff --git a/gdb/loongarch-linux-nat.c b/gdb/loongarch-linux-nat.c
index 5eb32b0a52a..2fa335a6108 100644
--- a/gdb/loongarch-linux-nat.c
+++ b/gdb/loongarch-linux-nat.c
@@ -34,11 +34,13 @@
class loongarch_linux_nat_target final : public linux_nat_trad_target
{
public:
+
/* Add our register access methods. */
void fetch_registers (struct regcache *, int) override;
void store_registers (struct regcache *, int) override;
protected:
+
/* Override linux_nat_trad_target methods. */
CORE_ADDR register_u_offset (struct gdbarch *gdbarch, int regnum,
int store_p) override;
@@ -53,21 +55,20 @@ fetch_gregs_from_thread (struct regcache *regcache, int regnum, pid_t tid)
elf_gregset_t regset;
if (regnum == -1 || (regnum >= 0 && regnum < 32)
- || regnum == LOONGARCH_ORIG_A0_REGNUM
- || regnum == LOONGARCH_PC_REGNUM
+ || regnum == LOONGARCH_ORIG_A0_REGNUM || regnum == LOONGARCH_PC_REGNUM
|| regnum == LOONGARCH_BADV_REGNUM)
- {
- struct iovec iov;
-
- iov.iov_base = &regset;
- iov.iov_len = sizeof (regset);
-
- if (ptrace (PTRACE_GETREGSET, tid, NT_PRSTATUS, (long) &iov) < 0)
- perror_with_name (_("Couldn't get NT_PRSTATUS registers"));
- else
- loongarch_gregset.supply_regset (nullptr, regcache, regnum,
- &regset, sizeof (regset));
- }
+ {
+ struct iovec iov;
+
+ iov.iov_base = &regset;
+ iov.iov_len = sizeof (regset);
+
+ if (ptrace (PTRACE_GETREGSET, tid, NT_PRSTATUS, (long) &iov) < 0)
+ perror_with_name (_ ("Couldn't get NT_PRSTATUS registers"));
+ else
+ loongarch_gregset.supply_regset (nullptr, regcache, regnum, &regset,
+ sizeof (regset));
+ }
}
/* Store to the current thread the valid general-purpose, orig_a0, pc and badv
@@ -79,25 +80,24 @@ store_gregs_to_thread (struct regcache *regcache, int regnum, pid_t tid)
elf_gregset_t regset;
if (regnum == -1 || (regnum >= 0 && regnum < 32)
- || regnum == LOONGARCH_ORIG_A0_REGNUM
- || regnum == LOONGARCH_PC_REGNUM
+ || regnum == LOONGARCH_ORIG_A0_REGNUM || regnum == LOONGARCH_PC_REGNUM
|| regnum == LOONGARCH_BADV_REGNUM)
- {
- struct iovec iov;
-
- iov.iov_base = &regset;
- iov.iov_len = sizeof (regset);
-
- if (ptrace (PTRACE_GETREGSET, tid, NT_PRSTATUS, (long) &iov) < 0)
- perror_with_name (_("Couldn't get NT_PRSTATUS registers"));
- else
- {
- loongarch_gregset.collect_regset (nullptr, regcache, regnum,
- &regset, sizeof (regset));
- if (ptrace (PTRACE_SETREGSET, tid, NT_PRSTATUS, (long) &iov) < 0)
- perror_with_name (_("Couldn't set NT_PRSTATUS registers"));
- }
- }
+ {
+ struct iovec iov;
+
+ iov.iov_base = &regset;
+ iov.iov_len = sizeof (regset);
+
+ if (ptrace (PTRACE_GETREGSET, tid, NT_PRSTATUS, (long) &iov) < 0)
+ perror_with_name (_ ("Couldn't get NT_PRSTATUS registers"));
+ else
+ {
+ loongarch_gregset.collect_regset (nullptr, regcache, regnum, &regset,
+ sizeof (regset));
+ if (ptrace (PTRACE_SETREGSET, tid, NT_PRSTATUS, (long) &iov) < 0)
+ perror_with_name (_ ("Couldn't set NT_PRSTATUS registers"));
+ }
+ }
}
/* Fill GDB's register array with the fp, fcc and fcsr
@@ -109,15 +109,16 @@ fetch_fpregs_from_thread (struct regcache *regcache, int regnum, pid_t tid)
elf_fpregset_t regset;
if ((regnum == -1)
- || (regnum >= LOONGARCH_FIRST_FP_REGNUM && regnum <= LOONGARCH_FCSR_REGNUM))
+ || (regnum >= LOONGARCH_FIRST_FP_REGNUM
+ && regnum <= LOONGARCH_FCSR_REGNUM))
{
struct iovec iovec = { .iov_base = &regset, .iov_len = sizeof (regset) };
if (ptrace (PTRACE_GETREGSET, tid, NT_FPREGSET, (long) &iovec) < 0)
- perror_with_name (_("Couldn't get NT_FPREGSET registers"));
+ perror_with_name (_ ("Couldn't get NT_FPREGSET registers"));
else
- loongarch_fpregset.supply_regset (nullptr, regcache, regnum,
- &regset, sizeof (regset));
+ loongarch_fpregset.supply_regset (nullptr, regcache, regnum, &regset,
+ sizeof (regset));
}
}
@@ -130,18 +131,19 @@ store_fpregs_to_thread (struct regcache *regcache, int regnum, pid_t tid)
elf_fpregset_t regset;
if ((regnum == -1)
- || (regnum >= LOONGARCH_FIRST_FP_REGNUM && regnum <= LOONGARCH_FCSR_REGNUM))
+ || (regnum >= LOONGARCH_FIRST_FP_REGNUM
+ && regnum <= LOONGARCH_FCSR_REGNUM))
{
struct iovec iovec = { .iov_base = &regset, .iov_len = sizeof (regset) };
if (ptrace (PTRACE_GETREGSET, tid, NT_FPREGSET, (long) &iovec) < 0)
- perror_with_name (_("Couldn't get NT_FPREGSET registers"));
+ perror_with_name (_ ("Couldn't get NT_FPREGSET registers"));
else
{
loongarch_fpregset.collect_regset (nullptr, regcache, regnum,
&regset, sizeof (regset));
if (ptrace (PTRACE_SETREGSET, tid, NT_FPREGSET, (long) &iovec) < 0)
- perror_with_name (_("Couldn't set NT_FPREGSET registers"));
+ perror_with_name (_ ("Couldn't set NT_FPREGSET registers"));
}
}
}
@@ -154,8 +156,8 @@ loongarch_linux_nat_target::fetch_registers (struct regcache *regcache,
{
pid_t tid = get_ptrace_pid (regcache->ptid ());
- fetch_gregs_from_thread(regcache, regnum, tid);
- fetch_fpregs_from_thread(regcache, regnum, tid);
+ fetch_gregs_from_thread (regcache, regnum, tid);
+ fetch_fpregs_from_thread (regcache, regnum, tid);
}
/* Implement the "store_registers" target_ops method. */
@@ -167,7 +169,7 @@ loongarch_linux_nat_target::store_registers (struct regcache *regcache,
pid_t tid = get_ptrace_pid (regcache->ptid ());
store_gregs_to_thread (regcache, regnum, tid);
- store_fpregs_to_thread(regcache, regnum, tid);
+ store_fpregs_to_thread (regcache, regnum, tid);
}
/* Return the address in the core dump or inferior of register REGNO. */
@@ -221,6 +223,7 @@ fill_fpregset (const struct regcache *regcache, gdb_fpregset_t *fpregset,
/* Initialize LoongArch Linux native support. */
void _initialize_loongarch_linux_nat ();
+
void
_initialize_loongarch_linux_nat ()
{
diff --git a/gdb/loongarch-linux-tdep.c b/gdb/loongarch-linux-tdep.c
index a09e3a990e9..b7b00ae1299 100644
--- a/gdb/loongarch-linux-tdep.c
+++ b/gdb/loongarch-linux-tdep.c
@@ -44,27 +44,25 @@ loongarch_supply_gregset (const struct regset *regset,
for (int i = 1; i < 32; i++)
{
- buf = (const gdb_byte*) gprs + regsize * i;
+ buf = (const gdb_byte *) gprs + regsize * i;
regcache->raw_supply (i, (const void *) buf);
}
- buf = (const gdb_byte*) gprs + regsize * LOONGARCH_ORIG_A0_REGNUM;
+ buf = (const gdb_byte *) gprs + regsize * LOONGARCH_ORIG_A0_REGNUM;
regcache->raw_supply (LOONGARCH_ORIG_A0_REGNUM, (const void *) buf);
- buf = (const gdb_byte*) gprs + regsize * LOONGARCH_PC_REGNUM;
+ buf = (const gdb_byte *) gprs + regsize * LOONGARCH_PC_REGNUM;
regcache->raw_supply (LOONGARCH_PC_REGNUM, (const void *) buf);
- buf = (const gdb_byte*) gprs + regsize * LOONGARCH_BADV_REGNUM;
+ buf = (const gdb_byte *) gprs + regsize * LOONGARCH_BADV_REGNUM;
regcache->raw_supply (LOONGARCH_BADV_REGNUM, (const void *) buf);
}
else if (regnum == 0)
regcache->raw_supply_zeroed (0);
- else if ((regnum > 0 && regnum < 32)
- || regnum == LOONGARCH_ORIG_A0_REGNUM
- || regnum == LOONGARCH_PC_REGNUM
- || regnum == LOONGARCH_BADV_REGNUM)
+ else if ((regnum > 0 && regnum < 32) || regnum == LOONGARCH_ORIG_A0_REGNUM
+ || regnum == LOONGARCH_PC_REGNUM || regnum == LOONGARCH_BADV_REGNUM)
{
- buf = (const gdb_byte*) gprs + regsize * regnum;
+ buf = (const gdb_byte *) gprs + regsize * regnum;
regcache->raw_supply (regnum, (const void *) buf);
}
}
@@ -96,10 +94,8 @@ loongarch_fill_gregset (const struct regset *regset,
buf = (gdb_byte *) gprs + regsize * LOONGARCH_BADV_REGNUM;
regcache->raw_collect (LOONGARCH_BADV_REGNUM, (void *) buf);
}
- else if ((regnum >= 0 && regnum < 32)
- || regnum == LOONGARCH_ORIG_A0_REGNUM
- || regnum == LOONGARCH_PC_REGNUM
- || regnum == LOONGARCH_BADV_REGNUM)
+ else if ((regnum >= 0 && regnum < 32) || regnum == LOONGARCH_ORIG_A0_REGNUM
+ || regnum == LOONGARCH_PC_REGNUM || regnum == LOONGARCH_BADV_REGNUM)
{
buf = (gdb_byte *) gprs + regsize * regnum;
regcache->raw_collect (regnum, (void *) buf);
@@ -108,8 +104,7 @@ loongarch_fill_gregset (const struct regset *regset,
/* Define the general register regset. */
-const struct regset loongarch_gregset =
-{
+const struct regset loongarch_gregset = {
nullptr,
loongarch_supply_gregset,
loongarch_fill_gregset,
@@ -117,9 +112,8 @@ const struct regset loongarch_gregset =
/* Unpack an elf_fpregset_t into GDB's register cache. */
static void
-loongarch_supply_fpregset (const struct regset *r,
- struct regcache *regcache, int regnum,
- const void *fprs, size_t len)
+loongarch_supply_fpregset (const struct regset *r, struct regcache *regcache,
+ int regnum, const void *fprs, size_t len)
{
const gdb_byte *buf = nullptr;
int fprsize = register_size (regcache->arch (), LOONGARCH_FIRST_FP_REGNUM);
@@ -129,35 +123,40 @@ loongarch_supply_fpregset (const struct regset *r,
{
for (int i = 0; i < LOONGARCH_LINUX_NUM_FPREGSET; i++)
{
- buf = (const gdb_byte *)fprs + fprsize * i;
- regcache->raw_supply (LOONGARCH_FIRST_FP_REGNUM + i, (const void *)buf);
+ buf = (const gdb_byte *) fprs + fprsize * i;
+ regcache->raw_supply (LOONGARCH_FIRST_FP_REGNUM + i,
+ (const void *) buf);
}
for (int i = 0; i < LOONGARCH_LINUX_NUM_FCC; i++)
{
- buf = (const gdb_byte *)fprs + fprsize * LOONGARCH_LINUX_NUM_FPREGSET +
- fccsize * i;
- regcache->raw_supply (LOONGARCH_FIRST_FCC_REGNUM + i, (const void *)buf);
+ buf = (const gdb_byte *) fprs
+ + fprsize * LOONGARCH_LINUX_NUM_FPREGSET + fccsize * i;
+ regcache->raw_supply (LOONGARCH_FIRST_FCC_REGNUM + i,
+ (const void *) buf);
}
- buf = (const gdb_byte *)fprs + fprsize * LOONGARCH_LINUX_NUM_FPREGSET +
- fccsize * LOONGARCH_LINUX_NUM_FCC;
- regcache->raw_supply (LOONGARCH_FCSR_REGNUM, (const void *)buf);
+ buf = (const gdb_byte *) fprs + fprsize * LOONGARCH_LINUX_NUM_FPREGSET
+ + fccsize * LOONGARCH_LINUX_NUM_FCC;
+ regcache->raw_supply (LOONGARCH_FCSR_REGNUM, (const void *) buf);
}
- else if (regnum >= LOONGARCH_FIRST_FP_REGNUM && regnum < LOONGARCH_FIRST_FCC_REGNUM)
+ else if (regnum >= LOONGARCH_FIRST_FP_REGNUM
+ && regnum < LOONGARCH_FIRST_FCC_REGNUM)
{
- buf = (const gdb_byte *)fprs + fprsize * (regnum - LOONGARCH_FIRST_FP_REGNUM);
- regcache->raw_supply (regnum, (const void *)buf);
+ buf = (const gdb_byte *) fprs
+ + fprsize * (regnum - LOONGARCH_FIRST_FP_REGNUM);
+ regcache->raw_supply (regnum, (const void *) buf);
}
- else if (regnum >= LOONGARCH_FIRST_FCC_REGNUM && regnum < LOONGARCH_FCSR_REGNUM)
+ else if (regnum >= LOONGARCH_FIRST_FCC_REGNUM
+ && regnum < LOONGARCH_FCSR_REGNUM)
{
- buf = (const gdb_byte *)fprs + fprsize * LOONGARCH_LINUX_NUM_FPREGSET +
- fccsize * (regnum - LOONGARCH_FIRST_FCC_REGNUM);
- regcache->raw_supply (regnum, (const void *)buf);
+ buf = (const gdb_byte *) fprs + fprsize * LOONGARCH_LINUX_NUM_FPREGSET
+ + fccsize * (regnum - LOONGARCH_FIRST_FCC_REGNUM);
+ regcache->raw_supply (regnum, (const void *) buf);
}
else if (regnum == LOONGARCH_FCSR_REGNUM)
{
- buf = (const gdb_byte *)fprs + fprsize * LOONGARCH_LINUX_NUM_FPREGSET +
- fccsize * LOONGARCH_LINUX_NUM_FCC;
- regcache->raw_supply (regnum, (const void *)buf);
+ buf = (const gdb_byte *) fprs + fprsize * LOONGARCH_LINUX_NUM_FPREGSET
+ + fccsize * LOONGARCH_LINUX_NUM_FCC;
+ regcache->raw_supply (regnum, (const void *) buf);
}
}
@@ -175,41 +174,42 @@ loongarch_fill_fpregset (const struct regset *r,
{
for (int i = 0; i < LOONGARCH_LINUX_NUM_FPREGSET; i++)
{
- buf = (gdb_byte *)fprs + fprsize * i;
- regcache->raw_collect (LOONGARCH_FIRST_FP_REGNUM + i, (void *)buf);
+ buf = (gdb_byte *) fprs + fprsize * i;
+ regcache->raw_collect (LOONGARCH_FIRST_FP_REGNUM + i, (void *) buf);
}
for (int i = 0; i < LOONGARCH_LINUX_NUM_FCC; i++)
{
- buf = (gdb_byte *)fprs + fprsize * LOONGARCH_LINUX_NUM_FPREGSET +
- fccsize * i;
- regcache->raw_collect (LOONGARCH_FIRST_FCC_REGNUM + i, (void *)buf);
+ buf = (gdb_byte *) fprs + fprsize * LOONGARCH_LINUX_NUM_FPREGSET
+ + fccsize * i;
+ regcache->raw_collect (LOONGARCH_FIRST_FCC_REGNUM + i, (void *) buf);
}
- buf = (gdb_byte *)fprs + fprsize * LOONGARCH_LINUX_NUM_FPREGSET +
- fccsize * LOONGARCH_LINUX_NUM_FCC;
- regcache->raw_collect (LOONGARCH_FCSR_REGNUM, (void *)buf);
+ buf = (gdb_byte *) fprs + fprsize * LOONGARCH_LINUX_NUM_FPREGSET
+ + fccsize * LOONGARCH_LINUX_NUM_FCC;
+ regcache->raw_collect (LOONGARCH_FCSR_REGNUM, (void *) buf);
}
- else if (regnum >= LOONGARCH_FIRST_FP_REGNUM && regnum < LOONGARCH_FIRST_FCC_REGNUM)
+ else if (regnum >= LOONGARCH_FIRST_FP_REGNUM
+ && regnum < LOONGARCH_FIRST_FCC_REGNUM)
{
- buf = (gdb_byte *)fprs + fprsize * (regnum - LOONGARCH_FIRST_FP_REGNUM);
- regcache->raw_collect (regnum, (void *)buf);
+ buf = (gdb_byte *) fprs + fprsize * (regnum - LOONGARCH_FIRST_FP_REGNUM);
+ regcache->raw_collect (regnum, (void *) buf);
}
- else if (regnum >= LOONGARCH_FIRST_FCC_REGNUM && regnum < LOONGARCH_FCSR_REGNUM)
+ else if (regnum >= LOONGARCH_FIRST_FCC_REGNUM
+ && regnum < LOONGARCH_FCSR_REGNUM)
{
- buf = (gdb_byte *)fprs + fprsize * LOONGARCH_LINUX_NUM_FPREGSET +
- fccsize * (regnum - LOONGARCH_FIRST_FCC_REGNUM);
- regcache->raw_collect (regnum, (void *)buf);
+ buf = (gdb_byte *) fprs + fprsize * LOONGARCH_LINUX_NUM_FPREGSET
+ + fccsize * (regnum - LOONGARCH_FIRST_FCC_REGNUM);
+ regcache->raw_collect (regnum, (void *) buf);
}
else if (regnum == LOONGARCH_FCSR_REGNUM)
{
- buf = (gdb_byte *)fprs + fprsize * LOONGARCH_LINUX_NUM_FPREGSET +
- fccsize * LOONGARCH_LINUX_NUM_FCC;
- regcache->raw_collect (regnum, (void *)buf);
+ buf = (gdb_byte *) fprs + fprsize * LOONGARCH_LINUX_NUM_FPREGSET
+ + fccsize * LOONGARCH_LINUX_NUM_FCC;
+ regcache->raw_collect (regnum, (void *) buf);
}
}
/* Define the FP register regset. */
-const struct regset loongarch_fpregset =
-{
+const struct regset loongarch_fpregset = {
nullptr,
loongarch_supply_fpregset,
loongarch_fill_fpregset,
@@ -217,8 +217,8 @@ const struct regset loongarch_fpregset =
/* Implement the "init" method of struct tramp_frame. */
-#define LOONGARCH_RT_SIGFRAME_UCONTEXT_OFFSET 128
-#define LOONGARCH_UCONTEXT_SIGCONTEXT_OFFSET 176
+#define LOONGARCH_RT_SIGFRAME_UCONTEXT_OFFSET 128
+#define LOONGARCH_UCONTEXT_SIGCONTEXT_OFFSET 176
static void
loongarch_linux_rt_sigframe_init (const struct tramp_frame *self,
@@ -238,22 +238,18 @@ loongarch_linux_rt_sigframe_init (const struct tramp_frame *self,
}
/* li.w a7, __NR_rt_sigreturn */
-#define LOONGARCH_INST_LIW_A7_RT_SIGRETURN 0x03822c0b
+#define LOONGARCH_INST_LIW_A7_RT_SIGRETURN 0x03822c0b
/* syscall 0 */
-#define LOONGARCH_INST_SYSCALL 0x002b0000
+#define LOONGARCH_INST_SYSCALL 0x002b0000
-static const struct tramp_frame loongarch_linux_rt_sigframe =
-{
- SIGTRAMP_FRAME,
- 4,
- {
- { LOONGARCH_INST_LIW_A7_RT_SIGRETURN, ULONGEST_MAX },
- { LOONGARCH_INST_SYSCALL, ULONGEST_MAX },
- { TRAMP_SENTINEL_INSN, ULONGEST_MAX }
- },
- loongarch_linux_rt_sigframe_init,
- nullptr
-};
+static const struct tramp_frame loongarch_linux_rt_sigframe
+ = { SIGTRAMP_FRAME,
+ 4,
+ { { LOONGARCH_INST_LIW_A7_RT_SIGRETURN, ULONGEST_MAX },
+ { LOONGARCH_INST_SYSCALL, ULONGEST_MAX },
+ { TRAMP_SENTINEL_INSN, ULONGEST_MAX } },
+ loongarch_linux_rt_sigframe_init,
+ nullptr };
/* Implement the "iterate_over_regset_sections" gdbarch method. */
@@ -267,18 +263,19 @@ loongarch_iterate_over_regset_sections (struct gdbarch *gdbarch,
int fprsize = register_size (gdbarch, LOONGARCH_FIRST_FP_REGNUM);
int fccsize = register_size (gdbarch, LOONGARCH_FIRST_FCC_REGNUM);
int fcsrsize = register_size (gdbarch, LOONGARCH_FCSR_REGNUM);
- int fpsize = fprsize * LOONGARCH_LINUX_NUM_FPREGSET +
- fccsize * LOONGARCH_LINUX_NUM_FCC + fcsrsize;
+ int fpsize = fprsize * LOONGARCH_LINUX_NUM_FPREGSET
+ + fccsize * LOONGARCH_LINUX_NUM_FCC + fcsrsize;
cb (".reg", LOONGARCH_LINUX_NUM_GREGSET * gprsize,
- LOONGARCH_LINUX_NUM_GREGSET * gprsize, &loongarch_gregset, nullptr, cb_data);
+ LOONGARCH_LINUX_NUM_GREGSET * gprsize, &loongarch_gregset, nullptr,
+ cb_data);
cb (".reg2", fpsize, fpsize, &loongarch_fpregset, nullptr, cb_data);
}
/* The following value is derived from __NR_rt_sigreturn in
<include/uapi/asm-generic/unistd.h> from the Linux source tree. */
-#define LOONGARCH_NR_rt_sigreturn 139
+#define LOONGARCH_NR_rt_sigreturn 139
/* When FRAME is at a syscall instruction, return the PC of the next
instruction to be executed. */
@@ -302,14 +299,15 @@ loongarch_linux_syscall_next_pc (frame_info_ptr frame)
static void
loongarch_linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
{
- loongarch_gdbarch_tdep *tdep = gdbarch_tdep<loongarch_gdbarch_tdep> (gdbarch);
+ loongarch_gdbarch_tdep *tdep
+ = gdbarch_tdep<loongarch_gdbarch_tdep> (gdbarch);
linux_init_abi (info, gdbarch, 0);
- set_solib_svr4_fetch_link_map_offsets (gdbarch,
- info.bfd_arch_info->bits_per_address == 32
- ? linux_ilp32_fetch_link_map_offsets
- : linux_lp64_fetch_link_map_offsets);
+ set_solib_svr4_fetch_link_map_offsets (
+ gdbarch, info.bfd_arch_info->bits_per_address == 32
+ ? linux_ilp32_fetch_link_map_offsets
+ : linux_lp64_fetch_link_map_offsets);
/* GNU/Linux uses SVR4-style shared libraries. */
set_gdbarch_skip_trampoline_code (gdbarch, find_solib_trampoline_target);
@@ -318,13 +316,15 @@ loongarch_linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
set_gdbarch_skip_solib_resolver (gdbarch, glibc_skip_solib_resolver);
/* Enable TLS support. */
- set_gdbarch_fetch_tls_load_module_address (gdbarch, svr4_fetch_objfile_link_map);
+ set_gdbarch_fetch_tls_load_module_address (gdbarch,
+ svr4_fetch_objfile_link_map);
/* Prepend tramp frame unwinder for signal. */
tramp_frame_prepend_unwinder (gdbarch, &loongarch_linux_rt_sigframe);
/* Core file support. */
- set_gdbarch_iterate_over_regset_sections (gdbarch, loongarch_iterate_over_regset_sections);
+ set_gdbarch_iterate_over_regset_sections (
+ gdbarch, loongarch_iterate_over_regset_sections);
tdep->syscall_next_pc = loongarch_linux_syscall_next_pc;
}
@@ -332,11 +332,12 @@ loongarch_linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
/* Initialize LoongArch Linux target support. */
void _initialize_loongarch_linux_tdep ();
+
void
_initialize_loongarch_linux_tdep ()
{
gdbarch_register_osabi (bfd_arch_loongarch, bfd_mach_loongarch32,
- GDB_OSABI_LINUX, loongarch_linux_init_abi);
+ GDB_OSABI_LINUX, loongarch_linux_init_abi);
gdbarch_register_osabi (bfd_arch_loongarch, bfd_mach_loongarch64,
- GDB_OSABI_LINUX, loongarch_linux_init_abi);
+ GDB_OSABI_LINUX, loongarch_linux_init_abi);
}
diff --git a/gdb/loongarch-tdep.c b/gdb/loongarch-tdep.c
index 10bbed35585..1c03a15f5d5 100644
--- a/gdb/loongarch-tdep.c
+++ b/gdb/loongarch-tdep.c
@@ -50,9 +50,9 @@ loongarch_fetch_instruction (CORE_ADDR pc)
static bool
loongarch_insn_is_uncond_branch (insn_t insn)
{
- if ((insn & 0xfc000000) == 0x4c000000 /* jirl */
- || (insn & 0xfc000000) == 0x50000000 /* b */
- || (insn & 0xfc000000) == 0x54000000) /* bl */
+ if ((insn & 0xfc000000) == 0x4c000000 /* jirl */
+ || (insn & 0xfc000000) == 0x50000000 /* b */
+ || (insn & 0xfc000000) == 0x54000000) /* bl */
return true;
return false;
}
@@ -62,14 +62,14 @@ loongarch_insn_is_uncond_branch (insn_t insn)
static bool
loongarch_insn_is_cond_branch (insn_t insn)
{
- if ((insn & 0xfc000000) == 0x58000000 /* beq */
- || (insn & 0xfc000000) == 0x5c000000 /* bne */
- || (insn & 0xfc000000) == 0x60000000 /* blt */
- || (insn & 0xfc000000) == 0x64000000 /* bge */
- || (insn & 0xfc000000) == 0x68000000 /* bltu */
- || (insn & 0xfc000000) == 0x6c000000 /* bgeu */
- || (insn & 0xfc000000) == 0x40000000 /* beqz */
- || (insn & 0xfc000000) == 0x44000000) /* bnez */
+ if ((insn & 0xfc000000) == 0x58000000 /* beq */
+ || (insn & 0xfc000000) == 0x5c000000 /* bne */
+ || (insn & 0xfc000000) == 0x60000000 /* blt */
+ || (insn & 0xfc000000) == 0x64000000 /* bge */
+ || (insn & 0xfc000000) == 0x68000000 /* bltu */
+ || (insn & 0xfc000000) == 0x6c000000 /* bgeu */
+ || (insn & 0xfc000000) == 0x40000000 /* beqz */
+ || (insn & 0xfc000000) == 0x44000000) /* bnez */
return true;
return false;
}
@@ -90,8 +90,8 @@ loongarch_insn_is_branch (insn_t insn)
static bool
loongarch_insn_is_ll (insn_t insn)
{
- if ((insn & 0xff000000) == 0x20000000 /* ll.w */
- || (insn & 0xff000000) == 0x22000000) /* ll.d */
+ if ((insn & 0xff000000) == 0x20000000 /* ll.w */
+ || (insn & 0xff000000) == 0x22000000) /* ll.d */
return true;
return false;
}
@@ -101,8 +101,8 @@ loongarch_insn_is_ll (insn_t insn)
static bool
loongarch_insn_is_sc (insn_t insn)
{
- if ((insn & 0xff000000) == 0x21000000 /* sc.w */
- || (insn & 0xff000000) == 0x23000000) /* sc.d */
+ if ((insn & 0xff000000) == 0x21000000 /* sc.w */
+ || (insn & 0xff000000) == 0x23000000) /* sc.d */
return true;
return false;
}
@@ -118,8 +118,8 @@ loongarch_scan_prologue (struct gdbarch *gdbarch, CORE_ADDR start_pc,
CORE_ADDR cur_pc = start_pc, prologue_end = 0;
int32_t sp = LOONGARCH_SP_REGNUM;
int32_t fp = LOONGARCH_FP_REGNUM;
- int32_t reg_value[32] = {0};
- int32_t reg_used[32] = {1, 0};
+ int32_t reg_value[32] = { 0 };
+ int32_t reg_used[32] = { 1, 0 };
while (cur_pc < limit_pc)
{
@@ -131,7 +131,7 @@ loongarch_scan_prologue (struct gdbarch *gdbarch, CORE_ADDR start_pc,
int32_t si12 = loongarch_decode_imm ("10:12", insn, 1);
int32_t si20 = loongarch_decode_imm ("5:20", insn, 1);
- if ((insn & 0xffc00000) == 0x02c00000 /* addi.d sp,sp,si12 */
+ if ((insn & 0xffc00000) == 0x02c00000 /* addi.d sp,sp,si12 */
&& rd == sp && rj == sp && si12 < 0)
{
prologue_end = cur_pc + insn_len;
@@ -213,7 +213,7 @@ loongarch_skip_prologue (struct gdbarch *gdbarch, CORE_ADDR pc)
that bound, then use an arbitrary large number as the upper bound. */
CORE_ADDR limit_pc = skip_prologue_using_sal (gdbarch, pc);
if (limit_pc == 0)
- limit_pc = pc + 100; /* Arbitrary large number. */
+ limit_pc = pc + 100; /* Arbitrary large number. */
return loongarch_scan_prologue (gdbarch, pc, limit_pc, nullptr, nullptr);
}
@@ -225,91 +225,107 @@ static CORE_ADDR
loongarch_next_pc (struct regcache *regcache, CORE_ADDR cur_pc)
{
struct gdbarch *gdbarch = regcache->arch ();
- loongarch_gdbarch_tdep *tdep = gdbarch_tdep<loongarch_gdbarch_tdep> (gdbarch);
+ loongarch_gdbarch_tdep *tdep
+ = gdbarch_tdep<loongarch_gdbarch_tdep> (gdbarch);
insn_t insn = loongarch_fetch_instruction (cur_pc);
size_t insn_len = loongarch_insn_length (insn);
CORE_ADDR next_pc = cur_pc + insn_len;
- if ((insn & 0xfc000000) == 0x4c000000) /* jirl rd, rj, offs16 */
+ if ((insn & 0xfc000000) == 0x4c000000) /* jirl rd, rj, offs16 */
{
- LONGEST rj = regcache_raw_get_signed (regcache,
- loongarch_decode_imm ("5:5", insn, 0));
+ LONGEST rj
+ = regcache_raw_get_signed (regcache,
+ loongarch_decode_imm ("5:5", insn, 0));
next_pc = rj + loongarch_decode_imm ("10:16<<2", insn, 1);
}
- else if ((insn & 0xfc000000) == 0x50000000 /* b offs26 */
- || (insn & 0xfc000000) == 0x54000000) /* bl offs26 */
+ else if ((insn & 0xfc000000) == 0x50000000 /* b offs26 */
+ || (insn & 0xfc000000) == 0x54000000) /* bl offs26 */
{
next_pc = cur_pc + loongarch_decode_imm ("0:10|10:16<<2", insn, 1);
}
- else if ((insn & 0xfc000000) == 0x58000000) /* beq rj, rd, offs16 */
+ else if ((insn & 0xfc000000) == 0x58000000) /* beq rj, rd, offs16 */
{
- LONGEST rj = regcache_raw_get_signed (regcache,
- loongarch_decode_imm ("5:5", insn, 0));
- LONGEST rd = regcache_raw_get_signed (regcache,
- loongarch_decode_imm ("0:5", insn, 0));
+ LONGEST rj
+ = regcache_raw_get_signed (regcache,
+ loongarch_decode_imm ("5:5", insn, 0));
+ LONGEST rd
+ = regcache_raw_get_signed (regcache,
+ loongarch_decode_imm ("0:5", insn, 0));
if (rj == rd)
next_pc = cur_pc + loongarch_decode_imm ("10:16<<2", insn, 1);
}
- else if ((insn & 0xfc000000) == 0x5c000000) /* bne rj, rd, offs16 */
+ else if ((insn & 0xfc000000) == 0x5c000000) /* bne rj, rd, offs16 */
{
- LONGEST rj = regcache_raw_get_signed (regcache,
- loongarch_decode_imm ("5:5", insn, 0));
- LONGEST rd = regcache_raw_get_signed (regcache,
- loongarch_decode_imm ("0:5", insn, 0));
+ LONGEST rj
+ = regcache_raw_get_signed (regcache,
+ loongarch_decode_imm ("5:5", insn, 0));
+ LONGEST rd
+ = regcache_raw_get_signed (regcache,
+ loongarch_decode_imm ("0:5", insn, 0));
if (rj != rd)
next_pc = cur_pc + loongarch_decode_imm ("10:16<<2", insn, 1);
}
- else if ((insn & 0xfc000000) == 0x60000000) /* blt rj, rd, offs16 */
+ else if ((insn & 0xfc000000) == 0x60000000) /* blt rj, rd, offs16 */
{
- LONGEST rj = regcache_raw_get_signed (regcache,
- loongarch_decode_imm ("5:5", insn, 0));
- LONGEST rd = regcache_raw_get_signed (regcache,
- loongarch_decode_imm ("0:5", insn, 0));
+ LONGEST rj
+ = regcache_raw_get_signed (regcache,
+ loongarch_decode_imm ("5:5", insn, 0));
+ LONGEST rd
+ = regcache_raw_get_signed (regcache,
+ loongarch_decode_imm ("0:5", insn, 0));
if (rj < rd)
next_pc = cur_pc + loongarch_decode_imm ("10:16<<2", insn, 1);
}
- else if ((insn & 0xfc000000) == 0x64000000) /* bge rj, rd, offs16 */
+ else if ((insn & 0xfc000000) == 0x64000000) /* bge rj, rd, offs16 */
{
- LONGEST rj = regcache_raw_get_signed (regcache,
- loongarch_decode_imm ("5:5", insn, 0));
- LONGEST rd = regcache_raw_get_signed (regcache,
- loongarch_decode_imm ("0:5", insn, 0));
+ LONGEST rj
+ = regcache_raw_get_signed (regcache,
+ loongarch_decode_imm ("5:5", insn, 0));
+ LONGEST rd
+ = regcache_raw_get_signed (regcache,
+ loongarch_decode_imm ("0:5", insn, 0));
if (rj >= rd)
next_pc = cur_pc + loongarch_decode_imm ("10:16<<2", insn, 1);
}
- else if ((insn & 0xfc000000) == 0x68000000) /* bltu rj, rd, offs16 */
+ else if ((insn & 0xfc000000) == 0x68000000) /* bltu rj, rd, offs16 */
{
- ULONGEST rj = regcache_raw_get_unsigned (regcache,
- loongarch_decode_imm ("5:5", insn, 0));
- ULONGEST rd = regcache_raw_get_unsigned (regcache,
- loongarch_decode_imm ("0:5", insn, 0));
+ ULONGEST rj
+ = regcache_raw_get_unsigned (regcache,
+ loongarch_decode_imm ("5:5", insn, 0));
+ ULONGEST rd
+ = regcache_raw_get_unsigned (regcache,
+ loongarch_decode_imm ("0:5", insn, 0));
if (rj < rd)
next_pc = cur_pc + loongarch_decode_imm ("10:16<<2", insn, 1);
}
- else if ((insn & 0xfc000000) == 0x6c000000) /* bgeu rj, rd, offs16 */
+ else if ((insn & 0xfc000000) == 0x6c000000) /* bgeu rj, rd, offs16 */
{
- ULONGEST rj = regcache_raw_get_unsigned (regcache,
- loongarch_decode_imm ("5:5", insn, 0));
- ULONGEST rd = regcache_raw_get_unsigned (regcache,
- loongarch_decode_imm ("0:5", insn, 0));
+ ULONGEST rj
+ = regcache_raw_get_unsigned (regcache,
+ loongarch_decode_imm ("5:5", insn, 0));
+ ULONGEST rd
+ = regcache_raw_get_unsigned (regcache,
+ loongarch_decode_imm ("0:5", insn, 0));
if (rj >= rd)
next_pc = cur_pc + loongarch_decode_imm ("10:16<<2", insn, 1);
}
- else if ((insn & 0xfc000000) == 0x40000000) /* beqz rj, offs21 */
+ else if ((insn & 0xfc000000) == 0x40000000) /* beqz rj, offs21 */
{
- LONGEST rj = regcache_raw_get_signed (regcache,
- loongarch_decode_imm ("5:5", insn, 0));
+ LONGEST rj
+ = regcache_raw_get_signed (regcache,
+ loongarch_decode_imm ("5:5", insn, 0));
if (rj == 0)
next_pc = cur_pc + loongarch_decode_imm ("0:5|10:16<<2", insn, 1);
}
- else if ((insn & 0xfc000000) == 0x44000000) /* bnez rj, offs21 */
+ else if ((insn & 0xfc000000) == 0x44000000) /* bnez rj, offs21 */
{
- LONGEST rj = regcache_raw_get_signed (regcache,
- loongarch_decode_imm ("5:5", insn, 0));
+ LONGEST rj
+ = regcache_raw_get_signed (regcache,
+ loongarch_decode_imm ("5:5", insn, 0));
if (rj != 0)
next_pc = cur_pc + loongarch_decode_imm ("0:5|10:16<<2", insn, 1);
}
- else if ((insn & 0xffff8000) == 0x002b0000) /* syscall */
+ else if ((insn & 0xffff8000) == 0x002b0000) /* syscall */
{
if (tdep->syscall_next_pc != nullptr)
next_pc = tdep->syscall_next_pc (get_current_frame ());
@@ -322,7 +338,8 @@ loongarch_next_pc (struct regcache *regcache, CORE_ADDR cur_pc)
so look for the end of the sequence and put the breakpoint there. */
static std::vector<CORE_ADDR>
-loongarch_deal_with_atomic_sequence (struct regcache *regcache, CORE_ADDR cur_pc)
+loongarch_deal_with_atomic_sequence (struct regcache *regcache,
+ CORE_ADDR cur_pc)
{
CORE_ADDR next_pc;
std::vector<CORE_ADDR> next_pcs;
@@ -383,7 +400,7 @@ loongarch_software_single_step (struct regcache *regcache)
CORE_ADDR next_pc = loongarch_next_pc (regcache, cur_pc);
- return {next_pc};
+ return { next_pc };
}
/* Implement the frame_align gdbarch method. */
@@ -487,8 +504,8 @@ pass_in_far (struct regcache *regcache, unsigned int far, const gdb_byte *val)
/* Pass a value on the stack. */
static void
-pass_on_stack (struct regcache *regcache, const gdb_byte *val,
- size_t len, int align, gdb_byte **addr)
+pass_on_stack (struct regcache *regcache, const gdb_byte *val, size_t len,
+ int align, gdb_byte **addr)
{
align = align_up (align, 8);
if (align > 16)
@@ -504,8 +521,7 @@ pass_on_stack (struct regcache *regcache, const gdb_byte *val,
/* Compute the numbers of struct member. */
static void
-compute_struct_member (struct type *type,
- unsigned int *fixed_point_members,
+compute_struct_member (struct type *type, unsigned int *fixed_point_members,
unsigned int *floating_point_members,
bool *first_member_is_fixed_point)
{
@@ -519,17 +535,16 @@ compute_struct_member (struct type *type,
|| field_type->code () == TYPE_CODE_RANGE
|| field_type->code () == TYPE_CODE_ENUM
|| field_type->code () == TYPE_CODE_PTR)
- {
- (*fixed_point_members)++;
+ {
+ (*fixed_point_members)++;
- if (*floating_point_members == 0)
- *first_member_is_fixed_point = true;
- }
+ if (*floating_point_members == 0)
+ *first_member_is_fixed_point = true;
+ }
else if (field_type->code () == TYPE_CODE_FLT)
(*floating_point_members)++;
else if (field_type->code () == TYPE_CODE_STRUCT)
- compute_struct_member (field_type,
- fixed_point_members,
+ compute_struct_member (field_type, fixed_point_members,
floating_point_members,
first_member_is_fixed_point);
else if (field_type->code () == TYPE_CODE_COMPLEX)
@@ -540,13 +555,9 @@ compute_struct_member (struct type *type,
/* Implement the push_dummy_call gdbarch method. */
static CORE_ADDR
-loongarch_push_dummy_call (struct gdbarch *gdbarch,
- struct value *function,
- struct regcache *regcache,
- CORE_ADDR bp_addr,
- int nargs,
- struct value **args,
- CORE_ADDR sp,
+loongarch_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
+ struct regcache *regcache, CORE_ADDR bp_addr,
+ int nargs, struct value **args, CORE_ADDR sp,
function_call_return_method return_method,
CORE_ADDR struct_addr)
{
@@ -571,7 +582,8 @@ loongarch_push_dummy_call (struct gdbarch *gdbarch,
int align = type_align (type);
enum type_code code = type->code ();
struct type *func_type = check_typedef (value_type (function));
- bool varargs = (func_type->has_varargs () && i >= func_type->num_fields ());
+ bool varargs
+ = (func_type->has_varargs () && i >= func_type->num_fields ());
switch (code)
{
@@ -587,22 +599,26 @@ loongarch_push_dummy_call (struct gdbarch *gdbarch,
When passed in registers or on the stack,
the unsigned integer scalars are zero-extended to GRLEN bits,
and the signed integer scalars are sign-extended. */
- if (type->is_unsigned ())
- {
- ULONGEST data = extract_unsigned_integer (val, len, BFD_ENDIAN_LITTLE);
- if (gar > 0)
- pass_in_gar (regcache, gar--, (gdb_byte *) &data);
- else
- pass_on_stack (regcache, (gdb_byte *) &data, len, align, &addr);
- }
- else
- {
- LONGEST data = extract_signed_integer (val, len, BFD_ENDIAN_LITTLE);
- if (gar > 0)
- pass_in_gar (regcache, gar--, (gdb_byte *) &data);
- else
- pass_on_stack (regcache, (gdb_byte *) &data, len, align, &addr);
- }
+ if (type->is_unsigned ())
+ {
+ ULONGEST data
+ = extract_unsigned_integer (val, len, BFD_ENDIAN_LITTLE);
+ if (gar > 0)
+ pass_in_gar (regcache, gar--, (gdb_byte *) &data);
+ else
+ pass_on_stack (regcache, (gdb_byte *) &data, len, align,
+ &addr);
+ }
+ else
+ {
+ LONGEST data
+ = extract_signed_integer (val, len, BFD_ENDIAN_LITTLE);
+ if (gar > 0)
+ pass_in_gar (regcache, gar--, (gdb_byte *) &data);
+ else
+ pass_on_stack (regcache, (gdb_byte *) &data, len, align,
+ &addr);
+ }
}
break;
case TYPE_CODE_FLT:
@@ -625,7 +641,8 @@ loongarch_push_dummy_call (struct gdbarch *gdbarch,
else if (gar == 1)
{
pass_in_gar (regcache, gar--, val);
- pass_on_stack (regcache, val + regsize, len - regsize, align, &addr);
+ pass_on_stack (regcache, val + regsize, len - regsize,
+ align, &addr);
}
else
{
@@ -673,11 +690,11 @@ loongarch_push_dummy_call (struct gdbarch *gdbarch,
If no FAR is available, it's passed in GAR.
If no GAR is available, it's passed on the stack. */
if (!varargs && far > 0)
- pass_in_far (regcache, far--, val);
+ pass_in_far (regcache, far--, val);
else if (gar > 0)
- pass_in_gar (regcache, gar--, val);
+ pass_in_gar (regcache, gar--, val);
else
- pass_on_stack (regcache, val, len, align, &addr);
+ pass_on_stack (regcache, val, len, align, &addr);
}
break;
case TYPE_CODE_STRUCT:
@@ -685,8 +702,7 @@ loongarch_push_dummy_call (struct gdbarch *gdbarch,
fixed_point_members = 0;
floating_point_members = 0;
first_member_is_fixed_point = false;
- compute_struct_member (type,
- &fixed_point_members,
+ compute_struct_member (type, &fixed_point_members,
&floating_point_members,
&first_member_is_fixed_point);
@@ -704,7 +720,8 @@ loongarch_push_dummy_call (struct gdbarch *gdbarch,
pass_on_stack (regcache, val, len, align, &addr);
}
/* The structure has only floating-point members. */
- else if (fixed_point_members == 0 && floating_point_members > 0)
+ else if (fixed_point_members == 0
+ && floating_point_members > 0)
{
/* The structure has one floating-point member.
The argument is passed in a FAR.
@@ -761,7 +778,8 @@ loongarch_push_dummy_call (struct gdbarch *gdbarch,
and the fixed-point member of the structure is passed in the GAR.
If no floating-point register but one GAR is available, it's passed in GAR;
If no GAR is available, it's passed on the stack. */
- else if (floating_point_members == 1 && fixed_point_members == 1)
+ else if (floating_point_members == 1
+ && fixed_point_members == 1)
{
if (!varargs && far > 0 && gar > 0)
{
@@ -806,7 +824,8 @@ loongarch_push_dummy_call (struct gdbarch *gdbarch,
else if (gar == 1)
{
pass_in_gar (regcache, gar--, val);
- pass_on_stack (regcache, val + regsize, len - regsize, align, &addr);
+ pass_on_stack (regcache, val + regsize, len - regsize,
+ align, &addr);
}
else
{
@@ -814,7 +833,8 @@ loongarch_push_dummy_call (struct gdbarch *gdbarch,
}
}
/* The structure has only floating-point members. */
- else if (fixed_point_members == 0 && floating_point_members > 0)
+ else if (fixed_point_members == 0
+ && floating_point_members > 0)
{
/* The structure has one long double member
or one double member and two adjacent float members
@@ -827,9 +847,9 @@ loongarch_push_dummy_call (struct gdbarch *gdbarch,
and the high-order bits are on the stack,
and passed on the stack if no GAR is available. */
if ((len == 16 && floating_point_members == 1)
- || (len == 16 && floating_point_members == 3)
- || (len == 12 && floating_point_members == 3)
- || (len == 16 && floating_point_members == 4))
+ || (len == 16 && floating_point_members == 3)
+ || (len == 12 && floating_point_members == 3)
+ || (len == 16 && floating_point_members == 4))
{
if (gar >= 2)
{
@@ -841,12 +861,14 @@ loongarch_push_dummy_call (struct gdbarch *gdbarch,
if (!varargs)
{
pass_in_gar (regcache, gar--, val);
- pass_on_stack (regcache, val + regsize, len - regsize, align, &addr);
+ pass_on_stack (regcache, val + regsize,
+ len - regsize, align, &addr);
}
else
{
gar--;
- pass_on_stack (regcache, val, len, align, &addr);
+ pass_on_stack (regcache, val, len, align,
+ &addr);
}
}
else
@@ -883,7 +905,8 @@ loongarch_push_dummy_call (struct gdbarch *gdbarch,
else if (gar == 1)
{
pass_in_gar (regcache, gar--, val);
- pass_on_stack (regcache, val + regsize, len - regsize, align, &addr);
+ pass_on_stack (regcache, val + regsize,
+ len - regsize, align, &addr);
}
else
{
@@ -895,7 +918,8 @@ loongarch_push_dummy_call (struct gdbarch *gdbarch,
else if (fixed_point_members > 0 && floating_point_members > 0)
{
/* The structure has one floating-point member and one fixed-point member. */
- if (floating_point_members == 1 && fixed_point_members == 1)
+ if (floating_point_members == 1
+ && fixed_point_members == 1)
{
/* If one FAR and one GAR are available,
the floating-point member of the structure is passed in the FAR,
@@ -919,17 +943,21 @@ loongarch_push_dummy_call (struct gdbarch *gdbarch,
pass_in_far (regcache, far--, val + regsize);
}
}
- else if ((!varargs && far == 0 && gar >= 2) || (varargs && gar >= 2))
+ else if ((!varargs && far == 0 && gar >= 2)
+ || (varargs && gar >= 2))
{
pass_in_gar (regcache, gar--, val);
pass_in_gar (regcache, gar--, val + regsize);
}
- else if ((!varargs && far == 0 && gar == 1) || (varargs && gar == 1))
+ else if ((!varargs && far == 0 && gar == 1)
+ || (varargs && gar == 1))
{
pass_in_gar (regcache, gar--, val);
- pass_on_stack (regcache, val + regsize, len - regsize, align, &addr);
+ pass_on_stack (regcache, val + regsize,
+ len - regsize, align, &addr);
}
- else if ((!varargs && far == 0 && gar == 0) || (varargs && gar == 0))
+ else if ((!varargs && far == 0 && gar == 0)
+ || (varargs && gar == 0))
{
pass_on_stack (regcache, val, len, align, &addr);
}
@@ -951,7 +979,8 @@ loongarch_push_dummy_call (struct gdbarch *gdbarch,
else if (gar == 1)
{
pass_in_gar (regcache, gar--, val);
- pass_on_stack (regcache, val + regsize, len - regsize, align, &addr);
+ pass_on_stack (regcache, val + regsize,
+ len - regsize, align, &addr);
}
else
{
@@ -962,7 +991,7 @@ loongarch_push_dummy_call (struct gdbarch *gdbarch,
}
else if (len > 2 * regsize)
{
- /* It's passed by reference and are replaced in the argument list with the address.
+ /* It's passed by reference and are replaced in the argument list with the address.
If there is an available GAR, the reference is passed in the GAR,
and passed on the stack if no GAR is available. */
sp = align_down (sp - len, 16);
@@ -971,7 +1000,8 @@ loongarch_push_dummy_call (struct gdbarch *gdbarch,
if (gar > 0)
pass_in_gar (regcache, gar--, (const gdb_byte *) &sp);
else
- pass_on_stack (regcache, (const gdb_byte*) &sp, len, regsize, &addr);
+ pass_on_stack (regcache, (const gdb_byte *) &sp, len,
+ regsize, &addr);
}
}
break;
@@ -1003,7 +1033,8 @@ loongarch_push_dummy_call (struct gdbarch *gdbarch,
else if (gar == 1)
{
pass_in_gar (regcache, gar--, val);
- pass_on_stack (regcache, val + regsize, len - regsize, align, &addr);
+ pass_on_stack (regcache, val + regsize, len - regsize, align,
+ &addr);
}
else
{
@@ -1021,7 +1052,8 @@ loongarch_push_dummy_call (struct gdbarch *gdbarch,
if (gar > 0)
pass_in_gar (regcache, gar--, (const gdb_byte *) &sp);
else
- pass_on_stack (regcache, (const gdb_byte*) &sp, len, regsize, &addr);
+ pass_on_stack (regcache, (const gdb_byte *) &sp, len, regsize,
+ &addr);
}
break;
case TYPE_CODE_COMPLEX:
@@ -1079,7 +1111,8 @@ loongarch_push_dummy_call (struct gdbarch *gdbarch,
else if (gar == 1)
{
pass_in_gar (regcache, gar--, val);
- pass_on_stack (regcache, val + align, len - align, align, &addr);
+ pass_on_stack (regcache, val + align, len - align, align,
+ &addr);
}
else
{
@@ -1099,7 +1132,8 @@ loongarch_push_dummy_call (struct gdbarch *gdbarch,
if (gar > 0)
pass_in_gar (regcache, gar--, (const gdb_byte *) &sp);
else
- pass_on_stack (regcache, (const gdb_byte*) &sp, regsize, regsize, &addr);
+ pass_on_stack (regcache, (const gdb_byte *) &sp, regsize,
+ regsize, &addr);
}
}
break;
@@ -1124,9 +1158,8 @@ loongarch_push_dummy_call (struct gdbarch *gdbarch,
/* Partial transfer of a cooked register. */
static void
-loongarch_xfer_reg (struct regcache *regcache,
- int regnum, int len, gdb_byte *readbuf,
- const gdb_byte *writebuf, size_t offset)
+loongarch_xfer_reg (struct regcache *regcache, int regnum, int len,
+ gdb_byte *readbuf, const gdb_byte *writebuf, size_t offset)
{
if (readbuf)
regcache->cooked_read_part (regnum, 0, len, readbuf + offset);
@@ -1173,12 +1206,14 @@ loongarch_return_value (struct gdbarch *gdbarch, struct value *function,
gdb_byte buf[regsize];
if (type->is_unsigned ())
{
- ULONGEST data = extract_unsigned_integer (writebuf, len, BFD_ENDIAN_LITTLE);
+ ULONGEST data = extract_unsigned_integer (writebuf, len,
+ BFD_ENDIAN_LITTLE);
store_unsigned_integer (buf, regsize, BFD_ENDIAN_LITTLE, data);
}
else
{
- LONGEST data = extract_signed_integer (writebuf, len, BFD_ENDIAN_LITTLE);
+ LONGEST data
+ = extract_signed_integer (writebuf, len, BFD_ENDIAN_LITTLE);
store_signed_integer (buf, regsize, BFD_ENDIAN_LITTLE, data);
}
loongarch_xfer_reg (regcache, a0, regsize, nullptr, buf, 0);
@@ -1193,7 +1228,8 @@ loongarch_return_value (struct gdbarch *gdbarch, struct value *function,
if (len == 2 * regsize)
{
loongarch_xfer_reg (regcache, a0, regsize, readbuf, writebuf, 0);
- loongarch_xfer_reg (regcache, a1, len - regsize, readbuf, writebuf, regsize);
+ loongarch_xfer_reg (regcache, a1, len - regsize, readbuf, writebuf,
+ regsize);
}
/* float or double type.
The return value is passed in f0. */
@@ -1207,8 +1243,7 @@ loongarch_return_value (struct gdbarch *gdbarch, struct value *function,
fixed_point_members = 0;
floating_point_members = 0;
first_member_is_fixed_point = false;
- compute_struct_member (type,
- &fixed_point_members,
+ compute_struct_member (type, &fixed_point_members,
&floating_point_members,
&first_member_is_fixed_point);
@@ -1227,14 +1262,17 @@ loongarch_return_value (struct gdbarch *gdbarch, struct value *function,
The return value is passed in f0. */
if (floating_point_members == 1)
{
- loongarch_xfer_reg (regcache, f0, len, readbuf, writebuf, 0);
+ loongarch_xfer_reg (regcache, f0, len, readbuf, writebuf,
+ 0);
}
/* The structure has two floating-point members.
The return value is passed in f0 and f1. */
else if (floating_point_members == 2)
{
- loongarch_xfer_reg (regcache, f0, len / 2, readbuf, writebuf, 0);
- loongarch_xfer_reg (regcache, f1, len / 2, readbuf, writebuf, len / 2);
+ loongarch_xfer_reg (regcache, f0, len / 2, readbuf,
+ writebuf, 0);
+ loongarch_xfer_reg (regcache, f1, len / 2, readbuf,
+ writebuf, len / 2);
}
}
/* The structure has both fixed-point and floating-point members. */
@@ -1244,22 +1282,28 @@ loongarch_return_value (struct gdbarch *gdbarch, struct value *function,
The return value is passed in a0. */
if (floating_point_members == 1 && fixed_point_members > 1)
{
- loongarch_xfer_reg (regcache, a0, len, readbuf, writebuf, 0);
+ loongarch_xfer_reg (regcache, a0, len, readbuf, writebuf,
+ 0);
}
/* The structure has one float member and one fixed-point member. */
- else if (floating_point_members == 1 && fixed_point_members == 1)
+ else if (floating_point_members == 1
+ && fixed_point_members == 1)
{
/* The return value is passed in f0 and a0 if the first member is floating-point. */
if (first_member_is_fixed_point == false)
{
- loongarch_xfer_reg (regcache, f0, regsize / 2, readbuf, writebuf, 0);
- loongarch_xfer_reg (regcache, a0, regsize / 2, readbuf, writebuf, regsize / 2);
+ loongarch_xfer_reg (regcache, f0, regsize / 2, readbuf,
+ writebuf, 0);
+ loongarch_xfer_reg (regcache, a0, regsize / 2, readbuf,
+ writebuf, regsize / 2);
}
/* The return value is passed in a0 and f0 if the first member is fixed-point. */
else
{
- loongarch_xfer_reg (regcache, a0, regsize / 2, readbuf, writebuf, 0);
- loongarch_xfer_reg (regcache, f0, regsize / 2, readbuf, writebuf, regsize / 2);
+ loongarch_xfer_reg (regcache, a0, regsize / 2, readbuf,
+ writebuf, 0);
+ loongarch_xfer_reg (regcache, f0, regsize / 2, readbuf,
+ writebuf, regsize / 2);
}
}
}
@@ -1270,8 +1314,10 @@ loongarch_return_value (struct gdbarch *gdbarch, struct value *function,
if (fixed_point_members > 0 && floating_point_members == 0)
{
/* The return value is passed in a0 and a1. */
- loongarch_xfer_reg (regcache, a0, regsize, readbuf, writebuf, 0);
- loongarch_xfer_reg (regcache, a1, len - regsize, readbuf, writebuf, regsize);
+ loongarch_xfer_reg (regcache, a0, regsize, readbuf, writebuf,
+ 0);
+ loongarch_xfer_reg (regcache, a1, len - regsize, readbuf,
+ writebuf, regsize);
}
/* The structure has only floating-point members. */
else if (fixed_point_members == 0 && floating_point_members > 0)
@@ -1285,8 +1331,10 @@ loongarch_return_value (struct gdbarch *gdbarch, struct value *function,
|| (len == 12 && floating_point_members == 3)
|| (len == 16 && floating_point_members == 4))
{
- loongarch_xfer_reg (regcache, a0, regsize, readbuf, writebuf, 0);
- loongarch_xfer_reg (regcache, a1, len - regsize, readbuf, writebuf, regsize);
+ loongarch_xfer_reg (regcache, a0, regsize, readbuf,
+ writebuf, 0);
+ loongarch_xfer_reg (regcache, a1, len - regsize, readbuf,
+ writebuf, regsize);
}
/* The structure has two double members
or one double member and one float member.
@@ -1294,8 +1342,10 @@ loongarch_return_value (struct gdbarch *gdbarch, struct value *function,
else if ((len == 16 && floating_point_members == 2)
|| (len == 12 && floating_point_members == 2))
{
- loongarch_xfer_reg (regcache, f0, regsize, readbuf, writebuf, 0);
- loongarch_xfer_reg (regcache, f1, len - regsize, readbuf, writebuf, regsize);
+ loongarch_xfer_reg (regcache, f0, regsize, readbuf,
+ writebuf, 0);
+ loongarch_xfer_reg (regcache, f1, len - regsize, readbuf,
+ writebuf, regsize);
}
}
/* The structure has both fixed-point and floating-point members. */
@@ -1307,21 +1357,27 @@ loongarch_return_value (struct gdbarch *gdbarch, struct value *function,
/* The return value is passed in f0 and a0 if the first member is floating-point. */
if (first_member_is_fixed_point == false)
{
- loongarch_xfer_reg (regcache, f0, regsize, readbuf, writebuf, 0);
- loongarch_xfer_reg (regcache, a0, len - regsize, readbuf, writebuf, regsize);
+ loongarch_xfer_reg (regcache, f0, regsize, readbuf,
+ writebuf, 0);
+ loongarch_xfer_reg (regcache, a0, len - regsize,
+ readbuf, writebuf, regsize);
}
/* The return value is passed in a0 and f0 if the first member is fixed-point. */
else
{
- loongarch_xfer_reg (regcache, a0, regsize, readbuf, writebuf, 0);
- loongarch_xfer_reg (regcache, f0, len - regsize, readbuf, writebuf, regsize);
+ loongarch_xfer_reg (regcache, a0, regsize, readbuf,
+ writebuf, 0);
+ loongarch_xfer_reg (regcache, f0, len - regsize,
+ readbuf, writebuf, regsize);
}
}
else
{
/* The return value is passed in a0 and a1. */
- loongarch_xfer_reg (regcache, a0, regsize, readbuf, writebuf, 0);
- loongarch_xfer_reg (regcache, a1, len - regsize, readbuf, writebuf, regsize);
+ loongarch_xfer_reg (regcache, a0, regsize, readbuf,
+ writebuf, 0);
+ loongarch_xfer_reg (regcache, a1, len - regsize, readbuf,
+ writebuf, regsize);
}
}
}
@@ -1337,7 +1393,8 @@ loongarch_return_value (struct gdbarch *gdbarch, struct value *function,
{
/* The return value is passed in a0 and a1. */
loongarch_xfer_reg (regcache, a0, regsize, readbuf, writebuf, 0);
- loongarch_xfer_reg (regcache, a1, len - regsize, readbuf, writebuf, regsize);
+ loongarch_xfer_reg (regcache, a1, len - regsize, readbuf, writebuf,
+ regsize);
}
break;
case TYPE_CODE_COMPLEX:
@@ -1367,7 +1424,8 @@ loongarch_dwarf2_reg_to_regnum (struct gdbarch *gdbarch, int regnum)
return -1;
}
-static constexpr gdb_byte loongarch_default_breakpoint[] = {0x05, 0x00, 0x2a, 0x00};
+static constexpr gdb_byte loongarch_default_breakpoint[]
+ = { 0x05, 0x00, 0x2a, 0x00 };
typedef BP_MANIPULATION (loongarch_default_breakpoint) loongarch_breakpoint;
/* Extract a set of required target features out of ABFD. If ABFD is nullptr
@@ -1394,7 +1452,7 @@ loongarch_features_from_bfd (const bfd *abfd)
else if (eclass == ELFCLASS64)
features.xlen = 8;
else
- internal_error (_("unknown ELF header class %d"), eclass);
+ internal_error (_ ("unknown ELF header class %d"), eclass);
if (EF_LOONGARCH_IS_SINGLE_FLOAT (e_flags))
features.fputype = SINGLE_FLOAT;
@@ -1452,16 +1510,19 @@ loongarch_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
if (feature_cpu == nullptr)
return nullptr;
-
/* Validate the description provides the mandatory base registers
and allocate their numbers. */
bool valid_p = true;
for (int i = 0; i < 32; i++)
- valid_p &= tdesc_numbered_register (feature_cpu, tdesc_data.get (), regnum++,
- loongarch_r_normal_name[i] + 1);
- valid_p &= tdesc_numbered_register (feature_cpu, tdesc_data.get (), regnum++, "orig_a0");
- valid_p &= tdesc_numbered_register (feature_cpu, tdesc_data.get (), regnum++, "pc");
- valid_p &= tdesc_numbered_register (feature_cpu, tdesc_data.get (), regnum++, "badv");
+ valid_p
+ &= tdesc_numbered_register (feature_cpu, tdesc_data.get (), regnum++,
+ loongarch_r_normal_name[i] + 1);
+ valid_p &= tdesc_numbered_register (feature_cpu, tdesc_data.get (), regnum++,
+ "orig_a0");
+ valid_p &= tdesc_numbered_register (feature_cpu, tdesc_data.get (), regnum++,
+ "pc");
+ valid_p &= tdesc_numbered_register (feature_cpu, tdesc_data.get (), regnum++,
+ "badv");
if (!valid_p)
return nullptr;
@@ -1474,12 +1535,15 @@ loongarch_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
allocate their numbers. */
regnum = LOONGARCH_FIRST_FP_REGNUM;
for (int i = 0; i < LOONGARCH_LINUX_NUM_FPREGSET; i++)
- valid_p &= tdesc_numbered_register (feature_fpu, tdesc_data.get (), regnum++,
- loongarch_f_normal_name[i] + 1);
+ valid_p
+ &= tdesc_numbered_register (feature_fpu, tdesc_data.get (), regnum++,
+ loongarch_f_normal_name[i] + 1);
for (int i = 0; i < LOONGARCH_LINUX_NUM_FCC; i++)
- valid_p &= tdesc_numbered_register (feature_fpu, tdesc_data.get (), regnum++,
- loongarch_c_normal_name[i] + 1);
- valid_p &= tdesc_numbered_register (feature_fpu, tdesc_data.get (), regnum++, "fcsr");
+ valid_p
+ &= tdesc_numbered_register (feature_fpu, tdesc_data.get (), regnum++,
+ loongarch_c_normal_name[i] + 1);
+ valid_p &= tdesc_numbered_register (feature_fpu, tdesc_data.get (), regnum++,
+ "fcsr");
if (!valid_p)
return nullptr;
@@ -1510,8 +1574,7 @@ loongarch_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
}
/* Find a candidate among the list of pre-declared architectures. */
- for (arches = gdbarch_list_lookup_by_info (arches, &info);
- arches != nullptr;
+ for (arches = gdbarch_list_lookup_by_info (arches, &info); arches != nullptr;
arches = gdbarch_list_lookup_by_info (arches->next, &info))
{
/* Check that the feature set of the ARCHES matches the feature set
@@ -1532,7 +1595,8 @@ loongarch_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
/* None found, so create a new architecture from the information provided. */
gdbarch *gdbarch
= gdbarch_alloc (&info, gdbarch_tdep_up (new loongarch_gdbarch_tdep));
- loongarch_gdbarch_tdep *tdep = gdbarch_tdep<loongarch_gdbarch_tdep> (gdbarch);
+ loongarch_gdbarch_tdep *tdep
+ = gdbarch_tdep<loongarch_gdbarch_tdep> (gdbarch);
tdep->abi_features = abi_features;
@@ -1576,8 +1640,10 @@ loongarch_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
/* Breakpoint manipulation. */
set_gdbarch_software_single_step (gdbarch, loongarch_software_single_step);
- set_gdbarch_breakpoint_kind_from_pc (gdbarch, loongarch_breakpoint::kind_from_pc);
- set_gdbarch_sw_breakpoint_from_kind (gdbarch, loongarch_breakpoint::bp_from_kind);
+ set_gdbarch_breakpoint_kind_from_pc (gdbarch,
+ loongarch_breakpoint::kind_from_pc);
+ set_gdbarch_sw_breakpoint_from_kind (gdbarch,
+ loongarch_breakpoint::bp_from_kind);
/* Frame unwinders. Use DWARF debug info if available, otherwise use our own unwinder. */
set_gdbarch_dwarf2_reg_to_regnum (gdbarch, loongarch_dwarf2_reg_to_regnum);
@@ -1591,6 +1657,7 @@ loongarch_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
}
void _initialize_loongarch_tdep ();
+
void
_initialize_loongarch_tdep ()
{
diff --git a/gdb/m2-exp.h b/gdb/m2-exp.h
index 51c391f498b..5b05c4b7455 100644
--- a/gdb/m2-exp.h
+++ b/gdb/m2-exp.h
@@ -24,8 +24,7 @@
extern struct value *eval_op_m2_high (struct type *expect_type,
struct expression *exp,
- enum noside noside,
- struct value *arg1);
+ enum noside noside, struct value *arg1);
extern struct value *eval_op_m2_subscript (struct type *expect_type,
struct expression *exp,
enum noside noside,
@@ -36,24 +35,21 @@ namespace expr
{
/* The Modula-2 "HIGH" operation. */
-class m2_unop_high_operation
- : public tuple_holding_operation<operation_up>
+class m2_unop_high_operation : public tuple_holding_operation<operation_up>
{
public:
using tuple_holding_operation::tuple_holding_operation;
- value *evaluate (struct type *expect_type,
- struct expression *exp,
+ value *evaluate (struct type *expect_type, struct expression *exp,
enum noside noside) override
{
- value *arg1 = std::get<0> (m_storage)->evaluate_with_coercion (exp,
- noside);
+ value *arg1
+ = std::get<0> (m_storage)->evaluate_with_coercion (exp, noside);
return eval_op_m2_high (expect_type, exp, noside, arg1);
}
- enum exp_opcode opcode () const override
- { return UNOP_HIGH; }
+ enum exp_opcode opcode () const override { return UNOP_HIGH; }
};
/* Subscripting for Modula-2. */
@@ -64,19 +60,17 @@ public:
using tuple_holding_operation::tuple_holding_operation;
- value *evaluate (struct type *expect_type,
- struct expression *exp,
+ value *evaluate (struct type *expect_type, struct expression *exp,
enum noside noside) override
{
- value *arg1 = std::get<0> (m_storage)->evaluate_with_coercion (exp,
- noside);
- value *arg2 = std::get<1> (m_storage)->evaluate_with_coercion (exp,
- noside);
+ value *arg1
+ = std::get<0> (m_storage)->evaluate_with_coercion (exp, noside);
+ value *arg2
+ = std::get<1> (m_storage)->evaluate_with_coercion (exp, noside);
return eval_op_m2_subscript (expect_type, exp, noside, arg1, arg2);
}
- enum exp_opcode opcode () const override
- { return BINOP_SUBSCRIPT; }
+ enum exp_opcode opcode () const override { return BINOP_SUBSCRIPT; }
};
} /* namespace expr */
diff --git a/gdb/m2-lang.c b/gdb/m2-lang.c
index fe02c45fba5..f50dce6cafa 100644
--- a/gdb/m2-lang.c
+++ b/gdb/m2-lang.c
@@ -34,8 +34,7 @@
struct value *
eval_op_m2_high (struct type *expect_type, struct expression *exp,
- enum noside noside,
- struct value *arg1)
+ enum noside noside, struct value *arg1)
{
if (noside == EVAL_AVOID_SIDE_EFFECTS)
return arg1;
@@ -51,8 +50,8 @@ eval_op_m2_high (struct type *expect_type, struct expression *exp,
type = type->field (1).type ();
/* i18n: Do not translate the "_m2_high" part! */
arg1 = value_struct_elt (&temp, {}, "_m2_high", NULL,
- _("unbounded structure "
- "missing _m2_high field"));
+ _ ("unbounded structure "
+ "missing _m2_high field"));
if (value_type (arg1) != type)
arg1 = value_cast (type, arg1);
@@ -65,8 +64,8 @@ eval_op_m2_high (struct type *expect_type, struct expression *exp,
struct value *
eval_op_m2_subscript (struct type *expect_type, struct expression *exp,
- enum noside noside,
- struct value *arg1, struct value *arg2)
+ enum noside noside, struct value *arg1,
+ struct value *arg2)
{
/* If the user attempts to subscript something that is not an
array or pointer type (like a plain int variable for example),
@@ -80,28 +79,26 @@ eval_op_m2_subscript (struct type *expect_type, struct expression *exp,
struct value *temp = arg1;
type = type->field (0).type ();
if (type == NULL || (type->code () != TYPE_CODE_PTR))
- error (_("internal error: unbounded "
- "array structure is unknown"));
+ error (_ ("internal error: unbounded "
+ "array structure is unknown"));
/* i18n: Do not translate the "_m2_contents" part! */
arg1 = value_struct_elt (&temp, {}, "_m2_contents", NULL,
- _("unbounded structure "
- "missing _m2_contents field"));
-
+ _ ("unbounded structure "
+ "missing _m2_contents field"));
+
if (value_type (arg1) != type)
arg1 = value_cast (type, arg1);
check_typedef (value_type (arg1));
return value_ind (value_ptradd (arg1, value_as_long (arg2)));
}
- else
- if (type->code () != TYPE_CODE_ARRAY)
- {
- if (type->name ())
- error (_("cannot subscript something of type `%s'"),
- type->name ());
- else
- error (_("cannot subscript requested type"));
- }
+ else if (type->code () != TYPE_CODE_ARRAY)
+ {
+ if (type->name ())
+ error (_ ("cannot subscript something of type `%s'"), type->name ());
+ else
+ error (_ ("cannot subscript requested type"));
+ }
if (noside == EVAL_AVOID_SIDE_EFFECTS)
return value_zero (type->target_type (), VALUE_LVAL (arg1));
@@ -109,8 +106,6 @@ eval_op_m2_subscript (struct type *expect_type, struct expression *exp,
return value_subscript (arg1, value_as_long (arg2));
}
-
-
/* Single instance of the M2 language. */
static m2_language m2_language_defn;
@@ -124,10 +119,7 @@ m2_language::language_arch_info (struct gdbarch *gdbarch,
const struct builtin_m2_type *builtin = builtin_m2_type (gdbarch);
/* Helper function to allow shorter lines below. */
- auto add = [&] (struct type * t)
- {
- lai->add_primitive_type (t);
- };
+ auto add = [&] (struct type *t) { lai->add_primitive_type (t); };
add (builtin->builtin_char);
add (builtin->builtin_int);
@@ -142,8 +134,7 @@ m2_language::language_arch_info (struct gdbarch *gdbarch,
/* See languge.h. */
void
-m2_language::printchar (int c, struct type *type,
- struct ui_file *stream) const
+m2_language::printchar (int c, struct type *type, struct ui_file *stream) const
{
gdb_puts ("'", stream);
emitchar (c, type, stream, '\'');
@@ -154,9 +145,9 @@ m2_language::printchar (int c, struct type *type,
void
m2_language::printstr (struct ui_file *stream, struct type *elttype,
- const gdb_byte *string, unsigned int length,
- const char *encoding, int force_ellipses,
- const struct value_print_options *options) const
+ const gdb_byte *string, unsigned int length,
+ const char *encoding, int force_ellipses,
+ const struct value_print_options *options) const
{
unsigned int i;
unsigned int things_printed = 0;
@@ -230,10 +221,10 @@ m2_language::printstr (struct ui_file *stream, struct type *elttype,
/* See language.h. */
void
-m2_language::emitchar (int ch, struct type *chtype,
- struct ui_file *stream, int quoter) const
+m2_language::emitchar (int ch, struct type *chtype, struct ui_file *stream,
+ int quoter) const
{
- ch &= 0xFF; /* Avoid sign bit follies. */
+ ch &= 0xFF; /* Avoid sign bit follies. */
if (PRINT_LITERAL_FORM (ch))
{
diff --git a/gdb/m2-lang.h b/gdb/m2-lang.h
index cda6e241c8c..546948c7b04 100644
--- a/gdb/m2-lang.h
+++ b/gdb/m2-lang.h
@@ -52,19 +52,19 @@ extern const struct builtin_m2_type *builtin_m2_type (struct gdbarch *gdbarch);
class m2_language : public language_defn
{
public:
+
m2_language ()
: language_defn (language_m2)
- { /* Nothing. */ }
+ { /* Nothing. */
+ }
/* See language.h. */
- const char *name () const override
- { return "modula-2"; }
+ const char *name () const override { return "modula-2"; }
/* See language.h. */
- const char *natural_name () const override
- { return "Modula-2"; }
+ const char *natural_name () const override { return "Modula-2"; }
/* See language.h. */
@@ -82,9 +82,9 @@ public:
/* See language.h. */
- void value_print_inner (struct value *val, struct ui_file *stream,
- int recurse,
- const struct value_print_options *options) const override;
+ void
+ value_print_inner (struct value *val, struct ui_file *stream, int recurse,
+ const struct value_print_options *options) const override;
/* See language.h. */
@@ -92,8 +92,8 @@ public:
/* See language.h. */
- void emitchar (int ch, struct type *chtype,
- struct ui_file *stream, int quoter) const override;
+ void emitchar (int ch, struct type *chtype, struct ui_file *stream,
+ int quoter) const override;
/* See language.h. */
@@ -117,8 +117,7 @@ public:
bool is_string_type_p (struct type *type) const override
{
type = check_typedef (type);
- if (type->code () == TYPE_CODE_ARRAY
- && type->length () > 0
+ if (type->code () == TYPE_CODE_ARRAY && type->length () > 0
&& type->target_type ()->length () > 0)
{
struct type *elttype = check_typedef (type->target_type ());
@@ -134,19 +133,16 @@ public:
/* See language.h. */
- bool c_style_arrays_p () const override
- { return false; }
+ bool c_style_arrays_p () const override { return false; }
/* See language.h. Despite not having C-style arrays, Modula-2 uses 0
for its string lower bounds. */
- char string_lower_bound () const override
- { return 0; }
+ char string_lower_bound () const override { return 0; }
/* See language.h. */
- bool range_checking_on_by_default () const override
- { return true; }
+ bool range_checking_on_by_default () const override { return true; }
};
#endif /* M2_LANG_H */
diff --git a/gdb/m2-typeprint.c b/gdb/m2-typeprint.c
index 00a328852e9..d3610b058ed 100644
--- a/gdb/m2-typeprint.c
+++ b/gdb/m2-typeprint.c
@@ -19,7 +19,7 @@
#include "defs.h"
#include "language.h"
#include "gdbsupport/gdb_obstack.h"
-#include "bfd.h" /* Binary File Description */
+#include "bfd.h" /* Binary File Description */
#include "symtab.h"
#include "gdbtypes.h"
#include "expression.h"
@@ -34,9 +34,8 @@
#include "cp-abi.h"
#include "cli/cli-style.h"
-static void m2_print_bounds (struct type *type,
- struct ui_file *stream, int show, int level,
- int print_high);
+static void m2_print_bounds (struct type *type, struct ui_file *stream,
+ int show, int level, int print_high);
static void m2_typedef (struct type *, struct ui_file *, int, int,
const struct type_print_options *);
@@ -53,15 +52,16 @@ static void m2_enum (struct type *, struct ui_file *, int, int);
static void m2_range (struct type *, struct ui_file *, int, int,
const struct type_print_options *);
static void m2_type_name (struct type *type, struct ui_file *stream);
-static void m2_short_set (struct type *type, struct ui_file *stream,
- int show, int level);
-static int m2_long_set (struct type *type, struct ui_file *stream,
- int show, int level, const struct type_print_options *flags);
+static void m2_short_set (struct type *type, struct ui_file *stream, int show,
+ int level);
+static int m2_long_set (struct type *type, struct ui_file *stream, int show,
+ int level, const struct type_print_options *flags);
static int m2_unbounded_array (struct type *type, struct ui_file *stream,
int show, int level,
const struct type_print_options *flags);
static void m2_record_fields (struct type *type, struct ui_file *stream,
- int show, int level, const struct type_print_options *flags);
+ int show, int level,
+ const struct type_print_options *flags);
static void m2_unknown (const char *s, struct type *type,
struct ui_file *stream, int show, int level);
@@ -69,11 +69,9 @@ int m2_is_long_set (struct type *type);
int m2_is_long_set_of_type (struct type *type, struct type **of_type);
int m2_is_unbounded_array (struct type *type);
-
void
m2_print_type (struct type *type, const char *varstring,
- struct ui_file *stream,
- int show, int level,
+ struct ui_file *stream, int show, int level,
const struct type_print_options *flags)
{
type = check_typedef (type);
@@ -83,14 +81,14 @@ m2_print_type (struct type *type, const char *varstring,
stream->wrap_here (4);
if (type == NULL)
{
- fputs_styled (_("<type unknown>"), metadata_style.style (), stream);
+ fputs_styled (_ ("<type unknown>"), metadata_style.style (), stream);
return;
}
switch (type->code ())
{
case TYPE_CODE_SET:
- m2_short_set(type, stream, show, level);
+ m2_short_set (type, stream, show, level);
break;
case TYPE_CODE_STRUCT:
@@ -117,7 +115,7 @@ m2_print_type (struct type *type, const char *varstring,
break;
case TYPE_CODE_METHOD:
- m2_unknown (_("method"), type, stream, show, level);
+ m2_unknown (_ ("method"), type, stream, show, level);
break;
case TYPE_CODE_FUNC:
@@ -137,11 +135,11 @@ m2_print_type (struct type *type, const char *varstring,
case TYPE_CODE_UNDEF:
/* i18n: Do not translate the "struct" part! */
- m2_unknown (_("undef"), type, stream, show, level);
+ m2_unknown (_ ("undef"), type, stream, show, level);
break;
case TYPE_CODE_ERROR:
- m2_unknown (_("error"), type, stream, show, level);
+ m2_unknown (_ ("error"), type, stream, show, level);
break;
case TYPE_CODE_RANGE:
@@ -165,8 +163,8 @@ m2_language::print_typedef (struct type *type, struct symbol *new_symbol,
type = check_typedef (type);
gdb_printf (stream, "TYPE ");
if (!new_symbol->type ()->name ()
- || strcmp ((new_symbol->type ())->name (),
- new_symbol->linkage_name ()) != 0)
+ || strcmp ((new_symbol->type ())->name (), new_symbol->linkage_name ())
+ != 0)
gdb_printf (stream, "%s = ", new_symbol->print_name ());
else
gdb_printf (stream, "<builtin> = ");
@@ -186,15 +184,14 @@ m2_type_name (struct type *type, struct ui_file *stream)
/* m2_range - displays a Modula-2 subrange type. */
void
-m2_range (struct type *type, struct ui_file *stream, int show,
- int level, const struct type_print_options *flags)
+m2_range (struct type *type, struct ui_file *stream, int show, int level,
+ const struct type_print_options *flags)
{
if (type->bounds ()->high.const_val () == type->bounds ()->low.const_val ())
{
/* FIXME: type::target_type used to be TYPE_DOMAIN_TYPE but that was
wrong. Not sure if type::target_type is correct though. */
- m2_print_type (type->target_type (), "", stream, show, level,
- flags);
+ m2_print_type (type->target_type (), "", stream, show, level, flags);
}
else
{
@@ -209,8 +206,8 @@ m2_range (struct type *type, struct ui_file *stream, int show,
}
static void
-m2_typedef (struct type *type, struct ui_file *stream, int show,
- int level, const struct type_print_options *flags)
+m2_typedef (struct type *type, struct ui_file *stream, int show, int level,
+ const struct type_print_options *flags)
{
if (type->name () != NULL)
{
@@ -222,8 +219,9 @@ m2_typedef (struct type *type, struct ui_file *stream, int show,
/* m2_array - prints out a Modula-2 ARRAY ... OF type. */
-static void m2_array (struct type *type, struct ui_file *stream,
- int show, int level, const struct type_print_options *flags)
+static void
+m2_array (struct type *type, struct ui_file *stream, int show, int level,
+ const struct type_print_options *flags)
{
gdb_printf (stream, "ARRAY [");
if (type->target_type ()->length () > 0
@@ -237,7 +235,7 @@ static void m2_array (struct type *type, struct ui_file *stream,
}
else
gdb_puts (pulongest ((type->length ()
- / type->target_type ()->length ())),
+ / type->target_type ()->length ())),
stream);
}
gdb_printf (stream, "] OF ");
@@ -245,8 +243,8 @@ static void m2_array (struct type *type, struct ui_file *stream,
}
static void
-m2_pointer (struct type *type, struct ui_file *stream, int show,
- int level, const struct type_print_options *flags)
+m2_pointer (struct type *type, struct ui_file *stream, int show, int level,
+ const struct type_print_options *flags)
{
if (TYPE_CONST (type))
gdb_printf (stream, "[...] : ");
@@ -257,28 +255,29 @@ m2_pointer (struct type *type, struct ui_file *stream, int show,
}
static void
-m2_ref (struct type *type, struct ui_file *stream, int show,
- int level, const struct type_print_options *flags)
+m2_ref (struct type *type, struct ui_file *stream, int show, int level,
+ const struct type_print_options *flags)
{
gdb_printf (stream, "VAR");
m2_print_type (type->target_type (), "", stream, show, level, flags);
}
static void
-m2_unknown (const char *s, struct type *type, struct ui_file *stream,
- int show, int level)
+m2_unknown (const char *s, struct type *type, struct ui_file *stream, int show,
+ int level)
{
- gdb_printf (stream, "%s %s", s, _("is unknown"));
+ gdb_printf (stream, "%s %s", s, _ ("is unknown"));
}
-static void m2_union (struct type *type, struct ui_file *stream)
+static void
+m2_union (struct type *type, struct ui_file *stream)
{
gdb_printf (stream, "union");
}
static void
-m2_procedure (struct type *type, struct ui_file *stream,
- int show, int level, const struct type_print_options *flags)
+m2_procedure (struct type *type, struct ui_file *stream, int show, int level,
+ const struct type_print_options *flags)
{
gdb_printf (stream, "PROCEDURE ");
m2_type_name (type, stream);
@@ -306,9 +305,8 @@ m2_procedure (struct type *type, struct ui_file *stream,
}
static void
-m2_print_bounds (struct type *type,
- struct ui_file *stream, int show, int level,
- int print_high)
+m2_print_bounds (struct type *type, struct ui_file *stream, int show,
+ int level, int print_high)
{
struct type *target = type->target_type ();
@@ -324,27 +322,24 @@ m2_print_bounds (struct type *type,
static void
m2_short_set (struct type *type, struct ui_file *stream, int show, int level)
{
- gdb_printf(stream, "SET [");
- m2_print_bounds (type->index_type (), stream,
- show - 1, level, 0);
-
- gdb_printf(stream, "..");
- m2_print_bounds (type->index_type (), stream,
- show - 1, level, 1);
- gdb_printf(stream, "]");
+ gdb_printf (stream, "SET [");
+ m2_print_bounds (type->index_type (), stream, show - 1, level, 0);
+
+ gdb_printf (stream, "..");
+ m2_print_bounds (type->index_type (), stream, show - 1, level, 1);
+ gdb_printf (stream, "]");
}
int
m2_is_long_set (struct type *type)
{
- LONGEST previous_high = 0; /* Unnecessary initialization
+ LONGEST previous_high = 0; /* Unnecessary initialization
keeps gcc -Wall happy. */
int len, i;
struct type *range;
if (type->code () == TYPE_CODE_STRUCT)
{
-
/* check if all fields of the RECORD are consecutive sets. */
len = type->num_fields ();
@@ -363,7 +358,7 @@ m2_is_long_set (struct type *type)
return 0;
previous_high = range->bounds ()->high.const_val ();
}
- return len>0;
+ return len > 0;
}
return 0;
}
@@ -422,10 +417,10 @@ m2_is_long_set_of_type (struct type *type, struct type **of_type)
*of_type = target;
if (m2_get_discrete_bounds (target, &l2, &h2))
return (l1 == l2 && h1 == h2);
- error (_("long_set failed to find discrete bounds for its subtype"));
+ error (_ ("long_set failed to find discrete bounds for its subtype"));
return 0;
}
- error (_("expecting long_set"));
+ error (_ ("expecting long_set"));
return 0;
}
@@ -451,26 +446,26 @@ m2_long_set (struct type *type, struct ui_file *stream, int show, int level,
if (get_long_set_bounds (type, &low, &high))
{
- gdb_printf(stream, "SET OF ");
+ gdb_printf (stream, "SET OF ");
i = TYPE_N_BASECLASSES (type);
if (m2_is_long_set_of_type (type, &of_type))
m2_print_type (of_type, "", stream, show - 1, level, flags);
else
{
- gdb_printf(stream, "[");
- m2_print_bounds (type->field (i).type ()->index_type (),
- stream, show - 1, level, 0);
+ gdb_printf (stream, "[");
+ m2_print_bounds (type->field (i).type ()->index_type (), stream,
+ show - 1, level, 0);
- gdb_printf(stream, "..");
+ gdb_printf (stream, "..");
m2_print_bounds (type->field (len - 1).type ()->index_type (),
stream, show - 1, level, 1);
- gdb_printf(stream, "]");
+ gdb_printf (stream, "]");
}
}
else
/* i18n: Do not translate the "SET OF" part! */
- gdb_printf(stream, _("SET OF <unknown>"));
+ gdb_printf (stream, _ ("SET OF <unknown>"));
return 1;
}
@@ -518,8 +513,8 @@ m2_unbounded_array (struct type *type, struct ui_file *stream, int show,
if (show > 0)
{
gdb_puts ("ARRAY OF ", stream);
- m2_print_type (type->field (0).type ()->target_type (),
- "", stream, 0, level, flags);
+ m2_print_type (type->field (0).type ()->target_type (), "", stream,
+ 0, level, flags);
}
return 1;
}
@@ -557,19 +552,18 @@ m2_record_fields (struct type *type, struct ui_file *stream, int show,
gdb_printf (stream, "RECORD\n");
else if (type->code () == TYPE_CODE_UNION)
/* i18n: Do not translate "CASE" and "OF". */
- gdb_printf (stream, _("CASE <variant> OF\n"));
+ gdb_printf (stream, _ ("CASE <variant> OF\n"));
for (i = TYPE_N_BASECLASSES (type); i < len; i++)
{
QUIT;
print_spaces (level + 4, stream);
- fputs_styled (type->field (i).name (),
- variable_name_style.style (), stream);
+ fputs_styled (type->field (i).name (), variable_name_style.style (),
+ stream);
gdb_puts (" : ", stream);
- m2_print_type (type->field (i).type (),
- "",
- stream, 0, level + 4, flags);
+ m2_print_type (type->field (i).type (), "", stream, 0, level + 4,
+ flags);
if (TYPE_FIELD_PACKED (type, i))
{
/* It is a bitfield. This code does not attempt
@@ -577,12 +571,11 @@ m2_record_fields (struct type *type, struct ui_file *stream, int show,
unnamed fields. This would lead to misleading
results if the compiler does not put out fields
for such things (I don't know what it does). */
- gdb_printf (stream, " : %d",
- TYPE_FIELD_BITSIZE (type, i));
+ gdb_printf (stream, " : %d", TYPE_FIELD_BITSIZE (type, i));
}
gdb_printf (stream, ";\n");
}
-
+
gdb_printf (stream, "%*sEND ", level, "");
}
}
@@ -610,8 +603,8 @@ m2_enum (struct type *type, struct ui_file *stream, int show, int level)
if (i > 0)
gdb_printf (stream, ", ");
stream->wrap_here (4);
- fputs_styled (type->field (i).name (),
- variable_name_style.style (), stream);
+ fputs_styled (type->field (i).name (), variable_name_style.style (),
+ stream);
if (lastval != type->field (i).loc_enumval ())
{
gdb_printf (stream, " = %s",
diff --git a/gdb/m2-valprint.c b/gdb/m2-valprint.c
index e4335c188aa..613128129bd 100644
--- a/gdb/m2-valprint.c
+++ b/gdb/m2-valprint.c
@@ -30,16 +30,14 @@
#include "target.h"
#include "cli/cli-style.h"
-static int print_unpacked_pointer (struct type *type,
- CORE_ADDR address, CORE_ADDR addr,
+static int print_unpacked_pointer (struct type *type, CORE_ADDR address,
+ CORE_ADDR addr,
const struct value_print_options *options,
struct ui_file *stream);
-static void
-m2_print_array_contents (struct value *val,
- struct ui_file *stream, int recurse,
- const struct value_print_options *options,
- int len);
-
+static void m2_print_array_contents (struct value *val, struct ui_file *stream,
+ int recurse,
+ const struct value_print_options *options,
+ int len);
/* get_long_set_bounds - assigns the bounds of the long set to low and
high. */
@@ -59,7 +57,7 @@ get_long_set_bounds (struct type *type, LONGEST *low, LONGEST *high)
*high = type->field (len - 1).type ()->bounds ()->high.const_val ();
return 1;
}
- error (_("expecting long_set"));
+ error (_ ("expecting long_set"));
return 0;
}
@@ -68,10 +66,10 @@ m2_print_long_set (struct type *type, const gdb_byte *valaddr,
int embedded_offset, CORE_ADDR address,
struct ui_file *stream)
{
- int empty_set = 1;
- int element_seen = 0;
+ int empty_set = 1;
+ int element_seen = 0;
LONGEST previous_low = 0;
- LONGEST previous_high= 0;
+ LONGEST previous_high = 0;
LONGEST i, low_bound, high_bound;
LONGEST field_low, field_high;
struct type *range;
@@ -90,8 +88,8 @@ m2_print_long_set (struct type *type, const gdb_byte *valaddr,
}
else
{
- fprintf_styled (stream, metadata_style.style (),
- " %s }", _("<unknown bounds of set>"));
+ fprintf_styled (stream, metadata_style.style (), " %s }",
+ _ ("<unknown bounds of set>"));
return;
}
@@ -102,19 +100,20 @@ m2_print_long_set (struct type *type, const gdb_byte *valaddr,
for (i = low_bound; i <= high_bound; i++)
{
bitval = value_bit_index (type->field (field).type (),
- (type->field (field).loc_bitpos () / 8) +
- valaddr + embedded_offset, i);
+ (type->field (field).loc_bitpos () / 8)
+ + valaddr + embedded_offset,
+ i);
if (bitval < 0)
- error (_("bit test is out of range"));
+ error (_ ("bit test is out of range"));
else if (bitval > 0)
{
previous_high = i;
- if (! element_seen)
+ if (!element_seen)
{
- if (! empty_set)
+ if (!empty_set)
gdb_printf (stream, ", ");
print_type_scalar (target, i, stream);
- empty_set = 0;
+ empty_set = 0;
element_seen = 1;
previous_low = i;
}
@@ -124,9 +123,9 @@ m2_print_long_set (struct type *type, const gdb_byte *valaddr,
/* bit is not set */
if (element_seen)
{
- if (previous_low+1 < previous_high)
+ if (previous_low + 1 < previous_high)
gdb_printf (stream, "..");
- if (previous_low+1 < previous_high)
+ if (previous_low + 1 < previous_high)
print_type_scalar (target, previous_high, stream);
element_seen = 0;
}
@@ -144,7 +143,7 @@ m2_print_long_set (struct type *type, const gdb_byte *valaddr,
}
if (element_seen)
{
- if (previous_low+1 < previous_high)
+ if (previous_low + 1 < previous_high)
{
gdb_printf (stream, "..");
print_type_scalar (target, previous_high, stream);
@@ -156,8 +155,8 @@ m2_print_long_set (struct type *type, const gdb_byte *valaddr,
}
static void
-m2_print_unbounded_array (struct value *value,
- struct ui_file *stream, int recurse,
+m2_print_unbounded_array (struct value *value, struct ui_file *stream,
+ int recurse,
const struct value_print_options *options)
{
CORE_ADDR addr;
@@ -168,21 +167,18 @@ m2_print_unbounded_array (struct value *value,
const gdb_byte *valaddr = value_contents_for_printing (value).data ();
addr = unpack_pointer (type->field (0).type (),
- (type->field (0).loc_bitpos () / 8) +
- valaddr);
+ (type->field (0).loc_bitpos () / 8) + valaddr);
- val = value_at_lazy (type->field (0).type ()->target_type (),
- addr);
+ val = value_at_lazy (type->field (0).type ()->target_type (), addr);
len = unpack_field_as_long (type, valaddr, 1);
- gdb_printf (stream, "{");
+ gdb_printf (stream, "{");
m2_print_array_contents (val, stream, recurse, options, len);
gdb_printf (stream, ", HIGH = %d}", (int) len);
}
static int
-print_unpacked_pointer (struct type *type,
- CORE_ADDR address, CORE_ADDR addr,
+print_unpacked_pointer (struct type *type, CORE_ADDR address, CORE_ADDR addr,
const struct value_print_options *options,
struct ui_file *stream)
{
@@ -207,25 +203,21 @@ print_unpacked_pointer (struct type *type,
/* For a pointer to char or unsigned char, also print the string
pointed to, unless pointer is null. */
- if (elttype->length () == 1
- && elttype->code () == TYPE_CODE_INT
- && (options->format == 0 || options->format == 's')
- && addr != 0)
+ if (elttype->length () == 1 && elttype->code () == TYPE_CODE_INT
+ && (options->format == 0 || options->format == 's') && addr != 0)
{
if (want_space)
gdb_puts (" ", stream);
- return val_print_string (type->target_type (), NULL, addr, -1,
- stream, options);
+ return val_print_string (type->target_type (), NULL, addr, -1, stream,
+ options);
}
-
+
return 0;
}
static void
-print_variable_at_address (struct type *type,
- const gdb_byte *valaddr,
- struct ui_file *stream,
- int recurse,
+print_variable_at_address (struct type *type, const gdb_byte *valaddr,
+ struct ui_file *stream, int recurse,
const struct value_print_options *options)
{
struct gdbarch *gdbarch = type->arch ();
@@ -235,11 +227,11 @@ print_variable_at_address (struct type *type,
gdb_printf (stream, "[");
gdb_puts (paddress (gdbarch, addr), stream);
gdb_printf (stream, "] : ");
-
+
if (elttype->code () != TYPE_CODE_UNDEF)
{
- struct value *deref_val =
- value_at (type->target_type (), unpack_pointer (type, valaddr));
+ struct value *deref_val
+ = value_at (type->target_type (), unpack_pointer (type, valaddr));
common_val_print (deref_val, stream, recurse, options, current_language);
}
@@ -247,7 +239,6 @@ print_variable_at_address (struct type *type,
gdb_puts ("???", stream);
}
-
/* m2_print_array_contents - prints out the contents of an
array up to a max_print values.
It prints arrays of char as a string
@@ -255,22 +246,21 @@ print_variable_at_address (struct type *type,
separated values. */
static void
-m2_print_array_contents (struct value *val,
- struct ui_file *stream, int recurse,
- const struct value_print_options *options,
- int len)
+m2_print_array_contents (struct value *val, struct ui_file *stream,
+ int recurse,
+ const struct value_print_options *options, int len)
{
struct type *type = check_typedef (value_type (val));
if (type->length () > 0)
{
/* For an array of chars, print with string syntax. */
- if (type->length () == 1 &&
- ((type->code () == TYPE_CODE_INT)
- || ((current_language->la_language == language_m2)
- && (type->code () == TYPE_CODE_CHAR)))
+ if (type->length () == 1
+ && ((type->code () == TYPE_CODE_INT)
+ || ((current_language->la_language == language_m2)
+ && (type->code () == TYPE_CODE_CHAR)))
&& (options->format == 0 || options->format == 's'))
- val_print_string (type, NULL, value_address (val), len+1, stream,
+ val_print_string (type, NULL, value_address (val), len + 1, stream,
options);
else
{
@@ -283,24 +273,15 @@ m2_print_array_contents (struct value *val,
/* Decorations for Modula 2. */
-static const struct generic_val_print_decorations m2_decorations =
-{
- "",
- " + ",
- " * I",
- "TRUE",
- "FALSE",
- "void",
- "{",
- "}"
-};
+static const struct generic_val_print_decorations m2_decorations
+ = { "", " + ", " * I", "TRUE", "FALSE", "void", "{", "}" };
/* See m2-lang.h. */
void
-m2_language::value_print_inner (struct value *val, struct ui_file *stream,
- int recurse,
- const struct value_print_options *options) const
+m2_language::value_print_inner (
+ struct value *val, struct ui_file *stream, int recurse,
+ const struct value_print_options *options) const
{
unsigned len;
struct type *elttype;
@@ -317,10 +298,10 @@ m2_language::value_print_inner (struct value *val, struct ui_file *stream,
elttype = check_typedef (type->target_type ());
len = type->length () / elttype->length ();
/* For an array of chars, print with string syntax. */
- if (elttype->length () == 1 &&
- ((elttype->code () == TYPE_CODE_INT)
- || ((current_language->la_language == language_m2)
- && (elttype->code () == TYPE_CODE_CHAR)))
+ if (elttype->length () == 1
+ && ((elttype->code () == TYPE_CODE_INT)
+ || ((current_language->la_language == language_m2)
+ && (elttype->code () == TYPE_CODE_CHAR)))
&& (options->format == 0 || options->format == 's'))
{
/* If requested, look for the first null char and only print
@@ -331,22 +312,20 @@ m2_language::value_print_inner (struct value *val, struct ui_file *stream,
unsigned int temp_len;
/* Look for a NULL char. */
- for (temp_len = 0;
- (valaddr[temp_len]
- && temp_len < len
- && temp_len < print_max_chars);
- temp_len++);
+ for (temp_len = 0; (valaddr[temp_len] && temp_len < len
+ && temp_len < print_max_chars);
+ temp_len++)
+ ;
len = temp_len;
}
- printstr (stream, type->target_type (), valaddr, len,
- NULL, 0, options);
+ printstr (stream, type->target_type (), valaddr, len, NULL, 0,
+ options);
}
else
{
gdb_printf (stream, "{");
- value_print_array_elements (val, stream, recurse,
- options, 0);
+ value_print_array_elements (val, stream, recurse, options, 0);
gdb_printf (stream, "}");
}
break;
@@ -389,7 +368,7 @@ m2_language::value_print_inner (struct value *val, struct ui_file *stream,
if (elttype->is_stub ())
{
fprintf_styled (stream, metadata_style.style (),
- _("<incomplete type>"));
+ _ ("<incomplete type>"));
break;
}
else
@@ -405,7 +384,7 @@ m2_language::value_print_inner (struct value *val, struct ui_file *stream,
maybe_bad_bstring:
if (i < 0)
{
- fputs_styled (_("<error value>"), metadata_style.style (),
+ fputs_styled (_ ("<error value>"), metadata_style.style (),
stream);
goto done;
}
diff --git a/gdb/m32c-tdep.c b/gdb/m32c-tdep.c
index c2c37145de8..4ea7bba45fe 100644
--- a/gdb/m32c-tdep.c
+++ b/gdb/m32c-tdep.c
@@ -32,7 +32,6 @@
#include "objfiles.h"
#include "gdbarch.h"
-
/* The m32c tdep structure. */
static const reggroup *m32c_dma_reggroup;
@@ -85,7 +84,6 @@ struct m32c_reg
int n;
};
-
/* An overestimate of the number of raw and pseudoregisters we will
have. The exact answer depends on the variant of the architecture
at hand, but we can use this to declare statically allocated
@@ -95,12 +93,13 @@ struct m32c_reg
/* The largest assigned DWARF register number. */
#define M32C_MAX_DWARF_REGNUM (40)
-
struct m32c_gdbarch_tdep : gdbarch_tdep_base
{
/* All the registers for this variant, indexed by GDB register
number, and the number of registers present. */
- struct m32c_reg regs[M32C_MAX_NUM_REGS] {};
+ struct m32c_reg regs[M32C_MAX_NUM_REGS]
+ {
+ };
/* The number of valid registers. */
int num_regs = 0;
@@ -108,7 +107,7 @@ struct m32c_gdbarch_tdep : gdbarch_tdep_base
/* Interesting registers. These are pointers into REGS. */
struct m32c_reg *pc = nullptr, *flg = nullptr;
struct m32c_reg *r0 = nullptr, *r1 = nullptr, *r2 = nullptr, *r3 = nullptr,
- *a0 = nullptr, *a1 = nullptr;
+ *a0 = nullptr, *a1 = nullptr;
struct m32c_reg *r2r0 = nullptr, *r3r2r1r0 = nullptr, *r3r1r2r0 = nullptr;
struct m32c_reg *sb = nullptr, *fb = nullptr, *sp = nullptr;
@@ -122,7 +121,7 @@ struct m32c_gdbarch_tdep : gdbarch_tdep_base
struct type *voyd = nullptr, *ptr_voyd = nullptr, *func_voyd = nullptr;
struct type *uint8 = nullptr, *uint16 = nullptr;
struct type *int8 = nullptr, *int16 = nullptr, *int32 = nullptr,
- *int64 = nullptr;
+ *int64 = nullptr;
/* The types for data address and code address registers. */
struct type *data_addr_reg_type = nullptr, *code_addr_reg_type = nullptr;
@@ -136,7 +135,6 @@ struct m32c_gdbarch_tdep : gdbarch_tdep_base
int push_addr_bytes = 0;
};
-
/* Types. */
static void
@@ -200,16 +198,14 @@ make_types (struct gdbarch *arch)
tdep->code_addr_reg_type
= arch_pointer_type (arch, code_addr_reg_bits, type_name, tdep->func_voyd);
- tdep->uint8 = arch_integer_type (arch, 8, 1, "uint8_t");
+ tdep->uint8 = arch_integer_type (arch, 8, 1, "uint8_t");
tdep->uint16 = arch_integer_type (arch, 16, 1, "uint16_t");
- tdep->int8 = arch_integer_type (arch, 8, 0, "int8_t");
- tdep->int16 = arch_integer_type (arch, 16, 0, "int16_t");
- tdep->int32 = arch_integer_type (arch, 32, 0, "int32_t");
- tdep->int64 = arch_integer_type (arch, 64, 0, "int64_t");
+ tdep->int8 = arch_integer_type (arch, 8, 0, "int8_t");
+ tdep->int16 = arch_integer_type (arch, 16, 0, "int16_t");
+ tdep->int32 = arch_integer_type (arch, 32, 0, "int32_t");
+ tdep->int64 = arch_integer_type (arch, 64, 0, "int64_t");
}
-
-
/* Register set. */
static const char *
@@ -219,7 +215,6 @@ m32c_register_name (struct gdbarch *gdbarch, int num)
return tdep->regs[num].name;
}
-
static struct type *
m32c_register_type (struct gdbarch *arch, int reg_nr)
{
@@ -227,7 +222,6 @@ m32c_register_type (struct gdbarch *arch, int reg_nr)
return tdep->regs[reg_nr].type;
}
-
static int
m32c_register_sim_regno (struct gdbarch *gdbarch, int reg_nr)
{
@@ -235,7 +229,6 @@ m32c_register_sim_regno (struct gdbarch *gdbarch, int reg_nr)
return tdep->regs[reg_nr].sim_num;
}
-
static int
m32c_debug_info_reg_to_regnum (struct gdbarch *gdbarch, int reg_nr)
{
@@ -249,7 +242,6 @@ m32c_debug_info_reg_to_regnum (struct gdbarch *gdbarch, int reg_nr)
return -1;
}
-
static int
m32c_register_reggroup_p (struct gdbarch *gdbarch, int regnum,
const struct reggroup *group)
@@ -258,22 +250,19 @@ m32c_register_reggroup_p (struct gdbarch *gdbarch, int regnum,
struct m32c_reg *reg = &tdep->regs[regnum];
/* The anonymous raw registers aren't in any groups. */
- if (! reg->name)
+ if (!reg->name)
return 0;
if (group == all_reggroup)
return 1;
- if (group == general_reggroup
- && reg->general_p)
+ if (group == general_reggroup && reg->general_p)
return 1;
- if (group == m32c_dma_reggroup
- && reg->dma_p)
+ if (group == m32c_dma_reggroup && reg->dma_p)
return 1;
- if (group == system_reggroup
- && reg->system_p)
+ if (group == system_reggroup && reg->system_p)
return 1;
/* Since the m32c DWARF register numbers refer to cooked registers, not
@@ -281,15 +270,13 @@ m32c_register_reggroup_p (struct gdbarch *gdbarch, int regnum,
containing registers the DWARF CFI will actually mention, our save
and restore groups are cooked registers, not raw registers. (This is
why we can't use the default reggroup function.) */
- if ((group == save_reggroup
- || group == restore_reggroup)
+ if ((group == save_reggroup || group == restore_reggroup)
&& reg->save_restore_p)
return 1;
return 0;
}
-
/* Register move functions. We declare them here using
m32c_{read,write}_reg_t to check the types. */
static m32c_read_reg_t m32c_raw_read;
@@ -313,7 +300,6 @@ m32c_raw_read (struct m32c_reg *reg, readable_regcache *cache, gdb_byte *buf)
return cache->raw_read (reg->num, buf);
}
-
/* Copy the value of the raw register REG from BUF to CACHE. */
static enum register_status
m32c_raw_write (struct m32c_reg *reg, struct regcache *cache,
@@ -324,7 +310,6 @@ m32c_raw_write (struct m32c_reg *reg, struct regcache *cache,
return REG_VALID;
}
-
/* Return the value of the 'flg' register in CACHE. */
static int
m32c_read_flg (readable_regcache *cache)
@@ -337,7 +322,6 @@ m32c_read_flg (readable_regcache *cache)
return flg & 0xffff;
}
-
/* Evaluate the real register number of a banked register. */
static struct m32c_reg *
m32c_banked_register (struct m32c_reg *reg, readable_regcache *cache)
@@ -345,19 +329,18 @@ m32c_banked_register (struct m32c_reg *reg, readable_regcache *cache)
return ((m32c_read_flg (cache) & reg->n) ? reg->ry : reg->rx);
}
-
/* Move the value of a banked register from CACHE to BUF.
If the value of the 'flg' register in CACHE has any of the bits
masked in REG->n set, then read REG->ry. Otherwise, read
REG->rx. */
static enum register_status
-m32c_banked_read (struct m32c_reg *reg, readable_regcache *cache, gdb_byte *buf)
+m32c_banked_read (struct m32c_reg *reg, readable_regcache *cache,
+ gdb_byte *buf)
{
struct m32c_reg *bank_reg = m32c_banked_register (reg, cache);
return cache->raw_read (bank_reg->num, buf);
}
-
/* Move the value of a banked register from BUF to CACHE.
If the value of the 'flg' register in CACHE has any of the bits
masked in REG->n set, then write REG->ry. Otherwise, write
@@ -372,7 +355,6 @@ m32c_banked_write (struct m32c_reg *reg, struct regcache *cache,
return REG_VALID;
}
-
/* Move the value of SB from CACHE to BUF. On bfd_mach_m32c, SB is a
banked register; on bfd_mach_m16c, it's not. */
static enum register_status
@@ -384,11 +366,11 @@ m32c_sb_read (struct m32c_reg *reg, readable_regcache *cache, gdb_byte *buf)
return m32c_banked_read (reg, cache, buf);
}
-
/* Move the value of SB from BUF to CACHE. On bfd_mach_m32c, SB is a
banked register; on bfd_mach_m16c, it's not. */
static enum register_status
-m32c_sb_write (struct m32c_reg *reg, struct regcache *cache, const gdb_byte *buf)
+m32c_sb_write (struct m32c_reg *reg, struct regcache *cache,
+ const gdb_byte *buf)
{
if (gdbarch_bfd_arch_info (reg->arch)->mach == bfd_mach_m16c)
m32c_raw_write (reg->rx, cache, buf);
@@ -398,7 +380,6 @@ m32c_sb_write (struct m32c_reg *reg, struct regcache *cache, const gdb_byte *buf
return REG_VALID;
}
-
/* Assuming REG uses m32c_part_read and m32c_part_write, set *OFFSET_P
and *LEN_P to the offset and length, in bytes, of the part REG
occupies in its underlying register. The offset is from the
@@ -435,7 +416,6 @@ m32c_find_part (struct m32c_reg *reg, int *offset_p, int *len_p)
*len_p = elt_len;
}
-
/* Move the value of a partial register (r0h, intbl, etc.) from CACHE
to BUF. Treating the value of the register REG->rx as an array of
REG->type values, where higher indices refer to more significant
@@ -450,7 +430,6 @@ m32c_part_read (struct m32c_reg *reg, readable_regcache *cache, gdb_byte *buf)
return cache->cooked_read_part (reg->rx->num, offset, len, buf);
}
-
/* Move the value of a banked register from BUF to CACHE.
Treating the value of the register REG->rx as an array of REG->type
values, where higher indices refer to more significant bits, write
@@ -467,7 +446,6 @@ m32c_part_write (struct m32c_reg *reg, struct regcache *cache,
return REG_VALID;
}
-
/* Move the value of REG from CACHE to BUF. REG's value is the
concatenation of the values of the registers REG->rx and REG->ry,
with REG->rx contributing the more significant bits. */
@@ -475,7 +453,7 @@ static enum register_status
m32c_cat_read (struct m32c_reg *reg, readable_regcache *cache, gdb_byte *buf)
{
int high_bytes = reg->rx->type->length ();
- int low_bytes = reg->ry->type->length ();
+ int low_bytes = reg->ry->type->length ();
enum register_status status;
gdb_assert (reg->type->length () == high_bytes + low_bytes);
@@ -495,7 +473,6 @@ m32c_cat_read (struct m32c_reg *reg, readable_regcache *cache, gdb_byte *buf)
return status;
}
-
/* Move the value of REG from CACHE to BUF. REG's value is the
concatenation of the values of the registers REG->rx and REG->ry,
with REG->rx contributing the more significant bits. */
@@ -504,7 +481,7 @@ m32c_cat_write (struct m32c_reg *reg, struct regcache *cache,
const gdb_byte *buf)
{
int high_bytes = reg->rx->type->length ();
- int low_bytes = reg->ry->type->length ();
+ int low_bytes = reg->ry->type->length ();
gdb_assert (reg->type->length () == high_bytes + low_bytes);
@@ -522,12 +499,12 @@ m32c_cat_write (struct m32c_reg *reg, struct regcache *cache,
return REG_VALID;
}
-
/* Copy the value of the raw register REG from CACHE to BUF. REG is
the concatenation (from most significant to least) of r3, r2, r1,
and r0. */
static enum register_status
-m32c_r3r2r1r0_read (struct m32c_reg *reg, readable_regcache *cache, gdb_byte *buf)
+m32c_r3r2r1r0_read (struct m32c_reg *reg, readable_regcache *cache,
+ gdb_byte *buf)
{
gdbarch *arch = reg->arch;
m32c_gdbarch_tdep *tdep = gdbarch_tdep<m32c_gdbarch_tdep> (arch);
@@ -558,7 +535,6 @@ m32c_r3r2r1r0_read (struct m32c_reg *reg, readable_regcache *cache, gdb_byte *bu
return status;
}
-
/* Copy the value of the raw register REG from BUF to CACHE. REG is
the concatenation (from most significant to least) of r3, r2, r1,
and r0. */
@@ -588,12 +564,9 @@ m32c_r3r2r1r0_write (struct m32c_reg *reg, struct regcache *cache,
return REG_VALID;
}
-
static enum register_status
-m32c_pseudo_register_read (struct gdbarch *arch,
- readable_regcache *cache,
- int cookednum,
- gdb_byte *buf)
+m32c_pseudo_register_read (struct gdbarch *arch, readable_regcache *cache,
+ int cookednum, gdb_byte *buf)
{
m32c_gdbarch_tdep *tdep = gdbarch_tdep<m32c_gdbarch_tdep> (arch);
struct m32c_reg *reg;
@@ -606,12 +579,9 @@ m32c_pseudo_register_read (struct gdbarch *arch,
return reg->read (reg, cache, buf);
}
-
static void
-m32c_pseudo_register_write (struct gdbarch *arch,
- struct regcache *cache,
- int cookednum,
- const gdb_byte *buf)
+m32c_pseudo_register_write (struct gdbarch *arch, struct regcache *cache,
+ int cookednum, const gdb_byte *buf)
{
m32c_gdbarch_tdep *tdep = gdbarch_tdep<m32c_gdbarch_tdep> (arch);
struct m32c_reg *reg;
@@ -624,47 +594,39 @@ m32c_pseudo_register_write (struct gdbarch *arch,
reg->write (reg, cache, buf);
}
-
/* Add a register with the given fields to the end of ARCH's table.
Return a pointer to the newly added register. */
static struct m32c_reg *
-add_reg (struct gdbarch *arch,
- const char *name,
- struct type *type,
- int sim_num,
- m32c_read_reg_t *read,
- m32c_write_reg_t *write,
- struct m32c_reg *rx,
- struct m32c_reg *ry,
- int n)
+add_reg (struct gdbarch *arch, const char *name, struct type *type,
+ int sim_num, m32c_read_reg_t *read, m32c_write_reg_t *write,
+ struct m32c_reg *rx, struct m32c_reg *ry, int n)
{
m32c_gdbarch_tdep *tdep = gdbarch_tdep<m32c_gdbarch_tdep> (arch);
struct m32c_reg *r = &tdep->regs[tdep->num_regs];
gdb_assert (tdep->num_regs < M32C_MAX_NUM_REGS);
- r->name = name;
- r->type = type;
- r->arch = arch;
- r->num = tdep->num_regs;
- r->sim_num = sim_num;
- r->dwarf_num = -1;
- r->general_p = 0;
- r->dma_p = 0;
- r->system_p = 0;
+ r->name = name;
+ r->type = type;
+ r->arch = arch;
+ r->num = tdep->num_regs;
+ r->sim_num = sim_num;
+ r->dwarf_num = -1;
+ r->general_p = 0;
+ r->dma_p = 0;
+ r->system_p = 0;
r->save_restore_p = 0;
- r->read = read;
- r->write = write;
- r->rx = rx;
- r->ry = ry;
- r->n = n;
+ r->read = read;
+ r->write = write;
+ r->rx = rx;
+ r->ry = ry;
+ r->n = n;
tdep->num_regs++;
return r;
}
-
/* Record NUM as REG's DWARF register number. */
static void
set_dwarf_regnum (struct m32c_reg *reg, int num)
@@ -682,7 +644,6 @@ set_dwarf_regnum (struct m32c_reg *reg, int num)
tdep->dwarf_regs[num] = reg;
}
-
/* Mark REG as a general-purpose register, and return it. */
static struct m32c_reg *
mark_general (struct m32c_reg *reg)
@@ -691,7 +652,6 @@ mark_general (struct m32c_reg *reg)
return reg;
}
-
/* Mark REG as a DMA register. */
static void
mark_dma (struct m32c_reg *reg)
@@ -699,7 +659,6 @@ mark_dma (struct m32c_reg *reg)
reg->dma_p = 1;
}
-
/* Mark REG as a SYSTEM register, and return it. */
static struct m32c_reg *
mark_system (struct m32c_reg *reg)
@@ -708,7 +667,6 @@ mark_system (struct m32c_reg *reg)
return reg;
}
-
/* Mark REG as a save-restore register, and return it. */
static struct m32c_reg *
mark_save_restore (struct m32c_reg *reg)
@@ -717,84 +675,79 @@ mark_save_restore (struct m32c_reg *reg)
return reg;
}
-
-#define FLAGBIT_B 0x0010
-#define FLAGBIT_U 0x0080
+#define FLAGBIT_B 0x0010
+#define FLAGBIT_U 0x0080
/* Handy macros for declaring registers. These all evaluate to
pointers to the register declared. Macros that define two
registers evaluate to a pointer to the first. */
/* A raw register named NAME, with type TYPE and sim number SIM_NUM. */
-#define R(name, type, sim_num) \
- (add_reg (arch, (name), (type), (sim_num), \
- m32c_raw_read, m32c_raw_write, NULL, NULL, 0))
+#define R(name, type, sim_num) \
+ (add_reg (arch, (name), (type), (sim_num), m32c_raw_read, m32c_raw_write, \
+ NULL, NULL, 0))
/* The simulator register number for a raw register named NAME. */
-#define SIM(name) (m32c_sim_reg_ ## name)
+#define SIM(name) (m32c_sim_reg_##name)
/* A raw unsigned 16-bit data register named NAME.
NAME should be an identifier, not a string. */
-#define R16U(name) \
- (R(#name, tdep->uint16, SIM (name)))
+#define R16U(name) (R (#name, tdep->uint16, SIM (name)))
/* A raw data address register named NAME.
NAME should be an identifier, not a string. */
-#define RA(name) \
- (R(#name, tdep->data_addr_reg_type, SIM (name)))
+#define RA(name) (R (#name, tdep->data_addr_reg_type, SIM (name)))
/* A raw code address register named NAME. NAME should
be an identifier, not a string. */
-#define RC(name) \
- (R(#name, tdep->code_addr_reg_type, SIM (name)))
+#define RC(name) (R (#name, tdep->code_addr_reg_type, SIM (name)))
/* A pair of raw registers named NAME0 and NAME1, with type TYPE.
NAME should be an identifier, not a string. */
-#define RP(name, type) \
- (R(#name "0", (type), SIM (name ## 0)), \
- R(#name "1", (type), SIM (name ## 1)) - 1)
+#define RP(name, type) \
+ (R (#name "0", (type), SIM (name##0)), \
+ R (#name "1", (type), SIM (name##1)) - 1)
/* A raw banked general-purpose data register named NAME.
NAME should be an identifier, not a string. */
-#define RBD(name) \
- (R("", tdep->int16, SIM (name ## _bank0)), \
- R("", tdep->int16, SIM (name ## _bank1)) - 1)
+#define RBD(name) \
+ (R ("", tdep->int16, SIM (name##_bank0)), \
+ R ("", tdep->int16, SIM (name##_bank1)) - 1)
/* A raw banked data address register named NAME.
NAME should be an identifier, not a string. */
-#define RBA(name) \
- (R("", tdep->data_addr_reg_type, SIM (name ## _bank0)), \
- R("", tdep->data_addr_reg_type, SIM (name ## _bank1)) - 1)
+#define RBA(name) \
+ (R ("", tdep->data_addr_reg_type, SIM (name##_bank0)), \
+ R ("", tdep->data_addr_reg_type, SIM (name##_bank1)) - 1)
/* A cooked register named NAME referring to a raw banked register
from the bank selected by the current value of FLG. RAW_PAIR
should be a pointer to the first register in the banked pair.
NAME must be an identifier, not a string. */
-#define CB(name, raw_pair) \
- (add_reg (arch, #name, (raw_pair)->type, 0, \
- m32c_banked_read, m32c_banked_write, \
- (raw_pair), (raw_pair + 1), FLAGBIT_B))
+#define CB(name, raw_pair) \
+ (add_reg (arch, #name, (raw_pair)->type, 0, m32c_banked_read, \
+ m32c_banked_write, (raw_pair), (raw_pair + 1), FLAGBIT_B))
/* A pair of registers named NAMEH and NAMEL, of type TYPE, that
access the top and bottom halves of the register pointed to by
NAME. NAME should be an identifier. */
-#define CHL(name, type) \
- (add_reg (arch, #name "h", (type), 0, \
- m32c_part_read, m32c_part_write, name, NULL, 1), \
- add_reg (arch, #name "l", (type), 0, \
- m32c_part_read, m32c_part_write, name, NULL, 0) - 1)
+#define CHL(name, type) \
+ (add_reg (arch, #name "h", (type), 0, m32c_part_read, m32c_part_write, \
+ name, NULL, 1), \
+ add_reg (arch, #name "l", (type), 0, m32c_part_read, m32c_part_write, \
+ name, NULL, 0) \
+ - 1)
/* A register constructed by concatenating the two registers HIGH and
LOW, whose name is HIGHLOW and whose type is TYPE. */
-#define CCAT(high, low, type) \
- (add_reg (arch, #high #low, (type), 0, \
- m32c_cat_read, m32c_cat_write, (high), (low), 0))
+#define CCAT(high, low, type) \
+ (add_reg (arch, #high #low, (type), 0, m32c_cat_read, m32c_cat_write, \
+ (high), (low), 0))
/* Abbreviations for marking register group membership. */
-#define G(reg) (mark_general (reg))
-#define S(reg) (mark_system (reg))
-#define DMA(reg) (mark_dma (reg))
-
+#define G(reg) (mark_general (reg))
+#define S(reg) (mark_system (reg))
+#define DMA(reg) (mark_dma (reg))
/* Construct the register set for ARCH. */
static void
@@ -835,11 +788,11 @@ make_regs (struct gdbarch *arch)
in the pseudoregister. */
struct m32c_reg *raw_sb_pair = RBA (sb);
- struct m32c_reg *usp = S (RA (usp));
- struct m32c_reg *isp = S (RA (isp));
- struct m32c_reg *intb = S (RC (intb));
- struct m32c_reg *pc = G (RC (pc));
- struct m32c_reg *flg = G (R16U (flg));
+ struct m32c_reg *usp = S (RA (usp));
+ struct m32c_reg *isp = S (RA (isp));
+ struct m32c_reg *intb = S (RC (intb));
+ struct m32c_reg *pc = G (RC (pc));
+ struct m32c_reg *flg = G (R16U (flg));
if (mach == bfd_mach_m32c)
{
@@ -857,39 +810,36 @@ make_regs (struct gdbarch *arch)
num_raw_regs = tdep->num_regs;
- r0 = G (CB (r0, raw_r0_pair));
- r1 = G (CB (r1, raw_r1_pair));
- r2 = G (CB (r2, raw_r2_pair));
- r3 = G (CB (r3, raw_r3_pair));
- a0 = G (CB (a0, raw_a0_pair));
- a1 = G (CB (a1, raw_a1_pair));
- fb = G (CB (fb, raw_fb_pair));
+ r0 = G (CB (r0, raw_r0_pair));
+ r1 = G (CB (r1, raw_r1_pair));
+ r2 = G (CB (r2, raw_r2_pair));
+ r3 = G (CB (r3, raw_r3_pair));
+ a0 = G (CB (a0, raw_a0_pair));
+ a1 = G (CB (a1, raw_a1_pair));
+ fb = G (CB (fb, raw_fb_pair));
/* sb is banked on the bfd_mach_m32c, but not on bfd_mach_m16c.
Specify custom read/write functions that do the right thing. */
- sb = G (add_reg (arch, "sb", raw_sb_pair->type, 0,
- m32c_sb_read, m32c_sb_write,
- raw_sb_pair, raw_sb_pair + 1, 0));
+ sb = G (add_reg (arch, "sb", raw_sb_pair->type, 0, m32c_sb_read,
+ m32c_sb_write, raw_sb_pair, raw_sb_pair + 1, 0));
/* The current sp is either usp or isp, depending on the value of
the FLG register's U bit. */
- sp = G (add_reg (arch, "sp", usp->type, 0,
- m32c_banked_read, m32c_banked_write,
- isp, usp, FLAGBIT_U));
+ sp = G (add_reg (arch, "sp", usp->type, 0, m32c_banked_read,
+ m32c_banked_write, isp, usp, FLAGBIT_U));
- r0hl = CHL (r0, tdep->int8);
- r1hl = CHL (r1, tdep->int8);
+ r0hl = CHL (r0, tdep->int8);
+ r1hl = CHL (r1, tdep->int8);
CHL (r2, tdep->int8);
CHL (r3, tdep->int8);
CHL (intb, tdep->int16);
- r2r0 = CCAT (r2, r0, tdep->int32);
- r3r1 = CCAT (r3, r1, tdep->int32);
- r3r1r2r0 = CCAT (r3r1, r2r0, tdep->int64);
+ r2r0 = CCAT (r2, r0, tdep->int32);
+ r3r1 = CCAT (r3, r1, tdep->int32);
+ r3r1r2r0 = CCAT (r3r1, r2r0, tdep->int64);
- r3r2r1r0
- = add_reg (arch, "r3r2r1r0", tdep->int64, 0,
- m32c_r3r2r1r0_read, m32c_r3r2r1r0_write, NULL, NULL, 0);
+ r3r2r1r0 = add_reg (arch, "r3r2r1r0", tdep->int64, 0, m32c_r3r2r1r0_read,
+ m32c_r3r2r1r0_write, NULL, NULL, 0);
if (mach == bfd_mach_m16c)
a1a0 = CCAT (a1, a0, tdep->int32);
@@ -898,20 +848,20 @@ make_regs (struct gdbarch *arch)
num_cooked_regs = tdep->num_regs - num_raw_regs;
- tdep->pc = pc;
- tdep->flg = flg;
- tdep->r0 = r0;
- tdep->r1 = r1;
- tdep->r2 = r2;
- tdep->r3 = r3;
- tdep->r2r0 = r2r0;
+ tdep->pc = pc;
+ tdep->flg = flg;
+ tdep->r0 = r0;
+ tdep->r1 = r1;
+ tdep->r2 = r2;
+ tdep->r3 = r3;
+ tdep->r2r0 = r2r0;
tdep->r3r2r1r0 = r3r2r1r0;
tdep->r3r1r2r0 = r3r1r2r0;
- tdep->a0 = a0;
- tdep->a1 = a1;
- tdep->sb = sb;
- tdep->fb = fb;
- tdep->sp = sp;
+ tdep->a0 = a0;
+ tdep->a1 = a1;
+ tdep->sb = sb;
+ tdep->fb = fb;
+ tdep->sp = sp;
/* Set up the DWARF register table. */
memset (tdep->dwarf_regs, 0, sizeof (tdep->dwarf_regs));
@@ -919,20 +869,20 @@ make_regs (struct gdbarch *arch)
set_dwarf_regnum (r0hl + 0, 0x02);
set_dwarf_regnum (r1hl + 1, 0x03);
set_dwarf_regnum (r1hl + 0, 0x04);
- set_dwarf_regnum (r0, 0x05);
- set_dwarf_regnum (r1, 0x06);
- set_dwarf_regnum (r2, 0x07);
- set_dwarf_regnum (r3, 0x08);
- set_dwarf_regnum (a0, 0x09);
- set_dwarf_regnum (a1, 0x0a);
- set_dwarf_regnum (fb, 0x0b);
- set_dwarf_regnum (sp, 0x0c);
- set_dwarf_regnum (pc, 0x0d); /* GCC's invention */
- set_dwarf_regnum (sb, 0x13);
- set_dwarf_regnum (r2r0, 0x15);
- set_dwarf_regnum (r3r1, 0x16);
+ set_dwarf_regnum (r0, 0x05);
+ set_dwarf_regnum (r1, 0x06);
+ set_dwarf_regnum (r2, 0x07);
+ set_dwarf_regnum (r3, 0x08);
+ set_dwarf_regnum (a0, 0x09);
+ set_dwarf_regnum (a1, 0x0a);
+ set_dwarf_regnum (fb, 0x0b);
+ set_dwarf_regnum (sp, 0x0c);
+ set_dwarf_regnum (pc, 0x0d); /* GCC's invention */
+ set_dwarf_regnum (sb, 0x13);
+ set_dwarf_regnum (r2r0, 0x15);
+ set_dwarf_regnum (r3r1, 0x16);
if (a1a0)
- set_dwarf_regnum (a1a0, 0x17);
+ set_dwarf_regnum (a1a0, 0x17);
/* Enumerate the save/restore register group.
@@ -984,14 +934,11 @@ make_regs (struct gdbarch *arch)
reggroup_add (arch, m32c_dma_reggroup);
}
-
-
/* Breakpoints. */
-constexpr gdb_byte m32c_break_insn[] = { 0x00 }; /* brk */
+constexpr gdb_byte m32c_break_insn[] = { 0x00 }; /* brk */
typedef BP_MANIPULATION (m32c_break_insn) m32c_breakpoint;
-
/* Prologue analysis. */
enum m32c_prologue_kind
@@ -1049,7 +996,6 @@ struct m32c_prologue
LONGEST reg_offset[M32C_MAX_NUM_REGS];
};
-
/* The longest I've seen, anyway. */
#define M32C_MAX_INSN_LEN (9)
@@ -1069,7 +1015,6 @@ struct m32c_pv_state
CORE_ADDR scan_pc, next_addr;
};
-
/* Push VALUE on STATE's stack, occupying SIZE bytes. Return zero if
all went well, or non-zero if simulating the action would trash our
state. */
@@ -1085,7 +1030,6 @@ m32c_pv_push (struct m32c_pv_state *state, pv_t value, int size)
return 0;
}
-
enum srcdest_kind
{
srcdest_reg,
@@ -1105,7 +1049,6 @@ struct srcdest
pv_t *reg, addr;
};
-
/* Return the SIZE-byte value at LOC in STATE. */
static pv_t
m32c_srcdest_fetch (struct m32c_pv_state *state, struct srcdest loc, int size)
@@ -1118,7 +1061,6 @@ m32c_srcdest_fetch (struct m32c_pv_state *state, struct srcdest loc, int size)
return *loc.reg;
}
-
/* Write VALUE, a SIZE-byte value, to LOC in STATE. Return zero if
all went well, or non-zero if simulating the store would trash our
state. */
@@ -1140,7 +1082,6 @@ m32c_srcdest_store (struct m32c_pv_state *state, struct srcdest loc,
return 0;
}
-
static int
m32c_sign_ext (int v, int bits)
{
@@ -1161,66 +1102,56 @@ m32c_udisp8 (struct m32c_pv_state *st)
return m32c_next_byte (st);
}
-
static int
m32c_sdisp8 (struct m32c_pv_state *st)
{
return m32c_sign_ext (m32c_next_byte (st), 8);
}
-
static int
m32c_udisp16 (struct m32c_pv_state *st)
{
- int low = m32c_next_byte (st);
+ int low = m32c_next_byte (st);
int high = m32c_next_byte (st);
return low + (high << 8);
}
-
static int
m32c_sdisp16 (struct m32c_pv_state *st)
{
- int low = m32c_next_byte (st);
+ int low = m32c_next_byte (st);
int high = m32c_next_byte (st);
return m32c_sign_ext (low + (high << 8), 16);
}
-
static int
m32c_udisp24 (struct m32c_pv_state *st)
{
- int low = m32c_next_byte (st);
- int mid = m32c_next_byte (st);
+ int low = m32c_next_byte (st);
+ int mid = m32c_next_byte (st);
int high = m32c_next_byte (st);
return low + (mid << 8) + (high << 16);
}
-
/* Extract the 'source' field from an m32c MOV.size:G-format instruction. */
static int
m32c_get_src23 (unsigned char *i)
{
- return (((i[0] & 0x70) >> 2)
- | ((i[1] & 0x30) >> 4));
+ return (((i[0] & 0x70) >> 2) | ((i[1] & 0x30) >> 4));
}
-
/* Extract the 'dest' field from an m32c MOV.size:G-format instruction. */
static int
m32c_get_dest23 (unsigned char *i)
{
- return (((i[0] & 0x0e) << 1)
- | ((i[1] & 0xc0) >> 6));
+ return (((i[0] & 0x0e) << 1) | ((i[1] & 0xc0) >> 6));
}
-
static struct srcdest
-m32c_decode_srcdest4 (struct m32c_pv_state *st,
- int code, int size)
+m32c_decode_srcdest4 (struct m32c_pv_state *st, int code, int size)
{
struct srcdest sd;
@@ -1234,26 +1165,58 @@ m32c_decode_srcdest4 (struct m32c_pv_state *st,
switch (code)
{
- case 0x0: sd.reg = &st->r0; break;
- case 0x1: sd.reg = (size == 1 ? &st->r0 : &st->r1); break;
- case 0x2: sd.reg = (size == 1 ? &st->r1 : &st->r2); break;
- case 0x3: sd.reg = (size == 1 ? &st->r1 : &st->r3); break;
+ case 0x0:
+ sd.reg = &st->r0;
+ break;
+ case 0x1:
+ sd.reg = (size == 1 ? &st->r0 : &st->r1);
+ break;
+ case 0x2:
+ sd.reg = (size == 1 ? &st->r1 : &st->r2);
+ break;
+ case 0x3:
+ sd.reg = (size == 1 ? &st->r1 : &st->r3);
+ break;
- case 0x4: sd.reg = &st->a0; break;
- case 0x5: sd.reg = &st->a1; break;
+ case 0x4:
+ sd.reg = &st->a0;
+ break;
+ case 0x5:
+ sd.reg = &st->a1;
+ break;
- case 0x6: sd.addr = st->a0; break;
- case 0x7: sd.addr = st->a1; break;
+ case 0x6:
+ sd.addr = st->a0;
+ break;
+ case 0x7:
+ sd.addr = st->a1;
+ break;
- case 0x8: sd.addr = pv_add_constant (st->a0, m32c_udisp8 (st)); break;
- case 0x9: sd.addr = pv_add_constant (st->a1, m32c_udisp8 (st)); break;
- case 0xa: sd.addr = pv_add_constant (st->sb, m32c_udisp8 (st)); break;
- case 0xb: sd.addr = pv_add_constant (st->fb, m32c_sdisp8 (st)); break;
+ case 0x8:
+ sd.addr = pv_add_constant (st->a0, m32c_udisp8 (st));
+ break;
+ case 0x9:
+ sd.addr = pv_add_constant (st->a1, m32c_udisp8 (st));
+ break;
+ case 0xa:
+ sd.addr = pv_add_constant (st->sb, m32c_udisp8 (st));
+ break;
+ case 0xb:
+ sd.addr = pv_add_constant (st->fb, m32c_sdisp8 (st));
+ break;
- case 0xc: sd.addr = pv_add_constant (st->a0, m32c_udisp16 (st)); break;
- case 0xd: sd.addr = pv_add_constant (st->a1, m32c_udisp16 (st)); break;
- case 0xe: sd.addr = pv_add_constant (st->sb, m32c_udisp16 (st)); break;
- case 0xf: sd.addr = pv_constant (m32c_udisp16 (st)); break;
+ case 0xc:
+ sd.addr = pv_add_constant (st->a0, m32c_udisp16 (st));
+ break;
+ case 0xd:
+ sd.addr = pv_add_constant (st->a1, m32c_udisp16 (st));
+ break;
+ case 0xe:
+ sd.addr = pv_add_constant (st->sb, m32c_udisp16 (st));
+ break;
+ case 0xf:
+ sd.addr = pv_constant (m32c_udisp16 (st));
+ break;
default:
gdb_assert_not_reached ("unexpected srcdest4");
@@ -1262,7 +1225,6 @@ m32c_decode_srcdest4 (struct m32c_pv_state *st,
return sd;
}
-
static struct srcdest
m32c_decode_sd23 (struct m32c_pv_state *st, int code, int size, int ind)
{
@@ -1288,32 +1250,71 @@ m32c_decode_sd23 (struct m32c_pv_state *st, int code, int size, int ind)
default:
sd.kind = srcdest_mem;
break;
-
}
switch (code)
{
- case 0x12: sd.reg = &st->r0; break;
- case 0x13: sd.reg = &st->r1; break;
- case 0x10: sd.reg = ((size == 1) ? &st->r0 : &st->r2); break;
- case 0x11: sd.reg = ((size == 1) ? &st->r1 : &st->r3); break;
- case 0x02: sd.reg = &st->a0; break;
- case 0x03: sd.reg = &st->a1; break;
-
- case 0x00: sd.addr = st->a0; break;
- case 0x01: sd.addr = st->a1; break;
- case 0x04: sd.addr = pv_add_constant (st->a0, m32c_udisp8 (st)); break;
- case 0x05: sd.addr = pv_add_constant (st->a1, m32c_udisp8 (st)); break;
- case 0x06: sd.addr = pv_add_constant (st->sb, m32c_udisp8 (st)); break;
- case 0x07: sd.addr = pv_add_constant (st->fb, m32c_sdisp8 (st)); break;
- case 0x08: sd.addr = pv_add_constant (st->a0, m32c_udisp16 (st)); break;
- case 0x09: sd.addr = pv_add_constant (st->a1, m32c_udisp16 (st)); break;
- case 0x0a: sd.addr = pv_add_constant (st->sb, m32c_udisp16 (st)); break;
- case 0x0b: sd.addr = pv_add_constant (st->fb, m32c_sdisp16 (st)); break;
- case 0x0c: sd.addr = pv_add_constant (st->a0, m32c_udisp24 (st)); break;
- case 0x0d: sd.addr = pv_add_constant (st->a1, m32c_udisp24 (st)); break;
- case 0x0f: sd.addr = pv_constant (m32c_udisp16 (st)); break;
- case 0x0e: sd.addr = pv_constant (m32c_udisp24 (st)); break;
+ case 0x12:
+ sd.reg = &st->r0;
+ break;
+ case 0x13:
+ sd.reg = &st->r1;
+ break;
+ case 0x10:
+ sd.reg = ((size == 1) ? &st->r0 : &st->r2);
+ break;
+ case 0x11:
+ sd.reg = ((size == 1) ? &st->r1 : &st->r3);
+ break;
+ case 0x02:
+ sd.reg = &st->a0;
+ break;
+ case 0x03:
+ sd.reg = &st->a1;
+ break;
+
+ case 0x00:
+ sd.addr = st->a0;
+ break;
+ case 0x01:
+ sd.addr = st->a1;
+ break;
+ case 0x04:
+ sd.addr = pv_add_constant (st->a0, m32c_udisp8 (st));
+ break;
+ case 0x05:
+ sd.addr = pv_add_constant (st->a1, m32c_udisp8 (st));
+ break;
+ case 0x06:
+ sd.addr = pv_add_constant (st->sb, m32c_udisp8 (st));
+ break;
+ case 0x07:
+ sd.addr = pv_add_constant (st->fb, m32c_sdisp8 (st));
+ break;
+ case 0x08:
+ sd.addr = pv_add_constant (st->a0, m32c_udisp16 (st));
+ break;
+ case 0x09:
+ sd.addr = pv_add_constant (st->a1, m32c_udisp16 (st));
+ break;
+ case 0x0a:
+ sd.addr = pv_add_constant (st->sb, m32c_udisp16 (st));
+ break;
+ case 0x0b:
+ sd.addr = pv_add_constant (st->fb, m32c_sdisp16 (st));
+ break;
+ case 0x0c:
+ sd.addr = pv_add_constant (st->a0, m32c_udisp24 (st));
+ break;
+ case 0x0d:
+ sd.addr = pv_add_constant (st->a1, m32c_udisp24 (st));
+ break;
+ case 0x0f:
+ sd.addr = pv_constant (m32c_udisp16 (st));
+ break;
+ case 0x0e:
+ sd.addr = pv_constant (m32c_udisp24 (st));
+ break;
default:
gdb_assert_not_reached ("unexpected sd23");
}
@@ -1327,7 +1328,6 @@ m32c_decode_sd23 (struct m32c_pv_state *st, int code, int size, int ind)
return sd;
}
-
/* The r16c and r32c machines have instructions with similar
semantics, but completely different machine language encodings. So
we break out the semantics into their own functions, and leave
@@ -1337,7 +1337,6 @@ m32c_decode_sd23 (struct m32c_pv_state *st, int code, int size, int ind)
and they all return zero if analysis should continue past this
instruction, or non-zero if analysis should stop. */
-
/* Simulate an 'enter SIZE' instruction in STATE. */
static int
m32c_pv_enter (struct m32c_pv_state *state, int size)
@@ -1359,10 +1358,9 @@ m32c_pv_enter (struct m32c_pv_state *state, int size)
return 0;
}
-
static int
-m32c_pv_pushm_one (struct m32c_pv_state *state, pv_t reg,
- int bit, int src, int size)
+m32c_pv_pushm_one (struct m32c_pv_state *state, pv_t reg, int bit, int src,
+ int size)
{
if (bit & src)
{
@@ -1373,7 +1371,6 @@ m32c_pv_pushm_one (struct m32c_pv_state *state, pv_t reg,
return 0;
}
-
/* Simulate a 'pushm SRC' instruction in STATE. */
static int
m32c_pv_pushm (struct m32c_pv_state *state, int src)
@@ -1383,15 +1380,15 @@ m32c_pv_pushm (struct m32c_pv_state *state, int src)
/* The bits in SRC indicating which registers to save are:
r0 r1 r2 r3 a0 a1 sb fb */
- return
- ( m32c_pv_pushm_one (state, state->fb, 0x01, src, tdep->push_addr_bytes)
- || m32c_pv_pushm_one (state, state->sb, 0x02, src, tdep->push_addr_bytes)
- || m32c_pv_pushm_one (state, state->a1, 0x04, src, tdep->push_addr_bytes)
- || m32c_pv_pushm_one (state, state->a0, 0x08, src, tdep->push_addr_bytes)
- || m32c_pv_pushm_one (state, state->r3, 0x10, src, 2)
- || m32c_pv_pushm_one (state, state->r2, 0x20, src, 2)
- || m32c_pv_pushm_one (state, state->r1, 0x40, src, 2)
- || m32c_pv_pushm_one (state, state->r0, 0x80, src, 2));
+ return (
+ m32c_pv_pushm_one (state, state->fb, 0x01, src, tdep->push_addr_bytes)
+ || m32c_pv_pushm_one (state, state->sb, 0x02, src, tdep->push_addr_bytes)
+ || m32c_pv_pushm_one (state, state->a1, 0x04, src, tdep->push_addr_bytes)
+ || m32c_pv_pushm_one (state, state->a0, 0x08, src, tdep->push_addr_bytes)
+ || m32c_pv_pushm_one (state, state->r3, 0x10, src, 2)
+ || m32c_pv_pushm_one (state, state->r2, 0x20, src, 2)
+ || m32c_pv_pushm_one (state, state->r1, 0x40, src, 2)
+ || m32c_pv_pushm_one (state, state->r0, 0x80, src, 2));
}
/* Return non-zero if VALUE is the first incoming argument register. */
@@ -1404,8 +1401,8 @@ m32c_is_1st_arg_reg (struct m32c_pv_state *state, pv_t value)
return (value.kind == pvk_register
&& (gdbarch_bfd_arch_info (state->arch)->mach == bfd_mach_m16c
- ? (value.reg == tdep->r1->num)
- : (value.reg == tdep->r0->num))
+ ? (value.reg == tdep->r1->num)
+ : (value.reg == tdep->r0->num))
&& value.k == 0);
}
@@ -1419,8 +1416,8 @@ m32c_is_arg_reg (struct m32c_pv_state *state, pv_t value)
return (value.kind == pvk_register
&& (gdbarch_bfd_arch_info (state->arch)->mach == bfd_mach_m16c
- ? (value.reg == tdep->r1->num || value.reg == tdep->r2->num)
- : (value.reg == tdep->r0->num))
+ ? (value.reg == tdep->r1->num || value.reg == tdep->r2->num)
+ : (value.reg == tdep->r0->num))
&& value.k == 0);
}
@@ -1435,17 +1432,14 @@ m32c_is_arg_reg (struct m32c_pv_state *state, pv_t value)
relative to the original value of the SP). */
static int
-m32c_is_arg_spill (struct m32c_pv_state *st,
- struct srcdest loc,
- pv_t value)
+m32c_is_arg_spill (struct m32c_pv_state *st, struct srcdest loc, pv_t value)
{
gdbarch *arch = st->arch;
m32c_gdbarch_tdep *tdep = gdbarch_tdep<m32c_gdbarch_tdep> (arch);
- return (m32c_is_arg_reg (st, value)
- && loc.kind == srcdest_mem
+ return (m32c_is_arg_reg (st, value) && loc.kind == srcdest_mem
&& pv_is_register (loc.addr, tdep->sp->num)
- && ! st->stack->find_reg (st->arch, value.reg, 0));
+ && !st->stack->find_reg (st->arch, value.reg, 0));
}
/* Return non-zero if a store of VALUE to LOC is probably
@@ -1459,8 +1453,7 @@ m32c_is_arg_spill (struct m32c_pv_state *st,
- LOC is an address register (a0 or a1). */
static int
-m32c_is_struct_return (struct m32c_pv_state *st,
- struct srcdest loc,
+m32c_is_struct_return (struct m32c_pv_state *st, struct srcdest loc,
pv_t value)
{
gdbarch *arch = st->arch;
@@ -1486,19 +1479,17 @@ m32c_pushm_is_reg_save (struct m32c_pv_state *st, int src)
/* The bits in SRC indicating which registers to save are:
r0 r1 r2 r3 a0 a1 sb fb */
- return
- (pv_is_register (st->sp, tdep->sp->num)
- && (! (src & 0x01) || pv_is_register_k (st->fb, tdep->fb->num, 0))
- && (! (src & 0x02) || pv_is_register_k (st->sb, tdep->sb->num, 0))
- && (! (src & 0x04) || pv_is_register_k (st->a1, tdep->a1->num, 0))
- && (! (src & 0x08) || pv_is_register_k (st->a0, tdep->a0->num, 0))
- && (! (src & 0x10) || pv_is_register_k (st->r3, tdep->r3->num, 0))
- && (! (src & 0x20) || pv_is_register_k (st->r2, tdep->r2->num, 0))
- && (! (src & 0x40) || pv_is_register_k (st->r1, tdep->r1->num, 0))
- && (! (src & 0x80) || pv_is_register_k (st->r0, tdep->r0->num, 0)));
+ return (pv_is_register (st->sp, tdep->sp->num)
+ && (!(src & 0x01) || pv_is_register_k (st->fb, tdep->fb->num, 0))
+ && (!(src & 0x02) || pv_is_register_k (st->sb, tdep->sb->num, 0))
+ && (!(src & 0x04) || pv_is_register_k (st->a1, tdep->a1->num, 0))
+ && (!(src & 0x08) || pv_is_register_k (st->a0, tdep->a0->num, 0))
+ && (!(src & 0x10) || pv_is_register_k (st->r3, tdep->r3->num, 0))
+ && (!(src & 0x20) || pv_is_register_k (st->r2, tdep->r2->num, 0))
+ && (!(src & 0x40) || pv_is_register_k (st->r1, tdep->r1->num, 0))
+ && (!(src & 0x80) || pv_is_register_k (st->r0, tdep->r0->num, 0)));
}
-
/* Function for finding saved registers in a 'struct pv_area'; we pass
this to pv_area::scan.
@@ -1514,8 +1505,7 @@ check_for_saved (void *prologue_untyped, pv_t addr, CORE_ADDR size, pv_t value)
/* Is this the unchanged value of some register being saved on the
stack? */
- if (value.kind == pvk_register
- && value.k == 0
+ if (value.kind == pvk_register && value.k == 0
&& pv_is_register (addr, tdep->sp->num))
{
/* Some registers require special handling: they're saved as a
@@ -1524,8 +1514,7 @@ check_for_saved (void *prologue_untyped, pv_t addr, CORE_ADDR size, pv_t value)
if (value.reg == tdep->pc->num)
saved_size = tdep->ret_addr_bytes;
- else if (register_type (arch, value.reg)
- == tdep->data_addr_reg_type)
+ else if (register_type (arch, value.reg) == tdep->data_addr_reg_type)
saved_size = tdep->push_addr_bytes;
if (size == saved_size)
@@ -1541,13 +1530,11 @@ check_for_saved (void *prologue_untyped, pv_t addr, CORE_ADDR size, pv_t value)
}
}
-
/* Analyze the function prologue for ARCH at START, going no further
than LIMIT, and place a description of what we found in
PROLOGUE. */
static void
-m32c_analyze_prologue (struct gdbarch *arch,
- CORE_ADDR start, CORE_ADDR limit,
+m32c_analyze_prologue (struct gdbarch *arch, CORE_ADDR start, CORE_ADDR limit,
struct m32c_prologue *prologue)
{
m32c_gdbarch_tdep *tdep = gdbarch_tdep<m32c_gdbarch_tdep> (arch);
@@ -1639,10 +1626,8 @@ m32c_analyze_prologue (struct gdbarch *arch,
pv_t src_value;
st.next_addr += 2;
- src
- = m32c_decode_srcdest4 (&st, (st.insn[1] >> 4) & 0xf, size);
- dest
- = m32c_decode_srcdest4 (&st, st.insn[1] & 0xf, size);
+ src = m32c_decode_srcdest4 (&st, (st.insn[1] >> 4) & 0xf, size);
+ dest = m32c_decode_srcdest4 (&st, st.insn[1] & 0xf, size);
src_value = m32c_srcdest_fetch (&st, src, size);
if (m32c_is_arg_spill (&st, dest, src_value))
@@ -1655,8 +1640,7 @@ m32c_analyze_prologue (struct gdbarch *arch,
}
/* (1) LDC #IMM16, sp */
- else if (st.insn[0] == 0xeb
- && st.insn[1] == 0x50)
+ else if (st.insn[0] == 0xeb && st.insn[1] == 0x50)
{
st.next_addr += 2;
st.sp = pv_constant (m32c_udisp16 (&st));
@@ -1728,12 +1712,10 @@ m32c_analyze_prologue (struct gdbarch *arch,
int size = bw ? 2 : 1;
st.next_addr += 2;
- src
- = m32c_decode_sd23 (&st, m32c_get_src23 (&st.insn[i]),
- size, src_indirect);
- dest
- = m32c_decode_sd23 (&st, m32c_get_dest23 (&st.insn[i]),
- size, dest_indirect);
+ src = m32c_decode_sd23 (&st, m32c_get_src23 (&st.insn[i]), size,
+ src_indirect);
+ dest = m32c_decode_sd23 (&st, m32c_get_dest23 (&st.insn[i]),
+ size, dest_indirect);
src_value = m32c_srcdest_fetch (&st, src, size);
if (m32c_is_arg_spill (&st, dest, src_value))
@@ -1743,8 +1725,7 @@ m32c_analyze_prologue (struct gdbarch *arch,
break;
}
/* (2) LDC #IMM24, sp */
- else if (st.insn[i] == 0xd5
- && st.insn[i + 1] == 0x29)
+ else if (st.insn[i] == 0xd5 && st.insn[i + 1] == 0x29)
{
st.next_addr += 2;
st.sp = pv_constant (m32c_udisp24 (&st));
@@ -1772,18 +1753,18 @@ m32c_analyze_prologue (struct gdbarch *arch,
teardown sequence, and the prologue should end before
that. */
- if (! pv_is_identical (st.fb, pre_insn_fb))
+ if (!pv_is_identical (st.fb, pre_insn_fb))
{
- if (! pv_is_register_k (st.fb, tdep->fb->num, 0))
+ if (!pv_is_register_k (st.fb, tdep->fb->num, 0))
after_last_frame_related_insn = st.next_addr;
}
- else if (! pv_is_identical (st.sp, pre_insn_sp))
+ else if (!pv_is_identical (st.sp, pre_insn_sp))
{
/* The comparison of the constants looks odd, there, because
.k is unsigned. All it really means is that the SP is
lower than it was before the instruction. */
- if ( pv_is_register (pre_insn_sp, tdep->sp->num)
- && pv_is_register (st.sp, tdep->sp->num)
+ if (pv_is_register (pre_insn_sp, tdep->sp->num)
+ && pv_is_register (st.sp, tdep->sp->num)
&& ((pre_insn_sp.k - st.sp.k) < (st.sp.k - pre_insn_sp.k)))
after_last_frame_related_insn = st.next_addr;
}
@@ -1823,7 +1804,6 @@ m32c_analyze_prologue (struct gdbarch *arch,
prologue->prologue_end = after_last_frame_related_insn;
}
-
static CORE_ADDR
m32c_skip_prologue (struct gdbarch *gdbarch, CORE_ADDR ip)
{
@@ -1832,7 +1812,7 @@ m32c_skip_prologue (struct gdbarch *gdbarch, CORE_ADDR ip)
struct m32c_prologue p;
/* Try to find the extent of the function that contains IP. */
- if (! find_pc_partial_function (ip, &name, &func_addr, &func_end))
+ if (!find_pc_partial_function (ip, &name, &func_addr, &func_end))
return ip;
/* Find end by prologue analysis. */
@@ -1846,37 +1826,33 @@ m32c_skip_prologue (struct gdbarch *gdbarch, CORE_ADDR ip)
return p.prologue_end;
}
-
-
/* Stack unwinding. */
static struct m32c_prologue *
m32c_analyze_frame_prologue (frame_info_ptr this_frame,
void **this_prologue_cache)
{
- if (! *this_prologue_cache)
+ if (!*this_prologue_cache)
{
CORE_ADDR func_start = get_frame_func (this_frame);
CORE_ADDR stop_addr = get_frame_pc (this_frame);
/* If we couldn't find any function containing the PC, then
just initialize the prologue cache, but don't do anything. */
- if (! func_start)
+ if (!func_start)
stop_addr = func_start;
*this_prologue_cache = FRAME_OBSTACK_ZALLOC (struct m32c_prologue);
- m32c_analyze_prologue (get_frame_arch (this_frame),
- func_start, stop_addr,
+ m32c_analyze_prologue (get_frame_arch (this_frame), func_start,
+ stop_addr,
(struct m32c_prologue *) *this_prologue_cache);
}
return (struct m32c_prologue *) *this_prologue_cache;
}
-
static CORE_ADDR
-m32c_frame_base (frame_info_ptr this_frame,
- void **this_prologue_cache)
+m32c_frame_base (frame_info_ptr this_frame, void **this_prologue_cache)
{
struct m32c_prologue *p
= m32c_analyze_frame_prologue (this_frame, this_prologue_cache);
@@ -1893,15 +1869,13 @@ m32c_frame_base (frame_info_ptr this_frame,
{
case prologue_with_frame_ptr:
{
- CORE_ADDR fb
- = get_frame_register_unsigned (this_frame, tdep->fb->num);
+ CORE_ADDR fb = get_frame_register_unsigned (this_frame, tdep->fb->num);
return fb - p->frame_ptr_offset;
}
case prologue_sans_frame_ptr:
{
- CORE_ADDR sp
- = get_frame_register_unsigned (this_frame, tdep->sp->num);
+ CORE_ADDR sp = get_frame_register_unsigned (this_frame, tdep->sp->num);
return sp - p->frame_size;
}
@@ -1913,10 +1887,8 @@ m32c_frame_base (frame_info_ptr this_frame,
}
}
-
static void
-m32c_this_id (frame_info_ptr this_frame,
- void **this_prologue_cache,
+m32c_this_id (frame_info_ptr this_frame, void **this_prologue_cache,
struct frame_id *this_id)
{
CORE_ADDR base = m32c_frame_base (this_frame, this_prologue_cache);
@@ -1926,10 +1898,9 @@ m32c_this_id (frame_info_ptr this_frame,
/* Otherwise, leave it unset, and that will terminate the backtrace. */
}
-
static struct value *
-m32c_prev_register (frame_info_ptr this_frame,
- void **this_prologue_cache, int regnum)
+m32c_prev_register (frame_info_ptr this_frame, void **this_prologue_cache,
+ int regnum)
{
gdbarch *arch = get_frame_arch (this_frame);
m32c_gdbarch_tdep *tdep = gdbarch_tdep<m32c_gdbarch_tdep> (arch);
@@ -1951,18 +1922,12 @@ m32c_prev_register (frame_info_ptr this_frame,
return frame_unwind_got_register (this_frame, regnum, regnum);
}
-
static const struct frame_unwind m32c_unwind = {
- "m32c prologue",
- NORMAL_FRAME,
- default_frame_unwind_stop_reason,
- m32c_this_id,
- m32c_prev_register,
- NULL,
+ "m32c prologue", NORMAL_FRAME, default_frame_unwind_stop_reason,
+ m32c_this_id, m32c_prev_register, NULL,
default_frame_sniffer
};
-
/* Inferior calls. */
/* The calling conventions, according to GCC:
@@ -1989,7 +1954,6 @@ static const struct frame_unwind m32c_unwind = {
higher-addressed byte is the padding), stack "alignment" is 16
bits. */
-
/* Return true if TYPE is a type that can be passed in registers. (We
ignore the size, and pay attention only to the type code;
acceptable sizes depends on which register is being considered to
@@ -1999,15 +1963,11 @@ m32c_reg_arg_type (struct type *type)
{
enum type_code code = type->code ();
- return (code == TYPE_CODE_INT
- || code == TYPE_CODE_ENUM
- || code == TYPE_CODE_PTR
- || TYPE_IS_REFERENCE (type)
- || code == TYPE_CODE_BOOL
- || code == TYPE_CODE_CHAR);
+ return (code == TYPE_CODE_INT || code == TYPE_CODE_ENUM
+ || code == TYPE_CODE_PTR || TYPE_IS_REFERENCE (type)
+ || code == TYPE_CODE_BOOL || code == TYPE_CODE_CHAR);
}
-
static CORE_ADDR
m32c_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
struct regcache *regcache, CORE_ADDR bp_addr, int nargs,
@@ -2035,8 +1995,8 @@ m32c_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
if (func_type->code () == TYPE_CODE_PTR)
func_type = func_type->target_type ();
- gdb_assert (func_type->code () == TYPE_CODE_FUNC ||
- func_type->code () == TYPE_CODE_METHOD);
+ gdb_assert (func_type->code () == TYPE_CODE_FUNC
+ || func_type->code () == TYPE_CODE_METHOD);
#if 0
/* The ABI description in gcc/config/m32c/m32c.abi says that
@@ -2044,7 +2004,7 @@ m32c_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
separately, but the code in GCC doesn't actually do so. */
if (TYPE_PROTOTYPED (func_type))
#endif
- num_prototyped_args = func_type->num_fields ();
+ num_prototyped_args = func_type->num_fields ();
}
/* First, if the function returns an aggregate by value, push a
@@ -2066,27 +2026,22 @@ m32c_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
ULONGEST arg_size = arg_type->length ();
/* Can it go in r1 or r1l (for m16c) or r0 or r0l (for m32c)? */
- if (i == 0
- && arg_size <= 2
- && i < num_prototyped_args
+ if (i == 0 && arg_size <= 2 && i < num_prototyped_args
&& m32c_reg_arg_type (arg_type))
{
/* Extract and re-store as an integer as a terse way to make
sure it ends up in the least significant end of r1. (GDB
should avoid assuming endianness, even on uni-endian
processors.) */
- ULONGEST u = extract_unsigned_integer (arg_bits, arg_size,
- byte_order);
+ ULONGEST u
+ = extract_unsigned_integer (arg_bits, arg_size, byte_order);
struct m32c_reg *reg = (mach == bfd_mach_m16c) ? tdep->r1 : tdep->r0;
regcache_cooked_write_unsigned (regcache, reg->num, u);
}
/* Can it go in r2? */
- else if (mach == bfd_mach_m16c
- && i == 1
- && arg_size == 2
- && i < num_prototyped_args
- && m32c_reg_arg_type (arg_type))
+ else if (mach == bfd_mach_m16c && i == 1 && arg_size == 2
+ && i < num_prototyped_args && m32c_reg_arg_type (arg_type))
regcache->cooked_write (tdep->r2->num, arg_bits);
/* Everything else goes on the stack. */
@@ -2133,8 +2088,6 @@ m32c_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
return cfa;
}
-
-
/* Return values. */
/* Return value conventions, according to GCC:
@@ -2166,17 +2119,13 @@ m32c_return_by_passed_buf (struct type *type)
{
enum type_code code = type->code ();
- return (code == TYPE_CODE_STRUCT
- || code == TYPE_CODE_UNION);
+ return (code == TYPE_CODE_STRUCT || code == TYPE_CODE_UNION);
}
static enum return_value_convention
-m32c_return_value (struct gdbarch *gdbarch,
- struct value *function,
- struct type *valtype,
- struct regcache *regcache,
- gdb_byte *readbuf,
- const gdb_byte *writebuf)
+m32c_return_value (struct gdbarch *gdbarch, struct value *function,
+ struct type *valtype, struct regcache *regcache,
+ gdb_byte *readbuf, const gdb_byte *writebuf)
{
m32c_gdbarch_tdep *tdep = gdbarch_tdep<m32c_gdbarch_tdep> (gdbarch);
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
@@ -2212,10 +2161,10 @@ m32c_return_value (struct gdbarch *gdbarch,
struct bound_minimal_symbol mem0
= lookup_minimal_symbol ("mem0", NULL, NULL);
- if (! mem0.minsym)
- error (_("The return value is stored in memory at 'mem0', "
- "but GDB cannot find\n"
- "its address."));
+ if (!mem0.minsym)
+ error (_ ("The return value is stored in memory at 'mem0', "
+ "but GDB cannot find\n"
+ "its address."));
read_memory (mem0.value_address (), readbuf, valtype_len);
}
}
@@ -2232,8 +2181,8 @@ m32c_return_value (struct gdbarch *gdbarch,
/* Anything that fits in r0 is returned there. */
if (valtype_len <= tdep->r0->type->length ())
{
- ULONGEST u = extract_unsigned_integer (writebuf, valtype_len,
- byte_order);
+ ULONGEST u
+ = extract_unsigned_integer (writebuf, valtype_len, byte_order);
regcache_cooked_write_unsigned (regcache, tdep->r0->num, u);
}
else
@@ -2244,10 +2193,10 @@ m32c_return_value (struct gdbarch *gdbarch,
struct bound_minimal_symbol mem0
= lookup_minimal_symbol ("mem0", NULL, NULL);
- if (! mem0.minsym)
- error (_("The return value is stored in memory at 'mem0', "
- "but GDB cannot find\n"
- " its address."));
+ if (!mem0.minsym)
+ error (_ ("The return value is stored in memory at 'mem0', "
+ "but GDB cannot find\n"
+ " its address."));
write_memory (mem0.value_address (), writebuf, valtype_len);
}
}
@@ -2255,8 +2204,6 @@ m32c_return_value (struct gdbarch *gdbarch,
return conv;
}
-
-
/* Trampolines. */
/* The m16c and m32c use a trampoline function for indirect function
@@ -2324,8 +2271,7 @@ m32c_skip_trampoline_code (frame_info_ptr frame, CORE_ADDR stop_pc)
if (find_pc_partial_function (stop_pc, &name, &start, &end))
{
/* Are we stopped at the beginning of the trampoline function? */
- if (strcmp (name, "m32c_jsri16") == 0
- && stop_pc == start)
+ if (strcmp (name, "m32c_jsri16") == 0 && stop_pc == start)
{
/* Get the stack pointer. The return address is at the top,
and the target function's address is just below that. We
@@ -2333,8 +2279,8 @@ m32c_skip_trampoline_code (frame_info_ptr frame, CORE_ADDR stop_pc)
m32c_jsri*16*. */
CORE_ADDR sp = get_frame_sp (get_current_frame ());
CORE_ADDR target
- = read_memory_unsigned_integer (sp + tdep->ret_addr_bytes,
- 2, byte_order);
+ = read_memory_unsigned_integer (sp + tdep->ret_addr_bytes, 2,
+ byte_order);
/* What we have now is the address of a jump instruction.
What we need is the destination of that jump.
@@ -2348,7 +2294,6 @@ m32c_skip_trampoline_code (frame_info_ptr frame, CORE_ADDR stop_pc)
return 0;
}
-
/* Address/pointer conversions. */
/* On the m16c, there is a 24-bit address space, but only a very few
@@ -2405,8 +2350,8 @@ m32c_skip_trampoline_code (frame_info_ptr frame, CORE_ADDR stop_pc)
programmer! :) */
static void
-m32c_m16c_address_to_pointer (struct gdbarch *gdbarch,
- struct type *type, gdb_byte *buf, CORE_ADDR addr)
+m32c_m16c_address_to_pointer (struct gdbarch *gdbarch, struct type *type,
+ gdb_byte *buf, CORE_ADDR addr)
{
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
enum type_code target_code;
@@ -2424,10 +2369,11 @@ m32c_m16c_address_to_pointer (struct gdbarch *gdbarch,
struct bound_minimal_symbol func_msym
= lookup_minimal_symbol_by_pc (addr);
- if (! func_msym.minsym)
- error (_("Cannot convert code address %s to function pointer:\n"
- "couldn't find a symbol at that address, to find trampoline."),
- paddress (gdbarch, addr));
+ if (!func_msym.minsym)
+ error (
+ _ ("Cannot convert code address %s to function pointer:\n"
+ "couldn't find a symbol at that address, to find trampoline."),
+ paddress (gdbarch, addr));
func_name = func_msym.minsym->linkage_name ();
tramp_name = (char *) xmalloc (strlen (func_name) + 5);
@@ -2441,7 +2387,7 @@ m32c_m16c_address_to_pointer (struct gdbarch *gdbarch,
the name any more. */
xfree (tramp_name);
- if (! tramp_msym.minsym)
+ if (!tramp_msym.minsym)
{
CORE_ADDR ptrval;
@@ -2459,16 +2405,15 @@ m32c_m16c_address_to_pointer (struct gdbarch *gdbarch,
determination about whether the result is useful or not. */
ptrval = addr & 0xffff;
- warning (_("Cannot convert code address %s to function pointer:\n"
- "couldn't find trampoline named '%s.plt'.\n"
- "Returning pointer value %s instead; this may produce\n"
- "a useful result if converted back into an address by GDB,\n"
- "but will most likely not be useful otherwise."),
- paddress (gdbarch, addr), func_name,
- paddress (gdbarch, ptrval));
+ warning (
+ _ ("Cannot convert code address %s to function pointer:\n"
+ "couldn't find trampoline named '%s.plt'.\n"
+ "Returning pointer value %s instead; this may produce\n"
+ "a useful result if converted back into an address by GDB,\n"
+ "but will most likely not be useful otherwise."),
+ paddress (gdbarch, addr), func_name, paddress (gdbarch, ptrval));
addr = ptrval;
-
}
else
{
@@ -2480,10 +2425,9 @@ m32c_m16c_address_to_pointer (struct gdbarch *gdbarch,
store_unsigned_integer (buf, type->length (), byte_order, addr);
}
-
static CORE_ADDR
-m32c_m16c_pointer_to_address (struct gdbarch *gdbarch,
- struct type *type, const gdb_byte *buf)
+m32c_m16c_pointer_to_address (struct gdbarch *gdbarch, struct type *type,
+ const gdb_byte *buf)
{
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
CORE_ADDR ptr;
@@ -2506,8 +2450,7 @@ m32c_m16c_pointer_to_address (struct gdbarch *gdbarch,
const char *ptr_msym_name = ptr_msym.minsym->linkage_name ();
int len = strlen (ptr_msym_name);
- if (len > 4
- && strcmp (ptr_msym_name + len - 4, ".plt") == 0)
+ if (len > 4 && strcmp (ptr_msym_name + len - 4, ".plt") == 0)
{
struct bound_minimal_symbol func_msym;
/* We have a .plt symbol; try to find the symbol for the
@@ -2519,8 +2462,7 @@ m32c_m16c_pointer_to_address (struct gdbarch *gdbarch,
char *func_name = (char *) xmalloc (len - 4 + 1);
memcpy (func_name, ptr_msym_name, len - 4);
func_name[len - 4] = '\0';
- func_msym
- = lookup_minimal_symbol (func_name, NULL, NULL);
+ func_msym = lookup_minimal_symbol (func_name, NULL, NULL);
/* If we do have such a symbol, return its value as the
function's true address. */
@@ -2535,7 +2477,7 @@ m32c_m16c_pointer_to_address (struct gdbarch *gdbarch,
for (aspace = 1; aspace <= 15; aspace++)
{
ptr_msym = lookup_minimal_symbol_by_pc ((aspace << 16) | ptr);
-
+
if (ptr_msym.minsym)
ptr |= aspace << 16;
}
@@ -2547,8 +2489,7 @@ m32c_m16c_pointer_to_address (struct gdbarch *gdbarch,
static void
m32c_virtual_frame_pointer (struct gdbarch *gdbarch, CORE_ADDR pc,
- int *frame_regnum,
- LONGEST *frame_offset)
+ int *frame_regnum, LONGEST *frame_offset)
{
const char *name;
CORE_ADDR func_addr, func_end;
@@ -2556,9 +2497,9 @@ m32c_virtual_frame_pointer (struct gdbarch *gdbarch, CORE_ADDR pc,
struct regcache *regcache = get_current_regcache ();
m32c_gdbarch_tdep *tdep = gdbarch_tdep<m32c_gdbarch_tdep> (gdbarch);
-
+
if (!find_pc_partial_function (pc, &name, &func_addr, &func_end))
- internal_error (_("No virtual frame pointer available"));
+ internal_error (_ ("No virtual frame pointer available"));
m32c_analyze_prologue (gdbarch, func_addr, pc, &p);
switch (p.kind)
@@ -2578,10 +2519,9 @@ m32c_virtual_frame_pointer (struct gdbarch *gdbarch, CORE_ADDR pc,
}
/* Sanity check */
if (*frame_regnum > gdbarch_num_regs (gdbarch))
- internal_error (_("No virtual frame pointer available"));
+ internal_error (_ ("No virtual frame pointer available"));
}
-
/* Initialization. */
static struct gdbarch *
@@ -2591,8 +2531,7 @@ m32c_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
/* Find a candidate among the list of architectures we've created
already. */
- for (arches = gdbarch_list_lookup_by_info (arches, &info);
- arches != NULL;
+ for (arches = gdbarch_list_lookup_by_info (arches, &info); arches != NULL;
arches = gdbarch_list_lookup_by_info (arches->next, &info))
return arches->gdbarch;
@@ -2652,6 +2591,7 @@ m32c_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
}
void _initialize_m32c_tdep ();
+
void
_initialize_m32c_tdep ()
{
diff --git a/gdb/m32r-linux-nat.c b/gdb/m32r-linux-nat.c
index 6a4be994806..fb9f1dc56ff 100644
--- a/gdb/m32r-linux-nat.c
+++ b/gdb/m32r-linux-nat.c
@@ -32,11 +32,11 @@
#include "gregset.h"
#include "m32r-tdep.h"
-
class m32r_linux_nat_target final : public linux_nat_target
{
public:
+
/* Add our register access methods. */
void fetch_registers (struct regcache *, int) override;
void store_registers (struct regcache *, int) override;
@@ -50,11 +50,8 @@ static m32r_linux_nat_target the_m32r_linux_nat_target;
/* Mapping between the general-purpose registers in `struct user'
format and GDB's register array layout. */
-static int regmap[] = {
- 4, 5, 6, 7, 0, 1, 2, 8,
- 9, 10, 11, 12, 13, 24, 25, 23,
- 19, 19, 26, 23, 22, 20, 16, 15
-};
+static int regmap[] = { 4, 5, 6, 7, 0, 1, 2, 8, 9, 10, 11, 12,
+ 13, 24, 25, 23, 19, 19, 26, 23, 22, 20, 16, 15 };
#define PSW_REGMAP 19
#define BBPSW_REGMAP 21
@@ -62,10 +59,8 @@ static int regmap[] = {
#define SPI_REGMAP 26
/* Doee (??) apply to the corresponding SET requests as well. */
-#define GETREGS_SUPPLIES(regno) (0 <= (regno) \
- && (regno) <= M32R_LINUX_NUM_REGS)
-
-
+#define GETREGS_SUPPLIES(regno) \
+ (0 <= (regno) && (regno) <= M32R_LINUX_NUM_REGS)
/* Transfering the general-purpose registers between GDB, inferiors
and core files. */
@@ -74,7 +69,7 @@ static int regmap[] = {
in *GREGSETP. */
void
-supply_gregset (struct regcache *regcache, const elf_gregset_t * gregsetp)
+supply_gregset (struct regcache *regcache, const elf_gregset_t *gregsetp)
{
const elf_greg_t *regp = (const elf_greg_t *) gregsetp;
int i;
@@ -118,7 +113,7 @@ fetch_regs (struct regcache *regcache, int tid)
elf_gregset_t regs;
if (ptrace (PTRACE_GETREGS, tid, 0, (int) &regs) < 0)
- perror_with_name (_("Couldn't get registers"));
+ perror_with_name (_ ("Couldn't get registers"));
supply_gregset (regcache, (const elf_gregset_t *) &regs);
}
@@ -128,8 +123,8 @@ fetch_regs (struct regcache *regcache, int tid)
do this for all registers. */
void
-fill_gregset (const struct regcache *regcache,
- elf_gregset_t * gregsetp, int regno)
+fill_gregset (const struct regcache *regcache, elf_gregset_t *gregsetp,
+ int regno)
{
elf_greg_t *regp = (elf_greg_t *) gregsetp;
int i;
@@ -167,15 +162,13 @@ store_regs (const struct regcache *regcache, int tid, int regno)
elf_gregset_t regs;
if (ptrace (PTRACE_GETREGS, tid, 0, (int) &regs) < 0)
- perror_with_name (_("Couldn't get registers"));
+ perror_with_name (_ ("Couldn't get registers"));
fill_gregset (regcache, &regs, regno);
if (ptrace (PTRACE_SETREGS, tid, 0, (int) &regs) < 0)
- perror_with_name (_("Couldn't write registers"));
+ perror_with_name (_ ("Couldn't write registers"));
}
-
-
/* Transfering floating-point registers between GDB, inferiors and cores.
Since M32R has no floating-point registers, these functions do nothing. */
@@ -186,12 +179,10 @@ supply_fpregset (struct regcache *regcache, const gdb_fpregset_t *fpregs)
}
void
-fill_fpregset (const struct regcache *regcache,
- gdb_fpregset_t *fpregs, int regno)
+fill_fpregset (const struct regcache *regcache, gdb_fpregset_t *fpregs,
+ int regno)
{
}
-
-
/* Transferring arbitrary registers between GDB and inferior. */
@@ -213,7 +204,7 @@ m32r_linux_nat_target::fetch_registers (struct regcache *regcache, int regno)
return;
}
- internal_error (_("Got request for bad register number %d."), regno);
+ internal_error (_ ("Got request for bad register number %d."), regno);
}
/* Store register REGNO back into the child process. If REGNO is -1,
@@ -232,10 +223,11 @@ m32r_linux_nat_target::store_registers (struct regcache *regcache, int regno)
return;
}
- internal_error (_("Got request to store bad register number %d."), regno);
+ internal_error (_ ("Got request to store bad register number %d."), regno);
}
void _initialize_m32r_linux_nat ();
+
void
_initialize_m32r_linux_nat ()
{
diff --git a/gdb/m32r-linux-tdep.c b/gdb/m32r-linux-tdep.c
index c2f65df9df0..a76090b92f4 100644
--- a/gdb/m32r-linux-tdep.c
+++ b/gdb/m32r-linux-tdep.c
@@ -38,8 +38,6 @@
#include "linux-tdep.h"
#include "gdbarch.h"
-
-
/* Recognizing signal handler frames. */
/* GNU/Linux has two flavors of signals. Normal signal handlers, and
@@ -78,7 +76,10 @@
supported too. */
static const gdb_byte linux_sigtramp_code[] = {
- 0x67, 0x77, 0x10, 0xf2,
+ 0x67,
+ 0x77,
+ 0x10,
+ 0xf2,
};
/* If PC is in a sigtramp routine, return the address of the start of
@@ -99,7 +100,7 @@ m32r_linux_sigtramp_start (CORE_ADDR pc, frame_info_ptr this_frame)
if (pc % 2 != 0)
{
- if (!safe_frame_unwind_memory (this_frame, pc, {buf, 2}))
+ if (!safe_frame_unwind_memory (this_frame, pc, { buf, 2 }))
return 0;
if (memcmp (buf, linux_sigtramp_code, 2) == 0)
@@ -108,7 +109,7 @@ m32r_linux_sigtramp_start (CORE_ADDR pc, frame_info_ptr this_frame)
return 0;
}
- if (!safe_frame_unwind_memory (this_frame, pc, {buf, 4}))
+ if (!safe_frame_unwind_memory (this_frame, pc, { buf, 4 }))
return 0;
if (memcmp (buf, linux_sigtramp_code, 4) != 0)
@@ -148,12 +149,12 @@ m32r_linux_rt_sigtramp_start (CORE_ADDR pc, frame_info_ptr this_frame)
if (pc % 2 != 0)
return 0;
- if (!safe_frame_unwind_memory (this_frame, pc, {buf, 4}))
+ if (!safe_frame_unwind_memory (this_frame, pc, { buf, 4 }))
return 0;
if (memcmp (buf, linux_rt_sigtramp_code, 4) == 0)
{
- if (!safe_frame_unwind_memory (this_frame, pc + 4, {buf, 4}))
+ if (!safe_frame_unwind_memory (this_frame, pc + 4, { buf, 4 }))
return 0;
if (memcmp (buf, linux_rt_sigtramp_code + 4, 4) == 0)
@@ -161,7 +162,7 @@ m32r_linux_rt_sigtramp_start (CORE_ADDR pc, frame_info_ptr this_frame)
}
else if (memcmp (buf, linux_rt_sigtramp_code + 4, 4) == 0)
{
- if (!safe_frame_unwind_memory (this_frame, pc - 4, {buf, 4}))
+ if (!safe_frame_unwind_memory (this_frame, pc - 4, { buf, 4 }))
return 0;
if (memcmp (buf, linux_rt_sigtramp_code, 4) == 0)
@@ -190,30 +191,30 @@ m32r_linux_pc_in_sigtramp (CORE_ADDR pc, const char *name,
/* From <asm/sigcontext.h>. */
static int m32r_linux_sc_reg_offset[] = {
- 4 * 4, /* r0 */
- 5 * 4, /* r1 */
- 6 * 4, /* r2 */
- 7 * 4, /* r3 */
- 0 * 4, /* r4 */
- 1 * 4, /* r5 */
- 2 * 4, /* r6 */
- 8 * 4, /* r7 */
- 9 * 4, /* r8 */
- 10 * 4, /* r9 */
- 11 * 4, /* r10 */
- 12 * 4, /* r11 */
- 13 * 4, /* r12 */
- 21 * 4, /* fp */
- 22 * 4, /* lr */
- -1 * 4, /* sp */
- 16 * 4, /* psw */
- -1 * 4, /* cbr */
- 23 * 4, /* spi */
- 20 * 4, /* spu */
- 19 * 4, /* bpc */
- 17 * 4, /* pc */
- 15 * 4, /* accl */
- 14 * 4 /* acch */
+ 4 * 4, /* r0 */
+ 5 * 4, /* r1 */
+ 6 * 4, /* r2 */
+ 7 * 4, /* r3 */
+ 0 * 4, /* r4 */
+ 1 * 4, /* r5 */
+ 2 * 4, /* r6 */
+ 8 * 4, /* r7 */
+ 9 * 4, /* r8 */
+ 10 * 4, /* r9 */
+ 11 * 4, /* r10 */
+ 12 * 4, /* r11 */
+ 13 * 4, /* r12 */
+ 21 * 4, /* fp */
+ 22 * 4, /* lr */
+ -1 * 4, /* sp */
+ 16 * 4, /* psw */
+ -1 * 4, /* cbr */
+ 23 * 4, /* spi */
+ 20 * 4, /* spu */
+ 19 * 4, /* bpc */
+ 17 * 4, /* pc */
+ 15 * 4, /* accl */
+ 14 * 4 /* acch */
};
struct m32r_frame_cache
@@ -223,8 +224,7 @@ struct m32r_frame_cache
};
static struct m32r_frame_cache *
-m32r_linux_sigtramp_frame_cache (frame_info_ptr this_frame,
- void **this_cache)
+m32r_linux_sigtramp_frame_cache (frame_info_ptr this_frame, void **this_cache)
{
struct m32r_frame_cache *cache;
CORE_ADDR sigcontext_addr, addr;
@@ -258,8 +258,8 @@ m32r_linux_sigtramp_frame_cache (frame_info_ptr this_frame,
for (regnum = 0; regnum < sizeof (m32r_linux_sc_reg_offset) / 4; regnum++)
{
if (m32r_linux_sc_reg_offset[regnum] >= 0)
- cache->saved_regs[regnum].set_addr (sigcontext_addr
- + m32r_linux_sc_reg_offset[regnum]);
+ cache->saved_regs[regnum].set_addr (
+ sigcontext_addr + m32r_linux_sc_reg_offset[regnum]);
}
return cache;
@@ -267,11 +267,10 @@ m32r_linux_sigtramp_frame_cache (frame_info_ptr this_frame,
static void
m32r_linux_sigtramp_frame_this_id (frame_info_ptr this_frame,
- void **this_cache,
- struct frame_id *this_id)
+ void **this_cache, struct frame_id *this_id)
{
- struct m32r_frame_cache *cache =
- m32r_linux_sigtramp_frame_cache (this_frame, this_cache);
+ struct m32r_frame_cache *cache
+ = m32r_linux_sigtramp_frame_cache (this_frame, this_cache);
(*this_id) = frame_id_build (cache->base, cache->pc);
}
@@ -280,8 +279,8 @@ static struct value *
m32r_linux_sigtramp_frame_prev_register (frame_info_ptr this_frame,
void **this_cache, int regnum)
{
- struct m32r_frame_cache *cache =
- m32r_linux_sigtramp_frame_cache (this_frame, this_cache);
+ struct m32r_frame_cache *cache
+ = m32r_linux_sigtramp_frame_cache (this_frame, this_cache);
return trad_frame_get_prev_register (this_frame, cache->saved_regs, regnum);
}
@@ -301,44 +300,43 @@ m32r_linux_sigtramp_frame_sniffer (const struct frame_unwind *self,
return 0;
}
-static const struct frame_unwind m32r_linux_sigtramp_frame_unwind = {
- "m32r linux sigtramp",
- SIGTRAMP_FRAME,
- default_frame_unwind_stop_reason,
- m32r_linux_sigtramp_frame_this_id,
- m32r_linux_sigtramp_frame_prev_register,
- NULL,
- m32r_linux_sigtramp_frame_sniffer
-};
+static const struct frame_unwind m32r_linux_sigtramp_frame_unwind
+ = { "m32r linux sigtramp",
+ SIGTRAMP_FRAME,
+ default_frame_unwind_stop_reason,
+ m32r_linux_sigtramp_frame_this_id,
+ m32r_linux_sigtramp_frame_prev_register,
+ NULL,
+ m32r_linux_sigtramp_frame_sniffer };
/* Mapping between the registers in `struct pt_regs'
format and GDB's register array layout. */
static int m32r_pt_regs_offset[] = {
- 4 * 4, /* r0 */
- 4 * 5, /* r1 */
- 4 * 6, /* r2 */
- 4 * 7, /* r3 */
- 4 * 0, /* r4 */
- 4 * 1, /* r5 */
- 4 * 2, /* r6 */
- 4 * 8, /* r7 */
- 4 * 9, /* r8 */
- 4 * 10, /* r9 */
- 4 * 11, /* r10 */
- 4 * 12, /* r11 */
- 4 * 13, /* r12 */
- 4 * 24, /* fp */
- 4 * 25, /* lr */
- 4 * 23, /* sp */
- 4 * 19, /* psw */
- 4 * 19, /* cbr */
- 4 * 26, /* spi */
- 4 * 23, /* spu */
- 4 * 22, /* bpc */
- 4 * 20, /* pc */
- 4 * 16, /* accl */
- 4 * 15 /* acch */
+ 4 * 4, /* r0 */
+ 4 * 5, /* r1 */
+ 4 * 6, /* r2 */
+ 4 * 7, /* r3 */
+ 4 * 0, /* r4 */
+ 4 * 1, /* r5 */
+ 4 * 2, /* r6 */
+ 4 * 8, /* r7 */
+ 4 * 9, /* r8 */
+ 4 * 10, /* r9 */
+ 4 * 11, /* r10 */
+ 4 * 12, /* r11 */
+ 4 * 13, /* r12 */
+ 4 * 24, /* fp */
+ 4 * 25, /* lr */
+ 4 * 23, /* sp */
+ 4 * 19, /* psw */
+ 4 * 19, /* cbr */
+ 4 * 26, /* spi */
+ 4 * 23, /* spu */
+ 4 * 22, /* bpc */
+ 4 * 20, /* pc */
+ 4 * 16, /* accl */
+ 4 * 15 /* acch */
};
#define PSW_OFFSET (4 * 19)
@@ -354,8 +352,7 @@ m32r_linux_supply_gregset (const struct regset *regset,
const void *gregs, size_t size)
{
const gdb_byte *regs = (const gdb_byte *) gregs;
- enum bfd_endian byte_order =
- gdbarch_byte_order (regcache->arch ());
+ enum bfd_endian byte_order = gdbarch_byte_order (regcache->arch ());
ULONGEST psw, bbpsw;
gdb_byte buf[4];
const gdb_byte *p;
@@ -393,13 +390,12 @@ m32r_linux_supply_gregset (const struct regset *regset,
static void
m32r_linux_collect_gregset (const struct regset *regset,
- const struct regcache *regcache,
- int regnum, void *gregs, size_t size)
+ const struct regcache *regcache, int regnum,
+ void *gregs, size_t size)
{
gdb_byte *regs = (gdb_byte *) gregs;
int i;
- enum bfd_endian byte_order =
- gdbarch_byte_order (regcache->arch ());
+ enum bfd_endian byte_order = gdbarch_byte_order (regcache->arch ());
ULONGEST psw;
gdb_byte buf[4];
@@ -422,8 +418,9 @@ m32r_linux_collect_gregset (const struct regset *regset,
case CBR_REGNUM:
break;
case M32R_SP_REGNUM:
- regcache->raw_collect
- (i, regs + ((psw & 0x80) ? SPU_OFFSET : SPI_OFFSET));
+ regcache->raw_collect (i,
+ regs
+ + ((psw & 0x80) ? SPU_OFFSET : SPI_OFFSET));
break;
default:
regcache->raw_collect (i, regs + m32r_pt_regs_offset[i]);
@@ -431,10 +428,8 @@ m32r_linux_collect_gregset (const struct regset *regset,
}
}
-static const struct regset m32r_linux_gregset = {
- NULL,
- m32r_linux_supply_gregset, m32r_linux_collect_gregset
-};
+static const struct regset m32r_linux_gregset
+ = { NULL, m32r_linux_supply_gregset, m32r_linux_collect_gregset };
static void
m32r_linux_iterate_over_regset_sections (struct gdbarch *gdbarch,
@@ -442,14 +437,13 @@ m32r_linux_iterate_over_regset_sections (struct gdbarch *gdbarch,
void *cb_data,
const struct regcache *regcache)
{
- cb (".reg", M32R_LINUX_GREGS_SIZE, M32R_LINUX_GREGS_SIZE, &m32r_linux_gregset,
- NULL, cb_data);
+ cb (".reg", M32R_LINUX_GREGS_SIZE, M32R_LINUX_GREGS_SIZE,
+ &m32r_linux_gregset, NULL, cb_data);
}
static void
m32r_linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
{
-
linux_init_abi (info, gdbarch, 0);
/* Since EVB register is not available for native debug, we reduce
@@ -460,12 +454,12 @@ m32r_linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
/* GNU/Linux uses SVR4-style shared libraries. */
set_gdbarch_skip_trampoline_code (gdbarch, find_solib_trampoline_target);
- set_solib_svr4_fetch_link_map_offsets
- (gdbarch, linux_ilp32_fetch_link_map_offsets);
+ set_solib_svr4_fetch_link_map_offsets (gdbarch,
+ linux_ilp32_fetch_link_map_offsets);
/* Core file support. */
- set_gdbarch_iterate_over_regset_sections
- (gdbarch, m32r_linux_iterate_over_regset_sections);
+ set_gdbarch_iterate_over_regset_sections (
+ gdbarch, m32r_linux_iterate_over_regset_sections);
/* Enable TLS support. */
set_gdbarch_fetch_tls_load_module_address (gdbarch,
@@ -473,6 +467,7 @@ m32r_linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
}
void _initialize_m32r_linux_tdep ();
+
void
_initialize_m32r_linux_tdep ()
{
diff --git a/gdb/m32r-tdep.c b/gdb/m32r-tdep.c
index fb1dc661867..a6df53367dd 100644
--- a/gdb/m32r-tdep.c
+++ b/gdb/m32r-tdep.c
@@ -51,7 +51,6 @@ m32r_frame_align (struct gdbarch *gdbarch, CORE_ADDR sp)
return sp & ~3;
}
-
/* Breakpoints
The little endian mode of M32R is unique. In most of architectures,
@@ -83,12 +82,12 @@ m32r_memory_insert_breakpoint (struct gdbarch *gdbarch,
int val;
gdb_byte buf[4];
gdb_byte contents_cache[4];
- gdb_byte bp_entry[] = { 0x10, 0xf1 }; /* dpt */
+ gdb_byte bp_entry[] = { 0x10, 0xf1 }; /* dpt */
/* Save the memory contents. */
val = target_read_memory (addr & 0xfffffffc, contents_cache, 4);
if (val != 0)
- return val; /* return error */
+ return val; /* return error */
memcpy (bp_tgt->shadow_contents, contents_cache, 4);
bp_tgt->shadow_len = 4;
@@ -111,7 +110,7 @@ m32r_memory_insert_breakpoint (struct gdbarch *gdbarch,
buf[3] = bp_entry[1];
}
}
- else /* little-endian */
+ else /* little-endian */
{
if ((addr & 3) == 0)
{
@@ -154,7 +153,7 @@ m32r_memory_remove_breakpoint (struct gdbarch *gdbarch,
if ((buf[0] & 0x80) == 0 && (buf[2] & 0x80) != 0)
buf[2] &= 0x7f;
}
- else /* little-endian */
+ else /* little-endian */
{
if ((buf[3] & 0x80) == 0 && (buf[1] & 0x80) != 0)
buf[1] &= 0x7f;
@@ -181,12 +180,8 @@ m32r_breakpoint_kind_from_pc (struct gdbarch *gdbarch, CORE_ADDR *pcptr)
static const gdb_byte *
m32r_sw_breakpoint_from_kind (struct gdbarch *gdbarch, int kind, int *size)
{
- static gdb_byte be_bp_entry[] = {
- 0x10, 0xf1, 0x70, 0x00
- }; /* dpt -> nop */
- static gdb_byte le_bp_entry[] = {
- 0x00, 0x70, 0xf1, 0x10
- }; /* dpt -> nop */
+ static gdb_byte be_bp_entry[] = { 0x10, 0xf1, 0x70, 0x00 }; /* dpt -> nop */
+ static gdb_byte le_bp_entry[] = { 0x00, 0x70, 0xf1, 0x10 }; /* dpt -> nop */
*size = kind;
@@ -202,12 +197,10 @@ m32r_sw_breakpoint_from_kind (struct gdbarch *gdbarch, int kind, int *size)
}
}
-static const char * const m32r_register_names[] = {
- "r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7",
- "r8", "r9", "r10", "r11", "r12", "fp", "lr", "sp",
- "psw", "cbr", "spi", "spu", "bpc", "pc", "accl", "acch",
- "evb"
-};
+static const char *const m32r_register_names[]
+ = { "r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7", "r8",
+ "r9", "r10", "r11", "r12", "fp", "lr", "sp", "psw", "cbr",
+ "spi", "spu", "bpc", "pc", "accl", "acch", "evb" };
static const char *
m32r_register_name (struct gdbarch *gdbarch, int reg_nr)
@@ -216,7 +209,6 @@ m32r_register_name (struct gdbarch *gdbarch, int reg_nr)
return m32r_register_names[reg_nr];
}
-
/* Return the GDB type object for the "standard" data type
of data in register N. */
@@ -231,7 +223,6 @@ m32r_register_type (struct gdbarch *gdbarch, int reg_nr)
return builtin_type (gdbarch)->builtin_int32;
}
-
/* Write into appropriate registers a function return value
of type TYPE, given in virtual format.
@@ -251,8 +242,7 @@ m32r_store_return_value (struct type *type, struct regcache *regcache,
if (len > 4)
{
- regval = extract_unsigned_integer (valbuf + 4,
- len - 4, byte_order);
+ regval = extract_unsigned_integer (valbuf + 4, len - 4, byte_order);
regcache_cooked_write_unsigned (regcache, RET1_REGNUM + 1, regval);
}
}
@@ -261,9 +251,9 @@ m32r_store_return_value (struct type *type, struct regcache *regcache,
should be cached because this thrashing is getting nuts. */
static int
-decode_prologue (struct gdbarch *gdbarch,
- CORE_ADDR start_pc, CORE_ADDR scan_limit,
- CORE_ADDR *pl_endptr, unsigned long *framelength)
+decode_prologue (struct gdbarch *gdbarch, CORE_ADDR start_pc,
+ CORE_ADDR scan_limit, CORE_ADDR *pl_endptr,
+ unsigned long *framelength)
{
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
unsigned long framesize;
@@ -301,39 +291,38 @@ decode_prologue (struct gdbarch *gdbarch,
if (insn & 0x8000)
{
if (current_pc == scan_limit)
- scan_limit += 2; /* extend the search */
+ scan_limit += 2; /* extend the search */
- current_pc += 2; /* skip the immediate data */
+ current_pc += 2; /* skip the immediate data */
/* Check if current pc's location is readable. */
if (!safe_read_memory_integer (current_pc, 2, byte_order,
&return_value))
return -1;
- if (insn == 0x8faf) /* add3 sp, sp, xxxx */
+ if (insn == 0x8faf) /* add3 sp, sp, xxxx */
/* add 16 bit sign-extended offset */
{
- framesize +=
- -((short) read_memory_unsigned_integer (current_pc,
- 2, byte_order));
+ framesize
+ += -((short) read_memory_unsigned_integer (current_pc, 2,
+ byte_order));
}
else
{
if (((insn >> 8) == 0xe4) /* ld24 r4, xxxxxx; sub sp, r4 */
- && safe_read_memory_integer (current_pc + 2,
- 2, byte_order,
- &return_value)
- && read_memory_unsigned_integer (current_pc + 2,
- 2, byte_order)
- == 0x0f24)
+ && safe_read_memory_integer (current_pc + 2, 2,
+ byte_order, &return_value)
+ && read_memory_unsigned_integer (current_pc + 2, 2,
+ byte_order)
+ == 0x0f24)
{
/* Subtract 24 bit sign-extended negative-offset. */
- insn = read_memory_unsigned_integer (current_pc - 2,
- 4, byte_order);
- if (insn & 0x00800000) /* sign extend */
- insn |= 0xff000000; /* negative */
+ insn = read_memory_unsigned_integer (current_pc - 2, 4,
+ byte_order);
+ if (insn & 0x00800000) /* sign extend */
+ insn |= 0xff000000; /* negative */
else
- insn &= 0x00ffffff; /* positive */
+ insn &= 0x00ffffff; /* positive */
framesize += insn;
}
}
@@ -341,15 +330,15 @@ decode_prologue (struct gdbarch *gdbarch,
continue;
}
}
- op1 = insn & 0xf000; /* Isolate just the first nibble. */
+ op1 = insn & 0xf000; /* Isolate just the first nibble. */
if ((insn & 0xf0ff) == 0x207f)
- { /* st reg, @-sp */
+ { /* st reg, @-sp */
framesize += 4;
after_prologue = 0;
continue;
}
- if ((insn >> 8) == 0x4f) /* addi sp, xx */
+ if ((insn >> 8) == 0x4f) /* addi sp, xx */
/* Add 8 bit sign-extended offset. */
{
int stack_adjust = (signed char) (insn & 0xff);
@@ -370,16 +359,16 @@ decode_prologue (struct gdbarch *gdbarch,
continue;
}
if (insn == 0x1d8f)
- { /* mv fp, sp */
+ { /* mv fp, sp */
after_prologue = current_pc + 2;
- break; /* end of stack adjustments */
+ break; /* end of stack adjustments */
}
/* Nop looks like a branch, continue explicitly. */
if (insn == 0x7000)
{
after_prologue = current_pc + 2;
- continue; /* nop occurs between pushes. */
+ continue; /* nop occurs between pushes. */
}
/* End of prolog if any of these are trap instructions. */
if ((insn & 0xfff0) == 0x10f0)
@@ -400,7 +389,7 @@ decode_prologue (struct gdbarch *gdbarch,
if ((subop == 0x0ec0) || (subop == 0x0fc0))
{
after_prologue = current_pc;
- continue; /* jmp , jl */
+ continue; /* jmp , jl */
}
}
}
@@ -444,7 +433,7 @@ decode_prologue (struct gdbarch *gdbarch,
*pl_endptr = after_prologue;
return 0;
-} /* decode_prologue */
+} /* decode_prologue */
/* Function: skip_prologue
Find end of function prologue. */
@@ -516,8 +505,7 @@ struct m32r_unwind_cache
for it IS the sp for the next frame. */
static struct m32r_unwind_cache *
-m32r_frame_unwind_cache (frame_info_ptr this_frame,
- void **this_prologue_cache)
+m32r_frame_unwind_cache (frame_info_ptr this_frame, void **this_prologue_cache)
{
CORE_ADDR pc, scan_limit;
ULONGEST prev_sp;
@@ -526,7 +514,6 @@ m32r_frame_unwind_cache (frame_info_ptr this_frame,
int i;
struct m32r_unwind_cache *info;
-
if ((*this_prologue_cache))
return (struct m32r_unwind_cache *) (*this_prologue_cache);
@@ -539,8 +526,7 @@ m32r_frame_unwind_cache (frame_info_ptr this_frame,
info->uses_frame = 0;
scan_limit = get_frame_pc (this_frame);
- for (pc = get_frame_func (this_frame);
- pc > 0 && pc < scan_limit; pc += 2)
+ for (pc = get_frame_func (this_frame); pc > 0 && pc < scan_limit; pc += 2)
{
if ((pc & 2) == 0)
{
@@ -555,18 +541,18 @@ m32r_frame_unwind_cache (frame_info_ptr this_frame,
info->sp_offset += n;
}
else if (((op >> 8) == 0xe4)
- && get_frame_memory_unsigned (this_frame, pc + 2,
- 2) == 0x0f24)
+ && get_frame_memory_unsigned (this_frame, pc + 2, 2)
+ == 0x0f24)
{
/* ld24 r4, xxxxxx; sub sp, r4 */
unsigned long n = op & 0xffffff;
info->sp_offset += n;
- pc += 2; /* skip sub instruction */
+ pc += 2; /* skip sub instruction */
}
if (pc == scan_limit)
- scan_limit += 2; /* extend the search */
- pc += 2; /* skip the immediate data */
+ scan_limit += 2; /* extend the search */
+ pc += 2; /* skip the immediate data */
continue;
}
}
@@ -591,12 +577,12 @@ m32r_frame_unwind_cache (frame_info_ptr this_frame,
/* mv fp, sp */
info->uses_frame = 1;
info->r13_offset = info->sp_offset;
- break; /* end of stack adjustments */
+ break; /* end of stack adjustments */
}
else if ((op & 0xfff0) == 0x10f0)
{
/* End of prologue if this is a trap instruction. */
- break; /* End of stack adjustments. */
+ break; /* End of stack adjustments. */
}
}
@@ -683,7 +669,7 @@ m32r_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
/* Now make sure there's space on the stack. */
for (argnum = 0, stack_alloc = 0; argnum < nargs; argnum++)
stack_alloc += ((value_type (args[argnum])->length () + 3) & ~3);
- sp -= stack_alloc; /* Make room on stack for args. */
+ sp -= stack_alloc; /* Make room on stack for args. */
for (argnum = 0, stack_offset = 0; argnum < nargs; argnum++)
{
@@ -724,10 +710,10 @@ m32r_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
else if (argreg <= ARGN_REGNUM)
{
/* There's room in a register. */
- regval =
- extract_unsigned_integer (val,
- register_size (gdbarch, argreg),
- byte_order);
+ regval
+ = extract_unsigned_integer (val,
+ register_size (gdbarch, argreg),
+ byte_order);
regcache_cooked_write_unsigned (regcache, argreg++, regval);
}
@@ -745,7 +731,6 @@ m32r_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
return sp;
}
-
/* Given a return value in `regbuf' with a type `valtype',
extract and copy its value into `valbuf'. */
@@ -793,8 +778,8 @@ m32r_return_value (struct gdbarch *gdbarch, struct value *function,
frame. This will be used to create a new GDB frame struct. */
static void
-m32r_frame_this_id (frame_info_ptr this_frame,
- void **this_prologue_cache, struct frame_id *this_id)
+m32r_frame_this_id (frame_info_ptr this_frame, void **this_prologue_cache,
+ struct frame_id *this_id)
{
struct m32r_unwind_cache *info
= m32r_frame_unwind_cache (this_frame, this_prologue_cache);
@@ -831,15 +816,14 @@ m32r_frame_prev_register (frame_info_ptr this_frame,
return trad_frame_get_prev_register (this_frame, info->saved_regs, regnum);
}
-static const struct frame_unwind m32r_frame_unwind = {
- "m32r prologue",
- NORMAL_FRAME,
- default_frame_unwind_stop_reason,
- m32r_frame_this_id,
- m32r_frame_prev_register,
- NULL,
- default_frame_sniffer
-};
+static const struct frame_unwind m32r_frame_unwind
+ = { "m32r prologue",
+ NORMAL_FRAME,
+ default_frame_unwind_stop_reason,
+ m32r_frame_this_id,
+ m32r_frame_prev_register,
+ NULL,
+ default_frame_sniffer };
static CORE_ADDR
m32r_frame_base_address (frame_info_ptr this_frame, void **this_cache)
@@ -849,12 +833,9 @@ m32r_frame_base_address (frame_info_ptr this_frame, void **this_cache)
return info->base;
}
-static const struct frame_base m32r_frame_base = {
- &m32r_frame_unwind,
- m32r_frame_base_address,
- m32r_frame_base_address,
- m32r_frame_base_address
-};
+static const struct frame_base m32r_frame_base
+ = { &m32r_frame_unwind, m32r_frame_base_address, m32r_frame_base_address,
+ m32r_frame_base_address };
static gdbarch_init_ftype m32r_gdbarch_init;
@@ -908,6 +889,7 @@ m32r_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
}
void _initialize_m32r_tdep ();
+
void
_initialize_m32r_tdep ()
{
diff --git a/gdb/m68hc11-tdep.c b/gdb/m68hc11-tdep.c
index 6625506cc4a..9a7f4dbeac4 100644
--- a/gdb/m68hc11-tdep.c
+++ b/gdb/m68hc11-tdep.c
@@ -19,7 +19,6 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
-
#include "defs.h"
#include "frame.h"
#include "frame-unwind.h"
@@ -32,7 +31,7 @@
#include "gdbcore.h"
#include "value.h"
#include "inferior.h"
-#include "dis-asm.h"
+#include "dis-asm.h"
#include "symfile.h"
#include "objfiles.h"
#include "arch-utils.h"
@@ -57,35 +56,31 @@
MSYMBOL_IS_RTC Tests the "RTC" bit in a minimal symbol.
MSYMBOL_IS_RTI Tests the "RTC" bit in a minimal symbol. */
-#define MSYMBOL_SET_RTC(msym) \
- (msym)->set_target_flag_1 (true)
+#define MSYMBOL_SET_RTC(msym) (msym)->set_target_flag_1 (true)
-#define MSYMBOL_SET_RTI(msym) \
- (msym)->set_target_flag_2 (true)
+#define MSYMBOL_SET_RTI(msym) (msym)->set_target_flag_2 (true)
-#define MSYMBOL_IS_RTC(msym) \
- (msym)->target_flag_1 ()
+#define MSYMBOL_IS_RTC(msym) (msym)->target_flag_1 ()
-#define MSYMBOL_IS_RTI(msym) \
- (msym)->target_flag_2 ()
+#define MSYMBOL_IS_RTI(msym) (msym)->target_flag_2 ()
-enum insn_return_kind {
+enum insn_return_kind
+{
RETURN_RTS,
RETURN_RTC,
RETURN_RTI
};
-
/* Register numbers of various important registers. */
-#define HARD_X_REGNUM 0
-#define HARD_D_REGNUM 1
-#define HARD_Y_REGNUM 2
-#define HARD_SP_REGNUM 3
-#define HARD_PC_REGNUM 4
+#define HARD_X_REGNUM 0
+#define HARD_D_REGNUM 1
+#define HARD_Y_REGNUM 2
+#define HARD_SP_REGNUM 3
+#define HARD_PC_REGNUM 4
-#define HARD_A_REGNUM 5
-#define HARD_B_REGNUM 6
+#define HARD_A_REGNUM 5
+#define HARD_B_REGNUM 6
#define HARD_CCR_REGNUM 7
/* 68HC12 page number register.
@@ -99,49 +94,50 @@ enum insn_return_kind {
/* Z is replaced by X or Y by gcc during machine reorg.
??? There is no way to get it and even know whether
it's in X or Y or in ZS. */
-#define SOFT_Z_REGNUM 8
+#define SOFT_Z_REGNUM 8
/* Soft registers. These registers are special. There are treated
like normal hard registers by gcc and gdb (ie, within dwarf2 info).
They are physically located in memory. */
-#define SOFT_FP_REGNUM 9
-#define SOFT_TMP_REGNUM 10
-#define SOFT_ZS_REGNUM 11
-#define SOFT_XY_REGNUM 12
-#define SOFT_UNUSED_REGNUM 13
-#define SOFT_D1_REGNUM 14
-#define SOFT_D32_REGNUM (SOFT_D1_REGNUM+31)
+#define SOFT_FP_REGNUM 9
+#define SOFT_TMP_REGNUM 10
+#define SOFT_ZS_REGNUM 11
+#define SOFT_XY_REGNUM 12
+#define SOFT_UNUSED_REGNUM 13
+#define SOFT_D1_REGNUM 14
+#define SOFT_D32_REGNUM (SOFT_D1_REGNUM + 31)
#define M68HC11_MAX_SOFT_REGS 32
-#define M68HC11_NUM_REGS (M68HC11_LAST_HARD_REG + 1)
-#define M68HC11_NUM_PSEUDO_REGS (M68HC11_MAX_SOFT_REGS+5)
-#define M68HC11_ALL_REGS (M68HC11_NUM_REGS+M68HC11_NUM_PSEUDO_REGS)
+#define M68HC11_NUM_REGS (M68HC11_LAST_HARD_REG + 1)
+#define M68HC11_NUM_PSEUDO_REGS (M68HC11_MAX_SOFT_REGS + 5)
+#define M68HC11_ALL_REGS (M68HC11_NUM_REGS + M68HC11_NUM_PSEUDO_REGS)
-#define M68HC11_REG_SIZE (2)
+#define M68HC11_REG_SIZE (2)
-#define M68HC12_NUM_REGS (9)
-#define M68HC12_NUM_PSEUDO_REGS ((M68HC11_MAX_SOFT_REGS+5)+1-1)
-#define M68HC12_HARD_PC_REGNUM (SOFT_D32_REGNUM+1)
+#define M68HC12_NUM_REGS (9)
+#define M68HC12_NUM_PSEUDO_REGS ((M68HC11_MAX_SOFT_REGS + 5) + 1 - 1)
+#define M68HC12_HARD_PC_REGNUM (SOFT_D32_REGNUM + 1)
struct insn_sequence;
+
struct m68gc11_gdbarch_tdep : gdbarch_tdep_base
- {
- /* Stack pointer correction value. For 68hc11, the stack pointer points
+{
+ /* Stack pointer correction value. For 68hc11, the stack pointer points
to the next push location. An offset of 1 must be applied to obtain
the address where the last value is saved. For 68hc12, the stack
pointer points to the last value pushed. No offset is necessary. */
- int stack_correction = 0;
+ int stack_correction = 0;
- /* Description of instructions in the prologue. */
- struct insn_sequence *prologue = nullptr;
+ /* Description of instructions in the prologue. */
+ struct insn_sequence *prologue = nullptr;
- /* True if the page memory bank register is available
+ /* True if the page memory bank register is available
and must be used. */
- int use_page_register = 0;
+ int use_page_register = 0;
- /* ELF flags for ABI. */
- int elf_flags = 0;
- };
+ /* ELF flags for ABI. */
+ int elf_flags = 0;
+};
static int
stack_correction (gdbarch *arch)
@@ -178,22 +174,17 @@ struct m68hc11_unwind_cache
/* Table of registers for 68HC11. This includes the hard registers
and the soft registers used by GCC. */
-static const char *
-m68hc11_register_names[] =
-{
- "x", "d", "y", "sp", "pc", "a", "b",
- "ccr", "page", "frame","tmp", "zs", "xy", 0,
- "d1", "d2", "d3", "d4", "d5", "d6", "d7",
- "d8", "d9", "d10", "d11", "d12", "d13", "d14",
- "d15", "d16", "d17", "d18", "d19", "d20", "d21",
- "d22", "d23", "d24", "d25", "d26", "d27", "d28",
- "d29", "d30", "d31", "d32"
-};
-
-struct m68hc11_soft_reg
+static const char *m68hc11_register_names[]
+ = { "x", "d", "y", "sp", "pc", "a", "b", "ccr", "page", "frame",
+ "tmp", "zs", "xy", 0, "d1", "d2", "d3", "d4", "d5", "d6",
+ "d7", "d8", "d9", "d10", "d11", "d12", "d13", "d14", "d15", "d16",
+ "d17", "d18", "d19", "d20", "d21", "d22", "d23", "d24", "d25", "d26",
+ "d27", "d28", "d29", "d30", "d31", "d32" };
+
+struct m68hc11_soft_reg
{
const char *name;
- CORE_ADDR addr;
+ CORE_ADDR addr;
};
static struct m68hc11_soft_reg soft_regs[M68HC11_ALL_REGS];
@@ -233,21 +224,21 @@ m68hc11_get_register_info (struct m68hc11_soft_reg *reg, const char *name)
/* Initialize the table of soft register addresses according
to the symbol table. */
- static void
+static void
m68hc11_initialize_register_info (void)
{
int i;
if (soft_reg_initialized)
return;
-
+
soft_min_addr = INT_MAX;
soft_max_addr = 0;
for (i = 0; i < M68HC11_ALL_REGS; i++)
{
soft_regs[i].name = 0;
}
-
+
m68hc11_get_register_info (&soft_regs[SOFT_FP_REGNUM], "_.frame");
m68hc11_get_register_info (&soft_regs[SOFT_TMP_REGNUM], "_.tmp");
m68hc11_get_register_info (&soft_regs[SOFT_ZS_REGNUM], "_.z");
@@ -263,8 +254,8 @@ m68hc11_initialize_register_info (void)
}
if (soft_regs[SOFT_FP_REGNUM].name == 0)
- warning (_("No frame soft register found in the symbol table.\n"
- "Stack backtrace will not work."));
+ warning (_ ("No frame soft register found in the symbol table.\n"
+ "Stack backtrace will not work."));
soft_reg_initialized = 1;
}
@@ -274,10 +265,10 @@ static int
m68hc11_which_soft_register (CORE_ADDR addr)
{
int i;
-
+
if (addr < soft_min_addr || addr > soft_max_addr)
return -1;
-
+
for (i = SOFT_FP_REGNUM; i < M68HC11_ALL_REGS; i++)
{
if (soft_regs[i].name && soft_regs[i].addr == addr)
@@ -291,8 +282,8 @@ m68hc11_which_soft_register (CORE_ADDR addr)
fetch into a memory read. */
static enum register_status
m68hc11_pseudo_register_read (struct gdbarch *gdbarch,
- readable_regcache *regcache,
- int regno, gdb_byte *buf)
+ readable_regcache *regcache, int regno,
+ gdb_byte *buf)
{
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
@@ -321,7 +312,7 @@ m68hc11_pseudo_register_read (struct gdbarch *gdbarch,
}
m68hc11_initialize_register_info ();
-
+
/* Fetch a soft register: translate into a memory read. */
if (soft_regs[regno].name)
{
@@ -339,8 +330,8 @@ m68hc11_pseudo_register_read (struct gdbarch *gdbarch,
into a memory write. */
static void
m68hc11_pseudo_register_write (struct gdbarch *gdbarch,
- struct regcache *regcache,
- int regno, const gdb_byte *buf)
+ struct regcache *regcache, int regno,
+ const gdb_byte *buf)
{
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
@@ -367,7 +358,7 @@ m68hc11_pseudo_register_write (struct gdbarch *gdbarch,
regcache_cooked_write_unsigned (regcache, HARD_PC_REGNUM, pc);
return;
}
-
+
m68hc11_initialize_register_info ();
/* Store a soft register: translate into a memory write. */
@@ -402,43 +393,43 @@ m68hc11_register_name (struct gdbarch *gdbarch, int reg_nr)
return m68hc11_register_names[reg_nr];
}
-constexpr gdb_byte m68hc11_break_insn[] = {0x0};
+constexpr gdb_byte m68hc11_break_insn[] = { 0x0 };
typedef BP_MANIPULATION (m68hc11_break_insn) m68hc11_breakpoint;
-
+
/* 68HC11 & 68HC12 prologue analysis. */
#define MAX_CODES 12
/* 68HC11 opcodes. */
#undef M6811_OP_PAGE2
-#define M6811_OP_PAGE2 (0x18)
-#define M6811_OP_LDX (0xde)
+#define M6811_OP_PAGE2 (0x18)
+#define M6811_OP_LDX (0xde)
#define M6811_OP_LDX_EXT (0xfe)
-#define M6811_OP_PSHX (0x3c)
-#define M6811_OP_STS (0x9f)
+#define M6811_OP_PSHX (0x3c)
+#define M6811_OP_STS (0x9f)
#define M6811_OP_STS_EXT (0xbf)
-#define M6811_OP_TSX (0x30)
-#define M6811_OP_XGDX (0x8f)
-#define M6811_OP_ADDD (0xc3)
-#define M6811_OP_TXS (0x35)
-#define M6811_OP_DES (0x34)
+#define M6811_OP_TSX (0x30)
+#define M6811_OP_XGDX (0x8f)
+#define M6811_OP_ADDD (0xc3)
+#define M6811_OP_TXS (0x35)
+#define M6811_OP_DES (0x34)
/* 68HC12 opcodes. */
-#define M6812_OP_PAGE2 (0x18)
-#define M6812_OP_MOVW (0x01)
-#define M6812_PB_PSHW (0xae)
-#define M6812_OP_STS (0x5f)
+#define M6812_OP_PAGE2 (0x18)
+#define M6812_OP_MOVW (0x01)
+#define M6812_PB_PSHW (0xae)
+#define M6812_OP_STS (0x5f)
#define M6812_OP_STS_EXT (0x7f)
-#define M6812_OP_LEAS (0x1b)
-#define M6812_OP_PSHX (0x34)
-#define M6812_OP_PSHY (0x35)
+#define M6812_OP_LEAS (0x1b)
+#define M6812_OP_PSHX (0x34)
+#define M6812_OP_PSHY (0x35)
/* Operand extraction. */
-#define OP_DIRECT (0x100) /* 8-byte direct addressing. */
-#define OP_IMM_LOW (0x200) /* Low part of 16-bit constant/address. */
-#define OP_IMM_HIGH (0x300) /* High part of 16-bit constant/address. */
-#define OP_PBYTE (0x400) /* 68HC12 indexed operand. */
+#define OP_DIRECT (0x100) /* 8-byte direct addressing. */
+#define OP_IMM_LOW (0x200) /* Low part of 16-bit constant/address. */
+#define OP_IMM_HIGH (0x300) /* High part of 16-bit constant/address. */
+#define OP_PBYTE (0x400) /* 68HC12 indexed operand. */
/* Identification of the sequence. */
enum m6811_seq_type
@@ -451,7 +442,8 @@ enum m6811_seq_type
P_LOCAL_N /* Allocate N bytes for locals. */
};
-struct insn_sequence {
+struct insn_sequence
+{
enum m6811_seq_type type;
unsigned length;
unsigned short code[MAX_CODES];
@@ -460,29 +452,32 @@ struct insn_sequence {
/* Sequence of instructions in the 68HC11 function prologue. */
static struct insn_sequence m6811_prologue[] = {
/* Sequences to save a soft-register. */
- { P_SAVE_REG, 3, { M6811_OP_LDX, OP_DIRECT,
- M6811_OP_PSHX } },
- { P_SAVE_REG, 5, { M6811_OP_PAGE2, M6811_OP_LDX, OP_DIRECT,
- M6811_OP_PAGE2, M6811_OP_PSHX } },
- { P_SAVE_REG, 4, { M6811_OP_LDX_EXT, OP_IMM_HIGH, OP_IMM_LOW,
- M6811_OP_PSHX } },
- { P_SAVE_REG, 6, { M6811_OP_PAGE2, M6811_OP_LDX_EXT, OP_IMM_HIGH, OP_IMM_LOW,
- M6811_OP_PAGE2, M6811_OP_PSHX } },
+ { P_SAVE_REG, 3, { M6811_OP_LDX, OP_DIRECT, M6811_OP_PSHX } },
+ { P_SAVE_REG,
+ 5,
+ { M6811_OP_PAGE2, M6811_OP_LDX, OP_DIRECT, M6811_OP_PAGE2,
+ M6811_OP_PSHX } },
+ { P_SAVE_REG,
+ 4,
+ { M6811_OP_LDX_EXT, OP_IMM_HIGH, OP_IMM_LOW, M6811_OP_PSHX } },
+ { P_SAVE_REG,
+ 6,
+ { M6811_OP_PAGE2, M6811_OP_LDX_EXT, OP_IMM_HIGH, OP_IMM_LOW,
+ M6811_OP_PAGE2, M6811_OP_PSHX } },
/* Sequences to allocate local variables. */
- { P_LOCAL_N, 7, { M6811_OP_TSX,
- M6811_OP_XGDX,
- M6811_OP_ADDD, OP_IMM_HIGH, OP_IMM_LOW,
- M6811_OP_XGDX,
- M6811_OP_TXS } },
- { P_LOCAL_N, 11, { M6811_OP_PAGE2, M6811_OP_TSX,
- M6811_OP_PAGE2, M6811_OP_XGDX,
- M6811_OP_ADDD, OP_IMM_HIGH, OP_IMM_LOW,
- M6811_OP_PAGE2, M6811_OP_XGDX,
- M6811_OP_PAGE2, M6811_OP_TXS } },
- { P_LOCAL_1, 1, { M6811_OP_DES } },
- { P_LOCAL_2, 1, { M6811_OP_PSHX } },
- { P_LOCAL_2, 2, { M6811_OP_PAGE2, M6811_OP_PSHX } },
+ { P_LOCAL_N,
+ 7,
+ { M6811_OP_TSX, M6811_OP_XGDX, M6811_OP_ADDD, OP_IMM_HIGH, OP_IMM_LOW,
+ M6811_OP_XGDX, M6811_OP_TXS } },
+ { P_LOCAL_N,
+ 11,
+ { M6811_OP_PAGE2, M6811_OP_TSX, M6811_OP_PAGE2, M6811_OP_XGDX,
+ M6811_OP_ADDD, OP_IMM_HIGH, OP_IMM_LOW, M6811_OP_PAGE2, M6811_OP_XGDX,
+ M6811_OP_PAGE2, M6811_OP_TXS } },
+ { P_LOCAL_1, 1, { M6811_OP_DES } },
+ { P_LOCAL_2, 1, { M6811_OP_PSHX } },
+ { P_LOCAL_2, 2, { M6811_OP_PAGE2, M6811_OP_PSHX } },
/* Initialize the frame pointer. */
{ P_SET_FRAME, 2, { M6811_OP_STS, OP_DIRECT } },
@@ -490,19 +485,18 @@ static struct insn_sequence m6811_prologue[] = {
{ P_LAST, 0, { 0 } }
};
-
/* Sequence of instructions in the 68HC12 function prologue. */
-static struct insn_sequence m6812_prologue[] = {
- { P_SAVE_REG, 5, { M6812_OP_PAGE2, M6812_OP_MOVW, M6812_PB_PSHW,
- OP_IMM_HIGH, OP_IMM_LOW } },
- { P_SET_FRAME, 2, { M6812_OP_STS, OP_DIRECT } },
- { P_SET_FRAME, 3, { M6812_OP_STS_EXT, OP_IMM_HIGH, OP_IMM_LOW } },
- { P_LOCAL_N, 2, { M6812_OP_LEAS, OP_PBYTE } },
- { P_LOCAL_2, 1, { M6812_OP_PSHX } },
- { P_LOCAL_2, 1, { M6812_OP_PSHY } },
- { P_LAST, 0 }
-};
-
+static struct insn_sequence m6812_prologue[]
+ = { { P_SAVE_REG,
+ 5,
+ { M6812_OP_PAGE2, M6812_OP_MOVW, M6812_PB_PSHW, OP_IMM_HIGH,
+ OP_IMM_LOW } },
+ { P_SET_FRAME, 2, { M6812_OP_STS, OP_DIRECT } },
+ { P_SET_FRAME, 3, { M6812_OP_STS_EXT, OP_IMM_HIGH, OP_IMM_LOW } },
+ { P_LOCAL_N, 2, { M6812_OP_LEAS, OP_PBYTE } },
+ { P_LOCAL_2, 1, { M6812_OP_PSHX } },
+ { P_LOCAL_2, 1, { M6812_OP_PSHY } },
+ { P_LAST, 0 } };
/* Analyze the sequence of instructions starting at the given address.
Returns a pointer to the sequence when it is recognized and
@@ -527,17 +521,17 @@ m68hc11_analyze_instruction (struct gdbarch *gdbarch,
{
if (bufsize < j + 1)
{
- buffer[bufsize] = read_memory_unsigned_integer (pc + bufsize,
- 1, byte_order);
+ buffer[bufsize]
+ = read_memory_unsigned_integer (pc + bufsize, 1, byte_order);
bufsize++;
}
/* Continue while we match the opcode. */
if (seq->code[j] == buffer[j])
continue;
-
+
if ((seq->code[j] & 0xf00) == 0)
break;
-
+
/* Extract a sequence parameter (address or constant). */
switch (seq->code[j])
{
@@ -641,7 +635,7 @@ m68hc11_scan_prologue (struct gdbarch *gdbarch, CORE_ADDR pc,
m68gc11_gdbarch_tdep *tdep = gdbarch_tdep<m68gc11_gdbarch_tdep> (gdbarch);
seq_table = tdep->prologue;
-
+
/* The 68hc11 stack is as follows:
@@ -831,7 +825,7 @@ m68hc11_frame_unwind_cache (frame_info_ptr this_frame,
this_base += stack_correction (gdbarch);
if (soft_regs[SOFT_FP_REGNUM].name)
info->saved_regs[SOFT_FP_REGNUM].set_addr (info->size - 2);
- }
+ }
if (info->return_kind == RETURN_RTC)
{
@@ -874,8 +868,7 @@ m68hc11_frame_unwind_cache (frame_info_ptr this_frame,
frame. This will be used to create a new GDB frame struct. */
static void
-m68hc11_frame_this_id (frame_info_ptr this_frame,
- void **this_prologue_cache,
+m68hc11_frame_this_id (frame_info_ptr this_frame, void **this_prologue_cache,
struct frame_id *this_id)
{
struct m68hc11_unwind_cache *info
@@ -909,8 +902,7 @@ m68hc11_frame_prev_register (frame_info_ptr this_frame,
value = trad_frame_get_prev_register (this_frame, info->saved_regs, regnum);
/* Take into account the 68HC12 specific call (PC + page). */
- if (regnum == HARD_PC_REGNUM
- && info->return_kind == RETURN_RTC
+ if (regnum == HARD_PC_REGNUM && info->return_kind == RETURN_RTC
&& use_page_register (get_frame_arch (this_frame)))
{
CORE_ADDR pc = value_as_long (value);
@@ -936,15 +928,14 @@ m68hc11_frame_prev_register (frame_info_ptr this_frame,
return value;
}
-static const struct frame_unwind m68hc11_frame_unwind = {
- "m68hc11 prologue",
- NORMAL_FRAME,
- default_frame_unwind_stop_reason,
- m68hc11_frame_this_id,
- m68hc11_frame_prev_register,
- NULL,
- default_frame_sniffer
-};
+static const struct frame_unwind m68hc11_frame_unwind
+ = { "m68hc11 prologue",
+ NORMAL_FRAME,
+ default_frame_unwind_stop_reason,
+ m68hc11_frame_this_id,
+ m68hc11_frame_prev_register,
+ NULL,
+ default_frame_sniffer };
static CORE_ADDR
m68hc11_frame_base_address (frame_info_ptr this_frame, void **this_cache)
@@ -971,12 +962,9 @@ m68hc11_frame_args_address (frame_info_ptr this_frame, void **this_cache)
return addr;
}
-static const struct frame_base m68hc11_frame_base = {
- &m68hc11_frame_unwind,
- m68hc11_frame_base_address,
- m68hc11_frame_base_address,
- m68hc11_frame_args_address
-};
+static const struct frame_base m68hc11_frame_base
+ = { &m68hc11_frame_unwind, m68hc11_frame_base_address,
+ m68hc11_frame_base_address, m68hc11_frame_args_address };
/* Assuming THIS_FRAME is a dummy, return the frame ID of that dummy
frame. The frame ID's base needs to match the TOS value saved by
@@ -993,7 +981,6 @@ m68hc11_dummy_id (struct gdbarch *gdbarch, frame_info_ptr this_frame)
return frame_id_build (tos, pc);
}
-
/* Get and print the register from the given frame. */
static void
m68hc11_print_register (struct gdbarch *gdbarch, struct ui_file *file,
@@ -1024,8 +1011,7 @@ m68hc11_print_register (struct gdbarch *gdbarch, struct ui_file *file,
ULONGEST page;
page = get_frame_register_unsigned (frame, HARD_PAGE_REGNUM);
- gdb_printf (file, "0x%02x:%04x ", (unsigned) page,
- (unsigned) rval);
+ gdb_printf (file, "0x%02x:%04x ", (unsigned) page, (unsigned) rval);
}
else
{
@@ -1042,14 +1028,10 @@ m68hc11_print_register (struct gdbarch *gdbarch, struct ui_file *file,
int C, Z, N, V;
unsigned char l = rval & 0xff;
- gdb_printf (file, "%c%c%c%c%c%c%c%c ",
- l & M6811_S_BIT ? 'S' : '-',
- l & M6811_X_BIT ? 'X' : '-',
- l & M6811_H_BIT ? 'H' : '-',
- l & M6811_I_BIT ? 'I' : '-',
- l & M6811_N_BIT ? 'N' : '-',
- l & M6811_Z_BIT ? 'Z' : '-',
- l & M6811_V_BIT ? 'V' : '-',
+ gdb_printf (file, "%c%c%c%c%c%c%c%c ", l & M6811_S_BIT ? 'S' : '-',
+ l & M6811_X_BIT ? 'X' : '-', l & M6811_H_BIT ? 'H' : '-',
+ l & M6811_I_BIT ? 'I' : '-', l & M6811_N_BIT ? 'N' : '-',
+ l & M6811_Z_BIT ? 'Z' : '-', l & M6811_V_BIT ? 'V' : '-',
l & M6811_C_BIT ? 'C' : '-');
N = (l & M6811_N_BIT) != 0;
Z = (l & M6811_Z_BIT) != 0;
@@ -1112,7 +1094,7 @@ m68hc11_print_registers_info (struct gdbarch *gdbarch, struct ui_file *file,
gdb_printf (file, "\nCCR=");
m68hc11_print_register (gdbarch, file, frame, HARD_CCR_REGNUM);
-
+
gdb_printf (file, "\nD=");
m68hc11_print_register (gdbarch, file, frame, HARD_D_REGNUM);
@@ -1121,8 +1103,9 @@ m68hc11_print_registers_info (struct gdbarch *gdbarch, struct ui_file *file,
gdb_printf (file, " Y=");
m68hc11_print_register (gdbarch, file, frame, HARD_Y_REGNUM);
-
- m68gc11_gdbarch_tdep *tdep = gdbarch_tdep<m68gc11_gdbarch_tdep> (gdbarch);
+
+ m68gc11_gdbarch_tdep *tdep
+ = gdbarch_tdep<m68gc11_gdbarch_tdep> (gdbarch);
if (tdep->use_page_register)
{
@@ -1137,7 +1120,7 @@ m68hc11_print_registers_info (struct gdbarch *gdbarch, struct ui_file *file,
/* Skip registers which are not defined in the symbol table. */
if (soft_regs[i].name == 0)
continue;
-
+
gdb_printf (file, "D%d=", i - SOFT_D1_REGNUM + 1);
m68hc11_print_register (gdbarch, file, frame, i);
nr++;
@@ -1164,7 +1147,7 @@ m68hc11_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
struct type *type;
const gdb_byte *val;
gdb_byte buf[2];
-
+
first_stack_argnum = 0;
if (return_method == return_method_struct)
regcache_cooked_write_unsigned (regcache, HARD_D_REGNUM, struct_addr);
@@ -1223,7 +1206,6 @@ m68hc11_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
return sp + 2;
}
-
/* Return the GDB type object for the "standard" data type
of data in register N. */
@@ -1263,10 +1245,9 @@ m68hc11_store_return_value (struct type *type, struct regcache *regcache,
regcache->raw_write (HARD_D_REGNUM, valbuf + (len - 2));
}
else
- error (_("return of value > 4 is not supported."));
+ error (_ ("return of value > 4 is not supported."));
}
-
/* Given a return value in `regcache' with a type `type',
extract and copy its value into `valbuf'. */
@@ -1288,19 +1269,19 @@ m68hc11_extract_return_value (struct type *type, struct regcache *regcache,
break;
case 3:
- memcpy ((char*) valbuf + 1, buf, 2);
+ memcpy ((char *) valbuf + 1, buf, 2);
regcache->raw_read (HARD_X_REGNUM, buf);
memcpy (valbuf, buf + 1, 1);
break;
case 4:
- memcpy ((char*) valbuf + 2, buf, 2);
+ memcpy ((char *) valbuf + 2, buf, 2);
regcache->raw_read (HARD_X_REGNUM, buf);
memcpy (valbuf, buf, 2);
break;
default:
- error (_("bad size for return value"));
+ error (_ ("bad size for return value"));
}
}
@@ -1311,8 +1292,7 @@ m68hc11_return_value (struct gdbarch *gdbarch, struct value *function,
{
if (valtype->code () == TYPE_CODE_STRUCT
|| valtype->code () == TYPE_CODE_UNION
- || valtype->code () == TYPE_CODE_ARRAY
- || valtype->length () > 4)
+ || valtype->code () == TYPE_CODE_ARRAY || valtype->length () > 4)
return RETURN_VALUE_STRUCT_CONVENTION;
else
{
@@ -1326,19 +1306,18 @@ m68hc11_return_value (struct gdbarch *gdbarch, struct value *function,
/* Test whether the ELF symbol corresponds to a function using rtc or
rti to return. */
-
+
static void
m68hc11_elf_make_msymbol_special (asymbol *sym, struct minimal_symbol *msym)
{
unsigned char flags;
- flags = ((elf_symbol_type *)sym)->internal_elf_sym.st_other;
+ flags = ((elf_symbol_type *) sym)->internal_elf_sym.st_other;
if (flags & STO_M68HC12_FAR)
MSYMBOL_SET_RTC (msym);
if (flags & STO_M68HC12_INTERRUPT)
MSYMBOL_SET_RTI (msym);
}
-
/* 68HC11/68HC12 register groups.
Identify real hard registers and soft registers used by gcc. */
@@ -1369,10 +1348,8 @@ m68hc11_register_reggroup_p (struct gdbarch *gdbarch, int regnum,
if (group == save_reggroup || group == restore_reggroup)
{
return (regnum <= gdbarch_num_regs (gdbarch)
- || ((regnum == SOFT_FP_REGNUM
- || regnum == SOFT_TMP_REGNUM
- || regnum == SOFT_ZS_REGNUM
- || regnum == SOFT_XY_REGNUM)
+ || ((regnum == SOFT_FP_REGNUM || regnum == SOFT_TMP_REGNUM
+ || regnum == SOFT_ZS_REGNUM || regnum == SOFT_XY_REGNUM)
&& m68hc11_register_name (gdbarch, regnum)));
}
@@ -1386,15 +1363,14 @@ m68hc11_register_reggroup_p (struct gdbarch *gdbarch, int regnum,
if (group == m68hc11_hard_reggroup)
{
return regnum == HARD_PC_REGNUM || regnum == HARD_SP_REGNUM
- || regnum == HARD_X_REGNUM || regnum == HARD_D_REGNUM
- || regnum == HARD_Y_REGNUM || regnum == HARD_CCR_REGNUM;
+ || regnum == HARD_X_REGNUM || regnum == HARD_D_REGNUM
+ || regnum == HARD_Y_REGNUM || regnum == HARD_CCR_REGNUM;
}
return default_register_reggroup_p (gdbarch, regnum, group);
}
static struct gdbarch *
-m68hc11_gdbarch_init (struct gdbarch_info info,
- struct gdbarch_list *arches)
+m68hc11_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
{
int elf_flags;
@@ -1408,8 +1384,7 @@ m68hc11_gdbarch_init (struct gdbarch_info info,
elf_flags = 0;
/* Try to find a pre-existing architecture. */
- for (arches = gdbarch_list_lookup_by_info (arches, &info);
- arches != NULL;
+ for (arches = gdbarch_list_lookup_by_info (arches, &info); arches != NULL;
arches = gdbarch_list_lookup_by_info (arches->next, &info))
{
m68gc11_gdbarch_tdep *tdep
@@ -1445,14 +1420,15 @@ m68hc11_gdbarch_init (struct gdbarch_info info,
tdep->use_page_register = elf_flags & E_M68HC12_BANKS;
tdep->prologue = m6812_prologue;
set_gdbarch_addr_bit (gdbarch, elf_flags & E_M68HC12_BANKS ? 32 : 16);
- set_gdbarch_num_pseudo_regs (gdbarch,
- elf_flags & E_M68HC12_BANKS
- ? M68HC12_NUM_PSEUDO_REGS
- : M68HC11_NUM_PSEUDO_REGS);
+ set_gdbarch_num_pseudo_regs (gdbarch, elf_flags & E_M68HC12_BANKS
+ ? M68HC12_NUM_PSEUDO_REGS
+ : M68HC11_NUM_PSEUDO_REGS);
set_gdbarch_pc_regnum (gdbarch, elf_flags & E_M68HC12_BANKS
- ? M68HC12_HARD_PC_REGNUM : HARD_PC_REGNUM);
+ ? M68HC12_HARD_PC_REGNUM
+ : HARD_PC_REGNUM);
set_gdbarch_num_regs (gdbarch, elf_flags & E_M68HC12_BANKS
- ? M68HC12_NUM_REGS : M68HC11_NUM_REGS);
+ ? M68HC12_NUM_REGS
+ : M68HC11_NUM_REGS);
break;
default:
@@ -1512,7 +1488,7 @@ m68hc11_gdbarch_init (struct gdbarch_info info,
frame_unwind_append_unwinder (gdbarch, &m68hc11_frame_unwind);
frame_base_set_default (gdbarch, &m68hc11_frame_base);
-
+
/* Methods for saving / extracting a dummy frame's ID. The ID's
stack address must match the SP value returned by
PUSH_DUMMY_CALL, and saved by generic_save_dummy_frame_tos. */
@@ -1528,11 +1504,11 @@ m68hc11_gdbarch_init (struct gdbarch_info info,
}
void _initialize_m68hc11_tdep ();
+
void
_initialize_m68hc11_tdep ()
{
gdbarch_register (bfd_arch_m68hc11, m68hc11_gdbarch_init);
gdbarch_register (bfd_arch_m68hc12, m68hc11_gdbarch_init);
m68hc11_init_reggroups ();
-}
-
+}
diff --git a/gdb/m68k-bsd-nat.c b/gdb/m68k-bsd-nat.c
index 96433e8cf51..3b253ee2612 100644
--- a/gdb/m68k-bsd-nat.c
+++ b/gdb/m68k-bsd-nat.c
@@ -82,8 +82,8 @@ m68kbsd_supply_fpregset (struct regcache *regcache, const void *fpregs)
in GREGS. */
static void
-m68kbsd_collect_gregset (const struct regcache *regcache,
- void *gregs, int regnum)
+m68kbsd_collect_gregset (const struct regcache *regcache, void *gregs,
+ int regnum)
{
gdb_byte *regs = (gdb_byte *) gregs;
int i;
@@ -99,8 +99,7 @@ m68kbsd_collect_gregset (const struct regcache *regcache,
in FPREGS. */
static void
-m68kbsd_collect_fpregset (struct regcache *regcache,
- void *fpregs, int regnum)
+m68kbsd_collect_fpregset (struct regcache *regcache, void *fpregs, int regnum)
{
struct gdbarch *gdbarch = regcache->arch ();
char *regs = fpregs;
@@ -112,7 +111,6 @@ m68kbsd_collect_fpregset (struct regcache *regcache,
regcache->raw_collect (i, regs + m68kbsd_fpreg_offset (gdbarch, i));
}
}
-
/* Fetch register REGNUM from the inferior. If REGNUM is -1, do this
for all registers (including the floating-point registers). */
@@ -128,7 +126,7 @@ m68k_bsd_nat_target::fetch_registers (struct regcache *regcache, int regnum)
struct reg regs;
if (ptrace (PT_GETREGS, pid, (PTRACE_TYPE_ARG3) &regs, lwp) == -1)
- perror_with_name (_("Couldn't get registers"));
+ perror_with_name (_ ("Couldn't get registers"));
m68kbsd_supply_gregset (regcache, &regs);
}
@@ -138,7 +136,7 @@ m68k_bsd_nat_target::fetch_registers (struct regcache *regcache, int regnum)
struct fpreg fpregs;
if (ptrace (PT_GETFPREGS, pid, (PTRACE_TYPE_ARG3) &fpregs, lwp) == -1)
- perror_with_name (_("Couldn't get floating point status"));
+ perror_with_name (_ ("Couldn't get floating point status"));
m68kbsd_supply_fpregset (regcache, &fpregs);
}
@@ -158,12 +156,12 @@ m68k_bsd_nat_target::store_registers (struct regcache *regcache, int regnum)
struct reg regs;
if (ptrace (PT_GETREGS, pid, (PTRACE_TYPE_ARG3) &regs, lwp) == -1)
- perror_with_name (_("Couldn't get registers"));
+ perror_with_name (_ ("Couldn't get registers"));
m68kbsd_collect_gregset (regcache, &regs, regnum);
if (ptrace (PT_SETREGS, pid, (PTRACE_TYPE_ARG3) &regs, lwp) == -1)
- perror_with_name (_("Couldn't write registers"));
+ perror_with_name (_ ("Couldn't write registers"));
}
if (regnum == -1 || m68kbsd_fpregset_supplies_p (regnum))
@@ -171,15 +169,14 @@ m68k_bsd_nat_target::store_registers (struct regcache *regcache, int regnum)
struct fpreg fpregs;
if (ptrace (PT_GETFPREGS, pid, (PTRACE_TYPE_ARG3) &fpregs, lwp) == -1)
- perror_with_name (_("Couldn't get floating point status"));
+ perror_with_name (_ ("Couldn't get floating point status"));
m68kbsd_collect_fpregset (regcache, &fpregs, regnum);
if (ptrace (PT_SETFPREGS, pid, (PTRACE_TYPE_ARG3) &fpregs, lwp) == -1)
- perror_with_name (_("Couldn't write floating point status"));
+ perror_with_name (_ ("Couldn't write floating point status"));
}
}
-
/* Support for debugging kernel virtual memory images. */
@@ -227,6 +224,7 @@ m68kbsd_supply_pcb (struct regcache *regcache, struct pcb *pcb)
}
void _initialize_m68kbsd_nat ();
+
void
_initialize_m68kbsd_nat ()
{
diff --git a/gdb/m68k-bsd-tdep.c b/gdb/m68k-bsd-tdep.c
index 8cce41592ba..17b5ffa73cf 100644
--- a/gdb/m68k-bsd-tdep.c
+++ b/gdb/m68k-bsd-tdep.c
@@ -33,16 +33,16 @@
/* Core file support. */
/* Sizeof `struct reg' in <machine/reg.h>. */
-#define M68KBSD_SIZEOF_GREGS (18 * 4)
+#define M68KBSD_SIZEOF_GREGS (18 * 4)
/* Sizeof `struct fpreg' in <machine/reg.h. */
-#define M68KBSD_SIZEOF_FPREGS (((8 * 3) + 3) * 4)
+#define M68KBSD_SIZEOF_FPREGS (((8 * 3) + 3) * 4)
int
m68kbsd_fpreg_offset (struct gdbarch *gdbarch, int regnum)
{
int fp_len = gdbarch_register_type (gdbarch, regnum)->length ();
-
+
if (regnum >= M68K_FPC_REGNUM)
return 8 * fp_len + (regnum - M68K_FPC_REGNUM) * 4;
@@ -55,8 +55,8 @@ m68kbsd_fpreg_offset (struct gdbarch *gdbarch, int regnum)
static void
m68kbsd_supply_fpregset (const struct regset *regset,
- struct regcache *regcache,
- int regnum, const void *fpregs, size_t len)
+ struct regcache *regcache, int regnum,
+ const void *fpregs, size_t len)
{
struct gdbarch *gdbarch = regcache->arch ();
const gdb_byte *regs = (const gdb_byte *) fpregs;
@@ -76,8 +76,7 @@ m68kbsd_supply_fpregset (const struct regset *regset,
REGCACHE. If REGNUM is -1, do this for all registers in REGSET. */
static void
-m68kbsd_supply_gregset (const struct regset *regset,
- struct regcache *regcache,
+m68kbsd_supply_gregset (const struct regset *regset, struct regcache *regcache,
int regnum, const void *gregs, size_t len)
{
const gdb_byte *regs = (const gdb_byte *) gregs;
@@ -101,19 +100,11 @@ m68kbsd_supply_gregset (const struct regset *regset,
/* Motorola 68000 register sets. */
-static const struct regset m68kbsd_gregset =
-{
- NULL,
- m68kbsd_supply_gregset,
- NULL,
- REGSET_VARIABLE_SIZE
-};
+static const struct regset m68kbsd_gregset
+ = { NULL, m68kbsd_supply_gregset, NULL, REGSET_VARIABLE_SIZE };
-static const struct regset m68kbsd_fpregset =
-{
- NULL,
- m68kbsd_supply_fpregset
-};
+static const struct regset m68kbsd_fpregset
+ = { NULL, m68kbsd_supply_fpregset };
/* Iterate over core file register note sections. */
@@ -128,7 +119,6 @@ m68kbsd_iterate_over_regset_sections (struct gdbarch *gdbarch,
cb (".reg2", M68KBSD_SIZEOF_FPREGS, M68KBSD_SIZEOF_FPREGS, &m68kbsd_fpregset,
NULL, cb_data);
}
-
static void
m68kbsd_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
@@ -140,19 +130,20 @@ m68kbsd_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
set_gdbarch_decr_pc_after_break (gdbarch, 2);
- set_gdbarch_iterate_over_regset_sections
- (gdbarch, m68kbsd_iterate_over_regset_sections);
+ set_gdbarch_iterate_over_regset_sections (
+ gdbarch, m68kbsd_iterate_over_regset_sections);
/* NetBSD ELF uses the SVR4 ABI. */
m68k_svr4_init_abi (info, gdbarch);
tdep->struct_return = pcc_struct_return;
/* NetBSD ELF uses SVR4-style shared libraries. */
- set_solib_svr4_fetch_link_map_offsets
- (gdbarch, svr4_ilp32_fetch_link_map_offsets);
+ set_solib_svr4_fetch_link_map_offsets (gdbarch,
+ svr4_ilp32_fetch_link_map_offsets);
}
void _initialize_m68kbsd_tdep ();
+
void
_initialize_m68kbsd_tdep ()
{
diff --git a/gdb/m68k-linux-nat.c b/gdb/m68k-linux-nat.c
index fe8c7c5d881..b89a23d4f06 100644
--- a/gdb/m68k-linux-nat.c
+++ b/gdb/m68k-linux-nat.c
@@ -57,11 +57,11 @@
#ifndef PTRACE_GET_THREAD_AREA
#define PTRACE_GET_THREAD_AREA 25
#endif
-
class m68k_linux_nat_target final : public linux_nat_target
{
public:
+
/* Add our register access methods. */
void fetch_registers (struct regcache *, int) override;
void store_registers (struct regcache *, int) override;
@@ -70,16 +70,13 @@ public:
static m68k_linux_nat_target the_m68k_linux_nat_target;
/* This table must line up with gdbarch_register_name in "m68k-tdep.c". */
-static const int regmap[] =
-{
- PT_D0, PT_D1, PT_D2, PT_D3, PT_D4, PT_D5, PT_D6, PT_D7,
- PT_A0, PT_A1, PT_A2, PT_A3, PT_A4, PT_A5, PT_A6, PT_USP,
- PT_SR, PT_PC,
- /* PT_FP0, ..., PT_FP7 */
- 21, 24, 27, 30, 33, 36, 39, 42,
- /* PT_FPCR, PT_FPSR, PT_FPIAR */
- 45, 46, 47
-};
+static const int regmap[]
+ = { PT_D0, PT_D1, PT_D2, PT_D3, PT_D4, PT_D5, PT_D6, PT_D7, PT_A0, PT_A1,
+ PT_A2, PT_A3, PT_A4, PT_A5, PT_A6, PT_USP, PT_SR, PT_PC,
+ /* PT_FP0, ..., PT_FP7 */
+ 21, 24, 27, 30, 33, 36, 39, 42,
+ /* PT_FPCR, PT_FPSR, PT_FPIAR */
+ 45, 46, 47 };
/* Which ptrace request retrieves which registers?
These apply to the corresponding SET requests as well. */
@@ -105,9 +102,7 @@ static int have_ptrace_getregs =
#else
0
#endif
-;
-
-
+ ;
/* Fetching registers directly from the U area, one at a time. */
@@ -130,9 +125,9 @@ fetch_register (struct regcache *regcache, int regno)
memcpy (&buf[i], &val, sizeof (long));
regaddr += sizeof (long);
if (errno != 0)
- error (_("Couldn't read register %s (#%d): %s."),
- gdbarch_register_name (gdbarch, regno),
- regno, safe_strerror (errno));
+ error (_ ("Couldn't read register %s (#%d): %s."),
+ gdbarch_register_name (gdbarch, regno), regno,
+ safe_strerror (errno));
}
regcache->raw_supply (regno, buf);
}
@@ -150,9 +145,7 @@ old_fetch_inferior_registers (struct regcache *regcache, int regno)
}
else
{
- for (regno = 0;
- regno < gdbarch_num_regs (regcache->arch ());
- regno++)
+ for (regno = 0; regno < gdbarch_num_regs (regcache->arch ()); regno++)
{
fetch_register (regcache, regno);
}
@@ -183,9 +176,9 @@ store_register (const struct regcache *regcache, int regno)
ptrace (PTRACE_POKEUSER, tid, regaddr, val);
regaddr += sizeof (long);
if (errno != 0)
- error (_("Couldn't write register %s (#%d): %s."),
- gdbarch_register_name (gdbarch, regno),
- regno, safe_strerror (errno));
+ error (_ ("Couldn't write register %s (#%d): %s."),
+ gdbarch_register_name (gdbarch, regno), regno,
+ safe_strerror (errno));
}
}
@@ -202,15 +195,13 @@ old_store_inferior_registers (const struct regcache *regcache, int regno)
}
else
{
- for (regno = 0;
- regno < gdbarch_num_regs (regcache->arch ());
- regno++)
+ for (regno = 0; regno < gdbarch_num_regs (regcache->arch ()); regno++)
{
store_register (regcache, regno);
}
}
}
-
+
/* Given a pointer to a general register set in /proc format
(elf_gregset_t *), unpack the register contents and supply
them as gdb's idea of the current register values. */
@@ -222,9 +213,7 @@ supply_gregset (struct regcache *regcache, const elf_gregset_t *gregsetp)
const elf_greg_t *regp = (const elf_greg_t *) gregsetp;
int regi;
- for (regi = M68K_D0_REGNUM;
- regi <= gdbarch_sp_regnum (gdbarch);
- regi++)
+ for (regi = M68K_D0_REGNUM; regi <= gdbarch_sp_regnum (gdbarch); regi++)
regcache->raw_supply (regi, &regp[regmap[regi]]);
regcache->raw_supply (gdbarch_ps_regnum (gdbarch), &regp[PT_SR]);
regcache->raw_supply (gdbarch_pc_regnum (gdbarch), &regp[PT_PC]);
@@ -234,8 +223,8 @@ supply_gregset (struct regcache *regcache, const elf_gregset_t *gregsetp)
*GREGSETPS with the value in GDB's register array. If REGNO is -1,
do this for all registers. */
void
-fill_gregset (const struct regcache *regcache,
- elf_gregset_t *gregsetp, int regno)
+fill_gregset (const struct regcache *regcache, elf_gregset_t *gregsetp,
+ int regno)
{
elf_greg_t *regp = (elf_greg_t *) gregsetp;
int i;
@@ -265,7 +254,7 @@ fetch_regs (struct regcache *regcache, int tid)
return;
}
- perror_with_name (_("Couldn't get registers"));
+ perror_with_name (_ ("Couldn't get registers"));
}
supply_gregset (regcache, (const elf_gregset_t *) &regs);
@@ -280,31 +269,32 @@ store_regs (const struct regcache *regcache, int tid, int regno)
elf_gregset_t regs;
if (ptrace (PTRACE_GETREGS, tid, 0, (int) &regs) < 0)
- perror_with_name (_("Couldn't get registers"));
+ perror_with_name (_ ("Couldn't get registers"));
fill_gregset (regcache, &regs, regno);
if (ptrace (PTRACE_SETREGS, tid, 0, (int) &regs) < 0)
- perror_with_name (_("Couldn't write registers"));
+ perror_with_name (_ ("Couldn't write registers"));
}
#else
-static void fetch_regs (struct regcache *regcache, int tid)
+static void
+fetch_regs (struct regcache *regcache, int tid)
{
}
-static void store_regs (const struct regcache *regcache, int tid, int regno)
+static void
+store_regs (const struct regcache *regcache, int tid, int regno)
{
}
#endif
-
/* Transfering floating-point registers between GDB, inferiors and cores. */
/* What is the address of fpN within the floating-point register set F? */
-#define FPREG_ADDR(f, n) (&(f)->fpregs[(n) * 3])
+#define FPREG_ADDR(f, n) (&(f)->fpregs[(n) *3])
/* Fill GDB's register array with the floating-point register values in
*FPREGSETP. */
@@ -317,8 +307,9 @@ supply_fpregset (struct regcache *regcache, const elf_fpregset_t *fpregsetp)
for (regi = gdbarch_fp0_regnum (gdbarch);
regi < gdbarch_fp0_regnum (gdbarch) + 8; regi++)
- regcache->raw_supply
- (regi, FPREG_ADDR (fpregsetp, regi - gdbarch_fp0_regnum (gdbarch)));
+ regcache->raw_supply (regi,
+ FPREG_ADDR (fpregsetp,
+ regi - gdbarch_fp0_regnum (gdbarch)));
regcache->raw_supply (M68K_FPC_REGNUM, &fpregsetp->fpcntl[0]);
regcache->raw_supply (M68K_FPS_REGNUM, &fpregsetp->fpcntl[1]);
regcache->raw_supply (M68K_FPI_REGNUM, &fpregsetp->fpcntl[2]);
@@ -329,18 +320,18 @@ supply_fpregset (struct regcache *regcache, const elf_fpregset_t *fpregsetp)
do this for all registers. */
void
-fill_fpregset (const struct regcache *regcache,
- elf_fpregset_t *fpregsetp, int regno)
+fill_fpregset (const struct regcache *regcache, elf_fpregset_t *fpregsetp,
+ int regno)
{
struct gdbarch *gdbarch = regcache->arch ();
int i;
/* Fill in the floating-point registers. */
- for (i = gdbarch_fp0_regnum (gdbarch);
- i < gdbarch_fp0_regnum (gdbarch) + 8; i++)
+ for (i = gdbarch_fp0_regnum (gdbarch); i < gdbarch_fp0_regnum (gdbarch) + 8;
+ i++)
if (regno == -1 || regno == i)
- regcache->raw_collect
- (i, FPREG_ADDR (fpregsetp, i - gdbarch_fp0_regnum (gdbarch)));
+ regcache->raw_collect (i, FPREG_ADDR (fpregsetp,
+ i - gdbarch_fp0_regnum (gdbarch)));
/* Fill in the floating-point control registers. */
for (i = M68K_FPC_REGNUM; i <= M68K_FPI_REGNUM; i++)
@@ -359,7 +350,7 @@ fetch_fpregs (struct regcache *regcache, int tid)
elf_fpregset_t fpregs;
if (ptrace (PTRACE_GETFPREGS, tid, 0, (int) &fpregs) < 0)
- perror_with_name (_("Couldn't get floating point status"));
+ perror_with_name (_ ("Couldn't get floating point status"));
supply_fpregset (regcache, (const elf_fpregset_t *) &fpregs);
}
@@ -373,26 +364,28 @@ store_fpregs (const struct regcache *regcache, int tid, int regno)
elf_fpregset_t fpregs;
if (ptrace (PTRACE_GETFPREGS, tid, 0, (int) &fpregs) < 0)
- perror_with_name (_("Couldn't get floating point status"));
+ perror_with_name (_ ("Couldn't get floating point status"));
fill_fpregset (regcache, &fpregs, regno);
if (ptrace (PTRACE_SETFPREGS, tid, 0, (int) &fpregs) < 0)
- perror_with_name (_("Couldn't write floating point status"));
+ perror_with_name (_ ("Couldn't write floating point status"));
}
#else
-static void fetch_fpregs (struct regcache *regcache, int tid)
+static void
+fetch_fpregs (struct regcache *regcache, int tid)
{
}
-static void store_fpregs (const struct regcache *regcache, int tid, int regno)
+static void
+store_fpregs (const struct regcache *regcache, int tid, int regno)
{
}
#endif
-
+
/* Transferring arbitrary registers between GDB and inferior. */
/* Fetch register REGNO from the child process. If REGNO is -1, do
@@ -406,7 +399,7 @@ m68k_linux_nat_target::fetch_registers (struct regcache *regcache, int regno)
/* Use the old method of peeking around in `struct user' if the
GETREGS request isn't available. */
- if (! have_ptrace_getregs)
+ if (!have_ptrace_getregs)
{
old_fetch_inferior_registers (regcache, regno);
return;
@@ -423,7 +416,7 @@ m68k_linux_nat_target::fetch_registers (struct regcache *regcache, int regno)
fetch_regs (regcache, tid);
/* The call above might reset `have_ptrace_getregs'. */
- if (! have_ptrace_getregs)
+ if (!have_ptrace_getregs)
{
old_fetch_inferior_registers (regcache, -1);
return;
@@ -445,7 +438,7 @@ m68k_linux_nat_target::fetch_registers (struct regcache *regcache, int regno)
return;
}
- internal_error (_("Got request for bad register number %d."), regno);
+ internal_error (_ ("Got request for bad register number %d."), regno);
}
/* Store register REGNO back into the child process. If REGNO is -1,
@@ -458,7 +451,7 @@ m68k_linux_nat_target::store_registers (struct regcache *regcache, int regno)
/* Use the old method of poking around in `struct user' if the
SETREGS request isn't available. */
- if (! have_ptrace_getregs)
+ if (!have_ptrace_getregs)
{
old_store_inferior_registers (regcache, regno);
return;
@@ -488,15 +481,14 @@ m68k_linux_nat_target::store_registers (struct regcache *regcache, int regno)
return;
}
- internal_error (_("Got request to store bad register number %d."), regno);
+ internal_error (_ ("Got request to store bad register number %d."), regno);
}
-
/* Fetch the thread-local storage pointer for libthread_db. */
ps_err_e
-ps_get_thread_area (struct ps_prochandle *ph,
- lwpid_t lwpid, int idx, void **base)
+ps_get_thread_area (struct ps_prochandle *ph, lwpid_t lwpid, int idx,
+ void **base)
{
if (ptrace (PTRACE_GET_THREAD_AREA, lwpid, NULL, base) < 0)
return PS_ERR;
@@ -510,6 +502,7 @@ ps_get_thread_area (struct ps_prochandle *ph,
}
void _initialize_m68k_linux_nat ();
+
void
_initialize_m68k_linux_nat ()
{
diff --git a/gdb/m68k-linux-tdep.c b/gdb/m68k-linux-tdep.c
index ac53a12ffa2..7db506561cf 100644
--- a/gdb/m68k-linux-tdep.c
+++ b/gdb/m68k-linux-tdep.c
@@ -36,7 +36,7 @@
#include "elf/common.h"
#include "linux-tdep.h"
#include "regset.h"
-
+
/* Offsets (in target ints) into jmp_buf. */
#define M68K_LINUX_JB_ELEMENT_SIZE 4
@@ -44,16 +44,15 @@
/* Check whether insn1 and insn2 are parts of a signal trampoline. */
-#define IS_SIGTRAMP(insn1, insn2) \
- (/* addaw #20,sp; moveq #119,d0; trap #0 */ \
- (insn1 == 0xdefc0014 && insn2 == 0x70774e40) \
- /* moveq #119,d0; trap #0 */ \
+#define IS_SIGTRAMP(insn1, insn2) \
+ (/* addaw #20,sp; moveq #119,d0; trap #0 */ \
+ (insn1 == 0xdefc0014 && insn2 == 0x70774e40) /* moveq #119,d0; trap #0 */ \
|| insn1 == 0x70774e40)
-#define IS_RT_SIGTRAMP(insn1, insn2) \
- (/* movel #173,d0; trap #0 */ \
- (insn1 == 0x203c0000 && insn2 == 0x00ad4e40) \
- /* moveq #82,d0; notb d0; trap #0 */ \
+#define IS_RT_SIGTRAMP(insn1, insn2) \
+ (/* movel #173,d0; trap #0 */ \
+ (insn1 == 0x203c0000 \
+ && insn2 == 0x00ad4e40) /* moveq #82,d0; notb d0; trap #0 */ \
|| (insn1 == 0x70524600 && (insn2 >> 16) == 0x4e40))
/* Return non-zero if THIS_FRAME corresponds to a signal trampoline. For
@@ -69,7 +68,7 @@ m68k_linux_pc_in_sigtramp (frame_info_ptr this_frame)
unsigned long insn0, insn1, insn2;
CORE_ADDR pc = get_frame_pc (this_frame);
- if (!safe_frame_unwind_memory (this_frame, pc - 4, {buf, sizeof (buf)}))
+ if (!safe_frame_unwind_memory (this_frame, pc - 4, { buf, sizeof (buf) }))
return 0;
insn1 = extract_unsigned_integer (buf + 4, 4, byte_order);
insn2 = extract_unsigned_integer (buf + 8, 4, byte_order);
@@ -95,107 +94,103 @@ m68k_linux_pc_in_sigtramp (frame_info_ptr this_frame)
}
/* From <asm/sigcontext.h>. */
-static int m68k_linux_sigcontext_reg_offset[M68K_NUM_REGS] =
-{
- 2 * 4, /* %d0 */
- 3 * 4, /* %d1 */
- -1, /* %d2 */
- -1, /* %d3 */
- -1, /* %d4 */
- -1, /* %d5 */
- -1, /* %d6 */
- -1, /* %d7 */
- 4 * 4, /* %a0 */
- 5 * 4, /* %a1 */
- -1, /* %a2 */
- -1, /* %a3 */
- -1, /* %a4 */
- -1, /* %a5 */
- -1, /* %fp */
- 1 * 4, /* %sp */
- 6 * 4, /* %sr */
- 6 * 4 + 2, /* %pc */
- 8 * 4, /* %fp0 */
- 11 * 4, /* %fp1 */
- -1, /* %fp2 */
- -1, /* %fp3 */
- -1, /* %fp4 */
- -1, /* %fp5 */
- -1, /* %fp6 */
- -1, /* %fp7 */
- 14 * 4, /* %fpcr */
- 15 * 4, /* %fpsr */
- 16 * 4 /* %fpiaddr */
+static int m68k_linux_sigcontext_reg_offset[M68K_NUM_REGS] = {
+ 2 * 4, /* %d0 */
+ 3 * 4, /* %d1 */
+ -1, /* %d2 */
+ -1, /* %d3 */
+ -1, /* %d4 */
+ -1, /* %d5 */
+ -1, /* %d6 */
+ -1, /* %d7 */
+ 4 * 4, /* %a0 */
+ 5 * 4, /* %a1 */
+ -1, /* %a2 */
+ -1, /* %a3 */
+ -1, /* %a4 */
+ -1, /* %a5 */
+ -1, /* %fp */
+ 1 * 4, /* %sp */
+ 6 * 4, /* %sr */
+ 6 * 4 + 2, /* %pc */
+ 8 * 4, /* %fp0 */
+ 11 * 4, /* %fp1 */
+ -1, /* %fp2 */
+ -1, /* %fp3 */
+ -1, /* %fp4 */
+ -1, /* %fp5 */
+ -1, /* %fp6 */
+ -1, /* %fp7 */
+ 14 * 4, /* %fpcr */
+ 15 * 4, /* %fpsr */
+ 16 * 4 /* %fpiaddr */
};
-static int m68k_uclinux_sigcontext_reg_offset[M68K_NUM_REGS] =
-{
- 2 * 4, /* %d0 */
- 3 * 4, /* %d1 */
- -1, /* %d2 */
- -1, /* %d3 */
- -1, /* %d4 */
- -1, /* %d5 */
- -1, /* %d6 */
- -1, /* %d7 */
- 4 * 4, /* %a0 */
- 5 * 4, /* %a1 */
- -1, /* %a2 */
- -1, /* %a3 */
- -1, /* %a4 */
- 6 * 4, /* %a5 */
- -1, /* %fp */
- 1 * 4, /* %sp */
- 7 * 4, /* %sr */
- 7 * 4 + 2, /* %pc */
- -1, /* %fp0 */
- -1, /* %fp1 */
- -1, /* %fp2 */
- -1, /* %fp3 */
- -1, /* %fp4 */
- -1, /* %fp5 */
- -1, /* %fp6 */
- -1, /* %fp7 */
- -1, /* %fpcr */
- -1, /* %fpsr */
- -1 /* %fpiaddr */
+static int m68k_uclinux_sigcontext_reg_offset[M68K_NUM_REGS] = {
+ 2 * 4, /* %d0 */
+ 3 * 4, /* %d1 */
+ -1, /* %d2 */
+ -1, /* %d3 */
+ -1, /* %d4 */
+ -1, /* %d5 */
+ -1, /* %d6 */
+ -1, /* %d7 */
+ 4 * 4, /* %a0 */
+ 5 * 4, /* %a1 */
+ -1, /* %a2 */
+ -1, /* %a3 */
+ -1, /* %a4 */
+ 6 * 4, /* %a5 */
+ -1, /* %fp */
+ 1 * 4, /* %sp */
+ 7 * 4, /* %sr */
+ 7 * 4 + 2, /* %pc */
+ -1, /* %fp0 */
+ -1, /* %fp1 */
+ -1, /* %fp2 */
+ -1, /* %fp3 */
+ -1, /* %fp4 */
+ -1, /* %fp5 */
+ -1, /* %fp6 */
+ -1, /* %fp7 */
+ -1, /* %fpcr */
+ -1, /* %fpsr */
+ -1 /* %fpiaddr */
};
/* From <asm/ucontext.h>. */
-static int m68k_linux_ucontext_reg_offset[M68K_NUM_REGS] =
-{
- 6 * 4, /* %d0 */
- 7 * 4, /* %d1 */
- 8 * 4, /* %d2 */
- 9 * 4, /* %d3 */
- 10 * 4, /* %d4 */
- 11 * 4, /* %d5 */
- 12 * 4, /* %d6 */
- 13 * 4, /* %d7 */
- 14 * 4, /* %a0 */
- 15 * 4, /* %a1 */
- 16 * 4, /* %a2 */
- 17 * 4, /* %a3 */
- 18 * 4, /* %a4 */
- 19 * 4, /* %a5 */
- 20 * 4, /* %fp */
- 21 * 4, /* %sp */
- 23 * 4, /* %sr */
- 22 * 4, /* %pc */
- 27 * 4, /* %fp0 */
- 30 * 4, /* %fp1 */
- 33 * 4, /* %fp2 */
- 36 * 4, /* %fp3 */
- 39 * 4, /* %fp4 */
- 42 * 4, /* %fp5 */
- 45 * 4, /* %fp6 */
- 48 * 4, /* %fp7 */
- 24 * 4, /* %fpcr */
- 25 * 4, /* %fpsr */
- 26 * 4 /* %fpiaddr */
+static int m68k_linux_ucontext_reg_offset[M68K_NUM_REGS] = {
+ 6 * 4, /* %d0 */
+ 7 * 4, /* %d1 */
+ 8 * 4, /* %d2 */
+ 9 * 4, /* %d3 */
+ 10 * 4, /* %d4 */
+ 11 * 4, /* %d5 */
+ 12 * 4, /* %d6 */
+ 13 * 4, /* %d7 */
+ 14 * 4, /* %a0 */
+ 15 * 4, /* %a1 */
+ 16 * 4, /* %a2 */
+ 17 * 4, /* %a3 */
+ 18 * 4, /* %a4 */
+ 19 * 4, /* %a5 */
+ 20 * 4, /* %fp */
+ 21 * 4, /* %sp */
+ 23 * 4, /* %sr */
+ 22 * 4, /* %pc */
+ 27 * 4, /* %fp0 */
+ 30 * 4, /* %fp1 */
+ 33 * 4, /* %fp2 */
+ 36 * 4, /* %fp3 */
+ 39 * 4, /* %fp4 */
+ 42 * 4, /* %fp5 */
+ 45 * 4, /* %fp6 */
+ 48 * 4, /* %fp7 */
+ 24 * 4, /* %fpcr */
+ 25 * 4, /* %fpsr */
+ 26 * 4 /* %fpiaddr */
};
-
/* Get info about saved registers in sigtramp. */
struct m68k_linux_sigtramp_info
@@ -239,17 +234,16 @@ m68k_linux_get_sigtramp_info (frame_info_ptr this_frame)
if (m68k_linux_pc_in_sigtramp (this_frame) == 2)
info.sc_reg_offset = m68k_linux_ucontext_reg_offset;
else
- info.sc_reg_offset = (target_is_uclinux
- ? m68k_uclinux_sigcontext_reg_offset
- : m68k_linux_sigcontext_reg_offset);
+ info.sc_reg_offset
+ = (target_is_uclinux ? m68k_uclinux_sigcontext_reg_offset
+ : m68k_linux_sigcontext_reg_offset);
return info;
}
/* Signal trampolines. */
static struct trad_frame_cache *
-m68k_linux_sigtramp_frame_cache (frame_info_ptr this_frame,
- void **this_cache)
+m68k_linux_sigtramp_frame_cache (frame_info_ptr this_frame, void **this_cache)
{
struct frame_id this_id;
struct trad_frame_cache *cache;
@@ -270,8 +264,9 @@ m68k_linux_sigtramp_frame_cache (frame_info_ptr this_frame,
trampoline. */
get_frame_register (this_frame, M68K_SP_REGNUM, buf);
/* See the end of m68k_push_dummy_call. */
- this_id = frame_id_build (extract_unsigned_integer (buf, 4, byte_order)
- - 4 + 8, get_frame_pc (this_frame));
+ this_id
+ = frame_id_build (extract_unsigned_integer (buf, 4, byte_order) - 4 + 8,
+ get_frame_pc (this_frame));
trad_frame_set_id (cache, this_id);
info = m68k_linux_get_sigtramp_info (this_frame);
@@ -287,22 +282,20 @@ m68k_linux_sigtramp_frame_cache (frame_info_ptr this_frame,
static void
m68k_linux_sigtramp_frame_this_id (frame_info_ptr this_frame,
- void **this_cache,
- struct frame_id *this_id)
+ void **this_cache, struct frame_id *this_id)
{
- struct trad_frame_cache *cache =
- m68k_linux_sigtramp_frame_cache (this_frame, this_cache);
+ struct trad_frame_cache *cache
+ = m68k_linux_sigtramp_frame_cache (this_frame, this_cache);
trad_frame_get_id (cache, this_id);
}
static struct value *
m68k_linux_sigtramp_frame_prev_register (frame_info_ptr this_frame,
- void **this_cache,
- int regnum)
+ void **this_cache, int regnum)
{
/* Make sure we've initialized the cache. */
- struct trad_frame_cache *cache =
- m68k_linux_sigtramp_frame_cache (this_frame, this_cache);
+ struct trad_frame_cache *cache
+ = m68k_linux_sigtramp_frame_cache (this_frame, this_cache);
return trad_frame_get_register (cache, this_frame, regnum);
}
@@ -314,58 +307,46 @@ m68k_linux_sigtramp_frame_sniffer (const struct frame_unwind *self,
return m68k_linux_pc_in_sigtramp (this_frame);
}
-static const struct frame_unwind m68k_linux_sigtramp_frame_unwind =
-{
- "m68k linux sigtramp",
- SIGTRAMP_FRAME,
- default_frame_unwind_stop_reason,
- m68k_linux_sigtramp_frame_this_id,
- m68k_linux_sigtramp_frame_prev_register,
- NULL,
- m68k_linux_sigtramp_frame_sniffer
-};
+static const struct frame_unwind m68k_linux_sigtramp_frame_unwind
+ = { "m68k linux sigtramp",
+ SIGTRAMP_FRAME,
+ default_frame_unwind_stop_reason,
+ m68k_linux_sigtramp_frame_this_id,
+ m68k_linux_sigtramp_frame_prev_register,
+ NULL,
+ m68k_linux_sigtramp_frame_sniffer };
/* Register maps for supply/collect regset functions. */
-static const struct regcache_map_entry m68k_linux_gregmap[] =
- {
- { 7, M68K_D1_REGNUM, 4 }, /* d1 ... d7 */
- { 7, M68K_A0_REGNUM, 4 }, /* a0 ... a6 */
- { 1, M68K_D0_REGNUM, 4 },
- { 1, M68K_SP_REGNUM, 4 },
- { 1, REGCACHE_MAP_SKIP, 4 }, /* orig_d0 (skip) */
- { 1, M68K_PS_REGNUM, 4 },
- { 1, M68K_PC_REGNUM, 4 },
- /* Ignore 16-bit fields 'fmtvec' and '__fill'. */
- { 0 }
- };
+static const struct regcache_map_entry m68k_linux_gregmap[]
+ = { { 7, M68K_D1_REGNUM, 4 }, /* d1 ... d7 */
+ { 7, M68K_A0_REGNUM, 4 }, /* a0 ... a6 */
+ { 1, M68K_D0_REGNUM, 4 },
+ { 1, M68K_SP_REGNUM, 4 },
+ { 1, REGCACHE_MAP_SKIP, 4 }, /* orig_d0 (skip) */
+ { 1, M68K_PS_REGNUM, 4 },
+ { 1, M68K_PC_REGNUM, 4 },
+ /* Ignore 16-bit fields 'fmtvec' and '__fill'. */
+ { 0 } };
#define M68K_LINUX_GREGS_SIZE (20 * 4)
-static const struct regcache_map_entry m68k_linux_fpregmap[] =
- {
- { 8, M68K_FP0_REGNUM, 12 }, /* fp0 ... fp7 */
- { 1, M68K_FPC_REGNUM, 4 },
- { 1, M68K_FPS_REGNUM, 4 },
- { 1, M68K_FPI_REGNUM, 4 },
- { 0 }
- };
+static const struct regcache_map_entry m68k_linux_fpregmap[]
+ = { { 8, M68K_FP0_REGNUM, 12 }, /* fp0 ... fp7 */
+ { 1, M68K_FPC_REGNUM, 4 },
+ { 1, M68K_FPS_REGNUM, 4 },
+ { 1, M68K_FPI_REGNUM, 4 },
+ { 0 } };
#define M68K_LINUX_FPREGS_SIZE (27 * 4)
/* Register sets. */
-static const struct regset m68k_linux_gregset =
- {
- m68k_linux_gregmap,
- regcache_supply_regset, regcache_collect_regset
- };
+static const struct regset m68k_linux_gregset
+ = { m68k_linux_gregmap, regcache_supply_regset, regcache_collect_regset };
-static const struct regset m68k_linux_fpregset =
- {
- m68k_linux_fpregmap,
- regcache_supply_regset, regcache_collect_regset
- };
+static const struct regset m68k_linux_fpregset
+ = { m68k_linux_fpregmap, regcache_supply_regset, regcache_collect_regset };
/* Iterate over core file register note sections. */
@@ -375,8 +356,8 @@ m68k_linux_iterate_over_regset_sections (struct gdbarch *gdbarch,
void *cb_data,
const struct regcache *regcache)
{
- cb (".reg", M68K_LINUX_GREGS_SIZE, M68K_LINUX_GREGS_SIZE, &m68k_linux_gregset,
- NULL, cb_data);
+ cb (".reg", M68K_LINUX_GREGS_SIZE, M68K_LINUX_GREGS_SIZE,
+ &m68k_linux_gregset, NULL, cb_data);
cb (".reg2", M68K_LINUX_FPREGS_SIZE, M68K_LINUX_FPREGS_SIZE,
&m68k_linux_fpregset, NULL, cb_data);
}
@@ -416,8 +397,8 @@ m68k_linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
set_gdbarch_skip_trampoline_code (gdbarch, find_solib_trampoline_target);
/* Core file support. */
- set_gdbarch_iterate_over_regset_sections
- (gdbarch, m68k_linux_iterate_over_regset_sections);
+ set_gdbarch_iterate_over_regset_sections (
+ gdbarch, m68k_linux_iterate_over_regset_sections);
/* Enable TLS support. */
set_gdbarch_fetch_tls_load_module_address (gdbarch,
@@ -425,6 +406,7 @@ m68k_linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
}
void _initialize_m68k_linux_tdep ();
+
void
_initialize_m68k_linux_tdep ()
{
diff --git a/gdb/m68k-tdep.c b/gdb/m68k-tdep.c
index ae020c89d19..45be597ec48 100644
--- a/gdb/m68k-tdep.c
+++ b/gdb/m68k-tdep.c
@@ -38,33 +38,31 @@
#include "elf/m68k.h"
#include "m68k-tdep.h"
-
-
-#define P_LINKL_FP 0x480e
-#define P_LINKW_FP 0x4e56
-#define P_PEA_FP 0x4856
-#define P_MOVEAL_SP_FP 0x2c4f
-#define P_ADDAW_SP 0xdefc
-#define P_ADDAL_SP 0xdffc
-#define P_SUBQW_SP 0x514f
-#define P_SUBQL_SP 0x518f
-#define P_LEA_SP_SP 0x4fef
-#define P_LEA_PC_A5 0x4bfb0170
-#define P_FMOVEMX_SP 0xf227
-#define P_MOVEL_SP 0x2f00
-#define P_MOVEML_SP 0x48e7
+
+#define P_LINKL_FP 0x480e
+#define P_LINKW_FP 0x4e56
+#define P_PEA_FP 0x4856
+#define P_MOVEAL_SP_FP 0x2c4f
+#define P_ADDAW_SP 0xdefc
+#define P_ADDAL_SP 0xdffc
+#define P_SUBQW_SP 0x514f
+#define P_SUBQL_SP 0x518f
+#define P_LEA_SP_SP 0x4fef
+#define P_LEA_PC_A5 0x4bfb0170
+#define P_FMOVEMX_SP 0xf227
+#define P_MOVEL_SP 0x2f00
+#define P_MOVEML_SP 0x48e7
/* Offset from SP to first arg on stack at first instruction of a function. */
#define SP_ARG0 (1 * 4)
-#if !defined (BPT_VECTOR)
+#if !defined(BPT_VECTOR)
#define BPT_VECTOR 0xf
#endif
-constexpr gdb_byte m68k_break_insn[] = {0x4e, (0x40 | BPT_VECTOR)};
+constexpr gdb_byte m68k_break_insn[] = { 0x4e, (0x40 | BPT_VECTOR) };
typedef BP_MANIPULATION (m68k_break_insn) m68k_breakpoint;
-
/* Construct types for ISA-specific registers. */
static struct type *
@@ -157,13 +155,11 @@ m68k_register_type (struct gdbarch *gdbarch, int regnum)
return builtin_type (gdbarch)->builtin_int32;
}
-static const char * const m68k_register_names[] = {
- "d0", "d1", "d2", "d3", "d4", "d5", "d6", "d7",
- "a0", "a1", "a2", "a3", "a4", "a5", "fp", "sp",
- "ps", "pc",
- "fp0", "fp1", "fp2", "fp3", "fp4", "fp5", "fp6", "fp7",
- "fpcontrol", "fpstatus", "fpiaddr"
- };
+static const char *const m68k_register_names[]
+ = { "d0", "d1", "d2", "d3", "d4", "d5", "d6", "d7",
+ "a0", "a1", "a2", "a3", "a4", "a5", "fp", "sp",
+ "ps", "pc", "fp0", "fp1", "fp2", "fp3", "fp4", "fp5",
+ "fp6", "fp7", "fpcontrol", "fpstatus", "fpiaddr" };
/* Function: m68k_register_name
Returns the name of the standard m68k register regnum. */
@@ -180,19 +176,20 @@ m68k_register_name (struct gdbarch *gdbarch, int regnum)
else
return m68k_register_names[regnum];
}
-
+
/* Return nonzero if a value of type TYPE stored in register REGNUM
needs any special handling. */
static int
-m68k_convert_register_p (struct gdbarch *gdbarch,
- int regnum, struct type *type)
+m68k_convert_register_p (struct gdbarch *gdbarch, int regnum,
+ struct type *type)
{
m68k_gdbarch_tdep *tdep = gdbarch_tdep<m68k_gdbarch_tdep> (gdbarch);
if (!tdep->fpregs_present)
return 0;
- return (regnum >= M68K_FP0_REGNUM && regnum <= M68K_FP0_REGNUM + 7
+ return (regnum >= M68K_FP0_REGNUM
+ && regnum <= M68K_FP0_REGNUM + 7
/* We only support floating-point values. */
&& type->code () == TYPE_CODE_FLT
&& type != register_type (gdbarch, M68K_FP0_REGNUM));
@@ -202,9 +199,8 @@ m68k_convert_register_p (struct gdbarch *gdbarch,
return its contents in TO. */
static int
-m68k_register_to_value (frame_info_ptr frame, int regnum,
- struct type *type, gdb_byte *to,
- int *optimizedp, int *unavailablep)
+m68k_register_to_value (frame_info_ptr frame, int regnum, struct type *type,
+ gdb_byte *to, int *optimizedp, int *unavailablep)
{
struct gdbarch *gdbarch = get_frame_arch (frame);
gdb_byte from[M68K_MAX_REGISTER_SIZE];
@@ -213,11 +209,10 @@ m68k_register_to_value (frame_info_ptr frame, int regnum,
gdb_assert (type->code () == TYPE_CODE_FLT);
/* Convert to TYPE. */
- if (!get_frame_register_bytes (frame, regnum, 0,
- gdb::make_array_view (from,
- register_size (gdbarch,
- regnum)),
- optimizedp, unavailablep))
+ if (!get_frame_register_bytes (
+ frame, regnum, 0,
+ gdb::make_array_view (from, register_size (gdbarch, regnum)),
+ optimizedp, unavailablep))
return 0;
target_float_convert (from, fpreg_type, to, type);
@@ -229,18 +224,18 @@ m68k_register_to_value (frame_info_ptr frame, int regnum,
REGNUM in frame FRAME. */
static void
-m68k_value_to_register (frame_info_ptr frame, int regnum,
- struct type *type, const gdb_byte *from)
+m68k_value_to_register (frame_info_ptr frame, int regnum, struct type *type,
+ const gdb_byte *from)
{
gdb_byte to[M68K_MAX_REGISTER_SIZE];
- struct type *fpreg_type = register_type (get_frame_arch (frame),
- M68K_FP0_REGNUM);
+ struct type *fpreg_type
+ = register_type (get_frame_arch (frame), M68K_FP0_REGNUM);
/* We only support floating-point values. */
if (type->code () != TYPE_CODE_FLT)
{
- warning (_("Cannot convert non-floating-point type "
- "to floating-point register value."));
+ warning (_ ("Cannot convert non-floating-point type "
+ "to floating-point register value."));
return;
}
@@ -249,7 +244,6 @@ m68k_value_to_register (frame_info_ptr frame, int regnum,
put_frame_register (frame, regnum, to);
}
-
/* There is a fair number of calling conventions that are in somewhat
wide use. The 68000/08/10 don't support an FPU, not even as a
coprocessor. All function return values are stored in %d0/%d1.
@@ -312,7 +306,7 @@ m68k_extract_return_value (struct type *type, struct regcache *regcache,
regcache->raw_read (M68K_D1_REGNUM, valbuf + (len - 4));
}
else
- internal_error (_("Cannot extract return value of %d bytes long."), len);
+ internal_error (_ ("Cannot extract return value of %d bytes long."), len);
}
static void
@@ -358,7 +352,7 @@ m68k_store_return_value (struct type *type, struct regcache *regcache,
regcache->raw_write (M68K_D1_REGNUM, valbuf + (len - 4));
}
else
- internal_error (_("Cannot store return value of %d bytes long."), len);
+ internal_error (_ ("Cannot store return value of %d bytes long."), len);
}
static void
@@ -480,8 +474,7 @@ m68k_svr4_return_value (struct gdbarch *gdbarch, struct value *function,
|| code == TYPE_CODE_COMPLEX || code == TYPE_CODE_ARRAY)
&& !m68k_reg_struct_return_p (gdbarch, type))
/* GCC may return a `long double' in memory too. */
- || (!tdep->float_return
- && code == TYPE_CODE_FLT
+ || (!tdep->float_return && code == TYPE_CODE_FLT
&& type->length () == 12))
{
/* The System V ABI says that:
@@ -517,7 +510,6 @@ m68k_svr4_return_value (struct gdbarch *gdbarch, struct value *function,
return RETURN_VALUE_REGISTER_CONVENTION;
}
-
/* Always align the frame to a 4-byte boundary. This is required on
coldfire and harmless on the rest. */
@@ -609,7 +601,6 @@ m68k_dwarf_reg_to_regnum (struct gdbarch *gdbarch, int num)
return -1;
}
-
struct m68k_frame_cache
{
/* Base address. */
@@ -658,9 +649,8 @@ m68k_alloc_frame_cache (void)
Otherwise, return PC. */
static CORE_ADDR
-m68k_analyze_frame_setup (struct gdbarch *gdbarch,
- CORE_ADDR pc, CORE_ADDR current_pc,
- struct m68k_frame_cache *cache)
+m68k_analyze_frame_setup (struct gdbarch *gdbarch, CORE_ADDR pc,
+ CORE_ADDR current_pc, struct m68k_frame_cache *cache)
{
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
int op;
@@ -773,8 +763,7 @@ m68k_analyze_register_saves (struct gdbarch *gdbarch, CORE_ADDR pc,
while (pc < current_pc)
{
op = read_memory_unsigned_integer (pc, 2, byte_order);
- if (op == P_FMOVEMX_SP
- && tdep->fpregs_present)
+ if (op == P_FMOVEMX_SP && tdep->fpregs_present)
{
/* fmovem.x REGS,-(%sp) */
op = read_memory_unsigned_integer (pc + 2, 2, byte_order);
@@ -824,7 +813,6 @@ m68k_analyze_register_saves (struct gdbarch *gdbarch, CORE_ADDR pc,
return pc;
}
-
/* Do a full analysis of the prologue at PC and update CACHE
accordingly. Bail out early if CURRENT_PC is reached. Return the
address where the analysis stopped.
@@ -903,7 +891,7 @@ m68k_unwind_pc (struct gdbarch *gdbarch, frame_info_ptr next_frame)
frame_unwind_register (next_frame, gdbarch_pc_regnum (gdbarch), buf);
return extract_typed_address (buf, builtin_type (gdbarch)->builtin_func_ptr);
}
-
+
/* Normal frames. */
static struct m68k_frame_cache *
@@ -954,8 +942,8 @@ m68k_frame_cache (frame_info_ptr this_frame, void **this_cache)
functions this might work too. */
get_frame_register (this_frame, M68K_SP_REGNUM, buf);
- cache->base = extract_unsigned_integer (buf, 4, byte_order)
- + cache->sp_offset;
+ cache->base
+ = extract_unsigned_integer (buf, 4, byte_order) + cache->sp_offset;
}
/* Now that we have the base address for the stack frame we can
@@ -1003,17 +991,15 @@ m68k_frame_prev_register (frame_info_ptr this_frame, void **this_cache,
return frame_unwind_got_register (this_frame, regnum, regnum);
}
-static const struct frame_unwind m68k_frame_unwind =
-{
- "m68k prologue",
- NORMAL_FRAME,
- default_frame_unwind_stop_reason,
- m68k_frame_this_id,
- m68k_frame_prev_register,
- NULL,
- default_frame_sniffer
-};
-
+static const struct frame_unwind m68k_frame_unwind
+ = { "m68k prologue",
+ NORMAL_FRAME,
+ default_frame_unwind_stop_reason,
+ m68k_frame_this_id,
+ m68k_frame_prev_register,
+ NULL,
+ default_frame_sniffer };
+
static CORE_ADDR
m68k_frame_base_address (frame_info_ptr this_frame, void **this_cache)
{
@@ -1022,13 +1008,9 @@ m68k_frame_base_address (frame_info_ptr this_frame, void **this_cache)
return cache->base;
}
-static const struct frame_base m68k_frame_base =
-{
- &m68k_frame_unwind,
- m68k_frame_base_address,
- m68k_frame_base_address,
- m68k_frame_base_address
-};
+static const struct frame_base m68k_frame_base
+ = { &m68k_frame_unwind, m68k_frame_base_address, m68k_frame_base_address,
+ m68k_frame_base_address };
static struct frame_id
m68k_dummy_id (struct gdbarch *gdbarch, frame_info_ptr this_frame)
@@ -1040,7 +1022,6 @@ m68k_dummy_id (struct gdbarch *gdbarch, frame_info_ptr this_frame)
/* See the end of m68k_push_dummy_call. */
return frame_id_build (fp + 8, get_frame_pc (this_frame));
}
-
/* Figure out where the longjmp will land. Slurp the args out of the stack.
We expect the first arg to be a pointer to the jmp_buf structure from which
@@ -1058,30 +1039,32 @@ m68k_get_longjmp_target (frame_info_ptr frame, CORE_ADDR *pc)
if (tdep->jb_pc < 0)
{
- internal_error (_("m68k_get_longjmp_target: not implemented"));
+ internal_error (_ ("m68k_get_longjmp_target: not implemented"));
return 0;
}
buf = (gdb_byte *) alloca (gdbarch_ptr_bit (gdbarch) / TARGET_CHAR_BIT);
sp = get_frame_register_unsigned (frame, gdbarch_sp_regnum (gdbarch));
- if (target_read_memory (sp + SP_ARG0, /* Offset of first arg on stack. */
+ if (target_read_memory (sp + SP_ARG0, /* Offset of first arg on stack. */
buf, gdbarch_ptr_bit (gdbarch) / TARGET_CHAR_BIT))
return 0;
- jb_addr = extract_unsigned_integer (buf, gdbarch_ptr_bit (gdbarch)
- / TARGET_CHAR_BIT, byte_order);
+ jb_addr
+ = extract_unsigned_integer (buf,
+ gdbarch_ptr_bit (gdbarch) / TARGET_CHAR_BIT,
+ byte_order);
if (target_read_memory (jb_addr + tdep->jb_pc * tdep->jb_elt_size, buf,
gdbarch_ptr_bit (gdbarch) / TARGET_CHAR_BIT),
- byte_order)
+ byte_order)
return 0;
- *pc = extract_unsigned_integer (buf, gdbarch_ptr_bit (gdbarch)
- / TARGET_CHAR_BIT, byte_order);
+ *pc = extract_unsigned_integer (buf,
+ gdbarch_ptr_bit (gdbarch) / TARGET_CHAR_BIT,
+ byte_order);
return 1;
}
-
/* This is the implementation of gdbarch method
return_in_first_hidden_param_p. */
@@ -1122,8 +1105,6 @@ m68k_embedded_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
tdep->pointer_result_regnum = M68K_D0_REGNUM;
}
-
-
/* Function: m68k_gdbarch_init
Initializer function for the m68k gdbarch vector.
Called by gdbarch. Sets up the gdbarch vector(s) for this target. */
@@ -1144,8 +1125,7 @@ m68k_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
const struct tdesc_feature *feature;
int valid_p;
- feature = tdesc_find_feature (info.target_desc,
- "org.gnu.gdb.m68k.core");
+ feature = tdesc_find_feature (info.target_desc, "org.gnu.gdb.m68k.core");
if (feature == NULL)
{
@@ -1157,8 +1137,8 @@ m68k_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
if (feature == NULL)
{
- feature = tdesc_find_feature (info.target_desc,
- "org.gnu.gdb.fido.core");
+ feature
+ = tdesc_find_feature (info.target_desc, "org.gnu.gdb.fido.core");
if (feature != NULL)
flavour = m68k_fido_flavour;
}
@@ -1176,8 +1156,8 @@ m68k_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
if (!valid_p)
return NULL;
- feature = tdesc_find_feature (info.target_desc,
- "org.gnu.gdb.coldfire.fp");
+ feature
+ = tdesc_find_feature (info.target_desc, "org.gnu.gdb.coldfire.fp");
if (feature != NULL)
{
valid_p = 1;
@@ -1197,15 +1177,15 @@ m68k_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
if (info.bfd_arch_info && info.bfd_arch_info->mach != 0)
{
- const bfd_arch_info_type *coldfire_arch =
- bfd_lookup_arch (bfd_arch_m68k, bfd_mach_mcf_isa_a_nodiv);
+ const bfd_arch_info_type *coldfire_arch
+ = bfd_lookup_arch (bfd_arch_m68k, bfd_mach_mcf_isa_a_nodiv);
if (coldfire_arch
- && ((*info.bfd_arch_info->compatible)
- (info.bfd_arch_info, coldfire_arch)))
+ && ((*info.bfd_arch_info->compatible) (info.bfd_arch_info,
+ coldfire_arch)))
flavour = m68k_coldfire_flavour;
}
-
+
/* Try to figure out if the arch uses floating registers to return
floating point values from functions. On ColdFire, floating
point values are returned in D0. */
@@ -1282,7 +1262,7 @@ m68k_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
set_gdbarch_pc_regnum (gdbarch, M68K_PC_REGNUM);
set_gdbarch_ps_regnum (gdbarch, M68K_PS_REGNUM);
set_gdbarch_convert_register_p (gdbarch, m68k_convert_register_p);
- set_gdbarch_register_to_value (gdbarch, m68k_register_to_value);
+ set_gdbarch_register_to_value (gdbarch, m68k_register_to_value);
set_gdbarch_value_to_register (gdbarch, m68k_value_to_register);
if (has_fp)
@@ -1291,8 +1271,8 @@ m68k_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
/* Function call & return. */
set_gdbarch_push_dummy_call (gdbarch, m68k_push_dummy_call);
set_gdbarch_return_value (gdbarch, m68k_return_value);
- set_gdbarch_return_in_first_hidden_param_p (gdbarch,
- m68k_return_in_first_hidden_param_p);
+ set_gdbarch_return_in_first_hidden_param_p (
+ gdbarch, m68k_return_in_first_hidden_param_p);
#if defined JB_PC && defined JB_ELEMENT_SIZE
tdep->jb_pc = JB_PC;
@@ -1330,7 +1310,6 @@ m68k_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
return gdbarch;
}
-
static void
m68k_dump_tdep (struct gdbarch *gdbarch, struct ui_file *file)
{
@@ -1354,6 +1333,7 @@ m68k_osabi_sniffer (bfd *abfd)
}
void _initialize_m68k_tdep ();
+
void
_initialize_m68k_tdep ()
{
diff --git a/gdb/m68k-tdep.h b/gdb/m68k-tdep.h
index 855e1573f6f..cc310a3e6b3 100644
--- a/gdb/m68k-tdep.h
+++ b/gdb/m68k-tdep.h
@@ -35,37 +35,37 @@ enum m68k_regnum
M68K_A0_REGNUM = 8,
M68K_A1_REGNUM = 9,
M68K_A2_REGNUM = 10,
- M68K_FP_REGNUM = 14, /* Address of executing stack frame. */
- M68K_SP_REGNUM = 15, /* Address of top of stack. */
- M68K_PS_REGNUM = 16, /* Processor status. */
- M68K_PC_REGNUM = 17, /* Program counter. */
- M68K_FP0_REGNUM = 18, /* Floating point register 0. */
- M68K_FPC_REGNUM = 26, /* 68881 control register. */
- M68K_FPS_REGNUM = 27, /* 68881 status register. */
+ M68K_FP_REGNUM = 14, /* Address of executing stack frame. */
+ M68K_SP_REGNUM = 15, /* Address of top of stack. */
+ M68K_PS_REGNUM = 16, /* Processor status. */
+ M68K_PC_REGNUM = 17, /* Program counter. */
+ M68K_FP0_REGNUM = 18, /* Floating point register 0. */
+ M68K_FPC_REGNUM = 26, /* 68881 control register. */
+ M68K_FPS_REGNUM = 27, /* 68881 status register. */
M68K_FPI_REGNUM = 28
};
/* Number of machine registers. */
-#define M68K_NUM_REGS (M68K_FPI_REGNUM + 1)
+#define M68K_NUM_REGS (M68K_FPI_REGNUM + 1)
/* Size of the largest register. */
-#define M68K_MAX_REGISTER_SIZE 12
+#define M68K_MAX_REGISTER_SIZE 12
/* Convention for returning structures. */
enum struct_return
{
- pcc_struct_return, /* Return "short" structures in memory. */
- reg_struct_return /* Return "short" structures in registers. */
+ pcc_struct_return, /* Return "short" structures in memory. */
+ reg_struct_return /* Return "short" structures in registers. */
};
/* Particular flavour of m68k. */
enum m68k_flavour
- {
- m68k_no_flavour,
- m68k_coldfire_flavour,
- m68k_fido_flavour
- };
+{
+ m68k_no_flavour,
+ m68k_coldfire_flavour,
+ m68k_fido_flavour
+};
/* Target-dependent structure in gdbarch. */
@@ -86,26 +86,29 @@ struct m68k_gdbarch_tdep : gdbarch_tdep_base
int pointer_result_regnum = 0;
/* Convention for returning structures. */
- enum struct_return struct_return {};
+ enum struct_return struct_return
+ {
+ };
/* Convention for returning floats. zero in int regs, non-zero in float. */
int float_return = 0;
/* The particular flavour of m68k. */
- enum m68k_flavour flavour {};
+ enum m68k_flavour flavour
+ {
+ };
/* Flag set if the floating point registers are present, or assumed
to be present. */
int fpregs_present = 0;
- /* ISA-specific data types. */
+ /* ISA-specific data types. */
struct type *m68k_ps_type = nullptr;
struct type *m68881_ext_type = nullptr;
};
/* Initialize a SVR4 architecture variant. */
extern void m68k_svr4_init_abi (struct gdbarch_info, struct gdbarch *);
-
/* Functions exported from m68k-bsd-tdep.c. */
diff --git a/gdb/machoread.c b/gdb/machoread.c
index 49cf4fd38fd..d5770330308 100644
--- a/gdb/machoread.c
+++ b/gdb/machoread.c
@@ -37,9 +37,9 @@
/* If non-zero displays debugging message. */
static unsigned int mach_o_debug_level = 0;
-#define macho_debug(LEVEL, FMT, ...) \
- debug_prefixed_printf_cond_nofunc (mach_o_debug_level > LEVEL, \
- "machoread", FMT, ## __VA_ARGS__)
+#define macho_debug(LEVEL, FMT, ...) \
+ debug_prefixed_printf_cond_nofunc (mach_o_debug_level > LEVEL, "machoread", \
+ FMT, ##__VA_ARGS__)
/* Dwarf debugging information are never in the final executable. They stay
in object files and the executable contains the list of object files read
@@ -51,11 +51,11 @@ static unsigned int mach_o_debug_level = 0;
struct oso_el
{
oso_el (asymbol **oso_sym_, asymbol **end_sym_, unsigned int nbr_syms_)
- : name((*oso_sym_)->name),
- mtime((*oso_sym_)->value),
- oso_sym(oso_sym_),
- end_sym(end_sym_),
- nbr_syms(nbr_syms_)
+ : name ((*oso_sym_)->name),
+ mtime ((*oso_sym_)->value),
+ oso_sym (oso_sym_),
+ end_sym (end_sym_),
+ nbr_syms (nbr_syms_)
{
}
@@ -136,7 +136,7 @@ macho_symtab_add_minsym (minimal_symbol_reader &reader,
ms_type = mst_unknown;
}
else
- return; /* Skip this symbol. */
+ return; /* Skip this symbol. */
reader.record_with_info (sym->name, symaddr, ms_type,
gdb_bfd_section_index (objfile->obfd.get (),
@@ -148,8 +148,7 @@ macho_symtab_add_minsym (minimal_symbol_reader &reader,
NUMBER_OF_SYMBOLS for OBJFILE. Registers OSO filenames found. */
static void
-macho_symtab_read (minimal_symbol_reader &reader,
- struct objfile *objfile,
+macho_symtab_read (minimal_symbol_reader &reader, struct objfile *objfile,
long number_of_symbols, asymbol **symbol_table,
std::vector<oso_el> *oso_vector_ptr)
{
@@ -177,12 +176,13 @@ macho_symtab_read (minimal_symbol_reader &reader,
S_DWARF_FILE,
S_STAB_FILE
- } state = S_NO_SO;
+ } state
+ = S_NO_SO;
for (i = 0; i < number_of_symbols; i++)
{
const asymbol *sym = symbol_table[i];
- bfd_mach_o_asymbol *mach_o_sym = (bfd_mach_o_asymbol *)sym;
+ bfd_mach_o_asymbol *mach_o_sym = (bfd_mach_o_asymbol *) sym;
switch (state)
{
@@ -193,7 +193,7 @@ macho_symtab_read (minimal_symbol_reader &reader,
if (sym->name == NULL || sym->name[0] == 0)
{
/* Unexpected empty N_SO. */
- complaint (_("Unexpected empty N_SO stab"));
+ complaint (_ ("Unexpected empty N_SO stab"));
}
else
{
@@ -210,7 +210,7 @@ macho_symtab_read (minimal_symbol_reader &reader,
}
/* Debugging symbols are not expected here. */
- complaint (_("%s: Unexpected debug stab outside SO markers"),
+ complaint (_ ("%s: Unexpected debug stab outside SO markers"),
objfile_name (objfile));
}
else
@@ -227,7 +227,7 @@ macho_symtab_read (minimal_symbol_reader &reader,
if (sym->name == NULL || sym->name[0] == 0)
{
/* Unexpected empty N_SO. */
- complaint (_("Empty SO section"));
+ complaint (_ ("Empty SO section"));
state = S_NO_SO;
}
else if (state == S_FIRST_SO)
@@ -237,7 +237,7 @@ macho_symtab_read (minimal_symbol_reader &reader,
state = S_SECOND_SO;
}
else
- complaint (_("Three SO in a raw"));
+ complaint (_ ("Three SO in a raw"));
}
else if (mach_o_sym->n_type == N_OSO)
{
@@ -246,7 +246,7 @@ macho_symtab_read (minimal_symbol_reader &reader,
/* Empty OSO. Means that this file was compiled with
stabs. */
state = S_STAB_FILE;
- warning (_("stabs debugging not supported for %s"),
+ warning (_ ("stabs debugging not supported for %s"),
file_so->name);
}
else
@@ -258,7 +258,7 @@ macho_symtab_read (minimal_symbol_reader &reader,
}
}
else
- complaint (_("Unexpected stab after SO"));
+ complaint (_ ("Unexpected stab after SO"));
break;
case S_STAB_FILE:
@@ -275,7 +275,7 @@ macho_symtab_read (minimal_symbol_reader &reader,
}
else
{
- complaint (_("Missing nul SO"));
+ complaint (_ ("Missing nul SO"));
file_so = sym;
state = S_FIRST_SO;
}
@@ -303,19 +303,19 @@ macho_symtab_read (minimal_symbol_reader &reader,
case N_GSYM:
break;
default:
- complaint (_("unhandled stab for dwarf OSO file"));
+ complaint (_ ("unhandled stab for dwarf OSO file"));
break;
}
}
}
else
- complaint (_("non-debugging symbol within SO"));
+ complaint (_ ("non-debugging symbol within SO"));
break;
}
}
if (state != S_NO_SO)
- complaint (_("missing nul SO"));
+ complaint (_ ("missing nul SO"));
}
/* If NAME describes an archive member (ie: ARCHIVE '(' MEMBER ')'),
@@ -359,8 +359,7 @@ struct macho_sym_hash_entry
static struct bfd_hash_entry *
macho_sym_hash_newfunc (struct bfd_hash_entry *entry,
- struct bfd_hash_table *table,
- const char *string)
+ struct bfd_hash_table *table, const char *string)
{
struct macho_sym_hash_entry *ret = (struct macho_sym_hash_entry *) entry;
@@ -368,13 +367,13 @@ macho_sym_hash_newfunc (struct bfd_hash_entry *entry,
subclass. */
if (ret == NULL)
ret = (struct macho_sym_hash_entry *) bfd_hash_allocate (table,
- sizeof (* ret));
+ sizeof (*ret));
if (ret == NULL)
return NULL;
/* Call the allocation method of the superclass. */
ret = (struct macho_sym_hash_entry *)
- bfd_hash_newfunc ((struct bfd_hash_entry *) ret, table, string);
+ bfd_hash_newfunc ((struct bfd_hash_entry *) ret, table, string);
if (ret)
{
@@ -400,7 +399,7 @@ macho_resolve_oso_sym_with_minsym (struct objfile *main_objfile, asymbol *sym)
msym = lookup_minimal_symbol (name, NULL, main_objfile);
if (msym.minsym == NULL)
{
- warning (_("can't find symbol '%s' in minsymtab"), name);
+ warning (_ ("can't find symbol '%s' in minsymtab"), name);
return 0;
}
else
@@ -411,8 +410,7 @@ macho_resolve_oso_sym_with_minsym (struct objfile *main_objfile, asymbol *sym)
static void
macho_add_oso_symfile (oso_el *oso, const gdb_bfd_ref_ptr &abfd,
- const char *name,
- struct objfile *main_objfile,
+ const char *name, struct objfile *main_objfile,
symfile_add_flags symfile_flags)
{
int storage;
@@ -425,18 +423,18 @@ macho_add_oso_symfile (oso_el *oso, const gdb_bfd_ref_ptr &abfd,
/* Per section flag to mark which section have been rebased. */
unsigned char *sections_rebased;
- macho_debug (0, _("Loading debugging symbols from oso: %s\n"), oso->name);
+ macho_debug (0, _ ("Loading debugging symbols from oso: %s\n"), oso->name);
if (!bfd_check_format (abfd.get (), bfd_object))
{
- warning (_("`%s': can't read symbols: %s."), oso->name,
+ warning (_ ("`%s': can't read symbols: %s."), oso->name,
bfd_errmsg (bfd_get_error ()));
return;
}
if (abfd->my_archive == NULL && oso->mtime != bfd_get_mtime (abfd.get ()))
{
- warning (_("`%s': file time stamp mismatch."), oso->name);
+ warning (_ ("`%s': file time stamp mismatch."), oso->name);
return;
}
@@ -444,7 +442,7 @@ macho_add_oso_symfile (oso_el *oso, const gdb_bfd_ref_ptr &abfd,
sizeof (struct macho_sym_hash_entry),
oso->nbr_syms))
{
- warning (_("`%s': can't create hash table"), oso->name);
+ warning (_ ("`%s': can't create hash table"), oso->name);
return;
}
@@ -465,7 +463,7 @@ macho_add_oso_symfile (oso_el *oso, const gdb_bfd_ref_ptr &abfd,
for (symp = oso->oso_sym; symp != oso->end_sym; symp++)
{
const asymbol *sym = *symp;
- bfd_mach_o_asymbol *mach_o_sym = (bfd_mach_o_asymbol *)sym;
+ bfd_mach_o_asymbol *mach_o_sym = (bfd_mach_o_asymbol *) sym;
switch (mach_o_sym->n_type)
{
@@ -488,15 +486,15 @@ macho_add_oso_symfile (oso_el *oso, const gdb_bfd_ref_ptr &abfd,
{
struct macho_sym_hash_entry *ent;
- ent = (struct macho_sym_hash_entry *)
- bfd_hash_lookup (&table, sym->name, TRUE, FALSE);
+ ent = (struct macho_sym_hash_entry *) bfd_hash_lookup (&table,
+ sym->name,
+ TRUE, FALSE);
if (ent->sym != NULL)
- complaint (_("Duplicated symbol %s in symbol table"), sym->name);
+ complaint (_ ("Duplicated symbol %s in symbol table"), sym->name);
else
{
- macho_debug (4, _("Adding symbol %s (addr: %s)\n"),
- sym->name, paddress (main_objfile->arch (),
- sym->value));
+ macho_debug (4, _ ("Adding symbol %s (addr: %s)\n"), sym->name,
+ paddress (main_objfile->arch (), sym->value));
ent->sym = sym;
}
}
@@ -506,12 +504,12 @@ macho_add_oso_symfile (oso_el *oso, const gdb_bfd_ref_ptr &abfd,
for (i = 0; symbol_table[i]; i++)
{
asymbol *sym = symbol_table[i];
- bfd_mach_o_asymbol *mach_o_sym = (bfd_mach_o_asymbol *)sym;
+ bfd_mach_o_asymbol *mach_o_sym = (bfd_mach_o_asymbol *) sym;
if (mach_o_sym->n_type & BFD_MACH_O_N_STAB)
continue;
if ((mach_o_sym->n_type & BFD_MACH_O_N_TYPE) == BFD_MACH_O_N_UNDF
- && sym->value != 0)
+ && sym->value != 0)
{
/* For common symbol use the min symtab and modify the OSO
symbol table. */
@@ -564,7 +562,7 @@ macho_add_oso_symfile (oso_el *oso, const gdb_bfd_ref_ptr &abfd,
{
CORE_ADDR res = addr - sym->value;
- macho_debug (3, _("resolve sect %s with %s (set to %s)\n"),
+ macho_debug (3, _ ("resolve sect %s with %s (set to %s)\n"),
sec->name, sym->name,
paddress (main_objfile->arch (), res));
bfd_set_section_vma (sec, res);
@@ -583,12 +581,11 @@ macho_add_oso_symfile (oso_el *oso, const gdb_bfd_ref_ptr &abfd,
/* We need to clear SYMFILE_MAINLINE to avoid interactive question
from symfile.c:symbol_file_add_with_addrs_or_offsets. */
- symbol_file_add_from_bfd
- (abfd, name, symfile_flags & ~(SYMFILE_MAINLINE | SYMFILE_VERBOSE),
- NULL,
- main_objfile->flags & (OBJF_REORDERED | OBJF_SHARED
- | OBJF_READNOW | OBJF_USERLOADED),
- main_objfile);
+ symbol_file_add_from_bfd (
+ abfd, name, symfile_flags & ~(SYMFILE_MAINLINE | SYMFILE_VERBOSE), NULL,
+ main_objfile->flags
+ & (OBJF_REORDERED | OBJF_SHARED | OBJF_READNOW | OBJF_USERLOADED),
+ main_objfile);
}
/* Read symbols from the vector of oso files.
@@ -636,26 +633,27 @@ macho_symfile_read_all_oso (std::vector<oso_el> *oso_vector_ptr,
gnutarget));
if (archive_bfd == NULL)
{
- warning (_("Could not open OSO archive file \"%s\""),
+ warning (_ ("Could not open OSO archive file \"%s\""),
archive_name.c_str ());
ix = last_ix;
continue;
}
if (!bfd_check_format (archive_bfd.get (), bfd_archive))
{
- warning (_("OSO archive file \"%s\" not an archive."),
+ warning (_ ("OSO archive file \"%s\" not an archive."),
archive_name.c_str ());
ix = last_ix;
continue;
}
- gdb_bfd_ref_ptr member_bfd
- (gdb_bfd_openr_next_archived_file (archive_bfd.get (), NULL));
+ gdb_bfd_ref_ptr member_bfd (
+ gdb_bfd_openr_next_archived_file (archive_bfd.get (), NULL));
if (member_bfd == NULL)
{
- warning (_("Could not read archive members out of "
- "OSO archive \"%s\""), archive_name.c_str ());
+ warning (_ ("Could not read archive members out of "
+ "OSO archive \"%s\""),
+ archive_name.c_str ());
ix = last_ix;
continue;
}
@@ -676,24 +674,26 @@ macho_symfile_read_all_oso (std::vector<oso_el> *oso_vector_ptr,
&& !memcmp (member_name, oso2->name + pfx_len + 1,
member_len))
{
- macho_add_oso_symfile (oso2, member_bfd,
- bfd_get_filename (member_bfd.get ()),
- main_objfile, symfile_flags);
+ macho_add_oso_symfile (
+ oso2, member_bfd, bfd_get_filename (member_bfd.get ()),
+ main_objfile, symfile_flags);
oso2->name = NULL;
break;
}
}
- member_bfd = gdb_bfd_openr_next_archived_file (archive_bfd.get (),
- member_bfd.get ());
+ member_bfd
+ = gdb_bfd_openr_next_archived_file (archive_bfd.get (),
+ member_bfd.get ());
}
for (ix2 = ix; ix2 < last_ix; ix2++)
{
oso2 = &(*oso_vector_ptr)[ix2];
if (oso2->name != NULL)
- warning (_("Could not find specified archive member "
- "for OSO name \"%s\""), oso->name);
+ warning (_ ("Could not find specified archive member "
+ "for OSO name \"%s\""),
+ oso->name);
}
ix = last_ix;
}
@@ -701,7 +701,7 @@ macho_symfile_read_all_oso (std::vector<oso_el> *oso_vector_ptr,
{
gdb_bfd_ref_ptr abfd (gdb_bfd_open (oso->name, gnutarget));
if (abfd == NULL)
- warning (_("`%s': can't open to read symbols: %s."), oso->name,
+ warning (_ ("`%s': can't open to read symbols: %s."), oso->name,
bfd_errmsg (bfd_get_error ()));
else
macho_add_oso_symfile (oso, abfd, oso->name, main_objfile,
@@ -742,35 +742,37 @@ macho_check_dsym (struct objfile *objfile, std::string *filenamep)
if (access (dsym_filename, R_OK) != 0)
return NULL;
- if (bfd_mach_o_lookup_command (objfile->obfd.get (),
- BFD_MACH_O_LC_UUID, &main_uuid) == 0)
+ if (bfd_mach_o_lookup_command (objfile->obfd.get (), BFD_MACH_O_LC_UUID,
+ &main_uuid)
+ == 0)
{
- warning (_("can't find UUID in %s"), objfile_name (objfile));
+ warning (_ ("can't find UUID in %s"), objfile_name (objfile));
return NULL;
}
gdb_bfd_ref_ptr dsym_bfd (gdb_bfd_openr (dsym_filename, gnutarget));
if (dsym_bfd == NULL)
{
- warning (_("can't open dsym file %s"), dsym_filename);
+ warning (_ ("can't open dsym file %s"), dsym_filename);
return NULL;
}
if (!bfd_check_format (dsym_bfd.get (), bfd_object))
{
- warning (_("bad dsym file format: %s"), bfd_errmsg (bfd_get_error ()));
+ warning (_ ("bad dsym file format: %s"), bfd_errmsg (bfd_get_error ()));
return NULL;
}
- if (bfd_mach_o_lookup_command (dsym_bfd.get (),
- BFD_MACH_O_LC_UUID, &dsym_uuid) == 0)
+ if (bfd_mach_o_lookup_command (dsym_bfd.get (), BFD_MACH_O_LC_UUID,
+ &dsym_uuid)
+ == 0)
{
- warning (_("can't find UUID in %s"), dsym_filename);
+ warning (_ ("can't find UUID in %s"), dsym_filename);
return NULL;
}
if (memcmp (dsym_uuid->command.uuid.uuid, main_uuid->command.uuid.uuid,
sizeof (main_uuid->command.uuid.uuid)))
{
- warning (_("dsym file UUID doesn't match the one in %s"),
+ warning (_ ("dsym file UUID doesn't match the one in %s"),
objfile_name (objfile));
return NULL;
}
@@ -798,7 +800,7 @@ macho_symfile_read (struct objfile *objfile, symfile_add_flags symfile_flags)
/* Process the normal symbol table first. */
storage_needed = bfd_get_symtab_upper_bound (objfile->obfd.get ());
if (storage_needed < 0)
- error (_("Can't read symbols from %s: %s"),
+ error (_ ("Can't read symbols from %s: %s"),
bfd_get_filename (objfile->obfd.get ()),
bfd_errmsg (bfd_get_error ()));
@@ -814,7 +816,7 @@ macho_symfile_read (struct objfile *objfile, symfile_add_flags symfile_flags)
symbol_table.data ());
if (symcount < 0)
- error (_("Can't read symbols from %s: %s"),
+ error (_ ("Can't read symbols from %s: %s"),
bfd_get_filename (objfile->obfd.get ()),
bfd_errmsg (bfd_get_error ()));
@@ -836,12 +838,11 @@ macho_symfile_read (struct objfile *objfile, symfile_add_flags symfile_flags)
{
struct bfd_section *asect, *dsect;
- macho_debug (0, _("dsym file found\n"));
+ macho_debug (0, _ ("dsym file found\n"));
/* Set dsym section size. */
for (asect = objfile->obfd->sections, dsect = dsym_bfd->sections;
- asect && dsect;
- asect = asect->next, dsect = dsect->next)
+ asect && dsect; asect = asect->next, dsect = dsect->next)
{
if (strcmp (asect->name, dsect->name) != 0)
break;
@@ -879,8 +880,8 @@ macho_symfile_relocate (struct objfile *objfile, asection *sectp,
if ((sectp->flags & SEC_RELOC) == 0)
return NULL;
- macho_debug (0, _("Relocate section '%s' of %s\n"),
- sectp->name, objfile_name (objfile));
+ macho_debug (0, _ ("Relocate section '%s' of %s\n"), sectp->name,
+ objfile_name (objfile));
return bfd_simple_get_relocated_section_contents (abfd, sectp, buf, NULL);
}
@@ -891,14 +892,14 @@ macho_symfile_finish (struct objfile *objfile)
}
static void
-macho_symfile_offsets (struct objfile *objfile,
- const section_addr_info &addrs)
+macho_symfile_offsets (struct objfile *objfile, const section_addr_info &addrs)
{
unsigned int i;
struct obj_section *osect;
/* Allocate section_offsets. */
- objfile->section_offsets.assign (gdb_bfd_count_sections (objfile->obfd.get ()), 0);
+ objfile->section_offsets.assign (
+ gdb_bfd_count_sections (objfile->obfd.get ()), 0);
/* This code is run when we first add the objfile with
symfile_add_with_addrs_or_offsets, when "addrs" not "offsets" are
@@ -928,7 +929,8 @@ macho_symfile_offsets (struct objfile *objfile,
ALL_OBJFILE_OSECTIONS (objfile, osect)
{
const char *bfd_sect_name = osect->the_bfd_section->name;
- int sect_index = osect - objfile->sections;;
+ int sect_index = osect - objfile->sections;
+ ;
if (startswith (bfd_sect_name, "LC_SEGMENT."))
bfd_sect_name += 11;
@@ -939,27 +941,26 @@ macho_symfile_offsets (struct objfile *objfile,
}
static const struct sym_fns macho_sym_fns = {
- macho_new_init, /* init anything gbl to entire symtab */
- macho_symfile_init, /* read initial info, setup for sym_read() */
- macho_symfile_read, /* read a symbol file into symtab */
- macho_symfile_finish, /* finished with file, cleanup */
- macho_symfile_offsets, /* xlate external to internal form */
- default_symfile_segments, /* Get segment information from a file. */
+ macho_new_init, /* init anything gbl to entire symtab */
+ macho_symfile_init, /* read initial info, setup for sym_read() */
+ macho_symfile_read, /* read a symbol file into symtab */
+ macho_symfile_finish, /* finished with file, cleanup */
+ macho_symfile_offsets, /* xlate external to internal form */
+ default_symfile_segments, /* Get segment information from a file. */
NULL,
- macho_symfile_relocate, /* Relocate a debug section. */
- NULL, /* sym_get_probes */
+ macho_symfile_relocate, /* Relocate a debug section. */
+ NULL, /* sym_get_probes */
};
void _initialize_machoread ();
+
void
_initialize_machoread ()
{
add_symtab_fns (bfd_target_mach_o_flavour, &macho_sym_fns);
- add_setshow_zuinteger_cmd ("mach-o", class_obscure,
- &mach_o_debug_level,
- _("Set if printing Mach-O symbols processing."),
- _("Show if printing Mach-O symbols processing."),
- NULL, NULL, NULL,
- &setdebuglist, &showdebuglist);
+ add_setshow_zuinteger_cmd ("mach-o", class_obscure, &mach_o_debug_level,
+ _ ("Set if printing Mach-O symbols processing."),
+ _ ("Show if printing Mach-O symbols processing."),
+ NULL, NULL, NULL, &setdebuglist, &showdebuglist);
}
diff --git a/gdb/macrocmd.c b/gdb/macrocmd.c
index b050459a2ab..dfb39662e82 100644
--- a/gdb/macrocmd.c
+++ b/gdb/macrocmd.c
@@ -17,7 +17,6 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
-
#include "defs.h"
#include "macrotab.h"
#include "macroexp.h"
@@ -28,15 +27,12 @@
#include "gdbcmd.h"
#include "linespec.h"
-
/* The `macro' prefix command. */
static struct cmd_list_element *macrolist;
-
/* Macro expansion commands. */
-
/* Prints an informational message regarding the lack of macro information. */
static void
macro_inform_no_debuginfo (void)
@@ -52,10 +48,10 @@ macro_expand_command (const char *exp, int from_tty)
Then it would be easy to ask, "Hey, what did I just evaluate?" But
at the moment, the `print' commands don't save the last expression
evaluated, just its value. */
- if (! exp || ! *exp)
- error (_("You must follow the `macro expand' command with the"
- " expression you\n"
- "want to expand."));
+ if (!exp || !*exp)
+ error (_ ("You must follow the `macro expand' command with the"
+ " expression you\n"
+ "want to expand."));
gdb::unique_xmalloc_ptr<macro_scope> ms = default_macro_scope ();
@@ -71,7 +67,6 @@ macro_expand_command (const char *exp, int from_tty)
macro_inform_no_debuginfo ();
}
-
static void
macro_expand_once_command (const char *exp, int from_tty)
{
@@ -80,10 +75,10 @@ macro_expand_once_command (const char *exp, int from_tty)
And it should set the once-expanded text as the new `last
expression'. That way, you could just hit return over and over and
see the expression expanded one level at a time. */
- if (! exp || ! *exp)
- error (_("You must follow the `macro expand-once' command with"
- " the expression\n"
- "you want to expand."));
+ if (!exp || !*exp)
+ error (_ ("You must follow the `macro expand-once' command with"
+ " the expression\n"
+ "you want to expand."));
gdb::unique_xmalloc_ptr<macro_scope> ms = default_macro_scope ();
@@ -104,20 +99,18 @@ macro_expand_once_command (const char *exp, int from_tty)
Care should be taken that this function does not cause any lookups into
the splay tree so that it can be safely used while iterating. */
static void
-show_pp_source_pos (struct ui_file *stream,
- struct macro_source_file *file,
+show_pp_source_pos (struct ui_file *stream, struct macro_source_file *file,
int line)
{
std::string fullname = macro_source_fullname (file);
gdb_printf (stream, "%ps:%d\n",
- styled_string (file_name_style.style (),
- fullname.c_str ()),
+ styled_string (file_name_style.style (), fullname.c_str ()),
line);
while (file->included_by)
{
fullname = macro_source_fullname (file->included_by);
- gdb_puts (_(" included at "), stream);
+ gdb_puts (_ (" included at "), stream);
fputs_styled (fullname.c_str (), file_name_style.style (), stream);
gdb_printf (stream, ":%d\n", file->included_at_line);
file = file->included_by;
@@ -132,10 +125,8 @@ show_pp_source_pos (struct ui_file *stream,
Care should be taken that this function does not cause any lookups into
the splay tree so that it can be safely used while iterating. */
static void
-print_macro_definition (const char *name,
- const struct macro_definition *d,
- struct macro_source_file *file,
- int line)
+print_macro_definition (const char *name, const struct macro_definition *d,
+ struct macro_source_file *file, int line)
{
gdb_printf ("Defined at ");
show_pp_source_pos (gdb_stdout, file, line);
@@ -175,8 +166,8 @@ info_macro_command (const char *args, int from_tty)
const char *arg_start = args;
int processing_args = 1;
- while (processing_args
- && arg_start && *arg_start == '-' && *arg_start != '\0')
+ while (processing_args && arg_start && *arg_start == '-'
+ && *arg_start != '\0')
{
const char *p = skip_to_space (arg_start);
@@ -184,7 +175,7 @@ info_macro_command (const char *args, int from_tty)
|| strncmp (arg_start, "-all", p - arg_start) == 0)
show_all_macros_named = 1;
else if (strncmp (arg_start, "--", p - arg_start) == 0)
- /* Our macro support seems rather C specific but this would
+ /* Our macro support seems rather C specific but this would
seem necessary for languages allowing - in macro names.
e.g. Scheme's (defmacro ->foo () "bar\n") */
processing_args = 0;
@@ -196,24 +187,22 @@ info_macro_command (const char *args, int from_tty)
name = arg_start;
- if (! name || ! *name)
- error (_("You must follow the `info macro' command with the name"
- " of the macro\n"
- "whose definition you want to see."));
+ if (!name || !*name)
+ error (_ ("You must follow the `info macro' command with the name"
+ " of the macro\n"
+ "whose definition you want to see."));
ms = default_macro_scope ();
- if (! ms)
+ if (!ms)
macro_inform_no_debuginfo ();
else if (show_all_macros_named)
- macro_for_each (ms->file->table, [&] (const char *macro_name,
- const macro_definition *macro,
- macro_source_file *source,
- int line)
- {
- if (strcmp (name, macro_name) == 0)
- print_macro_definition (name, macro, source, line);
- });
+ macro_for_each (ms->file->table,
+ [&] (const char *macro_name, const macro_definition *macro,
+ macro_source_file *source, int line) {
+ if (strcmp (name, macro_name) == 0)
+ print_macro_definition (name, macro, source, line);
+ });
else
{
struct macro_definition *d;
@@ -231,7 +220,8 @@ info_macro_command (const char *args, int from_tty)
{
gdb_printf ("The symbol `%s' has no definition as a C/C++"
" preprocessor macro\n"
- "at ", name);
+ "at ",
+ name);
show_pp_source_pos (gdb_stdout, ms->file, ms->line);
}
}
@@ -254,13 +244,12 @@ info_macros_command (const char *args, int from_tty)
ms = sal_macro_scope (sals[0]);
}
- if (! ms || ! ms->file || ! ms->file->table)
+ if (!ms || !ms->file || !ms->file->table)
macro_inform_no_debuginfo ();
else
macro_for_each_in_scope (ms->file, ms->line, print_macro_definition);
}
-
/* User-defined macros. */
static void
@@ -290,7 +279,7 @@ extract_identifier (const char **expp, int is_parameter)
}
else
{
- if (! *p || ! macro_is_identifier_nondigit (*p))
+ if (!*p || !macro_is_identifier_nondigit (*p))
return NULL;
for (++p;
*p && (macro_is_identifier_nondigit (*p) || macro_is_digit (*p));
@@ -298,7 +287,7 @@ extract_identifier (const char **expp, int is_parameter)
;
}
- if (is_parameter && startswith (p, "..."))
+ if (is_parameter && startswith (p, "..."))
p += 3;
len = p - *expp;
@@ -337,12 +326,12 @@ macro_define_command (const char *exp, int from_tty)
temporary_macro_definition new_macro;
if (!exp)
- error (_("usage: macro define NAME[(ARGUMENT-LIST)] [REPLACEMENT-LIST]"));
+ error (_ ("usage: macro define NAME[(ARGUMENT-LIST)] [REPLACEMENT-LIST]"));
skip_ws (&exp);
gdb::unique_xmalloc_ptr<char> name = extract_identifier (&exp, 0);
if (name == NULL)
- error (_("Invalid macro name."));
+ error (_ ("Invalid macro name."));
if (*exp == '(')
{
/* Function-like macro. */
@@ -351,7 +340,7 @@ macro_define_command (const char *exp, int from_tty)
new_macro.kind = macro_function_like;
new_macro.argc = 0;
- new_macro.argv = (const char * const *) argv;
+ new_macro.argv = (const char *const *) argv;
/* Skip the '(' and whitespace. */
++exp;
@@ -366,17 +355,17 @@ macro_define_command (const char *exp, int from_tty)
alloced *= 2;
argv = (char **) xrealloc (argv, alloced * sizeof (char *));
/* Must update new_macro as well... */
- new_macro.argv = (const char * const *) argv;
+ new_macro.argv = (const char *const *) argv;
}
argv[new_macro.argc] = extract_identifier (&exp, 1).release ();
- if (! argv[new_macro.argc])
- error (_("Macro is missing an argument."));
+ if (!argv[new_macro.argc])
+ error (_ ("Macro is missing an argument."));
++new_macro.argc;
for (i = new_macro.argc - 2; i >= 0; --i)
{
- if (! strcmp (argv[i], argv[new_macro.argc - 1]))
- error (_("Two macro arguments with identical names."));
+ if (!strcmp (argv[i], argv[new_macro.argc - 1]))
+ error (_ ("Two macro arguments with identical names."));
}
skip_ws (&exp);
@@ -386,7 +375,7 @@ macro_define_command (const char *exp, int from_tty)
skip_ws (&exp);
}
else if (*exp != ')')
- error (_("',' or ')' expected at end of macro arguments."));
+ error (_ ("',' or ')' expected at end of macro arguments."));
}
/* Skip the closing paren. */
++exp;
@@ -404,21 +393,19 @@ macro_define_command (const char *exp, int from_tty)
}
}
-
static void
macro_undef_command (const char *exp, int from_tty)
{
if (!exp)
- error (_("usage: macro undef NAME"));
+ error (_ ("usage: macro undef NAME"));
skip_ws (&exp);
gdb::unique_xmalloc_ptr<char> name = extract_identifier (&exp, 0);
if (name == nullptr)
- error (_("Invalid macro name."));
+ error (_ ("Invalid macro name."));
macro_undef (macro_main (macro_user_macros), -1, name.get ());
}
-
static void
print_one_macro (const char *name, const struct macro_definition *macro,
struct macro_source_file *source, int line)
@@ -430,14 +417,12 @@ print_one_macro (const char *name, const struct macro_definition *macro,
gdb_printf ("(");
for (i = 0; i < macro->argc; ++i)
- gdb_printf ("%s%s", (i > 0) ? ", " : "",
- macro->argv[i]);
+ gdb_printf ("%s%s", (i > 0) ? ", " : "", macro->argv[i]);
gdb_printf (")");
}
gdb_printf (" %s\n", macro->replacement);
}
-
static void
macro_list_command (const char *exp, int from_tty)
{
@@ -447,24 +432,26 @@ macro_list_command (const char *exp, int from_tty)
/* Initializing the `macrocmd' module. */
void _initialize_macrocmd ();
+
void
_initialize_macrocmd ()
{
/* We introduce a new command prefix, `macro', under which we'll put
the various commands for working with preprocessor macros. */
- add_basic_prefix_cmd ("macro", class_info,
- _("Prefix for commands dealing with C preprocessor macros."),
- &macrolist, 0, &cmdlist);
+ add_basic_prefix_cmd (
+ "macro", class_info,
+ _ ("Prefix for commands dealing with C preprocessor macros."), &macrolist,
+ 0, &cmdlist);
cmd_list_element *macro_expand_cmd
- = add_cmd ("expand", no_class, macro_expand_command, _("\
+ = add_cmd ("expand", no_class, macro_expand_command, _ ("\
Fully expand any C/C++ preprocessor macro invocations in EXPRESSION.\n\
Show the expanded expression."),
&macrolist);
add_alias_cmd ("exp", macro_expand_cmd, no_class, 1, &macrolist);
cmd_list_element *macro_expand_once_cmd
- = add_cmd ("expand-once", no_class, macro_expand_once_command, _("\
+ = add_cmd ("expand-once", no_class, macro_expand_once_command, _ ("\
Expand C/C++ preprocessor macro invocations appearing directly in EXPRESSION.\n\
Show the expanded expression.\n\
\n\
@@ -479,19 +466,20 @@ expression work together to yield a pre-processed expression."),
add_alias_cmd ("exp1", macro_expand_once_cmd, no_class, 1, &macrolist);
add_info ("macro", info_macro_command,
- _("Show the definition of MACRO, and it's source location.\n\
+ _ ("Show the definition of MACRO, and it's source location.\n\
Usage: info macro [-a|-all] [--] MACRO\n\
Options: \n\
-a, --all Output all definitions of MACRO in the current compilation\
unit.\n\
-- Specify the end of arguments and the beginning of the MACRO."));
- add_info ("macros", info_macros_command,
- _("Show the definitions of all macros at LINESPEC, or the current \
+ add_info (
+ "macros", info_macros_command,
+ _ ("Show the definitions of all macros at LINESPEC, or the current \
source location.\n\
Usage: info macros [LINESPEC]"));
- add_cmd ("define", no_class, macro_define_command, _("\
+ add_cmd ("define", no_class, macro_define_command, _ ("\
Define a new C/C++ preprocessor macro.\n\
The GDB command `macro define DEFINITION' is equivalent to placing a\n\
preprocessor directive of the form `#define DEFINITION' such that the\n\
@@ -501,11 +489,11 @@ For example:\n\
(gdb) macro define MIN(x,y) ((x) < (y) ? (x) : (y))"),
&macrolist);
- add_cmd ("undef", no_class, macro_undef_command, _("\
+ add_cmd ("undef", no_class, macro_undef_command, _ ("\
Remove the definition of the C/C++ preprocessor macro with the given name."),
&macrolist);
add_cmd ("list", no_class, macro_list_command,
- _("List all the macros defined using the `macro define' command."),
+ _ ("List all the macros defined using the `macro define' command."),
&macrolist);
}
diff --git a/gdb/macroexp.c b/gdb/macroexp.c
index a455fc39813..66da4b33a8c 100644
--- a/gdb/macroexp.c
+++ b/gdb/macroexp.c
@@ -24,9 +24,6 @@
#include "macroscope.h"
#include "c-lang.h"
-
-
-
/* A string type that we can use to refer to substrings of other
strings. */
@@ -62,10 +59,7 @@ struct shared_macro_buffer
/* Set the macro buffer to refer to the LEN bytes at ADDR, as a
shared substring. */
- shared_macro_buffer (const char *addr, int len)
- {
- set_shared (addr, len);
- }
+ shared_macro_buffer (const char *addr, int len) { set_shared (addr, len); }
/* Set the macro buffer to refer to the LEN bytes at ADDR, as a
shared substring. */
@@ -116,10 +110,7 @@ struct growable_macro_buffer
DISABLE_COPY_AND_ASSIGN (growable_macro_buffer);
- ~growable_macro_buffer ()
- {
- xfree (text);
- }
+ ~growable_macro_buffer () { xfree (text); }
/* Release the text of the buffer to the caller. */
gdb::unique_xmalloc_ptr<char> release ()
@@ -167,38 +158,26 @@ struct growable_macro_buffer
}
};
-
-
/* Recognizing preprocessor tokens. */
-
int
macro_is_whitespace (int c)
{
- return (c == ' '
- || c == '\t'
- || c == '\n'
- || c == '\v'
- || c == '\f');
+ return (c == ' ' || c == '\t' || c == '\n' || c == '\v' || c == '\f');
}
-
int
macro_is_digit (int c)
{
return ('0' <= c && c <= '9');
}
-
int
macro_is_identifier_nondigit (int c)
{
- return (c == '_'
- || ('a' <= c && c <= 'z')
- || ('A' <= c && c <= 'Z'));
+ return (c == '_' || ('a' <= c && c <= 'z') || ('A' <= c && c <= 'Z'));
}
-
static void
set_token (shared_macro_buffer *tok, const char *start, const char *end)
{
@@ -209,33 +188,28 @@ set_token (shared_macro_buffer *tok, const char *start, const char *end)
tok->is_identifier = 0;
}
-
static int
get_comment (shared_macro_buffer *tok, const char *p, const char *end)
{
if (p + 2 > end)
return 0;
- else if (p[0] == '/'
- && p[1] == '*')
+ else if (p[0] == '/' && p[1] == '*')
{
const char *tok_start = p;
p += 2;
for (; p < end; p++)
- if (p + 2 <= end
- && p[0] == '*'
- && p[1] == '/')
+ if (p + 2 <= end && p[0] == '*' && p[1] == '/')
{
p += 2;
set_token (tok, tok_start, p);
return 1;
}
- error (_("Unterminated comment in macro expansion."));
+ error (_ ("Unterminated comment in macro expansion."));
}
- else if (p[0] == '/'
- && p[1] == '/')
+ else if (p[0] == '/' && p[1] == '/')
{
const char *tok_start = p;
@@ -251,18 +225,15 @@ get_comment (shared_macro_buffer *tok, const char *p, const char *end)
return 0;
}
-
static int
get_identifier (shared_macro_buffer *tok, const char *p, const char *end)
{
- if (p < end
- && macro_is_identifier_nondigit (*p))
+ if (p < end && macro_is_identifier_nondigit (*p))
{
const char *tok_start = p;
while (p < end
- && (macro_is_identifier_nondigit (*p)
- || macro_is_digit (*p)))
+ && (macro_is_identifier_nondigit (*p) || macro_is_digit (*p)))
p++;
set_token (tok, tok_start, p);
@@ -273,26 +244,21 @@ get_identifier (shared_macro_buffer *tok, const char *p, const char *end)
return 0;
}
-
static int
get_pp_number (shared_macro_buffer *tok, const char *p, const char *end)
{
if (p < end
&& (macro_is_digit (*p)
- || (*p == '.'
- && p + 2 <= end
- && macro_is_digit (p[1]))))
+ || (*p == '.' && p + 2 <= end && macro_is_digit (p[1]))))
{
const char *tok_start = p;
while (p < end)
{
- if (p + 2 <= end
- && strchr ("eEpP", *p)
+ if (p + 2 <= end && strchr ("eEpP", *p)
&& (p[1] == '+' || p[1] == '-'))
p += 2;
- else if (macro_is_digit (*p)
- || macro_is_identifier_nondigit (*p)
+ else if (macro_is_digit (*p) || macro_is_identifier_nondigit (*p)
|| *p == '.')
p++;
else
@@ -306,24 +272,21 @@ get_pp_number (shared_macro_buffer *tok, const char *p, const char *end)
return 0;
}
-
-
/* If the text starting at P going up to (but not including) END
starts with a character constant, set *TOK to point to that
character constant, and return 1. Otherwise, return zero.
Signal an error if it contains a malformed or incomplete character
constant. */
static int
-get_character_constant (shared_macro_buffer *tok,
- const char *p, const char *end)
+get_character_constant (shared_macro_buffer *tok, const char *p,
+ const char *end)
{
/* ISO/IEC 9899:1999 (E) Section 6.4.4.4 paragraph 1
But of course, what really matters is that we handle it the same
way GDB's C/C++ lexer does. So we call parse_escape in utils.c
to handle escape sequences. */
if ((p + 1 <= end && *p == '\'')
- || (p + 2 <= end
- && (p[0] == 'L' || p[0] == 'u' || p[0] == 'U')
+ || (p + 2 <= end && (p[0] == 'L' || p[0] == 'u' || p[0] == 'U')
&& p[1] == '\''))
{
const char *tok_start = p;
@@ -339,12 +302,12 @@ get_character_constant (shared_macro_buffer *tok,
for (;;)
{
if (p >= end)
- error (_("Unmatched single quote."));
+ error (_ ("Unmatched single quote."));
else if (*p == '\'')
{
if (!char_count)
- error (_("A character constant must contain at least one "
- "character."));
+ error (_ ("A character constant must contain at least one "
+ "character."));
p++;
break;
}
@@ -370,7 +333,6 @@ get_character_constant (shared_macro_buffer *tok,
return 0;
}
-
/* If the text starting at P going up to (but not including) END
starts with a string literal, set *TOK to point to that string
literal, and return 1. Otherwise, return zero. Signal an error if
@@ -378,10 +340,8 @@ get_character_constant (shared_macro_buffer *tok,
static int
get_string_literal (shared_macro_buffer *tok, const char *p, const char *end)
{
- if ((p + 1 <= end
- && *p == '"')
- || (p + 2 <= end
- && (p[0] == 'L' || p[0] == 'u' || p[0] == 'U')
+ if ((p + 1 <= end && *p == '"')
+ || (p + 2 <= end && (p[0] == 'L' || p[0] == 'u' || p[0] == 'U')
&& p[1] == '"'))
{
const char *tok_start = p;
@@ -396,15 +356,15 @@ get_string_literal (shared_macro_buffer *tok, const char *p, const char *end)
for (;;)
{
if (p >= end)
- error (_("Unterminated string in expression."));
+ error (_ ("Unterminated string in expression."));
else if (*p == '"')
{
p++;
break;
}
else if (*p == '\n')
- error (_("Newline characters may not appear in string "
- "constants."));
+ error (_ ("Newline characters may not appear in string "
+ "constants."));
else if (*p == '\\')
{
const char *s, *o;
@@ -424,7 +384,6 @@ get_string_literal (shared_macro_buffer *tok, const char *p, const char *end)
return 0;
}
-
static int
get_punctuator (shared_macro_buffer *tok, const char *p, const char *end)
{
@@ -434,25 +393,12 @@ get_punctuator (shared_macro_buffer *tok, const char *p, const char *end)
Note that this table is ordered in a special way. A punctuator
which is a prefix of another punctuator must appear after its
"extension". Otherwise, the wrong token will be returned. */
- static const char * const punctuators[] = {
- "[", "]", "(", ")", "{", "}", "?", ";", ",", "~",
- "...", ".",
- "->", "--", "-=", "-",
- "++", "+=", "+",
- "*=", "*",
- "!=", "!",
- "&&", "&=", "&",
- "/=", "/",
- "%>", "%:%:", "%:", "%=", "%",
- "^=", "^",
- "##", "#",
- ":>", ":",
- "||", "|=", "|",
- "<<=", "<<", "<=", "<:", "<%", "<",
- ">>=", ">>", ">=", ">",
- "==", "=",
- 0
- };
+ static const char *const punctuators[]
+ = { "[", "]", "(", ")", "{", "}", "?", ";", ",", "~", "...",
+ ".", "->", "--", "-=", "-", "++", "+=", "+", "*=", "*", "!=",
+ "!", "&&", "&=", "&", "/=", "/", "%>", "%:%:", "%:", "%=", "%",
+ "^=", "^", "##", "#", ":>", ":", "||", "|=", "|", "<<=", "<<",
+ "<=", "<:", "<%", "<", ">>=", ">>", ">=", ">", "==", "=", 0 };
int i;
@@ -466,8 +412,7 @@ get_punctuator (shared_macro_buffer *tok, const char *p, const char *end)
{
int len = strlen (punctuator);
- if (p + len <= end
- && ! memcmp (p, punctuator, len))
+ if (p + len <= end && !memcmp (p, punctuator, len))
{
set_token (tok, p, p + len);
return 1;
@@ -479,7 +424,6 @@ get_punctuator (shared_macro_buffer *tok, const char *p, const char *end)
return 0;
}
-
/* Peel the next preprocessor token off of SRC, and put it in TOK.
Mutate TOK to refer to the first token in SRC, and mutate SRC to
refer to the text after that token. The resulting TOK will point
@@ -523,8 +467,7 @@ get_token (shared_macro_buffer *tok, shared_macro_buffer *src)
we give the wide character syntax precedence. Now,
since GDB doesn't handle wide character constants
anyway, is this the right thing to do? */
- || get_identifier (tok, p, end)
- || get_punctuator (tok, p, end))
+ || get_identifier (tok, p, end) || get_punctuator (tok, p, end))
{
/* How many characters did we consume, including whitespace? */
int consumed = p - src->text + tok->len;
@@ -533,7 +476,7 @@ get_token (shared_macro_buffer *tok, shared_macro_buffer *src)
src->len -= consumed;
return 1;
}
- else
+ else
{
/* We have found a "non-whitespace character that cannot be
one of the above." Make a token out of it. */
@@ -549,11 +492,8 @@ get_token (shared_macro_buffer *tok, shared_macro_buffer *src)
return 0;
}
-
-
/* Appending token strings, with and without splicing */
-
/* Append the macro buffer SRC to the end of DEST, and ensure that
doing so doesn't splice the token at the end of SRC with the token
at the beginning of DEST. SRC and DEST must have their last_token
@@ -571,14 +511,14 @@ get_token (shared_macro_buffer *tok, shared_macro_buffer *src)
yield "< <", not "<<", etc. */
static void
append_tokens_without_splicing (growable_macro_buffer *dest,
- shared_macro_buffer *src)
+ shared_macro_buffer *src)
{
int original_dest_len = dest->len;
shared_macro_buffer dest_tail, new_token;
gdb_assert (src->last_token != -1);
gdb_assert (dest->last_token != -1);
-
+
/* First, just try appending the two, and call get_token to see if
we got a splice. */
dest->appendmem (src->text, src->len);
@@ -602,8 +542,7 @@ append_tokens_without_splicing (growable_macro_buffer *dest,
make a comment start. (Just for the record, I got this right
the first time. This is not a bug fix.) */
if (get_token (&new_token, &dest_tail)
- && (new_token.text + new_token.len
- == dest->text + original_dest_len))
+ && (new_token.text + new_token.len == dest->text + original_dest_len))
{
/* No splice, so we're done. */
dest->last_token = original_dest_len + src->last_token;
@@ -622,8 +561,7 @@ append_tokens_without_splicing (growable_macro_buffer *dest,
/* Try to re-parse DEST's last token, as above. */
if (get_token (&new_token, &dest_tail)
- && (new_token.text + new_token.len
- == dest->text + original_dest_len))
+ && (new_token.text + new_token.len == dest->text + original_dest_len))
{
/* No splice, so we're done. */
dest->last_token = original_dest_len + 1 + src->last_token;
@@ -632,7 +570,8 @@ append_tokens_without_splicing (growable_macro_buffer *dest,
/* As far as I know, there's no case where inserting a space isn't
enough to prevent a splice. */
- internal_error (_("unable to avoid splicing tokens during macro expansion"));
+ internal_error (
+ _ ("unable to avoid splicing tokens during macro expansion"));
}
/* Stringify an argument, and insert it into DEST. ARG is the text to
@@ -696,18 +635,16 @@ macro_stringify (const char *str)
return buffer.release ();
}
-
/* Expanding macros! */
-
/* A singly-linked list of the names of the macros we are currently
expanding --- for detecting expansion loops. */
-struct macro_name_list {
+struct macro_name_list
+{
const char *name;
struct macro_name_list *next;
};
-
/* Return non-zero if we are currently expanding the macro named NAME,
according to LIST; otherwise, return zero.
@@ -728,7 +665,6 @@ currently_rescanning (struct macro_name_list *list, const char *name)
return 0;
}
-
/* Gather the arguments to a macro expansion.
NAME is the name of the macro being invoked. (It's only used for
@@ -778,9 +714,7 @@ gather_arguments (const char *name, shared_macro_buffer *src, int nargs,
{
shared_macro_buffer temp (src->text, src->len);
- if (! get_token (&tok, &temp)
- || tok.len != 1
- || tok.text[0] != '(')
+ if (!get_token (&tok, &temp) || tok.len != 1 || tok.text[0] != '(')
return false;
}
@@ -801,8 +735,8 @@ gather_arguments (const char *name, shared_macro_buffer *src, int nargs,
depth = 0;
for (;;)
{
- if (! get_token (&tok, src))
- error (_("Malformed argument list for macro `%s'."), name);
+ if (!get_token (&tok, src))
+ error (_ ("Malformed argument list for macro `%s'."), name);
/* Is tok an opening paren? */
if (tok.len == 1 && tok.text[0] == '(')
@@ -857,13 +791,10 @@ gather_arguments (const char *name, shared_macro_buffer *src, int nargs,
}
}
-
/* The `expand' and `substitute_args' functions both invoke `scan'
recursively, so we need a forward declaration somewhere. */
-static void scan (growable_macro_buffer *dest,
- shared_macro_buffer *src,
- struct macro_name_list *no_loop,
- const macro_scope &scope);
+static void scan (growable_macro_buffer *dest, shared_macro_buffer *src,
+ struct macro_name_list *no_loop, const macro_scope &scope);
/* A helper function for substitute_args.
@@ -877,27 +808,26 @@ static void scan (growable_macro_buffer *dest,
index. If TOK is not an argument, return -1. */
static int
-find_parameter (const shared_macro_buffer *tok,
- int is_varargs, const shared_macro_buffer *va_arg_name,
- int argc, const char * const *argv)
+find_parameter (const shared_macro_buffer *tok, int is_varargs,
+ const shared_macro_buffer *va_arg_name, int argc,
+ const char *const *argv)
{
int i;
- if (! tok->is_identifier)
+ if (!tok->is_identifier)
return -1;
for (i = 0; i < argc; ++i)
- if (tok->len == strlen (argv[i])
- && !memcmp (tok->text, argv[i], tok->len))
+ if (tok->len == strlen (argv[i]) && !memcmp (tok->text, argv[i], tok->len))
return i;
if (is_varargs && tok->len == va_arg_name->len
- && ! memcmp (tok->text, va_arg_name->text, tok->len))
+ && !memcmp (tok->text, va_arg_name->text, tok->len))
return argc - 1;
return -1;
}
-
+
/* Helper function for substitute_args that gets the next token and
updates the passed-in state variables. */
@@ -907,8 +837,7 @@ get_next_token_for_substitution (shared_macro_buffer *replacement_list,
const char **start,
shared_macro_buffer *lookahead,
const char **lookahead_start,
- int *lookahead_valid,
- bool *keep_going)
+ int *lookahead_valid, bool *keep_going)
{
if (!*lookahead_valid)
*keep_going = false;
@@ -938,12 +867,10 @@ get_next_token_for_substitution (shared_macro_buffer *replacement_list,
NO_LOOP. */
static void
-substitute_args (growable_macro_buffer *dest,
- struct macro_definition *def,
+substitute_args (growable_macro_buffer *dest, struct macro_definition *def,
int is_varargs, const shared_macro_buffer *va_arg_name,
const std::vector<shared_macro_buffer> &argv,
- struct macro_name_list *no_loop,
- const macro_scope &scope)
+ struct macro_name_list *no_loop, const macro_scope &scope)
{
/* The token we are currently considering. */
shared_macro_buffer tok;
@@ -965,7 +892,7 @@ substitute_args (growable_macro_buffer *dest,
dest->last_token = 0;
original_rl_start = replacement_list.text;
- if (! get_token (&tok, &replacement_list))
+ if (!get_token (&tok, &replacement_list))
return;
lookahead_rl_start = replacement_list.text;
lookahead_valid = get_token (&lookahead, &replacement_list);
@@ -976,23 +903,17 @@ substitute_args (growable_macro_buffer *dest,
>= 2 in __VA_OPT__, the value encodes the parenthesis depth. */
unsigned vaopt_state = 0;
- for (bool keep_going = true;
- keep_going;
- get_next_token_for_substitution (&replacement_list,
- &tok,
- &original_rl_start,
- &lookahead,
- &lookahead_rl_start,
- &lookahead_valid,
- &keep_going))
+ for (bool keep_going = true; keep_going; get_next_token_for_substitution (
+ &replacement_list, &tok, &original_rl_start, &lookahead,
+ &lookahead_rl_start, &lookahead_valid, &keep_going))
{
- bool token_is_vaopt = (tok.len == 10
- && startswith (tok.text, "__VA_OPT__"));
+ bool token_is_vaopt
+ = (tok.len == 10 && startswith (tok.text, "__VA_OPT__"));
if (vaopt_state > 0)
{
if (token_is_vaopt)
- error (_("__VA_OPT__ cannot appear inside __VA_OPT__"));
+ error (_ ("__VA_OPT__ cannot appear inside __VA_OPT__"));
else if (tok.len == 1 && tok.text[0] == '(')
{
++vaopt_state;
@@ -1001,7 +922,7 @@ substitute_args (growable_macro_buffer *dest,
continue;
}
else if (vaopt_state == 1)
- error (_("__VA_OPT__ must be followed by an open parenthesis"));
+ error (_ ("__VA_OPT__ must be followed by an open parenthesis"));
else if (tok.len == 1 && tok.text[0] == ')')
{
--vaopt_state;
@@ -1022,7 +943,7 @@ substitute_args (growable_macro_buffer *dest,
else if (token_is_vaopt)
{
if (!is_varargs)
- error (_("__VA_OPT__ is only valid in a variadic macro"));
+ error (_ ("__VA_OPT__ is only valid in a variadic macro"));
vaopt_state = 1;
/* Don't emit this token. */
continue;
@@ -1037,19 +958,18 @@ substitute_args (growable_macro_buffer *dest,
}
/* Is this token the stringification operator? */
- if (tok.len == 1
- && tok.text[0] == '#')
+ if (tok.len == 1 && tok.text[0] == '#')
{
int arg;
if (!lookahead_valid)
- error (_("Stringification operator requires an argument."));
+ error (_ ("Stringification operator requires an argument."));
- arg = find_parameter (&lookahead, is_varargs, va_arg_name,
- def->argc, def->argv);
+ arg = find_parameter (&lookahead, is_varargs, va_arg_name, def->argc,
+ def->argv);
if (arg == -1)
- error (_("Argument to stringification operator must name "
- "a macro parameter."));
+ error (_ ("Argument to stringification operator must name "
+ "a macro parameter."));
stringify (dest, argv[arg].text, argv[arg].len);
@@ -1059,15 +979,11 @@ substitute_args (growable_macro_buffer *dest,
lookahead_valid = get_token (&lookahead, &replacement_list);
}
/* Is this token the splicing operator? */
- else if (tok.len == 2
- && tok.text[0] == '#'
- && tok.text[1] == '#')
- error (_("Stray splicing operator"));
+ else if (tok.len == 2 && tok.text[0] == '#' && tok.text[1] == '#')
+ error (_ ("Stray splicing operator"));
/* Is the next token the splicing operator? */
- else if (lookahead_valid
- && lookahead.len == 2
- && lookahead.text[0] == '#'
- && lookahead.text[1] == '#')
+ else if (lookahead_valid && lookahead.len == 2
+ && lookahead.text[0] == '#' && lookahead.text[1] == '#')
{
int finished = 0;
int prev_was_comma = 0;
@@ -1093,8 +1009,8 @@ substitute_args (growable_macro_buffer *dest,
/* Apply a possible sequence of ## operators. */
for (;;)
{
- if (! get_token (&tok, &replacement_list))
- error (_("Splicing operator at end of macro"));
+ if (!get_token (&tok, &replacement_list))
+ error (_ ("Splicing operator at end of macro"));
/* Handle a comma before a ##. If we are handling
varargs, and the token on the right hand side is the
@@ -1107,10 +1023,9 @@ substitute_args (growable_macro_buffer *dest,
simply insert the comma. */
if (prev_was_comma)
{
- if (! (is_varargs
- && tok.len == va_arg_name->len
- && !memcmp (tok.text, va_arg_name->text, tok.len)
- && argv.back ().len == 0))
+ if (!(is_varargs && tok.len == va_arg_name->len
+ && !memcmp (tok.text, va_arg_name->text, tok.len)
+ && argv.back ().len == 0))
dest->appendmem (",", 1);
prev_was_comma = 0;
}
@@ -1133,15 +1048,13 @@ substitute_args (growable_macro_buffer *dest,
/* Now read another token. If it is another splice, we
loop. */
original_rl_start = replacement_list.text;
- if (! get_token (&tok, &replacement_list))
+ if (!get_token (&tok, &replacement_list))
{
finished = 1;
break;
}
- if (! (tok.len == 2
- && tok.text[0] == '#'
- && tok.text[1] == '#'))
+ if (!(tok.len == 2 && tok.text[0] == '#' && tok.text[1] == '#'))
break;
}
@@ -1166,8 +1079,8 @@ substitute_args (growable_macro_buffer *dest,
{
/* Is this token an identifier? */
int substituted = 0;
- int arg = find_parameter (&tok, is_varargs, va_arg_name,
- def->argc, def->argv);
+ int arg = find_parameter (&tok, is_varargs, va_arg_name, def->argc,
+ def->argv);
if (arg != -1)
{
@@ -1182,16 +1095,15 @@ substitute_args (growable_macro_buffer *dest,
}
/* If it wasn't a parameter, then just copy it across. */
- if (! substituted)
+ if (!substituted)
append_tokens_without_splicing (dest, &tok);
}
}
if (vaopt_state > 0)
- error (_("Unterminated __VA_OPT__"));
+ error (_ ("Unterminated __VA_OPT__"));
}
-
/* Expand a call to a macro named ID, whose definition is DEF. Append
its expansion to DEST. SRC is the input text following the ID
token. We are currently rescanning the expansions of the macros
@@ -1202,12 +1114,9 @@ substitute_args (growable_macro_buffer *dest,
function-like macro name that isn't followed by an argument list,
we don't expand it.) If we return zero, leave SRC unchanged. */
static int
-expand (const char *id,
- struct macro_definition *def,
- growable_macro_buffer *dest,
- shared_macro_buffer *src,
- struct macro_name_list *no_loop,
- const macro_scope &scope)
+expand (const char *id, struct macro_definition *def,
+ growable_macro_buffer *dest, shared_macro_buffer *src,
+ struct macro_name_list *no_loop, const macro_scope &scope)
{
struct macro_name_list new_no_loop;
@@ -1261,8 +1170,7 @@ expand (const char *id,
std::vector<shared_macro_buffer> argv;
/* If we couldn't find any argument list, then we don't expand
this macro. */
- if (!gather_arguments (id, src, is_varargs ? def->argc : -1,
- &argv))
+ if (!gather_arguments (id, src, is_varargs ? def->argc : -1, &argv))
return 0;
/* Check that we're passing an acceptable number of arguments for
@@ -1276,11 +1184,9 @@ expand (const char *id,
/* Remember that a sequence of tokens like "foo()" is a
valid invocation of a macro expecting either zero or one
arguments. */
- else if (! (argv.size () == 1
- && argv[0].len == 0
- && def->argc == 0))
- error (_("Wrong number of arguments to macro `%s' "
- "(expected %d, got %d)."),
+ else if (!(argv.size () == 1 && argv[0].len == 0 && def->argc == 0))
+ error (_ ("Wrong number of arguments to macro `%s' "
+ "(expected %d, got %d)."),
id, def->argc, int (argv.size ()));
}
@@ -1291,8 +1197,8 @@ expand (const char *id,
so we can't really tell whether it's appropriate to macro-
expand an argument until we see how it's being used. */
growable_macro_buffer substituted (0);
- substitute_args (&substituted, def, is_varargs, &va_arg_name,
- argv, no_loop, scope);
+ substitute_args (&substituted, def, is_varargs, &va_arg_name, argv,
+ no_loop, scope);
/* Now `substituted' is the macro's replacement list, with all
argument values substituted into it properly. Re-scan it for
@@ -1310,10 +1216,9 @@ expand (const char *id,
return 1;
}
else
- internal_error (_("bad macro definition kind"));
+ internal_error (_ ("bad macro definition kind"));
}
-
/* If the single token in SRC_FIRST followed by the tokens in SRC_REST
constitute a macro invocation not forbidden in NO_LOOP, append its
expansion to DEST and return non-zero. Otherwise, return zero, and
@@ -1321,10 +1226,8 @@ expand (const char *id,
SRC_FIRST must be a string built by get_token. */
static int
-maybe_expand (growable_macro_buffer *dest,
- shared_macro_buffer *src_first,
- shared_macro_buffer *src_rest,
- struct macro_name_list *no_loop,
+maybe_expand (growable_macro_buffer *dest, shared_macro_buffer *src_first,
+ shared_macro_buffer *src_rest, struct macro_name_list *no_loop,
const macro_scope &scope)
{
/* Is this token an identifier? */
@@ -1336,7 +1239,7 @@ maybe_expand (growable_macro_buffer *dest,
/* If we're currently re-scanning the result of expanding
this macro, don't expand it again. */
- if (! currently_rescanning (no_loop, id.c_str ()))
+ if (!currently_rescanning (no_loop, id.c_str ()))
{
/* Does this identifier have a macro definition in scope? */
macro_definition *def = standard_macro_lookup (id.c_str (), scope);
@@ -1349,25 +1252,21 @@ maybe_expand (growable_macro_buffer *dest,
return 0;
}
-
/* Expand macro references in SRC, appending the results to DEST.
Assume we are re-scanning the result of expanding the macros named
in NO_LOOP, and don't try to re-expand references to them. */
static void
-scan (growable_macro_buffer *dest,
- shared_macro_buffer *src,
- struct macro_name_list *no_loop,
- const macro_scope &scope)
+scan (growable_macro_buffer *dest, shared_macro_buffer *src,
+ struct macro_name_list *no_loop, const macro_scope &scope)
{
-
for (;;)
{
shared_macro_buffer tok;
const char *original_src_start = src->text;
/* Find the next token in SRC. */
- if (! get_token (&tok, src))
+ if (!get_token (&tok, src))
break;
/* Just for aesthetics. If we skipped some whitespace, copy
@@ -1378,7 +1277,7 @@ scan (growable_macro_buffer *dest,
dest->last_token = dest->len;
}
- if (! maybe_expand (dest, &tok, src, no_loop, scope))
+ if (!maybe_expand (dest, &tok, src, no_loop, scope))
/* We didn't end up expanding tok as a macro reference, so
simply append it to dest. */
append_tokens_without_splicing (dest, &tok);
@@ -1393,7 +1292,6 @@ scan (growable_macro_buffer *dest,
}
}
-
gdb::unique_xmalloc_ptr<char>
macro_expand (const char *source, const macro_scope &scope)
{
@@ -1409,11 +1307,10 @@ macro_expand (const char *source, const macro_scope &scope)
return dest.release ();
}
-
gdb::unique_xmalloc_ptr<char>
macro_expand_once (const char *source, const macro_scope &scope)
{
- error (_("Expand-once not implemented yet."));
+ error (_ ("Expand-once not implemented yet."));
}
gdb::unique_xmalloc_ptr<char>
@@ -1429,7 +1326,7 @@ macro_expand_next (const char **lexptr, const macro_scope &scope)
dest.last_token = 0;
/* Get the text's first preprocessing token. */
- if (! get_token (&tok, &src))
+ if (!get_token (&tok, &src))
return nullptr;
/* If it's a macro invocation, expand it. */
diff --git a/gdb/macroexp.h b/gdb/macroexp.h
index 87ee9bbb1ef..042610d29f4 100644
--- a/gdb/macroexp.h
+++ b/gdb/macroexp.h
@@ -17,7 +17,6 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
-
#ifndef MACROEXP_H
#define MACROEXP_H
@@ -77,7 +76,6 @@ int macro_is_whitespace (int c);
int macro_is_identifier_nondigit (int c);
int macro_is_digit (int c);
-
/* Stringify STR according to C rules and return a null-terminated string. */
gdb::unique_xmalloc_ptr<char> macro_stringify (const char *str);
diff --git a/gdb/macroscope.c b/gdb/macroscope.c
index 1b542eeb7d5..84a3a78c1c7 100644
--- a/gdb/macroscope.c
+++ b/gdb/macroscope.c
@@ -34,7 +34,6 @@
things. */
struct macro_table *macro_user_macros;
-
gdb::unique_xmalloc_ptr<struct macro_scope>
sal_macro_scope (struct symtab_and_line sal)
{
@@ -77,15 +76,15 @@ sal_macro_scope (struct symtab_and_line sal)
ms->file = main_file;
ms->line = -1;
- complaint (_("symtab found for `%s', but that file\n"
- "is not covered in the compilation unit's macro information"),
- symtab_to_filename_for_display (sal.symtab));
+ complaint (
+ _ ("symtab found for `%s', but that file\n"
+ "is not covered in the compilation unit's macro information"),
+ symtab_to_filename_for_display (sal.symtab));
}
return ms;
}
-
gdb::unique_xmalloc_ptr<struct macro_scope>
user_macro_scope (void)
{
@@ -122,21 +121,19 @@ default_macro_scope (void)
symbol files loaded, then get_current_or_default would raise an
error. But `set width' shouldn't raise an error just because
it can't decide which scope to macro-expand its argument in. */
- struct symtab_and_line cursal
- = get_current_source_symtab_and_line ();
-
+ struct symtab_and_line cursal = get_current_source_symtab_and_line ();
+
sal.symtab = cursal.symtab;
sal.line = cursal.line;
}
ms = sal_macro_scope (sal);
- if (! ms)
+ if (!ms)
ms = user_macro_scope ();
return ms;
}
-
/* Look up the definition of the macro named NAME in scope at the source
location given by BATON, which must be a pointer to a `struct
macro_scope' structure. */
@@ -154,6 +151,7 @@ standard_macro_lookup (const char *name, const macro_scope &ms)
}
void _initialize_macroscope ();
+
void
_initialize_macroscope ()
{
diff --git a/gdb/macroscope.h b/gdb/macroscope.h
index ad9eddf1e7d..c2593c5eb89 100644
--- a/gdb/macroscope.h
+++ b/gdb/macroscope.h
@@ -23,25 +23,23 @@
#include "macrotab.h"
#include "symtab.h"
-
/* The table of macros defined by the user. */
extern struct macro_table *macro_user_macros;
/* All the information we need to decide which macro definitions are
in scope: a source file (either a main source file or an
#inclusion), and a line number in that file. */
-struct macro_scope {
+struct macro_scope
+{
struct macro_source_file *file;
int line;
};
-
/* Return a `struct macro_scope' object corresponding to the symtab
and line given in SAL. If we have no macro information for that
location, or if SAL's pc is zero, return zero. */
-gdb::unique_xmalloc_ptr<struct macro_scope> sal_macro_scope
- (struct symtab_and_line sal);
-
+gdb::unique_xmalloc_ptr<struct macro_scope>
+sal_macro_scope (struct symtab_and_line sal);
/* Return a `struct macro_scope' object representing just the
user-defined macros. */
diff --git a/gdb/macrotab.c b/gdb/macrotab.c
index 52fc7215e4b..9811e1c8558 100644
--- a/gdb/macrotab.c
+++ b/gdb/macrotab.c
@@ -30,7 +30,6 @@
#include "complaints.h"
#include "macroexp.h"
-
/* The macro table structure. */
struct macro_table
@@ -76,8 +75,6 @@ struct macro_table
splay_tree definitions;
};
-
-
/* Allocation and freeing functions. */
/* Allocate SIZE bytes of memory appropriately for the macro table T.
@@ -92,7 +89,6 @@ macro_alloc (int size, struct macro_table *t)
return xmalloc (size);
}
-
static void
macro_free (void *object, struct macro_table *t)
{
@@ -106,7 +102,6 @@ macro_free (void *object, struct macro_table *t)
xfree (object);
}
-
/* If the macro table T has a bcache, then cache the LEN bytes at ADDR
there, and return the cached copy. Otherwise, just xmalloc a copy
of the bytes, and return a pointer to that. */
@@ -124,7 +119,6 @@ macro_bcache (struct macro_table *t, const void *addr, int len)
}
}
-
/* If the macro table T has a bcache, cache the null-terminated string
S there, and return a pointer to the cached copy. Otherwise,
xmalloc a copy and return that. */
@@ -134,7 +128,6 @@ macro_bcache_str (struct macro_table *t, const char *s)
return (const char *) macro_bcache (t, s, strlen (s) + 1);
}
-
/* Free a possibly bcached object OBJ. That is, if the macro table T
has a bcache, do nothing; otherwise, xfree OBJ. */
static void
@@ -150,8 +143,6 @@ macro_bcache_free (struct macro_table *t, void *obj)
xfree (obj);
}
-
-
/* Macro tree keys, w/their comparison, allocation, and freeing functions. */
/* A key in the splay tree. */
@@ -180,7 +171,6 @@ struct macro_key
int end_line;
};
-
/* Return the #inclusion depth of the source file FILE. This is the
number of #inclusions it took to reach this file. For the main
source file, the #inclusion depth is zero; for a file it #includes
@@ -196,7 +186,6 @@ inclusion_depth (struct macro_source_file *file)
return depth;
}
-
/* Compare two source locations (from the same compilation unit).
This is part of the comparison function for the tree of
definitions.
@@ -213,7 +202,7 @@ inclusion_depth (struct macro_source_file *file)
sources, where all the #included files have been substituted into
their places. */
static int
-compare_locations (struct macro_source_file *file1, int line1,
+compare_locations (struct macro_source_file *file1, int line1,
struct macro_source_file *file2, int line2)
{
/* We want to treat positions in an #included file as coming *after*
@@ -227,14 +216,14 @@ compare_locations (struct macro_source_file *file1, int line1,
/* If a file is zero, that means "end of compilation unit." Handle
that specially. */
- if (! file1)
+ if (!file1)
{
- if (! file2)
+ if (!file2)
return 0;
else
return 1;
}
- else if (! file2)
+ else if (!file2)
return -1;
/* If the two files are not the same, find their common ancestor in
@@ -292,7 +281,7 @@ compare_locations (struct macro_source_file *file1, int line1,
{
/* They can't both be from #included files. Then we shouldn't
have walked up this far. */
- gdb_assert (! included1 || ! included2);
+ gdb_assert (!included1 || !included2);
/* Any #included position comes after a non-#included position
with the same line number in the #including file. */
@@ -307,7 +296,6 @@ compare_locations (struct macro_source_file *file1, int line1,
return line1 - line2;
}
-
/* Compare a macro key KEY against NAME, the source file FILE, and
line number LINE.
@@ -318,24 +306,21 @@ compare_locations (struct macro_source_file *file1, int line1,
Return -1, 0, or 1 if key comes before, is identical to, or comes
after NAME, FILE, and LINE. */
static int
-key_compare (struct macro_key *key,
- const char *name, struct macro_source_file *file, int line)
+key_compare (struct macro_key *key, const char *name,
+ struct macro_source_file *file, int line)
{
int names = strcmp (key->name, name);
if (names)
return names;
- return compare_locations (key->start_file, key->start_line,
- file, line);
+ return compare_locations (key->start_file, key->start_line, file, line);
}
-
/* The macro tree comparison function, typed for the splay tree
library's happiness. */
static int
-macro_tree_compare (splay_tree_key untyped_key1,
- splay_tree_key untyped_key2)
+macro_tree_compare (splay_tree_key untyped_key1, splay_tree_key untyped_key2)
{
struct macro_key *key1 = (struct macro_key *) untyped_key1;
struct macro_key *key2 = (struct macro_key *) untyped_key2;
@@ -343,15 +328,12 @@ macro_tree_compare (splay_tree_key untyped_key1,
return key_compare (key1, key2->name, key2->start_file, key2->start_line);
}
-
/* Construct a new macro key node for a macro in table T whose name is
NAME, and whose scope starts at LINE in FILE; register the name in
the bcache. */
static struct macro_key *
-new_macro_key (struct macro_table *t,
- const char *name,
- struct macro_source_file *file,
- int line)
+new_macro_key (struct macro_table *t, const char *name,
+ struct macro_source_file *file, int line)
{
struct macro_key *k = (struct macro_key *) macro_alloc (sizeof (*k), t);
@@ -365,7 +347,6 @@ new_macro_key (struct macro_table *t,
return k;
}
-
static void
macro_tree_delete_key (void *untyped_key)
{
@@ -375,15 +356,11 @@ macro_tree_delete_key (void *untyped_key)
macro_free (key, key->table);
}
-
-
/* Building and querying the tree of #included files. */
-
/* Allocate and initialize a new source file structure. */
static struct macro_source_file *
-new_source_file (struct macro_table *t,
- const char *filename)
+new_source_file (struct macro_table *t, const char *filename)
{
/* Get space for the source file structure itself. */
struct macro_source_file *f
@@ -397,7 +374,6 @@ new_source_file (struct macro_table *t,
return f;
}
-
/* Free a source file, and all the source files it #included. */
static void
free_macro_source_file (struct macro_source_file *src)
@@ -415,21 +391,18 @@ free_macro_source_file (struct macro_source_file *src)
macro_free (src, src->table);
}
-
struct macro_source_file *
-macro_set_main (struct macro_table *t,
- const char *filename)
+macro_set_main (struct macro_table *t, const char *filename)
{
/* You can't change a table's main source file. What would that do
to the tree? */
- gdb_assert (! t->main_source);
+ gdb_assert (!t->main_source);
t->main_source = new_source_file (t, filename);
return t->main_source;
}
-
struct macro_source_file *
macro_main (struct macro_table *t)
{
@@ -438,18 +411,15 @@ macro_main (struct macro_table *t)
return t->main_source;
}
-
void
macro_allow_redefinitions (struct macro_table *t)
{
- gdb_assert (! t->obstack);
+ gdb_assert (!t->obstack);
t->redef_ok = 1;
}
-
struct macro_source_file *
-macro_include (struct macro_source_file *source,
- int line,
+macro_include (struct macro_source_file *source, int line,
const char *included)
{
struct macro_source_file *newobj;
@@ -458,8 +428,7 @@ macro_include (struct macro_source_file *source,
/* Find the right position in SOURCE's `includes' list for the new
file. Skip inclusions at earlier lines, until we find one at the
same line or later --- or until the end of the list. */
- for (link = &source->includes;
- *link && (*link)->included_at_line < line;
+ for (link = &source->includes; *link && (*link)->included_at_line < line;
link = &(*link)->next_included)
;
@@ -477,7 +446,7 @@ macro_include (struct macro_source_file *source,
std::string link_fullname = macro_source_fullname (*link);
std::string source_fullname = macro_source_fullname (source);
- complaint (_("both `%s' and `%s' allegedly #included at %s:%d"),
+ complaint (_ ("both `%s' and `%s' allegedly #included at %s:%d"),
included, link_fullname.c_str (), source_fullname.c_str (),
line);
@@ -503,7 +472,6 @@ macro_include (struct macro_source_file *source,
return newobj;
}
-
struct macro_source_file *
macro_lookup_inclusion (struct macro_source_file *source, const char *name)
{
@@ -526,7 +494,7 @@ macro_lookup_inclusion (struct macro_source_file *source, const char *name)
{
int result_depth = inclusion_depth (result);
- if (! best || result_depth < best_depth)
+ if (!best || result_depth < best_depth)
{
best = result;
best_depth = result_depth;
@@ -538,18 +506,13 @@ macro_lookup_inclusion (struct macro_source_file *source, const char *name)
}
}
-
-
/* Registering and looking up macro definitions. */
-
/* Construct a definition for a macro in table T. Cache all strings,
and the macro_definition structure itself, in T's bcache. */
static struct macro_definition *
-new_macro_definition (struct macro_table *t,
- enum macro_kind kind,
- int argc, const char **argv,
- const char *replacement)
+new_macro_definition (struct macro_table *t, enum macro_kind kind, int argc,
+ const char **argv, const char *replacement)
{
struct macro_definition *d
= (struct macro_definition *) macro_alloc (sizeof (*d), t);
@@ -572,8 +535,8 @@ new_macro_definition (struct macro_table *t,
cached_argv[i] = macro_bcache_str (t, argv[i]);
/* Now bcache the array of argument pointers itself. */
- d->argv = ((const char * const *)
- macro_bcache (t, cached_argv, cached_argv_size));
+ d->argv = ((const char *const *) macro_bcache (t, cached_argv,
+ cached_argv_size));
}
/* We don't bcache the entire definition structure because it's got
@@ -596,7 +559,6 @@ new_macro_definition (struct macro_table *t,
return d;
}
-
/* Free a macro definition. */
static void
macro_tree_delete_value (void *untyped_definition)
@@ -612,18 +574,15 @@ macro_tree_delete_value (void *untyped_definition)
macro_bcache_free (t, (char *) d->argv[i]);
macro_bcache_free (t, (char **) d->argv);
}
-
+
macro_bcache_free (t, (char *) d->replacement);
macro_free (d, t);
}
-
/* Find the splay tree node for the definition of NAME at LINE in
SOURCE, or zero if there is none. */
static splay_tree_node
-find_definition (const char *name,
- struct macro_source_file *file,
- int line)
+find_definition (const char *name, struct macro_source_file *file, int line)
{
struct macro_table *t = file->table;
splay_tree_node n;
@@ -637,7 +596,7 @@ find_definition (const char *name,
query.end_file = NULL;
n = splay_tree_lookup (t->definitions, (splay_tree_key) &query);
- if (! n)
+ if (!n)
{
/* It's okay for us to do two queries like this: the real work
of the searching is done when we splay, and splaying the tree
@@ -645,9 +604,9 @@ find_definition (const char *name,
If this still bugs you, you could always just extend the
splay tree library with a predecessor-or-equal operation, and
use that. */
- splay_tree_node pred = splay_tree_predecessor (t->definitions,
- (splay_tree_key) &query);
-
+ splay_tree_node pred
+ = splay_tree_predecessor (t->definitions, (splay_tree_key) &query);
+
if (pred)
{
/* Make sure this predecessor actually has the right name.
@@ -675,7 +634,6 @@ find_definition (const char *name,
return 0;
}
-
/* If NAME already has a definition in scope at LINE in SOURCE, return
the key. If the old definition is different from the definition
given by KIND, ARGC, ARGV, and REPLACEMENT, complain, too.
@@ -683,9 +641,8 @@ find_definition (const char *name,
is `macro_function_like'.) */
static struct macro_key *
check_for_redefinition (struct macro_source_file *source, int line,
- const char *name, enum macro_kind kind,
- int argc, const char **argv,
- const char *replacement)
+ const char *name, enum macro_kind kind, int argc,
+ const char **argv, const char *replacement)
{
splay_tree_node n = find_definition (name, source, line);
@@ -721,16 +678,15 @@ check_for_redefinition (struct macro_source_file *source, int line,
}
}
- if (! same)
+ if (!same)
{
std::string source_fullname = macro_source_fullname (source);
std::string found_key_fullname
= macro_source_fullname (found_key->start_file);
- complaint (_("macro `%s' redefined at %s:%d; "
- "original definition at %s:%d"),
+ complaint (_ ("macro `%s' redefined at %s:%d; "
+ "original definition at %s:%d"),
name, source_fullname.c_str (), line,
- found_key_fullname.c_str (),
- found_key->start_line);
+ found_key_fullname.c_str (), found_key->start_line);
}
return found_key;
@@ -747,18 +703,15 @@ check_for_redefinition (struct macro_source_file *source, int line,
static void
macro_define_internal (struct macro_source_file *source, int line,
- const char *name, enum macro_kind kind,
- int argc, const char **argv,
- const char *replacement)
+ const char *name, enum macro_kind kind, int argc,
+ const char **argv, const char *replacement)
{
struct macro_table *t = source->table;
struct macro_key *k = NULL;
struct macro_definition *d;
- if (! t->redef_ok)
- k = check_for_redefinition (source, line,
- name, kind,
- argc, argv,
+ if (!t->redef_ok)
+ k = check_for_redefinition (source, line, name, kind, argc, argv,
replacement);
/* If we're redefining a symbol, and the existing key would be
@@ -771,7 +724,7 @@ macro_define_internal (struct macro_source_file *source, int line,
case I know of where this arises is in GCC's output for
predefined macros, and all the definitions are the same in that
case. */
- if (k && ! key_compare (k, name, source, line))
+ if (k && !key_compare (k, name, source, line))
return;
k = new_macro_key (t, name, source, line);
@@ -786,10 +739,8 @@ macro_define_object_internal (struct macro_source_file *source, int line,
const char *name, const char *replacement,
enum macro_special_kind special_kind)
{
- macro_define_internal (source, line,
- name, macro_object_like,
- special_kind, NULL,
- replacement);
+ macro_define_internal (source, line, name, macro_object_like, special_kind,
+ NULL, replacement);
}
void
@@ -816,15 +767,12 @@ macro_define_function (struct macro_source_file *source, int line,
const char *name, int argc, const char **argv,
const char *replacement)
{
- macro_define_internal (source, line,
- name, macro_function_like,
- argc, argv,
+ macro_define_internal (source, line, name, macro_function_like, argc, argv,
replacement);
}
void
-macro_undef (struct macro_source_file *source, int line,
- const char *name)
+macro_undef (struct macro_source_file *source, int line, const char *name)
{
splay_tree_node n = find_definition (name, source, line);
@@ -836,8 +784,7 @@ macro_undef (struct macro_source_file *source, int line,
we defined it, then just delete the entry altogether. GCC
4.1.2 will generate DWARF that says to do this if you pass it
arguments like '-DFOO -UFOO -DFOO=2'. */
- if (source == key->start_file
- && line == key->start_line)
+ if (source == key->start_file && line == key->start_line)
splay_tree_remove (source->table->definitions, n->key);
else
@@ -852,11 +799,10 @@ macro_undef (struct macro_source_file *source, int line,
{
std::string source_fullname = macro_source_fullname (source);
std::string key_fullname = macro_source_fullname (key->end_file);
- complaint (_("macro '%s' is #undefined twice,"
- " at %s:%d and %s:%d"),
+ complaint (_ ("macro '%s' is #undefined twice,"
+ " at %s:%d and %s:%d"),
name, source_fullname.c_str (), line,
- key_fullname.c_str (),
- key->end_line);
+ key_fullname.c_str (), key->end_line);
}
/* Whether or not we've seen a prior #undefinition, wipe out
@@ -903,8 +849,8 @@ fixup_definition (const char *filename, int line, struct macro_definition *def)
}
struct macro_definition *
-macro_lookup_definition (struct macro_source_file *source,
- int line, const char *name)
+macro_lookup_definition (struct macro_source_file *source, int line,
+ const char *name)
{
splay_tree_node n = find_definition (name, source, line);
@@ -918,12 +864,9 @@ macro_lookup_definition (struct macro_source_file *source,
return 0;
}
-
struct macro_source_file *
-macro_definition_location (struct macro_source_file *source,
- int line,
- const char *name,
- int *definition_line)
+macro_definition_location (struct macro_source_file *source, int line,
+ const char *name, int *definition_line)
{
splay_tree_node n = find_definition (name, source, line);
@@ -938,7 +881,6 @@ macro_definition_location (struct macro_source_file *source,
return 0;
}
-
/* The type for callback data for iterating the splay tree in
macro_for_each and macro_for_each_in_scope. Only the latter uses
the FILE and LINE fields. */
@@ -991,11 +933,13 @@ foreach_macro_in_scope (splay_tree_node node, void *info)
/* See if this macro is defined before the passed-in line, and
extends past that line. */
- if (compare_locations (key->start_file, key->start_line,
- datum->file, datum->line) < 0
+ if (compare_locations (key->start_file, key->start_line, datum->file,
+ datum->line)
+ < 0
&& (!key->end_file
- || compare_locations (key->end_file, key->end_line,
- datum->file, datum->line) >= 0))
+ || compare_locations (key->end_file, key->end_line, datum->file,
+ datum->line)
+ >= 0))
datum->fn (key->name, def, key->start_file, key->start_line);
return 0;
}
@@ -1010,15 +954,12 @@ macro_for_each_in_scope (struct macro_source_file *file, int line,
datum.fn = fn;
datum.file = file;
datum.line = line;
- splay_tree_foreach (file->table->definitions,
- foreach_macro_in_scope, &datum);
+ splay_tree_foreach (file->table->definitions, foreach_macro_in_scope,
+ &datum);
}
-
-
/* Creating and freeing macro tables. */
-
struct macro_table *
new_macro_table (struct obstack *obstack, gdb::bcache *b,
struct compunit_symtab *cust)
@@ -1037,18 +978,15 @@ new_macro_table (struct obstack *obstack, gdb::bcache *b,
t->main_source = NULL;
t->compunit_symtab = cust;
t->redef_ok = 0;
- t->definitions = (splay_tree_new_with_allocator
- (macro_tree_compare,
- ((splay_tree_delete_key_fn) macro_tree_delete_key),
- ((splay_tree_delete_value_fn) macro_tree_delete_value),
- ((splay_tree_allocate_fn) macro_alloc),
- ((splay_tree_deallocate_fn) macro_free),
- t));
-
+ t->definitions = (splay_tree_new_with_allocator (
+ macro_tree_compare, ((splay_tree_delete_key_fn) macro_tree_delete_key),
+ ((splay_tree_delete_value_fn) macro_tree_delete_value),
+ ((splay_tree_allocate_fn) macro_alloc),
+ ((splay_tree_deallocate_fn) macro_free), t));
+
return t;
}
-
void
free_macro_table (struct macro_table *table)
{
diff --git a/gdb/macrotab.h b/gdb/macrotab.h
index ee73613c80d..00a421c05e8 100644
--- a/gdb/macrotab.h
+++ b/gdb/macrotab.h
@@ -25,7 +25,8 @@
struct obstack;
struct compunit_symtab;
-namespace gdb {
+namespace gdb
+{
struct bcache;
}
@@ -74,7 +75,6 @@ struct bcache;
In this interface, the first line of a file is numbered 1, not 0.
This is the same convention the rest of GDB uses. */
-
/* A table of all the macro definitions for a given compilation unit. */
struct macro_table;
@@ -126,7 +126,6 @@ struct macro_definition;
struct macro_source_file
{
-
/* The macro table for the compilation unit this source location is
a part of. */
struct macro_table *table;
@@ -155,7 +154,6 @@ struct macro_source_file
struct macro_source_file *next_included;
};
-
/* Create a new, empty macro table. Allocate it in OBSTACK, or use
xmalloc if OBSTACK is zero. Use BCACHE to store all macro names,
arguments, definitions, and anything else that might be the same
@@ -176,13 +174,11 @@ struct macro_table *new_macro_table (struct obstack *obstack,
gdb::bcache *bcache,
struct compunit_symtab *cust);
-
/* Free TABLE, and any macro definitions, source file structures,
etc. it owns. This will raise an internal error if TABLE was
allocated on an obstack, or if it uses a bcache. */
void free_macro_table (struct macro_table *table);
-
/* Set FILENAME as the main source file of TABLE. Return a source
file structure describing that file; if we record the #definition
of macros, or the #inclusion of other files into FILENAME, we'll
@@ -197,7 +193,6 @@ void free_macro_table (struct macro_table *table);
struct macro_source_file *macro_set_main (struct macro_table *table,
const char *filename);
-
/* Return the main source file of the macro table TABLE. */
struct macro_source_file *macro_main (struct macro_table *table);
@@ -206,7 +201,6 @@ struct macro_source_file *macro_main (struct macro_table *table);
TABLE is allocated on an obstack. */
void macro_allow_redefinitions (struct macro_table *table);
-
/* Record a #inclusion.
Record in SOURCE's macro table that, at line number LINE in SOURCE,
we #included the file INCLUDED. Return a source file structure we
@@ -219,8 +213,7 @@ void macro_allow_redefinitions (struct macro_table *table);
The macro table makes its own copy of INCLUDED; the caller is
responsible for freeing INCLUDED when it is no longer needed. */
struct macro_source_file *macro_include (struct macro_source_file *source,
- int line,
- const char *included);
+ int line, const char *included);
/* Define any special macros, like __FILE__ or __LINE__. This should
be called once, on the main source file. */
@@ -233,10 +226,8 @@ void macro_define_special (struct macro_table *table);
path. e.g., `stdio.h', not `/usr/include/stdio.h'. If NAME
appears more than once in the inclusion tree, return the
least-nested inclusion --- the one closest to the main source file. */
-struct macro_source_file *macro_lookup_inclusion
- (struct macro_source_file *source,
- const char *name);
-
+struct macro_source_file *
+macro_lookup_inclusion (struct macro_source_file *source, const char *name);
/* Record an object-like #definition (i.e., one with no parameter list).
Record in SOURCE's macro table that, at line number LINE in SOURCE,
@@ -246,7 +237,6 @@ struct macro_source_file *macro_lookup_inclusion
void macro_define_object (struct macro_source_file *source, int line,
const char *name, const char *replacement);
-
/* Record an function-like #definition (i.e., one with a parameter list).
Record in SOURCE's macro table that, at line number LINE in SOURCE,
@@ -261,7 +251,6 @@ void macro_define_function (struct macro_source_file *source, int line,
const char *name, int argc, const char **argv,
const char *replacement);
-
/* Record an #undefinition.
Record in SOURCE's macro table that, at line number LINE in SOURCE,
we removed the definition for the preprocessor symbol named NAME. */
@@ -302,7 +291,7 @@ struct macro_definition
`macro_object_like', then this is actually a `macro_special_kind'
describing the macro. */
int argc : 30;
- const char * const *argv;
+ const char *const *argv;
/* The replacement string (body) of the macro. For ordinary macros,
this is in the table's bcache, if it has one. For special macros
@@ -312,27 +301,23 @@ struct macro_definition
const char *replacement;
};
-
/* Return a pointer to the macro definition for NAME in scope at line
number LINE of SOURCE. If LINE is -1, return the definition in
effect at the end of the file. The macro table owns the structure;
the caller need not free it. Return zero if NAME is not #defined
at that point. */
-struct macro_definition *macro_lookup_definition
- (struct macro_source_file *source,
- int line, const char *name);
-
+struct macro_definition *
+macro_lookup_definition (struct macro_source_file *source, int line,
+ const char *name);
/* Return the source location of the definition for NAME in scope at
line number LINE of SOURCE. Set *DEFINITION_LINE to the line
number of the definition, and return a source file structure for
the file. Return zero if NAME has no definition in scope at that
point, and leave *DEFINITION_LINE unchanged. */
-struct macro_source_file *macro_definition_location
- (struct macro_source_file *source,
- int line,
- const char *name,
- int *definition_line);
+struct macro_source_file *
+macro_definition_location (struct macro_source_file *source, int line,
+ const char *name, int *definition_line);
/* Prototype for a callback callable when walking a macro table. NAME
is the name of the macro, and DEFINITION is the definition. SOURCE
@@ -340,8 +325,7 @@ struct macro_source_file *macro_definition_location
number of the SOURCE file where the macro was defined. */
typedef void (macro_callback_fn) (const char *name,
const struct macro_definition *definition,
- struct macro_source_file *source,
- int line);
+ struct macro_source_file *source, int line);
/* Call the callable FN for each macro in the macro table TABLE. */
void macro_for_each (struct macro_table *table,
diff --git a/gdb/main.c b/gdb/main.c
index c04d37a45f9..037cff2d29f 100644
--- a/gdb/main.c
+++ b/gdb/main.c
@@ -91,7 +91,6 @@ int batch_silent = 0;
int return_child_result = 0;
int return_child_result_value = -1;
-
/* GDB as it has been invoked from the command line (i.e. argv[0]). */
static char *gdb_program_name;
@@ -121,7 +120,7 @@ set_gdb_data_directory (const char *new_datadir)
print_sys_errmsg (new_datadir, save_errno);
}
else if (!S_ISDIR (st.st_mode))
- warning (_("%ps is not a directory."),
+ warning (_ ("%ps is not a directory."),
styled_string (file_name_style.style (), new_datadir));
gdb_datadir = gdb_realpath (new_datadir).get ();
@@ -193,8 +192,7 @@ relocate_gdb_directory (const char *initial, bool relocatable)
otherwise. */
static std::string
-relocate_file_path_maybe_in_datadir (const std::string &file,
- bool relocatable)
+relocate_file_path_maybe_in_datadir (const std::string &file, bool relocatable)
{
size_t datadir_len = strlen (GDB_DATADIR);
@@ -202,8 +200,7 @@ relocate_file_path_maybe_in_datadir (const std::string &file,
/* If SYSTEM_GDBINIT lives in data-directory, and data-directory
has been provided, search for SYSTEM_GDBINIT there. */
- if (gdb_datadir_provided
- && datadir_len < file.length ()
+ if (gdb_datadir_provided && datadir_len < file.length ()
&& filename_ncmp (file.c_str (), GDB_DATADIR, datadir_len) == 0
&& IS_DIR_SEPARATOR (file[datadir_len]))
{
@@ -217,10 +214,10 @@ relocate_file_path_maybe_in_datadir (const std::string &file,
}
else
{
- relocated_path = relocate_path (gdb_program_name, file.c_str (),
- relocatable);
+ relocated_path
+ = relocate_path (gdb_program_name, file.c_str (), relocatable);
}
- return relocated_path;
+ return relocated_path;
}
/* A class to wrap up the logic for finding the three different types of
@@ -230,6 +227,7 @@ relocate_file_path_maybe_in_datadir (const std::string &file,
class gdb_initfile_finder
{
public:
+
/* Constructor. Finds initialisation files named FILENAME in the home
directory or local (current working) directory. System initialisation
files are found in both SYSTEM_FILENAME and SYSTEM_DIRNAME if these
@@ -293,13 +291,13 @@ public:
files.push_back (std::move (tmp_filename));
}
std::sort (files.begin (), files.end ());
- m_system_files.insert (m_system_files.end (),
- files.begin (), files.end ());
+ m_system_files.insert (m_system_files.end (), files.begin (),
+ files.end ());
}
}
}
- /* If the .gdbinit file in the current directory is the same as
+ /* If the .gdbinit file in the current directory is the same as
the $HOME/.gdbinit file, it should not be sourced. homebuf
and cwdbuf are used in that purpose. Make sure that the stats
are zero in case one of them fails (this guarantees that they
@@ -325,17 +323,17 @@ public:
/* Return a list of system initialisation files. The list could be
empty. */
const std::vector<std::string> &system_files () const
- { return m_system_files; }
+ {
+ return m_system_files;
+ }
/* Return the path to the home initialisation file. The string can be
empty if there is no such file. */
- const std::string &home_file () const
- { return m_home_file; }
+ const std::string &home_file () const { return m_home_file; }
/* Return the path to the local initialisation file. The string can be
empty if there is no such file. */
- const std::string &local_file () const
- { return m_local_file; }
+ const std::string &local_file () const { return m_local_file; }
private:
@@ -360,8 +358,7 @@ private:
static void
get_init_files (std::vector<std::string> *system_gdbinit,
- std::string *home_gdbinit,
- std::string *local_gdbinit)
+ std::string *home_gdbinit, std::string *local_gdbinit)
{
/* Cache the file lookup object so we only actually search for the files
once. */
@@ -418,9 +415,9 @@ start_event_loop ()
stdin. Otherwise, any command that calls async_disable_stdin,
and then throws, will leave stdin inoperable. */
SWITCH_THRU_ALL_UIS ()
- {
- async_enable_stdin ();
- }
+ {
+ async_enable_stdin ();
+ }
/* If we long-jumped out of do_one_event, we probably didn't
get around to resetting the prompt, which leaves readline
in a messed-up state. Reset it here. */
@@ -452,7 +449,7 @@ start_event_loop ()
/* Prevent inlining this function for the benefit of GDB's selftests
in the testsuite. Those tests want to run GDB under GDB and stop
here. */
-static void captured_command_loop () __attribute__((noinline));
+static void captured_command_loop () __attribute__ ((noinline));
static void
captured_command_loop ()
@@ -547,8 +544,8 @@ validate_readnow_readnever ()
{
if (readnever_symbol_files && readnow_symbol_files)
{
- error (_("%s: '--readnow' and '--readnever' cannot be "
- "specified simultaneously"),
+ error (_ ("%s: '--readnow' and '--readnever' cannot be "
+ "specified simultaneously"),
gdb_program_name);
}
}
@@ -579,8 +576,10 @@ enum cmdarg_kind
struct cmdarg
{
cmdarg (cmdarg_kind type_, char *string_)
- : type (type_), string (string_)
- {}
+ : type (type_),
+ string (string_)
+ {
+ }
/* Type of this option. */
enum cmdarg_kind type;
@@ -596,14 +595,13 @@ struct cmdarg
static void
execute_cmdargs (const std::vector<struct cmdarg> *cmdarg_vec,
- cmdarg_kind file_type, cmdarg_kind cmd_type,
- int *ret)
+ cmdarg_kind file_type, cmdarg_kind cmd_type, int *ret)
{
for (const auto &cmdarg_p : *cmdarg_vec)
{
if (cmdarg_p.type == file_type)
- *ret = catch_command_errors (source_script, cmdarg_p.string,
- !batch_flag);
+ *ret
+ = catch_command_errors (source_script, cmdarg_p.string, !batch_flag);
else if (cmdarg_p.type == cmd_type)
*ret = catch_command_errors (execute_command, cmdarg_p.string,
!batch_flag, true);
@@ -652,10 +650,10 @@ captured_main_1 (struct captured_main_args *context)
scoped_command_stats stat_reporter (false);
-#if defined (HAVE_SETLOCALE) && defined (HAVE_LC_MESSAGES)
+#if defined(HAVE_SETLOCALE) && defined(HAVE_LC_MESSAGES)
setlocale (LC_MESSAGES, "");
#endif
-#if defined (HAVE_SETLOCALE)
+#if defined(HAVE_SETLOCALE)
setlocale (LC_CTYPE, "");
#endif
#ifdef ENABLE_NLS
@@ -681,7 +679,7 @@ captured_main_1 (struct captured_main_args *context)
gdb_stdtargin = gdb_stdin;
if (bfd_init () != BFD_INIT_MAGIC)
- error (_("fatal error: libbfd ABI mismatch"));
+ error (_ ("fatal error: libbfd ABI mismatch"));
#ifdef __MINGW32__
/* On Windows, argv[0] is not necessarily set to absolute form when
@@ -698,7 +696,7 @@ captured_main_1 (struct captured_main_args *context)
current_directory = getcwd (NULL, 0);
if (current_directory == NULL)
- perror_warning_with_name (_("error finding working directory"));
+ perror_warning_with_name (_ ("error finding working directory"));
/* Set the sysroot path. */
gdb_sysroot = relocate_gdb_directory (TARGET_SYSTEM_ROOT,
@@ -710,12 +708,11 @@ captured_main_1 (struct captured_main_args *context)
debug_file_directory
= relocate_gdb_directory (DEBUGDIR, DEBUGDIR_RELOCATABLE);
- gdb_datadir = relocate_gdb_directory (GDB_DATADIR,
- GDB_DATADIR_RELOCATABLE);
+ gdb_datadir = relocate_gdb_directory (GDB_DATADIR, GDB_DATADIR_RELOCATABLE);
#ifdef WITH_PYTHON_LIBDIR
- python_libdir = relocate_gdb_directory (WITH_PYTHON_LIBDIR,
- PYTHON_LIBDIR_RELOCATABLE);
+ python_libdir
+ = relocate_gdb_directory (WITH_PYTHON_LIBDIR, PYTHON_LIBDIR_RELOCATABLE);
#endif
#ifdef RELOC_SRCDIR
@@ -733,10 +730,12 @@ captured_main_1 (struct captured_main_args *context)
/* Parse arguments and options. */
{
int c;
+
/* When var field is 0, use flag field to record the equivalent
short option (or arbitrary numbers starting at 10 for those
with no equivalent). */
- enum {
+ enum
+ {
OPT_SE = 10,
OPT_CD,
OPT_ANNOTATE,
@@ -751,89 +750,87 @@ captured_main_1 (struct captured_main_args *context)
OPT_READNOW,
OPT_READNEVER
};
+
/* This struct requires int* in the struct, but write_files is a bool.
So use this temporary int that we write back after argument parsing. */
int write_files_1 = 0;
- static struct option long_options[] =
- {
- {"tui", no_argument, 0, OPT_TUI},
- {"readnow", no_argument, NULL, OPT_READNOW},
- {"readnever", no_argument, NULL, OPT_READNEVER},
- {"r", no_argument, NULL, OPT_READNOW},
- {"quiet", no_argument, &quiet, 1},
- {"q", no_argument, &quiet, 1},
- {"silent", no_argument, &quiet, 1},
- {"nh", no_argument, &inhibit_home_gdbinit, 1},
- {"nx", no_argument, &inhibit_gdbinit, 1},
- {"n", no_argument, &inhibit_gdbinit, 1},
- {"batch-silent", no_argument, 0, 'B'},
- {"batch", no_argument, &batch_flag, 1},
-
- /* This is a synonym for "--annotate=1". --annotate is now
+ static struct option long_options[]
+ = { { "tui", no_argument, 0, OPT_TUI },
+ { "readnow", no_argument, NULL, OPT_READNOW },
+ { "readnever", no_argument, NULL, OPT_READNEVER },
+ { "r", no_argument, NULL, OPT_READNOW },
+ { "quiet", no_argument, &quiet, 1 },
+ { "q", no_argument, &quiet, 1 },
+ { "silent", no_argument, &quiet, 1 },
+ { "nh", no_argument, &inhibit_home_gdbinit, 1 },
+ { "nx", no_argument, &inhibit_gdbinit, 1 },
+ { "n", no_argument, &inhibit_gdbinit, 1 },
+ { "batch-silent", no_argument, 0, 'B' },
+ { "batch", no_argument, &batch_flag, 1 },
+
+ /* This is a synonym for "--annotate=1". --annotate is now
preferred, but keep this here for a long time because people
will be running emacses which use --fullname. */
- {"fullname", no_argument, 0, 'f'},
- {"f", no_argument, 0, 'f'},
-
- {"annotate", required_argument, 0, OPT_ANNOTATE},
- {"help", no_argument, &print_help, 1},
- {"se", required_argument, 0, OPT_SE},
- {"symbols", required_argument, 0, 's'},
- {"s", required_argument, 0, 's'},
- {"exec", required_argument, 0, 'e'},
- {"e", required_argument, 0, 'e'},
- {"core", required_argument, 0, 'c'},
- {"c", required_argument, 0, 'c'},
- {"pid", required_argument, 0, 'p'},
- {"p", required_argument, 0, 'p'},
- {"command", required_argument, 0, 'x'},
- {"eval-command", required_argument, 0, 'X'},
- {"version", no_argument, &print_version, 1},
- {"configuration", no_argument, &print_configuration, 1},
- {"x", required_argument, 0, 'x'},
- {"ex", required_argument, 0, 'X'},
- {"init-command", required_argument, 0, OPT_IX},
- {"init-eval-command", required_argument, 0, OPT_IEX},
- {"ix", required_argument, 0, OPT_IX},
- {"iex", required_argument, 0, OPT_IEX},
- {"early-init-command", required_argument, 0, OPT_EIX},
- {"early-init-eval-command", required_argument, 0, OPT_EIEX},
- {"eix", required_argument, 0, OPT_EIX},
- {"eiex", required_argument, 0, OPT_EIEX},
+ { "fullname", no_argument, 0, 'f' },
+ { "f", no_argument, 0, 'f' },
+
+ { "annotate", required_argument, 0, OPT_ANNOTATE },
+ { "help", no_argument, &print_help, 1 },
+ { "se", required_argument, 0, OPT_SE },
+ { "symbols", required_argument, 0, 's' },
+ { "s", required_argument, 0, 's' },
+ { "exec", required_argument, 0, 'e' },
+ { "e", required_argument, 0, 'e' },
+ { "core", required_argument, 0, 'c' },
+ { "c", required_argument, 0, 'c' },
+ { "pid", required_argument, 0, 'p' },
+ { "p", required_argument, 0, 'p' },
+ { "command", required_argument, 0, 'x' },
+ { "eval-command", required_argument, 0, 'X' },
+ { "version", no_argument, &print_version, 1 },
+ { "configuration", no_argument, &print_configuration, 1 },
+ { "x", required_argument, 0, 'x' },
+ { "ex", required_argument, 0, 'X' },
+ { "init-command", required_argument, 0, OPT_IX },
+ { "init-eval-command", required_argument, 0, OPT_IEX },
+ { "ix", required_argument, 0, OPT_IX },
+ { "iex", required_argument, 0, OPT_IEX },
+ { "early-init-command", required_argument, 0, OPT_EIX },
+ { "early-init-eval-command", required_argument, 0, OPT_EIEX },
+ { "eix", required_argument, 0, OPT_EIX },
+ { "eiex", required_argument, 0, OPT_EIEX },
#ifdef GDBTK
- {"tclcommand", required_argument, 0, 'z'},
- {"enable-external-editor", no_argument, 0, 'y'},
- {"editor-command", required_argument, 0, 'w'},
+ { "tclcommand", required_argument, 0, 'z' },
+ { "enable-external-editor", no_argument, 0, 'y' },
+ { "editor-command", required_argument, 0, 'w' },
#endif
- {"ui", required_argument, 0, 'i'},
- {"interpreter", required_argument, 0, 'i'},
- {"i", required_argument, 0, 'i'},
- {"directory", required_argument, 0, 'd'},
- {"d", required_argument, 0, 'd'},
- {"data-directory", required_argument, 0, 'D'},
- {"D", required_argument, 0, 'D'},
- {"cd", required_argument, 0, OPT_CD},
- {"tty", required_argument, 0, 't'},
- {"baud", required_argument, 0, 'b'},
- {"b", required_argument, 0, 'b'},
- {"nw", no_argument, NULL, OPT_NOWINDOWS},
- {"nowindows", no_argument, NULL, OPT_NOWINDOWS},
- {"w", no_argument, NULL, OPT_WINDOWS},
- {"windows", no_argument, NULL, OPT_WINDOWS},
- {"statistics", no_argument, 0, OPT_STATISTICS},
- {"write", no_argument, &write_files_1, 1},
- {"args", no_argument, &set_args, 1},
- {"l", required_argument, 0, 'l'},
- {"return-child-result", no_argument, &return_child_result, 1},
- {0, no_argument, 0, 0}
- };
+ { "ui", required_argument, 0, 'i' },
+ { "interpreter", required_argument, 0, 'i' },
+ { "i", required_argument, 0, 'i' },
+ { "directory", required_argument, 0, 'd' },
+ { "d", required_argument, 0, 'd' },
+ { "data-directory", required_argument, 0, 'D' },
+ { "D", required_argument, 0, 'D' },
+ { "cd", required_argument, 0, OPT_CD },
+ { "tty", required_argument, 0, 't' },
+ { "baud", required_argument, 0, 'b' },
+ { "b", required_argument, 0, 'b' },
+ { "nw", no_argument, NULL, OPT_NOWINDOWS },
+ { "nowindows", no_argument, NULL, OPT_NOWINDOWS },
+ { "w", no_argument, NULL, OPT_WINDOWS },
+ { "windows", no_argument, NULL, OPT_WINDOWS },
+ { "statistics", no_argument, 0, OPT_STATISTICS },
+ { "write", no_argument, &write_files_1, 1 },
+ { "args", no_argument, &set_args, 1 },
+ { "l", required_argument, 0, 'l' },
+ { "return-child-result", no_argument, &return_child_result, 1 },
+ { 0, no_argument, 0, 0 } };
while (1)
{
int option_index;
- c = getopt_long_only (argc, argv, "",
- long_options, &option_index);
+ c = getopt_long_only (argc, argv, "", long_options, &option_index);
if (c == EOF || set_args)
break;
@@ -867,7 +864,7 @@ captured_main_1 (struct captured_main_args *context)
#ifdef TUI
interpreter_p = INTERP_TUI;
#else
- error (_("%s: TUI mode is not supported"), gdb_program_name);
+ error (_ ("%s: TUI mode is not supported"), gdb_program_name);
#endif
break;
case OPT_WINDOWS:
@@ -921,7 +918,7 @@ captured_main_1 (struct captured_main_args *context)
break;
case 'D':
if (optarg[0] == '\0')
- error (_("%s: empty path for `--data-directory'"),
+ error (_ ("%s: empty path for `--data-directory'"),
gdb_program_name);
set_gdb_data_directory (optarg);
gdb_datadir_provided = 1;
@@ -930,7 +927,7 @@ captured_main_1 (struct captured_main_args *context)
case 'z':
{
if (!gdbtk_test (optarg))
- error (_("%s: unable to load tclcommand file \"%s\""),
+ error (_ ("%s: unable to load tclcommand file \"%s\""),
gdb_program_name, optarg);
break;
}
@@ -964,8 +961,7 @@ captured_main_1 (struct captured_main_args *context)
rate = strtol (optarg, &p, 0);
if (rate == 0 && p == optarg)
- warning (_("could not set baud rate to `%s'."),
- optarg);
+ warning (_ ("could not set baud rate to `%s'."), optarg);
else
baud_rate = rate;
}
@@ -977,8 +973,7 @@ captured_main_1 (struct captured_main_args *context)
timeout = strtol (optarg, &p, 0);
if (timeout == 0 && p == optarg)
- warning (_("could not set timeout limit to `%s'."),
- optarg);
+ warning (_ ("could not set timeout limit to `%s'."), optarg);
else
remote_timeout = timeout;
}
@@ -999,7 +994,7 @@ captured_main_1 (struct captured_main_args *context)
break;
case '?':
- error (_("Use `%s --help' for a complete list of options."),
+ error (_ ("Use `%s --help' for a complete list of options."),
gdb_program_name);
}
}
@@ -1028,8 +1023,8 @@ captured_main_1 (struct captured_main_args *context)
std::string home_gdbearlyinit;
get_earlyinit_files (&home_gdbearlyinit);
if (!home_gdbearlyinit.empty () && !inhibit_home_gdbinit)
- ret = catch_command_errors (source_script,
- home_gdbearlyinit.c_str (), 0);
+ ret = catch_command_errors (source_script, home_gdbearlyinit.c_str (),
+ 0);
}
execute_cmdargs (&cmdarg_vec, CMDARG_EARLYINIT_FILE,
CMDARG_EARLYINIT_COMMAND, &ret);
@@ -1050,7 +1045,7 @@ captured_main_1 (struct captured_main_args *context)
inferior. The first one is the sym/exec file, and the rest
are arguments. */
if (optind >= argc)
- error (_("%s: `--args' specified but no program specified"),
+ error (_ ("%s: `--args' specified but no program specified"),
gdb_program_name);
symarg = argv[optind];
@@ -1085,10 +1080,9 @@ captured_main_1 (struct captured_main_args *context)
will be ignored. Inform the user. */
if (optind < argc)
gdb_printf (gdb_stderr,
- _("Excess command line "
- "arguments ignored. (%s%s)\n"),
- argv[optind],
- (optind == argc - 1) ? "" : " ...");
+ _ ("Excess command line "
+ "arguments ignored. (%s%s)\n"),
+ argv[optind], (optind == argc - 1) ? "" : " ...");
}
/* Lookup gdbinit files. Note that the gdbinit file name may be
@@ -1136,13 +1130,13 @@ captured_main_1 (struct captured_main_args *context)
if (symarg)
gdb_printf ("..");
gdb_printf ("\n");
- gdb_flush (gdb_stdout); /* Force to screen during slow
+ gdb_flush (gdb_stdout); /* Force to screen during slow
operations. */
}
/* Set off error and warning messages with a blank line. */
tmp_warn_preprint.reset ();
- warning_pre_print = _("\nwarning: ");
+ warning_pre_print = _ ("\nwarning: ");
/* Read and execute the system-wide gdbinit file, if it exists.
This is done *before* all the command line arguments are
@@ -1180,37 +1174,32 @@ captured_main_1 (struct captured_main_args *context)
save_auto_load = global_auto_load;
global_auto_load = 0;
- if (execarg != NULL
- && symarg != NULL
- && strcmp (execarg, symarg) == 0)
+ if (execarg != NULL && symarg != NULL && strcmp (execarg, symarg) == 0)
{
/* The exec file and the symbol-file are the same. If we can't
open it, better only print one error message.
catch_command_errors returns non-zero on success! */
- ret = catch_command_errors (exec_file_attach, execarg,
- !batch_flag);
+ ret = catch_command_errors (exec_file_attach, execarg, !batch_flag);
if (ret != 0)
- ret = catch_command_errors (symbol_file_add_main_adapter,
- symarg, !batch_flag);
+ ret = catch_command_errors (symbol_file_add_main_adapter, symarg,
+ !batch_flag);
}
else
{
if (execarg != NULL)
- ret = catch_command_errors (exec_file_attach, execarg,
- !batch_flag);
+ ret = catch_command_errors (exec_file_attach, execarg, !batch_flag);
if (symarg != NULL)
- ret = catch_command_errors (symbol_file_add_main_adapter,
- symarg, !batch_flag);
+ ret = catch_command_errors (symbol_file_add_main_adapter, symarg,
+ !batch_flag);
}
if (corearg && pidarg)
- error (_("Can't attach to process and specify "
- "a core file at the same time."));
+ error (_ ("Can't attach to process and specify "
+ "a core file at the same time."));
if (corearg != NULL)
{
- ret = catch_command_errors (core_file_command, corearg,
- !batch_flag);
+ ret = catch_command_errors (core_file_command, corearg, !batch_flag);
}
else if (pidarg != NULL)
{
@@ -1227,15 +1216,13 @@ captured_main_1 (struct captured_main_args *context)
ret = catch_command_errors (attach_command, pid_or_core_arg,
!batch_flag);
if (ret == 0)
- ret = catch_command_errors (core_file_command,
- pid_or_core_arg,
+ ret = catch_command_errors (core_file_command, pid_or_core_arg,
!batch_flag);
}
else
{
/* Can't be a pid, better be a corefile. */
- ret = catch_command_errors (core_file_command,
- pid_or_core_arg,
+ ret = catch_command_errors (core_file_command, pid_or_core_arg,
!batch_flag);
}
}
@@ -1244,7 +1231,7 @@ captured_main_1 (struct captured_main_args *context)
current_inferior ()->set_tty (ttyarg);
/* Error messages should no longer be distinguished with extra output. */
- warning_pre_print = _("warning: ");
+ warning_pre_print = _ ("warning: ");
/* Read the .gdbinit file in the current directory, *if* it isn't
the same as the $HOME/.gdbinit file (it should exist, also). */
@@ -1262,7 +1249,8 @@ captured_main_1 (struct captured_main_args *context)
{
auto_load_local_gdbinit_loaded = 1;
- ret = catch_command_errors (source_script, local_gdbinit.c_str (), 0);
+ ret = catch_command_errors (source_script,
+ local_gdbinit.c_str (), 0);
}
}
}
@@ -1334,7 +1322,6 @@ gdb_main (struct captured_main_args *args)
return 1;
}
-
/* Don't use *_filtered for printing help. We don't want to prompt
for continue no matter how small the screen or how much we're going
to print. */
@@ -1353,12 +1340,13 @@ print_gdb_help (struct ui_file *stream)
/* Note: The options in the list below are only approximately sorted
in the alphabetical order, so as to group closely related options
together. */
- gdb_puts (_("\
+ gdb_puts (_ ("\
This is the GNU debugger. Usage:\n\n\
gdb [options] [executable-file [core-file or process-id]]\n\
gdb [options] --args executable-file [inferior-arguments ...]\n\n\
-"), stream);
- gdb_puts (_("\
+"),
+ stream);
+ gdb_puts (_ ("\
Selection of debuggee and its files:\n\n\
--args Arguments after executable-file are passed to inferior.\n\
--core=COREFILE Analyze the core dump COREFILE.\n\
@@ -1370,8 +1358,9 @@ Selection of debuggee and its files:\n\n\
--readnow Fully read symbol files on first access.\n\
--readnever Do not read symbol files.\n\
--write Set writing into executable and core files.\n\n\
-"), stream);
- gdb_puts (_("\
+"),
+ stream);
+ gdb_puts (_ ("\
Initial commands and command files:\n\n\
--command=FILE, -x Execute GDB commands from FILE.\n\
--init-command=FILE, -ix\n\
@@ -1384,8 +1373,9 @@ Initial commands and command files:\n\n\
Like -ex but before loading inferior.\n\
--nh Do not read ~/.gdbinit.\n\
--nx Do not read any .gdbinit files in any directory.\n\n\
-"), stream);
- gdb_puts (_("\
+"),
+ stream);
+ gdb_puts (_ ("\
Output and user interface control:\n\n\
--fullname Output information used by emacs-GDB interface.\n\
--interpreter=INTERP\n\
@@ -1393,17 +1383,20 @@ Output and user interface control:\n\n\
--tty=TTY Use TTY for input/output by the program being debugged.\n\
-w Use the GUI interface.\n\
--nw Do not use the GUI interface.\n\
-"), stream);
+"),
+ stream);
#if defined(TUI)
- gdb_puts (_("\
+ gdb_puts (_ ("\
--tui Use a terminal user interface.\n\
-"), stream);
+"),
+ stream);
#endif
- gdb_puts (_("\
+ gdb_puts (_ ("\
-q, --quiet, --silent\n\
Do not print version number on startup.\n\n\
-"), stream);
- gdb_puts (_("\
+"),
+ stream);
+ gdb_puts (_ ("\
Operating modes:\n\n\
--batch Exit after processing options.\n\
--batch-silent Like --batch, but suppress all gdb stdout output.\n\
@@ -1419,21 +1412,25 @@ Other options:\n\n\
--cd=DIR Change current directory to DIR.\n\
--data-directory=DIR, -D\n\
Set GDB's data-directory to DIR.\n\
-"), stream);
- gdb_puts (_("\n\
+"),
+ stream);
+ gdb_puts (_ ("\n\
At startup, GDB reads the following early init files and executes their\n\
commands:\n\
-"), stream);
+"),
+ stream);
if (!home_gdbearlyinit.empty ())
- gdb_printf (stream, _("\
+ gdb_printf (stream, _ ("\
* user-specific early init file: %s\n\
-"), home_gdbearlyinit.c_str ());
+"),
+ home_gdbearlyinit.c_str ());
if (home_gdbearlyinit.empty ())
- gdb_printf (stream, _("\
+ gdb_printf (stream, _ ("\
None found.\n"));
- gdb_puts (_("\n\
+ gdb_puts (_ ("\n\
At startup, GDB reads the following init files and executes their commands:\n\
-"), stream);
+"),
+ stream);
if (!system_gdbinit.empty ())
{
std::string output;
@@ -1443,32 +1440,37 @@ At startup, GDB reads the following init files and executes their commands:\n\
if (idx < system_gdbinit.size () - 1)
output += ", ";
}
- gdb_printf (stream, _("\
+ gdb_printf (stream, _ ("\
* system-wide init files: %s\n\
-"), output.c_str ());
+"),
+ output.c_str ());
}
if (!home_gdbinit.empty ())
- gdb_printf (stream, _("\
+ gdb_printf (stream, _ ("\
* user-specific init file: %s\n\
-"), home_gdbinit.c_str ());
+"),
+ home_gdbinit.c_str ());
if (!local_gdbinit.empty ())
- gdb_printf (stream, _("\
+ gdb_printf (stream, _ ("\
* local init file (see also 'set auto-load local-gdbinit'): ./%s\n\
-"), local_gdbinit.c_str ());
+"),
+ local_gdbinit.c_str ());
if (system_gdbinit.empty () && home_gdbinit.empty ()
&& local_gdbinit.empty ())
- gdb_printf (stream, _("\
+ gdb_printf (stream, _ ("\
None found.\n"));
- gdb_puts (_("\n\
+ gdb_puts (_ ("\n\
For more information, type \"help\" from within GDB, or consult the\n\
GDB manual (available as on-line info or a printed manual).\n\
-"), stream);
+"),
+ stream);
if (REPORT_BUGS_TO[0] && stream == gdb_stdout)
- gdb_printf (stream, _("\n\
+ gdb_printf (stream, _ ("\n\
Report bugs to %ps.\n\
-"), styled_string (file_name_style.style (), REPORT_BUGS_TO));
+"),
+ styled_string (file_name_style.style (), REPORT_BUGS_TO));
if (stream == gdb_stdout)
- gdb_printf (stream, _("\n\
+ gdb_printf (stream, _ ("\n\
You can ask GDB-related questions on the GDB users mailing list\n\
(gdb@sourceware.org) or on GDB's IRC channel (#gdb on Freenode).\n"));
}
diff --git a/gdb/maint-test-options.c b/gdb/maint-test-options.c
index 9e2e2110f08..3d8bce3b4c0 100644
--- a/gdb/maint-test-options.c
+++ b/gdb/maint-test-options.c
@@ -116,13 +116,9 @@
const char test_options_enum_values_xxx[] = "xxx";
const char test_options_enum_values_yyy[] = "yyy";
const char test_options_enum_values_zzz[] = "zzz";
-static const char *const test_options_enum_values_choices[] =
-{
- test_options_enum_values_xxx,
- test_options_enum_values_yyy,
- test_options_enum_values_zzz,
- NULL
-};
+static const char *const test_options_enum_values_choices[]
+ = { test_options_enum_values_xxx, test_options_enum_values_yyy,
+ test_options_enum_values_zzz, NULL };
/* Option data for the "maintenance test-options" commands. */
@@ -146,21 +142,13 @@ struct test_options_opts
void dump (ui_file *file, const char *args) const
{
gdb_printf (file,
- _("-flag %d -xx1 %d -xx2 %d -bool %d "
- "-enum %s -uint-unl %s -pint-unl %s -string '%s' -- %s\n"),
- flag_opt,
- xx1_opt,
- xx2_opt,
- boolean_opt,
- enum_opt,
- (uint_unl_opt == UINT_MAX
- ? "unlimited"
- : pulongest (uint_unl_opt)),
- (pint_unl_opt == -1
- ? "unlimited"
- : plongest (pint_unl_opt)),
- string_opt.c_str (),
- args);
+ _ ("-flag %d -xx1 %d -xx2 %d -bool %d "
+ "-enum %s -uint-unl %s -pint-unl %s -string '%s' -- %s\n"),
+ flag_opt, xx1_opt, xx2_opt, boolean_opt, enum_opt,
+ (uint_unl_opt == UINT_MAX ? "unlimited"
+ : pulongest (uint_unl_opt)),
+ (pint_unl_opt == -1 ? "unlimited" : plongest (pint_unl_opt)),
+ string_opt.c_str (), args);
}
};
@@ -172,7 +160,7 @@ static const gdb::option::option_def test_options_option_defs[] = {
gdb::option::flag_option_def<test_options_opts> {
"flag",
[] (test_options_opts *opts) { return &opts->flag_opt; },
- N_("A flag option."),
+ N_ ("A flag option."),
},
/* A couple flags with similar names, for "ambiguous option names"
@@ -180,12 +168,12 @@ static const gdb::option::option_def test_options_option_defs[] = {
gdb::option::flag_option_def<test_options_opts> {
"xx1",
[] (test_options_opts *opts) { return &opts->xx1_opt; },
- N_("A flag option."),
+ N_ ("A flag option."),
},
gdb::option::flag_option_def<test_options_opts> {
"xx2",
[] (test_options_opts *opts) { return &opts->xx2_opt; },
- N_("A flag option."),
+ N_ ("A flag option."),
},
/* A boolean option. */
@@ -193,7 +181,7 @@ static const gdb::option::option_def test_options_option_defs[] = {
"bool",
[] (test_options_opts *opts) { return &opts->boolean_opt; },
nullptr, /* show_cmd_cb */
- N_("A boolean option."),
+ N_ ("A boolean option."),
},
/* An enum option. */
@@ -202,7 +190,7 @@ static const gdb::option::option_def test_options_option_defs[] = {
test_options_enum_values_choices,
[] (test_options_opts *opts) { return &opts->enum_opt; },
nullptr, /* show_cmd_cb */
- N_("An enum option."),
+ N_ ("An enum option."),
},
/* A uinteger + "unlimited" option. */
@@ -211,20 +199,18 @@ static const gdb::option::option_def test_options_option_defs[] = {
[] (test_options_opts *opts) { return &opts->uint_unl_opt; },
uinteger_unlimited_literals,
nullptr, /* show_cmd_cb */
- N_("A uinteger option."),
+ N_ ("A uinteger option."),
nullptr, /* show_doc */
- N_("A help doc that spawns\nmultiple lines."),
+ N_ ("A help doc that spawns\nmultiple lines."),
},
/* A pinteger + "unlimited" option. */
gdb::option::pinteger_option_def<test_options_opts> {
"pinteger-unlimited",
[] (test_options_opts *opts) { return &opts->pint_unl_opt; },
- pinteger_unlimited_literals,
- nullptr, /* show_cmd_cb */
- N_("A pinteger-unlimited option."),
- nullptr, /* show_doc */
- nullptr, /* help_doc */
+ pinteger_unlimited_literals, nullptr, /* show_cmd_cb */
+ N_ ("A pinteger-unlimited option."), nullptr, /* show_doc */
+ nullptr, /* help_doc */
},
/* A string option. */
@@ -232,7 +218,7 @@ static const gdb::option::option_def test_options_option_defs[] = {
"string",
[] (test_options_opts *opts) { return &opts->string_opt; },
nullptr, /* show_cmd_cb */
- N_("A string option."),
+ N_ ("A string option."),
},
};
@@ -242,7 +228,7 @@ static const gdb::option::option_def test_options_option_defs[] = {
static inline gdb::option::option_def_group
make_test_options_options_def_group (test_options_opts *opts)
{
- return {{test_options_option_defs}, opts};
+ return { { test_options_option_defs }, opts };
}
/* Implementation of the "maintenance test-options
@@ -314,17 +300,16 @@ save_completion_result (const test_options_opts &opts, bool res,
enumerator. */
static void
-maintenance_test_options_completer_mode (completion_tracker &tracker,
- const char *text,
- gdb::option::process_options_mode mode)
+maintenance_test_options_completer_mode (
+ completion_tracker &tracker, const char *text,
+ gdb::option::process_options_mode mode)
{
test_options_opts opts;
try
{
- bool res = (gdb::option::complete_options
- (tracker, &text, mode,
- make_test_options_options_def_group (&opts)));
+ bool res = (gdb::option::complete_options (
+ tracker, &text, mode, make_test_options_options_def_group (&opts)));
save_completion_result (opts, res, text);
}
@@ -342,8 +327,8 @@ static void
maintenance_test_options_require_delimiter_command (const char *args,
int from_tty)
{
- maintenance_test_options_command_mode
- (args, gdb::option::PROCESS_OPTIONS_REQUIRE_DELIMITER);
+ maintenance_test_options_command_mode (
+ args, gdb::option::PROCESS_OPTIONS_REQUIRE_DELIMITER);
}
/* Implementation of the "maintenance test-options
@@ -353,8 +338,8 @@ static void
maintenance_test_options_unknown_is_error_command (const char *args,
int from_tty)
{
- maintenance_test_options_command_mode
- (args, gdb::option::PROCESS_OPTIONS_UNKNOWN_IS_ERROR);
+ maintenance_test_options_command_mode (
+ args, gdb::option::PROCESS_OPTIONS_UNKNOWN_IS_ERROR);
}
/* Implementation of the "maintenance test-options
@@ -364,66 +349,64 @@ static void
maintenance_test_options_unknown_is_operand_command (const char *args,
int from_tty)
{
- maintenance_test_options_command_mode
- (args, gdb::option::PROCESS_OPTIONS_UNKNOWN_IS_OPERAND);
+ maintenance_test_options_command_mode (
+ args, gdb::option::PROCESS_OPTIONS_UNKNOWN_IS_OPERAND);
}
/* Completer for the "maintenance test-options require-delimiter"
command. */
static void
-maintenance_test_options_require_delimiter_command_completer
- (cmd_list_element *ignore, completion_tracker &tracker,
- const char *text, const char *word)
+maintenance_test_options_require_delimiter_command_completer (
+ cmd_list_element *ignore, completion_tracker &tracker, const char *text,
+ const char *word)
{
- maintenance_test_options_completer_mode
- (tracker, text, gdb::option::PROCESS_OPTIONS_REQUIRE_DELIMITER);
+ maintenance_test_options_completer_mode (
+ tracker, text, gdb::option::PROCESS_OPTIONS_REQUIRE_DELIMITER);
}
/* Completer for the "maintenance test-options unknown-is-error"
command. */
static void
-maintenance_test_options_unknown_is_error_command_completer
- (cmd_list_element *ignore, completion_tracker &tracker,
- const char *text, const char *word)
+maintenance_test_options_unknown_is_error_command_completer (
+ cmd_list_element *ignore, completion_tracker &tracker, const char *text,
+ const char *word)
{
- maintenance_test_options_completer_mode
- (tracker, text, gdb::option::PROCESS_OPTIONS_UNKNOWN_IS_ERROR);
+ maintenance_test_options_completer_mode (
+ tracker, text, gdb::option::PROCESS_OPTIONS_UNKNOWN_IS_ERROR);
}
/* Completer for the "maintenance test-options unknown-is-operand"
command. */
static void
-maintenance_test_options_unknown_is_operand_command_completer
- (cmd_list_element *ignore, completion_tracker &tracker,
- const char *text, const char *word)
+maintenance_test_options_unknown_is_operand_command_completer (
+ cmd_list_element *ignore, completion_tracker &tracker, const char *text,
+ const char *word)
{
- maintenance_test_options_completer_mode
- (tracker, text, gdb::option::PROCESS_OPTIONS_UNKNOWN_IS_OPERAND);
+ maintenance_test_options_completer_mode (
+ tracker, text, gdb::option::PROCESS_OPTIONS_UNKNOWN_IS_OPERAND);
}
/* Command list for maint test-options. */
static cmd_list_element *maintenance_test_options_list;
-
void _initialize_maint_test_options ();
+
void
_initialize_maint_test_options ()
{
cmd_list_element *cmd;
- add_basic_prefix_cmd ("test-options", no_class,
- _("\
+ add_basic_prefix_cmd ("test-options", no_class, _ ("\
Generic command for testing the options infrastructure."),
- &maintenance_test_options_list,
- 0, &maintenancelist);
+ &maintenance_test_options_list, 0, &maintenancelist);
const auto def_group = make_test_options_options_def_group (nullptr);
static const std::string help_require_delim_str
- = gdb::option::build_help (_("\
+ = gdb::option::build_help (_ ("\
Command used for testing options processing.\n\
Usage: maint test-options require-delimiter [[OPTION]... --] [OPERAND]...\n\
\n\
@@ -435,7 +418,7 @@ to mark the end of option processing."),
def_group);
static const std::string help_unknown_is_error_str
- = gdb::option::build_help (_("\
+ = gdb::option::build_help (_ ("\
Command used for testing options processing.\n\
Usage: maint test-options unknown-is-error [OPTION]... [OPERAND]...\n\
\n\
@@ -444,7 +427,7 @@ Options:\n\
def_group);
static const std::string help_unknown_is_operand_str
- = gdb::option::build_help (_("\
+ = gdb::option::build_help (_ ("\
Command used for testing options processing.\n\
Usage: maint test-options unknown-is-operand [OPTION]... [OPERAND]...\n\
\n\
@@ -456,26 +439,25 @@ Options:\n\
maintenance_test_options_require_delimiter_command,
help_require_delim_str.c_str (),
&maintenance_test_options_list);
- set_cmd_completer_handle_brkchars
- (cmd, maintenance_test_options_require_delimiter_command_completer);
+ set_cmd_completer_handle_brkchars (
+ cmd, maintenance_test_options_require_delimiter_command_completer);
cmd = add_cmd ("unknown-is-error", class_maintenance,
maintenance_test_options_unknown_is_error_command,
help_unknown_is_error_str.c_str (),
&maintenance_test_options_list);
- set_cmd_completer_handle_brkchars
- (cmd, maintenance_test_options_unknown_is_error_command_completer);
+ set_cmd_completer_handle_brkchars (
+ cmd, maintenance_test_options_unknown_is_error_command_completer);
cmd = add_cmd ("unknown-is-operand", class_maintenance,
maintenance_test_options_unknown_is_operand_command,
help_unknown_is_operand_str.c_str (),
&maintenance_test_options_list);
- set_cmd_completer_handle_brkchars
- (cmd, maintenance_test_options_unknown_is_operand_command_completer);
+ set_cmd_completer_handle_brkchars (
+ cmd, maintenance_test_options_unknown_is_operand_command_completer);
add_cmd ("test-options-completion-result", class_maintenance,
- maintenance_show_test_options_completion_result,
- _("\
+ maintenance_show_test_options_completion_result, _ ("\
Show maintenance test-options completion result.\n\
Shows the results of completing\n\
\"maint test-options require-delimiter\",\n\
diff --git a/gdb/maint-test-settings.c b/gdb/maint-test-settings.c
index 15b0d9e0e94..65eea9b32c9 100644
--- a/gdb/maint-test-settings.c
+++ b/gdb/maint-test-settings.c
@@ -17,7 +17,6 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
-
#include "defs.h"
#include "gdbcmd.h"
@@ -58,12 +57,9 @@ static const char maintenance_test_settings_xxx[] = "xxx";
static const char maintenance_test_settings_yyy[] = "yyy";
static const char maintenance_test_settings_zzz[] = "zzz";
-static const char *const maintenance_test_settings_enums[] = {
- maintenance_test_settings_xxx,
- maintenance_test_settings_yyy,
- maintenance_test_settings_zzz,
- nullptr
-};
+static const char *const maintenance_test_settings_enums[]
+ = { maintenance_test_settings_xxx, maintenance_test_settings_yyy,
+ maintenance_test_settings_zzz, nullptr };
static const char *maintenance_test_settings_enum
= maintenance_test_settings_xxx;
@@ -71,32 +67,32 @@ static const char *maintenance_test_settings_enum
/* The "maintenance show test-settings xxx" commands. */
static void
-maintenance_show_test_settings_value_cmd
- (struct ui_file *file, int from_tty,
- struct cmd_list_element *c, const char *value)
+maintenance_show_test_settings_value_cmd (struct ui_file *file, int from_tty,
+ struct cmd_list_element *c,
+ const char *value)
{
gdb_printf (file, (("%s\n")), value);
}
-
void _initialize_maint_test_settings ();
+
void
_initialize_maint_test_settings ()
{
maintenance_test_settings_filename = "/foo/bar";
- add_setshow_prefix_cmd ("test-settings", class_maintenance,
- _("\
+ add_setshow_prefix_cmd ("test-settings", class_maintenance, _ ("\
Set GDB internal variables used for set/show command infrastructure testing."),
- _("\
+ _ ("\
Show GDB internal variables used for set/show command infrastructure testing."),
&maintenance_set_test_settings_list,
&maintenance_show_test_settings_list,
&maintenance_set_cmdlist, &maintenance_show_cmdlist);
add_setshow_boolean_cmd ("boolean", class_maintenance,
- &maintenance_test_settings_boolean, _("\
-command used for internal testing."), _("\
+ &maintenance_test_settings_boolean, _ ("\
+command used for internal testing."),
+ _ ("\
command used for internal testing."),
nullptr, /* help_doc */
nullptr, /* set_cmd */
@@ -105,8 +101,9 @@ command used for internal testing."),
&maintenance_show_test_settings_list);
add_setshow_auto_boolean_cmd ("auto-boolean", class_maintenance,
- &maintenance_test_settings_auto_boolean, _("\
-command used for internal testing."), _("\
+ &maintenance_test_settings_auto_boolean, _ ("\
+command used for internal testing."),
+ _ ("\
command used for internal testing."),
nullptr, /* help_doc */
nullptr, /* set_cmd */
@@ -115,8 +112,9 @@ command used for internal testing."),
&maintenance_show_test_settings_list);
add_setshow_uinteger_cmd ("uinteger", class_maintenance,
- &maintenance_test_settings_uinteger, _("\
-command used for internal testing."), _("\
+ &maintenance_test_settings_uinteger, _ ("\
+command used for internal testing."),
+ _ ("\
command used for internal testing."),
nullptr, /* help_doc */
nullptr, /* set_cmd */
@@ -125,8 +123,9 @@ command used for internal testing."),
&maintenance_show_test_settings_list);
add_setshow_integer_cmd ("integer", class_maintenance,
- &maintenance_test_settings_integer, _("\
-command used for internal testing."), _("\
+ &maintenance_test_settings_integer, _ ("\
+command used for internal testing."),
+ _ ("\
command used for internal testing."),
nullptr, /* help_doc */
nullptr, /* set_cmd */
@@ -135,40 +134,43 @@ command used for internal testing."),
&maintenance_show_test_settings_list);
add_setshow_string_cmd ("string", class_maintenance,
- &maintenance_test_settings_string, _("\
-command used for internal testing."), _("\
+ &maintenance_test_settings_string, _ ("\
command used for internal testing."),
- nullptr, /* help_doc */
- nullptr, /* set_cmd */
+ _ ("\
+command used for internal testing."),
+ nullptr, /* help_doc */
+ nullptr, /* set_cmd */
maintenance_show_test_settings_value_cmd,
&maintenance_set_test_settings_list,
&maintenance_show_test_settings_list);
- add_setshow_string_noescape_cmd
- ("string-noescape", class_maintenance,
- &maintenance_test_settings_string_noescape, _("\
-command used for internal testing."), _("\
+ add_setshow_string_noescape_cmd ("string-noescape", class_maintenance,
+ &maintenance_test_settings_string_noescape,
+ _ ("\
command used for internal testing."),
- nullptr, /* help_doc */
- nullptr, /* set_cmd */
- maintenance_show_test_settings_value_cmd,
- &maintenance_set_test_settings_list,
- &maintenance_show_test_settings_list);
-
- add_setshow_optional_filename_cmd
- ("optional-filename", class_maintenance,
- &maintenance_test_settings_optional_filename, _("\
-command used for internal testing."), _("\
+ _ ("\
command used for internal testing."),
- nullptr, /* help_doc */
- nullptr, /* set_cmd */
- maintenance_show_test_settings_value_cmd,
- &maintenance_set_test_settings_list,
- &maintenance_show_test_settings_list);
+ nullptr, /* help_doc */
+ nullptr, /* set_cmd */
+ maintenance_show_test_settings_value_cmd,
+ &maintenance_set_test_settings_list,
+ &maintenance_show_test_settings_list);
+
+ add_setshow_optional_filename_cmd (
+ "optional-filename", class_maintenance,
+ &maintenance_test_settings_optional_filename, _ ("\
+command used for internal testing."),
+ _ ("\
+command used for internal testing."),
+ nullptr, /* help_doc */
+ nullptr, /* set_cmd */
+ maintenance_show_test_settings_value_cmd,
+ &maintenance_set_test_settings_list, &maintenance_show_test_settings_list);
add_setshow_filename_cmd ("filename", class_maintenance,
- &maintenance_test_settings_filename, _("\
-command used for internal testing."), _("\
+ &maintenance_test_settings_filename, _ ("\
+command used for internal testing."),
+ _ ("\
command used for internal testing."),
nullptr, /* help_doc */
nullptr, /* set_cmd */
@@ -177,8 +179,9 @@ command used for internal testing."),
&maintenance_show_test_settings_list);
add_setshow_zinteger_cmd ("zinteger", class_maintenance,
- &maintenance_test_settings_zinteger, _("\
-command used for internal testing."), _("\
+ &maintenance_test_settings_zinteger, _ ("\
+command used for internal testing."),
+ _ ("\
command used for internal testing."),
nullptr, /* help_doc */
nullptr, /* set_cmd */
@@ -187,8 +190,9 @@ command used for internal testing."),
&maintenance_show_test_settings_list);
add_setshow_zuinteger_cmd ("zuinteger", class_maintenance,
- &maintenance_test_settings_zuinteger, _("\
-command used for internal testing."), _("\
+ &maintenance_test_settings_zuinteger, _ ("\
+command used for internal testing."),
+ _ ("\
command used for internal testing."),
nullptr, /* help_doc */
nullptr, /* set_cmd */
@@ -196,21 +200,22 @@ command used for internal testing."),
&maintenance_set_test_settings_list,
&maintenance_show_test_settings_list);
- add_setshow_zuinteger_unlimited_cmd
- ("zuinteger-unlimited", class_maintenance,
- &maintenance_test_settings_zuinteger_unlimited, _("\
-command used for internal testing."), _("\
+ add_setshow_zuinteger_unlimited_cmd (
+ "zuinteger-unlimited", class_maintenance,
+ &maintenance_test_settings_zuinteger_unlimited, _ ("\
+command used for internal testing."),
+ _ ("\
command used for internal testing."),
- nullptr, /* help_doc */
- nullptr, /* set_cmd */
- maintenance_show_test_settings_value_cmd,
- &maintenance_set_test_settings_list,
- &maintenance_show_test_settings_list);
+ nullptr, /* help_doc */
+ nullptr, /* set_cmd */
+ maintenance_show_test_settings_value_cmd,
+ &maintenance_set_test_settings_list, &maintenance_show_test_settings_list);
add_setshow_enum_cmd ("enum", class_maintenance,
maintenance_test_settings_enums,
- &maintenance_test_settings_enum, _("\
-command used for internal testing."), _("\
+ &maintenance_test_settings_enum, _ ("\
+command used for internal testing."),
+ _ ("\
command used for internal testing."),
nullptr, /* help_doc */
nullptr, /* set_cmd */
diff --git a/gdb/maint.c b/gdb/maint.c
index 52f91a3246f..3a0db52e93d 100644
--- a/gdb/maint.c
+++ b/gdb/maint.c
@@ -19,7 +19,6 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
-
#include "defs.h"
#include "arch-utils.h"
#include <ctype.h>
@@ -32,7 +31,7 @@
#include "gdbtypes.h"
#include "demangle.h"
#include "gdbcore.h"
-#include "expression.h" /* For language.h */
+#include "expression.h" /* For language.h */
#include "language.h"
#include "symfile.h"
#include "objfiles.h"
@@ -54,7 +53,7 @@ static void maintenance_do_deprecate (const char *, int);
static void
maintenance_dump_me (const char *args, int from_tty)
{
- if (query (_("Should GDB dump core? ")))
+ if (query (_ ("Should GDB dump core? ")))
{
#ifdef __DJGPP__
/* SIGQUIT by default is ignored, so use SIGABRT instead. */
@@ -106,14 +105,14 @@ maintenance_demangler_warning (const char *args, int from_tty)
static void
maintenance_demangle (const char *args, int from_tty)
{
- gdb_printf (_("This command has been moved to \"demangle\".\n"));
+ gdb_printf (_ ("This command has been moved to \"demangle\".\n"));
}
static void
maintenance_time_display (const char *args, int from_tty)
{
if (args == NULL || *args == '\0')
- gdb_printf (_("\"maintenance time\" takes a numeric argument.\n"));
+ gdb_printf (_ ("\"maintenance time\" takes a numeric argument.\n"));
else
set_per_command_time (strtol (args, NULL, 10));
}
@@ -138,19 +137,16 @@ match_substring (const char *string, const char *substr)
while ((tok = strstr (string, substr)) != NULL)
{
/* Got a partial match. Is it a whole word? */
- if (tok == string
- || tok[-1] == ' '
- || tok[-1] == '\t')
- {
- /* Token is delimited at the front... */
- if (tok[substr_len] == ' '
- || tok[substr_len] == '\t'
- || tok[substr_len] == '\0')
+ if (tok == string || tok[-1] == ' ' || tok[-1] == '\t')
{
- /* Token is delimited at the rear. Got a whole-word match. */
- return true;
+ /* Token is delimited at the front... */
+ if (tok[substr_len] == ' ' || tok[substr_len] == '\t'
+ || tok[substr_len] == '\0')
+ {
+ /* Token is delimited at the rear. Got a whole-word match. */
+ return true;
+ }
}
- }
/* Token didn't match as a whole word. Advance and try again. */
string = tok + 1;
}
@@ -173,21 +169,19 @@ struct single_bfd_flag_info
/* Vector of all the known bfd flags. */
-static const single_bfd_flag_info bfd_flag_info[] =
- {
- { "ALLOC", SEC_ALLOC },
- { "LOAD", SEC_LOAD },
- { "RELOC", SEC_RELOC },
- { "READONLY", SEC_READONLY },
- { "CODE", SEC_CODE },
- { "DATA", SEC_DATA },
- { "ROM", SEC_ROM },
- { "CONSTRUCTOR", SEC_CONSTRUCTOR },
- { "HAS_CONTENTS", SEC_HAS_CONTENTS },
- { "NEVER_LOAD", SEC_NEVER_LOAD },
- { "COFF_SHARED_LIBRARY", SEC_COFF_SHARED_LIBRARY },
- { "IS_COMMON", SEC_IS_COMMON }
- };
+static const single_bfd_flag_info bfd_flag_info[]
+ = { { "ALLOC", SEC_ALLOC },
+ { "LOAD", SEC_LOAD },
+ { "RELOC", SEC_RELOC },
+ { "READONLY", SEC_READONLY },
+ { "CODE", SEC_CODE },
+ { "DATA", SEC_DATA },
+ { "ROM", SEC_ROM },
+ { "CONSTRUCTOR", SEC_CONSTRUCTOR },
+ { "HAS_CONTENTS", SEC_HAS_CONTENTS },
+ { "NEVER_LOAD", SEC_NEVER_LOAD },
+ { "COFF_SHARED_LIBRARY", SEC_COFF_SHARED_LIBRARY },
+ { "IS_COMMON", SEC_IS_COMMON } };
/* For each flag in the global BFD_FLAG_INFO list, if FLAGS has a flag's
flagword value set, and STRING contains the flag's name then return
@@ -200,8 +194,7 @@ match_bfd_flags (const char *string, flagword flags)
for (const auto &f : bfd_flag_info)
{
- if (flags & f.value
- && match_substring (string, f.name))
+ if (flags & f.value && match_substring (string, f.name))
return true;
}
@@ -222,14 +215,13 @@ print_bfd_flags (flagword flags)
}
static void
-maint_print_section_info (const char *name, flagword flags,
- CORE_ADDR addr, CORE_ADDR endaddr,
- unsigned long filepos, int addr_size)
+maint_print_section_info (const char *name, flagword flags, CORE_ADDR addr,
+ CORE_ADDR endaddr, unsigned long filepos,
+ int addr_size)
{
gdb_printf (" %s", hex_string_custom (addr, addr_size));
gdb_printf ("->%s", hex_string_custom (endaddr, addr_size));
- gdb_printf (" at %s",
- hex_string_custom ((unsigned long) filepos, 8));
+ gdb_printf (" at %s", hex_string_custom ((unsigned long) filepos, 8));
gdb_printf (": %s", name);
print_bfd_flags (flags);
gdb_printf ("\n");
@@ -251,9 +243,7 @@ index_digits (int count)
be printed, and is used to pretty-print the resulting string. */
static void
-print_section_index (bfd *abfd,
- asection *asect,
- int index_digits)
+print_section_index (bfd *abfd, asection *asect, int index_digits)
{
std::string result
= string_printf (" [%d] ", gdb_bfd_section_index (abfd, asect));
@@ -276,8 +266,7 @@ print_bfd_section_info (bfd *abfd, asection *asect, const char *arg,
flagword flags = bfd_section_flags (asect);
const char *name = bfd_section_name (asect);
- if (arg == NULL || *arg == '\0'
- || match_substring (arg, name)
+ if (arg == NULL || *arg == '\0' || match_substring (arg, name)
|| match_bfd_flags (arg, flags))
{
struct gdbarch *gdbarch = gdbarch_from_bfd (abfd);
@@ -287,8 +276,8 @@ print_bfd_section_info (bfd *abfd, asection *asect, const char *arg,
addr = bfd_section_vma (asect);
endaddr = addr + bfd_section_size (asect);
print_section_index (abfd, asect, index_digits);
- maint_print_section_info (name, flags, addr, endaddr,
- asect->filepos, addr_size);
+ maint_print_section_info (name, flags, addr, endaddr, asect->filepos,
+ addr_size);
}
}
@@ -307,18 +296,15 @@ print_objfile_section_info (bfd *abfd, struct obj_section *asect,
flagword flags = bfd_section_flags (asect->the_bfd_section);
const char *name = bfd_section_name (asect->the_bfd_section);
- if (arg == NULL || *arg == '\0'
- || match_substring (arg, name)
+ if (arg == NULL || *arg == '\0' || match_substring (arg, name)
|| match_bfd_flags (arg, flags))
{
struct gdbarch *gdbarch = gdbarch_from_bfd (abfd);
int addr_size = gdbarch_addr_bit (gdbarch) / 8;
print_section_index (abfd, asect->the_bfd_section, index_digits);
- maint_print_section_info (name, flags,
- asect->addr (), asect->endaddr (),
- asect->the_bfd_section->filepos,
- addr_size);
+ maint_print_section_info (name, flags, asect->addr (), asect->endaddr (),
+ asect->the_bfd_section->filepos, addr_size);
}
}
@@ -327,8 +313,7 @@ print_objfile_section_info (bfd *abfd, struct obj_section *asect,
sections don't have such wrappers) in which case nullptr is returned. */
obj_section *
-maint_obj_section_from_bfd_section (bfd *abfd,
- asection *asection,
+maint_obj_section_from_bfd_section (bfd *abfd, asection *asection,
objfile *ofile)
{
if (ofile->sections == nullptr)
@@ -364,7 +349,7 @@ maint_print_all_sections (const char *header, bfd *abfd, objfile *objfile,
gdb_stdout->wrap_here (8);
gdb_printf ("`%s', ", bfd_get_filename (abfd));
gdb_stdout->wrap_here (8);
- gdb_printf (_("file type %s.\n"), bfd_get_target (abfd));
+ gdb_printf (_ ("file type %s.\n"), bfd_get_target (abfd));
int section_count = gdb_bfd_count_sections (abfd);
int digits = index_digits (section_count);
@@ -376,8 +361,7 @@ maint_print_all_sections (const char *header, bfd *abfd, objfile *objfile,
if (objfile != nullptr)
{
gdb_assert (objfile->sections != nullptr);
- osect
- = maint_obj_section_from_bfd_section (abfd, sect, objfile);
+ osect = maint_obj_section_from_bfd_section (abfd, sect, objfile);
if (osect->the_bfd_section == nullptr)
osect = nullptr;
}
@@ -402,7 +386,7 @@ static const gdb::option::option_def maint_info_sections_option_defs[] = {
gdb::option::flag_option_def<maint_info_sections_opts> {
"all-objects",
[] (maint_info_sections_opts *opts) { return &opts->all_objects; },
- N_("Display information from all loaded object files."),
+ N_ ("Display information from all loaded object files."),
},
};
@@ -412,20 +396,20 @@ static const gdb::option::option_def maint_info_sections_option_defs[] = {
static inline gdb::option::option_def_group
make_maint_info_sections_options_def_group (maint_info_sections_opts *cc_opts)
{
- return {{maint_info_sections_option_defs}, cc_opts};
+ return { { maint_info_sections_option_defs }, cc_opts };
}
/* Completion for the "maintenance info sections" command. */
static void
maint_info_sections_completer (struct cmd_list_element *cmd,
- completion_tracker &tracker,
- const char *text, const char * /* word */)
+ completion_tracker &tracker, const char *text,
+ const char * /* word */)
{
/* Complete command options. */
const auto group = make_maint_info_sections_options_def_group (nullptr);
- if (gdb::option::complete_options
- (tracker, &text, gdb::option::PROCESS_OPTIONS_UNKNOWN_IS_ERROR, group))
+ if (gdb::option::complete_options (
+ tracker, &text, gdb::option::PROCESS_OPTIONS_UNKNOWN_IS_ERROR, group))
return;
const char *word = advance_to_expression_complete_word_point (tracker, text);
@@ -446,21 +430,22 @@ maintenance_info_sections (const char *arg, int from_tty)
/* Check if the "-all-objects" flag was passed. */
maint_info_sections_opts opts;
const auto group = make_maint_info_sections_options_def_group (&opts);
- gdb::option::process_options
- (&arg, gdb::option::PROCESS_OPTIONS_UNKNOWN_IS_ERROR, group);
+ gdb::option::process_options (&arg,
+ gdb::option::PROCESS_OPTIONS_UNKNOWN_IS_ERROR,
+ group);
for (objfile *ofile : current_program_space->objfiles ())
{
if (ofile->obfd == current_program_space->exec_bfd ())
- maint_print_all_sections (_("Exec file: "), ofile->obfd.get (),
- ofile, arg);
+ maint_print_all_sections (_ ("Exec file: "), ofile->obfd.get (), ofile,
+ arg);
else if (opts.all_objects)
- maint_print_all_sections (_("Object file: "), ofile->obfd.get (),
+ maint_print_all_sections (_ ("Object file: "), ofile->obfd.get (),
ofile, arg);
}
if (core_bfd)
- maint_print_all_sections (_("Core file: "), core_bfd, nullptr, arg);
+ maint_print_all_sections (_ ("Core file: "), core_bfd, nullptr, arg);
}
/* Implement the "maintenance info target-sections" command. */
@@ -480,8 +465,8 @@ maintenance_info_target_sections (const char *arg, int from_tty)
if (abfd == nullptr || sec.the_bfd_section->owner != abfd)
{
abfd = sec.the_bfd_section->owner;
- digits = std::max (index_digits (gdb_bfd_count_sections (abfd)),
- digits);
+ digits
+ = std::max (index_digits (gdb_bfd_count_sections (abfd)), digits);
}
}
@@ -489,27 +474,22 @@ maintenance_info_target_sections (const char *arg, int from_tty)
int addr_size = 0;
abfd = nullptr;
for (const target_section &sec : *table)
- {
+ {
if (sec.the_bfd_section->owner != abfd)
{
abfd = sec.the_bfd_section->owner;
gdbarch = gdbarch_from_bfd (abfd);
addr_size = gdbarch_addr_bit (gdbarch) / 8;
- gdb_printf (_("From '%s', file type %s:\n"),
+ gdb_printf (_ ("From '%s', file type %s:\n"),
bfd_get_filename (abfd), bfd_get_target (abfd));
}
- print_bfd_section_info (abfd,
- sec.the_bfd_section,
- nullptr,
- digits);
+ print_bfd_section_info (abfd, sec.the_bfd_section, nullptr, digits);
/* The magic '8 + digits' here ensures that the 'Start' is aligned
with the output of print_bfd_section_info. */
- gdb_printf ("%*sStart: %s, End: %s, Owner token: %p\n",
- (8 + digits), "",
+ gdb_printf ("%*sStart: %s, End: %s, Owner token: %p\n", (8 + digits), "",
hex_string_custom (sec.addr, addr_size),
- hex_string_custom (sec.endaddr, addr_size),
- sec.owner);
+ hex_string_custom (sec.endaddr, addr_size), sec.owner);
}
}
@@ -531,7 +511,7 @@ maintenance_print_architecture (const char *args, int from_tty)
stdio_file file;
if (!file.open (args, "w"))
- perror_with_name (_("maintenance print architecture"));
+ perror_with_name (_ ("maintenance print architecture"));
gdbarch_dump (gdbarch, &file);
}
}
@@ -550,17 +530,17 @@ maintenance_translate_address (const char *arg, int from_tty)
struct bound_minimal_symbol sym;
if (arg == NULL || *arg == 0)
- error (_("requires argument (address or section + address)"));
+ error (_ ("requires argument (address or section + address)"));
sect = NULL;
p = arg;
if (!isdigit (*p))
- { /* See if we have a valid section name. */
- while (*p && !isspace (*p)) /* Find end of section name. */
+ { /* See if we have a valid section name. */
+ while (*p && !isspace (*p)) /* Find end of section name. */
p++;
- if (*p == '\000') /* End of command? */
- error (_("Need to specify section name and address"));
+ if (*p == '\000') /* End of command? */
+ error (_ ("Need to specify section name and address"));
int arg_len = p - arg;
p = skip_spaces (p + 1);
@@ -572,8 +552,8 @@ maintenance_translate_address (const char *arg, int from_tty)
goto found;
}
- error (_("Unknown section %s."), arg);
- found: ;
+ error (_ ("Unknown section %s."), arg);
+ found:;
}
address = parse_and_eval_address (p);
@@ -586,8 +566,7 @@ maintenance_translate_address (const char *arg, int from_tty)
if (sym.minsym)
{
const char *symbol_name = sym.minsym->print_name ();
- const char *symbol_offset
- = pulongest (address - sym.value_address ());
+ const char *symbol_offset = pulongest (address - sym.value_address ());
sect = sym.obj_section ();
if (sect != NULL)
@@ -602,26 +581,24 @@ maintenance_translate_address (const char *arg, int from_tty)
obj_name = objfile_name (sect->objfile);
if (current_program_space->multi_objfile_p ())
- gdb_printf (_("%s + %s in section %s of %s\n"),
- symbol_name, symbol_offset,
- section_name, obj_name);
+ gdb_printf (_ ("%s + %s in section %s of %s\n"), symbol_name,
+ symbol_offset, section_name, obj_name);
else
- gdb_printf (_("%s + %s in section %s\n"),
- symbol_name, symbol_offset, section_name);
+ gdb_printf (_ ("%s + %s in section %s\n"), symbol_name,
+ symbol_offset, section_name);
}
else
- gdb_printf (_("%s + %s\n"), symbol_name, symbol_offset);
+ gdb_printf (_ ("%s + %s\n"), symbol_name, symbol_offset);
}
else if (sect)
- gdb_printf (_("no symbol at %s:%s\n"),
- sect->the_bfd_section->name, hex_string (address));
+ gdb_printf (_ ("no symbol at %s:%s\n"), sect->the_bfd_section->name,
+ hex_string (address));
else
- gdb_printf (_("no symbol at %s\n"), hex_string (address));
+ gdb_printf (_ ("no symbol at %s\n"), hex_string (address));
return;
}
-
/* When a command is deprecated the user will be warned the first time
the command is used. If possible, a replacement will be
offered. */
@@ -631,7 +608,7 @@ maintenance_deprecate (const char *args, int from_tty)
{
if (args == NULL || *args == '\0')
{
- gdb_printf (_("\"maintenance deprecate\" takes an argument,\n\
+ gdb_printf (_ ("\"maintenance deprecate\" takes an argument,\n\
the command you want to deprecate, and optionally the replacement command\n\
enclosed in quotes.\n"));
}
@@ -639,13 +616,12 @@ enclosed in quotes.\n"));
maintenance_do_deprecate (args, 1);
}
-
static void
maintenance_undeprecate (const char *args, int from_tty)
{
if (args == NULL || *args == '\0')
{
- gdb_printf (_("\"maintenance undeprecate\" takes an argument, \n\
+ gdb_printf (_ ("\"maintenance undeprecate\" takes an argument, \n\
the command you want to undeprecate.\n"));
}
@@ -676,7 +652,7 @@ maintenance_do_deprecate (const char *text, int deprecate)
if (!lookup_cmd_composition (text, &alias, &prefix_cmd, &cmd))
{
- gdb_printf (_("Can't find command '%s' to deprecate.\n"), text);
+ gdb_printf (_ ("Can't find command '%s' to deprecate.\n"), text);
return;
}
@@ -699,7 +675,6 @@ maintenance_do_deprecate (const char *text, int deprecate)
if (!start_ptr || !end_ptr)
replacement = NULL;
-
/* If they used an alias, we only want to deprecate the alias.
Note the MALLOCED_REPLACEMENT test. If the command's replacement
@@ -763,31 +738,32 @@ maintenance_with_cmd (const char *args, int from_tty)
static void
maintenance_with_cmd_completer (struct cmd_list_element *ignore,
- completion_tracker &tracker,
- const char *text, const char * /*word*/)
+ completion_tracker &tracker, const char *text,
+ const char * /*word*/)
{
- with_command_completer_1 ("maintenance set ", tracker, text);
+ with_command_completer_1 ("maintenance set ", tracker, text);
}
/* Profiling support. */
static bool maintenance_profile_p;
+
static void
show_maintenance_profile_p (struct ui_file *file, int from_tty,
struct cmd_list_element *c, const char *value)
{
- gdb_printf (file, _("Internal profiling is %s.\n"), value);
+ gdb_printf (file, _ ("Internal profiling is %s.\n"), value);
}
#ifdef HAVE__ETEXT
extern char _etext;
#define TEXTEND &_etext
-#elif defined (HAVE_ETEXT)
+#elif defined(HAVE_ETEXT)
extern char etext;
#define TEXTEND &etext
#endif
-#if defined (HAVE_MONSTARTUP) && defined (HAVE__MCLEANUP) && defined (TEXTEND)
+#if defined(HAVE_MONSTARTUP) && defined(HAVE__MCLEANUP) && defined(TEXTEND)
static int profiling_state;
@@ -838,7 +814,7 @@ static void
maintenance_set_profile_cmd (const char *args, int from_tty,
struct cmd_list_element *c)
{
- error (_("Profiling support is not available on this system."));
+ error (_ ("Profiling support is not available on this system."));
}
#endif
@@ -867,14 +843,14 @@ maintenance_set_worker_threads (const char *args, int from_tty,
static void
maintenance_show_worker_threads (struct ui_file *file, int from_tty,
- struct cmd_list_element *c,
- const char *value)
+ struct cmd_list_element *c, const char *value)
{
#if CXX_STD_THREAD
if (n_worker_threads == -1)
{
- gdb_printf (file, _("The number of worker threads GDB "
- "can use is unlimited (currently %zu).\n"),
+ gdb_printf (file,
+ _ ("The number of worker threads GDB "
+ "can use is unlimited (currently %zu).\n"),
gdb::thread_pool::g_thread_pool->thread_count ());
return;
}
@@ -884,12 +860,12 @@ maintenance_show_worker_threads (struct ui_file *file, int from_tty,
#if CXX_STD_THREAD
report_threads = n_worker_threads;
#endif
- gdb_printf (file, _("The number of worker threads GDB "
- "can use is %d.\n"),
+ gdb_printf (file,
+ _ ("The number of worker threads GDB "
+ "can use is %d.\n"),
report_threads);
}
-
/* If true, display time usage both at startup and for each command. */
static bool per_command_time;
@@ -969,15 +945,13 @@ scoped_command_stats::~scoped_command_stats ()
we don't know yet whether we will be reporting the stats. For the
startup case collect the data anyway (it should be cheap at this point),
and leave it to the reporter to decide whether to print them. */
- if (m_msg_type
- && !per_command_time
- && !per_command_space
+ if (m_msg_type && !per_command_time && !per_command_space
&& !per_command_symtab)
return;
if (m_time_enabled && per_command_time)
{
- print_time (_("command finished"));
+ print_time (_ ("command finished"));
using namespace std::chrono;
@@ -991,8 +965,8 @@ scoped_command_stats::~scoped_command_stats ()
gdb_printf (gdb_stdlog,
!m_msg_type
- ? _("Startup time: %.6f (cpu), %.6f (wall)\n")
- : _("Command execution time: %.6f (cpu), %.6f (wall)\n"),
+ ? _ ("Startup time: %.6f (cpu), %.6f (wall)\n")
+ : _ ("Command execution time: %.6f (cpu), %.6f (wall)\n"),
duration<double> (cmd_time).count (),
duration<double> (wall_time).count ());
}
@@ -1007,11 +981,9 @@ scoped_command_stats::~scoped_command_stats ()
gdb_printf (gdb_stdlog,
!m_msg_type
- ? _("Space used: %ld (%s%ld during startup)\n")
- : _("Space used: %ld (%s%ld for this command)\n"),
- space_now,
- (space_diff >= 0 ? "+" : ""),
- space_diff);
+ ? _ ("Space used: %ld (%s%ld during startup)\n")
+ : _ ("Space used: %ld (%s%ld for this command)\n"),
+ space_now, (space_diff >= 0 ? "+" : ""), space_diff);
#endif
}
@@ -1021,21 +993,18 @@ scoped_command_stats::~scoped_command_stats ()
count_symtabs_and_blocks (&nr_symtabs, &nr_compunit_symtabs, &nr_blocks);
gdb_printf (gdb_stdlog,
- _("#symtabs: %d (+%d),"
- " #compunits: %d (+%d),"
- " #blocks: %d (+%d)\n"),
- nr_symtabs,
- nr_symtabs - m_start_nr_symtabs,
+ _ ("#symtabs: %d (+%d),"
+ " #compunits: %d (+%d),"
+ " #blocks: %d (+%d)\n"),
+ nr_symtabs, nr_symtabs - m_start_nr_symtabs,
nr_compunit_symtabs,
- (nr_compunit_symtabs
- - m_start_nr_compunit_symtabs),
- nr_blocks,
- nr_blocks - m_start_nr_blocks);
+ (nr_compunit_symtabs - m_start_nr_compunit_symtabs),
+ nr_blocks, nr_blocks - m_start_nr_blocks);
}
}
scoped_command_stats::scoped_command_stats (bool msg_type)
-: m_msg_type (msg_type)
+ : m_msg_type (msg_type)
{
if (!m_msg_type || per_command_space)
{
@@ -1057,7 +1026,7 @@ scoped_command_stats::scoped_command_stats (bool msg_type)
m_time_enabled = true;
if (per_command_time)
- print_time (_("command started"));
+ print_time (_ ("command started"));
}
else
m_time_enabled = false;
@@ -1111,7 +1080,7 @@ set_per_command_cmd (const char *args, int from_tty)
val = parse_cli_boolean_value (args);
if (val < 0)
- error (_("Bad value for 'mt set per-command no'."));
+ error (_ ("Bad value for 'mt set per-command no'."));
for (list = per_command_setlist; list != NULL; list = list->next)
if (list->var->type () == var_boolean)
@@ -1133,9 +1102,9 @@ static const gdb::option::option_def maintenance_selftest_option_defs[] = {
"verbose",
[] (maintenance_selftest_options *opt) { return &opt->verbose; },
nullptr,
- N_("Set whether selftests run in verbose mode."),
- N_("Show whether selftests run in verbose mode."),
- N_("\
+ N_ ("Set whether selftests run in verbose mode."),
+ N_ ("Show whether selftests run in verbose mode."),
+ N_ ("\
When on, selftests may print verbose information."),
},
};
@@ -1145,9 +1114,9 @@ When on, selftests may print verbose information."),
static std::array<gdb::option::option_def_group, 1>
make_maintenance_selftest_option_group (maintenance_selftest_options *opts)
{
- return {{
- {{maintenance_selftest_option_defs}, opts},
- }};
+ return { {
+ { { maintenance_selftest_option_defs }, opts },
+ } };
}
/* The "maintenance selftest" command. */
@@ -1158,12 +1127,13 @@ maintenance_selftest (const char *args, int from_tty)
#if GDB_SELF_TEST
maintenance_selftest_options opts = user_maintenance_selftest_options;
auto grp = make_maintenance_selftest_option_group (&opts);
- gdb::option::process_options
- (&args, gdb::option::PROCESS_OPTIONS_UNKNOWN_IS_ERROR, grp);
+ gdb::option::process_options (&args,
+ gdb::option::PROCESS_OPTIONS_UNKNOWN_IS_ERROR,
+ grp);
const gdb_argv argv (args);
selftests::run_tests (argv.as_array_view (), opts.verbose);
#else
- gdb_printf (_("\
+ gdb_printf (_ ("\
Selftests have been disabled for this build.\n"));
#endif
}
@@ -1172,14 +1142,13 @@ Selftests have been disabled for this build.\n"));
static void
maintenance_selftest_completer (cmd_list_element *cmd,
- completion_tracker &tracker,
- const char *text,
+ completion_tracker &tracker, const char *text,
const char *word)
{
auto grp = make_maintenance_selftest_option_group (nullptr);
- if (gdb::option::complete_options
- (tracker, &text, gdb::option::PROCESS_OPTIONS_UNKNOWN_IS_ERROR, grp))
+ if (gdb::option::complete_options (
+ tracker, &text, gdb::option::PROCESS_OPTIONS_UNKNOWN_IS_ERROR, grp))
return;
#if GDB_SELF_TEST
@@ -1199,39 +1168,37 @@ maintenance_info_selftests (const char *arg, int from_tty)
for (const auto &test : selftests::all_selftests ())
gdb_printf (" - %s\n", test.name.c_str ());
#else
- gdb_printf (_("\
+ gdb_printf (_ ("\
Selftests have been disabled for this build.\n"));
#endif
}
-
void _initialize_maint_cmds ();
+
void
_initialize_maint_cmds ()
{
struct cmd_list_element *cmd;
cmd_list_element *maintenance_cmd
- = add_basic_prefix_cmd ("maintenance", class_maintenance, _("\
+ = add_basic_prefix_cmd ("maintenance", class_maintenance, _ ("\
Commands for use by GDB maintainers.\n\
Includes commands to dump specific internal GDB structures in\n\
a human readable form, to cause GDB to deliberately dump core, etc."),
- &maintenancelist, 0,
- &cmdlist);
+ &maintenancelist, 0, &cmdlist);
add_com_alias ("mt", maintenance_cmd, class_maintenance, 1);
cmd_list_element *maintenance_info_cmd
- = add_basic_prefix_cmd ("info", class_maintenance, _("\
+ = add_basic_prefix_cmd ("info", class_maintenance, _ ("\
Commands for showing internal info about the program being debugged."),
- &maintenanceinfolist, 0,
- &maintenancelist);
+ &maintenanceinfolist, 0, &maintenancelist);
add_alias_cmd ("i", maintenance_info_cmd, class_maintenance, 1,
&maintenancelist);
const auto opts = make_maint_info_sections_options_def_group (nullptr);
static std::string maint_info_sections_command_help
- = gdb::option::build_help (_("\
+ = gdb::option::build_help (_ ("\
List the BFD sections of the exec and core files.\n\
\n\
Usage: maintenance info sections [-all-objects] [FILTERS]\n\
@@ -1247,14 +1214,15 @@ Sections matching any of the FILTERS will be listed (no FILTERS implies\n\
all sections should be printed).\n\
\n\
Options:\n\
-%OPTIONS%"), opts);
+%OPTIONS%"),
+ opts);
cmd = add_cmd ("sections", class_maintenance, maintenance_info_sections,
maint_info_sections_command_help.c_str (),
&maintenanceinfolist);
set_cmd_completer_handle_brkchars (cmd, maint_info_sections_completer);
add_cmd ("target-sections", class_maintenance,
- maintenance_info_target_sections, _("\
+ maintenance_info_target_sections, _ ("\
List GDB's internal section table.\n\
\n\
Print the current targets section list. This is a sub-set of all\n\
@@ -1262,31 +1230,29 @@ sections, from all objects currently loaded. Usually the ALLOC\n\
sectoins."),
&maintenanceinfolist);
- add_basic_prefix_cmd ("print", class_maintenance,
- _("Maintenance command for printing GDB internal state."),
- &maintenanceprintlist, 0,
- &maintenancelist);
+ add_basic_prefix_cmd (
+ "print", class_maintenance,
+ _ ("Maintenance command for printing GDB internal state."),
+ &maintenanceprintlist, 0, &maintenancelist);
- add_basic_prefix_cmd ("flush", class_maintenance,
- _("Maintenance command for flushing GDB internal caches."),
- &maintenanceflushlist, 0,
- &maintenancelist);
+ add_basic_prefix_cmd (
+ "flush", class_maintenance,
+ _ ("Maintenance command for flushing GDB internal caches."),
+ &maintenanceflushlist, 0, &maintenancelist);
- add_basic_prefix_cmd ("set", class_maintenance, _("\
+ add_basic_prefix_cmd ("set", class_maintenance, _ ("\
Set GDB internal variables used by the GDB maintainer.\n\
Configure variables internal to GDB that aid in GDB's maintenance"),
- &maintenance_set_cmdlist,
- 0/*allow-unknown*/,
+ &maintenance_set_cmdlist, 0 /*allow-unknown*/,
&maintenancelist);
- add_show_prefix_cmd ("show", class_maintenance, _("\
+ add_show_prefix_cmd ("show", class_maintenance, _ ("\
Show GDB internal variables used by the GDB maintainer.\n\
Configure variables internal to GDB that aid in GDB's maintenance"),
- &maintenance_show_cmdlist,
- 0/*allow-unknown*/,
+ &maintenance_show_cmdlist, 0 /*allow-unknown*/,
&maintenancelist);
- cmd = add_cmd ("with", class_maintenance, maintenance_with_cmd, _("\
+ cmd = add_cmd ("with", class_maintenance, maintenance_with_cmd, _ ("\
Like \"with\", but works with \"maintenance set\" variables.\n\
Usage: maintenance with SETTING [VALUE] [-- COMMAND]\n\
With no COMMAND, repeats the last executed command.\n\
@@ -1296,79 +1262,81 @@ subcommands."),
set_cmd_completer_handle_brkchars (cmd, maintenance_with_cmd_completer);
#ifndef _WIN32
- add_cmd ("dump-me", class_maintenance, maintenance_dump_me, _("\
+ add_cmd ("dump-me", class_maintenance, maintenance_dump_me, _ ("\
Get fatal error; make debugger dump its core.\n\
GDB sets its handling of SIGQUIT back to SIG_DFL and then sends\n\
itself a SIGQUIT signal."),
&maintenancelist);
#endif
- add_cmd ("internal-error", class_maintenance,
- maintenance_internal_error, _("\
+ add_cmd ("internal-error", class_maintenance, maintenance_internal_error,
+ _ ("\
Give GDB an internal error.\n\
Cause GDB to behave as if an internal error was detected."),
&maintenancelist);
- add_cmd ("internal-warning", class_maintenance,
- maintenance_internal_warning, _("\
+ add_cmd ("internal-warning", class_maintenance, maintenance_internal_warning,
+ _ ("\
Give GDB an internal warning.\n\
Cause GDB to behave as if an internal warning was reported."),
&maintenancelist);
add_cmd ("demangler-warning", class_maintenance,
- maintenance_demangler_warning, _("\
+ maintenance_demangler_warning, _ ("\
Give GDB a demangler warning.\n\
Cause GDB to behave as if a demangler warning was reported."),
&maintenancelist);
- cmd = add_cmd ("demangle", class_maintenance, maintenance_demangle, _("\
+ cmd = add_cmd ("demangle", class_maintenance, maintenance_demangle, _ ("\
This command has been moved to \"demangle\"."),
&maintenancelist);
deprecate_cmd (cmd, "demangle");
- add_prefix_cmd ("per-command", class_maintenance, set_per_command_cmd, _("\
+ add_prefix_cmd ("per-command", class_maintenance, set_per_command_cmd, _ ("\
Per-command statistics settings."),
- &per_command_setlist,
- 1/*allow-unknown*/, &maintenance_set_cmdlist);
+ &per_command_setlist, 1 /*allow-unknown*/,
+ &maintenance_set_cmdlist);
- add_show_prefix_cmd ("per-command", class_maintenance, _("\
+ add_show_prefix_cmd ("per-command", class_maintenance, _ ("\
Show per-command statistics settings."),
- &per_command_showlist,
- 0/*allow-unknown*/, &maintenance_show_cmdlist);
+ &per_command_showlist, 0 /*allow-unknown*/,
+ &maintenance_show_cmdlist);
- add_setshow_boolean_cmd ("time", class_maintenance,
- &per_command_time, _("\
-Set whether to display per-command execution time."), _("\
+ add_setshow_boolean_cmd ("time", class_maintenance, &per_command_time, _ ("\
+Set whether to display per-command execution time."),
+ _ ("\
Show whether to display per-command execution time."),
- _("\
+ _ ("\
If enabled, the execution time for each command will be\n\
displayed following the command's output."),
- NULL, NULL,
- &per_command_setlist, &per_command_showlist);
+ NULL, NULL, &per_command_setlist,
+ &per_command_showlist);
- add_setshow_boolean_cmd ("space", class_maintenance,
- &per_command_space, _("\
-Set whether to display per-command space usage."), _("\
+ add_setshow_boolean_cmd ("space", class_maintenance, &per_command_space,
+ _ ("\
+Set whether to display per-command space usage."),
+ _ ("\
Show whether to display per-command space usage."),
- _("\
+ _ ("\
If enabled, the space usage for each command will be\n\
displayed following the command's output."),
- NULL, NULL,
- &per_command_setlist, &per_command_showlist);
+ NULL, NULL, &per_command_setlist,
+ &per_command_showlist);
- add_setshow_boolean_cmd ("symtab", class_maintenance,
- &per_command_symtab, _("\
-Set whether to display per-command symtab statistics."), _("\
+ add_setshow_boolean_cmd ("symtab", class_maintenance, &per_command_symtab,
+ _ ("\
+Set whether to display per-command symtab statistics."),
+ _ ("\
Show whether to display per-command symtab statistics."),
- _("\
+ _ ("\
If enabled, the basic symtab statistics for each command will be\n\
displayed following the command's output."),
- NULL, NULL,
- &per_command_setlist, &per_command_showlist);
+ NULL, NULL, &per_command_setlist,
+ &per_command_showlist);
/* This is equivalent to "mt set per-command time on".
Kept because some people are used to typing "mt time 1". */
- add_cmd ("time", class_maintenance, maintenance_time_display, _("\
+ add_cmd ("time", class_maintenance, maintenance_time_display, _ ("\
Set the display of time usage.\n\
If nonzero, will cause the execution time for each command to be\n\
displayed, following the command's output."),
@@ -1376,47 +1344,47 @@ displayed, following the command's output."),
/* This is equivalent to "mt set per-command space on".
Kept because some people are used to typing "mt space 1". */
- add_cmd ("space", class_maintenance, maintenance_space_display, _("\
+ add_cmd ("space", class_maintenance, maintenance_space_display, _ ("\
Set the display of space usage.\n\
If nonzero, will cause the execution space for each command to be\n\
displayed, following the command's output."),
&maintenancelist);
- cmd = add_cmd ("type", class_maintenance, maintenance_print_type, _("\
+ cmd = add_cmd ("type", class_maintenance, maintenance_print_type, _ ("\
Print a type chain for a given symbol.\n\
For each node in a type chain, print the raw data for each member of\n\
the type structure, and the interpretation of the data."),
- &maintenanceprintlist);
+ &maintenanceprintlist);
set_cmd_completer (cmd, expression_completer);
add_cmd ("statistics", class_maintenance, maintenance_print_statistics,
- _("Print statistics about internal gdb state."),
+ _ ("Print statistics about internal gdb state."),
&maintenanceprintlist);
- add_cmd ("architecture", class_maintenance,
- maintenance_print_architecture, _("\
+ add_cmd ("architecture", class_maintenance, maintenance_print_architecture,
+ _ ("\
Print the internal architecture configuration.\n\
Takes an optional file parameter."),
&maintenanceprintlist);
- add_basic_prefix_cmd ("check", class_maintenance, _("\
+ add_basic_prefix_cmd ("check", class_maintenance, _ ("\
Commands for checking internal gdb state."),
- &maintenancechecklist, 0,
- &maintenancelist);
+ &maintenancechecklist, 0, &maintenancelist);
add_cmd ("translate-address", class_maintenance,
maintenance_translate_address,
- _("Translate a section name and address to a symbol."),
+ _ ("Translate a section name and address to a symbol."),
&maintenancelist);
- add_cmd ("deprecate", class_maintenance, maintenance_deprecate, _("\
+ add_cmd ("deprecate", class_maintenance, maintenance_deprecate, _ ("\
Deprecate a command (for testing purposes).\n\
Usage: maintenance deprecate COMMANDNAME [\"REPLACEMENT\"]\n\
This is used by the testsuite to check the command deprecator.\n\
You probably shouldn't use this,\n\
-rather you should use the C function deprecate_cmd()."), &maintenancelist);
+rather you should use the C function deprecate_cmd()."),
+ &maintenancelist);
- add_cmd ("undeprecate", class_maintenance, maintenance_undeprecate, _("\
+ add_cmd ("undeprecate", class_maintenance, maintenance_undeprecate, _ ("\
Undeprecate a command (for testing purposes).\n\
Usage: maintenance undeprecate COMMANDNAME\n\
This is used by the testsuite to check the command deprecator.\n\
@@ -1424,7 +1392,7 @@ You probably shouldn't use this."),
&maintenancelist);
cmd_list_element *maintenance_selftest_cmd
- = add_cmd ("selftest", class_maintenance, maintenance_selftest, _("\
+ = add_cmd ("selftest", class_maintenance, maintenance_selftest, _ ("\
Run gdb's unit tests.\n\
Usage: maintenance selftest [FILTER]\n\
This will run any unit tests that were built in to gdb.\n\
@@ -1434,23 +1402,26 @@ If a filter is given, only the tests with that value in their name will ran."),
maintenance_selftest_completer);
add_cmd ("selftests", class_maintenance, maintenance_info_selftests,
- _("List the registered selftests."), &maintenanceinfolist);
+ _ ("List the registered selftests."), &maintenanceinfolist);
add_setshow_boolean_cmd ("profile", class_maintenance,
- &maintenance_profile_p, _("\
-Set internal profiling."), _("\
-Show internal profiling."), _("\
+ &maintenance_profile_p, _ ("\
+Set internal profiling."),
+ _ ("\
+Show internal profiling."),
+ _ ("\
When enabled GDB is profiled."),
maintenance_set_profile_cmd,
show_maintenance_profile_p,
&maintenance_set_cmdlist,
&maintenance_show_cmdlist);
- add_setshow_zuinteger_unlimited_cmd ("worker-threads",
- class_maintenance,
- &n_worker_threads, _("\
-Set the number of worker threads GDB can use."), _("\
-Show the number of worker threads GDB can use."), _("\
+ add_setshow_zuinteger_unlimited_cmd ("worker-threads", class_maintenance,
+ &n_worker_threads, _ ("\
+Set the number of worker threads GDB can use."),
+ _ ("\
+Show the number of worker threads GDB can use."),
+ _ ("\
GDB may use multiple threads to speed up certain CPU-intensive operations,\n\
such as demangling symbol names."),
maintenance_set_worker_threads,
@@ -1463,17 +1434,16 @@ such as demangling symbol names."),
static cmd_list_element *show_selftest_cmdlist = nullptr;
add_setshow_prefix_cmd ("selftest", class_maintenance,
- _("Self tests-related settings."),
- _("Self tests-related settings."),
+ _ ("Self tests-related settings."),
+ _ ("Self tests-related settings."),
&set_selftest_cmdlist, &show_selftest_cmdlist,
&maintenance_set_cmdlist, &maintenance_show_cmdlist);
/* Add setting commands matching "maintenance selftest" options. */
- gdb::option::add_setshow_cmds_for_options (class_maintenance,
- &user_maintenance_selftest_options,
- maintenance_selftest_option_defs,
- &set_selftest_cmdlist,
- &show_selftest_cmdlist);
+ gdb::option::add_setshow_cmds_for_options (
+ class_maintenance, &user_maintenance_selftest_options,
+ maintenance_selftest_option_defs, &set_selftest_cmdlist,
+ &show_selftest_cmdlist);
update_thread_pool_size ();
}
diff --git a/gdb/maint.h b/gdb/maint.h
index 1741d132567..686b594471b 100644
--- a/gdb/maint.h
+++ b/gdb/maint.h
@@ -31,12 +31,12 @@ extern void set_per_command_space (int);
class scoped_command_stats
{
- public:
+public:
explicit scoped_command_stats (bool msg_type);
~scoped_command_stats ();
- private:
+private:
DISABLE_COPY_AND_ASSIGN (scoped_command_stats);
diff --git a/gdb/mdebugread.c b/gdb/mdebugread.c
index 609b51727aa..2ca9fc76d0f 100644
--- a/gdb/mdebugread.c
+++ b/gdb/mdebugread.c
@@ -60,11 +60,11 @@
#include "bfd.h"
-#include "coff/ecoff.h" /* COFF-like aspects of ecoff files. */
+#include "coff/ecoff.h" /* COFF-like aspects of ecoff files. */
-#include "libaout.h" /* Private BFD a.out information. */
+#include "libaout.h" /* Private BFD a.out information. */
#include "aout/aout64.h"
-#include "aout/stab_gnu.h" /* STABS information. */
+#include "aout/stab_gnu.h" /* STABS information. */
#include "expression.h"
@@ -74,92 +74,85 @@
We use this define in order to know whether we should override a
symbol's ECOFF section with its ELF section. This is necessary in
case the symbol's ELF section could not be represented in ECOFF. */
-#define ECOFF_IN_ELF(bfd) (bfd_get_flavour (bfd) == bfd_target_elf_flavour \
- && bfd_get_section_by_name (bfd, ".mdebug") != NULL)
+#define ECOFF_IN_ELF(bfd) \
+ (bfd_get_flavour (bfd) == bfd_target_elf_flavour \
+ && bfd_get_section_by_name (bfd, ".mdebug") != NULL)
/* The objfile we are currently reading. */
static struct objfile *mdebugread_objfile;
-
-
/* We put a pointer to this structure in the read_symtab_private field
of the psymtab. */
struct md_symloc
- {
- /* Index of the FDR that this psymtab represents. */
- int fdr_idx;
- /* The BFD that the psymtab was created from. */
- bfd *cur_bfd;
- const struct ecoff_debug_swap *debug_swap;
- struct ecoff_debug_info *debug_info;
- struct mdebug_pending **pending_list;
- /* Pointer to external symbols for this file. */
- EXTR *extern_tab;
- /* Size of extern_tab. */
- int extern_count;
- enum language pst_language;
- };
-
-#define PST_PRIVATE(p) ((struct md_symloc *)(p)->read_symtab_private)
-#define FDR_IDX(p) (PST_PRIVATE(p)->fdr_idx)
-#define CUR_BFD(p) (PST_PRIVATE(p)->cur_bfd)
-#define DEBUG_SWAP(p) (PST_PRIVATE(p)->debug_swap)
-#define DEBUG_INFO(p) (PST_PRIVATE(p)->debug_info)
-#define PENDING_LIST(p) (PST_PRIVATE(p)->pending_list)
-
-#define SC_IS_TEXT(sc) ((sc) == scText \
- || (sc) == scRConst \
- || (sc) == scInit \
- || (sc) == scFini)
-#define SC_IS_DATA(sc) ((sc) == scData \
- || (sc) == scSData \
- || (sc) == scRData \
- || (sc) == scPData \
- || (sc) == scXData)
+{
+ /* Index of the FDR that this psymtab represents. */
+ int fdr_idx;
+ /* The BFD that the psymtab was created from. */
+ bfd *cur_bfd;
+ const struct ecoff_debug_swap *debug_swap;
+ struct ecoff_debug_info *debug_info;
+ struct mdebug_pending **pending_list;
+ /* Pointer to external symbols for this file. */
+ EXTR *extern_tab;
+ /* Size of extern_tab. */
+ int extern_count;
+ enum language pst_language;
+};
+
+#define PST_PRIVATE(p) ((struct md_symloc *) (p)->read_symtab_private)
+#define FDR_IDX(p) (PST_PRIVATE (p)->fdr_idx)
+#define CUR_BFD(p) (PST_PRIVATE (p)->cur_bfd)
+#define DEBUG_SWAP(p) (PST_PRIVATE (p)->debug_swap)
+#define DEBUG_INFO(p) (PST_PRIVATE (p)->debug_info)
+#define PENDING_LIST(p) (PST_PRIVATE (p)->pending_list)
+
+#define SC_IS_TEXT(sc) \
+ ((sc) == scText || (sc) == scRConst || (sc) == scInit || (sc) == scFini)
+#define SC_IS_DATA(sc) \
+ ((sc) == scData || (sc) == scSData || (sc) == scRData || (sc) == scPData \
+ || (sc) == scXData)
#define SC_IS_COMMON(sc) ((sc) == scCommon || (sc) == scSCommon)
#define SC_IS_BSS(sc) ((sc) == scBss)
#define SC_IS_SBSS(sc) ((sc) == scSBss)
#define SC_IS_UNDEF(sc) ((sc) == scUndefined || (sc) == scSUndefined)
-
+
/* Various complaints about symbol reading that don't abort the process. */
static void
index_complaint (const char *arg1)
{
- complaint (_("bad aux index at symbol %s"), arg1);
+ complaint (_ ("bad aux index at symbol %s"), arg1);
}
static void
unknown_ext_complaint (const char *arg1)
{
- complaint (_("unknown external symbol %s"), arg1);
+ complaint (_ ("unknown external symbol %s"), arg1);
}
static void
basic_type_complaint (int arg1, const char *arg2)
{
- complaint (_("cannot map ECOFF basic type 0x%x for %s"),
- arg1, arg2);
+ complaint (_ ("cannot map ECOFF basic type 0x%x for %s"), arg1, arg2);
}
static void
bad_tag_guess_complaint (const char *arg1)
{
- complaint (_("guessed tag type of %s incorrectly"), arg1);
+ complaint (_ ("guessed tag type of %s incorrectly"), arg1);
}
static void
bad_rfd_entry_complaint (const char *arg1, int arg2, int arg3)
{
- complaint (_("bad rfd entry for %s: file %d, index %d"),
- arg1, arg2, arg3);
+ complaint (_ ("bad rfd entry for %s: file %d, index %d"), arg1, arg2, arg3);
}
static void
unexpected_type_code_complaint (const char *arg1)
{
- complaint (_("unexpected type code for %s"), arg1);
+ complaint (_ ("unexpected type code for %s"), arg1);
}
/* Macros and extra defs. */
@@ -167,10 +160,11 @@ unexpected_type_code_complaint (const char *arg1)
/* Puns: hard to find whether -g was used and how. */
#define MIN_GLEVEL GLEVEL_0
-#define compare_glevel(a,b) \
- (((a) == GLEVEL_3) ? ((b) < GLEVEL_3) : \
- ((b) == GLEVEL_3) ? -1 : (int)((b) - (a)))
-
+#define compare_glevel(a, b) \
+ (((a) == GLEVEL_3) ? ((b) < GLEVEL_3) \
+ : ((b) == GLEVEL_3) ? -1 \
+ : (int) ((b) - (a)))
+
/* Things that really are local to this module. */
/* Remember what we deduced to be the source language of this psymtab. */
@@ -218,11 +212,10 @@ static int found_ecoff_debugging_info;
/* Forward declarations. */
-static int upgrade_type (int, struct type **, int, union aux_ext *,
- int, const char *);
+static int upgrade_type (int, struct type **, int, union aux_ext *, int,
+ const char *);
-static void parse_partial_symbols (minimal_symbol_reader &,
- psymtab_storage *,
+static void parse_partial_symbols (minimal_symbol_reader &, psymtab_storage *,
struct objfile *);
static int has_opaque_xref (FDR *, SYMR *);
@@ -234,18 +227,23 @@ static struct symbol *new_symbol (const char *);
static struct type *new_type (char *);
-enum block_type { FUNCTION_BLOCK, NON_FUNCTION_BLOCK };
+enum block_type
+{
+ FUNCTION_BLOCK,
+ NON_FUNCTION_BLOCK
+};
static struct block *new_block (enum block_type, enum language);
-static struct compunit_symtab *new_symtab (const char *, int, struct objfile *);
+static struct compunit_symtab *new_symtab (const char *, int,
+ struct objfile *);
static struct linetable *new_linetable (int);
static struct blockvector *new_bvect (int);
-static struct type *parse_type (int, union aux_ext *, unsigned int, int *,
- int, const char *);
+static struct type *parse_type (int, union aux_ext *, unsigned int, int *, int,
+ const char *);
static struct symbol *mylookup_symbol (const char *, const struct block *,
domain_enum, enum address_class);
@@ -256,7 +254,7 @@ static legacy_psymtab *new_psymtab (const char *, psymtab_storage *,
struct objfile *);
static void mdebug_expand_psymtab (legacy_psymtab *pst,
- struct objfile *objfile);
+ struct objfile *objfile);
static void add_block (struct block *, struct symtab *);
@@ -267,11 +265,11 @@ static int add_line (struct linetable *, int, CORE_ADDR, int);
static struct linetable *shrink_linetable (struct linetable *);
static void handle_psymbol_enumerators (struct objfile *, psymtab_storage *,
- partial_symtab *,
- FDR *, int, CORE_ADDR);
+ partial_symtab *, FDR *, int,
+ CORE_ADDR);
static const char *mdebug_next_symbol_text (struct objfile *);
-
+
/* Exported procedure: Builds a symtab from the partial symtab SELF.
Restores the environment in effect when SELF was created, delegates
most of the work to an ancillary procedure, and sorts
@@ -288,7 +286,7 @@ mdebug_read_symtab (legacy_psymtab *self, struct objfile *objfile)
after all of the symtabs and dependencies have been read in. */
scan_file_globals (objfile);
}
-
+
/* File-level interface functions. */
/* Find a file descriptor given its index RF relative to a file CF. */
@@ -325,13 +323,11 @@ fdr_name (FDR *f)
return debug_info->ss + f->issBase + f->rss;
}
-
/* Read in and parse the symtab of the file OBJFILE. Symbols from
different sections are relocated via the SECTION_OFFSETS. */
void
-mdebug_build_psymtabs (minimal_symbol_reader &reader,
- struct objfile *objfile,
+mdebug_build_psymtabs (minimal_symbol_reader &reader, struct objfile *objfile,
const struct ecoff_debug_swap *swap,
struct ecoff_debug_info *info)
{
@@ -342,7 +338,7 @@ mdebug_build_psymtabs (minimal_symbol_reader &reader,
stabsread_new_init ();
free_header_files ();
init_header_files ();
-
+
/* Make sure all the FDR information is swapped in. */
if (info->fdr == NULL)
{
@@ -353,8 +349,8 @@ mdebug_build_psymtabs (minimal_symbol_reader &reader,
info->fdr = (FDR *) XOBNEWVEC (&objfile->objfile_obstack, FDR,
info->symbolic_header.ifdMax);
fdr_src = (char *) info->external_fdr;
- fdr_end = (fdr_src
- + info->symbolic_header.ifdMax * swap->external_fdr_size);
+ fdr_end
+ = (fdr_src + info->symbolic_header.ifdMax * swap->external_fdr_size);
fdr_ptr = info->fdr;
for (; fdr_src < fdr_end; fdr_src += swap->external_fdr_size, fdr_ptr++)
(*swap->swap_fdr_in) (objfile->obfd.get (), fdr_src, fdr_ptr);
@@ -379,46 +375,44 @@ mdebug_build_psymtabs (minimal_symbol_reader &reader,
}
#endif
}
-
+
/* Local utilities */
/* Map of FDR indexes to partial symtabs. */
struct pst_map
{
- legacy_psymtab *pst = nullptr; /* the psymtab proper */
- long n_globals = 0; /* exported globals (external symbols) */
- long globals_offset = 0; /* cumulative */
+ legacy_psymtab *pst = nullptr; /* the psymtab proper */
+ long n_globals = 0; /* exported globals (external symbols) */
+ long globals_offset = 0; /* cumulative */
};
-
/* Utility stack, used to nest procedures and blocks properly.
It is a doubly linked list, to avoid too many alloc/free.
Since we might need it quite a few times it is NOT deallocated
after use. */
static struct parse_stack
- {
- struct parse_stack *next, *prev;
- struct symtab *cur_st; /* Current symtab. */
- struct block *cur_block; /* Block in it. */
+{
+ struct parse_stack *next, *prev;
+ struct symtab *cur_st; /* Current symtab. */
+ struct block *cur_block; /* Block in it. */
- /* What are we parsing. stFile, or stBlock are for files and
+ /* What are we parsing. stFile, or stBlock are for files and
blocks. stProc or stStaticProc means we have seen the start of a
procedure, but not the start of the block within in. When we see
the start of that block, we change it to stNil, without pushing a
new block, i.e. stNil means both a procedure and a block. */
- int blocktype;
-
- struct type *cur_type; /* Type we parse fields for. */
- int cur_field; /* Field number in cur_type. */
- CORE_ADDR procadr; /* Start addres of this procedure. */
- int numargs; /* Its argument count. */
- }
+ int blocktype;
- *top_stack; /* Top stack ptr */
+ struct type *cur_type; /* Type we parse fields for. */
+ int cur_field; /* Field number in cur_type. */
+ CORE_ADDR procadr; /* Start addres of this procedure. */
+ int numargs; /* Its argument count. */
+}
+ *top_stack; /* Top stack ptr */
/* Enter a new lexical context. */
@@ -456,7 +450,6 @@ pop_parse_stack (void)
top_stack = top_stack->next;
}
-
/* Cross-references might be to things we haven't looked at
yet, e.g. type references. To avoid too many type
duplications we keep a quick fixup table, an array
@@ -464,12 +457,11 @@ pop_parse_stack (void)
struct mdebug_pending
{
- struct mdebug_pending *next; /* link */
- char *s; /* the unswapped symbol */
- struct type *t; /* its partial type descriptor */
+ struct mdebug_pending *next; /* link */
+ char *s; /* the unswapped symbol */
+ struct type *t; /* its partial type descriptor */
};
-
/* The pending information is kept for an entire object file. We
allocate the pending information table when we create the partial
symbols, and we store a pointer to the single table in each
@@ -510,15 +502,14 @@ add_pending (FDR *fh, char *sh, struct type *t)
pending_list[f_idx] = p;
}
}
-
/* Parsing Routines proper. */
static void
reg_value_complaint (int regnum, int num_regs, const char *sym)
{
- complaint (_("bad register number %d (max %d) in symbol %s"),
- regnum, num_regs - 1, sym);
+ complaint (_ ("bad register number %d (max %d) in symbol %s"), regnum,
+ num_regs - 1, sym);
}
/* Parse a single symbol. Mostly just make up a GDB symbol for it.
@@ -546,9 +537,8 @@ mdebug_reg_to_regnum (struct symbol *sym, struct gdbarch *gdbarch)
return regno;
}
-static const struct symbol_register_ops mdebug_register_funcs = {
- mdebug_reg_to_regnum
-};
+static const struct symbol_register_ops mdebug_register_funcs
+ = { mdebug_reg_to_regnum };
/* The "aclass" indices for computed symbols. */
@@ -558,17 +548,16 @@ static int mdebug_regparm_index;
/* Common code for symbols describing data. */
static void
-add_data_symbol (SYMR *sh, union aux_ext *ax, int bigend,
- struct symbol *s, int aclass_index, struct block *b,
- struct objfile *objfile, const char *name)
+add_data_symbol (SYMR *sh, union aux_ext *ax, int bigend, struct symbol *s,
+ int aclass_index, struct block *b, struct objfile *objfile,
+ const char *name)
{
s->set_domain (VAR_DOMAIN);
s->set_aclass_index (aclass_index);
add_symbol (s, top_stack->cur_st, b);
/* Type could be missing if file is compiled without debugging info. */
- if (SC_IS_UNDEF (sh->sc)
- || sh->sc == scNil || sh->index == indexNil)
+ if (SC_IS_UNDEF (sh->sc) || sh->sc == scNil || sh->index == indexNil)
s->set_type (objfile_type (objfile)->nodebug_data_symbol);
else
s->set_type (parse_type (cur_fd, ax, sh->index, 0, bigend, name));
@@ -631,7 +620,7 @@ parse_symbol (SYMR *sh, union aux_ext *ax, char *ext_sh, int bigend,
case stNil:
break;
- case stGlobal: /* External symbol, goes into global block. */
+ case stGlobal: /* External symbol, goes into global block. */
b = top_stack->cur_st->compunit ()->blockvector ()->global_block ();
s = new_symbol (name);
s->set_section_index (section_index);
@@ -639,7 +628,7 @@ parse_symbol (SYMR *sh, union aux_ext *ax, char *ext_sh, int bigend,
add_data_symbol (sh, ax, bigend, s, LOC_STATIC, b, objfile, name);
break;
- case stStatic: /* Static data, goes into current block. */
+ case stStatic: /* Static data, goes into current block. */
b = top_stack->cur_block;
s = new_symbol (name);
if (SC_IS_COMMON (sh->sc))
@@ -659,19 +648,18 @@ parse_symbol (SYMR *sh, union aux_ext *ax, char *ext_sh, int bigend,
add_data_symbol (sh, ax, bigend, s, LOC_STATIC, b, objfile, name);
break;
- case stLocal: /* Local variable, goes into current block. */
+ case stLocal: /* Local variable, goes into current block. */
b = top_stack->cur_block;
s = new_symbol (name);
s->set_value_longest (svalue);
if (sh->sc == scRegister)
- add_data_symbol (sh, ax, bigend, s, mdebug_register_index,
- b, objfile, name);
+ add_data_symbol (sh, ax, bigend, s, mdebug_register_index, b, objfile,
+ name);
else
- add_data_symbol (sh, ax, bigend, s, LOC_LOCAL,
- b, objfile, name);
+ add_data_symbol (sh, ax, bigend, s, LOC_LOCAL, b, objfile, name);
break;
- case stParam: /* Arg to procedure, goes into current
+ case stParam: /* Arg to procedure, goes into current
block. */
max_gdbinfo++;
found_ecoff_debugging_info = 1;
@@ -679,7 +667,7 @@ parse_symbol (SYMR *sh, union aux_ext *ax, char *ext_sh, int bigend,
/* Special GNU C++ name. */
if (is_cplus_marker (name[0]) && name[1] == 't' && name[2] == 0)
- name = "this"; /* FIXME, not alloc'd in obstack. */
+ name = "this"; /* FIXME, not alloc'd in obstack. */
s = new_symbol (name);
s->set_domain (VAR_DOMAIN);
@@ -708,18 +696,18 @@ parse_symbol (SYMR *sh, union aux_ext *ax, char *ext_sh, int bigend,
add_symbol (s, top_stack->cur_st, top_stack->cur_block);
break;
- case stLabel: /* label, goes into current block. */
+ case stLabel: /* label, goes into current block. */
s = new_symbol (name);
- s->set_domain (VAR_DOMAIN); /* So that it can be used */
- s->set_aclass_index (LOC_LABEL); /* but not misused. */
+ s->set_domain (VAR_DOMAIN); /* So that it can be used */
+ s->set_aclass_index (LOC_LABEL); /* but not misused. */
s->set_section_index (section_index);
s->set_value_address (sh->value);
s->set_type (objfile_type (objfile)->builtin_int);
add_symbol (s, top_stack->cur_st, top_stack->cur_block);
break;
- case stProc: /* Procedure, usually goes into global block. */
- case stStaticProc: /* Static procedure, goes into current block. */
+ case stProc: /* Procedure, usually goes into global block. */
+ case stStaticProc: /* Static procedure, goes into current block. */
/* For stProc symbol records, we need to check the storage class
as well, as only (stProc, scText) entries represent "real"
procedures - See the Compaq document titled "Object File /
@@ -739,14 +727,14 @@ parse_symbol (SYMR *sh, union aux_ext *ax, char *ext_sh, int bigend,
count++;
switch (tsym.st)
{
- case stParam:
- break;
- case stEnd:
- keep_counting = 0;
- break;
- default:
- complaint (_("unknown symbol type 0x%x"), sh->st);
- break;
+ case stParam:
+ break;
+ case stEnd:
+ keep_counting = 0;
+ break;
+ default:
+ complaint (_ ("unknown symbol type 0x%x"), sh->st);
+ break;
}
}
break;
@@ -761,8 +749,7 @@ parse_symbol (SYMR *sh, union aux_ext *ax, char *ext_sh, int bigend,
else
{
t = parse_type (cur_fd, ax, sh->index + 1, 0, bigend, name);
- if (strcmp (name, "malloc") == 0
- && t->code () == TYPE_CODE_VOID)
+ if (strcmp (name, "malloc") == 0 && t->code () == TYPE_CODE_VOID)
{
/* I don't know why, but, at least under Alpha GNU/Linux,
when linking against a malloc without debugging
@@ -834,23 +821,23 @@ parse_symbol (SYMR *sh, union aux_ext *ax, char *ext_sh, int bigend,
long max_value;
struct field *f;
- case stStruct: /* Start a block defining a struct type. */
+ case stStruct: /* Start a block defining a struct type. */
type_code = TYPE_CODE_STRUCT;
goto structured_common;
- case stUnion: /* Start a block defining a union type. */
+ case stUnion: /* Start a block defining a union type. */
type_code = TYPE_CODE_UNION;
goto structured_common;
- case stEnum: /* Start a block defining an enum type. */
+ case stEnum: /* Start a block defining an enum type. */
type_code = TYPE_CODE_ENUM;
goto structured_common;
- case stBlock: /* Either a lexical block, or some type. */
+ case stBlock: /* Either a lexical block, or some type. */
if (sh->sc != scInfo && !SC_IS_COMMON (sh->sc))
- goto case_stBlock_code; /* Lexical block */
+ goto case_stBlock_code; /* Lexical block */
- type_code = TYPE_CODE_UNDEF; /* We have a type. */
+ type_code = TYPE_CODE_UNDEF; /* We have a type. */
/* Common code for handling struct, union, enum, and/or as-yet-
unknown-type blocks of info about structured data. `type_code'
@@ -863,8 +850,7 @@ parse_symbol (SYMR *sh, union aux_ext *ax, char *ext_sh, int bigend,
/* First count the number of fields and the highest value. */
nfields = 0;
max_value = 0;
- for (ext_tsym = ext_sh + external_sym_size;
- ;
+ for (ext_tsym = ext_sh + external_sym_size;;
ext_tsym += external_sym_size)
{
SYMR tsym;
@@ -893,7 +879,8 @@ parse_symbol (SYMR *sh, union aux_ext *ax, char *ext_sh, int bigend,
is 0 (issNull). */
if (tsym.iss == issNull
|| strcmp (debug_info->ss + cur_fdr->issBase + tsym.iss,
- name) == 0)
+ name)
+ == 0)
goto end_of_fields;
break;
@@ -964,8 +951,8 @@ parse_symbol (SYMR *sh, union aux_ext *ax, char *ext_sh, int bigend,
break;
default:
- complaint (_("declaration block contains "
- "unhandled symbol type %d"),
+ complaint (_ ("declaration block contains "
+ "unhandled symbol type %d"),
tsym.st);
}
}
@@ -1028,8 +1015,8 @@ parse_symbol (SYMR *sh, union aux_ext *ax, char *ext_sh, int bigend,
if (sh->iss == 0 || name[0] == '.' || name[0] == '\0')
t->set_name (NULL);
else
- t->set_name (obconcat (&mdebugread_objfile->objfile_obstack,
- name, (char *) NULL));
+ t->set_name (obconcat (&mdebugread_objfile->objfile_obstack, name,
+ (char *) NULL));
t->set_code (type_code);
t->set_length (sh->value);
@@ -1051,11 +1038,9 @@ parse_symbol (SYMR *sh, union aux_ext *ax, char *ext_sh, int bigend,
are hopefully rare enough.
Alpha cc -migrate has a sh.value field of zero, we adjust
that too. */
- if (t->length () == t->num_fields ()
- || t->length () == 0)
+ if (t->length () == t->num_fields () || t->length () == 0)
t->set_length (gdbarch_int_bit (gdbarch) / HOST_CHAR_BIT);
- for (ext_tsym = ext_sh + external_sym_size;
- ;
+ for (ext_tsym = ext_sh + external_sym_size;;
ext_tsym += external_sym_size)
{
SYMR tsym;
@@ -1072,9 +1057,8 @@ parse_symbol (SYMR *sh, union aux_ext *ax, char *ext_sh, int bigend,
FIELD_BITSIZE (*f) = 0;
enum_sym = new (&mdebugread_objfile->objfile_obstack) symbol;
- enum_sym->set_linkage_name
- (obstack_strdup (&mdebugread_objfile->objfile_obstack,
- f->name ()));
+ enum_sym->set_linkage_name (obstack_strdup (
+ &mdebugread_objfile->objfile_obstack, f->name ()));
enum_sym->set_aclass_index (LOC_CONST);
enum_sym->set_type (t);
enum_sym->set_domain (VAR_DOMAIN);
@@ -1142,15 +1126,15 @@ parse_symbol (SYMR *sh, union aux_ext *ax, char *ext_sh, int bigend,
add_block (b, top_stack->cur_st);
break;
- case stEnd: /* end (of anything) */
+ case stEnd: /* end (of anything) */
if (sh->sc == scInfo || SC_IS_COMMON (sh->sc))
{
/* Finished with type */
top_stack->cur_type = 0;
}
- else if (sh->sc == scText &&
- (top_stack->blocktype == stProc ||
- top_stack->blocktype == stStaticProc))
+ else if (sh->sc == scText
+ && (top_stack->blocktype == stProc
+ || top_stack->blocktype == stStaticProc))
{
/* Finished with procedure */
struct blockvector *bv
@@ -1159,8 +1143,8 @@ parse_symbol (SYMR *sh, union aux_ext *ax, char *ext_sh, int bigend,
struct block *cblock = top_stack->cur_block;
struct type *ftype = top_stack->cur_type;
- top_stack->cur_block->set_end
- (top_stack->cur_block->end () + sh->value); /* size */
+ top_stack->cur_block->set_end (top_stack->cur_block->end ()
+ + sh->value); /* size */
/* Make up special symbol to contain procedure specific info. */
s = new_symbol (MDEBUG_EFI_SYMBOL_NAME);
@@ -1200,9 +1184,8 @@ parse_symbol (SYMR *sh, union aux_ext *ax, char *ext_sh, int bigend,
struct block_iterator iter;
ftype->set_num_fields (nparams);
- ftype->set_fields
- ((struct field *)
- TYPE_ALLOC (ftype, nparams * sizeof (struct field)));
+ ftype->set_fields ((struct field *) TYPE_ALLOC (
+ ftype, nparams * sizeof (struct field)));
iparams = 0;
ALL_BLOCK_SYMBOLS (cblock, iter, sym)
@@ -1240,12 +1223,12 @@ parse_symbol (SYMR *sh, union aux_ext *ax, char *ext_sh, int bigend,
;
}
else
- complaint (_("stEnd with storage class %d not handled"), sh->sc);
+ complaint (_ ("stEnd with storage class %d not handled"), sh->sc);
- pop_parse_stack (); /* Restore previous lexical context. */
+ pop_parse_stack (); /* Restore previous lexical context. */
break;
- case stMember: /* member of struct or union */
+ case stMember: /* member of struct or union */
{
struct field *f = &top_stack->cur_type->field (top_stack->cur_field);
top_stack->cur_field++;
@@ -1258,12 +1241,12 @@ parse_symbol (SYMR *sh, union aux_ext *ax, char *ext_sh, int bigend,
}
break;
- case stIndirect: /* forward declaration on Irix5 */
+ case stIndirect: /* forward declaration on Irix5 */
/* Forward declarations from Irix5 cc are handled by cross_ref,
skip them. */
break;
- case stTypedef: /* type definition */
+ case stTypedef: /* type definition */
found_ecoff_debugging_info = 1;
/* Typedefs for forward declarations and opaque structs from alpha cc
@@ -1342,20 +1325,20 @@ parse_symbol (SYMR *sh, union aux_ext *ax, char *ext_sh, int bigend,
}
break;
- case stFile: /* file name */
+ case stFile: /* file name */
push_parse_stack ();
top_stack->blocktype = sh->st;
break;
/* I`ve never seen these for C */
case stRegReloc:
- break; /* register relocation */
+ break; /* register relocation */
case stForward:
- break; /* forwarding address */
+ break; /* forwarding address */
case stConstant:
- break; /* constant */
+ break; /* constant */
default:
- complaint (_("unknown symbol type 0x%x"), sh->st);
+ complaint (_ ("unknown symbol type 0x%x"), sh->st);
break;
}
@@ -1380,8 +1363,8 @@ basic_type (int bt, struct objfile *objfile)
if (!map_bt)
{
- map_bt = OBSTACK_CALLOC (&objfile->objfile_obstack,
- btMax, struct type *);
+ map_bt
+ = OBSTACK_CALLOC (&objfile->objfile_obstack, btMax, struct type *);
basic_type_data.set (objfile, map_bt);
}
@@ -1420,7 +1403,7 @@ basic_type (int bt, struct objfile *objfile)
tp = init_integer_type (objfile, 32, 0, "int");
break;
- case btUInt:
+ case btUInt:
tp = init_integer_type (objfile, 32, 1, "unsigned int");
break;
@@ -1433,13 +1416,13 @@ basic_type (int bt, struct objfile *objfile)
break;
case btFloat:
- tp = init_float_type (objfile, gdbarch_float_bit (gdbarch),
- "float", gdbarch_float_format (gdbarch));
+ tp = init_float_type (objfile, gdbarch_float_bit (gdbarch), "float",
+ gdbarch_float_format (gdbarch));
break;
case btDouble:
- tp = init_float_type (objfile, gdbarch_double_bit (gdbarch),
- "double", gdbarch_double_format (gdbarch));
+ tp = init_float_type (objfile, gdbarch_double_bit (gdbarch), "double",
+ gdbarch_double_format (gdbarch));
break;
case btComplex:
@@ -1459,8 +1442,8 @@ basic_type (int bt, struct objfile *objfile)
break;
case btFloatDec:
- tp = init_type (objfile, TYPE_CODE_ERROR,
- gdbarch_double_bit (gdbarch), "floating decimal");
+ tp = init_type (objfile, TYPE_CODE_ERROR, gdbarch_double_bit (gdbarch),
+ "floating decimal");
break;
case btString:
@@ -1595,8 +1578,7 @@ parse_type (int fd, union aux_ext *ax, unsigned int aux_index, int *bs,
else if (t->bt == btEnum)
;
else
- complaint (_("can't handle TIR fBitfield for %s"),
- sym_name);
+ complaint (_ ("can't handle TIR fBitfield for %s"), sym_name);
}
else
*bs = width;
@@ -1624,23 +1606,21 @@ parse_type (int fd, union aux_ext *ax, unsigned int aux_index, int *bs,
if (rf == -1)
{
- complaint (_("unable to cross ref btIndirect for %s"), sym_name);
+ complaint (_ ("unable to cross ref btIndirect for %s"), sym_name);
return basic_type (btInt, mdebugread_objfile);
}
xref_fh = get_rfd (fd, rf);
xref_fd = xref_fh - debug_info->fdr;
tp = parse_type (xref_fd, debug_info->external_aux + xref_fh->iauxBase,
- rn->index, NULL, xref_fh->fBigendian, sym_name);
+ rn->index, NULL, xref_fh->fBigendian, sym_name);
}
/* All these types really point to some (common) MIPS type
definition, and only the type-qualifiers fully identify
them. We'll make the same effort at sharing. */
- if (t->bt == btStruct ||
- t->bt == btUnion ||
- t->bt == btEnum ||
+ if (t->bt == btStruct || t->bt == btUnion || t->bt == btEnum ||
- /* btSet (I think) implies that the name is a tag name, not a typedef
+ /* btSet (I think) implies that the name is a tag name, not a typedef
name. This apparently is a MIPS extension for C sets. */
t->bt == btSet)
{
@@ -1653,15 +1633,13 @@ parse_type (int fd, union aux_ext *ax, unsigned int aux_index, int *bs,
/* DEC c89 produces cross references to qualified aggregate types,
dereference them. */
- while (tp->code () == TYPE_CODE_PTR
- || tp->code () == TYPE_CODE_ARRAY)
+ while (tp->code () == TYPE_CODE_PTR || tp->code () == TYPE_CODE_ARRAY)
tp = tp->target_type ();
/* Make sure that TYPE_CODE(tp) has an expected type code.
Any type may be returned from cross_ref if file indirect entries
are corrupted. */
- if (tp->code () != TYPE_CODE_STRUCT
- && tp->code () != TYPE_CODE_UNION
+ if (tp->code () != TYPE_CODE_STRUCT && tp->code () != TYPE_CODE_UNION
&& tp->code () != TYPE_CODE_ENUM)
{
unexpected_type_code_complaint (sym_name);
@@ -1672,8 +1650,7 @@ parse_type (int fd, union aux_ext *ax, unsigned int aux_index, int *bs,
exception is if we guessed wrong re struct/union/enum.
But for struct vs. union a wrong guess is harmless, so
don't complain(). */
- if ((tp->code () == TYPE_CODE_ENUM
- && type_code != TYPE_CODE_ENUM)
+ if ((tp->code () == TYPE_CODE_ENUM && type_code != TYPE_CODE_ENUM)
|| (tp->code () != TYPE_CODE_ENUM
&& type_code == TYPE_CODE_ENUM))
{
@@ -1689,8 +1666,7 @@ parse_type (int fd, union aux_ext *ax, unsigned int aux_index, int *bs,
(.Fxx or .xxfake or empty) for unnamed struct/union/enums. */
if (name[0] == '.' || name[0] == '\0')
tp->set_name (NULL);
- else if (tp->name () == NULL
- || strcmp (tp->name (), name) != 0)
+ else if (tp->name () == NULL || strcmp (tp->name (), name) != 0)
tp->set_name (obstack_strdup (&mdebugread_objfile->objfile_obstack,
name));
}
@@ -1725,8 +1701,7 @@ parse_type (int fd, union aux_ext *ax, unsigned int aux_index, int *bs,
bad_tag_guess_complaint (sym_name);
tp->set_code (type_code);
}
- if (tp->name () == NULL
- || strcmp (tp->name (), name) != 0)
+ if (tp->name () == NULL || strcmp (tp->name (), name) != 0)
tp->set_name (obstack_strdup (&mdebugread_objfile->objfile_obstack,
name));
}
@@ -1739,7 +1714,7 @@ parse_type (int fd, union aux_ext *ax, unsigned int aux_index, int *bs,
ax += cross_ref (fd, ax, &tp, type_code, &name, bigend, sym_name);
if (tp == NULL)
{
- complaint (_("unable to cross ref btTypedef for %s"), sym_name);
+ complaint (_ ("unable to cross ref btTypedef for %s"), sym_name);
tp = basic_type (btInt, mdebugread_objfile);
}
}
@@ -1749,7 +1724,7 @@ parse_type (int fd, union aux_ext *ax, unsigned int aux_index, int *bs,
{
tp->set_num_fields (0);
tp->set_bounds (((struct range_bounds *)
- TYPE_ZALLOC (tp, sizeof (struct range_bounds))));
+ TYPE_ZALLOC (tp, sizeof (struct range_bounds))));
tp->bounds ()->low.set_const_val (AUX_GET_DNLOW (bigend, ax));
ax++;
tp->bounds ()->high.set_const_val (AUX_GET_DNHIGH (bigend, ax));
@@ -1761,11 +1736,11 @@ parse_type (int fd, union aux_ext *ax, unsigned int aux_index, int *bs,
while (1)
{
-#define PARSE_TQ(tq) \
- if (t->tq != tqNil) \
- ax += upgrade_type(fd, &tp, t->tq, ax, bigend, sym_name); \
- else \
- break;
+#define PARSE_TQ(tq) \
+ if (t->tq != tqNil) \
+ ax += upgrade_type (fd, &tp, t->tq, ax, bigend, sym_name); \
+ else \
+ break;
PARSE_TQ (tq0);
PARSE_TQ (tq1);
@@ -1773,7 +1748,7 @@ parse_type (int fd, union aux_ext *ax, unsigned int aux_index, int *bs,
PARSE_TQ (tq3);
PARSE_TQ (tq4);
PARSE_TQ (tq5);
-#undef PARSE_TQ
+#undef PARSE_TQ
/* mips cc 2.x and gcc never put out continued aux entries. */
if (!t->continued)
@@ -1785,7 +1760,7 @@ parse_type (int fd, union aux_ext *ax, unsigned int aux_index, int *bs,
/* Complain for illegal continuations due to corrupt aux entries. */
if (t->continued)
- complaint (_("illegal TIR continued for %s"), sym_name);
+ complaint (_ ("illegal TIR continued for %s"), sym_name);
return tp;
}
@@ -1840,14 +1815,14 @@ upgrade_type (int fd, struct type **tpp, int tq, union aux_ext *ax, int bigend,
fh = get_rfd (fd, rf);
indx = parse_type (fh - debug_info->fdr,
- debug_info->external_aux + fh->iauxBase,
- id, NULL, bigend, sym_name);
+ debug_info->external_aux + fh->iauxBase, id, NULL,
+ bigend, sym_name);
/* The bounds type should be an integer type, but might be anything
else due to corrupt aux entries. */
if (indx->code () != TYPE_CODE_INT)
{
- complaint (_("illegal array index type for %s, assuming int"),
+ complaint (_ ("illegal array index type for %s, assuming int"),
sym_name);
indx = objfile_type (mdebugread_objfile)->builtin_int;
}
@@ -1858,7 +1833,7 @@ upgrade_type (int fd, struct type **tpp, int tq, union aux_ext *ax, int bigend,
ax++;
upper = AUX_GET_DNHIGH (bigend, ax);
ax++;
- rf = AUX_GET_WIDTH (bigend, ax); /* bit size of array element */
+ rf = AUX_GET_WIDTH (bigend, ax); /* bit size of array element */
range = create_static_range_type (NULL, indx, lower, upper);
@@ -1894,12 +1869,11 @@ upgrade_type (int fd, struct type **tpp, int tq, union aux_ext *ax, int bigend,
return 0;
default:
- complaint (_("unknown type qualifier 0x%x"), tq);
+ complaint (_ ("unknown type qualifier 0x%x"), tq);
return 0;
}
}
-
/* Parse a procedure descriptor record PR. Note that the procedure is
parsed _after_ the local symbols, now we just insert the extra
information we need into a MDEBUG_EFI_SYMBOL_NAME symbol that has
@@ -1926,7 +1900,7 @@ parse_procedure (PDR *pr, struct compunit_symtab *search_symtab,
{
/* Static procedure at address pr->adr. Sigh. */
/* FIXME-32x64. assuming pr->adr fits in long. */
- complaint (_("can't handle PDR for static proc at 0x%lx"),
+ complaint (_ ("can't handle PDR for static proc at 0x%lx"),
(unsigned long) pr->adr);
return;
}
@@ -1971,16 +1945,13 @@ parse_procedure (PDR *pr, struct compunit_symtab *search_symtab,
s = lookup_symbol (sh_name, NULL, VAR_DOMAIN, 0);
cur_fdr = save_cur_fdr;
#else
- s = mylookup_symbol
- (sh_name,
- search_symtab->blockvector ()->static_block (),
- VAR_DOMAIN,
- LOC_BLOCK);
+ s = mylookup_symbol (sh_name,
+ search_symtab->blockvector ()->static_block (),
+ VAR_DOMAIN, LOC_BLOCK);
#endif
}
else
- s = mylookup_symbol (sh_name, top_stack->cur_block,
- VAR_DOMAIN, LOC_BLOCK);
+ s = mylookup_symbol (sh_name, top_stack->cur_block, VAR_DOMAIN, LOC_BLOCK);
if (s != 0)
{
@@ -1988,11 +1959,11 @@ parse_procedure (PDR *pr, struct compunit_symtab *search_symtab,
}
else
{
- complaint (_("PDR for %s, but no symbol"), sh_name);
+ complaint (_ ("PDR for %s, but no symbol"), sh_name);
#if 1
return;
#else
-/* FIXME -- delete. We can't do symbol allocation now; it's all done. */
+ /* FIXME -- delete. We can't do symbol allocation now; it's all done. */
s = new_symbol (sh_name);
s->set_domain (VAR_DOMAIN);
SYMBOL_CLASS (s) = LOC_BLOCK;
@@ -2018,7 +1989,7 @@ parse_procedure (PDR *pr, struct compunit_symtab *search_symtab,
if (i)
{
struct mdebug_extra_func_info *e;
-
+
e = (struct mdebug_extra_func_info *) i->value_bytes ();
e->pdr = *pr;
@@ -2049,8 +2020,7 @@ parse_procedure (PDR *pr, struct compunit_symtab *search_symtab,
function is adjusted accordingly if no debugging info was found in the
compilation unit. */
- if (processing_gcc_compilation == 0
- && found_ecoff_debugging_info == 0
+ if (processing_gcc_compilation == 0 && found_ecoff_debugging_info == 0
&& s->type ()->target_type ()->code () == TYPE_CODE_VOID)
s->set_type (objfile_type (mdebugread_objfile)->nodebug_text_symbol);
}
@@ -2109,9 +2079,8 @@ parse_external (EXTR *es, int bigend, const section_offsets &section_offsets,
n_undef_symbols++;
/* FIXME: Turn this into a complaint? */
if (info_verbose)
- gdb_printf (_("Warning: %s `%s' is undefined (in %s)\n"),
- what, debug_info->ssext + es->asym.iss,
- fdr_name (cur_fdr));
+ gdb_printf (_ ("Warning: %s `%s' is undefined (in %s)\n"), what,
+ debug_info->ssext + es->asym.iss, fdr_name (cur_fdr));
return;
}
@@ -2138,8 +2107,7 @@ parse_external (EXTR *es, int bigend, const section_offsets &section_offsets,
/* Note that the case of a symbol with indexNil must be handled
anyways by parse_symbol(). */
- parse_symbol (&es->asym, ax, NULL,
- bigend, section_offsets, objfile);
+ parse_symbol (&es->asym, ax, NULL, bigend, section_offsets, objfile);
break;
default:
break;
@@ -2172,8 +2140,7 @@ parse_lines (FDR *fh, PDR *pr, struct linetable *lt, int maxlines,
unsigned char *halt;
/* No code for this one. */
- if (pr->iline == ilineNil ||
- pr->lnLow == -1 || pr->lnHigh == -1)
+ if (pr->iline == ilineNil || pr->lnLow == -1 || pr->lnHigh == -1)
continue;
/* Determine start and end address of compressed line bytes for
@@ -2187,7 +2154,7 @@ parse_lines (FDR *fh, PDR *pr, struct linetable *lt, int maxlines,
adr = textlow + pr->adr - lowest_pdr_addr;
- l = adr >> 2; /* in words */
+ l = adr >> 2; /* in words */
for (lineno = pr->lnLow; base < halt;)
{
count = *base & 0x0f;
@@ -2201,13 +2168,13 @@ parse_lines (FDR *fh, PDR *pr, struct linetable *lt, int maxlines,
delta -= 0x10000;
base += 2;
}
- lineno += delta; /* first delta is 0 */
+ lineno += delta; /* first delta is 0 */
/* Complain if the line table overflows. Could happen
with corrupt binaries. */
if (lt->nitems >= maxlines)
{
- complaint (_("guessed size of linetable for %s incorrectly"),
+ complaint (_ ("guessed size of linetable for %s incorrectly"),
fdr_name (fh));
break;
}
@@ -2216,12 +2183,12 @@ parse_lines (FDR *fh, PDR *pr, struct linetable *lt, int maxlines,
}
}
}
-
+
static void
function_outside_compilation_unit_complaint (const char *arg1)
{
- complaint (_("function `%s' appears to be defined "
- "outside of all compilation units"),
+ complaint (_ ("function `%s' appears to be defined "
+ "outside of all compilation units"),
arg1);
}
@@ -2229,8 +2196,8 @@ function_outside_compilation_unit_complaint (const char *arg1)
belongs to, and then records this new minimal symbol. */
static void
-record_minimal_symbol (minimal_symbol_reader &reader,
- const char *name, const CORE_ADDR address,
+record_minimal_symbol (minimal_symbol_reader &reader, const char *name,
+ const CORE_ADDR address,
enum minimal_symbol_type ms_type, int storage_class,
struct objfile *objfile)
{
@@ -2238,52 +2205,52 @@ record_minimal_symbol (minimal_symbol_reader &reader,
switch (storage_class)
{
- case scText:
- section = SECT_OFF_TEXT (objfile);
- break;
- case scData:
- section = SECT_OFF_DATA (objfile);
- break;
- case scBss:
- section = SECT_OFF_BSS (objfile);
- break;
- case scSData:
- section = get_section_index (objfile, ".sdata");
- break;
- case scSBss:
- section = get_section_index (objfile, ".sbss");
- break;
- case scRData:
- section = get_section_index (objfile, ".rdata");
- break;
- case scInit:
- section = get_section_index (objfile, ".init");
- break;
- case scXData:
- section = get_section_index (objfile, ".xdata");
- break;
- case scPData:
- section = get_section_index (objfile, ".pdata");
- break;
- case scFini:
- section = get_section_index (objfile, ".fini");
- break;
- case scRConst:
- section = get_section_index (objfile, ".rconst");
- break;
+ case scText:
+ section = SECT_OFF_TEXT (objfile);
+ break;
+ case scData:
+ section = SECT_OFF_DATA (objfile);
+ break;
+ case scBss:
+ section = SECT_OFF_BSS (objfile);
+ break;
+ case scSData:
+ section = get_section_index (objfile, ".sdata");
+ break;
+ case scSBss:
+ section = get_section_index (objfile, ".sbss");
+ break;
+ case scRData:
+ section = get_section_index (objfile, ".rdata");
+ break;
+ case scInit:
+ section = get_section_index (objfile, ".init");
+ break;
+ case scXData:
+ section = get_section_index (objfile, ".xdata");
+ break;
+ case scPData:
+ section = get_section_index (objfile, ".pdata");
+ break;
+ case scFini:
+ section = get_section_index (objfile, ".fini");
+ break;
+ case scRConst:
+ section = get_section_index (objfile, ".rconst");
+ break;
#ifdef scTlsData
- case scTlsData:
- section = get_section_index (objfile, ".tlsdata");
- break;
+ case scTlsData:
+ section = get_section_index (objfile, ".tlsdata");
+ break;
#endif
#ifdef scTlsBss
- case scTlsBss:
- section = get_section_index (objfile, ".tlsbss");
- break;
+ case scTlsBss:
+ section = get_section_index (objfile, ".tlsbss");
+ break;
#endif
- default:
- /* This kind of symbol is not associated to a section. */
- section = -1;
+ default:
+ /* This kind of symbol is not associated to a section. */
+ section = -1;
}
reader.record_with_info (name, address, ms_type, section);
@@ -2337,23 +2304,21 @@ parse_partial_symbols (minimal_symbol_reader &reader,
But we should do no adjustments if we are debugging a .o file, where
the text section (and fh->adr) really starts at zero. */
text_sect = bfd_get_section_by_name (cur_bfd, ".text");
- if (text_sect != NULL
- && (bfd_section_flags (text_sect) & SEC_RELOC))
+ if (text_sect != NULL && (bfd_section_flags (text_sect) & SEC_RELOC))
relocatable = 1;
extern_tab = XOBNEWVEC (&objfile->objfile_obstack, EXTR, hdr->iextMax);
includes_allocated = 30;
includes_used = 0;
- psymtab_include_list = (const char **) alloca (includes_allocated *
- sizeof (const char *));
+ psymtab_include_list
+ = (const char **) alloca (includes_allocated * sizeof (const char *));
next_symbol_text_func = mdebug_next_symbol_text;
dependencies_allocated = 30;
dependencies_used = 0;
- dependency_list =
- (legacy_psymtab **) alloca (dependencies_allocated *
- sizeof (legacy_psymtab *));
+ dependency_list = (legacy_psymtab **) alloca (dependencies_allocated
+ * sizeof (legacy_psymtab *));
set_last_source_file (NULL);
@@ -2383,10 +2348,9 @@ parse_partial_symbols (minimal_symbol_reader &reader,
}
/* Allocate the global pending list. */
- pending_list = XOBNEWVEC (&objfile->objfile_obstack, mdebug_pending *,
- hdr->ifdMax);
- memset (pending_list, 0,
- hdr->ifdMax * sizeof (struct mdebug_pending *));
+ pending_list
+ = XOBNEWVEC (&objfile->objfile_obstack, mdebug_pending *, hdr->ifdMax);
+ memset (pending_list, 0, hdr->ifdMax * sizeof (struct mdebug_pending *));
/* Pass 0 over external syms: swap them in. */
gdb::def_vector<EXTR> ext_block (hdr->iextMax);
@@ -2403,10 +2367,8 @@ parse_partial_symbols (minimal_symbol_reader &reader,
for (; ext_in < ext_in_end; ext_in++)
{
/* See calls to complain below. */
- if (ext_in->ifd >= -1
- && ext_in->ifd < hdr->ifdMax
- && ext_in->asym.iss >= 0
- && ext_in->asym.iss < hdr->issExtMax)
+ if (ext_in->ifd >= -1 && ext_in->ifd < hdr->ifdMax
+ && ext_in->asym.iss >= 0 && ext_in->asym.iss < hdr->issExtMax)
fdr_to_pst[ext_in->ifd].n_globals++;
}
@@ -2462,25 +2424,24 @@ parse_partial_symbols (minimal_symbol_reader &reader,
external symbols. */
if (ext_in->ifd < -1 || ext_in->ifd >= hdr->ifdMax)
{
- complaint (_("bad ifd for external symbol: %d (max %ld)"),
+ complaint (_ ("bad ifd for external symbol: %d (max %ld)"),
ext_in->ifd, hdr->ifdMax);
continue;
}
if (ext_in->asym.iss < 0 || ext_in->asym.iss >= hdr->issExtMax)
{
- complaint (_("bad iss for external symbol: %ld (max %ld)"),
+ complaint (_ ("bad iss for external symbol: %ld (max %ld)"),
ext_in->asym.iss, hdr->issExtMax);
continue;
}
extern_tab[fdr_to_pst[ext_in->ifd].globals_offset
- + fdr_to_pst[ext_in->ifd].n_globals++] = *ext_in;
-
+ + fdr_to_pst[ext_in->ifd].n_globals++]
+ = *ext_in;
if (SC_IS_UNDEF (ext_in->asym.sc) || ext_in->asym.sc == scNil)
continue;
-
/* Pass 3 over files, over local syms: fill in static symbols. */
name = debug_info->ssext + ext_in->asym.iss;
@@ -2538,12 +2499,12 @@ parse_partial_symbols (minimal_symbol_reader &reader,
which storage class is scData... Since these symbols are
usually useless for the debugger user anyway, we just
discard these symbols. */
-
+
if (SC_IS_TEXT (ext_in->asym.sc))
{
if (objfile->sect_index_text == -1)
continue;
-
+
ms_type = mst_file_text;
}
else if (SC_IS_DATA (ext_in->asym.sc))
@@ -2669,8 +2630,8 @@ parse_partial_symbols (minimal_symbol_reader &reader,
((char *) debug_info->external_sym
+ (fh->isymBase + 1) * external_sym_size),
&sh);
- if (strcmp (debug_info->ss + fh->issBase + sh.iss,
- stabs_symbol) == 0)
+ if (strcmp (debug_info->ss + fh->issBase + sh.iss, stabs_symbol)
+ == 0)
processing_gcc_compilation = 2;
}
@@ -2683,7 +2644,7 @@ parse_partial_symbols (minimal_symbol_reader &reader,
(*swap_sym_in) (cur_bfd,
(((char *) debug_info->external_sym)
- + (fh->isymBase + cur_sdx) * external_sym_size),
+ + (fh->isymBase + cur_sdx) * external_sym_size),
&sh);
type_code = ECOFF_UNMARK_STAB (sh.index);
if (!ECOFF_IS_STAB (&sh))
@@ -2704,8 +2665,7 @@ parse_partial_symbols (minimal_symbol_reader &reader,
isym = AUX_GET_ISYM (fh->fBigendian,
(debug_info->external_aux
- + fh->iauxBase
- + sh.index));
+ + fh->iauxBase + sh.index));
(*swap_sym_in) (cur_bfd,
((char *) debug_info->external_sym
+ ((fh->isymBase + isym - 1)
@@ -2750,8 +2710,7 @@ parse_partial_symbols (minimal_symbol_reader &reader,
then have the default be abs? */
namestring = debug_info->ss + fh->issBase + sh.iss;
record_minimal_symbol (reader, namestring, sh.value,
- mst_file_bss, sh.sc,
- objfile);
+ mst_file_bss, sh.sc, objfile);
break;
}
}
@@ -2780,7 +2739,7 @@ parse_partial_symbols (minimal_symbol_reader &reader,
(*swap_sym_in) (cur_bfd,
(((char *) debug_info->external_sym)
+ (fh->isymBase + cur_sdx)
- * external_sym_size),
+ * external_sym_size),
&sh2);
stabstring2 = debug_info->ss + fh->issBase + sh2.iss;
len2 = strlen (stabstring2);
@@ -2788,15 +2747,14 @@ parse_partial_symbols (minimal_symbol_reader &reader,
/* Concatenate stabstring2 with stabstring1. */
if (stabstring_storage != nullptr)
{
- stabstring_storage.reset
- ((char *) xrealloc (stabstring_storage.release (),
- len + len2 + 1));
+ stabstring_storage.reset ((char *) xrealloc (
+ stabstring_storage.release (), len + len2 + 1));
stabstring = stabstring_storage.get ();
}
else
{
- stabstring_storage.reset
- ((char *) xmalloc (len + len2 + 1));
+ stabstring_storage.reset ((char *) xmalloc (len + len2
+ + 1));
stabstring = stabstring_storage.get ();
strcpy (stabstring, stabstring1);
}
@@ -2821,14 +2779,14 @@ parse_partial_symbols (minimal_symbol_reader &reader,
case N_BSS:
case N_BSS | N_EXT:
case N_NBBSS | N_EXT:
- case N_SETV | N_EXT: /* FIXME, is this in BSS? */
+ case N_SETV | N_EXT: /* FIXME, is this in BSS? */
goto record_it;
case N_ABS | N_EXT:
record_it:
continue;
- /* Standard, local, non-debugger, symbols. */
+ /* Standard, local, non-debugger, symbols. */
case N_NBTEXT:
@@ -2847,7 +2805,7 @@ parse_partial_symbols (minimal_symbol_reader &reader,
goto record_it;
case N_UNDF | N_EXT:
- continue; /* Just undefined, not COMMON. */
+ continue; /* Just undefined, not COMMON. */
case N_UNDF:
continue;
@@ -2897,7 +2855,7 @@ parse_partial_symbols (minimal_symbol_reader &reader,
textlow_not_set = 0;
if (prev_so_symnum != symnum - 1)
- { /* Here if prev stab wasn't N_SO. */
+ { /* Here if prev stab wasn't N_SO. */
if (pst)
{
pst = (legacy_psymtab *) 0;
@@ -2926,7 +2884,7 @@ parse_partial_symbols (minimal_symbol_reader &reader,
the previous N_SO was a directory name. */
basename = lbasename (namestring);
if (basename != namestring && *basename == '\000')
- continue; /* Simply ignore directory
+ continue; /* Simply ignore directory
name SOs. */
/* Some other compilers (C++ ones in particular) emit
@@ -2984,7 +2942,8 @@ parse_partial_symbols (minimal_symbol_reader &reader,
for (i = 0; i < includes_used; i++)
if (filename_cmp (namestring,
- psymtab_include_list[i]) == 0)
+ psymtab_include_list[i])
+ == 0)
{
i = -1;
break;
@@ -2998,40 +2957,38 @@ parse_partial_symbols (minimal_symbol_reader &reader,
{
const char **orig = psymtab_include_list;
- psymtab_include_list = (const char **)
- alloca ((includes_allocated *= 2) *
- sizeof (const char *));
+ psymtab_include_list
+ = (const char **) alloca ((includes_allocated *= 2)
+ * sizeof (const char *));
memcpy (psymtab_include_list, orig,
includes_used * sizeof (const char *));
}
continue;
}
- case N_LSYM: /* Typedef or automatic variable. */
- case N_STSYM: /* Data seg var -- static */
- case N_LCSYM: /* BSS " */
- case N_ROSYM: /* Read-only data seg var -- static. */
- case N_NBSTS: /* Gould nobase. */
- case N_NBLCS: /* symbols. */
+ case N_LSYM: /* Typedef or automatic variable. */
+ case N_STSYM: /* Data seg var -- static */
+ case N_LCSYM: /* BSS " */
+ case N_ROSYM: /* Read-only data seg var -- static. */
+ case N_NBSTS: /* Gould nobase. */
+ case N_NBLCS: /* symbols. */
case N_FUN:
- case N_GSYM: /* Global (extern) variable; can be
+ case N_GSYM: /* Global (extern) variable; can be
data or bss (sigh FIXME). */
/* Following may probably be ignored; I'll leave them here
for now (until I do Pascal and Modula 2 extensions). */
- case N_PC: /* I may or may not need this; I
+ case N_PC: /* I may or may not need this; I
suspect not. */
- case N_M2C: /* I suspect that I can ignore this
+ case N_M2C: /* I suspect that I can ignore this
here. */
- case N_SCOPE: /* Same. */
+ case N_SCOPE: /* Same. */
/* SET_NAMESTRING (); */
namestring = stabstring;
p = (char *) strchr (namestring, ':');
if (!p)
- continue; /* Not a debugging symbol. */
-
-
+ continue; /* Not a debugging symbol. */
/* Main processing section for debugging symbols which
the initial read through the symbol tables needs to
@@ -3044,27 +3001,21 @@ parse_partial_symbols (minimal_symbol_reader &reader,
switch (p[1])
{
case 'S':
- pst->add_psymbol (gdb::string_view (namestring,
- p - namestring),
- true, VAR_DOMAIN, LOC_STATIC,
- SECT_OFF_DATA (objfile),
- psymbol_placement::STATIC,
- sh.value,
- psymtab_language,
- partial_symtabs, objfile);
+ pst->add_psymbol (
+ gdb::string_view (namestring, p - namestring), true,
+ VAR_DOMAIN, LOC_STATIC, SECT_OFF_DATA (objfile),
+ psymbol_placement::STATIC, sh.value,
+ psymtab_language, partial_symtabs, objfile);
continue;
case 'G':
/* The addresses in these entries are reported
to be wrong. See the code that reads 'G's
for symtabs. */
- pst->add_psymbol (gdb::string_view (namestring,
- p - namestring),
- true, VAR_DOMAIN, LOC_STATIC,
- SECT_OFF_DATA (objfile),
- psymbol_placement::GLOBAL,
- sh.value,
- psymtab_language,
- partial_symtabs, objfile);
+ pst->add_psymbol (
+ gdb::string_view (namestring, p - namestring), true,
+ VAR_DOMAIN, LOC_STATIC, SECT_OFF_DATA (objfile),
+ psymbol_placement::GLOBAL, sh.value,
+ psymtab_language, partial_symtabs, objfile);
continue;
case 'T':
@@ -3075,38 +3026,35 @@ parse_partial_symbols (minimal_symbol_reader &reader,
table. We do pick up the elements of such enums at
'check_enum:', below. */
if (p >= namestring + 2
- || (p == namestring + 1
- && namestring[0] != ' '))
+ || (p == namestring + 1 && namestring[0] != ' '))
{
- pst->add_psymbol
- (gdb::string_view (namestring, p - namestring),
- true, STRUCT_DOMAIN, LOC_TYPEDEF, -1,
- psymbol_placement::STATIC, 0, psymtab_language,
- partial_symtabs, objfile);
+ pst->add_psymbol (
+ gdb::string_view (namestring, p - namestring),
+ true, STRUCT_DOMAIN, LOC_TYPEDEF, -1,
+ psymbol_placement::STATIC, 0, psymtab_language,
+ partial_symtabs, objfile);
if (p[2] == 't')
{
/* Also a typedef with the same name. */
- pst->add_psymbol
- (gdb::string_view (namestring,
- p - namestring),
- true, VAR_DOMAIN, LOC_TYPEDEF, -1,
- psymbol_placement::STATIC, 0,
- psymtab_language,
- partial_symtabs, objfile);
+ pst->add_psymbol (
+ gdb::string_view (namestring,
+ p - namestring),
+ true, VAR_DOMAIN, LOC_TYPEDEF, -1,
+ psymbol_placement::STATIC, 0,
+ psymtab_language, partial_symtabs, objfile);
p += 1;
}
}
goto check_enum;
case 't':
- if (p != namestring) /* a name is there, not
+ if (p != namestring) /* a name is there, not
just :T... */
{
- pst->add_psymbol
- (gdb::string_view (namestring,
- p - namestring),
- true, VAR_DOMAIN, LOC_TYPEDEF, -1,
- psymbol_placement::STATIC, 0, psymtab_language,
- partial_symtabs, objfile);
+ pst->add_psymbol (
+ gdb::string_view (namestring, p - namestring),
+ true, VAR_DOMAIN, LOC_TYPEDEF, -1,
+ psymbol_placement::STATIC, 0, psymtab_language,
+ partial_symtabs, objfile);
}
check_enum:
/* If this is an enumerated type, we need to add
@@ -3127,9 +3075,8 @@ parse_partial_symbols (minimal_symbol_reader &reader,
p += 2;
/* This type may be given a number. Also, numbers
can come in pairs like (0,26). Skip over it. */
- while ((*p >= '0' && *p <= '9')
- || *p == '(' || *p == ',' || *p == ')'
- || *p == '=')
+ while ((*p >= '0' && *p <= '9') || *p == '('
+ || *p == ',' || *p == ')' || *p == '=')
p++;
if (*p++ == 'e')
@@ -3167,12 +3114,11 @@ parse_partial_symbols (minimal_symbol_reader &reader,
/* Note that the value doesn't matter for
enum constants in psymtabs, just in
symtabs. */
- pst->add_psymbol (gdb::string_view (p,
- q - p),
- true, VAR_DOMAIN,
- LOC_CONST, -1,
- psymbol_placement::STATIC,
- 0, psymtab_language,
+ pst->add_psymbol (gdb::string_view (p, q - p),
+ true, VAR_DOMAIN, LOC_CONST,
+ -1,
+ psymbol_placement::STATIC, 0,
+ psymtab_language,
partial_symtabs, objfile);
/* Point past the name. */
p = q;
@@ -3187,29 +3133,24 @@ parse_partial_symbols (minimal_symbol_reader &reader,
continue;
case 'c':
/* Constant, e.g. from "const" in Pascal. */
- pst->add_psymbol (gdb::string_view (namestring,
- p - namestring),
- true, VAR_DOMAIN, LOC_CONST, -1,
- psymbol_placement::STATIC,
- 0, psymtab_language,
- partial_symtabs, objfile);
+ pst->add_psymbol (
+ gdb::string_view (namestring, p - namestring), true,
+ VAR_DOMAIN, LOC_CONST, -1, psymbol_placement::STATIC,
+ 0, psymtab_language, partial_symtabs, objfile);
continue;
case 'f':
- if (! pst)
+ if (!pst)
{
std::string copy (namestring, p);
- function_outside_compilation_unit_complaint
- (copy.c_str ());
+ function_outside_compilation_unit_complaint (
+ copy.c_str ());
}
- pst->add_psymbol (gdb::string_view (namestring,
- p - namestring),
- true, VAR_DOMAIN, LOC_BLOCK,
- SECT_OFF_TEXT (objfile),
- psymbol_placement::STATIC,
- sh.value,
- psymtab_language,
- partial_symtabs, objfile);
+ pst->add_psymbol (
+ gdb::string_view (namestring, p - namestring), true,
+ VAR_DOMAIN, LOC_BLOCK, SECT_OFF_TEXT (objfile),
+ psymbol_placement::STATIC, sh.value,
+ psymtab_language, partial_symtabs, objfile);
continue;
/* Global functions were ignored here, but now they
@@ -3217,20 +3158,17 @@ parse_partial_symbols (minimal_symbol_reader &reader,
expect. They're also in the minimal symbol
table. */
case 'F':
- if (! pst)
+ if (!pst)
{
std::string copy (namestring, p);
- function_outside_compilation_unit_complaint
- (copy.c_str ());
+ function_outside_compilation_unit_complaint (
+ copy.c_str ());
}
- pst->add_psymbol (gdb::string_view (namestring,
- p - namestring),
- true, VAR_DOMAIN, LOC_BLOCK,
- SECT_OFF_TEXT (objfile),
- psymbol_placement::GLOBAL,
- sh.value,
- psymtab_language,
- partial_symtabs, objfile);
+ pst->add_psymbol (
+ gdb::string_view (namestring, p - namestring), true,
+ VAR_DOMAIN, LOC_BLOCK, SECT_OFF_TEXT (objfile),
+ psymbol_placement::GLOBAL, sh.value,
+ psymtab_language, partial_symtabs, objfile);
continue;
/* Two things show up here (hopefully); static
@@ -3250,7 +3188,7 @@ parse_partial_symbols (minimal_symbol_reader &reader,
case '8':
case '9':
case '-':
- case '#': /* For symbol identification (used
+ case '#': /* For symbol identification (used
in live ranges). */
continue;
@@ -3273,7 +3211,7 @@ parse_partial_symbols (minimal_symbol_reader &reader,
searching to the end of every string looking for
a backslash. */
- complaint (_("unknown symbol descriptor `%c'"), p[1]);
+ complaint (_ ("unknown symbol descriptor `%c'"), p[1]);
/* Ignore it; perhaps it is an extension that we don't
know about. */
@@ -3289,8 +3227,7 @@ parse_partial_symbols (minimal_symbol_reader &reader,
high text address of PST to the proper value,
which is necessary if a module compiled without
debugging info follows this module. */
- if (pst
- && gdbarch_sofun_address_maybe_missing (gdbarch))
+ if (pst && gdbarch_sofun_address_maybe_missing (gdbarch))
{
pst = (legacy_psymtab *) 0;
includes_used = 0;
@@ -3305,14 +3242,14 @@ parse_partial_symbols (minimal_symbol_reader &reader,
case N_EINCL:
case N_DSLINE:
case N_BSLINE:
- case N_SSYM: /* Claim: Structure or union
+ case N_SSYM: /* Claim: Structure or union
element. Hopefully, I can
ignore this. */
- case N_ENTRY: /* Alternate entry point; can
+ case N_ENTRY: /* Alternate entry point; can
ignore. */
- case N_MAIN: /* Can definitely ignore this. */
- case N_CATCH: /* These are GNU C++ extensions. */
- case N_EHDECL: /* that can safely be ignored here. */
+ case N_MAIN: /* Can definitely ignore this. */
+ case N_CATCH: /* These are GNU C++ extensions. */
+ case N_EHDECL: /* that can safely be ignored here. */
case N_LENG:
case N_BCOMM:
case N_ECOMM:
@@ -3322,12 +3259,12 @@ parse_partial_symbols (minimal_symbol_reader &reader,
case N_RSYM:
case N_PSYM:
case N_LBRAC:
- case N_NSYMS: /* Ultrix 4.0: symbol count */
- case N_DEFD: /* GNU Modula-2 */
- case N_ALIAS: /* SunPro F77: alias name, ignore
+ case N_NSYMS: /* Ultrix 4.0: symbol count */
+ case N_DEFD: /* GNU Modula-2 */
+ case N_ALIAS: /* SunPro F77: alias name, ignore
for now. */
- case N_OBJ: /* Useless types from Solaris. */
+ case N_OBJ: /* Useless types from Solaris. */
case N_OPT:
/* These symbols aren't interesting; don't worry about
them. */
@@ -3337,7 +3274,7 @@ parse_partial_symbols (minimal_symbol_reader &reader,
default:
/* If we haven't found it yet, ignore it. It's
probably some new type we don't know about yet. */
- complaint (_("unknown symbol type %s"),
+ complaint (_ ("unknown symbol type %s"),
hex_string (type_code)); /* CUR_SYMBOL_TYPE */
continue;
}
@@ -3422,20 +3359,20 @@ parse_partial_symbols (minimal_symbol_reader &reader,
/* Should not happen, but does when cross-compiling
with the MIPS compiler. FIXME -- pull later. */
index_complaint (sym_name);
- new_sdx = cur_sdx + 1; /* Don't skip at all. */
+ new_sdx = cur_sdx + 1; /* Don't skip at all. */
}
else
new_sdx = AUX_GET_ISYM (fh->fBigendian,
(debug_info->external_aux
- + fh->iauxBase
- + sh.index));
+ + fh->iauxBase + sh.index));
if (new_sdx <= cur_sdx)
{
/* This should not happen either... FIXME. */
- complaint (_("bad proc end in aux found from symbol %s"),
- sym_name);
- new_sdx = cur_sdx + 1; /* Don't skip backward. */
+ complaint (
+ _ ("bad proc end in aux found from symbol %s"),
+ sym_name);
+ new_sdx = cur_sdx + 1; /* Don't skip backward. */
}
/* For stProc symbol records, we need to check the
@@ -3460,17 +3397,13 @@ parse_partial_symbols (minimal_symbol_reader &reader,
symbol table, and the MAIN__ symbol via the minimal
symbol table. */
if (sh.st == stProc)
- pst->add_psymbol (sym_name, true,
- VAR_DOMAIN, LOC_BLOCK,
- section,
- psymbol_placement::GLOBAL,
+ pst->add_psymbol (sym_name, true, VAR_DOMAIN, LOC_BLOCK,
+ section, psymbol_placement::GLOBAL,
sh.value, psymtab_language,
partial_symtabs, objfile);
else
- pst->add_psymbol (sym_name, true,
- VAR_DOMAIN, LOC_BLOCK,
- section,
- psymbol_placement::STATIC,
+ pst->add_psymbol (sym_name, true, VAR_DOMAIN, LOC_BLOCK,
+ section, psymbol_placement::STATIC,
sh.value, psymtab_language,
partial_symtabs, objfile);
@@ -3496,7 +3429,7 @@ parse_partial_symbols (minimal_symbol_reader &reader,
pst->set_text_high (high);
continue;
- case stStatic: /* Variable */
+ case stStatic: /* Variable */
if (SC_IS_DATA (sh.sc))
reader.record_with_info (sym_name, minsym_value,
mst_file_data,
@@ -3508,11 +3441,11 @@ parse_partial_symbols (minimal_symbol_reader &reader,
theclass = LOC_STATIC;
break;
- case stIndirect: /* Irix5 forward declaration */
+ case stIndirect: /* Irix5 forward declaration */
/* Skip forward declarations from Irix5 cc. */
goto skip;
- case stTypedef: /* Typedef */
+ case stTypedef: /* Typedef */
/* Skip typedefs for forward declarations and opaque
structs from alpha and mips cc. */
if (sh.iss == 0 || has_opaque_xref (fh, &sh))
@@ -3520,48 +3453,46 @@ parse_partial_symbols (minimal_symbol_reader &reader,
theclass = LOC_TYPEDEF;
break;
- case stConstant: /* Constant decl */
+ case stConstant: /* Constant decl */
theclass = LOC_CONST;
break;
case stUnion:
case stStruct:
case stEnum:
- case stBlock: /* { }, str, un, enum */
+ case stBlock: /* { }, str, un, enum */
/* Do not create a partial symbol for cc unnamed aggregates
and gcc empty aggregates. */
- if ((sh.sc == scInfo
- || SC_IS_COMMON (sh.sc))
- && sh.iss != 0
+ if ((sh.sc == scInfo || SC_IS_COMMON (sh.sc)) && sh.iss != 0
&& sh.index != cur_sdx + 2)
{
- pst->add_psymbol (sym_name, true,
- STRUCT_DOMAIN, LOC_TYPEDEF, -1,
- psymbol_placement::STATIC,
- 0, psymtab_language,
- partial_symtabs, objfile);
+ pst->add_psymbol (sym_name, true, STRUCT_DOMAIN,
+ LOC_TYPEDEF, -1,
+ psymbol_placement::STATIC, 0,
+ psymtab_language, partial_symtabs,
+ objfile);
}
- handle_psymbol_enumerators (objfile, partial_symtabs,
- pst, fh, sh.st, sh.value);
+ handle_psymbol_enumerators (objfile, partial_symtabs, pst,
+ fh, sh.st, sh.value);
/* Skip over the block. */
new_sdx = sh.index;
if (new_sdx <= cur_sdx)
{
/* This happens with the Ultrix kernel. */
- complaint (_("bad aux index at block symbol %s"),
+ complaint (_ ("bad aux index at block symbol %s"),
sym_name);
- new_sdx = cur_sdx + 1; /* Don't skip backward. */
+ new_sdx = cur_sdx + 1; /* Don't skip backward. */
}
cur_sdx = new_sdx;
continue;
- case stFile: /* File headers */
- case stLabel: /* Labels */
- case stEnd: /* Ends of files */
+ case stFile: /* File headers */
+ case stLabel: /* Labels */
+ case stEnd: /* Ends of files */
goto skip;
- case stLocal: /* Local variables */
+ case stLocal: /* Local variables */
/* Normally these are skipped because we skip over
all blocks we see. However, these can occur
as visible symbols in a .h file that contains code. */
@@ -3570,20 +3501,17 @@ parse_partial_symbols (minimal_symbol_reader &reader,
default:
/* Both complaints are valid: one gives symbol sym_name,
the other the offending symbol type. */
- complaint (_("unknown local symbol %s"),
- sym_name);
- complaint (_("with type %d"), sh.st);
+ complaint (_ ("unknown local symbol %s"), sym_name);
+ complaint (_ ("with type %d"), sh.st);
cur_sdx++;
continue;
}
/* Use this gdb symbol. */
- pst->add_psymbol (sym_name, true,
- VAR_DOMAIN, theclass, section,
- psymbol_placement::STATIC,
- sh.value, psymtab_language,
- partial_symtabs, objfile);
+ pst->add_psymbol (sym_name, true, VAR_DOMAIN, theclass, section,
+ psymbol_placement::STATIC, sh.value,
+ psymtab_language, partial_symtabs, objfile);
skip:
- cur_sdx++; /* Go to next file symbol. */
+ cur_sdx++; /* Go to next file symbol. */
}
/* Now do enter the external symbols. */
@@ -3656,12 +3584,9 @@ parse_partial_symbols (minimal_symbol_reader &reader,
break;
}
char *sym_name = debug_info->ssext + psh->iss;
- pst->add_psymbol (sym_name, true,
- VAR_DOMAIN, theclass,
- section,
- psymbol_placement::GLOBAL,
- svalue, psymtab_language,
- partial_symtabs, objfile);
+ pst->add_psymbol (sym_name, true, VAR_DOMAIN, theclass, section,
+ psymbol_placement::GLOBAL, svalue,
+ psymtab_language, partial_symtabs, objfile);
}
}
@@ -3669,10 +3594,9 @@ parse_partial_symbols (minimal_symbol_reader &reader,
empty and put on the free list. */
fdr_to_pst[f_idx].pst
= dbx_end_psymtab (objfile, partial_symtabs, save_pst,
- psymtab_include_list, includes_used,
- -1, save_pst->raw_text_high (),
- dependency_list, dependencies_used,
- textlow_not_set);
+ psymtab_include_list, includes_used, -1,
+ save_pst->raw_text_high (), dependency_list,
+ dependencies_used, textlow_not_set);
includes_used = 0;
dependencies_used = 0;
@@ -3688,8 +3612,7 @@ parse_partial_symbols (minimal_symbol_reader &reader,
might have to use a more elaborate (and slower) algorithm for
other cases. */
save_pst = fdr_to_pst[f_idx].pst;
- if (save_pst != NULL
- && save_pst->text_low_valid
+ if (save_pst != NULL && save_pst->text_low_valid
&& !(objfile->flags & OBJF_REORDERED))
{
for (partial_symtab *iter : partial_symtabs->range ())
@@ -3734,7 +3657,7 @@ parse_partial_symbols (minimal_symbol_reader &reader,
&rh);
if (rh < 0 || rh >= hdr->ifdMax)
{
- complaint (_("bad file number %ld"), rh);
+ complaint (_ ("bad file number %ld"), rh);
continue;
}
@@ -3753,8 +3676,7 @@ parse_partial_symbols (minimal_symbol_reader &reader,
/* Remove the dummy psymtab created for -O3 images above, if it is
still empty, to enable the detection of stripped executables. */
partial_symtab *pst_del = partial_symtabs->psymtabs;
- if (pst_del->next == NULL
- && pst_del->number_of_dependencies == 0
+ if (pst_del->next == NULL && pst_del->number_of_dependencies == 0
&& pst_del->empty ())
partial_symtabs->discard_psymtab (pst_del);
}
@@ -3765,8 +3687,8 @@ parse_partial_symbols (minimal_symbol_reader &reader,
static void
handle_psymbol_enumerators (struct objfile *objfile,
psymtab_storage *partial_symtabs,
- partial_symtab *pst,
- FDR *fh, int stype, CORE_ADDR svalue)
+ partial_symtab *pst, FDR *fh, int stype,
+ CORE_ADDR svalue)
{
const bfd_size_type external_sym_size = debug_swap->external_sym_size;
void (*const swap_sym_in) (bfd *, void *, SYMR *) = debug_swap->swap_sym_in;
@@ -3792,15 +3714,12 @@ handle_psymbol_enumerators (struct objfile *objfile,
if (sh.st != stMember)
return;
- if (sh.index == indexNil
- || (sh.index == 0 && svalue == 0))
+ if (sh.index == indexNil || (sh.index == 0 && svalue == 0))
break;
- (*debug_swap->swap_tir_in) (fh->fBigendian,
- &(debug_info->external_aux
- + fh->iauxBase + sh.index)->a_ti,
- &tir);
- if ((tir.bt != btNil
- && tir.bt != btVoid
+ (*debug_swap->swap_tir_in) (
+ fh->fBigendian,
+ &(debug_info->external_aux + fh->iauxBase + sh.index)->a_ti, &tir);
+ if ((tir.bt != btNil && tir.bt != btVoid
&& (tir.bt != btEnum || svalue != 0))
|| tir.tq0 != tqNil)
return;
@@ -3821,10 +3740,9 @@ handle_psymbol_enumerators (struct objfile *objfile,
/* Note that the value doesn't matter for enum constants
in psymtabs, just in symtabs. */
- pst->add_psymbol (name, true,
- VAR_DOMAIN, LOC_CONST, -1,
- psymbol_placement::STATIC, 0,
- psymtab_language, partial_symtabs, objfile);
+ pst->add_psymbol (name, true, VAR_DOMAIN, LOC_CONST, -1,
+ psymbol_placement::STATIC, 0, psymtab_language,
+ partial_symtabs, objfile);
ext_sym += external_sym_size;
}
}
@@ -3896,9 +3814,7 @@ mdebug_expand_psymtab (legacy_psymtab *pst, struct objfile *objfile)
swap_pdr_in = debug_swap->swap_pdr_in;
mdebugread_objfile = objfile;
cur_fd = FDR_IDX (pst);
- fh = ((cur_fd == -1)
- ? NULL
- : debug_info->fdr + cur_fd);
+ fh = ((cur_fd == -1) ? NULL : debug_info->fdr + cur_fd);
cur_fdr = fh;
/* See comment in parse_partial_symbols about the @stabs sentinel. */
@@ -3911,8 +3827,7 @@ mdebug_expand_psymtab (legacy_psymtab *pst, struct objfile *objfile)
((char *) debug_info->external_sym
+ (fh->isymBase + 1) * external_sym_size),
&sh);
- if (strcmp (debug_info->ss + fh->issBase + sh.iss,
- stabs_symbol) == 0)
+ if (strcmp (debug_info->ss + fh->issBase + sh.iss, stabs_symbol) == 0)
{
/* We indicate that this is a GCC compilation so that certain
features will be enabled in stabsread/dbxread. */
@@ -3928,7 +3843,7 @@ mdebug_expand_psymtab (legacy_psymtab *pst, struct objfile *objfile)
/* Parse local symbols first. */
- if (fh->csym <= 2) /* FIXME, this blows psymtab->symtab ptr. */
+ if (fh->csym <= 2) /* FIXME, this blows psymtab->symtab ptr. */
{
mdebugread_objfile = NULL;
return;
@@ -3961,8 +3876,7 @@ mdebug_expand_psymtab (legacy_psymtab *pst, struct objfile *objfile)
can keep a handle to its symtab. The symtab
would otherwise be ended twice, once in
process_one_symbol, and once after this loop. */
- if (type_code == N_SO
- && get_last_source_file ()
+ if (type_code == N_SO && get_last_source_file ()
&& previous_stab_code != (unsigned char) N_SO
&& *name == '\000')
{
@@ -3982,8 +3896,8 @@ mdebug_expand_psymtab (legacy_psymtab *pst, struct objfile *objfile)
/* Similarly a hack. */
else if (name[0] == '#')
{
- process_one_symbol (N_SLINE, 0, valu, name,
- section_offsets, objfile, language);
+ process_one_symbol (N_SLINE, 0, valu, name, section_offsets,
+ objfile, language);
}
if (type_code == N_FUN)
{
@@ -4023,10 +3937,10 @@ mdebug_expand_psymtab (legacy_psymtab *pst, struct objfile *objfile)
/* These are generated by gcc-2.x, do not complain. */
;
else
- complaint (_("unknown stabs symbol %s"), name);
+ complaint (_ ("unknown stabs symbol %s"), name);
}
- if (! last_symtab_ended)
+ if (!last_symtab_ended)
{
cust = end_compunit_symtab (pst->raw_text_high ());
end_stabs ();
@@ -4052,9 +3966,7 @@ mdebug_expand_psymtab (legacy_psymtab *pst, struct objfile *objfile)
+ fh->ipdFirst * external_pdr_size);
pdr_end = pdr_ptr + fh->cpd * external_pdr_size;
pdr_in = pr_block.data ();
- for (;
- pdr_ptr < pdr_end;
- pdr_ptr += external_pdr_size, pdr_in++)
+ for (; pdr_ptr < pdr_end; pdr_ptr += external_pdr_size, pdr_in++)
{
(*swap_pdr_in) (cur_bfd, pdr_ptr, pdr_in);
@@ -4091,8 +4003,8 @@ mdebug_expand_psymtab (legacy_psymtab *pst, struct objfile *objfile)
/* The proper language was already determined when building
the psymtab, use it. */
- cust->primary_filetab ()->set_language
- (PST_PRIVATE (pst)->pst_language);
+ cust->primary_filetab ()->set_language (
+ PST_PRIVATE (pst)->pst_language);
}
psymtab_language = cust->primary_filetab ()->language ();
@@ -4127,10 +4039,9 @@ mdebug_expand_psymtab (legacy_psymtab *pst, struct objfile *objfile)
int c;
(*swap_sym_in) (cur_bfd, sym_ptr, &sh);
- c = parse_symbol (&sh,
- debug_info->external_aux + fh->iauxBase,
- sym_ptr, fh->fBigendian,
- section_offsets, objfile);
+ c = parse_symbol (&sh, debug_info->external_aux + fh->iauxBase,
+ sym_ptr, fh->fBigendian, section_offsets,
+ objfile);
sym_ptr += c * external_sym_size;
}
@@ -4150,9 +4061,7 @@ mdebug_expand_psymtab (legacy_psymtab *pst, struct objfile *objfile)
+ fh->ipdFirst * external_pdr_size);
pdr_end = pdr_ptr + fh->cpd * external_pdr_size;
pdr_in = pr_block.data ();
- for (;
- pdr_ptr < pdr_end;
- pdr_ptr += external_pdr_size, pdr_in++)
+ for (; pdr_ptr < pdr_end; pdr_ptr += external_pdr_size, pdr_in++)
{
(*swap_pdr_in) (cur_bfd, pdr_ptr, pdr_in);
@@ -4180,11 +4089,10 @@ mdebug_expand_psymtab (legacy_psymtab *pst, struct objfile *objfile)
size = lines->nitems;
if (size > 1)
--size;
- cust->primary_filetab ()->set_linetable
- ((struct linetable *)
- obstack_copy (&mdebugread_objfile->objfile_obstack,
- lines, (sizeof (struct linetable)
- + size * sizeof (lines->item))));
+ cust->primary_filetab ()->set_linetable (
+ (struct linetable *) obstack_copy (
+ &mdebugread_objfile->objfile_obstack, lines,
+ (sizeof (struct linetable) + size * sizeof (lines->item))));
xfree (lines);
/* .. and our share of externals.
@@ -4197,23 +4105,21 @@ mdebug_expand_psymtab (legacy_psymtab *pst, struct objfile *objfile)
ext_ptr = PST_PRIVATE (pst)->extern_tab;
for (i = PST_PRIVATE (pst)->extern_count; --i >= 0; ext_ptr++)
- parse_external (ext_ptr, fh->fBigendian,
- section_offsets, objfile);
+ parse_external (ext_ptr, fh->fBigendian, section_offsets, objfile);
/* If there are undefined symbols, tell the user.
The alpha has an undefined symbol for every symbol that is
from a shared library, so tell the user only if verbose is on. */
if (info_verbose && n_undef_symbols)
{
- gdb_printf (_("File %s contains %d unresolved references:"),
- symtab_to_filename_for_display
- (cust->primary_filetab ()),
- n_undef_symbols);
+ gdb_printf (
+ _ ("File %s contains %d unresolved references:"),
+ symtab_to_filename_for_display (cust->primary_filetab ()),
+ n_undef_symbols);
gdb_printf ("\n\t%4d variables\n\t%4d "
"procedures\n\t%4d labels\n",
n_undef_vars, n_undef_procs, n_undef_labels);
n_undef_symbols = n_undef_labels = n_undef_vars = n_undef_procs = 0;
-
}
pop_parse_stack ();
@@ -4225,7 +4131,7 @@ mdebug_expand_psymtab (legacy_psymtab *pst, struct objfile *objfile)
mdebugread_objfile = NULL;
}
-
+
/* Ancillary parsing procedures. */
/* Return 1 if the symbol pointed to by SH has a cross reference
@@ -4332,15 +4238,13 @@ cross_ref (int fd, union aux_ext *ax, struct type **tpp,
type here. */
esh = ((char *) debug_info->external_sym
- + ((fh->isymBase + rn->index)
- * debug_swap->external_sym_size));
+ + ((fh->isymBase + rn->index) * debug_swap->external_sym_size));
(*debug_swap->swap_sym_in) (cur_bfd, esh, &sh);
/* Make sure that this type of cross reference can be handled. */
if ((sh.sc != scInfo
|| (sh.st != stBlock && sh.st != stTypedef && sh.st != stIndirect
- && sh.st != stStruct && sh.st != stUnion
- && sh.st != stEnum))
+ && sh.st != stStruct && sh.st != stUnion && sh.st != stEnum))
&& (sh.st != stBlock || !SC_IS_COMMON (sh.sc)))
{
/* File indirect entry is corrupt. */
@@ -4376,12 +4280,11 @@ cross_ref (int fd, union aux_ext *ax, struct type **tpp,
The forward references are not entered in the pending list and
in the symbol table. */
- (*debug_swap->swap_tir_in) (bigend,
- &(debug_info->external_aux
- + fh->iauxBase + sh.index)->a_ti,
- &tir);
+ (*debug_swap->swap_tir_in) (
+ bigend,
+ &(debug_info->external_aux + fh->iauxBase + sh.index)->a_ti, &tir);
if (tir.tq0 != tqNil)
- complaint (_("illegal tq0 in forward typedef for %s"), sym_name);
+ complaint (_ ("illegal tq0 in forward typedef for %s"), sym_name);
switch (tir.bt)
{
case btVoid:
@@ -4393,10 +4296,9 @@ cross_ref (int fd, union aux_ext *ax, struct type **tpp,
case btUnion:
case btEnum:
cross_ref (xref_fd,
- (debug_info->external_aux
- + fh->iauxBase + sh.index + 1),
- tpp, type_code, pname,
- fh->fBigendian, sym_name);
+ (debug_info->external_aux + fh->iauxBase + sh.index
+ + 1),
+ tpp, type_code, pname, fh->fBigendian, sym_name);
break;
case btTypedef:
@@ -4407,17 +4309,15 @@ cross_ref (int fd, union aux_ext *ax, struct type **tpp,
copying is impossible as we might have mutual forward
references between two files and the copied type would not
get filled in when we later parse its definition. */
- *tpp = parse_type (xref_fd,
- debug_info->external_aux + fh->iauxBase,
- sh.index,
- NULL,
- fh->fBigendian,
- debug_info->ss + fh->issBase + sh.iss);
+ *tpp
+ = parse_type (xref_fd, debug_info->external_aux + fh->iauxBase,
+ sh.index, NULL, fh->fBigendian,
+ debug_info->ss + fh->issBase + sh.iss);
add_pending (fh, esh, *tpp);
break;
default:
- complaint (_("illegal bt %d in forward typedef for %s"), tir.bt,
+ complaint (_ ("illegal bt %d in forward typedef for %s"), tir.bt,
sym_name);
*tpp = init_type (mdebugread_objfile, type_code, 0, NULL);
break;
@@ -4433,11 +4333,8 @@ cross_ref (int fd, union aux_ext *ax, struct type **tpp,
impossible as we might have mutual forward references between
two files and the copied type would not get filled in when
we later parse its definition. */
- *tpp = parse_type (xref_fd,
- debug_info->external_aux + fh->iauxBase,
- sh.index,
- NULL,
- fh->fBigendian,
+ *tpp = parse_type (xref_fd, debug_info->external_aux + fh->iauxBase,
+ sh.index, NULL, fh->fBigendian,
debug_info->ss + fh->issBase + sh.iss);
}
else
@@ -4456,7 +4353,6 @@ cross_ref (int fd, union aux_ext *ax, struct type **tpp,
return result;
}
-
/* Quick&dirty lookup procedure, to avoid the MI ones that require
keeping the symtab sorted. */
@@ -4471,8 +4367,7 @@ mylookup_symbol (const char *name, const struct block *block,
inc = name[0];
ALL_BLOCK_SYMBOLS (block, iter, sym)
{
- if (sym->linkage_name ()[0] == inc
- && sym->domain () == domain
+ if (sym->linkage_name ()[0] == inc && sym->domain () == domain
&& sym->aclass () == theclass
&& strcmp (sym->linkage_name (), name) == 0)
return sym;
@@ -4484,7 +4379,6 @@ mylookup_symbol (const char *name, const struct block *block,
return 0;
}
-
/* Add a new symbol S to a block B. */
static void
@@ -4504,10 +4398,9 @@ add_block (struct block *b, struct symtab *s)
struct blockvector *bv
= (struct blockvector *) s->compunit ()->blockvector ();
- bv = (struct blockvector *) xrealloc ((void *) bv,
- (sizeof (struct blockvector)
- + bv->num_blocks ()
- * sizeof (struct block)));
+ bv = (struct blockvector *) xrealloc (
+ (void *) bv,
+ (sizeof (struct blockvector) + bv->num_blocks () * sizeof (struct block)));
if (bv != s->compunit ()->blockvector ())
s->compunit ()->set_blockvector (bv);
@@ -4538,16 +4431,16 @@ add_line (struct linetable *lt, int lineno, CORE_ADDR adr, int last)
if (lineno == 0)
lineno = 1;
if (last == 0)
- last = -2; /* Make sure we record first line. */
+ last = -2; /* Make sure we record first line. */
- if (last == lineno) /* Skip continuation lines. */
+ if (last == lineno) /* Skip continuation lines. */
return lineno;
lt->item[lt->nitems].line = lineno;
lt->item[lt->nitems++].pc = adr << 2;
return lineno;
}
-
+
/* Sorting and reordering procedures. */
/* Blocks with a smaller low bound should come first. */
@@ -4595,8 +4488,8 @@ sort_blocks (struct symtab *s)
{
gdb::array_view<block *> blocks_view = bv->blocks ();
- std::sort (blocks_view.begin () + FIRST_LOCAL_BLOCK,
- blocks_view.end (), block_is_less_than);
+ std::sort (blocks_view.begin () + FIRST_LOCAL_BLOCK, blocks_view.end (),
+ block_is_less_than);
}
{
@@ -4613,7 +4506,6 @@ sort_blocks (struct symtab *s)
bv->static_block ()->set_start (bv->global_block ()->start ());
bv->static_block ()->set_end (bv->global_block ()->end ());
}
-
/* Constructor/restructor/destructor procedures. */
@@ -4670,7 +4562,6 @@ new_psymtab (const char *name, psymtab_storage *partial_symtabs,
return (psymtab);
}
-
/* Allocate a linetable array of the given SIZE. Since the struct
already includes one item, we subtract one when calculating the
proper size to allocate. */
@@ -4697,10 +4588,9 @@ new_linetable (int size)
static struct linetable *
shrink_linetable (struct linetable *lt)
{
- return (struct linetable *) xrealloc ((void *) lt,
- (sizeof (struct linetable)
- + ((lt->nitems - 1)
- * sizeof (lt->item))));
+ return (struct linetable *) xrealloc (
+ (void *) lt,
+ (sizeof (struct linetable) + ((lt->nitems - 1) * sizeof (lt->item))));
}
/* Allocate and zero a new blockvector of NBLOCKS blocks. */
@@ -4763,7 +4653,7 @@ new_type (char *name)
INIT_CPLUS_SPECIFIC (t);
return t;
}
-
+
/* Read ECOFF debugging information from a BFD section. This is
called from elfread.c. It parses the section into a
ecoff_debug_info struct, and then lets the rest of the file handle
@@ -4785,7 +4675,7 @@ elfmdebug_build_psymtabs (struct objfile *objfile,
info = XOBNEW (&objfile->objfile_obstack, ecoff_debug_info);
if (!(*swap->read_debug_info) (abfd, sec, info))
- error (_("Error reading ECOFF debugging information: %s"),
+ error (_ ("Error reading ECOFF debugging information: %s"),
bfd_errmsg (bfd_get_error ()));
mdebug_build_psymtabs (reader, objfile, swap, info);
@@ -4794,6 +4684,7 @@ elfmdebug_build_psymtabs (struct objfile *objfile,
}
void _initialize_mdebugread ();
+
void
_initialize_mdebugread ()
{
diff --git a/gdb/mdebugread.h b/gdb/mdebugread.h
index f014692bd21..25e157aac9c 100644
--- a/gdb/mdebugread.h
+++ b/gdb/mdebugread.h
@@ -20,7 +20,7 @@
#ifndef MDEBUGREAD_H
#define MDEBUGREAD_H
-#include "coff/sym.h" /* Needed for PDR below. */
+#include "coff/sym.h" /* Needed for PDR below. */
#include "coff/symconst.h"
/* Specific information about a procedure. Architectures (ab)uses
@@ -28,8 +28,8 @@
struct mdebug_extra_func_info
{
- long numargs; /* Number of args to procedure (was iopt). */
- PDR pdr; /* Procedure descriptor record. */
+ long numargs; /* Number of args to procedure (was iopt). */
+ PDR pdr; /* Procedure descriptor record. */
};
/* Special symbol found in blocks associated with routines. We can
@@ -37,8 +37,7 @@ struct mdebug_extra_func_info
#define MDEBUG_EFI_SYMBOL_NAME "__GDB_EFI_INFO__"
-extern void mdebug_build_psymtabs (minimal_symbol_reader &,
- struct objfile *,
+extern void mdebug_build_psymtabs (minimal_symbol_reader &, struct objfile *,
const struct ecoff_debug_swap *,
struct ecoff_debug_info *);
diff --git a/gdb/mem-break.c b/gdb/mem-break.c
index abff4b47081..97df679f5be 100644
--- a/gdb/mem-break.c
+++ b/gdb/mem-break.c
@@ -71,7 +71,6 @@ default_memory_insert_breakpoint (struct gdbarch *gdbarch,
return val;
}
-
int
default_memory_remove_breakpoint (struct gdbarch *gdbarch,
struct bp_target_info *bp_tgt)
@@ -80,11 +79,10 @@ default_memory_remove_breakpoint (struct gdbarch *gdbarch,
gdbarch_sw_breakpoint_from_kind (gdbarch, bp_tgt->kind, &bplen);
- return target_write_raw_memory (bp_tgt->placed_address, bp_tgt->shadow_contents,
- bplen);
+ return target_write_raw_memory (bp_tgt->placed_address,
+ bp_tgt->shadow_contents, bplen);
}
-
int
memory_insert_breakpoint (struct target_ops *ops, struct gdbarch *gdbarch,
struct bp_target_info *bp_tgt)
diff --git a/gdb/memattr.c b/gdb/memattr.c
index fafd909a714..5c143a33c6e 100644
--- a/gdb/memattr.c
+++ b/gdb/memattr.c
@@ -56,15 +56,14 @@ static bool inaccessible_by_default = true;
static void
show_inaccessible_by_default (struct ui_file *file, int from_tty,
- struct cmd_list_element *c,
- const char *value)
+ struct cmd_list_element *c, const char *value)
{
if (inaccessible_by_default)
- gdb_printf (file, _("Unknown memory addresses will "
- "be treated as inaccessible.\n"));
+ gdb_printf (file, _ ("Unknown memory addresses will "
+ "be treated as inaccessible.\n"));
else
- gdb_printf (file, _("Unknown memory addresses "
- "will be treated as RAM.\n"));
+ gdb_printf (file, _ ("Unknown memory addresses "
+ "will be treated as RAM.\n"));
}
/* This function should be called before any command which would
@@ -89,8 +88,8 @@ require_user_regions (int from_tty)
/* Otherwise, let the user know how to get back. */
if (from_tty)
- warning (_("Switching to manual control of memory regions; use "
- "\"mem auto\" to fetch regions from the target again."));
+ warning (_ ("Switching to manual control of memory regions; use "
+ "\"mem auto\" to fetch regions from the target again."));
/* And create a new list (copy of the target-supplied regions) for the user
to modify. */
@@ -115,21 +114,19 @@ require_target_regions (void)
/* Create a new user-defined memory region. */
static void
-create_user_mem_region (CORE_ADDR lo, CORE_ADDR hi,
- const mem_attrib &attrib)
+create_user_mem_region (CORE_ADDR lo, CORE_ADDR hi, const mem_attrib &attrib)
{
/* lo == hi is a useless empty region. */
if (lo >= hi && hi != 0)
{
- gdb_printf (_("invalid memory region: low >= high\n"));
+ gdb_printf (_ ("invalid memory region: low >= high\n"));
return;
}
mem_region newobj (lo, hi, attrib);
auto it = std::lower_bound (user_mem_region_list.begin (),
- user_mem_region_list.end (),
- newobj);
+ user_mem_region_list.end (), newobj);
int ix = std::distance (user_mem_region_list.begin (), it);
/* Check for an overlapping memory region. We only need to check
@@ -148,7 +145,7 @@ create_user_mem_region (CORE_ADDR lo, CORE_ADDR hi,
|| (hi > n.lo && (hi <= n.hi || n.hi == 0))
|| (lo <= n.lo && ((hi >= n.hi && n.hi != 0) || hi == 0)))
{
- gdb_printf (_("overlapping memory region\n"));
+ gdb_printf (_ ("overlapping memory region\n"));
return;
}
}
@@ -243,7 +240,6 @@ user_mem_clear (void)
{
user_mem_region_list.clear ();
}
-
static void
mem_command (const char *args, int from_tty)
@@ -251,7 +247,7 @@ mem_command (const char *args, int from_tty)
CORE_ADDR lo, hi;
if (!args)
- error_no_arg (_("No mem"));
+ error_no_arg (_ ("No mem"));
/* For "mem auto", switch back to using a target provided list. */
if (strcmp (args, "auto") == 0)
@@ -269,12 +265,12 @@ mem_command (const char *args, int from_tty)
std::string tok = extract_arg (&args);
if (tok == "")
- error (_("no lo address"));
+ error (_ ("no lo address"));
lo = parse_and_eval_address (tok.c_str ());
tok = extract_arg (&args);
if (tok == "")
- error (_("no hi address"));
+ error (_ ("no hi address"));
hi = parse_and_eval_address (tok.c_str ());
mem_attrib attrib;
@@ -292,19 +288,19 @@ mem_command (const char *args, int from_tty)
else if (tok == "16")
{
if ((lo % 2 != 0) || (hi % 2 != 0))
- error (_("region bounds not 16 bit aligned"));
+ error (_ ("region bounds not 16 bit aligned"));
attrib.width = MEM_WIDTH_16;
}
else if (tok == "32")
{
if ((lo % 4 != 0) || (hi % 4 != 0))
- error (_("region bounds not 32 bit aligned"));
+ error (_ ("region bounds not 32 bit aligned"));
attrib.width = MEM_WIDTH_32;
}
else if (tok == "64")
{
if ((lo % 8 != 0) || (hi % 8 != 0))
- error (_("region bounds not 64 bit aligned"));
+ error (_ ("region bounds not 64 bit aligned"));
attrib.width = MEM_WIDTH_64;
}
@@ -328,26 +324,25 @@ mem_command (const char *args, int from_tty)
#endif
else
- error (_("unknown attribute: %s"), tok.c_str ());
+ error (_ ("unknown attribute: %s"), tok.c_str ());
}
create_user_mem_region (lo, hi, attrib);
}
-
static void
info_mem_command (const char *args, int from_tty)
{
if (mem_use_target ())
- gdb_printf (_("Using memory regions provided by the target.\n"));
+ gdb_printf (_ ("Using memory regions provided by the target.\n"));
else
- gdb_printf (_("Using user-defined memory regions.\n"));
+ gdb_printf (_ ("Using user-defined memory regions.\n"));
require_target_regions ();
if (mem_region_list->empty ())
{
- gdb_printf (_("There are no memory regions defined.\n"));
+ gdb_printf (_ ("There are no memory regions defined.\n"));
return;
}
@@ -366,14 +361,12 @@ info_mem_command (const char *args, int from_tty)
{
const char *tmp;
- gdb_printf ("%-3d %-3c\t",
- m.number,
- m.enabled_p ? 'y' : 'n');
+ gdb_printf ("%-3d %-3c\t", m.number, m.enabled_p ? 'y' : 'n');
if (gdbarch_addr_bit (target_gdbarch ()) <= 32)
tmp = hex_string_custom (m.lo, 8);
else
tmp = hex_string_custom (m.lo, 16);
-
+
gdb_printf ("%s ", tmp);
if (gdbarch_addr_bit (target_gdbarch ()) <= 32)
@@ -461,7 +454,6 @@ info_mem_command (const char *args, int from_tty)
gdb_printf ("\n");
}
}
-
/* Enable the memory region number NUM. */
@@ -474,7 +466,7 @@ mem_enable (int num)
m.enabled_p = 1;
return;
}
- gdb_printf (_("No memory region number %d.\n"), num);
+ gdb_printf (_ ("No memory region number %d.\n"), num);
}
static void
@@ -499,7 +491,6 @@ enable_mem_command (const char *args, int from_tty)
}
}
}
-
/* Disable the memory region number NUM. */
@@ -512,7 +503,7 @@ mem_disable (int num)
m.enabled_p = 0;
return;
}
- gdb_printf (_("No memory region number %d.\n"), num);
+ gdb_printf (_ ("No memory region number %d.\n"), num);
}
static void
@@ -545,20 +536,18 @@ mem_delete (int num)
{
if (!mem_region_list)
{
- gdb_printf (_("No memory region number %d.\n"), num);
+ gdb_printf (_ ("No memory region number %d.\n"), num);
return;
}
- auto it = std::remove_if (mem_region_list->begin (), mem_region_list->end (),
- [num] (const mem_region &m)
- {
- return m.number == num;
- });
+ auto it
+ = std::remove_if (mem_region_list->begin (), mem_region_list->end (),
+ [num] (const mem_region &m) { return m.number == num; });
if (it != mem_region_list->end ())
mem_region_list->erase (it);
else
- gdb_printf (_("No memory region number %d.\n"), num);
+ gdb_printf (_ ("No memory region number %d.\n"), num);
}
static void
@@ -570,7 +559,7 @@ delete_mem_command (const char *args, int from_tty)
if (args == NULL || *args == '\0')
{
- if (query (_("Delete all memory regions? ")))
+ if (query (_ ("Delete all memory regions? ")))
user_mem_clear ();
dont_repeat ();
return;
@@ -590,54 +579,56 @@ static struct cmd_list_element *mem_set_cmdlist;
static struct cmd_list_element *mem_show_cmdlist;
void _initialize_mem ();
+
void
_initialize_mem ()
{
- add_com ("mem", class_vars, mem_command, _("\
+ add_com ("mem", class_vars, mem_command,
+ _ ("\
Define attributes for memory region or reset memory region handling to "
-"target-based.\n\
+ "target-based.\n\
Usage: mem auto\n\
mem LOW HIGH [MODE WIDTH CACHE],\n\
where MODE may be rw (read/write), ro (read-only) or wo (write-only),\n\
WIDTH may be 8, 16, 32, or 64, and\n\
CACHE may be cache or nocache"));
- add_cmd ("mem", class_vars, enable_mem_command, _("\
+ add_cmd ("mem", class_vars, enable_mem_command, _ ("\
Enable memory region.\n\
Arguments are the IDs of the memory regions to enable.\n\
Usage: enable mem [ID]...\n\
-Do \"info mem\" to see current list of IDs."), &enablelist);
+Do \"info mem\" to see current list of IDs."),
+ &enablelist);
- add_cmd ("mem", class_vars, disable_mem_command, _("\
+ add_cmd ("mem", class_vars, disable_mem_command, _ ("\
Disable memory region.\n\
Arguments are the IDs of the memory regions to disable.\n\
Usage: disable mem [ID]...\n\
-Do \"info mem\" to see current list of IDs."), &disablelist);
+Do \"info mem\" to see current list of IDs."),
+ &disablelist);
- add_cmd ("mem", class_vars, delete_mem_command, _("\
+ add_cmd ("mem", class_vars, delete_mem_command, _ ("\
Delete memory region.\n\
Arguments are the IDs of the memory regions to delete.\n\
Usage: delete mem [ID]...\n\
-Do \"info mem\" to see current list of IDs."), &deletelist);
+Do \"info mem\" to see current list of IDs."),
+ &deletelist);
- add_info ("mem", info_mem_command,
- _("Memory region attributes."));
+ add_info ("mem", info_mem_command, _ ("Memory region attributes."));
- add_setshow_prefix_cmd ("mem", class_vars,
- _("Memory regions settings."),
- _("Memory regions settings."),
- &mem_set_cmdlist, &mem_show_cmdlist,
- &setlist, &showlist);
+ add_setshow_prefix_cmd ("mem", class_vars, _ ("Memory regions settings."),
+ _ ("Memory regions settings."), &mem_set_cmdlist,
+ &mem_show_cmdlist, &setlist, &showlist);
add_setshow_boolean_cmd ("inaccessible-by-default", no_class,
- &inaccessible_by_default, _("\
-Set handling of unknown memory regions."), _("\
-Show handling of unknown memory regions."), _("\
+ &inaccessible_by_default, _ ("\
+Set handling of unknown memory regions."),
+ _ ("\
+Show handling of unknown memory regions."),
+ _ ("\
If on, and some memory map is defined, debugger will emit errors on\n\
accesses to memory not defined in the memory map. If off, accesses to all\n\
memory addresses will be allowed."),
- NULL,
- show_inaccessible_by_default,
- &mem_set_cmdlist,
- &mem_show_cmdlist);
+ NULL, show_inaccessible_by_default,
+ &mem_set_cmdlist, &mem_show_cmdlist);
}
diff --git a/gdb/memattr.h b/gdb/memattr.h
index 9d776dce6ab..92320b0a47f 100644
--- a/gdb/memattr.h
+++ b/gdb/memattr.h
@@ -22,10 +22,10 @@
enum mem_access_mode
{
- MEM_NONE, /* Memory that is not physically present. */
- MEM_RW, /* read/write */
- MEM_RO, /* read only */
- MEM_WO, /* write only */
+ MEM_NONE, /* Memory that is not physically present. */
+ MEM_RW, /* read/write */
+ MEM_RO, /* read only */
+ MEM_WO, /* write only */
/* Read/write, but special steps are required to write to it. */
MEM_FLASH
@@ -34,10 +34,10 @@ enum mem_access_mode
enum mem_access_width
{
MEM_WIDTH_UNSPECIFIED,
- MEM_WIDTH_8, /* 8 bit accesses */
- MEM_WIDTH_16, /* 16 " " */
- MEM_WIDTH_32, /* 32 " " */
- MEM_WIDTH_64 /* 64 " " */
+ MEM_WIDTH_8, /* 8 bit accesses */
+ MEM_WIDTH_16, /* 16 " " */
+ MEM_WIDTH_32, /* 32 " " */
+ MEM_WIDTH_64 /* 64 " " */
};
/* The set of all attributes that can be set for a memory region.
@@ -49,8 +49,8 @@ enum mem_access_width
FIXME: It would be useful if there was a mechanism for targets to
add their own attributes. For example, the number of wait states. */
-
-struct mem_attrib
+
+struct mem_attrib
{
static mem_attrib unknown ()
{
@@ -68,10 +68,10 @@ struct mem_attrib
/* enables hardware breakpoints */
int hwbreak = 0;
-
+
/* enables host-side caching of memory region data */
int cache = 0;
-
+
/* Enables memory verification. After a write, memory is re-read
to verify that the write was successful. */
int verify = 0;
@@ -80,19 +80,22 @@ struct mem_attrib
int blocksize = -1;
};
-struct mem_region
+struct mem_region
{
/* Create a mem_region with default attributes. */
mem_region (CORE_ADDR lo_, CORE_ADDR hi_)
- : lo (lo_), hi (hi_)
- {}
+ : lo (lo_),
+ hi (hi_)
+ {
+ }
/* Create a mem_region with access mode MODE_, but otherwise default
attributes. */
mem_region (CORE_ADDR lo_, CORE_ADDR hi_, mem_access_mode mode_)
- : lo (lo_), hi (hi_)
+ : lo (lo_),
+ hi (hi_)
{
attrib.mode = mode_;
}
@@ -100,14 +103,14 @@ struct mem_region
/* Create a mem_region with attributes ATTRIB_. */
mem_region (CORE_ADDR lo_, CORE_ADDR hi_, const mem_attrib &attrib_)
- : lo (lo_), hi (hi_), attrib (attrib_)
- {}
-
- bool operator< (const mem_region &other) const
+ : lo (lo_),
+ hi (hi_),
+ attrib (attrib_)
{
- return this->lo < other.lo;
}
+ bool operator<(const mem_region &other) const { return this->lo < other.lo; }
+
/* Lowest address in the region. */
CORE_ADDR lo;
/* Address past the highest address of the region.
@@ -129,4 +132,4 @@ extern struct mem_region *lookup_mem_region (CORE_ADDR);
void invalidate_target_mem_regions (void);
-#endif /* MEMATTR_H */
+#endif /* MEMATTR_H */
diff --git a/gdb/memory-map.c b/gdb/memory-map.c
index 896d0151e13..51045c8cad2 100644
--- a/gdb/memory-map.c
+++ b/gdb/memory-map.c
@@ -30,8 +30,8 @@ parse_memory_map (const char *memory_map)
if (!have_warned)
{
have_warned = 1;
- warning (_("Can not parse XML memory map; XML support was disabled "
- "at compile time"));
+ warning (_ ("Can not parse XML memory map; XML support was disabled "
+ "at compile time"));
}
return std::vector<mem_region> ();
@@ -45,8 +45,9 @@ parse_memory_map (const char *memory_map)
struct memory_map_parsing_data
{
memory_map_parsing_data (std::vector<mem_region> *memory_map_)
- : memory_map (memory_map_)
- {}
+ : memory_map (memory_map_)
+ {
+ }
std::vector<mem_region> *memory_map;
@@ -69,11 +70,10 @@ memory_map_start_memory (struct gdb_xml_parser *parser,
= (ULONGEST *) xml_find_attribute (attributes, "start")->value.get ();
length_p
= (ULONGEST *) xml_find_attribute (attributes, "length")->value.get ();
- type_p
- = (ULONGEST *) xml_find_attribute (attributes, "type")->value.get ();
+ type_p = (ULONGEST *) xml_find_attribute (attributes, "type")->value.get ();
data->memory_map->emplace_back (*start_p, *start_p + *length_p,
- (enum mem_access_mode) *type_p);
+ (enum mem_access_mode) * type_p);
}
/* Handle the end of a <memory> element. Verify that any necessary
@@ -81,15 +81,15 @@ memory_map_start_memory (struct gdb_xml_parser *parser,
static void
memory_map_end_memory (struct gdb_xml_parser *parser,
- const struct gdb_xml_element *element,
- void *user_data, const char *body_text)
+ const struct gdb_xml_element *element, void *user_data,
+ const char *body_text)
{
struct memory_map_parsing_data *data
= (struct memory_map_parsing_data *) user_data;
const mem_region &r = data->memory_map->back ();
if (r.attrib.mode == MEM_FLASH && r.attrib.blocksize == -1)
- gdb_xml_error (parser, _("Flash block size is not set"));
+ gdb_xml_error (parser, _ ("Flash block size is not set"));
}
/* Handle the start of a <property> element by saving the name
@@ -126,49 +126,41 @@ memory_map_end_property (struct gdb_xml_parser *parser,
r.attrib.blocksize = gdb_xml_parse_ulongest (parser, body_text);
}
else
- gdb_xml_debug (parser, _("Unknown property \"%s\""),
+ gdb_xml_debug (parser, _ ("Unknown property \"%s\""),
data->property_name.c_str ());
}
/* The allowed elements and attributes for an XML memory map. */
-const struct gdb_xml_attribute property_attributes[] = {
- { "name", GDB_XML_AF_NONE, NULL, NULL },
- { NULL, GDB_XML_AF_NONE, NULL, NULL }
-};
+const struct gdb_xml_attribute property_attributes[]
+ = { { "name", GDB_XML_AF_NONE, NULL, NULL },
+ { NULL, GDB_XML_AF_NONE, NULL, NULL } };
-const struct gdb_xml_element memory_children[] = {
- { "property", property_attributes, NULL,
- GDB_XML_EF_REPEATABLE | GDB_XML_EF_OPTIONAL,
- memory_map_start_property, memory_map_end_property },
- { NULL, NULL, NULL, GDB_XML_EF_NONE, NULL, NULL }
-};
+const struct gdb_xml_element memory_children[]
+ = { { "property", property_attributes, NULL,
+ GDB_XML_EF_REPEATABLE | GDB_XML_EF_OPTIONAL, memory_map_start_property,
+ memory_map_end_property },
+ { NULL, NULL, NULL, GDB_XML_EF_NONE, NULL, NULL } };
-const struct gdb_xml_enum memory_type_enum[] = {
- { "ram", MEM_RW },
- { "rom", MEM_RO },
- { "flash", MEM_FLASH },
- { NULL, 0 }
-};
+const struct gdb_xml_enum memory_type_enum[] = { { "ram", MEM_RW },
+ { "rom", MEM_RO },
+ { "flash", MEM_FLASH },
+ { NULL, 0 } };
-const struct gdb_xml_attribute memory_attributes[] = {
- { "start", GDB_XML_AF_NONE, gdb_xml_parse_attr_ulongest, NULL },
- { "length", GDB_XML_AF_NONE, gdb_xml_parse_attr_ulongest, NULL },
- { "type", GDB_XML_AF_NONE, gdb_xml_parse_attr_enum, &memory_type_enum },
- { NULL, GDB_XML_AF_NONE, NULL, NULL }
-};
+const struct gdb_xml_attribute memory_attributes[]
+ = { { "start", GDB_XML_AF_NONE, gdb_xml_parse_attr_ulongest, NULL },
+ { "length", GDB_XML_AF_NONE, gdb_xml_parse_attr_ulongest, NULL },
+ { "type", GDB_XML_AF_NONE, gdb_xml_parse_attr_enum, &memory_type_enum },
+ { NULL, GDB_XML_AF_NONE, NULL, NULL } };
-const struct gdb_xml_element memory_map_children[] = {
- { "memory", memory_attributes, memory_children, GDB_XML_EF_REPEATABLE,
- memory_map_start_memory, memory_map_end_memory },
- { NULL, NULL, NULL, GDB_XML_EF_NONE, NULL, NULL }
-};
+const struct gdb_xml_element memory_map_children[]
+ = { { "memory", memory_attributes, memory_children, GDB_XML_EF_REPEATABLE,
+ memory_map_start_memory, memory_map_end_memory },
+ { NULL, NULL, NULL, GDB_XML_EF_NONE, NULL, NULL } };
-const struct gdb_xml_element memory_map_elements[] = {
- { "memory-map", NULL, memory_map_children, GDB_XML_EF_NONE,
- NULL, NULL },
- { NULL, NULL, NULL, GDB_XML_EF_NONE, NULL, NULL }
-};
+const struct gdb_xml_element memory_map_elements[]
+ = { { "memory-map", NULL, memory_map_children, GDB_XML_EF_NONE, NULL, NULL },
+ { NULL, NULL, NULL, GDB_XML_EF_NONE, NULL, NULL } };
std::vector<mem_region>
parse_memory_map (const char *memory_map)
@@ -176,8 +168,9 @@ parse_memory_map (const char *memory_map)
std::vector<mem_region> ret;
memory_map_parsing_data data (&ret);
- if (gdb_xml_parse_quick (_("target memory map"), NULL, memory_map_elements,
- memory_map, &data) == 0)
+ if (gdb_xml_parse_quick (_ ("target memory map"), NULL, memory_map_elements,
+ memory_map, &data)
+ == 0)
{
/* Parsed successfully, keep the result. */
return ret;
diff --git a/gdb/memory-map.h b/gdb/memory-map.h
index af2c24b616e..a3d1eb6c7c4 100644
--- a/gdb/memory-map.h
+++ b/gdb/memory-map.h
@@ -17,7 +17,6 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
-
#ifndef MEMORY_MAP_H
#define MEMORY_MAP_H
diff --git a/gdb/memrange.c b/gdb/memrange.c
index 31dc893cfdb..2369ee22563 100644
--- a/gdb/memrange.c
+++ b/gdb/memrange.c
@@ -22,8 +22,7 @@
#include <algorithm>
int
-mem_ranges_overlap (CORE_ADDR start1, int len1,
- CORE_ADDR start2, int len2)
+mem_ranges_overlap (CORE_ADDR start1, int len1, CORE_ADDR start2, int len2)
{
ULONGEST h, l;
@@ -37,8 +36,7 @@ mem_ranges_overlap (CORE_ADDR start1, int len1,
int
address_in_mem_range (CORE_ADDR address, const struct mem_range *r)
{
- return (r->start <= address
- && (address - r->start) < r->length);
+ return (r->start <= address && (address - r->start) < r->length);
}
void
@@ -59,9 +57,9 @@ normalize_mem_ranges (std::vector<mem_range> *memory)
{
m[a].length = std::max ((CORE_ADDR) m[a].length,
(m[b].start - m[a].start) + m[b].length);
- continue; /* next b, same a */
+ continue; /* next b, same a */
}
- a++; /* next a */
+ a++; /* next a */
if (a != b)
m[a] = m[b];
diff --git a/gdb/memrange.h b/gdb/memrange.h
index 109bec3e5a6..448e0e7f644 100644
--- a/gdb/memrange.h
+++ b/gdb/memrange.h
@@ -27,18 +27,19 @@ struct mem_range
mem_range () = default;
mem_range (CORE_ADDR start_, int length_)
- : start (start_), length (length_)
- {}
+ : start (start_),
+ length (length_)
+ {
+ }
- bool operator< (const mem_range &other) const
+ bool operator<(const mem_range &other) const
{
return this->start < other.start;
}
bool operator== (const mem_range &other) const
{
- return (this->start == other.start
- && this->length == other.length);
+ return (this->start == other.start && this->length == other.length);
}
/* Lowest address in the range. */
@@ -51,8 +52,8 @@ struct mem_range
/* Returns true if the ranges defined by [start1, start1+len1) and
[start2, start2+len2) overlap. */
-extern int mem_ranges_overlap (CORE_ADDR start1, int len1,
- CORE_ADDR start2, int len2);
+extern int mem_ranges_overlap (CORE_ADDR start1, int len1, CORE_ADDR start2,
+ int len2);
/* Returns true if ADDR is in RANGE. */
diff --git a/gdb/memtag.c b/gdb/memtag.c
index f5096639b2d..7232aae9a60 100644
--- a/gdb/memtag.c
+++ b/gdb/memtag.c
@@ -24,8 +24,8 @@
/* See memtag.h */
bool
-get_next_core_memtag_section (bfd *abfd, asection *section,
- CORE_ADDR address, memtag_section_info &info)
+get_next_core_memtag_section (bfd *abfd, asection *section, CORE_ADDR address,
+ memtag_section_info &info)
{
/* If the caller provided no SECTION to start from, search from the
beginning. */
@@ -43,8 +43,8 @@ get_next_core_memtag_section (bfd *abfd, asection *section,
it but keep going through the sections. */
if (memtag_range_size == 0 || tags_size == 0)
{
- warning (_("Found memtag section with empty memory "
- "range or empty tag dump"));
+ warning (_ ("Found memtag section with empty memory "
+ "range or empty tag dump"));
continue;
}
else
@@ -53,8 +53,7 @@ get_next_core_memtag_section (bfd *abfd, asection *section,
CORE_ADDR end_address = start_address + memtag_range_size;
/* Is the address within [start_address, end_address)? */
- if (address >= start_address
- && address < end_address)
+ if (address >= start_address && address < end_address)
{
info.start_address = start_address;
info.end_address = end_address;
diff --git a/gdb/mep-tdep.c b/gdb/mep-tdep.c
index 2b3f6424012..64697cf480e 100644
--- a/gdb/mep-tdep.c
+++ b/gdb/mep-tdep.c
@@ -51,7 +51,6 @@
#include "opcodes/mep-desc.h"
#include "opcodes/mep-opc.h"
-
/* The gdbarch_tdep structure. */
/* A quick recap for GDB hackers not familiar with the whole Toshiba
@@ -115,7 +114,6 @@
selected me_module. The MeP $OPT register indicates which
options are present on the current processor. */
-
struct mep_gdbarch_tdep : gdbarch_tdep_base
{
/* A CGEN cpu descriptor for this BFD architecture and machine.
@@ -143,18 +141,14 @@ struct mep_gdbarch_tdep : gdbarch_tdep_base
CONFIG_ATTR me_module {};
};
-
-
/* Getting me_module information from the CGEN tables. */
-
/* Find an entry in the DESC's hardware table whose name begins with
PREFIX, and whose ISA mask intersects COPRO_ISA_MASK, but does not
intersect with GENERIC_ISA_MASK. If there is no matching entry,
return zero. */
static const CGEN_HW_ENTRY *
-find_hw_entry_by_prefix_and_isa (CGEN_CPU_DESC desc,
- const char *prefix,
+find_hw_entry_by_prefix_and_isa (CGEN_CPU_DESC desc, const char *prefix,
CGEN_BITSET *copro_isa_mask,
CGEN_BITSET *generic_isa_mask)
{
@@ -166,12 +160,11 @@ find_hw_entry_by_prefix_and_isa (CGEN_CPU_DESC desc,
const CGEN_HW_ENTRY *hw = desc->hw_table.entries[i];
if (strncmp (prefix, hw->name, prefix_len) == 0)
{
- CGEN_BITSET *hw_isa_mask
- = ((CGEN_BITSET *)
- &CGEN_ATTR_CGEN_HW_ISA_VALUE (CGEN_HW_ATTRS (hw)));
+ CGEN_BITSET *hw_isa_mask = ((
+ CGEN_BITSET *) &CGEN_ATTR_CGEN_HW_ISA_VALUE (CGEN_HW_ATTRS (hw)));
if (cgen_bitset_intersect_p (hw_isa_mask, copro_isa_mask)
- && ! cgen_bitset_intersect_p (hw_isa_mask, generic_isa_mask))
+ && !cgen_bitset_intersect_p (hw_isa_mask, generic_isa_mask))
return hw;
}
}
@@ -179,7 +172,6 @@ find_hw_entry_by_prefix_and_isa (CGEN_CPU_DESC desc,
return 0;
}
-
/* Find an entry in DESC's hardware table whose type is TYPE. Return
zero if there is none. */
static const CGEN_HW_ENTRY *
@@ -198,15 +190,13 @@ find_hw_entry_by_type (CGEN_CPU_DESC desc, CGEN_HW_TYPE type)
return 0;
}
-
/* Return the CGEN hardware table entry for the coprocessor register
set for ME_MODULE, whose name prefix is PREFIX. If ME_MODULE has
no such register set, return zero. If ME_MODULE is the generic
me_module CONFIG_NONE, return the table entry for the register set
whose hardware type is GENERIC_TYPE. */
static const CGEN_HW_ENTRY *
-me_module_register_set (CONFIG_ATTR me_module,
- const char *prefix,
+me_module_register_set (CONFIG_ATTR me_module, const char *prefix,
CGEN_HW_TYPE generic_type)
{
/* This is kind of tricky, because the hardware table is constructed
@@ -259,8 +249,7 @@ me_module_register_set (CONFIG_ATTR me_module,
mask contains any of the me_module's coprocessor ISAs,
specifically excluding the generic coprocessor register sets. */
- mep_gdbarch_tdep *tdep
- = gdbarch_tdep<mep_gdbarch_tdep> (target_gdbarch ());
+ mep_gdbarch_tdep *tdep = gdbarch_tdep<mep_gdbarch_tdep> (target_gdbarch ());
CGEN_CPU_DESC desc = tdep->cpu_desc;
const CGEN_HW_ENTRY *hw;
@@ -277,13 +266,13 @@ me_module_register_set (CONFIG_ATTR me_module,
has that coprocessor. */
cop_and_core = cgen_bitset_copy (cop);
cgen_bitset_union (cop, core, cop_and_core);
- hw = find_hw_entry_by_prefix_and_isa (desc, prefix, cop_and_core, generic);
+ hw = find_hw_entry_by_prefix_and_isa (desc, prefix, cop_and_core,
+ generic);
}
return hw;
}
-
/* Given a hardware table entry HW representing a register set, return
a pointer to the keyword table with all the register names. If HW
is NULL, return NULL, to propagate the "no such register set" info
@@ -291,7 +280,7 @@ me_module_register_set (CONFIG_ATTR me_module,
static CGEN_KEYWORD *
register_set_keyword_table (const CGEN_HW_ENTRY *hw)
{
- if (! hw)
+ if (!hw)
return NULL;
/* Check that HW is actually a keyword table. */
@@ -302,7 +291,6 @@ register_set_keyword_table (const CGEN_HW_ENTRY *hw)
return (CGEN_KEYWORD *) hw->asm_data;
}
-
/* Given a keyword table KEYWORD and a register number REGNUM, return
the name of the register, or "" if KEYWORD contains no register
whose number is REGNUM. */
@@ -329,27 +317,26 @@ register_name_from_keyword (CGEN_KEYWORD *keyword_table, int regnum)
return "";
}
-
/* Masks for option bits in the OPT special-purpose register. */
-enum {
- MEP_OPT_DIV = 1 << 25, /* 32-bit divide instruction option */
- MEP_OPT_MUL = 1 << 24, /* 32-bit multiply instruction option */
- MEP_OPT_BIT = 1 << 23, /* bit manipulation instruction option */
- MEP_OPT_SAT = 1 << 22, /* saturation instruction option */
- MEP_OPT_CLP = 1 << 21, /* clip instruction option */
- MEP_OPT_MIN = 1 << 20, /* min/max instruction option */
- MEP_OPT_AVE = 1 << 19, /* average instruction option */
- MEP_OPT_ABS = 1 << 18, /* absolute difference instruction option */
- MEP_OPT_LDZ = 1 << 16, /* leading zero instruction option */
- MEP_OPT_VL64 = 1 << 6, /* 64-bit VLIW operation mode option */
- MEP_OPT_VL32 = 1 << 5, /* 32-bit VLIW operation mode option */
- MEP_OPT_COP = 1 << 4, /* coprocessor option */
- MEP_OPT_DSP = 1 << 2, /* DSP option */
- MEP_OPT_UCI = 1 << 1, /* UCI option */
- MEP_OPT_DBG = 1 << 0, /* DBG function option */
+enum
+{
+ MEP_OPT_DIV = 1 << 25, /* 32-bit divide instruction option */
+ MEP_OPT_MUL = 1 << 24, /* 32-bit multiply instruction option */
+ MEP_OPT_BIT = 1 << 23, /* bit manipulation instruction option */
+ MEP_OPT_SAT = 1 << 22, /* saturation instruction option */
+ MEP_OPT_CLP = 1 << 21, /* clip instruction option */
+ MEP_OPT_MIN = 1 << 20, /* min/max instruction option */
+ MEP_OPT_AVE = 1 << 19, /* average instruction option */
+ MEP_OPT_ABS = 1 << 18, /* absolute difference instruction option */
+ MEP_OPT_LDZ = 1 << 16, /* leading zero instruction option */
+ MEP_OPT_VL64 = 1 << 6, /* 64-bit VLIW operation mode option */
+ MEP_OPT_VL32 = 1 << 5, /* 32-bit VLIW operation mode option */
+ MEP_OPT_COP = 1 << 4, /* coprocessor option */
+ MEP_OPT_DSP = 1 << 2, /* DSP option */
+ MEP_OPT_UCI = 1 << 1, /* UCI option */
+ MEP_OPT_DBG = 1 << 0, /* DBG function option */
};
-
/* Given the option_mask value for a particular entry in
mep_config_map, produce the value the processor's OPT register
would use to represent the same set of options. */
@@ -358,7 +345,8 @@ opt_from_option_mask (unsigned int option_mask)
{
/* A table mapping OPT register bits onto CGEN config map option
bits. */
- struct {
+ struct
+ {
unsigned int opt_bit, option_mask_bit;
} bits[] = {
{ MEP_OPT_DIV, 1 << CGEN_INSN_OPTIONAL_DIV_INSN },
@@ -386,7 +374,6 @@ opt_from_option_mask (unsigned int option_mask)
return opt;
}
-
/* Return the value the $OPT register would use to represent the set
of options for ME_MODULE. */
static unsigned int
@@ -395,7 +382,6 @@ me_module_opt (CONFIG_ATTR me_module)
return opt_from_option_mask (mep_config_map[me_module].option_mask);
}
-
/* Return the width of ME_MODULE's coprocessor data bus, in bits.
This is either 32 or 64. */
static int
@@ -408,7 +394,6 @@ me_module_cop_data_bus_width (CONFIG_ATTR me_module)
return 32;
}
-
/* Return true if ME_MODULE is big-endian, false otherwise. */
static int
me_module_big_endian (CONFIG_ATTR me_module)
@@ -416,22 +401,20 @@ me_module_big_endian (CONFIG_ATTR me_module)
return mep_config_map[me_module].big_endian;
}
-
/* Return the name of ME_MODULE, or NULL if it has no name. */
static const char *
me_module_name (CONFIG_ATTR me_module)
{
/* The default me_module has "" as its name, but it's easier for our
callers to test for NULL. */
- if (! mep_config_map[me_module].name
+ if (!mep_config_map[me_module].name
|| mep_config_map[me_module].name[0] == '\0')
return NULL;
else
return mep_config_map[me_module].name;
}
-
-/* Register set. */
+/* Register set. */
/* The MeP spec defines the following registers:
16 general purpose registers (r0-r15)
@@ -481,11 +464,11 @@ enum
MEP_R12_REGNUM = 12,
MEP_FP_REGNUM = MEP_R8_REGNUM,
MEP_R13_REGNUM = 13,
- MEP_TP_REGNUM = MEP_R13_REGNUM, /* (r13) Tiny data pointer */
+ MEP_TP_REGNUM = MEP_R13_REGNUM, /* (r13) Tiny data pointer */
MEP_R14_REGNUM = 14,
- MEP_GP_REGNUM = MEP_R14_REGNUM, /* (r14) Global pointer */
+ MEP_GP_REGNUM = MEP_R14_REGNUM, /* (r14) Global pointer */
MEP_R15_REGNUM = 15,
- MEP_SP_REGNUM = MEP_R15_REGNUM, /* (r15) Stack pointer */
+ MEP_SP_REGNUM = MEP_R15_REGNUM, /* (r15) Stack pointer */
MEP_LAST_GPR_REGNUM = MEP_R15_REGNUM,
/* The raw control registers. These are the values as received via
@@ -493,38 +476,38 @@ enum
code touch the via the pseudoregisters, which enforce read-only
bits. */
MEP_FIRST_RAW_CSR_REGNUM = 16,
- MEP_RAW_PC_REGNUM = 16, /* Program counter */
- MEP_RAW_LP_REGNUM = 17, /* Link pointer */
- MEP_RAW_SAR_REGNUM = 18, /* Raw shift amount */
- MEP_RAW_CSR3_REGNUM = 19, /* csr3: reserved */
- MEP_RAW_RPB_REGNUM = 20, /* Raw repeat begin address */
- MEP_RAW_RPE_REGNUM = 21, /* Repeat end address */
- MEP_RAW_RPC_REGNUM = 22, /* Repeat count */
- MEP_RAW_HI_REGNUM = 23, /* Upper 32 bits of result of 64 bit mult/div */
- MEP_RAW_LO_REGNUM = 24, /* Lower 32 bits of result of 64 bit mult/div */
- MEP_RAW_CSR9_REGNUM = 25, /* csr3: reserved */
- MEP_RAW_CSR10_REGNUM = 26, /* csr3: reserved */
- MEP_RAW_CSR11_REGNUM = 27, /* csr3: reserved */
- MEP_RAW_MB0_REGNUM = 28, /* Raw modulo begin address 0 */
- MEP_RAW_ME0_REGNUM = 29, /* Raw modulo end address 0 */
- MEP_RAW_MB1_REGNUM = 30, /* Raw modulo begin address 1 */
- MEP_RAW_ME1_REGNUM = 31, /* Raw modulo end address 1 */
- MEP_RAW_PSW_REGNUM = 32, /* Raw program status word */
- MEP_RAW_ID_REGNUM = 33, /* Raw processor ID/revision */
- MEP_RAW_TMP_REGNUM = 34, /* Temporary */
- MEP_RAW_EPC_REGNUM = 35, /* Exception program counter */
- MEP_RAW_EXC_REGNUM = 36, /* Raw exception cause */
- MEP_RAW_CFG_REGNUM = 37, /* Raw processor configuration*/
- MEP_RAW_CSR22_REGNUM = 38, /* csr3: reserved */
- MEP_RAW_NPC_REGNUM = 39, /* Nonmaskable interrupt PC */
- MEP_RAW_DBG_REGNUM = 40, /* Raw debug */
- MEP_RAW_DEPC_REGNUM = 41, /* Debug exception PC */
- MEP_RAW_OPT_REGNUM = 42, /* Raw options */
- MEP_RAW_RCFG_REGNUM = 43, /* Raw local ram config */
- MEP_RAW_CCFG_REGNUM = 44, /* Raw cache config */
- MEP_RAW_CSR29_REGNUM = 45, /* csr3: reserved */
- MEP_RAW_CSR30_REGNUM = 46, /* csr3: reserved */
- MEP_RAW_CSR31_REGNUM = 47, /* csr3: reserved */
+ MEP_RAW_PC_REGNUM = 16, /* Program counter */
+ MEP_RAW_LP_REGNUM = 17, /* Link pointer */
+ MEP_RAW_SAR_REGNUM = 18, /* Raw shift amount */
+ MEP_RAW_CSR3_REGNUM = 19, /* csr3: reserved */
+ MEP_RAW_RPB_REGNUM = 20, /* Raw repeat begin address */
+ MEP_RAW_RPE_REGNUM = 21, /* Repeat end address */
+ MEP_RAW_RPC_REGNUM = 22, /* Repeat count */
+ MEP_RAW_HI_REGNUM = 23, /* Upper 32 bits of result of 64 bit mult/div */
+ MEP_RAW_LO_REGNUM = 24, /* Lower 32 bits of result of 64 bit mult/div */
+ MEP_RAW_CSR9_REGNUM = 25, /* csr3: reserved */
+ MEP_RAW_CSR10_REGNUM = 26, /* csr3: reserved */
+ MEP_RAW_CSR11_REGNUM = 27, /* csr3: reserved */
+ MEP_RAW_MB0_REGNUM = 28, /* Raw modulo begin address 0 */
+ MEP_RAW_ME0_REGNUM = 29, /* Raw modulo end address 0 */
+ MEP_RAW_MB1_REGNUM = 30, /* Raw modulo begin address 1 */
+ MEP_RAW_ME1_REGNUM = 31, /* Raw modulo end address 1 */
+ MEP_RAW_PSW_REGNUM = 32, /* Raw program status word */
+ MEP_RAW_ID_REGNUM = 33, /* Raw processor ID/revision */
+ MEP_RAW_TMP_REGNUM = 34, /* Temporary */
+ MEP_RAW_EPC_REGNUM = 35, /* Exception program counter */
+ MEP_RAW_EXC_REGNUM = 36, /* Raw exception cause */
+ MEP_RAW_CFG_REGNUM = 37, /* Raw processor configuration*/
+ MEP_RAW_CSR22_REGNUM = 38, /* csr3: reserved */
+ MEP_RAW_NPC_REGNUM = 39, /* Nonmaskable interrupt PC */
+ MEP_RAW_DBG_REGNUM = 40, /* Raw debug */
+ MEP_RAW_DEPC_REGNUM = 41, /* Debug exception PC */
+ MEP_RAW_OPT_REGNUM = 42, /* Raw options */
+ MEP_RAW_RCFG_REGNUM = 43, /* Raw local ram config */
+ MEP_RAW_CCFG_REGNUM = 44, /* Raw cache config */
+ MEP_RAW_CSR29_REGNUM = 45, /* csr3: reserved */
+ MEP_RAW_CSR30_REGNUM = 46, /* csr3: reserved */
+ MEP_RAW_CSR31_REGNUM = 47, /* csr3: reserved */
MEP_LAST_RAW_CSR_REGNUM = MEP_RAW_CSR31_REGNUM,
/* The raw coprocessor general-purpose registers. These are all 64
@@ -552,37 +535,37 @@ enum
implement registers with read-only bits. */
MEP_FIRST_CSR_REGNUM = MEP_FIRST_PSEUDO_REGNUM,
MEP_PC_REGNUM = MEP_FIRST_CSR_REGNUM, /* Program counter */
- MEP_LP_REGNUM, /* Link pointer */
- MEP_SAR_REGNUM, /* shift amount */
- MEP_CSR3_REGNUM, /* csr3: reserved */
- MEP_RPB_REGNUM, /* repeat begin address */
- MEP_RPE_REGNUM, /* Repeat end address */
- MEP_RPC_REGNUM, /* Repeat count */
- MEP_HI_REGNUM, /* Upper 32 bits of the result of 64 bit mult/div */
- MEP_LO_REGNUM, /* Lower 32 bits of the result of 64 bit mult/div */
- MEP_CSR9_REGNUM, /* csr3: reserved */
- MEP_CSR10_REGNUM, /* csr3: reserved */
- MEP_CSR11_REGNUM, /* csr3: reserved */
- MEP_MB0_REGNUM, /* modulo begin address 0 */
- MEP_ME0_REGNUM, /* modulo end address 0 */
- MEP_MB1_REGNUM, /* modulo begin address 1 */
- MEP_ME1_REGNUM, /* modulo end address 1 */
- MEP_PSW_REGNUM, /* program status word */
- MEP_ID_REGNUM, /* processor ID/revision */
- MEP_TMP_REGNUM, /* Temporary */
- MEP_EPC_REGNUM, /* Exception program counter */
- MEP_EXC_REGNUM, /* exception cause */
- MEP_CFG_REGNUM, /* processor configuration*/
- MEP_CSR22_REGNUM, /* csr3: reserved */
- MEP_NPC_REGNUM, /* Nonmaskable interrupt PC */
- MEP_DBG_REGNUM, /* debug */
- MEP_DEPC_REGNUM, /* Debug exception PC */
- MEP_OPT_REGNUM, /* options */
- MEP_RCFG_REGNUM, /* local ram config */
- MEP_CCFG_REGNUM, /* cache config */
- MEP_CSR29_REGNUM, /* csr3: reserved */
- MEP_CSR30_REGNUM, /* csr3: reserved */
- MEP_CSR31_REGNUM, /* csr3: reserved */
+ MEP_LP_REGNUM, /* Link pointer */
+ MEP_SAR_REGNUM, /* shift amount */
+ MEP_CSR3_REGNUM, /* csr3: reserved */
+ MEP_RPB_REGNUM, /* repeat begin address */
+ MEP_RPE_REGNUM, /* Repeat end address */
+ MEP_RPC_REGNUM, /* Repeat count */
+ MEP_HI_REGNUM, /* Upper 32 bits of the result of 64 bit mult/div */
+ MEP_LO_REGNUM, /* Lower 32 bits of the result of 64 bit mult/div */
+ MEP_CSR9_REGNUM, /* csr3: reserved */
+ MEP_CSR10_REGNUM, /* csr3: reserved */
+ MEP_CSR11_REGNUM, /* csr3: reserved */
+ MEP_MB0_REGNUM, /* modulo begin address 0 */
+ MEP_ME0_REGNUM, /* modulo end address 0 */
+ MEP_MB1_REGNUM, /* modulo begin address 1 */
+ MEP_ME1_REGNUM, /* modulo end address 1 */
+ MEP_PSW_REGNUM, /* program status word */
+ MEP_ID_REGNUM, /* processor ID/revision */
+ MEP_TMP_REGNUM, /* Temporary */
+ MEP_EPC_REGNUM, /* Exception program counter */
+ MEP_EXC_REGNUM, /* exception cause */
+ MEP_CFG_REGNUM, /* processor configuration*/
+ MEP_CSR22_REGNUM, /* csr3: reserved */
+ MEP_NPC_REGNUM, /* Nonmaskable interrupt PC */
+ MEP_DBG_REGNUM, /* debug */
+ MEP_DEPC_REGNUM, /* Debug exception PC */
+ MEP_OPT_REGNUM, /* options */
+ MEP_RCFG_REGNUM, /* local ram config */
+ MEP_CCFG_REGNUM, /* cache config */
+ MEP_CSR29_REGNUM, /* csr3: reserved */
+ MEP_CSR30_REGNUM, /* csr3: reserved */
+ MEP_CSR31_REGNUM, /* csr3: reserved */
MEP_LAST_CSR_REGNUM = MEP_CSR31_REGNUM,
/* The 32-bit integer view of the coprocessor GPR's. */
@@ -611,34 +594,33 @@ enum
MEP_NUM_REGS = MEP_NUM_RAW_REGS + MEP_NUM_PSEUDO_REGS
};
-
#define IN_SET(set, n) \
- (MEP_FIRST_ ## set ## _REGNUM <= (n) && (n) <= MEP_LAST_ ## set ## _REGNUM)
+ (MEP_FIRST_##set##_REGNUM <= (n) && (n) <= MEP_LAST_##set##_REGNUM)
-#define IS_GPR_REGNUM(n) (IN_SET (GPR, (n)))
+#define IS_GPR_REGNUM(n) (IN_SET (GPR, (n)))
#define IS_RAW_CSR_REGNUM(n) (IN_SET (RAW_CSR, (n)))
-#define IS_RAW_CR_REGNUM(n) (IN_SET (RAW_CR, (n)))
+#define IS_RAW_CR_REGNUM(n) (IN_SET (RAW_CR, (n)))
#define IS_RAW_CCR_REGNUM(n) (IN_SET (RAW_CCR, (n)))
-#define IS_CSR_REGNUM(n) (IN_SET (CSR, (n)))
-#define IS_CR32_REGNUM(n) (IN_SET (CR32, (n)))
+#define IS_CSR_REGNUM(n) (IN_SET (CSR, (n)))
+#define IS_CR32_REGNUM(n) (IN_SET (CR32, (n)))
#define IS_FP_CR32_REGNUM(n) (IN_SET (FP_CR32, (n)))
-#define IS_CR64_REGNUM(n) (IN_SET (CR64, (n)))
+#define IS_CR64_REGNUM(n) (IN_SET (CR64, (n)))
#define IS_FP_CR64_REGNUM(n) (IN_SET (FP_CR64, (n)))
-#define IS_CR_REGNUM(n) (IS_CR32_REGNUM (n) || IS_FP_CR32_REGNUM (n) \
- || IS_CR64_REGNUM (n) || IS_FP_CR64_REGNUM (n))
-#define IS_CCR_REGNUM(n) (IN_SET (CCR, (n)))
+#define IS_CR_REGNUM(n) \
+ (IS_CR32_REGNUM (n) || IS_FP_CR32_REGNUM (n) || IS_CR64_REGNUM (n) \
+ || IS_FP_CR64_REGNUM (n))
+#define IS_CCR_REGNUM(n) (IN_SET (CCR, (n)))
-#define IS_RAW_REGNUM(n) (IN_SET (RAW, (n)))
-#define IS_PSEUDO_REGNUM(n) (IN_SET (PSEUDO, (n)))
+#define IS_RAW_REGNUM(n) (IN_SET (RAW, (n)))
+#define IS_PSEUDO_REGNUM(n) (IN_SET (PSEUDO, (n)))
#define NUM_REGS_IN_SET(set) \
- (MEP_LAST_ ## set ## _REGNUM - MEP_FIRST_ ## set ## _REGNUM + 1)
-
-#define MEP_GPR_SIZE (4) /* Size of a MeP general-purpose register. */
-#define MEP_PSW_SIZE (4) /* Size of the PSW register. */
-#define MEP_LP_SIZE (4) /* Size of the LP register. */
+ (MEP_LAST_##set##_REGNUM - MEP_FIRST_##set##_REGNUM + 1)
+#define MEP_GPR_SIZE (4) /* Size of a MeP general-purpose register. */
+#define MEP_PSW_SIZE (4) /* Size of the PSW register. */
+#define MEP_LP_SIZE (4) /* Size of the LP register. */
/* Many of the control/special registers contain bits that cannot be
written to; some are entirely read-only. So we present them all as
@@ -658,47 +640,30 @@ struct mep_csr_register
LONGEST writeable_bits;
};
-
/* mep_csr_registers[i] describes the i'th CSR.
We just list the register numbers here explicitly to help catch
typos. */
-#define CSR(name) MEP_RAW_ ## name ## _REGNUM, MEP_ ## name ## _REGNUM
+#define CSR(name) MEP_RAW_##name##_REGNUM, MEP_##name##_REGNUM
static mep_csr_register mep_csr_registers[] = {
- { CSR(PC), 0xffffffff }, /* manual says r/o, but we can write it */
- { CSR(LP), 0xffffffff },
- { CSR(SAR), 0x0000003f },
- { CSR(CSR3), 0xffffffff },
- { CSR(RPB), 0xfffffffe },
- { CSR(RPE), 0xffffffff },
- { CSR(RPC), 0xffffffff },
- { CSR(HI), 0xffffffff },
- { CSR(LO), 0xffffffff },
- { CSR(CSR9), 0xffffffff },
- { CSR(CSR10), 0xffffffff },
- { CSR(CSR11), 0xffffffff },
- { CSR(MB0), 0x0000ffff },
- { CSR(ME0), 0x0000ffff },
- { CSR(MB1), 0x0000ffff },
- { CSR(ME1), 0x0000ffff },
- { CSR(PSW), 0x000003ff },
- { CSR(ID), 0x00000000 },
- { CSR(TMP), 0xffffffff },
- { CSR(EPC), 0xffffffff },
- { CSR(EXC), 0x000030f0 },
- { CSR(CFG), 0x00c0001b },
- { CSR(CSR22), 0xffffffff },
- { CSR(NPC), 0xffffffff },
- { CSR(DBG), 0x00000580 },
- { CSR(DEPC), 0xffffffff },
- { CSR(OPT), 0x00000000 },
- { CSR(RCFG), 0x00000000 },
- { CSR(CCFG), 0x00000000 },
- { CSR(CSR29), 0xffffffff },
- { CSR(CSR30), 0xffffffff },
- { CSR(CSR31), 0xffffffff },
+ { CSR (PC), 0xffffffff }, /* manual says r/o, but we can write it */
+ { CSR (LP), 0xffffffff }, { CSR (SAR), 0x0000003f },
+ { CSR (CSR3), 0xffffffff }, { CSR (RPB), 0xfffffffe },
+ { CSR (RPE), 0xffffffff }, { CSR (RPC), 0xffffffff },
+ { CSR (HI), 0xffffffff }, { CSR (LO), 0xffffffff },
+ { CSR (CSR9), 0xffffffff }, { CSR (CSR10), 0xffffffff },
+ { CSR (CSR11), 0xffffffff }, { CSR (MB0), 0x0000ffff },
+ { CSR (ME0), 0x0000ffff }, { CSR (MB1), 0x0000ffff },
+ { CSR (ME1), 0x0000ffff }, { CSR (PSW), 0x000003ff },
+ { CSR (ID), 0x00000000 }, { CSR (TMP), 0xffffffff },
+ { CSR (EPC), 0xffffffff }, { CSR (EXC), 0x000030f0 },
+ { CSR (CFG), 0x00c0001b }, { CSR (CSR22), 0xffffffff },
+ { CSR (NPC), 0xffffffff }, { CSR (DBG), 0x00000580 },
+ { CSR (DEPC), 0xffffffff }, { CSR (OPT), 0x00000000 },
+ { CSR (RCFG), 0x00000000 }, { CSR (CCFG), 0x00000000 },
+ { CSR (CSR29), 0xffffffff }, { CSR (CSR30), 0xffffffff },
+ { CSR (CSR31), 0xffffffff },
};
-
/* If R is the number of a raw register, then mep_raw_to_pseudo[R] is
the number of the corresponding pseudoregister. Otherwise,
mep_raw_to_pseudo[R] == R. */
@@ -720,8 +685,8 @@ mep_init_pseudoregister_maps (void)
/* Verify that the raw and pseudo ranges have matching sizes. */
gdb_assert (NUM_REGS_IN_SET (RAW_CSR) == NUM_REGS_IN_SET (CSR));
- gdb_assert (NUM_REGS_IN_SET (RAW_CR) == NUM_REGS_IN_SET (CR32));
- gdb_assert (NUM_REGS_IN_SET (RAW_CR) == NUM_REGS_IN_SET (CR64));
+ gdb_assert (NUM_REGS_IN_SET (RAW_CR) == NUM_REGS_IN_SET (CR32));
+ gdb_assert (NUM_REGS_IN_SET (RAW_CR) == NUM_REGS_IN_SET (CR64));
gdb_assert (NUM_REGS_IN_SET (RAW_CCR) == NUM_REGS_IN_SET (CCR));
for (i = 0; i < ARRAY_SIZE (mep_csr_registers); i++)
@@ -729,7 +694,7 @@ mep_init_pseudoregister_maps (void)
struct mep_csr_register *r = &mep_csr_registers[i];
gdb_assert (r->pseudo == MEP_FIRST_CSR_REGNUM + i);
- gdb_assert (r->raw == MEP_FIRST_RAW_CSR_REGNUM + i);
+ gdb_assert (r->raw == MEP_FIRST_RAW_CSR_REGNUM + i);
}
/* Set up the initial raw<->pseudo mappings. */
@@ -780,7 +745,6 @@ mep_init_pseudoregister_maps (void)
}
}
-
static int
mep_debug_reg_to_regnum (struct gdbarch *gdbarch, int debug_reg)
{
@@ -790,34 +754,28 @@ mep_debug_reg_to_regnum (struct gdbarch *gdbarch, int debug_reg)
return -1;
}
-
/* Return the size, in bits, of the coprocessor pseudoregister
numbered PSEUDO. */
static int
mep_pseudo_cr_size (int pseudo)
{
- if (IS_CR32_REGNUM (pseudo)
- || IS_FP_CR32_REGNUM (pseudo))
+ if (IS_CR32_REGNUM (pseudo) || IS_FP_CR32_REGNUM (pseudo))
return 32;
- else if (IS_CR64_REGNUM (pseudo)
- || IS_FP_CR64_REGNUM (pseudo))
+ else if (IS_CR64_REGNUM (pseudo) || IS_FP_CR64_REGNUM (pseudo))
return 64;
else
gdb_assert_not_reached ("unexpected coprocessor pseudo register");
}
-
/* If the coprocessor pseudoregister numbered PSEUDO is a
floating-point register, return non-zero; if it is an integer
register, return zero. */
static int
mep_pseudo_cr_is_float (int pseudo)
{
- return (IS_FP_CR32_REGNUM (pseudo)
- || IS_FP_CR64_REGNUM (pseudo));
+ return (IS_FP_CR32_REGNUM (pseudo) || IS_FP_CR64_REGNUM (pseudo));
}
-
/* Given a coprocessor GPR pseudoregister number, return its index
within that register bank. */
static int
@@ -826,16 +784,15 @@ mep_pseudo_cr_index (int pseudo)
if (IS_CR32_REGNUM (pseudo))
return pseudo - MEP_FIRST_CR32_REGNUM;
else if (IS_FP_CR32_REGNUM (pseudo))
- return pseudo - MEP_FIRST_FP_CR32_REGNUM;
+ return pseudo - MEP_FIRST_FP_CR32_REGNUM;
else if (IS_CR64_REGNUM (pseudo))
- return pseudo - MEP_FIRST_CR64_REGNUM;
+ return pseudo - MEP_FIRST_CR64_REGNUM;
else if (IS_FP_CR64_REGNUM (pseudo))
- return pseudo - MEP_FIRST_FP_CR64_REGNUM;
+ return pseudo - MEP_FIRST_FP_CR64_REGNUM;
else
gdb_assert_not_reached ("unexpected coprocessor pseudo register");
}
-
/* Return the me_module index describing the current target.
If the current target has registers (e.g., simulator, remote
@@ -861,7 +818,6 @@ current_me_module (void)
}
}
-
/* Return the set of options for the current target, in the form that
the OPT register would use.
@@ -876,15 +832,14 @@ current_options (void)
if (target_has_registers ())
{
ULONGEST regval;
- regcache_cooked_read_unsigned (get_current_regcache (),
- MEP_OPT_REGNUM, &regval);
+ regcache_cooked_read_unsigned (get_current_regcache (), MEP_OPT_REGNUM,
+ &regval);
return regval;
}
else
return me_module_opt (current_me_module ());
}
-
/* Return the width of the current me_module's coprocessor data bus,
in bits. This is either 32 or 64. */
static int
@@ -893,7 +848,6 @@ current_cop_data_bus_width (void)
return me_module_cop_data_bus_width (current_me_module ());
}
-
/* Return the keyword table of coprocessor general-purpose register
names appropriate for the me_module we're dealing with. */
static CGEN_KEYWORD *
@@ -905,7 +859,6 @@ current_cr_names (void)
return register_set_keyword_table (hw);
}
-
/* Return non-zero if the coprocessor general-purpose registers are
floating-point values, zero otherwise. */
static int
@@ -917,7 +870,6 @@ current_cr_is_float (void)
return CGEN_ATTR_CGEN_HW_IS_FLOAT_VALUE (CGEN_HW_ATTRS (hw));
}
-
/* Return the keyword table of coprocessor control register names
appropriate for the me_module we're dealing with. */
static CGEN_KEYWORD *
@@ -929,29 +881,28 @@ current_ccr_names (void)
return register_set_keyword_table (hw);
}
-
static const char *
mep_register_name (struct gdbarch *gdbarch, int regnr)
{
/* General-purpose registers. */
static const char *gpr_names[] = {
- "r0", "r1", "r2", "r3", /* 0 */
- "r4", "r5", "r6", "r7", /* 4 */
- "fp", "r9", "r10", "r11", /* 8 */
- "r12", "tp", "gp", "sp" /* 12 */
+ "r0", "r1", "r2", "r3", /* 0 */
+ "r4", "r5", "r6", "r7", /* 4 */
+ "fp", "r9", "r10", "r11", /* 8 */
+ "r12", "tp", "gp", "sp" /* 12 */
};
/* Special-purpose registers. */
static const char *csr_names[] = {
- "pc", "lp", "sar", "", /* 0 csr3: reserved */
- "rpb", "rpe", "rpc", "hi", /* 4 */
- "lo", "", "", "", /* 8 csr9-csr11: reserved */
- "mb0", "me0", "mb1", "me1", /* 12 */
-
- "psw", "id", "tmp", "epc", /* 16 */
- "exc", "cfg", "", "npc", /* 20 csr22: reserved */
- "dbg", "depc", "opt", "rcfg", /* 24 */
- "ccfg", "", "", "" /* 28 csr29-csr31: reserved */
+ "pc", "lp", "sar", "", /* 0 csr3: reserved */
+ "rpb", "rpe", "rpc", "hi", /* 4 */
+ "lo", "", "", "", /* 8 csr9-csr11: reserved */
+ "mb0", "me0", "mb1", "me1", /* 12 */
+
+ "psw", "id", "tmp", "epc", /* 16 */
+ "exc", "cfg", "", "npc", /* 20 csr22: reserved */
+ "dbg", "depc", "opt", "rcfg", /* 24 */
+ "ccfg", "", "", "" /* 28 csr29-csr31: reserved */
};
if (IS_GPR_REGNUM (regnr))
@@ -961,7 +912,7 @@ mep_register_name (struct gdbarch *gdbarch, int regnr)
/* The 'hi' and 'lo' registers are only present on processors
that have the 'MUL' or 'DIV' instructions enabled. */
if ((regnr == MEP_HI_REGNUM || regnr == MEP_LO_REGNUM)
- && (! (current_options () & (MEP_OPT_MUL | MEP_OPT_DIV))))
+ && (!(current_options () & (MEP_OPT_MUL | MEP_OPT_DIV))))
return "";
return csr_names[regnr - MEP_FIRST_CSR_REGNUM];
@@ -973,11 +924,11 @@ mep_register_name (struct gdbarch *gdbarch, int regnr)
int cr_is_float;
/* Does this module have a coprocessor at all? */
- if (! (current_options () & MEP_OPT_COP))
+ if (!(current_options () & MEP_OPT_COP))
return "";
names = current_cr_names ();
- if (! names)
+ if (!names)
/* This module's coprocessor has no general-purpose registers. */
return "";
@@ -989,7 +940,7 @@ mep_register_name (struct gdbarch *gdbarch, int regnr)
cr_is_float = current_cr_is_float ();
/* The extra ! operators ensure we get boolean equality, not
numeric equality. */
- if (! cr_is_float != ! mep_pseudo_cr_is_float (regnr))
+ if (!cr_is_float != !mep_pseudo_cr_is_float (regnr))
/* This module's coprocessor's GPR's are of a different type. */
return "";
@@ -998,17 +949,18 @@ mep_register_name (struct gdbarch *gdbarch, int regnr)
else if (IS_CCR_REGNUM (regnr))
{
/* Does this module have a coprocessor at all? */
- if (! (current_options () & MEP_OPT_COP))
+ if (!(current_options () & MEP_OPT_COP))
return "";
{
CGEN_KEYWORD *names = current_ccr_names ();
- if (! names)
+ if (!names)
/* This me_module's coprocessor has no control registers. */
return "";
- return register_name_from_keyword (names, regnr-MEP_FIRST_CCR_REGNUM);
+ return register_name_from_keyword (names,
+ regnr - MEP_FIRST_CCR_REGNUM);
}
}
@@ -1019,13 +971,11 @@ mep_register_name (struct gdbarch *gdbarch, int regnr)
return "";
}
-
/* Custom register groups for the MeP. */
static const reggroup *mep_csr_reggroup; /* control/special */
-static const reggroup *mep_cr_reggroup; /* coprocessor general-purpose */
+static const reggroup *mep_cr_reggroup; /* coprocessor general-purpose */
static const reggroup *mep_ccr_reggroup; /* coprocessor control */
-
static int
mep_register_reggroup_p (struct gdbarch *gdbarch, int regnum,
const struct reggroup *group)
@@ -1034,22 +984,19 @@ mep_register_reggroup_p (struct gdbarch *gdbarch, int regnum,
{
const char *name = mep_register_name (gdbarch, regnum);
- if (! name || name[0] == '\0')
+ if (!name || name[0] == '\0')
return 0;
}
/* We could separate the GPRs and the CSRs. Toshiba has approved of
the existing behavior, so we'd want to run that by them. */
if (group == general_reggroup)
- return (IS_GPR_REGNUM (regnum)
- || IS_CSR_REGNUM (regnum));
+ return (IS_GPR_REGNUM (regnum) || IS_CSR_REGNUM (regnum));
/* Everything is in the 'all' reggroup, except for the raw CSR's. */
else if (group == all_reggroup)
- return (IS_GPR_REGNUM (regnum)
- || IS_CSR_REGNUM (regnum)
- || IS_CR_REGNUM (regnum)
- || IS_CCR_REGNUM (regnum));
+ return (IS_GPR_REGNUM (regnum) || IS_CSR_REGNUM (regnum)
+ || IS_CR_REGNUM (regnum) || IS_CCR_REGNUM (regnum));
/* All registers should be saved and restored, except for the raw
CSR's.
@@ -1061,10 +1008,8 @@ mep_register_reggroup_p (struct gdbarch *gdbarch, int regnum,
coprocessor isn't supposed to do things like that --- you'd use a
hardware engine, perhaps. */
else if (group == save_reggroup || group == restore_reggroup)
- return (IS_GPR_REGNUM (regnum)
- || IS_CSR_REGNUM (regnum)
- || IS_CR_REGNUM (regnum)
- || IS_CCR_REGNUM (regnum));
+ return (IS_GPR_REGNUM (regnum) || IS_CSR_REGNUM (regnum)
+ || IS_CR_REGNUM (regnum) || IS_CCR_REGNUM (regnum));
else if (group == mep_csr_reggroup)
return IS_CSR_REGNUM (regnum);
@@ -1076,7 +1021,6 @@ mep_register_reggroup_p (struct gdbarch *gdbarch, int regnum,
return 0;
}
-
static struct type *
mep_register_type (struct gdbarch *gdbarch, int reg_nr)
{
@@ -1119,10 +1063,8 @@ mep_register_type (struct gdbarch *gdbarch, int reg_nr)
}
static enum register_status
-mep_pseudo_cr32_read (struct gdbarch *gdbarch,
- readable_regcache *regcache,
- int cookednum,
- gdb_byte *buf)
+mep_pseudo_cr32_read (struct gdbarch *gdbarch, readable_regcache *regcache,
+ int cookednum, gdb_byte *buf)
{
enum register_status status;
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
@@ -1143,42 +1085,30 @@ mep_pseudo_cr32_read (struct gdbarch *gdbarch,
return status;
}
-
static enum register_status
-mep_pseudo_cr64_read (struct gdbarch *gdbarch,
- readable_regcache *regcache,
- int cookednum,
- gdb_byte *buf)
+mep_pseudo_cr64_read (struct gdbarch *gdbarch, readable_regcache *regcache,
+ int cookednum, gdb_byte *buf)
{
return regcache->raw_read (mep_pseudo_to_raw[cookednum], buf);
}
-
static enum register_status
-mep_pseudo_register_read (struct gdbarch *gdbarch,
- readable_regcache *regcache,
- int cookednum,
- gdb_byte *buf)
+mep_pseudo_register_read (struct gdbarch *gdbarch, readable_regcache *regcache,
+ int cookednum, gdb_byte *buf)
{
- if (IS_CSR_REGNUM (cookednum)
- || IS_CCR_REGNUM (cookednum))
+ if (IS_CSR_REGNUM (cookednum) || IS_CCR_REGNUM (cookednum))
return regcache->raw_read (mep_pseudo_to_raw[cookednum], buf);
- else if (IS_CR32_REGNUM (cookednum)
- || IS_FP_CR32_REGNUM (cookednum))
+ else if (IS_CR32_REGNUM (cookednum) || IS_FP_CR32_REGNUM (cookednum))
return mep_pseudo_cr32_read (gdbarch, regcache, cookednum, buf);
- else if (IS_CR64_REGNUM (cookednum)
- || IS_FP_CR64_REGNUM (cookednum))
+ else if (IS_CR64_REGNUM (cookednum) || IS_FP_CR64_REGNUM (cookednum))
return mep_pseudo_cr64_read (gdbarch, regcache, cookednum, buf);
else
gdb_assert_not_reached ("unexpected pseudo register");
}
-
static void
-mep_pseudo_csr_write (struct gdbarch *gdbarch,
- struct regcache *regcache,
- int cookednum,
- const gdb_byte *buf)
+mep_pseudo_csr_write (struct gdbarch *gdbarch, struct regcache *regcache,
+ int cookednum, const gdb_byte *buf)
{
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
int size = register_size (gdbarch, cookednum);
@@ -1195,28 +1125,25 @@ mep_pseudo_csr_write (struct gdbarch *gdbarch,
ULONGEST old_bits;
ULONGEST new_bits;
ULONGEST mixed_bits;
-
+
regcache_raw_read_unsigned (regcache, r->raw, &old_bits);
new_bits = extract_unsigned_integer (buf, size, byte_order);
- mixed_bits = ((r->writeable_bits & new_bits)
- | (~r->writeable_bits & old_bits));
+ mixed_bits
+ = ((r->writeable_bits & new_bits) | (~r->writeable_bits & old_bits));
regcache_raw_write_unsigned (regcache, r->raw, mixed_bits);
}
}
-
static void
-mep_pseudo_cr32_write (struct gdbarch *gdbarch,
- struct regcache *regcache,
- int cookednum,
- const gdb_byte *buf)
+mep_pseudo_cr32_write (struct gdbarch *gdbarch, struct regcache *regcache,
+ int cookednum, const gdb_byte *buf)
{
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
/* Expand the 32-bit value into a 64-bit value, and write that to
the pseudoregister. */
int rawnum = mep_pseudo_to_raw[cookednum];
gdb_byte buf64[8];
-
+
gdb_assert (register_type (gdbarch, rawnum)->length () == sizeof (buf64));
gdb_assert (register_type (gdbarch, cookednum)->length () == 4);
/* Slow, but legible. */
@@ -1225,30 +1152,22 @@ mep_pseudo_cr32_write (struct gdbarch *gdbarch,
regcache->raw_write (rawnum, buf64);
}
-
static void
-mep_pseudo_cr64_write (struct gdbarch *gdbarch,
- struct regcache *regcache,
- int cookednum,
- const gdb_byte *buf)
+mep_pseudo_cr64_write (struct gdbarch *gdbarch, struct regcache *regcache,
+ int cookednum, const gdb_byte *buf)
{
regcache->raw_write (mep_pseudo_to_raw[cookednum], buf);
}
-
static void
-mep_pseudo_register_write (struct gdbarch *gdbarch,
- struct regcache *regcache,
- int cookednum,
- const gdb_byte *buf)
+mep_pseudo_register_write (struct gdbarch *gdbarch, struct regcache *regcache,
+ int cookednum, const gdb_byte *buf)
{
if (IS_CSR_REGNUM (cookednum))
mep_pseudo_csr_write (gdbarch, regcache, cookednum, buf);
- else if (IS_CR32_REGNUM (cookednum)
- || IS_FP_CR32_REGNUM (cookednum))
+ else if (IS_CR32_REGNUM (cookednum) || IS_FP_CR32_REGNUM (cookednum))
mep_pseudo_cr32_write (gdbarch, regcache, cookednum, buf);
- else if (IS_CR64_REGNUM (cookednum)
- || IS_FP_CR64_REGNUM (cookednum))
+ else if (IS_CR64_REGNUM (cookednum) || IS_FP_CR64_REGNUM (cookednum))
mep_pseudo_cr64_write (gdbarch, regcache, cookednum, buf);
else if (IS_CCR_REGNUM (cookednum))
regcache->raw_write (mep_pseudo_to_raw[cookednum], buf);
@@ -1256,14 +1175,12 @@ mep_pseudo_register_write (struct gdbarch *gdbarch,
gdb_assert_not_reached ("unexpected pseudo register");
}
-
-
/* Disassembly. */
static int
-mep_gdb_print_insn (bfd_vma pc, disassemble_info * info)
+mep_gdb_print_insn (bfd_vma pc, disassemble_info *info)
{
- struct obj_section * s = find_pc_section (pc);
+ struct obj_section *s = find_pc_section (pc);
info->arch = bfd_arch_mep;
if (s)
@@ -1278,10 +1195,8 @@ mep_gdb_print_insn (bfd_vma pc, disassemble_info * info)
return print_insn_mep (pc, info);
}
-
/* Prologue analysis. */
-
/* The MeP has two classes of instructions: "core" instructions, which
are pretty normal RISC chip stuff, and "coprocessor" instructions,
which are mostly concerned with moving data in and out of
@@ -1328,7 +1243,6 @@ mep_gdb_print_insn (bfd_vma pc, disassemble_info * info)
instruction, so I don't really know what's up there; perhaps these
are always the user-defined coprocessor instructions. */
-
/* Return non-zero if PC is in a VLIW code section, zero
otherwise. */
static int
@@ -1340,7 +1254,6 @@ mep_pc_in_vliw_section (CORE_ADDR pc)
return 0;
}
-
/* Set *INSN to the next core instruction at PC, and return the
address of the next instruction.
@@ -1405,7 +1318,7 @@ mep_pc_in_vliw_section (CORE_ADDR pc)
significant to prologue analysis --- for the time being,
anyway. */
-static CORE_ADDR
+static CORE_ADDR
mep_get_insn (struct gdbarch *gdbarch, CORE_ADDR pc, unsigned long *insn)
{
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
@@ -1434,7 +1347,7 @@ mep_get_insn (struct gdbarch *gdbarch, CORE_ADDR pc, unsigned long *insn)
you have a script that sets a bunch of standard breakpoints.)
So we'll just return zero here, and hope for the best. */
- if (! (vliw_mode & (MEP_OPT_VL32 | MEP_OPT_VL64)))
+ if (!(vliw_mode & (MEP_OPT_VL32 | MEP_OPT_VL64)))
return 0;
/* If both VL32 and VL64 are set, that's bogus, too. */
@@ -1476,7 +1389,7 @@ mep_get_insn (struct gdbarch *gdbarch, CORE_ADDR pc, unsigned long *insn)
else
gdb_assert_not_reached ("unexpected vliw mode");
}
-
+
/* Otherwise, the top two bits of the major opcode are (again) what
we need to check. */
else if ((*insn & 0xc0000000) == 0xc0000000)
@@ -1487,9 +1400,8 @@ mep_get_insn (struct gdbarch *gdbarch, CORE_ADDR pc, unsigned long *insn)
return pc + insn_len;
}
-
/* Sign-extend the LEN-bit value N. */
-#define SEXT(n, len) ((((int) (n)) ^ (1 << ((len) - 1))) - (1 << ((len) - 1)))
+#define SEXT(n, len) ((((int) (n)) ^ (1 << ((len) -1))) - (1 << ((len) -1)))
/* Return the LEN-bit field at POS from I. */
#define FIELD(i, pos, len) (((i) >> (pos)) & ((1 << (len)) - 1))
@@ -1497,7 +1409,6 @@ mep_get_insn (struct gdbarch *gdbarch, CORE_ADDR pc, unsigned long *insn)
/* Like FIELD, but sign-extend the field's value. */
#define SFIELD(i, pos, len) (SEXT (FIELD ((i), (pos), (len)), (len)))
-
/* Macros for decoding instructions.
Remember that 16-bit instructions are placed in bits 16..31 of i,
@@ -1511,67 +1422,66 @@ mep_get_insn (struct gdbarch *gdbarch, CORE_ADDR pc, unsigned long *insn)
/* SW Rn,(Rm) 0000_nnnn_mmmm_1010 */
/* SW Rn,disp16(Rm) 1100_nnnn_mmmm_1010 dddd_dddd_dddd_dddd */
-#define IS_SW(i) (((i) & 0xf00f0000) == 0xc00a0000)
+#define IS_SW(i) (((i) &0xf00f0000) == 0xc00a0000)
/* SB Rn,disp16(Rm) 1100_nnnn_mmmm_1000 dddd_dddd_dddd_dddd */
-#define IS_SB(i) (((i) & 0xf00f0000) == 0xc0080000)
+#define IS_SB(i) (((i) &0xf00f0000) == 0xc0080000)
/* SH Rn,disp16(Rm) 1100_nnnn_mmmm_1001 dddd_dddd_dddd_dddd */
-#define IS_SH(i) (((i) & 0xf00f0000) == 0xc0090000)
-#define SWBH_32_BASE(i) (FIELD (i, 20, 4))
-#define SWBH_32_SOURCE(i) (FIELD (i, 24, 4))
-#define SWBH_32_OFFSET(i) (SFIELD (i, 0, 16))
+#define IS_SH(i) (((i) &0xf00f0000) == 0xc0090000)
+#define SWBH_32_BASE(i) (FIELD (i, 20, 4))
+#define SWBH_32_SOURCE(i) (FIELD (i, 24, 4))
+#define SWBH_32_OFFSET(i) (SFIELD (i, 0, 16))
/* SW Rn,disp7.align4(SP) 0100_nnnn_0ddd_dd10 xxxx_xxxx_xxxx_xxxx */
-#define IS_SW_IMMD(i) (((i) & 0xf0830000) == 0x40020000)
-#define SW_IMMD_SOURCE(i) (FIELD (i, 24, 4))
-#define SW_IMMD_OFFSET(i) (FIELD (i, 18, 5) << 2)
+#define IS_SW_IMMD(i) (((i) &0xf0830000) == 0x40020000)
+#define SW_IMMD_SOURCE(i) (FIELD (i, 24, 4))
+#define SW_IMMD_OFFSET(i) (FIELD (i, 18, 5) << 2)
/* SW Rn,(Rm) 0000_nnnn_mmmm_1010 xxxx_xxxx_xxxx_xxxx */
-#define IS_SW_REG(i) (((i) & 0xf00f0000) == 0x000a0000)
-#define SW_REG_SOURCE(i) (FIELD (i, 24, 4))
-#define SW_REG_BASE(i) (FIELD (i, 20, 4))
+#define IS_SW_REG(i) (((i) &0xf00f0000) == 0x000a0000)
+#define SW_REG_SOURCE(i) (FIELD (i, 24, 4))
+#define SW_REG_BASE(i) (FIELD (i, 20, 4))
/* ADD3 Rl,Rn,Rm 1001_nnnn_mmmm_llll xxxx_xxxx_xxxx_xxxx */
-#define IS_ADD3_16_REG(i) (((i) & 0xf0000000) == 0x90000000)
-#define ADD3_16_REG_SRC1(i) (FIELD (i, 20, 4)) /* n */
-#define ADD3_16_REG_SRC2(i) (FIELD (i, 24, 4)) /* m */
+#define IS_ADD3_16_REG(i) (((i) &0xf0000000) == 0x90000000)
+#define ADD3_16_REG_SRC1(i) (FIELD (i, 20, 4)) /* n */
+#define ADD3_16_REG_SRC2(i) (FIELD (i, 24, 4)) /* m */
/* ADD3 Rn,Rm,imm16 1100_nnnn_mmmm_0000 iiii_iiii_iiii_iiii */
-#define IS_ADD3_32(i) (((i) & 0xf00f0000) == 0xc0000000)
-#define ADD3_32_TARGET(i) (FIELD (i, 24, 4))
-#define ADD3_32_SOURCE(i) (FIELD (i, 20, 4))
-#define ADD3_32_OFFSET(i) (SFIELD (i, 0, 16))
+#define IS_ADD3_32(i) (((i) &0xf00f0000) == 0xc0000000)
+#define ADD3_32_TARGET(i) (FIELD (i, 24, 4))
+#define ADD3_32_SOURCE(i) (FIELD (i, 20, 4))
+#define ADD3_32_OFFSET(i) (SFIELD (i, 0, 16))
/* ADD3 Rn,SP,imm7.align4 0100_nnnn_0iii_ii00 xxxx_xxxx_xxxx_xxxx */
-#define IS_ADD3_16(i) (((i) & 0xf0830000) == 0x40000000)
-#define ADD3_16_TARGET(i) (FIELD (i, 24, 4))
-#define ADD3_16_OFFSET(i) (FIELD (i, 18, 5) << 2)
+#define IS_ADD3_16(i) (((i) &0xf0830000) == 0x40000000)
+#define ADD3_16_TARGET(i) (FIELD (i, 24, 4))
+#define ADD3_16_OFFSET(i) (FIELD (i, 18, 5) << 2)
/* ADD Rn,imm6 0110_nnnn_iiii_ii00 xxxx_xxxx_xxxx_xxxx */
-#define IS_ADD(i) (((i) & 0xf0030000) == 0x60000000)
-#define ADD_TARGET(i) (FIELD (i, 24, 4))
-#define ADD_OFFSET(i) (SFIELD (i, 18, 6))
+#define IS_ADD(i) (((i) &0xf0030000) == 0x60000000)
+#define ADD_TARGET(i) (FIELD (i, 24, 4))
+#define ADD_OFFSET(i) (SFIELD (i, 18, 6))
/* LDC Rn,imm5 0111_nnnn_iiii_101I xxxx_xxxx_xxxx_xxxx
imm5 = I||i[7:4] */
-#define IS_LDC(i) (((i) & 0xf00e0000) == 0x700a0000)
-#define LDC_IMM(i) ((FIELD (i, 16, 1) << 4) | FIELD (i, 20, 4))
-#define LDC_TARGET(i) (FIELD (i, 24, 4))
+#define IS_LDC(i) (((i) &0xf00e0000) == 0x700a0000)
+#define LDC_IMM(i) ((FIELD (i, 16, 1) << 4) | FIELD (i, 20, 4))
+#define LDC_TARGET(i) (FIELD (i, 24, 4))
/* LW Rn,disp16(Rm) 1100_nnnn_mmmm_1110 dddd_dddd_dddd_dddd */
-#define IS_LW(i) (((i) & 0xf00f0000) == 0xc00e0000)
-#define LW_TARGET(i) (FIELD (i, 24, 4))
-#define LW_BASE(i) (FIELD (i, 20, 4))
-#define LW_OFFSET(i) (SFIELD (i, 0, 16))
+#define IS_LW(i) (((i) &0xf00f0000) == 0xc00e0000)
+#define LW_TARGET(i) (FIELD (i, 24, 4))
+#define LW_BASE(i) (FIELD (i, 20, 4))
+#define LW_OFFSET(i) (SFIELD (i, 0, 16))
/* MOV Rn,Rm 0000_nnnn_mmmm_0000 xxxx_xxxx_xxxx_xxxx */
-#define IS_MOV(i) (((i) & 0xf00f0000) == 0x00000000)
-#define MOV_TARGET(i) (FIELD (i, 24, 4))
-#define MOV_SOURCE(i) (FIELD (i, 20, 4))
+#define IS_MOV(i) (((i) &0xf00f0000) == 0x00000000)
+#define MOV_TARGET(i) (FIELD (i, 24, 4))
+#define MOV_SOURCE(i) (FIELD (i, 20, 4))
/* BRA disp12.align2 1011_dddd_dddd_ddd0 xxxx_xxxx_xxxx_xxxx */
-#define IS_BRA(i) (((i) & 0xf0010000) == 0xb0000000)
-#define BRA_DISP(i) (SFIELD (i, 17, 11) << 1)
-
+#define IS_BRA(i) (((i) &0xf0010000) == 0xb0000000)
+#define BRA_DISP(i) (SFIELD (i, 17, 11) << 1)
/* This structure holds the results of a prologue analysis. */
struct mep_prologue
@@ -1615,9 +1525,8 @@ struct mep_prologue
static int
is_arg_reg (pv_t value)
{
- return (value.kind == pvk_register
- && MEP_R1_REGNUM <= value.reg && value.reg <= MEP_R4_REGNUM
- && value.k == 0);
+ return (value.kind == pvk_register && MEP_R1_REGNUM <= value.reg
+ && value.reg <= MEP_R4_REGNUM && value.k == 0);
}
/* Return non-zero if a store of REG's current value VALUE to ADDR is
@@ -1633,12 +1542,10 @@ static int
is_arg_spill (struct gdbarch *gdbarch, pv_t value, pv_t addr,
struct pv_area *stack)
{
- return (is_arg_reg (value)
- && pv_is_register (addr, MEP_SP_REGNUM)
- && ! stack->find_reg (gdbarch, value.reg, 0));
+ return (is_arg_reg (value) && pv_is_register (addr, MEP_SP_REGNUM)
+ && !stack->find_reg (gdbarch, value.reg, 0));
}
-
/* Function for finding saved registers in a 'struct pv_area'; we pass
this to pv_area::scan.
@@ -1650,20 +1557,17 @@ check_for_saved (void *result_untyped, pv_t addr, CORE_ADDR size, pv_t value)
{
struct mep_prologue *result = (struct mep_prologue *) result_untyped;
- if (value.kind == pvk_register
- && value.k == 0
+ if (value.kind == pvk_register && value.k == 0
&& pv_is_register (addr, MEP_SP_REGNUM)
&& size == register_size (result->gdbarch, value.reg))
result->reg_offset[value.reg] = addr.k;
}
-
/* Analyze a prologue starting at START_PC, going no further than
LIMIT_PC. Fill in RESULT as appropriate. */
static void
-mep_analyze_prologue (struct gdbarch *gdbarch,
- CORE_ADDR start_pc, CORE_ADDR limit_pc,
- struct mep_prologue *result)
+mep_analyze_prologue (struct gdbarch *gdbarch, CORE_ADDR start_pc,
+ CORE_ADDR limit_pc, struct mep_prologue *result)
{
CORE_ADDR pc;
unsigned long insn;
@@ -1693,7 +1597,7 @@ mep_analyze_prologue (struct gdbarch *gdbarch,
able to read the instruction from memory, or that we don't
have enough information to be able to reliably decode it. So
we'll store here and hope for the best. */
- if (! next_pc)
+ if (!next_pc)
break;
/* Note the current values of the SP and FP, so we can tell if
@@ -1733,7 +1637,7 @@ mep_analyze_prologue (struct gdbarch *gdbarch,
accuracy, it would be better to just quit now. */
if (stack.store_would_trash (reg[rm]))
break;
-
+
if (is_arg_spill (gdbarch, reg[rn], reg[rm], &stack))
after_last_frame_setup_insn = next_pc;
@@ -1771,9 +1675,9 @@ mep_analyze_prologue (struct gdbarch *gdbarch,
int rn = SWBH_32_SOURCE (insn);
int rm = SWBH_32_BASE (insn);
int disp = SWBH_32_OFFSET (insn);
- int size = (IS_SB (insn) ? 1
+ int size = (IS_SB (insn) ? 1
: IS_SH (insn) ? 2
- : (gdb_assert (IS_SW (insn)), 4));
+ : (gdb_assert (IS_SW (insn)), 4));
pv_t addr = pv_add_constant (reg[rm], disp);
if (stack.store_would_trash (addr))
@@ -1845,12 +1749,12 @@ mep_analyze_prologue (struct gdbarch *gdbarch,
shrunk the frame), then it's probably part of a frame
teardown sequence, and the prologue should end before that. */
- if (! pv_is_identical (reg[MEP_FP_REGNUM], pre_insn_fp))
+ if (!pv_is_identical (reg[MEP_FP_REGNUM], pre_insn_fp))
{
- if (! pv_is_register_k (reg[MEP_FP_REGNUM], MEP_FP_REGNUM, 0))
+ if (!pv_is_register_k (reg[MEP_FP_REGNUM], MEP_FP_REGNUM, 0))
after_last_frame_setup_insn = next_pc;
}
- else if (! pv_is_identical (reg[MEP_SP_REGNUM], pre_insn_sp))
+ else if (!pv_is_identical (reg[MEP_SP_REGNUM], pre_insn_sp))
{
/* The comparison of constants looks odd, there, because .k
is unsigned. All it really means is that the new value
@@ -1882,7 +1786,6 @@ mep_analyze_prologue (struct gdbarch *gdbarch,
result->prologue_end = after_last_frame_setup_insn;
}
-
static CORE_ADDR
mep_skip_prologue (struct gdbarch *gdbarch, CORE_ADDR pc)
{
@@ -1891,57 +1794,49 @@ mep_skip_prologue (struct gdbarch *gdbarch, CORE_ADDR pc)
struct mep_prologue p;
/* Try to find the extent of the function that contains PC. */
- if (! find_pc_partial_function (pc, &name, &func_addr, &func_end))
+ if (!find_pc_partial_function (pc, &name, &func_addr, &func_end))
return pc;
mep_analyze_prologue (gdbarch, pc, func_end, &p);
return p.prologue_end;
}
-
-
/* Breakpoints. */
constexpr gdb_byte mep_break_insn[] = { 0x70, 0x32 };
typedef BP_MANIPULATION (mep_break_insn) mep_breakpoint;
-
/* Frames and frame unwinding. */
-
static struct mep_prologue *
mep_analyze_frame_prologue (frame_info_ptr this_frame,
void **this_prologue_cache)
{
- if (! *this_prologue_cache)
+ if (!*this_prologue_cache)
{
CORE_ADDR func_start, stop_addr;
- *this_prologue_cache
- = FRAME_OBSTACK_ZALLOC (struct mep_prologue);
+ *this_prologue_cache = FRAME_OBSTACK_ZALLOC (struct mep_prologue);
func_start = get_frame_func (this_frame);
stop_addr = get_frame_pc (this_frame);
/* If we couldn't find any function containing the PC, then
just initialize the prologue cache, but don't do anything. */
- if (! func_start)
+ if (!func_start)
stop_addr = func_start;
- mep_analyze_prologue (get_frame_arch (this_frame),
- func_start, stop_addr,
+ mep_analyze_prologue (get_frame_arch (this_frame), func_start, stop_addr,
(struct mep_prologue *) *this_prologue_cache);
}
return (struct mep_prologue *) *this_prologue_cache;
}
-
/* Given the next frame and a prologue cache, return this frame's
base. */
static CORE_ADDR
-mep_frame_base (frame_info_ptr this_frame,
- void **this_prologue_cache)
+mep_frame_base (frame_info_ptr this_frame, void **this_prologue_cache)
{
struct mep_prologue *p
= mep_analyze_frame_prologue (this_frame, this_prologue_cache);
@@ -1954,32 +1849,27 @@ mep_frame_base (frame_info_ptr this_frame,
frame pointer, use that to find the base. */
if (p->has_frame_ptr)
{
- CORE_ADDR fp
- = get_frame_register_unsigned (this_frame, MEP_FP_REGNUM);
+ CORE_ADDR fp = get_frame_register_unsigned (this_frame, MEP_FP_REGNUM);
return fp - p->frame_ptr_offset;
}
else
{
- CORE_ADDR sp
- = get_frame_register_unsigned (this_frame, MEP_SP_REGNUM);
+ CORE_ADDR sp = get_frame_register_unsigned (this_frame, MEP_SP_REGNUM);
return sp - p->frame_size;
}
}
-
static void
-mep_frame_this_id (frame_info_ptr this_frame,
- void **this_prologue_cache,
+mep_frame_this_id (frame_info_ptr this_frame, void **this_prologue_cache,
struct frame_id *this_id)
{
*this_id = frame_id_build (mep_frame_base (this_frame, this_prologue_cache),
get_frame_func (this_frame));
}
-
static struct value *
-mep_frame_prev_register (frame_info_ptr this_frame,
- void **this_prologue_cache, int regnum)
+mep_frame_prev_register (frame_info_ptr this_frame, void **this_prologue_cache,
+ int regnum)
{
struct mep_prologue *p
= mep_analyze_frame_prologue (this_frame, this_prologue_cache);
@@ -2057,33 +1947,26 @@ mep_frame_prev_register (frame_info_ptr this_frame,
}
}
+static const struct frame_unwind mep_frame_unwind
+ = { "mep prologue",
+ NORMAL_FRAME,
+ default_frame_unwind_stop_reason,
+ mep_frame_this_id,
+ mep_frame_prev_register,
+ NULL,
+ default_frame_sniffer };
-static const struct frame_unwind mep_frame_unwind = {
- "mep prologue",
- NORMAL_FRAME,
- default_frame_unwind_stop_reason,
- mep_frame_this_id,
- mep_frame_prev_register,
- NULL,
- default_frame_sniffer
-};
-
-
/* Return values. */
-
static int
mep_use_struct_convention (struct type *type)
{
return (type->length () > MEP_GPR_SIZE);
}
-
static void
-mep_extract_return_value (struct gdbarch *arch,
- struct type *type,
- struct regcache *regcache,
- gdb_byte *valbuf)
+mep_extract_return_value (struct gdbarch *arch, struct type *type,
+ struct regcache *regcache, gdb_byte *valbuf)
{
int byte_order = gdbarch_byte_order (arch);
@@ -2102,16 +1985,12 @@ mep_extract_return_value (struct gdbarch *arch,
offset = 0;
/* Return values that do fit in a single register are returned in R0. */
- regcache->cooked_read_part (MEP_R0_REGNUM, offset, type->length (),
- valbuf);
+ regcache->cooked_read_part (MEP_R0_REGNUM, offset, type->length (), valbuf);
}
-
static void
-mep_store_return_value (struct gdbarch *arch,
- struct type *type,
- struct regcache *regcache,
- const gdb_byte *valbuf)
+mep_store_return_value (struct gdbarch *arch, struct type *type,
+ struct regcache *regcache, const gdb_byte *valbuf)
{
int byte_order = gdbarch_byte_order (arch);
@@ -2136,7 +2015,7 @@ mep_store_return_value (struct gdbarch *arch,
memory, pointed to by R0. Unfortunately, we can't count on R0
pointing to the return buffer, so we raise an error here. */
else
- error (_("\
+ error (_ ("\
GDB cannot set return values larger than four bytes; the Media Processor's\n\
calling conventions do not provide enough information to do this.\n\
Try using the 'return' command with no argument."));
@@ -2163,7 +2042,7 @@ mep_return_value (struct gdbarch *gdbarch, struct value *function,
/* Return values larger than a single register are returned in
memory, pointed to by R0. Unfortunately, we can't count on R0
pointing to the return buffer, so we raise an error here. */
- error (_("\
+ error (_ ("\
GDB cannot set return values larger than four bytes; the Media Processor's\n\
calling conventions do not provide enough information to do this.\n\
Try using the 'return' command with no argument."));
@@ -2179,10 +2058,8 @@ Try using the 'return' command with no argument."));
return RETURN_VALUE_REGISTER_CONVENTION;
}
-
/* Inferior calls. */
-
static CORE_ADDR
mep_frame_align (struct gdbarch *gdbarch, CORE_ADDR sp)
{
@@ -2190,7 +2067,6 @@ mep_frame_align (struct gdbarch *gdbarch, CORE_ADDR sp)
return sp & -4;
}
-
/* From "lang_spec2.txt":
4.2 Calling conventions
@@ -2215,7 +2091,6 @@ mep_frame_align (struct gdbarch *gdbarch, CORE_ADDR sp)
passed in the least significant end of a four-byte word when
they're passed on the stack.] */
-
/* Traverse the list of ARGC arguments ARGV; for every ARGV[i] too
large to fit in a register, save it on the stack, and place its
address in COPY[i]. SP is the initial stack pointer; return the
@@ -2243,11 +2118,10 @@ push_large_arguments (CORE_ADDR sp, int argc, struct value **argv,
return sp;
}
-
static CORE_ADDR
mep_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
- struct regcache *regcache, CORE_ADDR bp_addr,
- int argc, struct value **argv, CORE_ADDR sp,
+ struct regcache *regcache, CORE_ADDR bp_addr, int argc,
+ struct value **argv, CORE_ADDR sp,
function_call_return_method return_method,
CORE_ADDR struct_addr)
{
@@ -2264,7 +2138,7 @@ mep_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
/* The address of the end of the stack area for arguments. This is
just for error checking. */
CORE_ADDR arg_stack_end;
-
+
sp = push_large_arguments (sp, argc, argv, copy);
/* Reserve space for the stack arguments, if any. */
@@ -2320,14 +2194,12 @@ mep_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
/* Update the stack pointer. */
regcache_cooked_write_unsigned (regcache, MEP_SP_REGNUM, sp);
-
+
return sp;
}
-
/* Initialization. */
-
static struct gdbarch *
mep_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
{
@@ -2357,7 +2229,7 @@ mep_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
{
/* The negations on either side make the comparison treat all
non-zero (true) values as equal. */
- if (! bfd_big_endian (info.abfd) != ! me_module_big_endian (me_module))
+ if (!bfd_big_endian (info.abfd) != !me_module_big_endian (me_module))
{
const char *module_name = me_module_name (me_module);
const char *module_endianness
@@ -2365,17 +2237,17 @@ mep_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
const char *file_name = bfd_get_filename (info.abfd);
const char *file_endianness
= bfd_big_endian (info.abfd) ? "big" : "little";
-
+
gdb_putc ('\n', gdb_stderr);
if (module_name)
- warning (_("the MeP module '%s' is %s-endian, but the executable\n"
- "%s is %s-endian."),
- module_name, module_endianness,
- file_name, file_endianness);
+ warning (
+ _ ("the MeP module '%s' is %s-endian, but the executable\n"
+ "%s is %s-endian."),
+ module_name, module_endianness, file_name, file_endianness);
else
- warning (_("the selected MeP module is %s-endian, but the "
- "executable\n"
- "%s is %s-endian."),
+ warning (_ ("the selected MeP module is %s-endian, but the "
+ "executable\n"
+ "%s is %s-endian."),
module_endianness, file_name, file_endianness);
}
}
@@ -2384,8 +2256,7 @@ mep_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
already. info->bfd_arch_info needs to match, but we also want
the right me_module: the ELF header's e_flags field needs to
match as well. */
- for (arches = gdbarch_list_lookup_by_info (arches, &info);
- arches != NULL;
+ for (arches = gdbarch_list_lookup_by_info (arches, &info); arches != NULL;
arches = gdbarch_list_lookup_by_info (arches->next, &info))
{
mep_gdbarch_tdep *tdep
@@ -2402,13 +2273,13 @@ mep_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
/* Get a CGEN CPU descriptor for this architecture. */
{
const char *mach_name = info.bfd_arch_info->printable_name;
- enum cgen_endian endian = (info.byte_order == BFD_ENDIAN_BIG
- ? CGEN_ENDIAN_BIG
- : CGEN_ENDIAN_LITTLE);
+ enum cgen_endian endian
+ = (info.byte_order == BFD_ENDIAN_BIG ? CGEN_ENDIAN_BIG
+ : CGEN_ENDIAN_LITTLE);
- tdep->cpu_desc = mep_cgen_cpu_open (CGEN_CPU_OPEN_BFDMACH, mach_name,
- CGEN_CPU_OPEN_ENDIAN, endian,
- CGEN_CPU_OPEN_END);
+ tdep->cpu_desc
+ = mep_cgen_cpu_open (CGEN_CPU_OPEN_BFDMACH, mach_name,
+ CGEN_CPU_OPEN_ENDIAN, endian, CGEN_CPU_OPEN_END);
}
tdep->me_module = me_module;
@@ -2431,7 +2302,7 @@ mep_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
reggroup_add (gdbarch, mep_ccr_reggroup);
/* Disassembly. */
- set_gdbarch_print_insn (gdbarch, mep_gdb_print_insn);
+ set_gdbarch_print_insn (gdbarch, mep_gdb_print_insn);
/* Breakpoints. */
set_gdbarch_breakpoint_kind_from_pc (gdbarch, mep_breakpoint::kind_from_pc);
@@ -2446,7 +2317,7 @@ mep_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
/* Return values. */
set_gdbarch_return_value (gdbarch, mep_return_value);
-
+
/* Inferior function calls. */
set_gdbarch_frame_align (gdbarch, mep_frame_align);
set_gdbarch_push_dummy_call (gdbarch, mep_push_dummy_call);
@@ -2455,11 +2326,12 @@ mep_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
}
void _initialize_mep_tdep ();
+
void
_initialize_mep_tdep ()
{
mep_csr_reggroup = reggroup_new ("csr", USER_REGGROUP);
- mep_cr_reggroup = reggroup_new ("cr", USER_REGGROUP);
+ mep_cr_reggroup = reggroup_new ("cr", USER_REGGROUP);
mep_ccr_reggroup = reggroup_new ("ccr", USER_REGGROUP);
gdbarch_register (bfd_arch_mep, mep_gdbarch_init);
diff --git a/gdb/mi/mi-cmd-break.c b/gdb/mi/mi-cmd-break.c
index 8b0483803b6..6573ff59274 100644
--- a/gdb/mi/mi-cmd-break.c
+++ b/gdb/mi/mi-cmd-break.c
@@ -35,9 +35,9 @@
#include "tracepoint.h"
enum
- {
- FROM_TTY = 0
- };
+{
+ FROM_TTY = 0
+};
/* True if MI breakpoint observers have been registered. */
@@ -66,11 +66,11 @@ breakpoint_notify (struct breakpoint *b)
}
enum bp_type
- {
- REG_BP,
- HW_BP,
- REGEXP_BP
- };
+{
+ REG_BP,
+ HW_BP,
+ REGEXP_BP
+};
/* Arrange for all new breakpoints and catchpoints to be reported to
CURRENT_UIOUT until the destructor of the returned scoped_restore
@@ -82,7 +82,7 @@ enum bp_type
scoped_restore_tmpl<int>
setup_breakpoint_reporting (void)
{
- if (! mi_breakpoint_observers_installed)
+ if (!mi_breakpoint_observers_installed)
{
gdb::observers::breakpoint_created.attach (breakpoint_notify,
"mi-cmd-break");
@@ -92,7 +92,6 @@ setup_breakpoint_reporting (void)
return make_scoped_restore (&mi_can_breakpoint_notify, 1);
}
-
/* Convert arguments in ARGV to the string in "format",argv,argv...
and return it. */
@@ -182,39 +181,44 @@ mi_cmd_break_insert_1 (int dprintf, const char *command, char **argv, int argc)
location_spec_up locspec;
const struct breakpoint_ops *ops;
int is_explicit = 0;
- std::unique_ptr<explicit_location_spec> explicit_loc
- (new explicit_location_spec ());
+ std::unique_ptr<explicit_location_spec> explicit_loc (
+ new explicit_location_spec ());
std::string extra_string;
bool force_condition = false;
enum opt
- {
- HARDWARE_OPT, TEMP_OPT, CONDITION_OPT,
- IGNORE_COUNT_OPT, THREAD_OPT, PENDING_OPT, DISABLE_OPT,
- TRACEPOINT_OPT,
- FORCE_CONDITION_OPT,
- QUALIFIED_OPT,
- EXPLICIT_SOURCE_OPT, EXPLICIT_FUNC_OPT,
- EXPLICIT_LABEL_OPT, EXPLICIT_LINE_OPT
- };
- static const struct mi_opt opts[] =
{
- {"h", HARDWARE_OPT, 0},
- {"t", TEMP_OPT, 0},
- {"c", CONDITION_OPT, 1},
- {"i", IGNORE_COUNT_OPT, 1},
- {"p", THREAD_OPT, 1},
- {"f", PENDING_OPT, 0},
- {"d", DISABLE_OPT, 0},
- {"a", TRACEPOINT_OPT, 0},
- {"-force-condition", FORCE_CONDITION_OPT, 0},
- {"-qualified", QUALIFIED_OPT, 0},
- {"-source" , EXPLICIT_SOURCE_OPT, 1},
- {"-function", EXPLICIT_FUNC_OPT, 1},
- {"-label", EXPLICIT_LABEL_OPT, 1},
- {"-line", EXPLICIT_LINE_OPT, 1},
- { 0, 0, 0 }
+ HARDWARE_OPT,
+ TEMP_OPT,
+ CONDITION_OPT,
+ IGNORE_COUNT_OPT,
+ THREAD_OPT,
+ PENDING_OPT,
+ DISABLE_OPT,
+ TRACEPOINT_OPT,
+ FORCE_CONDITION_OPT,
+ QUALIFIED_OPT,
+ EXPLICIT_SOURCE_OPT,
+ EXPLICIT_FUNC_OPT,
+ EXPLICIT_LABEL_OPT,
+ EXPLICIT_LINE_OPT
};
+ static const struct mi_opt opts[]
+ = { { "h", HARDWARE_OPT, 0 },
+ { "t", TEMP_OPT, 0 },
+ { "c", CONDITION_OPT, 1 },
+ { "i", IGNORE_COUNT_OPT, 1 },
+ { "p", THREAD_OPT, 1 },
+ { "f", PENDING_OPT, 0 },
+ { "d", DISABLE_OPT, 0 },
+ { "a", TRACEPOINT_OPT, 0 },
+ { "-force-condition", FORCE_CONDITION_OPT, 0 },
+ { "-qualified", QUALIFIED_OPT, 0 },
+ { "-source", EXPLICIT_SOURCE_OPT, 1 },
+ { "-function", EXPLICIT_FUNC_OPT, 1 },
+ { "-label", EXPLICIT_LABEL_OPT, 1 },
+ { "-line", EXPLICIT_LINE_OPT, 1 },
+ { 0, 0, 0 } };
/* Parse arguments. It could be -r or -h or -t, <location> or ``--''
to denote the end of the option list. */
@@ -223,8 +227,7 @@ mi_cmd_break_insert_1 (int dprintf, const char *command, char **argv, int argc)
while (1)
{
- int opt = mi_getopt ("-break-insert", argc, argv,
- opts, &oind, &oarg);
+ int opt = mi_getopt ("-break-insert", argc, argv, opts, &oind, &oarg);
if (opt < 0)
break;
switch ((enum opt) opt)
@@ -279,16 +282,16 @@ mi_cmd_break_insert_1 (int dprintf, const char *command, char **argv, int argc)
}
if (oind >= argc && !is_explicit)
- error (_("-%s-insert: Missing <location>"),
+ error (_ ("-%s-insert: Missing <location>"),
dprintf ? "dprintf" : "break");
if (dprintf)
{
int format_num = is_explicit ? oind : oind + 1;
if (hardware || tracepoint)
- error (_("-dprintf-insert: does not support -h or -a"));
+ error (_ ("-dprintf-insert: does not support -h or -a"));
if (format_num >= argc)
- error (_("-dprintf-insert: Missing <format>"));
+ error (_ ("-dprintf-insert: Missing <format>"));
extra_string = mi_argv_to_format (argv + format_num, argc - format_num);
address = argv[oind];
@@ -298,12 +301,12 @@ mi_cmd_break_insert_1 (int dprintf, const char *command, char **argv, int argc)
if (is_explicit)
{
if (oind < argc)
- error (_("-break-insert: Garbage following explicit location"));
+ error (_ ("-break-insert: Garbage following explicit location"));
}
else
{
if (oind < argc - 1)
- error (_("-break-insert: Garbage following <location>"));
+ error (_ ("-break-insert: Garbage following <location>"));
address = argv[oind];
}
}
@@ -342,8 +345,9 @@ mi_cmd_break_insert_1 (int dprintf, const char *command, char **argv, int argc)
&& explicit_loc->function_name == NULL
&& explicit_loc->label_name == NULL
&& explicit_loc->line_offset.sign == LINE_OFFSET_UNKNOWN)
- error (_("-%s-insert: --source option requires --function, --label,"
- " or --line"), dprintf ? "dprintf" : "break");
+ error (_ ("-%s-insert: --source option requires --function, --label,"
+ " or --line"),
+ dprintf ? "dprintf" : "break");
explicit_loc->func_name_match_type = match_type;
@@ -354,17 +358,15 @@ mi_cmd_break_insert_1 (int dprintf, const char *command, char **argv, int argc)
locspec = string_to_location_spec_basic (&address, current_language,
match_type);
if (*address)
- error (_("Garbage '%s' at end of location"), address);
+ error (_ ("Garbage '%s' at end of location"), address);
}
create_breakpoint (get_current_arch (), locspec.get (), condition, thread,
- extra_string.c_str (),
- force_condition,
- 0 /* condition and thread are valid. */,
- temp_p, type_wanted,
- ignore_count,
- pending ? AUTO_BOOLEAN_TRUE : AUTO_BOOLEAN_FALSE,
- ops, 0, enabled, 0, 0);
+ extra_string.c_str (), force_condition,
+ 0 /* condition and thread are valid. */, temp_p,
+ type_wanted, ignore_count,
+ pending ? AUTO_BOOLEAN_TRUE : AUTO_BOOLEAN_FALSE, ops, 0,
+ enabled, 0, 0);
}
/* Implements the -break-insert command.
@@ -392,16 +394,13 @@ void
mi_cmd_break_condition (const char *command, char **argv, int argc)
{
enum option
- {
- FORCE_CONDITION_OPT,
- };
-
- static const struct mi_opt opts[] =
{
- {"-force", FORCE_CONDITION_OPT, 0},
- { 0, 0, 0 }
+ FORCE_CONDITION_OPT,
};
+ static const struct mi_opt opts[]
+ = { { "-force", FORCE_CONDITION_OPT, 0 }, { 0, 0, 0 } };
+
/* Parse arguments. */
int oind = 0;
char *oarg;
@@ -409,8 +408,7 @@ mi_cmd_break_condition (const char *command, char **argv, int argc)
while (true)
{
- int opt = mi_getopt ("-break-condition", argc, argv,
- opts, &oind, &oarg);
+ int opt = mi_getopt ("-break-condition", argc, argv, opts, &oind, &oarg);
if (opt < 0)
break;
@@ -424,7 +422,7 @@ mi_cmd_break_condition (const char *command, char **argv, int argc)
/* There must be at least one more arg: a bpnum. */
if (oind >= argc)
- error (_("-break-condition: Missing the <number> argument"));
+ error (_ ("-break-condition: Missing the <number> argument"));
int bpnum = atoi (argv[oind]);
@@ -456,7 +454,7 @@ mi_cmd_break_passcount (const char *command, char **argv, int argc)
struct tracepoint *t;
if (argc != 2)
- error (_("Usage: tracepoint-number passcount"));
+ error (_ ("Usage: tracepoint-number passcount"));
n = atoi (argv[0]);
p = atoi (argv[1]);
@@ -469,7 +467,7 @@ mi_cmd_break_passcount (const char *command, char **argv, int argc)
}
else
{
- error (_("Could not find tracepoint %d"), n);
+ error (_ ("Could not find tracepoint %d"), n);
}
}
@@ -484,16 +482,14 @@ mi_cmd_break_watch (const char *command, char **argv, int argc)
{
char *expr = NULL;
enum wp_type type = REG_WP;
+
enum opt
- {
- READ_OPT, ACCESS_OPT
- };
- static const struct mi_opt opts[] =
{
- {"r", READ_OPT, 0},
- {"a", ACCESS_OPT, 0},
- { 0, 0, 0 }
+ READ_OPT,
+ ACCESS_OPT
};
+ static const struct mi_opt opts[]
+ = { { "r", READ_OPT, 0 }, { "a", ACCESS_OPT, 0 }, { 0, 0, 0 } };
/* Parse arguments. */
int oind = 0;
@@ -501,8 +497,7 @@ mi_cmd_break_watch (const char *command, char **argv, int argc)
while (1)
{
- int opt = mi_getopt ("-break-watch", argc, argv,
- opts, &oind, &oarg);
+ int opt = mi_getopt ("-break-watch", argc, argv, opts, &oind, &oarg);
if (opt < 0)
break;
@@ -517,9 +512,9 @@ mi_cmd_break_watch (const char *command, char **argv, int argc)
}
}
if (oind >= argc)
- error (_("-break-watch: Missing <expression>"));
+ error (_ ("-break-watch: Missing <expression>"));
if (oind < argc - 1)
- error (_("-break-watch: Garbage following <expression>"));
+ error (_ ("-break-watch: Garbage following <expression>"));
expr = argv[oind];
/* Now we have what we need, let's insert the watchpoint! */
@@ -535,7 +530,7 @@ mi_cmd_break_watch (const char *command, char **argv, int argc)
awatch_command_wrapper (expr, FROM_TTY, false);
break;
default:
- error (_("-break-watch: Unknown watchpoint type."));
+ error (_ ("-break-watch: Unknown watchpoint type."));
}
}
@@ -548,39 +543,33 @@ mi_cmd_break_commands (const char *command, char **argv, int argc)
struct breakpoint *b;
if (argc < 1)
- error (_("USAGE: %s <BKPT> [<COMMAND> [<COMMAND>...]]"), command);
+ error (_ ("USAGE: %s <BKPT> [<COMMAND> [<COMMAND>...]]"), command);
bnum = strtol (argv[0], &endptr, 0);
if (endptr == argv[0])
- error (_("breakpoint number argument \"%s\" is not a number."),
- argv[0]);
+ error (_ ("breakpoint number argument \"%s\" is not a number."), argv[0]);
else if (*endptr != '\0')
- error (_("junk at the end of breakpoint number argument \"%s\"."),
+ error (_ ("junk at the end of breakpoint number argument \"%s\"."),
argv[0]);
b = get_breakpoint (bnum);
if (b == NULL)
- error (_("breakpoint %d not found."), bnum);
+ error (_ ("breakpoint %d not found."), bnum);
int count = 1;
- auto reader
- = [&] (std::string &buffer)
- {
- const char *result = nullptr;
- if (count < argc)
- result = argv[count++];
- return result;
- };
+ auto reader = [&] (std::string &buffer) {
+ const char *result = nullptr;
+ if (count < argc)
+ result = argv[count++];
+ return result;
+ };
if (is_tracepoint (b))
- break_command = read_command_lines_1 (reader, 1,
- [=] (const char *line)
- {
- validate_actionline (line, b);
- });
+ break_command = read_command_lines_1 (reader, 1, [=] (const char *line) {
+ validate_actionline (line, b);
+ });
else
break_command = read_command_lines_1 (reader, 1, 0);
breakpoint_set_commands (b, std::move (break_command));
}
-
diff --git a/gdb/mi/mi-cmd-catch.c b/gdb/mi/mi-cmd-catch.c
index 082703740af..6538898335a 100644
--- a/gdb/mi/mi-cmd-catch.c
+++ b/gdb/mi/mi-cmd-catch.c
@@ -31,7 +31,7 @@
void
mi_cmd_catch_assert (const char *cmd, char *argv[], int argc)
{
- struct gdbarch *gdbarch = get_current_arch();
+ struct gdbarch *gdbarch = get_current_arch ();
std::string condition;
int enabled = 1;
int temp = 0;
@@ -40,21 +40,19 @@ mi_cmd_catch_assert (const char *cmd, char *argv[], int argc)
char *oarg;
enum opt
- {
- OPT_CONDITION, OPT_DISABLED, OPT_TEMP,
- };
- static const struct mi_opt opts[] =
- {
- { "c", OPT_CONDITION, 1},
- { "d", OPT_DISABLED, 0 },
- { "t", OPT_TEMP, 0 },
- { 0, 0, 0 }
- };
+ {
+ OPT_CONDITION,
+ OPT_DISABLED,
+ OPT_TEMP,
+ };
+ static const struct mi_opt opts[] = { { "c", OPT_CONDITION, 1 },
+ { "d", OPT_DISABLED, 0 },
+ { "t", OPT_TEMP, 0 },
+ { 0, 0, 0 } };
for (;;)
{
- int opt = mi_getopt ("-catch-assert", argc, argv, opts,
- &oind, &oarg);
+ int opt = mi_getopt ("-catch-assert", argc, argv, opts, &oind, &oarg);
if (opt < 0)
break;
@@ -76,7 +74,7 @@ mi_cmd_catch_assert (const char *cmd, char *argv[], int argc)
/* This command does not accept any argument. Make sure the user
did not provide any. */
if (oind != argc)
- error (_("Invalid argument: %s"), argv[oind]);
+ error (_ ("Invalid argument: %s"), argv[oind]);
scoped_restore restore_breakpoint_reporting = setup_breakpoint_reporting ();
create_ada_exception_catchpoint (gdbarch, ada_catch_assert, std::string (),
@@ -88,7 +86,7 @@ mi_cmd_catch_assert (const char *cmd, char *argv[], int argc)
void
mi_cmd_catch_exception (const char *cmd, char *argv[], int argc)
{
- struct gdbarch *gdbarch = get_current_arch();
+ struct gdbarch *gdbarch = get_current_arch ();
std::string condition;
int enabled = 1;
std::string exception_name;
@@ -99,24 +97,21 @@ mi_cmd_catch_exception (const char *cmd, char *argv[], int argc)
char *oarg;
enum opt
- {
- OPT_CONDITION, OPT_DISABLED, OPT_EXCEPTION_NAME, OPT_TEMP,
- OPT_UNHANDLED,
- };
- static const struct mi_opt opts[] =
- {
- { "c", OPT_CONDITION, 1},
- { "d", OPT_DISABLED, 0 },
- { "e", OPT_EXCEPTION_NAME, 1 },
- { "t", OPT_TEMP, 0 },
- { "u", OPT_UNHANDLED, 0},
- { 0, 0, 0 }
- };
+ {
+ OPT_CONDITION,
+ OPT_DISABLED,
+ OPT_EXCEPTION_NAME,
+ OPT_TEMP,
+ OPT_UNHANDLED,
+ };
+ static const struct mi_opt opts[]
+ = { { "c", OPT_CONDITION, 1 }, { "d", OPT_DISABLED, 0 },
+ { "e", OPT_EXCEPTION_NAME, 1 }, { "t", OPT_TEMP, 0 },
+ { "u", OPT_UNHANDLED, 0 }, { 0, 0, 0 } };
for (;;)
{
- int opt = mi_getopt ("-catch-exception", argc, argv, opts,
- &oind, &oarg);
+ int opt = mi_getopt ("-catch-exception", argc, argv, opts, &oind, &oarg);
if (opt < 0)
break;
@@ -144,17 +139,16 @@ mi_cmd_catch_exception (const char *cmd, char *argv[], int argc)
/* This command does not accept any argument. Make sure the user
did not provide any. */
if (oind != argc)
- error (_("Invalid argument: %s"), argv[oind]);
+ error (_ ("Invalid argument: %s"), argv[oind]);
/* Specifying an exception name does not make sense when requesting
an unhandled exception breakpoint. */
if (ex_kind == ada_catch_exception_unhandled && !exception_name.empty ())
- error (_("\"-e\" and \"-u\" are mutually exclusive"));
+ error (_ ("\"-e\" and \"-u\" are mutually exclusive"));
scoped_restore restore_breakpoint_reporting = setup_breakpoint_reporting ();
- create_ada_exception_catchpoint (gdbarch, ex_kind,
- exception_name,
- condition, temp, enabled, 0);
+ create_ada_exception_catchpoint (gdbarch, ex_kind, exception_name, condition,
+ temp, enabled, 0);
}
/* Handler for the -catch-handlers command. */
@@ -172,22 +166,21 @@ mi_cmd_catch_handlers (const char *cmd, char *argv[], int argc)
char *oarg;
enum opt
- {
- OPT_CONDITION, OPT_DISABLED, OPT_EXCEPTION_NAME, OPT_TEMP
- };
- static const struct mi_opt opts[] =
- {
- { "c", OPT_CONDITION, 1},
- { "d", OPT_DISABLED, 0 },
- { "e", OPT_EXCEPTION_NAME, 1 },
- { "t", OPT_TEMP, 0 },
- { 0, 0, 0 }
- };
+ {
+ OPT_CONDITION,
+ OPT_DISABLED,
+ OPT_EXCEPTION_NAME,
+ OPT_TEMP
+ };
+ static const struct mi_opt opts[] = { { "c", OPT_CONDITION, 1 },
+ { "d", OPT_DISABLED, 0 },
+ { "e", OPT_EXCEPTION_NAME, 1 },
+ { "t", OPT_TEMP, 0 },
+ { 0, 0, 0 } };
for (;;)
{
- int opt = mi_getopt ("-catch-handlers", argc, argv, opts,
- &oind, &oarg);
+ int opt = mi_getopt ("-catch-handlers", argc, argv, opts, &oind, &oarg);
if (opt < 0)
break;
@@ -212,12 +205,10 @@ mi_cmd_catch_handlers (const char *cmd, char *argv[], int argc)
/* This command does not accept any argument. Make sure the user
did not provide any. */
if (oind != argc)
- error (_("Invalid argument: %s"), argv[oind]);
+ error (_ ("Invalid argument: %s"), argv[oind]);
- scoped_restore restore_breakpoint_reporting
- = setup_breakpoint_reporting ();
- create_ada_exception_catchpoint (gdbarch, ada_catch_handlers,
- exception_name,
+ scoped_restore restore_breakpoint_reporting = setup_breakpoint_reporting ();
+ create_ada_exception_catchpoint (gdbarch, ada_catch_handlers, exception_name,
condition, temp, enabled, 0);
}
@@ -231,22 +222,18 @@ mi_catch_load_unload (int load, char *argv[], int argc)
int enabled = 1;
int oind = 0;
char *oarg;
+
enum opt
- {
- OPT_TEMP,
- OPT_DISABLED,
- };
- static const struct mi_opt opts[] =
- {
- { "t", OPT_TEMP, 0 },
- { "d", OPT_DISABLED, 0 },
- { 0, 0, 0 }
- };
+ {
+ OPT_TEMP,
+ OPT_DISABLED,
+ };
+ static const struct mi_opt opts[]
+ = { { "t", OPT_TEMP, 0 }, { "d", OPT_DISABLED, 0 }, { 0, 0, 0 } };
for (;;)
{
- int opt = mi_getopt (actual_cmd, argc, argv, opts,
- &oind, &oarg);
+ int opt = mi_getopt (actual_cmd, argc, argv, opts, &oind, &oarg);
if (opt < 0)
break;
@@ -263,9 +250,9 @@ mi_catch_load_unload (int load, char *argv[], int argc)
}
if (oind >= argc)
- error (_("-catch-load/unload: Missing <library name>"));
- if (oind < argc -1)
- error (_("-catch-load/unload: Garbage following the <library name>"));
+ error (_ ("-catch-load/unload: Missing <library name>"));
+ if (oind < argc - 1)
+ error (_ ("-catch-load/unload: Garbage following the <library name>"));
scoped_restore restore_breakpoint_reporting = setup_breakpoint_reporting ();
add_solib_catchpoint (argv[oind], load, temp, enabled);
@@ -279,7 +266,6 @@ mi_cmd_catch_load (const char *cmd, char *argv[], int argc)
mi_catch_load_unload (1, argv, argc);
}
-
/* Handler for the -catch-unload. */
void
@@ -293,29 +279,25 @@ mi_cmd_catch_unload (const char *cmd, char *argv[], int argc)
pass KIND through to GDB's core to select the correct event type. */
static void
-mi_cmd_catch_exception_event (enum exception_event_kind kind,
- const char *cmd, char *argv[], int argc)
+mi_cmd_catch_exception_event (enum exception_event_kind kind, const char *cmd,
+ char *argv[], int argc)
{
char *regex = NULL;
bool temp = false;
int oind = 0;
char *oarg;
+
enum opt
- {
- OPT_TEMP,
- OPT_REGEX,
- };
- static const struct mi_opt opts[] =
- {
- { "t", OPT_TEMP, 0 },
- { "r", OPT_REGEX, 1 },
- { 0, 0, 0 }
- };
+ {
+ OPT_TEMP,
+ OPT_REGEX,
+ };
+ static const struct mi_opt opts[]
+ = { { "t", OPT_TEMP, 0 }, { "r", OPT_REGEX, 1 }, { 0, 0, 0 } };
for (;;)
{
- int opt = mi_getopt (cmd, argc, argv, opts,
- &oind, &oarg);
+ int opt = mi_getopt (cmd, argc, argv, opts, &oind, &oarg);
if (opt < 0)
break;
@@ -358,4 +340,3 @@ mi_cmd_catch_catch (const char *cmd, char *argv[], int argc)
{
mi_cmd_catch_exception_event (EX_EVENT_CATCH, cmd, argv, argc);
}
-
diff --git a/gdb/mi/mi-cmd-disas.c b/gdb/mi/mi-cmd-disas.c
index fcda4a08918..bbe0168efb1 100644
--- a/gdb/mi/mi-cmd-disas.c
+++ b/gdb/mi/mi-cmd-disas.c
@@ -82,7 +82,10 @@ mi_cmd_disassemble (const char *command, char **argv, int argc)
/* Flags to handle the --opcodes option. */
enum opcodes_mode
{
- OPCODES_DEFAULT, OPCODES_NONE, OPCODES_DISPLAY, OPCODES_BYTES
+ OPCODES_DEFAULT,
+ OPCODES_NONE,
+ OPCODES_DISPLAY,
+ OPCODES_BYTES
};
enum opcodes_mode opcodes_mode = OPCODES_DEFAULT;
@@ -92,30 +95,34 @@ mi_cmd_disassemble (const char *command, char **argv, int argc)
/* Options processing stuff. */
int oind = 0;
char *oarg;
+
enum opt
{
- FILE_OPT, LINE_OPT, NUM_OPT, START_OPT, END_OPT, ADDR_OPT, OPCODES_OPT,
+ FILE_OPT,
+ LINE_OPT,
+ NUM_OPT,
+ START_OPT,
+ END_OPT,
+ ADDR_OPT,
+ OPCODES_OPT,
SHOW_SRC_OPT
};
- static const struct mi_opt opts[] =
- {
- {"f", FILE_OPT, 1},
- {"l", LINE_OPT, 1},
- {"n", NUM_OPT, 1},
- {"s", START_OPT, 1},
- {"e", END_OPT, 1},
- {"a", ADDR_OPT, 1},
- {"-opcodes", OPCODES_OPT, 1},
- {"-source", SHOW_SRC_OPT, 0},
- { 0, 0, 0 }
- };
+ static const struct mi_opt opts[] = { { "f", FILE_OPT, 1 },
+ { "l", LINE_OPT, 1 },
+ { "n", NUM_OPT, 1 },
+ { "s", START_OPT, 1 },
+ { "e", END_OPT, 1 },
+ { "a", ADDR_OPT, 1 },
+ { "-opcodes", OPCODES_OPT, 1 },
+ { "-source", SHOW_SRC_OPT, 0 },
+ { 0, 0, 0 } };
/* Get the options with their arguments. Keep track of what we
encountered. */
while (1)
{
- int opt = mi_getopt ("-data-disassemble", argc, argv, opts,
- &oind, &oarg);
+ int opt
+ = mi_getopt ("-data-disassemble", argc, argv, opts, &oind, &oarg);
if (opt < 0)
break;
switch ((enum opt) opt)
@@ -153,7 +160,8 @@ mi_cmd_disassemble (const char *command, char **argv, int argc)
else if (strcmp (oarg, "bytes") == 0)
opcodes_mode = OPCODES_BYTES;
else
- error (_("-data-disassemble: unknown value for -opcodes argument"));
+ error (
+ _ ("-data-disassemble: unknown value for -opcodes argument"));
break;
case SHOW_SRC_OPT:
source_seen = true;
@@ -167,36 +175,36 @@ mi_cmd_disassemble (const char *command, char **argv, int argc)
/* Allow only filename + linenum (with how_many which is not
required) OR start_addr + end_addr OR addr. */
- if (!(
- ( line_seen && file_seen && !start_seen && !end_seen
- && !addr_seen)
+ if (!((line_seen && file_seen && !start_seen && !end_seen && !addr_seen)
- || (!line_seen && !file_seen && !num_seen && start_seen && end_seen
- && !addr_seen)
+ || (!line_seen && !file_seen && !num_seen && start_seen && end_seen
+ && !addr_seen)
- || (!line_seen && !file_seen && !num_seen && !start_seen && !end_seen
- && addr_seen))
+ || (!line_seen && !file_seen && !num_seen && !start_seen && !end_seen
+ && addr_seen))
|| argc > 1)
- error (_("-data-disassemble: Usage: "
- "( -f filename -l linenum [-n howmany] |"
- " -s startaddr -e endaddr | -a addr ) "
- "[ --opcodes mode ] [ --source ] [ [--] mode ]."));
+ error (_ ("-data-disassemble: Usage: "
+ "( -f filename -l linenum [-n howmany] |"
+ " -s startaddr -e endaddr | -a addr ) "
+ "[ --opcodes mode ] [ --source ] [ [--] mode ]."));
if (argc == 1)
{
mode = atoi (argv[0]);
if (mode < 0 || mode > 5)
- error (_("-data-disassemble: Mode argument must be in the range 0-5."));
+ error (
+ _ ("-data-disassemble: Mode argument must be in the range 0-5."));
}
else
mode = 0;
if (mode != 0 && (source_seen || opcodes_seen))
- error (_("-data-disassemble: --opcodes and --source can only be used with mode 0"));
+ error (_ ("-data-disassemble: --opcodes and --source can only be used "
+ "with mode 0"));
/* Convert the mode into a set of disassembly flags. */
- disasm_flags = 0; /* Initialize here for -Wall. */
+ disasm_flags = 0; /* Initialize here for -Wall. */
switch (mode)
{
case 0:
@@ -248,21 +256,19 @@ mi_cmd_disassemble (const char *command, char **argv, int argc)
{
s = lookup_symtab (file_string);
if (s == NULL)
- error (_("-data-disassemble: Invalid filename."));
+ error (_ ("-data-disassemble: Invalid filename."));
if (!find_line_pc (s, line_num, &start))
- error (_("-data-disassemble: Invalid line number"));
+ error (_ ("-data-disassemble: Invalid line number"));
if (find_pc_partial_function (start, NULL, &low, &high) == 0)
- error (_("-data-disassemble: "
- "No function contains specified address"));
+ error (_ ("-data-disassemble: "
+ "No function contains specified address"));
}
else if (addr_seen)
{
if (find_pc_partial_function (addr, NULL, &low, &high) == 0)
- error (_("-data-disassemble: "
- "No function contains specified address"));
+ error (_ ("-data-disassemble: "
+ "No function contains specified address"));
}
- gdb_disassembly (gdbarch, uiout,
- disasm_flags,
- how_many, low, high);
+ gdb_disassembly (gdbarch, uiout, disasm_flags, how_many, low, high);
}
diff --git a/gdb/mi/mi-cmd-env.c b/gdb/mi/mi-cmd-env.c
index 454f89503af..d4ad6345c86 100644
--- a/gdb/mi/mi-cmd-env.c
+++ b/gdb/mi/mi-cmd-env.c
@@ -51,7 +51,7 @@ env_execute_cli_command (const char *cmd, const char *args)
run = xstrprintf ("%s %s", cmd, args);
else
run.reset (xstrdup (cmd));
- execute_command ( /*ui */ run.get (), 0 /*from_tty */ );
+ execute_command (/*ui */ run.get (), 0 /*from_tty */);
}
}
@@ -63,11 +63,11 @@ mi_cmd_env_pwd (const char *command, char **argv, int argc)
struct ui_out *uiout = current_uiout;
if (argc > 0)
- error (_("-environment-pwd: No arguments allowed"));
-
+ error (_ ("-environment-pwd: No arguments allowed"));
+
gdb::unique_xmalloc_ptr<char> cwd (getcwd (NULL, 0));
if (cwd == NULL)
- error (_("-environment-pwd: error finding name of working directory: %s"),
+ error (_ ("-environment-pwd: error finding name of working directory: %s"),
safe_strerror (errno));
uiout->field_string ("cwd", cwd.get ());
@@ -79,8 +79,8 @@ void
mi_cmd_env_cd (const char *command, char **argv, int argc)
{
if (argc == 0 || argc > 1)
- error (_("-environment-cd: Usage DIRECTORY"));
-
+ error (_ ("-environment-cd: Usage DIRECTORY"));
+
env_execute_cli_command ("cd", argv[0]);
}
@@ -106,22 +106,19 @@ mi_cmd_env_path (const char *command, char **argv, int argc)
int oind = 0;
int i;
char *oarg;
+
enum opt
- {
- RESET_OPT
- };
- static const struct mi_opt opts[] =
{
- {"r", RESET_OPT, 0},
- { 0, 0, 0 }
+ RESET_OPT
};
+ static const struct mi_opt opts[] = { { "r", RESET_OPT, 0 }, { 0, 0, 0 } };
dont_repeat ();
while (1)
{
- int opt = mi_getopt ("-environment-path", argc, argv, opts,
- &oind, &oarg);
+ int opt
+ = mi_getopt ("-environment-path", argc, argv, opts, &oind, &oarg);
if (opt < 0)
break;
@@ -171,22 +168,19 @@ mi_cmd_env_dir (const char *command, char **argv, int argc)
int oind = 0;
int reset = 0;
char *oarg;
+
enum opt
- {
- RESET_OPT
- };
- static const struct mi_opt opts[] =
{
- {"r", RESET_OPT, 0},
- { 0, 0, 0 }
+ RESET_OPT
};
+ static const struct mi_opt opts[] = { { "r", RESET_OPT, 0 }, { 0, 0, 0 } };
dont_repeat ();
while (1)
{
- int opt = mi_getopt ("-environment-directory", argc, argv, opts,
- &oind, &oarg);
+ int opt
+ = mi_getopt ("-environment-directory", argc, argv, opts, &oind, &oarg);
if (opt < 0)
break;
@@ -229,8 +223,8 @@ mi_cmd_inferior_tty_set (const char *command, char **argv, int argc)
void
mi_cmd_inferior_tty_show (const char *command, char **argv, int argc)
{
- if ( !mi_valid_noargs ("-inferior-tty-show", argc, argv))
- error (_("-inferior-tty-show: Usage: No args"));
+ if (!mi_valid_noargs ("-inferior-tty-show", argc, argv))
+ error (_ ("-inferior-tty-show: Usage: No args"));
const std::string &inferior_tty = current_inferior ()->tty ();
if (!inferior_tty.empty ())
@@ -238,7 +232,8 @@ mi_cmd_inferior_tty_show (const char *command, char **argv, int argc)
}
void _initialize_mi_cmd_env ();
-void
+
+void
_initialize_mi_cmd_env ()
{
const char *env;
diff --git a/gdb/mi/mi-cmd-file.c b/gdb/mi/mi-cmd-file.c
index 70c0a785f8f..3601b0cdedd 100644
--- a/gdb/mi/mi-cmd-file.c
+++ b/gdb/mi/mi-cmd-file.c
@@ -38,9 +38,9 @@ mi_cmd_file_list_exec_source_file (const char *command, char **argv, int argc)
{
struct symtab_and_line st;
struct ui_out *uiout = current_uiout;
-
+
if (!mi_valid_noargs ("-file-list-exec-source-file", argc, argv))
- error (_("-file-list-exec-source-file: Usage: No args"));
+ error (_ ("-file-list-exec-source-file: Usage: No args"));
/* Set the default file and line, also get them. */
set_default_source_symtab_and_line ();
@@ -50,7 +50,7 @@ mi_cmd_file_list_exec_source_file (const char *command, char **argv, int argc)
need to be tested for NULL. The documentation in symtab.h
suggests it will always be correct. */
if (!st.symtab)
- error (_("-file-list-exec-source-file: No symtab"));
+ error (_ ("-file-list-exec-source-file: No symtab"));
/* Print to the user the line, filename and fullname. */
uiout->field_signed ("line", st.line);
@@ -68,18 +68,16 @@ void
mi_cmd_file_list_exec_source_files (const char *command, char **argv, int argc)
{
enum opt
- {
- GROUP_BY_OBJFILE_OPT,
- MATCH_BASENAME_OPT,
- MATCH_DIRNAME_OPT
- };
- static const struct mi_opt opts[] =
{
- {"-group-by-objfile", GROUP_BY_OBJFILE_OPT, 0},
- {"-basename", MATCH_BASENAME_OPT, 0},
- {"-dirname", MATCH_DIRNAME_OPT, 0},
- { 0, 0, 0 }
+ GROUP_BY_OBJFILE_OPT,
+ MATCH_BASENAME_OPT,
+ MATCH_DIRNAME_OPT
};
+ static const struct mi_opt opts[]
+ = { { "-group-by-objfile", GROUP_BY_OBJFILE_OPT, 0 },
+ { "-basename", MATCH_BASENAME_OPT, 0 },
+ { "-dirname", MATCH_DIRNAME_OPT, 0 },
+ { 0, 0, 0 } };
/* Parse arguments. */
int oind = 0;
@@ -91,8 +89,8 @@ mi_cmd_file_list_exec_source_files (const char *command, char **argv, int argc)
while (1)
{
- int opt = mi_getopt ("-file-list-exec-source-files", argc, argv,
- opts, &oind, &oarg);
+ int opt = mi_getopt ("-file-list-exec-source-files", argc, argv, opts,
+ &oind, &oarg);
if (opt < 0)
break;
switch ((enum opt) opt)
@@ -110,7 +108,8 @@ mi_cmd_file_list_exec_source_files (const char *command, char **argv, int argc)
}
if ((argc - oind > 1) || (match_on_basename && match_on_dirname))
- error (_("-file-list-exec-source-files: Usage: [--group-by-objfile] [--basename | --dirname] [--] REGEXP"));
+ error (_ ("-file-list-exec-source-files: Usage: [--group-by-objfile] "
+ "[--basename | --dirname] [--] REGEXP"));
const char *regexp = nullptr;
if (argc - oind == 1)
@@ -145,7 +144,7 @@ mi_cmd_file_list_shared_libraries (const char *command, char **argv, int argc)
pattern = argv[0];
break;
default:
- error (_("Usage: -file-list-shared-libraries [REGEXP]"));
+ error (_ ("Usage: -file-list-shared-libraries [REGEXP]"));
}
if (pattern != NULL)
@@ -153,7 +152,7 @@ mi_cmd_file_list_shared_libraries (const char *command, char **argv, int argc)
const char *re_err = re_comp (pattern);
if (re_err != NULL)
- error (_("Invalid regexp: %s"), re_err);
+ error (_ ("Invalid regexp: %s"), re_err);
}
update_solib_list (1);
diff --git a/gdb/mi/mi-cmd-info.c b/gdb/mi/mi-cmd-info.c
index 2ddf2df8d0b..07f51c0fc68 100644
--- a/gdb/mi/mi-cmd-info.c
+++ b/gdb/mi/mi-cmd-info.c
@@ -40,14 +40,13 @@ mi_cmd_info_ada_exceptions (const char *command, char **argv, int argc)
regexp = argv[0];
break;
default:
- error (_("Usage: -info-ada-exceptions [REGEXP]"));
+ error (_ ("Usage: -info-ada-exceptions [REGEXP]"));
break;
}
std::vector<ada_exc_info> exceptions = ada_exceptions_list (regexp);
- ui_out_emit_table table_emitter (uiout, 2,
- exceptions.size (),
+ ui_out_emit_table table_emitter (uiout, 2, exceptions.size (),
"ada-exceptions");
uiout->table_header (1, ui_left, "name", "Name");
uiout->table_header (1, ui_left, "address", "Address");
@@ -72,7 +71,7 @@ mi_cmd_info_gdb_mi_command (const char *command, char **argv, int argc)
/* This command takes exactly one argument. */
if (argc != 1)
- error (_("Usage: -info-gdb-mi-command MI_COMMAND_NAME"));
+ error (_ ("Usage: -info-gdb-mi-command MI_COMMAND_NAME"));
cmd_name = argv[0];
/* Normally, the command name (aka the "operation" in the GDB/MI
@@ -100,7 +99,7 @@ mi_cmd_info_os (const char *command, char **argv, int argc)
info_osdata (argv[0]);
break;
default:
- error (_("Usage: -info-os [INFOTYPE]"));
+ error (_ ("Usage: -info-os [INFOTYPE]"));
break;
}
}
diff --git a/gdb/mi/mi-cmd-stack.c b/gdb/mi/mi-cmd-stack.c
index 4666808a9c9..a1107a32fc8 100644
--- a/gdb/mi/mi-cmd-stack.c
+++ b/gdb/mi/mi-cmd-stack.c
@@ -39,12 +39,16 @@
#include "inferior.h"
#include "observable.h"
-enum what_to_list { locals, arguments, all };
+enum what_to_list
+{
+ locals,
+ arguments,
+ all
+};
static void list_args_or_locals (const frame_print_options &fp_opts,
enum what_to_list what,
- enum print_values values,
- frame_info_ptr fi,
+ enum print_values values, frame_info_ptr fi,
int skip_unavailable);
/* True if we want to allow Python-based frame filters. */
@@ -54,25 +58,23 @@ void
mi_cmd_enable_frame_filters (const char *command, char **argv, int argc)
{
if (argc != 0)
- error (_("-enable-frame-filters: no arguments allowed"));
+ error (_ ("-enable-frame-filters: no arguments allowed"));
frame_filters = 1;
}
/* Like apply_ext_lang_frame_filter, but take a print_values */
static enum ext_lang_bt_status
-mi_apply_ext_lang_frame_filter (frame_info_ptr frame,
- frame_filter_flags flags,
+mi_apply_ext_lang_frame_filter (frame_info_ptr frame, frame_filter_flags flags,
enum print_values print_values,
- struct ui_out *out,
- int frame_low, int frame_high)
+ struct ui_out *out, int frame_low,
+ int frame_high)
{
/* ext_lang_frame_args's MI options are compatible with MI print
values. */
return apply_ext_lang_frame_filter (frame, flags,
(enum ext_lang_frame_args) print_values,
- out,
- frame_low, frame_high);
+ out, frame_low, frame_high);
}
/* Print a list of the stack frames. Args can be none, in which case
@@ -91,23 +93,21 @@ mi_cmd_stack_list_frames (const char *command, char **argv, int argc)
enum ext_lang_bt_status result = EXT_LANG_BT_ERROR;
int raw_arg = 0;
int oind = 0;
+
enum opt
- {
- NO_FRAME_FILTERS
- };
- static const struct mi_opt opts[] =
- {
- {"-no-frame-filters", NO_FRAME_FILTERS, 0},
- { 0, 0, 0 }
- };
+ {
+ NO_FRAME_FILTERS
+ };
+ static const struct mi_opt opts[]
+ = { { "-no-frame-filters", NO_FRAME_FILTERS, 0 }, { 0, 0, 0 } };
/* Parse arguments. In this instance we are just looking for
--no-frame-filters. */
while (1)
{
char *oarg;
- int opt = mi_getopt ("-stack-list-frames", argc, argv,
- opts, &oind, &oarg);
+ int opt
+ = mi_getopt ("-stack-list-frames", argc, argv, opts, &oind, &oarg);
if (opt < 0)
break;
switch ((enum opt) opt)
@@ -121,7 +121,8 @@ mi_cmd_stack_list_frames (const char *command, char **argv, int argc)
/* After the last option is parsed, there should either be low -
high range, or no further arguments. */
if ((argc - oind != 0) && (argc - oind != 2))
- error (_("-stack-list-frames: Usage: [--no-frame-filters] [FRAME_LOW FRAME_HIGH]"));
+ error (_ ("-stack-list-frames: Usage: [--no-frame-filters] [FRAME_LOW "
+ "FRAME_HIGH]"));
/* If there is a range, set it. */
if (argc - oind == 2)
@@ -140,16 +141,16 @@ mi_cmd_stack_list_frames (const char *command, char **argv, int argc)
/* Let's position fi on the frame at which to start the
display. Could be the innermost frame if the whole stack needs
displaying, or if frame_low is 0. */
- for (i = 0, fi = get_current_frame ();
- fi && i < frame_low;
- i++, fi = get_prev_frame (fi));
+ for (i = 0, fi = get_current_frame (); fi && i < frame_low;
+ i++, fi = get_prev_frame (fi))
+ ;
if (fi == NULL)
- error (_("-stack-list-frames: Not enough frames in stack."));
+ error (_ ("-stack-list-frames: Not enough frames in stack."));
ui_out_emit_list list_emitter (current_uiout, "stack");
- if (! raw_arg && frame_filters)
+ if (!raw_arg && frame_filters)
{
frame_filter_flags flags = PRINT_LEVEL | PRINT_FRAME_INFO;
int py_frame_low = frame_low;
@@ -161,25 +162,24 @@ mi_cmd_stack_list_frames (const char *command, char **argv, int argc)
py_frame_low++;
result = apply_ext_lang_frame_filter (get_current_frame (), flags,
- NO_VALUES, current_uiout,
+ NO_VALUES, current_uiout,
py_frame_low, frame_high);
}
/* Run the inbuilt backtrace if there are no filters registered, or
if "--no-frame-filters" has been specified from the command. */
- if (! frame_filters || raw_arg || result == EXT_LANG_BT_NO_FILTERS)
+ if (!frame_filters || raw_arg || result == EXT_LANG_BT_NO_FILTERS)
{
/* Now let's print the frames up to frame_high, or until there are
frames in the stack. */
- for (;
- fi && (i <= frame_high || frame_high == -1);
+ for (; fi && (i <= frame_high || frame_high == -1);
i++, fi = get_prev_frame (fi))
{
QUIT;
/* Print the location and the address always, even for level 0.
If args is 0, don't print the arguments. */
- print_frame_info (user_frame_print_options,
- fi, 1, LOC_AND_ADDRESS, 0 /* args */, 0);
+ print_frame_info (user_frame_print_options, fi, 1, LOC_AND_ADDRESS,
+ 0 /* args */, 0);
}
}
}
@@ -192,7 +192,7 @@ mi_cmd_stack_info_depth (const char *command, char **argv, int argc)
frame_info_ptr fi;
if (argc > 1)
- error (_("-stack-info-depth: Usage: [MAX_DEPTH]"));
+ error (_ ("-stack-info-depth: Usage: [MAX_DEPTH]"));
if (argc == 1)
frame_high = atoi (argv[0]);
@@ -230,19 +230,17 @@ mi_cmd_stack_list_locals (const char *command, char **argv, int argc)
NO_FRAME_FILTERS,
SKIP_UNAVAILABLE,
};
- static const struct mi_opt opts[] =
- {
- {"-no-frame-filters", NO_FRAME_FILTERS, 0},
- {"-skip-unavailable", SKIP_UNAVAILABLE, 0},
- { 0, 0, 0 }
- };
+ static const struct mi_opt opts[]
+ = { { "-no-frame-filters", NO_FRAME_FILTERS, 0 },
+ { "-skip-unavailable", SKIP_UNAVAILABLE, 0 },
+ { 0, 0, 0 } };
while (1)
{
char *oarg;
/* Don't parse 'print-values' as an option. */
- int opt = mi_getopt ("-stack-list-locals", argc - 1, argv,
- opts, &oind, &oarg);
+ int opt = mi_getopt ("-stack-list-locals", argc - 1, argv, opts,
+ &oind, &oarg);
if (opt < 0)
break;
@@ -261,28 +259,27 @@ mi_cmd_stack_list_locals (const char *command, char **argv, int argc)
/* After the last option is parsed, there should be only
'print-values'. */
if (argc - oind != 1)
- error (_("-stack-list-locals: Usage: [--no-frame-filters] "
- "[--skip-unavailable] PRINT_VALUES"));
+ error (_ ("-stack-list-locals: Usage: [--no-frame-filters] "
+ "[--skip-unavailable] PRINT_VALUES"));
frame = get_selected_frame (NULL);
print_value = mi_parse_print_values (argv[oind]);
- if (! raw_arg && frame_filters)
- {
- frame_filter_flags flags = PRINT_LEVEL | PRINT_LOCALS;
+ if (!raw_arg && frame_filters)
+ {
+ frame_filter_flags flags = PRINT_LEVEL | PRINT_LOCALS;
- result = mi_apply_ext_lang_frame_filter (frame, flags, print_value,
- current_uiout, 0, 0);
- }
+ result = mi_apply_ext_lang_frame_filter (frame, flags, print_value,
+ current_uiout, 0, 0);
+ }
- /* Run the inbuilt backtrace if there are no filters registered, or
+ /* Run the inbuilt backtrace if there are no filters registered, or
if "--no-frame-filters" has been specified from the command. */
- if (! frame_filters || raw_arg || result == EXT_LANG_BT_NO_FILTERS)
- {
- list_args_or_locals (user_frame_print_options,
- locals, print_value, frame,
- skip_unavailable);
- }
+ if (!frame_filters || raw_arg || result == EXT_LANG_BT_NO_FILTERS)
+ {
+ list_args_or_locals (user_frame_print_options, locals, print_value,
+ frame, skip_unavailable);
+ }
}
/* Print a list of the arguments for the current frame. With argument
@@ -302,23 +299,22 @@ mi_cmd_stack_list_args (const char *command, char **argv, int argc)
int oind = 0;
int skip_unavailable = 0;
enum ext_lang_bt_status result = EXT_LANG_BT_ERROR;
+
enum opt
{
NO_FRAME_FILTERS,
SKIP_UNAVAILABLE,
};
- static const struct mi_opt opts[] =
- {
- {"-no-frame-filters", NO_FRAME_FILTERS, 0},
- {"-skip-unavailable", SKIP_UNAVAILABLE, 0},
- { 0, 0, 0 }
- };
+ static const struct mi_opt opts[]
+ = { { "-no-frame-filters", NO_FRAME_FILTERS, 0 },
+ { "-skip-unavailable", SKIP_UNAVAILABLE, 0 },
+ { 0, 0, 0 } };
while (1)
{
char *oarg;
- int opt = mi_getopt_allow_unknown ("-stack-list-args", argc, argv,
- opts, &oind, &oarg);
+ int opt = mi_getopt_allow_unknown ("-stack-list-args", argc, argv, opts,
+ &oind, &oarg);
if (opt < 0)
break;
@@ -334,9 +330,9 @@ mi_cmd_stack_list_args (const char *command, char **argv, int argc)
}
if (argc - oind != 1 && argc - oind != 3)
- error (_("-stack-list-arguments: Usage: " \
- "[--no-frame-filters] [--skip-unavailable] "
- "PRINT_VALUES [FRAME_LOW FRAME_HIGH]"));
+ error (_ ("-stack-list-arguments: Usage: "
+ "[--no-frame-filters] [--skip-unavailable] "
+ "PRINT_VALUES [FRAME_LOW FRAME_HIGH]"));
if (argc - oind == 3)
{
@@ -356,16 +352,16 @@ mi_cmd_stack_list_args (const char *command, char **argv, int argc)
/* Let's position fi on the frame at which to start the
display. Could be the innermost frame if the whole stack needs
displaying, or if frame_low is 0. */
- for (i = 0, fi = get_current_frame ();
- fi && i < frame_low;
- i++, fi = get_prev_frame (fi));
+ for (i = 0, fi = get_current_frame (); fi && i < frame_low;
+ i++, fi = get_prev_frame (fi))
+ ;
if (fi == NULL)
- error (_("-stack-list-arguments: Not enough frames in stack."));
+ error (_ ("-stack-list-arguments: Not enough frames in stack."));
ui_out_emit_list list_emitter (uiout, "stack-args");
- if (! raw_arg && frame_filters)
+ if (!raw_arg && frame_filters)
{
frame_filter_flags flags = PRINT_LEVEL | PRINT_ARGS;
int py_frame_low = frame_low;
@@ -381,21 +377,20 @@ mi_cmd_stack_list_args (const char *command, char **argv, int argc)
py_frame_low, frame_high);
}
- /* Run the inbuilt backtrace if there are no filters registered, or
+ /* Run the inbuilt backtrace if there are no filters registered, or
if "--no-frame-filters" has been specified from the command. */
- if (! frame_filters || raw_arg || result == EXT_LANG_BT_NO_FILTERS)
- {
+ if (!frame_filters || raw_arg || result == EXT_LANG_BT_NO_FILTERS)
+ {
/* Now let's print the frames up to frame_high, or until there are
frames in the stack. */
- for (;
- fi && (i <= frame_high || frame_high == -1);
+ for (; fi && (i <= frame_high || frame_high == -1);
i++, fi = get_prev_frame (fi))
{
QUIT;
ui_out_emit_tuple tuple_emitter (uiout, "frame");
uiout->field_signed ("level", i);
- list_args_or_locals (user_frame_print_options,
- arguments, print_values, fi, skip_unavailable);
+ list_args_or_locals (user_frame_print_options, arguments,
+ print_values, fi, skip_unavailable);
}
}
}
@@ -422,19 +417,17 @@ mi_cmd_stack_list_variables (const char *command, char **argv, int argc)
NO_FRAME_FILTERS,
SKIP_UNAVAILABLE,
};
- static const struct mi_opt opts[] =
- {
- {"-no-frame-filters", NO_FRAME_FILTERS, 0},
- {"-skip-unavailable", SKIP_UNAVAILABLE, 0},
- { 0, 0, 0 }
- };
+ static const struct mi_opt opts[]
+ = { { "-no-frame-filters", NO_FRAME_FILTERS, 0 },
+ { "-skip-unavailable", SKIP_UNAVAILABLE, 0 },
+ { 0, 0, 0 } };
while (1)
{
char *oarg;
/* Don't parse 'print-values' as an option. */
- int opt = mi_getopt ("-stack-list-variables", argc - 1,
- argv, opts, &oind, &oarg);
+ int opt = mi_getopt ("-stack-list-variables", argc - 1, argv, opts,
+ &oind, &oarg);
if (opt < 0)
break;
switch ((enum opt) opt)
@@ -452,29 +445,27 @@ mi_cmd_stack_list_variables (const char *command, char **argv, int argc)
/* After the last option is parsed, there should be only
'print-values'. */
if (argc - oind != 1)
- error (_("-stack-list-variables: Usage: [--no-frame-filters] " \
- "[--skip-unavailable] PRINT_VALUES"));
+ error (_ ("-stack-list-variables: Usage: [--no-frame-filters] "
+ "[--skip-unavailable] PRINT_VALUES"));
- frame = get_selected_frame (NULL);
- print_value = mi_parse_print_values (argv[oind]);
+ frame = get_selected_frame (NULL);
+ print_value = mi_parse_print_values (argv[oind]);
- if (! raw_arg && frame_filters)
- {
- frame_filter_flags flags = PRINT_LEVEL | PRINT_ARGS | PRINT_LOCALS;
+ if (!raw_arg && frame_filters)
+ {
+ frame_filter_flags flags = PRINT_LEVEL | PRINT_ARGS | PRINT_LOCALS;
- result = mi_apply_ext_lang_frame_filter (frame, flags,
- print_value,
- current_uiout, 0, 0);
- }
+ result = mi_apply_ext_lang_frame_filter (frame, flags, print_value,
+ current_uiout, 0, 0);
+ }
- /* Run the inbuilt backtrace if there are no filters registered, or
+ /* Run the inbuilt backtrace if there are no filters registered, or
if "--no-frame-filters" has been specified from the command. */
- if (! frame_filters || raw_arg || result == EXT_LANG_BT_NO_FILTERS)
- {
- list_args_or_locals (user_frame_print_options,
- all, print_value, frame,
- skip_unavailable);
- }
+ if (!frame_filters || raw_arg || result == EXT_LANG_BT_NO_FILTERS)
+ {
+ list_args_or_locals (user_frame_print_options, all, print_value, frame,
+ skip_unavailable);
+ }
}
/* Print single local or argument. ARG must be already read in. For
@@ -535,7 +526,7 @@ list_arg_or_local (const struct frame_arg *arg, enum what_to_list what,
if (arg->val || arg->error)
{
if (arg->error)
- stb.printf (_("<error reading variable: %s>"), arg->error.get ());
+ stb.printf (_ ("<error reading variable: %s>"), arg->error.get ());
else
{
try
@@ -549,8 +540,7 @@ list_arg_or_local (const struct frame_arg *arg, enum what_to_list what,
}
catch (const gdb_exception_error &except)
{
- stb.printf (_("<error reading variable: %s>"),
- except.what ());
+ stb.printf (_ ("<error reading variable: %s>"), except.what ());
}
}
uiout->field_stream ("value", stb);
@@ -602,24 +592,24 @@ list_args_or_locals (const frame_print_options &fp_opts,
switch (sym->aclass ())
{
default:
- case LOC_UNDEF: /* catches errors */
- case LOC_CONST: /* constant */
- case LOC_TYPEDEF: /* local typedef */
- case LOC_LABEL: /* local label */
- case LOC_BLOCK: /* local function */
- case LOC_CONST_BYTES: /* loc. byte seq. */
- case LOC_UNRESOLVED: /* unresolved static */
- case LOC_OPTIMIZED_OUT: /* optimized out */
+ case LOC_UNDEF: /* catches errors */
+ case LOC_CONST: /* constant */
+ case LOC_TYPEDEF: /* local typedef */
+ case LOC_LABEL: /* local label */
+ case LOC_BLOCK: /* local function */
+ case LOC_CONST_BYTES: /* loc. byte seq. */
+ case LOC_UNRESOLVED: /* unresolved static */
+ case LOC_OPTIMIZED_OUT: /* optimized out */
print_me = 0;
break;
- case LOC_ARG: /* argument */
- case LOC_REF_ARG: /* reference arg */
- case LOC_REGPARM_ADDR: /* indirect register arg */
- case LOC_LOCAL: /* stack local */
- case LOC_STATIC: /* static */
- case LOC_REGISTER: /* register */
- case LOC_COMPUTED: /* computed location */
+ case LOC_ARG: /* argument */
+ case LOC_REF_ARG: /* reference arg */
+ case LOC_REGPARM_ADDR: /* indirect register arg */
+ case LOC_LOCAL: /* stack local */
+ case LOC_STATIC: /* static */
+ case LOC_REGISTER: /* register */
+ case LOC_COMPUTED: /* computed location */
if (what == all)
print_me = 1;
else if (what == locals)
@@ -634,8 +624,9 @@ list_args_or_locals (const frame_print_options &fp_opts,
struct frame_arg arg, entryarg;
if (sym->is_argument ())
- sym2 = lookup_symbol_search_name (sym->search_name (),
- block, VAR_DOMAIN).symbol;
+ sym2 = lookup_symbol_search_name (sym->search_name (), block,
+ VAR_DOMAIN)
+ .symbol;
else
sym2 = sym;
gdb_assert (sym2 != NULL);
@@ -726,9 +717,7 @@ parse_frame_specification (const char *frame_exp)
what (s)he gets. Still, give the highest one that matches.
(NOTE: cagney/2004-10-29: Why highest, or outer-most, I don't
know). */
- for (fid = get_current_frame ();
- fid != NULL;
- fid = get_prev_frame (fid))
+ for (fid = get_current_frame (); fid != NULL; fid = get_prev_frame (fid))
{
if (id == get_frame_id (fid))
{
@@ -737,8 +726,7 @@ parse_frame_specification (const char *frame_exp)
while (1)
{
prev_frame = get_prev_frame (fid);
- if (!prev_frame
- || id != get_frame_id (prev_frame))
+ if (!prev_frame || id != get_frame_id (prev_frame))
break;
fid = prev_frame;
}
@@ -757,7 +745,7 @@ void
mi_cmd_stack_select_frame (const char *command, char **argv, int argc)
{
if (argc == 0 || argc > 1)
- error (_("-stack-select-frame: Usage: FRAME_SPEC"));
+ error (_ ("-stack-select-frame: Usage: FRAME_SPEC"));
select_frame (parse_frame_specification (argv[0]));
}
@@ -765,8 +753,8 @@ void
mi_cmd_stack_info_frame (const char *command, char **argv, int argc)
{
if (argc > 0)
- error (_("-stack-info-frame: No arguments allowed"));
+ error (_ ("-stack-info-frame: No arguments allowed"));
- print_frame_info (user_frame_print_options,
- get_selected_frame (NULL), 1, LOC_AND_ADDRESS, 0, 1);
+ print_frame_info (user_frame_print_options, get_selected_frame (NULL), 1,
+ LOC_AND_ADDRESS, 0, 1);
}
diff --git a/gdb/mi/mi-cmd-target.c b/gdb/mi/mi-cmd-target.c
index d0d2ba5c652..b7385d1c14d 100644
--- a/gdb/mi/mi-cmd-target.c
+++ b/gdb/mi/mi-cmd-target.c
@@ -29,15 +29,12 @@ mi_cmd_target_file_get (const char *command, char **argv, int argc)
int oind = 0;
char *oarg;
const char *remote_file, *local_file;
- static const struct mi_opt opts[] =
- {
- { 0, 0, 0 }
- };
+ static const struct mi_opt opts[] = { { 0, 0, 0 } };
static const char prefix[] = "-target-file-get";
if (mi_getopt (prefix, argc, argv, opts, &oind, &oarg) != -1
|| oind != argc - 2)
- error (_("-target-file-get: Usage: REMOTE_FILE LOCAL_FILE"));
+ error (_ ("-target-file-get: Usage: REMOTE_FILE LOCAL_FILE"));
remote_file = argv[oind];
local_file = argv[oind + 1];
@@ -53,15 +50,12 @@ mi_cmd_target_file_put (const char *command, char **argv, int argc)
int oind = 0;
char *oarg;
const char *remote_file, *local_file;
- static const struct mi_opt opts[] =
- {
- { 0, 0, 0 }
- };
+ static const struct mi_opt opts[] = { { 0, 0, 0 } };
static const char prefix[] = "-target-file-put";
if (mi_getopt (prefix, argc, argv, opts, &oind, &oarg) != -1
|| oind != argc - 2)
- error (_("-target-file-put: Usage: LOCAL_FILE REMOTE_FILE"));
+ error (_ ("-target-file-put: Usage: LOCAL_FILE REMOTE_FILE"));
local_file = argv[oind];
remote_file = argv[oind + 1];
@@ -77,18 +71,14 @@ mi_cmd_target_file_delete (const char *command, char **argv, int argc)
int oind = 0;
char *oarg;
const char *remote_file;
- static const struct mi_opt opts[] =
- {
- { 0, 0, 0 }
- };
+ static const struct mi_opt opts[] = { { 0, 0, 0 } };
static const char prefix[] = "-target-file-delete";
if (mi_getopt (prefix, argc, argv, opts, &oind, &oarg) != -1
|| oind != argc - 1)
- error (_("-target-file-delete: Usage: REMOTE_FILE"));
+ error (_ ("-target-file-delete: Usage: REMOTE_FILE"));
remote_file = argv[oind];
remote_file_delete (remote_file, 0);
}
-
diff --git a/gdb/mi/mi-cmd-var.c b/gdb/mi/mi-cmd-var.c
index 1cf6d3cad27..13810489230 100644
--- a/gdb/mi/mi-cmd-var.c
+++ b/gdb/mi/mi-cmd-var.c
@@ -44,7 +44,7 @@ static int mi_print_value_p (struct varobj *var,
if the value should be printed. The PRINT_EXPRESSION parameter
controls if the expression should be printed. */
-static void
+static void
print_varobj (struct varobj *var, enum print_values print_values,
int print_expression)
{
@@ -59,7 +59,7 @@ print_varobj (struct varobj *var, enum print_values print_values,
uiout->field_string ("exp", exp);
}
uiout->field_signed ("numchild", varobj_get_num_children (var));
-
+
if (mi_print_value_p (var, print_values))
{
std::string val = varobj_get_value (var);
@@ -99,7 +99,7 @@ mi_cmd_var_create (const char *command, char **argv, int argc)
enum varobj_type var_type;
if (argc != 3)
- error (_("-var-create: Usage: NAME FRAME EXPRESSION."));
+ error (_ ("-var-create: Usage: NAME FRAME EXPRESSION."));
frame = argv[1];
expr = argv[2];
@@ -112,12 +112,12 @@ mi_cmd_var_create (const char *command, char **argv, int argc)
name = gen_name.c_str ();
}
else if (!isalpha (name[0]))
- error (_("-var-create: name of object must begin with a letter"));
+ error (_ ("-var-create: name of object must begin with a letter"));
if (strcmp (frame, "*") == 0)
var_type = USE_CURRENT_FRAME;
else if (strcmp (frame, "@") == 0)
- var_type = USE_SELECTED_FRAME;
+ var_type = USE_SELECTED_FRAME;
else
{
var_type = USE_SPECIFIED_FRAME;
@@ -126,13 +126,13 @@ mi_cmd_var_create (const char *command, char **argv, int argc)
if (varobjdebug)
gdb_printf (gdb_stdlog,
- "Name=\"%s\", Frame=\"%s\" (%s), Expression=\"%s\"\n",
- name, frame, hex_string (frameaddr), expr);
+ "Name=\"%s\", Frame=\"%s\" (%s), Expression=\"%s\"\n", name,
+ frame, hex_string (frameaddr), expr);
var = varobj_create (name, expr, frameaddr, var_type);
if (var == NULL)
- error (_("-var-create: unable to create variable object"));
+ error (_ ("-var-create: unable to create variable object"));
print_varobj (var, PRINT_ALL_VALUES, 0 /* don't print expression */);
@@ -149,7 +149,7 @@ mi_cmd_var_delete (const char *command, char **argv, int argc)
struct ui_out *uiout = current_uiout;
if (argc < 1 || argc > 2)
- error (_("-var-delete: Usage: [-c] EXPRESSION."));
+ error (_ ("-var-delete: Usage: [-c] EXPRESSION."));
name = argv[0];
@@ -158,10 +158,10 @@ mi_cmd_var_delete (const char *command, char **argv, int argc)
if (argc == 1)
{
if (strcmp (name, "-c") == 0)
- error (_("-var-delete: Missing required "
- "argument after '-c': variable object name"));
+ error (_ ("-var-delete: Missing required "
+ "argument after '-c': variable object name"));
if (*name == '-')
- error (_("-var-delete: Illegal variable object name"));
+ error (_ ("-var-delete: Illegal variable object name"));
}
/* If we have 2 arguments they must be '-c' followed by a string
@@ -169,7 +169,7 @@ mi_cmd_var_delete (const char *command, char **argv, int argc)
if (argc == 2)
{
if (strcmp (name, "-c") != 0)
- error (_("-var-delete: Invalid option."));
+ error (_ ("-var-delete: Invalid option."));
children_only_p = 1;
name = argv[1];
}
@@ -209,8 +209,9 @@ mi_parse_format (const char *arg)
return FORMAT_ZHEXADECIMAL;
}
- error (_("Must specify the format as: \"natural\", "
- "\"binary\", \"decimal\", \"hexadecimal\", \"octal\" or \"zero-hexadecimal\""));
+ error (_ ("Must specify the format as: \"natural\", "
+ "\"binary\", \"decimal\", \"hexadecimal\", \"octal\" or "
+ "\"zero-hexadecimal\""));
}
void
@@ -221,19 +222,19 @@ mi_cmd_var_set_format (const char *command, char **argv, int argc)
struct ui_out *uiout = current_uiout;
if (argc != 2)
- error (_("-var-set-format: Usage: NAME FORMAT."));
+ error (_ ("-var-set-format: Usage: NAME FORMAT."));
/* Get varobj handle, if a valid var obj name was specified. */
var = varobj_get_handle (argv[0]);
format = mi_parse_format (argv[1]);
-
+
/* Set the format of VAR to the given format. */
varobj_set_display_format (var, format);
/* Report the new current format. */
uiout->field_string ("format", varobj_format_string[(int) format]);
-
+
/* Report the value in the new format. */
std::string val = varobj_get_value (var);
uiout->field_string ("value", val);
@@ -245,12 +246,12 @@ mi_cmd_var_set_visualizer (const char *command, char **argv, int argc)
struct varobj *var;
if (argc != 2)
- error (_("Usage: NAME VISUALIZER_FUNCTION."));
+ error (_ ("Usage: NAME VISUALIZER_FUNCTION."));
var = varobj_get_handle (argv[0]);
if (var == NULL)
- error (_("Variable object not found"));
+ error (_ ("Variable object not found"));
varobj_set_visualizer (var, argv[1]);
}
@@ -262,7 +263,7 @@ mi_cmd_var_set_frozen (const char *command, char **argv, int argc)
bool frozen;
if (argc != 2)
- error (_("-var-set-format: Usage: NAME FROZEN_FLAG."));
+ error (_ ("-var-set-format: Usage: NAME FROZEN_FLAG."));
var = varobj_get_handle (argv[0]);
@@ -271,7 +272,7 @@ mi_cmd_var_set_frozen (const char *command, char **argv, int argc)
else if (strcmp (argv[1], "1") == 0)
frozen = true;
else
- error (_("Invalid flag value"));
+ error (_ ("Invalid flag value"));
varobj_set_frozen (var, frozen);
@@ -288,7 +289,7 @@ mi_cmd_var_show_format (const char *command, char **argv, int argc)
struct varobj *var;
if (argc != 1)
- error (_("-var-show-format: Usage: NAME."));
+ error (_ ("-var-show-format: Usage: NAME."));
/* Get varobj handle, if a valid var obj name was specified. */
var = varobj_get_handle (argv[0]);
@@ -306,7 +307,7 @@ mi_cmd_var_info_num_children (const char *command, char **argv, int argc)
struct varobj *var;
if (argc != 1)
- error (_("-var-info-num-children: Usage: NAME."));
+ error (_ ("-var-info-num-children: Usage: NAME."));
/* Get varobj handle, if a valid var obj name was specified. */
var = varobj_get_handle (argv[0]);
@@ -350,13 +351,13 @@ void
mi_cmd_var_list_children (const char *command, char **argv, int argc)
{
struct ui_out *uiout = current_uiout;
- struct varobj *var;
+ struct varobj *var;
enum print_values print_values;
int from, to;
if (argc < 1 || argc > 4)
- error (_("-var-list-children: Usage: "
- "[PRINT_VALUES] NAME [FROM TO]"));
+ error (_ ("-var-list-children: Usage: "
+ "[PRINT_VALUES] NAME [FROM TO]"));
/* Get varobj handle, if a valid var obj name was specified. */
if (argc == 1 || argc == 3)
@@ -409,7 +410,7 @@ mi_cmd_var_info_type (const char *command, char **argv, int argc)
struct varobj *var;
if (argc != 1)
- error (_("-var-info-type: Usage: NAME."));
+ error (_ ("-var-info-type: Usage: NAME."));
/* Get varobj handle, if a valid var obj name was specified. */
var = varobj_get_handle (argv[0]);
@@ -425,11 +426,11 @@ mi_cmd_var_info_path_expression (const char *command, char **argv, int argc)
struct varobj *var;
if (argc != 1)
- error (_("Usage: NAME."));
+ error (_ ("Usage: NAME."));
/* Get varobj handle, if a valid var obj name was specified. */
var = varobj_get_handle (argv[0]);
-
+
const char *path_expr = varobj_get_path_expr (var);
uiout->field_string ("path_expr", path_expr);
@@ -443,7 +444,7 @@ mi_cmd_var_info_expression (const char *command, char **argv, int argc)
struct varobj *var;
if (argc != 1)
- error (_("-var-info-expression: Usage: NAME."));
+ error (_ ("-var-info-expression: Usage: NAME."));
/* Get varobj handle, if a valid var obj name was specified. */
var = varobj_get_handle (argv[0]);
@@ -465,7 +466,7 @@ mi_cmd_var_show_attributes (const char *command, char **argv, int argc)
struct varobj *var;
if (argc != 1)
- error (_("-var-show-attributes: Usage: NAME."));
+ error (_ ("-var-show-attributes: Usage: NAME."));
/* Get varobj handle, if a valid var obj name was specified */
var = varobj_get_handle (argv[0]);
@@ -490,16 +491,12 @@ mi_cmd_var_evaluate_expression (const char *command, char **argv, int argc)
int formatFound;
int oind;
char *oarg;
-
+
enum opt
{
OP_FORMAT
};
- static const struct mi_opt opts[] =
- {
- {"f", OP_FORMAT, 1},
- { 0, 0, 0 }
- };
+ static const struct mi_opt opts[] = { { "f", OP_FORMAT, 1 }, { 0, 0, 0 } };
/* Parse arguments. */
format = FORMAT_NATURAL;
@@ -507,8 +504,8 @@ mi_cmd_var_evaluate_expression (const char *command, char **argv, int argc)
oind = 0;
while (1)
{
- int opt = mi_getopt ("-var-evaluate-expression", argc, argv,
- opts, &oind, &oarg);
+ int opt = mi_getopt ("-var-evaluate-expression", argc, argv, opts, &oind,
+ &oarg);
if (opt < 0)
break;
@@ -516,8 +513,8 @@ mi_cmd_var_evaluate_expression (const char *command, char **argv, int argc)
{
case OP_FORMAT:
if (formatFound)
- error (_("Cannot specify format more than once"));
-
+ error (_ ("Cannot specify format more than once"));
+
format = mi_parse_format (oarg);
formatFound = 1;
break;
@@ -525,14 +522,14 @@ mi_cmd_var_evaluate_expression (const char *command, char **argv, int argc)
}
if (oind >= argc)
- error (_("Usage: [-f FORMAT] NAME"));
-
+ error (_ ("Usage: [-f FORMAT] NAME"));
+
if (oind < argc - 1)
- error (_("Garbage at end of command"));
-
+ error (_ ("Garbage at end of command"));
+
/* Get varobj handle, if a valid var obj name was specified. */
var = varobj_get_handle (argv[oind]);
-
+
if (formatFound)
{
std::string val = varobj_get_formatted_value (var, format);
@@ -554,13 +551,13 @@ mi_cmd_var_assign (const char *command, char **argv, int argc)
struct varobj *var;
if (argc != 2)
- error (_("-var-assign: Usage: NAME EXPRESSION."));
+ error (_ ("-var-assign: Usage: NAME EXPRESSION."));
/* Get varobj handle, if a valid var obj name was specified. */
var = varobj_get_handle (argv[0]);
if (!varobj_editable_p (var))
- error (_("-var-assign: Variable object is not editable"));
+ error (_ ("-var-assign: Variable object is not editable"));
const char *expression = argv[1];
@@ -570,8 +567,8 @@ mi_cmd_var_assign (const char *command, char **argv, int argc)
= make_scoped_restore (&mi_suppress_notification.memory, 1);
if (!varobj_set_value (var, expression))
- error (_("-var-assign: Could not assign "
- "expression to variable object"));
+ error (_ ("-var-assign: Could not assign "
+ "expression to variable object"));
std::string val = varobj_get_value (var);
uiout->field_string ("value", val);
@@ -596,12 +593,10 @@ mi_cmd_var_update_iter (struct varobj *var, bool only_floating,
{
thread_info *tp = find_thread_global_id (thread_id);
- thread_stopped = (tp == NULL
- || tp->state == THREAD_STOPPED);
+ thread_stopped = (tp == NULL || tp->state == THREAD_STOPPED);
}
- if (thread_stopped
- && (!only_floating || varobj_floating_p (var)))
+ if (thread_stopped && (!only_floating || varobj_floating_p (var)))
varobj_update_one (var, print_values, false /* implicit */);
}
@@ -613,7 +608,7 @@ mi_cmd_var_update (const char *command, char **argv, int argc)
enum print_values print_values;
if (argc != 1 && argc != 2)
- error (_("-var-update: Usage: [PRINT_VALUES] NAME."));
+ error (_ ("-var-update: Usage: [PRINT_VALUES] NAME."));
if (argc == 1)
name = argv[0];
@@ -636,10 +631,9 @@ mi_cmd_var_update (const char *command, char **argv, int argc)
VAROBJ. Therefore update each VAROBJ only once by iterating
only the root VAROBJs. */
- all_root_varobjs ([=] (varobj *var)
- {
- mi_cmd_var_update_iter (var, *name == '0', print_values);
- });
+ all_root_varobjs ([=] (varobj *var) {
+ mi_cmd_var_update_iter (var, *name == '0', print_values);
+ });
}
else
{
@@ -658,8 +652,9 @@ varobj_update_one (struct varobj *var, enum print_values print_values,
{
struct ui_out *uiout = current_uiout;
- std::vector<varobj_update_result> changes = varobj_update (&var, is_explicit);
-
+ std::vector<varobj_update_result> changes
+ = varobj_update (&var, is_explicit);
+
for (const varobj_update_result &r : changes)
{
int from, to;
@@ -733,7 +728,7 @@ void
mi_cmd_enable_pretty_printing (const char *command, char **argv, int argc)
{
if (argc != 0)
- error (_("-enable-pretty-printing: no arguments allowed"));
+ error (_ ("-enable-pretty-printing: no arguments allowed"));
varobj_enable_pretty_printing ();
}
@@ -745,8 +740,8 @@ mi_cmd_var_set_update_range (const char *command, char **argv, int argc)
int from, to;
if (argc != 3)
- error (_("-var-set-update-range: Usage: VAROBJ FROM TO"));
-
+ error (_ ("-var-set-update-range: Usage: VAROBJ FROM TO"));
+
var = varobj_get_handle (argv[0]);
from = atoi (argv[1]);
to = atoi (argv[2]);
diff --git a/gdb/mi/mi-cmds.c b/gdb/mi/mi-cmds.c
index aa0f38a6900..64dbd755073 100644
--- a/gdb/mi/mi-cmds.c
+++ b/gdb/mi/mi-cmds.c
@@ -38,7 +38,7 @@ struct mi_command_mi : public mi_command
constructor, FUNC is the function called from do_invoke, which
implements this MI command. */
mi_command_mi (const char *name, mi_cmd_argv_ftype func,
- int *suppress_notification)
+ int *suppress_notification)
: mi_command (name, suppress_notification),
m_argv_function (func)
{
@@ -52,7 +52,7 @@ struct mi_command_mi : public mi_command
mi_parse_argv (parse->args, parse);
if (parse->argv == nullptr)
- error (_("Problem parsing arguments: %s %s"), parse->command,
+ error (_ ("Problem parsing arguments: %s %s"), parse->command,
parse->args);
this->m_argv_function (parse->command, parse->argv, parse->argc);
@@ -75,11 +75,12 @@ struct mi_command_cli : public mi_command
forwarded to CLI_NAME as its argument string, otherwise, if ARGS_P is
false, nullptr is send to CLI_NAME as its argument string. */
mi_command_cli (const char *name, const char *cli_name, bool args_p,
- int *suppress_notification)
+ int *suppress_notification)
: mi_command (name, suppress_notification),
m_cli_name (cli_name),
m_args_p (args_p)
- { /* Nothing. */ }
+ { /* Nothing. */
+ }
/* Called when this MI command has been invoked, calls the m_cli_name
CLI function. In m_args_p is true then the argument string from
@@ -133,7 +134,7 @@ remove_mi_cmd_entry (const std::string &name)
void
remove_mi_cmd_entries (remove_mi_cmd_entries_ftype callback)
{
- for (auto it = mi_cmd_table.cbegin (); it != mi_cmd_table.cend (); )
+ for (auto it = mi_cmd_table.cbegin (); it != mi_cmd_table.cend ();)
{
if (callback (it->second.get ()))
it = mi_cmd_table.erase (it);
@@ -201,8 +202,8 @@ add_builtin_mi_commands ()
add_mi_cmd_mi ("add-inferior", mi_cmd_add_inferior);
add_mi_cmd_cli ("break-after", "ignore", 1,
&mi_suppress_notification.breakpoint);
- add_mi_cmd_mi ("break-condition",mi_cmd_break_condition,
- &mi_suppress_notification.breakpoint);
+ add_mi_cmd_mi ("break-condition", mi_cmd_break_condition,
+ &mi_suppress_notification.breakpoint);
add_mi_cmd_mi ("break-commands", mi_cmd_break_commands,
&mi_suppress_notification.breakpoint);
add_mi_cmd_cli ("break-delete", "delete breakpoint", 1,
@@ -232,12 +233,12 @@ add_builtin_mi_commands ()
add_mi_cmd_mi ("catch-unload", mi_cmd_catch_unload,
&mi_suppress_notification.breakpoint);
add_mi_cmd_mi ("catch-throw", mi_cmd_catch_throw,
- &mi_suppress_notification.breakpoint),
- add_mi_cmd_mi ("catch-rethrow", mi_cmd_catch_rethrow,
- &mi_suppress_notification.breakpoint),
- add_mi_cmd_mi ("catch-catch", mi_cmd_catch_catch,
- &mi_suppress_notification.breakpoint),
- add_mi_cmd_mi ("complete", mi_cmd_complete);
+ &mi_suppress_notification.breakpoint),
+ add_mi_cmd_mi ("catch-rethrow", mi_cmd_catch_rethrow,
+ &mi_suppress_notification.breakpoint),
+ add_mi_cmd_mi ("catch-catch", mi_cmd_catch_catch,
+ &mi_suppress_notification.breakpoint),
+ add_mi_cmd_mi ("complete", mi_cmd_complete);
add_mi_cmd_mi ("data-disassemble", mi_cmd_disassemble);
add_mi_cmd_mi ("data-evaluate-expression", mi_cmd_data_evaluate_expression);
add_mi_cmd_mi ("data-list-changed-registers",
@@ -280,13 +281,13 @@ add_builtin_mi_commands ()
add_mi_cmd_mi ("file-list-exec-source-files",
mi_cmd_file_list_exec_source_files);
add_mi_cmd_mi ("file-list-shared-libraries",
- mi_cmd_file_list_shared_libraries),
- add_mi_cmd_cli ("file-symbol-file", "symbol-file", 1);
+ mi_cmd_file_list_shared_libraries),
+ add_mi_cmd_cli ("file-symbol-file", "symbol-file", 1);
add_mi_cmd_mi ("fix-breakpoint-script-output",
mi_cmd_fix_breakpoint_script_output),
- add_mi_cmd_mi ("fix-multi-location-breakpoint-output",
- mi_cmd_fix_multi_location_breakpoint_output),
- add_mi_cmd_mi ("gdb-exit", mi_cmd_gdb_exit);
+ add_mi_cmd_mi ("fix-multi-location-breakpoint-output",
+ mi_cmd_fix_multi_location_breakpoint_output),
+ add_mi_cmd_mi ("gdb-exit", mi_cmd_gdb_exit);
add_mi_cmd_cli ("gdb-set", "set", 1,
&mi_suppress_notification.cmd_param_changed);
add_mi_cmd_cli ("gdb-show", "show", 1);
@@ -315,9 +316,9 @@ add_builtin_mi_commands ()
add_mi_cmd_mi ("symbol-info-types", mi_cmd_symbol_info_types);
add_mi_cmd_mi ("symbol-info-modules", mi_cmd_symbol_info_modules);
add_mi_cmd_mi ("symbol-info-module-functions",
- mi_cmd_symbol_info_module_functions);
+ mi_cmd_symbol_info_module_functions);
add_mi_cmd_mi ("symbol-info-module-variables",
- mi_cmd_symbol_info_module_variables);
+ mi_cmd_symbol_info_module_variables);
add_mi_cmd_cli ("target-attach", "attach", 1);
add_mi_cmd_mi ("target-detach", mi_cmd_target_detach);
add_mi_cmd_cli ("target-disconnect", "disconnect", 0);
@@ -372,6 +373,7 @@ mi_cmd_lookup (const char *command)
}
void _initialize_mi_cmds ();
+
void
_initialize_mi_cmds ()
{
diff --git a/gdb/mi/mi-cmds.h b/gdb/mi/mi-cmds.h
index 490f50484d9..f55c0c09f9f 100644
--- a/gdb/mi/mi-cmds.h
+++ b/gdb/mi/mi-cmds.h
@@ -26,10 +26,11 @@
#include "gdbsupport/gdb_optional.h"
#include "mi/mi-main.h"
-enum print_values {
- PRINT_NO_VALUES,
- PRINT_ALL_VALUES,
- PRINT_SIMPLE_VALUES
+enum print_values
+{
+ PRINT_NO_VALUES,
+ PRINT_ALL_VALUES,
+ PRINT_SIMPLE_VALUES
};
typedef void (mi_cmd_argv_ftype) (const char *command, char **argv, int argc);
@@ -158,8 +159,7 @@ struct mi_command
/* Return the name of this command. This is the command that the user
will actually type in, without any arguments, and without the leading
dash. */
- const char *name () const
- { return m_name; }
+ const char *name () const { return m_name; }
/* Execute the MI command. this needs to be overridden in each
base class. PARSE is the parsed command line from the user.
@@ -174,7 +174,8 @@ struct mi_command
user context, then it should not emit change notifications. Therefore if
command does not suppress user context change notifications, then it should
preserve the context. */
- return m_suppress_notification != &mi_suppress_notification.user_selected_context;
+ return m_suppress_notification
+ != &mi_suppress_notification.user_selected_context;
}
/* If this command was created with a suppress notifications pointer,
@@ -222,8 +223,7 @@ extern bool remove_mi_cmd_entry (const std::string &name);
/* Call CALLBACK for each registered MI command. Remove commands for which
CALLBACK returns true. */
-using remove_mi_cmd_entries_ftype
- = gdb::function_view<bool (mi_command *)>;
+using remove_mi_cmd_entries_ftype = gdb::function_view<bool (mi_command *)>;
extern void remove_mi_cmd_entries (remove_mi_cmd_entries_ftype callback);
#endif /* MI_MI_CMDS_H */
diff --git a/gdb/mi/mi-common.c b/gdb/mi/mi-common.c
index ce70d11a912..1cf273c8d22 100644
--- a/gdb/mi/mi-common.c
+++ b/gdb/mi/mi-common.c
@@ -19,29 +19,27 @@
#include "defs.h"
#include "mi-common.h"
-static const char * const async_reason_string_lookup[] =
-{
- "breakpoint-hit",
- "watchpoint-trigger",
- "read-watchpoint-trigger",
- "access-watchpoint-trigger",
- "function-finished",
- "location-reached",
- "watchpoint-scope",
- "end-stepping-range",
- "exited-signalled",
- "exited",
- "exited-normally",
- "signal-received",
- "solib-event",
- "fork",
- "vfork",
- "syscall-entry",
- "syscall-return",
- "exec",
- "no-history",
- NULL
-};
+static const char *const async_reason_string_lookup[]
+ = { "breakpoint-hit",
+ "watchpoint-trigger",
+ "read-watchpoint-trigger",
+ "access-watchpoint-trigger",
+ "function-finished",
+ "location-reached",
+ "watchpoint-scope",
+ "end-stepping-range",
+ "exited-signalled",
+ "exited",
+ "exited-normally",
+ "signal-received",
+ "solib-event",
+ "fork",
+ "vfork",
+ "syscall-entry",
+ "syscall-return",
+ "exec",
+ "no-history",
+ NULL };
gdb_static_assert (ARRAY_SIZE (async_reason_string_lookup)
== EXEC_ASYNC_LAST + 1);
diff --git a/gdb/mi/mi-console.c b/gdb/mi/mi-console.c
index e0b5648c2df..8c9adeadacc 100644
--- a/gdb/mi/mi-console.c
+++ b/gdb/mi/mi-console.c
@@ -34,7 +34,8 @@ mi_console_file::mi_console_file (ui_file *raw, const char *prefix, char quote)
: m_raw (raw),
m_prefix (prefix),
m_quote (quote)
-{}
+{
+}
void
mi_console_file::write (const char *buf, long length_buf)
diff --git a/gdb/mi/mi-console.h b/gdb/mi/mi-console.h
index 522053e7d1d..164b18f9aeb 100644
--- a/gdb/mi/mi-console.h
+++ b/gdb/mi/mi-console.h
@@ -26,6 +26,7 @@
class mi_console_file : public ui_file
{
public:
+
/* Create a console that wraps the given output stream RAW with the
string PREFIX and quoting it with QUOTE. */
mi_console_file (ui_file *raw, const char *prefix, char quote);
@@ -42,6 +43,7 @@ public:
void write_async_safe (const char *buf, long length_buf) override;
private:
+
/* The wrapped raw output stream. */
ui_file *m_raw;
diff --git a/gdb/mi/mi-getopt.c b/gdb/mi/mi-getopt.c
index 2fc26485650..a9496a51b2b 100644
--- a/gdb/mi/mi-getopt.c
+++ b/gdb/mi/mi-getopt.c
@@ -19,6 +19,7 @@
#include "defs.h"
#include "mi-getopt.h"
+
/* See comments about mi_getopt and mi_getopt_silent in mi-getopt.h.
When there is an unknown option, if ERROR_ON_UNKNOWN is true,
throw an error, otherwise return -1. */
@@ -33,7 +34,7 @@ mi_getopt_1 (const char *prefix, int argc, char **argv,
/* We assume that argv/argc are ok. */
if (*oind > argc || *oind < 0)
- internal_error (_("mi_getopt_long: oind out of bounds"));
+ internal_error (_ ("mi_getopt_long: oind out of bounds"));
if (*oind == argc)
return -1;
arg = argv[*oind];
@@ -59,7 +60,7 @@ mi_getopt_1 (const char *prefix, int argc, char **argv,
{
/* A non-simple oarg option. */
if (argc < *oind + 2)
- error (_("%s: Option %s requires an argument"), prefix, arg);
+ error (_ ("%s: Option %s requires an argument"), prefix, arg);
*oarg = argv[(*oind) + 1];
*oind = (*oind) + 2;
return opt->index;
@@ -73,16 +74,14 @@ mi_getopt_1 (const char *prefix, int argc, char **argv,
}
if (error_on_unknown)
- error (_("%s: Unknown option ``%s''"), prefix, arg + 1);
+ error (_ ("%s: Unknown option ``%s''"), prefix, arg + 1);
else
return -1;
}
int
-mi_getopt (const char *prefix,
- int argc, char **argv,
- const struct mi_opt *opts,
- int *oind, char **oarg)
+mi_getopt (const char *prefix, int argc, char **argv,
+ const struct mi_opt *opts, int *oind, char **oarg)
{
return mi_getopt_1 (prefix, argc, argv, opts, oind, oarg, 1);
}
@@ -94,15 +93,12 @@ mi_getopt_allow_unknown (const char *prefix, int argc, char **argv,
return mi_getopt_1 (prefix, argc, argv, opts, oind, oarg, 0);
}
-int
-mi_valid_noargs (const char *prefix, int argc, char **argv)
+int
+mi_valid_noargs (const char *prefix, int argc, char **argv)
{
int oind = 0;
char *oarg;
- static const struct mi_opt opts[] =
- {
- { 0, 0, 0 }
- };
+ static const struct mi_opt opts[] = { { 0, 0, 0 } };
if (mi_getopt (prefix, argc, argv, opts, &oind, &oarg) == -1)
return 1;
diff --git a/gdb/mi/mi-getopt.h b/gdb/mi/mi-getopt.h
index e418ae99da2..63ee0bd133a 100644
--- a/gdb/mi/mi-getopt.h
+++ b/gdb/mi/mi-getopt.h
@@ -24,11 +24,11 @@
requires an argument. INDEX is returned to identify the option. */
struct mi_opt
- {
- const char *name;
- int index;
- int arg_p;
- };
+{
+ const char *name;
+ int index;
+ int arg_p;
+};
/* Like getopt() but with simpler semantics.
@@ -52,9 +52,9 @@ struct mi_opt
extern int mi_getopt (const char *prefix, int argc, char **argv,
const struct mi_opt *opt, int *optind, char **optarg);
-extern int mi_getopt_allow_unknown (const char *prefix, int argc,
- char **argv, const struct mi_opt *opts,
- int *oind, char **oarg);
+extern int mi_getopt_allow_unknown (const char *prefix, int argc, char **argv,
+ const struct mi_opt *opts, int *oind,
+ char **oarg);
/* mi_valid_noargs determines if ARGC/ARGV are a valid set of
parameters to satisfy an MI function that is not supposed to
diff --git a/gdb/mi/mi-interp.c b/gdb/mi/mi-interp.c
index 29d1aee8235..0076ea88c69 100644
--- a/gdb/mi/mi-interp.c
+++ b/gdb/mi/mi-interp.c
@@ -47,8 +47,8 @@
interpreter. */
static void mi_execute_command_wrapper (const char *cmd);
-static void mi_execute_command_input_handler
- (gdb::unique_xmalloc_ptr<char> &&cmd);
+static void
+mi_execute_command_input_handler (gdb::unique_xmalloc_ptr<char> &&cmd);
/* These are hooks that we put in place while doing interpreter_exec
so we can report interesting things that happened "behind the MI's
@@ -69,7 +69,7 @@ static void mi_on_no_history (void);
static void mi_new_thread (struct thread_info *t);
static void mi_thread_exit (struct thread_info *t, int silent);
-static void mi_record_changed (struct inferior*, int, const char *,
+static void mi_record_changed (struct inferior *, int, const char *,
const char *);
static void mi_inferior_added (struct inferior *inf);
static void mi_inferior_appeared (struct inferior *inf);
@@ -159,13 +159,12 @@ mi_interp::init (bool top_level)
target_terminal::scoped_restore_terminal_state term_state;
target_terminal::ours_for_output ();
- gdb_printf (mi->event_channel,
- "thread-group-added,id=\"i%d\"",
+ gdb_printf (mi->event_channel, "thread-group-added,id=\"i%d\"",
inf->num);
gdb_flush (mi->event_channel);
}
- }
+ }
}
void
@@ -212,12 +211,12 @@ mi_cmd_interpreter_exec (const char *command, char **argv, int argc)
int i;
if (argc < 2)
- error (_("-interpreter-exec: "
- "Usage: -interpreter-exec interp command"));
+ error (_ ("-interpreter-exec: "
+ "Usage: -interpreter-exec interp command"));
interp_to_use = interp_lookup (current_ui, argv[0]);
if (interp_to_use == NULL)
- error (_("-interpreter-exec: could not find interpreter \"%s\""),
+ error (_ ("-interpreter-exec: could not find interpreter \"%s\""),
argv[0]);
/* Note that unlike the CLI version of this command, we don't
@@ -234,9 +233,9 @@ mi_cmd_interpreter_exec (const char *command, char **argv, int argc)
/* Now run the code. */
SCOPE_EXIT
- {
- mi_remove_notify_hooks ();
- };
+ {
+ mi_remove_notify_hooks ();
+ };
for (i = 1; i < argc; i++)
interp_exec (interp_to_use, argv[i]);
@@ -329,39 +328,37 @@ static void
mi_new_thread (struct thread_info *t)
{
SWITCH_THRU_ALL_UIS ()
- {
- struct mi_interp *mi = as_mi_interp (top_level_interpreter ());
+ {
+ struct mi_interp *mi = as_mi_interp (top_level_interpreter ());
- if (mi == NULL)
- continue;
+ if (mi == NULL)
+ continue;
- target_terminal::scoped_restore_terminal_state term_state;
- target_terminal::ours_for_output ();
+ target_terminal::scoped_restore_terminal_state term_state;
+ target_terminal::ours_for_output ();
- gdb_printf (mi->event_channel,
- "thread-created,id=\"%d\",group-id=\"i%d\"",
- t->global_num, t->inf->num);
- gdb_flush (mi->event_channel);
- }
+ gdb_printf (mi->event_channel, "thread-created,id=\"%d\",group-id=\"i%d\"",
+ t->global_num, t->inf->num);
+ gdb_flush (mi->event_channel);
+ }
}
static void
mi_thread_exit (struct thread_info *t, int silent)
{
SWITCH_THRU_ALL_UIS ()
- {
- struct mi_interp *mi = as_mi_interp (top_level_interpreter ());
+ {
+ struct mi_interp *mi = as_mi_interp (top_level_interpreter ());
- if (mi == NULL)
- continue;
+ if (mi == NULL)
+ continue;
- target_terminal::scoped_restore_terminal_state term_state;
- target_terminal::ours_for_output ();
- gdb_printf (mi->event_channel,
- "thread-exited,id=\"%d\",group-id=\"i%d\"",
- t->global_num, t->inf->num);
- gdb_flush (mi->event_channel);
- }
+ target_terminal::scoped_restore_terminal_state term_state;
+ target_terminal::ours_for_output ();
+ gdb_printf (mi->event_channel, "thread-exited,id=\"%d\",group-id=\"i%d\"",
+ t->global_num, t->inf->num);
+ gdb_flush (mi->event_channel);
+ }
}
/* Emit notification on changing the state of record. */
@@ -371,134 +368,130 @@ mi_record_changed (struct inferior *inferior, int started, const char *method,
const char *format)
{
SWITCH_THRU_ALL_UIS ()
- {
- struct mi_interp *mi = as_mi_interp (top_level_interpreter ());
-
- if (mi == NULL)
- continue;
-
- target_terminal::scoped_restore_terminal_state term_state;
- target_terminal::ours_for_output ();
-
- if (started)
- {
- if (format != NULL)
- {
- gdb_printf (mi->event_channel,
- "record-started,thread-group=\"i%d\","
- "method=\"%s\",format=\"%s\"",
- inferior->num, method, format);
- }
- else
- {
- gdb_printf (mi->event_channel,
- "record-started,thread-group=\"i%d\","
- "method=\"%s\"",
- inferior->num, method);
- }
- }
- else
- {
- gdb_printf (mi->event_channel,
- "record-stopped,thread-group=\"i%d\"",
- inferior->num);
- }
-
- gdb_flush (mi->event_channel);
- }
+ {
+ struct mi_interp *mi = as_mi_interp (top_level_interpreter ());
+
+ if (mi == NULL)
+ continue;
+
+ target_terminal::scoped_restore_terminal_state term_state;
+ target_terminal::ours_for_output ();
+
+ if (started)
+ {
+ if (format != NULL)
+ {
+ gdb_printf (mi->event_channel,
+ "record-started,thread-group=\"i%d\","
+ "method=\"%s\",format=\"%s\"",
+ inferior->num, method, format);
+ }
+ else
+ {
+ gdb_printf (mi->event_channel,
+ "record-started,thread-group=\"i%d\","
+ "method=\"%s\"",
+ inferior->num, method);
+ }
+ }
+ else
+ {
+ gdb_printf (mi->event_channel, "record-stopped,thread-group=\"i%d\"",
+ inferior->num);
+ }
+
+ gdb_flush (mi->event_channel);
+ }
}
static void
mi_inferior_added (struct inferior *inf)
{
SWITCH_THRU_ALL_UIS ()
- {
- struct interp *interp;
- struct mi_interp *mi;
+ {
+ struct interp *interp;
+ struct mi_interp *mi;
- /* We'll be called once for the initial inferior, before the top
+ /* We'll be called once for the initial inferior, before the top
level interpreter is set. */
- interp = top_level_interpreter ();
- if (interp == NULL)
- continue;
+ interp = top_level_interpreter ();
+ if (interp == NULL)
+ continue;
- mi = as_mi_interp (interp);
- if (mi == NULL)
- continue;
+ mi = as_mi_interp (interp);
+ if (mi == NULL)
+ continue;
- target_terminal::scoped_restore_terminal_state term_state;
- target_terminal::ours_for_output ();
+ target_terminal::scoped_restore_terminal_state term_state;
+ target_terminal::ours_for_output ();
- gdb_printf (mi->event_channel,
- "thread-group-added,id=\"i%d\"",
- inf->num);
- gdb_flush (mi->event_channel);
- }
+ gdb_printf (mi->event_channel, "thread-group-added,id=\"i%d\"", inf->num);
+ gdb_flush (mi->event_channel);
+ }
}
static void
mi_inferior_appeared (struct inferior *inf)
{
SWITCH_THRU_ALL_UIS ()
- {
- struct mi_interp *mi = as_mi_interp (top_level_interpreter ());
+ {
+ struct mi_interp *mi = as_mi_interp (top_level_interpreter ());
- if (mi == NULL)
- continue;
+ if (mi == NULL)
+ continue;
- target_terminal::scoped_restore_terminal_state term_state;
- target_terminal::ours_for_output ();
+ target_terminal::scoped_restore_terminal_state term_state;
+ target_terminal::ours_for_output ();
- gdb_printf (mi->event_channel,
- "thread-group-started,id=\"i%d\",pid=\"%d\"",
- inf->num, inf->pid);
- gdb_flush (mi->event_channel);
- }
+ gdb_printf (mi->event_channel,
+ "thread-group-started,id=\"i%d\",pid=\"%d\"", inf->num,
+ inf->pid);
+ gdb_flush (mi->event_channel);
+ }
}
static void
mi_inferior_exit (struct inferior *inf)
{
SWITCH_THRU_ALL_UIS ()
- {
- struct mi_interp *mi = as_mi_interp (top_level_interpreter ());
+ {
+ struct mi_interp *mi = as_mi_interp (top_level_interpreter ());
- if (mi == NULL)
- continue;
+ if (mi == NULL)
+ continue;
- target_terminal::scoped_restore_terminal_state term_state;
- target_terminal::ours_for_output ();
+ target_terminal::scoped_restore_terminal_state term_state;
+ target_terminal::ours_for_output ();
- if (inf->has_exit_code)
- gdb_printf (mi->event_channel,
- "thread-group-exited,id=\"i%d\",exit-code=\"%s\"",
- inf->num, int_string (inf->exit_code, 8, 0, 0, 1));
- else
- gdb_printf (mi->event_channel,
- "thread-group-exited,id=\"i%d\"", inf->num);
+ if (inf->has_exit_code)
+ gdb_printf (mi->event_channel,
+ "thread-group-exited,id=\"i%d\",exit-code=\"%s\"", inf->num,
+ int_string (inf->exit_code, 8, 0, 0, 1));
+ else
+ gdb_printf (mi->event_channel, "thread-group-exited,id=\"i%d\"",
+ inf->num);
- gdb_flush (mi->event_channel);
- }
+ gdb_flush (mi->event_channel);
+ }
}
static void
mi_inferior_removed (struct inferior *inf)
{
SWITCH_THRU_ALL_UIS ()
- {
- struct mi_interp *mi = as_mi_interp (top_level_interpreter ());
+ {
+ struct mi_interp *mi = as_mi_interp (top_level_interpreter ());
- if (mi == NULL)
- continue;
+ if (mi == NULL)
+ continue;
- target_terminal::scoped_restore_terminal_state term_state;
- target_terminal::ours_for_output ();
+ target_terminal::scoped_restore_terminal_state term_state;
+ target_terminal::ours_for_output ();
- gdb_printf (mi->event_channel,
- "thread-group-removed,id=\"i%d\"",
- inf->num);
- gdb_flush (mi->event_channel);
- }
+ gdb_printf (mi->event_channel, "thread-group-removed,id=\"i%d\"",
+ inf->num);
+ gdb_flush (mi->event_channel);
+ }
}
/* Return the MI interpreter, if it is active -- either because it's
@@ -531,15 +524,15 @@ static void
mi_on_signal_received (enum gdb_signal siggnal)
{
SWITCH_THRU_ALL_UIS ()
- {
- struct mi_interp *mi = find_mi_interp ();
+ {
+ struct mi_interp *mi = find_mi_interp ();
- if (mi == NULL)
- continue;
+ if (mi == NULL)
+ continue;
- print_signal_received_reason (mi->mi_uiout, siggnal);
- print_signal_received_reason (mi->cli_uiout, siggnal);
- }
+ print_signal_received_reason (mi->mi_uiout, siggnal);
+ print_signal_received_reason (mi->cli_uiout, siggnal);
+ }
}
/* Observer for the end_stepping_range notification. */
@@ -548,15 +541,15 @@ static void
mi_on_end_stepping_range (void)
{
SWITCH_THRU_ALL_UIS ()
- {
- struct mi_interp *mi = find_mi_interp ();
+ {
+ struct mi_interp *mi = find_mi_interp ();
- if (mi == NULL)
- continue;
+ if (mi == NULL)
+ continue;
- print_end_stepping_range_reason (mi->mi_uiout);
- print_end_stepping_range_reason (mi->cli_uiout);
- }
+ print_end_stepping_range_reason (mi->mi_uiout);
+ print_end_stepping_range_reason (mi->cli_uiout);
+ }
}
/* Observer for the signal_exited notification. */
@@ -565,15 +558,15 @@ static void
mi_on_signal_exited (enum gdb_signal siggnal)
{
SWITCH_THRU_ALL_UIS ()
- {
- struct mi_interp *mi = find_mi_interp ();
+ {
+ struct mi_interp *mi = find_mi_interp ();
- if (mi == NULL)
- continue;
+ if (mi == NULL)
+ continue;
- print_signal_exited_reason (mi->mi_uiout, siggnal);
- print_signal_exited_reason (mi->cli_uiout, siggnal);
- }
+ print_signal_exited_reason (mi->mi_uiout, siggnal);
+ print_signal_exited_reason (mi->cli_uiout, siggnal);
+ }
}
/* Observer for the exited notification. */
@@ -582,15 +575,15 @@ static void
mi_on_exited (int exitstatus)
{
SWITCH_THRU_ALL_UIS ()
- {
- struct mi_interp *mi = find_mi_interp ();
+ {
+ struct mi_interp *mi = find_mi_interp ();
- if (mi == NULL)
- continue;
+ if (mi == NULL)
+ continue;
- print_exited_reason (mi->mi_uiout, exitstatus);
- print_exited_reason (mi->cli_uiout, exitstatus);
- }
+ print_exited_reason (mi->mi_uiout, exitstatus);
+ print_exited_reason (mi->cli_uiout, exitstatus);
+ }
}
/* Observer for the no_history notification. */
@@ -599,15 +592,15 @@ static void
mi_on_no_history (void)
{
SWITCH_THRU_ALL_UIS ()
- {
- struct mi_interp *mi = find_mi_interp ();
+ {
+ struct mi_interp *mi = find_mi_interp ();
- if (mi == NULL)
- continue;
+ if (mi == NULL)
+ continue;
- print_no_history_reason (mi->mi_uiout);
- print_no_history_reason (mi->cli_uiout);
- }
+ print_no_history_reason (mi->mi_uiout);
+ print_no_history_reason (mi->cli_uiout);
+ }
}
static void
@@ -627,8 +620,7 @@ mi_on_normal_stop_1 (struct bpstat *bs, int print_frame)
tp = inferior_thread ();
- if (tp->thread_fsm () != nullptr
- && tp->thread_fsm ()->finished_p ())
+ if (tp->thread_fsm () != nullptr && tp->thread_fsm ()->finished_p ())
{
enum async_reply_reason reason;
@@ -660,7 +652,7 @@ mi_on_normal_stop_1 (struct bpstat *bs, int print_frame)
if (core != -1)
mi_uiout->field_signed ("core", core);
}
-
+
gdb_puts ("*stopped", mi->raw_stdout);
mi_out_put (mi_uiout, mi->raw_stdout);
mi_out_rewind (mi_uiout);
@@ -673,12 +665,12 @@ static void
mi_on_normal_stop (struct bpstat *bs, int print_frame)
{
SWITCH_THRU_ALL_UIS ()
- {
- if (as_mi_interp (top_level_interpreter ()) == NULL)
- continue;
+ {
+ if (as_mi_interp (top_level_interpreter ()) == NULL)
+ continue;
- mi_on_normal_stop_1 (bs, print_frame);
- }
+ mi_on_normal_stop_1 (bs, print_frame);
+ }
}
static void
@@ -700,13 +692,12 @@ mi_about_to_proceed (void)
/* When the element is non-zero, no MI notifications will be emitted in
response to the corresponding observers. */
-struct mi_suppress_notification mi_suppress_notification =
- {
- 0,
- 0,
- 0,
- 0,
- };
+struct mi_suppress_notification mi_suppress_notification = {
+ 0,
+ 0,
+ 0,
+ 0,
+};
/* Emit notification on changing a traceframe. */
@@ -717,24 +708,25 @@ mi_traceframe_changed (int tfnum, int tpnum)
return;
SWITCH_THRU_ALL_UIS ()
- {
- struct mi_interp *mi = as_mi_interp (top_level_interpreter ());
+ {
+ struct mi_interp *mi = as_mi_interp (top_level_interpreter ());
- if (mi == NULL)
- continue;
+ if (mi == NULL)
+ continue;
- target_terminal::scoped_restore_terminal_state term_state;
- target_terminal::ours_for_output ();
+ target_terminal::scoped_restore_terminal_state term_state;
+ target_terminal::ours_for_output ();
- if (tfnum >= 0)
- gdb_printf (mi->event_channel, "traceframe-changed,"
- "num=\"%d\",tracepoint=\"%d\"",
- tfnum, tpnum);
- else
- gdb_printf (mi->event_channel, "traceframe-changed,end");
+ if (tfnum >= 0)
+ gdb_printf (mi->event_channel,
+ "traceframe-changed,"
+ "num=\"%d\",tracepoint=\"%d\"",
+ tfnum, tpnum);
+ else
+ gdb_printf (mi->event_channel, "traceframe-changed,end");
- gdb_flush (mi->event_channel);
- }
+ gdb_flush (mi->event_channel);
+ }
}
/* Emit notification on creating a trace state variable. */
@@ -743,21 +735,22 @@ static void
mi_tsv_created (const struct trace_state_variable *tsv)
{
SWITCH_THRU_ALL_UIS ()
- {
- struct mi_interp *mi = as_mi_interp (top_level_interpreter ());
+ {
+ struct mi_interp *mi = as_mi_interp (top_level_interpreter ());
- if (mi == NULL)
- continue;
+ if (mi == NULL)
+ continue;
- target_terminal::scoped_restore_terminal_state term_state;
- target_terminal::ours_for_output ();
+ target_terminal::scoped_restore_terminal_state term_state;
+ target_terminal::ours_for_output ();
- gdb_printf (mi->event_channel, "tsv-created,"
- "name=\"%s\",initial=\"%s\"",
- tsv->name.c_str (), plongest (tsv->initial_value));
+ gdb_printf (mi->event_channel,
+ "tsv-created,"
+ "name=\"%s\",initial=\"%s\"",
+ tsv->name.c_str (), plongest (tsv->initial_value));
- gdb_flush (mi->event_channel);
- }
+ gdb_flush (mi->event_channel);
+ }
}
/* Emit notification on deleting a trace state variable. */
@@ -766,23 +759,25 @@ static void
mi_tsv_deleted (const struct trace_state_variable *tsv)
{
SWITCH_THRU_ALL_UIS ()
- {
- struct mi_interp *mi = as_mi_interp (top_level_interpreter ());
+ {
+ struct mi_interp *mi = as_mi_interp (top_level_interpreter ());
- if (mi == NULL)
- continue;
+ if (mi == NULL)
+ continue;
- target_terminal::scoped_restore_terminal_state term_state;
- target_terminal::ours_for_output ();
+ target_terminal::scoped_restore_terminal_state term_state;
+ target_terminal::ours_for_output ();
- if (tsv != NULL)
- gdb_printf (mi->event_channel, "tsv-deleted,"
- "name=\"%s\"", tsv->name.c_str ());
- else
- gdb_printf (mi->event_channel, "tsv-deleted");
+ if (tsv != NULL)
+ gdb_printf (mi->event_channel,
+ "tsv-deleted,"
+ "name=\"%s\"",
+ tsv->name.c_str ());
+ else
+ gdb_printf (mi->event_channel, "tsv-deleted");
- gdb_flush (mi->event_channel);
- }
+ gdb_flush (mi->event_channel);
+ }
}
/* Emit notification on modifying a trace state variable. */
@@ -791,31 +786,29 @@ static void
mi_tsv_modified (const struct trace_state_variable *tsv)
{
SWITCH_THRU_ALL_UIS ()
- {
- struct mi_interp *mi = as_mi_interp (top_level_interpreter ());
- struct ui_out *mi_uiout;
+ {
+ struct mi_interp *mi = as_mi_interp (top_level_interpreter ());
+ struct ui_out *mi_uiout;
- if (mi == NULL)
- continue;
+ if (mi == NULL)
+ continue;
- mi_uiout = top_level_interpreter ()->interp_ui_out ();
+ mi_uiout = top_level_interpreter ()->interp_ui_out ();
- target_terminal::scoped_restore_terminal_state term_state;
- target_terminal::ours_for_output ();
+ target_terminal::scoped_restore_terminal_state term_state;
+ target_terminal::ours_for_output ();
- gdb_printf (mi->event_channel,
- "tsv-modified");
+ gdb_printf (mi->event_channel, "tsv-modified");
- ui_out_redirect_pop redir (mi_uiout, mi->event_channel);
+ ui_out_redirect_pop redir (mi_uiout, mi->event_channel);
- mi_uiout->field_string ("name", tsv->name);
- mi_uiout->field_string ("initial",
- plongest (tsv->initial_value));
- if (tsv->value_known)
- mi_uiout->field_string ("current", plongest (tsv->value));
+ mi_uiout->field_string ("name", tsv->name);
+ mi_uiout->field_string ("initial", plongest (tsv->initial_value));
+ if (tsv->value_known)
+ mi_uiout->field_string ("current", plongest (tsv->value));
- gdb_flush (mi->event_channel);
- }
+ gdb_flush (mi->event_channel);
+ }
}
/* Print breakpoint BP on MI's event channel. */
@@ -859,21 +852,20 @@ mi_breakpoint_created (struct breakpoint *b)
return;
SWITCH_THRU_ALL_UIS ()
- {
- struct mi_interp *mi = as_mi_interp (top_level_interpreter ());
+ {
+ struct mi_interp *mi = as_mi_interp (top_level_interpreter ());
- if (mi == NULL)
- continue;
+ if (mi == NULL)
+ continue;
- target_terminal::scoped_restore_terminal_state term_state;
- target_terminal::ours_for_output ();
+ target_terminal::scoped_restore_terminal_state term_state;
+ target_terminal::ours_for_output ();
- gdb_printf (mi->event_channel,
- "breakpoint-created");
- mi_print_breakpoint_for_event (mi, b);
+ gdb_printf (mi->event_channel, "breakpoint-created");
+ mi_print_breakpoint_for_event (mi, b);
- gdb_flush (mi->event_channel);
- }
+ gdb_flush (mi->event_channel);
+ }
}
/* Emit notification about deleted breakpoint. */
@@ -888,20 +880,19 @@ mi_breakpoint_deleted (struct breakpoint *b)
return;
SWITCH_THRU_ALL_UIS ()
- {
- struct mi_interp *mi = as_mi_interp (top_level_interpreter ());
+ {
+ struct mi_interp *mi = as_mi_interp (top_level_interpreter ());
- if (mi == NULL)
- continue;
+ if (mi == NULL)
+ continue;
- target_terminal::scoped_restore_terminal_state term_state;
- target_terminal::ours_for_output ();
+ target_terminal::scoped_restore_terminal_state term_state;
+ target_terminal::ours_for_output ();
- gdb_printf (mi->event_channel, "breakpoint-deleted,id=\"%d\"",
- b->number);
+ gdb_printf (mi->event_channel, "breakpoint-deleted,id=\"%d\"", b->number);
- gdb_flush (mi->event_channel);
- }
+ gdb_flush (mi->event_channel);
+ }
}
/* Emit notification about modified breakpoint. */
@@ -916,36 +907,34 @@ mi_breakpoint_modified (struct breakpoint *b)
return;
SWITCH_THRU_ALL_UIS ()
- {
- struct mi_interp *mi = as_mi_interp (top_level_interpreter ());
+ {
+ struct mi_interp *mi = as_mi_interp (top_level_interpreter ());
- if (mi == NULL)
- continue;
+ if (mi == NULL)
+ continue;
- target_terminal::scoped_restore_terminal_state term_state;
- target_terminal::ours_for_output ();
- gdb_printf (mi->event_channel,
- "breakpoint-modified");
- mi_print_breakpoint_for_event (mi, b);
+ target_terminal::scoped_restore_terminal_state term_state;
+ target_terminal::ours_for_output ();
+ gdb_printf (mi->event_channel, "breakpoint-modified");
+ mi_print_breakpoint_for_event (mi, b);
- gdb_flush (mi->event_channel);
- }
+ gdb_flush (mi->event_channel);
+ }
}
static void
mi_output_running (struct thread_info *thread)
{
SWITCH_THRU_ALL_UIS ()
- {
- struct mi_interp *mi = as_mi_interp (top_level_interpreter ());
+ {
+ struct mi_interp *mi = as_mi_interp (top_level_interpreter ());
- if (mi == NULL)
- continue;
+ if (mi == NULL)
+ continue;
- gdb_printf (mi->raw_stdout,
- "*running,thread-id=\"%d\"\n",
- thread->global_num);
- }
+ gdb_printf (mi->raw_stdout, "*running,thread-id=\"%d\"\n",
+ thread->global_num);
+ }
}
/* Return true if there are multiple inferiors loaded. This is used
@@ -967,8 +956,8 @@ multiple_inferiors_p ()
}
static void
-mi_on_resume_1 (struct mi_interp *mi,
- process_stratum_target *targ, ptid_t ptid)
+mi_on_resume_1 (struct mi_interp *mi, process_stratum_target *targ,
+ ptid_t ptid)
{
/* To cater for older frontends, emit ^running, but do it only once
per each command. We do it here, since at this point we know
@@ -987,8 +976,7 @@ mi_on_resume_1 (struct mi_interp *mi,
/* Backwards compatibility. If doing a wildcard resume and there's
only one inferior, output "all", otherwise, output each resumed
thread individually. */
- if ((ptid == minus_one_ptid || ptid.is_pid ())
- && !multiple_inferiors_p ())
+ if ((ptid == minus_one_ptid || ptid.is_pid ()) && !multiple_inferiors_p ())
gdb_printf (mi->raw_stdout, "*running,thread-id=\"all\"\n");
else
for (thread_info *tp : all_non_exited_threads (targ, ptid))
@@ -1022,17 +1010,17 @@ mi_on_resume (ptid_t ptid)
return;
SWITCH_THRU_ALL_UIS ()
- {
- struct mi_interp *mi = as_mi_interp (top_level_interpreter ());
+ {
+ struct mi_interp *mi = as_mi_interp (top_level_interpreter ());
- if (mi == NULL)
- continue;
+ if (mi == NULL)
+ continue;
- target_terminal::scoped_restore_terminal_state term_state;
- target_terminal::ours_for_output ();
+ target_terminal::scoped_restore_terminal_state term_state;
+ target_terminal::ours_for_output ();
- mi_on_resume_1 (mi, target, ptid);
- }
+ mi_on_resume_1 (mi, target, ptid);
+ }
}
/* See mi-interp.h. */
@@ -1047,7 +1035,7 @@ mi_output_solib_attribs (ui_out *uiout, struct so_list *solib)
uiout->field_string ("host-name", solib->so_name);
uiout->field_signed ("symbols-loaded", solib->symbols_loaded);
if (!gdbarch_has_global_solist (target_gdbarch ()))
- uiout->field_fmt ("thread-group", "i%d", current_inferior ()->num);
+ uiout->field_fmt ("thread-group", "i%d", current_inferior ()->num);
ui_out_emit_list list_emitter (uiout, "ranges");
ui_out_emit_tuple tuple_emitter (uiout, NULL);
@@ -1062,58 +1050,58 @@ static void
mi_solib_loaded (struct so_list *solib)
{
SWITCH_THRU_ALL_UIS ()
- {
- struct mi_interp *mi = as_mi_interp (top_level_interpreter ());
- struct ui_out *uiout;
+ {
+ struct mi_interp *mi = as_mi_interp (top_level_interpreter ());
+ struct ui_out *uiout;
- if (mi == NULL)
- continue;
+ if (mi == NULL)
+ continue;
- uiout = top_level_interpreter ()->interp_ui_out ();
+ uiout = top_level_interpreter ()->interp_ui_out ();
- target_terminal::scoped_restore_terminal_state term_state;
- target_terminal::ours_for_output ();
+ target_terminal::scoped_restore_terminal_state term_state;
+ target_terminal::ours_for_output ();
- gdb_printf (mi->event_channel, "library-loaded");
+ gdb_printf (mi->event_channel, "library-loaded");
- ui_out_redirect_pop redir (uiout, mi->event_channel);
+ ui_out_redirect_pop redir (uiout, mi->event_channel);
- mi_output_solib_attribs (uiout, solib);
+ mi_output_solib_attribs (uiout, solib);
- gdb_flush (mi->event_channel);
- }
+ gdb_flush (mi->event_channel);
+ }
}
static void
mi_solib_unloaded (struct so_list *solib)
{
SWITCH_THRU_ALL_UIS ()
- {
- struct mi_interp *mi = as_mi_interp (top_level_interpreter ());
- struct ui_out *uiout;
+ {
+ struct mi_interp *mi = as_mi_interp (top_level_interpreter ());
+ struct ui_out *uiout;
- if (mi == NULL)
- continue;
+ if (mi == NULL)
+ continue;
- uiout = top_level_interpreter ()->interp_ui_out ();
+ uiout = top_level_interpreter ()->interp_ui_out ();
- target_terminal::scoped_restore_terminal_state term_state;
- target_terminal::ours_for_output ();
+ target_terminal::scoped_restore_terminal_state term_state;
+ target_terminal::ours_for_output ();
- gdb_printf (mi->event_channel, "library-unloaded");
+ gdb_printf (mi->event_channel, "library-unloaded");
- ui_out_redirect_pop redir (uiout, mi->event_channel);
+ ui_out_redirect_pop redir (uiout, mi->event_channel);
- uiout->field_string ("id", solib->so_original_name);
- uiout->field_string ("target-name", solib->so_original_name);
- uiout->field_string ("host-name", solib->so_name);
- if (!gdbarch_has_global_solist (target_gdbarch ()))
- {
- uiout->field_fmt ("thread-group", "i%d", current_inferior ()->num);
- }
+ uiout->field_string ("id", solib->so_original_name);
+ uiout->field_string ("target-name", solib->so_original_name);
+ uiout->field_string ("host-name", solib->so_name);
+ if (!gdbarch_has_global_solist (target_gdbarch ()))
+ {
+ uiout->field_fmt ("thread-group", "i%d", current_inferior ()->num);
+ }
- gdb_flush (mi->event_channel);
- }
+ gdb_flush (mi->event_channel);
+ }
}
/* Emit notification about the command parameter change. */
@@ -1125,73 +1113,73 @@ mi_command_param_changed (const char *param, const char *value)
return;
SWITCH_THRU_ALL_UIS ()
- {
- struct mi_interp *mi = as_mi_interp (top_level_interpreter ());
- struct ui_out *mi_uiout;
+ {
+ struct mi_interp *mi = as_mi_interp (top_level_interpreter ());
+ struct ui_out *mi_uiout;
- if (mi == NULL)
- continue;
+ if (mi == NULL)
+ continue;
- mi_uiout = top_level_interpreter ()->interp_ui_out ();
+ mi_uiout = top_level_interpreter ()->interp_ui_out ();
- target_terminal::scoped_restore_terminal_state term_state;
- target_terminal::ours_for_output ();
+ target_terminal::scoped_restore_terminal_state term_state;
+ target_terminal::ours_for_output ();
- gdb_printf (mi->event_channel, "cmd-param-changed");
+ gdb_printf (mi->event_channel, "cmd-param-changed");
- ui_out_redirect_pop redir (mi_uiout, mi->event_channel);
+ ui_out_redirect_pop redir (mi_uiout, mi->event_channel);
- mi_uiout->field_string ("param", param);
- mi_uiout->field_string ("value", value);
+ mi_uiout->field_string ("param", param);
+ mi_uiout->field_string ("value", value);
- gdb_flush (mi->event_channel);
- }
+ gdb_flush (mi->event_channel);
+ }
}
/* Emit notification about the target memory change. */
static void
-mi_memory_changed (struct inferior *inferior, CORE_ADDR memaddr,
- ssize_t len, const bfd_byte *myaddr)
+mi_memory_changed (struct inferior *inferior, CORE_ADDR memaddr, ssize_t len,
+ const bfd_byte *myaddr)
{
if (mi_suppress_notification.memory)
return;
SWITCH_THRU_ALL_UIS ()
- {
- struct mi_interp *mi = as_mi_interp (top_level_interpreter ());
- struct ui_out *mi_uiout;
- struct obj_section *sec;
+ {
+ struct mi_interp *mi = as_mi_interp (top_level_interpreter ());
+ struct ui_out *mi_uiout;
+ struct obj_section *sec;
- if (mi == NULL)
- continue;
+ if (mi == NULL)
+ continue;
- mi_uiout = top_level_interpreter ()->interp_ui_out ();
+ mi_uiout = top_level_interpreter ()->interp_ui_out ();
- target_terminal::scoped_restore_terminal_state term_state;
- target_terminal::ours_for_output ();
+ target_terminal::scoped_restore_terminal_state term_state;
+ target_terminal::ours_for_output ();
- gdb_printf (mi->event_channel, "memory-changed");
+ gdb_printf (mi->event_channel, "memory-changed");
- ui_out_redirect_pop redir (mi_uiout, mi->event_channel);
+ ui_out_redirect_pop redir (mi_uiout, mi->event_channel);
- mi_uiout->field_fmt ("thread-group", "i%d", inferior->num);
- mi_uiout->field_core_addr ("addr", target_gdbarch (), memaddr);
- mi_uiout->field_string ("len", hex_string (len));
+ mi_uiout->field_fmt ("thread-group", "i%d", inferior->num);
+ mi_uiout->field_core_addr ("addr", target_gdbarch (), memaddr);
+ mi_uiout->field_string ("len", hex_string (len));
- /* Append 'type=code' into notification if MEMADDR falls in the range of
+ /* Append 'type=code' into notification if MEMADDR falls in the range of
sections contain code. */
- sec = find_pc_section (memaddr);
- if (sec != NULL && sec->objfile != NULL)
- {
- flagword flags = bfd_section_flags (sec->the_bfd_section);
+ sec = find_pc_section (memaddr);
+ if (sec != NULL && sec->objfile != NULL)
+ {
+ flagword flags = bfd_section_flags (sec->the_bfd_section);
- if (flags & SEC_CODE)
- mi_uiout->field_string ("type", "code");
- }
+ if (flags & SEC_CODE)
+ mi_uiout->field_string ("type", "code");
+ }
- gdb_flush (mi->event_channel);
- }
+ gdb_flush (mi->event_channel);
+ }
}
/* Emit an event when the selection context (inferior, thread, frame)
@@ -1212,42 +1200,41 @@ mi_user_selected_context_changed (user_selected_what selection)
tp = NULL;
SWITCH_THRU_ALL_UIS ()
- {
- struct mi_interp *mi = as_mi_interp (top_level_interpreter ());
- struct ui_out *mi_uiout;
+ {
+ struct mi_interp *mi = as_mi_interp (top_level_interpreter ());
+ struct ui_out *mi_uiout;
- if (mi == NULL)
- continue;
+ if (mi == NULL)
+ continue;
- mi_uiout = top_level_interpreter ()->interp_ui_out ();
+ mi_uiout = top_level_interpreter ()->interp_ui_out ();
- ui_out_redirect_pop redirect_popper (mi_uiout, mi->event_channel);
+ ui_out_redirect_pop redirect_popper (mi_uiout, mi->event_channel);
- target_terminal::scoped_restore_terminal_state term_state;
- target_terminal::ours_for_output ();
+ target_terminal::scoped_restore_terminal_state term_state;
+ target_terminal::ours_for_output ();
- if (selection & USER_SELECTED_INFERIOR)
- print_selected_inferior (mi->cli_uiout);
+ if (selection & USER_SELECTED_INFERIOR)
+ print_selected_inferior (mi->cli_uiout);
- if (tp != NULL
- && (selection & (USER_SELECTED_THREAD | USER_SELECTED_FRAME)))
- {
- print_selected_thread_frame (mi->cli_uiout, selection);
-
- gdb_printf (mi->event_channel,
- "thread-selected,id=\"%d\"",
- tp->global_num);
-
- if (tp->state != THREAD_RUNNING)
- {
- if (has_stack_frames ())
- print_stack_frame_to_uiout (mi_uiout, get_selected_frame (NULL),
- 1, SRC_AND_LOC, 1);
- }
- }
+ if (tp != NULL
+ && (selection & (USER_SELECTED_THREAD | USER_SELECTED_FRAME)))
+ {
+ print_selected_thread_frame (mi->cli_uiout, selection);
- gdb_flush (mi->event_channel);
- }
+ gdb_printf (mi->event_channel, "thread-selected,id=\"%d\"",
+ tp->global_num);
+
+ if (tp->state != THREAD_RUNNING)
+ {
+ if (has_stack_frames ())
+ print_stack_frame_to_uiout (mi_uiout, get_selected_frame (NULL),
+ 1, SRC_AND_LOC, 1);
+ }
+ }
+
+ gdb_flush (mi->event_channel);
+ }
}
ui_out *
@@ -1307,6 +1294,7 @@ mi_interp_factory (const char *name)
}
void _initialize_mi_interp ();
+
void
_initialize_mi_interp ()
{
@@ -1351,6 +1339,6 @@ _initialize_mi_interp ()
gdb::observers::memory_changed.attach (mi_memory_changed, "mi-interp");
gdb::observers::sync_execution_done.attach (mi_on_sync_execution_done,
"mi-interp");
- gdb::observers::user_selected_context_changed.attach
- (mi_user_selected_context_changed, "mi-interp");
+ gdb::observers::user_selected_context_changed.attach (
+ mi_user_selected_context_changed, "mi-interp");
}
diff --git a/gdb/mi/mi-interp.h b/gdb/mi/mi-interp.h
index e07be12f87a..0afbbdcdefb 100644
--- a/gdb/mi/mi-interp.h
+++ b/gdb/mi/mi-interp.h
@@ -29,9 +29,11 @@ struct mi_console_file;
class mi_interp final : public interp
{
public:
+
mi_interp (const char *name)
: interp (name)
- {}
+ {
+ }
void init (bool top_level) override;
void resume () override;
diff --git a/gdb/mi/mi-main.c b/gdb/mi/mi-main.c
index e0cade2edc3..f7f4468d280 100644
--- a/gdb/mi/mi-main.c
+++ b/gdb/mi/mi-main.c
@@ -35,7 +35,7 @@
#include "interps.h"
#include "gdbsupport/event-loop.h"
#include "event-top.h"
-#include "gdbcore.h" /* For write_memory(). */
+#include "gdbcore.h" /* For write_memory(). */
#include "value.h"
#include "regcache.h"
#include "frame.h"
@@ -64,9 +64,9 @@
#include <map>
enum
- {
- FROM_TTY = 0
- };
+{
+ FROM_TTY = 0
+};
/* Debug flag */
static int mi_debug_p;
@@ -91,10 +91,10 @@ int mi_proceeded;
static void mi_cmd_execute (struct mi_parse *parse);
-static void mi_execute_async_cli_command (const char *cli_command,
- char **argv, int argc);
+static void mi_execute_async_cli_command (const char *cli_command, char **argv,
+ int argc);
static bool register_changed_p (int regnum, readonly_detached_regcache *,
- readonly_detached_regcache *);
+ readonly_detached_regcache *);
static void output_register (frame_info_ptr, int regnum, int format,
int skip_unavailable);
@@ -112,7 +112,7 @@ set_mi_async_command (const char *args, int from_tty,
if (have_live_inferiors ())
{
mi_async_1 = mi_async;
- error (_("Cannot change this setting while the inferior is running."));
+ error (_ ("Cannot change this setting while the inferior is running."));
}
mi_async = mi_async_1;
@@ -120,12 +120,9 @@ set_mi_async_command (const char *args, int from_tty,
static void
show_mi_async_command (struct ui_file *file, int from_tty,
- struct cmd_list_element *c,
- const char *value)
+ struct cmd_list_element *c, const char *value)
{
- gdb_printf (file,
- _("Whether MI is in asynchronous mode is %s.\n"),
- value);
+ gdb_printf (file, _ ("Whether MI is in asynchronous mode is %s.\n"), value);
}
/* A wrapper for target_can_async_p that takes the MI setting into
@@ -165,7 +162,7 @@ void
mi_cmd_exec_next (const char *command, char **argv, int argc)
{
/* FIXME: Should call a libgdb function, not a cli wrapper. */
- if (argc > 0 && strcmp(argv[0], "--reverse") == 0)
+ if (argc > 0 && strcmp (argv[0], "--reverse") == 0)
mi_execute_async_cli_command ("reverse-next", argv + 1, argc - 1);
else
mi_execute_async_cli_command ("next", argv, argc);
@@ -175,7 +172,7 @@ void
mi_cmd_exec_next_instruction (const char *command, char **argv, int argc)
{
/* FIXME: Should call a libgdb function, not a cli wrapper. */
- if (argc > 0 && strcmp(argv[0], "--reverse") == 0)
+ if (argc > 0 && strcmp (argv[0], "--reverse") == 0)
mi_execute_async_cli_command ("reverse-nexti", argv + 1, argc - 1);
else
mi_execute_async_cli_command ("nexti", argv, argc);
@@ -185,7 +182,7 @@ void
mi_cmd_exec_step (const char *command, char **argv, int argc)
{
/* FIXME: Should call a libgdb function, not a cli wrapper. */
- if (argc > 0 && strcmp(argv[0], "--reverse") == 0)
+ if (argc > 0 && strcmp (argv[0], "--reverse") == 0)
mi_execute_async_cli_command ("reverse-step", argv + 1, argc - 1);
else
mi_execute_async_cli_command ("step", argv, argc);
@@ -195,7 +192,7 @@ void
mi_cmd_exec_step_instruction (const char *command, char **argv, int argc)
{
/* FIXME: Should call a libgdb function, not a cli wrapper. */
- if (argc > 0 && strcmp(argv[0], "--reverse") == 0)
+ if (argc > 0 && strcmp (argv[0], "--reverse") == 0)
mi_execute_async_cli_command ("reverse-stepi", argv + 1, argc - 1);
else
mi_execute_async_cli_command ("stepi", argv, argc);
@@ -205,7 +202,7 @@ void
mi_cmd_exec_finish (const char *command, char **argv, int argc)
{
/* FIXME: Should call a libgdb function, not a cli wrapper. */
- if (argc > 0 && strcmp(argv[0], "--reverse") == 0)
+ if (argc > 0 && strcmp (argv[0], "--reverse") == 0)
mi_execute_async_cli_command ("reverse-finish", argv + 1, argc - 1);
else
mi_execute_async_cli_command ("finish", argv, argc);
@@ -254,7 +251,7 @@ proceed_thread (struct thread_info *thread, int pid)
static int
proceed_thread_callback (struct thread_info *thread, void *arg)
{
- int pid = *(int *)arg;
+ int pid = *(int *) arg;
proceed_thread (thread, pid);
return 0;
@@ -263,8 +260,8 @@ proceed_thread_callback (struct thread_info *thread, void *arg)
static void
exec_continue (char **argv, int argc)
{
- prepare_execution_command (current_inferior ()->top_target (), mi_async_p ());
-
+ prepare_execution_command (current_inferior ()->top_target (),
+ mi_async_p ());
if (non_stop)
{
@@ -277,8 +274,8 @@ exec_continue (char **argv, int argc)
if (current_context->all || current_context->thread_group != -1)
{
scoped_restore_current_thread restore_thread;
- scoped_disable_commit_resumed disable_commit_resumed
- ("MI continue all threads in non-stop");
+ scoped_disable_commit_resumed disable_commit_resumed (
+ "MI continue all threads in non-stop");
int pid = 0;
if (!current_context->all)
@@ -323,13 +320,14 @@ exec_reverse_continue (char **argv, int argc)
enum exec_direction_kind dir = execution_direction;
if (dir == EXEC_REVERSE)
- error (_("Already in reverse mode."));
+ error (_ ("Already in reverse mode."));
if (!target_can_execute_reverse ())
- error (_("Target %s does not support this command."), target_shortname ());
+ error (_ ("Target %s does not support this command."),
+ target_shortname ());
- scoped_restore save_exec_dir = make_scoped_restore (&execution_direction,
- EXEC_REVERSE);
+ scoped_restore save_exec_dir
+ = make_scoped_restore (&execution_direction, EXEC_REVERSE);
exec_continue (argv, argc);
}
@@ -345,7 +343,7 @@ mi_cmd_exec_continue (const char *command, char **argv, int argc)
static int
interrupt_thread_callback (struct thread_info *thread, void *arg)
{
- int pid = *(int *)arg;
+ int pid = *(int *) arg;
if (thread->state != THREAD_RUNNING)
return 0;
@@ -383,8 +381,8 @@ mi_cmd_exec_interrupt (const char *command, char **argv, int argc)
{
struct inferior *inf = find_inferior_id (current_context->thread_group);
- scoped_disable_commit_resumed disable_commit_resumed
- ("interrupting all threads of thread group");
+ scoped_disable_commit_resumed disable_commit_resumed (
+ "interrupting all threads of thread group");
iterate_over_threads (interrupt_thread_callback, &inf->pid);
}
@@ -413,14 +411,13 @@ run_one_inferior (inferior *inf, bool start_p)
{
thread_info *tp = any_thread_of_inferior (inf);
if (tp == NULL)
- error (_("Inferior has no threads."));
+ error (_ ("Inferior has no threads."));
switch_to_thread (tp);
}
else
switch_to_inferior_no_thread (inf);
- mi_execute_cli_command (run_cmd, async_p,
- async_p ? "&" : NULL);
+ mi_execute_cli_command (run_cmd, async_p, async_p ? "&" : NULL);
}
void
@@ -430,14 +427,13 @@ mi_cmd_exec_run (const char *command, char **argv, int argc)
/* Parse the command options. */
enum opt
- {
- START_OPT,
- };
- static const struct mi_opt opts[] =
- {
- {"-start", START_OPT, 0},
- {NULL, 0, 0},
- };
+ {
+ START_OPT,
+ };
+ static const struct mi_opt opts[] = {
+ { "-start", START_OPT, 0 },
+ { NULL, 0, 0 },
+ };
int oind = 0;
char *oarg;
@@ -459,7 +455,7 @@ mi_cmd_exec_run (const char *command, char **argv, int argc)
/* This command does not accept any argument. Make sure the user
did not provide any. */
if (oind != argc)
- error (_("Invalid argument: %s"), argv[oind]);
+ error (_ ("Invalid argument: %s"), argv[oind]);
if (current_context->all)
{
@@ -474,16 +470,14 @@ mi_cmd_exec_run (const char *command, char **argv, int argc)
struct target_ops *run_target = find_run_target ();
bool async_p = mi_async && target_can_async_p (run_target);
- mi_execute_cli_command (run_cmd, async_p,
- async_p ? "&" : NULL);
+ mi_execute_cli_command (run_cmd, async_p, async_p ? "&" : NULL);
}
}
-
static int
find_thread_of_process (struct thread_info *ti, void *p)
{
- int pid = *(int *)p;
+ int pid = *(int *) p;
if (ti->ptid.pid () == pid && ti->state != THREAD_EXITED)
return 1;
@@ -495,7 +489,7 @@ void
mi_cmd_target_detach (const char *command, char **argv, int argc)
{
if (argc != 0 && argc != 1)
- error (_("Usage: -target-detach [pid | thread-group]"));
+ error (_ ("Usage: -target-detach [pid | thread-group]"));
if (argc == 1)
{
@@ -510,11 +504,11 @@ mi_cmd_target_detach (const char *command, char **argv, int argc)
int id = strtoul (argv[0] + 1, &end, 0);
if (*end != '\0')
- error (_("Invalid syntax of thread-group id '%s'"), argv[0]);
+ error (_ ("Invalid syntax of thread-group id '%s'"), argv[0]);
inf = find_inferior_id (id);
if (!inf)
- error (_("Non-existent thread-group id '%d'"), id);
+ error (_ ("Non-existent thread-group id '%d'"), id);
pid = inf->pid;
}
@@ -524,14 +518,14 @@ mi_cmd_target_detach (const char *command, char **argv, int argc)
pid = strtol (argv[0], &end, 10);
if (*end != '\0')
- error (_("Invalid identifier '%s'"), argv[0]);
+ error (_ ("Invalid identifier '%s'"), argv[0]);
}
/* Pick any thread in the desired process. Current
target_detach detaches from the parent of inferior_ptid. */
tp = iterate_over_threads (find_thread_of_process, &pid);
if (!tp)
- error (_("Thread group is empty"));
+ error (_ ("Thread group is empty"));
switch_to_thread (tp);
}
@@ -549,12 +543,12 @@ void
mi_cmd_thread_select (const char *command, char **argv, int argc)
{
if (argc != 1)
- error (_("-thread-select: USAGE: threadnum."));
+ error (_ ("-thread-select: USAGE: threadnum."));
int num = value_as_long (parse_and_eval (argv[0]));
thread_info *thr = find_thread_global_id (num);
if (thr == NULL)
- error (_("Thread ID %d not known."), num);
+ error (_ ("Thread ID %d not known."), num);
thread_select (argv[0], thr);
@@ -566,7 +560,7 @@ void
mi_cmd_thread_list_ids (const char *command, char **argv, int argc)
{
if (argc != 0)
- error (_("-thread-list-ids: No arguments required."));
+ error (_ ("-thread-list-ids: No arguments required."));
int num = 0;
int current_thread = -1;
@@ -595,7 +589,7 @@ void
mi_cmd_thread_info (const char *command, char **argv, int argc)
{
if (argc != 0 && argc != 1)
- error (_("Invalid MI command"));
+ error (_ ("Invalid MI command"));
print_thread_info (current_uiout, argv[0], -1);
}
@@ -684,7 +678,7 @@ output_cores (struct ui_out *uiout, const char *field_name, const char *xcores)
char *p = cores.get ();
char *saveptr;
- for (p = strtok_r (p, ",", &saveptr); p; p = strtok_r (NULL, ",", &saveptr))
+ for (p = strtok_r (p, ",", &saveptr); p; p = strtok_r (NULL, ",", &saveptr))
uiout->field_string (NULL, p);
}
@@ -775,22 +769,20 @@ mi_cmd_list_thread_groups (const char *command, char **argv, int argc)
enum opt
{
- AVAILABLE_OPT, RECURSE_OPT
+ AVAILABLE_OPT,
+ RECURSE_OPT
};
- static const struct mi_opt opts[] =
- {
- {"-available", AVAILABLE_OPT, 0},
- {"-recurse", RECURSE_OPT, 1},
- { 0, 0, 0 }
- };
+ static const struct mi_opt opts[] = { { "-available", AVAILABLE_OPT, 0 },
+ { "-recurse", RECURSE_OPT, 1 },
+ { 0, 0, 0 } };
int oind = 0;
char *oarg;
while (1)
{
- int opt = mi_getopt ("-list-thread-groups", argc, argv, opts,
- &oind, &oarg);
+ int opt
+ = mi_getopt ("-list-thread-groups", argc, argv, opts, &oind, &oarg);
if (opt < 0)
break;
@@ -805,8 +797,8 @@ mi_cmd_list_thread_groups (const char *command, char **argv, int argc)
else if (strcmp (oarg, "1") == 0)
recurse = 1;
else
- error (_("only '0' and '1' are valid values "
- "for the '--recurse' option"));
+ error (_ ("only '0' and '1' are valid values "
+ "for the '--recurse' option"));
break;
}
}
@@ -817,12 +809,12 @@ mi_cmd_list_thread_groups (const char *command, char **argv, int argc)
int inf;
if (*(argv[oind]) != 'i')
- error (_("invalid syntax of group id '%s'"), argv[oind]);
+ error (_ ("invalid syntax of group id '%s'"), argv[oind]);
inf = strtoul (argv[oind] + 1, &end, 0);
if (*end != '\0')
- error (_("invalid syntax of group id '%s'"), argv[oind]);
+ error (_ ("invalid syntax of group id '%s'"), argv[oind]);
ids.insert (inf);
}
@@ -837,7 +829,7 @@ mi_cmd_list_thread_groups (const char *command, char **argv, int argc)
struct inferior *inf = find_inferior_id (id);
if (!inf)
- error (_("Non-existent thread group id '%d'"), id);
+ error (_ ("Non-existent thread group id '%d'"), id);
print_thread_info (uiout, NULL, inf->pid);
}
@@ -874,16 +866,15 @@ mi_cmd_data_list_register_names (const char *command, char **argv, int argc)
ui_out_emit_list list_emitter (uiout, "register-names");
- if (argc == 0) /* No args, just do all the regs. */
+ if (argc == 0) /* No args, just do all the regs. */
{
- for (regnum = 0;
- regnum < numregs;
- regnum++)
+ for (regnum = 0; regnum < numregs; regnum++)
{
if (*(gdbarch_register_name (gdbarch, regnum)) == '\0')
uiout->field_string (NULL, "");
else
- uiout->field_string (NULL, gdbarch_register_name (gdbarch, regnum));
+ uiout->field_string (NULL,
+ gdbarch_register_name (gdbarch, regnum));
}
}
@@ -892,7 +883,7 @@ mi_cmd_data_list_register_names (const char *command, char **argv, int argc)
{
regnum = atoi (argv[i]);
if (regnum < 0 || regnum >= numregs)
- error (_("bad register number"));
+ error (_ ("bad register number"));
if (*(gdbarch_register_name (gdbarch, regnum)) == '\0')
uiout->field_string (NULL, "");
@@ -934,15 +925,12 @@ mi_cmd_data_list_changed_registers (const char *command, char **argv, int argc)
if (argc == 0)
{
/* No args, just do all the regs. */
- for (regnum = 0;
- regnum < numregs;
- regnum++)
+ for (regnum = 0; regnum < numregs; regnum++)
{
if (*(gdbarch_register_name (gdbarch, regnum)) == '\0')
continue;
- if (register_changed_p (regnum, prev_regs.get (),
- this_regs.get ()))
+ if (register_changed_p (regnum, prev_regs.get (), this_regs.get ()))
uiout->field_signed (NULL, regnum);
}
}
@@ -952,16 +940,14 @@ mi_cmd_data_list_changed_registers (const char *command, char **argv, int argc)
{
regnum = atoi (argv[i]);
- if (regnum >= 0
- && regnum < numregs
+ if (regnum >= 0 && regnum < numregs
&& *gdbarch_register_name (gdbarch, regnum) != '\000')
{
- if (register_changed_p (regnum, prev_regs.get (),
- this_regs.get ()))
+ if (register_changed_p (regnum, prev_regs.get (), this_regs.get ()))
uiout->field_signed (NULL, regnum);
}
else
- error (_("bad register number"));
+ error (_ ("bad register number"));
}
}
@@ -1010,15 +996,13 @@ mi_cmd_data_list_register_values (const char *command, char **argv, int argc)
int i;
int skip_unavailable = 0;
int oind = 0;
+
enum opt
{
SKIP_UNAVAILABLE,
};
- static const struct mi_opt opts[] =
- {
- {"-skip-unavailable", SKIP_UNAVAILABLE, 0},
- { 0, 0, 0 }
- };
+ static const struct mi_opt opts[]
+ = { { "-skip-unavailable", SKIP_UNAVAILABLE, 0 }, { 0, 0, 0 } };
/* Note that the test for a valid register must include checking the
gdbarch_register_name because gdbarch_num_regs may be allocated
@@ -1030,8 +1014,8 @@ mi_cmd_data_list_register_values (const char *command, char **argv, int argc)
while (1)
{
char *oarg;
- int opt = mi_getopt ("-data-list-register-values", argc, argv,
- opts, &oind, &oarg);
+ int opt = mi_getopt ("-data-list-register-values", argc, argv, opts,
+ &oind, &oarg);
if (opt < 0)
break;
@@ -1044,9 +1028,9 @@ mi_cmd_data_list_register_values (const char *command, char **argv, int argc)
}
if (argc - oind < 1)
- error (_("-data-list-register-values: Usage: "
- "-data-list-register-values [--skip-unavailable] <format>"
- " [<regnum1>...<regnumN>]"));
+ error (_ ("-data-list-register-values: Usage: "
+ "-data-list-register-values [--skip-unavailable] <format>"
+ " [<regnum1>...<regnumN>]"));
format = (int) argv[oind][0];
@@ -1059,9 +1043,7 @@ mi_cmd_data_list_register_values (const char *command, char **argv, int argc)
if (argc - oind == 1)
{
/* No args, beside the format: do all the regs. */
- for (regnum = 0;
- regnum < numregs;
- regnum++)
+ for (regnum = 0; regnum < numregs; regnum++)
{
if (*(gdbarch_register_name (gdbarch, regnum)) == '\0')
continue;
@@ -1075,12 +1057,11 @@ mi_cmd_data_list_register_values (const char *command, char **argv, int argc)
{
regnum = atoi (argv[i]);
- if (regnum >= 0
- && regnum < numregs
+ if (regnum >= 0 && regnum < numregs
&& *gdbarch_register_name (gdbarch, regnum) != '\000')
output_register (frame, regnum, format, skip_unavailable);
else
- error (_("bad register number"));
+ error (_ ("bad register number"));
}
}
@@ -1139,18 +1120,18 @@ mi_cmd_data_write_register_values (const char *command, char **argv, int argc)
numregs = gdbarch_num_cooked_regs (gdbarch);
if (argc == 0)
- error (_("-data-write-register-values: Usage: -data-write-register-"
- "values <format> [<regnum1> <value1>...<regnumN> <valueN>]"));
+ error (_ ("-data-write-register-values: Usage: -data-write-register-"
+ "values <format> [<regnum1> <value1>...<regnumN> <valueN>]"));
if (!target_has_registers ())
- error (_("-data-write-register-values: No registers."));
+ error (_ ("-data-write-register-values: No registers."));
if (!(argc - 1))
- error (_("-data-write-register-values: No regs and values specified."));
+ error (_ ("-data-write-register-values: No regs and values specified."));
if ((argc - 1) % 2)
- error (_("-data-write-register-values: "
- "Regs and vals are not in pairs."));
+ error (_ ("-data-write-register-values: "
+ "Regs and vals are not in pairs."));
for (i = 1; i < argc; i = i + 2)
{
@@ -1168,7 +1149,7 @@ mi_cmd_data_write_register_values (const char *command, char **argv, int argc)
regcache_cooked_write_signed (regcache, regnum, value);
}
else
- error (_("bad register number"));
+ error (_ ("bad register number"));
}
}
@@ -1184,8 +1165,8 @@ mi_cmd_data_evaluate_expression (const char *command, char **argv, int argc)
struct ui_out *uiout = current_uiout;
if (argc != 1)
- error (_("-data-evaluate-expression: "
- "Usage: -data-evaluate-expression expression"));
+ error (_ ("-data-evaluate-expression: "
+ "Usage: -data-evaluate-expression expression"));
expression_up expr = parse_expression (argv[0]);
@@ -1236,20 +1217,17 @@ mi_cmd_data_read_memory (const char *command, char **argv, int argc)
long offset = 0;
int oind = 0;
char *oarg;
+
enum opt
{
OFFSET_OPT
};
- static const struct mi_opt opts[] =
- {
- {"o", OFFSET_OPT, 1},
- { 0, 0, 0 }
- };
+ static const struct mi_opt opts[] = { { "o", OFFSET_OPT, 1 }, { 0, 0, 0 } };
while (1)
{
- int opt = mi_getopt ("-data-read-memory", argc, argv, opts,
- &oind, &oarg);
+ int opt
+ = mi_getopt ("-data-read-memory", argc, argv, opts, &oind, &oarg);
if (opt < 0)
break;
@@ -1264,8 +1242,8 @@ mi_cmd_data_read_memory (const char *command, char **argv, int argc)
argc -= oind;
if (argc < 5 || argc > 6)
- error (_("-data-read-memory: Usage: "
- "ADDR WORD-FORMAT WORD-SIZE NR-ROWS NR-COLS [ASCHAR]."));
+ error (_ ("-data-read-memory: Usage: "
+ "ADDR WORD-FORMAT WORD-SIZE NR-ROWS NR-COLS [ASCHAR]."));
/* Extract all the arguments. */
@@ -1301,12 +1279,12 @@ mi_cmd_data_read_memory (const char *command, char **argv, int argc)
/* The number of rows. */
nr_rows = atol (argv[3]);
if (nr_rows <= 0)
- error (_("-data-read-memory: invalid number of rows."));
+ error (_ ("-data-read-memory: invalid number of rows."));
/* Number of bytes per row. */
nr_cols = atol (argv[4]);
if (nr_cols <= 0)
- error (_("-data-read-memory: invalid number of columns."));
+ error (_ ("-data-read-memory: invalid number of columns."));
/* The un-printable character when printing ascii. */
if (argc == 6)
@@ -1319,11 +1297,11 @@ mi_cmd_data_read_memory (const char *command, char **argv, int argc)
gdb::byte_vector mbuf (total_bytes);
- nr_bytes = target_read (current_inferior ()->top_target (),
- TARGET_OBJECT_MEMORY, NULL,
- mbuf.data (), addr, total_bytes);
+ nr_bytes
+ = target_read (current_inferior ()->top_target (), TARGET_OBJECT_MEMORY,
+ NULL, mbuf.data (), addr, total_bytes);
if (nr_bytes <= 0)
- error (_("Unable to read memory."));
+ error (_ ("Unable to read memory."));
/* Output the header information. */
uiout->field_core_addr ("addr", gdbarch, addr);
@@ -1342,8 +1320,7 @@ mi_cmd_data_read_memory (const char *command, char **argv, int argc)
string_file stream;
ui_out_emit_list list_emitter (uiout, "memory");
- for (row = 0, row_byte = 0;
- row < nr_rows;
+ for (row = 0, row_byte = 0; row < nr_rows;
row++, row_byte += nr_cols * word_size)
{
int col;
@@ -1357,8 +1334,7 @@ mi_cmd_data_read_memory (const char *command, char **argv, int argc)
{
ui_out_emit_list list_data_emitter (uiout, "data");
get_formatted_print_options (&print_opts, word_format);
- for (col = 0, col_byte = row_byte;
- col < nr_cols;
+ for (col = 0, col_byte = row_byte; col < nr_cols;
col++, col_byte += word_size)
{
if (col_byte + word_size > nr_bytes)
@@ -1380,8 +1356,8 @@ mi_cmd_data_read_memory (const char *command, char **argv, int argc)
int byte;
stream.clear ();
- for (byte = row_byte;
- byte < row_byte + word_size * nr_cols; byte++)
+ for (byte = row_byte; byte < row_byte + word_size * nr_cols;
+ byte++)
{
if (byte >= nr_bytes)
stream.putc ('X');
@@ -1407,20 +1383,17 @@ mi_cmd_data_read_memory_bytes (const char *command, char **argv, int argc)
int unit_size = gdbarch_addressable_memory_unit_size (gdbarch);
int oind = 0;
char *oarg;
+
enum opt
{
OFFSET_OPT
};
- static const struct mi_opt opts[] =
- {
- {"o", OFFSET_OPT, 1},
- { 0, 0, 0 }
- };
+ static const struct mi_opt opts[] = { { "o", OFFSET_OPT, 1 }, { 0, 0, 0 } };
while (1)
{
- int opt = mi_getopt ("-data-read-memory-bytes", argc, argv, opts,
- &oind, &oarg);
+ int opt = mi_getopt ("-data-read-memory-bytes", argc, argv, opts, &oind,
+ &oarg);
if (opt < 0)
break;
switch ((enum opt) opt)
@@ -1434,7 +1407,7 @@ mi_cmd_data_read_memory_bytes (const char *command, char **argv, int argc)
argc -= oind;
if (argc != 2)
- error (_("Usage: [ -o OFFSET ] ADDR LENGTH."));
+ error (_ ("Usage: [ -o OFFSET ] ADDR LENGTH."));
addr = parse_and_eval_address (argv[0]) + offset;
length = atol (argv[1]);
@@ -1443,7 +1416,7 @@ mi_cmd_data_read_memory_bytes (const char *command, char **argv, int argc)
= read_memory_robust (current_inferior ()->top_target (), addr, length);
if (result.size () == 0)
- error (_("Unable to read memory."));
+ error (_ ("Unable to read memory."));
ui_out_emit_list list_emitter (uiout, "memory");
for (const memory_read_result &read_result : result)
@@ -1454,9 +1427,9 @@ mi_cmd_data_read_memory_bytes (const char *command, char **argv, int argc)
uiout->field_core_addr ("offset", gdbarch, read_result.begin - addr);
uiout->field_core_addr ("end", gdbarch, read_result.end);
- std::string data = bin2hex (read_result.data.get (),
- (read_result.end - read_result.begin)
- * unit_size);
+ std::string data
+ = bin2hex (read_result.data.get (),
+ (read_result.end - read_result.begin) * unit_size);
uiout->field_string ("contents", data);
}
}
@@ -1491,20 +1464,17 @@ mi_cmd_data_write_memory (const char *command, char **argv, int argc)
long offset = 0;
int oind = 0;
char *oarg;
+
enum opt
{
OFFSET_OPT
};
- static const struct mi_opt opts[] =
- {
- {"o", OFFSET_OPT, 1},
- { 0, 0, 0 }
- };
+ static const struct mi_opt opts[] = { { "o", OFFSET_OPT, 1 }, { 0, 0, 0 } };
while (1)
{
- int opt = mi_getopt ("-data-write-memory", argc, argv, opts,
- &oind, &oarg);
+ int opt
+ = mi_getopt ("-data-write-memory", argc, argv, opts, &oind, &oarg);
if (opt < 0)
break;
@@ -1519,8 +1489,8 @@ mi_cmd_data_write_memory (const char *command, char **argv, int argc)
argc -= oind;
if (argc != 4)
- error (_("-data-write-memory: Usage: "
- "[-o COLUMN_OFFSET] ADDR FORMAT WORD-SIZE VALUE."));
+ error (_ ("-data-write-memory: Usage: "
+ "[-o COLUMN_OFFSET] ADDR FORMAT WORD-SIZE VALUE."));
/* Extract all the arguments. */
/* Start address of the memory dump. */
@@ -1556,7 +1526,7 @@ mi_cmd_data_write_memory_bytes (const char *command, char **argv, int argc)
int unit_size;
if (argc != 2 && argc != 3)
- error (_("Usage: ADDR DATA [COUNT]."));
+ error (_ ("Usage: ADDR DATA [COUNT]."));
addr = parse_and_eval_address (argv[0]);
cdata = argv[1];
@@ -1564,8 +1534,8 @@ mi_cmd_data_write_memory_bytes (const char *command, char **argv, int argc)
unit_size = gdbarch_addressable_memory_unit_size (get_current_arch ());
if (len_hex % (unit_size * 2) != 0)
- error (_("Hex-encoded '%s' must represent an integral number of "
- "addressable memory units."),
+ error (_ ("Hex-encoded '%s' must represent an integral number of "
+ "addressable memory units."),
cdata);
len_bytes = len_hex / 2;
@@ -1582,7 +1552,7 @@ mi_cmd_data_write_memory_bytes (const char *command, char **argv, int argc)
{
int x;
if (sscanf (cdata + i * 2, "%02x", &x) != 1)
- error (_("Invalid argument"));
+ error (_ ("Invalid argument"));
databuf[i] = (gdb_byte) x;
}
@@ -1633,8 +1603,8 @@ mi_cmd_enable_timings (const char *command, char **argv, int argc)
return;
- usage_error:
- error (_("-enable-timings: Usage: %s {yes|no}"), command);
+usage_error:
+ error (_ ("-enable-timings: Usage: %s {yes|no}"), command);
}
void
@@ -1663,7 +1633,7 @@ mi_cmd_list_features (const char *command, char **argv, int argc)
return;
}
- error (_("-list-features should be passed no arguments"));
+ error (_ ("-list-features should be passed no arguments"));
}
void
@@ -1681,7 +1651,7 @@ mi_cmd_list_target_features (const char *command, char **argv, int argc)
return;
}
- error (_("-list-target-features should be passed no arguments"));
+ error (_ ("-list-target-features should be passed no arguments"));
}
void
@@ -1691,14 +1661,13 @@ mi_cmd_add_inferior (const char *command, char **argv, int argc)
/* Parse the command options. */
enum opt
- {
- NO_CONNECTION_OPT,
- };
- static const struct mi_opt opts[] =
- {
- {"-no-connection", NO_CONNECTION_OPT, 0},
- {NULL, 0, 0},
- };
+ {
+ NO_CONNECTION_OPT,
+ };
+ static const struct mi_opt opts[] = {
+ { "-no-connection", NO_CONNECTION_OPT, 0 },
+ { NULL, 0, 0 },
+ };
int oind = 0;
char *oarg;
@@ -1721,8 +1690,7 @@ mi_cmd_add_inferior (const char *command, char **argv, int argc)
inferior *inf = add_inferior_with_spaces ();
- switch_to_inferior_and_push_target (inf, no_connection,
- current_inferior ());
+ switch_to_inferior_and_push_target (inf, no_connection, current_inferior ());
current_uiout->field_fmt ("inferior", "i%d", inf->num);
@@ -1743,17 +1711,17 @@ mi_cmd_remove_inferior (const char *command, char **argv, int argc)
struct inferior *inf_to_remove;
if (argc != 1)
- error (_("-remove-inferior should be passed a single argument"));
+ error (_ ("-remove-inferior should be passed a single argument"));
if (sscanf (argv[0], "i%d", &id) != 1)
- error (_("the thread group id is syntactically invalid"));
+ error (_ ("the thread group id is syntactically invalid"));
inf_to_remove = find_inferior_id (id);
if (inf_to_remove == NULL)
- error (_("the specified thread group does not exist"));
+ error (_ ("the specified thread group does not exist"));
if (inf_to_remove->pid != 0)
- error (_("cannot remove an active inferior"));
+ error (_ ("cannot remove an active inferior"));
if (inf_to_remove == current_inferior ())
{
@@ -1767,7 +1735,7 @@ mi_cmd_remove_inferior (const char *command, char **argv, int argc)
}
if (new_inferior == NULL)
- error (_("Cannot remove last inferior"));
+ error (_ ("Cannot remove last inferior"));
set_current_inferior (new_inferior);
if (new_inferior->pid != 0)
@@ -1782,8 +1750,6 @@ mi_cmd_remove_inferior (const char *command, char **argv, int argc)
delete_inferior (inf_to_remove);
}
-
-
/* Execute a command within a safe environment.
Return <0 for error; >=0 for ok.
@@ -1799,8 +1765,8 @@ captured_mi_execute_command (struct ui_out *uiout, struct mi_parse *context)
if (do_timings)
current_command_ts = context->cmd_start;
- scoped_restore save_token = make_scoped_restore (&current_token,
- context->token);
+ scoped_restore save_token
+ = make_scoped_restore (&current_token, context->token);
running_result_record_printed = 0;
mi_proceeded = 0;
@@ -1809,8 +1775,7 @@ captured_mi_execute_command (struct ui_out *uiout, struct mi_parse *context)
case MI_COMMAND:
/* A MI command was read from the input stream. */
if (mi_debug_p)
- gdb_printf (gdb_stdlog,
- " token=`%s' command=`%s' args=`%s'\n",
+ gdb_printf (gdb_stdlog, " token=`%s' command=`%s' args=`%s'\n",
context->token, context->command, context->args);
mi_cmd_execute (context);
@@ -1827,7 +1792,9 @@ captured_mi_execute_command (struct ui_out *uiout, struct mi_parse *context)
/* There's no particularly good reason why target-connect results
in not ^done. Should kill ^connected for MI3. */
gdb_puts (strcmp (context->command, "target-select") == 0
- ? "^connected" : "^done", mi->raw_stdout);
+ ? "^connected"
+ : "^done",
+ mi->raw_stdout);
mi_out_put (uiout, mi->raw_stdout);
mi_out_rewind (uiout);
mi_print_timing_maybe (mi->raw_stdout);
@@ -1894,9 +1861,9 @@ mi_print_exception (const char *token, const struct gdb_exception &exception)
switch (exception.error)
{
- case UNDEFINED_COMMAND_ERROR:
- gdb_puts (",code=\"undefined-command\"", mi->raw_stdout);
- break;
+ case UNDEFINED_COMMAND_ERROR:
+ gdb_puts (",code=\"undefined-command\"", mi->raw_stdout);
+ break;
}
gdb_puts ("\n", mi->raw_stdout);
@@ -1955,7 +1922,6 @@ mi_execute_command (const char *cmd, int from_tty)
}
bpstat_do_actions ();
-
}
}
@@ -1995,14 +1961,15 @@ struct user_selected_context
null_frame_id. As comparing null_frame_id with itself always
reports not-equal, we only do the equality test if we have something
other than the innermost frame selected. */
- if (current_frame_level != -1
- && current_frame_id != m_previous_frame_id)
+ if (current_frame_level != -1 && current_frame_id != m_previous_frame_id)
return true;
/* Nothing changed! */
return false;
}
+
private:
+
/* The previously selected thread. This might be null_ptid if there was
no previously selected thread. */
ptid_t m_previous_ptid;
@@ -2020,16 +1987,16 @@ mi_cmd_execute (struct mi_parse *parse)
scoped_value_mark cleanup = prepare_execute_command ();
if (parse->all && parse->thread_group != -1)
- error (_("Cannot specify --thread-group together with --all"));
+ error (_ ("Cannot specify --thread-group together with --all"));
if (parse->all && parse->thread != -1)
- error (_("Cannot specify --thread together with --all"));
+ error (_ ("Cannot specify --thread together with --all"));
if (parse->thread_group != -1 && parse->thread != -1)
- error (_("Cannot specify --thread together with --thread-group"));
+ error (_ ("Cannot specify --thread together with --thread-group"));
if (parse->frame != -1 && parse->thread == -1)
- error (_("Cannot specify --frame without --thread"));
+ error (_ ("Cannot specify --frame without --thread"));
if (parse->thread_group != -1)
{
@@ -2037,7 +2004,7 @@ mi_cmd_execute (struct mi_parse *parse)
struct thread_info *tp = 0;
if (!inf)
- error (_("Invalid thread group for the --thread-group option"));
+ error (_ ("Invalid thread group for the --thread-group option"));
set_current_inferior (inf);
/* This behaviour means that if --thread-group option identifies
@@ -2062,10 +2029,10 @@ mi_cmd_execute (struct mi_parse *parse)
thread_info *tp = find_thread_global_id (parse->thread);
if (tp == NULL)
- error (_("Invalid thread id: %d"), parse->thread);
+ error (_ ("Invalid thread id: %d"), parse->thread);
if (tp->state == THREAD_EXITED)
- error (_("Thread id: %d has terminated"), parse->thread);
+ error (_ ("Thread id: %d has terminated"), parse->thread);
if (parse->cmd->preserve_user_selected_context ())
thread_saver.emplace ();
@@ -2088,7 +2055,7 @@ mi_cmd_execute (struct mi_parse *parse)
select_frame (fid);
}
else
- error (_("Invalid frame id: %d"), frame);
+ error (_ ("Invalid frame id: %d"), frame);
}
gdb::optional<scoped_restore_current_language> lang_saver;
@@ -2109,8 +2076,8 @@ mi_cmd_execute (struct mi_parse *parse)
if (!parse->cmd->preserve_user_selected_context ()
&& current_user_selected_context.has_changed ())
- gdb::observers::user_selected_context_changed.notify
- (USER_SELECTED_THREAD | USER_SELECTED_FRAME);
+ gdb::observers::user_selected_context_changed.notify (
+ USER_SELECTED_THREAD | USER_SELECTED_FRAME);
}
/* See mi-main.h. */
@@ -2128,10 +2095,9 @@ mi_execute_cli_command (const char *cmd, bool args_p, const char *args)
gdb_assert (args == nullptr);
if (mi_debug_p)
- gdb_printf (gdb_stdlog, "cli=%s run=%s\n",
- cmd, run.c_str ());
+ gdb_printf (gdb_stdlog, "cli=%s run=%s\n", cmd, run.c_str ());
- execute_command (run.c_str (), 0 /* from_tty */ );
+ execute_command (run.c_str (), 0 /* from_tty */);
}
}
@@ -2145,14 +2111,12 @@ mi_execute_async_cli_command (const char *cli_command, char **argv, int argc)
if (mi_async_p ())
run += "&";
- execute_command (run.c_str (), 0 /* from_tty */ );
+ execute_command (run.c_str (), 0 /* from_tty */);
}
void
-mi_load_progress (const char *section_name,
- unsigned long sent_so_far,
- unsigned long total_section,
- unsigned long total_sent,
+mi_load_progress (const char *section_name, unsigned long sent_so_far,
+ unsigned long total_section, unsigned long total_sent,
unsigned long grand_total)
{
using namespace std::chrono;
@@ -2172,8 +2136,8 @@ mi_load_progress (const char *section_name,
scoped_restore save_uiout
= make_scoped_restore (&current_uiout, uiout.get ());
- new_section = (previous_sect_name ?
- strcmp (previous_sect_name, section_name) : 1);
+ new_section
+ = (previous_sect_name ? strcmp (previous_sect_name, section_name) : 1);
if (new_section)
{
xfree (previous_sect_name);
@@ -2251,10 +2215,9 @@ print_diff (struct ui_file *file, struct mi_timestamp *start,
duration<double> utime = end->utime - start->utime;
duration<double> stime = end->stime - start->stime;
- gdb_printf
- (file,
- ",time={wallclock=\"%0.5f\",user=\"%0.5f\",system=\"%0.5f\"}",
- wallclock.count (), utime.count (), stime.count ());
+ gdb_printf (file,
+ ",time={wallclock=\"%0.5f\",user=\"%0.5f\",system=\"%0.5f\"}",
+ wallclock.count (), utime.count (), stime.count ());
}
void
@@ -2265,11 +2228,11 @@ mi_cmd_trace_define_variable (const char *command, char **argv, int argc)
char *name = 0;
if (argc != 1 && argc != 2)
- error (_("Usage: -trace-define-variable VARIABLE [VALUE]"));
+ error (_ ("Usage: -trace-define-variable VARIABLE [VALUE]"));
name = argv[0];
if (*name++ != '$')
- error (_("Name of trace variable should start with '$'"));
+ error (_ ("Name of trace variable should start with '$'"));
validate_trace_state_variable_name (name);
@@ -2287,7 +2250,7 @@ void
mi_cmd_trace_list_variables (const char *command, char **argv, int argc)
{
if (argc != 0)
- error (_("-trace-list-variables: no arguments allowed"));
+ error (_ ("-trace-list-variables: no arguments allowed"));
tvariables_info_1 ();
}
@@ -2298,7 +2261,7 @@ mi_cmd_trace_find (const char *command, char **argv, int argc)
char *mode;
if (argc == 0)
- error (_("trace selection mode is required"));
+ error (_ ("trace selection mode is required"));
mode = argv[0];
@@ -2313,56 +2276,55 @@ mi_cmd_trace_find (const char *command, char **argv, int argc)
if (strcmp (mode, "frame-number") == 0)
{
if (argc != 2)
- error (_("frame number is required"));
+ error (_ ("frame number is required"));
tfind_1 (tfind_number, atoi (argv[1]), 0, 0, 0);
}
else if (strcmp (mode, "tracepoint-number") == 0)
{
if (argc != 2)
- error (_("tracepoint number is required"));
+ error (_ ("tracepoint number is required"));
tfind_1 (tfind_tp, atoi (argv[1]), 0, 0, 0);
}
else if (strcmp (mode, "pc") == 0)
{
if (argc != 2)
- error (_("PC is required"));
+ error (_ ("PC is required"));
tfind_1 (tfind_pc, 0, parse_and_eval_address (argv[1]), 0, 0);
}
else if (strcmp (mode, "pc-inside-range") == 0)
{
if (argc != 3)
- error (_("Start and end PC are required"));
+ error (_ ("Start and end PC are required"));
tfind_1 (tfind_range, 0, parse_and_eval_address (argv[1]),
parse_and_eval_address (argv[2]), 0);
}
else if (strcmp (mode, "pc-outside-range") == 0)
{
if (argc != 3)
- error (_("Start and end PC are required"));
+ error (_ ("Start and end PC are required"));
tfind_1 (tfind_outside, 0, parse_and_eval_address (argv[1]),
parse_and_eval_address (argv[2]), 0);
}
else if (strcmp (mode, "line") == 0)
{
if (argc != 2)
- error (_("Line is required"));
+ error (_ ("Line is required"));
std::vector<symtab_and_line> sals
- = decode_line_with_current_source (argv[1],
- DECODE_LINE_FUNFIRSTLINE);
+ = decode_line_with_current_source (argv[1], DECODE_LINE_FUNFIRSTLINE);
const symtab_and_line &sal = sals[0];
if (sal.symtab == 0)
- error (_("Could not find the specified line"));
+ error (_ ("Could not find the specified line"));
CORE_ADDR start_pc, end_pc;
if (sal.line > 0 && find_line_pc_range (sal, &start_pc, &end_pc))
tfind_1 (tfind_range, 0, start_pc, end_pc - 1, 0);
else
- error (_("Could not find the specified line"));
+ error (_ ("Could not find the specified line"));
}
else
- error (_("Invalid mode '%s'"), mode);
+ error (_ ("Invalid mode '%s'"), mode);
if (has_stack_frames () || get_traceframe_number () >= 0)
print_stack_frame (get_selected_frame (NULL), 1, LOC_AND_ADDRESS, 1);
@@ -2379,19 +2341,15 @@ mi_cmd_trace_save (const char *command, char **argv, int argc)
enum opt
{
- TARGET_SAVE_OPT, CTF_OPT
+ TARGET_SAVE_OPT,
+ CTF_OPT
};
- static const struct mi_opt opts[] =
- {
- {"r", TARGET_SAVE_OPT, 0},
- {"ctf", CTF_OPT, 0},
- { 0, 0, 0 }
- };
+ static const struct mi_opt opts[]
+ = { { "r", TARGET_SAVE_OPT, 0 }, { "ctf", CTF_OPT, 0 }, { 0, 0, 0 } };
while (1)
{
- int opt = mi_getopt ("-trace-save", argc, argv, opts,
- &oind, &oarg);
+ int opt = mi_getopt ("-trace-save", argc, argv, opts, &oind, &oarg);
if (opt < 0)
break;
@@ -2407,8 +2365,8 @@ mi_cmd_trace_save (const char *command, char **argv, int argc)
}
if (argc - oind != 1)
- error (_("Exactly one argument required "
- "(file in which to save trace data)"));
+ error (_ ("Exactly one argument required "
+ "(file in which to save trace data)"));
filename = argv[oind];
@@ -2443,7 +2401,7 @@ void
mi_cmd_ada_task_info (const char *command, char **argv, int argc)
{
if (argc != 0 && argc != 1)
- error (_("Invalid MI command"));
+ error (_ ("Invalid MI command"));
print_ada_task_info (current_uiout, argv[0], current_inferior ());
}
@@ -2477,8 +2435,7 @@ print_variable_or_computed (const char *expression, enum print_values values)
type = check_typedef (value_type (val));
type_print (value_type (val), "", &stb, -1);
uiout->field_stream ("type", stb);
- if (type->code () != TYPE_CODE_ARRAY
- && type->code () != TYPE_CODE_STRUCT
+ if (type->code () != TYPE_CODE_ARRAY && type->code () != TYPE_CODE_STRUCT
&& type->code () != TYPE_CODE_UNION)
{
struct value_print_options opts;
@@ -2518,6 +2475,7 @@ mi_cmd_trace_frame_collected (const char *command, char **argv, int argc)
int registers_format = 'x';
int memory_contents = 0;
struct ui_out *uiout = current_uiout;
+
enum opt
{
VAR_PRINT_VALUES,
@@ -2525,20 +2483,18 @@ mi_cmd_trace_frame_collected (const char *command, char **argv, int argc)
REGISTERS_FORMAT,
MEMORY_CONTENTS,
};
- static const struct mi_opt opts[] =
- {
- {"-var-print-values", VAR_PRINT_VALUES, 1},
- {"-comp-print-values", COMP_PRINT_VALUES, 1},
- {"-registers-format", REGISTERS_FORMAT, 1},
- {"-memory-contents", MEMORY_CONTENTS, 0},
- { 0, 0, 0 }
- };
+ static const struct mi_opt opts[]
+ = { { "-var-print-values", VAR_PRINT_VALUES, 1 },
+ { "-comp-print-values", COMP_PRINT_VALUES, 1 },
+ { "-registers-format", REGISTERS_FORMAT, 1 },
+ { "-memory-contents", MEMORY_CONTENTS, 0 },
+ { 0, 0, 0 } };
while (1)
{
char *oarg;
- int opt = mi_getopt ("-trace-frame-collected", argc, argv, opts,
- &oind, &oarg);
+ int opt
+ = mi_getopt ("-trace-frame-collected", argc, argv, opts, &oind, &oarg);
if (opt < 0)
break;
switch ((enum opt) opt)
@@ -2559,11 +2515,11 @@ mi_cmd_trace_frame_collected (const char *command, char **argv, int argc)
}
if (oind != argc)
- error (_("Usage: -trace-frame-collected "
- "[--var-print-values PRINT_VALUES] "
- "[--comp-print-values PRINT_VALUES] "
- "[--registers-format FORMAT]"
- "[--memory-contents]"));
+ error (_ ("Usage: -trace-frame-collected "
+ "[--var-print-values PRINT_VALUES] "
+ "[--comp-print-values PRINT_VALUES] "
+ "[--registers-format FORMAT]"
+ "[--memory-contents]"));
/* This throws an error is not inspecting a trace frame. */
tloc = get_traceframe_location (&stepping_frame);
@@ -2647,8 +2603,9 @@ mi_cmd_trace_frame_collected (const char *command, char **argv, int argc)
{
uiout->field_fmt ("name", "$%s", tsv->name.c_str ());
- tsv->value_known = target_get_trace_state_variable_value (tsv->number,
- &tsv->value);
+ tsv->value_known
+ = target_get_trace_state_variable_value (tsv->number,
+ &tsv->value);
uiout->field_signed ("current", tsv->value);
}
else
@@ -2704,7 +2661,8 @@ mi_cmd_fix_multi_location_breakpoint_output (const char *command, char **argv,
/* See mi/mi-main.h. */
void
-mi_cmd_fix_breakpoint_script_output (const char *command, char **argv, int argc)
+mi_cmd_fix_breakpoint_script_output (const char *command, char **argv,
+ int argc)
{
fix_breakpoint_script_output_globally = true;
}
@@ -2715,10 +2673,10 @@ void
mi_cmd_complete (const char *command, char **argv, int argc)
{
if (argc != 1)
- error (_("Usage: -complete COMMAND"));
+ error (_ ("Usage: -complete COMMAND"));
if (max_completions == 0)
- error (_("max-completions is zero, completion is disabled."));
+ error (_ ("max-completions is zero, completion is disabled."));
int quote_char = '\0';
const char *word;
@@ -2730,22 +2688,22 @@ mi_cmd_complete (const char *command, char **argv, int argc)
struct ui_out *uiout = current_uiout;
if (result.number_matches > 0)
- uiout->field_fmt ("completion", "%s%s",
- arg_prefix.c_str (),result.match_list[0]);
+ uiout->field_fmt ("completion", "%s%s", arg_prefix.c_str (),
+ result.match_list[0]);
{
ui_out_emit_list completions_emitter (uiout, "matches");
if (result.number_matches == 1)
- uiout->field_fmt (NULL, "%s%s",
- arg_prefix.c_str (), result.match_list[0]);
+ uiout->field_fmt (NULL, "%s%s", arg_prefix.c_str (),
+ result.match_list[0]);
else
{
result.sort_match_list ();
for (size_t i = 0; i < result.number_matches; i++)
{
- uiout->field_fmt (NULL, "%s%s",
- arg_prefix.c_str (), result.match_list[i + 1]);
+ uiout->field_fmt (NULL, "%s%s", arg_prefix.c_str (),
+ result.match_list[i + 1]);
}
}
}
@@ -2753,24 +2711,25 @@ mi_cmd_complete (const char *command, char **argv, int argc)
result.number_matches == max_completions ? "1" : "0");
}
-
void _initialize_mi_main ();
+
void
_initialize_mi_main ()
{
set_show_commands mi_async_cmds
- = add_setshow_boolean_cmd ("mi-async", class_run,
- &mi_async_1, _("\
-Set whether MI asynchronous mode is enabled."), _("\
-Show whether MI asynchronous mode is enabled."), _("\
+ = add_setshow_boolean_cmd ("mi-async", class_run, &mi_async_1, _ ("\
+Set whether MI asynchronous mode is enabled."),
+ _ ("\
+Show whether MI asynchronous mode is enabled."),
+ _ ("\
Tells GDB whether MI should be in asynchronous mode."),
- set_mi_async_command,
- show_mi_async_command,
+ set_mi_async_command, show_mi_async_command,
&setlist, &showlist);
/* Alias old "target-async" to "mi-async". */
cmd_list_element *set_target_async_cmd
- = add_alias_cmd ("target-async", mi_async_cmds.set, class_run, 0, &setlist);
+ = add_alias_cmd ("target-async", mi_async_cmds.set, class_run, 0,
+ &setlist);
deprecate_cmd (set_target_async_cmd, "set mi-async");
cmd_list_element *show_target_async_cmd
diff --git a/gdb/mi/mi-main.h b/gdb/mi/mi-main.h
index ff1d4ed84bc..b8dd4480d77 100644
--- a/gdb/mi/mi-main.h
+++ b/gdb/mi/mi-main.h
@@ -69,7 +69,8 @@ extern void mi_execute_cli_command (const char *cmd, bool args_p,
/* Implementation of -fix-multi-location-breakpoint-output. */
extern void mi_cmd_fix_multi_location_breakpoint_output (const char *command,
- char **argv, int argc);
+ char **argv,
+ int argc);
/* Implementation of -fix-breakpoint-script-output. */
diff --git a/gdb/mi/mi-out.c b/gdb/mi/mi-out.c
index 5ce24a30999..3bc780cff29 100644
--- a/gdb/mi/mi-out.c
+++ b/gdb/mi/mi-out.c
@@ -32,8 +32,7 @@
/* Mark beginning of a table. */
void
-mi_ui_out::do_table_begin (int nr_cols, int nr_rows,
- const char *tblid)
+mi_ui_out::do_table_begin (int nr_cols, int nr_rows, const char *tblid)
{
open (tblid, ui_out_type_tuple);
do_field_signed (-1, -1, ui_left, "nr_rows", nr_rows);
@@ -167,8 +166,8 @@ mi_ui_out::do_text (const char *string)
}
void
-mi_ui_out::do_message (const ui_file_style &style,
- const char *format, va_list args)
+mi_ui_out::do_message (const ui_file_style &style, const char *format,
+ va_list args)
{
}
@@ -181,7 +180,6 @@ mi_ui_out::do_wrap_hint (int indent)
void
mi_ui_out::do_flush ()
{
-
gdb_flush (m_streams.back ());
}
@@ -225,7 +223,7 @@ mi_ui_out::open (const char *name, ui_out_type type)
break;
default:
- internal_error (_("bad switch"));
+ internal_error (_ ("bad switch"));
}
}
@@ -245,7 +243,7 @@ mi_ui_out::close (ui_out_type type)
break;
default:
- internal_error (_("bad switch"));
+ internal_error (_ ("bad switch"));
}
m_suppress_field_separator = false;
@@ -321,25 +319,23 @@ mi_ui_out::version ()
/* Constructor for an `mi_out_data' object. */
mi_ui_out::mi_ui_out (int mi_version)
-: ui_out (make_flags (mi_version)),
- m_suppress_field_separator (false),
- m_suppress_output (false),
- m_mi_version (mi_version)
+ : ui_out (make_flags (mi_version)),
+ m_suppress_field_separator (false),
+ m_suppress_output (false),
+ m_mi_version (mi_version)
{
string_file *stream = new string_file ();
m_streams.push_back (stream);
}
-mi_ui_out::~mi_ui_out ()
-{
-}
+mi_ui_out::~mi_ui_out () {}
/* See mi/mi-out.h. */
mi_ui_out *
mi_out_new (const char *mi_version)
{
- if (streq (mi_version, INTERP_MI4) || streq (mi_version, INTERP_MI))
+ if (streq (mi_version, INTERP_MI4) || streq (mi_version, INTERP_MI))
return new mi_ui_out (4);
if (streq (mi_version, INTERP_MI3))
diff --git a/gdb/mi/mi-out.h b/gdb/mi/mi-out.h
index b63492f459c..c60ee582b24 100644
--- a/gdb/mi/mi-out.h
+++ b/gdb/mi/mi-out.h
@@ -25,7 +25,6 @@
struct ui_out;
struct ui_file;
-
class mi_ui_out : public ui_out
{
public:
@@ -40,19 +39,16 @@ public:
/* Return the version number of the current MI. */
int version ();
- bool can_emit_style_escape () const override
- {
- return false;
- }
+ bool can_emit_style_escape () const override { return false; }
protected:
- virtual void do_table_begin (int nbrofcols, int nr_rows, const char *tblid)
- override;
+ virtual void do_table_begin (int nbrofcols, int nr_rows,
+ const char *tblid) override;
virtual void do_table_body () override;
virtual void do_table_header (int width, ui_align align,
- const std::string &col_name,
- const std::string &col_hdr) override;
+ const std::string &col_name,
+ const std::string &col_hdr) override;
virtual void do_table_end () override;
virtual void do_begin (ui_out_type type, const char *id) override;
@@ -60,32 +56,30 @@ protected:
virtual void do_field_signed (int fldno, int width, ui_align align,
const char *fldname, LONGEST value) override;
virtual void do_field_unsigned (int fldno, int width, ui_align align,
- const char *fldname, ULONGEST value)
- override;
+ const char *fldname,
+ ULONGEST value) override;
virtual void do_field_skip (int fldno, int width, ui_align align,
- const char *fldname) override;
+ const char *fldname) override;
virtual void do_field_string (int fldno, int width, ui_align align,
const char *fldname, const char *string,
const ui_file_style &style) override;
virtual void do_field_fmt (int fldno, int width, ui_align align,
const char *fldname, const ui_file_style &style,
- const char *format, va_list args)
- override ATTRIBUTE_PRINTF (7,0);
+ const char *format, va_list args) override
+ ATTRIBUTE_PRINTF (7, 0);
virtual void do_spaces (int numspaces) override;
virtual void do_text (const char *string) override;
- virtual void do_message (const ui_file_style &style,
- const char *format, va_list args) override
- ATTRIBUTE_PRINTF (3,0);
+ virtual void do_message (const ui_file_style &style, const char *format,
+ va_list args) override ATTRIBUTE_PRINTF (3, 0);
virtual void do_wrap_hint (int indent) override;
virtual void do_flush () override;
virtual void do_redirect (struct ui_file *outstream) override;
- virtual bool do_is_mi_like_p () const override
- { return true; }
+ virtual bool do_is_mi_like_p () const override { return true; }
virtual void do_progress_start () override;
- virtual void do_progress_notify (const std::string &, const char *,
- double, double) override;
+ virtual void do_progress_notify (const std::string &, const char *, double,
+ double) override;
virtual void do_progress_end () override;
@@ -103,7 +97,8 @@ private:
mi_progress_info ()
: state (progress_update::START)
- {}
+ {
+ }
};
/* Stack of progress info. */
diff --git a/gdb/mi/mi-parse.c b/gdb/mi/mi-parse.c
index e334968cc88..97af3e23a46 100644
--- a/gdb/mi/mi-parse.c
+++ b/gdb/mi/mi-parse.c
@@ -42,40 +42,40 @@ mi_parse_escape (const char **string_ptr)
switch (c)
{
- case '\n':
- return -2;
- case 0:
- (*string_ptr)--;
- return 0;
-
- case '0':
- case '1':
- case '2':
- case '3':
- case '4':
- case '5':
- case '6':
- case '7':
- {
- int i = fromhex (c);
- int count = 0;
-
- while (++count < 3)
- {
- c = (**string_ptr);
- if (isdigit (c) && c != '8' && c != '9')
- {
- (*string_ptr)++;
- i *= 8;
- i += fromhex (c);
- }
- else
- {
- break;
- }
- }
- return i;
- }
+ case '\n':
+ return -2;
+ case 0:
+ (*string_ptr)--;
+ return 0;
+
+ case '0':
+ case '1':
+ case '2':
+ case '3':
+ case '4':
+ case '5':
+ case '6':
+ case '7':
+ {
+ int i = fromhex (c);
+ int count = 0;
+
+ while (++count < 3)
+ {
+ c = (**string_ptr);
+ if (isdigit (c) && c != '8' && c != '9')
+ {
+ (*string_ptr)++;
+ i *= 8;
+ i += fromhex (c);
+ }
+ else
+ {
+ break;
+ }
+ }
+ return i;
+ }
case 'a':
c = '\a';
@@ -180,7 +180,7 @@ mi_parse_argv (const char *args, struct mi_parse *parse)
len++;
}
arg[len] = '\0';
- chp++; /* That closing quote. */
+ chp++; /* That closing quote. */
break;
}
default:
@@ -262,7 +262,7 @@ mi_parse (const char *cmd, char **token)
/* Extract the command. */
{
- const char *tmp = chp + 1; /* discard ``-'' */
+ const char *tmp = chp + 1; /* discard ``-'' */
for (; *chp && !isspace (*chp); chp++)
;
@@ -274,8 +274,8 @@ mi_parse (const char *cmd, char **token)
/* Find the command in the MI table. */
parse->cmd = mi_cmd_lookup (parse->command);
if (parse->cmd == NULL)
- throw_error (UNDEFINED_COMMAND_ERROR,
- _("Undefined MI command: %s"), parse->command);
+ throw_error (UNDEFINED_COMMAND_ERROR, _ ("Undefined MI command: %s"),
+ parse->command);
/* Skip white space following the command. */
chp = skip_spaces (chp);
@@ -314,10 +314,10 @@ mi_parse (const char *cmd, char **token)
option = "--thread-group";
if (parse->thread_group != -1)
- error (_("Duplicate '--thread-group' option"));
+ error (_ ("Duplicate '--thread-group' option"));
chp += tgs;
if (*chp != 'i')
- error (_("Invalid thread group id"));
+ error (_ ("Invalid thread group id"));
chp += 1;
parse->thread_group = strtol (chp, &endp, 10);
chp = endp;
@@ -328,7 +328,7 @@ mi_parse (const char *cmd, char **token)
option = "--thread";
if (parse->thread != -1)
- error (_("Duplicate '--thread' option"));
+ error (_ ("Duplicate '--thread' option"));
chp += ts;
parse->thread = strtol (chp, &endp, 10);
chp = endp;
@@ -339,7 +339,7 @@ mi_parse (const char *cmd, char **token)
option = "--frame";
if (parse->frame != -1)
- error (_("Duplicate '--frame' option"));
+ error (_ ("Duplicate '--frame' option"));
chp += fs;
parse->frame = strtol (chp, &endp, 10);
chp = endp;
@@ -353,13 +353,13 @@ mi_parse (const char *cmd, char **token)
parse->language = language_enum (lang_name.c_str ());
if (parse->language == language_unknown
|| parse->language == language_auto)
- error (_("Invalid --language argument: %s"), lang_name.c_str ());
+ error (_ ("Invalid --language argument: %s"), lang_name.c_str ());
}
else
break;
if (*chp != '\0' && !isspace (*chp))
- error (_("Invalid value for the '%s' option"), option);
+ error (_ ("Invalid value for the '%s' option"), option);
chp = skip_spaces (chp);
}
@@ -374,17 +374,14 @@ mi_parse (const char *cmd, char **token)
enum print_values
mi_parse_print_values (const char *name)
{
- if (strcmp (name, "0") == 0
- || strcmp (name, mi_no_values) == 0)
- return PRINT_NO_VALUES;
- else if (strcmp (name, "1") == 0
- || strcmp (name, mi_all_values) == 0)
- return PRINT_ALL_VALUES;
- else if (strcmp (name, "2") == 0
- || strcmp (name, mi_simple_values) == 0)
- return PRINT_SIMPLE_VALUES;
- else
- error (_("Unknown value for PRINT_VALUES: must be: \
+ if (strcmp (name, "0") == 0 || strcmp (name, mi_no_values) == 0)
+ return PRINT_NO_VALUES;
+ else if (strcmp (name, "1") == 0 || strcmp (name, mi_all_values) == 0)
+ return PRINT_ALL_VALUES;
+ else if (strcmp (name, "2") == 0 || strcmp (name, mi_simple_values) == 0)
+ return PRINT_SIMPLE_VALUES;
+ else
+ error (_ ("Unknown value for PRINT_VALUES: must be: \
0 or \"%s\", 1 or \"%s\", 2 or \"%s\""),
- mi_no_values, mi_all_values, mi_simple_values);
+ mi_no_values, mi_all_values, mi_simple_values);
}
diff --git a/gdb/mi/mi-parse.h b/gdb/mi/mi-parse.h
index e34796988a4..97353e37a7a 100644
--- a/gdb/mi/mi-parse.h
+++ b/gdb/mi/mi-parse.h
@@ -22,7 +22,7 @@
#include "gdbsupport/run-time-clock.h"
#include <chrono>
-#include "mi-cmds.h" /* For enum print_values. */
+#include "mi-cmds.h" /* For enum print_values. */
/* MI parser */
@@ -35,34 +35,35 @@ struct mi_timestamp
};
enum mi_command_type
- {
- MI_COMMAND, CLI_COMMAND
- };
+{
+ MI_COMMAND,
+ CLI_COMMAND
+};
struct mi_parse
- {
- mi_parse ();
- ~mi_parse ();
-
- DISABLE_COPY_AND_ASSIGN (mi_parse);
-
- enum mi_command_type op;
- char *command;
- char *token;
- const struct mi_command *cmd;
- struct mi_timestamp *cmd_start;
- char *args;
- char **argv;
- int argc;
- int all;
- int thread_group; /* At present, the same as inferior number. */
- int thread;
- int frame;
-
- /* The language that should be used to evaluate the MI command.
+{
+ mi_parse ();
+ ~mi_parse ();
+
+ DISABLE_COPY_AND_ASSIGN (mi_parse);
+
+ enum mi_command_type op;
+ char *command;
+ char *token;
+ const struct mi_command *cmd;
+ struct mi_timestamp *cmd_start;
+ char *args;
+ char **argv;
+ int argc;
+ int all;
+ int thread_group; /* At present, the same as inferior number. */
+ int thread;
+ int frame;
+
+ /* The language that should be used to evaluate the MI command.
Ignored if set to language_unknown. */
- enum language language;
- };
+ enum language language;
+};
/* Attempts to parse CMD returning a ``struct mi_parse''. If CMD is
invalid, an exception is thrown. For an MI_COMMAND COMMAND, ARGS
diff --git a/gdb/mi/mi-symbol-cmds.c b/gdb/mi/mi-symbol-cmds.c
index 16947dad51b..c4074377cd0 100644
--- a/gdb/mi/mi-symbol-cmds.c
+++ b/gdb/mi/mi-symbol-cmds.c
@@ -38,13 +38,13 @@ mi_cmd_symbol_list_lines (const char *command, char **argv, int argc)
struct ui_out *uiout = current_uiout;
if (argc != 1)
- error (_("-symbol-list-lines: Usage: SOURCE_FILENAME"));
+ error (_ ("-symbol-list-lines: Usage: SOURCE_FILENAME"));
filename = argv[0];
s = lookup_symtab (filename);
if (s == NULL)
- error (_("-symbol-list-lines: Unknown source file name."));
+ error (_ ("-symbol-list-lines: Unknown source file name."));
/* Now, dump the associated line table. The pc addresses are
already sorted by increasing values in the symbol table, so no
@@ -99,8 +99,7 @@ output_nondebug_symbol (ui_out *uiout,
struct gdbarch *gdbarch = msymbol.objfile->arch ();
ui_out_emit_tuple tuple_emitter (uiout, NULL);
- uiout->field_core_addr ("address", gdbarch,
- msymbol.value_address ());
+ uiout->field_core_addr ("address", gdbarch, msymbol.value_address ());
uiout->field_string ("name", msymbol.minsym->print_name ());
}
@@ -142,8 +141,7 @@ mi_symbol_info (enum search_domain kind, const char *name_regexp,
ui_out_emit_list symbols_list_emitter (uiout, "symbols");
/* As long as we have debug symbols from this symtab... */
- for (; (i < symbols.size ()
- && symbols[i].msymbol.minsym == nullptr
+ for (; (i < symbols.size () && symbols[i].msymbol.minsym == nullptr
&& symbols[i].symbol->symtab () == symtab);
++i)
{
@@ -177,7 +175,7 @@ parse_max_results_option (char *arg)
char *ptr = arg;
long long val = strtoll (arg, &ptr, 10);
if (arg == ptr || *ptr != '\0' || val > SIZE_MAX || val < 0)
- error (_("invalid value for --max-results argument"));
+ error (_ ("invalid value for --max-results argument"));
size_t max_results = (size_t) val;
return max_results;
@@ -195,17 +193,18 @@ mi_info_functions_or_variables (enum search_domain kind, char **argv, int argc)
bool exclude_minsyms = true;
enum opt
- {
- INCLUDE_NONDEBUG_OPT, TYPE_REGEXP_OPT, NAME_REGEXP_OPT, MAX_RESULTS_OPT
- };
- static const struct mi_opt opts[] =
{
- {"-include-nondebug" , INCLUDE_NONDEBUG_OPT, 0},
- {"-type", TYPE_REGEXP_OPT, 1},
- {"-name", NAME_REGEXP_OPT, 1},
- {"-max-results", MAX_RESULTS_OPT, 1},
- { 0, 0, 0 }
+ INCLUDE_NONDEBUG_OPT,
+ TYPE_REGEXP_OPT,
+ NAME_REGEXP_OPT,
+ MAX_RESULTS_OPT
};
+ static const struct mi_opt opts[]
+ = { { "-include-nondebug", INCLUDE_NONDEBUG_OPT, 0 },
+ { "-type", TYPE_REGEXP_OPT, 1 },
+ { "-name", NAME_REGEXP_OPT, 1 },
+ { "-max-results", MAX_RESULTS_OPT, 1 },
+ { 0, 0, 0 } };
int oind = 0;
char *oarg = nullptr;
@@ -213,8 +212,8 @@ mi_info_functions_or_variables (enum search_domain kind, char **argv, int argc)
while (1)
{
const char *cmd_string
- = ((kind == FUNCTIONS_DOMAIN)
- ? "-symbol-info-functions" : "-symbol-info-variables");
+ = ((kind == FUNCTIONS_DOMAIN) ? "-symbol-info-functions"
+ : "-symbol-info-variables");
int opt = mi_getopt (cmd_string, argc, argv, opts, &oind, &oarg);
if (opt < 0)
break;
@@ -240,16 +239,16 @@ mi_info_functions_or_variables (enum search_domain kind, char **argv, int argc)
/* Type for an iterator over a vector of module_symbol_search results. */
typedef std::vector<module_symbol_search>::const_iterator
- module_symbol_search_iterator;
+ module_symbol_search_iterator;
/* Helper for mi_info_module_functions_or_variables. Display the results
from ITER up to END or until we find a symbol that is in a different
module, or in a different symtab than the first symbol we print. Update
and return the new value for ITER. */
static module_symbol_search_iterator
-output_module_symbols_in_single_module_and_file
- (struct ui_out *uiout, module_symbol_search_iterator iter,
- const module_symbol_search_iterator end, enum search_domain kind)
+output_module_symbols_in_single_module_and_file (
+ struct ui_out *uiout, module_symbol_search_iterator iter,
+ const module_symbol_search_iterator end, enum search_domain kind)
{
/* The symbol for the module in which the first result resides. */
const symbol *first_module_symbol = iter->first.symbol;
@@ -267,12 +266,10 @@ output_module_symbols_in_single_module_and_file
/* Repeatedly output result symbols until either we run out of symbols,
we change module, or we change symtab. */
- for (; (iter != end
- && first_module_symbol == iter->first.symbol
+ for (; (iter != end && first_module_symbol == iter->first.symbol
&& first_symbtab == iter->second.symbol->symtab ());
++iter)
- output_debug_symbol (uiout, kind, iter->second.symbol,
- iter->second.block);
+ output_debug_symbol (uiout, kind, iter->second.symbol, iter->second.block);
return iter;
}
@@ -282,9 +279,9 @@ output_module_symbols_in_single_module_and_file
module than the first symbol we print. Update and return the new value
for ITER. */
static module_symbol_search_iterator
-output_module_symbols_in_single_module
- (struct ui_out *uiout, module_symbol_search_iterator iter,
- const module_symbol_search_iterator end, enum search_domain kind)
+output_module_symbols_in_single_module (
+ struct ui_out *uiout, module_symbol_search_iterator iter,
+ const module_symbol_search_iterator end, enum search_domain kind)
{
gdb_assert (iter->first.symbol != nullptr);
gdb_assert (iter->second.symbol != nullptr);
@@ -302,8 +299,8 @@ output_module_symbols_in_single_module
print all results within a single file. We keep calling the output
function until we change module. */
while (iter != end && first_module_symbol == iter->first.symbol)
- iter = output_module_symbols_in_single_module_and_file (uiout, iter,
- end, kind);
+ iter = output_module_symbols_in_single_module_and_file (uiout, iter, end,
+ kind);
return iter;
}
@@ -312,8 +309,8 @@ output_module_symbols_in_single_module
command line options passed to the MI command. */
static void
-mi_info_module_functions_or_variables (enum search_domain kind,
- char **argv, int argc)
+mi_info_module_functions_or_variables (enum search_domain kind, char **argv,
+ int argc)
{
const char *module_regexp = nullptr;
const char *regexp = nullptr;
@@ -322,16 +319,15 @@ mi_info_module_functions_or_variables (enum search_domain kind,
/* Process the command line options. */
enum opt
- {
- MODULE_REGEXP_OPT, TYPE_REGEXP_OPT, NAME_REGEXP_OPT
- };
- static const struct mi_opt opts[] =
{
- {"-module", MODULE_REGEXP_OPT, 1},
- {"-type", TYPE_REGEXP_OPT, 1},
- {"-name", NAME_REGEXP_OPT, 1},
- { 0, 0, 0 }
+ MODULE_REGEXP_OPT,
+ TYPE_REGEXP_OPT,
+ NAME_REGEXP_OPT
};
+ static const struct mi_opt opts[] = { { "-module", MODULE_REGEXP_OPT, 1 },
+ { "-type", TYPE_REGEXP_OPT, 1 },
+ { "-name", NAME_REGEXP_OPT, 1 },
+ { 0, 0, 0 } };
int oind = 0;
char *oarg = nullptr;
@@ -339,9 +335,8 @@ mi_info_module_functions_or_variables (enum search_domain kind,
while (1)
{
const char *cmd_string
- = ((kind == FUNCTIONS_DOMAIN)
- ? "-symbol-info-module-functions"
- : "-symbol-info-module-variables");
+ = ((kind == FUNCTIONS_DOMAIN) ? "-symbol-info-module-functions"
+ : "-symbol-info-module-variables");
int opt = mi_getopt (cmd_string, argc, argv, opts, &oind, &oarg);
if (opt < 0)
break;
@@ -410,23 +405,21 @@ mi_cmd_symbol_info_modules (const char *command, char **argv, int argc)
const char *regexp = nullptr;
enum opt
- {
- NAME_REGEXP_OPT, MAX_RESULTS_OPT
- };
- static const struct mi_opt opts[] =
{
- {"-name", NAME_REGEXP_OPT, 1},
- {"-max-results", MAX_RESULTS_OPT, 1},
- { 0, 0, 0 }
+ NAME_REGEXP_OPT,
+ MAX_RESULTS_OPT
};
+ static const struct mi_opt opts[] = { { "-name", NAME_REGEXP_OPT, 1 },
+ { "-max-results", MAX_RESULTS_OPT, 1 },
+ { 0, 0, 0 } };
int oind = 0;
char *oarg = nullptr;
while (1)
{
- int opt = mi_getopt ("-symbol-info-modules", argc, argv, opts,
- &oind, &oarg);
+ int opt
+ = mi_getopt ("-symbol-info-modules", argc, argv, opts, &oind, &oarg);
if (opt < 0)
break;
switch ((enum opt) opt)
@@ -452,23 +445,21 @@ mi_cmd_symbol_info_types (const char *command, char **argv, int argc)
const char *regexp = nullptr;
enum opt
- {
- NAME_REGEXP_OPT, MAX_RESULTS_OPT
- };
- static const struct mi_opt opts[] =
{
- {"-name", NAME_REGEXP_OPT, 1},
- {"-max-results", MAX_RESULTS_OPT, 1},
- { 0, 0, 0 }
+ NAME_REGEXP_OPT,
+ MAX_RESULTS_OPT
};
+ static const struct mi_opt opts[] = { { "-name", NAME_REGEXP_OPT, 1 },
+ { "-max-results", MAX_RESULTS_OPT, 1 },
+ { 0, 0, 0 } };
int oind = 0;
char *oarg = nullptr;
while (true)
{
- int opt = mi_getopt ("-symbol-info-types", argc, argv, opts,
- &oind, &oarg);
+ int opt
+ = mi_getopt ("-symbol-info-types", argc, argv, opts, &oind, &oarg);
if (opt < 0)
break;
switch ((enum opt) opt)
diff --git a/gdb/microblaze-linux-tdep.c b/gdb/microblaze-linux-tdep.c
index ae33cb5c014..9b7ca2b12e5 100644
--- a/gdb/microblaze-linux-tdep.c
+++ b/gdb/microblaze-linux-tdep.c
@@ -38,7 +38,7 @@
#include "linux-tdep.h"
static int
-microblaze_linux_memory_remove_breakpoint (struct gdbarch *gdbarch,
+microblaze_linux_memory_remove_breakpoint (struct gdbarch *gdbarch,
struct bp_target_info *bp_tgt)
{
CORE_ADDR addr = bp_tgt->reqstd_address;
@@ -64,8 +64,7 @@ microblaze_linux_memory_remove_breakpoint (struct gdbarch *gdbarch,
static void
microblaze_linux_sigtramp_cache (frame_info_ptr next_frame,
struct trad_frame_cache *this_cache,
- CORE_ADDR func, LONGEST offset,
- int bias)
+ CORE_ADDR func, LONGEST offset, int bias)
{
CORE_ADDR base;
CORE_ADDR gpregs;
@@ -82,12 +81,11 @@ microblaze_linux_sigtramp_cache (frame_info_ptr next_frame,
/* Registers saved on stack. */
for (regnum = 0; regnum < MICROBLAZE_BTR_REGNUM; regnum++)
- trad_frame_set_reg_addr (this_cache, regnum,
+ trad_frame_set_reg_addr (this_cache, regnum,
gpregs + regnum * MICROBLAZE_REGISTER_SIZE);
trad_frame_set_id (this_cache, frame_id_build (base, func));
}
-
static void
microblaze_linux_sighandler_cache_init (const struct tramp_frame *self,
frame_info_ptr next_frame,
@@ -96,31 +94,27 @@ microblaze_linux_sighandler_cache_init (const struct tramp_frame *self,
{
microblaze_linux_sigtramp_cache (next_frame, this_cache, func,
0 /* Offset to ucontext_t. */
- + 24 /* Offset to .reg. */,
+ + 24 /* Offset to .reg. */,
0);
}
-static struct tramp_frame microblaze_linux_sighandler_tramp_frame =
-{
- SIGTRAMP_FRAME,
- 4,
- {
- { 0x31800077, ULONGEST_MAX }, /* addik R12,R0,119. */
- { 0xb9cc0008, ULONGEST_MAX }, /* brki R14,8. */
- { TRAMP_SENTINEL_INSN },
- },
- microblaze_linux_sighandler_cache_init
-};
-
+static struct tramp_frame microblaze_linux_sighandler_tramp_frame
+ = { SIGTRAMP_FRAME,
+ 4,
+ {
+ { 0x31800077, ULONGEST_MAX }, /* addik R12,R0,119. */
+ { 0xb9cc0008, ULONGEST_MAX }, /* brki R14,8. */
+ { TRAMP_SENTINEL_INSN },
+ },
+ microblaze_linux_sighandler_cache_init };
static void
-microblaze_linux_init_abi (struct gdbarch_info info,
- struct gdbarch *gdbarch)
+microblaze_linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
{
linux_init_abi (info, gdbarch, 0);
- set_gdbarch_memory_remove_breakpoint (gdbarch,
- microblaze_linux_memory_remove_breakpoint);
+ set_gdbarch_memory_remove_breakpoint (
+ gdbarch, microblaze_linux_memory_remove_breakpoint);
/* Shared library handling. */
set_solib_svr4_fetch_link_map_offsets (gdbarch,
@@ -132,9 +126,10 @@ microblaze_linux_init_abi (struct gdbarch_info info,
}
void _initialize_microblaze_linux_tdep ();
+
void
_initialize_microblaze_linux_tdep ()
{
- gdbarch_register_osabi (bfd_arch_microblaze, 0, GDB_OSABI_LINUX,
+ gdbarch_register_osabi (bfd_arch_microblaze, 0, GDB_OSABI_LINUX,
microblaze_linux_init_abi);
}
diff --git a/gdb/microblaze-tdep.c b/gdb/microblaze-tdep.c
index 723dc7cde98..eafe260d60e 100644
--- a/gdb/microblaze-tdep.c
+++ b/gdb/microblaze-tdep.c
@@ -41,7 +41,7 @@
#include "features/microblaze-with-stack-protect.c"
#include "features/microblaze.c"
-
+
/* Instruction macros used for analyzing the prologue. */
/* This set of instruction macros need to be changed whenever the
prologue generated by the compiler could have more instructions or
@@ -65,28 +65,25 @@
/* The registers of the Xilinx microblaze processor. */
-static const char * const microblaze_register_names[] =
-{
- "r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7",
- "r8", "r9", "r10", "r11", "r12", "r13", "r14", "r15",
- "r16", "r17", "r18", "r19", "r20", "r21", "r22", "r23",
- "r24", "r25", "r26", "r27", "r28", "r29", "r30", "r31",
- "rpc", "rmsr", "rear", "resr", "rfsr", "rbtr",
- "rpvr0", "rpvr1", "rpvr2", "rpvr3", "rpvr4", "rpvr5", "rpvr6",
- "rpvr7", "rpvr8", "rpvr9", "rpvr10", "rpvr11",
- "redr", "rpid", "rzpr", "rtlbx", "rtlbsx", "rtlblo", "rtlbhi",
- "rslr", "rshr"
-};
+static const char *const microblaze_register_names[]
+ = { "r0", "r1", "r2", "r3", "r4", "r5", "r6",
+ "r7", "r8", "r9", "r10", "r11", "r12", "r13",
+ "r14", "r15", "r16", "r17", "r18", "r19", "r20",
+ "r21", "r22", "r23", "r24", "r25", "r26", "r27",
+ "r28", "r29", "r30", "r31", "rpc", "rmsr", "rear",
+ "resr", "rfsr", "rbtr", "rpvr0", "rpvr1", "rpvr2", "rpvr3",
+ "rpvr4", "rpvr5", "rpvr6", "rpvr7", "rpvr8", "rpvr9", "rpvr10",
+ "rpvr11", "redr", "rpid", "rzpr", "rtlbx", "rtlbsx", "rtlblo",
+ "rtlbhi", "rslr", "rshr" };
#define MICROBLAZE_NUM_REGS ARRAY_SIZE (microblaze_register_names)
-
+
static unsigned int microblaze_debug_flag = 0;
-#define microblaze_debug(fmt, ...) \
+#define microblaze_debug(fmt, ...) \
debug_prefixed_printf_cond_nofunc (microblaze_debug_flag, "MICROBLAZE", \
- fmt, ## __VA_ARGS__)
+ fmt, ##__VA_ARGS__)
-
/* Return the name of register REGNUM. */
static const char *
@@ -109,7 +106,6 @@ microblaze_register_type (struct gdbarch *gdbarch, int regnum)
return builtin_type (gdbarch)->builtin_int;
}
-
/* Fetch the instruction at PC. */
static unsigned long
@@ -124,12 +120,11 @@ microblaze_fetch_instruction (CORE_ADDR pc)
return extract_unsigned_integer (buf, 4, byte_order);
}
-
+
constexpr gdb_byte microblaze_break_insn[] = MICROBLAZE_BREAKPOINT;
typedef BP_MANIPULATION (microblaze_break_insn) microblaze_breakpoint;
-
/* Allocate and initialize a frame cache. */
static struct microblaze_frame_cache *
@@ -186,7 +181,7 @@ microblaze_alloc_frame_cache (void)
of "real" code (i.e., the end of the prologue). */
static CORE_ADDR
-microblaze_analyze_prologue (struct gdbarch *gdbarch, CORE_ADDR pc,
+microblaze_analyze_prologue (struct gdbarch *gdbarch, CORE_ADDR pc,
CORE_ADDR current_pc,
struct microblaze_frame_cache *cache)
{
@@ -206,10 +201,10 @@ microblaze_analyze_prologue (struct gdbarch *gdbarch, CORE_ADDR pc,
if (current_pc < pc)
return current_pc;
- /* Initialize info about frame. */
- cache->framesize = 0;
- cache->fp_regnum = MICROBLAZE_SP_REGNUM;
- cache->frameless_p = 1;
+ /* Initialize info about frame. */
+ cache->framesize = 0;
+ cache->fp_regnum = MICROBLAZE_SP_REGNUM;
+ cache->frameless_p = 1;
/* Start decoding the prologue. We start by checking two special cases:
@@ -225,15 +220,15 @@ microblaze_analyze_prologue (struct gdbarch *gdbarch, CORE_ADDR pc,
insn = microblaze_fetch_instruction (pc);
op = microblaze_decode_insn (insn, &rd, &ra, &rb, &imm);
- if (IS_RETURN(op))
+ if (IS_RETURN (op))
return pc;
/* Start at beginning of function and analyze until we get to the
current pc, or the end of the function, whichever is first. */
stop = (current_pc < func_end ? current_pc : func_end);
- microblaze_debug ("Scanning prologue: name=%s, func_addr=%s, stop=%s\n",
- name, paddress (gdbarch, func_addr),
+ microblaze_debug ("Scanning prologue: name=%s, func_addr=%s, stop=%s\n",
+ name, paddress (gdbarch, func_addr),
paddress (gdbarch, stop));
for (addr = func_addr; addr < stop; addr += INST_WORD_SIZE)
@@ -245,18 +240,18 @@ microblaze_analyze_prologue (struct gdbarch *gdbarch, CORE_ADDR pc,
/* This code is very sensitive to what functions are present in the
prologue. It assumes that the (addi, addik, swi, sw) can be the
only instructions in the prologue. */
- if (IS_UPDATE_SP(op, rd, ra))
+ if (IS_UPDATE_SP (op, rd, ra))
{
microblaze_debug ("got addi r1,r1,%d; contnuing\n", imm);
if (cache->framesize)
- break; /* break if framesize already computed. */
+ break; /* break if framesize already computed. */
cache->framesize = -imm; /* stack grows towards low memory. */
- cache->frameless_p = 0; /* Frame found. */
+ cache->frameless_p = 0; /* Frame found. */
save_hidden_pointer_found = 0;
non_stack_instruction_found = 0;
continue;
}
- else if (IS_SPILL_SP(op, rd, ra))
+ else if (IS_SPILL_SP (op, rd, ra))
{
/* Spill stack pointer. */
cache->register_offsets[rd] = imm; /* SP spilled before updating. */
@@ -267,7 +262,7 @@ microblaze_analyze_prologue (struct gdbarch *gdbarch, CORE_ADDR pc,
non_stack_instruction_found = 0;
continue;
}
- else if (IS_SPILL_REG(op, rd, ra))
+ else if (IS_SPILL_REG (op, rd, ra))
{
/* Spill register. */
cache->register_offsets[rd] = imm - cache->framesize;
@@ -278,7 +273,7 @@ microblaze_analyze_prologue (struct gdbarch *gdbarch, CORE_ADDR pc,
non_stack_instruction_found = 0;
continue;
}
- else if (IS_ALSO_SPILL_REG(op, rd, ra, rb))
+ else if (IS_ALSO_SPILL_REG (op, rd, ra, rb))
{
/* Spill register. */
cache->register_offsets[rd] = 0 - cache->framesize;
@@ -289,7 +284,7 @@ microblaze_analyze_prologue (struct gdbarch *gdbarch, CORE_ADDR pc,
non_stack_instruction_found = 0;
continue;
}
- else if (IS_SETUP_FP(op, ra, rb))
+ else if (IS_SETUP_FP (op, ra, rb))
{
/* We have a frame pointer. Note the register which is
acting as the frame pointer. */
@@ -300,7 +295,7 @@ microblaze_analyze_prologue (struct gdbarch *gdbarch, CORE_ADDR pc,
non_stack_instruction_found = 0;
continue;
}
- else if (IS_SPILL_REG_FP(op, rd, ra, cache->fp_regnum))
+ else if (IS_SPILL_REG_FP (op, rd, ra, cache->fp_regnum))
{
/* reg spilled after updating. */
cache->register_offsets[rd] = imm - cache->framesize;
@@ -311,7 +306,7 @@ microblaze_analyze_prologue (struct gdbarch *gdbarch, CORE_ADDR pc,
non_stack_instruction_found = 0;
continue;
}
- else if (IS_SAVE_HIDDEN_PTR(op, rd, ra, rb))
+ else if (IS_SAVE_HIDDEN_PTR (op, rd, ra, rb))
{
/* If the first argument is a hidden pointer to the area where the
return structure is to be saved, then it is saved as part of the
@@ -341,14 +336,14 @@ microblaze_analyze_prologue (struct gdbarch *gdbarch, CORE_ADDR pc,
instruction. */
{
- unsigned ctrl_op = (unsigned)insn >> 26;
+ unsigned ctrl_op = (unsigned) insn >> 26;
/* continue if not control flow (branch, return). */
if (ctrl_op != 0x26 && ctrl_op != 0x27 && ctrl_op != 0x2d
&& ctrl_op != 0x2e && ctrl_op != 0x2f)
continue;
else if (ctrl_op == 0x2c)
- continue; /* continue if imm. */
+ continue; /* continue if imm. */
}
/* This is not a prologue insn, so stop here. */
@@ -401,13 +396,12 @@ microblaze_skip_prologue (struct gdbarch *gdbarch, CORE_ADDR start_pc)
{
sal = find_pc_line (func_start, 0);
- if (sal.end < func_end
- && start_pc <= sal.end)
+ if (sal.end < func_end && start_pc <= sal.end)
start_pc = sal.end;
}
- ostart_pc = microblaze_analyze_prologue (gdbarch, func_start, 0xffffffffUL,
- &cache);
+ ostart_pc
+ = microblaze_analyze_prologue (gdbarch, func_start, 0xffffffffUL, &cache);
if (ostart_pc > start_pc)
return ostart_pc;
@@ -444,10 +438,10 @@ microblaze_frame_cache (frame_info_ptr next_frame, void **this_cache)
static void
microblaze_frame_this_id (frame_info_ptr next_frame, void **this_cache,
- struct frame_id *this_id)
+ struct frame_id *this_id)
{
- struct microblaze_frame_cache *cache =
- microblaze_frame_cache (next_frame, this_cache);
+ struct microblaze_frame_cache *cache
+ = microblaze_frame_cache (next_frame, this_cache);
/* This marks the outermost frame. */
if (cache->base == 0)
@@ -457,11 +451,11 @@ microblaze_frame_this_id (frame_info_ptr next_frame, void **this_cache,
}
static struct value *
-microblaze_frame_prev_register (frame_info_ptr this_frame,
- void **this_cache, int regnum)
+microblaze_frame_prev_register (frame_info_ptr this_frame, void **this_cache,
+ int regnum)
{
- struct microblaze_frame_cache *cache =
- microblaze_frame_cache (this_frame, this_cache);
+ struct microblaze_frame_cache *cache
+ = microblaze_frame_cache (this_frame, this_cache);
if (cache->frameless_p)
{
@@ -469,44 +463,36 @@ microblaze_frame_prev_register (frame_info_ptr this_frame,
regnum = 15;
if (regnum == MICROBLAZE_SP_REGNUM)
regnum = 1;
- return trad_frame_get_prev_register (this_frame,
- cache->saved_regs, regnum);
+ return trad_frame_get_prev_register (this_frame, cache->saved_regs,
+ regnum);
}
else
return trad_frame_get_prev_register (this_frame, cache->saved_regs,
regnum);
-
}
-static const struct frame_unwind microblaze_frame_unwind =
-{
- "microblaze prologue",
- NORMAL_FRAME,
- default_frame_unwind_stop_reason,
- microblaze_frame_this_id,
- microblaze_frame_prev_register,
- NULL,
- default_frame_sniffer
-};
-
+static const struct frame_unwind microblaze_frame_unwind
+ = { "microblaze prologue",
+ NORMAL_FRAME,
+ default_frame_unwind_stop_reason,
+ microblaze_frame_this_id,
+ microblaze_frame_prev_register,
+ NULL,
+ default_frame_sniffer };
+
static CORE_ADDR
-microblaze_frame_base_address (frame_info_ptr next_frame,
- void **this_cache)
+microblaze_frame_base_address (frame_info_ptr next_frame, void **this_cache)
{
- struct microblaze_frame_cache *cache =
- microblaze_frame_cache (next_frame, this_cache);
+ struct microblaze_frame_cache *cache
+ = microblaze_frame_cache (next_frame, this_cache);
return cache->base;
}
-static const struct frame_base microblaze_frame_base =
-{
- &microblaze_frame_unwind,
- microblaze_frame_base_address,
- microblaze_frame_base_address,
- microblaze_frame_base_address
-};
-
+static const struct frame_base microblaze_frame_base
+ = { &microblaze_frame_unwind, microblaze_frame_base_address,
+ microblaze_frame_base_address, microblaze_frame_base_address };
+
/* Extract from an array REGBUF containing the (raw) register state, a
function return value of TYPE, and copy that into VALBUF. */
static void
@@ -518,22 +504,22 @@ microblaze_extract_return_value (struct type *type, struct regcache *regcache,
/* Copy the return value (starting) in RETVAL_REGNUM to VALBUF. */
switch (type->length ())
{
- case 1: /* return last byte in the register. */
- regcache->cooked_read (MICROBLAZE_RETVAL_REGNUM, buf);
- memcpy(valbuf, buf + MICROBLAZE_REGISTER_SIZE - 1, 1);
- return;
- case 2: /* return last 2 bytes in register. */
- regcache->cooked_read (MICROBLAZE_RETVAL_REGNUM, buf);
- memcpy(valbuf, buf + MICROBLAZE_REGISTER_SIZE - 2, 2);
- return;
- case 4: /* for sizes 4 or 8, copy the required length. */
- case 8:
- regcache->cooked_read (MICROBLAZE_RETVAL_REGNUM, buf);
- regcache->cooked_read (MICROBLAZE_RETVAL_REGNUM + 1, buf+4);
- memcpy (valbuf, buf, type->length ());
- return;
- default:
- internal_error (_("Unsupported return value size requested"));
+ case 1: /* return last byte in the register. */
+ regcache->cooked_read (MICROBLAZE_RETVAL_REGNUM, buf);
+ memcpy (valbuf, buf + MICROBLAZE_REGISTER_SIZE - 1, 1);
+ return;
+ case 2: /* return last 2 bytes in register. */
+ regcache->cooked_read (MICROBLAZE_RETVAL_REGNUM, buf);
+ memcpy (valbuf, buf + MICROBLAZE_REGISTER_SIZE - 2, 2);
+ return;
+ case 4: /* for sizes 4 or 8, copy the required length. */
+ case 8:
+ regcache->cooked_read (MICROBLAZE_RETVAL_REGNUM, buf);
+ regcache->cooked_read (MICROBLAZE_RETVAL_REGNUM + 1, buf + 4);
+ memcpy (valbuf, buf, type->length ());
+ return;
+ default:
+ internal_error (_ ("Unsupported return value size requested"));
}
}
@@ -554,15 +540,15 @@ microblaze_store_return_value (struct type *type, struct regcache *regcache,
int len = type->length ();
gdb_byte buf[8];
- memset (buf, 0, sizeof(buf));
+ memset (buf, 0, sizeof (buf));
/* Integral and pointer return values. */
if (len > 4)
{
- gdb_assert (len == 8);
- memcpy (buf, valbuf, 8);
- regcache->cooked_write (MICROBLAZE_RETVAL_REGNUM+1, buf + 4);
+ gdb_assert (len == 8);
+ memcpy (buf, valbuf, 8);
+ regcache->cooked_write (MICROBLAZE_RETVAL_REGNUM + 1, buf + 4);
}
else
/* ??? Do we need to do any sign-extension here? */
@@ -590,28 +576,46 @@ microblaze_stabs_argument_has_addr (struct gdbarch *gdbarch, struct type *type)
return (type->length () == 16);
}
-
-static int dwarf2_to_reg_map[78] =
-{ 0 /* r0 */, 1 /* r1 */, 2 /* r2 */, 3 /* r3 */, /* 0- 3 */
- 4 /* r4 */, 5 /* r5 */, 6 /* r6 */, 7 /* r7 */, /* 4- 7 */
- 8 /* r8 */, 9 /* r9 */, 10 /* r10 */, 11 /* r11 */, /* 8-11 */
- 12 /* r12 */, 13 /* r13 */, 14 /* r14 */, 15 /* r15 */, /* 12-15 */
- 16 /* r16 */, 17 /* r17 */, 18 /* r18 */, 19 /* r19 */, /* 16-19 */
- 20 /* r20 */, 21 /* r21 */, 22 /* r22 */, 23 /* r23 */, /* 20-23 */
- 24 /* r24 */, 25 /* r25 */, 26 /* r26 */, 27 /* r27 */, /* 24-25 */
- 28 /* r28 */, 29 /* r29 */, 30 /* r30 */, 31 /* r31 */, /* 28-31 */
- -1 /* $f0 */, -1 /* $f1 */, -1 /* $f2 */, -1 /* $f3 */, /* 32-35 */
- -1 /* $f4 */, -1 /* $f5 */, -1 /* $f6 */, -1 /* $f7 */, /* 36-39 */
- -1 /* $f8 */, -1 /* $f9 */, -1 /* $f10 */, -1 /* $f11 */, /* 40-43 */
- -1 /* $f12 */, -1 /* $f13 */, -1 /* $f14 */, -1 /* $f15 */, /* 44-47 */
- -1 /* $f16 */, -1 /* $f17 */, -1 /* $f18 */, -1 /* $f19 */, /* 48-51 */
- -1 /* $f20 */, -1 /* $f21 */, -1 /* $f22 */, -1 /* $f23 */, /* 52-55 */
- -1 /* $f24 */, -1 /* $f25 */, -1 /* $f26 */, -1 /* $f27 */, /* 56-59 */
- -1 /* $f28 */, -1 /* $f29 */, -1 /* $f30 */, -1 /* $f31 */, /* 60-63 */
- -1 /* hi */, -1 /* lo */, -1 /* accum*/, 33 /* rmsr */, /* 64-67 */
- -1 /* $fcc1*/, -1 /* $fcc2*/, -1 /* $fcc3*/, -1 /* $fcc4*/, /* 68-71 */
- -1 /* $fcc5*/, -1 /* $fcc6*/, -1 /* $fcc7*/, -1 /* $ap */, /* 72-75 */
- -1 /* $rap */, -1 /* $frp */ /* 76-77 */
+static int dwarf2_to_reg_map[78] = {
+ 0 /* r0 */, 1 /* r1 */,
+ 2 /* r2 */, 3 /* r3 */, /* 0- 3 */
+ 4 /* r4 */, 5 /* r5 */,
+ 6 /* r6 */, 7 /* r7 */, /* 4- 7 */
+ 8 /* r8 */, 9 /* r9 */,
+ 10 /* r10 */, 11 /* r11 */, /* 8-11 */
+ 12 /* r12 */, 13 /* r13 */,
+ 14 /* r14 */, 15 /* r15 */, /* 12-15 */
+ 16 /* r16 */, 17 /* r17 */,
+ 18 /* r18 */, 19 /* r19 */, /* 16-19 */
+ 20 /* r20 */, 21 /* r21 */,
+ 22 /* r22 */, 23 /* r23 */, /* 20-23 */
+ 24 /* r24 */, 25 /* r25 */,
+ 26 /* r26 */, 27 /* r27 */, /* 24-25 */
+ 28 /* r28 */, 29 /* r29 */,
+ 30 /* r30 */, 31 /* r31 */, /* 28-31 */
+ -1 /* $f0 */, -1 /* $f1 */,
+ -1 /* $f2 */, -1 /* $f3 */, /* 32-35 */
+ -1 /* $f4 */, -1 /* $f5 */,
+ -1 /* $f6 */, -1 /* $f7 */, /* 36-39 */
+ -1 /* $f8 */, -1 /* $f9 */,
+ -1 /* $f10 */, -1 /* $f11 */, /* 40-43 */
+ -1 /* $f12 */, -1 /* $f13 */,
+ -1 /* $f14 */, -1 /* $f15 */, /* 44-47 */
+ -1 /* $f16 */, -1 /* $f17 */,
+ -1 /* $f18 */, -1 /* $f19 */, /* 48-51 */
+ -1 /* $f20 */, -1 /* $f21 */,
+ -1 /* $f22 */, -1 /* $f23 */, /* 52-55 */
+ -1 /* $f24 */, -1 /* $f25 */,
+ -1 /* $f26 */, -1 /* $f27 */, /* 56-59 */
+ -1 /* $f28 */, -1 /* $f29 */,
+ -1 /* $f30 */, -1 /* $f31 */, /* 60-63 */
+ -1 /* hi */, -1 /* lo */,
+ -1 /* accum*/, 33 /* rmsr */, /* 64-67 */
+ -1 /* $fcc1*/, -1 /* $fcc2*/,
+ -1 /* $fcc3*/, -1 /* $fcc4*/, /* 68-71 */
+ -1 /* $fcc5*/, -1 /* $fcc6*/,
+ -1 /* $fcc7*/, -1 /* $ap */, /* 72-75 */
+ -1 /* $rap */, -1 /* $frp */ /* 76-77 */
};
static int
@@ -625,12 +629,10 @@ microblaze_dwarf2_reg_to_regnum (struct gdbarch *gdbarch, int reg)
static void
microblaze_register_g_packet_guesses (struct gdbarch *gdbarch)
{
- register_remote_g_packet_guess (gdbarch,
- 4 * MICROBLAZE_NUM_CORE_REGS,
+ register_remote_g_packet_guess (gdbarch, 4 * MICROBLAZE_NUM_CORE_REGS,
tdesc_microblaze);
- register_remote_g_packet_guess (gdbarch,
- 4 * MICROBLAZE_NUM_REGS,
+ register_remote_g_packet_guess (gdbarch, 4 * MICROBLAZE_NUM_REGS,
tdesc_microblaze_with_stack_protect);
}
@@ -654,8 +656,7 @@ microblaze_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
int valid_p;
int i;
- feature = tdesc_find_feature (tdesc,
- "org.gnu.gdb.microblaze.core");
+ feature = tdesc_find_feature (tdesc, "org.gnu.gdb.microblaze.core");
if (feature == NULL)
return NULL;
tdesc_data = tdesc_data_alloc ();
@@ -664,17 +665,15 @@ microblaze_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
for (i = 0; i < MICROBLAZE_NUM_CORE_REGS; i++)
valid_p &= tdesc_numbered_register (feature, tdesc_data.get (), i,
microblaze_register_names[i]);
- feature = tdesc_find_feature (tdesc,
- "org.gnu.gdb.microblaze.stack-protect");
+ feature
+ = tdesc_find_feature (tdesc, "org.gnu.gdb.microblaze.stack-protect");
if (feature != NULL)
{
valid_p = 1;
valid_p &= tdesc_numbered_register (feature, tdesc_data.get (),
- MICROBLAZE_SLR_REGNUM,
- "rslr");
+ MICROBLAZE_SLR_REGNUM, "rslr");
valid_p &= tdesc_numbered_register (feature, tdesc_data.get (),
- MICROBLAZE_SHR_REGNUM,
- "rshr");
+ MICROBLAZE_SHR_REGNUM, "rshr");
}
if (!valid_p)
@@ -692,8 +691,8 @@ microblaze_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
set_gdbarch_register_type (gdbarch, microblaze_register_type);
/* Register numbers of various important registers. */
- set_gdbarch_sp_regnum (gdbarch, MICROBLAZE_SP_REGNUM);
- set_gdbarch_pc_regnum (gdbarch, MICROBLAZE_PC_REGNUM);
+ set_gdbarch_sp_regnum (gdbarch, MICROBLAZE_SP_REGNUM);
+ set_gdbarch_pc_regnum (gdbarch, MICROBLAZE_PC_REGNUM);
/* Map Dwarf2 registers to GDB registers. */
set_gdbarch_dwarf2_reg_to_regnum (gdbarch, microblaze_dwarf2_reg_to_regnum);
@@ -702,8 +701,8 @@ microblaze_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
set_gdbarch_call_dummy_location (gdbarch, ON_STACK);
set_gdbarch_return_value (gdbarch, microblaze_return_value);
- set_gdbarch_stabs_argument_has_addr
- (gdbarch, microblaze_stabs_argument_has_addr);
+ set_gdbarch_stabs_argument_has_addr (gdbarch,
+ microblaze_stabs_argument_has_addr);
set_gdbarch_skip_prologue (gdbarch, microblaze_skip_prologue);
@@ -737,6 +736,7 @@ microblaze_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
}
void _initialize_microblaze_tdep ();
+
void
_initialize_microblaze_tdep ()
{
@@ -746,12 +746,11 @@ _initialize_microblaze_tdep ()
initialize_tdesc_microblaze ();
/* Debug this files internals. */
add_setshow_zuinteger_cmd ("microblaze", class_maintenance,
- &microblaze_debug_flag, _("\
-Set microblaze debugging."), _("\
-Show microblaze debugging."), _("\
+ &microblaze_debug_flag, _ ("\
+Set microblaze debugging."),
+ _ ("\
+Show microblaze debugging."),
+ _ ("\
When non-zero, microblaze specific debugging is enabled."),
- NULL,
- NULL,
- &setdebuglist, &showdebuglist);
-
+ NULL, NULL, &setdebuglist, &showdebuglist);
}
diff --git a/gdb/microblaze-tdep.h b/gdb/microblaze-tdep.h
index 892e5b3b849..d74ee3d03f9 100644
--- a/gdb/microblaze-tdep.h
+++ b/gdb/microblaze-tdep.h
@@ -31,16 +31,20 @@ struct microblaze_gdbarch_tdep : gdbarch_tdep_base
enum microblaze_regnum
{
MICROBLAZE_R0_REGNUM,
- MICROBLAZE_R1_REGNUM, MICROBLAZE_SP_REGNUM = MICROBLAZE_R1_REGNUM,
+ MICROBLAZE_R1_REGNUM,
+ MICROBLAZE_SP_REGNUM = MICROBLAZE_R1_REGNUM,
MICROBLAZE_R2_REGNUM,
- MICROBLAZE_R3_REGNUM, MICROBLAZE_RETVAL_REGNUM = MICROBLAZE_R3_REGNUM,
+ MICROBLAZE_R3_REGNUM,
+ MICROBLAZE_RETVAL_REGNUM = MICROBLAZE_R3_REGNUM,
MICROBLAZE_R4_REGNUM,
- MICROBLAZE_R5_REGNUM, MICROBLAZE_FIRST_ARGREG = MICROBLAZE_R5_REGNUM,
+ MICROBLAZE_R5_REGNUM,
+ MICROBLAZE_FIRST_ARGREG = MICROBLAZE_R5_REGNUM,
MICROBLAZE_R6_REGNUM,
MICROBLAZE_R7_REGNUM,
MICROBLAZE_R8_REGNUM,
MICROBLAZE_R9_REGNUM,
- MICROBLAZE_R10_REGNUM, MICROBLAZE_LAST_ARGREG = MICROBLAZE_R10_REGNUM,
+ MICROBLAZE_R10_REGNUM,
+ MICROBLAZE_LAST_ARGREG = MICROBLAZE_R10_REGNUM,
MICROBLAZE_R11_REGNUM,
MICROBLAZE_R12_REGNUM,
MICROBLAZE_R13_REGNUM,
@@ -87,7 +91,8 @@ enum microblaze_regnum
MICROBLAZE_RTLBSX_REGNUM,
MICROBLAZE_RTLBLO_REGNUM,
MICROBLAZE_RTLBHI_REGNUM,
- MICROBLAZE_SLR_REGNUM, MICROBLAZE_NUM_CORE_REGS = MICROBLAZE_SLR_REGNUM,
+ MICROBLAZE_SLR_REGNUM,
+ MICROBLAZE_NUM_CORE_REGS = MICROBLAZE_SLR_REGNUM,
MICROBLAZE_SHR_REGNUM,
MICROBLAZE_NUM_REGS
};
@@ -113,11 +118,15 @@ struct microblaze_frame_cache
/* Table of saved registers. */
struct trad_frame_saved_reg *saved_regs;
};
+
/* All registers are 32 bits. */
#define MICROBLAZE_REGISTER_SIZE 4
/* MICROBLAZE_BREAKPOINT defines the breakpoint that should be used.
Only used for native debugging. */
-#define MICROBLAZE_BREAKPOINT {0xb9, 0xcc, 0x00, 0x60}
+#define MICROBLAZE_BREAKPOINT \
+ { \
+ 0xb9, 0xcc, 0x00, 0x60 \
+ }
#endif /* microblaze-tdep.h */
diff --git a/gdb/mingw-hdep.c b/gdb/mingw-hdep.c
index 75f63a3fe17..ecd04964b83 100644
--- a/gdb/mingw-hdep.c
+++ b/gdb/mingw-hdep.c
@@ -125,13 +125,10 @@ gdb_select (int n, fd_set *readfds, fd_set *writefds, fd_set *exceptfds,
gdb_assert (num_handles <= MAXIMUM_WAIT_OBJECTS);
- event = WaitForMultipleObjects (num_handles,
- handles,
- FALSE,
- timeout
- ? (timeout->tv_sec * 1000
- + timeout->tv_usec / 1000)
- : INFINITE);
+ event = WaitForMultipleObjects (num_handles, handles, FALSE,
+ timeout ? (timeout->tv_sec * 1000
+ + timeout->tv_usec / 1000)
+ : INFINITE);
/* EVENT can only be a value in the WAIT_ABANDONED_0 range if the
HANDLES included an abandoned mutex. Since GDB doesn't use
mutexes, that should never occur. */
@@ -213,7 +210,7 @@ static int mingw_console_initialized;
static HANDLE hstdout = INVALID_HANDLE_VALUE;
/* Text attribute to use for normal text (the "none" pseudo-color). */
-static SHORT norm_attr;
+static SHORT norm_attr;
/* The most recently applied style. */
static ui_file_style last_style;
@@ -226,7 +223,7 @@ gdb_console_fputs (const char *linebuf, FILE *fstream)
{
if (!mingw_console_initialized)
{
- hstdout = (HANDLE)_get_osfhandle (fileno (fstream));
+ hstdout = (HANDLE) _get_osfhandle (fileno (fstream));
DWORD cmode;
CONSOLE_SCREEN_BUFFER_INFO csbi;
@@ -247,23 +244,23 @@ gdb_console_fputs (const char *linebuf, FILE *fstream)
/* Mapping between 8 ANSI colors and Windows console attributes. */
static int fg_color[] = {
- 0, /* black */
- FOREGROUND_RED, /* red */
- FOREGROUND_GREEN, /* green */
- FOREGROUND_GREEN | FOREGROUND_RED, /* yellow */
- FOREGROUND_BLUE, /* blue */
- FOREGROUND_BLUE | FOREGROUND_RED, /* magenta */
- FOREGROUND_BLUE | FOREGROUND_GREEN, /* cyan */
+ 0, /* black */
+ FOREGROUND_RED, /* red */
+ FOREGROUND_GREEN, /* green */
+ FOREGROUND_GREEN | FOREGROUND_RED, /* yellow */
+ FOREGROUND_BLUE, /* blue */
+ FOREGROUND_BLUE | FOREGROUND_RED, /* magenta */
+ FOREGROUND_BLUE | FOREGROUND_GREEN, /* cyan */
FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE /* gray */
};
static int bg_color[] = {
- 0, /* black */
- BACKGROUND_RED, /* red */
- BACKGROUND_GREEN, /* green */
- BACKGROUND_GREEN | BACKGROUND_RED, /* yellow */
- BACKGROUND_BLUE, /* blue */
- BACKGROUND_BLUE | BACKGROUND_RED, /* magenta */
- BACKGROUND_BLUE | BACKGROUND_GREEN, /* cyan */
+ 0, /* black */
+ BACKGROUND_RED, /* red */
+ BACKGROUND_GREEN, /* green */
+ BACKGROUND_GREEN | BACKGROUND_RED, /* yellow */
+ BACKGROUND_BLUE, /* blue */
+ BACKGROUND_BLUE | BACKGROUND_RED, /* magenta */
+ BACKGROUND_BLUE | BACKGROUND_GREEN, /* cyan */
BACKGROUND_RED | BACKGROUND_GREEN | BACKGROUND_BLUE /* gray */
};
@@ -271,13 +268,13 @@ gdb_console_fputs (const char *linebuf, FILE *fstream)
unsigned char c;
size_t n_read;
- for ( ; (c = *linebuf) != 0; linebuf += n_read)
+ for (; (c = *linebuf) != 0; linebuf += n_read)
{
if (c == '\033')
{
fflush (fstream);
bool parsed = style.parse (linebuf, &n_read);
- if (n_read <= 0) /* should never happen */
+ if (n_read <= 0) /* should never happen */
n_read = 1;
if (!parsed)
{
@@ -360,8 +357,8 @@ gdb_console_fputs (const char *linebuf, FILE *fstream)
FillConsoleOutputAttribute (hstdout, norm_attr, nchars,
start_pos, &written);
- FillConsoleOutputCharacter (hstdout, ' ', nchars,
- start_pos, &written);
+ FillConsoleOutputCharacter (hstdout, ' ', nchars, start_pos,
+ &written);
}
}
fputc (c, fstream);
diff --git a/gdb/minidebug.c b/gdb/minidebug.c
index 53d34d349ce..c31f2b9c08f 100644
--- a/gdb/minidebug.c
+++ b/gdb/minidebug.c
@@ -96,7 +96,7 @@ lzma_open (struct bfd *nbfd, void *open_closure)
if (size < LZMA_STREAM_HEADER_SIZE
|| bfd_seek (section->owner, offset, SEEK_SET) != 0
|| bfd_bread (footer, LZMA_STREAM_HEADER_SIZE, section->owner)
- != LZMA_STREAM_HEADER_SIZE
+ != LZMA_STREAM_HEADER_SIZE
|| lzma_stream_footer_decode (&options, footer) != LZMA_OK
|| offset < options.backward_size)
{
@@ -110,10 +110,10 @@ lzma_open (struct bfd *nbfd, void *open_closure)
pos = 0;
if (bfd_seek (section->owner, offset, SEEK_SET) != 0
|| bfd_bread (indexdata, options.backward_size, section->owner)
- != options.backward_size
+ != options.backward_size
|| lzma_index_buffer_decode (&index, &memlimit, &gdb_lzma_allocator,
indexdata, &pos, options.backward_size)
- != LZMA_OK
+ != LZMA_OK
|| lzma_index_size (index) != options.backward_size)
{
xfree (indexdata);
@@ -150,8 +150,8 @@ lzma_pread (struct bfd *nbfd, void *stream, void *buf, file_ptr nbytes,
res = 0;
while (nbytes > 0)
{
- if (lstream->data == NULL
- || lstream->data_start > offset || offset >= lstream->data_end)
+ if (lstream->data == NULL || lstream->data_start > offset
+ || offset >= lstream->data_end)
{
asection *section = lstream->section;
@@ -163,7 +163,7 @@ lzma_pread (struct bfd *nbfd, void *stream, void *buf, file_ptr nbytes,
block_offset = section->filepos + iter.block.compressed_file_offset;
if (bfd_seek (section->owner, block_offset, SEEK_SET) != 0
|| bfd_bread (compressed, iter.block.total_size, section->owner)
- != iter.block.total_size)
+ != iter.block.total_size)
{
xfree (compressed);
break;
@@ -174,7 +174,8 @@ lzma_pread (struct bfd *nbfd, void *stream, void *buf, file_ptr nbytes,
memset (&block, 0, sizeof (block));
block.filters = filters;
block.header_size = lzma_block_header_size_decode (compressed[0]);
- if (lzma_block_header_decode (&block, &gdb_lzma_allocator, compressed)
+ if (lzma_block_header_decode (&block, &gdb_lzma_allocator,
+ compressed)
!= LZMA_OK)
{
xfree (compressed);
@@ -186,8 +187,8 @@ lzma_pread (struct bfd *nbfd, void *stream, void *buf, file_ptr nbytes,
uncompressed_pos = 0;
if (lzma_block_buffer_decode (&block, &gdb_lzma_allocator,
compressed, &compressed_pos,
- iter.block.total_size,
- uncompressed, &uncompressed_pos,
+ iter.block.total_size, uncompressed,
+ &uncompressed_pos,
iter.block.uncompressed_size)
!= LZMA_OK)
{
@@ -221,8 +222,7 @@ lzma_pread (struct bfd *nbfd, void *stream, void *buf, file_ptr nbytes,
is 'struct gdb_lzma_stream *'. */
static int
-lzma_close (struct bfd *nbfd,
- void *stream)
+lzma_close (struct bfd *nbfd, void *stream)
{
struct gdb_lzma_stream *lstream = (struct gdb_lzma_stream *) stream;
@@ -239,9 +239,7 @@ lzma_close (struct bfd *nbfd,
is 'struct gdb_lzma_stream *'. */
static int
-lzma_stat (struct bfd *abfd,
- void *stream,
- struct stat *sb)
+lzma_stat (struct bfd *abfd, void *stream, struct stat *sb)
{
struct gdb_lzma_stream *lstream = (struct gdb_lzma_stream *) stream;
@@ -277,25 +275,25 @@ find_separate_debug_file_in_section (struct objfile *objfile)
if (shared != nullptr)
return *shared;
- std::string filename = string_printf (_(".gnu_debugdata for %s"),
- objfile_name (objfile));
+ std::string filename
+ = string_printf (_ (".gnu_debugdata for %s"), objfile_name (objfile));
- abfd = gdb_bfd_openr_iovec (filename.c_str (), gnutarget, lzma_open,
- section, lzma_pread, lzma_close, lzma_stat);
+ abfd = gdb_bfd_openr_iovec (filename.c_str (), gnutarget, lzma_open, section,
+ lzma_pread, lzma_close, lzma_stat);
if (abfd == NULL)
return NULL;
if (!bfd_check_format (abfd.get (), bfd_object))
{
- warning (_("Cannot parse .gnu_debugdata section; not a BFD object"));
+ warning (_ ("Cannot parse .gnu_debugdata section; not a BFD object"));
return NULL;
}
gnu_debug_key.emplace (objfile->obfd.get (), abfd);
#else
- warning (_("Cannot parse .gnu_debugdata section; LZMA support was "
- "disabled at compile time"));
+ warning (_ ("Cannot parse .gnu_debugdata section; LZMA support was "
+ "disabled at compile time"));
#endif /* !HAVE_LIBLZMA */
return abfd;
diff --git a/gdb/minsyms.c b/gdb/minsyms.c
index 02e36cc6dd2..9e57b76d2a9 100644
--- a/gdb/minsyms.c
+++ b/gdb/minsyms.c
@@ -17,7 +17,6 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
-
/* This file contains support routines for creating, manipulating, and
destroying minimal symbol tables.
@@ -35,7 +34,6 @@
between names and addresses, and vice versa. They are also sometimes used
to figure out what full symbol table entries need to be read in. */
-
#include "defs.h"
#include <ctype.h>
#include "symtab.h"
@@ -126,8 +124,8 @@ msymbol_is_function (struct objfile *objfile, minimal_symbol *minsym,
case mst_data_gnu_ifunc:
{
struct gdbarch *gdbarch = objfile->arch ();
- CORE_ADDR pc = gdbarch_convert_from_func_ptr_addr
- (gdbarch, msym_addr, current_inferior ()->top_target ());
+ CORE_ADDR pc = gdbarch_convert_from_func_ptr_addr (
+ gdbarch, msym_addr, current_inferior ()->top_target ());
if (pc != msym_addr)
{
if (func_address_p != NULL)
@@ -154,10 +152,10 @@ msymbol_is_function (struct objfile *objfile, minimal_symbol *minsym,
#define BUNCH_SIZE 127
struct msym_bunch
- {
- struct msym_bunch *next;
- struct minimal_symbol contents[BUNCH_SIZE];
- };
+{
+ struct msym_bunch *next;
+ struct minimal_symbol contents[BUNCH_SIZE];
+};
/* See minsyms.h. */
@@ -216,8 +214,7 @@ add_minsym_to_demangled_hash_table (struct minimal_symbol *sym,
{
objfile->per_bfd->demangled_hash_languages.set (sym->language ());
- struct minimal_symbol **table
- = objfile->per_bfd->msymbol_demangled_hash;
+ struct minimal_symbol **table = objfile->per_bfd->msymbol_demangled_hash;
unsigned int hash_index = hash_value % MINIMAL_SYMBOL_HASH_SIZE;
sym->demangled_hash_next = table[hash_index];
table[hash_index] = sym;
@@ -258,8 +255,7 @@ found_minimal_symbols::maybe_collect (const char *sfile,
case mst_file_text:
case mst_file_data:
case mst_file_bss:
- if (sfile == NULL
- || filename_cmp (msymbol->filename, sfile) == 0)
+ if (sfile == NULL || filename_cmp (msymbol->filename, sfile) == 0)
{
file_symbol.minsym = msymbol;
file_symbol.objfile = objfile;
@@ -295,16 +291,14 @@ found_minimal_symbols::maybe_collect (const char *sfile,
matches LOOKUP_NAME according to NAMECMP to FOUND. */
static void
-lookup_minimal_symbol_mangled (const char *lookup_name,
- const char *sfile,
+lookup_minimal_symbol_mangled (const char *lookup_name, const char *sfile,
struct objfile *objfile,
struct minimal_symbol **table,
unsigned int hash,
int (*namecmp) (const char *, const char *),
found_minimal_symbols &found)
{
- for (minimal_symbol *msymbol = table[hash];
- msymbol != NULL;
+ for (minimal_symbol *msymbol = table[hash]; msymbol != NULL;
msymbol = msymbol->hash_next)
{
const char *symbol_name = msymbol->linkage_name ();
@@ -320,15 +314,13 @@ lookup_minimal_symbol_mangled (const char *lookup_name,
static void
lookup_minimal_symbol_demangled (const lookup_name_info &lookup_name,
- const char *sfile,
- struct objfile *objfile,
+ const char *sfile, struct objfile *objfile,
struct minimal_symbol **table,
unsigned int hash,
symbol_name_matcher_ftype *matcher,
found_minimal_symbols &found)
{
- for (minimal_symbol *msymbol = table[hash];
- msymbol != NULL;
+ for (minimal_symbol *msymbol = table[hash]; msymbol != NULL;
msymbol = msymbol->demangled_hash_next)
{
const char *symbol_name = msymbol->search_name ();
@@ -368,9 +360,7 @@ lookup_minimal_symbol (const char *name, const char *sfile,
unsigned int mangled_hash = msymbol_hash (name) % MINIMAL_SYMBOL_HASH_SIZE;
auto *mangled_cmp
- = (case_sensitivity == case_sensitive_on
- ? strcmp
- : strcasecmp);
+ = (case_sensitivity == case_sensitive_on ? strcmp : strcasecmp);
if (sfile != NULL)
sfile = lbasename (sfile);
@@ -406,13 +396,12 @@ lookup_minimal_symbol (const char *name, const char *sfile,
continue;
enum language lang = (enum language) iter;
- unsigned int hash
- = (lookup_name.search_name_hash (lang)
- % MINIMAL_SYMBOL_HASH_SIZE);
+ unsigned int hash = (lookup_name.search_name_hash (lang)
+ % MINIMAL_SYMBOL_HASH_SIZE);
symbol_name_matcher_ftype *match
- = language_def (lang)->get_symbol_name_matcher
- (lookup_name);
+ = language_def (lang)->get_symbol_name_matcher (
+ lookup_name);
struct minimal_symbol **msymbol_demangled_hash
= objfile->per_bfd->msymbol_demangled_hash;
@@ -434,9 +423,9 @@ lookup_minimal_symbol (const char *name, const char *sfile,
{
minimal_symbol *minsym = found.external_symbol.minsym;
- symbol_lookup_debug_printf
- ("lookup_minimal_symbol (...) = %s (external)",
- host_address_to_string (minsym));
+ symbol_lookup_debug_printf (
+ "lookup_minimal_symbol (...) = %s (external)",
+ host_address_to_string (minsym));
}
return found.external_symbol;
}
@@ -448,9 +437,9 @@ lookup_minimal_symbol (const char *name, const char *sfile,
{
minimal_symbol *minsym = found.file_symbol.minsym;
- symbol_lookup_debug_printf
- ("lookup_minimal_symbol (...) = %s (file-local)",
- host_address_to_string (minsym));
+ symbol_lookup_debug_printf (
+ "lookup_minimal_symbol (...) = %s (file-local)",
+ host_address_to_string (minsym));
}
return found.file_symbol;
}
@@ -462,9 +451,9 @@ lookup_minimal_symbol (const char *name, const char *sfile,
{
minimal_symbol *minsym = found.trampoline_symbol.minsym;
- symbol_lookup_debug_printf
- ("lookup_minimal_symbol (...) = %s (trampoline)",
- host_address_to_string (minsym));
+ symbol_lookup_debug_printf (
+ "lookup_minimal_symbol (...) = %s (trampoline)",
+ host_address_to_string (minsym));
}
return found.trampoline_symbol;
@@ -520,28 +509,25 @@ linkage_name_str (const lookup_name_info &lookup_name)
/* See minsyms.h. */
void
-iterate_over_minimal_symbols
- (struct objfile *objf, const lookup_name_info &lookup_name,
- gdb::function_view<bool (struct minimal_symbol *)> callback)
+iterate_over_minimal_symbols (
+ struct objfile *objf, const lookup_name_info &lookup_name,
+ gdb::function_view<bool (struct minimal_symbol *)> callback)
{
/* The first pass is over the ordinary hash table. */
- {
- const char *name = linkage_name_str (lookup_name);
- unsigned int hash = msymbol_hash (name) % MINIMAL_SYMBOL_HASH_SIZE;
- auto *mangled_cmp
- = (case_sensitivity == case_sensitive_on
- ? strcmp
- : strcasecmp);
-
- for (minimal_symbol *iter = objf->per_bfd->msymbol_hash[hash];
- iter != NULL;
- iter = iter->hash_next)
- {
- if (mangled_cmp (iter->linkage_name (), name) == 0)
- if (callback (iter))
- return;
- }
- }
+ {
+ const char *name = linkage_name_str (lookup_name);
+ unsigned int hash = msymbol_hash (name) % MINIMAL_SYMBOL_HASH_SIZE;
+ auto *mangled_cmp
+ = (case_sensitivity == case_sensitive_on ? strcmp : strcasecmp);
+
+ for (minimal_symbol *iter = objf->per_bfd->msymbol_hash[hash];
+ iter != NULL; iter = iter->hash_next)
+ {
+ if (mangled_cmp (iter->linkage_name (), name) == 0)
+ if (callback (iter))
+ return;
+ }
+ }
/* The second pass is over the demangled table. Once for each
language in the demangled hash names table (usually just zero or
@@ -559,8 +545,7 @@ iterate_over_minimal_symbols
unsigned int hash
= lookup_name.search_name_hash (lang) % MINIMAL_SYMBOL_HASH_SIZE;
for (minimal_symbol *iter = objf->per_bfd->msymbol_demangled_hash[hash];
- iter != NULL;
- iter = iter->demangled_hash_next)
+ iter != NULL; iter = iter->demangled_hash_next)
if (name_match (iter->search_name (), lookup_name, NULL))
if (callback (iter))
return;
@@ -577,13 +562,11 @@ lookup_minimal_symbol_linkage (const char *name, struct objfile *objf)
for (objfile *objfile : objf->separate_debug_objfiles ())
{
for (minimal_symbol *msymbol = objfile->per_bfd->msymbol_hash[hash];
- msymbol != NULL;
- msymbol = msymbol->hash_next)
+ msymbol != NULL; msymbol = msymbol->hash_next)
{
if (strcmp (msymbol->linkage_name (), name) == 0
- && (msymbol->type () == mst_data
- || msymbol->type () == mst_bss))
- return {msymbol, objfile};
+ && (msymbol->type () == mst_data || msymbol->type () == mst_bss))
+ return { msymbol, objfile };
}
}
@@ -613,10 +596,10 @@ lookup_minimal_symbol_text (const char *name, struct objfile *objf)
msymbol != NULL && found_symbol.minsym == NULL;
msymbol = msymbol->hash_next)
{
- if (strcmp (msymbol->linkage_name (), name) == 0 &&
- (msymbol->type () == mst_text
- || msymbol->type () == mst_text_gnu_ifunc
- || msymbol->type () == mst_file_text))
+ if (strcmp (msymbol->linkage_name (), name) == 0
+ && (msymbol->type () == mst_text
+ || msymbol->type () == mst_text_gnu_ifunc
+ || msymbol->type () == mst_file_text))
{
switch (msymbol->type ())
{
@@ -656,8 +639,7 @@ lookup_minimal_symbol_by_pc_name (CORE_ADDR pc, const char *name,
if (objf == NULL || objf == objfile
|| objf == objfile->separate_debug_objfile_backlink)
{
- for (msymbol = objfile->per_bfd->msymbol_hash[hash];
- msymbol != NULL;
+ for (msymbol = objfile->per_bfd->msymbol_hash[hash]; msymbol != NULL;
msymbol = msymbol->hash_next)
{
if (msymbol->value_address (objfile) == pc
@@ -722,7 +704,8 @@ msym_prefer_to_msym_type (lookup_msym_prefer prefer)
.data at 0x40048. */
bound_minimal_symbol
-lookup_minimal_symbol_by_pc_section (CORE_ADDR pc_in, struct obj_section *section,
+lookup_minimal_symbol_by_pc_section (CORE_ADDR pc_in,
+ struct obj_section *section,
lookup_msym_prefer prefer,
bound_minimal_symbol *previous)
{
@@ -848,9 +831,8 @@ lookup_minimal_symbol_by_pc_section (CORE_ADDR pc_in, struct obj_section *sectio
don't fill the bfd_section member, so don't
throw away symbols on those platforms. */
&& msymbol[hi].obj_section (objfile) != nullptr
- && (!matching_obj_sections
- (msymbol[hi].obj_section (objfile),
- section)))
+ && (!matching_obj_sections (
+ msymbol[hi].obj_section (objfile), section)))
{
hi--;
continue;
@@ -860,8 +842,7 @@ lookup_minimal_symbol_by_pc_section (CORE_ADDR pc_in, struct obj_section *sectio
text symbol, or the other way around, check the
preceding symbol too. If they are otherwise
identical prefer that one. */
- if (hi > 0
- && msymbol[hi].type () != want_type
+ if (hi > 0 && msymbol[hi].type () != want_type
&& msymbol[hi - 1].type () == want_type
&& (msymbol[hi].size () == msymbol[hi - 1].size ())
&& (msymbol[hi].value_raw_address ()
@@ -892,8 +873,7 @@ lookup_minimal_symbol_by_pc_section (CORE_ADDR pc_in, struct obj_section *sectio
size. This happens on i686-pc-linux-gnu with glibc;
the nocancel variants of system calls are inside
the cancellable variants, but both have sizes. */
- if (hi > 0
- && msymbol[hi].size () != 0
+ if (hi > 0 && msymbol[hi].size () != 0
&& pc >= (msymbol[hi].value_raw_address ()
+ msymbol[hi].size ())
&& pc < (msymbol[hi - 1].value_raw_address ()
@@ -924,8 +904,7 @@ lookup_minimal_symbol_by_pc_section (CORE_ADDR pc_in, struct obj_section *sectio
use that instead. We assume that if symbols have
specified sizes, they do not overlap. */
- if (hi >= 0
- && msymbol[hi].size () != 0
+ if (hi >= 0 && msymbol[hi].size () != 0
&& pc >= (msymbol[hi].value_raw_address ()
+ msymbol[hi].size ()))
{
@@ -955,9 +934,9 @@ lookup_minimal_symbol_by_pc_section (CORE_ADDR pc_in, struct obj_section *sectio
overall. */
if (hi >= 0
- && ((best_symbol == NULL) ||
- (best_symbol->value_raw_address () <
- msymbol[hi].value_raw_address ())))
+ && ((best_symbol == NULL)
+ || (best_symbol->value_raw_address ()
+ < msymbol[hi].value_raw_address ())))
{
best_symbol = &msymbol[hi];
best_objfile = objfile;
@@ -995,8 +974,8 @@ in_gnu_ifunc_stub (CORE_ADDR pc)
static CORE_ADDR
stub_gnu_ifunc_resolve_addr (struct gdbarch *gdbarch, CORE_ADDR pc)
{
- error (_("GDB cannot resolve STT_GNU_IFUNC symbol at address %s without "
- "the ELF support compiled in."),
+ error (_ ("GDB cannot resolve STT_GNU_IFUNC symbol at address %s without "
+ "the ELF support compiled in."),
paddress (gdbarch, pc));
}
@@ -1006,8 +985,8 @@ static bool
stub_gnu_ifunc_resolve_name (const char *function_name,
CORE_ADDR *function_address_p)
{
- error (_("GDB cannot resolve STT_GNU_IFUNC symbol \"%s\" without "
- "the ELF support compiled in."),
+ error (_ ("GDB cannot resolve STT_GNU_IFUNC symbol \"%s\" without "
+ "the ELF support compiled in."),
function_name);
}
@@ -1016,7 +995,7 @@ stub_gnu_ifunc_resolve_name (const char *function_name,
static void
stub_gnu_ifunc_resolver_stop (code_breakpoint *b)
{
- internal_error (_("elf_gnu_ifunc_resolver_stop cannot be reached."));
+ internal_error (_ ("elf_gnu_ifunc_resolver_stop cannot be reached."));
}
/* See elf_gnu_ifunc_resolver_return_stop for its real implementation. */
@@ -1024,13 +1003,12 @@ stub_gnu_ifunc_resolver_stop (code_breakpoint *b)
static void
stub_gnu_ifunc_resolver_return_stop (code_breakpoint *b)
{
- internal_error (_("elf_gnu_ifunc_resolver_return_stop cannot be reached."));
+ internal_error (_ ("elf_gnu_ifunc_resolver_return_stop cannot be reached."));
}
/* See elf_gnu_ifunc_fns for its real implementation. */
-static const struct gnu_ifunc_fns stub_gnu_ifunc_fns =
-{
+static const struct gnu_ifunc_fns stub_gnu_ifunc_fns = {
stub_gnu_ifunc_resolve_addr,
stub_gnu_ifunc_resolve_name,
stub_gnu_ifunc_resolver_stop,
@@ -1041,8 +1019,6 @@ static const struct gnu_ifunc_fns stub_gnu_ifunc_fns =
const struct gnu_ifunc_fns *gnu_ifunc_fns_p = &stub_gnu_ifunc_fns;
-
-
/* Return leading symbol character for a BFD. If BFD is NULL,
return the leading symbol character from the main objfile. */
@@ -1063,13 +1039,13 @@ get_symbol_leading_char (bfd *abfd)
/* See minsyms.h. */
minimal_symbol_reader::minimal_symbol_reader (struct objfile *obj)
-: m_objfile (obj),
- m_msym_bunch (NULL),
- /* Note that presetting m_msym_bunch_index to BUNCH_SIZE causes the
+ : m_objfile (obj),
+ m_msym_bunch (NULL),
+ /* Note that presetting m_msym_bunch_index to BUNCH_SIZE causes the
first call to save a minimal symbol to allocate the memory for
the first bunch. */
- m_msym_bunch_index (BUNCH_SIZE),
- m_msym_count (0)
+ m_msym_bunch_index (BUNCH_SIZE),
+ m_msym_count (0)
{
}
@@ -1127,32 +1103,34 @@ minimal_symbol_reader::record (const char *name, CORE_ADDR address,
static const char *
mst_str (minimal_symbol_type t)
{
-#define MST_TO_STR(x) case x: return #x;
+#define MST_TO_STR(x) \
+ case x: \
+ return #x;
switch (t)
- {
- MST_TO_STR (mst_unknown);
- MST_TO_STR (mst_text);
- MST_TO_STR (mst_text_gnu_ifunc);
- MST_TO_STR (mst_slot_got_plt);
- MST_TO_STR (mst_data);
- MST_TO_STR (mst_bss);
- MST_TO_STR (mst_abs);
- MST_TO_STR (mst_solib_trampoline);
- MST_TO_STR (mst_file_text);
- MST_TO_STR (mst_file_data);
- MST_TO_STR (mst_file_bss);
+ {
+ MST_TO_STR (mst_unknown);
+ MST_TO_STR (mst_text);
+ MST_TO_STR (mst_text_gnu_ifunc);
+ MST_TO_STR (mst_slot_got_plt);
+ MST_TO_STR (mst_data);
+ MST_TO_STR (mst_bss);
+ MST_TO_STR (mst_abs);
+ MST_TO_STR (mst_solib_trampoline);
+ MST_TO_STR (mst_file_text);
+ MST_TO_STR (mst_file_data);
+ MST_TO_STR (mst_file_bss);
default:
return "mst_???";
- }
+ }
#undef MST_TO_STR
}
/* See minsyms.h. */
struct minimal_symbol *
-minimal_symbol_reader::record_full (gdb::string_view name,
- bool copy_name, CORE_ADDR address,
+minimal_symbol_reader::record_full (gdb::string_view name, bool copy_name,
+ CORE_ADDR address,
enum minimal_symbol_type ms_type,
int section)
{
@@ -1178,8 +1156,8 @@ minimal_symbol_reader::record_full (gdb::string_view name,
return (NULL);
symtab_create_debug_printf_v ("recording minsym: %-21s %18s %4d %.*s",
- mst_str (ms_type), hex_string (address), section,
- (int) name.size (), name.data ());
+ mst_str (ms_type), hex_string (address),
+ section, (int) name.size (), name.data ());
if (m_msym_bunch_index == BUNCH_SIZE)
{
@@ -1189,8 +1167,7 @@ minimal_symbol_reader::record_full (gdb::string_view name,
m_msym_bunch = newobj;
}
msymbol = &m_msym_bunch->contents[m_msym_bunch_index];
- msymbol->set_language (language_auto,
- &m_objfile->per_bfd->storage_obstack);
+ msymbol->set_language (language_auto, &m_objfile->per_bfd->storage_obstack);
if (copy_name)
msymbol->m_name = obstack_strndup (&m_objfile->per_bfd->storage_obstack,
@@ -1224,11 +1201,11 @@ minimal_symbol_is_less_than (const minimal_symbol &fn1,
{
if ((&fn1)->value_raw_address () < (&fn2)->value_raw_address ())
{
- return true; /* addr 1 is less than addr 2. */
+ return true; /* addr 1 is less than addr 2. */
}
else if ((&fn1)->value_raw_address () > (&fn2)->value_raw_address ())
{
- return false; /* addr 1 is greater than addr 2. */
+ return false; /* addr 1 is greater than addr 2. */
}
else
/* addrs are equal: sort by name */
@@ -1236,14 +1213,14 @@ minimal_symbol_is_less_than (const minimal_symbol &fn1,
const char *name1 = fn1.linkage_name ();
const char *name2 = fn2.linkage_name ();
- if (name1 && name2) /* both have names */
+ if (name1 && name2) /* both have names */
return strcmp (name1, name2) < 0;
else if (name2)
- return true; /* fn1 has no name, so it is "less". */
- else if (name1) /* fn2 has no name, so it is "less". */
+ return true; /* fn1 has no name, so it is "less". */
+ else if (name1) /* fn2 has no name, so it is "less". */
return false;
else
- return false; /* Neither has a name, so they're equal. */
+ return false; /* Neither has a name, so they're equal. */
}
}
@@ -1287,11 +1264,12 @@ compact_minimal_symbols (struct minimal_symbol *msymbol, int mcount,
while (copyfrom < msymbol + mcount - 1)
{
if (copyfrom->value_raw_address ()
- == (copyfrom + 1)->value_raw_address ()
+ == (copyfrom + 1)->value_raw_address ()
&& (copyfrom->section_index ()
== (copyfrom + 1)->section_index ())
&& strcmp (copyfrom->linkage_name (),
- (copyfrom + 1)->linkage_name ()) == 0)
+ (copyfrom + 1)->linkage_name ())
+ == 0)
{
if ((copyfrom + 1)->type () == mst_unknown)
(copyfrom + 1)->set_type (copyfrom->type ());
@@ -1334,20 +1312,18 @@ struct computed_hash_values
/* Build (or rebuild) the minimal symbol hash tables. This is necessary
after compacting or sorting the table since the entries move around
thus causing the internal minimal_symbol pointers to become jumbled. */
-
+
static void
-build_minimal_symbol_hash_tables
- (struct objfile *objfile,
- const std::vector<computed_hash_values>& hash_values)
+build_minimal_symbol_hash_tables (
+ struct objfile *objfile,
+ const std::vector<computed_hash_values> &hash_values)
{
int i;
struct minimal_symbol *msym;
/* (Re)insert the actual entries. */
int mcount = objfile->per_bfd->minimal_symbol_count;
- for ((i = 0,
- msym = objfile->per_bfd->msymbols.get ());
- i < mcount;
+ for ((i = 0, msym = objfile->per_bfd->msymbols.get ()); i < mcount;
i++, msym++)
{
msym->hash_next = 0;
@@ -1356,8 +1332,8 @@ build_minimal_symbol_hash_tables
msym->demangled_hash_next = 0;
if (msym->search_name () != msym->linkage_name ())
- add_minsym_to_demangled_hash_table
- (msym, objfile, hash_values[i].minsym_demangled_hash);
+ add_minsym_to_demangled_hash_table (
+ msym, objfile, hash_values[i].minsym_demangled_hash);
}
}
@@ -1380,8 +1356,9 @@ minimal_symbol_reader::install ()
if (m_msym_count > 0)
{
- symtab_create_debug_printf ("installing %d minimal symbols of objfile %s",
- m_msym_count, objfile_name (m_objfile));
+ symtab_create_debug_printf (
+ "installing %d minimal symbols of objfile %s", m_msym_count,
+ objfile_name (m_objfile));
/* Allocate enough space, into which we will gather the bunches
of new and existing minimal symbols, sort them, and then
@@ -1389,8 +1366,8 @@ minimal_symbol_reader::install ()
table, we will give back the excess space. */
alloc_count = m_msym_count + m_objfile->per_bfd->minimal_symbol_count;
- gdb::unique_xmalloc_ptr<minimal_symbol>
- msym_holder (XNEWVEC (minimal_symbol, alloc_count));
+ gdb::unique_xmalloc_ptr<minimal_symbol> msym_holder (
+ XNEWVEC (minimal_symbol, alloc_count));
msymbols = msym_holder.get ();
/* Copy in the existing minimal symbols, if there are any. */
@@ -1398,7 +1375,7 @@ minimal_symbol_reader::install ()
if (m_objfile->per_bfd->minimal_symbol_count)
memcpy (msymbols, m_objfile->per_bfd->msymbols.get (),
m_objfile->per_bfd->minimal_symbol_count
- * sizeof (struct minimal_symbol));
+ * sizeof (struct minimal_symbol));
/* Walk through the list of minimal symbol bunches, adding each symbol
to the new contiguous array of symbols. Note that we start with the
@@ -1425,8 +1402,7 @@ minimal_symbol_reader::install ()
mcount = compact_minimal_symbols (msymbols, mcount, m_objfile);
msym_holder.reset (XRESIZEVEC (struct minimal_symbol,
- msym_holder.release (),
- mcount));
+ msym_holder.release (), mcount));
/* Attach the minimal symbol table to the specified objfile.
The strings themselves are also located in the storage_obstack
@@ -1449,55 +1425,53 @@ minimal_symbol_reader::install ()
msymbols = m_objfile->per_bfd->msymbols.get ();
/* Arbitrarily require at least 10 elements in a thread. */
gdb::parallel_for_each (10, &msymbols[0], &msymbols[mcount],
- [&] (minimal_symbol *start, minimal_symbol *end)
- {
- for (minimal_symbol *msym = start; msym < end; ++msym)
- {
- size_t idx = msym - msymbols;
- hash_values[idx].name_length = strlen (msym->linkage_name ());
- if (!msym->name_set)
- {
- /* This will be freed later, by compute_and_set_names. */
- gdb::unique_xmalloc_ptr<char> demangled_name
- = symbol_find_demangled_name (msym, msym->linkage_name ());
- msym->set_demangled_name
- (demangled_name.release (),
- &m_objfile->per_bfd->storage_obstack);
- msym->name_set = 1;
- }
- /* This mangled_name_hash computation has to be outside of
+ [&] (minimal_symbol *start,
+ minimal_symbol *end) {
+ for (minimal_symbol *msym = start; msym < end; ++msym)
+ {
+ size_t idx = msym - msymbols;
+ hash_values[idx].name_length = strlen (msym->linkage_name ());
+ if (!msym->name_set)
+ {
+ /* This will be freed later, by compute_and_set_names. */
+ gdb::unique_xmalloc_ptr<char> demangled_name
+ = symbol_find_demangled_name (msym, msym->linkage_name ());
+ msym->set_demangled_name (
+ demangled_name.release (),
+ &m_objfile->per_bfd->storage_obstack);
+ msym->name_set = 1;
+ }
+ /* This mangled_name_hash computation has to be outside of
the name_set check, or compute_and_set_names below will
be called with an invalid hash value. */
- hash_values[idx].mangled_name_hash
- = fast_hash (msym->linkage_name (),
- hash_values[idx].name_length);
- hash_values[idx].minsym_hash
- = msymbol_hash (msym->linkage_name ());
- /* We only use this hash code if the search name differs
+ hash_values[idx].mangled_name_hash
+ = fast_hash (msym->linkage_name (),
+ hash_values[idx].name_length);
+ hash_values[idx].minsym_hash
+ = msymbol_hash (msym->linkage_name ());
+ /* We only use this hash code if the search name differs
from the linkage name. See the code in
build_minimal_symbol_hash_tables. */
- if (msym->search_name () != msym->linkage_name ())
- hash_values[idx].minsym_demangled_hash
- = search_name_hash (msym->language (), msym->search_name ());
- }
- {
- /* To limit how long we hold the lock, we only acquire it here
+ if (msym->search_name () != msym->linkage_name ())
+ hash_values[idx].minsym_demangled_hash
+ = search_name_hash (msym->language (), msym->search_name ());
+ }
+ {
+ /* To limit how long we hold the lock, we only acquire it here
and not while we demangle the names above. */
#if CXX_STD_THREAD
- std::lock_guard<std::mutex> guard (demangled_mutex);
+ std::lock_guard<std::mutex> guard (demangled_mutex);
#endif
- for (minimal_symbol *msym = start; msym < end; ++msym)
- {
- size_t idx = msym - msymbols;
- msym->compute_and_set_names
- (gdb::string_view (msym->linkage_name (),
- hash_values[idx].name_length),
- false,
- m_objfile->per_bfd,
- hash_values[idx].mangled_name_hash);
- }
- }
- });
+ for (minimal_symbol *msym = start; msym < end; ++msym)
+ {
+ size_t idx = msym - msymbols;
+ msym->compute_and_set_names (
+ gdb::string_view (msym->linkage_name (),
+ hash_values[idx].name_length),
+ false, m_objfile->per_bfd, hash_values[idx].mangled_name_hash);
+ }
+ }
+ });
build_minimal_symbol_hash_tables (m_objfile, hash_values);
}
@@ -1548,7 +1522,8 @@ find_solib_trampoline_target (frame_info_ptr frame, CORE_ADDR pc)
|| msymbol->type () == mst_data
|| msymbol->type () == mst_data_gnu_ifunc)
&& strcmp (msymbol->linkage_name (),
- tsymbol->linkage_name ()) == 0)
+ tsymbol->linkage_name ())
+ == 0)
{
CORE_ADDR func;
@@ -1593,16 +1568,14 @@ minimal_symbol_upper_bound (struct bound_minimal_symbol minsym)
section = msymbol->section_index ();
for (iter = msymbol + 1; iter != past_the_end; ++iter)
{
- if ((iter->value_raw_address ()
- != msymbol->value_raw_address ())
+ if ((iter->value_raw_address () != msymbol->value_raw_address ())
&& iter->section_index () == section)
break;
}
obj_section = minsym.obj_section ();
if (iter != past_the_end
- && (iter->value_address (minsym.objfile)
- < obj_section->endaddr ()))
+ && (iter->value_address (minsym.objfile) < obj_section->endaddr ()))
result = iter->value_address (minsym.objfile);
else
/* We got the start address from the last msymbol in the objfile.
diff --git a/gdb/minsyms.h b/gdb/minsyms.h
index e9081495eb1..0f954128173 100644
--- a/gdb/minsyms.h
+++ b/gdb/minsyms.h
@@ -83,7 +83,7 @@ struct msym_bunch;
they are being read. */
class minimal_symbol_reader
{
- public:
+public:
/* Prepare to start collecting minimal symbols. This should be
called by a symbol reader to initialize the minimal symbol
@@ -118,8 +118,7 @@ class minimal_symbol_reader
SECTION - the symbol's section
*/
- struct minimal_symbol *record_full (gdb::string_view name,
- bool copy_name,
+ struct minimal_symbol *record_full (gdb::string_view name, bool copy_name,
CORE_ADDR address,
enum minimal_symbol_type ms_type,
int section);
@@ -141,13 +140,12 @@ class minimal_symbol_reader
This variant does not return the new symbol. */
void record_with_info (const char *name, CORE_ADDR address,
- enum minimal_symbol_type ms_type,
- int section)
+ enum minimal_symbol_type ms_type, int section)
{
record_full (name, true, address, ms_type, section);
}
- private:
+private:
DISABLE_COPY_AND_ASSIGN (minimal_symbol_reader);
@@ -168,15 +166,12 @@ class minimal_symbol_reader
int m_msym_count;
};
-
-
/* Return whether MSYMBOL is a function/method. If FUNC_ADDRESS_P is
non-NULL, and the MSYMBOL is a function, then *FUNC_ADDRESS_P is
set to the function's address, already resolved if MINSYM points to
a function descriptor. */
-bool msymbol_is_function (struct objfile *objfile,
- minimal_symbol *minsym,
+bool msymbol_is_function (struct objfile *objfile, minimal_symbol *minsym,
CORE_ADDR *func_address_p = NULL);
/* Compute a hash code for the string argument. Unlike htab_hash_string,
@@ -193,10 +188,8 @@ unsigned int msymbol_hash_iw (const char *);
is only a GDB in-memory computed value with no external files compatibility
requirements. */
-#define SYMBOL_HASH_NEXT(hash, c) \
- ((hash) * 67 + TOLOWER ((unsigned char) (c)) - 113)
-
-
+#define SYMBOL_HASH_NEXT(hash, c) \
+ ((hash) *67 + TOLOWER ((unsigned char) (c)) - 113)
/* Look through all the current minimal symbol tables and find the
first minimal symbol that matches NAME. If OBJF is non-NULL, limit
@@ -205,8 +198,7 @@ unsigned int msymbol_hash_iw (const char *);
symbols are still preferred). Returns a bound minimal symbol that
matches, or an empty bound minimal symbol if no match is found. */
-struct bound_minimal_symbol lookup_minimal_symbol (const char *,
- const char *,
+struct bound_minimal_symbol lookup_minimal_symbol (const char *, const char *,
struct objfile *);
/* Like lookup_minimal_symbol, but searches all files and
@@ -232,8 +224,8 @@ struct bound_minimal_symbol lookup_minimal_symbol_text (const char *,
objfile is not accepted. Returns a bound minimal symbol that
matches, or an "empty" bound minimal symbol otherwise. */
-extern struct bound_minimal_symbol lookup_minimal_symbol_linkage
- (const char *name, struct objfile *objf)
+extern struct bound_minimal_symbol
+lookup_minimal_symbol_linkage (const char *name, struct objfile *objf)
ATTRIBUTE_NONNULL (1) ATTRIBUTE_NONNULL (2);
/* Look through all the current minimal symbol tables and find the
@@ -241,8 +233,8 @@ extern struct bound_minimal_symbol lookup_minimal_symbol_linkage
limit the search to that objfile. Returns a pointer to the minimal
symbol that matches, or NULL if no match is found. */
-struct minimal_symbol *lookup_minimal_symbol_by_pc_name
- (CORE_ADDR, const char *, struct objfile *);
+struct minimal_symbol *
+lookup_minimal_symbol_by_pc_name (CORE_ADDR, const char *, struct objfile *);
enum class lookup_msym_prefer
{
@@ -279,11 +271,10 @@ enum class lookup_msym_prefer
then the contents will be set to reference the closest symbol before
PC_IN. */
-struct bound_minimal_symbol lookup_minimal_symbol_by_pc_section
- (CORE_ADDR pc_in,
- struct obj_section *section,
- lookup_msym_prefer prefer = lookup_msym_prefer::TEXT,
- bound_minimal_symbol *previous = nullptr);
+struct bound_minimal_symbol lookup_minimal_symbol_by_pc_section (
+ CORE_ADDR pc_in, struct obj_section *section,
+ lookup_msym_prefer prefer = lookup_msym_prefer::TEXT,
+ bound_minimal_symbol *previous = nullptr);
/* Backward compatibility: search through the minimal symbol table
for a matching PC (no section given).
@@ -300,9 +291,9 @@ struct bound_minimal_symbol lookup_minimal_symbol_by_pc (CORE_ADDR);
For each matching symbol, CALLBACK is called with the symbol. */
-void iterate_over_minimal_symbols
- (struct objfile *objf, const lookup_name_info &name,
- gdb::function_view<bool (struct minimal_symbol *)> callback);
+void iterate_over_minimal_symbols (
+ struct objfile *objf, const lookup_name_info &name,
+ gdb::function_view<bool (struct minimal_symbol *)> callback);
/* Compute the upper bound of MINSYM. The upper bound is the last
address thought to be part of the symbol. If the symbol has a
diff --git a/gdb/mips-fbsd-nat.c b/gdb/mips-fbsd-nat.c
index 46fdc370f31..2d237a1810c 100644
--- a/gdb/mips-fbsd-nat.c
+++ b/gdb/mips-fbsd-nat.c
@@ -44,8 +44,7 @@ static mips_fbsd_nat_target the_mips_fbsd_nat_target;
static bool
getregs_supplies (struct gdbarch *gdbarch, int regnum)
{
- return (regnum >= MIPS_ZERO_REGNUM
- && regnum <= mips_regnum (gdbarch)->pc);
+ return (regnum >= MIPS_ZERO_REGNUM && regnum <= mips_regnum (gdbarch)->pc);
}
/* Determine if PT_GETFPREGS fetches REGNUM. */
@@ -71,7 +70,7 @@ mips_fbsd_nat_target::fetch_registers (struct regcache *regcache, int regnum)
struct reg regs;
if (ptrace (PT_GETREGS, pid, (PTRACE_TYPE_ARG3) &regs, 0) == -1)
- perror_with_name (_("Couldn't get registers"));
+ perror_with_name (_ ("Couldn't get registers"));
mips_fbsd_supply_gregs (regcache, regnum, &regs, sizeof (register_t));
}
@@ -81,7 +80,7 @@ mips_fbsd_nat_target::fetch_registers (struct regcache *regcache, int regnum)
struct fpreg fpregs;
if (ptrace (PT_GETFPREGS, pid, (PTRACE_TYPE_ARG3) &fpregs, 0) == -1)
- perror_with_name (_("Couldn't get floating point status"));
+ perror_with_name (_ ("Couldn't get floating point status"));
mips_fbsd_supply_fpregs (regcache, regnum, &fpregs,
sizeof (f_register_t));
@@ -102,13 +101,13 @@ mips_fbsd_nat_target::store_registers (struct regcache *regcache, int regnum)
struct reg regs;
if (ptrace (PT_GETREGS, pid, (PTRACE_TYPE_ARG3) &regs, 0) == -1)
- perror_with_name (_("Couldn't get registers"));
+ perror_with_name (_ ("Couldn't get registers"));
mips_fbsd_collect_gregs (regcache, regnum, (char *) &regs,
sizeof (register_t));
if (ptrace (PT_SETREGS, pid, (PTRACE_TYPE_ARG3) &regs, 0) == -1)
- perror_with_name (_("Couldn't write registers"));
+ perror_with_name (_ ("Couldn't write registers"));
}
if (regnum == -1 || getfpregs_supplies (gdbarch, regnum))
@@ -116,17 +115,18 @@ mips_fbsd_nat_target::store_registers (struct regcache *regcache, int regnum)
struct fpreg fpregs;
if (ptrace (PT_GETFPREGS, pid, (PTRACE_TYPE_ARG3) &fpregs, 0) == -1)
- perror_with_name (_("Couldn't get floating point status"));
+ perror_with_name (_ ("Couldn't get floating point status"));
mips_fbsd_collect_fpregs (regcache, regnum, (char *) &fpregs,
sizeof (f_register_t));
if (ptrace (PT_SETFPREGS, pid, (PTRACE_TYPE_ARG3) &fpregs, 0) == -1)
- perror_with_name (_("Couldn't write floating point status"));
+ perror_with_name (_ ("Couldn't write floating point status"));
}
}
void _initialize_mips_fbsd_nat ();
+
void
_initialize_mips_fbsd_nat ()
{
diff --git a/gdb/mips-fbsd-tdep.c b/gdb/mips-fbsd-tdep.c
index 9966fa80741..fe08733ebb2 100644
--- a/gdb/mips-fbsd-tdep.c
+++ b/gdb/mips-fbsd-tdep.c
@@ -35,13 +35,13 @@
first 38 follow the standard MIPS layout. The 39th holds
IC_INT_REG on RM7K and RM9K processors. The 40th is a dummy for
padding. */
-#define MIPS_FBSD_NUM_GREGS 40
+#define MIPS_FBSD_NUM_GREGS 40
/* Number of registers in `struct fpreg' from <machine/reg.h>. The
first 32 hold floating point registers. 33 holds the FSR. The
34th holds FIR on FreeBSD 12.0 and newer kernels. On older kernels
it was a zero-filled dummy for padding. */
-#define MIPS_FBSD_NUM_FPREGS 34
+#define MIPS_FBSD_NUM_FPREGS 34
/* Supply a single register. The register size might not match, so use
regcache->raw_supply_integer (). */
@@ -78,15 +78,15 @@ mips_fbsd_supply_fpregs (struct regcache *regcache, int regnum,
fp0num = mips_regnum (gdbarch)->fp0;
for (i = 0; i <= 32; i++)
if (regnum == fp0num + i || regnum == -1)
- mips_fbsd_supply_reg (regcache, fp0num + i,
- regs + i * regsize, regsize);
+ mips_fbsd_supply_reg (regcache, fp0num + i, regs + i * regsize, regsize);
if (regnum == mips_regnum (gdbarch)->fp_control_status || regnum == -1)
mips_fbsd_supply_reg (regcache, mips_regnum (gdbarch)->fp_control_status,
regs + 32 * regsize, regsize);
if ((regnum == mips_regnum (gdbarch)->fp_implementation_revision
|| regnum == -1)
&& extract_unsigned_integer (regs + 33 * regsize, regsize,
- gdbarch_byte_order (gdbarch)) != 0)
+ gdbarch_byte_order (gdbarch))
+ != 0)
mips_fbsd_supply_reg (regcache,
mips_regnum (gdbarch)->fp_implementation_revision,
regs + 33 * regsize, regsize);
@@ -124,8 +124,8 @@ mips_fbsd_collect_fpregs (const struct regcache *regcache, int regnum,
fp0num = mips_regnum (gdbarch)->fp0;
for (i = 0; i < 32; i++)
if (regnum == fp0num + i || regnum == -1)
- mips_fbsd_collect_reg (regcache, fp0num + i,
- regs + i * regsize, regsize);
+ mips_fbsd_collect_reg (regcache, fp0num + i, regs + i * regsize,
+ regsize);
if (regnum == mips_regnum (gdbarch)->fp_control_status || regnum == -1)
mips_fbsd_collect_reg (regcache, mips_regnum (gdbarch)->fp_control_status,
regs + 32 * regsize, regsize);
@@ -159,8 +159,8 @@ mips_fbsd_collect_gregs (const struct regcache *regcache, int regnum,
static void
mips_fbsd_supply_fpregset (const struct regset *regset,
- struct regcache *regcache,
- int regnum, const void *fpregs, size_t len)
+ struct regcache *regcache, int regnum,
+ const void *fpregs, size_t len)
{
size_t regsize = mips_abi_regsize (regcache->arch ());
@@ -176,8 +176,8 @@ mips_fbsd_supply_fpregset (const struct regset *regset,
static void
mips_fbsd_collect_fpregset (const struct regset *regset,
- const struct regcache *regcache,
- int regnum, void *fpregs, size_t len)
+ const struct regcache *regcache, int regnum,
+ void *fpregs, size_t len)
{
size_t regsize = mips_abi_regsize (regcache->arch ());
@@ -209,8 +209,8 @@ mips_fbsd_supply_gregset (const struct regset *regset,
static void
mips_fbsd_collect_gregset (const struct regset *regset,
- const struct regcache *regcache,
- int regnum, void *gregs, size_t len)
+ const struct regcache *regcache, int regnum,
+ void *gregs, size_t len)
{
size_t regsize = mips_abi_regsize (regcache->arch ());
@@ -221,15 +221,13 @@ mips_fbsd_collect_gregset (const struct regset *regset,
/* FreeBSD/mips register sets. */
-static const struct regset mips_fbsd_gregset =
-{
+static const struct regset mips_fbsd_gregset = {
NULL,
mips_fbsd_supply_gregset,
mips_fbsd_collect_gregset,
};
-static const struct regset mips_fbsd_fpregset =
-{
+static const struct regset mips_fbsd_fpregset = {
NULL,
mips_fbsd_supply_fpregset,
mips_fbsd_collect_fpregset,
@@ -253,31 +251,30 @@ mips_fbsd_iterate_over_regset_sections (struct gdbarch *gdbarch,
/* Signal trampoline support. */
-#define FBSD_SYS_sigreturn 417
+#define FBSD_SYS_sigreturn 417
#define MIPS_INST_LI_V0_SIGRETURN 0x24020000 + FBSD_SYS_sigreturn
-#define MIPS_INST_SYSCALL 0x0000000c
-#define MIPS_INST_BREAK 0x0000000d
+#define MIPS_INST_SYSCALL 0x0000000c
+#define MIPS_INST_BREAK 0x0000000d
-#define O32_SIGFRAME_UCONTEXT_OFFSET (16)
-#define O32_SIGSET_T_SIZE (16)
+#define O32_SIGFRAME_UCONTEXT_OFFSET (16)
+#define O32_SIGSET_T_SIZE (16)
-#define O32_UCONTEXT_ONSTACK (O32_SIGSET_T_SIZE)
-#define O32_UCONTEXT_PC (O32_UCONTEXT_ONSTACK + 4)
-#define O32_UCONTEXT_REGS (O32_UCONTEXT_PC + 4)
-#define O32_UCONTEXT_SR (O32_UCONTEXT_REGS + 4 * 32)
-#define O32_UCONTEXT_LO (O32_UCONTEXT_SR + 4)
-#define O32_UCONTEXT_HI (O32_UCONTEXT_LO + 4)
-#define O32_UCONTEXT_FPUSED (O32_UCONTEXT_HI + 4)
-#define O32_UCONTEXT_FPREGS (O32_UCONTEXT_FPUSED + 4)
+#define O32_UCONTEXT_ONSTACK (O32_SIGSET_T_SIZE)
+#define O32_UCONTEXT_PC (O32_UCONTEXT_ONSTACK + 4)
+#define O32_UCONTEXT_REGS (O32_UCONTEXT_PC + 4)
+#define O32_UCONTEXT_SR (O32_UCONTEXT_REGS + 4 * 32)
+#define O32_UCONTEXT_LO (O32_UCONTEXT_SR + 4)
+#define O32_UCONTEXT_HI (O32_UCONTEXT_LO + 4)
+#define O32_UCONTEXT_FPUSED (O32_UCONTEXT_HI + 4)
+#define O32_UCONTEXT_FPREGS (O32_UCONTEXT_FPUSED + 4)
-#define O32_UCONTEXT_REG_SIZE 4
+#define O32_UCONTEXT_REG_SIZE 4
static void
mips_fbsd_sigframe_init (const struct tramp_frame *self,
frame_info_ptr this_frame,
- struct trad_frame_cache *cache,
- CORE_ADDR func)
+ struct trad_frame_cache *cache, CORE_ADDR func)
{
struct gdbarch *gdbarch = get_frame_arch (this_frame);
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
@@ -293,39 +290,32 @@ mips_fbsd_sigframe_init (const struct tramp_frame *self,
/* PC. */
regnum = mips_regnum (gdbarch)->pc;
- trad_frame_set_reg_addr (cache,
- regnum + gdbarch_num_regs (gdbarch),
+ trad_frame_set_reg_addr (cache, regnum + gdbarch_num_regs (gdbarch),
ucontext_addr + O32_UCONTEXT_PC);
/* GPRs. */
for (regnum = MIPS_ZERO_REGNUM, addr = ucontext_addr + O32_UCONTEXT_REGS;
regnum <= MIPS_RA_REGNUM; regnum++, addr += O32_UCONTEXT_REG_SIZE)
- trad_frame_set_reg_addr (cache,
- regnum + gdbarch_num_regs (gdbarch),
- addr);
+ trad_frame_set_reg_addr (cache, regnum + gdbarch_num_regs (gdbarch), addr);
regnum = MIPS_PS_REGNUM;
- trad_frame_set_reg_addr (cache,
- regnum + gdbarch_num_regs (gdbarch),
+ trad_frame_set_reg_addr (cache, regnum + gdbarch_num_regs (gdbarch),
ucontext_addr + O32_UCONTEXT_SR);
/* HI and LO. */
regnum = mips_regnum (gdbarch)->lo;
- trad_frame_set_reg_addr (cache,
- regnum + gdbarch_num_regs (gdbarch),
+ trad_frame_set_reg_addr (cache, regnum + gdbarch_num_regs (gdbarch),
ucontext_addr + O32_UCONTEXT_LO);
regnum = mips_regnum (gdbarch)->hi;
- trad_frame_set_reg_addr (cache,
- regnum + gdbarch_num_regs (gdbarch),
+ trad_frame_set_reg_addr (cache, regnum + gdbarch_num_regs (gdbarch),
ucontext_addr + O32_UCONTEXT_HI);
if (target_read_memory (ucontext_addr + O32_UCONTEXT_FPUSED, buf, 4) == 0
&& extract_unsigned_integer (buf, 4, byte_order) != 0)
{
- for (regnum = 0, addr = ucontext_addr + O32_UCONTEXT_FPREGS;
- regnum < 32; regnum++, addr += O32_UCONTEXT_REG_SIZE)
- trad_frame_set_reg_addr (cache,
- regnum + gdbarch_fp0_regnum (gdbarch),
+ for (regnum = 0, addr = ucontext_addr + O32_UCONTEXT_FPREGS; regnum < 32;
+ regnum++, addr += O32_UCONTEXT_REG_SIZE)
+ trad_frame_set_reg_addr (cache, regnum + gdbarch_fp0_regnum (gdbarch),
addr);
trad_frame_set_reg_addr (cache, mips_regnum (gdbarch)->fp_control_status,
addr);
@@ -334,42 +324,38 @@ mips_fbsd_sigframe_init (const struct tramp_frame *self,
trad_frame_set_id (cache, frame_id_build (sp, func));
}
-#define MIPS_INST_ADDIU_A0_SP_O32 (0x27a40000 \
- + O32_SIGFRAME_UCONTEXT_OFFSET)
+#define MIPS_INST_ADDIU_A0_SP_O32 (0x27a40000 + O32_SIGFRAME_UCONTEXT_OFFSET)
-static const struct tramp_frame mips_fbsd_sigframe =
-{
+static const struct tramp_frame mips_fbsd_sigframe = {
SIGTRAMP_FRAME,
MIPS_INSN32_SIZE,
- {
- { MIPS_INST_ADDIU_A0_SP_O32, ULONGEST_MAX }, /* addiu a0, sp, SIGF_UC */
- { MIPS_INST_LI_V0_SIGRETURN, ULONGEST_MAX }, /* li v0, SYS_sigreturn */
- { MIPS_INST_SYSCALL, ULONGEST_MAX }, /* syscall */
- { MIPS_INST_BREAK, ULONGEST_MAX }, /* break */
- { TRAMP_SENTINEL_INSN, ULONGEST_MAX }
- },
+ { { MIPS_INST_ADDIU_A0_SP_O32, ULONGEST_MAX }, /* addiu a0, sp, SIGF_UC */
+ { MIPS_INST_LI_V0_SIGRETURN,
+ ULONGEST_MAX }, /* li v0, SYS_sigreturn */
+ { MIPS_INST_SYSCALL, ULONGEST_MAX }, /* syscall */
+ { MIPS_INST_BREAK, ULONGEST_MAX }, /* break */
+ { TRAMP_SENTINEL_INSN, ULONGEST_MAX } },
mips_fbsd_sigframe_init
};
-#define N64_SIGFRAME_UCONTEXT_OFFSET (32)
-#define N64_SIGSET_T_SIZE (16)
+#define N64_SIGFRAME_UCONTEXT_OFFSET (32)
+#define N64_SIGSET_T_SIZE (16)
-#define N64_UCONTEXT_ONSTACK (N64_SIGSET_T_SIZE)
-#define N64_UCONTEXT_PC (N64_UCONTEXT_ONSTACK + 8)
-#define N64_UCONTEXT_REGS (N64_UCONTEXT_PC + 8)
-#define N64_UCONTEXT_SR (N64_UCONTEXT_REGS + 8 * 32)
-#define N64_UCONTEXT_LO (N64_UCONTEXT_SR + 8)
-#define N64_UCONTEXT_HI (N64_UCONTEXT_LO + 8)
-#define N64_UCONTEXT_FPUSED (N64_UCONTEXT_HI + 8)
-#define N64_UCONTEXT_FPREGS (N64_UCONTEXT_FPUSED + 8)
+#define N64_UCONTEXT_ONSTACK (N64_SIGSET_T_SIZE)
+#define N64_UCONTEXT_PC (N64_UCONTEXT_ONSTACK + 8)
+#define N64_UCONTEXT_REGS (N64_UCONTEXT_PC + 8)
+#define N64_UCONTEXT_SR (N64_UCONTEXT_REGS + 8 * 32)
+#define N64_UCONTEXT_LO (N64_UCONTEXT_SR + 8)
+#define N64_UCONTEXT_HI (N64_UCONTEXT_LO + 8)
+#define N64_UCONTEXT_FPUSED (N64_UCONTEXT_HI + 8)
+#define N64_UCONTEXT_FPREGS (N64_UCONTEXT_FPUSED + 8)
-#define N64_UCONTEXT_REG_SIZE 8
+#define N64_UCONTEXT_REG_SIZE 8
static void
mips64_fbsd_sigframe_init (const struct tramp_frame *self,
frame_info_ptr this_frame,
- struct trad_frame_cache *cache,
- CORE_ADDR func)
+ struct trad_frame_cache *cache, CORE_ADDR func)
{
struct gdbarch *gdbarch = get_frame_arch (this_frame);
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
@@ -385,39 +371,32 @@ mips64_fbsd_sigframe_init (const struct tramp_frame *self,
/* PC. */
regnum = mips_regnum (gdbarch)->pc;
- trad_frame_set_reg_addr (cache,
- regnum + gdbarch_num_regs (gdbarch),
+ trad_frame_set_reg_addr (cache, regnum + gdbarch_num_regs (gdbarch),
ucontext_addr + N64_UCONTEXT_PC);
/* GPRs. */
for (regnum = MIPS_ZERO_REGNUM, addr = ucontext_addr + N64_UCONTEXT_REGS;
regnum <= MIPS_RA_REGNUM; regnum++, addr += N64_UCONTEXT_REG_SIZE)
- trad_frame_set_reg_addr (cache,
- regnum + gdbarch_num_regs (gdbarch),
- addr);
+ trad_frame_set_reg_addr (cache, regnum + gdbarch_num_regs (gdbarch), addr);
regnum = MIPS_PS_REGNUM;
- trad_frame_set_reg_addr (cache,
- regnum + gdbarch_num_regs (gdbarch),
+ trad_frame_set_reg_addr (cache, regnum + gdbarch_num_regs (gdbarch),
ucontext_addr + N64_UCONTEXT_SR);
/* HI and LO. */
regnum = mips_regnum (gdbarch)->lo;
- trad_frame_set_reg_addr (cache,
- regnum + gdbarch_num_regs (gdbarch),
+ trad_frame_set_reg_addr (cache, regnum + gdbarch_num_regs (gdbarch),
ucontext_addr + N64_UCONTEXT_LO);
regnum = mips_regnum (gdbarch)->hi;
- trad_frame_set_reg_addr (cache,
- regnum + gdbarch_num_regs (gdbarch),
+ trad_frame_set_reg_addr (cache, regnum + gdbarch_num_regs (gdbarch),
ucontext_addr + N64_UCONTEXT_HI);
if (target_read_memory (ucontext_addr + N64_UCONTEXT_FPUSED, buf, 4) == 0
&& extract_unsigned_integer (buf, 4, byte_order) != 0)
{
- for (regnum = 0, addr = ucontext_addr + N64_UCONTEXT_FPREGS;
- regnum < 32; regnum++, addr += N64_UCONTEXT_REG_SIZE)
- trad_frame_set_reg_addr (cache,
- regnum + gdbarch_fp0_regnum (gdbarch),
+ for (regnum = 0, addr = ucontext_addr + N64_UCONTEXT_FPREGS; regnum < 32;
+ regnum++, addr += N64_UCONTEXT_REG_SIZE)
+ trad_frame_set_reg_addr (cache, regnum + gdbarch_fp0_regnum (gdbarch),
addr);
trad_frame_set_reg_addr (cache, mips_regnum (gdbarch)->fp_control_status,
addr);
@@ -426,37 +405,31 @@ mips64_fbsd_sigframe_init (const struct tramp_frame *self,
trad_frame_set_id (cache, frame_id_build (sp, func));
}
-#define MIPS_INST_ADDIU_A0_SP_N32 (0x27a40000 \
- + N64_SIGFRAME_UCONTEXT_OFFSET)
+#define MIPS_INST_ADDIU_A0_SP_N32 (0x27a40000 + N64_SIGFRAME_UCONTEXT_OFFSET)
-static const struct tramp_frame mipsn32_fbsd_sigframe =
-{
+static const struct tramp_frame mipsn32_fbsd_sigframe = {
SIGTRAMP_FRAME,
MIPS_INSN32_SIZE,
- {
- { MIPS_INST_ADDIU_A0_SP_N32, ULONGEST_MAX }, /* addiu a0, sp, SIGF_UC */
- { MIPS_INST_LI_V0_SIGRETURN, ULONGEST_MAX }, /* li v0, SYS_sigreturn */
- { MIPS_INST_SYSCALL, ULONGEST_MAX }, /* syscall */
- { MIPS_INST_BREAK, ULONGEST_MAX }, /* break */
- { TRAMP_SENTINEL_INSN, ULONGEST_MAX }
- },
+ { { MIPS_INST_ADDIU_A0_SP_N32, ULONGEST_MAX }, /* addiu a0, sp, SIGF_UC */
+ { MIPS_INST_LI_V0_SIGRETURN,
+ ULONGEST_MAX }, /* li v0, SYS_sigreturn */
+ { MIPS_INST_SYSCALL, ULONGEST_MAX }, /* syscall */
+ { MIPS_INST_BREAK, ULONGEST_MAX }, /* break */
+ { TRAMP_SENTINEL_INSN, ULONGEST_MAX } },
mips64_fbsd_sigframe_init
};
-#define MIPS_INST_DADDIU_A0_SP_N64 (0x67a40000 \
- + N64_SIGFRAME_UCONTEXT_OFFSET)
+#define MIPS_INST_DADDIU_A0_SP_N64 (0x67a40000 + N64_SIGFRAME_UCONTEXT_OFFSET)
-static const struct tramp_frame mips64_fbsd_sigframe =
-{
+static const struct tramp_frame mips64_fbsd_sigframe = {
SIGTRAMP_FRAME,
MIPS_INSN32_SIZE,
- {
- { MIPS_INST_DADDIU_A0_SP_N64, ULONGEST_MAX }, /* daddiu a0, sp, SIGF_UC */
- { MIPS_INST_LI_V0_SIGRETURN, ULONGEST_MAX }, /* li v0, SYS_sigreturn */
- { MIPS_INST_SYSCALL, ULONGEST_MAX }, /* syscall */
- { MIPS_INST_BREAK, ULONGEST_MAX }, /* break */
- { TRAMP_SENTINEL_INSN, ULONGEST_MAX }
- },
+ { { MIPS_INST_DADDIU_A0_SP_N64, ULONGEST_MAX }, /* daddiu a0, sp, SIGF_UC */
+ { MIPS_INST_LI_V0_SIGRETURN,
+ ULONGEST_MAX }, /* li v0, SYS_sigreturn */
+ { MIPS_INST_SYSCALL, ULONGEST_MAX }, /* syscall */
+ { MIPS_INST_BREAK, ULONGEST_MAX }, /* break */
+ { TRAMP_SENTINEL_INSN, ULONGEST_MAX } },
mips64_fbsd_sigframe_init
};
@@ -548,30 +521,31 @@ mips_fbsd_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
switch (abi)
{
- case MIPS_ABI_O32:
- tramp_frame_prepend_unwinder (gdbarch, &mips_fbsd_sigframe);
- break;
- case MIPS_ABI_N32:
- tramp_frame_prepend_unwinder (gdbarch, &mipsn32_fbsd_sigframe);
- break;
- case MIPS_ABI_N64:
- tramp_frame_prepend_unwinder (gdbarch, &mips64_fbsd_sigframe);
- break;
+ case MIPS_ABI_O32:
+ tramp_frame_prepend_unwinder (gdbarch, &mips_fbsd_sigframe);
+ break;
+ case MIPS_ABI_N32:
+ tramp_frame_prepend_unwinder (gdbarch, &mipsn32_fbsd_sigframe);
+ break;
+ case MIPS_ABI_N64:
+ tramp_frame_prepend_unwinder (gdbarch, &mips64_fbsd_sigframe);
+ break;
}
- set_gdbarch_iterate_over_regset_sections
- (gdbarch, mips_fbsd_iterate_over_regset_sections);
+ set_gdbarch_iterate_over_regset_sections (
+ gdbarch, mips_fbsd_iterate_over_regset_sections);
set_gdbarch_skip_solib_resolver (gdbarch, mips_fbsd_skip_solib_resolver);
/* FreeBSD/mips has SVR4-style shared libraries. */
- set_solib_svr4_fetch_link_map_offsets
- (gdbarch, (gdbarch_ptr_bit (gdbarch) == 32 ?
- mips_fbsd_ilp32_fetch_link_map_offsets :
- mips_fbsd_lp64_fetch_link_map_offsets));
+ set_solib_svr4_fetch_link_map_offsets (
+ gdbarch,
+ (gdbarch_ptr_bit (gdbarch) == 32 ? mips_fbsd_ilp32_fetch_link_map_offsets
+ : mips_fbsd_lp64_fetch_link_map_offsets));
}
void _initialize_mips_fbsd_tdep ();
+
void
_initialize_mips_fbsd_tdep ()
{
diff --git a/gdb/mips-linux-nat.c b/gdb/mips-linux-nat.c
index 972b5db8e76..3de4ce0453d 100644
--- a/gdb/mips-linux-nat.c
+++ b/gdb/mips-linux-nat.c
@@ -45,6 +45,7 @@
class mips_linux_nat_target final : public linux_nat_trad_target
{
public:
+
/* Add our register access methods. */
void fetch_registers (struct regcache *, int) override;
void store_registers (struct regcache *, int) override;
@@ -68,19 +69,19 @@ public:
const struct target_desc *read_description () override;
protected:
+
/* Override linux_nat_trad_target methods. */
- CORE_ADDR register_u_offset (struct gdbarch *gdbarch,
- int regno, int store_p) override;
+ CORE_ADDR register_u_offset (struct gdbarch *gdbarch, int regno,
+ int store_p) override;
/* Override linux_nat_target low methods. */
void low_new_thread (struct lwp_info *lp) override;
private:
+
/* Helpers. See definitions. */
- void mips64_regsets_store_registers (struct regcache *regcache,
- int regno);
- void mips64_regsets_fetch_registers (struct regcache *regcache,
- int regno);
+ void mips64_regsets_store_registers (struct regcache *regcache, int regno);
+ void mips64_regsets_fetch_registers (struct regcache *regcache, int regno);
};
static mips_linux_nat_target the_mips_linux_nat_target;
@@ -102,7 +103,7 @@ mips_linux_register_addr (struct gdbarch *gdbarch, int regno, int store)
CORE_ADDR regaddr;
if (regno < 0 || regno >= gdbarch_num_regs (gdbarch))
- error (_("Bogon register number %d."), regno);
+ error (_ ("Bogon register number %d."), regno);
if (regno > MIPS_ZERO_REGNUM && regno < MIPS_ZERO_REGNUM + 32)
regaddr = regno;
@@ -112,9 +113,9 @@ mips_linux_register_addr (struct gdbarch *gdbarch, int regno, int store)
else if (regno == mips_regnum (gdbarch)->pc)
regaddr = PC;
else if (regno == mips_regnum (gdbarch)->cause)
- regaddr = store? (CORE_ADDR) -1 : CAUSE;
+ regaddr = store ? (CORE_ADDR) -1 : CAUSE;
else if (regno == mips_regnum (gdbarch)->badvaddr)
- regaddr = store? (CORE_ADDR) -1 : BADVADDR;
+ regaddr = store ? (CORE_ADDR) -1 : BADVADDR;
else if (regno == mips_regnum (gdbarch)->lo)
regaddr = MMLO;
else if (regno == mips_regnum (gdbarch)->hi)
@@ -122,7 +123,7 @@ mips_linux_register_addr (struct gdbarch *gdbarch, int regno, int store)
else if (regno == mips_regnum (gdbarch)->fp_control_status)
regaddr = FPC_CSR;
else if (regno == mips_regnum (gdbarch)->fp_implementation_revision)
- regaddr = store? (CORE_ADDR) -1 : FPC_EIR;
+ regaddr = store ? (CORE_ADDR) -1 : FPC_EIR;
else if (mips_regnum (gdbarch)->dspacc != -1
&& regno >= mips_regnum (gdbarch)->dspacc
&& regno < mips_regnum (gdbarch)->dspacc + 6)
@@ -143,7 +144,7 @@ mips64_linux_register_addr (struct gdbarch *gdbarch, int regno, int store)
CORE_ADDR regaddr;
if (regno < 0 || regno >= gdbarch_num_regs (gdbarch))
- error (_("Bogon register number %d."), regno);
+ error (_ ("Bogon register number %d."), regno);
/* On n32 we can't access 64-bit registers via PTRACE_PEEKUSR
or PTRACE_POKEUSR. */
@@ -158,9 +159,9 @@ mips64_linux_register_addr (struct gdbarch *gdbarch, int regno, int store)
else if (regno == mips_regnum (gdbarch)->pc)
regaddr = MIPS64_PC;
else if (regno == mips_regnum (gdbarch)->cause)
- regaddr = store? (CORE_ADDR) -1 : MIPS64_CAUSE;
+ regaddr = store ? (CORE_ADDR) -1 : MIPS64_CAUSE;
else if (regno == mips_regnum (gdbarch)->badvaddr)
- regaddr = store? (CORE_ADDR) -1 : MIPS64_BADVADDR;
+ regaddr = store ? (CORE_ADDR) -1 : MIPS64_BADVADDR;
else if (regno == mips_regnum (gdbarch)->lo)
regaddr = MIPS64_MMLO;
else if (regno == mips_regnum (gdbarch)->hi)
@@ -168,7 +169,7 @@ mips64_linux_register_addr (struct gdbarch *gdbarch, int regno, int store)
else if (regno == mips_regnum (gdbarch)->fp_control_status)
regaddr = MIPS64_FPC_CSR;
else if (regno == mips_regnum (gdbarch)->fp_implementation_revision)
- regaddr = store? (CORE_ADDR) -1 : MIPS64_FPC_EIR;
+ regaddr = store ? (CORE_ADDR) -1 : MIPS64_FPC_EIR;
else if (mips_regnum (gdbarch)->dspacc != -1
&& regno >= mips_regnum (gdbarch)->dspacc
&& regno < mips_regnum (gdbarch)->dspacc + 6)
@@ -186,8 +187,8 @@ mips64_linux_register_addr (struct gdbarch *gdbarch, int regno, int store)
/* Fetch the thread-local storage pointer for libthread_db. */
ps_err_e
-ps_get_thread_area (struct ps_prochandle *ph,
- lwpid_t lwpid, int idx, void **base)
+ps_get_thread_area (struct ps_prochandle *ph, lwpid_t lwpid, int idx,
+ void **base)
{
if (ptrace (PTRACE_GET_THREAD_AREA, lwpid, NULL, base) != 0)
return PS_ERR;
@@ -195,7 +196,7 @@ ps_get_thread_area (struct ps_prochandle *ph,
/* IDX is the bias from the thread pointer to the beginning of the
thread descriptor. It has to be subtracted due to implementation
quirks in libthread_db. */
- *base = (void *) ((char *)*base - idx);
+ *base = (void *) ((char *) *base - idx);
return PS_OK;
}
@@ -212,8 +213,8 @@ supply_gregset (struct regcache *regcache, const gdb_gregset_t *gregsetp)
}
void
-fill_gregset (const struct regcache *regcache,
- gdb_gregset_t *gregsetp, int regno)
+fill_gregset (const struct regcache *regcache, gdb_gregset_t *gregsetp,
+ int regno)
{
if (mips_isa_regsize (regcache->arch ()) == 4)
mips_fill_gregset (regcache, (mips_elf_gregset_t *) gregsetp, regno);
@@ -228,19 +229,18 @@ supply_fpregset (struct regcache *regcache, const gdb_fpregset_t *fpregsetp)
}
void
-fill_fpregset (const struct regcache *regcache,
- gdb_fpregset_t *fpregsetp, int regno)
+fill_fpregset (const struct regcache *regcache, gdb_fpregset_t *fpregsetp,
+ int regno)
{
mips64_fill_fpregset (regcache, (mips64_elf_fpregset_t *) fpregsetp, regno);
}
-
/* Fetch REGNO (or all registers if REGNO == -1) from the target
using PTRACE_GETREGS et al. */
void
-mips_linux_nat_target::mips64_regsets_fetch_registers
- (struct regcache *regcache, int regno)
+mips_linux_nat_target::mips64_regsets_fetch_registers (
+ struct regcache *regcache, int regno)
{
struct gdbarch *gdbarch = regcache->arch ();
int is_fp, is_dsp;
@@ -263,7 +263,7 @@ mips_linux_nat_target::mips64_regsets_fetch_registers
if (!have_dsp)
is_dsp = 0;
else if (regno >= mips_regnum (gdbarch)->dspacc
- && regno < mips_regnum (gdbarch)->dspacc + 6)
+ && regno < mips_regnum (gdbarch)->dspacc + 6)
is_dsp = 1;
else if (regno == mips_regnum (gdbarch)->dspctl)
is_dsp = 1;
@@ -283,26 +283,25 @@ mips_linux_nat_target::mips64_regsets_fetch_registers
have_ptrace_regsets = 0;
return;
}
- perror_with_name (_("Couldn't get registers"));
+ perror_with_name (_ ("Couldn't get registers"));
}
- mips64_supply_gregset (regcache,
- (const mips64_elf_gregset_t *) &regs);
+ mips64_supply_gregset (regcache, (const mips64_elf_gregset_t *) &regs);
}
if (regno == -1 || is_fp)
{
mips64_elf_fpregset_t fp_regs;
- if (ptrace (PTRACE_GETFPREGS, tid, 0L,
- (PTRACE_TYPE_ARG3) &fp_regs) == -1)
+ if (ptrace (PTRACE_GETFPREGS, tid, 0L, (PTRACE_TYPE_ARG3) &fp_regs)
+ == -1)
{
if (errno == EIO)
{
have_ptrace_regsets = 0;
return;
}
- perror_with_name (_("Couldn't get FP registers"));
+ perror_with_name (_ ("Couldn't get FP registers"));
}
mips64_supply_fpregset (regcache,
@@ -314,8 +313,7 @@ mips_linux_nat_target::mips64_regsets_fetch_registers
else if (regno == -1 && have_dsp)
{
for (regi = mips_regnum (gdbarch)->dspacc;
- regi < mips_regnum (gdbarch)->dspacc + 6;
- regi++)
+ regi < mips_regnum (gdbarch)->dspacc + 6; regi++)
linux_nat_trad_target::fetch_registers (regcache, regi);
linux_nat_trad_target::fetch_registers (regcache,
mips_regnum (gdbarch)->dspctl);
@@ -326,8 +324,8 @@ mips_linux_nat_target::mips64_regsets_fetch_registers
using PTRACE_SETREGS et al. */
void
-mips_linux_nat_target::mips64_regsets_store_registers
- (struct regcache *regcache, int regno)
+mips_linux_nat_target::mips64_regsets_store_registers (
+ struct regcache *regcache, int regno)
{
struct gdbarch *gdbarch = regcache->arch ();
int is_fp, is_dsp;
@@ -350,7 +348,7 @@ mips_linux_nat_target::mips64_regsets_store_registers
if (!have_dsp)
is_dsp = 0;
else if (regno >= mips_regnum (gdbarch)->dspacc
- && regno < mips_regnum (gdbarch)->dspacc + 6)
+ && regno < mips_regnum (gdbarch)->dspacc + 6)
is_dsp = 1;
else if (regno == mips_regnum (gdbarch)->dspctl)
is_dsp = 1;
@@ -364,27 +362,27 @@ mips_linux_nat_target::mips64_regsets_store_registers
mips64_elf_gregset_t regs;
if (ptrace (PTRACE_GETREGS, tid, 0L, (PTRACE_TYPE_ARG3) &regs) == -1)
- perror_with_name (_("Couldn't get registers"));
+ perror_with_name (_ ("Couldn't get registers"));
mips64_fill_gregset (regcache, &regs, regno);
if (ptrace (PTRACE_SETREGS, tid, 0L, (PTRACE_TYPE_ARG3) &regs) == -1)
- perror_with_name (_("Couldn't set registers"));
+ perror_with_name (_ ("Couldn't set registers"));
}
if (regno == -1 || is_fp)
{
mips64_elf_fpregset_t fp_regs;
- if (ptrace (PTRACE_GETFPREGS, tid, 0L,
- (PTRACE_TYPE_ARG3) &fp_regs) == -1)
- perror_with_name (_("Couldn't get FP registers"));
+ if (ptrace (PTRACE_GETFPREGS, tid, 0L, (PTRACE_TYPE_ARG3) &fp_regs)
+ == -1)
+ perror_with_name (_ ("Couldn't get FP registers"));
mips64_fill_fpregset (regcache, &fp_regs, regno);
- if (ptrace (PTRACE_SETFPREGS, tid, 0L,
- (PTRACE_TYPE_ARG3) &fp_regs) == -1)
- perror_with_name (_("Couldn't set FP registers"));
+ if (ptrace (PTRACE_SETFPREGS, tid, 0L, (PTRACE_TYPE_ARG3) &fp_regs)
+ == -1)
+ perror_with_name (_ ("Couldn't set FP registers"));
}
if (is_dsp)
@@ -392,8 +390,7 @@ mips_linux_nat_target::mips64_regsets_store_registers
else if (regno == -1 && have_dsp)
{
for (regi = mips_regnum (gdbarch)->dspacc;
- regi < mips_regnum (gdbarch)->dspacc + 6;
- regi++)
+ regi < mips_regnum (gdbarch)->dspacc + 6; regi++)
linux_nat_trad_target::store_registers (regcache, regi);
linux_nat_trad_target::store_registers (regcache,
mips_regnum (gdbarch)->dspctl);
@@ -442,8 +439,8 @@ mips_linux_nat_target::store_registers (struct regcache *regcache, int regnum)
REGNO. */
CORE_ADDR
-mips_linux_nat_target::register_u_offset (struct gdbarch *gdbarch,
- int regno, int store_p)
+mips_linux_nat_target::register_u_offset (struct gdbarch *gdbarch, int regno,
+ int store_p)
{
if (mips_abi_regsize (gdbarch) == 8)
return mips64_linux_register_addr (gdbarch, regno, store_p);
@@ -471,7 +468,7 @@ mips_linux_nat_target::read_description ()
have_dsp = 0;
break;
default:
- perror_with_name (_("Couldn't check DSP support"));
+ perror_with_name (_ ("Couldn't check DSP support"));
break;
}
}
@@ -503,49 +500,48 @@ static struct mips_watchpoint *current_watches;
static struct pt_watch_regs watch_mirror;
static void
-mips_show_dr (const char *func, CORE_ADDR addr,
- int len, enum target_hw_bp_type type)
+mips_show_dr (const char *func, CORE_ADDR addr, int len,
+ enum target_hw_bp_type type)
{
int i;
gdb_puts (func, gdb_stdlog);
if (addr || len)
- gdb_printf (gdb_stdlog,
- " (addr=%s, len=%d, type=%s)",
+ gdb_printf (gdb_stdlog, " (addr=%s, len=%d, type=%s)",
paddress (target_gdbarch (), addr), len,
- type == hw_write ? "data-write"
- : (type == hw_read ? "data-read"
- : (type == hw_access ? "data-read/write"
- : (type == hw_execute ? "instruction-execute"
- : "??unknown??"))));
+ type == hw_write
+ ? "data-write"
+ : (type == hw_read
+ ? "data-read"
+ : (type == hw_access
+ ? "data-read/write"
+ : (type == hw_execute ? "instruction-execute"
+ : "??unknown??"))));
gdb_puts (":\n", gdb_stdlog);
for (i = 0; i < MAX_DEBUG_REGISTER; i++)
gdb_printf (gdb_stdlog, "\tDR%d: lo=%s, hi=%s\n", i,
paddress (target_gdbarch (),
- mips_linux_watch_get_watchlo (&watch_mirror,
- i)),
+ mips_linux_watch_get_watchlo (&watch_mirror, i)),
paddress (target_gdbarch (),
- mips_linux_watch_get_watchhi (&watch_mirror,
- i)));
+ mips_linux_watch_get_watchhi (&watch_mirror, i)));
}
/* Target to_can_use_hw_breakpoint implementation. Return 1 if we can
handle the specified watch type. */
int
-mips_linux_nat_target::can_use_hw_breakpoint (enum bptype type,
- int cnt, int ot)
+mips_linux_nat_target::can_use_hw_breakpoint (enum bptype type, int cnt,
+ int ot)
{
int i;
uint32_t wanted_mask, irw_mask;
- if (!mips_linux_read_watch_registers (inferior_ptid.lwp (),
- &watch_readback,
+ if (!mips_linux_read_watch_registers (inferior_ptid.lwp (), &watch_readback,
&watch_readback_valid, 0))
return 0;
- switch (type)
+ switch (type)
{
case bp_hardware_watchpoint:
wanted_mask = W_MASK;
@@ -559,10 +555,8 @@ mips_linux_nat_target::can_use_hw_breakpoint (enum bptype type,
default:
return 0;
}
-
- for (i = 0;
- i < mips_linux_watch_get_num_valid (&watch_readback) && cnt;
- i++)
+
+ for (i = 0; i < mips_linux_watch_get_num_valid (&watch_readback) && cnt; i++)
{
irw_mask = mips_linux_watch_get_irw_mask (&watch_readback, i);
if ((irw_mask & wanted_mask) == wanted_mask)
@@ -581,8 +575,7 @@ mips_linux_nat_target::stopped_by_watchpoint ()
int n;
int num_valid;
- if (!mips_linux_read_watch_registers (inferior_ptid.lwp (),
- &watch_readback,
+ if (!mips_linux_read_watch_registers (inferior_ptid.lwp (), &watch_readback,
&watch_readback_valid, 1))
return false;
@@ -616,8 +609,7 @@ mips_linux_nat_target::region_ok_for_hw_watchpoint (CORE_ADDR addr, int len)
struct pt_watch_regs dummy_regs;
int i;
- if (!mips_linux_read_watch_registers (inferior_ptid.lwp (),
- &watch_readback,
+ if (!mips_linux_read_watch_registers (inferior_ptid.lwp (), &watch_readback,
&watch_readback_valid, 0))
return 0;
@@ -637,7 +629,7 @@ write_watchpoint_regs (void)
{
int tid = lp->ptid.lwp ();
if (ptrace (PTRACE_SET_WATCH_REGS, tid, &watch_mirror, NULL) == -1)
- perror_with_name (_("Couldn't write debug register"));
+ perror_with_name (_ ("Couldn't write debug register"));
}
return 0;
}
@@ -650,13 +642,12 @@ mips_linux_nat_target::low_new_thread (struct lwp_info *lp)
{
long tid = lp->ptid.lwp ();
- if (!mips_linux_read_watch_registers (tid,
- &watch_readback,
+ if (!mips_linux_read_watch_registers (tid, &watch_readback,
&watch_readback_valid, 0))
return;
if (ptrace (PTRACE_SET_WATCH_REGS, tid, &watch_mirror, NULL) == -1)
- perror_with_name (_("Couldn't write debug register"));
+ perror_with_name (_ ("Couldn't write debug register"));
}
/* Target to_insert_watchpoint implementation. Try to insert a new
@@ -673,8 +664,7 @@ mips_linux_nat_target::insert_watchpoint (CORE_ADDR addr, int len,
int retval;
- if (!mips_linux_read_watch_registers (inferior_ptid.lwp (),
- &watch_readback,
+ if (!mips_linux_read_watch_registers (inferior_ptid.lwp (), &watch_readback,
&watch_readback_valid, 0))
return -1;
@@ -742,7 +732,7 @@ mips_linux_nat_target::remove_watchpoint (CORE_ADDR addr, int len,
}
if (!deleted_one)
- return -1; /* We don't know about it, fail doing nothing. */
+ return -1; /* We don't know about it, fail doing nothing. */
/* At this point watch_readback is known to be valid because we
could not have added the watch without reading it. */
@@ -782,20 +772,21 @@ mips_linux_nat_target::close ()
}
void _initialize_mips_linux_nat ();
+
void
_initialize_mips_linux_nat ()
{
add_setshow_boolean_cmd ("show-debug-regs", class_maintenance,
- &show_debug_regs, _("\
-Set whether to show variables that mirror the mips debug registers."), _("\
-Show whether to show variables that mirror the mips debug registers."), _("\
+ &show_debug_regs, _ ("\
+Set whether to show variables that mirror the mips debug registers."),
+ _ ("\
+Show whether to show variables that mirror the mips debug registers."),
+ _ ("\
Use \"on\" to enable, \"off\" to disable.\n\
If enabled, the debug registers values are shown when GDB inserts\n\
or removes a hardware breakpoint or watchpoint, and when the inferior\n\
triggers a breakpoint or watchpoint."),
- NULL,
- NULL,
- &maintenance_set_cmdlist,
+ NULL, NULL, &maintenance_set_cmdlist,
&maintenance_show_cmdlist);
linux_target = &the_mips_linux_nat_target;
diff --git a/gdb/mips-linux-tdep.c b/gdb/mips-linux-tdep.c
index 327678760e3..1422b4bcc5a 100644
--- a/gdb/mips-linux-tdep.c
+++ b/gdb/mips-linux-tdep.c
@@ -55,33 +55,33 @@ static struct target_so_ops mips_svr4_so_ops;
from the Linux kernel tree. */
enum
- {
- MIPS_LINUX_SIGEMT = 7,
- MIPS_LINUX_SIGBUS = 10,
- MIPS_LINUX_SIGSYS = 12,
- MIPS_LINUX_SIGUSR1 = 16,
- MIPS_LINUX_SIGUSR2 = 17,
- MIPS_LINUX_SIGCHLD = 18,
- MIPS_LINUX_SIGCLD = MIPS_LINUX_SIGCHLD,
- MIPS_LINUX_SIGPWR = 19,
- MIPS_LINUX_SIGWINCH = 20,
- MIPS_LINUX_SIGURG = 21,
- MIPS_LINUX_SIGIO = 22,
- MIPS_LINUX_SIGPOLL = MIPS_LINUX_SIGIO,
- MIPS_LINUX_SIGSTOP = 23,
- MIPS_LINUX_SIGTSTP = 24,
- MIPS_LINUX_SIGCONT = 25,
- MIPS_LINUX_SIGTTIN = 26,
- MIPS_LINUX_SIGTTOU = 27,
- MIPS_LINUX_SIGVTALRM = 28,
- MIPS_LINUX_SIGPROF = 29,
- MIPS_LINUX_SIGXCPU = 30,
- MIPS_LINUX_SIGXFSZ = 31,
-
- MIPS_LINUX_SIGRTMIN = 32,
- MIPS_LINUX_SIGRT64 = 64,
- MIPS_LINUX_SIGRTMAX = 127,
- };
+{
+ MIPS_LINUX_SIGEMT = 7,
+ MIPS_LINUX_SIGBUS = 10,
+ MIPS_LINUX_SIGSYS = 12,
+ MIPS_LINUX_SIGUSR1 = 16,
+ MIPS_LINUX_SIGUSR2 = 17,
+ MIPS_LINUX_SIGCHLD = 18,
+ MIPS_LINUX_SIGCLD = MIPS_LINUX_SIGCHLD,
+ MIPS_LINUX_SIGPWR = 19,
+ MIPS_LINUX_SIGWINCH = 20,
+ MIPS_LINUX_SIGURG = 21,
+ MIPS_LINUX_SIGIO = 22,
+ MIPS_LINUX_SIGPOLL = MIPS_LINUX_SIGIO,
+ MIPS_LINUX_SIGSTOP = 23,
+ MIPS_LINUX_SIGTSTP = 24,
+ MIPS_LINUX_SIGCONT = 25,
+ MIPS_LINUX_SIGTTIN = 26,
+ MIPS_LINUX_SIGTTOU = 27,
+ MIPS_LINUX_SIGVTALRM = 28,
+ MIPS_LINUX_SIGPROF = 29,
+ MIPS_LINUX_SIGXCPU = 30,
+ MIPS_LINUX_SIGXFSZ = 31,
+
+ MIPS_LINUX_SIGRTMIN = 32,
+ MIPS_LINUX_SIGRT64 = 64,
+ MIPS_LINUX_SIGRTMAX = 127,
+};
/* Figure out where the longjmp will land.
We expect the first arg to be a pointer to the jmp_buf structure
@@ -143,8 +143,7 @@ mips_supply_gregset (struct regcache *regcache,
supply_32bit_reg (regcache, mips_regnum (gdbarch)->lo, regp + EF_LO);
supply_32bit_reg (regcache, mips_regnum (gdbarch)->hi, regp + EF_HI);
- supply_32bit_reg (regcache, mips_regnum (gdbarch)->pc,
- regp + EF_CP0_EPC);
+ supply_32bit_reg (regcache, mips_regnum (gdbarch)->pc, regp + EF_CP0_EPC);
supply_32bit_reg (regcache, mips_regnum (gdbarch)->badvaddr,
regp + EF_CP0_BADVADDR);
supply_32bit_reg (regcache, MIPS_PS_REGNUM, regp + EF_CP0_STATUS);
@@ -157,12 +156,12 @@ mips_supply_gregset (struct regcache *regcache,
static void
mips_supply_gregset_wrapper (const struct regset *regset,
- struct regcache *regcache,
- int regnum, const void *gregs, size_t len)
+ struct regcache *regcache, int regnum,
+ const void *gregs, size_t len)
{
gdb_assert (len >= sizeof (mips_elf_gregset_t));
- mips_supply_gregset (regcache, (const mips_elf_gregset_t *)gregs);
+ mips_supply_gregset (regcache, (const mips_elf_gregset_t *) gregs);
}
/* Pack our registers (or one register) into an elf_gregset_t. */
@@ -189,7 +188,7 @@ mips_fill_gregset (const struct regcache *regcache,
mips_fill_gregset (regcache, gregsetp, mips_regnum (gdbarch)->cause);
mips_fill_gregset (regcache, gregsetp, MIPS_RESTART_REGNUM);
return;
- }
+ }
if (regno > 0 && regno < 32)
{
@@ -199,7 +198,7 @@ mips_fill_gregset (const struct regcache *regcache,
}
if (regno == mips_regnum (gdbarch)->lo)
- regaddr = EF_LO;
+ regaddr = EF_LO;
else if (regno == mips_regnum (gdbarch)->hi)
regaddr = EF_HI;
else if (regno == mips_regnum (gdbarch)->pc)
@@ -210,8 +209,7 @@ mips_fill_gregset (const struct regcache *regcache,
regaddr = EF_CP0_STATUS;
else if (regno == mips_regnum (gdbarch)->cause)
regaddr = EF_CP0_CAUSE;
- else if (mips_linux_restart_reg_p (gdbarch)
- && regno == MIPS_RESTART_REGNUM)
+ else if (mips_linux_restart_reg_p (gdbarch) && regno == MIPS_RESTART_REGNUM)
regaddr = EF_REG0;
else
regaddr = -1;
@@ -225,12 +223,12 @@ mips_fill_gregset (const struct regcache *regcache,
static void
mips_fill_gregset_wrapper (const struct regset *regset,
- const struct regcache *regcache,
- int regnum, void *gregs, size_t len)
+ const struct regcache *regcache, int regnum,
+ void *gregs, size_t len)
{
gdb_assert (len >= sizeof (mips_elf_gregset_t));
- mips_fill_gregset (regcache, (mips_elf_gregset_t *)gregs, regnum);
+ mips_fill_gregset (regcache, (mips_elf_gregset_t *) gregs, regnum);
}
/* Support for 64-bit ABIs. */
@@ -257,8 +255,7 @@ mips64_linux_get_longjmp_target (frame_info_ptr frame, CORE_ADDR *pc)
jb_addr = get_frame_register_unsigned (frame, MIPS_A0_REGNUM);
- if (target_read_memory (jb_addr + MIPS64_LINUX_JB_PC * element_size,
- buf,
+ if (target_read_memory (jb_addr + MIPS64_LINUX_JB_PC * element_size, buf,
gdbarch_ptr_bit (gdbarch) / TARGET_CHAR_BIT))
return 0;
@@ -276,8 +273,7 @@ mips64_linux_get_longjmp_target (frame_info_ptr frame, CORE_ADDR *pc)
/* Supply a 64-bit register. */
static void
-supply_64bit_reg (struct regcache *regcache, int regnum,
- const gdb_byte *buf)
+supply_64bit_reg (struct regcache *regcache, int regnum, const gdb_byte *buf)
{
struct gdbarch *gdbarch = regcache->arch ();
if (gdbarch_byte_order (gdbarch) == BFD_ENDIAN_BIG
@@ -325,12 +321,12 @@ mips64_supply_gregset (struct regcache *regcache,
static void
mips64_supply_gregset_wrapper (const struct regset *regset,
- struct regcache *regcache,
- int regnum, const void *gregs, size_t len)
+ struct regcache *regcache, int regnum,
+ const void *gregs, size_t len)
{
gdb_assert (len >= sizeof (mips64_elf_gregset_t));
- mips64_supply_gregset (regcache, (const mips64_elf_gregset_t *)gregs);
+ mips64_supply_gregset (regcache, (const mips64_elf_gregset_t *) gregs);
}
/* Pack our registers (or one register) into a 64-bit elf_gregset_t. */
@@ -355,10 +351,10 @@ mips64_fill_gregset (const struct regcache *regcache,
mips64_fill_gregset (regcache, gregsetp,
mips_regnum (gdbarch)->badvaddr);
mips64_fill_gregset (regcache, gregsetp, MIPS_PS_REGNUM);
- mips64_fill_gregset (regcache, gregsetp, mips_regnum (gdbarch)->cause);
+ mips64_fill_gregset (regcache, gregsetp, mips_regnum (gdbarch)->cause);
mips64_fill_gregset (regcache, gregsetp, MIPS_RESTART_REGNUM);
return;
- }
+ }
if (regno > 0 && regno < 32)
regaddr = regno + MIPS64_EF_REG0;
@@ -374,8 +370,7 @@ mips64_fill_gregset (const struct regcache *regcache,
regaddr = MIPS64_EF_CP0_STATUS;
else if (regno == mips_regnum (gdbarch)->cause)
regaddr = MIPS64_EF_CP0_CAUSE;
- else if (mips_linux_restart_reg_p (gdbarch)
- && regno == MIPS_RESTART_REGNUM)
+ else if (mips_linux_restart_reg_p (gdbarch) && regno == MIPS_RESTART_REGNUM)
regaddr = MIPS64_EF_REG0;
else
regaddr = -1;
@@ -389,12 +384,12 @@ mips64_fill_gregset (const struct regcache *regcache,
static void
mips64_fill_gregset_wrapper (const struct regset *regset,
- const struct regcache *regcache,
- int regnum, void *gregs, size_t len)
+ const struct regcache *regcache, int regnum,
+ void *gregs, size_t len)
{
gdb_assert (len >= sizeof (mips64_elf_gregset_t));
- mips64_fill_gregset (regcache, (mips64_elf_gregset_t *)gregs, regnum);
+ mips64_fill_gregset (regcache, (mips64_elf_gregset_t *) gregs, regnum);
}
/* Likewise, unpack an elf_fpregset_t. Linux only uses even-numbered
@@ -442,12 +437,12 @@ mips64_supply_fpregset (struct regcache *regcache,
static void
mips64_supply_fpregset_wrapper (const struct regset *regset,
- struct regcache *regcache,
- int regnum, const void *gregs, size_t len)
+ struct regcache *regcache, int regnum,
+ const void *gregs, size_t len)
{
gdb_assert (len >= sizeof (mips64_elf_fpregset_t));
- mips64_supply_fpregset (regcache, (const mips64_elf_fpregset_t *)gregs);
+ mips64_supply_fpregset (regcache, (const mips64_elf_fpregset_t *) gregs);
}
/* Likewise, pack one or all floating point registers into an
@@ -475,8 +470,8 @@ mips64_fill_fpregset (const struct regcache *regcache,
}
else
{
- to = (gdb_byte *) (*fpregsetp + regno
- - gdbarch_fp0_regnum (gdbarch));
+ to
+ = (gdb_byte *) (*fpregsetp + regno - gdbarch_fp0_regnum (gdbarch));
regcache->raw_collect (regno, to);
}
}
@@ -506,28 +501,22 @@ mips64_fill_fpregset (const struct regcache *regcache,
static void
mips64_fill_fpregset_wrapper (const struct regset *regset,
- const struct regcache *regcache,
- int regnum, void *gregs, size_t len)
+ const struct regcache *regcache, int regnum,
+ void *gregs, size_t len)
{
gdb_assert (len >= sizeof (mips64_elf_fpregset_t));
- mips64_fill_fpregset (regcache, (mips64_elf_fpregset_t *)gregs, regnum);
+ mips64_fill_fpregset (regcache, (mips64_elf_fpregset_t *) gregs, regnum);
}
-static const struct regset mips_linux_gregset =
- {
- NULL, mips_supply_gregset_wrapper, mips_fill_gregset_wrapper
- };
+static const struct regset mips_linux_gregset
+ = { NULL, mips_supply_gregset_wrapper, mips_fill_gregset_wrapper };
-static const struct regset mips64_linux_gregset =
- {
- NULL, mips64_supply_gregset_wrapper, mips64_fill_gregset_wrapper
- };
+static const struct regset mips64_linux_gregset
+ = { NULL, mips64_supply_gregset_wrapper, mips64_fill_gregset_wrapper };
-static const struct regset mips64_linux_fpregset =
- {
- NULL, mips64_supply_fpregset_wrapper, mips64_fill_fpregset_wrapper
- };
+static const struct regset mips64_linux_fpregset
+ = { NULL, mips64_supply_fpregset_wrapper, mips64_fill_fpregset_wrapper };
static void
mips_linux_iterate_over_regset_sections (struct gdbarch *gdbarch,
@@ -540,26 +529,25 @@ mips_linux_iterate_over_regset_sections (struct gdbarch *gdbarch,
cb (".reg", sizeof (mips_elf_gregset_t), sizeof (mips_elf_gregset_t),
&mips_linux_gregset, NULL, cb_data);
cb (".reg2", sizeof (mips64_elf_fpregset_t),
- sizeof (mips64_elf_fpregset_t), &mips64_linux_fpregset,
- NULL, cb_data);
+ sizeof (mips64_elf_fpregset_t), &mips64_linux_fpregset, NULL,
+ cb_data);
}
else
{
cb (".reg", sizeof (mips64_elf_gregset_t), sizeof (mips64_elf_gregset_t),
&mips64_linux_gregset, NULL, cb_data);
cb (".reg2", sizeof (mips64_elf_fpregset_t),
- sizeof (mips64_elf_fpregset_t), &mips64_linux_fpregset,
- NULL, cb_data);
+ sizeof (mips64_elf_fpregset_t), &mips64_linux_fpregset, NULL,
+ cb_data);
}
}
static const struct target_desc *
mips_linux_core_read_description (struct gdbarch *gdbarch,
- struct target_ops *target,
- bfd *abfd)
+ struct target_ops *target, bfd *abfd)
{
asection *section = bfd_get_section_by_name (abfd, ".reg");
- if (! section)
+ if (!section)
return NULL;
switch (bfd_section_size (section))
@@ -575,7 +563,6 @@ mips_linux_core_read_description (struct gdbarch *gdbarch,
}
}
-
/* Check the code at PC for a dynamic linker lazy resolution stub.
GNU ld for MIPS has put lazy resolution stubs into a ".MIPS.stubs"
section uniformly since version 2.15. If the pc is in that section,
@@ -717,10 +704,9 @@ static void mips_linux_o32_sigframe_init (const struct tramp_frame *self,
struct trad_frame_cache *this_cache,
CORE_ADDR func);
-static void mips_linux_n32n64_sigframe_init (const struct tramp_frame *self,
- frame_info_ptr this_frame,
- struct trad_frame_cache *this_cache,
- CORE_ADDR func);
+static void mips_linux_n32n64_sigframe_init (
+ const struct tramp_frame *self, frame_info_ptr this_frame,
+ struct trad_frame_cache *this_cache, CORE_ADDR func);
static int mips_linux_sigframe_validate (const struct tramp_frame *self,
frame_info_ptr this_frame,
@@ -749,108 +735,85 @@ static int micromips_linux_sigframe_validate (const struct tramp_frame *self,
#define MICROMIPS_INST_POOL32A 0x0000
#define MICROMIPS_INST_SYSCALL 0x8b7c
-static const struct tramp_frame mips_linux_o32_sigframe = {
- SIGTRAMP_FRAME,
- 4,
- {
- { MIPS_INST_LI_V0_SIGRETURN, ULONGEST_MAX },
- { MIPS_INST_SYSCALL, ULONGEST_MAX },
- { TRAMP_SENTINEL_INSN, ULONGEST_MAX }
- },
- mips_linux_o32_sigframe_init,
- mips_linux_sigframe_validate
-};
-
-static const struct tramp_frame mips_linux_o32_rt_sigframe = {
- SIGTRAMP_FRAME,
- 4,
- {
- { MIPS_INST_LI_V0_RT_SIGRETURN, ULONGEST_MAX },
- { MIPS_INST_SYSCALL, ULONGEST_MAX },
- { TRAMP_SENTINEL_INSN, ULONGEST_MAX } },
- mips_linux_o32_sigframe_init,
- mips_linux_sigframe_validate
-};
-
-static const struct tramp_frame mips_linux_n32_rt_sigframe = {
- SIGTRAMP_FRAME,
- 4,
- {
- { MIPS_INST_LI_V0_N32_RT_SIGRETURN, ULONGEST_MAX },
- { MIPS_INST_SYSCALL, ULONGEST_MAX },
- { TRAMP_SENTINEL_INSN, ULONGEST_MAX }
- },
- mips_linux_n32n64_sigframe_init,
- mips_linux_sigframe_validate
-};
-
-static const struct tramp_frame mips_linux_n64_rt_sigframe = {
- SIGTRAMP_FRAME,
- 4,
- {
- { MIPS_INST_LI_V0_N64_RT_SIGRETURN, ULONGEST_MAX },
- { MIPS_INST_SYSCALL, ULONGEST_MAX },
- { TRAMP_SENTINEL_INSN, ULONGEST_MAX }
- },
- mips_linux_n32n64_sigframe_init,
- mips_linux_sigframe_validate
-};
-
-static const struct tramp_frame micromips_linux_o32_sigframe = {
- SIGTRAMP_FRAME,
- 2,
- {
- { MICROMIPS_INST_LI_V0, ULONGEST_MAX },
- { MIPS_NR_sigreturn, ULONGEST_MAX },
- { MICROMIPS_INST_POOL32A, ULONGEST_MAX },
- { MICROMIPS_INST_SYSCALL, ULONGEST_MAX },
- { TRAMP_SENTINEL_INSN, ULONGEST_MAX }
- },
- mips_linux_o32_sigframe_init,
- micromips_linux_sigframe_validate
-};
-
-static const struct tramp_frame micromips_linux_o32_rt_sigframe = {
- SIGTRAMP_FRAME,
- 2,
- {
- { MICROMIPS_INST_LI_V0, ULONGEST_MAX },
- { MIPS_NR_rt_sigreturn, ULONGEST_MAX },
- { MICROMIPS_INST_POOL32A, ULONGEST_MAX },
- { MICROMIPS_INST_SYSCALL, ULONGEST_MAX },
- { TRAMP_SENTINEL_INSN, ULONGEST_MAX }
- },
- mips_linux_o32_sigframe_init,
- micromips_linux_sigframe_validate
-};
-
-static const struct tramp_frame micromips_linux_n32_rt_sigframe = {
- SIGTRAMP_FRAME,
- 2,
- {
- { MICROMIPS_INST_LI_V0, ULONGEST_MAX },
- { MIPS_NR_N32_rt_sigreturn, ULONGEST_MAX },
- { MICROMIPS_INST_POOL32A, ULONGEST_MAX },
- { MICROMIPS_INST_SYSCALL, ULONGEST_MAX },
- { TRAMP_SENTINEL_INSN, ULONGEST_MAX }
- },
- mips_linux_n32n64_sigframe_init,
- micromips_linux_sigframe_validate
-};
-
-static const struct tramp_frame micromips_linux_n64_rt_sigframe = {
- SIGTRAMP_FRAME,
- 2,
- {
- { MICROMIPS_INST_LI_V0, ULONGEST_MAX },
- { MIPS_NR_N64_rt_sigreturn, ULONGEST_MAX },
- { MICROMIPS_INST_POOL32A, ULONGEST_MAX },
- { MICROMIPS_INST_SYSCALL, ULONGEST_MAX },
- { TRAMP_SENTINEL_INSN, ULONGEST_MAX }
- },
- mips_linux_n32n64_sigframe_init,
- micromips_linux_sigframe_validate
-};
+static const struct tramp_frame mips_linux_o32_sigframe
+ = { SIGTRAMP_FRAME,
+ 4,
+ { { MIPS_INST_LI_V0_SIGRETURN, ULONGEST_MAX },
+ { MIPS_INST_SYSCALL, ULONGEST_MAX },
+ { TRAMP_SENTINEL_INSN, ULONGEST_MAX } },
+ mips_linux_o32_sigframe_init,
+ mips_linux_sigframe_validate };
+
+static const struct tramp_frame mips_linux_o32_rt_sigframe
+ = { SIGTRAMP_FRAME,
+ 4,
+ { { MIPS_INST_LI_V0_RT_SIGRETURN, ULONGEST_MAX },
+ { MIPS_INST_SYSCALL, ULONGEST_MAX },
+ { TRAMP_SENTINEL_INSN, ULONGEST_MAX } },
+ mips_linux_o32_sigframe_init,
+ mips_linux_sigframe_validate };
+
+static const struct tramp_frame mips_linux_n32_rt_sigframe
+ = { SIGTRAMP_FRAME,
+ 4,
+ { { MIPS_INST_LI_V0_N32_RT_SIGRETURN, ULONGEST_MAX },
+ { MIPS_INST_SYSCALL, ULONGEST_MAX },
+ { TRAMP_SENTINEL_INSN, ULONGEST_MAX } },
+ mips_linux_n32n64_sigframe_init,
+ mips_linux_sigframe_validate };
+
+static const struct tramp_frame mips_linux_n64_rt_sigframe
+ = { SIGTRAMP_FRAME,
+ 4,
+ { { MIPS_INST_LI_V0_N64_RT_SIGRETURN, ULONGEST_MAX },
+ { MIPS_INST_SYSCALL, ULONGEST_MAX },
+ { TRAMP_SENTINEL_INSN, ULONGEST_MAX } },
+ mips_linux_n32n64_sigframe_init,
+ mips_linux_sigframe_validate };
+
+static const struct tramp_frame micromips_linux_o32_sigframe
+ = { SIGTRAMP_FRAME,
+ 2,
+ { { MICROMIPS_INST_LI_V0, ULONGEST_MAX },
+ { MIPS_NR_sigreturn, ULONGEST_MAX },
+ { MICROMIPS_INST_POOL32A, ULONGEST_MAX },
+ { MICROMIPS_INST_SYSCALL, ULONGEST_MAX },
+ { TRAMP_SENTINEL_INSN, ULONGEST_MAX } },
+ mips_linux_o32_sigframe_init,
+ micromips_linux_sigframe_validate };
+
+static const struct tramp_frame micromips_linux_o32_rt_sigframe
+ = { SIGTRAMP_FRAME,
+ 2,
+ { { MICROMIPS_INST_LI_V0, ULONGEST_MAX },
+ { MIPS_NR_rt_sigreturn, ULONGEST_MAX },
+ { MICROMIPS_INST_POOL32A, ULONGEST_MAX },
+ { MICROMIPS_INST_SYSCALL, ULONGEST_MAX },
+ { TRAMP_SENTINEL_INSN, ULONGEST_MAX } },
+ mips_linux_o32_sigframe_init,
+ micromips_linux_sigframe_validate };
+
+static const struct tramp_frame micromips_linux_n32_rt_sigframe
+ = { SIGTRAMP_FRAME,
+ 2,
+ { { MICROMIPS_INST_LI_V0, ULONGEST_MAX },
+ { MIPS_NR_N32_rt_sigreturn, ULONGEST_MAX },
+ { MICROMIPS_INST_POOL32A, ULONGEST_MAX },
+ { MICROMIPS_INST_SYSCALL, ULONGEST_MAX },
+ { TRAMP_SENTINEL_INSN, ULONGEST_MAX } },
+ mips_linux_n32n64_sigframe_init,
+ micromips_linux_sigframe_validate };
+
+static const struct tramp_frame micromips_linux_n64_rt_sigframe
+ = { SIGTRAMP_FRAME,
+ 2,
+ { { MICROMIPS_INST_LI_V0, ULONGEST_MAX },
+ { MIPS_NR_N64_rt_sigreturn, ULONGEST_MAX },
+ { MICROMIPS_INST_POOL32A, ULONGEST_MAX },
+ { MICROMIPS_INST_SYSCALL, ULONGEST_MAX },
+ { TRAMP_SENTINEL_INSN, ULONGEST_MAX } },
+ mips_linux_n32n64_sigframe_init,
+ micromips_linux_sigframe_validate };
/* *INDENT-OFF* */
/* The unwinder for o32 signal frames. The legacy structures look
@@ -929,30 +892,30 @@ static const struct tramp_frame micromips_linux_n64_rt_sigframe = {
}; */
/* *INDENT-ON* */
-#define SIGFRAME_SIGCONTEXT_OFFSET (6 * 4)
-
-#define RTSIGFRAME_SIGINFO_SIZE 128
-#define STACK_T_SIZE (3 * 4)
-#define UCONTEXT_SIGCONTEXT_OFFSET (2 * 4 + STACK_T_SIZE + 4)
-#define RTSIGFRAME_SIGCONTEXT_OFFSET (SIGFRAME_SIGCONTEXT_OFFSET \
- + RTSIGFRAME_SIGINFO_SIZE \
- + UCONTEXT_SIGCONTEXT_OFFSET)
-
-#define SIGCONTEXT_PC (1 * 8)
-#define SIGCONTEXT_REGS (2 * 8)
-#define SIGCONTEXT_FPREGS (34 * 8)
-#define SIGCONTEXT_FPCSR (66 * 8 + 4)
-#define SIGCONTEXT_DSPCTL (68 * 8 + 0)
-#define SIGCONTEXT_HI (69 * 8)
-#define SIGCONTEXT_LO (70 * 8)
-#define SIGCONTEXT_CAUSE (71 * 8 + 0)
+#define SIGFRAME_SIGCONTEXT_OFFSET (6 * 4)
+
+#define RTSIGFRAME_SIGINFO_SIZE 128
+#define STACK_T_SIZE (3 * 4)
+#define UCONTEXT_SIGCONTEXT_OFFSET (2 * 4 + STACK_T_SIZE + 4)
+#define RTSIGFRAME_SIGCONTEXT_OFFSET \
+ (SIGFRAME_SIGCONTEXT_OFFSET + RTSIGFRAME_SIGINFO_SIZE \
+ + UCONTEXT_SIGCONTEXT_OFFSET)
+
+#define SIGCONTEXT_PC (1 * 8)
+#define SIGCONTEXT_REGS (2 * 8)
+#define SIGCONTEXT_FPREGS (34 * 8)
+#define SIGCONTEXT_FPCSR (66 * 8 + 4)
+#define SIGCONTEXT_DSPCTL (68 * 8 + 0)
+#define SIGCONTEXT_HI (69 * 8)
+#define SIGCONTEXT_LO (70 * 8)
+#define SIGCONTEXT_CAUSE (71 * 8 + 0)
#define SIGCONTEXT_BADVADDR (71 * 8 + 4)
-#define SIGCONTEXT_HI1 (71 * 8 + 0)
-#define SIGCONTEXT_LO1 (71 * 8 + 4)
-#define SIGCONTEXT_HI2 (72 * 8 + 0)
-#define SIGCONTEXT_LO2 (72 * 8 + 4)
-#define SIGCONTEXT_HI3 (73 * 8 + 0)
-#define SIGCONTEXT_LO3 (73 * 8 + 4)
+#define SIGCONTEXT_HI1 (71 * 8 + 0)
+#define SIGCONTEXT_LO1 (71 * 8 + 4)
+#define SIGCONTEXT_HI2 (72 * 8 + 0)
+#define SIGCONTEXT_LO2 (72 * 8 + 4)
+#define SIGCONTEXT_HI3 (73 * 8 + 0)
+#define SIGCONTEXT_LO3 (73 * 8 + 4)
#define SIGCONTEXT_REG_SIZE 8
@@ -992,11 +955,9 @@ mips_linux_o32_sigframe_init (const struct tramp_frame *self,
regs_base + SIGCONTEXT_REGS);
for (ireg = 1; ireg < 32; ireg++)
- trad_frame_set_reg_addr (this_cache,
- (ireg + MIPS_ZERO_REGNUM
- + gdbarch_num_regs (gdbarch)),
- (regs_base + SIGCONTEXT_REGS
- + ireg * SIGCONTEXT_REG_SIZE));
+ trad_frame_set_reg_addr (
+ this_cache, (ireg + MIPS_ZERO_REGNUM + gdbarch_num_regs (gdbarch)),
+ (regs_base + SIGCONTEXT_REGS + ireg * SIGCONTEXT_REG_SIZE));
for (ireg = 0; ireg < 32; ireg++)
if ((gdbarch_byte_order (gdbarch) == BFD_ENDIAN_BIG) != (ireg & 1))
@@ -1010,8 +971,7 @@ mips_linux_o32_sigframe_init (const struct tramp_frame *self,
(sigcontext_base + SIGCONTEXT_FPREGS
+ (ireg & ~1) * SIGCONTEXT_REG_SIZE));
- trad_frame_set_reg_addr (this_cache,
- regs->pc + gdbarch_num_regs (gdbarch),
+ trad_frame_set_reg_addr (this_cache, regs->pc + gdbarch_num_regs (gdbarch),
regs_base + SIGCONTEXT_PC);
trad_frame_set_reg_addr (this_cache,
@@ -1024,11 +984,9 @@ mips_linux_o32_sigframe_init (const struct tramp_frame *self,
regs->dspctl + gdbarch_num_regs (gdbarch),
sigcontext_base + SIGCONTEXT_DSPCTL);
- trad_frame_set_reg_addr (this_cache,
- regs->hi + gdbarch_num_regs (gdbarch),
+ trad_frame_set_reg_addr (this_cache, regs->hi + gdbarch_num_regs (gdbarch),
regs_base + SIGCONTEXT_HI);
- trad_frame_set_reg_addr (this_cache,
- regs->lo + gdbarch_num_regs (gdbarch),
+ trad_frame_set_reg_addr (this_cache, regs->lo + gdbarch_num_regs (gdbarch),
regs_base + SIGCONTEXT_LO);
if (regs->dspacc != -1)
@@ -1124,30 +1082,30 @@ mips_linux_o32_sigframe_init (const struct tramp_frame *self,
included too. */
/* *INDENT-ON* */
-#define N32_STACK_T_SIZE STACK_T_SIZE
-#define N64_STACK_T_SIZE (2 * 8 + 4)
-#define N32_UCONTEXT_SIGCONTEXT_OFFSET (2 * 4 + N32_STACK_T_SIZE + 4)
-#define N64_UCONTEXT_SIGCONTEXT_OFFSET (2 * 8 + N64_STACK_T_SIZE + 4)
-#define N32_SIGFRAME_SIGCONTEXT_OFFSET (SIGFRAME_SIGCONTEXT_OFFSET \
- + RTSIGFRAME_SIGINFO_SIZE \
- + N32_UCONTEXT_SIGCONTEXT_OFFSET)
-#define N64_SIGFRAME_SIGCONTEXT_OFFSET (SIGFRAME_SIGCONTEXT_OFFSET \
- + RTSIGFRAME_SIGINFO_SIZE \
- + N64_UCONTEXT_SIGCONTEXT_OFFSET)
-
-#define N64_SIGCONTEXT_REGS (0 * 8)
-#define N64_SIGCONTEXT_FPREGS (32 * 8)
-#define N64_SIGCONTEXT_HI (64 * 8)
-#define N64_SIGCONTEXT_HI1 (65 * 8)
-#define N64_SIGCONTEXT_HI2 (66 * 8)
-#define N64_SIGCONTEXT_HI3 (67 * 8)
-#define N64_SIGCONTEXT_LO (68 * 8)
-#define N64_SIGCONTEXT_LO1 (69 * 8)
-#define N64_SIGCONTEXT_LO2 (70 * 8)
-#define N64_SIGCONTEXT_LO3 (71 * 8)
-#define N64_SIGCONTEXT_PC (72 * 8)
-#define N64_SIGCONTEXT_FPCSR (73 * 8 + 0)
-#define N64_SIGCONTEXT_DSPCTL (74 * 8 + 0)
+#define N32_STACK_T_SIZE STACK_T_SIZE
+#define N64_STACK_T_SIZE (2 * 8 + 4)
+#define N32_UCONTEXT_SIGCONTEXT_OFFSET (2 * 4 + N32_STACK_T_SIZE + 4)
+#define N64_UCONTEXT_SIGCONTEXT_OFFSET (2 * 8 + N64_STACK_T_SIZE + 4)
+#define N32_SIGFRAME_SIGCONTEXT_OFFSET \
+ (SIGFRAME_SIGCONTEXT_OFFSET + RTSIGFRAME_SIGINFO_SIZE \
+ + N32_UCONTEXT_SIGCONTEXT_OFFSET)
+#define N64_SIGFRAME_SIGCONTEXT_OFFSET \
+ (SIGFRAME_SIGCONTEXT_OFFSET + RTSIGFRAME_SIGINFO_SIZE \
+ + N64_UCONTEXT_SIGCONTEXT_OFFSET)
+
+#define N64_SIGCONTEXT_REGS (0 * 8)
+#define N64_SIGCONTEXT_FPREGS (32 * 8)
+#define N64_SIGCONTEXT_HI (64 * 8)
+#define N64_SIGCONTEXT_HI1 (65 * 8)
+#define N64_SIGCONTEXT_HI2 (66 * 8)
+#define N64_SIGCONTEXT_HI3 (67 * 8)
+#define N64_SIGCONTEXT_LO (68 * 8)
+#define N64_SIGCONTEXT_LO1 (69 * 8)
+#define N64_SIGCONTEXT_LO2 (70 * 8)
+#define N64_SIGCONTEXT_LO3 (71 * 8)
+#define N64_SIGCONTEXT_PC (72 * 8)
+#define N64_SIGCONTEXT_FPCSR (73 * 8 + 0)
+#define N64_SIGCONTEXT_DSPCTL (74 * 8 + 0)
#define N64_SIGCONTEXT_REG_SIZE 8
@@ -1188,8 +1146,7 @@ mips_linux_n32n64_sigframe_init (const struct tramp_frame *self,
(sigcontext_base + N64_SIGCONTEXT_FPREGS
+ ireg * N64_SIGCONTEXT_REG_SIZE));
- trad_frame_set_reg_addr (this_cache,
- regs->pc + gdbarch_num_regs (gdbarch),
+ trad_frame_set_reg_addr (this_cache, regs->pc + gdbarch_num_regs (gdbarch),
sigcontext_base + N64_SIGCONTEXT_PC);
trad_frame_set_reg_addr (this_cache,
@@ -1197,11 +1154,9 @@ mips_linux_n32n64_sigframe_init (const struct tramp_frame *self,
+ gdbarch_num_regs (gdbarch)),
sigcontext_base + N64_SIGCONTEXT_FPCSR);
- trad_frame_set_reg_addr (this_cache,
- regs->hi + gdbarch_num_regs (gdbarch),
+ trad_frame_set_reg_addr (this_cache, regs->hi + gdbarch_num_regs (gdbarch),
sigcontext_base + N64_SIGCONTEXT_HI);
- trad_frame_set_reg_addr (this_cache,
- regs->lo + gdbarch_num_regs (gdbarch),
+ trad_frame_set_reg_addr (this_cache, regs->lo + gdbarch_num_regs (gdbarch),
sigcontext_base + N64_SIGCONTEXT_LO);
if (regs->dspacc != -1)
@@ -1238,8 +1193,7 @@ mips_linux_n32n64_sigframe_init (const struct tramp_frame *self,
static int
mips_linux_sigframe_validate (const struct tramp_frame *self,
- frame_info_ptr this_frame,
- CORE_ADDR *pc)
+ frame_info_ptr this_frame, CORE_ADDR *pc)
{
return mips_pc_is_mips (*pc);
}
@@ -1248,8 +1202,7 @@ mips_linux_sigframe_validate (const struct tramp_frame *self,
static int
micromips_linux_sigframe_validate (const struct tramp_frame *self,
- frame_info_ptr this_frame,
- CORE_ADDR *pc)
+ frame_info_ptr this_frame, CORE_ADDR *pc)
{
if (mips_pc_is_micromips (get_frame_arch (this_frame), *pc))
{
@@ -1300,10 +1253,8 @@ mips_linux_syscall_next_pc (frame_info_ptr frame)
/* If we are about to make a sigreturn syscall, use the unwinder to
decode the signal frame. */
- if (v0 == MIPS_NR_sigreturn
- || v0 == MIPS_NR_rt_sigreturn
- || v0 == MIPS_NR_N64_rt_sigreturn
- || v0 == MIPS_NR_N32_rt_sigreturn)
+ if (v0 == MIPS_NR_sigreturn || v0 == MIPS_NR_rt_sigreturn
+ || v0 == MIPS_NR_N64_rt_sigreturn || v0 == MIPS_NR_N32_rt_sigreturn)
return frame_unwind_caller_pc (get_current_frame ());
return pc + 4;
@@ -1313,8 +1264,7 @@ mips_linux_syscall_next_pc (frame_info_ptr frame)
v0 register. When the function fails, it returns -1. */
static LONGEST
-mips_linux_get_syscall_number (struct gdbarch *gdbarch,
- thread_info *thread)
+mips_linux_get_syscall_number (struct gdbarch *gdbarch, thread_info *thread)
{
struct regcache *regcache = get_thread_regcache (thread);
mips_gdbarch_tdep *tdep = gdbarch_tdep<mips_gdbarch_tdep> (gdbarch);
@@ -1326,8 +1276,7 @@ mips_linux_get_syscall_number (struct gdbarch *gdbarch,
LONGEST ret;
/* Make sure we're in a known ABI */
- gdb_assert (tdep->mips_abi == MIPS_ABI_O32
- || tdep->mips_abi == MIPS_ABI_N32
+ gdb_assert (tdep->mips_abi == MIPS_ABI_O32 || tdep->mips_abi == MIPS_ABI_N32
|| tdep->mips_abi == MIPS_ABI_N64);
gdb_assert (regsize <= sizeof (buf));
@@ -1345,8 +1294,7 @@ mips_linux_get_syscall_number (struct gdbarch *gdbarch,
gdbarch.h. */
static int
-mips_gdb_signal_to_target (struct gdbarch *gdbarch,
- enum gdb_signal signal)
+mips_gdb_signal_to_target (struct gdbarch *gdbarch, enum gdb_signal signal)
{
switch (signal)
{
@@ -1416,8 +1364,7 @@ mips_gdb_signal_to_target (struct gdbarch *gdbarch,
return MIPS_LINUX_SIGRTMIN;
}
- if (signal >= GDB_SIGNAL_REALTIME_33
- && signal <= GDB_SIGNAL_REALTIME_63)
+ if (signal >= GDB_SIGNAL_REALTIME_33 && signal <= GDB_SIGNAL_REALTIME_63)
{
int offset = signal - GDB_SIGNAL_REALTIME_33;
@@ -1511,11 +1458,9 @@ mips_gdb_signal_from_target (struct gdbarch *gdbarch, int signal)
if (offset == 0)
return GDB_SIGNAL_REALTIME_32;
else if (offset < 32)
- return (enum gdb_signal) (offset - 1
- + (int) GDB_SIGNAL_REALTIME_33);
+ return (enum gdb_signal) (offset - 1 + (int) GDB_SIGNAL_REALTIME_33);
else
- return (enum gdb_signal) (offset - 32
- + (int) GDB_SIGNAL_REALTIME_64);
+ return (enum gdb_signal) (offset - 32 + (int) GDB_SIGNAL_REALTIME_64);
}
return linux_gdb_signal_from_target (gdbarch, signal);
@@ -1524,8 +1469,7 @@ mips_gdb_signal_from_target (struct gdbarch *gdbarch, int signal)
/* Initialize one of the GNU/Linux OS ABIs. */
static void
-mips_linux_init_abi (struct gdbarch_info info,
- struct gdbarch *gdbarch)
+mips_linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
{
mips_gdbarch_tdep *tdep = gdbarch_tdep<mips_gdbarch_tdep> (gdbarch);
enum mips_abi abi = mips_abi (gdbarch);
@@ -1538,44 +1482,39 @@ mips_linux_init_abi (struct gdbarch_info info,
switch (abi)
{
- case MIPS_ABI_O32:
- set_gdbarch_get_longjmp_target (gdbarch,
- mips_linux_get_longjmp_target);
- set_solib_svr4_fetch_link_map_offsets
- (gdbarch, linux_ilp32_fetch_link_map_offsets);
- tramp_frame_prepend_unwinder (gdbarch, &micromips_linux_o32_sigframe);
- tramp_frame_prepend_unwinder (gdbarch,
- &micromips_linux_o32_rt_sigframe);
- tramp_frame_prepend_unwinder (gdbarch, &mips_linux_o32_sigframe);
- tramp_frame_prepend_unwinder (gdbarch, &mips_linux_o32_rt_sigframe);
- set_xml_syscall_file_name (gdbarch, "syscalls/mips-o32-linux.xml");
- break;
- case MIPS_ABI_N32:
- set_gdbarch_get_longjmp_target (gdbarch,
- mips_linux_get_longjmp_target);
- set_solib_svr4_fetch_link_map_offsets
- (gdbarch, linux_ilp32_fetch_link_map_offsets);
- set_gdbarch_long_double_bit (gdbarch, 128);
- set_gdbarch_long_double_format (gdbarch, floatformats_ieee_quad);
- tramp_frame_prepend_unwinder (gdbarch,
- &micromips_linux_n32_rt_sigframe);
- tramp_frame_prepend_unwinder (gdbarch, &mips_linux_n32_rt_sigframe);
- set_xml_syscall_file_name (gdbarch, "syscalls/mips-n32-linux.xml");
- break;
- case MIPS_ABI_N64:
- set_gdbarch_get_longjmp_target (gdbarch,
- mips64_linux_get_longjmp_target);
- set_solib_svr4_fetch_link_map_offsets
- (gdbarch, linux_lp64_fetch_link_map_offsets);
- set_gdbarch_long_double_bit (gdbarch, 128);
- set_gdbarch_long_double_format (gdbarch, floatformats_ieee_quad);
- tramp_frame_prepend_unwinder (gdbarch,
- &micromips_linux_n64_rt_sigframe);
- tramp_frame_prepend_unwinder (gdbarch, &mips_linux_n64_rt_sigframe);
- set_xml_syscall_file_name (gdbarch, "syscalls/mips-n64-linux.xml");
- break;
- default:
- break;
+ case MIPS_ABI_O32:
+ set_gdbarch_get_longjmp_target (gdbarch, mips_linux_get_longjmp_target);
+ set_solib_svr4_fetch_link_map_offsets (
+ gdbarch, linux_ilp32_fetch_link_map_offsets);
+ tramp_frame_prepend_unwinder (gdbarch, &micromips_linux_o32_sigframe);
+ tramp_frame_prepend_unwinder (gdbarch, &micromips_linux_o32_rt_sigframe);
+ tramp_frame_prepend_unwinder (gdbarch, &mips_linux_o32_sigframe);
+ tramp_frame_prepend_unwinder (gdbarch, &mips_linux_o32_rt_sigframe);
+ set_xml_syscall_file_name (gdbarch, "syscalls/mips-o32-linux.xml");
+ break;
+ case MIPS_ABI_N32:
+ set_gdbarch_get_longjmp_target (gdbarch, mips_linux_get_longjmp_target);
+ set_solib_svr4_fetch_link_map_offsets (
+ gdbarch, linux_ilp32_fetch_link_map_offsets);
+ set_gdbarch_long_double_bit (gdbarch, 128);
+ set_gdbarch_long_double_format (gdbarch, floatformats_ieee_quad);
+ tramp_frame_prepend_unwinder (gdbarch, &micromips_linux_n32_rt_sigframe);
+ tramp_frame_prepend_unwinder (gdbarch, &mips_linux_n32_rt_sigframe);
+ set_xml_syscall_file_name (gdbarch, "syscalls/mips-n32-linux.xml");
+ break;
+ case MIPS_ABI_N64:
+ set_gdbarch_get_longjmp_target (gdbarch,
+ mips64_linux_get_longjmp_target);
+ set_solib_svr4_fetch_link_map_offsets (
+ gdbarch, linux_lp64_fetch_link_map_offsets);
+ set_gdbarch_long_double_bit (gdbarch, 128);
+ set_gdbarch_long_double_format (gdbarch, floatformats_ieee_quad);
+ tramp_frame_prepend_unwinder (gdbarch, &micromips_linux_n64_rt_sigframe);
+ tramp_frame_prepend_unwinder (gdbarch, &mips_linux_n64_rt_sigframe);
+ set_xml_syscall_file_name (gdbarch, "syscalls/mips-n64-linux.xml");
+ break;
+ default:
+ break;
}
set_gdbarch_skip_solib_resolver (gdbarch, mips_linux_skip_resolver);
@@ -1601,14 +1540,12 @@ mips_linux_init_abi (struct gdbarch_info info,
set_gdbarch_core_read_description (gdbarch,
mips_linux_core_read_description);
- set_gdbarch_iterate_over_regset_sections
- (gdbarch, mips_linux_iterate_over_regset_sections);
+ set_gdbarch_iterate_over_regset_sections (
+ gdbarch, mips_linux_iterate_over_regset_sections);
- set_gdbarch_gdb_signal_from_target (gdbarch,
- mips_gdb_signal_from_target);
+ set_gdbarch_gdb_signal_from_target (gdbarch, mips_gdb_signal_from_target);
- set_gdbarch_gdb_signal_to_target (gdbarch,
- mips_gdb_signal_to_target);
+ set_gdbarch_gdb_signal_to_target (gdbarch, mips_gdb_signal_to_target);
tdep->syscall_next_pc = mips_linux_syscall_next_pc;
@@ -1624,8 +1561,8 @@ mips_linux_init_abi (struct gdbarch_info info,
set_gdbarch_num_pseudo_regs (gdbarch, MIPS_RESTART_REGNUM + 1);
/* If it's present, then assign it to the reserved number. */
- feature = tdesc_find_feature (info.target_desc,
- "org.gnu.gdb.mips.linux");
+ feature
+ = tdesc_find_feature (info.target_desc, "org.gnu.gdb.mips.linux");
if (feature != NULL)
tdesc_numbered_register (feature, tdesc_data, MIPS_RESTART_REGNUM,
"restart");
@@ -1633,17 +1570,16 @@ mips_linux_init_abi (struct gdbarch_info info,
}
void _initialize_mips_linux_tdep ();
+
void
_initialize_mips_linux_tdep ()
{
const struct bfd_arch_info *arch_info;
- for (arch_info = bfd_lookup_arch (bfd_arch_mips, 0);
- arch_info != NULL;
+ for (arch_info = bfd_lookup_arch (bfd_arch_mips, 0); arch_info != NULL;
arch_info = arch_info->next)
{
- gdbarch_register_osabi (bfd_arch_mips, arch_info->mach,
- GDB_OSABI_LINUX,
+ gdbarch_register_osabi (bfd_arch_mips, arch_info->mach, GDB_OSABI_LINUX,
mips_linux_init_abi);
}
diff --git a/gdb/mips-linux-tdep.h b/gdb/mips-linux-tdep.h
index 99d2120df88..52d2ee3cef4 100644
--- a/gdb/mips-linux-tdep.h
+++ b/gdb/mips-linux-tdep.h
@@ -21,8 +21,8 @@
#define MIPS_LINUX_TDEP_H
/* Copied from <asm/elf.h>. */
-#define ELF_NGREG 45
-#define ELF_NFPREG 33
+#define ELF_NGREG 45
+#define ELF_NFPREG 33
typedef unsigned char mips_elf_greg_t[4];
typedef mips_elf_greg_t mips_elf_gregset_t[ELF_NGREG];
@@ -31,27 +31,27 @@ typedef unsigned char mips_elf_fpreg_t[8];
typedef mips_elf_fpreg_t mips_elf_fpregset_t[ELF_NFPREG];
/* 0 - 31 are integer registers, 32 - 63 are fp registers. */
-#define FPR_BASE 32
-#define PC 64
-#define CAUSE 65
-#define BADVADDR 66
-#define MMHI 67
-#define MMLO 68
-#define FPC_CSR 69
-#define FPC_EIR 70
-#define DSP_BASE 71
-#define DSP_CONTROL 77
-
-#define EF_REG0 6
-#define EF_REG31 37
-#define EF_LO 38
-#define EF_HI 39
-#define EF_CP0_EPC 40
-#define EF_CP0_BADVADDR 41
-#define EF_CP0_STATUS 42
-#define EF_CP0_CAUSE 43
-
-#define EF_SIZE 180
+#define FPR_BASE 32
+#define PC 64
+#define CAUSE 65
+#define BADVADDR 66
+#define MMHI 67
+#define MMLO 68
+#define FPC_CSR 69
+#define FPC_EIR 70
+#define DSP_BASE 71
+#define DSP_CONTROL 77
+
+#define EF_REG0 6
+#define EF_REG31 37
+#define EF_LO 38
+#define EF_HI 39
+#define EF_CP0_EPC 40
+#define EF_CP0_BADVADDR 41
+#define EF_CP0_STATUS 42
+#define EF_CP0_CAUSE 43
+
+#define EF_SIZE 180
void mips_supply_gregset (struct regcache *, const mips_elf_gregset_t *);
void mips_fill_gregset (const struct regcache *, mips_elf_gregset_t *, int);
@@ -59,8 +59,8 @@ void mips_fill_gregset (const struct regcache *, mips_elf_gregset_t *, int);
/* 64-bit support. */
/* Copied from <asm/elf.h>. */
-#define MIPS64_ELF_NGREG 45
-#define MIPS64_ELF_NFPREG 33
+#define MIPS64_ELF_NGREG 45
+#define MIPS64_ELF_NFPREG 33
typedef unsigned char mips64_elf_greg_t[8];
typedef mips64_elf_greg_t mips64_elf_gregset_t[MIPS64_ELF_NGREG];
@@ -69,35 +69,35 @@ typedef unsigned char mips64_elf_fpreg_t[8];
typedef mips64_elf_fpreg_t mips64_elf_fpregset_t[MIPS64_ELF_NFPREG];
/* 0 - 31 are integer registers, 32 - 63 are fp registers. */
-#define MIPS64_FPR_BASE 32
-#define MIPS64_PC 64
-#define MIPS64_CAUSE 65
-#define MIPS64_BADVADDR 66
-#define MIPS64_MMHI 67
-#define MIPS64_MMLO 68
-#define MIPS64_FPC_CSR 69
-#define MIPS64_FPC_EIR 70
-
-#define MIPS64_EF_REG0 0
-#define MIPS64_EF_REG31 31
-#define MIPS64_EF_LO 32
-#define MIPS64_EF_HI 33
-#define MIPS64_EF_CP0_EPC 34
-#define MIPS64_EF_CP0_BADVADDR 35
-#define MIPS64_EF_CP0_STATUS 36
-#define MIPS64_EF_CP0_CAUSE 37
-
-#define MIPS64_EF_SIZE 304
+#define MIPS64_FPR_BASE 32
+#define MIPS64_PC 64
+#define MIPS64_CAUSE 65
+#define MIPS64_BADVADDR 66
+#define MIPS64_MMHI 67
+#define MIPS64_MMLO 68
+#define MIPS64_FPC_CSR 69
+#define MIPS64_FPC_EIR 70
+
+#define MIPS64_EF_REG0 0
+#define MIPS64_EF_REG31 31
+#define MIPS64_EF_LO 32
+#define MIPS64_EF_HI 33
+#define MIPS64_EF_CP0_EPC 34
+#define MIPS64_EF_CP0_BADVADDR 35
+#define MIPS64_EF_CP0_STATUS 36
+#define MIPS64_EF_CP0_CAUSE 37
+
+#define MIPS64_EF_SIZE 304
void mips64_supply_gregset (struct regcache *, const mips64_elf_gregset_t *);
-void mips64_fill_gregset (const struct regcache *,
- mips64_elf_gregset_t *, int);
-void mips64_supply_fpregset (struct regcache *,
- const mips64_elf_fpregset_t *);
-void mips64_fill_fpregset (const struct regcache *,
- mips64_elf_fpregset_t *, int);
-
-enum {
+void mips64_fill_gregset (const struct regcache *, mips64_elf_gregset_t *,
+ int);
+void mips64_supply_fpregset (struct regcache *, const mips64_elf_fpregset_t *);
+void mips64_fill_fpregset (const struct regcache *, mips64_elf_fpregset_t *,
+ int);
+
+enum
+{
/* The Linux kernel stores an error code from any interrupted
syscall in a "register" (in $0's save slot). */
MIPS_RESTART_REGNUM = 79
diff --git a/gdb/mips-netbsd-nat.c b/gdb/mips-netbsd-nat.c
index bdac40e8473..4c7e91a5089 100644
--- a/gdb/mips-netbsd-nat.c
+++ b/gdb/mips-netbsd-nat.c
@@ -60,20 +60,19 @@ mips_nbsd_nat_target::fetch_registers (struct regcache *regcache, int regno)
struct reg regs;
if (ptrace (PT_GETREGS, pid, (PTRACE_TYPE_ARG3) &regs, 0) == -1)
- perror_with_name (_("Couldn't get registers"));
-
+ perror_with_name (_ ("Couldn't get registers"));
+
mipsnbsd_supply_reg (regcache, (char *) &regs, regno);
if (regno != -1)
return;
}
- if (regno == -1
- || regno >= gdbarch_fp0_regnum (regcache->arch ()))
+ if (regno == -1 || regno >= gdbarch_fp0_regnum (regcache->arch ()))
{
struct fpreg fpregs;
if (ptrace (PT_GETFPREGS, pid, (PTRACE_TYPE_ARG3) &fpregs, 0) == -1)
- perror_with_name (_("Couldn't get floating point status"));
+ perror_with_name (_ ("Couldn't get floating point status"));
mipsnbsd_supply_fpreg (regcache, (char *) &fpregs, regno);
}
@@ -90,33 +89,33 @@ mips_nbsd_nat_target::store_registers (struct regcache *regcache, int regno)
struct reg regs;
if (ptrace (PT_GETREGS, pid, (PTRACE_TYPE_ARG3) &regs, 0) == -1)
- perror_with_name (_("Couldn't get registers"));
+ perror_with_name (_ ("Couldn't get registers"));
mipsnbsd_fill_reg (regcache, (char *) &regs, regno);
if (ptrace (PT_SETREGS, pid, (PTRACE_TYPE_ARG3) &regs, 0) == -1)
- perror_with_name (_("Couldn't write registers"));
+ perror_with_name (_ ("Couldn't write registers"));
if (regno != -1)
return;
}
- if (regno == -1
- || regno >= gdbarch_fp0_regnum (regcache->arch ()))
+ if (regno == -1 || regno >= gdbarch_fp0_regnum (regcache->arch ()))
{
- struct fpreg fpregs;
+ struct fpreg fpregs;
if (ptrace (PT_GETFPREGS, pid, (PTRACE_TYPE_ARG3) &fpregs, 0) == -1)
- perror_with_name (_("Couldn't get floating point status"));
+ perror_with_name (_ ("Couldn't get floating point status"));
mipsnbsd_fill_fpreg (regcache, (char *) &fpregs, regno);
if (ptrace (PT_SETFPREGS, pid, (PTRACE_TYPE_ARG3) &fpregs, 0) == -1)
- perror_with_name (_("Couldn't write floating point status"));
+ perror_with_name (_ ("Couldn't write floating point status"));
}
}
void _initialize_mipsnbsd_nat ();
+
void
_initialize_mipsnbsd_nat ()
{
diff --git a/gdb/mips-netbsd-tdep.c b/gdb/mips-netbsd-tdep.c
index 500869844bc..5eb2baea055 100644
--- a/gdb/mips-netbsd-tdep.c
+++ b/gdb/mips-netbsd-tdep.c
@@ -34,17 +34,17 @@
#include "solib-svr4.h"
/* Shorthand for some register numbers used below. */
-#define MIPS_PC_REGNUM MIPS_EMBED_PC_REGNUM
+#define MIPS_PC_REGNUM MIPS_EMBED_PC_REGNUM
#define MIPS_FP0_REGNUM MIPS_EMBED_FP0_REGNUM
#define MIPS_FSR_REGNUM MIPS_EMBED_FP0_REGNUM + 32
/* Core file support. */
/* Number of registers in `struct reg' from <machine/reg.h>. */
-#define MIPSNBSD_NUM_GREGS 38
+#define MIPSNBSD_NUM_GREGS 38
/* Number of registers in `struct fpreg' from <machine/reg.h>. */
-#define MIPSNBSD_NUM_FPREGS 33
+#define MIPSNBSD_NUM_FPREGS 33
/* Supply register REGNUM from the buffer specified by FPREGS and LEN
in the floating-point register set REGSET to register cache
@@ -52,8 +52,8 @@
static void
mipsnbsd_supply_fpregset (const struct regset *regset,
- struct regcache *regcache,
- int regnum, const void *fpregs, size_t len)
+ struct regcache *regcache, int regnum,
+ const void *fpregs, size_t len)
{
size_t regsize = mips_isa_regsize (regcache->arch ());
const char *regs = (const char *) fpregs;
@@ -99,19 +99,11 @@ mipsnbsd_supply_gregset (const struct regset *regset,
/* NetBSD/mips register sets. */
-static const struct regset mipsnbsd_gregset =
-{
- NULL,
- mipsnbsd_supply_gregset,
- NULL,
- REGSET_VARIABLE_SIZE
-};
+static const struct regset mipsnbsd_gregset
+ = { NULL, mipsnbsd_supply_gregset, NULL, REGSET_VARIABLE_SIZE };
-static const struct regset mipsnbsd_fpregset =
-{
- NULL,
- mipsnbsd_supply_fpregset
-};
+static const struct regset mipsnbsd_fpregset
+ = { NULL, mipsnbsd_supply_fpregset };
/* Iterate over core file register note sections. */
@@ -128,7 +120,6 @@ mipsnbsd_iterate_over_regset_sections (struct gdbarch *gdbarch,
cb (".reg2", MIPSNBSD_NUM_FPREGS * regsize, MIPSNBSD_NUM_FPREGS * regsize,
&mipsnbsd_fpregset, NULL, cb_data);
}
-
/* Conveniently, GDB uses the same register numbering as the
ptrace register structure used by NetBSD/mips. */
@@ -146,8 +137,7 @@ mipsnbsd_supply_reg (struct regcache *regcache, const char *regs, int regno)
if (gdbarch_cannot_fetch_register (gdbarch, i))
regcache->raw_supply (i, NULL);
else
- regcache->raw_supply
- (i, regs + (i * mips_isa_regsize (gdbarch)));
+ regcache->raw_supply (i, regs + (i * mips_isa_regsize (gdbarch)));
}
}
}
@@ -160,30 +150,28 @@ mipsnbsd_fill_reg (const struct regcache *regcache, char *regs, int regno)
for (i = 0; i <= gdbarch_pc_regnum (gdbarch); i++)
if ((regno == i || regno == -1)
- && ! gdbarch_cannot_store_register (gdbarch, i))
+ && !gdbarch_cannot_store_register (gdbarch, i))
regcache->raw_collect (i, regs + (i * mips_isa_regsize (gdbarch)));
}
void
-mipsnbsd_supply_fpreg (struct regcache *regcache,
- const char *fpregs, int regno)
+mipsnbsd_supply_fpreg (struct regcache *regcache, const char *fpregs,
+ int regno)
{
struct gdbarch *gdbarch = regcache->arch ();
int i;
for (i = gdbarch_fp0_regnum (gdbarch);
- i <= mips_regnum (gdbarch)->fp_implementation_revision;
- i++)
+ i <= mips_regnum (gdbarch)->fp_implementation_revision; i++)
{
if (regno == i || regno == -1)
{
if (gdbarch_cannot_fetch_register (gdbarch, i))
regcache->raw_supply (i, NULL);
else
- regcache->raw_supply (i,
- fpregs
- + ((i - gdbarch_fp0_regnum (gdbarch))
- * mips_isa_regsize (gdbarch)));
+ regcache->raw_supply (i, fpregs
+ + ((i - gdbarch_fp0_regnum (gdbarch))
+ * mips_isa_regsize (gdbarch)));
}
}
}
@@ -195,13 +183,12 @@ mipsnbsd_fill_fpreg (const struct regcache *regcache, char *fpregs, int regno)
int i;
for (i = gdbarch_fp0_regnum (gdbarch);
- i <= mips_regnum (gdbarch)->fp_control_status;
- i++)
- if ((regno == i || regno == -1)
- && ! gdbarch_cannot_store_register (gdbarch, i))
- regcache->raw_collect
- (i, (fpregs + ((i - gdbarch_fp0_regnum (gdbarch))
- * mips_isa_regsize (gdbarch))));
+ i <= mips_regnum (gdbarch)->fp_control_status; i++)
+ if ((regno == i || regno == -1)
+ && !gdbarch_cannot_store_register (gdbarch, i))
+ regcache->raw_collect (i, (fpregs
+ + ((i - gdbarch_fp0_regnum (gdbarch))
+ * mips_isa_regsize (gdbarch))));
}
#if 0
@@ -222,8 +209,8 @@ mipsnbsd_fill_fpreg (const struct regcache *regcache, char *fpregs, int regno)
signal trampoline. If not, -1 is returned, otherwise the offset from the
start of the return sequence is returned. */
-#define RETCODE_NWORDS 3
-#define RETCODE_SIZE (RETCODE_NWORDS * 4)
+#define RETCODE_NWORDS 3
+#define RETCODE_SIZE (RETCODE_NWORDS * 4)
static const unsigned char sigtramp_retcode_mipsel[RETCODE_SIZE] =
{
@@ -248,10 +235,10 @@ static const unsigned char sigtramp_retcode_mipseb[RETCODE_SIZE] =
at. The PC is copied into *pc. This routine returns true on
success. */
-#define NBSD_MIPS_JB_PC (2 * 4)
-#define NBSD_MIPS_JB_ELEMENT_SIZE(gdbarch) mips_isa_regsize (gdbarch)
-#define NBSD_MIPS_JB_OFFSET(gdbarch) (NBSD_MIPS_JB_PC * \
- NBSD_MIPS_JB_ELEMENT_SIZE (gdbarch))
+#define NBSD_MIPS_JB_PC (2 * 4)
+#define NBSD_MIPS_JB_ELEMENT_SIZE(gdbarch) mips_isa_regsize (gdbarch)
+#define NBSD_MIPS_JB_OFFSET(gdbarch) \
+ (NBSD_MIPS_JB_PC * NBSD_MIPS_JB_ELEMENT_SIZE (gdbarch))
static int
mipsnbsd_get_longjmp_target (frame_info_ptr frame, CORE_ADDR *pc)
@@ -299,7 +286,7 @@ mipsnbsd_ilp32_fetch_link_map_offsets (void)
static struct link_map_offsets lmo;
static struct link_map_offsets *lmp = NULL;
- if (lmp == NULL)
+ if (lmp == NULL)
{
lmp = &lmo;
@@ -342,7 +329,7 @@ mipsnbsd_lp64_fetch_link_map_offsets (void)
/* Everything we need is in the first 40 bytes. */
lmo.link_map_size = 48;
lmo.l_addr_offset = 0;
- lmo.l_name_offset = 16;
+ lmo.l_name_offset = 16;
lmo.l_ld_offset = 24;
lmo.l_next_offset = 32;
lmo.l_prev_offset = 40;
@@ -350,16 +337,14 @@ mipsnbsd_lp64_fetch_link_map_offsets (void)
return lmp;
}
-
static void
-mipsnbsd_init_abi (struct gdbarch_info info,
- struct gdbarch *gdbarch)
+mipsnbsd_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
{
nbsd_init_abi (info, gdbarch);
- set_gdbarch_iterate_over_regset_sections
- (gdbarch, mipsnbsd_iterate_over_regset_sections);
+ set_gdbarch_iterate_over_regset_sections (
+ gdbarch, mipsnbsd_iterate_over_regset_sections);
set_gdbarch_get_longjmp_target (gdbarch, mipsnbsd_get_longjmp_target);
@@ -369,13 +354,14 @@ mipsnbsd_init_abi (struct gdbarch_info info,
set_gdbarch_software_single_step (gdbarch, mips_software_single_step);
/* NetBSD/mips has SVR4-style shared libraries. */
- set_solib_svr4_fetch_link_map_offsets
- (gdbarch, (gdbarch_ptr_bit (gdbarch) == 32 ?
- mipsnbsd_ilp32_fetch_link_map_offsets :
- mipsnbsd_lp64_fetch_link_map_offsets));
+ set_solib_svr4_fetch_link_map_offsets (
+ gdbarch,
+ (gdbarch_ptr_bit (gdbarch) == 32 ? mipsnbsd_ilp32_fetch_link_map_offsets
+ : mipsnbsd_lp64_fetch_link_map_offsets));
}
void _initialize_mipsnbsd_tdep ();
+
void
_initialize_mipsnbsd_tdep ()
{
diff --git a/gdb/mips-sde-tdep.c b/gdb/mips-sde-tdep.c
index b921d84131b..143fd0bcf87 100644
--- a/gdb/mips-sde-tdep.c
+++ b/gdb/mips-sde-tdep.c
@@ -67,8 +67,8 @@ mips_sde_frame_cache (frame_info_ptr this_frame, void **this_cache)
};
*/
- stack_addr = get_frame_register_signed (this_frame,
- gdbarch_sp_regnum (gdbarch));
+ stack_addr
+ = get_frame_register_signed (this_frame, gdbarch_sp_regnum (gdbarch));
switch (abi)
{
case MIPS_ABI_O32:
@@ -80,7 +80,7 @@ mips_sde_frame_cache (frame_info_ptr this_frame, void **this_cache)
break;
case MIPS_ABI_N32:
case MIPS_ABI_N64:
- default: /* Wild guess. */
+ default: /* Wild guess. */
/* 16: XCPTCONTEXT
16: xcpt_gen() argspace ( 0 bytes)
00: _xcptcall() saved ra, rounded up (16 bytes) */
@@ -88,27 +88,21 @@ mips_sde_frame_cache (frame_info_ptr this_frame, void **this_cache)
break;
}
- trad_frame_set_reg_addr (cache,
- MIPS_PS_REGNUM + gdbarch_num_regs (gdbarch),
+ trad_frame_set_reg_addr (cache, MIPS_PS_REGNUM + gdbarch_num_regs (gdbarch),
xcpt_frame + 0 * sizeof_reg_t);
- trad_frame_set_reg_addr (cache,
- regs->cause + gdbarch_num_regs (gdbarch),
+ trad_frame_set_reg_addr (cache, regs->cause + gdbarch_num_regs (gdbarch),
xcpt_frame + 1 * sizeof_reg_t);
- trad_frame_set_reg_addr (cache,
- regs->pc + gdbarch_num_regs (gdbarch),
+ trad_frame_set_reg_addr (cache, regs->pc + gdbarch_num_regs (gdbarch),
xcpt_frame + 2 * sizeof_reg_t);
- trad_frame_set_reg_addr (cache,
- regs->badvaddr + gdbarch_num_regs (gdbarch),
+ trad_frame_set_reg_addr (cache, regs->badvaddr + gdbarch_num_regs (gdbarch),
xcpt_frame + 3 * sizeof_reg_t);
for (i = 0; i < MIPS_NUMREGS; i++)
trad_frame_set_reg_addr (cache,
i + MIPS_ZERO_REGNUM + gdbarch_num_regs (gdbarch),
xcpt_frame + (4 + i) * sizeof_reg_t);
- trad_frame_set_reg_addr (cache,
- regs->lo + gdbarch_num_regs (gdbarch),
+ trad_frame_set_reg_addr (cache, regs->lo + gdbarch_num_regs (gdbarch),
xcpt_frame + 36 * sizeof_reg_t);
- trad_frame_set_reg_addr (cache,
- regs->hi + gdbarch_num_regs (gdbarch),
+ trad_frame_set_reg_addr (cache, regs->hi + gdbarch_num_regs (gdbarch),
xcpt_frame + 37 * sizeof_reg_t);
pc = get_frame_pc (this_frame);
@@ -133,8 +127,7 @@ mips_sde_frame_this_id (frame_info_ptr this_frame, void **this_cache,
/* Implement the prev_register function for the SDE frame unwinder. */
static struct value *
-mips_sde_frame_prev_register (frame_info_ptr this_frame,
- void **this_cache,
+mips_sde_frame_prev_register (frame_info_ptr this_frame, void **this_cache,
int prev_regnum)
{
struct trad_frame_cache *trad_cache
@@ -147,8 +140,7 @@ mips_sde_frame_prev_register (frame_info_ptr this_frame,
static int
mips_sde_frame_sniffer (const struct frame_unwind *self,
- frame_info_ptr this_frame,
- void **this_cache)
+ frame_info_ptr this_frame, void **this_cache)
{
CORE_ADDR pc = get_frame_pc (this_frame);
const char *name;
@@ -161,16 +153,14 @@ mips_sde_frame_sniffer (const struct frame_unwind *self,
/* Data structure for the SDE frame unwinder. */
-static const struct frame_unwind mips_sde_frame_unwind =
-{
- "mips sde sigtramp",
- SIGTRAMP_FRAME,
- default_frame_unwind_stop_reason,
- mips_sde_frame_this_id,
- mips_sde_frame_prev_register,
- NULL,
- mips_sde_frame_sniffer
-};
+static const struct frame_unwind mips_sde_frame_unwind
+ = { "mips sde sigtramp",
+ SIGTRAMP_FRAME,
+ default_frame_unwind_stop_reason,
+ mips_sde_frame_this_id,
+ mips_sde_frame_prev_register,
+ NULL,
+ mips_sde_frame_sniffer };
/* Implement the this_base, this_locals, and this_args hooks
for the normal unwinder. */
@@ -184,13 +174,9 @@ mips_sde_frame_base_address (frame_info_ptr this_frame, void **this_cache)
return trad_frame_get_this_base (this_trad_cache);
}
-static const struct frame_base mips_sde_frame_base =
-{
- &mips_sde_frame_unwind,
- mips_sde_frame_base_address,
- mips_sde_frame_base_address,
- mips_sde_frame_base_address
-};
+static const struct frame_base mips_sde_frame_base
+ = { &mips_sde_frame_unwind, mips_sde_frame_base_address,
+ mips_sde_frame_base_address, mips_sde_frame_base_address };
static const struct frame_base *
mips_sde_frame_base_sniffer (frame_info_ptr this_frame)
@@ -241,8 +227,7 @@ mips_sde_elf_osabi_sniffer (bfd *abfd)
real OS in use we must look for OS notes that have been added.
For SDE, we simply look for sections named with .sde as prefixes. */
- bfd_map_over_sections (abfd,
- mips_sde_elf_osabi_sniff_abi_tag_sections,
+ bfd_map_over_sections (abfd, mips_sde_elf_osabi_sniff_abi_tag_sections,
&osabi);
}
return osabi;
@@ -256,11 +241,11 @@ mips_sde_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
}
void _initialize_mips_sde_tdep ();
+
void
_initialize_mips_sde_tdep ()
{
- gdbarch_register_osabi_sniffer (bfd_arch_mips,
- bfd_target_elf_flavour,
+ gdbarch_register_osabi_sniffer (bfd_arch_mips, bfd_target_elf_flavour,
mips_sde_elf_osabi_sniffer);
gdbarch_register_osabi (bfd_arch_mips, 0, GDB_OSABI_SDE, mips_sde_init_abi);
diff --git a/gdb/mips-tdep.c b/gdb/mips-tdep.c
index 6088587edbf..c6b2c48b1fb 100644
--- a/gdb/mips-tdep.c
+++ b/gdb/mips-tdep.c
@@ -96,16 +96,8 @@ enum
static const char *mips_abi_string;
-static const char *const mips_abi_strings[] = {
- "auto",
- "n32",
- "o32",
- "n64",
- "o64",
- "eabi32",
- "eabi64",
- NULL
-};
+static const char *const mips_abi_strings[]
+ = { "auto", "n32", "o32", "n64", "o64", "eabi32", "eabi64", NULL };
/* Enum describing the different kinds of breakpoints. */
@@ -129,12 +121,8 @@ enum mips_breakpoint_kind
compressed ISA encoding used. */
static const char mips_compression_mips16[] = "mips16";
static const char mips_compression_micromips[] = "micromips";
-static const char *const mips_compression_strings[] =
-{
- mips_compression_mips16,
- mips_compression_micromips,
- NULL
-};
+static const char *const mips_compression_strings[]
+ = { mips_compression_mips16, mips_compression_micromips, NULL };
static const char *mips_compression_string = mips_compression_mips16;
@@ -146,30 +134,53 @@ struct register_alias
};
/* Aliases for o32 and most other ABIs. */
-const struct register_alias mips_o32_aliases[] = {
- { "ta0", 12 },
- { "ta1", 13 },
- { "ta2", 14 },
- { "ta3", 15 }
-};
+const struct register_alias mips_o32_aliases[]
+ = { { "ta0", 12 }, { "ta1", 13 }, { "ta2", 14 }, { "ta3", 15 } };
/* Aliases for n32 and n64. */
-const struct register_alias mips_n32_n64_aliases[] = {
- { "ta0", 8 },
- { "ta1", 9 },
- { "ta2", 10 },
- { "ta3", 11 }
-};
+const struct register_alias mips_n32_n64_aliases[]
+ = { { "ta0", 8 }, { "ta1", 9 }, { "ta2", 10 }, { "ta3", 11 } };
/* Aliases for ABI-independent registers. */
const struct register_alias mips_register_aliases[] = {
- /* The architecture manuals specify these ABI-independent names for
+/* The architecture manuals specify these ABI-independent names for
the GPRs. */
-#define R(n) { "r" #n, n }
- R(0), R(1), R(2), R(3), R(4), R(5), R(6), R(7),
- R(8), R(9), R(10), R(11), R(12), R(13), R(14), R(15),
- R(16), R(17), R(18), R(19), R(20), R(21), R(22), R(23),
- R(24), R(25), R(26), R(27), R(28), R(29), R(30), R(31),
+#define R(n) \
+ { \
+ "r" #n, n \
+ }
+ R (0),
+ R (1),
+ R (2),
+ R (3),
+ R (4),
+ R (5),
+ R (6),
+ R (7),
+ R (8),
+ R (9),
+ R (10),
+ R (11),
+ R (12),
+ R (13),
+ R (14),
+ R (15),
+ R (16),
+ R (17),
+ R (18),
+ R (19),
+ R (20),
+ R (21),
+ R (22),
+ R (23),
+ R (24),
+ R (25),
+ R (26),
+ R (27),
+ R (28),
+ R (29),
+ R (30),
+ R (31),
#undef R
/* k0 and k1 are sometimes called these instead (for "kernel
@@ -188,11 +199,14 @@ const struct register_alias mips_register_aliases[] = {
};
const struct register_alias mips_numeric_register_aliases[] = {
-#define R(n) { #n, n }
- R(0), R(1), R(2), R(3), R(4), R(5), R(6), R(7),
- R(8), R(9), R(10), R(11), R(12), R(13), R(14), R(15),
- R(16), R(17), R(18), R(19), R(20), R(21), R(22), R(23),
- R(24), R(25), R(26), R(27), R(28), R(29), R(30), R(31),
+#define R(n) \
+ { \
+#n, n \
+ }
+ R (0), R (1), R (2), R (3), R (4), R (5), R (6), R (7),
+ R (8), R (9), R (10), R (11), R (12), R (13), R (14), R (15),
+ R (16), R (17), R (18), R (19), R (20), R (21), R (22), R (23),
+ R (24), R (25), R (26), R (27), R (28), R (29), R (30), R (31),
#undef R
};
@@ -253,7 +267,7 @@ static bool
mips_eabi (gdbarch *arch)
{
mips_gdbarch_tdep *tdep = gdbarch_tdep<mips_gdbarch_tdep> (arch);
- return (tdep->mips_abi == MIPS_ABI_EABI32 \
+ return (tdep->mips_abi == MIPS_ABI_EABI32
|| tdep->mips_abi == MIPS_ABI_EABI64);
}
@@ -321,7 +335,7 @@ mips_abi_regsize (struct gdbarch *gdbarch)
case MIPS_ABI_UNKNOWN:
case MIPS_ABI_LAST:
default:
- internal_error (_("bad switch"));
+ internal_error (_ ("bad switch"));
}
}
@@ -353,7 +367,7 @@ is_micromips_isa (struct gdbarch *gdbarch)
static int
is_compact_addr (CORE_ADDR addr)
{
- return ((addr) & 1);
+ return ((addr) &1);
}
/* Return one iff ADDR denotes standard ISA code. */
@@ -421,7 +435,7 @@ mips_unmake_compact_addr (CORE_ADDR addr)
in a minimal symbol. */
static void
-mips_elf_make_msymbol_special (asymbol * sym, struct minimal_symbol *msym)
+mips_elf_make_msymbol_special (asymbol *sym, struct minimal_symbol *msym)
{
elf_symbol_type *elfsym = (elf_symbol_type *) sym;
unsigned char st_other;
@@ -506,9 +520,8 @@ mips_make_symbol_special (struct symbol *sym, struct objfile *objfile)
static void
mips_xfer_register (struct gdbarch *gdbarch, struct regcache *regcache,
- int reg_num, int length,
- enum bfd_endian endian, gdb_byte *in,
- const gdb_byte *out, int buf_offset)
+ int reg_num, int length, enum bfd_endian endian,
+ gdb_byte *in, const gdb_byte *out, int buf_offset)
{
int reg_offset = 0;
@@ -523,16 +536,16 @@ mips_xfer_register (struct gdbarch *gdbarch, struct regcache *regcache,
case BFD_ENDIAN_LITTLE:
reg_offset = 0;
break;
- case BFD_ENDIAN_UNKNOWN: /* Indicates no alignment. */
+ case BFD_ENDIAN_UNKNOWN: /* Indicates no alignment. */
reg_offset = 0;
break;
default:
- internal_error (_("bad switch"));
+ internal_error (_ ("bad switch"));
}
if (mips_debug)
gdb_printf (gdb_stderr,
- "xfer $%d, reg offset %d, buf offset %d, length %d, ",
- reg_num, reg_offset, buf_offset, length);
+ "xfer $%d, reg offset %d, buf offset %d, length %d, ", reg_num,
+ reg_offset, buf_offset, length);
if (mips_debug && out != NULL)
{
int i;
@@ -543,7 +556,8 @@ mips_xfer_register (struct gdbarch *gdbarch, struct regcache *regcache,
if (in != NULL)
regcache->cooked_read_part (reg_num, reg_offset, length, in + buf_offset);
if (out != NULL)
- regcache->cooked_write_part (reg_num, reg_offset, length, out + buf_offset);
+ regcache->cooked_write_part (reg_num, reg_offset, length,
+ out + buf_offset);
if (mips_debug && in != NULL)
{
int i;
@@ -581,7 +595,7 @@ mips2_fp_compat (frame_info_ptr frame)
return 0;
}
-#define VM_MIN_ADDRESS (CORE_ADDR)0x400000
+#define VM_MIN_ADDRESS (CORE_ADDR) 0x400000
static CORE_ADDR heuristic_proc_start (struct gdbarch *, CORE_ADDR);
@@ -595,42 +609,36 @@ static struct cmd_list_element *showmipscmdlist = NULL;
are listed in the following tables. */
enum
-{ NUM_MIPS_PROCESSOR_REGS = (90 - 32) };
+{
+ NUM_MIPS_PROCESSOR_REGS = (90 - 32)
+};
/* Generic MIPS. */
-static const char * const mips_generic_reg_names[NUM_MIPS_PROCESSOR_REGS] = {
- "sr", "lo", "hi", "bad", "cause", "pc",
- "f0", "f1", "f2", "f3", "f4", "f5", "f6", "f7",
- "f8", "f9", "f10", "f11", "f12", "f13", "f14", "f15",
- "f16", "f17", "f18", "f19", "f20", "f21", "f22", "f23",
- "f24", "f25", "f26", "f27", "f28", "f29", "f30", "f31",
- "fsr", "fir",
+static const char *const mips_generic_reg_names[NUM_MIPS_PROCESSOR_REGS] = {
+ "sr", "lo", "hi", "bad", "cause", "pc", "f0", "f1", "f2", "f3",
+ "f4", "f5", "f6", "f7", "f8", "f9", "f10", "f11", "f12", "f13",
+ "f14", "f15", "f16", "f17", "f18", "f19", "f20", "f21", "f22", "f23",
+ "f24", "f25", "f26", "f27", "f28", "f29", "f30", "f31", "fsr", "fir",
};
/* Names of tx39 registers. */
-static const char * const mips_tx39_reg_names[NUM_MIPS_PROCESSOR_REGS] = {
- "sr", "lo", "hi", "bad", "cause", "pc",
- "", "", "", "", "", "", "", "",
- "", "", "", "", "", "", "", "",
- "", "", "", "", "", "", "", "",
- "", "", "", "", "", "", "", "",
- "", "", "", "",
- "", "", "", "", "", "", "", "",
- "", "", "config", "cache", "debug", "depc", "epc",
+static const char *const mips_tx39_reg_names[NUM_MIPS_PROCESSOR_REGS] = {
+ "sr", "lo", "hi", "bad", "cause", "pc", "", "", "", "",
+ "", "", "", "", "", "", "", "", "", "",
+ "", "", "", "", "", "", "", "", "", "",
+ "", "", "", "", "", "", "", "", "", "",
+ "", "", "", "", "", "", "", "", "", "",
+ "", "", "config", "cache", "debug", "depc", "epc",
};
/* Names of registers with Linux kernels. */
-static const char * const mips_linux_reg_names[NUM_MIPS_PROCESSOR_REGS] = {
- "sr", "lo", "hi", "bad", "cause", "pc",
- "f0", "f1", "f2", "f3", "f4", "f5", "f6", "f7",
- "f8", "f9", "f10", "f11", "f12", "f13", "f14", "f15",
- "f16", "f17", "f18", "f19", "f20", "f21", "f22", "f23",
- "f24", "f25", "f26", "f27", "f28", "f29", "f30", "f31",
- "fsr", "fir"
-};
-
+static const char *const mips_linux_reg_names[NUM_MIPS_PROCESSOR_REGS]
+ = { "sr", "lo", "hi", "bad", "cause", "pc", "f0", "f1", "f2", "f3",
+ "f4", "f5", "f6", "f7", "f8", "f9", "f10", "f11", "f12", "f13",
+ "f14", "f15", "f16", "f17", "f18", "f19", "f20", "f21", "f22", "f23",
+ "f24", "f25", "f26", "f27", "f28", "f29", "f30", "f31", "fsr", "fir" };
/* Return the name of the register corresponding to REGNO. */
static const char *
@@ -639,19 +647,16 @@ mips_register_name (struct gdbarch *gdbarch, int regno)
mips_gdbarch_tdep *tdep = gdbarch_tdep<mips_gdbarch_tdep> (gdbarch);
/* GPR names for all ABIs other than n32/n64. */
static const char *mips_gpr_names[] = {
- "zero", "at", "v0", "v1", "a0", "a1", "a2", "a3",
- "t0", "t1", "t2", "t3", "t4", "t5", "t6", "t7",
- "s0", "s1", "s2", "s3", "s4", "s5", "s6", "s7",
- "t8", "t9", "k0", "k1", "gp", "sp", "s8", "ra",
+ "zero", "at", "v0", "v1", "a0", "a1", "a2", "a3", "t0", "t1", "t2",
+ "t3", "t4", "t5", "t6", "t7", "s0", "s1", "s2", "s3", "s4", "s5",
+ "s6", "s7", "t8", "t9", "k0", "k1", "gp", "sp", "s8", "ra",
};
/* GPR names for n32 and n64 ABIs. */
- static const char *mips_n32_n64_gpr_names[] = {
- "zero", "at", "v0", "v1", "a0", "a1", "a2", "a3",
- "a4", "a5", "a6", "a7", "t0", "t1", "t2", "t3",
- "s0", "s1", "s2", "s3", "s4", "s5", "s6", "s7",
- "t8", "t9", "k0", "k1", "gp", "sp", "s8", "ra"
- };
+ static const char *mips_n32_n64_gpr_names[]
+ = { "zero", "at", "v0", "v1", "a0", "a1", "a2", "a3", "a4", "a5", "a6",
+ "a7", "t0", "t1", "t2", "t3", "s0", "s1", "s2", "s3", "s4", "s5",
+ "s6", "s7", "t8", "t9", "k0", "k1", "gp", "sp", "s8", "ra" };
enum mips_abi abi = mips_abi (gdbarch);
@@ -690,7 +695,7 @@ mips_register_name (struct gdbarch *gdbarch, int regno)
return "";
}
else
- internal_error (_("mips_register_name: bad register number %d"), rawnum);
+ internal_error (_ ("mips_register_name: bad register number %d"), rawnum);
}
/* Return the groups that a MIPS register can be categorised into. */
@@ -764,16 +769,17 @@ mips_tdesc_register_reggroup_p (struct gdbarch *gdbarch, int regnum,
registers. Take care of alignment and size problems. */
static enum register_status
-mips_pseudo_register_read (struct gdbarch *gdbarch, readable_regcache *regcache,
- int cookednum, gdb_byte *buf)
+mips_pseudo_register_read (struct gdbarch *gdbarch,
+ readable_regcache *regcache, int cookednum,
+ gdb_byte *buf)
{
int rawnum = cookednum % gdbarch_num_regs (gdbarch);
gdb_assert (cookednum >= gdbarch_num_regs (gdbarch)
&& cookednum < 2 * gdbarch_num_regs (gdbarch));
if (register_size (gdbarch, rawnum) == register_size (gdbarch, cookednum))
return regcache->raw_read (rawnum, buf);
- else if (register_size (gdbarch, rawnum) >
- register_size (gdbarch, cookednum))
+ else if (register_size (gdbarch, rawnum)
+ > register_size (gdbarch, cookednum))
{
mips_gdbarch_tdep *tdep = gdbarch_tdep<mips_gdbarch_tdep> (gdbarch);
@@ -792,21 +798,20 @@ mips_pseudo_register_read (struct gdbarch *gdbarch, readable_regcache *regcache,
}
}
else
- internal_error (_("bad register size"));
+ internal_error (_ ("bad register size"));
}
static void
-mips_pseudo_register_write (struct gdbarch *gdbarch,
- struct regcache *regcache, int cookednum,
- const gdb_byte *buf)
+mips_pseudo_register_write (struct gdbarch *gdbarch, struct regcache *regcache,
+ int cookednum, const gdb_byte *buf)
{
int rawnum = cookednum % gdbarch_num_regs (gdbarch);
gdb_assert (cookednum >= gdbarch_num_regs (gdbarch)
&& cookednum < 2 * gdbarch_num_regs (gdbarch));
if (register_size (gdbarch, rawnum) == register_size (gdbarch, cookednum))
regcache->raw_write (rawnum, buf);
- else if (register_size (gdbarch, rawnum) >
- register_size (gdbarch, cookednum))
+ else if (register_size (gdbarch, rawnum)
+ > register_size (gdbarch, cookednum))
{
mips_gdbarch_tdep *tdep = gdbarch_tdep<mips_gdbarch_tdep> (gdbarch);
@@ -823,7 +828,7 @@ mips_pseudo_register_write (struct gdbarch *gdbarch,
}
}
else
- internal_error (_("bad register size"));
+ internal_error (_ ("bad register size"));
}
static int
@@ -852,8 +857,7 @@ mips_ax_pseudo_register_push_stack (struct gdbarch *gdbarch,
if (register_size (gdbarch, rawnum) > register_size (gdbarch, reg))
{
- mips_gdbarch_tdep *tdep
- = gdbarch_tdep<mips_gdbarch_tdep> (gdbarch);
+ mips_gdbarch_tdep *tdep = gdbarch_tdep<mips_gdbarch_tdep> (gdbarch);
if (!tdep->mips64_transfers_32bit_regs_p
|| gdbarch_byte_order (gdbarch) != BFD_ENDIAN_BIG)
@@ -866,7 +870,7 @@ mips_ax_pseudo_register_push_stack (struct gdbarch *gdbarch,
}
}
else
- internal_error (_("bad register size"));
+ internal_error (_ ("bad register size"));
return 0;
}
@@ -897,7 +901,7 @@ set_mips64_transfers_32bit_regs (const char *args, int from_tty,
if (!gdbarch_update_p (info))
{
mips64_transfers_32bit_regs_p = 0;
- error (_("32-bit compatibility mode not supported"));
+ error (_ ("32-bit compatibility mode not supported"));
}
}
@@ -926,23 +930,21 @@ mips_convert_register_gpreg_case_p (struct gdbarch *gdbarch, int regnum,
{
int num_regs = gdbarch_num_regs (gdbarch);
- return (register_size (gdbarch, regnum) == 8
- && regnum % num_regs > 0 && regnum % num_regs < 32
- && type->length () < 8);
+ return (register_size (gdbarch, regnum) == 8 && regnum % num_regs > 0
+ && regnum % num_regs < 32 && type->length () < 8);
}
static int
-mips_convert_register_p (struct gdbarch *gdbarch,
- int regnum, struct type *type)
+mips_convert_register_p (struct gdbarch *gdbarch, int regnum,
+ struct type *type)
{
return (mips_convert_register_float_case_p (gdbarch, regnum, type)
|| mips_convert_register_gpreg_case_p (gdbarch, regnum, type));
}
static int
-mips_register_to_value (frame_info_ptr frame, int regnum,
- struct type *type, gdb_byte *to,
- int *optimizedp, int *unavailablep)
+mips_register_to_value (frame_info_ptr frame, int regnum, struct type *type,
+ gdb_byte *to, int *optimizedp, int *unavailablep)
{
struct gdbarch *gdbarch = get_frame_arch (frame);
@@ -951,11 +953,11 @@ mips_register_to_value (frame_info_ptr frame, int regnum,
get_frame_register (frame, regnum + 0, to + 4);
get_frame_register (frame, regnum + 1, to + 0);
- if (!get_frame_register_bytes (frame, regnum + 0, 0, {to + 4, 4},
+ if (!get_frame_register_bytes (frame, regnum + 0, 0, { to + 4, 4 },
optimizedp, unavailablep))
return 0;
- if (!get_frame_register_bytes (frame, regnum + 1, 0, {to + 0, 4},
+ if (!get_frame_register_bytes (frame, regnum + 1, 0, { to + 0, 4 },
optimizedp, unavailablep))
return 0;
*optimizedp = *unavailablep = 0;
@@ -967,7 +969,7 @@ mips_register_to_value (frame_info_ptr frame, int regnum,
CORE_ADDR offset;
offset = gdbarch_byte_order (gdbarch) == BFD_ENDIAN_BIG ? 8 - len : 0;
- if (!get_frame_register_bytes (frame, regnum, offset, {to, len},
+ if (!get_frame_register_bytes (frame, regnum, offset, { to, len },
optimizedp, unavailablep))
return 0;
@@ -976,13 +978,13 @@ mips_register_to_value (frame_info_ptr frame, int regnum,
}
else
{
- internal_error (_("mips_register_to_value: unrecognized case"));
+ internal_error (_ ("mips_register_to_value: unrecognized case"));
}
}
static void
-mips_value_to_register (frame_info_ptr frame, int regnum,
- struct type *type, const gdb_byte *from)
+mips_value_to_register (frame_info_ptr frame, int regnum, struct type *type,
+ const gdb_byte *from)
{
struct gdbarch *gdbarch = get_frame_arch (frame);
@@ -995,7 +997,7 @@ mips_value_to_register (frame_info_ptr frame, int regnum,
{
gdb_byte fill[8];
size_t len = type->length ();
-
+
/* Sign extend values, irrespective of type, that are stored to
a 64-bit general purpose register. (32-bit unsigned values
are stored as signed quantities within a 64-bit register.
@@ -1008,22 +1010,22 @@ mips_value_to_register (frame_info_ptr frame, int regnum,
store_signed_integer (fill, 8, BFD_ENDIAN_BIG, -1);
else
store_signed_integer (fill, 8, BFD_ENDIAN_BIG, 0);
- put_frame_register_bytes (frame, regnum, 0, {fill, 8 - len});
- put_frame_register_bytes (frame, regnum, 8 - len, {from, len});
+ put_frame_register_bytes (frame, regnum, 0, { fill, 8 - len });
+ put_frame_register_bytes (frame, regnum, 8 - len, { from, len });
}
else
{
- if (from[len-1] & 0x80)
+ if (from[len - 1] & 0x80)
store_signed_integer (fill, 8, BFD_ENDIAN_LITTLE, -1);
else
store_signed_integer (fill, 8, BFD_ENDIAN_LITTLE, 0);
- put_frame_register_bytes (frame, regnum, 0, {from, len});
- put_frame_register_bytes (frame, regnum, len, {fill, 8 - len});
+ put_frame_register_bytes (frame, regnum, 0, { from, len });
+ put_frame_register_bytes (frame, regnum, len, { fill, 8 - len });
}
}
else
{
- internal_error (_("mips_value_to_register: unrecognized case"));
+ internal_error (_ ("mips_value_to_register: unrecognized case"));
}
}
@@ -1117,7 +1119,7 @@ mips_pseudo_register_type (struct gdbarch *gdbarch, int regnum)
/* Use pointer types for registers if we can. For n32 we can not,
since we do not have a 64-bit pointer type. */
if (mips_abi_regsize (gdbarch)
- == builtin_type (gdbarch)->builtin_data_ptr->length())
+ == builtin_type (gdbarch)->builtin_data_ptr->length ())
{
if (rawnum == MIPS_SP_REGNUM
|| rawnum == mips_regnum (gdbarch)->badvaddr)
@@ -1145,8 +1147,7 @@ mips_pseudo_register_type (struct gdbarch *gdbarch, int regnum)
so allow the target to provide 64 bits without interfering
with the displayed type. */
if (gdbarch_osabi (gdbarch) != GDB_OSABI_LINUX
- && rawnum >= MIPS_FIRST_EMBED_REGNUM
- && rawnum <= MIPS_LAST_EMBED_REGNUM)
+ && rawnum >= MIPS_FIRST_EMBED_REGNUM && rawnum <= MIPS_LAST_EMBED_REGNUM)
return builtin_type (gdbarch)->builtin_int32;
/* For all other registers, pass through the hardware type. */
@@ -1169,7 +1170,7 @@ mips_mask_address_p (mips_gdbarch_tdep *tdep)
case AUTO_BOOLEAN_AUTO:
return tdep->default_mask_address_p;
default:
- internal_error (_("mips_mask_address_p: bad switch"));
+ internal_error (_ ("mips_mask_address_p: bad switch"));
return -1;
}
}
@@ -1182,21 +1183,22 @@ show_mask_address (struct ui_file *file, int from_tty,
if (mask_address_var == AUTO_BOOLEAN_AUTO)
{
if (gdbarch_bfd_arch_info (target_gdbarch ())->arch != bfd_arch_mips)
- additional_text = _(" (current architecture is not MIPS)");
+ additional_text = _ (" (current architecture is not MIPS)");
else
{
mips_gdbarch_tdep *tdep
= gdbarch_tdep<mips_gdbarch_tdep> (target_gdbarch ());
if (mips_mask_address_p (tdep))
- additional_text = _(" (currently \"on\")");
+ additional_text = _ (" (currently \"on\")");
else
- additional_text = _(" (currently \"off\")");
+ additional_text = _ (" (currently \"off\")");
}
}
- gdb_printf (file, _("Zeroing of upper 32 bits of 64-bit addresses is \"%s\"%s.\n"),
- value, additional_text);
+ gdb_printf (
+ file, _ ("Zeroing of upper 32 bits of 64-bit addresses is \"%s\"%s.\n"),
+ value, additional_text);
}
/* Tell if the program counter value in MEMADDR is in a standard ISA
@@ -1385,7 +1387,7 @@ mips_in_frame_stub (CORE_ADDR pc)
if (startswith (name, mips_str_fn_stub))
return 1;
- return 0; /* Not a stub. */
+ return 0; /* Not a stub. */
}
/* MIPS believes that the PC has a sign extended value. Perhaps the
@@ -1414,11 +1416,12 @@ mips_unwind_pc (struct gdbarch *gdbarch, frame_info_ptr next_frame)
and thus the caller's address is in $s2. */
if (frame_relative_level (next_frame) >= 0 && mips_in_frame_stub (pc))
{
- pc = frame_unwind_register_signed
- (next_frame, gdbarch_num_regs (gdbarch) + MIPS_RA_REGNUM);
+ pc = frame_unwind_register_signed (next_frame, gdbarch_num_regs (gdbarch)
+ + MIPS_RA_REGNUM);
if (mips_in_frame_stub (pc))
- pc = frame_unwind_register_signed
- (next_frame, gdbarch_num_regs (gdbarch) + MIPS_S2_REGNUM);
+ pc = frame_unwind_register_signed (next_frame,
+ gdbarch_num_regs (gdbarch)
+ + MIPS_S2_REGNUM);
}
return pc;
}
@@ -1426,8 +1429,8 @@ mips_unwind_pc (struct gdbarch *gdbarch, frame_info_ptr next_frame)
static CORE_ADDR
mips_unwind_sp (struct gdbarch *gdbarch, frame_info_ptr next_frame)
{
- return frame_unwind_register_signed
- (next_frame, gdbarch_num_regs (gdbarch) + MIPS_SP_REGNUM);
+ return frame_unwind_register_signed (next_frame, gdbarch_num_regs (gdbarch)
+ + MIPS_SP_REGNUM);
}
/* Assuming THIS_FRAME is a dummy, return the frame ID of that
@@ -1438,11 +1441,10 @@ mips_unwind_sp (struct gdbarch *gdbarch, frame_info_ptr next_frame)
static struct frame_id
mips_dummy_id (struct gdbarch *gdbarch, frame_info_ptr this_frame)
{
- return frame_id_build
- (get_frame_register_signed (this_frame,
- gdbarch_num_regs (gdbarch)
- + MIPS_SP_REGNUM),
- get_frame_pc (this_frame));
+ return frame_id_build (get_frame_register_signed (this_frame,
+ gdbarch_num_regs (gdbarch)
+ + MIPS_SP_REGNUM),
+ get_frame_pc (this_frame));
}
/* Implement the "write_pc" gdbarch method. */
@@ -1459,8 +1461,8 @@ mips_write_pc (struct regcache *regcache, CORE_ADDR pc)
MIPS16/microMIPS as appropriate. */
static ULONGEST
-mips_fetch_instruction (struct gdbarch *gdbarch,
- enum mips_isa isa, CORE_ADDR addr, int *errp)
+mips_fetch_instruction (struct gdbarch *gdbarch, enum mips_isa isa,
+ CORE_ADDR addr, int *errp)
{
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
gdb_byte buf[MIPS_INSN32_SIZE];
@@ -1478,7 +1480,7 @@ mips_fetch_instruction (struct gdbarch *gdbarch,
instlen = MIPS_INSN32_SIZE;
break;
default:
- internal_error (_("invalid ISA"));
+ internal_error (_ ("invalid ISA"));
break;
}
err = target_read_memory (addr, buf, instlen);
@@ -1515,11 +1517,11 @@ mips_fetch_instruction (struct gdbarch *gdbarch,
/* 16-bit/32-bit-high-part instruction formats, B and S refer to the lowest
bit and the size respectively of the field extracted. */
-#define b0s4_imm(x) ((x) & 0xf)
-#define b0s5_imm(x) ((x) & 0x1f)
-#define b0s5_reg(x) ((x) & 0x1f)
-#define b0s7_imm(x) ((x) & 0x7f)
-#define b0s10_imm(x) ((x) & 0x3ff)
+#define b0s4_imm(x) ((x) &0xf)
+#define b0s5_imm(x) ((x) &0x1f)
+#define b0s5_reg(x) ((x) &0x1f)
+#define b0s7_imm(x) ((x) &0x7f)
+#define b0s10_imm(x) ((x) &0x3ff)
#define b1s4_imm(x) (((x) >> 1) & 0xf)
#define b1s9_imm(x) (((x) >> 1) & 0x1ff)
#define b2s3_cc(x) (((x) >> 2) & 0x7)
@@ -1531,11 +1533,11 @@ mips_fetch_instruction (struct gdbarch *gdbarch,
/* 32-bit instruction formats, B and S refer to the lowest bit and the size
respectively of the field extracted. */
-#define b0s6_op(x) ((x) & 0x3f)
-#define b0s11_op(x) ((x) & 0x7ff)
-#define b0s12_imm(x) ((x) & 0xfff)
-#define b0s16_imm(x) ((x) & 0xffff)
-#define b0s26_imm(x) ((x) & 0x3ffffff)
+#define b0s6_op(x) ((x) &0x3f)
+#define b0s11_op(x) ((x) &0x7ff)
+#define b0s12_imm(x) ((x) &0xfff)
+#define b0s16_imm(x) ((x) &0xffff)
+#define b0s26_imm(x) ((x) &0x3ffffff)
#define b6s10_ext(x) (((x) >> 6) & 0x3ff)
#define b11s5_reg(x) (((x) >> 11) & 0x1f)
#define b12s4_op(x) (((x) >> 12) & 0xf)
@@ -1560,9 +1562,9 @@ mips_insn_size (enum mips_isa isa, ULONGEST insn)
else
return MIPS_INSN16_SIZE;
case ISA_MIPS:
- return MIPS_INSN32_SIZE;
+ return MIPS_INSN32_SIZE;
}
- internal_error (_("invalid ISA"));
+ internal_error (_ ("invalid ISA"));
}
static LONGEST
@@ -1609,8 +1611,8 @@ is_octeon (struct gdbarch *gdbarch)
const struct bfd_arch_info *info = gdbarch_bfd_arch_info (gdbarch);
return (info->mach == bfd_mach_mips_octeon
- || info->mach == bfd_mach_mips_octeonp
- || info->mach == bfd_mach_mips_octeon2);
+ || info->mach == bfd_mach_mips_octeonp
+ || info->mach == bfd_mach_mips_octeon2);
}
/* Return true if the OP represents the Octeon's BBIT instruction. */
@@ -1629,7 +1631,6 @@ is_octeon_bbit_op (int op, struct gdbarch *gdbarch)
return 0;
}
-
/* Determine where to set a single step breakpoint while considering
branch prediction. */
@@ -1641,7 +1642,7 @@ mips32_next_pc (struct regcache *regcache, CORE_ADDR pc)
int op;
inst = mips_fetch_instruction (gdbarch, ISA_MIPS, pc, NULL);
op = itype_op (inst);
- if ((inst & 0xe0000000) != 0) /* Not a special, jump or branch
+ if ((inst & 0xe0000000) != 0) /* Not a special, jump or branch
instruction. */
{
if (op >> 2 == 5)
@@ -1649,13 +1650,13 @@ mips32_next_pc (struct regcache *regcache, CORE_ADDR pc)
{
switch (op & 0x03)
{
- case 0: /* BEQL */
+ case 0: /* BEQL */
goto equal_branch;
- case 1: /* BNEL */
+ case 1: /* BNEL */
goto neq_branch;
- case 2: /* BLEZL */
+ case 2: /* BLEZL */
goto less_branch;
- case 3: /* BGTZL */
+ case 3: /* BGTZL */
goto greater_branch;
default:
pc += 4;
@@ -1664,12 +1665,10 @@ mips32_next_pc (struct regcache *regcache, CORE_ADDR pc)
else if (op == 17 && itype_rs (inst) == 8)
/* BC1F, BC1FL, BC1T, BC1TL: 010001 01000 */
pc = mips32_bc1_pc (gdbarch, regcache, inst, pc + 4, 1);
- else if (op == 17 && itype_rs (inst) == 9
- && (itype_rt (inst) & 2) == 0)
+ else if (op == 17 && itype_rs (inst) == 9 && (itype_rt (inst) & 2) == 0)
/* BC1ANY2F, BC1ANY2T: 010001 01001 xxx0x */
pc = mips32_bc1_pc (gdbarch, regcache, inst, pc + 4, 2);
- else if (op == 17 && itype_rs (inst) == 10
- && (itype_rt (inst) & 2) == 0)
+ else if (op == 17 && itype_rs (inst) == 10 && (itype_rt (inst) & 2) == 0)
/* BC1ANY4F, BC1ANY4T: 010001 01010 xxx0x */
pc = mips32_bc1_pc (gdbarch, regcache, inst, pc + 4, 4);
else if (op == 29)
@@ -1693,33 +1692,33 @@ mips32_next_pc (struct regcache *regcache, CORE_ADDR pc)
if (op == 54 || op == 62)
bit += 32;
- if (((regcache_raw_get_signed (regcache,
- itype_rs (inst)) >> bit) & 1)
+ if (((regcache_raw_get_signed (regcache, itype_rs (inst)) >> bit)
+ & 1)
== branch_if)
pc += mips32_relative_offset (inst) + 4;
else
- pc += 8; /* After the delay slot. */
+ pc += 8; /* After the delay slot. */
}
else
- pc += 4; /* Not a branch, next instruction is easy. */
+ pc += 4; /* Not a branch, next instruction is easy. */
}
else
- { /* This gets way messy. */
+ { /* This gets way messy. */
/* Further subdivide into SPECIAL, REGIMM and other. */
- switch (op & 0x07) /* Extract bits 28,27,26. */
+ switch (op & 0x07) /* Extract bits 28,27,26. */
{
- case 0: /* SPECIAL */
+ case 0: /* SPECIAL */
op = rtype_funct (inst);
switch (op)
{
- case 8: /* JR */
- case 9: /* JALR */
+ case 8: /* JR */
+ case 9: /* JALR */
/* Set PC to that address. */
pc = regcache_raw_get_signed (regcache, rtype_rs (inst));
break;
- case 12: /* SYSCALL */
+ case 12: /* SYSCALL */
{
mips_gdbarch_tdep *tdep
= gdbarch_tdep<mips_gdbarch_tdep> (gdbarch);
@@ -1734,33 +1733,33 @@ mips32_next_pc (struct regcache *regcache, CORE_ADDR pc)
pc += 4;
}
- break; /* end SPECIAL */
- case 1: /* REGIMM */
+ break; /* end SPECIAL */
+ case 1: /* REGIMM */
{
- op = itype_rt (inst); /* branch condition */
+ op = itype_rt (inst); /* branch condition */
switch (op)
{
- case 0: /* BLTZ */
- case 2: /* BLTZL */
- case 16: /* BLTZAL */
- case 18: /* BLTZALL */
+ case 0: /* BLTZ */
+ case 2: /* BLTZL */
+ case 16: /* BLTZAL */
+ case 18: /* BLTZALL */
less_branch:
if (regcache_raw_get_signed (regcache, itype_rs (inst)) < 0)
pc += mips32_relative_offset (inst) + 4;
else
- pc += 8; /* after the delay slot */
+ pc += 8; /* after the delay slot */
break;
- case 1: /* BGEZ */
- case 3: /* BGEZL */
- case 17: /* BGEZAL */
- case 19: /* BGEZALL */
+ case 1: /* BGEZ */
+ case 3: /* BGEZL */
+ case 17: /* BGEZAL */
+ case 19: /* BGEZALL */
if (regcache_raw_get_signed (regcache, itype_rs (inst)) >= 0)
pc += mips32_relative_offset (inst) + 4;
else
- pc += 8; /* after the delay slot */
+ pc += 8; /* after the delay slot */
break;
- case 0x1c: /* BPOSGE32 */
- case 0x1e: /* BPOSGE64 */
+ case 0x1c: /* BPOSGE32 */
+ case 0x1e: /* BPOSGE64 */
pc += 4;
if (itype_rs (inst) == 0)
{
@@ -1771,8 +1770,8 @@ mips32_next_pc (struct regcache *regcache, CORE_ADDR pc)
/* No way to handle; it'll most likely trap anyway. */
break;
- if ((regcache_raw_get_unsigned (regcache,
- dspctl) & 0x7f) >= pos)
+ if ((regcache_raw_get_unsigned (regcache, dspctl) & 0x7f)
+ >= pos)
pc += mips32_relative_offset (inst);
else
pc += 4;
@@ -1783,9 +1782,9 @@ mips32_next_pc (struct regcache *regcache, CORE_ADDR pc)
pc += 4;
}
}
- break; /* end REGIMM */
- case 2: /* J */
- case 3: /* JAL */
+ break; /* end REGIMM */
+ case 2: /* J */
+ case 3: /* JAL */
{
unsigned long reg;
reg = jtype_target (inst) << 2;
@@ -1793,23 +1792,23 @@ mips32_next_pc (struct regcache *regcache, CORE_ADDR pc)
pc = reg + ((pc + 4) & ~(CORE_ADDR) 0x0fffffff);
}
break;
- case 4: /* BEQ, BEQL */
+ case 4: /* BEQ, BEQL */
equal_branch:
- if (regcache_raw_get_signed (regcache, itype_rs (inst)) ==
- regcache_raw_get_signed (regcache, itype_rt (inst)))
+ if (regcache_raw_get_signed (regcache, itype_rs (inst))
+ == regcache_raw_get_signed (regcache, itype_rt (inst)))
pc += mips32_relative_offset (inst) + 4;
else
pc += 8;
break;
- case 5: /* BNE, BNEL */
+ case 5: /* BNE, BNEL */
neq_branch:
- if (regcache_raw_get_signed (regcache, itype_rs (inst)) !=
- regcache_raw_get_signed (regcache, itype_rt (inst)))
+ if (regcache_raw_get_signed (regcache, itype_rs (inst))
+ != regcache_raw_get_signed (regcache, itype_rt (inst)))
pc += mips32_relative_offset (inst) + 4;
else
pc += 8;
break;
- case 6: /* BLEZ, BLEZL */
+ case 6: /* BLEZ, BLEZL */
if (regcache_raw_get_signed (regcache, itype_rs (inst)) <= 0)
pc += mips32_relative_offset (inst) + 4;
else
@@ -1817,16 +1816,16 @@ mips32_next_pc (struct regcache *regcache, CORE_ADDR pc)
break;
case 7:
default:
- greater_branch: /* BGTZ, BGTZL */
+ greater_branch: /* BGTZ, BGTZL */
if (regcache_raw_get_signed (regcache, itype_rs (inst)) > 0)
pc += mips32_relative_offset (inst) + 4;
else
pc += 8;
break;
- } /* switch */
- } /* else */
+ } /* switch */
+ } /* else */
return pc;
-} /* mips32_next_pc */
+} /* mips32_next_pc */
/* Extract the 7-bit signed immediate offset from the microMIPS instruction
INSN. */
@@ -1950,8 +1949,8 @@ micromips_next_pc (struct regcache *regcache, CORE_ADDR pc)
case 0x00: /* BLTZ: bits 010000 00000 */
case 0x01: /* BLTZAL: bits 010000 00001 */
case 0x11: /* BLTZALS: bits 010000 10001 */
- if (regcache_raw_get_signed (regcache,
- b0s5_reg (insn >> 16)) < 0)
+ if (regcache_raw_get_signed (regcache, b0s5_reg (insn >> 16))
+ < 0)
pc += micromips_relative_offset16 (insn);
else
pc += micromips_pc_insn_size (gdbarch, pc);
@@ -1960,38 +1959,38 @@ micromips_next_pc (struct regcache *regcache, CORE_ADDR pc)
case 0x02: /* BGEZ: bits 010000 00010 */
case 0x03: /* BGEZAL: bits 010000 00011 */
case 0x13: /* BGEZALS: bits 010000 10011 */
- if (regcache_raw_get_signed (regcache,
- b0s5_reg (insn >> 16)) >= 0)
+ if (regcache_raw_get_signed (regcache, b0s5_reg (insn >> 16))
+ >= 0)
pc += micromips_relative_offset16 (insn);
else
pc += micromips_pc_insn_size (gdbarch, pc);
break;
case 0x04: /* BLEZ: bits 010000 00100 */
- if (regcache_raw_get_signed (regcache,
- b0s5_reg (insn >> 16)) <= 0)
+ if (regcache_raw_get_signed (regcache, b0s5_reg (insn >> 16))
+ <= 0)
pc += micromips_relative_offset16 (insn);
else
pc += micromips_pc_insn_size (gdbarch, pc);
break;
case 0x05: /* BNEZC: bits 010000 00101 */
- if (regcache_raw_get_signed (regcache,
- b0s5_reg (insn >> 16)) != 0)
+ if (regcache_raw_get_signed (regcache, b0s5_reg (insn >> 16))
+ != 0)
pc += micromips_relative_offset16 (insn);
break;
case 0x06: /* BGTZ: bits 010000 00110 */
- if (regcache_raw_get_signed (regcache,
- b0s5_reg (insn >> 16)) > 0)
+ if (regcache_raw_get_signed (regcache, b0s5_reg (insn >> 16))
+ > 0)
pc += micromips_relative_offset16 (insn);
else
pc += micromips_pc_insn_size (gdbarch, pc);
break;
case 0x07: /* BEQZC: bits 010000 00111 */
- if (regcache_raw_get_signed (regcache,
- b0s5_reg (insn >> 16)) == 0)
+ if (regcache_raw_get_signed (regcache, b0s5_reg (insn >> 16))
+ == 0)
pc += micromips_relative_offset16 (insn);
break;
@@ -2012,8 +2011,8 @@ micromips_next_pc (struct regcache *regcache, CORE_ADDR pc)
/* No way to handle; it'll most likely trap anyway. */
break;
- if ((regcache_raw_get_unsigned (regcache,
- dspctl) & 0x7f) >= pos)
+ if ((regcache_raw_get_unsigned (regcache, dspctl) & 0x7f)
+ >= pos)
pc += micromips_relative_offset16 (insn);
else
pc += micromips_pc_insn_size (gdbarch, pc);
@@ -2023,7 +2022,7 @@ micromips_next_pc (struct regcache *regcache, CORE_ADDR pc)
case 0x1c: /* BC1F: bits 010000 11100 xxx00 */
/* BC1ANY2F: bits 010000 11100 xxx01 */
case 0x1d: /* BC1T: bits 010000 11101 xxx00 */
- /* BC1ANY2T: bits 010000 11101 xxx01 */
+ /* BC1ANY2T: bits 010000 11101 xxx01 */
if (((insn >> 16) & 0x2) == 0x0)
pc = micromips_bc1_pc (gdbarch, regcache, insn, pc,
((insn >> 16) & 0x1) + 1);
@@ -2040,27 +2039,27 @@ micromips_next_pc (struct regcache *regcache, CORE_ADDR pc)
case 0x1d: /* JALS: bits 011101 */
case 0x35: /* J: bits 110101 */
case 0x3d: /* JAL: bits 111101 */
- pc = ((pc | 0x7fffffe) ^ 0x7fffffe) | (b0s26_imm (insn) << 1);
+ pc = ((pc | 0x7fffffe) ^ 0x7fffffe) | (b0s26_imm (insn) << 1);
break;
case 0x25: /* BEQ: bits 100101 */
- if (regcache_raw_get_signed (regcache, b0s5_reg (insn >> 16))
- == regcache_raw_get_signed (regcache, b5s5_reg (insn >> 16)))
- pc += micromips_relative_offset16 (insn);
- else
- pc += micromips_pc_insn_size (gdbarch, pc);
+ if (regcache_raw_get_signed (regcache, b0s5_reg (insn >> 16))
+ == regcache_raw_get_signed (regcache, b5s5_reg (insn >> 16)))
+ pc += micromips_relative_offset16 (insn);
+ else
+ pc += micromips_pc_insn_size (gdbarch, pc);
break;
case 0x2d: /* BNE: bits 101101 */
if (regcache_raw_get_signed (regcache, b0s5_reg (insn >> 16))
- != regcache_raw_get_signed (regcache, b5s5_reg (insn >> 16)))
- pc += micromips_relative_offset16 (insn);
+ != regcache_raw_get_signed (regcache, b5s5_reg (insn >> 16)))
+ pc += micromips_relative_offset16 (insn);
else
- pc += micromips_pc_insn_size (gdbarch, pc);
+ pc += micromips_pc_insn_size (gdbarch, pc);
break;
case 0x3c: /* JALX: bits 111100 */
- pc = ((pc | 0xfffffff) ^ 0xfffffff) | (b0s26_imm (insn) << 2);
+ pc = ((pc | 0xfffffff) ^ 0xfffffff) | (b0s26_imm (insn) << 2);
break;
}
break;
@@ -2121,39 +2120,39 @@ micromips_next_pc (struct regcache *regcache, CORE_ADDR pc)
and their extensions extItype,extritype,extI8type. */
enum mips16_inst_fmts
{
- itype, /* 0 immediate 5,10 */
- ritype, /* 1 5,3,8 */
- rrtype, /* 2 5,3,3,5 */
- rritype, /* 3 5,3,3,5 */
- rrrtype, /* 4 5,3,3,3,2 */
- rriatype, /* 5 5,3,3,1,4 */
- shifttype, /* 6 5,3,3,3,2 */
- i8type, /* 7 5,3,8 */
- i8movtype, /* 8 5,3,3,5 */
- i8mov32rtype, /* 9 5,3,5,3 */
- i64type, /* 10 5,3,8 */
- ri64type, /* 11 5,3,3,5 */
- jalxtype, /* 12 5,1,5,5,16 - a 32 bit instruction */
- exiItype, /* 13 5,6,5,5,1,1,1,1,1,1,5 */
- extRitype, /* 14 5,6,5,5,3,1,1,1,5 */
- extRRItype, /* 15 5,5,5,5,3,3,5 */
- extRRIAtype, /* 16 5,7,4,5,3,3,1,4 */
- EXTshifttype, /* 17 5,5,1,1,1,1,1,1,5,3,3,1,1,1,2 */
- extI8type, /* 18 5,6,5,5,3,1,1,1,5 */
- extI64type, /* 19 5,6,5,5,3,1,1,1,5 */
- extRi64type, /* 20 5,6,5,5,3,3,5 */
- extshift64type /* 21 5,5,1,1,1,1,1,1,5,1,1,1,3,5 */
+ itype, /* 0 immediate 5,10 */
+ ritype, /* 1 5,3,8 */
+ rrtype, /* 2 5,3,3,5 */
+ rritype, /* 3 5,3,3,5 */
+ rrrtype, /* 4 5,3,3,3,2 */
+ rriatype, /* 5 5,3,3,1,4 */
+ shifttype, /* 6 5,3,3,3,2 */
+ i8type, /* 7 5,3,8 */
+ i8movtype, /* 8 5,3,3,5 */
+ i8mov32rtype, /* 9 5,3,5,3 */
+ i64type, /* 10 5,3,8 */
+ ri64type, /* 11 5,3,3,5 */
+ jalxtype, /* 12 5,1,5,5,16 - a 32 bit instruction */
+ exiItype, /* 13 5,6,5,5,1,1,1,1,1,1,5 */
+ extRitype, /* 14 5,6,5,5,3,1,1,1,5 */
+ extRRItype, /* 15 5,5,5,5,3,3,5 */
+ extRRIAtype, /* 16 5,7,4,5,3,3,1,4 */
+ EXTshifttype, /* 17 5,5,1,1,1,1,1,1,5,3,3,1,1,1,2 */
+ extI8type, /* 18 5,6,5,5,3,1,1,1,5 */
+ extI64type, /* 19 5,6,5,5,3,1,1,1,5 */
+ extRi64type, /* 20 5,6,5,5,3,3,5 */
+ extshift64type /* 21 5,5,1,1,1,1,1,1,5,1,1,1,3,5 */
};
+
/* I am heaping all the fields of the formats into one structure and
then, only the fields which are involved in instruction extension. */
struct upk_mips16
{
CORE_ADDR offset;
- unsigned int regx; /* Function in i8 type. */
+ unsigned int regx; /* Function in i8 type. */
unsigned int regy;
};
-
/* The EXT-I, EXT-ri nad EXT-I8 instructions all have the same format
for the bits which make up the immediate extension. */
@@ -2162,11 +2161,11 @@ extended_offset (unsigned int extension)
{
CORE_ADDR value;
- value = (extension >> 16) & 0x1f; /* Extract 15:11. */
+ value = (extension >> 16) & 0x1f; /* Extract 15:11. */
value = value << 6;
- value |= (extension >> 21) & 0x3f; /* Extract 10:5. */
+ value |= (extension >> 21) & 0x3f; /* Extract 10:5. */
value = value << 5;
- value |= extension & 0x1f; /* Extract 4:0. */
+ value |= extension & 0x1f; /* Extract 4:0. */
return value;
}
@@ -2184,16 +2183,15 @@ fetch_mips_16 (struct gdbarch *gdbarch, CORE_ADDR pc)
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
gdb_byte buf[8];
- pc = unmake_compact_addr (pc); /* Clear the low order bit. */
+ pc = unmake_compact_addr (pc); /* Clear the low order bit. */
target_read_memory (pc, buf, 2);
return extract_unsigned_integer (buf, 2, byte_order);
}
static void
-unpack_mips16 (struct gdbarch *gdbarch, CORE_ADDR pc,
- unsigned int extension,
- unsigned int inst,
- enum mips16_inst_fmts insn_format, struct upk_mips16 *upk)
+unpack_mips16 (struct gdbarch *gdbarch, CORE_ADDR pc, unsigned int extension,
+ unsigned int inst, enum mips16_inst_fmts insn_format,
+ struct upk_mips16 *upk)
{
CORE_ADDR offset;
int regx;
@@ -2206,12 +2204,12 @@ unpack_mips16 (struct gdbarch *gdbarch, CORE_ADDR pc,
if (extension)
{
value = extended_offset ((extension << 16) | inst);
- value = (value ^ 0x8000) - 0x8000; /* Sign-extend. */
+ value = (value ^ 0x8000) - 0x8000; /* Sign-extend. */
}
else
{
value = inst & 0x7ff;
- value = (value ^ 0x400) - 0x400; /* Sign-extend. */
+ value = (value ^ 0x400) - 0x400; /* Sign-extend. */
}
offset = value;
regx = -1;
@@ -2220,22 +2218,22 @@ unpack_mips16 (struct gdbarch *gdbarch, CORE_ADDR pc,
break;
case ritype:
case i8type:
- { /* A register identifier and an offset. */
+ { /* A register identifier and an offset. */
/* Most of the fields are the same as I type but the
immediate value is of a different length. */
CORE_ADDR value;
if (extension)
{
value = extended_offset ((extension << 16) | inst);
- value = (value ^ 0x8000) - 0x8000; /* Sign-extend. */
+ value = (value ^ 0x8000) - 0x8000; /* Sign-extend. */
}
else
{
- value = inst & 0xff; /* 8 bits */
- value = (value ^ 0x80) - 0x80; /* Sign-extend. */
+ value = inst & 0xff; /* 8 bits */
+ value = (value ^ 0x80) - 0x80; /* Sign-extend. */
}
offset = value;
- regx = (inst >> 8) & 0x07; /* i8 funct */
+ regx = (inst >> 8) & 0x07; /* i8 funct */
regy = -1;
break;
}
@@ -2246,7 +2244,7 @@ unpack_mips16 (struct gdbarch *gdbarch, CORE_ADDR pc,
value = ((inst & 0x1f) << 5) | ((inst >> 5) & 0x1f);
value = value << 16;
nexthalf = mips_fetch_instruction (gdbarch, ISA_MIPS16, pc + 2, NULL);
- /* Low bit still set. */
+ /* Low bit still set. */
value |= nexthalf;
offset = value;
regx = -1;
@@ -2254,14 +2252,13 @@ unpack_mips16 (struct gdbarch *gdbarch, CORE_ADDR pc,
break;
}
default:
- internal_error (_("bad switch"));
+ internal_error (_ ("bad switch"));
}
upk->offset = offset;
upk->regx = regx;
upk->regy = regy;
}
-
/* Calculate the destination of a branch whose 16-bit opcode word is at PC,
and having a signed 16-bit OFFSET. */
@@ -2279,26 +2276,26 @@ extended_mips16_next_pc (regcache *regcache, CORE_ADDR pc,
int op = (insn >> 11);
switch (op)
{
- case 2: /* Branch */
+ case 2: /* Branch */
{
struct upk_mips16 upk;
unpack_mips16 (gdbarch, pc, extension, insn, itype, &upk);
pc = add_offset_16 (pc, upk.offset);
break;
}
- case 3: /* JAL , JALX - Watch out, these are 32 bit
+ case 3: /* JAL , JALX - Watch out, these are 32 bit
instructions. */
{
struct upk_mips16 upk;
unpack_mips16 (gdbarch, pc, extension, insn, jalxtype, &upk);
pc = ((pc + 2) & (~(CORE_ADDR) 0x0fffffff)) | (upk.offset << 2);
- if ((insn >> 10) & 0x01) /* Exchange mode */
- pc = pc & ~0x01; /* Clear low bit, indicate 32 bit mode. */
+ if ((insn >> 10) & 0x01) /* Exchange mode */
+ pc = pc & ~0x01; /* Clear low bit, indicate 32 bit mode. */
else
pc |= 0x01;
break;
}
- case 4: /* beqz */
+ case 4: /* beqz */
{
struct upk_mips16 upk;
int reg;
@@ -2310,7 +2307,7 @@ extended_mips16_next_pc (regcache *regcache, CORE_ADDR pc,
pc += 2;
break;
}
- case 5: /* bnez */
+ case 5: /* bnez */
{
struct upk_mips16 upk;
int reg;
@@ -2322,7 +2319,7 @@ extended_mips16_next_pc (regcache *regcache, CORE_ADDR pc,
pc += 2;
break;
}
- case 12: /* I8 Formats btez btnez */
+ case 12: /* I8 Formats btez btnez */
{
struct upk_mips16 upk;
int reg;
@@ -2331,13 +2328,13 @@ extended_mips16_next_pc (regcache *regcache, CORE_ADDR pc,
/* Test register is 24 */
reg = regcache_raw_get_signed (regcache, 24);
if (((upk.regx == 0) && (reg == 0)) /* BTEZ */
- || ((upk.regx == 1) && (reg != 0))) /* BTNEZ */
+ || ((upk.regx == 1) && (reg != 0))) /* BTNEZ */
pc = add_offset_16 (pc, upk.offset);
else
pc += 2;
break;
}
- case 29: /* RR Formats JR, JALR, JALR-RA */
+ case 29: /* RR Formats JR, JALR, JALR-RA */
{
struct upk_mips16 upk;
/* upk.fmt = rrtype; */
@@ -2350,7 +2347,7 @@ extended_mips16_next_pc (regcache *regcache, CORE_ADDR pc,
if ((upk.regy & 1) == 0)
reg = mips_reg3_to_reg[upk.regx];
else
- reg = 31; /* Function return instruction. */
+ reg = 31; /* Function return instruction. */
pc = regcache_raw_get_signed (regcache, reg);
}
else
@@ -2411,12 +2408,12 @@ mips16_instruction_is_compact_branch (unsigned short insn)
switch (insn & 0xf800)
{
case 0xe800:
- return (insn & 0x009f) == 0x80; /* JALRC/JRC */
+ return (insn & 0x009f) == 0x80; /* JALRC/JRC */
case 0x6000:
- return (insn & 0x0600) == 0; /* BTNEZ/BTEQZ */
- case 0x2800: /* BNEZ */
- case 0x2000: /* BEQZ */
- case 0x1000: /* B */
+ return (insn & 0x0600) == 0; /* BTNEZ/BTEQZ */
+ case 0x2800: /* BNEZ */
+ case 0x2000: /* BEQZ */
+ case 0x1000: /* B */
return 1;
default:
return 0;
@@ -2431,14 +2428,14 @@ micromips_instruction_is_compact_branch (unsigned short insn)
{
switch (micromips_op (insn))
{
- case 0x11: /* POOL16C: bits 010001 */
+ case 0x11: /* POOL16C: bits 010001 */
return (b5s5_op (insn) == 0x18
- /* JRADDIUSP: bits 010001 11000 */
+ /* JRADDIUSP: bits 010001 11000 */
|| b5s5_op (insn) == 0xd);
- /* JRC: bits 010011 01101 */
- case 0x10: /* POOL32I: bits 010000 */
+ /* JRC: bits 010011 01101 */
+ case 0x10: /* POOL32I: bits 010000 */
return (b5s5_op (insn) & 0x1d) == 0x5;
- /* BEQZC/BNEZC: bits 010000 001x1 */
+ /* BEQZC/BNEZC: bits 010000 001x1 */
default:
return 0;
}
@@ -2465,36 +2462,34 @@ static void
set_reg_offset (struct gdbarch *gdbarch, struct mips_frame_cache *this_cache,
int regnum, CORE_ADDR offset)
{
- if (this_cache != NULL
- && this_cache->saved_regs[regnum].is_realreg ()
+ if (this_cache != NULL && this_cache->saved_regs[regnum].is_realreg ()
&& this_cache->saved_regs[regnum].realreg () == regnum)
{
- this_cache->saved_regs[regnum + 0
- * gdbarch_num_regs (gdbarch)].set_addr (offset);
- this_cache->saved_regs[regnum + 1
- * gdbarch_num_regs (gdbarch)].set_addr (offset);
+ this_cache->saved_regs[regnum + 0 * gdbarch_num_regs (gdbarch)]
+ .set_addr (offset);
+ this_cache->saved_regs[regnum + 1 * gdbarch_num_regs (gdbarch)]
+ .set_addr (offset);
}
}
-
/* Fetch the immediate value from a MIPS16 instruction.
If the previous instruction was an EXTEND, use it to extend
the upper bits of the immediate value. This is a helper function
for mips16_scan_prologue. */
static int
-mips16_get_imm (unsigned short prev_inst, /* previous instruction */
- unsigned short inst, /* current instruction */
- int nbits, /* number of bits in imm field */
- int scale, /* scale factor to be applied to imm */
- int is_signed) /* is the imm field signed? */
+mips16_get_imm (unsigned short prev_inst, /* previous instruction */
+ unsigned short inst, /* current instruction */
+ int nbits, /* number of bits in imm field */
+ int scale, /* scale factor to be applied to imm */
+ int is_signed) /* is the imm field signed? */
{
int offset;
- if ((prev_inst & 0xf800) == 0xf000) /* prev instruction was EXTEND? */
+ if ((prev_inst & 0xf800) == 0xf000) /* prev instruction was EXTEND? */
{
offset = ((prev_inst & 0x1f) << 11) | (prev_inst & 0x7e0);
- if (offset & 0x8000) /* check for negative extend */
+ if (offset & 0x8000) /* check for negative extend */
offset = 0 - (0x10000 - (offset & 0xffff));
return offset | (inst & 0x1f);
}
@@ -2511,15 +2506,13 @@ mips16_get_imm (unsigned short prev_inst, /* previous instruction */
}
}
-
/* Analyze the function prologue from START_PC to LIMIT_PC. Builds
the associated FRAME_CACHE if not null.
Return the address of the first instruction past the prologue. */
static CORE_ADDR
-mips16_scan_prologue (struct gdbarch *gdbarch,
- CORE_ADDR start_pc, CORE_ADDR limit_pc,
- frame_info_ptr this_frame,
+mips16_scan_prologue (struct gdbarch *gdbarch, CORE_ADDR start_pc,
+ CORE_ADDR limit_pc, frame_info_ptr this_frame,
struct mips_frame_cache *this_cache)
{
int prev_non_prologue_insn = 0;
@@ -2527,12 +2520,12 @@ mips16_scan_prologue (struct gdbarch *gdbarch,
int non_prologue_insns = 0;
CORE_ADDR prev_pc;
CORE_ADDR cur_pc;
- CORE_ADDR frame_addr = 0; /* Value of $r17, used as frame pointer. */
+ CORE_ADDR frame_addr = 0; /* Value of $r17, used as frame pointer. */
CORE_ADDR sp;
- long frame_offset = 0; /* Size of stack frame. */
- long frame_adjust = 0; /* Offset of FP from SP. */
+ long frame_offset = 0; /* Size of stack frame. */
+ long frame_adjust = 0; /* Offset of FP from SP. */
int frame_reg = MIPS_SP_REGNUM;
- unsigned short prev_inst = 0; /* saved copy of previous instruction. */
+ unsigned short prev_inst = 0; /* saved copy of previous instruction. */
unsigned inst = 0; /* current instruction */
unsigned entry_inst = 0; /* the entry instruction */
unsigned save_inst = 0; /* the save instruction */
@@ -2547,9 +2540,8 @@ mips16_scan_prologue (struct gdbarch *gdbarch,
/* Can be called when there's no process, and hence when there's no
THIS_FRAME. */
if (this_frame != NULL)
- sp = get_frame_register_signed (this_frame,
- gdbarch_num_regs (gdbarch)
- + MIPS_SP_REGNUM);
+ sp = get_frame_register_signed (this_frame, gdbarch_num_regs (gdbarch)
+ + MIPS_SP_REGNUM);
else
sp = 0;
@@ -2578,7 +2570,7 @@ mips16_scan_prologue (struct gdbarch *gdbarch,
instruction is not part of the prologue either. We must
remember in this case to adjust the end_prologue_addr back
over the extend. */
- if ((inst & 0xf800) == 0xf000) /* extend */
+ if ((inst & 0xf800) == 0xf000) /* extend */
{
extend_bytes = MIPS_INSN16_SIZE;
continue;
@@ -2588,10 +2580,10 @@ mips16_scan_prologue (struct gdbarch *gdbarch,
extend_bytes = 0;
if ((inst & 0xff00) == 0x6300 /* addiu sp */
- || (inst & 0xff00) == 0xfb00) /* daddiu sp */
+ || (inst & 0xff00) == 0xfb00) /* daddiu sp */
{
offset = mips16_get_imm (prev_inst, inst, 8, 8, 1);
- if (offset < 0) /* Negative stack adjustment? */
+ if (offset < 0) /* Negative stack adjustment? */
frame_offset -= offset;
else
/* Exit loop if a positive stack adjustment is found, which
@@ -2599,77 +2591,77 @@ mips16_scan_prologue (struct gdbarch *gdbarch,
epilogue is reached. */
break;
}
- else if ((inst & 0xf800) == 0xd000) /* sw reg,n($sp) */
+ else if ((inst & 0xf800) == 0xd000) /* sw reg,n($sp) */
{
offset = mips16_get_imm (prev_inst, inst, 8, 4, 0);
reg = mips_reg3_to_reg[(inst & 0x700) >> 8];
set_reg_offset (gdbarch, this_cache, reg, sp + offset);
}
- else if ((inst & 0xff00) == 0xf900) /* sd reg,n($sp) */
+ else if ((inst & 0xff00) == 0xf900) /* sd reg,n($sp) */
{
offset = mips16_get_imm (prev_inst, inst, 5, 8, 0);
reg = mips_reg3_to_reg[(inst & 0xe0) >> 5];
set_reg_offset (gdbarch, this_cache, reg, sp + offset);
}
- else if ((inst & 0xff00) == 0x6200) /* sw $ra,n($sp) */
+ else if ((inst & 0xff00) == 0x6200) /* sw $ra,n($sp) */
{
offset = mips16_get_imm (prev_inst, inst, 8, 4, 0);
set_reg_offset (gdbarch, this_cache, MIPS_RA_REGNUM, sp + offset);
}
- else if ((inst & 0xff00) == 0xfa00) /* sd $ra,n($sp) */
+ else if ((inst & 0xff00) == 0xfa00) /* sd $ra,n($sp) */
{
offset = mips16_get_imm (prev_inst, inst, 8, 8, 0);
set_reg_offset (gdbarch, this_cache, MIPS_RA_REGNUM, sp + offset);
}
- else if (inst == 0x673d) /* move $s1, $sp */
+ else if (inst == 0x673d) /* move $s1, $sp */
{
frame_addr = sp;
frame_reg = 17;
}
- else if ((inst & 0xff00) == 0x0100) /* addiu $s1,sp,n */
+ else if ((inst & 0xff00) == 0x0100) /* addiu $s1,sp,n */
{
offset = mips16_get_imm (prev_inst, inst, 8, 4, 0);
frame_addr = sp + offset;
frame_reg = 17;
frame_adjust = offset;
}
- else if ((inst & 0xFF00) == 0xd900) /* sw reg,offset($s1) */
+ else if ((inst & 0xFF00) == 0xd900) /* sw reg,offset($s1) */
{
offset = mips16_get_imm (prev_inst, inst, 5, 4, 0);
reg = mips_reg3_to_reg[(inst & 0xe0) >> 5];
set_reg_offset (gdbarch, this_cache, reg, frame_addr + offset);
}
- else if ((inst & 0xFF00) == 0x7900) /* sd reg,offset($s1) */
+ else if ((inst & 0xFF00) == 0x7900) /* sd reg,offset($s1) */
{
offset = mips16_get_imm (prev_inst, inst, 5, 8, 0);
reg = mips_reg3_to_reg[(inst & 0xe0) >> 5];
set_reg_offset (gdbarch, this_cache, reg, frame_addr + offset);
}
else if ((inst & 0xf81f) == 0xe809
- && (inst & 0x700) != 0x700) /* entry */
- entry_inst = inst; /* Save for later processing. */
- else if ((inst & 0xff80) == 0x6480) /* save */
+ && (inst & 0x700) != 0x700) /* entry */
+ entry_inst = inst; /* Save for later processing. */
+ else if ((inst & 0xff80) == 0x6480) /* save */
{
- save_inst = inst; /* Save for later processing. */
- if (prev_extend_bytes) /* extend */
+ save_inst = inst; /* Save for later processing. */
+ if (prev_extend_bytes) /* extend */
save_inst |= prev_inst << 16;
}
- else if ((inst & 0xff1c) == 0x6704) /* move reg,$a0-$a3 */
+ else if ((inst & 0xff1c) == 0x6704) /* move reg,$a0-$a3 */
{
/* This instruction is part of the prologue, but we don't
need to do anything special to handle it. */
}
else if (mips16_instruction_has_delay_slot (inst, 0))
- /* JAL/JALR/JALX/JR */
+ /* JAL/JALR/JALX/JR */
{
/* The instruction in the delay slot can be a part
of the prologue, so move forward once more. */
in_delay_slot = 1;
if (mips16_instruction_has_delay_slot (inst, 1))
- /* JAL/JALX */
+ /* JAL/JALX */
{
prev_extend_bytes = MIPS_INSN16_SIZE;
- cur_pc += MIPS_INSN16_SIZE; /* 32-bit instruction */
+ cur_pc += MIPS_INSN16_SIZE; /* 32-bit instruction */
}
}
else
@@ -2740,12 +2732,10 @@ mips16_scan_prologue (struct gdbarch *gdbarch,
if (save_inst != 0 && mips_abi_regsize (gdbarch) == 4)
{
static int args_table[16] = {
- 0, 0, 0, 0, 1, 1, 1, 1,
- 2, 2, 2, 0, 3, 3, 4, -1,
+ 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 0, 3, 3, 4, -1,
};
static int astatic_table[16] = {
- 0, 1, 2, 3, 0, 1, 2, 3,
- 0, 1, 2, 4, 0, 1, 0, -1,
+ 0, 1, 2, 3, 0, 1, 2, 3, 0, 1, 2, 4, 0, 1, 0, -1,
};
int aregs = (save_inst >> 16) & 0xf;
int xsregs = (save_inst >> 24) & 0x7;
@@ -2755,12 +2745,13 @@ mips16_scan_prologue (struct gdbarch *gdbarch,
if (args < 0)
{
- warning (_("Invalid number of argument registers encoded in SAVE."));
+ warning (
+ _ ("Invalid number of argument registers encoded in SAVE."));
args = 0;
}
if (astatic < 0)
{
- warning (_("Invalid number of static registers encoded in SAVE."));
+ warning (_ ("Invalid number of static registers encoded in SAVE."));
astatic = 0;
}
@@ -2828,15 +2819,15 @@ mips16_scan_prologue (struct gdbarch *gdbarch,
if (this_cache != NULL)
{
- this_cache->base =
- (get_frame_register_signed (this_frame,
- gdbarch_num_regs (gdbarch) + frame_reg)
- + frame_offset - frame_adjust);
+ this_cache->base
+ = (get_frame_register_signed (this_frame,
+ gdbarch_num_regs (gdbarch) + frame_reg)
+ + frame_offset - frame_adjust);
/* FIXME: brobecker/2004-10-10: Just as in the mips32 case, we should
be able to get rid of the assignment below, evetually. But it's
still needed for now. */
- this_cache->saved_regs[gdbarch_num_regs (gdbarch)
- + mips_regnum (gdbarch)->pc]
+ this_cache
+ ->saved_regs[gdbarch_num_regs (gdbarch) + mips_regnum (gdbarch)->pc]
= this_cache->saved_regs[gdbarch_num_regs (gdbarch) + MIPS_RA_REGNUM];
}
@@ -2844,8 +2835,9 @@ mips16_scan_prologue (struct gdbarch *gdbarch,
after the last one we scanned. Unless the last one looked like a
non-prologue instruction (and we looked ahead), in which case use
its address instead. */
- end_prologue_addr = (prev_non_prologue_insn || prev_delay_slot
- ? prev_pc : cur_pc - prev_extend_bytes);
+ end_prologue_addr
+ = (prev_non_prologue_insn || prev_delay_slot ? prev_pc
+ : cur_pc - prev_extend_bytes);
return end_prologue_addr;
}
@@ -2882,10 +2874,10 @@ mips_insn16_frame_cache (frame_info_ptr this_frame, void **this_cache)
mips16_scan_prologue (gdbarch, start_addr, pc, this_frame,
(struct mips_frame_cache *) *this_cache);
}
-
+
/* gdbarch_sp_regnum contains the value and not the address. */
- cache->saved_regs[gdbarch_num_regs (gdbarch)
- + MIPS_SP_REGNUM].set_value (cache->base);
+ cache->saved_regs[gdbarch_num_regs (gdbarch) + MIPS_SP_REGNUM].set_value (
+ cache->base);
return (struct mips_frame_cache *) (*this_cache);
}
@@ -2894,8 +2886,8 @@ static void
mips_insn16_frame_this_id (frame_info_ptr this_frame, void **this_cache,
struct frame_id *this_id)
{
- struct mips_frame_cache *info = mips_insn16_frame_cache (this_frame,
- this_cache);
+ struct mips_frame_cache *info
+ = mips_insn16_frame_cache (this_frame, this_cache);
/* This marks the outermost frame. */
if (info->base == 0)
return;
@@ -2903,11 +2895,11 @@ mips_insn16_frame_this_id (frame_info_ptr this_frame, void **this_cache,
}
static struct value *
-mips_insn16_frame_prev_register (frame_info_ptr this_frame,
- void **this_cache, int regnum)
+mips_insn16_frame_prev_register (frame_info_ptr this_frame, void **this_cache,
+ int regnum)
{
- struct mips_frame_cache *info = mips_insn16_frame_cache (this_frame,
- this_cache);
+ struct mips_frame_cache *info
+ = mips_insn16_frame_cache (this_frame, this_cache);
return trad_frame_get_prev_register (this_frame, info->saved_regs, regnum);
}
@@ -2922,33 +2914,23 @@ mips_insn16_frame_sniffer (const struct frame_unwind *self,
return 0;
}
-static const struct frame_unwind mips_insn16_frame_unwind =
-{
- "mips insn16 prologue",
- NORMAL_FRAME,
- default_frame_unwind_stop_reason,
- mips_insn16_frame_this_id,
- mips_insn16_frame_prev_register,
- NULL,
- mips_insn16_frame_sniffer
-};
+static const struct frame_unwind mips_insn16_frame_unwind
+ = { "mips insn16 prologue", NORMAL_FRAME,
+ default_frame_unwind_stop_reason, mips_insn16_frame_this_id,
+ mips_insn16_frame_prev_register, NULL,
+ mips_insn16_frame_sniffer };
static CORE_ADDR
-mips_insn16_frame_base_address (frame_info_ptr this_frame,
- void **this_cache)
+mips_insn16_frame_base_address (frame_info_ptr this_frame, void **this_cache)
{
- struct mips_frame_cache *info = mips_insn16_frame_cache (this_frame,
- this_cache);
+ struct mips_frame_cache *info
+ = mips_insn16_frame_cache (this_frame, this_cache);
return info->base;
}
-static const struct frame_base mips_insn16_frame_base =
-{
- &mips_insn16_frame_unwind,
- mips_insn16_frame_base_address,
- mips_insn16_frame_base_address,
- mips_insn16_frame_base_address
-};
+static const struct frame_base mips_insn16_frame_base
+ = { &mips_insn16_frame_unwind, mips_insn16_frame_base_address,
+ mips_insn16_frame_base_address, mips_insn16_frame_base_address };
static const struct frame_base *
mips_insn16_frame_base_sniffer (frame_info_ptr this_frame)
@@ -2978,9 +2960,8 @@ micromips_decode_imm9 (int imm)
the address of the first instruction past the prologue. */
static CORE_ADDR
-micromips_scan_prologue (struct gdbarch *gdbarch,
- CORE_ADDR start_pc, CORE_ADDR limit_pc,
- frame_info_ptr this_frame,
+micromips_scan_prologue (struct gdbarch *gdbarch, CORE_ADDR start_pc,
+ CORE_ADDR limit_pc, frame_info_ptr this_frame,
struct mips_frame_cache *this_cache)
{
CORE_ADDR end_prologue_addr;
@@ -2988,17 +2969,17 @@ micromips_scan_prologue (struct gdbarch *gdbarch,
int frame_reg = MIPS_SP_REGNUM;
int this_non_prologue_insn;
int non_prologue_insns = 0;
- long frame_offset = 0; /* Size of stack frame. */
- long frame_adjust = 0; /* Offset of FP from SP. */
+ long frame_offset = 0; /* Size of stack frame. */
+ long frame_adjust = 0; /* Offset of FP from SP. */
int prev_delay_slot = 0;
int in_delay_slot;
CORE_ADDR prev_pc;
CORE_ADDR cur_pc;
- ULONGEST insn; /* current instruction */
+ ULONGEST insn; /* current instruction */
CORE_ADDR sp;
long offset;
long sp_adj;
- long v1_off = 0; /* The assumption is LUI will replace it. */
+ long v1_off = 0; /* The assumption is LUI will replace it. */
int reglist;
int breg;
int dreg;
@@ -3012,9 +2993,8 @@ micromips_scan_prologue (struct gdbarch *gdbarch,
/* Can be called when there's no process, and hence when there's no
THIS_FRAME. */
if (this_frame != NULL)
- sp = get_frame_register_signed (this_frame,
- gdbarch_num_regs (gdbarch)
- + MIPS_SP_REGNUM);
+ sp = get_frame_register_signed (this_frame, gdbarch_num_regs (gdbarch)
+ + MIPS_SP_REGNUM);
else
sp = 0;
@@ -3038,29 +3018,29 @@ micromips_scan_prologue (struct gdbarch *gdbarch,
/* 32-bit instructions. */
case 2 * MIPS_INSN16_SIZE:
insn <<= 16;
- insn |= mips_fetch_instruction (gdbarch,
- ISA_MICROMIPS, cur_pc + loc, NULL);
+ insn |= mips_fetch_instruction (gdbarch, ISA_MICROMIPS, cur_pc + loc,
+ NULL);
loc += MIPS_INSN16_SIZE;
switch (micromips_op (insn >> 16))
{
/* Record $sp/$fp adjustment. */
/* Discard (D)ADDU $gp,$jp used for PIC code. */
- case 0x0: /* POOL32A: bits 000000 */
+ case 0x0: /* POOL32A: bits 000000 */
case 0x16: /* POOL32S: bits 010110 */
op = b0s11_op (insn);
sreg = b0s5_reg (insn >> 16);
treg = b5s5_reg (insn >> 16);
dreg = b11s5_reg (insn);
if (op == 0x1d0
- /* SUBU: bits 000000 00111010000 */
- /* DSUBU: bits 010110 00111010000 */
+ /* SUBU: bits 000000 00111010000 */
+ /* DSUBU: bits 010110 00111010000 */
&& dreg == MIPS_SP_REGNUM && sreg == MIPS_SP_REGNUM
&& treg == 3)
- /* (D)SUBU $sp, $v1 */
- sp_adj = v1_off;
+ /* (D)SUBU $sp, $v1 */
+ sp_adj = v1_off;
else if (op != 0x150
- /* ADDU: bits 000000 00101010000 */
- /* DADDU: bits 010110 00101010000 */
+ /* ADDU: bits 000000 00101010000 */
+ /* DADDU: bits 010110 00101010000 */
|| dreg != 28 || sreg != 28 || treg != MIPS_T9_REGNUM)
this_non_prologue_insn = 1;
break;
@@ -3071,26 +3051,25 @@ micromips_scan_prologue (struct gdbarch *gdbarch,
reglist = sreg = b5s5_reg (insn >> 16);
offset = (b0s12_imm (insn) ^ 0x800) - 0x800;
if ((op == 0x9 || op == 0xc)
- /* SWP: bits 001000 1001 */
- /* SDP: bits 001000 1100 */
+ /* SWP: bits 001000 1001 */
+ /* SDP: bits 001000 1100 */
&& breg == MIPS_SP_REGNUM && sreg < MIPS_RA_REGNUM)
- /* S[DW]P reg,offset($sp) */
+ /* S[DW]P reg,offset($sp) */
{
s = 4 << ((b12s4_op (insn) & 0x4) == 0x4);
- set_reg_offset (gdbarch, this_cache,
- sreg, sp + offset);
- set_reg_offset (gdbarch, this_cache,
- sreg + 1, sp + offset + s);
+ set_reg_offset (gdbarch, this_cache, sreg, sp + offset);
+ set_reg_offset (gdbarch, this_cache, sreg + 1,
+ sp + offset + s);
}
else if ((op == 0xd || op == 0xf)
- /* SWM: bits 001000 1101 */
- /* SDM: bits 001000 1111 */
+ /* SWM: bits 001000 1101 */
+ /* SDM: bits 001000 1111 */
&& breg == MIPS_SP_REGNUM
- /* SWM reglist,offset($sp) */
+ /* SWM reglist,offset($sp) */
&& ((reglist >= 1 && reglist <= 9)
|| (reglist >= 16 && reglist <= 25)))
{
- int sreglist = std::min(reglist & 0xf, 8);
+ int sreglist = std::min (reglist & 0xf, 8);
s = 4 << ((b12s4_op (insn) & 0x2) == 0x2);
for (i = 0; i < sreglist; i++)
@@ -3098,8 +3077,8 @@ micromips_scan_prologue (struct gdbarch *gdbarch,
if ((reglist & 0xf) > 8)
set_reg_offset (gdbarch, this_cache, 30, sp + s * i++);
if ((reglist & 0x10) == 0x10)
- set_reg_offset (gdbarch, this_cache,
- MIPS_RA_REGNUM, sp + s * i++);
+ set_reg_offset (gdbarch, this_cache, MIPS_RA_REGNUM,
+ sp + s * i++);
}
else
this_non_prologue_insn = 1;
@@ -3107,22 +3086,22 @@ micromips_scan_prologue (struct gdbarch *gdbarch,
/* Record $sp/$fp adjustment. */
/* Discard (D)ADDIU $gp used for PIC code. */
- case 0xc: /* ADDIU: bits 001100 */
+ case 0xc: /* ADDIU: bits 001100 */
case 0x17: /* DADDIU: bits 010111 */
sreg = b0s5_reg (insn >> 16);
dreg = b5s5_reg (insn >> 16);
offset = (b0s16_imm (insn) ^ 0x8000) - 0x8000;
if (sreg == MIPS_SP_REGNUM && dreg == MIPS_SP_REGNUM)
- /* (D)ADDIU $sp, imm */
+ /* (D)ADDIU $sp, imm */
sp_adj = offset;
else if (sreg == MIPS_SP_REGNUM && dreg == 30)
- /* (D)ADDIU $fp, $sp, imm */
+ /* (D)ADDIU $fp, $sp, imm */
{
frame_adjust = offset;
frame_reg = 30;
}
else if (sreg != 28 || dreg != 28)
- /* (D)ADDIU $gp, imm */
+ /* (D)ADDIU $gp, imm */
this_non_prologue_insn = 1;
break;
@@ -3130,14 +3109,14 @@ micromips_scan_prologue (struct gdbarch *gdbarch,
/* Discard LUI $gp used for PIC code. */
case 0x10: /* POOL32I: bits 010000 */
if (b5s5_op (insn >> 16) == 0xd
- /* LUI: bits 010000 001101 */
+ /* LUI: bits 010000 001101 */
&& b0s5_reg (insn >> 16) == 3)
- /* LUI $v1, imm */
+ /* LUI $v1, imm */
v1_off = ((b0s16_imm (insn) << 16) ^ 0x80000000) - 0x80000000;
else if (b5s5_op (insn >> 16) != 0xd
- /* LUI: bits 010000 001101 */
+ /* LUI: bits 010000 001101 */
|| b0s5_reg (insn >> 16) != 28)
- /* LUI $gp, imm */
+ /* LUI $gp, imm */
this_non_prologue_insn = 1;
break;
@@ -3146,7 +3125,7 @@ micromips_scan_prologue (struct gdbarch *gdbarch,
sreg = b0s5_reg (insn >> 16);
dreg = b5s5_reg (insn >> 16);
if (sreg == 3 && dreg == 3)
- /* ORI $v1, imm */
+ /* ORI $v1, imm */
v1_off |= b0s16_imm (insn);
else
this_non_prologue_insn = 1;
@@ -3156,7 +3135,7 @@ micromips_scan_prologue (struct gdbarch *gdbarch,
case 0x2e: /* SDC1: bits 101110 */
breg = b0s5_reg (insn >> 16);
if (breg != MIPS_SP_REGNUM)
- /* S[DW]C1 reg,offset($sp) */
+ /* S[DW]C1 reg,offset($sp) */
this_non_prologue_insn = 1;
break;
@@ -3166,7 +3145,7 @@ micromips_scan_prologue (struct gdbarch *gdbarch,
sreg = b5s5_reg (insn >> 16);
offset = (b0s16_imm (insn) ^ 0x8000) - 0x8000;
if (breg == MIPS_SP_REGNUM)
- /* S[DW] reg,offset($sp) */
+ /* S[DW] reg,offset($sp) */
set_reg_offset (gdbarch, this_cache, sreg, sp + offset);
else
this_non_prologue_insn = 1;
@@ -3192,23 +3171,23 @@ micromips_scan_prologue (struct gdbarch *gdbarch,
sreg = b0s5_reg (insn);
dreg = b5s5_reg (insn);
if (sreg == MIPS_SP_REGNUM && dreg == 30)
- /* MOVE $fp, $sp */
+ /* MOVE $fp, $sp */
frame_reg = 30;
else if ((sreg & 0x1c) != 0x4)
- /* MOVE reg, $a0-$a3 */
+ /* MOVE reg, $a0-$a3 */
this_non_prologue_insn = 1;
break;
case 0x11: /* POOL16C: bits 010001 */
if (b6s4_op (insn) == 0x5)
- /* SWM: bits 010001 0101 */
+ /* SWM: bits 010001 0101 */
{
offset = ((b0s4_imm (insn) << 2) ^ 0x20) - 0x20;
reglist = b4s2_regl (insn);
for (i = 0; i <= reglist; i++)
set_reg_offset (gdbarch, this_cache, 16 + i, sp + 4 * i);
- set_reg_offset (gdbarch, this_cache,
- MIPS_RA_REGNUM, sp + 4 * i++);
+ set_reg_offset (gdbarch, this_cache, MIPS_RA_REGNUM,
+ sp + 4 * i++);
}
else
this_non_prologue_insn = 1;
@@ -3216,11 +3195,11 @@ micromips_scan_prologue (struct gdbarch *gdbarch,
case 0x13: /* POOL16D: bits 010011 */
if ((insn & 0x1) == 0x1)
- /* ADDIUSP: bits 010011 1 */
+ /* ADDIUSP: bits 010011 1 */
sp_adj = micromips_decode_imm9 (b1s9_imm (insn));
else if (b5s5_reg (insn) == MIPS_SP_REGNUM)
- /* ADDIUS5: bits 010011 0 */
- /* ADDIUS5 $sp, imm */
+ /* ADDIUS5: bits 010011 0 */
+ /* ADDIUS5 $sp, imm */
sp_adj = (b1s4_imm (insn) ^ 8) - 8;
else
this_non_prologue_insn = 1;
@@ -3262,15 +3241,15 @@ micromips_scan_prologue (struct gdbarch *gdbarch,
if (this_cache != NULL)
{
- this_cache->base =
- (get_frame_register_signed (this_frame,
- gdbarch_num_regs (gdbarch) + frame_reg)
- + frame_offset - frame_adjust);
+ this_cache->base
+ = (get_frame_register_signed (this_frame,
+ gdbarch_num_regs (gdbarch) + frame_reg)
+ + frame_offset - frame_adjust);
/* FIXME: brobecker/2004-10-10: Just as in the mips32 case, we should
be able to get rid of the assignment below, evetually. But it's
still needed for now. */
- this_cache->saved_regs[gdbarch_num_regs (gdbarch)
- + mips_regnum (gdbarch)->pc]
+ this_cache
+ ->saved_regs[gdbarch_num_regs (gdbarch) + mips_regnum (gdbarch)->pc]
= this_cache->saved_regs[gdbarch_num_regs (gdbarch) + MIPS_RA_REGNUM];
}
@@ -3319,8 +3298,8 @@ mips_micro_frame_cache (frame_info_ptr this_frame, void **this_cache)
}
/* gdbarch_sp_regnum contains the value and not the address. */
- cache->saved_regs[gdbarch_num_regs (gdbarch)
- + MIPS_SP_REGNUM].set_value (cache->base);
+ cache->saved_regs[gdbarch_num_regs (gdbarch) + MIPS_SP_REGNUM].set_value (
+ cache->base);
return (struct mips_frame_cache *) (*this_cache);
}
@@ -3329,8 +3308,8 @@ static void
mips_micro_frame_this_id (frame_info_ptr this_frame, void **this_cache,
struct frame_id *this_id)
{
- struct mips_frame_cache *info = mips_micro_frame_cache (this_frame,
- this_cache);
+ struct mips_frame_cache *info
+ = mips_micro_frame_cache (this_frame, this_cache);
/* This marks the outermost frame. */
if (info->base == 0)
return;
@@ -3338,11 +3317,11 @@ mips_micro_frame_this_id (frame_info_ptr this_frame, void **this_cache,
}
static struct value *
-mips_micro_frame_prev_register (frame_info_ptr this_frame,
- void **this_cache, int regnum)
+mips_micro_frame_prev_register (frame_info_ptr this_frame, void **this_cache,
+ int regnum)
{
- struct mips_frame_cache *info = mips_micro_frame_cache (this_frame,
- this_cache);
+ struct mips_frame_cache *info
+ = mips_micro_frame_cache (this_frame, this_cache);
return trad_frame_get_prev_register (this_frame, info->saved_regs, regnum);
}
@@ -3358,33 +3337,26 @@ mips_micro_frame_sniffer (const struct frame_unwind *self,
return 0;
}
-static const struct frame_unwind mips_micro_frame_unwind =
-{
- "mips micro prologue",
- NORMAL_FRAME,
- default_frame_unwind_stop_reason,
- mips_micro_frame_this_id,
- mips_micro_frame_prev_register,
- NULL,
- mips_micro_frame_sniffer
-};
+static const struct frame_unwind mips_micro_frame_unwind
+ = { "mips micro prologue",
+ NORMAL_FRAME,
+ default_frame_unwind_stop_reason,
+ mips_micro_frame_this_id,
+ mips_micro_frame_prev_register,
+ NULL,
+ mips_micro_frame_sniffer };
static CORE_ADDR
-mips_micro_frame_base_address (frame_info_ptr this_frame,
- void **this_cache)
+mips_micro_frame_base_address (frame_info_ptr this_frame, void **this_cache)
{
- struct mips_frame_cache *info = mips_micro_frame_cache (this_frame,
- this_cache);
+ struct mips_frame_cache *info
+ = mips_micro_frame_cache (this_frame, this_cache);
return info->base;
}
-static const struct frame_base mips_micro_frame_base =
-{
- &mips_micro_frame_unwind,
- mips_micro_frame_base_address,
- mips_micro_frame_base_address,
- mips_micro_frame_base_address
-};
+static const struct frame_base mips_micro_frame_base
+ = { &mips_micro_frame_unwind, mips_micro_frame_base_address,
+ mips_micro_frame_base_address, mips_micro_frame_base_address };
static const struct frame_base *
mips_micro_frame_base_sniffer (frame_info_ptr this_frame)
@@ -3423,9 +3395,8 @@ reset_saved_regs (struct gdbarch *gdbarch, struct mips_frame_cache *this_cache)
Return the address of the first instruction past the prologue. */
static CORE_ADDR
-mips32_scan_prologue (struct gdbarch *gdbarch,
- CORE_ADDR start_pc, CORE_ADDR limit_pc,
- frame_info_ptr this_frame,
+mips32_scan_prologue (struct gdbarch *gdbarch, CORE_ADDR start_pc,
+ CORE_ADDR limit_pc, frame_info_ptr this_frame,
struct mips_frame_cache *this_cache)
{
int prev_non_prologue_insn;
@@ -3438,7 +3409,7 @@ mips32_scan_prologue (struct gdbarch *gdbarch,
CORE_ADDR cur_pc;
CORE_ADDR sp;
long frame_offset;
- int frame_reg = MIPS_SP_REGNUM;
+ int frame_reg = MIPS_SP_REGNUM;
CORE_ADDR end_prologue_addr;
int seen_sp_adjust = 0;
@@ -3449,9 +3420,8 @@ mips32_scan_prologue (struct gdbarch *gdbarch,
/* Can be called when there's no process, and hence when there's no
THIS_FRAME. */
if (this_frame != NULL)
- sp = get_frame_register_signed (this_frame,
- gdbarch_num_regs (gdbarch)
- + MIPS_SP_REGNUM);
+ sp = get_frame_register_signed (this_frame, gdbarch_num_regs (gdbarch)
+ + MIPS_SP_REGNUM);
else
sp = 0;
@@ -3478,19 +3448,19 @@ restart:
in_delay_slot = 0;
/* Fetch the instruction. */
- inst = (unsigned long) mips_fetch_instruction (gdbarch, ISA_MIPS,
- cur_pc, NULL);
+ inst = (unsigned long) mips_fetch_instruction (gdbarch, ISA_MIPS, cur_pc,
+ NULL);
/* Save some code by pre-extracting some useful fields. */
high_word = (inst >> 16) & 0xffff;
offset = ((inst & 0xffff) ^ 0x8000) - 0x8000;
reg = high_word & 0x1f;
- if (high_word == 0x27bd /* addiu $sp,$sp,-i */
- || high_word == 0x23bd /* addi $sp,$sp,-i */
- || high_word == 0x67bd) /* daddiu $sp,$sp,-i */
+ if (high_word == 0x27bd /* addiu $sp,$sp,-i */
+ || high_word == 0x23bd /* addi $sp,$sp,-i */
+ || high_word == 0x67bd) /* daddiu $sp,$sp,-i */
{
- if (offset < 0) /* Negative stack adjustment? */
+ if (offset < 0) /* Negative stack adjustment? */
frame_offset -= offset;
else
/* Exit loop if a positive stack adjustment is found, which
@@ -3504,13 +3474,13 @@ restart:
{
set_reg_offset (gdbarch, this_cache, reg, sp + offset);
}
- else if (((high_word & 0xFFE0) == 0xffa0) /* sd reg,offset($sp) */
+ else if (((high_word & 0xFFE0) == 0xffa0) /* sd reg,offset($sp) */
&& regsize_is_64_bits)
{
/* Irix 6.2 N32 ABI uses sd instructions for saving $gp and $ra. */
set_reg_offset (gdbarch, this_cache, reg, sp + offset);
}
- else if (high_word == 0x27be) /* addiu $30,$sp,size */
+ else if (high_word == 0x27be) /* addiu $30,$sp,size */
{
/* Old gcc frame, r30 is virtual frame pointer. */
if (offset != frame_offset)
@@ -3520,8 +3490,9 @@ restart:
unsigned alloca_adjust;
frame_reg = 30;
- frame_addr = get_frame_register_signed
- (this_frame, gdbarch_num_regs (gdbarch) + 30);
+ frame_addr
+ = get_frame_register_signed (this_frame,
+ gdbarch_num_regs (gdbarch) + 30);
frame_offset = 0;
alloca_adjust = (unsigned) (frame_addr - (sp + offset));
@@ -3551,8 +3522,9 @@ restart:
unsigned alloca_adjust;
frame_reg = 30;
- frame_addr = get_frame_register_signed
- (this_frame, gdbarch_num_regs (gdbarch) + 30);
+ frame_addr
+ = get_frame_register_signed (this_frame,
+ gdbarch_num_regs (gdbarch) + 30);
alloca_adjust = (unsigned) (frame_addr - sp);
if (alloca_adjust > 0)
@@ -3570,22 +3542,22 @@ restart:
}
}
}
- else if ((high_word & 0xFFE0) == 0xafc0 /* sw reg,offset($30) */
+ else if ((high_word & 0xFFE0) == 0xafc0 /* sw reg,offset($30) */
&& !regsize_is_64_bits)
{
set_reg_offset (gdbarch, this_cache, reg, frame_addr + offset);
}
- else if ((high_word & 0xFFE0) == 0xE7A0 /* swc1 freg,n($sp) */
- || (high_word & 0xF3E0) == 0xA3C0 /* sx reg,n($s8) */
+ else if ((high_word & 0xFFE0) == 0xE7A0 /* swc1 freg,n($sp) */
+ || (high_word & 0xF3E0) == 0xA3C0 /* sx reg,n($s8) */
|| (inst & 0xFF9F07FF) == 0x00800021 /* move reg,$a0-$a3 */
- || high_word == 0x3c1c /* lui $gp,n */
- || high_word == 0x279c /* addiu $gp,$gp,n */
- || high_word == 0x679c /* daddiu $gp,$gp,n */
- || inst == 0x0399e021 /* addu $gp,$gp,$t9 */
- || inst == 0x033ce021 /* addu $gp,$t9,$gp */
- || inst == 0x0399e02d /* daddu $gp,$gp,$t9 */
- || inst == 0x033ce02d /* daddu $gp,$t9,$gp */
- )
+ || high_word == 0x3c1c /* lui $gp,n */
+ || high_word == 0x279c /* addiu $gp,$gp,n */
+ || high_word == 0x679c /* daddiu $gp,$gp,n */
+ || inst == 0x0399e021 /* addu $gp,$gp,$t9 */
+ || inst == 0x033ce021 /* addu $gp,$t9,$gp */
+ || inst == 0x0399e02d /* daddu $gp,$gp,$t9 */
+ || inst == 0x033ce02d /* daddu $gp,$t9,$gp */
+ )
{
/* These instructions are part of the prologue, but we don't
need to do anything special to handle them. */
@@ -3595,17 +3567,16 @@ restart:
subu $sp,$sp,[$at,$t0]. These instructions could also
initialize a local variable, so we accept them only before
a stack adjustment instruction was seen. */
- else if (!seen_sp_adjust
- && !prev_delay_slot
- && (high_word == 0x3c01 /* lui $at,n */
+ else if (!seen_sp_adjust && !prev_delay_slot
+ && (high_word == 0x3c01 /* lui $at,n */
|| high_word == 0x3c08 /* lui $t0,n */
|| high_word == 0x3421 /* ori $at,$at,n */
|| high_word == 0x3508 /* ori $t0,$t0,n */
|| high_word == 0x3401 /* ori $at,$zero,n */
|| high_word == 0x3408 /* ori $t0,$zero,n */
- ))
+ ))
{
- load_immediate_bytes += MIPS_INSN32_SIZE; /* FIXME! */
+ load_immediate_bytes += MIPS_INSN32_SIZE; /* FIXME! */
}
/* Check for branches and jumps. The instruction in the delay
slot can be a part of the prologue, so move forward once more. */
@@ -3635,17 +3606,16 @@ restart:
if (this_cache != NULL)
{
- this_cache->base =
- (get_frame_register_signed (this_frame,
- gdbarch_num_regs (gdbarch) + frame_reg)
- + frame_offset);
+ this_cache->base
+ = (get_frame_register_signed (this_frame,
+ gdbarch_num_regs (gdbarch) + frame_reg)
+ + frame_offset);
/* FIXME: brobecker/2004-09-15: We should be able to get rid of
this assignment below, eventually. But it's still needed
for now. */
- this_cache->saved_regs[gdbarch_num_regs (gdbarch)
- + mips_regnum (gdbarch)->pc]
- = this_cache->saved_regs[gdbarch_num_regs (gdbarch)
- + MIPS_RA_REGNUM];
+ this_cache
+ ->saved_regs[gdbarch_num_regs (gdbarch) + mips_regnum (gdbarch)->pc]
+ = this_cache->saved_regs[gdbarch_num_regs (gdbarch) + MIPS_RA_REGNUM];
}
/* Set end_prologue_addr to the address of the instruction immediately
@@ -3654,7 +3624,7 @@ restart:
its address instead. */
end_prologue_addr
= prev_non_prologue_insn || prev_delay_slot ? prev_pc : cur_pc;
-
+
/* In a frameless function, we might have incorrectly
skipped some load immediate instructions. Undo the skipping
if the load immediate was not followed by a stack adjustment. */
@@ -3698,10 +3668,10 @@ mips_insn32_frame_cache (frame_info_ptr this_frame, void **this_cache)
mips32_scan_prologue (gdbarch, start_addr, pc, this_frame,
(struct mips_frame_cache *) *this_cache);
}
-
+
/* gdbarch_sp_regnum contains the value and not the address. */
- cache->saved_regs[gdbarch_num_regs (gdbarch)
- + MIPS_SP_REGNUM].set_value (cache->base);
+ cache->saved_regs[gdbarch_num_regs (gdbarch) + MIPS_SP_REGNUM].set_value (
+ cache->base);
return (struct mips_frame_cache *) (*this_cache);
}
@@ -3710,8 +3680,8 @@ static void
mips_insn32_frame_this_id (frame_info_ptr this_frame, void **this_cache,
struct frame_id *this_id)
{
- struct mips_frame_cache *info = mips_insn32_frame_cache (this_frame,
- this_cache);
+ struct mips_frame_cache *info
+ = mips_insn32_frame_cache (this_frame, this_cache);
/* This marks the outermost frame. */
if (info->base == 0)
return;
@@ -3719,11 +3689,11 @@ mips_insn32_frame_this_id (frame_info_ptr this_frame, void **this_cache,
}
static struct value *
-mips_insn32_frame_prev_register (frame_info_ptr this_frame,
- void **this_cache, int regnum)
+mips_insn32_frame_prev_register (frame_info_ptr this_frame, void **this_cache,
+ int regnum)
{
- struct mips_frame_cache *info = mips_insn32_frame_cache (this_frame,
- this_cache);
+ struct mips_frame_cache *info
+ = mips_insn32_frame_cache (this_frame, this_cache);
return trad_frame_get_prev_register (this_frame, info->saved_regs, regnum);
}
@@ -3737,33 +3707,23 @@ mips_insn32_frame_sniffer (const struct frame_unwind *self,
return 0;
}
-static const struct frame_unwind mips_insn32_frame_unwind =
-{
- "mips insn32 prologue",
- NORMAL_FRAME,
- default_frame_unwind_stop_reason,
- mips_insn32_frame_this_id,
- mips_insn32_frame_prev_register,
- NULL,
- mips_insn32_frame_sniffer
-};
+static const struct frame_unwind mips_insn32_frame_unwind
+ = { "mips insn32 prologue", NORMAL_FRAME,
+ default_frame_unwind_stop_reason, mips_insn32_frame_this_id,
+ mips_insn32_frame_prev_register, NULL,
+ mips_insn32_frame_sniffer };
static CORE_ADDR
-mips_insn32_frame_base_address (frame_info_ptr this_frame,
- void **this_cache)
+mips_insn32_frame_base_address (frame_info_ptr this_frame, void **this_cache)
{
- struct mips_frame_cache *info = mips_insn32_frame_cache (this_frame,
- this_cache);
+ struct mips_frame_cache *info
+ = mips_insn32_frame_cache (this_frame, this_cache);
return info->base;
}
-static const struct frame_base mips_insn32_frame_base =
-{
- &mips_insn32_frame_unwind,
- mips_insn32_frame_base_address,
- mips_insn32_frame_base_address,
- mips_insn32_frame_base_address
-};
+static const struct frame_base mips_insn32_frame_base
+ = { &mips_insn32_frame_unwind, mips_insn32_frame_base_address,
+ mips_insn32_frame_base_address, mips_insn32_frame_base_address };
static const struct frame_base *
mips_insn32_frame_base_sniffer (frame_info_ptr this_frame)
@@ -3791,16 +3751,15 @@ mips_stub_frame_cache (frame_info_ptr this_frame, void **this_cache)
(*this_cache) = this_trad_cache;
/* The return address is in the link register. */
- trad_frame_set_reg_realreg (this_trad_cache,
- gdbarch_pc_regnum (gdbarch),
+ trad_frame_set_reg_realreg (this_trad_cache, gdbarch_pc_regnum (gdbarch),
num_regs + MIPS_RA_REGNUM);
/* Frame ID, since it's a frameless / stackless function, no stack
space is allocated and SP on entry is the current SP. */
pc = get_frame_pc (this_frame);
find_pc_partial_function (pc, NULL, &start_addr, NULL);
- stack_addr = get_frame_register_signed (this_frame,
- num_regs + MIPS_SP_REGNUM);
+ stack_addr
+ = get_frame_register_signed (this_frame, num_regs + MIPS_SP_REGNUM);
trad_frame_set_id (this_trad_cache, frame_id_build (stack_addr, start_addr));
/* Assume that the frame's base is the same as the
@@ -3820,8 +3779,8 @@ mips_stub_frame_this_id (frame_info_ptr this_frame, void **this_cache,
}
static struct value *
-mips_stub_frame_prev_register (frame_info_ptr this_frame,
- void **this_cache, int regnum)
+mips_stub_frame_prev_register (frame_info_ptr this_frame, void **this_cache,
+ int regnum)
{
struct trad_frame_cache *this_trad_cache
= mips_stub_frame_cache (this_frame, this_cache);
@@ -3846,41 +3805,33 @@ mips_stub_frame_sniffer (const struct frame_unwind *self,
/* Calling a PIC function from a non-PIC function passes through a
stub. The stub for foo is named ".pic.foo". */
msym = lookup_minimal_symbol_by_pc (pc);
- if (msym.minsym != NULL
- && msym.minsym->linkage_name () != NULL
+ if (msym.minsym != NULL && msym.minsym->linkage_name () != NULL
&& startswith (msym.minsym->linkage_name (), ".pic."))
return 1;
return 0;
}
-static const struct frame_unwind mips_stub_frame_unwind =
-{
- "mips stub",
- NORMAL_FRAME,
- default_frame_unwind_stop_reason,
- mips_stub_frame_this_id,
- mips_stub_frame_prev_register,
- NULL,
- mips_stub_frame_sniffer
-};
+static const struct frame_unwind mips_stub_frame_unwind
+ = { "mips stub",
+ NORMAL_FRAME,
+ default_frame_unwind_stop_reason,
+ mips_stub_frame_this_id,
+ mips_stub_frame_prev_register,
+ NULL,
+ mips_stub_frame_sniffer };
static CORE_ADDR
-mips_stub_frame_base_address (frame_info_ptr this_frame,
- void **this_cache)
+mips_stub_frame_base_address (frame_info_ptr this_frame, void **this_cache)
{
struct trad_frame_cache *this_trad_cache
= mips_stub_frame_cache (this_frame, this_cache);
return trad_frame_get_this_base (this_trad_cache);
}
-static const struct frame_base mips_stub_frame_base =
-{
- &mips_stub_frame_unwind,
- mips_stub_frame_base_address,
- mips_stub_frame_base_address,
- mips_stub_frame_base_address
-};
+static const struct frame_base mips_stub_frame_base
+ = { &mips_stub_frame_unwind, mips_stub_frame_base_address,
+ mips_stub_frame_base_address, mips_stub_frame_base_address };
static const struct frame_base *
mips_stub_frame_base_sniffer (frame_info_ptr this_frame)
@@ -3919,7 +3870,6 @@ mips_addr_bits_remove (struct gdbarch *gdbarch, CORE_ADDR addr)
return addr;
}
-
/* Checks for an atomic sequence of instructions beginning with a LL/LLD
instruction and ending with a SC/SCD instruction. If such a sequence
is found, attempt to step through it. A breakpoint is placed at the end of
@@ -3935,13 +3885,13 @@ mips_addr_bits_remove (struct gdbarch *gdbarch, CORE_ADDR addr)
static std::vector<CORE_ADDR>
mips_deal_with_atomic_sequence (struct gdbarch *gdbarch, CORE_ADDR pc)
{
- CORE_ADDR breaks[2] = {CORE_ADDR_MAX, CORE_ADDR_MAX};
+ CORE_ADDR breaks[2] = { CORE_ADDR_MAX, CORE_ADDR_MAX };
CORE_ADDR loc = pc;
CORE_ADDR branch_bp; /* Breakpoint at branch instruction's destination. */
ULONGEST insn;
int insn_count;
int index;
- int last_breakpoint = 0; /* Defaults to 0 (no breakpoints placed). */
+ int last_breakpoint = 0; /* Defaults to 0 (no breakpoints placed). */
const int atomic_sequence_length = 16; /* Instruction sequence length. */
insn = mips_fetch_instruction (gdbarch, ISA_MIPS, loc, NULL);
@@ -3962,26 +3912,26 @@ mips_deal_with_atomic_sequence (struct gdbarch *gdbarch, CORE_ADDR pc)
destination address. */
switch (itype_op (insn))
{
- case 0: /* SPECIAL */
+ case 0: /* SPECIAL */
if (rtype_funct (insn) >> 1 == 4) /* JR, JALR */
return {}; /* fallback to the standard single-step code. */
break;
- case 1: /* REGIMM */
+ case 1: /* REGIMM */
is_branch = ((itype_rt (insn) & 0xc) == 0 /* B{LT,GE}Z* */
|| ((itype_rt (insn) & 0x1e) == 0
&& itype_rs (insn) == 0)); /* BPOSGE* */
break;
- case 2: /* J */
- case 3: /* JAL */
+ case 2: /* J */
+ case 3: /* JAL */
return {}; /* fallback to the standard single-step code. */
- case 4: /* BEQ */
- case 5: /* BNE */
- case 6: /* BLEZ */
- case 7: /* BGTZ */
- case 20: /* BEQL */
- case 21: /* BNEL */
- case 22: /* BLEZL */
- case 23: /* BGTTL */
+ case 4: /* BEQ */
+ case 5: /* BNE */
+ case 6: /* BLEZ */
+ case 7: /* BGTZ */
+ case 20: /* BEQL */
+ case 21: /* BNEL */
+ case 22: /* BLEZL */
+ case 23: /* BGTTL */
is_branch = 1;
break;
case 17: /* COP1 */
@@ -3990,8 +3940,8 @@ mips_deal_with_atomic_sequence (struct gdbarch *gdbarch, CORE_ADDR pc)
if (is_branch) /* BC1ANY2F, BC1ANY2T, BC1ANY4F, BC1ANY4T */
break;
/* Fall through. */
- case 18: /* COP2 */
- case 19: /* COP3 */
+ case 18: /* COP2 */
+ case 19: /* COP3 */
is_branch = (itype_rs (insn) == 8); /* BCzF, BCzFL, BCzT, BCzTL */
break;
}
@@ -4033,12 +3983,11 @@ mips_deal_with_atomic_sequence (struct gdbarch *gdbarch, CORE_ADDR pc)
}
static std::vector<CORE_ADDR>
-micromips_deal_with_atomic_sequence (struct gdbarch *gdbarch,
- CORE_ADDR pc)
+micromips_deal_with_atomic_sequence (struct gdbarch *gdbarch, CORE_ADDR pc)
{
const int atomic_sequence_length = 16; /* Instruction sequence length. */
int last_breakpoint = 0; /* Defaults to 0 (no breakpoints placed). */
- CORE_ADDR breaks[2] = {CORE_ADDR_MAX, CORE_ADDR_MAX};
+ CORE_ADDR breaks[2] = { CORE_ADDR_MAX, CORE_ADDR_MAX };
CORE_ADDR branch_bp = 0; /* Breakpoint at branch instruction's
destination. */
CORE_ADDR loc = pc;
@@ -4049,20 +3998,19 @@ micromips_deal_with_atomic_sequence (struct gdbarch *gdbarch,
/* Assume all atomic sequences start with a ll/lld instruction. */
insn = mips_fetch_instruction (gdbarch, ISA_MICROMIPS, loc, NULL);
- if (micromips_op (insn) != 0x18) /* POOL32C: bits 011000 */
+ if (micromips_op (insn) != 0x18) /* POOL32C: bits 011000 */
return {};
loc += MIPS_INSN16_SIZE;
insn <<= 16;
insn |= mips_fetch_instruction (gdbarch, ISA_MICROMIPS, loc, NULL);
- if ((b12s4_op (insn) & 0xb) != 0x3) /* LL, LLD: bits 011000 0x11 */
+ if ((b12s4_op (insn) & 0xb) != 0x3) /* LL, LLD: bits 011000 0x11 */
return {};
loc += MIPS_INSN16_SIZE;
/* Assume all atomic sequences end with an sc/scd instruction. Assume
that no atomic sequence is longer than "atomic_sequence_length"
instructions. */
- for (insn_count = 0;
- !sc_found && insn_count < atomic_sequence_length;
+ for (insn_count = 0; !sc_found && insn_count < atomic_sequence_length;
++insn_count)
{
int is_branch = 0;
@@ -4081,29 +4029,26 @@ micromips_deal_with_atomic_sequence (struct gdbarch *gdbarch,
{
case 0x10: /* POOL32I: bits 010000 */
if ((b5s5_op (insn) & 0x18) != 0x0
- /* BLTZ, BLTZAL, BGEZ, BGEZAL: 010000 000xx */
- /* BLEZ, BNEZC, BGTZ, BEQZC: 010000 001xx */
+ /* BLTZ, BLTZAL, BGEZ, BGEZAL: 010000 000xx */
+ /* BLEZ, BNEZC, BGTZ, BEQZC: 010000 001xx */
&& (b5s5_op (insn) & 0x1d) != 0x11
- /* BLTZALS, BGEZALS: bits 010000 100x1 */
- && ((b5s5_op (insn) & 0x1e) != 0x14
- || (insn & 0x3) != 0x0)
- /* BC2F, BC2T: bits 010000 1010x xxx00 */
+ /* BLTZALS, BGEZALS: bits 010000 100x1 */
+ && ((b5s5_op (insn) & 0x1e) != 0x14 || (insn & 0x3) != 0x0)
+ /* BC2F, BC2T: bits 010000 1010x xxx00 */
&& (b5s5_op (insn) & 0x1e) != 0x1a
- /* BPOSGE64, BPOSGE32: bits 010000 1101x */
- && ((b5s5_op (insn) & 0x1e) != 0x1c
- || (insn & 0x3) != 0x0)
- /* BC1F, BC1T: bits 010000 1110x xxx00 */
- && ((b5s5_op (insn) & 0x1c) != 0x1c
- || (insn & 0x3) != 0x1))
- /* BC1ANY*: bits 010000 111xx xxx01 */
+ /* BPOSGE64, BPOSGE32: bits 010000 1101x */
+ && ((b5s5_op (insn) & 0x1e) != 0x1c || (insn & 0x3) != 0x0)
+ /* BC1F, BC1T: bits 010000 1110x xxx00 */
+ && ((b5s5_op (insn) & 0x1c) != 0x1c || (insn & 0x3) != 0x1))
+ /* BC1ANY*: bits 010000 111xx xxx01 */
break;
/* Fall through. */
case 0x25: /* BEQ: bits 100101 */
case 0x2d: /* BNE: bits 101101 */
insn <<= 16;
- insn |= mips_fetch_instruction (gdbarch,
- ISA_MICROMIPS, loc, NULL);
+ insn
+ |= mips_fetch_instruction (gdbarch, ISA_MICROMIPS, loc, NULL);
branch_bp = (loc + MIPS_INSN16_SIZE
+ micromips_relative_offset16 (insn));
is_branch = 1;
@@ -4111,25 +4056,25 @@ micromips_deal_with_atomic_sequence (struct gdbarch *gdbarch,
case 0x00: /* POOL32A: bits 000000 */
insn <<= 16;
- insn |= mips_fetch_instruction (gdbarch,
- ISA_MICROMIPS, loc, NULL);
+ insn
+ |= mips_fetch_instruction (gdbarch, ISA_MICROMIPS, loc, NULL);
if (b0s6_op (insn) != 0x3c
- /* POOL32Axf: bits 000000 ... 111100 */
+ /* POOL32Axf: bits 000000 ... 111100 */
|| (b6s10_ext (insn) & 0x2bf) != 0x3c)
- /* JALR, JALR.HB: 000000 000x111100 111100 */
- /* JALRS, JALRS.HB: 000000 010x111100 111100 */
+ /* JALR, JALR.HB: 000000 000x111100 111100 */
+ /* JALRS, JALRS.HB: 000000 010x111100 111100 */
break;
/* Fall through. */
- case 0x1d: /* JALS: bits 011101 */
- case 0x35: /* J: bits 110101 */
- case 0x3d: /* JAL: bits 111101 */
- case 0x3c: /* JALX: bits 111100 */
+ case 0x1d: /* JALS: bits 011101 */
+ case 0x35: /* J: bits 110101 */
+ case 0x3d: /* JAL: bits 111101 */
+ case 0x3c: /* JALX: bits 111100 */
return {}; /* Fall back to the standard single-step code. */
case 0x18: /* POOL32C: bits 011000 */
if ((b12s4_op (insn) & 0xb) == 0xb)
- /* SC, SCD: bits 011000 1x11 */
+ /* SC, SCD: bits 011000 1x11 */
sc_found = 1;
break;
}
@@ -4148,13 +4093,13 @@ micromips_deal_with_atomic_sequence (struct gdbarch *gdbarch,
case 0x11: /* POOL16C: bits 010001 */
if ((b5s5_op (insn) & 0x1c) != 0xc
- /* JR16, JRC, JALR16, JALRS16: 010001 011xx */
+ /* JR16, JRC, JALR16, JALRS16: 010001 011xx */
&& b5s5_op (insn) != 0x18)
- /* JRADDIUSP: bits 010001 11000 */
+ /* JRADDIUSP: bits 010001 11000 */
break;
return {}; /* Fall back to the standard single-step code. */
- case 0x33: /* B16: bits 110011 */
+ case 0x33: /* B16: bits 110011 */
return {}; /* Fall back to the standard single-step code. */
}
break;
@@ -4218,7 +4163,7 @@ mips_software_single_step (struct regcache *regcache)
next_pc = mips_next_pc (regcache, pc);
- return {next_pc};
+ return { next_pc };
}
/* Test whether the PC points to the return instruction at the
@@ -4236,10 +4181,9 @@ mips_about_to_return (struct gdbarch *gdbarch, CORE_ADDR pc)
insn = mips_fetch_instruction (gdbarch, ISA_MIPS, pc, NULL);
hint = 0x7c0;
- return (insn & ~hint) == 0x3e00008; /* jr(.hb) $ra */
+ return (insn & ~hint) == 0x3e00008; /* jr(.hb) $ra */
}
-
/* This fencepost looks highly suspicious to me. Removing it also
seems suspicious as it could affect remote debugging across serial
lines. */
@@ -4278,7 +4222,7 @@ heuristic_proc_start (struct gdbarch *gdbarch, CORE_ADDR pc)
{
static int blurb_printed = 0;
- warning (_("GDB can't find the start of the function at %s."),
+ warning (_ ("GDB can't find the start of the function at %s."),
paddress (gdbarch, pc));
if (!blurb_printed)
@@ -4320,25 +4264,25 @@ heuristic-fence-post' command.\n",
daddiu sp,-n
extend -n followed by 'addiu sp,+n' or 'daddiu sp,+n'. */
inst = mips_fetch_instruction (gdbarch, ISA_MIPS16, start_pc, NULL);
- if ((inst & 0xff80) == 0x6480) /* save */
+ if ((inst & 0xff80) == 0x6480) /* save */
{
if (start_pc - instlen >= fence)
{
inst = mips_fetch_instruction (gdbarch, ISA_MIPS16,
start_pc - instlen, NULL);
- if ((inst & 0xf800) == 0xf000) /* extend */
+ if ((inst & 0xf800) == 0xf000) /* extend */
start_pc -= instlen;
}
break;
}
else if (((inst & 0xf81f) == 0xe809
- && (inst & 0x700) != 0x700) /* entry */
- || (inst & 0xff80) == 0x6380 /* addiu sp,-n */
- || (inst & 0xff80) == 0xfb80 /* daddiu sp,-n */
- || ((inst & 0xf810) == 0xf010 && seen_adjsp)) /* extend -n */
+ && (inst & 0x700) != 0x700) /* entry */
+ || (inst & 0xff80) == 0x6380 /* addiu sp,-n */
+ || (inst & 0xff80) == 0xfb80 /* daddiu sp,-n */
+ || ((inst & 0xf810) == 0xf010 && seen_adjsp)) /* extend -n */
break;
- else if ((inst & 0xff00) == 0x6300 /* addiu sp */
- || (inst & 0xff00) == 0xfb00) /* daddiu sp */
+ else if ((inst & 0xff00) == 0x6300 /* addiu sp */
+ || (inst & 0xff00) == 0xfb00) /* daddiu sp */
seen_adjsp = 1;
else
seen_adjsp = 0;
@@ -4359,7 +4303,7 @@ heuristic-fence-post' command.\n",
insn = mips_fetch_instruction (gdbarch, ISA_MICROMIPS, pc, NULL);
switch (micromips_op (insn))
{
- case 0xc: /* ADDIU: bits 001100 */
+ case 0xc: /* ADDIU: bits 001100 */
case 0x17: /* DADDIU: bits 010111 */
sreg = b0s5_reg (insn);
dreg = b5s5_reg (insn);
@@ -4367,36 +4311,37 @@ heuristic-fence-post' command.\n",
insn |= mips_fetch_instruction (gdbarch, ISA_MICROMIPS,
pc + MIPS_INSN16_SIZE, NULL);
offset = (b0s16_imm (insn) ^ 0x8000) - 0x8000;
- if (sreg == MIPS_SP_REGNUM && dreg == MIPS_SP_REGNUM
- /* (D)ADDIU $sp, imm */
+ if (sreg == MIPS_SP_REGNUM
+ && dreg == MIPS_SP_REGNUM
+ /* (D)ADDIU $sp, imm */
&& offset < 0)
stop = 1;
break;
case 0x10: /* POOL32I: bits 010000 */
if (b5s5_op (insn) == 0xd
- /* LUI: bits 010000 001101 */
+ /* LUI: bits 010000 001101 */
&& b0s5_reg (insn >> 16) == 28)
- /* LUI $gp, imm */
+ /* LUI $gp, imm */
stop = 1;
break;
case 0x13: /* POOL16D: bits 010011 */
if ((insn & 0x1) == 0x1)
- /* ADDIUSP: bits 010011 1 */
+ /* ADDIUSP: bits 010011 1 */
{
offset = micromips_decode_imm9 (b1s9_imm (insn));
if (offset < 0)
- /* ADDIUSP -imm */
+ /* ADDIUSP -imm */
stop = 1;
}
else
- /* ADDIUS5: bits 010011 0 */
+ /* ADDIUS5: bits 010011 0 */
{
dreg = b5s5_reg (insn);
offset = (b1s4_imm (insn) ^ 8) - 8;
if (dreg == MIPS_SP_REGNUM && offset < 0)
- /* ADDIUS5 $sp, -imm */
+ /* ADDIUS5 $sp, -imm */
stop = 1;
}
break;
@@ -4432,11 +4377,10 @@ fp_register_arg_p (struct gdbarch *gdbarch, enum type_code typecode,
{
return ((typecode == TYPE_CODE_FLT
|| (mips_eabi (gdbarch)
- && (typecode == TYPE_CODE_STRUCT
- || typecode == TYPE_CODE_UNION)
+ && (typecode == TYPE_CODE_STRUCT || typecode == TYPE_CODE_UNION)
&& arg_type->num_fields () == 1
&& check_typedef (arg_type->field (0).type ())->code ()
- == TYPE_CODE_FLT))
+ == TYPE_CODE_FLT))
&& mips_get_fpu_type (gdbarch) != MIPS_FPU_NONE);
}
@@ -4480,9 +4424,8 @@ mips_frame_align (struct gdbarch *gdbarch, CORE_ADDR addr)
/* Implement the "push_dummy_code" gdbarch method. */
static CORE_ADDR
-mips_push_dummy_code (struct gdbarch *gdbarch, CORE_ADDR sp,
- CORE_ADDR funaddr, struct value **args,
- int nargs, struct type *value_type,
+mips_push_dummy_code (struct gdbarch *gdbarch, CORE_ADDR sp, CORE_ADDR funaddr,
+ struct value **args, int nargs, struct type *value_type,
CORE_ADDR *real_pc, CORE_ADDR *bp_addr,
struct regcache *regcache)
{
@@ -4496,8 +4439,9 @@ mips_push_dummy_code (struct gdbarch *gdbarch, CORE_ADDR sp,
/* Return to microMIPS mode if calling microMIPS code to avoid
triggering an address error exception on processors that only
support microMIPS execution. */
- *bp_addr = (mips_pc_is_micromips (gdbarch, funaddr)
- ? make_compact_addr (bp_slot) : bp_slot);
+ *bp_addr
+ = (mips_pc_is_micromips (gdbarch, funaddr) ? make_compact_addr (bp_slot)
+ : bp_slot);
/* The breakpoint layer automatically adjusts the address of
breakpoints inserted in a branch delay slot. With enough
@@ -4553,15 +4497,12 @@ mips_eabi_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
than necessary for EABI, because the first few arguments are
passed in registers, but that's OK. */
for (argnum = 0; argnum < nargs; argnum++)
- arg_space += align_up (value_type (args[argnum])->length (),
- abi_regsize);
+ arg_space += align_up (value_type (args[argnum])->length (), abi_regsize);
sp -= align_up (arg_space, 16);
if (mips_debug)
- gdb_printf (gdb_stdlog,
- "mips_eabi_push_dummy_call: sp=%s allocated %ld\n",
- paddress (gdbarch, sp),
- (long) align_up (arg_space, 16));
+ gdb_printf (gdb_stdlog, "mips_eabi_push_dummy_call: sp=%s allocated %ld\n",
+ paddress (gdbarch, sp), (long) align_up (arg_space, 16));
/* Initialize the integer and float register pointers. */
argreg = MIPS_A0_REGNUM;
@@ -4593,8 +4534,7 @@ mips_eabi_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
enum type_code typecode = arg_type->code ();
if (mips_debug)
- gdb_printf (gdb_stdlog,
- "mips_eabi_push_dummy_call: %d len=%d type=%d",
+ gdb_printf (gdb_stdlog, "mips_eabi_push_dummy_call: %d len=%d type=%d",
argnum + 1, len, (int) typecode);
/* The EABI passes structures that do not fit in a register by
@@ -4647,24 +4587,24 @@ mips_eabi_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
making the ABI determination. */
if (len == 8 && mips_abi (gdbarch) == MIPS_ABI_EABI32)
{
- int low_offset = gdbarch_byte_order (gdbarch)
- == BFD_ENDIAN_BIG ? 4 : 0;
+ int low_offset
+ = gdbarch_byte_order (gdbarch) == BFD_ENDIAN_BIG ? 4 : 0;
long regval;
/* Write the low word of the double to the even register(s). */
- regval = extract_signed_integer (val + low_offset,
- 4, byte_order);
+ regval
+ = extract_signed_integer (val + low_offset, 4, byte_order);
if (mips_debug)
- gdb_printf (gdb_stdlog, " - fpreg=%d val=%s",
- float_argreg, phex (regval, 4));
+ gdb_printf (gdb_stdlog, " - fpreg=%d val=%s", float_argreg,
+ phex (regval, 4));
regcache_cooked_write_signed (regcache, float_argreg++, regval);
/* Write the high word of the double to the odd register(s). */
- regval = extract_signed_integer (val + 4 - low_offset,
- 4, byte_order);
+ regval
+ = extract_signed_integer (val + 4 - low_offset, 4, byte_order);
if (mips_debug)
- gdb_printf (gdb_stdlog, " - fpreg=%d val=%s",
- float_argreg, phex (regval, 4));
+ gdb_printf (gdb_stdlog, " - fpreg=%d val=%s", float_argreg,
+ phex (regval, 4));
regcache_cooked_write_signed (regcache, float_argreg++, regval);
}
else
@@ -4675,8 +4615,8 @@ mips_eabi_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
above to ensure that it is even register aligned. */
LONGEST regval = extract_signed_integer (val, len, byte_order);
if (mips_debug)
- gdb_printf (gdb_stdlog, " - fpreg=%d val=%s",
- float_argreg, phex (regval, len));
+ gdb_printf (gdb_stdlog, " - fpreg=%d val=%s", float_argreg,
+ phex (regval, len));
regcache_cooked_write_signed (regcache, float_argreg++, regval);
}
}
@@ -4701,12 +4641,10 @@ mips_eabi_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
int partial_len = (len < abi_regsize ? len : abi_regsize);
if (mips_debug)
- gdb_printf (gdb_stdlog, " -- partial=%d",
- partial_len);
+ gdb_printf (gdb_stdlog, " -- partial=%d", partial_len);
/* Write this portion of the argument to the stack. */
- if (argreg > mips_last_arg_regnum (gdbarch)
- || odd_sized_struct
+ if (argreg > mips_last_arg_regnum (gdbarch) || odd_sized_struct
|| fp_register_arg_p (gdbarch, typecode, arg_type))
{
/* Should shorter than int integer values be
@@ -4719,7 +4657,8 @@ mips_eabi_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
if (abi_regsize == 8
&& (typecode == TYPE_CODE_INT
|| typecode == TYPE_CODE_PTR
- || typecode == TYPE_CODE_FLT) && len <= 4)
+ || typecode == TYPE_CODE_FLT)
+ && len <= 4)
longword_offset = abi_regsize - len;
else if ((typecode == TYPE_CODE_STRUCT
|| typecode == TYPE_CODE_UNION)
@@ -4744,8 +4683,7 @@ mips_eabi_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
paddress (gdbarch, addr));
for (i = 0; i < partial_len; i++)
{
- gdb_printf (gdb_stdlog, "%02x",
- val[i] & 0xff);
+ gdb_printf (gdb_stdlog, "%02x", val[i] & 0xff);
}
}
write_memory (addr, val, partial_len);
@@ -4759,12 +4697,11 @@ mips_eabi_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
if (argreg <= mips_last_arg_regnum (gdbarch)
&& !fp_register_arg_p (gdbarch, typecode, arg_type))
{
- LONGEST regval =
- extract_signed_integer (val, partial_len, byte_order);
+ LONGEST regval
+ = extract_signed_integer (val, partial_len, byte_order);
if (mips_debug)
- gdb_printf (gdb_stdlog, " - reg=%d val=%s",
- argreg,
+ gdb_printf (gdb_stdlog, " - reg=%d val=%s", argreg,
phex (regval, abi_regsize));
regcache_cooked_write_signed (regcache, argreg, regval);
argreg++;
@@ -4825,7 +4762,7 @@ mips_eabi_return_value (struct gdbarch *gdbarch, struct value *function,
}
}
- if (fp_return_type)
+ if (fp_return_type)
{
/* A floating-point value belongs in the least significant part
of FP0/FP1. */
@@ -4833,15 +4770,14 @@ mips_eabi_return_value (struct gdbarch *gdbarch, struct value *function,
gdb_printf (gdb_stderr, "Return float in $fp0\n");
regnum = mips_regnum (gdbarch)->fp0;
}
- else
+ else
{
/* An integer value goes in V0/V1. */
if (mips_debug)
gdb_printf (gdb_stderr, "Return scalar in $v0\n");
regnum = MIPS_V0_REGNUM;
}
- for (offset = 0;
- offset < type->length ();
+ for (offset = 0; offset < type->length ();
offset += mips_abi_regsize (gdbarch), regnum++)
{
xfer = mips_abi_regsize (gdbarch);
@@ -4856,7 +4792,6 @@ mips_eabi_return_value (struct gdbarch *gdbarch, struct value *function,
return RETURN_VALUE_REGISTER_CONVENTION;
}
-
/* N32/N64 ABI stuff. */
/* Search for a naturally aligned double at OFFSET inside a struct
@@ -4947,15 +4882,14 @@ mips_n32n64_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
/* Now make space on the stack for the args. */
for (argnum = 0; argnum < nargs; argnum++)
- arg_space += align_up (value_type (args[argnum])->length (),
- MIPS64_REGSIZE);
+ arg_space
+ += align_up (value_type (args[argnum])->length (), MIPS64_REGSIZE);
sp -= align_up (arg_space, 16);
if (mips_debug)
gdb_printf (gdb_stdlog,
"mips_n32n64_push_dummy_call: sp=%s allocated %ld\n",
- paddress (gdbarch, sp),
- (long) align_up (arg_space, 16));
+ paddress (gdbarch, sp), (long) align_up (arg_space, 16));
/* Initialize the integer and float register pointers. */
argreg = MIPS_A0_REGNUM;
@@ -4992,8 +4926,7 @@ mips_n32n64_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
/* A 128-bit long double value requires an even-odd pair of
floating-point registers. */
- if (len == 16
- && fp_register_arg_p (gdbarch, typecode, arg_type)
+ if (len == 16 && fp_register_arg_p (gdbarch, typecode, arg_type)
&& (float_argreg & 1))
{
float_argreg++;
@@ -5008,28 +4941,28 @@ mips_n32n64_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
int reglen = (len <= MIPS64_REGSIZE ? len : MIPS64_REGSIZE);
LONGEST regval = extract_unsigned_integer (val, reglen, byte_order);
if (mips_debug)
- gdb_printf (gdb_stdlog, " - fpreg=%d val=%s",
- float_argreg, phex (regval, reglen));
+ gdb_printf (gdb_stdlog, " - fpreg=%d val=%s", float_argreg,
+ phex (regval, reglen));
regcache_cooked_write_unsigned (regcache, float_argreg, regval);
if (mips_debug)
- gdb_printf (gdb_stdlog, " - reg=%d val=%s",
- argreg, phex (regval, reglen));
+ gdb_printf (gdb_stdlog, " - reg=%d val=%s", argreg,
+ phex (regval, reglen));
regcache_cooked_write_unsigned (regcache, argreg, regval);
float_argreg++;
argreg++;
if (len == 16)
{
- regval = extract_unsigned_integer (val + reglen,
- reglen, byte_order);
+ regval
+ = extract_unsigned_integer (val + reglen, reglen, byte_order);
if (mips_debug)
- gdb_printf (gdb_stdlog, " - fpreg=%d val=%s",
- float_argreg, phex (regval, reglen));
+ gdb_printf (gdb_stdlog, " - fpreg=%d val=%s", float_argreg,
+ phex (regval, reglen));
regcache_cooked_write_unsigned (regcache, float_argreg, regval);
if (mips_debug)
- gdb_printf (gdb_stdlog, " - reg=%d val=%s",
- argreg, phex (regval, reglen));
+ gdb_printf (gdb_stdlog, " - reg=%d val=%s", argreg,
+ phex (regval, reglen));
regcache_cooked_write_unsigned (regcache, argreg, regval);
float_argreg++;
argreg++;
@@ -5057,8 +4990,7 @@ mips_n32n64_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
int partial_len = (len < MIPS64_REGSIZE ? len : MIPS64_REGSIZE);
if (mips_debug)
- gdb_printf (gdb_stdlog, " -- partial=%d",
- partial_len);
+ gdb_printf (gdb_stdlog, " -- partial=%d", partial_len);
if (fp_register_arg_p (gdbarch, typecode, arg_type))
gdb_assert (argreg > mips_last_arg_regnum (gdbarch));
@@ -5096,8 +5028,7 @@ mips_n32n64_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
paddress (gdbarch, addr));
for (i = 0; i < partial_len; i++)
{
- gdb_printf (gdb_stdlog, "%02x",
- val[i] & 0xff);
+ gdb_printf (gdb_stdlog, "%02x", val[i] & 0xff);
}
}
write_memory (addr, val, partial_len);
@@ -5118,11 +5049,10 @@ mips_n32n64_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
if ((partial_len == 4
&& (typecode == TYPE_CODE_PTR
|| typecode == TYPE_CODE_INT))
- || (partial_len < 4
- && typecode == TYPE_CODE_INT
+ || (partial_len < 4 && typecode == TYPE_CODE_INT
&& !arg_type->is_unsigned ()))
- regval = extract_signed_integer (val, partial_len,
- byte_order);
+ regval
+ = extract_signed_integer (val, partial_len, byte_order);
else
regval = extract_unsigned_integer (val, partial_len,
byte_order);
@@ -5140,12 +5070,11 @@ mips_n32n64_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
&& partial_len < MIPS64_REGSIZE
&& (typecode == TYPE_CODE_STRUCT
|| typecode == TYPE_CODE_UNION))
- regval <<= ((MIPS64_REGSIZE - partial_len)
- * TARGET_CHAR_BIT);
+ regval
+ <<= ((MIPS64_REGSIZE - partial_len) * TARGET_CHAR_BIT);
if (mips_debug)
- gdb_printf (gdb_stdlog, " - reg=%d val=%s",
- argreg,
+ gdb_printf (gdb_stdlog, " - reg=%d val=%s", argreg,
phex (regval, MIPS64_REGSIZE));
regcache_cooked_write_unsigned (regcache, argreg, regval);
@@ -5245,13 +5174,12 @@ mips_n32n64_return_value (struct gdbarch *gdbarch, struct value *function,
+ mips_regnum (gdbarch)->fp0),
type->length () / 2, gdbarch_byte_order (gdbarch),
readbuf, writebuf, 0);
- mips_xfer_register (gdbarch, regcache,
- (gdbarch_num_regs (gdbarch)
- + mips_regnum (gdbarch)->fp0 + 2),
- type->length () / 2, gdbarch_byte_order (gdbarch),
- readbuf ? readbuf + type->length () / 2 : readbuf,
- (writebuf
- ? writebuf + type->length () / 2 : writebuf), 0);
+ mips_xfer_register (
+ gdbarch, regcache,
+ (gdbarch_num_regs (gdbarch) + mips_regnum (gdbarch)->fp0 + 2),
+ type->length () / 2, gdbarch_byte_order (gdbarch),
+ readbuf ? readbuf + type->length () / 2 : readbuf,
+ (writebuf ? writebuf + type->length () / 2 : writebuf), 0);
return RETURN_VALUE_REGISTER_CONVENTION;
}
else if (type->code () == TYPE_CODE_FLT
@@ -5263,13 +5191,11 @@ mips_n32n64_return_value (struct gdbarch *gdbarch, struct value *function,
mips_xfer_register (gdbarch, regcache,
(gdbarch_num_regs (gdbarch)
+ mips_regnum (gdbarch)->fp0),
- type->length (),
- gdbarch_byte_order (gdbarch),
+ type->length (), gdbarch_byte_order (gdbarch),
readbuf, writebuf, 0);
return RETURN_VALUE_REGISTER_CONVENTION;
}
- else if (type->code () == TYPE_CODE_STRUCT
- && type->num_fields () <= 2
+ else if (type->code () == TYPE_CODE_STRUCT && type->num_fields () <= 2
&& type->num_fields () >= 1
&& ((type->num_fields () == 1
&& (check_typedef (type->field (0).type ())->code ()
@@ -5286,35 +5212,32 @@ mips_n32n64_return_value (struct gdbarch *gdbarch, struct value *function,
int regnum;
int field;
for (field = 0, regnum = (tdep->mips_fpu_type != MIPS_FPU_NONE
- ? mips_regnum (gdbarch)->fp0
- : MIPS_V0_REGNUM);
+ ? mips_regnum (gdbarch)->fp0
+ : MIPS_V0_REGNUM);
field < type->num_fields (); field++, regnum += 2)
{
int offset = type->field (field).loc_bitpos () / TARGET_CHAR_BIT;
if (mips_debug)
- gdb_printf (gdb_stderr, "Return float struct+%d\n",
- offset);
+ gdb_printf (gdb_stderr, "Return float struct+%d\n", offset);
if (type->field (field).type ()->length () == 16)
{
/* A 16-byte long double field goes in two consecutive
registers. */
mips_xfer_register (gdbarch, regcache,
- gdbarch_num_regs (gdbarch) + regnum,
- 8,
- gdbarch_byte_order (gdbarch),
- readbuf, writebuf, offset);
+ gdbarch_num_regs (gdbarch) + regnum, 8,
+ gdbarch_byte_order (gdbarch), readbuf,
+ writebuf, offset);
mips_xfer_register (gdbarch, regcache,
- gdbarch_num_regs (gdbarch) + regnum + 1,
- 8,
- gdbarch_byte_order (gdbarch),
- readbuf, writebuf, offset + 8);
+ gdbarch_num_regs (gdbarch) + regnum + 1, 8,
+ gdbarch_byte_order (gdbarch), readbuf,
+ writebuf, offset + 8);
}
else
mips_xfer_register (gdbarch, regcache,
gdbarch_num_regs (gdbarch) + regnum,
type->field (field).type ()->length (),
- gdbarch_byte_order (gdbarch),
- readbuf, writebuf, offset);
+ gdbarch_byte_order (gdbarch), readbuf,
+ writebuf, offset);
}
return RETURN_VALUE_REGISTER_CONVENTION;
}
@@ -5327,20 +5250,18 @@ mips_n32n64_return_value (struct gdbarch *gdbarch, struct value *function,
mips_xfer_lower. */
int offset;
int regnum;
- for (offset = 0, regnum = MIPS_V0_REGNUM;
- offset < type->length ();
+ for (offset = 0, regnum = MIPS_V0_REGNUM; offset < type->length ();
offset += register_size (gdbarch, regnum), regnum++)
{
int xfer = register_size (gdbarch, regnum);
if (offset + xfer > type->length ())
xfer = type->length () - offset;
if (mips_debug)
- gdb_printf (gdb_stderr, "Return struct+%d:%d in $%d\n",
- offset, xfer, regnum);
+ gdb_printf (gdb_stderr, "Return struct+%d:%d in $%d\n", offset,
+ xfer, regnum);
mips_xfer_register (gdbarch, regcache,
- gdbarch_num_regs (gdbarch) + regnum,
- xfer, BFD_ENDIAN_UNKNOWN, readbuf, writebuf,
- offset);
+ gdbarch_num_regs (gdbarch) + regnum, xfer,
+ BFD_ENDIAN_UNKNOWN, readbuf, writebuf, offset);
}
return RETURN_VALUE_REGISTER_CONVENTION;
}
@@ -5350,20 +5271,19 @@ mips_n32n64_return_value (struct gdbarch *gdbarch, struct value *function,
justified. */
int offset;
int regnum;
- for (offset = 0, regnum = MIPS_V0_REGNUM;
- offset < type->length ();
+ for (offset = 0, regnum = MIPS_V0_REGNUM; offset < type->length ();
offset += register_size (gdbarch, regnum), regnum++)
{
int xfer = register_size (gdbarch, regnum);
if (offset + xfer > type->length ())
xfer = type->length () - offset;
if (mips_debug)
- gdb_printf (gdb_stderr, "Return scalar+%d:%d in $%d\n",
- offset, xfer, regnum);
+ gdb_printf (gdb_stderr, "Return scalar+%d:%d in $%d\n", offset,
+ xfer, regnum);
mips_xfer_register (gdbarch, regcache,
- gdbarch_num_regs (gdbarch) + regnum,
- xfer, gdbarch_byte_order (gdbarch),
- readbuf, writebuf, offset);
+ gdbarch_num_regs (gdbarch) + regnum, xfer,
+ gdbarch_byte_order (gdbarch), readbuf, writebuf,
+ offset);
}
return RETURN_VALUE_REGISTER_CONVENTION;
}
@@ -5431,10 +5351,8 @@ mips_o32_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
sp -= align_up (arg_space, 16);
if (mips_debug)
- gdb_printf (gdb_stdlog,
- "mips_o32_push_dummy_call: sp=%s allocated %ld\n",
- paddress (gdbarch, sp),
- (long) align_up (arg_space, 16));
+ gdb_printf (gdb_stdlog, "mips_o32_push_dummy_call: sp=%s allocated %ld\n",
+ paddress (gdbarch, sp), (long) align_up (arg_space, 16));
/* Initialize the integer and float register pointers. */
argreg = MIPS_A0_REGNUM;
@@ -5464,8 +5382,7 @@ mips_o32_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
enum type_code typecode = arg_type->code ();
if (mips_debug)
- gdb_printf (gdb_stdlog,
- "mips_o32_push_dummy_call: %d len=%d type=%d",
+ gdb_printf (gdb_stdlog, "mips_o32_push_dummy_call: %d len=%d type=%d",
argnum + 1, len, (int) typecode);
val = value_contents (arg).data ();
@@ -5497,36 +5414,34 @@ mips_o32_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
{
if (register_size (gdbarch, float_argreg) < 8 && len == 8)
{
- int freg_offset = gdbarch_byte_order (gdbarch)
- == BFD_ENDIAN_BIG ? 1 : 0;
+ int freg_offset
+ = gdbarch_byte_order (gdbarch) == BFD_ENDIAN_BIG ? 1 : 0;
unsigned long regval;
/* First word. */
regval = extract_unsigned_integer (val, 4, byte_order);
if (mips_debug)
gdb_printf (gdb_stdlog, " - fpreg=%d val=%s",
- float_argreg + freg_offset,
- phex (regval, 4));
+ float_argreg + freg_offset, phex (regval, 4));
regcache_cooked_write_unsigned (regcache,
float_argreg++ + freg_offset,
regval);
if (mips_debug)
- gdb_printf (gdb_stdlog, " - reg=%d val=%s",
- argreg, phex (regval, 4));
+ gdb_printf (gdb_stdlog, " - reg=%d val=%s", argreg,
+ phex (regval, 4));
regcache_cooked_write_unsigned (regcache, argreg++, regval);
/* Second word. */
regval = extract_unsigned_integer (val + 4, 4, byte_order);
if (mips_debug)
gdb_printf (gdb_stdlog, " - fpreg=%d val=%s",
- float_argreg - freg_offset,
- phex (regval, 4));
+ float_argreg - freg_offset, phex (regval, 4));
regcache_cooked_write_unsigned (regcache,
float_argreg++ - freg_offset,
regval);
if (mips_debug)
- gdb_printf (gdb_stdlog, " - reg=%d val=%s",
- argreg, phex (regval, 4));
+ gdb_printf (gdb_stdlog, " - reg=%d val=%s", argreg,
+ phex (regval, 4));
regcache_cooked_write_unsigned (regcache, argreg++, regval);
}
else
@@ -5537,16 +5452,16 @@ mips_o32_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
above to ensure that it is even register aligned. */
LONGEST regval = extract_unsigned_integer (val, len, byte_order);
if (mips_debug)
- gdb_printf (gdb_stdlog, " - fpreg=%d val=%s",
- float_argreg, phex (regval, len));
- regcache_cooked_write_unsigned (regcache,
- float_argreg++, regval);
+ gdb_printf (gdb_stdlog, " - fpreg=%d val=%s", float_argreg,
+ phex (regval, len));
+ regcache_cooked_write_unsigned (regcache, float_argreg++,
+ regval);
/* Although two FP registers are reserved for each
argument, only one corresponding integer register is
reserved. */
if (mips_debug)
- gdb_printf (gdb_stdlog, " - reg=%d val=%s",
- argreg, phex (regval, len));
+ gdb_printf (gdb_stdlog, " - reg=%d val=%s", argreg,
+ phex (regval, len));
regcache_cooked_write_unsigned (regcache, argreg++, regval);
}
/* Reserve space for the FP register. */
@@ -5562,8 +5477,8 @@ mips_o32_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
them in registers where gcc sometimes puts them on the
stack. For maximum compatibility, we will put them in
both places. */
- int odd_sized_struct = (len > MIPS32_REGSIZE
- && len % MIPS32_REGSIZE != 0);
+ int odd_sized_struct
+ = (len > MIPS32_REGSIZE && len % MIPS32_REGSIZE != 0);
/* Structures should be aligned to eight bytes (even arg registers)
on MIPS_ABI_O32, if their first member has double precision. */
if (mips_type_needs_double_align (arg_type))
@@ -5579,12 +5494,10 @@ mips_o32_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
int partial_len = (len < MIPS32_REGSIZE ? len : MIPS32_REGSIZE);
if (mips_debug)
- gdb_printf (gdb_stdlog, " -- partial=%d",
- partial_len);
+ gdb_printf (gdb_stdlog, " -- partial=%d", partial_len);
/* Write this portion of the argument to the stack. */
- if (argreg > mips_last_arg_regnum (gdbarch)
- || odd_sized_struct)
+ if (argreg > mips_last_arg_regnum (gdbarch) || odd_sized_struct)
{
/* Should shorter than int integer values be
promoted to int before being stored? */
@@ -5608,8 +5521,7 @@ mips_o32_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
paddress (gdbarch, addr));
for (i = 0; i < partial_len; i++)
{
- gdb_printf (gdb_stdlog, "%02x",
- val[i] & 0xff);
+ gdb_printf (gdb_stdlog, "%02x", val[i] & 0xff);
}
}
write_memory (addr, val, partial_len);
@@ -5621,8 +5533,8 @@ mips_o32_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
purpose register. */
if (argreg <= mips_last_arg_regnum (gdbarch))
{
- LONGEST regval = extract_signed_integer (val, partial_len,
- byte_order);
+ LONGEST regval
+ = extract_signed_integer (val, partial_len, byte_order);
/* Value may need to be sign extended, because
mips_isa_regsize() != mips_abi_regsize(). */
@@ -5655,12 +5567,11 @@ mips_o32_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
&& partial_len < MIPS32_REGSIZE
&& (typecode == TYPE_CODE_STRUCT
|| typecode == TYPE_CODE_UNION))
- regval <<= ((MIPS32_REGSIZE - partial_len)
- * TARGET_CHAR_BIT);
+ regval
+ <<= ((MIPS32_REGSIZE - partial_len) * TARGET_CHAR_BIT);
if (mips_debug)
- gdb_printf (gdb_stdlog, " - reg=%d val=%s",
- argreg,
+ gdb_printf (gdb_stdlog, " - reg=%d val=%s", argreg,
phex (regval, MIPS32_REGSIZE));
regcache_cooked_write_unsigned (regcache, argreg, regval);
argreg++;
@@ -5705,12 +5616,11 @@ mips_o32_return_value (struct gdbarch *gdbarch, struct value *function,
enum mips_fval_reg fval_reg;
fval_reg = readbuf ? mips16 ? mips_fval_gpr : mips_fval_fpr : mips_fval_both;
- if (type->code () == TYPE_CODE_STRUCT
- || type->code () == TYPE_CODE_UNION
+ if (type->code () == TYPE_CODE_STRUCT || type->code () == TYPE_CODE_UNION
|| type->code () == TYPE_CODE_ARRAY)
return RETURN_VALUE_STRUCT_CONVENTION;
- else if (type->code () == TYPE_CODE_FLT
- && type->length () == 4 && tdep->mips_fpu_type != MIPS_FPU_NONE)
+ else if (type->code () == TYPE_CODE_FLT && type->length () == 4
+ && tdep->mips_fpu_type != MIPS_FPU_NONE)
{
/* A single-precision floating-point value. If reading in or copying,
then we get it from/put it to FP0 for standard MIPS code or GPR2
@@ -5735,19 +5645,16 @@ mips_o32_return_value (struct gdbarch *gdbarch, struct value *function,
mips_xfer_register (gdbarch, regcache,
(gdbarch_num_regs (gdbarch)
+ mips_regnum (gdbarch)->fp0),
- type->length (),
- gdbarch_byte_order (gdbarch),
+ type->length (), gdbarch_byte_order (gdbarch),
readbuf, writebuf, 0);
if (fval_reg != mips_fval_fpr)
- mips_xfer_register (gdbarch, regcache,
- gdbarch_num_regs (gdbarch) + 2,
- type->length (),
- gdbarch_byte_order (gdbarch),
+ mips_xfer_register (gdbarch, regcache, gdbarch_num_regs (gdbarch) + 2,
+ type->length (), gdbarch_byte_order (gdbarch),
readbuf, writebuf, 0);
return RETURN_VALUE_REGISTER_CONVENTION;
}
- else if (type->code () == TYPE_CODE_FLT
- && type->length () == 8 && tdep->mips_fpu_type != MIPS_FPU_NONE)
+ else if (type->code () == TYPE_CODE_FLT && type->length () == 8
+ && tdep->mips_fpu_type != MIPS_FPU_NONE)
{
/* A double-precision floating-point value. If reading in or copying,
then we get it from/put it to FP1 and FP0 for standard MIPS code or
@@ -5766,8 +5673,7 @@ mips_o32_return_value (struct gdbarch *gdbarch, struct value *function,
gdb_printf (gdb_stderr, "Return float in $2/$3\n");
break;
case mips_fval_both:
- gdb_printf (gdb_stderr,
- "Return float in $fp1/$fp0 and $2/$3\n");
+ gdb_printf (gdb_stderr, "Return float in $fp1/$fp0 and $2/$3\n");
break;
}
if (fval_reg != mips_fval_gpr)
@@ -5780,28 +5686,28 @@ mips_o32_return_value (struct gdbarch *gdbarch, struct value *function,
mips_xfer_register (gdbarch, regcache,
(gdbarch_num_regs (gdbarch)
+ mips_regnum (gdbarch)->fp0 + 0),
- 4, gdbarch_byte_order (gdbarch),
- readbuf, writebuf, 0);
+ 4, gdbarch_byte_order (gdbarch), readbuf,
+ writebuf, 0);
mips_xfer_register (gdbarch, regcache,
(gdbarch_num_regs (gdbarch)
+ mips_regnum (gdbarch)->fp0 + 1),
- 4, gdbarch_byte_order (gdbarch),
- readbuf, writebuf, 4);
+ 4, gdbarch_byte_order (gdbarch), readbuf,
+ writebuf, 4);
break;
case BFD_ENDIAN_BIG:
mips_xfer_register (gdbarch, regcache,
(gdbarch_num_regs (gdbarch)
+ mips_regnum (gdbarch)->fp0 + 1),
- 4, gdbarch_byte_order (gdbarch),
- readbuf, writebuf, 0);
+ 4, gdbarch_byte_order (gdbarch), readbuf,
+ writebuf, 0);
mips_xfer_register (gdbarch, regcache,
(gdbarch_num_regs (gdbarch)
+ mips_regnum (gdbarch)->fp0 + 0),
- 4, gdbarch_byte_order (gdbarch),
- readbuf, writebuf, 4);
+ 4, gdbarch_byte_order (gdbarch), readbuf,
+ writebuf, 4);
break;
default:
- internal_error (_("bad switch"));
+ internal_error (_ ("bad switch"));
}
}
if (fval_reg != mips_fval_fpr)
@@ -5809,13 +5715,13 @@ mips_o32_return_value (struct gdbarch *gdbarch, struct value *function,
/* The two 32-bit parts are always placed in GPR2 and GPR3
following these registers' memory order. */
mips_xfer_register (gdbarch, regcache,
- gdbarch_num_regs (gdbarch) + 2,
- 4, gdbarch_byte_order (gdbarch),
- readbuf, writebuf, 0);
+ gdbarch_num_regs (gdbarch) + 2, 4,
+ gdbarch_byte_order (gdbarch), readbuf, writebuf,
+ 0);
mips_xfer_register (gdbarch, regcache,
- gdbarch_num_regs (gdbarch) + 3,
- 4, gdbarch_byte_order (gdbarch),
- readbuf, writebuf, 4);
+ gdbarch_num_regs (gdbarch) + 3, 4,
+ gdbarch_byte_order (gdbarch), readbuf, writebuf,
+ 4);
}
return RETURN_VALUE_REGISTER_CONVENTION;
}
@@ -5887,20 +5793,19 @@ mips_o32_return_value (struct gdbarch *gdbarch, struct value *function,
the ISA. */
int offset;
int regnum;
- for (offset = 0, regnum = MIPS_V0_REGNUM;
- offset < type->length ();
+ for (offset = 0, regnum = MIPS_V0_REGNUM; offset < type->length ();
offset += MIPS32_REGSIZE, regnum++)
{
int xfer = MIPS32_REGSIZE;
if (offset + xfer > type->length ())
xfer = type->length () - offset;
if (mips_debug)
- gdb_printf (gdb_stderr, "Return scalar+%d:%d in $%d\n",
- offset, xfer, regnum);
+ gdb_printf (gdb_stderr, "Return scalar+%d:%d in $%d\n", offset,
+ xfer, regnum);
mips_xfer_register (gdbarch, regcache,
gdbarch_num_regs (gdbarch) + regnum, xfer,
- gdbarch_byte_order (gdbarch),
- readbuf, writebuf, offset);
+ gdbarch_byte_order (gdbarch), readbuf, writebuf,
+ offset);
}
return RETURN_VALUE_REGISTER_CONVENTION;
}
@@ -5912,9 +5817,9 @@ mips_o32_return_value (struct gdbarch *gdbarch, struct value *function,
static CORE_ADDR
mips_o64_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
struct regcache *regcache, CORE_ADDR bp_addr,
- int nargs,
- struct value **args, CORE_ADDR sp,
- function_call_return_method return_method, CORE_ADDR struct_addr)
+ int nargs, struct value **args, CORE_ADDR sp,
+ function_call_return_method return_method,
+ CORE_ADDR struct_addr)
{
int argreg;
int float_argreg;
@@ -5952,10 +5857,8 @@ mips_o64_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
sp -= align_up (arg_space, 16);
if (mips_debug)
- gdb_printf (gdb_stdlog,
- "mips_o64_push_dummy_call: sp=%s allocated %ld\n",
- paddress (gdbarch, sp),
- (long) align_up (arg_space, 16));
+ gdb_printf (gdb_stdlog, "mips_o64_push_dummy_call: sp=%s allocated %ld\n",
+ paddress (gdbarch, sp), (long) align_up (arg_space, 16));
/* Initialize the integer and float register pointers. */
argreg = MIPS_A0_REGNUM;
@@ -5985,8 +5888,7 @@ mips_o64_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
enum type_code typecode = arg_type->code ();
if (mips_debug)
- gdb_printf (gdb_stdlog,
- "mips_o64_push_dummy_call: %d len=%d type=%d",
+ gdb_printf (gdb_stdlog, "mips_o64_push_dummy_call: %d len=%d type=%d",
argnum + 1, len, (int) typecode);
val = value_contents (arg).data ();
@@ -6006,12 +5908,12 @@ mips_o64_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
{
LONGEST regval = extract_unsigned_integer (val, len, byte_order);
if (mips_debug)
- gdb_printf (gdb_stdlog, " - fpreg=%d val=%s",
- float_argreg, phex (regval, len));
+ gdb_printf (gdb_stdlog, " - fpreg=%d val=%s", float_argreg,
+ phex (regval, len));
regcache_cooked_write_unsigned (regcache, float_argreg++, regval);
if (mips_debug)
- gdb_printf (gdb_stdlog, " - reg=%d val=%s",
- argreg, phex (regval, len));
+ gdb_printf (gdb_stdlog, " - reg=%d val=%s", argreg,
+ phex (regval, len));
regcache_cooked_write_unsigned (regcache, argreg, regval);
argreg++;
/* Reserve space for the FP register. */
@@ -6026,19 +5928,17 @@ mips_o64_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
are treated specially: Irix cc passes them in registers
where gcc sometimes puts them on the stack. For maximum
compatibility, we will put them in both places. */
- int odd_sized_struct = (len > MIPS64_REGSIZE
- && len % MIPS64_REGSIZE != 0);
+ int odd_sized_struct
+ = (len > MIPS64_REGSIZE && len % MIPS64_REGSIZE != 0);
while (len > 0)
{
int partial_len = (len < MIPS64_REGSIZE ? len : MIPS64_REGSIZE);
if (mips_debug)
- gdb_printf (gdb_stdlog, " -- partial=%d",
- partial_len);
+ gdb_printf (gdb_stdlog, " -- partial=%d", partial_len);
/* Write this portion of the argument to the stack. */
- if (argreg > mips_last_arg_regnum (gdbarch)
- || odd_sized_struct)
+ if (argreg > mips_last_arg_regnum (gdbarch) || odd_sized_struct)
{
/* Should shorter than int integer values be
promoted to int before being stored? */
@@ -6070,8 +5970,7 @@ mips_o64_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
paddress (gdbarch, addr));
for (i = 0; i < partial_len; i++)
{
- gdb_printf (gdb_stdlog, "%02x",
- val[i] & 0xff);
+ gdb_printf (gdb_stdlog, "%02x", val[i] & 0xff);
}
}
write_memory (addr, val, partial_len);
@@ -6083,8 +5982,8 @@ mips_o64_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
purpose register. */
if (argreg <= mips_last_arg_regnum (gdbarch))
{
- LONGEST regval = extract_signed_integer (val, partial_len,
- byte_order);
+ LONGEST regval
+ = extract_signed_integer (val, partial_len, byte_order);
/* Value may need to be sign extended, because
mips_isa_regsize() != mips_abi_regsize(). */
@@ -6101,12 +6000,11 @@ mips_o64_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
&& partial_len < MIPS64_REGSIZE
&& (typecode == TYPE_CODE_STRUCT
|| typecode == TYPE_CODE_UNION))
- regval <<= ((MIPS64_REGSIZE - partial_len)
- * TARGET_CHAR_BIT);
+ regval
+ <<= ((MIPS64_REGSIZE - partial_len) * TARGET_CHAR_BIT);
if (mips_debug)
- gdb_printf (gdb_stdlog, " - reg=%d val=%s",
- argreg,
+ gdb_printf (gdb_stdlog, " - reg=%d val=%s", argreg,
phex (regval, MIPS64_REGSIZE));
regcache_cooked_write_unsigned (regcache, argreg, regval);
argreg++;
@@ -6150,8 +6048,7 @@ mips_o64_return_value (struct gdbarch *gdbarch, struct value *function,
enum mips_fval_reg fval_reg;
fval_reg = readbuf ? mips16 ? mips_fval_gpr : mips_fval_fpr : mips_fval_both;
- if (type->code () == TYPE_CODE_STRUCT
- || type->code () == TYPE_CODE_UNION
+ if (type->code () == TYPE_CODE_STRUCT || type->code () == TYPE_CODE_UNION
|| type->code () == TYPE_CODE_ARRAY)
return RETURN_VALUE_STRUCT_CONVENTION;
else if (fp_register_arg_p (gdbarch, type->code (), type))
@@ -6179,14 +6076,11 @@ mips_o64_return_value (struct gdbarch *gdbarch, struct value *function,
mips_xfer_register (gdbarch, regcache,
(gdbarch_num_regs (gdbarch)
+ mips_regnum (gdbarch)->fp0),
- type->length (),
- gdbarch_byte_order (gdbarch),
+ type->length (), gdbarch_byte_order (gdbarch),
readbuf, writebuf, 0);
if (fval_reg != mips_fval_fpr)
- mips_xfer_register (gdbarch, regcache,
- gdbarch_num_regs (gdbarch) + 2,
- type->length (),
- gdbarch_byte_order (gdbarch),
+ mips_xfer_register (gdbarch, regcache, gdbarch_num_regs (gdbarch) + 2,
+ type->length (), gdbarch_byte_order (gdbarch),
readbuf, writebuf, 0);
return RETURN_VALUE_REGISTER_CONVENTION;
}
@@ -6196,20 +6090,19 @@ mips_o64_return_value (struct gdbarch *gdbarch, struct value *function,
justified. */
int offset;
int regnum;
- for (offset = 0, regnum = MIPS_V0_REGNUM;
- offset < type->length ();
+ for (offset = 0, regnum = MIPS_V0_REGNUM; offset < type->length ();
offset += MIPS64_REGSIZE, regnum++)
{
int xfer = MIPS64_REGSIZE;
if (offset + xfer > type->length ())
xfer = type->length () - offset;
if (mips_debug)
- gdb_printf (gdb_stderr, "Return scalar+%d:%d in $%d\n",
- offset, xfer, regnum);
+ gdb_printf (gdb_stderr, "Return scalar+%d:%d in $%d\n", offset,
+ xfer, regnum);
mips_xfer_register (gdbarch, regcache,
- gdbarch_num_regs (gdbarch) + regnum,
- xfer, gdbarch_byte_order (gdbarch),
- readbuf, writebuf, offset);
+ gdbarch_num_regs (gdbarch) + regnum, xfer,
+ gdbarch_byte_order (gdbarch), readbuf, writebuf,
+ offset);
}
return RETURN_VALUE_REGISTER_CONVENTION;
}
@@ -6257,8 +6150,8 @@ mips_read_fp_register_single (frame_info_ptr frame, int regno,
gdb_byte *raw_buffer = (gdb_byte *) alloca (raw_size);
if (!deprecated_frame_register_read (frame, regno, raw_buffer))
- error (_("can't read register %d (%s)"),
- regno, gdbarch_register_name (gdbarch, regno));
+ error (_ ("can't read register %d (%s)"), regno,
+ gdbarch_register_name (gdbarch, regno));
if (raw_size == 8)
{
/* We have a 64-bit value for this register. Find the low-order
@@ -6294,16 +6187,16 @@ mips_read_fp_register_double (frame_info_ptr frame, int regno,
/* We have a 64-bit value for this register, and we should use
all 64 bits. */
if (!deprecated_frame_register_read (frame, regno, rare_buffer))
- error (_("can't read register %d (%s)"),
- regno, gdbarch_register_name (gdbarch, regno));
+ error (_ ("can't read register %d (%s)"), regno,
+ gdbarch_register_name (gdbarch, regno));
}
else
{
int rawnum = regno % gdbarch_num_regs (gdbarch);
if ((rawnum - mips_regnum (gdbarch)->fp0) & 1)
- internal_error (_("mips_read_fp_register_double: bad access to "
- "odd-numbered FP register"));
+ internal_error (_ ("mips_read_fp_register_double: bad access to "
+ "odd-numbered FP register"));
/* mips_read_fp_register_single will find the correct 32 bits from
each register. */
@@ -6321,9 +6214,8 @@ mips_read_fp_register_double (frame_info_ptr frame, int regno,
}
static void
-mips_print_fp_register (struct ui_file *file, frame_info_ptr frame,
- int regnum)
-{ /* Do values for FP (float) regs. */
+mips_print_fp_register (struct ui_file *file, frame_info_ptr frame, int regnum)
+{ /* Do values for FP (float) regs. */
struct gdbarch *gdbarch = get_frame_arch (frame);
gdb_byte *raw_buffer;
std::string flt_str, dbl_str;
@@ -6331,14 +6223,12 @@ mips_print_fp_register (struct ui_file *file, frame_info_ptr frame,
const struct type *flt_type = builtin_type (gdbarch)->builtin_float;
const struct type *dbl_type = builtin_type (gdbarch)->builtin_double;
- raw_buffer
- = ((gdb_byte *)
- alloca (2 * register_size (gdbarch, mips_regnum (gdbarch)->fp0)));
+ raw_buffer = ((gdb_byte *) alloca (
+ 2 * register_size (gdbarch, mips_regnum (gdbarch)->fp0)));
gdb_printf (file, "%s:", gdbarch_register_name (gdbarch, regnum));
gdb_printf (file, "%*s",
- 4 - (int) strlen (gdbarch_register_name (gdbarch, regnum)),
- "");
+ 4 - (int) strlen (gdbarch_register_name (gdbarch, regnum)), "");
if (register_size (gdbarch, regnum) == 4 || mips2_fp_compat (frame))
{
@@ -6351,8 +6241,8 @@ mips_print_fp_register (struct ui_file *file, frame_info_ptr frame,
get_formatted_print_options (&opts, 'x');
print_scalar_formatted (raw_buffer,
- builtin_type (gdbarch)->builtin_uint32,
- &opts, 'w', file);
+ builtin_type (gdbarch)->builtin_uint32, &opts,
+ 'w', file);
gdb_printf (file, " flt: %s", flt_str.c_str ());
@@ -6377,8 +6267,8 @@ mips_print_fp_register (struct ui_file *file, frame_info_ptr frame,
get_formatted_print_options (&opts, 'x');
print_scalar_formatted (raw_buffer,
- builtin_type (gdbarch)->builtin_uint64,
- &opts, 'g', file);
+ builtin_type (gdbarch)->builtin_uint64, &opts,
+ 'g', file);
gdb_printf (file, " flt: %s", flt_str.c_str ());
gdb_printf (file, " dbl: %s", dbl_str.c_str ());
@@ -6386,8 +6276,7 @@ mips_print_fp_register (struct ui_file *file, frame_info_ptr frame,
}
static void
-mips_print_register (struct ui_file *file, frame_info_ptr frame,
- int regnum)
+mips_print_register (struct ui_file *file, frame_info_ptr frame, int regnum)
{
struct gdbarch *gdbarch = get_frame_arch (frame);
struct value_print_options opts;
@@ -6441,7 +6330,7 @@ print_fpu_flags (struct ui_file *file, int flags)
static void
mips_print_float_info (struct gdbarch *gdbarch, struct ui_file *file,
- frame_info_ptr frame, const char *args)
+ frame_info_ptr frame, const char *args)
{
int fcsr = mips_regnum (gdbarch)->fp_control_status;
enum mips_fpu_type type = mips_get_fpu_type (gdbarch);
@@ -6452,9 +6341,9 @@ mips_print_float_info (struct gdbarch *gdbarch, struct ui_file *file,
type = MIPS_FPU_NONE;
gdb_printf (file, "fpu type: %s\n",
- type == MIPS_FPU_DOUBLE ? "double-precision"
+ type == MIPS_FPU_DOUBLE ? "double-precision"
: type == MIPS_FPU_SINGLE ? "single-precision"
- : "none / unused");
+ : "none / unused");
if (type == MIPS_FPU_NONE)
return;
@@ -6480,10 +6369,18 @@ mips_print_float_info (struct gdbarch *gdbarch, struct ui_file *file,
gdb_puts ("rounding: ", file);
switch (fcs & 3)
{
- case 0: gdb_puts ("nearest\n", file); break;
- case 1: gdb_puts ("zero\n", file); break;
- case 2: gdb_puts ("+inf\n", file); break;
- case 3: gdb_puts ("-inf\n", file); break;
+ case 0:
+ gdb_puts ("nearest\n", file);
+ break;
+ case 1:
+ gdb_puts ("zero\n", file);
+ break;
+ case 2:
+ gdb_puts ("+inf\n", file);
+ break;
+ case 3:
+ gdb_puts ("-inf\n", file);
+ break;
}
gdb_puts ("flush :", file);
@@ -6508,8 +6405,7 @@ mips_print_float_info (struct gdbarch *gdbarch, struct ui_file *file,
Print regs in pretty columns. */
static int
-print_fp_register_row (struct ui_file *file, frame_info_ptr frame,
- int regnum)
+print_fp_register_row (struct ui_file *file, frame_info_ptr frame, int regnum)
{
gdb_printf (file, " ");
mips_print_fp_register (file, frame, regnum);
@@ -6517,7 +6413,6 @@ print_fp_register_row (struct ui_file *file, frame_info_ptr frame,
return regnum + 1;
}
-
/* Print a row's worth of GP (int) registers, with name labels above. */
static int
@@ -6528,25 +6423,24 @@ print_gp_register_row (struct ui_file *file, frame_info_ptr frame,
/* Do values for GP (int) regs. */
const gdb_byte *raw_buffer;
struct value *value;
- int ncols = (mips_abi_regsize (gdbarch) == 8 ? 4 : 8); /* display cols
+ int ncols = (mips_abi_regsize (gdbarch) == 8 ? 4 : 8); /* display cols
per row. */
int col, byte;
int regnum;
/* For GP registers, we print a separate row of names above the vals. */
for (col = 0, regnum = start_regnum;
- col < ncols && regnum < gdbarch_num_cooked_regs (gdbarch);
- regnum++)
+ col < ncols && regnum < gdbarch_num_cooked_regs (gdbarch); regnum++)
{
if (*gdbarch_register_name (gdbarch, regnum) == '\0')
- continue; /* unused register */
+ continue; /* unused register */
if (mips_float_register_p (gdbarch, regnum))
- break; /* End the row: reached FP register. */
+ break; /* End the row: reached FP register. */
/* Large registers are handled separately. */
if (register_size (gdbarch, regnum) > mips_abi_regsize (gdbarch))
{
if (col > 0)
- break; /* End the row before this register. */
+ break; /* End the row before this register. */
/* Print this register on a row by itself. */
mips_print_register (file, frame, regnum);
@@ -6555,8 +6449,7 @@ print_gp_register_row (struct ui_file *file, frame_info_ptr frame,
}
if (col == 0)
gdb_printf (file, " ");
- gdb_printf (file,
- mips_abi_regsize (gdbarch) == 8 ? "%17s" : "%9s",
+ gdb_printf (file, mips_abi_regsize (gdbarch) == 8 ? "%17s" : "%9s",
gdbarch_register_name (gdbarch, regnum));
col++;
}
@@ -6566,55 +6459,50 @@ print_gp_register_row (struct ui_file *file, frame_info_ptr frame,
/* Print the R0 to R31 names. */
if ((start_regnum % gdbarch_num_regs (gdbarch)) < MIPS_NUMREGS)
- gdb_printf (file, "\n R%-4d",
- start_regnum % gdbarch_num_regs (gdbarch));
+ gdb_printf (file, "\n R%-4d", start_regnum % gdbarch_num_regs (gdbarch));
else
gdb_printf (file, "\n ");
/* Now print the values in hex, 4 or 8 to the row. */
for (col = 0, regnum = start_regnum;
- col < ncols && regnum < gdbarch_num_cooked_regs (gdbarch);
- regnum++)
+ col < ncols && regnum < gdbarch_num_cooked_regs (gdbarch); regnum++)
{
if (*gdbarch_register_name (gdbarch, regnum) == '\0')
- continue; /* unused register */
+ continue; /* unused register */
if (mips_float_register_p (gdbarch, regnum))
- break; /* End row: reached FP register. */
+ break; /* End row: reached FP register. */
if (register_size (gdbarch, regnum) > mips_abi_regsize (gdbarch))
- break; /* End row: large register. */
+ break; /* End row: large register. */
/* OK: get the data in raw format. */
value = get_frame_register_value (frame, regnum);
- if (value_optimized_out (value)
- || !value_entirely_available (value))
+ if (value_optimized_out (value) || !value_entirely_available (value))
{
- gdb_printf (file, "%*s ",
- (int) mips_abi_regsize (gdbarch) * 2,
+ gdb_printf (file, "%*s ", (int) mips_abi_regsize (gdbarch) * 2,
(mips_abi_regsize (gdbarch) == 4 ? "<unavl>"
- : "<unavailable>"));
+ : "<unavailable>"));
col++;
continue;
}
raw_buffer = value_contents_all (value).data ();
/* pad small registers */
- for (byte = 0;
- byte < (mips_abi_regsize (gdbarch)
- - register_size (gdbarch, regnum)); byte++)
+ for (byte = 0; byte < (mips_abi_regsize (gdbarch)
+ - register_size (gdbarch, regnum));
+ byte++)
gdb_printf (file, " ");
/* Now print the register value in hex, endian order. */
if (gdbarch_byte_order (gdbarch) == BFD_ENDIAN_BIG)
- for (byte =
- register_size (gdbarch, regnum) - register_size (gdbarch, regnum);
+ for (byte = register_size (gdbarch, regnum)
+ - register_size (gdbarch, regnum);
byte < register_size (gdbarch, regnum); byte++)
gdb_printf (file, "%02x", raw_buffer[byte]);
else
- for (byte = register_size (gdbarch, regnum) - 1;
- byte >= 0; byte--)
+ for (byte = register_size (gdbarch, regnum) - 1; byte >= 0; byte--)
gdb_printf (file, "%02x", raw_buffer[byte]);
gdb_printf (file, " ");
col++;
}
- if (col > 0) /* ie. if we actually printed anything... */
+ if (col > 0) /* ie. if we actually printed anything... */
gdb_printf (file, "\n");
return regnum;
@@ -6626,11 +6514,11 @@ static void
mips_print_registers_info (struct gdbarch *gdbarch, struct ui_file *file,
frame_info_ptr frame, int regnum, int all)
{
- if (regnum != -1) /* Do one specified register. */
+ if (regnum != -1) /* Do one specified register. */
{
gdb_assert (regnum >= gdbarch_num_regs (gdbarch));
if (*(gdbarch_register_name (gdbarch, regnum)) == '\0')
- error (_("Not a valid register for the current processor type"));
+ error (_ ("Not a valid register for the current processor type"));
mips_print_register (file, frame, regnum);
gdb_printf (file, "\n");
@@ -6643,10 +6531,10 @@ mips_print_registers_info (struct gdbarch *gdbarch, struct ui_file *file,
{
if (mips_float_register_p (gdbarch, regnum))
{
- if (all) /* True for "INFO ALL-REGISTERS" command. */
+ if (all) /* True for "INFO ALL-REGISTERS" command. */
regnum = print_fp_register_row (file, frame, regnum);
else
- regnum += MIPS_NUMREGS; /* Skip floating point regs. */
+ regnum += MIPS_NUMREGS; /* Skip floating point regs. */
}
else
regnum = print_gp_register_row (file, frame, regnum);
@@ -6655,16 +6543,14 @@ mips_print_registers_info (struct gdbarch *gdbarch, struct ui_file *file,
}
static int
-mips_single_step_through_delay (struct gdbarch *gdbarch,
- frame_info_ptr frame)
+mips_single_step_through_delay (struct gdbarch *gdbarch, frame_info_ptr frame)
{
CORE_ADDR pc = get_frame_pc (frame);
enum mips_isa isa;
ULONGEST insn;
int size;
- if ((mips_pc_is_mips (pc)
- && !mips32_insn_at_pc_has_delay_slot (gdbarch, pc))
+ if ((mips_pc_is_mips (pc) && !mips32_insn_at_pc_has_delay_slot (gdbarch, pc))
|| (mips_pc_is_micromips (gdbarch, pc)
&& !micromips_insn_at_pc_has_delay_slot (gdbarch, pc, 0))
|| (mips_pc_is_mips16 (gdbarch, pc)
@@ -6715,7 +6601,7 @@ mips_skip_prologue (struct gdbarch *gdbarch, CORE_ADDR pc)
that bound, then use an arbitrary large number as the upper bound. */
limit_pc = skip_prologue_using_sal (gdbarch, pc);
if (limit_pc == 0)
- limit_pc = pc + 100; /* Magic. */
+ limit_pc = pc + 100; /* Magic. */
if (mips_pc_is_mips16 (gdbarch, pc))
return mips16_scan_prologue (gdbarch, pc, limit_pc, NULL, NULL);
@@ -6751,10 +6637,10 @@ mips32_stack_frame_destroyed_p (struct gdbarch *gdbarch, CORE_ADDR pc)
inst = mips_fetch_instruction (gdbarch, ISA_MIPS, pc, NULL);
high_word = (inst >> 16) & 0xffff;
- if (high_word != 0x27bd /* addiu $sp,$sp,offset */
- && high_word != 0x67bd /* daddiu $sp,$sp,offset */
- && inst != 0x03e00008 /* jr $ra */
- && inst != 0x00000000) /* nop */
+ if (high_word != 0x27bd /* addiu $sp,$sp,offset */
+ && high_word != 0x67bd /* daddiu $sp,$sp,offset */
+ && inst != 0x03e00008 /* jr $ra */
+ && inst != 0x00000000) /* nop */
return 0;
}
@@ -6800,18 +6686,19 @@ micromips_stack_frame_destroyed_p (struct gdbarch *gdbarch, CORE_ADDR pc)
/* 32-bit instructions. */
case 2 * MIPS_INSN16_SIZE:
insn <<= 16;
- insn |= mips_fetch_instruction (gdbarch,
- ISA_MICROMIPS, pc + loc, NULL);
+ insn
+ |= mips_fetch_instruction (gdbarch, ISA_MICROMIPS, pc + loc, NULL);
loc += MIPS_INSN16_SIZE;
switch (micromips_op (insn >> 16))
{
- case 0xc: /* ADDIU: bits 001100 */
+ case 0xc: /* ADDIU: bits 001100 */
case 0x17: /* DADDIU: bits 010111 */
sreg = b0s5_reg (insn >> 16);
dreg = b5s5_reg (insn >> 16);
offset = (b0s16_imm (insn) ^ 0x8000) - 0x8000;
- if (sreg == MIPS_SP_REGNUM && dreg == MIPS_SP_REGNUM
- /* (D)ADDIU $sp, imm */
+ if (sreg == MIPS_SP_REGNUM
+ && dreg == MIPS_SP_REGNUM
+ /* (D)ADDIU $sp, imm */
&& offset >= 0)
break;
return 0;
@@ -6829,24 +6716,24 @@ micromips_stack_frame_destroyed_p (struct gdbarch *gdbarch, CORE_ADDR pc)
sreg = b0s5_reg (insn);
dreg = b5s5_reg (insn);
if (sreg == 0 && dreg == 0)
- /* MOVE $zero, $zero aka NOP */
+ /* MOVE $zero, $zero aka NOP */
break;
return 0;
case 0x11: /* POOL16C: bits 010001 */
if (b5s5_op (insn) == 0x18
- /* JRADDIUSP: bits 010011 11000 */
+ /* JRADDIUSP: bits 010011 11000 */
|| (b5s5_op (insn) == 0xd
- /* JRC: bits 010011 01101 */
+ /* JRC: bits 010011 01101 */
&& b0s5_reg (insn) == MIPS_RA_REGNUM))
- /* JRC $ra */
+ /* JRC $ra */
break;
return 0;
case 0x13: /* POOL16D: bits 010011 */
offset = micromips_decode_imm9 (b1s9_imm (insn));
if ((insn & 0x1) == 0x1
- /* ADDIUSP: bits 010011 1 */
+ /* ADDIUSP: bits 010011 1 */
&& offset > 0)
break;
return 0;
@@ -6884,14 +6771,14 @@ mips16_stack_frame_destroyed_p (struct gdbarch *gdbarch, CORE_ADDR pc)
inst = mips_fetch_instruction (gdbarch, ISA_MIPS16, pc, NULL);
- if ((inst & 0xf800) == 0xf000) /* extend */
+ if ((inst & 0xf800) == 0xf000) /* extend */
continue;
- if (inst != 0x6300 /* addiu $sp,offset */
- && inst != 0xfb00 /* daddiu $sp,$sp,offset */
- && inst != 0xe820 /* jr $ra */
- && inst != 0xe8a0 /* jrc $ra */
- && inst != 0x6500) /* nop */
+ if (inst != 0x6300 /* addiu $sp,offset */
+ && inst != 0xfb00 /* daddiu $sp,$sp,offset */
+ && inst != 0xe820 /* jr $ra */
+ && inst != 0xe8a0 /* jrc $ra */
+ && inst != 0x6500) /* nop */
return 0;
}
@@ -6926,9 +6813,8 @@ show_mipsfpu_command (const char *args, int from_tty)
if (gdbarch_bfd_arch_info (target_gdbarch ())->arch != bfd_arch_mips)
{
- gdb_printf
- ("The MIPS floating-point coprocessor is unknown "
- "because the current architecture is not MIPS.\n");
+ gdb_printf ("The MIPS floating-point coprocessor is unknown "
+ "because the current architecture is not MIPS.\n");
return;
}
@@ -6944,18 +6830,17 @@ show_mipsfpu_command (const char *args, int from_tty)
fpu = "absent (none)";
break;
default:
- internal_error (_("bad switch"));
+ internal_error (_ ("bad switch"));
}
if (mips_fpu_type_auto)
gdb_printf ("The MIPS floating-point coprocessor "
"is set automatically (currently %s)\n",
fpu);
else
- gdb_printf
- ("The MIPS floating-point coprocessor is assumed to be %s\n", fpu);
+ gdb_printf ("The MIPS floating-point coprocessor is assumed to be %s\n",
+ fpu);
}
-
static void
set_mipsfpu_single_command (const char *args, int from_tty)
{
@@ -6966,7 +6851,7 @@ set_mipsfpu_single_command (const char *args, int from_tty)
instead of relying on globals. Doing that would let generic code
handle the search for this specific architecture. */
if (!gdbarch_update_p (info))
- internal_error (_("set mipsfpu failed"));
+ internal_error (_ ("set mipsfpu failed"));
}
static void
@@ -6979,7 +6864,7 @@ set_mipsfpu_double_command (const char *args, int from_tty)
instead of relying on globals. Doing that would let generic code
handle the search for this specific architecture. */
if (!gdbarch_update_p (info))
- internal_error (_("set mipsfpu failed"));
+ internal_error (_ ("set mipsfpu failed"));
}
static void
@@ -6992,7 +6877,7 @@ set_mipsfpu_none_command (const char *args, int from_tty)
instead of relying on globals. Doing that would let generic code
handle the search for this specific architecture. */
if (!gdbarch_update_p (info))
- internal_error (_("set mipsfpu failed"));
+ internal_error (_ ("set mipsfpu failed"));
}
static void
@@ -7028,8 +6913,10 @@ gdb_print_insn_mips (bfd_vma memaddr, struct disassemble_info *info)
info->mach = bfd_mach_mips_micromips;
/* Round down the instruction address to the appropriate boundary. */
- memaddr &= (info->mach == bfd_mach_mips16
- || info->mach == bfd_mach_mips_micromips) ? ~1 : ~3;
+ memaddr
+ &= (info->mach == bfd_mach_mips16 || info->mach == bfd_mach_mips_micromips)
+ ? ~1
+ : ~3;
return default_print_insn (memaddr, info);
}
@@ -7137,35 +7024,35 @@ mips32_instruction_has_delay_slot (struct gdbarch *gdbarch, ULONGEST inst)
{
rs = itype_rs (inst);
rt = itype_rt (inst);
- return (is_octeon_bbit_op (op, gdbarch)
- || op >> 2 == 5 /* BEQL, BNEL, BLEZL, BGTZL: bits 0101xx */
- || op == 29 /* JALX: bits 011101 */
+ return (is_octeon_bbit_op (op, gdbarch)
+ || op >> 2 == 5 /* BEQL, BNEL, BLEZL, BGTZL: bits 0101xx */
+ || op == 29 /* JALX: bits 011101 */
|| (op == 17
&& (rs == 8
- /* BC1F, BC1FL, BC1T, BC1TL: 010001 01000 */
+ /* BC1F, BC1FL, BC1T, BC1TL: 010001 01000 */
|| (rs == 9 && (rt & 0x2) == 0)
- /* BC1ANY2F, BC1ANY2T: bits 010001 01001 */
+ /* BC1ANY2F, BC1ANY2T: bits 010001 01001 */
|| (rs == 10 && (rt & 0x2) == 0))));
- /* BC1ANY4F, BC1ANY4T: bits 010001 01010 */
+ /* BC1ANY4F, BC1ANY4T: bits 010001 01010 */
}
else
- switch (op & 0x07) /* extract bits 28,27,26 */
+ switch (op & 0x07) /* extract bits 28,27,26 */
{
- case 0: /* SPECIAL */
+ case 0: /* SPECIAL */
op = rtype_funct (inst);
- return (op == 8 /* JR */
- || op == 9); /* JALR */
- break; /* end SPECIAL */
- case 1: /* REGIMM */
+ return (op == 8 /* JR */
+ || op == 9); /* JALR */
+ break; /* end SPECIAL */
+ case 1: /* REGIMM */
rs = itype_rs (inst);
- rt = itype_rt (inst); /* branch condition */
+ rt = itype_rt (inst); /* branch condition */
return ((rt & 0xc) == 0
- /* BLTZ, BLTZL, BGEZ, BGEZL: bits 000xx */
- /* BLTZAL, BLTZALL, BGEZAL, BGEZALL: 100xx */
+ /* BLTZ, BLTZL, BGEZ, BGEZL: bits 000xx */
+ /* BLTZAL, BLTZALL, BGEZAL, BGEZALL: 100xx */
|| ((rt & 0x1e) == 0x1c && rs == 0));
- /* BPOSGE32, BPOSGE64: bits 1110x */
- break; /* end REGIMM */
- default: /* J, JAL, BEQ, BNE, BLEZ, BGTZ */
+ /* BPOSGE32, BPOSGE64: bits 1110x */
+ break; /* end REGIMM */
+ default: /* J, JAL, BEQ, BNE, BLEZ, BGTZ */
return 1;
break;
}
@@ -7201,48 +7088,45 @@ micromips_instruction_has_delay_slot (ULONGEST insn, int mustbe32)
switch (micromips_op (major))
{
/* 16-bit instructions. */
- case 0x33: /* B16: bits 110011 */
- case 0x2b: /* BNEZ16: bits 101011 */
- case 0x23: /* BEQZ16: bits 100011 */
+ case 0x33: /* B16: bits 110011 */
+ case 0x2b: /* BNEZ16: bits 101011 */
+ case 0x23: /* BEQZ16: bits 100011 */
return !mustbe32;
- case 0x11: /* POOL16C: bits 010001 */
+ case 0x11: /* POOL16C: bits 010001 */
return (!mustbe32
&& ((b5s5_op (major) == 0xc
- /* JR16: bits 010001 01100 */
- || (b5s5_op (major) & 0x1e) == 0xe)));
- /* JALR16, JALRS16: bits 010001 0111x */
+ /* JR16: bits 010001 01100 */
+ || (b5s5_op (major) & 0x1e) == 0xe)));
+ /* JALR16, JALRS16: bits 010001 0111x */
/* 32-bit instructions. */
- case 0x3d: /* JAL: bits 111101 */
- case 0x3c: /* JALX: bits 111100 */
- case 0x35: /* J: bits 110101 */
- case 0x2d: /* BNE: bits 101101 */
- case 0x25: /* BEQ: bits 100101 */
- case 0x1d: /* JALS: bits 011101 */
+ case 0x3d: /* JAL: bits 111101 */
+ case 0x3c: /* JALX: bits 111100 */
+ case 0x35: /* J: bits 110101 */
+ case 0x2d: /* BNE: bits 101101 */
+ case 0x25: /* BEQ: bits 100101 */
+ case 0x1d: /* JALS: bits 011101 */
return 1;
- case 0x10: /* POOL32I: bits 010000 */
+ case 0x10: /* POOL32I: bits 010000 */
return ((b5s5_op (major) & 0x1c) == 0x0
- /* BLTZ, BLTZAL, BGEZ, BGEZAL: 010000 000xx */
+ /* BLTZ, BLTZAL, BGEZ, BGEZAL: 010000 000xx */
|| (b5s5_op (major) & 0x1d) == 0x4
- /* BLEZ, BGTZ: bits 010000 001x0 */
+ /* BLEZ, BGTZ: bits 010000 001x0 */
|| (b5s5_op (major) & 0x1d) == 0x11
- /* BLTZALS, BGEZALS: bits 010000 100x1 */
- || ((b5s5_op (major) & 0x1e) == 0x14
- && (major & 0x3) == 0x0)
- /* BC2F, BC2T: bits 010000 1010x xxx00 */
+ /* BLTZALS, BGEZALS: bits 010000 100x1 */
+ || ((b5s5_op (major) & 0x1e) == 0x14 && (major & 0x3) == 0x0)
+ /* BC2F, BC2T: bits 010000 1010x xxx00 */
|| (b5s5_op (major) & 0x1e) == 0x1a
- /* BPOSGE64, BPOSGE32: bits 010000 1101x */
- || ((b5s5_op (major) & 0x1e) == 0x1c
- && (major & 0x3) == 0x0)
- /* BC1F, BC1T: bits 010000 1110x xxx00 */
- || ((b5s5_op (major) & 0x1c) == 0x1c
- && (major & 0x3) == 0x1));
- /* BC1ANY*: bits 010000 111xx xxx01 */
- case 0x0: /* POOL32A: bits 000000 */
+ /* BPOSGE64, BPOSGE32: bits 010000 1101x */
+ || ((b5s5_op (major) & 0x1e) == 0x1c && (major & 0x3) == 0x0)
+ /* BC1F, BC1T: bits 010000 1110x xxx00 */
+ || ((b5s5_op (major) & 0x1c) == 0x1c && (major & 0x3) == 0x1));
+ /* BC1ANY*: bits 010000 111xx xxx01 */
+ case 0x0: /* POOL32A: bits 000000 */
return (b0s6_op (insn) == 0x3c
- /* POOL32Axf: bits 000000 ... 111100 */
+ /* POOL32Axf: bits 000000 ... 111100 */
&& (b6s10_ext (insn) & 0x2bf) == 0x3c);
- /* JALR, JALR.HB: 000000 000x111100 111100 */
- /* JALRS, JALRS.HB: 000000 010x111100 111100 */
+ /* JALR, JALR.HB: 000000 000x111100 111100 */
+ /* JALRS, JALRS.HB: 000000 010x111100 111100 */
default:
return 0;
}
@@ -7253,8 +7137,8 @@ micromips_instruction_has_delay_slot (ULONGEST insn, int mustbe32)
must be 32-bit if MUSTBE32 is set or can be any instruction otherwise. */
static int
-micromips_insn_at_pc_has_delay_slot (struct gdbarch *gdbarch,
- CORE_ADDR addr, int mustbe32)
+micromips_insn_at_pc_has_delay_slot (struct gdbarch *gdbarch, CORE_ADDR addr,
+ int mustbe32)
{
ULONGEST insn;
int status;
@@ -7283,9 +7167,9 @@ micromips_insn_at_pc_has_delay_slot (struct gdbarch *gdbarch,
static int
mips16_instruction_has_delay_slot (unsigned short inst, int mustbe32)
{
- if ((inst & 0xf89f) == 0xe800) /* JR/JALR (16-bit instruction) */
+ if ((inst & 0xf89f) == 0xe800) /* JR/JALR (16-bit instruction) */
return !mustbe32;
- return (inst & 0xf800) == 0x1800; /* JAL/JALX (32-bit instruction) */
+ return (inst & 0xf800) == 0x1800; /* JAL/JALX (32-bit instruction) */
}
/* Return non-zero if a MIPS16 instruction at ADDR has a branch delay
@@ -7293,8 +7177,8 @@ mips16_instruction_has_delay_slot (unsigned short inst, int mustbe32)
must be 32-bit if MUSTBE32 is set or can be any instruction otherwise. */
static int
-mips16_insn_at_pc_has_delay_slot (struct gdbarch *gdbarch,
- CORE_ADDR addr, int mustbe32)
+mips16_insn_at_pc_has_delay_slot (struct gdbarch *gdbarch, CORE_ADDR addr,
+ int mustbe32)
{
unsigned short insn;
int status;
@@ -7323,21 +7207,21 @@ mips_segment_boundary (CORE_ADDR bpaddr)
{
case 3:
if (bpaddr == (bfd_signed_vma) (int32_t) bpaddr)
- segsize = 29; /* 32-bit compatibility segment */
+ segsize = 29; /* 32-bit compatibility segment */
else
- segsize = 62; /* xkseg */
+ segsize = 62; /* xkseg */
break;
- case 2: /* xkphys */
+ case 2: /* xkphys */
segsize = 59;
break;
- default: /* xksseg (1), xkuseg/kuseg (0) */
+ default: /* xksseg (1), xkuseg/kuseg (0) */
segsize = 62;
break;
}
- else if (bpaddr & 0x80000000) /* kernel segment */
+ else if (bpaddr & 0x80000000) /* kernel segment */
segsize = 29;
else
- segsize = 31; /* user segment */
+ segsize = 31; /* user segment */
mask <<= segsize;
return bpaddr & mask;
}
@@ -7417,8 +7301,8 @@ mips_adjust_breakpoint_address (struct gdbarch *gdbarch, CORE_ADDR bpaddr)
FIXME: We have to assume that bpaddr is not the second half
of an extended instruction. */
insn_at_pc_has_delay_slot = (mips_pc_is_micromips (gdbarch, bpaddr)
- ? micromips_insn_at_pc_has_delay_slot
- : mips16_insn_at_pc_has_delay_slot);
+ ? micromips_insn_at_pc_has_delay_slot
+ : mips16_insn_at_pc_has_delay_slot);
jmpaddr = 0;
addr = bpaddr;
@@ -7483,19 +7367,19 @@ static int
mips_is_stub_suffix (const char *suffix, int zero)
{
switch (suffix[0])
- {
- case '0':
- return zero && suffix[1] == '\0';
- case '1':
- return suffix[1] == '\0' || (suffix[1] == '0' && suffix[2] == '\0');
- case '2':
- case '5':
- case '6':
- case '9':
- return suffix[1] == '\0';
- default:
- return 0;
- }
+ {
+ case '0':
+ return zero && suffix[1] == '\0';
+ case '1':
+ return suffix[1] == '\0' || (suffix[1] == '0' && suffix[2] == '\0');
+ case '2':
+ case '5':
+ case '6':
+ case '9':
+ return suffix[1] == '\0';
+ default:
+ return 0;
+ }
}
/* Return non-zero if MODE is one of the mode infixes used for MIPS16
@@ -7573,8 +7457,7 @@ mips_get_mips16_fn_stub_pc (frame_info_ptr frame, CORE_ADDR pc)
int status = 0;
int i;
- for (i = 0;
- status == 0 && target_pc == 0 && i < 20;
+ for (i = 0; status == 0 && target_pc == 0 && i < 20;
i++, pc += MIPS_INSN32_SIZE)
{
ULONGEST inst = mips_fetch_instruction (gdbarch, ISA_MIPS, pc, NULL);
@@ -7585,19 +7468,19 @@ mips_get_mips16_fn_stub_pc (frame_info_ptr frame, CORE_ADDR pc)
switch (itype_op (inst))
{
- case 0: /* SPECIAL */
+ case 0: /* SPECIAL */
switch (rtype_funct (inst))
{
- case 8: /* JR */
- case 9: /* JALR */
+ case 8: /* JR */
+ case 9: /* JALR */
rs = rtype_rs (inst);
if (rs == MIPS_GP_REGNUM)
- target_pc = gp; /* Hmm... */
+ target_pc = gp; /* Hmm... */
else if (rs == addrreg)
target_pc = addr;
break;
- case 0x21: /* ADDU */
+ case 0x21: /* ADDU */
rt = rtype_rt (inst);
rs = rtype_rs (inst);
rd = rtype_rd (inst);
@@ -7609,13 +7492,13 @@ mips_get_mips16_fn_stub_pc (frame_info_ptr frame, CORE_ADDR pc)
}
break;
- case 2: /* J */
- case 3: /* JAL */
+ case 2: /* J */
+ case 3: /* JAL */
target_pc = jtype_target (inst) << 2;
target_pc += ((pc + 4) & ~(CORE_ADDR) 0x0fffffff);
break;
- case 9: /* ADDIU */
+ case 9: /* ADDIU */
rt = itype_rt (inst);
rs = itype_rs (inst);
if (rt == rs)
@@ -7628,7 +7511,7 @@ mips_get_mips16_fn_stub_pc (frame_info_ptr frame, CORE_ADDR pc)
}
break;
- case 0xf: /* LUI */
+ case 0xf: /* LUI */
rt = itype_rt (inst);
imm = ((itype_immediate (inst) ^ 0x8000) - 0x8000) << 16;
if (rt == MIPS_GP_REGNUM)
@@ -7640,7 +7523,7 @@ mips_get_mips16_fn_stub_pc (frame_info_ptr frame, CORE_ADDR pc)
}
break;
- case 0x23: /* LW */
+ case 0x23: /* LW */
rt = itype_rt (inst);
rs = itype_rs (inst);
imm = (itype_immediate (inst) ^ 0x8000) - 0x8000;
@@ -7699,10 +7582,9 @@ mips_skip_mips16_trampoline_code (frame_info_ptr frame, CORE_ADDR pc)
and the target PC is in $31 ($ra). */
prefixlen = strlen (mips_str_mips16_ret_stub);
if (strncmp (name, mips_str_mips16_ret_stub, prefixlen) == 0
- && mips_is_stub_mode (name + prefixlen)
- && name[prefixlen + 2] == '\0')
- return get_frame_register_signed
- (frame, gdbarch_num_regs (gdbarch) + MIPS_RA_REGNUM);
+ && mips_is_stub_mode (name + prefixlen) && name[prefixlen + 2] == '\0')
+ return get_frame_register_signed (frame, gdbarch_num_regs (gdbarch)
+ + MIPS_RA_REGNUM);
/* If the PC is in __mips16_call_stub_*, this is one of the call
call/return stubs. */
@@ -7712,8 +7594,8 @@ mips_skip_mips16_trampoline_code (frame_info_ptr frame, CORE_ADDR pc)
/* If the PC is in __mips16_call_stub_{1..10}, this is a call stub
and the target PC is in $2. */
if (mips_is_stub_suffix (name + prefixlen, 0))
- return get_frame_register_signed
- (frame, gdbarch_num_regs (gdbarch) + MIPS_V0_REGNUM);
+ return get_frame_register_signed (frame, gdbarch_num_regs (gdbarch)
+ + MIPS_V0_REGNUM);
/* If the PC at the start of __mips16_call_stub_{s,d}{f,c}_{0..10},
i.e. before the JALR instruction, this is effectively a call stub
@@ -7726,16 +7608,16 @@ mips_skip_mips16_trampoline_code (frame_info_ptr frame, CORE_ADDR pc)
if (pc == start_addr)
/* This is the 'call' part of a call stub. The return
address is in $2. */
- return get_frame_register_signed
- (frame, gdbarch_num_regs (gdbarch) + MIPS_V0_REGNUM);
+ return get_frame_register_signed (frame, gdbarch_num_regs (gdbarch)
+ + MIPS_V0_REGNUM);
else
/* This is the 'return' part of a call stub. The return
address is in $18. */
- return get_frame_register_signed
- (frame, gdbarch_num_regs (gdbarch) + MIPS_S2_REGNUM);
+ return get_frame_register_signed (frame, gdbarch_num_regs (gdbarch)
+ + MIPS_S2_REGNUM);
}
else
- return 0; /* Not a stub. */
+ return 0; /* Not a stub. */
}
/* If the PC is in __call_stub_* or __fn_stub*, this is one of the
@@ -7751,11 +7633,11 @@ mips_skip_mips16_trampoline_code (frame_info_ptr frame, CORE_ADDR pc)
else
/* This is the 'return' part of a call stub. The return address
is in $18. */
- return get_frame_register_signed
- (frame, gdbarch_num_regs (gdbarch) + MIPS_S2_REGNUM);
+ return get_frame_register_signed (frame, gdbarch_num_regs (gdbarch)
+ + MIPS_S2_REGNUM);
}
- return 0; /* Not a stub. */
+ return 0; /* Not a stub. */
}
/* Return non-zero if the PC is inside a return thunk (aka stub or trampoline).
@@ -7777,8 +7659,7 @@ mips_in_return_stub (struct gdbarch *gdbarch, CORE_ADDR pc, const char *name)
prefixlen = strlen (mips_str_mips16_call_stub);
if (pc != start_addr
&& strncmp (name, mips_str_mips16_call_stub, prefixlen) == 0
- && mips_is_stub_mode (name + prefixlen)
- && name[prefixlen + 2] == '_'
+ && mips_is_stub_mode (name + prefixlen) && name[prefixlen + 2] == '_'
&& mips_is_stub_suffix (name + prefixlen + 3, 1))
return 1;
@@ -7800,11 +7681,10 @@ mips_in_return_stub (struct gdbarch *gdbarch, CORE_ADDR pc, const char *name)
/* If the PC is in __mips16_ret_{d,s}{f,c}, this is a return stub. */
prefixlen = strlen (mips_str_mips16_ret_stub);
if (strncmp (name, mips_str_mips16_ret_stub, prefixlen) == 0
- && mips_is_stub_mode (name + prefixlen)
- && name[prefixlen + 2] == '\0')
+ && mips_is_stub_mode (name + prefixlen) && name[prefixlen + 2] == '\0')
return 1;
- return 0; /* Not a stub. */
+ return 0; /* Not a stub. */
}
/* If the current PC is the start of a non-PIC-to-PIC stub, return the
@@ -7825,8 +7705,7 @@ mips_skip_pic_trampoline_code (frame_info_ptr frame, CORE_ADDR pc)
instructions inserted before foo or a three instruction sequence
which jumps to foo. */
msym = lookup_minimal_symbol_by_pc (pc);
- if (msym.minsym == NULL
- || msym.value_address () != pc
+ if (msym.minsym == NULL || msym.value_address () != pc
|| msym.minsym->linkage_name () == NULL
|| !startswith (msym.minsym->linkage_name (), ".pic."))
return 0;
@@ -7841,8 +7720,8 @@ mips_skip_pic_trampoline_code (frame_info_ptr frame, CORE_ADDR pc)
if (target_read_memory (pc, stub_code, 16) != 0)
return 0;
for (i = 0; i < 4; i++)
- stub_words[i] = extract_unsigned_integer (stub_code + i * 4,
- 4, byte_order);
+ stub_words[i]
+ = extract_unsigned_integer (stub_code + i * 4, 4, byte_order);
/* A stub contains these instructions:
lui t9, %hi(target)
@@ -7857,7 +7736,9 @@ mips_skip_pic_trampoline_code (frame_info_ptr frame, CORE_ADDR pc)
&& (stub_words[2] & 0xffff0000U) == 0x27390000
&& stub_words[3] == 0x00000000)
return ((((stub_words[0] & 0x0000ffff) << 16)
- + (stub_words[2] & 0x0000ffff)) ^ 0x8000) - 0x8000;
+ + (stub_words[2] & 0x0000ffff))
+ ^ 0x8000)
+ - 0x8000;
}
/* Not a recognized stub. */
@@ -7914,7 +7795,6 @@ mips_stab_reg_to_regnum (struct gdbarch *gdbarch, int num)
return gdbarch_num_regs (gdbarch) + regnum;
}
-
/* Convert a dwarf, dwarf2, or ecoff register number to a GDB [1 *
gdbarch_num_regs .. 2 * gdbarch_num_regs) REGNUM. */
@@ -7945,20 +7825,19 @@ mips_register_sim_regno (struct gdbarch *gdbarch, int regnum)
/* FIXME: cagney/2002-05-13: Need to look at the pseudo register to
decide if it is valid. Should instead define a standard sim/gdb
register numbering scheme. */
- if (gdbarch_register_name (gdbarch,
- gdbarch_num_regs (gdbarch) + regnum)[0] != '\0')
+ if (gdbarch_register_name (gdbarch, gdbarch_num_regs (gdbarch) + regnum)[0]
+ != '\0')
return regnum;
else
return LEGACY_SIM_REGNO_IGNORE;
}
-
/* Convert an integer into an address. Extracting the value signed
guarantees a correctly sign extended address. */
static CORE_ADDR
-mips_integer_to_address (struct gdbarch *gdbarch,
- struct type *type, const gdb_byte *buf)
+mips_integer_to_address (struct gdbarch *gdbarch, struct type *type,
+ const gdb_byte *buf)
{
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
return extract_signed_integer (buf, type->length (), byte_order);
@@ -7970,8 +7849,8 @@ mips_integer_to_address (struct gdbarch *gdbarch,
an assertion failure. */
static void
-mips_virtual_frame_pointer (struct gdbarch *gdbarch,
- CORE_ADDR pc, int *reg, LONGEST *offset)
+mips_virtual_frame_pointer (struct gdbarch *gdbarch, CORE_ADDR pc, int *reg,
+ LONGEST *offset)
{
*reg = MIPS_SP_REGNUM;
*offset = 0;
@@ -8002,7 +7881,7 @@ mips_find_abi_section (bfd *abfd, asection *sect, void *obj)
else if (strcmp (name, ".mdebug.eabi64") == 0)
*abip = MIPS_ABI_EABI64;
else
- warning (_("unsupported ABI %s."), name + 8);
+ warning (_ ("unsupported ABI %s."), name + 8);
}
static void
@@ -8016,7 +7895,7 @@ mips_find_long_section (bfd *abfd, asection *sect, void *obj)
else if (startswith (name, ".gcc_compiled_long64"))
*lbp = 64;
else if (startswith (name, ".gcc_compiled_long"))
- warning (_("unrecognized .gcc_compiled_longXX"));
+ warning (_ ("unrecognized .gcc_compiled_longXX"));
}
static enum mips_abi
@@ -8028,7 +7907,7 @@ global_mips_abi (void)
if (mips_abi_strings[i] == mips_abi_string)
return (enum mips_abi) i;
- internal_error (_("unknown ABI string"));
+ internal_error (_ ("unknown ABI string"));
}
/* Return the default compressed instruction set, either of MIPS16
@@ -8045,7 +7924,7 @@ global_mips_compression (void)
if (mips_compression_strings[i] == mips_compression_string)
return (enum mips_isa) i;
- internal_error (_("unknown compressed ISA string"));
+ internal_error (_ ("unknown compressed ISA string"));
}
static void
@@ -8081,7 +7960,7 @@ mips_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
enum mips_fpu_type fpu_type;
tdesc_arch_data_up tdesc_data;
int elf_fpu_type = Val_GNU_MIPS_ABI_FP_ANY;
- const char * const *reg_names;
+ const char *const *reg_names;
struct mips_regnum mips_regnum, *regnum;
enum mips_isa mips_isa;
int dspacc;
@@ -8099,8 +7978,8 @@ mips_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
else
elf_flags = 0;
if (gdbarch_debug)
- gdb_printf (gdb_stdlog,
- "mips_gdbarch_init: elf_flags = 0x%08x\n", elf_flags);
+ gdb_printf (gdb_stdlog, "mips_gdbarch_init: elf_flags = 0x%08x\n",
+ elf_flags);
/* Check ELF_FLAGS to see if it specifies the ABI being used. */
switch ((elf_flags & EF_MIPS_ABI))
@@ -8139,8 +8018,7 @@ mips_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
}
/* Try the architecture for any hint of the correct ABI. */
- if (found_abi == MIPS_ABI_UNKNOWN
- && info.bfd_arch_info != NULL
+ if (found_abi == MIPS_ABI_UNKNOWN && info.bfd_arch_info != NULL
&& info.bfd_arch_info->arch == bfd_arch_mips)
{
switch (info.bfd_arch_info->mach)
@@ -8168,15 +8046,13 @@ mips_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
}
/* Default 64-bit objects to N64 instead of O32. */
- if (found_abi == MIPS_ABI_UNKNOWN
- && info.abfd != NULL
+ if (found_abi == MIPS_ABI_UNKNOWN && info.abfd != NULL
&& bfd_get_flavour (info.abfd) == bfd_target_elf_flavour
&& elf_elfheader (info.abfd)->e_ident[EI_CLASS] == ELFCLASS64)
found_abi = MIPS_ABI_N64;
if (gdbarch_debug)
- gdb_printf (gdb_stdlog, "mips_gdbarch_init: found_abi = %d\n",
- found_abi);
+ gdb_printf (gdb_stdlog, "mips_gdbarch_init: found_abi = %d\n", found_abi);
/* What has the user specified from the command line? */
wanted_abi = global_mips_abi ();
@@ -8193,12 +8069,10 @@ mips_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
else
mips_abi = MIPS_ABI_O32;
if (gdbarch_debug)
- gdb_printf (gdb_stdlog, "mips_gdbarch_init: mips_abi = %d\n",
- mips_abi);
+ gdb_printf (gdb_stdlog, "mips_gdbarch_init: mips_abi = %d\n", mips_abi);
/* Make sure we don't use a 32-bit architecture with a 64-bit ABI. */
- if (mips_abi != MIPS_ABI_EABI32
- && mips_abi != MIPS_ABI_O32
+ if (mips_abi != MIPS_ABI_EABI32 && mips_abi != MIPS_ABI_O32
&& info.bfd_arch_info != NULL
&& info.bfd_arch_info->arch == bfd_arch_mips
&& info.bfd_arch_info->bits_per_word < 64)
@@ -8222,10 +8096,9 @@ mips_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
"mips64_transfers_32bit_regs_p = %d\n",
mips64_transfers_32bit_regs_p);
- /* Determine the MIPS FPU type. */
+ /* Determine the MIPS FPU type. */
#ifdef HAVE_ELF
- if (info.abfd
- && bfd_get_flavour (info.abfd) == bfd_target_elf_flavour)
+ if (info.abfd && bfd_get_flavour (info.abfd) == bfd_target_elf_flavour)
elf_fpu_type = bfd_elf_get_obj_attr_int (info.abfd, OBJ_ATTR_GNU,
Tag_GNU_MIPS_ABI_FP);
#endif /* HAVE_ELF */
@@ -8271,8 +8144,7 @@ mips_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
else
fpu_type = MIPS_FPU_DOUBLE;
if (gdbarch_debug)
- gdb_printf (gdb_stdlog,
- "mips_gdbarch_init: fpu_type = %d\n", fpu_type);
+ gdb_printf (gdb_stdlog, "mips_gdbarch_init: fpu_type = %d\n", fpu_type);
/* Check for blatant incompatibilities. */
@@ -8280,8 +8152,7 @@ mips_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
ABI. */
if (info.target_desc
&& tdesc_property (info.target_desc, PROPERTY_GP32) != NULL
- && mips_abi != MIPS_ABI_EABI32
- && mips_abi != MIPS_ABI_O32)
+ && mips_abi != MIPS_ABI_EABI32 && mips_abi != MIPS_ABI_O32)
return NULL;
/* Fill in the OS dependent register numbers and names. */
@@ -8325,15 +8196,14 @@ mips_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
/* Check any target description for validity. */
if (tdesc_has_registers (info.target_desc))
{
- static const char *const mips_gprs[] = {
- "r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7",
- "r8", "r9", "r10", "r11", "r12", "r13", "r14", "r15",
- "r16", "r17", "r18", "r19", "r20", "r21", "r22", "r23",
- "r24", "r25", "r26", "r27", "r28", "r29", "r30", "r31"
- };
+ static const char *const mips_gprs[]
+ = { "r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7",
+ "r8", "r9", "r10", "r11", "r12", "r13", "r14", "r15",
+ "r16", "r17", "r18", "r19", "r20", "r21", "r22", "r23",
+ "r24", "r25", "r26", "r27", "r28", "r29", "r30", "r31" };
static const char *const mips_fprs[] = {
- "f0", "f1", "f2", "f3", "f4", "f5", "f6", "f7",
- "f8", "f9", "f10", "f11", "f12", "f13", "f14", "f15",
+ "f0", "f1", "f2", "f3", "f4", "f5", "f6", "f7",
+ "f8", "f9", "f10", "f11", "f12", "f13", "f14", "f15",
"f16", "f17", "f18", "f19", "f20", "f21", "f22", "f23",
"f24", "f25", "f26", "f27", "f28", "f29", "f30", "f31",
};
@@ -8341,8 +8211,7 @@ mips_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
const struct tdesc_feature *feature;
int valid_p;
- feature = tdesc_find_feature (info.target_desc,
- "org.gnu.gdb.mips.cpu");
+ feature = tdesc_find_feature (info.target_desc, "org.gnu.gdb.mips.cpu");
if (feature == NULL)
return NULL;
@@ -8353,7 +8222,6 @@ mips_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
valid_p &= tdesc_numbered_register (feature, tdesc_data.get (), i,
mips_gprs[i]);
-
valid_p &= tdesc_numbered_register (feature, tdesc_data.get (),
mips_regnum.lo, "lo");
valid_p &= tdesc_numbered_register (feature, tdesc_data.get (),
@@ -8364,8 +8232,7 @@ mips_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
if (!valid_p)
return NULL;
- feature = tdesc_find_feature (info.target_desc,
- "org.gnu.gdb.mips.cp0");
+ feature = tdesc_find_feature (info.target_desc, "org.gnu.gdb.mips.cp0");
if (feature == NULL)
return NULL;
@@ -8382,8 +8249,7 @@ mips_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
/* FIXME drow/2007-05-17: The FPU should be optional. The MIPS
backend is not prepared for that, though. */
- feature = tdesc_find_feature (info.target_desc,
- "org.gnu.gdb.mips.fpu");
+ feature = tdesc_find_feature (info.target_desc, "org.gnu.gdb.mips.fpu");
if (feature == NULL)
return NULL;
@@ -8392,9 +8258,9 @@ mips_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
valid_p &= tdesc_numbered_register (feature, tdesc_data.get (),
i + mips_regnum.fp0, mips_fprs[i]);
- valid_p &= tdesc_numbered_register (feature, tdesc_data.get (),
- mips_regnum.fp_control_status,
- "fcsr");
+ valid_p
+ &= tdesc_numbered_register (feature, tdesc_data.get (),
+ mips_regnum.fp_control_status, "fcsr");
valid_p
&= tdesc_numbered_register (feature, tdesc_data.get (),
mips_regnum.fp_implementation_revision,
@@ -8407,8 +8273,8 @@ mips_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
if (dspacc >= 0)
{
- feature = tdesc_find_feature (info.target_desc,
- "org.gnu.gdb.mips.dsp");
+ feature
+ = tdesc_find_feature (info.target_desc, "org.gnu.gdb.mips.dsp");
/* The DSP registers are optional; it's OK if they are absent. */
if (feature != NULL)
{
@@ -8446,8 +8312,7 @@ mips_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
}
/* Try to find a pre-existing architecture. */
- for (arches = gdbarch_list_lookup_by_info (arches, &info);
- arches != NULL;
+ for (arches = gdbarch_list_lookup_by_info (arches, &info); arches != NULL;
arches = gdbarch_list_lookup_by_info (arches->next, &info))
{
mips_gdbarch_tdep *tdep
@@ -8463,8 +8328,7 @@ mips_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
continue;
/* Need to be pedantic about which register virtual size is
used. */
- if (tdep->mips64_transfers_32bit_regs_p
- != mips64_transfers_32bit_regs_p)
+ if (tdep->mips64_transfers_32bit_regs_p != mips64_transfers_32bit_regs_p)
continue;
/* Be pedantic about which FPU is selected. */
if (mips_get_fpu_type (arches->gdbarch) != fpu_type)
@@ -8514,8 +8378,8 @@ mips_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
set_gdbarch_ax_pseudo_register_collect (gdbarch,
mips_ax_pseudo_register_collect);
- set_gdbarch_ax_pseudo_register_push_stack
- (gdbarch, mips_ax_pseudo_register_push_stack);
+ set_gdbarch_ax_pseudo_register_push_stack (
+ gdbarch, mips_ax_pseudo_register_push_stack);
set_gdbarch_elf_make_msymbol_special (gdbarch,
mips_elf_make_msymbol_special);
@@ -8600,7 +8464,7 @@ mips_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
set_gdbarch_long_double_format (gdbarch, floatformats_ibm_long_double);
break;
default:
- internal_error (_("unknown ABI in switch"));
+ internal_error (_ ("unknown ABI in switch"));
}
/* GCC creates a pseudo-section whose name specifies the size of
@@ -8649,7 +8513,7 @@ mips_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
set_gdbarch_ptr_bit (gdbarch, long_bit);
break;
default:
- internal_error (_("unknown ABI in switch"));
+ internal_error (_ ("unknown ABI in switch"));
}
}
}
@@ -8727,14 +8591,14 @@ mips_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
set_gdbarch_print_insn (gdbarch, gdb_print_insn_mips);
if (mips_abi == MIPS_ABI_N64)
- set_gdbarch_disassembler_options_implicit
- (gdbarch, (const char *) mips_disassembler_options_n64);
+ set_gdbarch_disassembler_options_implicit (
+ gdbarch, (const char *) mips_disassembler_options_n64);
else if (mips_abi == MIPS_ABI_N32)
- set_gdbarch_disassembler_options_implicit
- (gdbarch, (const char *) mips_disassembler_options_n32);
+ set_gdbarch_disassembler_options_implicit (
+ gdbarch, (const char *) mips_disassembler_options_n32);
else
- set_gdbarch_disassembler_options_implicit
- (gdbarch, (const char *) mips_disassembler_options_o32);
+ set_gdbarch_disassembler_options_implicit (
+ gdbarch, (const char *) mips_disassembler_options_o32);
set_gdbarch_disassembler_options (gdbarch, &mips_disassembler_options);
set_gdbarch_valid_disassembler_options (gdbarch,
disassembler_options_mips ());
@@ -8813,8 +8677,8 @@ mips_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
value_of_mips_user_reg, &mips_n32_n64_aliases[i].regnum);
else
for (i = 0; i < ARRAY_SIZE (mips_o32_aliases); i++)
- user_reg_add (gdbarch, mips_o32_aliases[i].name,
- value_of_mips_user_reg, &mips_o32_aliases[i].regnum);
+ user_reg_add (gdbarch, mips_o32_aliases[i].name, value_of_mips_user_reg,
+ &mips_o32_aliases[i].regnum);
/* Add some other standard aliases. */
for (i = 0; i < ARRAY_SIZE (mips_register_aliases); i++)
@@ -8823,15 +8687,15 @@ mips_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
for (i = 0; i < ARRAY_SIZE (mips_numeric_register_aliases); i++)
user_reg_add (gdbarch, mips_numeric_register_aliases[i].name,
- value_of_mips_user_reg,
+ value_of_mips_user_reg,
&mips_numeric_register_aliases[i].regnum);
return gdbarch;
}
static void
-mips_abi_update (const char *ignore_args,
- int from_tty, struct cmd_list_element *c)
+mips_abi_update (const char *ignore_args, int from_tty,
+ struct cmd_list_element *c)
{
struct gdbarch_info info;
@@ -8843,16 +8707,13 @@ mips_abi_update (const char *ignore_args,
/* Print out which MIPS ABI is in use. */
static void
-show_mips_abi (struct ui_file *file,
- int from_tty,
- struct cmd_list_element *ignored_cmd,
- const char *ignored_value)
+show_mips_abi (struct ui_file *file, int from_tty,
+ struct cmd_list_element *ignored_cmd, const char *ignored_value)
{
if (gdbarch_bfd_arch_info (target_gdbarch ())->arch != bfd_arch_mips)
- gdb_printf
- (file,
- "The MIPS ABI is unknown because the current architecture "
- "is not MIPS.\n");
+ gdb_printf (file,
+ "The MIPS ABI is unknown because the current architecture "
+ "is not MIPS.\n");
else
{
enum mips_abi global_abi = global_mips_abi ();
@@ -8860,15 +8721,14 @@ show_mips_abi (struct ui_file *file,
const char *actual_abi_str = mips_abi_strings[actual_abi];
if (global_abi == MIPS_ABI_UNKNOWN)
- gdb_printf
- (file,
- "The MIPS ABI is set automatically (currently \"%s\").\n",
- actual_abi_str);
+ gdb_printf (file,
+ "The MIPS ABI is set automatically (currently \"%s\").\n",
+ actual_abi_str);
else if (global_abi == actual_abi)
- gdb_printf
- (file,
- "The MIPS ABI is assumed to be \"%s\" (due to user setting).\n",
- actual_abi_str);
+ gdb_printf (
+ file,
+ "The MIPS ABI is assumed to be \"%s\" (due to user setting).\n",
+ actual_abi_str);
else
{
/* Probably shouldn't happen... */
@@ -8886,8 +8746,7 @@ static void
show_mips_compression (struct ui_file *file, int from_tty,
struct cmd_list_element *c, const char *value)
{
- gdb_printf (file, _("The compressed ISA encoding used is %s.\n"),
- value);
+ gdb_printf (file, _ ("The compressed ISA encoding used is %s.\n"), value);
}
/* Return a textual name for MIPS FPU type FPU_TYPE. */
@@ -8937,37 +8796,29 @@ mips_dump_tdep (struct gdbarch *gdbarch, struct ui_file *file)
}
/* Determine the size of a pointer. */
ef_mips_32bitmode = (tdep->elf_flags & EF_MIPS_32BITMODE);
- gdb_printf (file,
- "mips_dump_tdep: tdep->elf_flags = 0x%x\n",
+ gdb_printf (file, "mips_dump_tdep: tdep->elf_flags = 0x%x\n",
tdep->elf_flags);
- gdb_printf (file,
- "mips_dump_tdep: ef_mips_32bitmode = %d\n",
+ gdb_printf (file, "mips_dump_tdep: ef_mips_32bitmode = %d\n",
ef_mips_32bitmode);
- gdb_printf (file,
- "mips_dump_tdep: ef_mips_arch = %d\n",
- ef_mips_arch);
- gdb_printf (file,
- "mips_dump_tdep: tdep->mips_abi = %d (%s)\n",
+ gdb_printf (file, "mips_dump_tdep: ef_mips_arch = %d\n", ef_mips_arch);
+ gdb_printf (file, "mips_dump_tdep: tdep->mips_abi = %d (%s)\n",
tdep->mips_abi, mips_abi_strings[tdep->mips_abi]);
gdb_printf (file,
"mips_dump_tdep: "
"mips_mask_address_p() %d (default %d)\n",
- mips_mask_address_p (tdep),
- tdep->default_mask_address_p);
+ mips_mask_address_p (tdep), tdep->default_mask_address_p);
}
- gdb_printf (file,
- "mips_dump_tdep: MIPS_DEFAULT_FPU_TYPE = %d (%s)\n",
+ gdb_printf (file, "mips_dump_tdep: MIPS_DEFAULT_FPU_TYPE = %d (%s)\n",
MIPS_DEFAULT_FPU_TYPE,
mips_fpu_type_str (MIPS_DEFAULT_FPU_TYPE));
- gdb_printf (file, "mips_dump_tdep: MIPS_EABI = %d\n",
- mips_eabi (gdbarch));
- gdb_printf (file,
- "mips_dump_tdep: MIPS_FPU_TYPE = %d (%s)\n",
+ gdb_printf (file, "mips_dump_tdep: MIPS_EABI = %d\n", mips_eabi (gdbarch));
+ gdb_printf (file, "mips_dump_tdep: MIPS_FPU_TYPE = %d (%s)\n",
mips_get_fpu_type (gdbarch),
mips_fpu_type_str (mips_get_fpu_type (gdbarch)));
}
void _initialize_mips_tdep ();
+
void
_initialize_mips_tdep ()
{
@@ -8976,7 +8827,7 @@ _initialize_mips_tdep ()
mips_abi_string = mips_abi_strings[MIPS_ABI_UNKNOWN];
if (MIPS_ABI_LAST + 1
!= sizeof (mips_abi_strings) / sizeof (mips_abi_strings[0]))
- internal_error (_("mips_abi_strings out of sync"));
+ internal_error (_ ("mips_abi_strings out of sync"));
gdbarch_register (bfd_arch_mips, mips_gdbarch_init, mips_dump_tdep);
@@ -8990,16 +8841,18 @@ _initialize_mips_tdep ()
/* Add root prefix command for all "set mips"/"show mips" commands. */
add_setshow_prefix_cmd ("mips", no_class,
- _("Various MIPS specific commands."),
- _("Various MIPS specific commands."),
- &setmipscmdlist, &showmipscmdlist,
- &setlist, &showlist);
+ _ ("Various MIPS specific commands."),
+ _ ("Various MIPS specific commands."),
+ &setmipscmdlist, &showmipscmdlist, &setlist,
+ &showlist);
/* Allow the user to override the ABI. */
add_setshow_enum_cmd ("abi", class_obscure, mips_abi_strings,
- &mips_abi_string, _("\
-Set the MIPS ABI used by this program."), _("\
-Show the MIPS ABI used by this program."), _("\
+ &mips_abi_string, _ ("\
+Set the MIPS ABI used by this program."),
+ _ ("\
+Show the MIPS ABI used by this program."),
+ _ ("\
This option can be set to one of:\n\
auto - the default ABI associated with the current binary\n\
o32\n\
@@ -9008,64 +8861,67 @@ This option can be set to one of:\n\
n64\n\
eabi32\n\
eabi64"),
- mips_abi_update,
- show_mips_abi,
- &setmipscmdlist, &showmipscmdlist);
+ mips_abi_update, show_mips_abi, &setmipscmdlist,
+ &showmipscmdlist);
/* Allow the user to set the ISA to assume for compressed code if ELF
file flags don't tell or there is no program file selected. This
setting is updated whenever unambiguous ELF file flags are interpreted,
and carried over to subsequent sessions. */
add_setshow_enum_cmd ("compression", class_obscure, mips_compression_strings,
- &mips_compression_string, _("\
-Set the compressed ISA encoding used by MIPS code."), _("\
-Show the compressed ISA encoding used by MIPS code."), _("\
+ &mips_compression_string, _ ("\
+Set the compressed ISA encoding used by MIPS code."),
+ _ ("\
+Show the compressed ISA encoding used by MIPS code."),
+ _ ("\
Select the compressed ISA encoding used in functions that have no symbol\n\
information available. The encoding can be set to either of:\n\
mips16\n\
micromips\n\
and is updated automatically from ELF file flags if available."),
- mips_abi_update,
- show_mips_compression,
+ mips_abi_update, show_mips_compression,
&setmipscmdlist, &showmipscmdlist);
/* Let the user turn off floating point and set the fence post for
heuristic_proc_start. */
add_basic_prefix_cmd ("mipsfpu", class_support,
- _("Set use of MIPS floating-point coprocessor."),
+ _ ("Set use of MIPS floating-point coprocessor."),
&mipsfpulist, 0, &setlist);
add_cmd ("single", class_support, set_mipsfpu_single_command,
- _("Select single-precision MIPS floating-point coprocessor."),
+ _ ("Select single-precision MIPS floating-point coprocessor."),
&mipsfpulist);
cmd_list_element *set_mipsfpu_double_cmd
= add_cmd ("double", class_support, set_mipsfpu_double_command,
- _("Select double-precision MIPS floating-point coprocessor."),
+ _ ("Select double-precision MIPS floating-point coprocessor."),
&mipsfpulist);
add_alias_cmd ("on", set_mipsfpu_double_cmd, class_support, 1, &mipsfpulist);
- add_alias_cmd ("yes", set_mipsfpu_double_cmd, class_support, 1, &mipsfpulist);
+ add_alias_cmd ("yes", set_mipsfpu_double_cmd, class_support, 1,
+ &mipsfpulist);
add_alias_cmd ("1", set_mipsfpu_double_cmd, class_support, 1, &mipsfpulist);
cmd_list_element *set_mipsfpu_none_cmd
= add_cmd ("none", class_support, set_mipsfpu_none_command,
- _("Select no MIPS floating-point coprocessor."), &mipsfpulist);
+ _ ("Select no MIPS floating-point coprocessor."), &mipsfpulist);
add_alias_cmd ("off", set_mipsfpu_none_cmd, class_support, 1, &mipsfpulist);
add_alias_cmd ("no", set_mipsfpu_none_cmd, class_support, 1, &mipsfpulist);
add_alias_cmd ("0", set_mipsfpu_none_cmd, class_support, 1, &mipsfpulist);
add_cmd ("auto", class_support, set_mipsfpu_auto_command,
- _("Select MIPS floating-point coprocessor automatically."),
+ _ ("Select MIPS floating-point coprocessor automatically."),
&mipsfpulist);
add_cmd ("mipsfpu", class_support, show_mipsfpu_command,
- _("Show current use of MIPS floating-point coprocessor target."),
+ _ ("Show current use of MIPS floating-point coprocessor target."),
&showlist);
/* We really would like to have both "0" and "unlimited" work, but
command.c doesn't deal with that. So make it a var_zinteger
because the user can always use "999999" or some such for unlimited. */
add_setshow_zinteger_cmd ("heuristic-fence-post", class_support,
- &heuristic_fence_post, _("\
-Set the distance searched for the start of a function."), _("\
-Show the distance searched for the start of a function."), _("\
+ &heuristic_fence_post, _ ("\
+Set the distance searched for the start of a function."),
+ _ ("\
+Show the distance searched for the start of a function."),
+ _ ("\
If you are debugging a stripped executable, GDB needs to search through the\n\
program for the start of a function. This command sets the distance of the\n\
search. The only need to set it is when debugging a stripped executable."),
@@ -9076,23 +8932,25 @@ search. The only need to set it is when debugging a stripped executable."),
/* Allow the user to control whether the upper bits of 64-bit
addresses should be zeroed. */
- add_setshow_auto_boolean_cmd ("mask-address", no_class,
- &mask_address_var, _("\
-Set zeroing of upper 32 bits of 64-bit addresses."), _("\
-Show zeroing of upper 32 bits of 64-bit addresses."), _("\
+ add_setshow_auto_boolean_cmd ("mask-address", no_class, &mask_address_var,
+ _ ("\
+Set zeroing of upper 32 bits of 64-bit addresses."),
+ _ ("\
+Show zeroing of upper 32 bits of 64-bit addresses."),
+ _ ("\
Use \"on\" to enable the masking, \"off\" to disable it and \"auto\" to\n\
allow GDB to determine the correct value."),
- NULL, show_mask_address,
- &setmipscmdlist, &showmipscmdlist);
+ NULL, show_mask_address, &setmipscmdlist,
+ &showmipscmdlist);
/* Allow the user to control the size of 32 bit registers within the
raw remote packet. */
add_setshow_boolean_cmd ("remote-mips64-transfers-32bit-regs", class_obscure,
- &mips64_transfers_32bit_regs_p, _("\
+ &mips64_transfers_32bit_regs_p, _ ("\
Set compatibility with 64-bit MIPS target that transfers 32-bit quantities."),
- _("\
+ _ ("\
Show compatibility with 64-bit MIPS target that transfers 32-bit quantities."),
- _("\
+ _ ("\
Use \"on\" to enable backward compatibility with older MIPS 64 GDB+target\n\
that would transfer 32 bits for some registers (e.g. SR, FSR) and\n\
64 bits for others. Use \"off\" to disable compatibility mode"),
@@ -9103,13 +8961,13 @@ that would transfer 32 bits for some registers (e.g. SR, FSR) and\n\
&setlist, &showlist);
/* Debug this files internals. */
- add_setshow_zuinteger_cmd ("mips", class_maintenance,
- &mips_debug, _("\
-Set mips debugging."), _("\
-Show mips debugging."), _("\
+ add_setshow_zuinteger_cmd ("mips", class_maintenance, &mips_debug, _ ("\
+Set mips debugging."),
+ _ ("\
+Show mips debugging."),
+ _ ("\
When non-zero, mips specific debugging is enabled."),
- NULL,
- NULL, /* FIXME: i18n: Mips debugging is
+ NULL, NULL, /* FIXME: i18n: Mips debugging is
currently %s. */
&setdebuglist, &showdebuglist);
}
diff --git a/gdb/mips-tdep.h b/gdb/mips-tdep.h
index 81f87b5c5b6..a7857d2c80d 100644
--- a/gdb/mips-tdep.h
+++ b/gdb/mips-tdep.h
@@ -27,40 +27,36 @@ struct gdbarch;
/* All the possible MIPS ABIs. */
enum mips_abi
- {
- MIPS_ABI_UNKNOWN = 0,
- MIPS_ABI_N32,
- MIPS_ABI_O32,
- MIPS_ABI_N64,
- MIPS_ABI_O64,
- MIPS_ABI_EABI32,
- MIPS_ABI_EABI64,
- MIPS_ABI_LAST
- };
+{
+ MIPS_ABI_UNKNOWN = 0,
+ MIPS_ABI_N32,
+ MIPS_ABI_O32,
+ MIPS_ABI_N64,
+ MIPS_ABI_O64,
+ MIPS_ABI_EABI32,
+ MIPS_ABI_EABI64,
+ MIPS_ABI_LAST
+};
/* Return the MIPS ABI associated with GDBARCH. */
enum mips_abi mips_abi (struct gdbarch *gdbarch);
/* Base and compressed MIPS ISA variations. */
enum mips_isa
- {
- ISA_MIPS = -1, /* mips_compression_string depends on it. */
- ISA_MIPS16,
- ISA_MICROMIPS
- };
+{
+ ISA_MIPS = -1, /* mips_compression_string depends on it. */
+ ISA_MIPS16,
+ ISA_MICROMIPS
+};
/* Corresponding MSYMBOL_TARGET_FLAG aliases. */
-#define MSYMBOL_TARGET_FLAG_MIPS16(sym) \
- (sym)->target_flag_1 ()
+#define MSYMBOL_TARGET_FLAG_MIPS16(sym) (sym)->target_flag_1 ()
-#define SET_MSYMBOL_TARGET_FLAG_MIPS16(sym) \
- (sym)->set_target_flag_1 (true)
+#define SET_MSYMBOL_TARGET_FLAG_MIPS16(sym) (sym)->set_target_flag_1 (true)
-#define MSYMBOL_TARGET_FLAG_MICROMIPS(sym) \
- (sym)->target_flag_2 ()
+#define MSYMBOL_TARGET_FLAG_MICROMIPS(sym) (sym)->target_flag_2 ()
-#define SET_MSYMBOL_TARGET_FLAG_MICROMIPS(sym) \
- (sym)->set_target_flag_2 (true)
+#define SET_MSYMBOL_TARGET_FLAG_MICROMIPS(sym) (sym)->set_target_flag_2 (true)
/* Return the MIPS ISA's register size. Just a short cut to the BFD
architecture's word size. */
@@ -73,12 +69,12 @@ struct mips_regnum
int fp0;
int fp_implementation_revision;
int fp_control_status;
- int badvaddr; /* Bad vaddr for addressing exception. */
- int cause; /* Describes last exception. */
- int hi; /* Multiply/divide temp. */
- int lo; /* ... */
- int dspacc; /* SmartMIPS/DSP accumulators. */
- int dspctl; /* DSP control. */
+ int badvaddr; /* Bad vaddr for addressing exception. */
+ int cause; /* Describes last exception. */
+ int hi; /* Multiply/divide temp. */
+ int lo; /* ... */
+ int dspacc; /* SmartMIPS/DSP accumulators. */
+ int dspctl; /* DSP control. */
};
extern const struct mips_regnum *mips_regnum (struct gdbarch *gdbarch);
@@ -87,9 +83,9 @@ extern const struct mips_regnum *mips_regnum (struct gdbarch *gdbarch);
enum mips_fpu_type
{
- MIPS_FPU_DOUBLE, /* Full double precision floating point. */
- MIPS_FPU_SINGLE, /* Single precision floating point (R4650). */
- MIPS_FPU_NONE /* No floating point. */
+ MIPS_FPU_DOUBLE, /* Full double precision floating point. */
+ MIPS_FPU_SINGLE, /* Single precision floating point (R4650). */
+ MIPS_FPU_NONE /* No floating point. */
};
/* MIPS specific per-architecture information. */
@@ -99,10 +95,22 @@ struct mips_gdbarch_tdep : gdbarch_tdep_base
int elf_flags = 0;
/* mips options */
- enum mips_abi mips_abi {};
- enum mips_abi found_abi {};
- enum mips_isa mips_isa {};
- enum mips_fpu_type mips_fpu_type {};
+ enum mips_abi mips_abi
+ {
+ };
+
+ enum mips_abi found_abi
+ {
+ };
+
+ enum mips_isa mips_isa
+ {
+ };
+
+ enum mips_fpu_type mips_fpu_type
+ {
+ };
+
int mips_last_arg_regnum = 0;
int mips_last_fp_arg_regnum = 0;
int default_mask_address_p = 0;
@@ -114,7 +122,7 @@ struct mips_gdbarch_tdep : gdbarch_tdep_base
add any that do not need to be public. */
const struct mips_regnum *regnum = nullptr;
/* Register names table for the current register set. */
- const char * const *mips_processor_reg_names = nullptr;
+ const char *const *mips_processor_reg_names = nullptr;
/* The size of register data available from the target, if known.
This doesn't quite obsolete the manual
@@ -132,16 +140,16 @@ struct mips_gdbarch_tdep : gdbarch_tdep_base
enum
{
- MIPS_ZERO_REGNUM = 0, /* Read-only register, always 0. */
+ MIPS_ZERO_REGNUM = 0, /* Read-only register, always 0. */
MIPS_AT_REGNUM = 1,
- MIPS_V0_REGNUM = 2, /* Function integer return value. */
- MIPS_A0_REGNUM = 4, /* Loc of first arg during a subr call. */
- MIPS_S2_REGNUM = 18, /* Contains return address in MIPS16 thunks. */
- MIPS_T9_REGNUM = 25, /* Contains address of callee in PIC. */
+ MIPS_V0_REGNUM = 2, /* Function integer return value. */
+ MIPS_A0_REGNUM = 4, /* Loc of first arg during a subr call. */
+ MIPS_S2_REGNUM = 18, /* Contains return address in MIPS16 thunks. */
+ MIPS_T9_REGNUM = 25, /* Contains address of callee in PIC. */
MIPS_GP_REGNUM = 28,
MIPS_SP_REGNUM = 29,
MIPS_RA_REGNUM = 31,
- MIPS_PS_REGNUM = 32, /* Contains processor status. */
+ MIPS_PS_REGNUM = 32, /* Contains processor status. */
MIPS_EMBED_LO_REGNUM = 33,
MIPS_EMBED_HI_REGNUM = 34,
MIPS_EMBED_BADVADDR_REGNUM = 35,
@@ -149,7 +157,7 @@ enum
MIPS_EMBED_PC_REGNUM = 37,
MIPS_EMBED_FP0_REGNUM = 38,
MIPS_UNUSED_REGNUM = 73, /* Never used, FIXME. */
- MIPS_FIRST_EMBED_REGNUM = 74, /* First CP0 register for embedded use. */
+ MIPS_FIRST_EMBED_REGNUM = 74, /* First CP0 register for embedded use. */
MIPS_PRID_REGNUM = 89, /* Processor ID. */
MIPS_LAST_EMBED_REGNUM = 89 /* Last one. */
};
@@ -164,8 +172,8 @@ enum
};
/* Single step based on where the current instruction will take us. */
-extern std::vector<CORE_ADDR> mips_software_single_step
- (struct regcache *regcache);
+extern std::vector<CORE_ADDR>
+mips_software_single_step (struct regcache *regcache);
/* Strip the ISA (compression) bit off from ADDR. */
extern CORE_ADDR mips_unmake_compact_addr (CORE_ADDR addr);
diff --git a/gdb/mips64-obsd-nat.c b/gdb/mips64-obsd-nat.c
index f17cab69567..681ccc2f0c0 100644
--- a/gdb/mips64-obsd-nat.c
+++ b/gdb/mips64-obsd-nat.c
@@ -31,8 +31,8 @@
#include "obsd-nat.h"
/* Shorthand for some register numbers used below. */
-#define MIPS_PC_REGNUM MIPS_EMBED_PC_REGNUM
-#define MIPS_FP0_REGNUM MIPS_EMBED_FP0_REGNUM
+#define MIPS_PC_REGNUM MIPS_EMBED_PC_REGNUM
+#define MIPS_FP0_REGNUM MIPS_EMBED_FP0_REGNUM
#define MIPS_FSR_REGNUM MIPS_EMBED_FP0_REGNUM + 32
struct mips64_obsd_nat_target final : public obsd_nat_target
@@ -62,8 +62,8 @@ mips64obsd_supply_gregset (struct regcache *regcache, const void *gregs)
in GREGS. */
static void
-mips64obsd_collect_gregset (const struct regcache *regcache,
- void *gregs, int regnum)
+mips64obsd_collect_gregset (const struct regcache *regcache, void *gregs,
+ int regnum)
{
char *regs = gregs;
int i;
@@ -80,7 +80,6 @@ mips64obsd_collect_gregset (const struct regcache *regcache,
regcache->raw_collect (i, regs + (i + 2) * 8);
}
}
-
/* Fetch register REGNUM from the inferior. If REGNUM is -1, do this
for all registers. */
@@ -92,7 +91,7 @@ mips64_obsd_nat_target::fetch_registers (struct regcache *regcache, int regnum)
pid_t pid = regcache->ptid ().pid ();
if (ptrace (PT_GETREGS, pid, (PTRACE_TYPE_ARG3) &regs, 0) == -1)
- perror_with_name (_("Couldn't get registers"));
+ perror_with_name (_ ("Couldn't get registers"));
mips64obsd_supply_gregset (regcache, &regs);
}
@@ -107,15 +106,16 @@ mips64_obsd_nat_target::store_registers (struct regcache *regcache, int regnum)
pid_t pid = regcache->ptid ().pid ();
if (ptrace (PT_GETREGS, pid, (PTRACE_TYPE_ARG3) &regs, 0) == -1)
- perror_with_name (_("Couldn't get registers"));
+ perror_with_name (_ ("Couldn't get registers"));
mips64obsd_collect_gregset (regcache, &regs, regnum);
if (ptrace (PT_SETREGS, pid, (PTRACE_TYPE_ARG3) &regs, 0) == -1)
- perror_with_name (_("Couldn't write registers"));
+ perror_with_name (_ ("Couldn't write registers"));
}
void _initialize_mips64obsd_nat ();
+
void
_initialize_mips64obsd_nat ()
{
diff --git a/gdb/mips64-obsd-tdep.c b/gdb/mips64-obsd-tdep.c
index 3e386481b1a..db2d1d41260 100644
--- a/gdb/mips64-obsd-tdep.c
+++ b/gdb/mips64-obsd-tdep.c
@@ -54,11 +54,8 @@ mips64obsd_supply_gregset (const struct regset *regset,
/* OpenBSD/mips64 register set. */
-static const struct regset mips64obsd_gregset =
-{
- NULL,
- mips64obsd_supply_gregset
-};
+static const struct regset mips64obsd_gregset
+ = { NULL, mips64obsd_supply_gregset };
/* Iterate over core file register note sections. */
@@ -71,15 +68,13 @@ mips64obsd_iterate_over_regset_sections (struct gdbarch *gdbarch,
cb (".reg", MIPS64OBSD_NUM_REGS * 8, MIPS64OBSD_NUM_REGS * 8,
&mips64obsd_gregset, NULL, cb_data);
}
-
/* Signal trampolines. */
static void
mips64obsd_sigframe_init (const struct tramp_frame *self,
frame_info_ptr this_frame,
- struct trad_frame_cache *cache,
- CORE_ADDR func)
+ struct trad_frame_cache *cache, CORE_ADDR func)
{
struct gdbarch *gdbarch = get_frame_arch (this_frame);
CORE_ADDR sp, sigcontext_addr, addr;
@@ -93,25 +88,20 @@ mips64obsd_sigframe_init (const struct tramp_frame *self,
/* PC. */
regnum = mips_regnum (gdbarch)->pc;
- trad_frame_set_reg_addr (cache,
- regnum + gdbarch_num_regs (gdbarch),
- sigcontext_addr + 16);
+ trad_frame_set_reg_addr (cache, regnum + gdbarch_num_regs (gdbarch),
+ sigcontext_addr + 16);
/* GPRs. */
for (regnum = MIPS_AT_REGNUM, addr = sigcontext_addr + 32;
regnum <= MIPS_RA_REGNUM; regnum++, addr += 8)
- trad_frame_set_reg_addr (cache,
- regnum + gdbarch_num_regs (gdbarch),
- addr);
+ trad_frame_set_reg_addr (cache, regnum + gdbarch_num_regs (gdbarch), addr);
/* HI and LO. */
regnum = mips_regnum (gdbarch)->lo;
- trad_frame_set_reg_addr (cache,
- regnum + gdbarch_num_regs (gdbarch),
+ trad_frame_set_reg_addr (cache, regnum + gdbarch_num_regs (gdbarch),
sigcontext_addr + 280);
regnum = mips_regnum (gdbarch)->hi;
- trad_frame_set_reg_addr (cache,
- regnum + gdbarch_num_regs (gdbarch),
+ trad_frame_set_reg_addr (cache, regnum + gdbarch_num_regs (gdbarch),
sigcontext_addr + 288);
/* TODO: Handle the floating-point registers. */
@@ -119,43 +109,39 @@ mips64obsd_sigframe_init (const struct tramp_frame *self,
trad_frame_set_id (cache, frame_id_build (sp, func));
}
-static const struct tramp_frame mips64obsd_sigframe =
-{
- SIGTRAMP_FRAME,
- MIPS_INSN32_SIZE,
- {
- { 0x67a40020, ULONGEST_MAX }, /* daddiu a0,sp,32 */
- { 0x24020067, ULONGEST_MAX }, /* li v0,103 */
- { 0x0000000c, ULONGEST_MAX }, /* syscall */
- { 0x0000000d, ULONGEST_MAX }, /* break */
- { TRAMP_SENTINEL_INSN, ULONGEST_MAX }
- },
- mips64obsd_sigframe_init
-};
-
-
+static const struct tramp_frame mips64obsd_sigframe
+ = { SIGTRAMP_FRAME,
+ MIPS_INSN32_SIZE,
+ { { 0x67a40020, ULONGEST_MAX }, /* daddiu a0,sp,32 */
+ { 0x24020067, ULONGEST_MAX }, /* li v0,103 */
+ { 0x0000000c, ULONGEST_MAX }, /* syscall */
+ { 0x0000000d, ULONGEST_MAX }, /* break */
+ { TRAMP_SENTINEL_INSN, ULONGEST_MAX } },
+ mips64obsd_sigframe_init };
+
static void
mips64obsd_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
{
/* OpenBSD/mips64 only supports the n64 ABI, but the braindamaged
way GDB works, forces us to pretend we can handle them all. */
- set_gdbarch_iterate_over_regset_sections
- (gdbarch, mips64obsd_iterate_over_regset_sections);
+ set_gdbarch_iterate_over_regset_sections (
+ gdbarch, mips64obsd_iterate_over_regset_sections);
tramp_frame_prepend_unwinder (gdbarch, &mips64obsd_sigframe);
set_gdbarch_long_double_bit (gdbarch, 128);
set_gdbarch_long_double_format (gdbarch, floatformats_ieee_quad);
- obsd_init_abi(info, gdbarch);
+ obsd_init_abi (info, gdbarch);
/* OpenBSD/mips64 has SVR4-style shared libraries. */
- set_solib_svr4_fetch_link_map_offsets
- (gdbarch, svr4_lp64_fetch_link_map_offsets);
+ set_solib_svr4_fetch_link_map_offsets (gdbarch,
+ svr4_lp64_fetch_link_map_offsets);
}
void _initialize_mips64obsd_tdep ();
+
void
_initialize_mips64obsd_tdep ()
{
diff --git a/gdb/mipsread.c b/gdb/mipsread.c
index 5c2c88e81c2..a1aaee35846 100644
--- a/gdb/mipsread.c
+++ b/gdb/mipsread.c
@@ -33,17 +33,16 @@
#include "coff/sym.h"
#include "coff/internal.h"
#include "coff/ecoff.h"
-#include "libcoff.h" /* Private BFD COFF information. */
-#include "libecoff.h" /* Private BFD ECOFF information. */
+#include "libcoff.h" /* Private BFD COFF information. */
+#include "libecoff.h" /* Private BFD ECOFF information. */
#include "elf/common.h"
#include "elf/internal.h"
#include "elf/mips.h"
#include "psymtab.h"
-static void
-read_alphacoff_dynamic_symtab (minimal_symbol_reader &,
- struct objfile *objfile);
+static void read_alphacoff_dynamic_symtab (minimal_symbol_reader &,
+ struct objfile *objfile);
/* Initialize anything that needs initializing when a completely new
symbol file is specified (not just adding some symbols from another
@@ -65,7 +64,8 @@ mipscoff_symfile_init (struct objfile *objfile)
/* Read a symbol file from a file. */
static void
-mipscoff_symfile_read (struct objfile *objfile, symfile_add_flags symfile_flags)
+mipscoff_symfile_read (struct objfile *objfile,
+ symfile_add_flags symfile_flags)
{
bfd *abfd = objfile->obfd.get ();
@@ -74,9 +74,10 @@ mipscoff_symfile_read (struct objfile *objfile, symfile_add_flags symfile_flags)
/* Now that the executable file is positioned at symbol table,
process it and define symbols accordingly. */
- if (!((*ecoff_backend (abfd)->debug_swap.read_debug_info)
- (abfd, NULL, &ecoff_data (abfd)->debug_info)))
- error (_("Error reading symbol table: %s"), bfd_errmsg (bfd_get_error ()));
+ if (!((*ecoff_backend (abfd)->debug_swap.read_debug_info) (
+ abfd, NULL, &ecoff_data (abfd)->debug_info)))
+ error (_ ("Error reading symbol table: %s"),
+ bfd_errmsg (bfd_get_error ()));
mdebug_build_psymtabs (reader, objfile, &ecoff_backend (abfd)->debug_swap,
&ecoff_data (abfd)->debug_info);
@@ -113,37 +114,37 @@ mipscoff_symfile_finish (struct objfile *objfile)
typedef struct
{
- unsigned char st_name[4]; /* Symbol name, index in string table. */
- unsigned char st_pad[4]; /* Pad to long word boundary. */
- unsigned char st_value[8]; /* Value of the symbol. */
- unsigned char st_size[4]; /* Associated symbol size. */
- unsigned char st_info[1]; /* Type and binding attributes. */
- unsigned char st_other[1]; /* No defined meaning, 0. */
- unsigned char st_shndx[2]; /* Associated section index. */
+ unsigned char st_name[4]; /* Symbol name, index in string table. */
+ unsigned char st_pad[4]; /* Pad to long word boundary. */
+ unsigned char st_value[8]; /* Value of the symbol. */
+ unsigned char st_size[4]; /* Associated symbol size. */
+ unsigned char st_info[1]; /* Type and binding attributes. */
+ unsigned char st_other[1]; /* No defined meaning, 0. */
+ unsigned char st_shndx[2]; /* Associated section index. */
} Elfalpha_External_Sym;
/* Format of an alpha external ELF dynamic info structure. */
typedef struct
{
- unsigned char d_tag[4]; /* Tag. */
- unsigned char d_pad[4]; /* Pad to long word boundary. */
+ unsigned char d_tag[4]; /* Tag. */
+ unsigned char d_pad[4]; /* Pad to long word boundary. */
+
union
{
- unsigned char d_ptr[8]; /* Pointer value. */
- unsigned char d_val[4]; /* Integer value. */
- }
- d_un;
+ unsigned char d_ptr[8]; /* Pointer value. */
+ unsigned char d_val[4]; /* Integer value. */
+ } d_un;
} Elfalpha_External_Dyn;
/* Struct to obtain the section pointers for alpha dynamic symbol info. */
struct alphacoff_dynsecinfo
{
- asection *sym_sect; /* Section pointer for .dynsym section. */
- asection *str_sect; /* Section pointer for .dynstr section. */
- asection *dyninfo_sect; /* Section pointer for .dynamic section. */
- asection *got_sect; /* Section pointer for .got section. */
+ asection *sym_sect; /* Section pointer for .dynsym section. */
+ asection *str_sect; /* Section pointer for .dynstr section. */
+ asection *dyninfo_sect; /* Section pointer for .dynamic section. */
+ asection *got_sect; /* Section pointer for .got section. */
};
/* We are called once per section from read_alphacoff_dynamic_symtab.
@@ -165,7 +166,7 @@ alphacoff_locate_sections (bfd *ignore_abfd, asection *sectp, void *sip)
else if (strcmp (sectp->name, ".dynamic") == 0)
si->dyninfo_sect = sectp;
else if (strcmp (sectp->name, ".got") == 0)
- si->got_sect = sectp;
+ si->got_sect = sectp;
}
/* Scan an alpha dynamic symbol table for symbols of interest and add
@@ -193,9 +194,9 @@ read_alphacoff_dynamic_symtab (minimal_symbol_reader &reader,
/* Locate the dynamic symbols sections and read them in. */
memset ((char *) &si, 0, sizeof (si));
- bfd_map_over_sections (abfd, alphacoff_locate_sections, (void *) & si);
- if (si.sym_sect == NULL || si.str_sect == NULL
- || si.dyninfo_sect == NULL || si.got_sect == NULL)
+ bfd_map_over_sections (abfd, alphacoff_locate_sections, (void *) &si);
+ if (si.sym_sect == NULL || si.str_sect == NULL || si.dyninfo_sect == NULL
+ || si.got_sect == NULL)
return;
gdb::byte_vector sym_sec (bfd_section_size (si.sym_sect));
@@ -219,9 +220,8 @@ read_alphacoff_dynamic_symtab (minimal_symbol_reader &reader,
/* Find the number of local GOT entries and the index for the
first dynamic symbol in the GOT. */
for ((dyninfo_p = dyninfo_sec.data (),
- dyninfo_end = dyninfo_p + dyninfo_sec.size ());
- dyninfo_p < dyninfo_end;
- dyninfo_p += sizeof (Elfalpha_External_Dyn))
+ dyninfo_end = dyninfo_p + dyninfo_sec.size ());
+ dyninfo_p < dyninfo_end; dyninfo_p += sizeof (Elfalpha_External_Dyn))
{
Elfalpha_External_Dyn *x_dynp = (Elfalpha_External_Dyn *) dyninfo_p;
long dyn_tag;
@@ -252,8 +252,7 @@ read_alphacoff_dynamic_symtab (minimal_symbol_reader &reader,
/* Skip first symbol, which is a null dummy. */
for (i = 1, x_symp = (Elfalpha_External_Sym *) sym_sec.data () + 1;
- i < sym_count;
- i++, x_symp++)
+ i < sym_count; i++, x_symp++)
{
unsigned long strx;
char *name;
@@ -304,16 +303,14 @@ read_alphacoff_dynamic_symtab (minimal_symbol_reader &reader,
them. */
if (sym_value == 0)
{
- int got_entry_offset =
- (i - dt_mips_gotsym + dt_mips_local_gotno) * got_entry_size;
+ int got_entry_offset
+ = (i - dt_mips_gotsym + dt_mips_local_gotno) * got_entry_size;
- if (got_entry_offset < 0
- || got_entry_offset >= got_sec.size ())
+ if (got_entry_offset < 0 || got_entry_offset >= got_sec.size ())
continue;
- sym_value =
- bfd_h_get_64 (abfd,
- (bfd_byte *) (got_sec.data ()
- + got_entry_offset));
+ sym_value
+ = bfd_h_get_64 (abfd, (bfd_byte *) (got_sec.data ()
+ + got_entry_offset));
if (sym_value == 0)
continue;
}
@@ -364,20 +361,20 @@ read_alphacoff_dynamic_symtab (minimal_symbol_reader &reader,
/* Initialization. */
-static const struct sym_fns ecoff_sym_fns =
-{
- mipscoff_new_init, /* init anything gbl to entire symtab */
- mipscoff_symfile_init, /* read initial info, setup for sym_read() */
- mipscoff_symfile_read, /* read a symbol file into symtab */
- mipscoff_symfile_finish, /* finished with file, cleanup */
- default_symfile_offsets, /* dummy FIXME til implem sym reloc */
- default_symfile_segments, /* Get segment information from a file. */
+static const struct sym_fns ecoff_sym_fns = {
+ mipscoff_new_init, /* init anything gbl to entire symtab */
+ mipscoff_symfile_init, /* read initial info, setup for sym_read() */
+ mipscoff_symfile_read, /* read a symbol file into symtab */
+ mipscoff_symfile_finish, /* finished with file, cleanup */
+ default_symfile_offsets, /* dummy FIXME til implem sym reloc */
+ default_symfile_segments, /* Get segment information from a file. */
NULL,
- default_symfile_relocate, /* Relocate a debug section. */
- NULL, /* sym_probe_fns */
+ default_symfile_relocate, /* Relocate a debug section. */
+ NULL, /* sym_probe_fns */
};
void _initialize_mipsread ();
+
void
_initialize_mipsread ()
{
diff --git a/gdb/mn10300-linux-tdep.c b/gdb/mn10300-linux-tdep.c
index 79ef01ada27..5f2cdd0304f 100644
--- a/gdb/mn10300-linux-tdep.c
+++ b/gdb/mn10300-linux-tdep.c
@@ -36,44 +36,45 @@
#define MN10300_ELF_NGREG 28
#define MN10300_ELF_NFPREG 32
-typedef gdb_byte mn10300_elf_greg_t[4];
+typedef gdb_byte mn10300_elf_greg_t[4];
typedef mn10300_elf_greg_t mn10300_elf_gregset_t[MN10300_ELF_NGREG];
-typedef gdb_byte mn10300_elf_fpreg_t[4];
+typedef gdb_byte mn10300_elf_fpreg_t[4];
+
typedef struct
{
mn10300_elf_fpreg_t fpregs[MN10300_ELF_NFPREG];
- gdb_byte fpcr[4];
+ gdb_byte fpcr[4];
} mn10300_elf_fpregset_t;
/* elf_gregset_t register indices stolen from include/asm-mn10300/ptrace.h. */
-#define MN10300_ELF_GREGSET_T_REG_INDEX_A3 0
-#define MN10300_ELF_GREGSET_T_REG_INDEX_A2 1
-#define MN10300_ELF_GREGSET_T_REG_INDEX_D3 2
-#define MN10300_ELF_GREGSET_T_REG_INDEX_D2 3
-#define MN10300_ELF_GREGSET_T_REG_INDEX_MCVF 4
-#define MN10300_ELF_GREGSET_T_REG_INDEX_MCRL 5
-#define MN10300_ELF_GREGSET_T_REG_INDEX_MCRH 6
-#define MN10300_ELF_GREGSET_T_REG_INDEX_MDRQ 7
-#define MN10300_ELF_GREGSET_T_REG_INDEX_E1 8
-#define MN10300_ELF_GREGSET_T_REG_INDEX_E0 9
-#define MN10300_ELF_GREGSET_T_REG_INDEX_E7 10
-#define MN10300_ELF_GREGSET_T_REG_INDEX_E6 11
-#define MN10300_ELF_GREGSET_T_REG_INDEX_E5 12
-#define MN10300_ELF_GREGSET_T_REG_INDEX_E4 13
-#define MN10300_ELF_GREGSET_T_REG_INDEX_E3 14
-#define MN10300_ELF_GREGSET_T_REG_INDEX_E2 15
-#define MN10300_ELF_GREGSET_T_REG_INDEX_SP 16
-#define MN10300_ELF_GREGSET_T_REG_INDEX_LAR 17
-#define MN10300_ELF_GREGSET_T_REG_INDEX_LIR 18
-#define MN10300_ELF_GREGSET_T_REG_INDEX_MDR 19
-#define MN10300_ELF_GREGSET_T_REG_INDEX_A1 20
-#define MN10300_ELF_GREGSET_T_REG_INDEX_A0 21
-#define MN10300_ELF_GREGSET_T_REG_INDEX_D1 22
-#define MN10300_ELF_GREGSET_T_REG_INDEX_D0 23
-#define MN10300_ELF_GREGSET_T_REG_INDEX_ORIG_D0 24
-#define MN10300_ELF_GREGSET_T_REG_INDEX_EPSW 25
-#define MN10300_ELF_GREGSET_T_REG_INDEX_PC 26
+#define MN10300_ELF_GREGSET_T_REG_INDEX_A3 0
+#define MN10300_ELF_GREGSET_T_REG_INDEX_A2 1
+#define MN10300_ELF_GREGSET_T_REG_INDEX_D3 2
+#define MN10300_ELF_GREGSET_T_REG_INDEX_D2 3
+#define MN10300_ELF_GREGSET_T_REG_INDEX_MCVF 4
+#define MN10300_ELF_GREGSET_T_REG_INDEX_MCRL 5
+#define MN10300_ELF_GREGSET_T_REG_INDEX_MCRH 6
+#define MN10300_ELF_GREGSET_T_REG_INDEX_MDRQ 7
+#define MN10300_ELF_GREGSET_T_REG_INDEX_E1 8
+#define MN10300_ELF_GREGSET_T_REG_INDEX_E0 9
+#define MN10300_ELF_GREGSET_T_REG_INDEX_E7 10
+#define MN10300_ELF_GREGSET_T_REG_INDEX_E6 11
+#define MN10300_ELF_GREGSET_T_REG_INDEX_E5 12
+#define MN10300_ELF_GREGSET_T_REG_INDEX_E4 13
+#define MN10300_ELF_GREGSET_T_REG_INDEX_E3 14
+#define MN10300_ELF_GREGSET_T_REG_INDEX_E2 15
+#define MN10300_ELF_GREGSET_T_REG_INDEX_SP 16
+#define MN10300_ELF_GREGSET_T_REG_INDEX_LAR 17
+#define MN10300_ELF_GREGSET_T_REG_INDEX_LIR 18
+#define MN10300_ELF_GREGSET_T_REG_INDEX_MDR 19
+#define MN10300_ELF_GREGSET_T_REG_INDEX_A1 20
+#define MN10300_ELF_GREGSET_T_REG_INDEX_A0 21
+#define MN10300_ELF_GREGSET_T_REG_INDEX_D1 22
+#define MN10300_ELF_GREGSET_T_REG_INDEX_D0 23
+#define MN10300_ELF_GREGSET_T_REG_INDEX_ORIG_D0 24
+#define MN10300_ELF_GREGSET_T_REG_INDEX_EPSW 25
+#define MN10300_ELF_GREGSET_T_REG_INDEX_PC 26
/* New gdbarch API for corefile registers.
Given a section name and size, create a struct reg object
@@ -83,149 +84,150 @@ typedef struct
If REGNUM is -1, do this for all gp registers in regset. */
static void
-am33_supply_gregset_method (const struct regset *regset,
- struct regcache *regcache,
- int regnum, const void *gregs, size_t len)
+am33_supply_gregset_method (const struct regset *regset,
+ struct regcache *regcache, int regnum,
+ const void *gregs, size_t len)
{
const mn10300_elf_greg_t *regp = (const mn10300_elf_greg_t *) gregs;
int i;
gdb_assert (len >= sizeof (mn10300_elf_gregset_t));
- switch (regnum) {
- case E_D0_REGNUM:
- regcache->raw_supply (E_D0_REGNUM,
- (regp + MN10300_ELF_GREGSET_T_REG_INDEX_D0));
- break;
- case E_D1_REGNUM:
- regcache->raw_supply (E_D1_REGNUM,
- (regp + MN10300_ELF_GREGSET_T_REG_INDEX_D1));
- break;
- case E_D2_REGNUM:
- regcache->raw_supply (E_D2_REGNUM,
- (regp + MN10300_ELF_GREGSET_T_REG_INDEX_D2));
- break;
- case E_D3_REGNUM:
- regcache->raw_supply (E_D3_REGNUM,
- (regp + MN10300_ELF_GREGSET_T_REG_INDEX_D3));
- break;
- case E_A0_REGNUM:
- regcache->raw_supply (E_A0_REGNUM,
- (regp + MN10300_ELF_GREGSET_T_REG_INDEX_A0));
- break;
- case E_A1_REGNUM:
- regcache->raw_supply (E_A1_REGNUM,
- (regp + MN10300_ELF_GREGSET_T_REG_INDEX_A1));
- break;
- case E_A2_REGNUM:
- regcache->raw_supply (E_A2_REGNUM,
- (regp + MN10300_ELF_GREGSET_T_REG_INDEX_A2));
- break;
- case E_A3_REGNUM:
- regcache->raw_supply (E_A3_REGNUM,
- (regp + MN10300_ELF_GREGSET_T_REG_INDEX_A3));
- break;
- case E_SP_REGNUM:
- regcache->raw_supply (E_SP_REGNUM,
- (regp + MN10300_ELF_GREGSET_T_REG_INDEX_SP));
- break;
- case E_PC_REGNUM:
- regcache->raw_supply (E_PC_REGNUM,
- (regp + MN10300_ELF_GREGSET_T_REG_INDEX_PC));
- break;
- case E_MDR_REGNUM:
- regcache->raw_supply (E_MDR_REGNUM,
- (regp + MN10300_ELF_GREGSET_T_REG_INDEX_MDR));
- break;
- case E_PSW_REGNUM:
- regcache->raw_supply (E_PSW_REGNUM,
- (regp + MN10300_ELF_GREGSET_T_REG_INDEX_EPSW));
- break;
- case E_LIR_REGNUM:
- regcache->raw_supply (E_LIR_REGNUM,
- (regp + MN10300_ELF_GREGSET_T_REG_INDEX_LIR));
- break;
- case E_LAR_REGNUM:
- regcache->raw_supply (E_LAR_REGNUM,
- (regp + MN10300_ELF_GREGSET_T_REG_INDEX_LAR));
- break;
- case E_MDRQ_REGNUM:
- regcache->raw_supply (E_MDRQ_REGNUM,
- (regp + MN10300_ELF_GREGSET_T_REG_INDEX_MDRQ));
- break;
- case E_E0_REGNUM:
- regcache->raw_supply (E_E0_REGNUM,
- (regp + MN10300_ELF_GREGSET_T_REG_INDEX_E0));
- break;
- case E_E1_REGNUM:
- regcache->raw_supply (E_E1_REGNUM,
- (regp + MN10300_ELF_GREGSET_T_REG_INDEX_E1));
- break;
- case E_E2_REGNUM:
- regcache->raw_supply (E_E2_REGNUM,
- (regp + MN10300_ELF_GREGSET_T_REG_INDEX_E2));
- break;
- case E_E3_REGNUM:
- regcache->raw_supply (E_E3_REGNUM,
- (regp + MN10300_ELF_GREGSET_T_REG_INDEX_E3));
- break;
- case E_E4_REGNUM:
- regcache->raw_supply (E_E4_REGNUM,
- (regp + MN10300_ELF_GREGSET_T_REG_INDEX_E4));
- break;
- case E_E5_REGNUM:
- regcache->raw_supply (E_E5_REGNUM,
- (regp + MN10300_ELF_GREGSET_T_REG_INDEX_E5));
- break;
- case E_E6_REGNUM:
- regcache->raw_supply (E_E6_REGNUM,
- (regp + MN10300_ELF_GREGSET_T_REG_INDEX_E6));
- break;
- case E_E7_REGNUM:
- regcache->raw_supply (E_E7_REGNUM,
- (regp + MN10300_ELF_GREGSET_T_REG_INDEX_E7));
- break;
-
- /* ssp, msp, and usp are inaccessible. */
- case E_E8_REGNUM:
- regcache->raw_supply_zeroed (E_E8_REGNUM);
- break;
- case E_E9_REGNUM:
- regcache->raw_supply_zeroed (E_E9_REGNUM);
- break;
- case E_E10_REGNUM:
- regcache->raw_supply_zeroed (E_E10_REGNUM);
- break;
- case E_MCRH_REGNUM:
- regcache->raw_supply (E_MCRH_REGNUM,
- (regp + MN10300_ELF_GREGSET_T_REG_INDEX_MCRH));
- break;
- case E_MCRL_REGNUM:
- regcache->raw_supply (E_MCRL_REGNUM,
- (regp + MN10300_ELF_GREGSET_T_REG_INDEX_MCRL));
- break;
- case E_MCVF_REGNUM:
- regcache->raw_supply (E_MCVF_REGNUM,
- (regp + MN10300_ELF_GREGSET_T_REG_INDEX_MCVF));
- break;
- case E_FPCR_REGNUM:
- /* FPCR is numbered among the GP regs, but handled as an FP reg.
+ switch (regnum)
+ {
+ case E_D0_REGNUM:
+ regcache->raw_supply (E_D0_REGNUM,
+ (regp + MN10300_ELF_GREGSET_T_REG_INDEX_D0));
+ break;
+ case E_D1_REGNUM:
+ regcache->raw_supply (E_D1_REGNUM,
+ (regp + MN10300_ELF_GREGSET_T_REG_INDEX_D1));
+ break;
+ case E_D2_REGNUM:
+ regcache->raw_supply (E_D2_REGNUM,
+ (regp + MN10300_ELF_GREGSET_T_REG_INDEX_D2));
+ break;
+ case E_D3_REGNUM:
+ regcache->raw_supply (E_D3_REGNUM,
+ (regp + MN10300_ELF_GREGSET_T_REG_INDEX_D3));
+ break;
+ case E_A0_REGNUM:
+ regcache->raw_supply (E_A0_REGNUM,
+ (regp + MN10300_ELF_GREGSET_T_REG_INDEX_A0));
+ break;
+ case E_A1_REGNUM:
+ regcache->raw_supply (E_A1_REGNUM,
+ (regp + MN10300_ELF_GREGSET_T_REG_INDEX_A1));
+ break;
+ case E_A2_REGNUM:
+ regcache->raw_supply (E_A2_REGNUM,
+ (regp + MN10300_ELF_GREGSET_T_REG_INDEX_A2));
+ break;
+ case E_A3_REGNUM:
+ regcache->raw_supply (E_A3_REGNUM,
+ (regp + MN10300_ELF_GREGSET_T_REG_INDEX_A3));
+ break;
+ case E_SP_REGNUM:
+ regcache->raw_supply (E_SP_REGNUM,
+ (regp + MN10300_ELF_GREGSET_T_REG_INDEX_SP));
+ break;
+ case E_PC_REGNUM:
+ regcache->raw_supply (E_PC_REGNUM,
+ (regp + MN10300_ELF_GREGSET_T_REG_INDEX_PC));
+ break;
+ case E_MDR_REGNUM:
+ regcache->raw_supply (E_MDR_REGNUM,
+ (regp + MN10300_ELF_GREGSET_T_REG_INDEX_MDR));
+ break;
+ case E_PSW_REGNUM:
+ regcache->raw_supply (E_PSW_REGNUM,
+ (regp + MN10300_ELF_GREGSET_T_REG_INDEX_EPSW));
+ break;
+ case E_LIR_REGNUM:
+ regcache->raw_supply (E_LIR_REGNUM,
+ (regp + MN10300_ELF_GREGSET_T_REG_INDEX_LIR));
+ break;
+ case E_LAR_REGNUM:
+ regcache->raw_supply (E_LAR_REGNUM,
+ (regp + MN10300_ELF_GREGSET_T_REG_INDEX_LAR));
+ break;
+ case E_MDRQ_REGNUM:
+ regcache->raw_supply (E_MDRQ_REGNUM,
+ (regp + MN10300_ELF_GREGSET_T_REG_INDEX_MDRQ));
+ break;
+ case E_E0_REGNUM:
+ regcache->raw_supply (E_E0_REGNUM,
+ (regp + MN10300_ELF_GREGSET_T_REG_INDEX_E0));
+ break;
+ case E_E1_REGNUM:
+ regcache->raw_supply (E_E1_REGNUM,
+ (regp + MN10300_ELF_GREGSET_T_REG_INDEX_E1));
+ break;
+ case E_E2_REGNUM:
+ regcache->raw_supply (E_E2_REGNUM,
+ (regp + MN10300_ELF_GREGSET_T_REG_INDEX_E2));
+ break;
+ case E_E3_REGNUM:
+ regcache->raw_supply (E_E3_REGNUM,
+ (regp + MN10300_ELF_GREGSET_T_REG_INDEX_E3));
+ break;
+ case E_E4_REGNUM:
+ regcache->raw_supply (E_E4_REGNUM,
+ (regp + MN10300_ELF_GREGSET_T_REG_INDEX_E4));
+ break;
+ case E_E5_REGNUM:
+ regcache->raw_supply (E_E5_REGNUM,
+ (regp + MN10300_ELF_GREGSET_T_REG_INDEX_E5));
+ break;
+ case E_E6_REGNUM:
+ regcache->raw_supply (E_E6_REGNUM,
+ (regp + MN10300_ELF_GREGSET_T_REG_INDEX_E6));
+ break;
+ case E_E7_REGNUM:
+ regcache->raw_supply (E_E7_REGNUM,
+ (regp + MN10300_ELF_GREGSET_T_REG_INDEX_E7));
+ break;
+
+ /* ssp, msp, and usp are inaccessible. */
+ case E_E8_REGNUM:
+ regcache->raw_supply_zeroed (E_E8_REGNUM);
+ break;
+ case E_E9_REGNUM:
+ regcache->raw_supply_zeroed (E_E9_REGNUM);
+ break;
+ case E_E10_REGNUM:
+ regcache->raw_supply_zeroed (E_E10_REGNUM);
+ break;
+ case E_MCRH_REGNUM:
+ regcache->raw_supply (E_MCRH_REGNUM,
+ (regp + MN10300_ELF_GREGSET_T_REG_INDEX_MCRH));
+ break;
+ case E_MCRL_REGNUM:
+ regcache->raw_supply (E_MCRL_REGNUM,
+ (regp + MN10300_ELF_GREGSET_T_REG_INDEX_MCRL));
+ break;
+ case E_MCVF_REGNUM:
+ regcache->raw_supply (E_MCVF_REGNUM,
+ (regp + MN10300_ELF_GREGSET_T_REG_INDEX_MCVF));
+ break;
+ case E_FPCR_REGNUM:
+ /* FPCR is numbered among the GP regs, but handled as an FP reg.
Do nothing. */
- break;
- case E_FPCR_REGNUM + 1:
- /* The two unused registers beyond fpcr are inaccessible. */
- regcache->raw_supply_zeroed (E_FPCR_REGNUM + 1);
- break;
- case E_FPCR_REGNUM + 2:
- regcache->raw_supply_zeroed (E_FPCR_REGNUM + 2);
- break;
- default: /* An error, obviously, but should we error out? */
- break;
- case -1:
- for (i = 0; i < MN10300_ELF_NGREG; i++)
- am33_supply_gregset_method (regset, regcache, i, gregs, len);
- break;
- }
+ break;
+ case E_FPCR_REGNUM + 1:
+ /* The two unused registers beyond fpcr are inaccessible. */
+ regcache->raw_supply_zeroed (E_FPCR_REGNUM + 1);
+ break;
+ case E_FPCR_REGNUM + 2:
+ regcache->raw_supply_zeroed (E_FPCR_REGNUM + 2);
+ break;
+ default: /* An error, obviously, but should we error out? */
+ break;
+ case -1:
+ for (i = 0; i < MN10300_ELF_NGREG; i++)
+ am33_supply_gregset_method (regset, regcache, i, gregs, len);
+ break;
+ }
return;
}
@@ -233,9 +235,9 @@ am33_supply_gregset_method (const struct regset *regset,
If REGNUM is -1, do this for all fp registers in regset. */
static void
-am33_supply_fpregset_method (const struct regset *regset,
- struct regcache *regcache,
- int regnum, const void *fpregs, size_t len)
+am33_supply_fpregset_method (const struct regset *regset,
+ struct regcache *regcache, int regnum,
+ const void *fpregs, size_t len)
{
const mn10300_elf_fpregset_t *fpregset
= (const mn10300_elf_fpregset_t *) fpregs;
@@ -247,10 +249,10 @@ am33_supply_fpregset_method (const struct regset *regset,
int i;
for (i = 0; i < MN10300_ELF_NFPREG; i++)
- am33_supply_fpregset_method (regset, regcache,
- E_FS0_REGNUM + i, fpregs, len);
- am33_supply_fpregset_method (regset, regcache,
- E_FPCR_REGNUM, fpregs, len);
+ am33_supply_fpregset_method (regset, regcache, E_FS0_REGNUM + i,
+ fpregs, len);
+ am33_supply_fpregset_method (regset, regcache, E_FPCR_REGNUM, fpregs,
+ len);
}
else if (regnum == E_FPCR_REGNUM)
regcache->raw_supply (E_FPCR_REGNUM, &fpregset->fpcr);
@@ -264,157 +266,158 @@ am33_supply_fpregset_method (const struct regset *regset,
/* Copy register values from regcache to regset. */
static void
-am33_collect_gregset_method (const struct regset *regset,
- const struct regcache *regcache,
- int regnum, void *gregs, size_t len)
+am33_collect_gregset_method (const struct regset *regset,
+ const struct regcache *regcache, int regnum,
+ void *gregs, size_t len)
{
mn10300_elf_gregset_t *regp = (gdb_byte (*)[28][4]) gregs;
int i;
gdb_assert (len >= sizeof (mn10300_elf_gregset_t));
- switch (regnum) {
- case E_D0_REGNUM:
- regcache->raw_collect (E_D0_REGNUM,
- (regp + MN10300_ELF_GREGSET_T_REG_INDEX_D0));
- break;
- case E_D1_REGNUM:
- regcache->raw_collect (E_D1_REGNUM,
- (regp + MN10300_ELF_GREGSET_T_REG_INDEX_D1));
- break;
- case E_D2_REGNUM:
- regcache->raw_collect (E_D2_REGNUM,
- (regp + MN10300_ELF_GREGSET_T_REG_INDEX_D2));
- break;
- case E_D3_REGNUM:
- regcache->raw_collect (E_D3_REGNUM,
- (regp + MN10300_ELF_GREGSET_T_REG_INDEX_D3));
- break;
- case E_A0_REGNUM:
- regcache->raw_collect (E_A0_REGNUM,
- (regp + MN10300_ELF_GREGSET_T_REG_INDEX_A0));
- break;
- case E_A1_REGNUM:
- regcache->raw_collect (E_A1_REGNUM,
- (regp + MN10300_ELF_GREGSET_T_REG_INDEX_A1));
- break;
- case E_A2_REGNUM:
- regcache->raw_collect (E_A2_REGNUM,
- (regp + MN10300_ELF_GREGSET_T_REG_INDEX_A2));
- break;
- case E_A3_REGNUM:
- regcache->raw_collect (E_A3_REGNUM,
- (regp + MN10300_ELF_GREGSET_T_REG_INDEX_A3));
- break;
- case E_SP_REGNUM:
- regcache->raw_collect (E_SP_REGNUM,
- (regp + MN10300_ELF_GREGSET_T_REG_INDEX_SP));
- break;
- case E_PC_REGNUM:
- regcache->raw_collect (E_PC_REGNUM,
- (regp + MN10300_ELF_GREGSET_T_REG_INDEX_PC));
- break;
- case E_MDR_REGNUM:
- regcache->raw_collect (E_MDR_REGNUM,
- (regp + MN10300_ELF_GREGSET_T_REG_INDEX_MDR));
- break;
- case E_PSW_REGNUM:
- regcache->raw_collect (E_PSW_REGNUM,
- (regp + MN10300_ELF_GREGSET_T_REG_INDEX_EPSW));
- break;
- case E_LIR_REGNUM:
- regcache->raw_collect (E_LIR_REGNUM,
- (regp + MN10300_ELF_GREGSET_T_REG_INDEX_LIR));
- break;
- case E_LAR_REGNUM:
- regcache->raw_collect (E_LAR_REGNUM,
- (regp + MN10300_ELF_GREGSET_T_REG_INDEX_LAR));
- break;
- case E_MDRQ_REGNUM:
- regcache->raw_collect (E_MDRQ_REGNUM,
- (regp + MN10300_ELF_GREGSET_T_REG_INDEX_MDRQ));
- break;
- case E_E0_REGNUM:
- regcache->raw_collect (E_E0_REGNUM,
- (regp + MN10300_ELF_GREGSET_T_REG_INDEX_E0));
- break;
- case E_E1_REGNUM:
- regcache->raw_collect (E_E1_REGNUM,
- (regp + MN10300_ELF_GREGSET_T_REG_INDEX_E1));
- break;
- case E_E2_REGNUM:
- regcache->raw_collect (E_E2_REGNUM,
- (regp + MN10300_ELF_GREGSET_T_REG_INDEX_E2));
- break;
- case E_E3_REGNUM:
- regcache->raw_collect (E_E3_REGNUM,
- (regp + MN10300_ELF_GREGSET_T_REG_INDEX_E3));
- break;
- case E_E4_REGNUM:
- regcache->raw_collect (E_E4_REGNUM,
- (regp + MN10300_ELF_GREGSET_T_REG_INDEX_E4));
- break;
- case E_E5_REGNUM:
- regcache->raw_collect (E_E5_REGNUM,
- (regp + MN10300_ELF_GREGSET_T_REG_INDEX_E5));
- break;
- case E_E6_REGNUM:
- regcache->raw_collect (E_E6_REGNUM,
- (regp + MN10300_ELF_GREGSET_T_REG_INDEX_E6));
- break;
- case E_E7_REGNUM:
- regcache->raw_collect (E_E7_REGNUM,
- (regp + MN10300_ELF_GREGSET_T_REG_INDEX_E7));
- break;
-
- /* ssp, msp, and usp are inaccessible. */
- case E_E8_REGNUM:
- /* The gregset struct has noplace to put this: do nothing. */
- break;
- case E_E9_REGNUM:
- /* The gregset struct has noplace to put this: do nothing. */
- break;
- case E_E10_REGNUM:
- /* The gregset struct has noplace to put this: do nothing. */
- break;
- case E_MCRH_REGNUM:
- regcache->raw_collect (E_MCRH_REGNUM,
- (regp + MN10300_ELF_GREGSET_T_REG_INDEX_MCRH));
- break;
- case E_MCRL_REGNUM:
- regcache->raw_collect (E_MCRL_REGNUM,
- (regp + MN10300_ELF_GREGSET_T_REG_INDEX_MCRL));
- break;
- case E_MCVF_REGNUM:
- regcache->raw_collect (E_MCVF_REGNUM,
- (regp + MN10300_ELF_GREGSET_T_REG_INDEX_MCVF));
- break;
- case E_FPCR_REGNUM:
- /* FPCR is numbered among the GP regs, but handled as an FP reg.
+ switch (regnum)
+ {
+ case E_D0_REGNUM:
+ regcache->raw_collect (E_D0_REGNUM,
+ (regp + MN10300_ELF_GREGSET_T_REG_INDEX_D0));
+ break;
+ case E_D1_REGNUM:
+ regcache->raw_collect (E_D1_REGNUM,
+ (regp + MN10300_ELF_GREGSET_T_REG_INDEX_D1));
+ break;
+ case E_D2_REGNUM:
+ regcache->raw_collect (E_D2_REGNUM,
+ (regp + MN10300_ELF_GREGSET_T_REG_INDEX_D2));
+ break;
+ case E_D3_REGNUM:
+ regcache->raw_collect (E_D3_REGNUM,
+ (regp + MN10300_ELF_GREGSET_T_REG_INDEX_D3));
+ break;
+ case E_A0_REGNUM:
+ regcache->raw_collect (E_A0_REGNUM,
+ (regp + MN10300_ELF_GREGSET_T_REG_INDEX_A0));
+ break;
+ case E_A1_REGNUM:
+ regcache->raw_collect (E_A1_REGNUM,
+ (regp + MN10300_ELF_GREGSET_T_REG_INDEX_A1));
+ break;
+ case E_A2_REGNUM:
+ regcache->raw_collect (E_A2_REGNUM,
+ (regp + MN10300_ELF_GREGSET_T_REG_INDEX_A2));
+ break;
+ case E_A3_REGNUM:
+ regcache->raw_collect (E_A3_REGNUM,
+ (regp + MN10300_ELF_GREGSET_T_REG_INDEX_A3));
+ break;
+ case E_SP_REGNUM:
+ regcache->raw_collect (E_SP_REGNUM,
+ (regp + MN10300_ELF_GREGSET_T_REG_INDEX_SP));
+ break;
+ case E_PC_REGNUM:
+ regcache->raw_collect (E_PC_REGNUM,
+ (regp + MN10300_ELF_GREGSET_T_REG_INDEX_PC));
+ break;
+ case E_MDR_REGNUM:
+ regcache->raw_collect (E_MDR_REGNUM,
+ (regp + MN10300_ELF_GREGSET_T_REG_INDEX_MDR));
+ break;
+ case E_PSW_REGNUM:
+ regcache->raw_collect (E_PSW_REGNUM,
+ (regp + MN10300_ELF_GREGSET_T_REG_INDEX_EPSW));
+ break;
+ case E_LIR_REGNUM:
+ regcache->raw_collect (E_LIR_REGNUM,
+ (regp + MN10300_ELF_GREGSET_T_REG_INDEX_LIR));
+ break;
+ case E_LAR_REGNUM:
+ regcache->raw_collect (E_LAR_REGNUM,
+ (regp + MN10300_ELF_GREGSET_T_REG_INDEX_LAR));
+ break;
+ case E_MDRQ_REGNUM:
+ regcache->raw_collect (E_MDRQ_REGNUM,
+ (regp + MN10300_ELF_GREGSET_T_REG_INDEX_MDRQ));
+ break;
+ case E_E0_REGNUM:
+ regcache->raw_collect (E_E0_REGNUM,
+ (regp + MN10300_ELF_GREGSET_T_REG_INDEX_E0));
+ break;
+ case E_E1_REGNUM:
+ regcache->raw_collect (E_E1_REGNUM,
+ (regp + MN10300_ELF_GREGSET_T_REG_INDEX_E1));
+ break;
+ case E_E2_REGNUM:
+ regcache->raw_collect (E_E2_REGNUM,
+ (regp + MN10300_ELF_GREGSET_T_REG_INDEX_E2));
+ break;
+ case E_E3_REGNUM:
+ regcache->raw_collect (E_E3_REGNUM,
+ (regp + MN10300_ELF_GREGSET_T_REG_INDEX_E3));
+ break;
+ case E_E4_REGNUM:
+ regcache->raw_collect (E_E4_REGNUM,
+ (regp + MN10300_ELF_GREGSET_T_REG_INDEX_E4));
+ break;
+ case E_E5_REGNUM:
+ regcache->raw_collect (E_E5_REGNUM,
+ (regp + MN10300_ELF_GREGSET_T_REG_INDEX_E5));
+ break;
+ case E_E6_REGNUM:
+ regcache->raw_collect (E_E6_REGNUM,
+ (regp + MN10300_ELF_GREGSET_T_REG_INDEX_E6));
+ break;
+ case E_E7_REGNUM:
+ regcache->raw_collect (E_E7_REGNUM,
+ (regp + MN10300_ELF_GREGSET_T_REG_INDEX_E7));
+ break;
+
+ /* ssp, msp, and usp are inaccessible. */
+ case E_E8_REGNUM:
+ /* The gregset struct has noplace to put this: do nothing. */
+ break;
+ case E_E9_REGNUM:
+ /* The gregset struct has noplace to put this: do nothing. */
+ break;
+ case E_E10_REGNUM:
+ /* The gregset struct has noplace to put this: do nothing. */
+ break;
+ case E_MCRH_REGNUM:
+ regcache->raw_collect (E_MCRH_REGNUM,
+ (regp + MN10300_ELF_GREGSET_T_REG_INDEX_MCRH));
+ break;
+ case E_MCRL_REGNUM:
+ regcache->raw_collect (E_MCRL_REGNUM,
+ (regp + MN10300_ELF_GREGSET_T_REG_INDEX_MCRL));
+ break;
+ case E_MCVF_REGNUM:
+ regcache->raw_collect (E_MCVF_REGNUM,
+ (regp + MN10300_ELF_GREGSET_T_REG_INDEX_MCVF));
+ break;
+ case E_FPCR_REGNUM:
+ /* FPCR is numbered among the GP regs, but handled as an FP reg.
Do nothing. */
- break;
- case E_FPCR_REGNUM + 1:
- /* The gregset struct has noplace to put this: do nothing. */
- break;
- case E_FPCR_REGNUM + 2:
- /* The gregset struct has noplace to put this: do nothing. */
- break;
- default: /* An error, obviously, but should we error out? */
- break;
- case -1:
- for (i = 0; i < MN10300_ELF_NGREG; i++)
- am33_collect_gregset_method (regset, regcache, i, gregs, len);
- break;
- }
+ break;
+ case E_FPCR_REGNUM + 1:
+ /* The gregset struct has noplace to put this: do nothing. */
+ break;
+ case E_FPCR_REGNUM + 2:
+ /* The gregset struct has noplace to put this: do nothing. */
+ break;
+ default: /* An error, obviously, but should we error out? */
+ break;
+ case -1:
+ for (i = 0; i < MN10300_ELF_NGREG; i++)
+ am33_collect_gregset_method (regset, regcache, i, gregs, len);
+ break;
+ }
return;
}
/* Copy fp register values from regcache to regset. */
static void
-am33_collect_fpregset_method (const struct regset *regset,
- const struct regcache *regcache,
- int regnum, void *fpregs, size_t len)
+am33_collect_fpregset_method (const struct regset *regset,
+ const struct regcache *regcache, int regnum,
+ void *fpregs, size_t len)
{
mn10300_elf_fpregset_t *fpregset = (mn10300_elf_fpregset_t *) fpregs;
@@ -426,8 +429,8 @@ am33_collect_fpregset_method (const struct regset *regset,
for (i = 0; i < MN10300_ELF_NFPREG; i++)
am33_collect_fpregset_method (regset, regcache, E_FS0_REGNUM + i,
fpregs, len);
- am33_collect_fpregset_method (regset, regcache,
- E_FPCR_REGNUM, fpregs, len);
+ am33_collect_fpregset_method (regset, regcache, E_FPCR_REGNUM, fpregs,
+ len);
}
else if (regnum == E_FPCR_REGNUM)
regcache->raw_collect (E_FPCR_REGNUM, &fpregset->fpcr);
@@ -438,15 +441,11 @@ am33_collect_fpregset_method (const struct regset *regset,
return;
}
-static const struct regset am33_gregset =
- {
- NULL, am33_supply_gregset_method, am33_collect_gregset_method
- };
+static const struct regset am33_gregset
+ = { NULL, am33_supply_gregset_method, am33_collect_gregset_method };
-static const struct regset am33_fpregset =
- {
- NULL, am33_supply_fpregset_method, am33_collect_fpregset_method
- };
+static const struct regset am33_fpregset
+ = { NULL, am33_supply_fpregset_method, am33_collect_fpregset_method };
/* Iterate over core file register note sections. */
@@ -458,47 +457,39 @@ am33_iterate_over_regset_sections (struct gdbarch *gdbarch,
{
cb (".reg", sizeof (mn10300_elf_gregset_t), sizeof (mn10300_elf_gregset_t),
&am33_gregset, NULL, cb_data);
- cb (".reg2", sizeof (mn10300_elf_fpregset_t), sizeof (mn10300_elf_fpregset_t),
- &am33_fpregset, NULL, cb_data);
+ cb (".reg2", sizeof (mn10300_elf_fpregset_t),
+ sizeof (mn10300_elf_fpregset_t), &am33_fpregset, NULL, cb_data);
}
-
-static void
-am33_linux_sigframe_cache_init (const struct tramp_frame *self,
- frame_info_ptr this_frame,
- struct trad_frame_cache *this_cache,
- CORE_ADDR func);
-
-static const struct tramp_frame am33_linux_sigframe = {
- SIGTRAMP_FRAME,
- 1,
- {
- /* mov 119,d0 */
- { 0x2c, ULONGEST_MAX },
- { 0x77, ULONGEST_MAX },
- { 0x00, ULONGEST_MAX },
- /* syscall 0 */
- { 0xf0, ULONGEST_MAX },
- { 0xe0, ULONGEST_MAX },
- { TRAMP_SENTINEL_INSN, ULONGEST_MAX }
- },
- am33_linux_sigframe_cache_init
-};
-static const struct tramp_frame am33_linux_rt_sigframe = {
- SIGTRAMP_FRAME,
- 1,
- {
- /* mov 173,d0 */
- { 0x2c, ULONGEST_MAX },
- { 0xad, ULONGEST_MAX },
- { 0x00, ULONGEST_MAX },
- /* syscall 0 */
- { 0xf0, ULONGEST_MAX },
- { 0xe0, ULONGEST_MAX },
- { TRAMP_SENTINEL_INSN, ULONGEST_MAX }
- },
- am33_linux_sigframe_cache_init
-};
+static void am33_linux_sigframe_cache_init (
+ const struct tramp_frame *self, frame_info_ptr this_frame,
+ struct trad_frame_cache *this_cache, CORE_ADDR func);
+
+static const struct tramp_frame am33_linux_sigframe
+ = { SIGTRAMP_FRAME,
+ 1,
+ { /* mov 119,d0 */
+ { 0x2c, ULONGEST_MAX },
+ { 0x77, ULONGEST_MAX },
+ { 0x00, ULONGEST_MAX },
+ /* syscall 0 */
+ { 0xf0, ULONGEST_MAX },
+ { 0xe0, ULONGEST_MAX },
+ { TRAMP_SENTINEL_INSN, ULONGEST_MAX } },
+ am33_linux_sigframe_cache_init };
+
+static const struct tramp_frame am33_linux_rt_sigframe
+ = { SIGTRAMP_FRAME,
+ 1,
+ { /* mov 173,d0 */
+ { 0x2c, ULONGEST_MAX },
+ { 0xad, ULONGEST_MAX },
+ { 0x00, ULONGEST_MAX },
+ /* syscall 0 */
+ { 0xf0, ULONGEST_MAX },
+ { 0xe0, ULONGEST_MAX },
+ { TRAMP_SENTINEL_INSN, ULONGEST_MAX } },
+ am33_linux_sigframe_cache_init };
/* Relevant struct definitions for signal handling...
@@ -575,7 +566,6 @@ struct sigcontext {
unsigned long oldmask;
}; */
-
#define AM33_SIGCONTEXT_D0 0
#define AM33_SIGCONTEXT_D1 4
#define AM33_SIGCONTEXT_D2 8
@@ -604,7 +594,6 @@ struct sigcontext {
#define AM33_SIGCONTEXT_PC 100
#define AM33_SIGCONTEXT_FPUCONTEXT 104
-
static void
am33_linux_sigframe_cache_init (const struct tramp_frame *self,
frame_info_ptr this_frame,
@@ -682,9 +671,9 @@ am33_linux_sigframe_cache_init (const struct tramp_frame *self,
trad_frame_set_reg_addr (this_cache, E_PC_REGNUM,
sc_base + AM33_SIGCONTEXT_PC);
- fpubase = get_frame_memory_unsigned (this_frame,
- sc_base + AM33_SIGCONTEXT_FPUCONTEXT,
- 4);
+ fpubase
+ = get_frame_memory_unsigned (this_frame,
+ sc_base + AM33_SIGCONTEXT_FPUCONTEXT, 4);
if (fpubase)
{
for (i = 0; i < 32; i++)
@@ -697,7 +686,7 @@ am33_linux_sigframe_cache_init (const struct tramp_frame *self,
trad_frame_set_id (this_cache, frame_id_build (sc_base, func));
}
-
+
/* AM33 GNU/Linux osabi has been recognized.
Now's our chance to register our corefile handling. */
@@ -706,20 +695,20 @@ am33_linux_init_osabi (struct gdbarch_info info, struct gdbarch *gdbarch)
{
linux_init_abi (info, gdbarch, 0);
- set_gdbarch_iterate_over_regset_sections
- (gdbarch, am33_iterate_over_regset_sections);
- set_solib_svr4_fetch_link_map_offsets
- (gdbarch, linux_ilp32_fetch_link_map_offsets);
+ set_gdbarch_iterate_over_regset_sections (gdbarch,
+ am33_iterate_over_regset_sections);
+ set_solib_svr4_fetch_link_map_offsets (gdbarch,
+ linux_ilp32_fetch_link_map_offsets);
tramp_frame_prepend_unwinder (gdbarch, &am33_linux_sigframe);
tramp_frame_prepend_unwinder (gdbarch, &am33_linux_rt_sigframe);
}
void _initialize_mn10300_linux_tdep ();
+
void
_initialize_mn10300_linux_tdep ()
{
- gdbarch_register_osabi (bfd_arch_mn10300, 0,
- GDB_OSABI_LINUX, am33_linux_init_osabi);
+ gdbarch_register_osabi (bfd_arch_mn10300, 0, GDB_OSABI_LINUX,
+ am33_linux_init_osabi);
}
-
diff --git a/gdb/mn10300-tdep.c b/gdb/mn10300-tdep.c
index fa43e8b9851..b4df2e6d8f7 100644
--- a/gdb/mn10300-tdep.c
+++ b/gdb/mn10300-tdep.c
@@ -22,7 +22,7 @@
#include "dis-asm.h"
#include "gdbtypes.h"
#include "regcache.h"
-#include "gdbcore.h" /* For write_memory_unsigned_integer. */
+#include "gdbcore.h" /* For write_memory_unsigned_integer. */
#include "value.h"
#include "frame.h"
#include "frame-unwind.h"
@@ -36,12 +36,11 @@
#include "mn10300-tdep.h"
-
/* The am33-2 has 64 registers. */
#define MN10300_MAX_NUM_REGS 64
/* Big enough to hold the size of the largest register in bytes. */
-#define MN10300_MAX_REGISTER_SIZE 64
+#define MN10300_MAX_REGISTER_SIZE 64
/* This structure holds the results of a prologue analysis. */
struct mn10300_prologue
@@ -80,7 +79,6 @@ struct mn10300_prologue
int reg_offset[MN10300_MAX_NUM_REGS];
};
-
/* Compute the alignment required by a type. */
static int
@@ -124,7 +122,7 @@ mn10300_type_align (struct type *type)
return mn10300_type_align (check_typedef (type));
default:
- internal_error (_("bad switch"));
+ internal_error (_ ("bad switch"));
}
}
@@ -173,7 +171,7 @@ mn10300_store_return_value (struct gdbarch *gdbarch, struct type *type,
{
int len = type->length ();
int reg, regsz;
-
+
if (type->code () == TYPE_CODE_PTR)
reg = 4;
else
@@ -190,7 +188,7 @@ mn10300_store_return_value (struct gdbarch *gdbarch, struct type *type,
regcache->raw_write_part (reg + 1, 0, len - regsz, valbuf + regsz);
}
else
- internal_error (_("Cannot store return value %d bytes long."), len);
+ internal_error (_ ("Cannot store return value %d bytes long."), len);
}
static void
@@ -222,7 +220,7 @@ mn10300_extract_return_value (struct gdbarch *gdbarch, struct type *type,
memcpy ((char *) valbuf + regsz, buf, len - regsz);
}
else
- internal_error (_("Cannot extract return value %d bytes long."), len);
+ internal_error (_ ("Cannot extract return value %d bytes long."), len);
}
/* Determine, for architecture GDBARCH, how a return value of TYPE
@@ -257,42 +255,36 @@ register_name (int reg, const char **regs, long num_regs)
static const char *
mn10300_generic_register_name (struct gdbarch *gdbarch, int reg)
{
- static const char *regs[] =
- { "d0", "d1", "d2", "d3", "a0", "a1", "a2", "a3",
- "sp", "pc", "mdr", "psw", "lir", "lar", "", "",
- "", "", "", "", "", "", "", "",
- "", "", "", "", "", "", "", "fp"
- };
+ static const char *regs[]
+ = { "d0", "d1", "d2", "d3", "a0", "a1", "a2", "a3", "sp", "pc", "mdr",
+ "psw", "lir", "lar", "", "", "", "", "", "", "", "",
+ "", "", "", "", "", "", "", "", "", "fp" };
return register_name (reg, regs, ARRAY_SIZE (regs));
}
-
static const char *
am33_register_name (struct gdbarch *gdbarch, int reg)
{
- static const char *regs[] =
- { "d0", "d1", "d2", "d3", "a0", "a1", "a2", "a3",
- "sp", "pc", "mdr", "psw", "lir", "lar", "",
- "r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7",
- "ssp", "msp", "usp", "mcrh", "mcrl", "mcvf", "", "", ""
- };
+ static const char *regs[]
+ = { "d0", "d1", "d2", "d3", "a0", "a1", "a2", "a3",
+ "sp", "pc", "mdr", "psw", "lir", "lar", "", "r0",
+ "r1", "r2", "r3", "r4", "r5", "r6", "r7", "ssp",
+ "msp", "usp", "mcrh", "mcrl", "mcvf", "", "", "" };
return register_name (reg, regs, ARRAY_SIZE (regs));
}
static const char *
am33_2_register_name (struct gdbarch *gdbarch, int reg)
{
- static const char *regs[] =
- {
- "d0", "d1", "d2", "d3", "a0", "a1", "a2", "a3",
- "sp", "pc", "mdr", "psw", "lir", "lar", "mdrq", "r0",
- "r1", "r2", "r3", "r4", "r5", "r6", "r7", "ssp",
- "msp", "usp", "mcrh", "mcrl", "mcvf", "fpcr", "", "",
- "fs0", "fs1", "fs2", "fs3", "fs4", "fs5", "fs6", "fs7",
- "fs8", "fs9", "fs10", "fs11", "fs12", "fs13", "fs14", "fs15",
- "fs16", "fs17", "fs18", "fs19", "fs20", "fs21", "fs22", "fs23",
- "fs24", "fs25", "fs26", "fs27", "fs28", "fs29", "fs30", "fs31"
- };
+ static const char *regs[]
+ = { "d0", "d1", "d2", "d3", "a0", "a1", "a2", "a3",
+ "sp", "pc", "mdr", "psw", "lir", "lar", "mdrq", "r0",
+ "r1", "r2", "r3", "r4", "r5", "r6", "r7", "ssp",
+ "msp", "usp", "mcrh", "mcrl", "mcvf", "fpcr", "", "",
+ "fs0", "fs1", "fs2", "fs3", "fs4", "fs5", "fs6", "fs7",
+ "fs8", "fs9", "fs10", "fs11", "fs12", "fs13", "fs14", "fs15",
+ "fs16", "fs17", "fs18", "fs19", "fs20", "fs21", "fs22", "fs23",
+ "fs24", "fs25", "fs26", "fs27", "fs28", "fs29", "fs30", "fs31" };
return register_name (reg, regs, ARRAY_SIZE (regs));
}
@@ -308,7 +300,7 @@ mn10300_register_type (struct gdbarch *gdbarch, int reg)
The Matsushita mn10x00 processors have single byte instructions
so we need a single byte breakpoint. Matsushita hasn't defined
one, so we defined it ourselves. */
-constexpr gdb_byte mn10300_break_insn[] = {0xff};
+constexpr gdb_byte mn10300_break_insn[] = { 0xff };
typedef BP_MANIPULATION (mn10300_break_insn) mn10300_breakpoint;
@@ -327,7 +319,7 @@ push_reg (pv_t *regs, struct pv_area *stack, int regnum)
static int
translate_rreg (int rreg)
{
- /* The higher register numbers actually correspond to the
+ /* The higher register numbers actually correspond to the
basic machine's address and data registers. */
if (rreg > 7 && rreg < 12)
return E_A0_REGNUM + rreg - 8;
@@ -347,8 +339,7 @@ check_for_saved (void *result_untyped, pv_t addr, CORE_ADDR size, pv_t value)
{
struct mn10300_prologue *result = (struct mn10300_prologue *) result_untyped;
- if (value.kind == pvk_register
- && value.k == 0
+ if (value.kind == pvk_register && value.k == 0
&& pv_is_register (addr, E_SP_REGNUM)
&& size == register_size (result->gdbarch, value.reg))
result->reg_offset[value.reg] = addr.k;
@@ -359,9 +350,8 @@ check_for_saved (void *result_untyped, pv_t addr, CORE_ADDR size, pv_t value)
returned in RESULT. See struct mn10300_prologue above for more
information. */
static void
-mn10300_analyze_prologue (struct gdbarch *gdbarch,
- CORE_ADDR start_pc, CORE_ADDR limit_pc,
- struct mn10300_prologue *result)
+mn10300_analyze_prologue (struct gdbarch *gdbarch, CORE_ADDR start_pc,
+ CORE_ADDR limit_pc, struct mn10300_prologue *result)
{
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
CORE_ADDR pc;
@@ -514,7 +504,6 @@ mn10300_analyze_prologue (struct gdbarch *gdbarch,
gdb_byte buf[1];
LONGEST imm8;
-
status = target_read_memory (pc + 2, buf, 1);
if (status != 0)
break;
@@ -553,7 +542,6 @@ mn10300_analyze_prologue (struct gdbarch *gdbarch,
if (status != 0)
break;
-
imm32 = extract_signed_integer (buf, 4, byte_order);
regs[E_SP_REGNUM] = pv_add_constant (regs[E_SP_REGNUM], imm32);
@@ -570,8 +558,8 @@ mn10300_analyze_prologue (struct gdbarch *gdbarch,
aN = instr[0] & 0x03;
imm8 = extract_signed_integer (&instr[1], 1, byte_order);
- regs[E_A0_REGNUM + aN] = pv_add_constant (regs[E_A0_REGNUM + aN],
- imm8);
+ regs[E_A0_REGNUM + aN]
+ = pv_add_constant (regs[E_A0_REGNUM + aN], imm8);
pc += 2;
}
@@ -588,11 +576,10 @@ mn10300_analyze_prologue (struct gdbarch *gdbarch,
if (status != 0)
break;
-
imm16 = extract_signed_integer (buf, 2, byte_order);
- regs[E_A0_REGNUM + aN] = pv_add_constant (regs[E_A0_REGNUM + aN],
- imm16);
+ regs[E_A0_REGNUM + aN]
+ = pv_add_constant (regs[E_A0_REGNUM + aN], imm16);
pc += 4;
}
@@ -611,8 +598,8 @@ mn10300_analyze_prologue (struct gdbarch *gdbarch,
imm32 = extract_signed_integer (buf, 2, byte_order);
- regs[E_A0_REGNUM + aN] = pv_add_constant (regs[E_A0_REGNUM + aN],
- imm32);
+ regs[E_A0_REGNUM + aN]
+ = pv_add_constant (regs[E_A0_REGNUM + aN], imm32);
pc += 6;
}
/* fmov fsM, (rN) */
@@ -631,8 +618,7 @@ mn10300_analyze_prologue (struct gdbarch *gdbarch,
rN = buf[0] & 0x0f;
fsM = (Y << 4) | sM;
- stack.store (regs[translate_rreg (rN)], 4,
- regs[E_FS0_REGNUM + fsM]);
+ stack.store (regs[translate_rreg (rN)], 4, regs[E_FS0_REGNUM + fsM]);
pc += 3;
}
@@ -651,8 +637,7 @@ mn10300_analyze_prologue (struct gdbarch *gdbarch,
sM = (buf[0] & 0xf0) >> 4;
fsM = (Y << 4) | sM;
- stack.store (regs[E_SP_REGNUM], 4,
- regs[E_FS0_REGNUM + fsM]);
+ stack.store (regs[E_SP_REGNUM], 4, regs[E_FS0_REGNUM + fsM]);
pc += 3;
}
@@ -662,7 +647,6 @@ mn10300_analyze_prologue (struct gdbarch *gdbarch,
int fsM, sM, Z, rN, rI;
gdb_byte buf[2];
-
status = target_read_memory (pc + 2, buf, 2);
if (status != 0)
break;
@@ -697,8 +681,8 @@ mn10300_analyze_prologue (struct gdbarch *gdbarch,
fsM = (Y << 4) | sM;
d8 = extract_signed_integer (&buf[1], 1, byte_order);
- stack.store (pv_add_constant (regs[translate_rreg (rN)], d8),
- 4, regs[E_FS0_REGNUM + fsM]);
+ stack.store (pv_add_constant (regs[translate_rreg (rN)], d8), 4,
+ regs[E_FS0_REGNUM + fsM]);
pc += 4;
}
@@ -720,8 +704,8 @@ mn10300_analyze_prologue (struct gdbarch *gdbarch,
fsM = (Y << 4) | sM;
d24 = extract_signed_integer (&buf[1], 3, byte_order);
- stack.store (pv_add_constant (regs[translate_rreg (rN)], d24),
- 4, regs[E_FS0_REGNUM + fsM]);
+ stack.store (pv_add_constant (regs[translate_rreg (rN)], d24), 4,
+ regs[E_FS0_REGNUM + fsM]);
pc += 6;
}
@@ -743,8 +727,8 @@ mn10300_analyze_prologue (struct gdbarch *gdbarch,
fsM = (Y << 4) | sM;
d32 = extract_signed_integer (&buf[1], 4, byte_order);
- stack.store (pv_add_constant (regs[translate_rreg (rN)], d32),
- 4, regs[E_FS0_REGNUM + fsM]);
+ stack.store (pv_add_constant (regs[translate_rreg (rN)], d32), 4,
+ regs[E_FS0_REGNUM + fsM]);
pc += 7;
}
@@ -765,8 +749,8 @@ mn10300_analyze_prologue (struct gdbarch *gdbarch,
fsM = (Y << 4) | sM;
d8 = extract_signed_integer (&buf[1], 1, byte_order);
- stack.store (pv_add_constant (regs[E_SP_REGNUM], d8),
- 4, regs[E_FS0_REGNUM + fsM]);
+ stack.store (pv_add_constant (regs[E_SP_REGNUM], d8), 4,
+ regs[E_FS0_REGNUM + fsM]);
pc += 4;
}
@@ -787,8 +771,8 @@ mn10300_analyze_prologue (struct gdbarch *gdbarch,
fsM = (Y << 4) | sM;
d24 = extract_signed_integer (&buf[1], 3, byte_order);
- stack.store (pv_add_constant (regs[E_SP_REGNUM], d24),
- 4, regs[E_FS0_REGNUM + fsM]);
+ stack.store (pv_add_constant (regs[E_SP_REGNUM], d24), 4,
+ regs[E_FS0_REGNUM + fsM]);
pc += 6;
}
@@ -809,8 +793,8 @@ mn10300_analyze_prologue (struct gdbarch *gdbarch,
fsM = (Y << 4) | sM;
d32 = extract_signed_integer (&buf[1], 4, byte_order);
- stack.store (pv_add_constant (regs[E_SP_REGNUM], d32),
- 4, regs[E_FS0_REGNUM + fsM]);
+ stack.store (pv_add_constant (regs[E_SP_REGNUM], d32), 4,
+ regs[E_FS0_REGNUM + fsM]);
pc += 7;
}
@@ -832,8 +816,7 @@ mn10300_analyze_prologue (struct gdbarch *gdbarch,
rN_regnum = translate_rreg (rN);
- stack.store (regs[rN_regnum], 4,
- regs[E_FS0_REGNUM + fsM]);
+ stack.store (regs[rN_regnum], 4, regs[E_FS0_REGNUM + fsM]);
regs[rN_regnum] = pv_add_constant (regs[rN_regnum], 4);
pc += 3;
@@ -1043,7 +1026,7 @@ mn10300_skip_prologue (struct gdbarch *gdbarch, CORE_ADDR pc)
invoke mn10300_analyze_prologue and return its result. */
static struct mn10300_prologue *
mn10300_analyze_frame_prologue (frame_info_ptr this_frame,
- void **this_prologue_cache)
+ void **this_prologue_cache)
{
if (!*this_prologue_cache)
{
@@ -1059,10 +1042,9 @@ mn10300_analyze_frame_prologue (frame_info_ptr this_frame,
if (!func_start)
stop_addr = func_start;
- mn10300_analyze_prologue (get_frame_arch (this_frame),
- func_start, stop_addr,
- ((struct mn10300_prologue *)
- *this_prologue_cache));
+ mn10300_analyze_prologue (
+ get_frame_arch (this_frame), func_start, stop_addr,
+ ((struct mn10300_prologue *) *this_prologue_cache));
}
return (struct mn10300_prologue *) *this_prologue_cache;
@@ -1095,14 +1077,12 @@ mn10300_frame_base (frame_info_ptr this_frame, void **this_prologue_cache)
}
static void
-mn10300_frame_this_id (frame_info_ptr this_frame,
- void **this_prologue_cache,
+mn10300_frame_this_id (frame_info_ptr this_frame, void **this_prologue_cache,
struct frame_id *this_id)
{
- *this_id = frame_id_build (mn10300_frame_base (this_frame,
- this_prologue_cache),
- get_frame_func (this_frame));
-
+ *this_id
+ = frame_id_build (mn10300_frame_base (this_frame, this_prologue_cache),
+ get_frame_func (this_frame));
}
static struct value *
@@ -1127,15 +1107,14 @@ mn10300_frame_prev_register (frame_info_ptr this_frame,
return frame_unwind_got_register (this_frame, regnum, regnum);
}
-static const struct frame_unwind mn10300_frame_unwind = {
- "mn10300 prologue",
- NORMAL_FRAME,
- default_frame_unwind_stop_reason,
- mn10300_frame_this_id,
- mn10300_frame_prev_register,
- NULL,
- default_frame_sniffer
-};
+static const struct frame_unwind mn10300_frame_unwind
+ = { "mn10300 prologue",
+ NORMAL_FRAME,
+ default_frame_unwind_stop_reason,
+ mn10300_frame_this_id,
+ mn10300_frame_prev_register,
+ NULL,
+ default_frame_sniffer };
static void
mn10300_frame_unwind_init (struct gdbarch *gdbarch)
@@ -1152,19 +1131,16 @@ mn10300_frame_unwind_init (struct gdbarch *gdbarch)
*/
static CORE_ADDR
-mn10300_push_dummy_call (struct gdbarch *gdbarch,
- struct value *target_func,
- struct regcache *regcache,
- CORE_ADDR bp_addr,
- int nargs, struct value **args,
- CORE_ADDR sp,
+mn10300_push_dummy_call (struct gdbarch *gdbarch, struct value *target_func,
+ struct regcache *regcache, CORE_ADDR bp_addr,
+ int nargs, struct value **args, CORE_ADDR sp,
function_call_return_method return_method,
CORE_ADDR struct_addr)
{
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
const int push_size = register_size (gdbarch, E_PC_REGNUM);
int regs_used;
- int len, arg_len;
+ int len, arg_len;
int stack_offset = 0;
int argnum;
const gdb_byte *val;
@@ -1223,8 +1199,9 @@ mn10300_push_dummy_call (struct gdbarch *gdbarch,
while (regs_used < 2 && arg_len > 0)
{
- regcache_cooked_write_unsigned (regcache, regs_used,
- extract_unsigned_integer (val, push_size, byte_order));
+ regcache_cooked_write_unsigned (
+ regcache, regs_used,
+ extract_unsigned_integer (val, push_size, byte_order));
val += push_size;
arg_len -= push_size;
regs_used++;
@@ -1274,7 +1251,7 @@ mn10300_push_dummy_call (struct gdbarch *gdbarch,
construct the frame ID of the dummy call. */
{
CORE_ADDR func_addr = find_function_addr (target_func, NULL);
- CORE_ADDR unwound_sp
+ CORE_ADDR unwound_sp
= gdbarch_unwind_sp (gdbarch, create_new_frame (sp, func_addr));
if (sp != unwound_sp)
regcache_cooked_write_unsigned (regcache, E_SP_REGNUM,
@@ -1298,39 +1275,42 @@ mn10300_dwarf2_reg_to_regnum (struct gdbarch *gdbarch, int dwarf2)
initializer in gcc/config/mn10300/mn10300.h. Registers which
appear in GCC's numbering, but have no counterpart in GDB's
world, are marked with a -1. */
- static int dwarf2_to_gdb[] = {
- E_D0_REGNUM, E_D1_REGNUM, E_D2_REGNUM, E_D3_REGNUM,
- E_A0_REGNUM, E_A1_REGNUM, E_A2_REGNUM, E_A3_REGNUM,
- -1, E_SP_REGNUM,
+ static int dwarf2_to_gdb[]
+ = { E_D0_REGNUM, E_D1_REGNUM, E_D2_REGNUM,
+ E_D3_REGNUM, E_A0_REGNUM, E_A1_REGNUM,
+ E_A2_REGNUM, E_A3_REGNUM, -1,
+ E_SP_REGNUM,
- E_E0_REGNUM, E_E1_REGNUM, E_E2_REGNUM, E_E3_REGNUM,
- E_E4_REGNUM, E_E5_REGNUM, E_E6_REGNUM, E_E7_REGNUM,
+ E_E0_REGNUM, E_E1_REGNUM, E_E2_REGNUM,
+ E_E3_REGNUM, E_E4_REGNUM, E_E5_REGNUM,
+ E_E6_REGNUM, E_E7_REGNUM,
- E_FS0_REGNUM + 0, E_FS0_REGNUM + 1, E_FS0_REGNUM + 2, E_FS0_REGNUM + 3,
- E_FS0_REGNUM + 4, E_FS0_REGNUM + 5, E_FS0_REGNUM + 6, E_FS0_REGNUM + 7,
+ E_FS0_REGNUM + 0, E_FS0_REGNUM + 1, E_FS0_REGNUM + 2,
+ E_FS0_REGNUM + 3, E_FS0_REGNUM + 4, E_FS0_REGNUM + 5,
+ E_FS0_REGNUM + 6, E_FS0_REGNUM + 7,
- E_FS0_REGNUM + 8, E_FS0_REGNUM + 9, E_FS0_REGNUM + 10, E_FS0_REGNUM + 11,
- E_FS0_REGNUM + 12, E_FS0_REGNUM + 13, E_FS0_REGNUM + 14, E_FS0_REGNUM + 15,
+ E_FS0_REGNUM + 8, E_FS0_REGNUM + 9, E_FS0_REGNUM + 10,
+ E_FS0_REGNUM + 11, E_FS0_REGNUM + 12, E_FS0_REGNUM + 13,
+ E_FS0_REGNUM + 14, E_FS0_REGNUM + 15,
- E_FS0_REGNUM + 16, E_FS0_REGNUM + 17, E_FS0_REGNUM + 18, E_FS0_REGNUM + 19,
- E_FS0_REGNUM + 20, E_FS0_REGNUM + 21, E_FS0_REGNUM + 22, E_FS0_REGNUM + 23,
+ E_FS0_REGNUM + 16, E_FS0_REGNUM + 17, E_FS0_REGNUM + 18,
+ E_FS0_REGNUM + 19, E_FS0_REGNUM + 20, E_FS0_REGNUM + 21,
+ E_FS0_REGNUM + 22, E_FS0_REGNUM + 23,
- E_FS0_REGNUM + 24, E_FS0_REGNUM + 25, E_FS0_REGNUM + 26, E_FS0_REGNUM + 27,
- E_FS0_REGNUM + 28, E_FS0_REGNUM + 29, E_FS0_REGNUM + 30, E_FS0_REGNUM + 31,
+ E_FS0_REGNUM + 24, E_FS0_REGNUM + 25, E_FS0_REGNUM + 26,
+ E_FS0_REGNUM + 27, E_FS0_REGNUM + 28, E_FS0_REGNUM + 29,
+ E_FS0_REGNUM + 30, E_FS0_REGNUM + 31,
- E_MDR_REGNUM, E_PSW_REGNUM, E_PC_REGNUM
- };
+ E_MDR_REGNUM, E_PSW_REGNUM, E_PC_REGNUM };
- if (dwarf2 < 0
- || dwarf2 >= ARRAY_SIZE (dwarf2_to_gdb))
+ if (dwarf2 < 0 || dwarf2 >= ARRAY_SIZE (dwarf2_to_gdb))
return -1;
return dwarf2_to_gdb[dwarf2];
}
static struct gdbarch *
-mn10300_gdbarch_init (struct gdbarch_info info,
- struct gdbarch_list *arches)
+mn10300_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
{
int num_regs;
@@ -1362,7 +1342,7 @@ mn10300_gdbarch_init (struct gdbarch_info info,
set_gdbarch_fp0_regnum (gdbarch, 32);
break;
default:
- internal_error (_("mn10300_gdbarch_init: Unknown mn10300 variant"));
+ internal_error (_ ("mn10300_gdbarch_init: Unknown mn10300 variant"));
break;
}
@@ -1388,12 +1368,11 @@ mn10300_gdbarch_init (struct gdbarch_info info,
/* Stage 2 */
set_gdbarch_return_value (gdbarch, mn10300_return_value);
-
+
/* Stage 3 -- get target calls working. */
set_gdbarch_push_dummy_call (gdbarch, mn10300_push_dummy_call);
/* set_gdbarch_return_value (store, extract) */
-
mn10300_frame_unwind_init (gdbarch);
/* Hook in ABI-specific overrides, if they have been registered. */
@@ -1401,21 +1380,20 @@ mn10300_gdbarch_init (struct gdbarch_info info,
return gdbarch;
}
-
+
/* Dump out the mn10300 specific architecture information. */
static void
mn10300_dump_tdep (struct gdbarch *gdbarch, struct ui_file *file)
{
mn10300_gdbarch_tdep *tdep = gdbarch_tdep<mn10300_gdbarch_tdep> (gdbarch);
- gdb_printf (file, "mn10300_dump_tdep: am33_mode = %d\n",
- tdep->am33_mode);
+ gdb_printf (file, "mn10300_dump_tdep: am33_mode = %d\n", tdep->am33_mode);
}
void _initialize_mn10300_tdep ();
+
void
_initialize_mn10300_tdep ()
{
gdbarch_register (bfd_arch_mn10300, mn10300_gdbarch_init, mn10300_dump_tdep);
}
-
diff --git a/gdb/mn10300-tdep.h b/gdb/mn10300-tdep.h
index 2e394c92b97..4139db4f987 100644
--- a/gdb/mn10300-tdep.h
+++ b/gdb/mn10300-tdep.h
@@ -22,7 +22,8 @@
#include "gdbarch.h"
-enum {
+enum
+{
E_D0_REGNUM = 0,
E_D1_REGNUM = 1,
E_D2_REGNUM = 2,
@@ -56,20 +57,22 @@ enum {
E_FS0_REGNUM = 32
};
-enum movm_register_bits {
+enum movm_register_bits
+{
movm_exother_bit = 0x01,
- movm_exreg1_bit = 0x02,
- movm_exreg0_bit = 0x04,
- movm_other_bit = 0x08,
- movm_a3_bit = 0x10,
- movm_a2_bit = 0x20,
- movm_d3_bit = 0x40,
- movm_d2_bit = 0x80
+ movm_exreg1_bit = 0x02,
+ movm_exreg0_bit = 0x04,
+ movm_other_bit = 0x08,
+ movm_a3_bit = 0x10,
+ movm_a2_bit = 0x20,
+ movm_d3_bit = 0x40,
+ movm_d2_bit = 0x80
};
/* Values for frame_info.status. */
-enum frame_kind {
+enum frame_kind
+{
MY_FRAME_IN_SP = 0x1,
MY_FRAME_IN_FP = 0x2,
NO_MORE_FRAMES = 0x4
diff --git a/gdb/moxie-tdep.c b/gdb/moxie-tdep.c
index 9154d488499..807c9d164f3 100644
--- a/gdb/moxie-tdep.c
+++ b/gdb/moxie-tdep.c
@@ -42,7 +42,10 @@
#include <algorithm>
/* Use an invalid address value as 'not available' marker. */
-enum { REG_UNAVAIL = (CORE_ADDR) -1 };
+enum
+{
+ REG_UNAVAIL = (CORE_ADDR) -1
+};
struct moxie_frame_cache
{
@@ -70,11 +73,9 @@ typedef BP_MANIPULATION (moxie_break_insn) moxie_breakpoint;
/* Moxie register names. */
-static const char * const moxie_register_names[] = {
- "$fp", "$sp", "$r0", "$r1", "$r2",
- "$r3", "$r4", "$r5", "$r6", "$r7",
- "$r8", "$r9", "$r10", "$r11", "$r12",
- "$r13", "$pc", "$cc" };
+static const char *const moxie_register_names[]
+ = { "$fp", "$sp", "$r0", "$r1", "$r2", "$r3", "$r4", "$r5", "$r6",
+ "$r7", "$r8", "$r9", "$r10", "$r11", "$r12", "$r13", "$pc", "$cc" };
/* Implement the "register_name" gdbarch method. */
@@ -91,7 +92,7 @@ static struct type *
moxie_register_type (struct gdbarch *gdbarch, int reg_nr)
{
if (reg_nr == MOXIE_PC_REGNUM)
- return builtin_type (gdbarch)->builtin_func_ptr;
+ return builtin_type (gdbarch)->builtin_func_ptr;
else if (reg_nr == MOXIE_SP_REGNUM || reg_nr == MOXIE_FP_REGNUM)
return builtin_type (gdbarch)->builtin_data_ptr;
else
@@ -103,7 +104,7 @@ moxie_register_type (struct gdbarch *gdbarch, int reg_nr)
static void
moxie_store_return_value (struct type *type, struct regcache *regcache,
- const gdb_byte *valbuf)
+ const gdb_byte *valbuf)
{
struct gdbarch *gdbarch = regcache->arch ();
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
@@ -145,7 +146,7 @@ moxie_analyze_prologue (CORE_ADDR start_addr, CORE_ADDR end_addr,
if (start_addr >= end_addr)
return end_addr;
- for (next_addr = start_addr; next_addr < end_addr; )
+ for (next_addr = start_addr; next_addr < end_addr;)
{
inst = read_memory_unsigned_integer (next_addr, 2, byte_order);
@@ -165,19 +166,19 @@ moxie_analyze_prologue (CORE_ADDR start_addr, CORE_ADDR end_addr,
/* Optional stack allocation for args and local vars <= 4
byte. */
- if (inst == 0x01e0) /* ldi.l $r12, X */
+ if (inst == 0x01e0) /* ldi.l $r12, X */
{
offset = read_memory_integer (next_addr + 2, 4, byte_order);
inst2 = read_memory_unsigned_integer (next_addr + 6, 2, byte_order);
-
- if (inst2 == 0x291e) /* sub.l $sp, $r12 */
+
+ if (inst2 == 0x291e) /* sub.l $sp, $r12 */
{
cache->framesize += offset;
}
-
+
return (next_addr + 8);
}
- else if ((inst & 0xff00) == 0x9100) /* dec $sp, X */
+ else if ((inst & 0xff00) == 0x9100) /* dec $sp, X */
{
cache->framesize += (inst & 0x00ff);
next_addr += 2;
@@ -220,11 +221,11 @@ moxie_skip_prologue (struct gdbarch *gdbarch, CORE_ADDR pc)
struct symbol *sym;
struct moxie_frame_cache cache;
CORE_ADDR plg_end;
-
+
memset (&cache, 0, sizeof cache);
-
- plg_end = moxie_analyze_prologue (func_addr,
- func_end, &cache, gdbarch);
+
+ plg_end
+ = moxie_analyze_prologue (func_addr, func_end, &cache, gdbarch);
/* Found a function. */
sym = lookup_symbol (func_name, NULL, VAR_DOMAIN, NULL).symbol;
/* Don't use line number debug info for assembly source
@@ -270,15 +271,15 @@ struct moxie_unwind_cache
/* Read an unsigned integer from the inferior, and adjust
endianness. */
static ULONGEST
-moxie_process_readu (CORE_ADDR addr, gdb_byte *buf,
- int length, enum bfd_endian byte_order)
+moxie_process_readu (CORE_ADDR addr, gdb_byte *buf, int length,
+ enum bfd_endian byte_order)
{
if (target_read_memory (addr, buf, length))
{
if (record_debug)
gdb_printf (gdb_stderr,
- _("Process record: error reading memory at "
- "addr 0x%s len = %d.\n"),
+ _ ("Process record: error reading memory at "
+ "addr 0x%s len = %d.\n"),
paddress (target_gdbarch (), addr), length);
return -1;
}
@@ -286,10 +287,10 @@ moxie_process_readu (CORE_ADDR addr, gdb_byte *buf,
return extract_unsigned_integer (buf, length, byte_order);
}
-
/* Helper macro to extract the signed 10-bit offset from a 16-bit
branch instruction. */
-#define INST2OFFSET(o) ((((signed short)((o & ((1<<10)-1))<<6))>>6)<<1)
+#define INST2OFFSET(o) \
+ ((((signed short) ((o & ((1 << 10) - 1)) << 6)) >> 6) << 1)
/* Insert a single step breakpoint. */
@@ -332,7 +333,7 @@ moxie_software_single_step (struct regcache *regcache)
/* Insert breaks on both branches, because we can't currently tell
which way things will go. */
next_pcs.push_back (addr + 2);
- next_pcs.push_back (addr + 2 + INST2OFFSET(inst));
+ next_pcs.push_back (addr + 2 + INST2OFFSET (inst));
break;
default:
{
@@ -426,12 +427,13 @@ moxie_software_single_step (struct regcache *regcache)
case 0x04: /* ret */
regcache_cooked_read_unsigned (regcache, MOXIE_FP_REGNUM, &fp);
- next_pcs.push_back (moxie_process_readu (fp + 4, buf, 4, byte_order));
+ next_pcs.push_back (moxie_process_readu (fp + 4, buf, 4,
+ byte_order));
break;
case 0x19: /* jsr */
case 0x25: /* jmp */
- regcache->raw_read ((inst >> 4) & 0xf, (gdb_byte *) & tmpu32);
+ regcache->raw_read ((inst >> 4) & 0xf, (gdb_byte *) &tmpu32);
next_pcs.push_back (tmpu32);
break;
@@ -475,8 +477,8 @@ moxie_extract_return_value (struct type *type, struct regcache *regcache,
static enum return_value_convention
moxie_return_value (struct gdbarch *gdbarch, struct value *function,
- struct type *valtype, struct regcache *regcache,
- gdb_byte *readbuf, const gdb_byte *writebuf)
+ struct type *valtype, struct regcache *regcache,
+ gdb_byte *readbuf, const gdb_byte *writebuf)
{
if (valtype->length () > 8)
return RETURN_VALUE_STRUCT_CONVENTION;
@@ -550,11 +552,11 @@ moxie_frame_cache (frame_info_ptr this_frame, void **this_cache)
frame. This will be used to create a new GDB frame struct. */
static void
-moxie_frame_this_id (frame_info_ptr this_frame,
- void **this_prologue_cache, struct frame_id *this_id)
+moxie_frame_this_id (frame_info_ptr this_frame, void **this_prologue_cache,
+ struct frame_id *this_id)
{
- struct moxie_frame_cache *cache = moxie_frame_cache (this_frame,
- this_prologue_cache);
+ struct moxie_frame_cache *cache
+ = moxie_frame_cache (this_frame, this_prologue_cache);
/* This marks the outermost frame. */
if (cache->base == 0)
@@ -567,10 +569,10 @@ moxie_frame_this_id (frame_info_ptr this_frame,
static struct value *
moxie_frame_prev_register (frame_info_ptr this_frame,
- void **this_prologue_cache, int regnum)
+ void **this_prologue_cache, int regnum)
{
- struct moxie_frame_cache *cache = moxie_frame_cache (this_frame,
- this_prologue_cache);
+ struct moxie_frame_cache *cache
+ = moxie_frame_cache (this_frame, this_prologue_cache);
gdb_assert (regnum >= 0);
@@ -584,33 +586,28 @@ moxie_frame_prev_register (frame_info_ptr this_frame,
return frame_unwind_got_register (this_frame, regnum, regnum);
}
-static const struct frame_unwind moxie_frame_unwind = {
- "moxie prologue",
- NORMAL_FRAME,
- default_frame_unwind_stop_reason,
- moxie_frame_this_id,
- moxie_frame_prev_register,
- NULL,
- default_frame_sniffer
-};
+static const struct frame_unwind moxie_frame_unwind
+ = { "moxie prologue",
+ NORMAL_FRAME,
+ default_frame_unwind_stop_reason,
+ moxie_frame_this_id,
+ moxie_frame_prev_register,
+ NULL,
+ default_frame_sniffer };
/* Return the base address of this_frame. */
static CORE_ADDR
moxie_frame_base_address (frame_info_ptr this_frame, void **this_cache)
{
- struct moxie_frame_cache *cache = moxie_frame_cache (this_frame,
- this_cache);
+ struct moxie_frame_cache *cache = moxie_frame_cache (this_frame, this_cache);
return cache->base;
}
-static const struct frame_base moxie_frame_base = {
- &moxie_frame_unwind,
- moxie_frame_base_address,
- moxie_frame_base_address,
- moxie_frame_base_address
-};
+static const struct frame_base moxie_frame_base
+ = { &moxie_frame_unwind, moxie_frame_base_address, moxie_frame_base_address,
+ moxie_frame_base_address };
/* Parse the current instruction and record the values of the registers and
memory that will be changed in current instruction to "record_arch_list".
@@ -626,7 +623,8 @@ moxie_process_record (struct gdbarch *gdbarch, struct regcache *regcache,
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
if (record_debug > 1)
- gdb_printf (gdb_stdlog, "Process record: moxie_process_record "
+ gdb_printf (gdb_stdlog,
+ "Process record: moxie_process_record "
"addr = 0x%s\n",
paddress (target_gdbarch (), addr));
@@ -639,7 +637,7 @@ moxie_process_record (struct gdbarch *gdbarch, struct regcache *regcache,
{
/* This is a Form 3 instruction. */
int opcode = (inst >> 10 & 0xf);
-
+
switch (opcode)
{
case 0x00: /* beq */
@@ -708,13 +706,11 @@ moxie_process_record (struct gdbarch *gdbarch, struct regcache *regcache,
break;
case 0x03: /* jsra */
{
- regcache->raw_read (
- MOXIE_SP_REGNUM, (gdb_byte *) & tmpu32);
- tmpu32 = extract_unsigned_integer ((gdb_byte *) & tmpu32,
- 4, byte_order);
+ regcache->raw_read (MOXIE_SP_REGNUM, (gdb_byte *) &tmpu32);
+ tmpu32
+ = extract_unsigned_integer ((gdb_byte *) &tmpu32, 4, byte_order);
if (record_full_arch_list_add_reg (regcache, MOXIE_FP_REGNUM)
- || (record_full_arch_list_add_reg (regcache,
- MOXIE_SP_REGNUM))
+ || (record_full_arch_list_add_reg (regcache, MOXIE_SP_REGNUM))
|| record_full_arch_list_add_mem (tmpu32 - 12, 12))
return -1;
}
@@ -722,8 +718,7 @@ moxie_process_record (struct gdbarch *gdbarch, struct regcache *regcache,
case 0x04: /* ret */
{
if (record_full_arch_list_add_reg (regcache, MOXIE_FP_REGNUM)
- || (record_full_arch_list_add_reg (regcache,
- MOXIE_SP_REGNUM)))
+ || (record_full_arch_list_add_reg (regcache, MOXIE_SP_REGNUM)))
return -1;
}
break;
@@ -737,9 +732,9 @@ moxie_process_record (struct gdbarch *gdbarch, struct regcache *regcache,
case 0x06: /* push */
{
int reg = (inst >> 4) & 0xf;
- regcache->raw_read (reg, (gdb_byte *) & tmpu32);
- tmpu32 = extract_unsigned_integer ((gdb_byte *) & tmpu32,
- 4, byte_order);
+ regcache->raw_read (reg, (gdb_byte *) &tmpu32);
+ tmpu32
+ = extract_unsigned_integer ((gdb_byte *) &tmpu32, 4, byte_order);
if (record_full_arch_list_add_reg (regcache, reg)
|| record_full_arch_list_add_mem (tmpu32 - 4, 4))
return -1;
@@ -763,8 +758,8 @@ moxie_process_record (struct gdbarch *gdbarch, struct regcache *regcache,
break;
case 0x09: /* sta.l */
{
- tmpu32 = (uint32_t) moxie_process_readu (addr+2, buf,
- 4, byte_order);
+ tmpu32
+ = (uint32_t) moxie_process_readu (addr + 2, buf, 4, byte_order);
if (record_full_arch_list_add_mem (tmpu32, 4))
return -1;
}
@@ -779,9 +774,9 @@ moxie_process_record (struct gdbarch *gdbarch, struct regcache *regcache,
case 0x0b: /* st.l */
{
int reg = (inst >> 4) & 0xf;
- regcache->raw_read (reg, (gdb_byte *) & tmpu32);
- tmpu32 = extract_unsigned_integer ((gdb_byte *) & tmpu32,
- 4, byte_order);
+ regcache->raw_read (reg, (gdb_byte *) &tmpu32);
+ tmpu32
+ = extract_unsigned_integer ((gdb_byte *) &tmpu32, 4, byte_order);
if (record_full_arch_list_add_mem (tmpu32, 4))
return -1;
}
@@ -796,11 +791,13 @@ moxie_process_record (struct gdbarch *gdbarch, struct regcache *regcache,
case 0x0d: /* sto.l */
{
int reg = (inst >> 4) & 0xf;
- uint32_t offset = (((int16_t) moxie_process_readu (addr+2, buf, 2,
- byte_order)) << 16 ) >> 16;
- regcache->raw_read (reg, (gdb_byte *) & tmpu32);
- tmpu32 = extract_unsigned_integer ((gdb_byte *) & tmpu32,
- 4, byte_order);
+ uint32_t offset
+ = (((int16_t) moxie_process_readu (addr + 2, buf, 2, byte_order))
+ << 16)
+ >> 16;
+ regcache->raw_read (reg, (gdb_byte *) &tmpu32);
+ tmpu32
+ = extract_unsigned_integer ((gdb_byte *) &tmpu32, 4, byte_order);
tmpu32 += offset;
if (record_full_arch_list_add_mem (tmpu32, 4))
return -1;
@@ -838,13 +835,11 @@ moxie_process_record (struct gdbarch *gdbarch, struct regcache *regcache,
}
case 0x19: /* jsr */
{
- regcache->raw_read (
- MOXIE_SP_REGNUM, (gdb_byte *) & tmpu32);
- tmpu32 = extract_unsigned_integer ((gdb_byte *) & tmpu32,
- 4, byte_order);
+ regcache->raw_read (MOXIE_SP_REGNUM, (gdb_byte *) &tmpu32);
+ tmpu32
+ = extract_unsigned_integer ((gdb_byte *) &tmpu32, 4, byte_order);
if (record_full_arch_list_add_reg (regcache, MOXIE_FP_REGNUM)
- || (record_full_arch_list_add_reg (regcache,
- MOXIE_SP_REGNUM))
+ || (record_full_arch_list_add_reg (regcache, MOXIE_SP_REGNUM))
|| record_full_arch_list_add_mem (tmpu32 - 12, 12))
return -1;
}
@@ -866,16 +861,16 @@ moxie_process_record (struct gdbarch *gdbarch, struct regcache *regcache,
case 0x1e: /* st.b */
{
int reg = (inst >> 4) & 0xf;
- regcache->raw_read (reg, (gdb_byte *) & tmpu32);
- tmpu32 = extract_unsigned_integer ((gdb_byte *) & tmpu32,
- 4, byte_order);
+ regcache->raw_read (reg, (gdb_byte *) &tmpu32);
+ tmpu32
+ = extract_unsigned_integer ((gdb_byte *) &tmpu32, 4, byte_order);
if (record_full_arch_list_add_mem (tmpu32, 1))
return -1;
}
break;
case 0x1f: /* sta.b */
{
- tmpu32 = moxie_process_readu (addr+2, buf, 4, byte_order);
+ tmpu32 = moxie_process_readu (addr + 2, buf, 4, byte_order);
if (record_full_arch_list_add_mem (tmpu32, 1))
return -1;
}
@@ -892,16 +887,16 @@ moxie_process_record (struct gdbarch *gdbarch, struct regcache *regcache,
case 0x23: /* st.s */
{
int reg = (inst >> 4) & 0xf;
- regcache->raw_read (reg, (gdb_byte *) & tmpu32);
- tmpu32 = extract_unsigned_integer ((gdb_byte *) & tmpu32,
- 4, byte_order);
+ regcache->raw_read (reg, (gdb_byte *) &tmpu32);
+ tmpu32
+ = extract_unsigned_integer ((gdb_byte *) &tmpu32, 4, byte_order);
if (record_full_arch_list_add_mem (tmpu32, 2))
return -1;
}
break;
case 0x24: /* sta.s */
{
- tmpu32 = moxie_process_readu (addr+2, buf, 4, byte_order);
+ tmpu32 = moxie_process_readu (addr + 2, buf, 4, byte_order);
if (record_full_arch_list_add_mem (tmpu32, 2))
return -1;
}
@@ -932,7 +927,7 @@ moxie_process_record (struct gdbarch *gdbarch, struct regcache *regcache,
/* We currently implement support for libgloss'
system calls. */
- int inum = moxie_process_readu (addr+2, buf, 4, byte_order);
+ int inum = moxie_process_readu (addr + 2, buf, 4, byte_order);
switch (inum)
{
@@ -952,16 +947,16 @@ moxie_process_record (struct gdbarch *gdbarch, struct regcache *regcache,
uint32_t length, ptr;
/* Read buffer pointer is in $r1. */
- regcache->raw_read (3, (gdb_byte *) & ptr);
- ptr = extract_unsigned_integer ((gdb_byte *) & ptr,
- 4, byte_order);
+ regcache->raw_read (3, (gdb_byte *) &ptr);
+ ptr = extract_unsigned_integer ((gdb_byte *) &ptr, 4,
+ byte_order);
/* String length is at 0x12($fp). */
- regcache->raw_read (
- MOXIE_FP_REGNUM, (gdb_byte *) & tmpu32);
- tmpu32 = extract_unsigned_integer ((gdb_byte *) & tmpu32,
- 4, byte_order);
- length = moxie_process_readu (tmpu32+20, buf, 4, byte_order);
+ regcache->raw_read (MOXIE_FP_REGNUM, (gdb_byte *) &tmpu32);
+ tmpu32 = extract_unsigned_integer ((gdb_byte *) &tmpu32, 4,
+ byte_order);
+ length
+ = moxie_process_readu (tmpu32 + 20, buf, 4, byte_order);
if (record_full_arch_list_add_mem (ptr, length))
return -1;
@@ -1001,11 +996,13 @@ moxie_process_record (struct gdbarch *gdbarch, struct regcache *regcache,
case 0x37: /* sto.b */
{
int reg = (inst >> 4) & 0xf;
- uint32_t offset = (((int16_t) moxie_process_readu (addr+2, buf, 2,
- byte_order)) << 16 ) >> 16;
- regcache->raw_read (reg, (gdb_byte *) & tmpu32);
- tmpu32 = extract_unsigned_integer ((gdb_byte *) & tmpu32,
- 4, byte_order);
+ uint32_t offset
+ = (((int16_t) moxie_process_readu (addr + 2, buf, 2, byte_order))
+ << 16)
+ >> 16;
+ regcache->raw_read (reg, (gdb_byte *) &tmpu32);
+ tmpu32
+ = extract_unsigned_integer ((gdb_byte *) &tmpu32, 4, byte_order);
tmpu32 += offset;
if (record_full_arch_list_add_mem (tmpu32, 1))
return -1;
@@ -1021,11 +1018,13 @@ moxie_process_record (struct gdbarch *gdbarch, struct regcache *regcache,
case 0x39: /* sto.s */
{
int reg = (inst >> 4) & 0xf;
- uint32_t offset = (((int16_t) moxie_process_readu (addr+2, buf, 2,
- byte_order)) << 16 ) >> 16;
- regcache->raw_read (reg, (gdb_byte *) & tmpu32);
- tmpu32 = extract_unsigned_integer ((gdb_byte *) & tmpu32,
- 4, byte_order);
+ uint32_t offset
+ = (((int16_t) moxie_process_readu (addr + 2, buf, 2, byte_order))
+ << 16)
+ >> 16;
+ regcache->raw_read (reg, (gdb_byte *) &tmpu32);
+ tmpu32
+ = extract_unsigned_integer ((gdb_byte *) &tmpu32, 4, byte_order);
tmpu32 += offset;
if (record_full_arch_list_add_mem (tmpu32, 2))
return -1;
@@ -1100,6 +1099,7 @@ moxie_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
/* Register this machine's init routine. */
void _initialize_moxie_tdep ();
+
void
_initialize_moxie_tdep ()
{
diff --git a/gdb/msp430-tdep.c b/gdb/msp430-tdep.c
index 051299078c5..0a5ba14a7e3 100644
--- a/gdb/msp430-tdep.c
+++ b/gdb/msp430-tdep.c
@@ -187,17 +187,16 @@ msp430x_register_type (struct gdbarch *gdbarch, int reg_nr)
static const char *
msp430_register_name (struct gdbarch *gdbarch, int regnr)
{
- static const char *const reg_names[] = {
- /* Raw registers. */
- "", "", "", "", "", "", "", "",
- "", "", "", "", "", "", "", "",
- /* Pseudo registers. */
- "pc", "sp", "sr", "cg", "r4", "r5", "r6", "r7",
- "r8", "r9", "r10", "r11", "r12", "r13", "r14", "r15"
- };
-
- gdb_static_assert (ARRAY_SIZE (reg_names) == (MSP430_NUM_REGS
- + MSP430_NUM_PSEUDO_REGS));
+ static const char *const reg_names[]
+ = { /* Raw registers. */
+ "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
+ /* Pseudo registers. */
+ "pc", "sp", "sr", "cg", "r4", "r5", "r6", "r7", "r8", "r9", "r10",
+ "r11", "r12", "r13", "r14", "r15"
+ };
+
+ gdb_static_assert (ARRAY_SIZE (reg_names)
+ == (MSP430_NUM_REGS + MSP430_NUM_PSEUDO_REGS));
return reg_names[regnr];
}
@@ -221,8 +220,8 @@ msp430_register_reggroup_p (struct gdbarch *gdbarch, int regnum,
static enum register_status
msp430_pseudo_register_read (struct gdbarch *gdbarch,
- readable_regcache *regcache,
- int regnum, gdb_byte *buffer)
+ readable_regcache *regcache, int regnum,
+ gdb_byte *buffer)
{
if (MSP430_NUM_REGS <= regnum && regnum < MSP430_NUM_TOTAL_REGS)
{
@@ -246,8 +245,8 @@ msp430_pseudo_register_read (struct gdbarch *gdbarch,
static void
msp430_pseudo_register_write (struct gdbarch *gdbarch,
- struct regcache *regcache,
- int regnum, const gdb_byte *buffer)
+ struct regcache *regcache, int regnum,
+ const gdb_byte *buffer)
{
if (MSP430_NUM_REGS <= regnum && regnum < MSP430_NUM_TOTAL_REGS)
@@ -259,7 +258,6 @@ msp430_pseudo_register_write (struct gdbarch *gdbarch,
val = extract_unsigned_integer (buffer, regsize, byte_order);
regcache_raw_write_unsigned (regcache, raw_regnum, val);
-
}
else
gdb_assert_not_reached ("invalid pseudo register number");
@@ -325,8 +323,7 @@ check_for_saved (void *result_untyped, pv_t addr, CORE_ADDR size, pv_t value)
{
struct msp430_prologue *result = (struct msp430_prologue *) result_untyped;
- if (value.kind == pvk_register
- && value.k == 0
+ if (value.kind == pvk_register && value.k == 0
&& pv_is_register (addr, MSP430_SP_REGNUM)
&& size == register_size (target_gdbarch (), value.reg))
result->reg_offset[value.reg] = addr.k;
@@ -382,7 +379,7 @@ msp430_analyze_prologue (struct gdbarch *gdbarch, CORE_ADDR start_pc,
stack.store (reg[MSP430_SP_REGNUM], 2, reg[rsrc]);
after_last_frame_setup_insn = next_pc;
}
- else if (opc.id == MSO_push /* PUSHM */
+ else if (opc.id == MSO_push /* PUSHM */
&& opc.op[0].type == MSP430_Operand_None
&& opc.op[1].type == MSP430_Operand_Register)
{
@@ -400,19 +397,17 @@ msp430_analyze_prologue (struct gdbarch *gdbarch, CORE_ADDR start_pc,
}
after_last_frame_setup_insn = next_pc;
}
- else if (opc.id == MSO_sub
- && opc.op[0].type == MSP430_Operand_Register
+ else if (opc.id == MSO_sub && opc.op[0].type == MSP430_Operand_Register
&& opc.op[0].reg == MSR_SP
&& opc.op[1].type == MSP430_Operand_Immediate)
{
int addend = opc.op[1].addend;
- reg[MSP430_SP_REGNUM] = pv_add_constant (reg[MSP430_SP_REGNUM],
- -addend);
+ reg[MSP430_SP_REGNUM]
+ = pv_add_constant (reg[MSP430_SP_REGNUM], -addend);
after_last_frame_setup_insn = next_pc;
}
- else if (opc.id == MSO_mov
- && opc.op[0].type == MSP430_Operand_Immediate
+ else if (opc.id == MSO_mov && opc.op[0].type == MSP430_Operand_Immediate
&& 12 <= opc.op[0].reg && opc.op[0].reg <= 15)
after_last_frame_setup_insn = next_pc;
else
@@ -474,9 +469,9 @@ msp430_analyze_frame_prologue (frame_info_ptr this_frame,
if (!func_start)
stop_addr = func_start;
- msp430_analyze_prologue (get_frame_arch (this_frame), func_start,
- stop_addr,
- (struct msp430_prologue *) *this_prologue_cache);
+ msp430_analyze_prologue (
+ get_frame_arch (this_frame), func_start, stop_addr,
+ (struct msp430_prologue *) *this_prologue_cache);
}
return (struct msp430_prologue *) *this_prologue_cache;
@@ -497,19 +492,19 @@ msp430_frame_base (frame_info_ptr this_frame, void **this_prologue_cache)
/* Implement the "frame_this_id" method for unwinding frames. */
static void
-msp430_this_id (frame_info_ptr this_frame,
- void **this_prologue_cache, struct frame_id *this_id)
+msp430_this_id (frame_info_ptr this_frame, void **this_prologue_cache,
+ struct frame_id *this_id)
{
- *this_id = frame_id_build (msp430_frame_base (this_frame,
- this_prologue_cache),
- get_frame_func (this_frame));
+ *this_id
+ = frame_id_build (msp430_frame_base (this_frame, this_prologue_cache),
+ get_frame_func (this_frame));
}
/* Implement the "frame_prev_register" method for unwinding frames. */
static struct value *
-msp430_prev_register (frame_info_ptr this_frame,
- void **this_prologue_cache, int regnum)
+msp430_prev_register (frame_info_ptr this_frame, void **this_prologue_cache,
+ int regnum)
{
struct msp430_prologue *p
= msp430_analyze_frame_prologue (this_frame, this_prologue_cache);
@@ -522,9 +517,9 @@ msp430_prev_register (frame_info_ptr this_frame,
return a description of the stack slot holding it. */
else if (p->reg_offset[regnum] != 1)
{
- struct value *rv = frame_unwind_got_memory (this_frame, regnum,
- frame_base +
- p->reg_offset[regnum]);
+ struct value *rv
+ = frame_unwind_got_memory (this_frame, regnum,
+ frame_base + p->reg_offset[regnum]);
if (regnum == MSP430_PC_REGNUM)
{
@@ -542,12 +537,8 @@ msp430_prev_register (frame_info_ptr this_frame,
}
static const struct frame_unwind msp430_unwind = {
- "msp430 prologue",
- NORMAL_FRAME,
- default_frame_unwind_stop_reason,
- msp430_this_id,
- msp430_prev_register,
- NULL,
+ "msp430 prologue", NORMAL_FRAME, default_frame_unwind_stop_reason,
+ msp430_this_id, msp430_prev_register, NULL,
default_frame_sniffer
};
@@ -564,10 +555,8 @@ msp430_dwarf2_reg_to_regnum (struct gdbarch *gdbarch, int reg)
/* Implement the "return_value" gdbarch method. */
static enum return_value_convention
-msp430_return_value (struct gdbarch *gdbarch,
- struct value *function,
- struct type *valtype,
- struct regcache *regcache,
+msp430_return_value (struct gdbarch *gdbarch, struct value *function,
+ struct type *valtype, struct regcache *regcache,
gdb_byte *readbuf, const gdb_byte *writebuf)
{
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
@@ -575,8 +564,7 @@ msp430_return_value (struct gdbarch *gdbarch,
msp430_gdbarch_tdep *tdep = gdbarch_tdep<msp430_gdbarch_tdep> (gdbarch);
int code_model = tdep->code_model;
- if (valtype->length () > 8
- || valtype->code () == TYPE_CODE_STRUCT
+ if (valtype->length () > 8 || valtype->code () == TYPE_CODE_STRUCT
|| valtype->code () == TYPE_CODE_UNION)
return RETURN_VALUE_STRUCT_CONVENTION;
@@ -631,7 +619,6 @@ msp430_return_value (struct gdbarch *gdbarch,
return RETURN_VALUE_REGISTER_CONVENTION;
}
-
/* Implement the "frame_align" gdbarch method. */
static CORE_ADDR
@@ -715,7 +702,6 @@ msp430_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
current_arg_on_stack = 1;
}
-
for (offset = 0; offset < arg_size; offset += 2)
{
/* The condition below prevents 8 byte scalars from being split
@@ -723,9 +709,10 @@ msp430_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
splits once the stack has been written to. */
if (!current_arg_on_stack
&& (arg_reg
- + ((arg_size == 8 || args_on_stack)
- ? ((arg_size - offset) / 2 - 1)
- : 0) <= MSP430_R15_REGNUM))
+ + ((arg_size == 8 || args_on_stack)
+ ? ((arg_size - offset) / 2 - 1)
+ : 0)
+ <= MSP430_R15_REGNUM))
{
int size = 2;
@@ -746,10 +733,10 @@ msp430_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
}
if (write_pass)
- regcache_cooked_write_unsigned (regcache, arg_reg,
- extract_unsigned_integer
- (arg_bits + offset, size,
- byte_order));
+ regcache_cooked_write_unsigned (
+ regcache, arg_reg,
+ extract_unsigned_integer (arg_bits + offset, size,
+ byte_order));
arg_reg++;
}
@@ -795,11 +782,9 @@ static const char msp430_epilog_name_prefix[] = "__mspabi_func_epilog_";
/* Implement the "in_return_stub" gdbarch method. */
static int
-msp430_in_return_stub (struct gdbarch *gdbarch, CORE_ADDR pc,
- const char *name)
+msp430_in_return_stub (struct gdbarch *gdbarch, CORE_ADDR pc, const char *name)
{
- return (name != NULL
- && startswith (name, msp430_epilog_name_prefix));
+ return (name != NULL && startswith (name, msp430_epilog_name_prefix));
}
/* Implement the "skip_trampoline_code" gdbarch method. */
@@ -822,9 +807,9 @@ msp430_skip_trampoline_code (frame_info_ptr frame, CORE_ADDR pc)
{
CORE_ADDR sp = get_frame_register_unsigned (frame, MSP430_SP_REGNUM);
- return read_memory_integer
- (sp + 2 * (stub_name[strlen (msp430_epilog_name_prefix)] - '0'),
- 2, gdbarch_byte_order (gdbarch));
+ return read_memory_integer (
+ sp + 2 * (stub_name[strlen (msp430_epilog_name_prefix)] - '0'), 2,
+ gdbarch_byte_order (gdbarch));
}
return pc;
@@ -864,7 +849,7 @@ msp430_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
code_model = MSP_LARGE_CODE_MODEL;
break;
default:
- internal_error (_("Unknown msp430x code memory model"));
+ internal_error (_ ("Unknown msp430x code memory model"));
break;
}
break;
@@ -887,7 +872,7 @@ msp430_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
}
/* Fall through. */
default:
- error (_("Unknown msp430 isa"));
+ error (_ ("Unknown msp430 isa"));
break;
}
else
@@ -896,18 +881,15 @@ msp430_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
code_model = MSP_SMALL_CODE_MODEL;
}
-
/* Try to find the architecture in the list of already defined
architectures. */
- for (arches = gdbarch_list_lookup_by_info (arches, &info);
- arches != NULL;
+ for (arches = gdbarch_list_lookup_by_info (arches, &info); arches != NULL;
arches = gdbarch_list_lookup_by_info (arches->next, &info))
{
msp430_gdbarch_tdep *candidate_tdep
= gdbarch_tdep<msp430_gdbarch_tdep> (arches->gdbarch);
- if (candidate_tdep->elf_flags != elf_flags
- || candidate_tdep->isa != isa
+ if (candidate_tdep->elf_flags != elf_flags || candidate_tdep->isa != isa
|| candidate_tdep->code_model != code_model)
continue;
@@ -951,7 +933,7 @@ msp430_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
set_gdbarch_ptr_bit (gdbarch, 16);
set_gdbarch_addr_bit (gdbarch, 16);
}
- else /* MSP_LARGE_CODE_MODEL */
+ else /* MSP_LARGE_CODE_MODEL */
{
set_gdbarch_ptr_bit (gdbarch, 32);
set_gdbarch_addr_bit (gdbarch, 32);
@@ -995,6 +977,7 @@ msp430_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
/* Register the initialization routine. */
void _initialize_msp430_tdep ();
+
void
_initialize_msp430_tdep ()
{
diff --git a/gdb/namespace.c b/gdb/namespace.c
index bdf5e8ffab4..f256455367e 100644
--- a/gdb/namespace.c
+++ b/gdb/namespace.c
@@ -36,14 +36,11 @@
but the pointed to characters are not copied. */
void
-add_using_directive (struct using_direct **using_directives,
- const char *dest,
- const char *src,
- const char *alias,
+add_using_directive (struct using_direct **using_directives, const char *dest,
+ const char *src, const char *alias,
const char *declaration,
const std::vector<const char *> &excludes,
- unsigned int decl_line,
- int copy_names,
+ unsigned int decl_line, int copy_names,
struct obstack *obstack)
{
struct using_direct *current;
@@ -86,8 +83,8 @@ add_using_directive (struct using_direct **using_directives,
return;
}
- alloc_len = (sizeof(*newobj)
- + (excludes.size () * sizeof(*newobj->excludes)));
+ alloc_len
+ = (sizeof (*newobj) + (excludes.size () * sizeof (*newobj->excludes)));
newobj = (struct using_direct *) obstack_alloc (obstack, alloc_len);
memset (newobj, 0, sizeof (*newobj));
@@ -132,8 +129,7 @@ using_direct::valid_line (unsigned int boundary) const
{
CORE_ADDR curr_pc = get_frame_pc (get_selected_frame (nullptr));
symtab_and_line curr_sal = find_pc_line (curr_pc, 0);
- return (decl_line <= curr_sal.line)
- || (decl_line >= boundary);
+ return (decl_line <= curr_sal.line) || (decl_line >= boundary);
}
catch (const gdb_exception &ex)
{
diff --git a/gdb/namespace.h b/gdb/namespace.h
index b8d4be88a28..d9375d47377 100644
--- a/gdb/namespace.h
+++ b/gdb/namespace.h
@@ -119,13 +119,10 @@ struct using_direct
};
extern void add_using_directive (struct using_direct **using_directives,
- const char *dest,
- const char *src,
- const char *alias,
- const char *declaration,
+ const char *dest, const char *src,
+ const char *alias, const char *declaration,
const std::vector<const char *> &excludes,
- const unsigned int decl_line,
- int copy_names,
+ const unsigned int decl_line, int copy_names,
struct obstack *obstack);
#endif /* NAMESPACE_H */
diff --git a/gdb/nat/aarch64-hw-point.c b/gdb/nat/aarch64-hw-point.c
index dd0ffc32634..8e6de15a952 100644
--- a/gdb/nat/aarch64-hw-point.c
+++ b/gdb/nat/aarch64-hw-point.c
@@ -24,7 +24,7 @@
/* For kernel_supports_any_contiguous_range. */
#include "aarch64-linux-hw-point.h"
#else
-#define kernel_supports_any_contiguous_range true
+#define kernel_supports_any_contiguous_range true
#endif
/* Number of hardware breakpoints/watchpoints the target supports.
@@ -67,7 +67,7 @@ aarch64_watchpoint_length (unsigned int ctrl)
mask >>= 1;
if (mask != 0)
- error (_("Unexpected hardware watchpoint length register value 0x%x"),
+ error (_ ("Unexpected hardware watchpoint length register value 0x%x"),
DR_CONTROL_MASK (ctrl));
return retval;
@@ -78,7 +78,8 @@ aarch64_watchpoint_length (unsigned int ctrl)
breakpoint/watchpoint control register. */
static unsigned int
-aarch64_point_encode_ctrl_reg (enum target_hw_bp_type type, int offset, int len)
+aarch64_point_encode_ctrl_reg (enum target_hw_bp_type type, int offset,
+ int len)
{
unsigned int ctrl, ttype;
@@ -101,7 +102,7 @@ aarch64_point_encode_ctrl_reg (enum target_hw_bp_type type, int offset, int len)
ttype = 0;
break;
default:
- perror_with_name (_("Unrecognized breakpoint/watchpoint type"));
+ perror_with_name (_ ("Unrecognized breakpoint/watchpoint type"));
}
ctrl = ttype << 3;
@@ -137,8 +138,7 @@ aarch64_point_is_aligned (ptid_t ptid, int is_watchpoint, CORE_ADDR addr,
alignment = AARCH64_HWP_ALIGNMENT;
else
{
- struct regcache *regcache
- = get_thread_regcache_for_ptid (ptid);
+ struct regcache *regcache = get_thread_regcache_for_ptid (ptid);
/* Set alignment to 2 only if the current process is 32-bit,
since thumb instruction can be 2-byte aligned. Otherwise, set
@@ -152,10 +152,9 @@ aarch64_point_is_aligned (ptid_t ptid, int is_watchpoint, CORE_ADDR addr,
if (addr & (alignment - 1))
return 0;
- if ((!kernel_supports_any_contiguous_range
- && len != 8 && len != 4 && len != 2 && len != 1)
- || (kernel_supports_any_contiguous_range
- && (len < 1 || len > 8)))
+ if ((!kernel_supports_any_contiguous_range && len != 8 && len != 4
+ && len != 2 && len != 1)
+ || (kernel_supports_any_contiguous_range && (len < 1 || len > 8)))
return 0;
return 1;
@@ -246,12 +245,12 @@ aarch64_align_watchpoint (CORE_ADDR addr, int len, CORE_ADDR *aligned_addr_p,
{
/* Find the smallest valid length that is large enough to
accommodate this watchpoint. */
- static const unsigned char
- aligned_len_array[AARCH64_HWP_MAX_LEN_PER_REG] =
- { 1, 2, 4, 4, 8, 8, 8, 8 };
+ static const unsigned char aligned_len_array[AARCH64_HWP_MAX_LEN_PER_REG]
+ = { 1, 2, 4, 4, 8, 8, 8, 8 };
aligned_len = (kernel_supports_any_contiguous_range
- ? len : aligned_len_array[offset + len - 1]);
+ ? len
+ : aligned_len_array[offset + len - 1]);
addr += len;
len = 0;
}
@@ -276,9 +275,8 @@ aarch64_align_watchpoint (CORE_ADDR addr, int len, CORE_ADDR *aligned_addr_p,
static int
aarch64_dr_state_insert_one_point (ptid_t ptid,
struct aarch64_debug_reg_state *state,
- enum target_hw_bp_type type,
- CORE_ADDR addr, int offset, int len,
- CORE_ADDR addr_orig)
+ enum target_hw_bp_type type, CORE_ADDR addr,
+ int offset, int len, CORE_ADDR addr_orig)
{
int i, idx, num_regs, is_watchpoint;
unsigned int ctrl, *dr_ctrl_p, *dr_ref_count;
@@ -357,9 +355,8 @@ aarch64_dr_state_insert_one_point (ptid_t ptid,
static int
aarch64_dr_state_remove_one_point (ptid_t ptid,
struct aarch64_debug_reg_state *state,
- enum target_hw_bp_type type,
- CORE_ADDR addr, int offset, int len,
- CORE_ADDR addr_orig)
+ enum target_hw_bp_type type, CORE_ADDR addr,
+ int offset, int len, CORE_ADDR addr_orig)
{
int i, num_regs, is_watchpoint;
unsigned int ctrl, *dr_ctrl_p, *dr_ref_count;
@@ -431,11 +428,11 @@ aarch64_handle_breakpoint (enum target_hw_bp_type type, CORE_ADDR addr,
However when GDB follows the parent process and detach breakpoints
from child process, inferior_ptid is the child ptid, but the
child inferior doesn't exist in GDB's view yet. */
- if (!aarch64_point_is_aligned (ptid, 0 /* is_watchpoint */ , addr, len))
+ if (!aarch64_point_is_aligned (ptid, 0 /* is_watchpoint */, addr, len))
return -1;
- return aarch64_dr_state_insert_one_point (ptid, state, type, addr, 0, len,
- -1);
+ return aarch64_dr_state_insert_one_point (ptid, state, type, addr, 0,
+ len, -1);
}
else
return aarch64_dr_state_remove_one_point (ptid, state, type, addr, 0, len,
@@ -446,9 +443,8 @@ aarch64_handle_breakpoint (enum target_hw_bp_type type, CORE_ADDR addr,
from that it is an aligned watchpoint to be handled. */
static int
-aarch64_handle_aligned_watchpoint (enum target_hw_bp_type type,
- CORE_ADDR addr, int len, int is_insert,
- ptid_t ptid,
+aarch64_handle_aligned_watchpoint (enum target_hw_bp_type type, CORE_ADDR addr,
+ int len, int is_insert, ptid_t ptid,
struct aarch64_debug_reg_state *state)
{
if (is_insert)
@@ -521,7 +517,7 @@ aarch64_handle_watchpoint (enum target_hw_bp_type type, CORE_ADDR addr,
int len, int is_insert, ptid_t ptid,
struct aarch64_debug_reg_state *state)
{
- if (aarch64_point_is_aligned (ptid, 1 /* is_watchpoint */ , addr, len))
+ if (aarch64_point_is_aligned (ptid, 1 /* is_watchpoint */, addr, len))
return aarch64_handle_aligned_watchpoint (type, addr, len, is_insert, ptid,
state);
else
@@ -540,7 +536,8 @@ aarch64_any_set_debug_regs_state (aarch64_debug_reg_state *state,
return false;
const CORE_ADDR *addr = watchpoint ? state->dr_addr_wp : state->dr_addr_bp;
- const unsigned int *ctrl = watchpoint ? state->dr_ctrl_wp : state->dr_ctrl_bp;
+ const unsigned int *ctrl
+ = watchpoint ? state->dr_ctrl_wp : state->dr_ctrl_bp;
for (int i = 0; i < count; i++)
if (addr[i] != 0 || ctrl[i] != 0)
@@ -553,32 +550,34 @@ aarch64_any_set_debug_regs_state (aarch64_debug_reg_state *state,
void
aarch64_show_debug_reg_state (struct aarch64_debug_reg_state *state,
- const char *func, CORE_ADDR addr,
- int len, enum target_hw_bp_type type)
+ const char *func, CORE_ADDR addr, int len,
+ enum target_hw_bp_type type)
{
int i;
debug_printf ("%s", func);
if (addr || len)
- debug_printf (" (addr=0x%08lx, len=%d, type=%s)",
- (unsigned long) addr, len,
- type == hw_write ? "hw-write-watchpoint"
- : (type == hw_read ? "hw-read-watchpoint"
- : (type == hw_access ? "hw-access-watchpoint"
- : (type == hw_execute ? "hw-breakpoint"
- : "??unknown??"))));
+ debug_printf (
+ " (addr=0x%08lx, len=%d, type=%s)", (unsigned long) addr, len,
+ type == hw_write
+ ? "hw-write-watchpoint"
+ : (type == hw_read
+ ? "hw-read-watchpoint"
+ : (type == hw_access
+ ? "hw-access-watchpoint"
+ : (type == hw_execute ? "hw-breakpoint" : "??unknown??"))));
debug_printf (":\n");
debug_printf ("\tBREAKPOINTs:\n");
for (i = 0; i < aarch64_num_bp_regs; i++)
- debug_printf ("\tBP%d: addr=%s, ctrl=0x%08x, ref.count=%d\n",
- i, core_addr_to_string_nz (state->dr_addr_bp[i]),
+ debug_printf ("\tBP%d: addr=%s, ctrl=0x%08x, ref.count=%d\n", i,
+ core_addr_to_string_nz (state->dr_addr_bp[i]),
state->dr_ctrl_bp[i], state->dr_ref_count_bp[i]);
debug_printf ("\tWATCHPOINTs:\n");
for (i = 0; i < aarch64_num_wp_regs; i++)
- debug_printf ("\tWP%d: addr=%s (orig=%s), ctrl=0x%08x, ref.count=%d\n",
- i, core_addr_to_string_nz (state->dr_addr_wp[i]),
+ debug_printf ("\tWP%d: addr=%s (orig=%s), ctrl=0x%08x, ref.count=%d\n", i,
+ core_addr_to_string_nz (state->dr_addr_wp[i]),
core_addr_to_string_nz (state->dr_addr_orig_wp[i]),
state->dr_ctrl_wp[i], state->dr_ref_count_wp[i]);
}
diff --git a/gdb/nat/aarch64-hw-point.h b/gdb/nat/aarch64-hw-point.h
index 13ec0c5fe9d..ca5dadc8a3d 100644
--- a/gdb/nat/aarch64-hw-point.h
+++ b/gdb/nat/aarch64-hw-point.h
@@ -68,8 +68,8 @@
The TYPE field is ignored for breakpoints. */
-#define DR_CONTROL_ENABLED(ctrl) (((ctrl) & 0x1) == 1)
-#define DR_CONTROL_MASK(ctrl) (((ctrl) >> 5) & 0xff)
+#define DR_CONTROL_ENABLED(ctrl) (((ctrl) &0x1) == 1)
+#define DR_CONTROL_MASK(ctrl) (((ctrl) >> 5) & 0xff)
/* Structure for managing the hardware breakpoint/watchpoint resources.
DR_ADDR_* stores the address, DR_CTRL_* stores the control register
@@ -118,8 +118,8 @@ bool aarch64_any_set_debug_regs_state (aarch64_debug_reg_state *state,
bool watchpoint);
void aarch64_show_debug_reg_state (struct aarch64_debug_reg_state *state,
- const char *func, CORE_ADDR addr,
- int len, enum target_hw_bp_type type);
+ const char *func, CORE_ADDR addr, int len,
+ enum target_hw_bp_type type);
int aarch64_region_ok_for_watchpoint (CORE_ADDR addr, int len);
diff --git a/gdb/nat/aarch64-linux-hw-point.c b/gdb/nat/aarch64-linux-hw-point.c
index 096c34fe9c8..a980e4556e1 100644
--- a/gdb/nat/aarch64-linux-hw-point.c
+++ b/gdb/nat/aarch64-linux-hw-point.c
@@ -63,18 +63,17 @@ debug_reg_change_callback (struct lwp_info *lwp, int is_watchpoint,
{
debug_printf ("debug_reg_change_callback: \n\tOn entry:\n");
debug_printf ("\ttid%d, dr_changed_bp=0x%s, "
- "dr_changed_wp=0x%s\n", tid,
- phex (info->dr_changed_bp, 8),
+ "dr_changed_wp=0x%s\n",
+ tid, phex (info->dr_changed_bp, 8),
phex (info->dr_changed_wp, 8));
}
- dr_changed_ptr = is_watchpoint ? &info->dr_changed_wp
- : &info->dr_changed_bp;
+ dr_changed_ptr = is_watchpoint ? &info->dr_changed_wp : &info->dr_changed_bp;
dr_changed = *dr_changed_ptr;
gdb_assert (idx >= 0
&& (idx <= (is_watchpoint ? aarch64_num_wp_regs
- : aarch64_num_bp_regs)));
+ : aarch64_num_bp_regs)));
/* The actual update is done later just before resuming the lwp,
we just mark that one register pair needs updating. */
@@ -89,8 +88,8 @@ debug_reg_change_callback (struct lwp_info *lwp, int is_watchpoint,
if (show_debug_regs)
{
debug_printf ("\tOn exit:\n\ttid%d, dr_changed_bp=0x%s, "
- "dr_changed_wp=0x%s\n", tid,
- phex (info->dr_changed_bp, 8),
+ "dr_changed_wp=0x%s\n",
+ tid, phex (info->dr_changed_bp, 8),
phex (info->dr_changed_wp, 8));
}
@@ -103,17 +102,14 @@ debug_reg_change_callback (struct lwp_info *lwp, int is_watchpoint,
when the thread is resumed. */
void
-aarch64_notify_debug_reg_change (ptid_t ptid,
- int is_watchpoint, unsigned int idx)
+aarch64_notify_debug_reg_change (ptid_t ptid, int is_watchpoint,
+ unsigned int idx)
{
ptid_t pid_ptid = ptid_t (ptid.pid ());
- iterate_over_lwps (pid_ptid, [=] (struct lwp_info *info)
- {
- return debug_reg_change_callback (info,
- is_watchpoint,
- idx);
- });
+ iterate_over_lwps (pid_ptid, [=] (struct lwp_info *info) {
+ return debug_reg_change_callback (info, is_watchpoint, idx);
+ });
}
/* Reconfigure STATE to be compatible with Linux kernels with the PR
@@ -176,8 +172,8 @@ aarch64_downgrade_regs (struct aarch64_debug_reg_state *state)
registers with data from *STATE. */
void
-aarch64_linux_set_debug_regs (struct aarch64_debug_reg_state *state,
- int tid, int watchpoint)
+aarch64_linux_set_debug_regs (struct aarch64_debug_reg_state *state, int tid,
+ int watchpoint)
{
int i, count;
struct iovec iov;
@@ -202,8 +198,7 @@ aarch64_linux_set_debug_regs (struct aarch64_debug_reg_state *state,
}
if (ptrace (PTRACE_SETREGSET, tid,
- watchpoint ? NT_ARM_HW_WATCH : NT_ARM_HW_BREAK,
- (void *) &iov))
+ watchpoint ? NT_ARM_HW_WATCH : NT_ARM_HW_BREAK, (void *) &iov))
{
/* Handle Linux kernels with the PR external/20207 bug. */
if (watchpoint && errno == EINVAL
@@ -214,7 +209,7 @@ aarch64_linux_set_debug_regs (struct aarch64_debug_reg_state *state,
aarch64_linux_set_debug_regs (state, tid, watchpoint);
return;
}
- error (_("Unexpected error setting hardware debug registers"));
+ error (_ ("Unexpected error setting hardware debug registers"));
}
}
@@ -255,16 +250,16 @@ aarch64_linux_get_debug_reg_capacity (int tid)
aarch64_num_wp_regs = AARCH64_DEBUG_NUM_SLOTS (dreg_state.dbg_info);
if (aarch64_num_wp_regs > AARCH64_HWP_MAX_NUM)
{
- warning (_("Unexpected number of hardware watchpoint registers"
- " reported by ptrace, got %d, expected %d."),
+ warning (_ ("Unexpected number of hardware watchpoint registers"
+ " reported by ptrace, got %d, expected %d."),
aarch64_num_wp_regs, AARCH64_HWP_MAX_NUM);
aarch64_num_wp_regs = AARCH64_HWP_MAX_NUM;
}
}
else
{
- warning (_("Unable to determine the number of hardware watchpoints"
- " available."));
+ warning (_ ("Unable to determine the number of hardware watchpoints"
+ " available."));
aarch64_num_wp_regs = 0;
}
@@ -275,16 +270,16 @@ aarch64_linux_get_debug_reg_capacity (int tid)
aarch64_num_bp_regs = AARCH64_DEBUG_NUM_SLOTS (dreg_state.dbg_info);
if (aarch64_num_bp_regs > AARCH64_HBP_MAX_NUM)
{
- warning (_("Unexpected number of hardware breakpoint registers"
- " reported by ptrace, got %d, expected %d."),
+ warning (_ ("Unexpected number of hardware breakpoint registers"
+ " reported by ptrace, got %d, expected %d."),
aarch64_num_bp_regs, AARCH64_HBP_MAX_NUM);
aarch64_num_bp_regs = AARCH64_HBP_MAX_NUM;
}
}
else
{
- warning (_("Unable to determine the number of hardware breakpoints"
- " available."));
+ warning (_ ("Unable to determine the number of hardware breakpoints"
+ " available."));
aarch64_num_bp_regs = 0;
}
}
diff --git a/gdb/nat/aarch64-linux-hw-point.h b/gdb/nat/aarch64-linux-hw-point.h
index 83a0a097f8b..9ef1b040b66 100644
--- a/gdb/nat/aarch64-linux-hw-point.h
+++ b/gdb/nat/aarch64-linux-hw-point.h
@@ -30,9 +30,8 @@
| RESERVED | RESERVED | DEBUG_ARCH | NUM_SLOTS |
+---------------+--------------+---------------+---------------+ */
-
/* Macros to extract fields from the hardware debug information word. */
-#define AARCH64_DEBUG_NUM_SLOTS(x) ((x) & 0xff)
+#define AARCH64_DEBUG_NUM_SLOTS(x) ((x) &0xff)
#define AARCH64_DEBUG_ARCH(x) (((x) >> 8) & 0xff)
/* Each bit of a variable of this type is used to indicate whether a
@@ -60,27 +59,30 @@ typedef ULONGEST dr_changed_t;
/* Set each of the lower M bits of X to 1; assert X is wide enough. */
-#define DR_MARK_ALL_CHANGED(x, m) \
- do \
- { \
- gdb_assert (sizeof ((x)) * 8 >= (m)); \
- (x) = (((dr_changed_t)1 << (m)) - 1); \
- } while (0)
-
-#define DR_MARK_N_CHANGED(x, n) \
- do \
- { \
- (x) |= ((dr_changed_t)1 << (n)); \
- } while (0)
-
-#define DR_CLEAR_CHANGED(x) \
- do \
- { \
- (x) = 0; \
- } while (0)
+#define DR_MARK_ALL_CHANGED(x, m) \
+ do \
+ { \
+ gdb_assert (sizeof ((x)) * 8 >= (m)); \
+ (x) = (((dr_changed_t) 1 << (m)) - 1); \
+ } \
+ while (0)
+
+#define DR_MARK_N_CHANGED(x, n) \
+ do \
+ { \
+ (x) |= ((dr_changed_t) 1 << (n)); \
+ } \
+ while (0)
+
+#define DR_CLEAR_CHANGED(x) \
+ do \
+ { \
+ (x) = 0; \
+ } \
+ while (0)
#define DR_HAS_CHANGED(x) ((x) != 0)
-#define DR_N_HAS_CHANGED(x, n) ((x) & ((dr_changed_t)1 << (n)))
+#define DR_N_HAS_CHANGED(x, n) ((x) & ((dr_changed_t) 1 << (n)))
/* Per-thread arch-specific data we want to keep. */
diff --git a/gdb/nat/aarch64-linux.c b/gdb/nat/aarch64-linux.c
index 6c8a78f1729..e35b5cb57be 100644
--- a/gdb/nat/aarch64-linux.c
+++ b/gdb/nat/aarch64-linux.c
@@ -208,7 +208,7 @@ aarch64_siginfo_from_compat_siginfo (siginfo_t *to, compat_siginfo_t *from)
default:
to->si_pid = from->cpt_si_pid;
to->si_uid = from->cpt_si_uid;
- to->si_ptr = (void* ) (intptr_t) from->cpt_si_ptr;
+ to->si_ptr = (void *) (intptr_t) from->cpt_si_ptr;
break;
}
}
@@ -218,9 +218,8 @@ aarch64_siginfo_from_compat_siginfo (siginfo_t *to, compat_siginfo_t *from)
storage (or its descriptor). */
ps_err_e
-aarch64_ps_get_thread_area (struct ps_prochandle *ph,
- lwpid_t lwpid, int idx, void **base,
- int is_64bit_p)
+aarch64_ps_get_thread_area (struct ps_prochandle *ph, lwpid_t lwpid, int idx,
+ void **base, int is_64bit_p)
{
struct iovec iovec;
uint64_t reg64;
diff --git a/gdb/nat/aarch64-linux.h b/gdb/nat/aarch64-linux.h
index 391c66ce00e..c0f2eb31791 100644
--- a/gdb/nat/aarch64-linux.h
+++ b/gdb/nat/aarch64-linux.h
@@ -114,9 +114,9 @@ typedef struct compat_siginfo
#define cpt_si_fd _sifields._sigpoll._fd
void aarch64_siginfo_from_compat_siginfo (siginfo_t *to,
- compat_siginfo_t *from);
+ compat_siginfo_t *from);
void aarch64_compat_siginfo_from_siginfo (compat_siginfo_t *to,
- siginfo_t *from);
+ siginfo_t *from);
void aarch64_linux_prepare_to_resume (struct lwp_info *lwp);
@@ -125,9 +125,8 @@ void aarch64_linux_new_thread (struct lwp_info *lwp);
/* Function to call when a thread is being deleted. */
void aarch64_linux_delete_thread (struct arch_lwp_info *arch_lwp);
-ps_err_e aarch64_ps_get_thread_area (struct ps_prochandle *ph,
- lwpid_t lwpid, int idx, void **base,
- int is_64bit_p);
+ps_err_e aarch64_ps_get_thread_area (struct ps_prochandle *ph, lwpid_t lwpid,
+ int idx, void **base, int is_64bit_p);
/* Return the number of TLS registers in the NT_ARM_TLS set. This is only
used for aarch64 state. */
diff --git a/gdb/nat/aarch64-mte-linux-ptrace.c b/gdb/nat/aarch64-mte-linux-ptrace.c
index a7be454435f..95e3b6f239e 100644
--- a/gdb/nat/aarch64-mte-linux-ptrace.c
+++ b/gdb/nat/aarch64-mte-linux-ptrace.c
@@ -38,15 +38,15 @@ aarch64_mte_linux_peek_error (int error)
switch (error)
{
case EIO:
- perror_with_name (_("PEEKMTETAGS not supported"));
+ perror_with_name (_ ("PEEKMTETAGS not supported"));
break;
case EFAULT:
- perror_with_name (_("Couldn't fetch allocation tags"));
+ perror_with_name (_ ("Couldn't fetch allocation tags"));
break;
case EOPNOTSUPP:
- perror_with_name (_("PROT_MTE not enabled for requested address"));
+ perror_with_name (_ ("PROT_MTE not enabled for requested address"));
default:
- perror_with_name (_("Unknown MTE error"));
+ perror_with_name (_ ("Unknown MTE error"));
break;
}
}
@@ -60,15 +60,15 @@ aarch64_mte_linux_poke_error (int error)
switch (error)
{
case EIO:
- perror_with_name (_("POKEMTETAGS not supported"));
+ perror_with_name (_ ("POKEMTETAGS not supported"));
break;
case EFAULT:
- perror_with_name (_("Couldn't store allocation tags"));
+ perror_with_name (_ ("Couldn't store allocation tags"));
break;
case EOPNOTSUPP:
- perror_with_name (_("PROT_MTE not enabled for requested address"));
+ perror_with_name (_ ("PROT_MTE not enabled for requested address"));
default:
- perror_with_name (_("Unknown MTE error"));
+ perror_with_name (_ ("Unknown MTE error"));
break;
}
}
@@ -112,8 +112,8 @@ bool
aarch64_mte_fetch_memtags (int tid, CORE_ADDR address, size_t len,
gdb::byte_vector &tags)
{
- size_t ntags = aarch64_mte_get_tag_granules (address, len,
- AARCH64_MTE_GRANULE_SIZE);
+ size_t ntags
+ = aarch64_mte_get_tag_granules (address, len, AARCH64_MTE_GRANULE_SIZE);
/* If the memory range contains no tags, nothing left to do. */
if (ntags == 0)
@@ -169,8 +169,8 @@ aarch64_mte_store_memtags (int tid, CORE_ADDR address, size_t len,
return true;
/* Get the number of tags we need to write. */
- size_t ntags = aarch64_mte_get_tag_granules (address, len,
- AARCH64_MTE_GRANULE_SIZE);
+ size_t ntags
+ = aarch64_mte_get_tag_granules (address, len, AARCH64_MTE_GRANULE_SIZE);
/* If the memory range contains no tags, nothing left to do. */
if (ntags == 0)
@@ -182,9 +182,9 @@ aarch64_mte_store_memtags (int tid, CORE_ADDR address, size_t len,
/* Write all the tags, AARCH64_MTE_TAGS_MAX_SIZE blocks at a time. */
while (!done_writing)
{
- gdb::byte_vector t = prepare_tag_vector (ntags - tags_written, tags,
- tags_written,
- AARCH64_MTE_TAGS_MAX_SIZE);
+ gdb::byte_vector t
+ = prepare_tag_vector (ntags - tags_written, tags, tags_written,
+ AARCH64_MTE_TAGS_MAX_SIZE);
struct iovec iovec;
iovec.iov_base = t.data ();
diff --git a/gdb/nat/aarch64-mte-linux-ptrace.h b/gdb/nat/aarch64-mte-linux-ptrace.h
index ec99e13211a..26a5ff75c11 100644
--- a/gdb/nat/aarch64-mte-linux-ptrace.h
+++ b/gdb/nat/aarch64-mte-linux-ptrace.h
@@ -23,11 +23,11 @@
/* MTE allocation tag access */
#ifndef PTRACE_PEEKMTETAGS
-#define PTRACE_PEEKMTETAGS 33
+#define PTRACE_PEEKMTETAGS 33
#endif
#ifndef PTRACE_POKEMTETAGS
-#define PTRACE_POKEMTETAGS 34
+#define PTRACE_POKEMTETAGS 34
#endif
/* Maximum number of tags to pass at once to the kernel. */
diff --git a/gdb/nat/aarch64-sve-linux-ptrace.c b/gdb/nat/aarch64-sve-linux-ptrace.c
index 51146535672..970453aaf91 100644
--- a/gdb/nat/aarch64-sve-linux-ptrace.c
+++ b/gdb/nat/aarch64-sve-linux-ptrace.c
@@ -53,7 +53,7 @@ aarch64_sve_get_vq (int tid)
if (!sve_vl_valid (header.vl))
{
- warning (_("Invalid SVE state from kernel; SVE disabled."));
+ warning (_ ("Invalid SVE state from kernel; SVE disabled."));
return 0;
}
@@ -126,7 +126,7 @@ aarch64_sve_get_sveregs (int tid)
uint64_t vq = aarch64_sve_get_vq (tid);
if (vq == 0)
- perror_with_name (_("Unable to fetch SVE register header"));
+ perror_with_name (_ ("Unable to fetch SVE register header"));
/* A ptrace call with NT_ARM_SVE will return a header followed by either a
dump of all the SVE and FP registers, or an fpsimd structure (identical to
@@ -138,7 +138,7 @@ aarch64_sve_get_sveregs (int tid)
iovec.iov_base = buf.get ();
if (ptrace (PTRACE_GETREGSET, tid, NT_ARM_SVE, &iovec) < 0)
- perror_with_name (_("Unable to fetch SVE registers"));
+ perror_with_name (_ ("Unable to fetch SVE registers"));
return buf;
}
@@ -176,7 +176,7 @@ aarch64_sve_regs_copy_to_reg_buf (struct reg_buffer_common *reg_buf,
/* Sanity check the data in the header. */
if (!sve_vl_valid (header->vl)
|| SVE_PT_SIZE (vq, header->flags) != header->size)
- error (_("Invalid SVE header from kernel."));
+ error (_ ("Invalid SVE header from kernel."));
/* Update VG. Note, the registers in the regcache will already be of the
correct length. */
@@ -220,7 +220,7 @@ aarch64_sve_regs_copy_to_reg_buf (struct reg_buffer_common *reg_buf,
gdb_byte *reg = (gdb_byte *) alloca (SVE_PT_SVE_ZREG_SIZE (vq));
struct user_fpsimd_state *fpsimd
- = (struct user_fpsimd_state *)(base + SVE_PT_FPSIMD_OFFSET);
+ = (struct user_fpsimd_state *) (base + SVE_PT_FPSIMD_OFFSET);
/* Make sure we have a zeroed register buffer. We will need the zero
padding below. */
@@ -263,7 +263,7 @@ aarch64_sve_regs_copy_from_reg_buf (const struct reg_buffer_common *reg_buf,
/* Sanity check the data in the header. */
if (!sve_vl_valid (header->vl)
|| SVE_PT_SIZE (vq, header->flags) != header->size)
- error (_("Invalid SVE header from kernel."));
+ error (_ ("Invalid SVE header from kernel."));
if (!HAS_SVE_STATE (*header))
{
@@ -277,7 +277,7 @@ aarch64_sve_regs_copy_from_reg_buf (const struct reg_buffer_common *reg_buf,
bool has_sve_state = false;
gdb_byte *reg = (gdb_byte *) alloca (SVE_PT_SVE_ZREG_SIZE (vq));
struct user_fpsimd_state *fpsimd
- = (struct user_fpsimd_state *)(base + SVE_PT_FPSIMD_OFFSET);
+ = (struct user_fpsimd_state *) (base + SVE_PT_FPSIMD_OFFSET);
memset (reg, 0, SVE_PT_SVE_ZREG_SIZE (vq));
@@ -295,15 +295,14 @@ aarch64_sve_regs_copy_from_reg_buf (const struct reg_buffer_common *reg_buf,
if (!has_sve_state)
for (int i = 0; i < AARCH64_SVE_P_REGS_NUM; i++)
{
- has_sve_state |= reg_buf->raw_compare (AARCH64_SVE_P0_REGNUM + i,
- reg, 0);
+ has_sve_state
+ |= reg_buf->raw_compare (AARCH64_SVE_P0_REGNUM + i, reg, 0);
if (has_sve_state)
break;
}
if (!has_sve_state)
- has_sve_state |= reg_buf->raw_compare (AARCH64_SVE_FFR_REGNUM,
- reg, 0);
+ has_sve_state |= reg_buf->raw_compare (AARCH64_SVE_FFR_REGNUM, reg, 0);
/* If no SVE state exists, then use the existing fpsimd structure to
write out state and return. */
@@ -360,7 +359,7 @@ aarch64_sve_regs_copy_from_reg_buf (const struct reg_buffer_common *reg_buf,
memcpy (base + SVE_PT_SVE_FPCR_OFFSET (vq), &fpsimd->fpcr,
sizeof (uint32_t));
- for (int i = AARCH64_SVE_Z_REGS_NUM; i >= 0 ; i--)
+ for (int i = AARCH64_SVE_Z_REGS_NUM; i >= 0; i--)
{
memcpy (base + SVE_PT_SVE_ZREG_OFFSET (vq, i), &fpsimd->vregs[i],
sizeof (__int128_t));
@@ -388,5 +387,4 @@ aarch64_sve_regs_copy_from_reg_buf (const struct reg_buffer_common *reg_buf,
if (REG_VALID == reg_buf->get_register_status (AARCH64_FPCR_REGNUM))
reg_buf->raw_collect (AARCH64_FPCR_REGNUM,
base + SVE_PT_SVE_FPCR_OFFSET (vq));
-
}
diff --git a/gdb/nat/aarch64-sve-linux-ptrace.h b/gdb/nat/aarch64-sve-linux-ptrace.h
index 9539e199d34..483a0fd4bce 100644
--- a/gdb/nat/aarch64-sve-linux-ptrace.h
+++ b/gdb/nat/aarch64-sve-linux-ptrace.h
@@ -59,8 +59,9 @@ extern std::unique_ptr<gdb_byte[]> aarch64_sve_get_sveregs (int tid);
/* Put the registers from linux structure buf into register buffer. Assumes the
vector lengths in the register buffer match the size in the kernel. */
-extern void aarch64_sve_regs_copy_to_reg_buf (struct reg_buffer_common *reg_buf,
- const void *buf);
+extern void
+aarch64_sve_regs_copy_to_reg_buf (struct reg_buffer_common *reg_buf,
+ const void *buf);
/* Put the registers from register buffer into linux structure buf. Assumes the
vector lengths in the register buffer match the size in the kernel. */
diff --git a/gdb/nat/aarch64-sve-linux-sigcontext.h b/gdb/nat/aarch64-sve-linux-sigcontext.h
index aba3c1595d0..d3c2fd2d4b6 100644
--- a/gdb/nat/aarch64-sve-linux-sigcontext.h
+++ b/gdb/nat/aarch64-sve-linux-sigcontext.h
@@ -19,12 +19,13 @@
#ifndef NAT_AARCH64_SVE_LINUX_SIGCONTEXT_H
#define NAT_AARCH64_SVE_LINUX_SIGCONTEXT_H
-#define SVE_MAGIC 0x53564501
+#define SVE_MAGIC 0x53564501
-struct sve_context {
- struct _aarch64_ctx head;
- __u16 vl;
- __u16 __reserved[3];
+struct sve_context
+{
+ struct _aarch64_ctx head;
+ __u16 vl;
+ __u16 __reserved[3];
};
/*
@@ -35,19 +36,19 @@ struct sve_context {
* See linux/Documentation/arm64/sve.txt for a description of the VL/VQ
* terminology.
*/
-#define SVE_VQ_BYTES 16 /* number of bytes per quadword */
+#define SVE_VQ_BYTES 16 /* number of bytes per quadword */
-#define SVE_VQ_MIN 1
-#define SVE_VQ_MAX 512
+#define SVE_VQ_MIN 1
+#define SVE_VQ_MAX 512
-#define SVE_VL_MIN (SVE_VQ_MIN * SVE_VQ_BYTES)
-#define SVE_VL_MAX (SVE_VQ_MAX * SVE_VQ_BYTES)
+#define SVE_VL_MIN (SVE_VQ_MIN * SVE_VQ_BYTES)
+#define SVE_VL_MAX (SVE_VQ_MAX * SVE_VQ_BYTES)
-#define SVE_NUM_ZREGS 32
-#define SVE_NUM_PREGS 16
+#define SVE_NUM_ZREGS 32
+#define SVE_NUM_PREGS 16
#define sve_vl_valid(vl) \
- ((vl) % SVE_VQ_BYTES == 0 && (vl) >= SVE_VL_MIN && (vl) <= SVE_VL_MAX)
+ ((vl) % SVE_VQ_BYTES == 0 && (vl) >= SVE_VL_MIN && (vl) <= SVE_VL_MAX)
/*
* If the SVE registers are currently live for the thread at signal delivery,
@@ -100,59 +101,59 @@ struct sve_context {
* Additional data might be appended in the future.
*/
-#define SVE_SIG_ZREG_SIZE(vq) ((__u32)(vq) * SVE_VQ_BYTES)
-#define SVE_SIG_PREG_SIZE(vq) ((__u32)(vq) * (SVE_VQ_BYTES / 8))
-#define SVE_SIG_FFR_SIZE(vq) SVE_SIG_PREG_SIZE(vq)
+#define SVE_SIG_ZREG_SIZE(vq) ((__u32) (vq) *SVE_VQ_BYTES)
+#define SVE_SIG_PREG_SIZE(vq) ((__u32) (vq) * (SVE_VQ_BYTES / 8))
+#define SVE_SIG_FFR_SIZE(vq) SVE_SIG_PREG_SIZE (vq)
-#define SVE_SIG_REGS_OFFSET \
- ((sizeof(struct sve_context) + (SVE_VQ_BYTES - 1)) \
- / SVE_VQ_BYTES * SVE_VQ_BYTES)
+#define SVE_SIG_REGS_OFFSET \
+ ((sizeof (struct sve_context) + (SVE_VQ_BYTES - 1)) / SVE_VQ_BYTES \
+ * SVE_VQ_BYTES)
-#define SVE_SIG_ZREGS_OFFSET SVE_SIG_REGS_OFFSET
+#define SVE_SIG_ZREGS_OFFSET SVE_SIG_REGS_OFFSET
#define SVE_SIG_ZREG_OFFSET(vq, n) \
- (SVE_SIG_ZREGS_OFFSET + SVE_SIG_ZREG_SIZE(vq) * (n))
+ (SVE_SIG_ZREGS_OFFSET + SVE_SIG_ZREG_SIZE (vq) * (n))
#define SVE_SIG_ZREGS_SIZE(vq) \
- (SVE_SIG_ZREG_OFFSET(vq, SVE_NUM_ZREGS) - SVE_SIG_ZREGS_OFFSET)
+ (SVE_SIG_ZREG_OFFSET (vq, SVE_NUM_ZREGS) - SVE_SIG_ZREGS_OFFSET)
#define SVE_SIG_PREGS_OFFSET(vq) \
- (SVE_SIG_ZREGS_OFFSET + SVE_SIG_ZREGS_SIZE(vq))
+ (SVE_SIG_ZREGS_OFFSET + SVE_SIG_ZREGS_SIZE (vq))
#define SVE_SIG_PREG_OFFSET(vq, n) \
- (SVE_SIG_PREGS_OFFSET(vq) + SVE_SIG_PREG_SIZE(vq) * (n))
+ (SVE_SIG_PREGS_OFFSET (vq) + SVE_SIG_PREG_SIZE (vq) * (n))
#define SVE_SIG_PREGS_SIZE(vq) \
- (SVE_SIG_PREG_OFFSET(vq, SVE_NUM_PREGS) - SVE_SIG_PREGS_OFFSET(vq))
+ (SVE_SIG_PREG_OFFSET (vq, SVE_NUM_PREGS) - SVE_SIG_PREGS_OFFSET (vq))
#define SVE_SIG_FFR_OFFSET(vq) \
- (SVE_SIG_PREGS_OFFSET(vq) + SVE_SIG_PREGS_SIZE(vq))
+ (SVE_SIG_PREGS_OFFSET (vq) + SVE_SIG_PREGS_SIZE (vq))
#define SVE_SIG_REGS_SIZE(vq) \
- (SVE_SIG_FFR_OFFSET(vq) + SVE_SIG_FFR_SIZE(vq) - SVE_SIG_REGS_OFFSET)
+ (SVE_SIG_FFR_OFFSET (vq) + SVE_SIG_FFR_SIZE (vq) - SVE_SIG_REGS_OFFSET)
-#define SVE_SIG_CONTEXT_SIZE(vq) (SVE_SIG_REGS_OFFSET + SVE_SIG_REGS_SIZE(vq))
+#define SVE_SIG_CONTEXT_SIZE(vq) (SVE_SIG_REGS_OFFSET + SVE_SIG_REGS_SIZE (vq))
/* SVE/FP/SIMD state (NT_ARM_SVE) */
-struct user_sve_header {
- __u32 size; /* total meaningful regset content in bytes */
- __u32 max_size; /* maximum possible size for this thread */
- __u16 vl; /* current vector length */
- __u16 max_vl; /* maximum possible vector length */
- __u16 flags;
- __u16 __reserved;
+struct user_sve_header
+{
+ __u32 size; /* total meaningful regset content in bytes */
+ __u32 max_size; /* maximum possible size for this thread */
+ __u16 vl; /* current vector length */
+ __u16 max_vl; /* maximum possible vector length */
+ __u16 flags;
+ __u16 __reserved;
};
/* Definitions for user_sve_header.flags: */
-#define SVE_PT_REGS_MASK (1 << 0)
+#define SVE_PT_REGS_MASK (1 << 0)
-#define SVE_PT_REGS_FPSIMD 0
-#define SVE_PT_REGS_SVE SVE_PT_REGS_MASK
+#define SVE_PT_REGS_FPSIMD 0
+#define SVE_PT_REGS_SVE SVE_PT_REGS_MASK
/*
* Common SVE_PT_* flags:
* These must be kept in sync with prctl interface in <linux/ptrace.h>
*/
-#define SVE_PT_VL_INHERIT (PR_SVE_VL_INHERIT >> 16)
-#define SVE_PT_VL_ONEXEC (PR_SVE_SET_VL_ONEXEC >> 16)
-
+#define SVE_PT_VL_INHERIT (PR_SVE_VL_INHERIT >> 16)
+#define SVE_PT_VL_ONEXEC (PR_SVE_SET_VL_ONEXEC >> 16)
/*
* The remainder of the SVE state follows struct user_sve_header. The
@@ -165,9 +166,9 @@ struct user_sve_header {
*/
/* Offset from the start of struct user_sve_header to the register data */
-#define SVE_PT_REGS_OFFSET \
- ((sizeof(struct user_sve_header) + (SVE_VQ_BYTES - 1)) \
- / SVE_VQ_BYTES * SVE_VQ_BYTES)
+#define SVE_PT_REGS_OFFSET \
+ ((sizeof (struct user_sve_header) + (SVE_VQ_BYTES - 1)) / SVE_VQ_BYTES \
+ * SVE_VQ_BYTES)
/*
* The register data content and layout depends on the value of the
@@ -184,9 +185,9 @@ struct user_sve_header {
* sizeof(struct user_fpsimd_state).
*/
-#define SVE_PT_FPSIMD_OFFSET SVE_PT_REGS_OFFSET
+#define SVE_PT_FPSIMD_OFFSET SVE_PT_REGS_OFFSET
-#define SVE_PT_FPSIMD_SIZE(vq, flags) (sizeof(struct user_fpsimd_state))
+#define SVE_PT_FPSIMD_SIZE(vq, flags) (sizeof (struct user_fpsimd_state))
/*
* (flags & SVE_PT_REGS_MASK) == SVE_PT_REGS_SVE case:
@@ -213,55 +214,51 @@ struct user_sve_header {
* Additional data might be appended in the future.
*/
-#define SVE_PT_SVE_ZREG_SIZE(vq) SVE_SIG_ZREG_SIZE(vq)
-#define SVE_PT_SVE_PREG_SIZE(vq) SVE_SIG_PREG_SIZE(vq)
-#define SVE_PT_SVE_FFR_SIZE(vq) SVE_SIG_FFR_SIZE(vq)
-#define SVE_PT_SVE_FPSR_SIZE sizeof(__u32)
-#define SVE_PT_SVE_FPCR_SIZE sizeof(__u32)
+#define SVE_PT_SVE_ZREG_SIZE(vq) SVE_SIG_ZREG_SIZE (vq)
+#define SVE_PT_SVE_PREG_SIZE(vq) SVE_SIG_PREG_SIZE (vq)
+#define SVE_PT_SVE_FFR_SIZE(vq) SVE_SIG_FFR_SIZE (vq)
+#define SVE_PT_SVE_FPSR_SIZE sizeof (__u32)
+#define SVE_PT_SVE_FPCR_SIZE sizeof (__u32)
#define __SVE_SIG_TO_PT(offset) \
- ((offset) - SVE_SIG_REGS_OFFSET + SVE_PT_REGS_OFFSET)
+ ((offset) -SVE_SIG_REGS_OFFSET + SVE_PT_REGS_OFFSET)
-#define SVE_PT_SVE_OFFSET SVE_PT_REGS_OFFSET
+#define SVE_PT_SVE_OFFSET SVE_PT_REGS_OFFSET
-#define SVE_PT_SVE_ZREGS_OFFSET \
- __SVE_SIG_TO_PT(SVE_SIG_ZREGS_OFFSET)
+#define SVE_PT_SVE_ZREGS_OFFSET __SVE_SIG_TO_PT (SVE_SIG_ZREGS_OFFSET)
#define SVE_PT_SVE_ZREG_OFFSET(vq, n) \
- __SVE_SIG_TO_PT(SVE_SIG_ZREG_OFFSET(vq, n))
+ __SVE_SIG_TO_PT (SVE_SIG_ZREG_OFFSET (vq, n))
#define SVE_PT_SVE_ZREGS_SIZE(vq) \
- (SVE_PT_SVE_ZREG_OFFSET(vq, SVE_NUM_ZREGS) - SVE_PT_SVE_ZREGS_OFFSET)
+ (SVE_PT_SVE_ZREG_OFFSET (vq, SVE_NUM_ZREGS) - SVE_PT_SVE_ZREGS_OFFSET)
-#define SVE_PT_SVE_PREGS_OFFSET(vq) \
- __SVE_SIG_TO_PT(SVE_SIG_PREGS_OFFSET(vq))
+#define SVE_PT_SVE_PREGS_OFFSET(vq) __SVE_SIG_TO_PT (SVE_SIG_PREGS_OFFSET (vq))
#define SVE_PT_SVE_PREG_OFFSET(vq, n) \
- __SVE_SIG_TO_PT(SVE_SIG_PREG_OFFSET(vq, n))
+ __SVE_SIG_TO_PT (SVE_SIG_PREG_OFFSET (vq, n))
#define SVE_PT_SVE_PREGS_SIZE(vq) \
- (SVE_PT_SVE_PREG_OFFSET(vq, SVE_NUM_PREGS) - \
- SVE_PT_SVE_PREGS_OFFSET(vq))
+ (SVE_PT_SVE_PREG_OFFSET (vq, SVE_NUM_PREGS) - SVE_PT_SVE_PREGS_OFFSET (vq))
-#define SVE_PT_SVE_FFR_OFFSET(vq) \
- __SVE_SIG_TO_PT(SVE_SIG_FFR_OFFSET(vq))
+#define SVE_PT_SVE_FFR_OFFSET(vq) __SVE_SIG_TO_PT (SVE_SIG_FFR_OFFSET (vq))
-#define SVE_PT_SVE_FPSR_OFFSET(vq) \
- ((SVE_PT_SVE_FFR_OFFSET(vq) + SVE_PT_SVE_FFR_SIZE(vq) + \
- (SVE_VQ_BYTES - 1)) \
- / SVE_VQ_BYTES * SVE_VQ_BYTES)
+#define SVE_PT_SVE_FPSR_OFFSET(vq) \
+ ((SVE_PT_SVE_FFR_OFFSET (vq) + SVE_PT_SVE_FFR_SIZE (vq) \
+ + (SVE_VQ_BYTES - 1)) \
+ / SVE_VQ_BYTES * SVE_VQ_BYTES)
#define SVE_PT_SVE_FPCR_OFFSET(vq) \
- (SVE_PT_SVE_FPSR_OFFSET(vq) + SVE_PT_SVE_FPSR_SIZE)
+ (SVE_PT_SVE_FPSR_OFFSET (vq) + SVE_PT_SVE_FPSR_SIZE)
/*
* Any future extension appended after FPCR must be aligned to the next
* 128-bit boundary.
*/
-#define SVE_PT_SVE_SIZE(vq, flags) \
- ((SVE_PT_SVE_FPCR_OFFSET(vq) + SVE_PT_SVE_FPCR_SIZE \
- - SVE_PT_SVE_OFFSET + (SVE_VQ_BYTES - 1)) \
- / SVE_VQ_BYTES * SVE_VQ_BYTES)
+#define SVE_PT_SVE_SIZE(vq, flags) \
+ ((SVE_PT_SVE_FPCR_OFFSET (vq) + SVE_PT_SVE_FPCR_SIZE - SVE_PT_SVE_OFFSET \
+ + (SVE_VQ_BYTES - 1)) \
+ / SVE_VQ_BYTES * SVE_VQ_BYTES)
-#define SVE_PT_SIZE(vq, flags) \
- (((flags) & SVE_PT_REGS_MASK) == SVE_PT_REGS_SVE ? \
- SVE_PT_SVE_OFFSET + SVE_PT_SVE_SIZE(vq, flags) \
- : SVE_PT_FPSIMD_OFFSET + SVE_PT_FPSIMD_SIZE(vq, flags))
+#define SVE_PT_SIZE(vq, flags) \
+ (((flags) &SVE_PT_REGS_MASK) == SVE_PT_REGS_SVE \
+ ? SVE_PT_SVE_OFFSET + SVE_PT_SVE_SIZE (vq, flags) \
+ : SVE_PT_FPSIMD_OFFSET + SVE_PT_FPSIMD_SIZE (vq, flags))
#endif /* NAT_AARCH64_SVE_LINUX_SIGCONTEXT_H */
diff --git a/gdb/nat/amd64-linux-siginfo.c b/gdb/nat/amd64-linux-siginfo.c
index 00bb5e522f4..a9a34d68e10 100644
--- a/gdb/nat/amd64-linux-siginfo.c
+++ b/gdb/nat/amd64-linux-siginfo.c
@@ -60,6 +60,7 @@ struct nat_siginfo_t
union
{
int _pad[((128 / sizeof (int)) - 4)];
+
/* kill() */
struct
{
@@ -98,6 +99,7 @@ struct nat_siginfo_t
{
nat_uptr_t _addr;
short int _addr_lsb;
+
struct
{
nat_uptr_t _lower;
@@ -187,6 +189,7 @@ struct compat_siginfo_t
{
unsigned int _addr;
short int _addr_lsb;
+
struct
{
unsigned int _lower;
@@ -293,7 +296,7 @@ struct __attribute__ ((__aligned__ (8))) compat_x32_siginfo_t
#endif
#ifndef SEGV_BNDERR
-#define SEGV_BNDERR 3
+#define SEGV_BNDERR 3
#endif
/* The type of the siginfo object the kernel returns in
@@ -333,8 +336,7 @@ compat_siginfo_from_siginfo (compat_siginfo_t *to, const siginfo_t *from)
#ifndef __ILP32__
/* The struct compat_x32_siginfo_t doesn't contain
cpt_si_lower/cpt_si_upper. */
- else if (to->si_code == SEGV_BNDERR
- && to->si_signo == SIGSEGV)
+ else if (to->si_code == SEGV_BNDERR && to->si_signo == SIGSEGV)
{
to->cpt_si_addr = from_ptrace.cpt_si_addr;
to->cpt_si_lower = from_ptrace.cpt_si_lower;
@@ -503,9 +505,6 @@ compat_x32_siginfo_from_siginfo (compat_x32_siginfo_t *to,
}
}
-
-
-
/* Convert the compatible x32 siginfo into system siginfo. */
static void
siginfo_from_compat_x32_siginfo (siginfo_t *to,
@@ -591,11 +590,9 @@ amd64_linux_siginfo_fixup_common (siginfo_t *ptrace, gdb_byte *inf,
else if (mode == FIXUP_X32)
{
if (direction == 0)
- compat_x32_siginfo_from_siginfo ((compat_x32_siginfo_t *) inf,
- ptrace);
+ compat_x32_siginfo_from_siginfo ((compat_x32_siginfo_t *) inf, ptrace);
else
- siginfo_from_compat_x32_siginfo (ptrace,
- (compat_x32_siginfo_t *) inf);
+ siginfo_from_compat_x32_siginfo (ptrace, (compat_x32_siginfo_t *) inf);
return 1;
}
diff --git a/gdb/nat/amd64-linux-siginfo.h b/gdb/nat/amd64-linux-siginfo.h
index 498cb2ec2bc..c98458b2694 100644
--- a/gdb/nat/amd64-linux-siginfo.h
+++ b/gdb/nat/amd64-linux-siginfo.h
@@ -20,7 +20,7 @@
#ifndef NAT_AMD64_LINUX_SIGINFO_H
#define NAT_AMD64_LINUX_SIGINFO_H
-#include <signal.h> /* For siginfo_t. */
+#include <signal.h> /* For siginfo_t. */
/* When GDB is built as a 64-bit application on Linux, the
PTRACE_GETSIGINFO data is always presented in 64-bit layout. Since
@@ -40,13 +40,12 @@
32 / X32 siginfo -> nat_siginfo -> buffer (to the kernel) */
-
/* Kind of siginfo fixup to be performed. */
enum amd64_siginfo_fixup_mode
{
- FIXUP_32 = 1, /* Fixup for 32bit. */
- FIXUP_X32 = 2 /* Fixup for x32. */
+ FIXUP_32 = 1, /* Fixup for 32bit. */
+ FIXUP_X32 = 2 /* Fixup for x32. */
};
/* Common code for performing the fixup of the siginfo. */
diff --git a/gdb/nat/fork-inferior.c b/gdb/nat/fork-inferior.c
index 968983b2021..75ccd30d36f 100644
--- a/gdb/nat/fork-inferior.c
+++ b/gdb/nat/fork-inferior.c
@@ -36,6 +36,7 @@ extern char **environ;
class execv_argv
{
public:
+
/* EXEC_FILE is the file to run. ALLARGS is a string containing the
arguments to the program. If starting with a shell, SHELL_FILE
is the shell to run. Otherwise, SHELL_FILE is NULL. */
@@ -48,25 +49,21 @@ public:
that the execv functions expect. Note that it is guaranteed that
the execv functions do not modify the argv[] array nor the
strings to which the array point. */
- char **argv ()
- {
- return const_cast<char **> (&m_argv[0]);
- }
+ char **argv () { return const_cast<char **> (&m_argv[0]); }
private:
+
DISABLE_COPY_AND_ASSIGN (execv_argv);
/* Helper methods for constructing the argument vector. */
/* Used when building an argv for a straight execv call, without
going via the shell. */
- void init_for_no_shell (const char *exec_file,
- const std::string &allargs);
+ void init_for_no_shell (const char *exec_file, const std::string &allargs);
/* Used when building an argv for execing a shell that execs the
child program. */
- void init_for_shell (const char *exec_file,
- const std::string &allargs,
+ void init_for_shell (const char *exec_file, const std::string &allargs,
const char *shell_file);
/* The argument vector built. Holds non-owning pointers. Elements
@@ -93,7 +90,6 @@ void
execv_argv::init_for_no_shell (const char *exec_file,
const std::string &allargs)
{
-
/* Save/work with a copy stored in our storage. The pointers pushed
to M_ARGV point directly into M_STORAGE, which is modified in
place with the necessary NULL terminators. This avoids N heap
@@ -160,8 +156,7 @@ escape_bang_in_quoted_argument (const char *shell_file)
/* See declaration. */
-execv_argv::execv_argv (const char *exec_file,
- const std::string &allargs,
+execv_argv::execv_argv (const char *exec_file, const std::string &allargs,
const char *shell_file)
{
if (shell_file == NULL)
@@ -173,8 +168,7 @@ execv_argv::execv_argv (const char *exec_file,
/* See declaration. */
void
-execv_argv::init_for_shell (const char *exec_file,
- const std::string &allargs,
+execv_argv::init_for_shell (const char *exec_file, const std::string &allargs,
const char *shell_file)
{
const char *exec_wrapper = get_exec_wrapper ();
@@ -232,7 +226,7 @@ execv_argv::init_for_shell (const char *exec_file,
}
++p;
}
- end_scan:
+end_scan:
if (need_to_quote)
{
shell_command += '\'';
@@ -268,10 +262,9 @@ pid_t
fork_inferior (const char *exec_file_arg, const std::string &allargs,
char **env, void (*traceme_fun) (),
gdb::function_view<void (int)> init_trace_fun,
- void (*pre_trace_fun) (),
- const char *shell_file_arg,
- void (*exec_fun)(const char *file, char * const *argv,
- char * const *env))
+ void (*pre_trace_fun) (), const char *shell_file_arg,
+ void (*exec_fun) (const char *file, char *const *argv,
+ char *const *env))
{
pid_t pid;
/* Set debug_fork then attach to the child while it sleeps, to debug. */
@@ -339,7 +332,7 @@ fork_inferior (const char *exec_file_arg, const std::string &allargs,
if (pre_trace_fun != NULL)
(*pre_trace_fun) ();
- /* Create the child process. Since the child process is going to
+ /* Create the child process. Since the child process is going to
exec(3) shortly afterwards, try to reduce the overhead by
calling vfork(2). However, if PRE_TRACE_FUN is non-null, it's
likely that this optimization won't work since there's too much
@@ -449,8 +442,7 @@ fork_inferior (const char *exec_file_arg, const std::string &allargs,
ptid_t
startup_inferior (process_stratum_target *proc_target, pid_t pid, int ntraps,
- struct target_waitstatus *last_waitstatus,
- ptid_t *last_ptid)
+ struct target_waitstatus *last_waitstatus, ptid_t *last_ptid)
{
int pending_execs = ntraps;
int terminal_initted = 0;
@@ -492,44 +484,44 @@ startup_inferior (process_stratum_target *proc_target, pid_t pid, int ntraps,
switch (ws.kind ())
{
- case TARGET_WAITKIND_SPURIOUS:
- case TARGET_WAITKIND_LOADED:
- case TARGET_WAITKIND_FORKED:
- case TARGET_WAITKIND_VFORKED:
- case TARGET_WAITKIND_SYSCALL_ENTRY:
- case TARGET_WAITKIND_SYSCALL_RETURN:
- /* Ignore gracefully during startup of the inferior. */
- switch_to_thread (proc_target, event_ptid);
- break;
+ case TARGET_WAITKIND_SPURIOUS:
+ case TARGET_WAITKIND_LOADED:
+ case TARGET_WAITKIND_FORKED:
+ case TARGET_WAITKIND_VFORKED:
+ case TARGET_WAITKIND_SYSCALL_ENTRY:
+ case TARGET_WAITKIND_SYSCALL_RETURN:
+ /* Ignore gracefully during startup of the inferior. */
+ switch_to_thread (proc_target, event_ptid);
+ break;
- case TARGET_WAITKIND_SIGNALLED:
- target_terminal::ours ();
- target_mourn_inferior (event_ptid);
- error (_("During startup program terminated with signal %s, %s."),
- gdb_signal_to_name (ws.sig ()),
- gdb_signal_to_string (ws.sig ()));
- return resume_ptid;
-
- case TARGET_WAITKIND_EXITED:
- target_terminal::ours ();
- target_mourn_inferior (event_ptid);
- if (ws.exit_status ())
- error (_("During startup program exited with code %d."),
- ws.exit_status ());
- else
- error (_("During startup program exited normally."));
- return resume_ptid;
-
- case TARGET_WAITKIND_EXECD:
- /* Handle EXEC signals as if they were SIGTRAP signals. */
- resume_signal = GDB_SIGNAL_TRAP;
- switch_to_thread (proc_target, event_ptid);
- break;
+ case TARGET_WAITKIND_SIGNALLED:
+ target_terminal::ours ();
+ target_mourn_inferior (event_ptid);
+ error (_ ("During startup program terminated with signal %s, %s."),
+ gdb_signal_to_name (ws.sig ()),
+ gdb_signal_to_string (ws.sig ()));
+ return resume_ptid;
+
+ case TARGET_WAITKIND_EXITED:
+ target_terminal::ours ();
+ target_mourn_inferior (event_ptid);
+ if (ws.exit_status ())
+ error (_ ("During startup program exited with code %d."),
+ ws.exit_status ());
+ else
+ error (_ ("During startup program exited normally."));
+ return resume_ptid;
- case TARGET_WAITKIND_STOPPED:
- resume_signal = ws.sig ();
- switch_to_thread (proc_target, event_ptid);
- break;
+ case TARGET_WAITKIND_EXECD:
+ /* Handle EXEC signals as if they were SIGTRAP signals. */
+ resume_signal = GDB_SIGNAL_TRAP;
+ switch_to_thread (proc_target, event_ptid);
+ break;
+
+ case TARGET_WAITKIND_STOPPED:
+ resume_signal = ws.sig ();
+ switch_to_thread (proc_target, event_ptid);
+ break;
}
if (resume_signal != GDB_SIGNAL_TRAP)
diff --git a/gdb/nat/fork-inferior.h b/gdb/nat/fork-inferior.h
index 67c765089f0..c83dff9d144 100644
--- a/gdb/nat/fork-inferior.h
+++ b/gdb/nat/fork-inferior.h
@@ -40,22 +40,17 @@ struct process_stratum_target;
/* This function is NOT reentrant. Some of the variables have been
made static to ensure that they survive the vfork call. */
-extern pid_t fork_inferior (const char *exec_file_arg,
- const std::string &allargs,
- char **env, void (*traceme_fun) (),
- gdb::function_view<void (int)> init_trace_fun,
- void (*pre_trace_fun) (),
- const char *shell_file_arg,
- void (*exec_fun) (const char *file,
- char * const *argv,
- char * const *env));
+extern pid_t fork_inferior (
+ const char *exec_file_arg, const std::string &allargs, char **env,
+ void (*traceme_fun) (), gdb::function_view<void (int)> init_trace_fun,
+ void (*pre_trace_fun) (), const char *shell_file_arg,
+ void (*exec_fun) (const char *file, char *const *argv, char *const *env));
/* Accept NTRAPS traps from the inferior.
Return the ptid of the inferior being started. */
-extern ptid_t startup_inferior (process_stratum_target *proc_target,
- pid_t pid, int ntraps,
- struct target_waitstatus *mystatus,
+extern ptid_t startup_inferior (process_stratum_target *proc_target, pid_t pid,
+ int ntraps, struct target_waitstatus *mystatus,
ptid_t *myptid);
/* Perform any necessary tasks before a fork/vfork takes place. ARGS
@@ -78,13 +73,13 @@ extern void gdb_flush_out_err ();
/* Report an error that happened when starting to trace the inferior
(i.e., when the "traceme_fun" callback is called on fork_inferior)
and bail out. This function does not return. */
-extern void trace_start_error (const char *fmt, ...)
- ATTRIBUTE_NORETURN ATTRIBUTE_PRINTF (1, 2);
+extern void trace_start_error (const char *fmt, ...) ATTRIBUTE_NORETURN
+ ATTRIBUTE_PRINTF (1, 2);
/* Like "trace_start_error", but the error message is constructed by
combining STRING with the system error message for errno. This
function does not return. */
-extern void trace_start_error_with_name (const char *string)
- ATTRIBUTE_NORETURN;
+extern void
+trace_start_error_with_name (const char *string) ATTRIBUTE_NORETURN;
#endif /* NAT_FORK_INFERIOR_H */
diff --git a/gdb/nat/gdb_ptrace.h b/gdb/nat/gdb_ptrace.h
index a5e3725ac36..c9ddcbb8490 100644
--- a/gdb/nat/gdb_ptrace.h
+++ b/gdb/nat/gdb_ptrace.h
@@ -31,40 +31,40 @@
common ptrace requests. */
#ifdef HAVE_PTRACE_H
-# include <ptrace.h>
+#include <ptrace.h>
#elif defined(HAVE_SYS_PTRACE_H)
-# include <sys/ptrace.h>
+#include <sys/ptrace.h>
#endif
/* No need to include <unistd.h> since it's already included by
"defs.h". */
#ifndef PT_TRACE_ME
-# define PT_TRACE_ME 0
+#define PT_TRACE_ME 0
#endif
#ifndef PT_READ_I
-# define PT_READ_I 1 /* Read word in child's I space. */
+#define PT_READ_I 1 /* Read word in child's I space. */
#endif
#ifndef PT_READ_D
-# define PT_READ_D 2 /* Read word in child's D space. */
+#define PT_READ_D 2 /* Read word in child's D space. */
#endif
#ifndef PT_READ_U
-# define PT_READ_U 3 /* Read word in child's U space. */
+#define PT_READ_U 3 /* Read word in child's U space. */
#endif
#ifndef PT_WRITE_I
-# define PT_WRITE_I 4 /* Write word in child's I space. */
+#define PT_WRITE_I 4 /* Write word in child's I space. */
#endif
#ifndef PT_WRITE_D
-# define PT_WRITE_D 5 /* Write word in child's D space. */
+#define PT_WRITE_D 5 /* Write word in child's D space. */
#endif
#ifndef PT_WRITE_U
-# define PT_WRITE_U 6 /* Write word in child's U space. */
+#define PT_WRITE_U 6 /* Write word in child's U space. */
#endif
/* HP-UX doesn't define PT_CONTINUE and PT_STEP. Instead of those two
@@ -73,37 +73,37 @@
which apparently is what is wanted by the HP-UX native code. */
#ifndef PT_CONTINUE
-# ifdef PT_CONTIN1
-# define PT_CONTINUE PT_CONTIN1
-# else
-# define PT_CONTINUE 7 /* Continue the child. */
-# endif
+#ifdef PT_CONTIN1
+#define PT_CONTINUE PT_CONTIN1
+#else
+#define PT_CONTINUE 7 /* Continue the child. */
+#endif
#endif
#ifndef PT_KILL
-# define PT_KILL 8 /* Kill the child process. */
+#define PT_KILL 8 /* Kill the child process. */
#endif
#ifndef PT_STEP
-# ifdef PT_SINGLE1
-# define PT_STEP PT_SINGLE1
-# else
-# define PT_STEP 9 /* Single step the child. */
-# endif
+#ifdef PT_SINGLE1
+#define PT_STEP PT_SINGLE1
+#else
+#define PT_STEP 9 /* Single step the child. */
+#endif
#endif
/* Not all systems support attaching and detaching. */
#ifndef PT_ATTACH
-# ifdef PTRACE_ATTACH
-# define PT_ATTACH PTRACE_ATTACH
-# endif
+#ifdef PTRACE_ATTACH
+#define PT_ATTACH PTRACE_ATTACH
+#endif
#endif
#ifndef PT_DETACH
-# ifdef PTRACE_DETACH
-# define PT_DETACH PTRACE_DETACH
-# endif
+#ifdef PTRACE_DETACH
+#define PT_DETACH PTRACE_DETACH
+#endif
#endif
/* For systems such as HP/UX that do not provide PT_SYSCALL, define it
@@ -114,11 +114,11 @@
and there is probably no special request that we would be required
to use when resuming the execution of our program. */
#ifndef PT_SYSCALL
-# ifdef PTRACE_SYSCALL
-# define PT_SYSCALL PTRACE_SYSCALL
+#ifdef PTRACE_SYSCALL
+#define PT_SYSCALL PTRACE_SYSCALL
#else
-# define PT_SYSCALL PT_CONTINUE
-# endif
+#define PT_SYSCALL PT_CONTINUE
+#endif
#endif
/* Some systems, at least AIX and HP-UX have a ptrace with five
@@ -127,19 +127,17 @@
zero. */
#ifdef PTRACE_TYPE_ARG5
-# ifdef HAVE_PTRACE64
-# define ptrace(request, pid, addr, data) \
- ptrace64 (request, pid, addr, data, 0)
-# undef PTRACE_TYPE_ARG3
-# define PTRACE_TYPE_ARG3 long long
-# else
-# define ptrace(request, pid, addr, data) \
- ptrace (request, pid, addr, data, 0)
-# endif
+#ifdef HAVE_PTRACE64
+#define ptrace(request, pid, addr, data) ptrace64 (request, pid, addr, data, 0)
+#undef PTRACE_TYPE_ARG3
+#define PTRACE_TYPE_ARG3 long long
+#else
+#define ptrace(request, pid, addr, data) ptrace (request, pid, addr, data, 0)
+#endif
#else
/* Wrapper that avoids adding a pointless cast to all callers. */
-# define ptrace(request, pid, addr, data) \
- ptrace ((PTRACE_TYPE_ARG1) request, pid, addr, data)
+#define ptrace(request, pid, addr, data) \
+ ptrace ((PTRACE_TYPE_ARG1) request, pid, addr, data)
#endif
#endif /* NAT_GDB_PTRACE_H */
diff --git a/gdb/nat/gdb_thread_db.h b/gdb/nat/gdb_thread_db.h
index 413176c9f09..9e682bf3845 100644
--- a/gdb/nat/gdb_thread_db.h
+++ b/gdb/nat/gdb_thread_db.h
@@ -39,15 +39,15 @@
typedef td_err_e (td_init_ftype) (void);
-typedef td_err_e (td_ta_new_ftype) (struct ps_prochandle * ps,
+typedef td_err_e (td_ta_new_ftype) (struct ps_prochandle *ps,
td_thragent_t **ta);
typedef td_err_e (td_ta_delete_ftype) (td_thragent_t *ta_p);
typedef td_err_e (td_ta_map_lwp2thr_ftype) (const td_thragent_t *ta,
lwpid_t lwpid, td_thrhandle_t *th);
typedef td_err_e (td_ta_thr_iter_ftype) (const td_thragent_t *ta,
- td_thr_iter_f *callback, void *cbdata_p,
- td_thr_state_e state, int ti_pri,
- sigset_t *ti_sigmask_p,
+ td_thr_iter_f *callback,
+ void *cbdata_p, td_thr_state_e state,
+ int ti_pri, sigset_t *ti_sigmask_p,
unsigned int ti_user_flags);
typedef td_err_e (td_ta_event_addr_ftype) (const td_thragent_t *ta,
td_event_e event, td_notify_t *ptr);
@@ -65,12 +65,13 @@ typedef td_err_e (td_thr_event_enable_ftype) (const td_thrhandle_t *th,
typedef td_err_e (td_thr_tls_get_addr_ftype) (const td_thrhandle_t *th,
psaddr_t map_address,
- size_t offset, psaddr_t *address);
+ size_t offset,
+ psaddr_t *address);
typedef td_err_e (td_thr_tlsbase_ftype) (const td_thrhandle_t *th,
unsigned long int modid,
psaddr_t *base);
-typedef const char ** (td_symbol_list_ftype) (void);
+typedef const char **(td_symbol_list_ftype) (void);
typedef td_err_e (td_ta_delete_ftype) (td_thragent_t *);
#endif /* NAT_GDB_THREAD_DB_H */
diff --git a/gdb/nat/glibc_thread_db.h b/gdb/nat/glibc_thread_db.h
index 598805deef2..825693d0100 100644
--- a/gdb/nat/glibc_thread_db.h
+++ b/gdb/nat/glibc_thread_db.h
@@ -27,7 +27,6 @@
#include <sys/types.h>
#include <sys/procfs.h>
-
/* Error codes of the library. */
typedef enum
{
@@ -54,11 +53,10 @@ typedef enum
TD_NOXREGS, /* X register set not available for given thread. */
TD_TLSDEFER, /* Thread has not yet allocated TLS for given module. */
TD_NOTALLOC = TD_TLSDEFER,
- TD_VERSION, /* Version if libpthread and libthread_db do not match. */
- TD_NOTLS /* There is no TLS segment in the given module. */
+ TD_VERSION, /* Version if libpthread and libthread_db do not match. */
+ TD_NOTLS /* There is no TLS segment in the given module. */
} td_err_e;
-
/* Possible thread states. TD_THR_ANY_STATE is a pseudo-state used to
select threads regardless of state in td_ta_thr_iter(). */
typedef enum
@@ -82,7 +80,6 @@ typedef enum
TD_THR_SYSTEM
} td_thr_type_e;
-
/* Types of the debugging library. */
/* Handle for a process. This type is opaque. */
@@ -95,21 +92,18 @@ typedef struct td_thrhandle
psaddr_t th_unique;
} td_thrhandle_t;
-
/* Forward declaration of a type defined by and for the dynamic linker. */
struct link_map;
-
/* Flags for `td_ta_thr_iter'. */
-#define TD_THR_ANY_USER_FLAGS 0xffffffff
-#define TD_THR_LOWEST_PRIORITY -20
-#define TD_SIGNO_MASK NULL
-
+#define TD_THR_ANY_USER_FLAGS 0xffffffff
+#define TD_THR_LOWEST_PRIORITY -20
+#define TD_SIGNO_MASK NULL
-#define TD_EVENTSIZE 2
-#define BT_UISHIFT 5 /* log base 2 of BT_NBIPUI, to extract word index */
-#define BT_NBIPUI (1 << BT_UISHIFT) /* n bits per uint */
-#define BT_UIMASK (BT_NBIPUI - 1) /* to extract bit index */
+#define TD_EVENTSIZE 2
+#define BT_UISHIFT 5 /* log base 2 of BT_NBIPUI, to extract word index */
+#define BT_NBIPUI (1 << BT_UISHIFT) /* n bits per uint */
+#define BT_UIMASK (BT_NBIPUI - 1) /* to extract bit index */
/* Bitmask of enabled events. */
typedef struct td_thr_events
@@ -118,24 +112,26 @@ typedef struct td_thr_events
} td_thr_events_t;
/* Event set manipulation macros. */
-#define __td_eventmask(n) \
- (UINT32_C (1) << (((n) - 1) & BT_UIMASK))
-#define __td_eventword(n) \
- ((UINT32_C ((n) - 1)) >> BT_UISHIFT)
-
-#define td_event_emptyset(setp) \
- do { \
- int __i; \
- for (__i = TD_EVENTSIZE; __i > 0; --__i) \
- (setp)->event_bits[__i - 1] = 0; \
- } while (0)
-
-#define td_event_fillset(setp) \
- do { \
- int __i; \
- for (__i = TD_EVENTSIZE; __i > 0; --__i) \
- (setp)->event_bits[__i - 1] = UINT32_C (0xffffffff); \
- } while (0)
+#define __td_eventmask(n) (UINT32_C (1) << (((n) -1) & BT_UIMASK))
+#define __td_eventword(n) ((UINT32_C ((n) -1)) >> BT_UISHIFT)
+
+#define td_event_emptyset(setp) \
+ do \
+ { \
+ int __i; \
+ for (__i = TD_EVENTSIZE; __i > 0; --__i) \
+ (setp)->event_bits[__i - 1] = 0; \
+ } \
+ while (0)
+
+#define td_event_fillset(setp) \
+ do \
+ { \
+ int __i; \
+ for (__i = TD_EVENTSIZE; __i > 0; --__i) \
+ (setp)->event_bits[__i - 1] = UINT32_C (0xffffffff); \
+ } \
+ while (0)
#define td_event_addset(setp, n) \
(((setp)->event_bits[__td_eventword (n)]) |= __td_eventmask (n))
@@ -144,10 +140,10 @@ typedef struct td_thr_events
#define td_eventismember(setp, n) \
(__td_eventmask (n) & ((setp)->event_bits[__td_eventword (n)]))
#if TD_EVENTSIZE == 2
-# define td_eventisempty(setp) \
+#define td_eventisempty(setp) \
(!((setp)->event_bits[0]) && !((setp)->event_bits[1]))
#else
-# error "td_eventisempty must be changed to match TD_EVENTSIZE"
+#error "td_eventisempty must be changed to match TD_EVENTSIZE"
#endif
/* Events reportable by the thread implementation. */
@@ -171,124 +167,118 @@ typedef enum
TD_TIMEOUT, /* Conditional variable wait timed out. */
TD_MIN_EVENT_NUM = TD_READY,
TD_MAX_EVENT_NUM = TD_TIMEOUT,
- TD_EVENTS_ENABLE = 31 /* Event reporting enabled. */
+ TD_EVENTS_ENABLE = 31 /* Event reporting enabled. */
} td_event_e;
/* Values representing the different ways events are reported. */
typedef enum
{
- NOTIFY_BPT, /* User must insert breakpoint at u.bptaddr. */
- NOTIFY_AUTOBPT, /* Breakpoint at u.bptaddr is automatically
+ NOTIFY_BPT, /* User must insert breakpoint at u.bptaddr. */
+ NOTIFY_AUTOBPT, /* Breakpoint at u.bptaddr is automatically
inserted. */
- NOTIFY_SYSCALL /* System call u.syscallno will be invoked. */
+ NOTIFY_SYSCALL /* System call u.syscallno will be invoked. */
} td_notify_e;
/* Description how event type is reported. */
typedef struct td_notify
{
- td_notify_e type; /* Way the event is reported. */
+ td_notify_e type; /* Way the event is reported. */
+
union
{
- psaddr_t bptaddr; /* Address of breakpoint. */
- int syscallno; /* Number of system call used. */
+ psaddr_t bptaddr; /* Address of breakpoint. */
+ int syscallno; /* Number of system call used. */
} u;
} td_notify_t;
/* Structure used to report event. */
typedef struct td_event_msg
{
- td_event_e event; /* Event type being reported. */
- const td_thrhandle_t *th_p; /* Thread reporting the event. */
+ td_event_e event; /* Event type being reported. */
+ const td_thrhandle_t *th_p; /* Thread reporting the event. */
+
union
{
-# if 0
+#if 0
td_synchandle_t *sh; /* Handle of synchronization object. */
#endif
- uintptr_t data; /* Event specific data. */
+ uintptr_t data; /* Event specific data. */
} msg;
} td_event_msg_t;
/* Structure containing event data available in each thread structure. */
typedef struct
{
- td_thr_events_t eventmask; /* Mask of enabled events. */
- td_event_e eventnum; /* Number of last event. */
- void *eventdata; /* Data associated with event. */
+ td_thr_events_t eventmask; /* Mask of enabled events. */
+ td_event_e eventnum; /* Number of last event. */
+ void *eventdata; /* Data associated with event. */
} td_eventbuf_t;
-
/* Gathered statistics about the process. */
typedef struct td_ta_stats
{
- int nthreads; /* Total number of threads in use. */
- int r_concurrency; /* Concurrency level requested by user. */
- int nrunnable_num; /* Average runnable threads, numerator. */
- int nrunnable_den; /* Average runnable threads, denominator. */
- int a_concurrency_num; /* Achieved concurrency level, numerator. */
- int a_concurrency_den; /* Achieved concurrency level, denominator. */
- int nlwps_num; /* Average number of processes in use,
+ int nthreads; /* Total number of threads in use. */
+ int r_concurrency; /* Concurrency level requested by user. */
+ int nrunnable_num; /* Average runnable threads, numerator. */
+ int nrunnable_den; /* Average runnable threads, denominator. */
+ int a_concurrency_num; /* Achieved concurrency level, numerator. */
+ int a_concurrency_den; /* Achieved concurrency level, denominator. */
+ int nlwps_num; /* Average number of processes in use,
numerator. */
- int nlwps_den; /* Average number of processes in use,
+ int nlwps_den; /* Average number of processes in use,
denominator. */
- int nidle_num; /* Average number of idling processes,
+ int nidle_num; /* Average number of idling processes,
numerator. */
- int nidle_den; /* Average number of idling processes,
+ int nidle_den; /* Average number of idling processes,
denominator. */
} td_ta_stats_t;
-
/* Since Sun's library is based on Solaris threads we have to define a few
types to map them to POSIX threads. */
typedef pthread_t thread_t;
typedef pthread_key_t thread_key_t;
-
/* Callback for iteration over threads. */
typedef int td_thr_iter_f (const td_thrhandle_t *, void *);
/* Callback for iteration over thread local data. */
typedef int td_key_iter_f (thread_key_t, void (*) (void *), void *);
-
-
/* Forward declaration. This has to be defined by the user. */
struct ps_prochandle;
-
/* Information about the thread. */
typedef struct td_thrinfo
{
- td_thragent_t *ti_ta_p; /* Process handle. */
- unsigned int ti_user_flags; /* Unused. */
- thread_t ti_tid; /* Thread ID returned by
+ td_thragent_t *ti_ta_p; /* Process handle. */
+ unsigned int ti_user_flags; /* Unused. */
+ thread_t ti_tid; /* Thread ID returned by
pthread_create(). */
- char *ti_tls; /* Pointer to thread-local data. */
- psaddr_t ti_startfunc; /* Start function passed to
+ char *ti_tls; /* Pointer to thread-local data. */
+ psaddr_t ti_startfunc; /* Start function passed to
pthread_create(). */
- psaddr_t ti_stkbase; /* Base of thread's stack. */
- long int ti_stksize; /* Size of thread's stack. */
- psaddr_t ti_ro_area; /* Unused. */
- int ti_ro_size; /* Unused. */
- td_thr_state_e ti_state; /* Thread state. */
- unsigned char ti_db_suspended; /* Nonzero if suspended by debugger. */
- td_thr_type_e ti_type; /* Type of the thread (system vs
+ psaddr_t ti_stkbase; /* Base of thread's stack. */
+ long int ti_stksize; /* Size of thread's stack. */
+ psaddr_t ti_ro_area; /* Unused. */
+ int ti_ro_size; /* Unused. */
+ td_thr_state_e ti_state; /* Thread state. */
+ unsigned char ti_db_suspended; /* Nonzero if suspended by debugger. */
+ td_thr_type_e ti_type; /* Type of the thread (system vs
user thread). */
- intptr_t ti_pc; /* Unused. */
- intptr_t ti_sp; /* Unused. */
- short int ti_flags; /* Unused. */
- int ti_pri; /* Thread priority. */
- lwpid_t ti_lid; /* Kernel PID for this thread. */
- sigset_t ti_sigmask; /* Signal mask. */
- unsigned char ti_traceme; /* Nonzero if event reporting
+ intptr_t ti_pc; /* Unused. */
+ intptr_t ti_sp; /* Unused. */
+ short int ti_flags; /* Unused. */
+ int ti_pri; /* Thread priority. */
+ lwpid_t ti_lid; /* Kernel PID for this thread. */
+ sigset_t ti_sigmask; /* Signal mask. */
+ unsigned char ti_traceme; /* Nonzero if event reporting
enabled. */
- unsigned char ti_preemptflag; /* Unused. */
- unsigned char ti_pirecflag; /* Unused. */
- sigset_t ti_pending; /* Set of pending signals. */
- td_thr_events_t ti_events; /* Set of enabled events. */
+ unsigned char ti_preemptflag; /* Unused. */
+ unsigned char ti_pirecflag; /* Unused. */
+ sigset_t ti_pending; /* Set of pending signals. */
+ td_thr_events_t ti_events; /* Set of enabled events. */
} td_thrinfo_t;
-
-
/* Prototypes for exported library functions. */
/* Initialize the thread debug support library. */
@@ -324,7 +314,6 @@ extern td_err_e td_ta_map_id2thr (const td_thragent_t *__ta, pthread_t __pt,
extern td_err_e td_ta_map_lwp2thr (const td_thragent_t *__ta, lwpid_t __lwpid,
td_thrhandle_t *__th);
-
/* Call for each thread in a process associated with TA the callback function
CALLBACK. */
extern td_err_e td_ta_thr_iter (const td_thragent_t *__ta,
@@ -337,7 +326,6 @@ extern td_err_e td_ta_thr_iter (const td_thragent_t *__ta,
extern td_err_e td_ta_tsd_iter (const td_thragent_t *__ta, td_key_iter_f *__ki,
void *__p);
-
/* Get event address for EVENT. */
extern td_err_e td_ta_event_addr (const td_thragent_t *__ta,
td_event_e __event, td_notify_t *__ptr);
@@ -354,11 +342,9 @@ extern td_err_e td_ta_clear_event (const td_thragent_t *__ta,
extern td_err_e td_ta_event_getmsg (const td_thragent_t *__ta,
td_event_msg_t *__msg);
-
/* Set suggested concurrency level for process associated with TA. */
extern td_err_e td_ta_setconcurrency (const td_thragent_t *__ta, int __level);
-
/* Enable collecting statistics for process associated with TA. */
extern td_err_e td_ta_enable_stats (const td_thragent_t *__ta, int __enable);
@@ -369,7 +355,6 @@ extern td_err_e td_ta_reset_stats (const td_thragent_t *__ta);
extern td_err_e td_ta_get_stats (const td_thragent_t *__ta,
td_ta_stats_t *__statsp);
-
/* Validate that TH is a thread handle. */
extern td_err_e td_thr_validate (const td_thrhandle_t *__th);
@@ -403,18 +388,15 @@ extern td_err_e td_thr_setgregs (const td_thrhandle_t *__th,
extern td_err_e td_thr_setxregs (const td_thrhandle_t *__th,
const void *__addr);
-
/* Get address of the given module's TLS storage area for the given thread. */
extern td_err_e td_thr_tlsbase (const td_thrhandle_t *__th,
- unsigned long int __modid,
- psaddr_t *__base);
+ unsigned long int __modid, psaddr_t *__base);
/* Get address of thread local variable. */
extern td_err_e td_thr_tls_get_addr (const td_thrhandle_t *__th,
psaddr_t __map_address, size_t __offset,
psaddr_t *__address);
-
/* Enable reporting for EVENT for thread TH. */
extern td_err_e td_thr_event_enable (const td_thrhandle_t *__th, int __event);
@@ -430,11 +412,9 @@ extern td_err_e td_thr_clear_event (const td_thrhandle_t *__th,
extern td_err_e td_thr_event_getmsg (const td_thrhandle_t *__th,
td_event_msg_t *__msg);
-
/* Set priority of thread TH. */
extern td_err_e td_thr_setprio (const td_thrhandle_t *__th, int __prio);
-
/* Set pending signals for thread TH. */
extern td_err_e td_thr_setsigpending (const td_thrhandle_t *__th,
unsigned char __n, const sigset_t *__ss);
@@ -443,12 +423,10 @@ extern td_err_e td_thr_setsigpending (const td_thrhandle_t *__th,
extern td_err_e td_thr_sigsetmask (const td_thrhandle_t *__th,
const sigset_t *__ss);
-
/* Return thread local data associated with key TK in thread TH. */
extern td_err_e td_thr_tsd (const td_thrhandle_t *__th,
const thread_key_t __tk, void **__data);
-
/* Suspend execution of thread TH. */
extern td_err_e td_thr_dbsuspend (const td_thrhandle_t *__th);
diff --git a/gdb/nat/linux-btrace.c b/gdb/nat/linux-btrace.c
index c5b3f1c93cf..138a6e3e085 100644
--- a/gdb/nat/linux-btrace.c
+++ b/gdb/nat/linux-btrace.c
@@ -277,7 +277,7 @@ perf_event_sample_ok (const struct perf_event_sample *sample)
part at the end and its upper part at the beginning of the buffer. */
static std::vector<btrace_block> *
-perf_event_read_bts (struct btrace_target_info* tinfo, const uint8_t *begin,
+perf_event_read_bts (struct btrace_target_info *tinfo, const uint8_t *begin,
const uint8_t *end, const uint8_t *start, size_t size)
{
std::vector<btrace_block> *btrace = new std::vector<btrace_block>;
@@ -338,7 +338,7 @@ perf_event_read_bts (struct btrace_target_info* tinfo, const uint8_t *begin,
if (!perf_event_sample_ok (psample))
{
- warning (_("Branch trace may be incomplete."));
+ warning (_ ("Branch trace may be incomplete."));
break;
}
@@ -432,19 +432,21 @@ diagnose_perf_event_open_fail ()
errno = 0;
gdb_file_up file = gdb_fopen_cloexec (filename, "r");
if (file.get () == nullptr)
- error (_("Failed to open %s (%s). Your system does not support "
- "process recording."), filename, safe_strerror (errno));
+ error (_ ("Failed to open %s (%s). Your system does not support "
+ "process recording."),
+ filename, safe_strerror (errno));
int level, found = fscanf (file.get (), "%d", &level);
if (found == 1 && level > 2)
- error (_("You do not have permission to record the process. "
- "Try setting %s to 2 or less."), filename);
+ error (_ ("You do not have permission to record the process. "
+ "Try setting %s to 2 or less."),
+ filename);
}
break;
}
- error (_("Failed to start recording: %s"), safe_strerror (errno));
+ error (_ ("Failed to start recording: %s"), safe_strerror (errno));
}
/* Enable branch tracing in BTS format. */
@@ -458,10 +460,10 @@ linux_enable_bts (ptid_t ptid, const struct btrace_config_bts *conf)
int pid, pg;
if (!cpu_supports_bts ())
- error (_("BTS support has been disabled for the target cpu."));
+ error (_ ("BTS support has been disabled for the target cpu."));
- gdb::unique_xmalloc_ptr<btrace_target_info> tinfo
- (XCNEW (btrace_target_info));
+ gdb::unique_xmalloc_ptr<btrace_target_info> tinfo (
+ XCNEW (btrace_target_info));
tinfo->ptid = ptid;
tinfo->conf.format = BTRACE_FORMAT_BTS;
@@ -530,13 +532,13 @@ linux_enable_bts (ptid_t ptid, const struct btrace_config_bts *conf)
}
if (pages == 0)
- error (_("Failed to map trace buffer: %s."), safe_strerror (errno));
+ error (_ ("Failed to map trace buffer: %s."), safe_strerror (errno));
- struct perf_event_mmap_page *header = (struct perf_event_mmap_page *)
- data.get ();
+ struct perf_event_mmap_page *header
+ = (struct perf_event_mmap_page *) data.get ();
data_offset = PAGE_SIZE;
-#if defined (PERF_ATTR_SIZE_VER5)
+#if defined(PERF_ATTR_SIZE_VER5)
if (offsetof (struct perf_event_mmap_page, data_size) <= header->size)
{
__u64 data_size;
@@ -548,7 +550,7 @@ linux_enable_bts (ptid_t ptid, const struct btrace_config_bts *conf)
/* Check for overflows. */
if ((__u64) size != data_size)
- error (_("Failed to determine trace buffer size."));
+ error (_ ("Failed to determine trace buffer size."));
}
#endif /* defined (PERF_ATTR_SIZE_VER5) */
@@ -563,7 +565,7 @@ linux_enable_bts (ptid_t ptid, const struct btrace_config_bts *conf)
return tinfo.release ();
}
-#if defined (PERF_ATTR_SIZE_VER5)
+#if defined(PERF_ATTR_SIZE_VER5)
/* Determine the event type. */
@@ -580,21 +582,23 @@ perf_event_pt_event_type ()
case EACCES:
case EFAULT:
case EPERM:
- error (_("Failed to open %s (%s). You do not have permission "
- "to use Intel PT."), filename, safe_strerror (errno));
+ error (_ ("Failed to open %s (%s). You do not have permission "
+ "to use Intel PT."),
+ filename, safe_strerror (errno));
case ENOTDIR:
case ENOENT:
- error (_("Failed to open %s (%s). Your system does not support "
- "Intel PT."), filename, safe_strerror (errno));
+ error (_ ("Failed to open %s (%s). Your system does not support "
+ "Intel PT."),
+ filename, safe_strerror (errno));
default:
- error (_("Failed to open %s: %s."), filename, safe_strerror (errno));
+ error (_ ("Failed to open %s: %s."), filename, safe_strerror (errno));
}
int type, found = fscanf (file.get (), "%d", &type);
if (found != 1)
- error (_("Failed to read the PT event type from %s."), filename);
+ error (_ ("Failed to read the PT event type from %s."), filename);
return type;
}
@@ -612,8 +616,8 @@ linux_enable_pt (ptid_t ptid, const struct btrace_config_pt *conf)
if (pid == 0)
pid = ptid.pid ();
- gdb::unique_xmalloc_ptr<btrace_target_info> tinfo
- (XCNEW (btrace_target_info));
+ gdb::unique_xmalloc_ptr<btrace_target_info> tinfo (
+ XCNEW (btrace_target_info));
tinfo->ptid = ptid;
tinfo->conf.format = BTRACE_FORMAT_PT;
@@ -635,10 +639,10 @@ linux_enable_pt (ptid_t ptid, const struct btrace_config_pt *conf)
scoped_mmap data (nullptr, PAGE_SIZE, PROT_READ | PROT_WRITE, MAP_SHARED,
fd.get (), 0);
if (data.get () == MAP_FAILED)
- error (_("Failed to map trace user page: %s."), safe_strerror (errno));
+ error (_ ("Failed to map trace user page: %s."), safe_strerror (errno));
- struct perf_event_mmap_page *header = (struct perf_event_mmap_page *)
- data.get ();
+ struct perf_event_mmap_page *header
+ = (struct perf_event_mmap_page *) data.get ();
header->aux_offset = header->data_offset + header->data_size;
@@ -685,7 +689,7 @@ linux_enable_pt (ptid_t ptid, const struct btrace_config_pt *conf)
}
if (pages == 0)
- error (_("Failed to map trace buffer: %s."), safe_strerror (errno));
+ error (_ ("Failed to map trace buffer: %s."), safe_strerror (errno));
pt->pt.size = aux.size ();
pt->pt.mem = (const uint8_t *) aux.release ();
@@ -703,7 +707,7 @@ linux_enable_pt (ptid_t ptid, const struct btrace_config_pt *conf)
static struct btrace_target_info *
linux_enable_pt (ptid_t ptid, const struct btrace_config_pt *conf)
{
- error (_("Intel Processor Trace support was disabled at compile time."));
+ error (_ ("Intel Processor Trace support was disabled at compile time."));
}
#endif /* !defined (PERF_ATTR_SIZE_VER5) */
@@ -716,10 +720,10 @@ linux_enable_btrace (ptid_t ptid, const struct btrace_config *conf)
switch (conf->format)
{
case BTRACE_FORMAT_NONE:
- error (_("Bad branch trace format."));
+ error (_ ("Bad branch trace format."));
default:
- error (_("Unknown branch trace format."));
+ error (_ ("Unknown branch trace format."));
case BTRACE_FORMAT_BTS:
return linux_enable_bts (ptid, &conf->bts);
@@ -734,7 +738,7 @@ linux_enable_btrace (ptid_t ptid, const struct btrace_config *conf)
static enum btrace_error
linux_disable_bts (struct btrace_tinfo_bts *tinfo)
{
- munmap((void *) tinfo->header, tinfo->bts.size + PAGE_SIZE);
+ munmap ((void *) tinfo->header, tinfo->bts.size + PAGE_SIZE);
close (tinfo->file);
return BTRACE_ERR_NONE;
@@ -745,8 +749,8 @@ linux_disable_bts (struct btrace_tinfo_bts *tinfo)
static enum btrace_error
linux_disable_pt (struct btrace_tinfo_pt *tinfo)
{
- munmap((void *) tinfo->pt.mem, tinfo->pt.size);
- munmap((void *) tinfo->header, PAGE_SIZE);
+ munmap ((void *) tinfo->pt.mem, tinfo->pt.size);
+ munmap ((void *) tinfo->header, PAGE_SIZE);
close (tinfo->file);
return BTRACE_ERR_NONE;
@@ -785,8 +789,7 @@ linux_disable_btrace (struct btrace_target_info *tinfo)
static enum btrace_error
linux_read_bts (struct btrace_data_bts *btrace,
- struct btrace_target_info *tinfo,
- enum btrace_read_type type)
+ struct btrace_target_info *tinfo, enum btrace_read_type type)
{
struct perf_event_buffer *pevent;
const uint8_t *begin, *end, *start;
@@ -887,8 +890,7 @@ linux_fill_btrace_pt_config (struct btrace_data_pt_config *conf)
given by TINFO into BTRACE using the TYPE reading method. */
static enum btrace_error
-linux_read_pt (struct btrace_data_pt *btrace,
- struct btrace_target_info *tinfo,
+linux_read_pt (struct btrace_data_pt *btrace, struct btrace_target_info *tinfo,
enum btrace_read_type type)
{
struct perf_event_buffer *pt;
@@ -914,7 +916,7 @@ linux_read_pt (struct btrace_data_pt *btrace,
return BTRACE_ERR_NONE;
}
- internal_error (_("Unknown btrace read type."));
+ internal_error (_ ("Unknown btrace read type."));
}
/* See linux-btrace.h. */
@@ -945,7 +947,7 @@ linux_read_btrace (struct btrace_data *btrace,
return linux_read_pt (&btrace->variant.pt, tinfo, type);
}
- internal_error (_("Unkown branch trace format."));
+ internal_error (_ ("Unkown branch trace format."));
}
/* See linux-btrace.h. */
diff --git a/gdb/nat/linux-btrace.h b/gdb/nat/linux-btrace.h
index ab69647c591..56fa7f4dadb 100644
--- a/gdb/nat/linux-btrace.h
+++ b/gdb/nat/linux-btrace.h
@@ -24,7 +24,7 @@
#include "gdbsupport/btrace-common.h"
#if HAVE_LINUX_PERF_EVENT_H
-# include <linux/perf_event.h>
+#include <linux/perf_event.h>
#endif
struct target_ops;
@@ -104,7 +104,7 @@ struct btrace_target_info
/* See to_enable_btrace in target.h. */
extern struct btrace_target_info *
- linux_enable_btrace (ptid_t ptid, const struct btrace_config *conf);
+linux_enable_btrace (ptid_t ptid, const struct btrace_config *conf);
/* See to_disable_btrace in target.h. */
extern enum btrace_error linux_disable_btrace (struct btrace_target_info *ti);
@@ -116,6 +116,6 @@ extern enum btrace_error linux_read_btrace (struct btrace_data *btrace,
/* See to_btrace_conf in target.h. */
extern const struct btrace_config *
- linux_btrace_conf (const struct btrace_target_info *);
+linux_btrace_conf (const struct btrace_target_info *);
#endif /* NAT_LINUX_BTRACE_H */
diff --git a/gdb/nat/linux-namespaces.c b/gdb/nat/linux-namespaces.c
index 4b1fee18425..f3981298cdc 100644
--- a/gdb/nat/linux-namespaces.c
+++ b/gdb/nat/linux-namespaces.c
@@ -97,8 +97,7 @@ linux_ns_filename (struct linux_ns *ns, int pid)
static char filename[PATH_MAX];
gdb_assert (pid > 0);
- xsnprintf (filename, sizeof (filename), "/proc/%d/ns/%s", pid,
- ns->filename);
+ xsnprintf (filename, sizeof (filename), "/proc/%d/ns/%s", pid, ns->filename);
return filename;
}
@@ -109,15 +108,9 @@ linux_ns_filename (struct linux_ns *ns, int pid)
static struct linux_ns *
linux_ns_get_namespace (enum linux_ns_type type)
{
- static struct linux_ns namespaces[NUM_LINUX_NS_TYPES] =
- {
- { "ipc" },
- { "mnt" },
- { "net" },
- { "pid" },
- { "user" },
- { "uts" },
- };
+ static struct linux_ns namespaces[NUM_LINUX_NS_TYPES] = {
+ { "ipc" }, { "mnt" }, { "net" }, { "pid" }, { "user" }, { "uts" },
+ };
struct linux_ns *ns;
gdb_assert (type >= 0 && type < NUM_LINUX_NS_TYPES);
@@ -220,58 +213,57 @@ linux_ns_same (pid_t pid, enum linux_ns_type type)
/* Mount namespace helper message types. */
enum mnsh_msg_type
- {
- /* A communication error occurred. Receipt of this message
+{
+ /* A communication error occurred. Receipt of this message
by either end will cause an assertion failure in the main
process. */
- MNSH_MSG_ERROR,
+ MNSH_MSG_ERROR,
- /* Requests, sent from the main process to the helper. */
+ /* Requests, sent from the main process to the helper. */
- /* A request that the helper call setns. Arguments should
+ /* A request that the helper call setns. Arguments should
be passed in FD and INT1. Helper should respond with a
MNSH_RET_INT. */
- MNSH_REQ_SETNS,
+ MNSH_REQ_SETNS,
- /* A request that the helper call open. Arguments should
+ /* A request that the helper call open. Arguments should
be passed in BUF, INT1 and INT2. The filename (in BUF)
should include a terminating NUL character. The helper
should respond with a MNSH_RET_FD. */
- MNSH_REQ_OPEN,
+ MNSH_REQ_OPEN,
- /* A request that the helper call unlink. The single
+ /* A request that the helper call unlink. The single
argument (the filename) should be passed in BUF, and
should include a terminating NUL character. The helper
should respond with a MNSH_RET_INT. */
- MNSH_REQ_UNLINK,
+ MNSH_REQ_UNLINK,
- /* A request that the helper call readlink. The single
+ /* A request that the helper call readlink. The single
argument (the filename) should be passed in BUF, and
should include a terminating NUL character. The helper
should respond with a MNSH_RET_INTSTR. */
- MNSH_REQ_READLINK,
+ MNSH_REQ_READLINK,
- /* Responses, sent to the main process from the helper. */
+ /* Responses, sent to the main process from the helper. */
- /* Return an integer in INT1 and errno in INT2. */
- MNSH_RET_INT,
+ /* Return an integer in INT1 and errno in INT2. */
+ MNSH_RET_INT,
- /* Return a file descriptor in FD if one was opened or an
+ /* Return a file descriptor in FD if one was opened or an
integer in INT1 otherwise. Return errno in INT2. */
- MNSH_RET_FD,
+ MNSH_RET_FD,
- /* Return an integer in INT1, errno in INT2, and optionally
+ /* Return an integer in INT1, errno in INT2, and optionally
some data in BUF. */
- MNSH_RET_INTSTR,
- };
+ MNSH_RET_INTSTR,
+};
/* Print a string representation of a message using debug_printf.
This function is not async-signal-safe so should never be
called from the helper. */
static void
-mnsh_debug_print_message (enum mnsh_msg_type type,
- int fd, int int1, int int2,
+mnsh_debug_print_message (enum mnsh_msg_type type, int fd, int int1, int int2,
const void *buf, int bufsiz)
{
gdb_byte *c = (gdb_byte *) buf;
@@ -334,9 +326,8 @@ static void mnsh_maybe_mourn_peer (void);
main process and the helper so must be async-signal-safe. */
static ssize_t
-mnsh_send_message (int sock, enum mnsh_msg_type type,
- int fd, int int1, int int2,
- const void *buf, int bufsiz)
+mnsh_send_message (int sock, enum mnsh_msg_type type, int fd, int int1,
+ int int2, const void *buf, int bufsiz)
{
struct msghdr msg;
struct iovec iov[4];
@@ -363,7 +354,7 @@ mnsh_send_message (int sock, enum mnsh_msg_type type,
memcpy (iov[3].iov_base, buf, bufsiz);
iov[3].iov_len = bufsiz;
- msg.msg_iovlen ++;
+ msg.msg_iovlen++;
}
/* Attach FD if supplied. */
@@ -409,9 +400,8 @@ mnsh_send_message (int sock, enum mnsh_msg_type type,
async-signal-safe. */
static ssize_t
-mnsh_recv_message (int sock, enum mnsh_msg_type *type,
- int *fd, int *int1, int *int2,
- void *buf, int bufsiz)
+mnsh_recv_message (int sock, enum mnsh_msg_type *type, int *fd, int *int1,
+ int *int2, void *buf, int bufsiz)
{
struct msghdr msg;
struct iovec iov[4];
@@ -469,10 +459,8 @@ mnsh_recv_message (int sock, enum mnsh_msg_type *type,
/* Unpack the file descriptor if supplied. */
cmsg = CMSG_FIRSTHDR (&msg);
- if (cmsg != NULL
- && cmsg->cmsg_len == CMSG_LEN (sizeof (int))
- && cmsg->cmsg_level == SOL_SOCKET
- && cmsg->cmsg_type == SCM_RIGHTS)
+ if (cmsg != NULL && cmsg->cmsg_len == CMSG_LEN (sizeof (int))
+ && cmsg->cmsg_level == SOL_SOCKET && cmsg->cmsg_type == SCM_RIGHTS)
memcpy (fd, CMSG_DATA (cmsg), sizeof (int));
else
*fd = -1;
@@ -494,15 +482,12 @@ mnsh_recv_message (int sock, enum mnsh_msg_type *type,
#define mnsh_return_int(sock, result, error) \
mnsh_send_message (sock, MNSH_RET_INT, -1, result, error, NULL, 0)
-#define mnsh_return_fd(sock, fd, error) \
- mnsh_send_message (sock, MNSH_RET_FD, \
- (fd) < 0 ? -1 : (fd), \
- (fd) < 0 ? (fd) : 0, \
- error, NULL, 0)
+#define mnsh_return_fd(sock, fd, error) \
+ mnsh_send_message (sock, MNSH_RET_FD, (fd) < 0 ? -1 : (fd), \
+ (fd) < 0 ? (fd) : 0, error, NULL, 0)
#define mnsh_return_intstr(sock, result, buf, bufsiz, error) \
- mnsh_send_message (sock, MNSH_RET_INTSTR, -1, result, error, \
- buf, bufsiz)
+ mnsh_send_message (sock, MNSH_RET_INTSTR, -1, result, error, buf, bufsiz)
/* Handle a MNSH_REQ_SETNS message. Must be async-signal-safe. */
@@ -517,8 +502,7 @@ mnsh_handle_setns (int sock, int fd, int nstype)
/* Handle a MNSH_REQ_OPEN message. Must be async-signal-safe. */
static ssize_t
-mnsh_handle_open (int sock, const char *filename,
- int flags, mode_t mode)
+mnsh_handle_open (int sock, const char *filename, int flags, mode_t mode)
{
scoped_fd fd = gdb_open_cloexec (filename, flags, mode);
return mnsh_return_fd (sock, fd.get (), errno);
@@ -542,9 +526,7 @@ mnsh_handle_readlink (int sock, const char *filename)
char buf[PATH_MAX];
int len = readlink (filename, buf, sizeof (buf));
- return mnsh_return_intstr (sock, len,
- buf, len < 0 ? 0 : len,
- errno);
+ return mnsh_return_intstr (sock, len, buf, len < 0 ? 0 : len, errno);
}
/* The helper process. Never returns. Must be async-signal-safe. */
@@ -561,9 +543,8 @@ mnsh_main (int sock)
char buf[PATH_MAX];
ssize_t size, response = -1;
- size = mnsh_recv_message (sock, &type,
- &fd, &int1, &int2,
- buf, sizeof (buf));
+ size = mnsh_recv_message (sock, &type, &fd, &int1, &int2, buf,
+ sizeof (buf));
if (size >= 0 && size < sizeof (buf))
{
@@ -604,8 +585,7 @@ mnsh_main (int sock)
if (size < 0)
size = 0;
- mnsh_send_message (sock, MNSH_MSG_ERROR,
- -1, int1, int2, buf, size);
+ mnsh_send_message (sock, MNSH_MSG_ERROR, -1, int1, int2, buf, size);
}
}
}
@@ -732,23 +712,23 @@ mnsh_maybe_mourn_peer (void)
else if (pid == -1)
{
if (errno == ECHILD)
- warning (_("mount namespace helper vanished?"));
+ warning (_ ("mount namespace helper vanished?"));
else
- internal_warning (_("unhandled error %d"), errno);
+ internal_warning (_ ("unhandled error %d"), errno);
}
else if (pid == helper->pid)
{
if (WIFEXITED (status))
- warning (_("mount namespace helper exited with status %d"),
+ warning (_ ("mount namespace helper exited with status %d"),
WEXITSTATUS (status));
else if (WIFSIGNALED (status))
- warning (_("mount namespace helper killed by signal %d"),
+ warning (_ ("mount namespace helper killed by signal %d"),
WTERMSIG (status));
else
- internal_warning (_("unhandled status %d"), status);
+ internal_warning (_ ("unhandled status %d"), status);
}
else
- internal_warning (_("unknown pid %d"), pid);
+ internal_warning (_ ("unknown pid %d"), pid);
/* Something unrecoverable happened. */
helper->pid = -1;
@@ -758,20 +738,19 @@ mnsh_maybe_mourn_peer (void)
/* Shortcuts for sending messages to the helper. */
#define mnsh_send_setns(helper, fd, nstype) \
- mnsh_send_message (helper->sock, MNSH_REQ_SETNS, fd, nstype, 0, \
- NULL, 0)
+ mnsh_send_message (helper->sock, MNSH_REQ_SETNS, fd, nstype, 0, NULL, 0)
-#define mnsh_send_open(helper, filename, flags, mode) \
- mnsh_send_message (helper->sock, MNSH_REQ_OPEN, -1, flags, mode, \
- filename, strlen (filename) + 1)
+#define mnsh_send_open(helper, filename, flags, mode) \
+ mnsh_send_message (helper->sock, MNSH_REQ_OPEN, -1, flags, mode, filename, \
+ strlen (filename) + 1)
-#define mnsh_send_unlink(helper, filename) \
- mnsh_send_message (helper->sock, MNSH_REQ_UNLINK, -1, 0, 0, \
- filename, strlen (filename) + 1)
+#define mnsh_send_unlink(helper, filename) \
+ mnsh_send_message (helper->sock, MNSH_REQ_UNLINK, -1, 0, 0, filename, \
+ strlen (filename) + 1)
-#define mnsh_send_readlink(helper, filename) \
- mnsh_send_message (helper->sock, MNSH_REQ_READLINK, -1, 0, 0, \
- filename, strlen (filename) + 1)
+#define mnsh_send_readlink(helper, filename) \
+ mnsh_send_message (helper->sock, MNSH_REQ_READLINK, -1, 0, 0, filename, \
+ strlen (filename) + 1)
/* Receive a message from the helper. Issue an assertion failure if
the message isn't a correctly-formatted MNSH_RET_INT. Set RESULT
@@ -786,9 +765,8 @@ mnsh_recv_int (struct linux_mnsh *helper, int *result, int *error)
ssize_t size;
int fd;
- size = mnsh_recv_message (helper->sock, &type, &fd,
- result, error,
- buf, sizeof (buf));
+ size = mnsh_recv_message (helper->sock, &type, &fd, result, error, buf,
+ sizeof (buf));
if (size < 0)
return -1;
@@ -812,9 +790,8 @@ mnsh_recv_fd (struct linux_mnsh *helper, int *fd, int *error)
ssize_t size;
int result;
- size = mnsh_recv_message (helper->sock, &type, fd,
- &result, error,
- buf, sizeof (buf));
+ size = mnsh_recv_message (helper->sock, &type, fd, &result, error, buf,
+ sizeof (buf));
if (size < 0)
return -1;
@@ -837,17 +814,15 @@ mnsh_recv_fd (struct linux_mnsh *helper, int *fd, int *error)
Set errno and return -1 on error. */
static ssize_t
-mnsh_recv_intstr (struct linux_mnsh *helper,
- int *result, int *error,
+mnsh_recv_intstr (struct linux_mnsh *helper, int *result, int *error,
void *buf, int bufsiz)
{
enum mnsh_msg_type type;
ssize_t size;
int fd;
- size = mnsh_recv_message (helper->sock, &type, &fd,
- result, error,
- buf, bufsiz);
+ size
+ = mnsh_recv_message (helper->sock, &type, &fd, result, error, buf, bufsiz);
if (size < 0)
return -1;
@@ -861,18 +836,18 @@ mnsh_recv_intstr (struct linux_mnsh *helper,
/* Return values for linux_mntns_access_fs. */
enum mnsh_fs_code
- {
- /* Something went wrong, errno is set. */
- MNSH_FS_ERROR = -1,
+{
+ /* Something went wrong, errno is set. */
+ MNSH_FS_ERROR = -1,
- /* The main process is in the correct mount namespace.
+ /* The main process is in the correct mount namespace.
The caller should access the filesystem directly. */
- MNSH_FS_DIRECT,
+ MNSH_FS_DIRECT,
- /* The helper is in the correct mount namespace.
+ /* The helper is in the correct mount namespace.
The caller should access the filesystem via the helper. */
- MNSH_FS_HELPER
- };
+ MNSH_FS_HELPER
+};
/* Return a value indicating how the caller should access the
mount namespace of process PID. */
@@ -898,11 +873,11 @@ linux_mntns_access_fs (pid_t pid)
return MNSH_FS_ERROR;
SCOPE_EXIT
- {
- int save_errno = errno;
- close (fd);
- errno = save_errno;
- };
+ {
+ int save_errno = errno;
+ close (fd);
+ errno = save_errno;
+ };
if (fstat (fd, &sb) != 0)
return MNSH_FS_ERROR;
@@ -948,8 +923,8 @@ linux_mntns_access_fs (pid_t pid)
/* See nat/linux-namespaces.h. */
int
-linux_mntns_open_cloexec (pid_t pid, const char *filename,
- int flags, mode_t mode)
+linux_mntns_open_cloexec (pid_t pid, const char *filename, int flags,
+ mode_t mode)
{
enum mnsh_fs_code access = linux_mntns_access_fs (pid);
struct linux_mnsh *helper;
@@ -1015,8 +990,8 @@ linux_mntns_unlink (pid_t pid, const char *filename)
/* See nat/linux-namespaces.h. */
ssize_t
-linux_mntns_readlink (pid_t pid, const char *filename,
- char *buf, size_t bufsiz)
+linux_mntns_readlink (pid_t pid, const char *filename, char *buf,
+ size_t bufsiz)
{
enum mnsh_fs_code access = linux_mntns_access_fs (pid);
struct linux_mnsh *helper;
diff --git a/gdb/nat/linux-namespaces.h b/gdb/nat/linux-namespaces.h
index a45b99cf650..0a32a1bdc1b 100644
--- a/gdb/nat/linux-namespaces.h
+++ b/gdb/nat/linux-namespaces.h
@@ -27,28 +27,28 @@ extern bool debug_linux_namespaces;
/* Enumeration of Linux namespace types. */
enum linux_ns_type
- {
- /* IPC namespace: System V IPC, POSIX message queues. */
- LINUX_NS_IPC,
+{
+ /* IPC namespace: System V IPC, POSIX message queues. */
+ LINUX_NS_IPC,
- /* Mount namespace: mount points. */
- LINUX_NS_MNT,
+ /* Mount namespace: mount points. */
+ LINUX_NS_MNT,
- /* Network namespace: network devices, stacks, ports, etc. */
- LINUX_NS_NET,
+ /* Network namespace: network devices, stacks, ports, etc. */
+ LINUX_NS_NET,
- /* PID namespace: process IDs. */
- LINUX_NS_PID,
+ /* PID namespace: process IDs. */
+ LINUX_NS_PID,
- /* User namespace: user and group IDs. */
- LINUX_NS_USER,
+ /* User namespace: user and group IDs. */
+ LINUX_NS_USER,
- /* UTS namespace: hostname and NIS domain name. */
- LINUX_NS_UTS,
+ /* UTS namespace: hostname and NIS domain name. */
+ LINUX_NS_UTS,
- /* Number of Linux namespaces. */
- NUM_LINUX_NS_TYPES
- };
+ /* Number of Linux namespaces. */
+ NUM_LINUX_NS_TYPES
+};
/* Return nonzero if process PID has the same TYPE namespace as the
calling process, or if the kernel does not support TYPE namespaces
diff --git a/gdb/nat/linux-nat.h b/gdb/nat/linux-nat.h
index aebb7de668d..84b937fddd2 100644
--- a/gdb/nat/linux-nat.h
+++ b/gdb/nat/linux-nat.h
@@ -52,9 +52,9 @@ typedef int (iterate_over_lwps_ftype) (struct lwp_info *lwp);
LWP immediately. Otherwise return NULL. This function must be
provided by the client. */
-extern struct lwp_info *iterate_over_lwps
- (ptid_t filter,
- gdb::function_view<iterate_over_lwps_ftype> callback);
+extern struct lwp_info *
+iterate_over_lwps (ptid_t filter,
+ gdb::function_view<iterate_over_lwps_ftype> callback);
/* Return the ptid of LWP. */
diff --git a/gdb/nat/linux-osdata.c b/gdb/nat/linux-osdata.c
index 2a160177ce3..39ebe5e1b6c 100644
--- a/gdb/nat/linux-osdata.c
+++ b/gdb/nat/linux-osdata.c
@@ -45,14 +45,14 @@
so that reading pid values embedded in /proc works
consistently. */
-typedef long long PID_T;
+typedef long long PID_T;
/* Define TIME_T to be at least as large as time_t, so that reading
time values embedded in /proc works consistently. */
typedef long long TIME_T;
-#define MAX_PID_T_STRLEN (sizeof ("-9223372036854775808") - 1)
+#define MAX_PID_T_STRLEN (sizeof ("-9223372036854775808") - 1)
/* Returns the CPU core that thread PTID is currently running on. */
@@ -64,8 +64,8 @@ linux_common_core_of_thread (ptid_t ptid)
char filename[sizeof ("/proc//task//stat") + 2 * MAX_PID_T_STRLEN];
int core;
- sprintf (filename, "/proc/%lld/task/%lld/stat",
- (PID_T) ptid.pid (), (PID_T) ptid.lwp ());
+ sprintf (filename, "/proc/%lld/task/%lld/stat", (PID_T) ptid.pid (),
+ (PID_T) ptid.lwp ());
gdb::optional<std::string> content = read_text_file_to_string (filename);
if (!content.has_value ())
@@ -122,7 +122,8 @@ command_from_pid (char *command, int maxlen, PID_T pid)
if (items_read == 2 && pid == stat_pid)
{
cmd[strlen (cmd) - 1] = '\0'; /* Remove trailing parenthesis. */
- strncpy (command, cmd + 1, maxlen); /* Ignore leading parenthesis. */
+ strncpy (command, cmd + 1,
+ maxlen); /* Ignore leading parenthesis. */
}
}
else
@@ -155,7 +156,8 @@ commandline_from_pid (PID_T pid)
if (read_bytes)
{
- commandline = (char *) xrealloc (commandline, len + read_bytes + 1);
+ commandline
+ = (char *) xrealloc (commandline, len + read_bytes + 1);
memcpy (commandline + len, buf, read_bytes);
len += read_bytes;
}
@@ -250,13 +252,12 @@ get_cores_used_by_process (PID_T pid, int *cores, const int num_cores)
PID_T tid;
int core;
- if (!isdigit (dp->d_name[0])
- || NAMELEN (dp) > MAX_PID_T_STRLEN)
+ if (!isdigit (dp->d_name[0]) || NAMELEN (dp) > MAX_PID_T_STRLEN)
continue;
sscanf (dp->d_name, "%lld", &tid);
- core = linux_common_core_of_thread (ptid_t ((pid_t) pid,
- (pid_t) tid));
+ core
+ = linux_common_core_of_thread (ptid_t ((pid_t) pid, (pid_t) tid));
if (core >= 0 && core < num_cores)
{
@@ -356,8 +357,7 @@ linux_xfer_osdata_processes ()
std::string cores_str;
int i;
- if (!isdigit (dp->d_name[0])
- || NAMELEN (dp) > MAX_PID_T_STRLEN)
+ if (!isdigit (dp->d_name[0]) || NAMELEN (dp) > MAX_PID_T_STRLEN)
continue;
sscanf (dp->d_name, "%lld", &pid);
@@ -384,18 +384,15 @@ linux_xfer_osdata_processes ()
xfree (cores);
- string_xml_appendf
- (buffer,
- "<item>"
- "<column name=\"pid\">%lld</column>"
- "<column name=\"user\">%s</column>"
- "<column name=\"command\">%s</column>"
- "<column name=\"cores\">%s</column>"
- "</item>",
- pid,
- user,
- command_line ? command_line : "",
- cores_str.c_str());
+ string_xml_appendf (buffer,
+ "<item>"
+ "<column name=\"pid\">%lld</column>"
+ "<column name=\"user\">%s</column>"
+ "<column name=\"command\">%s</column>"
+ "<column name=\"cores\">%s</column>"
+ "</item>",
+ pid, user, command_line ? command_line : "",
+ cores_str.c_str ());
xfree (command_line);
}
@@ -413,17 +410,16 @@ linux_xfer_osdata_processes ()
struct pid_pgid_entry
{
pid_pgid_entry (PID_T pid_, PID_T pgid_)
- : pid (pid_), pgid (pgid_)
- {}
+ : pid (pid_),
+ pgid (pgid_)
+ {
+ }
/* Return true if this pid is the leader of its process group. */
- bool is_leader () const
- {
- return pid == pgid;
- }
+ bool is_leader () const { return pid == pgid; }
- bool operator< (const pid_pgid_entry &other) const
+ bool operator<(const pid_pgid_entry &other) const
{
/* Sort by PGID. */
if (this->pgid != other.pgid)
@@ -467,8 +463,7 @@ linux_xfer_osdata_processgroups ()
{
PID_T pid, pgid;
- if (!isdigit (dp->d_name[0])
- || NAMELEN (dp) > MAX_PID_T_STRLEN)
+ if (!isdigit (dp->d_name[0]) || NAMELEN (dp) > MAX_PID_T_STRLEN)
continue;
sscanf (dp->d_name, "%lld", &pid);
@@ -493,18 +488,15 @@ linux_xfer_osdata_processgroups ()
command_from_pid (leader_command, sizeof (leader_command), pgid);
command_line = commandline_from_pid (pid);
- string_xml_appendf
- (buffer,
- "<item>"
- "<column name=\"pgid\">%lld</column>"
- "<column name=\"leader command\">%s</column>"
- "<column name=\"pid\">%lld</column>"
- "<column name=\"command line\">%s</column>"
- "</item>",
- pgid,
- leader_command,
- pid,
- command_line ? command_line : "");
+ string_xml_appendf (buffer,
+ "<item>"
+ "<column name=\"pgid\">%lld</column>"
+ "<column name=\"leader command\">%s</column>"
+ "<column name=\"pid\">%lld</column>"
+ "<column name=\"command line\">%s</column>"
+ "</item>",
+ pgid, leader_command, pid,
+ command_line ? command_line : "");
xfree (command_line);
}
@@ -538,10 +530,8 @@ linux_xfer_osdata_threads ()
|| NAMELEN (dp) > sizeof ("4294967295") - 1)
continue;
- xsnprintf (procentry, sizeof (procentry), "/proc/%s",
- dp->d_name);
- if (stat (procentry, &statbuf) == 0
- && S_ISDIR (statbuf.st_mode))
+ xsnprintf (procentry, sizeof (procentry), "/proc/%s", dp->d_name);
+ if (stat (procentry, &statbuf) == 0 && S_ISDIR (statbuf.st_mode))
{
DIR *dirp2;
PID_T pid;
@@ -571,18 +561,15 @@ linux_xfer_osdata_threads ()
tid = atoi (dp2->d_name);
core = linux_common_core_of_thread (ptid_t (pid, tid));
- string_xml_appendf
- (buffer,
- "<item>"
- "<column name=\"pid\">%lld</column>"
- "<column name=\"command\">%s</column>"
- "<column name=\"tid\">%lld</column>"
- "<column name=\"core\">%d</column>"
- "</item>",
- pid,
- command,
- tid,
- core);
+ string_xml_appendf (
+ buffer,
+ "<item>"
+ "<column name=\"pid\">%lld</column>"
+ "<column name=\"command\">%s</column>"
+ "<column name=\"tid\">%lld</column>"
+ "<column name=\"core\">%d</column>"
+ "</item>",
+ pid, command, tid, core);
}
closedir (dirp2);
@@ -648,10 +635,8 @@ linux_xfer_osdata_cpus ()
first_item = 0;
}
- string_xml_appendf (buffer,
- "<column name=\"%s\">%s</column>",
- key,
- value);
+ string_xml_appendf (buffer, "<column name=\"%s\">%s</column>",
+ key, value);
}
}
while (!feof (fp.get ()));
@@ -688,10 +673,8 @@ linux_xfer_osdata_fds ()
|| NAMELEN (dp) > sizeof ("4294967295") - 1)
continue;
- xsnprintf (procentry, sizeof (procentry), "/proc/%s",
- dp->d_name);
- if (stat (procentry, &statbuf) == 0
- && S_ISDIR (statbuf.st_mode))
+ xsnprintf (procentry, sizeof (procentry), "/proc/%s", dp->d_name);
+ if (stat (procentry, &statbuf) == 0 && S_ISDIR (statbuf.st_mode))
{
DIR *dirp2;
PID_T pid;
@@ -700,8 +683,7 @@ linux_xfer_osdata_fds ()
pid = atoi (dp->d_name);
command_from_pid (command, sizeof (command), pid);
- std::string pathname
- = string_printf ("/proc/%s/fd", dp->d_name);
+ std::string pathname = string_printf ("/proc/%s/fd", dp->d_name);
dirp2 = opendir (pathname.c_str ());
if (dirp2)
@@ -719,23 +701,20 @@ linux_xfer_osdata_fds ()
std::string fdname
= string_printf ("%s/%s", pathname.c_str (),
dp2->d_name);
- rslt = readlink (fdname.c_str (), buf,
- sizeof (buf) - 1);
+ rslt = readlink (fdname.c_str (), buf, sizeof (buf) - 1);
if (rslt >= 0)
buf[rslt] = '\0';
- string_xml_appendf
- (buffer,
- "<item>"
- "<column name=\"pid\">%s</column>"
- "<column name=\"command\">%s</column>"
- "<column name=\"file descriptor\">%s</column>"
- "<column name=\"name\">%s</column>"
- "</item>",
- dp->d_name,
- command,
- dp2->d_name,
- (rslt >= 0 ? buf : dp2->d_name));
+ string_xml_appendf (
+ buffer,
+ "<item>"
+ "<column name=\"pid\">%s</column>"
+ "<column name=\"command\">%s</column>"
+ "<column name=\"file descriptor\">%s</column>"
+ "<column name=\"name\">%s</column>"
+ "</item>",
+ dp->d_name, command, dp2->d_name,
+ (rslt >= 0 ? buf : dp2->d_name));
}
closedir (dirp2);
@@ -757,7 +736,8 @@ static const char *
format_socket_state (unsigned char state)
{
/* Copied from include/net/tcp_states.h in the Linux kernel sources. */
- enum {
+ enum
+ {
TCP_ESTABLISHED = 1,
TCP_SYN_SENT,
TCP_SYN_RECV,
@@ -801,11 +781,11 @@ format_socket_state (unsigned char state)
}
union socket_addr
- {
- struct sockaddr sa;
- struct sockaddr_in sin;
- struct sockaddr_in6 sin6;
- };
+{
+ struct sockaddr sa;
+ struct sockaddr_in sin;
+ struct sockaddr_in6 sin6;
+};
/* Auxiliary function used by linux_xfer_osdata_isocket. Formats
information for all open internet sockets of type FAMILY on the
@@ -843,11 +823,10 @@ print_sockets (unsigned short family, int tcp, std::string &buffer)
#endif
result = sscanf (buf,
- "%*d: %32[0-9A-F]:%X %32[0-9A-F]:%X %X %*X:%*X %*X:%*X %*X %d %*d %*u %*s\n",
- local_address, &local_port,
- remote_address, &remote_port,
- &state,
- &uid);
+ "%*d: %32[0-9A-F]:%X %32[0-9A-F]:%X %X %*X:%*X "
+ "%*X:%*X %*X %d %*d %*u %*s\n",
+ local_address, &local_port, remote_address,
+ &remote_port, &state, &uid);
if (result == 6)
{
@@ -894,46 +873,41 @@ print_sockets (unsigned short family, int tcp, std::string &buffer)
locaddr.sa.sa_family = remaddr.sa.sa_family = family;
- result = getnameinfo (&locaddr.sa, addr_size,
- local_address, sizeof (local_address),
- local_service, sizeof (local_service),
+ result = getnameinfo (&locaddr.sa, addr_size, local_address,
+ sizeof (local_address), local_service,
+ sizeof (local_service),
NI_NUMERICHOST | NI_NUMERICSERV
- | (tcp ? 0 : NI_DGRAM));
+ | (tcp ? 0 : NI_DGRAM));
if (result)
continue;
- result = getnameinfo (&remaddr.sa, addr_size,
- remote_address,
- sizeof (remote_address),
- remote_service,
- sizeof (remote_service),
- NI_NUMERICHOST | NI_NUMERICSERV
- | (tcp ? 0 : NI_DGRAM));
+ result
+ = getnameinfo (&remaddr.sa, addr_size, remote_address,
+ sizeof (remote_address), remote_service,
+ sizeof (remote_service),
+ NI_NUMERICHOST | NI_NUMERICSERV
+ | (tcp ? 0 : NI_DGRAM));
if (result)
continue;
user_from_uid (user, sizeof (user), uid);
- string_xml_appendf
- (buffer,
- "<item>"
- "<column name=\"local address\">%s</column>"
- "<column name=\"local port\">%s</column>"
- "<column name=\"remote address\">%s</column>"
- "<column name=\"remote port\">%s</column>"
- "<column name=\"state\">%s</column>"
- "<column name=\"user\">%s</column>"
- "<column name=\"family\">%s</column>"
- "<column name=\"protocol\">%s</column>"
- "</item>",
- local_address,
- local_service,
- remote_address,
- remote_service,
- format_socket_state (state),
- user,
- (family == AF_INET) ? "INET" : "INET6",
- tcp ? "STREAM" : "DGRAM");
+ string_xml_appendf (
+ buffer,
+ "<item>"
+ "<column name=\"local address\">%s</column>"
+ "<column name=\"local port\">%s</column>"
+ "<column name=\"remote address\">%s</column>"
+ "<column name=\"remote port\">%s</column>"
+ "<column name=\"state\">%s</column>"
+ "<column name=\"user\">%s</column>"
+ "<column name=\"family\">%s</column>"
+ "<column name=\"protocol\">%s</column>"
+ "</item>",
+ local_address, local_service, remote_address,
+ remote_service, format_socket_state (state), user,
+ (family == AF_INET) ? "INET" : "INET6",
+ tcp ? "STREAM" : "DGRAM");
}
}
}
@@ -1023,13 +997,10 @@ linux_xfer_osdata_shm ()
unsigned int perms;
int items_read;
- items_read = sscanf (buf,
- "%d %d %o %d %lld %lld %d %u %u %u %u %lld %lld %lld",
- &key, &shmid, &perms, &size,
- &cpid, &lpid,
- &nattch,
- &uid, &gid, &cuid, &cgid,
- &atime, &dtime, &ctime);
+ items_read = sscanf (
+ buf, "%d %d %o %d %lld %lld %d %u %u %u %u %lld %lld %lld",
+ &key, &shmid, &perms, &size, &cpid, &lpid, &nattch, &uid, &gid,
+ &cuid, &cgid, &atime, &dtime, &ctime);
if (items_read == 14)
{
@@ -1050,38 +1021,26 @@ linux_xfer_osdata_shm ()
time_from_time_t (dtime_str, sizeof (dtime_str), dtime);
time_from_time_t (ctime_str, sizeof (ctime_str), ctime);
- string_xml_appendf
- (buffer,
- "<item>"
- "<column name=\"key\">%d</column>"
- "<column name=\"shmid\">%d</column>"
- "<column name=\"permissions\">%o</column>"
- "<column name=\"size\">%d</column>"
- "<column name=\"creator command\">%s</column>"
- "<column name=\"last op. command\">%s</column>"
- "<column name=\"num attached\">%d</column>"
- "<column name=\"user\">%s</column>"
- "<column name=\"group\">%s</column>"
- "<column name=\"creator user\">%s</column>"
- "<column name=\"creator group\">%s</column>"
- "<column name=\"last shmat() time\">%s</column>"
- "<column name=\"last shmdt() time\">%s</column>"
- "<column name=\"last shmctl() time\">%s</column>"
- "</item>",
- key,
- shmid,
- perms,
- size,
- ccmd,
- lcmd,
- nattch,
- user,
- group,
- cuser,
- cgroup,
- atime_str,
- dtime_str,
- ctime_str);
+ string_xml_appendf (
+ buffer,
+ "<item>"
+ "<column name=\"key\">%d</column>"
+ "<column name=\"shmid\">%d</column>"
+ "<column name=\"permissions\">%o</column>"
+ "<column name=\"size\">%d</column>"
+ "<column name=\"creator command\">%s</column>"
+ "<column name=\"last op. command\">%s</column>"
+ "<column name=\"num attached\">%d</column>"
+ "<column name=\"user\">%s</column>"
+ "<column name=\"group\">%s</column>"
+ "<column name=\"creator user\">%s</column>"
+ "<column name=\"creator group\">%s</column>"
+ "<column name=\"last shmat() time\">%s</column>"
+ "<column name=\"last shmdt() time\">%s</column>"
+ "<column name=\"last shmctl() time\">%s</column>"
+ "</item>",
+ key, shmid, perms, size, ccmd, lcmd, nattch, user, group,
+ cuser, cgroup, atime_str, dtime_str, ctime_str);
}
}
}
@@ -1118,11 +1077,9 @@ linux_xfer_osdata_sem ()
TIME_T otime, ctime;
int items_read;
- items_read = sscanf (buf,
- "%d %d %o %u %d %d %d %d %lld %lld",
- &key, &semid, &perms, &nsems,
- &uid, &gid, &cuid, &cgid,
- &otime, &ctime);
+ items_read = sscanf (buf, "%d %d %o %u %d %d %d %d %lld %lld",
+ &key, &semid, &perms, &nsems, &uid, &gid,
+ &cuid, &cgid, &otime, &ctime);
if (items_read == 10)
{
@@ -1138,30 +1095,22 @@ linux_xfer_osdata_sem ()
time_from_time_t (otime_str, sizeof (otime_str), otime);
time_from_time_t (ctime_str, sizeof (ctime_str), ctime);
- string_xml_appendf
- (buffer,
- "<item>"
- "<column name=\"key\">%d</column>"
- "<column name=\"semid\">%d</column>"
- "<column name=\"permissions\">%o</column>"
- "<column name=\"num semaphores\">%u</column>"
- "<column name=\"user\">%s</column>"
- "<column name=\"group\">%s</column>"
- "<column name=\"creator user\">%s</column>"
- "<column name=\"creator group\">%s</column>"
- "<column name=\"last semop() time\">%s</column>"
- "<column name=\"last semctl() time\">%s</column>"
- "</item>",
- key,
- semid,
- perms,
- nsems,
- user,
- group,
- cuser,
- cgroup,
- otime_str,
- ctime_str);
+ string_xml_appendf (
+ buffer,
+ "<item>"
+ "<column name=\"key\">%d</column>"
+ "<column name=\"semid\">%d</column>"
+ "<column name=\"permissions\">%o</column>"
+ "<column name=\"num semaphores\">%u</column>"
+ "<column name=\"user\">%s</column>"
+ "<column name=\"group\">%s</column>"
+ "<column name=\"creator user\">%s</column>"
+ "<column name=\"creator group\">%s</column>"
+ "<column name=\"last semop() time\">%s</column>"
+ "<column name=\"last semctl() time\">%s</column>"
+ "</item>",
+ key, semid, perms, nsems, user, group, cuser, cgroup,
+ otime_str, ctime_str);
}
}
}
@@ -1199,11 +1148,10 @@ linux_xfer_osdata_msg ()
TIME_T stime, rtime, ctime;
int items_read;
- items_read = sscanf (buf,
- "%d %d %o %u %u %lld %lld %d %d %d %d %lld %lld %lld",
- &key, &msqid, &perms, &cbytes, &qnum,
- &lspid, &lrpid, &uid, &gid, &cuid, &cgid,
- &stime, &rtime, &ctime);
+ items_read = sscanf (
+ buf, "%d %d %o %u %u %lld %lld %d %d %d %d %lld %lld %lld",
+ &key, &msqid, &perms, &cbytes, &qnum, &lspid, &lrpid, &uid,
+ &gid, &cuid, &cgid, &stime, &rtime, &ctime);
if (items_read == 14)
{
@@ -1224,38 +1172,26 @@ linux_xfer_osdata_msg ()
time_from_time_t (rtime_str, sizeof (rtime_str), rtime);
time_from_time_t (ctime_str, sizeof (ctime_str), ctime);
- string_xml_appendf
- (buffer,
- "<item>"
- "<column name=\"key\">%d</column>"
- "<column name=\"msqid\">%d</column>"
- "<column name=\"permissions\">%o</column>"
- "<column name=\"num used bytes\">%u</column>"
- "<column name=\"num messages\">%u</column>"
- "<column name=\"last msgsnd() command\">%s</column>"
- "<column name=\"last msgrcv() command\">%s</column>"
- "<column name=\"user\">%s</column>"
- "<column name=\"group\">%s</column>"
- "<column name=\"creator user\">%s</column>"
- "<column name=\"creator group\">%s</column>"
- "<column name=\"last msgsnd() time\">%s</column>"
- "<column name=\"last msgrcv() time\">%s</column>"
- "<column name=\"last msgctl() time\">%s</column>"
- "</item>",
- key,
- msqid,
- perms,
- cbytes,
- qnum,
- lscmd,
- lrcmd,
- user,
- group,
- cuser,
- cgroup,
- stime_str,
- rtime_str,
- ctime_str);
+ string_xml_appendf (
+ buffer,
+ "<item>"
+ "<column name=\"key\">%d</column>"
+ "<column name=\"msqid\">%d</column>"
+ "<column name=\"permissions\">%o</column>"
+ "<column name=\"num used bytes\">%u</column>"
+ "<column name=\"num messages\">%u</column>"
+ "<column name=\"last msgsnd() command\">%s</column>"
+ "<column name=\"last msgrcv() command\">%s</column>"
+ "<column name=\"user\">%s</column>"
+ "<column name=\"group\">%s</column>"
+ "<column name=\"creator user\">%s</column>"
+ "<column name=\"creator group\">%s</column>"
+ "<column name=\"last msgsnd() time\">%s</column>"
+ "<column name=\"last msgrcv() time\">%s</column>"
+ "<column name=\"last msgctl() time\">%s</column>"
+ "</item>",
+ key, msqid, perms, cbytes, qnum, lscmd, lrcmd, user, group,
+ cuser, cgroup, stime_str, rtime_str, ctime_str);
}
}
}
@@ -1328,11 +1264,7 @@ linux_xfer_osdata_modules ()
"<column name=\"status\">%s</column>"
"<column name=\"address\">%llx</column>"
"</item>",
- name,
- size,
- uses,
- dependencies,
- status,
+ name, size, uses, dependencies, status,
address);
}
}
@@ -1346,37 +1278,37 @@ linux_xfer_osdata_modules ()
static std::string linux_xfer_osdata_info_os_types ();
-static struct osdata_type {
+static struct osdata_type
+{
const char *type;
const char *title;
const char *description;
std::string (*take_snapshot) ();
std::string buffer;
-} osdata_table[] = {
- { "types", "Types", "Listing of info os types you can list",
- linux_xfer_osdata_info_os_types },
- { "cpus", "CPUs", "Listing of all cpus/cores on the system",
- linux_xfer_osdata_cpus },
- { "files", "File descriptors", "Listing of all file descriptors",
- linux_xfer_osdata_fds },
- { "modules", "Kernel modules", "Listing of all loaded kernel modules",
- linux_xfer_osdata_modules },
- { "msg", "Message queues", "Listing of all message queues",
- linux_xfer_osdata_msg },
- { "processes", "Processes", "Listing of all processes",
- linux_xfer_osdata_processes },
- { "procgroups", "Process groups", "Listing of all process groups",
- linux_xfer_osdata_processgroups },
- { "semaphores", "Semaphores", "Listing of all semaphores",
- linux_xfer_osdata_sem },
- { "shm", "Shared-memory regions", "Listing of all shared-memory regions",
- linux_xfer_osdata_shm },
- { "sockets", "Sockets", "Listing of all internet-domain sockets",
- linux_xfer_osdata_isockets },
- { "threads", "Threads", "Listing of all threads",
- linux_xfer_osdata_threads },
- { NULL, NULL, NULL }
-};
+} osdata_table[]
+ = { { "types", "Types", "Listing of info os types you can list",
+ linux_xfer_osdata_info_os_types },
+ { "cpus", "CPUs", "Listing of all cpus/cores on the system",
+ linux_xfer_osdata_cpus },
+ { "files", "File descriptors", "Listing of all file descriptors",
+ linux_xfer_osdata_fds },
+ { "modules", "Kernel modules", "Listing of all loaded kernel modules",
+ linux_xfer_osdata_modules },
+ { "msg", "Message queues", "Listing of all message queues",
+ linux_xfer_osdata_msg },
+ { "processes", "Processes", "Listing of all processes",
+ linux_xfer_osdata_processes },
+ { "procgroups", "Process groups", "Listing of all process groups",
+ linux_xfer_osdata_processgroups },
+ { "semaphores", "Semaphores", "Listing of all semaphores",
+ linux_xfer_osdata_sem },
+ { "shm", "Shared-memory regions", "Listing of all shared-memory regions",
+ linux_xfer_osdata_shm },
+ { "sockets", "Sockets", "Listing of all internet-domain sockets",
+ linux_xfer_osdata_isockets },
+ { "threads", "Threads", "Listing of all threads",
+ linux_xfer_osdata_threads },
+ { NULL, NULL, NULL } };
/* Collect data about all types info os can show in BUFFER. */
@@ -1393,8 +1325,7 @@ linux_xfer_osdata_info_os_types ()
"<column name=\"Description\">%s</column>"
"<column name=\"Title\">%s</column>"
"</item>",
- osdata_table[i].type,
- osdata_table[i].description,
+ osdata_table[i].type, osdata_table[i].description,
osdata_table[i].title);
buffer += "</osdata>\n";
@@ -1402,13 +1333,12 @@ linux_xfer_osdata_info_os_types ()
return buffer;
}
-
/* Copies up to LEN bytes in READBUF from offset OFFSET in OSD->BUFFER.
If OFFSET is zero, first calls OSD->TAKE_SNAPSHOT. */
static LONGEST
-common_getter (struct osdata_type *osd,
- gdb_byte *readbuf, ULONGEST offset, ULONGEST len)
+common_getter (struct osdata_type *osd, gdb_byte *readbuf, ULONGEST offset,
+ ULONGEST len)
{
gdb_assert (readbuf);
@@ -1426,7 +1356,6 @@ common_getter (struct osdata_type *osd,
memcpy (readbuf, &osd->buffer[offset], len);
return len;
-
}
LONGEST
@@ -1435,8 +1364,7 @@ linux_common_xfer_osdata (const char *annex, gdb_byte *readbuf,
{
if (!annex || *annex == '\0')
{
- return common_getter (&osdata_table[0],
- readbuf, offset, len);
+ return common_getter (&osdata_table[0], readbuf, offset, len);
}
else
{
@@ -1445,8 +1373,7 @@ linux_common_xfer_osdata (const char *annex, gdb_byte *readbuf,
for (i = 0; osdata_table[i].type; ++i)
{
if (strcmp (annex, osdata_table[i].type) == 0)
- return common_getter (&osdata_table[i],
- readbuf, offset, len);
+ return common_getter (&osdata_table[i], readbuf, offset, len);
}
return 0;
diff --git a/gdb/nat/linux-personality.c b/gdb/nat/linux-personality.c
index c2ae725a879..6e021faa610 100644
--- a/gdb/nat/linux-personality.c
+++ b/gdb/nat/linux-personality.c
@@ -22,14 +22,14 @@
#include <sys/personality.h>
-# if !HAVE_DECL_ADDR_NO_RANDOMIZE
-# define ADDR_NO_RANDOMIZE 0x0040000
-# endif /* ! HAVE_DECL_ADDR_NO_RANDOMIZE */
+#if !HAVE_DECL_ADDR_NO_RANDOMIZE
+#define ADDR_NO_RANDOMIZE 0x0040000
+#endif /* ! HAVE_DECL_ADDR_NO_RANDOMIZE */
/* See comment on nat/linux-personality.h. */
maybe_disable_address_space_randomization::
-maybe_disable_address_space_randomization (int disable_randomization)
+ maybe_disable_address_space_randomization (int disable_randomization)
: m_personality_set (false),
m_personality_orig (0)
{
@@ -42,22 +42,23 @@ maybe_disable_address_space_randomization (int disable_randomization)
m_personality_set = true;
personality (m_personality_orig | ADDR_NO_RANDOMIZE);
}
- if (errno != 0 || (m_personality_set
- && !(personality (0xffffffff) & ADDR_NO_RANDOMIZE)))
- warning (_("Error disabling address space randomization: %s"),
+ if (errno != 0
+ || (m_personality_set
+ && !(personality (0xffffffff) & ADDR_NO_RANDOMIZE)))
+ warning (_ ("Error disabling address space randomization: %s"),
safe_strerror (errno));
}
}
maybe_disable_address_space_randomization::
-~maybe_disable_address_space_randomization ()
+ ~maybe_disable_address_space_randomization ()
{
if (m_personality_set)
{
errno = 0;
personality (m_personality_orig);
if (errno != 0)
- warning (_("Error restoring address space randomization: %s"),
+ warning (_ ("Error restoring address space randomization: %s"),
safe_strerror (errno));
}
}
diff --git a/gdb/nat/linux-procfs.c b/gdb/nat/linux-procfs.c
index 9c2d1beb91f..3e883e69b72 100644
--- a/gdb/nat/linux-procfs.c
+++ b/gdb/nat/linux-procfs.c
@@ -37,7 +37,7 @@ linux_proc_get_int (pid_t lwpid, const char *field, int warn)
if (status_file == NULL)
{
if (warn)
- warning (_("unable to open /proc file '%s'"), buf);
+ warning (_ ("unable to open /proc file '%s'"), buf);
return -1;
}
@@ -117,7 +117,6 @@ parse_proc_status_state (const char *state)
return PROC_STATE_UNKNOWN;
}
-
/* Fill in STATE, a buffer with BUFFER_SIZE bytes with the 'State'
line of /proc/PID/status. Returns -1 on failure to open the /proc
file, 1 if the line is found, and 0 if not found. If WARN, warn on
@@ -134,7 +133,7 @@ linux_proc_pid_get_state (pid_t pid, int warn, enum proc_state *state)
if (procfile == NULL)
{
if (warn)
- warning (_("unable to open /proc file '%s'"), buffer);
+ warning (_ ("unable to open /proc file '%s'"), buffer);
return -1;
}
@@ -234,7 +233,7 @@ linux_proc_pid_is_zombie (pid_t pid)
const char *
linux_proc_tid_get_name (ptid_t ptid)
{
-#define TASK_COMM_LEN 16 /* As defined in the kernel's sched.h. */
+#define TASK_COMM_LEN 16 /* As defined in the kernel's sched.h. */
static char comm_buf[TASK_COMM_LEN];
char comm_path[100];
@@ -242,8 +241,8 @@ linux_proc_tid_get_name (ptid_t ptid)
pid_t pid = ptid.pid ();
pid_t tid = ptid.lwp_p () ? ptid.lwp () : ptid.pid ();
- xsnprintf (comm_path, sizeof (comm_path),
- "/proc/%ld/task/%ld/comm", (long) pid, (long) tid);
+ xsnprintf (comm_path, sizeof (comm_path), "/proc/%ld/task/%ld/comm",
+ (long) pid, (long) tid);
gdb_file_up comm_file = gdb_fopen_cloexec (comm_path, "r");
if (comm_file == NULL)
@@ -287,7 +286,7 @@ linux_proc_attach_tgid_threads (pid_t pid,
dir = opendir (pathname);
if (dir == NULL)
{
- warning (_("Could not open /proc/%ld/task."), (long) pid);
+ warning (_ ("Could not open /proc/%ld/task."), (long) pid);
return;
}
@@ -372,5 +371,5 @@ linux_proc_init_warnings ()
struct stat st;
if (stat ("/proc/self", &st) != 0)
- warning (_("/proc is not accessible."));
+ warning (_ ("/proc is not accessible."));
}
diff --git a/gdb/nat/linux-ptrace.c b/gdb/nat/linux-ptrace.c
index f312779aa26..d8bb6d94fd8 100644
--- a/gdb/nat/linux-ptrace.c
+++ b/gdb/nat/linux-ptrace.c
@@ -40,14 +40,13 @@ linux_ptrace_attach_fail_reason (pid_t pid)
std::string result;
if (tracerpid > 0)
- string_appendf (result,
- _("process %d is already traced by process %d"),
+ string_appendf (result, _ ("process %d is already traced by process %d"),
(int) pid, (int) tracerpid);
if (linux_proc_pid_is_zombie_nowarn (pid))
string_appendf (result,
- _("process %d is a zombie - the process has already "
- "terminated"),
+ _ ("process %d is a zombie - the process has already "
+ "terminated"),
(int) pid);
return result;
@@ -89,8 +88,8 @@ kill_child (pid_t child, const char *who)
if (kill (child, SIGKILL) != 0)
{
- warning (_("%s: failed to kill child pid %ld %s"),
- who, (long) child, safe_strerror (errno));
+ warning (_ ("%s: failed to kill child pid %ld %s"), who, (long) child,
+ safe_strerror (errno));
return;
}
@@ -98,15 +97,15 @@ kill_child (pid_t child, const char *who)
got_pid = my_waitpid (child, &kill_status, 0);
if (got_pid != child)
{
- warning (_("%s: "
- "kill waitpid returned %ld: %s"),
+ warning (_ ("%s: "
+ "kill waitpid returned %ld: %s"),
who, (long) got_pid, safe_strerror (errno));
return;
}
if (!WIFSIGNALED (kill_status))
{
- warning (_("%s: "
- "kill status %d is not WIFSIGNALED!"),
+ warning (_ ("%s: "
+ "kill status %d is not WIFSIGNALED!"),
who, kill_status);
return;
}
@@ -127,12 +126,11 @@ linux_ptrace_test_ret_to_nx (void)
int status;
elf_gregset_t regs;
- return_address
- = (gdb_byte *) mmap (NULL, 2, PROT_READ | PROT_WRITE,
- MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
+ return_address = (gdb_byte *) mmap (NULL, 2, PROT_READ | PROT_WRITE,
+ MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
if (return_address == MAP_FAILED)
{
- warning (_("linux_ptrace_test_ret_to_nx: Cannot mmap: %s"),
+ warning (_ ("linux_ptrace_test_ret_to_nx: Cannot mmap: %s"),
safe_strerror (errno));
return;
}
@@ -144,7 +142,7 @@ linux_ptrace_test_ret_to_nx (void)
switch (child)
{
case -1:
- warning (_("linux_ptrace_test_ret_to_nx: Cannot fork: %s"),
+ warning (_ ("linux_ptrace_test_ret_to_nx: Cannot fork: %s"),
safe_strerror (errno));
return;
@@ -152,7 +150,7 @@ linux_ptrace_test_ret_to_nx (void)
l = ptrace (PTRACE_TRACEME, 0, (PTRACE_TYPE_ARG3) NULL,
(PTRACE_TYPE_ARG4) NULL);
if (l != 0)
- warning (_("linux_ptrace_test_ret_to_nx: Cannot PTRACE_TRACEME: %s"),
+ warning (_ ("linux_ptrace_test_ret_to_nx: Cannot PTRACE_TRACEME: %s"),
safe_strerror (errno));
else
{
@@ -161,16 +159,19 @@ linux_ptrace_test_ret_to_nx (void)
".globl linux_ptrace_test_ret_to_nx_instr;"
"linux_ptrace_test_ret_to_nx_instr:"
"ret"
- : : "r" (return_address) : "memory");
+ :
+ : "r"(return_address)
+ : "memory");
#elif defined __x86_64__
asm volatile ("pushq %0;"
".globl linux_ptrace_test_ret_to_nx_instr;"
"linux_ptrace_test_ret_to_nx_instr:"
"ret"
- : : "r" ((uint64_t) (uintptr_t) return_address)
+ :
+ : "r"((uint64_t) (uintptr_t) return_address)
: "memory");
#else
-# error "!__i386__ && !__x86_64__"
+#error "!__i386__ && !__x86_64__"
#endif
gdb_assert_not_reached ("asm block did not terminate");
}
@@ -182,7 +183,7 @@ linux_ptrace_test_ret_to_nx (void)
got_pid = waitpid (child, &status, 0);
if (got_pid != child)
{
- warning (_("linux_ptrace_test_ret_to_nx: waitpid returned %ld: %s"),
+ warning (_ ("linux_ptrace_test_ret_to_nx: waitpid returned %ld: %s"),
(long) got_pid, safe_strerror (errno));
return;
}
@@ -190,17 +191,18 @@ linux_ptrace_test_ret_to_nx (void)
if (WIFSIGNALED (status))
{
if (WTERMSIG (status) != SIGKILL)
- warning (_("linux_ptrace_test_ret_to_nx: WTERMSIG %d is not SIGKILL!"),
- (int) WTERMSIG (status));
+ warning (
+ _ ("linux_ptrace_test_ret_to_nx: WTERMSIG %d is not SIGKILL!"),
+ (int) WTERMSIG (status));
else
- warning (_("Cannot call inferior functions, Linux kernel PaX "
- "protection forbids return to non-executable pages!"));
+ warning (_ ("Cannot call inferior functions, Linux kernel PaX "
+ "protection forbids return to non-executable pages!"));
return;
}
if (!WIFSTOPPED (status))
{
- warning (_("linux_ptrace_test_ret_to_nx: status %d is not WIFSTOPPED!"),
+ warning (_ ("linux_ptrace_test_ret_to_nx: status %d is not WIFSTOPPED!"),
status);
kill_child (child, "linux_ptrace_test_ret_to_nx");
return;
@@ -209,17 +211,18 @@ linux_ptrace_test_ret_to_nx (void)
/* We may get SIGSEGV due to missing PROT_EXEC of the return_address. */
if (WSTOPSIG (status) != SIGTRAP && WSTOPSIG (status) != SIGSEGV)
{
- warning (_("linux_ptrace_test_ret_to_nx: "
- "WSTOPSIG %d is neither SIGTRAP nor SIGSEGV!"),
+ warning (_ ("linux_ptrace_test_ret_to_nx: "
+ "WSTOPSIG %d is neither SIGTRAP nor SIGSEGV!"),
(int) WSTOPSIG (status));
kill_child (child, "linux_ptrace_test_ret_to_nx");
return;
}
if (ptrace (PTRACE_GETREGS, child, (PTRACE_TYPE_ARG3) 0,
- (PTRACE_TYPE_ARG4) &regs) < 0)
+ (PTRACE_TYPE_ARG4) &regs)
+ < 0)
{
- warning (_("linux_ptrace_test_ret_to_nx: Cannot PTRACE_GETREGS: %s"),
+ warning (_ ("linux_ptrace_test_ret_to_nx: Cannot PTRACE_GETREGS: %s"),
safe_strerror (errno));
}
#if defined __i386__
@@ -227,7 +230,7 @@ linux_ptrace_test_ret_to_nx (void)
#elif defined __x86_64__
pc = (gdb_byte *) (uintptr_t) regs[RIP];
#else
-# error "!__i386__ && !__x86_64__"
+#error "!__i386__ && !__x86_64__"
#endif
kill_child (child, "linux_ptrace_test_ret_to_nx");
@@ -247,13 +250,13 @@ linux_ptrace_test_ret_to_nx (void)
}
if ((void (*) (void)) pc != &linux_ptrace_test_ret_to_nx_instr)
- warning (_("linux_ptrace_test_ret_to_nx: PC %p is neither near return "
- "address %p nor is the return instruction %p!"),
+ warning (_ ("linux_ptrace_test_ret_to_nx: PC %p is neither near return "
+ "address %p nor is the return instruction %p!"),
pc, return_address, &linux_ptrace_test_ret_to_nx_instr);
else
- warning (_("Cannot call inferior functions on this system - "
- "Linux kernel with broken i386 NX (non-executable pages) "
- "support detected!"));
+ warning (_ ("Cannot call inferior functions on this system - "
+ "Linux kernel with broken i386 NX (non-executable pages) "
+ "support detected!"));
#endif /* defined __i386__ || defined __x86_64__ */
}
@@ -276,18 +279,18 @@ linux_fork_to_function (gdb_byte *child_stack, int (*function) (void *))
#if defined(__UCLIBC__) && defined(HAS_NOMMU)
#define STACK_SIZE 4096
- if (child_stack == NULL)
- child_stack = (gdb_byte *) xmalloc (STACK_SIZE * 4);
+ if (child_stack == NULL)
+ child_stack = (gdb_byte *) xmalloc (STACK_SIZE * 4);
/* Use CLONE_VM instead of fork, to support uClinux (no MMU). */
#ifdef __ia64__
- child_pid = __clone2 (function, child_stack, STACK_SIZE,
- CLONE_VM | SIGCHLD, child_stack + STACK_SIZE * 2);
-#else /* !__ia64__ */
- child_pid = clone (function, child_stack + STACK_SIZE,
- CLONE_VM | SIGCHLD, child_stack + STACK_SIZE * 2);
+ child_pid = __clone2 (function, child_stack, STACK_SIZE, CLONE_VM | SIGCHLD,
+ child_stack + STACK_SIZE * 2);
+#else /* !__ia64__ */
+ child_pid = clone (function, child_stack + STACK_SIZE, CLONE_VM | SIGCHLD,
+ child_stack + STACK_SIZE * 2);
#endif /* !__ia64__ */
-#else /* !defined(__UCLIBC) && defined(HAS_NOMMU) */
+#else /* !defined(__UCLIBC) && defined(HAS_NOMMU) */
child_pid = fork ();
if (child_pid == 0)
@@ -327,12 +330,8 @@ linux_check_ptrace_features (void)
/* Initialize the options. We consider that these options are always
supported. */
supported_ptrace_options
- = (PTRACE_O_TRACESYSGOOD
- | PTRACE_O_TRACECLONE
- | PTRACE_O_TRACEFORK
- | PTRACE_O_TRACEVFORK
- | PTRACE_O_TRACEVFORKDONE
- | PTRACE_O_TRACEEXEC);
+ = (PTRACE_O_TRACESYSGOOD | PTRACE_O_TRACECLONE | PTRACE_O_TRACEFORK
+ | PTRACE_O_TRACEVFORK | PTRACE_O_TRACEVFORKDONE | PTRACE_O_TRACEEXEC);
/* Fork a child so we can do some testing. The child will call
linux_child_function and will get traced. The child will
@@ -344,10 +343,10 @@ linux_check_ptrace_features (void)
if (ret == -1)
perror_with_name (("waitpid"));
else if (ret != child_pid)
- error (_("linux_check_ptrace_features: waitpid: unexpected result %d."),
+ error (_ ("linux_check_ptrace_features: waitpid: unexpected result %d."),
ret);
- if (! WIFSTOPPED (status))
- error (_("linux_check_ptrace_features: waitpid: unexpected status %d."),
+ if (!WIFSTOPPED (status))
+ error (_ ("linux_check_ptrace_features: waitpid: unexpected status %d."),
status);
linux_test_for_exitkill (child_pid);
@@ -443,6 +442,5 @@ linux_wstatus_maybe_breakpoint (int wstat)
&& (WSTOPSIG (wstat) == SIGTRAP
/* SIGILL and SIGSEGV are also treated as traps in case a
breakpoint is inserted at the current PC. */
- || WSTOPSIG (wstat) == SIGILL
- || WSTOPSIG (wstat) == SIGSEGV));
+ || WSTOPSIG (wstat) == SIGILL || WSTOPSIG (wstat) == SIGSEGV));
}
diff --git a/gdb/nat/linux-ptrace.h b/gdb/nat/linux-ptrace.h
index 19f473626de..b965a92a7f7 100644
--- a/gdb/nat/linux-ptrace.h
+++ b/gdb/nat/linux-ptrace.h
@@ -40,61 +40,61 @@ struct buffer;
#endif
#ifndef PTRACE_GETSIGINFO
-# define PTRACE_GETSIGINFO 0x4202
-# define PTRACE_SETSIGINFO 0x4203
+#define PTRACE_GETSIGINFO 0x4202
+#define PTRACE_SETSIGINFO 0x4203
#endif /* PTRACE_GETSIGINF */
#ifndef PTRACE_GETREGSET
-#define PTRACE_GETREGSET 0x4204
+#define PTRACE_GETREGSET 0x4204
#endif
#ifndef PTRACE_SETREGSET
-#define PTRACE_SETREGSET 0x4205
+#define PTRACE_SETREGSET 0x4205
#endif
/* If the system headers did not provide the constants, hard-code the normal
values. */
#ifndef PTRACE_EVENT_FORK
-#define PTRACE_SETOPTIONS 0x4200
-#define PTRACE_GETEVENTMSG 0x4201
+#define PTRACE_SETOPTIONS 0x4200
+#define PTRACE_GETEVENTMSG 0x4201
/* options set using PTRACE_SETOPTIONS */
-#define PTRACE_O_TRACESYSGOOD 0x00000001
-#define PTRACE_O_TRACEFORK 0x00000002
-#define PTRACE_O_TRACEVFORK 0x00000004
-#define PTRACE_O_TRACECLONE 0x00000008
-#define PTRACE_O_TRACEEXEC 0x00000010
-#define PTRACE_O_TRACEVFORKDONE 0x00000020
-#define PTRACE_O_TRACEEXIT 0x00000040
+#define PTRACE_O_TRACESYSGOOD 0x00000001
+#define PTRACE_O_TRACEFORK 0x00000002
+#define PTRACE_O_TRACEVFORK 0x00000004
+#define PTRACE_O_TRACECLONE 0x00000008
+#define PTRACE_O_TRACEEXEC 0x00000010
+#define PTRACE_O_TRACEVFORKDONE 0x00000020
+#define PTRACE_O_TRACEEXIT 0x00000040
/* Wait extended result codes for the above trace options. */
-#define PTRACE_EVENT_FORK 1
-#define PTRACE_EVENT_VFORK 2
-#define PTRACE_EVENT_CLONE 3
-#define PTRACE_EVENT_EXEC 4
-#define PTRACE_EVENT_VFORK_DONE 5
-#define PTRACE_EVENT_EXIT 6
+#define PTRACE_EVENT_FORK 1
+#define PTRACE_EVENT_VFORK 2
+#define PTRACE_EVENT_CLONE 3
+#define PTRACE_EVENT_EXEC 4
+#define PTRACE_EVENT_VFORK_DONE 5
+#define PTRACE_EVENT_EXIT 6
#endif /* PTRACE_EVENT_FORK */
#ifndef PTRACE_O_EXITKILL
/* Only defined in Linux Kernel 3.8 or later. */
-#define PTRACE_O_EXITKILL 0x00100000
+#define PTRACE_O_EXITKILL 0x00100000
#endif
#if (defined __bfin__ || defined __frv__ || defined __sh__) \
- && !defined PTRACE_GETFDPIC
-#define PTRACE_GETFDPIC 31
-#define PTRACE_GETFDPIC_EXEC 0
-#define PTRACE_GETFDPIC_INTERP 1
+ && !defined PTRACE_GETFDPIC
+#define PTRACE_GETFDPIC 31
+#define PTRACE_GETFDPIC_EXEC 0
+#define PTRACE_GETFDPIC_INTERP 1
#endif
/* We can't always assume that this flag is available, but all systems
with the ptrace event handlers also have __WALL, so it's safe to use
in some contexts. */
#ifndef __WALL
-#define __WALL 0x40000000 /* Wait for any child. */
+#define __WALL 0x40000000 /* Wait for any child. */
#endif
/* True if whether a breakpoint/watchpoint triggered can be determined
@@ -159,21 +159,21 @@ struct buffer;
The generic Linux target code should use GDB_ARCH_IS_TRAP_* instead
of TRAP_* to abstract out these peculiarities. */
#if defined __i386__ || defined __x86_64__
-# define GDB_ARCH_IS_TRAP_BRKPT(X) ((X) == SI_KERNEL)
-# define GDB_ARCH_IS_TRAP_HWBKPT(X) ((X) == TRAP_HWBKPT)
+#define GDB_ARCH_IS_TRAP_BRKPT(X) ((X) == SI_KERNEL)
+#define GDB_ARCH_IS_TRAP_HWBKPT(X) ((X) == TRAP_HWBKPT)
#elif defined __powerpc__
-# define GDB_ARCH_IS_TRAP_BRKPT(X) ((X) == SI_KERNEL || (X) == TRAP_BRKPT)
-# define GDB_ARCH_IS_TRAP_HWBKPT(X) ((X) == TRAP_HWBKPT)
+#define GDB_ARCH_IS_TRAP_BRKPT(X) ((X) == SI_KERNEL || (X) == TRAP_BRKPT)
+#define GDB_ARCH_IS_TRAP_HWBKPT(X) ((X) == TRAP_HWBKPT)
#elif defined __mips__
-# define GDB_ARCH_IS_TRAP_BRKPT(X) ((X) == SI_KERNEL || (X) == TRAP_BRKPT)
-# define GDB_ARCH_IS_TRAP_HWBKPT(X) ((X) == SI_KERNEL || (X) == TRAP_HWBKPT)
+#define GDB_ARCH_IS_TRAP_BRKPT(X) ((X) == SI_KERNEL || (X) == TRAP_BRKPT)
+#define GDB_ARCH_IS_TRAP_HWBKPT(X) ((X) == SI_KERNEL || (X) == TRAP_HWBKPT)
#else
-# define GDB_ARCH_IS_TRAP_BRKPT(X) ((X) == TRAP_BRKPT)
-# define GDB_ARCH_IS_TRAP_HWBKPT(X) ((X) == TRAP_HWBKPT)
+#define GDB_ARCH_IS_TRAP_BRKPT(X) ((X) == TRAP_BRKPT)
+#define GDB_ARCH_IS_TRAP_HWBKPT(X) ((X) == TRAP_HWBKPT)
#endif
#ifndef TRAP_HWBKPT
-# define TRAP_HWBKPT 4
+#define TRAP_HWBKPT 4
#endif
extern std::string linux_ptrace_attach_fail_reason (pid_t pid);
@@ -181,7 +181,8 @@ extern std::string linux_ptrace_attach_fail_reason (pid_t pid);
/* Find all possible reasons we could have failed to attach to PTID
and return them as a string. ERR is the error PTRACE_ATTACH failed
with (an errno). */
-extern std::string linux_ptrace_attach_fail_reason_string (ptid_t ptid, int err);
+extern std::string linux_ptrace_attach_fail_reason_string (ptid_t ptid,
+ int err);
extern void linux_ptrace_init_warnings (void);
extern void linux_check_ptrace_features (void);
diff --git a/gdb/nat/linux-waitpid.c b/gdb/nat/linux-waitpid.c
index b10f333eb0c..f7f751e0058 100644
--- a/gdb/nat/linux-waitpid.c
+++ b/gdb/nat/linux-waitpid.c
@@ -40,8 +40,7 @@ status_to_str (int status)
strsignal (WSTOPSIG (status)));
}
else if (WIFSIGNALED (status))
- return string_printf ("%s - %s (terminated)",
- strsigno (WTERMSIG (status)),
+ return string_printf ("%s - %s (terminated)", strsigno (WTERMSIG (status)),
strsignal (WTERMSIG (status)));
else
return string_printf ("%d (exited)", WEXITSTATUS (status));
diff --git a/gdb/nat/mips-linux-watch.c b/gdb/nat/mips-linux-watch.c
index 5b2b48a930b..fb64093f314 100644
--- a/gdb/nat/mips-linux-watch.c
+++ b/gdb/nat/mips-linux-watch.c
@@ -32,7 +32,7 @@ mips_linux_watch_get_irw_mask (struct pt_watch_regs *regs, int n)
case pt_watch_style_mips64:
return regs->mips64.watch_masks[n] & IRW_MASK;
default:
- internal_error (_("Unrecognized watch register style"));
+ internal_error (_ ("Unrecognized watch register style"));
}
}
@@ -49,7 +49,7 @@ get_reg_mask (struct pt_watch_regs *regs, int n)
case pt_watch_style_mips64:
return regs->mips64.watch_masks[n] & ~IRW_MASK;
default:
- internal_error (_("Unrecognized watch register style"));
+ internal_error (_ ("Unrecognized watch register style"));
}
}
@@ -65,7 +65,7 @@ mips_linux_watch_get_num_valid (struct pt_watch_regs *regs)
case pt_watch_style_mips64:
return regs->mips64.num_valid;
default:
- internal_error (_("Unrecognized watch register style"));
+ internal_error (_ ("Unrecognized watch register style"));
}
}
@@ -82,7 +82,7 @@ mips_linux_watch_get_watchlo (struct pt_watch_regs *regs, int n)
case pt_watch_style_mips64:
return regs->mips64.watchlo[n];
default:
- internal_error (_("Unrecognized watch register style"));
+ internal_error (_ ("Unrecognized watch register style"));
}
}
@@ -104,7 +104,7 @@ mips_linux_watch_set_watchlo (struct pt_watch_regs *regs, int n,
regs->mips64.watchlo[n] = value;
break;
default:
- internal_error (_("Unrecognized watch register style"));
+ internal_error (_ ("Unrecognized watch register style"));
}
}
@@ -121,7 +121,7 @@ mips_linux_watch_get_watchhi (struct pt_watch_regs *regs, int n)
case pt_watch_style_mips64:
return regs->mips64.watchhi[n];
default:
- internal_error (_("Unrecognized watch register style"));
+ internal_error (_ ("Unrecognized watch register style"));
}
}
@@ -141,7 +141,7 @@ mips_linux_watch_set_watchhi (struct pt_watch_regs *regs, int n,
regs->mips64.watchhi[n] = value;
break;
default:
- internal_error (_("Unrecognized watch register style"));
+ internal_error (_ ("Unrecognized watch register style"));
}
}
@@ -226,8 +226,8 @@ fill_mask (CORE_ADDR mask)
is IRW. Return 1 on success, 0 on failure. */
int
-mips_linux_watch_try_one_watch (struct pt_watch_regs *regs,
- CORE_ADDR addr, int len, uint32_t irw)
+mips_linux_watch_try_one_watch (struct pt_watch_regs *regs, CORE_ADDR addr,
+ int len, uint32_t irw)
{
CORE_ADDR base_addr, last_byte, break_addr, segment_len;
CORE_ADDR mask_bits, t_low;
@@ -259,8 +259,7 @@ mips_linux_watch_try_one_watch (struct pt_watch_regs *regs,
for (i = 0; i < mips_linux_watch_get_num_valid (regs); i++)
{
t_low = mips_linux_watch_get_watchlo (regs, i);
- if (t_low == 0
- && irw == (mips_linux_watch_get_irw_mask (regs, i) & irw))
+ if (t_low == 0 && irw == (mips_linux_watch_get_irw_mask (regs, i) & irw))
{
if (mask_bits <= (get_reg_mask (regs, i) | IRW_MASK))
{
diff --git a/gdb/nat/mips-linux-watch.h b/gdb/nat/mips-linux-watch.h
index c38669e3787..fb108f0b8fd 100644
--- a/gdb/nat/mips-linux-watch.h
+++ b/gdb/nat/mips-linux-watch.h
@@ -27,10 +27,11 @@
have hardware watchpoint-related structures. Define them below. */
#ifndef PTRACE_GET_WATCH_REGS
-# define PTRACE_GET_WATCH_REGS 0xd0
-# define PTRACE_SET_WATCH_REGS 0xd1
+#define PTRACE_GET_WATCH_REGS 0xd0
+#define PTRACE_SET_WATCH_REGS 0xd1
-enum pt_watch_style {
+enum pt_watch_style
+{
pt_watch_style_mips32,
pt_watch_style_mips64
};
@@ -67,6 +68,7 @@ struct mips64_watch_regs
struct pt_watch_regs
{
enum pt_watch_style style;
+
union
{
struct mips32_watch_regs mips32;
@@ -106,8 +108,8 @@ void mips_linux_watch_set_watchlo (struct pt_watch_regs *regs, int n,
uint32_t mips_linux_watch_get_watchhi (struct pt_watch_regs *regs, int n);
void mips_linux_watch_set_watchhi (struct pt_watch_regs *regs, int n,
uint16_t value);
-int mips_linux_watch_try_one_watch (struct pt_watch_regs *regs,
- CORE_ADDR addr, int len, uint32_t irw);
+int mips_linux_watch_try_one_watch (struct pt_watch_regs *regs, CORE_ADDR addr,
+ int len, uint32_t irw);
void mips_linux_watch_populate_regs (struct mips_watchpoint *current_watches,
struct pt_watch_regs *regs);
uint32_t mips_linux_watch_type_to_irw (enum target_hw_bp_type type);
diff --git a/gdb/nat/netbsd-nat.c b/gdb/nat/netbsd-nat.c
index 143721b91f1..7751e2feb85 100644
--- a/gdb/nat/netbsd-nat.c
+++ b/gdb/nat/netbsd-nat.c
@@ -38,7 +38,7 @@ const char *
pid_to_exec_file (pid_t pid)
{
static char buf[PATH_MAX];
- int mib[4] = {CTL_KERN, KERN_PROC_ARGS, pid, KERN_PROC_PATHNAME};
+ int mib[4] = { CTL_KERN, KERN_PROC_ARGS, pid, KERN_PROC_PATHNAME };
size_t buflen = sizeof (buf);
if (::sysctl (mib, ARRAY_SIZE (mib), buf, &buflen, NULL, 0) != 0)
return NULL;
@@ -53,11 +53,11 @@ pid_to_exec_file (pid_t pid)
and the number of threads does not change between two sysctl () calls. */
static bool
-netbsd_thread_lister (const pid_t pid,
- gdb::function_view<bool (const struct kinfo_lwp *)>
- callback)
+netbsd_thread_lister (
+ const pid_t pid,
+ gdb::function_view<bool (const struct kinfo_lwp *)> callback)
{
- int mib[5] = {CTL_KERN, KERN_LWP, pid, sizeof (struct kinfo_lwp), 0};
+ int mib[5] = { CTL_KERN, KERN_LWP, pid, sizeof (struct kinfo_lwp), 0 };
size_t size;
if (sysctl (mib, ARRAY_SIZE (mib), NULL, &size, NULL, 0) == -1 || size == 0)
@@ -65,8 +65,8 @@ netbsd_thread_lister (const pid_t pid,
mib[4] = size / sizeof (size_t);
- gdb::unique_xmalloc_ptr<struct kinfo_lwp[]> kl
- ((struct kinfo_lwp *) xcalloc (size, 1));
+ gdb::unique_xmalloc_ptr<struct kinfo_lwp[]> kl ((struct kinfo_lwp *)
+ xcalloc (size, 1));
if (sysctl (mib, ARRAY_SIZE (mib), kl.get (), &size, NULL, 0) == -1
|| size == 0)
@@ -77,21 +77,19 @@ netbsd_thread_lister (const pid_t pid,
struct kinfo_lwp *l = &kl[i];
/* Return true if the specified thread is alive. */
- auto lwp_alive
- = [] (struct kinfo_lwp *lwp)
+ auto lwp_alive = [] (struct kinfo_lwp *lwp) {
+ switch (lwp->l_stat)
{
- switch (lwp->l_stat)
- {
- case LSSLEEP:
- case LSRUN:
- case LSONPROC:
- case LSSTOP:
- case LSSUSPENDED:
- return true;
- default:
- return false;
- }
- };
+ case LSSLEEP:
+ case LSRUN:
+ case LSONPROC:
+ case LSSTOP:
+ case LSSUSPENDED:
+ return true;
+ default:
+ return false;
+ }
+ };
/* Ignore embryonic or demised threads. */
if (!lwp_alive (l))
@@ -112,11 +110,7 @@ thread_alive (ptid_t ptid)
pid_t pid = ptid.pid ();
lwpid_t lwp = ptid.lwp ();
- auto fn
- = [=] (const struct kinfo_lwp *kl)
- {
- return kl->l_lid == lwp;
- };
+ auto fn = [=] (const struct kinfo_lwp *kl) { return kl->l_lid == lwp; };
return netbsd_thread_lister (pid, fn);
}
@@ -131,16 +125,14 @@ thread_name (ptid_t ptid)
static char buf[KI_LNAMELEN] = {};
- auto fn
- = [=] (const struct kinfo_lwp *kl)
+ auto fn = [=] (const struct kinfo_lwp *kl) {
+ if (kl->l_lid == lwp)
{
- if (kl->l_lid == lwp)
- {
- xsnprintf (buf, sizeof buf, "%s", kl->l_name);
- return true;
- }
- return false;
- };
+ xsnprintf (buf, sizeof buf, "%s", kl->l_name);
+ return true;
+ }
+ return false;
+ };
if (netbsd_thread_lister (pid, fn))
return buf;
@@ -153,13 +145,11 @@ thread_name (ptid_t ptid)
void
for_each_thread (pid_t pid, gdb::function_view<void (ptid_t)> callback)
{
- auto fn
- = [=, &callback] (const struct kinfo_lwp *kl)
- {
- ptid_t ptid = ptid_t (pid, kl->l_lid, 0);
- callback (ptid);
- return false;
- };
+ auto fn = [=, &callback] (const struct kinfo_lwp *kl) {
+ ptid_t ptid = ptid_t (pid, kl->l_lid, 0);
+ callback (ptid);
+ return false;
+ };
netbsd_thread_lister (pid, fn);
}
@@ -227,8 +217,8 @@ write_memory (pid_t pid, unsigned const char *writebuf, CORE_ADDR offset,
{
do
{
- io.piod_addr = (void *)(writebuf + bytes_written);
- io.piod_offs = (void *)(offset + bytes_written);
+ io.piod_addr = (void *) (writebuf + bytes_written);
+ io.piod_offs = (void *) (offset + bytes_written);
errno = 0;
int rv = ptrace (PT_IO, pid, &io, 0);
@@ -255,8 +245,8 @@ write_memory (pid_t pid, unsigned const char *writebuf, CORE_ADDR offset,
/* See netbsd-nat.h. */
int
-read_memory (pid_t pid, unsigned char *readbuf, CORE_ADDR offset,
- size_t len, size_t *xfered_len)
+read_memory (pid_t pid, unsigned char *readbuf, CORE_ADDR offset, size_t len,
+ size_t *xfered_len)
{
struct ptrace_io_desc io;
io.piod_op = PIOD_READ_D;
@@ -269,7 +259,7 @@ read_memory (pid_t pid, unsigned char *readbuf, CORE_ADDR offset,
{
do
{
- io.piod_offs = (void *)(offset + bytes_read);
+ io.piod_offs = (void *) (offset + bytes_read);
io.piod_addr = readbuf + bytes_read;
int rv = ptrace (PT_IO, pid, &io, 0);
@@ -290,4 +280,4 @@ read_memory (pid_t pid, unsigned char *readbuf, CORE_ADDR offset,
return 0;
}
-}
+} // namespace netbsd_nat
diff --git a/gdb/nat/netbsd-nat.h b/gdb/nat/netbsd-nat.h
index 1295cb23d9a..2b8b1cbefc3 100644
--- a/gdb/nat/netbsd-nat.h
+++ b/gdb/nat/netbsd-nat.h
@@ -89,6 +89,6 @@ extern int write_memory (pid_t pid, unsigned const char *writebuf,
extern int read_memory (pid_t pid, unsigned char *readbuf, CORE_ADDR offset,
size_t len, size_t *xfered_len);
-}
+} // namespace netbsd_nat
#endif
diff --git a/gdb/nat/ppc-linux.h b/gdb/nat/ppc-linux.h
index c84f9146bbd..ac23a8db0e9 100644
--- a/gdb/nat/ppc-linux.h
+++ b/gdb/nat/ppc-linux.h
@@ -37,7 +37,7 @@
#define PPC_FEATURE_BOOKE 0x00008000
#endif
#ifndef PPC_FEATURE_HAS_DFP
-#define PPC_FEATURE_HAS_DFP 0x00000400 /* Decimal Floating Point. */
+#define PPC_FEATURE_HAS_DFP 0x00000400 /* Decimal Floating Point. */
#endif
#ifndef PPC_FEATURE_HAS_VSX
#define PPC_FEATURE_HAS_VSX 0x00000080
diff --git a/gdb/nat/riscv-linux-tdesc.c b/gdb/nat/riscv-linux-tdesc.c
index d676233cc31..f09a9091e51 100644
--- a/gdb/nat/riscv-linux-tdesc.c
+++ b/gdb/nat/riscv-linux-tdesc.c
@@ -28,7 +28,7 @@
/* Work around glibc header breakage causing ELF_NFPREG not to be usable. */
#ifndef NFPREG
-# define NFPREG 33
+#define NFPREG 33
#endif
/* See nat/riscv-linux-tdesc.h. */
@@ -47,7 +47,7 @@ riscv_linux_read_features (int tid)
features.flen = 0;
/* How much worth of f-registers can we fetch if any? */
- for (flen = sizeof (regs.__f.__f[0]); ; flen *= 2)
+ for (flen = sizeof (regs.__f.__f[0]);; flen *= 2)
{
size_t regset_size;
struct iovec iov;
@@ -60,8 +60,8 @@ riscv_linux_read_features (int tid)
iov.iov_base = &regs;
iov.iov_len = regset_size;
- if (ptrace (PTRACE_GETREGSET, tid, NT_FPREGSET,
- (PTRACE_TYPE_ARG3) &iov) == -1)
+ if (ptrace (PTRACE_GETREGSET, tid, NT_FPREGSET, (PTRACE_TYPE_ARG3) &iov)
+ == -1)
{
switch (errno)
{
@@ -70,7 +70,7 @@ riscv_linux_read_features (int tid)
case EIO:
break;
default:
- perror_with_name (_("Couldn't get registers"));
+ perror_with_name (_ ("Couldn't get registers"));
break;
}
}
diff --git a/gdb/nat/windows-nat.c b/gdb/nat/windows-nat.c
index 8028494de20..c9f7e7ffe23 100644
--- a/gdb/nat/windows-nat.c
+++ b/gdb/nat/windows-nat.c
@@ -74,9 +74,9 @@ DeleteProcThreadAttributeList_ftype *DeleteProcThreadAttributeList;
/* Note that 'debug_events' must be locally defined in the relevant
functions. */
-#define DEBUG_EVENTS(fmt, ...) \
+#define DEBUG_EVENTS(fmt, ...) \
debug_prefixed_printf_cond (debug_events, "windows events", fmt, \
- ## __VA_ARGS__)
+ ##__VA_ARGS__)
void
windows_thread_info::suspend ()
@@ -95,7 +95,7 @@ windows_thread_info::suspend ()
We can get Invalid Handle (6) if the main thread
has exited. */
if (err != ERROR_INVALID_HANDLE && err != ERROR_ACCESS_DENIED)
- warning (_("SuspendThread (tid=0x%x) failed. (winerr %u: %s)"),
+ warning (_ ("SuspendThread (tid=0x%x) failed. (winerr %u: %s)"),
(unsigned) tid, (unsigned) err, strwinerror (err));
suspended = -1;
}
@@ -113,8 +113,9 @@ windows_thread_info::resume ()
if (ResumeThread (h) == (DWORD) -1)
{
DWORD err = GetLastError ();
- warning (_("warning: ResumeThread (tid=0x%x) failed. (winerr %u: %s)"),
- (unsigned) tid, (unsigned) err, strwinerror (err));
+ warning (
+ _ ("warning: ResumeThread (tid=0x%x) failed. (winerr %u: %s)"),
+ (unsigned) tid, (unsigned) err, strwinerror (err));
}
}
suspended = 0;
@@ -138,13 +139,12 @@ windows_thread_info::thread_name ()
character. It seems better to just reject bad
conversions here. */
BOOL used_default = FALSE;
- gdb::unique_xmalloc_ptr<char> new_name
- ((char *) xmalloc (needed));
- if (WideCharToMultiByte (CP_ACP, 0, value, -1,
- new_name.get (), needed,
- nullptr, &used_default) == needed
- && !used_default
- && strlen (new_name.get ()) > 0)
+ gdb::unique_xmalloc_ptr<char> new_name ((char *)
+ xmalloc (needed));
+ if (WideCharToMultiByte (CP_ACP, 0, value, -1, new_name.get (),
+ needed, nullptr, &used_default)
+ == needed
+ && !used_default && strlen (new_name.get ()) > 0)
name = std::move (new_name);
}
LocalFree (value);
@@ -176,8 +176,7 @@ windows_process_info::get_exec_module_filename (char *exe_name_ret,
#ifdef __x86_64__
if (wow64_process)
{
- if (!EnumProcessModulesEx (handle,
- &dh_buf, sizeof (HMODULE), &cbNeeded,
+ if (!EnumProcessModulesEx (handle, &dh_buf, sizeof (HMODULE), &cbNeeded,
LIST_MODULES_32BIT)
|| !cbNeeded)
return 0;
@@ -185,13 +184,12 @@ windows_process_info::get_exec_module_filename (char *exe_name_ret,
else
#endif
{
- if (!EnumProcessModules (handle,
- &dh_buf, sizeof (HMODULE), &cbNeeded)
+ if (!EnumProcessModules (handle, &dh_buf, sizeof (HMODULE), &cbNeeded)
|| !cbNeeded)
return 0;
}
- /* We know the executable is always first in the list of modules,
+ /* We know the executable is always first in the list of modules,
which we just fetched. So no need to fetch more. */
#ifdef __CYGWIN__
@@ -199,32 +197,32 @@ windows_process_info::get_exec_module_filename (char *exe_name_ret,
/* Cygwin prefers that the path be in /x/y/z format, so extract
the filename into a temporary buffer first, and then convert it
to POSIX format into the destination buffer. */
- wchar_t *pathbuf = (wchar_t *) alloca (exe_name_max_len * sizeof (wchar_t));
+ wchar_t *pathbuf
+ = (wchar_t *) alloca (exe_name_max_len * sizeof (wchar_t));
- len = GetModuleFileNameEx (handle,
- dh_buf, pathbuf, exe_name_max_len);
+ len = GetModuleFileNameEx (handle, dh_buf, pathbuf, exe_name_max_len);
if (len == 0)
{
unsigned err = (unsigned) GetLastError ();
- error (_("Error getting executable filename (error %u): %s"),
- err, strwinerror (err));
+ error (_ ("Error getting executable filename (error %u): %s"), err,
+ strwinerror (err));
}
if (cygwin_conv_path (CCP_WIN_W_TO_POSIX, pathbuf, exe_name_ret,
- exe_name_max_len) < 0)
- error (_("Error converting executable filename to POSIX: %d."), errno);
+ exe_name_max_len)
+ < 0)
+ error (_ ("Error converting executable filename to POSIX: %d."), errno);
}
#else
- len = GetModuleFileNameEx (handle,
- dh_buf, exe_name_ret, exe_name_max_len);
+ len = GetModuleFileNameEx (handle, dh_buf, exe_name_ret, exe_name_max_len);
if (len == 0)
{
unsigned err = (unsigned) GetLastError ();
- error (_("Error getting executable filename (error %u): %s"),
- err, strwinerror (err));
+ error (_ ("Error getting executable filename (error %u): %s"), err,
+ strwinerror (err));
}
#endif
- return 1; /* success */
+ return 1; /* success */
}
const char *
@@ -237,10 +235,10 @@ windows_process_info::pid_to_exec_file (int pid)
char procexe[sizeof ("/proc/4294967295/exe")];
xsnprintf (procexe, sizeof (procexe), "/proc/%u/exe", pid);
- nchars = readlink (procexe, path, sizeof(path));
+ nchars = readlink (procexe, path, sizeof (path));
if (nchars > 0 && nchars < sizeof (path))
{
- path[nchars] = '\0'; /* Got it */
+ path[nchars] = '\0'; /* Got it */
return path;
}
#endif
@@ -281,10 +279,9 @@ get_image_name (HANDLE h, void *address, int unicode)
/* See if we could read the address of a string, and that the
address isn't null. */
- if (!ReadProcessMemory (h, address, &address_ptr,
- sizeof (address_ptr), &done)
- || done != sizeof (address_ptr)
- || !address_ptr)
+ if (!ReadProcessMemory (h, address, &address_ptr, sizeof (address_ptr),
+ &done)
+ || done != sizeof (address_ptr) || !address_ptr)
return NULL;
/* Find the length of the string. */
@@ -302,8 +299,8 @@ get_image_name (HANDLE h, void *address, int unicode)
#ifdef __CYGWIN__
wcstombs (buf, unicode_address, MAX_PATH);
#else
- WideCharToMultiByte (CP_ACP, 0, unicode_address, len, buf, sizeof buf,
- 0, 0);
+ WideCharToMultiByte (CP_ACP, 0, unicode_address, len, buf, sizeof buf, 0,
+ 0);
#endif
}
@@ -328,9 +325,9 @@ windows_process_info::handle_ms_vc_exception (const EXCEPTION_RECORD *rec)
if (named_thread_id == (DWORD) -1)
named_thread_id = current_event.dwThreadId;
- named_thread = thread_rec (ptid_t (current_event.dwProcessId,
- named_thread_id, 0),
- DONT_INVALIDATE_CONTEXT);
+ named_thread
+ = thread_rec (ptid_t (current_event.dwProcessId, named_thread_id, 0),
+ DONT_INVALIDATE_CONTEXT);
if (named_thread != NULL)
{
int thread_name_len;
@@ -359,10 +356,11 @@ handle_exception_result
windows_process_info::handle_exception (struct target_waitstatus *ourstatus,
bool debug_exceptions)
{
-#define DEBUG_EXCEPTION_SIMPLE(x) if (debug_exceptions) \
- debug_printf ("gdb: Target exception %s at %s\n", x, \
- host_address_to_string (\
- current_event.u.Exception.ExceptionRecord.ExceptionAddress))
+#define DEBUG_EXCEPTION_SIMPLE(x) \
+ if (debug_exceptions) \
+ debug_printf ("gdb: Target exception %s at %s\n", x, \
+ host_address_to_string (current_event.u.Exception \
+ .ExceptionRecord.ExceptionAddress))
EXCEPTION_RECORD *rec = &current_event.u.Exception.ExceptionRecord;
DWORD code = rec->ExceptionCode;
@@ -436,7 +434,8 @@ windows_process_info::handle_exception (struct target_waitstatus *ourstatus,
on startup, first a BREAKPOINT for the 64bit ntdll.dll,
then a WX86_BREAKPOINT for the 32bit ntdll.dll.
Here we only care about the WX86_BREAKPOINT's. */
- DEBUG_EXCEPTION_SIMPLE ("EXCEPTION_BREAKPOINT - ignore_first_breakpoint");
+ DEBUG_EXCEPTION_SIMPLE (
+ "EXCEPTION_BREAKPOINT - ignore_first_breakpoint");
ourstatus->set_spurious ();
ignore_first_breakpoint = false;
break;
@@ -494,13 +493,14 @@ windows_process_info::handle_exception (struct target_waitstatus *ourstatus,
result = HANDLE_EXCEPTION_IGNORED;
break;
}
- /* treat improperly formed exception as unknown */
- /* FALLTHROUGH */
+ /* treat improperly formed exception as unknown */
+ /* FALLTHROUGH */
default:
/* Treat unhandled first chance exceptions specially. */
if (current_event.u.Exception.dwFirstChance)
return HANDLE_EXCEPTION_UNHANDLED;
- debug_printf ("gdb: unknown target exception 0x%08x at %s\n",
+ debug_printf (
+ "gdb: unknown target exception 0x%08x at %s\n",
(unsigned) current_event.u.Exception.ExceptionRecord.ExceptionCode,
host_address_to_string (
current_event.u.Exception.ExceptionRecord.ExceptionAddress));
@@ -529,16 +529,17 @@ windows_process_info::add_dll (LPVOID load_addr)
#ifdef __x86_64__
if (wow64_process)
{
- if (EnumProcessModulesEx (handle, &dummy_hmodule,
- sizeof (HMODULE), &cb_needed,
- LIST_MODULES_32BIT) == 0)
+ if (EnumProcessModulesEx (handle, &dummy_hmodule, sizeof (HMODULE),
+ &cb_needed, LIST_MODULES_32BIT)
+ == 0)
return;
}
else
#endif
{
- if (EnumProcessModules (handle, &dummy_hmodule,
- sizeof (HMODULE), &cb_needed) == 0)
+ if (EnumProcessModules (handle, &dummy_hmodule, sizeof (HMODULE),
+ &cb_needed)
+ == 0)
return;
}
@@ -549,16 +550,15 @@ windows_process_info::add_dll (LPVOID load_addr)
#ifdef __x86_64__
if (wow64_process)
{
- if (EnumProcessModulesEx (handle, hmodules,
- cb_needed, &cb_needed,
- LIST_MODULES_32BIT) == 0)
+ if (EnumProcessModulesEx (handle, hmodules, cb_needed, &cb_needed,
+ LIST_MODULES_32BIT)
+ == 0)
return;
}
else
#endif
{
- if (EnumProcessModules (handle, hmodules,
- cb_needed, &cb_needed) == 0)
+ if (EnumProcessModules (handle, hmodules, cb_needed, &cb_needed) == 0)
return;
}
@@ -590,7 +590,6 @@ windows_process_info::add_dll (LPVOID load_addr)
convert_syswow_dir = true;
}
-
}
for (i = 1; i < (int) (cb_needed / sizeof (HMODULE)); i++)
{
@@ -602,12 +601,12 @@ windows_process_info::add_dll (LPVOID load_addr)
char dll_name[MAX_PATH];
#endif
const char *name;
- if (GetModuleInformation (handle, hmodules[i],
- &mi, sizeof (mi)) == 0)
+ if (GetModuleInformation (handle, hmodules[i], &mi, sizeof (mi)) == 0)
continue;
- if (GetModuleFileNameEx (handle, hmodules[i],
- dll_name, sizeof (dll_name)) == 0)
+ if (GetModuleFileNameEx (handle, hmodules[i], dll_name,
+ sizeof (dll_name))
+ == 0)
continue;
#ifdef __USEWIDE
wcstombs (dll_name_mb, dll_name, MAX_PATH);
@@ -625,7 +624,7 @@ windows_process_info::add_dll (LPVOID load_addr)
{
syswow_dll_path = syswow_dir;
syswow_dll_path += name + system_dir_len;
- name = syswow_dll_path.c_str();
+ name = syswow_dll_path.c_str ();
}
/* Record the DLL if either LOAD_ADDR is NULL or the address
@@ -702,8 +701,7 @@ gdb::optional<pending_stop>
windows_process_info::fetch_pending_stop (bool debug_events)
{
gdb::optional<pending_stop> result;
- for (auto iter = pending_stops.begin ();
- iter != pending_stops.end ();
+ for (auto iter = pending_stops.begin (); iter != pending_stops.end ();
++iter)
{
if (desired_stop_thread_id == -1
@@ -731,12 +729,11 @@ continue_last_debug_event (DWORD continue_status, bool debug_events)
DEBUG_EVENTS ("ContinueDebugEvent (cpid=%d, ctid=0x%x, %s)",
(unsigned) last_wait_event.dwProcessId,
(unsigned) last_wait_event.dwThreadId,
- continue_status == DBG_CONTINUE ?
- "DBG_CONTINUE" : "DBG_EXCEPTION_NOT_HANDLED");
+ continue_status == DBG_CONTINUE ? "DBG_CONTINUE"
+ : "DBG_EXCEPTION_NOT_HANDLED");
return ContinueDebugEvent (last_wait_event.dwProcessId,
- last_wait_event.dwThreadId,
- continue_status);
+ last_wait_event.dwThreadId, continue_status);
}
/* See nat/windows-nat.h. */
@@ -759,10 +756,11 @@ wait_for_debug_event (DEBUG_EVENT *event, DWORD timeout)
/* Pick one of the symbols as a sentinel. */
#ifdef PROCESS_CREATION_MITIGATION_POLICY_FORCE_RELOCATE_IMAGES_ALWAYS_OFF
-static_assert ((PROCESS_CREATION_MITIGATION_POLICY_FORCE_RELOCATE_IMAGES_ALWAYS_OFF
- | PROCESS_CREATION_MITIGATION_POLICY_BOTTOM_UP_ASLR_ALWAYS_OFF)
- == relocate_aslr_flags,
- "check that ASLR flag values are correct");
+static_assert (
+ (PROCESS_CREATION_MITIGATION_POLICY_FORCE_RELOCATE_IMAGES_ALWAYS_OFF
+ | PROCESS_CREATION_MITIGATION_POLICY_BOTTOM_UP_ASLR_ALWAYS_OFF)
+ == relocate_aslr_flags,
+ "check that ASLR flag values are correct");
static_assert (PROC_THREAD_ATTRIBUTE_MITIGATION_POLICY == mitigation_policy,
"check that mitigation policy value is correct");
@@ -779,11 +777,9 @@ static_assert (PROC_THREAD_ATTRIBUTE_MITIGATION_POLICY == mitigation_policy,
template<typename FUNC, typename CHAR, typename INFO>
BOOL
create_process_wrapper (FUNC *do_create_process, const CHAR *image,
- CHAR *command_line, DWORD flags,
- void *environment, const CHAR *cur_dir,
- bool no_randomization,
- INFO *startup_info,
- PROCESS_INFORMATION *process_info)
+ CHAR *command_line, DWORD flags, void *environment,
+ const CHAR *cur_dir, bool no_randomization,
+ INFO *startup_info, PROCESS_INFORMATION *process_info)
{
if (no_randomization && disable_randomization_available ())
{
@@ -800,9 +796,9 @@ create_process_wrapper (FUNC *do_create_process, const CHAR *image,
gdb_lpproc_thread_attribute_list lpAttributeList;
};
-# ifndef EXTENDED_STARTUPINFO_PRESENT
-# define EXTENDED_STARTUPINFO_PRESENT 0x00080000
-# endif
+#ifndef EXTENDED_STARTUPINFO_PRESENT
+#define EXTENDED_STARTUPINFO_PRESENT 0x00080000
+#endif
gdb_extended_info info_ex {};
@@ -815,28 +811,24 @@ create_process_wrapper (FUNC *do_create_process, const CHAR *image,
InitializeProcThreadAttributeList (nullptr, 1, 0, &size);
info_ex.lpAttributeList
= (gdb_lpproc_thread_attribute_list) alloca (size);
- InitializeProcThreadAttributeList (info_ex.lpAttributeList,
- 1, 0, &size);
+ InitializeProcThreadAttributeList (info_ex.lpAttributeList, 1, 0,
+ &size);
gdb::optional<BOOL> return_value;
DWORD attr_flags = relocate_aslr_flags;
if (!UpdateProcThreadAttribute (info_ex.lpAttributeList, 0,
- mitigation_policy,
- &attr_flags,
- sizeof (attr_flags),
- nullptr, nullptr))
+ mitigation_policy, &attr_flags,
+ sizeof (attr_flags), nullptr,
+ nullptr))
tried_and_failed = true;
else
{
- BOOL result = do_create_process (image, command_line,
- nullptr, nullptr,
- TRUE,
- (flags
- | EXTENDED_STARTUPINFO_PRESENT),
- environment,
- cur_dir,
- &info_ex.StartupInfo,
- process_info);
+ BOOL result
+ = do_create_process (image, command_line, nullptr, nullptr,
+ TRUE,
+ (flags | EXTENDED_STARTUPINFO_PRESENT),
+ environment, cur_dir,
+ &info_ex.StartupInfo, process_info);
if (result)
return_value = result;
else if (GetLastError () == ERROR_INVALID_PARAMETER)
@@ -852,26 +844,22 @@ create_process_wrapper (FUNC *do_create_process, const CHAR *image,
}
}
- return do_create_process (image,
- command_line, /* command line */
- nullptr, /* Security */
- nullptr, /* thread */
- TRUE, /* inherit handles */
- flags, /* start flags */
- environment, /* environment */
- cur_dir, /* current directory */
- startup_info,
- process_info);
+ return do_create_process (image, command_line, /* command line */
+ nullptr, /* Security */
+ nullptr, /* thread */
+ TRUE, /* inherit handles */
+ flags, /* start flags */
+ environment, /* environment */
+ cur_dir, /* current directory */
+ startup_info, process_info);
}
/* See nat/windows-nat.h. */
BOOL
create_process (const char *image, char *command_line, DWORD flags,
- void *environment, const char *cur_dir,
- bool no_randomization,
- STARTUPINFOA *startup_info,
- PROCESS_INFORMATION *process_info)
+ void *environment, const char *cur_dir, bool no_randomization,
+ STARTUPINFOA *startup_info, PROCESS_INFORMATION *process_info)
{
return create_process_wrapper (CreateProcessA, image, command_line, flags,
environment, cur_dir, no_randomization,
@@ -885,8 +873,7 @@ create_process (const char *image, char *command_line, DWORD flags,
BOOL
create_process (const wchar_t *image, wchar_t *command_line, DWORD flags,
void *environment, const wchar_t *cur_dir,
- bool no_randomization,
- STARTUPINFOW *startup_info,
+ bool no_randomization, STARTUPINFOW *startup_info,
PROCESS_INFORMATION *process_info)
{
return create_process_wrapper (CreateProcessW, image, command_line, flags,
@@ -927,7 +914,7 @@ bad_GetConsoleFontSize (HANDLE w, DWORD nFont)
size.Y = 12;
return size;
}
-
+
/* See windows-nat.h. */
bool
@@ -946,8 +933,7 @@ initialize_loadable ()
bool result = true;
HMODULE hm = NULL;
-#define GPA(m, func) \
- func = (func ## _ftype *) GetProcAddress (m, #func)
+#define GPA(m, func) func = (func##_ftype *) GetProcAddress (m, #func)
hm = LoadLibrary (TEXT ("kernel32.dll"));
if (hm)
@@ -1000,8 +986,8 @@ initialize_loadable ()
GPA (hm, GetModuleFileNameExW);
}
- if (!EnumProcessModules || !GetModuleInformation
- || !GetModuleFileNameExA || !GetModuleFileNameExW)
+ if (!EnumProcessModules || !GetModuleInformation || !GetModuleFileNameExA
+ || !GetModuleFileNameExW)
{
/* Set variables to dummy versions of these processes if the function
wasn't found in psapi.dll. */
@@ -1040,4 +1026,4 @@ initialize_loadable ()
return result;
}
-}
+} // namespace windows_nat
diff --git a/gdb/nat/windows-nat.h b/gdb/nat/windows-nat.h
index e3ea7dbb525..d6725dea6ee 100644
--- a/gdb/nat/windows-nat.h
+++ b/gdb/nat/windows-nat.h
@@ -101,7 +101,6 @@ struct windows_thread_info
gdb::unique_xmalloc_ptr<char> name;
};
-
/* Possible values to pass to 'thread_rec'. */
enum thread_disposition_type
{
@@ -177,14 +176,14 @@ struct windows_process_info
bool ignore_first_breakpoint = false;
#endif
-
/* Find a thread record given a thread id. THREAD_DISPOSITION
controls whether the thread is suspended, and whether the context
is invalidated.
This function must be supplied by the embedding application. */
virtual windows_thread_info *thread_rec (ptid_t ptid,
- thread_disposition_type disposition) = 0;
+ thread_disposition_type disposition)
+ = 0;
/* Handle OUTPUT_DEBUG_STRING_EVENT from child process. Updates
OURSTATUS and returns the thread id if this represents a thread
@@ -194,7 +193,8 @@ struct windows_process_info
a Cygwin signal. Otherwise just print the string as a warning.
This function must be supplied by the embedding application. */
- virtual int handle_output_debug_string (struct target_waitstatus *ourstatus) = 0;
+ virtual int handle_output_debug_string (struct target_waitstatus *ourstatus)
+ = 0;
/* Handle a DLL load event.
@@ -224,8 +224,9 @@ struct windows_process_info
virtual bool handle_access_violation (const EXCEPTION_RECORD *rec) = 0;
- handle_exception_result handle_exception
- (struct target_waitstatus *ourstatus, bool debug_exceptions);
+ handle_exception_result
+ handle_exception (struct target_waitstatus *ourstatus,
+ bool debug_exceptions);
/* Call to indicate that a DLL was loaded. */
@@ -298,52 +299,48 @@ extern BOOL wait_for_debug_event (DEBUG_EVENT *event, DWORD timeout);
"disable randomization" feature can be implemented in a single
place. */
-extern BOOL create_process (const char *image, char *command_line,
- DWORD flags, void *environment,
- const char *cur_dir,
- bool no_randomization,
- STARTUPINFOA *startup_info,
+extern BOOL create_process (const char *image, char *command_line, DWORD flags,
+ void *environment, const char *cur_dir,
+ bool no_randomization, STARTUPINFOA *startup_info,
PROCESS_INFORMATION *process_info);
#ifdef __CYGWIN__
extern BOOL create_process (const wchar_t *image, wchar_t *command_line,
DWORD flags, void *environment,
- const wchar_t *cur_dir,
- bool no_randomization,
+ const wchar_t *cur_dir, bool no_randomization,
STARTUPINFOW *startup_info,
PROCESS_INFORMATION *process_info);
#endif /* __CYGWIN__ */
-#define AdjustTokenPrivileges dyn_AdjustTokenPrivileges
-#define DebugActiveProcessStop dyn_DebugActiveProcessStop
-#define DebugBreakProcess dyn_DebugBreakProcess
-#define DebugSetProcessKillOnExit dyn_DebugSetProcessKillOnExit
+#define AdjustTokenPrivileges dyn_AdjustTokenPrivileges
+#define DebugActiveProcessStop dyn_DebugActiveProcessStop
+#define DebugBreakProcess dyn_DebugBreakProcess
+#define DebugSetProcessKillOnExit dyn_DebugSetProcessKillOnExit
#undef EnumProcessModules
-#define EnumProcessModules dyn_EnumProcessModules
+#define EnumProcessModules dyn_EnumProcessModules
#undef EnumProcessModulesEx
-#define EnumProcessModulesEx dyn_EnumProcessModulesEx
+#define EnumProcessModulesEx dyn_EnumProcessModulesEx
#undef GetModuleInformation
-#define GetModuleInformation dyn_GetModuleInformation
+#define GetModuleInformation dyn_GetModuleInformation
#undef GetModuleFileNameExA
-#define GetModuleFileNameExA dyn_GetModuleFileNameExA
+#define GetModuleFileNameExA dyn_GetModuleFileNameExA
#undef GetModuleFileNameExW
-#define GetModuleFileNameExW dyn_GetModuleFileNameExW
-#define LookupPrivilegeValueA dyn_LookupPrivilegeValueA
-#define OpenProcessToken dyn_OpenProcessToken
-#define GetConsoleFontSize dyn_GetConsoleFontSize
-#define GetCurrentConsoleFont dyn_GetCurrentConsoleFont
-#define Wow64SuspendThread dyn_Wow64SuspendThread
-#define Wow64GetThreadContext dyn_Wow64GetThreadContext
-#define Wow64SetThreadContext dyn_Wow64SetThreadContext
-#define Wow64GetThreadSelectorEntry dyn_Wow64GetThreadSelectorEntry
-#define GenerateConsoleCtrlEvent dyn_GenerateConsoleCtrlEvent
+#define GetModuleFileNameExW dyn_GetModuleFileNameExW
+#define LookupPrivilegeValueA dyn_LookupPrivilegeValueA
+#define OpenProcessToken dyn_OpenProcessToken
+#define GetConsoleFontSize dyn_GetConsoleFontSize
+#define GetCurrentConsoleFont dyn_GetCurrentConsoleFont
+#define Wow64SuspendThread dyn_Wow64SuspendThread
+#define Wow64GetThreadContext dyn_Wow64GetThreadContext
+#define Wow64SetThreadContext dyn_Wow64SetThreadContext
+#define Wow64GetThreadSelectorEntry dyn_Wow64GetThreadSelectorEntry
+#define GenerateConsoleCtrlEvent dyn_GenerateConsoleCtrlEvent
#define InitializeProcThreadAttributeList dyn_InitializeProcThreadAttributeList
#define UpdateProcThreadAttribute dyn_UpdateProcThreadAttribute
#define DeleteProcThreadAttributeList dyn_DeleteProcThreadAttributeList
typedef BOOL WINAPI (AdjustTokenPrivileges_ftype) (HANDLE, BOOL,
- PTOKEN_PRIVILEGES,
- DWORD, PTOKEN_PRIVILEGES,
- PDWORD);
+ PTOKEN_PRIVILEGES, DWORD,
+ PTOKEN_PRIVILEGES, PDWORD);
extern AdjustTokenPrivileges_ftype *AdjustTokenPrivileges;
typedef BOOL WINAPI (DebugActiveProcessStop_ftype) (DWORD);
@@ -370,11 +367,11 @@ typedef BOOL WINAPI (GetModuleInformation_ftype) (HANDLE, HMODULE,
extern GetModuleInformation_ftype *GetModuleInformation;
typedef DWORD WINAPI (GetModuleFileNameExA_ftype) (HANDLE, HMODULE, LPSTR,
- DWORD);
+ DWORD);
extern GetModuleFileNameExA_ftype *GetModuleFileNameExA;
-typedef DWORD WINAPI (GetModuleFileNameExW_ftype) (HANDLE, HMODULE,
- LPWSTR, DWORD);
+typedef DWORD WINAPI (GetModuleFileNameExW_ftype) (HANDLE, HMODULE, LPWSTR,
+ DWORD);
extern GetModuleFileNameExW_ftype *GetModuleFileNameExW;
typedef BOOL WINAPI (LookupPrivilegeValueA_ftype) (LPCSTR, LPCSTR, PLUID);
@@ -413,19 +410,20 @@ extern GenerateConsoleCtrlEvent_ftype *GenerateConsoleCtrlEvent;
Windows 8. */
typedef void *gdb_lpproc_thread_attribute_list;
-typedef BOOL WINAPI (InitializeProcThreadAttributeList_ftype)
- (gdb_lpproc_thread_attribute_list lpAttributeList,
- DWORD dwAttributeCount, DWORD dwFlags, PSIZE_T lpSize);
-extern InitializeProcThreadAttributeList_ftype *InitializeProcThreadAttributeList;
+typedef BOOL WINAPI (InitializeProcThreadAttributeList_ftype) (
+ gdb_lpproc_thread_attribute_list lpAttributeList, DWORD dwAttributeCount,
+ DWORD dwFlags, PSIZE_T lpSize);
+extern InitializeProcThreadAttributeList_ftype
+ *InitializeProcThreadAttributeList;
-typedef BOOL WINAPI (UpdateProcThreadAttribute_ftype)
- (gdb_lpproc_thread_attribute_list lpAttributeList,
- DWORD dwFlags, DWORD_PTR Attribute, PVOID lpValue, SIZE_T cbSize,
- PVOID lpPreviousValue, PSIZE_T lpReturnSize);
+typedef BOOL WINAPI (UpdateProcThreadAttribute_ftype) (
+ gdb_lpproc_thread_attribute_list lpAttributeList, DWORD dwFlags,
+ DWORD_PTR Attribute, PVOID lpValue, SIZE_T cbSize, PVOID lpPreviousValue,
+ PSIZE_T lpReturnSize);
extern UpdateProcThreadAttribute_ftype *UpdateProcThreadAttribute;
-typedef void WINAPI (DeleteProcThreadAttributeList_ftype)
- (gdb_lpproc_thread_attribute_list lpAttributeList);
+typedef void WINAPI (DeleteProcThreadAttributeList_ftype) (
+ gdb_lpproc_thread_attribute_list lpAttributeList);
extern DeleteProcThreadAttributeList_ftype *DeleteProcThreadAttributeList;
/* Return true if it's possible to disable randomization on this
@@ -438,6 +436,6 @@ extern bool disable_randomization_available ();
extern bool initialize_loadable ();
-}
+} // namespace windows_nat
#endif
diff --git a/gdb/nat/x86-cpuid.h b/gdb/nat/x86-cpuid.h
index 0955afba577..d4c1105711e 100644
--- a/gdb/nat/x86-cpuid.h
+++ b/gdb/nat/x86-cpuid.h
@@ -30,9 +30,8 @@
unsupported cpuid level. Pointers may be non-null. */
static __inline int
-x86_cpuid (unsigned int __level,
- unsigned int *__eax, unsigned int *__ebx,
- unsigned int *__ecx, unsigned int *__edx)
+x86_cpuid (unsigned int __level, unsigned int *__eax, unsigned int *__ebx,
+ unsigned int *__ecx, unsigned int *__edx)
{
unsigned int __scratch;
@@ -51,9 +50,8 @@ x86_cpuid (unsigned int __level,
#else
static __inline int
-x86_cpuid (unsigned int __level,
- unsigned int *__eax, unsigned int *__ebx,
- unsigned int *__ecx, unsigned int *__edx)
+x86_cpuid (unsigned int __level, unsigned int *__eax, unsigned int *__ebx,
+ unsigned int *__ecx, unsigned int *__edx)
{
return 0;
}
diff --git a/gdb/nat/x86-dregs.c b/gdb/nat/x86-dregs.c
index 731093dfa73..ca07d0f067c 100644
--- a/gdb/nat/x86-dregs.c
+++ b/gdb/nat/x86-dregs.c
@@ -104,28 +104,28 @@ x86_get_debug_register_length ()
/* DR7 Debug Control register fields. */
/* How many bits to skip in DR7 to get to R/W and LEN fields. */
-#define DR_CONTROL_SHIFT 16
+#define DR_CONTROL_SHIFT 16
/* How many bits in DR7 per R/W and LEN field for each watchpoint. */
-#define DR_CONTROL_SIZE 4
+#define DR_CONTROL_SIZE 4
/* Watchpoint/breakpoint read/write fields in DR7. */
-#define DR_RW_EXECUTE (0x0) /* Break on instruction execution. */
-#define DR_RW_WRITE (0x1) /* Break on data writes. */
-#define DR_RW_READ (0x3) /* Break on data reads or writes. */
+#define DR_RW_EXECUTE (0x0) /* Break on instruction execution. */
+#define DR_RW_WRITE (0x1) /* Break on data writes. */
+#define DR_RW_READ (0x3) /* Break on data reads or writes. */
/* This is here for completeness. No platform supports this
functionality yet (as of March 2001). Note that the DE flag in the
CR4 register needs to be set to support this. */
#ifndef DR_RW_IORW
-#define DR_RW_IORW (0x2) /* Break on I/O reads or writes. */
+#define DR_RW_IORW (0x2) /* Break on I/O reads or writes. */
#endif
/* Watchpoint/breakpoint length fields in DR7. The 2-bit left shift
is so we could OR this with the read/write field defined above. */
-#define DR_LEN_1 (0x0 << 2) /* 1-byte region watch or breakpoint. */
-#define DR_LEN_2 (0x1 << 2) /* 2-byte region watch. */
-#define DR_LEN_4 (0x3 << 2) /* 4-byte region watch. */
-#define DR_LEN_8 (0x2 << 2) /* 8-byte region watch (AMD64). */
+#define DR_LEN_1 (0x0 << 2) /* 1-byte region watch or breakpoint. */
+#define DR_LEN_2 (0x1 << 2) /* 2-byte region watch. */
+#define DR_LEN_4 (0x3 << 2) /* 4-byte region watch. */
+#define DR_LEN_8 (0x2 << 2) /* 8-byte region watch (AMD64). */
/* Local and Global Enable flags in DR7.
@@ -138,29 +138,29 @@ x86_get_debug_register_length ()
Currently, all watchpoint are locally enabled. If you need to
enable them globally, read the comment which pertains to this in
x86_insert_aligned_watchpoint below. */
-#define DR_LOCAL_ENABLE_SHIFT 0 /* Extra shift to the local enable bit. */
-#define DR_GLOBAL_ENABLE_SHIFT 1 /* Extra shift to the global enable bit. */
-#define DR_ENABLE_SIZE 2 /* Two enable bits per debug register. */
+#define DR_LOCAL_ENABLE_SHIFT 0 /* Extra shift to the local enable bit. */
+#define DR_GLOBAL_ENABLE_SHIFT 1 /* Extra shift to the global enable bit. */
+#define DR_ENABLE_SIZE 2 /* Two enable bits per debug register. */
/* Local and global exact breakpoint enable flags (a.k.a. slowdown
flags). These are only required on i386, to allow detection of the
exact instruction which caused a watchpoint to break; i486 and
later processors do that automatically. We set these flags for
backwards compatibility. */
-#define DR_LOCAL_SLOWDOWN (0x100)
-#define DR_GLOBAL_SLOWDOWN (0x200)
+#define DR_LOCAL_SLOWDOWN (0x100)
+#define DR_GLOBAL_SLOWDOWN (0x200)
/* Fields reserved by Intel. This includes the GD (General Detect
Enable) flag, which causes a debug exception to be generated when a
MOV instruction accesses one of the debug registers.
FIXME: My Intel manual says we should use 0xF800, not 0xFC00. */
-#define DR_CONTROL_RESERVED (0xFC00)
+#define DR_CONTROL_RESERVED (0xFC00)
/* Auxiliary helper macros. */
/* A value that masks all fields in DR7 that are reserved by Intel. */
-#define X86_DR_CONTROL_MASK (~DR_CONTROL_RESERVED)
+#define X86_DR_CONTROL_MASK (~DR_CONTROL_RESERVED)
/* The I'th debug register is vacant if its Local and Global Enable
bits are reset in the Debug Control register. */
@@ -168,79 +168,91 @@ x86_get_debug_register_length ()
(((state)->dr_control_mirror & (3 << (DR_ENABLE_SIZE * (i)))) == 0)
/* Locally enable the break/watchpoint in the I'th debug register. */
-#define X86_DR_LOCAL_ENABLE(state, i) \
- do { \
- (state)->dr_control_mirror |= \
- (1 << (DR_LOCAL_ENABLE_SHIFT + DR_ENABLE_SIZE * (i))); \
- } while (0)
+#define X86_DR_LOCAL_ENABLE(state, i) \
+ do \
+ { \
+ (state)->dr_control_mirror \
+ |= (1 << (DR_LOCAL_ENABLE_SHIFT + DR_ENABLE_SIZE * (i))); \
+ } \
+ while (0)
/* Globally enable the break/watchpoint in the I'th debug register. */
-#define X86_DR_GLOBAL_ENABLE(state, i) \
- do { \
- (state)->dr_control_mirror |= \
- (1 << (DR_GLOBAL_ENABLE_SHIFT + DR_ENABLE_SIZE * (i))); \
- } while (0)
+#define X86_DR_GLOBAL_ENABLE(state, i) \
+ do \
+ { \
+ (state)->dr_control_mirror \
+ |= (1 << (DR_GLOBAL_ENABLE_SHIFT + DR_ENABLE_SIZE * (i))); \
+ } \
+ while (0)
/* Disable the break/watchpoint in the I'th debug register. */
-#define X86_DR_DISABLE(state, i) \
- do { \
- (state)->dr_control_mirror &= \
- ~(3 << (DR_ENABLE_SIZE * (i))); \
- } while (0)
+#define X86_DR_DISABLE(state, i) \
+ do \
+ { \
+ (state)->dr_control_mirror &= ~(3 << (DR_ENABLE_SIZE * (i))); \
+ } \
+ while (0)
/* Set in DR7 the RW and LEN fields for the I'th debug register. */
-#define X86_DR_SET_RW_LEN(state, i, rwlen) \
- do { \
- (state)->dr_control_mirror &= \
- ~(0x0f << (DR_CONTROL_SHIFT + DR_CONTROL_SIZE * (i))); \
- (state)->dr_control_mirror |= \
- ((rwlen) << (DR_CONTROL_SHIFT + DR_CONTROL_SIZE * (i))); \
- } while (0)
+#define X86_DR_SET_RW_LEN(state, i, rwlen) \
+ do \
+ { \
+ (state)->dr_control_mirror \
+ &= ~(0x0f << (DR_CONTROL_SHIFT + DR_CONTROL_SIZE * (i))); \
+ (state)->dr_control_mirror \
+ |= ((rwlen) << (DR_CONTROL_SHIFT + DR_CONTROL_SIZE * (i))); \
+ } \
+ while (0)
/* Get from DR7 the RW and LEN fields for the I'th debug register. */
#define X86_DR_GET_RW_LEN(dr7, i) \
- (((dr7) \
- >> (DR_CONTROL_SHIFT + DR_CONTROL_SIZE * (i))) & 0x0f)
+ (((dr7) >> (DR_CONTROL_SHIFT + DR_CONTROL_SIZE * (i))) & 0x0f)
/* Did the watchpoint whose address is in the I'th register break? */
#define X86_DR_WATCH_HIT(dr6, i) ((dr6) & (1 << (i)))
/* Types of operations supported by x86_handle_nonaligned_watchpoint. */
-enum x86_wp_op_t { WP_INSERT, WP_REMOVE, WP_COUNT };
+enum x86_wp_op_t
+{
+ WP_INSERT,
+ WP_REMOVE,
+ WP_COUNT
+};
/* Print the values of the mirrored debug registers. */
static void
-x86_show_dr (struct x86_debug_reg_state *state,
- const char *func, CORE_ADDR addr,
- int len, enum target_hw_bp_type type)
+x86_show_dr (struct x86_debug_reg_state *state, const char *func,
+ CORE_ADDR addr, int len, enum target_hw_bp_type type)
{
int i;
debug_printf ("%s", func);
if (addr || len)
- debug_printf (" (addr=%s, len=%d, type=%s)",
- phex (addr, 8), len,
- type == hw_write ? "data-write"
- : (type == hw_read ? "data-read"
- : (type == hw_access ? "data-read/write"
- : (type == hw_execute ? "instruction-execute"
- /* FIXME: if/when I/O read/write
+ debug_printf (" (addr=%s, len=%d, type=%s)", phex (addr, 8), len,
+ type == hw_write
+ ? "data-write"
+ : (type == hw_read
+ ? "data-read"
+ : (type == hw_access
+ ? "data-read/write"
+ : (type == hw_execute
+ ? "instruction-execute"
+ /* FIXME: if/when I/O read/write
watchpoints are supported, add them
here. */
- : "??unknown??"))));
+ : "??unknown??"))));
debug_printf (":\n");
debug_printf ("\tCONTROL (DR7): 0x%s\n", phex (state->dr_control_mirror, 8));
debug_printf ("\tSTATUS (DR6): 0x%s\n", phex (state->dr_status_mirror, 8));
ALL_DEBUG_ADDRESS_REGISTERS (i)
- {
- debug_printf ("\tDR%d: addr=0x%s, ref.count=%d\n",
- i, phex (state->dr_mirror[i],
- x86_get_debug_register_length ()),
- state->dr_ref_count[i]);
- }
+ {
+ debug_printf ("\tDR%d: addr=0x%s, ref.count=%d\n", i,
+ phex (state->dr_mirror[i], x86_get_debug_register_length ()),
+ state->dr_ref_count[i]);
+ }
}
/* Return the value of a 4-bit field for DR7 suitable for watching a
@@ -254,45 +266,46 @@ x86_length_and_rw_bits (int len, enum target_hw_bp_type type)
switch (type)
{
- case hw_execute:
- rw = DR_RW_EXECUTE;
- break;
- case hw_write:
- rw = DR_RW_WRITE;
- break;
- case hw_read:
- internal_error (_("The i386 doesn't support "
- "data-read watchpoints.\n"));
- case hw_access:
- rw = DR_RW_READ;
- break;
+ case hw_execute:
+ rw = DR_RW_EXECUTE;
+ break;
+ case hw_write:
+ rw = DR_RW_WRITE;
+ break;
+ case hw_read:
+ internal_error (_ ("The i386 doesn't support "
+ "data-read watchpoints.\n"));
+ case hw_access:
+ rw = DR_RW_READ;
+ break;
#if 0
/* Not yet supported. */
case hw_io_access:
rw = DR_RW_IORW;
break;
#endif
- default:
- internal_error (_("\
+ default:
+ internal_error (_ ("\
Invalid hardware breakpoint type %d in x86_length_and_rw_bits.\n"),
- (int) type);
+ (int) type);
}
switch (len)
{
- case 1:
- return (DR_LEN_1 | rw);
- case 2:
- return (DR_LEN_2 | rw);
- case 4:
- return (DR_LEN_4 | rw);
- case 8:
- if (TARGET_HAS_DR_LEN_8)
- return (DR_LEN_8 | rw);
- /* FALL THROUGH */
- default:
- internal_error (_("\
-Invalid hardware breakpoint length %d in x86_length_and_rw_bits.\n"), len);
+ case 1:
+ return (DR_LEN_1 | rw);
+ case 2:
+ return (DR_LEN_2 | rw);
+ case 4:
+ return (DR_LEN_4 | rw);
+ case 8:
+ if (TARGET_HAS_DR_LEN_8)
+ return (DR_LEN_8 | rw);
+ /* FALL THROUGH */
+ default:
+ internal_error (_ ("\
+Invalid hardware breakpoint length %d in x86_length_and_rw_bits.\n"),
+ len);
}
}
@@ -315,22 +328,21 @@ x86_insert_aligned_watchpoint (struct x86_debug_reg_state *state,
and the same RW and LEN definitions. If we find one, we can
reuse it for this watchpoint as well (and save a register). */
ALL_DEBUG_ADDRESS_REGISTERS (i)
- {
- if (!X86_DR_VACANT (state, i)
- && state->dr_mirror[i] == addr
- && X86_DR_GET_RW_LEN (state->dr_control_mirror, i) == len_rw_bits)
- {
- state->dr_ref_count[i]++;
- return 0;
- }
- }
+ {
+ if (!X86_DR_VACANT (state, i) && state->dr_mirror[i] == addr
+ && X86_DR_GET_RW_LEN (state->dr_control_mirror, i) == len_rw_bits)
+ {
+ state->dr_ref_count[i]++;
+ return 0;
+ }
+ }
/* Next, look for a vacant debug register. */
ALL_DEBUG_ADDRESS_REGISTERS (i)
- {
- if (X86_DR_VACANT (state, i))
- break;
- }
+ {
+ if (X86_DR_VACANT (state, i))
+ break;
+ }
/* No more debug registers! */
if (i >= DR_NADDR)
@@ -370,28 +382,27 @@ x86_remove_aligned_watchpoint (struct x86_debug_reg_state *state,
int all_vacant = 1;
ALL_DEBUG_ADDRESS_REGISTERS (i)
- {
- if (!X86_DR_VACANT (state, i)
- && state->dr_mirror[i] == addr
- && X86_DR_GET_RW_LEN (state->dr_control_mirror, i) == len_rw_bits)
- {
- if (--state->dr_ref_count[i] == 0) /* No longer in use? */
- {
- /* Reset our mirror. */
- state->dr_mirror[i] = 0;
- X86_DR_DISABLE (state, i);
- /* Even though not strictly necessary, clear out all
+ {
+ if (!X86_DR_VACANT (state, i) && state->dr_mirror[i] == addr
+ && X86_DR_GET_RW_LEN (state->dr_control_mirror, i) == len_rw_bits)
+ {
+ if (--state->dr_ref_count[i] == 0) /* No longer in use? */
+ {
+ /* Reset our mirror. */
+ state->dr_mirror[i] = 0;
+ X86_DR_DISABLE (state, i);
+ /* Even though not strictly necessary, clear out all
bits in DR_CONTROL related to this debug register.
Debug output is clearer when we don't have stale bits
in place. This also allows the assertion below. */
- X86_DR_SET_RW_LEN (state, i, 0);
- }
- retval = 0;
- }
+ X86_DR_SET_RW_LEN (state, i, 0);
+ }
+ retval = 0;
+ }
- if (!X86_DR_VACANT (state, i))
- all_vacant = 0;
- }
+ if (!X86_DR_VACANT (state, i))
+ all_vacant = 0;
+ }
if (all_vacant)
{
@@ -422,16 +433,15 @@ x86_handle_nonaligned_watchpoint (struct x86_debug_reg_state *state,
int retval = 0;
int max_wp_len = TARGET_HAS_DR_LEN_8 ? 8 : 4;
- static const int size_try_array[8][8] =
- {
- {1, 1, 1, 1, 1, 1, 1, 1}, /* Trying size one. */
- {2, 1, 2, 1, 2, 1, 2, 1}, /* Trying size two. */
- {2, 1, 2, 1, 2, 1, 2, 1}, /* Trying size three. */
- {4, 1, 2, 1, 4, 1, 2, 1}, /* Trying size four. */
- {4, 1, 2, 1, 4, 1, 2, 1}, /* Trying size five. */
- {4, 1, 2, 1, 4, 1, 2, 1}, /* Trying size six. */
- {4, 1, 2, 1, 4, 1, 2, 1}, /* Trying size seven. */
- {8, 1, 2, 1, 4, 1, 2, 1}, /* Trying size eight. */
+ static const int size_try_array[8][8] = {
+ { 1, 1, 1, 1, 1, 1, 1, 1 }, /* Trying size one. */
+ { 2, 1, 2, 1, 2, 1, 2, 1 }, /* Trying size two. */
+ { 2, 1, 2, 1, 2, 1, 2, 1 }, /* Trying size three. */
+ { 4, 1, 2, 1, 4, 1, 2, 1 }, /* Trying size four. */
+ { 4, 1, 2, 1, 4, 1, 2, 1 }, /* Trying size five. */
+ { 4, 1, 2, 1, 4, 1, 2, 1 }, /* Trying size six. */
+ { 4, 1, 2, 1, 4, 1, 2, 1 }, /* Trying size seven. */
+ { 8, 1, 2, 1, 4, 1, 2, 1 }, /* Trying size eight. */
};
while (len > 0)
@@ -461,7 +471,7 @@ x86_handle_nonaligned_watchpoint (struct x86_debug_reg_state *state,
else if (what == WP_REMOVE)
retval = x86_remove_aligned_watchpoint (state, addr, len_rw);
else
- internal_error (_("\
+ internal_error (_ ("\
Invalid value %d of operation in x86_handle_nonaligned_watchpoint.\n"),
(int) what);
if (retval)
@@ -485,12 +495,12 @@ x86_update_inferior_debug_regs (struct x86_debug_reg_state *state,
int i;
ALL_DEBUG_ADDRESS_REGISTERS (i)
- {
- if (X86_DR_VACANT (new_state, i) != X86_DR_VACANT (state, i))
- x86_dr_low_set_addr (new_state, i);
- else
- gdb_assert (new_state->dr_mirror[i] == state->dr_mirror[i]);
- }
+ {
+ if (X86_DR_VACANT (new_state, i) != X86_DR_VACANT (state, i))
+ x86_dr_low_set_addr (new_state, i);
+ else
+ gdb_assert (new_state->dr_mirror[i] == state->dr_mirror[i]);
+ }
if (new_state->dr_control_mirror != state->dr_control_mirror)
x86_dr_low_set_control (new_state);
@@ -504,8 +514,7 @@ x86_update_inferior_debug_regs (struct x86_debug_reg_state *state,
int
x86_dr_insert_watchpoint (struct x86_debug_reg_state *state,
- enum target_hw_bp_type type,
- CORE_ADDR addr, int len)
+ enum target_hw_bp_type type, CORE_ADDR addr, int len)
{
int retval;
/* Work on a local copy of the debug registers, and on success,
@@ -519,16 +528,14 @@ x86_dr_insert_watchpoint (struct x86_debug_reg_state *state,
&& !(TARGET_HAS_DR_LEN_8 && len == 8))
|| addr % len != 0)
{
- retval = x86_handle_nonaligned_watchpoint (&local_state,
- WP_INSERT,
- addr, len, type);
+ retval = x86_handle_nonaligned_watchpoint (&local_state, WP_INSERT, addr,
+ len, type);
}
else
{
unsigned len_rw = x86_length_and_rw_bits (len, type);
- retval = x86_insert_aligned_watchpoint (&local_state,
- addr, len_rw);
+ retval = x86_insert_aligned_watchpoint (&local_state, addr, len_rw);
}
if (retval == 0)
@@ -546,8 +553,7 @@ x86_dr_insert_watchpoint (struct x86_debug_reg_state *state,
int
x86_dr_remove_watchpoint (struct x86_debug_reg_state *state,
- enum target_hw_bp_type type,
- CORE_ADDR addr, int len)
+ enum target_hw_bp_type type, CORE_ADDR addr, int len)
{
int retval;
/* Work on a local copy of the debug registers, and on success,
@@ -558,16 +564,14 @@ x86_dr_remove_watchpoint (struct x86_debug_reg_state *state,
&& !(TARGET_HAS_DR_LEN_8 && len == 8))
|| addr % len != 0)
{
- retval = x86_handle_nonaligned_watchpoint (&local_state,
- WP_REMOVE,
- addr, len, type);
+ retval = x86_handle_nonaligned_watchpoint (&local_state, WP_REMOVE, addr,
+ len, type);
}
else
{
unsigned len_rw = x86_length_and_rw_bits (len, type);
- retval = x86_remove_aligned_watchpoint (&local_state,
- addr, len_rw);
+ retval = x86_remove_aligned_watchpoint (&local_state, addr, len_rw);
}
if (retval == 0)
@@ -590,8 +594,8 @@ x86_dr_region_ok_for_watchpoint (struct x86_debug_reg_state *state,
/* Compute how many aligned watchpoints we would need to cover this
region. */
- nregs = x86_handle_nonaligned_watchpoint (state, WP_COUNT,
- addr, len, hw_write);
+ nregs
+ = x86_handle_nonaligned_watchpoint (state, WP_COUNT, addr, len, hw_write);
return nregs <= DR_NADDR ? 1 : 0;
}
@@ -644,29 +648,29 @@ x86_dr_stopped_data_address (struct x86_debug_reg_state *state,
status = x86_dr_low_get_status ();
ALL_DEBUG_ADDRESS_REGISTERS (i)
- {
- if (!X86_DR_WATCH_HIT (status, i))
- continue;
+ {
+ if (!X86_DR_WATCH_HIT (status, i))
+ continue;
- if (!control_p)
- {
- control = x86_dr_low_get_control ();
- control_p = 1;
- }
+ if (!control_p)
+ {
+ control = x86_dr_low_get_control ();
+ control_p = 1;
+ }
- /* This second condition makes sure DRi is set up for a data
+ /* This second condition makes sure DRi is set up for a data
watchpoint, not a hardware breakpoint. The reason is that
GDB doesn't call the target_stopped_data_address method
except for data watchpoints. In other words, I'm being
paranoiac. */
- if (X86_DR_GET_RW_LEN (control, i) != 0)
- {
- addr = x86_dr_low_get_addr (i);
- rc = 1;
- if (show_debug_regs)
- x86_show_dr (state, "watchpoint_hit", addr, -1, hw_write);
- }
- }
+ if (X86_DR_GET_RW_LEN (control, i) != 0)
+ {
+ addr = x86_dr_low_get_addr (i);
+ rc = 1;
+ if (show_debug_regs)
+ x86_show_dr (state, "watchpoint_hit", addr, -1, hw_write);
+ }
+ }
if (show_debug_regs && addr == 0)
x86_show_dr (state, "stopped_data_addr", 0, 0, hw_write);
@@ -709,24 +713,24 @@ x86_dr_stopped_by_hw_breakpoint (struct x86_debug_reg_state *state)
status = x86_dr_low_get_status ();
ALL_DEBUG_ADDRESS_REGISTERS (i)
- {
- if (!X86_DR_WATCH_HIT (status, i))
- continue;
-
- if (!control_p)
- {
- control = x86_dr_low_get_control ();
- control_p = 1;
- }
-
- if (X86_DR_GET_RW_LEN (control, i) == 0)
- {
- addr = x86_dr_low_get_addr (i);
- rc = 1;
- if (show_debug_regs)
- x86_show_dr (state, "watchpoint_hit", addr, -1, hw_execute);
- }
- }
+ {
+ if (!X86_DR_WATCH_HIT (status, i))
+ continue;
+
+ if (!control_p)
+ {
+ control = x86_dr_low_get_control ();
+ control_p = 1;
+ }
+
+ if (X86_DR_GET_RW_LEN (control, i) == 0)
+ {
+ addr = x86_dr_low_get_addr (i);
+ rc = 1;
+ if (show_debug_regs)
+ x86_show_dr (state, "watchpoint_hit", addr, -1, hw_execute);
+ }
+ }
return rc;
}
diff --git a/gdb/nat/x86-dregs.h b/gdb/nat/x86-dregs.h
index 093a234bc20..a7bcf08cfe1 100644
--- a/gdb/nat/x86-dregs.h
+++ b/gdb/nat/x86-dregs.h
@@ -32,46 +32,45 @@
counts, and allow to watch regions up to 16 bytes long
(32 bytes on 64 bit hosts). */
-
#include "gdbsupport/break-common.h" /* target_hw_bp_type */
/* Low-level function vector. */
struct x86_dr_low_type
- {
- /* Set the debug control (DR7) register to a given value for
+{
+ /* Set the debug control (DR7) register to a given value for
all LWPs. May be NULL if the debug control register cannot
be set. */
- void (*set_control) (unsigned long);
+ void (*set_control) (unsigned long);
- /* Put an address into one debug register for all LWPs. May
+ /* Put an address into one debug register for all LWPs. May
be NULL if debug registers cannot be set*/
- void (*set_addr) (int, CORE_ADDR);
+ void (*set_addr) (int, CORE_ADDR);
- /* Return the address in a given debug register of the current
+ /* Return the address in a given debug register of the current
LWP. */
- CORE_ADDR (*get_addr) (int);
+ CORE_ADDR (*get_addr) (int);
- /* Return the value of the debug status (DR6) register for
+ /* Return the value of the debug status (DR6) register for
current LWP. */
- unsigned long (*get_status) (void);
+ unsigned long (*get_status) (void);
- /* Return the value of the debug control (DR7) register for
+ /* Return the value of the debug control (DR7) register for
current LWP. */
- unsigned long (*get_control) (void);
+ unsigned long (*get_control) (void);
- /* Number of bytes used for debug registers (4 or 8). */
- int debug_register_length;
- };
+ /* Number of bytes used for debug registers (4 or 8). */
+ int debug_register_length;
+};
extern struct x86_dr_low_type x86_dr_low;
/* Debug registers' indices. */
#define DR_FIRSTADDR 0
-#define DR_LASTADDR 3
-#define DR_NADDR 4 /* The number of debug address registers. */
-#define DR_STATUS 6 /* Index of debug status register (DR6). */
-#define DR_CONTROL 7 /* Index of debug control register (DR7). */
+#define DR_LASTADDR 3
+#define DR_NADDR 4 /* The number of debug address registers. */
+#define DR_STATUS 6 /* Index of debug status register (DR6). */
+#define DR_CONTROL 7 /* Index of debug control register (DR7). */
/* Global state needed to track h/w watchpoints. */
@@ -103,16 +102,14 @@ extern struct x86_debug_reg_state *x86_debug_reg_state (pid_t pid);
of the type TYPE. Return 0 on success, -1 on failure. */
extern int x86_dr_insert_watchpoint (struct x86_debug_reg_state *state,
enum target_hw_bp_type type,
- CORE_ADDR addr,
- int len);
+ CORE_ADDR addr, int len);
/* Remove a watchpoint that watched the memory region which starts at
address ADDR, whose length is LEN bytes, and for accesses of the
type TYPE. Return 0 on success, -1 on failure. */
extern int x86_dr_remove_watchpoint (struct x86_debug_reg_state *state,
enum target_hw_bp_type type,
- CORE_ADDR addr,
- int len);
+ CORE_ADDR addr, int len);
/* Return non-zero if we can watch a memory region that starts at
address ADDR and whose length is LEN bytes. */
diff --git a/gdb/nat/x86-gcc-cpuid.h b/gdb/nat/x86-gcc-cpuid.h
index 2f7390a0e4e..3f3650b6cc2 100644
--- a/gdb/nat/x86-gcc-cpuid.h
+++ b/gdb/nat/x86-gcc-cpuid.h
@@ -30,156 +30,153 @@
*/
/* %ecx */
-#define bit_SSE3 (1 << 0)
-#define bit_PCLMUL (1 << 1)
-#define bit_LZCNT (1 << 5)
-#define bit_SSSE3 (1 << 9)
-#define bit_FMA (1 << 12)
-#define bit_CMPXCHG16B (1 << 13)
-#define bit_SSE4_1 (1 << 19)
-#define bit_SSE4_2 (1 << 20)
-#define bit_MOVBE (1 << 22)
-#define bit_POPCNT (1 << 23)
-#define bit_AES (1 << 25)
-#define bit_XSAVE (1 << 26)
-#define bit_OSXSAVE (1 << 27)
-#define bit_AVX (1 << 28)
-#define bit_F16C (1 << 29)
-#define bit_RDRND (1 << 30)
+#define bit_SSE3 (1 << 0)
+#define bit_PCLMUL (1 << 1)
+#define bit_LZCNT (1 << 5)
+#define bit_SSSE3 (1 << 9)
+#define bit_FMA (1 << 12)
+#define bit_CMPXCHG16B (1 << 13)
+#define bit_SSE4_1 (1 << 19)
+#define bit_SSE4_2 (1 << 20)
+#define bit_MOVBE (1 << 22)
+#define bit_POPCNT (1 << 23)
+#define bit_AES (1 << 25)
+#define bit_XSAVE (1 << 26)
+#define bit_OSXSAVE (1 << 27)
+#define bit_AVX (1 << 28)
+#define bit_F16C (1 << 29)
+#define bit_RDRND (1 << 30)
/* %edx */
-#define bit_CMPXCHG8B (1 << 8)
-#define bit_CMOV (1 << 15)
-#define bit_MMX (1 << 23)
-#define bit_FXSAVE (1 << 24)
-#define bit_SSE (1 << 25)
-#define bit_SSE2 (1 << 26)
+#define bit_CMPXCHG8B (1 << 8)
+#define bit_CMOV (1 << 15)
+#define bit_MMX (1 << 23)
+#define bit_FXSAVE (1 << 24)
+#define bit_SSE (1 << 25)
+#define bit_SSE2 (1 << 26)
/* Extended Features */
/* %ecx */
-#define bit_LAHF_LM (1 << 0)
-#define bit_ABM (1 << 5)
-#define bit_SSE4a (1 << 6)
-#define bit_PRFCHW (1 << 8)
-#define bit_XOP (1 << 11)
-#define bit_LWP (1 << 15)
-#define bit_FMA4 (1 << 16)
-#define bit_TBM (1 << 21)
-#define bit_MWAITX (1 << 29)
+#define bit_LAHF_LM (1 << 0)
+#define bit_ABM (1 << 5)
+#define bit_SSE4a (1 << 6)
+#define bit_PRFCHW (1 << 8)
+#define bit_XOP (1 << 11)
+#define bit_LWP (1 << 15)
+#define bit_FMA4 (1 << 16)
+#define bit_TBM (1 << 21)
+#define bit_MWAITX (1 << 29)
/* %edx */
#define bit_AVX5124VNNIW (1 << 2)
#define bit_AVX5124FMAPS (1 << 3)
-#define bit_MMXEXT (1 << 22)
-#define bit_LM (1 << 29)
-#define bit_3DNOWP (1 << 30)
-#define bit_3DNOW (1 << 31)
+#define bit_MMXEXT (1 << 22)
+#define bit_LM (1 << 29)
+#define bit_3DNOWP (1 << 30)
+#define bit_3DNOW (1 << 31)
/* %ebx. */
-#define bit_CLZERO (1 << 0)
+#define bit_CLZERO (1 << 0)
/* Extended Features (%eax == 7) */
/* %ebx */
-#define bit_FSGSBASE (1 << 0)
-#define bit_BMI (1 << 3)
-#define bit_HLE (1 << 4)
-#define bit_AVX2 (1 << 5)
-#define bit_BMI2 (1 << 8)
-#define bit_RTM (1 << 11)
-#define bit_MPX (1 << 14)
-#define bit_AVX512F (1 << 16)
-#define bit_AVX512DQ (1 << 17)
-#define bit_RDSEED (1 << 18)
-#define bit_ADX (1 << 19)
-#define bit_AVX512IFMA (1 << 21)
-#define bit_CLFLUSHOPT (1 << 23)
-#define bit_CLWB (1 << 24)
-#define bit_AVX512PF (1 << 26)
-#define bit_AVX512ER (1 << 27)
-#define bit_AVX512CD (1 << 28)
-#define bit_SHA (1 << 29)
-#define bit_AVX512BW (1 << 30)
-#define bit_AVX512VL (1 << 31)
+#define bit_FSGSBASE (1 << 0)
+#define bit_BMI (1 << 3)
+#define bit_HLE (1 << 4)
+#define bit_AVX2 (1 << 5)
+#define bit_BMI2 (1 << 8)
+#define bit_RTM (1 << 11)
+#define bit_MPX (1 << 14)
+#define bit_AVX512F (1 << 16)
+#define bit_AVX512DQ (1 << 17)
+#define bit_RDSEED (1 << 18)
+#define bit_ADX (1 << 19)
+#define bit_AVX512IFMA (1 << 21)
+#define bit_CLFLUSHOPT (1 << 23)
+#define bit_CLWB (1 << 24)
+#define bit_AVX512PF (1 << 26)
+#define bit_AVX512ER (1 << 27)
+#define bit_AVX512CD (1 << 28)
+#define bit_SHA (1 << 29)
+#define bit_AVX512BW (1 << 30)
+#define bit_AVX512VL (1 << 31)
/* %ecx */
-#define bit_PREFETCHWT1 (1 << 0)
-#define bit_AVX512VBMI (1 << 1)
-#define bit_PKU (1 << 3)
-#define bit_OSPKE (1 << 4)
+#define bit_PREFETCHWT1 (1 << 0)
+#define bit_AVX512VBMI (1 << 1)
+#define bit_PKU (1 << 3)
+#define bit_OSPKE (1 << 4)
/* XFEATURE_ENABLED_MASK register bits (%eax == 13, %ecx == 0) */
-#define bit_BNDREGS (1 << 3)
-#define bit_BNDCSR (1 << 4)
+#define bit_BNDREGS (1 << 3)
+#define bit_BNDCSR (1 << 4)
/* Extended State Enumeration Sub-leaf (%eax == 13, %ecx == 1) */
-#define bit_XSAVEOPT (1 << 0)
-#define bit_XSAVEC (1 << 1)
-#define bit_XSAVES (1 << 3)
+#define bit_XSAVEOPT (1 << 0)
+#define bit_XSAVEC (1 << 1)
+#define bit_XSAVES (1 << 3)
/* Signatures for different CPU implementations as returned in uses
of cpuid with level 0. */
-#define signature_AMD_ebx 0x68747541
-#define signature_AMD_ecx 0x444d4163
-#define signature_AMD_edx 0x69746e65
+#define signature_AMD_ebx 0x68747541
+#define signature_AMD_ecx 0x444d4163
+#define signature_AMD_edx 0x69746e65
-#define signature_CENTAUR_ebx 0x746e6543
-#define signature_CENTAUR_ecx 0x736c7561
-#define signature_CENTAUR_edx 0x48727561
+#define signature_CENTAUR_ebx 0x746e6543
+#define signature_CENTAUR_ecx 0x736c7561
+#define signature_CENTAUR_edx 0x48727561
-#define signature_CYRIX_ebx 0x69727943
-#define signature_CYRIX_ecx 0x64616574
-#define signature_CYRIX_edx 0x736e4978
+#define signature_CYRIX_ebx 0x69727943
+#define signature_CYRIX_ecx 0x64616574
+#define signature_CYRIX_edx 0x736e4978
-#define signature_INTEL_ebx 0x756e6547
-#define signature_INTEL_ecx 0x6c65746e
-#define signature_INTEL_edx 0x49656e69
+#define signature_INTEL_ebx 0x756e6547
+#define signature_INTEL_ecx 0x6c65746e
+#define signature_INTEL_edx 0x49656e69
-#define signature_TM1_ebx 0x6e617254
-#define signature_TM1_ecx 0x55504361
-#define signature_TM1_edx 0x74656d73
+#define signature_TM1_ebx 0x6e617254
+#define signature_TM1_ecx 0x55504361
+#define signature_TM1_edx 0x74656d73
-#define signature_TM2_ebx 0x756e6547
-#define signature_TM2_ecx 0x3638784d
-#define signature_TM2_edx 0x54656e69
+#define signature_TM2_ebx 0x756e6547
+#define signature_TM2_ecx 0x3638784d
+#define signature_TM2_edx 0x54656e69
-#define signature_NSC_ebx 0x646f6547
-#define signature_NSC_ecx 0x43534e20
-#define signature_NSC_edx 0x79622065
+#define signature_NSC_ebx 0x646f6547
+#define signature_NSC_ecx 0x43534e20
+#define signature_NSC_edx 0x79622065
-#define signature_NEXGEN_ebx 0x4778654e
-#define signature_NEXGEN_ecx 0x6e657669
-#define signature_NEXGEN_edx 0x72446e65
+#define signature_NEXGEN_ebx 0x4778654e
+#define signature_NEXGEN_ecx 0x6e657669
+#define signature_NEXGEN_edx 0x72446e65
-#define signature_RISE_ebx 0x65736952
-#define signature_RISE_ecx 0x65736952
-#define signature_RISE_edx 0x65736952
+#define signature_RISE_ebx 0x65736952
+#define signature_RISE_ecx 0x65736952
+#define signature_RISE_edx 0x65736952
-#define signature_SIS_ebx 0x20536953
-#define signature_SIS_ecx 0x20536953
-#define signature_SIS_edx 0x20536953
+#define signature_SIS_ebx 0x20536953
+#define signature_SIS_ecx 0x20536953
+#define signature_SIS_edx 0x20536953
-#define signature_UMC_ebx 0x20434d55
-#define signature_UMC_ecx 0x20434d55
-#define signature_UMC_edx 0x20434d55
+#define signature_UMC_ebx 0x20434d55
+#define signature_UMC_ecx 0x20434d55
+#define signature_UMC_edx 0x20434d55
-#define signature_VIA_ebx 0x20414956
-#define signature_VIA_ecx 0x20414956
-#define signature_VIA_edx 0x20414956
+#define signature_VIA_ebx 0x20414956
+#define signature_VIA_ecx 0x20414956
+#define signature_VIA_edx 0x20414956
-#define signature_VORTEX_ebx 0x74726f56
-#define signature_VORTEX_ecx 0x436f5320
-#define signature_VORTEX_edx 0x36387865
+#define signature_VORTEX_ebx 0x74726f56
+#define signature_VORTEX_ecx 0x436f5320
+#define signature_VORTEX_edx 0x36387865
-#define __cpuid(level, a, b, c, d) \
- __asm__ ("cpuid\n\t" \
- : "=a" (a), "=b" (b), "=c" (c), "=d" (d) \
- : "0" (level))
-
-#define __cpuid_count(level, count, a, b, c, d) \
- __asm__ ("cpuid\n\t" \
- : "=a" (a), "=b" (b), "=c" (c), "=d" (d) \
- : "0" (level), "2" (count))
+#define __cpuid(level, a, b, c, d) \
+ __asm__ ("cpuid\n\t" : "=a"(a), "=b"(b), "=c"(c), "=d"(d) : "0"(level))
+#define __cpuid_count(level, count, a, b, c, d) \
+ __asm__ ("cpuid\n\t" \
+ : "=a"(a), "=b"(b), "=c"(c), "=d"(d) \
+ : "0"(level), "2"(count))
/* Return highest supported input value for cpuid instruction. ext can
be either 0x0 or 0x8000000 to return highest supported value for
@@ -206,10 +203,10 @@ __get_cpuid_max (unsigned int __ext, unsigned int *__sig)
"pushf{l|d}\n\t"
"pop{l}\t%0\n\t"
"popf{l|d}\n\t"
- : "=&r" (__eax), "=&r" (__ebx)
- : "i" (0x00200000));
+ : "=&r"(__eax), "=&r"(__ebx)
+ : "i"(0x00200000));
#else
-/* Host GCCs older than 3.0 weren't supporting Intel asm syntax
+ /* Host GCCs older than 3.0 weren't supporting Intel asm syntax
nor alternatives in i386 code. */
__asm__ ("pushfl\n\t"
"pushfl\n\t"
@@ -221,8 +218,8 @@ __get_cpuid_max (unsigned int __ext, unsigned int *__sig)
"pushfl\n\t"
"popl\t%0\n\t"
"popfl\n\t"
- : "=&r" (__eax), "=&r" (__ebx)
- : "i" (0x00200000));
+ : "=&r"(__eax), "=&r"(__ebx)
+ : "i"(0x00200000));
#endif
if (!((__eax ^ __ebx) & 0x00200000))
@@ -244,8 +241,7 @@ __get_cpuid_max (unsigned int __ext, unsigned int *__sig)
unsupported cpuid leaf. All pointers are required to be non-null. */
static __inline int
-__get_cpuid (unsigned int __leaf,
- unsigned int *__eax, unsigned int *__ebx,
+__get_cpuid (unsigned int __leaf, unsigned int *__eax, unsigned int *__ebx,
unsigned int *__ecx, unsigned int *__edx)
{
unsigned int __ext = __leaf & 0x80000000;
diff --git a/gdb/nat/x86-linux-dregs.c b/gdb/nat/x86-linux-dregs.c
index a1d51ea2929..760acb377f6 100644
--- a/gdb/nat/x86-linux-dregs.c
+++ b/gdb/nat/x86-linux-dregs.c
@@ -49,7 +49,7 @@ x86_linux_dr_get (ptid_t ptid, int regnum)
errno = 0;
value = ptrace (PTRACE_PEEKUSER, tid, u_debugreg_offset (regnum), 0);
if (errno != 0)
- perror_with_name (_("Couldn't read debug register"));
+ perror_with_name (_ ("Couldn't read debug register"));
return value;
}
@@ -67,7 +67,7 @@ x86_linux_dr_set (ptid_t ptid, int regnum, unsigned long value)
errno = 0;
ptrace (PTRACE_POKEUSER, tid, u_debugreg_offset (regnum), value);
if (errno != 0)
- perror_with_name (_("Couldn't write debug register"));
+ perror_with_name (_ ("Couldn't write debug register"));
}
/* Callback for iterate_over_lwps. Mark that our local mirror of
@@ -147,8 +147,7 @@ x86_linux_update_debug_registers (struct lwp_info *lwp)
if (lwp_debug_registers_changed (lwp))
{
- struct x86_debug_reg_state *state
- = x86_debug_reg_state (ptid.pid ());
+ struct x86_debug_reg_state *state = x86_debug_reg_state (ptid.pid ());
int i;
/* Prior to Linux kernel 2.6.33 commit
@@ -160,15 +159,15 @@ x86_linux_update_debug_registers (struct lwp_info *lwp)
x86_linux_dr_set (ptid, DR_CONTROL, 0);
ALL_DEBUG_ADDRESS_REGISTERS (i)
- if (state->dr_ref_count[i] > 0)
- {
- x86_linux_dr_set (ptid, i, state->dr_mirror[i]);
+ if (state->dr_ref_count[i] > 0)
+ {
+ x86_linux_dr_set (ptid, i, state->dr_mirror[i]);
- /* If we're setting a watchpoint, any change the inferior
+ /* If we're setting a watchpoint, any change the inferior
has made to its debug registers needs to be discarded
to avoid x86_stopped_data_address getting confused. */
- clear_status = 1;
- }
+ clear_status = 1;
+ }
/* If DR_CONTROL is supposed to be zero then it's already set. */
if (state->dr_control_mirror != 0)
@@ -177,7 +176,6 @@ x86_linux_update_debug_registers (struct lwp_info *lwp)
lwp_set_debug_registers_changed (lwp, 0);
}
- if (clear_status
- || lwp_stop_reason (lwp) == TARGET_STOPPED_BY_WATCHPOINT)
+ if (clear_status || lwp_stop_reason (lwp) == TARGET_STOPPED_BY_WATCHPOINT)
x86_linux_dr_set (ptid, DR_STATUS, 0);
}
diff --git a/gdb/nat/x86-linux.h b/gdb/nat/x86-linux.h
index edddbf4fda8..f6054264a43 100644
--- a/gdb/nat/x86-linux.h
+++ b/gdb/nat/x86-linux.h
@@ -26,8 +26,7 @@
changed since the values were last written to the thread. Nonzero
indicates that a change has been made, zero indicates no change. */
-extern void lwp_set_debug_registers_changed (struct lwp_info *lwp,
- int value);
+extern void lwp_set_debug_registers_changed (struct lwp_info *lwp, int value);
/* Return nonzero if our local mirror of LWP's debug registers has
been changed since the values were last written to the thread,
diff --git a/gdb/nds32-tdep.c b/gdb/nds32-tdep.c
index ede1a188fb5..c6b233627bd 100644
--- a/gdb/nds32-tdep.c
+++ b/gdb/nds32-tdep.c
@@ -46,20 +46,25 @@
#include "features/nds32.c"
/* Simple macros for instruction analysis. */
-#define CHOP_BITS(insn, n) (insn & ~__MASK (n))
-#define N32_LSMW_ENABLE4(insn) (((insn) >> 6) & 0xf)
+#define CHOP_BITS(insn, n) (insn & ~__MASK (n))
+#define N32_LSMW_ENABLE4(insn) (((insn) >> 6) & 0xf)
#define N32_SMW_ADM \
- N32_TYPE4 (LSMW, 0, 0, 0, 1, (N32_LSMW_ADM << 2) | N32_LSMW_LSMW)
+ N32_TYPE4 (LSMW, 0, 0, 0, 1, (N32_LSMW_ADM << 2) | N32_LSMW_LSMW)
#define N32_LMW_BIM \
- N32_TYPE4 (LSMW, 0, 0, 0, 0, (N32_LSMW_BIM << 2) | N32_LSMW_LSMW)
-#define N32_FLDI_SP \
- N32_TYPE2 (LDC, 0, REG_SP, 0)
+ N32_TYPE4 (LSMW, 0, 0, 0, 0, (N32_LSMW_BIM << 2) | N32_LSMW_LSMW)
+#define N32_FLDI_SP N32_TYPE2 (LDC, 0, REG_SP, 0)
/* Use an invalid address value as 'not available' marker. */
-enum { REG_UNAVAIL = (CORE_ADDR) -1 };
+enum
+{
+ REG_UNAVAIL = (CORE_ADDR) -1
+};
/* Use an impossible value as invalid offset. */
-enum { INVALID_OFFSET = (CORE_ADDR) -1 };
+enum
+{
+ INVALID_OFFSET = (CORE_ADDR) -1
+};
/* Instruction groups for NDS32 epilogue analysis. */
enum
@@ -76,32 +81,55 @@ enum
INSN_RECOVER_RETURN,
};
-static const char *const nds32_register_names[] =
-{
+static const char *const nds32_register_names[] = {
/* 32 GPRs. */
- "r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7",
- "r8", "r9", "r10", "r11", "r12", "r13", "r14", "r15",
- "r16", "r17", "r18", "r19", "r20", "r21", "r22", "r23",
- "r24", "r25", "r26", "r27", "fp", "gp", "lp", "sp",
+ "r0",
+ "r1",
+ "r2",
+ "r3",
+ "r4",
+ "r5",
+ "r6",
+ "r7",
+ "r8",
+ "r9",
+ "r10",
+ "r11",
+ "r12",
+ "r13",
+ "r14",
+ "r15",
+ "r16",
+ "r17",
+ "r18",
+ "r19",
+ "r20",
+ "r21",
+ "r22",
+ "r23",
+ "r24",
+ "r25",
+ "r26",
+ "r27",
+ "fp",
+ "gp",
+ "lp",
+ "sp",
/* PC. */
"pc",
};
-static const char *const nds32_fdr_register_names[] =
-{
- "fd0", "fd1", "fd2", "fd3", "fd4", "fd5", "fd6", "fd7",
- "fd8", "fd9", "fd10", "fd11", "fd12", "fd13", "fd14", "fd15",
- "fd16", "fd17", "fd18", "fd19", "fd20", "fd21", "fd22", "fd23",
- "fd24", "fd25", "fd26", "fd27", "fd28", "fd29", "fd30", "fd31"
-};
+static const char *const nds32_fdr_register_names[]
+ = { "fd0", "fd1", "fd2", "fd3", "fd4", "fd5", "fd6", "fd7",
+ "fd8", "fd9", "fd10", "fd11", "fd12", "fd13", "fd14", "fd15",
+ "fd16", "fd17", "fd18", "fd19", "fd20", "fd21", "fd22", "fd23",
+ "fd24", "fd25", "fd26", "fd27", "fd28", "fd29", "fd30", "fd31" };
-static const char *const nds32_fsr_register_names[] =
-{
- "fs0", "fs1", "fs2", "fs3", "fs4", "fs5", "fs6", "fs7",
- "fs8", "fs9", "fs10", "fs11", "fs12", "fs13", "fs14", "fs15",
- "fs16", "fs17", "fs18", "fs19", "fs20", "fs21", "fs22", "fs23",
- "fs24", "fs25", "fs26", "fs27", "fs28", "fs29", "fs30", "fs31"
-};
+static const char *const nds32_fsr_register_names[]
+ = { "fs0", "fs1", "fs2", "fs3", "fs4", "fs5", "fs6", "fs7",
+ "fs8", "fs9", "fs10", "fs11", "fs12", "fs13", "fs14", "fs15",
+ "fs16", "fs17", "fs18", "fs19", "fs20", "fs21", "fs22", "fs23",
+ "fs24", "fs25", "fs26", "fs27", "fs28", "fs29", "fs30", "fs31" };
/* The number of registers for four FPU configuration options. */
const int num_fdr_map[] = { 4, 8, 16, 32 };
@@ -112,153 +140,152 @@ static const struct
{
const char *name;
const char *alias;
-} nds32_register_aliases[] =
-{
- {"r15", "ta"},
- {"r26", "p0"},
- {"r27", "p1"},
- {"fp", "r28"},
- {"gp", "r29"},
- {"lp", "r30"},
- {"sp", "r31"},
-
- {"cr0", "cpu_ver"},
- {"cr1", "icm_cfg"},
- {"cr2", "dcm_cfg"},
- {"cr3", "mmu_cfg"},
- {"cr4", "msc_cfg"},
- {"cr5", "core_id"},
- {"cr6", "fucop_exist"},
- {"cr7", "msc_cfg2"},
-
- {"ir0", "psw"},
- {"ir1", "ipsw"},
- {"ir2", "p_psw"},
- {"ir3", "ivb"},
- {"ir4", "eva"},
- {"ir5", "p_eva"},
- {"ir6", "itype"},
- {"ir7", "p_itype"},
- {"ir8", "merr"},
- {"ir9", "ipc"},
- {"ir10", "p_ipc"},
- {"ir11", "oipc"},
- {"ir12", "p_p0"},
- {"ir13", "p_p1"},
- {"ir14", "int_mask"},
- {"ir15", "int_pend"},
- {"ir16", "sp_usr"},
- {"ir17", "sp_priv"},
- {"ir18", "int_pri"},
- {"ir19", "int_ctrl"},
- {"ir20", "sp_usr1"},
- {"ir21", "sp_priv1"},
- {"ir22", "sp_usr2"},
- {"ir23", "sp_priv2"},
- {"ir24", "sp_usr3"},
- {"ir25", "sp_priv3"},
- {"ir26", "int_mask2"},
- {"ir27", "int_pend2"},
- {"ir28", "int_pri2"},
- {"ir29", "int_trigger"},
-
- {"mr0", "mmu_ctl"},
- {"mr1", "l1_pptb"},
- {"mr2", "tlb_vpn"},
- {"mr3", "tlb_data"},
- {"mr4", "tlb_misc"},
- {"mr5", "vlpt_idx"},
- {"mr6", "ilmb"},
- {"mr7", "dlmb"},
- {"mr8", "cache_ctl"},
- {"mr9", "hsmp_saddr"},
- {"mr10", "hsmp_eaddr"},
- {"mr11", "bg_region"},
-
- {"dr0", "bpc0"},
- {"dr1", "bpc1"},
- {"dr2", "bpc2"},
- {"dr3", "bpc3"},
- {"dr4", "bpc4"},
- {"dr5", "bpc5"},
- {"dr6", "bpc6"},
- {"dr7", "bpc7"},
- {"dr8", "bpa0"},
- {"dr9", "bpa1"},
- {"dr10", "bpa2"},
- {"dr11", "bpa3"},
- {"dr12", "bpa4"},
- {"dr13", "bpa5"},
- {"dr14", "bpa6"},
- {"dr15", "bpa7"},
- {"dr16", "bpam0"},
- {"dr17", "bpam1"},
- {"dr18", "bpam2"},
- {"dr19", "bpam3"},
- {"dr20", "bpam4"},
- {"dr21", "bpam5"},
- {"dr22", "bpam6"},
- {"dr23", "bpam7"},
- {"dr24", "bpv0"},
- {"dr25", "bpv1"},
- {"dr26", "bpv2"},
- {"dr27", "bpv3"},
- {"dr28", "bpv4"},
- {"dr29", "bpv5"},
- {"dr30", "bpv6"},
- {"dr31", "bpv7"},
- {"dr32", "bpcid0"},
- {"dr33", "bpcid1"},
- {"dr34", "bpcid2"},
- {"dr35", "bpcid3"},
- {"dr36", "bpcid4"},
- {"dr37", "bpcid5"},
- {"dr38", "bpcid6"},
- {"dr39", "bpcid7"},
- {"dr40", "edm_cfg"},
- {"dr41", "edmsw"},
- {"dr42", "edm_ctl"},
- {"dr43", "edm_dtr"},
- {"dr44", "bpmtc"},
- {"dr45", "dimbr"},
- {"dr46", "tecr0"},
- {"dr47", "tecr1"},
-
- {"hspr0", "hsp_ctl"},
- {"hspr1", "sp_bound"},
- {"hspr2", "sp_bound_priv"},
-
- {"pfr0", "pfmc0"},
- {"pfr1", "pfmc1"},
- {"pfr2", "pfmc2"},
- {"pfr3", "pfm_ctl"},
- {"pfr4", "pft_ctl"},
-
- {"dmar0", "dma_cfg"},
- {"dmar1", "dma_gcsw"},
- {"dmar2", "dma_chnsel"},
- {"dmar3", "dma_act"},
- {"dmar4", "dma_setup"},
- {"dmar5", "dma_isaddr"},
- {"dmar6", "dma_esaddr"},
- {"dmar7", "dma_tcnt"},
- {"dmar8", "dma_status"},
- {"dmar9", "dma_2dset"},
- {"dmar10", "dma_2dsctl"},
- {"dmar11", "dma_rcnt"},
- {"dmar12", "dma_hstatus"},
-
- {"racr0", "prusr_acc_ctl"},
- {"fucpr", "fucop_ctl"},
-
- {"idr0", "sdz_ctl"},
- {"idr1", "misc_ctl"},
- {"idr2", "ecc_misc"},
-
- {"secur0", "sfcr"},
- {"secur1", "sign"},
- {"secur2", "isign"},
- {"secur3", "p_isign"},
+} nds32_register_aliases[] = {
+ { "r15", "ta" },
+ { "r26", "p0" },
+ { "r27", "p1" },
+ { "fp", "r28" },
+ { "gp", "r29" },
+ { "lp", "r30" },
+ { "sp", "r31" },
+
+ { "cr0", "cpu_ver" },
+ { "cr1", "icm_cfg" },
+ { "cr2", "dcm_cfg" },
+ { "cr3", "mmu_cfg" },
+ { "cr4", "msc_cfg" },
+ { "cr5", "core_id" },
+ { "cr6", "fucop_exist" },
+ { "cr7", "msc_cfg2" },
+
+ { "ir0", "psw" },
+ { "ir1", "ipsw" },
+ { "ir2", "p_psw" },
+ { "ir3", "ivb" },
+ { "ir4", "eva" },
+ { "ir5", "p_eva" },
+ { "ir6", "itype" },
+ { "ir7", "p_itype" },
+ { "ir8", "merr" },
+ { "ir9", "ipc" },
+ { "ir10", "p_ipc" },
+ { "ir11", "oipc" },
+ { "ir12", "p_p0" },
+ { "ir13", "p_p1" },
+ { "ir14", "int_mask" },
+ { "ir15", "int_pend" },
+ { "ir16", "sp_usr" },
+ { "ir17", "sp_priv" },
+ { "ir18", "int_pri" },
+ { "ir19", "int_ctrl" },
+ { "ir20", "sp_usr1" },
+ { "ir21", "sp_priv1" },
+ { "ir22", "sp_usr2" },
+ { "ir23", "sp_priv2" },
+ { "ir24", "sp_usr3" },
+ { "ir25", "sp_priv3" },
+ { "ir26", "int_mask2" },
+ { "ir27", "int_pend2" },
+ { "ir28", "int_pri2" },
+ { "ir29", "int_trigger" },
+
+ { "mr0", "mmu_ctl" },
+ { "mr1", "l1_pptb" },
+ { "mr2", "tlb_vpn" },
+ { "mr3", "tlb_data" },
+ { "mr4", "tlb_misc" },
+ { "mr5", "vlpt_idx" },
+ { "mr6", "ilmb" },
+ { "mr7", "dlmb" },
+ { "mr8", "cache_ctl" },
+ { "mr9", "hsmp_saddr" },
+ { "mr10", "hsmp_eaddr" },
+ { "mr11", "bg_region" },
+
+ { "dr0", "bpc0" },
+ { "dr1", "bpc1" },
+ { "dr2", "bpc2" },
+ { "dr3", "bpc3" },
+ { "dr4", "bpc4" },
+ { "dr5", "bpc5" },
+ { "dr6", "bpc6" },
+ { "dr7", "bpc7" },
+ { "dr8", "bpa0" },
+ { "dr9", "bpa1" },
+ { "dr10", "bpa2" },
+ { "dr11", "bpa3" },
+ { "dr12", "bpa4" },
+ { "dr13", "bpa5" },
+ { "dr14", "bpa6" },
+ { "dr15", "bpa7" },
+ { "dr16", "bpam0" },
+ { "dr17", "bpam1" },
+ { "dr18", "bpam2" },
+ { "dr19", "bpam3" },
+ { "dr20", "bpam4" },
+ { "dr21", "bpam5" },
+ { "dr22", "bpam6" },
+ { "dr23", "bpam7" },
+ { "dr24", "bpv0" },
+ { "dr25", "bpv1" },
+ { "dr26", "bpv2" },
+ { "dr27", "bpv3" },
+ { "dr28", "bpv4" },
+ { "dr29", "bpv5" },
+ { "dr30", "bpv6" },
+ { "dr31", "bpv7" },
+ { "dr32", "bpcid0" },
+ { "dr33", "bpcid1" },
+ { "dr34", "bpcid2" },
+ { "dr35", "bpcid3" },
+ { "dr36", "bpcid4" },
+ { "dr37", "bpcid5" },
+ { "dr38", "bpcid6" },
+ { "dr39", "bpcid7" },
+ { "dr40", "edm_cfg" },
+ { "dr41", "edmsw" },
+ { "dr42", "edm_ctl" },
+ { "dr43", "edm_dtr" },
+ { "dr44", "bpmtc" },
+ { "dr45", "dimbr" },
+ { "dr46", "tecr0" },
+ { "dr47", "tecr1" },
+
+ { "hspr0", "hsp_ctl" },
+ { "hspr1", "sp_bound" },
+ { "hspr2", "sp_bound_priv" },
+
+ { "pfr0", "pfmc0" },
+ { "pfr1", "pfmc1" },
+ { "pfr2", "pfmc2" },
+ { "pfr3", "pfm_ctl" },
+ { "pfr4", "pft_ctl" },
+
+ { "dmar0", "dma_cfg" },
+ { "dmar1", "dma_gcsw" },
+ { "dmar2", "dma_chnsel" },
+ { "dmar3", "dma_act" },
+ { "dmar4", "dma_setup" },
+ { "dmar5", "dma_isaddr" },
+ { "dmar6", "dma_esaddr" },
+ { "dmar7", "dma_tcnt" },
+ { "dmar8", "dma_status" },
+ { "dmar9", "dma_2dset" },
+ { "dmar10", "dma_2dsctl" },
+ { "dmar11", "dma_rcnt" },
+ { "dmar12", "dma_hstatus" },
+
+ { "racr0", "prusr_acc_ctl" },
+ { "fucpr", "fucop_ctl" },
+
+ { "idr0", "sdz_ctl" },
+ { "idr1", "misc_ctl" },
+ { "idr2", "ecc_misc" },
+
+ { "secur0", "sfcr" },
+ { "secur1", "sign" },
+ { "secur2", "isign" },
+ { "secur3", "p_isign" },
};
/* Value of a register alias. BATON is the regnum of the corresponding
@@ -269,7 +296,7 @@ value_of_nds32_reg (frame_info_ptr frame, const void *baton)
{
return value_of_register ((int) (intptr_t) baton, frame);
}
-
+
/* Implement the "frame_align" gdbarch method. */
static CORE_ADDR
@@ -312,7 +339,7 @@ nds32_dwarf2_reg_to_regnum (struct gdbarch *gdbarch, int num)
/* No match, return a inaccessible register number. */
return -1;
}
-
+
/* NDS32 register groups. */
static const reggroup *nds32_cr_reggroup;
static const reggroup *nds32_ir_reggroup;
@@ -385,7 +412,7 @@ nds32_register_reggroup_p (struct gdbarch *gdbarch, int regnum,
if (reggroup == system_reggroup)
return (regnum > NDS32_PC_REGNUM)
- && !nds32_register_reggroup_p (gdbarch, regnum, float_reggroup);
+ && !nds32_register_reggroup_p (gdbarch, regnum, float_reggroup);
/* The NDS32 reggroup contains registers whose name is prefixed
by reggroup name. */
@@ -393,7 +420,7 @@ nds32_register_reggroup_p (struct gdbarch *gdbarch, int regnum,
group_name = reggroup->name ();
return !strncmp (reg_name, group_name, strlen (group_name));
}
-
+
/* Implement the "pseudo_register_type" tdesc_arch_data method. */
static struct type *
@@ -406,7 +433,7 @@ nds32_pseudo_register_type (struct gdbarch *gdbarch, int regnum)
return arch_float_type (gdbarch, -1, "builtin_type_ieee_single",
floatformats_ieee_single);
- warning (_("Unknown nds32 pseudo register %d."), regnum);
+ warning (_ ("Unknown nds32 pseudo register %d."), regnum);
return NULL;
}
@@ -497,7 +524,7 @@ nds32_pseudo_register_write (struct gdbarch *gdbarch,
gdb_assert_not_reached ("invalid pseudo register number");
}
-
+
/* Helper function for NDS32 ABI. Return true if FPRs can be used
to pass function arguments and return value. */
@@ -740,10 +767,8 @@ nds32_analyze_prologue (struct gdbarch *gdbarch, CORE_ADDR pc,
{
int op = N32_OP6 (insn);
- if (op == N32_OP6_JI
- || op == N32_OP6_JREG
- || op == N32_OP6_BR1
- || op == N32_OP6_BR2
+ if (op == N32_OP6_JI || op == N32_OP6_JREG
+ || op == N32_OP6_BR1 || op == N32_OP6_BR2
|| op == N32_OP6_BR3)
break;
}
@@ -887,7 +912,7 @@ nds32_skip_prologue (struct gdbarch *gdbarch, CORE_ADDR pc)
that bound, then use an arbitrary large number as the upper bound. */
limit_pc = skip_prologue_using_sal (gdbarch, pc);
if (limit_pc == 0)
- limit_pc = pc + 128; /* Magic. */
+ limit_pc = pc + 128; /* Magic. */
/* Find the end of prologue. */
return nds32_analyze_prologue (gdbarch, pc, limit_pc, NULL);
@@ -949,8 +974,8 @@ nds32_frame_cache (frame_info_ptr this_frame, void **this_cache)
PC and the caller's SP when we were called. */
static void
-nds32_frame_this_id (frame_info_ptr this_frame,
- void **this_cache, struct frame_id *this_id)
+nds32_frame_this_id (frame_info_ptr this_frame, void **this_cache,
+ struct frame_id *this_id)
{
struct nds32_frame_cache *cache = nds32_frame_cache (this_frame, this_cache);
@@ -977,15 +1002,15 @@ nds32_frame_prev_register (frame_info_ptr this_frame, void **this_cache,
if (regnum == NDS32_PC_REGNUM)
regnum = NDS32_LP_REGNUM;
- if (regnum < NDS32_NUM_SAVED_REGS && cache->saved_regs[regnum] != REG_UNAVAIL)
+ if (regnum < NDS32_NUM_SAVED_REGS
+ && cache->saved_regs[regnum] != REG_UNAVAIL)
return frame_unwind_got_memory (this_frame, regnum,
cache->saved_regs[regnum]);
return frame_unwind_got_register (this_frame, regnum, regnum);
}
-static const struct frame_unwind nds32_frame_unwind =
-{
+static const struct frame_unwind nds32_frame_unwind = {
"nds32 prologue",
NORMAL_FRAME,
default_frame_unwind_stop_reason,
@@ -1005,14 +1030,10 @@ nds32_frame_base_address (frame_info_ptr this_frame, void **this_cache)
return cache->base;
}
-static const struct frame_base nds32_frame_base =
-{
- &nds32_frame_unwind,
- nds32_frame_base_address,
- nds32_frame_base_address,
- nds32_frame_base_address
-};
-
+static const struct frame_base nds32_frame_base
+ = { &nds32_frame_unwind, nds32_frame_base_address, nds32_frame_base_address,
+ nds32_frame_base_address };
+
/* Helper function for instructions used to pop multiple words. */
static void
@@ -1074,8 +1095,8 @@ nds32_analyze_epilogue_insn32 (int abi_use_fpr, uint32_t insn,
{
/* lmw.bim Rb, [$sp], Re, enable4 */
if (cache != NULL)
- nds32_pop_multiple_words (cache, N32_RT5 (insn),
- N32_RB5 (insn), N32_LSMW_ENABLE4 (insn));
+ nds32_pop_multiple_words (cache, N32_RT5 (insn), N32_RB5 (insn),
+ N32_LSMW_ENABLE4 (insn));
return INSN_RECOVER;
}
@@ -1331,8 +1352,8 @@ nds32_epilogue_frame_cache (frame_info_ptr this_frame, void **this_cache)
/* Implement the "this_id" frame_unwind method. */
static void
-nds32_epilogue_frame_this_id (frame_info_ptr this_frame,
- void **this_cache, struct frame_id *this_id)
+nds32_epilogue_frame_this_id (frame_info_ptr this_frame, void **this_cache,
+ struct frame_id *this_id)
{
struct nds32_frame_cache *cache
= nds32_epilogue_frame_cache (this_frame, this_cache);
@@ -1361,25 +1382,23 @@ nds32_epilogue_frame_prev_register (frame_info_ptr this_frame,
if (regnum == NDS32_PC_REGNUM)
regnum = NDS32_LP_REGNUM;
- if (regnum < NDS32_NUM_SAVED_REGS && cache->saved_regs[regnum] != REG_UNAVAIL)
+ if (regnum < NDS32_NUM_SAVED_REGS
+ && cache->saved_regs[regnum] != REG_UNAVAIL)
return frame_unwind_got_memory (this_frame, regnum,
cache->saved_regs[regnum]);
return frame_unwind_got_register (this_frame, regnum, regnum);
}
-static const struct frame_unwind nds32_epilogue_frame_unwind =
-{
- "nds32 epilogue",
- NORMAL_FRAME,
- default_frame_unwind_stop_reason,
- nds32_epilogue_frame_this_id,
- nds32_epilogue_frame_prev_register,
- NULL,
- nds32_epilogue_frame_sniffer
-};
+static const struct frame_unwind nds32_epilogue_frame_unwind
+ = { "nds32 epilogue",
+ NORMAL_FRAME,
+ default_frame_unwind_stop_reason,
+ nds32_epilogue_frame_this_id,
+ nds32_epilogue_frame_prev_register,
+ NULL,
+ nds32_epilogue_frame_sniffer };
-
/* Floating type and struct type that has only one floating type member
can pass value using FPU registers (when FPU ABI is used). */
@@ -1409,15 +1428,15 @@ nds32_check_calling_use_fpr (struct type *type)
static CORE_ADDR
nds32_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
- struct regcache *regcache, CORE_ADDR bp_addr,
- int nargs, struct value **args, CORE_ADDR sp,
+ struct regcache *regcache, CORE_ADDR bp_addr, int nargs,
+ struct value **args, CORE_ADDR sp,
function_call_return_method return_method,
CORE_ADDR struct_addr)
{
- const int REND = 6; /* End for register offset. */
- int goff = 0; /* Current gpr offset for argument. */
- int foff = 0; /* Current fpr offset for argument. */
- int soff = 0; /* Current stack offset for argument. */
+ const int REND = 6; /* End for register offset. */
+ int goff = 0; /* Current gpr offset for argument. */
+ int foff = 0; /* Current fpr offset for argument. */
+ int soff = 0; /* Current stack offset for argument. */
int i;
ULONGEST regval;
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
@@ -1518,8 +1537,8 @@ nds32_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
break;
default:
/* Long double? */
- internal_error ("Do not know how to handle %d-byte double.\n",
- len);
+ internal_error (
+ "Do not know how to handle %d-byte double.\n", len);
break;
}
continue;
@@ -1591,7 +1610,7 @@ nds32_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
}
}
-use_stack:
+ use_stack:
/*
When pushing (split parts of) an argument into stack,
@@ -1637,9 +1656,9 @@ use_stack:
error_no_fpr:
/* If use_fpr, but no floating-point register exists,
then it is an error. */
- error (_("Fail to call. FPU registers are required."));
+ error (_ ("Fail to call. FPU registers are required."));
}
-
+
/* Read, for architecture GDBARCH, a function return value of TYPE
from REGCACHE, and copy that into VALBUF. */
@@ -1663,8 +1682,9 @@ nds32_extract_return_value (struct gdbarch *gdbarch, struct type *type,
else if (len == 8)
regcache->cooked_read (NDS32_FD0_REGNUM, valbuf);
else
- internal_error (_("Cannot extract return value of %d bytes "
- "long floating-point."), len);
+ internal_error (_ ("Cannot extract return value of %d bytes "
+ "long floating-point."),
+ len);
}
else
{
@@ -1752,8 +1772,9 @@ nds32_store_return_value (struct gdbarch *gdbarch, struct type *type,
else if (len == 8)
regcache->cooked_write (NDS32_FD0_REGNUM, valbuf);
else
- internal_error (_("Cannot store return value of %d bytes "
- "long floating-point."), len);
+ internal_error (_ ("Cannot store return value of %d bytes "
+ "long floating-point."),
+ len);
}
else
{
@@ -1817,7 +1838,7 @@ nds32_return_value (struct gdbarch *gdbarch, struct value *func_type,
return RETURN_VALUE_REGISTER_CONVENTION;
}
}
-
+
/* Implement the "get_longjmp_target" gdbarch method. */
static int
@@ -1836,15 +1857,15 @@ nds32_get_longjmp_target (frame_info_ptr frame, CORE_ADDR *pc)
*pc = extract_unsigned_integer (buf, 4, byte_order);
return 1;
}
-
+
/* Validate the given TDESC, and fixed-number some registers in it.
Return 0 if the given TDESC does not contain the required feature
or not contain required registers. */
static int
nds32_validate_tdesc_p (const struct target_desc *tdesc,
- struct tdesc_arch_data *tdesc_data,
- int *fpu_freg, int *use_pseudo_fsrs)
+ struct tdesc_arch_data *tdesc_data, int *fpu_freg,
+ int *use_pseudo_fsrs)
{
const struct tdesc_feature *feature;
int i, valid_p;
@@ -1911,9 +1932,9 @@ nds32_validate_tdesc_p (const struct target_desc *tdesc,
fs0_regnum = NDS32_FD0_REGNUM + num_fdr_regs;
num_listed_fsr = 0;
for (i = 0; i < num_fsr_regs; i++)
- num_listed_fsr += tdesc_numbered_register (feature, tdesc_data,
- fs0_regnum + i,
- nds32_fsr_register_names[i]);
+ num_listed_fsr
+ += tdesc_numbered_register (feature, tdesc_data, fs0_regnum + i,
+ nds32_fsr_register_names[i]);
if (num_listed_fsr == 0)
/* No required FSRs are listed explicitly, make them pseudo registers
@@ -2082,6 +2103,7 @@ nds32_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
}
void _initialize_nds32_tdep ();
+
void
_initialize_nds32_tdep ()
{
diff --git a/gdb/nds32-tdep.h b/gdb/nds32-tdep.h
index 79dae6fac6e..c7c98846eda 100644
--- a/gdb/nds32-tdep.h
+++ b/gdb/nds32-tdep.h
@@ -28,13 +28,13 @@ enum nds32_regnum
/* General purpose registers. */
NDS32_R0_REGNUM = 0,
NDS32_R5_REGNUM = 5,
- NDS32_TA_REGNUM = 15, /* Temporary register. */
- NDS32_FP_REGNUM = 28, /* Frame pointer. */
- NDS32_GP_REGNUM = 29, /* Global pointer. */
- NDS32_LP_REGNUM = 30, /* Link pointer. */
- NDS32_SP_REGNUM = 31, /* Stack pointer. */
+ NDS32_TA_REGNUM = 15, /* Temporary register. */
+ NDS32_FP_REGNUM = 28, /* Frame pointer. */
+ NDS32_GP_REGNUM = 29, /* Global pointer. */
+ NDS32_LP_REGNUM = 30, /* Link pointer. */
+ NDS32_SP_REGNUM = 31, /* Stack pointer. */
- NDS32_PC_REGNUM = 32, /* Program counter. */
+ NDS32_PC_REGNUM = 32, /* Program counter. */
NDS32_NUM_REGS,
diff --git a/gdb/netbsd-nat.c b/gdb/netbsd-nat.c
index 64f74c9405c..0a01cd5195d 100644
--- a/gdb/netbsd-nat.c
+++ b/gdb/netbsd-nat.c
@@ -48,7 +48,7 @@ nbsd_pid_to_cwd (int pid)
{
char buf[PATH_MAX];
size_t buflen;
- int mib[4] = {CTL_KERN, KERN_PROC_ARGS, pid, KERN_PROC_CWD};
+ int mib[4] = { CTL_KERN, KERN_PROC_ARGS, pid, KERN_PROC_CWD };
buflen = sizeof (buf);
if (sysctl (mib, ARRAY_SIZE (mib), buf, &buflen, NULL, 0))
return "";
@@ -63,8 +63,8 @@ nbsd_pid_to_kinfo_proc2 (pid_t pid, struct kinfo_proc2 *kp)
gdb_assert (kp != nullptr);
size_t size = sizeof (*kp);
- int mib[6] = {CTL_KERN, KERN_PROC2, KERN_PROC_PID, pid,
- static_cast<int> (size), 1};
+ int mib[6]
+ = { CTL_KERN, KERN_PROC2, KERN_PROC_PID, pid, static_cast<int> (size), 1 };
return !sysctl (mib, ARRAY_SIZE (mib), kp, &size, NULL, 0);
}
@@ -73,10 +73,11 @@ nbsd_pid_to_kinfo_proc2 (pid_t pid, struct kinfo_proc2 *kp)
static gdb::unique_xmalloc_ptr<char[]>
nbsd_pid_to_cmdline (int pid)
{
- int mib[4] = {CTL_KERN, KERN_PROC_ARGS, pid, KERN_PROC_ARGV};
+ int mib[4] = { CTL_KERN, KERN_PROC_ARGS, pid, KERN_PROC_ARGV };
size_t size = 0;
- if (::sysctl (mib, ARRAY_SIZE (mib), NULL, &size, NULL, 0) == -1 || size == 0)
+ if (::sysctl (mib, ARRAY_SIZE (mib), NULL, &size, NULL, 0) == -1
+ || size == 0)
return nullptr;
gdb::unique_xmalloc_ptr<char[]> args (XNEWVAR (char, size));
@@ -118,17 +119,15 @@ nbsd_nat_target::thread_name (struct thread_info *thr)
static void
nbsd_add_threads (nbsd_nat_target *target, pid_t pid)
{
- auto fn
- = [&target] (ptid_t ptid)
+ auto fn = [&target] (ptid_t ptid) {
+ if (!in_thread_list (target, ptid))
{
- if (!in_thread_list (target, ptid))
- {
- if (inferior_ptid.lwp () == 0)
- thread_change_ptid (target, inferior_ptid, ptid);
- else
- add_thread (target, ptid);
- }
- };
+ if (inferior_ptid.lwp () == 0)
+ thread_change_ptid (target, inferior_ptid, ptid);
+ else
+ add_thread (target, ptid);
+ }
+ };
netbsd_nat::for_each_thread (pid, fn);
}
@@ -180,8 +179,8 @@ nbsd_nat_target::pid_to_str (ptid_t ptid)
static gdb::unique_xmalloc_ptr<struct kinfo_vmentry[]>
nbsd_kinfo_get_vmmap (pid_t pid, size_t *size)
{
- int mib[5] = {CTL_VM, VM_PROC, VM_PROC_MAP, pid,
- sizeof (struct kinfo_vmentry)};
+ int mib[5]
+ = { CTL_VM, VM_PROC, VM_PROC_MAP, pid, sizeof (struct kinfo_vmentry) };
size_t length = 0;
if (sysctl (mib, ARRAY_SIZE (mib), NULL, &length, NULL, 0))
@@ -195,8 +194,8 @@ nbsd_kinfo_get_vmmap (pid_t pid, size_t *size)
running process. */
length = length * 5 / 3;
- gdb::unique_xmalloc_ptr<struct kinfo_vmentry[]> kiv
- (XNEWVAR (kinfo_vmentry, length));
+ gdb::unique_xmalloc_ptr<struct kinfo_vmentry[]> kiv (XNEWVAR (kinfo_vmentry,
+ length));
if (sysctl (mib, ARRAY_SIZE (mib), kiv.get (), &length, NULL, 0))
{
@@ -222,7 +221,7 @@ nbsd_nat_target::find_memory_regions (find_memory_region_ftype func,
gdb::unique_xmalloc_ptr<struct kinfo_vmentry[]> vmentl
= nbsd_kinfo_get_vmmap (pid, &nitems);
if (vmentl == NULL)
- perror_with_name (_("Couldn't fetch VM map entries"));
+ perror_with_name (_ ("Couldn't fetch VM map entries"));
for (size_t i = 0; i < nitems; i++)
{
@@ -248,8 +247,7 @@ nbsd_nat_target::find_memory_regions (find_memory_region_ftype func,
size_t size = kve->kve_end - kve->kve_start;
if (info_verbose)
{
- gdb_printf ("Save segment, %ld bytes at %s (%c%c%c)\n",
- (long) size,
+ gdb_printf ("Save segment, %ld bytes at %s (%c%c%c)\n", (long) size,
paddress (target_gdbarch (), kve->kve_start),
kve->kve_protection & KVME_PROT_READ ? 'r' : '-',
kve->kve_protection & KVME_PROT_WRITE ? 'w' : '-',
@@ -308,7 +306,7 @@ nbsd_nat_target::info_proc (const char *args, enum info_proc_what what)
do_status = true;
break;
default:
- error (_("Not supported on this target."));
+ error (_ ("Not supported on this target."));
}
gdb_argv built_argv (args);
@@ -316,14 +314,14 @@ nbsd_nat_target::info_proc (const char *args, enum info_proc_what what)
{
pid = inferior_ptid.pid ();
if (pid == 0)
- error (_("No current process: you must name one."));
+ error (_ ("No current process: you must name one."));
}
else if (built_argv.count () == 1 && isdigit (built_argv[0][0]))
pid = strtol (built_argv[0], NULL, 10);
else
- error (_("Invalid arguments."));
+ error (_ ("Invalid arguments."));
- gdb_printf (_("process %d\n"), pid);
+ gdb_printf (_ ("process %d\n"), pid);
if (do_cmdline)
{
@@ -331,7 +329,7 @@ nbsd_nat_target::info_proc (const char *args, enum info_proc_what what)
if (cmdline != nullptr)
gdb_printf ("cmdline = '%s'\n", cmdline.get ());
else
- warning (_("unable to fetch command line"));
+ warning (_ ("unable to fetch command line"));
}
if (do_cwd)
{
@@ -339,7 +337,7 @@ nbsd_nat_target::info_proc (const char *args, enum info_proc_what what)
if (cwd != "")
gdb_printf ("cwd = '%s'\n", cwd.c_str ());
else
- warning (_("unable to fetch current working directory"));
+ warning (_ ("unable to fetch current working directory"));
}
if (do_exe)
{
@@ -347,7 +345,7 @@ nbsd_nat_target::info_proc (const char *args, enum info_proc_what what)
if (exe != nullptr)
gdb_printf ("exe = '%s'\n", exe);
else
- warning (_("unable to fetch executable path name"));
+ warning (_ ("unable to fetch executable path name"));
}
if (do_mappings)
{
@@ -368,39 +366,37 @@ nbsd_nat_target::info_proc (const char *args, enum info_proc_what what)
kve->kve_path);
}
else
- warning (_("unable to fetch virtual memory map"));
+ warning (_ ("unable to fetch virtual memory map"));
}
if (do_status)
{
struct kinfo_proc2 kp;
if (!nbsd_pid_to_kinfo_proc2 (pid, &kp))
- warning (_("Failed to fetch process information"));
+ warning (_ ("Failed to fetch process information"));
else
{
- auto process_status
- = [] (int8_t stat)
+ auto process_status = [] (int8_t stat) {
+ switch (stat)
{
- switch (stat)
- {
- case SIDL:
- return "IDL";
- case SACTIVE:
- return "ACTIVE";
- case SDYING:
- return "DYING";
- case SSTOP:
- return "STOP";
- case SZOMB:
- return "ZOMB";
- case SDEAD:
- return "DEAD";
- default:
- return "? (unknown)";
- }
- };
+ case SIDL:
+ return "IDL";
+ case SACTIVE:
+ return "ACTIVE";
+ case SDYING:
+ return "DYING";
+ case SSTOP:
+ return "STOP";
+ case SZOMB:
+ return "ZOMB";
+ case SDEAD:
+ return "DEAD";
+ default:
+ return "? (unknown)";
+ }
+ };
gdb_printf ("Name: %s\n", kp.p_comm);
- gdb_printf ("State: %s\n", process_status(kp.p_realstat));
+ gdb_printf ("State: %s\n", process_status (kp.p_realstat));
gdb_printf ("Parent process: %" PRId32 "\n", kp.p_ppid);
gdb_printf ("Process group: %" PRId32 "\n", kp.p__pgid);
gdb_printf ("Session id: %" PRId32 "\n", kp.p_sid);
@@ -421,10 +417,10 @@ nbsd_nat_target::info_proc (const char *args, enum info_proc_what what)
kp.p_uru_minflt);
gdb_printf ("Major faults (memory page faults): %" PRIu64 "\n",
kp.p_uru_majflt);
- gdb_printf ("utime: %" PRIu32 ".%06" PRIu32 "\n",
- kp.p_uutime_sec, kp.p_uutime_usec);
- gdb_printf ("stime: %" PRIu32 ".%06" PRIu32 "\n",
- kp.p_ustime_sec, kp.p_ustime_usec);
+ gdb_printf ("utime: %" PRIu32 ".%06" PRIu32 "\n", kp.p_uutime_sec,
+ kp.p_uutime_usec);
+ gdb_printf ("stime: %" PRIu32 ".%06" PRIu32 "\n", kp.p_ustime_sec,
+ kp.p_ustime_usec);
gdb_printf ("utime+stime, children: %" PRIu32 ".%06" PRIu32 "\n",
kp.p_uctime_sec, kp.p_uctime_usec);
gdb_printf ("'nice' value: %" PRIu8 "\n", kp.p_nice);
@@ -464,8 +460,8 @@ nbsd_nat_target::info_proc (const char *args, enum info_proc_what what)
give it that signal. */
static void
-nbsd_resume(nbsd_nat_target *target, ptid_t ptid, int step,
- enum gdb_signal signal)
+nbsd_resume (nbsd_nat_target *target, ptid_t ptid, int step,
+ enum gdb_signal signal)
{
int request;
@@ -505,7 +501,8 @@ nbsd_resume(nbsd_nat_target *target, ptid_t ptid, int step,
else
{
for (thread_info *tp : all_non_exited_threads (target, ptid))
- if (ptrace (PT_CLEARSTEP, tp->ptid.pid (), NULL, tp->ptid.lwp ()) == -1)
+ if (ptrace (PT_CLEARSTEP, tp->ptid.pid (), NULL, tp->ptid.lwp ())
+ == -1)
perror_with_name (("ptrace"));
}
@@ -517,7 +514,8 @@ nbsd_resume(nbsd_nat_target *target, ptid_t ptid, int step,
/* An address of (void *)1 tells ptrace to continue from
where it was. If GDB wanted it to start some other way, we have
already written a new program counter value to the child. */
- if (ptrace (request, ptid.pid (), (void *)1, gdb_signal_to_host (signal)) == -1)
+ if (ptrace (request, ptid.pid (), (void *) 1, gdb_signal_to_host (signal))
+ == -1)
perror_with_name (("ptrace"));
}
@@ -558,7 +556,7 @@ nbsd_wait (ptid_t ptid, struct target_waitstatus *ourstatus,
clear_sigint_trap ();
if (pid == -1)
- perror_with_name (_("Child process unexpectedly missing"));
+ perror_with_name (_ ("Child process unexpectedly missing"));
*ourstatus = host_status_to_waitstatus (status);
return pid;
@@ -620,14 +618,14 @@ nbsd_nat_target::wait (ptid_t ptid, struct target_waitstatus *ourstatus,
Ignore exited events for an unknown LWP. */
thread_info *thr = find_thread_ptid (this, wptid);
if (thr == nullptr)
- ourstatus->set_spurious ();
+ ourstatus->set_spurious ();
else
{
/* NetBSD does not store an LWP exit status. */
ourstatus->set_thread_exited (0);
if (print_thread_events)
- gdb_printf (_("[%s exited]\n"),
+ gdb_printf (_ ("[%s exited]\n"),
target_pid_to_str (wptid).c_str ());
delete_thread (thr);
}
@@ -640,7 +638,7 @@ nbsd_nat_target::wait (ptid_t ptid, struct target_waitstatus *ourstatus,
}
if (in_thread_list (this, ptid_t (pid)))
- thread_change_ptid (this, ptid_t (pid), wptid);
+ thread_change_ptid (this, ptid_t (pid), wptid);
if (code == TRAP_LWP && pst.pe_report_event == PTRACE_LWP_CREATE)
{
@@ -649,7 +647,7 @@ nbsd_nat_target::wait (ptid_t ptid, struct target_waitstatus *ourstatus,
not yet reported their PTRACE_LWP_CREATE event. Ignore
born events for an already-known LWP. */
if (in_thread_list (this, wptid))
- ourstatus->set_spurious ();
+ ourstatus->set_spurious ();
else
{
add_thread (this, wptid);
@@ -720,9 +718,9 @@ nbsd_nat_target::remove_exec_catchpoint (int pid)
/* Implement the "set_syscall_catchpoint" target_ops method. */
int
-nbsd_nat_target::set_syscall_catchpoint (int pid, bool needed,
- int any_count,
- gdb::array_view<const int> syscall_counts)
+nbsd_nat_target::set_syscall_catchpoint (
+ int pid, bool needed, int any_count,
+ gdb::array_view<const int> syscall_counts)
{
/* Ignore the arguments. inf-ptrace.c will use PT_SYSCALL which
will catch all system call entries and exits. The system calls
@@ -741,9 +739,8 @@ nbsd_nat_target::supports_multi_process ()
/* Implement the "xfer_partial" target_ops method. */
enum target_xfer_status
-nbsd_nat_target::xfer_partial (enum target_object object,
- const char *annex, gdb_byte *readbuf,
- const gdb_byte *writebuf,
+nbsd_nat_target::xfer_partial (enum target_object object, const char *annex,
+ gdb_byte *readbuf, const gdb_byte *writebuf,
ULONGEST offset, ULONGEST len,
ULONGEST *xfered_len)
{
@@ -753,8 +750,8 @@ nbsd_nat_target::xfer_partial (enum target_object object,
{
case TARGET_OBJECT_SIGNAL_INFO:
{
- len = netbsd_nat::qxfer_siginfo(pid, annex, readbuf, writebuf, offset,
- len);
+ len = netbsd_nat::qxfer_siginfo (pid, annex, readbuf, writebuf, offset,
+ len);
if (len == -1)
return TARGET_XFER_E_IO;
@@ -773,7 +770,8 @@ nbsd_nat_target::xfer_partial (enum target_object object,
if (res != 0)
{
if (res == EACCES)
- gdb_printf (gdb_stderr, "Cannot %s process at %s (%s). "
+ gdb_printf (gdb_stderr,
+ "Cannot %s process at %s (%s). "
"Is PaX MPROTECT active? See security(7), "
"sysctl(7), paxctl(8)\n",
(writebuf ? "write to" : "read from"),
@@ -786,9 +784,8 @@ nbsd_nat_target::xfer_partial (enum target_object object,
return TARGET_XFER_OK;
}
default:
- return inf_ptrace_target::xfer_partial (object, annex,
- readbuf, writebuf, offset,
- len, xfered_len);
+ return inf_ptrace_target::xfer_partial (object, annex, readbuf, writebuf,
+ offset, len, xfered_len);
}
}
@@ -807,7 +804,8 @@ nbsd_nat_target::dumpcore (const char *filename)
{
pid_t pid = inferior_ptid.pid ();
- if (ptrace (PT_DUMPCORE, pid, const_cast<char *>(filename),
- strlen (filename)) == -1)
+ if (ptrace (PT_DUMPCORE, pid, const_cast<char *> (filename),
+ strlen (filename))
+ == -1)
perror_with_name (("ptrace"));
}
diff --git a/gdb/netbsd-nat.h b/gdb/netbsd-nat.h
index 5dacd08049a..e9ca593a6bf 100644
--- a/gdb/netbsd-nat.h
+++ b/gdb/netbsd-nat.h
@@ -43,14 +43,13 @@ struct nbsd_nat_target : public inf_ptrace_target
ptid_t wait (ptid_t, struct target_waitstatus *, target_wait_flags) override;
int insert_exec_catchpoint (int pid) override;
int remove_exec_catchpoint (int pid) override;
- int set_syscall_catchpoint (int pid, bool needed, int any_count,
- gdb::array_view<const int> syscall_counts)
- override;
+ int
+ set_syscall_catchpoint (int pid, bool needed, int any_count,
+ gdb::array_view<const int> syscall_counts) override;
bool supports_multi_process () override;
enum target_xfer_status xfer_partial (enum target_object object,
- const char *annex,
- gdb_byte *readbuf,
+ const char *annex, gdb_byte *readbuf,
const gdb_byte *writebuf,
ULONGEST offset, ULONGEST len,
ULONGEST *xfered_len) override;
@@ -58,6 +57,7 @@ struct nbsd_nat_target : public inf_ptrace_target
void dumpcore (const char *filename) override;
protected:
+
void post_startup_inferior (ptid_t ptid) override;
};
diff --git a/gdb/netbsd-tdep.c b/gdb/netbsd-tdep.c
index 05f8d27f32d..e80dea8b506 100644
--- a/gdb/netbsd-tdep.c
+++ b/gdb/netbsd-tdep.c
@@ -30,19 +30,19 @@
/* Flags in the 'kve_protection' field in struct kinfo_vmentry. These
match the KVME_PROT_* constants in <sys/sysctl.h>. */
-#define KINFO_VME_PROT_READ 0x00000001
-#define KINFO_VME_PROT_WRITE 0x00000002
-#define KINFO_VME_PROT_EXEC 0x00000004
+#define KINFO_VME_PROT_READ 0x00000001
+#define KINFO_VME_PROT_WRITE 0x00000002
+#define KINFO_VME_PROT_EXEC 0x00000004
/* Flags in the 'kve_flags' field in struct kinfo_vmentry. These
match the KVME_FLAG_* constants in <sys/sysctl.h>. */
-#define KINFO_VME_FLAG_COW 0x00000001
-#define KINFO_VME_FLAG_NEEDS_COPY 0x00000002
-#define KINFO_VME_FLAG_NOCOREDUMP 0x00000004
-#define KINFO_VME_FLAG_PAGEABLE 0x00000008
-#define KINFO_VME_FLAG_GROWS_UP 0x00000010
-#define KINFO_VME_FLAG_GROWS_DOWN 0x00000020
+#define KINFO_VME_FLAG_COW 0x00000001
+#define KINFO_VME_FLAG_NEEDS_COPY 0x00000002
+#define KINFO_VME_FLAG_NOCOREDUMP 0x00000004
+#define KINFO_VME_FLAG_PAGEABLE 0x00000008
+#define KINFO_VME_FLAG_GROWS_UP 0x00000010
+#define KINFO_VME_FLAG_GROWS_DOWN 0x00000020
/* FIXME: kettenis/20060115: We should really eliminate the next two
functions completely. */
@@ -65,49 +65,48 @@ nbsd_pc_in_sigtramp (CORE_ADDR pc, const char *func_name)
/* Check for libc-provided signal trampoline. All such trampolines
have function names which begin with "__sigtramp". */
- return (func_name != NULL
- && startswith (func_name, "__sigtramp"));
+ return (func_name != NULL && startswith (func_name, "__sigtramp"));
}
/* This enum is derived from NETBSD's <sys/signal.h>. */
enum
- {
- NBSD_SIGHUP = 1,
- NBSD_SIGINT = 2,
- NBSD_SIGQUIT = 3,
- NBSD_SIGILL = 4,
- NBSD_SIGTRAP = 5,
- NBSD_SIGABRT = 6,
- NBSD_SIGEMT = 7,
- NBSD_SIGFPE = 8,
- NBSD_SIGKILL = 9,
- NBSD_SIGBUS = 10,
- NBSD_SIGSEGV = 11,
- NBSD_SIGSYS = 12,
- NBSD_SIGPIPE = 13,
- NBSD_SIGALRM = 14,
- NBSD_SIGTERM = 15,
- NBSD_SIGURG = 16,
- NBSD_SIGSTOP = 17,
- NBSD_SIGTSTP = 18,
- NBSD_SIGCONT = 19,
- NBSD_SIGCHLD = 20,
- NBSD_SIGTTIN = 21,
- NBSD_SIGTTOU = 22,
- NBSD_SIGIO = 23,
- NBSD_SIGXCPU = 24,
- NBSD_SIGXFSZ = 25,
- NBSD_SIGVTALRM = 26,
- NBSD_SIGPROF = 27,
- NBSD_SIGWINCH = 28,
- NBSD_SIGINFO = 29,
- NBSD_SIGUSR1 = 30,
- NBSD_SIGUSR2 = 31,
- NBSD_SIGPWR = 32,
- NBSD_SIGRTMIN = 33,
- NBSD_SIGRTMAX = 63,
- };
+{
+ NBSD_SIGHUP = 1,
+ NBSD_SIGINT = 2,
+ NBSD_SIGQUIT = 3,
+ NBSD_SIGILL = 4,
+ NBSD_SIGTRAP = 5,
+ NBSD_SIGABRT = 6,
+ NBSD_SIGEMT = 7,
+ NBSD_SIGFPE = 8,
+ NBSD_SIGKILL = 9,
+ NBSD_SIGBUS = 10,
+ NBSD_SIGSEGV = 11,
+ NBSD_SIGSYS = 12,
+ NBSD_SIGPIPE = 13,
+ NBSD_SIGALRM = 14,
+ NBSD_SIGTERM = 15,
+ NBSD_SIGURG = 16,
+ NBSD_SIGSTOP = 17,
+ NBSD_SIGTSTP = 18,
+ NBSD_SIGCONT = 19,
+ NBSD_SIGCHLD = 20,
+ NBSD_SIGTTIN = 21,
+ NBSD_SIGTTOU = 22,
+ NBSD_SIGIO = 23,
+ NBSD_SIGXCPU = 24,
+ NBSD_SIGXFSZ = 25,
+ NBSD_SIGVTALRM = 26,
+ NBSD_SIGPROF = 27,
+ NBSD_SIGWINCH = 28,
+ NBSD_SIGINFO = 29,
+ NBSD_SIGUSR1 = 30,
+ NBSD_SIGUSR2 = 31,
+ NBSD_SIGPWR = 32,
+ NBSD_SIGRTMIN = 33,
+ NBSD_SIGRTMAX = 63,
+};
/* Implement the "gdb_signal_from_target" gdbarch method. */
@@ -237,8 +236,7 @@ nbsd_gdb_signal_from_target (struct gdbarch *gdbarch, int signal)
/* Implement the "gdb_signal_to_target" gdbarch method. */
static int
-nbsd_gdb_signal_to_target (struct gdbarch *gdbarch,
- enum gdb_signal signal)
+nbsd_gdb_signal_to_target (struct gdbarch *gdbarch, enum gdb_signal signal)
{
switch (signal)
{
@@ -348,8 +346,7 @@ nbsd_gdb_signal_to_target (struct gdbarch *gdbarch,
return NBSD_SIGRTMAX;
}
- if (signal >= GDB_SIGNAL_REALTIME_34
- && signal <= GDB_SIGNAL_REALTIME_62)
+ if (signal >= GDB_SIGNAL_REALTIME_34 && signal <= GDB_SIGNAL_REALTIME_62)
{
int offset = signal - GDB_SIGNAL_REALTIME_32;
@@ -379,7 +376,7 @@ struct nbsd_gdbarch_data
};
static const registry<gdbarch>::key<nbsd_gdbarch_data>
- nbsd_gdbarch_data_handle;
+ nbsd_gdbarch_data_handle;
static struct nbsd_gdbarch_data *
get_nbsd_gdbarch_data (struct gdbarch *gdbarch)
@@ -430,8 +427,7 @@ nbsd_get_siginfo_type (struct gdbarch *gdbarch)
/* lwpid_t */
type *lwpid_type = arch_type (gdbarch, TYPE_CODE_TYPEDEF,
- int32_type->length () * char_bits,
- "lwpid_t");
+ int32_type->length () * char_bits, "lwpid_t");
lwpid_type->set_target_type (int32_type);
/* union sigval */
@@ -482,11 +478,9 @@ nbsd_get_siginfo_type (struct gdbarch *gdbarch)
/* _syscall */
t = arch_composite_type (gdbarch, NULL, TYPE_CODE_STRUCT);
append_composite_type_field (t, "_sysnum", int_type);
- append_composite_type_field (t, "_retval",
- init_vector_type (int_type, 2));
+ append_composite_type_field (t, "_retval", init_vector_type (int_type, 2));
append_composite_type_field (t, "_error", int_type);
- append_composite_type_field (t, "_args",
- init_vector_type (uint64_type, 8));
+ append_composite_type_field (t, "_args", init_vector_type (uint64_type, 8));
append_composite_type_field (reason_type, "_syscall", t);
/* _ptrace_state */
@@ -522,19 +516,15 @@ nbsd_get_siginfo_type (struct gdbarch *gdbarch)
void
nbsd_info_proc_mappings_header (int addr_bit)
{
- gdb_printf (_("Mapped address spaces:\n\n"));
+ gdb_printf (_ ("Mapped address spaces:\n\n"));
if (addr_bit == 64)
{
- gdb_printf (" %18s %18s %10s %10s %9s %s\n",
- "Start Addr",
- " End Addr",
+ gdb_printf (" %18s %18s %10s %10s %9s %s\n", "Start Addr", " End Addr",
" Size", " Offset", "Flags ", "File");
}
else
{
- gdb_printf ("\t%10s %10s %10s %10s %9s %s\n",
- "Start Addr",
- " End Addr",
+ gdb_printf ("\t%10s %10s %10s %10s %9s %s\n", "Start Addr", " End Addr",
" Size", " Offset", "Flags ", "File");
}
}
@@ -554,8 +544,9 @@ nbsd_vm_map_entry_flags (int kve_flags, int kve_protection)
vm_flags[4] = (kve_flags & KINFO_VME_FLAG_COW) ? 'C' : '-';
vm_flags[5] = (kve_flags & KINFO_VME_FLAG_NEEDS_COPY) ? 'N' : '-';
vm_flags[6] = (kve_flags & KINFO_VME_FLAG_PAGEABLE) ? 'P' : '-';
- vm_flags[7] = (kve_flags & KINFO_VME_FLAG_GROWS_UP) ? 'U'
- : (kve_flags & KINFO_VME_FLAG_GROWS_DOWN) ? 'D' : '-';
+ vm_flags[7] = (kve_flags & KINFO_VME_FLAG_GROWS_UP) ? 'U'
+ : (kve_flags & KINFO_VME_FLAG_GROWS_DOWN) ? 'D'
+ : '-';
vm_flags[8] = '\0';
return vm_flags;
@@ -569,20 +560,16 @@ nbsd_info_proc_mappings_entry (int addr_bit, ULONGEST kve_start,
{
if (addr_bit == 64)
{
- gdb_printf (" %18s %18s %10s %10s %9s %s\n",
- hex_string (kve_start),
- hex_string (kve_end),
- hex_string (kve_end - kve_start),
+ gdb_printf (" %18s %18s %10s %10s %9s %s\n", hex_string (kve_start),
+ hex_string (kve_end), hex_string (kve_end - kve_start),
hex_string (kve_offset),
nbsd_vm_map_entry_flags (kve_flags, kve_protection),
kve_path);
}
else
{
- gdb_printf ("\t%10s %10s %10s %10s %9s %s\n",
- hex_string (kve_start),
- hex_string (kve_end),
- hex_string (kve_end - kve_start),
+ gdb_printf ("\t%10s %10s %10s %10s %9s %s\n", hex_string (kve_start),
+ hex_string (kve_end), hex_string (kve_end - kve_start),
hex_string (kve_offset),
nbsd_vm_map_entry_flags (kve_flags, kve_protection),
kve_path);
@@ -594,14 +581,13 @@ nbsd_info_proc_mappings_entry (int addr_bit, ULONGEST kve_start,
static LONGEST
nbsd_get_syscall_number (struct gdbarch *gdbarch, thread_info *thread)
{
-
/* NetBSD doesn't use gdbarch_get_syscall_number since NetBSD
native targets fetch the system call number from the
'si_sysnum' member of siginfo_t in nbsd_nat_target::wait.
However, system call catching requires this function to be
set. */
- internal_error (_("nbsd_get_sycall_number called"));
+ internal_error (_ ("nbsd_get_sycall_number called"));
}
/* See netbsd-tdep.h. */
diff --git a/gdb/netbsd-tdep.h b/gdb/netbsd-tdep.h
index ab13e628d58..4a440b37a8d 100644
--- a/gdb/netbsd-tdep.h
+++ b/gdb/netbsd-tdep.h
@@ -43,8 +43,8 @@ extern void nbsd_info_proc_mappings_header (int addr_bit);
extern void nbsd_info_proc_mappings_entry (int addr_bit, ULONGEST kve_start,
ULONGEST kve_end,
- ULONGEST kve_offset,
- int kve_flags, int kve_protection,
+ ULONGEST kve_offset, int kve_flags,
+ int kve_protection,
const char *kve_path);
#endif /* NBSD_TDEP_H */
diff --git a/gdb/nios2-linux-tdep.c b/gdb/nios2-linux-tdep.c
index fb9e88326fb..6c03623fc67 100644
--- a/gdb/nios2-linux-tdep.c
+++ b/gdb/nios2-linux-tdep.c
@@ -37,16 +37,14 @@
registers appear in core files, which corresponds to the order
of the register slots in the kernel's struct pt_regs. */
-static const int reg_offsets[NIOS2_NUM_REGS] =
-{
- -1, 8, 9, 10, 11, 12, 13, 14, /* r0 - r7 */
- 0, 1, 2, 3, 4, 5, 6, 7, /* r8 - r15 */
- 23, 24, 25, 26, 27, 28, 29, 30, /* r16 - r23 */
- -1, -1, 19, 18, 17, 21, -1, 16, /* et bt gp sp fp ea sstatus ra */
- 21, /* pc */
- -1, 20, -1, -1, -1, -1, -1, -1, /* status estatus ... */
- -1, -1, -1, -1, -1, -1, -1, -1
-};
+static const int reg_offsets[NIOS2_NUM_REGS]
+ = { -1, 8, 9, 10, 11, 12, 13, 14, /* r0 - r7 */
+ 0, 1, 2, 3, 4, 5, 6, 7, /* r8 - r15 */
+ 23, 24, 25, 26, 27, 28, 29, 30, /* r16 - r23 */
+ -1, -1, 19, 18, 17, 21, -1, 16, /* et bt gp sp fp ea sstatus ra */
+ 21, /* pc */
+ -1, 20, -1, -1, -1, -1, -1, -1, /* status estatus ... */
+ -1, -1, -1, -1, -1, -1, -1, -1 };
/* General register set size. Should match sizeof (struct pt_regs) +
sizeof (struct switch_stack) from the NIOS2 Linux kernel patch. */
@@ -56,13 +54,12 @@ static const int reg_offsets[NIOS2_NUM_REGS] =
/* Implement the supply_regset hook for core files. */
static void
-nios2_supply_gregset (const struct regset *regset,
- struct regcache *regcache,
+nios2_supply_gregset (const struct regset *regset, struct regcache *regcache,
int regnum, const void *gregs_buf, size_t len)
{
const gdb_byte *gregs = (const gdb_byte *) gregs_buf;
int regno;
- static const gdb_byte zero_buf[4] = {0, 0, 0, 0};
+ static const gdb_byte zero_buf[4] = { 0, 0, 0, 0 };
for (regno = NIOS2_Z_REGNUM; regno <= NIOS2_MPUACC_REGNUM; regno++)
if (regnum == -1 || regnum == regno)
@@ -78,8 +75,8 @@ nios2_supply_gregset (const struct regset *regset,
static void
nios2_collect_gregset (const struct regset *regset,
- const struct regcache *regcache,
- int regnum, void *gregs_buf, size_t len)
+ const struct regcache *regcache, int regnum,
+ void *gregs_buf, size_t len)
{
gdb_byte *gregs = (gdb_byte *) gregs_buf;
int regno;
@@ -92,12 +89,8 @@ nios2_collect_gregset (const struct regset *regset,
}
}
-static const struct regset nios2_core_regset =
-{
- NULL,
- nios2_supply_gregset,
- nios2_collect_gregset
-};
+static const struct regset nios2_core_regset
+ = { NULL, nios2_supply_gregset, nios2_collect_gregset };
/* Iterate over core file register note sections. */
@@ -159,29 +152,23 @@ nios2_linux_rt_sigreturn_init (const struct tramp_frame *self,
trap 0
appropriately encoded for R1 or R2. */
-static struct tramp_frame nios2_r1_linux_rt_sigreturn_tramp_frame =
-{
+static struct tramp_frame nios2_r1_linux_rt_sigreturn_tramp_frame = {
SIGTRAMP_FRAME,
4,
- {
- { MATCH_R1_MOVI | SET_IW_I_B (2) | SET_IW_I_IMM16 (139), ULONGEST_MAX },
- { MATCH_R1_TRAP | SET_IW_R_IMM5 (0), ULONGEST_MAX},
- { TRAMP_SENTINEL_INSN }
- },
+ { { MATCH_R1_MOVI | SET_IW_I_B (2) | SET_IW_I_IMM16 (139), ULONGEST_MAX },
+ { MATCH_R1_TRAP | SET_IW_R_IMM5 (0), ULONGEST_MAX },
+ { TRAMP_SENTINEL_INSN } },
nios2_linux_rt_sigreturn_init
};
-static struct tramp_frame nios2_r2_linux_rt_sigreturn_tramp_frame =
-{
- SIGTRAMP_FRAME,
- 4,
- {
- { MATCH_R2_MOVI | SET_IW_F2I16_B (2) | SET_IW_F2I16_IMM16 (139), ULONGEST_MAX },
- { MATCH_R2_TRAP | SET_IW_X2L5_IMM5 (0), ULONGEST_MAX},
- { TRAMP_SENTINEL_INSN }
- },
- nios2_linux_rt_sigreturn_init
-};
+static struct tramp_frame nios2_r2_linux_rt_sigreturn_tramp_frame
+ = { SIGTRAMP_FRAME,
+ 4,
+ { { MATCH_R2_MOVI | SET_IW_F2I16_B (2) | SET_IW_F2I16_IMM16 (139),
+ ULONGEST_MAX },
+ { MATCH_R2_TRAP | SET_IW_X2L5_IMM5 (0), ULONGEST_MAX },
+ { TRAMP_SENTINEL_INSN } },
+ nios2_linux_rt_sigreturn_init };
/* When FRAME is at a syscall instruction, return the PC of the next
instruction to be executed. */
@@ -231,8 +218,8 @@ nios2_linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
set_gdbarch_fetch_tls_load_module_address (gdbarch,
svr4_fetch_objfile_link_map);
/* Core file support. */
- set_gdbarch_iterate_over_regset_sections
- (gdbarch, nios2_iterate_over_regset_sections);
+ set_gdbarch_iterate_over_regset_sections (
+ gdbarch, nios2_iterate_over_regset_sections);
/* Linux signal frame unwinders. */
if (gdbarch_bfd_arch_info (gdbarch)->mach == bfd_mach_nios2r2)
tramp_frame_prepend_unwinder (gdbarch,
@@ -249,15 +236,14 @@ nios2_linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
}
void _initialize_nios2_linux_tdep ();
+
void
_initialize_nios2_linux_tdep ()
{
-
const struct bfd_arch_info *arch_info;
- for (arch_info = bfd_lookup_arch (bfd_arch_nios2, 0);
- arch_info != NULL;
+ for (arch_info = bfd_lookup_arch (bfd_arch_nios2, 0); arch_info != NULL;
arch_info = arch_info->next)
- gdbarch_register_osabi (bfd_arch_nios2, arch_info->mach,
- GDB_OSABI_LINUX, nios2_linux_init_abi);
+ gdbarch_register_osabi (bfd_arch_nios2, arch_info->mach, GDB_OSABI_LINUX,
+ nios2_linux_init_abi);
}
diff --git a/gdb/nios2-tdep.c b/gdb/nios2-tdep.c
index de61c9c2370..38b3a74dca9 100644
--- a/gdb/nios2-tdep.c
+++ b/gdb/nios2-tdep.c
@@ -103,41 +103,59 @@ struct nios2_unwind_cache
struct reg_saved reg_saved[NIOS2_NUM_REGS];
};
-
/* This array is a mapping from Dwarf-2 register numbering to GDB's. */
-static int nios2_dwarf2gdb_regno_map[] =
-{
- 0, 1, 2, 3,
- 4, 5, 6, 7,
- 8, 9, 10, 11,
- 12, 13, 14, 15,
- 16, 17, 18, 19,
- 20, 21, 22, 23,
- 24, 25,
- NIOS2_GP_REGNUM, /* 26 */
- NIOS2_SP_REGNUM, /* 27 */
- NIOS2_FP_REGNUM, /* 28 */
- NIOS2_EA_REGNUM, /* 29 */
- NIOS2_BA_REGNUM, /* 30 */
- NIOS2_RA_REGNUM, /* 31 */
- NIOS2_PC_REGNUM, /* 32 */
- NIOS2_STATUS_REGNUM, /* 33 */
- NIOS2_ESTATUS_REGNUM, /* 34 */
- NIOS2_BSTATUS_REGNUM, /* 35 */
- NIOS2_IENABLE_REGNUM, /* 36 */
- NIOS2_IPENDING_REGNUM, /* 37 */
- NIOS2_CPUID_REGNUM, /* 38 */
- 39, /* CTL6 */ /* 39 */
+static int nios2_dwarf2gdb_regno_map[] = {
+ 0,
+ 1,
+ 2,
+ 3,
+ 4,
+ 5,
+ 6,
+ 7,
+ 8,
+ 9,
+ 10,
+ 11,
+ 12,
+ 13,
+ 14,
+ 15,
+ 16,
+ 17,
+ 18,
+ 19,
+ 20,
+ 21,
+ 22,
+ 23,
+ 24,
+ 25,
+ NIOS2_GP_REGNUM, /* 26 */
+ NIOS2_SP_REGNUM, /* 27 */
+ NIOS2_FP_REGNUM, /* 28 */
+ NIOS2_EA_REGNUM, /* 29 */
+ NIOS2_BA_REGNUM, /* 30 */
+ NIOS2_RA_REGNUM, /* 31 */
+ NIOS2_PC_REGNUM, /* 32 */
+ NIOS2_STATUS_REGNUM, /* 33 */
+ NIOS2_ESTATUS_REGNUM, /* 34 */
+ NIOS2_BSTATUS_REGNUM, /* 35 */
+ NIOS2_IENABLE_REGNUM, /* 36 */
+ NIOS2_IPENDING_REGNUM, /* 37 */
+ NIOS2_CPUID_REGNUM, /* 38 */
+ 39,
+ /* CTL6 */ /* 39 */
NIOS2_EXCEPTION_REGNUM, /* 40 */
- NIOS2_PTEADDR_REGNUM, /* 41 */
- NIOS2_TLBACC_REGNUM, /* 42 */
- NIOS2_TLBMISC_REGNUM, /* 43 */
- NIOS2_ECCINJ_REGNUM, /* 44 */
- NIOS2_BADADDR_REGNUM, /* 45 */
- NIOS2_CONFIG_REGNUM, /* 46 */
- NIOS2_MPUBASE_REGNUM, /* 47 */
- NIOS2_MPUACC_REGNUM /* 48 */
+ NIOS2_PTEADDR_REGNUM, /* 41 */
+ NIOS2_TLBACC_REGNUM, /* 42 */
+ NIOS2_TLBMISC_REGNUM, /* 43 */
+ NIOS2_ECCINJ_REGNUM, /* 44 */
+ NIOS2_BADADDR_REGNUM, /* 45 */
+ NIOS2_CONFIG_REGNUM, /* 46 */
+ NIOS2_MPUBASE_REGNUM, /* 47 */
+ NIOS2_MPUACC_REGNUM /* 48 */
};
gdb_static_assert (ARRAY_SIZE (nios2_dwarf2gdb_regno_map) == NIOS2_NUM_REGS);
@@ -155,18 +173,16 @@ nios2_dwarf_reg_to_regnum (struct gdbarch *gdbarch, int dw_reg)
/* Canonical names for the 49 registers. */
-static const char *const nios2_reg_names[NIOS2_NUM_REGS] =
-{
- "zero", "at", "r2", "r3", "r4", "r5", "r6", "r7",
- "r8", "r9", "r10", "r11", "r12", "r13", "r14", "r15",
- "r16", "r17", "r18", "r19", "r20", "r21", "r22", "r23",
- "et", "bt", "gp", "sp", "fp", "ea", "sstatus", "ra",
- "pc",
- "status", "estatus", "bstatus", "ienable",
- "ipending", "cpuid", "ctl6", "exception",
- "pteaddr", "tlbacc", "tlbmisc", "eccinj",
- "badaddr", "config", "mpubase", "mpuacc"
-};
+static const char *const nios2_reg_names[NIOS2_NUM_REGS]
+ = { "zero", "at", "r2", "r3", "r4", "r5",
+ "r6", "r7", "r8", "r9", "r10", "r11",
+ "r12", "r13", "r14", "r15", "r16", "r17",
+ "r18", "r19", "r20", "r21", "r22", "r23",
+ "et", "bt", "gp", "sp", "fp", "ea",
+ "sstatus", "ra", "pc", "status", "estatus", "bstatus",
+ "ienable", "ipending", "cpuid", "ctl6", "exception", "pteaddr",
+ "tlbacc", "tlbmisc", "eccinj", "badaddr", "config", "mpubase",
+ "mpuacc" };
/* Implement the register_name gdbarch method. */
@@ -240,7 +256,6 @@ nios2_store_return_value (struct gdbarch *gdbarch, struct type *valtype,
}
}
-
/* Set up the default values of the registers. */
static void
@@ -251,12 +266,12 @@ nios2_setup_default (struct nios2_unwind_cache *cache)
for (i = 0; i < NIOS2_NUM_REGS; i++)
{
/* All registers start off holding their previous values. */
- cache->reg_value[i].reg = i;
+ cache->reg_value[i].reg = i;
cache->reg_value[i].offset = 0;
/* All registers start off not saved. */
cache->reg_saved[i].basereg = -1;
- cache->reg_saved[i].addr = 0;
+ cache->reg_saved[i].addr = 0;
}
}
@@ -277,8 +292,7 @@ nios2_init_cache (struct nios2_unwind_cache *cache, CORE_ADDR pc)
pointer or NULL if the memory couldn't be read or disassembled. */
static const struct nios2_opcode *
-nios2_fetch_insn (struct gdbarch *gdbarch, CORE_ADDR pc,
- unsigned int *insnp)
+nios2_fetch_insn (struct gdbarch *gdbarch, CORE_ADDR pc, unsigned int *insnp)
{
LONGEST memword;
unsigned long mach = gdbarch_bfd_arch_info (gdbarch)->mach;
@@ -286,8 +300,8 @@ nios2_fetch_insn (struct gdbarch *gdbarch, CORE_ADDR pc,
if (mach == bfd_mach_nios2r2)
{
- if (!safe_read_memory_integer (pc, NIOS2_OPCODE_SIZE,
- BFD_ENDIAN_LITTLE, &memword)
+ if (!safe_read_memory_integer (pc, NIOS2_OPCODE_SIZE, BFD_ENDIAN_LITTLE,
+ &memword)
&& !safe_read_memory_integer (pc, NIOS2_CDX_OPCODE_SIZE,
BFD_ENDIAN_LITTLE, &memword))
return NULL;
@@ -302,7 +316,6 @@ nios2_fetch_insn (struct gdbarch *gdbarch, CORE_ADDR pc,
return nios2_find_opcode_hash (insn, mach);
}
-
/* Match and disassemble an ADD-type instruction, with 3 register operands.
Returns true on success, and fills in the operand pointers. */
@@ -412,7 +425,7 @@ nios2_match_addi (uint32_t insn, const struct nios2_opcode *op,
*rb = nios2_r2_reg3_mappings[GET_IW_T2X1I3_B3 (insn)];
*imm = nios2_r2_asi_n_mappings[GET_IW_T2X1I3_IMM3 (insn)];
if (op->match == MATCH_R2_SUBI_N)
- *imm = - (*imm);
+ *imm = -(*imm);
return 1;
}
else if (op->match == MATCH_R2_SPADDI_N)
@@ -428,7 +441,7 @@ nios2_match_addi (uint32_t insn, const struct nios2_opcode *op,
*rb = NIOS2_SP_REGNUM;
*imm = GET_IW_X1I7_IMM7 (insn) << 2;
if (op->match == MATCH_R2_SPDECI_N)
- *imm = - (*imm);
+ *imm = -(*imm);
return 1;
}
return 0;
@@ -601,8 +614,8 @@ nios2_match_rdctl (uint32_t insn, const struct nios2_opcode *op,
static int
nios2_match_stwm (uint32_t insn, const struct nios2_opcode *op,
- unsigned long mach, unsigned int *reglist,
- int *ra, int *imm, int *wb, int *id)
+ unsigned long mach, unsigned int *reglist, int *ra, int *imm,
+ int *wb, int *id)
{
int is_r2 = (mach == bfd_mach_nios2r2);
@@ -651,8 +664,8 @@ nios2_match_stwm (uint32_t insn, const struct nios2_opcode *op,
static int
nios2_match_ldwm (uint32_t insn, const struct nios2_opcode *op,
- unsigned long mach, unsigned int *reglist,
- int *ra, int *imm, int *wb, int *id, int *ret)
+ unsigned long mach, unsigned int *reglist, int *ra, int *imm,
+ int *wb, int *id, int *ret)
{
int is_r2 = (mach == bfd_mach_nios2r2);
@@ -702,7 +715,8 @@ nios2_match_ldwm (uint32_t insn, const struct nios2_opcode *op,
2 register operands and one immediate operand.
Returns true on success, and fills in the operand pointers. */
-enum branch_condition {
+enum branch_condition
+{
branch_none,
branch_eq,
branch_ne,
@@ -711,7 +725,7 @@ enum branch_condition {
branch_lt,
branch_ltu
};
-
+
static int
nios2_match_branch (uint32_t insn, const struct nios2_opcode *op,
unsigned long mach, int *ra, int *rb, int *imm,
@@ -943,7 +957,7 @@ nios2_match_callr (uint32_t insn, const struct nios2_opcode *op,
static int
nios2_match_break (uint32_t insn, const struct nios2_opcode *op,
- unsigned long mach, unsigned int *uimm)
+ unsigned long mach, unsigned int *uimm)
{
int is_r2 = (mach == bfd_mach_nios2r2);
@@ -1004,8 +1018,7 @@ nios2_match_trap (uint32_t insn, const struct nios2_opcode *op,
started before current_pc, not whether it has completed. */
static int
-nios2_in_epilogue_p (struct gdbarch *gdbarch,
- CORE_ADDR current_pc,
+nios2_in_epilogue_p (struct gdbarch *gdbarch, CORE_ADDR current_pc,
CORE_ADDR start_pc)
{
unsigned long mach = gdbarch_bfd_arch_info (gdbarch)->mach;
@@ -1032,7 +1045,7 @@ nios2_in_epilogue_p (struct gdbarch *gdbarch,
sure is to scan through from the beginning of the function,
disassembling as we go. */
if (is_r2)
- for (pc = start_pc; ; )
+ for (pc = start_pc;;)
{
op = nios2_fetch_insn (gdbarch, pc, &insn);
if (op == NULL)
@@ -1045,8 +1058,7 @@ nios2_in_epilogue_p (struct gdbarch *gdbarch,
the branch offset is relative to the next instruction,
it's correct to do this after incrementing the pc above. */
if (nios2_match_branch (insn, op, mach, &ra, &rb, &imm, &cond)
- && imm > 0
- && pc + imm < current_pc)
+ && imm > 0 && pc + imm < current_pc)
pc += imm;
}
/* Otherwise just go back to the previous 32-bit insn. */
@@ -1079,8 +1091,8 @@ nios2_in_epilogue_p (struct gdbarch *gdbarch,
ok = (rc == NIOS2_SP_REGNUM);
else if (nios2_match_ldw (insn, op, mach, &ra, &rb, &imm))
ok = (rb == NIOS2_SP_REGNUM);
- else if (nios2_match_ldwm (insn, op, mach, &uimm, &ra,
- &imm, &wb, &ret, &id))
+ else if (nios2_match_ldwm (insn, op, mach, &uimm, &ra, &imm, &wb, &ret,
+ &id))
ok = (ra == NIOS2_SP_REGNUM && wb && id);
if (!ok)
break;
@@ -1222,10 +1234,8 @@ nios2_analyze_prologue (struct gdbarch *gdbarch, const CORE_ADDR start_pc,
int innermost = (this_frame ? (frame_relative_level (this_frame) == 0) : 1);
if (nios2_debug)
- gdb_printf (gdb_stdlog,
- "{ nios2_analyze_prologue start=%s, current=%s ",
- paddress (gdbarch, start_pc),
- paddress (gdbarch, current_pc));
+ gdb_printf (gdb_stdlog, "{ nios2_analyze_prologue start=%s, current=%s ",
+ paddress (gdbarch, start_pc), paddress (gdbarch, current_pc));
/* Set up the default values of the registers. */
nios2_setup_default (cache);
@@ -1275,8 +1285,7 @@ nios2_analyze_prologue (struct gdbarch *gdbarch, const CORE_ADDR start_pc,
if (nios2_match_add (insn, op, mach, &ra, &rb, &rc))
{
/* ADD rc, ra, rb (also used for MOV) */
- if (rc == NIOS2_SP_REGNUM
- && rb == 0
+ if (rc == NIOS2_SP_REGNUM && rb == 0
&& value[ra].reg == cache->reg_saved[NIOS2_SP_REGNUM].basereg)
{
/* If the previous value of SP is available somewhere
@@ -1285,7 +1294,7 @@ nios2_analyze_prologue (struct gdbarch *gdbarch, const CORE_ADDR start_pc,
/* If any registers were saved on the stack before then
we can't backtrace into them now. */
- for (int i = 0 ; i < NIOS2_NUM_REGS ; i++)
+ for (int i = 0; i < NIOS2_NUM_REGS; i++)
{
if (cache->reg_saved[i].basereg == NIOS2_SP_REGNUM)
cache->reg_saved[i].basereg = -1;
@@ -1298,8 +1307,7 @@ nios2_analyze_prologue (struct gdbarch *gdbarch, const CORE_ADDR start_pc,
with that. */
value[NIOS2_SP_REGNUM].reg = NIOS2_SP_REGNUM;
value[NIOS2_SP_REGNUM].offset
- = (value[ra].offset
- - cache->reg_saved[NIOS2_SP_REGNUM].addr
+ = (value[ra].offset - cache->reg_saved[NIOS2_SP_REGNUM].addr
- 4);
cache->reg_saved[NIOS2_SP_REGNUM].basereg = NIOS2_SP_REGNUM;
cache->reg_saved[NIOS2_SP_REGNUM].addr = -4;
@@ -1326,7 +1334,7 @@ nios2_analyze_prologue (struct gdbarch *gdbarch, const CORE_ADDR start_pc,
if (rc == NIOS2_SP_REGNUM || rc == NIOS2_FP_REGNUM)
prologue_end = pc;
}
-
+
else if (nios2_match_sub (insn, op, mach, &ra, &rb, &rc))
{
/* SUB rc, ra, rb */
@@ -1360,7 +1368,7 @@ nios2_analyze_prologue (struct gdbarch *gdbarch, const CORE_ADDR start_pc,
if (rb != 0)
{
- value[rb].reg = value[ra].reg;
+ value[rb].reg = value[ra].reg;
value[rb].offset = value[ra].offset + imm;
}
@@ -1375,7 +1383,7 @@ nios2_analyze_prologue (struct gdbarch *gdbarch, const CORE_ADDR start_pc,
/* ORHI rb, ra, uimm (also used for MOVHI) */
if (rb != 0)
{
- value[rb].reg = (value[ra].reg == 0) ? 0 : -1;
+ value[rb].reg = (value[ra].reg == 0) ? 0 : -1;
value[rb].offset = value[ra].offset | (uimm << 16);
}
}
@@ -1399,9 +1407,9 @@ nios2_analyze_prologue (struct gdbarch *gdbarch, const CORE_ADDR start_pc,
cache->reg_saved[orig].basereg = value[ra].reg;
cache->reg_saved[orig].addr = value[ra].offset + imm;
}
-
+
prologue_end = pc;
-
+
if (orig == NIOS2_EA_REGNUM || orig == NIOS2_ESTATUS_REGNUM)
exception_handler = 1;
}
@@ -1410,8 +1418,8 @@ nios2_analyze_prologue (struct gdbarch *gdbarch, const CORE_ADDR start_pc,
break;
}
- else if (nios2_match_stwm (insn, op, mach,
- &reglist, &ra, &imm, &wb, &id))
+ else if (nios2_match_stwm (insn, op, mach, &reglist, &ra, &imm, &wb,
+ &id))
{
/* PUSH.N {reglist}, adjust
or
@@ -1427,7 +1435,7 @@ nios2_analyze_prologue (struct gdbarch *gdbarch, const CORE_ADDR start_pc,
if (reglist & (1 << i))
{
int orig = value[i].reg;
-
+
off += 4;
if (orig > 0 && value[i].offset == 0 && pc < current_pc)
{
@@ -1452,15 +1460,14 @@ nios2_analyze_prologue (struct gdbarch *gdbarch, const CORE_ADDR start_pc,
a subsequent save to the stack frame. */
if (rc != 0)
{
- value[rc].reg = NIOS2_STATUS_REGNUM + ra;
+ value[rc].reg = NIOS2_STATUS_REGNUM + ra;
value[rc].offset = 0;
}
}
else if (nios2_match_calli (insn, op, mach, &uimm))
{
- if (value[8].reg == NIOS2_RA_REGNUM
- && value[8].offset == 0
+ if (value[8].reg == NIOS2_RA_REGNUM && value[8].offset == 0
&& value[NIOS2_SP_REGNUM].reg == NIOS2_SP_REGNUM
&& value[NIOS2_SP_REGNUM].offset == 0)
{
@@ -1468,9 +1475,9 @@ nios2_analyze_prologue (struct gdbarch *gdbarch, const CORE_ADDR start_pc,
if ra has been stored into r8 beforehand and if it's
before the stack adjust.
Note mcount corrupts r2-r3, r9-r15 & ra. */
- for (int i = 2 ; i <= 3 ; i++)
+ for (int i = 2; i <= 3; i++)
value[i].reg = -1;
- for (int i = 9 ; i <= 15 ; i++)
+ for (int i = 9; i <= 15; i++)
value[i].reg = -1;
value[NIOS2_RA_REGNUM].reg = -1;
@@ -1528,8 +1535,8 @@ nios2_analyze_prologue (struct gdbarch *gdbarch, const CORE_ADDR start_pc,
else if (nios2_match_callr (insn, op, mach, &ra)
|| nios2_match_jmpr (insn, op, mach, &ra)
|| nios2_match_jmpi (insn, op, mach, &uimm)
- || (nios2_match_ldwm (insn, op, mach, &reglist, &ra,
- &imm, &wb, &id, &ret)
+ || (nios2_match_ldwm (insn, op, mach, &reglist, &ra, &imm, &wb,
+ &id, &ret)
&& ret)
|| nios2_match_trap (insn, op, mach, &uimm)
|| nios2_match_break (insn, op, mach, &uimm))
@@ -1598,13 +1605,13 @@ nios2_analyze_prologue (struct gdbarch *gdbarch, const CORE_ADDR start_pc,
if (ra == current_pc)
{
if (nios2_debug)
- gdb_printf
- (gdb_stdlog,
- "<noreturn ADJUST %s, r31@r%d+?>, r%d@r%d+?> }\n",
- paddress (gdbarch, cache->reg_value[base_reg].offset),
- cache->reg_saved[NIOS2_RA_REGNUM].basereg,
- cache->return_regnum,
- cache->reg_saved[cache->return_regnum].basereg);
+ gdb_printf (gdb_stdlog,
+ "<noreturn ADJUST %s, r31@r%d+?>, r%d@r%d+?> }\n",
+ paddress (gdbarch,
+ cache->reg_value[base_reg].offset),
+ cache->reg_saved[NIOS2_RA_REGNUM].basereg,
+ cache->return_regnum,
+ cache->reg_saved[cache->return_regnum].basereg);
return 0;
}
}
@@ -1630,10 +1637,10 @@ nios2_analyze_prologue (struct gdbarch *gdbarch, const CORE_ADDR start_pc,
for (int i = 0; i < NIOS2_NUM_REGS; i++)
if (cache->reg_saved[i].basereg == NIOS2_GP_REGNUM)
{
- CORE_ADDR gp = get_frame_register_unsigned (this_frame,
- NIOS2_GP_REGNUM);
+ CORE_ADDR gp
+ = get_frame_register_unsigned (this_frame, NIOS2_GP_REGNUM);
- for ( ; i < NIOS2_NUM_REGS; i++)
+ for (; i < NIOS2_NUM_REGS; i++)
if (cache->reg_saved[i].basereg == NIOS2_GP_REGNUM)
{
cache->reg_saved[i].basereg = NIOS2_Z_REGNUM;
@@ -1660,8 +1667,7 @@ nios2_analyze_prologue (struct gdbarch *gdbarch, const CORE_ADDR start_pc,
}
if (nios2_debug)
- gdb_printf (gdb_stdlog, "cfa=%s }\n",
- paddress (gdbarch, cache->cfa));
+ gdb_printf (gdb_stdlog, "cfa=%s }\n", paddress (gdbarch, cache->cfa));
return prologue_end;
}
@@ -1719,7 +1725,7 @@ nios2_breakpoint_kind_from_pc (struct gdbarch *gdbarch, CORE_ADDR *pcptr)
static const gdb_byte *
nios2_sw_breakpoint_from_kind (struct gdbarch *gdbarch, int kind, int *size)
{
-/* The Nios II ABI for Linux says: "Userspace programs should not use
+ /* The Nios II ABI for Linux says: "Userspace programs should not use
the break instruction and userspace debuggers should not insert
one." and "Userspace breakpoints are accomplished using the trap
instruction with immediate operand 31 (all ones)."
@@ -1738,7 +1744,7 @@ nios2_sw_breakpoint_from_kind (struct gdbarch *gdbarch, int kind, int *size)
if (kind == NIOS2_CDX_OPCODE_SIZE)
{
- static const gdb_byte cdx_breakpoint_le[] = {0xc9, 0xd7};
+ static const gdb_byte cdx_breakpoint_le[] = { 0xc9, 0xd7 };
return cdx_breakpoint_le;
}
@@ -1748,7 +1754,8 @@ nios2_sw_breakpoint_from_kind (struct gdbarch *gdbarch, int kind, int *size)
if (mach == bfd_mach_nios2r2)
{
- static const gdb_byte r2_breakpoint_le[] = {0x20, 0x00, 0xfd, 0xb7};
+ static const gdb_byte r2_breakpoint_le[]
+ = { 0x20, 0x00, 0xfd, 0xb7 };
return r2_breakpoint_le;
}
@@ -1759,8 +1766,8 @@ nios2_sw_breakpoint_from_kind (struct gdbarch *gdbarch, int kind, int *size)
/* R1 trap encoding:
((0x1d << 17) | (0x2d << 11) | (0x1f << 6) | (0x3a << 0))
0x003b6ffa */
- static const gdb_byte r1_breakpoint_le[] = {0xfa, 0x6f, 0x3b, 0x0};
- static const gdb_byte r1_breakpoint_be[] = {0x0, 0x3b, 0x6f, 0xfa};
+ static const gdb_byte r1_breakpoint_le[] = { 0xfa, 0x6f, 0x3b, 0x0 };
+ static const gdb_byte r1_breakpoint_be[] = { 0x0, 0x3b, 0x6f, 0xfa };
if (byte_order_for_code == BFD_ENDIAN_BIG)
return r1_breakpoint_be;
@@ -1778,7 +1785,6 @@ nios2_frame_align (struct gdbarch *gdbarch, CORE_ADDR addr)
return align_down (addr, 4);
}
-
/* Implement the return_value gdbarch method. */
static enum return_value_convention
@@ -1801,8 +1807,8 @@ nios2_return_value (struct gdbarch *gdbarch, struct value *function,
static CORE_ADDR
nios2_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
- struct regcache *regcache, CORE_ADDR bp_addr,
- int nargs, struct value **args, CORE_ADDR sp,
+ struct regcache *regcache, CORE_ADDR bp_addr, int nargs,
+ struct value **args, CORE_ADDR sp,
function_call_return_method return_method,
CORE_ADDR struct_addr)
{
@@ -1851,8 +1857,8 @@ nios2_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
if (argreg <= NIOS2_LAST_ARGREG)
{
/* The argument is being passed in a register. */
- CORE_ADDR regval = extract_unsigned_integer (val, partial_len,
- byte_order);
+ CORE_ADDR regval
+ = extract_unsigned_integer (val, partial_len, byte_order);
regcache_cooked_write_unsigned (regcache, argreg, regval);
argreg++;
@@ -1923,8 +1929,8 @@ static void
nios2_frame_this_id (frame_info_ptr this_frame, void **this_cache,
struct frame_id *this_id)
{
- struct nios2_unwind_cache *cache =
- nios2_frame_unwind_cache (this_frame, this_cache);
+ struct nios2_unwind_cache *cache
+ = nios2_frame_unwind_cache (this_frame, this_cache);
/* This marks the outermost frame. */
if (cache->base == 0)
@@ -1939,8 +1945,8 @@ static struct value *
nios2_frame_prev_register (frame_info_ptr this_frame, void **this_cache,
int regnum)
{
- struct nios2_unwind_cache *cache =
- nios2_frame_unwind_cache (this_frame, this_cache);
+ struct nios2_unwind_cache *cache
+ = nios2_frame_unwind_cache (this_frame, this_cache);
gdb_assert (regnum >= 0 && regnum < NIOS2_NUM_REGS);
@@ -1977,24 +1983,18 @@ nios2_frame_base_address (frame_info_ptr this_frame, void **this_cache)
/* Data structures for the normal prologue-analysis-based
unwinder. */
-static const struct frame_unwind nios2_frame_unwind =
-{
- "nios2 prologue",
- NORMAL_FRAME,
- default_frame_unwind_stop_reason,
- nios2_frame_this_id,
- nios2_frame_prev_register,
- NULL,
- default_frame_sniffer
-};
+static const struct frame_unwind nios2_frame_unwind
+ = { "nios2 prologue",
+ NORMAL_FRAME,
+ default_frame_unwind_stop_reason,
+ nios2_frame_this_id,
+ nios2_frame_prev_register,
+ NULL,
+ default_frame_sniffer };
-static const struct frame_base nios2_frame_base =
-{
- &nios2_frame_unwind,
- nios2_frame_base_address,
- nios2_frame_base_address,
- nios2_frame_base_address
-};
+static const struct frame_base nios2_frame_base
+ = { &nios2_frame_unwind, nios2_frame_base_address, nios2_frame_base_address,
+ nios2_frame_base_address };
/* Fill in the register cache *THIS_CACHE for THIS_FRAME for use
in the stub unwinder. */
@@ -2014,8 +2014,7 @@ nios2_stub_frame_cache (frame_info_ptr this_frame, void **this_cache)
*this_cache = this_trad_cache;
/* The return address is in the link register. */
- trad_frame_set_reg_realreg (this_trad_cache,
- gdbarch_pc_regnum (gdbarch),
+ trad_frame_set_reg_realreg (this_trad_cache, gdbarch_pc_regnum (gdbarch),
NIOS2_RA_REGNUM);
/* Frame ID, since it's a frameless / stackless function, no stack
@@ -2045,8 +2044,8 @@ nios2_stub_frame_this_id (frame_info_ptr this_frame, void **this_cache,
/* Implement the prev_register function for the stub unwinder. */
static struct value *
-nios2_stub_frame_prev_register (frame_info_ptr this_frame,
- void **this_cache, int regnum)
+nios2_stub_frame_prev_register (frame_info_ptr this_frame, void **this_cache,
+ int regnum)
{
struct trad_frame_cache *this_trad_cache
= nios2_stub_frame_cache (this_frame, this_cache);
@@ -2078,18 +2077,14 @@ nios2_stub_frame_sniffer (const struct frame_unwind *self,
/* Define the data structures for the stub unwinder. */
-static const struct frame_unwind nios2_stub_frame_unwind =
-{
- "nios2 stub",
- NORMAL_FRAME,
- default_frame_unwind_stop_reason,
- nios2_stub_frame_this_id,
- nios2_stub_frame_prev_register,
- NULL,
- nios2_stub_frame_sniffer
-};
-
-
+static const struct frame_unwind nios2_stub_frame_unwind
+ = { "nios2 stub",
+ NORMAL_FRAME,
+ default_frame_unwind_stop_reason,
+ nios2_stub_frame_this_id,
+ nios2_stub_frame_prev_register,
+ NULL,
+ nios2_stub_frame_sniffer };
/* Determine where to set a single step breakpoint while considering
branch prediction. */
@@ -2112,7 +2107,7 @@ nios2_get_next_pc (struct regcache *regcache, CORE_ADDR pc)
/* Do something stupid if we can't disassemble the insn at pc. */
if (op == NULL)
return pc + NIOS2_OPCODE_SIZE;
-
+
if (nios2_match_branch (insn, op, mach, &ra, &rb, &imm, &cond))
{
int ras = regcache_raw_get_signed (regcache, ra);
@@ -2160,8 +2155,7 @@ nios2_get_next_pc (struct regcache *regcache, CORE_ADDR pc)
else if (nios2_match_calli (insn, op, mach, &uimm))
{
CORE_ADDR callto = (pc & 0xf0000000) | uimm;
- if (tdep->is_kernel_helper != NULL
- && tdep->is_kernel_helper (callto))
+ if (tdep->is_kernel_helper != NULL && tdep->is_kernel_helper (callto))
/* Step over call to kernel helper, which we cannot debug
from user space. */
pc += op->size;
@@ -2174,8 +2168,7 @@ nios2_get_next_pc (struct regcache *regcache, CORE_ADDR pc)
else if (nios2_match_callr (insn, op, mach, &ra))
{
CORE_ADDR callto = regcache_raw_get_unsigned (regcache, ra);
- if (tdep->is_kernel_helper != NULL
- && tdep->is_kernel_helper (callto))
+ if (tdep->is_kernel_helper != NULL && tdep->is_kernel_helper (callto))
/* Step over call to kernel helper. */
pc += op->size;
else
@@ -2210,9 +2203,10 @@ nios2_get_next_pc (struct regcache *regcache, CORE_ADDR pc)
static std::vector<CORE_ADDR>
nios2_software_single_step (struct regcache *regcache)
{
- CORE_ADDR next_pc = nios2_get_next_pc (regcache, regcache_read_pc (regcache));
+ CORE_ADDR next_pc
+ = nios2_get_next_pc (regcache, regcache_read_pc (regcache));
- return {next_pc};
+ return { next_pc };
}
/* Implement the get_longjump_target gdbarch method. */
@@ -2295,7 +2289,7 @@ nios2_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
tdesc_data = tdesc_data_alloc ();
valid_p = 1;
-
+
for (i = 0; i < NIOS2_NUM_REGS; i++)
valid_p &= tdesc_numbered_register (feature, tdesc_data.get (), i,
nios2_reg_names[i]);
@@ -2336,7 +2330,7 @@ nios2_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
/* The register set. */
set_gdbarch_num_regs (gdbarch, NIOS2_NUM_REGS);
set_gdbarch_sp_regnum (gdbarch, NIOS2_SP_REGNUM);
- set_gdbarch_pc_regnum (gdbarch, NIOS2_PC_REGNUM); /* Pseudo register PC */
+ set_gdbarch_pc_regnum (gdbarch, NIOS2_PC_REGNUM); /* Pseudo register PC */
set_gdbarch_register_name (gdbarch, nios2_register_name);
set_gdbarch_register_type (gdbarch, nios2_register_type);
@@ -2389,6 +2383,7 @@ nios2_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
}
void _initialize_nios2_tdep ();
+
void
_initialize_nios2_tdep ()
{
@@ -2396,11 +2391,9 @@ _initialize_nios2_tdep ()
initialize_tdesc_nios2 ();
/* Allow debugging this file's internals. */
- add_setshow_boolean_cmd ("nios2", class_maintenance, &nios2_debug,
- _("Set Nios II debugging."),
- _("Show Nios II debugging."),
- _("When on, Nios II specific debugging is enabled."),
- NULL,
- NULL,
- &setdebuglist, &showdebuglist);
+ add_setshow_boolean_cmd (
+ "nios2", class_maintenance, &nios2_debug, _ ("Set Nios II debugging."),
+ _ ("Show Nios II debugging."),
+ _ ("When on, Nios II specific debugging is enabled."), NULL, NULL,
+ &setdebuglist, &showdebuglist);
}
diff --git a/gdb/nios2-tdep.h b/gdb/nios2-tdep.h
index b8f4285ef14..beaa9a2b7b3 100644
--- a/gdb/nios2-tdep.h
+++ b/gdb/nios2-tdep.h
@@ -26,18 +26,18 @@
#include "opcode/nios2.h"
/* Registers. */
-#define NIOS2_Z_REGNUM 0 /* Zero */
-#define NIOS2_R2_REGNUM 2 /* used for return value */
-#define NIOS2_R3_REGNUM 3 /* used for return value */
+#define NIOS2_Z_REGNUM 0 /* Zero */
+#define NIOS2_R2_REGNUM 2 /* used for return value */
+#define NIOS2_R3_REGNUM 3 /* used for return value */
/* Used for hidden zero argument to store ptr to struct return value. */
#define NIOS2_R4_REGNUM 4
#define NIOS2_R7_REGNUM 7
-#define NIOS2_GP_REGNUM 26 /* Global Pointer */
-#define NIOS2_SP_REGNUM 27 /* Stack Pointer */
-#define NIOS2_FP_REGNUM 28 /* Frame Pointer */
-#define NIOS2_EA_REGNUM 29 /* Exception address */
-#define NIOS2_BA_REGNUM 30 /* Breakpoint return address */
-#define NIOS2_RA_REGNUM 31 /* Return address */
+#define NIOS2_GP_REGNUM 26 /* Global Pointer */
+#define NIOS2_SP_REGNUM 27 /* Stack Pointer */
+#define NIOS2_FP_REGNUM 28 /* Frame Pointer */
+#define NIOS2_EA_REGNUM 29 /* Exception address */
+#define NIOS2_BA_REGNUM 30 /* Breakpoint return address */
+#define NIOS2_RA_REGNUM 31 /* Return address */
#define NIOS2_PC_REGNUM 32
/* Control registers. */
@@ -73,8 +73,8 @@ struct nios2_gdbarch_tdep : gdbarch_tdep_base
{
/* Assumes FRAME is stopped at a syscall (trap) instruction; returns
the expected next PC. */
- CORE_ADDR (*syscall_next_pc) (frame_info_ptr frame,
- const struct nios2_opcode *op) = nullptr;
+ CORE_ADDR (*syscall_next_pc)
+ (frame_info_ptr frame, const struct nios2_opcode *op) = nullptr;
/* Returns true if PC points to a kernel helper function. */
bool (*is_kernel_helper) (CORE_ADDR pc) = nullptr;
diff --git a/gdb/nto-procfs.c b/gdb/nto-procfs.c
index ffe11c69abf..70eefad51b8 100644
--- a/gdb/nto-procfs.c
+++ b/gdb/nto-procfs.c
@@ -45,9 +45,10 @@
#include "gdbsupport/filestuff.h"
#include "gdbsupport/scoped_fd.h"
-#define NULL_PID 0
-#define _DEBUG_FLAG_TRACE (_DEBUG_FLAG_TRACE_EXEC|_DEBUG_FLAG_TRACE_RD|\
- _DEBUG_FLAG_TRACE_WR|_DEBUG_FLAG_TRACE_MODIFY)
+#define NULL_PID 0
+#define _DEBUG_FLAG_TRACE \
+ (_DEBUG_FLAG_TRACE_EXEC | _DEBUG_FLAG_TRACE_RD | _DEBUG_FLAG_TRACE_WR \
+ | _DEBUG_FLAG_TRACE_MODIFY)
int ctl_fd;
@@ -75,8 +76,7 @@ struct nto_procfs_target : public inf_child_target
void store_registers (struct regcache *, int) override;
enum target_xfer_status xfer_partial (enum target_object object,
- const char *annex,
- gdb_byte *readbuf,
+ const char *annex, gdb_byte *readbuf,
const gdb_byte *writebuf,
ULONGEST offset, ULONGEST len,
ULONGEST *xfered_len) override;
@@ -90,9 +90,11 @@ struct nto_procfs_target : public inf_child_target
int can_use_hw_breakpoint (enum bptype, int, int) override;
- int insert_hw_breakpoint (struct gdbarch *, struct bp_target_info *) override;
+ int insert_hw_breakpoint (struct gdbarch *,
+ struct bp_target_info *) override;
- int remove_hw_breakpoint (struct gdbarch *, struct bp_target_info *) override;
+ int remove_hw_breakpoint (struct gdbarch *,
+ struct bp_target_info *) override;
int insert_watchpoint (CORE_ADDR, int, enum target_hw_bp_type,
struct expression *) override;
@@ -104,8 +106,8 @@ struct nto_procfs_target : public inf_child_target
void kill () override;
- void create_inferior (const char *, const std::string &,
- char **, int) override;
+ void create_inferior (const char *, const std::string &, char **,
+ int) override;
void mourn_inferior () override;
@@ -126,30 +128,24 @@ struct nto_procfs_target : public inf_child_target
/* For "target native". */
-static const target_info nto_native_target_info = {
- "native",
- N_("QNX Neutrino local process"),
- N_("QNX Neutrino local process (started by the \"run\" command).")
-};
+static const target_info nto_native_target_info
+ = { "native", N_ ("QNX Neutrino local process"),
+ N_ ("QNX Neutrino local process (started by the \"run\" command).") };
class nto_procfs_target_native final : public nto_procfs_target
{
- const target_info &info () const override
- { return nto_native_target_info; }
+ const target_info &info () const override { return nto_native_target_info; }
};
/* For "target procfs <node>". */
-static const target_info nto_procfs_target_info = {
- "procfs",
- N_("QNX Neutrino local or remote process"),
- N_("QNX Neutrino process. target procfs NODE")
-};
+static const target_info nto_procfs_target_info
+ = { "procfs", N_ ("QNX Neutrino local or remote process"),
+ N_ ("QNX Neutrino process. target procfs NODE") };
struct nto_procfs_target_procfs final : public nto_procfs_target
{
- const target_info &info () const override
- { return nto_procfs_target_info; }
+ const target_info &info () const override { return nto_procfs_target_info; }
};
static ptid_t do_attach (ptid_t ptid);
@@ -170,13 +166,12 @@ nto_node (void)
{
unsigned node;
- if (ND_NODE_CMP (nto_procfs_node, ND_LOCAL_NODE) == 0
- || nodestr == NULL)
+ if (ND_NODE_CMP (nto_procfs_node, ND_LOCAL_NODE) == 0 || nodestr == NULL)
return ND_LOCAL_NODE;
node = netmgr_strtond (nodestr, 0);
if (node == -1)
- error (_("Lost the QNX node. Debug session probably over."));
+ error (_ ("Lost the QNX node. Debug session probably over."));
return (node);
}
@@ -221,8 +216,8 @@ nto_procfs_target::open (const char *arg, int from_tty)
{
if (errno == ENOTSUP)
gdb_printf ("QNX Net Manager not found.\n");
- gdb_printf ("Invalid QNX node %s: error %d (%s).\n", nodestr,
- errno, safe_strerror (errno));
+ gdb_printf ("Invalid QNX node %s: error %d (%s).\n", nodestr, errno,
+ safe_strerror (errno));
xfree (nodestr);
nodestr = NULL;
nto_procfs_node = ND_LOCAL_NODE;
@@ -243,7 +238,7 @@ nto_procfs_target::open (const char *arg, int from_tty)
{
gdb_printf ("Error opening %s : %d (%s)\n", nto_procfs_path, errno,
safe_strerror (errno));
- error (_("Invalid procfs arg"));
+ error (_ ("Invalid procfs arg"));
}
sysinfo = (void *) buffer;
@@ -251,7 +246,7 @@ nto_procfs_target::open (const char *arg, int from_tty)
{
gdb_printf ("Error getting size: %d (%s)\n", errno,
safe_strerror (errno));
- error (_("Devctl failed."));
+ error (_ ("Devctl failed."));
}
else
{
@@ -259,9 +254,8 @@ nto_procfs_target::open (const char *arg, int from_tty)
sysinfo = alloca (total_size);
if (sysinfo == NULL)
{
- gdb_printf ("Memory error: %d (%s)\n", errno,
- safe_strerror (errno));
- error (_("alloca failed."));
+ gdb_printf ("Memory error: %d (%s)\n", errno, safe_strerror (errno));
+ error (_ ("alloca failed."));
}
else
{
@@ -270,14 +264,14 @@ nto_procfs_target::open (const char *arg, int from_tty)
{
gdb_printf ("Error getting sysinfo: %d (%s)\n", errno,
safe_strerror (errno));
- error (_("Devctl failed."));
+ error (_ ("Devctl failed."));
}
else
{
- if (sysinfo->type !=
- nto_map_arch_to_cputype (gdbarch_bfd_arch_info
- (target_gdbarch ())->arch_name))
- error (_("Invalid target CPU."));
+ if (sysinfo->type
+ != nto_map_arch_to_cputype (
+ gdbarch_bfd_arch_info (target_gdbarch ())->arch_name))
+ error (_ ("Invalid target CPU."));
}
}
}
@@ -312,8 +306,8 @@ nto_procfs_target::thread_alive (ptid_t ptid)
return false;
status.tid = tid;
- if ((err = devctl (ctl_fd, DCMD_PROC_TIDSTATUS,
- &status, sizeof (status), 0)) != EOK)
+ if ((err = devctl (ctl_fd, DCMD_PROC_TIDSTATUS, &status, sizeof (status), 0))
+ != EOK)
return false;
/* Thread is alive or dead but not yet joined,
@@ -342,9 +336,9 @@ update_thread_private_data_name (struct thread_info *new_thread,
pti->name = newname;
}
-static void
-update_thread_private_data (struct thread_info *new_thread,
- pthread_t tid, int state, int flags)
+static void
+update_thread_private_data (struct thread_info *new_thread, pthread_t tid,
+ int state, int flags)
{
procfs_info pidinfo;
struct _thread_name *tn;
@@ -353,8 +347,7 @@ update_thread_private_data (struct thread_info *new_thread,
#if _NTO_VERSION > 630
gdb_assert (new_thread != NULL);
- if (devctl (ctl_fd, DCMD_PROC_INFO, &pidinfo,
- sizeof(pidinfo), 0) != EOK)
+ if (devctl (ctl_fd, DCMD_PROC_INFO, &pidinfo, sizeof (pidinfo), 0) != EOK)
return;
memset (&tctl, 0, sizeof (tctl));
@@ -399,7 +392,7 @@ nto_procfs_target::update_thread_list ()
for (tid = 1;; ++tid)
{
- if (status.tid == tid
+ if (status.tid == tid
&& (devctl (ctl_fd, DCMD_PROC_TIDSTATUS, &status, sizeof (status), 0)
!= EOK))
break;
@@ -437,8 +430,8 @@ procfs_pidlist (const char *args, int from_tty)
gdb_dir_up dp (opendir (procfs_dir));
if (dp == NULL)
{
- gdb_printf (gdb_stderr, "failed to opendir \"%s\" - %d (%s)",
- procfs_dir, errno, safe_strerror (errno));
+ gdb_printf (gdb_stderr, "failed to opendir \"%s\" - %d (%s)", procfs_dir,
+ errno, safe_strerror (errno));
return;
}
@@ -454,8 +447,7 @@ procfs_pidlist (const char *args, int from_tty)
if (dirp == NULL)
return;
snprintf (buf, sizeof (buf), "%s%s/%s/as",
- (nodestr != NULL) ? nodestr : "",
- "/proc", dirp->d_name);
+ (nodestr != NULL) ? nodestr : "", "/proc", dirp->d_name);
pid = atoi (dirp->d_name);
}
while (pid == 0);
@@ -464,16 +456,15 @@ procfs_pidlist (const char *args, int from_tty)
scoped_fd fd (open (buf, O_RDONLY));
if (fd.get () == -1)
{
- gdb_printf (gdb_stderr, "failed to open %s - %d (%s)\n",
- buf, errno, safe_strerror (errno));
+ gdb_printf (gdb_stderr, "failed to open %s - %d (%s)\n", buf, errno,
+ safe_strerror (errno));
continue;
}
pidinfo = (procfs_info *) buf;
if (devctl (fd.get (), DCMD_PROC_INFO, pidinfo, sizeof (buf), 0) != EOK)
{
- gdb_printf (gdb_stderr,
- "devctl DCMD_PROC_INFO failed - %d (%s)\n",
+ gdb_printf (gdb_stderr, "devctl DCMD_PROC_INFO failed - %d (%s)\n",
errno, safe_strerror (errno));
break;
}
@@ -552,8 +543,8 @@ procfs_meminfo (const char *args, int from_tty)
mapinfo_p = mapinfos;
/* Fill the map entrys. */
- err = devctl (ctl_fd, DCMD_PROC_MAPINFO, mapinfo_p, num
- * sizeof (procfs_mapinfo), &num);
+ err = devctl (ctl_fd, DCMD_PROC_MAPINFO, mapinfo_p,
+ num * sizeof (procfs_mapinfo), &num);
if (err != EOK)
{
printf ("failed devctl mapinfos - %d (%s)\n", err, safe_strerror (err));
@@ -570,7 +561,7 @@ procfs_meminfo (const char *args, int from_tty)
if (!(mapinfo_p->flags & flags))
mapinfo_p->ino = 0;
- if (mapinfo_p->ino == 0) /* Already visited. */
+ if (mapinfo_p->ino == 0) /* Already visited. */
continue;
map.info.vaddr = mapinfo_p->vaddr;
@@ -597,8 +588,7 @@ procfs_meminfo (const char *args, int from_tty)
&& mapinfo_p2->dev == mapinfo_p->dev)
{
map.info.vaddr = mapinfo_p2->vaddr;
- err =
- devctl (ctl_fd, DCMD_PROC_MAPDEBUG, &map, sizeof (map), 0);
+ err = devctl (ctl_fd, DCMD_PROC_MAPDEBUG, &map, sizeof (map), 0);
if (err != EOK)
continue;
@@ -699,7 +689,7 @@ nto_procfs_target::attach (const char *args, int from_tty)
pid = parse_pid_to_attach (args);
if (pid == getpid ())
- error (_("Attaching GDB to itself is not a good idea..."));
+ error (_ ("Attaching GDB to itself is not a good idea..."));
target_announce_attach (from_tty, pid);
@@ -730,14 +720,14 @@ do_attach (ptid_t ptid)
struct sigevent event;
char path[PATH_MAX];
- snprintf (path, PATH_MAX - 1, "%s%s/%d/as",
- (nodestr != NULL) ? nodestr : "", "/proc", ptid.pid ());
+ snprintf (path, PATH_MAX - 1, "%s%s/%d/as", (nodestr != NULL) ? nodestr : "",
+ "/proc", ptid.pid ());
ctl_fd = open (path, O_RDWR);
if (ctl_fd == -1)
- error (_("Couldn't open proc file %s, error %d (%s)"), path, errno,
+ error (_ ("Couldn't open proc file %s, error %d (%s)"), path, errno,
safe_strerror (errno));
if (devctl (ctl_fd, DCMD_PROC_STOP, &status, sizeof (status), 0) != EOK)
- error (_("Couldn't stop process"));
+ error (_ ("Couldn't stop process"));
/* Define a sigevent for process stopped notification. */
event.sigev_notify = SIGEV_SIGNAL_THREAD;
@@ -758,7 +748,7 @@ do_attach (ptid_t ptid)
static void
interrupt_query (void)
{
- if (query (_("Interrupted while waiting for the program.\n\
+ if (query (_ ("Interrupted while waiting for the program.\n\
Give up (and stop debugging it)? ")))
{
target_mourn_inferior (inferior_ptid);
@@ -791,7 +781,7 @@ nto_procfs_target::wait (ptid_t ptid, struct target_waitstatus *ourstatus,
sigset_t set;
siginfo_t info;
procfs_status status;
- static int exit_signo = 0; /* To track signals that cause termination. */
+ static int exit_signo = 0; /* To track signals that cause termination. */
ourstatus->set_spurious ();
@@ -838,8 +828,8 @@ nto_procfs_target::wait (ptid_t ptid, struct target_waitstatus *ourstatus,
}
else
{
- ourstatus->set_stopped
- (gdb_signal_from_host (status.info.si_signo));
+ ourstatus->set_stopped (
+ gdb_signal_from_host (status.info.si_signo));
exit_signo = ourstatus->sig ();
}
break;
@@ -885,15 +875,14 @@ nto_procfs_target::fetch_registers (struct regcache *regcache, int regno)
procfs_greg greg;
procfs_fpreg fpreg;
procfs_altreg altreg;
- }
- reg;
+ } reg;
+
int regsize;
procfs_set_thread (regcache->ptid ());
if (devctl (ctl_fd, DCMD_PROC_GETGREG, &reg, sizeof (reg), &regsize) == EOK)
nto_supply_gregset (regcache, (char *) &reg.greg);
- if (devctl (ctl_fd, DCMD_PROC_GETFPREG, &reg, sizeof (reg), &regsize)
- == EOK)
+ if (devctl (ctl_fd, DCMD_PROC_GETFPREG, &reg, sizeof (reg), &regsize) == EOK)
nto_supply_fpregset (regcache, (char *) &reg.fpreg);
if (devctl (ctl_fd, DCMD_PROC_GETALTREG, &reg, sizeof (reg), &regsize)
== EOK)
@@ -925,10 +914,10 @@ procfs_xfer_memory (gdb_byte *readbuf, const gdb_byte *writebuf,
/* Target to_xfer_partial implementation. */
enum target_xfer_status
-nto_procfs_target::xfer_partial (enum target_object object,
- const char *annex, gdb_byte *readbuf,
- const gdb_byte *writebuf, ULONGEST offset,
- ULONGEST len, ULONGEST *xfered_len)
+nto_procfs_target::xfer_partial (enum target_object object, const char *annex,
+ gdb_byte *readbuf, const gdb_byte *writebuf,
+ ULONGEST offset, ULONGEST len,
+ ULONGEST *xfered_len)
{
switch (object)
{
@@ -949,8 +938,7 @@ nto_procfs_target::xfer_partial (enum target_object object,
if (tempbuf == NULL)
return TARGET_XFER_E_IO;
- err = devctl (ctl_fd, DCMD_PROC_INFO, &procinfo,
- sizeof procinfo, 0);
+ err = devctl (ctl_fd, DCMD_PROC_INFO, &procinfo, sizeof procinfo, 0);
if (err != EOK)
return TARGET_XFER_E_IO;
@@ -965,11 +953,10 @@ nto_procfs_target::xfer_partial (enum target_object object,
*xfered_len = tempread;
return tempread ? TARGET_XFER_OK : TARGET_XFER_EOF;
}
- /* Fallthru */
+ /* Fallthru */
default:
- return this->beneath ()->xfer_partial (object, annex,
- readbuf, writebuf, offset, len,
- xfered_len);
+ return this->beneath ()->xfer_partial (object, annex, readbuf, writebuf,
+ offset, len, xfered_len);
}
}
@@ -1051,8 +1038,7 @@ nto_procfs_target::resume (ptid_t ptid, int step, enum gdb_signal signo)
if (inferior_ptid == null_ptid)
return;
- procfs_set_thread (ptid == minus_one_ptid ? inferior_ptid :
- ptid);
+ procfs_set_thread (ptid == minus_one_ptid ? inferior_ptid : ptid);
run.flags = _DEBUG_RUN_FAULT | _DEBUG_RUN_TRACE;
if (step)
@@ -1082,11 +1068,11 @@ nto_procfs_target::resume (ptid_t ptid, int step, enum gdb_signal signo)
{
if (signal_to_pass != status.info.si_signo)
{
- SignalKill (nto_node (), inferior_ptid.pid (), 0,
- signal_to_pass, 0, 0);
+ SignalKill (nto_node (), inferior_ptid.pid (), 0, signal_to_pass,
+ 0, 0);
run.flags |= _DEBUG_RUN_CLRFLT | _DEBUG_RUN_CLRSIG;
}
- else /* Let it kill the program without telling us. */
+ else /* Let it kill the program without telling us. */
sigdelset (&run.trace, signal_to_pass);
}
}
@@ -1096,7 +1082,7 @@ nto_procfs_target::resume (ptid_t ptid, int step, enum gdb_signal signo)
errno = devctl (ctl_fd, DCMD_PROC_RUN, &run, sizeof (run), 0);
if (errno != EOK)
{
- perror (_("run error!\n"));
+ perror (_ ("run error!\n"));
return;
}
}
@@ -1176,8 +1162,8 @@ breakup_args (char *scratch, char **argv)
void
nto_procfs_target::create_inferior (const char *exec_file,
- const std::string &allargs,
- char **env, int from_tty)
+ const std::string &allargs, char **env,
+ int from_tty)
{
struct inheritance inherit;
pid_t pid;
@@ -1188,8 +1174,7 @@ nto_procfs_target::create_inferior (const char *exec_file,
sigset_t set;
struct inferior *inf;
- argv = xmalloc ((allargs.size () / (unsigned) 2 + 2) *
- sizeof (*argv));
+ argv = xmalloc ((allargs.size () / (unsigned) 2 + 2) * sizeof (*argv));
argv[0] = const_cast<char *> (get_exec_file (1));
if (!argv[0])
{
@@ -1270,7 +1255,7 @@ nto_procfs_target::create_inferior (const char *exec_file,
sigprocmask (SIG_BLOCK, &set, NULL);
if (pid == -1)
- error (_("Error spawning %s: %d (%s)"), argv[0], errno,
+ error (_ ("Error spawning %s: %d (%s)"), argv[0], errno,
safe_strerror (errno));
if (fds[0] != STDIN_FILENO)
@@ -1288,7 +1273,7 @@ nto_procfs_target::create_inferior (const char *exec_file,
inferior_appeared (inf, pid);
inf->attach_flag = false;
- flags = _DEBUG_FLAG_KLC; /* Kill-on-Last-Close flag. */
+ flags = _DEBUG_FLAG_KLC; /* Kill-on-Last-Close flag. */
errn = devctl (ctl_fd, DCMD_PROC_SET_FLAG, &flags, sizeof (flags), 0);
if (errn != EOK)
{
@@ -1359,8 +1344,8 @@ nto_procfs_target::store_registers (struct regcache *regcache, int regno)
procfs_greg greg;
procfs_fpreg fpreg;
procfs_altreg altreg;
- }
- reg;
+ } reg;
+
unsigned off;
int len, regset, regsize, dev_set, err;
char *data;
@@ -1374,8 +1359,7 @@ nto_procfs_target::store_registers (struct regcache *regcache, int regno)
{
for (regset = NTO_REG_GENERAL; regset < NTO_REG_END; regset++)
{
- dev_set = get_regset (regset, (char *) &reg,
- sizeof (reg), &regsize);
+ dev_set = get_regset (regset, (char *) &reg, sizeof (reg), &regsize);
if (dev_set == -1)
continue;
@@ -1384,8 +1368,7 @@ nto_procfs_target::store_registers (struct regcache *regcache, int regno)
err = devctl (ctl_fd, dev_set, &reg, regsize, 0);
if (err != EOK)
- gdb_printf (gdb_stderr,
- "Warning unable to write regset %d: %s\n",
+ gdb_printf (gdb_stderr, "Warning unable to write regset %d: %s\n",
regno, safe_strerror (err));
}
}
@@ -1399,8 +1382,7 @@ nto_procfs_target::store_registers (struct regcache *regcache, int regno)
if (dev_set == -1)
return;
- len = nto_register_area (regcache->arch (),
- regno, regset, &off);
+ len = nto_register_area (regcache->arch (), regno, regset, &off);
if (len < 1)
return;
@@ -1409,17 +1391,16 @@ nto_procfs_target::store_registers (struct regcache *regcache, int regno)
err = devctl (ctl_fd, dev_set, &reg, regsize, 0);
if (err != EOK)
- gdb_printf (gdb_stderr,
- "Warning unable to write regset %d: %s\n", regno,
- safe_strerror (err));
+ gdb_printf (gdb_stderr, "Warning unable to write regset %d: %s\n",
+ regno, safe_strerror (err));
}
}
/* Set list of signals to be handled in the target. */
void
-nto_procfs_target::pass_signals
- (gdb::array_view<const unsigned char> pass_signals)
+nto_procfs_target::pass_signals (
+ gdb::array_view<const unsigned char> pass_signals)
{
int signo;
@@ -1442,7 +1423,7 @@ nto_procfs_target::pid_to_str (ptid_t ptid)
pid = ptid.pid ();
tid = ptid.tid ();
-#if 0 /* NYI */
+#if 0 /* NYI */
tip = procfs_thread_info (pid, tid);
if (tip != NULL)
snprintf (&buf[n], 1023, " (state = 0x%02x)", tip->state);
@@ -1485,6 +1466,7 @@ init_procfs_targets (void)
#define OSTYPE_NTO 1
void _initialize_procfs ();
+
void
_initialize_procfs ()
{
@@ -1505,13 +1487,12 @@ _initialize_procfs ()
nto_cpuinfo_flags = SYSPAGE_ENTRY (cpuinfo)->flags;
nto_cpuinfo_valid = 1;
- add_info ("pidlist", procfs_pidlist, _("pidlist"));
- add_info ("meminfo", procfs_meminfo, _("memory information"));
+ add_info ("pidlist", procfs_pidlist, _ ("pidlist"));
+ add_info ("meminfo", procfs_meminfo, _ ("memory information"));
nto_is_nto_target = procfs_is_nto_target;
}
-
static int
procfs_hw_watchpoint (int addr, int len, enum target_hw_bp_type type)
{
@@ -1525,26 +1506,26 @@ procfs_hw_watchpoint (int addr, int len, enum target_hw_bp_type type)
case hw_access:
brk.type = _DEBUG_BREAK_RW;
break;
- default: /* Modify. */
-/* FIXME: brk.type = _DEBUG_BREAK_RWM gives EINVAL for some reason. */
+ default: /* Modify. */
+ /* FIXME: brk.type = _DEBUG_BREAK_RWM gives EINVAL for some reason. */
brk.type = _DEBUG_BREAK_RW;
}
- brk.type |= _DEBUG_BREAK_HW; /* Always ask for HW. */
+ brk.type |= _DEBUG_BREAK_HW; /* Always ask for HW. */
brk.addr = addr;
brk.size = len;
errno = devctl (ctl_fd, DCMD_PROC_BREAK, &brk, sizeof (brk), 0);
if (errno != EOK)
{
- perror (_("Failed to set hardware watchpoint"));
+ perror (_ ("Failed to set hardware watchpoint"));
return -1;
}
return 0;
}
bool
-nto_procfs_target::can_use_hw_breakpoint (enum bptype type,
- int cnt, int othertype)
+nto_procfs_target::can_use_hw_breakpoint (enum bptype type, int cnt,
+ int othertype)
{
return 1;
}
@@ -1582,7 +1563,6 @@ nto_procfs_target::stopped_by_watchpoint ()
inf_data = nto_inferior_data (inf);
return inf_data->stopped_flags
- & (_DEBUG_FLAG_TRACE_RD
- | _DEBUG_FLAG_TRACE_WR
+ & (_DEBUG_FLAG_TRACE_RD | _DEBUG_FLAG_TRACE_WR
| _DEBUG_FLAG_TRACE_MODIFY);
}
diff --git a/gdb/nto-tdep.c b/gdb/nto-tdep.c
index 1ad0f012969..32003cdd98e 100644
--- a/gdb/nto-tdep.c
+++ b/gdb/nto-tdep.c
@@ -34,7 +34,7 @@
#include "source.h"
#include "gdbsupport/pathstuff.h"
-#define QNX_NOTE_NAME "QNX"
+#define QNX_NOTE_NAME "QNX"
#define QNX_INFO_SECT_NAME "QNX_info"
#ifdef __CYGWIN__
@@ -102,15 +102,18 @@ nto_find_and_open_solib (const char *solib, unsigned o_flags,
"%s/lib:%s/usr/lib:%s/usr/photon/lib:%s/usr/photon/dll:%s/lib/dll"
nto_root = nto_target ();
- if (strcmp (gdbarch_bfd_arch_info (target_gdbarch ())->arch_name, "i386") == 0)
+ if (strcmp (gdbarch_bfd_arch_info (target_gdbarch ())->arch_name, "i386")
+ == 0)
{
arch = "x86";
endian = "";
}
else if (strcmp (gdbarch_bfd_arch_info (target_gdbarch ())->arch_name,
- "rs6000") == 0
+ "rs6000")
+ == 0
|| strcmp (gdbarch_bfd_arch_info (target_gdbarch ())->arch_name,
- "powerpc") == 0)
+ "powerpc")
+ == 0)
{
arch = "ppc";
endian = "be";
@@ -118,8 +121,8 @@ nto_find_and_open_solib (const char *solib, unsigned o_flags,
else
{
arch = gdbarch_bfd_arch_info (target_gdbarch ())->arch_name;
- endian = gdbarch_byte_order (target_gdbarch ())
- == BFD_ENDIAN_BIG ? "be" : "le";
+ endian = gdbarch_byte_order (target_gdbarch ()) == BFD_ENDIAN_BIG ? "be"
+ : "le";
}
/* In case nto_root is short, add strlen(solib)
@@ -162,15 +165,18 @@ nto_init_solib_absolute_prefix (void)
const char *arch;
nto_root = nto_target ();
- if (strcmp (gdbarch_bfd_arch_info (target_gdbarch ())->arch_name, "i386") == 0)
+ if (strcmp (gdbarch_bfd_arch_info (target_gdbarch ())->arch_name, "i386")
+ == 0)
{
arch = "x86";
endian = "";
}
else if (strcmp (gdbarch_bfd_arch_info (target_gdbarch ())->arch_name,
- "rs6000") == 0
+ "rs6000")
+ == 0
|| strcmp (gdbarch_bfd_arch_info (target_gdbarch ())->arch_name,
- "powerpc") == 0)
+ "powerpc")
+ == 0)
{
arch = "ppc";
endian = "be";
@@ -178,8 +184,8 @@ nto_init_solib_absolute_prefix (void)
else
{
arch = gdbarch_bfd_arch_info (target_gdbarch ())->arch_name;
- endian = gdbarch_byte_order (target_gdbarch ())
- == BFD_ENDIAN_BIG ? "be" : "le";
+ endian = gdbarch_byte_order (target_gdbarch ()) == BFD_ENDIAN_BIG ? "be"
+ : "le";
}
xsnprintf (arch_path, sizeof (arch_path), "%s/%s%s", nto_root, arch, endian);
@@ -189,14 +195,15 @@ nto_init_solib_absolute_prefix (void)
}
char **
-nto_parse_redirection (char *pargv[], const char **pin, const char **pout,
+nto_parse_redirection (char *pargv[], const char **pin, const char **pout,
const char **perr)
{
char **argv;
const char *in, *out, *err, *p;
int argc, i, n;
- for (n = 0; pargv[n]; n++);
+ for (n = 0; pargv[n]; n++)
+ ;
if (n == 0)
return NULL;
in = "";
@@ -348,36 +355,33 @@ nto_elf_osabi_sniffer (bfd *abfd)
{
enum gdb_osabi osabi = GDB_OSABI_UNKNOWN;
- bfd_map_over_sections (abfd,
- nto_sniff_abi_note_section,
- &osabi);
+ bfd_map_over_sections (abfd, nto_sniff_abi_note_section, &osabi);
return osabi;
}
-static const char * const nto_thread_state_str[] =
-{
- "DEAD", /* 0 0x00 */
- "RUNNING", /* 1 0x01 */
- "READY", /* 2 0x02 */
- "STOPPED", /* 3 0x03 */
- "SEND", /* 4 0x04 */
- "RECEIVE", /* 5 0x05 */
- "REPLY", /* 6 0x06 */
- "STACK", /* 7 0x07 */
- "WAITTHREAD", /* 8 0x08 */
- "WAITPAGE", /* 9 0x09 */
- "SIGSUSPEND", /* 10 0x0a */
- "SIGWAITINFO", /* 11 0x0b */
- "NANOSLEEP", /* 12 0x0c */
- "MUTEX", /* 13 0x0d */
- "CONDVAR", /* 14 0x0e */
- "JOIN", /* 15 0x0f */
- "INTR", /* 16 0x10 */
- "SEM", /* 17 0x11 */
- "WAITCTX", /* 18 0x12 */
- "NET_SEND", /* 19 0x13 */
- "NET_REPLY" /* 20 0x14 */
+static const char *const nto_thread_state_str[] = {
+ "DEAD", /* 0 0x00 */
+ "RUNNING", /* 1 0x01 */
+ "READY", /* 2 0x02 */
+ "STOPPED", /* 3 0x03 */
+ "SEND", /* 4 0x04 */
+ "RECEIVE", /* 5 0x05 */
+ "REPLY", /* 6 0x06 */
+ "STACK", /* 7 0x07 */
+ "WAITTHREAD", /* 8 0x08 */
+ "WAITPAGE", /* 9 0x09 */
+ "SIGSUSPEND", /* 10 0x0a */
+ "SIGWAITINFO", /* 11 0x0b */
+ "NANOSLEEP", /* 12 0x0c */
+ "MUTEX", /* 13 0x0d */
+ "CONDVAR", /* 14 0x0e */
+ "JOIN", /* 15 0x0f */
+ "INTR", /* 16 0x10 */
+ "SEM", /* 17 0x11 */
+ "WAITCTX", /* 18 0x12 */
+ "NET_SEND", /* 19 0x13 */
+ "NET_REPLY" /* 20 0x14 */
};
const char *
@@ -388,7 +392,7 @@ nto_extra_thread_info (struct target_ops *self, struct thread_info *ti)
nto_thread_info *priv = get_nto_thread_info (ti);
if (priv->state < ARRAY_SIZE (nto_thread_state_str))
- return nto_thread_state_str [priv->state];
+ return nto_thread_state_str[priv->state];
}
return "";
}
@@ -466,8 +470,7 @@ nto_read_auxv_from_initial_stack (CORE_ADDR initial_stack, gdb_byte *readbuf,
/* Now loop over env table: */
anint = 0;
- while (target_read_memory (initial_stack + data_ofs, targ64, ptr_size)
- == 0)
+ while (target_read_memory (initial_stack + data_ofs, targ64, ptr_size) == 0)
{
if (extract_unsigned_integer (targ64, ptr_size, byte_order) == 0)
anint = 1; /* Keep looping until non-null entry is found. */
@@ -479,7 +482,7 @@ nto_read_auxv_from_initial_stack (CORE_ADDR initial_stack, gdb_byte *readbuf,
memset (readbuf, 0, len);
buff = readbuf;
- while (len_read <= len-sizeof_auxv_t)
+ while (len_read <= len - sizeof_auxv_t)
{
if (target_read_memory (initial_stack + len_read, buff, sizeof_auxv_t)
== 0)
diff --git a/gdb/nto-tdep.h b/gdb/nto-tdep.h
index ca88642c31e..af3e5752e04 100644
--- a/gdb/nto-tdep.h
+++ b/gdb/nto-tdep.h
@@ -32,7 +32,7 @@
struct nto_target_ops
{
-/* The CPUINFO flags from the remote. Currently used by
+ /* The CPUINFO flags from the remote. Currently used by
i386 for fxsave but future proofing other hosts.
This is initialized in procfs_attach or nto_start_remote
depending on our host/target. It would only be invalid
@@ -40,10 +40,10 @@ struct nto_target_ops
the cpuinfo message. */
unsigned cpuinfo_flags;
-/* True if successfully retrieved cpuinfo from remote. */
+ /* True if successfully retrieved cpuinfo from remote. */
int cpuinfo_valid;
-/* Given a register, return an id that represents the Neutrino
+ /* Given a register, return an id that represents the Neutrino
regset it came from. If reg == -1 update all regsets. */
int (*regset_id) (int);
@@ -53,24 +53,24 @@ struct nto_target_ops
void (*supply_altregset) (struct regcache *, char *);
-/* Given a regset, tell gdb about registers stored in data. */
+ /* Given a regset, tell gdb about registers stored in data. */
void (*supply_regset) (struct regcache *, int, char *);
-/* Given a register and regset, calculate the offset into the regset
+ /* Given a register and regset, calculate the offset into the regset
and stuff it into the last argument. If regno is -1, calculate the
size of the entire regset. Returns length of data, -1 if unknown
regset, 0 if unknown register. */
int (*register_area) (struct gdbarch *, int, int, unsigned *);
-/* Build the Neutrino register set info into the data buffer.
+ /* Build the Neutrino register set info into the data buffer.
Return -1 if unknown regset, 0 otherwise. */
int (*regset_fill) (const struct regcache *, int, char *);
-/* Gives the fetch_link_map_offsets function exposure outside of
+ /* Gives the fetch_link_map_offsets function exposure outside of
solib-svr4.c so that we can override relocate_section_addresses(). */
struct link_map_offsets *(*fetch_link_map_offsets) (void);
-/* Used by nto_elf_osabi_sniffer to determine if we're connected to an
+ /* Used by nto_elf_osabi_sniffer to determine if we're connected to an
Neutrino target. */
enum gdb_osabi (*is_nto_target) (bfd *abfd);
};
@@ -95,8 +95,7 @@ extern struct nto_target_ops current_nto_target;
#define nto_regset_fill (current_nto_target.regset_fill)
-#define nto_fetch_link_map_offsets \
-(current_nto_target.fetch_link_map_offsets)
+#define nto_fetch_link_map_offsets (current_nto_target.fetch_link_map_offsets)
#define nto_is_nto_target (current_nto_target.is_nto_target)
@@ -184,11 +183,12 @@ void nto_dummy_supply_regset (struct regcache *regcache, char *regs);
int nto_in_dynsym_resolve_code (CORE_ADDR pc);
-const char *nto_extra_thread_info (struct target_ops *self, struct thread_info *);
+const char *nto_extra_thread_info (struct target_ops *self,
+ struct thread_info *);
LONGEST nto_read_auxv_from_initial_stack (CORE_ADDR inital_stack,
- gdb_byte *readbuf,
- LONGEST len, size_t sizeof_auxv_t);
+ gdb_byte *readbuf, LONGEST len,
+ size_t sizeof_auxv_t);
struct nto_inferior_data *nto_inferior_data (struct inferior *inf);
diff --git a/gdb/objc-lang.c b/gdb/objc-lang.c
index e17a4c406c0..cbba81d2d70 100644
--- a/gdb/objc-lang.c
+++ b/gdb/objc-lang.c
@@ -48,14 +48,16 @@
#include <ctype.h>
#include <algorithm>
-struct objc_object {
+struct objc_object
+{
CORE_ADDR isa;
};
-struct objc_class {
- CORE_ADDR isa;
- CORE_ADDR super_class;
- CORE_ADDR name;
+struct objc_class
+{
+ CORE_ADDR isa;
+ CORE_ADDR super_class;
+ CORE_ADDR name;
long version;
long info;
long instance_size;
@@ -65,12 +67,14 @@ struct objc_class {
CORE_ADDR protocols;
};
-struct objc_super {
+struct objc_super
+{
CORE_ADDR receiver;
CORE_ADDR theclass;
};
-struct objc_method {
+struct objc_method
+{
CORE_ADDR name;
CORE_ADDR types;
CORE_ADDR imp;
@@ -93,46 +97,45 @@ lookup_struct_typedef (const char *name, const struct block *block, int noerr)
{
if (noerr)
return 0;
- else
- error (_("No struct type named %s."), name);
+ else
+ error (_ ("No struct type named %s."), name);
}
if (sym->type ()->code () != TYPE_CODE_STRUCT)
{
if (noerr)
return 0;
else
- error (_("This context has class, union or enum %s, not a struct."),
+ error (_ ("This context has class, union or enum %s, not a struct."),
name);
}
return sym;
}
-CORE_ADDR
+CORE_ADDR
lookup_objc_class (struct gdbarch *gdbarch, const char *classname)
{
struct type *char_type = builtin_type (gdbarch)->builtin_char;
- struct value * function, *classval;
+ struct value *function, *classval;
- if (! target_has_execution ())
+ if (!target_has_execution ())
{
/* Can't call into inferior to lookup class. */
return 0;
}
- if (lookup_minimal_symbol("objc_lookUpClass", 0, 0).minsym)
- function = find_function_in_inferior("objc_lookUpClass", NULL);
+ if (lookup_minimal_symbol ("objc_lookUpClass", 0, 0).minsym)
+ function = find_function_in_inferior ("objc_lookUpClass", NULL);
else if (lookup_minimal_symbol ("objc_lookup_class", 0, 0).minsym)
- function = find_function_in_inferior("objc_lookup_class", NULL);
+ function = find_function_in_inferior ("objc_lookup_class", NULL);
else
{
- complaint (_("no way to lookup Objective-C classes"));
+ complaint (_ ("no way to lookup Objective-C classes"));
return 0;
}
classval = value_string (classname, strlen (classname) + 1, char_type);
classval = value_coerce_array (classval);
- return (CORE_ADDR) value_as_long (call_function_by_hand (function,
- NULL,
+ return (CORE_ADDR) value_as_long (call_function_by_hand (function, NULL,
classval));
}
@@ -140,31 +143,30 @@ CORE_ADDR
lookup_child_selector (struct gdbarch *gdbarch, const char *selname)
{
struct type *char_type = builtin_type (gdbarch)->builtin_char;
- struct value * function, *selstring;
+ struct value *function, *selstring;
- if (! target_has_execution ())
+ if (!target_has_execution ())
{
/* Can't call into inferior to lookup selector. */
return 0;
}
- if (lookup_minimal_symbol("sel_getUid", 0, 0).minsym)
- function = find_function_in_inferior("sel_getUid", NULL);
+ if (lookup_minimal_symbol ("sel_getUid", 0, 0).minsym)
+ function = find_function_in_inferior ("sel_getUid", NULL);
else if (lookup_minimal_symbol ("sel_get_any_uid", 0, 0).minsym)
- function = find_function_in_inferior("sel_get_any_uid", NULL);
+ function = find_function_in_inferior ("sel_get_any_uid", NULL);
else
{
- complaint (_("no way to lookup Objective-C selectors"));
+ complaint (_ ("no way to lookup Objective-C selectors"));
return 0;
}
- selstring = value_coerce_array (value_string (selname,
- strlen (selname) + 1,
+ selstring = value_coerce_array (value_string (selname, strlen (selname) + 1,
char_type));
return value_as_long (call_function_by_hand (function, NULL, selstring));
}
-struct value *
+struct value *
value_nsstring (struct gdbarch *gdbarch, const char *ptr, int len)
{
struct type *char_type = builtin_type (gdbarch)->builtin_char;
@@ -174,43 +176,44 @@ value_nsstring (struct gdbarch *gdbarch, const char *ptr, int len)
struct type *type;
if (!target_has_execution ())
- return 0; /* Can't call into inferior to create NSString. */
+ return 0; /* Can't call into inferior to create NSString. */
- stringValue[2] = value_string(ptr, len, char_type);
- stringValue[2] = value_coerce_array(stringValue[2]);
+ stringValue[2] = value_string (ptr, len, char_type);
+ stringValue[2] = value_coerce_array (stringValue[2]);
/* _NSNewStringFromCString replaces "istr" after Lantern2A. */
- if (lookup_minimal_symbol("_NSNewStringFromCString", 0, 0).minsym)
+ if (lookup_minimal_symbol ("_NSNewStringFromCString", 0, 0).minsym)
{
- function = find_function_in_inferior("_NSNewStringFromCString", NULL);
- nsstringValue = call_function_by_hand(function, NULL, stringValue[2]);
+ function = find_function_in_inferior ("_NSNewStringFromCString", NULL);
+ nsstringValue = call_function_by_hand (function, NULL, stringValue[2]);
}
- else if (lookup_minimal_symbol("istr", 0, 0).minsym)
+ else if (lookup_minimal_symbol ("istr", 0, 0).minsym)
{
- function = find_function_in_inferior("istr", NULL);
- nsstringValue = call_function_by_hand(function, NULL, stringValue[2]);
+ function = find_function_in_inferior ("istr", NULL);
+ nsstringValue = call_function_by_hand (function, NULL, stringValue[2]);
}
- else if (lookup_minimal_symbol("+[NSString stringWithCString:]", 0, 0).minsym)
+ else if (
+ lookup_minimal_symbol ("+[NSString stringWithCString:]", 0, 0).minsym)
{
function
- = find_function_in_inferior("+[NSString stringWithCString:]", NULL);
+ = find_function_in_inferior ("+[NSString stringWithCString:]", NULL);
type = builtin_type (gdbarch)->builtin_long;
- stringValue[0] = value_from_longest
- (type, lookup_objc_class (gdbarch, "NSString"));
- stringValue[1] = value_from_longest
- (type, lookup_child_selector (gdbarch, "stringWithCString:"));
- nsstringValue = call_function_by_hand(function, NULL, stringValue);
+ stringValue[0]
+ = value_from_longest (type, lookup_objc_class (gdbarch, "NSString"));
+ stringValue[1] = value_from_longest (
+ type, lookup_child_selector (gdbarch, "stringWithCString:"));
+ nsstringValue = call_function_by_hand (function, NULL, stringValue);
}
else
- error (_("NSString: internal error -- no way to create new NSString"));
+ error (_ ("NSString: internal error -- no way to create new NSString"));
- sym = lookup_struct_typedef("NSString", 0, 1);
+ sym = lookup_struct_typedef ("NSString", 0, 1);
if (sym == NULL)
- sym = lookup_struct_typedef("NXString", 0, 1);
+ sym = lookup_struct_typedef ("NXString", 0, 1);
if (sym == NULL)
type = builtin_type (gdbarch)->builtin_data_ptr;
else
- type = lookup_pointer_type(sym->type ());
+ type = lookup_pointer_type (sym->type ());
deprecated_set_value_type (nsstringValue, type);
return nsstringValue;
@@ -221,19 +224,19 @@ value_nsstring (struct gdbarch *gdbarch, const char *ptr, int len)
class objc_language : public language_defn
{
public:
+
objc_language ()
: language_defn (language_objc)
- { /* Nothing. */ }
+ { /* Nothing. */
+ }
/* See language.h. */
- const char *name () const override
- { return "objective-c"; }
+ const char *name () const override { return "objective-c"; }
/* See language.h. */
- const char *natural_name () const override
- { return "Objective-C"; }
+ const char *natural_name () const override { return "Objective-C"; }
/* See language.h. */
@@ -251,9 +254,9 @@ public:
}
/* See language.h. */
- bool sniff_from_mangled_name
- (const char *mangled, gdb::unique_xmalloc_ptr<char> *demangled)
- const override
+ bool sniff_from_mangled_name (
+ const char *mangled,
+ gdb::unique_xmalloc_ptr<char> *demangled) const override
{
*demangled = demangle_symbol (mangled, 0);
return *demangled != NULL;
@@ -266,10 +269,7 @@ public:
/* See language.h. */
- bool can_print_type_offsets () const override
- {
- return true;
- }
+ bool can_print_type_offsets () const override { return true; }
/* See language.h. */
@@ -305,8 +305,8 @@ public:
if (method_stop_pc)
{
- real_stop_pc = gdbarch_skip_trampoline_code
- (gdbarch, frame, method_stop_pc);
+ real_stop_pc
+ = gdbarch_skip_trampoline_code (gdbarch, frame, method_stop_pc);
if (real_stop_pc == 0)
real_stop_pc = method_stop_pc;
}
@@ -316,13 +316,14 @@ public:
/* See language.h. */
- const char *name_of_this () const override
- { return "self"; }
+ const char *name_of_this () const override { return "self"; }
/* See language.h. */
enum macro_expansion macro_expansion () const override
- { return macro_expansion_c; }
+ {
+ return macro_expansion_c;
+ }
};
/* See declaration of objc_language::demangle_symbol above. */
@@ -332,63 +333,62 @@ objc_language::demangle_symbol (const char *mangled, int options) const
{
char *demangled, *cp;
- if (mangled[0] == '_'
- && (mangled[1] == 'i' || mangled[1] == 'c')
+ if (mangled[0] == '_' && (mangled[1] == 'i' || mangled[1] == 'c')
&& mangled[2] == '_')
{
cp = demangled = (char *) xmalloc (strlen (mangled) + 2);
if (mangled[1] == 'i')
- *cp++ = '-'; /* for instance method */
+ *cp++ = '-'; /* for instance method */
else
- *cp++ = '+'; /* for class method */
+ *cp++ = '+'; /* for class method */
*cp++ = '['; /* opening left brace */
- strcpy(cp, mangled+3); /* Tack on the rest of the mangled name. */
+ strcpy (cp, mangled + 3); /* Tack on the rest of the mangled name. */
while (*cp != '\0' && *cp == '_')
- cp++; /* Skip any initial underbars in class
+ cp++; /* Skip any initial underbars in class
name. */
- cp = strchr(cp, '_');
- if (cp == nullptr) /* Find first non-initial underbar. */
+ cp = strchr (cp, '_');
+ if (cp == nullptr) /* Find first non-initial underbar. */
{
- xfree(demangled); /* not mangled name */
+ xfree (demangled); /* not mangled name */
return nullptr;
}
- if (cp[1] == '_') /* Easy case: no category name. */
+ if (cp[1] == '_') /* Easy case: no category name. */
{
- *cp++ = ' '; /* Replace two '_' with one ' '. */
- strcpy(cp, mangled + (cp - demangled) + 2);
+ *cp++ = ' '; /* Replace two '_' with one ' '. */
+ strcpy (cp, mangled + (cp - demangled) + 2);
}
else
{
- *cp++ = '('; /* Less easy case: category name. */
- cp = strchr(cp, '_');
+ *cp++ = '('; /* Less easy case: category name. */
+ cp = strchr (cp, '_');
if (cp == nullptr)
{
- xfree(demangled); /* not mangled name */
+ xfree (demangled); /* not mangled name */
return nullptr;
}
*cp++ = ')';
- *cp++ = ' '; /* Overwriting 1st char of method name... */
- strcpy(cp, mangled + (cp - demangled)); /* Get it back. */
+ *cp++ = ' '; /* Overwriting 1st char of method name... */
+ strcpy (cp, mangled + (cp - demangled)); /* Get it back. */
}
while (*cp != '\0' && *cp == '_')
- cp++; /* Skip any initial underbars in
+ cp++; /* Skip any initial underbars in
method name. */
for (; *cp != '\0'; cp++)
if (*cp == '_')
- *cp = ':'; /* Replace remaining '_' with ':'. */
+ *cp = ':'; /* Replace remaining '_' with ':'. */
- *cp++ = ']'; /* closing right brace */
- *cp++ = 0; /* string terminator */
+ *cp++ = ']'; /* closing right brace */
+ *cp++ = 0; /* string terminator */
return gdb::unique_xmalloc_ptr<char> (demangled);
}
else
- return nullptr; /* Not an objc mangled name. */
+ return nullptr; /* Not an objc mangled name. */
}
/* Single instance of the class representing the Objective-C language. */
@@ -400,19 +400,19 @@ static objc_language objc_language_defn;
* Following functions help construct Objective-C message calls.
*/
-struct selname /* For parsing Objective-C. */
- {
- struct selname *next;
- char *msglist_sel;
- int msglist_len;
- };
+struct selname /* For parsing Objective-C. */
+{
+ struct selname *next;
+ char *msglist_sel;
+ int msglist_len;
+};
static int msglist_len;
static struct selname *selname_chain;
static char *msglist_sel;
void
-start_msglist(void)
+start_msglist (void)
{
struct selname *newobj = XNEW (struct selname);
@@ -420,21 +420,21 @@ start_msglist(void)
newobj->msglist_len = msglist_len;
newobj->msglist_sel = msglist_sel;
msglist_len = 0;
- msglist_sel = (char *)xmalloc(1);
+ msglist_sel = (char *) xmalloc (1);
*msglist_sel = 0;
selname_chain = newobj;
}
void
-add_msglist(struct stoken *str, int addcolon)
+add_msglist (struct stoken *str, int addcolon)
{
char *s;
const char *p;
int len, plen;
- if (str == 0) /* Unnamed arg, or... */
+ if (str == 0) /* Unnamed arg, or... */
{
- if (addcolon == 0) /* variable number of args. */
+ if (addcolon == 0) /* variable number of args. */
{
msglist_len++;
return;
@@ -447,20 +447,20 @@ add_msglist(struct stoken *str, int addcolon)
p = str->ptr;
plen = str->length;
}
- len = plen + strlen(msglist_sel) + 2;
- s = (char *)xmalloc(len);
- strcpy(s, msglist_sel);
- strncat(s, p, plen);
- xfree(msglist_sel);
+ len = plen + strlen (msglist_sel) + 2;
+ s = (char *) xmalloc (len);
+ strcpy (s, msglist_sel);
+ strncat (s, p, plen);
+ xfree (msglist_sel);
msglist_sel = s;
if (addcolon)
{
- s[len-2] = ':';
- s[len-1] = 0;
+ s[len - 2] = ':';
+ s[len - 1] = 0;
msglist_len++;
}
else
- s[len-2] = '\0';
+ s[len - 2] = '\0';
}
int
@@ -479,13 +479,13 @@ end_msglist (struct parser_state *ps)
msglist_sel = sel->msglist_sel;
selid = lookup_child_selector (ps->gdbarch (), p);
if (!selid)
- error (_("Can't find selector \"%s\""), p);
+ error (_ ("Can't find selector \"%s\""), p);
ps->push_new<expr::objc_msgcall_operation> (selid, std::move (target),
std::move (args));
- xfree(p);
- xfree(sel);
+ xfree (p);
+ xfree (sel);
return val;
}
@@ -507,10 +507,10 @@ specialcmp (const char *a, const char *b)
a++, b++;
}
if (*a && *a != ' ' && *a != ']')
- return 1; /* a is longer therefore greater. */
+ return 1; /* a is longer therefore greater. */
if (*b && *b != ' ' && *b != ']')
- return -1; /* a is shorter therefore lesser. */
- return 0; /* a and b are identical. */
+ return -1; /* a is shorter therefore lesser. */
+ return 0; /* a and b are identical. */
}
/*
@@ -528,14 +528,14 @@ compare_selectors (const void *a, const void *b)
aname = (*(struct symbol **) a)->print_name ();
bname = (*(struct symbol **) b)->print_name ();
if (aname == NULL || bname == NULL)
- error (_("internal: compare_selectors(1)"));
+ error (_ ("internal: compare_selectors(1)"));
- aname = strchr(aname, ' ');
- bname = strchr(bname, ' ');
+ aname = strchr (aname, ' ');
+ bname = strchr (bname, ' ');
if (aname == NULL || bname == NULL)
- error (_("internal: compare_selectors(2)"));
+ error (_ ("internal: compare_selectors(2)"));
- return specialcmp (aname+1, bname+1);
+ return specialcmp (aname + 1, bname + 1);
}
/*
@@ -550,18 +550,18 @@ compare_selectors (const void *a, const void *b)
static void
info_selectors_command (const char *regexp, int from_tty)
{
- const char *name;
- char *val;
- int matches = 0;
- int maxlen = 0;
- int ix;
- char myregexp[2048];
- char asel[256];
- struct symbol **sym_arr;
- int plusminus = 0;
+ const char *name;
+ char *val;
+ int matches = 0;
+ int maxlen = 0;
+ int ix;
+ char myregexp[2048];
+ char asel[256];
+ struct symbol **sym_arr;
+ int plusminus = 0;
if (regexp == NULL)
- strcpy(myregexp, ".*]"); /* Null input, match all objc methods. */
+ strcpy (myregexp, ".*]"); /* Null input, match all objc methods. */
else
{
if (*regexp == '+' || *regexp == '-')
@@ -571,17 +571,17 @@ info_selectors_command (const char *regexp, int from_tty)
regexp++;
}
if (*regexp == '\0')
- strcpy(myregexp, ".*]");
+ strcpy (myregexp, ".*]");
else
{
/* Allow a few extra bytes because of the strcat below. */
if (sizeof (myregexp) < strlen (regexp) + 4)
- error (_("Regexp is too long: %s"), regexp);
- strcpy(myregexp, regexp);
- if (myregexp[strlen(myregexp) - 1] == '$') /* end of selector */
- myregexp[strlen(myregexp) - 1] = ']'; /* end of method name */
+ error (_ ("Regexp is too long: %s"), regexp);
+ strcpy (myregexp, regexp);
+ if (myregexp[strlen (myregexp) - 1] == '$') /* end of selector */
+ myregexp[strlen (myregexp) - 1] = ']'; /* end of method name */
else
- strcat(myregexp, ".*]");
+ strcat (myregexp, ".*]");
}
}
@@ -589,7 +589,7 @@ info_selectors_command (const char *regexp, int from_tty)
{
val = re_comp (myregexp);
if (val != 0)
- error (_("Invalid regexp (%s): %s"), val, regexp);
+ error (_ ("Invalid regexp (%s): %s"), val, regexp);
}
/* First time thru is JUST to get max length and count. */
@@ -599,28 +599,27 @@ info_selectors_command (const char *regexp, int from_tty)
{
QUIT;
name = msymbol->natural_name ();
- if (name
- && (name[0] == '-' || name[0] == '+')
- && name[1] == '[') /* Got a method name. */
+ if (name && (name[0] == '-' || name[0] == '+')
+ && name[1] == '[') /* Got a method name. */
{
/* Filter for class/instance methods. */
if (plusminus && name[0] != plusminus)
continue;
/* Find selector part. */
- name = (char *) strchr (name+2, ' ');
+ name = (char *) strchr (name + 2, ' ');
if (name == NULL)
{
- complaint (_("Bad method name '%s'"),
+ complaint (_ ("Bad method name '%s'"),
msymbol->natural_name ());
continue;
}
- if (regexp == NULL || re_exec(++name) != 0)
- {
+ if (regexp == NULL || re_exec (++name) != 0)
+ {
const char *mystart = name;
- const char *myend = strchr (mystart, ']');
-
+ const char *myend = strchr (mystart, ']');
+
if (myend && (myend - mystart > maxlen))
- maxlen = myend - mystart; /* Get longest selector. */
+ maxlen = myend - mystart; /* Get longest selector. */
matches++;
}
}
@@ -628,8 +627,7 @@ info_selectors_command (const char *regexp, int from_tty)
}
if (matches)
{
- gdb_printf (_("Selectors matching \"%s\":\n\n"),
- regexp ? regexp : "*");
+ gdb_printf (_ ("Selectors matching \"%s\":\n\n"), regexp ? regexp : "*");
sym_arr = XALLOCAVEC (struct symbol *, matches);
matches = 0;
@@ -639,47 +637,45 @@ info_selectors_command (const char *regexp, int from_tty)
{
QUIT;
name = msymbol->natural_name ();
- if (name &&
- (name[0] == '-' || name[0] == '+') &&
- name[1] == '[') /* Got a method name. */
+ if (name && (name[0] == '-' || name[0] == '+')
+ && name[1] == '[') /* Got a method name. */
{
/* Filter for class/instance methods. */
if (plusminus && name[0] != plusminus)
continue;
/* Find selector part. */
- name = (char *) strchr(name+2, ' ');
- if (regexp == NULL || re_exec(++name) != 0)
+ name = (char *) strchr (name + 2, ' ');
+ if (regexp == NULL || re_exec (++name) != 0)
sym_arr[matches++] = (struct symbol *) msymbol;
}
}
}
- qsort (sym_arr, matches, sizeof (struct minimal_symbol *),
+ qsort (sym_arr, matches, sizeof (struct minimal_symbol *),
compare_selectors);
/* Prevent compare on first iteration. */
asel[0] = 0;
- for (ix = 0; ix < matches; ix++) /* Now do the output. */
+ for (ix = 0; ix < matches; ix++) /* Now do the output. */
{
char *p = asel;
QUIT;
name = sym_arr[ix]->natural_name ();
name = strchr (name, ' ') + 1;
- if (p[0] && specialcmp(name, p) == 0)
- continue; /* Seen this one already (not unique). */
+ if (p[0] && specialcmp (name, p) == 0)
+ continue; /* Seen this one already (not unique). */
/* Copy selector part. */
while (*name && *name != ']')
*p++ = *name++;
*p++ = '\0';
/* Print in columns. */
- puts_tabular(asel, maxlen + 1, 0);
+ puts_tabular (asel, maxlen + 1, 0);
}
- begin_line();
+ begin_line ();
}
else
- gdb_printf (_("No selectors matching \"%s\"\n"),
- regexp ? regexp : "*");
+ gdb_printf (_ ("No selectors matching \"%s\"\n"), regexp ? regexp : "*");
}
/*
@@ -697,9 +693,9 @@ compare_classes (const void *a, const void *b)
aname = (*(struct symbol **) a)->print_name ();
bname = (*(struct symbol **) b)->print_name ();
if (aname == NULL || bname == NULL)
- error (_("internal: compare_classes(1)"));
+ error (_ ("internal: compare_classes(1)"));
- return specialcmp (aname+1, bname+1);
+ return specialcmp (aname + 1, bname + 1);
}
/*
@@ -715,35 +711,35 @@ compare_classes (const void *a, const void *b)
static void
info_classes_command (const char *regexp, int from_tty)
{
- const char *name;
- char *val;
- int matches = 0;
- int maxlen = 0;
- int ix;
- char myregexp[2048];
- char aclass[256];
- struct symbol **sym_arr;
+ const char *name;
+ char *val;
+ int matches = 0;
+ int maxlen = 0;
+ int ix;
+ char myregexp[2048];
+ char aclass[256];
+ struct symbol **sym_arr;
if (regexp == NULL)
- strcpy(myregexp, ".* "); /* Null input: match all objc classes. */
+ strcpy (myregexp, ".* "); /* Null input: match all objc classes. */
else
{
/* Allow a few extra bytes because of the strcat below. */
if (sizeof (myregexp) < strlen (regexp) + 4)
- error (_("Regexp is too long: %s"), regexp);
- strcpy(myregexp, regexp);
- if (myregexp[strlen(myregexp) - 1] == '$')
+ error (_ ("Regexp is too long: %s"), regexp);
+ strcpy (myregexp, regexp);
+ if (myregexp[strlen (myregexp) - 1] == '$')
/* In the method name, the end of the class name is marked by ' '. */
- myregexp[strlen(myregexp) - 1] = ' ';
+ myregexp[strlen (myregexp) - 1] = ' ';
else
- strcat(myregexp, ".* ");
+ strcat (myregexp, ".* ");
}
if (regexp != NULL)
{
val = re_comp (myregexp);
if (val != 0)
- error (_("Invalid regexp (%s): %s"), val, regexp);
+ error (_ ("Invalid regexp (%s): %s"), val, regexp);
}
/* First time thru is JUST to get max length and count. */
@@ -753,15 +749,14 @@ info_classes_command (const char *regexp, int from_tty)
{
QUIT;
name = msymbol->natural_name ();
- if (name &&
- (name[0] == '-' || name[0] == '+') &&
- name[1] == '[') /* Got a method name. */
- if (regexp == NULL || re_exec(name+2) != 0)
- {
+ if (name && (name[0] == '-' || name[0] == '+')
+ && name[1] == '[') /* Got a method name. */
+ if (regexp == NULL || re_exec (name + 2) != 0)
+ {
/* Compute length of classname part. */
const char *mystart = name + 2;
- const char *myend = strchr (mystart, ' ');
-
+ const char *myend = strchr (mystart, ' ');
+
if (myend && (myend - mystart > maxlen))
maxlen = myend - mystart;
matches++;
@@ -770,8 +765,7 @@ info_classes_command (const char *regexp, int from_tty)
}
if (matches)
{
- gdb_printf (_("Classes matching \"%s\":\n\n"),
- regexp ? regexp : "*");
+ gdb_printf (_ ("Classes matching \"%s\":\n\n"), regexp ? regexp : "*");
sym_arr = XALLOCAVEC (struct symbol *, matches);
matches = 0;
for (objfile *objfile : current_program_space->objfiles ())
@@ -780,42 +774,41 @@ info_classes_command (const char *regexp, int from_tty)
{
QUIT;
name = msymbol->natural_name ();
- if (name &&
- (name[0] == '-' || name[0] == '+') &&
- name[1] == '[') /* Got a method name. */
- if (regexp == NULL || re_exec(name+2) != 0)
+ if (name && (name[0] == '-' || name[0] == '+')
+ && name[1] == '[') /* Got a method name. */
+ if (regexp == NULL || re_exec (name + 2) != 0)
sym_arr[matches++] = (struct symbol *) msymbol;
}
}
- qsort (sym_arr, matches, sizeof (struct minimal_symbol *),
+ qsort (sym_arr, matches, sizeof (struct minimal_symbol *),
compare_classes);
/* Prevent compare on first iteration. */
aclass[0] = 0;
- for (ix = 0; ix < matches; ix++) /* Now do the output. */
+ for (ix = 0; ix < matches; ix++) /* Now do the output. */
{
char *p = aclass;
QUIT;
name = sym_arr[ix]->natural_name ();
name += 2;
- if (p[0] && specialcmp(name, p) == 0)
- continue; /* Seen this one already (not unique). */
+ if (p[0] && specialcmp (name, p) == 0)
+ continue; /* Seen this one already (not unique). */
/* Copy class part of method name. */
while (*name && *name != ' ')
*p++ = *name++;
*p++ = '\0';
/* Print in columns. */
- puts_tabular(aclass, maxlen + 1, 0);
+ puts_tabular (aclass, maxlen + 1, 0);
}
- begin_line();
+ begin_line ();
}
else
- gdb_printf (_("No classes matching \"%s\"\n"), regexp ? regexp : "*");
+ gdb_printf (_ ("No classes matching \"%s\"\n"), regexp ? regexp : "*");
}
-static char *
+static char *
parse_selector (char *method, char **selector)
{
char *s1 = NULL;
@@ -829,13 +822,13 @@ parse_selector (char *method, char **selector)
s1 = method;
s1 = skip_spaces (s1);
- if (*s1 == '\'')
+ if (*s1 == '\'')
{
found_quote = 1;
s1++;
}
s1 = skip_spaces (s1);
-
+
nselector = s1;
s2 = s1;
@@ -856,7 +849,7 @@ parse_selector (char *method, char **selector)
s2 = skip_spaces (s2);
if (found_quote)
{
- if (*s2 == '\'')
+ if (*s2 == '\'')
s2++;
s2 = skip_spaces (s2);
}
@@ -867,9 +860,9 @@ parse_selector (char *method, char **selector)
return s2;
}
-static char *
-parse_method (char *method, char *type, char **theclass,
- char **category, char **selector)
+static char *
+parse_method (char *method, char *type, char **theclass, char **category,
+ char **selector)
{
char *s1 = NULL;
char *s2 = NULL;
@@ -884,17 +877,17 @@ parse_method (char *method, char *type, char **theclass,
gdb_assert (theclass != NULL);
gdb_assert (category != NULL);
gdb_assert (selector != NULL);
-
+
s1 = method;
s1 = skip_spaces (s1);
- if (*s1 == '\'')
+ if (*s1 == '\'')
{
found_quote = 1;
s1++;
}
s1 = skip_spaces (s1);
-
+
if ((s1[0] == '+') || (s1[0] == '-'))
ntype = *s1++;
@@ -907,10 +900,10 @@ parse_method (char *method, char *type, char **theclass,
nclass = s1;
while (isalnum (*s1) || (*s1 == '_'))
s1++;
-
+
s2 = s1;
s2 = skip_spaces (s2);
-
+
if (*s2 == '(')
{
s2++;
@@ -945,7 +938,7 @@ parse_method (char *method, char *type, char **theclass,
s2 = skip_spaces (s2);
if (found_quote)
{
- if (*s2 != '\'')
+ if (*s2 != '\'')
return NULL;
s2++;
s2 = skip_spaces (s2);
@@ -964,9 +957,8 @@ parse_method (char *method, char *type, char **theclass,
}
static void
-find_methods (char type, const char *theclass, const char *category,
- const char *selector,
- std::vector<const char *> *symbol_names)
+find_methods (char type, const char *theclass, const char *category,
+ const char *selector, std::vector<const char *> *symbol_names)
{
const char *symname = NULL;
@@ -1020,8 +1012,8 @@ find_methods (char type, const char *theclass, const char *category,
}
strcpy (tmp, symname);
- if (parse_method (tmp, &ntype, &nclass,
- &ncategory, &nselector) == NULL)
+ if (parse_method (tmp, &ntype, &nclass, &ncategory, &nselector)
+ == NULL)
continue;
if ((type != '\0') && (ntype != type))
@@ -1031,12 +1023,12 @@ find_methods (char type, const char *theclass, const char *category,
&& ((nclass == NULL) || (strcmp (theclass, nclass) != 0)))
continue;
- if ((category != NULL) &&
- ((ncategory == NULL) || (strcmp (category, ncategory) != 0)))
+ if ((category != NULL)
+ && ((ncategory == NULL) || (strcmp (category, ncategory) != 0)))
continue;
- if ((selector != NULL) &&
- ((nselector == NULL) || (strcmp (selector, nselector) != 0)))
+ if ((selector != NULL)
+ && ((nselector == NULL) || (strcmp (selector, nselector) != 0)))
continue;
symbol_names->push_back (symname);
@@ -1129,17 +1121,17 @@ find_imps (const char *method, std::vector<const char *> *symbol_names)
add the selector itself as a symbol, if it exists. */
if (selector_case && !symbol_names->empty ())
{
- struct symbol *sym = lookup_symbol (selector, NULL, VAR_DOMAIN,
- 0).symbol;
+ struct symbol *sym
+ = lookup_symbol (selector, NULL, VAR_DOMAIN, 0).symbol;
- if (sym != NULL)
+ if (sym != NULL)
symbol_names->push_back (sym->natural_name ());
else
{
struct bound_minimal_symbol msym
= lookup_minimal_symbol (selector, 0, 0);
- if (msym.minsym != NULL)
+ if (msym.minsym != NULL)
symbol_names->push_back (msym.minsym->natural_name ());
}
}
@@ -1149,7 +1141,7 @@ find_imps (const char *method, std::vector<const char *> *symbol_names)
return method + (tmp - buf);
}
-static void
+static void
print_object_command (const char *args, int from_tty)
{
struct value *object, *function, *description;
@@ -1158,8 +1150,8 @@ print_object_command (const char *args, int from_tty)
gdb_byte c = 0;
if (!args || !*args)
- error (
-"The 'print-object' command requires an argument (an Objective-C object)");
+ error ("The 'print-object' command requires an argument (an Objective-C "
+ "object)");
{
expression_up expr = parse_expression (args);
@@ -1175,13 +1167,13 @@ print_object_command (const char *args, int from_tty)
function = find_function_in_inferior ("_NSPrintForDebugger", NULL);
if (function == NULL)
- error (_("Unable to locate _NSPrintForDebugger in child process"));
+ error (_ ("Unable to locate _NSPrintForDebugger in child process"));
description = call_function_by_hand (function, NULL, object);
string_addr = value_as_long (description);
if (string_addr == 0)
- error (_("object returns null description"));
+ error (_ ("object returns null description"));
read_memory (string_addr + i++, &c, 1);
if (c != 0)
@@ -1190,9 +1182,10 @@ print_object_command (const char *args, int from_tty)
QUIT;
gdb_printf ("%c", c);
read_memory (string_addr + i++, &c, 1);
- } while (c != 0);
+ }
+ while (c != 0);
else
- gdb_printf(_("<object returns empty description>"));
+ gdb_printf (_ ("<object returns empty description>"));
gdb_printf ("\n");
}
@@ -1201,9 +1194,10 @@ print_object_command (const char *args, int from_tty)
* and ultimately find the method being called.
*/
-struct objc_methcall {
+struct objc_methcall
+{
const char *name;
- /* Return instance method to be called. */
+ /* Return instance method to be called. */
int (*stop_at) (CORE_ADDR, CORE_ADDR *);
/* Start of pc range corresponding to method invocation. */
CORE_ADDR begin;
@@ -1216,14 +1210,13 @@ static int resolve_msgsend_stret (CORE_ADDR pc, CORE_ADDR *new_pc);
static int resolve_msgsend_super (CORE_ADDR pc, CORE_ADDR *new_pc);
static int resolve_msgsend_super_stret (CORE_ADDR pc, CORE_ADDR *new_pc);
-static struct objc_methcall methcalls[] = {
- { "_objc_msgSend", resolve_msgsend, 0, 0},
- { "_objc_msgSend_stret", resolve_msgsend_stret, 0, 0},
- { "_objc_msgSendSuper", resolve_msgsend_super, 0, 0},
- { "_objc_msgSendSuper_stret", resolve_msgsend_super_stret, 0, 0},
- { "_objc_getClass", NULL, 0, 0},
- { "_objc_getMetaClass", NULL, 0, 0}
-};
+static struct objc_methcall methcalls[]
+ = { { "_objc_msgSend", resolve_msgsend, 0, 0 },
+ { "_objc_msgSend_stret", resolve_msgsend_stret, 0, 0 },
+ { "_objc_msgSendSuper", resolve_msgsend_super, 0, 0 },
+ { "_objc_msgSendSuper_stret", resolve_msgsend_super_stret, 0, 0 },
+ { "_objc_getClass", NULL, 0, 0 },
+ { "_objc_getMetaClass", NULL, 0, 0 } };
#define nmethcalls (sizeof (methcalls) / sizeof (methcalls[0]))
@@ -1234,7 +1227,7 @@ static struct objc_methcall methcalls[] = {
* case the functions have moved for some reason.
*/
-static void
+static void
find_objc_msgsend (void)
{
unsigned int i;
@@ -1250,10 +1243,10 @@ find_objc_msgsend (void)
func = lookup_bound_minimal_symbol (methcalls[i].name + 1);
}
if (func.minsym == NULL)
- {
+ {
methcalls[i].begin = 0;
methcalls[i].end = 0;
- continue;
+ continue;
}
methcalls[i].begin = func.value_address ();
@@ -1276,9 +1269,8 @@ find_objc_msgsend (void)
* dependent modules.
*/
-static int
-find_objc_msgcall_submethod (int (*f) (CORE_ADDR, CORE_ADDR *),
- CORE_ADDR pc,
+static int
+find_objc_msgcall_submethod (int (*f) (CORE_ADDR, CORE_ADDR *), CORE_ADDR pc,
CORE_ADDR *new_pc)
{
try
@@ -1296,7 +1288,7 @@ find_objc_msgcall_submethod (int (*f) (CORE_ADDR, CORE_ADDR *),
return 0;
}
-int
+int
find_objc_msgcall (CORE_ADDR pc, CORE_ADDR *new_pc)
{
unsigned int i;
@@ -1307,13 +1299,13 @@ find_objc_msgcall (CORE_ADDR pc, CORE_ADDR *new_pc)
*new_pc = 0;
}
- for (i = 0; i < nmethcalls; i++)
- if ((pc >= methcalls[i].begin) && (pc < methcalls[i].end))
+ for (i = 0; i < nmethcalls; i++)
+ if ((pc >= methcalls[i].begin) && (pc < methcalls[i].end))
{
- if (methcalls[i].stop_at != NULL)
- return find_objc_msgcall_submethod (methcalls[i].stop_at,
- pc, new_pc);
- else
+ if (methcalls[i].stop_at != NULL)
+ return find_objc_msgcall_submethod (methcalls[i].stop_at, pc,
+ new_pc);
+ else
return 0;
}
@@ -1321,28 +1313,29 @@ find_objc_msgcall (CORE_ADDR pc, CORE_ADDR *new_pc)
}
void _initialize_objc_language ();
+
void
_initialize_objc_language ()
{
add_info ("selectors", info_selectors_command,
- _("All Objective-C selectors, or those matching REGEXP."));
+ _ ("All Objective-C selectors, or those matching REGEXP."));
add_info ("classes", info_classes_command,
- _("All Objective-C classes, or those matching REGEXP."));
+ _ ("All Objective-C classes, or those matching REGEXP."));
cmd_list_element *print_object_cmd
= add_com ("print-object", class_vars, print_object_command,
- _("Ask an Objective-C object to print itself."));
+ _ ("Ask an Objective-C object to print itself."));
add_com_alias ("po", print_object_cmd, class_vars, 1);
}
-static void
+static void
read_objc_method (struct gdbarch *gdbarch, CORE_ADDR addr,
struct objc_method *method)
{
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
- method->name = read_memory_unsigned_integer (addr + 0, 4, byte_order);
+ method->name = read_memory_unsigned_integer (addr + 0, 4, byte_order);
method->types = read_memory_unsigned_integer (addr + 4, 4, byte_order);
- method->imp = read_memory_unsigned_integer (addr + 8, 4, byte_order);
+ method->imp = read_memory_unsigned_integer (addr + 8, 4, byte_order);
}
static unsigned long
@@ -1353,15 +1346,15 @@ read_objc_methlist_nmethods (struct gdbarch *gdbarch, CORE_ADDR addr)
return read_memory_unsigned_integer (addr + 4, 4, byte_order);
}
-static void
+static void
read_objc_methlist_method (struct gdbarch *gdbarch, CORE_ADDR addr,
unsigned long num, struct objc_method *method)
{
gdb_assert (num < read_objc_methlist_nmethods (gdbarch, addr));
read_objc_method (gdbarch, addr + 8 + (12 * num), method);
}
-
-static void
+
+static void
read_objc_object (struct gdbarch *gdbarch, CORE_ADDR addr,
struct objc_object *object)
{
@@ -1370,7 +1363,7 @@ read_objc_object (struct gdbarch *gdbarch, CORE_ADDR addr,
object->isa = read_memory_unsigned_integer (addr, 4, byte_order);
}
-static void
+static void
read_objc_super (struct gdbarch *gdbarch, CORE_ADDR addr,
struct objc_super *super)
{
@@ -1380,61 +1373,62 @@ read_objc_super (struct gdbarch *gdbarch, CORE_ADDR addr,
super->theclass = read_memory_unsigned_integer (addr + 4, 4, byte_order);
};
-static void
+static void
read_objc_class (struct gdbarch *gdbarch, CORE_ADDR addr,
struct objc_class *theclass)
{
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
theclass->isa = read_memory_unsigned_integer (addr, 4, byte_order);
- theclass->super_class = read_memory_unsigned_integer (addr + 4, 4, byte_order);
+ theclass->super_class
+ = read_memory_unsigned_integer (addr + 4, 4, byte_order);
theclass->name = read_memory_unsigned_integer (addr + 8, 4, byte_order);
theclass->version = read_memory_unsigned_integer (addr + 12, 4, byte_order);
theclass->info = read_memory_unsigned_integer (addr + 16, 4, byte_order);
- theclass->instance_size = read_memory_unsigned_integer (addr + 18, 4,
- byte_order);
+ theclass->instance_size
+ = read_memory_unsigned_integer (addr + 18, 4, byte_order);
theclass->ivars = read_memory_unsigned_integer (addr + 24, 4, byte_order);
theclass->methods = read_memory_unsigned_integer (addr + 28, 4, byte_order);
theclass->cache = read_memory_unsigned_integer (addr + 32, 4, byte_order);
- theclass->protocols = read_memory_unsigned_integer (addr + 36, 4, byte_order);
+ theclass->protocols
+ = read_memory_unsigned_integer (addr + 36, 4, byte_order);
}
static CORE_ADDR
-find_implementation_from_class (struct gdbarch *gdbarch,
- CORE_ADDR theclass, CORE_ADDR sel)
+find_implementation_from_class (struct gdbarch *gdbarch, CORE_ADDR theclass,
+ CORE_ADDR sel)
{
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
CORE_ADDR subclass = theclass;
- while (subclass != 0)
+ while (subclass != 0)
{
-
struct objc_class class_str;
unsigned mlistnum = 0;
read_objc_class (gdbarch, subclass, &class_str);
- for (;;)
+ for (;;)
{
CORE_ADDR mlist;
unsigned long nmethods;
unsigned long i;
-
- mlist = read_memory_unsigned_integer (class_str.methods +
- (4 * mlistnum),
- 4, byte_order);
- if (mlist == 0)
+
+ mlist
+ = read_memory_unsigned_integer (class_str.methods + (4 * mlistnum),
+ 4, byte_order);
+ if (mlist == 0)
break;
nmethods = read_objc_methlist_nmethods (gdbarch, mlist);
- for (i = 0; i < nmethods; i++)
+ for (i = 0; i < nmethods; i++)
{
struct objc_method meth_str;
read_objc_methlist_method (gdbarch, mlist, i, &meth_str);
- if (meth_str.name == sel)
+ if (meth_str.name == sel)
/* FIXME: hppa arch was doing a pointer dereference
here. There needs to be a better way to do that. */
return meth_str.imp;
@@ -1448,8 +1442,7 @@ find_implementation_from_class (struct gdbarch *gdbarch,
}
static CORE_ADDR
-find_implementation (struct gdbarch *gdbarch,
- CORE_ADDR object, CORE_ADDR sel)
+find_implementation (struct gdbarch *gdbarch, CORE_ADDR object, CORE_ADDR sel)
{
struct objc_object ostr;
@@ -1525,7 +1518,7 @@ resolve_msgsend_super (CORE_ADDR pc, CORE_ADDR *new_pc)
read_objc_super (gdbarch, super, &sstr);
if (sstr.theclass == 0)
return 0;
-
+
res = find_implementation_from_class (gdbarch, sstr.theclass, sel);
if (new_pc != 0)
*new_pc = res;
@@ -1553,7 +1546,7 @@ resolve_msgsend_super_stret (CORE_ADDR pc, CORE_ADDR *new_pc)
read_objc_super (gdbarch, super, &sstr);
if (sstr.theclass == 0)
return 0;
-
+
res = find_implementation_from_class (gdbarch, sstr.theclass, sel);
if (new_pc != 0)
*new_pc = res;
diff --git a/gdb/objc-lang.h b/gdb/objc-lang.h
index 3c0221b7170..04b747cb80b 100644
--- a/gdb/objc-lang.h
+++ b/gdb/objc-lang.h
@@ -26,8 +26,8 @@ struct value;
struct block;
struct parser_state;
-extern CORE_ADDR lookup_objc_class (struct gdbarch *gdbarch,
- const char *classname);
+extern CORE_ADDR lookup_objc_class (struct gdbarch *gdbarch,
+ const char *classname);
extern CORE_ADDR lookup_child_selector (struct gdbarch *gdbarch,
const char *methodname);
@@ -36,8 +36,8 @@ extern int find_objc_msgcall (CORE_ADDR pc, CORE_ADDR *new_pc);
extern const char *find_imps (const char *method,
std::vector<const char *> *symbol_names);
-extern struct value *value_nsstring (struct gdbarch *gdbarch,
- const char *ptr, int len);
+extern struct value *value_nsstring (struct gdbarch *gdbarch, const char *ptr,
+ int len);
/* for parsing Objective C */
extern void start_msglist (void);
@@ -45,7 +45,6 @@ extern void add_msglist (struct stoken *str, int addcolon);
extern int end_msglist (struct parser_state *);
struct symbol *lookup_struct_typedef (const char *name,
- const struct block *block,
- int noerr);
+ const struct block *block, int noerr);
#endif
diff --git a/gdb/objfile-flags.h b/gdb/objfile-flags.h
index 7cc45684f66..1584bd47f3b 100644
--- a/gdb/objfile-flags.h
+++ b/gdb/objfile-flags.h
@@ -17,7 +17,7 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
-#if !defined (OBJFILE_FLAGS_H)
+#if !defined(OBJFILE_FLAGS_H)
#define OBJFILE_FLAGS_H
#include "gdbsupport/enum-flags.h"
@@ -26,49 +26,49 @@
break circular header dependencies. */
enum objfile_flag : unsigned
- {
- /* When an object file has its functions reordered (currently
+{
+ /* When an object file has its functions reordered (currently
Irix-5.2 shared libraries exhibit this behaviour), we will need
an expensive algorithm to locate a partial symtab or symtab via
an address. To avoid this penalty for normal object files, we
use this flag, whose setting is determined upon symbol table
read in. */
- OBJF_REORDERED = 1 << 0, /* Functions are reordered */
+ OBJF_REORDERED = 1 << 0, /* Functions are reordered */
- /* Distinguish between an objfile for a shared library and a
+ /* Distinguish between an objfile for a shared library and a
"vanilla" objfile. This may come from a target's
implementation of the solib interface, from add-symbol-file, or
any other mechanism that loads dynamic objects. */
- OBJF_SHARED = 1 << 1, /* From a shared library */
+ OBJF_SHARED = 1 << 1, /* From a shared library */
- /* User requested that this objfile be read in it's entirety. */
- OBJF_READNOW = 1 << 2, /* Immediate full read */
+ /* User requested that this objfile be read in it's entirety. */
+ OBJF_READNOW = 1 << 2, /* Immediate full read */
- /* This objfile was created because the user explicitly caused it
+ /* This objfile was created because the user explicitly caused it
(e.g., used the add-symbol-file command). This bit offers a
way for run_command to remove old objfile entries which are no
longer valid (i.e., are associated with an old inferior), but
to preserve ones that the user explicitly loaded via the
add-symbol-file command. */
- OBJF_USERLOADED = 1 << 3, /* User loaded */
+ OBJF_USERLOADED = 1 << 3, /* User loaded */
- /* Set if we have tried to read partial symtabs for this objfile.
+ /* Set if we have tried to read partial symtabs for this objfile.
This is used to allow lazy reading of partial symtabs. */
- OBJF_PSYMTABS_READ = 1 << 4,
+ OBJF_PSYMTABS_READ = 1 << 4,
- /* Set if this is the main symbol file (as opposed to symbol file
+ /* Set if this is the main symbol file (as opposed to symbol file
for dynamically loaded code). */
- OBJF_MAINLINE = 1 << 5,
+ OBJF_MAINLINE = 1 << 5,
- /* ORIGINAL_NAME and OBFD->FILENAME correspond to text description
+ /* ORIGINAL_NAME and OBFD->FILENAME correspond to text description
unrelated to filesystem names. It can be for example
"<image in memory>". */
- OBJF_NOT_FILENAME = 1 << 6,
+ OBJF_NOT_FILENAME = 1 << 6,
- /* User requested that we do not read this objfile's symbolic
+ /* User requested that we do not read this objfile's symbolic
information. */
- OBJF_READNEVER = 1 << 7,
- };
+ OBJF_READNEVER = 1 << 7,
+};
DEF_ENUM_FLAGS_TYPE (enum objfile_flag, objfile_flags);
diff --git a/gdb/objfiles.c b/gdb/objfiles.c
index ed29131d528..28dc5d6a549 100644
--- a/gdb/objfiles.c
+++ b/gdb/objfiles.c
@@ -23,7 +23,7 @@
destroying objfile structures. */
#include "defs.h"
-#include "bfd.h" /* Binary File Description */
+#include "bfd.h" /* Binary File Description */
#include "symtab.h"
#include "symfile.h"
#include "objfiles.h"
@@ -102,15 +102,11 @@ get_objfile_pspace_data (struct program_space *pspace)
return info;
}
-
-
/* Per-BFD data key. */
static const registry<bfd>::key<objfile_per_bfd_storage> objfiles_bfd_data;
-objfile_per_bfd_storage::~objfile_per_bfd_storage ()
-{
-}
+objfile_per_bfd_storage::~objfile_per_bfd_storage () {}
/* Create the per-BFD storage object for OBJFILE. If ABFD is not
NULL, and it already has a per-BFD storage object, use that.
@@ -148,8 +144,8 @@ set_objfile_per_bfd (struct objfile *objfile)
language. */
void
-set_objfile_main_name (struct objfile *objfile,
- const char *name, enum language lang)
+set_objfile_main_name (struct objfile *objfile, const char *name,
+ enum language lang)
{
if (objfile->per_bfd->name_of_main == NULL
|| strcmp (objfile->per_bfd->name_of_main, name) != 0)
@@ -204,9 +200,9 @@ objfile_register_static_link (struct objfile *objfile,
struct static_link_htab_entry *entry;
if (objfile->static_links == NULL)
- objfile->static_links.reset (htab_create_alloc
- (1, &static_link_htab_entry_hash, static_link_htab_entry_eq, NULL,
- xcalloc, xfree));
+ objfile->static_links.reset (
+ htab_create_alloc (1, &static_link_htab_entry_hash,
+ static_link_htab_entry_eq, NULL, xcalloc, xfree));
/* Create a slot for the mapping, make sure it's the first mapping for this
block and then create the mapping itself. */
@@ -224,8 +220,7 @@ objfile_register_static_link (struct objfile *objfile,
none was found. */
const struct dynamic_prop *
-objfile_lookup_static_link (struct objfile *objfile,
- const struct block *block)
+objfile_lookup_static_link (struct objfile *objfile, const struct block *block)
{
struct static_link_htab_entry *entry;
struct static_link_htab_entry lookup_entry;
@@ -234,7 +229,7 @@ objfile_lookup_static_link (struct objfile *objfile,
return NULL;
lookup_entry.block = block;
entry = ((struct static_link_htab_entry *)
- htab_find (objfile->static_links.get (), &lookup_entry));
+ htab_find (objfile->static_links.get (), &lookup_entry));
if (entry == NULL)
return NULL;
@@ -242,8 +237,6 @@ objfile_lookup_static_link (struct objfile *objfile,
return entry->static_link;
}
-
-
/* Build up the section table that the objfile references. The
objfile contains pointers to the start of the table
(objfile->sections) and to the first location after the end of the
@@ -251,7 +244,7 @@ objfile_lookup_static_link (struct objfile *objfile,
static void
add_to_objfile_sections (struct bfd *abfd, struct bfd_section *asect,
- struct objfile *objfile, int force)
+ struct objfile *objfile, int force)
{
struct obj_section *section;
@@ -280,22 +273,21 @@ build_objfile_section_table (struct objfile *objfile)
{
int count = gdb_bfd_count_sections (objfile->obfd.get ());
- objfile->sections = OBSTACK_CALLOC (&objfile->objfile_obstack,
- count,
- struct obj_section);
+ objfile->sections
+ = OBSTACK_CALLOC (&objfile->objfile_obstack, count, struct obj_section);
objfile->sections_end = (objfile->sections + count);
for (asection *sect : gdb_bfd_sections (objfile->obfd))
add_to_objfile_sections (objfile->obfd.get (), sect, objfile, 0);
/* See gdb_bfd_section_index. */
- add_to_objfile_sections (objfile->obfd.get (), bfd_com_section_ptr,
- objfile, 1);
- add_to_objfile_sections (objfile->obfd.get (), bfd_und_section_ptr,
- objfile, 1);
- add_to_objfile_sections (objfile->obfd.get (), bfd_abs_section_ptr,
- objfile, 1);
- add_to_objfile_sections (objfile->obfd.get (), bfd_ind_section_ptr,
- objfile, 1);
+ add_to_objfile_sections (objfile->obfd.get (), bfd_com_section_ptr, objfile,
+ 1);
+ add_to_objfile_sections (objfile->obfd.get (), bfd_und_section_ptr, objfile,
+ 1);
+ add_to_objfile_sections (objfile->obfd.get (), bfd_abs_section_ptr, objfile,
+ 1);
+ add_to_objfile_sections (objfile->obfd.get (), bfd_ind_section_ptr, objfile,
+ 1);
}
/* Given a pointer to an initialized bfd (ABFD) and some flag bits,
@@ -325,8 +317,7 @@ objfile::objfile (gdb_bfd_ref_ptr bfd_, const char *name, objfile_flags flags_)
gdb_assert ((flags & OBJF_NOT_FILENAME) != 0);
expanded_name = "<<anonymous objfile>>";
}
- else if ((flags & OBJF_NOT_FILENAME) != 0
- || is_target_filename (name))
+ else if ((flags & OBJF_NOT_FILENAME) != 0 || is_target_filename (name))
expanded_name = name;
else
{
@@ -374,7 +365,7 @@ entry_point_address (void)
CORE_ADDR retval;
if (!entry_point_address_query (&retval))
- error (_("Entry point address is not known."));
+ error (_ ("Entry point address is not known."));
return retval;
}
@@ -410,8 +401,7 @@ separate_debug_iterator::operator++ ()
return *this;
}
- for (res = m_objfile->separate_debug_objfile_backlink;
- res != m_parent;
+ for (res = m_objfile->separate_debug_objfile_backlink; res != m_parent;
res = res->separate_debug_objfile_backlink)
{
gdb_assert (res != nullptr);
@@ -508,8 +498,8 @@ objfile::~objfile ()
if (child == this)
{
/* THIS is the first child. */
- separate_debug_objfile_backlink->separate_debug_objfile =
- separate_debug_objfile_link;
+ separate_debug_objfile_backlink->separate_debug_objfile
+ = separate_debug_objfile_link;
}
else
{
@@ -518,8 +508,8 @@ objfile::~objfile ()
{
if (child->separate_debug_objfile_link == this)
{
- child->separate_debug_objfile_link =
- separate_debug_objfile_link;
+ child->separate_debug_objfile_link
+ = separate_debug_objfile_link;
break;
}
child = child->separate_debug_objfile_link;
@@ -574,7 +564,6 @@ objfile::~objfile ()
get_objfile_pspace_data (pspace)->section_map_dirty = 1;
}
-
/* A helper function for objfile_relocate1 that relocates a single
symbol. */
@@ -586,8 +575,7 @@ relocate_one_symbol (struct symbol *sym, struct objfile *objfile,
any symbols in STRUCT_DOMAIN or UNDEF_DOMAIN.
But I'm leaving out that test, on the theory that
they can't possibly pass the tests below. */
- if ((sym->aclass () == LOC_LABEL
- || sym->aclass () == LOC_STATIC)
+ if ((sym->aclass () == LOC_LABEL || sym->aclass () == LOC_STATIC)
&& sym->section_index () >= 0)
sym->set_value_address (sym->value_address ()
+ delta[sym->section_index ()]);
@@ -598,8 +586,7 @@ relocate_one_symbol (struct symbol *sym, struct objfile *objfile,
Return non-zero iff any change happened. */
static int
-objfile_relocate1 (struct objfile *objfile,
- const section_offsets &new_offsets)
+objfile_relocate1 (struct objfile *objfile, const section_offsets &new_offsets)
{
section_offsets delta (objfile->section_offsets.size ());
@@ -706,8 +693,7 @@ objfile_relocate1 (struct objfile *objfile,
files. */
void
-objfile_relocate (struct objfile *objfile,
- const section_offsets &new_offsets)
+objfile_relocate (struct objfile *objfile, const section_offsets &new_offsets)
{
int changed = 0;
@@ -728,8 +714,8 @@ objfile_relocate (struct objfile *objfile,
gdb_assert (debug_objfile->section_offsets.size ()
== gdb_bfd_count_sections (debug_objfile->obfd.get ()));
- section_offsets new_debug_offsets
- (debug_objfile->section_offsets.size ());
+ section_offsets new_debug_offsets (
+ debug_objfile->section_offsets.size ());
relative_addr_info_to_section_offsets (new_debug_offsets, objfile_addrs);
changed |= objfile_relocate1 (debug_objfile, new_debug_offsets);
@@ -766,7 +752,7 @@ objfile_rebase (struct objfile *objfile, CORE_ADDR slide)
if (changed)
breakpoint_re_set ();
}
-
+
/* Return non-zero if OBJFILE has full symbols. */
int
@@ -787,7 +773,6 @@ objfile_has_symbols (struct objfile *objfile)
return 0;
}
-
/* Many places in gdb want to test just to see if we have any partial
symbols available. This function returns zero if none are currently
available, nonzero otherwise. */
@@ -818,7 +803,6 @@ have_full_symbols (void)
return 0;
}
-
/* This operations deletes all objfile entries that represent solibs that
weren't explicitly loaded by the user, via e.g., the add-symbol-file
command. */
@@ -836,7 +820,6 @@ objfile_purge_solibs (void)
}
}
-
/* Many places in gdb want to test just to see if we have any minimal
symbols available. This function returns zero if none are currently
available, nonzero otherwise. */
@@ -957,8 +940,7 @@ preferred_obj_section (struct obj_section *a, struct obj_section *b)
We want to insert only non-overlay non-TLS non-empty sections. */
static int
-insert_section_p (const struct bfd *abfd,
- const struct bfd_section *section)
+insert_section_p (const struct bfd *abfd, const struct bfd_section *section)
{
const bfd_vma lma = bfd_section_lma (section);
@@ -1032,7 +1014,7 @@ filter_overlapping_sections (struct obj_section **map, int map_size)
{
int i, j;
- for (i = 0, j = 0; i < map_size - 1; )
+ for (i = 0, j = 0; i < map_size - 1;)
{
int k;
@@ -1063,10 +1045,10 @@ filter_overlapping_sections (struct obj_section **map, int map_size)
struct gdbarch *const gdbarch = objf1->arch ();
- complaint (_("unexpected overlap between:\n"
- " (A) section `%s' from `%s' [%s, %s)\n"
- " (B) section `%s' from `%s' [%s, %s).\n"
- "Will ignore section B"),
+ complaint (_ ("unexpected overlap between:\n"
+ " (A) section `%s' from `%s' [%s, %s)\n"
+ " (B) section `%s' from `%s' [%s, %s).\n"
+ "Will ignore section B"),
bfd_section_name (bfds1), objfile_name (objf1),
paddress (gdbarch, sect1_addr),
paddress (gdbarch, sect1_endaddr),
@@ -1087,13 +1069,12 @@ filter_overlapping_sections (struct obj_section **map, int map_size)
return j;
}
-
/* Update PMAP, PMAP_SIZE with sections from all objfiles, excluding any
TLS, overlay and overlapping sections. */
static void
-update_section_map (struct program_space *pspace,
- struct obj_section ***pmap, int *pmap_size)
+update_section_map (struct program_space *pspace, struct obj_section ***pmap,
+ int *pmap_size)
{
struct objfile_pspace_info *pspace_info;
int alloc_size, map_size, i;
@@ -1129,8 +1110,8 @@ update_section_map (struct program_space *pspace,
map[i++] = s;
std::sort (map, map + alloc_size, sort_cmp);
- map_size = filter_debuginfo_sections(map, alloc_size);
- map_size = filter_overlapping_sections(map, map_size);
+ map_size = filter_debuginfo_sections (map, alloc_size);
+ map_size = filter_overlapping_sections (map, map_size);
if (map_size < alloc_size)
/* Some sections were eliminated. Trim excess space. */
@@ -1175,8 +1156,7 @@ find_pc_section (CORE_ADDR pc)
|| (pspace_info->new_objfiles_available
&& !pspace_info->inhibit_updates))
{
- update_section_map (current_program_space,
- &pspace_info->sections,
+ update_section_map (current_program_space, &pspace_info->sections,
&pspace_info->num_sections);
/* Don't need updates to section map until objfiles are added,
@@ -1193,8 +1173,7 @@ find_pc_section (CORE_ADDR pc)
return NULL;
}
- sp = (struct obj_section **) bsearch (&pc,
- pspace_info->sections,
+ sp = (struct obj_section **) bsearch (&pc, pspace_info->sections,
pspace_info->num_sections,
sizeof (*pspace_info->sections),
bsearch_cmp);
@@ -1203,18 +1182,15 @@ find_pc_section (CORE_ADDR pc)
return NULL;
}
-
/* Return non-zero if PC is in a section called NAME. */
bool
pc_in_section (CORE_ADDR pc, const char *name)
{
struct obj_section *s = find_pc_section (pc);
- return (s != nullptr
- && s->the_bfd_section->name != nullptr
+ return (s != nullptr && s->the_bfd_section->name != nullptr
&& strcmp (s->the_bfd_section->name, name) == 0);
}
-
/* Set section_map_dirty so section map will be rebuilt next time it
is used. Called by reread_symbols. */
@@ -1231,8 +1207,8 @@ objfiles_changed (void)
scoped_restore_tmpl<int>
inhibit_section_map_updates (struct program_space *pspace)
{
- return scoped_restore_tmpl<int>
- (&get_objfile_pspace_data (pspace)->inhibit_updates, 1);
+ return scoped_restore_tmpl<int> (
+ &get_objfile_pspace_data (pspace)->inhibit_updates, 1);
}
/* See objfiles.h. */
@@ -1281,13 +1257,13 @@ shared_objfile_contains_address_p (struct program_space *pspace,
we can without some knowledge specific to the architecture. */
void
-default_iterate_over_objfiles_in_search_order
- (gdbarch *gdbarch, iterate_over_objfiles_in_search_order_cb_ftype cb,
- objfile *current_objfile)
+default_iterate_over_objfiles_in_search_order (
+ gdbarch *gdbarch, iterate_over_objfiles_in_search_order_cb_ftype cb,
+ objfile *current_objfile)
{
for (objfile *objfile : current_program_space->objfiles ())
if (cb (objfile))
- return;
+ return;
}
/* See objfiles.h. */
@@ -1338,12 +1314,11 @@ objfile_int_type (struct objfile *of, int size_in_bytes, bool unsigned_p)
struct type *int_type;
/* Helper macro to examine the various builtin types. */
-#define TRY_TYPE(F) \
- int_type = (unsigned_p \
- ? objfile_type (of)->builtin_unsigned_ ## F \
- : objfile_type (of)->builtin_ ## F); \
- if (int_type != NULL && int_type->length () == size_in_bytes) \
- return int_type
+#define TRY_TYPE(F) \
+ int_type = (unsigned_p ? objfile_type (of)->builtin_unsigned_##F \
+ : objfile_type (of)->builtin_##F); \
+ if (int_type != NULL && int_type->length () == size_in_bytes) \
+ return int_type
TRY_TYPE (char);
TRY_TYPE (short);
diff --git a/gdb/objfiles.h b/gdb/objfiles.h
index 342aa09ac6a..8b3e5cb53b5 100644
--- a/gdb/objfiles.h
+++ b/gdb/objfiles.h
@@ -17,11 +17,11 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
-#if !defined (OBJFILES_H)
+#if !defined(OBJFILES_H)
#define OBJFILES_H
#include "hashtab.h"
-#include "gdbsupport/gdb_obstack.h" /* For obstack internals. */
+#include "gdbsupport/gdb_obstack.h" /* For obstack internals. */
#include "objfile-flags.h"
#include "symfile.h"
#include "progspace.h"
@@ -127,28 +127,28 @@ struct entry_info
unsigned initialized : 1;
};
-#define ALL_OBJFILE_OSECTIONS(objfile, osect) \
+#define ALL_OBJFILE_OSECTIONS(objfile, osect) \
for (osect = objfile->sections; osect < objfile->sections_end; osect++) \
- if (osect->the_bfd_section == NULL) \
- { \
- /* Nothing. */ \
- } \
+ if (osect->the_bfd_section == NULL) \
+ { \
+ /* Nothing. */ \
+ } \
else
-#define SECT_OFF_DATA(objfile) \
- ((objfile->sect_index_data == -1) \
- ? (internal_error (_("sect_index_data not initialized")), -1) \
- : objfile->sect_index_data)
+#define SECT_OFF_DATA(objfile) \
+ ((objfile->sect_index_data == -1) \
+ ? (internal_error (_ ("sect_index_data not initialized")), -1) \
+ : objfile->sect_index_data)
-#define SECT_OFF_RODATA(objfile) \
- ((objfile->sect_index_rodata == -1) \
- ? (internal_error (_("sect_index_rodata not initialized")), -1) \
- : objfile->sect_index_rodata)
+#define SECT_OFF_RODATA(objfile) \
+ ((objfile->sect_index_rodata == -1) \
+ ? (internal_error (_ ("sect_index_rodata not initialized")), -1) \
+ : objfile->sect_index_rodata)
-#define SECT_OFF_TEXT(objfile) \
- ((objfile->sect_index_text == -1) \
- ? (internal_error (_("sect_index_text not initialized")), -1) \
- : objfile->sect_index_text)
+#define SECT_OFF_TEXT(objfile) \
+ ((objfile->sect_index_text == -1) \
+ ? (internal_error (_ ("sect_index_text not initialized")), -1) \
+ : objfile->sect_index_text)
/* Sometimes the .bss section is missing from the objfile, so we don't
want to die here. Let the users of SECT_OFF_BSS deal with an
@@ -175,7 +175,7 @@ struct objstats
int sz_strtab = 0;
};
-#define OBJSTAT(objfile, expr) (objfile -> stats.expr)
+#define OBJSTAT(objfile, expr) (objfile->stats.expr)
#define OBJSTATS struct objstats stats
extern void print_objfile_statistics (void);
@@ -198,10 +198,7 @@ struct minimal_symbol_iterator
{
}
- value_type operator* () const
- {
- return m_msym;
- }
+ value_type operator* () const { return m_msym; }
bool operator== (const self_type &other) const
{
@@ -220,6 +217,7 @@ struct minimal_symbol_iterator
}
private:
+
struct minimal_symbol *m_msym;
};
@@ -231,8 +229,10 @@ private:
struct objfile_per_bfd_storage
{
objfile_per_bfd_storage (bfd *bfd)
- : minsyms_read (false), m_bfd (bfd)
- {}
+ : minsyms_read (false),
+ m_bfd (bfd)
+ {
+ }
~objfile_per_bfd_storage ();
@@ -255,10 +255,7 @@ struct objfile_per_bfd_storage
/* Get the BFD this object is associated to. */
- bfd *get_bfd () const
- {
- return m_bfd;
- }
+ bfd *get_bfd () const { return m_bfd; }
/* The storage has an obstack of its own. */
@@ -339,6 +336,7 @@ struct objfile_per_bfd_storage
std::bitset<nr_languages> demangled_hash_languages;
private:
+
/* The BFD this object is associated to. */
bfd *m_bfd;
@@ -364,10 +362,7 @@ public:
separate_debug_iterator &operator++ ();
- struct objfile *operator* ()
- {
- return m_objfile;
- }
+ struct objfile *operator* () { return m_objfile; }
private:
@@ -466,23 +461,14 @@ public:
/* Intern STRING and return the unique copy. The copy has the same
lifetime as the per-BFD object. */
- const char *intern (const char *str)
- {
- return per_bfd->intern (str);
- }
+ const char *intern (const char *str) { return per_bfd->intern (str); }
/* Intern STRING and return the unique copy. The copy has the same
lifetime as the per-BFD object. */
- const char *intern (const std::string &str)
- {
- return per_bfd->intern (str);
- }
+ const char *intern (const std::string &str) { return per_bfd->intern (str); }
/* Retrieve the gdbarch associated with this objfile. */
- struct gdbarch *arch () const
- {
- return per_bfd->gdbarch;
- }
+ struct gdbarch *arch () const { return per_bfd->gdbarch; }
/* Return true if OBJFILE has partial symbols. */
@@ -512,9 +498,9 @@ public:
Then, this calls iterate_over_some_symtabs (or equivalent) over
all newly-created symbol tables, passing CALLBACK to it.
The result of this call is returned. */
- bool map_symtabs_matching_filename
- (const char *name, const char *real_path,
- gdb::function_view<bool (symtab *)> callback);
+ bool
+ map_symtabs_matching_filename (const char *name, const char *real_path,
+ gdb::function_view<bool (symtab *)> callback);
/* Check to see if the symbol is defined in a "partial" symbol table
of this objfile. BLOCK_INDEX should be either GLOBAL_BLOCK or
@@ -550,27 +536,24 @@ public:
void expand_symtabs_with_fullname (const char *fullname);
/* See quick_symbol_functions. */
- void expand_matching_symbols
- (const lookup_name_info &name, domain_enum domain,
- int global,
- symbol_compare_ftype *ordered_compare);
+ void expand_matching_symbols (const lookup_name_info &name,
+ domain_enum domain, int global,
+ symbol_compare_ftype *ordered_compare);
/* See quick_symbol_functions. */
- bool expand_symtabs_matching
- (gdb::function_view<expand_symtabs_file_matcher_ftype> file_matcher,
- const lookup_name_info *lookup_name,
- gdb::function_view<expand_symtabs_symbol_matcher_ftype> symbol_matcher,
- gdb::function_view<expand_symtabs_exp_notify_ftype> expansion_notify,
- block_search_flags search_flags,
- domain_enum domain,
- enum search_domain kind);
+ bool expand_symtabs_matching (
+ gdb::function_view<expand_symtabs_file_matcher_ftype> file_matcher,
+ const lookup_name_info *lookup_name,
+ gdb::function_view<expand_symtabs_symbol_matcher_ftype> symbol_matcher,
+ gdb::function_view<expand_symtabs_exp_notify_ftype> expansion_notify,
+ block_search_flags search_flags, domain_enum domain,
+ enum search_domain kind);
/* See quick_symbol_functions. */
- struct compunit_symtab *find_pc_sect_compunit_symtab
- (struct bound_minimal_symbol msymbol,
- CORE_ADDR pc,
- struct obj_section *section,
- int warn_if_readin);
+ struct compunit_symtab *
+ find_pc_sect_compunit_symtab (struct bound_minimal_symbol msymbol,
+ CORE_ADDR pc, struct obj_section *section,
+ int warn_if_readin);
/* See quick_symbol_functions. */
void map_symbol_filenames (gdb::function_view<symbol_filename_ftype> fun,
@@ -790,17 +773,13 @@ public:
struct objfile_deleter
{
- void operator() (objfile *ptr) const
- {
- ptr->unlink ();
- }
+ void operator() (objfile *ptr) const { ptr->unlink (); }
};
/* A unique pointer that holds an objfile. */
typedef std::unique_ptr<objfile, objfile_deleter> objfile_up;
-
/* Sections in an objfile. The section offsets are stored in the
OBJFILE. */
@@ -900,8 +879,7 @@ extern bool pc_in_section (CORE_ADDR, const char *);
static inline int
in_plt_section (CORE_ADDR pc)
{
- return (pc_in_section (pc, ".plt")
- || pc_in_section (pc, ".plt.sec"));
+ return (pc_in_section (pc, ".plt") || pc_in_section (pc, ".plt.sec"));
}
/* In normal use, the section map will be rebuilt by find_pc_section
@@ -912,12 +890,12 @@ in_plt_section (CORE_ADDR pc)
call to find_pc_section in the inhibited region relates to a
section that is already in the section map and has not since been
removed or relocated. */
-extern scoped_restore_tmpl<int> inhibit_section_map_updates
- (struct program_space *pspace);
+extern scoped_restore_tmpl<int>
+inhibit_section_map_updates (struct program_space *pspace);
-extern void default_iterate_over_objfiles_in_search_order
- (gdbarch *gdbarch, iterate_over_objfiles_in_search_order_cb_ftype cb,
- objfile *current_objfile);
+extern void default_iterate_over_objfiles_in_search_order (
+ gdbarch *gdbarch, iterate_over_objfiles_in_search_order_cb_ftype cb,
+ objfile *current_objfile);
/* Reset the per-BFD storage area on OBJ. */
@@ -945,20 +923,21 @@ const char *objfile_flavour_name (struct objfile *objfile);
/* Set the objfile's notion of the "main" name and language. */
-extern void set_objfile_main_name (struct objfile *objfile,
- const char *name, enum language lang);
+extern void set_objfile_main_name (struct objfile *objfile, const char *name,
+ enum language lang);
/* Find an integer type SIZE_IN_BYTES bytes in size from OF and return it.
UNSIGNED_P controls if the integer is unsigned or not. */
extern struct type *objfile_int_type (struct objfile *of, int size_in_bytes,
bool unsigned_p);
-extern void objfile_register_static_link
- (struct objfile *objfile,
- const struct block *block,
- const struct dynamic_prop *static_link);
+extern void
+objfile_register_static_link (struct objfile *objfile,
+ const struct block *block,
+ const struct dynamic_prop *static_link);
-extern const struct dynamic_prop *objfile_lookup_static_link
- (struct objfile *objfile, const struct block *block);
+extern const struct dynamic_prop *
+objfile_lookup_static_link (struct objfile *objfile,
+ const struct block *block);
#endif /* !defined (OBJFILES_H) */
diff --git a/gdb/obsd-nat.c b/gdb/obsd-nat.c
index 2c60444c2c8..d8ef3c9f59b 100644
--- a/gdb/obsd-nat.c
+++ b/gdb/obsd-nat.c
@@ -37,7 +37,8 @@ std::string
obsd_nat_target::pid_to_str (ptid_t ptid)
{
if (ptid.lwp () != 0)
- return string_printf ("thread %ld of process %d", ptid.lwp (), ptid.pid ());
+ return string_printf ("thread %ld of process %d", ptid.lwp (),
+ ptid.pid ());
return normal_pid_to_str (ptid);
}
@@ -50,7 +51,7 @@ obsd_nat_target::update_thread_list ()
prune_threads ();
- if (ptrace (PT_GET_THREAD_FIRST, pid, (caddr_t)&pts, sizeof pts) == -1)
+ if (ptrace (PT_GET_THREAD_FIRST, pid, (caddr_t) &pts, sizeof pts) == -1)
perror_with_name (("ptrace"));
while (pts.pts_tid != -1)
@@ -65,7 +66,7 @@ obsd_nat_target::update_thread_list ()
add_thread (this, ptid);
}
- if (ptrace (PT_GET_THREAD_NEXT, pid, (caddr_t)&pts, sizeof pts) == -1)
+ if (ptrace (PT_GET_THREAD_NEXT, pid, (caddr_t) &pts, sizeof pts) == -1)
perror_with_name (("ptrace"));
}
}
@@ -80,8 +81,7 @@ obsd_enable_proc_events (pid_t pid)
/* Set the initial event mask. */
memset (&pe, 0, sizeof pe);
pe.pe_set_event |= PTRACE_FORK;
- if (ptrace (PT_SET_EVENT_MASK, pid,
- (PTRACE_TYPE_ARG3)&pe, sizeof pe) == -1)
+ if (ptrace (PT_SET_EVENT_MASK, pid, (PTRACE_TYPE_ARG3) &pe, sizeof pe) == -1)
perror_with_name (("ptrace"));
}
@@ -95,7 +95,7 @@ obsd_nat_target::wait (ptid_t ptid, struct target_waitstatus *ourstatus,
ptrace_state_t pe;
pid_t pid = wptid.pid ();
- if (ptrace (PT_GET_PROCESS_STATE, pid, (caddr_t)&pe, sizeof pe) == -1)
+ if (ptrace (PT_GET_PROCESS_STATE, pid, (caddr_t) &pe, sizeof pe) == -1)
perror_with_name (("ptrace"));
wptid = ptid_t (pid, pe.pe_tid, 0);
@@ -110,8 +110,8 @@ obsd_nat_target::wait (ptid_t ptid, struct target_waitstatus *ourstatus,
if (fpid == -1)
perror_with_name (("waitpid"));
- if (ptrace (PT_GET_PROCESS_STATE, fpid,
- (caddr_t)&pe, sizeof pe) == -1)
+ if (ptrace (PT_GET_PROCESS_STATE, fpid, (caddr_t) &pe, sizeof pe)
+ == -1)
perror_with_name (("ptrace"));
gdb_assert (pe.pe_report_event == PTRACE_FORK);
@@ -157,8 +157,8 @@ obsd_nat_target::post_startup_inferior (ptid_t pid)
void
obsd_nat_target::follow_fork (inferior *child_inf, ptid_t child_ptid,
- target_waitkind fork_kind,
- bool follow_child, bool detach_fork)
+ target_waitkind fork_kind, bool follow_child,
+ bool detach_fork)
{
inf_ptrace_target::follow_fork (child_inf, child_ptid, fork_kind,
follow_child, detach_fork);
@@ -168,7 +168,7 @@ obsd_nat_target::follow_fork (inferior *child_inf, ptid_t child_ptid,
/* Breakpoints have already been detached from the child by
infrun.c. */
- if (ptrace (PT_DETACH, child_ptid.pid (), (PTRACE_TYPE_ARG3)1, 0) == -1)
+ if (ptrace (PT_DETACH, child_ptid.pid (), (PTRACE_TYPE_ARG3) 1, 0) == -1)
perror_with_name (("ptrace"));
}
}
diff --git a/gdb/obsd-nat.h b/gdb/obsd-nat.h
index 4f296b83442..5bfd486d592 100644
--- a/gdb/obsd-nat.h
+++ b/gdb/obsd-nat.h
@@ -29,7 +29,8 @@ class obsd_nat_target : public inf_ptrace_target
void update_thread_list () override;
ptid_t wait (ptid_t, struct target_waitstatus *, target_wait_flags) override;
- void follow_fork (inferior *inf, ptid_t, target_waitkind, bool, bool) override;
+ void follow_fork (inferior *inf, ptid_t, target_waitkind, bool,
+ bool) override;
int insert_fork_catchpoint (int) override;
@@ -38,6 +39,7 @@ class obsd_nat_target : public inf_ptrace_target
void post_attach (int) override;
protected:
+
void post_startup_inferior (ptid_t) override;
};
diff --git a/gdb/obsd-tdep.c b/gdb/obsd-tdep.c
index fa8292d7e35..fe7457900ab 100644
--- a/gdb/obsd-tdep.c
+++ b/gdb/obsd-tdep.c
@@ -30,7 +30,7 @@ obsd_skip_solib_resolver (struct gdbarch *gdbarch, CORE_ADDR pc)
{
struct bound_minimal_symbol msym;
- msym = lookup_minimal_symbol("_dl_bind", NULL, NULL);
+ msym = lookup_minimal_symbol ("_dl_bind", NULL, NULL);
if (msym.minsym && msym.value_address () == pc)
return frame_unwind_caller_pc (get_current_frame ());
else
@@ -40,40 +40,40 @@ obsd_skip_solib_resolver (struct gdbarch *gdbarch, CORE_ADDR pc)
/* OpenBSD signal numbers. From <sys/signal.h>. */
enum
- {
- OBSD_SIGHUP = 1,
- OBSD_SIGINT = 2,
- OBSD_SIGQUIT = 3,
- OBSD_SIGILL = 4,
- OBSD_SIGTRAP = 5,
- OBSD_SIGABRT = 6,
- OBSD_SIGEMT = 7,
- OBSD_SIGFPE = 8,
- OBSD_SIGKILL = 9,
- OBSD_SIGBUS = 10,
- OBSD_SIGSEGV = 11,
- OBSD_SIGSYS = 12,
- OBSD_SIGPIPE = 13,
- OBSD_SIGALRM = 14,
- OBSD_SIGTERM = 15,
- OBSD_SIGURG = 16,
- OBSD_SIGSTOP = 17,
- OBSD_SIGTSTP = 18,
- OBSD_SIGCONT = 19,
- OBSD_SIGCHLD = 20,
- OBSD_SIGTTIN = 21,
- OBSD_SIGTTOU = 22,
- OBSD_SIGIO = 23,
- OBSD_SIGXCPU = 24,
- OBSD_SIGXFSZ = 25,
- OBSD_SIGVTALRM = 26,
- OBSD_SIGPROF = 27,
- OBSD_SIGWINCH = 28,
- OBSD_SIGINFO = 29,
- OBSD_SIGUSR1 = 30,
- OBSD_SIGUSR2 = 31,
- OBSD_SIGTHR = 32,
- };
+{
+ OBSD_SIGHUP = 1,
+ OBSD_SIGINT = 2,
+ OBSD_SIGQUIT = 3,
+ OBSD_SIGILL = 4,
+ OBSD_SIGTRAP = 5,
+ OBSD_SIGABRT = 6,
+ OBSD_SIGEMT = 7,
+ OBSD_SIGFPE = 8,
+ OBSD_SIGKILL = 9,
+ OBSD_SIGBUS = 10,
+ OBSD_SIGSEGV = 11,
+ OBSD_SIGSYS = 12,
+ OBSD_SIGPIPE = 13,
+ OBSD_SIGALRM = 14,
+ OBSD_SIGTERM = 15,
+ OBSD_SIGURG = 16,
+ OBSD_SIGSTOP = 17,
+ OBSD_SIGTSTP = 18,
+ OBSD_SIGCONT = 19,
+ OBSD_SIGCHLD = 20,
+ OBSD_SIGTTIN = 21,
+ OBSD_SIGTTOU = 22,
+ OBSD_SIGIO = 23,
+ OBSD_SIGXCPU = 24,
+ OBSD_SIGXFSZ = 25,
+ OBSD_SIGVTALRM = 26,
+ OBSD_SIGPROF = 27,
+ OBSD_SIGWINCH = 28,
+ OBSD_SIGINFO = 29,
+ OBSD_SIGUSR1 = 30,
+ OBSD_SIGUSR2 = 31,
+ OBSD_SIGTHR = 32,
+};
/* Implement the "gdb_signal_from_target" gdbarch method. */
@@ -185,8 +185,7 @@ obsd_gdb_signal_from_target (struct gdbarch *gdbarch, int signal)
/* Implement the "gdb_signal_to_target" gdbarch method. */
static int
-obsd_gdb_signal_to_target (struct gdbarch *gdbarch,
- enum gdb_signal signal)
+obsd_gdb_signal_to_target (struct gdbarch *gdbarch, enum gdb_signal signal)
{
switch (signal)
{
@@ -293,10 +292,8 @@ obsd_gdb_signal_to_target (struct gdbarch *gdbarch,
void
obsd_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
{
- set_gdbarch_gdb_signal_from_target (gdbarch,
- obsd_gdb_signal_from_target);
- set_gdbarch_gdb_signal_to_target (gdbarch,
- obsd_gdb_signal_to_target);
+ set_gdbarch_gdb_signal_from_target (gdbarch, obsd_gdb_signal_from_target);
+ set_gdbarch_gdb_signal_to_target (gdbarch, obsd_gdb_signal_to_target);
set_gdbarch_auxv_parse (gdbarch, svr4_auxv_parse);
}
diff --git a/gdb/observable.c b/gdb/observable.c
index 28249a5ad01..fdd96977c28 100644
--- a/gdb/observable.c
+++ b/gdb/observable.c
@@ -30,7 +30,7 @@ namespace observers
bool observer_debug = false;
-#define DEFINE_OBSERVABLE(name) decltype (name) name (# name)
+#define DEFINE_OBSERVABLE(name) decltype (name) name (#name)
DEFINE_OBSERVABLE (normal_stop);
DEFINE_OBSERVABLE (signal_received);
@@ -90,19 +90,21 @@ static void
show_observer_debug (struct ui_file *file, int from_tty,
struct cmd_list_element *c, const char *value)
{
- gdb_printf (file, _("Observer debugging is %s.\n"), value);
+ gdb_printf (file, _ ("Observer debugging is %s.\n"), value);
}
void _initialize_observer ();
+
void
_initialize_observer ()
{
add_setshow_boolean_cmd ("observer", class_maintenance,
- &gdb::observers::observer_debug, _("\
-Set observer debugging."), _("\
-Show observer debugging."), _("\
+ &gdb::observers::observer_debug, _ ("\
+Set observer debugging."),
+ _ ("\
+Show observer debugging."),
+ _ ("\
When non-zero, observer debugging is enabled."),
- NULL,
- show_observer_debug,
- &setdebuglist, &showdebuglist);
+ NULL, show_observer_debug, &setdebuglist,
+ &showdebuglist);
}
diff --git a/gdb/observable.h b/gdb/observable.h
index efd0446e168..e3af66e90cf 100644
--- a/gdb/observable.h
+++ b/gdb/observable.h
@@ -51,7 +51,7 @@ namespace observers
condition that is not met. If the breakpoint has any associated
commands list, the commands are executed after the notification is
emitted. */
-extern observable<struct bpstat */* bs */, int /* print_frame */> normal_stop;
+extern observable<struct bpstat * /* bs */, int /* print_frame */> normal_stop;
/* The inferior was stopped by a signal. */
extern observable<enum gdb_signal /* siggnal */> signal_received;
@@ -75,7 +75,7 @@ extern observable<> sync_execution_done;
extern observable<> command_error;
/* The target's register contents have changed. */
-extern observable<struct target_ops */* target */> target_changed;
+extern observable<struct target_ops * /* target */> target_changed;
/* The executable being debugged by GDB has changed: The user
decided to debug a different program, or the program he was
@@ -88,10 +88,10 @@ extern observable<> executable_changed;
instruction. For 'attach' and 'core', gdb calls this observer
immediately after connecting to the inferior, and before any
information on the inferior has been printed. */
-extern observable<inferior */* inferior */> inferior_created;
+extern observable<inferior * /* inferior */> inferior_created;
/* The inferior INF has exec'ed a new executable file. */
-extern observable<struct inferior */* inf */> inferior_execd;
+extern observable<struct inferior * /* inf */> inferior_execd;
/* The status of process record for inferior inferior in gdb has
changed. The process record is started if STARTED is true, and
@@ -101,35 +101,35 @@ extern observable<struct inferior */* inf */> inferior_execd;
method used for recording. If the method supports multiple
formats, FORMAT indicates which one is being used, otherwise it
is NULL. When STARTED is false, they are both NULL. */
-extern observable<struct inferior */* inferior */, int /* started */,
- const char */* method */, const char */* format */>
- record_changed;
+extern observable<struct inferior * /* inferior */, int /* started */,
+ const char * /* method */, const char * /* format */>
+ record_changed;
/* The shared library specified by SOLIB has been loaded. Note that
when gdb calls this observer, the library's symbols probably
haven't been loaded yet. */
-extern observable<struct so_list */* solib */> solib_loaded;
+extern observable<struct so_list * /* solib */> solib_loaded;
/* The shared library specified by SOLIB has been unloaded. Note
that when gdb calls this observer, the library's symbols have not
been unloaded yet, and thus are still available. */
-extern observable<struct so_list */* solib */> solib_unloaded;
+extern observable<struct so_list * /* solib */> solib_unloaded;
/* The symbol file specified by OBJFILE has been loaded. Called
with OBJFILE equal to NULL to indicate previously loaded symbol
table data has now been invalidated. */
-extern observable<struct objfile */* objfile */> new_objfile;
+extern observable<struct objfile * /* objfile */> new_objfile;
/* The object file specified by OBJFILE is about to be freed. */
-extern observable<struct objfile */* objfile */> free_objfile;
+extern observable<struct objfile * /* objfile */> free_objfile;
/* The thread specified by T has been created. */
-extern observable<struct thread_info */* t */> new_thread;
+extern observable<struct thread_info * /* t */> new_thread;
/* The thread specified by T has exited. The SILENT argument
indicates that gdb is removing the thread from its tables without
wanting to notify the user about it. */
-extern observable<struct thread_info */* t */, int /* silent */> thread_exit;
+extern observable<struct thread_info * /* t */, int /* silent */> thread_exit;
/* An explicit stop request was issued to PTID. If PTID equals
minus_one_ptid, the request applied to all threads. If
@@ -147,15 +147,15 @@ extern observable<ptid_t /* ptid */> target_resumed;
extern observable<> about_to_proceed;
/* A new breakpoint B has been created. */
-extern observable<struct breakpoint */* b */> breakpoint_created;
+extern observable<struct breakpoint * /* b */> breakpoint_created;
/* A breakpoint has been destroyed. The argument B is the
pointer to the destroyed breakpoint. */
-extern observable<struct breakpoint */* b */> breakpoint_deleted;
+extern observable<struct breakpoint * /* b */> breakpoint_deleted;
/* A breakpoint has been modified in some way. The argument B
is the modified breakpoint. */
-extern observable<struct breakpoint */* b */> breakpoint_modified;
+extern observable<struct breakpoint * /* b */> breakpoint_modified;
/* The trace frame is changed to TFNUM (e.g., by using the 'tfind'
command). If TFNUM is negative, it means gdb resumes live
@@ -165,42 +165,42 @@ extern observable<int /* tfnum */, int /* tpnum */> traceframe_changed;
/* The current architecture has changed. The argument NEWARCH is a
pointer to the new architecture. */
-extern observable<struct gdbarch */* newarch */> architecture_changed;
+extern observable<struct gdbarch * /* newarch */> architecture_changed;
/* The thread's ptid has changed. The OLD_PTID parameter specifies
the old value, and NEW_PTID specifies the new value. */
-extern observable<process_stratum_target * /* target */,
- ptid_t /* old_ptid */, ptid_t /* new_ptid */>
+extern observable<process_stratum_target * /* target */, ptid_t /* old_ptid */,
+ ptid_t /* new_ptid */>
thread_ptid_changed;
/* The inferior INF has been added to the list of inferiors. At
this point, it might not be associated with any process. */
-extern observable<struct inferior */* inf */> inferior_added;
+extern observable<struct inferior * /* inf */> inferior_added;
/* The inferior identified by INF has been attached to a
process. */
-extern observable<struct inferior */* inf */> inferior_appeared;
+extern observable<struct inferior * /* inf */> inferior_appeared;
/* Inferior INF is about to be detached. */
-extern observable<struct inferior */* inf */> inferior_pre_detach;
+extern observable<struct inferior * /* inf */> inferior_pre_detach;
/* Either the inferior associated with INF has been detached from
the process, or the process has exited. */
-extern observable<struct inferior */* inf */> inferior_exit;
+extern observable<struct inferior * /* inf */> inferior_exit;
/* The inferior INF has been removed from the list of inferiors.
This method is called immediately before freeing INF. */
-extern observable<struct inferior */* inf */> inferior_removed;
+extern observable<struct inferior * /* inf */> inferior_removed;
/* Bytes from DATA to DATA + LEN have been written to the inferior
at ADDR. */
-extern observable<struct inferior */* inferior */, CORE_ADDR /* addr */,
- ssize_t /* len */, const bfd_byte */* data */>
- memory_changed;
+extern observable<struct inferior * /* inferior */, CORE_ADDR /* addr */,
+ ssize_t /* len */, const bfd_byte * /* data */>
+ memory_changed;
/* Called before a top-level prompt is displayed. CURRENT_PROMPT is
the current top-level prompt. */
-extern observable<const char */* current_prompt */> before_prompt;
+extern observable<const char * /* current_prompt */> before_prompt;
/* Variable gdb_datadir has been set. The value may not necessarily
change. */
@@ -210,40 +210,40 @@ extern observable<> gdb_datadir_changed;
This method is called after a command 'set param value'. PARAM
is the parameter of 'set' command, and VALUE is the value of
changed parameter. */
-extern observable<const char */* param */, const char */* value */>
- command_param_changed;
+extern observable<const char * /* param */, const char * /* value */>
+ command_param_changed;
/* The new trace state variable TSV is created. */
-extern observable<const struct trace_state_variable */* tsv */> tsv_created;
+extern observable<const struct trace_state_variable * /* tsv */> tsv_created;
/* The trace state variable TSV is deleted. If TSV is NULL, all
trace state variables are deleted. */
-extern observable<const struct trace_state_variable */* tsv */> tsv_deleted;
+extern observable<const struct trace_state_variable * /* tsv */> tsv_deleted;
/* The trace state value TSV is modified. */
-extern observable<const struct trace_state_variable */* tsv */> tsv_modified;
+extern observable<const struct trace_state_variable * /* tsv */> tsv_modified;
/* An inferior function at ADDRESS is about to be called in thread
THREAD. */
extern observable<ptid_t /* thread */, CORE_ADDR /* address */>
- inferior_call_pre;
+ inferior_call_pre;
/* The inferior function at ADDRESS has just been called. This
observer is called even if the inferior exits during the call.
THREAD is the thread in which the function was called, which may
be different from the current thread. */
extern observable<ptid_t /* thread */, CORE_ADDR /* address */>
- inferior_call_post;
+ inferior_call_post;
/* A register in the inferior has been modified by the gdb user. */
extern observable<frame_info_ptr /* frame */, int /* regnum */>
- register_changed;
+ register_changed;
/* The user-selected inferior, thread and/or frame has changed. The
user_select_what flag specifies if the inferior, thread and/or
frame has changed. */
extern observable<user_selected_what /* selection */>
- user_selected_context_changed;
+ user_selected_context_changed;
/* This is notified when a styling setting has changed, content may need
to be updated based on the new settings. */
@@ -258,13 +258,13 @@ extern observable<> current_source_symtab_and_line_changed;
extern observable<int> gdb_exiting;
/* When a connection is removed. */
-extern observable<process_stratum_target */* target */> connection_removed;
+extern observable<process_stratum_target * /* target */> connection_removed;
/* About to enter target_wait (). */
-extern observable <ptid_t /* ptid */> target_pre_wait;
+extern observable<ptid_t /* ptid */> target_pre_wait;
/* About to leave target_wait (). */
-extern observable <ptid_t /* event_ptid */> target_post_wait;
+extern observable<ptid_t /* event_ptid */> target_post_wait;
} /* namespace observers */
diff --git a/gdb/opencl-lang.c b/gdb/opencl-lang.c
index 0052c560dff..a744cbcf64c 100644
--- a/gdb/opencl-lang.c
+++ b/gdb/opencl-lang.c
@@ -42,13 +42,12 @@ lookup_opencl_vector_type (struct gdbarch *gdbarch, enum type_code code,
/* Check if n describes a valid OpenCL vector size (2, 3, 4, 8, 16). */
if (n != 2 && n != 3 && n != 4 && n != 8 && n != 16)
- error (_("Invalid OpenCL vector size: %d"), n);
+ error (_ ("Invalid OpenCL vector size: %d"), n);
/* Triple vectors have the size of a quad vector. */
- length = (n == 3) ? el_length * 4 : el_length * n;
+ length = (n == 3) ? el_length * 4 : el_length * n;
- auto filter = [&] (struct type *type)
- {
+ auto filter = [&] (struct type *type) {
LONGEST lowb, highb;
return (type->code () == TYPE_CODE_ARRAY && type->is_vector ()
@@ -56,8 +55,7 @@ lookup_opencl_vector_type (struct gdbarch *gdbarch, enum type_code code,
&& type->target_type ()->code () == code
&& type->target_type ()->is_unsigned () == flag_unsigned
&& type->target_type ()->length () == el_length
- && type->length () == length
- && highb - lowb + 1 == n);
+ && type->length () == length && highb - lowb + 1 == n);
};
const struct language_defn *lang = language_def (language_opencl);
return language_lookup_primitive_type (lang, gdbarch, filter);
@@ -130,7 +128,7 @@ lval_func_read (struct value *v)
if (type->code () == TYPE_CODE_ARRAY
&& !get_array_bounds (type, &lowb, &highb))
- error (_("Could not determine the vector bounds"));
+ error (_ ("Could not determine the vector bounds"));
/* Assume elsize aligned offset. */
gdb_assert (offset % elsize == 0);
@@ -140,8 +138,7 @@ lval_func_read (struct value *v)
for (i = offset; i < n; i++)
memcpy (value_contents_raw (v).data () + j++ * elsize,
- value_contents (c->val).data () + c->indices[i] * elsize,
- elsize);
+ value_contents (c->val).data () + c->indices[i] * elsize, elsize);
}
static void
@@ -160,7 +157,7 @@ lval_func_write (struct value *v, struct value *fromval)
if (type->code () == TYPE_CODE_ARRAY
&& !get_array_bounds (type, &lowb, &highb))
- error (_("Could not determine the vector bounds"));
+ error (_ ("Could not determine the vector bounds"));
/* Assume elsize aligned offset. */
gdb_assert (offset % elsize == 0);
@@ -181,8 +178,7 @@ lval_func_write (struct value *v, struct value *fromval)
struct value *to_elm_val = value_subscript (c->val, c->indices[i]);
memcpy (value_contents_writeable (from_elm_val).data (),
- value_contents (fromval).data () + j++ * elsize,
- elsize);
+ value_contents (fromval).data () + j++ * elsize, elsize);
value_assign (to_elm_val, from_elm_val);
}
}
@@ -191,13 +187,13 @@ lval_func_write (struct value *v, struct value *fromval)
synthetic pointer. */
static int
-lval_func_check_synthetic_pointer (const struct value *v,
- LONGEST offset, int length)
+lval_func_check_synthetic_pointer (const struct value *v, LONGEST offset,
+ int length)
{
struct lval_closure *c = (struct lval_closure *) value_computed_closure (v);
/* Size of the target type in bits. */
- int elsize =
- check_typedef (value_type (c->val))->target_type ()->length () * 8;
+ int elsize
+ = check_typedef (value_type (c->val))->target_type ()->length () * 8;
int startrest = offset % elsize;
int start = offset / elsize;
int endrest = (offset + length) % elsize;
@@ -243,23 +239,22 @@ lval_func_free_closure (struct value *v)
if (c->refc == 0)
{
- value_decref (c->val); /* Decrement the reference counter of the value. */
+ value_decref (
+ c->val); /* Decrement the reference counter of the value. */
xfree (c->indices);
xfree (c);
}
}
-static const struct lval_funcs opencl_value_funcs =
- {
- lval_func_read,
- lval_func_write,
- nullptr,
- NULL, /* indirect */
- NULL, /* coerce_ref */
- lval_func_check_synthetic_pointer,
- lval_func_copy_closure,
- lval_func_free_closure
- };
+static const struct lval_funcs opencl_value_funcs
+ = { lval_func_read,
+ lval_func_write,
+ nullptr,
+ NULL, /* indirect */
+ NULL, /* coerce_ref */
+ lval_func_check_synthetic_pointer,
+ lval_func_copy_closure,
+ lval_func_free_closure };
/* Creates a sub-vector from VAL. The elements are selected by the indices of
an array with the length of N. Supported values for NOSIDE are
@@ -286,10 +281,10 @@ create_value (struct gdbarch *gdbarch, struct value *val, enum noside noside,
{
/* Multiple components of the vector are requested which means the
resulting type is a vector as well. */
- struct type *dst_type =
- lookup_opencl_vector_type (gdbarch, elm_type->code (),
- elm_type->length (),
- elm_type->is_unsigned (), n);
+ struct type *dst_type
+ = lookup_opencl_vector_type (gdbarch, elm_type->code (),
+ elm_type->length (),
+ elm_type->is_unsigned (), n);
if (dst_type == NULL)
dst_type = init_vector_type (elm_type, n);
@@ -315,9 +310,9 @@ create_value (struct gdbarch *gdbarch, struct value *val, enum noside noside,
/* Copy src val contents into the destination value. */
for (i = 0; i < n; i++)
memcpy (value_contents_writeable (ret).data ()
- + (i * elm_type->length ()),
+ + (i * elm_type->length ()),
value_contents (val).data ()
- + (indices[i] * elm_type->length ()),
+ + (indices[i] * elm_type->length ()),
elm_type->length ());
}
}
@@ -338,7 +333,7 @@ opencl_component_ref (struct expression *exp, struct value *val,
int dst_len;
if (!get_array_bounds (check_typedef (value_type (val)), &lowb, &highb))
- error (_("Could not determine the vector bounds"));
+ error (_ ("Could not determine the vector bounds"));
src_len = highb - lowb + 1;
@@ -346,9 +341,9 @@ opencl_component_ref (struct expression *exp, struct value *val,
valid OpenCL vector size (2, 3, 4, 8, 16). */
if (src_len != 2 && src_len != 3 && src_len != 4 && src_len != 8
&& src_len != 16)
- error (_("Invalid OpenCL vector size"));
+ error (_ ("Invalid OpenCL vector size"));
- if (strcmp (comps, "lo") == 0 )
+ if (strcmp (comps, "lo") == 0)
{
dst_len = (src_len == 3) ? 2 : src_len / 2;
@@ -367,21 +362,23 @@ opencl_component_ref (struct expression *exp, struct value *val,
dst_len = (src_len == 3) ? 2 : src_len / 2;
for (i = 0; i < dst_len; i++)
- indices[i] = i*2;
+ indices[i] = i * 2;
}
else if (strcmp (comps, "odd") == 0)
{
dst_len = (src_len == 3) ? 2 : src_len / 2;
for (i = 0; i < dst_len; i++)
- indices[i] = i*2+1;
+ indices[i] = i * 2 + 1;
}
else if (strncasecmp (comps, "s", 1) == 0)
{
-#define HEXCHAR_TO_INT(C) ((C >= '0' && C <= '9') ? \
- C-'0' : ((C >= 'A' && C <= 'F') ? \
- C-'A'+10 : ((C >= 'a' && C <= 'f') ? \
- C-'a'+10 : -1)))
+#define HEXCHAR_TO_INT(C) \
+ ((C >= '0' && C <= '9') \
+ ? C - '0' \
+ : ((C >= 'A' && C <= 'F') \
+ ? C - 'A' + 10 \
+ : ((C >= 'a' && C <= 'f') ? C - 'a' + 10 : -1)))
dst_len = strlen (comps);
/* Skip the s/S-prefix. */
@@ -389,11 +386,11 @@ opencl_component_ref (struct expression *exp, struct value *val,
for (i = 0; i < dst_len; i++)
{
- indices[i] = HEXCHAR_TO_INT(comps[i+1]);
+ indices[i] = HEXCHAR_TO_INT (comps[i + 1]);
/* Check if the requested component is invalid or exceeds
the vector. */
if (indices[i] < 0 || indices[i] >= src_len)
- error (_("Invalid OpenCL vector component accessor %s"), comps);
+ error (_ ("Invalid OpenCL vector component accessor %s"), comps);
}
}
else
@@ -404,27 +401,29 @@ opencl_component_ref (struct expression *exp, struct value *val,
{
/* x, y, z, w */
switch (comps[i])
- {
- case 'x':
- indices[i] = 0;
- break;
- case 'y':
- indices[i] = 1;
- break;
- case 'z':
- if (src_len < 3)
- error (_("Invalid OpenCL vector component accessor %s"), comps);
- indices[i] = 2;
- break;
- case 'w':
- if (src_len < 4)
- error (_("Invalid OpenCL vector component accessor %s"), comps);
- indices[i] = 3;
- break;
- default:
- error (_("Invalid OpenCL vector component accessor %s"), comps);
- break;
- }
+ {
+ case 'x':
+ indices[i] = 0;
+ break;
+ case 'y':
+ indices[i] = 1;
+ break;
+ case 'z':
+ if (src_len < 3)
+ error (_ ("Invalid OpenCL vector component accessor %s"),
+ comps);
+ indices[i] = 2;
+ break;
+ case 'w':
+ if (src_len < 4)
+ error (_ ("Invalid OpenCL vector component accessor %s"),
+ comps);
+ indices[i] = 3;
+ break;
+ default:
+ error (_ ("Invalid OpenCL vector component accessor %s"), comps);
+ break;
+ }
}
}
@@ -432,7 +431,7 @@ opencl_component_ref (struct expression *exp, struct value *val,
result in a valid length (1, 2, 3, 4, 8, 16). */
if (dst_len != 1 && dst_len != 2 && dst_len != 3 && dst_len != 4
&& dst_len != 8 && dst_len != 16)
- error (_("Invalid OpenCL vector component accessor %s"), comps);
+ error (_ ("Invalid OpenCL vector component accessor %s"), comps);
v = create_value (exp->gdbarch, val, noside, indices, dst_len);
@@ -443,8 +442,7 @@ opencl_component_ref (struct expression *exp, struct value *val,
struct value *
opencl_logical_not (struct type *expect_type, struct expression *exp,
- enum noside noside, enum exp_opcode op,
- struct value *arg)
+ enum noside noside, enum exp_opcode op, struct value *arg)
{
struct type *type = check_typedef (value_type (arg));
struct type *rettype;
@@ -457,13 +455,13 @@ opencl_logical_not (struct type *expect_type, struct expression *exp,
int i;
if (!get_array_bounds (type, &lowb, &highb))
- error (_("Could not determine the vector bounds"));
+ error (_ ("Could not determine the vector bounds"));
/* Determine the resulting type of the operation and allocate the
value. */
- rettype = lookup_opencl_vector_type (exp->gdbarch, TYPE_CODE_INT,
- eltype->length (), 0,
- highb - lowb + 1);
+ rettype
+ = lookup_opencl_vector_type (exp->gdbarch, TYPE_CODE_INT,
+ eltype->length (), 0, highb - lowb + 1);
ret = allocate_value (rettype);
for (i = 0; i < highb - lowb + 1; i++)
@@ -520,7 +518,7 @@ scalar_relop (struct value *val1, struct value *val2, enum exp_opcode op)
ret = !value_logical_not (val1) || !value_logical_not (val2);
break;
default:
- error (_("Attempt to perform an unsupported operation"));
+ error (_ ("Attempt to perform an unsupported operation"));
break;
}
return ret;
@@ -544,26 +542,26 @@ vector_relop (struct expression *exp, struct value *val1, struct value *val2,
t2_is_vec = (type2->code () == TYPE_CODE_ARRAY && type2->is_vector ());
if (!t1_is_vec || !t2_is_vec)
- error (_("Vector operations are not supported on scalar types"));
+ error (_ ("Vector operations are not supported on scalar types"));
eltype1 = check_typedef (type1->target_type ());
eltype2 = check_typedef (type2->target_type ());
- if (!get_array_bounds (type1,&lowb1, &highb1)
+ if (!get_array_bounds (type1, &lowb1, &highb1)
|| !get_array_bounds (type2, &lowb2, &highb2))
- error (_("Could not determine the vector bounds"));
+ error (_ ("Could not determine the vector bounds"));
/* Check whether the vector types are compatible. */
if (eltype1->code () != eltype2->code ()
|| eltype1->length () != eltype2->length ()
- || eltype1->is_unsigned () != eltype2->is_unsigned ()
- || lowb1 != lowb2 || highb1 != highb2)
- error (_("Cannot perform operation on vectors with different types"));
+ || eltype1->is_unsigned () != eltype2->is_unsigned () || lowb1 != lowb2
+ || highb1 != highb2)
+ error (_ ("Cannot perform operation on vectors with different types"));
/* Determine the resulting type of the operation and allocate the value. */
- rettype = lookup_opencl_vector_type (exp->gdbarch, TYPE_CODE_INT,
- eltype1->length (), 0,
- highb1 - lowb1 + 1);
+ rettype
+ = lookup_opencl_vector_type (exp->gdbarch, TYPE_CODE_INT,
+ eltype1->length (), 0, highb1 - lowb1 + 1);
ret = allocate_value (rettype);
for (i = 0; i < highb1 - lowb1 + 1; i++)
@@ -572,11 +570,13 @@ vector_relop (struct expression *exp, struct value *val1, struct value *val2,
return 0 if the specified relation is false and -1 (i.e. all bits set)
if the specified relation is true. */
int tmp = scalar_relop (value_subscript (val1, i),
- value_subscript (val2, i), op) ? -1 : 0;
+ value_subscript (val2, i), op)
+ ? -1
+ : 0;
memset ((value_contents_writeable (ret).data ()
+ i * eltype1->length ()),
tmp, eltype1->length ());
- }
+ }
return ret;
}
@@ -606,7 +606,7 @@ opencl_value_cast (struct type *type, struct value *arg)
code2 = check_typedef (value_type (arg))->code ();
if (code2 == TYPE_CODE_REF)
- code2 = check_typedef (value_type (coerce_ref(arg)))->code ();
+ code2 = check_typedef (value_type (coerce_ref (arg)))->code ();
scalar = (code2 == TYPE_CODE_INT || code2 == TYPE_CODE_BOOL
|| code2 == TYPE_CODE_CHAR || code2 == TYPE_CODE_FLT
@@ -637,22 +637,20 @@ opencl_value_cast (struct type *type, struct value *arg)
struct value *
opencl_relop (struct type *expect_type, struct expression *exp,
- enum noside noside, enum exp_opcode op,
- struct value *arg1, struct value *arg2)
+ enum noside noside, enum exp_opcode op, struct value *arg1,
+ struct value *arg2)
{
struct value *val;
struct type *type1 = check_typedef (value_type (arg1));
struct type *type2 = check_typedef (value_type (arg2));
- int t1_is_vec = (type1->code () == TYPE_CODE_ARRAY
- && type1->is_vector ());
- int t2_is_vec = (type2->code () == TYPE_CODE_ARRAY
- && type2->is_vector ());
+ int t1_is_vec = (type1->code () == TYPE_CODE_ARRAY && type1->is_vector ());
+ int t2_is_vec = (type2->code () == TYPE_CODE_ARRAY && type2->is_vector ());
if (!t1_is_vec && !t2_is_vec)
{
int tmp = scalar_relop (arg1, arg2, op);
- struct type *type =
- language_bool_type (exp->language_defn, exp->gdbarch);
+ struct type *type
+ = language_bool_type (exp->language_defn, exp->gdbarch);
val = value_from_longest (type, tmp);
}
@@ -667,7 +665,7 @@ opencl_relop (struct type *expect_type, struct expression *exp,
struct type *t = t1_is_vec ? type2 : type1;
if (t->code () != TYPE_CODE_FLT && !is_integral_type (t))
- error (_("Argument to operation not a number or boolean."));
+ error (_ ("Argument to operation not a number or boolean."));
*v = opencl_value_cast (t1_is_vec ? type1 : type2, *v);
val = vector_relop (exp, arg1, arg2, op);
@@ -680,8 +678,8 @@ opencl_relop (struct type *expect_type, struct expression *exp,
struct value *
eval_opencl_assign (struct type *expect_type, struct expression *exp,
- enum noside noside, enum exp_opcode op,
- struct value *arg1, struct value *arg2)
+ enum noside noside, enum exp_opcode op, struct value *arg1,
+ struct value *arg2)
{
if (noside == EVAL_AVOID_SIDE_EFFECTS)
return arg1;
@@ -710,9 +708,9 @@ opencl_structop_operation::evaluate (struct type *expect_type,
noside);
else
{
- struct value *v = value_struct_elt (&arg1, {},
- std::get<1> (m_storage).c_str (),
- NULL, "structure");
+ struct value *v
+ = value_struct_elt (&arg1, {}, std::get<1> (m_storage).c_str (), NULL,
+ "structure");
if (noside == EVAL_AVOID_SIDE_EFFECTS)
v = value_zero (value_type (v), VALUE_LVAL (v));
@@ -786,10 +784,8 @@ opencl_ternop_cond_operation::evaluate (struct type *expect_type,
arg3 = std::get<2> (m_storage)->evaluate (nullptr, exp, noside);
type2 = check_typedef (value_type (arg2));
type3 = check_typedef (value_type (arg3));
- t2_is_vec
- = type2->code () == TYPE_CODE_ARRAY && type2->is_vector ();
- t3_is_vec
- = type3->code () == TYPE_CODE_ARRAY && type3->is_vector ();
+ t2_is_vec = type2->code () == TYPE_CODE_ARRAY && type2->is_vector ();
+ t3_is_vec = type3->code () == TYPE_CODE_ARRAY && type3->is_vector ();
/* Widen the scalar operand to a vector if necessary. */
if (t2_is_vec || !t3_is_vec)
@@ -805,7 +801,7 @@ opencl_ternop_cond_operation::evaluate (struct type *expect_type,
else if (!t2_is_vec || !t3_is_vec)
{
/* Throw an error if arg2 or arg3 aren't vectors. */
- error (_("\
+ error (_ ("\
Cannot perform conditional operation on incompatible types"));
}
@@ -815,31 +811,32 @@ Cannot perform conditional operation on incompatible types"));
if (!get_array_bounds (type1, &lowb1, &highb1)
|| !get_array_bounds (type2, &lowb2, &highb2)
|| !get_array_bounds (type3, &lowb3, &highb3))
- error (_("Could not determine the vector bounds"));
+ error (_ ("Could not determine the vector bounds"));
/* Throw an error if the types of arg2 or arg3 are incompatible. */
if (eltype2->code () != eltype3->code ()
|| eltype2->length () != eltype3->length ()
|| eltype2->is_unsigned () != eltype3->is_unsigned ()
|| lowb2 != lowb3 || highb2 != highb3)
- error (_("\
+ error (_ ("\
Cannot perform operation on vectors with different types"));
/* Throw an error if the sizes of arg1 and arg2/arg3 differ. */
- if (lowb1 != lowb2 || lowb1 != lowb3
- || highb1 != highb2 || highb1 != highb3)
- error (_("\
+ if (lowb1 != lowb2 || lowb1 != lowb3 || highb1 != highb2
+ || highb1 != highb3)
+ error (_ ("\
Cannot perform conditional operation on vectors with different sizes"));
ret = allocate_value (type2);
for (i = 0; i < highb1 - lowb1 + 1; i++)
{
- tmp = value_logical_not (value_subscript (arg1, i)) ?
- value_subscript (arg3, i) : value_subscript (arg2, i);
- memcpy (value_contents_writeable (ret).data () +
- i * eltype2->length (), value_contents_all (tmp).data (),
- eltype2->length ());
+ tmp = value_logical_not (value_subscript (arg1, i))
+ ? value_subscript (arg3, i)
+ : value_subscript (arg2, i);
+ memcpy (value_contents_writeable (ret).data ()
+ + i * eltype2->length (),
+ value_contents_all (tmp).data (), eltype2->length ());
}
return ret;
@@ -860,26 +857,26 @@ Cannot perform conditional operation on vectors with different sizes"));
class opencl_language : public language_defn
{
public:
+
opencl_language ()
: language_defn (language_opencl)
- { /* Nothing. */ }
+ { /* Nothing. */
+ }
/* See language.h. */
- const char *name () const override
- { return "opencl"; }
+ const char *name () const override { return "opencl"; }
/* See language.h. */
- const char *natural_name () const override
- { return "OpenCL C"; }
+ const char *natural_name () const override { return "OpenCL C"; }
/* See language.h. */
void language_arch_info (struct gdbarch *gdbarch,
struct language_arch_info *lai) const override
{
/* Helper function to allow shorter lines below. */
- auto add = [&] (struct type * t) -> struct type *
+ auto add = [&](struct type * t) -> struct type *
{
lai->add_primitive_type (t);
return t;
@@ -890,23 +887,23 @@ public:
/* This macro allocates and assigns the type struct pointers
for the vector types. */
-#define BUILD_OCL_VTYPES(TYPE, ELEMENT_TYPE) \
- do \
- { \
- struct type *tmp; \
- tmp = add (init_vector_type (ELEMENT_TYPE, 2)); \
- tmp->set_name (OCL_STRING(TYPE ## 2)); \
- tmp = add (init_vector_type (ELEMENT_TYPE, 3)); \
- tmp->set_name (OCL_STRING(TYPE ## 3)); \
- tmp->set_length (4 * (ELEMENT_TYPE)->length ()); \
- tmp = add (init_vector_type (ELEMENT_TYPE, 4)); \
- tmp->set_name (OCL_STRING(TYPE ## 4)); \
- tmp = add (init_vector_type (ELEMENT_TYPE, 8)); \
- tmp->set_name (OCL_STRING(TYPE ## 8)); \
- tmp = init_vector_type (ELEMENT_TYPE, 16); \
- tmp->set_name (OCL_STRING(TYPE ## 16)); \
- } \
- while (false)
+#define BUILD_OCL_VTYPES(TYPE, ELEMENT_TYPE) \
+ do \
+ { \
+ struct type *tmp; \
+ tmp = add (init_vector_type (ELEMENT_TYPE, 2)); \
+ tmp->set_name (OCL_STRING (TYPE##2)); \
+ tmp = add (init_vector_type (ELEMENT_TYPE, 3)); \
+ tmp->set_name (OCL_STRING (TYPE##3)); \
+ tmp->set_length (4 * (ELEMENT_TYPE)->length ()); \
+ tmp = add (init_vector_type (ELEMENT_TYPE, 4)); \
+ tmp->set_name (OCL_STRING (TYPE##4)); \
+ tmp = add (init_vector_type (ELEMENT_TYPE, 8)); \
+ tmp->set_name (OCL_STRING (TYPE##8)); \
+ tmp = init_vector_type (ELEMENT_TYPE, 16); \
+ tmp->set_name (OCL_STRING (TYPE##16)); \
+ } \
+ while (false)
struct type *el_type, *char_type, *int_type;
@@ -926,11 +923,14 @@ public:
BUILD_OCL_VTYPES (long, el_type);
el_type = add (arch_integer_type (gdbarch, 64, 1, "ulong"));
BUILD_OCL_VTYPES (ulong, el_type);
- el_type = add (arch_float_type (gdbarch, 16, "half", floatformats_ieee_half));
+ el_type
+ = add (arch_float_type (gdbarch, 16, "half", floatformats_ieee_half));
BUILD_OCL_VTYPES (half, el_type);
- el_type = add (arch_float_type (gdbarch, 32, "float", floatformats_ieee_single));
+ el_type
+ = add (arch_float_type (gdbarch, 32, "float", floatformats_ieee_single));
BUILD_OCL_VTYPES (float, el_type);
- el_type = add (arch_float_type (gdbarch, 64, "double", floatformats_ieee_double));
+ el_type = add (arch_float_type (gdbarch, 64, "double",
+ floatformats_ieee_double));
BUILD_OCL_VTYPES (double, el_type);
add (arch_boolean_type (gdbarch, 8, 1, "bool"));
@@ -939,9 +939,12 @@ public:
add (arch_integer_type (gdbarch, 32, 1, "unsigned int"));
add (arch_integer_type (gdbarch, 64, 1, "unsigned long"));
add (arch_integer_type (gdbarch, gdbarch_ptr_bit (gdbarch), 1, "size_t"));
- add (arch_integer_type (gdbarch, gdbarch_ptr_bit (gdbarch), 0, "ptrdiff_t"));
- add (arch_integer_type (gdbarch, gdbarch_ptr_bit (gdbarch), 0, "intptr_t"));
- add (arch_integer_type (gdbarch, gdbarch_ptr_bit (gdbarch), 1, "uintptr_t"));
+ add (arch_integer_type (gdbarch, gdbarch_ptr_bit (gdbarch), 0,
+ "ptrdiff_t"));
+ add (arch_integer_type (gdbarch, gdbarch_ptr_bit (gdbarch), 0,
+ "intptr_t"));
+ add (arch_integer_type (gdbarch, gdbarch_ptr_bit (gdbarch), 1,
+ "uintptr_t"));
add (arch_type (gdbarch, TYPE_CODE_VOID, TARGET_CHAR_BIT, "void"));
/* Type of elements of strings. */
@@ -953,10 +956,7 @@ public:
/* See language.h. */
- bool can_print_type_offsets () const override
- {
- return true;
- }
+ bool can_print_type_offsets () const override { return true; }
/* See language.h. */
@@ -981,7 +981,9 @@ public:
/* See language.h. */
enum macro_expansion macro_expansion () const override
- { return macro_expansion_c; }
+ {
+ return macro_expansion_c;
+ }
};
/* Single instance of the OpenCL language class. */
diff --git a/gdb/or1k-linux-nat.c b/gdb/or1k-linux-nat.c
index 83b10476c74..397381cf6a9 100644
--- a/gdb/or1k-linux-nat.c
+++ b/gdb/or1k-linux-nat.c
@@ -33,6 +33,7 @@
class or1k_linux_nat_target final : public linux_nat_target
{
public:
+
/* Add our register access methods. */
void fetch_registers (struct regcache *regcache, int regnum) override;
void store_registers (struct regcache *regcache, int regnum) override;
@@ -117,8 +118,8 @@ supply_fpregset (struct regcache *regcache, const gdb_fpregset_t *fpregs)
}
void
-fill_fpregset (const struct regcache *regcache,
- gdb_fpregset_t *fpregs, int regno)
+fill_fpregset (const struct regcache *regcache, gdb_fpregset_t *fpregs,
+ int regno)
{
}
@@ -138,11 +139,10 @@ or1k_linux_nat_target::fetch_registers (struct regcache *regcache, int regnum)
{
int tid;
- tid = get_ptrace_pid (regcache->ptid());
+ tid = get_ptrace_pid (regcache->ptid ());
if ((regnum >= OR1K_ZERO_REGNUM && regnum < OR1K_MAX_GPR_REGS)
- || (regnum == OR1K_NPC_REGNUM)
- || (regnum == -1))
+ || (regnum == OR1K_NPC_REGNUM) || (regnum == -1))
{
struct iovec iov;
elf_gregset_t regs;
@@ -150,9 +150,9 @@ or1k_linux_nat_target::fetch_registers (struct regcache *regcache, int regnum)
iov.iov_base = &regs;
iov.iov_len = sizeof (regs);
- if (ptrace (PTRACE_GETREGSET, tid, NT_PRSTATUS,
- (PTRACE_TYPE_ARG3) &iov) == -1)
- perror_with_name (_("Couldn't get registers"));
+ if (ptrace (PTRACE_GETREGSET, tid, NT_PRSTATUS, (PTRACE_TYPE_ARG3) &iov)
+ == -1)
+ perror_with_name (_ ("Couldn't get registers"));
else
supply_gregset_regnum (regcache, &regs, regnum);
}
@@ -172,8 +172,7 @@ or1k_linux_nat_target::store_registers (struct regcache *regcache, int regnum)
tid = get_ptrace_pid (regcache->ptid ());
if ((regnum >= OR1K_ZERO_REGNUM && regnum < OR1K_MAX_GPR_REGS)
- || (regnum == OR1K_NPC_REGNUM)
- || (regnum == -1))
+ || (regnum == OR1K_NPC_REGNUM) || (regnum == -1))
{
struct iovec iov;
elf_gregset_t regs;
@@ -181,16 +180,17 @@ or1k_linux_nat_target::store_registers (struct regcache *regcache, int regnum)
iov.iov_base = &regs;
iov.iov_len = sizeof (regs);
- if (ptrace (PTRACE_GETREGSET, tid, NT_PRSTATUS,
- (PTRACE_TYPE_ARG3) &iov) == -1)
- perror_with_name (_("Couldn't get registers"));
+ if (ptrace (PTRACE_GETREGSET, tid, NT_PRSTATUS, (PTRACE_TYPE_ARG3) &iov)
+ == -1)
+ perror_with_name (_ ("Couldn't get registers"));
else
{
fill_gregset (regcache, &regs, regnum);
if (ptrace (PTRACE_SETREGSET, tid, NT_PRSTATUS,
- (PTRACE_TYPE_ARG3) &iov) == -1)
- perror_with_name (_("Couldn't set registers"));
+ (PTRACE_TYPE_ARG3) &iov)
+ == -1)
+ perror_with_name (_ ("Couldn't set registers"));
}
}
@@ -201,6 +201,7 @@ or1k_linux_nat_target::store_registers (struct regcache *regcache, int regnum)
/* Initialize OpenRISC Linux native support. */
void _initialize_or1k_linux_nat ();
+
void
_initialize_or1k_linux_nat ()
{
diff --git a/gdb/or1k-linux-tdep.c b/gdb/or1k-linux-tdep.c
index 1d66a971c01..664fe7e7be9 100644
--- a/gdb/or1k-linux-tdep.c
+++ b/gdb/or1k-linux-tdep.c
@@ -34,19 +34,15 @@
linux and 33 in GDB, in GDB 32 is for PPC which is not popupated from linux.
Register r0 is always 0 and can be ignored. */
-static const struct regcache_map_entry or1k_linux_gregmap[] =
-{
- { 32, OR1K_ZERO_REGNUM, 4 }, /* r0 to r31 */
- { 1, OR1K_NPC_REGNUM, 4 },
- { 0 }
-};
+static const struct regcache_map_entry or1k_linux_gregmap[]
+ = { { 32, OR1K_ZERO_REGNUM, 4 }, /* r0 to r31 */
+ { 1, OR1K_NPC_REGNUM, 4 },
+ { 0 } };
/* Define the general register regset. */
-static const struct regset or1k_linux_gregset =
-{
- or1k_linux_gregmap, regcache_supply_regset, regcache_collect_regset
-};
+static const struct regset or1k_linux_gregset
+ = { or1k_linux_gregmap, regcache_supply_regset, regcache_collect_regset };
/* Define hook for core file support. */
@@ -62,28 +58,25 @@ or1k_linux_iterate_over_regset_sections (struct gdbarch *gdbarch,
/* Signal trampoline support. */
static void or1k_linux_sigframe_init (const struct tramp_frame *self,
- frame_info_ptr this_frame,
- struct trad_frame_cache *this_cache,
- CORE_ADDR func);
-
-#define OR1K_RT_SIGRETURN 139
-
-#define OR1K_INST_L_ORI_R11_R0_IMM 0xa9600000
-#define OR1K_INST_L_SYS_1 0x20000001
-#define OR1K_INST_L_NOP 0x15000000
-
-static const struct tramp_frame or1k_linux_sigframe = {
- SIGTRAMP_FRAME,
- 4,
- {
- { OR1K_INST_L_ORI_R11_R0_IMM | OR1K_RT_SIGRETURN, ULONGEST_MAX },
- { OR1K_INST_L_SYS_1, ULONGEST_MAX },
- { OR1K_INST_L_NOP, ULONGEST_MAX },
- { TRAMP_SENTINEL_INSN }
- },
- or1k_linux_sigframe_init,
- NULL
-};
+ frame_info_ptr this_frame,
+ struct trad_frame_cache *this_cache,
+ CORE_ADDR func);
+
+#define OR1K_RT_SIGRETURN 139
+
+#define OR1K_INST_L_ORI_R11_R0_IMM 0xa9600000
+#define OR1K_INST_L_SYS_1 0x20000001
+#define OR1K_INST_L_NOP 0x15000000
+
+static const struct tramp_frame or1k_linux_sigframe
+ = { SIGTRAMP_FRAME,
+ 4,
+ { { OR1K_INST_L_ORI_R11_R0_IMM | OR1K_RT_SIGRETURN, ULONGEST_MAX },
+ { OR1K_INST_L_SYS_1, ULONGEST_MAX },
+ { OR1K_INST_L_NOP, ULONGEST_MAX },
+ { TRAMP_SENTINEL_INSN } },
+ or1k_linux_sigframe_init,
+ NULL };
/* Runtime signal frames look like this:
struct rt_sigframe {
@@ -111,14 +104,13 @@ static const struct tramp_frame or1k_linux_sigframe = {
unsigned long sr;
}; */
-#define SIGFRAME_SIGINFO_SIZE 128
-#define UCONTEXT_MCONTEXT_OFFSET 20
+#define SIGFRAME_SIGINFO_SIZE 128
+#define UCONTEXT_MCONTEXT_OFFSET 20
static void
or1k_linux_sigframe_init (const struct tramp_frame *self,
- frame_info_ptr this_frame,
- struct trad_frame_cache *this_cache,
- CORE_ADDR func)
+ frame_info_ptr this_frame,
+ struct trad_frame_cache *this_cache, CORE_ADDR func)
{
CORE_ADDR frame_sp = get_frame_sp (this_frame);
CORE_ADDR mcontext_base;
@@ -160,8 +152,8 @@ or1k_linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
set_gdbarch_fetch_tls_load_module_address (gdbarch,
svr4_fetch_objfile_link_map);
- set_gdbarch_iterate_over_regset_sections
- (gdbarch, or1k_linux_iterate_over_regset_sections);
+ set_gdbarch_iterate_over_regset_sections (
+ gdbarch, or1k_linux_iterate_over_regset_sections);
tramp_frame_prepend_unwinder (gdbarch, &or1k_linux_sigframe);
}
@@ -169,6 +161,7 @@ or1k_linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
/* Initialize OpenRISC Linux target support. */
void _initialize_or1k_linux_tdep ();
+
void
_initialize_or1k_linux_tdep ()
{
diff --git a/gdb/or1k-tdep.c b/gdb/or1k-tdep.c
index 3616d7751ca..90d60381d5e 100644
--- a/gdb/or1k-tdep.c
+++ b/gdb/or1k-tdep.c
@@ -46,7 +46,6 @@
/* OpenRISC specific includes. */
#include "or1k-tdep.h"
#include "features/or1k.c"
-
/* Global debug flag. */
@@ -56,10 +55,9 @@ static void
show_or1k_debug (struct ui_file *file, int from_tty,
struct cmd_list_element *c, const char *value)
{
- gdb_printf (file, _("OpenRISC debugging is %s.\n"), value);
+ gdb_printf (file, _ ("OpenRISC debugging is %s.\n"), value);
}
-
/* The target-dependent structure for gdbarch. */
struct or1k_gdbarch_tdep : gdbarch_tdep_base
@@ -79,9 +77,10 @@ or1k_fetch_instruction (struct gdbarch *gdbarch, CORE_ADDR addr)
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
gdb_byte buf[OR1K_INSTLEN];
- if (target_read_code (addr, buf, OR1K_INSTLEN)) {
- memory_error (TARGET_XFER_E_IO, addr);
- }
+ if (target_read_code (addr, buf, OR1K_INSTLEN))
+ {
+ memory_error (TARGET_XFER_E_IO, addr);
+ }
return extract_unsigned_integer (buf, OR1K_INSTLEN, byte_order);
}
@@ -103,7 +102,7 @@ or1k_analyse_inst (uint32_t inst, const char *format, ...)
const char *start_ptr;
char *end_ptr;
- uint32_t bits; /* Bit substring of interest */
+ uint32_t bits; /* Bit substring of interest */
uint32_t width; /* Substring width */
uint32_t *arg_ptr;
@@ -131,7 +130,7 @@ or1k_analyse_inst (uint32_t inst, const char *format, ...)
/* Check we got something, and if so skip on. */
if (start_ptr == end_ptr)
- error (_("bitstring \"%s\" at offset %d has no length field."),
+ error (_ ("bitstring \"%s\" at offset %d has no length field."),
format, i);
i += end_ptr - start_ptr;
@@ -140,7 +139,7 @@ or1k_analyse_inst (uint32_t inst, const char *format, ...)
still give a fatal error, because these are fixed strings that
just should not be wrong. */
if ('b' != format[i++])
- error (_("bitstring \"%s\" at offset %d has no terminating 'b'."),
+ error (_ ("bitstring \"%s\" at offset %d has no terminating 'b'."),
format, i);
/* Break out the field. There is a special case with a bit width
@@ -148,8 +147,8 @@ or1k_analyse_inst (uint32_t inst, const char *format, ...)
if (32 == width)
bits = inst;
else
- bits =
- (inst >> (OR1K_INSTBITLEN - iptr - width)) & ((1 << width) - 1);
+ bits = (inst >> (OR1K_INSTBITLEN - iptr - width))
+ & ((1 << width) - 1);
arg_ptr = va_arg (ap, uint32_t *);
*arg_ptr = bits;
@@ -157,7 +156,7 @@ or1k_analyse_inst (uint32_t inst, const char *format, ...)
break;
default:
- error (_("invalid character in bitstring \"%s\" at offset %d."),
+ error (_ ("invalid character in bitstring \"%s\" at offset %d."),
format, i);
break;
}
@@ -180,8 +179,8 @@ or1k_analyse_inst (uint32_t inst, const char *format, ...)
false on failure. */
static bool
-or1k_analyse_l_addi (uint32_t inst, unsigned int *rd_ptr,
- unsigned int *ra_ptr, int *simm_ptr)
+or1k_analyse_l_addi (uint32_t inst, unsigned int *rd_ptr, unsigned int *ra_ptr,
+ int *simm_ptr)
{
/* Instruction fields */
uint32_t rd, ra, i;
@@ -233,7 +232,6 @@ or1k_analyse_l_sw (uint32_t inst, int *simm_ptr, unsigned int *ra_ptr,
else
return false; /* Failure */
}
-
/* Functions defining the architecture. */
@@ -285,11 +283,10 @@ or1k_return_value (struct gdbarch *gdbarch, struct value *functype,
regcache_cooked_read_unsigned (regcache, OR1K_RV_REGNUM, &tmp);
store_unsigned_integer (readbuf, rv_size, byte_order, tmp);
-
}
if (writebuf != NULL)
{
- gdb_byte *buf = XCNEWVEC(gdb_byte, bpw);
+ gdb_byte *buf = XCNEWVEC (gdb_byte, bpw);
if (BFD_ENDIAN_BIG == byte_order)
memcpy (buf + (sizeof (gdb_byte) * bpw) - rv_size, writebuf,
@@ -311,8 +308,7 @@ or1k_return_value (struct gdbarch *gdbarch, struct value *functype,
ULONGEST tmp_hi;
ULONGEST tmp;
- regcache_cooked_read_unsigned (regcache, OR1K_RV_REGNUM,
- &tmp_hi);
+ regcache_cooked_read_unsigned (regcache, OR1K_RV_REGNUM, &tmp_hi);
regcache_cooked_read_unsigned (regcache, OR1K_RV_REGNUM + 1,
&tmp_lo);
tmp = (tmp_hi << (bpw * 8)) | tmp_lo;
@@ -321,8 +317,8 @@ or1k_return_value (struct gdbarch *gdbarch, struct value *functype,
}
if (writebuf != NULL)
{
- gdb_byte *buf_lo = XCNEWVEC(gdb_byte, bpw);
- gdb_byte *buf_hi = XCNEWVEC(gdb_byte, bpw);
+ gdb_byte *buf_lo = XCNEWVEC (gdb_byte, bpw);
+ gdb_byte *buf_hi = XCNEWVEC (gdb_byte, bpw);
/* This is cheating. We assume that we fit in 2 words exactly,
which wouldn't work if we had (say) a 6-byte scalar type on a
@@ -343,7 +339,7 @@ or1k_return_value (struct gdbarch *gdbarch, struct value *functype,
/* OR1K always uses a l.trap instruction for breakpoints. */
-constexpr gdb_byte or1k_break_insn[] = {0x21, 0x00, 0x00, 0x01};
+constexpr gdb_byte or1k_break_insn[] = { 0x21, 0x00, 0x00, 0x01 };
typedef BP_MANIPULATION (or1k_break_insn) or1k_breakpoint;
@@ -354,10 +350,9 @@ or1k_delay_slot_p (struct gdbarch *gdbarch, CORE_ADDR pc)
CGEN_FIELDS tmp_fields;
or1k_gdbarch_tdep *tdep = gdbarch_tdep<or1k_gdbarch_tdep> (gdbarch);
- insn = cgen_lookup_insn (tdep->gdb_cgen_cpu_desc,
- NULL,
- or1k_fetch_instruction (gdbarch, pc),
- NULL, 32, &tmp_fields, 0);
+ insn = cgen_lookup_insn (tdep->gdb_cgen_cpu_desc, NULL,
+ or1k_fetch_instruction (gdbarch, pc), NULL, 32,
+ &tmp_fields, 0);
/* NULL here would mean the last instruction was not understood by cgen.
This should not usually happen, but if does its not a delay slot. */
@@ -416,17 +411,16 @@ or1k_software_single_step (struct regcache *regcache)
if (or1k_delay_slot_p (gdbarch, pc))
next_pc += 4;
- return {next_pc};
+ return { next_pc };
}
/* Name for or1k general registers. */
static const char *const or1k_reg_names[OR1K_NUM_REGS] = {
/* general purpose registers */
- "r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7",
- "r8", "r9", "r10", "r11", "r12", "r13", "r14", "r15",
- "r16", "r17", "r18", "r19", "r20", "r21", "r22", "r23",
- "r24", "r25", "r26", "r27", "r28", "r29", "r30", "r31",
+ "r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7", "r8", "r9", "r10", "r11",
+ "r12", "r13", "r14", "r15", "r16", "r17", "r18", "r19", "r20", "r21", "r22",
+ "r23", "r24", "r25", "r26", "r27", "r28", "r29", "r30", "r31",
/* previous program counter, next program counter and status register */
"ppc", "npc", "sr"
@@ -435,8 +429,7 @@ static const char *const or1k_reg_names[OR1K_NUM_REGS] = {
static int
or1k_is_arg_reg (unsigned int regnum)
{
- return (OR1K_FIRST_ARG_REGNUM <= regnum)
- && (regnum <= OR1K_LAST_ARG_REGNUM);
+ return (OR1K_FIRST_ARG_REGNUM <= regnum) && (regnum <= OR1K_LAST_ARG_REGNUM);
}
static int
@@ -469,8 +462,7 @@ or1k_skip_prologue (struct gdbarch *gdbarch, CORE_ADDR pc)
if (0 != prologue_end)
{
struct symtab_and_line prologue_sal = find_pc_line (start_pc, 0);
- struct compunit_symtab *compunit
- = prologue_sal.symtab->compunit ();
+ struct compunit_symtab *compunit = prologue_sal.symtab->compunit ();
const char *debug_format = compunit->debugformat ();
if ((NULL != debug_format)
@@ -488,9 +480,8 @@ or1k_skip_prologue (struct gdbarch *gdbarch, CORE_ADDR pc)
inst = or1k_fetch_instruction (gdbarch, addr);
/* Look for the new stack pointer being set up. */
- if (or1k_analyse_l_addi (inst, &rd, &ra, &simm)
- && (OR1K_SP_REGNUM == rd) && (OR1K_SP_REGNUM == ra)
- && (simm < 0) && (0 == (simm % 4)))
+ if (or1k_analyse_l_addi (inst, &rd, &ra, &simm) && (OR1K_SP_REGNUM == rd)
+ && (OR1K_SP_REGNUM == ra) && (simm < 0) && (0 == (simm % 4)))
{
frame_size = -simm;
addr += OR1K_INSTLEN;
@@ -498,9 +489,8 @@ or1k_skip_prologue (struct gdbarch *gdbarch, CORE_ADDR pc)
}
/* Look for the frame pointer being manipulated. */
- if (or1k_analyse_l_sw (inst, &simm, &ra, &rb)
- && (OR1K_SP_REGNUM == ra) && (OR1K_FP_REGNUM == rb)
- && (simm >= 0) && (0 == (simm % 4)))
+ if (or1k_analyse_l_sw (inst, &simm, &ra, &rb) && (OR1K_SP_REGNUM == ra)
+ && (OR1K_FP_REGNUM == rb) && (simm >= 0) && (0 == (simm % 4)))
{
addr += OR1K_INSTLEN;
inst = or1k_fetch_instruction (gdbarch, addr);
@@ -514,9 +504,8 @@ or1k_skip_prologue (struct gdbarch *gdbarch, CORE_ADDR pc)
}
/* Look for the link register being saved. */
- if (or1k_analyse_l_sw (inst, &simm, &ra, &rb)
- && (OR1K_SP_REGNUM == ra) && (OR1K_LR_REGNUM == rb)
- && (simm >= 0) && (0 == (simm % 4)))
+ if (or1k_analyse_l_sw (inst, &simm, &ra, &rb) && (OR1K_SP_REGNUM == ra)
+ && (OR1K_LR_REGNUM == rb) && (simm >= 0) && (0 == (simm % 4)))
{
addr += OR1K_INSTLEN;
inst = or1k_fetch_instruction (gdbarch, addr);
@@ -569,8 +558,7 @@ or1k_unwind_pc (struct gdbarch *gdbarch, frame_info_ptr next_frame)
pc = frame_unwind_register_unsigned (next_frame, OR1K_NPC_REGNUM);
if (or1k_debug)
- gdb_printf (gdb_stdlog, "or1k_unwind_pc, pc=%s\n",
- paddress (gdbarch, pc));
+ gdb_printf (gdb_stdlog, "or1k_unwind_pc, pc=%s\n", paddress (gdbarch, pc));
return pc;
}
@@ -589,8 +577,7 @@ or1k_unwind_sp (struct gdbarch *gdbarch, frame_info_ptr next_frame)
sp = frame_unwind_register_unsigned (next_frame, OR1K_SP_REGNUM);
if (or1k_debug)
- gdb_printf (gdb_stdlog, "or1k_unwind_sp, sp=%s\n",
- paddress (gdbarch, sp));
+ gdb_printf (gdb_stdlog, "or1k_unwind_sp, sp=%s\n", paddress (gdbarch, sp));
return sp;
}
@@ -600,8 +587,8 @@ or1k_unwind_sp (struct gdbarch *gdbarch, frame_info_ptr next_frame)
static CORE_ADDR
or1k_push_dummy_code (struct gdbarch *gdbarch, CORE_ADDR sp,
CORE_ADDR function, struct value **args, int nargs,
- struct type *value_type, CORE_ADDR * real_pc,
- CORE_ADDR * bp_addr, struct regcache *regcache)
+ struct type *value_type, CORE_ADDR *real_pc,
+ CORE_ADDR *bp_addr, struct regcache *regcache)
{
CORE_ADDR bp_slot;
@@ -621,12 +608,11 @@ or1k_push_dummy_code (struct gdbarch *gdbarch, CORE_ADDR sp,
static CORE_ADDR
or1k_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
- struct regcache *regcache, CORE_ADDR bp_addr,
- int nargs, struct value **args, CORE_ADDR sp,
+ struct regcache *regcache, CORE_ADDR bp_addr, int nargs,
+ struct value **args, CORE_ADDR sp,
function_call_return_method return_method,
CORE_ADDR struct_addr)
{
-
int argreg;
int argnum;
int first_stack_arg;
@@ -707,8 +693,8 @@ or1k_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
if (argreg <= (OR1K_LAST_ARG_REGNUM - 1))
{
- ULONGEST regval = extract_unsigned_integer (val, len,
- byte_order);
+ ULONGEST regval
+ = extract_unsigned_integer (val, len, byte_order);
unsigned int bits_per_word = bpw * 8;
ULONGEST mask = (((ULONGEST) 1) << bits_per_word) - 1;
@@ -728,9 +714,8 @@ or1k_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
else if (argreg <= OR1K_LAST_ARG_REGNUM)
{
/* Smaller scalars fit in a single register. */
- regcache_cooked_write_unsigned
- (regcache, argreg, extract_unsigned_integer (val, len,
- byte_order));
+ regcache_cooked_write_unsigned (
+ regcache, argreg, extract_unsigned_integer (val, len, byte_order));
argreg++;
}
else
@@ -819,8 +804,6 @@ or1k_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
return sp;
}
-
-
/* Support functions for frame handling. */
/* Initialize a prologue cache
@@ -903,8 +886,7 @@ or1k_frame_cache (frame_info_ptr this_frame, void **prologue_cache)
CORE_ADDR end_addr;
if (or1k_debug)
- gdb_printf (gdb_stdlog,
- "or1k_frame_cache, prologue_cache = %s\n",
+ gdb_printf (gdb_stdlog, "or1k_frame_cache, prologue_cache = %s\n",
host_address_to_string (*prologue_cache));
/* Nothing to do if we already have this info. */
@@ -922,8 +904,9 @@ or1k_frame_cache (frame_info_ptr this_frame, void **prologue_cache)
/* Get the stack pointer if we have one (if there's no process executing
yet we won't have a frame. */
- this_sp = (NULL == this_frame) ? 0 :
- get_frame_register_unsigned (this_frame, OR1K_SP_REGNUM);
+ this_sp = (NULL == this_frame)
+ ? 0
+ : get_frame_register_unsigned (this_frame, OR1K_SP_REGNUM);
/* Return early if GDB couldn't find the function. */
if (start_addr == 0)
@@ -964,7 +947,7 @@ or1k_frame_cache (frame_info_ptr this_frame, void **prologue_cache)
have executed the code. Check we have a sane prologue size, and if
zero we are frameless and can give up here. */
if (end_addr < start_addr)
- error (_("end addr %s is less than start addr %s"),
+ error (_ ("end addr %s is less than start addr %s"),
paddress (gdbarch, end_addr), paddress (gdbarch, start_addr));
if (end_addr == start_addr)
@@ -979,9 +962,8 @@ or1k_frame_cache (frame_info_ptr this_frame, void **prologue_cache)
int simm;
/* Look for the new stack pointer being set up. */
- if (or1k_analyse_l_addi (inst, &rd, &ra, &simm)
- && (OR1K_SP_REGNUM == rd) && (OR1K_SP_REGNUM == ra)
- && (simm < 0) && (0 == (simm % 4)))
+ if (or1k_analyse_l_addi (inst, &rd, &ra, &simm) && (OR1K_SP_REGNUM == rd)
+ && (OR1K_SP_REGNUM == ra) && (simm < 0) && (0 == (simm % 4)))
{
frame_size = -simm;
addr += OR1K_INSTLEN;
@@ -1016,10 +998,9 @@ or1k_frame_cache (frame_info_ptr this_frame, void **prologue_cache)
end_addr = (this_pc < end_addr) ? this_pc : end_addr;
/* Look for the frame pointer being manipulated. */
- if ((addr < end_addr)
- && or1k_analyse_l_sw (inst, &simm, &ra, &rb)
- && (OR1K_SP_REGNUM == ra) && (OR1K_FP_REGNUM == rb)
- && (simm >= 0) && (0 == (simm % 4)))
+ if ((addr < end_addr) && or1k_analyse_l_sw (inst, &simm, &ra, &rb)
+ && (OR1K_SP_REGNUM == ra) && (OR1K_FP_REGNUM == rb) && (simm >= 0)
+ && (0 == (simm % 4)))
{
addr += OR1K_INSTLEN;
inst = or1k_fetch_instruction (gdbarch, addr);
@@ -1029,8 +1010,7 @@ or1k_frame_cache (frame_info_ptr this_frame, void **prologue_cache)
trad_frame_set_reg_addr (info, OR1K_FP_REGNUM, this_sp + simm);
/* Look for the new frame pointer being set up. */
- if ((addr < end_addr)
- && or1k_analyse_l_addi (inst, &rd, &ra, &simm)
+ if ((addr < end_addr) && or1k_analyse_l_addi (inst, &rd, &ra, &simm)
&& (OR1K_FP_REGNUM == rd) && (OR1K_SP_REGNUM == ra)
&& (simm == frame_size))
{
@@ -1045,10 +1025,9 @@ or1k_frame_cache (frame_info_ptr this_frame, void **prologue_cache)
}
/* Look for the link register being saved. */
- if ((addr < end_addr)
- && or1k_analyse_l_sw (inst, &simm, &ra, &rb)
- && (OR1K_SP_REGNUM == ra) && (OR1K_LR_REGNUM == rb)
- && (simm >= 0) && (0 == (simm % 4)))
+ if ((addr < end_addr) && or1k_analyse_l_sw (inst, &simm, &ra, &rb)
+ && (OR1K_SP_REGNUM == ra) && (OR1K_LR_REGNUM == rb) && (simm >= 0)
+ && (0 == (simm % 4)))
{
addr += OR1K_INSTLEN;
inst = or1k_fetch_instruction (gdbarch, addr);
@@ -1069,8 +1048,7 @@ or1k_frame_cache (frame_info_ptr this_frame, void **prologue_cache)
{
if (or1k_analyse_l_sw (inst, &simm, &ra, &rb)
&& (((OR1K_FP_REGNUM == ra) && or1k_is_arg_reg (rb))
- || ((OR1K_SP_REGNUM == ra)
- && or1k_is_callee_saved_reg (rb)))
+ || ((OR1K_SP_REGNUM == ra) && or1k_is_callee_saved_reg (rb)))
&& (0 == (simm % 4)))
{
addr += OR1K_INSTLEN;
@@ -1102,11 +1080,11 @@ or1k_frame_cache (frame_info_ptr this_frame, void **prologue_cache)
/* Implement the this_id function for the stub unwinder. */
static void
-or1k_frame_this_id (frame_info_ptr this_frame,
- void **prologue_cache, struct frame_id *this_id)
+or1k_frame_this_id (frame_info_ptr this_frame, void **prologue_cache,
+ struct frame_id *this_id)
{
- struct trad_frame_cache *info = or1k_frame_cache (this_frame,
- prologue_cache);
+ struct trad_frame_cache *info
+ = or1k_frame_cache (this_frame, prologue_cache);
trad_frame_get_id (info, this_id);
}
@@ -1114,11 +1092,11 @@ or1k_frame_this_id (frame_info_ptr this_frame,
/* Implement the prev_register function for the stub unwinder. */
static struct value *
-or1k_frame_prev_register (frame_info_ptr this_frame,
- void **prologue_cache, int regnum)
+or1k_frame_prev_register (frame_info_ptr this_frame, void **prologue_cache,
+ int regnum)
{
- struct trad_frame_cache *info = or1k_frame_cache (this_frame,
- prologue_cache);
+ struct trad_frame_cache *info
+ = or1k_frame_cache (this_frame, prologue_cache);
return trad_frame_get_register (info, this_frame, regnum);
}
@@ -1179,10 +1157,8 @@ or1k_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
/* Information about the target architecture */
set_gdbarch_return_value (gdbarch, or1k_return_value);
- set_gdbarch_breakpoint_kind_from_pc (gdbarch,
- or1k_breakpoint::kind_from_pc);
- set_gdbarch_sw_breakpoint_from_kind (gdbarch,
- or1k_breakpoint::bp_from_kind);
+ set_gdbarch_breakpoint_kind_from_pc (gdbarch, or1k_breakpoint::kind_from_pc);
+ set_gdbarch_sw_breakpoint_from_kind (gdbarch, or1k_breakpoint::bp_from_kind);
set_gdbarch_have_nonsteppable_watchpoint (gdbarch, 1);
/* Register architecture */
@@ -1215,14 +1191,14 @@ or1k_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
/* Get a CGEN CPU descriptor for this architecture. */
{
-
const char *mach_name = binfo->printable_name;
- enum cgen_endian endian = (info.byte_order == BFD_ENDIAN_BIG
- ? CGEN_ENDIAN_BIG : CGEN_ENDIAN_LITTLE);
+ enum cgen_endian endian
+ = (info.byte_order == BFD_ENDIAN_BIG ? CGEN_ENDIAN_BIG
+ : CGEN_ENDIAN_LITTLE);
- tdep->gdb_cgen_cpu_desc =
- or1k_cgen_cpu_open (CGEN_CPU_OPEN_BFDMACH, mach_name,
- CGEN_CPU_OPEN_ENDIAN, endian, CGEN_CPU_OPEN_END);
+ tdep->gdb_cgen_cpu_desc
+ = or1k_cgen_cpu_open (CGEN_CPU_OPEN_BFDMACH, mach_name,
+ CGEN_CPU_OPEN_ENDIAN, endian, CGEN_CPU_OPEN_END);
or1k_cgen_init_asm (tdep->gdb_cgen_cpu_desc);
}
@@ -1283,9 +1259,9 @@ or1k_dump_tdep (struct gdbarch *gdbarch, struct ui_file *file)
gdb_printf (file, "or1k_dump_tdep: %d bytes per address\n",
tdep->bytes_per_address);
}
-
void _initialize_or1k_tdep ();
+
void
_initialize_or1k_tdep ()
{
@@ -1295,11 +1271,9 @@ _initialize_or1k_tdep ()
initialize_tdesc_or1k ();
/* Debugging flag. */
- add_setshow_boolean_cmd ("or1k", class_maintenance, &or1k_debug,
- _("Set OpenRISC debugging."),
- _("Show OpenRISC debugging."),
- _("When on, OpenRISC specific debugging is enabled."),
- NULL,
- show_or1k_debug,
- &setdebuglist, &showdebuglist);
+ add_setshow_boolean_cmd (
+ "or1k", class_maintenance, &or1k_debug, _ ("Set OpenRISC debugging."),
+ _ ("Show OpenRISC debugging."),
+ _ ("When on, OpenRISC specific debugging is enabled."), NULL,
+ show_or1k_debug, &setdebuglist, &showdebuglist);
}
diff --git a/gdb/or1k-tdep.h b/gdb/or1k-tdep.h
index a11950584d7..21be1c7b83d 100644
--- a/gdb/or1k-tdep.h
+++ b/gdb/or1k-tdep.h
@@ -27,34 +27,33 @@
#include "opcodes/or1k-opc.h"
/* General Purpose Registers */
-#define OR1K_ZERO_REGNUM 0
-#define OR1K_SP_REGNUM 1
-#define OR1K_FP_REGNUM 2
-#define OR1K_FIRST_ARG_REGNUM 3
-#define OR1K_LAST_ARG_REGNUM 8
-#define OR1K_LR_REGNUM 9
-#define OR1K_FIRST_SAVED_REGNUM 10
-#define OR1K_RV_REGNUM 11
-#define OR1K_PPC_REGNUM (OR1K_MAX_GPR_REGS + 0)
-#define OR1K_NPC_REGNUM (OR1K_MAX_GPR_REGS + 1)
-#define OR1K_SR_REGNUM (OR1K_MAX_GPR_REGS + 2)
+#define OR1K_ZERO_REGNUM 0
+#define OR1K_SP_REGNUM 1
+#define OR1K_FP_REGNUM 2
+#define OR1K_FIRST_ARG_REGNUM 3
+#define OR1K_LAST_ARG_REGNUM 8
+#define OR1K_LR_REGNUM 9
+#define OR1K_FIRST_SAVED_REGNUM 10
+#define OR1K_RV_REGNUM 11
+#define OR1K_PPC_REGNUM (OR1K_MAX_GPR_REGS + 0)
+#define OR1K_NPC_REGNUM (OR1K_MAX_GPR_REGS + 1)
+#define OR1K_SR_REGNUM (OR1K_MAX_GPR_REGS + 2)
/* Properties of the architecture. GDB mapping of registers is all the GPRs
and SPRs followed by the PPC, NPC and SR at the end. Red zone is the area
past the end of the stack reserved for exception handlers etc. */
-#define OR1K_MAX_GPR_REGS 32
-#define OR1K_NUM_PSEUDO_REGS 0
-#define OR1K_NUM_REGS (OR1K_MAX_GPR_REGS + 3)
-#define OR1K_STACK_ALIGN 4
-#define OR1K_INSTLEN 4
-#define OR1K_INSTBITLEN (OR1K_INSTLEN * 8)
-#define OR1K_NUM_TAP_RECORDS 8
-#define OR1K_FRAME_RED_ZONE_SIZE 2536
+#define OR1K_MAX_GPR_REGS 32
+#define OR1K_NUM_PSEUDO_REGS 0
+#define OR1K_NUM_REGS (OR1K_MAX_GPR_REGS + 3)
+#define OR1K_STACK_ALIGN 4
+#define OR1K_INSTLEN 4
+#define OR1K_INSTBITLEN (OR1K_INSTLEN * 8)
+#define OR1K_NUM_TAP_RECORDS 8
+#define OR1K_FRAME_RED_ZONE_SIZE 2536
/* Single step based on where the current instruction will take us. */
-extern std::vector<CORE_ADDR> or1k_software_single_step
- (struct regcache *regcache);
-
+extern std::vector<CORE_ADDR>
+or1k_software_single_step (struct regcache *regcache);
#endif /* OR1K_TDEP_H */
diff --git a/gdb/osabi.c b/gdb/osabi.c
index d18802ac3a4..b53dc437ac6 100644
--- a/gdb/osabi.c
+++ b/gdb/osabi.c
@@ -34,12 +34,8 @@
/* State for the "set osabi" command. */
static enum { osabi_auto, osabi_default, osabi_user } user_osabi_state;
static enum gdb_osabi user_selected_osabi;
-static const char *gdb_osabi_available_names[GDB_OSABI_INVALID + 3] = {
- "auto",
- "default",
- "none",
- NULL
-};
+static const char *gdb_osabi_available_names[GDB_OSABI_INVALID + 3]
+ = { "auto", "default", "none", NULL };
static const char *set_osabi_string;
/* Names associated with each osabi. */
@@ -57,34 +53,21 @@ struct osabi_names
/* This table matches the indices assigned to enum gdb_osabi. Keep
them in sync. */
-static const struct osabi_names gdb_osabi_names[] =
-{
- { "unknown", NULL },
- { "none", NULL },
-
- { "SVR4", NULL },
- { "GNU/Hurd", NULL },
- { "Solaris", NULL },
- { "GNU/Linux", "linux(-gnu[^-]*)?" },
- { "FreeBSD", NULL },
- { "NetBSD", NULL },
- { "OpenBSD", NULL },
- { "WindowsCE", NULL },
- { "DJGPP", NULL },
- { "QNX-Neutrino", NULL },
- { "Cygwin", NULL },
- { "Windows", NULL },
- { "AIX", NULL },
- { "DICOS", NULL },
- { "Darwin", NULL },
- { "OpenVMS", NULL },
- { "LynxOS178", NULL },
- { "Newlib", NULL },
- { "SDE", NULL },
- { "PikeOS", NULL },
-
- { "<invalid>", NULL }
-};
+static const struct osabi_names gdb_osabi_names[]
+ = { { "unknown", NULL }, { "none", NULL },
+
+ { "SVR4", NULL }, { "GNU/Hurd", NULL },
+ { "Solaris", NULL }, { "GNU/Linux", "linux(-gnu[^-]*)?" },
+ { "FreeBSD", NULL }, { "NetBSD", NULL },
+ { "OpenBSD", NULL }, { "WindowsCE", NULL },
+ { "DJGPP", NULL }, { "QNX-Neutrino", NULL },
+ { "Cygwin", NULL }, { "Windows", NULL },
+ { "AIX", NULL }, { "DICOS", NULL },
+ { "Darwin", NULL }, { "OpenVMS", NULL },
+ { "LynxOS178", NULL }, { "Newlib", NULL },
+ { "SDE", NULL }, { "PikeOS", NULL },
+
+ { "<invalid>", NULL } };
const char *
gdbarch_osabi_name (enum gdb_osabi osabi)
@@ -137,7 +120,7 @@ struct gdb_osabi_handler
struct gdb_osabi_handler *next;
const struct bfd_arch_info *arch_info;
enum gdb_osabi osabi;
- void (*init_osabi)(struct gdbarch_info, struct gdbarch *);
+ void (*init_osabi) (struct gdbarch_info, struct gdbarch *);
};
static struct gdb_osabi_handler *gdb_osabi_handler_list;
@@ -145,8 +128,8 @@ static struct gdb_osabi_handler *gdb_osabi_handler_list;
void
gdbarch_register_osabi (enum bfd_architecture arch, unsigned long machine,
enum gdb_osabi osabi,
- void (*init_osabi)(struct gdbarch_info,
- struct gdbarch *))
+ void (*init_osabi) (struct gdbarch_info,
+ struct gdbarch *))
{
struct gdb_osabi_handler **handler_p;
const struct bfd_arch_info *arch_info = bfd_lookup_arch (arch, machine);
@@ -155,12 +138,11 @@ gdbarch_register_osabi (enum bfd_architecture arch, unsigned long machine,
/* Registering an OS ABI handler for "unknown" is not allowed. */
if (osabi == GDB_OSABI_UNKNOWN)
{
- internal_error
- (_("gdbarch_register_osabi: An attempt to register a handler for "
- "OS ABI \"%s\" for architecture %s was made. The handler will "
- "not be registered"),
- gdbarch_osabi_name (osabi),
- bfd_printable_arch_mach (arch, machine));
+ internal_error (
+ _ ("gdbarch_register_osabi: An attempt to register a handler for "
+ "OS ABI \"%s\" for architecture %s was made. The handler will "
+ "not be registered"),
+ gdbarch_osabi_name (osabi), bfd_printable_arch_mach (arch, machine));
return;
}
@@ -169,14 +151,12 @@ gdbarch_register_osabi (enum bfd_architecture arch, unsigned long machine,
for (handler_p = &gdb_osabi_handler_list; *handler_p != NULL;
handler_p = &(*handler_p)->next)
{
- if ((*handler_p)->arch_info == arch_info
- && (*handler_p)->osabi == osabi)
+ if ((*handler_p)->arch_info == arch_info && (*handler_p)->osabi == osabi)
{
- internal_error
- (_("gdbarch_register_osabi: A handler for OS ABI \"%s\" "
- "has already been registered for architecture %s"),
- gdbarch_osabi_name (osabi),
- arch_info->printable_name);
+ internal_error (
+ _ ("gdbarch_register_osabi: A handler for OS ABI \"%s\" "
+ "has already been registered for architecture %s"),
+ gdbarch_osabi_name (osabi), arch_info->printable_name);
/* If user wants to continue, override previous definition. */
(*handler_p)->init_osabi = init_osabi;
return;
@@ -191,7 +171,7 @@ gdbarch_register_osabi (enum bfd_architecture arch, unsigned long machine,
/* Add this OS ABI to the list of enum values for "set osabi", if it isn't
already there. */
- for (name_ptr = gdb_osabi_available_names; *name_ptr; name_ptr ++)
+ for (name_ptr = gdb_osabi_available_names; *name_ptr; name_ptr++)
{
if (*name_ptr == gdbarch_osabi_name (osabi))
return;
@@ -199,7 +179,6 @@ gdbarch_register_osabi (enum bfd_architecture arch, unsigned long machine,
*name_ptr++ = gdbarch_osabi_name (osabi);
*name_ptr = NULL;
}
-
/* Sniffer to find the OS ABI for a given file's architecture and flavour.
It is legal to have multiple sniffers for each arch/flavour pair, to
@@ -209,9 +188,9 @@ gdbarch_register_osabi (enum bfd_architecture arch, unsigned long machine,
struct gdb_osabi_sniffer
{
struct gdb_osabi_sniffer *next;
- enum bfd_architecture arch; /* bfd_arch_unknown == wildcard */
+ enum bfd_architecture arch; /* bfd_arch_unknown == wildcard */
enum bfd_flavour flavour;
- enum gdb_osabi (*sniffer)(bfd *);
+ enum gdb_osabi (*sniffer) (bfd *);
};
static struct gdb_osabi_sniffer *gdb_osabi_sniffer_list;
@@ -219,7 +198,7 @@ static struct gdb_osabi_sniffer *gdb_osabi_sniffer_list;
void
gdbarch_register_osabi_sniffer (enum bfd_architecture arch,
enum bfd_flavour flavour,
- enum gdb_osabi (*sniffer_fn)(bfd *))
+ enum gdb_osabi (*sniffer_fn) (bfd *))
{
struct gdb_osabi_sniffer *sniffer;
@@ -231,7 +210,6 @@ gdbarch_register_osabi_sniffer (enum bfd_architecture arch,
sniffer->next = gdb_osabi_sniffer_list;
gdb_osabi_sniffer_list = sniffer;
}
-
enum gdb_osabi
gdbarch_lookup_osabi (bfd *abfd)
@@ -263,12 +241,11 @@ gdbarch_lookup_osabi (bfd *abfd)
osabi = (*sniffer->sniffer) (abfd);
if (osabi < GDB_OSABI_UNKNOWN || osabi >= GDB_OSABI_INVALID)
{
- internal_error
- (_("gdbarch_lookup_osabi: invalid OS ABI (%d) from sniffer "
- "for architecture %s flavour %d"),
- (int) osabi,
- bfd_printable_arch_mach (bfd_get_arch (abfd), 0),
- (int) bfd_get_flavour (abfd));
+ internal_error (
+ _ ("gdbarch_lookup_osabi: invalid OS ABI (%d) from sniffer "
+ "for architecture %s flavour %d"),
+ (int) osabi, bfd_printable_arch_mach (bfd_get_arch (abfd), 0),
+ (int) bfd_get_flavour (abfd));
}
else if (osabi != GDB_OSABI_UNKNOWN)
{
@@ -279,17 +256,18 @@ gdbarch_lookup_osabi (bfd *abfd)
if (match != GDB_OSABI_UNKNOWN)
{
if ((match_specific && sniffer->arch != bfd_arch_unknown)
- || (!match_specific && sniffer->arch == bfd_arch_unknown))
+ || (!match_specific
+ && sniffer->arch == bfd_arch_unknown))
{
- internal_error
- (_("gdbarch_lookup_osabi: multiple %sspecific OS ABI "
- "match for architecture %s flavour %d: first "
- "match \"%s\", second match \"%s\""),
- match_specific ? "" : "non-",
- bfd_printable_arch_mach (bfd_get_arch (abfd), 0),
- (int) bfd_get_flavour (abfd),
- gdbarch_osabi_name (match),
- gdbarch_osabi_name (osabi));
+ internal_error (
+ _ ("gdbarch_lookup_osabi: multiple %sspecific OS ABI "
+ "match for architecture %s flavour %d: first "
+ "match \"%s\", second match \"%s\""),
+ match_specific ? "" : "non-",
+ bfd_printable_arch_mach (bfd_get_arch (abfd), 0),
+ (int) bfd_get_flavour (abfd),
+ gdbarch_osabi_name (match),
+ gdbarch_osabi_name (osabi));
}
else if (sniffer->arch != bfd_arch_unknown)
{
@@ -310,7 +288,6 @@ gdbarch_lookup_osabi (bfd *abfd)
return match;
}
-
/* Return non-zero if architecture A can run code written for
architecture B. */
static int
@@ -399,15 +376,14 @@ gdbarch_init_osabi (struct gdbarch_info info, struct gdbarch *gdbarch)
return;
}
- warning
- ("A handler for the OS ABI \"%s\" is not built into this configuration\n"
- "of GDB. Attempting to continue with the default %s settings.\n",
- gdbarch_osabi_name (info.osabi),
- info.bfd_arch_info->printable_name);
+ warning (
+ "A handler for the OS ABI \"%s\" is not built into this configuration\n"
+ "of GDB. Attempting to continue with the default %s settings.\n",
+ gdbarch_osabi_name (info.osabi), info.bfd_arch_info->printable_name);
}
-
+
/* Limit on the amount of data to be read. */
-#define MAX_NOTESZ 128
+#define MAX_NOTESZ 128
/* Return non-zero if NOTE matches NAME, DESCSZ and TYPE. If
*SECTSIZE is non-zero, then this reads that many bytes from
@@ -510,7 +486,7 @@ generic_elf_osabi_sniff_abi_tag_sections (bfd *abfd, asection *sect,
break;
default:
- warning (_("GNU ABI tag value %u unrecognized."), abi_tag);
+ warning (_ ("GNU ABI tag value %u unrecognized."), abi_tag);
break;
}
return;
@@ -530,7 +506,8 @@ generic_elf_osabi_sniff_abi_tag_sections (bfd *abfd, asection *sect,
/* .note.netbsd.ident notes, used by NetBSD. */
if (strcmp (name, ".note.netbsd.ident") == 0
- && check_note (abfd, sect, note, &sectsize, "NetBSD", 4, NT_NETBSD_IDENT))
+ && check_note (abfd, sect, note, &sectsize, "NetBSD", 4,
+ NT_NETBSD_IDENT))
{
/* There is no need to check the version yet. */
*osabi = GDB_OSABI_NETBSD;
@@ -606,14 +583,15 @@ generic_elf_osabi_sniffer (bfd *abfd)
/* The FreeBSD folks have been naughty; they stored the string
"FreeBSD" in the padding of the e_ident field of the ELF
header to "brand" their ELF binaries in FreeBSD 3.x. */
- if (memcmp (&elf_elfheader (abfd)->e_ident[8],
- "FreeBSD", sizeof ("FreeBSD")) == 0)
+ if (memcmp (&elf_elfheader (abfd)->e_ident[8], "FreeBSD",
+ sizeof ("FreeBSD"))
+ == 0)
osabi = GDB_OSABI_FREEBSD;
}
return osabi;
}
-
+
static void
set_osabi (const char *args, int from_tty, struct cmd_list_element *c)
{
@@ -640,15 +618,15 @@ set_osabi (const char *args, int from_tty, struct cmd_list_element *c)
}
}
if (i == GDB_OSABI_INVALID)
- internal_error (_("Invalid OS ABI \"%s\" passed to command handler."),
+ internal_error (_ ("Invalid OS ABI \"%s\" passed to command handler."),
set_osabi_string);
}
/* NOTE: At some point (true multiple architectures) we'll need to be more
graceful here. */
gdbarch_info info;
- if (! gdbarch_update_p (info))
- internal_error (_("Updating OS ABI failed."));
+ if (!gdbarch_update_p (info))
+ internal_error (_ ("Updating OS ABI failed."));
}
static void
@@ -657,29 +635,29 @@ show_osabi (struct ui_file *file, int from_tty, struct cmd_list_element *c,
{
if (user_osabi_state == osabi_auto)
gdb_printf (file,
- _("The current OS ABI is \"auto\" "
- "(currently \"%s\").\n"),
+ _ ("The current OS ABI is \"auto\" "
+ "(currently \"%s\").\n"),
gdbarch_osabi_name (gdbarch_osabi (get_current_arch ())));
else
- gdb_printf (file, _("The current OS ABI is \"%s\".\n"),
+ gdb_printf (file, _ ("The current OS ABI is \"%s\".\n"),
gdbarch_osabi_name (user_selected_osabi));
if (GDB_OSABI_DEFAULT != GDB_OSABI_UNKNOWN)
- gdb_printf (file, _("The default OS ABI is \"%s\".\n"),
+ gdb_printf (file, _ ("The default OS ABI is \"%s\".\n"),
gdbarch_osabi_name (GDB_OSABI_DEFAULT));
}
void _initialize_gdb_osabi ();
+
void
_initialize_gdb_osabi ()
{
if (strcmp (gdb_osabi_names[GDB_OSABI_INVALID].pretty, "<invalid>") != 0)
- internal_error
- (_("_initialize_gdb_osabi: gdb_osabi_names[] is inconsistent"));
+ internal_error (
+ _ ("_initialize_gdb_osabi: gdb_osabi_names[] is inconsistent"));
/* Register a generic sniffer for ELF flavoured files. */
- gdbarch_register_osabi_sniffer (bfd_arch_unknown,
- bfd_target_elf_flavour,
+ gdbarch_register_osabi_sniffer (bfd_arch_unknown, bfd_target_elf_flavour,
generic_elf_osabi_sniffer);
/* Register the "set osabi" command. */
@@ -687,9 +665,7 @@ _initialize_gdb_osabi ()
set_osabi_string = gdb_osabi_available_names[0];
gdb_assert (strcmp (set_osabi_string, "auto") == 0);
add_setshow_enum_cmd ("osabi", class_support, gdb_osabi_available_names,
- &set_osabi_string,
- _("Set OS ABI of target."),
- _("Show OS ABI of target."),
- NULL, set_osabi, show_osabi,
- &setlist, &showlist);
+ &set_osabi_string, _ ("Set OS ABI of target."),
+ _ ("Show OS ABI of target."), NULL, set_osabi,
+ show_osabi, &setlist, &showlist);
}
diff --git a/gdb/osabi.h b/gdb/osabi.h
index 35f14ec433c..694d30efdfa 100644
--- a/gdb/osabi.h
+++ b/gdb/osabi.h
@@ -23,7 +23,7 @@
table in osabi.c. */
enum gdb_osabi
{
- GDB_OSABI_UNKNOWN = 0, /* keep this zero */
+ GDB_OSABI_UNKNOWN = 0, /* keep this zero */
GDB_OSABI_NONE,
GDB_OSABI_SVR4,
@@ -47,7 +47,7 @@ enum gdb_osabi
GDB_OSABI_SDE,
GDB_OSABI_PIKEOS,
- GDB_OSABI_INVALID /* keep this last */
+ GDB_OSABI_INVALID /* keep this last */
};
/* Register an OS ABI sniffer. Each arch/flavour may have more than
@@ -55,17 +55,15 @@ enum gdb_osabi
another. The first sniffer to return something other than
GDB_OSABI_UNKNOWN wins, so a sniffer should be careful to claim a file
only if it knows for sure what it is. */
-void gdbarch_register_osabi_sniffer (enum bfd_architecture,
- enum bfd_flavour,
- enum gdb_osabi (*)(bfd *));
+void gdbarch_register_osabi_sniffer (enum bfd_architecture, enum bfd_flavour,
+ enum gdb_osabi (*) (bfd *));
/* Register a handler for an OS ABI variant for a given architecture
and machine type. There should be only one handler for a given OS
ABI for each architecture and machine type combination. */
void gdbarch_register_osabi (enum bfd_architecture, unsigned long,
enum gdb_osabi,
- void (*)(struct gdbarch_info,
- struct gdbarch *));
+ void (*) (struct gdbarch_info, struct gdbarch *));
/* Lookup the OS ABI corresponding to the specified BFD. */
enum gdb_osabi gdbarch_lookup_osabi (bfd *);
diff --git a/gdb/osdata.c b/gdb/osdata.c
index 21b8eb01f6b..be7a15845b8 100644
--- a/gdb/osdata.c
+++ b/gdb/osdata.c
@@ -34,8 +34,8 @@ osdata_parse (const char *xml)
if (!have_warned)
{
have_warned = 1;
- warning (_("Can not parse XML OS data; XML support was disabled "
- "at compile time"));
+ warning (_ ("Can not parse XML OS data; XML support was disabled "
+ "at compile time"));
}
return NULL;
@@ -54,14 +54,13 @@ struct osdata_parsing_data
static void
osdata_start_osdata (struct gdb_xml_parser *parser,
- const struct gdb_xml_element *element,
- void *user_data,
- std::vector<gdb_xml_value> &attributes)
+ const struct gdb_xml_element *element, void *user_data,
+ std::vector<gdb_xml_value> &attributes)
{
struct osdata_parsing_data *data = (struct osdata_parsing_data *) user_data;
if (data->osdata != NULL)
- gdb_xml_error (parser, _("Seen more than on osdata element"));
+ gdb_xml_error (parser, _ ("Seen more than on osdata element"));
char *type = (char *) xml_find_attribute (attributes, "type")->value.get ();
data->osdata.reset (new struct osdata (std::string (type)));
@@ -71,9 +70,8 @@ osdata_start_osdata (struct gdb_xml_parser *parser,
static void
osdata_start_item (struct gdb_xml_parser *parser,
- const struct gdb_xml_element *element,
- void *user_data,
- std::vector<gdb_xml_value> &attributes)
+ const struct gdb_xml_element *element, void *user_data,
+ std::vector<gdb_xml_value> &attributes)
{
struct osdata_parsing_data *data = (struct osdata_parsing_data *) user_data;
data->osdata->items.emplace_back ();
@@ -83,9 +81,8 @@ osdata_start_item (struct gdb_xml_parser *parser,
static void
osdata_start_column (struct gdb_xml_parser *parser,
- const struct gdb_xml_element *element,
- void *user_data,
- std::vector<gdb_xml_value> &attributes)
+ const struct gdb_xml_element *element, void *user_data,
+ std::vector<gdb_xml_value> &attributes)
{
struct osdata_parsing_data *data = (struct osdata_parsing_data *) user_data;
const char *name
@@ -98,8 +95,8 @@ osdata_start_column (struct gdb_xml_parser *parser,
static void
osdata_end_column (struct gdb_xml_parser *parser,
- const struct gdb_xml_element *element,
- void *user_data, const char *body_text)
+ const struct gdb_xml_element *element, void *user_data,
+ const char *body_text)
{
osdata_parsing_data *data = (struct osdata_parsing_data *) user_data;
struct osdata *osdata = data->osdata.get ();
@@ -112,43 +109,38 @@ osdata_end_column (struct gdb_xml_parser *parser,
/* The allowed elements and attributes for OS data object.
The root element is a <osdata>. */
-const struct gdb_xml_attribute column_attributes[] = {
- { "name", GDB_XML_AF_NONE, NULL, NULL },
- { NULL, GDB_XML_AF_NONE, NULL, NULL }
-};
+const struct gdb_xml_attribute column_attributes[]
+ = { { "name", GDB_XML_AF_NONE, NULL, NULL },
+ { NULL, GDB_XML_AF_NONE, NULL, NULL } };
-const struct gdb_xml_element item_children[] = {
- { "column", column_attributes, NULL,
- GDB_XML_EF_REPEATABLE | GDB_XML_EF_OPTIONAL,
- osdata_start_column, osdata_end_column },
- { NULL, NULL, NULL, GDB_XML_EF_NONE, NULL, NULL }
-};
+const struct gdb_xml_element item_children[]
+ = { { "column", column_attributes, NULL,
+ GDB_XML_EF_REPEATABLE | GDB_XML_EF_OPTIONAL, osdata_start_column,
+ osdata_end_column },
+ { NULL, NULL, NULL, GDB_XML_EF_NONE, NULL, NULL } };
-const struct gdb_xml_attribute osdata_attributes[] = {
- { "type", GDB_XML_AF_NONE, NULL, NULL },
- { NULL, GDB_XML_AF_NONE, NULL, NULL }
-};
+const struct gdb_xml_attribute osdata_attributes[]
+ = { { "type", GDB_XML_AF_NONE, NULL, NULL },
+ { NULL, GDB_XML_AF_NONE, NULL, NULL } };
-const struct gdb_xml_element osdata_children[] = {
- { "item", NULL, item_children,
- GDB_XML_EF_REPEATABLE | GDB_XML_EF_OPTIONAL,
- osdata_start_item, NULL },
- { NULL, NULL, NULL, GDB_XML_EF_NONE, NULL, NULL }
-};
+const struct gdb_xml_element osdata_children[]
+ = { { "item", NULL, item_children,
+ GDB_XML_EF_REPEATABLE | GDB_XML_EF_OPTIONAL, osdata_start_item, NULL },
+ { NULL, NULL, NULL, GDB_XML_EF_NONE, NULL, NULL } };
-const struct gdb_xml_element osdata_elements[] = {
- { "osdata", osdata_attributes, osdata_children,
- GDB_XML_EF_NONE, osdata_start_osdata, NULL },
- { NULL, NULL, NULL, GDB_XML_EF_NONE, NULL, NULL }
-};
+const struct gdb_xml_element osdata_elements[]
+ = { { "osdata", osdata_attributes, osdata_children, GDB_XML_EF_NONE,
+ osdata_start_osdata, NULL },
+ { NULL, NULL, NULL, GDB_XML_EF_NONE, NULL, NULL } };
std::unique_ptr<osdata>
osdata_parse (const char *xml)
{
osdata_parsing_data data;
- if (gdb_xml_parse_quick (_("osdata"), "osdata.dtd",
- osdata_elements, xml, &data) == 0)
+ if (gdb_xml_parse_quick (_ ("osdata"), "osdata.dtd", osdata_elements, xml,
+ &data)
+ == 0)
{
/* Parsed successfully, don't need to delete the result. */
return std::move (data.osdata);
@@ -169,16 +161,16 @@ get_osdata (const char *type)
if ((*xml)[0] == '\0')
{
if (type)
- warning (_("Empty data returned by target. Wrong osdata type?"));
+ warning (_ ("Empty data returned by target. Wrong osdata type?"));
else
- warning (_("Empty type list returned by target. No type data?"));
+ warning (_ ("Empty type list returned by target. No type data?"));
}
else
osdata = osdata_parse (xml->data ());
}
if (osdata == NULL)
- error (_("Can not fetch data now."));
+ error (_ ("Can not fetch data now."));
return osdata;
}
@@ -209,8 +201,8 @@ info_osdata (const char *type)
int nrows = osdata->items.size ();
if (*type == '\0' && nrows == 0)
- error (_("Available types of OS data not reported."));
-
+ error (_ ("Available types of OS data not reported."));
+
if (!osdata->items.empty ())
{
last = &osdata->items.back ();
@@ -251,8 +243,8 @@ info_osdata (const char *type)
continue;
snprintf (col_name, 32, "col%d", ix);
- uiout->table_header (10, ui_left,
- col_name, last->columns[ix].name.c_str ());
+ uiout->table_header (10, ui_left, col_name,
+ last->columns[ix].name.c_str ());
}
}
@@ -261,24 +253,24 @@ info_osdata (const char *type)
if (nrows != 0)
{
for (const osdata_item &item : osdata->items)
- {
- {
- ui_out_emit_tuple tuple_emitter (uiout, "item");
+ {
+ {
+ ui_out_emit_tuple tuple_emitter (uiout, "item");
- for (int ix_cols = 0; ix_cols < item.columns.size (); ix_cols++)
- {
- char col_name[32];
+ for (int ix_cols = 0; ix_cols < item.columns.size (); ix_cols++)
+ {
+ char col_name[32];
- if (ix_cols == col_to_skip)
- continue;
+ if (ix_cols == col_to_skip)
+ continue;
- snprintf (col_name, 32, "col%d", ix_cols);
- uiout->field_string (col_name, item.columns[ix_cols].value);
- }
- }
+ snprintf (col_name, 32, "col%d", ix_cols);
+ uiout->field_string (col_name, item.columns[ix_cols].value);
+ }
+ }
- uiout->text ("\n");
- }
+ uiout->text ("\n");
+ }
}
}
@@ -289,9 +281,9 @@ info_osdata_command (const char *arg, int from_tty)
}
void _initialize_osdata ();
+
void
_initialize_osdata ()
{
- add_info ("os", info_osdata_command,
- _("Show OS data ARG."));
+ add_info ("os", info_osdata_command, _ ("Show OS data ARG."));
}
diff --git a/gdb/osdata.h b/gdb/osdata.h
index bb3c004c6c6..84034e3a978 100644
--- a/gdb/osdata.h
+++ b/gdb/osdata.h
@@ -25,8 +25,10 @@
struct osdata_column
{
osdata_column (std::string &&name_, std::string &&value_)
- : name (std::move (name_)), value (std::move (value_))
- {}
+ : name (std::move (name_)),
+ value (std::move (value_))
+ {
+ }
std::string name;
std::string value;
@@ -40,8 +42,9 @@ struct osdata_item
struct osdata
{
osdata (std::string &&type_)
- : type (std::move (type_))
- {}
+ : type (std::move (type_))
+ {
+ }
std::string type;
std::vector<osdata_item> items;
diff --git a/gdb/p-lang.c b/gdb/p-lang.c
index 2b4720df4ef..4003dd0c28c 100644
--- a/gdb/p-lang.c
+++ b/gdb/p-lang.c
@@ -87,7 +87,7 @@ pascal_main_name (void)
/* See p-lang.h. */
int
-pascal_is_string_type (struct type *type,int *length_pos, int *length_size,
+pascal_is_string_type (struct type *type, int *length_pos, int *length_size,
int *string_pos, struct type **char_type,
const char **arrayname)
{
@@ -95,8 +95,7 @@ pascal_is_string_type (struct type *type,int *length_pos, int *length_size,
{
/* Old Borland type pascal strings from Free Pascal Compiler. */
/* Two fields: length and st. */
- if (type->num_fields () == 2
- && type->field (0).name ()
+ if (type->num_fields () == 2 && type->field (0).name ()
&& strcmp (type->field (0).name (), "length") == 0
&& type->field (1).name ()
&& strcmp (type->field (1).name (), "st") == 0)
@@ -111,12 +110,11 @@ pascal_is_string_type (struct type *type,int *length_pos, int *length_size,
*char_type = type->field (1).type ()->target_type ();
if (arrayname)
*arrayname = type->field (1).name ();
- return 2;
+ return 2;
};
/* GNU pascal strings. */
/* Three fields: Capacity, length and schema$ or _p_schema. */
- if (type->num_fields () == 3
- && type->field (0).name ()
+ if (type->num_fields () == 3 && type->field (0).name ()
&& strcmp (type->field (0).name (), "Capacity") == 0
&& type->field (1).name ()
&& strcmp (type->field (1).name (), "length") == 0)
@@ -137,7 +135,7 @@ pascal_is_string_type (struct type *type,int *length_pos, int *length_size,
}
if (arrayname)
*arrayname = type->field (2).name ();
- return 3;
+ return 3;
};
}
return 0;
@@ -183,20 +181,16 @@ pascal_language::printchar (int c, struct type *type,
gdb_puts ("'", stream);
}
-
-
/* See language.h. */
-void pascal_language::language_arch_info
- (struct gdbarch *gdbarch, struct language_arch_info *lai) const
+void
+pascal_language::language_arch_info (struct gdbarch *gdbarch,
+ struct language_arch_info *lai) const
{
const struct builtin_type *builtin = builtin_type (gdbarch);
/* Helper function to allow shorter lines below. */
- auto add = [&] (struct type * t)
- {
- lai->add_primitive_type (t);
- };
+ auto add = [&] (struct type *t) { lai->add_primitive_type (t); };
add (builtin->builtin_int);
add (builtin->builtin_long);
@@ -244,7 +238,8 @@ pascal_language::printstr (struct ui_file *stream, struct type *elttype,
style. */
if ((!force_ellipses) && length > 0
&& extract_unsigned_integer (string + (length - 1) * width, width,
- byte_order) == 0)
+ byte_order)
+ == 0)
length--;
if (length == 0)
@@ -271,14 +266,15 @@ pascal_language::printstr (struct ui_file *stream, struct type *elttype,
need_comma = 0;
}
- current_char = extract_unsigned_integer (string + i * width, width,
- byte_order);
+ current_char
+ = extract_unsigned_integer (string + i * width, width, byte_order);
rep1 = i + 1;
reps = 1;
while (rep1 < length
&& extract_unsigned_integer (string + rep1 * width, width,
- byte_order) == current_char)
+ byte_order)
+ == current_char)
{
++rep1;
++reps;
@@ -293,8 +289,7 @@ pascal_language::printstr (struct ui_file *stream, struct type *elttype,
}
printchar (current_char, elttype, stream);
gdb_printf (stream, " %p[<repeats %u times>%p]",
- metadata_style.style ().ptr (),
- reps, nullptr);
+ metadata_style.style ().ptr (), reps, nullptr);
i = rep1 - 1;
things_printed += options->repeat_count_threshold;
need_comma = 1;
diff --git a/gdb/p-lang.h b/gdb/p-lang.h
index 662079114ed..d430fe5b5e8 100644
--- a/gdb/p-lang.h
+++ b/gdb/p-lang.h
@@ -35,7 +35,7 @@ struct parser_state;
then the results are wrong but this does not happen for Free Pascal nor
for GPC. */
-extern int pascal_is_string_type (struct type *type,int *length_pos,
+extern int pascal_is_string_type (struct type *type, int *length_pos,
int *length_size, int *string_pos,
struct type **char_type,
const char **arrayname);
@@ -58,19 +58,19 @@ extern int pascal_object_is_vtbl_member (struct type *);
class pascal_language : public language_defn
{
public:
+
pascal_language ()
: language_defn (language_pascal)
- { /* Nothing. */ }
+ { /* Nothing. */
+ }
/* See language.h. */
- const char *name () const override
- { return "pascal"; }
+ const char *name () const override { return "pascal"; }
/* See language.h. */
- const char *natural_name () const override
- { return "Pascal"; }
+ const char *natural_name () const override { return "Pascal"; }
/* See language.h. */
@@ -99,9 +99,9 @@ public:
/* See language.h. */
- void value_print_inner
- (struct value *val, struct ui_file *stream, int recurse,
- const struct value_print_options *options) const override;
+ void
+ value_print_inner (struct value *val, struct ui_file *stream, int recurse,
+ const struct value_print_options *options) const override;
/* See language.h. */
@@ -109,8 +109,8 @@ public:
/* See language.h. */
- void emitchar (int ch, struct type *chtype,
- struct ui_file *stream, int quoter) const override
+ void emitchar (int ch, struct type *chtype, struct ui_file *stream,
+ int quoter) const override
{
int in_quotes = 0;
@@ -140,19 +140,18 @@ public:
bool is_string_type_p (struct type *type) const override
{
- return pascal_is_string_type(type, nullptr, nullptr, nullptr,
- nullptr, nullptr) > 0;
+ return pascal_is_string_type (type, nullptr, nullptr, nullptr, nullptr,
+ nullptr)
+ > 0;
}
/* See language.h. */
- const char *name_of_this () const override
- { return "this"; }
+ const char *name_of_this () const override { return "this"; }
/* See language.h. */
- bool range_checking_on_by_default () const override
- { return true; }
+ bool range_checking_on_by_default () const override { return true; }
private:
@@ -181,23 +180,21 @@ private:
int level,
const struct type_print_options *flags) const;
-
/* Print any array sizes, function arguments or close parentheses
needed after the variable name (to describe its type).
Args work like pascal_type_print_varspec_prefix. */
- void type_print_varspec_suffix (struct type *type, struct ui_file *stream,
- int show, int passed_a_ptr,
- int demangled_args,
- const struct type_print_options *flags) const;
+ void
+ type_print_varspec_suffix (struct type *type, struct ui_file *stream,
+ int show, int passed_a_ptr, int demangled_args,
+ const struct type_print_options *flags) const;
/* Helper for pascal_language::type_print_varspec_suffix to print the
suffix of a function or method. */
- void type_print_func_varspec_suffix
- (struct type *type, struct ui_file *stream, int show,
- int passed_a_ptr, int demangled_args,
- const struct type_print_options *flags) const;
+ void type_print_func_varspec_suffix (
+ struct type *type, struct ui_file *stream, int show, int passed_a_ptr,
+ int demangled_args, const struct type_print_options *flags) const;
/* Print any asterisks or open-parentheses needed before the
variable name (to describe its type).
@@ -207,15 +204,16 @@ private:
any typename for TYPE and show its details.
SHOW is always zero on recursive calls. */
- void type_print_varspec_prefix
- (struct type *type, struct ui_file *stream, int show,
- int passed_a_ptr, const struct type_print_options *flags) const;
+ void
+ type_print_varspec_prefix (struct type *type, struct ui_file *stream,
+ int show, int passed_a_ptr,
+ const struct type_print_options *flags) const;
/* Print the function args from TYPE (a TYPE_CODE_FUNC) to STREAM taking
FLAGS into account where appropriate. */
- void print_func_args (struct type *type, struct ui_file *stream,
- const struct type_print_options *flags) const;
+ void print_func_args (struct type *type, struct ui_file *stream,
+ const struct type_print_options *flags) const;
/* Print the Pascal method arguments for PHYSNAME and METHODNAME to the
file STREAM. */
diff --git a/gdb/p-typeprint.c b/gdb/p-typeprint.c
index e8542d6845a..48329f9d3a7 100644
--- a/gdb/p-typeprint.c
+++ b/gdb/p-typeprint.c
@@ -20,7 +20,7 @@
#include "defs.h"
#include "gdbsupport/gdb_obstack.h"
-#include "bfd.h" /* Binary File Description */
+#include "bfd.h" /* Binary File Description */
#include "symtab.h"
#include "gdbtypes.h"
#include "expression.h"
@@ -49,8 +49,7 @@ pascal_language::print_type (struct type *type, const char *varstring,
if (show > 0)
type = check_typedef (type);
- if ((code == TYPE_CODE_FUNC
- || code == TYPE_CODE_METHOD))
+ if ((code == TYPE_CODE_FUNC || code == TYPE_CODE_METHOD))
{
type_print_varspec_prefix (type, stream, show, 0, flags);
}
@@ -58,14 +57,12 @@ pascal_language::print_type (struct type *type, const char *varstring,
gdb_puts (varstring, stream);
if ((varstring != NULL && *varstring != '\0')
- && !(code == TYPE_CODE_FUNC
- || code == TYPE_CODE_METHOD))
+ && !(code == TYPE_CODE_FUNC || code == TYPE_CODE_METHOD))
{
gdb_puts (" : ", stream);
}
- if (!(code == TYPE_CODE_FUNC
- || code == TYPE_CODE_METHOD))
+ if (!(code == TYPE_CODE_FUNC || code == TYPE_CODE_METHOD))
{
type_print_varspec_prefix (type, stream, show, 0, flags);
}
@@ -75,9 +72,7 @@ pascal_language::print_type (struct type *type, const char *varstring,
so don't print an additional pair of ()'s. */
demangled_args = varstring ? strchr (varstring, '(') != NULL : 0;
- type_print_varspec_suffix (type, stream, show, 0, demangled_args,
- flags);
-
+ type_print_varspec_suffix (type, stream, show, 0, demangled_args, flags);
}
/* See language.h. */
@@ -167,10 +162,9 @@ pascal_language::type_print_method_args (const char *physname,
/* See p-lang.h. */
void
-pascal_language::type_print_varspec_prefix (struct type *type,
- struct ui_file *stream,
- int show, int passed_a_ptr,
- const struct type_print_options *flags) const
+pascal_language::type_print_varspec_prefix (
+ struct type *type, struct ui_file *stream, int show, int passed_a_ptr,
+ const struct type_print_options *flags) const
{
if (type == 0)
return;
@@ -184,9 +178,8 @@ pascal_language::type_print_varspec_prefix (struct type *type,
{
case TYPE_CODE_PTR:
gdb_printf (stream, "^");
- type_print_varspec_prefix (type->target_type (), stream, 0, 1,
- flags);
- break; /* Pointer should be handled normally
+ type_print_varspec_prefix (type->target_type (), stream, 0, 1, flags);
+ break; /* Pointer should be handled normally
in pascal. */
case TYPE_CODE_METHOD:
@@ -205,15 +198,14 @@ pascal_language::type_print_varspec_prefix (struct type *type,
if (passed_a_ptr)
{
gdb_printf (stream, " ");
- type_print_base (TYPE_SELF_TYPE (type),
- stream, 0, passed_a_ptr, flags);
+ type_print_base (TYPE_SELF_TYPE (type), stream, 0, passed_a_ptr,
+ flags);
gdb_printf (stream, "::");
}
break;
case TYPE_CODE_REF:
- type_print_varspec_prefix (type->target_type (), stream, 0, 1,
- flags);
+ type_print_varspec_prefix (type->target_type (), stream, 0, 1, flags);
gdb_printf (stream, "&");
break;
@@ -294,9 +286,10 @@ pascal_language::print_func_args (struct type *type, struct ui_file *stream,
{
gdb_printf (stream, "var ");
} */
- print_type (type->field (i).type (), "" /* TYPE_FIELD_NAME
+ print_type (type->field (i).type (), "" /* TYPE_FIELD_NAME
seems invalid! */
- ,stream, -1, 0, flags);
+ ,
+ stream, -1, 0, flags);
}
if (len)
{
@@ -307,38 +300,32 @@ pascal_language::print_func_args (struct type *type, struct ui_file *stream,
/* See p-lang.h. */
void
-pascal_language::type_print_func_varspec_suffix (struct type *type,
- struct ui_file *stream,
- int show, int passed_a_ptr,
- int demangled_args,
- const struct type_print_options *flags) const
+pascal_language::type_print_func_varspec_suffix (
+ struct type *type, struct ui_file *stream, int show, int passed_a_ptr,
+ int demangled_args, const struct type_print_options *flags) const
{
if (type->target_type () == NULL
|| type->target_type ()->code () != TYPE_CODE_VOID)
{
gdb_printf (stream, " : ");
- type_print_varspec_prefix (type->target_type (),
- stream, 0, 0, flags);
+ type_print_varspec_prefix (type->target_type (), stream, 0, 0, flags);
if (type->target_type () == NULL)
type_print_unknown_return_type (stream);
else
- type_print_base (type->target_type (), stream, show, 0,
- flags);
+ type_print_base (type->target_type (), stream, show, 0, flags);
- type_print_varspec_suffix (type->target_type (), stream, 0,
- passed_a_ptr, 0, flags);
+ type_print_varspec_suffix (type->target_type (), stream, 0, passed_a_ptr,
+ 0, flags);
}
}
/* See p-lang.h. */
void
-pascal_language::type_print_varspec_suffix (struct type *type,
- struct ui_file *stream,
- int show, int passed_a_ptr,
- int demangled_args,
- const struct type_print_options *flags) const
+pascal_language::type_print_varspec_suffix (
+ struct type *type, struct ui_file *stream, int show, int passed_a_ptr,
+ int demangled_args, const struct type_print_options *flags) const
{
if (type == 0)
return;
@@ -359,14 +346,13 @@ pascal_language::type_print_varspec_suffix (struct type *type,
if (passed_a_ptr)
gdb_printf (stream, ")");
type_print_method_args ("", "", stream);
- type_print_func_varspec_suffix (type, stream, show,
- passed_a_ptr, 0, flags);
+ type_print_func_varspec_suffix (type, stream, show, passed_a_ptr, 0,
+ flags);
break;
case TYPE_CODE_PTR:
case TYPE_CODE_REF:
- type_print_varspec_suffix (type->target_type (),
- stream, 0, 1, 0, flags);
+ type_print_varspec_suffix (type->target_type (), stream, 0, 1, 0, flags);
break;
case TYPE_CODE_FUNC:
@@ -374,8 +360,8 @@ pascal_language::type_print_varspec_suffix (struct type *type,
gdb_printf (stream, ")");
if (!demangled_args)
print_func_args (type, stream, flags);
- type_print_func_varspec_suffix (type, stream, show,
- passed_a_ptr, 0, flags);
+ type_print_func_varspec_suffix (type, stream, show, passed_a_ptr, 0,
+ flags);
break;
case TYPE_CODE_UNDEF:
@@ -406,17 +392,21 @@ pascal_language::type_print_varspec_suffix (struct type *type,
/* See p-lang.h. */
void
-pascal_language::type_print_base (struct type *type, struct ui_file *stream, int show,
- int level, const struct type_print_options *flags) const
+pascal_language::type_print_base (struct type *type, struct ui_file *stream,
+ int show, int level,
+ const struct type_print_options *flags) const
{
int i;
int len;
LONGEST lastval;
+
enum
- {
- s_none, s_public, s_private, s_protected
- }
- section_type;
+ {
+ s_none,
+ s_public,
+ s_private,
+ s_protected
+ } section_type;
QUIT;
stream->wrap_here (4);
@@ -430,15 +420,13 @@ pascal_language::type_print_base (struct type *type, struct ui_file *stream, int
if ((type->code () == TYPE_CODE_PTR)
&& (type->target_type ()->code () == TYPE_CODE_VOID))
{
- gdb_puts (type->name () ? type->name () : "pointer",
- stream);
+ gdb_puts (type->name () ? type->name () : "pointer", stream);
return;
}
/* When SHOW is zero or less, and there is a valid type name, then always
just print the type name directly from the type. */
- if (show <= 0
- && type->name () != NULL)
+ if (show <= 0 && type->name () != NULL)
{
gdb_puts (type->name (), stream);
return;
@@ -451,8 +439,7 @@ pascal_language::type_print_base (struct type *type, struct ui_file *stream, int
case TYPE_CODE_TYPEDEF:
case TYPE_CODE_PTR:
case TYPE_CODE_REF:
- type_print_base (type->target_type (), stream, show, level,
- flags);
+ type_print_base (type->target_type (), stream, show, level, flags);
break;
case TYPE_CODE_ARRAY:
@@ -502,11 +489,9 @@ pascal_language::type_print_base (struct type *type, struct ui_file *stream, int
if ((type->num_fields () == 0) && (TYPE_NFN_FIELDS (type) == 0))
{
if (type->is_stub ())
- gdb_printf (stream, "%*s<incomplete type>\n",
- level + 4, "");
+ gdb_printf (stream, "%*s<incomplete type>\n", level + 4, "");
else
- gdb_printf (stream, "%*s<no data fields>\n",
- level + 4, "");
+ gdb_printf (stream, "%*s<no data fields>\n", level + 4, "");
}
/* Start off with no specific section type, so we can print
@@ -537,8 +522,7 @@ pascal_language::type_print_base (struct type *type, struct ui_file *stream, int
if (section_type != s_protected)
{
section_type = s_protected;
- gdb_printf (stream, "%*sprotected\n",
- level + 2, "");
+ gdb_printf (stream, "%*sprotected\n", level + 2, "");
}
}
else if (TYPE_FIELD_PRIVATE (type, i))
@@ -546,8 +530,7 @@ pascal_language::type_print_base (struct type *type, struct ui_file *stream, int
if (section_type != s_private)
{
section_type = s_private;
- gdb_printf (stream, "%*sprivate\n",
- level + 2, "");
+ gdb_printf (stream, "%*sprivate\n", level + 2, "");
}
}
else
@@ -555,8 +538,7 @@ pascal_language::type_print_base (struct type *type, struct ui_file *stream, int
if (section_type != s_public)
{
section_type = s_public;
- gdb_printf (stream, "%*spublic\n",
- level + 2, "");
+ gdb_printf (stream, "%*spublic\n", level + 2, "");
}
}
}
@@ -564,9 +546,8 @@ pascal_language::type_print_base (struct type *type, struct ui_file *stream, int
print_spaces (level + 4, stream);
if (field_is_static (&type->field (i)))
gdb_printf (stream, "static ");
- print_type (type->field (i).type (),
- type->field (i).name (),
- stream, show - 1, level + 4, flags);
+ print_type (type->field (i).type (), type->field (i).name (),
+ stream, show - 1, level + 4, flags);
if (!field_is_static (&type->field (i))
&& TYPE_FIELD_PACKED (type, i))
{
@@ -575,8 +556,7 @@ pascal_language::type_print_base (struct type *type, struct ui_file *stream, int
unnamed fields. This would lead to misleading
results if the compiler does not put out fields
for such things (I don't know what it does). */
- gdb_printf (stream, " : %d",
- TYPE_FIELD_BITSIZE (type, i));
+ gdb_printf (stream, " : %d", TYPE_FIELD_BITSIZE (type, i));
}
gdb_printf (stream, ";\n");
}
@@ -610,8 +590,7 @@ pascal_language::type_print_base (struct type *type, struct ui_file *stream, int
if (section_type != s_protected)
{
section_type = s_protected;
- gdb_printf (stream, "%*sprotected\n",
- level + 2, "");
+ gdb_printf (stream, "%*sprotected\n", level + 2, "");
}
}
else if (TYPE_FN_FIELD_PRIVATE (f, j))
@@ -619,8 +598,7 @@ pascal_language::type_print_base (struct type *type, struct ui_file *stream, int
if (section_type != s_private)
{
section_type = s_private;
- gdb_printf (stream, "%*sprivate\n",
- level + 2, "");
+ gdb_printf (stream, "%*sprivate\n", level + 2, "");
}
}
else
@@ -628,8 +606,7 @@ pascal_language::type_print_base (struct type *type, struct ui_file *stream, int
if (section_type != s_public)
{
section_type = s_public;
- gdb_printf (stream, "%*spublic\n",
- level + 2, "");
+ gdb_printf (stream, "%*spublic\n", level + 2, "");
}
}
@@ -652,9 +629,10 @@ pascal_language::type_print_base (struct type *type, struct ui_file *stream, int
{
gdb_printf (stream, "destructor ");
}
- else if (TYPE_FN_FIELD_TYPE (f, j)->target_type () != 0
- && (TYPE_FN_FIELD_TYPE(f, j)->target_type ()->code ()
- != TYPE_CODE_VOID))
+ else if (
+ TYPE_FN_FIELD_TYPE (f, j)->target_type () != 0
+ && (TYPE_FN_FIELD_TYPE (f, j)->target_type ()->code ()
+ != TYPE_CODE_VOID))
{
gdb_printf (stream, "function ");
}
@@ -667,7 +645,7 @@ pascal_language::type_print_base (struct type *type, struct ui_file *stream, int
type_print_method_args (physname, method_name, stream);
if (TYPE_FN_FIELD_TYPE (f, j)->target_type () != 0
- && (TYPE_FN_FIELD_TYPE(f, j)->target_type ()->code ()
+ && (TYPE_FN_FIELD_TYPE (f, j)->target_type ()->code ()
!= TYPE_CODE_VOID))
{
gdb_puts (" : ", stream);
@@ -715,8 +693,7 @@ pascal_language::type_print_base (struct type *type, struct ui_file *stream, int
gdb_puts (type->field (i).name (), stream);
if (lastval != type->field (i).loc_enumval ())
{
- gdb_printf (stream,
- " := %s",
+ gdb_printf (stream, " := %s",
plongest (type->field (i).loc_enumval ()));
lastval = type->field (i).loc_enumval ();
}
@@ -751,8 +728,7 @@ pascal_language::type_print_base (struct type *type, struct ui_file *stream, int
case TYPE_CODE_SET:
gdb_puts ("set of ", stream);
- print_type (type->index_type (), "", stream,
- show - 1, level, flags);
+ print_type (type->index_type (), "", stream, show - 1, level, flags);
break;
case TYPE_CODE_STRING:
diff --git a/gdb/p-valprint.c b/gdb/p-valprint.c
index 69bfeba1477..e73c7f5c684 100644
--- a/gdb/p-valprint.c
+++ b/gdb/p-valprint.c
@@ -40,39 +40,29 @@
#include "objfiles.h"
#include "gdbsupport/byte-vector.h"
#include "cli/cli-style.h"
-
-static void pascal_object_print_value_fields (struct value *, struct ui_file *,
- int,
- const struct value_print_options *,
- struct type **, int);
+static void
+pascal_object_print_value_fields (struct value *, struct ui_file *, int,
+ const struct value_print_options *,
+ struct type **, int);
/* Decorations for Pascal. */
-static const struct generic_val_print_decorations p_decorations =
-{
- "",
- " + ",
- " * I",
- "true",
- "false",
- "void",
- "{",
- "}"
-};
+static const struct generic_val_print_decorations p_decorations
+ = { "", " + ", " * I", "true", "false", "void", "{", "}" };
/* See p-lang.h. */
void
-pascal_language::value_print_inner (struct value *val,
- struct ui_file *stream, int recurse,
- const struct value_print_options *options) const
+pascal_language::value_print_inner (
+ struct value *val, struct ui_file *stream, int recurse,
+ const struct value_print_options *options) const
{
struct type *type = check_typedef (value_type (val));
struct gdbarch *gdbarch = type->arch ();
enum bfd_endian byte_order = type_byte_order (type);
- unsigned int i = 0; /* Number of characters printed */
+ unsigned int i = 0; /* Number of characters printed */
unsigned len;
struct type *elttype;
unsigned eltlen;
@@ -111,16 +101,16 @@ pascal_language::value_print_inner (struct value *val,
/* Look for a NULL char. */
for (temp_len = 0;
- (extract_unsigned_integer
- (valaddr + temp_len * eltlen, eltlen, byte_order)
- && temp_len < len
- && temp_len < print_max_chars);
- temp_len++);
+ (extract_unsigned_integer (
+ valaddr + temp_len * eltlen, eltlen, byte_order)
+ && temp_len < len && temp_len < print_max_chars);
+ temp_len++)
+ ;
len = temp_len;
}
- printstr (stream, type->target_type (), valaddr, len,
- NULL, 0, options);
+ printstr (stream, type->target_type (), valaddr, len, NULL, 0,
+ options);
i = len;
}
else
@@ -159,8 +149,8 @@ pascal_language::value_print_inner (struct value *val,
/* Print vtable entry - we only get here if we ARE using
-fvtable_thunks. (Otherwise, look under TYPE_CODE_STRUCT.) */
/* Extract the address, assume that it is unsigned. */
- addr = extract_unsigned_integer (valaddr,
- type->length (), byte_order);
+ addr
+ = extract_unsigned_integer (valaddr, type->length (), byte_order);
print_address_demangle (options, gdbarch, addr, stream, demangle);
break;
}
@@ -186,12 +176,11 @@ pascal_language::value_print_inner (struct value *val,
/* For a pointer to char or unsigned char, also print the string
pointed to, unless pointer is null. */
if (((elttype->length () == 1
- && (elttype->code () == TYPE_CODE_INT
- || elttype->code () == TYPE_CODE_CHAR))
+ && (elttype->code () == TYPE_CODE_INT
+ || elttype->code () == TYPE_CODE_CHAR))
|| ((elttype->length () == 2 || elttype->length () == 4)
&& elttype->code () == TYPE_CODE_CHAR))
- && (options->format == 0 || options->format == 's')
- && addr != 0)
+ && (options->format == 0 || options->format == 's') && addr != 0)
{
if (want_space)
gdb_puts (" ", stream);
@@ -204,7 +193,8 @@ pascal_language::value_print_inner (struct value *val,
Pascal strings are mapped to records
with lowercase names PM. */
if (pascal_is_string_type (elttype, &length_pos, &length_size,
- &string_pos, &char_type, NULL) > 0
+ &string_pos, &char_type, NULL)
+ > 0
&& addr != 0)
{
ULONGEST string_length;
@@ -214,23 +204,21 @@ pascal_language::value_print_inner (struct value *val,
gdb_puts (" ", stream);
buffer = (gdb_byte *) xmalloc (length_size);
read_memory (addr + length_pos, buffer, length_size);
- string_length = extract_unsigned_integer (buffer, length_size,
- byte_order);
+ string_length
+ = extract_unsigned_integer (buffer, length_size, byte_order);
xfree (buffer);
- i = val_print_string (char_type, NULL,
- addr + string_pos, string_length,
- stream, options);
+ i = val_print_string (char_type, NULL, addr + string_pos,
+ string_length, stream, options);
}
else if (pascal_object_is_vtbl_member (type))
{
/* Print vtbl's nicely. */
CORE_ADDR vt_address = unpack_pointer (type, valaddr);
- struct bound_minimal_symbol msymbol =
- lookup_minimal_symbol_by_pc (vt_address);
+ struct bound_minimal_symbol msymbol
+ = lookup_minimal_symbol_by_pc (vt_address);
/* If 'symbol_print' is set, we did the work above. */
- if (!options->symbol_print
- && (msymbol.minsym != NULL)
+ if (!options->symbol_print && (msymbol.minsym != NULL)
&& (vt_address == msymbol.value_address ()))
{
if (want_space)
@@ -252,8 +240,9 @@ pascal_language::value_print_inner (struct value *val,
if (msymbol.minsym != NULL)
{
const char *search_name = msymbol.minsym->search_name ();
- wsym = lookup_symbol_search_name (search_name, NULL,
- VAR_DOMAIN).symbol;
+ wsym
+ = lookup_symbol_search_name (search_name, NULL, VAR_DOMAIN)
+ .symbol;
}
if (wsym)
@@ -306,27 +295,27 @@ pascal_language::value_print_inner (struct value *val,
/* Print vtable entry - we only get here if NOT using
-fvtable_thunks. (Otherwise, look under TYPE_CODE_PTR.) */
/* Extract the address, assume that it is unsigned. */
- print_address_demangle
- (options, gdbarch,
- extract_unsigned_integer
- (valaddr + type->field (VTBL_FNADDR_OFFSET).loc_bitpos () / 8,
- type->field (VTBL_FNADDR_OFFSET).type ()->length (),
- byte_order),
- stream, demangle);
+ print_address_demangle (
+ options, gdbarch,
+ extract_unsigned_integer (
+ valaddr + type->field (VTBL_FNADDR_OFFSET).loc_bitpos () / 8,
+ type->field (VTBL_FNADDR_OFFSET).type ()->length (), byte_order),
+ stream, demangle);
}
else
{
if (pascal_is_string_type (type, &length_pos, &length_size,
- &string_pos, &char_type, NULL) > 0)
+ &string_pos, &char_type, NULL)
+ > 0)
{
len = extract_unsigned_integer (valaddr + length_pos,
length_size, byte_order);
- printstr (stream, char_type, valaddr + string_pos, len,
- NULL, 0, options);
+ printstr (stream, char_type, valaddr + string_pos, len, NULL, 0,
+ options);
}
else
- pascal_object_print_value_fields (val, stream, recurse,
- options, NULL, 0);
+ pascal_object_print_value_fields (val, stream, recurse, options,
+ NULL, 0);
}
break;
@@ -335,7 +324,8 @@ pascal_language::value_print_inner (struct value *val,
elttype = check_typedef (elttype);
if (elttype->is_stub ())
{
- fprintf_styled (stream, metadata_style.style (), "<incomplete type>");
+ fprintf_styled (stream, metadata_style.style (),
+ "<incomplete type>");
break;
}
else
@@ -346,8 +336,8 @@ pascal_language::value_print_inner (struct value *val,
gdb_puts ("[", stream);
- int bound_info = (get_discrete_bounds (range, &low_bound, &high_bound)
- ? 0 : -1);
+ int bound_info
+ = (get_discrete_bounds (range, &low_bound, &high_bound) ? 0 : -1);
if (low_bound == 0 && high_bound == -1 && type->length () > 0)
{
/* If we know the size of the set type, we can figure out the
@@ -398,12 +388,11 @@ pascal_language::value_print_inner (struct value *val,
break;
default:
- error (_("Invalid pascal type code %d in symbol table."),
+ error (_ ("Invalid pascal type code %d in symbol table."),
type->code ());
}
}
-
void
pascal_language::value_print (struct value *val, struct ui_file *stream,
const struct value_print_options *options) const
@@ -419,13 +408,11 @@ pascal_language::value_print (struct value *val, struct ui_file *stream,
Object pascal: if it is a member pointer, we will take care
of that when we print it. */
- if (type->code () == TYPE_CODE_PTR
- || type->code () == TYPE_CODE_REF)
+ if (type->code () == TYPE_CODE_PTR || type->code () == TYPE_CODE_REF)
{
/* Hack: remove (char *) for char strings. Their
type is indicated by the quoted string anyway. */
- if (type->code () == TYPE_CODE_PTR
- && type->name () == NULL
+ if (type->code () == TYPE_CODE_PTR && type->name () == NULL
&& type->target_type ()->name () != NULL
&& strcmp (type->target_type ()->name (), "char") == 0)
{
@@ -441,29 +428,27 @@ pascal_language::value_print (struct value *val, struct ui_file *stream,
common_val_print (val, stream, 0, &opts, current_language);
}
-
static void
show_pascal_static_field_print (struct ui_file *file, int from_tty,
struct cmd_list_element *c, const char *value)
{
- gdb_printf (file, _("Printing of pascal static members is %s.\n"),
- value);
+ gdb_printf (file, _ ("Printing of pascal static members is %s.\n"), value);
}
static struct obstack dont_print_vb_obstack;
static struct obstack dont_print_statmem_obstack;
-static void pascal_object_print_static_field (struct value *,
- struct ui_file *, int,
- const struct value_print_options *);
+static void
+pascal_object_print_static_field (struct value *, struct ui_file *, int,
+ const struct value_print_options *);
static void pascal_object_print_value (struct value *, struct ui_file *, int,
const struct value_print_options *,
struct type **);
/* It was changed to this after 2.4.5. */
-const char pascal_vtbl_ptr_name[] =
-{'_', '_', 'v', 't', 'b', 'l', '_', 'p', 't', 'r', '_', 't', 'y', 'p', 'e', 0};
+const char pascal_vtbl_ptr_name[] = { '_', '_', 'v', 't', 'b', 'l', '_', 'p',
+ 't', 'r', '_', 't', 'y', 'p', 'e', 0 };
/* Return truth value for assertion that TYPE is of the type
"pointer to virtual function". */
@@ -473,8 +458,7 @@ pascal_object_is_vtbl_ptr_type (struct type *type)
{
const char *type_name = type->name ();
- return (type_name != NULL
- && strcmp (type_name, pascal_vtbl_ptr_name) == 0);
+ return (type_name != NULL && strcmp (type_name, pascal_vtbl_ptr_name) == 0);
}
/* Return truth value for the assertion that TYPE is of the type
@@ -489,9 +473,9 @@ pascal_object_is_vtbl_member (struct type *type)
if (type->code () == TYPE_CODE_ARRAY)
{
type = type->target_type ();
- if (type->code () == TYPE_CODE_STRUCT /* If not using
+ if (type->code () == TYPE_CODE_STRUCT /* If not using
thunks. */
- || type->code () == TYPE_CODE_PTR) /* If using thunks. */
+ || type->code () == TYPE_CODE_PTR) /* If using thunks. */
{
/* Virtual functions tables are full of pointers
to virtual functions. */
@@ -530,8 +514,8 @@ pascal_object_print_value_fields (struct value *val, struct ui_file *stream,
/* Print out baseclasses such that we don't print
duplicates of virtual baseclasses. */
if (n_baseclasses > 0)
- pascal_object_print_value (val, stream, recurse + 1,
- options, dont_print_vb);
+ pascal_object_print_value (val, stream, recurse + 1, options,
+ dont_print_vb);
if (!len && n_baseclasses == 1)
fprintf_styled (stream, metadata_style.style (), "<No data fields>");
@@ -585,8 +569,7 @@ pascal_object_print_value_fields (struct value *val, struct ui_file *stream,
if (field_is_static (&type->field (i)))
{
gdb_puts ("static ", stream);
- fprintf_symbol (stream,
- type->field (i).name (),
+ fprintf_symbol (stream, type->field (i).name (),
current_language->la_language,
DMGL_PARAMS | DMGL_ANSI);
}
@@ -609,11 +592,11 @@ pascal_object_print_value_fields (struct value *val, struct ui_file *stream,
fputs_styled ("<optimized out or zero length>",
metadata_style.style (), stream);
}
- else if (value_bits_synthetic_pointer
- (val, type->field (i).loc_bitpos (),
- TYPE_FIELD_BITSIZE (type, i)))
+ else if (value_bits_synthetic_pointer (
+ val, type->field (i).loc_bitpos (),
+ TYPE_FIELD_BITSIZE (type, i)))
{
- fputs_styled (_("<synthetic pointer>"),
+ fputs_styled (_ ("<synthetic pointer>"),
metadata_style.style (), stream);
}
else
@@ -654,8 +637,8 @@ pascal_object_print_value_fields (struct value *val, struct ui_file *stream,
opts.deref_ref = false;
- struct value *v = value_primitive_field (val, 0, i,
- value_type (val));
+ struct value *v
+ = value_primitive_field (val, 0, i, value_type (val));
common_val_print (v, stream, recurse + 1, &opts,
current_language);
}
@@ -717,7 +700,7 @@ pascal_object_print_value (struct value *val, struct ui_file *stream,
= (struct type **) obstack_base (&dont_print_vb_obstack);
int j = (struct type **) obstack_next_free (&dont_print_vb_obstack)
- - first_dont_print;
+ - first_dont_print;
while (--j >= 0)
if (baseclass == first_dont_print[j])
@@ -748,15 +731,16 @@ pascal_object_print_value (struct value *val, struct ui_file *stream,
if (boffset < 0 || boffset >= type->length ())
{
- CORE_ADDR address= value_address (val);
+ CORE_ADDR address = value_address (val);
gdb::byte_vector buf (baseclass->length ());
if (target_read_memory (address + boffset, buf.data (),
- baseclass->length ()) != 0)
+ baseclass->length ())
+ != 0)
skip = 1;
- base_value = value_from_contents_and_address (baseclass,
- buf.data (),
- address + boffset);
+ base_value
+ = value_from_contents_and_address (baseclass, buf.data (),
+ address + boffset);
baseclass = value_type (base_value);
boffset = 0;
}
@@ -779,14 +763,12 @@ pascal_object_print_value (struct value *val, struct ui_file *stream,
else if (skip > 0)
val_print_invalid_address (stream);
else
- pascal_object_print_value_fields
- (base_value, stream, recurse, options,
- (struct type **) obstack_base (&dont_print_vb_obstack),
- 0);
+ pascal_object_print_value_fields (
+ base_value, stream, recurse, options,
+ (struct type **) obstack_base (&dont_print_vb_obstack), 0);
gdb_puts (", ", stream);
- flush_it:
- ;
+ flush_it:;
}
if (dont_print_vb == 0)
@@ -810,8 +792,7 @@ pascal_object_print_value (struct value *val, struct ui_file *stream,
have the same meanings as in c_val_print. */
static void
-pascal_object_print_static_field (struct value *val,
- struct ui_file *stream,
+pascal_object_print_static_field (struct value *val, struct ui_file *stream,
int recurse,
const struct value_print_options *options)
{
@@ -832,13 +813,13 @@ pascal_object_print_static_field (struct value *val,
first_dont_print
= (CORE_ADDR *) obstack_base (&dont_print_statmem_obstack);
i = (CORE_ADDR *) obstack_next_free (&dont_print_statmem_obstack)
- - first_dont_print;
+ - first_dont_print;
while (--i >= 0)
{
if (value_address (val) == first_dont_print[i])
{
- fputs_styled (_("\
+ fputs_styled (_ ("\
<same as static member of an already seen type>"),
metadata_style.style (), stream);
return;
@@ -850,8 +831,8 @@ pascal_object_print_static_field (struct value *val,
sizeof (CORE_ADDR));
type = check_typedef (type);
- pascal_object_print_value_fields (val, stream, recurse,
- options, NULL, 1);
+ pascal_object_print_value_fields (val, stream, recurse, options, NULL,
+ 1);
return;
}
@@ -861,14 +842,15 @@ pascal_object_print_static_field (struct value *val,
}
void _initialize_pascal_valprint ();
+
void
_initialize_pascal_valprint ()
{
add_setshow_boolean_cmd ("pascal_static-members", class_support,
- &user_print_options.pascal_static_field_print, _("\
-Set printing of pascal static members."), _("\
-Show printing of pascal static members."), NULL,
- NULL,
- show_pascal_static_field_print,
+ &user_print_options.pascal_static_field_print, _ ("\
+Set printing of pascal static members."),
+ _ ("\
+Show printing of pascal static members."),
+ NULL, NULL, show_pascal_static_field_print,
&setprintlist, &showprintlist);
}
diff --git a/gdb/pager.h b/gdb/pager.h
index 751279d4db4..57d8cf0f585 100644
--- a/gdb/pager.h
+++ b/gdb/pager.h
@@ -26,6 +26,7 @@
class pager_file : public wrapped_file
{
public:
+
/* Create a new pager_file. The new object takes ownership of
STREAM. */
explicit pager_file (ui_file *stream)
@@ -33,10 +34,7 @@ public:
{
}
- ~pager_file ()
- {
- delete m_stream;
- }
+ ~pager_file () { delete m_stream; }
DISABLE_COPY_AND_ASSIGN (pager_file);
diff --git a/gdb/parse.c b/gdb/parse.c
index 2f7d58061ab..d6c5cea3ddb 100644
--- a/gdb/parse.c
+++ b/gdb/parse.c
@@ -41,7 +41,7 @@
#include "language.h"
#include "parser-defs.h"
#include "gdbcmd.h"
-#include "symfile.h" /* for overlay functions */
+#include "symfile.h" /* for overlay functions */
#include "inferior.h"
#include "target-float.h"
#include "block.h"
@@ -53,14 +53,14 @@
#include "c-exp.h"
static unsigned int expressiondebug = 0;
+
static void
show_expressiondebug (struct ui_file *file, int from_tty,
struct cmd_list_element *c, const char *value)
{
- gdb_printf (file, _("Expression debugging is %s.\n"), value);
+ gdb_printf (file, _ ("Expression debugging is %s.\n"), value);
}
-
/* True if an expression parser should set yydebug. */
bool parser_debug;
@@ -68,15 +68,13 @@ static void
show_parserdebug (struct ui_file *file, int from_tty,
struct cmd_list_element *c, const char *value)
{
- gdb_printf (file, _("Parser debugging is %s.\n"), value);
+ gdb_printf (file, _ ("Parser debugging is %s.\n"), value);
}
-
-static expression_up parse_exp_in_context
- (const char **, CORE_ADDR,
- const struct block *, int,
- bool, innermost_block_tracker *,
- std::unique_ptr<expr_completion_base> *);
+static expression_up
+parse_exp_in_context (const char **, CORE_ADDR, const struct block *, int,
+ bool, innermost_block_tracker *,
+ std::unique_ptr<expr_completion_base> *);
/* Documented at it's declaration. */
@@ -85,28 +83,24 @@ innermost_block_tracker::update (const struct block *b,
innermost_block_tracker_types t)
{
if ((m_types & t) != 0
- && (m_innermost_block == NULL
- || contained_in (b, m_innermost_block)))
+ && (m_innermost_block == NULL || contained_in (b, m_innermost_block)))
m_innermost_block = b;
}
-
-
/* Return the type of MSYMBOL, a minimal symbol of OBJFILE. If
ADDRESS_P is not NULL, set it to the MSYMBOL's resolved
address. */
type *
-find_minsym_type_and_address (minimal_symbol *msymbol,
- struct objfile *objfile,
+find_minsym_type_and_address (minimal_symbol *msymbol, struct objfile *objfile,
CORE_ADDR *address_p)
{
- bound_minimal_symbol bound_msym = {msymbol, objfile};
+ bound_minimal_symbol bound_msym = { msymbol, objfile };
struct obj_section *section = msymbol->obj_section (objfile);
enum minimal_symbol_type type = msymbol->type ();
- bool is_tls = (section != NULL
- && section->the_bfd_section->flags & SEC_THREAD_LOCAL);
+ bool is_tls
+ = (section != NULL && section->the_bfd_section->flags & SEC_THREAD_LOCAL);
/* The minimal symbol might point to a function descriptor;
resolve it to the actual code address instead. */
@@ -199,11 +193,10 @@ parser_state::mark_completion_tag (enum type_code tag, const char *ptr,
int length)
{
gdb_assert (parse_completion && m_completion_state == nullptr);
- gdb_assert (tag == TYPE_CODE_UNION
- || tag == TYPE_CODE_STRUCT
+ gdb_assert (tag == TYPE_CODE_UNION || tag == TYPE_CODE_STRUCT
|| tag == TYPE_CODE_ENUM);
- m_completion_state.reset
- (new expr_complete_tag (tag, make_unique_xstrndup (ptr, length)));
+ m_completion_state.reset (
+ new expr_complete_tag (tag, make_unique_xstrndup (ptr, length)));
}
/* See parser-defs.h. */
@@ -236,9 +229,9 @@ parser_state::push_symbol (const char *name, block_symbol sym)
if (msymbol.minsym != NULL)
push_new<expr::var_msym_value_operation> (msymbol);
else if (!have_full_symbols () && !have_partial_symbols ())
- error (_("No symbol table is loaded. Use the \"file\" command."));
+ error (_ ("No symbol table is loaded. Use the \"file\" command."));
else
- error (_("No symbol \"%s\" in current context."), name);
+ error (_ ("No symbol \"%s\" in current context."), name);
}
}
@@ -284,8 +277,7 @@ parser_state::push_dollar (struct stoken str)
/* Handle tokens that refer to machine registers:
$ followed by a register name. */
- i = user_reg_map_name_to_regnum (gdbarch (),
- str.ptr + 1, str.length - 1);
+ i = user_reg_map_name_to_regnum (gdbarch (), str.ptr + 1, str.length - 1);
if (i >= 0)
goto handle_register;
@@ -317,8 +309,8 @@ parser_state::push_dollar (struct stoken str)
/* Any other names are assumed to be debugger internal variables. */
- push_new<expr::internalvar_operation>
- (create_internalvar (copy.c_str () + 1));
+ push_new<expr::internalvar_operation> (create_internalvar (copy.c_str ()
+ + 1));
return;
handle_last:
push_new<expr::last_operation> (i);
@@ -332,8 +324,6 @@ handle_register:
return;
}
-
-
const char *
find_template_name_end (const char *p)
{
@@ -356,32 +346,31 @@ find_template_name_end (const char *p)
/* In future, may want to allow these?? */
return 0;
case '<':
- depth++; /* start nested template */
+ depth++; /* start nested template */
if (just_seen_colon || just_seen_right || just_seen_space)
- return 0; /* but not after : or :: or > or space */
+ return 0; /* but not after : or :: or > or space */
break;
case '>':
if (just_seen_colon || just_seen_right)
- return 0; /* end a (nested?) template */
- just_seen_right = 1; /* but not after : or :: */
- if (--depth == 0) /* also disallow >>, insist on > > */
- return ++p; /* if outermost ended, return */
+ return 0; /* end a (nested?) template */
+ just_seen_right = 1; /* but not after : or :: */
+ if (--depth == 0) /* also disallow >>, insist on > > */
+ return ++p; /* if outermost ended, return */
break;
case ':':
if (just_seen_space || (just_seen_colon > 1))
- return 0; /* nested class spec coming up */
- just_seen_colon++; /* we allow :: but not :::: */
+ return 0; /* nested class spec coming up */
+ just_seen_colon++; /* we allow :: but not :::: */
break;
case ' ':
break;
default:
- if (!((*p >= 'a' && *p <= 'z') || /* allow token chars */
- (*p >= 'A' && *p <= 'Z') ||
- (*p >= '0' && *p <= '9') ||
- (*p == '_') || (*p == ',') || /* commas for template args */
- (*p == '&') || (*p == '*') || /* pointer and ref types */
- (*p == '(') || (*p == ')') || /* function types */
- (*p == '[') || (*p == ']'))) /* array types */
+ if (!((*p >= 'a' && *p <= 'z') || /* allow token chars */
+ (*p >= 'A' && *p <= 'Z') || (*p >= '0' && *p <= '9')
+ || (*p == '_') || (*p == ',') || /* commas for template args */
+ (*p == '&') || (*p == '*') || /* pointer and ref types */
+ (*p == '(') || (*p == ')') || /* function types */
+ (*p == '[') || (*p == ']'))) /* array types */
return 0;
}
if (*p != ' ')
@@ -393,7 +382,6 @@ find_template_name_end (const char *p)
}
return 0;
}
-
/* Return a null-terminated temporary copy of the name of a string token.
@@ -408,7 +396,6 @@ copy_name (struct stoken token)
{
return std::string (token.ptr, token.length);
}
-
/* Read an expression from the string *STRINGPTR points to,
parse it, and return a pointer to a struct expression that we malloc.
@@ -424,8 +411,8 @@ expression_up
parse_exp_1 (const char **stringptr, CORE_ADDR pc, const struct block *block,
int comma, innermost_block_tracker *tracker)
{
- return parse_exp_in_context (stringptr, pc, block, comma, false,
- tracker, nullptr);
+ return parse_exp_in_context (stringptr, pc, block, comma, false, tracker,
+ nullptr);
}
/* As for parse_exp_1, except that if VOID_CONTEXT_P, then
@@ -433,15 +420,14 @@ parse_exp_1 (const char **stringptr, CORE_ADDR pc, const struct block *block,
static expression_up
parse_exp_in_context (const char **stringptr, CORE_ADDR pc,
- const struct block *block,
- int comma, bool void_context_p,
- innermost_block_tracker *tracker,
+ const struct block *block, int comma,
+ bool void_context_p, innermost_block_tracker *tracker,
std::unique_ptr<expr_completion_base> *completer)
{
const struct language_defn *lang = NULL;
if (*stringptr == 0 || **stringptr == 0)
- error_no_arg (_("expression to compute"));
+ error_no_arg (_ ("expression to compute"));
const struct block *expression_context_block = block;
CORE_ADDR expression_context_pc = 0;
@@ -519,7 +505,7 @@ parse_exp_in_context (const char **stringptr, CORE_ADDR pc,
/* If parsing for completion, allow this to succeed; but if no
expression elements have been written, then there's nothing
to do, so fail. */
- if (! ps.parse_completion || ps.expout->op == nullptr)
+ if (!ps.parse_completion || ps.expout->op == nullptr)
throw;
}
@@ -547,10 +533,9 @@ parse_expression (const char *string, innermost_block_tracker *tracker,
bool void_context_p)
{
expression_up exp = parse_exp_in_context (&string, 0, nullptr, 0,
- void_context_p,
- tracker, nullptr);
+ void_context_p, tracker, nullptr);
if (*string)
- error (_("Junk after end of expression."));
+ error (_ ("Junk after end of expression."));
return exp;
}
@@ -575,9 +560,8 @@ parse_expression_with_language (const char *string, enum language lang)
cases, return NULL. */
expression_up
-parse_expression_for_completion
- (const char *string,
- std::unique_ptr<expr_completion_base> *completer)
+parse_expression_for_completion (
+ const char *string, std::unique_ptr<expr_completion_base> *completer)
{
expression_up exp;
@@ -606,8 +590,7 @@ parse_expression_for_completion
NOTE: This accepts the floating point syntax that sscanf accepts. */
bool
-parse_float (const char *p, int len,
- const struct type *type, gdb_byte *data)
+parse_float (const char *p, int len, const struct type *type, gdb_byte *data)
{
return target_float_from_string (data, type, std::string (p, len));
}
@@ -629,7 +612,7 @@ fits_in_type (int n_sign, ULONGEST n, int type_bits, bool type_signed_p)
if (type_bits > sizeof (ULONGEST) * 8)
return true;
- ULONGEST smax = (ULONGEST)1 << (type_bits - 1);
+ ULONGEST smax = (ULONGEST) 1 << (type_bits - 1);
if (n_sign == -1)
{
/* Negative number, signed type. */
@@ -648,17 +631,17 @@ fits_in_type (int n_sign, ULONGEST n, int type_bits, bool type_signed_p)
else
gdb_assert_not_reached ("");
}
-
+
/* This function avoids direct calls to fprintf
in the parser generated debug code. */
void
parser_fprintf (FILE *x, const char *y, ...)
-{
+{
va_list args;
va_start (args, y);
if (x == stderr)
- gdb_vprintf (gdb_stderr, y, args);
+ gdb_vprintf (gdb_stderr, y, args);
else
{
gdb_printf (gdb_stderr, " Unknown FILE used.\n");
@@ -668,25 +651,22 @@ parser_fprintf (FILE *x, const char *y, ...)
}
void _initialize_parse ();
+
void
_initialize_parse ()
{
- add_setshow_zuinteger_cmd ("expression", class_maintenance,
- &expressiondebug,
- _("Set expression debugging."),
- _("Show expression debugging."),
- _("When non-zero, the internal representation "
- "of expressions will be printed."),
- NULL,
- show_expressiondebug,
- &setdebuglist, &showdebuglist);
- add_setshow_boolean_cmd ("parser", class_maintenance,
- &parser_debug,
- _("Set parser debugging."),
- _("Show parser debugging."),
- _("When non-zero, expression parser "
- "tracing will be enabled."),
- NULL,
- show_parserdebug,
- &setdebuglist, &showdebuglist);
+ add_setshow_zuinteger_cmd ("expression", class_maintenance, &expressiondebug,
+ _ ("Set expression debugging."),
+ _ ("Show expression debugging."),
+ _ ("When non-zero, the internal representation "
+ "of expressions will be printed."),
+ NULL, show_expressiondebug, &setdebuglist,
+ &showdebuglist);
+ add_setshow_boolean_cmd ("parser", class_maintenance, &parser_debug,
+ _ ("Set parser debugging."),
+ _ ("Show parser debugging."),
+ _ ("When non-zero, expression parser "
+ "tracing will be enabled."),
+ NULL, show_parserdebug, &setdebuglist,
+ &showdebuglist);
}
diff --git a/gdb/parser-defs.h b/gdb/parser-defs.h
index 1780d856744..f842bb7c490 100644
--- a/gdb/parser-defs.h
+++ b/gdb/parser-defs.h
@@ -20,7 +20,7 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
-#if !defined (PARSER_DEFS_H)
+#if !defined(PARSER_DEFS_H)
#define PARSER_DEFS_H 1
#include "expression.h"
@@ -41,8 +41,7 @@ struct expr_builder
/* Constructor. LANG is the language used to parse the expression.
And GDBARCH is the gdbarch to use during parsing. */
- expr_builder (const struct language_defn *lang,
- struct gdbarch *gdbarch)
+ expr_builder (const struct language_defn *lang, struct gdbarch *gdbarch)
: expout (new expression (lang, gdbarch))
{
}
@@ -58,24 +57,15 @@ struct expr_builder
/* Return the gdbarch that was passed to the constructor. */
- struct gdbarch *gdbarch ()
- {
- return expout->gdbarch;
- }
+ struct gdbarch *gdbarch () { return expout->gdbarch; }
/* Return the language that was passed to the constructor. */
- const struct language_defn *language ()
- {
- return expout->language_defn;
- }
+ const struct language_defn *language () { return expout->language_defn; }
/* Set the root operation of the expression that is currently being
built. */
- void set_operation (expr::operation_up &&op)
- {
- expout->op = std::move (op);
- }
+ void set_operation (expr::operation_up &&op) { expout->op = std::move (op); }
/* The expression related to this parser state. */
@@ -91,8 +81,7 @@ struct expr_complete_structop : public expr_completion_base
{
}
- bool complete (struct expression *exp,
- completion_tracker &tracker) override
+ bool complete (struct expression *exp, completion_tracker &tracker) override
{
return m_op->complete (exp, tracker);
}
@@ -110,19 +99,16 @@ private:
struct expr_complete_tag : public expr_completion_base
{
- expr_complete_tag (enum type_code code,
- gdb::unique_xmalloc_ptr<char> name)
+ expr_complete_tag (enum type_code code, gdb::unique_xmalloc_ptr<char> name)
: m_code (code),
m_name (std::move (name))
{
/* Parsers should enforce this statically. */
- gdb_assert (code == TYPE_CODE_ENUM
- || code == TYPE_CODE_UNION
+ gdb_assert (code == TYPE_CODE_ENUM || code == TYPE_CODE_UNION
|| code == TYPE_CODE_STRUCT);
}
- bool complete (struct expression *exp,
- completion_tracker &tracker) override;
+ bool complete (struct expression *exp, completion_tracker &tracker) override;
private:
@@ -142,15 +128,10 @@ struct parser_state : public expr_builder
/* Constructor. LANG is the language used to parse the expression.
And GDBARCH is the gdbarch to use during parsing. */
- parser_state (const struct language_defn *lang,
- struct gdbarch *gdbarch,
- const struct block *context_block,
- CORE_ADDR context_pc,
- int comma,
- const char *input,
- bool completion,
- innermost_block_tracker *tracker,
- bool void_p)
+ parser_state (const struct language_defn *lang, struct gdbarch *gdbarch,
+ const struct block *context_block, CORE_ADDR context_pc,
+ int comma, const char *input, bool completion,
+ innermost_block_tracker *tracker, bool void_p)
: expr_builder (lang, gdbarch),
expression_context_block (context_block),
expression_context_pc (context_pc),
@@ -267,7 +248,7 @@ struct parser_state : public expr_builder
/* If this is nonzero, this block is used as the lexical context for
symbol names. */
- const struct block * const expression_context_block;
+ const struct block *const expression_context_block;
/* If expression_context_block is non-zero, then this is the PC
within the block that we want to evaluate expressions at. When
@@ -322,11 +303,13 @@ private:
class innermost_block_tracker
{
public:
+
innermost_block_tracker (innermost_block_tracker_types types
= INNERMOST_BLOCK_FOR_SYMBOLS)
: m_types (types),
m_innermost_block (NULL)
- { /* Nothing. */ }
+ { /* Nothing. */
+ }
/* Update the stored innermost block if the new block B is more inner
than the currently stored block, or if no block is stored yet. The
@@ -345,12 +328,10 @@ public:
/* Return the stored innermost block. Can be nullptr if no symbols or
registers were found during an expression parse, and so no innermost
block was defined. */
- const struct block *block () const
- {
- return m_innermost_block;
- }
+ const struct block *block () const { return m_innermost_block; }
private:
+
/* The type of innermost block being looked for. */
innermost_block_tracker_types m_types;
@@ -363,58 +344,57 @@ private:
used, for example, for the names of symbols. */
struct stoken
- {
- /* Pointer to first byte of char-string or first bit of bit-string. */
- const char *ptr;
- /* Length of string in bytes for char-string or bits for bit-string. */
- int length;
- };
+{
+ /* Pointer to first byte of char-string or first bit of bit-string. */
+ const char *ptr;
+ /* Length of string in bytes for char-string or bits for bit-string. */
+ int length;
+};
struct typed_stoken
- {
- /* A language-specific type field. */
- int type;
- /* Pointer to first byte of char-string or first bit of bit-string. */
- char *ptr;
- /* Length of string in bytes for char-string or bits for bit-string. */
- int length;
- };
+{
+ /* A language-specific type field. */
+ int type;
+ /* Pointer to first byte of char-string or first bit of bit-string. */
+ char *ptr;
+ /* Length of string in bytes for char-string or bits for bit-string. */
+ int length;
+};
struct stoken_vector
- {
- int len;
- struct typed_stoken *tokens;
- };
+{
+ int len;
+ struct typed_stoken *tokens;
+};
struct ttype
- {
- struct stoken stoken;
- struct type *type;
- };
+{
+ struct stoken stoken;
+ struct type *type;
+};
struct symtoken
- {
- struct stoken stoken;
- struct block_symbol sym;
- int is_a_field_of_this;
- };
+{
+ struct stoken stoken;
+ struct block_symbol sym;
+ int is_a_field_of_this;
+};
struct objc_class_str
- {
- struct stoken stoken;
- struct type *type;
- int theclass;
- };
+{
+ struct stoken stoken;
+ struct type *type;
+ int theclass;
+};
extern const char *find_template_name_end (const char *);
extern std::string copy_name (struct stoken);
-extern bool parse_float (const char *p, int len,
- const struct type *type, gdb_byte *data);
+extern bool parse_float (const char *p, int len, const struct type *type,
+ gdb_byte *data);
extern bool fits_in_type (int n_sign, ULONGEST n, int type_bits,
bool type_signed_p);
-
/* Function used to avoid direct calls to fprintf
in the code generated by the bison parser. */
@@ -422,4 +402,3 @@ extern bool fits_in_type (int n_sign, ULONGEST n, int type_bits,
extern void parser_fprintf (FILE *, const char *, ...) ATTRIBUTE_PRINTF (2, 3);
#endif /* PARSER_DEFS_H */
-
diff --git a/gdb/posix-hdep.c b/gdb/posix-hdep.c
index e1cd8358457..af9724f6923 100644
--- a/gdb/posix-hdep.c
+++ b/gdb/posix-hdep.c
@@ -48,7 +48,7 @@ sharing_input_terminal (int pid)
/* Using host-dependent code here is fine, because the
child_terminal_foo functions are meant to be used by child/native
targets. */
-#if defined (__linux__) || defined (__sun__)
+#if defined(__linux__) || defined(__sun__)
char buf[100];
xsnprintf (buf, sizeof (buf), "/proc/%d/fd/0", pid);
diff --git a/gdb/ppc-fbsd-nat.c b/gdb/ppc-fbsd-nat.c
index febb19e3fb2..7cf266cf832 100644
--- a/gdb/ppc-fbsd-nat.c
+++ b/gdb/ppc-fbsd-nat.c
@@ -60,8 +60,8 @@ supply_gregset (struct regcache *regcache, const gdb_gregset_t *gregsetp)
register array. If REGNO is -1 do it for all registers. */
void
-fill_gregset (const struct regcache *regcache,
- gdb_gregset_t *gregsetp, int regno)
+fill_gregset (const struct regcache *regcache, gdb_gregset_t *gregsetp,
+ int regno)
{
const struct regset *regset = ppc_fbsd_gregset (sizeof (long));
@@ -74,25 +74,24 @@ fill_gregset (const struct regcache *regcache,
in *FPREGSETP. */
void
-supply_fpregset (struct regcache *regcache, const gdb_fpregset_t * fpregsetp)
+supply_fpregset (struct regcache *regcache, const gdb_fpregset_t *fpregsetp)
{
const struct regset *regset = ppc_fbsd_fpregset ();
- ppc_supply_fpregset (regset, regcache, -1,
- fpregsetp, sizeof (*fpregsetp));
+ ppc_supply_fpregset (regset, regcache, -1, fpregsetp, sizeof (*fpregsetp));
}
/* Fill register REGNO in *FGREGSETP with the value in GDB's
register array. If REGNO is -1 do it for all registers. */
void
-fill_fpregset (const struct regcache *regcache,
- gdb_fpregset_t *fpregsetp, int regno)
+fill_fpregset (const struct regcache *regcache, gdb_fpregset_t *fpregsetp,
+ int regno)
{
const struct regset *regset = ppc_fbsd_fpregset ();
- ppc_collect_fpregset (regset, regcache, regno,
- fpregsetp, sizeof (*fpregsetp));
+ ppc_collect_fpregset (regset, regcache, regno, fpregsetp,
+ sizeof (*fpregsetp));
}
/* Returns true if PT_GETFPREGS fetches this register. */
@@ -130,7 +129,7 @@ ppc_fbsd_nat_target::fetch_registers (struct regcache *regcache, int regno)
pid_t pid = regcache->ptid ().lwp ();
if (ptrace (PT_GETREGS, pid, (PTRACE_TYPE_ARG3) &regs, 0) == -1)
- perror_with_name (_("Couldn't get registers"));
+ perror_with_name (_ ("Couldn't get registers"));
supply_gregset (regcache, &regs);
@@ -140,7 +139,7 @@ ppc_fbsd_nat_target::fetch_registers (struct regcache *regcache, int regno)
gdb_fpregset_t fpregs;
if (ptrace (PT_GETFPREGS, pid, (PTRACE_TYPE_ARG3) &fpregs, 0) == -1)
- perror_with_name (_("Couldn't get FP registers"));
+ perror_with_name (_ ("Couldn't get FP registers"));
ppc_supply_fpregset (fpregset, regcache, regno, &fpregs, sizeof fpregs);
}
@@ -156,24 +155,24 @@ ppc_fbsd_nat_target::store_registers (struct regcache *regcache, int regno)
pid_t pid = regcache->ptid ().lwp ();
if (ptrace (PT_GETREGS, pid, (PTRACE_TYPE_ARG3) &regs, 0) == -1)
- perror_with_name (_("Couldn't get registers"));
+ perror_with_name (_ ("Couldn't get registers"));
fill_gregset (regcache, &regs, regno);
if (ptrace (PT_SETREGS, pid, (PTRACE_TYPE_ARG3) &regs, 0) == -1)
- perror_with_name (_("Couldn't write registers"));
+ perror_with_name (_ ("Couldn't write registers"));
if (regno == -1 || getfpregs_supplies (regcache->arch (), regno))
{
gdb_fpregset_t fpregs;
if (ptrace (PT_GETFPREGS, pid, (PTRACE_TYPE_ARG3) &fpregs, 0) == -1)
- perror_with_name (_("Couldn't get FP registers"));
+ perror_with_name (_ ("Couldn't get FP registers"));
fill_fpregset (regcache, &fpregs, regno);
if (ptrace (PT_SETFPREGS, pid, (PTRACE_TYPE_ARG3) &fpregs, 0) == -1)
- perror_with_name (_("Couldn't set FP registers"));
+ perror_with_name (_ ("Couldn't set FP registers"));
}
}
@@ -202,6 +201,7 @@ ppcfbsd_supply_pcb (struct regcache *regcache, struct pcb *pcb)
}
void _initialize_ppcfbsd_nat ();
+
void
_initialize_ppcfbsd_nat ()
{
diff --git a/gdb/ppc-fbsd-tdep.c b/gdb/ppc-fbsd-tdep.c
index 4355b6483fe..91c781580db 100644
--- a/gdb/ppc-fbsd-tdep.c
+++ b/gdb/ppc-fbsd-tdep.c
@@ -37,74 +37,62 @@
#include "solib-svr4.h"
#include "inferior.h"
-
/* 32-bit regset descriptions. */
-static const struct ppc_reg_offsets ppc32_fbsd_reg_offsets =
- {
- /* General-purpose registers. */
- /* .r0_offset = */ 0,
- /* .gpr_size = */ 4,
- /* .xr_size = */ 4,
- /* .pc_offset = */ 144,
- /* .ps_offset = */ -1,
- /* .cr_offset = */ 132,
- /* .lr_offset = */ 128,
- /* .ctr_offset = */ 140,
- /* .xer_offset = */ 136,
- /* .mq_offset = */ -1,
-
- /* Floating-point registers. */
- /* .f0_offset = */ 0,
- /* .fpscr_offset = */ 256,
- /* .fpscr_size = */ 8
- };
+static const struct ppc_reg_offsets ppc32_fbsd_reg_offsets = {
+ /* General-purpose registers. */
+ /* .r0_offset = */ 0,
+ /* .gpr_size = */ 4,
+ /* .xr_size = */ 4,
+ /* .pc_offset = */ 144,
+ /* .ps_offset = */ -1,
+ /* .cr_offset = */ 132,
+ /* .lr_offset = */ 128,
+ /* .ctr_offset = */ 140,
+ /* .xer_offset = */ 136,
+ /* .mq_offset = */ -1,
+
+ /* Floating-point registers. */
+ /* .f0_offset = */ 0,
+ /* .fpscr_offset = */ 256,
+ /* .fpscr_size = */ 8
+};
/* 64-bit regset descriptions. */
-static const struct ppc_reg_offsets ppc64_fbsd_reg_offsets =
- {
- /* General-purpose registers. */
- /* .r0_offset = */ 0,
- /* .gpr_size = */ 8,
- /* .xr_size = */ 8,
- /* .pc_offset = */ 288,
- /* .ps_offset = */ -1,
- /* .cr_offset = */ 264,
- /* .lr_offset = */ 256,
- /* .ctr_offset = */ 280,
- /* .xer_offset = */ 272,
- /* .mq_offset = */ -1,
-
- /* Floating-point registers. */
- /* .f0_offset = */ 0,
- /* .fpscr_offset = */ 256,
- /* .fpscr_size = */ 8
- };
+static const struct ppc_reg_offsets ppc64_fbsd_reg_offsets = {
+ /* General-purpose registers. */
+ /* .r0_offset = */ 0,
+ /* .gpr_size = */ 8,
+ /* .xr_size = */ 8,
+ /* .pc_offset = */ 288,
+ /* .ps_offset = */ -1,
+ /* .cr_offset = */ 264,
+ /* .lr_offset = */ 256,
+ /* .ctr_offset = */ 280,
+ /* .xer_offset = */ 272,
+ /* .mq_offset = */ -1,
+
+ /* Floating-point registers. */
+ /* .f0_offset = */ 0,
+ /* .fpscr_offset = */ 256,
+ /* .fpscr_size = */ 8
+};
/* 32-bit general-purpose register set. */
-static const struct regset ppc32_fbsd_gregset = {
- &ppc32_fbsd_reg_offsets,
- ppc_supply_gregset,
- ppc_collect_gregset
-};
+static const struct regset ppc32_fbsd_gregset
+ = { &ppc32_fbsd_reg_offsets, ppc_supply_gregset, ppc_collect_gregset };
/* 64-bit general-purpose register set. */
-static const struct regset ppc64_fbsd_gregset = {
- &ppc64_fbsd_reg_offsets,
- ppc_supply_gregset,
- ppc_collect_gregset
-};
+static const struct regset ppc64_fbsd_gregset
+ = { &ppc64_fbsd_reg_offsets, ppc_supply_gregset, ppc_collect_gregset };
/* 32-/64-bit floating-point register set. */
-static const struct regset ppc32_fbsd_fpregset = {
- &ppc32_fbsd_reg_offsets,
- ppc_supply_fpregset,
- ppc_collect_fpregset
-};
+static const struct regset ppc32_fbsd_fpregset
+ = { &ppc32_fbsd_reg_offsets, ppc_supply_fpregset, ppc_collect_fpregset };
const struct regset *
ppc_fbsd_gregset (int wordsize)
@@ -141,17 +129,14 @@ static const int ppcfbsd_page_size = 4096;
/* Offset for sigreturn(2). */
-static const int ppcfbsd_sigreturn_offset[] = {
- 0xc, /* FreeBSD 32-bit */
- -1
-};
+static const int ppcfbsd_sigreturn_offset[] = { 0xc, /* FreeBSD 32-bit */
+ -1 };
/* Signal trampolines. */
static int
ppcfbsd_sigtramp_frame_sniffer (const struct frame_unwind *self,
- frame_info_ptr this_frame,
- void **this_cache)
+ frame_info_ptr this_frame, void **this_cache)
{
struct gdbarch *gdbarch = get_frame_arch (this_frame);
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
@@ -176,7 +161,7 @@ ppcfbsd_sigtramp_frame_sniffer (const struct frame_unwind *self,
unsigned long insn;
if (!safe_frame_unwind_memory (this_frame, start_pc + *offset,
- {buf, sizeof buf}))
+ { buf, sizeof buf }))
continue;
/* Check for "li r0,SYS_sigreturn". */
@@ -185,8 +170,8 @@ ppcfbsd_sigtramp_frame_sniffer (const struct frame_unwind *self,
continue;
/* Check for "sc". */
- insn = extract_unsigned_integer (buf + PPC_INSN_SIZE,
- PPC_INSN_SIZE, byte_order);
+ insn = extract_unsigned_integer (buf + PPC_INSN_SIZE, PPC_INSN_SIZE,
+ byte_order);
if (insn != 0x44000002)
continue;
@@ -214,7 +199,7 @@ ppcfbsd_sigtramp_frame_cache (frame_info_ptr this_frame, void **this_cache)
func = get_frame_pc (this_frame);
func &= ~(ppcfbsd_page_size - 1);
- if (!safe_frame_unwind_memory (this_frame, func, {buf, sizeof buf}))
+ if (!safe_frame_unwind_memory (this_frame, func, { buf, sizeof buf }))
return cache;
base = get_frame_register_unsigned (this_frame, gdbarch_sp_regnum (gdbarch));
@@ -243,11 +228,11 @@ ppcfbsd_sigtramp_frame_cache (frame_info_ptr this_frame, void **this_cache)
}
static void
-ppcfbsd_sigtramp_frame_this_id (frame_info_ptr this_frame,
- void **this_cache, struct frame_id *this_id)
+ppcfbsd_sigtramp_frame_this_id (frame_info_ptr this_frame, void **this_cache,
+ struct frame_id *this_id)
{
- struct trad_frame_cache *cache =
- ppcfbsd_sigtramp_frame_cache (this_frame, this_cache);
+ struct trad_frame_cache *cache
+ = ppcfbsd_sigtramp_frame_cache (this_frame, this_cache);
trad_frame_get_id (cache, this_id);
}
@@ -256,21 +241,20 @@ static struct value *
ppcfbsd_sigtramp_frame_prev_register (frame_info_ptr this_frame,
void **this_cache, int regnum)
{
- struct trad_frame_cache *cache =
- ppcfbsd_sigtramp_frame_cache (this_frame, this_cache);
+ struct trad_frame_cache *cache
+ = ppcfbsd_sigtramp_frame_cache (this_frame, this_cache);
return trad_frame_get_register (cache, this_frame, regnum);
}
-static const struct frame_unwind ppcfbsd_sigtramp_frame_unwind = {
- "ppc freebsd sigtramp",
- SIGTRAMP_FRAME,
- default_frame_unwind_stop_reason,
- ppcfbsd_sigtramp_frame_this_id,
- ppcfbsd_sigtramp_frame_prev_register,
- NULL,
- ppcfbsd_sigtramp_frame_sniffer
-};
+static const struct frame_unwind ppcfbsd_sigtramp_frame_unwind
+ = { "ppc freebsd sigtramp",
+ SIGTRAMP_FRAME,
+ default_frame_unwind_stop_reason,
+ ppcfbsd_sigtramp_frame_this_id,
+ ppcfbsd_sigtramp_frame_prev_register,
+ NULL,
+ ppcfbsd_sigtramp_frame_sniffer };
static enum return_value_convention
ppcfbsd_return_value (struct gdbarch *gdbarch, struct value *function,
@@ -308,7 +292,7 @@ ppcfbsd_get_thread_local_address (struct gdbarch *gdbarch, ptid_t ptid,
ULONGEST tp;
if (regcache->cooked_read (tp_regnum, &tp) != REG_VALID)
- error (_("Unable to fetch tcb pointer"));
+ error (_ ("Unable to fetch tcb pointer"));
/* tp points to the end of the TCB block. The first member of the
TCB is the pointer to the DTV array. */
@@ -333,8 +317,8 @@ ppcfbsd_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
set_gdbarch_return_value (gdbarch, ppcfbsd_return_value);
set_gdbarch_skip_trampoline_code (gdbarch, find_solib_trampoline_target);
- set_solib_svr4_fetch_link_map_offsets (gdbarch,
- svr4_ilp32_fetch_link_map_offsets);
+ set_solib_svr4_fetch_link_map_offsets (
+ gdbarch, svr4_ilp32_fetch_link_map_offsets);
frame_unwind_append_unwinder (gdbarch, &ppcfbsd_sigtramp_frame_unwind);
set_gdbarch_gcore_bfd_target (gdbarch, "elf32-powerpc");
@@ -342,8 +326,8 @@ ppcfbsd_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
if (tdep->wordsize == 8)
{
- set_gdbarch_convert_from_func_ptr_addr
- (gdbarch, ppc64_convert_from_func_ptr_addr);
+ set_gdbarch_convert_from_func_ptr_addr (
+ gdbarch, ppc64_convert_from_func_ptr_addr);
set_gdbarch_elf_make_msymbol_special (gdbarch,
ppc64_elf_make_msymbol_special);
@@ -353,8 +337,8 @@ ppcfbsd_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
set_gdbarch_gcore_bfd_target (gdbarch, "elf64-powerpc");
}
- set_gdbarch_iterate_over_regset_sections
- (gdbarch, ppcfbsd_iterate_over_regset_sections);
+ set_gdbarch_iterate_over_regset_sections (
+ gdbarch, ppcfbsd_iterate_over_regset_sections);
set_gdbarch_fetch_tls_load_module_address (gdbarch,
svr4_fetch_objfile_link_map);
@@ -363,6 +347,7 @@ ppcfbsd_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
}
void _initialize_ppcfbsd_tdep ();
+
void
_initialize_ppcfbsd_tdep ()
{
diff --git a/gdb/ppc-linux-nat.c b/gdb/ppc-linux-nat.c
index d8a8fbdf706..6344344e2ea 100644
--- a/gdb/ppc-linux-nat.c
+++ b/gdb/ppc-linux-nat.c
@@ -59,13 +59,13 @@
/* Similarly for the hardware watchpoint support. These requests are used
when the PowerPC HWDEBUG ptrace interface is not available. */
#ifndef PTRACE_GET_DEBUGREG
-#define PTRACE_GET_DEBUGREG 25
+#define PTRACE_GET_DEBUGREG 25
#endif
#ifndef PTRACE_SET_DEBUGREG
-#define PTRACE_SET_DEBUGREG 26
+#define PTRACE_SET_DEBUGREG 26
#endif
#ifndef PTRACE_GETSIGINFO
-#define PTRACE_GETSIGINFO 0x4202
+#define PTRACE_GETSIGINFO 0x4202
#endif
/* These requests are used when the PowerPC HWDEBUG ptrace interface is
@@ -78,65 +78,65 @@
ptrace interface is not present in ptrace.h, so we'll have to pretty much
include it all here so that the code at least compiles on older systems. */
#define PPC_PTRACE_GETHWDBGINFO 0x89
-#define PPC_PTRACE_SETHWDEBUG 0x88
-#define PPC_PTRACE_DELHWDEBUG 0x87
+#define PPC_PTRACE_SETHWDEBUG 0x88
+#define PPC_PTRACE_DELHWDEBUG 0x87
struct ppc_debug_info
{
- uint32_t version; /* Only version 1 exists to date. */
- uint32_t num_instruction_bps;
- uint32_t num_data_bps;
- uint32_t num_condition_regs;
- uint32_t data_bp_alignment;
- uint32_t sizeof_condition; /* size of the DVC register. */
- uint64_t features;
+ uint32_t version; /* Only version 1 exists to date. */
+ uint32_t num_instruction_bps;
+ uint32_t num_data_bps;
+ uint32_t num_condition_regs;
+ uint32_t data_bp_alignment;
+ uint32_t sizeof_condition; /* size of the DVC register. */
+ uint64_t features;
};
/* Features will have bits indicating whether there is support for: */
-#define PPC_DEBUG_FEATURE_INSN_BP_RANGE 0x1
-#define PPC_DEBUG_FEATURE_INSN_BP_MASK 0x2
-#define PPC_DEBUG_FEATURE_DATA_BP_RANGE 0x4
-#define PPC_DEBUG_FEATURE_DATA_BP_MASK 0x8
+#define PPC_DEBUG_FEATURE_INSN_BP_RANGE 0x1
+#define PPC_DEBUG_FEATURE_INSN_BP_MASK 0x2
+#define PPC_DEBUG_FEATURE_DATA_BP_RANGE 0x4
+#define PPC_DEBUG_FEATURE_DATA_BP_MASK 0x8
struct ppc_hw_breakpoint
{
- uint32_t version; /* currently, version must be 1 */
- uint32_t trigger_type; /* only some combinations allowed */
- uint32_t addr_mode; /* address match mode */
- uint32_t condition_mode; /* break/watchpoint condition flags */
- uint64_t addr; /* break/watchpoint address */
- uint64_t addr2; /* range end or mask */
- uint64_t condition_value; /* contents of the DVC register */
+ uint32_t version; /* currently, version must be 1 */
+ uint32_t trigger_type; /* only some combinations allowed */
+ uint32_t addr_mode; /* address match mode */
+ uint32_t condition_mode; /* break/watchpoint condition flags */
+ uint64_t addr; /* break/watchpoint address */
+ uint64_t addr2; /* range end or mask */
+ uint64_t condition_value; /* contents of the DVC register */
};
/* Trigger type. */
-#define PPC_BREAKPOINT_TRIGGER_EXECUTE 0x1
-#define PPC_BREAKPOINT_TRIGGER_READ 0x2
-#define PPC_BREAKPOINT_TRIGGER_WRITE 0x4
-#define PPC_BREAKPOINT_TRIGGER_RW 0x6
+#define PPC_BREAKPOINT_TRIGGER_EXECUTE 0x1
+#define PPC_BREAKPOINT_TRIGGER_READ 0x2
+#define PPC_BREAKPOINT_TRIGGER_WRITE 0x4
+#define PPC_BREAKPOINT_TRIGGER_RW 0x6
/* Address mode. */
-#define PPC_BREAKPOINT_MODE_EXACT 0x0
-#define PPC_BREAKPOINT_MODE_RANGE_INCLUSIVE 0x1
-#define PPC_BREAKPOINT_MODE_RANGE_EXCLUSIVE 0x2
-#define PPC_BREAKPOINT_MODE_MASK 0x3
+#define PPC_BREAKPOINT_MODE_EXACT 0x0
+#define PPC_BREAKPOINT_MODE_RANGE_INCLUSIVE 0x1
+#define PPC_BREAKPOINT_MODE_RANGE_EXCLUSIVE 0x2
+#define PPC_BREAKPOINT_MODE_MASK 0x3
/* Condition mode. */
-#define PPC_BREAKPOINT_CONDITION_NONE 0x0
-#define PPC_BREAKPOINT_CONDITION_AND 0x1
-#define PPC_BREAKPOINT_CONDITION_EXACT 0x1
-#define PPC_BREAKPOINT_CONDITION_OR 0x2
+#define PPC_BREAKPOINT_CONDITION_NONE 0x0
+#define PPC_BREAKPOINT_CONDITION_AND 0x1
+#define PPC_BREAKPOINT_CONDITION_EXACT 0x1
+#define PPC_BREAKPOINT_CONDITION_OR 0x2
#define PPC_BREAKPOINT_CONDITION_AND_OR 0x3
#define PPC_BREAKPOINT_CONDITION_BE_ALL 0x00ff0000
-#define PPC_BREAKPOINT_CONDITION_BE_SHIFT 16
-#define PPC_BREAKPOINT_CONDITION_BE(n) \
- (1<<((n)+PPC_BREAKPOINT_CONDITION_BE_SHIFT))
+#define PPC_BREAKPOINT_CONDITION_BE_SHIFT 16
+#define PPC_BREAKPOINT_CONDITION_BE(n) \
+ (1 << ((n) + PPC_BREAKPOINT_CONDITION_BE_SHIFT))
#endif /* PPC_PTRACE_GETHWDBGINFO */
/* Feature defined on Linux kernel v3.9: DAWR interface, that enables wider
watchpoint (up to 512 bytes). */
#ifndef PPC_DEBUG_FEATURE_DATA_BP_DAWR
-#define PPC_DEBUG_FEATURE_DATA_BP_DAWR 0x10
+#define PPC_DEBUG_FEATURE_DATA_BP_DAWR 0x10
#endif /* PPC_DEBUG_FEATURE_DATA_BP_DAWR */
/* Feature defined on Linux kernel v5.1: Second watchpoint support. */
@@ -327,9 +327,8 @@ class ppc_linux_dreg_interface
public:
ppc_linux_dreg_interface ()
- : m_interface (), m_hwdebug_info ()
- {
- };
+ : m_interface (),
+ m_hwdebug_info () {};
DISABLE_COPY_AND_ASSIGN (ppc_linux_dreg_interface);
@@ -367,10 +366,7 @@ public:
/* Returns true if the interface has already been detected. This is
useful for cases when we know there is no work to be done if the
interface hasn't been detected yet. */
- bool detected_p ()
- {
- return m_interface.has_value ();
- }
+ bool detected_p () { return m_interface.has_value (); }
/* Detect the available interface, if any, if it hasn't been detected
before, using PTID for the necessary ptrace calls. */
@@ -384,8 +380,7 @@ public:
bool no_features = false;
- if (ptrace (PPC_PTRACE_GETHWDBGINFO, ptid.lwp (), 0, &m_hwdebug_info)
- >= 0)
+ if (ptrace (PPC_PTRACE_GETHWDBGINFO, ptid.lwp (), 0, &m_hwdebug_info) >= 0)
{
/* If there are no advertised features, we don't use the
HWDEBUG interface and try the DEBUGREG interface instead.
@@ -439,8 +434,8 @@ public:
}
if (errno != EIO)
- warning (_("Error when detecting the debug register interface. "
- "Debug registers will be unavailable."));
+ warning (_ ("Error when detecting the debug register interface. "
+ "Debug registers will be unavailable."));
m_interface.emplace (UNAVAILABLE);
return;
@@ -459,11 +454,11 @@ private:
detect wich interface is available. */
enum debug_reg_interface
- {
- UNAVAILABLE,
- HWDEBUG,
- DEBUGREG
- };
+ {
+ UNAVAILABLE,
+ HWDEBUG,
+ DEBUGREG
+ };
/* The interface option. Initialized if has_value () returns true. */
gdb::optional<enum debug_reg_interface> m_interface;
@@ -499,11 +494,11 @@ struct ppc_linux_nat_target final : public linux_nat_target
/* Add our breakpoint/watchpoint methods. */
int can_use_hw_breakpoint (enum bptype, int, int) override;
- int insert_hw_breakpoint (struct gdbarch *, struct bp_target_info *)
- override;
+ int insert_hw_breakpoint (struct gdbarch *,
+ struct bp_target_info *) override;
- int remove_hw_breakpoint (struct gdbarch *, struct bp_target_info *)
- override;
+ int remove_hw_breakpoint (struct gdbarch *,
+ struct bp_target_info *) override;
int region_ok_for_hw_watchpoint (CORE_ADDR, int) override;
@@ -513,26 +508,25 @@ struct ppc_linux_nat_target final : public linux_nat_target
int remove_watchpoint (CORE_ADDR, int, enum target_hw_bp_type,
struct expression *) override;
- int insert_mask_watchpoint (CORE_ADDR, CORE_ADDR, enum target_hw_bp_type)
- override;
+ int insert_mask_watchpoint (CORE_ADDR, CORE_ADDR,
+ enum target_hw_bp_type) override;
- int remove_mask_watchpoint (CORE_ADDR, CORE_ADDR, enum target_hw_bp_type)
- override;
+ int remove_mask_watchpoint (CORE_ADDR, CORE_ADDR,
+ enum target_hw_bp_type) override;
bool watchpoint_addr_within_range (CORE_ADDR, CORE_ADDR, int) override;
- bool can_accel_watchpoint_condition (CORE_ADDR, int, int, struct expression *)
- override;
+ bool can_accel_watchpoint_condition (CORE_ADDR, int, int,
+ struct expression *) override;
int masked_watch_num_registers (CORE_ADDR, CORE_ADDR) override;
int ranged_break_num_registers () override;
- const struct target_desc *read_description () override;
+ const struct target_desc *read_description () override;
- int auxv_parse (const gdb_byte **readptr,
- const gdb_byte *endptr, CORE_ADDR *typep, CORE_ADDR *valp)
- override;
+ int auxv_parse (const gdb_byte **readptr, const gdb_byte *endptr,
+ CORE_ADDR *typep, CORE_ADDR *valp) override;
/* Override linux_nat_target low methods. */
bool low_stopped_by_watchpoint () override;
@@ -560,11 +554,9 @@ private:
void mark_debug_registers_changed (pid_t pid);
- void register_hw_breakpoint (pid_t pid,
- const struct ppc_hw_breakpoint &bp);
+ void register_hw_breakpoint (pid_t pid, const struct ppc_hw_breakpoint &bp);
- void clear_hw_breakpoint (pid_t pid,
- const struct ppc_hw_breakpoint &a);
+ void clear_hw_breakpoint (pid_t pid, const struct ppc_hw_breakpoint &a);
void register_wp (pid_t pid, long wp_value);
@@ -572,25 +564,19 @@ private:
bool can_use_watchpoint_cond_accel (void);
- void calculate_dvc (CORE_ADDR addr, int len,
- CORE_ADDR data_value,
- uint32_t *condition_mode,
- uint64_t *condition_value);
+ void calculate_dvc (CORE_ADDR addr, int len, CORE_ADDR data_value,
+ uint32_t *condition_mode, uint64_t *condition_value);
- int check_condition (CORE_ADDR watch_addr,
- struct expression *cond,
+ int check_condition (CORE_ADDR watch_addr, struct expression *cond,
CORE_ADDR *data_value, int *len);
int num_memory_accesses (const std::vector<value_ref_ptr> &chain);
int get_trigger_type (enum target_hw_bp_type type);
- void create_watchpoint_request (struct ppc_hw_breakpoint *p,
- CORE_ADDR addr,
- int len,
- enum target_hw_bp_type type,
- struct expression *cond,
- int insert);
+ void create_watchpoint_request (struct ppc_hw_breakpoint *p, CORE_ADDR addr,
+ int len, enum target_hw_bp_type type,
+ struct expression *cond, int insert);
bool hwdebug_point_cmp (const struct ppc_hw_breakpoint &a,
const struct ppc_hw_breakpoint &b);
@@ -612,7 +598,7 @@ private:
{
std::size_t operator() (const ptid_t &ptid) const
{
- return std::hash<long>{} (ptid.lwp ());
+ return std::hash<long> {}(ptid.lwp ());
}
};
@@ -621,9 +607,9 @@ private:
and watchpoints were last installed in each slot of each thread.
Only used when the interface is HWDEBUG. */
- std::unordered_map <ptid_t,
- std::list<std::pair<long, ppc_hw_breakpoint>>,
- ptid_hash> m_installed_hw_bps;
+ std::unordered_map<ptid_t, std::list<std::pair<long, ppc_hw_breakpoint>>,
+ ptid_hash>
+ m_installed_hw_bps;
};
static ppc_linux_nat_target the_ppc_linux_nat_target;
@@ -655,15 +641,14 @@ ppc_register_u_addr (struct gdbarch *gdbarch, int regno)
int wordsize = sizeof (long);
/* General purpose registers occupy 1 slot each in the buffer. */
- if (regno >= tdep->ppc_gp0_regnum
+ if (regno >= tdep->ppc_gp0_regnum
&& regno < tdep->ppc_gp0_regnum + ppc_num_gprs)
u_addr = ((regno - tdep->ppc_gp0_regnum + PT_R0) * wordsize);
/* Floating point regs: eight bytes each in both 32- and 64-bit
ptrace interfaces. Thus, two slots each in 32-bit interface, one
slot each in 64-bit interface. */
- if (tdep->ppc_fp0_regnum >= 0
- && regno >= tdep->ppc_fp0_regnum
+ if (tdep->ppc_fp0_regnum >= 0 && regno >= tdep->ppc_fp0_regnum
&& regno < tdep->ppc_fp0_regnum + ppc_num_fprs)
u_addr = (PT_FPR0 * wordsize) + ((regno - tdep->ppc_fp0_regnum) * 8);
@@ -688,8 +673,7 @@ ppc_register_u_addr (struct gdbarch *gdbarch, int regno)
u_addr = PT_ORIG_R3 * wordsize;
if (regno == PPC_TRAP_REGNUM)
u_addr = PT_TRAP * wordsize;
- if (tdep->ppc_fpscr_regnum >= 0
- && regno == tdep->ppc_fpscr_regnum)
+ if (tdep->ppc_fpscr_regnum >= 0 && regno == tdep->ppc_fpscr_regnum)
{
/* NOTE: cagney/2005-02-08: On some 64-bit GNU/Linux systems the
kernel headers incorrectly contained the 32-bit definition of
@@ -704,8 +688,8 @@ ppc_register_u_addr (struct gdbarch *gdbarch, int regno)
slot and not just its second word. The PT_FPSCR supplied when
GDB is compiled as a 32-bit app doesn't reflect this. */
else if (wordsize == 4 && register_size (gdbarch, regno) == 8
- && PT_FPSCR == (48 + 2*32 + 1))
- u_addr = (48 + 2*32) * wordsize;
+ && PT_FPSCR == (48 + 2 * 32 + 1))
+ u_addr = (48 + 2 * 32) * wordsize;
else
u_addr = PT_FPSCR * wordsize;
}
@@ -730,7 +714,7 @@ fetch_vsx_registers (struct regcache *regcache, int tid, int regno)
have_ptrace_getsetvsxregs = 0;
return;
}
- perror_with_name (_("Unable to fetch VSX registers"));
+ perror_with_name (_ ("Unable to fetch VSX registers"));
}
vsxregset->supply_regset (vsxregset, regcache, regno, &regs,
@@ -741,8 +725,7 @@ fetch_vsx_registers (struct regcache *regcache, int tid, int regno)
registers set mechanism, as opposed to the interface for all the
other registers, that stores/fetches each register individually. */
static void
-fetch_altivec_registers (struct regcache *regcache, int tid,
- int regno)
+fetch_altivec_registers (struct regcache *regcache, int tid, int regno)
{
int ret;
gdb_vrregset_t regs;
@@ -757,7 +740,7 @@ fetch_altivec_registers (struct regcache *regcache, int tid,
have_ptrace_getvrregs = 0;
return;
}
- perror_with_name (_("Unable to fetch AltiVec registers"));
+ perror_with_name (_ ("Unable to fetch AltiVec registers"));
}
vrregset->supply_regset (vrregset, regcache, regno, &regs,
@@ -787,7 +770,7 @@ get_spe_registers (int tid, struct gdb_evrregset_t *evrregset)
have_ptrace_getsetevrregs = 0;
else
/* Anything else needs to be reported. */
- perror_with_name (_("Unable to fetch SPE registers"));
+ perror_with_name (_ ("Unable to fetch SPE registers"));
}
}
@@ -826,12 +809,10 @@ fetch_spe_register (struct regcache *regcache, int tid, int regno)
regcache->raw_supply (regno,
&evrregs.evr[regno - tdep->ppc_ev0_upper_regnum]);
- if (regno == -1
- || regno == tdep->ppc_acc_regnum)
+ if (regno == -1 || regno == tdep->ppc_acc_regnum)
regcache->raw_supply (tdep->ppc_acc_regnum, &evrregs.acc);
- if (regno == -1
- || regno == tdep->ppc_spefscr_regnum)
+ if (regno == -1 || regno == tdep->ppc_spefscr_regnum)
regcache->raw_supply (tdep->ppc_spefscr_regnum, &evrregs.spefscr);
}
@@ -842,8 +823,8 @@ fetch_spe_register (struct regcache *regcache, int tid, int regno)
registers as unavailable in REGCACHE. */
static void
-fetch_regset (struct regcache *regcache, int tid,
- int regset_id, int regsetsize, const struct regset *regset)
+fetch_regset (struct regcache *regcache, int tid, int regset_id,
+ int regsetsize, const struct regset *regset)
{
void *buf = alloca (regsetsize);
struct iovec iov;
@@ -856,7 +837,7 @@ fetch_regset (struct regcache *regcache, int tid,
if (errno == ENODATA)
regset->supply_regset (regset, regcache, -1, NULL, regsetsize);
else
- perror_with_name (_("Couldn't get register set"));
+ perror_with_name (_ ("Couldn't get register set"));
}
else
regset->supply_regset (regset, regcache, -1, buf, regsetsize);
@@ -880,12 +861,12 @@ store_regset (const struct regcache *regcache, int tid, int regnum,
/* Make sure that the buffer that will be stored has up to date values
for the registers that won't be collected. */
if (ptrace (PTRACE_GETREGSET, tid, regset_id, &iov) < 0)
- perror_with_name (_("Couldn't get register set"));
+ perror_with_name (_ ("Couldn't get register set"));
regset->collect_regset (regset, regcache, regnum, buf, regsetsize);
if (ptrace (PTRACE_SETREGSET, tid, regset_id, &iov) < 0)
- perror_with_name (_("Couldn't set register set"));
+ perror_with_name (_ ("Couldn't set register set"));
}
/* Check whether the kernel provides a register set with number
@@ -900,8 +881,7 @@ check_regset (int tid, int regset_id, int regsetsize)
iov.iov_base = buf;
iov.iov_len = regsetsize;
- if (ptrace (PTRACE_GETREGSET, tid, regset_id, &iov) >= 0
- || errno == ENODATA)
+ if (ptrace (PTRACE_GETREGSET, tid, regset_id, &iov) >= 0 || errno == ENODATA)
return true;
else
return false;
@@ -924,11 +904,11 @@ fetch_register (struct regcache *regcache, int tid, int regno)
support for such a ptrace request, then go and fetch the
register. */
if (have_ptrace_getvrregs)
- {
- fetch_altivec_registers (regcache, tid, regno);
- return;
- }
- /* If we have discovered that there is no ptrace support for
+ {
+ fetch_altivec_registers (regcache, tid, regno);
+ return;
+ }
+ /* If we have discovered that there is no ptrace support for
AltiVec registers, fall through and return zeroes, because
regaddr will be -1 in this case. */
}
@@ -949,8 +929,7 @@ fetch_register (struct regcache *regcache, int tid, int regno)
{
gdb_assert (tdep->ppc_dscr_regnum != -1);
- fetch_regset (regcache, tid, NT_PPC_DSCR,
- PPC_LINUX_SIZEOF_DSCRREGSET,
+ fetch_regset (regcache, tid, NT_PPC_DSCR, PPC_LINUX_SIZEOF_DSCRREGSET,
&ppc32_linux_dscrregset);
return;
}
@@ -958,8 +937,7 @@ fetch_register (struct regcache *regcache, int tid, int regno)
{
gdb_assert (tdep->ppc_ppr_regnum != -1);
- fetch_regset (regcache, tid, NT_PPC_PPR,
- PPC_LINUX_SIZEOF_PPRREGSET,
+ fetch_regset (regcache, tid, NT_PPC_PPR, PPC_LINUX_SIZEOF_PPRREGSET,
&ppc32_linux_pprregset);
return;
}
@@ -967,8 +945,7 @@ fetch_register (struct regcache *regcache, int tid, int regno)
{
gdb_assert (tdep->ppc_tar_regnum != -1);
- fetch_regset (regcache, tid, NT_PPC_TAR,
- PPC_LINUX_SIZEOF_TARREGSET,
+ fetch_regset (regcache, tid, NT_PPC_TAR, PPC_LINUX_SIZEOF_TARREGSET,
&ppc32_linux_tarregset);
return;
}
@@ -976,8 +953,7 @@ fetch_register (struct regcache *regcache, int tid, int regno)
{
gdb_assert (tdep->have_ebb);
- fetch_regset (regcache, tid, NT_PPC_EBB,
- PPC_LINUX_SIZEOF_EBBREGSET,
+ fetch_regset (regcache, tid, NT_PPC_EBB, PPC_LINUX_SIZEOF_EBBREGSET,
&ppc32_linux_ebbregset);
return;
}
@@ -985,8 +961,7 @@ fetch_register (struct regcache *regcache, int tid, int regno)
{
gdb_assert (tdep->ppc_mmcr0_regnum != -1);
- fetch_regset (regcache, tid, NT_PPC_PMU,
- PPC_LINUX_SIZEOF_PMUREGSET,
+ fetch_regset (regcache, tid, NT_PPC_PMU, PPC_LINUX_SIZEOF_PMUREGSET,
&ppc32_linux_pmuregset);
return;
}
@@ -995,8 +970,7 @@ fetch_register (struct regcache *regcache, int tid, int regno)
gdb_assert (tdep->have_htm_spr);
fetch_regset (regcache, tid, NT_PPC_TM_SPR,
- PPC_LINUX_SIZEOF_TM_SPRREGSET,
- &ppc32_linux_tm_sprregset);
+ PPC_LINUX_SIZEOF_TM_SPRREGSET, &ppc32_linux_tm_sprregset);
return;
}
else if (PPC_IS_CKPTGP_REGNUM (regno))
@@ -1005,9 +979,8 @@ fetch_register (struct regcache *regcache, int tid, int regno)
const struct regset *cgprregset = ppc_linux_cgprregset (gdbarch);
fetch_regset (regcache, tid, NT_PPC_TM_CGPR,
- (tdep->wordsize == 4?
- PPC32_LINUX_SIZEOF_CGPRREGSET
- : PPC64_LINUX_SIZEOF_CGPRREGSET),
+ (tdep->wordsize == 4 ? PPC32_LINUX_SIZEOF_CGPRREGSET
+ : PPC64_LINUX_SIZEOF_CGPRREGSET),
cgprregset);
return;
}
@@ -1015,8 +988,7 @@ fetch_register (struct regcache *regcache, int tid, int regno)
{
gdb_assert (tdep->have_htm_fpu);
- fetch_regset (regcache, tid, NT_PPC_TM_CFPR,
- PPC_LINUX_SIZEOF_CFPRREGSET,
+ fetch_regset (regcache, tid, NT_PPC_TM_CFPR, PPC_LINUX_SIZEOF_CFPRREGSET,
&ppc32_linux_cfprregset);
return;
}
@@ -1025,8 +997,7 @@ fetch_register (struct regcache *regcache, int tid, int regno)
gdb_assert (tdep->have_htm_altivec);
const struct regset *cvmxregset = ppc_linux_cvmxregset (gdbarch);
- fetch_regset (regcache, tid, NT_PPC_TM_CVMX,
- PPC_LINUX_SIZEOF_CVMXREGSET,
+ fetch_regset (regcache, tid, NT_PPC_TM_CVMX, PPC_LINUX_SIZEOF_CVMXREGSET,
cvmxregset);
return;
}
@@ -1034,8 +1005,7 @@ fetch_register (struct regcache *regcache, int tid, int regno)
{
gdb_assert (tdep->have_htm_vsx);
- fetch_regset (regcache, tid, NT_PPC_TM_CVSX,
- PPC_LINUX_SIZEOF_CVSXREGSET,
+ fetch_regset (regcache, tid, NT_PPC_TM_CVSX, PPC_LINUX_SIZEOF_CVSXREGSET,
&ppc32_linux_cvsxregset);
return;
}
@@ -1043,8 +1013,7 @@ fetch_register (struct regcache *regcache, int tid, int regno)
{
gdb_assert (tdep->ppc_cppr_regnum != -1);
- fetch_regset (regcache, tid, NT_PPC_TM_CPPR,
- PPC_LINUX_SIZEOF_CPPRREGSET,
+ fetch_regset (regcache, tid, NT_PPC_TM_CPPR, PPC_LINUX_SIZEOF_CPPRREGSET,
&ppc32_linux_cpprregset);
return;
}
@@ -1053,23 +1022,21 @@ fetch_register (struct regcache *regcache, int tid, int regno)
gdb_assert (tdep->ppc_cdscr_regnum != -1);
fetch_regset (regcache, tid, NT_PPC_TM_CDSCR,
- PPC_LINUX_SIZEOF_CDSCRREGSET,
- &ppc32_linux_cdscrregset);
+ PPC_LINUX_SIZEOF_CDSCRREGSET, &ppc32_linux_cdscrregset);
return;
}
else if (regno == PPC_CTAR_REGNUM)
{
gdb_assert (tdep->ppc_ctar_regnum != -1);
- fetch_regset (regcache, tid, NT_PPC_TM_CTAR,
- PPC_LINUX_SIZEOF_CTARREGSET,
+ fetch_regset (regcache, tid, NT_PPC_TM_CTAR, PPC_LINUX_SIZEOF_CTARREGSET,
&ppc32_linux_ctarregset);
return;
}
if (regaddr == -1)
{
- memset (buf, '\0', register_size (gdbarch, regno)); /* Supply zeroes */
+ memset (buf, '\0', register_size (gdbarch, regno)); /* Supply zeroes */
regcache->raw_supply (regno, buf);
return;
}
@@ -1112,8 +1079,8 @@ fetch_register (struct regcache *regcache, int tid, int regno)
size_t padding = (bytes_transferred - register_size (gdbarch, regno));
regcache->raw_supply (regno, buf + padding);
}
- else
- internal_error (_("fetch_register: unexpected byte order: %d"),
+ else
+ internal_error (_ ("fetch_register: unexpected byte order: %d"),
gdbarch_byte_order (gdbarch));
}
@@ -1137,7 +1104,7 @@ fetch_all_gp_regs (struct regcache *regcache, int tid)
have_ptrace_getsetregs = 0;
return 0;
}
- perror_with_name (_("Couldn't get general-purpose registers"));
+ perror_with_name (_ ("Couldn't get general-purpose registers"));
}
supply_gregset (regcache, (const gdb_gregset_t *) &gregset);
@@ -1189,7 +1156,7 @@ fetch_all_fp_regs (struct regcache *regcache, int tid)
have_ptrace_getsetfpregs = 0;
return 0;
}
- perror_with_name (_("Couldn't get floating-point registers"));
+ perror_with_name (_ ("Couldn't get floating-point registers"));
}
supply_fpregset (regcache, (const gdb_fpregset_t *) &fpregs);
@@ -1213,7 +1180,7 @@ fetch_fp_regs (struct regcache *regcache, int tid)
if (have_ptrace_getsetfpregs)
if (fetch_all_fp_regs (regcache, tid))
return;
-
+
/* If we've hit this point, it doesn't really matter which
architecture we are using. We just need to read the
registers in the "old-fashioned way". */
@@ -1221,7 +1188,7 @@ fetch_fp_regs (struct regcache *regcache, int tid)
fetch_register (regcache, tid, tdep->ppc_fp0_regnum + i);
}
-static void
+static void
fetch_ppc_registers (struct regcache *regcache, int tid)
{
struct gdbarch *gdbarch = regcache->arch ();
@@ -1259,64 +1226,51 @@ fetch_ppc_registers (struct regcache *regcache, int tid)
if (tdep->ppc_ev0_upper_regnum >= 0)
fetch_spe_register (regcache, tid, -1);
if (tdep->ppc_ppr_regnum != -1)
- fetch_regset (regcache, tid, NT_PPC_PPR,
- PPC_LINUX_SIZEOF_PPRREGSET,
+ fetch_regset (regcache, tid, NT_PPC_PPR, PPC_LINUX_SIZEOF_PPRREGSET,
&ppc32_linux_pprregset);
if (tdep->ppc_dscr_regnum != -1)
- fetch_regset (regcache, tid, NT_PPC_DSCR,
- PPC_LINUX_SIZEOF_DSCRREGSET,
+ fetch_regset (regcache, tid, NT_PPC_DSCR, PPC_LINUX_SIZEOF_DSCRREGSET,
&ppc32_linux_dscrregset);
if (tdep->ppc_tar_regnum != -1)
- fetch_regset (regcache, tid, NT_PPC_TAR,
- PPC_LINUX_SIZEOF_TARREGSET,
+ fetch_regset (regcache, tid, NT_PPC_TAR, PPC_LINUX_SIZEOF_TARREGSET,
&ppc32_linux_tarregset);
if (tdep->have_ebb)
- fetch_regset (regcache, tid, NT_PPC_EBB,
- PPC_LINUX_SIZEOF_EBBREGSET,
+ fetch_regset (regcache, tid, NT_PPC_EBB, PPC_LINUX_SIZEOF_EBBREGSET,
&ppc32_linux_ebbregset);
if (tdep->ppc_mmcr0_regnum != -1)
- fetch_regset (regcache, tid, NT_PPC_PMU,
- PPC_LINUX_SIZEOF_PMUREGSET,
+ fetch_regset (regcache, tid, NT_PPC_PMU, PPC_LINUX_SIZEOF_PMUREGSET,
&ppc32_linux_pmuregset);
if (tdep->have_htm_spr)
- fetch_regset (regcache, tid, NT_PPC_TM_SPR,
- PPC_LINUX_SIZEOF_TM_SPRREGSET,
+ fetch_regset (regcache, tid, NT_PPC_TM_SPR, PPC_LINUX_SIZEOF_TM_SPRREGSET,
&ppc32_linux_tm_sprregset);
if (tdep->have_htm_core)
{
const struct regset *cgprregset = ppc_linux_cgprregset (gdbarch);
fetch_regset (regcache, tid, NT_PPC_TM_CGPR,
- (tdep->wordsize == 4?
- PPC32_LINUX_SIZEOF_CGPRREGSET
- : PPC64_LINUX_SIZEOF_CGPRREGSET),
+ (tdep->wordsize == 4 ? PPC32_LINUX_SIZEOF_CGPRREGSET
+ : PPC64_LINUX_SIZEOF_CGPRREGSET),
cgprregset);
}
if (tdep->have_htm_fpu)
- fetch_regset (regcache, tid, NT_PPC_TM_CFPR,
- PPC_LINUX_SIZEOF_CFPRREGSET,
+ fetch_regset (regcache, tid, NT_PPC_TM_CFPR, PPC_LINUX_SIZEOF_CFPRREGSET,
&ppc32_linux_cfprregset);
if (tdep->have_htm_altivec)
{
const struct regset *cvmxregset = ppc_linux_cvmxregset (gdbarch);
- fetch_regset (regcache, tid, NT_PPC_TM_CVMX,
- PPC_LINUX_SIZEOF_CVMXREGSET,
+ fetch_regset (regcache, tid, NT_PPC_TM_CVMX, PPC_LINUX_SIZEOF_CVMXREGSET,
cvmxregset);
}
if (tdep->have_htm_vsx)
- fetch_regset (regcache, tid, NT_PPC_TM_CVSX,
- PPC_LINUX_SIZEOF_CVSXREGSET,
+ fetch_regset (regcache, tid, NT_PPC_TM_CVSX, PPC_LINUX_SIZEOF_CVSXREGSET,
&ppc32_linux_cvsxregset);
if (tdep->ppc_cppr_regnum != -1)
- fetch_regset (regcache, tid, NT_PPC_TM_CPPR,
- PPC_LINUX_SIZEOF_CPPRREGSET,
+ fetch_regset (regcache, tid, NT_PPC_TM_CPPR, PPC_LINUX_SIZEOF_CPPRREGSET,
&ppc32_linux_cpprregset);
if (tdep->ppc_cdscr_regnum != -1)
- fetch_regset (regcache, tid, NT_PPC_TM_CDSCR,
- PPC_LINUX_SIZEOF_CDSCRREGSET,
+ fetch_regset (regcache, tid, NT_PPC_TM_CDSCR, PPC_LINUX_SIZEOF_CDSCRREGSET,
&ppc32_linux_cdscrregset);
if (tdep->ppc_ctar_regnum != -1)
- fetch_regset (regcache, tid, NT_PPC_TM_CTAR,
- PPC_LINUX_SIZEOF_CTARREGSET,
+ fetch_regset (regcache, tid, NT_PPC_TM_CTAR, PPC_LINUX_SIZEOF_CTARREGSET,
&ppc32_linux_ctarregset);
}
@@ -1330,7 +1284,7 @@ ppc_linux_nat_target::fetch_registers (struct regcache *regcache, int regno)
if (regno == -1)
fetch_ppc_registers (regcache, tid);
- else
+ else
fetch_register (regcache, tid, regno);
}
@@ -1349,7 +1303,7 @@ store_vsx_registers (const struct regcache *regcache, int tid, int regno)
have_ptrace_getsetvsxregs = 0;
return;
}
- perror_with_name (_("Unable to fetch VSX registers"));
+ perror_with_name (_ ("Unable to fetch VSX registers"));
}
vsxregset->collect_regset (vsxregset, regcache, regno, &regs,
@@ -1357,12 +1311,11 @@ store_vsx_registers (const struct regcache *regcache, int tid, int regno)
ret = ptrace (PTRACE_SETVSXREGS, tid, 0, &regs);
if (ret < 0)
- perror_with_name (_("Unable to store VSX registers"));
+ perror_with_name (_ ("Unable to store VSX registers"));
}
static void
-store_altivec_registers (const struct regcache *regcache, int tid,
- int regno)
+store_altivec_registers (const struct regcache *regcache, int tid, int regno)
{
int ret;
gdb_vrregset_t regs;
@@ -1377,7 +1330,7 @@ store_altivec_registers (const struct regcache *regcache, int tid,
have_ptrace_getvrregs = 0;
return;
}
- perror_with_name (_("Unable to fetch AltiVec registers"));
+ perror_with_name (_ ("Unable to fetch AltiVec registers"));
}
vrregset->collect_regset (vrregset, regcache, regno, &regs,
@@ -1385,7 +1338,7 @@ store_altivec_registers (const struct regcache *regcache, int tid,
ret = ptrace (PTRACE_SETVRREGS, tid, 0, &regs);
if (ret < 0)
- perror_with_name (_("Unable to store AltiVec registers"));
+ perror_with_name (_ ("Unable to store AltiVec registers"));
}
/* Assuming TID refers to an SPE process, set the top halves of TID's
@@ -1412,7 +1365,7 @@ set_spe_registers (int tid, struct gdb_evrregset_t *evrregset)
have_ptrace_getsetevrregs = 0;
else
/* Anything else needs to be reported. */
- perror_with_name (_("Unable to set SPE registers"));
+ perror_with_name (_ ("Unable to set SPE registers"));
}
}
}
@@ -1458,15 +1411,11 @@ store_spe_register (const struct regcache *regcache, int tid, int regno)
regcache->raw_collect (regno,
&evrregs.evr[regno - tdep->ppc_ev0_upper_regnum]);
- if (regno == -1
- || regno == tdep->ppc_acc_regnum)
- regcache->raw_collect (tdep->ppc_acc_regnum,
- &evrregs.acc);
+ if (regno == -1 || regno == tdep->ppc_acc_regnum)
+ regcache->raw_collect (tdep->ppc_acc_regnum, &evrregs.acc);
- if (regno == -1
- || regno == tdep->ppc_spefscr_regnum)
- regcache->raw_collect (tdep->ppc_spefscr_regnum,
- &evrregs.spefscr);
+ if (regno == -1 || regno == tdep->ppc_spefscr_regnum)
+ regcache->raw_collect (tdep->ppc_spefscr_regnum, &evrregs.spefscr);
/* Write back the modified register set. */
set_spe_registers (tid, &evrregs);
@@ -1503,8 +1452,7 @@ store_register (const struct regcache *regcache, int tid, int regno)
gdb_assert (tdep->ppc_dscr_regnum != -1);
store_regset (regcache, tid, regno, NT_PPC_DSCR,
- PPC_LINUX_SIZEOF_DSCRREGSET,
- &ppc32_linux_dscrregset);
+ PPC_LINUX_SIZEOF_DSCRREGSET, &ppc32_linux_dscrregset);
return;
}
else if (regno == PPC_PPR_REGNUM)
@@ -1512,8 +1460,7 @@ store_register (const struct regcache *regcache, int tid, int regno)
gdb_assert (tdep->ppc_ppr_regnum != -1);
store_regset (regcache, tid, regno, NT_PPC_PPR,
- PPC_LINUX_SIZEOF_PPRREGSET,
- &ppc32_linux_pprregset);
+ PPC_LINUX_SIZEOF_PPRREGSET, &ppc32_linux_pprregset);
return;
}
else if (regno == PPC_TAR_REGNUM)
@@ -1521,8 +1468,7 @@ store_register (const struct regcache *regcache, int tid, int regno)
gdb_assert (tdep->ppc_tar_regnum != -1);
store_regset (regcache, tid, regno, NT_PPC_TAR,
- PPC_LINUX_SIZEOF_TARREGSET,
- &ppc32_linux_tarregset);
+ PPC_LINUX_SIZEOF_TARREGSET, &ppc32_linux_tarregset);
return;
}
else if (PPC_IS_EBB_REGNUM (regno))
@@ -1530,8 +1476,7 @@ store_register (const struct regcache *regcache, int tid, int regno)
gdb_assert (tdep->have_ebb);
store_regset (regcache, tid, regno, NT_PPC_EBB,
- PPC_LINUX_SIZEOF_EBBREGSET,
- &ppc32_linux_ebbregset);
+ PPC_LINUX_SIZEOF_EBBREGSET, &ppc32_linux_ebbregset);
return;
}
else if (PPC_IS_PMU_REGNUM (regno))
@@ -1539,8 +1484,7 @@ store_register (const struct regcache *regcache, int tid, int regno)
gdb_assert (tdep->ppc_mmcr0_regnum != -1);
store_regset (regcache, tid, regno, NT_PPC_PMU,
- PPC_LINUX_SIZEOF_PMUREGSET,
- &ppc32_linux_pmuregset);
+ PPC_LINUX_SIZEOF_PMUREGSET, &ppc32_linux_pmuregset);
return;
}
else if (PPC_IS_TMSPR_REGNUM (regno))
@@ -1548,8 +1492,7 @@ store_register (const struct regcache *regcache, int tid, int regno)
gdb_assert (tdep->have_htm_spr);
store_regset (regcache, tid, regno, NT_PPC_TM_SPR,
- PPC_LINUX_SIZEOF_TM_SPRREGSET,
- &ppc32_linux_tm_sprregset);
+ PPC_LINUX_SIZEOF_TM_SPRREGSET, &ppc32_linux_tm_sprregset);
return;
}
else if (PPC_IS_CKPTGP_REGNUM (regno))
@@ -1558,9 +1501,8 @@ store_register (const struct regcache *regcache, int tid, int regno)
const struct regset *cgprregset = ppc_linux_cgprregset (gdbarch);
store_regset (regcache, tid, regno, NT_PPC_TM_CGPR,
- (tdep->wordsize == 4?
- PPC32_LINUX_SIZEOF_CGPRREGSET
- : PPC64_LINUX_SIZEOF_CGPRREGSET),
+ (tdep->wordsize == 4 ? PPC32_LINUX_SIZEOF_CGPRREGSET
+ : PPC64_LINUX_SIZEOF_CGPRREGSET),
cgprregset);
return;
}
@@ -1569,8 +1511,7 @@ store_register (const struct regcache *regcache, int tid, int regno)
gdb_assert (tdep->have_htm_fpu);
store_regset (regcache, tid, regno, NT_PPC_TM_CFPR,
- PPC_LINUX_SIZEOF_CFPRREGSET,
- &ppc32_linux_cfprregset);
+ PPC_LINUX_SIZEOF_CFPRREGSET, &ppc32_linux_cfprregset);
return;
}
else if (PPC_IS_CKPTVMX_REGNUM (regno))
@@ -1579,8 +1520,7 @@ store_register (const struct regcache *regcache, int tid, int regno)
const struct regset *cvmxregset = ppc_linux_cvmxregset (gdbarch);
store_regset (regcache, tid, regno, NT_PPC_TM_CVMX,
- PPC_LINUX_SIZEOF_CVMXREGSET,
- cvmxregset);
+ PPC_LINUX_SIZEOF_CVMXREGSET, cvmxregset);
return;
}
else if (PPC_IS_CKPTVSX_REGNUM (regno))
@@ -1588,8 +1528,7 @@ store_register (const struct regcache *regcache, int tid, int regno)
gdb_assert (tdep->have_htm_vsx);
store_regset (regcache, tid, regno, NT_PPC_TM_CVSX,
- PPC_LINUX_SIZEOF_CVSXREGSET,
- &ppc32_linux_cvsxregset);
+ PPC_LINUX_SIZEOF_CVSXREGSET, &ppc32_linux_cvsxregset);
return;
}
else if (regno == PPC_CPPR_REGNUM)
@@ -1597,8 +1536,7 @@ store_register (const struct regcache *regcache, int tid, int regno)
gdb_assert (tdep->ppc_cppr_regnum != -1);
store_regset (regcache, tid, regno, NT_PPC_TM_CPPR,
- PPC_LINUX_SIZEOF_CPPRREGSET,
- &ppc32_linux_cpprregset);
+ PPC_LINUX_SIZEOF_CPPRREGSET, &ppc32_linux_cpprregset);
return;
}
else if (regno == PPC_CDSCR_REGNUM)
@@ -1606,8 +1544,7 @@ store_register (const struct regcache *regcache, int tid, int regno)
gdb_assert (tdep->ppc_cdscr_regnum != -1);
store_regset (regcache, tid, regno, NT_PPC_TM_CDSCR,
- PPC_LINUX_SIZEOF_CDSCRREGSET,
- &ppc32_linux_cdscrregset);
+ PPC_LINUX_SIZEOF_CDSCRREGSET, &ppc32_linux_cdscrregset);
return;
}
else if (regno == PPC_CTAR_REGNUM)
@@ -1615,8 +1552,7 @@ store_register (const struct regcache *regcache, int tid, int regno)
gdb_assert (tdep->ppc_ctar_regnum != -1);
store_regset (regcache, tid, regno, NT_PPC_TM_CTAR,
- PPC_LINUX_SIZEOF_CTARREGSET,
- &ppc32_linux_ctarregset);
+ PPC_LINUX_SIZEOF_CTARREGSET, &ppc32_linux_ctarregset);
return;
}
@@ -1649,9 +1585,8 @@ store_register (const struct regcache *regcache, int tid, int regno)
ptrace (PTRACE_POKEUSER, tid, (PTRACE_TYPE_ARG3) regaddr, l);
regaddr += sizeof (long);
- if (errno == EIO
- && (regno == tdep->ppc_fpscr_regnum
- || regno == PPC_ORIG_R3_REGNUM
+ if (errno == EIO
+ && (regno == tdep->ppc_fpscr_regnum || regno == PPC_ORIG_R3_REGNUM
|| regno == PPC_TRAP_REGNUM))
{
/* Some older kernel versions don't allow fpscr, orig_r3
@@ -1689,7 +1624,7 @@ store_all_gp_regs (const struct regcache *regcache, int tid, int regno)
have_ptrace_getsetregs = 0;
return 0;
}
- perror_with_name (_("Couldn't get general-purpose registers"));
+ perror_with_name (_ ("Couldn't get general-purpose registers"));
}
fill_gregset (regcache, &gregset, regno);
@@ -1701,7 +1636,7 @@ store_all_gp_regs (const struct regcache *regcache, int tid, int regno)
have_ptrace_getsetregs = 0;
return 0;
}
- perror_with_name (_("Couldn't set general-purpose registers"));
+ perror_with_name (_ ("Couldn't set general-purpose registers"));
}
return 1;
@@ -1751,7 +1686,7 @@ store_all_fp_regs (const struct regcache *regcache, int tid, int regno)
have_ptrace_getsetfpregs = 0;
return 0;
}
- perror_with_name (_("Couldn't get floating-point registers"));
+ perror_with_name (_ ("Couldn't get floating-point registers"));
}
fill_fpregset (regcache, &fpregs, regno);
@@ -1763,7 +1698,7 @@ store_all_fp_regs (const struct regcache *regcache, int tid, int regno)
have_ptrace_getsetfpregs = 0;
return 0;
}
- perror_with_name (_("Couldn't set floating-point registers"));
+ perror_with_name (_ ("Couldn't set floating-point registers"));
}
return 1;
@@ -1798,7 +1733,7 @@ store_ppc_registers (const struct regcache *regcache, int tid)
{
struct gdbarch *gdbarch = regcache->arch ();
ppc_gdbarch_tdep *tdep = gdbarch_tdep<ppc_gdbarch_tdep> (gdbarch);
-
+
store_gp_regs (regcache, tid, -1);
if (tdep->ppc_fp0_regnum >= 0)
store_fp_regs (regcache, tid, -1);
@@ -1831,27 +1766,22 @@ store_ppc_registers (const struct regcache *regcache, int tid)
if (tdep->ppc_ev0_upper_regnum >= 0)
store_spe_register (regcache, tid, -1);
if (tdep->ppc_ppr_regnum != -1)
- store_regset (regcache, tid, -1, NT_PPC_PPR,
- PPC_LINUX_SIZEOF_PPRREGSET,
+ store_regset (regcache, tid, -1, NT_PPC_PPR, PPC_LINUX_SIZEOF_PPRREGSET,
&ppc32_linux_pprregset);
if (tdep->ppc_dscr_regnum != -1)
- store_regset (regcache, tid, -1, NT_PPC_DSCR,
- PPC_LINUX_SIZEOF_DSCRREGSET,
+ store_regset (regcache, tid, -1, NT_PPC_DSCR, PPC_LINUX_SIZEOF_DSCRREGSET,
&ppc32_linux_dscrregset);
if (tdep->ppc_tar_regnum != -1)
- store_regset (regcache, tid, -1, NT_PPC_TAR,
- PPC_LINUX_SIZEOF_TARREGSET,
+ store_regset (regcache, tid, -1, NT_PPC_TAR, PPC_LINUX_SIZEOF_TARREGSET,
&ppc32_linux_tarregset);
if (tdep->ppc_mmcr0_regnum != -1)
- store_regset (regcache, tid, -1, NT_PPC_PMU,
- PPC_LINUX_SIZEOF_PMUREGSET,
+ store_regset (regcache, tid, -1, NT_PPC_PMU, PPC_LINUX_SIZEOF_PMUREGSET,
&ppc32_linux_pmuregset);
if (tdep->have_htm_spr)
store_regset (regcache, tid, -1, NT_PPC_TM_SPR,
- PPC_LINUX_SIZEOF_TM_SPRREGSET,
- &ppc32_linux_tm_sprregset);
+ PPC_LINUX_SIZEOF_TM_SPRREGSET, &ppc32_linux_tm_sprregset);
/* Because the EBB and checkpointed HTM registers can be
unavailable, attempts to store them here would cause this
@@ -1884,8 +1814,8 @@ supply_gregset (struct regcache *regcache, const gdb_gregset_t *gregsetp)
}
void
-fill_gregset (const struct regcache *regcache,
- gdb_gregset_t *gregsetp, int regno)
+fill_gregset (const struct regcache *regcache, gdb_gregset_t *gregsetp,
+ int regno)
{
const struct regset *regset = ppc_linux_gregset (sizeof (long));
@@ -1895,22 +1825,21 @@ fill_gregset (const struct regcache *regcache,
}
void
-supply_fpregset (struct regcache *regcache, const gdb_fpregset_t * fpregsetp)
+supply_fpregset (struct regcache *regcache, const gdb_fpregset_t *fpregsetp)
{
const struct regset *regset = ppc_linux_fpregset ();
- ppc_supply_fpregset (regset, regcache, -1,
- fpregsetp, sizeof (*fpregsetp));
+ ppc_supply_fpregset (regset, regcache, -1, fpregsetp, sizeof (*fpregsetp));
}
void
-fill_fpregset (const struct regcache *regcache,
- gdb_fpregset_t *fpregsetp, int regno)
+fill_fpregset (const struct regcache *regcache, gdb_fpregset_t *fpregsetp,
+ int regno)
{
const struct regset *regset = ppc_linux_fpregset ();
- ppc_collect_fpregset (regset, regcache, regno,
- fpregsetp, sizeof (*fpregsetp));
+ ppc_collect_fpregset (regset, regcache, regno, fpregsetp,
+ sizeof (*fpregsetp));
}
int
@@ -1957,7 +1886,7 @@ ppc_linux_nat_target::read_description ()
/* EIO means that the PTRACE_GETEVRREGS request isn't supported.
Anything else needs to be reported. */
else if (errno != EIO)
- perror_with_name (_("Unable to fetch SPE registers"));
+ perror_with_name (_ ("Unable to fetch SPE registers"));
}
struct ppc_linux_features features = ppc_linux_no_features;
@@ -1967,8 +1896,7 @@ ppc_linux_nat_target::read_description ()
CORE_ADDR hwcap = linux_get_hwcap ();
CORE_ADDR hwcap2 = linux_get_hwcap2 ();
- if (have_ptrace_getsetvsxregs
- && (hwcap & PPC_FEATURE_HAS_VSX))
+ if (have_ptrace_getsetvsxregs && (hwcap & PPC_FEATURE_HAS_VSX))
{
gdb_vsxregset_t vsxregset;
@@ -1978,11 +1906,10 @@ ppc_linux_nat_target::read_description ()
/* EIO means that the PTRACE_GETVSXREGS request isn't supported.
Anything else needs to be reported. */
else if (errno != EIO)
- perror_with_name (_("Unable to fetch VSX registers"));
+ perror_with_name (_ ("Unable to fetch VSX registers"));
}
- if (have_ptrace_getvrregs
- && (hwcap & PPC_FEATURE_HAS_ALTIVEC))
+ if (have_ptrace_getvrregs && (hwcap & PPC_FEATURE_HAS_ALTIVEC))
{
gdb_vrregset_t vrregset;
@@ -1992,7 +1919,7 @@ ppc_linux_nat_target::read_description ()
/* EIO means that the PTRACE_GETVRREGS request isn't supported.
Anything else needs to be reported. */
else if (errno != EIO)
- perror_with_name (_("Unable to fetch AltiVec registers"));
+ perror_with_name (_ ("Unable to fetch AltiVec registers"));
}
features.isa205 = ppc_linux_has_isa205 (hwcap);
@@ -2002,8 +1929,7 @@ ppc_linux_nat_target::read_description ()
&& check_regset (tid, NT_PPC_DSCR, PPC_LINUX_SIZEOF_DSCRREGSET))
{
features.ppr_dscr = true;
- if ((hwcap2 & PPC_FEATURE2_ARCH_2_07)
- && (hwcap2 & PPC_FEATURE2_TAR)
+ if ((hwcap2 & PPC_FEATURE2_ARCH_2_07) && (hwcap2 & PPC_FEATURE2_TAR)
&& (hwcap2 & PPC_FEATURE2_EBB)
&& check_regset (tid, NT_PPC_TAR, PPC_LINUX_SIZEOF_TARREGSET)
&& check_regset (tid, NT_PPC_EBB, PPC_LINUX_SIZEOF_EBBREGSET)
@@ -2040,8 +1966,7 @@ ppc_linux_nat_target::read_description ()
watchpoint or breakpoint. See the description in target.h. */
int
-ppc_linux_nat_target::can_use_hw_breakpoint (enum bptype type, int cnt,
- int ot)
+ppc_linux_nat_target::can_use_hw_breakpoint (enum bptype type, int cnt, int ot)
{
int total_hw_wp, total_hw_bp;
@@ -2111,8 +2036,8 @@ ppc_linux_nat_target::region_ok_for_hw_watchpoint (CORE_ADDR addr, int len)
watchpoints. */
if (m_dreg_interface.hwdebug_p ())
{
- const struct ppc_debug_info &hwdebug_info = (m_dreg_interface
- .hwdebug_info ());
+ const struct ppc_debug_info &hwdebug_info
+ = (m_dreg_interface.hwdebug_info ());
int region_size = hwdebug_info.data_bp_alignment;
int region_align = region_size;
@@ -2120,8 +2045,7 @@ ppc_linux_nat_target::region_ok_for_hw_watchpoint (CORE_ADDR addr, int len)
watchpoints and can watch any access within an arbitrary memory
region. This is useful to watch arrays and structs, for instance. It
takes two hardware watchpoints though. */
- if (len > 1
- && hwdebug_info.features & PPC_DEBUG_FEATURE_DATA_BP_RANGE
+ if (len > 1 && hwdebug_info.features & PPC_DEBUG_FEATURE_DATA_BP_RANGE
&& (linux_get_hwcap () & PPC_FEATURE_BOOKE))
return 2;
/* Check if the processor provides DAWR interface. */
@@ -2166,12 +2090,9 @@ bool
ppc_linux_nat_target::hwdebug_point_cmp (const struct ppc_hw_breakpoint &a,
const struct ppc_hw_breakpoint &b)
{
- return (a.trigger_type == b.trigger_type
- && a.addr_mode == b.addr_mode
- && a.condition_mode == b.condition_mode
- && a.addr == b.addr
- && a.addr2 == b.addr2
- && a.condition_value == b.condition_value);
+ return (a.trigger_type == b.trigger_type && a.addr_mode == b.addr_mode
+ && a.condition_mode == b.condition_mode && a.addr == b.addr
+ && a.addr2 == b.addr2 && a.condition_value == b.condition_value);
}
/* Return the number of registers needed for a ranged breakpoint. */
@@ -2183,8 +2104,9 @@ ppc_linux_nat_target::ranged_break_num_registers ()
return ((m_dreg_interface.hwdebug_p ()
&& (m_dreg_interface.hwdebug_info ().features
- & PPC_DEBUG_FEATURE_INSN_BP_RANGE))?
- 2 : -1);
+ & PPC_DEBUG_FEATURE_INSN_BP_RANGE))
+ ? 2
+ : -1);
}
/* Register the hardware breakpoint described by BP_TGT, to be inserted
@@ -2293,7 +2215,7 @@ ppc_linux_nat_target::get_trigger_type (enum target_hw_bp_type type)
hw_access for an access watchpoint. */
int
-ppc_linux_nat_target::insert_mask_watchpoint (CORE_ADDR addr, CORE_ADDR mask,
+ppc_linux_nat_target::insert_mask_watchpoint (CORE_ADDR addr, CORE_ADDR mask,
target_hw_bp_type rw)
{
struct ppc_hw_breakpoint p;
@@ -2387,11 +2309,11 @@ ppc_linux_nat_target::calculate_dvc (CORE_ADDR addr, int len,
uint32_t *condition_mode,
uint64_t *condition_value)
{
- const struct ppc_debug_info &hwdebug_info = (m_dreg_interface.
- hwdebug_info ());
+ const struct ppc_debug_info &hwdebug_info
+ = (m_dreg_interface.hwdebug_info ());
int i, num_byte_enable, align_offset, num_bytes_off_dvc,
- rightmost_enabled_byte;
+ rightmost_enabled_byte;
CORE_ADDR addr_end_data, addr_end_dvc;
/* The DVC register compares bytes within fixed-length windows which
@@ -2401,14 +2323,13 @@ ppc_linux_nat_target::calculate_dvc (CORE_ADDR addr, int len,
align_offset = addr % hwdebug_info.sizeof_condition;
addr_end_data = addr + len;
- addr_end_dvc = (addr - align_offset
- + hwdebug_info.sizeof_condition);
- num_bytes_off_dvc = (addr_end_data > addr_end_dvc)?
- addr_end_data - addr_end_dvc : 0;
+ addr_end_dvc = (addr - align_offset + hwdebug_info.sizeof_condition);
+ num_bytes_off_dvc
+ = (addr_end_data > addr_end_dvc) ? addr_end_data - addr_end_dvc : 0;
num_byte_enable = len - num_bytes_off_dvc;
/* Here, bytes are numbered from right to left. */
- rightmost_enabled_byte = (addr_end_data < addr_end_dvc)?
- addr_end_dvc - addr_end_data : 0;
+ rightmost_enabled_byte
+ = (addr_end_data < addr_end_dvc) ? addr_end_dvc - addr_end_data : 0;
*condition_mode = PPC_BREAKPOINT_CONDITION_AND;
for (i = 0; i < num_byte_enable; i++)
@@ -2419,8 +2340,8 @@ ppc_linux_nat_target::calculate_dvc (CORE_ADDR addr, int len,
value with where the watch region is relative to the window
(i.e., the ALIGN_OFFSET). */
- *condition_value = ((uint64_t) data_value >> num_bytes_off_dvc * 8
- << rightmost_enabled_byte * 8);
+ *condition_value = ((uint64_t) data_value
+ >> num_bytes_off_dvc * 8 << rightmost_enabled_byte * 8);
}
/* Return the number of memory locations that need to be accessed to
@@ -2430,8 +2351,8 @@ ppc_linux_nat_target::calculate_dvc (CORE_ADDR addr, int len,
expression (e.g., lval_computed or lval_internalvar). */
int
-ppc_linux_nat_target::num_memory_accesses (const std::vector<value_ref_ptr>
- &chain)
+ppc_linux_nat_target::num_memory_accesses (
+ const std::vector<value_ref_ptr> &chain)
{
int found_memory_cnt = 0;
@@ -2539,8 +2460,8 @@ ppc_linux_nat_target::check_condition (CORE_ADDR watch_addr,
true. */
bool
-ppc_linux_nat_target::can_accel_watchpoint_condition (CORE_ADDR addr,
- int len, int rw,
+ppc_linux_nat_target::can_accel_watchpoint_condition (CORE_ADDR addr, int len,
+ int rw,
struct expression *cond)
{
CORE_ADDR data_value;
@@ -2564,19 +2485,18 @@ ppc_linux_nat_target::create_watchpoint_request (struct ppc_hw_breakpoint *p,
struct expression *cond,
int insert)
{
- const struct ppc_debug_info &hwdebug_info = (m_dreg_interface
- .hwdebug_info ());
+ const struct ppc_debug_info &hwdebug_info
+ = (m_dreg_interface.hwdebug_info ());
- if (len == 1
- || !(hwdebug_info.features & PPC_DEBUG_FEATURE_DATA_BP_RANGE))
+ if (len == 1 || !(hwdebug_info.features & PPC_DEBUG_FEATURE_DATA_BP_RANGE))
{
int use_condition;
CORE_ADDR data_value;
- use_condition = (insert? can_use_watchpoint_cond_accel ()
- : hwdebug_info.num_condition_regs > 0);
- if (cond && use_condition && check_condition (addr, cond,
- &data_value, &len))
+ use_condition = (insert ? can_use_watchpoint_cond_accel ()
+ : hwdebug_info.num_condition_regs > 0);
+ if (cond && use_condition
+ && check_condition (addr, cond, &data_value, &len))
calculate_dvc (addr, len, data_value, &p->condition_mode,
&p->condition_value);
else
@@ -2655,18 +2575,18 @@ ppc_linux_nat_target::insert_watchpoint (CORE_ADDR addr, int len,
wp_value = addr & ~(read_mode | write_mode);
switch (type)
{
- case hw_read:
- /* Set read and translate bits. */
- wp_value |= read_mode;
- break;
- case hw_write:
- /* Set write and translate bits. */
- wp_value |= write_mode;
- break;
- case hw_access:
- /* Set read, write and translate bits. */
- wp_value |= read_mode | write_mode;
- break;
+ case hw_read:
+ /* Set read and translate bits. */
+ wp_value |= read_mode;
+ break;
+ case hw_write:
+ /* Set write and translate bits. */
+ wp_value |= write_mode;
+ break;
+ case hw_access:
+ /* Set read, write and translate bits. */
+ wp_value |= read_mode | write_mode;
+ break;
}
register_wp (inferior_ptid.pid (), wp_value);
@@ -2715,8 +2635,7 @@ ppc_linux_nat_target::remove_watchpoint (CORE_ADDR addr, int len,
void
ppc_linux_nat_target::low_forget_process (pid_t pid)
{
- if ((!m_dreg_interface.detected_p ())
- || (m_dreg_interface.unavailable_p ()))
+ if ((!m_dreg_interface.detected_p ()) || (m_dreg_interface.unavailable_p ()))
return;
ptid_t pid_ptid (pid, 0, 0);
@@ -2757,11 +2676,9 @@ ppc_linux_nat_target::low_forget_process (pid_t pid)
had at the point when it forked. */
void
-ppc_linux_nat_target::low_new_fork (struct lwp_info *parent,
- pid_t child_pid)
+ppc_linux_nat_target::low_new_fork (struct lwp_info *parent, pid_t child_pid)
{
- if ((!m_dreg_interface.detected_p ())
- || (m_dreg_interface.unavailable_p ()))
+ if ((!m_dreg_interface.detected_p ()) || (m_dreg_interface.unavailable_p ()))
return;
auto process_it = m_process_info.find (parent->ptid.pid ());
@@ -2784,11 +2701,9 @@ ppc_linux_nat_target::low_new_fork (struct lwp_info *parent,
even if it doesn't. */
void
-ppc_linux_nat_target::low_new_clone (struct lwp_info *parent,
- pid_t child_lwp)
+ppc_linux_nat_target::low_new_clone (struct lwp_info *parent, pid_t child_lwp)
{
- if ((!m_dreg_interface.detected_p ())
- || (m_dreg_interface.unavailable_p ()))
+ if ((!m_dreg_interface.detected_p ()) || (m_dreg_interface.unavailable_p ()))
return;
if (m_dreg_interface.hwdebug_p ())
@@ -2815,13 +2730,11 @@ ppc_linux_nat_target::low_new_thread (struct lwp_info *lp)
/* Delete the per-thread debug register stale flag. */
void
-ppc_linux_nat_target::low_delete_thread (struct arch_lwp_info
- *lp_arch_info)
+ppc_linux_nat_target::low_delete_thread (struct arch_lwp_info *lp_arch_info)
{
if (lp_arch_info != NULL)
{
- if (m_dreg_interface.detected_p ()
- && m_dreg_interface.hwdebug_p ())
+ if (m_dreg_interface.detected_p () && m_dreg_interface.hwdebug_p ())
m_installed_hw_bps.erase (lp_arch_info->lwp_ptid);
xfree (lp_arch_info);
@@ -2834,8 +2747,7 @@ ppc_linux_nat_target::low_delete_thread (struct arch_lwp_info
void
ppc_linux_nat_target::low_prepare_to_resume (struct lwp_info *lp)
{
- if ((!m_dreg_interface.detected_p ())
- || (m_dreg_interface.unavailable_p ()))
+ if ((!m_dreg_interface.detected_p ()) || (m_dreg_interface.unavailable_p ()))
return;
/* We have to re-install or clear the debug registers if we set the
@@ -2879,10 +2791,11 @@ ppc_linux_nat_target::low_prepare_to_resume (struct lwp_info *lp)
the debug register state when fork and clone events are
detected. */
if (ptrace (PPC_PTRACE_DELHWDEBUG, lp->ptid.lwp (), 0,
- bp_it->first) < 0)
+ bp_it->first)
+ < 0)
if (errno != ENOENT)
- perror_with_name (_("Error deleting hardware "
- "breakpoint or watchpoint"));
+ perror_with_name (_ ("Error deleting hardware "
+ "breakpoint or watchpoint"));
/* We erase the entries one at a time after successfuly
removing the corresponding slot form the thread so that
@@ -2901,15 +2814,14 @@ ppc_linux_nat_target::low_prepare_to_resume (struct lwp_info *lp)
{
auto &bp_list = m_installed_hw_bps[lp->ptid];
- for (ppc_hw_breakpoint bp
- : process_it->second.requested_hw_bps)
+ for (ppc_hw_breakpoint bp : process_it->second.requested_hw_bps)
{
- long slot = ptrace (PPC_PTRACE_SETHWDEBUG, lp->ptid.lwp (),
- 0, &bp);
+ long slot
+ = ptrace (PPC_PTRACE_SETHWDEBUG, lp->ptid.lwp (), 0, &bp);
if (slot < 0)
- perror_with_name (_("Error setting hardware "
- "breakpoint or watchpoint"));
+ perror_with_name (_ ("Error setting hardware "
+ "breakpoint or watchpoint"));
/* Keep track of which slots we installed in this
thread. */
@@ -2927,7 +2839,7 @@ ppc_linux_nat_target::low_prepare_to_resume (struct lwp_info *lp)
older kernel versions and configurations simply overwriting the
watchpoint after it was hit would not re-enable it. */
if (ptrace (PTRACE_SET_DEBUGREG, lp->ptid.lwp (), 0, 0) < 0)
- perror_with_name (_("Error clearing hardware watchpoint"));
+ perror_with_name (_ ("Error clearing hardware watchpoint"));
/* GDB requested a watchpoint to be installed. */
if (process_it != m_process_info.end ()
@@ -2936,7 +2848,7 @@ ppc_linux_nat_target::low_prepare_to_resume (struct lwp_info *lp)
long wp = *(process_it->second.requested_wp_val);
if (ptrace (PTRACE_SET_DEBUGREG, lp->ptid.lwp (), 0, wp) < 0)
- perror_with_name (_("Error setting hardware watchpoint"));
+ perror_with_name (_ ("Error setting hardware watchpoint"));
}
}
@@ -2979,7 +2891,7 @@ ppc_linux_nat_target::low_stopped_data_address (CORE_ADDR *addr_p)
TRAP_HWBKPT signal. */
gdb_assert (installed_it != m_installed_hw_bps.end ());
- for (const auto & slot_bp_pair : installed_it->second)
+ for (const auto &slot_bp_pair : installed_it->second)
if (slot_bp_pair.first == slot
&& (slot_bp_pair.second.trigger_type
== PPC_BREAKPOINT_TRIGGER_EXECUTE))
@@ -3033,12 +2945,13 @@ ppc_linux_nat_target::masked_watch_num_registers (CORE_ADDR addr,
if (!m_dreg_interface.hwdebug_p ()
|| (m_dreg_interface.hwdebug_info ().features
- & PPC_DEBUG_FEATURE_DATA_BP_MASK) == 0)
+ & PPC_DEBUG_FEATURE_DATA_BP_MASK)
+ == 0)
return -1;
else if ((mask & 0xC0000000) != 0xC0000000)
{
- warning (_("The given mask covers kernel address space "
- "and cannot be used.\n"));
+ warning (_ ("The given mask covers kernel address space "
+ "and cannot be used.\n"));
return -2;
}
@@ -3068,8 +2981,7 @@ ppc_linux_nat_target::copy_thread_dreg_state (const ptid_t &parent_ptid,
void
ppc_linux_nat_target::mark_thread_stale (struct lwp_info *lp)
{
- if ((!m_dreg_interface.detected_p ())
- || (m_dreg_interface.unavailable_p ()))
+ if ((!m_dreg_interface.detected_p ()) || (m_dreg_interface.unavailable_p ()))
return;
arch_lwp_info *lp_arch_info = get_arch_lwp_info (lp);
@@ -3087,18 +2999,16 @@ ppc_linux_nat_target::mark_debug_registers_changed (pid_t pid)
/* We do this in two passes to make sure all threads are marked even if
we get an exception when stopping one of them. */
- iterate_over_lwps (ptid_t (pid),
- [this] (struct lwp_info *lp) -> int {
- this->mark_thread_stale (lp);
- return 0;
- });
+ iterate_over_lwps (ptid_t (pid), [this] (struct lwp_info *lp) -> int {
+ this->mark_thread_stale (lp);
+ return 0;
+ });
- iterate_over_lwps (ptid_t (pid),
- [] (struct lwp_info *lp) -> int {
- if (!lwp_is_stopped (lp))
- linux_stop_lwp (lp);
- return 0;
- });
+ iterate_over_lwps (ptid_t (pid), [] (struct lwp_info *lp) -> int {
+ if (!lwp_is_stopped (lp))
+ linux_stop_lwp (lp);
+ return 0;
+ });
}
/* Register a hardware breakpoint or watchpoint BP for the pid PID, then
@@ -3108,9 +3018,8 @@ ppc_linux_nat_target::mark_debug_registers_changed (pid_t pid)
debug register interface is HWDEBUG. */
void
-ppc_linux_nat_target::register_hw_breakpoint (pid_t pid,
- const struct
- ppc_hw_breakpoint &bp)
+ppc_linux_nat_target::register_hw_breakpoint (
+ pid_t pid, const struct ppc_hw_breakpoint &bp)
{
gdb_assert (m_dreg_interface.hwdebug_p ());
@@ -3135,12 +3044,12 @@ ppc_linux_nat_target::clear_hw_breakpoint (pid_t pid,
gdb_assert (process_it != m_process_info.end ());
- auto bp_it = std::find_if (process_it->second.requested_hw_bps.begin (),
- process_it->second.requested_hw_bps.end (),
- [&bp, this]
- (const struct ppc_hw_breakpoint &curr)
- { return hwdebug_point_cmp (bp, curr); }
- );
+ auto bp_it
+ = std::find_if (process_it->second.requested_hw_bps.begin (),
+ process_it->second.requested_hw_bps.end (),
+ [&bp, this] (const struct ppc_hw_breakpoint &curr) {
+ return hwdebug_point_cmp (bp, curr);
+ });
/* If GDB is removing a watchpoint, it must have been inserted. */
gdb_assert (bp_it != process_it->second.requested_hw_bps.end ());
@@ -3217,6 +3126,7 @@ ppc_linux_nat_target::get_arch_lwp_info (struct lwp_info *lp)
}
void _initialize_ppc_linux_nat ();
+
void
_initialize_ppc_linux_nat ()
{
diff --git a/gdb/ppc-linux-tdep.c b/gdb/ppc-linux-tdep.c
index 918d8aad7da..a6ad8a616be 100644
--- a/gdb/ppc-linux-tdep.c
+++ b/gdb/ppc-linux-tdep.c
@@ -250,7 +250,7 @@ static enum return_value_convention
ppc_linux_return_value (struct gdbarch *gdbarch, struct value *function,
struct type *valtype, struct regcache *regcache,
struct value **read_value, const gdb_byte *writebuf)
-{
+{
gdb_byte *readbuf = nullptr;
if (read_value != nullptr)
{
@@ -269,36 +269,30 @@ ppc_linux_return_value (struct gdbarch *gdbarch, struct value *function,
}
/* PLT stub in an executable. */
-static const struct ppc_insn_pattern powerpc32_plt_stub[] =
- {
- { 0xffff0000, 0x3d600000, 0 }, /* lis r11, xxxx */
- { 0xffff0000, 0x816b0000, 0 }, /* lwz r11, xxxx(r11) */
- { 0xffffffff, 0x7d6903a6, 0 }, /* mtctr r11 */
- { 0xffffffff, 0x4e800420, 0 }, /* bctr */
- { 0, 0, 0 }
- };
+static const struct ppc_insn_pattern powerpc32_plt_stub[]
+ = { { 0xffff0000, 0x3d600000, 0 }, /* lis r11, xxxx */
+ { 0xffff0000, 0x816b0000, 0 }, /* lwz r11, xxxx(r11) */
+ { 0xffffffff, 0x7d6903a6, 0 }, /* mtctr r11 */
+ { 0xffffffff, 0x4e800420, 0 }, /* bctr */
+ { 0, 0, 0 } };
/* PLT stubs in a shared library or PIE.
The first variant is used when the PLT entry is within +/-32k of
the GOT pointer (r30). */
-static const struct ppc_insn_pattern powerpc32_plt_stub_so_1[] =
- {
- { 0xffff0000, 0x817e0000, 0 }, /* lwz r11, xxxx(r30) */
- { 0xffffffff, 0x7d6903a6, 0 }, /* mtctr r11 */
- { 0xffffffff, 0x4e800420, 0 }, /* bctr */
- { 0, 0, 0 }
- };
+static const struct ppc_insn_pattern powerpc32_plt_stub_so_1[]
+ = { { 0xffff0000, 0x817e0000, 0 }, /* lwz r11, xxxx(r30) */
+ { 0xffffffff, 0x7d6903a6, 0 }, /* mtctr r11 */
+ { 0xffffffff, 0x4e800420, 0 }, /* bctr */
+ { 0, 0, 0 } };
/* The second variant is used when the PLT entry is more than +/-32k
from the GOT pointer (r30). */
-static const struct ppc_insn_pattern powerpc32_plt_stub_so_2[] =
- {
- { 0xffff0000, 0x3d7e0000, 0 }, /* addis r11, r30, xxxx */
- { 0xffff0000, 0x816b0000, 0 }, /* lwz r11, xxxx(r11) */
- { 0xffffffff, 0x7d6903a6, 0 }, /* mtctr r11 */
- { 0xffffffff, 0x4e800420, 0 }, /* bctr */
- { 0, 0, 0 }
- };
+static const struct ppc_insn_pattern powerpc32_plt_stub_so_2[]
+ = { { 0xffff0000, 0x3d7e0000, 0 }, /* addis r11, r30, xxxx */
+ { 0xffff0000, 0x816b0000, 0 }, /* lwz r11, xxxx(r11) */
+ { 0xffffffff, 0x7d6903a6, 0 }, /* mtctr r11 */
+ { 0xffffffff, 0x4e800420, 0 }, /* bctr */
+ { 0, 0, 0 } };
/* The max number of insns we check using ppc_insns_match_pattern. */
#define POWERPC32_PLT_CHECK_LEN (ARRAY_SIZE (powerpc32_plt_stub) - 1)
@@ -348,7 +342,7 @@ ppc_skip_trampoline_code (frame_info_ptr frame, CORE_ADDR pc)
/* When reverse-debugging, scan backward to check whether we are
in the middle of trampoline code. */
if (execution_direction == EXEC_REVERSE)
- scan_limit = 4; /* At most 4 instructions. */
+ scan_limit = 4; /* At most 4 instructions. */
for (i = 0; i < scan_limit; i++)
{
@@ -399,8 +393,8 @@ ppc_skip_trampoline_code (frame_info_ptr frame, CORE_ADDR pc)
static void
ppc_linux_supply_gregset (const struct regset *regset,
- struct regcache *regcache,
- int regnum, const void *gregs, size_t len)
+ struct regcache *regcache, int regnum,
+ const void *gregs, size_t len)
{
const struct ppc_reg_offsets *offsets
= (const struct ppc_reg_offsets *) regset->regmap;
@@ -425,8 +419,8 @@ ppc_linux_supply_gregset (const struct regset *regset,
static void
ppc_linux_collect_gregset (const struct regset *regset,
- const struct regcache *regcache,
- int regnum, void *gregs, size_t len)
+ const struct regcache *regcache, int regnum,
+ void *gregs, size_t len)
{
const struct ppc_reg_offsets *offsets
= (const struct ppc_reg_offsets *) regset->regmap;
@@ -454,211 +448,146 @@ ppc_linux_collect_gregset (const struct regset *regset,
}
/* Regset descriptions. */
-static const struct ppc_reg_offsets ppc32_linux_reg_offsets =
- {
- /* General-purpose registers. */
- /* .r0_offset = */ 0,
- /* .gpr_size = */ 4,
- /* .xr_size = */ 4,
- /* .pc_offset = */ 128,
- /* .ps_offset = */ 132,
- /* .cr_offset = */ 152,
- /* .lr_offset = */ 144,
- /* .ctr_offset = */ 140,
- /* .xer_offset = */ 148,
- /* .mq_offset = */ 156,
-
- /* Floating-point registers. */
- /* .f0_offset = */ 0,
- /* .fpscr_offset = */ 256,
- /* .fpscr_size = */ 8
- };
-
-static const struct ppc_reg_offsets ppc64_linux_reg_offsets =
- {
- /* General-purpose registers. */
- /* .r0_offset = */ 0,
- /* .gpr_size = */ 8,
- /* .xr_size = */ 8,
- /* .pc_offset = */ 256,
- /* .ps_offset = */ 264,
- /* .cr_offset = */ 304,
- /* .lr_offset = */ 288,
- /* .ctr_offset = */ 280,
- /* .xer_offset = */ 296,
- /* .mq_offset = */ 312,
-
- /* Floating-point registers. */
- /* .f0_offset = */ 0,
- /* .fpscr_offset = */ 256,
- /* .fpscr_size = */ 8
- };
-
-static const struct regset ppc32_linux_gregset = {
- &ppc32_linux_reg_offsets,
- ppc_linux_supply_gregset,
- ppc_linux_collect_gregset
+static const struct ppc_reg_offsets ppc32_linux_reg_offsets = {
+ /* General-purpose registers. */
+ /* .r0_offset = */ 0,
+ /* .gpr_size = */ 4,
+ /* .xr_size = */ 4,
+ /* .pc_offset = */ 128,
+ /* .ps_offset = */ 132,
+ /* .cr_offset = */ 152,
+ /* .lr_offset = */ 144,
+ /* .ctr_offset = */ 140,
+ /* .xer_offset = */ 148,
+ /* .mq_offset = */ 156,
+
+ /* Floating-point registers. */
+ /* .f0_offset = */ 0,
+ /* .fpscr_offset = */ 256,
+ /* .fpscr_size = */ 8
};
-static const struct regset ppc64_linux_gregset = {
- &ppc64_linux_reg_offsets,
- ppc_linux_supply_gregset,
- ppc_linux_collect_gregset
+static const struct ppc_reg_offsets ppc64_linux_reg_offsets = {
+ /* General-purpose registers. */
+ /* .r0_offset = */ 0,
+ /* .gpr_size = */ 8,
+ /* .xr_size = */ 8,
+ /* .pc_offset = */ 256,
+ /* .ps_offset = */ 264,
+ /* .cr_offset = */ 304,
+ /* .lr_offset = */ 288,
+ /* .ctr_offset = */ 280,
+ /* .xer_offset = */ 296,
+ /* .mq_offset = */ 312,
+
+ /* Floating-point registers. */
+ /* .f0_offset = */ 0,
+ /* .fpscr_offset = */ 256,
+ /* .fpscr_size = */ 8
};
-static const struct regset ppc32_linux_fpregset = {
- &ppc32_linux_reg_offsets,
- ppc_supply_fpregset,
- ppc_collect_fpregset
-};
+static const struct regset ppc32_linux_gregset
+ = { &ppc32_linux_reg_offsets, ppc_linux_supply_gregset,
+ ppc_linux_collect_gregset };
-static const struct regcache_map_entry ppc32_le_linux_vrregmap[] =
- {
- { 32, PPC_VR0_REGNUM, 16 },
- { 1, PPC_VSCR_REGNUM, 4 },
- { 1, REGCACHE_MAP_SKIP, 12 },
- { 1, PPC_VRSAVE_REGNUM, 4 },
- { 1, REGCACHE_MAP_SKIP, 12 },
- { 0 }
- };
-
-static const struct regcache_map_entry ppc32_be_linux_vrregmap[] =
- {
- { 32, PPC_VR0_REGNUM, 16 },
- { 1, REGCACHE_MAP_SKIP, 12},
- { 1, PPC_VSCR_REGNUM, 4 },
- { 1, PPC_VRSAVE_REGNUM, 4 },
- { 1, REGCACHE_MAP_SKIP, 12 },
- { 0 }
- };
-
-static const struct regset ppc32_le_linux_vrregset = {
- ppc32_le_linux_vrregmap,
- regcache_supply_regset,
- regcache_collect_regset
-};
+static const struct regset ppc64_linux_gregset
+ = { &ppc64_linux_reg_offsets, ppc_linux_supply_gregset,
+ ppc_linux_collect_gregset };
-static const struct regset ppc32_be_linux_vrregset = {
- ppc32_be_linux_vrregmap,
- regcache_supply_regset,
- regcache_collect_regset
-};
+static const struct regset ppc32_linux_fpregset
+ = { &ppc32_linux_reg_offsets, ppc_supply_fpregset, ppc_collect_fpregset };
-static const struct regcache_map_entry ppc32_linux_vsxregmap[] =
- {
- { 32, PPC_VSR0_UPPER_REGNUM, 8 },
- { 0 }
- };
+static const struct regcache_map_entry ppc32_le_linux_vrregmap[]
+ = { { 32, PPC_VR0_REGNUM, 16 }, { 1, PPC_VSCR_REGNUM, 4 },
+ { 1, REGCACHE_MAP_SKIP, 12 }, { 1, PPC_VRSAVE_REGNUM, 4 },
+ { 1, REGCACHE_MAP_SKIP, 12 }, { 0 } };
-static const struct regset ppc32_linux_vsxregset = {
- ppc32_linux_vsxregmap,
- regcache_supply_regset,
- regcache_collect_regset
-};
+static const struct regcache_map_entry ppc32_be_linux_vrregmap[]
+ = { { 32, PPC_VR0_REGNUM, 16 }, { 1, REGCACHE_MAP_SKIP, 12 },
+ { 1, PPC_VSCR_REGNUM, 4 }, { 1, PPC_VRSAVE_REGNUM, 4 },
+ { 1, REGCACHE_MAP_SKIP, 12 }, { 0 } };
+
+static const struct regset ppc32_le_linux_vrregset
+ = { ppc32_le_linux_vrregmap, regcache_supply_regset,
+ regcache_collect_regset };
+
+static const struct regset ppc32_be_linux_vrregset
+ = { ppc32_be_linux_vrregmap, regcache_supply_regset,
+ regcache_collect_regset };
+
+static const struct regcache_map_entry ppc32_linux_vsxregmap[]
+ = { { 32, PPC_VSR0_UPPER_REGNUM, 8 }, { 0 } };
+
+static const struct regset ppc32_linux_vsxregset
+ = { ppc32_linux_vsxregmap, regcache_supply_regset, regcache_collect_regset };
/* Program Priorty Register regmap. */
-static const struct regcache_map_entry ppc32_regmap_ppr[] =
- {
- { 1, PPC_PPR_REGNUM, 8 },
- { 0 }
- };
+static const struct regcache_map_entry ppc32_regmap_ppr[]
+ = { { 1, PPC_PPR_REGNUM, 8 }, { 0 } };
/* Program Priorty Register regset. */
-const struct regset ppc32_linux_pprregset = {
- ppc32_regmap_ppr,
- regcache_supply_regset,
- regcache_collect_regset
-};
+const struct regset ppc32_linux_pprregset
+ = { ppc32_regmap_ppr, regcache_supply_regset, regcache_collect_regset };
/* Data Stream Control Register regmap. */
-static const struct regcache_map_entry ppc32_regmap_dscr[] =
- {
- { 1, PPC_DSCR_REGNUM, 8 },
- { 0 }
- };
+static const struct regcache_map_entry ppc32_regmap_dscr[]
+ = { { 1, PPC_DSCR_REGNUM, 8 }, { 0 } };
/* Data Stream Control Register regset. */
-const struct regset ppc32_linux_dscrregset = {
- ppc32_regmap_dscr,
- regcache_supply_regset,
- regcache_collect_regset
-};
+const struct regset ppc32_linux_dscrregset
+ = { ppc32_regmap_dscr, regcache_supply_regset, regcache_collect_regset };
/* Target Address Register regmap. */
-static const struct regcache_map_entry ppc32_regmap_tar[] =
- {
- { 1, PPC_TAR_REGNUM, 8 },
- { 0 }
- };
+static const struct regcache_map_entry ppc32_regmap_tar[]
+ = { { 1, PPC_TAR_REGNUM, 8 }, { 0 } };
/* Target Address Register regset. */
-const struct regset ppc32_linux_tarregset = {
- ppc32_regmap_tar,
- regcache_supply_regset,
- regcache_collect_regset
-};
+const struct regset ppc32_linux_tarregset
+ = { ppc32_regmap_tar, regcache_supply_regset, regcache_collect_regset };
/* Event-Based Branching regmap. */
-static const struct regcache_map_entry ppc32_regmap_ebb[] =
- {
- { 1, PPC_EBBRR_REGNUM, 8 },
+static const struct regcache_map_entry ppc32_regmap_ebb[]
+ = { { 1, PPC_EBBRR_REGNUM, 8 },
{ 1, PPC_EBBHR_REGNUM, 8 },
{ 1, PPC_BESCR_REGNUM, 8 },
- { 0 }
- };
+ { 0 } };
/* Event-Based Branching regset. */
-const struct regset ppc32_linux_ebbregset = {
- ppc32_regmap_ebb,
- regcache_supply_regset,
- regcache_collect_regset
-};
+const struct regset ppc32_linux_ebbregset
+ = { ppc32_regmap_ebb, regcache_supply_regset, regcache_collect_regset };
/* Performance Monitoring Unit regmap. */
-static const struct regcache_map_entry ppc32_regmap_pmu[] =
- {
- { 1, PPC_SIAR_REGNUM, 8 },
- { 1, PPC_SDAR_REGNUM, 8 },
- { 1, PPC_SIER_REGNUM, 8 },
- { 1, PPC_MMCR2_REGNUM, 8 },
- { 1, PPC_MMCR0_REGNUM, 8 },
- { 0 }
- };
+static const struct regcache_map_entry ppc32_regmap_pmu[]
+ = { { 1, PPC_SIAR_REGNUM, 8 }, { 1, PPC_SDAR_REGNUM, 8 },
+ { 1, PPC_SIER_REGNUM, 8 }, { 1, PPC_MMCR2_REGNUM, 8 },
+ { 1, PPC_MMCR0_REGNUM, 8 }, { 0 } };
/* Performance Monitoring Unit regset. */
-const struct regset ppc32_linux_pmuregset = {
- ppc32_regmap_pmu,
- regcache_supply_regset,
- regcache_collect_regset
-};
+const struct regset ppc32_linux_pmuregset
+ = { ppc32_regmap_pmu, regcache_supply_regset, regcache_collect_regset };
/* Hardware Transactional Memory special-purpose register regmap. */
-static const struct regcache_map_entry ppc32_regmap_tm_spr[] =
- {
- { 1, PPC_TFHAR_REGNUM, 8 },
+static const struct regcache_map_entry ppc32_regmap_tm_spr[]
+ = { { 1, PPC_TFHAR_REGNUM, 8 },
{ 1, PPC_TEXASR_REGNUM, 8 },
{ 1, PPC_TFIAR_REGNUM, 8 },
- { 0 }
- };
+ { 0 } };
/* Hardware Transactional Memory special-purpose register regset. */
-const struct regset ppc32_linux_tm_sprregset = {
- ppc32_regmap_tm_spr,
- regcache_supply_regset,
- regcache_collect_regset
-};
+const struct regset ppc32_linux_tm_sprregset
+ = { ppc32_regmap_tm_spr, regcache_supply_regset, regcache_collect_regset };
/* Regmaps for the Hardware Transactional Memory checkpointed
general-purpose regsets for 32-bit, 64-bit big-endian, and 64-bit
@@ -681,45 +610,39 @@ const struct regset ppc32_linux_tm_sprregset = {
when writing the regset to the inferior (with
PTRACE_SETREGSET). */
-static const struct regcache_map_entry ppc32_regmap_cgpr[] =
- {
- { 32, PPC_CR0_REGNUM, 4 },
+static const struct regcache_map_entry ppc32_regmap_cgpr[]
+ = { { 32, PPC_CR0_REGNUM, 4 },
{ 3, REGCACHE_MAP_SKIP, 4 }, /* nip, msr, orig_gpr3. */
{ 1, PPC_CCTR_REGNUM, 4 },
{ 1, PPC_CLR_REGNUM, 4 },
{ 1, PPC_CXER_REGNUM, 4 },
{ 1, PPC_CCR_REGNUM, 4 },
{ 9, REGCACHE_MAP_SKIP, 4 }, /* All the rest. */
- { 0 }
- };
+ { 0 } };
-static const struct regcache_map_entry ppc64_le_regmap_cgpr[] =
- {
- { 32, PPC_CR0_REGNUM, 8 },
+static const struct regcache_map_entry ppc64_le_regmap_cgpr[]
+ = { { 32, PPC_CR0_REGNUM, 8 },
{ 3, REGCACHE_MAP_SKIP, 8 },
{ 1, PPC_CCTR_REGNUM, 8 },
{ 1, PPC_CLR_REGNUM, 8 },
{ 1, PPC_CXER_REGNUM, 4 },
{ 1, REGCACHE_MAP_SKIP, 4 }, /* CXER padding. */
{ 1, PPC_CCR_REGNUM, 4 },
- { 1, REGCACHE_MAP_SKIP, 4}, /* CCR padding. */
- { 9, REGCACHE_MAP_SKIP, 8},
- { 0 }
- };
-
-static const struct regcache_map_entry ppc64_be_regmap_cgpr[] =
- {
- { 32, PPC_CR0_REGNUM, 8 },
+ { 1, REGCACHE_MAP_SKIP, 4 }, /* CCR padding. */
+ { 9, REGCACHE_MAP_SKIP, 8 },
+ { 0 } };
+
+static const struct regcache_map_entry ppc64_be_regmap_cgpr[]
+ = { { 32, PPC_CR0_REGNUM, 8 },
{ 3, REGCACHE_MAP_SKIP, 8 },
{ 1, PPC_CCTR_REGNUM, 8 },
{ 1, PPC_CLR_REGNUM, 8 },
- { 1, REGCACHE_MAP_SKIP, 4}, /* CXER padding. */
+ { 1, REGCACHE_MAP_SKIP, 4 }, /* CXER padding. */
{ 1, PPC_CXER_REGNUM, 4 },
- { 1, REGCACHE_MAP_SKIP, 4}, /* CCR padding. */
+ { 1, REGCACHE_MAP_SKIP, 4 }, /* CCR padding. */
{ 1, PPC_CCR_REGNUM, 4 },
- { 9, REGCACHE_MAP_SKIP, 8},
- { 0 }
- };
+ { 9, REGCACHE_MAP_SKIP, 8 },
+ { 0 } };
/* Regsets for the Hardware Transactional Memory checkpointed
general-purpose registers for 32-bit, 64-bit big-endian, and 64-bit
@@ -730,150 +653,94 @@ static const struct regcache_map_entry ppc64_be_regmap_cgpr[] =
used, so we set the variable size flag in the corresponding regset
to accept this case. */
-static const struct regset ppc32_linux_cgprregset = {
- ppc32_regmap_cgpr,
- regcache_supply_regset,
- regcache_collect_regset,
- REGSET_VARIABLE_SIZE
-};
+static const struct regset ppc32_linux_cgprregset
+ = { ppc32_regmap_cgpr, regcache_supply_regset, regcache_collect_regset,
+ REGSET_VARIABLE_SIZE };
-static const struct regset ppc64_be_linux_cgprregset = {
- ppc64_be_regmap_cgpr,
- regcache_supply_regset,
- regcache_collect_regset
-};
+static const struct regset ppc64_be_linux_cgprregset
+ = { ppc64_be_regmap_cgpr, regcache_supply_regset, regcache_collect_regset };
-static const struct regset ppc64_le_linux_cgprregset = {
- ppc64_le_regmap_cgpr,
- regcache_supply_regset,
- regcache_collect_regset
-};
+static const struct regset ppc64_le_linux_cgprregset
+ = { ppc64_le_regmap_cgpr, regcache_supply_regset, regcache_collect_regset };
/* Hardware Transactional Memory checkpointed floating-point regmap. */
-static const struct regcache_map_entry ppc32_regmap_cfpr[] =
- {
- { 32, PPC_CF0_REGNUM, 8 },
- { 1, PPC_CFPSCR_REGNUM, 8 },
- { 0 }
- };
+static const struct regcache_map_entry ppc32_regmap_cfpr[]
+ = { { 32, PPC_CF0_REGNUM, 8 }, { 1, PPC_CFPSCR_REGNUM, 8 }, { 0 } };
/* Hardware Transactional Memory checkpointed floating-point regset. */
-const struct regset ppc32_linux_cfprregset = {
- ppc32_regmap_cfpr,
- regcache_supply_regset,
- regcache_collect_regset
-};
+const struct regset ppc32_linux_cfprregset
+ = { ppc32_regmap_cfpr, regcache_supply_regset, regcache_collect_regset };
/* Regmaps for the Hardware Transactional Memory checkpointed vector
regsets, for big and little endian targets. The position of the
4-byte VSCR in its 16-byte field depends on the endianness. */
-static const struct regcache_map_entry ppc32_le_regmap_cvmx[] =
- {
- { 32, PPC_CVR0_REGNUM, 16 },
- { 1, PPC_CVSCR_REGNUM, 4 },
- { 1, REGCACHE_MAP_SKIP, 12 },
- { 1, PPC_CVRSAVE_REGNUM, 4 },
- { 1, REGCACHE_MAP_SKIP, 12 },
- { 0 }
- };
-
-static const struct regcache_map_entry ppc32_be_regmap_cvmx[] =
- {
- { 32, PPC_CVR0_REGNUM, 16 },
- { 1, REGCACHE_MAP_SKIP, 12 },
- { 1, PPC_CVSCR_REGNUM, 4 },
- { 1, PPC_CVRSAVE_REGNUM, 4 },
- { 1, REGCACHE_MAP_SKIP, 12},
- { 0 }
- };
+static const struct regcache_map_entry ppc32_le_regmap_cvmx[]
+ = { { 32, PPC_CVR0_REGNUM, 16 }, { 1, PPC_CVSCR_REGNUM, 4 },
+ { 1, REGCACHE_MAP_SKIP, 12 }, { 1, PPC_CVRSAVE_REGNUM, 4 },
+ { 1, REGCACHE_MAP_SKIP, 12 }, { 0 } };
+
+static const struct regcache_map_entry ppc32_be_regmap_cvmx[]
+ = { { 32, PPC_CVR0_REGNUM, 16 }, { 1, REGCACHE_MAP_SKIP, 12 },
+ { 1, PPC_CVSCR_REGNUM, 4 }, { 1, PPC_CVRSAVE_REGNUM, 4 },
+ { 1, REGCACHE_MAP_SKIP, 12 }, { 0 } };
/* Hardware Transactional Memory checkpointed vector regsets, for little
and big endian targets. */
-static const struct regset ppc32_le_linux_cvmxregset = {
- ppc32_le_regmap_cvmx,
- regcache_supply_regset,
- regcache_collect_regset
-};
+static const struct regset ppc32_le_linux_cvmxregset
+ = { ppc32_le_regmap_cvmx, regcache_supply_regset, regcache_collect_regset };
-static const struct regset ppc32_be_linux_cvmxregset = {
- ppc32_be_regmap_cvmx,
- regcache_supply_regset,
- regcache_collect_regset
-};
+static const struct regset ppc32_be_linux_cvmxregset
+ = { ppc32_be_regmap_cvmx, regcache_supply_regset, regcache_collect_regset };
/* Hardware Transactional Memory checkpointed vector-scalar regmap. */
-static const struct regcache_map_entry ppc32_regmap_cvsx[] =
- {
- { 32, PPC_CVSR0_UPPER_REGNUM, 8 },
- { 0 }
- };
+static const struct regcache_map_entry ppc32_regmap_cvsx[]
+ = { { 32, PPC_CVSR0_UPPER_REGNUM, 8 }, { 0 } };
/* Hardware Transactional Memory checkpointed vector-scalar regset. */
-const struct regset ppc32_linux_cvsxregset = {
- ppc32_regmap_cvsx,
- regcache_supply_regset,
- regcache_collect_regset
-};
+const struct regset ppc32_linux_cvsxregset
+ = { ppc32_regmap_cvsx, regcache_supply_regset, regcache_collect_regset };
/* Hardware Transactional Memory checkpointed Program Priority Register
regmap. */
-static const struct regcache_map_entry ppc32_regmap_cppr[] =
- {
- { 1, PPC_CPPR_REGNUM, 8 },
- { 0 }
- };
+static const struct regcache_map_entry ppc32_regmap_cppr[]
+ = { { 1, PPC_CPPR_REGNUM, 8 }, { 0 } };
/* Hardware Transactional Memory checkpointed Program Priority Register
regset. */
-const struct regset ppc32_linux_cpprregset = {
- ppc32_regmap_cppr,
- regcache_supply_regset,
- regcache_collect_regset
-};
+const struct regset ppc32_linux_cpprregset
+ = { ppc32_regmap_cppr, regcache_supply_regset, regcache_collect_regset };
/* Hardware Transactional Memory checkpointed Data Stream Control
Register regmap. */
-static const struct regcache_map_entry ppc32_regmap_cdscr[] =
- {
- { 1, PPC_CDSCR_REGNUM, 8 },
- { 0 }
- };
+static const struct regcache_map_entry ppc32_regmap_cdscr[]
+ = { { 1, PPC_CDSCR_REGNUM, 8 }, { 0 } };
/* Hardware Transactional Memory checkpointed Data Stream Control
Register regset. */
-const struct regset ppc32_linux_cdscrregset = {
- ppc32_regmap_cdscr,
- regcache_supply_regset,
- regcache_collect_regset
-};
+const struct regset ppc32_linux_cdscrregset
+ = { ppc32_regmap_cdscr, regcache_supply_regset, regcache_collect_regset };
/* Hardware Transactional Memory checkpointed Target Address Register
regmap. */
-static const struct regcache_map_entry ppc32_regmap_ctar[] =
- {
- { 1, PPC_CTAR_REGNUM, 8 },
- { 0 }
- };
+static const struct regcache_map_entry ppc32_regmap_ctar[]
+ = { { 1, PPC_CTAR_REGNUM, 8 }, { 0 } };
/* Hardware Transactional Memory checkpointed Target Address Register
regset. */
-const struct regset ppc32_linux_ctarregset = {
- ppc32_regmap_ctar,
- regcache_supply_regset,
- regcache_collect_regset
-};
+const struct regset ppc32_linux_ctarregset
+ = { ppc32_regmap_ctar, regcache_supply_regset, regcache_collect_regset };
const struct regset *
ppc_linux_gregset (int wordsize)
@@ -941,8 +808,8 @@ ppc_linux_cvmxregset (struct gdbarch *gdbarch)
static void
ppc_linux_collect_core_cpgrregset (const struct regset *regset,
- const struct regcache *regcache,
- int regnum, void *buf, size_t len)
+ const struct regcache *regcache, int regnum,
+ void *buf, size_t len)
{
struct gdbarch *gdbarch = regcache->arch ();
ppc_gdbarch_tdep *tdep = gdbarch_tdep<ppc_gdbarch_tdep> (gdbarch);
@@ -973,15 +840,17 @@ ppc_linux_collect_core_cpgrregset (const struct regset *regset,
4-bytes long. We use raw_collect_integer which handles
differences in the sizes for the source and destination buffers
for both endian modes. */
- (regcache->raw_collect_integer
- (PPC_TFHAR_REGNUM, ((gdb_byte *) buf) + pt_offset * tdep->wordsize,
- tdep->wordsize, false));
+ (regcache->raw_collect_integer (PPC_TFHAR_REGNUM,
+ ((gdb_byte *) buf)
+ + pt_offset * tdep->wordsize,
+ tdep->wordsize, false));
pt_offset = 33;
- (regcache->raw_collect_integer
- (PPC_MSR_REGNUM, ((gdb_byte *) buf) + pt_offset * tdep->wordsize,
- tdep->wordsize, false));
+ (regcache->raw_collect_integer (PPC_MSR_REGNUM,
+ ((gdb_byte *) buf)
+ + pt_offset * tdep->wordsize,
+ tdep->wordsize, false));
}
/* Iterate over supported core file register note sections. */
@@ -1018,19 +887,16 @@ ppc_linux_iterate_over_regset_sections (struct gdbarch *gdbarch,
&ppc32_linux_vsxregset, "POWER7 VSX", cb_data);
if (have_ppr)
- cb (".reg-ppc-ppr", PPC_LINUX_SIZEOF_PPRREGSET,
- PPC_LINUX_SIZEOF_PPRREGSET,
+ cb (".reg-ppc-ppr", PPC_LINUX_SIZEOF_PPRREGSET, PPC_LINUX_SIZEOF_PPRREGSET,
&ppc32_linux_pprregset, "Priority Program Register", cb_data);
if (have_dscr)
cb (".reg-ppc-dscr", PPC_LINUX_SIZEOF_DSCRREGSET,
- PPC_LINUX_SIZEOF_DSCRREGSET,
- &ppc32_linux_dscrregset, "Data Stream Control Register",
- cb_data);
+ PPC_LINUX_SIZEOF_DSCRREGSET, &ppc32_linux_dscrregset,
+ "Data Stream Control Register", cb_data);
if (have_tar)
- cb (".reg-ppc-tar", PPC_LINUX_SIZEOF_TARREGSET,
- PPC_LINUX_SIZEOF_TARREGSET,
+ cb (".reg-ppc-tar", PPC_LINUX_SIZEOF_TARREGSET, PPC_LINUX_SIZEOF_TARREGSET,
&ppc32_linux_tarregset, "Target Address Register", cb_data);
/* EBB registers are unavailable when ptrace returns ENODATA. Check
@@ -1039,22 +905,17 @@ ppc_linux_iterate_over_regset_sections (struct gdbarch *gdbarch,
if (regcache == NULL
|| REG_VALID == regcache->get_register_status (PPC_BESCR_REGNUM))
cb (".reg-ppc-ebb", PPC_LINUX_SIZEOF_EBBREGSET,
- PPC_LINUX_SIZEOF_EBBREGSET,
- &ppc32_linux_ebbregset, "Event-based Branching Registers",
- cb_data);
+ PPC_LINUX_SIZEOF_EBBREGSET, &ppc32_linux_ebbregset,
+ "Event-based Branching Registers", cb_data);
if (tdep->ppc_mmcr0_regnum != -1)
- cb (".reg-ppc-pmu", PPC_LINUX_SIZEOF_PMUREGSET,
- PPC_LINUX_SIZEOF_PMUREGSET,
- &ppc32_linux_pmuregset, "Performance Monitor Registers",
- cb_data);
+ cb (".reg-ppc-pmu", PPC_LINUX_SIZEOF_PMUREGSET, PPC_LINUX_SIZEOF_PMUREGSET,
+ &ppc32_linux_pmuregset, "Performance Monitor Registers", cb_data);
if (tdep->have_htm_spr)
cb (".reg-ppc-tm-spr", PPC_LINUX_SIZEOF_TM_SPRREGSET,
- PPC_LINUX_SIZEOF_TM_SPRREGSET,
- &ppc32_linux_tm_sprregset,
- "Hardware Transactional Memory Special Purpose Registers",
- cb_data);
+ PPC_LINUX_SIZEOF_TM_SPRREGSET, &ppc32_linux_tm_sprregset,
+ "Hardware Transactional Memory Special Purpose Registers", cb_data);
/* Checkpointed registers can be unavailable, don't call back if
we are generating a core file. */
@@ -1065,16 +926,15 @@ ppc_linux_iterate_over_regset_sections (struct gdbarch *gdbarch,
access to the HTM SPRs, because we need TFHAR to fill the
"checkpointed" NIP slot. We can read a core file without it
since GDB is not aware of this NIP as a visible register. */
- if (regcache == NULL ||
- (REG_VALID == regcache->get_register_status (PPC_CR0_REGNUM)
- && tdep->have_htm_spr))
+ if (regcache == NULL
+ || (REG_VALID == regcache->get_register_status (PPC_CR0_REGNUM)
+ && tdep->have_htm_spr))
{
- int cgpr_size = (tdep->wordsize == 4?
- PPC32_LINUX_SIZEOF_CGPRREGSET
- : PPC64_LINUX_SIZEOF_CGPRREGSET);
+ int cgpr_size
+ = (tdep->wordsize == 4 ? PPC32_LINUX_SIZEOF_CGPRREGSET
+ : PPC64_LINUX_SIZEOF_CGPRREGSET);
- const struct regset *cgprregset =
- ppc_linux_cgprregset (gdbarch);
+ const struct regset *cgprregset = ppc_linux_cgprregset (gdbarch);
if (regcache != NULL)
{
@@ -1083,16 +943,12 @@ ppc_linux_iterate_over_regset_sections (struct gdbarch *gdbarch,
core_cgprregset.collect_regset
= ppc_linux_collect_core_cpgrregset;
- cb (".reg-ppc-tm-cgpr",
- cgpr_size, cgpr_size,
- &core_cgprregset,
+ cb (".reg-ppc-tm-cgpr", cgpr_size, cgpr_size, &core_cgprregset,
"Checkpointed General Purpose Registers", cb_data);
}
else
{
- cb (".reg-ppc-tm-cgpr",
- cgpr_size, cgpr_size,
- cgprregset,
+ cb (".reg-ppc-tm-cgpr", cgpr_size, cgpr_size, cgprregset,
"Checkpointed General Purpose Registers", cb_data);
}
}
@@ -1100,76 +956,68 @@ ppc_linux_iterate_over_regset_sections (struct gdbarch *gdbarch,
if (tdep->have_htm_fpu)
{
- if (regcache == NULL ||
- REG_VALID == regcache->get_register_status (PPC_CF0_REGNUM))
+ if (regcache == NULL
+ || REG_VALID == regcache->get_register_status (PPC_CF0_REGNUM))
cb (".reg-ppc-tm-cfpr", PPC_LINUX_SIZEOF_CFPRREGSET,
- PPC_LINUX_SIZEOF_CFPRREGSET,
- &ppc32_linux_cfprregset,
+ PPC_LINUX_SIZEOF_CFPRREGSET, &ppc32_linux_cfprregset,
"Checkpointed Floating Point Registers", cb_data);
}
if (tdep->have_htm_altivec)
{
- if (regcache == NULL ||
- REG_VALID == regcache->get_register_status (PPC_CVR0_REGNUM))
+ if (regcache == NULL
+ || REG_VALID == regcache->get_register_status (PPC_CVR0_REGNUM))
{
- const struct regset *cvmxregset =
- ppc_linux_cvmxregset (gdbarch);
+ const struct regset *cvmxregset = ppc_linux_cvmxregset (gdbarch);
cb (".reg-ppc-tm-cvmx", PPC_LINUX_SIZEOF_CVMXREGSET,
- PPC_LINUX_SIZEOF_CVMXREGSET,
- cvmxregset,
+ PPC_LINUX_SIZEOF_CVMXREGSET, cvmxregset,
"Checkpointed Altivec (VMX) Registers", cb_data);
}
}
if (tdep->have_htm_vsx)
{
- if (regcache == NULL ||
- (REG_VALID
- == regcache->get_register_status (PPC_CVSR0_UPPER_REGNUM)))
+ if (regcache == NULL
+ || (REG_VALID
+ == regcache->get_register_status (PPC_CVSR0_UPPER_REGNUM)))
cb (".reg-ppc-tm-cvsx", PPC_LINUX_SIZEOF_CVSXREGSET,
- PPC_LINUX_SIZEOF_CVSXREGSET,
- &ppc32_linux_cvsxregset,
+ PPC_LINUX_SIZEOF_CVSXREGSET, &ppc32_linux_cvsxregset,
"Checkpointed VSX Registers", cb_data);
}
if (tdep->ppc_cppr_regnum != -1)
{
- if (regcache == NULL ||
- REG_VALID == regcache->get_register_status (PPC_CPPR_REGNUM))
+ if (regcache == NULL
+ || REG_VALID == regcache->get_register_status (PPC_CPPR_REGNUM))
cb (".reg-ppc-tm-cppr", PPC_LINUX_SIZEOF_CPPRREGSET,
- PPC_LINUX_SIZEOF_CPPRREGSET,
- &ppc32_linux_cpprregset,
+ PPC_LINUX_SIZEOF_CPPRREGSET, &ppc32_linux_cpprregset,
"Checkpointed Priority Program Register", cb_data);
}
if (tdep->ppc_cdscr_regnum != -1)
{
- if (regcache == NULL ||
- REG_VALID == regcache->get_register_status (PPC_CDSCR_REGNUM))
+ if (regcache == NULL
+ || REG_VALID == regcache->get_register_status (PPC_CDSCR_REGNUM))
cb (".reg-ppc-tm-cdscr", PPC_LINUX_SIZEOF_CDSCRREGSET,
- PPC_LINUX_SIZEOF_CDSCRREGSET,
- &ppc32_linux_cdscrregset,
+ PPC_LINUX_SIZEOF_CDSCRREGSET, &ppc32_linux_cdscrregset,
"Checkpointed Data Stream Control Register", cb_data);
}
if (tdep->ppc_ctar_regnum)
{
- if ( regcache == NULL ||
- REG_VALID == regcache->get_register_status (PPC_CTAR_REGNUM))
+ if (regcache == NULL
+ || REG_VALID == regcache->get_register_status (PPC_CTAR_REGNUM))
cb (".reg-ppc-tm-ctar", PPC_LINUX_SIZEOF_CTARREGSET,
- PPC_LINUX_SIZEOF_CTARREGSET,
- &ppc32_linux_ctarregset,
+ PPC_LINUX_SIZEOF_CTARREGSET, &ppc32_linux_ctarregset,
"Checkpointed Target Address Register", cb_data);
}
}
static void
ppc_linux_sigtramp_cache (frame_info_ptr this_frame,
- struct trad_frame_cache *this_cache,
- CORE_ADDR func, LONGEST offset,
- int bias)
+ struct trad_frame_cache *this_cache, CORE_ADDR func,
+ LONGEST offset, int bias)
{
CORE_ADDR base;
CORE_ADDR regs;
@@ -1180,8 +1028,7 @@ ppc_linux_sigtramp_cache (frame_info_ptr this_frame,
ppc_gdbarch_tdep *tdep = gdbarch_tdep<ppc_gdbarch_tdep> (gdbarch);
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
- base = get_frame_register_unsigned (this_frame,
- gdbarch_sp_regnum (gdbarch));
+ base = get_frame_register_unsigned (this_frame, gdbarch_sp_regnum (gdbarch));
if (bias > 0 && get_frame_pc (this_frame) != func)
/* See below, some signal trampolines increment the stack as their
first instruction, need to compensate for that. */
@@ -1198,11 +1045,10 @@ ppc_linux_sigtramp_cache (frame_info_ptr this_frame,
for (i = 0; i < 32; i++)
{
int regnum = i + tdep->ppc_gp0_regnum;
- trad_frame_set_reg_addr (this_cache,
- regnum, gpregs + i * tdep->wordsize);
+ trad_frame_set_reg_addr (this_cache, regnum,
+ gpregs + i * tdep->wordsize);
}
- trad_frame_set_reg_addr (this_cache,
- gdbarch_pc_regnum (gdbarch),
+ trad_frame_set_reg_addr (this_cache, gdbarch_pc_regnum (gdbarch),
gpregs + 32 * tdep->wordsize);
trad_frame_set_reg_addr (this_cache, tdep->ppc_ctr_regnum,
gpregs + 35 * tdep->wordsize);
@@ -1231,7 +1077,7 @@ ppc_linux_sigtramp_cache (frame_info_ptr this_frame,
fpregs + i * tdep->wordsize);
}
trad_frame_set_reg_addr (this_cache, tdep->ppc_fpscr_regnum,
- fpregs + 32 * tdep->wordsize);
+ fpregs + 32 * tdep->wordsize);
}
trad_frame_set_id (this_cache, frame_id_build (base, func));
}
@@ -1244,7 +1090,7 @@ ppc32_linux_sigaction_cache_init (const struct tramp_frame *self,
{
ppc_linux_sigtramp_cache (this_frame, this_cache, func,
0xd0 /* Offset to ucontext_t. */
- + 0x30 /* Offset to .reg. */,
+ + 0x30 /* Offset to .reg. */,
0);
}
@@ -1256,7 +1102,7 @@ ppc64_linux_sigaction_cache_init (const struct tramp_frame *self,
{
ppc_linux_sigtramp_cache (this_frame, this_cache, func,
0x80 /* Offset to ucontext_t. */
- + 0xe0 /* Offset to .reg. */,
+ + 0xe0 /* Offset to .reg. */,
128);
}
@@ -1268,7 +1114,7 @@ ppc32_linux_sighandler_cache_init (const struct tramp_frame *self,
{
ppc_linux_sigtramp_cache (this_frame, this_cache, func,
0x40 /* Offset to ucontext_t. */
- + 0x1c /* Offset to .reg. */,
+ + 0x1c /* Offset to .reg. */,
0);
}
@@ -1280,52 +1126,48 @@ ppc64_linux_sighandler_cache_init (const struct tramp_frame *self,
{
ppc_linux_sigtramp_cache (this_frame, this_cache, func,
0x80 /* Offset to struct sigcontext. */
- + 0x38 /* Offset to .reg. */,
+ + 0x38 /* Offset to .reg. */,
128);
}
-static struct tramp_frame ppc32_linux_sigaction_tramp_frame = {
- SIGTRAMP_FRAME,
- 4,
- {
- { 0x380000ac, ULONGEST_MAX }, /* li r0, 172 */
- { 0x44000002, ULONGEST_MAX }, /* sc */
- { TRAMP_SENTINEL_INSN },
- },
- ppc32_linux_sigaction_cache_init
-};
-static struct tramp_frame ppc64_linux_sigaction_tramp_frame = {
- SIGTRAMP_FRAME,
- 4,
- {
- { 0x38210080, ULONGEST_MAX }, /* addi r1,r1,128 */
- { 0x380000ac, ULONGEST_MAX }, /* li r0, 172 */
- { 0x44000002, ULONGEST_MAX }, /* sc */
- { TRAMP_SENTINEL_INSN },
- },
- ppc64_linux_sigaction_cache_init
-};
-static struct tramp_frame ppc32_linux_sighandler_tramp_frame = {
- SIGTRAMP_FRAME,
- 4,
- {
- { 0x38000077, ULONGEST_MAX }, /* li r0,119 */
- { 0x44000002, ULONGEST_MAX }, /* sc */
- { TRAMP_SENTINEL_INSN },
- },
- ppc32_linux_sighandler_cache_init
-};
-static struct tramp_frame ppc64_linux_sighandler_tramp_frame = {
- SIGTRAMP_FRAME,
- 4,
- {
- { 0x38210080, ULONGEST_MAX }, /* addi r1,r1,128 */
- { 0x38000077, ULONGEST_MAX }, /* li r0,119 */
- { 0x44000002, ULONGEST_MAX }, /* sc */
- { TRAMP_SENTINEL_INSN },
- },
- ppc64_linux_sighandler_cache_init
-};
+static struct tramp_frame ppc32_linux_sigaction_tramp_frame
+ = { SIGTRAMP_FRAME,
+ 4,
+ {
+ { 0x380000ac, ULONGEST_MAX }, /* li r0, 172 */
+ { 0x44000002, ULONGEST_MAX }, /* sc */
+ { TRAMP_SENTINEL_INSN },
+ },
+ ppc32_linux_sigaction_cache_init };
+static struct tramp_frame ppc64_linux_sigaction_tramp_frame
+ = { SIGTRAMP_FRAME,
+ 4,
+ {
+ { 0x38210080, ULONGEST_MAX }, /* addi r1,r1,128 */
+ { 0x380000ac, ULONGEST_MAX }, /* li r0, 172 */
+ { 0x44000002, ULONGEST_MAX }, /* sc */
+ { TRAMP_SENTINEL_INSN },
+ },
+ ppc64_linux_sigaction_cache_init };
+static struct tramp_frame ppc32_linux_sighandler_tramp_frame
+ = { SIGTRAMP_FRAME,
+ 4,
+ {
+ { 0x38000077, ULONGEST_MAX }, /* li r0,119 */
+ { 0x44000002, ULONGEST_MAX }, /* sc */
+ { TRAMP_SENTINEL_INSN },
+ },
+ ppc32_linux_sighandler_cache_init };
+static struct tramp_frame ppc64_linux_sighandler_tramp_frame
+ = { SIGTRAMP_FRAME,
+ 4,
+ {
+ { 0x38210080, ULONGEST_MAX }, /* addi r1,r1,128 */
+ { 0x38000077, ULONGEST_MAX }, /* li r0,119 */
+ { 0x44000002, ULONGEST_MAX }, /* sc */
+ { TRAMP_SENTINEL_INSN },
+ },
+ ppc64_linux_sighandler_cache_init };
/* Return 1 if PPC_ORIG_R3_REGNUM and PPC_TRAP_REGNUM are usable. */
int
@@ -1344,8 +1186,7 @@ ppc_linux_trap_reg_p (struct gdbarch *gdbarch)
/* Return the current system call's number present in the
r0 register. When the function fails, it returns -1. */
static LONGEST
-ppc_linux_get_syscall_number (struct gdbarch *gdbarch,
- thread_info *thread)
+ppc_linux_get_syscall_number (struct gdbarch *gdbarch, thread_info *thread)
{
struct regcache *regcache = get_thread_regcache (thread);
ppc_gdbarch_tdep *tdep = gdbarch_tdep<ppc_gdbarch_tdep> (gdbarch);
@@ -1384,19 +1225,19 @@ ppc_canonicalize_syscall (int syscall, int wordsize)
if (syscall <= 165)
result = syscall;
- else if (syscall >= 167 && syscall <= 190) /* Skip query_module 166 */
+ else if (syscall >= 167 && syscall <= 190) /* Skip query_module 166 */
result = syscall + 1;
- else if (syscall >= 192 && syscall <= 197) /* mmap2 */
+ else if (syscall >= 192 && syscall <= 197) /* mmap2 */
result = syscall;
- else if (syscall == 208) /* tkill */
+ else if (syscall == 208) /* tkill */
result = gdb_sys_tkill;
- else if (syscall >= 207 && syscall <= 220) /* gettid */
+ else if (syscall >= 207 && syscall <= 220) /* gettid */
result = syscall + 224 - 207;
- else if (syscall >= 234 && syscall <= 239) /* exit_group */
+ else if (syscall >= 234 && syscall <= 239) /* exit_group */
result = syscall + 252 - 234;
- else if (syscall >= 240 && syscall <= 248) /* timer_create */
+ else if (syscall >= 240 && syscall <= 248) /* timer_create */
result = syscall += 259 - 240;
- else if (syscall >= 250 && syscall <= 251) /* tgkill */
+ else if (syscall >= 250 && syscall <= 251) /* tgkill */
result = syscall + 270 - 250;
else if (syscall == 286)
result = gdb_sys_openat;
@@ -1439,42 +1280,40 @@ ppc_linux_syscall_record (struct regcache *regcache)
if (syscall_gdb < 0)
{
gdb_printf (gdb_stderr,
- _("Process record and replay target doesn't "
- "support syscall number %d\n"), (int) scnum);
+ _ ("Process record and replay target doesn't "
+ "support syscall number %d\n"),
+ (int) scnum);
return 0;
}
- if (syscall_gdb == gdb_sys_sigreturn
- || syscall_gdb == gdb_sys_rt_sigreturn)
- {
- int i, j;
- int regsets[] = { tdep->ppc_gp0_regnum,
- tdep->ppc_fp0_regnum,
- tdep->ppc_vr0_regnum,
- tdep->ppc_vsr0_upper_regnum };
-
- for (j = 0; j < 4; j++)
- {
- if (regsets[j] == -1)
- continue;
- for (i = 0; i < 32; i++)
- {
- if (record_full_arch_list_add_reg (regcache, regsets[j] + i))
- return -1;
- }
- }
-
- if (record_full_arch_list_add_reg (regcache, tdep->ppc_cr_regnum))
- return -1;
- if (record_full_arch_list_add_reg (regcache, tdep->ppc_ctr_regnum))
- return -1;
- if (record_full_arch_list_add_reg (regcache, tdep->ppc_lr_regnum))
- return -1;
- if (record_full_arch_list_add_reg (regcache, tdep->ppc_xer_regnum))
- return -1;
-
- return 0;
- }
+ if (syscall_gdb == gdb_sys_sigreturn || syscall_gdb == gdb_sys_rt_sigreturn)
+ {
+ int i, j;
+ int regsets[] = { tdep->ppc_gp0_regnum, tdep->ppc_fp0_regnum,
+ tdep->ppc_vr0_regnum, tdep->ppc_vsr0_upper_regnum };
+
+ for (j = 0; j < 4; j++)
+ {
+ if (regsets[j] == -1)
+ continue;
+ for (i = 0; i < 32; i++)
+ {
+ if (record_full_arch_list_add_reg (regcache, regsets[j] + i))
+ return -1;
+ }
+ }
+
+ if (record_full_arch_list_add_reg (regcache, tdep->ppc_cr_regnum))
+ return -1;
+ if (record_full_arch_list_add_reg (regcache, tdep->ppc_ctr_regnum))
+ return -1;
+ if (record_full_arch_list_add_reg (regcache, tdep->ppc_lr_regnum))
+ return -1;
+ if (record_full_arch_list_add_reg (regcache, tdep->ppc_xer_regnum))
+ return -1;
+
+ return 0;
+ }
if (tdep->wordsize == 8)
ret = record_linux_system_call (syscall_gdb, regcache,
@@ -1544,7 +1383,8 @@ ppc_linux_record_signal (struct gdbarch *gdbarch, struct regcache *regcache,
sp -= SIGNAL_FRAMESIZE;
sp -= sizeof_rt_sigframe;
- if (record_full_arch_list_add_mem (sp, SIGNAL_FRAMESIZE + sizeof_rt_sigframe))
+ if (record_full_arch_list_add_mem (sp,
+ SIGNAL_FRAMESIZE + sizeof_rt_sigframe))
return -1;
if (record_full_arch_list_add_end ())
@@ -1574,8 +1414,7 @@ ppc_linux_write_pc (struct regcache *regcache, CORE_ADDR pc)
static const struct target_desc *
ppc_linux_core_read_description (struct gdbarch *gdbarch,
- struct target_ops *target,
- bfd *abfd)
+ struct target_ops *target, bfd *abfd)
{
struct ppc_linux_features features = ppc_linux_no_features;
asection *altivec = bfd_get_section_by_name (abfd, ".reg-ppc-vmx");
@@ -1587,7 +1426,7 @@ ppc_linux_core_read_description (struct gdbarch *gdbarch,
asection *pmu = bfd_get_section_by_name (abfd, ".reg-ppc-pmu");
asection *htmspr = bfd_get_section_by_name (abfd, ".reg-ppc-tm-spr");
- if (! section)
+ if (!section)
return NULL;
switch (bfd_section_size (section))
@@ -1632,7 +1471,6 @@ ppc_linux_core_read_description (struct gdbarch *gdbarch,
return ppc_linux_match_description (features);
}
-
/* Implementation of `gdbarch_elf_make_msymbol_special', as defined in
gdbarch.h. This implementation is used for the ELFv2 ABI only. */
@@ -1644,7 +1482,7 @@ ppc_elfv2_elf_make_msymbol_special (asymbol *sym, struct minimal_symbol *msym)
trampoline) do not have a local entry point. */
return;
- elf_symbol_type *elf_sym = (elf_symbol_type *)sym;
+ elf_symbol_type *elf_sym = (elf_symbol_type *) sym;
/* If the symbol is marked as having a local entry point, set a target
flag in the msymbol. We currently only support local entry point
@@ -1694,9 +1532,9 @@ ppc_stap_is_single_operand (struct gdbarch *gdbarch, const char *s)
{
return (*s == 'i' /* Literal number. */
|| (isdigit (*s) && s[1] == '('
- && isdigit (s[2])) /* Displacement. */
+ && isdigit (s[2])) /* Displacement. */
|| (*s == '(' && isdigit (s[1])) /* Register indirection. */
- || isdigit (*s)); /* Register value. */
+ || isdigit (*s)); /* Register value. */
}
/* Implementation of `gdbarch_stap_parse_special_token', as defined in
@@ -1734,8 +1572,8 @@ ppc_stap_parse_special_token (struct gdbarch *gdbarch,
regname[len] = '\0';
if (user_reg_map_name_to_regnum (gdbarch, regname, len) == -1)
- error (_("Invalid register name `%s' on expression `%s'."),
- regname, p->saved_arg);
+ error (_ ("Invalid register name `%s' on expression `%s'."), regname,
+ p->saved_arg);
p->arg = s;
@@ -1758,7 +1596,7 @@ ppc_init_linux_record_tdep (struct linux_record_tdep *record_tdep,
/* The values for TCGETS, TCSETS, TCSETSW, TCSETSF are based on the
size of struct termios in the kernel source.
include/uapi/asm-generic/termbits.h */
-#define SIZE_OF_STRUCT_TERMIOS 0x2c
+#define SIZE_OF_STRUCT_TERMIOS 0x2c
/* Simply return if it had been initialized. */
if (record_tdep->size_pointer != 0)
@@ -1818,7 +1656,7 @@ ppc_init_linux_record_tdep (struct linux_record_tdep *record_tdep,
record_tdep->size_stat64 = 104;
record_tdep->size_gid_t = 4;
record_tdep->size_uid_t = 4;
- record_tdep->size_PAGE_SIZE = 0x10000; /* 64KB */
+ record_tdep->size_PAGE_SIZE = 0x10000; /* 64KB */
record_tdep->size_flock64 = 32;
record_tdep->size_io_event = 32;
record_tdep->size_iocb = 64;
@@ -1885,7 +1723,7 @@ ppc_init_linux_record_tdep (struct linux_record_tdep *record_tdep,
record_tdep->size_stat64 = 104;
record_tdep->size_gid_t = 4;
record_tdep->size_uid_t = 4;
- record_tdep->size_PAGE_SIZE = 0x10000; /* 64KB */
+ record_tdep->size_PAGE_SIZE = 0x10000; /* 64KB */
record_tdep->size_flock64 = 32;
record_tdep->size_io_event = 32;
record_tdep->size_iocb = 64;
@@ -1902,7 +1740,7 @@ ppc_init_linux_record_tdep (struct linux_record_tdep *record_tdep,
record_tdep->size_time_t = 4;
}
else
- internal_error (_("unexpected wordsize"));
+ internal_error (_ ("unexpected wordsize"));
/* These values are the second argument of system call "sys_fcntl"
and "sys_fcntl64". They are obtained from Linux Kernel source. */
@@ -1987,13 +1825,11 @@ ppc_init_linux_record_tdep (struct linux_record_tdep *record_tdep,
If no suitable type is found, return NULL. */
static const struct floatformat **
-ppc_floatformat_for_type (struct gdbarch *gdbarch,
- const char *name, int len)
+ppc_floatformat_for_type (struct gdbarch *gdbarch, const char *name, int len)
{
if (len == 128 && name)
{
- if (strcmp (name, "__float128") == 0
- || strcmp (name, "_Float128") == 0
+ if (strcmp (name, "__float128") == 0 || strcmp (name, "_Float128") == 0
|| strcmp (name, "_Float64x") == 0
|| strcmp (name, "complex _Float128") == 0
|| strcmp (name, "complex _Float64x") == 0)
@@ -2039,8 +1875,8 @@ ppc64_linux_gcc_target_options (struct gdbarch *gdbarch)
}
static displaced_step_prepare_status
-ppc_linux_displaced_step_prepare (gdbarch *arch, thread_info *thread,
- CORE_ADDR &displaced_pc)
+ppc_linux_displaced_step_prepare (gdbarch *arch, thread_info *thread,
+ CORE_ADDR &displaced_pc)
{
ppc_inferior_data *per_inferior = get_ppc_per_inferior (thread->inf);
if (!per_inferior->disp_step_buf.has_value ())
@@ -2056,16 +1892,15 @@ ppc_linux_displaced_step_prepare (gdbarch *arch, thread_info *thread,
}
static void
-ppc_linux_init_abi (struct gdbarch_info info,
- struct gdbarch *gdbarch)
+ppc_linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
{
ppc_gdbarch_tdep *tdep = gdbarch_tdep<ppc_gdbarch_tdep> (gdbarch);
struct tdesc_arch_data *tdesc_data = info.tdesc_data;
static const char *const stap_integer_prefixes[] = { "i", NULL };
- static const char *const stap_register_indirection_prefixes[] = { "(",
- NULL };
- static const char *const stap_register_indirection_suffixes[] = { ")",
- NULL };
+ static const char *const stap_register_indirection_prefixes[]
+ = { "(", NULL };
+ static const char *const stap_register_indirection_suffixes[]
+ = { ")", NULL };
linux_init_abi (info, gdbarch, 0);
@@ -2091,14 +1926,13 @@ ppc_linux_init_abi (struct gdbarch_info info,
/* SystemTap functions. */
set_gdbarch_stap_integer_prefixes (gdbarch, stap_integer_prefixes);
- set_gdbarch_stap_register_indirection_prefixes (gdbarch,
- stap_register_indirection_prefixes);
- set_gdbarch_stap_register_indirection_suffixes (gdbarch,
- stap_register_indirection_suffixes);
+ set_gdbarch_stap_register_indirection_prefixes (
+ gdbarch, stap_register_indirection_prefixes);
+ set_gdbarch_stap_register_indirection_suffixes (
+ gdbarch, stap_register_indirection_suffixes);
set_gdbarch_stap_gdb_register_prefix (gdbarch, "r");
set_gdbarch_stap_is_single_operand (gdbarch, ppc_stap_is_single_operand);
- set_gdbarch_stap_parse_special_token (gdbarch,
- ppc_stap_parse_special_token);
+ set_gdbarch_stap_parse_special_token (gdbarch, ppc_stap_parse_special_token);
if (tdep->wordsize == 4)
{
@@ -2112,13 +1946,13 @@ ppc_linux_init_abi (struct gdbarch_info info,
set_gdbarch_return_value_as_value (gdbarch, ppc_linux_return_value);
set_gdbarch_return_value (gdbarch, nullptr);
- set_gdbarch_memory_remove_breakpoint (gdbarch,
- ppc_linux_memory_remove_breakpoint);
+ set_gdbarch_memory_remove_breakpoint (
+ gdbarch, ppc_linux_memory_remove_breakpoint);
/* Shared library handling. */
set_gdbarch_skip_trampoline_code (gdbarch, ppc_skip_trampoline_code);
- set_solib_svr4_fetch_link_map_offsets
- (gdbarch, linux_ilp32_fetch_link_map_offsets);
+ set_solib_svr4_fetch_link_map_offsets (
+ gdbarch, linux_ilp32_fetch_link_map_offsets);
/* Setting the correct XML syscall filename. */
set_xml_syscall_file_name (gdbarch, XML_SYSCALL_FILENAME_PPC);
@@ -2139,38 +1973,38 @@ ppc_linux_init_abi (struct gdbarch_info info,
{
powerpc_so_ops = svr4_so_ops;
/* Override dynamic resolve function. */
- powerpc_so_ops.in_dynsym_resolve_code =
- powerpc_linux_in_dynsym_resolve_code;
+ powerpc_so_ops.in_dynsym_resolve_code
+ = powerpc_linux_in_dynsym_resolve_code;
}
set_gdbarch_so_ops (gdbarch, &powerpc_so_ops);
set_gdbarch_skip_solib_resolver (gdbarch, glibc_skip_solib_resolver);
}
-
+
if (tdep->wordsize == 8)
{
if (tdep->elf_abi == POWERPC_ELF_V1)
{
/* Handle PPC GNU/Linux 64-bit function pointers (which are really
function descriptors). */
- set_gdbarch_convert_from_func_ptr_addr
- (gdbarch, ppc64_convert_from_func_ptr_addr);
+ set_gdbarch_convert_from_func_ptr_addr (
+ gdbarch, ppc64_convert_from_func_ptr_addr);
- set_gdbarch_elf_make_msymbol_special
- (gdbarch, ppc64_elf_make_msymbol_special);
+ set_gdbarch_elf_make_msymbol_special (
+ gdbarch, ppc64_elf_make_msymbol_special);
}
else
{
- set_gdbarch_elf_make_msymbol_special
- (gdbarch, ppc_elfv2_elf_make_msymbol_special);
+ set_gdbarch_elf_make_msymbol_special (
+ gdbarch, ppc_elfv2_elf_make_msymbol_special);
set_gdbarch_skip_entrypoint (gdbarch, ppc_elfv2_skip_entrypoint);
}
/* Shared library handling. */
set_gdbarch_skip_trampoline_code (gdbarch, ppc64_skip_trampoline_code);
- set_solib_svr4_fetch_link_map_offsets
- (gdbarch, linux_lp64_fetch_link_map_offsets);
+ set_solib_svr4_fetch_link_map_offsets (
+ gdbarch, linux_lp64_fetch_link_map_offsets);
/* Setting the correct XML syscall filename. */
set_xml_syscall_file_name (gdbarch, XML_SYSCALL_FILENAME_PPC64);
@@ -2186,7 +2020,7 @@ ppc_linux_init_abi (struct gdbarch_info info,
set_gdbarch_gcore_bfd_target (gdbarch, "elf64-powerpcle");
else
set_gdbarch_gcore_bfd_target (gdbarch, "elf64-powerpc");
- /* Set compiler triplet. */
+ /* Set compiler triplet. */
if (gdbarch_byte_order (gdbarch) == BFD_ENDIAN_LITTLE)
set_gdbarch_gnu_triplet_regexp (gdbarch, ppc64le_gnu_triplet_regexp);
else
@@ -2196,8 +2030,8 @@ ppc_linux_init_abi (struct gdbarch_info info,
}
set_gdbarch_core_read_description (gdbarch, ppc_linux_core_read_description);
- set_gdbarch_iterate_over_regset_sections (gdbarch,
- ppc_linux_iterate_over_regset_sections);
+ set_gdbarch_iterate_over_regset_sections (
+ gdbarch, ppc_linux_iterate_over_regset_sections);
/* Enable TLS support. */
set_gdbarch_fetch_tls_load_module_address (gdbarch,
@@ -2214,14 +2048,14 @@ ppc_linux_init_abi (struct gdbarch_info info,
set_gdbarch_num_regs (gdbarch, PPC_TRAP_REGNUM + 1);
/* If they are present, then assign them to the reserved number. */
- feature = tdesc_find_feature (info.target_desc,
- "org.gnu.gdb.power.linux");
+ feature
+ = tdesc_find_feature (info.target_desc, "org.gnu.gdb.power.linux");
if (feature != NULL)
{
- tdesc_numbered_register (feature, tdesc_data,
- PPC_ORIG_R3_REGNUM, "orig_r3");
- tdesc_numbered_register (feature, tdesc_data,
- PPC_TRAP_REGNUM, "trap");
+ tdesc_numbered_register (feature, tdesc_data, PPC_ORIG_R3_REGNUM,
+ "orig_r3");
+ tdesc_numbered_register (feature, tdesc_data, PPC_TRAP_REGNUM,
+ "trap");
}
}
@@ -2236,21 +2070,21 @@ ppc_linux_init_abi (struct gdbarch_info info,
/* Setup displaced stepping. */
set_gdbarch_displaced_step_prepare (gdbarch,
ppc_linux_displaced_step_prepare);
-
}
void _initialize_ppc_linux_tdep ();
+
void
_initialize_ppc_linux_tdep ()
{
/* Register for all sub-families of the POWER/PowerPC: 32-bit and
64-bit PowerPC, and the older rs6k. */
gdbarch_register_osabi (bfd_arch_powerpc, bfd_mach_ppc, GDB_OSABI_LINUX,
- ppc_linux_init_abi);
+ ppc_linux_init_abi);
gdbarch_register_osabi (bfd_arch_powerpc, bfd_mach_ppc64, GDB_OSABI_LINUX,
- ppc_linux_init_abi);
+ ppc_linux_init_abi);
gdbarch_register_osabi (bfd_arch_rs6000, bfd_mach_rs6k, GDB_OSABI_LINUX,
- ppc_linux_init_abi);
+ ppc_linux_init_abi);
/* Initialize the Linux target descriptions. */
initialize_tdesc_powerpc_32l ();
diff --git a/gdb/ppc-linux-tdep.h b/gdb/ppc-linux-tdep.h
index af70c7a4b1e..2ff332e44e3 100644
--- a/gdb/ppc-linux-tdep.h
+++ b/gdb/ppc-linux-tdep.h
@@ -20,7 +20,7 @@
#ifndef PPC_LINUX_TDEP_H
#define PPC_LINUX_TDEP_H
-#include "ppc-tdep.h" /* For PPC_NUM_REGS. */
+#include "ppc-tdep.h" /* For PPC_NUM_REGS. */
struct regset;
@@ -38,13 +38,14 @@ const struct regset *ppc_linux_cgprregset (struct gdbarch *gdbarch);
/* Get the checkpointed vector regset that matches the target byte
order. */
-const struct regset* ppc_linux_cvmxregset (struct gdbarch *gdbarch);
+const struct regset *ppc_linux_cvmxregset (struct gdbarch *gdbarch);
/* Extra register number constants. The Linux kernel stores a
"trap" code and the original value of r3 into special "registers";
these need to be saved and restored when performing an inferior
call while the inferior was interrupted within a system call. */
-enum {
+enum
+{
PPC_ORIG_R3_REGNUM = PPC_NUM_REGS,
PPC_TRAP_REGNUM,
};
diff --git a/gdb/ppc-netbsd-nat.c b/gdb/ppc-netbsd-nat.c
index 4d700e18859..ba184f8a223 100644
--- a/gdb/ppc-netbsd-nat.c
+++ b/gdb/ppc-netbsd-nat.c
@@ -56,10 +56,8 @@ getregs_supplies (struct gdbarch *gdbarch, int regnum)
return ((regnum >= tdep->ppc_gp0_regnum
&& regnum < tdep->ppc_gp0_regnum + ppc_num_gprs)
- || regnum == tdep->ppc_lr_regnum
- || regnum == tdep->ppc_cr_regnum
- || regnum == tdep->ppc_xer_regnum
- || regnum == tdep->ppc_ctr_regnum
+ || regnum == tdep->ppc_lr_regnum || regnum == tdep->ppc_cr_regnum
+ || regnum == tdep->ppc_xer_regnum || regnum == tdep->ppc_ctr_regnum
|| regnum == gdbarch_pc_regnum (gdbarch));
}
@@ -99,10 +97,10 @@ ppc_nbsd_nat_target::fetch_registers (struct regcache *regcache, int regnum)
struct reg regs;
if (ptrace (PT_GETREGS, pid, (PTRACE_TYPE_ARG3) &regs, lwp) == -1)
- perror_with_name (_("Couldn't get registers"));
+ perror_with_name (_ ("Couldn't get registers"));
- ppc_supply_gregset (&ppcnbsd_gregset, regcache,
- regnum, &regs, sizeof regs);
+ ppc_supply_gregset (&ppcnbsd_gregset, regcache, regnum, &regs,
+ sizeof regs);
}
if (regnum == -1 || getfpregs_supplies (gdbarch, regnum))
@@ -110,10 +108,10 @@ ppc_nbsd_nat_target::fetch_registers (struct regcache *regcache, int regnum)
struct fpreg fpregs;
if (ptrace (PT_GETFPREGS, pid, (PTRACE_TYPE_ARG3) &fpregs, lwp) == -1)
- perror_with_name (_("Couldn't get FP registers"));
+ perror_with_name (_ ("Couldn't get FP registers"));
- ppc_supply_fpregset (&ppcnbsd_fpregset, regcache,
- regnum, &fpregs, sizeof fpregs);
+ ppc_supply_fpregset (&ppcnbsd_fpregset, regcache, regnum, &fpregs,
+ sizeof fpregs);
}
}
@@ -129,13 +127,13 @@ ppc_nbsd_nat_target::store_registers (struct regcache *regcache, int regnum)
struct reg regs;
if (ptrace (PT_GETREGS, pid, (PTRACE_TYPE_ARG3) &regs, lwp) == -1)
- perror_with_name (_("Couldn't get registers"));
+ perror_with_name (_ ("Couldn't get registers"));
- ppc_collect_gregset (&ppcnbsd_gregset, regcache,
- regnum, &regs, sizeof regs);
+ ppc_collect_gregset (&ppcnbsd_gregset, regcache, regnum, &regs,
+ sizeof regs);
if (ptrace (PT_SETREGS, pid, (PTRACE_TYPE_ARG3) &regs, lwp) == -1)
- perror_with_name (_("Couldn't write registers"));
+ perror_with_name (_ ("Couldn't write registers"));
}
if (regnum == -1 || getfpregs_supplies (gdbarch, regnum))
@@ -143,13 +141,13 @@ ppc_nbsd_nat_target::store_registers (struct regcache *regcache, int regnum)
struct fpreg fpregs;
if (ptrace (PT_GETFPREGS, pid, (PTRACE_TYPE_ARG3) &fpregs, lwp) == -1)
- perror_with_name (_("Couldn't get FP registers"));
+ perror_with_name (_ ("Couldn't get FP registers"));
- ppc_collect_fpregset (&ppcnbsd_fpregset, regcache,
- regnum, &fpregs, sizeof fpregs);
+ ppc_collect_fpregset (&ppcnbsd_fpregset, regcache, regnum, &fpregs,
+ sizeof fpregs);
if (ptrace (PT_SETFPREGS, pid, (PTRACE_TYPE_ARG3) &fpregs, lwp) == -1)
- perror_with_name (_("Couldn't set FP registers"));
+ perror_with_name (_ ("Couldn't set FP registers"));
}
}
@@ -166,18 +164,18 @@ ppcnbsd_supply_pcb (struct regcache *regcache, struct pcb *pcb)
if (pcb->pcb_sp == 0)
return 0;
- read_memory (pcb->pcb_sp, (gdb_byte *)&sf, sizeof sf);
+ read_memory (pcb->pcb_sp, (gdb_byte *) &sf, sizeof sf);
regcache->raw_supply (tdep->ppc_cr_regnum, &sf.cr);
regcache->raw_supply (tdep->ppc_gp0_regnum + 2, &sf.fixreg2);
- for (i = 0 ; i < 19 ; i++)
+ for (i = 0; i < 19; i++)
regcache->raw_supply (tdep->ppc_gp0_regnum + 13 + i, &sf.fixreg[i]);
- read_memory(sf.sp, (gdb_byte *)&cf, sizeof(cf));
+ read_memory (sf.sp, (gdb_byte *) &cf, sizeof (cf));
regcache->raw_supply (tdep->ppc_gp0_regnum + 30, &cf.r30);
regcache->raw_supply (tdep->ppc_gp0_regnum + 31, &cf.r31);
regcache->raw_supply (tdep->ppc_gp0_regnum + 1, &cf.sp);
- read_memory(cf.sp, (gdb_byte *)&cf, sizeof(cf));
+ read_memory (cf.sp, (gdb_byte *) &cf, sizeof (cf));
regcache->raw_supply (tdep->ppc_lr_regnum, &cf.lr);
regcache->raw_supply (gdbarch_pc_regnum (gdbarch), &cf.lr);
@@ -185,6 +183,7 @@ ppcnbsd_supply_pcb (struct regcache *regcache, struct pcb *pcb)
}
void _initialize_ppcnbsd_nat ();
+
void
_initialize_ppcnbsd_nat ()
{
diff --git a/gdb/ppc-netbsd-tdep.c b/gdb/ppc-netbsd-tdep.c
index 0206b3e312c..2351d4769de 100644
--- a/gdb/ppc-netbsd-tdep.c
+++ b/gdb/ppc-netbsd-tdep.c
@@ -34,23 +34,16 @@
/* Register offsets from <machine/reg.h>. */
static ppc_reg_offsets ppcnbsd_reg_offsets;
-
/* Core file support. */
/* NetBSD/powerpc register sets. */
-const struct regset ppcnbsd_gregset =
-{
- &ppcnbsd_reg_offsets,
- ppc_supply_gregset
-};
+const struct regset ppcnbsd_gregset
+ = { &ppcnbsd_reg_offsets, ppc_supply_gregset };
-const struct regset ppcnbsd_fpregset =
-{
- &ppcnbsd_reg_offsets,
- ppc_supply_fpregset
-};
+const struct regset ppcnbsd_fpregset
+ = { &ppcnbsd_reg_offsets, ppc_supply_fpregset };
/* Iterate over core file register note sections. */
@@ -63,7 +56,6 @@ ppcnbsd_iterate_over_regset_sections (struct gdbarch *gdbarch,
cb (".reg", 148, 148, &ppcnbsd_gregset, NULL, cb_data);
cb (".reg2", 264, 264, &ppcnbsd_fpregset, NULL, cb_data);
}
-
/* NetBSD is confused. It appears that 1.5 was using the correct SVR4
convention but, 1.6 switched to the below broken convention. For
@@ -86,10 +78,9 @@ ppcnbsd_return_value (struct gdbarch *gdbarch, struct value *function,
return RETURN_VALUE_STRUCT_CONVENTION;
else
#endif
- return ppc_sysv_abi_broken_return_value (gdbarch, function, valtype,
- regcache, readbuf, writebuf);
+ return ppc_sysv_abi_broken_return_value (gdbarch, function, valtype,
+ regcache, readbuf, writebuf);
}
-
/* Signal trampolines. */
@@ -106,8 +97,7 @@ ppcnbsd_sigtramp_cache_init (const struct tramp_frame *self,
CORE_ADDR addr, base;
int i;
- base = get_frame_register_unsigned (this_frame,
- gdbarch_sp_regnum (gdbarch));
+ base = get_frame_register_unsigned (this_frame, gdbarch_sp_regnum (gdbarch));
if (self == &ppcnbsd2_sigtramp)
addr = base + 0x10 + 2 * tdep->wordsize;
else
@@ -133,46 +123,36 @@ ppcnbsd_sigtramp_cache_init (const struct tramp_frame *self,
trad_frame_set_id (this_cache, frame_id_build (base, func));
}
-static const struct tramp_frame ppcnbsd_sigtramp =
-{
- SIGTRAMP_FRAME,
- 4,
- {
- { 0x3821fff0, ULONGEST_MAX }, /* add r1,r1,-16 */
- { 0x4e800021, ULONGEST_MAX }, /* blrl */
- { 0x38610018, ULONGEST_MAX }, /* addi r3,r1,24 */
- { 0x38000127, ULONGEST_MAX }, /* li r0,295 */
- { 0x44000002, ULONGEST_MAX }, /* sc */
- { 0x38000001, ULONGEST_MAX }, /* li r0,1 */
- { 0x44000002, ULONGEST_MAX }, /* sc */
- { TRAMP_SENTINEL_INSN, ULONGEST_MAX }
- },
- ppcnbsd_sigtramp_cache_init
-};
+static const struct tramp_frame ppcnbsd_sigtramp
+ = { SIGTRAMP_FRAME,
+ 4,
+ { { 0x3821fff0, ULONGEST_MAX }, /* add r1,r1,-16 */
+ { 0x4e800021, ULONGEST_MAX }, /* blrl */
+ { 0x38610018, ULONGEST_MAX }, /* addi r3,r1,24 */
+ { 0x38000127, ULONGEST_MAX }, /* li r0,295 */
+ { 0x44000002, ULONGEST_MAX }, /* sc */
+ { 0x38000001, ULONGEST_MAX }, /* li r0,1 */
+ { 0x44000002, ULONGEST_MAX }, /* sc */
+ { TRAMP_SENTINEL_INSN, ULONGEST_MAX } },
+ ppcnbsd_sigtramp_cache_init };
/* NetBSD 2.0 introduced a slightly different signal trampoline. */
-const struct tramp_frame ppcnbsd2_sigtramp =
-{
- SIGTRAMP_FRAME,
- 4,
- {
- { 0x3821fff0, ULONGEST_MAX }, /* add r1,r1,-16 */
- { 0x4e800021, ULONGEST_MAX }, /* blrl */
- { 0x38610010, ULONGEST_MAX }, /* addi r3,r1,16 */
- { 0x38000127, ULONGEST_MAX }, /* li r0,295 */
- { 0x44000002, ULONGEST_MAX }, /* sc */
- { 0x38000001, ULONGEST_MAX }, /* li r0,1 */
- { 0x44000002, ULONGEST_MAX }, /* sc */
- { TRAMP_SENTINEL_INSN, ULONGEST_MAX }
- },
- ppcnbsd_sigtramp_cache_init
-};
-
+const struct tramp_frame ppcnbsd2_sigtramp
+ = { SIGTRAMP_FRAME,
+ 4,
+ { { 0x3821fff0, ULONGEST_MAX }, /* add r1,r1,-16 */
+ { 0x4e800021, ULONGEST_MAX }, /* blrl */
+ { 0x38610010, ULONGEST_MAX }, /* addi r3,r1,16 */
+ { 0x38000127, ULONGEST_MAX }, /* li r0,295 */
+ { 0x44000002, ULONGEST_MAX }, /* sc */
+ { 0x38000001, ULONGEST_MAX }, /* li r0,1 */
+ { 0x44000002, ULONGEST_MAX }, /* sc */
+ { TRAMP_SENTINEL_INSN, ULONGEST_MAX } },
+ ppcnbsd_sigtramp_cache_init };
static void
-ppcnbsd_init_abi (struct gdbarch_info info,
- struct gdbarch *gdbarch)
+ppcnbsd_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
{
nbsd_init_abi (info, gdbarch);
@@ -181,17 +161,18 @@ ppcnbsd_init_abi (struct gdbarch_info info,
set_gdbarch_return_value (gdbarch, ppcnbsd_return_value);
/* NetBSD uses SVR4-style shared libraries. */
- set_solib_svr4_fetch_link_map_offsets
- (gdbarch, svr4_ilp32_fetch_link_map_offsets);
+ set_solib_svr4_fetch_link_map_offsets (gdbarch,
+ svr4_ilp32_fetch_link_map_offsets);
- set_gdbarch_iterate_over_regset_sections
- (gdbarch, ppcnbsd_iterate_over_regset_sections);
+ set_gdbarch_iterate_over_regset_sections (
+ gdbarch, ppcnbsd_iterate_over_regset_sections);
tramp_frame_prepend_unwinder (gdbarch, &ppcnbsd_sigtramp);
tramp_frame_prepend_unwinder (gdbarch, &ppcnbsd2_sigtramp);
}
void _initialize_ppcnbsd_tdep ();
+
void
_initialize_ppcnbsd_tdep ()
{
@@ -218,6 +199,5 @@ _initialize_ppcnbsd_tdep ()
ppcnbsd_reg_offsets.f0_offset = 0;
ppcnbsd_reg_offsets.fpscr_offset = 256;
ppcnbsd_reg_offsets.fpscr_size = 4;
-
}
}
diff --git a/gdb/ppc-obsd-nat.c b/gdb/ppc-obsd-nat.c
index b491f252984..ef6a8816e91 100644
--- a/gdb/ppc-obsd-nat.c
+++ b/gdb/ppc-obsd-nat.c
@@ -85,26 +85,23 @@ ppc_obsd_nat_target::fetch_registers (struct regcache *regcache, int regnum)
pid_t pid = regcache->ptid ().pid ();
if (ptrace (PT_GETREGS, pid, (PTRACE_TYPE_ARG3) &regs, 0) == -1)
- perror_with_name (_("Couldn't get registers"));
+ perror_with_name (_ ("Couldn't get registers"));
- ppc_supply_gregset (&ppcobsd_gregset, regcache, -1,
- &regs, sizeof regs);
+ ppc_supply_gregset (&ppcobsd_gregset, regcache, -1, &regs, sizeof regs);
#ifndef PT_GETFPREGS
- ppc_supply_fpregset (&ppcobsd_gregset, regcache, -1,
- &regs, sizeof regs);
+ ppc_supply_fpregset (&ppcobsd_gregset, regcache, -1, &regs, sizeof regs);
#endif
#ifdef PT_GETFPREGS
- if (regnum == -1
- || getfpregs_supplies (regcache->arch (), regnum))
+ if (regnum == -1 || getfpregs_supplies (regcache->arch (), regnum))
{
struct fpreg fpregs;
if (ptrace (PT_GETFPREGS, pid, (PTRACE_TYPE_ARG3) &fpregs, 0) == -1)
- perror_with_name (_("Couldn't get floating point status"));
+ perror_with_name (_ ("Couldn't get floating point status"));
- ppc_supply_fpregset (&ppcobsd_fpregset, regcache, -1,
- &fpregs, sizeof fpregs);
+ ppc_supply_fpregset (&ppcobsd_fpregset, regcache, -1, &fpregs,
+ sizeof fpregs);
}
#endif
}
@@ -119,36 +116,33 @@ ppc_obsd_nat_target::store_registers (struct regcache *regcache, int regnum)
pid_t pid = regcache->ptid ().pid ();
if (ptrace (PT_GETREGS, pid, (PTRACE_TYPE_ARG3) &regs, 0) == -1)
- perror_with_name (_("Couldn't get registers"));
+ perror_with_name (_ ("Couldn't get registers"));
- ppc_collect_gregset (&ppcobsd_gregset, regcache,
- regnum, &regs, sizeof regs);
+ ppc_collect_gregset (&ppcobsd_gregset, regcache, regnum, &regs, sizeof regs);
#ifndef PT_GETFPREGS
- ppc_collect_fpregset (&ppcobsd_gregset, regcache,
- regnum, &regs, sizeof regs);
+ ppc_collect_fpregset (&ppcobsd_gregset, regcache, regnum, &regs,
+ sizeof regs);
#endif
if (ptrace (PT_SETREGS, pid, (PTRACE_TYPE_ARG3) &regs, 0) == -1)
- perror_with_name (_("Couldn't write registers"));
+ perror_with_name (_ ("Couldn't write registers"));
#ifdef PT_GETFPREGS
- if (regnum == -1
- || getfpregs_supplies (regcache->arch (), regnum))
+ if (regnum == -1 || getfpregs_supplies (regcache->arch (), regnum))
{
struct fpreg fpregs;
if (ptrace (PT_GETFPREGS, pid, (PTRACE_TYPE_ARG3) &fpregs, 0) == -1)
- perror_with_name (_("Couldn't get floating point status"));
+ perror_with_name (_ ("Couldn't get floating point status"));
- ppc_collect_fpregset (&ppcobsd_fpregset, regcache,
- regnum, &fpregs, sizeof fpregs);
+ ppc_collect_fpregset (&ppcobsd_fpregset, regcache, regnum, &fpregs,
+ sizeof fpregs);
if (ptrace (PT_SETFPREGS, pid, (PTRACE_TYPE_ARG3) &fpregs, 0) == -1)
- perror_with_name (_("Couldn't write floating point status"));
+ perror_with_name (_ ("Couldn't write floating point status"));
}
#endif
}
-
static int
ppcobsd_supply_pcb (struct regcache *regcache, struct pcb *pcb)
@@ -172,14 +166,14 @@ ppcobsd_supply_pcb (struct regcache *regcache, struct pcb *pcb)
if (pcb->pcb_sp == 0)
return 0;
- read_memory (pcb->pcb_sp, (gdb_byte *)&sf, sizeof sf);
+ read_memory (pcb->pcb_sp, (gdb_byte *) &sf, sizeof sf);
regcache->raw_supply (gdbarch_sp_regnum (gdbarch), &sf.sp);
regcache->raw_supply (tdep->ppc_cr_regnum, &sf.cr);
regcache->raw_supply (tdep->ppc_gp0_regnum + 2, &sf.fixreg2);
for (i = 0, regnum = tdep->ppc_gp0_regnum + 13; i < 19; i++, regnum++)
regcache->raw_supply (regnum, &sf.fixreg[i]);
- read_memory (sf.sp, (gdb_byte *)&cf, sizeof cf);
+ read_memory (sf.sp, (gdb_byte *) &cf, sizeof cf);
regcache->raw_supply (gdbarch_pc_regnum (gdbarch), &cf.lr);
regcache->raw_supply (tdep->ppc_gp0_regnum + 30, &cf.r30);
regcache->raw_supply (tdep->ppc_gp0_regnum + 31, &cf.r31);
@@ -188,6 +182,7 @@ ppcobsd_supply_pcb (struct regcache *regcache, struct pcb *pcb)
}
void _initialize_ppcobsd_nat ();
+
void
_initialize_ppcobsd_nat ()
{
diff --git a/gdb/ppc-obsd-tdep.c b/gdb/ppc-obsd-tdep.c
index d407c232311..bd80a6c3d6d 100644
--- a/gdb/ppc-obsd-tdep.c
+++ b/gdb/ppc-obsd-tdep.c
@@ -35,7 +35,6 @@
/* Register offsets from <machine/reg.h>. */
struct ppc_reg_offsets ppcobsd_reg_offsets;
struct ppc_reg_offsets ppcobsd_fpreg_offsets;
-
/* Core file support. */
@@ -44,9 +43,8 @@ struct ppc_reg_offsets ppcobsd_fpreg_offsets;
REGCACHE. If REGNUM is -1, do this for all registers in REGSET. */
void
-ppcobsd_supply_gregset (const struct regset *regset,
- struct regcache *regcache, int regnum,
- const void *gregs, size_t len)
+ppcobsd_supply_gregset (const struct regset *regset, struct regcache *regcache,
+ int regnum, const void *gregs, size_t len)
{
ppc_supply_gregset (regset, regcache, regnum, gregs, len);
ppc_supply_fpregset (regset, regcache, regnum, gregs, len);
@@ -68,17 +66,11 @@ ppcobsd_collect_gregset (const struct regset *regset,
/* OpenBSD/powerpc register set. */
-const struct regset ppcobsd_gregset =
-{
- &ppcobsd_reg_offsets,
- ppcobsd_supply_gregset
-};
+const struct regset ppcobsd_gregset
+ = { &ppcobsd_reg_offsets, ppcobsd_supply_gregset };
-const struct regset ppcobsd_fpregset =
-{
- &ppcobsd_fpreg_offsets,
- ppc_supply_fpregset
-};
+const struct regset ppcobsd_fpregset
+ = { &ppcobsd_fpreg_offsets, ppc_supply_fpregset };
/* Iterate over core file register note sections. */
@@ -90,7 +82,6 @@ ppcobsd_iterate_over_regset_sections (struct gdbarch *gdbarch,
{
cb (".reg", 412, 412, &ppcobsd_gregset, NULL, cb_data);
}
-
/* Signal trampolines. */
@@ -109,16 +100,13 @@ ppcobsd_iterate_over_regset_sections (struct gdbarch *gdbarch,
static const int ppcobsd_page_size = 4096;
/* Offset for sigreturn(2). */
-static const int ppcobsd_sigreturn_offset[] = {
- 0x98, /* OpenBSD 3.8 */
- 0x0c, /* OpenBSD 3.2 */
- -1
-};
+static const int ppcobsd_sigreturn_offset[] = { 0x98, /* OpenBSD 3.8 */
+ 0x0c, /* OpenBSD 3.2 */
+ -1 };
static int
ppcobsd_sigtramp_frame_sniffer (const struct frame_unwind *self,
- frame_info_ptr this_frame,
- void **this_cache)
+ frame_info_ptr this_frame, void **this_cache)
{
struct gdbarch *gdbarch = get_frame_arch (this_frame);
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
@@ -137,7 +125,7 @@ ppcobsd_sigtramp_frame_sniffer (const struct frame_unwind *self,
unsigned long insn;
if (!safe_frame_unwind_memory (this_frame, start_pc + *offset,
- {buf, sizeof buf}))
+ { buf, sizeof buf }))
continue;
/* Check for "li r0,SYS_sigreturn". */
@@ -146,8 +134,8 @@ ppcobsd_sigtramp_frame_sniffer (const struct frame_unwind *self,
continue;
/* Check for "sc". */
- insn = extract_unsigned_integer (buf + PPC_INSN_SIZE,
- PPC_INSN_SIZE, byte_order);
+ insn = extract_unsigned_integer (buf + PPC_INSN_SIZE, PPC_INSN_SIZE,
+ byte_order);
if (insn != 0x44000002)
continue;
@@ -177,7 +165,7 @@ ppcobsd_sigtramp_frame_cache (frame_info_ptr this_frame, void **this_cache)
func = get_frame_pc (this_frame);
func &= ~(ppcobsd_page_size - 1);
- if (!safe_frame_unwind_memory (this_frame, func, {buf, sizeof buf}))
+ if (!safe_frame_unwind_memory (this_frame, func, { buf, sizeof buf }))
return cache;
/* Calculate the offset where we can find `struct sigcontext'. We
@@ -212,11 +200,11 @@ ppcobsd_sigtramp_frame_cache (frame_info_ptr this_frame, void **this_cache)
}
static void
-ppcobsd_sigtramp_frame_this_id (frame_info_ptr this_frame,
- void **this_cache, struct frame_id *this_id)
+ppcobsd_sigtramp_frame_this_id (frame_info_ptr this_frame, void **this_cache,
+ struct frame_id *this_id)
{
- struct trad_frame_cache *cache =
- ppcobsd_sigtramp_frame_cache (this_frame, this_cache);
+ struct trad_frame_cache *cache
+ = ppcobsd_sigtramp_frame_cache (this_frame, this_cache);
trad_frame_get_id (cache, this_id);
}
@@ -225,22 +213,20 @@ static struct value *
ppcobsd_sigtramp_frame_prev_register (frame_info_ptr this_frame,
void **this_cache, int regnum)
{
- struct trad_frame_cache *cache =
- ppcobsd_sigtramp_frame_cache (this_frame, this_cache);
+ struct trad_frame_cache *cache
+ = ppcobsd_sigtramp_frame_cache (this_frame, this_cache);
return trad_frame_get_register (cache, this_frame, regnum);
}
-static const struct frame_unwind ppcobsd_sigtramp_frame_unwind = {
- "ppc openbsd sigtramp",
- SIGTRAMP_FRAME,
- default_frame_unwind_stop_reason,
- ppcobsd_sigtramp_frame_this_id,
- ppcobsd_sigtramp_frame_prev_register,
- NULL,
- ppcobsd_sigtramp_frame_sniffer
-};
-
+static const struct frame_unwind ppcobsd_sigtramp_frame_unwind
+ = { "ppc openbsd sigtramp",
+ SIGTRAMP_FRAME,
+ default_frame_unwind_stop_reason,
+ ppcobsd_sigtramp_frame_this_id,
+ ppcobsd_sigtramp_frame_prev_register,
+ NULL,
+ ppcobsd_sigtramp_frame_sniffer };
static void
ppcobsd_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
@@ -253,16 +239,17 @@ ppcobsd_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
set_gdbarch_return_value (gdbarch, ppc_sysv_abi_broken_return_value);
/* OpenBSD uses SVR4-style shared libraries. */
- set_solib_svr4_fetch_link_map_offsets
- (gdbarch, svr4_ilp32_fetch_link_map_offsets);
+ set_solib_svr4_fetch_link_map_offsets (gdbarch,
+ svr4_ilp32_fetch_link_map_offsets);
- set_gdbarch_iterate_over_regset_sections
- (gdbarch, ppcobsd_iterate_over_regset_sections);
+ set_gdbarch_iterate_over_regset_sections (
+ gdbarch, ppcobsd_iterate_over_regset_sections);
frame_unwind_append_unwinder (gdbarch, &ppcobsd_sigtramp_frame_unwind);
}
void _initialize_ppcobsd_tdep ();
+
void
_initialize_ppcobsd_tdep ()
{
@@ -290,7 +277,6 @@ _initialize_ppcobsd_tdep ()
/* Floating-point registers. */
ppcobsd_reg_offsets.f0_offset = 128;
ppcobsd_reg_offsets.fpscr_offset = -1;
-
}
if (ppcobsd_fpreg_offsets.fpscr_offset == 0)
diff --git a/gdb/ppc-obsd-tdep.h b/gdb/ppc-obsd-tdep.h
index e3c96d28c81..0f66aaa3f9f 100644
--- a/gdb/ppc-obsd-tdep.h
+++ b/gdb/ppc-obsd-tdep.h
@@ -30,7 +30,6 @@ extern struct ppc_reg_offsets ppcobsd_fpreg_offsets;
/* Register sets for OpenBSD/powerpc. */
extern const struct regset ppcobsd_gregset;
extern const struct regset ppcobsd_fpregset;
-
/* Supply register REGNUM in the general-purpose register set REGSET
from the buffer specified by GREGS and LEN to register cache
diff --git a/gdb/ppc-ravenscar-thread.c b/gdb/ppc-ravenscar-thread.c
index 8649631fb1f..e0a9093a43c 100644
--- a/gdb/ppc-ravenscar-thread.c
+++ b/gdb/ppc-ravenscar-thread.c
@@ -29,72 +29,48 @@
/* See ppc-tdep.h for register numbers. */
-static const int powerpc_context_offsets[] =
-{
+static const int powerpc_context_offsets[] = {
/* R0 - R32 */
- NO_OFFSET, 0, 4, NO_OFFSET,
- NO_OFFSET, NO_OFFSET, NO_OFFSET, NO_OFFSET,
- NO_OFFSET, NO_OFFSET, NO_OFFSET, NO_OFFSET,
- NO_OFFSET, 8, 12, 16,
- 20, 24, 28, 32,
- 36, 40, 44, 48,
- 52, 56, 60, 64,
- 68, 72, 76, 80,
+ NO_OFFSET, 0, 4, NO_OFFSET, NO_OFFSET, NO_OFFSET, NO_OFFSET, NO_OFFSET,
+ NO_OFFSET, NO_OFFSET, NO_OFFSET, NO_OFFSET, NO_OFFSET, 8, 12, 16, 20, 24, 28,
+ 32, 36, 40, 44, 48, 52, 56, 60, 64, 68, 72, 76, 80,
/* F0 - F31 */
- NO_OFFSET, NO_OFFSET, NO_OFFSET, NO_OFFSET,
- NO_OFFSET, NO_OFFSET, NO_OFFSET, NO_OFFSET,
- NO_OFFSET, NO_OFFSET, NO_OFFSET, NO_OFFSET,
- NO_OFFSET, NO_OFFSET, 96, 104,
- 112, 120, 128, 136,
- 144, 152, 160, 168,
- 176, 184, 192, 200,
- 208, 216, 224, 232,
+ NO_OFFSET, NO_OFFSET, NO_OFFSET, NO_OFFSET, NO_OFFSET, NO_OFFSET, NO_OFFSET,
+ NO_OFFSET, NO_OFFSET, NO_OFFSET, NO_OFFSET, NO_OFFSET, NO_OFFSET, NO_OFFSET,
+ 96, 104, 112, 120, 128, 136, 144, 152, 160, 168, 176, 184, 192, 200, 208,
+ 216, 224, 232,
/* PC, MSR, CR, LR */
- 88, NO_OFFSET, 84, NO_OFFSET,
+ 88, NO_OFFSET, 84, NO_OFFSET,
/* CTR, XER, FPSCR */
NO_OFFSET, NO_OFFSET, 240
};
-static const int e500_context_offsets[] =
-{
+static const int e500_context_offsets[] = {
/* R0 - R32 */
- NO_OFFSET, 4, 12, NO_OFFSET,
- NO_OFFSET, NO_OFFSET, NO_OFFSET, NO_OFFSET,
- NO_OFFSET, NO_OFFSET, NO_OFFSET, NO_OFFSET,
- NO_OFFSET, 20, 28, 36,
- 44, 52, 60, 68,
- 76, 84, 92, 100,
- 108, 116, 124, 132,
- 140, 148, 156, 164,
+ NO_OFFSET, 4, 12, NO_OFFSET, NO_OFFSET, NO_OFFSET, NO_OFFSET, NO_OFFSET,
+ NO_OFFSET, NO_OFFSET, NO_OFFSET, NO_OFFSET, NO_OFFSET, 20, 28, 36, 44, 52,
+ 60, 68, 76, 84, 92, 100, 108, 116, 124, 132, 140, 148, 156, 164,
/* F0 - F31 */
- NO_OFFSET, NO_OFFSET, NO_OFFSET, NO_OFFSET,
- NO_OFFSET, NO_OFFSET, NO_OFFSET, NO_OFFSET,
- NO_OFFSET, NO_OFFSET, NO_OFFSET, NO_OFFSET,
- NO_OFFSET, NO_OFFSET, NO_OFFSET, NO_OFFSET,
- NO_OFFSET, NO_OFFSET, NO_OFFSET, NO_OFFSET,
- NO_OFFSET, NO_OFFSET, NO_OFFSET, NO_OFFSET,
- NO_OFFSET, NO_OFFSET, NO_OFFSET, NO_OFFSET,
+ NO_OFFSET, NO_OFFSET, NO_OFFSET, NO_OFFSET, NO_OFFSET, NO_OFFSET, NO_OFFSET,
+ NO_OFFSET, NO_OFFSET, NO_OFFSET, NO_OFFSET, NO_OFFSET, NO_OFFSET, NO_OFFSET,
+ NO_OFFSET, NO_OFFSET, NO_OFFSET, NO_OFFSET, NO_OFFSET, NO_OFFSET, NO_OFFSET,
+ NO_OFFSET, NO_OFFSET, NO_OFFSET, NO_OFFSET, NO_OFFSET, NO_OFFSET, NO_OFFSET,
NO_OFFSET, NO_OFFSET, NO_OFFSET, NO_OFFSET,
/* PC, MSR, CR, LR */
- 172, NO_OFFSET, 168, NO_OFFSET,
+ 172, NO_OFFSET, 168, NO_OFFSET,
/* CTR, XER, FPSCR, MQ */
NO_OFFSET, NO_OFFSET, NO_OFFSET, NO_OFFSET,
/* Upper R0-R32. */
- NO_OFFSET, 0, 8, NO_OFFSET,
- NO_OFFSET, NO_OFFSET, NO_OFFSET, NO_OFFSET,
- NO_OFFSET, NO_OFFSET, NO_OFFSET, NO_OFFSET,
- NO_OFFSET, 16, 24, 32,
- 40, 48, 56, 64,
- 72, 80, 88, 96,
- 104, 112, 120, 128,
- 136, 144, 152, 160,
+ NO_OFFSET, 0, 8, NO_OFFSET, NO_OFFSET, NO_OFFSET, NO_OFFSET, NO_OFFSET,
+ NO_OFFSET, NO_OFFSET, NO_OFFSET, NO_OFFSET, NO_OFFSET, 16, 24, 32, 40, 48,
+ 56, 64, 72, 80, 88, 96, 104, 112, 120, 128, 136, 144, 152, 160,
/* ACC, FSCR */
NO_OFFSET, 176
@@ -102,8 +78,8 @@ static const int e500_context_offsets[] =
/* The ravenscar_arch_ops vector for most PowerPC targets. */
-static struct ravenscar_arch_ops ppc_ravenscar_powerpc_ops
- (powerpc_context_offsets);
+static struct ravenscar_arch_ops
+ ppc_ravenscar_powerpc_ops (powerpc_context_offsets);
/* Register ppc_ravenscar_powerpc_ops in GDBARCH. */
diff --git a/gdb/ppc-sysv-tdep.c b/gdb/ppc-sysv-tdep.c
index 3df56c8b75c..5d96f4ca09c 100644
--- a/gdb/ppc-sysv-tdep.c
+++ b/gdb/ppc-sysv-tdep.c
@@ -33,7 +33,6 @@
#include "target-float.h"
#include <algorithm>
-
/* Check whether FTPYE is a (pointer to) function type that should use
the OpenCL vector ABI. */
@@ -71,7 +70,7 @@ ppc_sysv_abi_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
int opencl_abi = ppc_sysv_use_opencl_abi (value_type (function));
ULONGEST saved_sp;
- int argspace = 0; /* 0 is an initial wrong guess. */
+ int argspace = 0; /* 0 is an initial wrong guess. */
int write_pass;
gdb_assert (tdep->wordsize == 4);
@@ -126,8 +125,7 @@ ppc_sysv_abi_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
int len = type->length ();
const bfd_byte *val = value_contents (arg).data ();
- if (type->code () == TYPE_CODE_FLT && len <= 8
- && !tdep->soft_float)
+ if (type->code () == TYPE_CODE_FLT && len <= 8 && !tdep->soft_float)
{
/* Floating point value converted to "double" then
passed in an FP register, when the registers run out,
@@ -162,12 +160,11 @@ ppc_sysv_abi_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
the argument (float or double). */
argoffset = align_up (argoffset, len);
if (write_pass)
- write_memory (sp + argoffset, val, len);
+ write_memory (sp + argoffset, val, len);
argoffset += len;
}
}
- else if (type->code () == TYPE_CODE_FLT
- && len == 16
+ else if (type->code () == TYPE_CODE_FLT && len == 16
&& !tdep->soft_float
&& (gdbarch_long_double_format (gdbarch)
== floatformats_ibm_long_double))
@@ -178,7 +175,8 @@ ppc_sysv_abi_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
{
if (write_pass)
{
- regcache->cooked_write (tdep->ppc_fp0_regnum + freg, val);
+ regcache->cooked_write (tdep->ppc_fp0_regnum + freg,
+ val);
regcache->cooked_write (tdep->ppc_fp0_regnum + freg + 1,
val + 8);
}
@@ -193,8 +191,8 @@ ppc_sysv_abi_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
}
}
else if (len == 8
- && (type->code () == TYPE_CODE_INT /* long long */
- || type->code () == TYPE_CODE_FLT /* double */
+ && (type->code () == TYPE_CODE_INT /* long long */
+ || type->code () == TYPE_CODE_FLT /* double */
|| (type->code () == TYPE_CODE_DECFLOAT
&& tdep->soft_float)))
{
@@ -314,7 +312,8 @@ ppc_sysv_abi_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
if (write_pass)
{
- regcache->cooked_write (tdep->ppc_fp0_regnum + freg, val);
+ regcache->cooked_write (tdep->ppc_fp0_regnum + freg,
+ val);
regcache->cooked_write (tdep->ppc_fp0_regnum + freg + 1,
val + 8);
}
@@ -335,10 +334,8 @@ ppc_sysv_abi_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
Hence we increase freg even when writing to memory. */
freg += 2;
}
- else if (len < 16
- && type->code () == TYPE_CODE_ARRAY
- && type->is_vector ()
- && opencl_abi)
+ else if (len < 16 && type->code () == TYPE_CODE_ARRAY
+ && type->is_vector () && opencl_abi)
{
/* OpenCL vectors shorter than 16 bytes are passed as if
a series of independent scalars. */
@@ -359,8 +356,8 @@ ppc_sysv_abi_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
gdb_byte regval[PPC_MAX_REGISTER_SIZE];
struct type *regtype
= register_type (gdbarch, regnum);
- target_float_convert (elval, eltype,
- regval, regtype);
+ target_float_convert (elval, eltype, regval,
+ regtype);
regcache->cooked_write (regnum, regval);
}
freg++;
@@ -408,7 +405,8 @@ ppc_sysv_abi_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
if (greg <= 10)
{
if (write_pass)
- regcache->cooked_write (tdep->ppc_gp0_regnum + greg,
+ regcache->cooked_write (tdep->ppc_gp0_regnum
+ + greg,
word);
greg++;
}
@@ -416,16 +414,15 @@ ppc_sysv_abi_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
{
argoffset = align_up (argoffset, tdep->wordsize);
if (write_pass)
- write_memory (sp + argoffset, word, tdep->wordsize);
+ write_memory (sp + argoffset, word,
+ tdep->wordsize);
argoffset += tdep->wordsize;
}
}
}
}
- else if (len >= 16
- && type->code () == TYPE_CODE_ARRAY
- && type->is_vector ()
- && opencl_abi)
+ else if (len >= 16 && type->code () == TYPE_CODE_ARRAY
+ && type->is_vector () && opencl_abi)
{
/* OpenCL vectors 16 bytes or longer are passed as if
a series of AltiVec vectors. */
@@ -452,12 +449,11 @@ ppc_sysv_abi_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
}
}
else if (len == 16
- && ((type->code () == TYPE_CODE_ARRAY
- && type->is_vector ()
+ && ((type->code () == TYPE_CODE_ARRAY && type->is_vector ()
&& tdep->vector_abi == POWERPC_VEC_ALTIVEC)
- || (type->code () == TYPE_CODE_FLT
- && (gdbarch_long_double_format (gdbarch)
- == floatformats_ieee_quad))))
+ || (type->code () == TYPE_CODE_FLT
+ && (gdbarch_long_double_format (gdbarch)
+ == floatformats_ieee_quad))))
{
/* Vector parameter passed in an Altivec register, or
when that runs out, 16 byte aligned stack location.
@@ -477,8 +473,7 @@ ppc_sysv_abi_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
argoffset += 16;
}
}
- else if (len == 8
- && type->code () == TYPE_CODE_ARRAY
+ else if (len == 8 && type->code () == TYPE_CODE_ARRAY
&& type->is_vector ()
&& tdep->vector_abi == POWERPC_VEC_SPE)
{
@@ -509,14 +504,12 @@ ppc_sysv_abi_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
"word". */
gdb_byte word[PPC_MAX_REGISTER_SIZE];
memset (word, 0, PPC_MAX_REGISTER_SIZE);
- if (len > tdep->wordsize
- || type->code () == TYPE_CODE_STRUCT
+ if (len > tdep->wordsize || type->code () == TYPE_CODE_STRUCT
|| type->code () == TYPE_CODE_UNION)
{
/* Structs and large values are put in an
aligned stack slot ... */
- if (type->code () == TYPE_CODE_ARRAY
- && type->is_vector ()
+ if (type->code () == TYPE_CODE_ARRAY && type->is_vector ()
&& len >= 16)
structoffset = align_up (structoffset, 16);
else
@@ -656,7 +649,7 @@ get_decimal_float_return_value (struct gdbarch *gdbarch, struct type *valtype,
}
else
/* Can't happen. */
- internal_error (_("Unknown decimal float size."));
+ internal_error (_ ("Unknown decimal float size."));
return RETURN_VALUE_REGISTER_CONVENTION;
}
@@ -684,12 +677,11 @@ do_ppc_sysv_return_value (struct gdbarch *gdbarch, struct type *func_type,
{
ppc_gdbarch_tdep *tdep = gdbarch_tdep<ppc_gdbarch_tdep> (gdbarch);
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
- int opencl_abi = func_type? ppc_sysv_use_opencl_abi (func_type) : 0;
+ int opencl_abi = func_type ? ppc_sysv_use_opencl_abi (func_type) : 0;
gdb_assert (tdep->wordsize == 4);
- if (type->code () == TYPE_CODE_FLT
- && type->length () <= 8
+ if (type->code () == TYPE_CODE_FLT && type->length () <= 8
&& !tdep->soft_float)
{
if (readbuf)
@@ -697,8 +689,8 @@ do_ppc_sysv_return_value (struct gdbarch *gdbarch, struct type *func_type,
/* Floats and doubles stored in "f1". Convert the value to
the required type. */
gdb_byte regval[PPC_MAX_REGISTER_SIZE];
- struct type *regtype = register_type (gdbarch,
- tdep->ppc_fp0_regnum + 1);
+ struct type *regtype
+ = register_type (gdbarch, tdep->ppc_fp0_regnum + 1);
regcache->cooked_read (tdep->ppc_fp0_regnum + 1, regval);
target_float_convert (regval, regtype, readbuf, type);
}
@@ -713,8 +705,7 @@ do_ppc_sysv_return_value (struct gdbarch *gdbarch, struct type *func_type,
}
return RETURN_VALUE_REGISTER_CONVENTION;
}
- if (type->code () == TYPE_CODE_FLT
- && type->length () == 16
+ if (type->code () == TYPE_CODE_FLT && type->length () == 16
&& !tdep->soft_float
&& (gdbarch_long_double_format (gdbarch)
== floatformats_ibm_long_double))
@@ -780,11 +771,9 @@ do_ppc_sysv_return_value (struct gdbarch *gdbarch, struct type *func_type,
if (type->code () == TYPE_CODE_DECFLOAT && !tdep->soft_float)
return get_decimal_float_return_value (gdbarch, type, regcache, readbuf,
writebuf);
- else if ((type->code () == TYPE_CODE_INT
- || type->code () == TYPE_CODE_CHAR
+ else if ((type->code () == TYPE_CODE_INT || type->code () == TYPE_CODE_CHAR
|| type->code () == TYPE_CODE_BOOL
- || type->code () == TYPE_CODE_PTR
- || TYPE_IS_REFERENCE (type)
+ || type->code () == TYPE_CODE_PTR || TYPE_IS_REFERENCE (type)
|| type->code () == TYPE_CODE_ENUM)
&& type->length () <= tdep->wordsize)
{
@@ -810,10 +799,8 @@ do_ppc_sysv_return_value (struct gdbarch *gdbarch, struct type *func_type,
}
/* OpenCL vectors < 16 bytes are returned as distinct
scalars in f1..f2 or r3..r10. */
- if (type->code () == TYPE_CODE_ARRAY
- && type->is_vector ()
- && type->length () < 16
- && opencl_abi)
+ if (type->code () == TYPE_CODE_ARRAY && type->is_vector ()
+ && type->length () < 16 && opencl_abi)
{
struct type *eltype = check_typedef (type->target_type ());
int i, nelt = type->length () / eltype->length ();
@@ -830,15 +817,15 @@ do_ppc_sysv_return_value (struct gdbarch *gdbarch, struct type *func_type,
if (writebuf != NULL)
{
- target_float_convert (writebuf + offset, eltype,
- regval, regtype);
+ target_float_convert (writebuf + offset, eltype, regval,
+ regtype);
regcache->cooked_write (regnum, regval);
}
if (readbuf != NULL)
{
regcache->cooked_read (regnum, regval);
- target_float_convert (regval, regtype,
- readbuf + offset, eltype);
+ target_float_convert (regval, regtype, readbuf + offset,
+ eltype);
}
}
else
@@ -854,9 +841,8 @@ do_ppc_sysv_return_value (struct gdbarch *gdbarch, struct type *func_type,
if (readbuf != NULL)
{
regcache_cooked_read_unsigned (regcache, regnum, &regval);
- store_unsigned_integer (readbuf + offset,
- eltype->length (), byte_order,
- regval);
+ store_unsigned_integer (readbuf + offset, eltype->length (),
+ byte_order, regval);
}
}
}
@@ -864,10 +850,8 @@ do_ppc_sysv_return_value (struct gdbarch *gdbarch, struct type *func_type,
return RETURN_VALUE_REGISTER_CONVENTION;
}
/* OpenCL vectors >= 16 bytes are returned in v2..v9. */
- if (type->code () == TYPE_CODE_ARRAY
- && type->is_vector ()
- && type->length () >= 16
- && opencl_abi)
+ if (type->code () == TYPE_CODE_ARRAY && type->is_vector ()
+ && type->length () >= 16 && opencl_abi)
{
int n_regs = type->length () / 16;
int i;
@@ -885,10 +869,8 @@ do_ppc_sysv_return_value (struct gdbarch *gdbarch, struct type *func_type,
return RETURN_VALUE_REGISTER_CONVENTION;
}
- if (type->length () == 16
- && type->code () == TYPE_CODE_ARRAY
- && type->is_vector ()
- && tdep->vector_abi == POWERPC_VEC_ALTIVEC)
+ if (type->length () == 16 && type->code () == TYPE_CODE_ARRAY
+ && type->is_vector () && tdep->vector_abi == POWERPC_VEC_ALTIVEC)
{
if (readbuf)
{
@@ -902,10 +884,8 @@ do_ppc_sysv_return_value (struct gdbarch *gdbarch, struct type *func_type,
}
return RETURN_VALUE_REGISTER_CONVENTION;
}
- if (type->length () == 16
- && type->code () == TYPE_CODE_ARRAY
- && type->is_vector ()
- && tdep->vector_abi == POWERPC_VEC_GENERIC)
+ if (type->length () == 16 && type->code () == TYPE_CODE_ARRAY
+ && type->is_vector () && tdep->vector_abi == POWERPC_VEC_GENERIC)
{
/* GCC -maltivec -mabi=no-altivec returns vectors in r3/r4/r5/r6.
GCC without AltiVec returns them in memory, but it warns about
@@ -926,10 +906,8 @@ do_ppc_sysv_return_value (struct gdbarch *gdbarch, struct type *func_type,
}
return RETURN_VALUE_REGISTER_CONVENTION;
}
- if (type->length () == 8
- && type->code () == TYPE_CODE_ARRAY
- && type->is_vector ()
- && tdep->vector_abi == POWERPC_VEC_SPE)
+ if (type->length () == 8 && type->code () == TYPE_CODE_ARRAY
+ && type->is_vector () && tdep->vector_abi == POWERPC_VEC_SPE)
{
/* The e500 ABI places return values for the 64-bit DSP types
(__ev64_opaque__) in r3. However, in GDB-speak, ev3
@@ -1019,10 +997,9 @@ ppc_sysv_abi_return_value (struct gdbarch *gdbarch, struct value *function,
enum return_value_convention
ppc_sysv_abi_broken_return_value (struct gdbarch *gdbarch,
- struct value *function,
- struct type *valtype,
- struct regcache *regcache,
- gdb_byte *readbuf, const gdb_byte *writebuf)
+ struct value *function, struct type *valtype,
+ struct regcache *regcache, gdb_byte *readbuf,
+ const gdb_byte *writebuf)
{
return do_ppc_sysv_return_value (gdbarch,
function ? value_type (function) : NULL,
@@ -1078,8 +1055,7 @@ convert_code_addr_to_desc_addr (CORE_ADDR code_addr, CORE_ADDR *desc_addr)
sub-tree. */
static LONGEST
-ppc64_aggregate_candidate (struct type *type,
- struct type **field_type)
+ppc64_aggregate_candidate (struct type *type, struct type **field_type)
{
type = check_typedef (type);
@@ -1120,8 +1096,7 @@ ppc64_aggregate_candidate (struct type *type,
{
LONGEST count, low_bound, high_bound;
- count = ppc64_aggregate_candidate
- (type->target_type (), field_type);
+ count = ppc64_aggregate_candidate (type->target_type (), field_type);
if (count == -1)
return -1;
@@ -1141,36 +1116,36 @@ ppc64_aggregate_candidate (struct type *type,
case TYPE_CODE_STRUCT:
case TYPE_CODE_UNION:
- {
- LONGEST count = 0;
- int i;
+ {
+ LONGEST count = 0;
+ int i;
- for (i = 0; i < type->num_fields (); i++)
- {
- LONGEST sub_count;
+ for (i = 0; i < type->num_fields (); i++)
+ {
+ LONGEST sub_count;
- if (field_is_static (&type->field (i)))
- continue;
+ if (field_is_static (&type->field (i)))
+ continue;
- sub_count = ppc64_aggregate_candidate
- (type->field (i).type (), field_type);
- if (sub_count == -1)
- return -1;
+ sub_count = ppc64_aggregate_candidate (type->field (i).type (),
+ field_type);
+ if (sub_count == -1)
+ return -1;
- if (type->code () == TYPE_CODE_STRUCT)
- count += sub_count;
- else
- count = std::max (count, sub_count);
- }
+ if (type->code () == TYPE_CODE_STRUCT)
+ count += sub_count;
+ else
+ count = std::max (count, sub_count);
+ }
- /* There must be no padding. */
- if (count == 0)
- return type->length () == 0 ? 0 : -1;
- else if (type->length () != count * (*field_type)->length ())
- return -1;
+ /* There must be no padding. */
+ if (count == 0)
+ return type->length () == 0 ? 0 : -1;
+ else if (type->length () != count * (*field_type)->length ())
+ return -1;
- return count;
- }
+ return count;
+ }
break;
default:
@@ -1192,8 +1167,7 @@ ppc64_elfv2_abi_homogeneous_aggregate (struct type *type,
{
/* Complex types at the top level are treated separately. However,
complex types can be elements of homogeneous aggregates. */
- if (type->code () == TYPE_CODE_STRUCT
- || type->code () == TYPE_CODE_UNION
+ if (type->code () == TYPE_CODE_STRUCT || type->code () == TYPE_CODE_UNION
|| (type->code () == TYPE_CODE_ARRAY && !type->is_vector ()))
{
struct type *field_type = NULL;
@@ -1238,24 +1212,24 @@ ppc64_elfv2_abi_homogeneous_aggregate (struct type *type,
/* Structure holding the next argument position. */
struct ppc64_sysv_argpos
- {
- /* Register cache holding argument registers. If this is NULL,
+{
+ /* Register cache holding argument registers. If this is NULL,
we only simulate argument processing without actually updating
any registers or memory. */
- struct regcache *regcache;
- /* Next available general-purpose argument register. */
- int greg;
- /* Next available floating-point argument register. */
- int freg;
- /* Next available vector argument register. */
- int vreg;
- /* The address, at which the next general purpose parameter
+ struct regcache *regcache;
+ /* Next available general-purpose argument register. */
+ int greg;
+ /* Next available floating-point argument register. */
+ int freg;
+ /* Next available vector argument register. */
+ int vreg;
+ /* The address, at which the next general purpose parameter
(integer, struct, float, vector, ...) should be saved. */
- CORE_ADDR gparam;
- /* The address, at which the next by-reference parameter
+ CORE_ADDR gparam;
+ /* The address, at which the next by-reference parameter
(non-Altivec vector, variably-sized type) should be saved. */
- CORE_ADDR refparam;
- };
+ CORE_ADDR refparam;
+};
/* VAL is a value of length LEN. Store it into the argument area on the
stack and load it into the corresponding general-purpose registers
@@ -1265,9 +1239,8 @@ struct ppc64_sysv_argpos
for the on-stack copy of the argument. */
static void
-ppc64_sysv_abi_push_val (struct gdbarch *gdbarch,
- const bfd_byte *val, int len, int align,
- struct ppc64_sysv_argpos *argpos)
+ppc64_sysv_abi_push_val (struct gdbarch *gdbarch, const bfd_byte *val, int len,
+ int align, struct ppc64_sysv_argpos *argpos)
{
ppc_gdbarch_tdep *tdep = gdbarch_tdep<ppc_gdbarch_tdep> (gdbarch);
int offset = 0;
@@ -1285,8 +1258,7 @@ ppc64_sysv_abi_push_val (struct gdbarch *gdbarch,
doubleword are right-aligned and those larger are left-aligned.
GCC versions before 3.4 implemented this incorrectly; see
<http://gcc.gnu.org/gcc-3.4/powerpc-abi.html>. */
- if (len < tdep->wordsize
- && gdbarch_byte_order (gdbarch) == BFD_ENDIAN_BIG)
+ if (len < tdep->wordsize && gdbarch_byte_order (gdbarch) == BFD_ENDIAN_BIG)
offset = tdep->wordsize - len;
if (argpos->regcache)
@@ -1306,8 +1278,9 @@ ppc64_sysv_abi_push_val (struct gdbarch *gdbarch,
if (len > 0)
{
if (argpos->regcache && argpos->greg <= 10)
- argpos->regcache->cooked_write_part
- (tdep->ppc_gp0_regnum + argpos->greg, offset, len, val);
+ argpos->regcache->cooked_write_part (tdep->ppc_gp0_regnum
+ + argpos->greg,
+ offset, len, val);
argpos->greg++;
}
}
@@ -1333,16 +1306,15 @@ ppc64_sysv_abi_push_integer (struct gdbarch *gdbarch, ULONGEST val,
and update ARGPOS. */
static void
-ppc64_sysv_abi_push_freg (struct gdbarch *gdbarch,
- struct type *type, const bfd_byte *val,
+ppc64_sysv_abi_push_freg (struct gdbarch *gdbarch, struct type *type,
+ const bfd_byte *val,
struct ppc64_sysv_argpos *argpos)
{
ppc_gdbarch_tdep *tdep = gdbarch_tdep<ppc_gdbarch_tdep> (gdbarch);
if (tdep->soft_float)
return;
- if (type->length () <= 8
- && type->code () == TYPE_CODE_FLT)
+ if (type->length () <= 8 && type->code () == TYPE_CODE_FLT)
{
/* Floats and doubles go in f1 .. f13. 32-bit floats are converted
to double first. */
@@ -1358,8 +1330,7 @@ ppc64_sysv_abi_push_freg (struct gdbarch *gdbarch,
argpos->freg++;
}
- else if (type->length () <= 8
- && type->code () == TYPE_CODE_DECFLOAT)
+ else if (type->length () <= 8 && type->code () == TYPE_CODE_DECFLOAT)
{
/* Floats and doubles go in f1 .. f13. 32-bit decimal floats are
placed in the least significant word. */
@@ -1371,14 +1342,13 @@ ppc64_sysv_abi_push_freg (struct gdbarch *gdbarch,
if (gdbarch_byte_order (gdbarch) == BFD_ENDIAN_BIG)
offset = 8 - type->length ();
- argpos->regcache->cooked_write_part (regnum, offset,
- type->length (), val);
+ argpos->regcache->cooked_write_part (regnum, offset, type->length (),
+ val);
}
argpos->freg++;
}
- else if (type->length () == 16
- && type->code () == TYPE_CODE_FLT
+ else if (type->length () == 16 && type->code () == TYPE_CODE_FLT
&& (gdbarch_long_double_format (gdbarch)
== floatformats_ibm_long_double))
{
@@ -1394,8 +1364,7 @@ ppc64_sysv_abi_push_freg (struct gdbarch *gdbarch,
argpos->freg += 2;
}
- else if (type->length () == 16
- && type->code () == TYPE_CODE_DECFLOAT)
+ else if (type->length () == 16 && type->code () == TYPE_CODE_DECFLOAT)
{
/* 128-bit decimal floating-point values are stored in and even/odd
pair of FPRs, with the even FPR holding the most significant half. */
@@ -1434,16 +1403,14 @@ ppc64_sysv_abi_push_vreg (struct gdbarch *gdbarch, const bfd_byte *val,
as required by the ABI, and update ARGPOS. */
static void
-ppc64_sysv_abi_push_param (struct gdbarch *gdbarch,
- struct type *type, const bfd_byte *val,
+ppc64_sysv_abi_push_param (struct gdbarch *gdbarch, struct type *type,
+ const bfd_byte *val,
struct ppc64_sysv_argpos *argpos)
{
ppc_gdbarch_tdep *tdep = gdbarch_tdep<ppc_gdbarch_tdep> (gdbarch);
- if (type->code () == TYPE_CODE_FLT
- && type->length () == 16
- && (gdbarch_long_double_format (gdbarch)
- == floatformats_ieee_quad))
+ if (type->code () == TYPE_CODE_FLT && type->length () == 16
+ && (gdbarch_long_double_format (gdbarch) == floatformats_ieee_quad))
{
/* IEEE FLOAT128, args in vector registers. */
ppc64_sysv_abi_push_val (gdbarch, val, type->length (), 16, argpos);
@@ -1457,8 +1424,7 @@ ppc64_sysv_abi_push_param (struct gdbarch *gdbarch,
ppc64_sysv_abi_push_freg (gdbarch, type, val, argpos);
}
else if (type->code () == TYPE_CODE_ARRAY && type->is_vector ()
- && tdep->vector_abi == POWERPC_VEC_ALTIVEC
- && type->length () == 16)
+ && tdep->vector_abi == POWERPC_VEC_ALTIVEC && type->length () == 16)
{
/* AltiVec vectors are passed aligned, and in vector registers. */
ppc64_sysv_abi_push_val (gdbarch, val, type->length (), 16, argpos);
@@ -1478,12 +1444,10 @@ ppc64_sysv_abi_push_param (struct gdbarch *gdbarch,
/* ... and pass a pointer to the copy as parameter. */
ppc64_sysv_abi_push_integer (gdbarch, addr, argpos);
}
- else if ((type->code () == TYPE_CODE_INT
- || type->code () == TYPE_CODE_ENUM
+ else if ((type->code () == TYPE_CODE_INT || type->code () == TYPE_CODE_ENUM
|| type->code () == TYPE_CODE_BOOL
|| type->code () == TYPE_CODE_CHAR
- || type->code () == TYPE_CODE_PTR
- || TYPE_IS_REFERENCE (type))
+ || type->code () == TYPE_CODE_PTR || TYPE_IS_REFERENCE (type))
&& type->length () <= tdep->wordsize)
{
ULONGEST word = 0;
@@ -1498,8 +1462,7 @@ ppc64_sysv_abi_push_param (struct gdbarch *gdbarch,
&& (type->code () == TYPE_CODE_PTR
|| type->code () == TYPE_CODE_REF))
{
- struct type *target_type
- = check_typedef (type->target_type ());
+ struct type *target_type = check_typedef (type->target_type ());
if (target_type->code () == TYPE_CODE_FUNC
|| target_type->code () == TYPE_CODE_METHOD)
@@ -1524,26 +1487,26 @@ ppc64_sysv_abi_push_param (struct gdbarch *gdbarch,
/* The ABI (version 1.9) specifies that structs containing a
single floating-point value, at any level of nesting of
single-member structs, are passed in floating-point registers. */
- if (type->code () == TYPE_CODE_STRUCT
- && type->num_fields () == 1 && tdep->elf_abi == POWERPC_ELF_V1)
+ if (type->code () == TYPE_CODE_STRUCT && type->num_fields () == 1
+ && tdep->elf_abi == POWERPC_ELF_V1)
{
- while (type->code () == TYPE_CODE_STRUCT
- && type->num_fields () == 1)
+ while (type->code () == TYPE_CODE_STRUCT && type->num_fields () == 1)
type = check_typedef (type->field (0).type ());
- if (type->code () == TYPE_CODE_FLT) {
- /* Handle the case of 128-bit floats for both IEEE and IBM long double
+ if (type->code () == TYPE_CODE_FLT)
+ {
+ /* Handle the case of 128-bit floats for both IEEE and IBM long double
formats. */
- if (type->length () == 16
- && (gdbarch_long_double_format (gdbarch)
- == floatformats_ieee_quad))
- {
- ppc64_sysv_abi_push_vreg (gdbarch, val, argpos);
- align = 16;
- }
- else
- ppc64_sysv_abi_push_freg (gdbarch, type, val, argpos);
- }
+ if (type->length () == 16
+ && (gdbarch_long_double_format (gdbarch)
+ == floatformats_ieee_quad))
+ {
+ ppc64_sysv_abi_push_vreg (gdbarch, val, argpos);
+ align = 16;
+ }
+ else
+ ppc64_sysv_abi_push_freg (gdbarch, type, val, argpos);
+ }
}
/* In the ELFv2 ABI, homogeneous floating-point or vector
@@ -1559,18 +1522,17 @@ ppc64_sysv_abi_push_param (struct gdbarch *gdbarch,
{
const gdb_byte *elval = val + i * eltype->length ();
- if (eltype->code () == TYPE_CODE_FLT
- && eltype->length () == 16
+ if (eltype->code () == TYPE_CODE_FLT && eltype->length () == 16
&& (gdbarch_long_double_format (gdbarch)
== floatformats_ieee_quad))
- /* IEEE FLOAT128, args in vector registers. */
+ /* IEEE FLOAT128, args in vector registers. */
{
ppc64_sysv_abi_push_vreg (gdbarch, elval, argpos);
align = 16;
}
else if (eltype->code () == TYPE_CODE_FLT
- || eltype->code () == TYPE_CODE_DECFLOAT)
- /* IBM long double and all other floats and decfloats, args
+ || eltype->code () == TYPE_CODE_DECFLOAT)
+ /* IBM long double and all other floats and decfloats, args
are in a pair of floating point registers. */
ppc64_sysv_abi_push_freg (gdbarch, eltype, elval, argpos);
else if (eltype->code () == TYPE_CODE_ARRAY
@@ -1701,7 +1663,7 @@ ppc64_sysv_abi_push_dummy_call (struct gdbarch *gdbarch,
ppc64_sysv_abi_push_param (gdbarch, eltype, val, &argpos);
ppc64_sysv_abi_push_param (gdbarch, eltype,
- val + eltype->length (), &argpos);
+ val + eltype->length (), &argpos);
}
else if (type->code () == TYPE_CODE_ARRAY && type->is_vector ()
&& opencl_abi)
@@ -1767,20 +1729,20 @@ ppc64_sysv_abi_push_dummy_call (struct gdbarch *gdbarch,
|| convert_code_addr_to_desc_addr (func_addr, &desc_addr))
{
/* The TOC is the second double word in the descriptor. */
- CORE_ADDR toc =
- read_memory_unsigned_integer (desc_addr + tdep->wordsize,
- tdep->wordsize, byte_order);
+ CORE_ADDR toc
+ = read_memory_unsigned_integer (desc_addr + tdep->wordsize,
+ tdep->wordsize, byte_order);
- regcache_cooked_write_unsigned (regcache,
- tdep->ppc_gp0_regnum + 2, toc);
+ regcache_cooked_write_unsigned (regcache, tdep->ppc_gp0_regnum + 2,
+ toc);
}
}
/* In the ELFv2 ABI, we need to pass the target address in r12 since
we may be calling a global entry point. */
if (tdep->elf_abi == POWERPC_ELF_V2)
- regcache_cooked_write_unsigned (regcache,
- tdep->ppc_gp0_regnum + 12, func_addr);
+ regcache_cooked_write_unsigned (regcache, tdep->ppc_gp0_regnum + 12,
+ func_addr);
return sp;
}
@@ -1794,19 +1756,18 @@ ppc64_sysv_abi_push_dummy_call (struct gdbarch *gdbarch,
Returns true if VALTYPE is some such base type that could be handled,
false otherwise. */
static int
-ppc64_sysv_abi_return_value_base (struct gdbarch *gdbarch, struct type *valtype,
+ppc64_sysv_abi_return_value_base (struct gdbarch *gdbarch,
+ struct type *valtype,
struct regcache *regcache, gdb_byte *readbuf,
const gdb_byte *writebuf, int index)
{
ppc_gdbarch_tdep *tdep = gdbarch_tdep<ppc_gdbarch_tdep> (gdbarch);
/* Integers live in GPRs starting at r3. */
- if ((valtype->code () == TYPE_CODE_INT
- || valtype->code () == TYPE_CODE_ENUM
+ if ((valtype->code () == TYPE_CODE_INT || valtype->code () == TYPE_CODE_ENUM
|| valtype->code () == TYPE_CODE_CHAR
|| valtype->code () == TYPE_CODE_BOOL
- || valtype->code () == TYPE_CODE_RANGE
- || is_fixed_point_type (valtype))
+ || valtype->code () == TYPE_CODE_RANGE || is_fixed_point_type (valtype))
&& valtype->length () <= 8)
{
int regnum = tdep->ppc_gp0_regnum + 3 + index;
@@ -1847,8 +1808,7 @@ ppc64_sysv_abi_return_value_base (struct gdbarch *gdbarch, struct type *valtype,
/* Floats and doubles go in f1 .. f13. 32-bit floats are converted
to double first. */
- if (valtype->length () <= 8
- && valtype->code () == TYPE_CODE_FLT)
+ if (valtype->length () <= 8 && valtype->code () == TYPE_CODE_FLT)
{
int regnum = tdep->ppc_fp0_regnum + 1 + index;
struct type *regtype = register_type (gdbarch, regnum);
@@ -1869,8 +1829,7 @@ ppc64_sysv_abi_return_value_base (struct gdbarch *gdbarch, struct type *valtype,
/* Floats and doubles go in f1 .. f13. 32-bit decimal floats are
placed in the least significant word. */
- if (valtype->length () <= 8
- && valtype->code () == TYPE_CODE_DECFLOAT)
+ if (valtype->length () <= 8 && valtype->code () == TYPE_CODE_DECFLOAT)
{
int regnum = tdep->ppc_fp0_regnum + 1 + index;
int offset = 0;
@@ -1888,8 +1847,7 @@ ppc64_sysv_abi_return_value_base (struct gdbarch *gdbarch, struct type *valtype,
}
/* IBM long double stored in two consecutive FPRs. */
- if (valtype->length () == 16
- && valtype->code () == TYPE_CODE_FLT
+ if (valtype->length () == 16 && valtype->code () == TYPE_CODE_FLT
&& (gdbarch_long_double_format (gdbarch)
== floatformats_ibm_long_double))
{
@@ -1910,8 +1868,7 @@ ppc64_sysv_abi_return_value_base (struct gdbarch *gdbarch, struct type *valtype,
/* 128-bit decimal floating-point values are stored in an even/odd
pair of FPRs, with the even FPR holding the most significant half. */
- if (valtype->length () == 16
- && valtype->code () == TYPE_CODE_DECFLOAT)
+ if (valtype->length () == 16 && valtype->code () == TYPE_CODE_DECFLOAT)
{
int regnum = tdep->ppc_fp0_regnum + 2 + 2 * index;
int lopart = gdbarch_byte_order (gdbarch) == BFD_ENDIAN_BIG ? 8 : 0;
@@ -1934,8 +1891,7 @@ ppc64_sysv_abi_return_value_base (struct gdbarch *gdbarch, struct type *valtype,
IEEE FLOAT 128-bit are stored in vector register. */
if (valtype->length () == 16
- && ((valtype->code () == TYPE_CODE_ARRAY
- && valtype->is_vector ()
+ && ((valtype->code () == TYPE_CODE_ARRAY && valtype->is_vector ()
&& tdep->vector_abi == POWERPC_VEC_ALTIVEC)
|| (valtype->code () == TYPE_CODE_FLT
&& (gdbarch_long_double_format (gdbarch)
@@ -1951,8 +1907,8 @@ ppc64_sysv_abi_return_value_base (struct gdbarch *gdbarch, struct type *valtype,
}
/* Short vectors are returned in GPRs starting at r3. */
- if (valtype->length () <= 8
- && valtype->code () == TYPE_CODE_ARRAY && valtype->is_vector ())
+ if (valtype->length () <= 8 && valtype->code () == TYPE_CODE_ARRAY
+ && valtype->is_vector ())
{
int regnum = tdep->ppc_gp0_regnum + 3 + index;
int offset = 0;
@@ -1989,7 +1945,7 @@ ppc64_sysv_abi_return_value (struct gdbarch *gdbarch, struct value *function,
{
ppc_gdbarch_tdep *tdep = gdbarch_tdep<ppc_gdbarch_tdep> (gdbarch);
struct type *func_type = function ? value_type (function) : NULL;
- int opencl_abi = func_type? ppc_sysv_use_opencl_abi (func_type) : 0;
+ int opencl_abi = func_type ? ppc_sysv_use_opencl_abi (func_type) : 0;
struct type *eltype;
int nelt, ok;
@@ -2056,8 +2012,7 @@ ppc64_sysv_abi_return_value (struct gdbarch *gdbarch, struct value *function,
}
/* Small character arrays are returned, right justified, in r3. */
- if (valtype->code () == TYPE_CODE_ARRAY
- && !valtype->is_vector ()
+ if (valtype->code () == TYPE_CODE_ARRAY && !valtype->is_vector ()
&& valtype->length () <= 8
&& valtype->target_type ()->code () == TYPE_CODE_INT
&& valtype->target_type ()->length () == 1)
@@ -2081,8 +2036,7 @@ ppc64_sysv_abi_return_value (struct gdbarch *gdbarch, struct value *function,
gdbarch)
&& (eltype->code () == TYPE_CODE_FLT
|| eltype->code () == TYPE_CODE_DECFLOAT
- || (eltype->code () == TYPE_CODE_ARRAY
- && eltype->is_vector ()
+ || (eltype->code () == TYPE_CODE_ARRAY && eltype->is_vector ()
&& tdep->vector_abi == POWERPC_VEC_ALTIVEC
&& eltype->length () == 16)))
{
@@ -2107,15 +2061,13 @@ ppc64_sysv_abi_return_value (struct gdbarch *gdbarch, struct value *function,
/* In the ELFv2 ABI, aggregate types of up to 16 bytes are
returned in registers r3:r4. */
- if (tdep->elf_abi == POWERPC_ELF_V2
- && valtype->length () <= 16
+ if (tdep->elf_abi == POWERPC_ELF_V2 && valtype->length () <= 16
&& (valtype->code () == TYPE_CODE_STRUCT
|| valtype->code () == TYPE_CODE_UNION
- || (valtype->code () == TYPE_CODE_ARRAY
- && !valtype->is_vector ())))
+ || (valtype->code () == TYPE_CODE_ARRAY && !valtype->is_vector ())))
{
- int n_regs = ((valtype->length () + tdep->wordsize - 1)
- / tdep->wordsize);
+ int n_regs
+ = ((valtype->length () + tdep->wordsize - 1) / tdep->wordsize);
for (int i = 0; i < n_regs; i++)
{
@@ -2151,8 +2103,8 @@ ppc64_sysv_abi_return_value (struct gdbarch *gdbarch, struct value *function,
}
/* Handle plain base types. */
- if (ppc64_sysv_abi_return_value_base (gdbarch, valtype, regcache,
- readbuf, writebuf, 0))
+ if (ppc64_sysv_abi_return_value_base (gdbarch, valtype, regcache, readbuf,
+ writebuf, 0))
return RETURN_VALUE_REGISTER_CONVENTION;
return RETURN_VALUE_STRUCT_CONVENTION;
@@ -2179,7 +2131,7 @@ ppc64_sysv_get_return_buf_addr (struct type *val_type,
enum call_site_parameter_kind kind;
CORE_ADDR return_val = 0;
- kind_u.dwarf_reg = 3; /* First passed arg/return value is in r3. */
+ kind_u.dwarf_reg = 3; /* First passed arg/return value is in r3. */
kind = CALL_SITE_PARAMETER_DWARF_REG;
/* val_type is the type of the return value. Need the pointer type
@@ -2188,9 +2140,9 @@ ppc64_sysv_get_return_buf_addr (struct type *val_type,
try
{
- return_val = value_as_address (value_of_dwarf_reg_entry (val_type,
- cur_frame,
- kind, kind_u));
+ return_val
+ = value_as_address (value_of_dwarf_reg_entry (val_type, cur_frame,
+ kind, kind_u));
}
catch (const gdb_exception_error &e)
{
diff --git a/gdb/ppc-tdep.h b/gdb/ppc-tdep.h
index fe41baef149..a7853acf206 100644
--- a/gdb/ppc-tdep.h
+++ b/gdb/ppc-tdep.h
@@ -29,35 +29,28 @@ struct regcache;
struct type;
/* From ppc-sysv-tdep.c ... */
-enum return_value_convention ppc_sysv_abi_return_value (struct gdbarch *gdbarch,
- struct value *function,
- struct type *valtype,
- struct regcache *regcache,
- gdb_byte *readbuf,
- const gdb_byte *writebuf);
-enum return_value_convention ppc_sysv_abi_broken_return_value (struct gdbarch *gdbarch,
- struct value *function,
- struct type *valtype,
- struct regcache *regcache,
- gdb_byte *readbuf,
- const gdb_byte *writebuf);
-
-CORE_ADDR ppc_sysv_abi_push_dummy_call
- (struct gdbarch *gdbarch, struct value *function, struct regcache *regcache,
- CORE_ADDR bp_addr, int nargs, struct value **args, CORE_ADDR sp,
- function_call_return_method return_method, CORE_ADDR struct_addr);
-
-CORE_ADDR ppc64_sysv_abi_push_dummy_call
- (struct gdbarch *gdbarch, struct value *function, struct regcache *regcache,
- CORE_ADDR bp_addr, int nargs, struct value **args, CORE_ADDR sp,
- function_call_return_method return_method, CORE_ADDR struct_addr);
-
-enum return_value_convention ppc64_sysv_abi_return_value (struct gdbarch *gdbarch,
- struct value *function,
- struct type *valtype,
- struct regcache *regcache,
- gdb_byte *readbuf,
- const gdb_byte *writebuf);
+enum return_value_convention
+ppc_sysv_abi_return_value (struct gdbarch *gdbarch, struct value *function,
+ struct type *valtype, struct regcache *regcache,
+ gdb_byte *readbuf, const gdb_byte *writebuf);
+enum return_value_convention ppc_sysv_abi_broken_return_value (
+ struct gdbarch *gdbarch, struct value *function, struct type *valtype,
+ struct regcache *regcache, gdb_byte *readbuf, const gdb_byte *writebuf);
+
+CORE_ADDR ppc_sysv_abi_push_dummy_call (
+ struct gdbarch *gdbarch, struct value *function, struct regcache *regcache,
+ CORE_ADDR bp_addr, int nargs, struct value **args, CORE_ADDR sp,
+ function_call_return_method return_method, CORE_ADDR struct_addr);
+
+CORE_ADDR ppc64_sysv_abi_push_dummy_call (
+ struct gdbarch *gdbarch, struct value *function, struct regcache *regcache,
+ CORE_ADDR bp_addr, int nargs, struct value **args, CORE_ADDR sp,
+ function_call_return_method return_method, CORE_ADDR struct_addr);
+
+enum return_value_convention
+ppc64_sysv_abi_return_value (struct gdbarch *gdbarch, struct value *function,
+ struct type *valtype, struct regcache *regcache,
+ gdb_byte *readbuf, const gdb_byte *writebuf);
/* From rs6000-tdep.c... */
int altivec_register_p (struct gdbarch *gdbarch, int regno);
@@ -75,9 +68,8 @@ int ppc_altivec_support_p (struct gdbarch *gdbarch);
/* Return non-zero if the architecture described by GDBARCH has
VSX registers (vsr0 --- vsr63). */
int vsx_support_p (struct gdbarch *gdbarch);
-std::vector<CORE_ADDR> ppc_deal_with_atomic_sequence
- (struct regcache *regcache);
-
+std::vector<CORE_ADDR>
+ppc_deal_with_atomic_sequence (struct regcache *regcache);
/* Register set description. */
@@ -86,7 +78,7 @@ struct ppc_reg_offsets
/* General-purpose registers. */
int r0_offset;
int gpr_size; /* size for r0-31, pc, ps, lr, ctr. */
- int xr_size; /* size for cr, xer, mq. */
+ int xr_size; /* size for cr, xer, mq. */
int pc_offset;
int ps_offset;
int cr_offset;
@@ -112,32 +104,32 @@ extern void ppc_collect_reg (const struct regcache *regcache, int regnum,
REGCACHE. If REGNUM is -1, do this for all registers in REGSET. */
extern void ppc_supply_gregset (const struct regset *regset,
- struct regcache *regcache,
- int regnum, const void *gregs, size_t len);
+ struct regcache *regcache, int regnum,
+ const void *gregs, size_t len);
/* Supply register REGNUM in the floating-point register set REGSET
from the buffer specified by FPREGS and LEN to register cache
REGCACHE. If REGNUM is -1, do this for all registers in REGSET. */
extern void ppc_supply_fpregset (const struct regset *regset,
- struct regcache *regcache,
- int regnum, const void *fpregs, size_t len);
+ struct regcache *regcache, int regnum,
+ const void *fpregs, size_t len);
/* Supply register REGNUM in the Altivec register set REGSET
from the buffer specified by VRREGS and LEN to register cache
REGCACHE. If REGNUM is -1, do this for all registers in REGSET. */
extern void ppc_supply_vrregset (const struct regset *regset,
- struct regcache *regcache,
- int regnum, const void *vrregs, size_t len);
+ struct regcache *regcache, int regnum,
+ const void *vrregs, size_t len);
/* Supply register REGNUM in the VSX register set REGSET
from the buffer specified by VSXREGS and LEN to register cache
REGCACHE. If REGNUM is -1, do this for all registers in REGSET. */
extern void ppc_supply_vsxregset (const struct regset *regset,
- struct regcache *regcache,
- int regnum, const void *vsxregs, size_t len);
+ struct regcache *regcache, int regnum,
+ const void *vsxregs, size_t len);
/* Collect register REGNUM in the general-purpose register set
REGSET, from register cache REGCACHE into the buffer specified by
@@ -145,8 +137,8 @@ extern void ppc_supply_vsxregset (const struct regset *regset,
REGSET. */
extern void ppc_collect_gregset (const struct regset *regset,
- const struct regcache *regcache,
- int regnum, void *gregs, size_t len);
+ const struct regcache *regcache, int regnum,
+ void *gregs, size_t len);
/* Collect register REGNUM in the floating-point register set
REGSET, from register cache REGCACHE into the buffer specified by
@@ -154,8 +146,8 @@ extern void ppc_collect_gregset (const struct regset *regset,
REGSET. */
extern void ppc_collect_fpregset (const struct regset *regset,
- const struct regcache *regcache,
- int regnum, void *fpregs, size_t len);
+ const struct regcache *regcache, int regnum,
+ void *fpregs, size_t len);
/* Collect register REGNUM in the Altivec register set
REGSET from register cache REGCACHE into the buffer specified by
@@ -163,8 +155,8 @@ extern void ppc_collect_fpregset (const struct regset *regset,
REGSET. */
extern void ppc_collect_vrregset (const struct regset *regset,
- const struct regcache *regcache,
- int regnum, void *vrregs, size_t len);
+ const struct regcache *regcache, int regnum,
+ void *vrregs, size_t len);
/* Collect register REGNUM in the VSX register set
REGSET from register cache REGCACHE into the buffer specified by
@@ -172,10 +164,10 @@ extern void ppc_collect_vrregset (const struct regset *regset,
REGSET. */
extern void ppc_collect_vsxregset (const struct regset *regset,
- const struct regcache *regcache,
- int regnum, void *vsxregs, size_t len);
+ const struct regcache *regcache, int regnum,
+ void *vsxregs, size_t len);
-extern CORE_ADDR ppc64_sysv_get_return_buf_addr (type*, frame_info_ptr);
+extern CORE_ADDR ppc64_sysv_get_return_buf_addr (type *, frame_info_ptr);
/* Private data that this module attaches to struct gdbarch. */
@@ -208,127 +200,132 @@ enum powerpc_long_double_abi
};
struct ppc_gdbarch_tdep : gdbarch_tdep_base
- {
- int wordsize = 0; /* Size in bytes of fixed-point word. */
- int soft_float = 0; /* Avoid FP registers for arguments? */
+{
+ int wordsize = 0; /* Size in bytes of fixed-point word. */
+ int soft_float = 0; /* Avoid FP registers for arguments? */
- enum powerpc_elf_abi elf_abi {}; /* ELF ABI version. */
+ enum powerpc_elf_abi elf_abi
+ {
+ }; /* ELF ABI version. */
- /* Format to use for the "long double" data type. */
- enum powerpc_long_double_abi long_double_abi {};
+ /* Format to use for the "long double" data type. */
+ enum powerpc_long_double_abi long_double_abi
+ {
+ };
- /* How to pass vector arguments. Never set to AUTO or LAST. */
- enum powerpc_vector_abi vector_abi {};
+ /* How to pass vector arguments. Never set to AUTO or LAST. */
+ enum powerpc_vector_abi vector_abi
+ {
+ };
- int ppc_gp0_regnum = 0; /* GPR register 0 */
- int ppc_toc_regnum = 0; /* TOC register */
- int ppc_ps_regnum = 0; /* Processor (or machine) status (%msr) */
- int ppc_cr_regnum = 0; /* Condition register */
- int ppc_lr_regnum = 0; /* Link register */
- int ppc_ctr_regnum = 0; /* Count register */
- int ppc_xer_regnum = 0; /* Integer exception register */
+ int ppc_gp0_regnum = 0; /* GPR register 0 */
+ int ppc_toc_regnum = 0; /* TOC register */
+ int ppc_ps_regnum = 0; /* Processor (or machine) status (%msr) */
+ int ppc_cr_regnum = 0; /* Condition register */
+ int ppc_lr_regnum = 0; /* Link register */
+ int ppc_ctr_regnum = 0; /* Count register */
+ int ppc_xer_regnum = 0; /* Integer exception register */
- /* Not all PPC and RS6000 variants will have the registers
+ /* Not all PPC and RS6000 variants will have the registers
represented below. A -1 is used to indicate that the register
is not present in this variant. */
- /* Floating-point registers. */
- int ppc_fp0_regnum = 0; /* Floating-point register 0. */
- int ppc_fpscr_regnum = 0; /* fp status and condition register. */
+ /* Floating-point registers. */
+ int ppc_fp0_regnum = 0; /* Floating-point register 0. */
+ int ppc_fpscr_regnum = 0; /* fp status and condition register. */
- /* Multiplier-Quotient Register (older POWER architectures only). */
- int ppc_mq_regnum = 0;
+ /* Multiplier-Quotient Register (older POWER architectures only). */
+ int ppc_mq_regnum = 0;
- /* POWER7 VSX registers. */
- int ppc_vsr0_regnum = 0; /* First VSX register. */
- int ppc_vsr0_upper_regnum = 0; /* First right most dword vsx register. */
- int ppc_efpr0_regnum = 0; /* First Extended FP register. */
+ /* POWER7 VSX registers. */
+ int ppc_vsr0_regnum = 0; /* First VSX register. */
+ int ppc_vsr0_upper_regnum = 0; /* First right most dword vsx register. */
+ int ppc_efpr0_regnum = 0; /* First Extended FP register. */
- /* Altivec registers. */
- int ppc_vr0_regnum = 0; /* First AltiVec register. */
- int ppc_vrsave_regnum = 0; /* Last AltiVec register. */
+ /* Altivec registers. */
+ int ppc_vr0_regnum = 0; /* First AltiVec register. */
+ int ppc_vrsave_regnum = 0; /* Last AltiVec register. */
- /* Altivec pseudo-register vX aliases for the raw vrX
+ /* Altivec pseudo-register vX aliases for the raw vrX
registers. */
- int ppc_v0_alias_regnum = 0;
-
- /* SPE registers. */
- int ppc_ev0_upper_regnum = 0; /* First GPR upper half register. */
- int ppc_ev0_regnum = 0; /* First ev register. */
- int ppc_acc_regnum = 0; /* SPE 'acc' register. */
- int ppc_spefscr_regnum = 0; /* SPE 'spefscr' register. */
-
- /* Program Priority Register. */
- int ppc_ppr_regnum = 0;
-
- /* Data Stream Control Register. */
- int ppc_dscr_regnum = 0;
-
- /* Target Address Register. */
- int ppc_tar_regnum = 0;
-
- /* Decimal 128 registers. */
- int ppc_dl0_regnum = 0; /* First Decimal128 argument register pair. */
-
- int have_ebb = 0;
-
- /* PMU registers. */
- int ppc_mmcr0_regnum = 0;
- int ppc_mmcr2_regnum = 0;
- int ppc_siar_regnum = 0;
- int ppc_sdar_regnum = 0;
- int ppc_sier_regnum = 0;
-
- /* Hardware Transactional Memory registers. */
- int have_htm_spr = 0;
- int have_htm_core = 0;
- int have_htm_fpu = 0;
- int have_htm_altivec = 0;
- int have_htm_vsx = 0;
- int ppc_cppr_regnum = 0;
- int ppc_cdscr_regnum = 0;
- int ppc_ctar_regnum = 0;
-
- /* HTM pseudo registers. */
- int ppc_cdl0_regnum = 0;
- int ppc_cvsr0_regnum = 0;
- int ppc_cefpr0_regnum = 0;
-
- /* Offset to ABI specific location where link register is saved. */
- int lr_frame_offset = 0;
-
- /* An array of integers, such that sim_regno[I] is the simulator
+ int ppc_v0_alias_regnum = 0;
+
+ /* SPE registers. */
+ int ppc_ev0_upper_regnum = 0; /* First GPR upper half register. */
+ int ppc_ev0_regnum = 0; /* First ev register. */
+ int ppc_acc_regnum = 0; /* SPE 'acc' register. */
+ int ppc_spefscr_regnum = 0; /* SPE 'spefscr' register. */
+
+ /* Program Priority Register. */
+ int ppc_ppr_regnum = 0;
+
+ /* Data Stream Control Register. */
+ int ppc_dscr_regnum = 0;
+
+ /* Target Address Register. */
+ int ppc_tar_regnum = 0;
+
+ /* Decimal 128 registers. */
+ int ppc_dl0_regnum = 0; /* First Decimal128 argument register pair. */
+
+ int have_ebb = 0;
+
+ /* PMU registers. */
+ int ppc_mmcr0_regnum = 0;
+ int ppc_mmcr2_regnum = 0;
+ int ppc_siar_regnum = 0;
+ int ppc_sdar_regnum = 0;
+ int ppc_sier_regnum = 0;
+
+ /* Hardware Transactional Memory registers. */
+ int have_htm_spr = 0;
+ int have_htm_core = 0;
+ int have_htm_fpu = 0;
+ int have_htm_altivec = 0;
+ int have_htm_vsx = 0;
+ int ppc_cppr_regnum = 0;
+ int ppc_cdscr_regnum = 0;
+ int ppc_ctar_regnum = 0;
+
+ /* HTM pseudo registers. */
+ int ppc_cdl0_regnum = 0;
+ int ppc_cvsr0_regnum = 0;
+ int ppc_cefpr0_regnum = 0;
+
+ /* Offset to ABI specific location where link register is saved. */
+ int lr_frame_offset = 0;
+
+ /* An array of integers, such that sim_regno[I] is the simulator
register number for GDB register number I, or -1 if the
simulator does not implement that register. */
- int *sim_regno = nullptr;
+ int *sim_regno = nullptr;
- /* ISA-specific types. */
- struct type *ppc_builtin_type_vec64 = nullptr;
- struct type *ppc_builtin_type_vec128 = nullptr;
+ /* ISA-specific types. */
+ struct type *ppc_builtin_type_vec64 = nullptr;
+ struct type *ppc_builtin_type_vec128 = nullptr;
- int (*ppc_syscall_record) (struct regcache *regcache) = nullptr;
+ int (*ppc_syscall_record) (struct regcache *regcache) = nullptr;
};
-
/* Constants for register set sizes. */
enum
- {
- ppc_num_gprs = 32, /* 32 general-purpose registers. */
- ppc_num_fprs = 32, /* 32 floating-point registers. */
- ppc_num_srs = 16, /* 16 segment registers. */
- ppc_num_vrs = 32, /* 32 Altivec vector registers. */
- ppc_num_vshrs = 32, /* 32 doublewords (dword 1 of vs0~vs31). */
- ppc_num_vsrs = 64, /* 64 VSX vector registers. */
- ppc_num_efprs = 32 /* 32 Extended FP registers. */
- };
-
+{
+ ppc_num_gprs = 32, /* 32 general-purpose registers. */
+ ppc_num_fprs = 32, /* 32 floating-point registers. */
+ ppc_num_srs = 16, /* 16 segment registers. */
+ ppc_num_vrs = 32, /* 32 Altivec vector registers. */
+ ppc_num_vshrs = 32, /* 32 doublewords (dword 1 of vs0~vs31). */
+ ppc_num_vsrs = 64, /* 64 VSX vector registers. */
+ ppc_num_efprs = 32 /* 32 Extended FP registers. */
+};
/* Register number constants. These are GDB internal register
numbers; they are not used for the simulator or remote targets.
Extra SPRs (those other than MQ, CTR, LR, XER, SPEFSCR) are given
numbers above PPC_NUM_REGS. So are segment registers and other
target-defined registers. */
-enum {
+enum
+{
PPC_R0_REGNUM = 0,
PPC_F0_REGNUM = 32,
PPC_PC_REGNUM = 64,
@@ -390,13 +387,13 @@ enum {
};
/* Big enough to hold the size of the largest register in bytes. */
-#define PPC_MAX_REGISTER_SIZE 64
+#define PPC_MAX_REGISTER_SIZE 64
#define PPC_IS_EBB_REGNUM(i) \
- ((i) >= PPC_BESCR_REGNUM && (i) <= PPC_EBBRR_REGNUM)
+ ((i) >= PPC_BESCR_REGNUM && (i) <= PPC_EBBRR_REGNUM)
#define PPC_IS_PMU_REGNUM(i) \
- ((i) >= PPC_MMCR0_REGNUM && (i) <= PPC_SIER_REGNUM)
+ ((i) >= PPC_MMCR0_REGNUM && (i) <= PPC_SIER_REGNUM)
#define PPC_IS_TMSPR_REGNUM(i) \
((i) >= PPC_TFHAR_REGNUM && (i) <= PPC_TFIAR_REGNUM)
@@ -417,9 +414,9 @@ enum {
struct ppc_insn_pattern
{
- unsigned int mask; /* mask the insn with this... */
- unsigned int data; /* ...and see if it matches this. */
- int optional; /* If non-zero, this insn may be absent. */
+ unsigned int mask; /* mask the insn with this... */
+ unsigned int data; /* ...and see if it matches this. */
+ int optional; /* If non-zero, this insn may be absent. */
};
extern int ppc_insns_match_pattern (frame_info_ptr frame, CORE_ADDR pc,
@@ -438,7 +435,7 @@ extern int ppc_process_record (struct gdbarch *gdbarch,
#define PPC_INSN_SIZE 4
/* Estimate for the maximum number of instructions in a function epilogue. */
-#define PPC_MAX_EPILOGUE_INSTRUCTIONS 52
+#define PPC_MAX_EPILOGUE_INSTRUCTIONS 52
struct ppc_inferior_data
{
@@ -448,6 +445,6 @@ struct ppc_inferior_data
gdb::optional<displaced_step_buffers> disp_step_buf;
};
-extern ppc_inferior_data * get_ppc_per_inferior (inferior *inf);
+extern ppc_inferior_data *get_ppc_per_inferior (inferior *inf);
#endif /* ppc-tdep.h */
diff --git a/gdb/ppc64-tdep.c b/gdb/ppc64-tdep.c
index a7ab62293d9..45bbe6ceb31 100644
--- a/gdb/ppc64-tdep.c
+++ b/gdb/ppc64-tdep.c
@@ -29,56 +29,40 @@
operands are masked off before they're or-ed into the instruction,
you can use -1 to make masks. */
-#define insn_d(opcd, rts, ra, d) \
- ((((unsigned (opcd)) & 0x3f) << 26) \
- | (((unsigned (rts)) & 0x1f) << 21) \
- | (((unsigned (ra)) & 0x1f) << 16) \
- | ((unsigned (d)) & 0xffff))
-
-#define insn_ds(opcd, rts, ra, d, xo) \
- ((((unsigned (opcd)) & 0x3f) << 26) \
- | (((unsigned (rts)) & 0x1f) << 21) \
- | (((unsigned (ra)) & 0x1f) << 16) \
- | ((unsigned (d)) & 0xfffc) \
+#define insn_d(opcd, rts, ra, d) \
+ ((((unsigned (opcd)) & 0x3f) << 26) | (((unsigned (rts)) & 0x1f) << 21) \
+ | (((unsigned (ra)) & 0x1f) << 16) | ((unsigned (d)) & 0xffff))
+
+#define insn_ds(opcd, rts, ra, d, xo) \
+ ((((unsigned (opcd)) & 0x3f) << 26) | (((unsigned (rts)) & 0x1f) << 21) \
+ | (((unsigned (ra)) & 0x1f) << 16) | ((unsigned (d)) & 0xfffc) \
| ((unsigned (xo)) & 0x3))
-#define insn_xfx(opcd, rts, spr, xo) \
- ((((unsigned (opcd)) & 0x3f) << 26) \
- | (((unsigned (rts)) & 0x1f) << 21) \
- | (((unsigned (spr)) & 0x1f) << 16) \
- | (((unsigned (spr)) & 0x3e0) << 6) \
+#define insn_xfx(opcd, rts, spr, xo) \
+ ((((unsigned (opcd)) & 0x3f) << 26) | (((unsigned (rts)) & 0x1f) << 21) \
+ | (((unsigned (spr)) & 0x1f) << 16) | (((unsigned (spr)) & 0x3e0) << 6) \
| (((unsigned (xo)) & 0x3ff) << 1))
-#define prefix(a, b, R, do) \
- (((0x1) << 26) \
- | (((unsigned (a)) & 0x3) << 24) \
- | (((unsigned (b)) & 0x1) << 23) \
- | (((unsigned (R)) & 0x1) << 20) \
+#define prefix(a, b, R, do) \
+ (((0x1) << 26) | (((unsigned (a)) & 0x3) << 24) \
+ | (((unsigned (b)) & 0x1) << 23) | (((unsigned (R)) & 0x1) << 20) \
| ((unsigned (do)) & 0x3ffff))
-#define insn_md(opcd, ra, rs, sh, me, rc) \
- ((((unsigned (opcd)) & 0x3f) << 26) \
- | (((unsigned (rs)) & 0x1f) << 21) \
- | (((unsigned (ra)) & 0x1f) << 16) \
- | (((unsigned (sh)) & 0x3e) << 11) \
- | (((unsigned (me)) & 0x3f) << 25) \
- | (((unsigned (sh)) & 0x1) << 1) \
+#define insn_md(opcd, ra, rs, sh, me, rc) \
+ ((((unsigned (opcd)) & 0x3f) << 26) | (((unsigned (rs)) & 0x1f) << 21) \
+ | (((unsigned (ra)) & 0x1f) << 16) | (((unsigned (sh)) & 0x3e) << 11) \
+ | (((unsigned (me)) & 0x3f) << 25) | (((unsigned (sh)) & 0x1) << 1) \
| ((unsigned (rc)) & 0x1))
-#define insn_x(opcd, rt, ra, rb, opc2) \
- ((((unsigned (opcd)) & 0x3f) << 26) \
- | (((unsigned (rt)) & 0x1f) << 21) \
- | (((unsigned (ra)) & 0x1f) << 16) \
- | (((unsigned (rb)) & 0x3e) << 11) \
+#define insn_x(opcd, rt, ra, rb, opc2) \
+ ((((unsigned (opcd)) & 0x3f) << 26) | (((unsigned (rt)) & 0x1f) << 21) \
+ | (((unsigned (ra)) & 0x1f) << 16) | (((unsigned (rb)) & 0x3e) << 11) \
| (((unsigned (opc2)) & 0x3FF) << 1))
-#define insn_xo(opcd, rt, ra, rb, oe, rc, opc2) \
- ((((unsigned (opcd)) & 0x3f) << 26) \
- | (((unsigned (rt)) & 0x1f) << 21) \
- | (((unsigned (ra)) & 0x1f) << 16) \
- | (((unsigned (rb)) & 0x3e) << 11) \
- | (((unsigned (oe)) & 0x1) << 10) \
- | (((unsigned (opc2)) & 0x1FF) << 1) \
+#define insn_xo(opcd, rt, ra, rb, oe, rc, opc2) \
+ ((((unsigned (opcd)) & 0x3f) << 26) | (((unsigned (rt)) & 0x1f) << 21) \
+ | (((unsigned (ra)) & 0x1f) << 16) | (((unsigned (rb)) & 0x3e) << 11) \
+ | (((unsigned (oe)) & 0x1) << 10) | (((unsigned (opc2)) & 0x1FF) << 1) \
| (((unsigned (rc)))))
/* PLT_OFF is the TOC-relative offset of a 64-bit PowerPC PLT entry.
@@ -95,8 +79,8 @@ ppc64_plt_entry_point (frame_info_ptr frame, CORE_ADDR plt_off)
if (execution_direction == EXEC_REVERSE)
{
/* If executing in reverse, r2 will have been stored to the stack. */
- CORE_ADDR sp = get_frame_register_unsigned (frame,
- tdep->ppc_gp0_regnum + 1);
+ CORE_ADDR sp
+ = get_frame_register_unsigned (frame, tdep->ppc_gp0_regnum + 1);
unsigned int sp_off = tdep->elf_abi == POWERPC_ELF_V1 ? 40 : 24;
tocp = read_memory_unsigned_integer (sp + sp_off, 8, byte_order);
}
@@ -124,37 +108,36 @@ ppc64_plt_pcrel_entry_point (frame_info_ptr frame, CORE_ADDR plt_off,
/* Old ELFv1 PLT call stub. */
-static const struct ppc_insn_pattern ppc64_standard_linkage1[] =
- {
- /* addis r12, r2, <any> */
- { insn_d (-1, -1, -1, 0), insn_d (15, 12, 2, 0), 0 },
+static const struct ppc_insn_pattern ppc64_standard_linkage1[] = {
+ /* addis r12, r2, <any> */
+ { insn_d (-1, -1, -1, 0), insn_d (15, 12, 2, 0), 0 },
- /* std r2, 40(r1) */
- { (unsigned) -1, insn_ds (62, 2, 1, 40, 0), 0 },
+ /* std r2, 40(r1) */
+ { (unsigned) -1, insn_ds (62, 2, 1, 40, 0), 0 },
- /* ld r11, <any>(r12) */
- { insn_ds (-1, -1, -1, 0, -1), insn_ds (58, 11, 12, 0, 0), 0 },
+ /* ld r11, <any>(r12) */
+ { insn_ds (-1, -1, -1, 0, -1), insn_ds (58, 11, 12, 0, 0), 0 },
- /* addis r12, r12, 1 <optional> */
- { insn_d (-1, -1, -1, -1), insn_d (15, 12, 12, 1), 1 },
+ /* addis r12, r12, 1 <optional> */
+ { insn_d (-1, -1, -1, -1), insn_d (15, 12, 12, 1), 1 },
- /* ld r2, <any>(r12) */
- { insn_ds (-1, -1, -1, 0, -1), insn_ds (58, 2, 12, 0, 0), 0 },
+ /* ld r2, <any>(r12) */
+ { insn_ds (-1, -1, -1, 0, -1), insn_ds (58, 2, 12, 0, 0), 0 },
- /* addis r12, r12, 1 <optional> */
- { insn_d (-1, -1, -1, -1), insn_d (15, 12, 12, 1), 1 },
+ /* addis r12, r12, 1 <optional> */
+ { insn_d (-1, -1, -1, -1), insn_d (15, 12, 12, 1), 1 },
- /* mtctr r11 */
- { insn_xfx (-1, -1, -1, -1), insn_xfx (31, 11, 9, 467), 0 },
+ /* mtctr r11 */
+ { insn_xfx (-1, -1, -1, -1), insn_xfx (31, 11, 9, 467), 0 },
- /* ld r11, <any>(r12) <optional> */
- { insn_ds (-1, -1, -1, 0, -1), insn_ds (58, 11, 12, 0, 0), 1 },
+ /* ld r11, <any>(r12) <optional> */
+ { insn_ds (-1, -1, -1, 0, -1), insn_ds (58, 11, 12, 0, 0), 1 },
- /* bctr */
- { (unsigned) -1, 0x4e800420, 0 },
+ /* bctr */
+ { (unsigned) -1, 0x4e800420, 0 },
- { 0, 0, 0 }
- };
+ { 0, 0, 0 }
+};
/* ELFv1 PLT call stub to access PLT entries more than +/- 32k from r2.
Also supports older stub with different placement of std 2,40(1),
@@ -163,332 +146,321 @@ static const struct ppc_insn_pattern ppc64_standard_linkage1[] =
instructions following "cmpldi r2, 0", "bnectr+" and "b <glink_i>",
but there isn't any need to match them. */
-static const struct ppc_insn_pattern ppc64_standard_linkage2[] =
- {
- /* std r2, 40(r1) <optional> */
- { (unsigned) -1, insn_ds (62, 2, 1, 40, 0), 1 },
+static const struct ppc_insn_pattern ppc64_standard_linkage2[] = {
+ /* std r2, 40(r1) <optional> */
+ { (unsigned) -1, insn_ds (62, 2, 1, 40, 0), 1 },
- /* addis r12, r2, <any> */
- { insn_d (-1, -1, -1, 0), insn_d (15, 12, 2, 0), 0 },
+ /* addis r12, r2, <any> */
+ { insn_d (-1, -1, -1, 0), insn_d (15, 12, 2, 0), 0 },
- /* std r2, 40(r1) <optional> */
- { (unsigned) -1, insn_ds (62, 2, 1, 40, 0), 1 },
+ /* std r2, 40(r1) <optional> */
+ { (unsigned) -1, insn_ds (62, 2, 1, 40, 0), 1 },
- /* ld r11, <any>(r12) */
- { insn_ds (-1, -1, -1, 0, -1), insn_ds (58, 11, 12, 0, 0), 0 },
+ /* ld r11, <any>(r12) */
+ { insn_ds (-1, -1, -1, 0, -1), insn_ds (58, 11, 12, 0, 0), 0 },
- /* addi r12, r12, <any> <optional> */
- { insn_d (-1, -1, -1, 0), insn_d (14, 12, 12, 0), 1 },
+ /* addi r12, r12, <any> <optional> */
+ { insn_d (-1, -1, -1, 0), insn_d (14, 12, 12, 0), 1 },
- /* mtctr r11 */
- { insn_xfx (-1, -1, -1, -1), insn_xfx (31, 11, 9, 467), 0 },
+ /* mtctr r11 */
+ { insn_xfx (-1, -1, -1, -1), insn_xfx (31, 11, 9, 467), 0 },
- /* xor r11, r11, r11 <optional> */
- { (unsigned) -1, 0x7d6b5a78, 1 },
+ /* xor r11, r11, r11 <optional> */
+ { (unsigned) -1, 0x7d6b5a78, 1 },
- /* add r12, r12, r11 <optional> */
- { (unsigned) -1, 0x7d8c5a14, 1 },
+ /* add r12, r12, r11 <optional> */
+ { (unsigned) -1, 0x7d8c5a14, 1 },
- /* ld r2, <any>(r12) */
- { insn_ds (-1, -1, -1, 0, -1), insn_ds (58, 2, 12, 0, 0), 0 },
+ /* ld r2, <any>(r12) */
+ { insn_ds (-1, -1, -1, 0, -1), insn_ds (58, 2, 12, 0, 0), 0 },
- /* ld r11, <any>(r12) <optional> */
- { insn_ds (-1, -1, -1, 0, -1), insn_ds (58, 11, 12, 0, 0), 1 },
+ /* ld r11, <any>(r12) <optional> */
+ { insn_ds (-1, -1, -1, 0, -1), insn_ds (58, 11, 12, 0, 0), 1 },
- /* bctr <optional> */
- { (unsigned) -1, 0x4e800420, 1 },
+ /* bctr <optional> */
+ { (unsigned) -1, 0x4e800420, 1 },
- /* cmpldi r2, 0 <optional> */
- { (unsigned) -1, 0x28220000, 1 },
+ /* cmpldi r2, 0 <optional> */
+ { (unsigned) -1, 0x28220000, 1 },
- { 0, 0, 0 }
- };
+ { 0, 0, 0 }
+};
/* ELFv1 PLT call stub to access PLT entries within +/- 32k of r2. */
-static const struct ppc_insn_pattern ppc64_standard_linkage3[] =
- {
- /* std r2, 40(r1) <optional> */
- { (unsigned) -1, insn_ds (62, 2, 1, 40, 0), 1 },
+static const struct ppc_insn_pattern ppc64_standard_linkage3[] = {
+ /* std r2, 40(r1) <optional> */
+ { (unsigned) -1, insn_ds (62, 2, 1, 40, 0), 1 },
- /* ld r11, <any>(r2) */
- { insn_ds (-1, -1, -1, 0, -1), insn_ds (58, 11, 2, 0, 0), 0 },
+ /* ld r11, <any>(r2) */
+ { insn_ds (-1, -1, -1, 0, -1), insn_ds (58, 11, 2, 0, 0), 0 },
- /* addi r2, r2, <any> <optional> */
- { insn_d (-1, -1, -1, 0), insn_d (14, 2, 2, 0), 1 },
+ /* addi r2, r2, <any> <optional> */
+ { insn_d (-1, -1, -1, 0), insn_d (14, 2, 2, 0), 1 },
- /* mtctr r11 */
- { insn_xfx (-1, -1, -1, -1), insn_xfx (31, 11, 9, 467), 0 },
+ /* mtctr r11 */
+ { insn_xfx (-1, -1, -1, -1), insn_xfx (31, 11, 9, 467), 0 },
- /* xor r11, r11, r11 <optional> */
- { (unsigned) -1, 0x7d6b5a78, 1 },
+ /* xor r11, r11, r11 <optional> */
+ { (unsigned) -1, 0x7d6b5a78, 1 },
- /* add r2, r2, r11 <optional> */
- { (unsigned) -1, 0x7c425a14, 1 },
+ /* add r2, r2, r11 <optional> */
+ { (unsigned) -1, 0x7c425a14, 1 },
- /* ld r11, <any>(r2) <optional> */
- { insn_ds (-1, -1, -1, 0, -1), insn_ds (58, 11, 2, 0, 0), 1 },
+ /* ld r11, <any>(r2) <optional> */
+ { insn_ds (-1, -1, -1, 0, -1), insn_ds (58, 11, 2, 0, 0), 1 },
- /* ld r2, <any>(r2) */
- { insn_ds (-1, -1, -1, 0, -1), insn_ds (58, 2, 2, 0, 0), 0 },
+ /* ld r2, <any>(r2) */
+ { insn_ds (-1, -1, -1, 0, -1), insn_ds (58, 2, 2, 0, 0), 0 },
- /* bctr <optional> */
- { (unsigned) -1, 0x4e800420, 1 },
+ /* bctr <optional> */
+ { (unsigned) -1, 0x4e800420, 1 },
- /* cmpldi r2, 0 <optional> */
- { (unsigned) -1, 0x28220000, 1 },
+ /* cmpldi r2, 0 <optional> */
+ { (unsigned) -1, 0x28220000, 1 },
- { 0, 0, 0 }
- };
+ { 0, 0, 0 }
+};
/* ELFv1 PLT call stub to access PLT entries more than +/- 32k from r2.
A more modern variant of ppc64_standard_linkage2 differing in
register usage. */
-static const struct ppc_insn_pattern ppc64_standard_linkage4[] =
- {
- /* std r2, 40(r1) <optional> */
- { (unsigned) -1, insn_ds (62, 2, 1, 40, 0), 1 },
+static const struct ppc_insn_pattern ppc64_standard_linkage4[] = {
+ /* std r2, 40(r1) <optional> */
+ { (unsigned) -1, insn_ds (62, 2, 1, 40, 0), 1 },
- /* addis r11, r2, <any> */
- { insn_d (-1, -1, -1, 0), insn_d (15, 11, 2, 0), 0 },
+ /* addis r11, r2, <any> */
+ { insn_d (-1, -1, -1, 0), insn_d (15, 11, 2, 0), 0 },
- /* ld r12, <any>(r11) */
- { insn_ds (-1, -1, -1, 0, -1), insn_ds (58, 12, 11, 0, 0), 0 },
+ /* ld r12, <any>(r11) */
+ { insn_ds (-1, -1, -1, 0, -1), insn_ds (58, 12, 11, 0, 0), 0 },
- /* addi r11, r11, <any> <optional> */
- { insn_d (-1, -1, -1, 0), insn_d (14, 11, 11, 0), 1 },
+ /* addi r11, r11, <any> <optional> */
+ { insn_d (-1, -1, -1, 0), insn_d (14, 11, 11, 0), 1 },
- /* mtctr r12 */
- { insn_xfx (-1, -1, -1, -1), insn_xfx (31, 12, 9, 467), 0 },
+ /* mtctr r12 */
+ { insn_xfx (-1, -1, -1, -1), insn_xfx (31, 12, 9, 467), 0 },
- /* xor r2, r12, r12 <optional> */
- { (unsigned) -1, 0x7d826278, 1 },
+ /* xor r2, r12, r12 <optional> */
+ { (unsigned) -1, 0x7d826278, 1 },
- /* add r11, r11, r2 <optional> */
- { (unsigned) -1, 0x7d6b1214, 1 },
+ /* add r11, r11, r2 <optional> */
+ { (unsigned) -1, 0x7d6b1214, 1 },
- /* ld r2, <any>(r11) */
- { insn_ds (-1, -1, -1, 0, -1), insn_ds (58, 2, 11, 0, 0), 0 },
+ /* ld r2, <any>(r11) */
+ { insn_ds (-1, -1, -1, 0, -1), insn_ds (58, 2, 11, 0, 0), 0 },
- /* ld r11, <any>(r11) <optional> */
- { insn_ds (-1, -1, -1, 0, -1), insn_ds (58, 11, 11, 0, 0), 1 },
+ /* ld r11, <any>(r11) <optional> */
+ { insn_ds (-1, -1, -1, 0, -1), insn_ds (58, 11, 11, 0, 0), 1 },
- /* bctr <optional> */
- { (unsigned) -1, 0x4e800420, 1 },
+ /* bctr <optional> */
+ { (unsigned) -1, 0x4e800420, 1 },
- /* cmpldi r2, 0 <optional> */
- { (unsigned) -1, 0x28220000, 1 },
+ /* cmpldi r2, 0 <optional> */
+ { (unsigned) -1, 0x28220000, 1 },
- { 0, 0, 0 }
- };
+ { 0, 0, 0 }
+};
/* ELFv1 PLT call stub to access PLT entries within +/- 32k of r2.
A more modern variant of ppc64_standard_linkage3 differing in
register usage. */
-static const struct ppc_insn_pattern ppc64_standard_linkage5[] =
- {
- /* std r2, 40(r1) <optional> */
- { (unsigned) -1, insn_ds (62, 2, 1, 40, 0), 1 },
+static const struct ppc_insn_pattern ppc64_standard_linkage5[] = {
+ /* std r2, 40(r1) <optional> */
+ { (unsigned) -1, insn_ds (62, 2, 1, 40, 0), 1 },
- /* ld r12, <any>(r2) */
- { insn_ds (-1, -1, -1, 0, -1), insn_ds (58, 12, 2, 0, 0), 0 },
+ /* ld r12, <any>(r2) */
+ { insn_ds (-1, -1, -1, 0, -1), insn_ds (58, 12, 2, 0, 0), 0 },
- /* addi r2, r2, <any> <optional> */
- { insn_d (-1, -1, -1, 0), insn_d (14, 2, 2, 0), 1 },
+ /* addi r2, r2, <any> <optional> */
+ { insn_d (-1, -1, -1, 0), insn_d (14, 2, 2, 0), 1 },
- /* mtctr r12 */
- { insn_xfx (-1, -1, -1, -1), insn_xfx (31, 12, 9, 467), 0 },
+ /* mtctr r12 */
+ { insn_xfx (-1, -1, -1, -1), insn_xfx (31, 12, 9, 467), 0 },
- /* xor r11, r12, r12 <optional> */
- { (unsigned) -1, 0x7d8b6278, 1 },
+ /* xor r11, r12, r12 <optional> */
+ { (unsigned) -1, 0x7d8b6278, 1 },
- /* add r2, r2, r11 <optional> */
- { (unsigned) -1, 0x7c425a14, 1 },
+ /* add r2, r2, r11 <optional> */
+ { (unsigned) -1, 0x7c425a14, 1 },
- /* ld r11, <any>(r2) <optional> */
- { insn_ds (-1, -1, -1, 0, -1), insn_ds (58, 11, 2, 0, 0), 1 },
+ /* ld r11, <any>(r2) <optional> */
+ { insn_ds (-1, -1, -1, 0, -1), insn_ds (58, 11, 2, 0, 0), 1 },
- /* ld r2, <any>(r2) */
- { insn_ds (-1, -1, -1, 0, -1), insn_ds (58, 2, 2, 0, 0), 0 },
+ /* ld r2, <any>(r2) */
+ { insn_ds (-1, -1, -1, 0, -1), insn_ds (58, 2, 2, 0, 0), 0 },
- /* bctr <optional> */
- { (unsigned) -1, 0x4e800420, 1 },
+ /* bctr <optional> */
+ { (unsigned) -1, 0x4e800420, 1 },
- /* cmpldi r2, 0 <optional> */
- { (unsigned) -1, 0x28220000, 1 },
+ /* cmpldi r2, 0 <optional> */
+ { (unsigned) -1, 0x28220000, 1 },
- { 0, 0, 0 }
- };
+ { 0, 0, 0 }
+};
/* ELFv2 PLT call stub to access PLT entries more than +/- 32k from r2. */
-static const struct ppc_insn_pattern ppc64_standard_linkage6[] =
- {
- /* std r2, 24(r1) <optional> */
- { (unsigned) -1, insn_ds (62, 2, 1, 24, 0), 1 },
+static const struct ppc_insn_pattern ppc64_standard_linkage6[] = {
+ /* std r2, 24(r1) <optional> */
+ { (unsigned) -1, insn_ds (62, 2, 1, 24, 0), 1 },
- /* addis r11, r2, <any> */
- { insn_d (-1, -1, -1, 0), insn_d (15, 11, 2, 0), 0 },
+ /* addis r11, r2, <any> */
+ { insn_d (-1, -1, -1, 0), insn_d (15, 11, 2, 0), 0 },
- /* ld r12, <any>(r11) */
- { insn_ds (-1, -1, -1, 0, -1), insn_ds (58, 12, 11, 0, 0), 0 },
+ /* ld r12, <any>(r11) */
+ { insn_ds (-1, -1, -1, 0, -1), insn_ds (58, 12, 11, 0, 0), 0 },
- /* mtctr r12 */
- { insn_xfx (-1, -1, -1, -1), insn_xfx (31, 12, 9, 467), 0 },
+ /* mtctr r12 */
+ { insn_xfx (-1, -1, -1, -1), insn_xfx (31, 12, 9, 467), 0 },
- /* bctr */
- { (unsigned) -1, 0x4e800420, 0 },
+ /* bctr */
+ { (unsigned) -1, 0x4e800420, 0 },
- { 0, 0, 0 }
- };
+ { 0, 0, 0 }
+};
/* ELFv2 PLT call stub to access PLT entries within +/- 32k of r2. */
-static const struct ppc_insn_pattern ppc64_standard_linkage7[] =
- {
- /* std r2, 24(r1) <optional> */
- { (unsigned) -1, insn_ds (62, 2, 1, 24, 0), 1 },
+static const struct ppc_insn_pattern ppc64_standard_linkage7[] = {
+ /* std r2, 24(r1) <optional> */
+ { (unsigned) -1, insn_ds (62, 2, 1, 24, 0), 1 },
- /* ld r12, <any>(r2) */
- { insn_ds (-1, -1, -1, 0, -1), insn_ds (58, 12, 2, 0, 0), 0 },
+ /* ld r12, <any>(r2) */
+ { insn_ds (-1, -1, -1, 0, -1), insn_ds (58, 12, 2, 0, 0), 0 },
- /* mtctr r12 */
- { insn_xfx (-1, -1, -1, -1), insn_xfx (31, 12, 9, 467), 0 },
+ /* mtctr r12 */
+ { insn_xfx (-1, -1, -1, -1), insn_xfx (31, 12, 9, 467), 0 },
- /* bctr */
- { (unsigned) -1, 0x4e800420, 0 },
+ /* bctr */
+ { (unsigned) -1, 0x4e800420, 0 },
- { 0, 0, 0 }
- };
+ { 0, 0, 0 }
+};
/* ELFv2 PLT call stub to access PLT entries more than +/- 32k from r2,
supporting fusion. */
-static const struct ppc_insn_pattern ppc64_standard_linkage8[] =
- {
- /* std r2, 24(r1) <optional> */
- { (unsigned) -1, insn_ds (62, 2, 1, 24, 0), 1 },
+static const struct ppc_insn_pattern ppc64_standard_linkage8[] = {
+ /* std r2, 24(r1) <optional> */
+ { (unsigned) -1, insn_ds (62, 2, 1, 24, 0), 1 },
- /* addis r12, r2, <any> */
- { insn_d (-1, -1, -1, 0), insn_d (15, 12, 2, 0), 0 },
+ /* addis r12, r2, <any> */
+ { insn_d (-1, -1, -1, 0), insn_d (15, 12, 2, 0), 0 },
- /* ld r12, <any>(r12) */
- { insn_ds (-1, -1, -1, 0, -1), insn_ds (58, 12, 12, 0, 0), 0 },
+ /* ld r12, <any>(r12) */
+ { insn_ds (-1, -1, -1, 0, -1), insn_ds (58, 12, 12, 0, 0), 0 },
- /* mtctr r12 */
- { insn_xfx (-1, -1, -1, -1), insn_xfx (31, 12, 9, 467), 0 },
+ /* mtctr r12 */
+ { insn_xfx (-1, -1, -1, -1), insn_xfx (31, 12, 9, 467), 0 },
- /* bctr */
- { (unsigned) -1, 0x4e800420, 0 },
+ /* bctr */
+ { (unsigned) -1, 0x4e800420, 0 },
- { 0, 0, 0 }
- };
+ { 0, 0, 0 }
+};
/* Power 10 ELFv2 PLT call stubs */
-static const struct ppc_insn_pattern ppc64_standard_linkage9[] =
- {
- /* std %r2,0+40(%r1) <optional> */
- { insn_ds (-1, -1, -1, 0, 1), insn_ds (62, 2, 1, 40, 0), 1 },
+static const struct ppc_insn_pattern ppc64_standard_linkage9[] = {
+ /* std %r2,0+40(%r1) <optional> */
+ { insn_ds (-1, -1, -1, 0, 1), insn_ds (62, 2, 1, 40, 0), 1 },
- /* pld r12, <any> */
- { prefix (-1, -1, 1, 0), prefix (0, 0, 1, 0), 0 },
- { insn_d (-1, -1, -1, 0), insn_d (57, 12, 0, 0), 0 },
+ /* pld r12, <any> */
+ { prefix (-1, -1, 1, 0), prefix (0, 0, 1, 0), 0 },
+ { insn_d (-1, -1, -1, 0), insn_d (57, 12, 0, 0), 0 },
- /* mtctr r12 */
- { insn_xfx (-1, -1, -1, -1), insn_xfx (31, 12, 9, 467), 0 },
+ /* mtctr r12 */
+ { insn_xfx (-1, -1, -1, -1), insn_xfx (31, 12, 9, 467), 0 },
- /* bctr */
- { (unsigned) -1, 0x4e800420, 0 },
+ /* bctr */
+ { (unsigned) -1, 0x4e800420, 0 },
- { 0, 0, 0 }
- };
+ { 0, 0, 0 }
+};
-static const struct ppc_insn_pattern ppc64_standard_linkage10[] =
- {
- /* std %r2,0+40(%r1) <optional> */
- { insn_ds (-1, -1, -1, 0, 1), insn_ds (62, 2, 1, 40, 0), 1 },
+static const struct ppc_insn_pattern ppc64_standard_linkage10[] = {
+ /* std %r2,0+40(%r1) <optional> */
+ { insn_ds (-1, -1, -1, 0, 1), insn_ds (62, 2, 1, 40, 0), 1 },
- /* paddi r12,<any> */
- { prefix (-1, -1, 1, 0), prefix (2, 0, 1, 0), 0 },
- { insn_d (-1, -1, -1, 0), insn_d (14, 12, 0, 0), 0 },
+ /* paddi r12,<any> */
+ { prefix (-1, -1, 1, 0), prefix (2, 0, 1, 0), 0 },
+ { insn_d (-1, -1, -1, 0), insn_d (14, 12, 0, 0), 0 },
- /* mtctr r12 <optional> */
- { insn_xfx (-1, -1, -1, -1), insn_xfx (31, 12, 9, 467), 0 },
+ /* mtctr r12 <optional> */
+ { insn_xfx (-1, -1, -1, -1), insn_xfx (31, 12, 9, 467), 0 },
- /* bctr */
- { (unsigned) -1, 0x4e800420, 0 },
+ /* bctr */
+ { (unsigned) -1, 0x4e800420, 0 },
- { 0, 0, 0 }
- };
+ { 0, 0, 0 }
+};
-static const struct ppc_insn_pattern ppc64_standard_linkage11[] =
- {
- /* std %r2,0+40(%r1) <optional> */
- { insn_ds (-1, -1, -1, 0, 1), insn_ds (62, 2, 1, 40, 0), 1 },
+static const struct ppc_insn_pattern ppc64_standard_linkage11[] = {
+ /* std %r2,0+40(%r1) <optional> */
+ { insn_ds (-1, -1, -1, 0, 1), insn_ds (62, 2, 1, 40, 0), 1 },
- /* li %r11,0 <optional> */
- { insn_d (-1, -1, -1, 0), insn_d (14, 11, 0, 0), 1 },
+ /* li %r11,0 <optional> */
+ { insn_d (-1, -1, -1, 0), insn_d (14, 11, 0, 0), 1 },
- /* sldi %r11,%r11,34 <eq to rldicr rx,ry,n, 63-n> <optional> */
- { insn_md (-1, -1, -1, 0, 0, 1), insn_md (30, 11, 11, 34, 63-34, 0), 1 },
+ /* sldi %r11,%r11,34 <eq to rldicr rx,ry,n, 63-n> <optional> */
+ { insn_md (-1, -1, -1, 0, 0, 1), insn_md (30, 11, 11, 34, 63 - 34, 0), 1 },
- /* paddi r12, <any> */
- { prefix (-1, -1, 1, 0), prefix (2, 0, 1, 0), 0 },
- { insn_d (-1, -1, -1, 0), insn_d (14, 12, 0, 0), 0 },
+ /* paddi r12, <any> */
+ { prefix (-1, -1, 1, 0), prefix (2, 0, 1, 0), 0 },
+ { insn_d (-1, -1, -1, 0), insn_d (14, 12, 0, 0), 0 },
- /* ldx %r12,%r11,%r12 <optional> */
- { (unsigned) -1, insn_x (31, 12, 11, 12, 21), 1 },
+ /* ldx %r12,%r11,%r12 <optional> */
+ { (unsigned) -1, insn_x (31, 12, 11, 12, 21), 1 },
- /* add %r12,%r11,%r12 <optional> */
- { (unsigned) -1, insn_xo (31, 12, 11, 12, 0, 0, 40), 1 },
+ /* add %r12,%r11,%r12 <optional> */
+ { (unsigned) -1, insn_xo (31, 12, 11, 12, 0, 0, 40), 1 },
- /* mtctr r12 */
- { insn_xfx (-1, -1, -1, -1), insn_xfx (31, 12, 9, 467), 0 },
+ /* mtctr r12 */
+ { insn_xfx (-1, -1, -1, -1), insn_xfx (31, 12, 9, 467), 0 },
- /* bctr */ // 13, 14, 15, 16
- { (unsigned) -1, 0x4e800420, 0 },
+ /* bctr */ // 13, 14, 15, 16
+ { (unsigned) -1, 0x4e800420, 0 },
- { 0, 0, 0 }
- };
+ { 0, 0, 0 }
+};
-static const struct ppc_insn_pattern ppc64_standard_linkage12[] =
- {
- /* std %r2,0+40(%r1) <optional> */
- { insn_ds (-1, -1, -1, 0, 1), insn_ds (62, 2, 1, 40, 0), 1 },
+static const struct ppc_insn_pattern ppc64_standard_linkage12[] = {
+ /* std %r2,0+40(%r1) <optional> */
+ { insn_ds (-1, -1, -1, 0, 1), insn_ds (62, 2, 1, 40, 0), 1 },
- /* lis %r11,xxx@ha <equivalent addis rx, 0, val> */
- /* addis r12, r2, <any> */
- { insn_d (-1, -1, -1, 0), insn_d (15, 12, 2, 0), 0 },
+ /* lis %r11,xxx@ha <equivalent addis rx, 0, val> */
+ /* addis r12, r2, <any> */
+ { insn_d (-1, -1, -1, 0), insn_d (15, 12, 2, 0), 0 },
- /* ori %r11,%r11,xxx@l */
- { insn_d (-1, -1, -1, 0), insn_d (24, 11, 11, 0), 0 },
+ /* ori %r11,%r11,xxx@l */
+ { insn_d (-1, -1, -1, 0), insn_d (24, 11, 11, 0), 0 },
- /* sldi %r11,%r11,34 <optional> */
- { (unsigned) -1, insn_md (30, 11, 11, 34, 63-34, 0), 1 },
+ /* sldi %r11,%r11,34 <optional> */
+ { (unsigned) -1, insn_md (30, 11, 11, 34, 63 - 34, 0), 1 },
- /*paddi r12,<any> */
- { prefix (-1, -1, 1, 0), prefix (2, 0, 1, 0), 0 },
- { insn_d (-1, -1, -1, 0), insn_d (14, 12, 0, 0), 0 },
+ /*paddi r12,<any> */
+ { prefix (-1, -1, 1, 0), prefix (2, 0, 1, 0), 0 },
+ { insn_d (-1, -1, -1, 0), insn_d (14, 12, 0, 0), 0 },
- /* sldi %r11,%r11,34 <optional> */
- { (unsigned) -1, insn_md (30, 11, 11, 34, 63-34, 0), 1 },
+ /* sldi %r11,%r11,34 <optional> */
+ { (unsigned) -1, insn_md (30, 11, 11, 34, 63 - 34, 0), 1 },
- /* ldx %r12,%r11,%r12 <optional> */
- { (unsigned) -1, insn_x (31, 12, 11, 12, 21), 1 },
+ /* ldx %r12,%r11,%r12 <optional> */
+ { (unsigned) -1, insn_x (31, 12, 11, 12, 21), 1 },
- /* add %r12,%r11,%r12 <optional> */
- { (unsigned) -1, insn_xo (31, 12, 11, 12, 0, 0, 40), 1 },
+ /* add %r12,%r11,%r12 <optional> */
+ { (unsigned) -1, insn_xo (31, 12, 11, 12, 0, 0, 40), 1 },
- /* mtctr r12 */
- { insn_xfx (-1, -1, -1, -1), insn_xfx (31, 12, 9, 467), 0 },
+ /* mtctr r12 */
+ { insn_xfx (-1, -1, -1, -1), insn_xfx (31, 12, 9, 467), 0 },
- /* bctr */ // 17, 18, 19, 20
- { (unsigned) -1, 0x4e800420, 0 },
+ /* bctr */ // 17, 18, 19, 20
+ { (unsigned) -1, 0x4e800420, 0 },
- { 0, 0, 0 }
- };
+ { 0, 0, 0 }
+};
/* When the dynamic linker is doing lazy symbol resolution, the first
call to a function in another object will go like this:
@@ -548,8 +520,8 @@ static const struct ppc_insn_pattern ppc64_standard_linkage12[] =
static CORE_ADDR
ppc64_standard_linkage1_target (frame_info_ptr frame, unsigned int *insn)
{
- CORE_ADDR plt_off = ((ppc_insn_d_field (insn[0]) << 16)
- + ppc_insn_ds_field (insn[2]));
+ CORE_ADDR plt_off
+ = ((ppc_insn_d_field (insn[0]) << 16) + ppc_insn_ds_field (insn[2]));
return ppc64_plt_entry_point (frame, plt_off);
}
@@ -557,8 +529,8 @@ ppc64_standard_linkage1_target (frame_info_ptr frame, unsigned int *insn)
static CORE_ADDR
ppc64_standard_linkage2_target (frame_info_ptr frame, unsigned int *insn)
{
- CORE_ADDR plt_off = ((ppc_insn_d_field (insn[1]) << 16)
- + ppc_insn_ds_field (insn[3]));
+ CORE_ADDR plt_off
+ = ((ppc_insn_d_field (insn[1]) << 16) + ppc_insn_ds_field (insn[3]));
return ppc64_plt_entry_point (frame, plt_off);
}
@@ -574,8 +546,8 @@ ppc64_standard_linkage3_target (frame_info_ptr frame, unsigned int *insn)
static CORE_ADDR
ppc64_standard_linkage4_target (frame_info_ptr frame, unsigned int *insn)
{
- CORE_ADDR plt_off = ((ppc_insn_d_field (insn[1]) << 16)
- + ppc_insn_ds_field (insn[2]));
+ CORE_ADDR plt_off
+ = ((ppc_insn_d_field (insn[1]) << 16) + ppc_insn_ds_field (insn[2]));
return ppc64_plt_entry_point (frame, plt_off);
}
@@ -603,7 +575,6 @@ ppc64_pcrel_linkage2_target (frame_info_ptr frame, unsigned int *insn,
return ppc64_plt_pcrel_entry_point (frame, plt_off, pc);
}
-
/* Given that we've begun executing a call trampoline at PC, return
the entry point of the function the trampoline will go to.
@@ -613,21 +584,22 @@ ppc64_pcrel_linkage2_target (frame_info_ptr frame, unsigned int *insn,
static CORE_ADDR
ppc64_skip_trampoline_code_1 (frame_info_ptr frame, CORE_ADDR pc)
{
-#define MAX(a,b) ((a) > (b) ? (a) : (b))
- unsigned int insns[MAX (MAX (MAX (ARRAY_SIZE (ppc64_standard_linkage1),
- ARRAY_SIZE (ppc64_standard_linkage2)),
- MAX (ARRAY_SIZE (ppc64_standard_linkage3),
- ARRAY_SIZE (ppc64_standard_linkage4))),
- MAX(MAX (MAX (ARRAY_SIZE (ppc64_standard_linkage5),
- ARRAY_SIZE (ppc64_standard_linkage6)),
- MAX (ARRAY_SIZE (ppc64_standard_linkage7),
- ARRAY_SIZE (ppc64_standard_linkage8))),
- MAX (MAX (ARRAY_SIZE (ppc64_standard_linkage9),
- ARRAY_SIZE (ppc64_standard_linkage10)),
- MAX (ARRAY_SIZE (ppc64_standard_linkage11),
- ARRAY_SIZE (ppc64_standard_linkage12)))))
-
- - 1];
+#define MAX(a, b) ((a) > (b) ? (a) : (b))
+ unsigned int
+ insns[MAX (MAX (MAX (ARRAY_SIZE (ppc64_standard_linkage1),
+ ARRAY_SIZE (ppc64_standard_linkage2)),
+ MAX (ARRAY_SIZE (ppc64_standard_linkage3),
+ ARRAY_SIZE (ppc64_standard_linkage4))),
+ MAX (MAX (MAX (ARRAY_SIZE (ppc64_standard_linkage5),
+ ARRAY_SIZE (ppc64_standard_linkage6)),
+ MAX (ARRAY_SIZE (ppc64_standard_linkage7),
+ ARRAY_SIZE (ppc64_standard_linkage8))),
+ MAX (MAX (ARRAY_SIZE (ppc64_standard_linkage9),
+ ARRAY_SIZE (ppc64_standard_linkage10)),
+ MAX (ARRAY_SIZE (ppc64_standard_linkage11),
+ ARRAY_SIZE (ppc64_standard_linkage12)))))
+
+ - 1];
CORE_ADDR target;
int scan_limit, i;
@@ -640,19 +612,24 @@ ppc64_skip_trampoline_code_1 (frame_info_ptr frame, CORE_ADDR pc)
for (i = 0; i < scan_limit; i++)
{
if (i < ARRAY_SIZE (ppc64_standard_linkage12) - 1
- && ppc_insns_match_pattern (frame, pc, ppc64_standard_linkage12, insns))
+ && ppc_insns_match_pattern (frame, pc, ppc64_standard_linkage12,
+ insns))
pc = ppc64_pcrel_linkage1_target (frame, insns, pc);
else if (i < ARRAY_SIZE (ppc64_standard_linkage11) - 1
- && ppc_insns_match_pattern (frame, pc, ppc64_standard_linkage11, insns))
+ && ppc_insns_match_pattern (frame, pc, ppc64_standard_linkage11,
+ insns))
pc = ppc64_pcrel_linkage2_target (frame, insns, pc);
else if (i < ARRAY_SIZE (ppc64_standard_linkage10) - 1
- && ppc_insns_match_pattern (frame, pc, ppc64_standard_linkage10, insns))
+ && ppc_insns_match_pattern (frame, pc, ppc64_standard_linkage10,
+ insns))
pc = ppc64_pcrel_linkage1_target (frame, insns, pc);
else if (i < ARRAY_SIZE (ppc64_standard_linkage9) - 1
- && ppc_insns_match_pattern (frame, pc, ppc64_standard_linkage9, insns))
+ && ppc_insns_match_pattern (frame, pc, ppc64_standard_linkage9,
+ insns))
pc = ppc64_pcrel_linkage1_target (frame, insns, pc);
else if (i < ARRAY_SIZE (ppc64_standard_linkage8) - 1
- && ppc_insns_match_pattern (frame, pc, ppc64_standard_linkage8, insns))
+ && ppc_insns_match_pattern (frame, pc, ppc64_standard_linkage8,
+ insns))
pc = ppc64_standard_linkage4_target (frame, insns);
else if (i < ARRAY_SIZE (ppc64_standard_linkage7) - 1
&& ppc_insns_match_pattern (frame, pc, ppc64_standard_linkage7,
@@ -698,7 +675,7 @@ ppc64_skip_trampoline_code_1 (frame_info_ptr frame, CORE_ADDR pc)
symbols, find_solib_trampoline_target should be able to resolve them. */
target = find_solib_trampoline_target (frame, pc);
return target ? target : pc;
- }
+ }
return 0;
}
@@ -744,9 +721,8 @@ ppc64_skip_trampoline_code (frame_info_ptr frame, CORE_ADDR pc)
random addresses such as occur when there is no symbol table. */
CORE_ADDR
-ppc64_convert_from_func_ptr_addr (struct gdbarch *gdbarch,
- CORE_ADDR addr,
- struct target_ops *targ)
+ppc64_convert_from_func_ptr_addr (struct gdbarch *gdbarch, CORE_ADDR addr,
+ struct target_ops *targ)
{
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
const struct target_section *s = target_section_by_addr (targ, addr);
@@ -778,12 +754,12 @@ ppc64_convert_from_func_ptr_addr (struct gdbarch *gdbarch,
int res;
res = bfd_get_section_contents (s->the_bfd_section->owner,
- s->the_bfd_section,
- &buf, addr - s->addr, 8);
+ s->the_bfd_section, &buf, addr - s->addr,
+ 8);
if (res != 0)
return (extract_unsigned_integer (buf, 8, byte_order)
- bfd_section_vma (s->the_bfd_section) + s->addr);
- }
+ }
return addr;
}
diff --git a/gdb/printcmd.c b/gdb/printcmd.c
index 7f3551327a8..1d1b4355696 100644
--- a/gdb/printcmd.c
+++ b/gdb/printcmd.c
@@ -33,9 +33,9 @@
#include "gdb-demangle.h"
#include "valprint.h"
#include "annotate.h"
-#include "symfile.h" /* for overlay functions */
-#include "objfiles.h" /* ditto */
-#include "completer.h" /* for completion functions */
+#include "symfile.h" /* for overlay functions */
+#include "objfiles.h" /* ditto */
+#include "completer.h" /* for completion functions */
#include "ui-out.h"
#include "block.h"
#include "disasm.h"
@@ -98,25 +98,28 @@ static value_ref_ptr last_examine_value;
printed as `0x1234 <symbol+offset>'. */
static unsigned int max_symbolic_offset = UINT_MAX;
+
static void
show_max_symbolic_offset (struct ui_file *file, int from_tty,
struct cmd_list_element *c, const char *value)
{
gdb_printf (file,
- _("The largest offset that will be "
- "printed in <symbol+1234> form is %s.\n"),
+ _ ("The largest offset that will be "
+ "printed in <symbol+1234> form is %s.\n"),
value);
}
/* Append the source filename and linenumber of the symbol when
printing a symbolic value as `<symbol at filename:linenum>' if set. */
static bool print_symbol_filename = false;
+
static void
show_print_symbol_filename (struct ui_file *file, int from_tty,
struct cmd_list_element *c, const char *value)
{
- gdb_printf (file, _("Printing of source filename and "
- "line number with <symbol> is %s.\n"),
+ gdb_printf (file,
+ _ ("Printing of source filename and "
+ "line number with <symbol> is %s.\n"),
value);
}
@@ -131,41 +134,41 @@ static int current_display_number;
static int display_number;
struct display
+{
+ display (const char *exp_string_, expression_up &&exp_,
+ const struct format_data &format_, struct program_space *pspace_,
+ const struct block *block_)
+ : exp_string (exp_string_),
+ exp (std::move (exp_)),
+ number (++display_number),
+ format (format_),
+ pspace (pspace_),
+ block (block_),
+ enabled_p (true)
{
- display (const char *exp_string_, expression_up &&exp_,
- const struct format_data &format_, struct program_space *pspace_,
- const struct block *block_)
- : exp_string (exp_string_),
- exp (std::move (exp_)),
- number (++display_number),
- format (format_),
- pspace (pspace_),
- block (block_),
- enabled_p (true)
- {
- }
+ }
- /* The expression as the user typed it. */
- std::string exp_string;
+ /* The expression as the user typed it. */
+ std::string exp_string;
- /* Expression to be evaluated and displayed. */
- expression_up exp;
+ /* Expression to be evaluated and displayed. */
+ expression_up exp;
- /* Item number of this auto-display item. */
- int number;
+ /* Item number of this auto-display item. */
+ int number;
- /* Display format specified. */
- struct format_data format;
+ /* Display format specified. */
+ struct format_data format;
- /* Program space associated with `block'. */
- struct program_space *pspace;
+ /* Program space associated with `block'. */
+ struct program_space *pspace;
- /* Innermost block required by this expression when evaluated. */
- const struct block *block;
+ /* Innermost block required by this expression when evaluated. */
+ const struct block *block;
- /* Status of this display (enabled or disabled). */
- bool enabled_p;
- };
+ /* Status of this display (enabled or disabled). */
+ bool enabled_p;
+};
/* Expressions whose values should be displayed automatically each
time the program stops. */
@@ -175,7 +178,6 @@ static std::vector<std::unique_ptr<struct display>> all_displays;
/* Prototypes for local functions. */
static void do_one_display (struct display *);
-
/* Decode a format specification. *STRING_PTR should point to it.
OFORMAT and OSIZE are used as defaults for the format and size
@@ -282,7 +284,7 @@ decode_format (const char **string_ptr, int oformat, int osize)
return val;
}
-
+
/* Print value VAL on stream according to OPTIONS.
Do not end with a newline.
SIZE is the letter for the size of datum being printed.
@@ -308,10 +310,11 @@ print_formatted (struct value *val, int size,
{
struct type *elttype = value_type (val);
- next_address = (value_address (val)
- + val_print_string (elttype, NULL,
- value_address (val), -1,
- stream, options) * len);
+ next_address
+ = (value_address (val)
+ + val_print_string (elttype, NULL, value_address (val), -1,
+ stream, options)
+ * len);
}
return;
@@ -319,20 +322,16 @@ print_formatted (struct value *val, int size,
/* We often wrap here if there are long symbolic names. */
stream->wrap_here (4);
next_address = (value_address (val)
- + gdb_print_insn (type->arch (),
- value_address (val), stream,
- &branch_delay_insns));
+ + gdb_print_insn (type->arch (), value_address (val),
+ stream, &branch_delay_insns));
return;
}
}
if (options->format == 0 || options->format == 's'
- || type->code () == TYPE_CODE_VOID
- || type->code () == TYPE_CODE_REF
- || type->code () == TYPE_CODE_ARRAY
- || type->code () == TYPE_CODE_STRING
- || type->code () == TYPE_CODE_STRUCT
- || type->code () == TYPE_CODE_UNION
+ || type->code () == TYPE_CODE_VOID || type->code () == TYPE_CODE_REF
+ || type->code () == TYPE_CODE_ARRAY || type->code () == TYPE_CODE_STRING
+ || type->code () == TYPE_CODE_STRUCT || type->code () == TYPE_CODE_UNION
|| type->code () == TYPE_CODE_NAMESPACE)
value_print (val, stream, options);
else
@@ -365,8 +364,8 @@ float_type_from_length (struct type *type)
void
print_scalar_formatted (const gdb_byte *valaddr, struct type *type,
- const struct value_print_options *options,
- int size, struct ui_file *stream)
+ const struct value_print_options *options, int size,
+ struct ui_file *stream)
{
struct gdbarch *gdbarch = type->arch ();
unsigned int len = type->length ();
@@ -419,7 +418,7 @@ print_scalar_formatted (const gdb_byte *valaddr, struct type *type,
newlen = 8;
break;
default:
- error (_("Undefined output size \"%c\"."), size);
+ error (_ ("Undefined output size \"%c\"."), size);
}
if (newlen < len && byte_order == BFD_ENDIAN_BIG)
valaddr += len - newlen;
@@ -434,12 +433,9 @@ print_scalar_formatted (const gdb_byte *valaddr, struct type *type,
here for possible use later. */
gdb::optional<LONGEST> val_long;
if ((is_fixed_point_type (type)
- && (options->format == 'o'
- || options->format == 'x'
- || options->format == 't'
- || options->format == 'z'
- || options->format == 'd'
- || options->format == 'u'))
+ && (options->format == 'o' || options->format == 'x'
+ || options->format == 't' || options->format == 'z'
+ || options->format == 'd' || options->format == 'u'))
|| (type->code () == TYPE_CODE_RANGE && type->bounds ()->bias != 0)
|| type->bit_size_differs_p ())
{
@@ -519,7 +515,7 @@ print_scalar_formatted (const gdb_byte *valaddr, struct type *type,
break;
default:
- error (_("Undefined output format \"%c\"."), format);
+ error (_ ("Undefined output format \"%c\"."), format);
}
}
@@ -550,8 +546,8 @@ set_next_address (struct gdbarch *gdbarch, CORE_ADDR addr)
int
print_address_symbolic (struct gdbarch *gdbarch, CORE_ADDR addr,
- struct ui_file *stream,
- int do_demangle, const char *leadin)
+ struct ui_file *stream, int do_demangle,
+ const char *leadin)
{
std::string name, filename;
int unmapped = 0;
@@ -591,22 +587,21 @@ print_address_symbolic (struct gdbarch *gdbarch, CORE_ADDR addr,
/* See valprint.h. */
int
-build_address_symbolic (struct gdbarch *gdbarch,
- CORE_ADDR addr, /* IN */
- bool do_demangle, /* IN */
- bool prefer_sym_over_minsym, /* IN */
- std::string *name, /* OUT */
- int *offset, /* OUT */
- std::string *filename, /* OUT */
- int *line, /* OUT */
- int *unmapped) /* OUT */
+build_address_symbolic (struct gdbarch *gdbarch, CORE_ADDR addr, /* IN */
+ bool do_demangle, /* IN */
+ bool prefer_sym_over_minsym, /* IN */
+ std::string *name, /* OUT */
+ int *offset, /* OUT */
+ std::string *filename, /* OUT */
+ int *line, /* OUT */
+ int *unmapped) /* OUT */
{
struct bound_minimal_symbol msymbol;
struct symbol *symbol;
CORE_ADDR name_location = 0;
struct obj_section *section = NULL;
const char *name_temp = "";
-
+
/* Let's say it is mapped (not unmapped). */
*unmapped = 0;
@@ -652,10 +647,8 @@ build_address_symbolic (struct gdbarch *gdbarch,
name_temp = symbol->linkage_name ();
}
- if (msymbol.minsym != NULL
- && msymbol.minsym->has_size ()
- && msymbol.minsym->size () == 0
- && msymbol.minsym->type () != mst_text
+ if (msymbol.minsym != NULL && msymbol.minsym->has_size ()
+ && msymbol.minsym->size () == 0 && msymbol.minsym->type () != mst_text
&& msymbol.minsym->type () != mst_text_gnu_ifunc
&& msymbol.minsym->type () != mst_file_text)
msymbol.minsym = NULL;
@@ -671,10 +664,9 @@ build_address_symbolic (struct gdbarch *gdbarch,
consideration.
3) The symbol address is not identical to that of the address
under consideration. */
- if (symbol == NULL ||
- (!prefer_sym_over_minsym
- && msymbol.value_address () == addr
- && name_location != addr))
+ if (symbol == NULL
+ || (!prefer_sym_over_minsym && msymbol.value_address () == addr
+ && name_location != addr))
{
/* If this is a function (i.e. a code address), strip out any
non-address bits. For instance, display a pointer to the
@@ -728,14 +720,12 @@ build_address_symbolic (struct gdbarch *gdbarch,
return 0;
}
-
/* Print address ADDR symbolically on STREAM.
First print it as a number. Then perhaps print
<SYMBOL + OFFSET> after the number. */
void
-print_address (struct gdbarch *gdbarch,
- CORE_ADDR addr, struct ui_file *stream)
+print_address (struct gdbarch *gdbarch, CORE_ADDR addr, struct ui_file *stream)
{
fputs_styled (paddress (gdbarch, addr), address_style.style (), stream);
print_address_symbolic (gdbarch, addr, stream, asm_demangle, " ");
@@ -779,7 +769,6 @@ print_address_demangle (const struct value_print_options *opts,
}
return 1;
}
-
/* Find the address of the instruction that is INST_COUNT instructions before
the instruction at ADDR.
@@ -819,8 +808,8 @@ find_instruction_backward (struct gdbarch *gdbarch, CORE_ADDR addr,
/* We reach here when line info is not available. In this case,
we print a message and just exit the loop. The return value
is calculated after the loop. */
- gdb_printf (_("No line number information available "
- "for address "));
+ gdb_printf (_ ("No line number information available "
+ "for address "));
gdb_stdout->wrap_here (2);
print_address (gdbarch, loop_start - 1, gdb_stdout);
gdb_printf ("\n");
@@ -881,11 +870,11 @@ find_instruction_backward (struct gdbarch *gdbarch, CORE_ADDR addr,
a count of the bytes actually read. */
static int
-read_memory_backward (struct gdbarch *gdbarch,
- CORE_ADDR memaddr, gdb_byte *myaddr, int len)
+read_memory_backward (struct gdbarch *gdbarch, CORE_ADDR memaddr,
+ gdb_byte *myaddr, int len)
{
int errcode;
- int nread; /* Number of bytes actually read. */
+ int nread; /* Number of bytes actually read. */
/* First try a complete read. */
errcode = target_read_memory (memaddr, myaddr, len);
@@ -905,7 +894,7 @@ read_memory_backward (struct gdbarch *gdbarch,
if (errcode != 0)
{
/* The read was unsuccessful, so exit the loop. */
- gdb_printf (_("Cannot access memory at address %s\n"),
+ gdb_printf (_ ("Cannot access memory at address %s\n"),
paddress (gdbarch, memaddr));
break;
}
@@ -933,9 +922,8 @@ integer_is_zero (const gdb_byte *x, int len)
PRINT_MAX from the string. */
static CORE_ADDR
-find_string_backward (struct gdbarch *gdbarch,
- CORE_ADDR addr, int count, int char_size,
- const struct value_print_options *options,
+find_string_backward (struct gdbarch *gdbarch, CORE_ADDR addr, int count,
+ int char_size, const struct value_print_options *options,
int *strings_counted)
{
const int chunk_size = 0x20;
@@ -959,7 +947,7 @@ find_string_backward (struct gdbarch *gdbarch,
read_error = (chars_read == chars_to_read) ? 0 : 1;
unsigned int print_max_chars = get_print_max_chars (options);
/* Searching for '\0' from the end of buffer in backward direction. */
- for (i = 0; i < chars_read && count > 0 ; ++i, ++chars_counted)
+ for (i = 0; i < chars_read && count > 0; ++i, ++chars_counted)
{
int offset = (chars_to_read - i - 1) * char_size;
@@ -1029,7 +1017,7 @@ do_examine (struct format_data fmt, struct gdbarch *gdbarch, CORE_ADDR addr)
size = 'h';
else
/* Bad value for gdbarch_ptr_bit. */
- internal_error (_("failed internal consistency check"));
+ internal_error (_ ("failed internal consistency check"));
}
if (size == 'b')
@@ -1056,8 +1044,9 @@ do_examine (struct format_data fmt, struct gdbarch *gdbarch, CORE_ADDR addr)
else
{
if (size != '\0' && size != 'b')
- warning (_("Unable to display strings with "
- "size '%c', using 'b' instead."), size);
+ warning (_ ("Unable to display strings with "
+ "size '%c', using 'b' instead."),
+ size);
size = 'b';
val_type = builtin_type (next_gdbarch)->builtin_int8;
}
@@ -1082,14 +1071,14 @@ do_examine (struct format_data fmt, struct gdbarch *gdbarch, CORE_ADDR addr)
count = -count;
if (format == 'i')
{
- next_address = find_instruction_backward (gdbarch, addr, count,
- &count);
+ next_address
+ = find_instruction_backward (gdbarch, addr, count, &count);
}
else if (format == 's')
{
- next_address = find_string_backward (gdbarch, addr, count,
- val_type->length (),
- &opts, &count);
+ next_address
+ = find_string_backward (gdbarch, addr, count, val_type->length (),
+ &opts, &count);
}
else
{
@@ -1099,9 +1088,8 @@ do_examine (struct format_data fmt, struct gdbarch *gdbarch, CORE_ADDR addr)
/* The following call to print_formatted updates next_address in every
iteration. In backward case, we store the start address here
and update next_address with it before exiting the function. */
- addr_rewound = (format == 's'
- ? next_address - val_type->length ()
- : next_address);
+ addr_rewound
+ = (format == 's' ? next_address - val_type->length () : next_address);
need_to_update_next_address = 1;
}
@@ -1133,16 +1121,14 @@ do_examine (struct format_data fmt, struct gdbarch *gdbarch, CORE_ADDR addr)
if (gdbarch_tagged_address_p (target_gdbarch (), v_addr))
{
/* Fetch the allocation tag. */
- struct value *tag
- = gdbarch_get_memtag (gdbarch, v_addr, memtag_type::allocation);
- std::string atag
- = gdbarch_memtag_to_string (gdbarch, tag);
+ struct value *tag = gdbarch_get_memtag (gdbarch, v_addr,
+ memtag_type::allocation);
+ std::string atag = gdbarch_memtag_to_string (gdbarch, tag);
if (!atag.empty ())
{
- gdb_printf (_("<Allocation Tag %s for range [%s,%s)>\n"),
- atag.c_str (),
- paddress (gdbarch, tag_laddr),
+ gdb_printf (_ ("<Allocation Tag %s for range [%s,%s)>\n"),
+ atag.c_str (), paddress (gdbarch, tag_laddr),
paddress (gdbarch, tag_haddr));
}
}
@@ -1153,9 +1139,7 @@ do_examine (struct format_data fmt, struct gdbarch *gdbarch, CORE_ADDR addr)
gdb_puts (pc_prefix (next_address));
print_address (next_gdbarch, next_address, gdb_stdout);
gdb_printf (":");
- for (i = maxelts;
- i > 0 && count > 0;
- i--, count--)
+ for (i = maxelts; i > 0 && count > 0; i--, count--)
{
gdb_printf ("\t");
/* Note that print_formatted sets next_address for the next
@@ -1183,7 +1167,7 @@ do_examine (struct format_data fmt, struct gdbarch *gdbarch, CORE_ADDR addr)
/* Update the tag range based on the current address being
processed. */
if (tag_haddr <= next_address)
- print_range_tag = true;
+ print_range_tag = true;
}
gdb_printf ("\n");
}
@@ -1191,17 +1175,17 @@ do_examine (struct format_data fmt, struct gdbarch *gdbarch, CORE_ADDR addr)
if (need_to_update_next_address)
next_address = addr_rewound;
}
-
+
static void
validate_format (struct format_data fmt, const char *cmdname)
{
if (fmt.size != 0)
- error (_("Size letters are meaningless in \"%s\" command."), cmdname);
+ error (_ ("Size letters are meaningless in \"%s\" command."), cmdname);
if (fmt.count != 1)
- error (_("Item count other than 1 is meaningless in \"%s\" command."),
+ error (_ ("Item count other than 1 is meaningless in \"%s\" command."),
cmdname);
if (fmt.format == 'i')
- error (_("Format letter \"%c\" is meaningless in \"%s\" command."),
+ error (_ ("Format letter \"%c\" is meaningless in \"%s\" command."),
fmt.format, cmdname);
}
@@ -1269,14 +1253,12 @@ should_validate_memtags (struct value *value)
enum type_code code = value_type (value)->code ();
/* Skip non-address values. */
- if (code != TYPE_CODE_PTR
- && !TYPE_IS_REFERENCE (value_type (value)))
+ if (code != TYPE_CODE_PTR && !TYPE_IS_REFERENCE (value_type (value)))
return false;
/* OK, we have an address value. Check we have a complete value we
can extract. */
- if (value_optimized_out (value)
- || !value_entirely_available (value))
+ if (value_optimized_out (value) || !value_entirely_available (value))
return false;
/* We do. Check whether it includes any tags. */
@@ -1292,8 +1274,9 @@ process_print_command_args (const char *args, value_print_options *print_opts,
get_user_print_options (print_opts);
/* Override global settings with explicit options, if any. */
auto group = make_value_print_options_def_group (print_opts);
- gdb::option::process_options
- (&args, gdb::option::PROCESS_OPTIONS_REQUIRE_DELIMITER, group);
+ gdb::option::process_options (&args,
+ gdb::option::PROCESS_OPTIONS_REQUIRE_DELIMITER,
+ group);
print_command_parse_format (&args, "print", print_opts);
@@ -1317,10 +1300,12 @@ print_command_1 (const char *args, int voidprint)
{
value_print_options print_opts;
- struct value *val = process_print_command_args (args, &print_opts, voidprint);
+ struct value *val
+ = process_print_command_args (args, &print_opts, voidprint);
- if (voidprint || (val && value_type (val) &&
- value_type (val)->code () != TYPE_CODE_VOID))
+ if (voidprint
+ || (val && value_type (val)
+ && value_type (val)->code () != TYPE_CODE_VOID))
{
/* If memory tagging validation is on, check if the tag is valid. */
if (print_opts.memory_tag_violations)
@@ -1343,8 +1328,8 @@ print_command_1 (const char *args, int voidprint)
std::string atag
= gdbarch_memtag_to_string (target_gdbarch (), tag);
- gdb_printf (_("Logical tag (%s) does not match the "
- "allocation tag (%s).\n"),
+ gdb_printf (_ ("Logical tag (%s) does not match the "
+ "allocation tag (%s).\n"),
ltag.c_str (), atag.c_str ());
}
}
@@ -1354,7 +1339,7 @@ print_command_1 (const char *args, int voidprint)
throw;
gdb_printf (gdb_stderr,
- _("Could not validate memory tag: %s\n"),
+ _ ("Could not validate memory tag: %s\n"),
ex.message->c_str ());
}
}
@@ -1432,12 +1417,12 @@ skip_over_slash_fmt (completion_tracker &tracker, const char **args)
void
print_command_completer (struct cmd_list_element *ignore,
- completion_tracker &tracker,
- const char *text, const char * /*word*/)
+ completion_tracker &tracker, const char *text,
+ const char * /*word*/)
{
const auto group = make_value_print_options_def_group (nullptr);
- if (gdb::option::complete_options
- (tracker, &text, gdb::option::PROCESS_OPTIONS_REQUIRE_DELIMITER, group))
+ if (gdb::option::complete_options (
+ tracker, &text, gdb::option::PROCESS_OPTIONS_REQUIRE_DELIMITER, group))
return;
if (skip_over_slash_fmt (tracker, &text))
@@ -1512,8 +1497,8 @@ set_command (const char *exp, int from_tty)
case BINOP_COMMA:
break;
default:
- warning
- (_("Expression is not an assignment (and might have no effect)"));
+ warning (
+ _ ("Expression is not an assignment (and might have no effect)"));
}
evaluate_expression (expr.get ());
@@ -1529,7 +1514,7 @@ info_symbol_command (const char *arg, int from_tty)
unsigned int offset;
if (!arg)
- error_no_arg (_("address"));
+ error_no_arg (_ ("address"));
addr = parse_and_eval_address (arg);
for (objfile *objfile : current_program_space->objfiles ())
@@ -1542,17 +1527,17 @@ info_symbol_command (const char *arg, int from_tty)
sect_addr = overlay_mapped_address (addr, osect);
- if (osect->addr () <= sect_addr && sect_addr < osect->endaddr ()
- && (msymbol
- = lookup_minimal_symbol_by_pc_section (sect_addr,
- osect).minsym))
+ if (
+ osect->addr () <= sect_addr && sect_addr < osect->endaddr ()
+ && (msymbol
+ = lookup_minimal_symbol_by_pc_section (sect_addr, osect).minsym))
{
const char *obj_name, *mapped, *sec_name, *msym_name;
const char *loc_string;
matches = 1;
offset = sect_addr - msymbol->value_address (objfile);
- mapped = section_is_mapped (osect) ? _("mapped") : _("unmapped");
+ mapped = section_is_mapped (osect) ? _ ("mapped") : _ ("unmapped");
sec_name = osect->the_bfd_section->name;
msym_name = msymbol->print_name ();
@@ -1573,41 +1558,36 @@ info_symbol_command (const char *arg, int from_tty)
if (current_program_space->multi_objfile_p ())
if (pc_in_unmapped_range (addr, osect))
if (section_is_overlay (osect))
- gdb_printf (_("%s in load address range of "
- "%s overlay section %s of %s\n"),
+ gdb_printf (_ ("%s in load address range of "
+ "%s overlay section %s of %s\n"),
loc_string, mapped, sec_name, obj_name);
else
- gdb_printf (_("%s in load address range of "
- "section %s of %s\n"),
+ gdb_printf (_ ("%s in load address range of "
+ "section %s of %s\n"),
loc_string, sec_name, obj_name);
+ else if (section_is_overlay (osect))
+ gdb_printf (_ ("%s in %s overlay section %s of %s\n"),
+ loc_string, mapped, sec_name, obj_name);
else
- if (section_is_overlay (osect))
- gdb_printf (_("%s in %s overlay section %s of %s\n"),
- loc_string, mapped, sec_name, obj_name);
- else
- gdb_printf (_("%s in section %s of %s\n"),
- loc_string, sec_name, obj_name);
- else
- if (pc_in_unmapped_range (addr, osect))
- if (section_is_overlay (osect))
- gdb_printf (_("%s in load address range of %s overlay "
- "section %s\n"),
- loc_string, mapped, sec_name);
- else
- gdb_printf
- (_("%s in load address range of section %s\n"),
- loc_string, sec_name);
+ gdb_printf (_ ("%s in section %s of %s\n"), loc_string,
+ sec_name, obj_name);
+ else if (pc_in_unmapped_range (addr, osect))
+ if (section_is_overlay (osect))
+ gdb_printf (_ ("%s in load address range of %s overlay "
+ "section %s\n"),
+ loc_string, mapped, sec_name);
else
- if (section_is_overlay (osect))
- gdb_printf (_("%s in %s overlay section %s\n"),
- loc_string, mapped, sec_name);
- else
- gdb_printf (_("%s in section %s\n"),
- loc_string, sec_name);
+ gdb_printf (_ ("%s in load address range of section %s\n"),
+ loc_string, sec_name);
+ else if (section_is_overlay (osect))
+ gdb_printf (_ ("%s in %s overlay section %s\n"), loc_string,
+ mapped, sec_name);
+ else
+ gdb_printf (_ ("%s in section %s\n"), loc_string, sec_name);
}
}
if (matches == 0)
- gdb_printf (_("No symbol matches %s.\n"), arg);
+ gdb_printf (_ ("No symbol matches %s.\n"), arg);
}
static void
@@ -1623,20 +1603,21 @@ info_address_command (const char *exp, int from_tty)
struct field_of_this_result is_a_field_of_this;
if (exp == 0)
- error (_("Argument required."));
+ error (_ ("Argument required."));
sym = lookup_symbol (exp, get_selected_block (&context_pc), VAR_DOMAIN,
- &is_a_field_of_this).symbol;
+ &is_a_field_of_this)
+ .symbol;
if (sym == NULL)
{
if (is_a_field_of_this.type != NULL)
{
gdb_printf ("Symbol \"");
- fprintf_symbol (gdb_stdout, exp,
- current_language->la_language, DMGL_ANSI);
+ fprintf_symbol (gdb_stdout, exp, current_language->la_language,
+ DMGL_ANSI);
gdb_printf ("\" is a field of the local class variable ");
if (current_language->la_language == language_objc)
- gdb_printf ("`self'\n"); /* ObjC equivalent of "this" */
+ gdb_printf ("`self'\n"); /* ObjC equivalent of "this" */
else
gdb_printf ("`this'\n");
return;
@@ -1652,8 +1633,8 @@ info_address_command (const char *exp, int from_tty)
load_addr = msymbol.value_address ();
gdb_printf ("Symbol \"");
- fprintf_symbol (gdb_stdout, exp,
- current_language->la_language, DMGL_ANSI);
+ fprintf_symbol (gdb_stdout, exp, current_language->la_language,
+ DMGL_ANSI);
gdb_printf ("\" is at ");
fputs_styled (paddress (gdbarch, load_addr), address_style.style (),
gdb_stdout);
@@ -1664,15 +1645,14 @@ info_address_command (const char *exp, int from_tty)
load_addr = overlay_unmapped_address (load_addr, section);
gdb_printf (",\n -- loaded at ");
fputs_styled (paddress (gdbarch, load_addr),
- address_style.style (),
- gdb_stdout);
+ address_style.style (), gdb_stdout);
gdb_printf (" in overlay section %s",
section->the_bfd_section->name);
}
gdb_printf (".\n");
}
else
- error (_("No symbol \"%s\" in current context."), exp);
+ error (_ ("No symbol \"%s\" in current context."), exp);
return;
}
@@ -1730,25 +1710,25 @@ info_address_command (const char *exp, int from_tty)
regno = SYMBOL_REGISTER_OPS (sym)->register_number (sym, gdbarch);
if (sym->is_argument ())
- gdb_printf (_("an argument in register %s"),
+ gdb_printf (_ ("an argument in register %s"),
gdbarch_register_name (gdbarch, regno));
else
- gdb_printf (_("a variable in register %s"),
+ gdb_printf (_ ("a variable in register %s"),
gdbarch_register_name (gdbarch, regno));
break;
case LOC_STATIC:
- gdb_printf (_("static storage at address "));
+ gdb_printf (_ ("static storage at address "));
load_addr = sym->value_address ();
fputs_styled (paddress (gdbarch, load_addr), address_style.style (),
gdb_stdout);
if (section_is_overlay (section))
{
load_addr = overlay_unmapped_address (load_addr, section);
- gdb_printf (_(",\n -- loaded at "));
+ gdb_printf (_ (",\n -- loaded at "));
fputs_styled (paddress (gdbarch, load_addr), address_style.style (),
gdb_stdout);
- gdb_printf (_(" in overlay section %s"),
+ gdb_printf (_ (" in overlay section %s"),
section->the_bfd_section->name);
}
break;
@@ -1756,38 +1736,38 @@ info_address_command (const char *exp, int from_tty)
case LOC_REGPARM_ADDR:
/* Note comment at LOC_REGISTER. */
regno = SYMBOL_REGISTER_OPS (sym)->register_number (sym, gdbarch);
- gdb_printf (_("address of an argument in register %s"),
+ gdb_printf (_ ("address of an argument in register %s"),
gdbarch_register_name (gdbarch, regno));
break;
case LOC_ARG:
- gdb_printf (_("an argument at offset %ld"), val);
+ gdb_printf (_ ("an argument at offset %ld"), val);
break;
case LOC_LOCAL:
- gdb_printf (_("a local variable at frame offset %ld"), val);
+ gdb_printf (_ ("a local variable at frame offset %ld"), val);
break;
case LOC_REF_ARG:
- gdb_printf (_("a reference argument at offset %ld"), val);
+ gdb_printf (_ ("a reference argument at offset %ld"), val);
break;
case LOC_TYPEDEF:
- gdb_printf (_("a typedef"));
+ gdb_printf (_ ("a typedef"));
break;
case LOC_BLOCK:
- gdb_printf (_("a function at address "));
+ gdb_printf (_ ("a function at address "));
load_addr = sym->value_block ()->entry_pc ();
fputs_styled (paddress (gdbarch, load_addr), address_style.style (),
gdb_stdout);
if (section_is_overlay (section))
{
load_addr = overlay_unmapped_address (load_addr, section);
- gdb_printf (_(",\n -- loaded at "));
+ gdb_printf (_ (",\n -- loaded at "));
fputs_styled (paddress (gdbarch, load_addr), address_style.style (),
gdb_stdout);
- gdb_printf (_(" in overlay section %s"),
+ gdb_printf (_ (" in overlay section %s"),
section->the_bfd_section->name);
}
break;
@@ -1807,25 +1787,24 @@ info_address_command (const char *exp, int from_tty)
&& (section->the_bfd_section->flags & SEC_THREAD_LOCAL) != 0)
{
load_addr = msym.minsym->value_raw_address ();
- gdb_printf (_("a thread-local variable at offset %s "
- "in the thread-local storage for `%s'"),
+ gdb_printf (_ ("a thread-local variable at offset %s "
+ "in the thread-local storage for `%s'"),
paddress (gdbarch, load_addr),
objfile_name (section->objfile));
}
else
{
load_addr = msym.value_address ();
- gdb_printf (_("static storage at address "));
+ gdb_printf (_ ("static storage at address "));
fputs_styled (paddress (gdbarch, load_addr),
address_style.style (), gdb_stdout);
if (section_is_overlay (section))
{
load_addr = overlay_unmapped_address (load_addr, section);
- gdb_printf (_(",\n -- loaded at "));
+ gdb_printf (_ (",\n -- loaded at "));
fputs_styled (paddress (gdbarch, load_addr),
- address_style.style (),
- gdb_stdout);
- gdb_printf (_(" in overlay section %s"),
+ address_style.style (), gdb_stdout);
+ gdb_printf (_ (" in overlay section %s"),
section->the_bfd_section->name);
}
}
@@ -1834,16 +1813,15 @@ info_address_command (const char *exp, int from_tty)
break;
case LOC_OPTIMIZED_OUT:
- gdb_printf (_("optimized out"));
+ gdb_printf (_ ("optimized out"));
break;
default:
- gdb_printf (_("of unknown (botched) type"));
+ gdb_printf (_ ("of unknown (botched) type"));
break;
}
gdb_printf (".\n");
}
-
static void
x_command (const char *exp, int from_tty)
@@ -1888,7 +1866,7 @@ x_command (const char *exp, int from_tty)
/* In rvalue contexts, such as this, functions are coerced into
pointers to functions. This makes "x/i main" work. */
if (value_type (val)->code () == TYPE_CODE_FUNC
- && VALUE_LVAL (val) == lval_memory)
+ && VALUE_LVAL (val) == lval_memory)
next_address = value_address (val);
else
next_address = value_as_address (val);
@@ -1897,7 +1875,7 @@ x_command (const char *exp, int from_tty)
}
if (!next_gdbarch)
- error_no_arg (_("starting display address"));
+ error_no_arg (_ ("starting display address"));
do_examine (fmt, next_gdbarch, next_address);
@@ -1938,8 +1916,8 @@ x_command (const char *exp, int from_tty)
static void
display_and_x_command_completer (struct cmd_list_element *ignore,
- completion_tracker &tracker,
- const char *text, const char * /*word*/)
+ completion_tracker &tracker, const char *text,
+ const char * /*word*/)
{
if (skip_over_slash_fmt (tracker, &text))
return;
@@ -1948,8 +1926,6 @@ display_and_x_command_completer (struct cmd_list_element *ignore,
expression_completer (ignore, tracker, text, word);
}
-
-
/* Add an expression to the auto-display chain.
Specify the expression. */
@@ -1986,8 +1962,8 @@ display_command (const char *arg, int from_tty)
innermost_block_tracker tracker;
expression_up expr = parse_expression (exp, &tracker);
- newobj = new display (exp, std::move (expr), fmt,
- current_program_space, tracker.block ());
+ newobj = new display (exp, std::move (expr), fmt, current_program_space,
+ tracker.block ());
all_displays.emplace_back (newobj);
if (from_tty)
@@ -2012,12 +1988,10 @@ delete_display (struct display *display)
{
gdb_assert (display != NULL);
- auto iter = std::find_if (all_displays.begin (),
- all_displays.end (),
- [=] (const std::unique_ptr<struct display> &item)
- {
- return item.get () == display;
- });
+ auto iter = std::find_if (all_displays.begin (), all_displays.end (),
+ [=] (const std::unique_ptr<struct display> &item) {
+ return item.get () == display;
+ });
gdb_assert (iter != all_displays.end ());
all_displays.erase (iter);
}
@@ -2032,7 +2006,7 @@ map_display_numbers (const char *args,
int num;
if (args == NULL)
- error_no_arg (_("one or more display numbers"));
+ error_no_arg (_ ("one or more display numbers"));
number_or_range_parser parser (args);
@@ -2042,17 +2016,16 @@ map_display_numbers (const char *args,
num = parser.get_number ();
if (num == 0)
- warning (_("bad display number at or near '%s'"), p);
+ warning (_ ("bad display number at or near '%s'"), p);
else
{
- auto iter = std::find_if (all_displays.begin (),
- all_displays.end (),
- [=] (const std::unique_ptr<display> &item)
- {
- return item->number == num;
- });
+ auto iter
+ = std::find_if (all_displays.begin (), all_displays.end (),
+ [=] (const std::unique_ptr<display> &item) {
+ return item->number == num;
+ });
if (iter == all_displays.end ())
- gdb_printf (_("No display number %d.\n"), num);
+ gdb_printf (_ ("No display number %d.\n"), num);
else
function (iter->get ());
}
@@ -2066,7 +2039,7 @@ undisplay_command (const char *args, int from_tty)
{
if (args == NULL)
{
- if (query (_("Delete all auto-display expressions? ")))
+ if (query (_ ("Delete all auto-display expressions? ")))
clear_displays ();
dont_repeat ();
return;
@@ -2103,7 +2076,6 @@ do_one_display (struct display *d)
if (d->exp == NULL)
{
-
try
{
innermost_block_tracker tracker;
@@ -2114,8 +2086,8 @@ do_one_display (struct display *d)
{
/* Can't re-parse the expression. Disable this display item. */
d->enabled_p = false;
- warning (_("Unable to display \"%s\": %s"),
- d->exp_string.c_str (), ex.what ());
+ warning (_ ("Unable to display \"%s\": %s"), d->exp_string.c_str (),
+ ex.what ());
return;
}
}
@@ -2123,8 +2095,8 @@ do_one_display (struct display *d)
if (d->block)
{
if (d->pspace == current_program_space)
- within_current_scope = contained_in (get_selected_block (0), d->block,
- true);
+ within_current_scope
+ = contained_in (get_selected_block (0), d->block, true);
else
within_current_scope = 0;
}
@@ -2142,7 +2114,6 @@ do_one_display (struct display *d)
gdb_printf (": ");
if (d->format.size)
{
-
annotate_display_format ();
gdb_printf ("x/");
@@ -2178,9 +2149,8 @@ do_one_display (struct display *d)
}
catch (const gdb_exception_error &ex)
{
- gdb_printf (_("%p[<error: %s>%p]\n"),
- metadata_style.style ().ptr (), ex.what (),
- nullptr);
+ gdb_printf (_ ("%p[<error: %s>%p]\n"),
+ metadata_style.style ().ptr (), ex.what (), nullptr);
}
}
else
@@ -2214,7 +2184,7 @@ do_one_display (struct display *d)
catch (const gdb_exception_error &ex)
{
fprintf_styled (gdb_stdout, metadata_style.style (),
- _("<error: %s>"), ex.what ());
+ _ ("<error: %s>"), ex.what ());
}
gdb_printf ("\n");
@@ -2247,7 +2217,7 @@ disable_display (int num)
d->enabled_p = false;
return;
}
- gdb_printf (_("No display number %d.\n"), num);
+ gdb_printf (_ ("No display number %d.\n"), num);
}
void
@@ -2257,8 +2227,8 @@ disable_current_display (void)
{
disable_display (current_display_number);
gdb_printf (gdb_stderr,
- _("Disabling display %d to "
- "avoid infinite recursion.\n"),
+ _ ("Disabling display %d to "
+ "avoid infinite recursion.\n"),
current_display_number);
}
current_display_number = -1;
@@ -2268,9 +2238,9 @@ static void
info_display_command (const char *ignore, int from_tty)
{
if (all_displays.empty ())
- gdb_printf (_("There are no auto-display expressions now.\n"));
+ gdb_printf (_ ("There are no auto-display expressions now.\n"));
else
- gdb_printf (_("Auto-display expressions now in effect:\n\
+ gdb_printf (_ ("Auto-display expressions now in effect:\n\
Num Enb Expression\n"));
for (auto &d : all_displays)
@@ -2283,7 +2253,7 @@ Num Enb Expression\n"));
gdb_printf ("/%c ", d->format.format);
gdb_puts (d->exp_string.c_str ());
if (d->block && !contained_in (get_selected_block (0), d->block, true))
- gdb_printf (_(" (cannot be evaluated in the current context)"));
+ gdb_printf (_ (" (cannot be evaluated in the current context)"));
gdb_printf ("\n");
}
}
@@ -2302,10 +2272,7 @@ enable_disable_display_command (const char *args, int from_tty, bool enable)
}
map_display_numbers (args,
- [=] (struct display *d)
- {
- d->enabled_p = enable;
- });
+ [=] (struct display *d) { d->enabled_p = enable; });
}
/* The "enable display" command. */
@@ -2368,7 +2335,6 @@ clear_dangling_display_expressions (struct objfile *objfile)
}
}
}
-
/* Print the value in stack frame FRAME of a variable specified by a
struct symbol. NAME is the name to print; if NULL then VAR's print
@@ -2380,10 +2346,9 @@ clear_dangling_display_expressions (struct objfile *objfile)
void
print_variable_and_value (const char *name, struct symbol *var,
- frame_info_ptr frame,
- struct ui_file *stream, int indent)
+ frame_info_ptr frame, struct ui_file *stream,
+ int indent)
{
-
if (!name)
name = var->print_name ();
@@ -2442,18 +2407,19 @@ printf_c_string (struct ui_file *stream, const char *format,
gdb_byte *tem_str = (gdb_byte *) alloca (len + 1);
memcpy (tem_str, value_contents (value).data (), len);
- tem_str [len] = 0;
+ tem_str[len] = 0;
str = tem_str;
}
else
{
- CORE_ADDR tem = value_as_address (value);;
+ CORE_ADDR tem = value_as_address (value);
+ ;
if (tem == 0)
{
DIAGNOSTIC_PUSH
DIAGNOSTIC_IGNORE_FORMAT_NONLITERAL
- gdb_printf (stream, format, "(null)");
+ gdb_printf (stream, format, "(null)");
DIAGNOSTIC_POP
return;
}
@@ -2482,7 +2448,7 @@ printf_c_string (struct ui_file *stream, const char *format,
DIAGNOSTIC_PUSH
DIAGNOSTIC_IGNORE_FORMAT_NONLITERAL
- gdb_printf (stream, format, (char *) str);
+ gdb_printf (stream, format, (char *) str);
DIAGNOSTIC_POP
}
@@ -2498,8 +2464,7 @@ printf_wide_c_string (struct ui_file *stream, const char *format,
const gdb_byte *str;
size_t len;
struct gdbarch *gdbarch = value_type (value)->arch ();
- struct type *wctype = lookup_typename (current_language,
- "wchar_t", NULL, 0);
+ struct type *wctype = lookup_typename (current_language, "wchar_t", NULL, 0);
int wcwidth = wctype->length ();
if (VALUE_LVAL (value) == lval_internalvar
@@ -2516,7 +2481,7 @@ printf_wide_c_string (struct ui_file *stream, const char *format,
{
DIAGNOSTIC_PUSH
DIAGNOSTIC_IGNORE_FORMAT_NONLITERAL
- gdb_printf (stream, format, "(null)");
+ gdb_printf (stream, format, "(null)");
DIAGNOSTIC_POP
return;
}
@@ -2544,15 +2509,13 @@ printf_wide_c_string (struct ui_file *stream, const char *format,
auto_obstack output;
- convert_between_encodings (target_wide_charset (gdbarch),
- host_charset (),
- str, len, wcwidth,
- &output, translit_char);
+ convert_between_encodings (target_wide_charset (gdbarch), host_charset (),
+ str, len, wcwidth, &output, translit_char);
obstack_grow_str0 (&output, "");
DIAGNOSTIC_PUSH
DIAGNOSTIC_IGNORE_FORMAT_NONLITERAL
- gdb_printf (stream, format, obstack_base (&output));
+ gdb_printf (stream, format, obstack_base (&output));
DIAGNOSTIC_POP
}
@@ -2571,23 +2534,23 @@ printf_floating (struct ui_file *stream, const char *format,
struct type *fmt_type;
switch (argclass)
{
- case double_arg:
- fmt_type = builtin_type (gdbarch)->builtin_double;
- break;
- case long_double_arg:
- fmt_type = builtin_type (gdbarch)->builtin_long_double;
- break;
- case dec32float_arg:
- fmt_type = builtin_type (gdbarch)->builtin_decfloat;
- break;
- case dec64float_arg:
- fmt_type = builtin_type (gdbarch)->builtin_decdouble;
- break;
- case dec128float_arg:
- fmt_type = builtin_type (gdbarch)->builtin_declong;
- break;
- default:
- gdb_assert_not_reached ("unexpected argument class");
+ case double_arg:
+ fmt_type = builtin_type (gdbarch)->builtin_double;
+ break;
+ case long_double_arg:
+ fmt_type = builtin_type (gdbarch)->builtin_long_double;
+ break;
+ case dec32float_arg:
+ fmt_type = builtin_type (gdbarch)->builtin_decfloat;
+ break;
+ case dec64float_arg:
+ fmt_type = builtin_type (gdbarch)->builtin_decdouble;
+ break;
+ case dec128float_arg:
+ fmt_type = builtin_type (gdbarch)->builtin_declong;
+ break;
+ default:
+ gdb_assert_not_reached ("unexpected argument class");
}
/* To match the traditional GDB behavior, the conversion is
@@ -2614,15 +2577,15 @@ printf_floating (struct ui_file *stream, const char *format,
{
param_type = float_type_from_length (param_type);
if (param_type != value_type (value))
- value = value_from_contents (param_type,
- value_contents (value).data ());
+ value
+ = value_from_contents (param_type, value_contents (value).data ());
}
value = value_cast (fmt_type, value);
/* Convert the value to a string and print it. */
- std::string str
- = target_float_to_string (value_contents (value).data (), fmt_type, format);
+ std::string str = target_float_to_string (value_contents (value).data (),
+ fmt_type, format);
gdb_puts (str.c_str (), stream);
}
@@ -2684,7 +2647,7 @@ printf_pointer (struct ui_file *stream, const char *format,
*fmt_p++ = '\0';
DIAGNOSTIC_PUSH
DIAGNOSTIC_IGNORE_FORMAT_NONLITERAL
- gdb_printf (stream, fmt, val);
+ gdb_printf (stream, fmt, val);
DIAGNOSTIC_POP
}
else
@@ -2693,7 +2656,7 @@ printf_pointer (struct ui_file *stream, const char *format,
*fmt_p++ = '\0';
DIAGNOSTIC_PUSH
DIAGNOSTIC_IGNORE_FORMAT_NONLITERAL
- gdb_printf (stream, fmt, "(nil)");
+ gdb_printf (stream, fmt, "(nil)");
DIAGNOSTIC_POP
}
}
@@ -2707,23 +2670,23 @@ ui_printf (const char *arg, struct ui_file *stream)
std::vector<struct value *> val_args;
if (s == 0)
- error_no_arg (_("format-control string and values to print"));
+ error_no_arg (_ ("format-control string and values to print"));
s = skip_spaces (s);
/* A format string should follow, enveloped in double quotes. */
if (*s++ != '"')
- error (_("Bad format string, missing '\"'."));
+ error (_ ("Bad format string, missing '\"'."));
format_pieces fpieces (&s);
if (*s++ != '"')
- error (_("Bad format string, non-terminated '\"'."));
-
+ error (_ ("Bad format string, non-terminated '\"'."));
+
s = skip_spaces (s);
if (*s != ',' && *s != 0)
- error (_("Invalid argument syntax"));
+ error (_ ("Invalid argument syntax"));
if (*s == ',')
s++;
@@ -2755,7 +2718,7 @@ ui_printf (const char *arg, struct ui_file *stream)
}
if (val_args.size () != nargs_wanted)
- error (_("Wrong number of arguments for specified format-string"));
+ error (_ ("Wrong number of arguments for specified format-string"));
/* Now actually print them. */
i = 0;
@@ -2773,31 +2736,30 @@ ui_printf (const char *arg, struct ui_file *stream)
case wide_char_arg:
{
struct gdbarch *gdbarch = value_type (val_args[i])->arch ();
- struct type *wctype = lookup_typename (current_language,
- "wchar_t", NULL, 0);
+ struct type *wctype
+ = lookup_typename (current_language, "wchar_t", NULL, 0);
struct type *valtype;
const gdb_byte *bytes;
valtype = value_type (val_args[i]);
if (valtype->length () != wctype->length ()
|| valtype->code () != TYPE_CODE_INT)
- error (_("expected wchar_t argument for %%lc"));
+ error (_ ("expected wchar_t argument for %%lc"));
bytes = value_contents (val_args[i]).data ();
auto_obstack output;
convert_between_encodings (target_wide_charset (gdbarch),
- host_charset (),
- bytes, valtype->length (),
+ host_charset (), bytes,
valtype->length (),
- &output, translit_char);
+ valtype->length (), &output,
+ translit_char);
obstack_grow_str0 (&output, "");
DIAGNOSTIC_PUSH
DIAGNOSTIC_IGNORE_FORMAT_NONLITERAL
- gdb_printf (stream, current_substring,
- obstack_base (&output));
+ gdb_printf (stream, current_substring, obstack_base (&output));
DIAGNOSTIC_POP
}
break;
@@ -2808,12 +2770,12 @@ ui_printf (const char *arg, struct ui_file *stream)
DIAGNOSTIC_PUSH
DIAGNOSTIC_IGNORE_FORMAT_NONLITERAL
- gdb_printf (stream, current_substring, val);
+ gdb_printf (stream, current_substring, val);
DIAGNOSTIC_POP
break;
}
#else
- error (_("long long not supported in printf"));
+ error (_ ("long long not supported in printf"));
#endif
case int_arg:
{
@@ -2821,7 +2783,7 @@ ui_printf (const char *arg, struct ui_file *stream)
DIAGNOSTIC_PUSH
DIAGNOSTIC_IGNORE_FORMAT_NONLITERAL
- gdb_printf (stream, current_substring, val);
+ gdb_printf (stream, current_substring, val);
DIAGNOSTIC_POP
break;
}
@@ -2831,7 +2793,7 @@ ui_printf (const char *arg, struct ui_file *stream)
DIAGNOSTIC_PUSH
DIAGNOSTIC_IGNORE_FORMAT_NONLITERAL
- gdb_printf (stream, current_substring, val);
+ gdb_printf (stream, current_substring, val);
DIAGNOSTIC_POP
break;
}
@@ -2841,7 +2803,7 @@ ui_printf (const char *arg, struct ui_file *stream)
DIAGNOSTIC_PUSH
DIAGNOSTIC_IGNORE_FORMAT_NONLITERAL
- gdb_printf (stream, current_substring, val);
+ gdb_printf (stream, current_substring, val);
DIAGNOSTIC_POP
break;
}
@@ -2868,11 +2830,11 @@ ui_printf (const char *arg, struct ui_file *stream)
argument. */
DIAGNOSTIC_PUSH
DIAGNOSTIC_IGNORE_FORMAT_NONLITERAL
- gdb_printf (stream, current_substring, 0);
+ gdb_printf (stream, current_substring, 0);
DIAGNOSTIC_POP
break;
default:
- internal_error (_("failed internal consistency check"));
+ internal_error (_ ("failed internal consistency check"));
}
/* Maybe advance to the next argument. */
if (piece.argclass != literal_piece)
@@ -2911,7 +2873,7 @@ eval_command (const char *arg, int from_tty)
static void
show_addr_not_tagged (CORE_ADDR address)
{
- error (_("Address %s not in a region mapped with a memory tagging flag."),
+ error (_ ("Address %s not in a region mapped with a memory tagging flag."),
paddress (target_gdbarch (), address));
}
@@ -2920,8 +2882,8 @@ show_addr_not_tagged (CORE_ADDR address)
static void
show_memory_tagging_unsupported (void)
{
- error (_("Memory tagging not supported or disabled by the current"
- " architecture."));
+ error (_ ("Memory tagging not supported or disabled by the current"
+ " architecture."));
}
/* Implement the "memory-tag" prefix command. */
@@ -2938,7 +2900,7 @@ static void
memory_tag_print_tag_command (const char *args, enum memtag_type tag_type)
{
if (args == nullptr)
- error_no_arg (_("address or pointer"));
+ error_no_arg (_ ("address or pointer"));
/* Parse args into a value. If the value is a pointer or an address,
then fetch the logical or allocation tag. */
@@ -2959,13 +2921,11 @@ memory_tag_print_tag_command (const char *args, enum memtag_type tag_type)
std::string tag = gdbarch_memtag_to_string (target_gdbarch (), tag_value);
if (tag.empty ())
- gdb_printf (_("%s tag unavailable.\n"),
- tag_type
- == memtag_type::logical? "Logical" : "Allocation");
+ gdb_printf (_ ("%s tag unavailable.\n"),
+ tag_type == memtag_type::logical ? "Logical" : "Allocation");
- struct value *v_tag = process_print_command_args (tag.c_str (),
- &print_opts,
- true);
+ struct value *v_tag
+ = process_print_command_args (tag.c_str (), &print_opts, true);
print_opts.output_format = 'x';
print_value (v_tag, print_opts);
}
@@ -3004,18 +2964,18 @@ parse_with_logical_tag_input (const char *args, struct value **val,
std::string address_string = extract_string_maybe_quoted (&args);
/* Parse the address into a value. */
- *val = process_print_command_args (address_string.c_str (), print_opts,
- true);
+ *val
+ = process_print_command_args (address_string.c_str (), print_opts, true);
/* Fetch the tag bytes. */
std::string tag_string = extract_string_maybe_quoted (&args);
/* Validate the input. */
if (address_string.empty () || tag_string.empty ())
- error (_("Missing arguments."));
+ error (_ ("Missing arguments."));
if (tag_string.length () != 2)
- error (_("Error parsing tags argument. The tag should be 2 digits."));
+ error (_ ("Error parsing tags argument. The tag should be 2 digits."));
tags = hex2bin (tag_string.c_str ());
}
@@ -3029,7 +2989,7 @@ memory_tag_with_logical_tag_command (const char *args, int from_tty)
show_memory_tagging_unsupported ();
if (args == nullptr)
- error_no_arg (_("<address> <tag>"));
+ error_no_arg (_ ("<address> <tag>"));
gdb::byte_vector tags;
struct value *val;
@@ -3051,13 +3011,12 @@ memory_tag_with_logical_tag_command (const char *args, int from_tty)
length. */
/* Cast to (void *). */
- val = value_cast (builtin_type (target_gdbarch ())->builtin_data_ptr,
- val);
+ val = value_cast (builtin_type (target_gdbarch ())->builtin_data_ptr, val);
/* Length doesn't matter for a logical tag. Pass 0. */
if (!gdbarch_set_memtags (target_gdbarch (), val, 0, tags,
memtag_type::logical))
- gdb_printf (_("Could not update the logical tag data.\n"));
+ gdb_printf (_ ("Could not update the logical tag data.\n"));
else
{
/* Always print it in hex format. */
@@ -3077,8 +3036,8 @@ parse_set_allocation_tag_input (const char *args, struct value **val,
/* Parse the address into a value. */
value_print_options print_opts;
- *val = process_print_command_args (address_string.c_str (), &print_opts,
- true);
+ *val
+ = process_print_command_args (address_string.c_str (), &print_opts, true);
/* Fetch the length. */
std::string length_string = extract_string_maybe_quoted (&args);
@@ -3087,23 +3046,25 @@ parse_set_allocation_tag_input (const char *args, struct value **val,
std::string tags_string = extract_string_maybe_quoted (&args);
/* Validate the input. */
- if (address_string.empty () || length_string.empty () || tags_string.empty ())
- error (_("Missing arguments."));
+ if (address_string.empty () || length_string.empty ()
+ || tags_string.empty ())
+ error (_ ("Missing arguments."));
errno = 0;
const char *trailer = nullptr;
LONGEST parsed_length = strtoulst (length_string.c_str (), &trailer, 10);
if (errno != 0 || (trailer != nullptr && trailer[0] != '\0'))
- error (_("Error parsing length argument."));
+ error (_ ("Error parsing length argument."));
if (parsed_length <= 0)
- error (_("Invalid zero or negative length."));
+ error (_ ("Invalid zero or negative length."));
*length = parsed_length;
if (tags_string.length () % 2)
- error (_("Error parsing tags argument. Tags should be 2 digits per byte."));
+ error (
+ _ ("Error parsing tags argument. Tags should be 2 digits per byte."));
tags = hex2bin (tags_string.c_str ());
@@ -3123,7 +3084,7 @@ memory_tag_set_allocation_tag_command (const char *args, int from_tty)
show_memory_tagging_unsupported ();
if (args == nullptr)
- error_no_arg (_("<starting address> <length> <tag bytes>"));
+ error_no_arg (_ ("<starting address> <length> <tag bytes>"));
gdb::byte_vector tags;
size_t length = 0;
@@ -3134,9 +3095,9 @@ memory_tag_set_allocation_tag_command (const char *args, int from_tty)
if (!gdbarch_set_memtags (target_gdbarch (), val, length, tags,
memtag_type::allocation))
- gdb_printf (_("Could not update the allocation tag(s).\n"));
+ gdb_printf (_ ("Could not update the allocation tag(s).\n"));
else
- gdb_printf (_("Allocation tag(s) updated successfully.\n"));
+ gdb_printf (_ ("Allocation tag(s) updated successfully.\n"));
}
/* Implement the "memory-tag check" command. */
@@ -3148,7 +3109,7 @@ memory_tag_check_command (const char *args, int from_tty)
show_memory_tagging_unsupported ();
if (args == nullptr)
- error (_("Argument required (address or pointer)"));
+ error (_ ("Argument required (address or pointer)"));
/* Parse the expression into a value. If the value is an address or
pointer, then check its logical tag against the allocation tag. */
@@ -3168,16 +3129,14 @@ memory_tag_check_command (const char *args, int from_tty)
{
struct value *tag
= gdbarch_get_memtag (target_gdbarch (), val, memtag_type::logical);
- std::string ltag
- = gdbarch_memtag_to_string (target_gdbarch (), tag);
+ std::string ltag = gdbarch_memtag_to_string (target_gdbarch (), tag);
- tag = gdbarch_get_memtag (target_gdbarch (), val,
- memtag_type::allocation);
- std::string atag
- = gdbarch_memtag_to_string (target_gdbarch (), tag);
+ tag
+ = gdbarch_get_memtag (target_gdbarch (), val, memtag_type::allocation);
+ std::string atag = gdbarch_memtag_to_string (target_gdbarch (), tag);
- gdb_printf (_("Logical tag (%s) does not match"
- " the allocation tag (%s) for address %s.\n"),
+ gdb_printf (_ ("Logical tag (%s) does not match"
+ " the allocation tag (%s) for address %s.\n"),
ltag.c_str (), atag.c_str (),
paddress (target_gdbarch (), addr));
}
@@ -3185,15 +3144,15 @@ memory_tag_check_command (const char *args, int from_tty)
{
struct value *tag
= gdbarch_get_memtag (target_gdbarch (), val, memtag_type::logical);
- std::string ltag
- = gdbarch_memtag_to_string (target_gdbarch (), tag);
+ std::string ltag = gdbarch_memtag_to_string (target_gdbarch (), tag);
- gdb_printf (_("Memory tags for address %s match (%s).\n"),
+ gdb_printf (_ ("Memory tags for address %s match (%s).\n"),
paddress (target_gdbarch (), addr), ltag.c_str ());
}
}
void _initialize_printcmd ();
+
void
_initialize_printcmd ()
{
@@ -3205,15 +3164,15 @@ _initialize_printcmd ()
"printcmd");
add_info ("address", info_address_command,
- _("Describe where symbol SYM is stored.\n\
+ _ ("Describe where symbol SYM is stored.\n\
Usage: info address SYM"));
- add_info ("symbol", info_symbol_command, _("\
+ add_info ("symbol", info_symbol_command, _ ("\
Describe what symbol is at location ADDR.\n\
Usage: info symbol ADDR\n\
Only for symbols with fixed locations (global or static scope)."));
- c = add_com ("x", class_vars, x_command, _("\
+ c = add_com ("x", class_vars, x_command, _ ("\
Examine memory: x/FMT ADDRESS.\n\
ADDRESS is an expression for the memory address to examine.\n\
FMT is a repeat count followed by a format letter and a size letter.\n\
@@ -3229,11 +3188,11 @@ Default count is 1. Default address is following last thing printed\n\
with this command or \"print\"."));
set_cmd_completer_handle_brkchars (c, display_and_x_command_completer);
- add_info ("display", info_display_command, _("\
+ add_info ("display", info_display_command, _ ("\
Expressions to display when program stops, with code numbers.\n\
Usage: info display"));
- add_cmd ("undisplay", class_vars, undisplay_command, _("\
+ add_cmd ("undisplay", class_vars, undisplay_command, _ ("\
Cancel some expressions to be displayed when program stops.\n\
Usage: undisplay [NUM]...\n\
Arguments are the code numbers of the expressions to stop displaying.\n\
@@ -3242,7 +3201,7 @@ No argument means cancel all automatic-display expressions.\n\
Do \"info display\" to see current list of code numbers."),
&cmdlist);
- c = add_com ("display", class_vars, display_command, _("\
+ c = add_com ("display", class_vars, display_command, _ ("\
Print value of expression EXP each time the program stops.\n\
Usage: display[/FMT] EXP\n\
/FMT may be used before EXP as in the \"print\" command.\n\
@@ -3253,38 +3212,41 @@ With no argument, display all currently requested auto-display expressions.\n\
Use \"undisplay\" to cancel display requests previously made."));
set_cmd_completer_handle_brkchars (c, display_and_x_command_completer);
- add_cmd ("display", class_vars, enable_display_command, _("\
+ add_cmd ("display", class_vars, enable_display_command, _ ("\
Enable some expressions to be displayed when program stops.\n\
Usage: enable display [NUM]...\n\
Arguments are the code numbers of the expressions to resume displaying.\n\
No argument means enable all automatic-display expressions.\n\
-Do \"info display\" to see current list of code numbers."), &enablelist);
+Do \"info display\" to see current list of code numbers."),
+ &enablelist);
- add_cmd ("display", class_vars, disable_display_command, _("\
+ add_cmd ("display", class_vars, disable_display_command, _ ("\
Disable some expressions to be displayed when program stops.\n\
Usage: disable display [NUM]...\n\
Arguments are the code numbers of the expressions to stop displaying.\n\
No argument means disable all automatic-display expressions.\n\
-Do \"info display\" to see current list of code numbers."), &disablelist);
+Do \"info display\" to see current list of code numbers."),
+ &disablelist);
- add_cmd ("display", class_vars, undisplay_command, _("\
+ add_cmd ("display", class_vars, undisplay_command, _ ("\
Cancel some expressions to be displayed when program stops.\n\
Usage: delete display [NUM]...\n\
Arguments are the code numbers of the expressions to stop displaying.\n\
No argument means cancel all automatic-display expressions.\n\
-Do \"info display\" to see current list of code numbers."), &deletelist);
+Do \"info display\" to see current list of code numbers."),
+ &deletelist);
- add_com ("printf", class_vars, printf_command, _("\
+ add_com ("printf", class_vars, printf_command, _ ("\
Formatted printing, like the C \"printf\" function.\n\
Usage: printf \"format string\", ARG1, ARG2, ARG3, ..., ARGN\n\
This supports most C printf format specifications, like %s, %d, etc."));
- add_com ("output", class_vars, output_command, _("\
+ add_com ("output", class_vars, output_command, _ ("\
Like \"print\" but don't put in value history and don't print newline.\n\
Usage: output EXP\n\
This is useful in user-defined commands."));
- add_prefix_cmd ("set", class_vars, set_command, _("\
+ add_prefix_cmd ("set", class_vars, set_command, _ ("\
Evaluate expression EXP and assign result to variable VAR.\n\
Usage: set VAR = EXP\n\
This uses assignment syntax appropriate for the current language\n\
@@ -3299,7 +3261,7 @@ You can see these environment settings with the \"show\" command."),
&setlist, 1, &cmdlist);
/* "call" is the same as "set", but handy for dbx users to call fns. */
- c = add_com ("call", class_vars, call_command, _("\
+ c = add_com ("call", class_vars, call_command, _ ("\
Call a function in the program.\n\
Usage: call EXP\n\
The argument is the function name and arguments, in the notation of the\n\
@@ -3308,7 +3270,7 @@ history, if it is not void."));
set_cmd_completer_handle_brkchars (c, print_command_completer);
cmd_list_element *set_variable_cmd
- = add_cmd ("variable", class_vars, set_command, _("\
+ = add_cmd ("variable", class_vars, set_command, _ ("\
Evaluate expression EXP and assign result to variable VAR.\n\
Usage: set variable VAR = EXP\n\
This uses assignment syntax appropriate for the current language\n\
@@ -3322,7 +3284,7 @@ This may usually be abbreviated to simply \"set\"."),
const auto print_opts = make_value_print_options_def_group (nullptr);
- static const std::string print_help = gdb::option::build_help (_("\
+ static const std::string print_help = gdb::option::build_help (_ ("\
Print value of expression EXP.\n\
Usage: print [[OPTION]... --] [/FMT] [EXP]\n\
\n\
@@ -3353,7 +3315,7 @@ resides in memory.\n\
\n\
EXP may be preceded with /FMT, where FMT is a format letter\n\
but no count or size letter (see \"x\" command)."),
- print_opts);
+ print_opts);
cmd_list_element *print_cmd
= add_com ("print", class_vars, print_command, print_help.c_str ());
@@ -3362,33 +3324,34 @@ but no count or size letter (see \"x\" command)."),
add_com_alias ("inspect", print_cmd, class_vars, 1);
add_setshow_uinteger_cmd ("max-symbolic-offset", no_class,
- &max_symbolic_offset, _("\
-Set the largest offset that will be printed in <SYMBOL+1234> form."), _("\
-Show the largest offset that will be printed in <SYMBOL+1234> form."), _("\
+ &max_symbolic_offset, _ ("\
+Set the largest offset that will be printed in <SYMBOL+1234> form."),
+ _ ("\
+Show the largest offset that will be printed in <SYMBOL+1234> form."),
+ _ ("\
Tell GDB to only display the symbolic form of an address if the\n\
offset between the closest earlier symbol and the address is less than\n\
the specified maximum offset. The default is \"unlimited\", which tells GDB\n\
to always print the symbolic form of an address if any symbol precedes\n\
it. Zero is equivalent to \"unlimited\"."),
- NULL,
- show_max_symbolic_offset,
- &setprintlist, &showprintlist);
- add_setshow_boolean_cmd ("symbol-filename", no_class,
- &print_symbol_filename, _("\
-Set printing of source filename and line number with <SYMBOL>."), _("\
-Show printing of source filename and line number with <SYMBOL>."), NULL,
- NULL,
- show_print_symbol_filename,
+ NULL, show_max_symbolic_offset, &setprintlist,
+ &showprintlist);
+ add_setshow_boolean_cmd ("symbol-filename", no_class, &print_symbol_filename,
+ _ ("\
+Set printing of source filename and line number with <SYMBOL>."),
+ _ ("\
+Show printing of source filename and line number with <SYMBOL>."),
+ NULL, NULL, show_print_symbol_filename,
&setprintlist, &showprintlist);
- add_com ("eval", no_class, eval_command, _("\
+ add_com ("eval", no_class, eval_command, _ ("\
Construct a GDB command and then evaluate it.\n\
Usage: eval \"format string\", ARG1, ARG2, ARG3, ..., ARGN\n\
Convert the arguments to a string as \"printf\" would, but then\n\
treat this string as a command line, and evaluate it."));
/* Memory tagging commands. */
- add_prefix_cmd ("memory-tag", class_vars, memory_tag_command, _("\
+ add_prefix_cmd ("memory-tag", class_vars, memory_tag_command, _ ("\
Generic command for printing and manipulating memory tag properties."),
&memory_tag_list, 0, &cmdlist);
add_cmd ("print-logical-tag", class_vars,
@@ -3401,14 +3364,14 @@ architecture-specific."),
&memory_tag_list);
add_cmd ("print-allocation-tag", class_vars,
memory_tag_print_allocation_tag_command,
- _("Print the allocation tag for ADDRESS.\n\
+ _ ("Print the allocation tag for ADDRESS.\n\
Usage: memory-tag print-allocation-tag <ADDRESS>.\n\
<ADDRESS> is an expression that evaluates to a memory address.\n\
Print the allocation tag associated with the memory address ADDRESS.\n\
The tag interpretation is architecture-specific."),
&memory_tag_list);
add_cmd ("with-logical-tag", class_vars, memory_tag_with_logical_tag_command,
- _("Print a POINTER with a specific logical TAG.\n\
+ _ ("Print a POINTER with a specific logical TAG.\n\
Usage: memory-tag with-logical-tag <POINTER> <TAG>\n\
<POINTER> is an expression that evaluates to a pointer.\n\
<TAG> is a sequence of hex bytes that is interpreted by the architecture\n\
@@ -3416,7 +3379,7 @@ as a single memory tag."),
&memory_tag_list);
add_cmd ("set-allocation-tag", class_vars,
memory_tag_set_allocation_tag_command,
- _("Set the allocation tag(s) for a memory range.\n\
+ _ ("Set the allocation tag(s) for a memory range.\n\
Usage: memory-tag set-allocation-tag <ADDRESS> <LENGTH> <TAG_BYTES>\n\
<ADDRESS> is an expression that evaluates to a memory address\n\
<LENGTH> is the number of bytes that is added to <ADDRESS> to calculate\n\
@@ -3436,7 +3399,7 @@ that gets repeated until the number of tag granules in the memory range\n\
[ADDRESS, ADDRESS + LENGTH) is updated."),
&memory_tag_list);
add_cmd ("check", class_vars, memory_tag_check_command,
- _("Validate a pointer's logical tag against the allocation tag.\n\
+ _ ("Validate a pointer's logical tag against the allocation tag.\n\
Usage: memory-tag check <POINTER>\n\
<POINTER> is an expression that evaluates to a pointer\n\
Fetch the logical and allocation tags for POINTER and compare them\n\
diff --git a/gdb/probe.c b/gdb/probe.c
index 13e95bcfb20..da482f21991 100644
--- a/gdb/probe.c
+++ b/gdb/probe.c
@@ -43,6 +43,7 @@
class any_static_probe_ops : public static_probe_ops
{
public:
+
/* See probe.h. */
bool is_linespec (const char **linespecp) const override;
@@ -54,8 +55,8 @@ public:
const char *type_name () const override;
/* See probe.h. */
- std::vector<struct info_probe_column> gen_info_probes_table_header
- () const override;
+ std::vector<struct info_probe_column>
+ gen_info_probes_table_header () const override;
};
/* Static operations associated with a generic probe. */
@@ -68,10 +69,8 @@ const any_static_probe_ops any_static_probe_ops {};
static void
parse_probes_in_pspace (const static_probe_ops *spops,
struct program_space *search_pspace,
- const char *objfile_namestr,
- const char *provider,
- const char *name,
- std::vector<symtab_and_line> *result)
+ const char *objfile_namestr, const char *provider,
+ const char *name, std::vector<symtab_and_line> *result)
{
for (objfile *objfile : search_pspace->objfiles ())
{
@@ -80,8 +79,8 @@ parse_probes_in_pspace (const static_probe_ops *spops,
if (objfile_namestr
&& FILENAME_CMP (objfile_name (objfile), objfile_namestr) != 0
- && FILENAME_CMP (lbasename (objfile_name (objfile)),
- objfile_namestr) != 0)
+ && FILENAME_CMP (lbasename (objfile_name (objfile)), objfile_namestr)
+ != 0)
continue;
const std::vector<std::unique_ptr<probe>> &probes
@@ -128,12 +127,12 @@ parse_probes (const location_spec *locspec,
cs = arg_start;
const static_probe_ops *spops = probe_linespec_to_static_ops (&cs);
if (spops == NULL)
- error (_("'%s' is not a probe linespec"), arg_start);
+ error (_ ("'%s' is not a probe linespec"), arg_start);
arg = (char *) cs;
arg = skip_spaces (arg);
if (!*arg)
- error (_("argument to `%s' missing"), arg_start);
+ error (_ ("argument to `%s' missing"), arg_start);
arg_end = skip_to_space (arg);
@@ -171,32 +170,32 @@ parse_probes (const location_spec *locspec,
}
if (*name == '\0')
- error (_("no probe name specified"));
+ error (_ ("no probe name specified"));
if (provider && *provider == '\0')
- error (_("invalid provider name"));
+ error (_ ("invalid provider name"));
if (objfile_namestr && *objfile_namestr == '\0')
- error (_("invalid objfile name"));
+ error (_ ("invalid objfile name"));
std::vector<symtab_and_line> result;
if (search_pspace != NULL)
{
- parse_probes_in_pspace (spops, search_pspace, objfile_namestr,
- provider, name, &result);
+ parse_probes_in_pspace (spops, search_pspace, objfile_namestr, provider,
+ name, &result);
}
else
{
for (struct program_space *pspace : program_spaces)
- parse_probes_in_pspace (spops, pspace, objfile_namestr,
- provider, name, &result);
+ parse_probes_in_pspace (spops, pspace, objfile_namestr, provider, name,
+ &result);
}
if (result.empty ())
{
- throw_error (NOT_FOUND_ERROR,
- _("No probe matching objfile=`%s', provider=`%s', name=`%s'"),
- objfile_namestr ? objfile_namestr : _("<any>"),
- provider ? provider : _("<any>"),
- name);
+ throw_error (
+ NOT_FOUND_ERROR,
+ _ ("No probe matching objfile=`%s', provider=`%s', name=`%s'"),
+ objfile_namestr ? objfile_namestr : _ ("<any>"),
+ provider ? provider : _ ("<any>"), name);
}
if (canonical)
@@ -268,8 +267,6 @@ find_probe_by_pc (CORE_ADDR pc)
return result;
}
-
-
/* Make a vector of probes matching OBJNAME, PROVIDER, and PROBE_NAME.
If SPOPS is not &any_static_probe_ops, only probes related to this
specific static probe ops will match. Each argument is a regexp,
@@ -284,17 +281,17 @@ collect_probes (const std::string &objname, const std::string &provider,
if (!provider.empty ())
prov_pat.emplace (provider.c_str (), REG_NOSUB,
- _("Invalid provider regexp"));
+ _ ("Invalid provider regexp"));
if (!probe_name.empty ())
probe_pat.emplace (probe_name.c_str (), REG_NOSUB,
- _("Invalid probe regexp"));
+ _ ("Invalid probe regexp"));
if (!objname.empty ())
obj_pat.emplace (objname.c_str (), REG_NOSUB,
- _("Invalid object file regexp"));
+ _ ("Invalid object file regexp"));
for (objfile *objfile : current_program_space->objfiles ())
{
- if (! objfile->sf || ! objfile->sf->sym_probe_fns)
+ if (!objfile->sf || !objfile->sf->sym_probe_fns)
continue;
if (obj_pat)
@@ -390,8 +387,8 @@ gen_ui_out_table_header_info (const std::vector<bound_probe> &probes,
}
}
- current_uiout->table_header (size_max, ui_left,
- column.field_name, column.print_name);
+ current_uiout->table_header (size_max, ui_left, column.field_name,
+ column.print_name);
}
}
@@ -401,11 +398,11 @@ gen_ui_out_table_header_info (const std::vector<bound_probe> &probes,
static void
print_ui_out_not_applicables (const static_probe_ops *spops)
{
- std::vector<struct info_probe_column> headings
- = spops->gen_info_probes_table_header ();
+ std::vector<struct info_probe_column> headings
+ = spops->gen_info_probes_table_header ();
for (const info_probe_column &column : headings)
- current_uiout->field_string (column.field_name, _("n/a"));
+ current_uiout->field_string (column.field_name, _ ("n/a"));
}
/* Helper function to print extra information about a probe and an objfile
@@ -419,8 +416,7 @@ print_ui_out_info (probe *probe)
gdb_assert (probe != NULL);
std::vector<struct info_probe_column> headings
= probe->get_static_ops ()->gen_info_probes_table_header ();
- std::vector<const char *> values
- = probe->gen_info_probes_table_values ();
+ std::vector<const char *> values = probe->gen_info_probes_table_values ();
gdb_assert (headings.size () == values.size ());
@@ -520,8 +516,7 @@ info_probes_for_spops (const char *arg, int from_tty,
ui_out_extra_fields = get_number_extra_fields (spops);
{
- ui_out_emit_table table_emitter (current_uiout,
- 5 + ui_out_extra_fields,
+ ui_out_emit_table table_emitter (current_uiout, 5 + ui_out_extra_fields,
probes.size (), "StaticProbes");
std::sort (probes.begin (), probes.end (), compare_probes);
@@ -537,17 +532,17 @@ info_probes_for_spops (const char *arg, int from_tty,
size_type = std::max (strlen (probe_type), size_type);
size_name = std::max (probe.prob->get_name ().size (), size_name);
- size_provider = std::max (probe.prob->get_provider ().size (),
- size_provider);
- size_objname = std::max (strlen (objfile_name (probe.objfile)),
- size_objname);
+ size_provider
+ = std::max (probe.prob->get_provider ().size (), size_provider);
+ size_objname
+ = std::max (strlen (objfile_name (probe.objfile)), size_objname);
}
- current_uiout->table_header (size_type, ui_left, "type", _("Type"));
+ current_uiout->table_header (size_type, ui_left, "type", _ ("Type"));
current_uiout->table_header (size_provider, ui_left, "provider",
- _("Provider"));
- current_uiout->table_header (size_name, ui_left, "name", _("Name"));
- current_uiout->table_header (size_addr, ui_left, "addr", _("Where"));
+ _ ("Provider"));
+ current_uiout->table_header (size_name, ui_left, "name", _ ("Name"));
+ current_uiout->table_header (size_addr, ui_left, "addr", _ ("Where"));
if (spops == &any_static_probe_ops)
{
@@ -561,7 +556,8 @@ info_probes_for_spops (const char *arg, int from_tty,
else
gen_ui_out_table_header_info (probes, spops);
- current_uiout->table_header (size_objname, ui_left, "object", _("Object"));
+ current_uiout->table_header (size_objname, ui_left, "object",
+ _ ("Object"));
current_uiout->table_body ();
for (const bound_probe &probe : probes)
@@ -573,9 +569,9 @@ info_probes_for_spops (const char *arg, int from_tty,
current_uiout->field_string ("type", probe_type);
current_uiout->field_string ("provider", probe.prob->get_provider ());
current_uiout->field_string ("name", probe.prob->get_name ());
- current_uiout->field_core_addr ("addr", probe.prob->get_gdbarch (),
- probe.prob->get_relocated_address
- (probe.objfile));
+ current_uiout->field_core_addr (
+ "addr", probe.prob->get_gdbarch (),
+ probe.prob->get_relocated_address (probe.objfile));
if (spops == &any_static_probe_ops)
{
@@ -590,8 +586,7 @@ info_probes_for_spops (const char *arg, int from_tty,
else
print_ui_out_info (probe.prob);
- current_uiout->field_string ("object",
- objfile_name (probe.objfile));
+ current_uiout->field_string ("object", objfile_name (probe.objfile));
current_uiout->text ("\n");
}
@@ -599,7 +594,7 @@ info_probes_for_spops (const char *arg, int from_tty,
}
if (!any_found)
- current_uiout->message (_("No probes matched.\n"));
+ current_uiout->message (_ ("No probes matched.\n"));
}
/* Implementation of the `info probes' command. */
@@ -623,23 +618,23 @@ enable_probes_command (const char *arg, int from_tty)
= collect_probes (objname, provider, probe_name, &any_static_probe_ops);
if (probes.empty ())
{
- current_uiout->message (_("No probes matched.\n"));
+ current_uiout->message (_ ("No probes matched.\n"));
return;
}
/* Enable the selected probes, provided their backends support the
notion of enabling a probe. */
- for (const bound_probe &probe: probes)
+ for (const bound_probe &probe : probes)
{
if (probe.prob->get_static_ops ()->can_enable ())
{
probe.prob->enable ();
- current_uiout->message (_("Probe %s:%s enabled.\n"),
+ current_uiout->message (_ ("Probe %s:%s enabled.\n"),
probe.prob->get_provider ().c_str (),
probe.prob->get_name ().c_str ());
}
else
- current_uiout->message (_("Probe %s:%s cannot be enabled.\n"),
+ current_uiout->message (_ ("Probe %s:%s cannot be enabled.\n"),
probe.prob->get_provider ().c_str (),
probe.prob->get_name ().c_str ());
}
@@ -658,7 +653,7 @@ disable_probes_command (const char *arg, int from_tty)
= collect_probes (objname, provider, probe_name, &any_static_probe_ops);
if (probes.empty ())
{
- current_uiout->message (_("No probes matched.\n"));
+ current_uiout->message (_ ("No probes matched.\n"));
return;
}
@@ -669,12 +664,12 @@ disable_probes_command (const char *arg, int from_tty)
if (probe.prob->get_static_ops ()->can_enable ())
{
probe.prob->disable ();
- current_uiout->message (_("Probe %s:%s disabled.\n"),
+ current_uiout->message (_ ("Probe %s:%s disabled.\n"),
probe.prob->get_provider ().c_str (),
probe.prob->get_name ().c_str ());
}
else
- current_uiout->message (_("Probe %s:%s cannot be disabled.\n"),
+ current_uiout->message (_ ("Probe %s:%s cannot be disabled.\n"),
probe.prob->get_provider ().c_str (),
probe.prob->get_name ().c_str ());
}
@@ -703,17 +698,13 @@ ignore_probe_p (const char *provider, const char *name,
gdb::optional<compiled_regex> &re_obj
= ignore_probes_obj_pat[ignore_probes_idx];
- bool res
- = ((!re_prov
- || re_prov->exec (provider, 0, NULL, 0) == 0)
- && (!re_name
- || re_name->exec (name, 0, NULL, 0) == 0)
- && (!re_obj
- || re_obj->exec (objfile_name, 0, NULL, 0) == 0));
+ bool res = ((!re_prov || re_prov->exec (provider, 0, NULL, 0) == 0)
+ && (!re_name || re_name->exec (name, 0, NULL, 0) == 0)
+ && (!re_obj || re_obj->exec (objfile_name, 0, NULL, 0) == 0));
if (res && ignore_probes_verbose_p)
- gdb_printf (gdb_stdlog, _("Ignoring %s probe %s %s in %s.\n"),
- type, provider, name, objfile_name);
+ gdb_printf (gdb_stdlog, _ ("Ignoring %s probe %s %s in %s.\n"), type,
+ provider, name, objfile_name);
return res;
}
@@ -734,10 +725,10 @@ ignore_probes_command (const char *arg, int from_tty)
if (strcmp (s.c_str (), "-reset") == 0)
{
if (*idx != '\0')
- error (_("-reset: no arguments allowed"));
+ error (_ ("-reset: no arguments allowed"));
ignore_probes_p = false;
- gdb_printf (gdb_stdout, _("ignore-probes filter has been reset\n"));
+ gdb_printf (gdb_stdout, _ ("ignore-probes filter has been reset\n"));
return;
}
@@ -766,21 +757,22 @@ ignore_probes_command (const char *arg, int from_tty)
re_obj.reset ();
if (!ignore_provider.empty ())
re_prov.emplace (ignore_provider.c_str (), REG_NOSUB,
- _("Invalid provider regexp"));
+ _ ("Invalid provider regexp"));
if (!ignore_probe_name.empty ())
re_name.emplace (ignore_probe_name.c_str (), REG_NOSUB,
- _("Invalid probe regexp"));
+ _ ("Invalid probe regexp"));
if (!ignore_objname.empty ())
re_obj.emplace (ignore_objname.c_str (), REG_NOSUB,
- _("Invalid object file regexp"));
+ _ ("Invalid object file regexp"));
ignore_probes_idx = new_ignore_probes_idx;
ignore_probes_p = true;
ignore_probes_verbose_p = verbose_p;
- gdb_printf (gdb_stdout, _("ignore-probes filter has been set to:\n"));
- gdb_printf (gdb_stdout, _("PROVIDER: '%s'\n"), ignore_provider.c_str ());
- gdb_printf (gdb_stdout, _("PROBE_NAME: '%s'\n"), ignore_probe_name.c_str ());
- gdb_printf (gdb_stdout, _("OBJNAME: '%s'\n"), ignore_objname.c_str ());
+ gdb_printf (gdb_stdout, _ ("ignore-probes filter has been set to:\n"));
+ gdb_printf (gdb_stdout, _ ("PROVIDER: '%s'\n"), ignore_provider.c_str ());
+ gdb_printf (gdb_stdout, _ ("PROBE_NAME: '%s'\n"),
+ ignore_probe_name.c_str ());
+ gdb_printf (gdb_stdout, _ ("OBJNAME: '%s'\n"), ignore_objname.c_str ());
}
/* See comments in probe.h. */
@@ -817,7 +809,8 @@ probe_linespec_to_static_ops (const char **linespecp)
/* See comment in probe.h. */
int
-probe_is_linespec_by_keyword (const char **linespecp, const char *const *keywords)
+probe_is_linespec_by_keyword (const char **linespecp,
+ const char *const *keywords)
{
const char *s = *linespecp;
const char *const *csp;
@@ -880,8 +873,7 @@ info_probes_cmdlist_get (void)
static struct cmd_list_element *info_probes_cmdlist;
if (info_probes_cmdlist == NULL)
- add_prefix_cmd ("probes", class_info, info_probes_command,
- _("\
+ add_prefix_cmd ("probes", class_info, info_probes_command, _ ("\
Show available static probes.\n\
Usage: info probes [all|TYPE [ARGS]]\n\
TYPE specifies the type of the probe, and can be one of the following:\n\
@@ -890,21 +882,18 @@ If you specify TYPE, there may be additional arguments needed by the\n\
subcommand.\n\
If you do not specify any argument, or specify `all', then the command\n\
will show information about all types of probes."),
- &info_probes_cmdlist, 0/*allow-unknown*/, &infolist);
+ &info_probes_cmdlist, 0 /*allow-unknown*/, &infolist);
return &info_probes_cmdlist;
}
-
-
/* This is called to compute the value of one of the $_probe_arg*
convenience variables. */
static struct value *
-compute_probe_arg (struct gdbarch *arch, struct internalvar *ivar,
- void *data)
+compute_probe_arg (struct gdbarch *arch, struct internalvar *ivar, void *data)
{
- frame_info_ptr frame = get_selected_frame (_("No frame selected"));
+ frame_info_ptr frame = get_selected_frame (_ ("No frame selected"));
CORE_ADDR pc = get_frame_pc (frame);
int sel = (int) (uintptr_t) data;
struct bound_probe pc_probe;
@@ -915,14 +904,14 @@ compute_probe_arg (struct gdbarch *arch, struct internalvar *ivar,
pc_probe = find_probe_by_pc (pc);
if (pc_probe.prob == NULL)
- error (_("No probe at PC %s"), core_addr_to_string (pc));
+ error (_ ("No probe at PC %s"), core_addr_to_string (pc));
n_args = pc_probe.prob->get_argument_count (arch);
if (sel == -1)
return value_from_longest (builtin_type (arch)->builtin_int, n_args);
if (sel >= n_args)
- error (_("Invalid probe argument %d -- probe has %u arguments available"),
+ error (_ ("Invalid probe argument %d -- probe has %u arguments available"),
sel, n_args);
return pc_probe.prob->evaluate_argument (sel, frame);
@@ -945,7 +934,7 @@ compile_probe_arg (struct internalvar *ivar, struct agent_expr *expr,
pc_probe = find_probe_by_pc (pc);
if (pc_probe.prob == NULL)
- error (_("No probe at PC %s"), core_addr_to_string (pc));
+ error (_ ("No probe at PC %s"), core_addr_to_string (pc));
n_args = pc_probe.prob->get_argument_count (expr->gdbarch);
@@ -959,22 +948,21 @@ compile_probe_arg (struct internalvar *ivar, struct agent_expr *expr,
gdb_assert (sel >= 0);
if (sel >= n_args)
- error (_("Invalid probe argument %d -- probe has %d arguments available"),
+ error (_ ("Invalid probe argument %d -- probe has %d arguments available"),
sel, n_args);
pc_probe.prob->compile_to_ax (expr, value, sel);
}
-static const struct internalvar_funcs probe_funcs =
-{
+static const struct internalvar_funcs probe_funcs = {
compute_probe_arg,
compile_probe_arg,
};
-
std::vector<const static_probe_ops *> all_static_probe_ops;
void _initialize_probe ();
+
void
_initialize_probe ()
{
@@ -1007,12 +995,11 @@ _initialize_probe ()
create_internalvar_type_lazy ("_probe_arg11", &probe_funcs,
(void *) (uintptr_t) 11);
- add_cmd ("all", class_info, info_probes_command,
- _("\
+ add_cmd ("all", class_info, info_probes_command, _ ("\
Show information about all type of probes."),
info_probes_cmdlist_get ());
- add_cmd ("probes", class_breakpoint, enable_probes_command, _("\
+ add_cmd ("probes", class_breakpoint, enable_probes_command, _ ("\
Enable probes.\n\
Usage: enable probes [PROVIDER [NAME [OBJECT]]]\n\
Each argument is a regular expression, used to select probes.\n\
@@ -1023,7 +1010,7 @@ If you do not specify any argument then the command will enable\n\
all defined probes."),
&enablelist);
- add_cmd ("probes", class_breakpoint, disable_probes_command, _("\
+ add_cmd ("probes", class_breakpoint, disable_probes_command, _ ("\
Disable probes.\n\
Usage: disable probes [PROVIDER [NAME [OBJECT]]]\n\
Each argument is a regular expression, used to select probes.\n\
@@ -1034,7 +1021,7 @@ If you do not specify any argument then the command will disable\n\
all defined probes."),
&disablelist);
- add_cmd ("ignore-probes", class_maintenance, ignore_probes_command, _("\
+ add_cmd ("ignore-probes", class_maintenance, ignore_probes_command, _ ("\
Ignore probes.\n\
Usage: maintenance ignore-probes [-v|-verbose] [PROVIDER [NAME [OBJECT]]]\n\
maintenance ignore-probes -reset\n\
diff --git a/gdb/probe.h b/gdb/probe.h
index d7956c2a281..2ceeee69aa8 100644
--- a/gdb/probe.h
+++ b/gdb/probe.h
@@ -17,7 +17,7 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
-#if !defined (PROBE_H)
+#if !defined(PROBE_H)
#define PROBE_H 1
#include "symtab.h"
@@ -29,15 +29,15 @@ struct linespec_result;
`gen_ui_out_table_header'. */
struct info_probe_column
- {
- /* The internal name of the field. This string cannot be capitalized nor
+{
+ /* The internal name of the field. This string cannot be capitalized nor
localized, e.g., "extra_field". */
- const char *field_name;
+ const char *field_name;
- /* The field name to be printed in the `info probes' command. This
+ /* The field name to be printed in the `info probes' command. This
string can be capitalized and localized, e.g., _("Extra Field"). */
- const char *print_name;
- };
+ const char *print_name;
+};
/* Operations that act on probes, but are specific to each backend.
These methods do not go into the 'class probe' because they do not
@@ -54,6 +54,7 @@ struct info_probe_column
class static_probe_ops
{
public:
+
/* Method responsible for verifying if LINESPECP is a valid linespec
for a probe breakpoint. It should return true if it is, or false
if it is not. It also should update LINESPECP in order to
@@ -65,7 +66,8 @@ public:
/* Function that should fill PROBES with known probes from OBJFILE. */
virtual void get_probes (std::vector<std::unique_ptr<probe>> *probes,
- struct objfile *objfile) const = 0;
+ struct objfile *objfile) const
+ = 0;
/* Return a pointer to a name identifying the probe type. This is
the string that will be displayed in the "Type" column of the
@@ -73,10 +75,7 @@ public:
virtual const char *type_name () const = 0;
/* Return true if the probe can be enabled; false otherwise. */
- virtual bool can_enable () const
- {
- return false;
- }
+ virtual bool can_enable () const { return false; }
/* Function responsible for providing the extra fields that will be
printed in the `info probes' command. It should fill HEADS
@@ -84,7 +83,7 @@ public:
required by the probe backend, the method EMIT_INFO_PROBES_FIELDS
should return false. */
virtual std::vector<struct info_probe_column>
- gen_info_probes_table_header () const = 0;
+ gen_info_probes_table_header () const = 0;
};
/* Definition of a vector of static_probe_ops. */
@@ -106,7 +105,7 @@ extern int probe_is_linespec_by_keyword (const char **linespecp,
any known probe type, *LINESPECP is not modified in such case. */
extern const static_probe_ops *
- probe_linespec_to_static_ops (const char **linespecp);
+probe_linespec_to_static_ops (const char **linespecp);
/* The probe itself. The class contains generic information about the
probe. */
@@ -114,16 +113,19 @@ extern const static_probe_ops *
class probe
{
public:
+
/* Default constructor for a probe. */
probe (std::string &&name_, std::string &&provider_, CORE_ADDR address_,
struct gdbarch *arch_)
- : m_name (std::move (name_)), m_provider (std::move (provider_)),
- m_address (address_), m_arch (arch_)
- {}
+ : m_name (std::move (name_)),
+ m_provider (std::move (provider_)),
+ m_address (address_),
+ m_arch (arch_)
+ {
+ }
/* Virtual destructor. */
- virtual ~probe ()
- {}
+ virtual ~probe () {}
/* Compute the probe's relocated address. OBJFILE is the objfile
in which the probe originated. */
@@ -142,28 +144,29 @@ public:
/* Evaluate the Nth argument from the probe, returning a value
corresponding to it. The argument number is represented N.
This function can throw an exception. */
- virtual struct value *evaluate_argument (unsigned n,
- frame_info_ptr frame) = 0;
+ virtual struct value *evaluate_argument (unsigned n, frame_info_ptr frame)
+ = 0;
/* Compile the Nth argument of the probe to an agent expression.
The argument number is represented by N. */
virtual void compile_to_ax (struct agent_expr *aexpr,
- struct axs_value *axs_value,
- unsigned n) = 0;
+ struct axs_value *axs_value, unsigned n)
+ = 0;
/* Set the semaphore associated with the probe. This function only
makes sense if the probe has a concept of semaphore associated to
a probe. */
- virtual void set_semaphore (struct objfile *objfile,
- struct gdbarch *gdbarch)
- {}
+ virtual void set_semaphore (struct objfile *objfile, struct gdbarch *gdbarch)
+ {
+ }
/* Clear the semaphore associated with the probe. This function
only makes sense if the probe has a concept of semaphore
associated to a probe. */
virtual void clear_semaphore (struct objfile *objfile,
struct gdbarch *gdbarch)
- {}
+ {
+ }
/* Return the pointer to the static_probe_ops instance related to
the probe type. */
@@ -186,40 +189,27 @@ public:
/* Enable the probe. The semantics of "enabling" a probe depend on
the specific backend. This function can throw an exception. */
- virtual void enable ()
- {}
+ virtual void enable () {}
/* Disable the probe. The semantics of "disabling" a probe depend
on the specific backend. This function can throw an
exception. */
- virtual void disable ()
- {}
+ virtual void disable () {}
/* Getter for M_NAME. */
- const std::string &get_name () const
- {
- return m_name;
- }
+ const std::string &get_name () const { return m_name; }
/* Getter for M_PROVIDER. */
- const std::string &get_provider () const
- {
- return m_provider;
- }
+ const std::string &get_provider () const { return m_provider; }
/* Getter for M_ADDRESS. */
- CORE_ADDR get_address () const
- {
- return m_address;
- }
+ CORE_ADDR get_address () const { return m_address; }
/* Getter for M_ARCH. */
- struct gdbarch *get_gdbarch () const
- {
- return m_arch;
- }
+ struct gdbarch *get_gdbarch () const { return m_arch; }
private:
+
/* The name of the probe. */
std::string m_name;
@@ -243,13 +233,14 @@ private:
struct bound_probe
{
/* Create an empty bound_probe object. */
- bound_probe ()
- {}
+ bound_probe () {}
/* Create and initialize a bound_probe object using PROBE and OBJFILE. */
bound_probe (probe *probe_, struct objfile *objfile_)
- : prob (probe_), objfile (objfile_)
- {}
+ : prob (probe_),
+ objfile (objfile_)
+ {
+ }
/* The probe. */
probe *prob = NULL;
@@ -262,10 +253,9 @@ struct bound_probe
returns a std::vector<symtab_and_line> object and updates LOC or
throws an error. */
-extern std::vector<symtab_and_line> parse_probes
- (const location_spec *locspec,
- struct program_space *pspace,
- struct linespec_result *canon);
+extern std::vector<symtab_and_line>
+parse_probes (const location_spec *locspec, struct program_space *pspace,
+ struct linespec_result *canon);
/* Given a PC, find an associated probe. If a probe is found, return
it. If no probe is found, return a bound probe whose fields are
diff --git a/gdb/proc-api.c b/gdb/proc-api.c
index addda6dd647..9a0e031a797 100644
--- a/gdb/proc-api.c
+++ b/gdb/proc-api.c
@@ -30,9 +30,9 @@
#include <sys/types.h>
#include <sys/procfs.h>
-#include <sys/proc.h> /* for struct proc */
-#include <sys/user.h> /* for struct user */
-#include <fcntl.h> /* for O_RDWR etc. */
+#include <sys/proc.h> /* for struct proc */
+#include <sys/user.h> /* for struct user */
+#include <fcntl.h> /* for O_RDWR etc. */
#include "gdbsupport/gdb_wait.h"
#include "proc-utils.h"
@@ -42,37 +42,39 @@
following form. These tables can be used to map numeric values to
their symbolic names and to a string that describes their specific use. */
-struct trans {
- long value; /* The numeric value */
- const char *name; /* The equivalent symbolic value */
- const char *desc; /* Short description of value */
+struct trans
+{
+ long value; /* The numeric value */
+ const char *name; /* The equivalent symbolic value */
+ const char *desc; /* Short description of value */
};
-static bool procfs_trace = false;
-static FILE *procfs_file = NULL;
+static bool procfs_trace = false;
+static FILE *procfs_file = NULL;
static std::string procfs_filename = "procfs_trace";
static void
prepare_to_trace (void)
{
- if (procfs_trace) /* if procfs tracing turned on */
- if (procfs_file == NULL) /* if output file not yet open */
- procfs_file = fopen (procfs_filename.c_str (), "a"); /* open output file */
+ if (procfs_trace) /* if procfs tracing turned on */
+ if (procfs_file == NULL) /* if output file not yet open */
+ procfs_file
+ = fopen (procfs_filename.c_str (), "a"); /* open output file */
}
static void
-set_procfs_trace_cmd (const char *args,
- int from_tty, struct cmd_list_element *c)
+set_procfs_trace_cmd (const char *args, int from_tty,
+ struct cmd_list_element *c)
{
-#if 0 /* not sure what I might actually need to do here, if anything */
+#if 0 /* not sure what I might actually need to do here, if anything */
if (procfs_file)
fflush (procfs_file);
#endif
}
static void
-set_procfs_file_cmd (const char *args,
- int from_tty, struct cmd_list_element *c)
+set_procfs_file_cmd (const char *args, int from_tty,
+ struct cmd_list_element *c)
{
/* Just changed the filename for procfs tracing.
If a file was already open, close it. */
@@ -81,37 +83,36 @@ set_procfs_file_cmd (const char *args,
procfs_file = NULL;
}
-static struct trans rw_table[] = {
- { PCAGENT, "PCAGENT", "create agent lwp with regs from argument" },
- { PCCFAULT, "PCCFAULT", "clear current fault" },
- { PCCSIG, "PCCSIG", "clear current signal" },
- { PCDSTOP, "PCDSTOP", "post stop request" },
- { PCKILL, "PCKILL", "post a signal" },
- { PCNICE, "PCNICE", "set nice priority" },
- { PCREAD, "PCREAD", "read from the address space" },
- { PCWRITE, "PCWRITE", "write to the address space" },
- { PCRUN, "PCRUN", "make process/lwp runnable" },
- { PCSASRS, "PCSASRS", "set ancillary state registers" },
- { PCSCRED, "PCSCRED", "set process credentials" },
- { PCSENTRY, "PCSENTRY", "set traced syscall entry set" },
- { PCSET, "PCSET", "set modes" },
- { PCSEXIT, "PCSEXIT", "set traced syscall exit set" },
- { PCSFAULT, "PCSFAULT", "set traced fault set" },
- { PCSFPREG, "PCSFPREG", "set floating point registers" },
- { PCSHOLD, "PCSHOLD", "set signal mask" },
- { PCSREG, "PCSREG", "set general registers" },
- { PCSSIG, "PCSSIG", "set current signal" },
- { PCSTOP, "PCSTOP", "post stop request and wait" },
- { PCSTRACE, "PCSTRACE", "set traced signal set" },
- { PCSVADDR, "PCSVADDR", "set pc virtual address" },
- { PCSXREG, "PCSXREG", "set extra registers" },
- { PCTWSTOP, "PCTWSTOP", "wait for stop, with timeout arg" },
- { PCUNKILL, "PCUNKILL", "delete a pending signal" },
- { PCUNSET, "PCUNSET", "unset modes" },
- { PCWATCH, "PCWATCH", "set/unset watched memory area" },
- { PCWSTOP, "PCWSTOP", "wait for process/lwp to stop, no timeout" },
- { 0, NULL, NULL }
-};
+static struct trans rw_table[]
+ = { { PCAGENT, "PCAGENT", "create agent lwp with regs from argument" },
+ { PCCFAULT, "PCCFAULT", "clear current fault" },
+ { PCCSIG, "PCCSIG", "clear current signal" },
+ { PCDSTOP, "PCDSTOP", "post stop request" },
+ { PCKILL, "PCKILL", "post a signal" },
+ { PCNICE, "PCNICE", "set nice priority" },
+ { PCREAD, "PCREAD", "read from the address space" },
+ { PCWRITE, "PCWRITE", "write to the address space" },
+ { PCRUN, "PCRUN", "make process/lwp runnable" },
+ { PCSASRS, "PCSASRS", "set ancillary state registers" },
+ { PCSCRED, "PCSCRED", "set process credentials" },
+ { PCSENTRY, "PCSENTRY", "set traced syscall entry set" },
+ { PCSET, "PCSET", "set modes" },
+ { PCSEXIT, "PCSEXIT", "set traced syscall exit set" },
+ { PCSFAULT, "PCSFAULT", "set traced fault set" },
+ { PCSFPREG, "PCSFPREG", "set floating point registers" },
+ { PCSHOLD, "PCSHOLD", "set signal mask" },
+ { PCSREG, "PCSREG", "set general registers" },
+ { PCSSIG, "PCSSIG", "set current signal" },
+ { PCSTOP, "PCSTOP", "post stop request and wait" },
+ { PCSTRACE, "PCSTRACE", "set traced signal set" },
+ { PCSVADDR, "PCSVADDR", "set pc virtual address" },
+ { PCSXREG, "PCSXREG", "set extra registers" },
+ { PCTWSTOP, "PCTWSTOP", "wait for stop, with timeout arg" },
+ { PCUNKILL, "PCUNKILL", "delete a pending signal" },
+ { PCUNSET, "PCUNSET", "unset modes" },
+ { PCWATCH, "PCWATCH", "set/unset watched memory area" },
+ { PCWSTOP, "PCWSTOP", "wait for process/lwp to stop, no timeout" },
+ { 0, NULL, NULL } };
static off_t lseek_offset;
@@ -131,110 +132,100 @@ write_with_trace (int fd, void *varg, size_t len, char *file, int line)
break;
if (info_verbose)
- fprintf (procfs_file ? procfs_file : stdout,
- "%s:%d -- ", file, line);
- switch (opcode) {
- case PCSET:
- fprintf (procfs_file ? procfs_file : stdout,
- "write (PCSET, %s) %s\n",
- arg[1] == PR_FORK ? "PR_FORK" :
- arg[1] == PR_RLC ? "PR_RLC" :
- arg[1] == PR_ASYNC ? "PR_ASYNC" :
- "<unknown flag>",
- info_verbose ? rw_table[i].desc : "");
- break;
- case PCUNSET:
- fprintf (procfs_file ? procfs_file : stdout,
- "write (PCRESET, %s) %s\n",
- arg[1] == PR_FORK ? "PR_FORK" :
- arg[1] == PR_RLC ? "PR_RLC" :
- arg[1] == PR_ASYNC ? "PR_ASYNC" :
- "<unknown flag>",
- info_verbose ? rw_table[i].desc : "");
- break;
- case PCSTRACE:
- fprintf (procfs_file ? procfs_file : stdout,
- "write (PCSTRACE) ");
- proc_prettyfprint_signalset (procfs_file ? procfs_file : stdout,
- (sigset_t *) &arg[1], 0);
- break;
- case PCSFAULT:
- fprintf (procfs_file ? procfs_file : stdout,
- "write (PCSFAULT) ");
- proc_prettyfprint_faultset (procfs_file ? procfs_file : stdout,
- (fltset_t *) &arg[1], 0);
- break;
- case PCSENTRY:
- fprintf (procfs_file ? procfs_file : stdout,
- "write (PCSENTRY) ");
- proc_prettyfprint_syscalls (procfs_file ? procfs_file : stdout,
- (sysset_t *) &arg[1], 0);
- break;
- case PCSEXIT:
- fprintf (procfs_file ? procfs_file : stdout,
- "write (PCSEXIT) ");
- proc_prettyfprint_syscalls (procfs_file ? procfs_file : stdout,
- (sysset_t *) &arg[1], 0);
- break;
- case PCSHOLD:
- fprintf (procfs_file ? procfs_file : stdout,
- "write (PCSHOLD) ");
- proc_prettyfprint_signalset (procfs_file ? procfs_file : stdout,
- (sigset_t *) &arg[1], 0);
- break;
- case PCSSIG:
- fprintf (procfs_file ? procfs_file : stdout,
- "write (PCSSIG) ");
- proc_prettyfprint_signal (procfs_file ? procfs_file : stdout,
- arg[1] ? ((siginfo_t *) &arg[1])->si_signo
- : 0,
- 0);
- fprintf (procfs_file ? procfs_file : stdout, "\n");
- break;
- case PCRUN:
- fprintf (procfs_file ? procfs_file : stdout,
- "write (PCRUN) ");
- if (arg[1] & PRCSIG)
- fprintf (procfs_file ? procfs_file : stdout, "clearSig ");
- if (arg[1] & PRCFAULT)
- fprintf (procfs_file ? procfs_file : stdout, "clearFlt ");
- if (arg[1] & PRSTEP)
- fprintf (procfs_file ? procfs_file : stdout, "step ");
- if (arg[1] & PRSABORT)
- fprintf (procfs_file ? procfs_file : stdout, "syscallAbort ");
- if (arg[1] & PRSTOP)
- fprintf (procfs_file ? procfs_file : stdout, "stopReq ");
-
- fprintf (procfs_file ? procfs_file : stdout, "\n");
- break;
- case PCKILL:
- fprintf (procfs_file ? procfs_file : stdout,
- "write (PCKILL) ");
- proc_prettyfprint_signal (procfs_file ? procfs_file : stdout,
- arg[1], 0);
- fprintf (procfs_file ? procfs_file : stdout, "\n");
- break;
- default:
+ fprintf (procfs_file ? procfs_file : stdout, "%s:%d -- ", file, line);
+ switch (opcode)
{
- if (rw_table[i].name)
- fprintf (procfs_file ? procfs_file : stdout,
- "write (%s) %s\n",
- rw_table[i].name,
- info_verbose ? rw_table[i].desc : "");
- else
- {
- if (lseek_offset != -1)
- fprintf (procfs_file ? procfs_file : stdout,
- "write (<unknown>, %lud bytes at 0x%08lx) \n",
- (unsigned long) len, (unsigned long) lseek_offset);
- else
- fprintf (procfs_file ? procfs_file : stdout,
- "write (<unknown>, %lud bytes) \n",
- (unsigned long) len);
- }
+ case PCSET:
+ fprintf (procfs_file ? procfs_file : stdout,
+ "write (PCSET, %s) %s\n",
+ arg[1] == PR_FORK ? "PR_FORK"
+ : arg[1] == PR_RLC ? "PR_RLC"
+ : arg[1] == PR_ASYNC ? "PR_ASYNC"
+ : "<unknown flag>",
+ info_verbose ? rw_table[i].desc : "");
+ break;
+ case PCUNSET:
+ fprintf (procfs_file ? procfs_file : stdout,
+ "write (PCRESET, %s) %s\n",
+ arg[1] == PR_FORK ? "PR_FORK"
+ : arg[1] == PR_RLC ? "PR_RLC"
+ : arg[1] == PR_ASYNC ? "PR_ASYNC"
+ : "<unknown flag>",
+ info_verbose ? rw_table[i].desc : "");
+ break;
+ case PCSTRACE:
+ fprintf (procfs_file ? procfs_file : stdout, "write (PCSTRACE) ");
+ proc_prettyfprint_signalset (procfs_file ? procfs_file : stdout,
+ (sigset_t *) &arg[1], 0);
+ break;
+ case PCSFAULT:
+ fprintf (procfs_file ? procfs_file : stdout, "write (PCSFAULT) ");
+ proc_prettyfprint_faultset (procfs_file ? procfs_file : stdout,
+ (fltset_t *) &arg[1], 0);
+ break;
+ case PCSENTRY:
+ fprintf (procfs_file ? procfs_file : stdout, "write (PCSENTRY) ");
+ proc_prettyfprint_syscalls (procfs_file ? procfs_file : stdout,
+ (sysset_t *) &arg[1], 0);
+ break;
+ case PCSEXIT:
+ fprintf (procfs_file ? procfs_file : stdout, "write (PCSEXIT) ");
+ proc_prettyfprint_syscalls (procfs_file ? procfs_file : stdout,
+ (sysset_t *) &arg[1], 0);
+ break;
+ case PCSHOLD:
+ fprintf (procfs_file ? procfs_file : stdout, "write (PCSHOLD) ");
+ proc_prettyfprint_signalset (procfs_file ? procfs_file : stdout,
+ (sigset_t *) &arg[1], 0);
break;
+ case PCSSIG:
+ fprintf (procfs_file ? procfs_file : stdout, "write (PCSSIG) ");
+ proc_prettyfprint_signal (procfs_file ? procfs_file : stdout,
+ arg[1] ? ((siginfo_t *) &arg[1])->si_signo
+ : 0,
+ 0);
+ fprintf (procfs_file ? procfs_file : stdout, "\n");
+ break;
+ case PCRUN:
+ fprintf (procfs_file ? procfs_file : stdout, "write (PCRUN) ");
+ if (arg[1] & PRCSIG)
+ fprintf (procfs_file ? procfs_file : stdout, "clearSig ");
+ if (arg[1] & PRCFAULT)
+ fprintf (procfs_file ? procfs_file : stdout, "clearFlt ");
+ if (arg[1] & PRSTEP)
+ fprintf (procfs_file ? procfs_file : stdout, "step ");
+ if (arg[1] & PRSABORT)
+ fprintf (procfs_file ? procfs_file : stdout, "syscallAbort ");
+ if (arg[1] & PRSTOP)
+ fprintf (procfs_file ? procfs_file : stdout, "stopReq ");
+
+ fprintf (procfs_file ? procfs_file : stdout, "\n");
+ break;
+ case PCKILL:
+ fprintf (procfs_file ? procfs_file : stdout, "write (PCKILL) ");
+ proc_prettyfprint_signal (procfs_file ? procfs_file : stdout, arg[1],
+ 0);
+ fprintf (procfs_file ? procfs_file : stdout, "\n");
+ break;
+ default:
+ {
+ if (rw_table[i].name)
+ fprintf (procfs_file ? procfs_file : stdout, "write (%s) %s\n",
+ rw_table[i].name, info_verbose ? rw_table[i].desc : "");
+ else
+ {
+ if (lseek_offset != -1)
+ fprintf (procfs_file ? procfs_file : stdout,
+ "write (<unknown>, %lud bytes at 0x%08lx) \n",
+ (unsigned long) len, (unsigned long) lseek_offset);
+ else
+ fprintf (procfs_file ? procfs_file : stdout,
+ "write (<unknown>, %lud bytes) \n",
+ (unsigned long) len);
+ }
+ break;
+ }
}
- }
if (procfs_file)
fflush (procfs_file);
}
@@ -242,10 +233,9 @@ write_with_trace (int fd, void *varg, size_t len, char *file, int line)
ret = write (fd, (void *) arg, len);
if (procfs_trace && ret != len)
{
- fprintf (procfs_file ? procfs_file : stdout,
+ fprintf (procfs_file ? procfs_file : stdout,
"[write (%s) FAILED! (%s)]\n",
- rw_table[i].name != NULL ?
- rw_table[i].name : "<unknown>",
+ rw_table[i].name != NULL ? rw_table[i].name : "<unknown>",
safe_strerror (errno));
if (procfs_file)
fflush (procfs_file);
@@ -266,9 +256,9 @@ lseek_with_trace (int fd, off_t offset, int whence, char *file, int line)
lseek_offset = ret;
if (procfs_trace && (ret == -1 || errno != 0))
{
- fprintf (procfs_file ? procfs_file : stdout,
- "[lseek (0x%08lx) FAILED! (%s)]\n",
- (unsigned long) offset, safe_strerror (errno));
+ fprintf (procfs_file ? procfs_file : stdout,
+ "[lseek (0x%08lx) FAILED! (%s)]\n", (unsigned long) offset,
+ safe_strerror (errno));
if (procfs_file)
fflush (procfs_file);
}
@@ -287,19 +277,18 @@ open_with_trace (char *filename, int mode, char *file, int line)
if (procfs_trace)
{
if (info_verbose)
- fprintf (procfs_file ? procfs_file : stdout,
- "%s:%d -- ", file, line);
+ fprintf (procfs_file ? procfs_file : stdout, "%s:%d -- ", file, line);
if (errno)
{
- fprintf (procfs_file ? procfs_file : stdout,
- "[open FAILED! (%s) line %d]\\n",
- safe_strerror (errno), line);
+ fprintf (procfs_file ? procfs_file : stdout,
+ "[open FAILED! (%s) line %d]\\n", safe_strerror (errno),
+ line);
}
else
{
- fprintf (procfs_file ? procfs_file : stdout,
- "%d = open (%s, ", ret, filename);
+ fprintf (procfs_file ? procfs_file : stdout, "%d = open (%s, ", ret,
+ filename);
if (mode == O_RDONLY)
fprintf (procfs_file ? procfs_file : stdout, "O_RDONLY) %d\n",
line);
@@ -328,14 +317,13 @@ close_with_trace (int fd, char *file, int line)
if (procfs_trace)
{
if (info_verbose)
- fprintf (procfs_file ? procfs_file : stdout,
- "%s:%d -- ", file, line);
+ fprintf (procfs_file ? procfs_file : stdout, "%s:%d -- ", file, line);
if (errno)
- fprintf (procfs_file ? procfs_file : stdout,
- "[close FAILED! (%s)]\n", safe_strerror (errno));
+ fprintf (procfs_file ? procfs_file : stdout, "[close FAILED! (%s)]\n",
+ safe_strerror (errno));
else
- fprintf (procfs_file ? procfs_file : stdout,
- "%d = close (%d)\n", ret, fd);
+ fprintf (procfs_file ? procfs_file : stdout, "%d = close (%d)\n", ret,
+ fd);
if (procfs_file)
fflush (procfs_file);
}
@@ -352,10 +340,8 @@ wait_with_trace (int *wstat, char *file, int line)
if (procfs_trace)
{
if (info_verbose)
- fprintf (procfs_file ? procfs_file : stdout,
- "%s:%d -- ", file, line);
- fprintf (procfs_file ? procfs_file : stdout,
- "wait (line %d) ", line);
+ fprintf (procfs_file ? procfs_file : stdout, "%s:%d -- ", file, line);
+ fprintf (procfs_file ? procfs_file : stdout, "wait (line %d) ", line);
if (procfs_file)
fflush (procfs_file);
}
@@ -364,10 +350,10 @@ wait_with_trace (int *wstat, char *file, int line)
if (procfs_trace)
{
if (errno)
- fprintf (procfs_file ? procfs_file : stdout,
- "[wait FAILED! (%s)]\n", safe_strerror (errno));
+ fprintf (procfs_file ? procfs_file : stdout, "[wait FAILED! (%s)]\n",
+ safe_strerror (errno));
else
- fprintf (procfs_file ? procfs_file : stdout,
+ fprintf (procfs_file ? procfs_file : stdout,
"returned pid %d, status 0x%x\n", ret, lstat);
if (procfs_file)
fflush (procfs_file);
@@ -385,8 +371,7 @@ procfs_note (const char *msg, const char *file, int line)
if (procfs_trace)
{
if (info_verbose)
- fprintf (procfs_file ? procfs_file : stdout,
- "%s:%d -- ", file, line);
+ fprintf (procfs_file ? procfs_file : stdout, "%s:%d -- ", file, line);
fprintf (procfs_file ? procfs_file : stdout, "%s", msg);
if (procfs_file)
fflush (procfs_file);
@@ -400,35 +385,34 @@ proc_prettyfprint_status (long flags, int why, int what, int thread)
if (procfs_trace)
{
if (thread)
- fprintf (procfs_file ? procfs_file : stdout,
- "Thread %d: ", thread);
+ fprintf (procfs_file ? procfs_file : stdout, "Thread %d: ", thread);
- proc_prettyfprint_flags (procfs_file ? procfs_file : stdout,
- flags, 0);
+ proc_prettyfprint_flags (procfs_file ? procfs_file : stdout, flags, 0);
if (flags & (PR_STOPPED | PR_ISTOP))
- proc_prettyfprint_why (procfs_file ? procfs_file : stdout,
- why, what, 0);
+ proc_prettyfprint_why (procfs_file ? procfs_file : stdout, why, what,
+ 0);
if (procfs_file)
fflush (procfs_file);
}
}
void _initialize_proc_api ();
+
void
_initialize_proc_api ()
{
- add_setshow_boolean_cmd ("procfs-trace", no_class, &procfs_trace, _("\
-Set tracing for /proc api calls."), _("\
-Show tracing for /proc api calls."), NULL,
- set_procfs_trace_cmd,
- NULL, /* FIXME: i18n: */
+ add_setshow_boolean_cmd ("procfs-trace", no_class, &procfs_trace, _ ("\
+Set tracing for /proc api calls."),
+ _ ("\
+Show tracing for /proc api calls."),
+ NULL, set_procfs_trace_cmd, NULL, /* FIXME: i18n: */
&setlist, &showlist);
- add_setshow_filename_cmd ("procfs-file", no_class, &procfs_filename, _("\
-Set filename for /proc tracefile."), _("\
-Show filename for /proc tracefile."), NULL,
- set_procfs_file_cmd,
- NULL, /* FIXME: i18n: */
+ add_setshow_filename_cmd ("procfs-file", no_class, &procfs_filename, _ ("\
+Set filename for /proc tracefile."),
+ _ ("\
+Show filename for /proc tracefile."),
+ NULL, set_procfs_file_cmd, NULL, /* FIXME: i18n: */
&setlist, &showlist);
}
diff --git a/gdb/proc-events.c b/gdb/proc-events.c
index 99b2f4f0f8b..dadb9238dc6 100644
--- a/gdb/proc-events.c
+++ b/gdb/proc-events.c
@@ -45,17 +45,16 @@
struct trans
{
- int value; /* The numeric value. */
- const char *name; /* The equivalent symbolic value. */
- const char *desc; /* Short description of value. */
+ int value; /* The numeric value. */
+ const char *name; /* The equivalent symbolic value. */
+ const char *desc; /* Short description of value. */
};
-
/* Pretty print syscalls. */
/* Syscall translation table. */
-#define MAX_SYSCALLS 262 /* Pretty arbitrary. */
+#define MAX_SYSCALLS 262 /* Pretty arbitrary. */
static const char *syscall_table[MAX_SYSCALLS];
static void
@@ -557,23 +556,22 @@ proc_prettyprint_syscalls (sysset_t *sysset, int verbose)
{
proc_prettyfprint_syscalls (stdout, sysset, verbose);
}
-
+
/* Prettyprint signals. */
/* Signal translation table, ordered ANSI-standard signals first,
other signals second, with signals in each block ordered by their
numerical values on a typical POSIX platform. */
-static struct trans signal_table[] =
-{
- { 0, "<no signal>", "no signal" },
+static struct trans signal_table[] = {
+ { 0, "<no signal>", "no signal" },
/* SIGINT, SIGILL, SIGABRT, SIGFPE, SIGSEGV and SIGTERM
are ANSI-standard signals and are always available. */
{ SIGINT, "SIGINT", "Interrupt (rubout)" },
- { SIGILL, "SIGILL", "Illegal instruction" }, /* not reset when caught */
- { SIGABRT, "SIGABRT", "used by abort()" }, /* replaces SIGIOT */
+ { SIGILL, "SIGILL", "Illegal instruction" }, /* not reset when caught */
+ { SIGABRT, "SIGABRT", "used by abort()" }, /* replaces SIGIOT */
{ SIGFPE, "SIGFPE", "Floating point exception" },
{ SIGSEGV, "SIGSEGV", "Segmentation violation" },
{ SIGTERM, "SIGTERM", "Software termination signal from kill" },
@@ -582,24 +580,24 @@ static struct trans signal_table[] =
{ SIGHUP, "SIGHUP", "Hangup" },
{ SIGQUIT, "SIGQUIT", "Quit (ASCII FS)" },
- { SIGTRAP, "SIGTRAP", "Trace trap" }, /* not reset when caught */
+ { SIGTRAP, "SIGTRAP", "Trace trap" }, /* not reset when caught */
{ SIGIOT, "SIGIOT", "IOT instruction" },
{ SIGEMT, "SIGEMT", "EMT instruction" },
- { SIGKILL, "SIGKILL", "Kill" }, /* Solaris: cannot be caught/ignored */
+ { SIGKILL, "SIGKILL", "Kill" }, /* Solaris: cannot be caught/ignored */
{ SIGBUS, "SIGBUS", "Bus error" },
{ SIGSYS, "SIGSYS", "Bad argument to system call" },
{ SIGPIPE, "SIGPIPE", "Write to pipe with no one to read it" },
{ SIGALRM, "SIGALRM", "Alarm clock" },
{ SIGUSR1, "SIGUSR1", "User defined signal 1" },
{ SIGUSR2, "SIGUSR2", "User defined signal 2" },
- { SIGCHLD, "SIGCHLD", "Child status changed" }, /* Posix version */
- { SIGCLD, "SIGCLD", "Child status changed" }, /* Solaris version */
+ { SIGCHLD, "SIGCHLD", "Child status changed" }, /* Posix version */
+ { SIGCLD, "SIGCLD", "Child status changed" }, /* Solaris version */
{ SIGPWR, "SIGPWR", "Power-fail restart" },
{ SIGWINCH, "SIGWINCH", "Window size change" },
{ SIGURG, "SIGURG", "Urgent socket condition" },
{ SIGPOLL, "SIGPOLL", "Pollable event" },
{ SIGIO, "SIGIO", "Socket I/O possible" }, /* alias for SIGPOLL */
- { SIGSTOP, "SIGSTOP", "Stop, not from tty" }, /* cannot be caught or
+ { SIGSTOP, "SIGSTOP", "Stop, not from tty" }, /* cannot be caught or
ignored */
{ SIGTSTP, "SIGTSTP", "User stop from tty" },
{ SIGCONT, "SIGCONT", "Stopped process has been continued" },
@@ -669,14 +667,12 @@ proc_prettyprint_signalset (sigset_t *sigset, int verbose)
{
proc_prettyfprint_signalset (stdout, sigset, verbose);
}
-
/* Prettyprint faults. */
/* Fault translation table. */
-static struct trans fault_table[] =
-{
+static struct trans fault_table[] = {
{ FLTILL, "FLTILL", "Illegal instruction" },
{ FLTPRIV, "FLTPRIV", "Privileged instruction" },
{ FLTBPT, "FLTBPT", "Breakpoint trap" },
@@ -718,8 +714,7 @@ proc_prettyfprint_fault (FILE *file, int faultno, int verbose)
return;
}
- fprintf (file, "Unknown hardware fault %d%c",
- faultno, verbose ? '\n' : ' ');
+ fprintf (file, "Unknown hardware fault %d%c", faultno, verbose ? '\n' : ' ');
}
void
@@ -761,6 +756,7 @@ proc_prettyprint_actionset (struct sigaction *actions, int verbose)
}
void _initialize_proc_events ();
+
void
_initialize_proc_events ()
{
diff --git a/gdb/proc-flags.c b/gdb/proc-flags.c
index 85989b728dd..14572b08ade 100644
--- a/gdb/proc-flags.c
+++ b/gdb/proc-flags.c
@@ -37,17 +37,17 @@
following form. These tables can be used to map numeric values to
their symbolic names and to a string that describes their specific use. */
-struct trans {
- int value; /* The numeric value */
- const char *name; /* The equivalent symbolic value */
- const char *desc; /* Short description of value */
+struct trans
+{
+ int value; /* The numeric value */
+ const char *name; /* The equivalent symbolic value */
+ const char *desc; /* Short description of value */
};
/* Translate bits in the pr_flags member of the prstatus structure,
into the names and desc information. */
-static struct trans pr_flag_table[] =
-{
+static struct trans pr_flag_table[] = {
/* lwp is stopped */
{ PR_STOPPED, "PR_STOPPED", "Process (LWP) is stopped" },
/* lwp is stopped on an event of interest */
diff --git a/gdb/proc-service.c b/gdb/proc-service.c
index 509836ec1a8..abf419214c4 100644
--- a/gdb/proc-service.c
+++ b/gdb/proc-service.c
@@ -33,7 +33,6 @@
/* Prototypes for supply_gregset etc. */
#include "gregset.h"
-
/* Helper functions. */
@@ -69,8 +68,8 @@ core_addr_to_ps_addr (CORE_ADDR addr)
This is a helper function for ps_pdread and ps_pdwrite. */
static ps_err_e
-ps_xfer_memory (const struct ps_prochandle *ph, psaddr_t addr,
- gdb_byte *buf, size_t len, int write)
+ps_xfer_memory (const struct ps_prochandle *ph, psaddr_t addr, gdb_byte *buf,
+ size_t len, int write)
{
scoped_restore_current_inferior restore_inferior;
set_current_inferior (ph->thread->inf);
@@ -90,15 +89,14 @@ ps_xfer_memory (const struct ps_prochandle *ph, psaddr_t addr,
ret = target_read_memory (core_addr, buf, len);
return (ret == 0 ? PS_OK : PS_ERR);
}
-
/* Search for the symbol named NAME within the object named OBJ within
the target process PH. If the symbol is found the address of the
symbol is stored in SYM_ADDR. */
ps_err_e
-ps_pglobal_lookup (struct ps_prochandle *ph, const char *obj,
- const char *name, psaddr_t *sym_addr)
+ps_pglobal_lookup (struct ps_prochandle *ph, const char *obj, const char *name,
+ psaddr_t *sym_addr)
{
inferior *inf = ph->thread->inf;
@@ -127,8 +125,8 @@ ps_pdread (struct ps_prochandle *ph, psaddr_t addr, void *buf, size_t size)
/* Write SIZE bytes from BUF into the target process PH at address ADDR. */
ps_err_e
-ps_pdwrite (struct ps_prochandle *ph, psaddr_t addr,
- const void *buf, size_t size)
+ps_pdwrite (struct ps_prochandle *ph, psaddr_t addr, const void *buf,
+ size_t size)
{
return ps_xfer_memory (ph, addr, (gdb_byte *) buf, size, 1);
}
@@ -143,8 +141,7 @@ get_ps_regcache (struct ps_prochandle *ph, lwpid_t lwpid)
{
inferior *inf = ph->thread->inf;
return get_thread_arch_regcache (inf->process_target (),
- ptid_t (inf->pid, lwpid),
- inf->gdbarch);
+ ptid_t (inf->pid, lwpid), inf->gdbarch);
}
/* Get the general registers of LWP LWPID within the target process PH
@@ -165,7 +162,8 @@ ps_lgetregs (struct ps_prochandle *ph, lwpid_t lwpid, prgregset_t gregset)
from GREGSET. */
ps_err_e
-ps_lsetregs (struct ps_prochandle *ph, lwpid_t lwpid, const prgregset_t gregset)
+ps_lsetregs (struct ps_prochandle *ph, lwpid_t lwpid,
+ const prgregset_t gregset)
{
struct regcache *regcache = get_ps_regcache (ph, lwpid);
@@ -179,8 +177,7 @@ ps_lsetregs (struct ps_prochandle *ph, lwpid_t lwpid, const prgregset_t gregset)
process PH and store them in FPREGSET. */
ps_err_e
-ps_lgetfpregs (struct ps_prochandle *ph, lwpid_t lwpid,
- prfpregset_t *fpregset)
+ps_lgetfpregs (struct ps_prochandle *ph, lwpid_t lwpid, prfpregset_t *fpregset)
{
struct regcache *regcache = get_ps_regcache (ph, lwpid);
@@ -215,6 +212,7 @@ ps_getpid (struct ps_prochandle *ph)
}
void _initialize_proc_service ();
+
void
_initialize_proc_service ()
{
diff --git a/gdb/proc-utils.h b/gdb/proc-utils.h
index 25785709229..48c5026035a 100644
--- a/gdb/proc-utils.h
+++ b/gdb/proc-utils.h
@@ -56,7 +56,7 @@ extern void proc_prettyfprint_signal (FILE *file, int signo, int verbose);
extern void proc_prettyfprint_flags (FILE *file, unsigned long flags,
int verbose);
-extern void proc_prettyfprint_why (FILE *file, unsigned long why,
+extern void proc_prettyfprint_why (FILE *file, unsigned long why,
unsigned long what, int verbose);
extern void proc_prettyfprint_fault (FILE *file, int faultno, int verbose);
@@ -66,7 +66,6 @@ extern void proc_prettyfprint_syscalls (FILE *file, sysset_t *sysset,
extern void proc_prettyfprint_status (long, int, int, int);
-
/* From proc-flags.c */
/*
@@ -78,20 +77,19 @@ extern void proc_prettyprint_flags (unsigned long flags, int verbose);
extern void proc_prettyfprint_flags (FILE *file, unsigned long flags,
int verbose);
-
/* From proc-api.c */
/*
* Trace functions for /proc api.
*/
-extern int write_with_trace (int, void *, size_t, char *, int);
-extern off_t lseek_with_trace (int, off_t, int, char *, int);
-extern int ioctl_with_trace (int, long, void *, char *, int);
-extern pid_t wait_with_trace (int *, char *, int);
-extern int open_with_trace (char *, int, char *, int);
-extern int close_with_trace (int, char *, int);
-extern void procfs_note (const char *, const char *, int);
+extern int write_with_trace (int, void *, size_t, char *, int);
+extern off_t lseek_with_trace (int, off_t, int, char *, int);
+extern int ioctl_with_trace (int, long, void *, char *, int);
+extern pid_t wait_with_trace (int *, char *, int);
+extern int open_with_trace (char *, int, char *, int);
+extern int close_with_trace (int, char *, int);
+extern void procfs_note (const char *, const char *, int);
#ifdef PROCFS_TRACE
/*
@@ -102,16 +100,16 @@ extern void procfs_note (const char *, const char *, int);
* with the older version of procfs.
*/
-#define write(X,Y,Z) write_with_trace (X, Y, Z, __FILE__, __LINE__)
-#define lseek(X,Y,Z) lseek_with_trace (X, Y, Z, __FILE__, __LINE__)
-#define ioctl(X,Y,Z) ioctl_with_trace (X, Y, Z, __FILE__, __LINE__)
-#define open(X,Y) open_with_trace (X, Y, __FILE__, __LINE__)
-#define close(X) close_with_trace (X, __FILE__, __LINE__)
-#define wait(X) wait_with_trace (X, __FILE__, __LINE__)
+#define write(X, Y, Z) write_with_trace (X, Y, Z, __FILE__, __LINE__)
+#define lseek(X, Y, Z) lseek_with_trace (X, Y, Z, __FILE__, __LINE__)
+#define ioctl(X, Y, Z) ioctl_with_trace (X, Y, Z, __FILE__, __LINE__)
+#define open(X, Y) open_with_trace (X, Y, __FILE__, __LINE__)
+#define close(X) close_with_trace (X, __FILE__, __LINE__)
+#define wait(X) wait_with_trace (X, __FILE__, __LINE__)
#endif
-#define PROCFS_NOTE(X) procfs_note (X, __FILE__, __LINE__)
-#define PROC_PRETTYFPRINT_STATUS(X,Y,Z,T) \
- proc_prettyfprint_status (X, Y, Z, T)
+#define PROCFS_NOTE(X) procfs_note (X, __FILE__, __LINE__)
+#define PROC_PRETTYFPRINT_STATUS(X, Y, Z, T) \
+ proc_prettyfprint_status (X, Y, Z, T)
/* Define the type (and more importantly the width) of the control
word used to write to the /proc/PID/ctl file. */
diff --git a/gdb/proc-why.c b/gdb/proc-why.c
index 85199116b4b..7b20eea04a8 100644
--- a/gdb/proc-why.c
+++ b/gdb/proc-why.c
@@ -33,17 +33,16 @@
struct trans
{
- int value; /* The numeric value. */
- const char *name; /* The equivalent symbolic value. */
- const char *desc; /* Short description of value. */
+ int value; /* The numeric value. */
+ const char *name; /* The equivalent symbolic value. */
+ const char *desc; /* Short description of value. */
};
/* Translate values in the pr_why field of a `struct prstatus' or
`struct lwpstatus'. */
-static struct trans pr_why_table[] =
-{
- { PR_REQUESTED, "PR_REQUESTED",
+static struct trans pr_why_table[] = {
+ { PR_REQUESTED, "PR_REQUESTED",
"Directed to stop by debugger via P(IO)CSTOP or P(IO)CWSTOP" },
{ PR_SIGNALLED, "PR_SIGNALLED", "Receipt of a traced signal" },
{ PR_SYSENTRY, "PR_SYSENTRY", "Entry to a traced system call" },
@@ -73,30 +72,31 @@ proc_prettyfprint_why (FILE *file, unsigned long why, unsigned long what,
if (verbose)
fprintf (file, ": %s ", pr_why_table[i].desc);
- switch (why) {
- case PR_REQUESTED:
- break; /* Nothing more to print. */
- case PR_SIGNALLED:
- proc_prettyfprint_signal (file, what, verbose);
- break;
- case PR_FAULTED:
- proc_prettyfprint_fault (file, what, verbose);
- break;
- case PR_SYSENTRY:
- fprintf (file, "Entry to ");
- proc_prettyfprint_syscall (file, what, verbose);
- break;
- case PR_SYSEXIT:
- fprintf (file, "Exit from ");
- proc_prettyfprint_syscall (file, what, verbose);
- break;
- case PR_JOBCONTROL:
- proc_prettyfprint_signal (file, what, verbose);
- break;
- default:
- fprintf (file, "Unknown why %ld, what %ld\n", why, what);
- break;
- }
+ switch (why)
+ {
+ case PR_REQUESTED:
+ break; /* Nothing more to print. */
+ case PR_SIGNALLED:
+ proc_prettyfprint_signal (file, what, verbose);
+ break;
+ case PR_FAULTED:
+ proc_prettyfprint_fault (file, what, verbose);
+ break;
+ case PR_SYSENTRY:
+ fprintf (file, "Entry to ");
+ proc_prettyfprint_syscall (file, what, verbose);
+ break;
+ case PR_SYSEXIT:
+ fprintf (file, "Exit from ");
+ proc_prettyfprint_syscall (file, what, verbose);
+ break;
+ case PR_JOBCONTROL:
+ proc_prettyfprint_signal (file, what, verbose);
+ break;
+ default:
+ fprintf (file, "Unknown why %ld, what %ld\n", why, what);
+ break;
+ }
fprintf (file, "\n");
return;
diff --git a/gdb/process-stratum-target.c b/gdb/process-stratum-target.c
index 4722c5a0f28..7c1cf706f5b 100644
--- a/gdb/process-stratum-target.c
+++ b/gdb/process-stratum-target.c
@@ -22,9 +22,7 @@
#include "inferior.h"
#include <algorithm>
-process_stratum_target::~process_stratum_target ()
-{
-}
+process_stratum_target::~process_stratum_target () {}
struct address_space *
process_stratum_target::thread_address_space (ptid_t ptid)
@@ -33,8 +31,8 @@ process_stratum_target::thread_address_space (ptid_t ptid)
inferior *inf = find_inferior_ptid (this, ptid);
if (inf == NULL || inf->aspace == NULL)
- internal_error (_("Can't determine the current "
- "address space of thread %s\n"),
+ internal_error (_ ("Can't determine the current "
+ "address space of thread %s\n"),
target_pid_to_str (ptid).c_str ());
return inf->aspace;
@@ -111,8 +109,7 @@ process_stratum_target::follow_exec (inferior *follow_inf, ptid_t ptid,
void
process_stratum_target::follow_fork (inferior *child_inf, ptid_t child_ptid,
target_waitkind fork_kind,
- bool follow_child,
- bool detach_on_fork)
+ bool follow_child, bool detach_on_fork)
{
if (child_inf != nullptr)
{
@@ -124,8 +121,8 @@ process_stratum_target::follow_fork (inferior *child_inf, ptid_t child_ptid,
/* See process-stratum-target.h. */
void
-process_stratum_target::maybe_add_resumed_with_pending_wait_status
- (thread_info *thread)
+process_stratum_target::maybe_add_resumed_with_pending_wait_status (
+ thread_info *thread)
{
gdb_assert (!thread->resumed_with_pending_wait_status_node.is_linked ());
@@ -140,8 +137,8 @@ process_stratum_target::maybe_add_resumed_with_pending_wait_status
/* See process-stratum-target.h. */
void
-process_stratum_target::maybe_remove_resumed_with_pending_wait_status
- (thread_info *thread)
+process_stratum_target::maybe_remove_resumed_with_pending_wait_status (
+ thread_info *thread)
{
if (thread->resumed () && thread->has_pending_waitstatus ())
{
@@ -158,13 +155,12 @@ process_stratum_target::maybe_remove_resumed_with_pending_wait_status
/* See process-stratum-target.h. */
thread_info *
-process_stratum_target::random_resumed_with_pending_wait_status
- (inferior *inf, ptid_t filter_ptid)
+process_stratum_target::random_resumed_with_pending_wait_status (
+ inferior *inf, ptid_t filter_ptid)
{
- auto matches = [inf, filter_ptid] (const thread_info &thread)
- {
- return thread.inf == inf && thread.ptid.matches (filter_ptid);
- };
+ auto matches = [inf, filter_ptid] (const thread_info &thread) {
+ return thread.inf == inf && thread.ptid.matches (filter_ptid);
+ };
/* First see how many matching events we have. */
const auto &l = m_resumed_with_pending_wait_status;
@@ -174,23 +170,21 @@ process_stratum_target::random_resumed_with_pending_wait_status
return nullptr;
/* Now randomly pick a thread out of those that match the criteria. */
- int random_selector
- = (int) ((count * (double) rand ()) / (RAND_MAX + 1.0));
+ int random_selector = (int) ((count * (double) rand ()) / (RAND_MAX + 1.0));
if (count > 1)
- infrun_debug_printf ("Found %u events, selecting #%d",
- count, random_selector);
+ infrun_debug_printf ("Found %u events, selecting #%d", count,
+ random_selector);
/* Select the Nth thread that matches. */
- auto it = std::find_if (l.begin (), l.end (),
- [&random_selector, &matches]
- (const thread_info &thread)
- {
- if (!matches (thread))
- return false;
-
- return random_selector-- == 0;
- });
+ auto it
+ = std::find_if (l.begin (), l.end (),
+ [&random_selector, &matches] (const thread_info &thread) {
+ if (!matches (thread))
+ return false;
+
+ return random_selector-- == 0;
+ });
gdb_assert (it != l.end ());
diff --git a/gdb/process-stratum-target.h b/gdb/process-stratum-target.h
index dcbca5a9c6a..0cd7684a8e7 100644
--- a/gdb/process-stratum-target.h
+++ b/gdb/process-stratum-target.h
@@ -31,6 +31,7 @@
class process_stratum_target : public target_ops
{
public:
+
~process_stratum_target () override = 0;
strata stratum () const final override { return process_stratum; }
@@ -48,7 +49,9 @@ public:
/* We must default these because they must be implemented by any
target that can run. */
bool can_async_p () override { return false; }
+
bool supports_non_stop () override { return false; }
+
bool supports_disable_randomization () override { return false; }
/* This default implementation returns the inferior's address
@@ -101,12 +104,14 @@ public:
/* Return true if this target has at least one resumed thread with a pending
wait status. */
bool has_resumed_with_pending_wait_status () const
- { return !m_resumed_with_pending_wait_status.empty (); }
+ {
+ return !m_resumed_with_pending_wait_status.empty ();
+ }
/* Return a random resumed thread with pending wait status belonging to INF
and matching FILTER_PTID. */
- thread_info *random_resumed_with_pending_wait_status
- (inferior *inf, ptid_t filter_ptid);
+ thread_info *random_resumed_with_pending_wait_status (inferior *inf,
+ ptid_t filter_ptid);
/* The connection number. Visible in "info connections". */
int connection_number = 0;
@@ -144,6 +149,7 @@ public:
bool commit_resumed_state = false;
private:
+
/* List of threads managed by this target which simultaneously are resumed
and have a pending wait status.
diff --git a/gdb/procfs.c b/gdb/procfs.c
index 2c009c3e320..5b56e0ceb12 100644
--- a/gdb/procfs.c
+++ b/gdb/procfs.c
@@ -25,7 +25,7 @@
#include "infrun.h"
#include "target.h"
#include "gdbcore.h"
-#include "elf-bfd.h" /* for elfcore_write_* */
+#include "elf-bfd.h" /* for elfcore_write_* */
#include "gdbcmd.h"
#include "gdbthread.h"
#include "regcache.h"
@@ -66,11 +66,11 @@
interface. */
#include <sys/types.h>
-#include <dirent.h> /* opendir/readdir, for listing the LWP's */
+#include <dirent.h> /* opendir/readdir, for listing the LWP's */
-#include <fcntl.h> /* for O_RDONLY */
-#include <unistd.h> /* for "X_OK" */
-#include <sys/stat.h> /* for struct stat */
+#include <fcntl.h> /* for O_RDONLY */
+#include <unistd.h> /* for "X_OK" */
+#include <sys/stat.h> /* for struct stat */
/* Note: procfs-utils.h must be included after the above system header
files, because it redefines various system calls using macros.
@@ -85,17 +85,16 @@
/* This module defines the GDB target vector and its methods. */
-
static enum target_xfer_status procfs_xfer_memory (gdb_byte *,
- const gdb_byte *,
- ULONGEST, ULONGEST,
- ULONGEST *);
+ const gdb_byte *, ULONGEST,
+ ULONGEST, ULONGEST *);
class procfs_target final : public inf_child_target
{
public:
- void create_inferior (const char *, const std::string &,
- char **, int) override;
+
+ void create_inferior (const char *, const std::string &, char **,
+ int) override;
void kill () override;
@@ -111,8 +110,7 @@ public:
void store_registers (struct regcache *, int) override;
enum target_xfer_status xfer_partial (enum target_object object,
- const char *annex,
- gdb_byte *readbuf,
+ const char *annex, gdb_byte *readbuf,
const gdb_byte *writebuf,
ULONGEST offset, ULONGEST len,
ULONGEST *xfered_len) override;
@@ -130,20 +128,20 @@ public:
const char *pid_to_exec_file (int pid) override;
thread_control_capabilities get_thread_control_capabilities () override
- { return tc_schedlock; }
+ {
+ return tc_schedlock;
+ }
/* find_memory_regions support method for gcore */
- int find_memory_regions (find_memory_region_ftype func, void *data)
- override;
+ int find_memory_regions (find_memory_region_ftype func, void *data) override;
gdb::unique_xmalloc_ptr<char> make_corefile_notes (bfd *, int *) override;
bool info_proc (const char *, enum info_proc_what) override;
#if PR_MODEL_NATIVE == PR_MODEL_LP64
- int auxv_parse (const gdb_byte **readptr,
- const gdb_byte *endptr, CORE_ADDR *typep, CORE_ADDR *valp)
- override;
+ int auxv_parse (const gdb_byte **readptr, const gdb_byte *endptr,
+ CORE_ADDR *typep, CORE_ADDR *valp) override;
#endif
bool stopped_by_watchpoint () override;
@@ -169,9 +167,8 @@ static procfs_target the_procfs_target;
is presented in 64-bit format. We need to provide a custom parser
to handle that. */
int
-procfs_target::auxv_parse (const gdb_byte **readptr,
- const gdb_byte *endptr, CORE_ADDR *typep,
- CORE_ADDR *valp)
+procfs_target::auxv_parse (const gdb_byte **readptr, const gdb_byte *endptr,
+ CORE_ADDR *typep, CORE_ADDR *valp)
{
enum bfd_endian byte_order = gdbarch_byte_order (target_gdbarch ());
const gdb_byte *ptr = *readptr;
@@ -198,7 +195,7 @@ procfs_target::auxv_parse (const gdb_byte **readptr,
/* =================== STRUCT PROCINFO "MODULE" =================== */
- /* FIXME: this comment will soon be out of date W.R.T. threads. */
+/* FIXME: this comment will soon be out of date W.R.T. threads. */
/* The procinfo struct is a wrapper to hold all the state information
concerning a /proc process. There should be exactly one procinfo
@@ -218,44 +215,45 @@ procfs_target::auxv_parse (const gdb_byte **readptr,
inferior's procinfo information. */
/* format strings for /proc paths */
-#define CTL_PROC_NAME_FMT "/proc/%d/ctl"
-#define AS_PROC_NAME_FMT "/proc/%d/as"
-#define MAP_PROC_NAME_FMT "/proc/%d/map"
+#define CTL_PROC_NAME_FMT "/proc/%d/ctl"
+#define AS_PROC_NAME_FMT "/proc/%d/as"
+#define MAP_PROC_NAME_FMT "/proc/%d/map"
#define STATUS_PROC_NAME_FMT "/proc/%d/status"
-#define MAX_PROC_NAME_SIZE sizeof("/proc/999999/lwp/0123456789/lwpstatus")
+#define MAX_PROC_NAME_SIZE sizeof ("/proc/999999/lwp/0123456789/lwpstatus")
-typedef struct procinfo {
+typedef struct procinfo
+{
struct procinfo *next;
- int pid; /* Process ID */
- int tid; /* Thread/LWP id */
+ int pid; /* Process ID */
+ int tid; /* Thread/LWP id */
/* process state */
int was_stopped;
int ignore_next_sigstop;
- int ctl_fd; /* File descriptor for /proc control file */
- int status_fd; /* File descriptor for /proc status file */
- int as_fd; /* File descriptor for /proc as file */
+ int ctl_fd; /* File descriptor for /proc control file */
+ int status_fd; /* File descriptor for /proc status file */
+ int as_fd; /* File descriptor for /proc as file */
- char pathname[MAX_PROC_NAME_SIZE]; /* Pathname to /proc entry */
+ char pathname[MAX_PROC_NAME_SIZE]; /* Pathname to /proc entry */
- fltset_t saved_fltset; /* Saved traced hardware fault set */
- sigset_t saved_sigset; /* Saved traced signal set */
- sigset_t saved_sighold; /* Saved held signal set */
- sysset_t *saved_exitset; /* Saved traced system call exit set */
- sysset_t *saved_entryset; /* Saved traced system call entry set */
+ fltset_t saved_fltset; /* Saved traced hardware fault set */
+ sigset_t saved_sigset; /* Saved traced signal set */
+ sigset_t saved_sighold; /* Saved held signal set */
+ sysset_t *saved_exitset; /* Saved traced system call exit set */
+ sysset_t *saved_entryset; /* Saved traced system call entry set */
- pstatus_t prstatus; /* Current process status info */
+ pstatus_t prstatus; /* Current process status info */
struct procinfo *thread_list;
int status_valid : 1;
- int gregs_valid : 1;
+ int gregs_valid : 1;
int fpregs_valid : 1;
- int threads_valid: 1;
+ int threads_valid : 1;
} procinfo;
-static char errmsg[128]; /* shared error msg buffer */
+static char errmsg[128]; /* shared error msg buffer */
/* Function prototypes for procinfo module: */
@@ -267,10 +265,10 @@ static void dead_procinfo (procinfo *p, const char *msg, int killp);
static int open_procinfo_files (procinfo *p, int which);
static void close_procinfo_files (procinfo *p);
-static int iterate_over_mappings
- (procinfo *pi, find_memory_region_ftype child_func, void *data,
- int (*func) (struct prmap *map, find_memory_region_ftype child_func,
- void *data));
+static int iterate_over_mappings (
+ procinfo *pi, find_memory_region_ftype child_func, void *data,
+ int (*func) (struct prmap *map, find_memory_region_ftype child_func,
+ void *data));
/* The head of the procinfo list: */
static procinfo *procinfo_list;
@@ -315,11 +313,11 @@ find_procinfo_or_die (int pid, int tid)
if (pi == NULL)
{
if (tid)
- error (_("procfs: couldn't find pid %d "
- "(kernel thread %d) in procinfo list."),
+ error (_ ("procfs: couldn't find pid %d "
+ "(kernel thread %d) in procinfo list."),
pid, tid);
else
- error (_("procfs: couldn't find pid %d in procinfo list."), pid);
+ error (_ ("procfs: couldn't find pid %d in procinfo list."), pid);
}
return pi;
}
@@ -361,13 +359,18 @@ open_with_retry (const char *pathname, int flags)
control file descriptor; the others are opened lazily as needed.
Returns the file descriptor, or zero for failure. */
-enum { FD_CTL, FD_STATUS, FD_AS };
+enum
+{
+ FD_CTL,
+ FD_STATUS,
+ FD_AS
+};
static int
open_procinfo_files (procinfo *pi, int which)
{
char tmp[MAX_PROC_NAME_SIZE];
- int fd;
+ int fd;
/* This function is getting ALMOST long enough to break up into
several. Here is some rationale:
@@ -398,41 +401,42 @@ open_procinfo_files (procinfo *pi, int which)
needed. */
strcpy (tmp, pi->pathname);
- switch (which) { /* Which file descriptor to open? */
- case FD_CTL:
- if (pi->tid)
- strcat (tmp, "/lwpctl");
- else
- strcat (tmp, "/ctl");
- fd = open_with_retry (tmp, O_WRONLY);
- if (fd < 0)
- return 0; /* fail */
- pi->ctl_fd = fd;
- break;
- case FD_AS:
- if (pi->tid)
- return 0; /* There is no 'as' file descriptor for an lwp. */
- strcat (tmp, "/as");
- fd = open_with_retry (tmp, O_RDWR);
- if (fd < 0)
- return 0; /* fail */
- pi->as_fd = fd;
- break;
- case FD_STATUS:
- if (pi->tid)
- strcat (tmp, "/lwpstatus");
- else
- strcat (tmp, "/status");
- fd = open_with_retry (tmp, O_RDONLY);
- if (fd < 0)
- return 0; /* fail */
- pi->status_fd = fd;
- break;
- default:
- return 0; /* unknown file descriptor */
- }
+ switch (which)
+ { /* Which file descriptor to open? */
+ case FD_CTL:
+ if (pi->tid)
+ strcat (tmp, "/lwpctl");
+ else
+ strcat (tmp, "/ctl");
+ fd = open_with_retry (tmp, O_WRONLY);
+ if (fd < 0)
+ return 0; /* fail */
+ pi->ctl_fd = fd;
+ break;
+ case FD_AS:
+ if (pi->tid)
+ return 0; /* There is no 'as' file descriptor for an lwp. */
+ strcat (tmp, "/as");
+ fd = open_with_retry (tmp, O_RDWR);
+ if (fd < 0)
+ return 0; /* fail */
+ pi->as_fd = fd;
+ break;
+ case FD_STATUS:
+ if (pi->tid)
+ strcat (tmp, "/lwpstatus");
+ else
+ strcat (tmp, "/status");
+ fd = open_with_retry (tmp, O_RDONLY);
+ if (fd < 0)
+ return 0; /* fail */
+ pi->status_fd = fd;
+ break;
+ default:
+ return 0; /* unknown file descriptor */
+ }
- return 1; /* success */
+ return 1; /* success */
}
/* Allocate a data structure and link it into the procinfo list.
@@ -446,11 +450,11 @@ create_procinfo (int pid, int tid)
pi = find_procinfo (pid, tid);
if (pi != NULL)
- return pi; /* Already exists, nothing to do. */
+ return pi; /* Already exists, nothing to do. */
/* Find parent before doing malloc, to save having to cleanup. */
if (tid != 0)
- parent = find_procinfo_or_die (pid, 0); /* FIXME: should I
+ parent = find_procinfo_or_die (pid, 0); /* FIXME: should I
create it if it
doesn't exist yet? */
@@ -471,8 +475,8 @@ create_procinfo (int pid, int tid)
}
else
{
- xsnprintf (pi->pathname, sizeof (pi->pathname), "/proc/%d/lwp/%d",
- pid, tid);
+ xsnprintf (pi->pathname, sizeof (pi->pathname), "/proc/%d/lwp/%d", pid,
+ tid);
pi->next = parent->thread_list;
parent->thread_list = pi;
}
@@ -507,7 +511,7 @@ destroy_one_procinfo (procinfo **list, procinfo *pi)
for (ptr = *list; ptr; ptr = ptr->next)
if (ptr->next == pi)
{
- ptr->next = pi->next;
+ ptr->next = pi->next;
break;
}
@@ -525,12 +529,12 @@ destroy_procinfo (procinfo *pi)
{
procinfo *tmp;
- if (pi->tid != 0) /* Destroy a thread procinfo. */
+ if (pi->tid != 0) /* Destroy a thread procinfo. */
{
- tmp = find_procinfo (pi->pid, 0); /* Find the parent process. */
+ tmp = find_procinfo (pi->pid, 0); /* Find the parent process. */
destroy_one_procinfo (&tmp->thread_list, pi);
}
- else /* Destroy a process procinfo and all its threads. */
+ else /* Destroy a process procinfo and all its threads. */
{
/* First destroy the children, if any; */
while (pi->thread_list != NULL)
@@ -543,15 +547,16 @@ destroy_procinfo (procinfo *pi)
/* A deleter that calls destroy_procinfo. */
struct procinfo_deleter
{
- void operator() (procinfo *pi) const
- {
- destroy_procinfo (pi);
- }
+ void operator() (procinfo *pi) const { destroy_procinfo (pi); }
};
typedef std::unique_ptr<procinfo, procinfo_deleter> procinfo_up;
-enum { NOKILL, KILL };
+enum
+{
+ NOKILL,
+ KILL
+};
/* To be called on a non_recoverable error for a procinfo. Prints
error messages, optionally sends a SIGKILL to the process, then
@@ -585,24 +590,22 @@ static int proc_why (procinfo *pi);
static int proc_what (procinfo *pi);
static int proc_set_current_signal (procinfo *pi, int signo);
static int proc_get_current_thread (procinfo *pi);
-static int proc_iterate_over_threads
- (procinfo *pi,
- int (*func) (procinfo *, procinfo *, void *),
- void *ptr);
+static int proc_iterate_over_threads (
+ procinfo *pi, int (*func) (procinfo *, procinfo *, void *), void *ptr);
static void
proc_warn (procinfo *pi, const char *func, int line)
{
- xsnprintf (errmsg, sizeof (errmsg), "procfs: %s line %d, %s",
- func, line, pi->pathname);
+ xsnprintf (errmsg, sizeof (errmsg), "procfs: %s line %d, %s", func, line,
+ pi->pathname);
print_sys_errmsg (errmsg, errno);
}
static void
proc_error (procinfo *pi, const char *func, int line)
{
- xsnprintf (errmsg, sizeof (errmsg), "procfs: %s line %d, %s",
- func, line, pi->pathname);
+ xsnprintf (errmsg, sizeof (errmsg), "procfs: %s line %d, %s", func, line,
+ pi->pathname);
perror_with_name (errmsg);
}
@@ -623,39 +626,35 @@ proc_get_status (procinfo *pi)
}
if (lseek (pi->status_fd, 0, SEEK_SET) < 0)
- pi->status_valid = 0; /* fail */
+ pi->status_valid = 0; /* fail */
else
{
/* Sigh... I have to read a different data structure,
depending on whether this is a main process or an LWP. */
if (pi->tid)
- pi->status_valid = (read (pi->status_fd,
- (char *) &pi->prstatus.pr_lwp,
+ pi->status_valid = (read (pi->status_fd, (char *) &pi->prstatus.pr_lwp,
sizeof (lwpstatus_t))
== sizeof (lwpstatus_t));
else
{
- pi->status_valid = (read (pi->status_fd,
- (char *) &pi->prstatus,
- sizeof (pstatus_t))
- == sizeof (pstatus_t));
+ pi->status_valid
+ = (read (pi->status_fd, (char *) &pi->prstatus, sizeof (pstatus_t))
+ == sizeof (pstatus_t));
}
}
if (pi->status_valid)
{
- PROC_PRETTYFPRINT_STATUS (proc_flags (pi),
- proc_why (pi),
- proc_what (pi),
+ PROC_PRETTYFPRINT_STATUS (proc_flags (pi), proc_why (pi), proc_what (pi),
proc_get_current_thread (pi));
}
/* The status struct includes general regs, so mark them valid too. */
- pi->gregs_valid = pi->status_valid;
+ pi->gregs_valid = pi->status_valid;
/* In the read/write multiple-fd model, the status struct includes
the fp regs too, so mark them valid too. */
pi->fpregs_valid = pi->status_valid;
- return pi->status_valid; /* True if success, false if failure. */
+ return pi->status_valid; /* True if success, false if failure. */
}
/* Returns the process flags (pr_flags field). */
@@ -665,7 +664,7 @@ proc_flags (procinfo *pi)
{
if (!pi->status_valid)
if (!proc_get_status (pi))
- return 0; /* FIXME: not a good failure value (but what is?) */
+ return 0; /* FIXME: not a good failure value (but what is?) */
return pi->prstatus.pr_lwp.pr_flags;
}
@@ -677,7 +676,7 @@ proc_why (procinfo *pi)
{
if (!pi->status_valid)
if (!proc_get_status (pi))
- return 0; /* FIXME: not a good failure value (but what is?) */
+ return 0; /* FIXME: not a good failure value (but what is?) */
return pi->prstatus.pr_lwp.pr_why;
}
@@ -689,7 +688,7 @@ proc_what (procinfo *pi)
{
if (!pi->status_valid)
if (!proc_get_status (pi))
- return 0; /* FIXME: not a good failure value (but what is?) */
+ return 0; /* FIXME: not a good failure value (but what is?) */
return pi->prstatus.pr_lwp.pr_what;
}
@@ -706,9 +705,9 @@ proc_watchpoint_address (procinfo *pi, CORE_ADDR *addr)
if (!proc_get_status (pi))
return 0;
- *addr = (CORE_ADDR) gdbarch_pointer_to_address (target_gdbarch (),
- builtin_type (target_gdbarch ())->builtin_data_ptr,
- (gdb_byte *) &pi->prstatus.pr_lwp.pr_info.si_addr);
+ *addr = (CORE_ADDR) gdbarch_pointer_to_address (
+ target_gdbarch (), builtin_type (target_gdbarch ())->builtin_data_ptr,
+ (gdb_byte *) &pi->prstatus.pr_lwp.pr_info.si_addr);
return 1;
}
@@ -753,12 +752,16 @@ proc_sysargs (procinfo *pi)
Returns non-zero for success, zero for failure. */
-enum { FLAG_RESET, FLAG_SET };
+enum
+{
+ FLAG_RESET,
+ FLAG_SET
+};
static int
proc_modify_flag (procinfo *pi, long flag, long mode)
{
- long win = 0; /* default to fail */
+ long win = 0; /* default to fail */
/* These operations affect the process as a whole, and applying them
to an individual LWP has the same meaning as applying them to the
@@ -771,9 +774,9 @@ proc_modify_flag (procinfo *pi, long flag, long mode)
procfs_ctl_t arg[2];
- if (mode == FLAG_SET) /* Set the flag (RLC, FORK, or ASYNC). */
+ if (mode == FLAG_SET) /* Set the flag (RLC, FORK, or ASYNC). */
arg[0] = PCSET;
- else /* Reset the flag. */
+ else /* Reset the flag. */
arg[0] = PCUNSET;
arg[1] = flag;
@@ -784,12 +787,12 @@ proc_modify_flag (procinfo *pi, long flag, long mode)
pi->status_valid = 0;
if (!win)
- warning (_("procfs: modify_flag failed to turn %s %s"),
- flag == PR_FORK ? "PR_FORK" :
- flag == PR_RLC ? "PR_RLC" :
- flag == PR_ASYNC ? "PR_ASYNC" :
- flag == PR_KLC ? "PR_KLC" :
- "<unknown flag>",
+ warning (_ ("procfs: modify_flag failed to turn %s %s"),
+ flag == PR_FORK ? "PR_FORK"
+ : flag == PR_RLC ? "PR_RLC"
+ : flag == PR_ASYNC ? "PR_ASYNC"
+ : flag == PR_KLC ? "PR_KLC"
+ : "<unknown flag>",
mode == FLAG_RESET ? "off" : "on");
return win;
@@ -926,18 +929,18 @@ proc_run_process (procinfo *pi, int step, int signo)
if (pi->ctl_fd == 0 && open_procinfo_files (pi, FD_CTL) == 0)
return 0;
- runflags = PRCFAULT; /* Always clear current fault. */
+ runflags = PRCFAULT; /* Always clear current fault. */
if (step)
runflags |= PRSTEP;
if (signo == 0)
runflags |= PRCSIG;
- else if (signo != -1) /* -1 means do nothing W.R.T. signals. */
+ else if (signo != -1) /* -1 means do nothing W.R.T. signals. */
proc_set_current_signal (pi, signo);
procfs_ctl_t cmd[2];
- cmd[0] = PCRUN;
- cmd[1] = runflags;
+ cmd[0] = PCRUN;
+ cmd[1] = runflags;
win = (write (pi->ctl_fd, (char *) &cmd, sizeof (cmd)) == sizeof (cmd));
return win;
@@ -959,7 +962,8 @@ proc_set_traced_signals (procinfo *pi, sigset_t *sigset)
if (pi->tid != 0)
pi = find_procinfo_or_die (pi->pid, 0);
- struct {
+ struct
+ {
procfs_ctl_t cmd;
/* Use char array to avoid alignment issues. */
char sigset[sizeof (sigset_t)];
@@ -974,7 +978,7 @@ proc_set_traced_signals (procinfo *pi, sigset_t *sigset)
pi->status_valid = 0;
if (!win)
- warning (_("procfs: set_traced_signals failed"));
+ warning (_ ("procfs: set_traced_signals failed"));
return win;
}
@@ -994,7 +998,8 @@ proc_set_traced_faults (procinfo *pi, fltset_t *fltset)
if (pi->tid != 0)
pi = find_procinfo_or_die (pi->pid, 0);
- struct {
+ struct
+ {
procfs_ctl_t cmd;
/* Use char array to avoid alignment issues. */
char fltset[sizeof (fltset_t)];
@@ -1027,7 +1032,8 @@ proc_set_traced_sysentry (procinfo *pi, sysset_t *sysset)
if (pi->tid != 0)
pi = find_procinfo_or_die (pi->pid, 0);
- struct {
+ struct
+ {
procfs_ctl_t cmd;
/* Use char array to avoid alignment issues. */
char sysset[sizeof (sysset_t)];
@@ -1061,7 +1067,8 @@ proc_set_traced_sysexit (procinfo *pi, sysset_t *sysset)
if (pi->tid != 0)
pi = find_procinfo_or_die (pi->pid, 0);
- struct gdb_proc_ctl_pcsexit {
+ struct gdb_proc_ctl_pcsexit
+ {
procfs_ctl_t cmd;
/* Use char array to avoid alignment issues. */
char sysset[sizeof (sysset_t)];
@@ -1095,13 +1102,14 @@ proc_set_held_signals (procinfo *pi, sigset_t *sighold)
if (pi->tid != 0)
pi = find_procinfo_or_die (pi->pid, 0);
- struct {
+ struct
+ {
procfs_ctl_t cmd;
/* Use char array to avoid alignment issues. */
char hold[sizeof (sigset_t)];
} arg;
- arg.cmd = PCSHOLD;
+ arg.cmd = PCSHOLD;
memcpy (&arg.hold, sighold, sizeof (sigset_t));
win = (write (pi->ctl_fd, (void *) &arg, sizeof (arg)) == sizeof (arg));
@@ -1283,11 +1291,14 @@ static int
proc_set_current_signal (procinfo *pi, int signo)
{
int win;
- struct {
+
+ struct
+ {
procfs_ctl_t cmd;
/* Use char array to avoid alignment issues. */
char sinfo[sizeof (siginfo_t)];
} arg;
+
siginfo_t mysinfo;
process_stratum_target *wait_target;
ptid_t wait_ptid;
@@ -1303,27 +1314,24 @@ proc_set_current_signal (procinfo *pi, int signo)
/* The pointer is just a type alias. */
get_last_target_status (&wait_target, &wait_ptid, &wait_status);
- if (wait_target == &the_procfs_target
- && wait_ptid == inferior_ptid
+ if (wait_target == &the_procfs_target && wait_ptid == inferior_ptid
&& wait_status.kind () == TARGET_WAITKIND_STOPPED
&& wait_status.sig () == gdb_signal_from_host (signo)
- && proc_get_status (pi)
- && pi->prstatus.pr_lwp.pr_info.si_signo == signo
- )
+ && proc_get_status (pi) && pi->prstatus.pr_lwp.pr_info.si_signo == signo)
/* Use the siginfo associated with the signal being
redelivered. */
memcpy (arg.sinfo, &pi->prstatus.pr_lwp.pr_info, sizeof (siginfo_t));
else
{
mysinfo.si_signo = signo;
- mysinfo.si_code = 0;
- mysinfo.si_pid = getpid (); /* ?why? */
- mysinfo.si_uid = getuid (); /* ?why? */
+ mysinfo.si_code = 0;
+ mysinfo.si_pid = getpid (); /* ?why? */
+ mysinfo.si_uid = getuid (); /* ?why? */
memcpy (arg.sinfo, &mysinfo, sizeof (siginfo_t));
}
arg.cmd = PCSSIG;
- win = (write (pi->ctl_fd, (void *) &arg, sizeof (arg)) == sizeof (arg));
+ win = (write (pi->ctl_fd, (void *) &arg, sizeof (arg)) == sizeof (arg));
return win;
}
@@ -1345,20 +1353,22 @@ proc_clear_current_signal (procinfo *pi)
if (pi->tid != 0)
pi = find_procinfo_or_die (pi->pid, 0);
- struct {
+ struct
+ {
procfs_ctl_t cmd;
/* Use char array to avoid alignment issues. */
char sinfo[sizeof (siginfo_t)];
} arg;
+
siginfo_t mysinfo;
arg.cmd = PCSSIG;
/* The pointer is just a type alias. */
mysinfo.si_signo = 0;
- mysinfo.si_code = 0;
+ mysinfo.si_code = 0;
mysinfo.si_errno = 0;
- mysinfo.si_pid = getpid (); /* ?why? */
- mysinfo.si_uid = getuid (); /* ?why? */
+ mysinfo.si_pid = getpid (); /* ?why? */
+ mysinfo.si_uid = getuid (); /* ?why? */
memcpy (arg.sinfo, &mysinfo, sizeof (siginfo_t));
win = (write (pi->ctl_fd, (void *) &arg, sizeof (arg)) == sizeof (arg));
@@ -1404,13 +1414,14 @@ proc_set_gregs (procinfo *pi)
gregs = proc_get_gregs (pi);
if (gregs == NULL)
- return 0; /* proc_get_regs has already warned. */
+ return 0; /* proc_get_regs has already warned. */
if (pi->ctl_fd == 0 && open_procinfo_files (pi, FD_CTL) == 0)
return 0;
else
{
- struct {
+ struct
+ {
procfs_ctl_t cmd;
/* Use char array to avoid alignment issues. */
char gregs[sizeof (gdb_gregset_t)];
@@ -1438,13 +1449,14 @@ proc_set_fpregs (procinfo *pi)
fpregs = proc_get_fpregs (pi);
if (fpregs == NULL)
- return 0; /* proc_get_fpregs has already warned. */
+ return 0; /* proc_get_fpregs has already warned. */
if (pi->ctl_fd == 0 && open_procinfo_files (pi, FD_CTL) == 0)
return 0;
else
{
- struct {
+ struct
+ {
procfs_ctl_t cmd;
/* Use char array to avoid alignment issues. */
char fpregs[sizeof (gdb_fpregset_t)];
@@ -1480,7 +1492,7 @@ proc_kill (procinfo *pi, int signo)
cmd[0] = PCKILL;
cmd[1] = signo;
win = (write (pi->ctl_fd, (char *) &cmd, sizeof (cmd)) == sizeof (cmd));
- }
+ }
return win;
}
@@ -1516,25 +1528,27 @@ procfs_address_to_host_pointer (CORE_ADDR addr)
void *ptr;
gdb_assert (sizeof (ptr) == ptr_type->length ());
- gdbarch_address_to_pointer (target_gdbarch (), ptr_type,
- (gdb_byte *) &ptr, addr);
+ gdbarch_address_to_pointer (target_gdbarch (), ptr_type, (gdb_byte *) &ptr,
+ addr);
return ptr;
}
static int
proc_set_watchpoint (procinfo *pi, CORE_ADDR addr, int len, int wflags)
{
- struct {
+ struct
+ {
procfs_ctl_t cmd;
char watch[sizeof (prwatch_t)];
} arg;
+
prwatch_t pwatch;
/* NOTE: cagney/2003-02-01: Even more horrible hack. Need to
convert a target address into something that can be stored in a
native data structure. */
- pwatch.pr_vaddr = (uintptr_t) procfs_address_to_host_pointer (addr);
- pwatch.pr_size = len;
+ pwatch.pr_vaddr = (uintptr_t) procfs_address_to_host_pointer (addr);
+ pwatch.pr_size = len;
pwatch.pr_wflags = wflags;
arg.cmd = PCWATCH;
memcpy (arg.watch, &pwatch, sizeof (prwatch_t));
@@ -1556,7 +1570,7 @@ proc_get_nthreads (procinfo *pi)
/* Only works for the process procinfo, because the LWP procinfos do not
get prstatus filled in. */
- if (pi->tid != 0) /* Find the parent process procinfo. */
+ if (pi->tid != 0) /* Find the parent process procinfo. */
pi = find_procinfo_or_die (pi->pid, 0);
return pi->prstatus.pr_nlwp;
}
@@ -1591,13 +1605,13 @@ proc_get_current_thread (procinfo *pi)
static int
proc_delete_dead_threads (procinfo *parent, procinfo *thread, void *ignore)
{
- if (thread && parent) /* sanity */
+ if (thread && parent) /* sanity */
{
thread->status_valid = 0;
if (!proc_get_status (thread))
destroy_one_procinfo (&parent->thread_list, thread);
}
- return 0; /* keep iterating */
+ return 0; /* keep iterating */
}
static int
@@ -1632,7 +1646,7 @@ proc_update_threads (procinfo *pi)
proc_error (pi, "update_threads, opendir", __LINE__);
while ((direntry = readdir (dirp.get ())) != NULL)
- if (direntry->d_name[0] != '.') /* skip '.' and '..' */
+ if (direntry->d_name[0] != '.') /* skip '.' and '..' */
{
lwpid = atoi (&direntry->d_name[0]);
thread = create_procinfo (pi->pid, lwpid);
@@ -1674,7 +1688,7 @@ proc_iterate_over_threads (procinfo *pi,
for (thread = pi->thread_list; thread != NULL; thread = next)
{
- next = thread->next; /* In case thread is destroyed. */
+ next = thread->next; /* In case thread is destroyed. */
retval = (*func) (pi, thread, ptr);
if (retval != 0)
break;
@@ -1713,9 +1727,9 @@ procfs_debug_inferior (procinfo *pi)
int status;
/* Register to trace hardware faults in the child. */
- prfillset (&traced_faults); /* trace all faults... */
- prdelset (&traced_faults, FLTPAGE); /* except page fault. */
- if (!proc_set_traced_faults (pi, &traced_faults))
+ prfillset (&traced_faults); /* trace all faults... */
+ prdelset (&traced_faults, FLTPAGE); /* except page fault. */
+ if (!proc_set_traced_faults (pi, &traced_faults))
return __LINE__;
/* Initially, register to trace all signals in the child. */
@@ -1723,7 +1737,6 @@ procfs_debug_inferior (procinfo *pi)
if (!proc_set_traced_signals (pi, &traced_signals))
return __LINE__;
-
/* Register to trace the 'exit' system call (on entry). */
traced_syscall_entries = XNEW (sysset_t);
premptyset (traced_syscall_entries);
@@ -1753,12 +1766,12 @@ procfs_debug_inferior (procinfo *pi)
void
procfs_target::attach (const char *args, int from_tty)
{
- int pid;
+ int pid;
pid = parse_pid_to_attach (args);
if (pid == getpid ())
- error (_("Attaching GDB to itself is not a good idea..."));
+ error (_ ("Attaching GDB to itself is not a good idea..."));
/* Push the target if needed, ensure it gets un-pushed it if attach fails. */
inferior *inf = current_inferior ();
@@ -1799,7 +1812,7 @@ do_attach (ptid_t ptid)
pi = create_procinfo (ptid.pid (), 0);
if (pi == NULL)
- perror (_("procfs: out of memory in 'attach'"));
+ perror (_ ("procfs: out of memory in 'attach'"));
if (!open_procinfo_files (pi, FD_CTL))
{
@@ -1829,17 +1842,17 @@ do_attach (ptid_t ptid)
pi->ignore_next_sigstop = 1;
}
/* Save some of the /proc state to be restored if we detach. */
- if (!proc_get_traced_faults (pi, &pi->saved_fltset))
+ if (!proc_get_traced_faults (pi, &pi->saved_fltset))
dead_procinfo (pi, "do_attach: couldn't save traced faults.", NOKILL);
- if (!proc_get_traced_signals (pi, &pi->saved_sigset))
+ if (!proc_get_traced_signals (pi, &pi->saved_sigset))
dead_procinfo (pi, "do_attach: couldn't save traced signals.", NOKILL);
if (!proc_get_traced_sysentry (pi, pi->saved_entryset))
dead_procinfo (pi, "do_attach: couldn't save traced syscall entries.",
NOKILL);
- if (!proc_get_traced_sysexit (pi, pi->saved_exitset))
+ if (!proc_get_traced_sysexit (pi, pi->saved_exitset))
dead_procinfo (pi, "do_attach: couldn't save traced syscall exits.",
NOKILL);
- if (!proc_get_held_signals (pi, &pi->saved_sighold))
+ if (!proc_get_held_signals (pi, &pi->saved_sighold))
dead_procinfo (pi, "do_attach: couldn't save held signals.", NOKILL);
fail = procfs_debug_inferior (pi);
@@ -1867,8 +1880,7 @@ do_detach ()
procinfo *pi;
/* Find procinfo for the main process. */
- pi = find_procinfo_or_die (inferior_ptid.pid (),
- 0); /* FIXME: threads */
+ pi = find_procinfo_or_die (inferior_ptid.pid (), 0); /* FIXME: threads */
if (!proc_set_traced_signals (pi, &pi->saved_sigset))
proc_warn (pi, "do_detach, set_traced_signal", __LINE__);
@@ -1887,7 +1899,7 @@ do_detach ()
if (proc_flags (pi) & (PR_STOPPED | PR_ISTOP))
if (!(pi->was_stopped)
- || query (_("Was stopped when attached, make it runnable again? ")))
+ || query (_ ("Was stopped when attached, make it runnable again? ")))
{
/* Clear any pending signal. */
if (!proc_clear_current_fault (pi))
@@ -1926,7 +1938,7 @@ procfs_target::fetch_registers (struct regcache *regcache, int regnum)
pi = find_procinfo_or_die (pid, tid);
if (pi == NULL)
- error (_("procfs: fetch_registers failed to find procinfo for %s"),
+ error (_ ("procfs: fetch_registers failed to find procinfo for %s"),
target_pid_to_str (ptid).c_str ());
gregs = proc_get_gregs (pi);
@@ -1942,7 +1954,7 @@ procfs_target::fetch_registers (struct regcache *regcache, int regnum)
if ((regnum >= 0 && regnum < gdbarch_fp0_regnum (gdbarch))
|| regnum == gdbarch_pc_regnum (gdbarch)
|| regnum == gdbarch_sp_regnum (gdbarch))
- return; /* Not a floating point register. */
+ return; /* Not a floating point register. */
fpregs = proc_get_fpregs (pi);
if (fpregs == NULL)
@@ -1975,7 +1987,7 @@ procfs_target::store_registers (struct regcache *regcache, int regnum)
pi = find_procinfo_or_die (pid, tid);
if (pi == NULL)
- error (_("procfs: store_registers: failed to find procinfo for %s"),
+ error (_ ("procfs: store_registers: failed to find procinfo for %s"),
target_pid_to_str (ptid).c_str ());
gregs = proc_get_gregs (pi);
@@ -1993,7 +2005,7 @@ procfs_target::store_registers (struct regcache *regcache, int regnum)
if ((regnum >= 0 && regnum < gdbarch_fp0_regnum (gdbarch))
|| regnum == gdbarch_pc_regnum (gdbarch)
|| regnum == gdbarch_sp_regnum (gdbarch))
- return; /* Not a floating point register. */
+ return; /* Not a floating point register. */
fpregs = proc_get_fpregs (pi);
if (fpregs == NULL)
@@ -2017,17 +2029,17 @@ procfs_target::wait (ptid_t ptid, struct target_waitstatus *status,
{
/* First cut: loosely based on original version 2.1. */
procinfo *pi;
- int wstat;
- int temp_tid;
- ptid_t retval, temp_ptid;
- int why, what, flags;
- int retry = 0;
+ int wstat;
+ int temp_tid;
+ ptid_t retval, temp_ptid;
+ int why, what, flags;
+ int retry = 0;
wait_again:
retry++;
- wstat = 0;
- retval = ptid_t (-1);
+ wstat = 0;
+ retval = ptid_t (-1);
/* Find procinfo for main process. */
@@ -2039,10 +2051,10 @@ wait_again:
{
/* We must assume that the status is stale now... */
pi->status_valid = 0;
- pi->gregs_valid = 0;
+ pi->gregs_valid = 0;
pi->fpregs_valid = 0;
-#if 0 /* just try this out... */
+#if 0 /* just try this out... */
flags = proc_flags (pi);
why = proc_why (pi);
if ((flags & PR_STOPPED) && (why == PR_REQUESTED))
@@ -2058,12 +2070,13 @@ wait_again:
int wait_retval;
/* /proc file not found; presumably child has terminated. */
- wait_retval = ::wait (&wstat); /* "wait" for the child's exit. */
+ wait_retval
+ = ::wait (&wstat); /* "wait" for the child's exit. */
/* Wrong child? */
if (wait_retval != inf->pid)
- error (_("procfs: couldn't stop "
- "process %d: wait returned %d."),
+ error (_ ("procfs: couldn't stop "
+ "process %d: wait returned %d."),
inf->pid, wait_retval);
/* FIXME: might I not just use waitpid?
Or try find_procinfo to see if I know about this child? */
@@ -2090,8 +2103,8 @@ wait_again:
because we already have a waitstatus. */
flags = proc_flags (pi);
- why = proc_why (pi);
- what = proc_what (pi);
+ why = proc_why (pi);
+ what = proc_what (pi);
if (flags & (PR_STOPPED | PR_ISTOP))
{
@@ -2108,98 +2121,98 @@ wait_again:
the process ID plus the lwp ID. */
retval = ptid_t (pi->pid, proc_get_current_thread (pi), 0);
- switch (why) {
- case PR_SIGNALLED:
- wstat = (what << 8) | 0177;
- break;
- case PR_SYSENTRY:
- if (what == SYS_lwp_exit)
- {
- if (print_thread_events)
- gdb_printf (_("[%s exited]\n"),
- target_pid_to_str (retval).c_str ());
- delete_thread (find_thread_ptid (this, retval));
- target_continue_no_signal (ptid);
- goto wait_again;
- }
- else if (what == SYS_exit)
- {
- /* Handle SYS_exit call only. */
- /* Stopped at entry to SYS_exit.
+ switch (why)
+ {
+ case PR_SIGNALLED:
+ wstat = (what << 8) | 0177;
+ break;
+ case PR_SYSENTRY:
+ if (what == SYS_lwp_exit)
+ {
+ if (print_thread_events)
+ gdb_printf (_ ("[%s exited]\n"),
+ target_pid_to_str (retval).c_str ());
+ delete_thread (find_thread_ptid (this, retval));
+ target_continue_no_signal (ptid);
+ goto wait_again;
+ }
+ else if (what == SYS_exit)
+ {
+ /* Handle SYS_exit call only. */
+ /* Stopped at entry to SYS_exit.
Make it runnable, resume it, then use
the wait system call to get its exit code.
Proc_run_process always clears the current
fault and signal.
Then return its exit status. */
- pi->status_valid = 0;
- wstat = 0;
- /* FIXME: what we should do is return
+ pi->status_valid = 0;
+ wstat = 0;
+ /* FIXME: what we should do is return
TARGET_WAITKIND_SPURIOUS. */
- if (!proc_run_process (pi, 0, 0))
- proc_error (pi, "target_wait, run_process", __LINE__);
+ if (!proc_run_process (pi, 0, 0))
+ proc_error (pi, "target_wait, run_process", __LINE__);
- if (inf->attach_flag)
- {
- /* Don't call wait: simulate waiting for exit,
+ if (inf->attach_flag)
+ {
+ /* Don't call wait: simulate waiting for exit,
return a "success" exit code. Bogus: what if
it returns something else? */
- wstat = 0;
- retval = ptid_t (inf->pid); /* ? ? ? */
- }
- else
- {
- int temp = ::wait (&wstat);
-
- /* FIXME: shouldn't I make sure I get the right
+ wstat = 0;
+ retval = ptid_t (inf->pid); /* ? ? ? */
+ }
+ else
+ {
+ int temp = ::wait (&wstat);
+
+ /* FIXME: shouldn't I make sure I get the right
event from the right process? If (for
instance) I have killed an earlier inferior
process but failed to clean up after it
somehow, I could get its termination event
here. */
- /* If wait returns -1, that's what we return
+ /* If wait returns -1, that's what we return
to GDB. */
- if (temp < 0)
- retval = ptid_t (temp);
- }
- }
- else
- {
- gdb_printf (_("procfs: trapped on entry to "));
- proc_prettyprint_syscall (proc_what (pi), 0);
- gdb_printf ("\n");
-
- long i, nsysargs, *sysargs;
-
- nsysargs = proc_nsysarg (pi);
- sysargs = proc_sysargs (pi);
-
- if (nsysargs > 0 && sysargs != NULL)
- {
- gdb_printf (_("%ld syscall arguments:\n"),
- nsysargs);
- for (i = 0; i < nsysargs; i++)
- gdb_printf ("#%ld: 0x%08lx\n",
- i, sysargs[i]);
- }
-
- /* How to keep going without returning to wfi: */
- target_continue_no_signal (ptid);
- goto wait_again;
- }
- break;
- case PR_SYSEXIT:
- if (what == SYS_execve)
- {
- /* Hopefully this is our own "fork-child" execing
+ if (temp < 0)
+ retval = ptid_t (temp);
+ }
+ }
+ else
+ {
+ gdb_printf (_ ("procfs: trapped on entry to "));
+ proc_prettyprint_syscall (proc_what (pi), 0);
+ gdb_printf ("\n");
+
+ long i, nsysargs, *sysargs;
+
+ nsysargs = proc_nsysarg (pi);
+ sysargs = proc_sysargs (pi);
+
+ if (nsysargs > 0 && sysargs != NULL)
+ {
+ gdb_printf (_ ("%ld syscall arguments:\n"),
+ nsysargs);
+ for (i = 0; i < nsysargs; i++)
+ gdb_printf ("#%ld: 0x%08lx\n", i, sysargs[i]);
+ }
+
+ /* How to keep going without returning to wfi: */
+ target_continue_no_signal (ptid);
+ goto wait_again;
+ }
+ break;
+ case PR_SYSEXIT:
+ if (what == SYS_execve)
+ {
+ /* Hopefully this is our own "fork-child" execing
the real child. Hoax this event into a trap, and
GDB will see the child about to execute its start
address. */
- wstat = (SIGTRAP << 8) | 0177;
- }
- else if (what == SYS_lwp_create)
- {
- /* This syscall is somewhat like fork/exec. We
+ wstat = (SIGTRAP << 8) | 0177;
+ }
+ else if (what == SYS_lwp_create)
+ {
+ /* This syscall is somewhat like fork/exec. We
will get the event twice: once for the parent
LWP, and once for the child. We should already
know about the parent LWP, but the child will
@@ -2207,118 +2220,113 @@ wait_again:
if it represents a new thread, simply add the
thread to the list. */
- /* If not in procinfo list, add it. */
- temp_tid = proc_get_current_thread (pi);
- if (!find_procinfo (pi->pid, temp_tid))
- create_procinfo (pi->pid, temp_tid);
-
- temp_ptid = ptid_t (pi->pid, temp_tid, 0);
- /* If not in GDB's thread list, add it. */
- if (!in_thread_list (this, temp_ptid))
- add_thread (this, temp_ptid);
-
- target_continue_no_signal (ptid);
- goto wait_again;
- }
- else if (what == SYS_lwp_exit)
- {
- if (print_thread_events)
- gdb_printf (_("[%s exited]\n"),
- target_pid_to_str (retval).c_str ());
- delete_thread (find_thread_ptid (this, retval));
- status->set_spurious ();
- return retval;
- }
- else
- {
- gdb_printf (_("procfs: trapped on exit from "));
- proc_prettyprint_syscall (proc_what (pi), 0);
- gdb_printf ("\n");
-
- long i, nsysargs, *sysargs;
-
- nsysargs = proc_nsysarg (pi);
- sysargs = proc_sysargs (pi);
-
- if (nsysargs > 0 && sysargs != NULL)
- {
- gdb_printf (_("%ld syscall arguments:\n"),
- nsysargs);
- for (i = 0; i < nsysargs; i++)
- gdb_printf ("#%ld: 0x%08lx\n",
- i, sysargs[i]);
- }
-
- target_continue_no_signal (ptid);
- goto wait_again;
- }
- break;
- case PR_REQUESTED:
-#if 0 /* FIXME */
+ /* If not in procinfo list, add it. */
+ temp_tid = proc_get_current_thread (pi);
+ if (!find_procinfo (pi->pid, temp_tid))
+ create_procinfo (pi->pid, temp_tid);
+
+ temp_ptid = ptid_t (pi->pid, temp_tid, 0);
+ /* If not in GDB's thread list, add it. */
+ if (!in_thread_list (this, temp_ptid))
+ add_thread (this, temp_ptid);
+
+ target_continue_no_signal (ptid);
+ goto wait_again;
+ }
+ else if (what == SYS_lwp_exit)
+ {
+ if (print_thread_events)
+ gdb_printf (_ ("[%s exited]\n"),
+ target_pid_to_str (retval).c_str ());
+ delete_thread (find_thread_ptid (this, retval));
+ status->set_spurious ();
+ return retval;
+ }
+ else
+ {
+ gdb_printf (_ ("procfs: trapped on exit from "));
+ proc_prettyprint_syscall (proc_what (pi), 0);
+ gdb_printf ("\n");
+
+ long i, nsysargs, *sysargs;
+
+ nsysargs = proc_nsysarg (pi);
+ sysargs = proc_sysargs (pi);
+
+ if (nsysargs > 0 && sysargs != NULL)
+ {
+ gdb_printf (_ ("%ld syscall arguments:\n"),
+ nsysargs);
+ for (i = 0; i < nsysargs; i++)
+ gdb_printf ("#%ld: 0x%08lx\n", i, sysargs[i]);
+ }
+
+ target_continue_no_signal (ptid);
+ goto wait_again;
+ }
+ break;
+ case PR_REQUESTED:
+#if 0 /* FIXME */
wstat = (SIGSTOP << 8) | 0177;
break;
#else
- if (retry < 5)
- {
- gdb_printf (_("Retry #%d:\n"), retry);
- pi->status_valid = 0;
- goto wait_again;
- }
- else
+ if (retry < 5)
+ {
+ gdb_printf (_ ("Retry #%d:\n"), retry);
+ pi->status_valid = 0;
+ goto wait_again;
+ }
+ else
+ {
+ /* If not in procinfo list, add it. */
+ temp_tid = proc_get_current_thread (pi);
+ if (!find_procinfo (pi->pid, temp_tid))
+ create_procinfo (pi->pid, temp_tid);
+
+ /* If not in GDB's thread list, add it. */
+ temp_ptid = ptid_t (pi->pid, temp_tid, 0);
+ if (!in_thread_list (this, temp_ptid))
+ add_thread (this, temp_ptid);
+
+ status->set_stopped (GDB_SIGNAL_0);
+ return retval;
+ }
+#endif
+ case PR_JOBCONTROL:
+ wstat = (what << 8) | 0177;
+ break;
+ case PR_FAULTED:
{
- /* If not in procinfo list, add it. */
- temp_tid = proc_get_current_thread (pi);
- if (!find_procinfo (pi->pid, temp_tid))
- create_procinfo (pi->pid, temp_tid);
-
- /* If not in GDB's thread list, add it. */
- temp_ptid = ptid_t (pi->pid, temp_tid, 0);
- if (!in_thread_list (this, temp_ptid))
- add_thread (this, temp_ptid);
-
- status->set_stopped (GDB_SIGNAL_0);
- return retval;
+ int signo = pi->prstatus.pr_lwp.pr_info.si_signo;
+ if (signo != 0)
+ wstat = (signo << 8) | 0177;
}
-#endif
- case PR_JOBCONTROL:
- wstat = (what << 8) | 0177;
- break;
- case PR_FAULTED:
- {
- int signo = pi->prstatus.pr_lwp.pr_info.si_signo;
- if (signo != 0)
- wstat = (signo << 8) | 0177;
+ break;
+ default: /* switch (why) unmatched */
+ gdb_printf ("procfs:%d -- ", __LINE__);
+ gdb_printf (_ ("child stopped for unknown reason:\n"));
+ proc_prettyprint_why (why, what, 1);
+ error (_ ("... giving up..."));
+ break;
}
- break;
- default: /* switch (why) unmatched */
- gdb_printf ("procfs:%d -- ", __LINE__);
- gdb_printf (_("child stopped for unknown reason:\n"));
- proc_prettyprint_why (why, what, 1);
- error (_("... giving up..."));
- break;
- }
/* Got this far without error: If retval isn't in the
threads database, add it. */
- if (retval.pid () > 0
- && !in_thread_list (this, retval))
+ if (retval.pid () > 0 && !in_thread_list (this, retval))
{
/* We have a new thread. We need to add it both to
GDB's list and to our own. If we don't create a
procinfo, resume may be unhappy later. */
add_thread (this, retval);
- if (find_procinfo (retval.pid (),
- retval.lwp ()) == NULL)
- create_procinfo (retval.pid (),
- retval.lwp ());
+ if (find_procinfo (retval.pid (), retval.lwp ()) == NULL)
+ create_procinfo (retval.pid (), retval.lwp ());
}
}
- else /* Flags do not indicate STOPPED. */
+ else /* Flags do not indicate STOPPED. */
{
/* surely this can't happen... */
- gdb_printf ("procfs:%d -- process not stopped.\n",
- __LINE__);
+ gdb_printf ("procfs:%d -- process not stopped.\n", __LINE__);
proc_prettyprint_flags (flags, 1);
- error (_("procfs: ...giving up..."));
+ error (_ ("procfs: ...giving up..."));
}
}
@@ -2333,10 +2341,10 @@ wait_again:
memory transfers, fall back to the old memory xfer functions. */
enum target_xfer_status
-procfs_target::xfer_partial (enum target_object object,
- const char *annex, gdb_byte *readbuf,
- const gdb_byte *writebuf, ULONGEST offset,
- ULONGEST len, ULONGEST *xfered_len)
+procfs_target::xfer_partial (enum target_object object, const char *annex,
+ gdb_byte *readbuf, const gdb_byte *writebuf,
+ ULONGEST offset, ULONGEST len,
+ ULONGEST *xfered_len)
{
switch (object)
{
@@ -2344,13 +2352,12 @@ procfs_target::xfer_partial (enum target_object object,
return procfs_xfer_memory (readbuf, writebuf, offset, len, xfered_len);
case TARGET_OBJECT_AUXV:
- return memory_xfer_auxv (this, object, annex, readbuf, writebuf,
- offset, len, xfered_len);
+ return memory_xfer_auxv (this, object, annex, readbuf, writebuf, offset,
+ len, xfered_len);
default:
- return this->beneath ()->xfer_partial (object, annex,
- readbuf, writebuf, offset, len,
- xfered_len);
+ return this->beneath ()->xfer_partial (object, annex, readbuf, writebuf,
+ offset, len, xfered_len);
}
}
@@ -2420,9 +2427,9 @@ invalidate_cache (procinfo *parent, procinfo *pi, void *ptr)
close_procinfo_files (pi);
}
- pi->gregs_valid = 0;
- pi->fpregs_valid = 0;
- pi->status_valid = 0;
+ pi->gregs_valid = 0;
+ pi->fpregs_valid = 0;
+ pi->status_valid = 0;
pi->threads_valid = 0;
return 0;
@@ -2486,7 +2493,7 @@ procfs_target::resume (ptid_t ptid, int step, enum gdb_signal signo)
others. Set the child process's PR_ASYNC flag. */
if (!proc_set_async (pi))
proc_error (pi, "target_resume, set_async", __LINE__);
- pi = thread; /* Substitute the thread's procinfo
+ pi = thread; /* Substitute the thread's procinfo
for run. */
}
}
@@ -2495,8 +2502,8 @@ procfs_target::resume (ptid_t ptid, int step, enum gdb_signal signo)
if (!proc_run_process (pi, step, native_signo))
{
if (errno == EBUSY)
- warning (_("resume: target already running. "
- "Pretend to resume, and hope for the best!"));
+ warning (_ ("resume: target already running. "
+ "Pretend to resume, and hope for the best!"));
else
proc_error (pi, "target_resume", __LINE__);
}
@@ -2531,8 +2538,8 @@ procfs_target::files_info ()
{
struct inferior *inf = current_inferior ();
- gdb_printf (_("\tUsing the running image of %s %s via /proc.\n"),
- inf->attach_flag? "attached": "child",
+ gdb_printf (_ ("\tUsing the running image of %s %s via /proc.\n"),
+ inf->attach_flag ? "attached" : "child",
target_pid_to_str (inferior_ptid).c_str ());
}
@@ -2617,7 +2624,7 @@ procfs_target::procfs_init_inferior (int pid)
pi = create_procinfo (pid, 0);
if (pi == NULL)
- perror (_("procfs: out of memory in 'init_inferior'"));
+ perror (_ ("procfs: out of memory in 'init_inferior'"));
if (!open_procinfo_files (pi, FD_CTL))
proc_error (pi, "init_inferior, open_proc_files", __LINE__);
@@ -2639,15 +2646,15 @@ procfs_target::procfs_init_inferior (int pid)
/* Save some of the /proc state to be restored if we detach. */
/* FIXME: Why? In case another debugger was debugging it?
We're it's parent, for Ghu's sake! */
- if (!proc_get_traced_signals (pi, &pi->saved_sigset))
+ if (!proc_get_traced_signals (pi, &pi->saved_sigset))
proc_error (pi, "init_inferior, get_traced_signals", __LINE__);
- if (!proc_get_held_signals (pi, &pi->saved_sighold))
+ if (!proc_get_held_signals (pi, &pi->saved_sighold))
proc_error (pi, "init_inferior, get_held_signals", __LINE__);
- if (!proc_get_traced_faults (pi, &pi->saved_fltset))
+ if (!proc_get_traced_faults (pi, &pi->saved_fltset))
proc_error (pi, "init_inferior, get_traced_faults", __LINE__);
if (!proc_get_traced_sysentry (pi, pi->saved_entryset))
proc_error (pi, "init_inferior, get_traced_sysentry", __LINE__);
- if (!proc_get_traced_sysexit (pi, pi->saved_exitset))
+ if (!proc_get_traced_sysexit (pi, pi->saved_exitset))
proc_error (pi, "init_inferior, get_traced_sysexit", __LINE__);
fail = procfs_debug_inferior (pi);
@@ -2697,7 +2704,7 @@ procfs_set_exec_trap (void)
pi = create_procinfo (getpid (), 0);
if (pi == NULL)
- perror_with_name (_("procfs: create_procinfo failed in child"));
+ perror_with_name (_ ("procfs: create_procinfo failed in child"));
if (open_procinfo_files (pi, FD_CTL) == 0)
{
@@ -2756,8 +2763,8 @@ procfs_pre_trace (void)
void
procfs_target::create_inferior (const char *exec_file,
- const std::string &allargs,
- char **env, int from_tty)
+ const std::string &allargs, char **env,
+ int from_tty)
{
const char *shell_file = get_shell ();
char *tryname;
@@ -2765,7 +2772,6 @@ procfs_target::create_inferior (const char *exec_file,
if (strchr (shell_file, '/') == NULL)
{
-
/* We will be looking down the PATH to find shell_file. If we
just do this the normal way (via execlp, which operates by
attempting an exec for each element of the PATH until it
@@ -2799,7 +2805,7 @@ procfs_target::create_inferior (const char *exec_file,
path = "/bin:/usr/bin";
tryname = (char *) alloca (strlen (path) + strlen (shell_file) + 2);
- for (p = path; p != NULL; p = p1 ? p1 + 1: NULL)
+ for (p = path; p != NULL; p = p1 ? p1 + 1 : NULL)
{
p1 = strchr (p, ':');
if (p1 != NULL)
@@ -2825,8 +2831,8 @@ procfs_target::create_inferior (const char *exec_file,
/* Not found. This must be an error rather than merely passing
the file to execlp(), because execlp() would try all the
exec()s, causing GDB to get confused. */
- error (_("procfs:%d -- Can't find shell %s in PATH"),
- __LINE__, shell_file);
+ error (_ ("procfs:%d -- Can't find shell %s in PATH"), __LINE__,
+ shell_file);
shell_file = tryname;
}
@@ -2835,8 +2841,8 @@ procfs_target::create_inferior (const char *exec_file,
if (!inf->target_is_pushed (this))
inf->push_target (this);
- pid = fork_inferior (exec_file, allargs, env, procfs_set_exec_trap,
- NULL, procfs_pre_trace, shell_file, NULL);
+ pid = fork_inferior (exec_file, allargs, env, procfs_set_exec_trap, NULL,
+ procfs_pre_trace, shell_file, NULL);
/* We have something that executes now. We'll be running through
the shell at this point (if startup-with-shell is true), but the
@@ -2887,8 +2893,8 @@ procfs_target::thread_alive (ptid_t ptid)
int proc, thread;
procinfo *pi;
- proc = ptid.pid ();
- thread = ptid.lwp ();
+ proc = ptid.pid ();
+ thread = ptid.lwp ();
/* If I don't know it, it ain't alive! */
pi = find_procinfo (proc, thread);
if (pi == NULL)
@@ -2952,44 +2958,45 @@ static int
procfs_set_watchpoint (ptid_t ptid, CORE_ADDR addr, int len, int rwflag,
int after)
{
- int pflags = 0;
+ int pflags = 0;
procinfo *pi;
- pi = find_procinfo_or_die (ptid.pid () == -1 ?
- inferior_ptid.pid () : ptid.pid (),
+ pi = find_procinfo_or_die (ptid.pid () == -1 ? inferior_ptid.pid ()
+ : ptid.pid (),
0);
/* Translate from GDB's flags to /proc's. */
- if (len > 0) /* len == 0 means delete watchpoint. */
+ if (len > 0) /* len == 0 means delete watchpoint. */
{
- switch (rwflag) { /* FIXME: need an enum! */
- case hw_write: /* default watchpoint (write) */
- pflags = WA_WRITE;
- break;
- case hw_read: /* read watchpoint */
- pflags = WA_READ;
- break;
- case hw_access: /* access watchpoint */
- pflags = WA_READ | WA_WRITE;
- break;
- case hw_execute: /* execution HW breakpoint */
- pflags = WA_EXEC;
- break;
- default: /* Something weird. Return error. */
- return -1;
- }
- if (after) /* Stop after r/w access is completed. */
+ switch (rwflag)
+ { /* FIXME: need an enum! */
+ case hw_write: /* default watchpoint (write) */
+ pflags = WA_WRITE;
+ break;
+ case hw_read: /* read watchpoint */
+ pflags = WA_READ;
+ break;
+ case hw_access: /* access watchpoint */
+ pflags = WA_READ | WA_WRITE;
+ break;
+ case hw_execute: /* execution HW breakpoint */
+ pflags = WA_EXEC;
+ break;
+ default: /* Something weird. Return error. */
+ return -1;
+ }
+ if (after) /* Stop after r/w access is completed. */
pflags |= WA_TRAPAFTER;
}
if (!proc_set_watchpoint (pi, addr, len, pflags))
{
- if (errno == E2BIG) /* Typical error for no resources. */
- return -1; /* fail */
+ if (errno == E2BIG) /* Typical error for no resources. */
+ return -1; /* fail */
/* GDB may try to remove the same watchpoint twice.
If a remove request returns no match, don't error. */
if (errno == ESRCH && len == 0)
- return 0; /* ignore */
+ return 0; /* ignore */
proc_error (pi, "set_watchpoint", __LINE__);
}
return 0;
@@ -3154,17 +3161,15 @@ iterate_over_mappings (procinfo *pi, find_memory_region_ftype child_func,
Returns the integer value returned by the callback. */
static int
-find_memory_regions_callback (struct prmap *map,
- find_memory_region_ftype func, void *data)
+find_memory_regions_callback (struct prmap *map, find_memory_region_ftype func,
+ void *data)
{
- return (*func) ((CORE_ADDR) map->pr_vaddr,
- map->pr_size,
+ return (*func) ((CORE_ADDR) map->pr_vaddr, map->pr_size,
(map->pr_mflags & MA_READ) != 0,
(map->pr_mflags & MA_WRITE) != 0,
(map->pr_mflags & MA_EXEC) != 0,
1, /* MODIFIED is unknown, pass it as true. */
- false,
- data);
+ false, data);
}
/* External interface. Calls a callback function once for each
@@ -3184,8 +3189,7 @@ procfs_target::find_memory_regions (find_memory_region_ftype func, void *data)
{
procinfo *pi = find_procinfo_or_die (inferior_ptid.pid (), 0);
- return iterate_over_mappings (pi, func, data,
- find_memory_regions_callback);
+ return iterate_over_mappings (pi, func, data, find_memory_regions_callback);
}
/* Returns an ascii representation of a memory mapping's flags. */
@@ -3226,15 +3230,13 @@ info_mappings_callback (struct prmap *map, find_memory_region_ftype ignore,
gdb_printf ("\t%#10lx %#10lx %#10lx %#10x %7s\n",
(unsigned long) map->pr_vaddr,
(unsigned long) map->pr_vaddr + map->pr_size - 1,
- (unsigned long) map->pr_size,
- pr_off,
+ (unsigned long) map->pr_size, pr_off,
mappingflags (map->pr_mflags));
else
gdb_printf (" %#18lx %#18lx %#10lx %#10x %7s\n",
(unsigned long) map->pr_vaddr,
(unsigned long) map->pr_vaddr + map->pr_size - 1,
- (unsigned long) map->pr_size,
- pr_off,
+ (unsigned long) map->pr_size, pr_off,
mappingflags (map->pr_mflags));
return 0;
@@ -3246,23 +3248,15 @@ static void
info_proc_mappings (procinfo *pi, int summary)
{
if (summary)
- return; /* No output for summary mode. */
+ return; /* No output for summary mode. */
- gdb_printf (_("Mapped address spaces:\n\n"));
+ gdb_printf (_ ("Mapped address spaces:\n\n"));
if (gdbarch_ptr_bit (target_gdbarch ()) == 32)
- gdb_printf ("\t%10s %10s %10s %10s %7s\n",
- "Start Addr",
- " End Addr",
- " Size",
- " Offset",
- "Flags");
+ gdb_printf ("\t%10s %10s %10s %10s %7s\n", "Start Addr", " End Addr",
+ " Size", " Offset", "Flags");
else
- gdb_printf (" %18s %18s %10s %10s %7s\n",
- "Start Addr",
- " End Addr",
- " Size",
- " Offset",
- "Flags");
+ gdb_printf (" %18s %18s %10s %10s %7s\n", "Start Addr", " End Addr",
+ " Size", " Offset", "Flags");
iterate_over_mappings (pi, NULL, NULL, info_mappings_callback);
gdb_printf ("\n");
@@ -3273,12 +3267,12 @@ info_proc_mappings (procinfo *pi, int summary)
bool
procfs_target::info_proc (const char *args, enum info_proc_what what)
{
- procinfo *process = NULL;
- procinfo *thread = NULL;
- char *tmp = NULL;
- int pid = 0;
- int tid = 0;
- int mappings = 0;
+ procinfo *process = NULL;
+ procinfo *thread = NULL;
+ char *tmp = NULL;
+ int pid = 0;
+ int tid = 0;
+ int mappings = 0;
switch (what)
{
@@ -3291,7 +3285,7 @@ procfs_target::info_proc (const char *args, enum info_proc_what what)
break;
default:
- error (_("Not supported on this target."));
+ error (_ ("Not supported on this target."));
}
gdb_argv built_argv (args);
@@ -3313,38 +3307,37 @@ procfs_target::info_proc (const char *args, enum info_proc_what what)
if (pid == 0)
pid = inferior_ptid.pid ();
if (pid == 0)
- error (_("No current process: you must name one."));
+ error (_ ("No current process: you must name one."));
else
{
/* Have pid, will travel.
First see if it's a process we're already debugging. */
process = find_procinfo (pid, 0);
- if (process == NULL)
- {
- /* No. So open a procinfo for it, but
+ if (process == NULL)
+ {
+ /* No. So open a procinfo for it, but
remember to close it again when finished. */
- process = create_procinfo (pid, 0);
- temporary_procinfo.reset (process);
- if (!open_procinfo_files (process, FD_CTL))
- proc_error (process, "info proc, open_procinfo_files", __LINE__);
- }
+ process = create_procinfo (pid, 0);
+ temporary_procinfo.reset (process);
+ if (!open_procinfo_files (process, FD_CTL))
+ proc_error (process, "info proc, open_procinfo_files", __LINE__);
+ }
}
if (tid != 0)
thread = create_procinfo (pid, tid);
if (process)
{
- gdb_printf (_("process %d flags:\n"), process->pid);
+ gdb_printf (_ ("process %d flags:\n"), process->pid);
proc_prettyprint_flags (proc_flags (process), 1);
if (proc_flags (process) & (PR_STOPPED | PR_ISTOP))
proc_prettyprint_why (proc_why (process), proc_what (process), 1);
if (proc_get_nthreads (process) > 1)
- gdb_printf ("Process has %d threads.\n",
- proc_get_nthreads (process));
+ gdb_printf ("Process has %d threads.\n", proc_get_nthreads (process));
}
if (thread)
{
- gdb_printf (_("thread %d flags:\n"), thread->tid);
+ gdb_printf (_ ("thread %d flags:\n"), thread->tid);
proc_prettyprint_flags (proc_flags (thread), 1);
if (proc_flags (thread) & (PR_STOPPED | PR_ISTOP))
proc_prettyprint_why (proc_why (thread), proc_what (thread), 1);
@@ -3397,15 +3390,16 @@ proc_trace_syscalls_1 (procinfo *pi, int syscallnum, int entry_or_exit,
}
static void
-proc_trace_syscalls (const char *args, int from_tty, int entry_or_exit, int mode)
+proc_trace_syscalls (const char *args, int from_tty, int entry_or_exit,
+ int mode)
{
procinfo *pi;
if (inferior_ptid.pid () <= 0)
- error (_("you must be debugging a process to use this command."));
+ error (_ ("you must be debugging a process to use this command."));
if (args == NULL || args[0] == 0)
- error_no_arg (_("system call to trace"));
+ error_no_arg (_ ("system call to trace"));
pi = find_procinfo_or_die (inferior_ptid.pid (), 0);
if (isdigit (args[0]))
@@ -3441,25 +3435,24 @@ proc_untrace_sysexit_cmd (const char *args, int from_tty)
}
void _initialize_procfs ();
+
void
_initialize_procfs ()
{
add_com ("proc-trace-entry", no_class, proc_trace_sysentry_cmd,
- _("Give a trace of entries into the syscall."));
+ _ ("Give a trace of entries into the syscall."));
add_com ("proc-trace-exit", no_class, proc_trace_sysexit_cmd,
- _("Give a trace of exits from the syscall."));
+ _ ("Give a trace of exits from the syscall."));
add_com ("proc-untrace-entry", no_class, proc_untrace_sysentry_cmd,
- _("Cancel a trace of entries into the syscall."));
+ _ ("Cancel a trace of entries into the syscall."));
add_com ("proc-untrace-exit", no_class, proc_untrace_sysexit_cmd,
- _("Cancel a trace of exits from the syscall."));
+ _ ("Cancel a trace of exits from the syscall."));
add_inf_child_target (&the_procfs_target);
}
/* =================== END, GDB "MODULE" =================== */
-
-
/* miscellaneous stubs: */
/* The following satisfy a few random symbols mostly created by the
@@ -3496,17 +3489,12 @@ procfs_do_thread_registers (bfd *obfd, ptid_t ptid,
target_fetch_registers (regcache, -1);
fill_gregset (regcache, &gregs, -1);
- note_data.reset (elfcore_write_lwpstatus (obfd,
- note_data.release (),
- note_size,
- merged_pid,
- stop_signal,
+ note_data.reset (elfcore_write_lwpstatus (obfd, note_data.release (),
+ note_size, merged_pid, stop_signal,
&gregs));
fill_fpregset (regcache, &fpregs, -1);
- note_data.reset (elfcore_write_prfpreg (obfd,
- note_data.release (),
- note_size,
- &fpregs,
+ note_data.reset (elfcore_write_prfpreg (obfd, note_data.release (),
+ note_size, &fpregs,
sizeof (fpregs)));
}
@@ -3515,9 +3503,12 @@ struct procfs_corefile_thread_data
procfs_corefile_thread_data (bfd *obfd,
gdb::unique_xmalloc_ptr<char> &note_data,
int *note_size, gdb_signal stop_signal)
- : obfd (obfd), note_data (note_data), note_size (note_size),
+ : obfd (obfd),
+ note_data (note_data),
+ note_size (note_size),
stop_signal (stop_signal)
- {}
+ {
+ }
bfd *obfd;
gdb::unique_xmalloc_ptr<char> &note_data;
@@ -3535,10 +3526,8 @@ procfs_corefile_thread_callback (procinfo *pi, procinfo *thread, void *data)
{
ptid_t ptid = ptid_t (pi->pid, thread->tid, 0);
- procfs_do_thread_registers (args->obfd, ptid,
- args->note_data,
- args->note_size,
- args->stop_signal);
+ procfs_do_thread_registers (args->obfd, ptid, args->note_data,
+ args->note_size, args->stop_signal);
}
return 0;
}
@@ -3556,8 +3545,8 @@ find_signalled_thread (struct thread_info *info, void *data)
static enum gdb_signal
find_stop_signal (void)
{
- struct thread_info *info =
- iterate_over_threads (find_signalled_thread, NULL);
+ struct thread_info *info
+ = iterate_over_threads (find_signalled_thread, NULL);
if (info)
return info->stop_signal ();
@@ -3569,8 +3558,8 @@ gdb::unique_xmalloc_ptr<char>
procfs_target::make_corefile_notes (bfd *obfd, int *note_size)
{
gdb_gregset_t gregs;
- char fname[16] = {'\0'};
- char psargs[80] = {'\0'};
+ char fname[16] = { '\0' };
+ char psargs[80] = { '\0' };
procinfo *pi = find_procinfo_or_die (inferior_ptid.pid (), 0);
gdb::unique_xmalloc_ptr<char> note_data;
enum gdb_signal stop_signal;
@@ -3583,27 +3572,24 @@ procfs_target::make_corefile_notes (bfd *obfd, int *note_size)
psargs[sizeof (psargs) - 1] = 0;
const std::string &inf_args = current_inferior ()->args ();
- if (!inf_args.empty () &&
- inf_args.length () < ((int) sizeof (psargs) - (int) strlen (psargs)))
+ if (!inf_args.empty ()
+ && inf_args.length ()
+ < ((int) sizeof (psargs) - (int) strlen (psargs)))
{
- strncat (psargs, " ",
- sizeof (psargs) - strlen (psargs));
+ strncat (psargs, " ", sizeof (psargs) - strlen (psargs));
strncat (psargs, inf_args.c_str (),
sizeof (psargs) - strlen (psargs));
}
}
- note_data.reset (elfcore_write_prpsinfo (obfd,
- note_data.release (),
- note_size,
- fname,
- psargs));
+ note_data.reset (elfcore_write_prpsinfo (obfd, note_data.release (),
+ note_size, fname, psargs));
stop_signal = find_stop_signal ();
fill_gregset (get_current_regcache (), &gregs, -1);
- note_data.reset (elfcore_write_pstatus (obfd, note_data.release (), note_size,
- inferior_ptid.pid (),
+ note_data.reset (elfcore_write_pstatus (obfd, note_data.release (),
+ note_size, inferior_ptid.pid (),
stop_signal, &gregs));
procfs_corefile_thread_data thread_args (obfd, note_data, note_size,
@@ -3611,9 +3597,9 @@ procfs_target::make_corefile_notes (bfd *obfd, int *note_size)
proc_iterate_over_threads (pi, procfs_corefile_thread_callback,
&thread_args);
- gdb::optional<gdb::byte_vector> auxv =
- target_read_alloc (current_inferior ()->top_target (),
- TARGET_OBJECT_AUXV, NULL);
+ gdb::optional<gdb::byte_vector> auxv
+ = target_read_alloc (current_inferior ()->top_target (),
+ TARGET_OBJECT_AUXV, NULL);
if (auxv && !auxv->empty ())
note_data.reset (elfcore_write_note (obfd, note_data.release (), note_size,
"CORE", NT_AUXV, auxv->data (),
@@ -3621,4 +3607,5 @@ procfs_target::make_corefile_notes (bfd *obfd, int *note_size)
return note_data;
}
+
/* =================== END GCORE .NOTE "MODULE" =================== */
diff --git a/gdb/producer.c b/gdb/producer.c
index 655eb971283..fd4a2a484bc 100644
--- a/gdb/producer.c
+++ b/gdb/producer.c
@@ -29,7 +29,7 @@ producer_is_gcc_ge_4 (const char *producer)
{
int major, minor;
- if (! producer_is_gcc (producer, &major, &minor))
+ if (!producer_is_gcc (producer, &major, &minor))
return -1;
if (major < 4)
return -1;
@@ -80,7 +80,7 @@ producer_is_icc_ge_19 (const char *producer)
{
int major, minor;
- if (! producer_is_icc (producer, &major, &minor))
+ if (!producer_is_icc (producer, &major, &minor))
return false;
return major >= 19;
@@ -123,8 +123,9 @@ producer_is_icc (const char *producer, int *major, int *minor)
bool
producer_is_llvm (const char *producer)
{
- return ((producer != NULL) && (startswith (producer, "clang ")
- || startswith (producer, " F90 Flang ")));
+ return ((producer != NULL)
+ && (startswith (producer, "clang ")
+ || startswith (producer, " F90 Flang ")));
}
/* See producer.h. */
@@ -152,8 +153,10 @@ producer_is_clang (const char *producer, int *major, int *minor)
}
#if defined GDB_SELF_TEST
-namespace selftests {
-namespace producer {
+namespace selftests
+{
+namespace producer
+{
static void
producer_parsing_tests ()
@@ -175,8 +178,8 @@ Intel(R) 64, \
Version 14.0.1.074 Build 20130716";
int major = 0, minor = 0;
- SELF_CHECK (producer_is_icc (extern_f_14_0, &major, &minor)
- && major == 14 && minor == 0);
+ SELF_CHECK (producer_is_icc (extern_f_14_0, &major, &minor) && major == 14
+ && minor == 0);
SELF_CHECK (!producer_is_gcc (extern_f_14_0, &major, &minor));
}
@@ -187,8 +190,8 @@ Intel(R) 64, \
Version 14.0";
int major = 0, minor = 0;
- SELF_CHECK (producer_is_icc (intern_f_14, &major, &minor)
- && major == 14 && minor == 0);
+ SELF_CHECK (producer_is_icc (intern_f_14, &major, &minor) && major == 14
+ && minor == 0);
SELF_CHECK (!producer_is_gcc (intern_f_14, &major, &minor));
}
@@ -198,8 +201,8 @@ Intel(R) C++ Intel(R) 64 Compiler XE for applications running on \
Intel(R) 64, \
Version 14.0";
int major = 0, minor = 0;
- SELF_CHECK (producer_is_icc (intern_c_14, &major, &minor)
- && major == 14 && minor == 0);
+ SELF_CHECK (producer_is_icc (intern_c_14, &major, &minor) && major == 14
+ && minor == 0);
SELF_CHECK (!producer_is_gcc (intern_c_14, &major, &minor));
}
@@ -209,8 +212,8 @@ Intel(R) C++ Intel(R) 64 Compiler for applications running on \
Intel(R) 64, \
Version 18.0 Beta";
int major = 0, minor = 0;
- SELF_CHECK (producer_is_icc (intern_c_18, &major, &minor)
- && major == 18 && minor == 0);
+ SELF_CHECK (producer_is_icc (intern_c_18, &major, &minor) && major == 18
+ && minor == 0);
}
{
@@ -218,16 +221,16 @@ Version 18.0 Beta";
SELF_CHECK (!producer_is_icc (gnu, NULL, NULL));
int major = 0, minor = 0;
- SELF_CHECK (producer_is_gcc (gnu, &major, &minor)
- && major == 4 && minor == 7);
+ SELF_CHECK (producer_is_gcc (gnu, &major, &minor) && major == 4
+ && minor == 7);
}
{
static const char gnu_exp[] = "GNU C++14 5.0.0 20150123 (experimental)";
int major = 0, minor = 0;
SELF_CHECK (!producer_is_icc (gnu_exp, NULL, NULL));
- SELF_CHECK (producer_is_gcc (gnu_exp, &major, &minor)
- && major == 5 && minor == 0);
+ SELF_CHECK (producer_is_gcc (gnu_exp, &major, &minor) && major == 5
+ && minor == 0);
}
{
@@ -246,16 +249,17 @@ Version 18.0 Beta";
SELF_CHECK (producer_is_llvm (flang_llvm_exp));
}
}
-}
-}
+} // namespace producer
+} // namespace selftests
#endif
void _initialize_producer ();
+
void
_initialize_producer ()
{
#if defined GDB_SELF_TEST
- selftests::register_test
- ("producer-parser", selftests::producer::producer_parsing_tests);
+ selftests::register_test ("producer-parser",
+ selftests::producer::producer_parsing_tests);
#endif
}
diff --git a/gdb/progspace-and-thread.h b/gdb/progspace-and-thread.h
index 1f8e44fb3d6..f126735a0b9 100644
--- a/gdb/progspace-and-thread.h
+++ b/gdb/progspace-and-thread.h
@@ -15,7 +15,6 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
-
#ifndef PROGSPACE_AND_THREAD_H
#define PROGSPACE_AND_THREAD_H
diff --git a/gdb/progspace.c b/gdb/progspace.c
index 32bdfebcf7c..60e643a5897 100644
--- a/gdb/progspace.c
+++ b/gdb/progspace.c
@@ -41,8 +41,6 @@ struct program_space *current_program_space;
/* The last address space number assigned. */
static int highest_address_space_num;
-
-
/* Create a new address space object, and add it to the list. */
address_space::address_space ()
@@ -76,8 +74,6 @@ init_address_spaces (void)
highest_address_space_num = 0;
}
-
-
/* Remove a program space from the program spaces list. */
static void
@@ -85,8 +81,8 @@ remove_program_space (program_space *pspace)
{
gdb_assert (pspace != NULL);
- auto iter = std::find (program_spaces.begin (), program_spaces.end (),
- pspace);
+ auto iter
+ = std::find (program_spaces.begin (), program_spaces.end (), pspace);
gdb_assert (iter != program_spaces.end ());
program_spaces.erase (iter);
}
@@ -146,10 +142,9 @@ program_space::add_objfile (std::unique_ptr<objfile> &&objfile,
else
{
auto iter = std::find_if (objfiles_list.begin (), objfiles_list.end (),
- [=] (const std::unique_ptr<::objfile> &objf)
- {
- return objf.get () == before;
- });
+ [=] (const std::unique_ptr<::objfile> &objf) {
+ return objf.get () == before;
+ });
gdb_assert (iter != objfiles_list.end ());
objfiles_list.insert (iter, std::move (objfile));
}
@@ -167,10 +162,9 @@ program_space::remove_objfile (struct objfile *objfile)
reinit_frame_cache ();
auto iter = std::find_if (objfiles_list.begin (), objfiles_list.end (),
- [=] (const std::unique_ptr<::objfile> &objf)
- {
- return objf.get () == objfile;
- });
+ [=] (const std::unique_ptr<::objfile> &objf) {
+ return objf.get () == objfile;
+ });
gdb_assert (iter != objfiles_list.end ());
objfiles_list.erase (iter);
@@ -324,13 +318,11 @@ print_program_space (struct ui_out *uiout, int requested)
if (!printed_header)
{
printed_header = 1;
- gdb_printf ("\n\tBound inferiors: ID %d (%s)",
- inf->num,
+ gdb_printf ("\n\tBound inferiors: ID %d (%s)", inf->num,
target_pid_to_str (ptid_t (inf->pid)).c_str ());
}
else
- gdb_printf (", ID %d (%s)",
- inf->num,
+ gdb_printf (", ID %d (%s)", inf->num,
target_pid_to_str (ptid_t (inf->pid)).c_str ());
}
@@ -363,7 +355,7 @@ maintenance_info_program_spaces_command (const char *args, int from_tty)
{
requested = parse_and_eval_long (args);
if (!valid_program_space_id (requested))
- error (_("program space ID %d not known."), requested);
+ error (_ ("program space ID %d not known."), requested);
}
print_program_space (current_uiout, requested);
@@ -409,8 +401,6 @@ update_address_spaces (void)
inf->aspace = inf->pspace->aspace;
}
-
-
/* See progspace.h. */
void
@@ -420,14 +410,12 @@ program_space::clear_solib_cache ()
deleted_solibs.clear ();
}
-
-
void
initialize_progspace (void)
{
add_cmd ("program-spaces", class_maintenance,
maintenance_info_program_spaces_command,
- _("Info about currently known program spaces."),
+ _ ("Info about currently known program spaces."),
&maintenanceinfolist);
/* There's always one program space. Note that this function isn't
diff --git a/gdb/progspace.h b/gdb/progspace.h
index 85215f0e2f1..e8e7b3a3e39 100644
--- a/gdb/progspace.h
+++ b/gdb/progspace.h
@@ -17,7 +17,6 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
-
#ifndef PROGSPACE_H
#define PROGSPACE_H
@@ -64,10 +63,7 @@ public:
{
}
- objfile *operator* () const
- {
- return m_iter->get ();
- }
+ objfile *operator* () const { return m_iter->get (); }
unwrapping_objfile_iterator operator++ ()
{
@@ -86,7 +82,6 @@ private:
objfile_list::iterator m_iter;
};
-
/* A range that returns unwrapping_objfile_iterators. */
using unwrapping_objfile_range = iterator_range<unwrapping_objfile_iterator>;
@@ -208,9 +203,9 @@ struct program_space
for (objfile *objf : pspace->objfiles ()) { ... } */
objfiles_range objfiles ()
{
- return objfiles_range
- (unwrapping_objfile_iterator (objfiles_list.begin ()),
- unwrapping_objfile_iterator (objfiles_list.end ()));
+ return objfiles_range (
+ unwrapping_objfile_iterator (objfiles_list.begin ()),
+ unwrapping_objfile_iterator (objfiles_list.end ()));
}
using objfiles_safe_range = basic_safe_range<objfiles_range>;
@@ -224,10 +219,9 @@ struct program_space
deleted during iteration. */
objfiles_safe_range objfiles_safe ()
{
- return objfiles_safe_range
- (objfiles_range
- (unwrapping_objfile_iterator (objfiles_list.begin ()),
- unwrapping_objfile_iterator (objfiles_list.end ())));
+ return objfiles_safe_range (
+ objfiles_range (unwrapping_objfile_iterator (objfiles_list.begin ()),
+ unwrapping_objfile_iterator (objfiles_list.end ())));
}
/* Add OBJFILE to the list of objfiles, putting it just before
@@ -241,10 +235,7 @@ struct program_space
/* Return true if there is more than one object file loaded; false
otherwise. */
- bool multi_objfile_p () const
- {
- return objfiles_list.size () > 1;
- }
+ bool multi_objfile_p () const { return objfiles_list.size () > 1; }
/* Free all the objfiles associated with this program space. */
void free_all_objfiles ();
@@ -253,24 +244,17 @@ struct program_space
program space. Use it like:
for (so_list *so : pspace->solibs ()) { ... } */
- so_list_range solibs () const
- { return so_list_range (this->so_list); }
+ so_list_range solibs () const { return so_list_range (this->so_list); }
/* Close and clear exec_bfd. If we end up with no target sections
to read memory from, this unpushes the exec_ops target. */
void exec_close ();
/* Return the exec BFD for this program space. */
- bfd *exec_bfd () const
- {
- return ebfd.get ();
- }
+ bfd *exec_bfd () const { return ebfd.get (); }
/* Set the exec BFD for this program space to ABFD. */
- void set_exec_bfd (gdb_bfd_ref_ptr &&abfd)
- {
- ebfd = std::move (abfd);
- }
+ void set_exec_bfd (gdb_bfd_ref_ptr &&abfd) { ebfd = std::move (abfd); }
/* Reset saved solib data at the start of an solib event. This lets
us properly collect the data when calling solib_add, so it can then
@@ -286,24 +270,17 @@ struct program_space
/* Add the sections array defined by SECTIONS to the
current set of target sections. */
- void add_target_sections (void *owner,
- const target_section_table &sections);
+ void add_target_sections (void *owner, const target_section_table &sections);
/* Add the sections of OBJFILE to the current set of target
sections. They are given OBJFILE as the "owner". */
void add_target_sections (struct objfile *objfile);
/* Clear all target sections from M_TARGET_SECTIONS table. */
- void clear_target_sections ()
- {
- m_target_sections.clear ();
- }
+ void clear_target_sections () { m_target_sections.clear (); }
/* Return a reference to the M_TARGET_SECTIONS table. */
- target_section_table &target_sections ()
- {
- return m_target_sections;
- }
+ target_section_table &target_sections () { return m_target_sections; }
/* Unique ID number. */
int num = 0;
@@ -374,6 +351,7 @@ struct program_space
registry<program_space> registry_fields;
private:
+
/* The set of target sections matching the sections mapped into
this program space. Managed by both exec_ops and solib.c. */
target_section_table m_target_sections;
@@ -389,20 +367,18 @@ struct address_space
DISABLE_COPY_AND_ASSIGN (address_space);
/* Returns the integer address space id of this address space. */
- int num () const
- {
- return m_num;
- }
+ int num () const { return m_num; }
/* Per aspace data-pointers required by other GDB modules. */
registry<address_space> registry_fields;
private:
+
int m_num;
};
/* The list of all program spaces. There's always at least one. */
-extern std::vector<struct program_space *>program_spaces;
+extern std::vector<struct program_space *> program_spaces;
/* The current program space. This is always non-null. */
extern struct program_space *current_program_space;
@@ -410,7 +386,7 @@ extern struct program_space *current_program_space;
/* Copies program space SRC to DEST. Copies the main executable file,
and the main symbol file. Returns DEST. */
extern struct program_space *clone_program_space (struct program_space *dest,
- struct program_space *src);
+ struct program_space *src);
/* Sets PSPACE as the current program space. This is usually used
instead of set_current_space_and_thread when the current
@@ -427,16 +403,21 @@ extern void set_current_program_space (struct program_space *pspace);
class scoped_restore_current_program_space
{
public:
+
scoped_restore_current_program_space ()
: m_saved_pspace (current_program_space)
- {}
+ {
+ }
~scoped_restore_current_program_space ()
- { set_current_program_space (m_saved_pspace); }
+ {
+ set_current_program_space (m_saved_pspace);
+ }
DISABLE_COPY_AND_ASSIGN (scoped_restore_current_program_space);
private:
+
program_space *m_saved_pspace;
};
diff --git a/gdb/prologue-value.c b/gdb/prologue-value.c
index 13bf4362069..d250331f529 100644
--- a/gdb/prologue-value.c
+++ b/gdb/prologue-value.c
@@ -20,7 +20,6 @@
#include "prologue-value.h"
#include "regcache.h"
-
/* Constructors. */
pv_t
@@ -31,20 +30,18 @@ pv_unknown (void)
return v;
}
-
pv_t
pv_constant (CORE_ADDR k)
{
pv_t v;
v.kind = pvk_constant;
- v.reg = -1; /* for debugging */
+ v.reg = -1; /* for debugging */
v.k = k;
return v;
}
-
pv_t
pv_register (int reg, CORE_ADDR k)
{
@@ -57,8 +54,6 @@ pv_register (int reg, CORE_ADDR k)
return v;
}
-
-
/* Arithmetic operations. */
/* If one of *A and *B is a constant, and the other isn't, swap the
@@ -68,8 +63,7 @@ pv_register (int reg, CORE_ADDR k)
static void
constant_last (pv_t *a, pv_t *b)
{
- if (a->kind == pvk_constant
- && b->kind != pvk_constant)
+ if (a->kind == pvk_constant && b->kind != pvk_constant)
{
pv_t temp = *a;
*a = *b;
@@ -77,20 +71,17 @@ constant_last (pv_t *a, pv_t *b)
}
}
-
pv_t
pv_add (pv_t a, pv_t b)
{
constant_last (&a, &b);
/* We can add a constant to a register. */
- if (a.kind == pvk_register
- && b.kind == pvk_constant)
+ if (a.kind == pvk_register && b.kind == pvk_constant)
return pv_register (a.reg, a.k + b.k);
/* We can add a constant to another constant. */
- else if (a.kind == pvk_constant
- && b.kind == pvk_constant)
+ else if (a.kind == pvk_constant && b.kind == pvk_constant)
return pv_constant (a.k + b.k);
/* Anything else we don't know how to add. We don't have a
@@ -100,7 +91,6 @@ pv_add (pv_t a, pv_t b)
return pv_unknown ();
}
-
pv_t
pv_add_constant (pv_t v, CORE_ADDR k)
{
@@ -109,7 +99,6 @@ pv_add_constant (pv_t v, CORE_ADDR k)
return pv_add (v, pv_constant (k));
}
-
pv_t
pv_subtract (pv_t a, pv_t b)
{
@@ -128,19 +117,15 @@ pv_subtract (pv_t a, pv_t b)
constant_last (&a, &b);
/* We can subtract two constants. */
- if (a.kind == pvk_constant
- && b.kind == pvk_constant)
+ if (a.kind == pvk_constant && b.kind == pvk_constant)
return pv_constant (a.k - b.k);
/* We can subtract a constant from a register. */
- else if (a.kind == pvk_register
- && b.kind == pvk_constant)
+ else if (a.kind == pvk_register && b.kind == pvk_constant)
return pv_register (a.reg, a.k - b.k);
/* We can subtract a register from itself, yielding a constant. */
- else if (a.kind == pvk_register
- && b.kind == pvk_register
- && a.reg == b.reg)
+ else if (a.kind == pvk_register && b.kind == pvk_register && a.reg == b.reg)
return pv_constant (a.k - b.k);
/* We don't know how to subtract anything else. */
@@ -148,31 +133,25 @@ pv_subtract (pv_t a, pv_t b)
return pv_unknown ();
}
-
pv_t
pv_logical_and (pv_t a, pv_t b)
{
constant_last (&a, &b);
/* We can 'and' two constants. */
- if (a.kind == pvk_constant
- && b.kind == pvk_constant)
+ if (a.kind == pvk_constant && b.kind == pvk_constant)
return pv_constant (a.k & b.k);
/* We can 'and' anything with the constant zero. */
- else if (b.kind == pvk_constant
- && b.k == 0)
+ else if (b.kind == pvk_constant && b.k == 0)
return pv_constant (0);
/* We can 'and' anything with ~0. */
- else if (b.kind == pvk_constant
- && b.k == ~ (CORE_ADDR) 0)
+ else if (b.kind == pvk_constant && b.k == ~(CORE_ADDR) 0)
return a;
/* We can 'and' a register with itself. */
- else if (a.kind == pvk_register
- && b.kind == pvk_register
- && a.reg == b.reg
+ else if (a.kind == pvk_register && b.kind == pvk_register && a.reg == b.reg
&& a.k == b.k)
return a;
@@ -181,8 +160,6 @@ pv_logical_and (pv_t a, pv_t b)
return pv_unknown ();
}
-
-
/* Examining prologue values. */
int
@@ -204,36 +181,27 @@ pv_is_identical (pv_t a, pv_t b)
}
}
-
int
pv_is_constant (pv_t a)
{
return (a.kind == pvk_constant);
}
-
int
pv_is_register (pv_t a, int r)
{
- return (a.kind == pvk_register
- && a.reg == r);
+ return (a.kind == pvk_register && a.reg == r);
}
-
int
pv_is_register_k (pv_t a, int r, CORE_ADDR k)
{
- return (a.kind == pvk_register
- && a.reg == r
- && a.k == k);
+ return (a.kind == pvk_register && a.reg == r && a.k == k);
}
-
enum pv_boolean
-pv_is_array_ref (pv_t addr, CORE_ADDR size,
- pv_t array_addr, CORE_ADDR array_len,
- CORE_ADDR elt_size,
- int *i)
+pv_is_array_ref (pv_t addr, CORE_ADDR size, pv_t array_addr,
+ CORE_ADDR array_len, CORE_ADDR elt_size, int *i)
{
/* Note that, since .k is a CORE_ADDR, and CORE_ADDR is unsigned, if
addr is *before* the start of the array, then this isn't going to
@@ -248,11 +216,9 @@ pv_is_array_ref (pv_t addr, CORE_ADDR size,
completely after". But with unsigned arithmetic, things are
different: since it's a number circle, not a number line, the
right values for offset.k are actually one contiguous range. */
- if (offset.k <= -size
- && offset.k >= array_len * elt_size)
+ if (offset.k <= -size && offset.k >= array_len * elt_size)
return pv_definite_no;
- else if (offset.k % elt_size != 0
- || size != elt_size)
+ else if (offset.k % elt_size != 0 || size != elt_size)
return pv_maybe;
else
{
@@ -264,11 +230,8 @@ pv_is_array_ref (pv_t addr, CORE_ADDR size,
return pv_maybe;
}
-
-
/* Areas. */
-
/* A particular value known to be stored in an area.
Entries form a ring, sorted by unsigned offset from the area's base
@@ -295,7 +258,6 @@ struct pv_area::area_entry
pv_t value;
};
-
/* See prologue-value.h. */
pv_area::pv_area (int base_reg, int addr_bit)
@@ -332,13 +294,11 @@ pv_area::clear_entries ()
}
}
-
pv_area::~pv_area ()
{
clear_entries ();
}
-
/* See prologue-value.h. */
bool
@@ -349,12 +309,10 @@ pv_area::store_would_trash (pv_t addr)
pv_areas are always relative to a register, and we don't know the
value of the register, so we can't compare entry addresses to
constants. */
- return (addr.kind == pvk_unknown
- || addr.kind == pvk_constant
+ return (addr.kind == pvk_unknown || addr.kind == pvk_constant
|| (addr.kind == pvk_register && addr.reg != m_base_reg));
}
-
/* See prologue-value.h. */
struct pv_area::area_entry *
@@ -362,7 +320,7 @@ pv_area::find_entry (CORE_ADDR offset)
{
struct area_entry *e = m_entry;
- if (! e)
+ if (!e)
return 0;
/* If the next entry would be better than the current one, then scan
@@ -391,7 +349,6 @@ pv_area::find_entry (CORE_ADDR offset)
return e;
}
-
/* See prologue-value.h. */
int
@@ -402,7 +359,6 @@ pv_area::overlaps (struct area_entry *entry, CORE_ADDR offset, CORE_ADDR size)
|| ((offset - entry->offset) & m_addr_mask) < entry->size);
}
-
/* See prologue-value.h. */
void
@@ -464,7 +420,6 @@ pv_area::store (pv_t addr, CORE_ADDR size, pv_t value)
}
}
-
/* See prologue-value.h. */
pv_t
@@ -472,8 +427,7 @@ pv_area::fetch (pv_t addr, CORE_ADDR size)
{
/* If we have no entries, or we can't decide how ADDR relates to the
entries we do have, then the value is unknown. */
- if (! m_entry
- || store_would_trash (addr))
+ if (!m_entry || store_would_trash (addr))
return pv_unknown ();
else
{
@@ -489,7 +443,6 @@ pv_area::fetch (pv_t addr, CORE_ADDR size)
}
}
-
/* See prologue-value.h. */
bool
@@ -500,10 +453,8 @@ pv_area::find_reg (struct gdbarch *gdbarch, int reg, CORE_ADDR *offset_p)
if (e)
do
{
- if (e->value.kind == pvk_register
- && e->value.reg == reg
- && e->value.k == 0
- && e->size == register_size (gdbarch, reg))
+ if (e->value.kind == pvk_register && e->value.reg == reg
+ && e->value.k == 0 && e->size == register_size (gdbarch, reg))
{
if (offset_p)
*offset_p = e->offset;
@@ -517,13 +468,10 @@ pv_area::find_reg (struct gdbarch *gdbarch, int reg, CORE_ADDR *offset_p)
return false;
}
-
/* See prologue-value.h. */
void
-pv_area::scan (void (*func) (void *closure,
- pv_t addr,
- CORE_ADDR size,
+pv_area::scan (void (*func) (void *closure, pv_t addr, CORE_ADDR size,
pv_t value),
void *closure)
{
diff --git a/gdb/prologue-value.h b/gdb/prologue-value.h
index 75c0d2e80f9..bf735c71bd1 100644
--- a/gdb/prologue-value.h
+++ b/gdb/prologue-value.h
@@ -137,8 +137,8 @@ enum prologue_value_kind
A 'struct prologue_value' is a conservative approximation of the
real value the register or stack slot will have. */
-struct prologue_value {
-
+struct prologue_value
+{
/* What sort of value is this? This determines the interpretation
of subsequent fields. */
enum prologue_value_kind kind;
@@ -151,7 +151,6 @@ struct prologue_value {
typedef struct prologue_value pv_t;
-
/* Return the unknown prologue value --- { pvk_unknown, ?, ? }. */
pv_t pv_unknown (void);
@@ -162,14 +161,12 @@ pv_t pv_constant (CORE_ADDR k);
register REG, plus the constant K. */
pv_t pv_register (int reg, CORE_ADDR k);
-
/* Return conservative approximations of the results of the following
operations. */
-pv_t pv_add (pv_t a, pv_t b); /* a + b */
+pv_t pv_add (pv_t a, pv_t b); /* a + b */
pv_t pv_add_constant (pv_t v, CORE_ADDR k); /* a + k */
-pv_t pv_subtract (pv_t a, pv_t b); /* a - b */
-pv_t pv_logical_and (pv_t a, pv_t b); /* a & b */
-
+pv_t pv_subtract (pv_t a, pv_t b); /* a - b */
+pv_t pv_logical_and (pv_t a, pv_t b); /* a & b */
/* Return non-zero iff A and B are identical expressions.
@@ -183,7 +180,6 @@ pv_t pv_logical_and (pv_t a, pv_t b); /* a & b */
same. */
int pv_is_identical (pv_t a, pv_t b);
-
/* Return non-zero if A is known to be a constant. */
int pv_is_constant (pv_t a);
@@ -191,20 +187,19 @@ int pv_is_constant (pv_t a);
plus some constant, zero otherwise. */
int pv_is_register (pv_t a, int r);
-
/* Return non-zero if A is the original value of register R plus the
constant K. */
int pv_is_register_k (pv_t a, int r, CORE_ADDR k);
/* A conservative boolean type, including "maybe", when we can't
figure out whether something is true or not. */
-enum pv_boolean {
+enum pv_boolean
+{
pv_maybe,
pv_definite_yes,
pv_definite_no,
};
-
/* Decide whether a reference to SIZE bytes at ADDR refers exactly to
an element of an array. The array starts at ARRAY_ADDR, and has
ARRAY_LEN values of ELT_SIZE bytes each. If ADDR definitely does
@@ -215,12 +210,10 @@ enum pv_boolean {
If the reference does touch the array, but doesn't fall exactly on
an element boundary, or doesn't refer to the whole element, return
pv_maybe. */
-enum pv_boolean pv_is_array_ref (pv_t addr, CORE_ADDR size,
- pv_t array_addr, CORE_ADDR array_len,
- CORE_ADDR elt_size,
+enum pv_boolean pv_is_array_ref (pv_t addr, CORE_ADDR size, pv_t array_addr,
+ CORE_ADDR array_len, CORE_ADDR elt_size,
int *i);
-
/* A 'pv_area' keeps track of values stored in a particular region of
memory. */
class pv_area
@@ -250,9 +243,7 @@ public:
creating AREA, then we can't tell which values here the stored
value might overlap, and we'll have to mark everything as
unknown. */
- void store (pv_t addr,
- CORE_ADDR size,
- pv_t value);
+ void store (pv_t addr, CORE_ADDR size, pv_t value);
/* Return the SIZE-byte value at ADDR in AREA. This may return
pv_unknown (). */
@@ -282,12 +273,9 @@ public:
instead, and collecting all your information in one pass. */
bool find_reg (struct gdbarch *gdbarch, int reg, CORE_ADDR *offset_p);
-
/* For every part of AREA whose value we know, apply FUNC to CLOSURE,
the value's address, its size, and the value itself. */
- void scan (void (*func) (void *closure,
- pv_t addr,
- CORE_ADDR size,
+ void scan (void (*func) (void *closure, pv_t addr, CORE_ADDR size,
pv_t value),
void *closure);
@@ -311,9 +299,7 @@ private:
/* Return non-zero if the SIZE bytes at OFFSET would overlap ENTRY;
return zero otherwise. AREA is the area to which ENTRY belongs. */
- int overlaps (struct area_entry *entry,
- CORE_ADDR offset,
- CORE_ADDR size);
+ int overlaps (struct area_entry *entry, CORE_ADDR offset, CORE_ADDR size);
/* This area's base register. */
int m_base_reg;
diff --git a/gdb/psympriv.h b/gdb/psympriv.h
index a266628b491..4b9241ed9fe 100644
--- a/gdb/psympriv.h
+++ b/gdb/psympriv.h
@@ -44,10 +44,7 @@ struct partial_symbol
}
/* Return the unrelocated address of this partial symbol. */
- CORE_ADDR unrelocated_address () const
- {
- return ginfo.value_address ();
- }
+ CORE_ADDR unrelocated_address () const { return ginfo.value_address (); }
/* Return the address of this partial symbol, relocated according to
the offsets provided in OBJFILE. */
@@ -71,13 +68,13 @@ struct partial_symbol
/* Name space code. */
- ENUM_BITFIELD(domain_enum) domain : SYMBOL_DOMAIN_BITS;
+ ENUM_BITFIELD (domain_enum) domain : SYMBOL_DOMAIN_BITS;
/* Address class (for info_symbols). Note that we don't allow
synthetic "aclass" values here at present, simply because there's
no need. */
- ENUM_BITFIELD(address_class) aclass : SYMBOL_ACLASS_BITS;
+ ENUM_BITFIELD (address_class) aclass : SYMBOL_ACLASS_BITS;
};
/* A convenience enum to give names to some constants used when
@@ -85,11 +82,11 @@ struct partial_symbol
used elsewhere. */
enum psymtab_search_status
- {
- PST_NOT_SEARCHED,
- PST_SEARCHED_AND_FOUND,
- PST_SEARCHED_AND_NOT_FOUND
- };
+{
+ PST_NOT_SEARCHED,
+ PST_SEARCHED_AND_FOUND,
+ PST_SEARCHED_AND_NOT_FOUND
+};
/* Specify whether a partial psymbol should be allocated on the global
list or the static list. */
@@ -118,8 +115,7 @@ struct partial_symtab
partial symtab will also be installed using
psymtab_storage::install. */
- partial_symtab (const char *filename,
- psymtab_storage *partial_symtabs,
+ partial_symtab (const char *filename, psymtab_storage *partial_symtabs,
objfile_per_bfd_storage *objfile_per_bfd)
ATTRIBUTE_NONNULL (2) ATTRIBUTE_NONNULL (3);
@@ -127,15 +123,11 @@ struct partial_symtab
from the ADDR argument, and sets the global- and
static-offsets. */
- partial_symtab (const char *filename,
- psymtab_storage *partial_symtabs,
- objfile_per_bfd_storage *objfile_per_bfd,
- CORE_ADDR addr)
+ partial_symtab (const char *filename, psymtab_storage *partial_symtabs,
+ objfile_per_bfd_storage *objfile_per_bfd, CORE_ADDR addr)
ATTRIBUTE_NONNULL (2) ATTRIBUTE_NONNULL (3);
- virtual ~partial_symtab ()
- {
- }
+ virtual ~partial_symtab () {}
/* Psymtab expansion is done in two steps:
- a call to read_symtab
@@ -168,20 +160,14 @@ struct partial_symtab
Return nullptr if the compunit was not read in or if there was no
symtab. */
- virtual struct compunit_symtab *get_compunit_symtab
- (struct objfile *) const = 0;
+ virtual struct compunit_symtab *get_compunit_symtab (struct objfile *) const
+ = 0;
/* Return the raw low text address of this partial_symtab. */
- CORE_ADDR raw_text_low () const
- {
- return m_text_low;
- }
+ CORE_ADDR raw_text_low () const { return m_text_low; }
/* Return the raw high text address of this partial_symtab. */
- CORE_ADDR raw_text_high () const
- {
- return m_text_high;
- }
+ CORE_ADDR raw_text_high () const { return m_text_high; }
/* Return the relocated low text address of this partial_symtab. */
CORE_ADDR text_low (struct objfile *objfile) const
@@ -234,25 +220,18 @@ struct partial_symtab
LANGUAGE is the language from which the symbol originates. This will
influence, amongst other things, how the symbol name is demangled. */
- void add_psymbol (gdb::string_view name,
- bool copy_name, domain_enum domain,
- enum address_class theclass,
- short section,
- psymbol_placement where,
- CORE_ADDR coreaddr,
- enum language language,
- psymtab_storage *partial_symtabs,
+ void add_psymbol (gdb::string_view name, bool copy_name, domain_enum domain,
+ enum address_class theclass, short section,
+ psymbol_placement where, CORE_ADDR coreaddr,
+ enum language language, psymtab_storage *partial_symtabs,
struct objfile *objfile);
/* Add a symbol to this partial symbol table of OBJFILE. The psymbol
must be fully constructed, and the names must be set and intern'd
as appropriate. */
- void add_psymbol (const partial_symbol &psym,
- psymbol_placement where,
- psymtab_storage *partial_symtabs,
- struct objfile *objfile);
-
+ void add_psymbol (const partial_symbol &psym, psymbol_placement where,
+ psymtab_storage *partial_symtabs, struct objfile *objfile);
/* Indicate that this partial symtab is complete. */
@@ -362,25 +341,19 @@ struct partial_symtab
object. */
struct standard_psymtab : public partial_symtab
{
- standard_psymtab (const char *filename,
- psymtab_storage *partial_symtabs,
+ standard_psymtab (const char *filename, psymtab_storage *partial_symtabs,
objfile_per_bfd_storage *objfile_per_bfd)
: partial_symtab (filename, partial_symtabs, objfile_per_bfd)
{
}
- standard_psymtab (const char *filename,
- psymtab_storage *partial_symtabs,
- objfile_per_bfd_storage *objfile_per_bfd,
- CORE_ADDR addr)
+ standard_psymtab (const char *filename, psymtab_storage *partial_symtabs,
+ objfile_per_bfd_storage *objfile_per_bfd, CORE_ADDR addr)
: partial_symtab (filename, partial_symtabs, objfile_per_bfd, addr)
{
}
- bool readin_p (struct objfile *) const override
- {
- return readin;
- }
+ bool readin_p (struct objfile *) const override { return readin; }
struct compunit_symtab *get_compunit_symtab (struct objfile *) const override
{
@@ -404,17 +377,14 @@ struct standard_psymtab : public partial_symtab
struct legacy_psymtab : public standard_psymtab
{
- legacy_psymtab (const char *filename,
- psymtab_storage *partial_symtabs,
+ legacy_psymtab (const char *filename, psymtab_storage *partial_symtabs,
objfile_per_bfd_storage *objfile_per_bfd)
: standard_psymtab (filename, partial_symtabs, objfile_per_bfd)
{
}
- legacy_psymtab (const char *filename,
- psymtab_storage *partial_symtabs,
- objfile_per_bfd_storage *objfile_per_bfd,
- CORE_ADDR addr)
+ legacy_psymtab (const char *filename, psymtab_storage *partial_symtabs,
+ objfile_per_bfd_storage *objfile_per_bfd, CORE_ADDR addr)
: standard_psymtab (filename, partial_symtabs, objfile_per_bfd, addr)
{
}
@@ -453,7 +423,7 @@ struct legacy_psymtab : public standard_psymtab
the tables can be kept by calling the "keep" method. */
class psymtab_discarder
{
- public:
+public:
psymtab_discarder (psymtab_storage *partial_symtabs)
: m_partial_symtabs (partial_symtabs),
@@ -468,12 +438,9 @@ class psymtab_discarder
}
/* Keep any partial symbol tables that were built. */
- void keep ()
- {
- m_partial_symtabs = nullptr;
- }
+ void keep () { m_partial_symtabs = nullptr; }
- private:
+private:
/* The partial symbol storage object. */
psymtab_storage *m_partial_symtabs;
@@ -514,29 +481,26 @@ struct psymbol_functions : public quick_symbol_functions
void expand_all_symtabs (struct objfile *objfile) override;
- void expand_matching_symbols
- (struct objfile *,
- const lookup_name_info &lookup_name,
- domain_enum domain,
- int global,
- symbol_compare_ftype *ordered_compare) override;
-
- bool expand_symtabs_matching
- (struct objfile *objfile,
- gdb::function_view<expand_symtabs_file_matcher_ftype> file_matcher,
- const lookup_name_info *lookup_name,
- gdb::function_view<expand_symtabs_symbol_matcher_ftype> symbol_matcher,
- gdb::function_view<expand_symtabs_exp_notify_ftype> expansion_notify,
- block_search_flags search_flags,
- domain_enum domain,
- enum search_domain kind) override;
-
- struct compunit_symtab *find_pc_sect_compunit_symtab
- (struct objfile *objfile, struct bound_minimal_symbol msymbol,
- CORE_ADDR pc, struct obj_section *section, int warn_if_readin) override;
-
- struct compunit_symtab *find_compunit_symtab_by_address
- (struct objfile *objfile, CORE_ADDR address) override
+ void expand_matching_symbols (
+ struct objfile *, const lookup_name_info &lookup_name, domain_enum domain,
+ int global, symbol_compare_ftype *ordered_compare) override;
+
+ bool expand_symtabs_matching (
+ struct objfile *objfile,
+ gdb::function_view<expand_symtabs_file_matcher_ftype> file_matcher,
+ const lookup_name_info *lookup_name,
+ gdb::function_view<expand_symtabs_symbol_matcher_ftype> symbol_matcher,
+ gdb::function_view<expand_symtabs_exp_notify_ftype> expansion_notify,
+ block_search_flags search_flags, domain_enum domain,
+ enum search_domain kind) override;
+
+ struct compunit_symtab *find_pc_sect_compunit_symtab (
+ struct objfile *objfile, struct bound_minimal_symbol msymbol, CORE_ADDR pc,
+ struct obj_section *section, int warn_if_readin) override;
+
+ struct compunit_symtab *
+ find_compunit_symtab_by_address (struct objfile *objfile,
+ CORE_ADDR address) override
{
return nullptr;
}
@@ -546,8 +510,8 @@ struct psymbol_functions : public quick_symbol_functions
bool need_fullname) override;
/* Return a range adapter for the psymtabs. */
- psymtab_storage::partial_symtab_range partial_symbols
- (struct objfile *objfile);
+ psymtab_storage::partial_symtab_range
+ partial_symbols (struct objfile *objfile);
/* Return the partial symbol storage associated with this
object. */
@@ -568,11 +532,10 @@ struct psymbol_functions : public quick_symbol_functions
exactly matches PC, or, if we cannot find an exact match, the
psymtab that contains a symbol whose address is closest to PC. */
- struct partial_symtab *find_pc_sect_psymtab
- (struct objfile *objfile,
- CORE_ADDR pc,
- struct obj_section *section,
- struct bound_minimal_symbol msymbol);
+ struct partial_symtab *
+ find_pc_sect_psymtab (struct objfile *objfile, CORE_ADDR pc,
+ struct obj_section *section,
+ struct bound_minimal_symbol msymbol);
private:
diff --git a/gdb/psymtab.c b/gdb/psymtab.c
index c9fd6f5f20e..fc777cda549 100644
--- a/gdb/psymtab.c
+++ b/gdb/psymtab.c
@@ -41,8 +41,7 @@
static struct partial_symbol *lookup_partial_symbol (struct objfile *,
struct partial_symtab *,
const lookup_name_info &,
- int,
- domain_enum);
+ int, domain_enum);
static const char *psymtab_to_fullname (struct partial_symtab *ps);
@@ -74,8 +73,6 @@ psymtab_storage::install_psymtab (partial_symtab *pst)
psymtabs = pst;
}
-
-
/* See psympriv.h. */
psymtab_storage::partial_symtab_range
@@ -89,8 +86,8 @@ psymbol_functions::partial_symbols (struct objfile *objfile)
We may find a different psymtab than PST. See FIND_PC_SECT_PSYMTAB. */
static struct partial_symtab *
-find_pc_sect_psymtab_closer (struct objfile *objfile,
- CORE_ADDR pc, struct obj_section *section,
+find_pc_sect_psymtab_closer (struct objfile *objfile, CORE_ADDR pc,
+ struct obj_section *section,
struct partial_symtab *pst,
struct bound_minimal_symbol msymbol)
{
@@ -103,7 +100,7 @@ find_pc_sect_psymtab_closer (struct objfile *objfile,
we want the partial symbol table that contains the
function containing the PC. */
if (!(objfile->flags & OBJF_REORDERED)
- && section == NULL) /* Can't validate section this way. */
+ && section == NULL) /* Can't validate section this way. */
return pst;
if (msymbol.minsym == NULL)
@@ -128,8 +125,7 @@ find_pc_sect_psymtab_closer (struct objfile *objfile,
true; the debug info might be much richer than the
object's symbol table. */
p = find_pc_sect_psymbol (objfile, tpst, pc, section);
- if (p != NULL
- && (p->address (objfile) == msymbol.value_address ()))
+ if (p != NULL && (p->address (objfile) == msymbol.value_address ()))
return tpst;
/* Also accept the textlow value of a psymtab as a
@@ -164,8 +160,7 @@ find_pc_sect_psymtab_closer (struct objfile *objfile,
/* See psympriv.h. */
struct partial_symtab *
-psymbol_functions::find_pc_sect_psymtab (struct objfile *objfile,
- CORE_ADDR pc,
+psymbol_functions::find_pc_sect_psymtab (struct objfile *objfile, CORE_ADDR pc,
struct obj_section *section,
struct bound_minimal_symbol msymbol)
{
@@ -174,8 +169,8 @@ psymbol_functions::find_pc_sect_psymtab (struct objfile *objfile,
{
struct partial_symtab *best_pst;
- best_pst = find_pc_sect_psymtab_closer (objfile, pc, section, pst,
- msymbol);
+ best_pst
+ = find_pc_sect_psymtab_closer (objfile, pc, section, pst, msymbol);
if (best_pst != NULL)
return best_pst;
}
@@ -187,23 +182,19 @@ psymbol_functions::find_pc_sect_psymtab (struct objfile *objfile,
the definition of quick_symbol_functions in symfile.h. */
struct compunit_symtab *
-psymbol_functions::find_pc_sect_compunit_symtab
- (struct objfile *objfile,
- struct bound_minimal_symbol msymbol,
- CORE_ADDR pc,
- struct obj_section *section,
- int warn_if_readin)
+psymbol_functions::find_pc_sect_compunit_symtab (
+ struct objfile *objfile, struct bound_minimal_symbol msymbol, CORE_ADDR pc,
+ struct obj_section *section, int warn_if_readin)
{
- struct partial_symtab *ps = find_pc_sect_psymtab (objfile,
- pc, section,
- msymbol);
+ struct partial_symtab *ps
+ = find_pc_sect_psymtab (objfile, pc, section, msymbol);
if (ps != NULL)
{
if (warn_if_readin && ps->readin_p (objfile))
/* Might want to error() here (in case symtab is corrupt and
will cause a core dump), but maybe we can successfully
continue, so let's not. */
- warning (_("\
+ warning (_ ("\
(Internal error: pc %s in read in psymtab, but not in symtab.)\n"),
paddress (objfile->arch (), pc));
psymtab_to_symtab (objfile, ps);
@@ -216,9 +207,8 @@ psymbol_functions::find_pc_sect_compunit_symtab
Return NULL if none. */
static struct partial_symbol *
-find_pc_sect_psymbol (struct objfile *objfile,
- struct partial_symtab *psymtab, CORE_ADDR pc,
- struct obj_section *section)
+find_pc_sect_psymbol (struct objfile *objfile, struct partial_symtab *psymtab,
+ CORE_ADDR pc, struct obj_section *section)
{
struct partial_symbol *best = NULL;
CORE_ADDR best_pc;
@@ -234,17 +224,15 @@ find_pc_sect_psymbol (struct objfile *objfile,
cache a bad endaddr. */
for (partial_symbol *p : psymtab->global_psymbols)
{
- if (p->domain == VAR_DOMAIN
- && p->aclass == LOC_BLOCK
+ if (p->domain == VAR_DOMAIN && p->aclass == LOC_BLOCK
&& pc >= p->address (objfile)
&& (p->address (objfile) > best_pc
- || (psymtab->text_low (objfile) == 0
- && best_pc == 0 && p->address (objfile) == 0)))
+ || (psymtab->text_low (objfile) == 0 && best_pc == 0
+ && p->address (objfile) == 0)))
{
- if (section != NULL) /* Match on a specific section. */
+ if (section != NULL) /* Match on a specific section. */
{
- if (!matching_obj_sections (p->obj_section (objfile),
- section))
+ if (!matching_obj_sections (p->obj_section (objfile), section))
continue;
}
best_pc = p->address (objfile);
@@ -254,17 +242,15 @@ find_pc_sect_psymbol (struct objfile *objfile,
for (partial_symbol *p : psymtab->static_psymbols)
{
- if (p->domain == VAR_DOMAIN
- && p->aclass == LOC_BLOCK
+ if (p->domain == VAR_DOMAIN && p->aclass == LOC_BLOCK
&& pc >= p->address (objfile)
&& (p->address (objfile) > best_pc
- || (psymtab->text_low (objfile) == 0
- && best_pc == 0 && p->address (objfile) == 0)))
+ || (psymtab->text_low (objfile) == 0 && best_pc == 0
+ && p->address (objfile) == 0)))
{
- if (section != NULL) /* Match on a specific section. */
+ if (section != NULL) /* Match on a specific section. */
{
- if (!matching_obj_sections (p->obj_section (objfile),
- section))
+ if (!matching_obj_sections (p->obj_section (objfile), section))
continue;
}
best_pc = p->address (objfile);
@@ -328,26 +314,23 @@ psymbol_name_matches (partial_symbol *psym,
with MATCH. Returns the symbol, if found, and otherwise NULL. */
static struct partial_symbol *
-match_partial_symbol (struct objfile *objfile,
- struct partial_symtab *pst, int global,
- const lookup_name_info &name, domain_enum domain,
+match_partial_symbol (struct objfile *objfile, struct partial_symtab *pst,
+ int global, const lookup_name_info &name,
+ domain_enum domain,
symbol_compare_ftype *ordered_compare)
{
struct partial_symbol **start, **psym;
struct partial_symbol **top, **real_top, **bottom, **center;
- int length = (global
- ? pst->global_psymbols.size ()
- : pst->static_psymbols.size ());
+ int length
+ = (global ? pst->global_psymbols.size () : pst->static_psymbols.size ());
int do_linear_search = 1;
if (length == 0)
return NULL;
- start = (global ?
- &pst->global_psymbols[0] :
- &pst->static_psymbols[0]);
+ start = (global ? &pst->global_psymbols[0] : &pst->static_psymbols[0]);
- if (global && ordered_compare) /* Can use a binary search. */
+ if (global && ordered_compare) /* Can use a binary search. */
{
do_linear_search = 0;
@@ -368,19 +351,17 @@ match_partial_symbol (struct objfile *objfile,
enum language lang = (*center)->ginfo.language ();
const char *lang_ln = name.language_lookup_name (lang);
- if (ordered_compare ((*center)->ginfo.search_name (),
- lang_ln) >= 0)
+ if (ordered_compare ((*center)->ginfo.search_name (), lang_ln) >= 0)
top = center;
else
bottom = center + 1;
}
gdb_assert (top == bottom);
- while (top <= real_top
- && psymbol_name_matches (*top, name))
+ while (top <= real_top && psymbol_name_matches (*top, name))
{
- if (symbol_matches_domain ((*top)->ginfo.language (),
- (*top)->domain, domain))
+ if (symbol_matches_domain ((*top)->ginfo.language (), (*top)->domain,
+ domain))
return *top;
top++;
}
@@ -408,26 +389,22 @@ match_partial_symbol (struct objfile *objfile,
symbols if not. */
static struct partial_symbol *
-lookup_partial_symbol (struct objfile *objfile,
- struct partial_symtab *pst,
- const lookup_name_info &lookup_name,
- int global, domain_enum domain)
+lookup_partial_symbol (struct objfile *objfile, struct partial_symtab *pst,
+ const lookup_name_info &lookup_name, int global,
+ domain_enum domain)
{
struct partial_symbol **start, **psym;
struct partial_symbol **top, **real_top, **bottom, **center;
- int length = (global
- ? pst->global_psymbols.size ()
- : pst->static_psymbols.size ());
+ int length
+ = (global ? pst->global_psymbols.size () : pst->static_psymbols.size ());
int do_linear_search = 1;
if (length == 0)
return NULL;
- start = (global ?
- &pst->global_psymbols[0] :
- &pst->static_psymbols[0]);
+ start = (global ? &pst->global_psymbols[0] : &pst->static_psymbols[0]);
- if (global) /* This means we can use a binary search. */
+ if (global) /* This means we can use a binary search. */
{
do_linear_search = 0;
@@ -447,7 +424,8 @@ lookup_partial_symbol (struct objfile *objfile,
gdb_assert (center < top);
if (strcmp_iw_ordered ((*center)->ginfo.search_name (),
- lookup_name.c_str ()) >= 0)
+ lookup_name.c_str ())
+ >= 0)
{
top = center;
}
@@ -461,18 +439,18 @@ lookup_partial_symbol (struct objfile *objfile,
/* For `case_sensitivity == case_sensitive_off' strcmp_iw_ordered will
search more exactly than what matches SYMBOL_MATCHES_SEARCH_NAME. */
- while (top >= start && symbol_matches_search_name (&(*top)->ginfo,
- lookup_name))
+ while (top >= start
+ && symbol_matches_search_name (&(*top)->ginfo, lookup_name))
top--;
/* Fixup to have a symbol which matches SYMBOL_MATCHES_SEARCH_NAME. */
top++;
- while (top <= real_top && symbol_matches_search_name (&(*top)->ginfo,
- lookup_name))
+ while (top <= real_top
+ && symbol_matches_search_name (&(*top)->ginfo, lookup_name))
{
- if (symbol_matches_domain ((*top)->ginfo.language (),
- (*top)->domain, domain))
+ if (symbol_matches_domain ((*top)->ginfo.language (), (*top)->domain,
+ domain))
return *top;
top++;
}
@@ -520,8 +498,7 @@ psymtab_to_symtab (struct objfile *objfile, struct partial_symtab *pst)
if (info_verbose)
{
- gdb_printf (_("Reading in symbols for %s...\n"),
- pst->filename);
+ gdb_printf (_ ("Reading in symbols for %s...\n"), pst->filename);
gdb_flush (gdb_stdout);
}
@@ -544,8 +521,9 @@ psymbol_functions::find_last_source_symtab (struct objfile *ofp)
const char *name = ps->filename;
int len = strlen (name);
- if (!(len > 2 && (strcmp (&name[len - 2], ".h") == 0
- || strcmp (name, "<<C++-namespaces>>") == 0)))
+ if (!(len > 2
+ && (strcmp (&name[len - 2], ".h") == 0
+ || strcmp (name, "<<C++-namespaces>>") == 0)))
cs_pst = ps;
}
@@ -553,8 +531,8 @@ psymbol_functions::find_last_source_symtab (struct objfile *ofp)
{
if (cs_pst->readin_p (ofp))
{
- internal_error (_("select_source_symtab: "
- "readin pst found and no symtabs."));
+ internal_error (_ ("select_source_symtab: "
+ "readin pst found and no symtabs."));
}
else
{
@@ -596,8 +574,7 @@ print_partial_symbols (struct gdbarch *gdbarch, struct objfile *objfile,
gdb_printf (outfile, " `%s'", p->ginfo.linkage_name ());
if (p->ginfo.demangled_name () != NULL)
{
- gdb_printf (outfile, " `%s'",
- p->ginfo.demangled_name ());
+ gdb_printf (outfile, " `%s'", p->ginfo.demangled_name ());
}
gdb_puts (", ", outfile);
switch (p->domain)
@@ -698,17 +675,14 @@ dump_psymtab (struct objfile *objfile, struct partial_symtab *psymtab,
gdb_printf (outfile, "\nPartial symtab for source file %s ",
psymtab->filename);
}
- gdb_printf (outfile, "(object %s)\n\n",
- host_address_to_string (psymtab));
+ gdb_printf (outfile, "(object %s)\n\n", host_address_to_string (psymtab));
gdb_printf (outfile, " Read from object file %s (%s)\n",
- objfile_name (objfile),
- host_address_to_string (objfile));
+ objfile_name (objfile), host_address_to_string (objfile));
if (psymtab->readin_p (objfile))
- gdb_printf
- (outfile,
- " Full symtab was read (at %s)\n",
- host_address_to_string (psymtab->get_compunit_symtab (objfile)));
+ gdb_printf (
+ outfile, " Full symtab was read (at %s)\n",
+ host_address_to_string (psymtab->get_compunit_symtab (objfile)));
gdb_printf (outfile, " Symbols cover text addresses ");
gdb_puts (paddress (gdbarch, psymtab->text_low (objfile)), outfile);
@@ -725,15 +699,13 @@ dump_psymtab (struct objfile *objfile, struct partial_symtab *psymtab,
host_address_to_string (psymtab->user));
if (!psymtab->global_psymbols.empty ())
{
- print_partial_symbols
- (gdbarch, objfile, psymtab->global_psymbols,
- "Global", outfile);
+ print_partial_symbols (gdbarch, objfile, psymtab->global_psymbols,
+ "Global", outfile);
}
if (!psymtab->static_psymbols.empty ())
{
- print_partial_symbols
- (gdbarch, objfile, psymtab->static_psymbols,
- "Static", outfile);
+ print_partial_symbols (gdbarch, objfile, psymtab->static_psymbols,
+ "Static", outfile);
}
gdb_printf (outfile, "\n");
}
@@ -764,8 +736,7 @@ psymbol_functions::print_stats (struct objfile *objfile, bool print_bcache)
{
int n_psyms = count_psyms ();
if (n_psyms > 0)
- gdb_printf (_(" Number of \"partial\" symbols read: %d\n"),
- n_psyms);
+ gdb_printf (_ (" Number of \"partial\" symbols read: %d\n"), n_psyms);
i = 0;
for (partial_symtab *ps : partial_symbols (objfile))
@@ -773,16 +744,15 @@ psymbol_functions::print_stats (struct objfile *objfile, bool print_bcache)
if (!ps->readin_p (objfile))
i++;
}
- gdb_printf (_(" Number of psym tables (not yet expanded): %d\n"),
- i);
- gdb_printf (_(" Total memory used for psymbol cache: %d\n"),
+ gdb_printf (_ (" Number of psym tables (not yet expanded): %d\n"), i);
+ gdb_printf (_ (" Total memory used for psymbol cache: %d\n"),
m_partial_symtabs->psymbol_cache.memory_used ());
}
else
{
- gdb_printf (_("Psymbol byte cache statistics:\n"));
- m_partial_symtabs->psymbol_cache.print_statistics
- ("partial symbol cache");
+ gdb_printf (_ ("Psymbol byte cache statistics:\n"));
+ m_partial_symtabs->psymbol_cache.print_statistics (
+ "partial symbol cache");
}
}
@@ -797,11 +767,9 @@ psymbol_functions::dump (struct objfile *objfile)
if (m_partial_symtabs->psymtabs)
{
gdb_printf ("Psymtabs:\n");
- for (psymtab = m_partial_symtabs->psymtabs;
- psymtab != NULL;
+ for (psymtab = m_partial_symtabs->psymtabs; psymtab != NULL;
psymtab = psymtab->next)
- gdb_printf ("%s at %s\n",
- psymtab->filename,
+ gdb_printf ("%s at %s\n", psymtab->filename,
host_address_to_string (psymtab));
gdb_printf ("\n\n");
}
@@ -821,10 +789,9 @@ psymbol_functions::expand_all_symtabs (struct objfile *objfile)
the definition of quick_symbol_functions in symfile.h. */
void
-psymbol_functions::map_symbol_filenames
- (struct objfile *objfile,
- gdb::function_view<symbol_filename_ftype> fun,
- bool need_fullname)
+psymbol_functions::map_symbol_filenames (
+ struct objfile *objfile, gdb::function_view<symbol_filename_ftype> fun,
+ bool need_fullname)
{
for (partial_symtab *ps : partial_symbols (objfile))
{
@@ -881,11 +848,9 @@ psymtab_to_fullname (struct partial_symtab *ps)
the definition of quick_symbol_functions in symfile.h. */
void
-psymbol_functions::expand_matching_symbols
- (struct objfile *objfile,
- const lookup_name_info &name, domain_enum domain,
- int global,
- symbol_compare_ftype *ordered_compare)
+psymbol_functions::expand_matching_symbols (
+ struct objfile *objfile, const lookup_name_info &name, domain_enum domain,
+ int global, symbol_compare_ftype *ordered_compare)
{
for (partial_symtab *ps : partial_symbols (objfile))
{
@@ -903,14 +868,11 @@ psymbol_functions::expand_matching_symbols
various psymtabs that it searches. */
static bool
-recursively_search_psymtabs
- (struct partial_symtab *ps,
- struct objfile *objfile,
- block_search_flags search_flags,
- domain_enum domain,
- enum search_domain search,
- const lookup_name_info &lookup_name,
- gdb::function_view<expand_symtabs_symbol_matcher_ftype> sym_matcher)
+recursively_search_psymtabs (
+ struct partial_symtab *ps, struct objfile *objfile,
+ block_search_flags search_flags, domain_enum domain,
+ enum search_domain search, const lookup_name_info &lookup_name,
+ gdb::function_view<expand_symtabs_symbol_matcher_ftype> sym_matcher)
{
int keep_going = 1;
enum psymtab_search_status result = PST_SEARCHED_AND_NOT_FOUND;
@@ -929,8 +891,8 @@ recursively_search_psymtabs
if (ps->dependencies[i]->user == NULL)
continue;
- r = recursively_search_psymtabs (ps->dependencies[i],
- objfile, search_flags, domain, search,
+ r = recursively_search_psymtabs (ps->dependencies[i], objfile,
+ search_flags, domain, search,
lookup_name, sym_matcher);
if (r != 0)
{
@@ -939,10 +901,10 @@ recursively_search_psymtabs
}
}
- partial_symbol **gbound = (ps->global_psymbols.data ()
- + ps->global_psymbols.size ());
- partial_symbol **sbound = (ps->static_psymbols.data ()
- + ps->static_psymbols.size ());
+ partial_symbol **gbound
+ = (ps->global_psymbols.data () + ps->global_psymbols.size ());
+ partial_symbol **sbound
+ = (ps->static_psymbols.data () + ps->static_psymbols.size ());
partial_symbol **bound = gbound;
/* Go through all of the symbols stored in a partial
@@ -978,22 +940,21 @@ recursively_search_psymtabs
{
QUIT;
- if ((domain == UNDEF_DOMAIN
- || symbol_matches_domain ((*psym)->ginfo.language (),
- (*psym)->domain, domain))
- && (search == ALL_DOMAIN
- || (search == MODULES_DOMAIN
- && (*psym)->domain == MODULE_DOMAIN)
- || (search == VARIABLES_DOMAIN
- && (*psym)->aclass != LOC_TYPEDEF
- && (*psym)->aclass != LOC_BLOCK)
- || (search == FUNCTIONS_DOMAIN
- && (*psym)->aclass == LOC_BLOCK)
- || (search == TYPES_DOMAIN
- && (*psym)->aclass == LOC_TYPEDEF))
- && psymbol_name_matches (*psym, lookup_name)
- && (sym_matcher == NULL
- || sym_matcher ((*psym)->ginfo.search_name ())))
+ if (
+ (domain == UNDEF_DOMAIN
+ || symbol_matches_domain ((*psym)->ginfo.language (),
+ (*psym)->domain, domain))
+ && (search == ALL_DOMAIN
+ || (search == MODULES_DOMAIN
+ && (*psym)->domain == MODULE_DOMAIN)
+ || (search == VARIABLES_DOMAIN
+ && (*psym)->aclass != LOC_TYPEDEF
+ && (*psym)->aclass != LOC_BLOCK)
+ || (search == FUNCTIONS_DOMAIN && (*psym)->aclass == LOC_BLOCK)
+ || (search == TYPES_DOMAIN && (*psym)->aclass == LOC_TYPEDEF))
+ && psymbol_name_matches (*psym, lookup_name)
+ && (sym_matcher == NULL
+ || sym_matcher ((*psym)->ginfo.search_name ())))
{
/* Found a match, so notify our caller. */
result = PST_SEARCHED_AND_FOUND;
@@ -1011,15 +972,14 @@ recursively_search_psymtabs
the definition of quick_symbol_functions in symfile.h. */
bool
-psymbol_functions::expand_symtabs_matching
- (struct objfile *objfile,
- gdb::function_view<expand_symtabs_file_matcher_ftype> file_matcher,
- const lookup_name_info *lookup_name,
- gdb::function_view<expand_symtabs_symbol_matcher_ftype> symbol_matcher,
- gdb::function_view<expand_symtabs_exp_notify_ftype> expansion_notify,
- block_search_flags search_flags,
- domain_enum domain,
- enum search_domain search)
+psymbol_functions::expand_symtabs_matching (
+ struct objfile *objfile,
+ gdb::function_view<expand_symtabs_file_matcher_ftype> file_matcher,
+ const lookup_name_info *lookup_name,
+ gdb::function_view<expand_symtabs_symbol_matcher_ftype> symbol_matcher,
+ gdb::function_view<expand_symtabs_exp_notify_ftype> expansion_notify,
+ block_search_flags search_flags, domain_enum domain,
+ enum search_domain search)
{
/* Clear the search flags. */
for (partial_symtab *ps : partial_symbols (objfile))
@@ -1060,9 +1020,8 @@ psymbol_functions::expand_symtabs_matching
}
if (lookup_name == nullptr
- || recursively_search_psymtabs (ps, objfile, search_flags,
- domain, search,
- *psym_lookup_name,
+ || recursively_search_psymtabs (ps, objfile, search_flags, domain,
+ search, *psym_lookup_name,
symbol_matcher))
{
compunit_symtab *cust = psymtab_to_symtab (objfile, ps);
@@ -1103,8 +1062,6 @@ psymbol_functions::has_unexpanded_symtabs (struct objfile *objfile)
return false;
}
-
-
/* Partially fill a partial symtab. It will be completely filled at
the end of the symbol list. */
@@ -1127,13 +1084,12 @@ partial_symtab::end ()
static_psymbols.shrink_to_fit ();
/* Sort the global list; don't sort the static list. */
- std::sort (global_psymbols.begin (),
- global_psymbols.end (),
- [] (partial_symbol *s1, partial_symbol *s2)
- {
- return strcmp_iw_ordered (s1->ginfo.search_name (),
- s2->ginfo.search_name ()) < 0;
- });
+ std::sort (global_psymbols.begin (), global_psymbols.end (),
+ [] (partial_symbol *s1, partial_symbol *s2) {
+ return strcmp_iw_ordered (s1->ginfo.search_name (),
+ s2->ginfo.search_name ())
+ < 0;
+ });
}
/* See psymtab.h. */
@@ -1167,7 +1123,8 @@ psymbol_bcache::compare (const void *addr1, const void *addr2, int length)
struct partial_symbol *sym2 = (struct partial_symbol *) addr2;
return (memcmp (&sym1->ginfo.m_value, &sym2->ginfo.m_value,
- sizeof (sym1->ginfo.m_value)) == 0
+ sizeof (sym1->ginfo.m_value))
+ == 0
&& sym1->ginfo.language () == sym2->ginfo.language ()
&& sym1->domain == sym2->domain
&& sym1->aclass == sym2->aclass
@@ -1189,9 +1146,8 @@ partial_symtab::add_psymbol (const partial_symbol &psymbol,
/* Stash the partial symbol away in the cache. */
partial_symbol *psym
- = ((struct partial_symbol *)
- partial_symtabs->psymbol_cache.insert
- (&psymbol, sizeof (struct partial_symbol), &added));
+ = ((struct partial_symbol *) partial_symtabs->psymbol_cache.insert (
+ &psymbol, sizeof (struct partial_symbol), &added));
/* Do not duplicate global partial symbols. */
if (where == psymbol_placement::GLOBAL && !added)
@@ -1199,9 +1155,7 @@ partial_symtab::add_psymbol (const partial_symbol &psymbol,
/* Save pointer to partial symbol in psymtab, growing symtab if needed. */
std::vector<partial_symbol *> &list
- = (where == psymbol_placement::STATIC
- ? static_psymbols
- : global_psymbols);
+ = (where == psymbol_placement::STATIC ? static_psymbols : global_psymbols);
list.push_back (psym);
}
@@ -1209,12 +1163,9 @@ partial_symtab::add_psymbol (const partial_symbol &psymbol,
void
partial_symtab::add_psymbol (gdb::string_view name, bool copy_name,
- domain_enum domain,
- enum address_class theclass,
- short section,
- psymbol_placement where,
- CORE_ADDR coreaddr,
- enum language language,
+ domain_enum domain, enum address_class theclass,
+ short section, psymbol_placement where,
+ CORE_ADDR coreaddr, enum language language,
psymtab_storage *partial_symtabs,
struct objfile *objfile)
{
@@ -1290,7 +1241,6 @@ partial_symtab::expand_dependencies (struct objfile *objfile)
}
}
-
void
psymtab_storage::discard_psymtab (struct partial_symtab *pst)
{
@@ -1312,8 +1262,6 @@ psymtab_storage::discard_psymtab (struct partial_symtab *pst)
delete pst;
}
-
-
static void
maintenance_print_psymbols (const char *args, int from_tty)
{
@@ -1332,19 +1280,19 @@ maintenance_print_psymbols (const char *args, int from_tty)
if (strcmp (argv[i], "-pc") == 0)
{
if (argv[i + 1] == NULL)
- error (_("Missing pc value"));
+ error (_ ("Missing pc value"));
address_arg = argv[++i];
}
else if (strcmp (argv[i], "-source") == 0)
{
if (argv[i + 1] == NULL)
- error (_("Missing source file"));
+ error (_ ("Missing source file"));
source_arg = argv[++i];
}
else if (strcmp (argv[i], "-objfile") == 0)
{
if (argv[i + 1] == NULL)
- error (_("Missing objfile name"));
+ error (_ ("Missing objfile name"));
objfile_arg = argv[++i];
}
else if (strcmp (argv[i], "--") == 0)
@@ -1356,7 +1304,7 @@ maintenance_print_psymbols (const char *args, int from_tty)
else if (argv[i][0] == '-')
{
/* Future proofing: Don't allow OUTFILE to begin with "-". */
- error (_("Unknown option: %s"), argv[i]);
+ error (_ ("Unknown option: %s"), argv[i]);
}
else
break;
@@ -1364,16 +1312,16 @@ maintenance_print_psymbols (const char *args, int from_tty)
outfile_idx = i;
if (address_arg != NULL && source_arg != NULL)
- error (_("Must specify at most one of -pc and -source"));
+ error (_ ("Must specify at most one of -pc and -source"));
stdio_file arg_outfile;
if (argv != NULL && argv[outfile_idx] != NULL)
{
if (argv[outfile_idx + 1] != NULL)
- error (_("Junk at end of command"));
- gdb::unique_xmalloc_ptr<char> outfile_name
- (tilde_expand (argv[outfile_idx]));
+ error (_ ("Junk at end of command"));
+ gdb::unique_xmalloc_ptr<char> outfile_name (
+ tilde_expand (argv[outfile_idx]));
if (!arg_outfile.open (outfile_name.get (), FOPEN_WT))
perror_with_name (outfile_name.get ());
outfile = &arg_outfile;
@@ -1395,8 +1343,7 @@ maintenance_print_psymbols (const char *args, int from_tty)
QUIT;
if (objfile_arg != NULL)
print_for_objfile
- = compare_filenames_for_search (objfile_name (objfile),
- objfile_arg);
+ = compare_filenames_for_search (objfile_name (objfile), objfile_arg);
if (!print_for_objfile)
continue;
@@ -1437,16 +1384,17 @@ maintenance_print_psymbols (const char *args, int from_tty)
if (source_arg != NULL)
{
print_for_source
- = compare_filenames_for_search (ps->filename, source_arg);
+ = compare_filenames_for_search (ps->filename,
+ source_arg);
found = 1;
}
- if (source_arg == NULL
- || print_for_source)
+ if (source_arg == NULL || print_for_source)
{
if (!printed_objfile_header)
{
- outfile->printf ("\nPartial symtabs for objfile %s\n",
- objfile_name (objfile));
+ outfile->printf (
+ "\nPartial symtabs for objfile %s\n",
+ objfile_name (objfile));
printed_objfile_header = 1;
}
dump_psymtab (objfile, ps, outfile);
@@ -1459,9 +1407,9 @@ maintenance_print_psymbols (const char *args, int from_tty)
if (!found)
{
if (address_arg != NULL)
- error (_("No partial symtab for address: %s"), address_arg);
+ error (_ ("No partial symtab for address: %s"), address_arg);
if (source_arg != NULL)
- error (_("No partial symtab for source file: %s"), source_arg);
+ error (_ ("No partial symtab for source file: %s"), source_arg);
}
}
@@ -1492,10 +1440,9 @@ maintenance_info_psymtabs (const char *regexp, int from_tty)
{
QUIT;
- if (! regexp
- || re_exec (psymtab->filename))
+ if (!regexp || re_exec (psymtab->filename))
{
- if (! printed_objfile_start)
+ if (!printed_objfile_start)
{
gdb_printf ("{ objfile %s ", objfile_name (objfile));
gdb_stdout->wrap_here (2);
@@ -1511,30 +1458,29 @@ maintenance_info_psymtabs (const char *regexp, int from_tty)
gdb_printf (" readin %s\n",
psymtab->readin_p (objfile) ? "yes" : "no");
- gdb_printf (" fullname %s\n",
- psymtab->fullname
- ? psymtab->fullname : "(null)");
+ gdb_printf (" fullname %s\n", psymtab->fullname
+ ? psymtab->fullname
+ : "(null)");
gdb_printf (" text addresses ");
- gdb_puts (paddress (gdbarch,
- psymtab->text_low (objfile)));
+ gdb_puts (paddress (gdbarch, psymtab->text_low (objfile)));
gdb_printf (" -- ");
gdb_puts (paddress (gdbarch,
psymtab->text_high (objfile)));
gdb_printf ("\n");
gdb_printf (" globals ");
if (!psymtab->global_psymbols.empty ())
- gdb_printf
- ("(* (struct partial_symbol **) %s @ %d)\n",
- host_address_to_string (psymtab->global_psymbols.data ()),
- (int) psymtab->global_psymbols.size ());
+ gdb_printf ("(* (struct partial_symbol **) %s @ %d)\n",
+ host_address_to_string (
+ psymtab->global_psymbols.data ()),
+ (int) psymtab->global_psymbols.size ());
else
gdb_printf ("(none)\n");
gdb_printf (" statics ");
if (!psymtab->static_psymbols.empty ())
- gdb_printf
- ("(* (struct partial_symbol **) %s @ %d)\n",
- host_address_to_string (psymtab->static_psymbols.data ()),
- (int) psymtab->static_psymbols.size ());
+ gdb_printf ("(* (struct partial_symbol **) %s @ %d)\n",
+ host_address_to_string (
+ psymtab->static_psymbols.data ()),
+ (int) psymtab->static_psymbols.size ());
else
gdb_printf ("(none)\n");
if (psymtab->user)
@@ -1550,7 +1496,8 @@ maintenance_info_psymtabs (const char *regexp, int from_tty)
gdb_printf ("{\n");
for (i = 0; i < psymtab->number_of_dependencies; i++)
{
- struct partial_symtab *dep = psymtab->dependencies[i];
+ struct partial_symtab *dep
+ = psymtab->dependencies[i];
/* Note the string concatenation there --- no
comma. */
@@ -1627,9 +1574,10 @@ maintenance_check_psymtabs (const char *ignore, int from_tty)
&& psym->ginfo.value_address () == 0)
continue;
- sym = block_lookup_symbol (b, psym->ginfo.search_name (),
- symbol_name_match_type::SEARCH_NAME,
- psym->domain);
+ sym
+ = block_lookup_symbol (b, psym->ginfo.search_name (),
+ symbol_name_match_type::SEARCH_NAME,
+ psym->domain);
if (!sym)
{
gdb_printf ("Static symbol `");
@@ -1642,9 +1590,10 @@ maintenance_check_psymtabs (const char *ignore, int from_tty)
b = bv->global_block ();
for (partial_symbol *psym : ps->global_psymbols)
{
- sym = block_lookup_symbol (b, psym->ginfo.search_name (),
- symbol_name_match_type::SEARCH_NAME,
- psym->domain);
+ sym
+ = block_lookup_symbol (b, psym->ginfo.search_name (),
+ symbol_name_match_type::SEARCH_NAME,
+ psym->domain);
if (!sym)
{
gdb_printf ("Global symbol `");
@@ -1676,10 +1625,11 @@ maintenance_check_psymtabs (const char *ignore, int from_tty)
}
void _initialize_psymtab ();
+
void
_initialize_psymtab ()
{
- add_cmd ("psymbols", class_maintenance, maintenance_print_psymbols, _("\
+ add_cmd ("psymbols", class_maintenance, maintenance_print_psymbols, _ ("\
Print dump of current partial symbol definitions.\n\
Usage: mt print psymbols [-objfile OBJFILE] [-pc ADDRESS] [--] [OUTFILE]\n\
mt print psymbols [-objfile OBJFILE] [-source SOURCE] [--] [OUTFILE]\n\
@@ -1690,14 +1640,14 @@ If SOURCE is provided, dump only that file's symbols.\n\
If OBJFILE is provided, dump only that file's minimal symbols."),
&maintenanceprintlist);
- add_cmd ("psymtabs", class_maintenance, maintenance_info_psymtabs, _("\
+ add_cmd ("psymtabs", class_maintenance, maintenance_info_psymtabs, _ ("\
List the partial symbol tables for all object files.\n\
This does not include information about individual partial symbols,\n\
just the symbol table structures themselves."),
&maintenanceinfolist);
add_cmd ("check-psymtabs", class_maintenance, maintenance_check_psymtabs,
- _("\
+ _ ("\
Check consistency of currently expanded psymtabs versus symtabs."),
&maintenancelist);
}
diff --git a/gdb/psymtab.h b/gdb/psymtab.h
index ceb1310ae53..cb1280f7f64 100644
--- a/gdb/psymtab.h
+++ b/gdb/psymtab.h
@@ -64,6 +64,7 @@ struct psymbol_bcache : public gdb::bcache
class psymtab_storage
{
public:
+
psymtab_storage () = default;
~psymtab_storage ();
@@ -109,11 +110,7 @@ public:
/* A range adapter that makes it possible to iterate over all
psymtabs in one objfile. */
- partial_symtab_range range ()
- {
- return partial_symtab_range (psymtabs);
- }
-
+ partial_symtab_range range () { return partial_symtab_range (psymtabs); }
/* Each objfile points to a linked list of partial symtabs derived from
this file, one partial symtab structure for each compilation unit
diff --git a/gdb/python/py-arch.c b/gdb/python/py-arch.c
index 51559ca7c35..62e1e3a790e 100644
--- a/gdb/python/py-arch.c
+++ b/gdb/python/py-arch.c
@@ -23,28 +23,30 @@
#include "disasm.h"
#include "python-internal.h"
-struct arch_object {
- PyObject_HEAD
- struct gdbarch *gdbarch;
+struct arch_object
+{
+ PyObject_HEAD struct gdbarch *gdbarch;
};
static const registry<gdbarch>::key<PyObject, gdb::noop_deleter<PyObject>>
- arch_object_data;
+ arch_object_data;
/* Require a valid Architecture. */
-#define ARCHPY_REQUIRE_VALID(arch_obj, arch) \
- do { \
- arch = arch_object_to_gdbarch (arch_obj); \
- if (arch == NULL) \
- { \
- PyErr_SetString (PyExc_RuntimeError, \
- _("Architecture is invalid.")); \
- return NULL; \
- } \
- } while (0)
-
-extern PyTypeObject arch_object_type
- CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF ("arch_object");
+#define ARCHPY_REQUIRE_VALID(arch_obj, arch) \
+ do \
+ { \
+ arch = arch_object_to_gdbarch (arch_obj); \
+ if (arch == NULL) \
+ { \
+ PyErr_SetString (PyExc_RuntimeError, \
+ _ ("Architecture is invalid.")); \
+ return NULL; \
+ } \
+ } \
+ while (0)
+
+extern PyTypeObject
+ arch_object_type CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF ("arch_object");
/* Associates an arch_object with GDBARCH as gdbarch_data via the gdbarch
post init registration mechanism (gdbarch_data_register_post_init). */
@@ -135,9 +137,8 @@ archpy_disassemble (PyObject *self, PyObject *args, PyObject *kw)
ARCHPY_REQUIRE_VALID (self, gdbarch);
- if (!gdb_PyArg_ParseTupleAndKeywords (args, kw, "O|OO",
- keywords, &start_obj, &end_obj,
- &count_obj))
+ if (!gdb_PyArg_ParseTupleAndKeywords (args, kw, "O|OO", keywords, &start_obj,
+ &end_obj, &count_obj))
return NULL;
if (get_addr_from_python (start_obj, &start) < 0)
@@ -151,8 +152,8 @@ archpy_disassemble (PyObject *self, PyObject *args, PyObject *kw)
if (end < start)
{
PyErr_SetString (PyExc_ValueError,
- _("Argument 'end_pc' should be greater than or "
- "equal to the argument 'start_pc'."));
+ _ ("Argument 'end_pc' should be greater than or "
+ "equal to the argument 'start_pc'."));
return NULL;
}
@@ -163,8 +164,8 @@ archpy_disassemble (PyObject *self, PyObject *args, PyObject *kw)
if (PyErr_Occurred () || count < 0)
{
PyErr_SetString (PyExc_TypeError,
- _("Argument 'count' should be an non-negative "
- "integer."));
+ _ ("Argument 'count' should be an non-negative "
+ "integer."));
return NULL;
}
@@ -190,7 +191,7 @@ archpy_disassemble (PyObject *self, PyObject *args, PyObject *kw)
if (insn_dict == NULL)
return NULL;
if (PyList_Append (result_list.get (), insn_dict.get ()))
- return NULL; /* PyList_Append Sets the exception. */
+ return NULL; /* PyList_Append Sets the exception. */
string_file stb;
@@ -208,8 +209,8 @@ archpy_disassemble (PyObject *self, PyObject *args, PyObject *kw)
if (pc_obj == nullptr)
return nullptr;
- gdbpy_ref<> asm_obj
- (PyUnicode_FromString (!stb.empty () ? stb.c_str () : "<unknown>"));
+ gdbpy_ref<> asm_obj (PyUnicode_FromString (!stb.empty () ? stb.c_str ()
+ : "<unknown>"));
if (asm_obj == nullptr)
return nullptr;
@@ -241,8 +242,7 @@ archpy_registers (PyObject *self, PyObject *args, PyObject *kw)
const char *group_name = NULL;
/* Parse method arguments. */
- if (!gdb_PyArg_ParseTupleAndKeywords (args, kw, "|s", keywords,
- &group_name))
+ if (!gdb_PyArg_ParseTupleAndKeywords (args, kw, "|s", keywords, &group_name))
return NULL;
/* Extract the gdbarch from the self object. */
@@ -273,13 +273,13 @@ archpy_integer_type (PyObject *self, PyObject *args, PyObject *kw)
int size;
PyObject *is_signed_obj = nullptr;
- if (!gdb_PyArg_ParseTupleAndKeywords (args, kw, "i|O", keywords,
- &size, &is_signed_obj))
+ if (!gdb_PyArg_ParseTupleAndKeywords (args, kw, "i|O", keywords, &size,
+ &is_signed_obj))
return nullptr;
/* Assume signed by default. */
- bool is_signed = (is_signed_obj == nullptr
- || PyObject_IsTrue (is_signed_obj));
+ bool is_signed
+ = (is_signed_obj == nullptr || PyObject_IsTrue (is_signed_obj));
struct gdbarch *gdbarch;
ARCHPY_REQUIRE_VALID (self, gdbarch);
@@ -312,7 +312,7 @@ archpy_integer_type (PyObject *self, PyObject *args, PyObject *kw)
default:
PyErr_SetString (PyExc_ValueError,
- _("no integer type of that size is available"));
+ _ ("no integer type of that size is available"));
return nullptr;
}
@@ -332,14 +332,14 @@ gdbpy_all_architecture_names (PyObject *self, PyObject *args)
std::vector<const char *> name_list = gdbarch_printable_names ();
for (const char *name : name_list)
{
- gdbpy_ref <> py_name (PyUnicode_FromString (name));
+ gdbpy_ref<> py_name (PyUnicode_FromString (name));
if (py_name == nullptr)
return nullptr;
if (PyList_Append (list.get (), py_name.get ()) < 0)
return nullptr;
}
- return list.release ();
+ return list.release ();
}
/* Initializes the Architecture class in the gdb module. */
@@ -355,9 +355,8 @@ gdbpy_initialize_arch (void)
(PyObject *) &arch_object_type);
}
-static PyMethodDef arch_object_methods [] = {
- { "name", archpy_name, METH_NOARGS,
- "name () -> String.\n\
+static PyMethodDef arch_object_methods[] = {
+ { "name", archpy_name, METH_NOARGS, "name () -> String.\n\
Return the name of the architecture as a string value." },
{ "disassemble", (PyCFunction) archpy_disassemble,
METH_VARARGS | METH_KEYWORDS,
@@ -365,58 +364,54 @@ Return the name of the architecture as a string value." },
Return a list of at most COUNT disassembled instructions from START_PC to\n\
END_PC." },
{ "integer_type", (PyCFunction) archpy_integer_type,
- METH_VARARGS | METH_KEYWORDS,
- "integer_type (size [, signed]) -> type\n\
+ METH_VARARGS | METH_KEYWORDS, "integer_type (size [, signed]) -> type\n\
Return an integer Type corresponding to the given bitsize and signed-ness.\n\
If not specified, the type defaults to signed." },
- { "registers", (PyCFunction) archpy_registers,
- METH_VARARGS | METH_KEYWORDS,
+ { "registers", (PyCFunction) archpy_registers, METH_VARARGS | METH_KEYWORDS,
"registers ([ group-name ]) -> Iterator.\n\
Return an iterator of register descriptors for the registers in register\n\
group GROUP-NAME." },
- { "register_groups", archpy_register_groups,
- METH_NOARGS,
+ { "register_groups", archpy_register_groups, METH_NOARGS,
"register_groups () -> Iterator.\n\
Return an iterator over all of the register groups in this architecture." },
- {NULL} /* Sentinel */
+ { NULL } /* Sentinel */
};
PyTypeObject arch_object_type = {
- PyVarObject_HEAD_INIT (NULL, 0)
- "gdb.Architecture", /* tp_name */
- sizeof (arch_object), /* tp_basicsize */
- 0, /* tp_itemsize */
- 0, /* tp_dealloc */
- 0, /* tp_print */
- 0, /* tp_getattr */
- 0, /* tp_setattr */
- 0, /* tp_compare */
- 0, /* tp_repr */
- 0, /* tp_as_number */
- 0, /* tp_as_sequence */
- 0, /* tp_as_mapping */
- 0, /* tp_hash */
- 0, /* tp_call */
- 0, /* tp_str */
- 0, /* tp_getattro */
- 0, /* tp_setattro */
- 0, /* tp_as_buffer */
- Py_TPFLAGS_DEFAULT, /* tp_flags */
- "GDB architecture object", /* tp_doc */
- 0, /* tp_traverse */
- 0, /* tp_clear */
- 0, /* tp_richcompare */
- 0, /* tp_weaklistoffset */
- 0, /* tp_iter */
- 0, /* tp_iternext */
- arch_object_methods, /* tp_methods */
- 0, /* tp_members */
- 0, /* tp_getset */
- 0, /* tp_base */
- 0, /* tp_dict */
- 0, /* tp_descr_get */
- 0, /* tp_descr_set */
- 0, /* tp_dictoffset */
- 0, /* tp_init */
- 0, /* tp_alloc */
+ PyVarObject_HEAD_INIT (NULL, 0) "gdb.Architecture", /* tp_name */
+ sizeof (arch_object), /* tp_basicsize */
+ 0, /* tp_itemsize */
+ 0, /* tp_dealloc */
+ 0, /* tp_print */
+ 0, /* tp_getattr */
+ 0, /* tp_setattr */
+ 0, /* tp_compare */
+ 0, /* tp_repr */
+ 0, /* tp_as_number */
+ 0, /* tp_as_sequence */
+ 0, /* tp_as_mapping */
+ 0, /* tp_hash */
+ 0, /* tp_call */
+ 0, /* tp_str */
+ 0, /* tp_getattro */
+ 0, /* tp_setattro */
+ 0, /* tp_as_buffer */
+ Py_TPFLAGS_DEFAULT, /* tp_flags */
+ "GDB architecture object", /* tp_doc */
+ 0, /* tp_traverse */
+ 0, /* tp_clear */
+ 0, /* tp_richcompare */
+ 0, /* tp_weaklistoffset */
+ 0, /* tp_iter */
+ 0, /* tp_iternext */
+ arch_object_methods, /* tp_methods */
+ 0, /* tp_members */
+ 0, /* tp_getset */
+ 0, /* tp_base */
+ 0, /* tp_dict */
+ 0, /* tp_descr_get */
+ 0, /* tp_descr_set */
+ 0, /* tp_dictoffset */
+ 0, /* tp_init */
+ 0, /* tp_alloc */
};
diff --git a/gdb/python/py-auto-load.c b/gdb/python/py-auto-load.c
index ed6202d794b..51c070a993d 100644
--- a/gdb/python/py-auto-load.c
+++ b/gdb/python/py-auto-load.c
@@ -37,7 +37,7 @@ static void
show_auto_load_python_scripts (struct ui_file *file, int from_tty,
struct cmd_list_element *c, const char *value)
{
- gdb_printf (file, _("Auto-loading of Python scripts is %s.\n"), value);
+ gdb_printf (file, _ ("Auto-loading of Python scripts is %s.\n"), value);
}
/* See python-internal.h. */
@@ -55,14 +55,16 @@ info_auto_load_python_scripts (const char *pattern, int from_tty)
{
auto_load_info_scripts (pattern, from_tty, &extension_language_python);
}
-
+
int
gdbpy_initialize_auto_load (void)
{
add_setshow_boolean_cmd ("python-scripts", class_support,
- &auto_load_python_scripts, _("\
-Set the debugger's behaviour regarding auto-loaded Python scripts."), _("\
-Show the debugger's behaviour regarding auto-loaded Python scripts."), _("\
+ &auto_load_python_scripts, _ ("\
+Set the debugger's behaviour regarding auto-loaded Python scripts."),
+ _ ("\
+Show the debugger's behaviour regarding auto-loaded Python scripts."),
+ _ ("\
If enabled, auto-loaded Python scripts are loaded when the debugger reads\n\
an executable or shared library.\n\
This options has security implications for untrusted inferiors."),
@@ -72,24 +74,25 @@ This options has security implications for untrusted inferiors."),
set_show_commands auto_load_scripts_cmds
= add_setshow_boolean_cmd ("auto-load-scripts", class_support,
- &auto_load_python_scripts, _("\
+ &auto_load_python_scripts,
+ _ ("\
Set the debugger's behaviour regarding auto-loaded Python scripts, "
- "deprecated."),
- _("\
+ "deprecated."),
+ _ ("\
Show the debugger's behaviour regarding auto-loaded Python scripts, "
- "deprecated."),
+ "deprecated."),
NULL, NULL, show_auto_load_python_scripts,
&setlist, &showlist);
deprecate_cmd (auto_load_scripts_cmds.set, "set auto-load python-scripts");
deprecate_cmd (auto_load_scripts_cmds.show, "show auto-load python-scripts");
add_cmd ("python-scripts", class_info, info_auto_load_python_scripts,
- _("Print the list of automatically loaded Python scripts.\n\
+ _ ("Print the list of automatically loaded Python scripts.\n\
Usage: info auto-load python-scripts [REGEXP]"),
auto_load_info_cmdlist_get ());
cmd_list_element *info_auto_load_scripts_cmd
- = add_info ("auto-load-scripts", info_auto_load_python_scripts, _("\
+ = add_info ("auto-load-scripts", info_auto_load_python_scripts, _ ("\
Print the list of automatically loaded Python scripts, deprecated."));
deprecate_cmd (info_auto_load_scripts_cmd, "info auto-load python-scripts");
diff --git a/gdb/python/py-block.c b/gdb/python/py-block.c
index c399a01c4fb..77db7a1cb10 100644
--- a/gdb/python/py-block.c
+++ b/gdb/python/py-block.c
@@ -24,10 +24,11 @@
#include "python-internal.h"
#include "objfiles.h"
-struct block_object {
+struct block_object
+{
PyObject_HEAD
- /* The GDB block structure that represents a frame's code block. */
- const struct block *block;
+ /* The GDB block structure that represents a frame's code block. */
+ const struct block *block;
/* The backing object file. There is no direct relationship in GDB
between a block and an object file. When a block is created also
store a pointer to the object file for later use. */
@@ -38,10 +39,11 @@ struct block_object {
block_object *next;
};
-struct block_syms_iterator_object {
+struct block_syms_iterator_object
+{
PyObject_HEAD
- /* The block. */
- const struct block *block;
+ /* The block. */
+ const struct block *block;
/* The iterator for that block. */
struct block_iterator iter;
/* Has the iterator been initialized flag. */
@@ -54,28 +56,31 @@ struct block_syms_iterator_object {
/* Require a valid block. All access to block_object->block should be
gated by this call. */
-#define BLPY_REQUIRE_VALID(block_obj, block) \
- do { \
- block = block_object_to_block (block_obj); \
- if (block == NULL) \
- { \
- PyErr_SetString (PyExc_RuntimeError, \
- _("Block is invalid.")); \
- return NULL; \
- } \
- } while (0)
+#define BLPY_REQUIRE_VALID(block_obj, block) \
+ do \
+ { \
+ block = block_object_to_block (block_obj); \
+ if (block == NULL) \
+ { \
+ PyErr_SetString (PyExc_RuntimeError, _ ("Block is invalid.")); \
+ return NULL; \
+ } \
+ } \
+ while (0)
/* Require a valid block. This macro is called during block iterator
creation, and at each next call. */
-#define BLPY_ITER_REQUIRE_VALID(block_obj) \
- do { \
- if (block_obj->block == NULL) \
- { \
- PyErr_SetString (PyExc_RuntimeError, \
- _("Source block for iterator is invalid.")); \
- return NULL; \
- } \
- } while (0)
+#define BLPY_ITER_REQUIRE_VALID(block_obj) \
+ do \
+ { \
+ if (block_obj->block == NULL) \
+ { \
+ PyErr_SetString (PyExc_RuntimeError, \
+ _ ("Source block for iterator is invalid.")); \
+ return NULL; \
+ } \
+ } \
+ while (0)
/* This is called when an objfile is about to be freed.
Invalidate the block as further actions on the block would result
@@ -101,9 +106,9 @@ struct blpy_deleter
};
extern PyTypeObject block_syms_iterator_object_type
- CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF ("block_syms_iterator_object");
+ CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF ("block_syms_iterator_object");
static const registry<objfile>::key<block_object, blpy_deleter>
- blpy_objfile_data_key;
+ blpy_objfile_data_key;
static PyObject *
blpy_iter (PyObject *self)
@@ -116,7 +121,7 @@ blpy_iter (PyObject *self)
block_iter_obj = PyObject_New (block_syms_iterator_object,
&block_syms_iterator_object_type);
if (block_iter_obj == NULL)
- return NULL;
+ return NULL;
block_iter_obj->block = block;
block_iter_obj->initialized_p = 0;
@@ -166,7 +171,7 @@ blpy_get_superblock (PyObject *self, void *closure)
{
const struct block *block;
const struct block *super_block;
- block_object *self_obj = (block_object *) self;
+ block_object *self_obj = (block_object *) self;
BLPY_REQUIRE_VALID (self, block);
@@ -184,15 +189,13 @@ blpy_get_global_block (PyObject *self, void *closure)
{
const struct block *block;
const struct block *global_block;
- block_object *self_obj = (block_object *) self;
+ block_object *self_obj = (block_object *) self;
BLPY_REQUIRE_VALID (self, block);
global_block = block_global_block (block);
- return block_to_block_object (global_block,
- self_obj->objfile);
-
+ return block_to_block_object (global_block, self_obj->objfile);
}
/* Return the static block associated to this block. Return None
@@ -203,7 +206,7 @@ blpy_get_static_block (PyObject *self, void *closure)
{
const struct block *block;
const struct block *static_block;
- block_object *self_obj = (block_object *) self;
+ block_object *self_obj = (block_object *) self;
BLPY_REQUIRE_VALID (self, block);
@@ -242,7 +245,7 @@ blpy_is_static (PyObject *self, void *closure)
BLPY_REQUIRE_VALID (self, block);
if (block->superblock () != NULL
- && block->superblock ()->superblock () == NULL)
+ && block->superblock ()->superblock () == NULL)
Py_RETURN_TRUE;
Py_RETURN_FALSE;
@@ -263,7 +266,7 @@ blpy_getitem (PyObject *self, PyObject *key)
if (name == nullptr)
return nullptr;
- lookup_name_info lookup_name (name.get(), symbol_name_match_type::FULL);
+ lookup_name_info lookup_name (name.get (), symbol_name_match_type::FULL);
/* We use ALL_BLOCK_SYMBOLS_WITH_NAME instead of block_lookup_symbol so
that we can look up symbols irrespective of the domain, matching the
@@ -341,7 +344,7 @@ block_to_block_object (const struct block *block, struct objfile *objfile)
const struct block *
block_object_to_block (PyObject *obj)
{
- if (! PyObject_TypeCheck (obj, &block_object_type))
+ if (!PyObject_TypeCheck (obj, &block_object_type))
return NULL;
return ((block_object *) obj)->block;
}
@@ -370,7 +373,7 @@ blpy_block_syms_iternext (PyObject *self)
if (!iter_obj->initialized_p)
{
- sym = block_iterator_first (iter_obj->block, &(iter_obj->iter));
+ sym = block_iterator_first (iter_obj->block, &(iter_obj->iter));
iter_obj->initialized_p = 1;
}
else
@@ -378,7 +381,7 @@ blpy_block_syms_iternext (PyObject *self)
if (sym == NULL)
{
- PyErr_SetString (PyExc_StopIteration, _("Symbol is null."));
+ PyErr_SetString (PyExc_StopIteration, _ ("Symbol is null."));
return NULL;
}
@@ -415,8 +418,7 @@ blpy_is_valid (PyObject *self, PyObject *args)
static PyObject *
blpy_iter_is_valid (PyObject *self, PyObject *args)
{
- block_syms_iterator_object *iter_obj =
- (block_syms_iterator_object *) self;
+ block_syms_iterator_object *iter_obj = (block_syms_iterator_object *) self;
if (iter_obj->source->block == NULL)
Py_RETURN_FALSE;
@@ -436,20 +438,19 @@ gdbpy_initialize_blocks (void)
return -1;
if (gdb_pymodule_addobject (gdb_module, "Block",
- (PyObject *) &block_object_type) < 0)
+ (PyObject *) &block_object_type)
+ < 0)
return -1;
- return gdb_pymodule_addobject (gdb_module, "BlockIterator",
- (PyObject *) &block_syms_iterator_object_type);
+ return gdb_pymodule_addobject (
+ gdb_module, "BlockIterator",
+ (PyObject *) &block_syms_iterator_object_type);
}
-
-
static PyMethodDef block_object_methods[] = {
- { "is_valid", blpy_is_valid, METH_NOARGS,
- "is_valid () -> Boolean.\n\
+ { "is_valid", blpy_is_valid, METH_NOARGS, "is_valid () -> Boolean.\n\
Return true if this block is valid, false if not." },
- {NULL} /* Sentinel */
+ { NULL } /* Sentinel */
};
static gdb_PyGetSetDef block_object_getset[] = {
@@ -463,86 +464,79 @@ static gdb_PyGetSetDef block_object_getset[] = {
"Block containing the global block.", NULL },
{ "static_block", blpy_get_static_block, NULL,
"Block containing the static block.", NULL },
- { "is_static", blpy_is_static, NULL,
- "Whether this block is a static block.", NULL },
- { "is_global", blpy_is_global, NULL,
- "Whether this block is a global block.", NULL },
- { NULL } /* Sentinel */
+ { "is_static", blpy_is_static, NULL, "Whether this block is a static block.",
+ NULL },
+ { "is_global", blpy_is_global, NULL, "Whether this block is a global block.",
+ NULL },
+ { NULL } /* Sentinel */
};
-static PyMappingMethods block_object_as_mapping = {
- NULL,
- blpy_getitem,
- NULL
-};
+static PyMappingMethods block_object_as_mapping = { NULL, blpy_getitem, NULL };
PyTypeObject block_object_type = {
- PyVarObject_HEAD_INIT (NULL, 0)
- "gdb.Block", /*tp_name*/
- sizeof (block_object), /*tp_basicsize*/
- 0, /*tp_itemsize*/
- blpy_dealloc, /*tp_dealloc*/
- 0, /*tp_print*/
- 0, /*tp_getattr*/
- 0, /*tp_setattr*/
- 0, /*tp_compare*/
- 0, /*tp_repr*/
- 0, /*tp_as_number*/
- 0, /*tp_as_sequence*/
- &block_object_as_mapping, /*tp_as_mapping*/
- 0, /*tp_hash */
- 0, /*tp_call*/
- 0, /*tp_str*/
- 0, /*tp_getattro*/
- 0, /*tp_setattro*/
- 0, /*tp_as_buffer*/
- Py_TPFLAGS_DEFAULT, /*tp_flags*/
- "GDB block object", /* tp_doc */
- 0, /* tp_traverse */
- 0, /* tp_clear */
- 0, /* tp_richcompare */
- 0, /* tp_weaklistoffset */
- blpy_iter, /* tp_iter */
- 0, /* tp_iternext */
- block_object_methods, /* tp_methods */
- 0, /* tp_members */
- block_object_getset /* tp_getset */
+ PyVarObject_HEAD_INIT (NULL, 0) "gdb.Block", /*tp_name*/
+ sizeof (block_object), /*tp_basicsize*/
+ 0, /*tp_itemsize*/
+ blpy_dealloc, /*tp_dealloc*/
+ 0, /*tp_print*/
+ 0, /*tp_getattr*/
+ 0, /*tp_setattr*/
+ 0, /*tp_compare*/
+ 0, /*tp_repr*/
+ 0, /*tp_as_number*/
+ 0, /*tp_as_sequence*/
+ &block_object_as_mapping, /*tp_as_mapping*/
+ 0, /*tp_hash */
+ 0, /*tp_call*/
+ 0, /*tp_str*/
+ 0, /*tp_getattro*/
+ 0, /*tp_setattro*/
+ 0, /*tp_as_buffer*/
+ Py_TPFLAGS_DEFAULT, /*tp_flags*/
+ "GDB block object", /* tp_doc */
+ 0, /* tp_traverse */
+ 0, /* tp_clear */
+ 0, /* tp_richcompare */
+ 0, /* tp_weaklistoffset */
+ blpy_iter, /* tp_iter */
+ 0, /* tp_iternext */
+ block_object_methods, /* tp_methods */
+ 0, /* tp_members */
+ block_object_getset /* tp_getset */
};
static PyMethodDef block_iterator_object_methods[] = {
- { "is_valid", blpy_iter_is_valid, METH_NOARGS,
- "is_valid () -> Boolean.\n\
+ { "is_valid", blpy_iter_is_valid, METH_NOARGS, "is_valid () -> Boolean.\n\
Return true if this block iterator is valid, false if not." },
- {NULL} /* Sentinel */
+ { NULL } /* Sentinel */
};
PyTypeObject block_syms_iterator_object_type = {
- PyVarObject_HEAD_INIT (NULL, 0)
- "gdb.BlockIterator", /*tp_name*/
- sizeof (block_syms_iterator_object), /*tp_basicsize*/
- 0, /*tp_itemsize*/
- blpy_block_syms_dealloc, /*tp_dealloc*/
- 0, /*tp_print*/
- 0, /*tp_getattr*/
- 0, /*tp_setattr*/
- 0, /*tp_compare*/
- 0, /*tp_repr*/
- 0, /*tp_as_number*/
- 0, /*tp_as_sequence*/
- 0, /*tp_as_mapping*/
- 0, /*tp_hash */
- 0, /*tp_call*/
- 0, /*tp_str*/
- 0, /*tp_getattro*/
- 0, /*tp_setattro*/
- 0, /*tp_as_buffer*/
- Py_TPFLAGS_DEFAULT, /*tp_flags*/
- "GDB block syms iterator object", /*tp_doc */
- 0, /*tp_traverse */
- 0, /*tp_clear */
- 0, /*tp_richcompare */
- 0, /*tp_weaklistoffset */
- blpy_block_syms_iter, /*tp_iter */
- blpy_block_syms_iternext, /*tp_iternext */
- block_iterator_object_methods /*tp_methods */
+ PyVarObject_HEAD_INIT (NULL, 0) "gdb.BlockIterator", /*tp_name*/
+ sizeof (block_syms_iterator_object), /*tp_basicsize*/
+ 0, /*tp_itemsize*/
+ blpy_block_syms_dealloc, /*tp_dealloc*/
+ 0, /*tp_print*/
+ 0, /*tp_getattr*/
+ 0, /*tp_setattr*/
+ 0, /*tp_compare*/
+ 0, /*tp_repr*/
+ 0, /*tp_as_number*/
+ 0, /*tp_as_sequence*/
+ 0, /*tp_as_mapping*/
+ 0, /*tp_hash */
+ 0, /*tp_call*/
+ 0, /*tp_str*/
+ 0, /*tp_getattro*/
+ 0, /*tp_setattro*/
+ 0, /*tp_as_buffer*/
+ Py_TPFLAGS_DEFAULT, /*tp_flags*/
+ "GDB block syms iterator object", /*tp_doc */
+ 0, /*tp_traverse */
+ 0, /*tp_clear */
+ 0, /*tp_richcompare */
+ 0, /*tp_weaklistoffset */
+ blpy_block_syms_iter, /*tp_iter */
+ blpy_block_syms_iternext, /*tp_iternext */
+ block_iterator_object_methods /*tp_methods */
};
diff --git a/gdb/python/py-bpevent.c b/gdb/python/py-bpevent.c
index 00fb625794b..d058192d736 100644
--- a/gdb/python/py-bpevent.c
+++ b/gdb/python/py-bpevent.c
@@ -32,13 +32,12 @@ create_breakpoint_event_object (PyObject *breakpoint_list, PyObject *first_bp)
if (breakpoint_event_obj == NULL)
return NULL;
- if (evpy_add_attribute (breakpoint_event_obj.get (),
- "breakpoint",
- first_bp) < 0)
+ if (evpy_add_attribute (breakpoint_event_obj.get (), "breakpoint", first_bp)
+ < 0)
return NULL;
- if (evpy_add_attribute (breakpoint_event_obj.get (),
- "breakpoints",
- breakpoint_list) < 0)
+ if (evpy_add_attribute (breakpoint_event_obj.get (), "breakpoints",
+ breakpoint_list)
+ < 0)
return NULL;
return breakpoint_event_obj;
diff --git a/gdb/python/py-breakpoint.c b/gdb/python/py-breakpoint.c
index 1b10ccd5415..5c9e8bfeb5e 100644
--- a/gdb/python/py-breakpoint.c
+++ b/gdb/python/py-breakpoint.c
@@ -35,14 +35,14 @@
#include "linespec.h"
extern PyTypeObject breakpoint_location_object_type
- CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF ("breakpoint_location_object");
+ CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF ("breakpoint_location_object");
struct gdbpy_breakpoint_location_object
{
PyObject_HEAD
- /* An owning reference to the gdb breakpoint location object. */
- bp_location *bp_loc;
+ /* An owning reference to the gdb breakpoint location object. */
+ bp_location *bp_loc;
/* An owning reference to the location's breakpoint owner. */
gdbpy_breakpoint_object *owner;
@@ -50,24 +50,28 @@ struct gdbpy_breakpoint_location_object
/* Require that BREAKPOINT and LOCATION->OWNER are the same; throw a Python
exception if they are not. */
-#define BPLOCPY_REQUIRE_VALID(Breakpoint, Location) \
- do { \
- if ((Breakpoint)->bp != (Location)->bp_loc->owner) \
- return PyErr_Format (PyExc_RuntimeError, \
- _("Breakpoint location is invalid.")); \
- } while (0)
+#define BPLOCPY_REQUIRE_VALID(Breakpoint, Location) \
+ do \
+ { \
+ if ((Breakpoint)->bp != (Location)->bp_loc->owner) \
+ return PyErr_Format (PyExc_RuntimeError, \
+ _ ("Breakpoint location is invalid.")); \
+ } \
+ while (0)
/* Require that BREAKPOINT and LOCATION->OWNER are the same; throw a Python
exception if they are not. This macro is for use in setter functions. */
-#define BPLOCPY_SET_REQUIRE_VALID(Breakpoint, Location) \
- do { \
- if ((Breakpoint)->bp != (Location)->bp_loc->owner) \
- { \
- PyErr_Format (PyExc_RuntimeError, \
- _("Breakpoint location is invalid.")); \
- return -1; \
- } \
- } while (0)
+#define BPLOCPY_SET_REQUIRE_VALID(Breakpoint, Location) \
+ do \
+ { \
+ if ((Breakpoint)->bp != (Location)->bp_loc->owner) \
+ { \
+ PyErr_Format (PyExc_RuntimeError, \
+ _ ("Breakpoint location is invalid.")); \
+ return -1; \
+ } \
+ } \
+ while (0)
/* Debugging of Python breakpoints. */
@@ -79,7 +83,7 @@ static void
show_pybp_debug (struct ui_file *file, int from_tty,
struct cmd_list_element *c, const char *value)
{
- gdb_printf (file, _("Python breakpoint debugging is %s.\n"), value);
+ gdb_printf (file, _ ("Python breakpoint debugging is %s.\n"), value);
}
/* Print a "py-breakpoint" debug statement. */
@@ -112,26 +116,24 @@ struct pybp_code
};
/* Entries related to the type of user set breakpoints. */
-static struct pybp_code pybp_codes[] =
-{
- { "BP_NONE", bp_none},
- { "BP_BREAKPOINT", bp_breakpoint},
- { "BP_HARDWARE_BREAKPOINT", bp_hardware_breakpoint},
- { "BP_WATCHPOINT", bp_watchpoint},
- { "BP_HARDWARE_WATCHPOINT", bp_hardware_watchpoint},
- { "BP_READ_WATCHPOINT", bp_read_watchpoint},
- { "BP_ACCESS_WATCHPOINT", bp_access_watchpoint},
- { "BP_CATCHPOINT", bp_catchpoint},
- {NULL} /* Sentinel. */
+static struct pybp_code pybp_codes[] = {
+ { "BP_NONE", bp_none },
+ { "BP_BREAKPOINT", bp_breakpoint },
+ { "BP_HARDWARE_BREAKPOINT", bp_hardware_breakpoint },
+ { "BP_WATCHPOINT", bp_watchpoint },
+ { "BP_HARDWARE_WATCHPOINT", bp_hardware_watchpoint },
+ { "BP_READ_WATCHPOINT", bp_read_watchpoint },
+ { "BP_ACCESS_WATCHPOINT", bp_access_watchpoint },
+ { "BP_CATCHPOINT", bp_catchpoint },
+ { NULL } /* Sentinel. */
};
/* Entries related to the type of watchpoint. */
-static struct pybp_code pybp_watch_types[] =
-{
- { "WP_READ", hw_read},
- { "WP_WRITE", hw_write},
- { "WP_ACCESS", hw_access},
- {NULL} /* Sentinel. */
+static struct pybp_code pybp_watch_types[] = {
+ { "WP_READ", hw_read },
+ { "WP_WRITE", hw_write },
+ { "WP_ACCESS", hw_access },
+ { NULL } /* Sentinel. */
};
/* Python function which checks the validity of a breakpoint object. */
@@ -152,7 +154,7 @@ bppy_get_enabled (PyObject *self, void *closure)
gdbpy_breakpoint_object *self_bp = (gdbpy_breakpoint_object *) self;
BPPY_REQUIRE_VALID (self_bp);
- if (! self_bp->bp)
+ if (!self_bp->bp)
Py_RETURN_FALSE;
if (self_bp->bp->enable_state == bp_enabled)
Py_RETURN_TRUE;
@@ -183,14 +185,14 @@ bppy_set_enabled (PyObject *self, PyObject *newvalue, void *closure)
if (newvalue == NULL)
{
PyErr_SetString (PyExc_TypeError,
- _("Cannot delete `enabled' attribute."));
+ _ ("Cannot delete `enabled' attribute."));
return -1;
}
- else if (! PyBool_Check (newvalue))
+ else if (!PyBool_Check (newvalue))
{
PyErr_SetString (PyExc_TypeError,
- _("The value of `enabled' must be a boolean."));
+ _ ("The value of `enabled' must be a boolean."));
return -1;
}
@@ -225,13 +227,13 @@ bppy_set_silent (PyObject *self, PyObject *newvalue, void *closure)
if (newvalue == NULL)
{
PyErr_SetString (PyExc_TypeError,
- _("Cannot delete `silent' attribute."));
+ _ ("Cannot delete `silent' attribute."));
return -1;
}
- else if (! PyBool_Check (newvalue))
+ else if (!PyBool_Check (newvalue))
{
PyErr_SetString (PyExc_TypeError,
- _("The value of `silent' must be a boolean."));
+ _ ("The value of `silent' must be a boolean."));
return -1;
}
@@ -256,18 +258,17 @@ bppy_set_thread (PyObject *self, PyObject *newvalue, void *closure)
if (newvalue == NULL)
{
PyErr_SetString (PyExc_TypeError,
- _("Cannot delete `thread' attribute."));
+ _ ("Cannot delete `thread' attribute."));
return -1;
}
else if (PyLong_Check (newvalue))
{
- if (! gdb_py_int_as_long (newvalue, &id))
+ if (!gdb_py_int_as_long (newvalue, &id))
return -1;
if (!valid_global_thread_id (id))
{
- PyErr_SetString (PyExc_RuntimeError,
- _("Invalid thread ID."));
+ PyErr_SetString (PyExc_RuntimeError, _ ("Invalid thread ID."));
return -1;
}
}
@@ -275,8 +276,9 @@ bppy_set_thread (PyObject *self, PyObject *newvalue, void *closure)
id = -1;
else
{
- PyErr_SetString (PyExc_TypeError,
- _("The value of `thread' must be an integer or None."));
+ PyErr_SetString (
+ PyExc_TypeError,
+ _ ("The value of `thread' must be an integer or None."));
return -1;
}
@@ -297,13 +299,12 @@ bppy_set_task (PyObject *self, PyObject *newvalue, void *closure)
if (newvalue == NULL)
{
- PyErr_SetString (PyExc_TypeError,
- _("Cannot delete `task' attribute."));
+ PyErr_SetString (PyExc_TypeError, _ ("Cannot delete `task' attribute."));
return -1;
}
else if (PyLong_Check (newvalue))
{
- if (! gdb_py_int_as_long (newvalue, &id))
+ if (!gdb_py_int_as_long (newvalue, &id))
return -1;
try
@@ -315,10 +316,9 @@ bppy_set_task (PyObject *self, PyObject *newvalue, void *closure)
GDB_PY_SET_HANDLE_EXCEPTION (except);
}
- if (! valid_id)
+ if (!valid_id)
{
- PyErr_SetString (PyExc_RuntimeError,
- _("Invalid task ID."));
+ PyErr_SetString (PyExc_RuntimeError, _ ("Invalid task ID."));
return -1;
}
}
@@ -327,7 +327,7 @@ bppy_set_task (PyObject *self, PyObject *newvalue, void *closure)
else
{
PyErr_SetString (PyExc_TypeError,
- _("The value of `task' must be an integer or None."));
+ _ ("The value of `task' must be an integer or None."));
return -1;
}
@@ -360,7 +360,6 @@ bppy_delete_breakpoint (PyObject *self, PyObject *args)
Py_RETURN_NONE;
}
-
/* Python function to set the ignore count of a breakpoint. */
static int
bppy_set_ignore_count (PyObject *self, PyObject *newvalue, void *closure)
@@ -373,17 +372,17 @@ bppy_set_ignore_count (PyObject *self, PyObject *newvalue, void *closure)
if (newvalue == NULL)
{
PyErr_SetString (PyExc_TypeError,
- _("Cannot delete `ignore_count' attribute."));
+ _ ("Cannot delete `ignore_count' attribute."));
return -1;
}
else if (!PyLong_Check (newvalue))
{
PyErr_SetString (PyExc_TypeError,
- _("The value of `ignore_count' must be an integer."));
+ _ ("The value of `ignore_count' must be an integer."));
return -1;
}
- if (! gdb_py_int_as_long (newvalue, &value))
+ if (!gdb_py_int_as_long (newvalue, &value))
return -1;
if (value < 0)
@@ -412,20 +411,20 @@ bppy_set_hit_count (PyObject *self, PyObject *newvalue, void *closure)
if (newvalue == NULL)
{
PyErr_SetString (PyExc_TypeError,
- _("Cannot delete `hit_count' attribute."));
+ _ ("Cannot delete `hit_count' attribute."));
return -1;
}
else
{
long value;
- if (! gdb_py_int_as_long (newvalue, &value))
+ if (!gdb_py_int_as_long (newvalue, &value))
return -1;
if (value != 0)
{
PyErr_SetString (PyExc_AttributeError,
- _("The value of `hit_count' must be zero."));
+ _ ("The value of `hit_count' must be zero."));
return -1;
}
}
@@ -469,7 +468,7 @@ bppy_get_expression (PyObject *self, void *closure)
wp = (struct watchpoint *) obj->bp;
str = wp->exp_string.get ();
- if (! str)
+ if (!str)
str = "";
return host_string_to_python_string (str).release ();
@@ -485,7 +484,7 @@ bppy_get_condition (PyObject *self, void *closure)
BPPY_REQUIRE_VALID (obj);
str = obj->bp->cond_string.get ();
- if (! str)
+ if (!str)
Py_RETURN_NONE;
return host_string_to_python_string (str).release ();
@@ -507,7 +506,7 @@ bppy_set_condition (PyObject *self, PyObject *newvalue, void *closure)
if (newvalue == NULL)
{
PyErr_SetString (PyExc_TypeError,
- _("Cannot delete `condition' attribute."));
+ _ ("Cannot delete `condition' attribute."));
return -1;
}
else if (newvalue == Py_None)
@@ -543,7 +542,7 @@ bppy_get_commands (PyObject *self, void *closure)
BPPY_REQUIRE_VALID (self_bp);
- if (! self_bp->bp->commands)
+ if (!self_bp->bp->commands)
Py_RETURN_NONE;
string_file stb;
@@ -572,8 +571,8 @@ bppy_set_commands (PyObject *self, PyObject *newvalue, void *closure)
BPPY_SET_REQUIRE_VALID (self_bp);
- gdb::unique_xmalloc_ptr<char> commands
- (python_string_to_host_string (newvalue));
+ gdb::unique_xmalloc_ptr<char> commands (
+ python_string_to_host_string (newvalue));
if (commands == nullptr)
return -1;
@@ -581,14 +580,12 @@ bppy_set_commands (PyObject *self, PyObject *newvalue, void *closure)
{
bool first = true;
char *save_ptr = nullptr;
- auto reader
- = [&] (std::string &buffer)
- {
- const char *result = strtok_r (first ? commands.get () : nullptr,
- "\n", &save_ptr);
- first = false;
- return result;
- };
+ auto reader = [&] (std::string &buffer) {
+ const char *result
+ = strtok_r (first ? commands.get () : nullptr, "\n", &save_ptr);
+ first = false;
+ return result;
+ };
counted_command_line lines = read_command_lines_1 (reader, 1, nullptr);
breakpoint_set_commands (self_bp->bp, std::move (lines));
@@ -740,8 +737,8 @@ bppy_get_locations (PyObject *self, void *closure)
for (bp_location *loc : self_bp->bp->locations ())
{
- gdbpy_ref<py_bploc_t> py_bploc
- (PyObject_New (py_bploc_t, &breakpoint_location_object_type));
+ gdbpy_ref<py_bploc_t> py_bploc (
+ PyObject_New (py_bploc_t, &breakpoint_location_object_type));
if (py_bploc == nullptr)
return nullptr;
@@ -761,9 +758,8 @@ bppy_get_locations (PyObject *self, void *closure)
provided to bppy_init. */
static int
-bppy_init_validate_args (const char *spec, char *source,
- char *function, char *label,
- char *line, enum bptype type)
+bppy_init_validate_args (const char *spec, char *source, char *function,
+ char *label, char *line, enum bptype type)
{
/* If spec is defined, ensure that none of the explicit location
keywords are also defined. */
@@ -771,9 +767,10 @@ bppy_init_validate_args (const char *spec, char *source,
{
if (source != NULL || function != NULL || label != NULL || line != NULL)
{
- PyErr_SetString (PyExc_RuntimeError,
- _("Breakpoints specified with spec cannot "
- "have source, function, label or line defined."));
+ PyErr_SetString (
+ PyExc_RuntimeError,
+ _ ("Breakpoints specified with spec cannot "
+ "have source, function, label or line defined."));
return -1;
}
}
@@ -784,8 +781,8 @@ bppy_init_validate_args (const char *spec, char *source,
if (type == bp_watchpoint)
{
PyErr_SetString (PyExc_RuntimeError,
- _("Watchpoints cannot be set by explicit "
- "location parameters."));
+ _ ("Watchpoints cannot be set by explicit "
+ "location parameters."));
return -1;
}
else
@@ -795,7 +792,7 @@ bppy_init_validate_args (const char *spec, char *source,
&& line == NULL)
{
PyErr_SetString (PyExc_RuntimeError,
- _("Neither spec nor explicit location set."));
+ _ ("Neither spec nor explicit location set."));
return -1;
}
/* Finally, if source is specified, ensure that line, label
@@ -804,8 +801,8 @@ bppy_init_validate_args (const char *spec, char *source,
&& line == NULL)
{
PyErr_SetString (PyExc_RuntimeError,
- _("Specifying a source must also include a "
- "line, label or function."));
+ _ ("Specifying a source must also include a "
+ "line, label or function."));
return -1;
}
}
@@ -817,32 +814,30 @@ bppy_init_validate_args (const char *spec, char *source,
static int
bppy_init (PyObject *self, PyObject *args, PyObject *kwargs)
{
- static const char *keywords[] = { "spec", "type", "wp_class", "internal",
- "temporary","source", "function",
- "label", "line", "qualified", NULL };
+ static const char *keywords[]
+ = { "spec", "type", "wp_class", "internal", "temporary", "source",
+ "function", "label", "line", "qualified", NULL };
const char *spec = NULL;
enum bptype type = bp_breakpoint;
int access_type = hw_write;
PyObject *internal = NULL;
PyObject *temporary = NULL;
- PyObject *lineobj = NULL;;
+ PyObject *lineobj = NULL;
+ ;
int internal_bp = 0;
int temporary_bp = 0;
gdb::unique_xmalloc_ptr<char> line;
char *label = NULL;
char *source = NULL;
char *function = NULL;
- PyObject * qualified = NULL;
+ PyObject *qualified = NULL;
if (!gdb_PyArg_ParseTupleAndKeywords (args, kwargs, "|siiOOsssOO", keywords,
- &spec, &type, &access_type,
- &internal,
- &temporary, &source,
- &function, &label, &lineobj,
- &qualified))
+ &spec, &type, &access_type, &internal,
+ &temporary, &source, &function, &label,
+ &lineobj, &qualified))
return -1;
-
if (lineobj != NULL)
{
if (PyLong_Check (lineobj))
@@ -851,8 +846,9 @@ bppy_init (PyObject *self, PyObject *args, PyObject *kwargs)
line = python_string_to_host_string (lineobj);
else
{
- PyErr_SetString (PyExc_RuntimeError,
- _("Line keyword should be an integer or a string. "));
+ PyErr_SetString (
+ PyExc_RuntimeError,
+ _ ("Line keyword should be an integer or a string. "));
return -1;
}
}
@@ -872,7 +868,8 @@ bppy_init (PyObject *self, PyObject *args, PyObject *kwargs)
}
if (bppy_init_validate_args (spec, source, function, label, line.get (),
- type) == -1)
+ type)
+ == -1)
return -1;
bppy_pending_object = (gdbpy_breakpoint_object *) self;
@@ -889,23 +886,22 @@ bppy_init (PyObject *self, PyObject *args, PyObject *kwargs)
location_spec_up locspec;
symbol_name_match_type func_name_match_type
= (qualified != NULL && PyObject_IsTrue (qualified)
- ? symbol_name_match_type::FULL
- : symbol_name_match_type::WILD);
+ ? symbol_name_match_type::FULL
+ : symbol_name_match_type::WILD);
if (spec != NULL)
{
- gdb::unique_xmalloc_ptr<char>
- copy_holder (xstrdup (skip_spaces (spec)));
+ gdb::unique_xmalloc_ptr<char> copy_holder (
+ xstrdup (skip_spaces (spec)));
const char *copy = copy_holder.get ();
- locspec = string_to_location_spec (&copy,
- current_language,
- func_name_match_type);
+ locspec = string_to_location_spec (&copy, current_language,
+ func_name_match_type);
}
else
{
- std::unique_ptr<explicit_location_spec> explicit_loc
- (new explicit_location_spec ());
+ std::unique_ptr<explicit_location_spec> explicit_loc (
+ new explicit_location_spec ());
explicit_loc->source_filename
= source != nullptr ? xstrdup (source) : nullptr;
@@ -926,14 +922,9 @@ bppy_init (PyObject *self, PyObject *args, PyObject *kwargs)
const struct breakpoint_ops *ops
= breakpoint_ops_for_location_spec (locspec.get (), false);
- create_breakpoint (gdbpy_enter::get_gdbarch (),
- locspec.get (), NULL, -1, NULL, false,
- 0,
- temporary_bp, type,
- 0,
- AUTO_BOOLEAN_TRUE,
- ops,
- 0, 1, internal_bp, 0);
+ create_breakpoint (gdbpy_enter::get_gdbarch (), locspec.get (),
+ NULL, -1, NULL, false, 0, temporary_bp, type, 0,
+ AUTO_BOOLEAN_TRUE, ops, 0, 1, internal_bp, 0);
break;
}
case bp_watchpoint:
@@ -947,13 +938,13 @@ bppy_init (PyObject *self, PyObject *args, PyObject *kwargs)
else if (access_type == hw_read)
rwatch_command_wrapper (spec, 0, internal_bp);
else
- error(_("Cannot understand watchpoint access type."));
+ error (_ ("Cannot understand watchpoint access type."));
break;
}
case bp_catchpoint:
- error (_("BP_CATCHPOINT not supported"));
+ error (_ ("BP_CATCHPOINT not supported"));
default:
- error(_("Do not understand breakpoint type to set."));
+ error (_ ("Do not understand breakpoint type to set."));
}
}
catch (const gdb_exception &except)
@@ -1065,7 +1056,7 @@ gdbpy_breakpoint_cond_says_stop (const struct extension_language_defn *extlang,
/* If the "stop" function returns False that means
the Python breakpoint wants GDB to continue. */
- if (! evaluate)
+ if (!evaluate)
stop = 0;
}
else
@@ -1099,8 +1090,6 @@ gdbpy_breakpoint_has_cond (const struct extension_language_defn *extlang,
return PyObject_HasAttrString (py_bp, stop_func);
}
-
-
/* Event callback functions. */
/* Callback that is used when a breakpoint is created. This function
@@ -1118,12 +1107,9 @@ gdbpy_breakpoint_created (struct breakpoint *bp)
return;
}
- if (bp->type != bp_breakpoint
- && bp->type != bp_hardware_breakpoint
- && bp->type != bp_watchpoint
- && bp->type != bp_hardware_watchpoint
- && bp->type != bp_read_watchpoint
- && bp->type != bp_access_watchpoint
+ if (bp->type != bp_breakpoint && bp->type != bp_hardware_breakpoint
+ && bp->type != bp_watchpoint && bp->type != bp_hardware_watchpoint
+ && bp->type != bp_read_watchpoint && bp->type != bp_access_watchpoint
&& bp->type != bp_catchpoint)
{
pybp_debug_printf ("is not a breakpoint or watchpoint");
@@ -1155,14 +1141,15 @@ gdbpy_breakpoint_created (struct breakpoint *bp)
else
{
PyErr_SetString (PyExc_RuntimeError,
- _("Error while creating breakpoint from GDB."));
+ _ ("Error while creating breakpoint from GDB."));
gdbpy_print_stack ();
}
if (!evregpy_no_listeners_p (gdb_py_events.breakpoint_created))
{
if (evpy_emit_event ((PyObject *) newbp,
- gdb_py_events.breakpoint_created) < 0)
+ gdb_py_events.breakpoint_created)
+ < 0)
gdbpy_print_stack ();
}
}
@@ -1188,7 +1175,8 @@ gdbpy_breakpoint_deleted (struct breakpoint *b)
if (!evregpy_no_listeners_p (gdb_py_events.breakpoint_deleted))
{
if (evpy_emit_event ((PyObject *) bp_obj.get (),
- gdb_py_events.breakpoint_deleted) < 0)
+ gdb_py_events.breakpoint_deleted)
+ < 0)
gdbpy_print_stack ();
}
@@ -1218,16 +1206,14 @@ gdbpy_breakpoint_modified (struct breakpoint *b)
{
if (!evregpy_no_listeners_p (gdb_py_events.breakpoint_modified))
{
- if (evpy_emit_event (bp_obj,
- gdb_py_events.breakpoint_modified) < 0)
+ if (evpy_emit_event (bp_obj, gdb_py_events.breakpoint_modified)
+ < 0)
gdbpy_print_stack ();
}
}
}
}
-
-
/* Initialize the Python breakpoint code. */
int
gdbpy_initialize_breakpoints (void)
@@ -1238,7 +1224,8 @@ gdbpy_initialize_breakpoints (void)
return -1;
if (gdb_pymodule_addobject (gdb_module, "Breakpoint",
- (PyObject *) &breakpoint_object_type) < 0)
+ (PyObject *) &breakpoint_object_type)
+ < 0)
return -1;
gdb::observers::breakpoint_created.attach (gdbpy_breakpoint_created,
@@ -1252,7 +1239,8 @@ gdbpy_initialize_breakpoints (void)
for (i = 0; pybp_codes[i].name; ++i)
{
if (PyModule_AddIntConstant (gdb_module, pybp_codes[i].name,
- pybp_codes[i].code) < 0)
+ pybp_codes[i].code)
+ < 0)
return -1;
}
@@ -1260,7 +1248,8 @@ gdbpy_initialize_breakpoints (void)
for (i = 0; pybp_watch_types[i].name; ++i)
{
if (PyModule_AddIntConstant (gdb_module, pybp_watch_types[i].name,
- pybp_watch_types[i].code) < 0)
+ pybp_watch_types[i].code)
+ < 0)
return -1;
}
@@ -1282,8 +1271,6 @@ gdbpy_initialize_breakpoint_locations ()
return 0;
}
-
-
/* Helper function that overrides this Python object's
PyObject_GenericSetAttr to allow extra validation of the attribute
being set. */
@@ -1311,9 +1298,9 @@ local_setattro (PyObject *self, PyObject *name, PyObject *v)
if (extlang != NULL)
{
std::string error_text
- = string_printf (_("Only one stop condition allowed. There is"
- " currently a %s stop condition defined for"
- " this breakpoint."),
+ = string_printf (_ ("Only one stop condition allowed. There is"
+ " currently a %s stop condition defined for"
+ " this breakpoint."),
ext_lang_capitalized_name (extlang));
PyErr_SetString (PyExc_RuntimeError, error_text.c_str ());
return -1;
@@ -1332,45 +1319,45 @@ static gdb_PyGetSetDef breakpoint_object_getset[] = {
"Thread ID for the breakpoint.\n\
If the value is a thread ID (integer), then this is a thread-specific breakpoint.\n\
If the value is None, then this breakpoint is not thread-specific.\n\
-No other type of value can be used.", NULL },
- { "task", bppy_get_task, bppy_set_task,
- "Thread ID for the breakpoint.\n\
+No other type of value can be used.",
+ NULL },
+ { "task", bppy_get_task, bppy_set_task, "Thread ID for the breakpoint.\n\
If the value is a task ID (integer), then this is an Ada task-specific breakpoint.\n\
If the value is None, then this breakpoint is not task-specific.\n\
-No other type of value can be used.", NULL },
+No other type of value can be used.",
+ NULL },
{ "ignore_count", bppy_get_ignore_count, bppy_set_ignore_count,
"Number of times this breakpoint should be automatically continued.",
NULL },
- { "number", bppy_get_number, NULL,
- "Breakpoint's number assigned by GDB.", NULL },
+ { "number", bppy_get_number, NULL, "Breakpoint's number assigned by GDB.",
+ NULL },
{ "hit_count", bppy_get_hit_count, bppy_set_hit_count,
"Number of times the breakpoint has been hit.\n\
Can be set to zero to clear the count. No other value is valid\n\
-when setting this property.", NULL },
+when setting this property.",
+ NULL },
{ "location", bppy_get_location, NULL,
- "Location of the breakpoint, as specified by the user.", NULL},
+ "Location of the breakpoint, as specified by the user.", NULL },
{ "expression", bppy_get_expression, NULL,
- "Expression of the breakpoint, as specified by the user.", NULL},
+ "Expression of the breakpoint, as specified by the user.", NULL },
{ "condition", bppy_get_condition, bppy_set_condition,
"Condition of the breakpoint, as specified by the user,\
-or None if no condition set."},
+or None if no condition set." },
{ "commands", bppy_get_commands, bppy_set_commands,
- "Commands of the breakpoint, as specified by the user."},
- { "type", bppy_get_type, NULL,
- "Type of breakpoint."},
+ "Commands of the breakpoint, as specified by the user." },
+ { "type", bppy_get_type, NULL, "Type of breakpoint." },
{ "visible", bppy_get_visibility, NULL,
- "Whether the breakpoint is visible to the user."},
+ "Whether the breakpoint is visible to the user." },
{ "temporary", bppy_get_temporary, NULL,
- "Whether this breakpoint is a temporary breakpoint."},
+ "Whether this breakpoint is a temporary breakpoint." },
{ "pending", bppy_get_pending, NULL,
- "Whether this breakpoint is a pending breakpoint."},
+ "Whether this breakpoint is a pending breakpoint." },
{ "locations", bppy_get_locations, NULL,
- "Get locations where this breakpoint was set"},
- { NULL } /* Sentinel. */
+ "Get locations where this breakpoint was set" },
+ { NULL } /* Sentinel. */
};
-static PyMethodDef breakpoint_object_methods[] =
-{
+static PyMethodDef breakpoint_object_methods[] = {
{ "is_valid", bppy_is_valid, METH_NOARGS,
"Return true if this breakpoint is valid, false if not." },
{ "delete", bppy_delete_breakpoint, METH_NOARGS,
@@ -1378,59 +1365,56 @@ static PyMethodDef breakpoint_object_methods[] =
{ NULL } /* Sentinel. */
};
-PyTypeObject breakpoint_object_type =
-{
- PyVarObject_HEAD_INIT (NULL, 0)
- "gdb.Breakpoint", /*tp_name*/
- sizeof (gdbpy_breakpoint_object), /*tp_basicsize*/
- 0, /*tp_itemsize*/
- 0, /*tp_dealloc*/
- 0, /*tp_print*/
- 0, /*tp_getattr*/
- 0, /*tp_setattr*/
- 0, /*tp_compare*/
- 0, /*tp_repr*/
- 0, /*tp_as_number*/
- 0, /*tp_as_sequence*/
- 0, /*tp_as_mapping*/
- 0, /*tp_hash */
- 0, /*tp_call*/
- 0, /*tp_str*/
- 0, /*tp_getattro*/
- (setattrofunc)local_setattro, /*tp_setattro */
- 0, /*tp_as_buffer*/
- Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /*tp_flags*/
- "GDB breakpoint object", /* tp_doc */
- 0, /* tp_traverse */
- 0, /* tp_clear */
- 0, /* tp_richcompare */
- 0, /* tp_weaklistoffset */
- 0, /* tp_iter */
- 0, /* tp_iternext */
- breakpoint_object_methods, /* tp_methods */
- 0, /* tp_members */
- breakpoint_object_getset, /* tp_getset */
- 0, /* tp_base */
- 0, /* tp_dict */
- 0, /* tp_descr_get */
- 0, /* tp_descr_set */
- 0, /* tp_dictoffset */
- bppy_init, /* tp_init */
- 0, /* tp_alloc */
+PyTypeObject breakpoint_object_type = {
+ PyVarObject_HEAD_INIT (NULL, 0) "gdb.Breakpoint", /*tp_name*/
+ sizeof (gdbpy_breakpoint_object), /*tp_basicsize*/
+ 0, /*tp_itemsize*/
+ 0, /*tp_dealloc*/
+ 0, /*tp_print*/
+ 0, /*tp_getattr*/
+ 0, /*tp_setattr*/
+ 0, /*tp_compare*/
+ 0, /*tp_repr*/
+ 0, /*tp_as_number*/
+ 0, /*tp_as_sequence*/
+ 0, /*tp_as_mapping*/
+ 0, /*tp_hash */
+ 0, /*tp_call*/
+ 0, /*tp_str*/
+ 0, /*tp_getattro*/
+ (setattrofunc) local_setattro, /*tp_setattro */
+ 0, /*tp_as_buffer*/
+ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /*tp_flags*/
+ "GDB breakpoint object", /* tp_doc */
+ 0, /* tp_traverse */
+ 0, /* tp_clear */
+ 0, /* tp_richcompare */
+ 0, /* tp_weaklistoffset */
+ 0, /* tp_iter */
+ 0, /* tp_iternext */
+ breakpoint_object_methods, /* tp_methods */
+ 0, /* tp_members */
+ breakpoint_object_getset, /* tp_getset */
+ 0, /* tp_base */
+ 0, /* tp_dict */
+ 0, /* tp_descr_get */
+ 0, /* tp_descr_set */
+ 0, /* tp_dictoffset */
+ bppy_init, /* tp_init */
+ 0, /* tp_alloc */
};
void _initialize_py_breakpoint ();
+
void
_initialize_py_breakpoint ()
{
- add_setshow_boolean_cmd
- ("py-breakpoint", class_maintenance, &pybp_debug,
- _("Set Python breakpoint debugging."),
- _("Show Python breakpoint debugging."),
- _("When on, Python breakpoint debugging is enabled."),
- NULL,
- show_pybp_debug,
- &setdebuglist, &showdebuglist);
+ add_setshow_boolean_cmd (
+ "py-breakpoint", class_maintenance, &pybp_debug,
+ _ ("Set Python breakpoint debugging."),
+ _ ("Show Python breakpoint debugging."),
+ _ ("When on, Python breakpoint debugging is enabled."), NULL,
+ show_pybp_debug, &setdebuglist, &showdebuglist);
}
/* Python function to set the enabled state of a breakpoint location. */
@@ -1445,13 +1429,13 @@ bplocpy_set_enabled (PyObject *py_self, PyObject *newvalue, void *closure)
if (newvalue == nullptr)
{
PyErr_SetString (PyExc_TypeError,
- _("Cannot delete 'enabled' attribute."));
+ _ ("Cannot delete 'enabled' attribute."));
return -1;
}
else if (!PyBool_Check (newvalue))
{
PyErr_SetString (PyExc_TypeError,
- _("The value of 'enabled' must be a boolean."));
+ _ ("The value of 'enabled' must be a boolean."));
return -1;
}
@@ -1586,8 +1570,7 @@ bplocpy_get_fullname (PyObject *py_self, void *closure)
const auto symtab = self->bp_loc->symtab;
if (symtab != nullptr && symtab->fullname != nullptr)
{
- gdbpy_ref<> fullname
- = host_string_to_python_string (symtab->fullname);
+ gdbpy_ref<> fullname = host_string_to_python_string (symtab->fullname);
return fullname.release ();
}
Py_RETURN_NONE;
@@ -1599,7 +1582,7 @@ static void
bplocpy_dealloc (PyObject *py_self)
{
auto *self = (gdbpy_breakpoint_location_object *) py_self;
- bp_location_ref_ptr decrementing_ref {self->bp_loc};
+ bp_location_ref_ptr decrementing_ref { self->bp_loc };
Py_XDECREF (self->owner);
Py_TYPE (py_self)->tp_free (py_self);
}
@@ -1609,58 +1592,56 @@ bplocpy_dealloc (PyObject *py_self)
static gdb_PyGetSetDef bp_location_object_getset[] = {
{ "enabled", bplocpy_get_enabled, bplocpy_set_enabled,
"Boolean telling whether the breakpoint is enabled.", NULL },
- { "owner", bplocpy_get_owner, NULL,
- "Get the breakpoint owner object", NULL },
+ { "owner", bplocpy_get_owner, NULL, "Get the breakpoint owner object",
+ NULL },
{ "address", bplocpy_get_address, NULL,
- "Get address of where this location was set", NULL},
+ "Get address of where this location was set", NULL },
{ "source", bplocpy_get_source_location, NULL,
- "Get file and line number of where this location was set", NULL},
+ "Get file and line number of where this location was set", NULL },
{ "function", bplocpy_get_function, NULL,
"Get function of where this location was set", NULL },
{ "fullname", bplocpy_get_fullname, NULL,
"Get fullname of where this location was set", NULL },
{ "thread_groups", bplocpy_get_thread_groups, NULL,
"Get thread groups where this location is in", NULL },
- { NULL } /* Sentinel. */
+ { NULL } /* Sentinel. */
};
-PyTypeObject breakpoint_location_object_type =
-{
- PyVarObject_HEAD_INIT (NULL, 0)
- "gdb.BreakpointLocation", /*tp_name*/
- sizeof (gdbpy_breakpoint_location_object), /*tp_basicsize*/
- 0, /*tp_itemsize*/
- bplocpy_dealloc, /*tp_dealloc*/
- 0, /*tp_print*/
- 0, /*tp_getattr*/
- 0, /*tp_setattr*/
- 0, /*tp_compare*/
- 0, /*tp_repr*/
- 0, /*tp_as_number*/
- 0, /*tp_as_sequence*/
- 0, /*tp_as_mapping*/
- 0, /*tp_hash */
- 0, /*tp_call*/
- 0, /*tp_str*/
- 0, /*tp_getattro*/
- 0, /*tp_setattro */
- 0, /*tp_as_buffer*/
- Py_TPFLAGS_DEFAULT, /*tp_flags*/
- "GDB breakpoint location object", /* tp_doc */
- 0, /* tp_traverse */
- 0, /* tp_clear */
- 0, /* tp_richcompare */
- 0, /* tp_weaklistoffset */
- 0, /* tp_iter */
- 0, /* tp_iternext */
- 0, /* tp_methods */
- 0, /* tp_members */
- bp_location_object_getset, /* tp_getset */
- 0, /* tp_base */
- 0, /* tp_dict */
- 0, /* tp_descr_get */
- 0, /* tp_descr_set */
- 0, /* tp_dictoffset */
- 0, /* tp_init */
- 0, /* tp_alloc */
+PyTypeObject breakpoint_location_object_type = {
+ PyVarObject_HEAD_INIT (NULL, 0) "gdb.BreakpointLocation", /*tp_name*/
+ sizeof (gdbpy_breakpoint_location_object), /*tp_basicsize*/
+ 0, /*tp_itemsize*/
+ bplocpy_dealloc, /*tp_dealloc*/
+ 0, /*tp_print*/
+ 0, /*tp_getattr*/
+ 0, /*tp_setattr*/
+ 0, /*tp_compare*/
+ 0, /*tp_repr*/
+ 0, /*tp_as_number*/
+ 0, /*tp_as_sequence*/
+ 0, /*tp_as_mapping*/
+ 0, /*tp_hash */
+ 0, /*tp_call*/
+ 0, /*tp_str*/
+ 0, /*tp_getattro*/
+ 0, /*tp_setattro */
+ 0, /*tp_as_buffer*/
+ Py_TPFLAGS_DEFAULT, /*tp_flags*/
+ "GDB breakpoint location object", /* tp_doc */
+ 0, /* tp_traverse */
+ 0, /* tp_clear */
+ 0, /* tp_richcompare */
+ 0, /* tp_weaklistoffset */
+ 0, /* tp_iter */
+ 0, /* tp_iternext */
+ 0, /* tp_methods */
+ 0, /* tp_members */
+ bp_location_object_getset, /* tp_getset */
+ 0, /* tp_base */
+ 0, /* tp_dict */
+ 0, /* tp_descr_get */
+ 0, /* tp_descr_set */
+ 0, /* tp_dictoffset */
+ 0, /* tp_init */
+ 0, /* tp_alloc */
};
diff --git a/gdb/python/py-cmd.c b/gdb/python/py-cmd.c
index f7fc79e16fe..8984dbdcf9c 100644
--- a/gdb/python/py-cmd.c
+++ b/gdb/python/py-cmd.c
@@ -17,7 +17,6 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
-
#include "defs.h"
#include "arch-utils.h"
#include "value.h"
@@ -37,8 +36,7 @@ struct cmdpy_completer
completer_ftype *completer;
};
-static const struct cmdpy_completer completers[] =
-{
+static const struct cmdpy_completer completers[] = {
{ "COMPLETE_NONE", noop_completer },
{ "COMPLETE_FILENAME", filename_completer },
{ "COMPLETE_LOCATION", location_completer },
@@ -55,9 +53,9 @@ struct cmdpy_object
{
PyObject_HEAD
- /* The corresponding gdb command object, or NULL if the command is
+ /* The corresponding gdb command object, or NULL if the command is
no longer installed. */
- struct cmd_list_element *command;
+ struct cmd_list_element *command;
/* A prefix command requires storage for a list of its sub-commands.
A pointer to this is passed to add_prefix_command, and to add_cmd
@@ -66,15 +64,13 @@ struct cmdpy_object
struct cmd_list_element *sub_list;
};
-extern PyTypeObject cmdpy_object_type
- CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF ("cmdpy_object");
+extern PyTypeObject
+ cmdpy_object_type CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF ("cmdpy_object");
/* Constants used by this module. */
static PyObject *invoke_cst;
static PyObject *complete_cst;
-
-
/* Python function which wraps dont_repeat. */
static PyObject *
cmdpy_dont_repeat (PyObject *self, PyObject *args)
@@ -83,8 +79,6 @@ cmdpy_dont_repeat (PyObject *self, PyObject *args)
Py_RETURN_NONE;
}
-
-
/* Called if the gdb cmd_list_element is destroyed. */
static void
@@ -106,26 +100,26 @@ cmdpy_function (const char *args, int from_tty, cmd_list_element *command)
gdbpy_enter enter_py;
- if (! obj)
- error (_("Invalid invocation of Python command object."));
- if (! PyObject_HasAttr ((PyObject *) obj, invoke_cst))
+ if (!obj)
+ error (_ ("Invalid invocation of Python command object."));
+ if (!PyObject_HasAttr ((PyObject *) obj, invoke_cst))
{
if (obj->command->is_prefix ())
{
/* A prefix command does not need an invoke method. */
return;
}
- error (_("Python command object missing 'invoke' method."));
+ error (_ ("Python command object missing 'invoke' method."));
}
- if (! args)
+ if (!args)
args = "";
gdbpy_ref<> argobj (PyUnicode_Decode (args, strlen (args), host_charset (),
NULL));
if (argobj == NULL)
{
gdbpy_print_stack ();
- error (_("Could not convert arguments to Python string."));
+ error (_ ("Could not convert arguments to Python string."));
}
gdbpy_ref<> ttyobj (PyBool_FromLong (from_tty));
@@ -167,13 +161,13 @@ cmdpy_function (const char *args, int from_tty, cmd_list_element *command)
Python method call. */
static gdbpy_ref<>
-cmdpy_completer_helper (struct cmd_list_element *command,
- const char *text, const char *word)
+cmdpy_completer_helper (struct cmd_list_element *command, const char *text,
+ const char *word)
{
cmdpy_object *obj = (cmdpy_object *) command->context ();
if (obj == NULL)
- error (_("Invalid invocation of Python command object."));
+ error (_ ("Invalid invocation of Python command object."));
if (!PyObject_HasAttr ((PyObject *) obj, complete_cst))
{
/* If there is no complete method, don't error. */
@@ -183,7 +177,7 @@ cmdpy_completer_helper (struct cmd_list_element *command,
gdbpy_ref<> textobj (PyUnicode_Decode (text, strlen (text), host_charset (),
NULL));
if (textobj == NULL)
- error (_("Could not convert argument to Python string."));
+ error (_ ("Could not convert argument to Python string."));
gdbpy_ref<> wordobj;
if (word == NULL)
@@ -196,13 +190,11 @@ cmdpy_completer_helper (struct cmd_list_element *command,
wordobj.reset (PyUnicode_Decode (word, strlen (word), host_charset (),
NULL));
if (wordobj == NULL)
- error (_("Could not convert argument to Python string."));
+ error (_ ("Could not convert argument to Python string."));
}
- gdbpy_ref<> resultobj (PyObject_CallMethodObjArgs ((PyObject *) obj,
- complete_cst,
- textobj.get (),
- wordobj.get (), NULL));
+ gdbpy_ref<> resultobj (PyObject_CallMethodObjArgs (
+ (PyObject *) obj, complete_cst, textobj.get (), wordobj.get (), NULL));
if (resultobj == NULL)
{
/* Just swallow errors here. */
@@ -219,8 +211,8 @@ cmdpy_completer_helper (struct cmd_list_element *command,
static void
cmdpy_completer_handle_brkchars (struct cmd_list_element *command,
- completion_tracker &tracker,
- const char *text, const char *word)
+ completion_tracker &tracker, const char *text,
+ const char *word)
{
gdbpy_enter enter_py;
@@ -251,8 +243,8 @@ cmdpy_completer_handle_brkchars (struct cmd_list_element *command,
/* This is the core of this function. Depending on which
completer type the Python function returns, we have to
adjust the break characters accordingly. */
- brkchars_fn = (completer_handle_brkchars_func_for_completer
- (completers[value].completer));
+ brkchars_fn = (completer_handle_brkchars_func_for_completer (
+ completers[value].completer));
brkchars_fn (command, tracker, text, word);
}
}
@@ -261,8 +253,7 @@ cmdpy_completer_handle_brkchars (struct cmd_list_element *command,
/* Called by gdb for command completion. */
static void
-cmdpy_completer (struct cmd_list_element *command,
- completion_tracker &tracker,
+cmdpy_completer (struct cmd_list_element *command, completion_tracker &tracker,
const char *text, const char *word)
{
gdbpy_enter enter_py;
@@ -282,7 +273,7 @@ cmdpy_completer (struct cmd_list_element *command,
thus requesting that sort of completion. */
long value;
- if (! gdb_py_int_as_long (resultobj.get (), &value))
+ if (!gdb_py_int_as_long (resultobj.get (), &value))
{
/* Ignore. */
PyErr_Clear ();
@@ -304,13 +295,13 @@ cmdpy_completer (struct cmd_list_element *command,
if (elt == NULL)
break;
- if (! gdbpy_is_string (elt.get ()))
+ if (!gdbpy_is_string (elt.get ()))
{
/* Skip problem elements. */
continue;
}
- gdb::unique_xmalloc_ptr<char>
- item (python_string_to_host_string (elt.get ()));
+ gdb::unique_xmalloc_ptr<char> item (
+ python_string_to_host_string (elt.get ()));
if (item == NULL)
{
/* Skip problem elements. */
@@ -358,7 +349,7 @@ gdbpy_parse_command_name (const char *name,
;
if (i < 0)
{
- PyErr_SetString (PyExc_RuntimeError, _("No command name found."));
+ PyErr_SetString (PyExc_RuntimeError, _ ("No command name found."));
return NULL;
}
lastchar = i;
@@ -386,7 +377,8 @@ gdbpy_parse_command_name (const char *name,
elt = lookup_cmd_1 (&prefix_text2, *start_list, NULL, NULL, 1);
if (elt == NULL || elt == CMD_LIST_AMBIGUOUS)
{
- PyErr_Format (PyExc_RuntimeError, _("Could not find command prefix %s."),
+ PyErr_Format (PyExc_RuntimeError,
+ _ ("Could not find command prefix %s."),
prefix_text.c_str ());
return NULL;
}
@@ -397,7 +389,7 @@ gdbpy_parse_command_name (const char *name,
return result;
}
- PyErr_Format (PyExc_RuntimeError, _("'%s' is not a prefix command."),
+ PyErr_Format (PyExc_RuntimeError, _ ("'%s' is not a prefix command."),
prefix_text.c_str ());
return NULL;
}
@@ -430,8 +422,8 @@ cmdpy_init (PyObject *self, PyObject *args, PyObject *kw)
int cmdtype;
int completetype = -1;
struct cmd_list_element **cmd_list;
- static const char *keywords[] = { "name", "command_class", "completer_class",
- "prefix", NULL };
+ static const char *keywords[]
+ = { "name", "command_class", "completer_class", "prefix", NULL };
PyObject *is_prefix_obj = NULL;
bool is_prefix = false;
@@ -440,31 +432,30 @@ cmdpy_init (PyObject *self, PyObject *args, PyObject *kw)
/* Note: this is apparently not documented in Python. We return
0 for success, -1 for failure. */
PyErr_Format (PyExc_RuntimeError,
- _("Command object already initialized."));
+ _ ("Command object already initialized."));
return -1;
}
- if (!gdb_PyArg_ParseTupleAndKeywords (args, kw, "si|iO",
- keywords, &name, &cmdtype,
- &completetype, &is_prefix_obj))
+ if (!gdb_PyArg_ParseTupleAndKeywords (args, kw, "si|iO", keywords, &name,
+ &cmdtype, &completetype,
+ &is_prefix_obj))
return -1;
- if (cmdtype != no_class && cmdtype != class_run
- && cmdtype != class_vars && cmdtype != class_stack
- && cmdtype != class_files && cmdtype != class_support
- && cmdtype != class_info && cmdtype != class_breakpoint
- && cmdtype != class_trace && cmdtype != class_obscure
- && cmdtype != class_maintenance && cmdtype != class_user
- && cmdtype != class_tui)
+ if (cmdtype != no_class && cmdtype != class_run && cmdtype != class_vars
+ && cmdtype != class_stack && cmdtype != class_files
+ && cmdtype != class_support && cmdtype != class_info
+ && cmdtype != class_breakpoint && cmdtype != class_trace
+ && cmdtype != class_obscure && cmdtype != class_maintenance
+ && cmdtype != class_user && cmdtype != class_tui)
{
- PyErr_Format (PyExc_RuntimeError, _("Invalid command class argument."));
+ PyErr_Format (PyExc_RuntimeError, _ ("Invalid command class argument."));
return -1;
}
if (completetype < -1 || completetype >= (int) N_COMPLETERS)
{
PyErr_Format (PyExc_RuntimeError,
- _("Invalid completion type argument."));
+ _ ("Invalid completion type argument."));
return -1;
}
@@ -496,7 +487,7 @@ cmdpy_init (PyObject *self, PyObject *args, PyObject *kw)
}
}
if (docstring == nullptr)
- docstring = make_unique_xstrdup (_("This command is not documented."));
+ docstring = make_unique_xstrdup (_ ("This command is not documented."));
gdbpy_ref<> self_ref = gdbpy_ref<>::new_reference (self);
@@ -511,8 +502,7 @@ cmdpy_init (PyObject *self, PyObject *args, PyObject *kw)
/* If we have our own "invoke" method, then allow unknown
sub-commands. */
allow_unknown = PyObject_HasAttr (self, invoke_cst);
- cmd = add_prefix_cmd (cmd_name.get (),
- (enum command_class) cmdtype,
+ cmd = add_prefix_cmd (cmd_name.get (), (enum command_class) cmdtype,
NULL, docstring.release (), &obj->sub_list,
allow_unknown, cmd_list);
}
@@ -532,8 +522,9 @@ cmdpy_init (PyObject *self, PyObject *args, PyObject *kw)
obj->command = cmd;
cmd->set_context (self_ref.release ());
- set_cmd_completer (cmd, ((completetype == -1) ? cmdpy_completer
- : completers[completetype].completer));
+ set_cmd_completer (cmd, ((completetype == -1)
+ ? cmdpy_completer
+ : completers[completetype].completer));
if (completetype == -1)
set_cmd_completer_handle_brkchars (cmd,
cmdpy_completer_handle_brkchars);
@@ -547,8 +538,6 @@ cmdpy_init (PyObject *self, PyObject *args, PyObject *kw)
return 0;
}
-
-
/* Initialize the 'commands' code. */
int
@@ -566,17 +555,20 @@ gdbpy_initialize_commands (void)
|| PyModule_AddIntConstant (gdb_module, "COMMAND_DATA", class_vars) < 0
|| PyModule_AddIntConstant (gdb_module, "COMMAND_STACK", class_stack) < 0
|| PyModule_AddIntConstant (gdb_module, "COMMAND_FILES", class_files) < 0
- || PyModule_AddIntConstant (gdb_module, "COMMAND_SUPPORT",
- class_support) < 0
+ || PyModule_AddIntConstant (gdb_module, "COMMAND_SUPPORT", class_support)
+ < 0
|| PyModule_AddIntConstant (gdb_module, "COMMAND_STATUS", class_info) < 0
|| PyModule_AddIntConstant (gdb_module, "COMMAND_BREAKPOINTS",
- class_breakpoint) < 0
+ class_breakpoint)
+ < 0
|| PyModule_AddIntConstant (gdb_module, "COMMAND_TRACEPOINTS",
- class_trace) < 0
- || PyModule_AddIntConstant (gdb_module, "COMMAND_OBSCURE",
- class_obscure) < 0
+ class_trace)
+ < 0
+ || PyModule_AddIntConstant (gdb_module, "COMMAND_OBSCURE", class_obscure)
+ < 0
|| PyModule_AddIntConstant (gdb_module, "COMMAND_MAINTENANCE",
- class_maintenance) < 0
+ class_maintenance)
+ < 0
|| PyModule_AddIntConstant (gdb_module, "COMMAND_USER", class_user) < 0
|| PyModule_AddIntConstant (gdb_module, "COMMAND_TUI", class_tui) < 0)
return -1;
@@ -588,7 +580,8 @@ gdbpy_initialize_commands (void)
}
if (gdb_pymodule_addobject (gdb_module, "Command",
- (PyObject *) &cmdpy_object_type) < 0)
+ (PyObject *) &cmdpy_object_type)
+ < 0)
return -1;
invoke_cst = PyUnicode_FromString ("invoke");
@@ -601,59 +594,51 @@ gdbpy_initialize_commands (void)
return 0;
}
-
-
-static PyMethodDef cmdpy_object_methods[] =
-{
- { "dont_repeat", cmdpy_dont_repeat, METH_NOARGS,
- "Prevent command repetition when user enters empty line." },
-
- { 0 }
+static PyMethodDef cmdpy_object_methods[]
+ = { { "dont_repeat", cmdpy_dont_repeat, METH_NOARGS,
+ "Prevent command repetition when user enters empty line." },
+
+ { 0 } };
+
+PyTypeObject cmdpy_object_type = {
+ PyVarObject_HEAD_INIT (NULL, 0) "gdb.Command", /*tp_name*/
+ sizeof (cmdpy_object), /*tp_basicsize*/
+ 0, /*tp_itemsize*/
+ 0, /*tp_dealloc*/
+ 0, /*tp_print*/
+ 0, /*tp_getattr*/
+ 0, /*tp_setattr*/
+ 0, /*tp_compare*/
+ 0, /*tp_repr*/
+ 0, /*tp_as_number*/
+ 0, /*tp_as_sequence*/
+ 0, /*tp_as_mapping*/
+ 0, /*tp_hash */
+ 0, /*tp_call*/
+ 0, /*tp_str*/
+ 0, /*tp_getattro*/
+ 0, /*tp_setattro*/
+ 0, /*tp_as_buffer*/
+ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /*tp_flags*/
+ "GDB command object", /* tp_doc */
+ 0, /* tp_traverse */
+ 0, /* tp_clear */
+ 0, /* tp_richcompare */
+ 0, /* tp_weaklistoffset */
+ 0, /* tp_iter */
+ 0, /* tp_iternext */
+ cmdpy_object_methods, /* tp_methods */
+ 0, /* tp_members */
+ 0, /* tp_getset */
+ 0, /* tp_base */
+ 0, /* tp_dict */
+ 0, /* tp_descr_get */
+ 0, /* tp_descr_set */
+ 0, /* tp_dictoffset */
+ cmdpy_init, /* tp_init */
+ 0, /* tp_alloc */
};
-PyTypeObject cmdpy_object_type =
-{
- PyVarObject_HEAD_INIT (NULL, 0)
- "gdb.Command", /*tp_name*/
- sizeof (cmdpy_object), /*tp_basicsize*/
- 0, /*tp_itemsize*/
- 0, /*tp_dealloc*/
- 0, /*tp_print*/
- 0, /*tp_getattr*/
- 0, /*tp_setattr*/
- 0, /*tp_compare*/
- 0, /*tp_repr*/
- 0, /*tp_as_number*/
- 0, /*tp_as_sequence*/
- 0, /*tp_as_mapping*/
- 0, /*tp_hash */
- 0, /*tp_call*/
- 0, /*tp_str*/
- 0, /*tp_getattro*/
- 0, /*tp_setattro*/
- 0, /*tp_as_buffer*/
- Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /*tp_flags*/
- "GDB command object", /* tp_doc */
- 0, /* tp_traverse */
- 0, /* tp_clear */
- 0, /* tp_richcompare */
- 0, /* tp_weaklistoffset */
- 0, /* tp_iter */
- 0, /* tp_iternext */
- cmdpy_object_methods, /* tp_methods */
- 0, /* tp_members */
- 0, /* tp_getset */
- 0, /* tp_base */
- 0, /* tp_dict */
- 0, /* tp_descr_get */
- 0, /* tp_descr_set */
- 0, /* tp_dictoffset */
- cmdpy_init, /* tp_init */
- 0, /* tp_alloc */
-};
-
-
-
/* Utility to build a buildargv-like result from ARGS.
This intentionally parses arguments the way libiberty/argv.c:buildargv
does. It splits up arguments in a reasonable way, and we want a standard
@@ -685,8 +670,7 @@ gdbpy_string_to_argv (PyObject *self, PyObject *args)
{
gdbpy_ref<> argp (PyUnicode_FromString (arg));
- if (argp == NULL
- || PyList_Append (py_argv.get (), argp.get ()) < 0)
+ if (argp == NULL || PyList_Append (py_argv.get (), argp.get ()) < 0)
return NULL;
}
}
diff --git a/gdb/python/py-connection.c b/gdb/python/py-connection.c
index 84435eb3119..0f5e332c4d9 100644
--- a/gdb/python/py-connection.c
+++ b/gdb/python/py-connection.c
@@ -37,13 +37,13 @@ struct connection_object
{
PyObject_HEAD
- /* The process target that represents this connection. When a
+ /* The process target that represents this connection. When a
connection_object is created this field will always point at a valid
target. Later, if GDB stops using this target (the target is popped
from all target stacks) then this field is set to nullptr, which
indicates that this Python object is now in the invalid state (see
the is_valid() method below). */
- struct process_stratum_target *target;
+ struct process_stratum_target *target;
};
extern PyTypeObject connection_object_type
@@ -53,21 +53,23 @@ extern PyTypeObject remote_connection_object_type
CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF ("remote_connection_object");
/* Require that CONNECTION be valid. */
-#define CONNPY_REQUIRE_VALID(connection) \
- do { \
- if (connection->target == nullptr) \
- { \
- PyErr_SetString (PyExc_RuntimeError, \
- _("Connection no longer exists.")); \
- return nullptr; \
- } \
- } while (0)
+#define CONNPY_REQUIRE_VALID(connection) \
+ do \
+ { \
+ if (connection->target == nullptr) \
+ { \
+ PyErr_SetString (PyExc_RuntimeError, \
+ _ ("Connection no longer exists.")); \
+ return nullptr; \
+ } \
+ } \
+ while (0)
/* A map between process_stratum targets and the Python object representing
them. We actually hold a gdbpy_ref around the Python object so that
reference counts are handled correctly when entries are deleted. */
-static std::map<process_stratum_target *,
- gdbpy_ref<connection_object>> all_connection_objects;
+static std::map<process_stratum_target *, gdbpy_ref<connection_object>>
+ all_connection_objects;
/* Return a reference to a gdb.TargetConnection object for TARGET. If
TARGET is nullptr then a reference to None is returned.
@@ -82,7 +84,7 @@ target_to_connection_object (process_stratum_target *target)
if (target == nullptr)
return gdbpy_ref<>::new_reference (Py_None);
- gdbpy_ref <connection_object> conn_obj;
+ gdbpy_ref<connection_object> conn_obj;
auto conn_obj_iter = all_connection_objects.find (target);
if (conn_obj_iter == all_connection_objects.end ())
{
@@ -141,8 +143,7 @@ static int
emit_connection_event (process_stratum_target *target,
eventregistry_object *registry)
{
- gdbpy_ref<> event_obj
- = create_event_object (&connection_event_object_type);
+ gdbpy_ref<> event_obj = create_event_object (&connection_event_object_type);
if (event_obj == nullptr)
return -1;
@@ -170,7 +171,7 @@ connpy_connection_removed (process_stratum_target *target)
auto conn_obj_iter = all_connection_objects.find (target);
if (conn_obj_iter != all_connection_objects.end ())
{
- gdbpy_ref <connection_object> conn_obj = conn_obj_iter->second;
+ gdbpy_ref<connection_object> conn_obj = conn_obj_iter->second;
conn_obj->target = nullptr;
all_connection_objects.erase (target);
}
@@ -206,10 +207,10 @@ connpy_repr (PyObject *obj)
if (target == nullptr)
return PyUnicode_FromFormat ("<%s (invalid)>", Py_TYPE (obj)->tp_name);
- return PyUnicode_FromFormat ("<%s num=%d, what=\"%s\">",
- Py_TYPE (obj)->tp_name,
- target->connection_number,
- make_target_connection_string (target).c_str ());
+ return PyUnicode_FromFormat (
+ "<%s num=%d, what=\"%s\">", Py_TYPE (obj)->tp_name,
+ target->connection_number,
+ make_target_connection_string (target).c_str ());
}
/* Implementation of gdb.TargetConnection.is_valid() -> Boolean. Returns
@@ -292,14 +293,16 @@ gdbpy_initialize_connection (void)
return -1;
if (gdb_pymodule_addobject (gdb_module, "TargetConnection",
- (PyObject *) &connection_object_type) < 0)
+ (PyObject *) &connection_object_type)
+ < 0)
return -1;
if (PyType_Ready (&remote_connection_object_type) < 0)
return -1;
if (gdb_pymodule_addobject (gdb_module, "RemoteTargetConnection",
- (PyObject *) &remote_connection_object_type) < 0)
+ (PyObject *) &remote_connection_object_type)
+ < 0)
return -1;
return 0;
@@ -315,12 +318,14 @@ struct py_send_packet_callbacks : public send_remote_packet_callbacks
py_send_packet_callbacks ()
: m_result (nullptr)
- { /* Nothing. */ }
+ { /* Nothing. */
+ }
/* There's nothing to do when the packet is sent. */
void sending (gdb::array_view<const char> &buf) override
- { /* Nothing. */ }
+ { /* Nothing. */
+ }
/* When the result is returned create a Python object and assign this
into M_RESULT. If for any reason we can't create a Python object to
@@ -353,10 +358,7 @@ struct py_send_packet_callbacks : public send_remote_packet_callbacks
Python functions that might clear the error state, or rely on an error
not being set will cause undefined behaviour. */
- gdbpy_ref<> result () const
- {
- return m_result;
- }
+ gdbpy_ref<> result () const { return m_result; }
private:
@@ -377,11 +379,10 @@ connpy_send_packet (PyObject *self, PyObject *args, PyObject *kw)
CONNPY_REQUIRE_VALID (conn);
- static const char *keywords[] = {"packet", nullptr};
+ static const char *keywords[] = { "packet", nullptr };
PyObject *packet_obj;
- if (!gdb_PyArg_ParseTupleAndKeywords (args, kw, "O", keywords,
- &packet_obj))
+ if (!gdb_PyArg_ParseTupleAndKeywords (args, kw, "O", keywords, &packet_obj))
return nullptr;
/* If the packet is a unicode string then convert it to a bytes object. */
@@ -397,21 +398,21 @@ connpy_send_packet (PyObject *self, PyObject *args, PyObject *kw)
/* Check the packet is now a bytes object. */
if (!PyBytes_Check (packet_obj))
{
- PyErr_SetString (PyExc_TypeError, _("Packet is not a bytes object"));
+ PyErr_SetString (PyExc_TypeError, _ ("Packet is not a bytes object"));
return nullptr;
}
Py_ssize_t packet_len = 0;
char *packet_str_nonconst = nullptr;
- if (PyBytes_AsStringAndSize (packet_obj, &packet_str_nonconst,
- &packet_len) < 0)
+ if (PyBytes_AsStringAndSize (packet_obj, &packet_str_nonconst, &packet_len)
+ < 0)
return nullptr;
const char *packet_str = packet_str_nonconst;
gdb_assert (packet_str != nullptr);
if (packet_len == 0)
{
- PyErr_SetString (PyExc_ValueError, _("Packet must not be empty"));
+ PyErr_SetString (PyExc_ValueError, _ ("Packet must not be empty"));
return nullptr;
}
@@ -440,6 +441,7 @@ connpy_send_packet (PyObject *self, PyObject *args, PyObject *kw)
/* Global initialization for this file. */
void _initialize_py_connection ();
+
void
_initialize_py_connection ()
{
@@ -449,122 +451,110 @@ _initialize_py_connection ()
/* Methods for the gdb.TargetConnection object type. */
-static PyMethodDef connection_object_methods[] =
-{
- { "is_valid", connpy_is_valid, METH_NOARGS,
- "is_valid () -> Boolean.\n\
+static PyMethodDef connection_object_methods[]
+ = { { "is_valid", connpy_is_valid, METH_NOARGS, "is_valid () -> Boolean.\n\
Return true if this TargetConnection is valid, false if not." },
- { NULL }
-};
+ { NULL } };
/* Methods for the gdb.RemoteTargetConnection object type. */
-static PyMethodDef remote_connection_object_methods[] =
-{
- { "send_packet", (PyCFunction) connpy_send_packet,
- METH_VARARGS | METH_KEYWORDS,
- "send_packet (PACKET) -> Bytes\n\
+static PyMethodDef remote_connection_object_methods[]
+ = { { "send_packet", (PyCFunction) connpy_send_packet,
+ METH_VARARGS | METH_KEYWORDS, "send_packet (PACKET) -> Bytes\n\
Send PACKET to a remote target, return the reply as a bytes array." },
- { NULL }
-};
+ { NULL } };
/* Attributes for the gdb.TargetConnection object type. */
-static gdb_PyGetSetDef connection_object_getset[] =
-{
- { "num", connpy_get_connection_num, NULL,
- "ID number of this connection, as assigned by GDB.", NULL },
- { "type", connpy_get_connection_type, NULL,
- "A short string that is the name for this connection type.", NULL },
- { "description", connpy_get_description, NULL,
- "A longer string describing this connection type.", NULL },
- { "details", connpy_get_connection_details, NULL,
- "A string containing additional connection details.", NULL },
- { NULL }
-};
+static gdb_PyGetSetDef connection_object_getset[]
+ = { { "num", connpy_get_connection_num, NULL,
+ "ID number of this connection, as assigned by GDB.", NULL },
+ { "type", connpy_get_connection_type, NULL,
+ "A short string that is the name for this connection type.", NULL },
+ { "description", connpy_get_description, NULL,
+ "A longer string describing this connection type.", NULL },
+ { "details", connpy_get_connection_details, NULL,
+ "A string containing additional connection details.", NULL },
+ { NULL } };
/* Define the gdb.TargetConnection object type. */
-PyTypeObject connection_object_type =
-{
- PyVarObject_HEAD_INIT (NULL, 0)
- "gdb.TargetConnection", /* tp_name */
- sizeof (connection_object), /* tp_basicsize */
- 0, /* tp_itemsize */
- connpy_connection_dealloc, /* tp_dealloc */
- 0, /* tp_print */
- 0, /* tp_getattr */
- 0, /* tp_setattr */
- 0, /* tp_compare */
- connpy_repr, /* tp_repr */
- 0, /* tp_as_number */
- 0, /* tp_as_sequence */
- 0, /* tp_as_mapping */
- 0, /* tp_hash */
- 0, /* tp_call */
- 0, /* tp_str */
- 0, /* tp_getattro */
- 0, /* tp_setattro */
- 0, /* tp_as_buffer */
- Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */
- "GDB target connection object", /* tp_doc */
- 0, /* tp_traverse */
- 0, /* tp_clear */
- 0, /* tp_richcompare */
- 0, /* tp_weaklistoffset */
- 0, /* tp_iter */
- 0, /* tp_iternext */
- connection_object_methods, /* tp_methods */
- 0, /* tp_members */
- connection_object_getset, /* tp_getset */
- 0, /* tp_base */
- 0, /* tp_dict */
- 0, /* tp_descr_get */
- 0, /* tp_descr_set */
- 0, /* tp_dictoffset */
- 0, /* tp_init */
- 0 /* tp_alloc */
+PyTypeObject connection_object_type = {
+ PyVarObject_HEAD_INIT (NULL, 0) "gdb.TargetConnection", /* tp_name */
+ sizeof (connection_object), /* tp_basicsize */
+ 0, /* tp_itemsize */
+ connpy_connection_dealloc, /* tp_dealloc */
+ 0, /* tp_print */
+ 0, /* tp_getattr */
+ 0, /* tp_setattr */
+ 0, /* tp_compare */
+ connpy_repr, /* tp_repr */
+ 0, /* tp_as_number */
+ 0, /* tp_as_sequence */
+ 0, /* tp_as_mapping */
+ 0, /* tp_hash */
+ 0, /* tp_call */
+ 0, /* tp_str */
+ 0, /* tp_getattro */
+ 0, /* tp_setattro */
+ 0, /* tp_as_buffer */
+ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */
+ "GDB target connection object", /* tp_doc */
+ 0, /* tp_traverse */
+ 0, /* tp_clear */
+ 0, /* tp_richcompare */
+ 0, /* tp_weaklistoffset */
+ 0, /* tp_iter */
+ 0, /* tp_iternext */
+ connection_object_methods, /* tp_methods */
+ 0, /* tp_members */
+ connection_object_getset, /* tp_getset */
+ 0, /* tp_base */
+ 0, /* tp_dict */
+ 0, /* tp_descr_get */
+ 0, /* tp_descr_set */
+ 0, /* tp_dictoffset */
+ 0, /* tp_init */
+ 0 /* tp_alloc */
};
/* Define the gdb.RemoteTargetConnection object type. */
-PyTypeObject remote_connection_object_type =
-{
- PyVarObject_HEAD_INIT (NULL, 0)
- "gdb.RemoteTargetConnection", /* tp_name */
- sizeof (connection_object), /* tp_basicsize */
- 0, /* tp_itemsize */
- connpy_connection_dealloc, /* tp_dealloc */
- 0, /* tp_print */
- 0, /* tp_getattr */
- 0, /* tp_setattr */
- 0, /* tp_compare */
- connpy_repr, /* tp_repr */
- 0, /* tp_as_number */
- 0, /* tp_as_sequence */
- 0, /* tp_as_mapping */
- 0, /* tp_hash */
- 0, /* tp_call */
- 0, /* tp_str */
- 0, /* tp_getattro */
- 0, /* tp_setattro */
- 0, /* tp_as_buffer */
- Py_TPFLAGS_DEFAULT, /* tp_flags */
- "GDB remote target connection object", /* tp_doc */
- 0, /* tp_traverse */
- 0, /* tp_clear */
- 0, /* tp_richcompare */
- 0, /* tp_weaklistoffset */
- 0, /* tp_iter */
- 0, /* tp_iternext */
- remote_connection_object_methods, /* tp_methods */
- 0, /* tp_members */
- 0, /* tp_getset */
- &connection_object_type, /* tp_base */
- 0, /* tp_dict */
- 0, /* tp_descr_get */
- 0, /* tp_descr_set */
- 0, /* tp_dictoffset */
- 0, /* tp_init */
- 0 /* tp_alloc */
+PyTypeObject remote_connection_object_type = {
+ PyVarObject_HEAD_INIT (NULL, 0) "gdb.RemoteTargetConnection", /* tp_name */
+ sizeof (connection_object), /* tp_basicsize */
+ 0, /* tp_itemsize */
+ connpy_connection_dealloc, /* tp_dealloc */
+ 0, /* tp_print */
+ 0, /* tp_getattr */
+ 0, /* tp_setattr */
+ 0, /* tp_compare */
+ connpy_repr, /* tp_repr */
+ 0, /* tp_as_number */
+ 0, /* tp_as_sequence */
+ 0, /* tp_as_mapping */
+ 0, /* tp_hash */
+ 0, /* tp_call */
+ 0, /* tp_str */
+ 0, /* tp_getattro */
+ 0, /* tp_setattro */
+ 0, /* tp_as_buffer */
+ Py_TPFLAGS_DEFAULT, /* tp_flags */
+ "GDB remote target connection object", /* tp_doc */
+ 0, /* tp_traverse */
+ 0, /* tp_clear */
+ 0, /* tp_richcompare */
+ 0, /* tp_weaklistoffset */
+ 0, /* tp_iter */
+ 0, /* tp_iternext */
+ remote_connection_object_methods, /* tp_methods */
+ 0, /* tp_members */
+ 0, /* tp_getset */
+ &connection_object_type, /* tp_base */
+ 0, /* tp_dict */
+ 0, /* tp_descr_get */
+ 0, /* tp_descr_set */
+ 0, /* tp_dictoffset */
+ 0, /* tp_init */
+ 0 /* tp_alloc */
};
diff --git a/gdb/python/py-dap.c b/gdb/python/py-dap.c
index 32f927214d7..44b9e28c548 100644
--- a/gdb/python/py-dap.c
+++ b/gdb/python/py-dap.c
@@ -37,18 +37,11 @@ public:
void init (bool top_level) override;
- void suspend () override
- {
- }
+ void suspend () override {}
- void resume () override
- {
- }
+ void resume () override {}
- void exec (const char *command) override
- {
- /* Just ignore it. */
- }
+ void exec (const char *command) override { /* Just ignore it. */ }
void set_logging (ui_file_up logfile, bool logging_redirect,
bool debug_redirect) override
@@ -56,10 +49,7 @@ public:
/* Just ignore it. */
}
- ui_out *interp_ui_out () override
- {
- return m_ui_out.get ();
- }
+ ui_out *interp_ui_out () override { return m_ui_out.get (); }
private:
@@ -88,11 +78,11 @@ dap_interp::init (bool top_level)
}
void _initialize_py_interp ();
+
void
_initialize_py_interp ()
{
- interp_factory_register ("dap", [] (const char *name) -> interp *
- {
- return new dap_interp (name);
- });
+ interp_factory_register ("dap", [] (const char *name) -> interp * {
+ return new dap_interp (name);
+ });
}
diff --git a/gdb/python/py-disasm.c b/gdb/python/py-disasm.c
index c3d8d8a7994..8743727ea58 100644
--- a/gdb/python/py-disasm.c
+++ b/gdb/python/py-disasm.c
@@ -33,8 +33,8 @@ struct disasm_info_object
{
PyObject_HEAD
- /* The architecture in which we are disassembling. */
- struct gdbarch *gdbarch;
+ /* The architecture in which we are disassembling. */
+ struct gdbarch *gdbarch;
/* The program_space in which we are disassembling. */
struct program_space *program_space;
@@ -54,7 +54,7 @@ struct disasm_info_object
};
extern PyTypeObject disasm_info_object_type
- CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF ("disasm_info_object");
+ CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF ("disasm_info_object");
/* Implement gdb.disassembler.DisassemblerResult type, an object that holds
the result of calling the disassembler. This is mostly the length of
@@ -65,8 +65,8 @@ struct disasm_result_object
{
PyObject_HEAD
- /* The length of the disassembled instruction in bytes. */
- int length;
+ /* The length of the disassembled instruction in bytes. */
+ int length;
/* A buffer which, when allocated, holds the disassembled content of an
instruction. */
@@ -74,7 +74,7 @@ struct disasm_result_object
};
extern PyTypeObject disasm_result_object_type
- CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF ("disasm_result_object");
+ CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF ("disasm_result_object");
/* When this is false we fast path out of gdbpy_print_insn, which should
keep the performance impact of the Python disassembler down. This is
@@ -94,11 +94,7 @@ struct gdbpy_disassembler : public gdb_printing_disassembler
gdbpy_disassembler (disasm_info_object *obj, PyObject *memory_source);
/* Get the DisassembleInfo object pointer. */
- disasm_info_object *
- py_disasm_info () const
- {
- return m_disasm_info_object;
- }
+ disasm_info_object *py_disasm_info () const { return m_disasm_info_object; }
/* Callbacks used by disassemble_info. */
static void memory_error_func (int status, bfd_vma memaddr,
@@ -113,15 +109,14 @@ struct gdbpy_disassembler : public gdb_printing_disassembler
memory error occurred. The optional will only have a value if a
memory error actually occurred. */
const gdb::optional<CORE_ADDR> &memory_error_address () const
- { return m_memory_error_address; }
+ {
+ return m_memory_error_address;
+ }
/* Return the content of the disassembler as a string. The contents are
moved out of the disassembler, so after this call the disassembler
contents have been reset back to empty. */
- std::string release ()
- {
- return m_string_file.release ();
- }
+ std::string release () { return m_string_file.release (); }
/* If there is a Python exception stored in this disassembler then
restore it (i.e. set the PyErr_* state), clear the exception within
@@ -215,14 +210,13 @@ disasm_info_init (PyObject *self, PyObject *args, PyObject *kwargs)
static const char *keywords[] = { "info", NULL };
PyObject *info_obj;
if (!gdb_PyArg_ParseTupleAndKeywords (args, kwargs, "O!", keywords,
- &disasm_info_object_type,
- &info_obj))
+ &disasm_info_object_type, &info_obj))
return -1;
disasm_info_object *other = (disasm_info_object *) info_obj;
disasm_info_object *info = (disasm_info_object *) self;
- disasm_info_fill (info, other->gdbarch, other->program_space,
- other->address, other->gdb_info, other->next);
+ disasm_info_fill (info, other->gdbarch, other->program_space, other->address,
+ other->gdb_info, other->next);
other->next = info;
/* As the OTHER object now holds a pointer to INFO we inc the ref count
@@ -273,15 +267,17 @@ disasmpy_set_memory_error_for_address (CORE_ADDR address)
/* Ensure that a gdb.disassembler.DisassembleInfo is valid. */
-#define DISASMPY_DISASM_INFO_REQUIRE_VALID(Info) \
- do { \
- if (!disasm_info_object_is_valid (Info)) \
- { \
- PyErr_SetString (PyExc_RuntimeError, \
- _("DisassembleInfo is no longer valid.")); \
- return nullptr; \
- } \
- } while (0)
+#define DISASMPY_DISASM_INFO_REQUIRE_VALID(Info) \
+ do \
+ { \
+ if (!disasm_info_object_is_valid (Info)) \
+ { \
+ PyErr_SetString (PyExc_RuntimeError, \
+ _ ("DisassembleInfo is no longer valid.")); \
+ return nullptr; \
+ } \
+ } \
+ while (0)
/* Initialise OBJ, a DisassemblerResult object with LENGTH and CONTENT.
OBJ might already have been initialised, in which case any existing
@@ -342,7 +338,6 @@ disasmpy_builtin_disassemble (PyObject *self, PyObject *args, PyObject *kw)
if (length == -1)
{
-
/* In an ideal world, every disassembler should always call the
memory error function before returning a status of -1 as the only
error a disassembler should encounter is a failure to read
@@ -365,7 +360,7 @@ disasmpy_builtin_disassemble (PyObject *self, PyObject *args, PyObject *kw)
PyErr_SetString (gdbpy_gdberror_exc, content.c_str ());
else
PyErr_SetString (gdbpy_gdberror_exc,
- _("Unknown disassembly error."));
+ _ ("Unknown disassembly error."));
}
return nullptr;
}
@@ -380,8 +375,8 @@ disasmpy_builtin_disassemble (PyObject *self, PyObject *args, PyObject *kw)
/* Create a DisassemblerResult containing the results. */
std::string content = disassembler.release ();
PyTypeObject *type = &disasm_result_object_type;
- gdbpy_ref<disasm_result_object> res
- ((disasm_result_object *) type->tp_alloc (type, 0));
+ gdbpy_ref<disasm_result_object> res ((disasm_result_object *)
+ type->tp_alloc (type, 0));
disasmpy_init_disassembler_result (res.get (), length, std::move (content));
return reinterpret_cast<PyObject *> (res.release ());
}
@@ -403,14 +398,14 @@ disasmpy_set_enabled (PyObject *self, PyObject *args, PyObject *kw)
{
PyObject *newstate;
static const char *keywords[] = { "state", nullptr };
- if (!gdb_PyArg_ParseTupleAndKeywords (args, kw, "O", keywords,
- &newstate))
+ if (!gdb_PyArg_ParseTupleAndKeywords (args, kw, "O", keywords, &newstate))
return nullptr;
if (!PyBool_Check (newstate))
{
- PyErr_SetString (PyExc_TypeError,
- _("The value passed to `_set_enabled' must be a boolean."));
+ PyErr_SetString (
+ PyExc_TypeError,
+ _ ("The value passed to `_set_enabled' must be a boolean."));
return nullptr;
}
@@ -435,8 +430,8 @@ disasmpy_info_read_memory (PyObject *self, PyObject *args, PyObject *kw)
gdb::unique_xmalloc_ptr<gdb_byte> buffer;
static const char *keywords[] = { "length", "offset", nullptr };
- if (!gdb_PyArg_ParseTupleAndKeywords (args, kw, "L|L", keywords,
- &length, &offset))
+ if (!gdb_PyArg_ParseTupleAndKeywords (args, kw, "L|L", keywords, &length,
+ &offset))
return nullptr;
/* The apparent address from which we are reading memory. Note that in
@@ -454,7 +449,8 @@ disasmpy_info_read_memory (PyObject *self, PyObject *args, PyObject *kw)
it to the user. */
disassemble_info *info = obj->gdb_info;
if (info->read_memory_func ((bfd_vma) address, buffer.get (),
- (unsigned int) length, info) != 0)
+ (unsigned int) length, info)
+ != 0)
{
disasmpy_set_memory_error_for_address (address);
return nullptr;
@@ -535,8 +531,7 @@ gdbpy_disassembler::read_memory_func (bfd_vma memaddr, gdb_byte *buff,
/* Now call the DisassembleInfo.read_memory method. This might have been
overridden by the user. */
- gdbpy_ref<> result_obj (PyObject_CallMethod ((PyObject *) obj,
- "read_memory",
+ gdbpy_ref<> result_obj (PyObject_CallMethod ((PyObject *) obj, "read_memory",
"KL", len, offset));
/* Handle any exceptions. */
@@ -565,10 +560,10 @@ gdbpy_disassembler::read_memory_func (bfd_vma memaddr, gdb_byte *buff,
/* Convert the result to a buffer. */
Py_buffer py_buff;
if (!PyObject_CheckBuffer (result_obj.get ())
- || PyObject_GetBuffer (result_obj.get(), &py_buff, PyBUF_CONTIG_RO) < 0)
+ || PyObject_GetBuffer (result_obj.get (), &py_buff, PyBUF_CONTIG_RO) < 0)
{
PyErr_Format (PyExc_TypeError,
- _("Result from read_memory is not a buffer"));
+ _ ("Result from read_memory is not a buffer"));
dis->store_exception (gdbpy_err_fetch ());
return -1;
}
@@ -581,7 +576,8 @@ gdbpy_disassembler::read_memory_func (bfd_vma memaddr, gdb_byte *buff,
if (py_buff.len != len)
{
PyErr_Format (PyExc_ValueError,
- _("Buffer returned from read_memory is sized %d instead of the expected %d"),
+ _ ("Buffer returned from read_memory is sized %d instead "
+ "of the expected %d"),
py_buff.len, len);
dis->store_exception (gdbpy_err_fetch ());
return -1;
@@ -614,8 +610,7 @@ disasmpy_result_string (PyObject *self, void *closure)
gdb_assert (obj->content != nullptr);
gdb_assert (strlen (obj->content->c_str ()) > 0);
gdb_assert (obj->length > 0);
- return PyUnicode_Decode (obj->content->c_str (),
- obj->content->size (),
+ return PyUnicode_Decode (obj->content->c_str (), obj->content->size (),
host_charset (), nullptr);
}
@@ -629,21 +624,19 @@ disasmpy_result_init (PyObject *self, PyObject *args, PyObject *kwargs)
static const char *keywords[] = { "length", "string", NULL };
int length;
const char *string;
- if (!gdb_PyArg_ParseTupleAndKeywords (args, kwargs, "is", keywords,
- &length, &string))
+ if (!gdb_PyArg_ParseTupleAndKeywords (args, kwargs, "is", keywords, &length,
+ &string))
return -1;
if (length <= 0)
{
- PyErr_SetString (PyExc_ValueError,
- _("Length must be greater than 0."));
+ PyErr_SetString (PyExc_ValueError, _ ("Length must be greater than 0."));
return -1;
}
if (strlen (string) == 0)
{
- PyErr_SetString (PyExc_ValueError,
- _("String must not be empty."));
+ PyErr_SetString (PyExc_ValueError, _ ("String must not be empty."));
return -1;
}
@@ -681,12 +674,12 @@ gdbpy_disassembler::print_address_func (bfd_vma addr,
gdbpy_disassembler::gdbpy_disassembler (disasm_info_object *obj,
PyObject *memory_source)
- : gdb_printing_disassembler (obj->gdbarch, &m_string_file,
- read_memory_func, memory_error_func,
- print_address_func),
+ : gdb_printing_disassembler (obj->gdbarch, &m_string_file, read_memory_func,
+ memory_error_func, print_address_func),
m_disasm_info_object (obj),
m_memory_source (memory_source)
-{ /* Nothing. */ }
+{ /* Nothing. */
+}
/* A wrapper around a reference to a Python DisassembleInfo object, which
ensures that the object is marked as invalid when we leave the enclosing
@@ -717,26 +710,20 @@ struct scoped_disasm_info_object
{
/* Invalidate the original DisassembleInfo object as well as any copies
that the user might have made. */
- for (disasm_info_object *obj = m_disasm_info.get ();
- obj != nullptr;
+ for (disasm_info_object *obj = m_disasm_info.get (); obj != nullptr;
obj = obj->next)
obj->gdb_info = nullptr;
}
/* Return a pointer to the underlying disasm_info_object instance. */
- disasm_info_object *
- get () const
- {
- return m_disasm_info.get ();
- }
+ disasm_info_object *get () const { return m_disasm_info.get (); }
private:
/* Wrapper around the call to PyObject_New, this wrapper function can be
called from the constructor initialization list, while PyObject_New, a
macro, can't. */
- static disasm_info_object *
- allocate_disasm_info_object ()
+ static disasm_info_object *allocate_disasm_info_object ()
{
return (disasm_info_object *) PyObject_New (disasm_info_object,
&disasm_info_object_type);
@@ -768,8 +755,8 @@ gdbpy_print_insn (struct gdbarch *gdbarch, CORE_ADDR memaddr,
gdbpy_enter enter_py (get_current_arch (), current_language);
/* Import the gdb.disassembler module. */
- gdbpy_ref<> gdb_python_disassembler_module
- (PyImport_ImportModule ("gdb.disassembler"));
+ gdbpy_ref<> gdb_python_disassembler_module (
+ PyImport_ImportModule ("gdb.disassembler"));
if (gdb_python_disassembler_module == nullptr)
{
gdbpy_print_stack ();
@@ -778,9 +765,8 @@ gdbpy_print_insn (struct gdbarch *gdbarch, CORE_ADDR memaddr,
/* Get the _print_insn attribute from the module, this should be the
function we are going to call to actually perform the disassembly. */
- gdbpy_ref<> hook
- (PyObject_GetAttrString (gdb_python_disassembler_module.get (),
- "_print_insn"));
+ gdbpy_ref<> hook (PyObject_GetAttrString (
+ gdb_python_disassembler_module.get (), "_print_insn"));
if (hook == nullptr)
{
gdbpy_print_stack ();
@@ -796,8 +782,7 @@ gdbpy_print_insn (struct gdbarch *gdbarch, CORE_ADDR memaddr,
disassembly. */
PyObject *insn_disas_obj = (PyObject *) disasm_info;
gdbpy_ref<> result (PyObject_CallFunctionObjArgs (hook.get (),
- insn_disas_obj,
- nullptr));
+ insn_disas_obj, nullptr));
if (result == nullptr)
{
@@ -846,7 +831,6 @@ gdbpy_print_insn (struct gdbarch *gdbarch, CORE_ADDR memaddr,
gdbpy_print_stack ();
return gdb::optional<int> (-1);
}
-
}
else if (result == Py_None)
{
@@ -861,7 +845,7 @@ gdbpy_print_insn (struct gdbarch *gdbarch, CORE_ADDR memaddr,
(PyObject *) &disasm_result_object_type))
{
PyErr_SetString (PyExc_TypeError,
- _("Result is not a DisassemblerResult."));
+ _ ("Result is not a DisassemblerResult."));
gdbpy_print_stack ();
return gdb::optional<int> (-1);
}
@@ -883,7 +867,8 @@ gdbpy_print_insn (struct gdbarch *gdbarch, CORE_ADDR memaddr,
}
if (!gdbpy_is_string (string_obj.get ()))
{
- PyErr_SetString (PyExc_TypeError, _("String attribute is not a string."));
+ PyErr_SetString (PyExc_TypeError,
+ _ ("String attribute is not a string."));
gdbpy_print_stack ();
return gdb::optional<int> (-1);
}
@@ -903,22 +888,23 @@ gdbpy_print_insn (struct gdbarch *gdbarch, CORE_ADDR memaddr,
return gdb::optional<int> (-1);
}
- long max_insn_length = (gdbarch_max_insn_length_p (gdbarch) ?
- gdbarch_max_insn_length (gdbarch) : INT_MAX);
+ long max_insn_length
+ = (gdbarch_max_insn_length_p (gdbarch) ? gdbarch_max_insn_length (gdbarch)
+ : INT_MAX);
if (length <= 0)
{
- PyErr_SetString
- (PyExc_ValueError,
- _("Invalid length attribute: length must be greater than 0."));
+ PyErr_SetString (
+ PyExc_ValueError,
+ _ ("Invalid length attribute: length must be greater than 0."));
gdbpy_print_stack ();
return gdb::optional<int> (-1);
}
if (length > max_insn_length)
{
- PyErr_Format
- (PyExc_ValueError,
- _("Invalid length attribute: length %d greater than architecture maximum of %d"),
- length, max_insn_length);
+ PyErr_Format (PyExc_ValueError,
+ _ ("Invalid length attribute: length %d greater than "
+ "architecture maximum of %d"),
+ length, max_insn_length);
gdbpy_print_stack ();
return gdb::optional<int> (-1);
}
@@ -926,7 +912,7 @@ gdbpy_print_insn (struct gdbarch *gdbarch, CORE_ADDR memaddr,
if (strlen (string.get ()) == 0)
{
PyErr_SetString (PyExc_ValueError,
- _("String attribute must not be empty."));
+ _ ("String attribute must not be empty."));
gdbpy_print_stack ();
return gdb::optional<int> (-1);
}
@@ -957,20 +943,19 @@ static gdb_PyGetSetDef disasm_info_object_getset[] = {
"Architecture to disassemble in", nullptr },
{ "progspace", disasmpy_info_progspace, nullptr,
"Program space to disassemble in", nullptr },
- { nullptr } /* Sentinel */
+ { nullptr } /* Sentinel */
};
/* The methods of the gdb.disassembler.DisassembleInfo type. */
static PyMethodDef disasm_info_object_methods[] = {
{ "read_memory", (PyCFunction) disasmpy_info_read_memory,
- METH_VARARGS | METH_KEYWORDS,
- "read_memory (LEN, OFFSET = 0) -> Octets[]\n\
+ METH_VARARGS | METH_KEYWORDS, "read_memory (LEN, OFFSET = 0) -> Octets[]\n\
Read LEN octets for the instruction to disassemble." },
{ "is_valid", disasmpy_info_is_valid, METH_NOARGS,
"is_valid () -> Boolean.\n\
Return true if this DisassembleInfo is valid, false if not." },
- {nullptr} /* Sentinel */
+ { nullptr } /* Sentinel */
};
/* The get/set attributes of the gdb.disassembler.DisassemblerResult type. */
@@ -980,42 +965,37 @@ static gdb_PyGetSetDef disasm_result_object_getset[] = {
"Length of the disassembled instruction.", nullptr },
{ "string", disasmpy_result_string, nullptr,
"String representing the disassembled instruction.", nullptr },
- { nullptr } /* Sentinel */
+ { nullptr } /* Sentinel */
};
/* These are the methods we add into the _gdb.disassembler module, which
are then imported into the gdb.disassembler module. These are global
functions that support performing disassembly. */
-PyMethodDef python_disassembler_methods[] =
-{
- { "builtin_disassemble", (PyCFunction) disasmpy_builtin_disassemble,
- METH_VARARGS | METH_KEYWORDS,
- "builtin_disassemble (INFO, MEMORY_SOURCE = None) -> None\n\
+PyMethodDef python_disassembler_methods[]
+ = { { "builtin_disassemble", (PyCFunction) disasmpy_builtin_disassemble,
+ METH_VARARGS | METH_KEYWORDS,
+ "builtin_disassemble (INFO, MEMORY_SOURCE = None) -> None\n\
Disassemble using GDB's builtin disassembler. INFO is an instance of\n\
gdb.disassembler.DisassembleInfo. The MEMORY_SOURCE, if not None, should\n\
be an object with the read_memory method." },
- { "_set_enabled", (PyCFunction) disasmpy_set_enabled,
- METH_VARARGS | METH_KEYWORDS,
- "_set_enabled (STATE) -> None\n\
+ { "_set_enabled", (PyCFunction) disasmpy_set_enabled,
+ METH_VARARGS | METH_KEYWORDS, "_set_enabled (STATE) -> None\n\
Set whether GDB should call into the Python _print_insn code or not." },
- {nullptr, nullptr, 0, nullptr}
-};
+ { nullptr, nullptr, 0, nullptr } };
/* Structure to define the _gdb.disassembler module. */
-static struct PyModuleDef python_disassembler_module_def =
-{
- PyModuleDef_HEAD_INIT,
- "_gdb.disassembler",
- nullptr,
- -1,
- python_disassembler_methods,
- nullptr,
- nullptr,
- nullptr,
- nullptr
-};
+static struct PyModuleDef python_disassembler_module_def
+ = { PyModuleDef_HEAD_INIT,
+ "_gdb.disassembler",
+ nullptr,
+ -1,
+ python_disassembler_methods,
+ nullptr,
+ nullptr,
+ nullptr,
+ nullptr };
/* Called to initialize the Python structures in this file. */
@@ -1028,7 +1008,7 @@ gdbpy_initialize_disasm ()
gdb_disassembler_module = PyModule_Create (&python_disassembler_module_def);
if (gdb_disassembler_module == nullptr)
return -1;
- PyModule_AddObject(gdb_module, "disassembler", gdb_disassembler_module);
+ PyModule_AddObject (gdb_module, "disassembler", gdb_disassembler_module);
/* This is needed so that 'import _gdb.disassembler' will work. */
PyObject *dict = PyImport_GetModuleDict ();
@@ -1039,7 +1019,8 @@ gdbpy_initialize_disasm ()
return -1;
if (gdb_pymodule_addobject (gdb_disassembler_module, "DisassembleInfo",
- (PyObject *) &disasm_info_object_type) < 0)
+ (PyObject *) &disasm_info_object_type)
+ < 0)
return -1;
disasm_result_object_type.tp_new = PyType_GenericNew;
@@ -1047,7 +1028,8 @@ gdbpy_initialize_disasm ()
return -1;
if (gdb_pymodule_addobject (gdb_disassembler_module, "DisassemblerResult",
- (PyObject *) &disasm_result_object_type) < 0)
+ (PyObject *) &disasm_result_object_type)
+ < 0)
return -1;
return 0;
@@ -1056,83 +1038,83 @@ gdbpy_initialize_disasm ()
/* Describe the gdb.disassembler.DisassembleInfo type. */
PyTypeObject disasm_info_object_type = {
- PyVarObject_HEAD_INIT (nullptr, 0)
- "gdb.disassembler.DisassembleInfo", /*tp_name*/
- sizeof (disasm_info_object), /*tp_basicsize*/
- 0, /*tp_itemsize*/
- disasm_info_dealloc, /*tp_dealloc*/
- 0, /*tp_print*/
- 0, /*tp_getattr*/
- 0, /*tp_setattr*/
- 0, /*tp_compare*/
- 0, /*tp_repr*/
- 0, /*tp_as_number*/
- 0, /*tp_as_sequence*/
- 0, /*tp_as_mapping*/
- 0, /*tp_hash */
- 0, /*tp_call*/
- 0, /*tp_str*/
- 0, /*tp_getattro*/
- 0, /*tp_setattro*/
- 0, /*tp_as_buffer*/
- Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /*tp_flags*/
- "GDB instruction disassembler object", /* tp_doc */
- 0, /* tp_traverse */
- 0, /* tp_clear */
- 0, /* tp_richcompare */
- 0, /* tp_weaklistoffset */
- 0, /* tp_iter */
- 0, /* tp_iternext */
- disasm_info_object_methods, /* tp_methods */
- 0, /* tp_members */
- disasm_info_object_getset, /* tp_getset */
- 0, /* tp_base */
- 0, /* tp_dict */
- 0, /* tp_descr_get */
- 0, /* tp_descr_set */
- 0, /* tp_dictoffset */
- disasm_info_init, /* tp_init */
- 0, /* tp_alloc */
+ PyVarObject_HEAD_INIT (nullptr,
+ 0) "gdb.disassembler.DisassembleInfo", /*tp_name*/
+ sizeof (disasm_info_object), /*tp_basicsize*/
+ 0, /*tp_itemsize*/
+ disasm_info_dealloc, /*tp_dealloc*/
+ 0, /*tp_print*/
+ 0, /*tp_getattr*/
+ 0, /*tp_setattr*/
+ 0, /*tp_compare*/
+ 0, /*tp_repr*/
+ 0, /*tp_as_number*/
+ 0, /*tp_as_sequence*/
+ 0, /*tp_as_mapping*/
+ 0, /*tp_hash */
+ 0, /*tp_call*/
+ 0, /*tp_str*/
+ 0, /*tp_getattro*/
+ 0, /*tp_setattro*/
+ 0, /*tp_as_buffer*/
+ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /*tp_flags*/
+ "GDB instruction disassembler object", /* tp_doc */
+ 0, /* tp_traverse */
+ 0, /* tp_clear */
+ 0, /* tp_richcompare */
+ 0, /* tp_weaklistoffset */
+ 0, /* tp_iter */
+ 0, /* tp_iternext */
+ disasm_info_object_methods, /* tp_methods */
+ 0, /* tp_members */
+ disasm_info_object_getset, /* tp_getset */
+ 0, /* tp_base */
+ 0, /* tp_dict */
+ 0, /* tp_descr_get */
+ 0, /* tp_descr_set */
+ 0, /* tp_dictoffset */
+ disasm_info_init, /* tp_init */
+ 0, /* tp_alloc */
};
/* Describe the gdb.disassembler.DisassemblerResult type. */
PyTypeObject disasm_result_object_type = {
- PyVarObject_HEAD_INIT (nullptr, 0)
- "gdb.disassembler.DisassemblerResult", /*tp_name*/
- sizeof (disasm_result_object), /*tp_basicsize*/
- 0, /*tp_itemsize*/
- disasmpy_dealloc_result, /*tp_dealloc*/
- 0, /*tp_print*/
- 0, /*tp_getattr*/
- 0, /*tp_setattr*/
- 0, /*tp_compare*/
- 0, /*tp_repr*/
- 0, /*tp_as_number*/
- 0, /*tp_as_sequence*/
- 0, /*tp_as_mapping*/
- 0, /*tp_hash */
- 0, /*tp_call*/
- 0, /*tp_str*/
- 0, /*tp_getattro*/
- 0, /*tp_setattro*/
- 0, /*tp_as_buffer*/
- Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /*tp_flags*/
- "GDB object, representing a disassembler result", /* tp_doc */
- 0, /* tp_traverse */
- 0, /* tp_clear */
- 0, /* tp_richcompare */
- 0, /* tp_weaklistoffset */
- 0, /* tp_iter */
- 0, /* tp_iternext */
- 0, /* tp_methods */
- 0, /* tp_members */
- disasm_result_object_getset, /* tp_getset */
- 0, /* tp_base */
- 0, /* tp_dict */
- 0, /* tp_descr_get */
- 0, /* tp_descr_set */
- 0, /* tp_dictoffset */
- disasmpy_result_init, /* tp_init */
- 0, /* tp_alloc */
+ PyVarObject_HEAD_INIT (nullptr,
+ 0) "gdb.disassembler.DisassemblerResult", /*tp_name*/
+ sizeof (disasm_result_object), /*tp_basicsize*/
+ 0, /*tp_itemsize*/
+ disasmpy_dealloc_result, /*tp_dealloc*/
+ 0, /*tp_print*/
+ 0, /*tp_getattr*/
+ 0, /*tp_setattr*/
+ 0, /*tp_compare*/
+ 0, /*tp_repr*/
+ 0, /*tp_as_number*/
+ 0, /*tp_as_sequence*/
+ 0, /*tp_as_mapping*/
+ 0, /*tp_hash */
+ 0, /*tp_call*/
+ 0, /*tp_str*/
+ 0, /*tp_getattro*/
+ 0, /*tp_setattro*/
+ 0, /*tp_as_buffer*/
+ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /*tp_flags*/
+ "GDB object, representing a disassembler result", /* tp_doc */
+ 0, /* tp_traverse */
+ 0, /* tp_clear */
+ 0, /* tp_richcompare */
+ 0, /* tp_weaklistoffset */
+ 0, /* tp_iter */
+ 0, /* tp_iternext */
+ 0, /* tp_methods */
+ 0, /* tp_members */
+ disasm_result_object_getset, /* tp_getset */
+ 0, /* tp_base */
+ 0, /* tp_dict */
+ 0, /* tp_descr_get */
+ 0, /* tp_descr_set */
+ 0, /* tp_dictoffset */
+ disasmpy_result_init, /* tp_init */
+ 0, /* tp_alloc */
};
diff --git a/gdb/python/py-event.c b/gdb/python/py-event.c
index 3ff31acf85b..b1db186fb7a 100644
--- a/gdb/python/py-event.c
+++ b/gdb/python/py-event.c
@@ -57,8 +57,7 @@ evpy_add_attribute (PyObject *event, const char *name, PyObject *attr)
int
gdbpy_initialize_event (void)
{
- return gdbpy_initialize_event_generic (&event_object_type,
- "Event");
+ return gdbpy_initialize_event_generic (&event_object_type, "Event");
}
/* Initialize the given event type. If BASE is not NULL it will
@@ -66,8 +65,7 @@ gdbpy_initialize_event (void)
Returns 0 if initialization was successful -1 otherwise. */
int
-gdbpy_initialize_event_generic (PyTypeObject *type,
- const char *name)
+gdbpy_initialize_event_generic (PyTypeObject *type, const char *name)
{
if (PyType_Ready (type) < 0)
return -1;
@@ -75,13 +73,11 @@ gdbpy_initialize_event_generic (PyTypeObject *type,
return gdb_pymodule_addobject (gdb_module, name, (PyObject *) type);
}
-
/* Notify the list of listens that the given EVENT has occurred.
returns 0 if emit is successful -1 otherwise. */
int
-evpy_emit_event (PyObject *event,
- eventregistry_object *registry)
+evpy_emit_event (PyObject *event, eventregistry_object *registry)
{
Py_ssize_t i;
@@ -114,50 +110,46 @@ evpy_emit_event (PyObject *event,
return 0;
}
-static gdb_PyGetSetDef event_object_getset[] =
-{
- { "__dict__", gdb_py_generic_dict, NULL,
- "The __dict__ for this event.", &event_object_type },
- { NULL }
-};
-
-PyTypeObject event_object_type =
-{
- PyVarObject_HEAD_INIT (NULL, 0)
- "gdb.Event", /* tp_name */
- sizeof (event_object), /* tp_basicsize */
- 0, /* tp_itemsize */
- evpy_dealloc, /* tp_dealloc */
- 0, /* tp_print */
- 0, /* tp_getattr */
- 0, /* tp_setattr */
- 0, /* tp_compare */
- 0, /* tp_repr */
- 0, /* tp_as_number */
- 0, /* tp_as_sequence */
- 0, /* tp_as_mapping */
- 0, /* tp_hash */
- 0, /* tp_call */
- 0, /* tp_str */
- 0, /* tp_getattro */
- 0, /* tp_setattro */
- 0, /* tp_as_buffer */
- Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */
- "GDB event object", /* tp_doc */
- 0, /* tp_traverse */
- 0, /* tp_clear */
- 0, /* tp_richcompare */
- 0, /* tp_weaklistoffset */
- 0, /* tp_iter */
- 0, /* tp_iternext */
- 0, /* tp_methods */
- 0, /* tp_members */
- event_object_getset, /* tp_getset */
- 0, /* tp_base */
- 0, /* tp_dict */
- 0, /* tp_descr_get */
- 0, /* tp_descr_set */
- offsetof (event_object, dict), /* tp_dictoffset */
- 0, /* tp_init */
- 0 /* tp_alloc */
+static gdb_PyGetSetDef event_object_getset[]
+ = { { "__dict__", gdb_py_generic_dict, NULL, "The __dict__ for this event.",
+ &event_object_type },
+ { NULL } };
+
+PyTypeObject event_object_type = {
+ PyVarObject_HEAD_INIT (NULL, 0) "gdb.Event", /* tp_name */
+ sizeof (event_object), /* tp_basicsize */
+ 0, /* tp_itemsize */
+ evpy_dealloc, /* tp_dealloc */
+ 0, /* tp_print */
+ 0, /* tp_getattr */
+ 0, /* tp_setattr */
+ 0, /* tp_compare */
+ 0, /* tp_repr */
+ 0, /* tp_as_number */
+ 0, /* tp_as_sequence */
+ 0, /* tp_as_mapping */
+ 0, /* tp_hash */
+ 0, /* tp_call */
+ 0, /* tp_str */
+ 0, /* tp_getattro */
+ 0, /* tp_setattro */
+ 0, /* tp_as_buffer */
+ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */
+ "GDB event object", /* tp_doc */
+ 0, /* tp_traverse */
+ 0, /* tp_clear */
+ 0, /* tp_richcompare */
+ 0, /* tp_weaklistoffset */
+ 0, /* tp_iter */
+ 0, /* tp_iternext */
+ 0, /* tp_methods */
+ 0, /* tp_members */
+ event_object_getset, /* tp_getset */
+ 0, /* tp_base */
+ 0, /* tp_dict */
+ 0, /* tp_descr_get */
+ 0, /* tp_descr_set */
+ offsetof (event_object, dict), /* tp_dictoffset */
+ 0, /* tp_init */
+ 0 /* tp_alloc */
};
diff --git a/gdb/python/py-event.h b/gdb/python/py-event.h
index 0a7d31d02e9..e213f4e0f24 100644
--- a/gdb/python/py-event.h
+++ b/gdb/python/py-event.h
@@ -27,8 +27,8 @@
/* Declare all event types. */
#define GDB_PY_DEFINE_EVENT_TYPE(name, py_name, doc, base) \
- extern PyTypeObject name##_event_object_type \
- CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF ("event_object");
+ extern PyTypeObject name##_event_object_type \
+ CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF ("event_object");
#include "py-event-types.def"
#undef GDB_PY_DEFINE_EVENT_TYPE
@@ -36,7 +36,7 @@ struct event_object
{
PyObject_HEAD
- PyObject *dict;
+ PyObject *dict;
};
extern int emit_continue_event (ptid_t ptid);
@@ -53,13 +53,11 @@ enum inferior_call_kind
INFERIOR_CALL_POST,
};
-extern int emit_inferior_call_event (inferior_call_kind kind,
- ptid_t thread, CORE_ADDR addr);
-extern int emit_register_changed_event (frame_info_ptr frame,
- int regnum);
+extern int emit_inferior_call_event (inferior_call_kind kind, ptid_t thread,
+ CORE_ADDR addr);
+extern int emit_register_changed_event (frame_info_ptr frame, int regnum);
extern int emit_memory_changed_event (CORE_ADDR addr, ssize_t len);
-extern int evpy_emit_event (PyObject *event,
- eventregistry_object *registry);
+extern int evpy_emit_event (PyObject *event, eventregistry_object *registry);
extern gdbpy_ref<> create_event_object (PyTypeObject *py_type);
@@ -78,9 +76,9 @@ extern int emit_free_objfile_event (struct objfile *objfile);
extern int emit_clear_objfiles_event (void);
extern void evpy_dealloc (PyObject *self);
-extern int evpy_add_attribute (PyObject *event,
- const char *name, PyObject *attr)
- CPYCHECKER_NEGATIVE_RESULT_SETS_EXCEPTION;
+extern int
+evpy_add_attribute (PyObject *event, const char *name,
+ PyObject *attr) CPYCHECKER_NEGATIVE_RESULT_SETS_EXCEPTION;
int gdbpy_initialize_event_generic (PyTypeObject *type, const char *name)
CPYCHECKER_NEGATIVE_RESULT_SETS_EXCEPTION;
diff --git a/gdb/python/py-events.h b/gdb/python/py-events.h
index 89fd99b13ab..bcfd47ef402 100644
--- a/gdb/python/py-events.h
+++ b/gdb/python/py-events.h
@@ -31,7 +31,7 @@ struct eventregistry_object
{
PyObject_HEAD
- PyObject *callbacks;
+ PyObject *callbacks;
};
/* Struct holding references to event registries both in python and c.
@@ -39,13 +39,11 @@ struct eventregistry_object
struct events_object
{
-#define GDB_PY_DEFINE_EVENT(name) \
- eventregistry_object *name;
+#define GDB_PY_DEFINE_EVENT(name) eventregistry_object *name;
#include "py-all-events.def"
#undef GDB_PY_DEFINE_EVENT
PyObject *module;
-
};
/* Python events singleton. */
diff --git a/gdb/python/py-evtregistry.c b/gdb/python/py-evtregistry.c
index 49c43593381..374b36693d1 100644
--- a/gdb/python/py-evtregistry.c
+++ b/gdb/python/py-evtregistry.c
@@ -24,7 +24,7 @@
events_object gdb_py_events;
extern PyTypeObject eventregistry_object_type
- CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF ("eventregistry_object");
+ CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF ("eventregistry_object");
/* Implementation of EventRegistry.connect () -> NULL.
Add FUNCTION to the list of listeners. */
@@ -79,9 +79,8 @@ evregpy_disconnect (PyObject *self, PyObject *function)
eventregistry_object *
create_eventregistry_object (void)
{
- gdbpy_ref<eventregistry_object>
- eventregistry_obj (PyObject_New (eventregistry_object,
- &eventregistry_object_type));
+ gdbpy_ref<eventregistry_object> eventregistry_obj (
+ PyObject_New (eventregistry_object, &eventregistry_object_type));
if (eventregistry_obj == NULL)
return NULL;
@@ -123,50 +122,47 @@ evregpy_no_listeners_p (eventregistry_object *registry)
return registry == nullptr || PyList_Size (registry->callbacks) == 0;
}
-static PyMethodDef eventregistry_object_methods[] =
-{
+static PyMethodDef eventregistry_object_methods[] = {
{ "connect", evregpy_connect, METH_VARARGS, "Add function" },
{ "disconnect", evregpy_disconnect, METH_VARARGS, "Remove function" },
{ NULL } /* Sentinel. */
};
-PyTypeObject eventregistry_object_type =
-{
- PyVarObject_HEAD_INIT (NULL, 0)
- "gdb.EventRegistry", /* tp_name */
- sizeof (eventregistry_object), /* tp_basicsize */
- 0, /* tp_itemsize */
- evregpy_dealloc, /* tp_dealloc */
- 0, /* tp_print */
- 0, /* tp_getattr */
- 0, /* tp_setattr */
- 0, /* tp_compare */
- 0, /* tp_repr */
- 0, /* tp_as_number */
- 0, /* tp_as_sequence */
- 0, /* tp_as_mapping */
- 0, /* tp_hash */
- 0, /* tp_call */
- 0, /* tp_str */
- 0, /* tp_getattro */
- 0, /* tp_setattro */
- 0, /* tp_as_buffer */
- Py_TPFLAGS_DEFAULT, /* tp_flags */
- "GDB event registry object", /* tp_doc */
- 0, /* tp_traverse */
- 0, /* tp_clear */
- 0, /* tp_richcompare */
- 0, /* tp_weaklistoffset */
- 0, /* tp_iter */
- 0, /* tp_iternext */
- eventregistry_object_methods, /* tp_methods */
- 0, /* tp_members */
- 0, /* tp_getset */
- 0, /* tp_base */
- 0, /* tp_dict */
- 0, /* tp_descr_get */
- 0, /* tp_descr_set */
- 0, /* tp_dictoffset */
- 0, /* tp_init */
- 0 /* tp_alloc */
+PyTypeObject eventregistry_object_type = {
+ PyVarObject_HEAD_INIT (NULL, 0) "gdb.EventRegistry", /* tp_name */
+ sizeof (eventregistry_object), /* tp_basicsize */
+ 0, /* tp_itemsize */
+ evregpy_dealloc, /* tp_dealloc */
+ 0, /* tp_print */
+ 0, /* tp_getattr */
+ 0, /* tp_setattr */
+ 0, /* tp_compare */
+ 0, /* tp_repr */
+ 0, /* tp_as_number */
+ 0, /* tp_as_sequence */
+ 0, /* tp_as_mapping */
+ 0, /* tp_hash */
+ 0, /* tp_call */
+ 0, /* tp_str */
+ 0, /* tp_getattro */
+ 0, /* tp_setattro */
+ 0, /* tp_as_buffer */
+ Py_TPFLAGS_DEFAULT, /* tp_flags */
+ "GDB event registry object", /* tp_doc */
+ 0, /* tp_traverse */
+ 0, /* tp_clear */
+ 0, /* tp_richcompare */
+ 0, /* tp_weaklistoffset */
+ 0, /* tp_iter */
+ 0, /* tp_iternext */
+ eventregistry_object_methods, /* tp_methods */
+ 0, /* tp_members */
+ 0, /* tp_getset */
+ 0, /* tp_base */
+ 0, /* tp_dict */
+ 0, /* tp_descr_get */
+ 0, /* tp_descr_set */
+ 0, /* tp_dictoffset */
+ 0, /* tp_init */
+ 0 /* tp_alloc */
};
diff --git a/gdb/python/py-evts.c b/gdb/python/py-evts.c
index 5f9e00d1edd..85c35d13bf1 100644
--- a/gdb/python/py-evts.c
+++ b/gdb/python/py-evts.c
@@ -20,17 +20,8 @@
#include "defs.h"
#include "py-events.h"
-static struct PyModuleDef EventModuleDef =
-{
- PyModuleDef_HEAD_INIT,
- "_gdbevents",
- NULL,
- -1,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL
+static struct PyModuleDef EventModuleDef = {
+ PyModuleDef_HEAD_INIT, "_gdbevents", NULL, -1, NULL, NULL, NULL, NULL, NULL
};
/* Helper function to add a single event registry to the events
@@ -44,9 +35,8 @@ add_new_registry (eventregistry_object **registryp, const char *name)
if (*registryp == NULL)
return -1;
- return gdb_pymodule_addobject (gdb_py_events.module,
- name,
- (PyObject *)(*registryp));
+ return gdb_pymodule_addobject (gdb_py_events.module, name,
+ (PyObject *) (*registryp));
}
/* Create and populate the _gdbevents module. Note that this is
@@ -59,8 +49,8 @@ gdbpy_events_mod_func ()
if (gdb_py_events.module == nullptr)
return nullptr;
-#define GDB_PY_DEFINE_EVENT(name) \
- if (add_new_registry (&gdb_py_events.name, #name) < 0) \
+#define GDB_PY_DEFINE_EVENT(name) \
+ if (add_new_registry (&gdb_py_events.name, #name) < 0) \
return nullptr;
#include "py-all-events.def"
#undef GDB_PY_DEFINE_EVENT
diff --git a/gdb/python/py-exitedevent.c b/gdb/python/py-exitedevent.c
index 7506f4b2305..1cf977e11fb 100644
--- a/gdb/python/py-exitedevent.c
+++ b/gdb/python/py-exitedevent.c
@@ -35,14 +35,16 @@ create_exited_event_object (const LONGEST *exit_code, struct inferior *inf)
if (exit_code_obj == NULL)
return NULL;
if (evpy_add_attribute (exited_event.get (), "exit_code",
- exit_code_obj.get ()) < 0)
+ exit_code_obj.get ())
+ < 0)
return NULL;
}
gdbpy_ref<inferior_object> inf_obj = inferior_to_inferior_object (inf);
- if (inf_obj == NULL || evpy_add_attribute (exited_event.get (),
- "inferior",
- (PyObject *) inf_obj.get ()) < 0)
+ if (inf_obj == NULL
+ || evpy_add_attribute (exited_event.get (), "inferior",
+ (PyObject *) inf_obj.get ())
+ < 0)
return NULL;
return exited_event;
diff --git a/gdb/python/py-finishbreakpoint.c b/gdb/python/py-finishbreakpoint.c
index d4d129110e9..1d5ba488d76 100644
--- a/gdb/python/py-finishbreakpoint.c
+++ b/gdb/python/py-finishbreakpoint.c
@@ -17,8 +17,6 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
-
-
#include "defs.h"
#include "python-internal.h"
#include "breakpoint.h"
@@ -62,7 +60,7 @@ struct finish_breakpoint_object
};
extern PyTypeObject finish_breakpoint_object_type
- CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF ("finish_breakpoint_object");
+ CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF ("finish_breakpoint_object");
/* Python function to get the 'return_value' attribute of
FinishBreakpoint. */
@@ -70,8 +68,8 @@ extern PyTypeObject finish_breakpoint_object_type
static PyObject *
bpfinishpy_get_returnvalue (PyObject *self, void *closure)
{
- struct finish_breakpoint_object *self_finishbp =
- (struct finish_breakpoint_object *) self;
+ struct finish_breakpoint_object *self_finishbp
+ = (struct finish_breakpoint_object *) self;
if (!self_finishbp->return_value)
Py_RETURN_NONE;
@@ -85,8 +83,8 @@ bpfinishpy_get_returnvalue (PyObject *self, void *closure)
static void
bpfinishpy_dealloc (PyObject *self)
{
- struct finish_breakpoint_object *self_bpfinish =
- (struct finish_breakpoint_object *) self;
+ struct finish_breakpoint_object *self_bpfinish
+ = (struct finish_breakpoint_object *) self;
Py_XDECREF (self_bpfinish->func_symbol);
Py_XDECREF (self_bpfinish->function_value);
@@ -101,8 +99,8 @@ bpfinishpy_dealloc (PyObject *self)
void
bpfinishpy_pre_stop_hook (struct gdbpy_breakpoint_object *bp_obj)
{
- struct finish_breakpoint_object *self_finishbp =
- (struct finish_breakpoint_object *) bp_obj;
+ struct finish_breakpoint_object *self_finishbp
+ = (struct finish_breakpoint_object *) bp_obj;
/* Can compute return_value only once. */
gdb_assert (!self_finishbp->return_value);
@@ -112,18 +110,17 @@ bpfinishpy_pre_stop_hook (struct gdbpy_breakpoint_object *bp_obj)
try
{
- struct symbol *func_symbol =
- symbol_object_to_symbol (self_finishbp->func_symbol);
- struct value *function =
- value_object_to_value (self_finishbp->function_value);
- struct value *ret =
- get_return_value (func_symbol, function);
+ struct symbol *func_symbol
+ = symbol_object_to_symbol (self_finishbp->func_symbol);
+ struct value *function
+ = value_object_to_value (self_finishbp->function_value);
+ struct value *ret = get_return_value (func_symbol, function);
if (ret)
{
self_finishbp->return_value = value_to_value_object (ret);
if (!self_finishbp->return_value)
- gdbpy_print_stack ();
+ gdbpy_print_stack ();
}
else
{
@@ -144,7 +141,6 @@ bpfinishpy_pre_stop_hook (struct gdbpy_breakpoint_object *bp_obj)
void
bpfinishpy_post_stop_hook (struct gdbpy_breakpoint_object *bp_obj)
{
-
try
{
/* Can't delete it here, but it will be removed at the next stop. */
@@ -164,8 +160,8 @@ static int
bpfinishpy_init (PyObject *self, PyObject *args, PyObject *kwargs)
{
static const char *keywords[] = { "frame", "internal", NULL };
- struct finish_breakpoint_object *self_bpfinish =
- (struct finish_breakpoint_object *) self;
+ struct finish_breakpoint_object *self_bpfinish
+ = (struct finish_breakpoint_object *) self;
PyObject *frame_obj = NULL;
int thread;
frame_info_ptr frame = NULL; /* init for gcc -Wall */
@@ -190,7 +186,7 @@ bpfinishpy_init (PyObject *self, PyObject *args, PyObject *kwargs)
if (frame == NULL)
{
PyErr_SetString (PyExc_ValueError,
- _("Invalid ID for the `frame' object."));
+ _ ("Invalid ID for the `frame' object."));
}
else
{
@@ -198,15 +194,15 @@ bpfinishpy_init (PyObject *self, PyObject *args, PyObject *kwargs)
if (prev_frame == 0)
{
PyErr_SetString (PyExc_ValueError,
- _("\"FinishBreakpoint\" not "
- "meaningful in the outermost "
- "frame."));
+ _ ("\"FinishBreakpoint\" not "
+ "meaningful in the outermost "
+ "frame."));
}
else if (get_frame_type (prev_frame) == DUMMY_FRAME)
{
PyErr_SetString (PyExc_ValueError,
- _("\"FinishBreakpoint\" cannot "
- "be set on a dummy frame."));
+ _ ("\"FinishBreakpoint\" cannot "
+ "be set on a dummy frame."));
}
else
frame_id = get_frame_id (prev_frame);
@@ -223,8 +219,7 @@ bpfinishpy_init (PyObject *self, PyObject *args, PyObject *kwargs)
if (inferior_ptid == null_ptid)
{
- PyErr_SetString (PyExc_ValueError,
- _("No thread currently selected."));
+ PyErr_SetString (PyExc_ValueError, _ ("No thread currently selected."));
return -1;
}
@@ -236,7 +231,7 @@ bpfinishpy_init (PyObject *self, PyObject *args, PyObject *kwargs)
if (internal_bp == -1)
{
PyErr_SetString (PyExc_ValueError,
- _("The value of `internal' must be a boolean."));
+ _ ("The value of `internal' must be a boolean."));
return -1;
}
}
@@ -252,8 +247,8 @@ bpfinishpy_init (PyObject *self, PyObject *args, PyObject *kwargs)
struct symbol *function = find_pc_function (pc);
if (function != nullptr)
{
- struct type *ret_type =
- check_typedef (function->type ()->target_type ());
+ struct type *ret_type
+ = check_typedef (function->type ()->target_type ());
/* Remember only non-void return types. */
if (ret_type->code () != TYPE_CODE_VOID)
@@ -297,15 +292,10 @@ bpfinishpy_init (PyObject *self, PyObject *args, PyObject *kwargs)
/* Set a breakpoint on the return address. */
location_spec_up locspec
= new_address_location_spec (get_frame_pc (prev_frame), NULL, 0);
- create_breakpoint (gdbpy_enter::get_gdbarch (),
- locspec.get (), NULL, thread, NULL, false,
- 0,
- 1 /*temp_flag*/,
- bp_breakpoint,
- 0,
- AUTO_BOOLEAN_TRUE,
- &code_breakpoint_ops,
- 0, 1, internal_bp, 0);
+ create_breakpoint (gdbpy_enter::get_gdbarch (), locspec.get (), NULL,
+ thread, NULL, false, 0, 1 /*temp_flag*/,
+ bp_breakpoint, 0, AUTO_BOOLEAN_TRUE,
+ &code_breakpoint_ops, 0, 1, internal_bp, 0);
}
catch (const gdb_exception &except)
{
@@ -357,8 +347,8 @@ bpfinishpy_detect_out_scope_cb (struct breakpoint *b,
not anymore in the current callstack. */
if (py_bp != NULL && b->py_bp_object->is_finish_bp)
{
- struct finish_breakpoint_object *finish_bp =
- (struct finish_breakpoint_object *) py_bp;
+ struct finish_breakpoint_object *finish_bp
+ = (struct finish_breakpoint_object *) py_bp;
/* Check scope if not currently stopped at the FinishBreakpoint. */
if (b != bp_stopped)
@@ -417,7 +407,8 @@ gdbpy_initialize_finishbreakpoints (void)
return -1;
if (gdb_pymodule_addobject (gdb_module, "FinishBreakpoint",
- (PyObject *) &finish_breakpoint_object_type) < 0)
+ (PyObject *) &finish_breakpoint_object_type)
+ < 0)
return -1;
gdb::observers::normal_stop.attach (bpfinishpy_handle_stop,
@@ -430,49 +421,48 @@ gdbpy_initialize_finishbreakpoints (void)
static gdb_PyGetSetDef finish_breakpoint_object_getset[] = {
{ "return_value", bpfinishpy_get_returnvalue, NULL,
- "gdb.Value object representing the return value, if any. \
-None otherwise.", NULL },
- { NULL } /* Sentinel. */
+ "gdb.Value object representing the return value, if any. \
+None otherwise.",
+ NULL },
+ { NULL } /* Sentinel. */
};
-PyTypeObject finish_breakpoint_object_type =
-{
- PyVarObject_HEAD_INIT (NULL, 0)
- "gdb.FinishBreakpoint", /*tp_name*/
- sizeof (struct finish_breakpoint_object), /*tp_basicsize*/
- 0, /*tp_itemsize*/
- bpfinishpy_dealloc, /*tp_dealloc*/
- 0, /*tp_print*/
- 0, /*tp_getattr*/
- 0, /*tp_setattr*/
- 0, /*tp_compare*/
- 0, /*tp_repr*/
- 0, /*tp_as_number*/
- 0, /*tp_as_sequence*/
- 0, /*tp_as_mapping*/
- 0, /*tp_hash */
- 0, /*tp_call*/
- 0, /*tp_str*/
- 0, /*tp_getattro*/
- 0, /*tp_setattro */
- 0, /*tp_as_buffer*/
- Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /*tp_flags*/
- "GDB finish breakpoint object", /* tp_doc */
- 0, /* tp_traverse */
- 0, /* tp_clear */
- 0, /* tp_richcompare */
- 0, /* tp_weaklistoffset */
- 0, /* tp_iter */
- 0, /* tp_iternext */
- 0, /* tp_methods */
- 0, /* tp_members */
- finish_breakpoint_object_getset,/* tp_getset */
- &breakpoint_object_type, /* tp_base */
- 0, /* tp_dict */
- 0, /* tp_descr_get */
- 0, /* tp_descr_set */
- 0, /* tp_dictoffset */
- bpfinishpy_init, /* tp_init */
- 0, /* tp_alloc */
- 0 /* tp_new */
+PyTypeObject finish_breakpoint_object_type = {
+ PyVarObject_HEAD_INIT (NULL, 0) "gdb.FinishBreakpoint", /*tp_name*/
+ sizeof (struct finish_breakpoint_object), /*tp_basicsize*/
+ 0, /*tp_itemsize*/
+ bpfinishpy_dealloc, /*tp_dealloc*/
+ 0, /*tp_print*/
+ 0, /*tp_getattr*/
+ 0, /*tp_setattr*/
+ 0, /*tp_compare*/
+ 0, /*tp_repr*/
+ 0, /*tp_as_number*/
+ 0, /*tp_as_sequence*/
+ 0, /*tp_as_mapping*/
+ 0, /*tp_hash */
+ 0, /*tp_call*/
+ 0, /*tp_str*/
+ 0, /*tp_getattro*/
+ 0, /*tp_setattro */
+ 0, /*tp_as_buffer*/
+ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /*tp_flags*/
+ "GDB finish breakpoint object", /* tp_doc */
+ 0, /* tp_traverse */
+ 0, /* tp_clear */
+ 0, /* tp_richcompare */
+ 0, /* tp_weaklistoffset */
+ 0, /* tp_iter */
+ 0, /* tp_iternext */
+ 0, /* tp_methods */
+ 0, /* tp_members */
+ finish_breakpoint_object_getset, /* tp_getset */
+ &breakpoint_object_type, /* tp_base */
+ 0, /* tp_dict */
+ 0, /* tp_descr_get */
+ 0, /* tp_descr_set */
+ 0, /* tp_dictoffset */
+ bpfinishpy_init, /* tp_init */
+ 0, /* tp_alloc */
+ 0 /* tp_new */
};
diff --git a/gdb/python/py-frame.c b/gdb/python/py-frame.c
index f66d22bfa3d..328c37f6577 100644
--- a/gdb/python/py-frame.c
+++ b/gdb/python/py-frame.c
@@ -29,9 +29,9 @@
#include "symfile.h"
#include "objfiles.h"
-struct frame_object {
- PyObject_HEAD
- struct frame_id frame_id;
+struct frame_object
+{
+ PyObject_HEAD struct frame_id frame_id;
struct gdbarch *gdbarch;
/* Marks that the FRAME_ID member actually holds the ID of the frame next
@@ -47,12 +47,14 @@ struct frame_object {
/* Require a valid frame. This must be called inside a TRY_CATCH, or
another context in which a gdb exception is allowed. */
-#define FRAPY_REQUIRE_VALID(frame_obj, frame) \
- do { \
- frame = frame_object_to_frame_info (frame_obj); \
- if (frame == NULL) \
- error (_("Frame is invalid.")); \
- } while (0)
+#define FRAPY_REQUIRE_VALID(frame_obj, frame) \
+ do \
+ { \
+ frame = frame_object_to_frame_info (frame_obj); \
+ if (frame == NULL) \
+ error (_ ("Frame is invalid.")); \
+ } \
+ while (0)
/* Returns the frame_info object corresponding to the given Python Frame
object. If the frame doesn't exist anymore (the frame id doesn't
@@ -151,7 +153,8 @@ static PyObject *
frapy_type (PyObject *self, PyObject *args)
{
frame_info_ptr frame;
- enum frame_type type = NORMAL_FRAME;/* Initialize to appease gcc warning. */
+ enum frame_type type
+ = NORMAL_FRAME; /* Initialize to appease gcc warning. */
try
{
@@ -173,7 +176,7 @@ frapy_type (PyObject *self, PyObject *args)
static PyObject *
frapy_arch (PyObject *self, PyObject *args)
{
- frame_info_ptr frame = NULL; /* Initialize to appease gcc warning. */
+ frame_info_ptr frame = NULL; /* Initialize to appease gcc warning. */
frame_object *obj = (frame_object *) self;
try
@@ -194,7 +197,7 @@ frapy_arch (PyObject *self, PyObject *args)
static PyObject *
frapy_unwind_stop_reason (PyObject *self, PyObject *args)
{
- frame_info_ptr frame = NULL; /* Initialize to appease gcc warning. */
+ frame_info_ptr frame = NULL; /* Initialize to appease gcc warning. */
enum unwind_stop_reason stop_reason;
try
@@ -217,7 +220,7 @@ frapy_unwind_stop_reason (PyObject *self, PyObject *args)
static PyObject *
frapy_pc (PyObject *self, PyObject *args)
{
- CORE_ADDR pc = 0; /* Initialize to appease gcc warning. */
+ CORE_ADDR pc = 0; /* Initialize to appease gcc warning. */
frame_info_ptr frame;
try
@@ -260,7 +263,7 @@ frapy_read_register (PyObject *self, PyObject *args)
val = value_of_register (regnum, frame);
if (val == NULL)
- PyErr_SetString (PyExc_ValueError, _("Can't read register."));
+ PyErr_SetString (PyExc_ValueError, _ ("Can't read register."));
}
catch (const gdb_exception &except)
{
@@ -289,28 +292,25 @@ frapy_block (PyObject *self, PyObject *args)
GDB_PY_HANDLE_EXCEPTION (except);
}
- for (fn_block = block;
- fn_block != NULL && fn_block->function () == NULL;
+ for (fn_block = block; fn_block != NULL && fn_block->function () == NULL;
fn_block = fn_block->superblock ())
;
if (block == NULL || fn_block == NULL || fn_block->function () == NULL)
{
PyErr_SetString (PyExc_RuntimeError,
- _("Cannot locate block for frame."));
+ _ ("Cannot locate block for frame."));
return NULL;
}
if (block)
{
- return block_to_block_object
- (block, fn_block->function ()->objfile ());
+ return block_to_block_object (block, fn_block->function ()->objfile ());
}
Py_RETURN_NONE;
}
-
/* Implementation of gdb.Frame.function (self) -> gdb.Symbol.
Returns the symbol for the function corresponding to this frame. */
@@ -353,7 +353,6 @@ frame_info_to_frame_object (frame_info_ptr frame)
try
{
-
/* Try to get the previous frame, to determine if this is the last frame
in a corrupt stack. If so, we need to store the frame_id of the next
frame and not of this one (which is possibly invalid). */
@@ -388,7 +387,7 @@ static PyObject *
frapy_older (PyObject *self, PyObject *args)
{
frame_info_ptr frame, prev = NULL;
- PyObject *prev_obj = NULL; /* Initialize to appease gcc warning. */
+ PyObject *prev_obj = NULL; /* Initialize to appease gcc warning. */
try
{
@@ -420,7 +419,7 @@ static PyObject *
frapy_newer (PyObject *self, PyObject *args)
{
frame_info_ptr frame, next = NULL;
- PyObject *next_obj = NULL; /* Initialize to appease gcc warning. */
+ PyObject *next_obj = NULL; /* Initialize to appease gcc warning. */
try
{
@@ -451,7 +450,7 @@ static PyObject *
frapy_find_sal (PyObject *self, PyObject *args)
{
frame_info_ptr frame;
- PyObject *sal_obj = NULL; /* Initialize to appease gcc warning. */
+ PyObject *sal_obj = NULL; /* Initialize to appease gcc warning. */
try
{
@@ -480,7 +479,7 @@ frapy_read_var (PyObject *self, PyObject *args)
{
frame_info_ptr frame;
PyObject *sym_obj, *block_obj = NULL;
- struct symbol *var = NULL; /* gcc-4.3.2 false warning. */
+ struct symbol *var = NULL; /* gcc-4.3.2 false warning. */
const struct block *block = NULL;
struct value *val = NULL;
@@ -491,8 +490,8 @@ frapy_read_var (PyObject *self, PyObject *args)
var = symbol_object_to_symbol (sym_obj);
else if (gdbpy_is_string (sym_obj))
{
- gdb::unique_xmalloc_ptr<char>
- var_name (python_string_to_target_string (sym_obj));
+ gdb::unique_xmalloc_ptr<char> var_name (
+ python_string_to_target_string (sym_obj));
if (!var_name)
return NULL;
@@ -503,7 +502,7 @@ frapy_read_var (PyObject *self, PyObject *args)
if (!block)
{
PyErr_SetString (PyExc_RuntimeError,
- _("Second argument must be block."));
+ _ ("Second argument must be block."));
return NULL;
}
}
@@ -515,7 +514,8 @@ frapy_read_var (PyObject *self, PyObject *args)
if (!block)
block = get_frame_block (frame, NULL);
- lookup_sym = lookup_symbol (var_name.get (), block, VAR_DOMAIN, NULL);
+ lookup_sym
+ = lookup_symbol (var_name.get (), block, VAR_DOMAIN, NULL);
var = lookup_sym.symbol;
block = lookup_sym.block;
}
@@ -527,8 +527,8 @@ frapy_read_var (PyObject *self, PyObject *args)
if (!var)
{
- PyErr_Format (PyExc_ValueError,
- _("Variable '%s' not found."), var_name.get ());
+ PyErr_Format (PyExc_ValueError, _ ("Variable '%s' not found."),
+ var_name.get ());
return NULL;
}
@@ -536,7 +536,7 @@ frapy_read_var (PyObject *self, PyObject *args)
else
{
PyErr_SetString (PyExc_TypeError,
- _("Argument must be a symbol or string."));
+ _ ("Argument must be a symbol or string."));
return NULL;
}
@@ -673,8 +673,7 @@ gdbpy_frame_stop_reason_string (PyObject *self, PyObject *args)
if (reason < UNWIND_FIRST || reason > UNWIND_LAST)
{
- PyErr_SetString (PyExc_ValueError,
- _("Invalid frame stop reason."));
+ PyErr_SetString (PyExc_ValueError, _ ("Invalid frame stop reason."));
return NULL;
}
@@ -727,17 +726,17 @@ gdbpy_initialize_frames (void)
if (PyModule_AddIntConstant (gdb_module, "NORMAL_FRAME", NORMAL_FRAME) < 0
|| PyModule_AddIntConstant (gdb_module, "DUMMY_FRAME", DUMMY_FRAME) < 0
|| PyModule_AddIntConstant (gdb_module, "INLINE_FRAME", INLINE_FRAME) < 0
- || PyModule_AddIntConstant (gdb_module, "TAILCALL_FRAME",
- TAILCALL_FRAME) < 0
- || PyModule_AddIntConstant (gdb_module, "SIGTRAMP_FRAME",
- SIGTRAMP_FRAME) < 0
+ || PyModule_AddIntConstant (gdb_module, "TAILCALL_FRAME", TAILCALL_FRAME)
+ < 0
+ || PyModule_AddIntConstant (gdb_module, "SIGTRAMP_FRAME", SIGTRAMP_FRAME)
+ < 0
|| PyModule_AddIntConstant (gdb_module, "ARCH_FRAME", ARCH_FRAME) < 0
- || PyModule_AddIntConstant (gdb_module, "SENTINEL_FRAME",
- SENTINEL_FRAME) < 0)
+ || PyModule_AddIntConstant (gdb_module, "SENTINEL_FRAME", SENTINEL_FRAME)
+ < 0)
return -1;
-#define SET(name, description) \
- if (PyModule_AddIntConstant (gdb_module, "FRAME_"#name, name) < 0) \
+#define SET(name, description) \
+ if (PyModule_AddIntConstant (gdb_module, "FRAME_" #name, name) < 0) \
return -1;
#include "unwind_stop_reasons.def"
#undef SET
@@ -746,17 +745,12 @@ gdbpy_initialize_frames (void)
(PyObject *) &frame_object_type);
}
-
-
static PyMethodDef frame_object_methods[] = {
- { "is_valid", frapy_is_valid, METH_NOARGS,
- "is_valid () -> Boolean.\n\
+ { "is_valid", frapy_is_valid, METH_NOARGS, "is_valid () -> Boolean.\n\
Return true if this frame is valid, false if not." },
- { "name", frapy_name, METH_NOARGS,
- "name () -> String.\n\
+ { "name", frapy_name, METH_NOARGS, "name () -> String.\n\
Return the function name of the frame, or None if it can't be determined." },
- { "type", frapy_type, METH_NOARGS,
- "type () -> Integer.\n\
+ { "type", frapy_type, METH_NOARGS, "type () -> Integer.\n\
Return the type of the frame." },
{ "architecture", frapy_arch, METH_NOARGS,
"architecture () -> gdb.Architecture.\n\
@@ -764,23 +758,18 @@ Return the architecture of the frame." },
{ "unwind_stop_reason", frapy_unwind_stop_reason, METH_NOARGS,
"unwind_stop_reason () -> Integer.\n\
Return the reason why it's not possible to find frames older than this." },
- { "pc", frapy_pc, METH_NOARGS,
- "pc () -> Long.\n\
+ { "pc", frapy_pc, METH_NOARGS, "pc () -> Long.\n\
Return the frame's resume address." },
{ "read_register", frapy_read_register, METH_VARARGS,
"read_register (register_name) -> gdb.Value\n\
Return the value of the register in the frame." },
- { "block", frapy_block, METH_NOARGS,
- "block () -> gdb.Block.\n\
+ { "block", frapy_block, METH_NOARGS, "block () -> gdb.Block.\n\
Return the frame's code block." },
- { "function", frapy_function, METH_NOARGS,
- "function () -> gdb.Symbol.\n\
+ { "function", frapy_function, METH_NOARGS, "function () -> gdb.Symbol.\n\
Returns the symbol for the function corresponding to this frame." },
- { "older", frapy_older, METH_NOARGS,
- "older () -> gdb.Frame.\n\
+ { "older", frapy_older, METH_NOARGS, "older () -> gdb.Frame.\n\
Return the frame that called this frame." },
- { "newer", frapy_newer, METH_NOARGS,
- "newer () -> gdb.Frame.\n\
+ { "newer", frapy_newer, METH_NOARGS, "newer () -> gdb.Frame.\n\
Return the frame called by this frame." },
{ "find_sal", frapy_find_sal, METH_NOARGS,
"find_sal () -> gdb.Symtab_and_line.\n\
@@ -790,49 +779,46 @@ Return the frame's symtab and line." },
Return the value of the variable in this frame." },
{ "select", frapy_select, METH_NOARGS,
"Select this frame as the user's current frame." },
- { "level", frapy_level, METH_NOARGS,
- "The stack level of this frame." },
- { "language", frapy_language, METH_NOARGS,
- "The language of this frame." },
- {NULL} /* Sentinel */
+ { "level", frapy_level, METH_NOARGS, "The stack level of this frame." },
+ { "language", frapy_language, METH_NOARGS, "The language of this frame." },
+ { NULL } /* Sentinel */
};
PyTypeObject frame_object_type = {
- PyVarObject_HEAD_INIT (NULL, 0)
- "gdb.Frame", /* tp_name */
- sizeof (frame_object), /* tp_basicsize */
- 0, /* tp_itemsize */
- 0, /* tp_dealloc */
- 0, /* tp_print */
- 0, /* tp_getattr */
- 0, /* tp_setattr */
- 0, /* tp_compare */
- 0, /* tp_repr */
- 0, /* tp_as_number */
- 0, /* tp_as_sequence */
- 0, /* tp_as_mapping */
- 0, /* tp_hash */
- 0, /* tp_call */
- frapy_str, /* tp_str */
- 0, /* tp_getattro */
- 0, /* tp_setattro */
- 0, /* tp_as_buffer */
- Py_TPFLAGS_DEFAULT, /* tp_flags */
- "GDB frame object", /* tp_doc */
- 0, /* tp_traverse */
- 0, /* tp_clear */
- frapy_richcompare, /* tp_richcompare */
- 0, /* tp_weaklistoffset */
- 0, /* tp_iter */
- 0, /* tp_iternext */
- frame_object_methods, /* tp_methods */
- 0, /* tp_members */
- 0, /* tp_getset */
- 0, /* tp_base */
- 0, /* tp_dict */
- 0, /* tp_descr_get */
- 0, /* tp_descr_set */
- 0, /* tp_dictoffset */
- 0, /* tp_init */
- 0, /* tp_alloc */
+ PyVarObject_HEAD_INIT (NULL, 0) "gdb.Frame", /* tp_name */
+ sizeof (frame_object), /* tp_basicsize */
+ 0, /* tp_itemsize */
+ 0, /* tp_dealloc */
+ 0, /* tp_print */
+ 0, /* tp_getattr */
+ 0, /* tp_setattr */
+ 0, /* tp_compare */
+ 0, /* tp_repr */
+ 0, /* tp_as_number */
+ 0, /* tp_as_sequence */
+ 0, /* tp_as_mapping */
+ 0, /* tp_hash */
+ 0, /* tp_call */
+ frapy_str, /* tp_str */
+ 0, /* tp_getattro */
+ 0, /* tp_setattro */
+ 0, /* tp_as_buffer */
+ Py_TPFLAGS_DEFAULT, /* tp_flags */
+ "GDB frame object", /* tp_doc */
+ 0, /* tp_traverse */
+ 0, /* tp_clear */
+ frapy_richcompare, /* tp_richcompare */
+ 0, /* tp_weaklistoffset */
+ 0, /* tp_iter */
+ 0, /* tp_iternext */
+ frame_object_methods, /* tp_methods */
+ 0, /* tp_members */
+ 0, /* tp_getset */
+ 0, /* tp_base */
+ 0, /* tp_dict */
+ 0, /* tp_descr_get */
+ 0, /* tp_descr_set */
+ 0, /* tp_dictoffset */
+ 0, /* tp_init */
+ 0, /* tp_alloc */
};
diff --git a/gdb/python/py-framefilter.c b/gdb/python/py-framefilter.c
index 10a3adadf2f..7a10ba5aa43 100644
--- a/gdb/python/py-framefilter.c
+++ b/gdb/python/py-framefilter.c
@@ -96,8 +96,8 @@ extract_sym (PyObject *obj, gdb::unique_xmalloc_ptr<char> *name,
if (*sym == NULL)
{
PyErr_SetString (PyExc_RuntimeError,
- _("Unexpected value. Expecting a "
- "gdb.Symbol or a Python string."));
+ _ ("Unexpected value. Expecting a "
+ "gdb.Symbol or a Python string."));
return EXT_LANG_BT_ERROR;
}
@@ -172,26 +172,26 @@ mi_should_print (struct symbol *sym, enum mi_print_types type)
switch (sym->aclass ())
{
default:
- case LOC_UNDEF: /* catches errors */
- case LOC_CONST: /* constant */
- case LOC_TYPEDEF: /* local typedef */
- case LOC_LABEL: /* local label */
- case LOC_BLOCK: /* local function */
- case LOC_CONST_BYTES: /* loc. byte seq. */
- case LOC_UNRESOLVED: /* unresolved static */
- case LOC_OPTIMIZED_OUT: /* optimized out */
+ case LOC_UNDEF: /* catches errors */
+ case LOC_CONST: /* constant */
+ case LOC_TYPEDEF: /* local typedef */
+ case LOC_LABEL: /* local label */
+ case LOC_BLOCK: /* local function */
+ case LOC_CONST_BYTES: /* loc. byte seq. */
+ case LOC_UNRESOLVED: /* unresolved static */
+ case LOC_OPTIMIZED_OUT: /* optimized out */
print_me = 0;
break;
- case LOC_ARG: /* argument */
- case LOC_REF_ARG: /* reference arg */
- case LOC_REGPARM_ADDR: /* indirect register arg */
- case LOC_LOCAL: /* stack local */
- case LOC_STATIC: /* static */
- case LOC_REGISTER: /* register */
- case LOC_COMPUTED: /* computed location */
+ case LOC_ARG: /* argument */
+ case LOC_REF_ARG: /* reference arg */
+ case LOC_REGPARM_ADDR: /* indirect register arg */
+ case LOC_LOCAL: /* stack local */
+ case LOC_STATIC: /* static */
+ case LOC_REGISTER: /* register */
+ case LOC_COMPUTED: /* computed location */
if (type == MI_PRINT_LOCALS)
- print_me = ! sym->is_argument ();
+ print_me = !sym->is_argument ();
else
print_me = sym->is_argument ();
}
@@ -222,8 +222,7 @@ py_print_type (struct ui_out *out, struct value *val)
static void
py_print_value (struct ui_out *out, struct value *val,
- const struct value_print_options *opts,
- int indent,
+ const struct value_print_options *opts, int indent,
enum ext_lang_frame_args args_type,
const struct language_defn *language)
{
@@ -232,8 +231,7 @@ py_print_value (struct ui_out *out, struct value *val,
/* MI does not print certain values, differentiated by type,
depending on what ARGS_TYPE indicates. Test type against option.
For CLI print all values. */
- if (args_type == MI_PRINT_SIMPLE_VALUES
- || args_type == MI_PRINT_ALL_VALUES)
+ if (args_type == MI_PRINT_SIMPLE_VALUES || args_type == MI_PRINT_ALL_VALUES)
{
struct type *type = check_typedef (value_type (val));
@@ -305,13 +303,10 @@ get_py_iter_from_func (PyObject *filter, const char *func)
printed. */
static void
-py_print_single_arg (struct ui_out *out,
- const char *sym_name,
- struct frame_arg *fa,
- struct value *fv,
+py_print_single_arg (struct ui_out *out, const char *sym_name,
+ struct frame_arg *fa, struct value *fv,
const struct value_print_options *opts,
- enum ext_lang_frame_args args_type,
- int print_args_field,
+ enum ext_lang_frame_args args_type, int print_args_field,
const struct language_defn *language)
{
struct value *val;
@@ -382,7 +377,7 @@ py_print_single_arg (struct ui_out *out,
/* If the output is to the CLI, and the user option "set print
frame-arguments" is set to none, just output "...". */
- if (! out->is_mi_like_p () && args_type == NO_VALUES)
+ if (!out->is_mi_like_p () && args_type == NO_VALUES)
out->field_string ("value", "...");
else
{
@@ -394,7 +389,7 @@ py_print_single_arg (struct ui_out *out,
{
gdb_assert (fa != NULL && fa->error != NULL);
out->field_fmt ("value", metadata_style.style (),
- _("<error reading variable: %s>"),
+ _ ("<error reading variable: %s>"),
fa->error.get ());
}
else
@@ -415,10 +410,8 @@ py_print_single_arg (struct ui_out *out,
success. */
static enum ext_lang_bt_status
-enumerate_args (PyObject *iter,
- struct ui_out *out,
- enum ext_lang_frame_args args_type,
- int print_args_field,
+enumerate_args (PyObject *iter, struct ui_out *out,
+ enum ext_lang_frame_args args_type, int print_args_field,
frame_info_ptr frame)
{
struct value_print_options opts;
@@ -452,8 +445,8 @@ enumerate_args (PyObject *iter,
struct value *val;
enum ext_lang_bt_status success = EXT_LANG_BT_ERROR;
- success = extract_sym (item.get (), &sym_name, &sym, &sym_block,
- &language);
+ success
+ = extract_sym (item.get (), &sym_name, &sym, &sym_block, &language);
if (success == EXT_LANG_BT_ERROR)
return EXT_LANG_BT_ERROR;
@@ -461,8 +454,7 @@ enumerate_args (PyObject *iter,
if (success == EXT_LANG_BT_ERROR)
return EXT_LANG_BT_ERROR;
- if (sym && out->is_mi_like_p ()
- && ! mi_should_print (sym, MI_PRINT_ARGS))
+ if (sym && out->is_mi_like_p () && !mi_should_print (sym, MI_PRINT_ARGS))
continue;
/* If the object did not provide a value, read it using
@@ -476,12 +468,12 @@ enumerate_args (PyObject *iter,
if (sym == NULL)
{
PyErr_SetString (PyExc_RuntimeError,
- _("No symbol or value provided."));
+ _ ("No symbol or value provided."));
return EXT_LANG_BT_ERROR;
}
- read_frame_arg (user_frame_print_options,
- sym, frame, &arg, &entryarg);
+ read_frame_arg (user_frame_print_options, sym, frame, &arg,
+ &entryarg);
/* The object has not provided a value, so this is a frame
argument to be read by GDB. In this case we have to
@@ -489,11 +481,8 @@ enumerate_args (PyObject *iter,
if (arg.entry_kind != print_entry_values_only)
{
- py_print_single_arg (out, NULL, &arg,
- NULL, &opts,
- args_type,
- print_args_field,
- NULL);
+ py_print_single_arg (out, NULL, &arg, NULL, &opts, args_type,
+ print_args_field, NULL);
}
if (entryarg.entry_kind != print_entry_values_no)
@@ -513,8 +502,7 @@ enumerate_args (PyObject *iter,
/* If the object has provided a value, we just print that. */
if (val != NULL)
py_print_single_arg (out, sym_name.get (), NULL, val, &opts,
- args_type, print_args_field,
- language);
+ args_type, print_args_field, language);
}
/* Collect the next item from the iterator. If
@@ -532,7 +520,6 @@ enumerate_args (PyObject *iter,
return EXT_LANG_BT_OK;
}
-
/* Helper function to loop over variables provided by the
"frame_locals" Python API. Elements in the iterable must conform
to the "Symbol Value" interface. ITER is the Python iterable
@@ -545,11 +532,8 @@ enumerate_args (PyObject *iter,
exception, or EXT_LANG_BT_OK on success. */
static enum ext_lang_bt_status
-enumerate_locals (PyObject *iter,
- struct ui_out *out,
- int indent,
- enum ext_lang_frame_args args_type,
- int print_args_field,
+enumerate_locals (PyObject *iter, struct ui_out *out, int indent,
+ enum ext_lang_frame_args args_type, int print_args_field,
frame_info_ptr frame)
{
struct value_print_options opts;
@@ -572,8 +556,8 @@ enumerate_locals (PyObject *iter,
if (item == NULL)
break;
- success = extract_sym (item.get (), &sym_name, &sym, &sym_block,
- &language);
+ success
+ = extract_sym (item.get (), &sym_name, &sym, &sym_block, &language);
if (success == EXT_LANG_BT_ERROR)
return EXT_LANG_BT_ERROR;
@@ -582,7 +566,7 @@ enumerate_locals (PyObject *iter,
return EXT_LANG_BT_ERROR;
if (sym != NULL && out->is_mi_like_p ()
- && ! mi_should_print (sym, MI_PRINT_LOCALS))
+ && !mi_should_print (sym, MI_PRINT_LOCALS))
continue;
/* If the object did not provide a value, read it. */
@@ -608,18 +592,16 @@ enumerate_locals (PyObject *iter,
/* CLI always prints values for locals. MI uses the
simple/no/all system. */
- if (! out->is_mi_like_p ())
+ if (!out->is_mi_like_p ())
{
int val_indent = (indent + 1) * 4;
- py_print_value (out, val, &opts, val_indent, args_type,
- language);
+ py_print_value (out, val, &opts, val_indent, args_type, language);
}
else
{
if (args_type != NO_VALUES)
- py_print_value (out, val, &opts, 0, args_type,
- language);
+ py_print_value (out, val, &opts, 0, args_type, language);
}
out->text ("\n");
@@ -668,10 +650,8 @@ py_mi_print_variables (PyObject *filter, struct ui_out *out,
EXT_LANG_BT_ERROR on error, or EXT_LANG_BT_OK on success. */
static enum ext_lang_bt_status
-py_print_locals (PyObject *filter,
- struct ui_out *out,
- enum ext_lang_frame_args args_type,
- int indent,
+py_print_locals (PyObject *filter, struct ui_out *out,
+ enum ext_lang_frame_args args_type, int indent,
frame_info_ptr frame)
{
gdbpy_ref<> locals_iter (get_py_iter_from_func (filter, "frame_locals"));
@@ -681,8 +661,9 @@ py_print_locals (PyObject *filter,
ui_out_emit_list list_emitter (out, "locals");
if (locals_iter != Py_None
- && (enumerate_locals (locals_iter.get (), out, indent, args_type,
- 0, frame) == EXT_LANG_BT_ERROR))
+ && (enumerate_locals (locals_iter.get (), out, indent, args_type, 0,
+ frame)
+ == EXT_LANG_BT_ERROR))
return EXT_LANG_BT_ERROR;
return EXT_LANG_BT_OK;
@@ -694,10 +675,8 @@ py_print_locals (PyObject *filter,
a Python exception, or EXT_LANG_BT_OK on success. */
static enum ext_lang_bt_status
-py_print_args (PyObject *filter,
- struct ui_out *out,
- enum ext_lang_frame_args args_type,
- frame_info_ptr frame)
+py_print_args (PyObject *filter, struct ui_out *out,
+ enum ext_lang_frame_args args_type, frame_info_ptr frame)
{
gdbpy_ref<> args_iter (get_py_iter_from_func (filter, "frame_args"));
if (args_iter == NULL)
@@ -748,8 +727,8 @@ py_print_args (PyObject *filter,
static enum ext_lang_bt_status
py_print_frame (PyObject *filter, frame_filter_flags flags,
- enum ext_lang_frame_args args_type,
- struct ui_out *out, int indent, htab_t levels_printed)
+ enum ext_lang_frame_args args_type, struct ui_out *out,
+ int indent, htab_t levels_printed)
{
int has_addr = 0;
CORE_ADDR address = 0;
@@ -804,10 +783,10 @@ py_print_frame (PyObject *filter, frame_filter_flags flags,
gdbarch = get_frame_arch (frame);
/* stack-list-variables. */
- if (print_locals && print_args && ! print_frame_info)
+ if (print_locals && print_args && !print_frame_info)
{
- if (py_mi_print_variables (filter, out, &opts,
- args_type, frame) == EXT_LANG_BT_ERROR)
+ if (py_mi_print_variables (filter, out, &opts, args_type, frame)
+ == EXT_LANG_BT_ERROR)
return EXT_LANG_BT_ERROR;
return EXT_LANG_BT_OK;
}
@@ -816,7 +795,7 @@ py_print_frame (PyObject *filter, frame_filter_flags flags,
/* -stack-list-locals does not require a
wrapping frame attribute. */
- if (print_frame_info || (print_args && ! print_locals))
+ if (print_frame_info || (print_args && !print_locals))
tuple.emplace (out, "frame");
if (print_frame_info)
@@ -846,12 +825,10 @@ py_print_frame (PyObject *filter, frame_filter_flags flags,
}
/* For MI, each piece is controlled individually. */
- bool location_print = (print_frame_info
- && !out->is_mi_like_p ()
- && (print_what == LOCATION
- || print_what == SRC_AND_LOC
- || print_what == LOC_AND_ADDRESS
- || print_what == SHORT_LOCATION));
+ bool location_print
+ = (print_frame_info && !out->is_mi_like_p ()
+ && (print_what == LOCATION || print_what == SRC_AND_LOC
+ || print_what == LOC_AND_ADDRESS || print_what == SHORT_LOCATION));
/* Print frame level. MI does not require the level if
locals/variables only are being printed. */
@@ -862,8 +839,8 @@ py_print_frame (PyObject *filter, frame_filter_flags flags,
struct frame_info **slot;
int level;
- slot = (frame_info **) htab_find_slot (levels_printed,
- frame.get(), INSERT);
+ slot = (frame_info **) htab_find_slot (levels_printed, frame.get (),
+ INSERT);
level = frame_relative_level (frame);
@@ -876,8 +853,7 @@ py_print_frame (PyObject *filter, frame_filter_flags flags,
else
{
*slot = frame.get ();
- annotate_frame_begin (print_level ? level : 0,
- gdbarch, address);
+ annotate_frame_begin (print_level ? level : 0, gdbarch, address);
out->text ("#");
out->field_fmt_signed (2, ui_left, "level", level);
}
@@ -889,8 +865,7 @@ py_print_frame (PyObject *filter, frame_filter_flags flags,
print nothing. */
if (opts.addressprint && has_addr)
{
- if (!sal.symtab
- || frame_show_address (frame, sal)
+ if (!sal.symtab || frame_show_address (frame, sal)
|| print_what == LOC_AND_ADDRESS)
{
annotate_frame_address ();
@@ -935,8 +910,8 @@ py_print_frame (PyObject *filter, frame_filter_flags flags,
else if (py_func != Py_None)
{
PyErr_SetString (PyExc_RuntimeError,
- _("FrameDecorator.function: expecting a " \
- "String, integer or None."));
+ _ ("FrameDecorator.function: expecting a "
+ "String, integer or None."));
return EXT_LANG_BT_ERROR;
}
@@ -948,7 +923,6 @@ py_print_frame (PyObject *filter, frame_filter_flags flags,
}
}
-
/* Frame arguments. Check the result, and error if something went
wrong. */
if (print_args && (location_print || out->is_mi_like_p ()))
@@ -974,8 +948,8 @@ py_print_frame (PyObject *filter, frame_filter_flags flags,
if (py_fn != Py_None)
{
- gdb::unique_xmalloc_ptr<char>
- filename (python_string_to_host_string (py_fn.get ()));
+ gdb::unique_xmalloc_ptr<char> filename (
+ python_string_to_host_string (py_fn.get ()));
if (filename == NULL)
return EXT_LANG_BT_ERROR;
@@ -1014,7 +988,7 @@ py_print_frame (PyObject *filter, frame_filter_flags flags,
}
bool source_print
- = (! out->is_mi_like_p ()
+ = (!out->is_mi_like_p ()
&& (print_what == SRC_LINE || print_what == SRC_AND_LOC));
if (source_print)
{
@@ -1025,7 +999,7 @@ py_print_frame (PyObject *filter, frame_filter_flags flags,
/* For MI we need to deal with the "children" list population of
elided frames, so if MI output detected do not send newline. */
- if (! out->is_mi_like_p ())
+ if (!out->is_mi_like_p ())
{
annotate_frame_end ();
/* print_source_lines has already printed a newline. */
@@ -1035,8 +1009,8 @@ py_print_frame (PyObject *filter, frame_filter_flags flags,
if (print_locals)
{
- if (py_print_locals (filter, out, args_type, indent,
- frame) == EXT_LANG_BT_ERROR)
+ if (py_print_locals (filter, out, args_type, indent, frame)
+ == EXT_LANG_BT_ERROR)
return EXT_LANG_BT_ERROR;
}
@@ -1078,8 +1052,8 @@ py_print_frame (PyObject *filter, frame_filter_flags flags,
frame FRAME. */
static PyObject *
-bootstrap_python_frame_filters (frame_info_ptr frame,
- int frame_low, int frame_high)
+bootstrap_python_frame_filters (frame_info_ptr frame, int frame_low,
+ int frame_high)
{
gdbpy_ref<> frame_obj (frame_info_to_frame_object (frame));
if (frame_obj == NULL)
@@ -1102,11 +1076,9 @@ bootstrap_python_frame_filters (frame_info_ptr frame,
if (py_frame_high == NULL)
return NULL;
- gdbpy_ref<> iterable (PyObject_CallFunctionObjArgs (sort_func.get (),
- frame_obj.get (),
- py_frame_low.get (),
- py_frame_high.get (),
- NULL));
+ gdbpy_ref<> iterable (PyObject_CallFunctionObjArgs (
+ sort_func.get (), frame_obj.get (), py_frame_low.get (),
+ py_frame_high.get (), NULL));
if (iterable == NULL)
return NULL;
@@ -1195,9 +1167,7 @@ gdbpy_apply_frame_filter (const struct extension_language_defn *extlang,
if (iterable == Py_None)
return EXT_LANG_BT_NO_FILTERS;
- htab_up levels_printed (htab_create (20,
- htab_hash_pointer,
- htab_eq_pointer,
+ htab_up levels_printed (htab_create (20, htab_hash_pointer, htab_eq_pointer,
NULL));
while (true)
@@ -1222,7 +1192,7 @@ gdbpy_apply_frame_filter (const struct extension_language_defn *extlang,
{
/* We've printed all the frames we were asked to
print, but more frames existed. */
- gdb_printf (_("(More stack frames follow...)\n"));
+ gdb_printf (_ ("(More stack frames follow...)\n"));
break;
}
}
diff --git a/gdb/python/py-function.c b/gdb/python/py-function.c
index e13f7b02d7f..cae977ff7e3 100644
--- a/gdb/python/py-function.c
+++ b/gdb/python/py-function.c
@@ -17,7 +17,6 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
-
#include "defs.h"
#include "value.h"
#include "python-internal.h"
@@ -28,10 +27,8 @@
#include "expression.h"
#include "language.h"
-extern PyTypeObject fnpy_object_type
- CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF ("PyObject");
-
-
+extern PyTypeObject
+ fnpy_object_type CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF ("PyObject");
/* Return a reference to a tuple ARGC elements long. Each element of the
tuple is a PyObject converted from the corresponding element of ARGV. */
@@ -79,7 +76,7 @@ fnpy_call (struct gdbarch *gdbarch, const struct language_defn *language,
gdbpy_ref<> callable (PyObject_GetAttrString ((PyObject *) cookie,
"invoke"));
if (callable == NULL)
- error (_("No method named 'invoke' in object."));
+ error (_ ("No method named 'invoke' in object."));
result.reset (PyObject_Call (callable.get (), args.get (), NULL));
}
@@ -91,7 +88,7 @@ fnpy_call (struct gdbarch *gdbarch, const struct language_defn *language,
if (value == NULL)
{
gdbpy_print_stack ();
- error (_("Error while executing Python code."));
+ error (_ ("Error while executing Python code."));
}
return value;
@@ -106,7 +103,7 @@ fnpy_init (PyObject *self, PyObject *args, PyObject *kwds)
const char *name;
gdb::unique_xmalloc_ptr<char> docstring;
- if (! PyArg_ParseTuple (args, "s", &name))
+ if (!PyArg_ParseTuple (args, "s", &name))
return -1;
gdbpy_ref<> self_ref = gdbpy_ref<>::new_reference (self);
@@ -124,8 +121,8 @@ fnpy_init (PyObject *self, PyObject *args, PyObject *kwds)
}
}
}
- if (! docstring)
- docstring.reset (xstrdup (_("This function is not documented.")));
+ if (!docstring)
+ docstring.reset (xstrdup (_ ("This function is not documented.")));
add_internal_function (make_unique_xstrdup (name), std::move (docstring),
fnpy_call, self_ref.release ());
@@ -145,45 +142,41 @@ gdbpy_initialize_functions (void)
(PyObject *) &fnpy_object_type);
}
-
-
-PyTypeObject fnpy_object_type =
-{
- PyVarObject_HEAD_INIT (NULL, 0)
- "gdb.Function", /*tp_name*/
- sizeof (PyObject), /*tp_basicsize*/
- 0, /*tp_itemsize*/
- 0, /*tp_dealloc*/
- 0, /*tp_print*/
- 0, /*tp_getattr*/
- 0, /*tp_setattr*/
- 0, /*tp_compare*/
- 0, /*tp_repr*/
- 0, /*tp_as_number*/
- 0, /*tp_as_sequence*/
- 0, /*tp_as_mapping*/
- 0, /*tp_hash */
- 0, /*tp_call*/
- 0, /*tp_str*/
- 0, /*tp_getattro*/
- 0, /*tp_setattro*/
- 0, /*tp_as_buffer*/
- Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /*tp_flags*/
- "GDB function object", /* tp_doc */
- 0, /* tp_traverse */
- 0, /* tp_clear */
- 0, /* tp_richcompare */
- 0, /* tp_weaklistoffset */
- 0, /* tp_iter */
- 0, /* tp_iternext */
- 0, /* tp_methods */
- 0, /* tp_members */
- 0, /* tp_getset */
- 0, /* tp_base */
- 0, /* tp_dict */
- 0, /* tp_descr_get */
- 0, /* tp_descr_set */
- 0, /* tp_dictoffset */
- fnpy_init, /* tp_init */
- 0, /* tp_alloc */
+PyTypeObject fnpy_object_type = {
+ PyVarObject_HEAD_INIT (NULL, 0) "gdb.Function", /*tp_name*/
+ sizeof (PyObject), /*tp_basicsize*/
+ 0, /*tp_itemsize*/
+ 0, /*tp_dealloc*/
+ 0, /*tp_print*/
+ 0, /*tp_getattr*/
+ 0, /*tp_setattr*/
+ 0, /*tp_compare*/
+ 0, /*tp_repr*/
+ 0, /*tp_as_number*/
+ 0, /*tp_as_sequence*/
+ 0, /*tp_as_mapping*/
+ 0, /*tp_hash */
+ 0, /*tp_call*/
+ 0, /*tp_str*/
+ 0, /*tp_getattro*/
+ 0, /*tp_setattro*/
+ 0, /*tp_as_buffer*/
+ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /*tp_flags*/
+ "GDB function object", /* tp_doc */
+ 0, /* tp_traverse */
+ 0, /* tp_clear */
+ 0, /* tp_richcompare */
+ 0, /* tp_weaklistoffset */
+ 0, /* tp_iter */
+ 0, /* tp_iternext */
+ 0, /* tp_methods */
+ 0, /* tp_members */
+ 0, /* tp_getset */
+ 0, /* tp_base */
+ 0, /* tp_dict */
+ 0, /* tp_descr_get */
+ 0, /* tp_descr_set */
+ 0, /* tp_dictoffset */
+ fnpy_init, /* tp_init */
+ 0, /* tp_alloc */
};
diff --git a/gdb/python/py-gdb-readline.c b/gdb/python/py-gdb-readline.c
index ea0f78c9ad8..91a45e4685c 100644
--- a/gdb/python/py-gdb-readline.c
+++ b/gdb/python/py-gdb-readline.c
@@ -111,4 +111,3 @@ sys.meta_path.append(GdbRemoveReadlineFinder())\n\
") == 0)
PyOS_ReadlineFunctionPointer = gdbpy_readline_wrapper;
}
-
diff --git a/gdb/python/py-inferior.c b/gdb/python/py-inferior.c
index 9b3385c83b5..0cd8fe4711b 100644
--- a/gdb/python/py-inferior.c
+++ b/gdb/python/py-inferior.c
@@ -39,16 +39,16 @@ struct inferior_object
{
PyObject_HEAD
- /* The inferior we represent. */
- struct inferior *inferior;
+ /* The inferior we represent. */
+ struct inferior *inferior;
/* thread_object instances under this inferior. This owns a
reference to each object it contains. */
thread_map_t *threads;
};
-extern PyTypeObject inferior_object_type
- CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF ("inferior_object");
+extern PyTypeObject
+ inferior_object_type CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF ("inferior_object");
/* Deleter to clean up when an inferior is removed. */
struct infpy_deleter
@@ -68,18 +68,20 @@ struct infpy_deleter
};
static const registry<inferior>::key<inferior_object, infpy_deleter>
- infpy_inf_data_key;
+ infpy_inf_data_key;
/* Require that INFERIOR be a valid inferior ID. */
-#define INFPY_REQUIRE_VALID(Inferior) \
- do { \
- if (!Inferior->inferior) \
- { \
- PyErr_SetString (PyExc_RuntimeError, \
- _("Inferior no longer exists.")); \
- return NULL; \
- } \
- } while (0)
+#define INFPY_REQUIRE_VALID(Inferior) \
+ do \
+ { \
+ if (!Inferior->inferior) \
+ { \
+ PyErr_SetString (PyExc_RuntimeError, \
+ _ ("Inferior no longer exists.")); \
+ return NULL; \
+ } \
+ } \
+ while (0)
static void
python_on_normal_stop (struct bpstat *bs, int print_frame)
@@ -141,7 +143,8 @@ python_on_inferior_call_post (ptid_t thread, CORE_ADDR address)
'set' command). */
static void
-python_on_memory_change (struct inferior *inferior, CORE_ADDR addr, ssize_t len, const bfd_byte *data)
+python_on_memory_change (struct inferior *inferior, CORE_ADDR addr,
+ ssize_t len, const bfd_byte *data)
{
gdbpy_enter enter_py (target_gdbarch ());
@@ -189,9 +192,8 @@ python_new_objfile (struct objfile *objfile)
if (!gdb_python_initialized)
return;
- gdbpy_enter enter_py (objfile != NULL
- ? objfile->arch ()
- : target_gdbarch ());
+ gdbpy_enter enter_py (objfile != NULL ? objfile->arch ()
+ : target_gdbarch ());
if (objfile == NULL)
{
@@ -272,7 +274,8 @@ python_new_inferior (struct inferior *inf)
gdbpy_ref<> event = create_event_object (&new_inferior_event_object_type);
if (event == NULL
|| evpy_add_attribute (event.get (), "inferior",
- (PyObject *) inf_obj.get ()) < 0
+ (PyObject *) inf_obj.get ())
+ < 0
|| evpy_emit_event (event.get (), gdb_py_events.new_inferior) < 0)
gdbpy_print_stack ();
}
@@ -297,10 +300,12 @@ python_inferior_deleted (struct inferior *inf)
return;
}
- gdbpy_ref<> event = create_event_object (&inferior_deleted_event_object_type);
+ gdbpy_ref<> event
+ = create_event_object (&inferior_deleted_event_object_type);
if (event == NULL
|| evpy_add_attribute (event.get (), "inferior",
- (PyObject *) inf_obj.get ()) < 0
+ (PyObject *) inf_obj.get ())
+ < 0
|| evpy_emit_event (event.get (), gdb_py_events.inferior_deleted) < 0)
gdbpy_print_stack ();
}
@@ -314,11 +319,10 @@ thread_to_thread_object (thread_info *thr)
auto thread_it = inf_obj->threads->find (thr);
if (thread_it != inf_obj->threads->end ())
- return gdbpy_ref<>::new_reference
- ((PyObject *) (thread_it->second.get ()));
+ return gdbpy_ref<>::new_reference (
+ (PyObject *) (thread_it->second.get ()));
- PyErr_SetString (PyExc_SystemError,
- _("could not find gdb thread object"));
+ PyErr_SetString (PyExc_SystemError, _ ("could not find gdb thread object"));
return NULL;
}
@@ -341,8 +345,8 @@ add_thread_object (struct thread_info *tp)
inf_obj = (inferior_object *) thread_obj->inf_obj;
- auto ins_result = inf_obj->threads->emplace
- (thread_map_t::value_type (tp, std::move (thread_obj)));
+ auto ins_result = inf_obj->threads->emplace (
+ thread_map_t::value_type (tp, std::move (thread_obj)));
if (!ins_result.second)
return;
@@ -350,9 +354,9 @@ add_thread_object (struct thread_info *tp)
if (evregpy_no_listeners_p (gdb_py_events.new_thread))
return;
- gdbpy_ref<> event = create_thread_event_object
- (&new_thread_event_object_type,
- (PyObject *) ins_result.first->second.get ());
+ gdbpy_ref<> event = create_thread_event_object (
+ &new_thread_event_object_type,
+ (PyObject *) ins_result.first->second.get ());
if (event == NULL
|| evpy_emit_event (event.get (), gdb_py_events.new_thread) < 0)
@@ -530,8 +534,8 @@ infpy_read_memory (PyObject *self, PyObject *args, PyObject *kw)
PyObject *addr_obj, *length_obj;
static const char *keywords[] = { "address", "length", NULL };
- if (!gdb_PyArg_ParseTupleAndKeywords (args, kw, "OO", keywords,
- &addr_obj, &length_obj))
+ if (!gdb_PyArg_ParseTupleAndKeywords (args, kw, "OO", keywords, &addr_obj,
+ &length_obj))
return NULL;
if (get_addr_from_python (addr_obj, &addr) < 0
@@ -549,7 +553,6 @@ infpy_read_memory (PyObject *self, PyObject *args, PyObject *kw)
GDB_PY_HANDLE_EXCEPTION (except);
}
-
return gdbpy_buffer_to_membuf (std::move (buffer), addr, length);
}
@@ -570,8 +573,8 @@ infpy_write_memory (PyObject *self, PyObject *args, PyObject *kw)
static const char *keywords[] = { "address", "buffer", "length", NULL };
Py_buffer pybuf;
- if (!gdb_PyArg_ParseTupleAndKeywords (args, kw, "Os*|O", keywords,
- &addr_obj, &pybuf, &length_obj))
+ if (!gdb_PyArg_ParseTupleAndKeywords (args, kw, "Os*|O", keywords, &addr_obj,
+ &pybuf, &length_obj))
return NULL;
Py_buffer_up buffer_up (&pybuf);
@@ -622,8 +625,7 @@ infpy_search_memory (PyObject *self, PyObject *args, PyObject *kw)
Py_buffer pybuf;
if (!gdb_PyArg_ParseTupleAndKeywords (args, kw, "OOs*", keywords,
- &start_addr_obj, &length_obj,
- &pybuf))
+ &start_addr_obj, &length_obj, &pybuf))
return NULL;
Py_buffer_up buffer_up (&pybuf);
@@ -638,23 +640,19 @@ infpy_search_memory (PyObject *self, PyObject *args, PyObject *kw)
if (!length)
{
- PyErr_SetString (PyExc_ValueError,
- _("Search range is empty."));
+ PyErr_SetString (PyExc_ValueError, _ ("Search range is empty."));
return nullptr;
}
/* Watch for overflows. */
- else if (length > CORE_ADDR_MAX
- || (start_addr + length - 1) < start_addr)
+ else if (length > CORE_ADDR_MAX || (start_addr + length - 1) < start_addr)
{
- PyErr_SetString (PyExc_ValueError,
- _("The search range is too large."));
+ PyErr_SetString (PyExc_ValueError, _ ("The search range is too large."));
return nullptr;
}
try
{
- found = target_search_memory (start_addr, length,
- buffer, pattern_size,
+ found = target_search_memory (start_addr, length, buffer, pattern_size,
&found_addr);
}
catch (gdb_exception &ex)
@@ -678,7 +676,7 @@ infpy_is_valid (PyObject *self, PyObject *args)
{
inferior_object *inf = (inferior_object *) self;
- if (! inf->inferior)
+ if (!inf->inferior)
Py_RETURN_FALSE;
Py_RETURN_TRUE;
@@ -696,7 +694,7 @@ infpy_thread_from_thread_handle (PyObject *self, PyObject *args, PyObject *kw)
INFPY_REQUIRE_VALID (inf_obj);
- if (! gdb_PyArg_ParseTupleAndKeywords (args, kw, "O", keywords, &handle_obj))
+ if (!gdb_PyArg_ParseTupleAndKeywords (args, kw, "O", keywords, &handle_obj))
return NULL;
const gdb_byte *bytes;
@@ -719,8 +717,9 @@ infpy_thread_from_thread_handle (PyObject *self, PyObject *args, PyObject *kw)
}
else
{
- PyErr_SetString (PyExc_TypeError,
- _("Argument 'handle' must be a thread handle object."));
+ PyErr_SetString (
+ PyExc_TypeError,
+ _ ("Argument 'handle' must be a thread handle object."));
return NULL;
}
@@ -729,9 +728,8 @@ infpy_thread_from_thread_handle (PyObject *self, PyObject *args, PyObject *kw)
{
struct thread_info *thread_info;
- thread_info = find_thread_by_handle
- (gdb::array_view<const gdb_byte> (bytes, bytes_len),
- inf_obj->inferior);
+ thread_info = find_thread_by_handle (
+ gdb::array_view<const gdb_byte> (bytes, bytes_len), inf_obj->inferior);
if (thread_info != NULL)
return thread_to_thread_object (thread_info).release ();
}
@@ -766,11 +764,10 @@ infpy_repr (PyObject *obj)
if (inf == nullptr)
return PyUnicode_FromString ("<gdb.Inferior (invalid)>");
- return PyUnicode_FromFormat ("<gdb.Inferior num=%d, pid=%d>",
- inf->num, inf->pid);
+ return PyUnicode_FromFormat ("<gdb.Inferior num=%d, pid=%d>", inf->num,
+ inf->pid);
}
-
static void
infpy_dealloc (PyObject *obj)
{
@@ -798,8 +795,8 @@ infpy_dealloc (PyObject *obj)
PyObject *
gdbpy_selected_inferior (PyObject *self, PyObject *args)
{
- return ((PyObject *)
- inferior_to_inferior_object (current_inferior ()).release ());
+ return (
+ (PyObject *) inferior_to_inferior_object (current_inferior ()).release ());
}
int
@@ -809,7 +806,8 @@ gdbpy_initialize_inferior (void)
return -1;
if (gdb_pymodule_addobject (gdb_module, "Inferior",
- (PyObject *) &inferior_object_type) < 0)
+ (PyObject *) &inferior_object_type)
+ < 0)
return -1;
gdb::observers::new_thread.attach (add_thread_object, "py-inferior");
@@ -827,9 +825,9 @@ gdbpy_initialize_inferior (void)
gdb::observers::inferior_exit.attach (python_inferior_exit, "py-inferior");
/* Need to run after auto-load's new_objfile observer, so that
auto-loaded pretty-printers are available. */
- gdb::observers::new_objfile.attach
- (python_new_objfile, "py-inferior",
- { &auto_load_new_objfile_observer_token });
+ gdb::observers::new_objfile.attach (
+ python_new_objfile, "py-inferior",
+ { &auto_load_new_objfile_observer_token });
gdb::observers::free_objfile.attach (python_free_objfile, "py-inferior");
gdb::observers::inferior_added.attach (python_new_inferior, "py-inferior");
gdb::observers::inferior_removed.attach (python_inferior_deleted,
@@ -838,8 +836,7 @@ gdbpy_initialize_inferior (void)
return 0;
}
-static gdb_PyGetSetDef inferior_object_getset[] =
-{
+static gdb_PyGetSetDef inferior_object_getset[] = {
{ "num", infpy_get_num, NULL, "ID of inferior, as assigned by GDB.", NULL },
{ "connection", infpy_get_connection, NULL,
"The gdb.TargetConnection for this inferior.", NULL },
@@ -853,20 +850,16 @@ static gdb_PyGetSetDef inferior_object_getset[] =
{ NULL }
};
-static PyMethodDef inferior_object_methods[] =
-{
- { "is_valid", infpy_is_valid, METH_NOARGS,
- "is_valid () -> Boolean.\n\
+static PyMethodDef inferior_object_methods[] = {
+ { "is_valid", infpy_is_valid, METH_NOARGS, "is_valid () -> Boolean.\n\
Return true if this inferior is valid, false if not." },
{ "threads", infpy_threads, METH_NOARGS,
"Return all the threads of this inferior." },
{ "read_memory", (PyCFunction) infpy_read_memory,
- METH_VARARGS | METH_KEYWORDS,
- "read_memory (address, length) -> buffer\n\
+ METH_VARARGS | METH_KEYWORDS, "read_memory (address, length) -> buffer\n\
Return a buffer object for reading from the inferior's memory." },
{ "write_memory", (PyCFunction) infpy_write_memory,
- METH_VARARGS | METH_KEYWORDS,
- "write_memory (address, buffer [, length])\n\
+ METH_VARARGS | METH_KEYWORDS, "write_memory (address, buffer [, length])\n\
Write the given buffer object to the inferior's memory." },
{ "search_memory", (PyCFunction) infpy_search_memory,
METH_VARARGS | METH_KEYWORDS,
@@ -888,43 +881,41 @@ Return architecture of this inferior." },
{ NULL }
};
-PyTypeObject inferior_object_type =
-{
- PyVarObject_HEAD_INIT (NULL, 0)
- "gdb.Inferior", /* tp_name */
- sizeof (inferior_object), /* tp_basicsize */
- 0, /* tp_itemsize */
- infpy_dealloc, /* tp_dealloc */
- 0, /* tp_print */
- 0, /* tp_getattr */
- 0, /* tp_setattr */
- 0, /* tp_compare */
- infpy_repr, /* tp_repr */
- 0, /* tp_as_number */
- 0, /* tp_as_sequence */
- 0, /* tp_as_mapping */
- 0, /* tp_hash */
- 0, /* tp_call */
- 0, /* tp_str */
- 0, /* tp_getattro */
- 0, /* tp_setattro */
- 0, /* tp_as_buffer */
- Py_TPFLAGS_DEFAULT, /* tp_flags */
- "GDB inferior object", /* tp_doc */
- 0, /* tp_traverse */
- 0, /* tp_clear */
- 0, /* tp_richcompare */
- 0, /* tp_weaklistoffset */
- 0, /* tp_iter */
- 0, /* tp_iternext */
- inferior_object_methods, /* tp_methods */
- 0, /* tp_members */
- inferior_object_getset, /* tp_getset */
- 0, /* tp_base */
- 0, /* tp_dict */
- 0, /* tp_descr_get */
- 0, /* tp_descr_set */
- 0, /* tp_dictoffset */
- 0, /* tp_init */
- 0 /* tp_alloc */
+PyTypeObject inferior_object_type = {
+ PyVarObject_HEAD_INIT (NULL, 0) "gdb.Inferior", /* tp_name */
+ sizeof (inferior_object), /* tp_basicsize */
+ 0, /* tp_itemsize */
+ infpy_dealloc, /* tp_dealloc */
+ 0, /* tp_print */
+ 0, /* tp_getattr */
+ 0, /* tp_setattr */
+ 0, /* tp_compare */
+ infpy_repr, /* tp_repr */
+ 0, /* tp_as_number */
+ 0, /* tp_as_sequence */
+ 0, /* tp_as_mapping */
+ 0, /* tp_hash */
+ 0, /* tp_call */
+ 0, /* tp_str */
+ 0, /* tp_getattro */
+ 0, /* tp_setattro */
+ 0, /* tp_as_buffer */
+ Py_TPFLAGS_DEFAULT, /* tp_flags */
+ "GDB inferior object", /* tp_doc */
+ 0, /* tp_traverse */
+ 0, /* tp_clear */
+ 0, /* tp_richcompare */
+ 0, /* tp_weaklistoffset */
+ 0, /* tp_iter */
+ 0, /* tp_iternext */
+ inferior_object_methods, /* tp_methods */
+ 0, /* tp_members */
+ inferior_object_getset, /* tp_getset */
+ 0, /* tp_base */
+ 0, /* tp_dict */
+ 0, /* tp_descr_get */
+ 0, /* tp_descr_set */
+ 0, /* tp_dictoffset */
+ 0, /* tp_init */
+ 0 /* tp_alloc */
};
diff --git a/gdb/python/py-infevents.c b/gdb/python/py-infevents.c
index 1af836b0e88..61ac1aa1f0d 100644
--- a/gdb/python/py-infevents.c
+++ b/gdb/python/py-infevents.c
@@ -62,10 +62,10 @@ create_inferior_call_event_object (inferior_call_kind flag, ptid_t ptid,
register number. */
static gdbpy_ref<>
-create_register_changed_event_object (frame_info_ptr frame,
- int regnum)
+create_register_changed_event_object (frame_info_ptr frame, int regnum)
{
- gdbpy_ref<> event = create_event_object (&register_changed_event_object_type);
+ gdbpy_ref<> event
+ = create_event_object (&register_changed_event_object_type);
if (event == NULL)
return NULL;
diff --git a/gdb/python/py-infthread.c b/gdb/python/py-infthread.c
index 9343c8bba70..c79eb5705c9 100644
--- a/gdb/python/py-infthread.c
+++ b/gdb/python/py-infthread.c
@@ -22,19 +22,21 @@
#include "inferior.h"
#include "python-internal.h"
-extern PyTypeObject thread_object_type
- CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF ("thread_object");
+extern PyTypeObject
+ thread_object_type CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF ("thread_object");
/* Require that INFERIOR be a valid inferior ID. */
-#define THPY_REQUIRE_VALID(Thread) \
- do { \
- if (!Thread->thread) \
- { \
- PyErr_SetString (PyExc_RuntimeError, \
- _("Thread no longer exists.")); \
- return NULL; \
- } \
- } while (0)
+#define THPY_REQUIRE_VALID(Thread) \
+ do \
+ { \
+ if (!Thread->thread) \
+ { \
+ PyErr_SetString (PyExc_RuntimeError, \
+ _ ("Thread no longer exists.")); \
+ return NULL; \
+ } \
+ } \
+ while (0)
gdbpy_ref<thread_object>
create_thread_object (struct thread_info *tp)
@@ -110,32 +112,31 @@ thpy_set_name (PyObject *self, PyObject *newvalue, void *ignore)
thread_object *thread_obj = (thread_object *) self;
gdb::unique_xmalloc_ptr<char> name;
- if (! thread_obj->thread)
+ if (!thread_obj->thread)
{
- PyErr_SetString (PyExc_RuntimeError, _("Thread no longer exists."));
+ PyErr_SetString (PyExc_RuntimeError, _ ("Thread no longer exists."));
return -1;
}
if (newvalue == NULL)
{
- PyErr_SetString (PyExc_TypeError,
- _("Cannot delete `name' attribute."));
+ PyErr_SetString (PyExc_TypeError, _ ("Cannot delete `name' attribute."));
return -1;
}
else if (newvalue == Py_None)
{
/* Nothing. */
}
- else if (! gdbpy_is_string (newvalue))
+ else if (!gdbpy_is_string (newvalue))
{
PyErr_SetString (PyExc_TypeError,
- _("The value of `name' must be a string."));
+ _ ("The value of `name' must be a string."));
return -1;
}
else
{
name = python_string_to_host_string (newvalue);
- if (! name)
+ if (!name)
return -1;
}
@@ -277,7 +278,7 @@ thpy_is_valid (PyObject *self, PyObject *args)
{
thread_object *thread_obj = (thread_object *) self;
- if (! thread_obj->thread)
+ if (!thread_obj->thread)
Py_RETURN_FALSE;
Py_RETURN_TRUE;
@@ -292,7 +293,7 @@ thpy_thread_handle (PyObject *self, PyObject *args)
THPY_REQUIRE_VALID (thread_obj);
gdb::byte_vector hv;
-
+
try
{
hv = target_thread_info_to_thread_handle (thread_obj->thread);
@@ -304,12 +305,12 @@ thpy_thread_handle (PyObject *self, PyObject *args)
if (hv.size () == 0)
{
- PyErr_SetString (PyExc_RuntimeError, _("Thread handle not found."));
+ PyErr_SetString (PyExc_RuntimeError, _ ("Thread handle not found."));
return NULL;
}
- PyObject *object = PyBytes_FromStringAndSize ((const char *) hv.data (),
- hv.size());
+ PyObject *object
+ = PyBytes_FromStringAndSize ((const char *) hv.data (), hv.size ());
return object;
}
@@ -371,86 +372,75 @@ gdbpy_initialize_thread (void)
(PyObject *) &thread_object_type);
}
-static gdb_PyGetSetDef thread_object_getset[] =
-{
- { "name", thpy_get_name, thpy_set_name,
- "The name of the thread, as set by the user or the OS.", NULL },
- { "details", thpy_get_details, NULL,
- "A target specific string containing extra thread state details.",
- NULL },
- { "num", thpy_get_num, NULL,
- "Per-inferior number of the thread, as assigned by GDB.", NULL },
- { "global_num", thpy_get_global_num, NULL,
- "Global number of the thread, as assigned by GDB.", NULL },
- { "ptid", thpy_get_ptid, NULL, "ID of the thread, as assigned by the OS.",
- NULL },
- { "inferior", thpy_get_inferior, NULL,
- "The Inferior object this thread belongs to.", NULL },
-
- { NULL }
-};
-
-static PyMethodDef thread_object_methods[] =
-{
- { "is_valid", thpy_is_valid, METH_NOARGS,
- "is_valid () -> Boolean.\n\
+static gdb_PyGetSetDef thread_object_getset[]
+ = { { "name", thpy_get_name, thpy_set_name,
+ "The name of the thread, as set by the user or the OS.", NULL },
+ { "details", thpy_get_details, NULL,
+ "A target specific string containing extra thread state details.",
+ NULL },
+ { "num", thpy_get_num, NULL,
+ "Per-inferior number of the thread, as assigned by GDB.", NULL },
+ { "global_num", thpy_get_global_num, NULL,
+ "Global number of the thread, as assigned by GDB.", NULL },
+ { "ptid", thpy_get_ptid, NULL,
+ "ID of the thread, as assigned by the OS.", NULL },
+ { "inferior", thpy_get_inferior, NULL,
+ "The Inferior object this thread belongs to.", NULL },
+
+ { NULL } };
+
+static PyMethodDef thread_object_methods[] = {
+ { "is_valid", thpy_is_valid, METH_NOARGS, "is_valid () -> Boolean.\n\
Return true if this inferior thread is valid, false if not." },
- { "switch", thpy_switch, METH_NOARGS,
- "switch ()\n\
+ { "switch", thpy_switch, METH_NOARGS, "switch ()\n\
Makes this the GDB selected thread." },
- { "is_stopped", thpy_is_stopped, METH_NOARGS,
- "is_stopped () -> Boolean\n\
+ { "is_stopped", thpy_is_stopped, METH_NOARGS, "is_stopped () -> Boolean\n\
Return whether the thread is stopped." },
- { "is_running", thpy_is_running, METH_NOARGS,
- "is_running () -> Boolean\n\
+ { "is_running", thpy_is_running, METH_NOARGS, "is_running () -> Boolean\n\
Return whether the thread is running." },
- { "is_exited", thpy_is_exited, METH_NOARGS,
- "is_exited () -> Boolean\n\
+ { "is_exited", thpy_is_exited, METH_NOARGS, "is_exited () -> Boolean\n\
Return whether the thread is exited." },
- { "handle", thpy_thread_handle, METH_NOARGS,
- "handle () -> handle\n\
+ { "handle", thpy_thread_handle, METH_NOARGS, "handle () -> handle\n\
Return thread library specific handle for thread." },
{ NULL }
};
-PyTypeObject thread_object_type =
-{
- PyVarObject_HEAD_INIT (NULL, 0)
- "gdb.InferiorThread", /*tp_name*/
- sizeof (thread_object), /*tp_basicsize*/
- 0, /*tp_itemsize*/
- thpy_dealloc, /*tp_dealloc*/
- 0, /*tp_print*/
- 0, /*tp_getattr*/
- 0, /*tp_setattr*/
- 0, /*tp_compare*/
- 0, /*tp_repr*/
- 0, /*tp_as_number*/
- 0, /*tp_as_sequence*/
- 0, /*tp_as_mapping*/
- 0, /*tp_hash */
- 0, /*tp_call*/
- 0, /*tp_str*/
- 0, /*tp_getattro*/
- 0, /*tp_setattro*/
- 0, /*tp_as_buffer*/
- Py_TPFLAGS_DEFAULT, /*tp_flags*/
- "GDB thread object", /* tp_doc */
- 0, /* tp_traverse */
- 0, /* tp_clear */
- 0, /* tp_richcompare */
- 0, /* tp_weaklistoffset */
- 0, /* tp_iter */
- 0, /* tp_iternext */
- thread_object_methods, /* tp_methods */
- 0, /* tp_members */
- thread_object_getset, /* tp_getset */
- 0, /* tp_base */
- 0, /* tp_dict */
- 0, /* tp_descr_get */
- 0, /* tp_descr_set */
- 0, /* tp_dictoffset */
- 0, /* tp_init */
- 0 /* tp_alloc */
+PyTypeObject thread_object_type = {
+ PyVarObject_HEAD_INIT (NULL, 0) "gdb.InferiorThread", /*tp_name*/
+ sizeof (thread_object), /*tp_basicsize*/
+ 0, /*tp_itemsize*/
+ thpy_dealloc, /*tp_dealloc*/
+ 0, /*tp_print*/
+ 0, /*tp_getattr*/
+ 0, /*tp_setattr*/
+ 0, /*tp_compare*/
+ 0, /*tp_repr*/
+ 0, /*tp_as_number*/
+ 0, /*tp_as_sequence*/
+ 0, /*tp_as_mapping*/
+ 0, /*tp_hash */
+ 0, /*tp_call*/
+ 0, /*tp_str*/
+ 0, /*tp_getattro*/
+ 0, /*tp_setattro*/
+ 0, /*tp_as_buffer*/
+ Py_TPFLAGS_DEFAULT, /*tp_flags*/
+ "GDB thread object", /* tp_doc */
+ 0, /* tp_traverse */
+ 0, /* tp_clear */
+ 0, /* tp_richcompare */
+ 0, /* tp_weaklistoffset */
+ 0, /* tp_iter */
+ 0, /* tp_iternext */
+ thread_object_methods, /* tp_methods */
+ 0, /* tp_members */
+ thread_object_getset, /* tp_getset */
+ 0, /* tp_base */
+ 0, /* tp_dict */
+ 0, /* tp_descr_get */
+ 0, /* tp_descr_set */
+ 0, /* tp_dictoffset */
+ 0, /* tp_init */
+ 0 /* tp_alloc */
};
diff --git a/gdb/python/py-instruction.c b/gdb/python/py-instruction.c
index ba85a505de4..91401d7c466 100644
--- a/gdb/python/py-instruction.c
+++ b/gdb/python/py-instruction.c
@@ -24,13 +24,12 @@
contains getters for four elements: "pc" (int), "data" (buffer), "decode"
(str) and "size" (int) that must be overridden by sub classes. */
-PyTypeObject py_insn_type = {
- PyVarObject_HEAD_INIT (NULL, 0)
-};
+PyTypeObject py_insn_type = { PyVarObject_HEAD_INIT (NULL, 0) };
/* Python instruction object. */
-struct py_insn_obj {
+struct py_insn_obj
+{
PyObject_HEAD
};
@@ -39,19 +38,17 @@ struct py_insn_obj {
static PyObject *
py_insn_getter (PyObject *self, void *closure)
{
- return PyErr_Format (PyExc_NotImplementedError, _("Not implemented."));
+ return PyErr_Format (PyExc_NotImplementedError, _ ("Not implemented."));
}
/* Instruction members. */
-static gdb_PyGetSetDef py_insn_getset[] =
-{
- { "pc", py_insn_getter, NULL, "instruction address", NULL},
- { "data", py_insn_getter, NULL, "instruction memory", NULL},
- { "decoded", py_insn_getter, NULL, "decoded instruction", NULL},
- { "size", py_insn_getter, NULL, "instruction size in bytes", NULL},
- {NULL}
-};
+static gdb_PyGetSetDef py_insn_getset[]
+ = { { "pc", py_insn_getter, NULL, "instruction address", NULL },
+ { "data", py_insn_getter, NULL, "instruction memory", NULL },
+ { "decoded", py_insn_getter, NULL, "decoded instruction", NULL },
+ { "size", py_insn_getter, NULL, "instruction size in bytes", NULL },
+ { NULL } };
/* See py-instruction.h. */
diff --git a/gdb/python/py-lazy-string.c b/gdb/python/py-lazy-string.c
index 7177d74c32e..427f5d6eb69 100644
--- a/gdb/python/py-lazy-string.c
+++ b/gdb/python/py-lazy-string.c
@@ -24,11 +24,12 @@
#include "valprint.h"
#include "language.h"
-struct lazy_string_object {
+struct lazy_string_object
+{
PyObject_HEAD
- /* Holds the address of the lazy string. */
- CORE_ADDR address;
+ /* Holds the address of the lazy string. */
+ CORE_ADDR address;
/* Holds the encoding that will be applied to the string
when the string is printed by GDB. If the encoding is set
@@ -54,7 +55,7 @@ struct lazy_string_object {
};
extern PyTypeObject lazy_string_object_type
- CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF ("lazy_string_object");
+ CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF ("lazy_string_object");
static PyObject *
stpy_get_address (PyObject *self, void *closure)
@@ -109,7 +110,7 @@ stpy_convert_to_value (PyObject *self, PyObject *args)
if (self_string->address == 0)
{
PyErr_SetString (gdbpy_gdb_memory_error,
- _("Cannot create a value from NULL."));
+ _ ("Cannot create a value from NULL."));
return NULL;
}
@@ -130,8 +131,8 @@ stpy_convert_to_value (PyObject *self, PyObject *args)
/* PR 20786: There's no way to specify an array of length zero.
Record a length of [0,-1] which is how Ada does it. Anything
we do is broken, but this is one possible solution. */
- type = lookup_array_range_type (realtype->target_type (),
- 0, self_string->length - 1);
+ type = lookup_array_range_type (realtype->target_type (), 0,
+ self_string->length - 1);
val = value_at_lazy (type, self_string->address);
}
else
@@ -174,22 +175,22 @@ gdbpy_create_lazy_string_object (CORE_ADDR address, long length,
if (length < -1)
{
- PyErr_SetString (PyExc_ValueError, _("Invalid length."));
+ PyErr_SetString (PyExc_ValueError, _ ("Invalid length."));
return NULL;
}
if (address == 0 && length != 0)
{
PyErr_SetString (gdbpy_gdb_memory_error,
- _("Cannot create a lazy string with address 0x0, " \
- "and a non-zero length."));
+ _ ("Cannot create a lazy string with address 0x0, "
+ "and a non-zero length."));
return NULL;
}
if (!type)
{
PyErr_SetString (PyExc_RuntimeError,
- _("A lazy string's type cannot be NULL."));
+ _ ("A lazy string's type cannot be NULL."));
return NULL;
}
@@ -207,7 +208,7 @@ gdbpy_create_lazy_string_object (CORE_ADDR address, long length,
length = array_length;
else if (length != array_length)
{
- PyErr_SetString (PyExc_ValueError, _("Invalid length."));
+ PyErr_SetString (PyExc_ValueError, _ ("Invalid length."));
return NULL;
}
break;
@@ -275,8 +276,7 @@ stpy_lazy_string_elt_type (lazy_string_object *lazy)
void
gdbpy_extract_lazy_string (PyObject *string, CORE_ADDR *addr,
- struct type **str_elt_type,
- long *length,
+ struct type **str_elt_type, long *length,
gdb::unique_xmalloc_ptr<char> *encoding)
{
lazy_string_object *lazy;
@@ -291,52 +291,48 @@ gdbpy_extract_lazy_string (PyObject *string, CORE_ADDR *addr,
encoding->reset (lazy->encoding ? xstrdup (lazy->encoding) : NULL);
}
-
-
static PyMethodDef lazy_string_object_methods[] = {
{ "value", stpy_convert_to_value, METH_NOARGS,
"Create a (lazy) value that contains a pointer to the string." },
- {NULL} /* Sentinel */
+ { NULL } /* Sentinel */
};
-
static gdb_PyGetSetDef lazy_string_object_getset[] = {
{ "address", stpy_get_address, NULL, "Address of the string.", NULL },
{ "encoding", stpy_get_encoding, NULL, "Encoding of the string.", NULL },
{ "length", stpy_get_length, NULL, "Length of the string.", NULL },
{ "type", stpy_get_type, NULL, "Type associated with the string.", NULL },
- { NULL } /* Sentinel */
+ { NULL } /* Sentinel */
};
PyTypeObject lazy_string_object_type = {
- PyVarObject_HEAD_INIT (NULL, 0)
- "gdb.LazyString", /*tp_name*/
- sizeof (lazy_string_object), /*tp_basicsize*/
- 0, /*tp_itemsize*/
- stpy_dealloc, /*tp_dealloc*/
- 0, /*tp_print*/
- 0, /*tp_getattr*/
- 0, /*tp_setattr*/
- 0, /*tp_compare*/
- 0, /*tp_repr*/
- 0, /*tp_as_number*/
- 0, /*tp_as_sequence*/
- 0, /*tp_as_mapping*/
- 0, /*tp_hash */
- 0, /*tp_call*/
- 0, /*tp_str*/
- 0, /*tp_getattro*/
- 0, /*tp_setattro*/
- 0, /*tp_as_buffer*/
- Py_TPFLAGS_DEFAULT, /*tp_flags*/
- "GDB lazy string object", /* tp_doc */
- 0, /* tp_traverse */
- 0, /* tp_clear */
- 0, /* tp_richcompare */
- 0, /* tp_weaklistoffset */
- 0, /* tp_iter */
- 0, /* tp_iternext */
- lazy_string_object_methods, /* tp_methods */
- 0, /* tp_members */
- lazy_string_object_getset /* tp_getset */
+ PyVarObject_HEAD_INIT (NULL, 0) "gdb.LazyString", /*tp_name*/
+ sizeof (lazy_string_object), /*tp_basicsize*/
+ 0, /*tp_itemsize*/
+ stpy_dealloc, /*tp_dealloc*/
+ 0, /*tp_print*/
+ 0, /*tp_getattr*/
+ 0, /*tp_setattr*/
+ 0, /*tp_compare*/
+ 0, /*tp_repr*/
+ 0, /*tp_as_number*/
+ 0, /*tp_as_sequence*/
+ 0, /*tp_as_mapping*/
+ 0, /*tp_hash */
+ 0, /*tp_call*/
+ 0, /*tp_str*/
+ 0, /*tp_getattro*/
+ 0, /*tp_setattro*/
+ 0, /*tp_as_buffer*/
+ Py_TPFLAGS_DEFAULT, /*tp_flags*/
+ "GDB lazy string object", /* tp_doc */
+ 0, /* tp_traverse */
+ 0, /* tp_clear */
+ 0, /* tp_richcompare */
+ 0, /* tp_weaklistoffset */
+ 0, /* tp_iter */
+ 0, /* tp_iternext */
+ lazy_string_object_methods, /* tp_methods */
+ 0, /* tp_members */
+ lazy_string_object_getset /* tp_getset */
};
diff --git a/gdb/python/py-linetable.c b/gdb/python/py-linetable.c
index 7e5a6536fde..bb10ab892dd 100644
--- a/gdb/python/py-linetable.c
+++ b/gdb/python/py-linetable.c
@@ -20,32 +20,35 @@
#include "defs.h"
#include "python-internal.h"
-struct linetable_entry_object {
+struct linetable_entry_object
+{
PyObject_HEAD
- /* The line table source line. */
- int line;
+ /* The line table source line. */
+ int line;
/* The pc associated with the source line. */
CORE_ADDR pc;
};
extern PyTypeObject linetable_entry_object_type
- CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF ("linetable_entry_object");
+ CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF ("linetable_entry_object");
-struct linetable_object {
+struct linetable_object
+{
PyObject_HEAD
- /* The symtab python object. We store the Python object here as the
+ /* The symtab python object. We store the Python object here as the
underlying symtab can become invalid, and we have to run validity
checks on it. */
- PyObject *symtab;
+ PyObject *symtab;
};
extern PyTypeObject linetable_object_type
- CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF ("linetable_object");
+ CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF ("linetable_object");
-struct ltpy_iterator_object {
+struct ltpy_iterator_object
+{
PyObject_HEAD
- /* The current entry in the line table for the iterator */
- int current_index;
+ /* The current entry in the line table for the iterator */
+ int current_index;
/* Pointer back to the original source line table object. Needed to
check if the line table is still valid, and has not been invalidated
when an object file has been freed. */
@@ -53,7 +56,7 @@ struct ltpy_iterator_object {
};
extern PyTypeObject ltpy_iterator_object_type
- CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF ("ltpy_iterator_object");
+ CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF ("ltpy_iterator_object");
/* Internal helper function to extract gdb.Symtab from a gdb.LineTable
object. */
@@ -66,17 +69,18 @@ get_symtab (PyObject *linetable)
return lt->symtab;
}
-#define LTPY_REQUIRE_VALID(lt_obj, symtab) \
- do { \
- symtab = symtab_object_to_symtab (get_symtab (lt_obj)); \
- if (symtab == NULL) \
- { \
- PyErr_SetString (PyExc_RuntimeError, \
- _("Symbol Table in line table is invalid."));\
- return NULL; \
- } \
- } while (0)
-
+#define LTPY_REQUIRE_VALID(lt_obj, symtab) \
+ do \
+ { \
+ symtab = symtab_object_to_symtab (get_symtab (lt_obj)); \
+ if (symtab == NULL) \
+ { \
+ PyErr_SetString (PyExc_RuntimeError, \
+ _ ("Symbol Table in line table is invalid.")); \
+ return NULL; \
+ } \
+ } \
+ while (0)
/* Helper function to create a line table object that wraps a
gdb.Symtab object. */
@@ -103,8 +107,7 @@ build_linetable_entry (int line, CORE_ADDR address)
{
linetable_entry_object *obj;
- obj = PyObject_New (linetable_entry_object,
- &linetable_entry_object_type);
+ obj = PyObject_New (linetable_entry_object, &linetable_entry_object_type);
if (obj != NULL)
{
obj->line = line;
@@ -161,7 +164,7 @@ ltpy_get_pcs_for_line (PyObject *self, PyObject *args)
LTPY_REQUIRE_VALID (self, symtab);
- if (! PyArg_ParseTuple (args, GDB_PY_LL_ARG, &py_line))
+ if (!PyArg_ParseTuple (args, GDB_PY_LL_ARG, &py_line))
return NULL;
try
@@ -189,13 +192,13 @@ ltpy_has_line (PyObject *self, PyObject *args)
LTPY_REQUIRE_VALID (self, symtab);
- if (! PyArg_ParseTuple (args, GDB_PY_LL_ARG, &py_line))
+ if (!PyArg_ParseTuple (args, GDB_PY_LL_ARG, &py_line))
return NULL;
if (symtab->linetable () == NULL)
{
PyErr_SetString (PyExc_RuntimeError,
- _("Linetable information not found in symbol table"));
+ _ ("Linetable information not found in symbol table"));
return NULL;
}
@@ -203,7 +206,7 @@ ltpy_has_line (PyObject *self, PyObject *args)
{
struct linetable_entry *item = &(symtab->linetable ()->item[index]);
if (item->line == py_line)
- Py_RETURN_TRUE;
+ Py_RETURN_TRUE;
}
Py_RETURN_FALSE;
@@ -226,7 +229,7 @@ ltpy_get_all_source_lines (PyObject *self, PyObject *args)
if (symtab->linetable () == NULL)
{
PyErr_SetString (PyExc_RuntimeError,
- _("Linetable information not found in symbol table"));
+ _ ("Linetable information not found in symbol table"));
return NULL;
}
@@ -301,15 +304,18 @@ gdbpy_initialize_linetable (void)
Py_INCREF (&ltpy_iterator_object_type);
if (gdb_pymodule_addobject (gdb_module, "LineTable",
- (PyObject *) &linetable_object_type) < 0)
+ (PyObject *) &linetable_object_type)
+ < 0)
return -1;
if (gdb_pymodule_addobject (gdb_module, "LineTableEntry",
- (PyObject *) &linetable_entry_object_type) < 0)
+ (PyObject *) &linetable_entry_object_type)
+ < 0)
return -1;
if (gdb_pymodule_addobject (gdb_module, "LineTableIterator",
- (PyObject *) &ltpy_iterator_object_type) < 0)
+ (PyObject *) &ltpy_iterator_object_type)
+ < 0)
return -1;
return 0;
@@ -351,8 +357,8 @@ ltpy_iter (PyObject *self)
LTPY_REQUIRE_VALID (self, symtab);
- ltpy_iter_obj = PyObject_New (ltpy_iterator_object,
- &ltpy_iterator_object_type);
+ ltpy_iter_obj
+ = PyObject_New (ltpy_iterator_object, &ltpy_iterator_object_type);
if (ltpy_iter_obj == NULL)
return NULL;
@@ -446,147 +452,137 @@ ltpy_iter_is_valid (PyObject *self, PyObject *args)
Py_RETURN_TRUE;
}
-
-
static PyMethodDef linetable_object_methods[] = {
- { "line", ltpy_get_pcs_for_line, METH_VARARGS,
- "line (lineno) -> Tuple\n\
+ { "line", ltpy_get_pcs_for_line, METH_VARARGS, "line (lineno) -> Tuple\n\
Return executable locations for a given source line." },
- { "has_line", ltpy_has_line, METH_VARARGS,
- "has_line (lineno) -> Boolean\n\
+ { "has_line", ltpy_has_line, METH_VARARGS, "has_line (lineno) -> Boolean\n\
Return TRUE if this line has executable information, FALSE if not." },
{ "source_lines", ltpy_get_all_source_lines, METH_NOARGS,
"source_lines () -> List\n\
Return a list of all executable source lines." },
- { "is_valid", ltpy_is_valid, METH_NOARGS,
- "is_valid () -> Boolean.\n\
+ { "is_valid", ltpy_is_valid, METH_NOARGS, "is_valid () -> Boolean.\n\
Return True if this LineTable is valid, False if not." },
- {NULL} /* Sentinel */
+ { NULL } /* Sentinel */
};
PyTypeObject linetable_object_type = {
- PyVarObject_HEAD_INIT (NULL, 0)
- "gdb.LineTable", /*tp_name*/
- sizeof (linetable_object), /*tp_basicsize*/
- 0, /*tp_itemsize*/
- ltpy_dealloc, /*tp_dealloc*/
- 0, /*tp_print*/
- 0, /*tp_getattr*/
- 0, /*tp_setattr*/
- 0, /*tp_compare*/
- 0, /*tp_repr*/
- 0, /*tp_as_number*/
- 0, /*tp_as_sequence*/
- 0, /*tp_as_mapping*/
- 0, /*tp_hash */
- 0, /*tp_call*/
- 0, /*tp_str*/
- 0, /*tp_getattro*/
- 0, /*tp_setattro*/
- 0, /*tp_as_buffer*/
- Py_TPFLAGS_DEFAULT, /*tp_flags*/
- "GDB line table object", /* tp_doc */
- 0, /* tp_traverse */
- 0, /* tp_clear */
- 0, /* tp_richcompare */
- 0, /* tp_weaklistoffset */
- ltpy_iter, /* tp_iter */
- 0, /* tp_iternext */
- linetable_object_methods, /* tp_methods */
- 0, /* tp_members */
- 0, /* tp_getset */
- 0, /* tp_base */
- 0, /* tp_dict */
- 0, /* tp_descr_get */
- 0, /* tp_descr_set */
- 0, /* tp_dictoffset */
- 0, /* tp_init */
- 0, /* tp_alloc */
+ PyVarObject_HEAD_INIT (NULL, 0) "gdb.LineTable", /*tp_name*/
+ sizeof (linetable_object), /*tp_basicsize*/
+ 0, /*tp_itemsize*/
+ ltpy_dealloc, /*tp_dealloc*/
+ 0, /*tp_print*/
+ 0, /*tp_getattr*/
+ 0, /*tp_setattr*/
+ 0, /*tp_compare*/
+ 0, /*tp_repr*/
+ 0, /*tp_as_number*/
+ 0, /*tp_as_sequence*/
+ 0, /*tp_as_mapping*/
+ 0, /*tp_hash */
+ 0, /*tp_call*/
+ 0, /*tp_str*/
+ 0, /*tp_getattro*/
+ 0, /*tp_setattro*/
+ 0, /*tp_as_buffer*/
+ Py_TPFLAGS_DEFAULT, /*tp_flags*/
+ "GDB line table object", /* tp_doc */
+ 0, /* tp_traverse */
+ 0, /* tp_clear */
+ 0, /* tp_richcompare */
+ 0, /* tp_weaklistoffset */
+ ltpy_iter, /* tp_iter */
+ 0, /* tp_iternext */
+ linetable_object_methods, /* tp_methods */
+ 0, /* tp_members */
+ 0, /* tp_getset */
+ 0, /* tp_base */
+ 0, /* tp_dict */
+ 0, /* tp_descr_get */
+ 0, /* tp_descr_set */
+ 0, /* tp_dictoffset */
+ 0, /* tp_init */
+ 0, /* tp_alloc */
};
static PyMethodDef ltpy_iterator_methods[] = {
- { "is_valid", ltpy_iter_is_valid, METH_NOARGS,
- "is_valid () -> Boolean.\n\
+ { "is_valid", ltpy_iter_is_valid, METH_NOARGS, "is_valid () -> Boolean.\n\
Return True if this LineTable iterator is valid, False if not." },
- {NULL} /* Sentinel */
+ { NULL } /* Sentinel */
};
PyTypeObject ltpy_iterator_object_type = {
- PyVarObject_HEAD_INIT (NULL, 0)
- "gdb.LineTableIterator", /*tp_name*/
- sizeof (ltpy_iterator_object), /*tp_basicsize*/
- 0, /*tp_itemsize*/
- ltpy_iterator_dealloc, /*tp_dealloc*/
- 0, /*tp_print*/
- 0, /*tp_getattr*/
- 0, /*tp_setattr*/
- 0, /*tp_compare*/
- 0, /*tp_repr*/
- 0, /*tp_as_number*/
- 0, /*tp_as_sequence*/
- 0, /*tp_as_mapping*/
- 0, /*tp_hash */
- 0, /*tp_call*/
- 0, /*tp_str*/
- 0, /*tp_getattro*/
- 0, /*tp_setattro*/
- 0, /*tp_as_buffer*/
- Py_TPFLAGS_DEFAULT, /*tp_flags*/
- "GDB line table iterator object", /*tp_doc */
- 0, /*tp_traverse */
- 0, /*tp_clear */
- 0, /*tp_richcompare */
- 0, /*tp_weaklistoffset */
- ltpy_iterator, /*tp_iter */
- ltpy_iternext, /*tp_iternext */
- ltpy_iterator_methods /*tp_methods */
+ PyVarObject_HEAD_INIT (NULL, 0) "gdb.LineTableIterator", /*tp_name*/
+ sizeof (ltpy_iterator_object), /*tp_basicsize*/
+ 0, /*tp_itemsize*/
+ ltpy_iterator_dealloc, /*tp_dealloc*/
+ 0, /*tp_print*/
+ 0, /*tp_getattr*/
+ 0, /*tp_setattr*/
+ 0, /*tp_compare*/
+ 0, /*tp_repr*/
+ 0, /*tp_as_number*/
+ 0, /*tp_as_sequence*/
+ 0, /*tp_as_mapping*/
+ 0, /*tp_hash */
+ 0, /*tp_call*/
+ 0, /*tp_str*/
+ 0, /*tp_getattro*/
+ 0, /*tp_setattro*/
+ 0, /*tp_as_buffer*/
+ Py_TPFLAGS_DEFAULT, /*tp_flags*/
+ "GDB line table iterator object", /*tp_doc */
+ 0, /*tp_traverse */
+ 0, /*tp_clear */
+ 0, /*tp_richcompare */
+ 0, /*tp_weaklistoffset */
+ ltpy_iterator, /*tp_iter */
+ ltpy_iternext, /*tp_iternext */
+ ltpy_iterator_methods /*tp_methods */
};
-
static gdb_PyGetSetDef linetable_entry_object_getset[] = {
- { "line", ltpy_entry_get_line, NULL,
- "The line number in the source file.", NULL },
- { "pc", ltpy_entry_get_pc, NULL,
- "The memory address for this line number.", NULL },
- { NULL } /* Sentinel */
+ { "line", ltpy_entry_get_line, NULL, "The line number in the source file.",
+ NULL },
+ { "pc", ltpy_entry_get_pc, NULL, "The memory address for this line number.",
+ NULL },
+ { NULL } /* Sentinel */
};
PyTypeObject linetable_entry_object_type = {
- PyVarObject_HEAD_INIT (NULL, 0)
- "gdb.LineTableEntry", /*tp_name*/
- sizeof (linetable_entry_object), /*tp_basicsize*/
- 0, /*tp_itemsize*/
- 0, /*tp_dealloc*/
- 0, /*tp_print*/
- 0, /*tp_getattr*/
- 0, /*tp_setattr*/
- 0, /*tp_compare*/
- 0, /*tp_repr*/
- 0, /*tp_as_number*/
- 0, /*tp_as_sequence*/
- 0, /*tp_as_mapping*/
- 0, /*tp_hash */
- 0, /*tp_call*/
- 0, /*tp_str*/
- 0, /*tp_getattro*/
- 0, /*tp_setattro*/
- 0, /*tp_as_buffer*/
- Py_TPFLAGS_DEFAULT, /*tp_flags*/
- "GDB line table entry object", /* tp_doc */
- 0, /* tp_traverse */
- 0, /* tp_clear */
- 0, /* tp_richcompare */
- 0, /* tp_weaklistoffset */
- 0, /* tp_iter */
- 0, /* tp_iternext */
- 0, /* tp_methods */
- 0, /* tp_members */
- linetable_entry_object_getset, /* tp_getset */
- 0, /* tp_base */
- 0, /* tp_dict */
- 0, /* tp_descr_get */
- 0, /* tp_descr_set */
- 0, /* tp_dictoffset */
- 0, /* tp_init */
- 0, /* tp_alloc */
+ PyVarObject_HEAD_INIT (NULL, 0) "gdb.LineTableEntry", /*tp_name*/
+ sizeof (linetable_entry_object), /*tp_basicsize*/
+ 0, /*tp_itemsize*/
+ 0, /*tp_dealloc*/
+ 0, /*tp_print*/
+ 0, /*tp_getattr*/
+ 0, /*tp_setattr*/
+ 0, /*tp_compare*/
+ 0, /*tp_repr*/
+ 0, /*tp_as_number*/
+ 0, /*tp_as_sequence*/
+ 0, /*tp_as_mapping*/
+ 0, /*tp_hash */
+ 0, /*tp_call*/
+ 0, /*tp_str*/
+ 0, /*tp_getattro*/
+ 0, /*tp_setattro*/
+ 0, /*tp_as_buffer*/
+ Py_TPFLAGS_DEFAULT, /*tp_flags*/
+ "GDB line table entry object", /* tp_doc */
+ 0, /* tp_traverse */
+ 0, /* tp_clear */
+ 0, /* tp_richcompare */
+ 0, /* tp_weaklistoffset */
+ 0, /* tp_iter */
+ 0, /* tp_iternext */
+ 0, /* tp_methods */
+ 0, /* tp_members */
+ linetable_entry_object_getset, /* tp_getset */
+ 0, /* tp_base */
+ 0, /* tp_dict */
+ 0, /* tp_descr_get */
+ 0, /* tp_descr_set */
+ 0, /* tp_dictoffset */
+ 0, /* tp_init */
+ 0, /* tp_alloc */
};
diff --git a/gdb/python/py-membuf.c b/gdb/python/py-membuf.c
index 9390bcfcfc1..bc4eb7bb2bd 100644
--- a/gdb/python/py-membuf.c
+++ b/gdb/python/py-membuf.c
@@ -20,11 +20,12 @@
#include "defs.h"
#include "python-internal.h"
-struct membuf_object {
+struct membuf_object
+{
PyObject_HEAD
- /* Pointer to the raw data, and array of gdb_bytes. */
- void *buffer;
+ /* Pointer to the raw data, and array of gdb_bytes. */
+ void *buffer;
/* The address from where the data was read, held for mbpy_str. */
CORE_ADDR addr;
@@ -33,8 +34,8 @@ struct membuf_object {
CORE_ADDR length;
};
-extern PyTypeObject membuf_object_type
- CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF ("membuf_object");
+extern PyTypeObject
+ membuf_object_type CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF ("membuf_object");
/* Wrap BUFFER, ADDRESS, and LENGTH into a gdb.Membuf object. ADDRESS is
the address within the inferior that the contents of BUFFER were read,
@@ -42,8 +43,7 @@ extern PyTypeObject membuf_object_type
PyObject *
gdbpy_buffer_to_membuf (gdb::unique_xmalloc_ptr<gdb_byte> buffer,
- CORE_ADDR address,
- ULONGEST length)
+ CORE_ADDR address, ULONGEST length)
{
gdbpy_ref<membuf_object> membuf_obj (PyObject_New (membuf_object,
&membuf_object_type));
@@ -73,7 +73,7 @@ mbpy_str (PyObject *self)
{
membuf_object *membuf_obj = (membuf_object *) self;
- return PyUnicode_FromFormat (_("Memory buffer for address %s, \
+ return PyUnicode_FromFormat (_ ("Memory buffer for address %s, \
which is %s bytes long."),
paddress (gdbpy_enter::get_gdbarch (),
membuf_obj->addr),
@@ -86,9 +86,8 @@ get_buffer (PyObject *self, Py_buffer *buf, int flags)
membuf_object *membuf_obj = (membuf_object *) self;
int ret;
- ret = PyBuffer_FillInfo (buf, self, membuf_obj->buffer,
- membuf_obj->length, 0,
- PyBUF_CONTIG);
+ ret = PyBuffer_FillInfo (buf, self, membuf_obj->buffer, membuf_obj->length,
+ 0, PyBUF_CONTIG);
/* Despite the documentation saying this field is a "const char *",
in Python 3.4 at least, it's really a "char *". */
@@ -110,47 +109,43 @@ gdbpy_initialize_membuf (void)
(PyObject *) &membuf_object_type);
}
-static PyBufferProcs buffer_procs =
-{
- get_buffer
-};
+static PyBufferProcs buffer_procs = { get_buffer };
PyTypeObject membuf_object_type = {
- PyVarObject_HEAD_INIT (nullptr, 0)
- "gdb.Membuf", /*tp_name*/
- sizeof (membuf_object), /*tp_basicsize*/
- 0, /*tp_itemsize*/
- mbpy_dealloc, /*tp_dealloc*/
- 0, /*tp_print*/
- 0, /*tp_getattr*/
- 0, /*tp_setattr*/
- 0, /*tp_compare*/
- 0, /*tp_repr*/
- 0, /*tp_as_number*/
- 0, /*tp_as_sequence*/
- 0, /*tp_as_mapping*/
- 0, /*tp_hash */
- 0, /*tp_call*/
- mbpy_str, /*tp_str*/
- 0, /*tp_getattro*/
- 0, /*tp_setattro*/
- &buffer_procs, /*tp_as_buffer*/
- Py_TPFLAGS_DEFAULT, /*tp_flags*/
- "GDB memory buffer object", /*tp_doc*/
- 0, /* tp_traverse */
- 0, /* tp_clear */
- 0, /* tp_richcompare */
- 0, /* tp_weaklistoffset */
- 0, /* tp_iter */
- 0, /* tp_iternext */
- 0, /* tp_methods */
- 0, /* tp_members */
- 0, /* tp_getset */
- 0, /* tp_base */
- 0, /* tp_dict */
- 0, /* tp_descr_get */
- 0, /* tp_descr_set */
- 0, /* tp_dictoffset */
- 0, /* tp_init */
- 0, /* tp_alloc */
+ PyVarObject_HEAD_INIT (nullptr, 0) "gdb.Membuf", /*tp_name*/
+ sizeof (membuf_object), /*tp_basicsize*/
+ 0, /*tp_itemsize*/
+ mbpy_dealloc, /*tp_dealloc*/
+ 0, /*tp_print*/
+ 0, /*tp_getattr*/
+ 0, /*tp_setattr*/
+ 0, /*tp_compare*/
+ 0, /*tp_repr*/
+ 0, /*tp_as_number*/
+ 0, /*tp_as_sequence*/
+ 0, /*tp_as_mapping*/
+ 0, /*tp_hash */
+ 0, /*tp_call*/
+ mbpy_str, /*tp_str*/
+ 0, /*tp_getattro*/
+ 0, /*tp_setattro*/
+ &buffer_procs, /*tp_as_buffer*/
+ Py_TPFLAGS_DEFAULT, /*tp_flags*/
+ "GDB memory buffer object", /*tp_doc*/
+ 0, /* tp_traverse */
+ 0, /* tp_clear */
+ 0, /* tp_richcompare */
+ 0, /* tp_weaklistoffset */
+ 0, /* tp_iter */
+ 0, /* tp_iternext */
+ 0, /* tp_methods */
+ 0, /* tp_members */
+ 0, /* tp_getset */
+ 0, /* tp_base */
+ 0, /* tp_dict */
+ 0, /* tp_descr_get */
+ 0, /* tp_descr_set */
+ 0, /* tp_dictoffset */
+ 0, /* tp_init */
+ 0, /* tp_alloc */
};
diff --git a/gdb/python/py-micmd.c b/gdb/python/py-micmd.c
index ef87b9cb4db..b703fdc8e8b 100644
--- a/gdb/python/py-micmd.c
+++ b/gdb/python/py-micmd.c
@@ -39,7 +39,7 @@ static void
show_pymicmd_debug (struct ui_file *file, int from_tty,
struct cmd_list_element *c, const char *value)
{
- gdb_printf (file, _("Python MI command debugging is %s.\n"), value);
+ gdb_printf (file, _ ("Python MI command debugging is %s.\n"), value);
}
/* Print a "py-micmd" debug statement. */
@@ -60,10 +60,10 @@ struct micmdpy_object
{
PyObject_HEAD
- /* The object representing this command in the MI command table. This
+ /* The object representing this command in the MI command table. This
pointer can be nullptr if the command is not currently installed into
the MI command table (see gdb.MICommand.installed property). */
- struct mi_command_py *mi_command;
+ struct mi_command_py *mi_command;
/* The string representing the name of this command, without the leading
dash. This string is never nullptr once the Python object has been
@@ -147,8 +147,8 @@ struct mi_command_py : public mi_command
than changing the value of mi_command::m_name (which is not accessible
from here) to point to the name owned by the new object, swap the names
of the two objects, since we know they are identical strings. */
- gdb_assert (strcmp (new_pyobj->mi_command_name,
- m_pyobj->mi_command_name) == 0);
+ gdb_assert (strcmp (new_pyobj->mi_command_name, m_pyobj->mi_command_name)
+ == 0);
std::swap (new_pyobj->mi_command_name, m_pyobj->mi_command_name);
/* Take a reference to the new object, drop the reference to the current
@@ -157,17 +157,18 @@ struct mi_command_py : public mi_command
}
/* Called when the MI command is invoked. */
- virtual void invoke(struct mi_parse *parse) const override;
+ virtual void invoke (struct mi_parse *parse) const override;
private:
+
/* The Python object representing this MI command. */
gdbpy_ref<micmdpy_object> m_pyobj;
};
using mi_command_py_up = std::unique_ptr<mi_command_py>;
-extern PyTypeObject micmdpy_object_type
- CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF ("micmdpy_object");
+extern PyTypeObject
+ micmdpy_object_type CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF ("micmdpy_object");
/* Holds a Python object containing the string 'invoke'. */
@@ -194,7 +195,7 @@ py_object_to_mi_key (PyObject *key_obj)
if (key_repr_string == nullptr)
gdbpy_handle_exception ();
- gdbpy_error (_("non-string object used as key: %s"),
+ gdbpy_error (_ ("non-string object used as key: %s"),
key_repr_string.get ());
}
@@ -205,8 +206,7 @@ py_object_to_mi_key (PyObject *key_obj)
/* Predicate function, returns true if NAME is a valid field name for use
in MI result output, otherwise, returns false. */
- auto is_valid_key_name = [] (const char *name) -> bool
- {
+ auto is_valid_key_name = [] (const char *name) -> bool {
gdb_assert (name != nullptr);
if (*name == '\0' || !isalpha (*name))
@@ -222,9 +222,9 @@ py_object_to_mi_key (PyObject *key_obj)
if (!is_valid_key_name (key_string.get ()))
{
if (*key_string.get () == '\0')
- gdbpy_error (_("Invalid empty key in MI result"));
+ gdbpy_error (_ ("Invalid empty key in MI result"));
else
- gdbpy_error (_("Invalid key in MI result: %s"), key_string.get ());
+ gdbpy_error (_ ("Invalid key in MI result: %s"), key_string.get ());
}
return key_string;
@@ -256,8 +256,7 @@ serialize_mi_result_1 (PyObject *result, const char *field_name)
ui_out_emit_tuple tuple_emitter (uiout, field_name);
while (PyDict_Next (result, &pos, &key, &value))
{
- gdb::unique_xmalloc_ptr<char> key_string
- (py_object_to_mi_key (key));
+ gdb::unique_xmalloc_ptr<char> key_string (py_object_to_mi_key (key));
serialize_mi_result_1 (value, key_string.get ());
}
}
@@ -269,7 +268,7 @@ serialize_mi_result_1 (PyObject *result, const char *field_name)
gdbpy_handle_exception ();
for (Py_ssize_t i = 0; i < len; ++i)
{
- gdbpy_ref<> item (PySequence_ITEM (result, i));
+ gdbpy_ref<> item (PySequence_ITEM (result, i));
if (item == nullptr)
gdbpy_handle_exception ();
serialize_mi_result_1 (item.get (), nullptr);
@@ -318,14 +317,13 @@ serialize_mi_result (PyObject *result)
/* At the top-level, the result must be a dictionary. */
if (!PyDict_Check (result))
- gdbpy_error (_("Result from invoke must be a dictionary"));
+ gdbpy_error (_ ("Result from invoke must be a dictionary"));
PyObject *key, *value;
Py_ssize_t pos = 0;
while (PyDict_Next (result, &pos, &key, &value))
{
- gdb::unique_xmalloc_ptr<char> key_string
- (py_object_to_mi_key (key));
+ gdb::unique_xmalloc_ptr<char> key_string (py_object_to_mi_key (key));
serialize_mi_result_1 (value, key_string.get ());
}
}
@@ -343,8 +341,8 @@ mi_command_py::invoke (struct mi_parse *parse) const
mi_parse_argv (parse->args, parse);
if (parse->argv == nullptr)
- error (_("Problem parsing arguments: %s %s"), parse->command, parse->args);
-
+ error (_ ("Problem parsing arguments: %s %s"), parse->command,
+ parse->args);
gdbpy_enter enter_py;
@@ -365,9 +363,8 @@ mi_command_py::invoke (struct mi_parse *parse) const
gdb_assert (this->m_pyobj != nullptr);
gdb_assert (PyErr_Occurred () == nullptr);
- gdbpy_ref<> result
- (PyObject_CallMethodObjArgs ((PyObject *) this->m_pyobj.get (), invoke_cst,
- argobj.get (), nullptr));
+ gdbpy_ref<> result (PyObject_CallMethodObjArgs (
+ (PyObject *) this->m_pyobj.get (), invoke_cst, argobj.get (), nullptr));
if (result == nullptr)
gdbpy_handle_exception ();
@@ -454,7 +451,7 @@ micmdpy_install_command (micmdpy_object *obj)
/* There is already an MI command registered with that name, and it's not
a Python one. Forbid replacing a non-Python MI command. */
PyErr_SetString (PyExc_RuntimeError,
- _("unable to add command, name is already in use"));
+ _ ("unable to add command, name is already in use"));
return -1;
}
@@ -491,22 +488,21 @@ micmdpy_init (PyObject *self, PyObject *args, PyObject *kwargs)
static const char *keywords[] = { "name", nullptr };
const char *name;
- if (!gdb_PyArg_ParseTupleAndKeywords (args, kwargs, "s", keywords,
- &name))
+ if (!gdb_PyArg_ParseTupleAndKeywords (args, kwargs, "s", keywords, &name))
return -1;
/* Validate command name */
const int name_len = strlen (name);
if (name_len == 0)
{
- PyErr_SetString (PyExc_ValueError, _("MI command name is empty."));
+ PyErr_SetString (PyExc_ValueError, _ ("MI command name is empty."));
return -1;
}
else if ((name_len < 2) || (name[0] != '-') || !isalnum (name[1]))
{
PyErr_SetString (PyExc_ValueError,
- _("MI command name does not start with '-'"
- " followed by at least one letter or digit."));
+ _ ("MI command name does not start with '-'"
+ " followed by at least one letter or digit."));
return -1;
}
else
@@ -515,10 +511,10 @@ micmdpy_init (PyObject *self, PyObject *args, PyObject *kwargs)
{
if (!isalnum (name[i]) && name[i] != '-')
{
- PyErr_Format
- (PyExc_ValueError,
- _("MI command name contains invalid character: %c."),
- name[i]);
+ PyErr_Format (
+ PyExc_ValueError,
+ _ ("MI command name contains invalid character: %c."),
+ name[i]);
return -1;
}
}
@@ -542,9 +538,9 @@ micmdpy_init (PyObject *self, PyObject *args, PyObject *kwargs)
an excessive restriction. */
if (strcmp (cmd->mi_command_name, name) != 0)
{
- PyErr_SetString
- (PyExc_ValueError,
- _("can't reinitialize object with a different command name"));
+ PyErr_SetString (
+ PyExc_ValueError,
+ _ ("can't reinitialize object with a different command name"));
return -1;
}
@@ -577,7 +573,8 @@ micmdpy_dealloc (PyObject *obj)
be nullptr. */
pymicmd_debug_printf ("obj = %p, name = %s", cmd,
(cmd->mi_command_name == nullptr
- ? "(null)" : cmd->mi_command_name));
+ ? "(null)"
+ : cmd->mi_command_name));
/* As the mi_command_py object holds a reference to the micmdpy_object,
the only way the dealloc function can be called is if the mi_command_py
@@ -620,10 +617,9 @@ gdbpy_finalize_micommands ()
/* mi_command_py objects hold references to micmdpy_object objects. They must
be dropped before the Python interpreter is finalized. Do so by removing
those MI command entries, thus deleting the mi_command_py objects. */
- remove_mi_cmd_entries ([] (mi_command *cmd)
- {
- return as_mi_command_py (cmd) != nullptr;
- });
+ remove_mi_cmd_entries ([] (mi_command *cmd) {
+ return as_mi_command_py (cmd) != nullptr;
+ });
}
/* Get the gdb.MICommand.name attribute, returns a string, the name of this
@@ -680,60 +676,59 @@ static gdb_PyGetSetDef micmdpy_object_getset[] = {
{ "name", micmdpy_get_name, nullptr, "The command's name.", nullptr },
{ "installed", micmdpy_get_installed, micmdpy_set_installed,
"Is this command installed for use.", nullptr },
- { nullptr } /* Sentinel. */
+ { nullptr } /* Sentinel. */
};
/* The gdb.MICommand descriptor. */
PyTypeObject micmdpy_object_type = {
PyVarObject_HEAD_INIT (nullptr, 0) "gdb.MICommand", /*tp_name */
- sizeof (micmdpy_object), /*tp_basicsize */
- 0, /*tp_itemsize */
- micmdpy_dealloc, /*tp_dealloc */
- 0, /*tp_print */
- 0, /*tp_getattr */
- 0, /*tp_setattr */
- 0, /*tp_compare */
- 0, /*tp_repr */
- 0, /*tp_as_number */
- 0, /*tp_as_sequence */
- 0, /*tp_as_mapping */
- 0, /*tp_hash */
- 0, /*tp_call */
- 0, /*tp_str */
- 0, /*tp_getattro */
- 0, /*tp_setattro */
- 0, /*tp_as_buffer */
- Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /*tp_flags */
- "GDB mi-command object", /* tp_doc */
- 0, /* tp_traverse */
- 0, /* tp_clear */
- 0, /* tp_richcompare */
- 0, /* tp_weaklistoffset */
- 0, /* tp_iter */
- 0, /* tp_iternext */
- 0, /* tp_methods */
- 0, /* tp_members */
- micmdpy_object_getset, /* tp_getset */
- 0, /* tp_base */
- 0, /* tp_dict */
- 0, /* tp_descr_get */
- 0, /* tp_descr_set */
- 0, /* tp_dictoffset */
- micmdpy_init, /* tp_init */
- 0, /* tp_alloc */
+ sizeof (micmdpy_object), /*tp_basicsize */
+ 0, /*tp_itemsize */
+ micmdpy_dealloc, /*tp_dealloc */
+ 0, /*tp_print */
+ 0, /*tp_getattr */
+ 0, /*tp_setattr */
+ 0, /*tp_compare */
+ 0, /*tp_repr */
+ 0, /*tp_as_number */
+ 0, /*tp_as_sequence */
+ 0, /*tp_as_mapping */
+ 0, /*tp_hash */
+ 0, /*tp_call */
+ 0, /*tp_str */
+ 0, /*tp_getattro */
+ 0, /*tp_setattro */
+ 0, /*tp_as_buffer */
+ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /*tp_flags */
+ "GDB mi-command object", /* tp_doc */
+ 0, /* tp_traverse */
+ 0, /* tp_clear */
+ 0, /* tp_richcompare */
+ 0, /* tp_weaklistoffset */
+ 0, /* tp_iter */
+ 0, /* tp_iternext */
+ 0, /* tp_methods */
+ 0, /* tp_members */
+ micmdpy_object_getset, /* tp_getset */
+ 0, /* tp_base */
+ 0, /* tp_dict */
+ 0, /* tp_descr_get */
+ 0, /* tp_descr_set */
+ 0, /* tp_dictoffset */
+ micmdpy_init, /* tp_init */
+ 0, /* tp_alloc */
};
void _initialize_py_micmd ();
+
void
_initialize_py_micmd ()
{
- add_setshow_boolean_cmd
- ("py-micmd", class_maintenance, &pymicmd_debug,
- _("Set Python micmd debugging."),
- _("Show Python micmd debugging."),
- _("When on, Python micmd debugging is enabled."),
- nullptr,
- show_pymicmd_debug,
- &setdebuglist, &showdebuglist);
+ add_setshow_boolean_cmd ("py-micmd", class_maintenance, &pymicmd_debug,
+ _ ("Set Python micmd debugging."),
+ _ ("Show Python micmd debugging."),
+ _ ("When on, Python micmd debugging is enabled."),
+ nullptr, show_pymicmd_debug, &setdebuglist,
+ &showdebuglist);
}
diff --git a/gdb/python/py-newobjfileevent.c b/gdb/python/py-newobjfileevent.c
index 34e8e4923b5..27fa5f210dd 100644
--- a/gdb/python/py-newobjfileevent.c
+++ b/gdb/python/py-newobjfileevent.c
@@ -29,9 +29,10 @@ create_new_objfile_event_object (struct objfile *objfile)
return NULL;
gdbpy_ref<> py_objfile = objfile_to_objfile_object (objfile);
- if (py_objfile == NULL || evpy_add_attribute (objfile_event.get (),
- "new_objfile",
- py_objfile.get ()) < 0)
+ if (py_objfile == NULL
+ || evpy_add_attribute (objfile_event.get (), "new_objfile",
+ py_objfile.get ())
+ < 0)
return NULL;
return objfile_event;
@@ -67,7 +68,8 @@ create_free_objfile_event_object (struct objfile *objfile)
gdbpy_ref<> py_objfile = objfile_to_objfile_object (objfile);
if (py_objfile == nullptr
|| evpy_add_attribute (objfile_event.get (), "objfile",
- py_objfile.get ()) < 0)
+ py_objfile.get ())
+ < 0)
return nullptr;
return objfile_event;
@@ -89,7 +91,6 @@ emit_free_objfile_event (struct objfile *objfile)
return evpy_emit_event (event.get (), gdb_py_events.free_objfile);
}
-
/* Subroutine of emit_clear_objfiles_event to simplify it. */
static gdbpy_ref<>
@@ -101,9 +102,10 @@ create_clear_objfiles_event_object (void)
return NULL;
gdbpy_ref<> py_progspace = pspace_to_pspace_object (current_program_space);
- if (py_progspace == NULL || evpy_add_attribute (objfile_event.get (),
- "progspace",
- py_progspace.get ()) < 0)
+ if (py_progspace == NULL
+ || evpy_add_attribute (objfile_event.get (), "progspace",
+ py_progspace.get ())
+ < 0)
return NULL;
return objfile_event;
diff --git a/gdb/python/py-objfile.c b/gdb/python/py-objfile.c
index b15a3fe2dba..da76fb3951e 100644
--- a/gdb/python/py-objfile.c
+++ b/gdb/python/py-objfile.c
@@ -30,8 +30,8 @@ struct objfile_object
{
PyObject_HEAD
- /* The corresponding objfile. */
- struct objfile *objfile;
+ /* The corresponding objfile. */
+ struct objfile *objfile;
/* Dictionary holding user-added attributes.
This is the __dict__ attribute of the object. */
@@ -53,8 +53,8 @@ struct objfile_object
PyObject *xmethods;
};
-extern PyTypeObject objfile_object_type
- CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF ("objfile_object");
+extern PyTypeObject
+ objfile_object_type CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF ("objfile_object");
/* Clear the OBJFILE pointer in an Objfile object and remove the
reference. */
@@ -69,20 +69,20 @@ struct objfpy_deleter
};
static const registry<objfile>::key<objfile_object, objfpy_deleter>
- objfpy_objfile_data_key;
+ objfpy_objfile_data_key;
/* Require that OBJF be a valid objfile. */
-#define OBJFPY_REQUIRE_VALID(obj) \
- do { \
- if (!(obj)->objfile) \
- { \
- PyErr_SetString (PyExc_RuntimeError, \
- _("Objfile no longer exists.")); \
- return NULL; \
- } \
- } while (0)
-
-
+#define OBJFPY_REQUIRE_VALID(obj) \
+ do \
+ { \
+ if (!(obj)->objfile) \
+ { \
+ PyErr_SetString (PyExc_RuntimeError, \
+ _ ("Objfile no longer exists.")); \
+ return NULL; \
+ } \
+ } \
+ while (0)
/* An Objfile method which returns the objfile's file name, or None. */
@@ -92,8 +92,8 @@ objfpy_get_filename (PyObject *self, void *closure)
objfile_object *obj = (objfile_object *) self;
if (obj->objfile)
- return (host_string_to_python_string (objfile_name (obj->objfile))
- .release ());
+ return (
+ host_string_to_python_string (objfile_name (obj->objfile)).release ());
Py_RETURN_NONE;
}
@@ -265,17 +265,17 @@ objfpy_set_printers (PyObject *o, PyObject *value, void *ignore)
{
objfile_object *self = (objfile_object *) o;
- if (! value)
+ if (!value)
{
PyErr_SetString (PyExc_TypeError,
- _("Cannot delete the pretty_printers attribute."));
+ _ ("Cannot delete the pretty_printers attribute."));
return -1;
}
- if (! PyList_Check (value))
+ if (!PyList_Check (value))
{
PyErr_SetString (PyExc_TypeError,
- _("The pretty_printers attribute must be a list."));
+ _ ("The pretty_printers attribute must be a list."));
return -1;
}
@@ -304,17 +304,18 @@ objfpy_set_frame_filters (PyObject *o, PyObject *filters, void *ignore)
{
objfile_object *self = (objfile_object *) o;
- if (! filters)
+ if (!filters)
{
PyErr_SetString (PyExc_TypeError,
- _("Cannot delete the frame filters attribute."));
+ _ ("Cannot delete the frame filters attribute."));
return -1;
}
- if (! PyDict_Check (filters))
+ if (!PyDict_Check (filters))
{
- PyErr_SetString (PyExc_TypeError,
- _("The frame_filters attribute must be a dictionary."));
+ PyErr_SetString (
+ PyExc_TypeError,
+ _ ("The frame_filters attribute must be a dictionary."));
return -1;
}
@@ -347,14 +348,14 @@ objfpy_set_frame_unwinders (PyObject *o, PyObject *unwinders, void *ignore)
if (!unwinders)
{
PyErr_SetString (PyExc_TypeError,
- _("Cannot delete the frame unwinders attribute."));
+ _ ("Cannot delete the frame unwinders attribute."));
return -1;
}
if (!PyList_Check (unwinders))
{
PyErr_SetString (PyExc_TypeError,
- _("The frame_unwinders attribute must be a list."));
+ _ ("The frame_unwinders attribute must be a list."));
return -1;
}
@@ -395,17 +396,17 @@ objfpy_set_type_printers (PyObject *o, PyObject *value, void *ignore)
{
objfile_object *self = (objfile_object *) o;
- if (! value)
+ if (!value)
{
PyErr_SetString (PyExc_TypeError,
- _("Cannot delete the type_printers attribute."));
+ _ ("Cannot delete the type_printers attribute."));
return -1;
}
- if (! PyList_Check (value))
+ if (!PyList_Check (value))
{
PyErr_SetString (PyExc_TypeError,
- _("The type_printers attribute must be a list."));
+ _ ("The type_printers attribute must be a list."));
return -1;
}
@@ -425,7 +426,7 @@ objfpy_is_valid (PyObject *self, PyObject *args)
{
objfile_object *obj = (objfile_object *) self;
- if (! obj->objfile)
+ if (!obj->objfile)
Py_RETURN_FALSE;
Py_RETURN_TRUE;
@@ -472,14 +473,16 @@ objfpy_lookup_global_symbol (PyObject *self, PyObject *args, PyObject *kw)
OBJFPY_REQUIRE_VALID (obj);
- if (!gdb_PyArg_ParseTupleAndKeywords (args, kw, "s|i", keywords, &symbol_name,
- &domain))
+ if (!gdb_PyArg_ParseTupleAndKeywords (args, kw, "s|i", keywords,
+ &symbol_name, &domain))
return nullptr;
try
{
- struct symbol *sym = lookup_global_symbol_from_objfile
- (obj->objfile, GLOBAL_BLOCK, symbol_name, (domain_enum) domain).symbol;
+ struct symbol *sym
+ = lookup_global_symbol_from_objfile (obj->objfile, GLOBAL_BLOCK,
+ symbol_name, (domain_enum) domain)
+ .symbol;
if (sym == nullptr)
Py_RETURN_NONE;
@@ -506,14 +509,16 @@ objfpy_lookup_static_symbol (PyObject *self, PyObject *args, PyObject *kw)
OBJFPY_REQUIRE_VALID (obj);
- if (!gdb_PyArg_ParseTupleAndKeywords (args, kw, "s|i", keywords, &symbol_name,
- &domain))
+ if (!gdb_PyArg_ParseTupleAndKeywords (args, kw, "s|i", keywords,
+ &symbol_name, &domain))
return nullptr;
try
{
- struct symbol *sym = lookup_global_symbol_from_objfile
- (obj->objfile, STATIC_BLOCK, symbol_name, (domain_enum) domain).symbol;
+ struct symbol *sym
+ = lookup_global_symbol_from_objfile (obj->objfile, STATIC_BLOCK,
+ symbol_name, (domain_enum) domain)
+ .symbol;
if (sym == nullptr)
Py_RETURN_NONE;
@@ -595,8 +600,8 @@ gdbpy_lookup_objfile (PyObject *self, PyObject *args, PyObject *kw)
PyObject *by_build_id_obj = NULL;
int by_build_id;
- if (!gdb_PyArg_ParseTupleAndKeywords (args, kw, "s|O!", keywords,
- &name, &PyBool_Type, &by_build_id_obj))
+ if (!gdb_PyArg_ParseTupleAndKeywords (args, kw, "s|O!", keywords, &name,
+ &PyBool_Type, &by_build_id_obj))
return NULL;
by_build_id = 0;
@@ -611,72 +616,69 @@ gdbpy_lookup_objfile (PyObject *self, PyObject *args, PyObject *kw)
if (by_build_id && !objfpy_build_id_ok (name))
{
- PyErr_SetString (PyExc_TypeError, _("Not a valid build id."));
+ PyErr_SetString (PyExc_TypeError, _ ("Not a valid build id."));
return NULL;
}
struct objfile *objfile = nullptr;
if (by_build_id)
- gdbarch_iterate_over_objfiles_in_search_order
- (target_gdbarch (),
- [&objfile, name] (struct objfile *obj)
- {
- /* Don't return separate debug files. */
- if (obj->separate_debug_objfile_backlink != nullptr)
- return 0;
-
- bfd *obfd = obj->obfd.get ();
- if (obfd == nullptr)
- return 0;
-
- const bfd_build_id *obfd_build_id = build_id_bfd_get (obfd);
- if (obfd_build_id == nullptr)
- return 0;
-
- if (!objfpy_build_id_matches (obfd_build_id, name))
- return 0;
-
- objfile = obj;
- return 1;
- }, gdbpy_current_objfile);
+ gdbarch_iterate_over_objfiles_in_search_order (
+ target_gdbarch (),
+ [&objfile, name] (struct objfile *obj) {
+ /* Don't return separate debug files. */
+ if (obj->separate_debug_objfile_backlink != nullptr)
+ return 0;
+
+ bfd *obfd = obj->obfd.get ();
+ if (obfd == nullptr)
+ return 0;
+
+ const bfd_build_id *obfd_build_id = build_id_bfd_get (obfd);
+ if (obfd_build_id == nullptr)
+ return 0;
+
+ if (!objfpy_build_id_matches (obfd_build_id, name))
+ return 0;
+
+ objfile = obj;
+ return 1;
+ },
+ gdbpy_current_objfile);
else
- gdbarch_iterate_over_objfiles_in_search_order
- (target_gdbarch (),
- [&objfile, name] (struct objfile *obj)
- {
- /* Don't return separate debug files. */
- if (obj->separate_debug_objfile_backlink != nullptr)
- return 0;
-
- if ((obj->flags & OBJF_NOT_FILENAME) != 0)
- return 0;
-
- const char *filename = objfile_filename (obj);
- if (filename != NULL
- && compare_filenames_for_search (filename, name))
- {
- objfile = obj;
- return 1;
- }
-
- if (compare_filenames_for_search (obj->original_name, name))
- {
- objfile = obj;
- return 1;
- }
-
- return 0;
- }, gdbpy_current_objfile);
+ gdbarch_iterate_over_objfiles_in_search_order (
+ target_gdbarch (),
+ [&objfile, name] (struct objfile *obj) {
+ /* Don't return separate debug files. */
+ if (obj->separate_debug_objfile_backlink != nullptr)
+ return 0;
+
+ if ((obj->flags & OBJF_NOT_FILENAME) != 0)
+ return 0;
+
+ const char *filename = objfile_filename (obj);
+ if (filename != NULL && compare_filenames_for_search (filename, name))
+ {
+ objfile = obj;
+ return 1;
+ }
+
+ if (compare_filenames_for_search (obj->original_name, name))
+ {
+ objfile = obj;
+ return 1;
+ }
+
+ return 0;
+ },
+ gdbpy_current_objfile);
if (objfile != NULL)
return objfile_to_objfile_object (objfile).release ();
- PyErr_SetString (PyExc_ValueError, _("Objfile not found."));
+ PyErr_SetString (PyExc_ValueError, _ ("Objfile not found."));
return NULL;
}
-
-
/* Return a new reference to the Python object of type Objfile
representing OBJFILE. If the object has already been created,
return it. Otherwise, create it. Return NULL and set the Python
@@ -685,12 +687,11 @@ gdbpy_lookup_objfile (PyObject *self, PyObject *args, PyObject *kw)
gdbpy_ref<>
objfile_to_objfile_object (struct objfile *objfile)
{
- PyObject *result
- = (PyObject *) objfpy_objfile_data_key.get (objfile);
+ PyObject *result = (PyObject *) objfpy_objfile_data_key.get (objfile);
if (result == NULL)
{
- gdbpy_ref<objfile_object> object
- ((objfile_object *) PyObject_New (objfile_object, &objfile_object_type));
+ gdbpy_ref<objfile_object> object ((objfile_object *) PyObject_New (
+ objfile_object, &objfile_object_type));
if (object == NULL)
return NULL;
if (!objfpy_initialize (object.get ()))
@@ -714,100 +715,87 @@ gdbpy_initialize_objfile (void)
(PyObject *) &objfile_object_type);
}
-
-
-static PyMethodDef objfile_object_methods[] =
-{
- { "is_valid", objfpy_is_valid, METH_NOARGS,
- "is_valid () -> Boolean.\n\
+static PyMethodDef objfile_object_methods[] = {
+ { "is_valid", objfpy_is_valid, METH_NOARGS, "is_valid () -> Boolean.\n\
Return true if this object file is valid, false if not." },
{ "add_separate_debug_file", (PyCFunction) objfpy_add_separate_debug_file,
- METH_VARARGS | METH_KEYWORDS,
- "add_separate_debug_file (file_name).\n\
+ METH_VARARGS | METH_KEYWORDS, "add_separate_debug_file (file_name).\n\
Add FILE_NAME to the list of files containing debug info for the objfile." },
{ "lookup_global_symbol", (PyCFunction) objfpy_lookup_global_symbol,
- METH_VARARGS | METH_KEYWORDS,
- "lookup_global_symbol (name [, domain]).\n\
+ METH_VARARGS | METH_KEYWORDS, "lookup_global_symbol (name [, domain]).\n\
Look up a global symbol in this objfile and return it." },
{ "lookup_static_symbol", (PyCFunction) objfpy_lookup_static_symbol,
- METH_VARARGS | METH_KEYWORDS,
- "lookup_static_symbol (name [, domain]).\n\
+ METH_VARARGS | METH_KEYWORDS, "lookup_static_symbol (name [, domain]).\n\
Look up a static-linkage global symbol in this objfile and return it." },
{ NULL }
};
-static gdb_PyGetSetDef objfile_getset[] =
-{
- { "__dict__", gdb_py_generic_dict, NULL,
- "The __dict__ for this objfile.", &objfile_object_type },
- { "filename", objfpy_get_filename, NULL,
- "The objfile's filename, or None.", NULL },
- { "username", objfpy_get_username, NULL,
- "The name of the objfile as provided by the user, or None.", NULL },
- { "owner", objfpy_get_owner, NULL,
- "The objfile owner of separate debug info objfiles, or None.",
- NULL },
- { "build_id", objfpy_get_build_id, NULL,
- "The objfile's build id, or None.", NULL },
- { "progspace", objfpy_get_progspace, NULL,
- "The objfile's progspace, or None.", NULL },
- { "pretty_printers", objfpy_get_printers, objfpy_set_printers,
- "Pretty printers.", NULL },
- { "frame_filters", objfpy_get_frame_filters,
- objfpy_set_frame_filters, "Frame Filters.", NULL },
- { "frame_unwinders", objfpy_get_frame_unwinders,
- objfpy_set_frame_unwinders, "Frame Unwinders", NULL },
- { "type_printers", objfpy_get_type_printers, objfpy_set_type_printers,
- "Type printers.", NULL },
- { "xmethods", objfpy_get_xmethods, NULL,
- "Debug methods.", NULL },
- { "is_file", objfpy_get_is_file, nullptr,
- "Whether this objfile came from a file.", nullptr },
- { NULL }
-};
-
-PyTypeObject objfile_object_type =
-{
- PyVarObject_HEAD_INIT (NULL, 0)
- "gdb.Objfile", /*tp_name*/
- sizeof (objfile_object), /*tp_basicsize*/
- 0, /*tp_itemsize*/
- objfpy_dealloc, /*tp_dealloc*/
- 0, /*tp_print*/
- 0, /*tp_getattr*/
- 0, /*tp_setattr*/
- 0, /*tp_compare*/
- objfpy_repr, /*tp_repr*/
- 0, /*tp_as_number*/
- 0, /*tp_as_sequence*/
- 0, /*tp_as_mapping*/
- 0, /*tp_hash */
- 0, /*tp_call*/
- 0, /*tp_str*/
- 0, /*tp_getattro*/
- 0, /*tp_setattro*/
- 0, /*tp_as_buffer*/
- Py_TPFLAGS_DEFAULT, /*tp_flags*/
- "GDB objfile object", /* tp_doc */
- 0, /* tp_traverse */
- 0, /* tp_clear */
- 0, /* tp_richcompare */
- 0, /* tp_weaklistoffset */
- 0, /* tp_iter */
- 0, /* tp_iternext */
- objfile_object_methods, /* tp_methods */
- 0, /* tp_members */
- objfile_getset, /* tp_getset */
- 0, /* tp_base */
- 0, /* tp_dict */
- 0, /* tp_descr_get */
- 0, /* tp_descr_set */
- offsetof (objfile_object, dict), /* tp_dictoffset */
- 0, /* tp_init */
- 0, /* tp_alloc */
- objfpy_new, /* tp_new */
+static gdb_PyGetSetDef objfile_getset[]
+ = { { "__dict__", gdb_py_generic_dict, NULL,
+ "The __dict__ for this objfile.", &objfile_object_type },
+ { "filename", objfpy_get_filename, NULL,
+ "The objfile's filename, or None.", NULL },
+ { "username", objfpy_get_username, NULL,
+ "The name of the objfile as provided by the user, or None.", NULL },
+ { "owner", objfpy_get_owner, NULL,
+ "The objfile owner of separate debug info objfiles, or None.", NULL },
+ { "build_id", objfpy_get_build_id, NULL,
+ "The objfile's build id, or None.", NULL },
+ { "progspace", objfpy_get_progspace, NULL,
+ "The objfile's progspace, or None.", NULL },
+ { "pretty_printers", objfpy_get_printers, objfpy_set_printers,
+ "Pretty printers.", NULL },
+ { "frame_filters", objfpy_get_frame_filters, objfpy_set_frame_filters,
+ "Frame Filters.", NULL },
+ { "frame_unwinders", objfpy_get_frame_unwinders,
+ objfpy_set_frame_unwinders, "Frame Unwinders", NULL },
+ { "type_printers", objfpy_get_type_printers, objfpy_set_type_printers,
+ "Type printers.", NULL },
+ { "xmethods", objfpy_get_xmethods, NULL, "Debug methods.", NULL },
+ { "is_file", objfpy_get_is_file, nullptr,
+ "Whether this objfile came from a file.", nullptr },
+ { NULL } };
+
+PyTypeObject objfile_object_type = {
+ PyVarObject_HEAD_INIT (NULL, 0) "gdb.Objfile", /*tp_name*/
+ sizeof (objfile_object), /*tp_basicsize*/
+ 0, /*tp_itemsize*/
+ objfpy_dealloc, /*tp_dealloc*/
+ 0, /*tp_print*/
+ 0, /*tp_getattr*/
+ 0, /*tp_setattr*/
+ 0, /*tp_compare*/
+ objfpy_repr, /*tp_repr*/
+ 0, /*tp_as_number*/
+ 0, /*tp_as_sequence*/
+ 0, /*tp_as_mapping*/
+ 0, /*tp_hash */
+ 0, /*tp_call*/
+ 0, /*tp_str*/
+ 0, /*tp_getattro*/
+ 0, /*tp_setattro*/
+ 0, /*tp_as_buffer*/
+ Py_TPFLAGS_DEFAULT, /*tp_flags*/
+ "GDB objfile object", /* tp_doc */
+ 0, /* tp_traverse */
+ 0, /* tp_clear */
+ 0, /* tp_richcompare */
+ 0, /* tp_weaklistoffset */
+ 0, /* tp_iter */
+ 0, /* tp_iternext */
+ objfile_object_methods, /* tp_methods */
+ 0, /* tp_members */
+ objfile_getset, /* tp_getset */
+ 0, /* tp_base */
+ 0, /* tp_dict */
+ 0, /* tp_descr_get */
+ 0, /* tp_descr_set */
+ offsetof (objfile_object, dict), /* tp_dictoffset */
+ 0, /* tp_init */
+ 0, /* tp_alloc */
+ objfpy_new, /* tp_new */
};
diff --git a/gdb/python/py-param.c b/gdb/python/py-param.c
index a1bd4e09788..935612bad08 100644
--- a/gdb/python/py-param.c
+++ b/gdb/python/py-param.c
@@ -17,7 +17,6 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
-
#include "defs.h"
#include "value.h"
#include "python-internal.h"
@@ -44,8 +43,7 @@ enum param_types
param_zuinteger,
param_zuinteger_unlimited,
param_enum,
-}
-param_types;
+} param_types;
/* Translation from Python parameters to GDB variable types. Keep in the
same order as PARAM_TYPES due to C++'s lack of designated initializers. */
@@ -57,43 +55,38 @@ static const struct
/* Extra literals, such as `unlimited', accepted in lieu of a number. */
const literal_def *extra_literals;
-}
-param_to_var[] =
-{
- { var_boolean },
- { var_auto_boolean },
- { var_uinteger, uinteger_unlimited_literals },
- { var_integer, integer_unlimited_literals },
- { var_string },
- { var_string_noescape },
- { var_optional_filename },
- { var_filename },
- { var_integer },
- { var_uinteger },
- { var_pinteger, pinteger_unlimited_literals },
- { var_enum }
-};
+} param_to_var[] = { { var_boolean },
+ { var_auto_boolean },
+ { var_uinteger, uinteger_unlimited_literals },
+ { var_integer, integer_unlimited_literals },
+ { var_string },
+ { var_string_noescape },
+ { var_optional_filename },
+ { var_filename },
+ { var_integer },
+ { var_uinteger },
+ { var_pinteger, pinteger_unlimited_literals },
+ { var_enum } };
/* Parameter constants and their values. */
-static struct {
+static struct
+{
const char *name;
int value;
-} parm_constants[] =
-{
- { "PARAM_BOOLEAN", param_boolean }, /* ARI: param_boolean */
- { "PARAM_AUTO_BOOLEAN", param_auto_boolean },
- { "PARAM_UINTEGER", param_uinteger },
- { "PARAM_INTEGER", param_integer },
- { "PARAM_STRING", param_string },
- { "PARAM_STRING_NOESCAPE", param_string_noescape },
- { "PARAM_OPTIONAL_FILENAME", param_optional_filename },
- { "PARAM_FILENAME", param_filename },
- { "PARAM_ZINTEGER", param_zinteger },
- { "PARAM_ZUINTEGER", param_zuinteger },
- { "PARAM_ZUINTEGER_UNLIMITED", param_zuinteger_unlimited },
- { "PARAM_ENUM", param_enum },
- { NULL, 0 }
-};
+} parm_constants[]
+ = { { "PARAM_BOOLEAN", param_boolean }, /* ARI: param_boolean */
+ { "PARAM_AUTO_BOOLEAN", param_auto_boolean },
+ { "PARAM_UINTEGER", param_uinteger },
+ { "PARAM_INTEGER", param_integer },
+ { "PARAM_STRING", param_string },
+ { "PARAM_STRING_NOESCAPE", param_string_noescape },
+ { "PARAM_OPTIONAL_FILENAME", param_optional_filename },
+ { "PARAM_FILENAME", param_filename },
+ { "PARAM_ZINTEGER", param_zinteger },
+ { "PARAM_ZUINTEGER", param_zuinteger },
+ { "PARAM_ZUINTEGER_UNLIMITED", param_zuinteger_unlimited },
+ { "PARAM_ENUM", param_enum },
+ { NULL, 0 } };
/* A union that can hold anything described by enum var_types. */
union parmpy_variable
@@ -123,8 +116,8 @@ struct parmpy_object
{
PyObject_HEAD
- /* The type of the parameter. */
- enum var_types type;
+ /* The type of the parameter. */
+ enum var_types type;
/* Extra literals, such as `unlimited', accepted in lieu of a number. */
const literal_def *extra_literals;
@@ -163,21 +156,19 @@ make_setting (parmpy_object *s)
gdb_assert_not_reached ("unhandled var type");
}
-extern PyTypeObject parmpy_object_type
- CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF ("parmpy_object");
+extern PyTypeObject
+ parmpy_object_type CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF ("parmpy_object");
/* Some handy string constants. */
static PyObject *set_doc_cst;
static PyObject *show_doc_cst;
-
-
/* Get an attribute. */
static PyObject *
get_attr (PyObject *obj, PyObject *attr_name)
{
if (PyUnicode_Check (attr_name)
- && ! PyUnicode_CompareWithASCIIString (attr_name, "value"))
+ && !PyUnicode_CompareWithASCIIString (attr_name, "value"))
{
parmpy_object *self = (parmpy_object *) obj;
@@ -200,12 +191,11 @@ set_parameter_value (parmpy_object *self, PyObject *value)
case var_string_noescape:
case var_optional_filename:
case var_filename:
- if (! gdbpy_is_string (value)
- && (self->type == var_filename
- || value != Py_None))
+ if (!gdbpy_is_string (value)
+ && (self->type == var_filename || value != Py_None))
{
PyErr_SetString (PyExc_RuntimeError,
- _("String required for filename."));
+ _ ("String required for filename."));
return -1;
}
@@ -213,8 +203,8 @@ set_parameter_value (parmpy_object *self, PyObject *value)
self->value.stringval->clear ();
else
{
- gdb::unique_xmalloc_ptr<char>
- string (python_string_to_host_string (value));
+ gdb::unique_xmalloc_ptr<char> string (
+ python_string_to_host_string (value));
if (string == NULL)
return -1;
@@ -226,24 +216,25 @@ set_parameter_value (parmpy_object *self, PyObject *value)
{
int i;
- if (! gdbpy_is_string (value))
+ if (!gdbpy_is_string (value))
{
PyErr_SetString (PyExc_RuntimeError,
- _("ENUM arguments must be a string."));
+ _ ("ENUM arguments must be a string."));
return -1;
}
- gdb::unique_xmalloc_ptr<char>
- str (python_string_to_host_string (value));
+ gdb::unique_xmalloc_ptr<char> str (
+ python_string_to_host_string (value));
if (str == NULL)
return -1;
for (i = 0; self->enumeration[i]; ++i)
- if (! strcmp (self->enumeration[i], str.get ()))
+ if (!strcmp (self->enumeration[i], str.get ()))
break;
- if (! self->enumeration[i])
+ if (!self->enumeration[i])
{
- PyErr_SetString (PyExc_RuntimeError,
- _("The value must be member of an enumeration."));
+ PyErr_SetString (
+ PyExc_RuntimeError,
+ _ ("The value must be member of an enumeration."));
return -1;
}
self->value.cstringval = self->enumeration[i];
@@ -251,23 +242,23 @@ set_parameter_value (parmpy_object *self, PyObject *value)
}
case var_boolean:
- if (! PyBool_Check (value))
+ if (!PyBool_Check (value))
{
PyErr_SetString (PyExc_RuntimeError,
- _("A boolean argument is required."));
+ _ ("A boolean argument is required."));
return -1;
}
cmp = PyObject_IsTrue (value);
if (cmp < 0)
- return -1;
+ return -1;
self->value.boolval = cmp;
break;
case var_auto_boolean:
- if (! PyBool_Check (value) && value != Py_None)
+ if (!PyBool_Check (value) && value != Py_None)
{
PyErr_SetString (PyExc_RuntimeError,
- _("A boolean or None is required"));
+ _ ("A boolean or None is required"));
return -1;
}
@@ -276,8 +267,8 @@ set_parameter_value (parmpy_object *self, PyObject *value)
else
{
cmp = PyObject_IsTrue (value);
- if (cmp < 0 )
- return -1;
+ if (cmp < 0)
+ return -1;
if (cmp == 1)
self->value.autoboolval = AUTO_BOOLEAN_TRUE;
else
@@ -298,13 +289,12 @@ set_parameter_value (parmpy_object *self, PyObject *value)
if (extra_literals != nullptr)
{
- gdb::unique_xmalloc_ptr<char>
- str (python_string_to_host_string (value));
+ gdb::unique_xmalloc_ptr<char> str (
+ python_string_to_host_string (value));
const char *s = str != nullptr ? str.get () : nullptr;
PyErr_Clear ();
- for (const literal_def *l = extra_literals;
- l->literal != nullptr;
+ for (const literal_def *l = extra_literals; l->literal != nullptr;
l++, count++)
{
if (count != 0)
@@ -328,23 +318,23 @@ set_parameter_value (parmpy_object *self, PyObject *value)
{
if (extra_literals == nullptr)
PyErr_SetString (PyExc_RuntimeError,
- _("The value must be integer."));
+ _ ("The value must be integer."));
else if (count > 1)
PyErr_SetString (PyExc_RuntimeError,
- string_printf (_("integer or one of: %s"),
- buffer.c_str ()).c_str ());
+ string_printf (_ ("integer or one of: %s"),
+ buffer.c_str ())
+ .c_str ());
else
PyErr_SetString (PyExc_RuntimeError,
- string_printf (_("integer or %s"),
- buffer.c_str ()).c_str ());
+ string_printf (_ ("integer or %s"),
+ buffer.c_str ())
+ .c_str ());
return -1;
}
-
if (extra_literals != nullptr)
for (const literal_def *l = extra_literals;
- l->literal != nullptr;
- l++)
+ l->literal != nullptr; l++)
{
if (l->val.has_value () && val == *l->val)
{
@@ -355,7 +345,7 @@ set_parameter_value (parmpy_object *self, PyObject *value)
else if (val == l->use)
allowed = TRIBOOL_FALSE;
}
- }
+ }
if (allowed == TRIBOOL_UNKNOWN)
{
@@ -368,8 +358,7 @@ set_parameter_value (parmpy_object *self, PyObject *value)
}
if (allowed == TRIBOOL_FALSE)
{
- PyErr_SetString (PyExc_RuntimeError,
- _("Range exceeded."));
+ PyErr_SetString (PyExc_RuntimeError, _ ("Range exceeded."));
return -1;
}
@@ -382,7 +371,7 @@ set_parameter_value (parmpy_object *self, PyObject *value)
default:
PyErr_SetString (PyExc_RuntimeError,
- _("Unhandled type in parameter value."));
+ _ ("Unhandled type in parameter value."));
return -1;
}
@@ -394,12 +383,12 @@ static int
set_attr (PyObject *obj, PyObject *attr_name, PyObject *val)
{
if (PyUnicode_Check (attr_name)
- && ! PyUnicode_CompareWithASCIIString (attr_name, "value"))
+ && !PyUnicode_CompareWithASCIIString (attr_name, "value"))
{
if (!val)
{
PyErr_SetString (PyExc_RuntimeError,
- _("Cannot delete a parameter's value."));
+ _ ("Cannot delete a parameter's value."));
return -1;
}
return set_parameter_value ((parmpy_object *) obj, val);
@@ -419,8 +408,7 @@ set_attr (PyObject *obj, PyObject *attr_name, PyObject *val)
static std::string
full_cmd_name_without_first_prefix (struct cmd_list_element *c)
{
- std::vector<std::string> components
- = c->command_components ();
+ std::vector<std::string> components = c->command_components ();
gdb_assert (components.size () > 1);
std::string result = components[1];
for (int i = 2; i < components.size (); ++i)
@@ -478,15 +466,15 @@ get_doc_string (PyObject *object, enum doc_string_type doc_type,
if (result == nullptr)
{
if (doc_type == doc_string_description)
- result.reset (xstrdup (_("This command is not documented.")));
+ result.reset (xstrdup (_ ("This command is not documented.")));
else
{
if (doc_type == doc_string_show)
- result = xstrprintf (_("Show the current value of '%s'."),
- cmd_name);
+ result
+ = xstrprintf (_ ("Show the current value of '%s'."), cmd_name);
else
- result = xstrprintf (_("Set the current value of '%s'."),
- cmd_name);
+ result
+ = xstrprintf (_ ("Set the current value of '%s'."), cmd_name);
}
}
return result;
@@ -508,13 +496,13 @@ call_doc_function (PyObject *obj, PyObject *method, PyObject *arg)
if (gdbpy_is_string (result.get ()))
{
data = python_string_to_host_string (result.get ());
- if (! data)
+ if (!data)
return NULL;
}
else
{
PyErr_SetString (PyExc_RuntimeError,
- _("Parameter must return a string value."));
+ _ ("Parameter must return a string value."));
return NULL;
}
@@ -527,8 +515,7 @@ call_doc_function (PyObject *obj, PyObject *method, PyObject *arg)
is then printed. If "get_set_string" does not exist, or returns an
empty string, then nothing is printed. */
static void
-get_set_value (const char *args, int from_tty,
- struct cmd_list_element *c)
+get_set_value (const char *args, int from_tty, struct cmd_list_element *c)
{
PyObject *obj = (PyObject *) c->context ();
gdb::unique_xmalloc_ptr<char> set_doc_string;
@@ -545,7 +532,7 @@ get_set_value (const char *args, int from_tty,
if (PyObject_HasAttr (obj, set_doc_func.get ()))
{
set_doc_string = call_doc_function (obj, set_doc_func.get (), NULL);
- if (! set_doc_string)
+ if (!set_doc_string)
gdbpy_handle_exception ();
}
@@ -561,8 +548,7 @@ get_set_value (const char *args, int from_tty,
neither exist, insert a string indicating the Parameter is not
documented. */
static void
-get_show_value (struct ui_file *file, int from_tty,
- struct cmd_list_element *c,
+get_show_value (struct ui_file *file, int from_tty, struct cmd_list_element *c,
const char *value)
{
PyObject *obj = (PyObject *) c->context ();
@@ -587,9 +573,9 @@ get_show_value (struct ui_file *file, int from_tty,
return;
}
- show_doc_string = call_doc_function (obj, show_doc_func.get (),
- val_obj.get ());
- if (! show_doc_string)
+ show_doc_string
+ = call_doc_function (obj, show_doc_func.get (), val_obj.get ());
+ if (!show_doc_string)
{
gdbpy_print_stack ();
return;
@@ -606,11 +592,10 @@ get_show_value (struct ui_file *file, int from_tty,
show_doc adjustment is not i18n friendly, so, instead, we just
print this generic string. */
std::string cmd_path = full_cmd_name_without_first_prefix (c);
- gdb_printf (file, _("The current value of '%s' is \"%s\".\n"),
+ gdb_printf (file, _ ("The current value of '%s' is \"%s\".\n"),
cmd_path.c_str (), value);
}
}
-
/* A helper function that dispatches to the appropriate add_setshow
function. */
@@ -618,9 +603,8 @@ static void
add_setshow_generic (enum var_types type, const literal_def *extra_literals,
enum command_class cmdclass,
gdb::unique_xmalloc_ptr<char> cmd_name,
- parmpy_object *self,
- const char *set_doc, const char *show_doc,
- const char *help_doc,
+ parmpy_object *self, const char *set_doc,
+ const char *show_doc, const char *help_doc,
struct cmd_list_element **set_list,
struct cmd_list_element **show_list)
{
@@ -637,35 +621,35 @@ add_setshow_generic (enum var_types type, const literal_def *extra_literals,
break;
case var_auto_boolean:
- commands = add_setshow_auto_boolean_cmd (cmd_name.get (), cmdclass,
- &self->value.autoboolval,
- set_doc, show_doc, help_doc,
- get_set_value, get_show_value,
- set_list, show_list);
+ commands
+ = add_setshow_auto_boolean_cmd (cmd_name.get (), cmdclass,
+ &self->value.autoboolval, set_doc,
+ show_doc, help_doc, get_set_value,
+ get_show_value, set_list, show_list);
break;
case var_uinteger:
- commands = add_setshow_uinteger_cmd (cmd_name.get (), cmdclass,
- &self->value.uintval,
- extra_literals, set_doc,
- show_doc, help_doc, get_set_value,
- get_show_value, set_list, show_list);
+ commands
+ = add_setshow_uinteger_cmd (cmd_name.get (), cmdclass,
+ &self->value.uintval, extra_literals,
+ set_doc, show_doc, help_doc, get_set_value,
+ get_show_value, set_list, show_list);
break;
case var_integer:
- commands = add_setshow_integer_cmd (cmd_name.get (), cmdclass,
- &self->value.intval,
- extra_literals, set_doc,
- show_doc, help_doc, get_set_value,
- get_show_value, set_list, show_list);
+ commands
+ = add_setshow_integer_cmd (cmd_name.get (), cmdclass,
+ &self->value.intval, extra_literals,
+ set_doc, show_doc, help_doc, get_set_value,
+ get_show_value, set_list, show_list);
break;
case var_pinteger:
- commands = add_setshow_pinteger_cmd (cmd_name.get (), cmdclass,
- &self->value.intval,
- extra_literals, set_doc,
- show_doc, help_doc, get_set_value,
- get_show_value, set_list, show_list);
+ commands
+ = add_setshow_pinteger_cmd (cmd_name.get (), cmdclass,
+ &self->value.intval, extra_literals,
+ set_doc, show_doc, help_doc, get_set_value,
+ get_show_value, set_list, show_list);
break;
case var_string:
@@ -676,37 +660,33 @@ add_setshow_generic (enum var_types type, const literal_def *extra_literals,
break;
case var_string_noescape:
- commands = add_setshow_string_noescape_cmd (cmd_name.get (), cmdclass,
- self->value.stringval,
- set_doc, show_doc, help_doc,
- get_set_value, get_show_value,
- set_list, show_list);
+ commands = add_setshow_string_noescape_cmd (
+ cmd_name.get (), cmdclass, self->value.stringval, set_doc, show_doc,
+ help_doc, get_set_value, get_show_value, set_list, show_list);
break;
case var_optional_filename:
- commands = add_setshow_optional_filename_cmd (cmd_name.get (), cmdclass,
- self->value.stringval,
- set_doc, show_doc, help_doc,
- get_set_value,
- get_show_value, set_list,
- show_list);
+ commands = add_setshow_optional_filename_cmd (
+ cmd_name.get (), cmdclass, self->value.stringval, set_doc, show_doc,
+ help_doc, get_set_value, get_show_value, set_list, show_list);
break;
case var_filename:
- commands = add_setshow_filename_cmd (cmd_name.get (), cmdclass,
- self->value.stringval, set_doc,
- show_doc, help_doc, get_set_value,
- get_show_value, set_list, show_list);
+ commands
+ = add_setshow_filename_cmd (cmd_name.get (), cmdclass,
+ self->value.stringval, set_doc, show_doc,
+ help_doc, get_set_value, get_show_value,
+ set_list, show_list);
break;
case var_enum:
/* Initialize the value, just in case. */
self->value.cstringval = self->enumeration[0];
- commands = add_setshow_enum_cmd (cmd_name.get (), cmdclass,
- self->enumeration,
- &self->value.cstringval, set_doc,
- show_doc, help_doc, get_set_value,
- get_show_value, set_list, show_list);
+ commands
+ = add_setshow_enum_cmd (cmd_name.get (), cmdclass, self->enumeration,
+ &self->value.cstringval, set_doc, show_doc,
+ help_doc, get_set_value, get_show_value,
+ set_list, show_list);
break;
default:
@@ -728,17 +708,17 @@ compute_enum_values (parmpy_object *self, PyObject *enum_values)
{
Py_ssize_t size, i;
- if (! enum_values)
+ if (!enum_values)
{
PyErr_SetString (PyExc_RuntimeError,
- _("An enumeration is required for PARAM_ENUM."));
+ _ ("An enumeration is required for PARAM_ENUM."));
return 0;
}
- if (! PySequence_Check (enum_values))
+ if (!PySequence_Check (enum_values))
{
PyErr_SetString (PyExc_RuntimeError,
- _("The enumeration is not a sequence."));
+ _ ("The enumeration is not a sequence."));
return 0;
}
@@ -747,8 +727,7 @@ compute_enum_values (parmpy_object *self, PyObject *enum_values)
return 0;
if (size == 0)
{
- PyErr_SetString (PyExc_RuntimeError,
- _("The enumeration is empty."));
+ PyErr_SetString (PyExc_RuntimeError, _ ("The enumeration is empty."));
return 0;
}
@@ -761,10 +740,10 @@ compute_enum_values (parmpy_object *self, PyObject *enum_values)
if (item == NULL)
return 0;
- if (! gdbpy_is_string (item.get ()))
+ if (!gdbpy_is_string (item.get ()))
{
PyErr_SetString (PyExc_RuntimeError,
- _("The enumeration item not a string."));
+ _ ("The enumeration item not a string."));
return 0;
}
enumeration[i] = python_string_to_host_string (item.get ()).release ();
@@ -772,7 +751,7 @@ compute_enum_values (parmpy_object *self, PyObject *enum_values)
return 0;
}
- self->enumeration = const_cast<const char**> (holder.release ());
+ self->enumeration = const_cast<const char **> (holder.release ());
return 1;
}
@@ -811,43 +790,42 @@ parmpy_init (PyObject *self, PyObject *args, PyObject *kwds)
const literal_def *extra_literals;
enum var_types type;
- if (! PyArg_ParseTuple (args, "sii|O", &name, &cmdtype, &parmclass,
- &enum_values))
+ if (!PyArg_ParseTuple (args, "sii|O", &name, &cmdtype, &parmclass,
+ &enum_values))
return -1;
- if (cmdtype != no_class && cmdtype != class_run
- && cmdtype != class_vars && cmdtype != class_stack
- && cmdtype != class_files && cmdtype != class_support
- && cmdtype != class_info && cmdtype != class_breakpoint
- && cmdtype != class_trace && cmdtype != class_obscure
- && cmdtype != class_maintenance)
+ if (cmdtype != no_class && cmdtype != class_run && cmdtype != class_vars
+ && cmdtype != class_stack && cmdtype != class_files
+ && cmdtype != class_support && cmdtype != class_info
+ && cmdtype != class_breakpoint && cmdtype != class_trace
+ && cmdtype != class_obscure && cmdtype != class_maintenance)
{
- PyErr_Format (PyExc_RuntimeError, _("Invalid command class argument."));
+ PyErr_Format (PyExc_RuntimeError, _ ("Invalid command class argument."));
return -1;
}
if (parmclass != param_boolean /* ARI: param_boolean */
- && parmclass != param_auto_boolean
- && parmclass != param_uinteger && parmclass != param_integer
- && parmclass != param_string && parmclass != param_string_noescape
+ && parmclass != param_auto_boolean && parmclass != param_uinteger
+ && parmclass != param_integer && parmclass != param_string
+ && parmclass != param_string_noescape
&& parmclass != param_optional_filename && parmclass != param_filename
&& parmclass != param_zinteger && parmclass != param_zuinteger
&& parmclass != param_zuinteger_unlimited && parmclass != param_enum)
{
PyErr_SetString (PyExc_RuntimeError,
- _("Invalid parameter class argument."));
+ _ ("Invalid parameter class argument."));
return -1;
}
if (enum_values && parmclass != param_enum)
{
PyErr_SetString (PyExc_RuntimeError,
- _("Only PARAM_ENUM accepts a fourth argument."));
+ _ ("Only PARAM_ENUM accepts a fourth argument."));
return -1;
}
if (parmclass == param_enum)
{
- if (! compute_enum_values (obj, enum_values))
+ if (!compute_enum_values (obj, enum_values))
return -1;
}
else
@@ -878,11 +856,9 @@ parmpy_init (PyObject *self, PyObject *args, PyObject *kwds)
try
{
- add_setshow_generic (type, extra_literals,
- (enum command_class) cmdtype,
- std::move (cmd_name), obj,
- set_doc.get (), show_doc.get (),
- doc.get (), set_list, show_list);
+ add_setshow_generic (type, extra_literals, (enum command_class) cmdtype,
+ std::move (cmd_name), obj, set_doc.get (),
+ show_doc.get (), doc.get (), set_list, show_list);
}
catch (const gdb_exception &except)
{
@@ -916,17 +892,17 @@ gdbpy_initialize_parameters (void)
return -1;
set_doc_cst = PyUnicode_FromString ("set_doc");
- if (! set_doc_cst)
+ if (!set_doc_cst)
return -1;
show_doc_cst = PyUnicode_FromString ("show_doc");
- if (! show_doc_cst)
+ if (!show_doc_cst)
return -1;
for (i = 0; parm_constants[i].name; ++i)
{
- if (PyModule_AddIntConstant (gdb_module,
- parm_constants[i].name,
- parm_constants[i].value) < 0)
+ if (PyModule_AddIntConstant (gdb_module, parm_constants[i].name,
+ parm_constants[i].value)
+ < 0)
return -1;
}
@@ -934,45 +910,41 @@ gdbpy_initialize_parameters (void)
(PyObject *) &parmpy_object_type);
}
-
-
-PyTypeObject parmpy_object_type =
-{
- PyVarObject_HEAD_INIT (NULL, 0)
- "gdb.Parameter", /*tp_name*/
- sizeof (parmpy_object), /*tp_basicsize*/
- 0, /*tp_itemsize*/
- parmpy_dealloc, /*tp_dealloc*/
- 0, /*tp_print*/
- 0, /*tp_getattr*/
- 0, /*tp_setattr*/
- 0, /*tp_compare*/
- 0, /*tp_repr*/
- 0, /*tp_as_number*/
- 0, /*tp_as_sequence*/
- 0, /*tp_as_mapping*/
- 0, /*tp_hash */
- 0, /*tp_call*/
- 0, /*tp_str*/
- get_attr, /*tp_getattro*/
- set_attr, /*tp_setattro*/
- 0, /*tp_as_buffer*/
- Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /*tp_flags*/
- "GDB parameter object", /* tp_doc */
- 0, /* tp_traverse */
- 0, /* tp_clear */
- 0, /* tp_richcompare */
- 0, /* tp_weaklistoffset */
- 0, /* tp_iter */
- 0, /* tp_iternext */
- 0, /* tp_methods */
- 0, /* tp_members */
- 0, /* tp_getset */
- 0, /* tp_base */
- 0, /* tp_dict */
- 0, /* tp_descr_get */
- 0, /* tp_descr_set */
- 0, /* tp_dictoffset */
- parmpy_init, /* tp_init */
- 0, /* tp_alloc */
+PyTypeObject parmpy_object_type = {
+ PyVarObject_HEAD_INIT (NULL, 0) "gdb.Parameter", /*tp_name*/
+ sizeof (parmpy_object), /*tp_basicsize*/
+ 0, /*tp_itemsize*/
+ parmpy_dealloc, /*tp_dealloc*/
+ 0, /*tp_print*/
+ 0, /*tp_getattr*/
+ 0, /*tp_setattr*/
+ 0, /*tp_compare*/
+ 0, /*tp_repr*/
+ 0, /*tp_as_number*/
+ 0, /*tp_as_sequence*/
+ 0, /*tp_as_mapping*/
+ 0, /*tp_hash */
+ 0, /*tp_call*/
+ 0, /*tp_str*/
+ get_attr, /*tp_getattro*/
+ set_attr, /*tp_setattro*/
+ 0, /*tp_as_buffer*/
+ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /*tp_flags*/
+ "GDB parameter object", /* tp_doc */
+ 0, /* tp_traverse */
+ 0, /* tp_clear */
+ 0, /* tp_richcompare */
+ 0, /* tp_weaklistoffset */
+ 0, /* tp_iter */
+ 0, /* tp_iternext */
+ 0, /* tp_methods */
+ 0, /* tp_members */
+ 0, /* tp_getset */
+ 0, /* tp_base */
+ 0, /* tp_dict */
+ 0, /* tp_descr_get */
+ 0, /* tp_descr_set */
+ 0, /* tp_dictoffset */
+ parmpy_init, /* tp_init */
+ 0, /* tp_alloc */
};
diff --git a/gdb/python/py-prettyprint.c b/gdb/python/py-prettyprint.c
index 1a5ce08c477..c369b97b989 100644
--- a/gdb/python/py-prettyprint.c
+++ b/gdb/python/py-prettyprint.c
@@ -30,14 +30,14 @@
/* Return type of print_string_repr. */
enum gdbpy_string_repr_result
- {
- /* The string method returned None. */
- string_repr_none,
- /* The string method had an error. */
- string_repr_error,
- /* Everything ok. */
- string_repr_ok
- };
+{
+ /* The string method returned None. */
+ string_repr_none,
+ /* The string method had an error. */
+ string_repr_error,
+ /* Everything ok. */
+ string_repr_ok
+};
/* If non-null, points to options that are in effect while
printing. */
@@ -58,7 +58,7 @@ search_pp_list (PyObject *list, PyObject *value)
for (list_index = 0; list_index < pp_list_size; list_index++)
{
PyObject *function = PyList_GetItem (list, list_index);
- if (! function)
+ if (!function)
return NULL;
/* Skip if disabled. */
@@ -149,11 +149,11 @@ find_pretty_printer_from_gdb (PyObject *value)
{
/* Fetch the global pretty printer list. */
if (gdb_python_module == NULL
- || ! PyObject_HasAttrString (gdb_python_module, "pretty_printers"))
+ || !PyObject_HasAttrString (gdb_python_module, "pretty_printers"))
return gdbpy_ref<>::new_reference (Py_None);
gdbpy_ref<> pp_list (PyObject_GetAttrString (gdb_python_module,
"pretty_printers"));
- if (pp_list == NULL || ! PyList_Check (pp_list.get ()))
+ if (pp_list == NULL || !PyList_Check (pp_list.get ()))
return gdbpy_ref<>::new_reference (Py_None);
return search_pp_list (pp_list.get (), value);
@@ -201,12 +201,13 @@ pretty_print_one_value (PyObject *printer, struct value **out_value)
result = gdbpy_ref<>::new_reference (Py_None);
else
{
- result.reset (PyObject_CallMethodObjArgs (printer, gdbpy_to_string_cst,
+ result.reset (PyObject_CallMethodObjArgs (printer,
+ gdbpy_to_string_cst,
NULL));
if (result != NULL)
{
- if (! gdbpy_is_string (result.get ())
- && ! gdbpy_is_lazy_string (result.get ())
+ if (!gdbpy_is_string (result.get ())
+ && !gdbpy_is_lazy_string (result.get ())
&& result != Py_None)
{
*out_value = convert_value_from_python (result.get ());
@@ -233,11 +234,11 @@ gdbpy_get_display_hint (PyObject *printer)
{
gdb::unique_xmalloc_ptr<char> result;
- if (! PyObject_HasAttr (printer, gdbpy_display_hint_cst))
+ if (!PyObject_HasAttr (printer, gdbpy_display_hint_cst))
return NULL;
- gdbpy_ref<> hint (PyObject_CallMethodObjArgs (printer, gdbpy_display_hint_cst,
- NULL));
+ gdbpy_ref<> hint (PyObject_CallMethodObjArgs (printer,
+ gdbpy_display_hint_cst, NULL));
if (hint != NULL)
{
if (gdbpy_is_string (hint.get ()))
@@ -265,10 +266,10 @@ print_stack_unless_memory_error (struct ui_file *stream)
if (msg == NULL || *msg == '\0')
fprintf_styled (stream, metadata_style.style (),
- _("<error reading variable>"));
+ _ ("<error reading variable>"));
else
fprintf_styled (stream, metadata_style.style (),
- _("<error reading variable: %s>"), msg.get ());
+ _ ("<error reading variable: %s>"), msg.get ());
}
else
gdbpy_print_stack ();
@@ -278,9 +279,8 @@ print_stack_unless_memory_error (struct ui_file *stream)
formats the result. */
static enum gdbpy_string_repr_result
-print_string_repr (PyObject *printer, const char *hint,
- struct ui_file *stream, int recurse,
- const struct value_print_options *options,
+print_string_repr (PyObject *printer, const char *hint, struct ui_file *stream,
+ int recurse, const struct value_print_options *options,
const struct language_defn *language,
struct gdbarch *gdbarch)
{
@@ -300,12 +300,12 @@ print_string_repr (PyObject *printer, const char *hint,
gdb::unique_xmalloc_ptr<char> encoding;
struct value_print_options local_opts = *options;
- gdbpy_extract_lazy_string (py_str.get (), &addr, &type,
- &length, &encoding);
+ gdbpy_extract_lazy_string (py_str.get (), &addr, &type, &length,
+ &encoding);
local_opts.addressprint = false;
- val_print_string (type, encoding.get (), addr, (int) length,
- stream, &local_opts);
+ val_print_string (type, encoding.get (), addr, (int) length, stream,
+ &local_opts);
}
else
{
@@ -322,8 +322,8 @@ print_string_repr (PyObject *printer, const char *hint,
type = builtin_type (gdbarch)->builtin_char;
if (hint && !strcmp (hint, "string"))
- language->printstr (stream, type, (gdb_byte *) output,
- length, NULL, 0, options);
+ language->printstr (stream, type, (gdb_byte *) output, length,
+ NULL, 0, options);
else
gdb_puts (output, stream);
}
@@ -354,25 +354,23 @@ print_string_repr (PyObject *printer, const char *hint,
printer, if any exist. If is_py_none is true, then nothing has
been printed by to_string, and format output accordingly. */
static void
-print_children (PyObject *printer, const char *hint,
- struct ui_file *stream, int recurse,
- const struct value_print_options *options,
- const struct language_defn *language,
- int is_py_none)
+print_children (PyObject *printer, const char *hint, struct ui_file *stream,
+ int recurse, const struct value_print_options *options,
+ const struct language_defn *language, int is_py_none)
{
int is_map, is_array, done_flag, pretty;
unsigned int i;
- if (! PyObject_HasAttr (printer, gdbpy_children_cst))
+ if (!PyObject_HasAttr (printer, gdbpy_children_cst))
return;
/* If we are printing a map or an array, we want some special
formatting. */
- is_map = hint && ! strcmp (hint, "map");
- is_array = hint && ! strcmp (hint, "array");
+ is_map = hint && !strcmp (hint, "map");
+ is_array = hint && !strcmp (hint, "array");
- gdbpy_ref<> children (PyObject_CallMethodObjArgs (printer, gdbpy_children_cst,
- NULL));
+ gdbpy_ref<> children (PyObject_CallMethodObjArgs (printer,
+ gdbpy_children_cst, NULL));
if (children == NULL)
{
print_stack_unless_memory_error (stream);
@@ -411,26 +409,26 @@ print_children (PyObject *printer, const char *hint,
print_stack_unless_memory_error (stream);
/* Set a flag so we can know whether we printed all the
available elements. */
- else
+ else
done_flag = 1;
break;
}
- if (! PyTuple_Check (item.get ()) || PyTuple_Size (item.get ()) != 2)
+ if (!PyTuple_Check (item.get ()) || PyTuple_Size (item.get ()) != 2)
{
PyErr_SetString (PyExc_TypeError,
- _("Result of children iterator not a tuple"
- " of two elements."));
+ _ ("Result of children iterator not a tuple"
+ " of two elements."));
gdbpy_print_stack ();
continue;
}
- if (! PyArg_ParseTuple (item.get (), "sO", &name, &py_v))
+ if (!PyArg_ParseTuple (item.get (), "sO", &name, &py_v))
{
/* The user won't necessarily get a stack trace here, so provide
more context. */
if (gdbpy_print_python_errors_p ())
gdb_printf (gdb_stderr,
- _("Bad result from children iterator.\n"));
+ _ ("Bad result from children iterator.\n"));
gdbpy_print_stack ();
continue;
}
@@ -445,7 +443,7 @@ print_children (PyObject *printer, const char *hint,
if (!is_py_none)
gdb_puts (" = ", stream);
}
- else if (! is_map || i % 2 == 0)
+ else if (!is_map || i % 2 == 0)
gdb_puts (pretty ? "," : ", ", stream);
/* Skip printing children if max_depth has been reached. This check
@@ -470,7 +468,7 @@ print_children (PyObject *printer, const char *hint,
break;
}
- if (! is_map || i % 2 == 0)
+ if (!is_map || i % 2 == 0)
{
if (pretty)
{
@@ -478,7 +476,7 @@ print_children (PyObject *printer, const char *hint,
print_spaces (2 + 2 * recurse, stream);
}
else
- stream->wrap_here (2 + 2 *recurse);
+ stream->wrap_here (2 + 2 * recurse);
}
if (is_map && i % 2 == 0)
@@ -490,7 +488,7 @@ print_children (PyObject *printer, const char *hint,
if (options->print_array_indexes)
gdb_printf (stream, "[%d] = ", i);
}
- else if (! is_map)
+ else if (!is_map)
{
gdb_puts (name, stream);
gdb_puts (" = ", stream);
@@ -527,7 +525,7 @@ print_children (PyObject *printer, const char *hint,
if (value == NULL)
{
gdbpy_print_stack ();
- error (_("Error while executing Python code."));
+ error (_ ("Error while executing Python code."));
}
else
{
@@ -535,8 +533,7 @@ print_children (PyObject *printer, const char *hint,
level of depth. This means the key will print before the
value does. */
struct value_print_options opt = *options;
- if (is_map && i % 2 == 0
- && opt.max_depth != -1
+ if (is_map && i % 2 == 0 && opt.max_depth != -1
&& opt.max_depth < INT_MAX)
++opt.max_depth;
common_val_print (value, stream, recurse + 1, &opt, language);
@@ -569,8 +566,8 @@ print_children (PyObject *printer, const char *hint,
enum ext_lang_rc
gdbpy_apply_val_pretty_printer (const struct extension_language_defn *extlang,
- struct value *value,
- struct ui_file *stream, int recurse,
+ struct value *value, struct ui_file *stream,
+ int recurse,
const struct value_print_options *options,
const struct language_defn *language)
{
@@ -608,8 +605,8 @@ gdbpy_apply_val_pretty_printer (const struct extension_language_defn *extlang,
if (printer == Py_None)
return EXT_LANG_RC_NOP;
- scoped_restore set_options = make_scoped_restore (&gdbpy_current_print_options,
- options);
+ scoped_restore set_options
+ = make_scoped_restore (&gdbpy_current_print_options, options);
/* If we are printing a map, we want some special formatting. */
gdb::unique_xmalloc_ptr<char> hint (gdbpy_get_display_hint (printer.get ()));
@@ -626,7 +623,6 @@ gdbpy_apply_val_pretty_printer (const struct extension_language_defn *extlang,
return EXT_LANG_RC_OK;
}
-
/* Apply a pretty-printer for the varobj code. PRINTER_OBJ is the
print object. It must have a 'to_string' method (but this is
checked by varobj, not here) which takes no arguments and
@@ -637,13 +633,12 @@ gdbpy_apply_val_pretty_printer (const struct extension_language_defn *extlang,
error, *REPLACEMENT is set to NULL and this function also returns
NULL. */
gdbpy_ref<>
-apply_varobj_pretty_printer (PyObject *printer_obj,
- struct value **replacement,
+apply_varobj_pretty_printer (PyObject *printer_obj, struct value **replacement,
struct ui_file *stream,
const value_print_options *opts)
{
- scoped_restore set_options = make_scoped_restore (&gdbpy_current_print_options,
- opts);
+ scoped_restore set_options
+ = make_scoped_restore (&gdbpy_current_print_options, opts);
*replacement = NULL;
gdbpy_ref<> py_str = pretty_print_one_value (printer_obj, replacement);
@@ -687,13 +682,12 @@ gdbpy_default_visualizer (PyObject *self, PyObject *args)
PyObject *val_obj;
struct value *value;
- if (! PyArg_ParseTuple (args, "O", &val_obj))
+ if (!PyArg_ParseTuple (args, "O", &val_obj))
return NULL;
value = value_object_to_value (val_obj);
- if (! value)
+ if (!value)
{
- PyErr_SetString (PyExc_TypeError,
- _("Argument must be a gdb.Value."));
+ PyErr_SetString (PyExc_TypeError, _ ("Argument must be a gdb.Value."));
return NULL;
}
@@ -731,38 +725,29 @@ gdbpy_print_options (PyObject *unused1, PyObject *unused2)
value_print_options opts;
gdbpy_get_print_options (&opts);
- if (set_boolean (result.get (), "raw",
- opts.raw) < 0
- || set_boolean (result.get (), "pretty_arrays",
- opts.prettyformat_arrays) < 0
+ if (set_boolean (result.get (), "raw", opts.raw) < 0
+ || set_boolean (result.get (), "pretty_arrays", opts.prettyformat_arrays)
+ < 0
|| set_boolean (result.get (), "pretty_structs",
- opts.prettyformat_structs) < 0
- || set_boolean (result.get (), "array_indexes",
- opts.print_array_indexes) < 0
- || set_boolean (result.get (), "symbols",
- opts.symbol_print) < 0
- || set_boolean (result.get (), "unions",
- opts.unionprint) < 0
- || set_boolean (result.get (), "address",
- opts.addressprint) < 0
- || set_boolean (result.get (), "deref_refs",
- opts.deref_ref) < 0
- || set_boolean (result.get (), "actual_objects",
- opts.objectprint) < 0
- || set_boolean (result.get (), "static_members",
- opts.static_field_print) < 0
- || set_boolean (result.get (), "deref_refs",
- opts.deref_ref) < 0
- || set_boolean (result.get (), "nibbles",
- opts.nibblesprint) < 0
- || set_boolean (result.get (), "summary",
- opts.summary) < 0
- || set_unsigned (result.get (), "max_elements",
- opts.print_max) < 0
- || set_unsigned (result.get (), "max_depth",
- opts.max_depth) < 0
+ opts.prettyformat_structs)
+ < 0
+ || set_boolean (result.get (), "array_indexes", opts.print_array_indexes)
+ < 0
+ || set_boolean (result.get (), "symbols", opts.symbol_print) < 0
+ || set_boolean (result.get (), "unions", opts.unionprint) < 0
+ || set_boolean (result.get (), "address", opts.addressprint) < 0
+ || set_boolean (result.get (), "deref_refs", opts.deref_ref) < 0
+ || set_boolean (result.get (), "actual_objects", opts.objectprint) < 0
+ || set_boolean (result.get (), "static_members", opts.static_field_print)
+ < 0
+ || set_boolean (result.get (), "deref_refs", opts.deref_ref) < 0
+ || set_boolean (result.get (), "nibbles", opts.nibblesprint) < 0
+ || set_boolean (result.get (), "summary", opts.summary) < 0
+ || set_unsigned (result.get (), "max_elements", opts.print_max) < 0
+ || set_unsigned (result.get (), "max_depth", opts.max_depth) < 0
|| set_unsigned (result.get (), "repeat_threshold",
- opts.repeat_count_threshold) < 0)
+ opts.repeat_count_threshold)
+ < 0)
return nullptr;
if (opts.format != 0)
diff --git a/gdb/python/py-progspace.c b/gdb/python/py-progspace.c
index 571a104641a..4fa6ea333c4 100644
--- a/gdb/python/py-progspace.c
+++ b/gdb/python/py-progspace.c
@@ -31,8 +31,8 @@ struct pspace_object
{
PyObject_HEAD
- /* The corresponding pspace. */
- struct program_space *pspace;
+ /* The corresponding pspace. */
+ struct program_space *pspace;
/* Dictionary holding user-added attributes.
This is the __dict__ attribute of the object. */
@@ -54,8 +54,8 @@ struct pspace_object
PyObject *xmethods;
};
-extern PyTypeObject pspace_object_type
- CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF ("pspace_object");
+extern PyTypeObject
+ pspace_object_type CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF ("pspace_object");
/* Clear the PSPACE pointer in a Pspace object and remove the reference. */
struct pspace_deleter
@@ -80,18 +80,20 @@ struct pspace_deleter
};
static const registry<program_space>::key<pspace_object, pspace_deleter>
- pspy_pspace_data_key;
+ pspy_pspace_data_key;
/* Require that PSPACE_OBJ be a valid program space ID. */
-#define PSPY_REQUIRE_VALID(pspace_obj) \
- do { \
- if (pspace_obj->pspace == nullptr) \
- { \
- PyErr_SetString (PyExc_RuntimeError, \
- _("Program space no longer exists.")); \
- return NULL; \
- } \
- } while (0)
+#define PSPY_REQUIRE_VALID(pspace_obj) \
+ do \
+ { \
+ if (pspace_obj->pspace == nullptr) \
+ { \
+ PyErr_SetString (PyExc_RuntimeError, \
+ _ ("Program space no longer exists.")); \
+ return NULL; \
+ } \
+ } \
+ while (0)
/* An Objfile method which returns the objfile's file name, or None. */
@@ -105,8 +107,8 @@ pspy_get_filename (PyObject *self, void *closure)
struct objfile *objfile = obj->pspace->symfile_object_file;
if (objfile)
- return (host_string_to_python_string (objfile_name (objfile))
- .release ());
+ return (
+ host_string_to_python_string (objfile_name (objfile)).release ());
}
Py_RETURN_NONE;
}
@@ -188,14 +190,14 @@ pspy_set_printers (PyObject *o, PyObject *value, void *ignore)
{
pspace_object *self = (pspace_object *) o;
- if (! value)
+ if (!value)
{
PyErr_SetString (PyExc_TypeError,
"cannot delete the pretty_printers attribute");
return -1;
}
- if (! PyList_Check (value))
+ if (!PyList_Check (value))
{
PyErr_SetString (PyExc_TypeError,
"the pretty_printers attribute must be a list");
@@ -227,14 +229,14 @@ pspy_set_frame_filters (PyObject *o, PyObject *frame, void *ignore)
{
pspace_object *self = (pspace_object *) o;
- if (! frame)
+ if (!frame)
{
PyErr_SetString (PyExc_TypeError,
"cannot delete the frame filter attribute");
return -1;
}
- if (! PyDict_Check (frame))
+ if (!PyDict_Check (frame))
{
PyErr_SetString (PyExc_TypeError,
"the frame filter attribute must be a dictionary");
@@ -318,14 +320,14 @@ pspy_set_type_printers (PyObject *o, PyObject *value, void *ignore)
{
pspace_object *self = (pspace_object *) o;
- if (! value)
+ if (!value)
{
PyErr_SetString (PyExc_TypeError,
"cannot delete the type_printers attribute");
return -1;
}
- if (! PyList_Check (value))
+ if (!PyList_Check (value))
{
PyErr_SetString (PyExc_TypeError,
"the type_printers attribute must be a list");
@@ -484,8 +486,6 @@ pspy_is_valid (PyObject *o, PyObject *args)
Py_RETURN_TRUE;
}
-
-
/* Return a new reference to the Python object of type Pspace
representing PSPACE. If the object has already been created,
return it. Otherwise, create it. Return NULL and set the Python
@@ -497,8 +497,8 @@ pspace_to_pspace_object (struct program_space *pspace)
PyObject *result = (PyObject *) pspy_pspace_data_key.get (pspace);
if (result == NULL)
{
- gdbpy_ref<pspace_object> object
- ((pspace_object *) PyObject_New (pspace_object, &pspace_object_type));
+ gdbpy_ref<pspace_object> object (
+ (pspace_object *) PyObject_New (pspace_object, &pspace_object_type));
if (object == NULL)
return NULL;
if (!pspy_initialize (object.get ()))
@@ -539,83 +539,73 @@ gdbpy_initialize_pspace (void)
(PyObject *) &pspace_object_type);
}
-
-
-static gdb_PyGetSetDef pspace_getset[] =
-{
- { "__dict__", gdb_py_generic_dict, NULL,
- "The __dict__ for this progspace.", &pspace_object_type },
- { "filename", pspy_get_filename, NULL,
- "The progspace's main filename, or None.", NULL },
- { "pretty_printers", pspy_get_printers, pspy_set_printers,
- "Pretty printers.", NULL },
- { "frame_filters", pspy_get_frame_filters, pspy_set_frame_filters,
- "Frame filters.", NULL },
- { "frame_unwinders", pspy_get_frame_unwinders, pspy_set_frame_unwinders,
- "Frame unwinders.", NULL },
- { "type_printers", pspy_get_type_printers, pspy_set_type_printers,
- "Type printers.", NULL },
- { "xmethods", pspy_get_xmethods, NULL,
- "Debug methods.", NULL },
- { NULL }
-};
-
-static PyMethodDef progspace_object_methods[] =
-{
- { "objfiles", pspy_get_objfiles, METH_NOARGS,
- "Return a sequence of objfiles associated to this program space." },
- { "solib_name", pspy_solib_name, METH_VARARGS,
- "solib_name (Long) -> String.\n\
+static gdb_PyGetSetDef pspace_getset[]
+ = { { "__dict__", gdb_py_generic_dict, NULL,
+ "The __dict__ for this progspace.", &pspace_object_type },
+ { "filename", pspy_get_filename, NULL,
+ "The progspace's main filename, or None.", NULL },
+ { "pretty_printers", pspy_get_printers, pspy_set_printers,
+ "Pretty printers.", NULL },
+ { "frame_filters", pspy_get_frame_filters, pspy_set_frame_filters,
+ "Frame filters.", NULL },
+ { "frame_unwinders", pspy_get_frame_unwinders, pspy_set_frame_unwinders,
+ "Frame unwinders.", NULL },
+ { "type_printers", pspy_get_type_printers, pspy_set_type_printers,
+ "Type printers.", NULL },
+ { "xmethods", pspy_get_xmethods, NULL, "Debug methods.", NULL },
+ { NULL } };
+
+static PyMethodDef progspace_object_methods[]
+ = { { "objfiles", pspy_get_objfiles, METH_NOARGS,
+ "Return a sequence of objfiles associated to this program space." },
+ { "solib_name", pspy_solib_name, METH_VARARGS,
+ "solib_name (Long) -> String.\n\
Return the name of the shared library holding a given address, or None." },
- { "block_for_pc", pspy_block_for_pc, METH_VARARGS,
- "Return the block containing the given pc value, or None." },
- { "find_pc_line", pspy_find_pc_line, METH_VARARGS,
- "find_pc_line (pc) -> Symtab_and_line.\n\
+ { "block_for_pc", pspy_block_for_pc, METH_VARARGS,
+ "Return the block containing the given pc value, or None." },
+ { "find_pc_line", pspy_find_pc_line, METH_VARARGS,
+ "find_pc_line (pc) -> Symtab_and_line.\n\
Return the gdb.Symtab_and_line object corresponding to the pc value." },
- { "is_valid", pspy_is_valid, METH_NOARGS,
- "is_valid () -> Boolean.\n\
+ { "is_valid", pspy_is_valid, METH_NOARGS, "is_valid () -> Boolean.\n\
Return true if this program space is valid, false if not." },
- { NULL }
-};
-
-PyTypeObject pspace_object_type =
-{
- PyVarObject_HEAD_INIT (NULL, 0)
- "gdb.Progspace", /*tp_name*/
- sizeof (pspace_object), /*tp_basicsize*/
- 0, /*tp_itemsize*/
- pspy_dealloc, /*tp_dealloc*/
- 0, /*tp_print*/
- 0, /*tp_getattr*/
- 0, /*tp_setattr*/
- 0, /*tp_compare*/
- 0, /*tp_repr*/
- 0, /*tp_as_number*/
- 0, /*tp_as_sequence*/
- 0, /*tp_as_mapping*/
- 0, /*tp_hash */
- 0, /*tp_call*/
- 0, /*tp_str*/
- 0, /*tp_getattro*/
- 0, /*tp_setattro*/
- 0, /*tp_as_buffer*/
- Py_TPFLAGS_DEFAULT, /*tp_flags*/
- "GDB progspace object", /* tp_doc */
- 0, /* tp_traverse */
- 0, /* tp_clear */
- 0, /* tp_richcompare */
- 0, /* tp_weaklistoffset */
- 0, /* tp_iter */
- 0, /* tp_iternext */
- progspace_object_methods, /* tp_methods */
- 0, /* tp_members */
- pspace_getset, /* tp_getset */
- 0, /* tp_base */
- 0, /* tp_dict */
- 0, /* tp_descr_get */
- 0, /* tp_descr_set */
- offsetof (pspace_object, dict), /* tp_dictoffset */
- 0, /* tp_init */
- 0, /* tp_alloc */
- pspy_new, /* tp_new */
+ { NULL } };
+
+PyTypeObject pspace_object_type = {
+ PyVarObject_HEAD_INIT (NULL, 0) "gdb.Progspace", /*tp_name*/
+ sizeof (pspace_object), /*tp_basicsize*/
+ 0, /*tp_itemsize*/
+ pspy_dealloc, /*tp_dealloc*/
+ 0, /*tp_print*/
+ 0, /*tp_getattr*/
+ 0, /*tp_setattr*/
+ 0, /*tp_compare*/
+ 0, /*tp_repr*/
+ 0, /*tp_as_number*/
+ 0, /*tp_as_sequence*/
+ 0, /*tp_as_mapping*/
+ 0, /*tp_hash */
+ 0, /*tp_call*/
+ 0, /*tp_str*/
+ 0, /*tp_getattro*/
+ 0, /*tp_setattro*/
+ 0, /*tp_as_buffer*/
+ Py_TPFLAGS_DEFAULT, /*tp_flags*/
+ "GDB progspace object", /* tp_doc */
+ 0, /* tp_traverse */
+ 0, /* tp_clear */
+ 0, /* tp_richcompare */
+ 0, /* tp_weaklistoffset */
+ 0, /* tp_iter */
+ 0, /* tp_iternext */
+ progspace_object_methods, /* tp_methods */
+ 0, /* tp_members */
+ pspace_getset, /* tp_getset */
+ 0, /* tp_base */
+ 0, /* tp_dict */
+ 0, /* tp_descr_get */
+ 0, /* tp_descr_set */
+ offsetof (pspace_object, dict), /* tp_dictoffset */
+ 0, /* tp_init */
+ 0, /* tp_alloc */
+ pspy_new, /* tp_new */
};
diff --git a/gdb/python/py-record-btrace.c b/gdb/python/py-record-btrace.c
index 4af86672d26..37106cf94f5 100644
--- a/gdb/python/py-record-btrace.c
+++ b/gdb/python/py-record-btrace.c
@@ -30,11 +30,12 @@
/* Python object for btrace record lists. */
-struct btpy_list_object {
+struct btpy_list_object
+{
PyObject_HEAD
- /* The thread this list belongs to. */
- thread_info *thread;
+ /* The thread this list belongs to. */
+ thread_info *thread;
/* The first index being part of this list. */
Py_ssize_t first;
@@ -46,20 +47,18 @@ struct btpy_list_object {
Py_ssize_t step;
/* Either &BTPY_CALL_TYPE or &RECPY_INSN_TYPE. */
- PyTypeObject* element_type;
+ PyTypeObject *element_type;
};
/* Python type for btrace lists. */
-static PyTypeObject btpy_list_type = {
- PyVarObject_HEAD_INIT (NULL, 0)
-};
+static PyTypeObject btpy_list_type = { PyVarObject_HEAD_INIT (NULL, 0) };
/* Returns either a btrace_insn for the given Python gdb.RecordInstruction
object or sets an appropriate Python exception and returns NULL. */
static const btrace_insn *
-btrace_insn_from_recpy_insn (const PyObject * const pyobject)
+btrace_insn_from_recpy_insn (const PyObject *const pyobject)
{
const btrace_insn *insn;
const recpy_element_object *obj;
@@ -68,7 +67,7 @@ btrace_insn_from_recpy_insn (const PyObject * const pyobject)
if (Py_TYPE (pyobject) != &recpy_insn_type)
{
- PyErr_Format (gdbpy_gdb_error, _("Must be gdb.RecordInstruction"));
+ PyErr_Format (gdbpy_gdb_error, _ ("Must be gdb.RecordInstruction"));
return NULL;
}
@@ -77,20 +76,20 @@ btrace_insn_from_recpy_insn (const PyObject * const pyobject)
if (tinfo == NULL || btrace_is_empty (tinfo))
{
- PyErr_Format (gdbpy_gdb_error, _("No such instruction."));
+ PyErr_Format (gdbpy_gdb_error, _ ("No such instruction."));
return NULL;
}
if (btrace_find_insn_by_number (&iter, &tinfo->btrace, obj->number) == 0)
{
- PyErr_Format (gdbpy_gdb_error, _("No such instruction."));
+ PyErr_Format (gdbpy_gdb_error, _ ("No such instruction."));
return NULL;
}
insn = btrace_insn_get (&iter);
if (insn == NULL)
{
- PyErr_Format (gdbpy_gdb_error, _("Not a valid instruction."));
+ PyErr_Format (gdbpy_gdb_error, _ ("Not a valid instruction."));
return NULL;
}
@@ -102,7 +101,7 @@ btrace_insn_from_recpy_insn (const PyObject * const pyobject)
returns NULL. */
static const btrace_function *
-btrace_func_from_recpy_func (const PyObject * const pyobject)
+btrace_func_from_recpy_func (const PyObject *const pyobject)
{
const btrace_function *func;
const recpy_element_object *obj;
@@ -111,7 +110,7 @@ btrace_func_from_recpy_func (const PyObject * const pyobject)
if (Py_TYPE (pyobject) != &recpy_func_type)
{
- PyErr_Format (gdbpy_gdb_error, _("Must be gdb.RecordFunctionSegment"));
+ PyErr_Format (gdbpy_gdb_error, _ ("Must be gdb.RecordFunctionSegment"));
return NULL;
}
@@ -120,20 +119,20 @@ btrace_func_from_recpy_func (const PyObject * const pyobject)
if (tinfo == NULL || btrace_is_empty (tinfo))
{
- PyErr_Format (gdbpy_gdb_error, _("No such function segment."));
+ PyErr_Format (gdbpy_gdb_error, _ ("No such function segment."));
return NULL;
}
if (btrace_find_call_by_number (&iter, &tinfo->btrace, obj->number) == 0)
{
- PyErr_Format (gdbpy_gdb_error, _("No such function segment."));
+ PyErr_Format (gdbpy_gdb_error, _ ("No such function segment."));
return NULL;
}
func = btrace_call_get (&iter);
if (func == NULL)
{
- PyErr_Format (gdbpy_gdb_error, _("Not a valid function segment."));
+ PyErr_Format (gdbpy_gdb_error, _ ("Not a valid function segment."));
return NULL;
}
@@ -169,11 +168,11 @@ btpy_insn_or_gap_new (thread_info *tinfo, Py_ssize_t number)
/* Create a new gdb.BtraceList object. */
static PyObject *
-btpy_list_new (thread_info *thread, Py_ssize_t first, Py_ssize_t last, Py_ssize_t step,
- PyTypeObject *element_type)
+btpy_list_new (thread_info *thread, Py_ssize_t first, Py_ssize_t last,
+ Py_ssize_t step, PyTypeObject *element_type)
{
- btpy_list_object * const obj = PyObject_New (btpy_list_object,
- &btpy_list_type);
+ btpy_list_object *const obj
+ = PyObject_New (btpy_list_object, &btpy_list_type);
if (obj == NULL)
return NULL;
@@ -193,7 +192,7 @@ btpy_list_new (thread_info *thread, Py_ssize_t first, Py_ssize_t last, Py_ssize_
PyObject *
recpy_bt_insn_sal (PyObject *self, void *closure)
{
- const btrace_insn * const insn = btrace_insn_from_recpy_insn (self);
+ const btrace_insn *const insn = btrace_insn_from_recpy_insn (self);
PyObject *result = NULL;
if (insn == NULL)
@@ -217,7 +216,7 @@ recpy_bt_insn_sal (PyObject *self, void *closure)
PyObject *
recpy_bt_insn_pc (PyObject *self, void *closure)
{
- const btrace_insn * const insn = btrace_insn_from_recpy_insn (self);
+ const btrace_insn *const insn = btrace_insn_from_recpy_insn (self);
if (insn == NULL)
return NULL;
@@ -231,7 +230,7 @@ recpy_bt_insn_pc (PyObject *self, void *closure)
PyObject *
recpy_bt_insn_size (PyObject *self, void *closure)
{
- const btrace_insn * const insn = btrace_insn_from_recpy_insn (self);
+ const btrace_insn *const insn = btrace_insn_from_recpy_insn (self);
if (insn == NULL)
return NULL;
@@ -245,7 +244,7 @@ recpy_bt_insn_size (PyObject *self, void *closure)
PyObject *
recpy_bt_insn_is_speculative (PyObject *self, void *closure)
{
- const btrace_insn * const insn = btrace_insn_from_recpy_insn (self);
+ const btrace_insn *const insn = btrace_insn_from_recpy_insn (self);
if (insn == NULL)
return NULL;
@@ -262,7 +261,7 @@ recpy_bt_insn_is_speculative (PyObject *self, void *closure)
PyObject *
recpy_bt_insn_data (PyObject *self, void *closure)
{
- const btrace_insn * const insn = btrace_insn_from_recpy_insn (self);
+ const btrace_insn *const insn = btrace_insn_from_recpy_insn (self);
gdb::byte_vector buffer;
PyObject *object;
@@ -279,8 +278,8 @@ recpy_bt_insn_data (PyObject *self, void *closure)
GDB_PY_HANDLE_EXCEPTION (except);
}
- object = PyBytes_FromStringAndSize ((const char *) buffer.data (),
- insn->size);
+ object
+ = PyBytes_FromStringAndSize ((const char *) buffer.data (), insn->size);
if (object == NULL)
return NULL;
@@ -294,7 +293,7 @@ recpy_bt_insn_data (PyObject *self, void *closure)
PyObject *
recpy_bt_insn_decoded (PyObject *self, void *closure)
{
- const btrace_insn * const insn = btrace_insn_from_recpy_insn (self);
+ const btrace_insn *const insn = btrace_insn_from_recpy_insn (self);
string_file strfile;
if (insn == NULL)
@@ -310,7 +309,6 @@ recpy_bt_insn_decoded (PyObject *self, void *closure)
return NULL;
}
-
return PyBytes_FromString (strfile.string ().c_str ());
}
@@ -320,15 +318,15 @@ recpy_bt_insn_decoded (PyObject *self, void *closure)
PyObject *
recpy_bt_func_level (PyObject *self, void *closure)
{
- const btrace_function * const func = btrace_func_from_recpy_func (self);
+ const btrace_function *const func = btrace_func_from_recpy_func (self);
thread_info *tinfo;
if (func == NULL)
return NULL;
tinfo = ((recpy_element_object *) self)->thread;
- return gdb_py_object_from_longest (tinfo->btrace.level
- + func->level).release ();
+ return gdb_py_object_from_longest (tinfo->btrace.level + func->level)
+ .release ();
}
/* Implementation of RecordFunctionSegment.symbol [gdb.Symbol] for btrace.
@@ -337,7 +335,7 @@ recpy_bt_func_level (PyObject *self, void *closure)
PyObject *
recpy_bt_func_symbol (PyObject *self, void *closure)
{
- const btrace_function * const func = btrace_func_from_recpy_func (self);
+ const btrace_function *const func = btrace_func_from_recpy_func (self);
if (func == NULL)
return NULL;
@@ -354,7 +352,7 @@ recpy_bt_func_symbol (PyObject *self, void *closure)
PyObject *
recpy_bt_func_instructions (PyObject *self, void *closure)
{
- const btrace_function * const func = btrace_func_from_recpy_func (self);
+ const btrace_function *const func = btrace_func_from_recpy_func (self);
unsigned int len;
if (func == NULL)
@@ -377,7 +375,7 @@ recpy_bt_func_instructions (PyObject *self, void *closure)
PyObject *
recpy_bt_func_up (PyObject *self, void *closure)
{
- const btrace_function * const func = btrace_func_from_recpy_func (self);
+ const btrace_function *const func = btrace_func_from_recpy_func (self);
if (func == NULL)
return NULL;
@@ -395,7 +393,7 @@ recpy_bt_func_up (PyObject *self, void *closure)
PyObject *
recpy_bt_func_prev (PyObject *self, void *closure)
{
- const btrace_function * const func = btrace_func_from_recpy_func (self);
+ const btrace_function *const func = btrace_func_from_recpy_func (self);
if (func == NULL)
return NULL;
@@ -413,7 +411,7 @@ recpy_bt_func_prev (PyObject *self, void *closure)
PyObject *
recpy_bt_func_next (PyObject *self, void *closure)
{
- const btrace_function * const func = btrace_func_from_recpy_func (self);
+ const btrace_function *const func = btrace_func_from_recpy_func (self);
if (func == NULL)
return NULL;
@@ -430,7 +428,7 @@ recpy_bt_func_next (PyObject *self, void *closure)
static Py_ssize_t
btpy_list_length (PyObject *self)
{
- const btpy_list_object * const obj = (btpy_list_object *) self;
+ const btpy_list_object *const obj = (btpy_list_object *) self;
const Py_ssize_t distance = obj->last - obj->first;
const Py_ssize_t result = distance / obj->step;
@@ -447,11 +445,11 @@ btpy_list_length (PyObject *self)
static PyObject *
btpy_list_item (PyObject *self, Py_ssize_t index)
{
- const btpy_list_object * const obj = (btpy_list_object *) self;
+ const btpy_list_object *const obj = (btpy_list_object *) self;
Py_ssize_t number;
if (index < 0 || index >= btpy_list_length (self))
- return PyErr_Format (PyExc_IndexError, _("Index out of range: %zd."),
+ return PyErr_Format (PyExc_IndexError, _ ("Index out of range: %zd."),
index);
number = obj->first + (obj->step * index);
@@ -467,7 +465,7 @@ btpy_list_item (PyObject *self, Py_ssize_t index)
static PyObject *
btpy_list_slice (PyObject *self, PyObject *value)
{
- const btpy_list_object * const obj = (btpy_list_object *) self;
+ const btpy_list_object *const obj = (btpy_list_object *) self;
const Py_ssize_t length = btpy_list_length (self);
Py_ssize_t start, stop, step, slicelength;
@@ -483,10 +481,11 @@ btpy_list_slice (PyObject *self, PyObject *value)
}
if (!PySlice_Check (value))
- return PyErr_Format (PyExc_TypeError, _("Index must be int or slice."));
+ return PyErr_Format (PyExc_TypeError, _ ("Index must be int or slice."));
- if (0 != PySlice_GetIndicesEx (value, length, &start, &stop,
- &step, &slicelength))
+ if (0
+ != PySlice_GetIndicesEx (value, length, &start, &stop, &step,
+ &slicelength))
return NULL;
return btpy_list_new (obj->thread, obj->first + obj->step * start,
@@ -500,8 +499,8 @@ btpy_list_slice (PyObject *self, PyObject *value)
static LONGEST
btpy_list_position (PyObject *self, PyObject *value)
{
- const btpy_list_object * const list_obj = (btpy_list_object *) self;
- const recpy_element_object * const obj = (const recpy_element_object *) value;
+ const btpy_list_object *const list_obj = (btpy_list_object *) self;
+ const recpy_element_object *const obj = (const recpy_element_object *) value;
Py_ssize_t index = obj->number;
if (list_obj->element_type != Py_TYPE (value))
@@ -540,7 +539,7 @@ btpy_list_index (PyObject *self, PyObject *value)
const LONGEST index = btpy_list_position (self, value);
if (index < 0)
- return PyErr_Format (PyExc_ValueError, _("Not in list."));
+ return PyErr_Format (PyExc_ValueError, _ ("Not in list."));
return gdb_py_object_from_longest (index).release ();
}
@@ -552,8 +551,8 @@ btpy_list_count (PyObject *self, PyObject *value)
{
/* We know that if an element is in the list, it is so exactly one time,
enabling us to reuse the "is element of" check. */
- return gdb_py_object_from_longest (btpy_list_contains (self,
- value)).release ();
+ return gdb_py_object_from_longest (btpy_list_contains (self, value))
+ .release ();
}
/* Python rich compare function to allow for equality and inequality checks
@@ -562,8 +561,8 @@ btpy_list_count (PyObject *self, PyObject *value)
static PyObject *
btpy_list_richcompare (PyObject *self, PyObject *other, int op)
{
- const btpy_list_object * const obj1 = (btpy_list_object *) self;
- const btpy_list_object * const obj2 = (btpy_list_object *) other;
+ const btpy_list_object *const obj1 = (btpy_list_object *) self;
+ const btpy_list_object *const obj2 = (btpy_list_object *) other;
if (Py_TYPE (self) != Py_TYPE (other))
{
@@ -572,12 +571,11 @@ btpy_list_richcompare (PyObject *self, PyObject *other, int op)
}
switch (op)
- {
+ {
case Py_EQ:
if (obj1->thread == obj2->thread
&& obj1->element_type == obj2->element_type
- && obj1->first == obj2->first
- && obj1->last == obj2->last
+ && obj1->first == obj2->first && obj1->last == obj2->last
&& obj1->step == obj2->step)
Py_RETURN_TRUE;
else
@@ -586,8 +584,7 @@ btpy_list_richcompare (PyObject *self, PyObject *other, int op)
case Py_NE:
if (obj1->thread != obj2->thread
|| obj1->element_type != obj2->element_type
- || obj1->first != obj2->first
- || obj1->last != obj2->last
+ || obj1->first != obj2->first || obj1->last != obj2->last
|| obj1->step != obj2->step)
Py_RETURN_TRUE;
else
@@ -595,7 +592,7 @@ btpy_list_richcompare (PyObject *self, PyObject *other, int op)
default:
break;
- }
+ }
Py_INCREF (Py_NotImplemented);
return Py_NotImplemented;
@@ -616,9 +613,9 @@ recpy_bt_method (PyObject *self, void *closure)
PyObject *
recpy_bt_format (PyObject *self, void *closure)
{
- const recpy_record_object * const record = (recpy_record_object *) self;
- const struct thread_info * const tinfo = record->thread;
- const struct btrace_config * config;
+ const recpy_record_object *const record = (recpy_record_object *) self;
+ const struct thread_info *const tinfo = record->thread;
+ const struct btrace_config *config;
if (tinfo == NULL)
Py_RETURN_NONE;
@@ -637,8 +634,8 @@ recpy_bt_format (PyObject *self, void *closure)
PyObject *
recpy_bt_replay_position (PyObject *self, void *closure)
{
- const recpy_record_object * const record = (recpy_record_object *) self;
- thread_info * tinfo = record->thread;
+ const recpy_record_object *const record = (recpy_record_object *) self;
+ thread_info *tinfo = record->thread;
if (tinfo == NULL)
Py_RETURN_NONE;
@@ -656,7 +653,7 @@ recpy_bt_replay_position (PyObject *self, void *closure)
PyObject *
recpy_bt_begin (PyObject *self, void *closure)
{
- const recpy_record_object * const record = (recpy_record_object *) self;
+ const recpy_record_object *const record = (recpy_record_object *) self;
thread_info *const tinfo = record->thread;
struct btrace_insn_iterator iterator;
@@ -678,7 +675,7 @@ recpy_bt_begin (PyObject *self, void *closure)
PyObject *
recpy_bt_end (PyObject *self, void *closure)
{
- const recpy_record_object * const record = (recpy_record_object *) self;
+ const recpy_record_object *const record = (recpy_record_object *) self;
thread_info *const tinfo = record->thread;
struct btrace_insn_iterator iterator;
@@ -700,27 +697,27 @@ recpy_bt_end (PyObject *self, void *closure)
PyObject *
recpy_bt_instruction_history (PyObject *self, void *closure)
{
- const recpy_record_object * const record = (recpy_record_object *) self;
+ const recpy_record_object *const record = (recpy_record_object *) self;
thread_info *const tinfo = record->thread;
struct btrace_insn_iterator iterator;
unsigned long first = 0;
unsigned long last = 0;
- if (tinfo == NULL)
- Py_RETURN_NONE;
+ if (tinfo == NULL)
+ Py_RETURN_NONE;
- btrace_fetch (tinfo, record_btrace_get_cpu ());
+ btrace_fetch (tinfo, record_btrace_get_cpu ());
- if (btrace_is_empty (tinfo))
- Py_RETURN_NONE;
+ if (btrace_is_empty (tinfo))
+ Py_RETURN_NONE;
- btrace_insn_begin (&iterator, &tinfo->btrace);
- first = btrace_insn_number (&iterator);
+ btrace_insn_begin (&iterator, &tinfo->btrace);
+ first = btrace_insn_number (&iterator);
- btrace_insn_end (&iterator, &tinfo->btrace);
- last = btrace_insn_number (&iterator);
+ btrace_insn_end (&iterator, &tinfo->btrace);
+ last = btrace_insn_number (&iterator);
- return btpy_list_new (tinfo, first, last, 1, &recpy_insn_type);
+ return btpy_list_new (tinfo, first, last, 1, &recpy_insn_type);
}
/* Implementation of
@@ -729,7 +726,7 @@ recpy_bt_instruction_history (PyObject *self, void *closure)
PyObject *
recpy_bt_function_call_history (PyObject *self, void *closure)
{
- const recpy_record_object * const record = (recpy_record_object *) self;
+ const recpy_record_object *const record = (recpy_record_object *) self;
thread_info *const tinfo = record->thread;
struct btrace_call_iterator iterator;
unsigned long first = 0;
@@ -757,19 +754,19 @@ recpy_bt_function_call_history (PyObject *self, void *closure)
PyObject *
recpy_bt_goto (PyObject *self, PyObject *args)
{
- const recpy_record_object * const record = (recpy_record_object *) self;
+ const recpy_record_object *const record = (recpy_record_object *) self;
thread_info *const tinfo = record->thread;
const recpy_element_object *obj;
PyObject *parse_obj;
if (tinfo == NULL || btrace_is_empty (tinfo))
- return PyErr_Format (gdbpy_gdb_error, _("Empty branch trace."));
+ return PyErr_Format (gdbpy_gdb_error, _ ("Empty branch trace."));
if (!PyArg_ParseTuple (args, "O", &parse_obj))
return NULL;
if (Py_TYPE (parse_obj) != &recpy_insn_type)
- return PyErr_Format (PyExc_TypeError, _("Argument must be instruction."));
+ return PyErr_Format (PyExc_TypeError, _ ("Argument must be instruction."));
obj = (const recpy_element_object *) parse_obj;
try
@@ -793,26 +790,18 @@ recpy_bt_goto (PyObject *self, PyObject *args)
/* BtraceList methods. */
-static PyMethodDef btpy_list_methods[] =
-{
- { "count", btpy_list_count, METH_O, "count number of occurrences"},
- { "index", btpy_list_index, METH_O, "index of entry"},
- {NULL}
-};
+static PyMethodDef btpy_list_methods[]
+ = { { "count", btpy_list_count, METH_O, "count number of occurrences" },
+ { "index", btpy_list_index, METH_O, "index of entry" },
+ { NULL } };
/* BtraceList sequence methods. */
-static PySequenceMethods btpy_list_sequence_methods =
-{
- NULL
-};
+static PySequenceMethods btpy_list_sequence_methods = { NULL };
/* BtraceList mapping methods. Necessary for slicing. */
-static PyMappingMethods btpy_list_mapping_methods =
-{
- NULL
-};
+static PyMappingMethods btpy_list_mapping_methods = { NULL };
/* Sets up the btrace record API. */
diff --git a/gdb/python/py-record-btrace.h b/gdb/python/py-record-btrace.h
index 0af8153b715..e8f47a12b3b 100644
--- a/gdb/python/py-record-btrace.h
+++ b/gdb/python/py-record-btrace.h
@@ -35,7 +35,8 @@ extern PyObject *recpy_bt_goto (PyObject *self, PyObject *value);
extern PyObject *recpy_bt_instruction_history (PyObject *self, void *closure);
/* Implementation of record.function_call_history [list]. */
-extern PyObject *recpy_bt_function_call_history (PyObject *self, void *closure);
+extern PyObject *recpy_bt_function_call_history (PyObject *self,
+ void *closure);
/* Implementation of record.replay_position [instruction]. */
extern PyObject *recpy_bt_replay_position (PyObject *self, void *closure);
diff --git a/gdb/python/py-record.c b/gdb/python/py-record.c
index 1e40f2cded0..0abade7bead 100644
--- a/gdb/python/py-record.c
+++ b/gdb/python/py-record.c
@@ -27,35 +27,27 @@
/* Python Record type. */
-static PyTypeObject recpy_record_type = {
- PyVarObject_HEAD_INIT (NULL, 0)
-};
+static PyTypeObject recpy_record_type = { PyVarObject_HEAD_INIT (NULL, 0) };
/* Python RecordInstruction type. */
-PyTypeObject recpy_insn_type = {
- PyVarObject_HEAD_INIT (NULL, 0)
-};
+PyTypeObject recpy_insn_type = { PyVarObject_HEAD_INIT (NULL, 0) };
/* Python RecordFunctionSegment type. */
-PyTypeObject recpy_func_type = {
- PyVarObject_HEAD_INIT (NULL, 0)
-};
+PyTypeObject recpy_func_type = { PyVarObject_HEAD_INIT (NULL, 0) };
/* Python RecordGap type. */
-static PyTypeObject recpy_gap_type = {
- PyVarObject_HEAD_INIT (NULL, 0)
-};
+static PyTypeObject recpy_gap_type = { PyVarObject_HEAD_INIT (NULL, 0) };
/* Python RecordGap object. */
struct recpy_gap_object
{
PyObject_HEAD
- /* Reason code. */
- int reason_code;
+ /* Reason code. */
+ int reason_code;
/* Reason message. */
const char *reason_string;
@@ -67,9 +59,9 @@ struct recpy_gap_object
/* Implementation of record.method. */
static PyObject *
-recpy_method (PyObject *self, void* closure)
+recpy_method (PyObject *self, void *closure)
{
- const recpy_record_object * const obj = (recpy_record_object *) self;
+ const recpy_record_object *const obj = (recpy_record_object *) self;
if (obj->method == RECORD_METHOD_FULL)
return recpy_full_method (self, closure);
@@ -77,15 +69,15 @@ recpy_method (PyObject *self, void* closure)
if (obj->method == RECORD_METHOD_BTRACE)
return recpy_bt_method (self, closure);
- return PyErr_Format (PyExc_NotImplementedError, _("Not implemented."));
+ return PyErr_Format (PyExc_NotImplementedError, _ ("Not implemented."));
}
/* Implementation of record.format. */
static PyObject *
-recpy_format (PyObject *self, void* closure)
+recpy_format (PyObject *self, void *closure)
{
- const recpy_record_object * const obj = (recpy_record_object *) self;
+ const recpy_record_object *const obj = (recpy_record_object *) self;
if (obj->method == RECORD_METHOD_FULL)
return recpy_full_format (self, closure);
@@ -93,7 +85,7 @@ recpy_format (PyObject *self, void* closure)
if (obj->method == RECORD_METHOD_BTRACE)
return recpy_bt_format (self, closure);
- return PyErr_Format (PyExc_NotImplementedError, _("Not implemented."));
+ return PyErr_Format (PyExc_NotImplementedError, _ ("Not implemented."));
}
/* Implementation of record.goto (instruction) -> None. */
@@ -101,12 +93,12 @@ recpy_format (PyObject *self, void* closure)
static PyObject *
recpy_goto (PyObject *self, PyObject *value)
{
- const recpy_record_object * const obj = (recpy_record_object *) self;
+ const recpy_record_object *const obj = (recpy_record_object *) self;
if (obj->method == RECORD_METHOD_BTRACE)
return recpy_bt_goto (self, value);
- return PyErr_Format (PyExc_NotImplementedError, _("Not implemented."));
+ return PyErr_Format (PyExc_NotImplementedError, _ ("Not implemented."));
}
/* Implementation of record.replay_position [instruction] */
@@ -114,76 +106,77 @@ recpy_goto (PyObject *self, PyObject *value)
static PyObject *
recpy_replay_position (PyObject *self, void *closure)
{
- const recpy_record_object * const obj = (recpy_record_object *) self;
+ const recpy_record_object *const obj = (recpy_record_object *) self;
if (obj->method == RECORD_METHOD_BTRACE)
return recpy_bt_replay_position (self, closure);
- return PyErr_Format (PyExc_NotImplementedError, _("Not implemented."));
+ return PyErr_Format (PyExc_NotImplementedError, _ ("Not implemented."));
}
/* Implementation of record.instruction_history [list]. */
static PyObject *
-recpy_instruction_history (PyObject *self, void* closure)
+recpy_instruction_history (PyObject *self, void *closure)
{
- const recpy_record_object * const obj = (recpy_record_object *) self;
+ const recpy_record_object *const obj = (recpy_record_object *) self;
if (obj->method == RECORD_METHOD_BTRACE)
return recpy_bt_instruction_history (self, closure);
- return PyErr_Format (PyExc_NotImplementedError, _("Not implemented."));
+ return PyErr_Format (PyExc_NotImplementedError, _ ("Not implemented."));
}
/* Implementation of record.function_call_history [list]. */
static PyObject *
-recpy_function_call_history (PyObject *self, void* closure)
+recpy_function_call_history (PyObject *self, void *closure)
{
- const recpy_record_object * const obj = (recpy_record_object *) self;
+ const recpy_record_object *const obj = (recpy_record_object *) self;
if (obj->method == RECORD_METHOD_BTRACE)
return recpy_bt_function_call_history (self, closure);
- return PyErr_Format (PyExc_NotImplementedError, _("Not implemented."));
+ return PyErr_Format (PyExc_NotImplementedError, _ ("Not implemented."));
}
/* Implementation of record.begin [instruction]. */
static PyObject *
-recpy_begin (PyObject *self, void* closure)
+recpy_begin (PyObject *self, void *closure)
{
- const recpy_record_object * const obj = (recpy_record_object *) self;
+ const recpy_record_object *const obj = (recpy_record_object *) self;
if (obj->method == RECORD_METHOD_BTRACE)
return recpy_bt_begin (self, closure);
- return PyErr_Format (PyExc_NotImplementedError, _("Not implemented."));
+ return PyErr_Format (PyExc_NotImplementedError, _ ("Not implemented."));
}
/* Implementation of record.end [instruction]. */
static PyObject *
-recpy_end (PyObject *self, void* closure)
+recpy_end (PyObject *self, void *closure)
{
- const recpy_record_object * const obj = (recpy_record_object *) self;
+ const recpy_record_object *const obj = (recpy_record_object *) self;
if (obj->method == RECORD_METHOD_BTRACE)
return recpy_bt_end (self, closure);
- return PyErr_Format (PyExc_NotImplementedError, _("Not implemented."));
+ return PyErr_Format (PyExc_NotImplementedError, _ ("Not implemented."));
}
/* Create a new gdb.RecordInstruction object. */
PyObject *
-recpy_insn_new (thread_info *thread, enum record_method method, Py_ssize_t number)
+recpy_insn_new (thread_info *thread, enum record_method method,
+ Py_ssize_t number)
{
- recpy_element_object * const obj = PyObject_New (recpy_element_object,
- &recpy_insn_type);
+ recpy_element_object *const obj
+ = PyObject_New (recpy_element_object, &recpy_insn_type);
if (obj == NULL)
- return NULL;
+ return NULL;
obj->thread = thread;
obj->method = method;
@@ -197,12 +190,12 @@ recpy_insn_new (thread_info *thread, enum record_method method, Py_ssize_t numbe
static PyObject *
recpy_insn_sal (PyObject *self, void *closure)
{
- const recpy_element_object * const obj = (recpy_element_object *) self;
+ const recpy_element_object *const obj = (recpy_element_object *) self;
if (obj->method == RECORD_METHOD_BTRACE)
return recpy_bt_insn_sal (self, closure);
- return PyErr_Format (PyExc_NotImplementedError, _("Not implemented."));
+ return PyErr_Format (PyExc_NotImplementedError, _ ("Not implemented."));
}
/* Implementation of RecordInstruction.pc [int]. */
@@ -210,12 +203,12 @@ recpy_insn_sal (PyObject *self, void *closure)
static PyObject *
recpy_insn_pc (PyObject *self, void *closure)
{
- const recpy_element_object * const obj = (recpy_element_object *) self;
+ const recpy_element_object *const obj = (recpy_element_object *) self;
if (obj->method == RECORD_METHOD_BTRACE)
return recpy_bt_insn_pc (self, closure);
- return PyErr_Format (PyExc_NotImplementedError, _("Not implemented."));
+ return PyErr_Format (PyExc_NotImplementedError, _ ("Not implemented."));
}
/* Implementation of RecordInstruction.data [buffer]. */
@@ -223,12 +216,12 @@ recpy_insn_pc (PyObject *self, void *closure)
static PyObject *
recpy_insn_data (PyObject *self, void *closure)
{
- const recpy_element_object * const obj = (recpy_element_object *) self;
+ const recpy_element_object *const obj = (recpy_element_object *) self;
if (obj->method == RECORD_METHOD_BTRACE)
return recpy_bt_insn_data (self, closure);
- return PyErr_Format (PyExc_NotImplementedError, _("Not implemented."));
+ return PyErr_Format (PyExc_NotImplementedError, _ ("Not implemented."));
}
/* Implementation of RecordInstruction.decoded [str]. */
@@ -236,12 +229,12 @@ recpy_insn_data (PyObject *self, void *closure)
static PyObject *
recpy_insn_decoded (PyObject *self, void *closure)
{
- const recpy_element_object * const obj = (recpy_element_object *) self;
+ const recpy_element_object *const obj = (recpy_element_object *) self;
if (obj->method == RECORD_METHOD_BTRACE)
return recpy_bt_insn_decoded (self, closure);
- return PyErr_Format (PyExc_NotImplementedError, _("Not implemented."));
+ return PyErr_Format (PyExc_NotImplementedError, _ ("Not implemented."));
}
/* Implementation of RecordInstruction.size [int]. */
@@ -249,12 +242,12 @@ recpy_insn_decoded (PyObject *self, void *closure)
static PyObject *
recpy_insn_size (PyObject *self, void *closure)
{
- const recpy_element_object * const obj = (recpy_element_object *) self;
+ const recpy_element_object *const obj = (recpy_element_object *) self;
if (obj->method == RECORD_METHOD_BTRACE)
return recpy_bt_insn_size (self, closure);
- return PyErr_Format (PyExc_NotImplementedError, _("Not implemented."));
+ return PyErr_Format (PyExc_NotImplementedError, _ ("Not implemented."));
}
/* Implementation of RecordInstruction.is_speculative [bool]. */
@@ -262,24 +255,25 @@ recpy_insn_size (PyObject *self, void *closure)
static PyObject *
recpy_insn_is_speculative (PyObject *self, void *closure)
{
- const recpy_element_object * const obj = (recpy_element_object *) self;
+ const recpy_element_object *const obj = (recpy_element_object *) self;
if (obj->method == RECORD_METHOD_BTRACE)
return recpy_bt_insn_is_speculative (self, closure);
- return PyErr_Format (PyExc_NotImplementedError, _("Not implemented."));
+ return PyErr_Format (PyExc_NotImplementedError, _ ("Not implemented."));
}
/* Create a new gdb.RecordFunctionSegment object. */
PyObject *
-recpy_func_new (thread_info *thread, enum record_method method, Py_ssize_t number)
+recpy_func_new (thread_info *thread, enum record_method method,
+ Py_ssize_t number)
{
- recpy_element_object * const obj = PyObject_New (recpy_element_object,
- &recpy_func_type);
+ recpy_element_object *const obj
+ = PyObject_New (recpy_element_object, &recpy_func_type);
if (obj == NULL)
- return NULL;
+ return NULL;
obj->thread = thread;
obj->method = method;
@@ -293,12 +287,12 @@ recpy_func_new (thread_info *thread, enum record_method method, Py_ssize_t numbe
static PyObject *
recpy_func_level (PyObject *self, void *closure)
{
- const recpy_element_object * const obj = (recpy_element_object *) self;
+ const recpy_element_object *const obj = (recpy_element_object *) self;
if (obj->method == RECORD_METHOD_BTRACE)
return recpy_bt_func_level (self, closure);
- return PyErr_Format (PyExc_NotImplementedError, _("Not implemented."));
+ return PyErr_Format (PyExc_NotImplementedError, _ ("Not implemented."));
}
/* Implementation of RecordFunctionSegment.symbol [gdb.Symbol]. */
@@ -306,12 +300,12 @@ recpy_func_level (PyObject *self, void *closure)
static PyObject *
recpy_func_symbol (PyObject *self, void *closure)
{
- const recpy_element_object * const obj = (recpy_element_object *) self;
+ const recpy_element_object *const obj = (recpy_element_object *) self;
if (obj->method == RECORD_METHOD_BTRACE)
return recpy_bt_func_symbol (self, closure);
- return PyErr_Format (PyExc_NotImplementedError, _("Not implemented."));
+ return PyErr_Format (PyExc_NotImplementedError, _ ("Not implemented."));
}
/* Implementation of RecordFunctionSegment.instructions [list]. */
@@ -319,12 +313,12 @@ recpy_func_symbol (PyObject *self, void *closure)
static PyObject *
recpy_func_instructions (PyObject *self, void *closure)
{
- const recpy_element_object * const obj = (recpy_element_object *) self;
+ const recpy_element_object *const obj = (recpy_element_object *) self;
if (obj->method == RECORD_METHOD_BTRACE)
return recpy_bt_func_instructions (self, closure);
- return PyErr_Format (PyExc_NotImplementedError, _("Not implemented."));
+ return PyErr_Format (PyExc_NotImplementedError, _ ("Not implemented."));
}
/* Implementation of RecordFunctionSegment.up [RecordFunctionSegment]. */
@@ -332,12 +326,12 @@ recpy_func_instructions (PyObject *self, void *closure)
static PyObject *
recpy_func_up (PyObject *self, void *closure)
{
- const recpy_element_object * const obj = (recpy_element_object *) self;
+ const recpy_element_object *const obj = (recpy_element_object *) self;
if (obj->method == RECORD_METHOD_BTRACE)
return recpy_bt_func_up (self, closure);
- return PyErr_Format (PyExc_NotImplementedError, _("Not implemented."));
+ return PyErr_Format (PyExc_NotImplementedError, _ ("Not implemented."));
}
/* Implementation of RecordFunctionSegment.prev [RecordFunctionSegment]. */
@@ -345,12 +339,12 @@ recpy_func_up (PyObject *self, void *closure)
static PyObject *
recpy_func_prev (PyObject *self, void *closure)
{
- const recpy_element_object * const obj = (recpy_element_object *) self;
+ const recpy_element_object *const obj = (recpy_element_object *) self;
if (obj->method == RECORD_METHOD_BTRACE)
return recpy_bt_func_prev (self, closure);
- return PyErr_Format (PyExc_NotImplementedError, _("Not implemented."));
+ return PyErr_Format (PyExc_NotImplementedError, _ ("Not implemented."));
}
/* Implementation of RecordFunctionSegment.next [RecordFunctionSegment]. */
@@ -358,21 +352,21 @@ recpy_func_prev (PyObject *self, void *closure)
static PyObject *
recpy_func_next (PyObject *self, void *closure)
{
- const recpy_element_object * const obj = (recpy_element_object *) self;
+ const recpy_element_object *const obj = (recpy_element_object *) self;
if (obj->method == RECORD_METHOD_BTRACE)
return recpy_bt_func_next (self, closure);
- return PyErr_Format (PyExc_NotImplementedError, _("Not implemented."));
+ return PyErr_Format (PyExc_NotImplementedError, _ ("Not implemented."));
}
/* Implementation of RecordInstruction.number [int] and
RecordFunctionSegment.number [int]. */
static PyObject *
-recpy_element_number (PyObject *self, void* closure)
+recpy_element_number (PyObject *self, void *closure)
{
- const recpy_element_object * const obj = (recpy_element_object *) self;
+ const recpy_element_object *const obj = (recpy_element_object *) self;
return gdb_py_object_from_longest (obj->number).release ();
}
@@ -383,7 +377,7 @@ recpy_element_number (PyObject *self, void* closure)
static Py_hash_t
recpy_element_hash (PyObject *self)
{
- const recpy_element_object * const obj = (recpy_element_object *) self;
+ const recpy_element_object *const obj = (recpy_element_object *) self;
return obj->number;
}
@@ -394,8 +388,8 @@ recpy_element_hash (PyObject *self)
static PyObject *
recpy_element_richcompare (PyObject *self, PyObject *other, int op)
{
- const recpy_element_object * const obj1 = (recpy_element_object *) self;
- const recpy_element_object * const obj2 = (recpy_element_object *) other;
+ const recpy_element_object *const obj1 = (recpy_element_object *) self;
+ const recpy_element_object *const obj2 = (recpy_element_object *) other;
if (Py_TYPE (self) != Py_TYPE (other))
{
@@ -404,18 +398,16 @@ recpy_element_richcompare (PyObject *self, PyObject *other, int op)
}
switch (op)
- {
+ {
case Py_EQ:
- if (obj1->thread == obj2->thread
- && obj1->method == obj2->method
+ if (obj1->thread == obj2->thread && obj1->method == obj2->method
&& obj1->number == obj2->number)
Py_RETURN_TRUE;
else
Py_RETURN_FALSE;
case Py_NE:
- if (obj1->thread != obj2->thread
- || obj1->method != obj2->method
+ if (obj1->thread != obj2->thread || obj1->method != obj2->method
|| obj1->number != obj2->number)
Py_RETURN_TRUE;
else
@@ -423,7 +415,7 @@ recpy_element_richcompare (PyObject *self, PyObject *other, int op)
default:
break;
- }
+ }
Py_INCREF (Py_NotImplemented);
return Py_NotImplemented;
@@ -434,11 +426,11 @@ recpy_element_richcompare (PyObject *self, PyObject *other, int op)
PyObject *
recpy_gap_new (int reason_code, const char *reason_string, Py_ssize_t number)
{
- recpy_gap_object * const obj = PyObject_New (recpy_gap_object,
- &recpy_gap_type);
+ recpy_gap_object *const obj
+ = PyObject_New (recpy_gap_object, &recpy_gap_type);
if (obj == NULL)
- return NULL;
+ return NULL;
obj->reason_code = reason_code;
obj->reason_string = reason_string;
@@ -452,7 +444,7 @@ recpy_gap_new (int reason_code, const char *reason_string, Py_ssize_t number)
static PyObject *
recpy_gap_number (PyObject *self, void *closure)
{
- const recpy_gap_object * const obj = (const recpy_gap_object *) self;
+ const recpy_gap_object *const obj = (const recpy_gap_object *) self;
return gdb_py_object_from_longest (obj->number).release ();
}
@@ -462,7 +454,7 @@ recpy_gap_number (PyObject *self, void *closure)
static PyObject *
recpy_gap_reason_code (PyObject *self, void *closure)
{
- const recpy_gap_object * const obj = (const recpy_gap_object *) self;
+ const recpy_gap_object *const obj = (const recpy_gap_object *) self;
return gdb_py_object_from_longest (obj->reason_code).release ();
}
@@ -472,19 +464,18 @@ recpy_gap_reason_code (PyObject *self, void *closure)
static PyObject *
recpy_gap_reason_string (PyObject *self, void *closure)
{
- const recpy_gap_object * const obj = (const recpy_gap_object *) self;
+ const recpy_gap_object *const obj = (const recpy_gap_object *) self;
return PyUnicode_FromString (obj->reason_string);
}
/* Record method list. */
-static PyMethodDef recpy_record_methods[] = {
- { "goto", recpy_goto, METH_VARARGS,
- "goto (instruction|function_call) -> None.\n\
-Rewind to given location."},
- { NULL }
-};
+static PyMethodDef recpy_record_methods[]
+ = { { "goto", recpy_goto, METH_VARARGS,
+ "goto (instruction|function_call) -> None.\n\
+Rewind to given location." },
+ { NULL } };
/* Record member list. */
@@ -497,50 +488,54 @@ static gdb_PyGetSetDef recpy_record_getset[] = {
"List of instructions in current recording.", NULL },
{ "function_call_history", recpy_function_call_history, NULL,
"List of function calls in current recording.", NULL },
- { "begin", recpy_begin, NULL,
- "First instruction in current recording.", NULL },
+ { "begin", recpy_begin, NULL, "First instruction in current recording.",
+ NULL },
{ "end", recpy_end, NULL,
"One past the last instruction in current recording. This is typically \
-the current instruction and is used for e.g. record.goto (record.end).", NULL },
+the current instruction and is used for e.g. record.goto (record.end).",
+ NULL },
{ NULL }
};
/* RecordInstruction member list. */
-static gdb_PyGetSetDef recpy_insn_getset[] = {
- { "number", recpy_element_number, NULL, "instruction number", NULL},
- { "sal", recpy_insn_sal, NULL, "associated symbol and line", NULL},
- { "pc", recpy_insn_pc, NULL, "instruction address", NULL},
- { "data", recpy_insn_data, NULL, "raw instruction data", NULL},
- { "decoded", recpy_insn_decoded, NULL, "decoded instruction", NULL},
- { "size", recpy_insn_size, NULL, "instruction size in byte", NULL},
- { "is_speculative", recpy_insn_is_speculative, NULL, "if the instruction was \
- executed speculatively", NULL},
- { NULL }
-};
+static gdb_PyGetSetDef recpy_insn_getset[]
+ = { { "number", recpy_element_number, NULL, "instruction number", NULL },
+ { "sal", recpy_insn_sal, NULL, "associated symbol and line", NULL },
+ { "pc", recpy_insn_pc, NULL, "instruction address", NULL },
+ { "data", recpy_insn_data, NULL, "raw instruction data", NULL },
+ { "decoded", recpy_insn_decoded, NULL, "decoded instruction", NULL },
+ { "size", recpy_insn_size, NULL, "instruction size in byte", NULL },
+ { "is_speculative", recpy_insn_is_speculative, NULL,
+ "if the instruction was \
+ executed speculatively",
+ NULL },
+ { NULL } };
/* RecordFunctionSegment member list. */
static gdb_PyGetSetDef recpy_func_getset[] = {
- { "number", recpy_element_number, NULL, "function segment number", NULL},
- { "level", recpy_func_level, NULL, "call stack level", NULL},
- { "symbol", recpy_func_symbol, NULL, "associated line and symbol", NULL},
+ { "number", recpy_element_number, NULL, "function segment number", NULL },
+ { "level", recpy_func_level, NULL, "call stack level", NULL },
+ { "symbol", recpy_func_symbol, NULL, "associated line and symbol", NULL },
{ "instructions", recpy_func_instructions, NULL, "list of instructions in \
-this function segment", NULL},
- { "up", recpy_func_up, NULL, "caller or returned-to function segment", NULL},
- { "prev", recpy_func_prev, NULL, "previous segment of this function", NULL},
- { "next", recpy_func_next, NULL, "next segment of this function", NULL},
+this function segment",
+ NULL },
+ { "up", recpy_func_up, NULL, "caller or returned-to function segment",
+ NULL },
+ { "prev", recpy_func_prev, NULL, "previous segment of this function", NULL },
+ { "next", recpy_func_next, NULL, "next segment of this function", NULL },
{ NULL }
};
/* RecordGap member list. */
-static gdb_PyGetSetDef recpy_gap_getset[] = {
- { "number", recpy_gap_number, NULL, "element number", NULL},
- { "reason_code", recpy_gap_reason_code, NULL, "reason code", NULL},
- { "reason_string", recpy_gap_reason_string, NULL, "reason string", NULL},
- { NULL }
-};
+static gdb_PyGetSetDef recpy_gap_getset[]
+ = { { "number", recpy_gap_number, NULL, "element number", NULL },
+ { "reason_code", recpy_gap_reason_code, NULL, "reason code", NULL },
+ { "reason_string", recpy_gap_reason_string, NULL, "reason string",
+ NULL },
+ { NULL } };
/* Sets up the record API in the gdb module. */
diff --git a/gdb/python/py-record.h b/gdb/python/py-record.h
index 6eec71e06e7..21ebabbde4c 100644
--- a/gdb/python/py-record.h
+++ b/gdb/python/py-record.h
@@ -29,8 +29,8 @@ struct recpy_record_object
{
PyObject_HEAD
- /* The thread this object refers to. */
- thread_info *thread;
+ /* The thread this object refers to. */
+ thread_info *thread;
/* The current recording method. */
enum record_method method;
@@ -43,8 +43,8 @@ struct recpy_element_object
{
PyObject_HEAD
- /* The thread this object refers to. */
- thread_info *thread;
+ /* The thread this object refers to. */
+ thread_info *thread;
/* The current recording method. */
enum record_method method;
@@ -60,12 +60,12 @@ extern PyTypeObject recpy_insn_type;
extern PyTypeObject recpy_func_type;
/* Create a new gdb.RecordInstruction object. */
-extern PyObject *recpy_insn_new (thread_info *thread, enum record_method method,
- Py_ssize_t number);
+extern PyObject *recpy_insn_new (thread_info *thread,
+ enum record_method method, Py_ssize_t number);
/* Create a new gdb.RecordFunctionSegment object. */
-extern PyObject *recpy_func_new (thread_info *thread, enum record_method method,
- Py_ssize_t number);
+extern PyObject *recpy_func_new (thread_info *thread,
+ enum record_method method, Py_ssize_t number);
/* Create a new gdb.RecordGap object. */
extern PyObject *recpy_gap_new (int reason_code, const char *reason_string,
diff --git a/gdb/python/py-ref.h b/gdb/python/py-ref.h
index 6283af7b523..46e527c29b3 100644
--- a/gdb/python/py-ref.h
+++ b/gdb/python/py-ref.h
@@ -26,20 +26,14 @@
template<typename T>
struct gdbpy_ref_policy
{
- static void incref (T *ptr)
- {
- Py_INCREF (ptr);
- }
-
- static void decref (T *ptr)
- {
- Py_DECREF (ptr);
- }
+ static void incref (T *ptr) { Py_INCREF (ptr); }
+
+ static void decref (T *ptr) { Py_DECREF (ptr); }
};
/* A gdb::ref_ptr that has been specialized for Python objects or
their "subclasses". */
-template<typename T = PyObject> using gdbpy_ref
- = gdb::ref_ptr<T, gdbpy_ref_policy<T>>;
+template<typename T = PyObject>
+using gdbpy_ref = gdb::ref_ptr<T, gdbpy_ref_policy<T>>;
#endif /* PYTHON_PY_REF_H */
diff --git a/gdb/python/py-registers.c b/gdb/python/py-registers.c
index 9531cf7b502..9ac002ff2d6 100644
--- a/gdb/python/py-registers.c
+++ b/gdb/python/py-registers.c
@@ -30,15 +30,16 @@ typedef std::vector<gdbpy_ref<>> gdbpy_register_type;
/* Token to access per-gdbarch data related to register descriptors. */
static const registry<gdbarch>::key<gdbpy_register_type>
- gdbpy_register_object_data;
+ gdbpy_register_object_data;
/* Structure for iterator over register descriptors. */
-struct register_descriptor_iterator_object {
+struct register_descriptor_iterator_object
+{
PyObject_HEAD
- /* The register group that the user is iterating over. This will never
+ /* The register group that the user is iterating over. This will never
be NULL. */
- const struct reggroup *reggroup;
+ const struct reggroup *reggroup;
/* The next register number to lookup. Starts at 0 and counts up. */
int regnum;
@@ -48,46 +49,49 @@ struct register_descriptor_iterator_object {
};
extern PyTypeObject register_descriptor_iterator_object_type
- CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF ("register_descriptor_iterator_object");
+ CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF ("register_descriptor_iterator_object");
/* A register descriptor. */
-struct register_descriptor_object {
+struct register_descriptor_object
+{
PyObject_HEAD
- /* The register this is a descriptor for. */
- int regnum;
+ /* The register this is a descriptor for. */
+ int regnum;
/* The architecture this is a register for. */
struct gdbarch *gdbarch;
};
extern PyTypeObject register_descriptor_object_type
- CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF ("register_descriptor_object");
+ CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF ("register_descriptor_object");
/* Structure for iterator over register groups. */
-struct reggroup_iterator_object {
+struct reggroup_iterator_object
+{
PyObject_HEAD
- /* The index into GROUPS for the next group to return. */
- std::vector<const reggroup *>::size_type index;
+ /* The index into GROUPS for the next group to return. */
+ std::vector<const reggroup *>::size_type index;
/* Pointer back to the architecture we're finding registers for. */
struct gdbarch *gdbarch;
};
extern PyTypeObject reggroup_iterator_object_type
- CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF ("reggroup_iterator_object");
+ CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF ("reggroup_iterator_object");
/* A register group object. */
-struct reggroup_object {
+struct reggroup_object
+{
PyObject_HEAD
- /* The register group being described. */
- const struct reggroup *reggroup;
+ /* The register group being described. */
+ const struct reggroup *reggroup;
};
-extern PyTypeObject reggroup_object_type
- CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF ("reggroup_object");
+extern PyTypeObject
+ reggroup_object_type CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF ("reggroup_object");
/* Return a gdb.RegisterGroup object wrapping REGGROUP. The register
group objects are cached, and the same Python object will always be
@@ -99,7 +103,7 @@ gdbpy_get_reggroup (const reggroup *reggroup)
/* Map from GDB's internal reggroup objects to the Python representation.
GDB's reggroups are global, and are never deleted, so using a map like
this is safe. */
- static std::unordered_map<const struct reggroup *,gdbpy_ref<>>
+ static std::unordered_map<const struct reggroup *, gdbpy_ref<>>
gdbpy_reggroup_object_map;
/* If there is not already a suitable Python object in the map then
@@ -107,8 +111,8 @@ gdbpy_get_reggroup (const reggroup *reggroup)
if (gdbpy_reggroup_object_map[reggroup] == nullptr)
{
/* Create a new object and fill in its details. */
- gdbpy_ref<reggroup_object> group
- (PyObject_New (reggroup_object, &reggroup_object_type));
+ gdbpy_ref<reggroup_object> group (PyObject_New (reggroup_object,
+ &reggroup_object_type));
if (group == NULL)
return NULL;
group->reggroup = reggroup;
@@ -147,8 +151,7 @@ gdbpy_reggroup_name (PyObject *self, void *closure)
then cached on the GDBARCH. */
static gdbpy_ref<>
-gdbpy_get_register_descriptor (struct gdbarch *gdbarch,
- int regnum)
+gdbpy_get_register_descriptor (struct gdbarch *gdbarch, int regnum)
{
gdbpy_register_type *vecp = gdbpy_register_object_data.get (gdbarch);
if (vecp == nullptr)
@@ -163,9 +166,8 @@ gdbpy_get_register_descriptor (struct gdbarch *gdbarch,
create one now. */
if (vec[regnum] == nullptr)
{
- gdbpy_ref <register_descriptor_object> reg
- (PyObject_New (register_descriptor_object,
- &register_descriptor_object_type));
+ gdbpy_ref<register_descriptor_object> reg (PyObject_New (
+ register_descriptor_object, &register_descriptor_object_type));
if (reg == NULL)
return NULL;
reg->regnum = regnum;
@@ -183,8 +185,7 @@ gdbpy_get_register_descriptor (struct gdbarch *gdbarch,
static PyObject *
gdbpy_register_descriptor_to_string (PyObject *self)
{
- register_descriptor_object *reg
- = (register_descriptor_object *) self;
+ register_descriptor_object *reg = (register_descriptor_object *) self;
struct gdbarch *gdbarch = reg->gdbarch;
int regnum = reg->regnum;
@@ -216,14 +217,13 @@ gdbpy_reggroup_iter (PyObject *self)
static PyObject *
gdbpy_reggroup_iter_next (PyObject *self)
{
- reggroup_iterator_object *iter_obj
- = (reggroup_iterator_object *) self;
+ reggroup_iterator_object *iter_obj = (reggroup_iterator_object *) self;
const std::vector<const reggroup *> &groups
= gdbarch_reggroups (iter_obj->gdbarch);
if (iter_obj->index >= groups.size ())
{
- PyErr_SetString (PyExc_StopIteration, _("No more groups"));
+ PyErr_SetString (PyExc_StopIteration, _ ("No more groups"));
return NULL;
}
@@ -242,8 +242,7 @@ gdbpy_new_reggroup_iterator (struct gdbarch *gdbarch)
/* Create a new object and fill in its internal state. */
reggroup_iterator_object *iter
- = PyObject_New (reggroup_iterator_object,
- &reggroup_iterator_object_type);
+ = PyObject_New (reggroup_iterator_object, &reggroup_iterator_object_type);
if (iter == NULL)
return NULL;
iter->index = 0;
@@ -274,7 +273,7 @@ gdbpy_new_register_descriptor_iterator (struct gdbarch *gdbarch,
if (grp == NULL)
{
PyErr_SetString (PyExc_ValueError,
- _("Unknown register group name."));
+ _ ("Unknown register group name."));
return NULL;
}
}
@@ -315,14 +314,13 @@ gdbpy_register_descriptor_iter_next (PyObject *self)
{
if (iter_obj->regnum >= gdbarch_num_cooked_regs (gdbarch))
{
- PyErr_SetString (PyExc_StopIteration, _("No more registers"));
+ PyErr_SetString (PyExc_StopIteration, _ ("No more registers"));
return NULL;
}
const char *name = nullptr;
int regnum = iter_obj->regnum;
- if (gdbarch_register_reggroup_p (gdbarch, regnum,
- iter_obj->reggroup))
+ if (gdbarch_register_reggroup_p (gdbarch, regnum, iter_obj->reggroup))
name = gdbarch_register_name (gdbarch, regnum);
iter_obj->regnum++;
@@ -375,7 +373,8 @@ gdbpy_parse_register_id (struct gdbarch *gdbarch, PyObject *pyo_reg_id,
/* The register could be a string, its name. */
if (gdbpy_is_string (pyo_reg_id))
{
- gdb::unique_xmalloc_ptr<char> reg_name (gdbpy_obj_to_string (pyo_reg_id));
+ gdb::unique_xmalloc_ptr<char> reg_name (
+ gdbpy_obj_to_string (pyo_reg_id));
if (reg_name != NULL)
{
@@ -405,7 +404,7 @@ gdbpy_parse_register_id (struct gdbarch *gdbarch, PyObject *pyo_reg_id,
}
/* The register could be a gdb.RegisterDescriptor object. */
else if (PyObject_IsInstance (pyo_reg_id,
- (PyObject *) &register_descriptor_object_type))
+ (PyObject *) &register_descriptor_object_type))
{
register_descriptor_object *reg
= (register_descriptor_object *) pyo_reg_id;
@@ -416,10 +415,10 @@ gdbpy_parse_register_id (struct gdbarch *gdbarch, PyObject *pyo_reg_id,
}
else
PyErr_SetString (PyExc_ValueError,
- _("Invalid Architecture in RegisterDescriptor"));
+ _ ("Invalid Architecture in RegisterDescriptor"));
}
else
- PyErr_SetString (PyExc_TypeError, _("Invalid type for register"));
+ PyErr_SetString (PyExc_TypeError, _ ("Invalid type for register"));
gdb_assert (PyErr_Occurred ());
return false;
@@ -433,180 +432,176 @@ gdbpy_initialize_registers ()
register_descriptor_object_type.tp_new = PyType_GenericNew;
if (PyType_Ready (&register_descriptor_object_type) < 0)
return -1;
- if (gdb_pymodule_addobject
- (gdb_module, "RegisterDescriptor",
- (PyObject *) &register_descriptor_object_type) < 0)
+ if (gdb_pymodule_addobject (gdb_module, "RegisterDescriptor",
+ (PyObject *) &register_descriptor_object_type)
+ < 0)
return -1;
reggroup_iterator_object_type.tp_new = PyType_GenericNew;
if (PyType_Ready (&reggroup_iterator_object_type) < 0)
return -1;
- if (gdb_pymodule_addobject
- (gdb_module, "RegisterGroupsIterator",
- (PyObject *) &reggroup_iterator_object_type) < 0)
+ if (gdb_pymodule_addobject (gdb_module, "RegisterGroupsIterator",
+ (PyObject *) &reggroup_iterator_object_type)
+ < 0)
return -1;
reggroup_object_type.tp_new = PyType_GenericNew;
if (PyType_Ready (&reggroup_object_type) < 0)
return -1;
- if (gdb_pymodule_addobject
- (gdb_module, "RegisterGroup",
- (PyObject *) &reggroup_object_type) < 0)
+ if (gdb_pymodule_addobject (gdb_module, "RegisterGroup",
+ (PyObject *) &reggroup_object_type)
+ < 0)
return -1;
register_descriptor_iterator_object_type.tp_new = PyType_GenericNew;
if (PyType_Ready (&register_descriptor_iterator_object_type) < 0)
return -1;
- return (gdb_pymodule_addobject
- (gdb_module, "RegisterDescriptorIterator",
- (PyObject *) &register_descriptor_iterator_object_type));
+ return (gdb_pymodule_addobject (
+ gdb_module, "RegisterDescriptorIterator",
+ (PyObject *) &register_descriptor_iterator_object_type));
}
-static PyMethodDef register_descriptor_iterator_object_methods [] = {
+static PyMethodDef register_descriptor_iterator_object_methods[] = {
{ "find", (PyCFunction) register_descriptor_iter_find,
METH_VARARGS | METH_KEYWORDS,
"registers (name) -> gdb.RegisterDescriptor.\n\
Return a register descriptor for the register NAME, or None if no register\n\
with that name exists in this iterator." },
- {NULL} /* Sentinel */
+ { NULL } /* Sentinel */
};
PyTypeObject register_descriptor_iterator_object_type = {
- PyVarObject_HEAD_INIT (NULL, 0)
- "gdb.RegisterDescriptorIterator", /*tp_name*/
- sizeof (register_descriptor_iterator_object), /*tp_basicsize*/
- 0, /*tp_itemsize*/
- 0, /*tp_dealloc*/
- 0, /*tp_print*/
- 0, /*tp_getattr*/
- 0, /*tp_setattr*/
- 0, /*tp_compare*/
- 0, /*tp_repr*/
- 0, /*tp_as_number*/
- 0, /*tp_as_sequence*/
- 0, /*tp_as_mapping*/
- 0, /*tp_hash */
- 0, /*tp_call*/
- 0, /*tp_str*/
- 0, /*tp_getattro*/
- 0, /*tp_setattro*/
- 0, /*tp_as_buffer*/
- Py_TPFLAGS_DEFAULT, /*tp_flags*/
- "GDB architecture register descriptor iterator object", /*tp_doc */
- 0, /*tp_traverse */
- 0, /*tp_clear */
- 0, /*tp_richcompare */
- 0, /*tp_weaklistoffset */
- gdbpy_register_descriptor_iter, /*tp_iter */
- gdbpy_register_descriptor_iter_next, /*tp_iternext */
- register_descriptor_iterator_object_methods /*tp_methods */
+ PyVarObject_HEAD_INIT (NULL, 0) "gdb.RegisterDescriptorIterator", /*tp_name*/
+ sizeof (register_descriptor_iterator_object), /*tp_basicsize*/
+ 0, /*tp_itemsize*/
+ 0, /*tp_dealloc*/
+ 0, /*tp_print*/
+ 0, /*tp_getattr*/
+ 0, /*tp_setattr*/
+ 0, /*tp_compare*/
+ 0, /*tp_repr*/
+ 0, /*tp_as_number*/
+ 0, /*tp_as_sequence*/
+ 0, /*tp_as_mapping*/
+ 0, /*tp_hash */
+ 0, /*tp_call*/
+ 0, /*tp_str*/
+ 0, /*tp_getattro*/
+ 0, /*tp_setattro*/
+ 0, /*tp_as_buffer*/
+ Py_TPFLAGS_DEFAULT, /*tp_flags*/
+ "GDB architecture register descriptor iterator object", /*tp_doc */
+ 0, /*tp_traverse */
+ 0, /*tp_clear */
+ 0, /*tp_richcompare */
+ 0, /*tp_weaklistoffset */
+ gdbpy_register_descriptor_iter, /*tp_iter */
+ gdbpy_register_descriptor_iter_next, /*tp_iternext */
+ register_descriptor_iterator_object_methods /*tp_methods */
};
static gdb_PyGetSetDef gdbpy_register_descriptor_getset[] = {
- { "name", gdbpy_register_descriptor_name, NULL,
- "The name of this register.", NULL },
- { NULL } /* Sentinel */
+ { "name", gdbpy_register_descriptor_name, NULL, "The name of this register.",
+ NULL },
+ { NULL } /* Sentinel */
};
PyTypeObject register_descriptor_object_type = {
- PyVarObject_HEAD_INIT (NULL, 0)
- "gdb.RegisterDescriptor", /*tp_name*/
- sizeof (register_descriptor_object), /*tp_basicsize*/
- 0, /*tp_itemsize*/
- 0, /*tp_dealloc*/
- 0, /*tp_print*/
- 0, /*tp_getattr*/
- 0, /*tp_setattr*/
- 0, /*tp_compare*/
- 0, /*tp_repr*/
- 0, /*tp_as_number*/
- 0, /*tp_as_sequence*/
- 0, /*tp_as_mapping*/
- 0, /*tp_hash */
- 0, /*tp_call*/
- gdbpy_register_descriptor_to_string, /*tp_str*/
- 0, /*tp_getattro*/
- 0, /*tp_setattro*/
- 0, /*tp_as_buffer*/
- Py_TPFLAGS_DEFAULT, /*tp_flags*/
- "GDB architecture register descriptor object", /*tp_doc */
- 0, /*tp_traverse */
- 0, /*tp_clear */
- 0, /*tp_richcompare */
- 0, /*tp_weaklistoffset */
- 0, /*tp_iter */
- 0, /*tp_iternext */
- 0, /*tp_methods */
- 0, /*tp_members */
- gdbpy_register_descriptor_getset /*tp_getset */
+ PyVarObject_HEAD_INIT (NULL, 0) "gdb.RegisterDescriptor", /*tp_name*/
+ sizeof (register_descriptor_object), /*tp_basicsize*/
+ 0, /*tp_itemsize*/
+ 0, /*tp_dealloc*/
+ 0, /*tp_print*/
+ 0, /*tp_getattr*/
+ 0, /*tp_setattr*/
+ 0, /*tp_compare*/
+ 0, /*tp_repr*/
+ 0, /*tp_as_number*/
+ 0, /*tp_as_sequence*/
+ 0, /*tp_as_mapping*/
+ 0, /*tp_hash */
+ 0, /*tp_call*/
+ gdbpy_register_descriptor_to_string, /*tp_str*/
+ 0, /*tp_getattro*/
+ 0, /*tp_setattro*/
+ 0, /*tp_as_buffer*/
+ Py_TPFLAGS_DEFAULT, /*tp_flags*/
+ "GDB architecture register descriptor object", /*tp_doc */
+ 0, /*tp_traverse */
+ 0, /*tp_clear */
+ 0, /*tp_richcompare */
+ 0, /*tp_weaklistoffset */
+ 0, /*tp_iter */
+ 0, /*tp_iternext */
+ 0, /*tp_methods */
+ 0, /*tp_members */
+ gdbpy_register_descriptor_getset /*tp_getset */
};
PyTypeObject reggroup_iterator_object_type = {
- PyVarObject_HEAD_INIT (NULL, 0)
- "gdb.RegisterGroupsIterator", /*tp_name*/
- sizeof (reggroup_iterator_object), /*tp_basicsize*/
- 0, /*tp_itemsize*/
- 0, /*tp_dealloc*/
- 0, /*tp_print*/
- 0, /*tp_getattr*/
- 0, /*tp_setattr*/
- 0, /*tp_compare*/
- 0, /*tp_repr*/
- 0, /*tp_as_number*/
- 0, /*tp_as_sequence*/
- 0, /*tp_as_mapping*/
- 0, /*tp_hash */
- 0, /*tp_call*/
- 0, /*tp_str*/
- 0, /*tp_getattro*/
- 0, /*tp_setattro*/
- 0, /*tp_as_buffer*/
- Py_TPFLAGS_DEFAULT, /*tp_flags*/
- "GDB register groups iterator object", /*tp_doc */
- 0, /*tp_traverse */
- 0, /*tp_clear */
- 0, /*tp_richcompare */
- 0, /*tp_weaklistoffset */
- gdbpy_reggroup_iter, /*tp_iter */
- gdbpy_reggroup_iter_next, /*tp_iternext */
- 0 /*tp_methods */
+ PyVarObject_HEAD_INIT (NULL, 0) "gdb.RegisterGroupsIterator", /*tp_name*/
+ sizeof (reggroup_iterator_object), /*tp_basicsize*/
+ 0, /*tp_itemsize*/
+ 0, /*tp_dealloc*/
+ 0, /*tp_print*/
+ 0, /*tp_getattr*/
+ 0, /*tp_setattr*/
+ 0, /*tp_compare*/
+ 0, /*tp_repr*/
+ 0, /*tp_as_number*/
+ 0, /*tp_as_sequence*/
+ 0, /*tp_as_mapping*/
+ 0, /*tp_hash */
+ 0, /*tp_call*/
+ 0, /*tp_str*/
+ 0, /*tp_getattro*/
+ 0, /*tp_setattro*/
+ 0, /*tp_as_buffer*/
+ Py_TPFLAGS_DEFAULT, /*tp_flags*/
+ "GDB register groups iterator object", /*tp_doc */
+ 0, /*tp_traverse */
+ 0, /*tp_clear */
+ 0, /*tp_richcompare */
+ 0, /*tp_weaklistoffset */
+ gdbpy_reggroup_iter, /*tp_iter */
+ gdbpy_reggroup_iter_next, /*tp_iternext */
+ 0 /*tp_methods */
};
static gdb_PyGetSetDef gdbpy_reggroup_getset[] = {
- { "name", gdbpy_reggroup_name, NULL,
- "The name of this register group.", NULL },
- { NULL } /* Sentinel */
+ { "name", gdbpy_reggroup_name, NULL, "The name of this register group.",
+ NULL },
+ { NULL } /* Sentinel */
};
PyTypeObject reggroup_object_type = {
- PyVarObject_HEAD_INIT (NULL, 0)
- "gdb.RegisterGroup", /*tp_name*/
- sizeof (reggroup_object), /*tp_basicsize*/
- 0, /*tp_itemsize*/
- 0, /*tp_dealloc*/
- 0, /*tp_print*/
- 0, /*tp_getattr*/
- 0, /*tp_setattr*/
- 0, /*tp_compare*/
- 0, /*tp_repr*/
- 0, /*tp_as_number*/
- 0, /*tp_as_sequence*/
- 0, /*tp_as_mapping*/
- 0, /*tp_hash */
- 0, /*tp_call*/
- gdbpy_reggroup_to_string, /*tp_str*/
- 0, /*tp_getattro*/
- 0, /*tp_setattro*/
- 0, /*tp_as_buffer*/
- Py_TPFLAGS_DEFAULT, /*tp_flags*/
- "GDB register group object", /*tp_doc */
- 0, /*tp_traverse */
- 0, /*tp_clear */
- 0, /*tp_richcompare */
- 0, /*tp_weaklistoffset */
- 0, /*tp_iter */
- 0, /*tp_iternext */
- 0, /*tp_methods */
- 0, /*tp_members */
- gdbpy_reggroup_getset /*tp_getset */
+ PyVarObject_HEAD_INIT (NULL, 0) "gdb.RegisterGroup", /*tp_name*/
+ sizeof (reggroup_object), /*tp_basicsize*/
+ 0, /*tp_itemsize*/
+ 0, /*tp_dealloc*/
+ 0, /*tp_print*/
+ 0, /*tp_getattr*/
+ 0, /*tp_setattr*/
+ 0, /*tp_compare*/
+ 0, /*tp_repr*/
+ 0, /*tp_as_number*/
+ 0, /*tp_as_sequence*/
+ 0, /*tp_as_mapping*/
+ 0, /*tp_hash */
+ 0, /*tp_call*/
+ gdbpy_reggroup_to_string, /*tp_str*/
+ 0, /*tp_getattro*/
+ 0, /*tp_setattro*/
+ 0, /*tp_as_buffer*/
+ Py_TPFLAGS_DEFAULT, /*tp_flags*/
+ "GDB register group object", /*tp_doc */
+ 0, /*tp_traverse */
+ 0, /*tp_clear */
+ 0, /*tp_richcompare */
+ 0, /*tp_weaklistoffset */
+ 0, /*tp_iter */
+ 0, /*tp_iternext */
+ 0, /*tp_methods */
+ 0, /*tp_members */
+ gdbpy_reggroup_getset /*tp_getset */
};
diff --git a/gdb/python/py-signalevent.c b/gdb/python/py-signalevent.c
index 93d06706542..457ec3e9233 100644
--- a/gdb/python/py-signalevent.c
+++ b/gdb/python/py-signalevent.c
@@ -34,9 +34,9 @@ create_signal_event_object (enum gdb_signal stop_signal)
gdbpy_ref<> signal_name_obj (PyUnicode_FromString (signal_name));
if (signal_name_obj == NULL)
return NULL;
- if (evpy_add_attribute (signal_event_obj.get (),
- "stop_signal",
- signal_name_obj.get ()) < 0)
+ if (evpy_add_attribute (signal_event_obj.get (), "stop_signal",
+ signal_name_obj.get ())
+ < 0)
return NULL;
return signal_event_obj;
diff --git a/gdb/python/py-stopevent.c b/gdb/python/py-stopevent.c
index 0aa9d5381f8..c4f1dbe0a51 100644
--- a/gdb/python/py-stopevent.c
+++ b/gdb/python/py-stopevent.c
@@ -48,11 +48,10 @@ emit_stop_event (struct bpstat *bs, enum gdb_signal stop_signal)
/* Add any breakpoint set at this location to the list. */
for (current_bs = bs; current_bs != NULL; current_bs = current_bs->next)
{
- if (current_bs->breakpoint_at
- && current_bs->breakpoint_at->py_bp_object)
+ if (current_bs->breakpoint_at && current_bs->breakpoint_at->py_bp_object)
{
- PyObject *current_py_bp =
- (PyObject *) current_bs->breakpoint_at->py_bp_object;
+ PyObject *current_py_bp
+ = (PyObject *) current_bs->breakpoint_at->py_bp_object;
if (list == NULL)
{
@@ -71,15 +70,13 @@ emit_stop_event (struct bpstat *bs, enum gdb_signal stop_signal)
if (list != NULL)
{
- stop_event_obj = create_breakpoint_event_object (list.get (),
- first_bp);
+ stop_event_obj = create_breakpoint_event_object (list.get (), first_bp);
if (stop_event_obj == NULL)
return -1;
}
/* Check if the signal is "Signal 0" or "Trace/breakpoint trap". */
- if (stop_signal != GDB_SIGNAL_0
- && stop_signal != GDB_SIGNAL_TRAP)
+ if (stop_signal != GDB_SIGNAL_0 && stop_signal != GDB_SIGNAL_TRAP)
{
stop_event_obj = create_signal_event_object (stop_signal);
if (stop_event_obj == NULL)
diff --git a/gdb/python/py-stopevent.h b/gdb/python/py-stopevent.h
index 023459ff200..418826339d2 100644
--- a/gdb/python/py-stopevent.h
+++ b/gdb/python/py-stopevent.h
@@ -25,8 +25,7 @@
extern gdbpy_ref<> create_stop_event_object (PyTypeObject *py_type);
extern void stop_evpy_dealloc (PyObject *self);
-extern int emit_stop_event (struct bpstat *bs,
- enum gdb_signal stop_signal);
+extern int emit_stop_event (struct bpstat *bs, enum gdb_signal stop_signal);
extern gdbpy_ref<> create_breakpoint_event_object (PyObject *breakpoint_list,
PyObject *first_bp);
diff --git a/gdb/python/py-symbol.c b/gdb/python/py-symbol.c
index b8777966c47..5f8c2db88bf 100644
--- a/gdb/python/py-symbol.c
+++ b/gdb/python/py-symbol.c
@@ -25,10 +25,11 @@
#include "objfiles.h"
#include "symfile.h"
-struct symbol_object {
+struct symbol_object
+{
PyObject_HEAD
- /* The GDB symbol structure this object is wrapping. */
- struct symbol *symbol;
+ /* The GDB symbol structure this object is wrapping. */
+ struct symbol *symbol;
/* A symbol object is associated with an objfile, so keep track with
doubly-linked list, rooted in the objfile. This lets us
invalidate the underlying struct symbol when the objfile is
@@ -39,16 +40,17 @@ struct symbol_object {
/* Require a valid symbol. All access to symbol_object->symbol should be
gated by this call. */
-#define SYMPY_REQUIRE_VALID(symbol_obj, symbol) \
- do { \
- symbol = symbol_object_to_symbol (symbol_obj); \
- if (symbol == NULL) \
- { \
- PyErr_SetString (PyExc_RuntimeError, \
- _("Symbol is invalid.")); \
- return NULL; \
- } \
- } while (0)
+#define SYMPY_REQUIRE_VALID(symbol_obj, symbol) \
+ do \
+ { \
+ symbol = symbol_object_to_symbol (symbol_obj); \
+ if (symbol == NULL) \
+ { \
+ PyErr_SetString (PyExc_RuntimeError, _ ("Symbol is invalid.")); \
+ return NULL; \
+ } \
+ } \
+ while (0)
/* A deleter that is used when an objfile is about to be freed. */
struct symbol_object_deleter
@@ -69,7 +71,7 @@ struct symbol_object_deleter
};
static const registry<objfile>::key<symbol_object, symbol_object_deleter>
- sympy_objfile_data_key;
+ sympy_objfile_data_key;
static PyObject *
sympy_str (PyObject *self)
@@ -173,7 +175,8 @@ sympy_is_constant (PyObject *self, void *closure)
theclass = symbol->aclass ();
- return PyBool_FromLong (theclass == LOC_CONST || theclass == LOC_CONST_BYTES);
+ return PyBool_FromLong (theclass == LOC_CONST
+ || theclass == LOC_CONST_BYTES);
}
static PyObject *
@@ -201,7 +204,8 @@ sympy_is_variable (PyObject *self, void *closure)
return PyBool_FromLong (!symbol->is_argument ()
&& (theclass == LOC_LOCAL || theclass == LOC_REGISTER
- || theclass == LOC_STATIC || theclass == LOC_COMPUTED
+ || theclass == LOC_STATIC
+ || theclass == LOC_COMPUTED
|| theclass == LOC_OPTIMIZED_OUT));
}
@@ -291,11 +295,11 @@ sympy_value (PyObject *self, PyObject *args)
{
frame_info = frame_object_to_frame_info (frame_obj);
if (frame_info == NULL)
- error (_("invalid frame"));
+ error (_ ("invalid frame"));
}
if (symbol_read_needs_frame (symbol) && frame_info == NULL)
- error (_("symbol requires a frame to compute its value"));
+ error (_ ("symbol requires a frame to compute its value"));
/* TODO: currently, we have no way to recover the block in which SYMBOL
was found, so we have no block to pass to read_var_value. This will
@@ -321,8 +325,7 @@ set_symbol (symbol_object *obj, struct symbol *symbol)
{
obj->symbol = symbol;
obj->prev = NULL;
- if (symbol->is_objfile_owned ()
- && symbol->symtab () != NULL)
+ if (symbol->is_objfile_owned () && symbol->symtab () != NULL)
{
struct objfile *objfile = symbol->objfile ();
@@ -353,7 +356,7 @@ symbol_to_symbol_object (struct symbol *sym)
struct symbol *
symbol_object_to_symbol (PyObject *obj)
{
- if (! PyObject_TypeCheck (obj, &symbol_object_type))
+ if (!PyObject_TypeCheck (obj, &symbol_object_type))
return NULL;
return ((symbol_object *) obj)->symbol;
}
@@ -365,8 +368,7 @@ sympy_dealloc (PyObject *obj)
if (sym_obj->prev)
sym_obj->prev->next = sym_obj->next;
- else if (sym_obj->symbol != NULL
- && sym_obj->symbol->is_objfile_owned ()
+ else if (sym_obj->symbol != NULL && sym_obj->symbol->is_objfile_owned ()
&& sym_obj->symbol->symtab () != NULL)
sympy_objfile_data_key.set (sym_obj->symbol->objfile (), sym_obj->next);
if (sym_obj->next)
@@ -405,7 +407,7 @@ gdbpy_lookup_symbol (PyObject *self, PyObject *args, PyObject *kw)
try
{
- selected_frame = get_selected_frame (_("No frame selected."));
+ selected_frame = get_selected_frame (_ ("No frame selected."));
block = get_frame_block (selected_frame, NULL);
}
catch (const gdb_exception &except)
@@ -417,7 +419,8 @@ gdbpy_lookup_symbol (PyObject *self, PyObject *args, PyObject *kw)
try
{
symbol = lookup_symbol (name, block, (domain_enum) domain,
- &is_a_field_of_this).symbol;
+ &is_a_field_of_this)
+ .symbol;
}
catch (const gdb_exception &except)
{
@@ -512,7 +515,7 @@ gdbpy_lookup_static_symbol (PyObject *self, PyObject *args, PyObject *kw)
try
{
frame_info_ptr selected_frame
- = get_selected_frame (_("No frame selected."));
+ = get_selected_frame (_ ("No frame selected."));
block = get_frame_block (selected_frame, NULL);
}
catch (const gdb_exception &except)
@@ -524,8 +527,8 @@ gdbpy_lookup_static_symbol (PyObject *self, PyObject *args, PyObject *kw)
{
if (block != nullptr)
symbol
- = lookup_symbol_in_static_block (name, block,
- (domain_enum) domain).symbol;
+ = lookup_symbol_in_static_block (name, block, (domain_enum) domain)
+ .symbol;
if (symbol == nullptr)
symbol = lookup_static_symbol (name, (domain_enum) domain).symbol;
@@ -589,13 +592,14 @@ gdbpy_lookup_static_symbols (PyObject *self, PyObject *args, PyObject *kw)
if (block != nullptr)
{
- symbol *symbol = lookup_symbol_in_static_block
- (name, block, (domain_enum) domain).symbol;
+ symbol *symbol
+ = lookup_symbol_in_static_block (name, block,
+ (domain_enum) domain)
+ .symbol;
if (symbol != nullptr)
{
- PyObject *sym_obj
- = symbol_to_symbol_object (symbol);
+ PyObject *sym_obj = symbol_to_symbol_object (symbol);
if (PyList_Append (return_list.get (), sym_obj) == -1)
return NULL;
}
@@ -617,49 +621,57 @@ gdbpy_initialize_symbols (void)
if (PyType_Ready (&symbol_object_type) < 0)
return -1;
- if (PyModule_AddIntConstant (gdb_module, "SYMBOL_LOC_UNDEF", LOC_UNDEF) < 0
- || PyModule_AddIntConstant (gdb_module, "SYMBOL_LOC_CONST",
- LOC_CONST) < 0
- || PyModule_AddIntConstant (gdb_module, "SYMBOL_LOC_STATIC",
- LOC_STATIC) < 0
- || PyModule_AddIntConstant (gdb_module, "SYMBOL_LOC_REGISTER",
- LOC_REGISTER) < 0
- || PyModule_AddIntConstant (gdb_module, "SYMBOL_LOC_ARG",
- LOC_ARG) < 0
- || PyModule_AddIntConstant (gdb_module, "SYMBOL_LOC_REF_ARG",
- LOC_REF_ARG) < 0
- || PyModule_AddIntConstant (gdb_module, "SYMBOL_LOC_LOCAL",
- LOC_LOCAL) < 0
- || PyModule_AddIntConstant (gdb_module, "SYMBOL_LOC_TYPEDEF",
- LOC_TYPEDEF) < 0
- || PyModule_AddIntConstant (gdb_module, "SYMBOL_LOC_LABEL",
- LOC_LABEL) < 0
- || PyModule_AddIntConstant (gdb_module, "SYMBOL_LOC_BLOCK",
- LOC_BLOCK) < 0
- || PyModule_AddIntConstant (gdb_module, "SYMBOL_LOC_CONST_BYTES",
- LOC_CONST_BYTES) < 0
- || PyModule_AddIntConstant (gdb_module, "SYMBOL_LOC_UNRESOLVED",
- LOC_UNRESOLVED) < 0
- || PyModule_AddIntConstant (gdb_module, "SYMBOL_LOC_OPTIMIZED_OUT",
- LOC_OPTIMIZED_OUT) < 0
- || PyModule_AddIntConstant (gdb_module, "SYMBOL_LOC_COMPUTED",
- LOC_COMPUTED) < 0
- || PyModule_AddIntConstant (gdb_module, "SYMBOL_LOC_COMMON_BLOCK",
- LOC_COMMON_BLOCK) < 0
- || PyModule_AddIntConstant (gdb_module, "SYMBOL_LOC_REGPARM_ADDR",
- LOC_REGPARM_ADDR) < 0
- || PyModule_AddIntConstant (gdb_module, "SYMBOL_UNDEF_DOMAIN",
- UNDEF_DOMAIN) < 0
- || PyModule_AddIntConstant (gdb_module, "SYMBOL_VAR_DOMAIN",
- VAR_DOMAIN) < 0
- || PyModule_AddIntConstant (gdb_module, "SYMBOL_STRUCT_DOMAIN",
- STRUCT_DOMAIN) < 0
- || PyModule_AddIntConstant (gdb_module, "SYMBOL_LABEL_DOMAIN",
- LABEL_DOMAIN) < 0
- || PyModule_AddIntConstant (gdb_module, "SYMBOL_MODULE_DOMAIN",
- MODULE_DOMAIN) < 0
- || PyModule_AddIntConstant (gdb_module, "SYMBOL_COMMON_BLOCK_DOMAIN",
- COMMON_BLOCK_DOMAIN) < 0)
+ if (
+ PyModule_AddIntConstant (gdb_module, "SYMBOL_LOC_UNDEF", LOC_UNDEF) < 0
+ || PyModule_AddIntConstant (gdb_module, "SYMBOL_LOC_CONST", LOC_CONST) < 0
+ || PyModule_AddIntConstant (gdb_module, "SYMBOL_LOC_STATIC", LOC_STATIC)
+ < 0
+ || PyModule_AddIntConstant (gdb_module, "SYMBOL_LOC_REGISTER",
+ LOC_REGISTER)
+ < 0
+ || PyModule_AddIntConstant (gdb_module, "SYMBOL_LOC_ARG", LOC_ARG) < 0
+ || PyModule_AddIntConstant (gdb_module, "SYMBOL_LOC_REF_ARG", LOC_REF_ARG)
+ < 0
+ || PyModule_AddIntConstant (gdb_module, "SYMBOL_LOC_LOCAL", LOC_LOCAL) < 0
+ || PyModule_AddIntConstant (gdb_module, "SYMBOL_LOC_TYPEDEF", LOC_TYPEDEF)
+ < 0
+ || PyModule_AddIntConstant (gdb_module, "SYMBOL_LOC_LABEL", LOC_LABEL) < 0
+ || PyModule_AddIntConstant (gdb_module, "SYMBOL_LOC_BLOCK", LOC_BLOCK) < 0
+ || PyModule_AddIntConstant (gdb_module, "SYMBOL_LOC_CONST_BYTES",
+ LOC_CONST_BYTES)
+ < 0
+ || PyModule_AddIntConstant (gdb_module, "SYMBOL_LOC_UNRESOLVED",
+ LOC_UNRESOLVED)
+ < 0
+ || PyModule_AddIntConstant (gdb_module, "SYMBOL_LOC_OPTIMIZED_OUT",
+ LOC_OPTIMIZED_OUT)
+ < 0
+ || PyModule_AddIntConstant (gdb_module, "SYMBOL_LOC_COMPUTED",
+ LOC_COMPUTED)
+ < 0
+ || PyModule_AddIntConstant (gdb_module, "SYMBOL_LOC_COMMON_BLOCK",
+ LOC_COMMON_BLOCK)
+ < 0
+ || PyModule_AddIntConstant (gdb_module, "SYMBOL_LOC_REGPARM_ADDR",
+ LOC_REGPARM_ADDR)
+ < 0
+ || PyModule_AddIntConstant (gdb_module, "SYMBOL_UNDEF_DOMAIN",
+ UNDEF_DOMAIN)
+ < 0
+ || PyModule_AddIntConstant (gdb_module, "SYMBOL_VAR_DOMAIN", VAR_DOMAIN)
+ < 0
+ || PyModule_AddIntConstant (gdb_module, "SYMBOL_STRUCT_DOMAIN",
+ STRUCT_DOMAIN)
+ < 0
+ || PyModule_AddIntConstant (gdb_module, "SYMBOL_LABEL_DOMAIN",
+ LABEL_DOMAIN)
+ < 0
+ || PyModule_AddIntConstant (gdb_module, "SYMBOL_MODULE_DOMAIN",
+ MODULE_DOMAIN)
+ < 0
+ || PyModule_AddIntConstant (gdb_module, "SYMBOL_COMMON_BLOCK_DOMAIN",
+ COMMON_BLOCK_DOMAIN)
+ < 0)
return -1;
/* These remain defined for compatibility, but as they were never
@@ -669,22 +681,22 @@ gdbpy_initialize_symbols (void)
used differently. Here we try to give them values that will make
sense if they are passed to gdb.lookup_symbol. */
if (PyModule_AddIntConstant (gdb_module, "SYMBOL_VARIABLES_DOMAIN",
- VAR_DOMAIN) < 0
+ VAR_DOMAIN)
+ < 0
|| PyModule_AddIntConstant (gdb_module, "SYMBOL_FUNCTIONS_DOMAIN",
- VAR_DOMAIN) < 0
+ VAR_DOMAIN)
+ < 0
|| PyModule_AddIntConstant (gdb_module, "SYMBOL_TYPES_DOMAIN",
- VAR_DOMAIN) < 0)
+ VAR_DOMAIN)
+ < 0)
return -1;
return gdb_pymodule_addobject (gdb_module, "Symbol",
(PyObject *) &symbol_object_type);
}
-
-
static gdb_PyGetSetDef symbol_object_getset[] = {
- { "type", sympy_get_type, NULL,
- "Type of the symbol.", NULL },
+ { "type", sympy_get_type, NULL, "Type of the symbol.", NULL },
{ "symtab", sympy_get_symtab, NULL,
"Symbol table in which the symbol appears.", NULL },
{ "name", sympy_get_name, NULL,
@@ -695,7 +707,8 @@ static gdb_PyGetSetDef symbol_object_getset[] = {
{ "print_name", sympy_get_print_name, NULL,
"Name of the symbol in a form suitable for output.\n\
This is either name or linkage_name, depending on whether the user asked GDB\n\
-to display demangled or mangled names.", NULL },
+to display demangled or mangled names.",
+ NULL },
{ "addr_class", sympy_get_addr_class, NULL, "Address class of the symbol." },
{ "is_argument", sympy_is_argument, NULL,
"True if the symbol is an argument of a function." },
@@ -709,48 +722,45 @@ to display demangled or mangled names.", NULL },
"True if the symbol requires a frame for evaluation." },
{ "line", sympy_line, NULL,
"The source line number at which the symbol was defined." },
- { NULL } /* Sentinel */
+ { NULL } /* Sentinel */
};
static PyMethodDef symbol_object_methods[] = {
- { "is_valid", sympy_is_valid, METH_NOARGS,
- "is_valid () -> Boolean.\n\
+ { "is_valid", sympy_is_valid, METH_NOARGS, "is_valid () -> Boolean.\n\
Return true if this symbol is valid, false if not." },
- { "value", sympy_value, METH_VARARGS,
- "value ([frame]) -> gdb.Value\n\
+ { "value", sympy_value, METH_VARARGS, "value ([frame]) -> gdb.Value\n\
Return the value of the symbol." },
- {NULL} /* Sentinel */
+ { NULL } /* Sentinel */
};
PyTypeObject symbol_object_type = {
- PyVarObject_HEAD_INIT (NULL, 0)
- "gdb.Symbol", /*tp_name*/
- sizeof (symbol_object), /*tp_basicsize*/
- 0, /*tp_itemsize*/
- sympy_dealloc, /*tp_dealloc*/
- 0, /*tp_print*/
- 0, /*tp_getattr*/
- 0, /*tp_setattr*/
- 0, /*tp_compare*/
- 0, /*tp_repr*/
- 0, /*tp_as_number*/
- 0, /*tp_as_sequence*/
- 0, /*tp_as_mapping*/
- 0, /*tp_hash */
- 0, /*tp_call*/
- sympy_str, /*tp_str*/
- 0, /*tp_getattro*/
- 0, /*tp_setattro*/
- 0, /*tp_as_buffer*/
- Py_TPFLAGS_DEFAULT, /*tp_flags*/
- "GDB symbol object", /*tp_doc */
- 0, /*tp_traverse */
- 0, /*tp_clear */
- 0, /*tp_richcompare */
- 0, /*tp_weaklistoffset */
- 0, /*tp_iter */
- 0, /*tp_iternext */
- symbol_object_methods, /*tp_methods */
- 0, /*tp_members */
- symbol_object_getset /*tp_getset */
+ PyVarObject_HEAD_INIT (NULL, 0) "gdb.Symbol", /*tp_name*/
+ sizeof (symbol_object), /*tp_basicsize*/
+ 0, /*tp_itemsize*/
+ sympy_dealloc, /*tp_dealloc*/
+ 0, /*tp_print*/
+ 0, /*tp_getattr*/
+ 0, /*tp_setattr*/
+ 0, /*tp_compare*/
+ 0, /*tp_repr*/
+ 0, /*tp_as_number*/
+ 0, /*tp_as_sequence*/
+ 0, /*tp_as_mapping*/
+ 0, /*tp_hash */
+ 0, /*tp_call*/
+ sympy_str, /*tp_str*/
+ 0, /*tp_getattro*/
+ 0, /*tp_setattro*/
+ 0, /*tp_as_buffer*/
+ Py_TPFLAGS_DEFAULT, /*tp_flags*/
+ "GDB symbol object", /*tp_doc */
+ 0, /*tp_traverse */
+ 0, /*tp_clear */
+ 0, /*tp_richcompare */
+ 0, /*tp_weaklistoffset */
+ 0, /*tp_iter */
+ 0, /*tp_iternext */
+ symbol_object_methods, /*tp_methods */
+ 0, /*tp_members */
+ symbol_object_getset /*tp_getset */
};
diff --git a/gdb/python/py-symtab.c b/gdb/python/py-symtab.c
index 86ef7254956..7e82ac66928 100644
--- a/gdb/python/py-symtab.c
+++ b/gdb/python/py-symtab.c
@@ -25,10 +25,11 @@
#include "objfiles.h"
#include "block.h"
-struct symtab_object {
+struct symtab_object
+{
PyObject_HEAD
- /* The GDB Symbol table structure. */
- struct symtab *symtab;
+ /* The GDB Symbol table structure. */
+ struct symtab *symtab;
/* A symtab object is associated with an objfile, so keep track with
a doubly-linked list, rooted in the objfile. This allows
invalidation of the underlying struct symtab when the objfile is
@@ -58,28 +59,31 @@ struct stpy_deleter
}
};
-extern PyTypeObject symtab_object_type
- CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF ("symtab_object");
+extern PyTypeObject
+ symtab_object_type CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF ("symtab_object");
static const registry<objfile>::key<symtab_object, stpy_deleter>
- stpy_objfile_data_key;
+ stpy_objfile_data_key;
/* Require a valid symbol table. All access to symtab_object->symtab
should be gated by this call. */
-#define STPY_REQUIRE_VALID(symtab_obj, symtab) \
- do { \
- symtab = symtab_object_to_symtab (symtab_obj); \
- if (symtab == NULL) \
- { \
- PyErr_SetString (PyExc_RuntimeError, \
- _("Symbol Table is invalid.")); \
- return NULL; \
- } \
- } while (0)
-
-struct sal_object {
+#define STPY_REQUIRE_VALID(symtab_obj, symtab) \
+ do \
+ { \
+ symtab = symtab_object_to_symtab (symtab_obj); \
+ if (symtab == NULL) \
+ { \
+ PyErr_SetString (PyExc_RuntimeError, \
+ _ ("Symbol Table is invalid.")); \
+ return NULL; \
+ } \
+ } \
+ while (0)
+
+struct sal_object
+{
PyObject_HEAD
- /* The GDB Symbol table structure. */
- PyObject *symtab;
+ /* The GDB Symbol table structure. */
+ PyObject *symtab;
/* The GDB Symbol table and line structure. */
struct symtab_and_line *sal;
/* A Symtab and line object is associated with an objfile, so keep
@@ -119,23 +123,25 @@ struct salpy_deleter
}
};
-extern PyTypeObject sal_object_type
- CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF ("sal_object");
+extern PyTypeObject
+ sal_object_type CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF ("sal_object");
static const registry<objfile>::key<sal_object, salpy_deleter>
- salpy_objfile_data_key;
+ salpy_objfile_data_key;
/* Require a valid symbol table and line object. All access to
sal_object->sal should be gated by this call. */
-#define SALPY_REQUIRE_VALID(sal_obj, sal) \
- do { \
- sal = sal_object_to_symtab_and_line (sal_obj); \
- if (sal == NULL) \
- { \
- PyErr_SetString (PyExc_RuntimeError, \
- _("Symbol Table and Line is invalid.")); \
- return NULL; \
- } \
- } while (0)
+#define SALPY_REQUIRE_VALID(sal_obj, sal) \
+ do \
+ { \
+ sal = sal_object_to_symtab_and_line (sal_obj); \
+ if (sal == NULL) \
+ { \
+ PyErr_SetString (PyExc_RuntimeError, \
+ _ ("Symbol Table and Line is invalid.")); \
+ return NULL; \
+ } \
+ } \
+ while (0)
static PyObject *
stpy_str (PyObject *self)
@@ -171,7 +177,8 @@ stpy_get_objfile (PyObject *self, void *closure)
STPY_REQUIRE_VALID (self, symtab);
- return objfile_to_objfile_object (symtab->compunit ()->objfile ()).release ();
+ return objfile_to_objfile_object (symtab->compunit ()->objfile ())
+ .release ();
}
/* Getter function for symtab.producer. */
@@ -306,7 +313,6 @@ stpy_dealloc (PyObject *obj)
Py_TYPE (obj)->tp_free (obj);
}
-
static PyObject *
salpy_get_pc (PyObject *self, void *closure)
{
@@ -379,9 +385,9 @@ salpy_dealloc (PyObject *self)
if (self_sal->prev)
self_sal->prev->next = self_sal->next;
else if (self_sal->symtab != Py_None)
- salpy_objfile_data_key.set
- (symtab_object_to_symtab (self_sal->symtab)->compunit ()->objfile (),
- self_sal->next);
+ salpy_objfile_data_key.set (
+ symtab_object_to_symtab (self_sal->symtab)->compunit ()->objfile (),
+ self_sal->next);
if (self_sal->next)
self_sal->next->prev = self_sal->prev;
@@ -403,7 +409,7 @@ set_sal (sal_object *sal_obj, struct symtab_and_line sal)
if (sal.symtab)
{
- symtab_obj = symtab_to_symtab_object (sal.symtab);
+ symtab_obj = symtab_to_symtab_object (sal.symtab);
/* If a symtab existed in the sal, but it cannot be duplicated,
we exit. */
if (symtab_obj == NULL)
@@ -415,9 +421,10 @@ set_sal (sal_object *sal_obj, struct symtab_and_line sal)
Py_INCREF (Py_None);
}
- sal_obj->sal = ((struct symtab_and_line *)
- xmemdup (&sal, sizeof (struct symtab_and_line),
- sizeof (struct symtab_and_line)));
+ sal_obj->sal
+ = ((struct symtab_and_line *) xmemdup (&sal,
+ sizeof (struct symtab_and_line),
+ sizeof (struct symtab_and_line)));
sal_obj->symtab = symtab_obj;
sal_obj->prev = NULL;
@@ -495,7 +502,7 @@ symtab_and_line_to_sal_object (struct symtab_and_line sal)
struct symtab_and_line *
sal_object_to_symtab_and_line (PyObject *obj)
{
- if (! PyObject_TypeCheck (obj, &sal_object_type))
+ if (!PyObject_TypeCheck (obj, &sal_object_type))
return NULL;
return ((sal_object *) obj)->sal;
}
@@ -504,7 +511,7 @@ sal_object_to_symtab_and_line (PyObject *obj)
struct symtab *
symtab_object_to_symtab (PyObject *obj)
{
- if (! PyObject_TypeCheck (obj, &symtab_object_type))
+ if (!PyObject_TypeCheck (obj, &symtab_object_type))
return NULL;
return ((symtab_object *) obj)->symtab;
}
@@ -521,31 +528,27 @@ gdbpy_initialize_symtabs (void)
return -1;
if (gdb_pymodule_addobject (gdb_module, "Symtab",
- (PyObject *) &symtab_object_type) < 0)
+ (PyObject *) &symtab_object_type)
+ < 0)
return -1;
return gdb_pymodule_addobject (gdb_module, "Symtab_and_line",
(PyObject *) &sal_object_type);
}
-
-
static gdb_PyGetSetDef symtab_object_getset[] = {
- { "filename", stpy_get_filename, NULL,
- "The symbol table's source filename.", NULL },
- { "objfile", stpy_get_objfile, NULL, "The symtab's objfile.",
+ { "filename", stpy_get_filename, NULL, "The symbol table's source filename.",
NULL },
+ { "objfile", stpy_get_objfile, NULL, "The symtab's objfile.", NULL },
{ "producer", stpy_get_producer, NULL,
"The name/version of the program that compiled this symtab.", NULL },
- {NULL} /* Sentinel */
+ { NULL } /* Sentinel */
};
static PyMethodDef symtab_object_methods[] = {
- { "is_valid", stpy_is_valid, METH_NOARGS,
- "is_valid () -> Boolean.\n\
+ { "is_valid", stpy_is_valid, METH_NOARGS, "is_valid () -> Boolean.\n\
Return true if this symbol table is valid, false if not." },
- { "fullname", stpy_fullname, METH_NOARGS,
- "fullname () -> String.\n\
+ { "fullname", stpy_fullname, METH_NOARGS, "fullname () -> String.\n\
Return the symtab's full source filename." },
{ "global_block", stpy_global_block, METH_NOARGS,
"global_block () -> gdb.Block.\n\
@@ -553,91 +556,87 @@ Return the global block of the symbol table." },
{ "static_block", stpy_static_block, METH_NOARGS,
"static_block () -> gdb.Block.\n\
Return the static block of the symbol table." },
- { "linetable", stpy_get_linetable, METH_NOARGS,
+ { "linetable", stpy_get_linetable, METH_NOARGS,
"linetable () -> gdb.LineTable.\n\
Return the LineTable associated with this symbol table" },
- {NULL} /* Sentinel */
+ { NULL } /* Sentinel */
};
PyTypeObject symtab_object_type = {
- PyVarObject_HEAD_INIT (NULL, 0)
- "gdb.Symtab", /*tp_name*/
- sizeof (symtab_object), /*tp_basicsize*/
- 0, /*tp_itemsize*/
- stpy_dealloc, /*tp_dealloc*/
- 0, /*tp_print*/
- 0, /*tp_getattr*/
- 0, /*tp_setattr*/
- 0, /*tp_compare*/
- 0, /*tp_repr*/
- 0, /*tp_as_number*/
- 0, /*tp_as_sequence*/
- 0, /*tp_as_mapping*/
- 0, /*tp_hash */
- 0, /*tp_call*/
- stpy_str, /*tp_str*/
- 0, /*tp_getattro*/
- 0, /*tp_setattro*/
- 0, /*tp_as_buffer*/
- Py_TPFLAGS_DEFAULT, /*tp_flags*/
- "GDB symtab object", /*tp_doc */
- 0, /*tp_traverse */
- 0, /*tp_clear */
- 0, /*tp_richcompare */
- 0, /*tp_weaklistoffset */
- 0, /*tp_iter */
- 0, /*tp_iternext */
- symtab_object_methods, /*tp_methods */
- 0, /*tp_members */
- symtab_object_getset /*tp_getset */
+ PyVarObject_HEAD_INIT (NULL, 0) "gdb.Symtab", /*tp_name*/
+ sizeof (symtab_object), /*tp_basicsize*/
+ 0, /*tp_itemsize*/
+ stpy_dealloc, /*tp_dealloc*/
+ 0, /*tp_print*/
+ 0, /*tp_getattr*/
+ 0, /*tp_setattr*/
+ 0, /*tp_compare*/
+ 0, /*tp_repr*/
+ 0, /*tp_as_number*/
+ 0, /*tp_as_sequence*/
+ 0, /*tp_as_mapping*/
+ 0, /*tp_hash */
+ 0, /*tp_call*/
+ stpy_str, /*tp_str*/
+ 0, /*tp_getattro*/
+ 0, /*tp_setattro*/
+ 0, /*tp_as_buffer*/
+ Py_TPFLAGS_DEFAULT, /*tp_flags*/
+ "GDB symtab object", /*tp_doc */
+ 0, /*tp_traverse */
+ 0, /*tp_clear */
+ 0, /*tp_richcompare */
+ 0, /*tp_weaklistoffset */
+ 0, /*tp_iter */
+ 0, /*tp_iternext */
+ symtab_object_methods, /*tp_methods */
+ 0, /*tp_members */
+ symtab_object_getset /*tp_getset */
};
static gdb_PyGetSetDef sal_object_getset[] = {
{ "symtab", salpy_get_symtab, NULL, "Symtab object.", NULL },
{ "pc", salpy_get_pc, NULL, "Return the symtab_and_line's pc.", NULL },
- { "last", salpy_get_last, NULL,
- "Return the symtab_and_line's last address.", NULL },
- { "line", salpy_get_line, NULL,
- "Return the symtab_and_line's line.", NULL },
- {NULL} /* Sentinel */
+ { "last", salpy_get_last, NULL, "Return the symtab_and_line's last address.",
+ NULL },
+ { "line", salpy_get_line, NULL, "Return the symtab_and_line's line.", NULL },
+ { NULL } /* Sentinel */
};
static PyMethodDef sal_object_methods[] = {
- { "is_valid", salpy_is_valid, METH_NOARGS,
- "is_valid () -> Boolean.\n\
+ { "is_valid", salpy_is_valid, METH_NOARGS, "is_valid () -> Boolean.\n\
Return true if this symbol table and line is valid, false if not." },
- {NULL} /* Sentinel */
+ { NULL } /* Sentinel */
};
PyTypeObject sal_object_type = {
- PyVarObject_HEAD_INIT (NULL, 0)
- "gdb.Symtab_and_line", /*tp_name*/
- sizeof (sal_object), /*tp_basicsize*/
- 0, /*tp_itemsize*/
- salpy_dealloc, /*tp_dealloc*/
- 0, /*tp_print*/
- 0, /*tp_getattr*/
- 0, /*tp_setattr*/
- 0, /*tp_compare*/
- 0, /*tp_repr*/
- 0, /*tp_as_number*/
- 0, /*tp_as_sequence*/
- 0, /*tp_as_mapping*/
- 0, /*tp_hash */
- 0, /*tp_call*/
- salpy_str, /*tp_str*/
- 0, /*tp_getattro*/
- 0, /*tp_setattro*/
- 0, /*tp_as_buffer*/
- Py_TPFLAGS_DEFAULT, /*tp_flags*/
- "GDB symtab_and_line object", /*tp_doc */
- 0, /*tp_traverse */
- 0, /*tp_clear */
- 0, /*tp_richcompare */
- 0, /*tp_weaklistoffset */
- 0, /*tp_iter */
- 0, /*tp_iternext */
- sal_object_methods, /*tp_methods */
- 0, /*tp_members */
- sal_object_getset /*tp_getset */
+ PyVarObject_HEAD_INIT (NULL, 0) "gdb.Symtab_and_line", /*tp_name*/
+ sizeof (sal_object), /*tp_basicsize*/
+ 0, /*tp_itemsize*/
+ salpy_dealloc, /*tp_dealloc*/
+ 0, /*tp_print*/
+ 0, /*tp_getattr*/
+ 0, /*tp_setattr*/
+ 0, /*tp_compare*/
+ 0, /*tp_repr*/
+ 0, /*tp_as_number*/
+ 0, /*tp_as_sequence*/
+ 0, /*tp_as_mapping*/
+ 0, /*tp_hash */
+ 0, /*tp_call*/
+ salpy_str, /*tp_str*/
+ 0, /*tp_getattro*/
+ 0, /*tp_setattro*/
+ 0, /*tp_as_buffer*/
+ Py_TPFLAGS_DEFAULT, /*tp_flags*/
+ "GDB symtab_and_line object", /*tp_doc */
+ 0, /*tp_traverse */
+ 0, /*tp_clear */
+ 0, /*tp_richcompare */
+ 0, /*tp_weaklistoffset */
+ 0, /*tp_iter */
+ 0, /*tp_iternext */
+ sal_object_methods, /*tp_methods */
+ 0, /*tp_members */
+ sal_object_getset /*tp_getset */
};
diff --git a/gdb/python/py-threadevent.c b/gdb/python/py-threadevent.c
index b29f69a3855..d7dae07439c 100644
--- a/gdb/python/py-threadevent.c
+++ b/gdb/python/py-threadevent.c
@@ -28,8 +28,7 @@ py_get_event_thread (ptid_t ptid)
if (non_stop)
{
thread_info *thread
- = find_thread_ptid (current_inferior ()->process_target (),
- ptid);
+ = find_thread_ptid (current_inferior ()->process_target (), ptid);
if (thread != nullptr)
return thread_to_thread_object (thread);
PyErr_SetString (PyExc_RuntimeError, "Could not find event thread");
@@ -47,9 +46,8 @@ create_thread_event_object (PyTypeObject *py_type, PyObject *thread)
if (thread_event_obj == NULL)
return NULL;
- if (evpy_add_attribute (thread_event_obj.get (),
- "inferior_thread",
- thread) < 0)
+ if (evpy_add_attribute (thread_event_obj.get (), "inferior_thread", thread)
+ < 0)
return NULL;
return thread_event_obj;
diff --git a/gdb/python/py-tui.c b/gdb/python/py-tui.c
index e9c91012ae9..6df0cdd70ac 100644
--- a/gdb/python/py-tui.c
+++ b/gdb/python/py-tui.c
@@ -17,7 +17,6 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
-
#include "defs.h"
#include "arch-utils.h"
#include "python-internal.h"
@@ -45,15 +44,15 @@ struct gdbpy_tui_window
{
PyObject_HEAD
- /* The TUI window, or nullptr if the window has been deleted. */
- tui_py_window *window;
+ /* The TUI window, or nullptr if the window has been deleted. */
+ tui_py_window *window;
/* Return true if this object is valid. */
bool is_valid () const;
};
extern PyTypeObject gdbpy_tui_window_object_type
- CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF ("gdbpy_tui_window");
+ CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF ("gdbpy_tui_window");
/* A TUI window written in Python. */
@@ -80,10 +79,7 @@ public:
m_window = std::move (user_window);
}
- const char *name () const override
- {
- return m_name.c_str ();
- }
+ const char *name () const override { return m_name.c_str (); }
void rerender () override;
void do_scroll_vertical (int num_to_scroll) override;
@@ -118,16 +114,10 @@ public:
void output (const char *str, bool full_window);
/* A helper function to compute the viewport width. */
- int viewport_width () const
- {
- return std::max (0, width - 2);
- }
+ int viewport_width () const { return std::max (0, width - 2); }
/* A helper function to compute the viewport height. */
- int viewport_height () const
- {
- return std::max (0, height - 2);
- }
+ int viewport_height () const { return std::max (0, height - 2); }
private:
@@ -159,8 +149,7 @@ tui_py_window::~tui_py_window ()
/* This can be null if the user-provided Python construction
function failed. */
- if (m_window != nullptr
- && PyObject_HasAttrString (m_window.get (), "close"))
+ if (m_window != nullptr && PyObject_HasAttrString (m_window.get (), "close"))
{
gdbpy_ref<> result (PyObject_CallMethod (m_window.get (), "close",
nullptr));
@@ -210,8 +199,8 @@ tui_py_window::do_scroll_horizontal (int num_to_scroll)
if (PyObject_HasAttrString (m_window.get (), "hscroll"))
{
- gdbpy_ref<> result (PyObject_CallMethod (m_window.get(), "hscroll",
- "i", num_to_scroll, nullptr));
+ gdbpy_ref<> result (PyObject_CallMethod (m_window.get (), "hscroll", "i",
+ num_to_scroll, nullptr));
if (result == nullptr)
gdbpy_print_stack ();
}
@@ -224,8 +213,8 @@ tui_py_window::do_scroll_vertical (int num_to_scroll)
if (PyObject_HasAttrString (m_window.get (), "vscroll"))
{
- gdbpy_ref<> result (PyObject_CallMethod (m_window.get (), "vscroll",
- "i", num_to_scroll, nullptr));
+ gdbpy_ref<> result (PyObject_CallMethod (m_window.get (), "vscroll", "i",
+ num_to_scroll, nullptr));
if (result == nullptr)
gdbpy_print_stack ();
}
@@ -238,8 +227,8 @@ tui_py_window::click (int mouse_x, int mouse_y, int mouse_button)
if (PyObject_HasAttrString (m_window.get (), "click"))
{
- gdbpy_ref<> result (PyObject_CallMethod (m_window.get (), "click",
- "iii", mouse_x, mouse_y,
+ gdbpy_ref<> result (PyObject_CallMethod (m_window.get (), "click", "iii",
+ mouse_x, mouse_y,
mouse_button));
if (result == nullptr)
gdbpy_print_stack ();
@@ -262,8 +251,6 @@ tui_py_window::output (const char *text, bool full_window)
}
}
-
-
/* A callable that is used to create a TUI window. It wraps the
user-supplied window constructor. */
@@ -321,21 +308,19 @@ gdbpy_tui_window_maker::operator() (const char *win_name)
{
gdbpy_enter enter_py;
- gdbpy_ref<gdbpy_tui_window> wrapper
- (PyObject_New (gdbpy_tui_window, &gdbpy_tui_window_object_type));
+ gdbpy_ref<gdbpy_tui_window> wrapper (
+ PyObject_New (gdbpy_tui_window, &gdbpy_tui_window_object_type));
if (wrapper == nullptr)
{
gdbpy_print_stack ();
return nullptr;
}
- std::unique_ptr<tui_py_window> window
- (new tui_py_window (win_name, wrapper));
+ std::unique_ptr<tui_py_window> window (new tui_py_window (win_name,
+ wrapper));
- gdbpy_ref<> user_window
- (PyObject_CallFunctionObjArgs (m_constr.get (),
- (PyObject *) wrapper.get (),
- nullptr));
+ gdbpy_ref<> user_window (PyObject_CallFunctionObjArgs (
+ m_constr.get (), (PyObject *) wrapper.get (), nullptr));
if (user_window == nullptr)
{
gdbpy_print_stack ();
@@ -357,8 +342,8 @@ gdbpy_register_tui_window (PyObject *self, PyObject *args, PyObject *kw)
const char *name;
PyObject *cons_obj;
- if (!gdb_PyArg_ParseTupleAndKeywords (args, kw, "sO", keywords,
- &name, &cons_obj))
+ if (!gdb_PyArg_ParseTupleAndKeywords (args, kw, "sO", keywords, &name,
+ &cons_obj))
return nullptr;
try
@@ -375,28 +360,29 @@ gdbpy_register_tui_window (PyObject *self, PyObject *args, PyObject *kw)
Py_RETURN_NONE;
}
-
-
/* Require that "Window" be a valid window. */
-#define REQUIRE_WINDOW(Window) \
- do { \
- if (!(Window)->is_valid ()) \
- return PyErr_Format (PyExc_RuntimeError, \
- _("TUI window is invalid.")); \
- } while (0)
+#define REQUIRE_WINDOW(Window) \
+ do \
+ { \
+ if (!(Window)->is_valid ()) \
+ return PyErr_Format (PyExc_RuntimeError, \
+ _ ("TUI window is invalid.")); \
+ } \
+ while (0)
/* Require that "Window" be a valid window. */
-#define REQUIRE_WINDOW_FOR_SETTER(Window) \
- do { \
- if (!(Window)->is_valid ()) \
- { \
- PyErr_Format (PyExc_RuntimeError, \
- _("TUI window is invalid.")); \
- return -1; \
- } \
- } while (0)
+#define REQUIRE_WINDOW_FOR_SETTER(Window) \
+ do \
+ { \
+ if (!(Window)->is_valid ()) \
+ { \
+ PyErr_Format (PyExc_RuntimeError, _ ("TUI window is invalid.")); \
+ return -1; \
+ } \
+ } \
+ while (0)
/* Python function which checks the validity of a TUI window
object. */
@@ -482,7 +468,7 @@ gdbpy_tui_set_title (PyObject *self, PyObject *newvalue, void *closure)
if (newvalue == nullptr)
{
- PyErr_Format (PyExc_TypeError, _("Cannot delete \"title\" attribute."));
+ PyErr_Format (PyExc_TypeError, _ ("Cannot delete \"title\" attribute."));
return -1;
}
@@ -495,66 +481,60 @@ gdbpy_tui_set_title (PyObject *self, PyObject *newvalue, void *closure)
return 0;
}
-static gdb_PyGetSetDef tui_object_getset[] =
-{
+static gdb_PyGetSetDef tui_object_getset[] = {
{ "width", gdbpy_tui_width, NULL, "Width of the window.", NULL },
{ "height", gdbpy_tui_height, NULL, "Height of the window.", NULL },
{ "title", gdbpy_tui_title, gdbpy_tui_set_title, "Title of the window.",
NULL },
- { NULL } /* Sentinel */
+ { NULL } /* Sentinel */
};
-static PyMethodDef tui_object_methods[] =
-{
- { "is_valid", gdbpy_tui_is_valid, METH_NOARGS,
- "is_valid () -> Boolean\n\
+static PyMethodDef tui_object_methods[] = {
+ { "is_valid", gdbpy_tui_is_valid, METH_NOARGS, "is_valid () -> Boolean\n\
Return true if this TUI window is valid, false if not." },
- { "erase", gdbpy_tui_erase, METH_NOARGS,
- "Erase the TUI window." },
+ { "erase", gdbpy_tui_erase, METH_NOARGS, "Erase the TUI window." },
{ "write", (PyCFunction) gdbpy_tui_write, METH_VARARGS,
"Append a string to the TUI window." },
{ NULL } /* Sentinel. */
};
-PyTypeObject gdbpy_tui_window_object_type =
-{
- PyVarObject_HEAD_INIT (NULL, 0)
- "gdb.TuiWindow", /*tp_name*/
- sizeof (gdbpy_tui_window), /*tp_basicsize*/
- 0, /*tp_itemsize*/
- 0, /*tp_dealloc*/
- 0, /*tp_print*/
- 0, /*tp_getattr*/
- 0, /*tp_setattr*/
- 0, /*tp_compare*/
- 0, /*tp_repr*/
- 0, /*tp_as_number*/
- 0, /*tp_as_sequence*/
- 0, /*tp_as_mapping*/
- 0, /*tp_hash */
- 0, /*tp_call*/
- 0, /*tp_str*/
- 0, /*tp_getattro*/
- 0, /*tp_setattro */
- 0, /*tp_as_buffer*/
- Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /*tp_flags*/
- "GDB TUI window object", /* tp_doc */
- 0, /* tp_traverse */
- 0, /* tp_clear */
- 0, /* tp_richcompare */
- 0, /* tp_weaklistoffset */
- 0, /* tp_iter */
- 0, /* tp_iternext */
- tui_object_methods, /* tp_methods */
- 0, /* tp_members */
- tui_object_getset, /* tp_getset */
- 0, /* tp_base */
- 0, /* tp_dict */
- 0, /* tp_descr_get */
- 0, /* tp_descr_set */
- 0, /* tp_dictoffset */
- 0, /* tp_init */
- 0, /* tp_alloc */
+PyTypeObject gdbpy_tui_window_object_type = {
+ PyVarObject_HEAD_INIT (NULL, 0) "gdb.TuiWindow", /*tp_name*/
+ sizeof (gdbpy_tui_window), /*tp_basicsize*/
+ 0, /*tp_itemsize*/
+ 0, /*tp_dealloc*/
+ 0, /*tp_print*/
+ 0, /*tp_getattr*/
+ 0, /*tp_setattr*/
+ 0, /*tp_compare*/
+ 0, /*tp_repr*/
+ 0, /*tp_as_number*/
+ 0, /*tp_as_sequence*/
+ 0, /*tp_as_mapping*/
+ 0, /*tp_hash */
+ 0, /*tp_call*/
+ 0, /*tp_str*/
+ 0, /*tp_getattro*/
+ 0, /*tp_setattro */
+ 0, /*tp_as_buffer*/
+ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /*tp_flags*/
+ "GDB TUI window object", /* tp_doc */
+ 0, /* tp_traverse */
+ 0, /* tp_clear */
+ 0, /* tp_richcompare */
+ 0, /* tp_weaklistoffset */
+ 0, /* tp_iter */
+ 0, /* tp_iternext */
+ tui_object_methods, /* tp_methods */
+ 0, /* tp_members */
+ tui_object_getset, /* tp_getset */
+ 0, /* tp_base */
+ 0, /* tp_dict */
+ 0, /* tp_descr_get */
+ 0, /* tp_descr_set */
+ 0, /* tp_dictoffset */
+ 0, /* tp_init */
+ 0, /* tp_alloc */
};
#endif /* TUI */
@@ -568,7 +548,7 @@ gdbpy_initialize_tui ()
gdbpy_tui_window_object_type.tp_new = PyType_GenericNew;
if (PyType_Ready (&gdbpy_tui_window_object_type) < 0)
return -1;
-#endif /* TUI */
+#endif /* TUI */
return 0;
}
diff --git a/gdb/python/py-type.c b/gdb/python/py-type.c
index 81b595140af..2a28cbda30e 100644
--- a/gdb/python/py-type.c
+++ b/gdb/python/py-type.c
@@ -31,8 +31,7 @@
struct type_object
{
- PyObject_HEAD
- struct type *type;
+ PyObject_HEAD struct type *type;
/* If a Type object is associated with an objfile, it is kept on a
doubly-linked list, rooted in the objfile. This lets us copy the
@@ -41,26 +40,27 @@ struct type_object
struct type_object *next;
};
-extern PyTypeObject type_object_type
- CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF ("type_object");
+extern PyTypeObject
+ type_object_type CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF ("type_object");
/* A Field object. */
struct field_object
{
PyObject_HEAD
- /* Dictionary holding our attributes. */
- PyObject *dict;
+ /* Dictionary holding our attributes. */
+ PyObject *dict;
};
-extern PyTypeObject field_object_type
- CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF ("field_object");
+extern PyTypeObject
+ field_object_type CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF ("field_object");
/* A type iterator object. */
-struct typy_iterator_object {
+struct typy_iterator_object
+{
PyObject_HEAD
- /* The current field index. */
- int field;
+ /* The current field index. */
+ int field;
/* What to return. */
enum gdbpy_iter_kind kind;
/* Pointer back to the original source type object. */
@@ -68,7 +68,7 @@ struct typy_iterator_object {
};
extern PyTypeObject type_iterator_object_type
- CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF ("typy_iterator_object");
+ CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF ("typy_iterator_object");
/* This is used to initialize various gdb.TYPE_ constants. */
struct pyty_code
@@ -82,8 +82,7 @@ struct pyty_code
/* Forward declarations. */
static PyObject *typy_make_iter (PyObject *self, enum gdbpy_iter_kind kind);
-static struct pyty_code pyty_codes[] =
-{
+static struct pyty_code pyty_codes[] = {
/* This is kept for backward compatibility. */
{ -1, "TYPE_CODE_BITSTRING" },
@@ -92,8 +91,6 @@ static struct pyty_code pyty_codes[] =
#undef OP
};
-
-
static void
field_dealloc (PyObject *obj)
{
@@ -118,8 +115,6 @@ field_new (void)
return (PyObject *) result.release ();
}
-
-
/* Return true if OBJ is of type gdb.Field, false otherwise. */
int
@@ -160,7 +155,8 @@ convert_field (struct type *type, int field)
if (type->code () == TYPE_CODE_ENUM)
{
- arg = gdb_py_object_from_longest (type->field (field).loc_enumval ());
+ arg
+ = gdb_py_object_from_longest (type->field (field).loc_enumval ());
attrstring = "enumval";
}
else
@@ -168,7 +164,8 @@ convert_field (struct type *type, int field)
if (type->field (field).loc_kind () == FIELD_LOC_KIND_DWARF_BLOCK)
arg = gdbpy_ref<>::new_reference (Py_None);
else
- arg = gdb_py_object_from_longest (type->field (field).loc_bitpos ());
+ arg
+ = gdb_py_object_from_longest (type->field (field).loc_bitpos ());
attrstring = "bitpos";
}
@@ -386,8 +383,7 @@ typy_get_tag (PyObject *self, void *closure)
struct type *type = ((type_object *) self)->type;
const char *tagname = nullptr;
- if (type->code () == TYPE_CODE_STRUCT
- || type->code () == TYPE_CODE_UNION
+ if (type->code () == TYPE_CODE_STRUCT || type->code () == TYPE_CODE_UNION
|| type->code () == TYPE_CODE_ENUM)
tagname = type->name ();
@@ -431,8 +427,7 @@ typy_is_signed (PyObject *self, void *closure)
if (!is_scalar_type (type))
{
- PyErr_SetString (PyExc_ValueError,
- _("Type must be a scalar type"));
+ PyErr_SetString (PyExc_ValueError, _ ("Type must be a scalar type"));
return nullptr;
}
@@ -466,7 +461,6 @@ typy_strip_typedefs (PyObject *self, PyObject *args)
static struct type *
typy_get_composite (struct type *type)
{
-
for (;;)
{
try
@@ -485,14 +479,13 @@ typy_get_composite (struct type *type)
/* If this is not a struct, union, or enum type, raise TypeError
exception. */
- if (type->code () != TYPE_CODE_STRUCT
- && type->code () != TYPE_CODE_UNION
- && type->code () != TYPE_CODE_ENUM
- && type->code () != TYPE_CODE_METHOD
+ if (type->code () != TYPE_CODE_STRUCT && type->code () != TYPE_CODE_UNION
+ && type->code () != TYPE_CODE_ENUM && type->code () != TYPE_CODE_METHOD
&& type->code () != TYPE_CODE_FUNC)
{
- PyErr_SetString (PyExc_TypeError,
- "Type is not a structure, union, enum, or function type.");
+ PyErr_SetString (
+ PyExc_TypeError,
+ "Type is not a structure, union, enum, or function type.");
return NULL;
}
@@ -509,7 +502,7 @@ typy_array_1 (PyObject *self, PyObject *args, int is_vector)
struct type *array = NULL;
struct type *type = ((type_object *) self)->type;
- if (! PyArg_ParseTuple (args, "l|O", &n1, &n2_obj))
+ if (!PyArg_ParseTuple (args, "l|O", &n1, &n2_obj))
return NULL;
if (n2_obj)
@@ -517,11 +510,11 @@ typy_array_1 (PyObject *self, PyObject *args, int is_vector)
if (!PyLong_Check (n2_obj))
{
PyErr_SetString (PyExc_RuntimeError,
- _("Array bound must be an integer"));
+ _ ("Array bound must be an integer"));
return NULL;
}
- if (! gdb_py_int_as_long (n2_obj, &n2))
+ if (!gdb_py_int_as_long (n2_obj, &n2))
return NULL;
}
else
@@ -533,7 +526,7 @@ typy_array_1 (PyObject *self, PyObject *args, int is_vector)
if (n2 < n1 - 1) /* Note: An empty array has n2 == n1 - 1. */
{
PyErr_SetString (PyExc_ValueError,
- _("Array length must not be negative"));
+ _ ("Array length must not be negative"));
return NULL;
}
@@ -595,12 +588,11 @@ typy_range (PyObject *self, PyObject *args)
/* Initialize these to appease GCC warnings. */
LONGEST low = 0, high = 0;
- if (type->code () != TYPE_CODE_ARRAY
- && type->code () != TYPE_CODE_STRING
+ if (type->code () != TYPE_CODE_ARRAY && type->code () != TYPE_CODE_STRING
&& type->code () != TYPE_CODE_RANGE)
{
PyErr_SetString (PyExc_RuntimeError,
- _("This type does not have a range."));
+ _ ("This type does not have a range."));
return NULL;
}
@@ -665,8 +657,7 @@ typy_target (PyObject *self, PyObject *args)
if (!type->target_type ())
{
- PyErr_SetString (PyExc_RuntimeError,
- _("Type does not have a target."));
+ PyErr_SetString (PyExc_RuntimeError, _ ("Type does not have a target."));
return NULL;
}
@@ -807,8 +798,7 @@ typy_lookup_typename (const char *type_name, const struct block *block)
else if (startswith (type_name, "enum "))
type = lookup_enum (type_name + 5, NULL);
else
- type = lookup_typename (current_language,
- type_name, block, 0);
+ type = lookup_typename (current_language, type_name, block, 0);
}
catch (const gdb_exception &except)
{
@@ -836,7 +826,7 @@ typy_lookup_type (struct demangle_component *demangled,
|| demangled_type == DEMANGLE_COMPONENT_VOLATILE)
{
type = typy_lookup_type (demangled->u.s_binary.left, block);
- if (! type)
+ if (!type)
return NULL;
try
@@ -897,7 +887,7 @@ typy_legacy_template_argument (struct type *type, const struct block *block,
if (type->name () == NULL)
{
- PyErr_SetString (PyExc_RuntimeError, _("Null type name."));
+ PyErr_SetString (PyExc_RuntimeError, _ ("Null type name."));
return NULL;
}
@@ -911,7 +901,7 @@ typy_legacy_template_argument (struct type *type, const struct block *block,
GDB_PY_HANDLE_EXCEPTION (except);
}
- if (! info)
+ if (!info)
{
PyErr_SetString (PyExc_RuntimeError, err.c_str ());
return NULL;
@@ -925,7 +915,7 @@ typy_legacy_template_argument (struct type *type, const struct block *block,
if (demangled->type != DEMANGLE_COMPONENT_TEMPLATE)
{
- PyErr_SetString (PyExc_RuntimeError, _("Type is not a template."));
+ PyErr_SetString (PyExc_RuntimeError, _ ("Type is not a template."));
return NULL;
}
@@ -935,15 +925,15 @@ typy_legacy_template_argument (struct type *type, const struct block *block,
for (i = 0; demangled && i < argno; ++i)
demangled = demangled->u.s_binary.right;
- if (! demangled)
+ if (!demangled)
{
- PyErr_Format (PyExc_RuntimeError, _("No argument %d in template."),
+ PyErr_Format (PyExc_RuntimeError, _ ("No argument %d in template."),
argno);
return NULL;
}
argtype = typy_lookup_type (demangled->u.s_binary.left, block);
- if (! argtype)
+ if (!argtype)
return NULL;
return type_to_type_object (argtype);
@@ -959,23 +949,23 @@ typy_template_argument (PyObject *self, PyObject *args)
struct symbol *sym;
struct value *val = NULL;
- if (! PyArg_ParseTuple (args, "i|O", &argno, &block_obj))
+ if (!PyArg_ParseTuple (args, "i|O", &argno, &block_obj))
return NULL;
if (argno < 0)
{
PyErr_SetString (PyExc_RuntimeError,
- _("Template argument number must be non-negative"));
+ _ ("Template argument number must be non-negative"));
return NULL;
}
if (block_obj)
{
block = block_object_to_block (block_obj);
- if (! block)
+ if (!block)
{
PyErr_SetString (PyExc_RuntimeError,
- _("Second argument must be block."));
+ _ ("Second argument must be block."));
return NULL;
}
}
@@ -994,12 +984,12 @@ typy_template_argument (PyObject *self, PyObject *args)
/* We might not have DW_TAG_template_*, so try to parse the type's
name. This is inefficient if we do not have a template type --
but that is going to wind up as an error anyhow. */
- if (! TYPE_N_TEMPLATE_ARGUMENTS (type))
+ if (!TYPE_N_TEMPLATE_ARGUMENTS (type))
return typy_legacy_template_argument (type, block, argno);
if (argno >= TYPE_N_TEMPLATE_ARGUMENTS (type))
{
- PyErr_Format (PyExc_RuntimeError, _("No argument %d in template."),
+ PyErr_Format (PyExc_RuntimeError, _ ("No argument %d in template."),
argno);
return NULL;
}
@@ -1010,7 +1000,7 @@ typy_template_argument (PyObject *self, PyObject *args)
else if (sym->aclass () == LOC_OPTIMIZED_OUT)
{
PyErr_Format (PyExc_RuntimeError,
- _("Template argument is optimized out"));
+ _ ("Template argument is optimized out"));
return NULL;
}
@@ -1033,17 +1023,16 @@ typy_str (PyObject *self)
try
{
- current_language->print_type (type_object_to_type (self), "",
- &thetype, -1, 0,
- &type_print_raw_options);
+ current_language->print_type (type_object_to_type (self), "", &thetype,
+ -1, 0, &type_print_raw_options);
}
catch (const gdb_exception &except)
{
GDB_PY_HANDLE_EXCEPTION (except);
}
- return PyUnicode_Decode (thetype.c_str (), thetype.size (),
- host_charset (), NULL);
+ return PyUnicode_Decode (thetype.c_str (), thetype.size (), host_charset (),
+ NULL);
}
/* Implement the richcompare method. */
@@ -1084,8 +1073,6 @@ typy_richcompare (PyObject *self, PyObject *other, int op)
Py_RETURN_FALSE;
}
-
-
/* Deleter that saves types when an objfile is being destroyed. */
struct typy_deleter
{
@@ -1117,7 +1104,7 @@ struct typy_deleter
};
static const registry<objfile>::key<type_object, typy_deleter>
- typy_objfile_data_key;
+ typy_objfile_data_key;
static void
set_type (type_object *obj, struct type *type)
@@ -1291,10 +1278,10 @@ typy_make_iter (PyObject *self, enum gdbpy_iter_kind kind)
if (typy_get_composite (((type_object *) self)->type) == NULL)
return NULL;
- typy_iter_obj = PyObject_New (typy_iterator_object,
- &type_iterator_object_type);
+ typy_iter_obj
+ = PyObject_New (typy_iterator_object, &type_iterator_object_type);
if (typy_iter_obj == NULL)
- return NULL;
+ return NULL;
typy_iter_obj->field = 0;
typy_iter_obj->kind = kind;
@@ -1357,8 +1344,8 @@ typy_iterator_iternext (PyObject *self)
if (iter_obj->field < type->num_fields ())
{
- gdbpy_ref<> result = make_fielditem (type, iter_obj->field,
- iter_obj->kind);
+ gdbpy_ref<> result
+ = make_fielditem (type, iter_obj->field, iter_obj->kind);
if (result != NULL)
iter_obj->field++;
return result.release ();
@@ -1403,13 +1390,11 @@ type_to_type_object (struct type *type)
struct type *
type_object_to_type (PyObject *obj)
{
- if (! PyObject_TypeCheck (obj, &type_object_type))
+ if (!PyObject_TypeCheck (obj, &type_object_type))
return NULL;
return ((type_object *) obj)->type;
}
-
-
/* Implementation of gdb.lookup_type. */
PyObject *
gdbpy_lookup_type (PyObject *self, PyObject *args, PyObject *kw)
@@ -1420,23 +1405,23 @@ gdbpy_lookup_type (PyObject *self, PyObject *args, PyObject *kw)
PyObject *block_obj = NULL;
const struct block *block = NULL;
- if (!gdb_PyArg_ParseTupleAndKeywords (args, kw, "s|O", keywords,
- &type_name, &block_obj))
+ if (!gdb_PyArg_ParseTupleAndKeywords (args, kw, "s|O", keywords, &type_name,
+ &block_obj))
return NULL;
if (block_obj)
{
block = block_object_to_block (block_obj);
- if (! block)
+ if (!block)
{
PyErr_SetString (PyExc_RuntimeError,
- _("'block' argument must be a Block."));
+ _ ("'block' argument must be a Block."));
return NULL;
}
}
type = typy_lookup_typename (type_name, block);
- if (! type)
+ if (!type)
return NULL;
return type_to_type_object (type);
@@ -1459,266 +1444,238 @@ gdbpy_initialize_types (void)
}
if (gdb_pymodule_addobject (gdb_module, "Type",
- (PyObject *) &type_object_type) < 0)
+ (PyObject *) &type_object_type)
+ < 0)
return -1;
if (gdb_pymodule_addobject (gdb_module, "TypeIterator",
- (PyObject *) &type_iterator_object_type) < 0)
+ (PyObject *) &type_iterator_object_type)
+ < 0)
return -1;
return gdb_pymodule_addobject (gdb_module, "Field",
(PyObject *) &field_object_type);
}
-
-
-static gdb_PyGetSetDef type_object_getset[] =
-{
- { "alignof", typy_get_alignof, NULL,
- "The alignment of this type, in bytes.", NULL },
- { "code", typy_get_code, NULL,
- "The code for this type.", NULL },
- { "dynamic", typy_get_dynamic, NULL,
- "Whether this type is dynamic.", NULL },
- { "name", typy_get_name, NULL,
- "The name for this type, or None.", NULL },
- { "sizeof", typy_get_sizeof, NULL,
- "The size of this type, in bytes.", NULL },
- { "tag", typy_get_tag, NULL,
- "The tag name for this type, or None.", NULL },
+static gdb_PyGetSetDef type_object_getset[] = {
+ { "alignof", typy_get_alignof, NULL, "The alignment of this type, in bytes.",
+ NULL },
+ { "code", typy_get_code, NULL, "The code for this type.", NULL },
+ { "dynamic", typy_get_dynamic, NULL, "Whether this type is dynamic.", NULL },
+ { "name", typy_get_name, NULL, "The name for this type, or None.", NULL },
+ { "sizeof", typy_get_sizeof, NULL, "The size of this type, in bytes.",
+ NULL },
+ { "tag", typy_get_tag, NULL, "The tag name for this type, or None.", NULL },
{ "objfile", typy_get_objfile, NULL,
"The objfile this type was defined in, or None.", NULL },
- { "is_scalar", typy_is_scalar, nullptr,
- "Is this a scalar type?", nullptr },
- { "is_signed", typy_is_signed, nullptr,
- "Is this an signed type?", nullptr },
+ { "is_scalar", typy_is_scalar, nullptr, "Is this a scalar type?", nullptr },
+ { "is_signed", typy_is_signed, nullptr, "Is this an signed type?", nullptr },
{ NULL }
};
-static PyMethodDef type_object_methods[] =
-{
- { "array", typy_array, METH_VARARGS,
- "array ([LOW_BOUND,] HIGH_BOUND) -> Type\n\
+static PyMethodDef type_object_methods[]
+ = { { "array", typy_array, METH_VARARGS,
+ "array ([LOW_BOUND,] HIGH_BOUND) -> Type\n\
Return a type which represents an array of objects of this type.\n\
The bounds of the array are [LOW_BOUND, HIGH_BOUND] inclusive.\n\
If LOW_BOUND is omitted, a value of zero is used." },
- { "vector", typy_vector, METH_VARARGS,
- "vector ([LOW_BOUND,] HIGH_BOUND) -> Type\n\
+ { "vector", typy_vector, METH_VARARGS,
+ "vector ([LOW_BOUND,] HIGH_BOUND) -> Type\n\
Return a type which represents a vector of objects of this type.\n\
The bounds of the array are [LOW_BOUND, HIGH_BOUND] inclusive.\n\
If LOW_BOUND is omitted, a value of zero is used.\n\
Vectors differ from arrays in that if the current language has C-style\n\
arrays, vectors don't decay to a pointer to the first element.\n\
They are first class values." },
- { "__contains__", typy_has_key, METH_VARARGS,
- "T.__contains__(k) -> True if T has a field named k, else False" },
- { "const", typy_const, METH_NOARGS,
- "const () -> Type\n\
+ { "__contains__", typy_has_key, METH_VARARGS,
+ "T.__contains__(k) -> True if T has a field named k, else False" },
+ { "const", typy_const, METH_NOARGS, "const () -> Type\n\
Return a const variant of this type." },
- { "optimized_out", typy_optimized_out, METH_NOARGS,
- "optimized_out() -> Value\n\
+ { "optimized_out", typy_optimized_out, METH_NOARGS,
+ "optimized_out() -> Value\n\
Return optimized out value of this type." },
- { "fields", typy_fields, METH_NOARGS,
- "fields () -> list\n\
+ { "fields", typy_fields, METH_NOARGS, "fields () -> list\n\
Return a list holding all the fields of this type.\n\
Each field is a gdb.Field object." },
- { "get", typy_get, METH_VARARGS,
- "T.get(k[,default]) -> returns field named k in T, if it exists;\n\
+ { "get", typy_get, METH_VARARGS,
+ "T.get(k[,default]) -> returns field named k in T, if it exists;\n\
otherwise returns default, if supplied, or None if not." },
- { "has_key", typy_has_key, METH_VARARGS,
- "T.has_key(k) -> True if T has a field named k, else False" },
- { "items", typy_items, METH_NOARGS,
- "items () -> list\n\
+ { "has_key", typy_has_key, METH_VARARGS,
+ "T.has_key(k) -> True if T has a field named k, else False" },
+ { "items", typy_items, METH_NOARGS, "items () -> list\n\
Return a list of (name, field) pairs of this type.\n\
Each field is a gdb.Field object." },
- { "iteritems", typy_iteritems, METH_NOARGS,
- "iteritems () -> an iterator over the (name, field)\n\
+ { "iteritems", typy_iteritems, METH_NOARGS,
+ "iteritems () -> an iterator over the (name, field)\n\
pairs of this type. Each field is a gdb.Field object." },
- { "iterkeys", typy_iterkeys, METH_NOARGS,
- "iterkeys () -> an iterator over the field names of this type." },
- { "itervalues", typy_itervalues, METH_NOARGS,
- "itervalues () -> an iterator over the fields of this type.\n\
+ { "iterkeys", typy_iterkeys, METH_NOARGS,
+ "iterkeys () -> an iterator over the field names of this type." },
+ { "itervalues", typy_itervalues, METH_NOARGS,
+ "itervalues () -> an iterator over the fields of this type.\n\
Each field is a gdb.Field object." },
- { "keys", typy_field_names, METH_NOARGS,
- "keys () -> list\n\
+ { "keys", typy_field_names, METH_NOARGS, "keys () -> list\n\
Return a list holding all the fields names of this type." },
- { "pointer", typy_pointer, METH_NOARGS,
- "pointer () -> Type\n\
+ { "pointer", typy_pointer, METH_NOARGS, "pointer () -> Type\n\
Return a type of pointer to this type." },
- { "range", typy_range, METH_NOARGS,
- "range () -> tuple\n\
-Return a tuple containing the lower and upper range for this type."},
- { "reference", typy_reference, METH_NOARGS,
- "reference () -> Type\n\
+ { "range", typy_range, METH_NOARGS, "range () -> tuple\n\
+Return a tuple containing the lower and upper range for this type." },
+ { "reference", typy_reference, METH_NOARGS, "reference () -> Type\n\
Return a type of reference to this type." },
- { "strip_typedefs", typy_strip_typedefs, METH_NOARGS,
- "strip_typedefs () -> Type\n\
-Return a type formed by stripping this type of all typedefs."},
- { "target", typy_target, METH_NOARGS,
- "target () -> Type\n\
+ { "strip_typedefs", typy_strip_typedefs, METH_NOARGS,
+ "strip_typedefs () -> Type\n\
+Return a type formed by stripping this type of all typedefs." },
+ { "target", typy_target, METH_NOARGS, "target () -> Type\n\
Return the target type of this type." },
- { "template_argument", typy_template_argument, METH_VARARGS,
- "template_argument (arg, [block]) -> Type\n\
+ { "template_argument", typy_template_argument, METH_VARARGS,
+ "template_argument (arg, [block]) -> Type\n\
Return the type of a template argument." },
- { "unqualified", typy_unqualified, METH_NOARGS,
- "unqualified () -> Type\n\
+ { "unqualified", typy_unqualified, METH_NOARGS,
+ "unqualified () -> Type\n\
Return a variant of this type without const or volatile attributes." },
- { "values", typy_values, METH_NOARGS,
- "values () -> list\n\
+ { "values", typy_values, METH_NOARGS, "values () -> list\n\
Return a list holding all the fields of this type.\n\
Each field is a gdb.Field object." },
- { "volatile", typy_volatile, METH_NOARGS,
- "volatile () -> Type\n\
+ { "volatile", typy_volatile, METH_NOARGS, "volatile () -> Type\n\
Return a volatile variant of this type" },
- { NULL }
-};
+ { NULL } };
static PyNumberMethods type_object_as_number = {
- NULL, /* nb_add */
- NULL, /* nb_subtract */
- NULL, /* nb_multiply */
- NULL, /* nb_remainder */
- NULL, /* nb_divmod */
- NULL, /* nb_power */
- NULL, /* nb_negative */
- NULL, /* nb_positive */
- NULL, /* nb_absolute */
- typy_nonzero, /* nb_nonzero */
- NULL, /* nb_invert */
- NULL, /* nb_lshift */
- NULL, /* nb_rshift */
- NULL, /* nb_and */
- NULL, /* nb_xor */
- NULL, /* nb_or */
- NULL, /* nb_int */
- NULL, /* reserved */
- NULL, /* nb_float */
+ NULL, /* nb_add */
+ NULL, /* nb_subtract */
+ NULL, /* nb_multiply */
+ NULL, /* nb_remainder */
+ NULL, /* nb_divmod */
+ NULL, /* nb_power */
+ NULL, /* nb_negative */
+ NULL, /* nb_positive */
+ NULL, /* nb_absolute */
+ typy_nonzero, /* nb_nonzero */
+ NULL, /* nb_invert */
+ NULL, /* nb_lshift */
+ NULL, /* nb_rshift */
+ NULL, /* nb_and */
+ NULL, /* nb_xor */
+ NULL, /* nb_or */
+ NULL, /* nb_int */
+ NULL, /* reserved */
+ NULL, /* nb_float */
};
static PyMappingMethods typy_mapping = {
- typy_length,
- typy_getitem,
- NULL /* no "set" method */
+ typy_length, typy_getitem, NULL /* no "set" method */
};
-PyTypeObject type_object_type =
-{
- PyVarObject_HEAD_INIT (NULL, 0)
- "gdb.Type", /*tp_name*/
- sizeof (type_object), /*tp_basicsize*/
- 0, /*tp_itemsize*/
- typy_dealloc, /*tp_dealloc*/
- 0, /*tp_print*/
- 0, /*tp_getattr*/
- 0, /*tp_setattr*/
- 0, /*tp_compare*/
- 0, /*tp_repr*/
- &type_object_as_number, /*tp_as_number*/
- 0, /*tp_as_sequence*/
- &typy_mapping, /*tp_as_mapping*/
- 0, /*tp_hash */
- 0, /*tp_call*/
- typy_str, /*tp_str*/
- 0, /*tp_getattro*/
- 0, /*tp_setattro*/
- 0, /*tp_as_buffer*/
- Py_TPFLAGS_DEFAULT, /*tp_flags*/
- "GDB type object", /* tp_doc */
- 0, /* tp_traverse */
- 0, /* tp_clear */
- typy_richcompare, /* tp_richcompare */
- 0, /* tp_weaklistoffset */
- typy_iter, /* tp_iter */
- 0, /* tp_iternext */
- type_object_methods, /* tp_methods */
- 0, /* tp_members */
- type_object_getset, /* tp_getset */
- 0, /* tp_base */
- 0, /* tp_dict */
- 0, /* tp_descr_get */
- 0, /* tp_descr_set */
- 0, /* tp_dictoffset */
- 0, /* tp_init */
- 0, /* tp_alloc */
- 0, /* tp_new */
+PyTypeObject type_object_type = {
+ PyVarObject_HEAD_INIT (NULL, 0) "gdb.Type", /*tp_name*/
+ sizeof (type_object), /*tp_basicsize*/
+ 0, /*tp_itemsize*/
+ typy_dealloc, /*tp_dealloc*/
+ 0, /*tp_print*/
+ 0, /*tp_getattr*/
+ 0, /*tp_setattr*/
+ 0, /*tp_compare*/
+ 0, /*tp_repr*/
+ &type_object_as_number, /*tp_as_number*/
+ 0, /*tp_as_sequence*/
+ &typy_mapping, /*tp_as_mapping*/
+ 0, /*tp_hash */
+ 0, /*tp_call*/
+ typy_str, /*tp_str*/
+ 0, /*tp_getattro*/
+ 0, /*tp_setattro*/
+ 0, /*tp_as_buffer*/
+ Py_TPFLAGS_DEFAULT, /*tp_flags*/
+ "GDB type object", /* tp_doc */
+ 0, /* tp_traverse */
+ 0, /* tp_clear */
+ typy_richcompare, /* tp_richcompare */
+ 0, /* tp_weaklistoffset */
+ typy_iter, /* tp_iter */
+ 0, /* tp_iternext */
+ type_object_methods, /* tp_methods */
+ 0, /* tp_members */
+ type_object_getset, /* tp_getset */
+ 0, /* tp_base */
+ 0, /* tp_dict */
+ 0, /* tp_descr_get */
+ 0, /* tp_descr_set */
+ 0, /* tp_dictoffset */
+ 0, /* tp_init */
+ 0, /* tp_alloc */
+ 0, /* tp_new */
};
-static gdb_PyGetSetDef field_object_getset[] =
-{
- { "__dict__", gdb_py_generic_dict, NULL,
- "The __dict__ for this field.", &field_object_type },
- { NULL }
-};
-
-PyTypeObject field_object_type =
-{
- PyVarObject_HEAD_INIT (NULL, 0)
- "gdb.Field", /*tp_name*/
- sizeof (field_object), /*tp_basicsize*/
- 0, /*tp_itemsize*/
- field_dealloc, /*tp_dealloc*/
- 0, /*tp_print*/
- 0, /*tp_getattr*/
- 0, /*tp_setattr*/
- 0, /*tp_compare*/
- 0, /*tp_repr*/
- 0, /*tp_as_number*/
- 0, /*tp_as_sequence*/
- 0, /*tp_as_mapping*/
- 0, /*tp_hash */
- 0, /*tp_call*/
- 0, /*tp_str*/
- 0, /*tp_getattro*/
- 0, /*tp_setattro*/
- 0, /*tp_as_buffer*/
- Py_TPFLAGS_DEFAULT, /*tp_flags*/
- "GDB field object", /* tp_doc */
- 0, /* tp_traverse */
- 0, /* tp_clear */
- 0, /* tp_richcompare */
- 0, /* tp_weaklistoffset */
- 0, /* tp_iter */
- 0, /* tp_iternext */
- 0, /* tp_methods */
- 0, /* tp_members */
- field_object_getset, /* tp_getset */
- 0, /* tp_base */
- 0, /* tp_dict */
- 0, /* tp_descr_get */
- 0, /* tp_descr_set */
- offsetof (field_object, dict), /* tp_dictoffset */
- 0, /* tp_init */
- 0, /* tp_alloc */
- 0, /* tp_new */
+static gdb_PyGetSetDef field_object_getset[]
+ = { { "__dict__", gdb_py_generic_dict, NULL, "The __dict__ for this field.",
+ &field_object_type },
+ { NULL } };
+
+PyTypeObject field_object_type = {
+ PyVarObject_HEAD_INIT (NULL, 0) "gdb.Field", /*tp_name*/
+ sizeof (field_object), /*tp_basicsize*/
+ 0, /*tp_itemsize*/
+ field_dealloc, /*tp_dealloc*/
+ 0, /*tp_print*/
+ 0, /*tp_getattr*/
+ 0, /*tp_setattr*/
+ 0, /*tp_compare*/
+ 0, /*tp_repr*/
+ 0, /*tp_as_number*/
+ 0, /*tp_as_sequence*/
+ 0, /*tp_as_mapping*/
+ 0, /*tp_hash */
+ 0, /*tp_call*/
+ 0, /*tp_str*/
+ 0, /*tp_getattro*/
+ 0, /*tp_setattro*/
+ 0, /*tp_as_buffer*/
+ Py_TPFLAGS_DEFAULT, /*tp_flags*/
+ "GDB field object", /* tp_doc */
+ 0, /* tp_traverse */
+ 0, /* tp_clear */
+ 0, /* tp_richcompare */
+ 0, /* tp_weaklistoffset */
+ 0, /* tp_iter */
+ 0, /* tp_iternext */
+ 0, /* tp_methods */
+ 0, /* tp_members */
+ field_object_getset, /* tp_getset */
+ 0, /* tp_base */
+ 0, /* tp_dict */
+ 0, /* tp_descr_get */
+ 0, /* tp_descr_set */
+ offsetof (field_object, dict), /* tp_dictoffset */
+ 0, /* tp_init */
+ 0, /* tp_alloc */
+ 0, /* tp_new */
};
PyTypeObject type_iterator_object_type = {
- PyVarObject_HEAD_INIT (NULL, 0)
- "gdb.TypeIterator", /*tp_name*/
- sizeof (typy_iterator_object), /*tp_basicsize*/
- 0, /*tp_itemsize*/
- typy_iterator_dealloc, /*tp_dealloc*/
- 0, /*tp_print*/
- 0, /*tp_getattr*/
- 0, /*tp_setattr*/
- 0, /*tp_compare*/
- 0, /*tp_repr*/
- 0, /*tp_as_number*/
- 0, /*tp_as_sequence*/
- 0, /*tp_as_mapping*/
- 0, /*tp_hash */
- 0, /*tp_call*/
- 0, /*tp_str*/
- 0, /*tp_getattro*/
- 0, /*tp_setattro*/
- 0, /*tp_as_buffer*/
- Py_TPFLAGS_DEFAULT, /*tp_flags*/
- "GDB type iterator object", /*tp_doc */
- 0, /*tp_traverse */
- 0, /*tp_clear */
- 0, /*tp_richcompare */
- 0, /*tp_weaklistoffset */
- typy_iterator_iter, /*tp_iter */
- typy_iterator_iternext, /*tp_iternext */
- 0 /*tp_methods */
+ PyVarObject_HEAD_INIT (NULL, 0) "gdb.TypeIterator", /*tp_name*/
+ sizeof (typy_iterator_object), /*tp_basicsize*/
+ 0, /*tp_itemsize*/
+ typy_iterator_dealloc, /*tp_dealloc*/
+ 0, /*tp_print*/
+ 0, /*tp_getattr*/
+ 0, /*tp_setattr*/
+ 0, /*tp_compare*/
+ 0, /*tp_repr*/
+ 0, /*tp_as_number*/
+ 0, /*tp_as_sequence*/
+ 0, /*tp_as_mapping*/
+ 0, /*tp_hash */
+ 0, /*tp_call*/
+ 0, /*tp_str*/
+ 0, /*tp_getattro*/
+ 0, /*tp_setattro*/
+ 0, /*tp_as_buffer*/
+ Py_TPFLAGS_DEFAULT, /*tp_flags*/
+ "GDB type iterator object", /*tp_doc */
+ 0, /*tp_traverse */
+ 0, /*tp_clear */
+ 0, /*tp_richcompare */
+ 0, /*tp_weaklistoffset */
+ typy_iterator_iter, /*tp_iter */
+ typy_iterator_iternext, /*tp_iternext */
+ 0 /*tp_methods */
};
diff --git a/gdb/python/py-unwind.c b/gdb/python/py-unwind.c
index e7ec660e150..e4578a96f4a 100644
--- a/gdb/python/py-unwind.c
+++ b/gdb/python/py-unwind.c
@@ -39,7 +39,7 @@ static void
show_pyuw_debug (struct ui_file *file, int from_tty,
struct cmd_list_element *c, const char *value)
{
- gdb_printf (file, _("Python unwinder debugging is %s.\n"), value);
+ gdb_printf (file, _ ("Python unwinder debugging is %s.\n"), value);
}
/* Print a "py-unwind" debug statement. */
@@ -56,8 +56,8 @@ struct pending_frame_object
{
PyObject_HEAD
- /* Frame we are unwinding. */
- frame_info_ptr frame_info;
+ /* Frame we are unwinding. */
+ frame_info_ptr frame_info;
/* Its architecture, passed by the sniffer caller. */
struct gdbarch *gdbarch;
@@ -84,8 +84,8 @@ struct unwind_info_object
{
PyObject_HEAD
- /* gdb.PendingFrame for the frame we are unwinding. */
- PyObject *pending_frame;
+ /* gdb.PendingFrame for the frame we are unwinding. */
+ PyObject *pending_frame;
/* Its ID. */
struct frame_id frame_id;
@@ -112,10 +112,10 @@ struct cached_frame_info
};
extern PyTypeObject pending_frame_object_type
- CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF ("pending_frame_object");
+ CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF ("pending_frame_object");
extern PyTypeObject unwind_info_object_type
- CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF ("unwind_info_object");
+ CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF ("unwind_info_object");
/* Convert gdb.Value instance to inferior's pointer. Return 1 on success,
0 on failure. */
@@ -163,9 +163,9 @@ pyuw_object_attribute_to_pointer (PyObject *pyo, const char *attr_name,
rc = pyuw_value_obj_to_pointer (pyo_value.get (), addr);
if (!rc)
PyErr_Format (
- PyExc_ValueError,
- _("The value of the '%s' attribute is not a pointer."),
- attr_name);
+ PyExc_ValueError,
+ _ ("The value of the '%s' attribute is not a pointer."),
+ attr_name);
}
}
return rc;
@@ -218,11 +218,10 @@ unwind_infopy_str (PyObject *self)
Sets Python error and returns NULL on error. */
static PyObject *
-pyuw_create_unwind_info (PyObject *pyo_pending_frame,
- struct frame_id frame_id)
+pyuw_create_unwind_info (PyObject *pyo_pending_frame, struct frame_id frame_id)
{
unwind_info_object *unwind_info
- = PyObject_New (unwind_info_object, &unwind_info_object_type);
+ = PyObject_New (unwind_info_object, &unwind_info_object_type);
if (((pending_frame_object *) pyo_pending_frame)->frame_info == NULL)
{
@@ -245,7 +244,7 @@ unwind_infopy_add_saved_register (PyObject *self, PyObject *args)
{
unwind_info_object *unwind_info = (unwind_info_object *) self;
pending_frame_object *pending_frame
- = (pending_frame_object *) (unwind_info->pending_frame);
+ = (pending_frame_object *) (unwind_info->pending_frame);
PyObject *pyo_reg_id;
PyObject *pyo_reg_value;
int regnum;
@@ -256,8 +255,8 @@ unwind_infopy_add_saved_register (PyObject *self, PyObject *args)
"UnwindInfo instance refers to a stale PendingFrame");
return NULL;
}
- if (!PyArg_UnpackTuple (args, "previous_frame_register", 2, 2,
- &pyo_reg_id, &pyo_reg_value))
+ if (!PyArg_UnpackTuple (args, "previous_frame_register", 2, 2, &pyo_reg_id,
+ &pyo_reg_value))
return NULL;
if (!gdbpy_parse_register_id (pending_frame->gdbarch, pyo_reg_id, &regnum))
return nullptr;
@@ -286,7 +285,7 @@ unwind_infopy_add_saved_register (PyObject *self, PyObject *args)
size_t data_size;
if (pyo_reg_value == NULL
- || (value = value_object_to_value (pyo_reg_value)) == NULL)
+ || (value = value_object_to_value (pyo_reg_value)) == NULL)
{
PyErr_SetString (PyExc_ValueError, "Bad register value");
return NULL;
@@ -294,12 +293,11 @@ unwind_infopy_add_saved_register (PyObject *self, PyObject *args)
data_size = register_size (pending_frame->gdbarch, regnum);
if (data_size != value_type (value)->length ())
{
- PyErr_Format (
- PyExc_ValueError,
- "The value of the register returned by the Python "
- "sniffer has unexpected size: %u instead of %u.",
- (unsigned) value_type (value)->length (),
- (unsigned) data_size);
+ PyErr_Format (PyExc_ValueError,
+ "The value of the register returned by the Python "
+ "sniffer has unexpected size: %u instead of %u.",
+ (unsigned) value_type (value)->length (),
+ (unsigned) data_size);
return NULL;
}
}
@@ -389,8 +387,7 @@ pending_framepy_read_register (PyObject *self, PyObject *args)
handle the user register case. */
val = value_of_register (regnum, pending_frame->frame_info);
if (val == NULL)
- PyErr_Format (PyExc_ValueError,
- "Cannot read register %d from frame.",
+ PyErr_Format (PyExc_ValueError, "Cannot read register %d from frame.",
regnum);
}
catch (const gdb_exception &except)
@@ -413,11 +410,11 @@ pending_framepy_create_unwind_info (PyObject *self, PyObject *args)
CORE_ADDR special;
if (!PyArg_ParseTuple (args, "O:create_unwind_info", &pyo_frame_id))
- return NULL;
+ return NULL;
if (!pyuw_object_attribute_to_pointer (pyo_frame_id, "sp", &sp))
{
PyErr_SetString (PyExc_ValueError,
- _("frame_id should have 'sp' attribute."));
+ _ ("frame_id should have 'sp' attribute."));
return NULL;
}
@@ -464,8 +461,9 @@ pending_framepy_level (PyObject *self, PyObject *args)
if (pending_frame->frame_info == NULL)
{
- PyErr_SetString (PyExc_ValueError,
- "Attempting to read stack level from stale PendingFrame");
+ PyErr_SetString (
+ PyExc_ValueError,
+ "Attempting to read stack level from stale PendingFrame");
return NULL;
}
int level = frame_relative_level (pending_frame->frame_info);
@@ -485,8 +483,7 @@ pyuw_this_id (frame_info_ptr this_frame, void **cache_ptr,
/* frame_unwind.prev_register. */
static struct value *
-pyuw_prev_register (frame_info_ptr this_frame, void **cache_ptr,
- int regnum)
+pyuw_prev_register (frame_info_ptr this_frame, void **cache_ptr, int regnum)
{
PYUW_SCOPED_DEBUG_ENTER_EXIT;
@@ -494,8 +491,8 @@ pyuw_prev_register (frame_info_ptr this_frame, void **cache_ptr,
cached_reg_t *reg_info = cached_frame->reg;
cached_reg_t *reg_info_end = reg_info + cached_frame->reg_count;
- pyuw_debug_printf ("frame=%d, reg=%d",
- frame_relative_level (this_frame), regnum);
+ pyuw_debug_printf ("frame=%d, reg=%d", frame_relative_level (this_frame),
+ regnum);
for (; reg_info < reg_info_end; ++reg_info)
{
if (regnum == reg_info->num)
@@ -524,8 +521,8 @@ pyuw_sniffer (const struct frame_unwind *self, frame_info_ptr this_frame,
paddress (gdbarch, get_frame_pc (this_frame)));
/* Create PendingFrame instance to pass to sniffers. */
- pending_frame_object *pfo = PyObject_New (pending_frame_object,
- &pending_frame_object_type);
+ pending_frame_object *pfo
+ = PyObject_New (pending_frame_object, &pending_frame_object_type);
gdbpy_ref<> pyo_pending_frame ((PyObject *) pfo);
if (pyo_pending_frame == NULL)
{
@@ -533,12 +530,12 @@ pyuw_sniffer (const struct frame_unwind *self, frame_info_ptr this_frame,
return 0;
}
pfo->gdbarch = gdbarch;
- scoped_restore invalidate_frame = make_scoped_restore (&pfo->frame_info,
- this_frame);
+ scoped_restore invalidate_frame
+ = make_scoped_restore (&pfo->frame_info, this_frame);
/* Run unwinders. */
if (gdb_python_module == NULL
- || ! PyObject_HasAttrString (gdb_python_module, "_execute_unwinders"))
+ || !PyObject_HasAttrString (gdb_python_module, "_execute_unwinders"))
{
PyErr_SetString (PyExc_NameError,
"Installation error: gdb._execute_unwinders function "
@@ -555,9 +552,8 @@ pyuw_sniffer (const struct frame_unwind *self, frame_info_ptr this_frame,
}
/* A (gdb.UnwindInfo, str) tuple, or None. */
- gdbpy_ref<> pyo_execute_ret
- (PyObject_CallFunctionObjArgs (pyo_execute.get (),
- pyo_pending_frame.get (), NULL));
+ gdbpy_ref<> pyo_execute_ret (PyObject_CallFunctionObjArgs (
+ pyo_execute.get (), pyo_pending_frame.get (), NULL));
if (pyo_execute_ret == nullptr)
{
/* If the unwinder is cancelled due to a Ctrl-C, then propagate
@@ -574,7 +570,8 @@ pyuw_sniffer (const struct frame_unwind *self, frame_info_ptr this_frame,
if (pyuw_debug)
{
- PyObject *pyo_unwinder_name = PyTuple_GET_ITEM (pyo_execute_ret.get (), 1);
+ PyObject *pyo_unwinder_name
+ = PyTuple_GET_ITEM (pyo_execute_ret.get (), 1);
gdb::unique_xmalloc_ptr<char> name
= python_string_to_host_string (pyo_unwinder_name);
@@ -592,18 +589,16 @@ pyuw_sniffer (const struct frame_unwind *self, frame_info_ptr this_frame,
/* Received UnwindInfo, cache data. */
PyObject *pyo_unwind_info = PyTuple_GET_ITEM (pyo_execute_ret.get (), 0);
if (PyObject_IsInstance (pyo_unwind_info,
- (PyObject *) &unwind_info_object_type) <= 0)
- error (_("A Unwinder should return gdb.UnwindInfo instance."));
+ (PyObject *) &unwind_info_object_type)
+ <= 0)
+ error (_ ("A Unwinder should return gdb.UnwindInfo instance."));
{
- unwind_info_object *unwind_info =
- (unwind_info_object *) pyo_unwind_info;
+ unwind_info_object *unwind_info = (unwind_info_object *) pyo_unwind_info;
int reg_count = unwind_info->saved_regs->size ();
- cached_frame
- = ((cached_frame_info *)
- xmalloc (sizeof (*cached_frame)
- + reg_count * sizeof (cached_frame->reg[0])));
+ cached_frame = ((cached_frame_info *) xmalloc (
+ sizeof (*cached_frame) + reg_count * sizeof (cached_frame->reg[0])));
cached_frame->gdbarch = gdbarch;
cached_frame->frame_id = unwind_info->frame_id;
cached_frame->reg_count = reg_count;
@@ -623,8 +618,8 @@ pyuw_sniffer (const struct frame_unwind *self, frame_info_ptr this_frame,
gdb_assert (data_size == value_type (value)->length ());
cached_frame->reg[i].data = (gdb_byte *) xmalloc (data_size);
- memcpy (cached_frame->reg[i].data,
- value_contents (value).data (), data_size);
+ memcpy (cached_frame->reg[i].data, value_contents (value).data (),
+ data_size);
}
}
@@ -662,12 +657,12 @@ pyuw_on_new_gdbarch (struct gdbarch *newarch)
{
struct pyuw_gdbarch_data_type *data = pyuw_gdbarch_data.get (newarch);
if (data == nullptr)
- data= pyuw_gdbarch_data.emplace (newarch);
+ data = pyuw_gdbarch_data.emplace (newarch);
if (!data->unwinder_registered)
{
struct frame_unwind *unwinder
- = GDBARCH_OBSTACK_ZALLOC (newarch, struct frame_unwind);
+ = GDBARCH_OBSTACK_ZALLOC (newarch, struct frame_unwind);
unwinder->name = "python";
unwinder->type = NORMAL_FRAME;
@@ -683,17 +678,16 @@ pyuw_on_new_gdbarch (struct gdbarch *newarch)
}
void _initialize_py_unwind ();
+
void
_initialize_py_unwind ()
{
- add_setshow_boolean_cmd
- ("py-unwind", class_maintenance, &pyuw_debug,
- _("Set Python unwinder debugging."),
- _("Show Python unwinder debugging."),
- _("When on, Python unwinder debugging is enabled."),
- NULL,
- show_pyuw_debug,
- &setdebuglist, &showdebuglist);
+ add_setshow_boolean_cmd (
+ "py-unwind", class_maintenance, &pyuw_debug,
+ _ ("Set Python unwinder debugging."),
+ _ ("Show Python unwinder debugging."),
+ _ ("When on, Python unwinder debugging is enabled."), NULL,
+ show_pyuw_debug, &setdebuglist, &showdebuglist);
}
/* Initialize unwind machinery. */
@@ -714,115 +708,106 @@ gdbpy_initialize_unwind (void)
if (PyType_Ready (&unwind_info_object_type) < 0)
return -1;
return gdb_pymodule_addobject (gdb_module, "UnwindInfo",
- (PyObject *) &unwind_info_object_type);
+ (PyObject *) &unwind_info_object_type);
}
-static PyMethodDef pending_frame_object_methods[] =
-{
+static PyMethodDef pending_frame_object_methods[] = {
{ "read_register", pending_framepy_read_register, METH_VARARGS,
"read_register (REG) -> gdb.Value\n"
"Return the value of the REG in the frame." },
- { "create_unwind_info",
- pending_framepy_create_unwind_info, METH_VARARGS,
+ { "create_unwind_info", pending_framepy_create_unwind_info, METH_VARARGS,
"create_unwind_info (FRAME_ID) -> gdb.UnwindInfo\n"
"Construct UnwindInfo for this PendingFrame, using FRAME_ID\n"
"to identify it." },
- { "architecture",
- pending_framepy_architecture, METH_NOARGS,
+ { "architecture", pending_framepy_architecture, METH_NOARGS,
"architecture () -> gdb.Architecture\n"
"The architecture for this PendingFrame." },
{ "level", pending_framepy_level, METH_NOARGS,
"The stack level of this frame." },
- {NULL} /* Sentinel */
+ { NULL } /* Sentinel */
};
-PyTypeObject pending_frame_object_type =
-{
- PyVarObject_HEAD_INIT (NULL, 0)
- "gdb.PendingFrame", /* tp_name */
- sizeof (pending_frame_object), /* tp_basicsize */
- 0, /* tp_itemsize */
- 0, /* tp_dealloc */
- 0, /* tp_print */
- 0, /* tp_getattr */
- 0, /* tp_setattr */
- 0, /* tp_compare */
- 0, /* tp_repr */
- 0, /* tp_as_number */
- 0, /* tp_as_sequence */
- 0, /* tp_as_mapping */
- 0, /* tp_hash */
- 0, /* tp_call */
- pending_framepy_str, /* tp_str */
- 0, /* tp_getattro */
- 0, /* tp_setattro */
- 0, /* tp_as_buffer */
- Py_TPFLAGS_DEFAULT, /* tp_flags */
- "GDB PendingFrame object", /* tp_doc */
- 0, /* tp_traverse */
- 0, /* tp_clear */
- 0, /* tp_richcompare */
- 0, /* tp_weaklistoffset */
- 0, /* tp_iter */
- 0, /* tp_iternext */
- pending_frame_object_methods, /* tp_methods */
- 0, /* tp_members */
- 0, /* tp_getset */
- 0, /* tp_base */
- 0, /* tp_dict */
- 0, /* tp_descr_get */
- 0, /* tp_descr_set */
- 0, /* tp_dictoffset */
- 0, /* tp_init */
- 0, /* tp_alloc */
+PyTypeObject pending_frame_object_type = {
+ PyVarObject_HEAD_INIT (NULL, 0) "gdb.PendingFrame", /* tp_name */
+ sizeof (pending_frame_object), /* tp_basicsize */
+ 0, /* tp_itemsize */
+ 0, /* tp_dealloc */
+ 0, /* tp_print */
+ 0, /* tp_getattr */
+ 0, /* tp_setattr */
+ 0, /* tp_compare */
+ 0, /* tp_repr */
+ 0, /* tp_as_number */
+ 0, /* tp_as_sequence */
+ 0, /* tp_as_mapping */
+ 0, /* tp_hash */
+ 0, /* tp_call */
+ pending_framepy_str, /* tp_str */
+ 0, /* tp_getattro */
+ 0, /* tp_setattro */
+ 0, /* tp_as_buffer */
+ Py_TPFLAGS_DEFAULT, /* tp_flags */
+ "GDB PendingFrame object", /* tp_doc */
+ 0, /* tp_traverse */
+ 0, /* tp_clear */
+ 0, /* tp_richcompare */
+ 0, /* tp_weaklistoffset */
+ 0, /* tp_iter */
+ 0, /* tp_iternext */
+ pending_frame_object_methods, /* tp_methods */
+ 0, /* tp_members */
+ 0, /* tp_getset */
+ 0, /* tp_base */
+ 0, /* tp_dict */
+ 0, /* tp_descr_get */
+ 0, /* tp_descr_set */
+ 0, /* tp_dictoffset */
+ 0, /* tp_init */
+ 0, /* tp_alloc */
};
-static PyMethodDef unwind_info_object_methods[] =
-{
- { "add_saved_register",
- unwind_infopy_add_saved_register, METH_VARARGS,
+static PyMethodDef unwind_info_object_methods[] = {
+ { "add_saved_register", unwind_infopy_add_saved_register, METH_VARARGS,
"add_saved_register (REG, VALUE) -> None\n"
"Set the value of the REG in the previous frame to VALUE." },
- { NULL } /* Sentinel */
+ { NULL } /* Sentinel */
};
-PyTypeObject unwind_info_object_type =
-{
- PyVarObject_HEAD_INIT (NULL, 0)
- "gdb.UnwindInfo", /* tp_name */
- sizeof (unwind_info_object), /* tp_basicsize */
- 0, /* tp_itemsize */
- unwind_infopy_dealloc, /* tp_dealloc */
- 0, /* tp_print */
- 0, /* tp_getattr */
- 0, /* tp_setattr */
- 0, /* tp_compare */
- 0, /* tp_repr */
- 0, /* tp_as_number */
- 0, /* tp_as_sequence */
- 0, /* tp_as_mapping */
- 0, /* tp_hash */
- 0, /* tp_call */
- unwind_infopy_str, /* tp_str */
- 0, /* tp_getattro */
- 0, /* tp_setattro */
- 0, /* tp_as_buffer */
- Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */
- "GDB UnwindInfo object", /* tp_doc */
- 0, /* tp_traverse */
- 0, /* tp_clear */
- 0, /* tp_richcompare */
- 0, /* tp_weaklistoffset */
- 0, /* tp_iter */
- 0, /* tp_iternext */
- unwind_info_object_methods, /* tp_methods */
- 0, /* tp_members */
- 0, /* tp_getset */
- 0, /* tp_base */
- 0, /* tp_dict */
- 0, /* tp_descr_get */
- 0, /* tp_descr_set */
- 0, /* tp_dictoffset */
- 0, /* tp_init */
- 0, /* tp_alloc */
+PyTypeObject unwind_info_object_type = {
+ PyVarObject_HEAD_INIT (NULL, 0) "gdb.UnwindInfo", /* tp_name */
+ sizeof (unwind_info_object), /* tp_basicsize */
+ 0, /* tp_itemsize */
+ unwind_infopy_dealloc, /* tp_dealloc */
+ 0, /* tp_print */
+ 0, /* tp_getattr */
+ 0, /* tp_setattr */
+ 0, /* tp_compare */
+ 0, /* tp_repr */
+ 0, /* tp_as_number */
+ 0, /* tp_as_sequence */
+ 0, /* tp_as_mapping */
+ 0, /* tp_hash */
+ 0, /* tp_call */
+ unwind_infopy_str, /* tp_str */
+ 0, /* tp_getattro */
+ 0, /* tp_setattro */
+ 0, /* tp_as_buffer */
+ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */
+ "GDB UnwindInfo object", /* tp_doc */
+ 0, /* tp_traverse */
+ 0, /* tp_clear */
+ 0, /* tp_richcompare */
+ 0, /* tp_weaklistoffset */
+ 0, /* tp_iter */
+ 0, /* tp_iternext */
+ unwind_info_object_methods, /* tp_methods */
+ 0, /* tp_members */
+ 0, /* tp_getset */
+ 0, /* tp_base */
+ 0, /* tp_dict */
+ 0, /* tp_descr_get */
+ 0, /* tp_descr_set */
+ 0, /* tp_dictoffset */
+ 0, /* tp_init */
+ 0, /* tp_alloc */
};
diff --git a/gdb/python/py-utils.c b/gdb/python/py-utils.c
index 624b90a827f..a65cf3cf54b 100644
--- a/gdb/python/py-utils.c
+++ b/gdb/python/py-utils.c
@@ -47,8 +47,7 @@ python_string_to_unicode (PyObject *obj)
}
else
{
- PyErr_SetString (PyExc_TypeError,
- _("Expected a string object."));
+ PyErr_SetString (PyExc_TypeError, _ ("Expected a string object."));
unicode_str = NULL;
}
@@ -67,8 +66,8 @@ unicode_to_encoded_string (PyObject *unicode_str, const char *charset)
if (string == NULL)
return NULL;
- return gdb::unique_xmalloc_ptr<char>
- (xstrdup (PyBytes_AsString (string.get ())));
+ return gdb::unique_xmalloc_ptr<char> (
+ xstrdup (PyBytes_AsString (string.get ())));
}
/* Returns a PyObject with the contents of the given unicode string
@@ -89,9 +88,8 @@ unicode_to_encoded_python_string (PyObject *unicode_str, const char *charset)
gdb::unique_xmalloc_ptr<char>
unicode_to_target_string (PyObject *unicode_str)
{
- return (unicode_to_encoded_string
- (unicode_str,
- target_charset (gdbpy_enter::get_gdbarch ())));
+ return (unicode_to_encoded_string (
+ unicode_str, target_charset (gdbpy_enter::get_gdbarch ())));
}
/* Returns a PyObject with the contents of the given unicode string
@@ -101,9 +99,8 @@ unicode_to_target_string (PyObject *unicode_str)
static gdbpy_ref<>
unicode_to_target_python_string (PyObject *unicode_str)
{
- return (unicode_to_encoded_python_string
- (unicode_str,
- target_charset (gdbpy_enter::get_gdbarch ())));
+ return (unicode_to_encoded_python_string (
+ unicode_str, target_charset (gdbpy_enter::get_gdbarch ())));
}
/* Converts a python string (8-bit or unicode) to a target string in
@@ -237,7 +234,6 @@ get_addr_from_python (PyObject *obj, CORE_ADDR *addr)
{
if (gdbpy_is_value_object (obj))
{
-
try
{
*addr = value_as_address (value_object_to_value (obj));
@@ -262,7 +258,7 @@ get_addr_from_python (PyObject *obj, CORE_ADDR *addr)
if (sizeof (val) > sizeof (CORE_ADDR) && ((CORE_ADDR) val) != val)
{
PyErr_SetString (PyExc_ValueError,
- _("Overflow converting to address."));
+ _ ("Overflow converting to address."));
return -1;
}
@@ -301,11 +297,9 @@ int
gdb_py_int_as_long (PyObject *obj, long *result)
{
*result = PyLong_AsLong (obj);
- return ! (*result == -1 && PyErr_Occurred ());
+ return !(*result == -1 && PyErr_Occurred ());
}
-
-
/* Generic implementation of the __dict__ attribute for objects that
have a dictionary. The CLOSURE argument should be the type object.
This only handles positive values for tp_dictoffset. */
@@ -318,7 +312,7 @@ gdb_py_generic_dict (PyObject *self, void *closure)
char *raw_ptr;
raw_ptr = (char *) self + type_obj->tp_dictoffset;
- result = * (PyObject **) raw_ptr;
+ result = *(PyObject **) raw_ptr;
Py_INCREF (result);
return result;
@@ -351,9 +345,9 @@ gdbpy_error (const char *fmt, ...)
const char *msg = str.c_str ();
if (msg != nullptr && *msg != '\0')
- error (_("Error occurred in Python: %s"), msg);
+ error (_ ("Error occurred in Python: %s"), msg);
else
- error (_("Error occurred in Python."));
+ error (_ ("Error occurred in Python."));
}
/* Handle a Python exception when the special gdb.GdbError treatment
@@ -372,9 +366,9 @@ gdbpy_handle_exception ()
{
/* An error occurred computing the string representation of the
error message. This is rare, but we should inform the user. */
- gdb_printf (_("An error occurred in Python "
- "and then another occurred computing the "
- "error message.\n"));
+ gdb_printf (_ ("An error occurred in Python "
+ "and then another occurred computing the "
+ "error message.\n"));
gdbpy_print_stack ();
}
@@ -387,15 +381,15 @@ gdbpy_handle_exception ()
if (fetched_error.type_matches (PyExc_KeyboardInterrupt))
throw_quit ("Quit");
- else if (! fetched_error.type_matches (gdbpy_gdberror_exc)
- || msg == NULL || *msg == '\0')
+ else if (!fetched_error.type_matches (gdbpy_gdberror_exc) || msg == NULL
+ || *msg == '\0')
{
fetched_error.restore ();
gdbpy_print_stack ();
if (msg != NULL && *msg != '\0')
- error (_("Error occurred in Python: %s"), msg.get ());
+ error (_ ("Error occurred in Python: %s"), msg.get ());
else
- error (_("Error occurred in Python."));
+ error (_ ("Error occurred in Python."));
}
else
error ("%s", msg.get ());
@@ -415,17 +409,17 @@ gdbpy_fix_doc_string_indentation (gdb::unique_xmalloc_ptr<char> doc)
line_whitespace (size_t offset, int ws_count)
: m_offset (offset),
m_ws_count (ws_count)
- { /* Nothing. */ }
+ { /* Nothing. */
+ }
/* The offset from the start of DOC. */
- size_t offset () const
- { return m_offset; }
+ size_t offset () const { return m_offset; }
/* The number of white-space characters at the start of this line. */
- int ws () const
- { return m_ws_count; }
+ int ws () const { return m_ws_count; }
private:
+
/* The offset from the start of DOC to the first character of this
line. */
size_t m_offset;
@@ -438,8 +432,7 @@ gdbpy_fix_doc_string_indentation (gdb::unique_xmalloc_ptr<char> doc)
/* Count the number of white-space character starting at TXT. We
currently only count true single space characters, things like tabs,
newlines, etc are not counted. */
- auto count_whitespace = [] (const char *txt) -> int
- {
+ auto count_whitespace = [] (const char *txt) -> int {
int count = 0;
while (*txt == ' ')
@@ -559,8 +552,8 @@ gdbpy_fix_doc_string_indentation (gdb::unique_xmalloc_ptr<char> doc)
|| src[src_offset + ws_info[ws_info_offset].ws ()] == '\0')
src_offset += ws_info[ws_info_offset].ws ();
else
- src_offset += std::min (*min_whitespace,
- ws_info[ws_info_offset].ws ());
+ src_offset
+ += std::min (*min_whitespace, ws_info[ws_info_offset].ws ());
/* If we skipped white-space, and are now at the end of the
input, then we're done. */
diff --git a/gdb/python/py-value.c b/gdb/python/py-value.c
index da2565081e6..1578df11ffe 100644
--- a/gdb/python/py-value.c
+++ b/gdb/python/py-value.c
@@ -47,8 +47,8 @@
builtin_type (gdbpy_enter::get_gdbarch ())->builtin_long_long
/* Python's long type corresponds to C's long long type. Unsigned version. */
-#define builtin_type_upylong builtin_type \
- (gdbpy_enter::get_gdbarch ())->builtin_unsigned_long_long
+#define builtin_type_upylong \
+ builtin_type (gdbpy_enter::get_gdbarch ())->builtin_unsigned_long_long
#define builtin_type_pybool \
language_bool_type (current_language, gdbpy_enter::get_gdbarch ())
@@ -56,9 +56,9 @@
#define builtin_type_pychar \
language_string_char_type (current_language, gdbpy_enter::get_gdbarch ())
-struct value_object {
- PyObject_HEAD
- struct value_object *next;
+struct value_object
+{
+ PyObject_HEAD struct value_object *next;
struct value_object *prev;
struct value *value;
PyObject *address;
@@ -144,7 +144,7 @@ convert_buffer_and_type_to_value (PyObject *obj, struct type *type)
Py_buffer_up buffer_up;
Py_buffer py_buf;
- if (PyObject_CheckBuffer (obj)
+ if (PyObject_CheckBuffer (obj)
&& PyObject_GetBuffer (obj, &py_buf, PyBUF_SIMPLE) == 0)
{
/* Got a buffer, py_buf, out of obj. Cause it to be released
@@ -154,14 +154,15 @@ convert_buffer_and_type_to_value (PyObject *obj, struct type *type)
else
{
PyErr_SetString (PyExc_TypeError,
- _("Object must support the python buffer protocol."));
+ _ ("Object must support the python buffer protocol."));
return nullptr;
}
if (type->length () > py_buf.len)
{
- PyErr_SetString (PyExc_ValueError,
- _("Size of type is larger than that of buffer object."));
+ PyErr_SetString (
+ PyExc_ValueError,
+ _ ("Size of type is larger than that of buffer object."));
return nullptr;
}
@@ -177,8 +178,8 @@ valpy_init (PyObject *self, PyObject *args, PyObject *kwds)
PyObject *val_obj = nullptr;
PyObject *type_obj = nullptr;
- if (!gdb_PyArg_ParseTupleAndKeywords (args, kwds, "O|O", keywords,
- &val_obj, &type_obj))
+ if (!gdb_PyArg_ParseTupleAndKeywords (args, kwds, "O|O", keywords, &val_obj,
+ &type_obj))
return -1;
struct type *type = nullptr;
@@ -188,7 +189,7 @@ valpy_init (PyObject *self, PyObject *args, PyObject *kwds)
if (type == nullptr)
{
PyErr_SetString (PyExc_TypeError,
- _("type argument must be a gdb.Type."));
+ _ ("type argument must be a gdb.Type."));
return -1;
}
}
@@ -282,8 +283,8 @@ valpy_referenced_value (PyObject *self, PyObject *args)
res_val = coerce_ref (self_val);
break;
default:
- error(_("Trying to get the referenced value from a value which is "
- "neither a pointer nor a reference."));
+ error (_ ("Trying to get the referenced value from a value which is "
+ "neither a pointer nor a reference."));
}
result = value_to_value_object (res_val);
@@ -490,13 +491,13 @@ valpy_lazy_string (PyObject *self, PyObject *args, PyObject *kw)
static const char *keywords[] = { "encoding", "length", NULL };
PyObject *str_obj = NULL;
- if (!gdb_PyArg_ParseTupleAndKeywords (args, kw, "|s" GDB_PY_LL_ARG,
- keywords, &user_encoding, &length))
+ if (!gdb_PyArg_ParseTupleAndKeywords (args, kw, "|s" GDB_PY_LL_ARG, keywords,
+ &user_encoding, &length))
return NULL;
if (length < -1)
{
- PyErr_SetString (PyExc_ValueError, _("Invalid length."));
+ PyErr_SetString (PyExc_ValueError, _ ("Invalid length."));
return NULL;
}
@@ -525,15 +526,15 @@ valpy_lazy_string (PyObject *self, PyObject *args, PyObject *kw)
length = array_length;
else if (array_length == -1)
{
- type = lookup_array_range_type (realtype->target_type (),
- 0, length - 1);
+ type = lookup_array_range_type (realtype->target_type (), 0,
+ length - 1);
}
else if (length != array_length)
{
/* We need to create a new array type with the
specified length. */
if (length > array_length)
- error (_("Length is larger than array size."));
+ error (_ ("Length is larger than array size."));
type = lookup_array_range_type (realtype->target_type (),
low_bound,
low_bound + length - 1);
@@ -552,8 +553,8 @@ valpy_lazy_string (PyObject *self, PyObject *args, PyObject *kw)
break;
}
- str_obj = gdbpy_create_lazy_string_object (addr, length, user_encoding,
- type);
+ str_obj
+ = gdbpy_create_lazy_string_object (addr, length, user_encoding, type);
}
catch (const gdb_exception &except)
{
@@ -597,8 +598,7 @@ valpy_string (PyObject *self, PyObject *args, PyObject *kw)
encoding = (user_encoding && *user_encoding) ? user_encoding : la_encoding;
return PyUnicode_Decode ((const char *) buffer.get (),
- length * char_type->length (),
- encoding, errors);
+ length * char_type->length (), encoding, errors);
}
/* Given a Python object, copy its truth value to a C bool (the value
@@ -629,31 +629,30 @@ copy_py_bool_obj (bool *dest, PyObject *src_obj)
static PyObject *
valpy_format_string (PyObject *self, PyObject *args, PyObject *kw)
{
- static const char *keywords[] =
- {
- /* Basic C/C++ options. */
- "raw", /* See the /r option to print. */
- "pretty_arrays", /* See set print array on|off. */
- "pretty_structs", /* See set print pretty on|off. */
- "array_indexes", /* See set print array-indexes on|off. */
- "symbols", /* See set print symbol on|off. */
- "unions", /* See set print union on|off. */
- "address", /* See set print address on|off. */
- "styling", /* Should we apply styling. */
- "nibbles", /* See set print nibbles on|off. */
- "summary", /* Summary mode for non-scalars. */
- /* C++ options. */
- "deref_refs", /* No corresponding setting. */
- "actual_objects", /* See set print object on|off. */
- "static_members", /* See set print static-members on|off. */
- /* C non-bool options. */
- "max_characters", /* See set print characters N. */
- "max_elements", /* See set print elements N. */
- "max_depth", /* See set print max-depth N. */
- "repeat_threshold", /* See set print repeats. */
- "format", /* The format passed to the print command. */
- NULL
- };
+ static const char *keywords[]
+ = { /* Basic C/C++ options. */
+ "raw", /* See the /r option to print. */
+ "pretty_arrays", /* See set print array on|off. */
+ "pretty_structs", /* See set print pretty on|off. */
+ "array_indexes", /* See set print array-indexes on|off. */
+ "symbols", /* See set print symbol on|off. */
+ "unions", /* See set print union on|off. */
+ "address", /* See set print address on|off. */
+ "styling", /* Should we apply styling. */
+ "nibbles", /* See set print nibbles on|off. */
+ "summary", /* Summary mode for non-scalars. */
+ /* C++ options. */
+ "deref_refs", /* No corresponding setting. */
+ "actual_objects", /* See set print object on|off. */
+ "static_members", /* See set print static-members on|off. */
+ /* C non-bool options. */
+ "max_characters", /* See set print characters N. */
+ "max_elements", /* See set print elements N. */
+ "max_depth", /* See set print max-depth N. */
+ "repeat_threshold", /* See set print repeats. */
+ "format", /* The format passed to the print command. */
+ NULL
+ };
/* This function has too many arguments to be useful as positionals, so
the user should specify them all as keyword arguments.
@@ -668,9 +667,10 @@ valpy_format_string (PyObject *self, PyObject *args, PyObject *kw)
/* This matches the error message that Python 3.3 raises when
passing positionals to functions expecting keyword-only
arguments. */
- PyErr_Format (PyExc_TypeError,
- "format_string() takes 0 positional arguments but %zu were given",
- positional_count);
+ PyErr_Format (
+ PyExc_TypeError,
+ "format_string() takes 0 positional arguments but %zu were given",
+ positional_count);
return NULL;
}
@@ -694,28 +694,16 @@ valpy_format_string (PyObject *self, PyObject *args, PyObject *kw)
PyObject *static_members_obj = NULL;
PyObject *summary_obj = NULL;
char *format = NULL;
- if (!gdb_PyArg_ParseTupleAndKeywords (args,
- kw,
- "|O!O!O!O!O!O!O!O!O!O!O!O!O!IIIIs",
- keywords,
- &PyBool_Type, &raw_obj,
- &PyBool_Type, &pretty_arrays_obj,
- &PyBool_Type, &pretty_structs_obj,
- &PyBool_Type, &array_indexes_obj,
- &PyBool_Type, &symbols_obj,
- &PyBool_Type, &unions_obj,
- &PyBool_Type, &address_obj,
- &PyBool_Type, &styling_obj,
- &PyBool_Type, &nibbles_obj,
- &PyBool_Type, &summary_obj,
- &PyBool_Type, &deref_refs_obj,
- &PyBool_Type, &actual_objects_obj,
- &PyBool_Type, &static_members_obj,
- &opts.print_max_chars,
- &opts.print_max,
- &opts.max_depth,
- &opts.repeat_count_threshold,
- &format))
+ if (!gdb_PyArg_ParseTupleAndKeywords (
+ args, kw, "|O!O!O!O!O!O!O!O!O!O!O!O!O!IIIIs", keywords, &PyBool_Type,
+ &raw_obj, &PyBool_Type, &pretty_arrays_obj, &PyBool_Type,
+ &pretty_structs_obj, &PyBool_Type, &array_indexes_obj, &PyBool_Type,
+ &symbols_obj, &PyBool_Type, &unions_obj, &PyBool_Type, &address_obj,
+ &PyBool_Type, &styling_obj, &PyBool_Type, &nibbles_obj, &PyBool_Type,
+ &summary_obj, &PyBool_Type, &deref_refs_obj, &PyBool_Type,
+ &actual_objects_obj, &PyBool_Type, &static_members_obj,
+ &opts.print_max_chars, &opts.print_max, &opts.max_depth,
+ &opts.repeat_count_threshold, &format))
return NULL;
/* Set boolean arguments. */
@@ -761,8 +749,7 @@ valpy_format_string (PyObject *self, PyObject *args, PyObject *kw)
{
/* Mimic the message on standard Python ones for similar
errors. */
- PyErr_SetString (PyExc_ValueError,
- "a single character is required");
+ PyErr_SetString (PyExc_ValueError, "a single character is required");
return NULL;
}
}
@@ -771,8 +758,8 @@ valpy_format_string (PyObject *self, PyObject *args, PyObject *kw)
try
{
- common_val_print (((value_object *) self)->value, &stb, 0,
- &opts, current_language);
+ common_val_print (((value_object *) self)->value, &stb, 0, &opts,
+ current_language);
}
catch (const gdb_exception &except)
{
@@ -790,14 +777,13 @@ valpy_do_cast (PyObject *self, PyObject *args, enum exp_opcode op)
PyObject *type_obj, *result = NULL;
struct type *type;
- if (! PyArg_ParseTuple (args, "O", &type_obj))
+ if (!PyArg_ParseTuple (args, "O", &type_obj))
return NULL;
type = type_object_to_type (type_obj);
- if (! type)
+ if (!type)
{
- PyErr_SetString (PyExc_RuntimeError,
- _("Argument must be a type."));
+ PyErr_SetString (PyExc_RuntimeError, _ ("Argument must be a type."));
return NULL;
}
@@ -856,7 +842,7 @@ valpy_length (PyObject *self)
{
/* We don't support getting the number of elements in a struct / class. */
PyErr_SetString (PyExc_NotImplementedError,
- _("Invalid operation on gdb.Value."));
+ _ ("Invalid operation on gdb.Value."));
return -1;
}
@@ -877,9 +863,10 @@ value_has_field (struct value *v, PyObject *field)
parent_type = type_object_to_type (type_object.get ());
if (parent_type == NULL)
{
- PyErr_SetString (PyExc_TypeError,
- _("'parent_type' attribute of gdb.Field object is not a"
- "gdb.Type object."));
+ PyErr_SetString (
+ PyExc_TypeError,
+ _ ("'parent_type' attribute of gdb.Field object is not a"
+ "gdb.Type object."));
return -1;
}
@@ -934,8 +921,8 @@ get_field_type (PyObject *field)
ftype = type_object_to_type (ftype_obj.get ());
if (ftype == NULL)
PyErr_SetString (PyExc_TypeError,
- _("'type' attribute of gdb.Field object is not a "
- "gdb.Type object."));
+ _ ("'type' attribute of gdb.Field object is not a "
+ "gdb.Type object."));
return ftype;
}
@@ -970,8 +957,8 @@ valpy_getitem (PyObject *self, PyObject *key)
else if (valid_field == 0)
{
PyErr_SetString (PyExc_TypeError,
- _("Invalid lookup for a field not contained in "
- "the value."));
+ _ ("Invalid lookup for a field not contained in "
+ "the value."));
return NULL;
}
@@ -1003,8 +990,8 @@ valpy_getitem (PyObject *self, PyObject *key)
if (!PyObject_HasAttrString (key, "bitpos"))
{
PyErr_SetString (PyExc_AttributeError,
- _("gdb.Field object has no name and no "
- "'bitpos' attribute."));
+ _ ("gdb.Field object has no name and no "
+ "'bitpos' attribute."));
return NULL;
}
@@ -1041,11 +1028,13 @@ valpy_getitem (PyObject *self, PyObject *key)
if (val_type->code () == TYPE_CODE_PTR)
res_val = value_cast (lookup_pointer_type (base_class_type), tmp);
else if (val_type->code () == TYPE_CODE_REF)
- res_val = value_cast (lookup_lvalue_reference_type (base_class_type),
- tmp);
+ res_val
+ = value_cast (lookup_lvalue_reference_type (base_class_type),
+ tmp);
else if (val_type->code () == TYPE_CODE_RVALUE_REF)
- res_val = value_cast (lookup_rvalue_reference_type (base_class_type),
- tmp);
+ res_val
+ = value_cast (lookup_rvalue_reference_type (base_class_type),
+ tmp);
else
res_val = value_cast (base_class_type, tmp);
}
@@ -1066,7 +1055,7 @@ valpy_getitem (PyObject *self, PyObject *key)
type = check_typedef (value_type (tmp));
if (type->code () != TYPE_CODE_ARRAY
&& type->code () != TYPE_CODE_PTR)
- error (_("Cannot subscript requested type."));
+ error (_ ("Cannot subscript requested type."));
else
res_val = value_subscript (tmp, value_as_long (idx));
}
@@ -1089,7 +1078,7 @@ static int
valpy_setitem (PyObject *self, PyObject *key, PyObject *value)
{
PyErr_Format (PyExc_NotImplementedError,
- _("Setting of struct elements is not currently supported."));
+ _ ("Setting of struct elements is not currently supported."));
return -1;
}
@@ -1116,14 +1105,14 @@ valpy_call (PyObject *self, PyObject *args, PyObject *keywords)
if (ftype->code () != TYPE_CODE_FUNC)
{
PyErr_SetString (PyExc_RuntimeError,
- _("Value is not callable (not TYPE_CODE_FUNC)."));
+ _ ("Value is not callable (not TYPE_CODE_FUNC)."));
return NULL;
}
- if (! PyTuple_Check (args))
+ if (!PyTuple_Check (args))
{
PyErr_SetString (PyExc_TypeError,
- _("Inferior arguments must be provided in a tuple."));
+ _ ("Inferior arguments must be provided in a tuple."));
return NULL;
}
@@ -1177,8 +1166,8 @@ valpy_str (PyObject *self)
try
{
- common_val_print (((value_object *) self)->value, &stb, 0,
- &opts, current_language);
+ common_val_print (((value_object *) self)->value, &stb, 0, &opts,
+ current_language);
}
catch (const gdb_exception &except)
{
@@ -1320,11 +1309,9 @@ valpy_binop_throw (enum valpy_opcode opcode, PyObject *self, PyObject *other)
rtype = STRIP_REFERENCE (rtype);
handled = 1;
- if (ltype->code () == TYPE_CODE_PTR
- && is_integral_type (rtype))
+ if (ltype->code () == TYPE_CODE_PTR && is_integral_type (rtype))
res_val = value_ptradd (arg1, value_as_long (arg2));
- else if (rtype->code () == TYPE_CODE_PTR
- && is_integral_type (ltype))
+ else if (rtype->code () == TYPE_CODE_PTR && is_integral_type (ltype))
res_val = value_ptradd (arg2, value_as_long (arg1));
else
{
@@ -1344,14 +1331,12 @@ valpy_binop_throw (enum valpy_opcode opcode, PyObject *self, PyObject *other)
rtype = STRIP_REFERENCE (rtype);
handled = 1;
- if (ltype->code () == TYPE_CODE_PTR
- && rtype->code () == TYPE_CODE_PTR)
+ if (ltype->code () == TYPE_CODE_PTR && rtype->code () == TYPE_CODE_PTR)
/* A ptrdiff_t for the target would be preferable here. */
res_val = value_from_longest (builtin_type_pyint,
value_ptrdiff (arg1, arg2));
- else if (ltype->code () == TYPE_CODE_PTR
- && is_integral_type (rtype))
- res_val = value_ptradd (arg1, - value_as_long (arg2));
+ else if (ltype->code () == TYPE_CODE_PTR && is_integral_type (rtype))
+ res_val = value_ptradd (arg1, -value_as_long (arg2));
else
{
handled = 0;
@@ -1536,8 +1521,9 @@ valpy_nonzero (PyObject *self)
if (is_integral_type (type) || type->code () == TYPE_CODE_PTR)
nonzero = !!value_as_long (self_value->value);
else if (is_floating_value (self_value->value))
- nonzero = !target_float_is_zero
- (value_contents (self_value->value).data (), type);
+ nonzero
+ = !target_float_is_zero (value_contents (self_value->value).data (),
+ type);
else
/* All other values are True. */
nonzero = 1;
@@ -1635,7 +1621,7 @@ valpy_richcompare_throw (PyObject *self, PyObject *other, int op)
break;
case Py_LE:
result = value_less (value_self, value_other)
- || value_equal (value_self, value_other);
+ || value_equal (value_self, value_other);
break;
case Py_EQ:
result = value_equal (value_self, value_other);
@@ -1653,7 +1639,7 @@ valpy_richcompare_throw (PyObject *self, PyObject *other, int op)
default:
/* Can't happen. */
PyErr_SetString (PyExc_NotImplementedError,
- _("Invalid operation on gdb.Value."));
+ _ ("Invalid operation on gdb.Value."));
result = -1;
break;
}
@@ -1661,7 +1647,6 @@ valpy_richcompare_throw (PyObject *self, PyObject *other, int op)
return result;
}
-
/* Implements comparison operations for value objects. Returns NULL on error,
with a python exception set. */
static PyObject *
@@ -1672,7 +1657,8 @@ valpy_richcompare (PyObject *self, PyObject *other, int op)
if (other == Py_None)
/* Comparing with None is special. From what I can tell, in Python
None is smaller than anything else. */
- switch (op) {
+ switch (op)
+ {
case Py_LT:
case Py_LE:
case Py_EQ:
@@ -1684,9 +1670,9 @@ valpy_richcompare (PyObject *self, PyObject *other, int op)
default:
/* Can't happen. */
PyErr_SetString (PyExc_NotImplementedError,
- _("Invalid operation on gdb.Value."));
+ _ ("Invalid operation on gdb.Value."));
return NULL;
- }
+ }
try
{
@@ -1725,9 +1711,8 @@ valpy_long (PyObject *self)
type = check_typedef (type);
- if (!is_integral_type (type)
- && type->code () != TYPE_CODE_PTR)
- error (_("Cannot convert value to long."));
+ if (!is_integral_type (type) && type->code () != TYPE_CODE_PTR)
+ error (_ ("Cannot convert value to long."));
l = value_as_long (value);
}
@@ -1764,7 +1749,7 @@ valpy_float (PyObject *self)
d = value_as_long (value);
}
else
- error (_("Cannot convert value to float."));
+ error (_ ("Cannot convert value to float."));
}
catch (const gdb_exception &except)
{
@@ -1826,7 +1811,7 @@ value_object_to_value (PyObject *self)
{
value_object *real;
- if (! PyObject_TypeCheck (self, &value_object_type))
+ if (!PyObject_TypeCheck (self, &value_object_type))
return NULL;
real = (value_object *) self;
return real->value;
@@ -1871,7 +1856,7 @@ convert_value_from_python (PyObject *obj)
ULONGEST ul;
ul = PyLong_AsUnsignedLongLong (obj);
- if (! PyErr_Occurred ())
+ if (!PyErr_Occurred ())
value = value_from_ulongest (builtin_type_upylong, ul);
}
else
@@ -1888,7 +1873,7 @@ convert_value_from_python (PyObject *obj)
{
double d = PyFloat_AsDouble (obj);
- if (! PyErr_Occurred ())
+ if (!PyErr_Occurred ())
value = value_from_host_double (builtin_type_pyfloat, d);
}
else if (gdbpy_is_string (obj))
@@ -1905,12 +1890,12 @@ convert_value_from_python (PyObject *obj)
{
PyObject *result;
- result = PyObject_CallMethodObjArgs (obj, gdbpy_value_cst, NULL);
+ result = PyObject_CallMethodObjArgs (obj, gdbpy_value_cst, NULL);
value = value_copy (((value_object *) result)->value);
}
else
PyErr_Format (PyExc_TypeError,
- _("Could not convert Python object: %S."), obj);
+ _ ("Could not convert Python object: %S."), obj);
}
catch (const gdb_exception &except)
{
@@ -1926,7 +1911,7 @@ PyObject *
gdbpy_history (PyObject *self, PyObject *args)
{
int i;
- struct value *res_val = NULL; /* Initialize to appease gcc warning. */
+ struct value *res_val = NULL; /* Initialize to appease gcc warning. */
if (!PyArg_ParseTuple (args, "i", &i))
return NULL;
@@ -2071,36 +2056,32 @@ gdbpy_initialize_values (void)
(PyObject *) &value_object_type);
}
-
-
static gdb_PyGetSetDef value_object_getset[] = {
- { "address", valpy_get_address, NULL, "The address of the value.",
- NULL },
+ { "address", valpy_get_address, NULL, "The address of the value.", NULL },
{ "is_optimized_out", valpy_get_is_optimized_out, NULL,
"Boolean telling whether the value is optimized "
"out (i.e., not available).",
NULL },
{ "type", valpy_get_type, NULL, "Type of the value.", NULL },
- { "dynamic_type", valpy_get_dynamic_type, NULL,
- "Dynamic type of the value.", NULL },
+ { "dynamic_type", valpy_get_dynamic_type, NULL, "Dynamic type of the value.",
+ NULL },
{ "is_lazy", valpy_get_is_lazy, NULL,
"Boolean telling whether the value is lazy (not fetched yet\n\
from the inferior). A lazy value is fetched when needed, or when\n\
-the \"fetch_lazy()\" method is called.", NULL },
- {NULL} /* Sentinel */
+the \"fetch_lazy()\" method is called.",
+ NULL },
+ { NULL } /* Sentinel */
};
static PyMethodDef value_object_methods[] = {
{ "cast", valpy_cast, METH_VARARGS, "Cast the value to the supplied type." },
{ "dynamic_cast", valpy_dynamic_cast, METH_VARARGS,
"dynamic_cast (gdb.Type) -> gdb.Value\n\
-Cast the value to the supplied type, as if by the C++ dynamic_cast operator."
- },
+Cast the value to the supplied type, as if by the C++ dynamic_cast operator." },
{ "reinterpret_cast", valpy_reinterpret_cast, METH_VARARGS,
"reinterpret_cast (gdb.Type) -> gdb.Value\n\
Cast the value to the supplied type, as if by the C++\n\
-reinterpret_cast operator."
- },
+reinterpret_cast operator." },
{ "dereference", valpy_dereference, METH_NOARGS, "Dereferences the value." },
{ "referenced_value", valpy_referenced_value, METH_NOARGS,
"Return the value referenced by a TYPE_CODE_REF or TYPE_CODE_PTR value." },
@@ -2120,94 +2101,86 @@ Return Unicode string representation of the value." },
{ "fetch_lazy", valpy_fetch_lazy, METH_NOARGS,
"Fetches the value from the inferior, if it was lazy." },
{ "format_string", (PyCFunction) valpy_format_string,
- METH_VARARGS | METH_KEYWORDS,
- "format_string (...) -> string\n\
+ METH_VARARGS | METH_KEYWORDS, "format_string (...) -> string\n\
Return a string representation of the value using the specified\n\
formatting options" },
- {NULL} /* Sentinel */
+ { NULL } /* Sentinel */
};
static PyNumberMethods value_object_as_number = {
- valpy_add,
- valpy_subtract,
- valpy_multiply,
- valpy_remainder,
- NULL, /* nb_divmod */
- valpy_power, /* nb_power */
- valpy_negative, /* nb_negative */
- valpy_positive, /* nb_positive */
- valpy_absolute, /* nb_absolute */
- valpy_nonzero, /* nb_nonzero */
- valpy_invert, /* nb_invert */
- valpy_lsh, /* nb_lshift */
- valpy_rsh, /* nb_rshift */
- valpy_and, /* nb_and */
- valpy_xor, /* nb_xor */
- valpy_or, /* nb_or */
- valpy_long, /* nb_int */
- NULL, /* reserved */
- valpy_float, /* nb_float */
- NULL, /* nb_inplace_add */
- NULL, /* nb_inplace_subtract */
- NULL, /* nb_inplace_multiply */
- NULL, /* nb_inplace_remainder */
- NULL, /* nb_inplace_power */
- NULL, /* nb_inplace_lshift */
- NULL, /* nb_inplace_rshift */
- NULL, /* nb_inplace_and */
- NULL, /* nb_inplace_xor */
- NULL, /* nb_inplace_or */
- NULL, /* nb_floor_divide */
- valpy_divide, /* nb_true_divide */
- NULL, /* nb_inplace_floor_divide */
- NULL, /* nb_inplace_true_divide */
- valpy_long, /* nb_index */
+ valpy_add, valpy_subtract, valpy_multiply, valpy_remainder,
+ NULL, /* nb_divmod */
+ valpy_power, /* nb_power */
+ valpy_negative, /* nb_negative */
+ valpy_positive, /* nb_positive */
+ valpy_absolute, /* nb_absolute */
+ valpy_nonzero, /* nb_nonzero */
+ valpy_invert, /* nb_invert */
+ valpy_lsh, /* nb_lshift */
+ valpy_rsh, /* nb_rshift */
+ valpy_and, /* nb_and */
+ valpy_xor, /* nb_xor */
+ valpy_or, /* nb_or */
+ valpy_long, /* nb_int */
+ NULL, /* reserved */
+ valpy_float, /* nb_float */
+ NULL, /* nb_inplace_add */
+ NULL, /* nb_inplace_subtract */
+ NULL, /* nb_inplace_multiply */
+ NULL, /* nb_inplace_remainder */
+ NULL, /* nb_inplace_power */
+ NULL, /* nb_inplace_lshift */
+ NULL, /* nb_inplace_rshift */
+ NULL, /* nb_inplace_and */
+ NULL, /* nb_inplace_xor */
+ NULL, /* nb_inplace_or */
+ NULL, /* nb_floor_divide */
+ valpy_divide, /* nb_true_divide */
+ NULL, /* nb_inplace_floor_divide */
+ NULL, /* nb_inplace_true_divide */
+ valpy_long, /* nb_index */
};
-static PyMappingMethods value_object_as_mapping = {
- valpy_length,
- valpy_getitem,
- valpy_setitem
-};
+static PyMappingMethods value_object_as_mapping
+ = { valpy_length, valpy_getitem, valpy_setitem };
PyTypeObject value_object_type = {
- PyVarObject_HEAD_INIT (NULL, 0)
- "gdb.Value", /*tp_name*/
- sizeof (value_object), /*tp_basicsize*/
- 0, /*tp_itemsize*/
- valpy_dealloc, /*tp_dealloc*/
- 0, /*tp_print*/
- 0, /*tp_getattr*/
- 0, /*tp_setattr*/
- 0, /*tp_compare*/
- 0, /*tp_repr*/
- &value_object_as_number, /*tp_as_number*/
- 0, /*tp_as_sequence*/
- &value_object_as_mapping, /*tp_as_mapping*/
- valpy_hash, /*tp_hash*/
- valpy_call, /*tp_call*/
- valpy_str, /*tp_str*/
- 0, /*tp_getattro*/
- 0, /*tp_setattro*/
- 0, /*tp_as_buffer*/
+ PyVarObject_HEAD_INIT (NULL, 0) "gdb.Value", /*tp_name*/
+ sizeof (value_object), /*tp_basicsize*/
+ 0, /*tp_itemsize*/
+ valpy_dealloc, /*tp_dealloc*/
+ 0, /*tp_print*/
+ 0, /*tp_getattr*/
+ 0, /*tp_setattr*/
+ 0, /*tp_compare*/
+ 0, /*tp_repr*/
+ &value_object_as_number, /*tp_as_number*/
+ 0, /*tp_as_sequence*/
+ &value_object_as_mapping, /*tp_as_mapping*/
+ valpy_hash, /*tp_hash*/
+ valpy_call, /*tp_call*/
+ valpy_str, /*tp_str*/
+ 0, /*tp_getattro*/
+ 0, /*tp_setattro*/
+ 0, /*tp_as_buffer*/
Py_TPFLAGS_DEFAULT | Py_TPFLAGS_CHECKTYPES
- | Py_TPFLAGS_BASETYPE, /*tp_flags*/
- "GDB value object", /* tp_doc */
- 0, /* tp_traverse */
- 0, /* tp_clear */
- valpy_richcompare, /* tp_richcompare */
- 0, /* tp_weaklistoffset */
- 0, /* tp_iter */
- 0, /* tp_iternext */
- value_object_methods, /* tp_methods */
- 0, /* tp_members */
- value_object_getset, /* tp_getset */
- 0, /* tp_base */
- 0, /* tp_dict */
- 0, /* tp_descr_get */
- 0, /* tp_descr_set */
- 0, /* tp_dictoffset */
- valpy_init, /* tp_init */
- 0, /* tp_alloc */
- PyType_GenericNew, /* tp_new */
+ | Py_TPFLAGS_BASETYPE, /*tp_flags*/
+ "GDB value object", /* tp_doc */
+ 0, /* tp_traverse */
+ 0, /* tp_clear */
+ valpy_richcompare, /* tp_richcompare */
+ 0, /* tp_weaklistoffset */
+ 0, /* tp_iter */
+ 0, /* tp_iternext */
+ value_object_methods, /* tp_methods */
+ 0, /* tp_members */
+ value_object_getset, /* tp_getset */
+ 0, /* tp_base */
+ 0, /* tp_dict */
+ 0, /* tp_descr_get */
+ 0, /* tp_descr_set */
+ 0, /* tp_dictoffset */
+ valpy_init, /* tp_init */
+ 0, /* tp_alloc */
+ PyType_GenericNew, /* tp_new */
};
diff --git a/gdb/python/py-varobj.c b/gdb/python/py-varobj.c
index 08e790b7e7e..1ec41a99737 100644
--- a/gdb/python/py-varobj.c
+++ b/gdb/python/py-varobj.c
@@ -72,8 +72,8 @@ py_varobj_iter::next ()
gdbpy_enter_varobj enter_py (m_var);
- scoped_restore set_options = make_scoped_restore (&gdbpy_current_print_options,
- &m_opts);
+ scoped_restore set_options
+ = make_scoped_restore (&gdbpy_current_print_options, &m_opts);
gdbpy_ref<> item (PyIter_Next (m_iter));
@@ -94,8 +94,8 @@ py_varobj_iter::next ()
return NULL;
}
- std::string name_str = string_printf ("<error at %d>",
- m_next_raw_index++);
+ std::string name_str
+ = string_printf ("<error at %d>", m_next_raw_index++);
item.reset (Py_BuildValue ("(ss)", name_str.c_str (),
value_str.get ()));
if (item == NULL)
@@ -115,7 +115,7 @@ py_varobj_iter::next ()
if (!PyArg_ParseTuple (item.get (), "sO", &name, &py_v))
{
gdbpy_print_stack ();
- error (_("Invalid item from the child list"));
+ error (_ ("Invalid item from the child list"));
}
vitem = new varobj_item ();
@@ -152,22 +152,22 @@ py_varobj_get_iterator (struct varobj *var, PyObject *printer,
if (!PyObject_HasAttr (printer, gdbpy_children_cst))
return NULL;
- scoped_restore set_options = make_scoped_restore (&gdbpy_current_print_options,
- opts);
+ scoped_restore set_options
+ = make_scoped_restore (&gdbpy_current_print_options, opts);
- gdbpy_ref<> children (PyObject_CallMethodObjArgs (printer, gdbpy_children_cst,
- NULL));
+ gdbpy_ref<> children (PyObject_CallMethodObjArgs (printer,
+ gdbpy_children_cst, NULL));
if (children == NULL)
{
gdbpy_print_stack ();
- error (_("Null value returned for children"));
+ error (_ ("Null value returned for children"));
}
gdbpy_ref<> iter (PyObject_GetIter (children.get ()));
if (iter == NULL)
{
gdbpy_print_stack ();
- error (_("Could not get children iterator"));
+ error (_ ("Could not get children iterator"));
}
return std::unique_ptr<varobj_iter> (new py_varobj_iter (var,
diff --git a/gdb/python/py-xmethods.c b/gdb/python/py-xmethods.c
index d6d607d99d4..88c1ced0187 100644
--- a/gdb/python/py-xmethods.c
+++ b/gdb/python/py-xmethods.c
@@ -115,10 +115,9 @@ invoke_match_method (PyObject *matcher, PyObject *py_obj_type,
/* Implementation of get_matching_xmethod_workers for Python. */
enum ext_lang_rc
-gdbpy_get_matching_xmethod_workers
- (const struct extension_language_defn *extlang,
- struct type *obj_type, const char *method_name,
- std::vector<xmethod_worker_up> *dm_vec)
+gdbpy_get_matching_xmethod_workers (
+ const struct extension_language_defn *extlang, struct type *obj_type,
+ const char *method_name, std::vector<xmethod_worker_up> *dm_vec)
{
gdb_assert (obj_type != NULL && method_name != NULL);
@@ -268,8 +267,8 @@ gdbpy_get_matching_xmethod_workers
break;
}
- worker = new python_xmethod_worker (py_worker.get (),
- py_type.get ());
+ worker
+ = new python_xmethod_worker (py_worker.get (), py_type.get ());
dm_vec->emplace_back (worker);
}
@@ -278,8 +277,8 @@ gdbpy_get_matching_xmethod_workers
{
struct xmethod_worker *worker;
- worker = new python_xmethod_worker (match_result.get (),
- py_type.get ());
+ worker
+ = new python_xmethod_worker (match_result.get (), py_type.get ());
dm_vec->emplace_back (worker);
}
}
@@ -299,17 +298,16 @@ python_xmethod_worker::do_get_arg_types (std::vector<type *> *arg_types)
int i = 1, arg_count;
gdbpy_ref<> list_iter;
- gdbpy_ref<> get_arg_types_method
- (PyObject_GetAttrString (m_py_worker, get_arg_types_method_name));
+ gdbpy_ref<> get_arg_types_method (
+ PyObject_GetAttrString (m_py_worker, get_arg_types_method_name));
if (get_arg_types_method == NULL)
{
gdbpy_print_stack ();
return EXT_LANG_RC_ERROR;
}
- gdbpy_ref<> py_argtype_list
- (PyObject_CallMethodObjArgs (m_py_worker, py_get_arg_types_method_name,
- NULL));
+ gdbpy_ref<> py_argtype_list (PyObject_CallMethodObjArgs (
+ m_py_worker, py_get_arg_types_method_name, NULL));
if (py_argtype_list == NULL)
{
gdbpy_print_stack ();
@@ -359,9 +357,9 @@ python_xmethod_worker::do_get_arg_types (std::vector<type *> *arg_types)
if (arg_type == NULL)
{
PyErr_SetString (PyExc_TypeError,
- _("Arg type returned by the get_arg_types "
- "method of a debug method worker object is "
- "not a gdb.Type object."));
+ _ ("Arg type returned by the get_arg_types "
+ "method of a debug method worker object is "
+ "not a gdb.Type object."));
return EXT_LANG_RC_ERROR;
}
@@ -378,9 +376,9 @@ python_xmethod_worker::do_get_arg_types (std::vector<type *> *arg_types)
if (arg_type == NULL)
{
PyErr_SetString (PyExc_TypeError,
- _("Arg type returned by the get_arg_types method "
- "of an xmethod worker object is not a gdb.Type "
- "object."));
+ _ ("Arg type returned by the get_arg_types method "
+ "of an xmethod worker object is not a gdb.Type "
+ "object."));
return EXT_LANG_RC_ERROR;
}
else
@@ -394,8 +392,7 @@ python_xmethod_worker::do_get_arg_types (std::vector<type *> *arg_types)
be a 'const' value. Hence, create a 'const' variant of the 'this' pointer
type. */
obj_type = type_object_to_type (m_this_type);
- (*arg_types)[0] = make_cv_type (1, 0, lookup_pointer_type (obj_type),
- NULL);
+ (*arg_types)[0] = make_cv_type (1, 0, lookup_pointer_type (obj_type), NULL);
return EXT_LANG_RC_OK;
}
@@ -414,8 +411,8 @@ python_xmethod_worker::do_get_result_type (value *obj,
/* First see if there is a get_result_type method.
If not this could be an old xmethod (pre 7.9.1). */
- gdbpy_ref<> get_result_type_method
- (PyObject_GetAttrString (m_py_worker, get_result_type_method_name));
+ gdbpy_ref<> get_result_type_method (
+ PyObject_GetAttrString (m_py_worker, get_result_type_method_name));
if (get_result_type_method == NULL)
{
PyErr_Clear ();
@@ -475,8 +472,8 @@ python_xmethod_worker::do_get_result_type (value *obj,
PyTuple_SET_ITEM (py_arg_tuple.get (), i + 1, py_value_arg);
}
- gdbpy_ref<> py_result_type
- (PyObject_CallObject (get_result_type_method.get (), py_arg_tuple.get ()));
+ gdbpy_ref<> py_result_type (
+ PyObject_CallObject (get_result_type_method.get (), py_arg_tuple.get ()));
if (py_result_type == NULL)
{
gdbpy_print_stack ();
@@ -487,8 +484,8 @@ python_xmethod_worker::do_get_result_type (value *obj,
if (*result_type_ptr == NULL)
{
PyErr_SetString (PyExc_TypeError,
- _("Type returned by the get_result_type method of an"
- " xmethod worker object is not a gdb.Type object."));
+ _ ("Type returned by the get_result_type method of an"
+ " xmethod worker object is not a gdb.Type object."));
gdbpy_print_stack ();
return EXT_LANG_RC_ERROR;
}
@@ -534,14 +531,14 @@ python_xmethod_worker::invoke (struct value *obj,
if (py_value_obj == NULL)
{
gdbpy_print_stack ();
- error (_("Error while executing Python code."));
+ error (_ ("Error while executing Python code."));
}
gdbpy_ref<> py_arg_tuple (PyTuple_New (args.size () + 1));
if (py_arg_tuple == NULL)
{
gdbpy_print_stack ();
- error (_("Error while executing Python code."));
+ error (_ ("Error while executing Python code."));
}
/* PyTuple_SET_ITEM steals the reference of the element, hence the
@@ -555,7 +552,7 @@ python_xmethod_worker::invoke (struct value *obj,
if (py_value_arg == NULL)
{
gdbpy_print_stack ();
- error (_("Error while executing Python code."));
+ error (_ ("Error while executing Python code."));
}
PyTuple_SET_ITEM (py_arg_tuple.get (), i + 1, py_value_arg);
@@ -566,7 +563,7 @@ python_xmethod_worker::invoke (struct value *obj,
if (py_result == NULL)
{
gdbpy_print_stack ();
- error (_("Error while executing Python code."));
+ error (_ ("Error while executing Python code."));
}
if (py_result != Py_None)
@@ -575,22 +572,23 @@ python_xmethod_worker::invoke (struct value *obj,
if (res == NULL)
{
gdbpy_print_stack ();
- error (_("Error while executing Python code."));
+ error (_ ("Error while executing Python code."));
}
}
else
{
- res = allocate_value (lookup_typename (current_language,
- "void", NULL, 0));
+ res
+ = allocate_value (lookup_typename (current_language, "void", NULL, 0));
}
return res;
}
python_xmethod_worker::python_xmethod_worker (PyObject *py_worker,
- PyObject *this_type)
-: xmethod_worker (&extension_language_python),
- m_py_worker (py_worker), m_this_type (this_type)
+ PyObject *this_type)
+ : xmethod_worker (&extension_language_python),
+ m_py_worker (py_worker),
+ m_this_type (this_type)
{
gdb_assert (m_py_worker != NULL && m_this_type != NULL);
diff --git a/gdb/python/python-internal.h b/gdb/python/python-internal.h
index c41a43bac96..f9b7f187af6 100644
--- a/gdb/python/python-internal.h
+++ b/gdb/python/python-internal.h
@@ -32,7 +32,7 @@
gdb. */
#ifdef WITH_CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF_ATTRIBUTE
-#define CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF(ARG) \
+#define CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF(ARG) \
__attribute__ ((cpychecker_type_object_for_typedef (ARG)))
#else
#define CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF(ARG)
@@ -45,7 +45,7 @@
#endif
#ifdef WITH_CPYCHECKER_NEGATIVE_RESULT_SETS_EXCEPTION_ATTRIBUTE
-#define CPYCHECKER_NEGATIVE_RESULT_SETS_EXCEPTION \
+#define CPYCHECKER_NEGATIVE_RESULT_SETS_EXCEPTION \
__attribute__ ((cpychecker_negative_result_sets_exception))
#else
#define CPYCHECKER_NEGATIVE_RESULT_SETS_EXCEPTION
@@ -74,7 +74,7 @@
/* Another kludge to avoid compilation errors because MinGW defines
'hypot' to '_hypot', but the C++ headers says "using ::hypot". */
#ifdef __MINGW32__
-# define _hypot hypot
+#define _hypot hypot
#endif
/* Request clean size types from Python. */
@@ -94,9 +94,9 @@
PyGILState_STATE will be. */
#ifndef WITH_THREAD
#define PyGILState_Ensure() ((PyGILState_STATE) 0)
-#define PyGILState_Release(ARG) ((void)(ARG))
+#define PyGILState_Release(ARG) ((void) (ARG))
#define PyEval_InitThreads()
-#define PyThreadState_Swap(ARG) ((void)(ARG))
+#define PyThreadState_Swap(ARG) ((void) (ARG))
#define PyEval_ReleaseLock()
#endif
@@ -144,10 +144,8 @@ static inline PyObject *
gdb_PyObject_CallMethod (PyObject *o, const char *method, const char *format,
Args... args) /* ARI: editCase function */
{
- return PyObject_CallMethod (o,
- const_cast<char *> (method),
- const_cast<char *> (format),
- args...);
+ return PyObject_CallMethod (o, const_cast<char *> (method),
+ const_cast<char *> (format), args...);
}
#undef PyObject_CallMethod
@@ -157,7 +155,7 @@ gdb_PyObject_CallMethod (PyObject *o, const char *method, const char *format,
qualifier in Python <= 3.4. Hence, we wrap it in a function to
avoid errors when compiled with -Werror. */
-static inline PyObject*
+static inline PyObject *
gdb_PyErr_NewException (const char *name, PyObject *base, PyObject *dict)
{
return PyErr_NewException (const_cast<char *> (name), base, dict);
@@ -185,7 +183,7 @@ gdb_PySys_GetObject (const char *name)
before Python 3.6. Hence, we wrap it in a function to avoid errors
when compiled with -Werror. */
-# define GDB_PYSYS_SETPATH_CHAR wchar_t
+#define GDB_PYSYS_SETPATH_CHAR wchar_t
static inline void
gdb_PySys_SetPath (const GDB_PYSYS_SETPATH_CHAR *path)
@@ -209,21 +207,24 @@ struct gdb_PyGetSetDef : PyGetSetDef
{
constexpr gdb_PyGetSetDef (const char *name_, getter get_, setter set_,
const char *doc_, void *closure_)
- : PyGetSetDef {const_cast<char *> (name_), get_, set_,
- const_cast<char *> (doc_), closure_}
- {}
+ : PyGetSetDef { const_cast<char *> (name_), get_, set_,
+ const_cast<char *> (doc_), closure_ }
+ {
+ }
/* Alternative constructor that allows omitting the closure in list
initialization. */
constexpr gdb_PyGetSetDef (const char *name_, getter get_, setter set_,
const char *doc_)
- : gdb_PyGetSetDef {name_, get_, set_, doc_, NULL}
- {}
+ : gdb_PyGetSetDef { name_, get_, set_, doc_, NULL }
+ {
+ }
/* Constructor for the sentinel entries. */
constexpr gdb_PyGetSetDef (std::nullptr_t)
- : gdb_PyGetSetDef {NULL, NULL, NULL, NULL, NULL}
- {}
+ : gdb_PyGetSetDef { NULL, NULL, NULL, NULL, NULL }
+ {
+ }
};
/* The 'keywords' parameter of PyArg_ParseTupleAndKeywords has type
@@ -240,15 +241,15 @@ struct gdb_PyGetSetDef : PyGetSetDef
static inline int
gdb_PyArg_ParseTupleAndKeywords (PyObject *args, PyObject *kw,
- const char *format, const char **keywords, ...)
+ const char *format, const char **keywords,
+ ...)
{
va_list ap;
int res;
va_start (ap, keywords);
res = PyArg_VaParseTupleAndKeywords (args, kw, format,
- const_cast<char **> (keywords),
- ap);
+ const_cast<char **> (keywords), ap);
va_end (ap);
return res;
@@ -262,7 +263,12 @@ gdb_PyArg_ParseTupleAndKeywords (PyObject *args, PyObject *kw,
#include "command.h"
#include "breakpoint.h"
-enum gdbpy_iter_kind { iter_keys, iter_values, iter_items };
+enum gdbpy_iter_kind
+{
+ iter_keys,
+ iter_values,
+ iter_items
+};
struct block;
struct value;
@@ -275,20 +281,20 @@ extern int gdb_python_initialized;
extern PyObject *gdb_module;
extern PyObject *gdb_python_module;
-extern PyTypeObject value_object_type
- CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF ("value_object");
-extern PyTypeObject block_object_type
- CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF("block_object");
-extern PyTypeObject symbol_object_type
- CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF ("symbol_object");
-extern PyTypeObject event_object_type
- CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF ("event_object");
+extern PyTypeObject
+ value_object_type CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF ("value_object");
+extern PyTypeObject
+ block_object_type CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF ("block_object");
+extern PyTypeObject
+ symbol_object_type CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF ("symbol_object");
+extern PyTypeObject
+ event_object_type CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF ("event_object");
extern PyTypeObject breakpoint_object_type
- CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF ("breakpoint_object");
-extern PyTypeObject frame_object_type
- CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF ("frame_object");
-extern PyTypeObject thread_object_type
- CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF ("thread_object");
+ CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF ("breakpoint_object");
+extern PyTypeObject
+ frame_object_type CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF ("frame_object");
+extern PyTypeObject
+ thread_object_type CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF ("thread_object");
/* Ensure that breakpoint_object_type is initialized and return true. If
breakpoint_object_type can't be initialized then set a suitable Python
@@ -306,8 +312,8 @@ struct gdbpy_breakpoint_object
{
PyObject_HEAD
- /* The breakpoint number according to gdb. */
- int number;
+ /* The breakpoint number according to gdb. */
+ int number;
/* The gdb breakpoint object, or NULL if the breakpoint has been
deleted. */
@@ -319,38 +325,40 @@ struct gdbpy_breakpoint_object
/* Require that BREAKPOINT be a valid breakpoint ID; throw a Python
exception if it is invalid. */
-#define BPPY_REQUIRE_VALID(Breakpoint) \
- do { \
- if ((Breakpoint)->bp == NULL) \
- return PyErr_Format (PyExc_RuntimeError, \
- _("Breakpoint %d is invalid."), \
- (Breakpoint)->number); \
- } while (0)
+#define BPPY_REQUIRE_VALID(Breakpoint) \
+ do \
+ { \
+ if ((Breakpoint)->bp == NULL) \
+ return PyErr_Format (PyExc_RuntimeError, \
+ _ ("Breakpoint %d is invalid."), \
+ (Breakpoint)->number); \
+ } \
+ while (0)
/* Require that BREAKPOINT be a valid breakpoint ID; throw a Python
exception if it is invalid. This macro is for use in setter functions. */
-#define BPPY_SET_REQUIRE_VALID(Breakpoint) \
- do { \
- if ((Breakpoint)->bp == NULL) \
- { \
- PyErr_Format (PyExc_RuntimeError, _("Breakpoint %d is invalid."), \
- (Breakpoint)->number); \
- return -1; \
- } \
- } while (0)
-
+#define BPPY_SET_REQUIRE_VALID(Breakpoint) \
+ do \
+ { \
+ if ((Breakpoint)->bp == NULL) \
+ { \
+ PyErr_Format (PyExc_RuntimeError, _ ("Breakpoint %d is invalid."), \
+ (Breakpoint)->number); \
+ return -1; \
+ } \
+ } \
+ while (0)
/* Variables used to pass information between the Breakpoint
constructor and the breakpoint-created hook function. */
extern gdbpy_breakpoint_object *bppy_pending_object;
-
struct thread_object
{
PyObject_HEAD
- /* The thread we represent. */
- struct thread_info *thread;
+ /* The thread we represent. */
+ struct thread_info *thread;
/* The Inferior object to which this thread belongs. */
PyObject *inf_obj;
@@ -360,7 +368,7 @@ struct inferior_object;
extern struct cmd_list_element *set_python_list;
extern struct cmd_list_element *show_python_list;
-
+
/* extension_language_script_ops "methods". */
/* Return true if auto-loading Python scripts is enabled.
@@ -370,31 +378,30 @@ extern bool gdbpy_auto_load_enabled (const struct extension_language_defn *);
/* extension_language_ops "methods". */
-extern enum ext_lang_rc gdbpy_apply_val_pretty_printer
- (const struct extension_language_defn *,
- struct value *value,
- struct ui_file *stream, int recurse,
- const struct value_print_options *options,
- const struct language_defn *language);
-extern enum ext_lang_bt_status gdbpy_apply_frame_filter
- (const struct extension_language_defn *,
- frame_info_ptr frame, frame_filter_flags flags,
- enum ext_lang_frame_args args_type,
- struct ui_out *out, int frame_low, int frame_high);
+extern enum ext_lang_rc
+gdbpy_apply_val_pretty_printer (const struct extension_language_defn *,
+ struct value *value, struct ui_file *stream,
+ int recurse,
+ const struct value_print_options *options,
+ const struct language_defn *language);
+extern enum ext_lang_bt_status
+gdbpy_apply_frame_filter (const struct extension_language_defn *,
+ frame_info_ptr frame, frame_filter_flags flags,
+ enum ext_lang_frame_args args_type,
+ struct ui_out *out, int frame_low, int frame_high);
extern void gdbpy_preserve_values (const struct extension_language_defn *,
struct objfile *objfile,
htab_t copied_types);
-extern enum ext_lang_bp_stop gdbpy_breakpoint_cond_says_stop
- (const struct extension_language_defn *, struct breakpoint *);
+extern enum ext_lang_bp_stop
+gdbpy_breakpoint_cond_says_stop (const struct extension_language_defn *,
+ struct breakpoint *);
extern int gdbpy_breakpoint_has_cond (const struct extension_language_defn *,
struct breakpoint *b);
-extern enum ext_lang_rc gdbpy_get_matching_xmethod_workers
- (const struct extension_language_defn *extlang,
- struct type *obj_type, const char *method_name,
- std::vector<xmethod_worker_up> *dm_vec);
+extern enum ext_lang_rc gdbpy_get_matching_xmethod_workers (
+ const struct extension_language_defn *extlang, struct type *obj_type,
+ const char *method_name, std::vector<xmethod_worker_up> *dm_vec);
-
PyObject *gdbpy_history (PyObject *self, PyObject *args);
PyObject *gdbpy_add_history (PyObject *self, PyObject *args);
extern PyObject *gdbpy_history_count (PyObject *self, PyObject *args);
@@ -408,7 +415,7 @@ PyObject *gdbpy_lookup_global_symbol (PyObject *self, PyObject *args,
PyObject *gdbpy_lookup_static_symbol (PyObject *self, PyObject *args,
PyObject *kw);
PyObject *gdbpy_lookup_static_symbols (PyObject *self, PyObject *args,
- PyObject *kw);
+ PyObject *kw);
PyObject *gdbpy_start_recording (PyObject *self, PyObject *args);
PyObject *gdbpy_current_recording (PyObject *self, PyObject *args);
PyObject *gdbpy_stop_recording (PyObject *self, PyObject *args);
@@ -425,9 +432,10 @@ PyObject *gdbpy_selected_thread (PyObject *self, PyObject *args);
PyObject *gdbpy_selected_inferior (PyObject *self, PyObject *args);
PyObject *gdbpy_string_to_argv (PyObject *self, PyObject *args);
PyObject *gdbpy_parameter_value (const setting &var);
-gdb::unique_xmalloc_ptr<char> gdbpy_parse_command_name
- (const char *name, struct cmd_list_element ***base_list,
- struct cmd_list_element **start_list);
+gdb::unique_xmalloc_ptr<char>
+gdbpy_parse_command_name (const char *name,
+ struct cmd_list_element ***base_list,
+ struct cmd_list_element **start_list);
PyObject *gdbpy_register_tui_window (PyObject *self, PyObject *args,
PyObject *kw);
@@ -462,7 +470,8 @@ PyObject *gdbpy_new_register_descriptor_iterator (struct gdbarch *gdbarch,
PyObject *gdbpy_new_reggroup_iterator (struct gdbarch *gdbarch);
gdbpy_ref<thread_object> create_thread_object (struct thread_info *tp);
-gdbpy_ref<> thread_to_thread_object (thread_info *thr);;
+gdbpy_ref<> thread_to_thread_object (thread_info *thr);
+;
gdbpy_ref<inferior_object> inferior_to_inferior_object (inferior *inf);
PyObject *gdbpy_buffer_to_membuf (gdb::unique_xmalloc_ptr<gdb_byte> buffer,
@@ -490,75 +499,52 @@ struct gdbarch *arch_object_to_gdbarch (PyObject *obj);
extern struct program_space *progspace_object_to_program_space (PyObject *obj);
void gdbpy_initialize_gdb_readline (void);
-int gdbpy_initialize_auto_load (void)
- CPYCHECKER_NEGATIVE_RESULT_SETS_EXCEPTION;
-int gdbpy_initialize_values (void)
- CPYCHECKER_NEGATIVE_RESULT_SETS_EXCEPTION;
-int gdbpy_initialize_frames (void)
- CPYCHECKER_NEGATIVE_RESULT_SETS_EXCEPTION;
-int gdbpy_initialize_instruction (void)
- CPYCHECKER_NEGATIVE_RESULT_SETS_EXCEPTION;
-int gdbpy_initialize_btrace (void)
- CPYCHECKER_NEGATIVE_RESULT_SETS_EXCEPTION;
-int gdbpy_initialize_record (void)
- CPYCHECKER_NEGATIVE_RESULT_SETS_EXCEPTION;
-int gdbpy_initialize_symtabs (void)
- CPYCHECKER_NEGATIVE_RESULT_SETS_EXCEPTION;
-int gdbpy_initialize_commands (void)
- CPYCHECKER_NEGATIVE_RESULT_SETS_EXCEPTION;
-int gdbpy_initialize_symbols (void)
- CPYCHECKER_NEGATIVE_RESULT_SETS_EXCEPTION;
-int gdbpy_initialize_symtabs (void)
- CPYCHECKER_NEGATIVE_RESULT_SETS_EXCEPTION;
-int gdbpy_initialize_blocks (void)
- CPYCHECKER_NEGATIVE_RESULT_SETS_EXCEPTION;
-int gdbpy_initialize_types (void)
- CPYCHECKER_NEGATIVE_RESULT_SETS_EXCEPTION;
-int gdbpy_initialize_functions (void)
- CPYCHECKER_NEGATIVE_RESULT_SETS_EXCEPTION;
-int gdbpy_initialize_pspace (void)
- CPYCHECKER_NEGATIVE_RESULT_SETS_EXCEPTION;
-int gdbpy_initialize_objfile (void)
- CPYCHECKER_NEGATIVE_RESULT_SETS_EXCEPTION;
-int gdbpy_initialize_breakpoints (void)
- CPYCHECKER_NEGATIVE_RESULT_SETS_EXCEPTION;
+int
+gdbpy_initialize_auto_load (void) CPYCHECKER_NEGATIVE_RESULT_SETS_EXCEPTION;
+int gdbpy_initialize_values (void) CPYCHECKER_NEGATIVE_RESULT_SETS_EXCEPTION;
+int gdbpy_initialize_frames (void) CPYCHECKER_NEGATIVE_RESULT_SETS_EXCEPTION;
+int
+gdbpy_initialize_instruction (void) CPYCHECKER_NEGATIVE_RESULT_SETS_EXCEPTION;
+int gdbpy_initialize_btrace (void) CPYCHECKER_NEGATIVE_RESULT_SETS_EXCEPTION;
+int gdbpy_initialize_record (void) CPYCHECKER_NEGATIVE_RESULT_SETS_EXCEPTION;
+int gdbpy_initialize_symtabs (void) CPYCHECKER_NEGATIVE_RESULT_SETS_EXCEPTION;
+int gdbpy_initialize_commands (void) CPYCHECKER_NEGATIVE_RESULT_SETS_EXCEPTION;
+int gdbpy_initialize_symbols (void) CPYCHECKER_NEGATIVE_RESULT_SETS_EXCEPTION;
+int gdbpy_initialize_symtabs (void) CPYCHECKER_NEGATIVE_RESULT_SETS_EXCEPTION;
+int gdbpy_initialize_blocks (void) CPYCHECKER_NEGATIVE_RESULT_SETS_EXCEPTION;
+int gdbpy_initialize_types (void) CPYCHECKER_NEGATIVE_RESULT_SETS_EXCEPTION;
+int
+gdbpy_initialize_functions (void) CPYCHECKER_NEGATIVE_RESULT_SETS_EXCEPTION;
+int gdbpy_initialize_pspace (void) CPYCHECKER_NEGATIVE_RESULT_SETS_EXCEPTION;
+int gdbpy_initialize_objfile (void) CPYCHECKER_NEGATIVE_RESULT_SETS_EXCEPTION;
+int
+gdbpy_initialize_breakpoints (void) CPYCHECKER_NEGATIVE_RESULT_SETS_EXCEPTION;
int gdbpy_initialize_breakpoint_locations ()
CPYCHECKER_NEGATIVE_RESULT_SETS_EXCEPTION;
int gdbpy_initialize_finishbreakpoints (void)
CPYCHECKER_NEGATIVE_RESULT_SETS_EXCEPTION;
-int gdbpy_initialize_lazy_string (void)
- CPYCHECKER_NEGATIVE_RESULT_SETS_EXCEPTION;
-int gdbpy_initialize_linetable (void)
- CPYCHECKER_NEGATIVE_RESULT_SETS_EXCEPTION;
-int gdbpy_initialize_parameters (void)
- CPYCHECKER_NEGATIVE_RESULT_SETS_EXCEPTION;
-int gdbpy_initialize_thread (void)
- CPYCHECKER_NEGATIVE_RESULT_SETS_EXCEPTION;
-int gdbpy_initialize_inferior (void)
- CPYCHECKER_NEGATIVE_RESULT_SETS_EXCEPTION;
+int
+gdbpy_initialize_lazy_string (void) CPYCHECKER_NEGATIVE_RESULT_SETS_EXCEPTION;
+int
+gdbpy_initialize_linetable (void) CPYCHECKER_NEGATIVE_RESULT_SETS_EXCEPTION;
+int
+gdbpy_initialize_parameters (void) CPYCHECKER_NEGATIVE_RESULT_SETS_EXCEPTION;
+int gdbpy_initialize_thread (void) CPYCHECKER_NEGATIVE_RESULT_SETS_EXCEPTION;
+int gdbpy_initialize_inferior (void) CPYCHECKER_NEGATIVE_RESULT_SETS_EXCEPTION;
int gdbpy_initialize_eventregistry (void)
CPYCHECKER_NEGATIVE_RESULT_SETS_EXCEPTION;
-int gdbpy_initialize_event (void)
- CPYCHECKER_NEGATIVE_RESULT_SETS_EXCEPTION;
-int gdbpy_initialize_arch (void)
- CPYCHECKER_NEGATIVE_RESULT_SETS_EXCEPTION;
-int gdbpy_initialize_registers ()
- CPYCHECKER_NEGATIVE_RESULT_SETS_EXCEPTION;
-int gdbpy_initialize_xmethods (void)
- CPYCHECKER_NEGATIVE_RESULT_SETS_EXCEPTION;
-int gdbpy_initialize_unwind (void)
- CPYCHECKER_NEGATIVE_RESULT_SETS_EXCEPTION;
-int gdbpy_initialize_tui ()
- CPYCHECKER_NEGATIVE_RESULT_SETS_EXCEPTION;
-int gdbpy_initialize_membuf ()
- CPYCHECKER_NEGATIVE_RESULT_SETS_EXCEPTION;
-int gdbpy_initialize_connection ()
- CPYCHECKER_NEGATIVE_RESULT_SETS_EXCEPTION;
-int gdbpy_initialize_micommands (void)
- CPYCHECKER_NEGATIVE_RESULT_SETS_EXCEPTION;
+int gdbpy_initialize_event (void) CPYCHECKER_NEGATIVE_RESULT_SETS_EXCEPTION;
+int gdbpy_initialize_arch (void) CPYCHECKER_NEGATIVE_RESULT_SETS_EXCEPTION;
+int gdbpy_initialize_registers () CPYCHECKER_NEGATIVE_RESULT_SETS_EXCEPTION;
+int gdbpy_initialize_xmethods (void) CPYCHECKER_NEGATIVE_RESULT_SETS_EXCEPTION;
+int gdbpy_initialize_unwind (void) CPYCHECKER_NEGATIVE_RESULT_SETS_EXCEPTION;
+int gdbpy_initialize_tui () CPYCHECKER_NEGATIVE_RESULT_SETS_EXCEPTION;
+int gdbpy_initialize_membuf () CPYCHECKER_NEGATIVE_RESULT_SETS_EXCEPTION;
+int gdbpy_initialize_connection () CPYCHECKER_NEGATIVE_RESULT_SETS_EXCEPTION;
+int
+gdbpy_initialize_micommands (void) CPYCHECKER_NEGATIVE_RESULT_SETS_EXCEPTION;
void gdbpy_finalize_micommands ();
-int gdbpy_initialize_disasm ()
- CPYCHECKER_NEGATIVE_RESULT_SETS_EXCEPTION;
+int gdbpy_initialize_disasm () CPYCHECKER_NEGATIVE_RESULT_SETS_EXCEPTION;
PyMODINIT_FUNC gdbpy_events_mod_func ();
@@ -584,8 +570,7 @@ public:
void restore ()
{
- PyErr_Restore (m_error_type.release (),
- m_error_value.release (),
+ PyErr_Restore (m_error_type.release (), m_error_value.release (),
m_error_traceback.release ());
}
@@ -610,10 +595,7 @@ public:
/* Return a new reference to the exception value object. */
- gdbpy_ref<> value ()
- {
- return m_error_value;
- }
+ gdbpy_ref<> value () { return m_error_value; }
private:
@@ -627,7 +609,7 @@ private:
handler. */
class gdbpy_enter
{
- public:
+public:
/* Set the ambient Python architecture to GDBARCH and the language
to LANGUAGE. If GDBARCH is nullptr, then the architecture will
@@ -653,7 +635,7 @@ class gdbpy_enter
acceptable value. */
static void finalize ();
- private:
+private:
/* The current gdbarch, according to Python. This can be
nullptr. */
@@ -673,12 +655,11 @@ class gdbpy_enter
make constructor delegation a little nicer. */
class gdbpy_enter_varobj : public gdbpy_enter
{
- public:
+public:
/* This is defined in varobj.c, where it can access varobj
internals. */
gdbpy_enter_varobj (const struct varobj *var);
-
};
/* The opposite of gdb_enter: this releases the GIL around a region,
@@ -694,10 +675,7 @@ public:
gdb_assert (m_save != nullptr);
}
- ~gdbpy_allow_threads ()
- {
- PyEval_RestoreThread (m_save);
- }
+ ~gdbpy_allow_threads () { PyEval_RestoreThread (m_save); }
DISABLE_COPY_AND_ASSIGN (gdbpy_allow_threads);
@@ -708,25 +686,29 @@ private:
/* Use this after a TRY_EXCEPT to throw the appropriate Python
exception. */
-#define GDB_PY_HANDLE_EXCEPTION(Exception) \
- do { \
- if (Exception.reason < 0) \
- { \
- gdbpy_convert_exception (Exception); \
- return NULL; \
- } \
- } while (0)
+#define GDB_PY_HANDLE_EXCEPTION(Exception) \
+ do \
+ { \
+ if (Exception.reason < 0) \
+ { \
+ gdbpy_convert_exception (Exception); \
+ return NULL; \
+ } \
+ } \
+ while (0)
/* Use this after a TRY_EXCEPT to throw the appropriate Python
exception. This macro is for use inside setter functions. */
-#define GDB_PY_SET_HANDLE_EXCEPTION(Exception) \
- do { \
- if (Exception.reason < 0) \
- { \
- gdbpy_convert_exception (Exception); \
- return -1; \
- } \
- } while (0)
+#define GDB_PY_SET_HANDLE_EXCEPTION(Exception) \
+ do \
+ { \
+ if (Exception.reason < 0) \
+ { \
+ gdbpy_convert_exception (Exception); \
+ return -1; \
+ } \
+ } \
+ while (0)
int gdbpy_print_python_errors_p (void);
void gdbpy_print_stack (void);
@@ -741,8 +723,8 @@ void gdbpy_handle_exception () ATTRIBUTE_NORETURN;
This always calls error, and never returns. */
-void gdbpy_error (const char *fmt, ...)
- ATTRIBUTE_NORETURN ATTRIBUTE_PRINTF (1, 2);
+void gdbpy_error (const char *fmt, ...) ATTRIBUTE_NORETURN
+ ATTRIBUTE_PRINTF (1, 2);
gdbpy_ref<> python_string_to_unicode (PyObject *obj);
gdb::unique_xmalloc_ptr<char> unicode_to_target_string (PyObject *unicode_str);
@@ -755,8 +737,7 @@ gdb::unique_xmalloc_ptr<char> gdbpy_obj_to_string (PyObject *obj);
int gdbpy_is_lazy_string (PyObject *result);
void gdbpy_extract_lazy_string (PyObject *string, CORE_ADDR *addr,
- struct type **str_type,
- long *length,
+ struct type **str_type, long *length,
gdb::unique_xmalloc_ptr<char> *encoding);
int gdbpy_is_value_object (PyObject *obj);
@@ -791,10 +772,10 @@ extern PyObject *gdbpy_gdb_memory_error;
extern PyObject *gdbpy_gdberror_exc;
extern void gdbpy_convert_exception (const struct gdb_exception &)
- CPYCHECKER_SETS_EXCEPTION;
+ CPYCHECKER_SETS_EXCEPTION;
int get_addr_from_python (PyObject *obj, CORE_ADDR *addr)
- CPYCHECKER_NEGATIVE_RESULT_SETS_EXCEPTION;
+ CPYCHECKER_NEGATIVE_RESULT_SETS_EXCEPTION;
gdbpy_ref<> gdb_py_object_from_longest (LONGEST l);
gdbpy_ref<> gdb_py_object_from_ulongest (ULONGEST l);
@@ -808,19 +789,15 @@ int gdb_pymodule_addobject (PyObject *module, const char *name,
struct varobj_iter;
struct varobj;
-std::unique_ptr<varobj_iter> py_varobj_get_iterator
- (struct varobj *var,
- PyObject *printer,
- const value_print_options *opts);
+std::unique_ptr<varobj_iter>
+py_varobj_get_iterator (struct varobj *var, PyObject *printer,
+ const value_print_options *opts);
/* Deleter for Py_buffer unique_ptr specialization. */
struct Py_buffer_deleter
{
- void operator() (Py_buffer *b) const
- {
- PyBuffer_Release (b);
- }
+ void operator() (Py_buffer *b) const { PyBuffer_Release (b); }
};
/* A unique_ptr specialization for Py_buffer. */
@@ -873,8 +850,8 @@ extern bool gdbpy_is_progspace (PyObject *obj);
If the analysis of DOC fails then DOC will be returned unmodified. */
-extern gdb::unique_xmalloc_ptr<char> gdbpy_fix_doc_string_indentation
- (gdb::unique_xmalloc_ptr<char> doc);
+extern gdb::unique_xmalloc_ptr<char>
+gdbpy_fix_doc_string_indentation (gdb::unique_xmalloc_ptr<char> doc);
/* Implement the 'print_insn' hook for Python. Disassemble an instruction
whose address is ADDRESS for architecture GDBARCH. The bytes of the
diff --git a/gdb/python/python.c b/gdb/python/python.c
index 54623f445ed..66b0f26de35 100644
--- a/gdb/python/python.c
+++ b/gdb/python/python.c
@@ -44,13 +44,8 @@ static const char python_excp_full[] = "full";
static const char python_excp_message[] = "message";
/* "set python print-stack" choices. */
-static const char *const python_excp_enums[] =
- {
- python_excp_none,
- python_excp_full,
- python_excp_message,
- NULL
- };
+static const char *const python_excp_enums[]
+ = { python_excp_none, python_excp_full, python_excp_message, NULL };
/* The exception printing variable. 'full' if we want to print the
error message and stack, 'none' if we want to print nothing, and
@@ -58,7 +53,6 @@ static const char *const python_excp_enums[] =
the default. */
static const char *gdbpy_should_print_stack = python_excp_message;
-
#ifdef HAVE_PYTHON
#include "cli/cli-decode.h"
@@ -106,38 +100,36 @@ static objfile_script_sourcer_func gdbpy_source_objfile_script;
static objfile_script_executor_func gdbpy_execute_objfile_script;
static void gdbpy_initialize (const struct extension_language_defn *);
static int gdbpy_initialized (const struct extension_language_defn *);
-static void gdbpy_eval_from_control_command
- (const struct extension_language_defn *, struct command_line *cmd);
+static void
+gdbpy_eval_from_control_command (const struct extension_language_defn *,
+ struct command_line *cmd);
static void gdbpy_start_type_printers (const struct extension_language_defn *,
struct ext_lang_type_printers *);
-static enum ext_lang_rc gdbpy_apply_type_printers
- (const struct extension_language_defn *,
- const struct ext_lang_type_printers *, struct type *, char **);
+static enum ext_lang_rc
+gdbpy_apply_type_printers (const struct extension_language_defn *,
+ const struct ext_lang_type_printers *,
+ struct type *, char **);
static void gdbpy_free_type_printers (const struct extension_language_defn *,
struct ext_lang_type_printers *);
static void gdbpy_set_quit_flag (const struct extension_language_defn *);
static int gdbpy_check_quit_flag (const struct extension_language_defn *);
-static enum ext_lang_rc gdbpy_before_prompt_hook
- (const struct extension_language_defn *, const char *current_gdb_prompt);
-static gdb::optional<std::string> gdbpy_colorize
- (const std::string &filename, const std::string &contents);
-static gdb::optional<std::string> gdbpy_colorize_disasm
- (const std::string &content, gdbarch *gdbarch);
+static enum ext_lang_rc
+gdbpy_before_prompt_hook (const struct extension_language_defn *,
+ const char *current_gdb_prompt);
+static gdb::optional<std::string> gdbpy_colorize (const std::string &filename,
+ const std::string &contents);
+static gdb::optional<std::string>
+gdbpy_colorize_disasm (const std::string &content, gdbarch *gdbarch);
/* The interface between gdb proper and loading of python scripts. */
-static const struct extension_language_script_ops python_extension_script_ops =
-{
- gdbpy_source_script,
- gdbpy_source_objfile_script,
- gdbpy_execute_objfile_script,
- gdbpy_auto_load_enabled
-};
+static const struct extension_language_script_ops python_extension_script_ops
+ = { gdbpy_source_script, gdbpy_source_objfile_script,
+ gdbpy_execute_objfile_script, gdbpy_auto_load_enabled };
/* The interface between gdb proper and python extensions. */
-static const struct extension_language_ops python_extension_ops =
-{
+static const struct extension_language_ops python_extension_ops = {
gdbpy_initialize,
gdbpy_initialized,
@@ -174,25 +166,24 @@ static const struct extension_language_ops python_extension_ops =
/* The main struct describing GDB's interface to the Python
extension language. */
-const struct extension_language_defn extension_language_python =
-{
- EXT_LANG_PYTHON,
- "python",
- "Python",
+const struct extension_language_defn extension_language_python
+ = { EXT_LANG_PYTHON,
+ "python",
+ "Python",
- ".py",
- "-gdb.py",
+ ".py",
+ "-gdb.py",
- python_control,
+ python_control,
#ifdef HAVE_PYTHON
- &python_extension_script_ops,
- &python_extension_ops
+ &python_extension_script_ops,
+ &python_extension_ops
#else
- NULL,
- NULL
+ NULL,
+ NULL
#endif
-};
+ };
#ifdef HAVE_PYTHON
@@ -200,14 +191,14 @@ const struct extension_language_defn extension_language_python =
the Python interpreter. */
struct gdbarch *gdbpy_enter::python_gdbarch;
-gdbpy_enter::gdbpy_enter (struct gdbarch *gdbarch,
- const struct language_defn *language)
-: m_gdbarch (python_gdbarch),
- m_language (language == nullptr ? nullptr : current_language)
+gdbpy_enter::gdbpy_enter (struct gdbarch *gdbarch,
+ const struct language_defn *language)
+ : m_gdbarch (python_gdbarch),
+ m_language (language == nullptr ? nullptr : current_language)
{
/* We should not ever enter Python unless initialized. */
if (!gdb_python_initialized)
- error (_("Python not initialized"));
+ error (_ ("Python not initialized"));
m_previous_active = set_active_ext_lang (&extension_language_python);
@@ -228,7 +219,7 @@ gdbpy_enter::~gdbpy_enter ()
{
/* This order is similar to the one calling error afterwards. */
gdbpy_print_stack ();
- warning (_("internal error: Unhandled Python exception"));
+ warning (_ ("internal error: Unhandled Python exception"));
}
m_error->restore ();
@@ -267,10 +258,7 @@ public:
{
}
- ~gdbpy_gil ()
- {
- PyGILState_Release (m_state);
- }
+ ~gdbpy_gil () { PyGILState_Release (m_state); }
DISABLE_COPY_AND_ASSIGN (gdbpy_gil);
@@ -350,7 +338,7 @@ python_interactive_command (const char *arg, int from_tty)
if (err)
{
gdbpy_print_stack ();
- error (_("Error while executing Python code."));
+ error (_ ("Error while executing Python code."));
}
}
@@ -383,17 +371,17 @@ python_run_simple_file (FILE *file, const char *filename)
gdb::unique_xmalloc_ptr<char> full_path (tilde_expand (filename));
if (gdb_python_module == nullptr
- || ! PyObject_HasAttrString (gdb_python_module, "_execute_file"))
- error (_("Installation error: gdb._execute_file function is missing"));
+ || !PyObject_HasAttrString (gdb_python_module, "_execute_file"))
+ error (_ ("Installation error: gdb._execute_file function is missing"));
- gdbpy_ref<> return_value
- (PyObject_CallMethod (gdb_python_module, "_execute_file", "s",
- full_path.get ()));
+ gdbpy_ref<> return_value (PyObject_CallMethod (gdb_python_module,
+ "_execute_file", "s",
+ full_path.get ()));
if (return_value == nullptr)
{
/* Use PyErr_PrintEx instead of gdbpy_print_stack to better match the
behavior of the non-Windows codepath. */
- PyErr_PrintEx(0);
+ PyErr_PrintEx (0);
}
#endif /* _WIN32 */
@@ -426,14 +414,14 @@ gdbpy_eval_from_control_command (const struct extension_language_defn *extlang,
int ret;
if (cmd->body_list_1 != nullptr)
- error (_("Invalid \"python\" block structure."));
+ error (_ ("Invalid \"python\" block structure."));
gdbpy_enter enter_py;
std::string script = compute_python_string (cmd->body_list_0.get ());
ret = PyRun_SimpleString (script.c_str ());
if (ret)
- error (_("Error while executing Python code."));
+ error (_ ("Error while executing Python code."));
}
/* Implementation of the gdb "python" command. */
@@ -449,7 +437,7 @@ python_command (const char *arg, int from_tty)
if (arg && *arg)
{
if (PyRun_SimpleString (arg))
- error (_("Error while executing Python code."));
+ error (_ ("Error while executing Python code."));
}
else
{
@@ -459,8 +447,6 @@ python_command (const char *arg, int from_tty)
}
}
-
-
/* Transform a gdb parameters's value into a Python value. May return
NULL (and set a Python exception) on error. Helper function for
get_parameter. */
@@ -508,22 +494,19 @@ gdbpy_parameter_value (const setting &var)
case var_integer:
case var_pinteger:
{
- LONGEST value
- = (var.type () == var_uinteger
- ? static_cast<LONGEST> (var.get<unsigned int> ())
- : static_cast<LONGEST> (var.get<int> ()));
+ LONGEST value = (var.type () == var_uinteger
+ ? static_cast<LONGEST> (var.get<unsigned int> ())
+ : static_cast<LONGEST> (var.get<int> ()));
if (var.extra_literals () != nullptr)
for (const literal_def *l = var.extra_literals ();
- l->literal != nullptr;
- l++)
+ l->literal != nullptr; l++)
if (value == l->use)
{
if (strcmp (l->literal, "unlimited") == 0)
{
/* Compatibility hack for API brokenness. */
- if (var.type () == var_pinteger
- && l->val.has_value ()
+ if (var.type () == var_pinteger && l->val.has_value ()
&& *l->val == -1)
value = -1;
else
@@ -536,18 +519,17 @@ gdbpy_parameter_value (const setting &var)
}
if (var.type () == var_uinteger)
- return
- gdb_py_object_from_ulongest
- (static_cast<unsigned int> (value)).release ();
+ return gdb_py_object_from_ulongest (
+ static_cast<unsigned int> (value))
+ .release ();
else
- return
- gdb_py_object_from_longest
- (static_cast<int> (value)).release ();
+ return gdb_py_object_from_longest (static_cast<int> (value))
+ .release ();
}
}
return PyErr_Format (PyExc_RuntimeError,
- _("Programmer error: unhandled type."));
+ _ ("Programmer error: unhandled type."));
}
/* A Python function which returns a gdb parameter's value as a Python
@@ -560,7 +542,7 @@ gdbpy_parameter (PyObject *self, PyObject *args)
const char *arg;
int found = -1;
- if (! PyArg_ParseTuple (args, "s", &arg))
+ if (!PyArg_ParseTuple (args, "s", &arg))
return NULL;
std::string newarg = std::string ("show ") + arg;
@@ -576,11 +558,11 @@ gdbpy_parameter (PyObject *self, PyObject *args)
if (!found)
return PyErr_Format (PyExc_RuntimeError,
- _("Could not find parameter `%s'."), arg);
+ _ ("Could not find parameter `%s'."), arg);
if (!cmd->var.has_value ())
- return PyErr_Format (PyExc_RuntimeError,
- _("`%s' is not a parameter."), arg);
+ return PyErr_Format (PyExc_RuntimeError, _ ("`%s' is not a parameter."),
+ arg);
return gdbpy_parameter_value (*cmd->var);
}
@@ -661,20 +643,18 @@ execute_gdb_command (PyObject *self, PyObject *args, PyObject *kw)
std::string arg_copy = arg;
bool first = true;
char *save_ptr = nullptr;
- auto reader
- = [&] (std::string &buffer)
- {
- const char *result = strtok_r (first ? &arg_copy[0] : nullptr,
- "\n", &save_ptr);
- first = false;
- return result;
- };
+ auto reader = [&] (std::string &buffer) {
+ const char *result
+ = strtok_r (first ? &arg_copy[0] : nullptr, "\n", &save_ptr);
+ first = false;
+ return result;
+ };
counted_command_line lines = read_command_lines_1 (reader, 1, nullptr);
{
- scoped_restore save_async = make_scoped_restore (&current_ui->async,
- 0);
+ scoped_restore save_async
+ = make_scoped_restore (&current_ui->async, 0);
scoped_restore save_uiout = make_scoped_restore (&current_uiout);
@@ -684,8 +664,8 @@ execute_gdb_command (PyObject *self, PyObject *args, PyObject *kw)
current_uiout = interp->interp_ui_out ();
if (to_string)
- to_string_res = execute_control_commands_to_string (lines.get (),
- from_tty);
+ to_string_res
+ = execute_control_commands_to_string (lines.get (), from_tty);
else
execute_control_commands (lines.get (), from_tty);
}
@@ -732,13 +712,12 @@ gdbpy_rbreak (PyObject *self, PyObject *args, PyObject *kw)
PyObject *minsyms_p_obj = NULL;
int minsyms_p = 0;
unsigned int throttle = 0;
- static const char *keywords[] = {"regex","minsyms", "throttle",
- "symtabs", NULL};
+ static const char *keywords[]
+ = { "regex", "minsyms", "throttle", "symtabs", NULL };
- if (!gdb_PyArg_ParseTupleAndKeywords (args, kw, "s|O!IO", keywords,
- &regex, &PyBool_Type,
- &minsyms_p_obj, &throttle,
- &symtab_list))
+ if (!gdb_PyArg_ParseTupleAndKeywords (args, kw, "s|O!IO", keywords, &regex,
+ &PyBool_Type, &minsyms_p_obj,
+ &throttle, &symtab_list))
return NULL;
/* Parse minsyms keyword. */
@@ -751,7 +730,8 @@ gdbpy_rbreak (PyObject *self, PyObject *args, PyObject *kw)
}
global_symbol_searcher spec (FUNCTIONS_DOMAIN, regex);
- SCOPE_EXIT {
+ SCOPE_EXIT
+ {
for (const char *elem : spec.filenames)
xfree ((void *) elem);
};
@@ -793,8 +773,8 @@ gdbpy_rbreak (PyObject *self, PyObject *args, PyObject *kw)
if (obj_name == Py_None)
continue;
- gdb::unique_xmalloc_ptr<char> filename =
- python_string_to_target_string (obj_name.get ());
+ gdb::unique_xmalloc_ptr<char> filename
+ = python_string_to_target_string (obj_name.get ());
if (filename == NULL)
return NULL;
@@ -828,7 +808,7 @@ gdbpy_rbreak (PyObject *self, PyObject *args, PyObject *kw)
if (throttle != 0 && count > throttle)
{
PyErr_SetString (PyExc_RuntimeError,
- _("Number of breakpoints exceeds throttled maximum."));
+ _ ("Number of breakpoints exceeds throttled maximum."));
return NULL;
}
@@ -855,16 +835,15 @@ gdbpy_rbreak (PyObject *self, PyObject *args, PyObject *kw)
const char *fullname = symtab_to_fullname (symtab);
symbol_name = fullname;
- symbol_name += ":";
- symbol_name += p.symbol->linkage_name ();
+ symbol_name += ":";
+ symbol_name += p.symbol->linkage_name ();
}
else
symbol_name = p.msymbol.minsym->linkage_name ();
- gdbpy_ref<> argList (Py_BuildValue("(s)", symbol_name.c_str ()));
- gdbpy_ref<> obj (PyObject_CallObject ((PyObject *)
- &breakpoint_object_type,
- argList.get ()));
+ gdbpy_ref<> argList (Py_BuildValue ("(s)", symbol_name.c_str ()));
+ gdbpy_ref<> obj (PyObject_CallObject (
+ (PyObject *) &breakpoint_object_type, argList.get ()));
/* Tolerate individual breakpoint failures. */
if (obj == NULL)
@@ -888,7 +867,7 @@ gdbpy_decode_line (PyObject *self, PyObject *args)
gdbpy_ref<> unparsed;
location_spec_up locspec;
- if (! PyArg_ParseTuple (args, "|s", &arg))
+ if (!PyArg_ParseTuple (args, "|s", &arg))
return NULL;
/* Treat a string consisting of just whitespace the same as
@@ -1003,15 +982,13 @@ gdbpy_invalidate_cached_frames (PyObject *self, PyObject *args)
the traceback and clear the error indicator. */
static void
-gdbpy_source_script (const struct extension_language_defn *extlang,
- FILE *file, const char *filename)
+gdbpy_source_script (const struct extension_language_defn *extlang, FILE *file,
+ const char *filename)
{
gdbpy_enter enter_py;
python_run_simple_file (file, filename);
}
-
-
/* Posting and handling events. */
/* A single event. */
@@ -1071,8 +1048,7 @@ gdbpy_post_event (PyObject *self, PyObject *args)
if (!PyCallable_Check (func))
{
- PyErr_SetString (PyExc_RuntimeError,
- _("Posted event is not callable"));
+ PyErr_SetString (PyExc_RuntimeError, _ ("Posted event is not callable"));
return NULL;
}
@@ -1083,8 +1059,6 @@ gdbpy_post_event (PyObject *self, PyObject *args)
Py_RETURN_NONE;
}
-
-
/* This is the extension_language_ops.before_prompt "method". */
static enum ext_lang_rc
@@ -1113,16 +1087,16 @@ gdbpy_before_prompt_hook (const struct extension_language_defn *extlang,
if (PyCallable_Check (hook.get ()))
{
- gdbpy_ref<> current_prompt (PyUnicode_FromString (current_gdb_prompt));
+ gdbpy_ref<> current_prompt (
+ PyUnicode_FromString (current_gdb_prompt));
if (current_prompt == NULL)
{
gdbpy_print_stack ();
return EXT_LANG_RC_ERROR;
}
- gdbpy_ref<> result
- (PyObject_CallFunctionObjArgs (hook.get (), current_prompt.get (),
- NULL));
+ gdbpy_ref<> result (PyObject_CallFunctionObjArgs (
+ hook.get (), current_prompt.get (), NULL));
if (result == NULL)
{
gdbpy_print_stack ();
@@ -1135,16 +1109,16 @@ gdbpy_before_prompt_hook (const struct extension_language_defn *extlang,
if (result != Py_None && !PyUnicode_Check (result.get ()))
{
PyErr_Format (PyExc_RuntimeError,
- _("Return from prompt_hook must " \
- "be either a Python string, or None"));
+ _ ("Return from prompt_hook must "
+ "be either a Python string, or None"));
gdbpy_print_stack ();
return EXT_LANG_RC_ERROR;
}
if (result != Py_None)
{
- gdb::unique_xmalloc_ptr<char>
- prompt (python_string_to_host_string (result.get ()));
+ gdb::unique_xmalloc_ptr<char> prompt (
+ python_string_to_host_string (result.get ()));
if (prompt == NULL)
{
@@ -1215,10 +1189,8 @@ gdbpy_colorize (const std::string &filename, const std::string &contents)
contents (a bytes object). This function should return either a bytes
object, the same contents with styling applied, or None to indicate
that no styling should be performed. */
- gdbpy_ref<> result (PyObject_CallFunctionObjArgs (hook.get (),
- fname_arg.get (),
- contents_arg.get (),
- nullptr));
+ gdbpy_ref<> result (PyObject_CallFunctionObjArgs (
+ hook.get (), fname_arg.get (), contents_arg.get (), nullptr));
if (result == nullptr)
{
gdbpy_print_stack ();
@@ -1229,8 +1201,10 @@ gdbpy_colorize (const std::string &filename, const std::string &contents)
return {};
else if (!PyBytes_Check (result.get ()))
{
- PyErr_SetString (PyExc_TypeError,
- _("Return value from gdb.colorize should be a bytes object or None."));
+ PyErr_SetString (
+ PyExc_TypeError,
+ _ (
+ "Return value from gdb.colorize should be a bytes object or None."));
gdbpy_print_stack ();
return {};
}
@@ -1258,8 +1232,7 @@ gdbpy_colorize_disasm (const std::string &content, gdbarch *gdbarch)
if (!PyObject_HasAttrString (module.get (), "colorize_disasm"))
return {};
- gdbpy_ref<> hook (PyObject_GetAttrString (module.get (),
- "colorize_disasm"));
+ gdbpy_ref<> hook (PyObject_GetAttrString (module.get (), "colorize_disasm"));
if (hook == nullptr)
{
gdbpy_print_stack ();
@@ -1283,10 +1256,8 @@ gdbpy_colorize_disasm (const std::string &content, gdbarch *gdbarch)
return {};
}
- gdbpy_ref<> result (PyObject_CallFunctionObjArgs (hook.get (),
- content_arg.get (),
- gdbarch_arg.get (),
- nullptr));
+ gdbpy_ref<> result (PyObject_CallFunctionObjArgs (
+ hook.get (), content_arg.get (), gdbarch_arg.get (), nullptr));
if (result == nullptr)
{
gdbpy_print_stack ();
@@ -1299,7 +1270,8 @@ gdbpy_colorize_disasm (const std::string &content, gdbarch *gdbarch)
if (!PyBytes_Check (result.get ()))
{
PyErr_SetString (PyExc_TypeError,
- _("Return value from gdb.colorize_disasm should be a bytes object or None."));
+ _ ("Return value from gdb.colorize_disasm should be a "
+ "bytes object or None."));
gdbpy_print_stack ();
return {};
}
@@ -1307,8 +1279,6 @@ gdbpy_colorize_disasm (const std::string &content, gdbarch *gdbarch)
return std::string (PyBytes_AsString (result.get ()));
}
-
-
/* Implement gdb.format_address(ADDR,P_SPACE,ARCH). Provide access to
GDB's print_address function from Python. The returned address will
have the format '0x..... <symbol+offset>'. */
@@ -1316,17 +1286,15 @@ gdbpy_colorize_disasm (const std::string &content, gdbarch *gdbarch)
static PyObject *
gdbpy_format_address (PyObject *self, PyObject *args, PyObject *kw)
{
- static const char *keywords[] =
- {
- "address", "progspace", "architecture", nullptr
- };
+ static const char *keywords[]
+ = { "address", "progspace", "architecture", nullptr };
PyObject *addr_obj = nullptr, *pspace_obj = nullptr, *arch_obj = nullptr;
CORE_ADDR addr;
struct gdbarch *gdbarch = nullptr;
struct program_space *pspace = nullptr;
- if (!gdb_PyArg_ParseTupleAndKeywords (args, kw, "O|OO", keywords,
- &addr_obj, &pspace_obj, &arch_obj))
+ if (!gdb_PyArg_ParseTupleAndKeywords (args, kw, "O|OO", keywords, &addr_obj,
+ &pspace_obj, &arch_obj))
return nullptr;
if (get_addr_from_python (addr_obj, &addr) < 0)
@@ -1356,8 +1324,9 @@ gdbpy_format_address (PyObject *self, PyObject *args, PyObject *kw)
default, but it feels like there's too much scope of mistakes in
this case, so better to require the user to provide both
arguments. */
- PyErr_SetString (PyExc_ValueError,
- _("The architecture and progspace arguments must both be supplied"));
+ PyErr_SetString (
+ PyExc_ValueError,
+ _ ("The architecture and progspace arguments must both be supplied"));
return nullptr;
}
else
@@ -1366,8 +1335,9 @@ gdbpy_format_address (PyObject *self, PyObject *args, PyObject *kw)
Just check that these objects are valid. */
if (!gdbpy_is_progspace (pspace_obj))
{
- PyErr_SetString (PyExc_TypeError,
- _("The progspace argument is not a gdb.Progspace object"));
+ PyErr_SetString (
+ PyExc_TypeError,
+ _ ("The progspace argument is not a gdb.Progspace object"));
return nullptr;
}
@@ -1375,14 +1345,15 @@ gdbpy_format_address (PyObject *self, PyObject *args, PyObject *kw)
if (pspace == nullptr)
{
PyErr_SetString (PyExc_ValueError,
- _("The progspace argument is not valid"));
+ _ ("The progspace argument is not valid"));
return nullptr;
}
if (!gdbpy_is_architecture (arch_obj))
{
- PyErr_SetString (PyExc_TypeError,
- _("The architecture argument is not a gdb.Architecture object"));
+ PyErr_SetString (
+ PyExc_TypeError,
+ _ ("The architecture argument is not a gdb.Architecture object"));
return nullptr;
}
@@ -1408,8 +1379,6 @@ gdbpy_format_address (PyObject *self, PyObject *args, PyObject *kw)
return PyUnicode_FromString (buf.c_str ());
}
-
-
/* Printing. */
/* A python function to write a single string using gdb's filtered
@@ -1501,7 +1470,6 @@ gdbpy_print_python_errors_p (void)
void
gdbpy_print_stack (void)
{
-
/* Print "none", just clear exception. */
if (gdbpy_should_print_stack == python_excp_none)
{
@@ -1541,13 +1509,13 @@ gdbpy_print_stack (void)
/* An error occurred computing the string representation of the
error message. */
gdb_printf (gdb_stderr,
- _("Error occurred computing Python error" \
- "message.\n"));
+ _ ("Error occurred computing Python error"
+ "message.\n"));
PyErr_Clear ();
}
else
- gdb_printf (gdb_stderr, "Python Exception %s: %s\n",
- type.get (), msg.get ());
+ gdb_printf (gdb_stderr, "Python Exception %s: %s\n", type.get (),
+ msg.get ());
}
catch (const gdb_exception &except)
{
@@ -1569,8 +1537,6 @@ gdbpy_print_stack_or_quit ()
gdbpy_print_stack ();
}
-
-
/* Return a sequence holding all the Progspaces. */
static PyObject *
@@ -1599,8 +1565,6 @@ gdbpy_current_language (PyObject *unused1, PyObject *unused2)
return host_string_to_python_string (current_language->name ()).release ();
}
-
-
/* See python.h. */
struct objfile *gdbpy_current_objfile;
@@ -1651,7 +1615,7 @@ gdbpy_execute_objfile_script (const struct extension_language_defn *extlang,
static PyObject *
gdbpy_get_current_objfile (PyObject *unused1, PyObject *unused2)
{
- if (! gdbpy_current_objfile)
+ if (!gdbpy_current_objfile)
Py_RETURN_NONE;
return objfile_to_objfile_object (gdbpy_current_objfile).release ();
@@ -1740,10 +1704,8 @@ gdbpy_apply_type_printers (const struct extension_language_defn *extlang,
return EXT_LANG_RC_ERROR;
}
- gdbpy_ref<> result_obj (PyObject_CallFunctionObjArgs (func.get (),
- printers_obj,
- type_obj.get (),
- (char *) NULL));
+ gdbpy_ref<> result_obj (PyObject_CallFunctionObjArgs (
+ func.get (), printers_obj, type_obj.get (), (char *) NULL));
if (result_obj == NULL)
{
gdbpy_print_stack ();
@@ -1793,7 +1755,7 @@ python_interactive_command (const char *arg, int from_tty)
{
arg = skip_spaces (arg);
if (arg && *arg)
- error (_("Python scripting is not supported in this copy of GDB."));
+ error (_ ("Python scripting is not supported in this copy of GDB."));
else
{
counted_command_line l = get_command_line (python_control, "");
@@ -1821,8 +1783,7 @@ static void
show_python_ignore_environment (struct ui_file *file, int from_tty,
struct cmd_list_element *c, const char *value)
{
- gdb_printf (file, _("Python's ignore-environment setting is %s.\n"),
- value);
+ gdb_printf (file, _ ("Python's ignore-environment setting is %s.\n"), value);
}
/* Implement 'set python ignore-environment'. This sets Python's internal
@@ -1859,14 +1820,17 @@ show_python_dont_write_bytecode (struct ui_file *file, int from_tty,
{
const char *auto_string
= (python_ignore_environment
- || getenv ("PYTHONDONTWRITEBYTECODE") == nullptr) ? "off" : "on";
+ || getenv ("PYTHONDONTWRITEBYTECODE") == nullptr)
+ ? "off"
+ : "on";
- gdb_printf (file,
- _("Python's dont-write-bytecode setting is %s (currently %s).\n"),
- value, auto_string);
+ gdb_printf (
+ file,
+ _ ("Python's dont-write-bytecode setting is %s (currently %s).\n"),
+ value, auto_string);
}
else
- gdb_printf (file, _("Python's dont-write-bytecode setting is %s.\n"),
+ gdb_printf (file, _ ("Python's dont-write-bytecode setting is %s.\n"),
value);
}
@@ -1917,8 +1881,6 @@ set_python_dont_write_bytecode (const char *args, int from_tty,
#endif /* HAVE_PYTHON */
}
-
-
/* Lists for 'set python' commands. */
static struct cmd_list_element *user_set_python_list;
@@ -1957,23 +1919,21 @@ finalize_python (void *ignore)
restore_active_ext_lang (previous_active);
}
-static struct PyModuleDef python_GdbModuleDef =
-{
- PyModuleDef_HEAD_INIT,
- "_gdb",
- NULL,
- -1,
- python_GdbMethods,
- NULL,
- NULL,
- NULL,
- NULL
-};
+static struct PyModuleDef python_GdbModuleDef = { PyModuleDef_HEAD_INIT,
+ "_gdb",
+ NULL,
+ -1,
+ python_GdbMethods,
+ NULL,
+ NULL,
+ NULL,
+ NULL };
/* This is called via the PyImport_AppendInittab mechanism called
during initialization, to make the built-in _gdb module known to
Python. */
PyMODINIT_FUNC init__gdb_module (void);
+
PyMODINIT_FUNC
init__gdb_module (void)
{
@@ -2020,12 +1980,9 @@ do_start_initialization ()
{
/* Define all internal modules. These are all imported (and thus
created) during initialization. */
- struct _inittab mods[] =
- {
- { "_gdb", init__gdb_module },
- { "_gdbevents", gdbpy_events_mod_func },
- { nullptr, nullptr }
- };
+ struct _inittab mods[] = { { "_gdb", init__gdb_module },
+ { "_gdbevents", gdbpy_events_mod_func },
+ { nullptr, nullptr } };
if (PyImport_ExtendInittab (mods) < 0)
return false;
@@ -2037,9 +1994,9 @@ do_start_initialization ()
/foo/bin/python
/foo/lib/pythonX.Y/...
This must be done before calling Py_Initialize. */
- gdb::unique_xmalloc_ptr<char> progname
- (concat (ldirname (python_libdir.c_str ()).c_str (), SLASH_STRING, "bin",
- SLASH_STRING, "python", (char *) NULL));
+ gdb::unique_xmalloc_ptr<char> progname (
+ concat (ldirname (python_libdir.c_str ()).c_str (), SLASH_STRING, "bin",
+ SLASH_STRING, "python", (char *) NULL));
/* Python documentation indicates that the memory given
to Py_SetProgramName cannot be freed. However, it seems that
at least Python 3.7.4 Py_SetProgramName takes a copy of the
@@ -2073,8 +2030,8 @@ do_start_initialization ()
PyConfig config;
PyConfig_InitPythonConfig (&config);
- PyStatus status = PyConfig_SetString (&config, &config.program_name,
- progname_copy);
+ PyStatus status
+ = PyConfig_SetString (&config, &config.program_name, progname_copy);
if (PyStatus_Exception (status))
goto init_done;
@@ -2109,8 +2066,8 @@ init_done:
if (PyModule_AddStringConstant (gdb_module, "VERSION", version) < 0
|| PyModule_AddStringConstant (gdb_module, "HOST_CONFIG", host_name) < 0
- || PyModule_AddStringConstant (gdb_module, "TARGET_CONFIG",
- target_name) < 0)
+ || PyModule_AddStringConstant (gdb_module, "TARGET_CONFIG", target_name)
+ < 0)
return false;
/* Add stream constants. */
@@ -2124,58 +2081,47 @@ init_done:
|| gdb_pymodule_addobject (gdb_module, "error", gdbpy_gdb_error) < 0)
return false;
- gdbpy_gdb_memory_error = PyErr_NewException ("gdb.MemoryError",
- gdbpy_gdb_error, NULL);
+ gdbpy_gdb_memory_error
+ = PyErr_NewException ("gdb.MemoryError", gdbpy_gdb_error, NULL);
if (gdbpy_gdb_memory_error == NULL
|| gdb_pymodule_addobject (gdb_module, "MemoryError",
- gdbpy_gdb_memory_error) < 0)
+ gdbpy_gdb_memory_error)
+ < 0)
return false;
gdbpy_gdberror_exc = PyErr_NewException ("gdb.GdbError", NULL, NULL);
if (gdbpy_gdberror_exc == NULL
- || gdb_pymodule_addobject (gdb_module, "GdbError",
- gdbpy_gdberror_exc) < 0)
+ || gdb_pymodule_addobject (gdb_module, "GdbError", gdbpy_gdberror_exc)
+ < 0)
return false;
gdbpy_initialize_gdb_readline ();
- if (gdbpy_initialize_auto_load () < 0
- || gdbpy_initialize_values () < 0
- || gdbpy_initialize_disasm () < 0
- || gdbpy_initialize_frames () < 0
+ if (gdbpy_initialize_auto_load () < 0 || gdbpy_initialize_values () < 0
+ || gdbpy_initialize_disasm () < 0 || gdbpy_initialize_frames () < 0
|| gdbpy_initialize_commands () < 0
- || gdbpy_initialize_instruction () < 0
- || gdbpy_initialize_record () < 0
- || gdbpy_initialize_btrace () < 0
- || gdbpy_initialize_symbols () < 0
- || gdbpy_initialize_symtabs () < 0
- || gdbpy_initialize_blocks () < 0
+ || gdbpy_initialize_instruction () < 0 || gdbpy_initialize_record () < 0
+ || gdbpy_initialize_btrace () < 0 || gdbpy_initialize_symbols () < 0
+ || gdbpy_initialize_symtabs () < 0 || gdbpy_initialize_blocks () < 0
|| gdbpy_initialize_functions () < 0
- || gdbpy_initialize_parameters () < 0
- || gdbpy_initialize_types () < 0
- || gdbpy_initialize_pspace () < 0
- || gdbpy_initialize_objfile () < 0
+ || gdbpy_initialize_parameters () < 0 || gdbpy_initialize_types () < 0
+ || gdbpy_initialize_pspace () < 0 || gdbpy_initialize_objfile () < 0
|| gdbpy_initialize_breakpoints () < 0
|| gdbpy_initialize_breakpoint_locations () < 0
|| gdbpy_initialize_finishbreakpoints () < 0
|| gdbpy_initialize_lazy_string () < 0
- || gdbpy_initialize_linetable () < 0
- || gdbpy_initialize_thread () < 0
+ || gdbpy_initialize_linetable () < 0 || gdbpy_initialize_thread () < 0
|| gdbpy_initialize_inferior () < 0
- || gdbpy_initialize_eventregistry () < 0
- || gdbpy_initialize_event () < 0
- || gdbpy_initialize_arch () < 0
- || gdbpy_initialize_registers () < 0
- || gdbpy_initialize_xmethods () < 0
- || gdbpy_initialize_unwind () < 0
- || gdbpy_initialize_membuf () < 0
- || gdbpy_initialize_connection () < 0
- || gdbpy_initialize_tui () < 0
- || gdbpy_initialize_micommands () < 0)
+ || gdbpy_initialize_eventregistry () < 0 || gdbpy_initialize_event () < 0
+ || gdbpy_initialize_arch () < 0 || gdbpy_initialize_registers () < 0
+ || gdbpy_initialize_xmethods () < 0 || gdbpy_initialize_unwind () < 0
+ || gdbpy_initialize_membuf () < 0 || gdbpy_initialize_connection () < 0
+ || gdbpy_initialize_tui () < 0 || gdbpy_initialize_micommands () < 0)
return false;
-#define GDB_PY_DEFINE_EVENT_TYPE(name, py_name, doc, base) \
- if (gdbpy_initialize_event_generic (&name##_event_object_type, py_name) < 0) \
+#define GDB_PY_DEFINE_EVENT_TYPE(name, py_name, doc, base) \
+ if (gdbpy_initialize_event_generic (&name##_event_object_type, py_name) \
+ < 0) \
return false;
#include "py-event-types.def"
#undef GDB_PY_DEFINE_EVENT_TYPE
@@ -2212,7 +2158,8 @@ init_done:
}
#if GDB_SELF_TEST
-namespace selftests {
+namespace selftests
+{
/* Entry point for python unit tests. */
@@ -2248,9 +2195,8 @@ test_python ()
saw_exception = false;
{
- scoped_restore save_hook
- = make_scoped_restore (&hook_set_active_ext_lang,
- []() { raise (SIGINT); });
+ scoped_restore save_hook = make_scoped_restore (&hook_set_active_ext_lang,
+ [] () { raise (SIGINT); });
try
{
CMD (output);
@@ -2286,14 +2232,14 @@ test_python ()
cmd_list_element *python_cmd_element = nullptr;
void _initialize_python ();
+
void
_initialize_python ()
{
cmd_list_element *python_interactive_cmd
- = add_com ("python-interactive", class_obscure,
- python_interactive_command,
+ = add_com ("python-interactive", class_obscure, python_interactive_command,
#ifdef HAVE_PYTHON
- _("\
+ _ ("\
Start an interactive Python prompt.\n\
\n\
To return to GDB, type the EOF character (e.g., Ctrl-D on an empty\n\
@@ -2305,19 +2251,19 @@ printed. For example:\n\
\n\
(gdb) python-interactive 2 + 3\n\
5")
-#else /* HAVE_PYTHON */
- _("\
+#else /* HAVE_PYTHON */
+ _ ("\
Start a Python interactive prompt.\n\
\n\
Python scripting is not supported in this copy of GDB.\n\
This command is only a placeholder.")
#endif /* HAVE_PYTHON */
- );
+ );
add_com_alias ("pi", python_interactive_cmd, class_obscure, 1);
python_cmd_element = add_com ("python", class_obscure, python_command,
#ifdef HAVE_PYTHON
- _("\
+ _ ("\
Evaluate a Python command.\n\
\n\
The command can be given as an argument, for instance:\n\
@@ -2327,50 +2273,54 @@ The command can be given as an argument, for instance:\n\
If no argument is given, the following lines are read and used\n\
as the Python commands. Type a line containing \"end\" to indicate\n\
the end of the command.")
-#else /* HAVE_PYTHON */
- _("\
+#else /* HAVE_PYTHON */
+ _ ("\
Evaluate a Python command.\n\
\n\
Python scripting is not supported in this copy of GDB.\n\
This command is only a placeholder.")
#endif /* HAVE_PYTHON */
- );
+ );
add_com_alias ("py", python_cmd_element, class_obscure, 1);
/* Add set/show python print-stack. */
add_setshow_prefix_cmd ("python", no_class,
- _("Prefix command for python preference settings."),
- _("Prefix command for python preference settings."),
+ _ ("Prefix command for python preference settings."),
+ _ ("Prefix command for python preference settings."),
&user_set_python_list, &user_show_python_list,
&setlist, &showlist);
add_setshow_enum_cmd ("print-stack", no_class, python_excp_enums,
- &gdbpy_should_print_stack, _("\
-Set mode for Python stack dump on error."), _("\
-Show the mode of Python stack printing on error."), _("\
+ &gdbpy_should_print_stack, _ ("\
+Set mode for Python stack dump on error."),
+ _ ("\
+Show the mode of Python stack printing on error."),
+ _ ("\
none == no stack or message will be printed.\n\
full == a message and a stack will be printed.\n\
message == an error message without a stack will be printed."),
- NULL, NULL,
- &user_set_python_list,
+ NULL, NULL, &user_set_python_list,
&user_show_python_list);
add_setshow_boolean_cmd ("ignore-environment", no_class,
- &python_ignore_environment, _("\
-Set whether the Python interpreter should ignore environment variables."), _(" \
-Show whether the Python interpreter showlist ignore environment variables."), _(" \
+ &python_ignore_environment, _ ("\
+Set whether the Python interpreter should ignore environment variables."),
+ _ (" \
+Show whether the Python interpreter showlist ignore environment variables."),
+ _ (" \
When enabled GDB's Python interpreter will ignore any Python related\n \
flags in the environment. This is equivalent to passing `-E' to a\n \
python executable."),
set_python_ignore_environment,
show_python_ignore_environment,
- &user_set_python_list,
- &user_show_python_list);
+ &user_set_python_list, &user_show_python_list);
add_setshow_auto_boolean_cmd ("dont-write-bytecode", no_class,
- &python_dont_write_bytecode, _("\
-Set whether the Python interpreter should avoid byte-compiling python modules."), _("\
-Show whether the Python interpreter should avoid byte-compiling python modules."), _("\
+ &python_dont_write_bytecode, _ ("\
+Set whether the Python interpreter should avoid byte-compiling python modules."),
+ _ ("\
+Show whether the Python interpreter should avoid byte-compiling python modules."),
+ _ ("\
When enabled, GDB's embedded Python interpreter won't byte-compile python\n\
modules. In order to take effect, this setting must be enabled in an early\n\
initialization file, i.e. those run via the --early-init-eval-command or\n\
@@ -2387,8 +2337,7 @@ environment variable doesn't exist. All other settings, including those\n\
which don't seem to make sense, indicate that it's on/enabled."),
set_python_dont_write_bytecode,
show_python_dont_write_bytecode,
- &user_set_python_list,
- &user_show_python_list);
+ &user_set_python_list, &user_show_python_list);
#ifdef HAVE_PYTHON
#if GDB_SELF_TEST
@@ -2411,8 +2360,8 @@ do_initialize (const struct extension_language_defn *extlang)
/* Add the initial data-directory to sys.path. */
- std::string gdb_pythondir = (std::string (gdb_datadir) + SLASH_STRING
- + "python");
+ std::string gdb_pythondir
+ = (std::string (gdb_datadir) + SLASH_STRING + "python");
sys_path = PySys_GetObject ("path");
@@ -2456,11 +2405,12 @@ do_initialize (const struct extension_language_defn *extlang)
gdbpy_print_stack ();
/* This is passed in one call to warning so that blank lines aren't
inserted between each line of text. */
- warning (_("\n"
- "Could not load the Python gdb module from `%s'.\n"
- "Limited Python support is available from the _gdb module.\n"
- "Suggest passing --data-directory=/path/to/gdb/data-directory."),
- gdb_pythondir.c_str ());
+ warning (
+ _ ("\n"
+ "Could not load the Python gdb module from `%s'.\n"
+ "Limited Python support is available from the _gdb module.\n"
+ "Suggest passing --data-directory=/path/to/gdb/data-directory."),
+ gdb_pythondir.c_str ());
/* We return "success" here as we've already emitted the
warning. */
return true;
@@ -2484,7 +2434,7 @@ gdbpy_initialize (const struct extension_language_defn *extlang)
if (!do_initialize (extlang))
{
gdbpy_print_stack ();
- warning (_("internal error: Unhandled Python exception"));
+ warning (_ ("internal error: Unhandled Python exception"));
}
}
@@ -2497,10 +2447,8 @@ gdbpy_initialized (const struct extension_language_defn *extlang)
return gdb_python_initialized;
}
-PyMethodDef python_GdbMethods[] =
-{
- { "history", gdbpy_history, METH_VARARGS,
- "Get a value from history" },
+PyMethodDef python_GdbMethods[] = {
+ { "history", gdbpy_history, METH_VARARGS, "Get a value from history" },
{ "add_history", gdbpy_add_history, METH_VARARGS,
"Add a value to the value history list" },
{ "history_count", gdbpy_history_count, METH_NOARGS,
@@ -2539,7 +2487,7 @@ Return a string explaining unwind stop reason." },
"start_recording ([method] [, format]) -> gdb.Record.\n\
Start recording with the given method. If no method is given, will fall back\n\
to the system default method. If no format is given, will fall back to the\n\
-default format for the given method."},
+default format for the given method." },
{ "current_recording", gdbpy_current_recording, METH_NOARGS,
"current_recording () -> gdb.Record.\n\
Return current recording object." },
@@ -2548,8 +2496,7 @@ Return current recording object." },
Stop current recording." },
{ "lookup_type", (PyCFunction) gdbpy_lookup_type,
- METH_VARARGS | METH_KEYWORDS,
- "lookup_type (name [, block]) -> type\n\
+ METH_VARARGS | METH_KEYWORDS, "lookup_type (name [, block]) -> type\n\
Return a Type corresponding to the given name." },
{ "lookup_symbol", (PyCFunction) gdbpy_lookup_symbol,
METH_VARARGS | METH_KEYWORDS,
@@ -2583,11 +2530,10 @@ that 'break' or 'edit' does. Return a tuple containing two elements.\n\
The first element contains any unparsed portion of the String parameter\n\
(or None if the string was fully parsed). The second element contains\n\
a tuple that contains all the locations that match, represented as\n\
-gdb.Symtab_and_line objects (or None)."},
+gdb.Symtab_and_line objects (or None)." },
{ "parse_and_eval", gdbpy_parse_and_eval, METH_VARARGS,
"parse_and_eval (String) -> Value.\n\
-Parse String as an expression, evaluate it, and return the result as a Value."
- },
+Parse String as an expression, evaluate it, and return the result as a Value." },
{ "post_event", gdbpy_post_event, METH_VARARGS,
"Post an event into gdb's event loop." },
@@ -2607,11 +2553,10 @@ Return a Tuple containing gdb.Breakpoint objects that match the given Regex." },
{ "string_to_argv", gdbpy_string_to_argv, METH_VARARGS,
"string_to_argv (String) -> Array.\n\
Parse String and return an argv-like array.\n\
-Arguments are separate by spaces and may be quoted."
- },
- { "write", (PyCFunction)gdbpy_write, METH_VARARGS | METH_KEYWORDS,
+Arguments are separate by spaces and may be quoted." },
+ { "write", (PyCFunction) gdbpy_write, METH_VARARGS | METH_KEYWORDS,
"Write a string using gdb's filtered stream." },
- { "flush", (PyCFunction)gdbpy_flush, METH_VARARGS | METH_KEYWORDS,
+ { "flush", (PyCFunction) gdbpy_flush, METH_VARARGS | METH_KEYWORDS,
"Flush gdb's filtered stdout stream." },
{ "selected_thread", gdbpy_selected_thread, METH_NOARGS,
"selected_thread () -> gdb.InferiorThread.\n\
@@ -2641,14 +2586,13 @@ Set the value of the convenience variable $NAME." },
METH_VARARGS | METH_KEYWORDS,
"register_window_type (NAME, CONSTRUCSTOR) -> None\n\
Register a TUI window constructor." },
-#endif /* TUI */
+#endif /* TUI */
{ "architecture_names", gdbpy_all_architecture_names, METH_NOARGS,
"architecture_names () -> List.\n\
Return a list of all the architecture names GDB understands." },
- { "connections", gdbpy_connections, METH_NOARGS,
- "connections () -> List.\n\
+ { "connections", gdbpy_connections, METH_NOARGS, "connections () -> List.\n\
Return a list of gdb.TargetConnection objects." },
{ "format_address", (PyCFunction) gdbpy_format_address,
@@ -2666,52 +2610,51 @@ Return the name of the currently selected language." },
"print_options () -> dict\n\
Return the current print options." },
- {NULL, NULL, 0, NULL}
+ { NULL, NULL, 0, NULL }
};
/* Define all the event objects. */
-#define GDB_PY_DEFINE_EVENT_TYPE(name, py_name, doc, base) \
- PyTypeObject name##_event_object_type \
- CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF ("event_object") \
- = { \
- PyVarObject_HEAD_INIT (NULL, 0) \
- "gdb." py_name, /* tp_name */ \
- sizeof (event_object), /* tp_basicsize */ \
- 0, /* tp_itemsize */ \
- evpy_dealloc, /* tp_dealloc */ \
- 0, /* tp_print */ \
- 0, /* tp_getattr */ \
- 0, /* tp_setattr */ \
- 0, /* tp_compare */ \
- 0, /* tp_repr */ \
- 0, /* tp_as_number */ \
- 0, /* tp_as_sequence */ \
- 0, /* tp_as_mapping */ \
- 0, /* tp_hash */ \
- 0, /* tp_call */ \
- 0, /* tp_str */ \
- 0, /* tp_getattro */ \
- 0, /* tp_setattro */ \
- 0, /* tp_as_buffer */ \
- Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ \
- doc, /* tp_doc */ \
- 0, /* tp_traverse */ \
- 0, /* tp_clear */ \
- 0, /* tp_richcompare */ \
- 0, /* tp_weaklistoffset */ \
- 0, /* tp_iter */ \
- 0, /* tp_iternext */ \
- 0, /* tp_methods */ \
- 0, /* tp_members */ \
- 0, /* tp_getset */ \
- &base, /* tp_base */ \
- 0, /* tp_dict */ \
- 0, /* tp_descr_get */ \
- 0, /* tp_descr_set */ \
- 0, /* tp_dictoffset */ \
- 0, /* tp_init */ \
- 0 /* tp_alloc */ \
- };
+#define GDB_PY_DEFINE_EVENT_TYPE(name, py_name, doc, base) \
+ PyTypeObject name##_event_object_type CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF ( \
+ "event_object") \
+ = { \
+ PyVarObject_HEAD_INIT (NULL, 0) "gdb." py_name, /* tp_name */ \
+ sizeof (event_object), /* tp_basicsize */ \
+ 0, /* tp_itemsize */ \
+ evpy_dealloc, /* tp_dealloc */ \
+ 0, /* tp_print */ \
+ 0, /* tp_getattr */ \
+ 0, /* tp_setattr */ \
+ 0, /* tp_compare */ \
+ 0, /* tp_repr */ \
+ 0, /* tp_as_number */ \
+ 0, /* tp_as_sequence */ \
+ 0, /* tp_as_mapping */ \
+ 0, /* tp_hash */ \
+ 0, /* tp_call */ \
+ 0, /* tp_str */ \
+ 0, /* tp_getattro */ \
+ 0, /* tp_setattro */ \
+ 0, /* tp_as_buffer */ \
+ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ \
+ doc, /* tp_doc */ \
+ 0, /* tp_traverse */ \
+ 0, /* tp_clear */ \
+ 0, /* tp_richcompare */ \
+ 0, /* tp_weaklistoffset */ \
+ 0, /* tp_iter */ \
+ 0, /* tp_iternext */ \
+ 0, /* tp_methods */ \
+ 0, /* tp_members */ \
+ 0, /* tp_getset */ \
+ &base, /* tp_base */ \
+ 0, /* tp_dict */ \
+ 0, /* tp_descr_get */ \
+ 0, /* tp_descr_set */ \
+ 0, /* tp_dictoffset */ \
+ 0, /* tp_init */ \
+ 0 /* tp_alloc */ \
+ };
#include "py-event-types.def"
#undef GDB_PY_DEFINE_EVENT_TYPE
diff --git a/gdb/quick-symbol.h b/gdb/quick-symbol.h
index a7fea2ccb49..288799c5ea4 100644
--- a/gdb/quick-symbol.h
+++ b/gdb/quick-symbol.h
@@ -32,8 +32,7 @@ DEF_ENUM_FLAGS_TYPE (enum block_search_flag_values, block_search_flags);
/* Comparison function for symbol look ups. */
-typedef int (symbol_compare_ftype) (const char *string1,
- const char *string2);
+typedef int (symbol_compare_ftype) (const char *string1, const char *string2);
/* Callback for quick_symbol_functions->map_symbol_filenames. */
@@ -78,9 +77,7 @@ typedef bool (expand_symtabs_exp_notify_ftype) (compunit_symtab *symtab);
struct quick_symbol_functions
{
- virtual ~quick_symbol_functions ()
- {
- }
+ virtual ~quick_symbol_functions () {}
/* Return true if this objfile has any "partial" symbols
available. */
@@ -105,11 +102,10 @@ struct quick_symbol_functions
If found, sets *symbol_found_p to true and returns the symbol language.
defined, or NULL if no such symbol table exists. */
- virtual enum language lookup_global_symbol_language
- (struct objfile *objfile,
- const char *name,
- domain_enum domain,
- bool *symbol_found_p) = 0;
+ virtual enum language
+ lookup_global_symbol_language (struct objfile *objfile, const char *name,
+ domain_enum domain, bool *symbol_found_p)
+ = 0;
/* Print statistics about any indices loaded for OBJFILE. The
statistics should be printed to gdb_stdout. This is used for
@@ -140,12 +136,11 @@ struct quick_symbol_functions
(allowing strcmp_iw_ordered(x,y) < 0 while ORDERED_COMPARE(x, y) == 0).
*/
- virtual void expand_matching_symbols
- (struct objfile *,
- const lookup_name_info &lookup_name,
- domain_enum domain,
- int global,
- symbol_compare_ftype *ordered_compare) = 0;
+ virtual void expand_matching_symbols (struct objfile *,
+ const lookup_name_info &lookup_name,
+ domain_enum domain, int global,
+ symbol_compare_ftype *ordered_compare)
+ = 0;
/* Expand all symbol tables in OBJFILE matching some criteria.
@@ -175,15 +170,15 @@ struct quick_symbol_functions
returns false, execution stops and this method returns false.
Otherwise, more files are considered. This method will return
true if all calls to the notification function return true. */
- virtual bool expand_symtabs_matching
- (struct objfile *objfile,
- gdb::function_view<expand_symtabs_file_matcher_ftype> file_matcher,
- const lookup_name_info *lookup_name,
- gdb::function_view<expand_symtabs_symbol_matcher_ftype> symbol_matcher,
- gdb::function_view<expand_symtabs_exp_notify_ftype> expansion_notify,
- block_search_flags search_flags,
- domain_enum domain,
- enum search_domain kind) = 0;
+ virtual bool expand_symtabs_matching (
+ struct objfile *objfile,
+ gdb::function_view<expand_symtabs_file_matcher_ftype> file_matcher,
+ const lookup_name_info *lookup_name,
+ gdb::function_view<expand_symtabs_symbol_matcher_ftype> symbol_matcher,
+ gdb::function_view<expand_symtabs_exp_notify_ftype> expansion_notify,
+ block_search_flags search_flags, domain_enum domain,
+ enum search_domain kind)
+ = 0;
/* Return the comp unit from OBJFILE that contains PC and
SECTION. Return NULL if there is no such compunit. This
@@ -191,40 +186,38 @@ struct quick_symbol_functions
address exactly matches PC, or, if there is no exact match, the
compunit that contains a symbol whose address is closest to
PC. */
- virtual struct compunit_symtab *find_pc_sect_compunit_symtab
- (struct objfile *objfile, struct bound_minimal_symbol msymbol,
- CORE_ADDR pc, struct obj_section *section, int warn_if_readin) = 0;
+ virtual struct compunit_symtab *find_pc_sect_compunit_symtab (
+ struct objfile *objfile, struct bound_minimal_symbol msymbol, CORE_ADDR pc,
+ struct obj_section *section, int warn_if_readin)
+ = 0;
/* Return the comp unit from OBJFILE that contains a symbol at
ADDRESS. Return NULL if there is no such comp unit. Unlike
find_pc_sect_compunit_symtab, any sort of symbol (not just text
symbols) can be considered, and only exact address matches are
considered. */
- virtual struct compunit_symtab *find_compunit_symtab_by_address
- (struct objfile *objfile, CORE_ADDR address) = 0;
+ virtual struct compunit_symtab *
+ find_compunit_symtab_by_address (struct objfile *objfile, CORE_ADDR address)
+ = 0;
/* Call a callback for every file defined in OBJFILE whose symtab is
not already read in. FUN is the callback. It is passed the
file's FILENAME and the file's FULLNAME (if need_fullname is
non-zero). */
- virtual void map_symbol_filenames
- (struct objfile *objfile,
- gdb::function_view<symbol_filename_ftype> fun,
- bool need_fullname) = 0;
+ virtual void
+ map_symbol_filenames (struct objfile *objfile,
+ gdb::function_view<symbol_filename_ftype> fun,
+ bool need_fullname)
+ = 0;
/* Return true if this class can lazily read the symbols. This may
only return true if there are in fact symbols to be read, because
this is used in the implementation of 'has_partial_symbols'. */
- virtual bool can_lazily_read_symbols ()
- {
- return false;
- }
+ virtual bool can_lazily_read_symbols () { return false; }
/* Read the partial symbols for OBJFILE. This will only ever be
called if can_lazily_read_symbols returns true. */
- virtual void read_partial_symbols (struct objfile *objfile)
- {
- }
+ virtual void read_partial_symbols (struct objfile *objfile) {}
};
typedef std::unique_ptr<quick_symbol_functions> quick_symbol_functions_up;
diff --git a/gdb/ravenscar-thread.c b/gdb/ravenscar-thread.c
index 22fbdbe9662..662d88873b6 100644
--- a/gdb/ravenscar-thread.c
+++ b/gdb/ravenscar-thread.c
@@ -69,11 +69,8 @@ static const char first_task_name[] = "system__tasking__debug__first_task";
static const char ravenscar_runtime_initializer[]
= "system__bb__threads__initialize";
-static const target_info ravenscar_target_info = {
- "ravenscar",
- N_("Ravenscar tasks."),
- N_("Ravenscar tasks support.")
-};
+static const target_info ravenscar_target_info
+ = { "ravenscar", N_ ("Ravenscar tasks."), N_ ("Ravenscar tasks support.") };
struct ravenscar_thread_target final : public target_ops
{
@@ -82,8 +79,7 @@ struct ravenscar_thread_target final : public target_ops
{
}
- const target_info &info () const override
- { return ravenscar_target_info; }
+ const target_info &info () const override { return ravenscar_target_info; }
strata stratum () const override { return thread_stratum; }
@@ -104,8 +100,7 @@ struct ravenscar_thread_target final : public target_ops
bool stopped_data_address (CORE_ADDR *) override;
enum target_xfer_status xfer_partial (enum target_object object,
- const char *annex,
- gdb_byte *readbuf,
+ const char *annex, gdb_byte *readbuf,
const gdb_byte *writebuf,
ULONGEST offset, ULONGEST len,
ULONGEST *xfered_len) override;
@@ -120,9 +115,8 @@ struct ravenscar_thread_target final : public target_ops
ptid_t get_ada_task_ptid (long lwp, ULONGEST thread) override;
- struct btrace_target_info *enable_btrace (thread_info *tp,
- const struct btrace_config *conf)
- override
+ struct btrace_target_info *
+ enable_btrace (thread_info *tp, const struct btrace_config *conf) override
{
process_stratum_target *proc_target
= as_process_stratum_target (this->beneath ());
@@ -134,10 +128,7 @@ struct ravenscar_thread_target final : public target_ops
void mourn_inferior () override;
- void close () override
- {
- delete this;
- }
+ void close () override { delete this; }
thread_info *add_active_thread ();
@@ -389,8 +380,7 @@ get_running_thread_id (int cpu)
return 0;
object_size = builtin_type_void_data_ptr->length ();
- object_addr = (object_msym.value_address ()
- + (cpu - 1) * object_size);
+ object_addr = (object_msym.value_address () + (cpu - 1) * object_size);
buf_size = object_size;
buf = (gdb_byte *) alloca (buf_size);
read_memory (object_addr, buf, buf_size);
@@ -415,8 +405,7 @@ ravenscar_thread_target::resume (ptid_t ptid, int step,
}
ptid_t
-ravenscar_thread_target::wait (ptid_t ptid,
- struct target_waitstatus *status,
+ravenscar_thread_target::wait (ptid_t ptid, struct target_waitstatus *status,
target_wait_flags options)
{
process_stratum_target *beneath
@@ -465,18 +454,16 @@ ravenscar_thread_target::update_thread_list ()
/* iterate_over_live_ada_tasks requires that inferior_ptid be set,
but this isn't always the case in target methods. So, we ensure
it here. */
- scoped_restore save_ptid = make_scoped_restore (&inferior_ptid,
- m_base_ptid);
+ scoped_restore save_ptid = make_scoped_restore (&inferior_ptid, m_base_ptid);
/* Do not clear the thread list before adding the Ada task, to keep
the thread that the process stratum has included into it
(m_base_ptid) and the running thread, that may not have been included
to system.tasking.debug's list yet. */
- iterate_over_live_ada_tasks ([=] (struct ada_task_info *task)
- {
- this->add_thread (task);
- });
+ iterate_over_live_ada_tasks ([=] (struct ada_task_info *task) {
+ this->add_thread (task);
+ });
}
ptid_t
@@ -518,8 +505,7 @@ ravenscar_arch_ops::get_stack_base (struct regcache *regcache) const
}
void
-ravenscar_arch_ops::supply_one_register (struct regcache *regcache,
- int regnum,
+ravenscar_arch_ops::supply_one_register (struct regcache *regcache, int regnum,
CORE_ADDR descriptor,
CORE_ADDR stack_base) const
{
@@ -545,8 +531,7 @@ ravenscar_arch_ops::fetch_register (struct regcache *regcache,
struct gdbarch *gdbarch = regcache->arch ();
/* The tid is the thread_id field, which is a pointer to the thread. */
- CORE_ADDR thread_descriptor_address
- = (CORE_ADDR) regcache->ptid ().tid ();
+ CORE_ADDR thread_descriptor_address = (CORE_ADDR) regcache->ptid ().tid ();
int sp_regno = -1;
CORE_ADDR stack_address = 0;
@@ -591,8 +576,7 @@ ravenscar_arch_ops::store_register (struct regcache *regcache,
gdb_assert (regnum != -1);
/* The tid is the thread_id field, which is a pointer to the thread. */
- CORE_ADDR thread_descriptor_address
- = (CORE_ADDR) regcache->ptid ().tid ();
+ CORE_ADDR thread_descriptor_address = (CORE_ADDR) regcache->ptid ().tid ();
CORE_ADDR stack_address = 0;
if (regnum >= first_stack_register && regnum <= last_stack_register)
@@ -618,10 +602,7 @@ public:
m_regcache->set_ptid (new_ptid);
}
- ~temporarily_change_regcache_ptid ()
- {
- m_regcache->set_ptid (m_save_ptid);
- }
+ ~temporarily_change_regcache_ptid () { m_regcache->set_ptid (m_save_ptid); }
private:
@@ -661,10 +642,9 @@ ravenscar_thread_target::get_fpu_state (struct regcache *regcache,
CORE_ADDR fpu_task = value_as_long (val);
/* The tid is the thread_id field, which is a pointer to the thread. */
- CORE_ADDR thread_descriptor_address
- = (CORE_ADDR) regcache->ptid ().tid ();
- if (fpu_task == (thread_descriptor_address
- + arch_ops->get_fpu_context_offset ()))
+ CORE_ADDR thread_descriptor_address = (CORE_ADDR) regcache->ptid ().tid ();
+ if (fpu_task
+ == (thread_descriptor_address + arch_ops->get_fpu_context_offset ()))
return LIVE_FP_REGISTERS;
int v_init_offset = arch_ops->get_v_init_offset ();
@@ -850,8 +830,7 @@ ravenscar_thread_target::core_of_thread (ptid_t ptid)
enum target_xfer_status
ravenscar_thread_target::xfer_partial (enum target_object object,
- const char *annex,
- gdb_byte *readbuf,
+ const char *annex, gdb_byte *readbuf,
const gdb_byte *writebuf,
ULONGEST offset, ULONGEST len,
ULONGEST *xfered_len)
@@ -862,8 +841,8 @@ ravenscar_thread_target::xfer_partial (enum target_object object,
internal map, so it should not result in recursive calls in
practice. */
inferior_ptid = get_base_thread_from_ravenscar_task (inferior_ptid);
- return beneath ()->xfer_partial (object, annex, readbuf, writebuf,
- offset, len, xfered_len);
+ return beneath ()->xfer_partial (object, annex, readbuf, writebuf, offset,
+ len, xfered_len);
}
/* Observer on inferior_created: push ravenscar thread stratum if needed. */
@@ -881,7 +860,7 @@ ravenscar_inferior_created (inferior *inf)
err_msg = ada_get_tcb_types_info ();
if (err_msg != NULL)
{
- warning (_("%s. Task/thread support disabled."), err_msg);
+ warning (_ ("%s. Task/thread support disabled."), err_msg);
return;
}
@@ -910,10 +889,10 @@ show_ravenscar_task_switching_command (struct ui_file *file, int from_tty,
const char *value)
{
if (ravenscar_task_support)
- gdb_printf (file, _("\
+ gdb_printf (file, _ ("\
Support for Ravenscar task/thread switching is enabled\n"));
else
- gdb_printf (file, _("\
+ gdb_printf (file, _ ("\
Support for Ravenscar task/thread switching is disabled\n"));
}
@@ -921,6 +900,7 @@ Support for Ravenscar task/thread switching is disabled\n"));
init.c. */
void _initialize_ravenscar ();
+
void
_initialize_ravenscar ()
{
@@ -929,18 +909,18 @@ _initialize_ravenscar ()
gdb::observers::inferior_created.attach (ravenscar_inferior_created,
"ravenscar-thread");
- add_setshow_prefix_cmd
- ("ravenscar", no_class,
- _("Prefix command for changing Ravenscar-specific settings."),
- _("Prefix command for showing Ravenscar-specific settings."),
- &set_ravenscar_list, &show_ravenscar_list,
- &setlist, &showlist);
+ add_setshow_prefix_cmd (
+ "ravenscar", no_class,
+ _ ("Prefix command for changing Ravenscar-specific settings."),
+ _ ("Prefix command for showing Ravenscar-specific settings."),
+ &set_ravenscar_list, &show_ravenscar_list, &setlist, &showlist);
add_setshow_boolean_cmd ("task-switching", class_obscure,
- &ravenscar_task_support, _("\
-Enable or disable support for GNAT Ravenscar tasks."), _("\
+ &ravenscar_task_support, _ ("\
+Enable or disable support for GNAT Ravenscar tasks."),
+ _ ("\
Show whether support for GNAT Ravenscar tasks is enabled."),
- _("\
+ _ ("\
Enable or disable support for task/thread switching with the GNAT\n\
Ravenscar run-time library for bareboard configuration."),
NULL, show_ravenscar_task_switching_command,
diff --git a/gdb/ravenscar-thread.h b/gdb/ravenscar-thread.h
index 739dc5036ca..82bc65ef548 100644
--- a/gdb/ravenscar-thread.h
+++ b/gdb/ravenscar-thread.h
@@ -25,11 +25,8 @@
struct ravenscar_arch_ops
{
ravenscar_arch_ops (gdb::array_view<const int> offsets_,
- int first_stack = -1,
- int last_stack = -1,
- int v_init = -1,
- int fpu_offset = -1,
- int first_fp = -1,
+ int first_stack = -1, int last_stack = -1,
+ int v_init = -1, int fpu_offset = -1, int first_fp = -1,
int last_fp = -1)
: offsets (offsets_),
first_stack_register (first_stack),
@@ -51,8 +48,7 @@ struct ravenscar_arch_ops
/* Return true if this architecture implements on-demand floating
point. */
- bool on_demand_fp () const
- { return v_init_offset != -1; }
+ bool on_demand_fp () const { return v_init_offset != -1; }
/* Return true if REGNUM is a floating-point register for this
target. If this target does not use the on-demand FP scheme,
@@ -118,12 +114,10 @@ private:
/* Helper function to supply one register. */
void supply_one_register (struct regcache *regcache, int regnum,
- CORE_ADDR descriptor,
- CORE_ADDR stack_base) const;
+ CORE_ADDR descriptor, CORE_ADDR stack_base) const;
/* Helper function to store one register. */
void store_one_register (struct regcache *regcache, int regnum,
- CORE_ADDR descriptor,
- CORE_ADDR stack_base) const;
+ CORE_ADDR descriptor, CORE_ADDR stack_base) const;
/* Helper function to find stack address where registers are stored.
This must be called with the stack pointer already supplied in
the register cache. */
diff --git a/gdb/record-btrace.c b/gdb/record-btrace.c
index 0daba893813..05104f03ed8 100644
--- a/gdb/record-btrace.c
+++ b/gdb/record-btrace.c
@@ -45,19 +45,20 @@
#include "async-event.h"
#include <forward_list>
-static const target_info record_btrace_target_info = {
- "record-btrace",
- N_("Branch tracing target"),
- N_("Collect control-flow trace and provide the execution history.")
-};
+static const target_info record_btrace_target_info
+ = { "record-btrace", N_ ("Branch tracing target"),
+ N_ ("Collect control-flow trace and provide the execution history.") };
/* The target_ops of record-btrace. */
class record_btrace_target final : public target_ops
{
public:
+
const target_info &info () const override
- { return record_btrace_target_info; }
+ {
+ return record_btrace_target_info;
+ }
strata stratum () const override { return record_stratum; }
@@ -65,15 +66,15 @@ public:
void async (bool) override;
void detach (inferior *inf, int from_tty) override
- { record_detach (this, inf, from_tty); }
+ {
+ record_detach (this, inf, from_tty);
+ }
void disconnect (const char *, int) override;
- void mourn_inferior () override
- { record_mourn_inferior (this); }
+ void mourn_inferior () override { record_mourn_inferior (this); }
- void kill () override
- { record_kill (this); }
+ void kill () override { record_kill (this); }
enum record_method record_method (ptid_t ptid) override;
@@ -86,24 +87,22 @@ public:
void insn_history_range (ULONGEST begin, ULONGEST end,
gdb_disassembly_flags flags) override;
void call_history (int size, record_print_flags flags) override;
- void call_history_from (ULONGEST begin, int size, record_print_flags flags)
- override;
- void call_history_range (ULONGEST begin, ULONGEST end, record_print_flags flags)
- override;
+ void call_history_from (ULONGEST begin, int size,
+ record_print_flags flags) override;
+ void call_history_range (ULONGEST begin, ULONGEST end,
+ record_print_flags flags) override;
bool record_is_replaying (ptid_t ptid) override;
bool record_will_replay (ptid_t ptid, int dir) override;
void record_stop_replaying () override;
enum target_xfer_status xfer_partial (enum target_object object,
- const char *annex,
- gdb_byte *readbuf,
+ const char *annex, gdb_byte *readbuf,
const gdb_byte *writebuf,
ULONGEST offset, ULONGEST len,
ULONGEST *xfered_len) override;
- int insert_breakpoint (struct gdbarch *,
- struct bp_target_info *) override;
+ int insert_breakpoint (struct gdbarch *, struct bp_target_info *) override;
int remove_breakpoint (struct gdbarch *, struct bp_target_info *,
enum remove_bp_reason) override;
@@ -150,12 +149,8 @@ static const gdb::observers::token record_btrace_thread_observer_token {};
/* Memory access types used in set/show record btrace replay-memory-access. */
static const char replay_memory_access_read_only[] = "read-only";
static const char replay_memory_access_read_write[] = "read-write";
-static const char *const replay_memory_access_types[] =
-{
- replay_memory_access_read_only,
- replay_memory_access_read_write,
- NULL
-};
+static const char *const replay_memory_access_types[]
+ = { replay_memory_access_read_only, replay_memory_access_read_write, NULL };
/* The currently allowed replay memory access type. */
static const char *replay_memory_access = replay_memory_access_read_only;
@@ -207,16 +202,14 @@ static struct cmd_list_element *set_record_btrace_cpu_cmdlist;
/* Print a record-btrace debug message. Use do ... while (0) to avoid
ambiguities when used in if statements. */
-#define DEBUG(msg, args...) \
- do \
- { \
- if (record_debug != 0) \
- gdb_printf (gdb_stdlog, \
- "[record-btrace] " msg "\n", ##args); \
- } \
+#define DEBUG(msg, args...) \
+ do \
+ { \
+ if (record_debug != 0) \
+ gdb_printf (gdb_stdlog, "[record-btrace] " msg "\n", ##args); \
+ } \
while (0)
-
/* Return the cpu configured by the user. Returns NULL if the cpu was
configured as auto. */
const struct btrace_cpu *
@@ -234,7 +227,7 @@ record_btrace_get_cpu (void)
return &record_btrace_cpu;
}
- error (_("Internal error: bad record btrace cpu state."));
+ error (_ ("Internal error: bad record btrace cpu state."));
}
/* Update the branch trace for the current thread and return a pointer to its
@@ -249,7 +242,7 @@ require_btrace_thread (void)
DEBUG ("require");
if (inferior_ptid == null_ptid)
- error (_("No thread."));
+ error (_ ("No thread."));
thread_info *tp = inferior_thread ();
@@ -258,7 +251,7 @@ require_btrace_thread (void)
btrace_fetch (tp, record_btrace_get_cpu ());
if (btrace_is_empty (tp))
- error (_("No trace."));
+ error (_ ("No trace."));
return tp;
}
@@ -346,7 +339,8 @@ record_btrace_push_target (void)
record_btrace_generating_corefile = 0;
format = btrace_format_short_string (record_btrace_conf.format);
- gdb::observers::record_changed.notify (current_inferior (), 1, "btrace", format);
+ gdb::observers::record_changed.notify (current_inferior (), 1, "btrace",
+ format);
}
/* Disable btrace on a set of threads on scope exit. */
@@ -363,17 +357,12 @@ struct scoped_btrace_disable
btrace_disable (tp);
}
- void add_thread (thread_info *thread)
- {
- m_threads.push_front (thread);
- }
+ void add_thread (thread_info *thread) { m_threads.push_front (thread); }
- void discard ()
- {
- m_threads.clear ();
- }
+ void discard () { m_threads.clear (); }
private:
+
std::forward_list<thread_info *> m_threads;
};
@@ -391,7 +380,7 @@ record_btrace_target_open (const char *args, int from_tty)
record_preopen ();
if (!target_has_execution ())
- error (_("The program is not being run."));
+ error (_ ("The program is not being run."));
for (thread_info *tp : current_inferior ()->non_exited_threads ())
if (args == NULL || *args == 0 || number_is_in_list (args, tp->global_num))
@@ -423,8 +412,7 @@ record_btrace_target::stop_recording ()
/* The disconnect method of target record-btrace. */
void
-record_btrace_target::disconnect (const char *args,
- int from_tty)
+record_btrace_target::disconnect (const char *args, int from_tty)
{
struct target_ops *beneath = this->beneath ();
@@ -506,7 +494,7 @@ record_btrace_print_bts_conf (const struct btrace_config_bts *conf)
if (size > 0)
{
suffix = record_btrace_adjust_size (&size);
- gdb_printf (_("Buffer size: %u%s.\n"), size, suffix);
+ gdb_printf (_ ("Buffer size: %u%s.\n"), size, suffix);
}
}
@@ -522,7 +510,7 @@ record_btrace_print_pt_conf (const struct btrace_config_pt *conf)
if (size > 0)
{
suffix = record_btrace_adjust_size (&size);
- gdb_printf (_("Buffer size: %u%s.\n"), size, suffix);
+ gdb_printf (_ ("Buffer size: %u%s.\n"), size, suffix);
}
}
@@ -531,7 +519,7 @@ record_btrace_print_pt_conf (const struct btrace_config_pt *conf)
static void
record_btrace_print_conf (const struct btrace_config *conf)
{
- gdb_printf (_("Recording format: %s.\n"),
+ gdb_printf (_ ("Recording format: %s.\n"),
btrace_format_string (conf->format));
switch (conf->format)
@@ -548,7 +536,7 @@ record_btrace_print_conf (const struct btrace_config *conf)
return;
}
- internal_error (_("Unknown branch trace format."));
+ internal_error (_ ("Unknown branch trace format."));
}
/* The info_record method of target record-btrace. */
@@ -564,7 +552,7 @@ record_btrace_target::info_record ()
DEBUG ("info");
if (inferior_ptid == null_ptid)
- error (_("No thread."));
+ error (_ ("No thread."));
tp = inferior_thread ();
@@ -602,13 +590,13 @@ record_btrace_target::info_record ()
gaps = btinfo->ngaps;
}
- gdb_printf (_("Recorded %u instructions in %u functions (%u gaps) "
- "for thread %s (%s).\n"), insns, calls, gaps,
- print_thread_id (tp),
+ gdb_printf (_ ("Recorded %u instructions in %u functions (%u gaps) "
+ "for thread %s (%s).\n"),
+ insns, calls, gaps, print_thread_id (tp),
target_pid_to_str (tp->ptid).c_str ());
if (btrace_is_replaying (tp))
- gdb_printf (_("Replay in progress. At instruction %u.\n"),
+ gdb_printf (_ ("Replay in progress. At instruction %u.\n"),
btrace_insn_number (btinfo->replay));
}
@@ -620,16 +608,16 @@ btrace_ui_out_decode_error (struct ui_out *uiout, int errcode,
{
const char *errstr = btrace_decode_error (format, errcode);
- uiout->text (_("["));
+ uiout->text (_ ("["));
/* ERRCODE > 0 indicates notifications on BTRACE_FORMAT_PT. */
if (!(format == BTRACE_FORMAT_PT && errcode > 0))
{
- uiout->text (_("decode error ("));
+ uiout->text (_ ("decode error ("));
uiout->field_signed ("errcode", errcode);
- uiout->text (_("): "));
+ uiout->text (_ ("): "));
}
uiout->text (errstr);
- uiout->text (_("]\n"));
+ uiout->text (_ ("]\n"));
}
/* A range of source lines. */
@@ -693,8 +681,7 @@ static int
btrace_line_range_contains_range (struct btrace_line_range lhs,
struct btrace_line_range rhs)
{
- return ((lhs.symtab == rhs.symtab)
- && (lhs.begin <= rhs.begin)
+ return ((lhs.symtab == rhs.symtab) && (lhs.begin <= rhs.begin)
&& (rhs.end <= lhs.end));
}
@@ -798,7 +785,7 @@ btrace_insn_history (struct ui_out *uiout,
gdb_pretty_print_disassembler disasm (gdbarch, uiout);
for (btrace_insn_iterator it = *begin; btrace_insn_cmp (&it, end) != 0;
- btrace_insn_next (&it, 1))
+ btrace_insn_next (&it, 1))
{
const struct btrace_insn *insn;
@@ -814,8 +801,7 @@ btrace_insn_history (struct ui_out *uiout,
/* We have trace so we must have a configuration. */
gdb_assert (conf != NULL);
- uiout->field_fmt ("insn-number", "%u",
- btrace_insn_number (&it));
+ uiout->field_fmt ("insn-number", "%u", btrace_insn_number (&it));
uiout->text ("\t");
btrace_ui_out_decode_error (uiout, btrace_insn_get_error (&it),
@@ -833,8 +819,8 @@ btrace_insn_history (struct ui_out *uiout,
if (!btrace_line_range_is_empty (lines)
&& !btrace_line_range_contains_range (last_lines, lines))
{
- btrace_print_lines (lines, uiout, &src_and_asm_tuple, &asm_list,
- flags);
+ btrace_print_lines (lines, uiout, &src_and_asm_tuple,
+ &asm_list, flags);
last_lines = lines;
}
else if (!src_and_asm_tuple.has_value ())
@@ -878,7 +864,7 @@ record_btrace_target::insn_history (int size, gdb_disassembly_flags flags)
ui_out_emit_tuple tuple_emitter (uiout, "insn history");
context = abs (size);
if (context == 0)
- error (_("Bad record instruction-history-size."));
+ error (_ ("Bad record instruction-history-size."));
btinfo = require_btrace ();
history = btinfo->insn_history;
@@ -938,9 +924,9 @@ record_btrace_target::insn_history (int size, gdb_disassembly_flags flags)
else
{
if (size < 0)
- gdb_printf (_("At the start of the branch trace record.\n"));
+ gdb_printf (_ ("At the start of the branch trace record.\n"));
else
- gdb_printf (_("At the end of the branch trace record.\n"));
+ gdb_printf (_ ("At the end of the branch trace record.\n"));
}
btrace_set_insn_history (btinfo, &begin, &end);
@@ -967,16 +953,16 @@ record_btrace_target::insn_history_range (ULONGEST from, ULONGEST to,
/* Check for wrap-arounds. */
if (low != from || high != to)
- error (_("Bad range."));
+ error (_ ("Bad range."));
if (high < low)
- error (_("Bad range."));
+ error (_ ("Bad range."));
btinfo = require_btrace ();
found = btrace_find_insn_by_number (&begin, btinfo, low);
if (found == 0)
- error (_("Range out of bounds."));
+ error (_ ("Range out of bounds."));
found = btrace_find_insn_by_number (&end, btinfo, high);
if (found == 0)
@@ -1004,7 +990,7 @@ record_btrace_target::insn_history_from (ULONGEST from, int size,
context = abs (size);
if (context == 0)
- error (_("Bad record instruction-history-size."));
+ error (_ ("Bad record instruction-history-size."));
if (size < 0)
{
@@ -1053,8 +1039,8 @@ btrace_call_history_insn_range (struct ui_out *uiout,
result from inlining or macro expansion. */
static void
-btrace_compute_src_line_range (const struct btrace_function *bfun,
- int *pbegin, int *pend)
+btrace_compute_src_line_range (const struct btrace_function *bfun, int *pbegin,
+ int *pend)
{
struct symtab *symtab;
struct symbol *sym;
@@ -1081,7 +1067,7 @@ btrace_compute_src_line_range (const struct btrace_function *bfun,
end = std::max (end, sal.line);
}
- out:
+out:
*pbegin = begin;
*pend = end;
}
@@ -1099,8 +1085,7 @@ btrace_call_history_src_line (struct ui_out *uiout,
if (sym == NULL)
return;
- uiout->field_string ("file",
- symtab_to_filename_for_display (sym->symtab ()),
+ uiout->field_string ("file", symtab_to_filename_for_display (sym->symtab ()),
file_name_style.style ());
btrace_compute_src_line_range (bfun, &begin, &end);
@@ -1145,8 +1130,7 @@ static void
btrace_call_history (struct ui_out *uiout,
const struct btrace_thread_info *btinfo,
const struct btrace_call_iterator *begin,
- const struct btrace_call_iterator *end,
- int int_flags)
+ const struct btrace_call_iterator *end, int int_flags)
{
struct btrace_call_iterator it;
record_print_flags flags = (enum record_print_flag) int_flags;
@@ -1198,18 +1182,17 @@ btrace_call_history (struct ui_out *uiout,
uiout->field_string ("function", msym->print_name (),
function_name_style.style ());
else if (!uiout->is_mi_like_p ())
- uiout->field_string ("function", "??",
- function_name_style.style ());
+ uiout->field_string ("function", "??", function_name_style.style ());
if ((flags & RECORD_PRINT_INSN_RANGE) != 0)
{
- uiout->text (_("\tinst "));
+ uiout->text (_ ("\tinst "));
btrace_call_history_insn_range (uiout, bfun);
}
if ((flags & RECORD_PRINT_SRC_LINE) != 0)
{
- uiout->text (_("\tat "));
+ uiout->text (_ ("\tat "));
btrace_call_history_src_line (uiout, bfun);
}
@@ -1232,7 +1215,7 @@ record_btrace_target::call_history (int size, record_print_flags flags)
ui_out_emit_tuple tuple_emitter (uiout, "insn history");
context = abs (size);
if (context == 0)
- error (_("Bad record function-call-history-size."));
+ error (_ ("Bad record function-call-history-size."));
btinfo = require_btrace ();
history = btinfo->call_history;
@@ -1267,7 +1250,7 @@ record_btrace_target::call_history (int size, record_print_flags flags)
else
{
covered = btrace_call_next (&end, context);
- covered += btrace_call_prev (&begin, context- covered);
+ covered += btrace_call_prev (&begin, context - covered);
}
}
else
@@ -1295,9 +1278,9 @@ record_btrace_target::call_history (int size, record_print_flags flags)
else
{
if (size < 0)
- gdb_printf (_("At the start of the branch trace record.\n"));
+ gdb_printf (_ ("At the start of the branch trace record.\n"));
else
- gdb_printf (_("At the end of the branch trace record.\n"));
+ gdb_printf (_ ("At the end of the branch trace record.\n"));
}
btrace_set_call_history (btinfo, &begin, &end);
@@ -1324,16 +1307,16 @@ record_btrace_target::call_history_range (ULONGEST from, ULONGEST to,
/* Check for wrap-arounds. */
if (low != from || high != to)
- error (_("Bad range."));
+ error (_ ("Bad range."));
if (high < low)
- error (_("Bad range."));
+ error (_ ("Bad range."));
btinfo = require_btrace ();
found = btrace_find_call_by_number (&begin, btinfo, low);
if (found == 0)
- error (_("Range out of bounds."));
+ error (_ ("Range out of bounds."));
found = btrace_find_call_by_number (&end, btinfo, high);
if (found == 0)
@@ -1361,7 +1344,7 @@ record_btrace_target::call_history_from (ULONGEST from, int size,
context = abs (size);
if (context == 0)
- error (_("Bad record function-call-history-size."));
+ error (_ ("Bad record function-call-history-size."));
if (size < 0)
{
@@ -1382,7 +1365,7 @@ record_btrace_target::call_history_from (ULONGEST from, int size,
end = ULONGEST_MAX;
}
- call_history_range ( begin, end, flags);
+ call_history_range (begin, end, flags);
}
/* The record_method method of target record-btrace. */
@@ -1394,7 +1377,7 @@ record_btrace_target::record_method (ptid_t ptid)
thread_info *const tp = find_thread_ptid (proc_target, ptid);
if (tp == NULL)
- error (_("No thread."));
+ error (_ ("No thread."));
if (tp->btrace.target == NULL)
return RECORD_METHOD_NONE;
@@ -1455,7 +1438,8 @@ record_btrace_target::xfer_partial (enum target_object object,
{
/* Check if the section we found is readonly. */
if ((bfd_section_flags (section->the_bfd_section)
- & SEC_READONLY) != 0)
+ & SEC_READONLY)
+ != 0)
{
/* Truncate the request to fit into this section. */
len = std::min (len, section->endaddr - offset);
@@ -1545,7 +1529,7 @@ record_btrace_target::fetch_registers (struct regcache *regcache, int regno)
case. */
thread_info *tp = find_thread_ptid (regcache->target (), regcache->ptid ());
if (tp != nullptr)
- replay = tp->btrace.replay;
+ replay = tp->btrace.replay;
if (replay != nullptr && !record_btrace_generating_corefile)
{
@@ -1578,7 +1562,7 @@ record_btrace_target::store_registers (struct regcache *regcache, int regno)
{
if (!record_btrace_generating_corefile
&& record_is_replaying (regcache->ptid ()))
- error (_("Cannot write registers while replaying."));
+ error (_ ("Cannot write registers while replaying."));
gdb_assert (may_write_registers);
@@ -1729,8 +1713,7 @@ record_btrace_frame_this_id (frame_info_ptr this_frame, void **this_cache,
static struct value *
record_btrace_frame_prev_register (frame_info_ptr this_frame,
- void **this_cache,
- int regnum)
+ void **this_cache, int regnum)
{
const struct btrace_frame_cache *cache;
const struct btrace_function *bfun, *caller;
@@ -1743,7 +1726,7 @@ record_btrace_frame_prev_register (frame_info_ptr this_frame,
pcreg = gdbarch_pc_regnum (gdbarch);
if (pcreg < 0 || regnum != pcreg)
throw_error (NOT_AVAILABLE_ERROR,
- _("Registers are not available in btrace record history"));
+ _ ("Registers are not available in btrace record history"));
cache = (const struct btrace_frame_cache *) *this_cache;
bfun = cache->bfun;
@@ -1751,7 +1734,7 @@ record_btrace_frame_prev_register (frame_info_ptr this_frame,
if (btrace_find_call_by_number (&it, &cache->tp->btrace, bfun->up) == 0)
throw_error (NOT_AVAILABLE_ERROR,
- _("No caller in btrace record history"));
+ _ ("No caller in btrace record history"));
caller = btrace_call_get (&it);
@@ -1774,8 +1757,7 @@ record_btrace_frame_prev_register (frame_info_ptr this_frame,
static int
record_btrace_frame_sniffer (const struct frame_unwind *self,
- frame_info_ptr this_frame,
- void **this_cache)
+ frame_info_ptr this_frame, void **this_cache)
{
const struct btrace_function *bfun;
struct btrace_frame_cache *cache;
@@ -1887,29 +1869,25 @@ record_btrace_frame_dealloc_cache (frame_info *self, void *this_cache)
Therefore this unwinder reports any possibly unwound registers as
<unavailable>. */
-const struct frame_unwind record_btrace_frame_unwind =
-{
- "record-btrace",
- NORMAL_FRAME,
- record_btrace_frame_unwind_stop_reason,
- record_btrace_frame_this_id,
- record_btrace_frame_prev_register,
- NULL,
- record_btrace_frame_sniffer,
- record_btrace_frame_dealloc_cache
-};
-
-const struct frame_unwind record_btrace_tailcall_frame_unwind =
-{
- "record-btrace tailcall",
- TAILCALL_FRAME,
- record_btrace_frame_unwind_stop_reason,
- record_btrace_frame_this_id,
- record_btrace_frame_prev_register,
- NULL,
- record_btrace_tailcall_frame_sniffer,
- record_btrace_frame_dealloc_cache
-};
+const struct frame_unwind record_btrace_frame_unwind
+ = { "record-btrace",
+ NORMAL_FRAME,
+ record_btrace_frame_unwind_stop_reason,
+ record_btrace_frame_this_id,
+ record_btrace_frame_prev_register,
+ NULL,
+ record_btrace_frame_sniffer,
+ record_btrace_frame_dealloc_cache };
+
+const struct frame_unwind record_btrace_tailcall_frame_unwind
+ = { "record-btrace tailcall",
+ TAILCALL_FRAME,
+ record_btrace_frame_unwind_stop_reason,
+ record_btrace_frame_this_id,
+ record_btrace_frame_prev_register,
+ NULL,
+ record_btrace_tailcall_frame_sniffer,
+ record_btrace_frame_dealloc_cache };
/* Implement the get_unwinder method. */
@@ -1998,9 +1976,9 @@ get_thread_current_frame_id (struct thread_info *tp)
bool executing = tp->executing ();
set_executing (proc_target, inferior_ptid, false);
SCOPE_EXIT
- {
- set_executing (proc_target, inferior_ptid, executing);
- };
+ {
+ set_executing (proc_target, inferior_ptid, executing);
+ };
return get_frame_id (get_current_frame ());
}
@@ -2017,7 +1995,7 @@ record_btrace_start_replaying (struct thread_info *tp)
/* We can't start replaying without trace. */
if (btinfo->functions.empty ())
- error (_("No trace."));
+ error (_ ("No trace."));
/* GDB stores the current frame_id when stepping in order to detects steps
into subroutines.
@@ -2048,7 +2026,7 @@ record_btrace_start_replaying (struct thread_info *tp)
steps = btrace_insn_prev (replay, 1);
if (steps == 0)
- error (_("No trace."));
+ error (_ ("No trace."));
}
/* We're not replaying, yet. */
@@ -2201,8 +2179,7 @@ record_btrace_cancel_resume (struct thread_info *tp)
if (flags == 0)
return;
- DEBUG ("cancel resume thread %s (%s): %x (%s)",
- print_thread_id (tp),
+ DEBUG ("cancel resume thread %s (%s): %x (%s)", print_thread_id (tp),
tp->ptid.to_string ().c_str (), flags.raw (),
btrace_thread_flag_to_str (flags));
@@ -2439,7 +2416,7 @@ record_btrace_step_thread (struct thread_info *tp)
switch (flags)
{
default:
- internal_error (_("invalid stepping type."));
+ internal_error (_ ("invalid stepping type."));
case BTHR_STOP:
return btrace_step_stopped_on_request ();
@@ -2486,12 +2463,13 @@ record_btrace_step_thread (struct thread_info *tp)
/* Announce further events if necessary. */
static void
-record_btrace_maybe_mark_async_event
- (const std::vector<thread_info *> &moving,
- const std::vector<thread_info *> &no_history)
+record_btrace_maybe_mark_async_event (
+ const std::vector<thread_info *> &moving,
+ const std::vector<thread_info *> &no_history)
{
bool more_moving = !moving.empty ();
- bool more_no_history = !no_history.empty ();;
+ bool more_no_history = !no_history.empty ();
+ ;
if (!more_moving && !more_no_history)
return;
@@ -2517,8 +2495,7 @@ record_btrace_target::wait (ptid_t ptid, struct target_waitstatus *status,
/* Clear this, if needed we'll re-mark it below. */
clear_async_event_handler (record_btrace_async_inferior_event_handler);
- DEBUG ("wait %s (0x%x)", ptid.to_string ().c_str (),
- (unsigned) options);
+ DEBUG ("wait %s (0x%x)", ptid.to_string ().c_str (), (unsigned) options);
/* As long as we're not replaying, just forward the request. */
if ((::execution_direction != EXEC_REVERSE)
@@ -2626,10 +2603,8 @@ record_btrace_target::wait (ptid_t ptid, struct target_waitstatus *status,
/* We moved the replay position but did not update registers. */
registers_changed_thread (eventing);
- DEBUG ("wait ended by thread %s (%s): %s",
- print_thread_id (eventing),
- eventing->ptid.to_string ().c_str (),
- status->to_string ().c_str ());
+ DEBUG ("wait ended by thread %s (%s): %s", print_thread_id (eventing),
+ eventing->ptid.to_string ().c_str (), status->to_string ().c_str ());
return eventing->ptid;
}
@@ -2658,7 +2633,7 @@ record_btrace_target::stop (ptid_t ptid)
tp->btrace.flags |= BTHR_STOP;
}
}
- }
+}
/* The can_execute_reverse method of target record-btrace. */
@@ -2798,7 +2773,7 @@ record_btrace_target::goto_record_begin ()
steps = btrace_insn_next (&begin, 1);
if (steps == 0)
- error (_("No trace."));
+ error (_ ("No trace."));
}
record_btrace_set_replay (tp, &begin);
@@ -2830,7 +2805,7 @@ record_btrace_target::goto_record (ULONGEST insn)
/* Check for wrap-arounds. */
if (number != insn)
- error (_("Instruction number out of range."));
+ error (_ ("Instruction number out of range."));
tp = require_btrace_thread ();
@@ -2838,7 +2813,7 @@ record_btrace_target::goto_record (ULONGEST insn)
/* Check if the instruction could not be found or is a gap. */
if (found == 0 || btrace_insn_get (&it) == NULL)
- error (_("No such instruction."));
+ error (_ ("No such instruction."));
record_btrace_set_replay (tp, &it);
}
@@ -2882,7 +2857,7 @@ static void
cmd_record_btrace_bts_start (const char *args, int from_tty)
{
if (args != NULL && *args != 0)
- error (_("Invalid argument."));
+ error (_ ("Invalid argument."));
record_btrace_conf.format = BTRACE_FORMAT_BTS;
@@ -2903,7 +2878,7 @@ static void
cmd_record_btrace_pt_start (const char *args, int from_tty)
{
if (args != NULL && *args != 0)
- error (_("Invalid argument."));
+ error (_ ("Invalid argument."));
record_btrace_conf.format = BTRACE_FORMAT_PT;
@@ -2924,7 +2899,7 @@ static void
cmd_record_btrace_start (const char *args, int from_tty)
{
if (args != NULL && *args != 0)
- error (_("Invalid argument."));
+ error (_ ("Invalid argument."));
record_btrace_conf.format = BTRACE_FORMAT_PT;
@@ -2954,8 +2929,7 @@ static void
cmd_show_replay_memory_access (struct ui_file *file, int from_tty,
struct cmd_list_element *c, const char *value)
{
- gdb_printf (file, _("Replay memory access is %s.\n"),
- replay_memory_access);
+ gdb_printf (file, _ ("Replay memory access is %s.\n"), replay_memory_access);
}
/* The "set record btrace cpu none" command. */
@@ -2964,7 +2938,7 @@ static void
cmd_set_record_btrace_cpu_none (const char *args, int from_tty)
{
if (args != nullptr && *args != 0)
- error (_("Trailing junk: '%s'."), args);
+ error (_ ("Trailing junk: '%s'."), args);
record_btrace_cpu_state = CS_NONE;
}
@@ -2975,7 +2949,7 @@ static void
cmd_set_record_btrace_cpu_auto (const char *args, int from_tty)
{
if (args != nullptr && *args != 0)
- error (_("Trailing junk: '%s'."), args);
+ error (_ ("Trailing junk: '%s'."), args);
record_btrace_cpu_state = CS_AUTO;
}
@@ -2990,31 +2964,32 @@ cmd_set_record_btrace_cpu (const char *args, int from_tty)
/* We use a hard-coded vendor string for now. */
unsigned int family, model, stepping;
- int l1, l2, matches = sscanf (args, "intel: %u/%u%n/%u%n", &family,
- &model, &l1, &stepping, &l2);
+ int l1, l2,
+ matches = sscanf (args, "intel: %u/%u%n/%u%n", &family, &model, &l1,
+ &stepping, &l2);
if (matches == 3)
{
if (strlen (args) != l2)
- error (_("Trailing junk: '%s'."), args + l2);
+ error (_ ("Trailing junk: '%s'."), args + l2);
}
else if (matches == 2)
{
if (strlen (args) != l1)
- error (_("Trailing junk: '%s'."), args + l1);
+ error (_ ("Trailing junk: '%s'."), args + l1);
stepping = 0;
}
else
- error (_("Bad format. See \"help set record btrace cpu\"."));
+ error (_ ("Bad format. See \"help set record btrace cpu\"."));
if (USHRT_MAX < family)
- error (_("Cpu family too big."));
+ error (_ ("Cpu family too big."));
if (UCHAR_MAX < model)
- error (_("Cpu model too big."));
+ error (_ ("Cpu model too big."));
if (UCHAR_MAX < stepping)
- error (_("Cpu stepping too big."));
+ error (_ ("Cpu stepping too big."));
record_btrace_cpu.vendor = CV_INTEL;
record_btrace_cpu.family = family;
@@ -3030,16 +3005,16 @@ static void
cmd_show_record_btrace_cpu (const char *args, int from_tty)
{
if (args != nullptr && *args != 0)
- error (_("Trailing junk: '%s'."), args);
+ error (_ ("Trailing junk: '%s'."), args);
switch (record_btrace_cpu_state)
{
case CS_AUTO:
- gdb_printf (_("btrace cpu is 'auto'.\n"));
+ gdb_printf (_ ("btrace cpu is 'auto'.\n"));
return;
case CS_NONE:
- gdb_printf (_("btrace cpu is 'none'.\n"));
+ gdb_printf (_ ("btrace cpu is 'none'.\n"));
return;
case CS_CPU:
@@ -3047,19 +3022,17 @@ cmd_show_record_btrace_cpu (const char *args, int from_tty)
{
case CV_INTEL:
if (record_btrace_cpu.stepping == 0)
- gdb_printf (_("btrace cpu is 'intel: %u/%u'.\n"),
- record_btrace_cpu.family,
- record_btrace_cpu.model);
+ gdb_printf (_ ("btrace cpu is 'intel: %u/%u'.\n"),
+ record_btrace_cpu.family, record_btrace_cpu.model);
else
- gdb_printf (_("btrace cpu is 'intel: %u/%u/%u'.\n"),
- record_btrace_cpu.family,
- record_btrace_cpu.model,
+ gdb_printf (_ ("btrace cpu is 'intel: %u/%u/%u'.\n"),
+ record_btrace_cpu.family, record_btrace_cpu.model,
record_btrace_cpu.stepping);
return;
}
}
- error (_("Internal error: bad cpu state."));
+ error (_ ("Internal error: bad cpu state."));
}
/* The "record bts buffer-size" show value function. */
@@ -3069,8 +3042,7 @@ show_record_bts_buffer_size_value (struct ui_file *file, int from_tty,
struct cmd_list_element *c,
const char *value)
{
- gdb_printf (file, _("The record/replay bts buffer size is %s.\n"),
- value);
+ gdb_printf (file, _ ("The record/replay bts buffer size is %s.\n"), value);
}
/* The "record pt buffer-size" show value function. */
@@ -3080,64 +3052,63 @@ show_record_pt_buffer_size_value (struct ui_file *file, int from_tty,
struct cmd_list_element *c,
const char *value)
{
- gdb_printf (file, _("The record/replay pt buffer size is %s.\n"),
- value);
+ gdb_printf (file, _ ("The record/replay pt buffer size is %s.\n"), value);
}
/* Initialize btrace commands. */
void _initialize_record_btrace ();
+
void
_initialize_record_btrace ()
{
cmd_list_element *record_btrace_cmd
= add_prefix_cmd ("btrace", class_obscure, cmd_record_btrace_start,
- _("Start branch trace recording."),
+ _ ("Start branch trace recording."),
&record_btrace_cmdlist, 0, &record_cmdlist);
add_alias_cmd ("b", record_btrace_cmd, class_obscure, 1, &record_cmdlist);
cmd_list_element *record_btrace_bts_cmd
- = add_cmd ("bts", class_obscure, cmd_record_btrace_bts_start,
- _("\
+ = add_cmd ("bts", class_obscure, cmd_record_btrace_bts_start, _ ("\
Start branch trace recording in Branch Trace Store (BTS) format.\n\n\
The processor stores a from/to record for each branch into a cyclic buffer.\n\
This format may not be available on all processors."),
- &record_btrace_cmdlist);
+ &record_btrace_cmdlist);
add_alias_cmd ("bts", record_btrace_bts_cmd, class_obscure, 1,
&record_cmdlist);
cmd_list_element *record_btrace_pt_cmd
- = add_cmd ("pt", class_obscure, cmd_record_btrace_pt_start,
- _("\
+ = add_cmd ("pt", class_obscure, cmd_record_btrace_pt_start, _ ("\
Start branch trace recording in Intel Processor Trace format.\n\n\
This format may not be available on all processors."),
- &record_btrace_cmdlist);
- add_alias_cmd ("pt", record_btrace_pt_cmd, class_obscure, 1, &record_cmdlist);
+ &record_btrace_cmdlist);
+ add_alias_cmd ("pt", record_btrace_pt_cmd, class_obscure, 1,
+ &record_cmdlist);
- add_setshow_prefix_cmd ("btrace", class_support,
- _("Set record options."),
- _("Show record options."),
+ add_setshow_prefix_cmd ("btrace", class_support, _ ("Set record options."),
+ _ ("Show record options."),
&set_record_btrace_cmdlist,
- &show_record_btrace_cmdlist,
- &set_record_cmdlist, &show_record_cmdlist);
+ &show_record_btrace_cmdlist, &set_record_cmdlist,
+ &show_record_cmdlist);
add_setshow_enum_cmd ("replay-memory-access", no_class,
- replay_memory_access_types, &replay_memory_access, _("\
-Set what memory accesses are allowed during replay."), _("\
+ replay_memory_access_types, &replay_memory_access,
+ _ ("\
+Set what memory accesses are allowed during replay."),
+ _ ("\
Show what memory accesses are allowed during replay."),
- _("Default is READ-ONLY.\n\n\
+ _ ("Default is READ-ONLY.\n\n\
The btrace record target does not trace data.\n\
The memory therefore corresponds to the live target and not \
to the current replay position.\n\n\
When READ-ONLY, allow accesses to read-only memory during replay.\n\
When READ-WRITE, allow accesses to read-only and read-write memory during \
replay."),
- NULL, cmd_show_replay_memory_access,
- &set_record_btrace_cmdlist,
- &show_record_btrace_cmdlist);
+ NULL, cmd_show_replay_memory_access,
+ &set_record_btrace_cmdlist,
+ &show_record_btrace_cmdlist);
- add_prefix_cmd ("cpu", class_support, cmd_set_record_btrace_cpu,
- _("\
+ add_prefix_cmd ("cpu", class_support, cmd_set_record_btrace_cpu, _ ("\
Set the cpu to be used for trace decode.\n\n\
The format is \"VENDOR:IDENTIFIER\" or \"none\" or \"auto\" (default).\n\
For vendor \"intel\" the format is \"FAMILY/MODEL[/STEPPING]\".\n\n\
@@ -3146,25 +3117,24 @@ The default is \"auto\", which uses the cpu on which the trace was recorded.\n\
When GDB does not support that cpu, this option can be used to enable\n\
workarounds for a similar cpu that GDB supports.\n\n\
When set to \"none\", errata workarounds are disabled."),
- &set_record_btrace_cpu_cmdlist,
- 1,
+ &set_record_btrace_cpu_cmdlist, 1,
&set_record_btrace_cmdlist);
- add_cmd ("auto", class_support, cmd_set_record_btrace_cpu_auto, _("\
+ add_cmd ("auto", class_support, cmd_set_record_btrace_cpu_auto, _ ("\
Automatically determine the cpu to be used for trace decode."),
&set_record_btrace_cpu_cmdlist);
- add_cmd ("none", class_support, cmd_set_record_btrace_cpu_none, _("\
+ add_cmd ("none", class_support, cmd_set_record_btrace_cpu_none, _ ("\
Do not enable errata workarounds for trace decode."),
&set_record_btrace_cpu_cmdlist);
- add_cmd ("cpu", class_support, cmd_show_record_btrace_cpu, _("\
+ add_cmd ("cpu", class_support, cmd_show_record_btrace_cpu, _ ("\
Show the cpu to be used for trace decode."),
&show_record_btrace_cmdlist);
add_setshow_prefix_cmd ("bts", class_support,
- _("Set record btrace bts options."),
- _("Show record btrace bts options."),
+ _ ("Set record btrace bts options."),
+ _ ("Show record btrace bts options."),
&set_record_btrace_bts_cmdlist,
&show_record_btrace_bts_cmdlist,
&set_record_btrace_cmdlist,
@@ -3172,21 +3142,22 @@ Show the cpu to be used for trace decode."),
add_setshow_uinteger_cmd ("buffer-size", no_class,
&record_btrace_conf.bts.size,
- _("Set the record/replay bts buffer size."),
- _("Show the record/replay bts buffer size."), _("\
+ _ ("Set the record/replay bts buffer size."),
+ _ ("Show the record/replay bts buffer size."),
+ _ ("\
When starting recording request a trace buffer of this size. \
The actual buffer size may differ from the requested size. \
Use \"info record\" to see the actual buffer size.\n\n\
Bigger buffers allow longer recording but also take more time to process \
the recorded execution trace.\n\n\
-The trace buffer size may not be changed while recording."), NULL,
- show_record_bts_buffer_size_value,
+The trace buffer size may not be changed while recording."),
+ NULL, show_record_bts_buffer_size_value,
&set_record_btrace_bts_cmdlist,
&show_record_btrace_bts_cmdlist);
add_setshow_prefix_cmd ("pt", class_support,
- _("Set record btrace pt options."),
- _("Show record btrace pt options."),
+ _ ("Set record btrace pt options."),
+ _ ("Show record btrace pt options."),
&set_record_btrace_pt_cmdlist,
&show_record_btrace_pt_cmdlist,
&set_record_btrace_cmdlist,
@@ -3194,19 +3165,20 @@ The trace buffer size may not be changed while recording."), NULL,
add_setshow_uinteger_cmd ("buffer-size", no_class,
&record_btrace_conf.pt.size,
- _("Set the record/replay pt buffer size."),
- _("Show the record/replay pt buffer size."), _("\
+ _ ("Set the record/replay pt buffer size."),
+ _ ("Show the record/replay pt buffer size."), _ ("\
Bigger buffers allow longer recording but also take more time to process \
the recorded execution.\n\
The actual buffer size may differ from the requested size. Use \"info record\" \
-to see the actual buffer size."), NULL, show_record_pt_buffer_size_value,
+to see the actual buffer size."),
+ NULL, show_record_pt_buffer_size_value,
&set_record_btrace_pt_cmdlist,
&show_record_btrace_pt_cmdlist);
add_target (record_btrace_target_info, record_btrace_target_open);
- bfcache = htab_create_alloc (50, bfcache_hash, bfcache_eq, NULL,
- xcalloc, xfree);
+ bfcache
+ = htab_create_alloc (50, bfcache_hash, bfcache_eq, NULL, xcalloc, xfree);
record_btrace_conf.bts.size = 64 * 1024;
record_btrace_conf.pt.size = 16 * 1024;
diff --git a/gdb/record-full.c b/gdb/record-full.c
index e3cfa3f45d5..2ff8ecf0680 100644
--- a/gdb/record-full.c
+++ b/gdb/record-full.c
@@ -63,12 +63,12 @@
instruction's side effects by duplicating the changes that it would
have made on memory and registers. */
-#define DEFAULT_RECORD_FULL_INSN_MAX_NUM 200000
+#define DEFAULT_RECORD_FULL_INSN_MAX_NUM 200000
#define RECORD_FULL_IS_REPLAY \
(record_full_list->next || ::execution_direction == EXEC_REVERSE)
-#define RECORD_FULL_FILE_MAGIC netorder32(0x20091016)
+#define RECORD_FULL_FILE_MAGIC netorder32 (0x20091016)
/* These are the core structs of the process record functionality.
@@ -88,6 +88,7 @@ struct record_full_mem_entry
/* Set this flag if target memory for this entry
can no longer be accessed. */
int mem_entry_not_accessible;
+
union
{
gdb_byte *ptr;
@@ -99,7 +100,8 @@ struct record_full_reg_entry
{
unsigned short num;
unsigned short len;
- union
+
+ union
{
gdb_byte *ptr;
gdb_byte buf[2 * sizeof (gdb_byte *)];
@@ -148,6 +150,7 @@ struct record_full_entry
struct record_full_entry *prev;
struct record_full_entry *next;
enum record_full_type type;
+
union
{
/* reg */
@@ -201,17 +204,16 @@ static struct record_full_entry *record_full_arch_list_tail = NULL;
static bool record_full_stop_at_limit = true;
/* Maximum allowed number of insns in execution log. */
static unsigned int record_full_insn_max_num
- = DEFAULT_RECORD_FULL_INSN_MAX_NUM;
+ = DEFAULT_RECORD_FULL_INSN_MAX_NUM;
/* Actual count of insns presently in execution log. */
static unsigned int record_full_insn_num = 0;
/* Count of insns logged so far (may be larger
than count of insns presently in execution log). */
static ULONGEST record_full_insn_count;
-static const char record_longname[]
- = N_("Process record and replay target");
+static const char record_longname[] = N_ ("Process record and replay target");
static const char record_doc[]
- = N_("Log program while executing and replay execution from log.");
+ = N_ ("Log program while executing and replay execution from log.");
/* Base class implementing functionality common to both the
"record-full" and "record-core" targets. */
@@ -219,6 +221,7 @@ static const char record_doc[]
class record_full_base_target : public target_ops
{
public:
+
const target_info &info () const override = 0;
strata stratum () const override { return record_stratum; }
@@ -265,8 +268,8 @@ static const target_info record_full_target_info = {
class record_full_target final : public record_full_base_target
{
public:
- const target_info &info () const override
- { return record_full_target_info; }
+
+ const target_info &info () const override { return record_full_target_info; }
void resume (ptid_t, int, enum gdb_signal) override;
void disconnect (const char *, int) override;
@@ -275,15 +278,12 @@ public:
void kill () override;
void store_registers (struct regcache *, int) override;
enum target_xfer_status xfer_partial (enum target_object object,
- const char *annex,
- gdb_byte *readbuf,
+ const char *annex, gdb_byte *readbuf,
const gdb_byte *writebuf,
ULONGEST offset, ULONGEST len,
ULONGEST *xfered_len) override;
- int insert_breakpoint (struct gdbarch *,
- struct bp_target_info *) override;
- int remove_breakpoint (struct gdbarch *,
- struct bp_target_info *,
+ int insert_breakpoint (struct gdbarch *, struct bp_target_info *) override;
+ int remove_breakpoint (struct gdbarch *, struct bp_target_info *,
enum remove_bp_reason) override;
};
@@ -298,8 +298,11 @@ static const target_info record_full_core_target_info = {
class record_full_core_target final : public record_full_base_target
{
public:
+
const target_info &info () const override
- { return record_full_core_target_info; }
+ {
+ return record_full_core_target_info;
+ }
void resume (ptid_t, int, enum gdb_signal) override;
void disconnect (const char *, int) override;
@@ -308,15 +311,12 @@ public:
void prepare_to_store (struct regcache *regcache) override;
void store_registers (struct regcache *, int) override;
enum target_xfer_status xfer_partial (enum target_object object,
- const char *annex,
- gdb_byte *readbuf,
+ const char *annex, gdb_byte *readbuf,
const gdb_byte *writebuf,
ULONGEST offset, ULONGEST len,
ULONGEST *xfered_len) override;
- int insert_breakpoint (struct gdbarch *,
- struct bp_target_info *) override;
- int remove_breakpoint (struct gdbarch *,
- struct bp_target_info *,
+ int insert_breakpoint (struct gdbarch *, struct bp_target_info *) override;
+ int remove_breakpoint (struct gdbarch *, struct bp_target_info *,
enum remove_bp_reason) override;
bool has_execution (inferior *inf) override;
@@ -363,11 +363,9 @@ record_full_is_used (void)
struct target_ops *t;
t = find_record_target ();
- return (t == &record_full_ops
- || t == &record_full_core_ops);
+ return (t == &record_full_ops || t == &record_full_core_ops);
}
-
/* Command lists for "set/show record full". */
static struct cmd_list_element *set_record_full_cmdlist;
static struct cmd_list_element *show_record_full_cmdlist;
@@ -467,17 +465,18 @@ record_full_entry_release (struct record_full_entry *rec)
{
enum record_full_type type = rec->type;
- switch (type) {
- case record_full_reg:
- record_full_reg_release (rec);
- break;
- case record_full_mem:
- record_full_mem_release (rec);
- break;
- case record_full_end:
- record_full_end_release (rec);
- break;
- }
+ switch (type)
+ {
+ case record_full_reg:
+ record_full_reg_release (rec);
+ break;
+ case record_full_mem:
+ record_full_mem_release (rec);
+ break;
+ case record_full_end:
+ record_full_end_release (rec);
+ break;
+ }
return type;
}
@@ -550,12 +549,12 @@ record_full_list_release_first (void)
/* tmp is now isolated, and can be deleted. */
if (record_full_entry_release (tmp) == record_full_end)
- break; /* End loop at first record_full_end. */
+ break; /* End loop at first record_full_end. */
if (!record_full_first.next)
{
gdb_assert (record_full_insn_num == 1);
- break; /* End loop when list is empty. */
+ break; /* End loop when list is empty. */
}
}
}
@@ -566,8 +565,7 @@ static void
record_full_arch_list_add (struct record_full_entry *rec)
{
if (record_debug > 1)
- gdb_printf (gdb_stdlog,
- "Process record: record_full_arch_list_add %s.\n",
+ gdb_printf (gdb_stdlog, "Process record: record_full_arch_list_add %s.\n",
host_address_to_string (rec));
if (record_full_arch_list_tail)
@@ -587,22 +585,23 @@ record_full_arch_list_add (struct record_full_entry *rec)
static inline gdb_byte *
record_full_get_loc (struct record_full_entry *rec)
{
- switch (rec->type) {
- case record_full_mem:
- if (rec->u.mem.len > sizeof (rec->u.mem.u.buf))
- return rec->u.mem.u.ptr;
- else
- return rec->u.mem.u.buf;
- case record_full_reg:
- if (rec->u.reg.len > sizeof (rec->u.reg.u.buf))
- return rec->u.reg.u.ptr;
- else
- return rec->u.reg.u.buf;
- case record_full_end:
- default:
- gdb_assert_not_reached ("unexpected record_full_entry type");
- return NULL;
- }
+ switch (rec->type)
+ {
+ case record_full_mem:
+ if (rec->u.mem.len > sizeof (rec->u.mem.u.buf))
+ return rec->u.mem.u.ptr;
+ else
+ return rec->u.mem.u.buf;
+ case record_full_reg:
+ if (rec->u.reg.len > sizeof (rec->u.reg.u.buf))
+ return rec->u.reg.u.ptr;
+ else
+ return rec->u.reg.u.buf;
+ case record_full_end:
+ default:
+ gdb_assert_not_reached ("unexpected record_full_entry type");
+ return NULL;
+ }
}
/* Record the value of a register NUM to record_full_arch_list. */
@@ -641,13 +640,13 @@ record_full_arch_list_add_mem (CORE_ADDR addr, int len)
"record list.\n",
paddress (target_gdbarch (), addr), len);
- if (!addr) /* FIXME: Why? Some arch must permit it... */
+ if (!addr) /* FIXME: Why? Some arch must permit it... */
return 0;
rec = record_full_mem_alloc (addr, len);
- if (record_read_memory (target_gdbarch (), addr,
- record_full_get_loc (rec), len))
+ if (record_read_memory (target_gdbarch (), addr, record_full_get_loc (rec),
+ len))
{
record_full_mem_release (rec);
return -1;
@@ -667,8 +666,7 @@ record_full_arch_list_add_end (void)
struct record_full_entry *rec;
if (record_debug > 1)
- gdb_printf (gdb_stdlog,
- "Process record: add end to arch list.\n");
+ gdb_printf (gdb_stdlog, "Process record: add end to arch list.\n");
rec = record_full_end_alloc ();
rec->u.end.sigval = GDB_SIGNAL_0;
@@ -687,10 +685,10 @@ record_full_check_insn_num (void)
/* Ask user what to do. */
if (record_full_stop_at_limit)
{
- if (!yquery (_("Do you want to auto delete previous execution "
- "log entries when record/replay buffer becomes "
- "full (record full stop-at-limit)?")))
- error (_("Process record: stopped by user."));
+ if (!yquery (_ ("Do you want to auto delete previous execution "
+ "log entries when record/replay buffer becomes "
+ "full (record full stop-at-limit)?")))
+ error (_ ("Process record: stopped by user."));
record_full_stop_at_limit = 0;
}
}
@@ -739,27 +737,23 @@ record_full_message (struct regcache *regcache, enum gdb_signal signal)
if we delivered it during the recording. Therefore we should
record the signal during record_full_wait, not
record_full_resume. */
- if (record_full_list != &record_full_first) /* FIXME better way
+ if (record_full_list != &record_full_first) /* FIXME better way
to check */
{
gdb_assert (record_full_list->type == record_full_end);
record_full_list->u.end.sigval = signal;
}
- if (signal == GDB_SIGNAL_0
- || !gdbarch_process_record_signal_p (gdbarch))
- ret = gdbarch_process_record (gdbarch,
- regcache,
+ if (signal == GDB_SIGNAL_0 || !gdbarch_process_record_signal_p (gdbarch))
+ ret = gdbarch_process_record (gdbarch, regcache,
regcache_read_pc (regcache));
else
- ret = gdbarch_process_record_signal (gdbarch,
- regcache,
- signal);
+ ret = gdbarch_process_record_signal (gdbarch, regcache, signal);
if (ret > 0)
- error (_("Process record: inferior program stopped."));
+ error (_ ("Process record: inferior program stopped."));
if (ret < 0)
- error (_("Process record: failed to record execution log."));
+ error (_ ("Process record: failed to record execution log."));
}
catch (const gdb_exception &ex)
{
@@ -814,8 +808,7 @@ static enum target_stop_reason record_full_stop_reason
entries and memory entries, followed by an 'end' entry. */
static inline void
-record_full_exec_insn (struct regcache *regcache,
- struct gdbarch *gdbarch,
+record_full_exec_insn (struct regcache *regcache, struct gdbarch *gdbarch,
struct record_full_entry *entry)
{
switch (entry->type)
@@ -828,8 +821,7 @@ record_full_exec_insn (struct regcache *regcache,
gdb_printf (gdb_stdlog,
"Process record: record_full_reg %s to "
"inferior num = %d.\n",
- host_address_to_string (entry),
- entry->u.reg.num);
+ host_address_to_string (entry), entry->u.reg.num);
regcache->cooked_read (entry->u.reg.num, reg.data ());
regcache->cooked_write (entry->u.reg.num, record_full_get_loc (entry));
@@ -852,20 +844,19 @@ record_full_exec_insn (struct regcache *regcache,
paddress (gdbarch, entry->u.mem.addr),
entry->u.mem.len);
- if (record_read_memory (gdbarch,
- entry->u.mem.addr, mem.data (),
+ if (record_read_memory (gdbarch, entry->u.mem.addr, mem.data (),
entry->u.mem.len))
entry->u.mem.mem_entry_not_accessible = 1;
else
{
- if (target_write_memory (entry->u.mem.addr,
+ if (target_write_memory (entry->u.mem.addr,
record_full_get_loc (entry),
entry->u.mem.len))
{
entry->u.mem.mem_entry_not_accessible = 1;
if (record_debug)
- warning (_("Process record: error writing memory at "
- "addr = %s len = %d."),
+ warning (_ ("Process record: error writing memory at "
+ "addr = %s len = %d."),
paddress (gdbarch, entry->u.mem.addr),
entry->u.mem.len);
}
@@ -882,9 +873,9 @@ record_full_exec_insn (struct regcache *regcache,
_before_ actually doing the memory change, and
not doing the change at all if the watchpoint
traps. */
- if (hardware_watchpoint_inserted_in_range
- (regcache->aspace (),
- entry->u.mem.addr, entry->u.mem.len))
+ if (hardware_watchpoint_inserted_in_range (
+ regcache->aspace (), entry->u.mem.addr,
+ entry->u.mem.len))
record_full_stop_reason = TARGET_STOPPED_BY_WATCHPOINT;
}
}
@@ -920,7 +911,7 @@ record_full_core_open_1 (const char *name, int from_tty)
target_fetch_registers (regcache, -1);
record_full_core_regbuf = new detached_regcache (regcache->arch (), false);
- for (i = 0; i < regnum; i ++)
+ for (i = 0; i < regnum; i++)
record_full_core_regbuf->raw_supply (i, *regcache);
record_full_core_sections = build_section_table (core_bfd);
@@ -939,14 +930,14 @@ record_full_open_1 (const char *name, int from_tty)
/* check exec */
if (!target_has_execution ())
- error (_("Process record: the program is not being run."));
+ error (_ ("Process record: the program is not being run."));
if (non_stop)
- error (_("Process record target can't debug inferior in non-stop mode "
- "(non-stop)."));
+ error (_ ("Process record target can't debug inferior in non-stop mode "
+ "(non-stop)."));
if (!gdbarch_process_record_p (target_gdbarch ()))
- error (_("Process record: the current architecture doesn't support "
- "record function."));
+ error (_ ("Process record: the current architecture doesn't support "
+ "record function."));
current_inferior ()->push_target (&record_full_ops);
}
@@ -981,7 +972,7 @@ record_full_open (const char *name, int from_tty)
record_full_init_record_breakpoints ();
- gdb::observers::record_changed.notify (current_inferior (), 1, "full", NULL);
+ gdb::observers::record_changed.notify (current_inferior (), 1, "full", NULL);
}
/* "close" target method. Close the process record target. */
@@ -1130,8 +1121,8 @@ record_full_sig_handler (int signo)
where to stop. */
static ptid_t
-record_full_wait_1 (struct target_ops *ops,
- ptid_t ptid, struct target_waitstatus *status,
+record_full_wait_1 (struct target_ops *ops, ptid_t ptid,
+ struct target_waitstatus *status,
target_wait_flags options)
{
scoped_restore restore_operation_disable
@@ -1143,8 +1134,8 @@ record_full_wait_1 (struct target_ops *ops,
"record_full_resume_step = %d, "
"record_full_resumed = %d, direction=%s\n",
record_full_resume_step, record_full_resumed,
- record_full_execution_dir == EXEC_FORWARD
- ? "forward" : "reverse");
+ record_full_execution_dir == EXEC_FORWARD ? "forward"
+ : "reverse");
if (!record_full_resumed)
{
@@ -1181,9 +1172,8 @@ record_full_wait_1 (struct target_ops *ops,
if (status->kind () == TARGET_WAITKIND_IGNORE)
{
if (record_debug)
- gdb_printf (gdb_stdlog,
- "Process record: record_full_wait "
- "target beneath not done yet\n");
+ gdb_printf (gdb_stdlog, "Process record: record_full_wait "
+ "target beneath not done yet\n");
return ret;
}
@@ -1233,8 +1223,8 @@ record_full_wait_1 (struct target_ops *ops,
if (!record_full_message_wrapper_safe (regcache,
GDB_SIGNAL_0))
{
- status->set_stopped (GDB_SIGNAL_0);
- break;
+ status->set_stopped (GDB_SIGNAL_0);
+ break;
}
process_stratum_target *proc_target
@@ -1246,9 +1236,9 @@ record_full_wait_1 (struct target_ops *ops,
If insert success, set step to 0. */
set_executing (proc_target, inferior_ptid, false);
SCOPE_EXIT
- {
- set_executing (proc_target, inferior_ptid, true);
- };
+ {
+ set_executing (proc_target, inferior_ptid, true);
+ };
reinit_frame_cache ();
step = !insert_single_step_breakpoints (gdbarch);
@@ -1295,12 +1285,11 @@ record_full_wait_1 (struct target_ops *ops,
if (execution_direction == EXEC_FORWARD)
{
tmp_pc = regcache_read_pc (regcache);
- if (record_check_stopped_by_breakpoint (aspace, tmp_pc,
- &record_full_stop_reason))
+ if (record_check_stopped_by_breakpoint (
+ aspace, tmp_pc, &record_full_stop_reason))
{
if (record_debug)
- gdb_printf (gdb_stdlog,
- "Process record: break at %s.\n",
+ gdb_printf (gdb_stdlog, "Process record: break at %s.\n",
paddress (gdbarch, tmp_pc));
goto replay_out;
}
@@ -1343,11 +1332,10 @@ record_full_wait_1 (struct target_ops *ops,
if (record_full_list->type == record_full_end)
{
if (record_debug > 1)
- gdb_printf
- (gdb_stdlog,
- "Process record: record_full_end %s to "
- "inferior.\n",
- host_address_to_string (record_full_list));
+ gdb_printf (gdb_stdlog,
+ "Process record: record_full_end %s to "
+ "inferior.\n",
+ host_address_to_string (record_full_list));
if (first_record_full_end
&& execution_direction == EXEC_REVERSE)
@@ -1367,15 +1355,14 @@ record_full_wait_1 (struct target_ops *ops,
if (record_full_resume_step)
{
if (record_debug > 1)
- gdb_printf (gdb_stdlog,
- "Process record: step.\n");
+ gdb_printf (gdb_stdlog, "Process record: step.\n");
continue_flag = 0;
}
/* check breakpoint */
tmp_pc = regcache_read_pc (regcache);
- if (record_check_stopped_by_breakpoint
- (aspace, tmp_pc, &record_full_stop_reason))
+ if (record_check_stopped_by_breakpoint (
+ aspace, tmp_pc, &record_full_stop_reason))
{
if (record_debug)
gdb_printf (gdb_stdlog,
@@ -1390,9 +1377,8 @@ record_full_wait_1 (struct target_ops *ops,
== TARGET_STOPPED_BY_WATCHPOINT)
{
if (record_debug)
- gdb_printf (gdb_stdlog,
- "Process record: hit hw "
- "watchpoint.\n");
+ gdb_printf (gdb_stdlog, "Process record: hit hw "
+ "watchpoint.\n");
continue_flag = 0;
}
/* Check target signal */
@@ -1540,7 +1526,7 @@ record_full_registers_change (struct regcache *regcache, int regnum)
if (record_full_arch_list_add_reg (regcache, i))
{
record_full_list_release (record_full_arch_list_tail);
- error (_("Process record: failed to record execution log."));
+ error (_ ("Process record: failed to record execution log."));
}
}
}
@@ -1549,13 +1535,13 @@ record_full_registers_change (struct regcache *regcache, int regnum)
if (record_full_arch_list_add_reg (regcache, regnum))
{
record_full_list_release (record_full_arch_list_tail);
- error (_("Process record: failed to record execution log."));
+ error (_ ("Process record: failed to record execution log."));
}
}
if (record_full_arch_list_add_end ())
{
record_full_list_release (record_full_arch_list_tail);
- error (_("Process record: failed to record execution log."));
+ error (_ ("Process record: failed to record execution log."));
}
record_full_list->next = record_full_arch_list_head;
record_full_arch_list_head->prev = record_full_list;
@@ -1580,18 +1566,15 @@ record_full_target::store_registers (struct regcache *regcache, int regno)
/* Let user choose if he wants to write register or not. */
if (regno < 0)
- n =
- query (_("Because GDB is in replay mode, changing the "
- "value of a register will make the execution "
- "log unusable from this point onward. "
- "Change all registers?"));
+ n = query (_ ("Because GDB is in replay mode, changing the "
+ "value of a register will make the execution "
+ "log unusable from this point onward. "
+ "Change all registers?"));
else
- n =
- query (_("Because GDB is in replay mode, changing the value "
- "of a register will make the execution log unusable "
- "from this point onward. Change register %s?"),
- gdbarch_register_name (regcache->arch (),
- regno));
+ n = query (_ ("Because GDB is in replay mode, changing the value "
+ "of a register will make the execution log unusable "
+ "from this point onward. Change register %s?"),
+ gdbarch_register_name (regcache->arch (), regno));
if (!n)
{
@@ -1601,15 +1584,13 @@ record_full_target::store_registers (struct regcache *regcache, int regno)
{
int i;
- for (i = 0;
- i < gdbarch_num_regs (regcache->arch ());
- i++)
+ for (i = 0; i < gdbarch_num_regs (regcache->arch ()); i++)
regcache->invalidate (i);
}
else
regcache->invalidate (regno);
- error (_("Process record canceled the operation."));
+ error (_ ("Process record canceled the operation."));
}
/* Destroy the record from here forward. */
@@ -1627,23 +1608,23 @@ record_full_target::store_registers (struct regcache *regcache, int regno)
invalidate the record/replay log from this point forward. */
enum target_xfer_status
-record_full_target::xfer_partial (enum target_object object,
- const char *annex, gdb_byte *readbuf,
- const gdb_byte *writebuf, ULONGEST offset,
- ULONGEST len, ULONGEST *xfered_len)
+record_full_target::xfer_partial (enum target_object object, const char *annex,
+ gdb_byte *readbuf, const gdb_byte *writebuf,
+ ULONGEST offset, ULONGEST len,
+ ULONGEST *xfered_len)
{
if (!record_full_gdb_operation_disable
- && (object == TARGET_OBJECT_MEMORY
- || object == TARGET_OBJECT_RAW_MEMORY) && writebuf)
+ && (object == TARGET_OBJECT_MEMORY || object == TARGET_OBJECT_RAW_MEMORY)
+ && writebuf)
{
if (RECORD_FULL_IS_REPLAY)
{
/* Let user choose if he wants to write memory or not. */
- if (!query (_("Because GDB is in replay mode, writing to memory "
- "will make the execution log unusable from this "
- "point onward. Write memory at address %s?"),
- paddress (target_gdbarch (), offset)))
- error (_("Process record canceled the operation."));
+ if (!query (_ ("Because GDB is in replay mode, writing to memory "
+ "will make the execution log unusable from this "
+ "point onward. Write memory at address %s?"),
+ paddress (target_gdbarch (), offset)))
+ error (_ ("Process record canceled the operation."));
/* Destroy the record from here forward. */
record_full_list_release_following (record_full_list);
@@ -1659,18 +1640,16 @@ record_full_target::xfer_partial (enum target_object object,
{
record_full_list_release (record_full_arch_list_tail);
if (record_debug)
- gdb_printf (gdb_stdlog,
- "Process record: failed to record "
- "execution log.");
+ gdb_printf (gdb_stdlog, "Process record: failed to record "
+ "execution log.");
return TARGET_XFER_E_IO;
}
if (record_full_arch_list_add_end ())
{
record_full_list_release (record_full_arch_list_tail);
if (record_debug)
- gdb_printf (gdb_stdlog,
- "Process record: failed to record "
- "execution log.");
+ gdb_printf (gdb_stdlog, "Process record: failed to record "
+ "execution log.");
return TARGET_XFER_E_IO;
}
record_full_list->next = record_full_arch_list_head;
@@ -1697,8 +1676,7 @@ record_full_target::xfer_partial (enum target_object object,
struct record_full_breakpoint
{
record_full_breakpoint (struct address_space *address_space_,
- CORE_ADDR addr_,
- bool in_target_beneath_)
+ CORE_ADDR addr_, bool in_target_beneath_)
: address_space (address_space_),
addr (addr_),
in_target_beneath (in_target_beneath_)
@@ -1732,9 +1710,9 @@ record_full_init_record_breakpoints (void)
continue;
if (loc->inserted)
- record_full_breakpoints.emplace_back
- (loc->target_info.placed_address_space,
- loc->target_info.placed_address, 1);
+ record_full_breakpoints.emplace_back (
+ loc->target_info.placed_address_space,
+ loc->target_info.placed_address, 1);
}
}
@@ -1793,8 +1771,7 @@ record_full_target::remove_breakpoint (struct gdbarch *gdbarch,
enum remove_bp_reason reason)
{
for (auto iter = record_full_breakpoints.begin ();
- iter != record_full_breakpoints.end ();
- ++iter)
+ iter != record_full_breakpoints.end (); ++iter)
{
struct record_full_breakpoint &bp = *iter;
@@ -1843,11 +1820,9 @@ record_full_base_target::get_bookmark (const char *args, int from_tty)
if (record_debug)
{
if (ret)
- gdb_printf (gdb_stdlog,
- "record_full_get_bookmark returns %s\n", ret);
+ gdb_printf (gdb_stdlog, "record_full_get_bookmark returns %s\n", ret);
else
- gdb_printf (gdb_stdlog,
- "record_full_get_bookmark returns NULL\n");
+ gdb_printf (gdb_stdlog, "record_full_get_bookmark returns NULL\n");
}
return (gdb_byte *) ret;
}
@@ -1861,14 +1836,14 @@ record_full_base_target::goto_bookmark (const gdb_byte *raw_bookmark,
const char *bookmark = (const char *) raw_bookmark;
if (record_debug)
- gdb_printf (gdb_stdlog,
- "record_full_goto_bookmark receives %s\n", bookmark);
+ gdb_printf (gdb_stdlog, "record_full_goto_bookmark receives %s\n",
+ bookmark);
std::string name_holder;
if (bookmark[0] == '\'' || bookmark[0] == '\"')
{
if (bookmark[strlen (bookmark) - 1] != bookmark[0])
- error (_("Unbalanced quotes: %s"), bookmark);
+ error (_ ("Unbalanced quotes: %s"), bookmark);
name_holder = std::string (bookmark + 1, strlen (bookmark) - 2);
bookmark = name_holder.c_str ();
@@ -1897,13 +1872,12 @@ record_full_base_target::info_record ()
struct record_full_entry *p;
if (RECORD_FULL_IS_REPLAY)
- gdb_printf (_("Replay mode:\n"));
+ gdb_printf (_ ("Replay mode:\n"));
else
- gdb_printf (_("Record mode:\n"));
+ gdb_printf (_ ("Record mode:\n"));
/* Find entry for first actual instruction in the log. */
- for (p = record_full_first.next;
- p != NULL && p->type != record_full_end;
+ for (p = record_full_first.next; p != NULL && p->type != record_full_end;
p = p->next)
;
@@ -1911,27 +1885,26 @@ record_full_base_target::info_record ()
if (p != NULL && p->type == record_full_end)
{
/* Display instruction number for first instruction in the log. */
- gdb_printf (_("Lowest recorded instruction number is %s.\n"),
+ gdb_printf (_ ("Lowest recorded instruction number is %s.\n"),
pulongest (p->u.end.insn_num));
/* If in replay mode, display where we are in the log. */
if (RECORD_FULL_IS_REPLAY)
- gdb_printf (_("Current instruction number is %s.\n"),
+ gdb_printf (_ ("Current instruction number is %s.\n"),
pulongest (record_full_list->u.end.insn_num));
/* Display instruction number for last instruction in the log. */
- gdb_printf (_("Highest recorded instruction number is %s.\n"),
+ gdb_printf (_ ("Highest recorded instruction number is %s.\n"),
pulongest (record_full_insn_count));
/* Display log count. */
- gdb_printf (_("Log contains %u instructions.\n"),
- record_full_insn_num);
+ gdb_printf (_ ("Log contains %u instructions.\n"), record_full_insn_num);
}
else
- gdb_printf (_("No instructions have been logged.\n"));
+ gdb_printf (_ ("No instructions have been logged.\n"));
/* Display max log size. */
- gdb_printf (_("Max logged instructions is %u.\n"),
+ gdb_printf (_ ("Max logged instructions is %u.\n"),
record_full_insn_max_num);
}
@@ -1975,18 +1948,18 @@ static void
record_full_goto_entry (struct record_full_entry *p)
{
if (p == NULL)
- error (_("Target insn not found."));
+ error (_ ("Target insn not found."));
else if (p == record_full_list)
- error (_("Already at target insn."));
+ error (_ ("Already at target insn."));
else if (p->u.end.insn_num > record_full_list->u.end.insn_num)
{
- gdb_printf (_("Go forward to insn number %s\n"),
+ gdb_printf (_ ("Go forward to insn number %s\n"),
pulongest (p->u.end.insn_num));
record_full_goto_insn (p, EXEC_FORWARD);
}
else
{
- gdb_printf (_("Go backward to insn number %s\n"),
+ gdb_printf (_ ("Go backward to insn number %s\n"),
pulongest (p->u.end.insn_num));
record_full_goto_insn (p, EXEC_REVERSE);
}
@@ -2020,7 +1993,7 @@ record_full_base_target::goto_record_end ()
for (p = record_full_list; p->next != NULL; p = p->next)
;
- for (; p!= NULL; p = p->prev)
+ for (; p != NULL; p = p->prev)
if (p->type == record_full_end)
break;
@@ -2052,8 +2025,7 @@ record_full_base_target::record_stop_replaying ()
/* "resume" method for prec over corefile. */
void
-record_full_core_target::resume (ptid_t ptid, int step,
- enum gdb_signal signal)
+record_full_core_target::resume (ptid_t ptid, int step, enum gdb_signal signal)
{
record_full_resume_step = step;
record_full_resumed = 1;
@@ -2074,15 +2046,14 @@ record_full_core_target::kill ()
/* "fetch_registers" method for prec over corefile. */
void
-record_full_core_target::fetch_registers (struct regcache *regcache,
- int regno)
+record_full_core_target::fetch_registers (struct regcache *regcache, int regno)
{
if (regno < 0)
{
int num = gdbarch_num_regs (regcache->arch ());
int i;
- for (i = 0; i < num; i ++)
+ for (i = 0; i < num; i++)
regcache->raw_supply (i, *record_full_core_regbuf);
}
else
@@ -2099,13 +2070,12 @@ record_full_core_target::prepare_to_store (struct regcache *regcache)
/* "store_registers" method for prec over corefile. */
void
-record_full_core_target::store_registers (struct regcache *regcache,
- int regno)
+record_full_core_target::store_registers (struct regcache *regcache, int regno)
{
if (record_full_gdb_operation_disable)
record_full_core_regbuf->raw_supply (regno, *regcache);
else
- error (_("You can't do that without a process to debug."));
+ error (_ ("You can't do that without a process to debug."));
}
/* "xfer_partial" method for prec over corefile. */
@@ -2113,8 +2083,9 @@ record_full_core_target::store_registers (struct regcache *regcache,
enum target_xfer_status
record_full_core_target::xfer_partial (enum target_object object,
const char *annex, gdb_byte *readbuf,
- const gdb_byte *writebuf, ULONGEST offset,
- ULONGEST len, ULONGEST *xfered_len)
+ const gdb_byte *writebuf,
+ ULONGEST offset, ULONGEST len,
+ ULONGEST *xfered_len)
{
if (object == TARGET_OBJECT_MEMORY)
{
@@ -2158,10 +2129,9 @@ record_full_core_target::xfer_partial (enum target_object object,
/* Add a new entry. */
entry = XNEW (struct record_full_core_buf_entry);
entry->p = &p;
- if (!bfd_malloc_and_get_section
- (p.the_bfd_section->owner,
- p.the_bfd_section,
- &entry->buf))
+ if (!bfd_malloc_and_get_section (
+ p.the_bfd_section->owner, p.the_bfd_section,
+ &entry->buf))
{
xfree (entry);
return TARGET_XFER_EOF;
@@ -2170,19 +2140,18 @@ record_full_core_target::xfer_partial (enum target_object object,
record_full_core_buf_list = entry;
}
- memcpy (entry->buf + sec_offset, writebuf,
- (size_t) len);
+ memcpy (entry->buf + sec_offset, writebuf, (size_t) len);
}
else
{
if (!entry)
return this->beneath ()->xfer_partial (object, annex,
- readbuf, writebuf,
+ readbuf,
+ writebuf,
offset, len,
xfered_len);
- memcpy (readbuf, entry->buf + sec_offset,
- (size_t) len);
+ memcpy (readbuf, entry->buf + sec_offset, (size_t) len);
}
*xfered_len = len;
@@ -2193,12 +2162,11 @@ record_full_core_target::xfer_partial (enum target_object object,
return TARGET_XFER_E_IO;
}
else
- error (_("You can't do that without a process to debug."));
+ error (_ ("You can't do that without a process to debug."));
}
- return this->beneath ()->xfer_partial (object, annex,
- readbuf, writebuf, offset, len,
- xfered_len);
+ return this->beneath ()->xfer_partial (object, annex, readbuf, writebuf,
+ offset, len, xfered_len);
}
/* "insert_breakpoint" method for prec over corefile. */
@@ -2280,9 +2248,8 @@ bfdcore_read (bfd *obfd, asection *osec, void *buf, int len, int *offset)
if (ret)
*offset += len;
else
- error (_("Failed to read %d bytes from core file %s ('%s')."),
- len, bfd_get_filename (obfd),
- bfd_errmsg (bfd_get_error ()));
+ error (_ ("Failed to read %d bytes from core file %s ('%s')."), len,
+ bfd_get_filename (obfd), bfd_errmsg (bfd_get_error ()));
}
static inline uint64_t
@@ -2290,8 +2257,8 @@ netorder64 (uint64_t input)
{
uint64_t ret;
- store_unsigned_integer ((gdb_byte *) &ret, sizeof (ret),
- BFD_ENDIAN_BIG, input);
+ store_unsigned_integer ((gdb_byte *) &ret, sizeof (ret), BFD_ENDIAN_BIG,
+ input);
return ret;
}
@@ -2300,8 +2267,8 @@ netorder32 (uint32_t input)
{
uint32_t ret;
- store_unsigned_integer ((gdb_byte *) &ret, sizeof (ret),
- BFD_ENDIAN_BIG, input);
+ store_unsigned_integer ((gdb_byte *) &ret, sizeof (ret), BFD_ENDIAN_BIG,
+ input);
return ret;
}
@@ -2323,7 +2290,7 @@ record_full_restore (void)
/* "record_full_restore" can only be called when record list is empty. */
gdb_assert (record_full_first.next == NULL);
-
+
if (record_debug)
gdb_printf (gdb_stdlog, "Restoring recording from core file.\n");
@@ -2341,7 +2308,7 @@ record_full_restore (void)
/* Check the magic code. */
bfdcore_read (core_bfd, osec, &magic, sizeof (magic), &bfd_offset);
if (magic != RECORD_FULL_FILE_MAGIC)
- error (_("Version mis-match or file format error in core file %s."),
+ error (_ ("Version mis-match or file format error in core file %s."),
bfd_get_filename (core_bfd));
if (record_debug)
gdb_printf (gdb_stdlog,
@@ -2368,14 +2335,15 @@ record_full_restore (void)
/* We are finished when offset reaches osec_size. */
if (bfd_offset >= osec_size)
break;
- bfdcore_read (core_bfd, osec, &rectype, sizeof (rectype), &bfd_offset);
+ bfdcore_read (core_bfd, osec, &rectype, sizeof (rectype),
+ &bfd_offset);
switch (rectype)
{
case record_full_reg: /* reg */
/* Get register number to regnum. */
- bfdcore_read (core_bfd, osec, &regnum,
- sizeof (regnum), &bfd_offset);
+ bfdcore_read (core_bfd, osec, &regnum, sizeof (regnum),
+ &bfd_offset);
regnum = netorder32 (regnum);
rec = record_full_reg_alloc (regcache, regnum);
@@ -2388,20 +2356,17 @@ record_full_restore (void)
gdb_printf (gdb_stdlog,
" Reading register %d (1 "
"plus %lu plus %d bytes)\n",
- rec->u.reg.num,
- (unsigned long) sizeof (regnum),
+ rec->u.reg.num, (unsigned long) sizeof (regnum),
rec->u.reg.len);
break;
case record_full_mem: /* mem */
/* Get len. */
- bfdcore_read (core_bfd, osec, &len,
- sizeof (len), &bfd_offset);
+ bfdcore_read (core_bfd, osec, &len, sizeof (len), &bfd_offset);
len = netorder32 (len);
/* Get addr. */
- bfdcore_read (core_bfd, osec, &addr,
- sizeof (addr), &bfd_offset);
+ bfdcore_read (core_bfd, osec, &addr, sizeof (addr), &bfd_offset);
addr = netorder64 (addr);
rec = record_full_mem_alloc (addr, len);
@@ -2414,26 +2379,24 @@ record_full_restore (void)
gdb_printf (gdb_stdlog,
" Reading memory %s (1 plus "
"%lu plus %lu plus %d bytes)\n",
- paddress (get_current_arch (),
- rec->u.mem.addr),
+ paddress (get_current_arch (), rec->u.mem.addr),
(unsigned long) sizeof (addr),
- (unsigned long) sizeof (len),
- rec->u.mem.len);
+ (unsigned long) sizeof (len), rec->u.mem.len);
break;
case record_full_end: /* end */
rec = record_full_end_alloc ();
- record_full_insn_num ++;
+ record_full_insn_num++;
/* Get signal value. */
- bfdcore_read (core_bfd, osec, &signal,
- sizeof (signal), &bfd_offset);
+ bfdcore_read (core_bfd, osec, &signal, sizeof (signal),
+ &bfd_offset);
signal = netorder32 (signal);
rec->u.end.sigval = (enum gdb_signal) signal;
/* Get insn count. */
- bfdcore_read (core_bfd, osec, &count,
- sizeof (count), &bfd_offset);
+ bfdcore_read (core_bfd, osec, &count, sizeof (count),
+ &bfd_offset);
count = netorder32 (count);
rec->u.end.insn_num = count;
record_full_insn_count = count + 1;
@@ -2443,12 +2406,11 @@ record_full_restore (void)
"%lu + %lu bytes), offset == %s\n",
(unsigned long) sizeof (signal),
(unsigned long) sizeof (count),
- paddress (get_current_arch (),
- bfd_offset));
+ paddress (get_current_arch (), bfd_offset));
break;
default:
- error (_("Bad entry type in core file %s."),
+ error (_ ("Bad entry type in core file %s."),
bfd_get_filename (core_bfd));
break;
}
@@ -2473,12 +2435,12 @@ record_full_restore (void)
if (record_full_insn_num > record_full_insn_max_num)
{
record_full_insn_max_num = record_full_insn_num;
- warning (_("Auto increase record/replay buffer limit to %u."),
+ warning (_ ("Auto increase record/replay buffer limit to %u."),
record_full_insn_max_num);
}
/* Succeeded. */
- gdb_printf (_("Restored records from core file %s.\n"),
+ gdb_printf (_ ("Restored records from core file %s.\n"),
bfd_get_filename (core_bfd));
print_stack_frame (get_selected_frame (NULL), 1, SRC_AND_LOC, 1);
@@ -2494,9 +2456,8 @@ bfdcore_write (bfd *obfd, asection *osec, void *buf, int len, int *offset)
if (ret)
*offset += len;
else
- error (_("Failed to write %d bytes to core file %s ('%s')."),
- len, bfd_get_filename (obfd),
- bfd_errmsg (bfd_get_error ()));
+ error (_ ("Failed to write %d bytes to core file %s ('%s')."), len,
+ bfd_get_filename (obfd), bfd_errmsg (bfd_get_error ()));
}
/* Restore the execution log from a file. We use a modified elf
@@ -2559,7 +2520,7 @@ record_full_base_target::save_record (const char *recfilename)
}
/* Compute the size needed for the extra bfd section. */
- save_size = 4; /* magic cookie */
+ save_size = 4; /* magic cookie */
for (record_full_list = record_full_first.next; record_full_list;
record_full_list = record_full_list->next)
switch (record_full_list->type)
@@ -2577,12 +2538,10 @@ record_full_base_target::save_record (const char *recfilename)
/* Make the new bfd section. */
osec = bfd_make_section_anyway_with_flags (obfd.get (), "precord",
- SEC_HAS_CONTENTS
- | SEC_READONLY);
+ SEC_HAS_CONTENTS | SEC_READONLY);
if (osec == NULL)
- error (_("Failed to create 'precord' section for corefile %s: %s"),
- recfilename,
- bfd_errmsg (bfd_get_error ()));
+ error (_ ("Failed to create 'precord' section for corefile %s: %s"),
+ recfilename, bfd_errmsg (bfd_get_error ()));
bfd_set_section_size (osec, save_size);
bfd_set_section_vma (osec, 0);
bfd_set_section_alignment (osec, 0);
@@ -2628,8 +2587,8 @@ record_full_base_target::save_record (const char *recfilename)
/* Write regnum. */
regnum = netorder32 (record_full_list->u.reg.num);
- bfdcore_write (obfd.get (), osec, &regnum,
- sizeof (regnum), &bfd_offset);
+ bfdcore_write (obfd.get (), osec, &regnum, sizeof (regnum),
+ &bfd_offset);
/* Write regval. */
bfdcore_write (obfd.get (), osec,
@@ -2642,8 +2601,7 @@ record_full_base_target::save_record (const char *recfilename)
gdb_printf (gdb_stdlog,
" Writing memory %s (1 plus "
"%lu plus %lu plus %d bytes)\n",
- paddress (gdbarch,
- record_full_list->u.mem.addr),
+ paddress (gdbarch, record_full_list->u.mem.addr),
(unsigned long) sizeof (addr),
(unsigned long) sizeof (len),
record_full_list->u.mem.len);
@@ -2655,8 +2613,8 @@ record_full_base_target::save_record (const char *recfilename)
/* Write memaddr. */
addr = netorder64 (record_full_list->u.mem.addr);
- bfdcore_write (obfd.get (), osec, &addr,
- sizeof (addr), &bfd_offset);
+ bfdcore_write (obfd.get (), osec, &addr, sizeof (addr),
+ &bfd_offset);
/* Write memval. */
bfdcore_write (obfd.get (), osec,
@@ -2664,23 +2622,23 @@ record_full_base_target::save_record (const char *recfilename)
record_full_list->u.mem.len, &bfd_offset);
break;
- case record_full_end:
- if (record_debug)
- gdb_printf (gdb_stdlog,
- " Writing record_full_end (1 + "
- "%lu + %lu bytes)\n",
- (unsigned long) sizeof (signal),
- (unsigned long) sizeof (count));
- /* Write signal value. */
- signal = netorder32 (record_full_list->u.end.sigval);
- bfdcore_write (obfd.get (), osec, &signal,
- sizeof (signal), &bfd_offset);
-
- /* Write insn count. */
- count = netorder32 (record_full_list->u.end.insn_num);
- bfdcore_write (obfd.get (), osec, &count,
- sizeof (count), &bfd_offset);
- break;
+ case record_full_end:
+ if (record_debug)
+ gdb_printf (gdb_stdlog,
+ " Writing record_full_end (1 + "
+ "%lu + %lu bytes)\n",
+ (unsigned long) sizeof (signal),
+ (unsigned long) sizeof (count));
+ /* Write signal value. */
+ signal = netorder32 (record_full_list->u.end.sigval);
+ bfdcore_write (obfd.get (), osec, &signal, sizeof (signal),
+ &bfd_offset);
+
+ /* Write insn count. */
+ count = netorder32 (record_full_list->u.end.insn_num);
+ bfdcore_write (obfd.get (), osec, &count, sizeof (count),
+ &bfd_offset);
+ break;
}
}
@@ -2709,8 +2667,7 @@ record_full_base_target::save_record (const char *recfilename)
unlink_file.keep ();
/* Succeeded. */
- gdb_printf (_("Saved core file %s with execution log.\n"),
- recfilename);
+ gdb_printf (_ ("Saved core file %s with execution log.\n"), recfilename);
}
/* record_full_goto_insn -- rewind the record log (forward or backward,
@@ -2739,7 +2696,8 @@ record_full_goto_insn (struct record_full_entry *entry,
record_full_list = record_full_list->prev;
else
record_full_list = record_full_list->next;
- } while (record_full_list != entry);
+ }
+ while (record_full_list != entry);
}
/* Alias for "target record-full". */
@@ -2758,10 +2716,10 @@ set_record_full_insn_max_num (const char *args, int from_tty,
{
/* Count down record_full_insn_num while releasing records from list. */
while (record_full_insn_num > record_full_insn_max_num)
- {
- record_full_list_release_first ();
- record_full_insn_num--;
- }
+ {
+ record_full_list_release_first ();
+ record_full_insn_num--;
+ }
}
}
@@ -2786,7 +2744,7 @@ maintenance_print_record_instruction (const char *args, int from_tty)
offset--;
}
if (offset != 0)
- error (_("Not enough recorded history"));
+ error (_ ("Not enough recorded history"));
}
else
{
@@ -2797,7 +2755,7 @@ maintenance_print_record_instruction (const char *args, int from_tty)
offset++;
}
if (offset != 0)
- error (_("Not enough recorded history"));
+ error (_ ("Not enough recorded history"));
}
}
gdb_assert (to_print != nullptr);
@@ -2809,47 +2767,47 @@ maintenance_print_record_instruction (const char *args, int from_tty)
/* if we're in the first record, there are no actual instructions
recorded. Warn the user and leave. */
if (to_print == &record_full_first)
- error (_("Not enough recorded history"));
+ error (_ ("Not enough recorded history"));
while (to_print->type != record_full_end)
{
switch (to_print->type)
{
- case record_full_reg:
- {
- type *regtype = gdbarch_register_type (target_gdbarch (),
- to_print->u.reg.num);
- value *val
- = value_from_contents (regtype,
- record_full_get_loc (to_print));
- gdb_printf ("Register %s changed: ",
- gdbarch_register_name (target_gdbarch (),
- to_print->u.reg.num));
- struct value_print_options opts;
- get_user_print_options (&opts);
- opts.raw = true;
- value_print (val, gdb_stdout, &opts);
- gdb_printf ("\n");
- break;
- }
- case record_full_mem:
- {
- gdb_byte *b = record_full_get_loc (to_print);
- gdb_printf ("%d bytes of memory at address %s changed from:",
- to_print->u.mem.len,
- print_core_address (target_gdbarch (),
- to_print->u.mem.addr));
- for (int i = 0; i < to_print->u.mem.len; i++)
- gdb_printf (" %02x", b[i]);
- gdb_printf ("\n");
- break;
- }
+ case record_full_reg:
+ {
+ type *regtype
+ = gdbarch_register_type (target_gdbarch (), to_print->u.reg.num);
+ value *val
+ = value_from_contents (regtype, record_full_get_loc (to_print));
+ gdb_printf ("Register %s changed: ",
+ gdbarch_register_name (target_gdbarch (),
+ to_print->u.reg.num));
+ struct value_print_options opts;
+ get_user_print_options (&opts);
+ opts.raw = true;
+ value_print (val, gdb_stdout, &opts);
+ gdb_printf ("\n");
+ break;
+ }
+ case record_full_mem:
+ {
+ gdb_byte *b = record_full_get_loc (to_print);
+ gdb_printf ("%d bytes of memory at address %s changed from:",
+ to_print->u.mem.len,
+ print_core_address (target_gdbarch (),
+ to_print->u.mem.addr));
+ for (int i = 0; i < to_print->u.mem.len; i++)
+ gdb_printf (" %02x", b[i]);
+ gdb_printf ("\n");
+ break;
+ }
}
to_print = to_print->next;
}
}
void _initialize_record_full ();
+
void
_initialize_record_full ()
{
@@ -2865,12 +2823,12 @@ _initialize_record_full ()
add_target (record_full_core_target_info, record_full_open);
add_prefix_cmd ("full", class_obscure, cmd_record_full_start,
- _("Start full execution recording."), &record_full_cmdlist,
+ _ ("Start full execution recording."), &record_full_cmdlist,
0, &record_cmdlist);
cmd_list_element *record_full_restore_cmd
= add_cmd ("restore", class_obscure, cmd_record_full_restore,
- _("Restore the execution log from a file.\n\
+ _ ("Restore the execution log from a file.\n\
Argument is filename. File must be created with 'record save'."),
&record_full_cmdlist);
set_cmd_completer (record_full_restore_cmd, filename_completer);
@@ -2881,48 +2839,43 @@ Argument is filename. File must be created with 'record save'."),
set_cmd_completer (c, filename_completer);
deprecate_cmd (c, "record full restore");
- add_setshow_prefix_cmd ("full", class_support,
- _("Set record options."),
- _("Show record options."),
- &set_record_full_cmdlist,
- &show_record_full_cmdlist,
- &set_record_cmdlist,
+ add_setshow_prefix_cmd ("full", class_support, _ ("Set record options."),
+ _ ("Show record options."), &set_record_full_cmdlist,
+ &show_record_full_cmdlist, &set_record_cmdlist,
&show_record_cmdlist);
/* Record instructions number limit command. */
set_show_commands set_record_full_stop_at_limit_cmds
= add_setshow_boolean_cmd ("stop-at-limit", no_class,
- &record_full_stop_at_limit, _("\
-Set whether record/replay stops when record/replay buffer becomes full."), _("\
+ &record_full_stop_at_limit, _ ("\
+Set whether record/replay stops when record/replay buffer becomes full."),
+ _ ("\
Show whether record/replay stops when record/replay buffer becomes full."),
- _("Default is ON.\n\
+ _ ("Default is ON.\n\
When ON, if the record/replay buffer becomes full, ask user what to do.\n\
When OFF, if the record/replay buffer becomes full,\n\
delete the oldest recorded instruction to make room for each new one."),
- NULL, NULL,
- &set_record_full_cmdlist,
+ NULL, NULL, &set_record_full_cmdlist,
&show_record_full_cmdlist);
- c = add_alias_cmd ("stop-at-limit",
- set_record_full_stop_at_limit_cmds.set, no_class, 1,
- &set_record_cmdlist);
+ c = add_alias_cmd ("stop-at-limit", set_record_full_stop_at_limit_cmds.set,
+ no_class, 1, &set_record_cmdlist);
deprecate_cmd (c, "set record full stop-at-limit");
- c = add_alias_cmd ("stop-at-limit",
- set_record_full_stop_at_limit_cmds.show, no_class, 1,
- &show_record_cmdlist);
+ c = add_alias_cmd ("stop-at-limit", set_record_full_stop_at_limit_cmds.show,
+ no_class, 1, &show_record_cmdlist);
deprecate_cmd (c, "show record full stop-at-limit");
set_show_commands record_full_insn_number_max_cmds
= add_setshow_uinteger_cmd ("insn-number-max", no_class,
&record_full_insn_max_num,
- _("Set record/replay buffer limit."),
- _("Show record/replay buffer limit."), _("\
+ _ ("Set record/replay buffer limit."),
+ _ ("Show record/replay buffer limit."), _ ("\
Set the maximum number of instructions to be stored in the\n\
record/replay buffer. A value of either \"unlimited\" or zero means no\n\
limit. Default is 200000."),
- set_record_full_insn_max_num,
- NULL, &set_record_full_cmdlist,
+ set_record_full_insn_max_num, NULL,
+ &set_record_full_cmdlist,
&show_record_full_cmdlist);
c = add_alias_cmd ("insn-number-max", record_full_insn_number_max_cmds.set,
@@ -2935,15 +2888,14 @@ limit. Default is 200000."),
set_show_commands record_full_memory_query_cmds
= add_setshow_boolean_cmd ("memory-query", no_class,
- &record_full_memory_query, _("\
+ &record_full_memory_query, _ ("\
Set whether query if PREC cannot record memory change of next instruction."),
- _("\
+ _ ("\
Show whether query if PREC cannot record memory change of next instruction."),
- _("\
+ _ ("\
Default is OFF.\n\
When ON, query if PREC cannot record memory change of next instruction."),
- NULL, NULL,
- &set_record_full_cmdlist,
+ NULL, NULL, &set_record_full_cmdlist,
&show_record_full_cmdlist);
c = add_alias_cmd ("memory-query", record_full_memory_query_cmds.set,
@@ -2951,16 +2903,16 @@ When ON, query if PREC cannot record memory change of next instruction."),
deprecate_cmd (c, "set record full memory-query");
c = add_alias_cmd ("memory-query", record_full_memory_query_cmds.show,
- no_class, 1,&show_record_cmdlist);
+ no_class, 1, &show_record_cmdlist);
deprecate_cmd (c, "show record full memory-query");
add_cmd ("record-instruction", class_maintenance,
- maintenance_print_record_instruction,
- _("\
+ maintenance_print_record_instruction, _ ("\
Print a recorded instruction.\n\
If no argument is provided, print the last instruction recorded.\n\
If a negative argument is given, prints how the nth previous \
instruction will be undone.\n\
If a positive argument is given, prints \
-how the nth following instruction will be redone."), &maintenanceprintlist);
+how the nth following instruction will be redone."),
+ &maintenanceprintlist);
}
diff --git a/gdb/record.c b/gdb/record.c
index f7c95153537..8b68c6428c9 100644
--- a/gdb/record.c
+++ b/gdb/record.c
@@ -53,9 +53,9 @@ struct cmd_list_element *set_record_cmdlist = NULL;
struct cmd_list_element *show_record_cmdlist = NULL;
struct cmd_list_element *info_record_cmdlist = NULL;
-#define DEBUG(msg, args...) \
- if (record_debug) \
- gdb_printf (gdb_stdlog, "record: " msg "\n", ##args)
+#define DEBUG(msg, args...) \
+ if (record_debug) \
+ gdb_printf (gdb_stdlog, "record: " msg "\n", ##args)
/* See record.h. */
@@ -74,8 +74,8 @@ require_record_target (void)
t = find_record_target ();
if (t == NULL)
- error (_("No recording is currently active.\n"
- "Use the \"record full\" or \"record btrace\" command first."));
+ error (_ ("No recording is currently active.\n"
+ "Use the \"record full\" or \"record btrace\" command first."));
return t;
}
@@ -87,8 +87,8 @@ record_preopen (void)
{
/* Check if a record target is already running. */
if (find_record_target () != NULL)
- error (_("The process is already being recorded. Use \"record stop\" to "
- "stop recording first."));
+ error (_ ("The process is already being recorded. Use \"record stop\" to "
+ "stop recording first."));
}
/* See record.h. */
@@ -101,14 +101,14 @@ record_start (const char *method, const char *format, int from_tty)
if (format == NULL)
execute_command_to_string ("record", from_tty, false);
else
- error (_("Invalid format."));
+ error (_ ("Invalid format."));
}
else if (strcmp (method, "full") == 0)
{
if (format == NULL)
execute_command_to_string ("record full", from_tty, false);
else
- error (_("Invalid format."));
+ error (_ ("Invalid format."));
}
else if (strcmp (method, "btrace") == 0)
{
@@ -119,10 +119,10 @@ record_start (const char *method, const char *format, int from_tty)
else if (strcmp (format, "pt") == 0)
execute_command_to_string ("record btrace pt", from_tty, false);
else
- error (_("Invalid format."));
+ error (_ ("Invalid format."));
}
else
- error (_("Invalid method."));
+ error (_ ("Invalid method."));
}
/* See record.h. */
@@ -136,9 +136,8 @@ record_stop (int from_tty)
/* See record.h. */
int
-record_read_memory (struct gdbarch *gdbarch,
- CORE_ADDR memaddr, gdb_byte *myaddr,
- ssize_t len)
+record_read_memory (struct gdbarch *gdbarch, CORE_ADDR memaddr,
+ gdb_byte *myaddr, ssize_t len)
{
int ret = target_read_memory (memaddr, myaddr, len);
@@ -234,8 +233,7 @@ record_kill (struct target_ops *t)
/* See record.h. */
int
-record_check_stopped_by_breakpoint (const address_space *aspace,
- CORE_ADDR pc,
+record_check_stopped_by_breakpoint (const address_space *aspace, CORE_ADDR pc,
enum target_stop_reason *reason)
{
if (breakpoint_inserted_here_p (aspace, pc))
@@ -257,8 +255,7 @@ static void
show_record_debug (struct ui_file *file, int from_tty,
struct cmd_list_element *c, const char *value)
{
- gdb_printf (file, _("Debugging of process record target is %s.\n"),
- value);
+ gdb_printf (file, _ ("Debugging of process record target is %s.\n"), value);
}
/* Alias for "target record". */
@@ -279,20 +276,21 @@ cmd_record_delete (const char *args, int from_tty)
if (!target_record_is_replaying (inferior_ptid))
{
- gdb_printf (_("Already at end of record list.\n"));
+ gdb_printf (_ ("Already at end of record list.\n"));
return;
}
if (!target_supports_delete_record ())
{
- gdb_printf (_("The current record target does not support "
- "this operation.\n"));
+ gdb_printf (_ ("The current record target does not support "
+ "this operation.\n"));
return;
}
- if (!from_tty || query (_("Delete the log from this point forward "
- "and begin to record the running message "
- "at current PC?")))
+ if (!from_tty
+ || query (_ ("Delete the log from this point forward "
+ "and begin to record the running message "
+ "at current PC?")))
target_delete_record ();
}
@@ -308,13 +306,12 @@ cmd_record_stop (const char *args, int from_tty)
record_stop (t);
record_unpush (t);
- gdb_printf (_("Process record is stopped and all execution "
- "logs are deleted.\n"));
+ gdb_printf (_ ("Process record is stopped and all execution "
+ "logs are deleted.\n"));
gdb::observers::record_changed.notify (current_inferior (), 0, NULL, NULL);
}
-
/* The "info record" command. */
static void
@@ -325,11 +322,11 @@ info_record_command (const char *args, int from_tty)
t = find_record_target ();
if (t == NULL)
{
- gdb_printf (_("No recording is currently active.\n"));
+ gdb_printf (_ ("No recording is currently active.\n"));
return;
}
- gdb_printf (_("Active record target: %s\n"), t->shortname ());
+ gdb_printf (_ ("Active record target: %s\n"), t->shortname ());
t->info_record ();
}
@@ -349,7 +346,7 @@ cmd_record_save (const char *args, int from_tty)
{
/* Default recfile name is "gdb_record.PID". */
xsnprintf (recfilename_buffer, sizeof (recfilename_buffer),
- "gdb_record.%d", inferior_ptid.pid ());
+ "gdb_record.%d", inferior_ptid.pid ());
recfilename = recfilename_buffer;
}
@@ -364,7 +361,7 @@ record_goto (const char *arg)
ULONGEST insn;
if (arg == NULL || *arg == '\0')
- error (_("Command requires an argument (insn number to go to)."));
+ error (_ ("Command requires an argument (insn number to go to)."));
insn = parse_and_eval_long (arg);
@@ -389,7 +386,7 @@ static void
cmd_record_goto_begin (const char *arg, int from_tty)
{
if (arg != NULL && *arg != '\0')
- error (_("Junk after argument: %s."), arg);
+ error (_ ("Junk after argument: %s."), arg);
require_record_target ();
target_goto_record_begin ();
@@ -401,7 +398,7 @@ static void
cmd_record_goto_end (const char *arg, int from_tty)
{
if (arg != NULL && *arg != '\0')
- error (_("Junk after argument: %s."), arg);
+ error (_ ("Junk after argument: %s."), arg);
require_record_target ();
target_goto_record_end ();
@@ -419,7 +416,7 @@ get_insn_number (const char **arg)
pos = skip_spaces (begin);
if (!isdigit (*pos))
- error (_("Expected positive number, got: %s."), pos);
+ error (_ ("Expected positive number, got: %s."), pos);
number = strtoulst (pos, &end, 10);
@@ -439,7 +436,7 @@ get_context_size (const char **arg)
pos = skip_spaces (*arg);
if (!isdigit (*pos))
- error (_("Expected positive number, got: %s."), pos);
+ error (_ ("Expected positive number, got: %s."), pos);
long result = strtol (pos, &end, 10);
*arg = end;
@@ -452,7 +449,7 @@ static void
no_chunk (const char *arg)
{
if (*arg != 0)
- error (_("Junk after argument: %s."), arg);
+ error (_ ("Junk after argument: %s."), arg);
}
/* Read instruction-history modifiers from an argument string. */
@@ -474,7 +471,7 @@ get_insn_history_modifiers (const char **arg)
++args;
if (*args == '\0')
- error (_("Missing modifier."));
+ error (_ ("Missing modifier."));
for (; *args; ++args)
{
@@ -504,7 +501,7 @@ get_insn_history_modifiers (const char **arg)
modifiers |= DISASSEMBLY_OMIT_PC;
break;
default:
- error (_("Invalid modifier: %c."), *args);
+ error (_ ("Invalid modifier: %c."), *args);
}
}
@@ -615,7 +612,7 @@ get_call_history_modifiers (const char **arg)
++args;
if (*args == '\0')
- error (_("Missing modifier."));
+ error (_ ("Missing modifier."));
for (; *args; ++args)
{
@@ -637,7 +634,7 @@ get_call_history_modifiers (const char **arg)
modifiers |= RECORD_PRINT_INDENT_CALLS;
break;
default:
- error (_("Invalid modifier: %c."), *args);
+ error (_ ("Invalid modifier: %c."), *args);
}
}
@@ -727,7 +724,7 @@ validate_history_size (unsigned int *command_var, unsigned int *setting)
/* Restore previous value. */
*command_var = *setting;
- error (_("integer %u out of range"), new_value);
+ error (_ ("integer %u out of range"), new_value);
}
/* Commit new value. */
@@ -759,98 +756,98 @@ set_record_call_history_size (const char *args, int from_tty,
}
void _initialize_record ();
+
void
_initialize_record ()
{
struct cmd_list_element *c;
add_setshow_zuinteger_cmd ("record", no_class, &record_debug,
- _("Set debugging of record/replay feature."),
- _("Show debugging of record/replay feature."),
- _("When enabled, debugging output for "
- "record/replay feature is displayed."),
+ _ ("Set debugging of record/replay feature."),
+ _ ("Show debugging of record/replay feature."),
+ _ ("When enabled, debugging output for "
+ "record/replay feature is displayed."),
NULL, show_record_debug, &setdebuglist,
&showdebuglist);
add_setshow_uinteger_cmd ("instruction-history-size", no_class,
- &record_insn_history_size_setshow_var, _("\
-Set number of instructions to print in \"record instruction-history\"."), _("\
-Show number of instructions to print in \"record instruction-history\"."), _("\
+ &record_insn_history_size_setshow_var, _ ("\
+Set number of instructions to print in \"record instruction-history\"."),
+ _ ("\
+Show number of instructions to print in \"record instruction-history\"."),
+ _ ("\
A size of \"unlimited\" means unlimited instructions. The default is 10."),
set_record_insn_history_size, NULL,
&set_record_cmdlist, &show_record_cmdlist);
add_setshow_uinteger_cmd ("function-call-history-size", no_class,
- &record_call_history_size_setshow_var, _("\
-Set number of function to print in \"record function-call-history\"."), _("\
-Show number of functions to print in \"record function-call-history\"."), _("\
+ &record_call_history_size_setshow_var, _ ("\
+Set number of function to print in \"record function-call-history\"."),
+ _ ("\
+Show number of functions to print in \"record function-call-history\"."),
+ _ ("\
A size of \"unlimited\" means unlimited lines. The default is 10."),
set_record_call_history_size, NULL,
&set_record_cmdlist, &show_record_cmdlist);
cmd_list_element *record_cmd
= add_prefix_cmd ("record", class_obscure, cmd_record_start,
- _("Start recording."),
- &record_cmdlist, 0, &cmdlist);
+ _ ("Start recording."), &record_cmdlist, 0, &cmdlist);
set_cmd_completer (record_cmd, filename_completer);
add_com_alias ("rec", record_cmd, class_obscure, 1);
set_show_commands setshow_record_cmds
= add_setshow_prefix_cmd ("record", class_support,
- _("Set record options."),
- _("Show record options."),
- &set_record_cmdlist, &show_record_cmdlist,
- &setlist, &showlist);
-
+ _ ("Set record options."),
+ _ ("Show record options."), &set_record_cmdlist,
+ &show_record_cmdlist, &setlist, &showlist);
add_alias_cmd ("rec", setshow_record_cmds.set, class_obscure, 1, &setlist);
add_alias_cmd ("rec", setshow_record_cmds.show, class_obscure, 1, &showlist);
cmd_list_element *info_record_cmd
= add_prefix_cmd ("record", class_support, info_record_command,
- _("Info record options."), &info_record_cmdlist,
- 0, &infolist);
+ _ ("Info record options."), &info_record_cmdlist, 0,
+ &infolist);
add_alias_cmd ("rec", info_record_cmd, class_obscure, 1, &infolist);
c = add_cmd ("save", class_obscure, cmd_record_save,
- _("Save the execution log to a file.\n\
+ _ ("Save the execution log to a file.\n\
Usage: record save [FILENAME]\n\
Default filename is 'gdb_record.PROCESS_ID'."),
&record_cmdlist);
set_cmd_completer (c, filename_completer);
cmd_list_element *record_delete_cmd
- = add_cmd ("delete", class_obscure, cmd_record_delete,
- _("Delete the rest of execution log and start recording it \
+ = add_cmd ("delete", class_obscure, cmd_record_delete,
+ _ ("Delete the rest of execution log and start recording it \
anew."),
- &record_cmdlist);
+ &record_cmdlist);
add_alias_cmd ("d", record_delete_cmd, class_obscure, 1, &record_cmdlist);
add_alias_cmd ("del", record_delete_cmd, class_obscure, 1, &record_cmdlist);
cmd_list_element *record_stop_cmd
= add_cmd ("stop", class_obscure, cmd_record_stop,
- _("Stop the record/replay target."),
- &record_cmdlist);
+ _ ("Stop the record/replay target."), &record_cmdlist);
add_alias_cmd ("s", record_stop_cmd, class_obscure, 1, &record_cmdlist);
- add_prefix_cmd ("goto", class_obscure, cmd_record_goto, _("\
+ add_prefix_cmd ("goto", class_obscure, cmd_record_goto, _ ("\
Restore the program to its state at instruction number N.\n\
Argument is instruction number, as shown by 'info record'."),
&record_goto_cmdlist, 1, &record_cmdlist);
cmd_list_element *record_goto_begin_cmd
= add_cmd ("begin", class_obscure, cmd_record_goto_begin,
- _("Go to the beginning of the execution log."),
+ _ ("Go to the beginning of the execution log."),
&record_goto_cmdlist);
add_alias_cmd ("start", record_goto_begin_cmd, class_obscure, 1,
&record_goto_cmdlist);
add_cmd ("end", class_obscure, cmd_record_goto_end,
- _("Go to the end of the execution log."),
- &record_goto_cmdlist);
+ _ ("Go to the end of the execution log."), &record_goto_cmdlist);
- add_cmd ("instruction-history", class_obscure, cmd_record_insn_history, _("\
+ add_cmd ("instruction-history", class_obscure, cmd_record_insn_history, _ ("\
Print disassembled instructions stored in the execution log.\n\
With a /m or /s modifier, source lines are included (if available).\n\
With a /r modifier, raw instructions in hex are included.\n\
@@ -870,7 +867,8 @@ The number of instructions to disassemble can be defined with \"set record \
instruction-history-size\"."),
&record_cmdlist);
- add_cmd ("function-call-history", class_obscure, cmd_record_call_history, _("\
+ add_cmd ("function-call-history", class_obscure, cmd_record_call_history,
+ _ ("\
Prints the execution history at function granularity.\n\
It prints one line for each sequence of instructions that belong to the same \
function.\n\
diff --git a/gdb/record.h b/gdb/record.h
index 166b5349988..80f2107d471 100644
--- a/gdb/record.h
+++ b/gdb/record.h
@@ -64,6 +64,7 @@ enum record_print_flag
/* Indent based on call stack depth (if applicable). */
RECORD_PRINT_INDENT_CALLS = (1 << 2)
};
+
DEF_ENUM_FLAGS_TYPE (enum record_print_flag, record_print_flags);
/* Determined whether the target is stopped at a software or hardware
@@ -73,15 +74,13 @@ DEF_ENUM_FLAGS_TYPE (enum record_print_flag, record_print_flags);
otherwise. */
extern int
- record_check_stopped_by_breakpoint (const address_space *aspace,
- CORE_ADDR pc,
- enum target_stop_reason *reason);
+record_check_stopped_by_breakpoint (const address_space *aspace, CORE_ADDR pc,
+ enum target_stop_reason *reason);
/* Wrapper for target_read_memory that prints a debug message if
reading memory fails. */
-extern int record_read_memory (struct gdbarch *gdbarch,
- CORE_ADDR memaddr, gdb_byte *myaddr,
- ssize_t len);
+extern int record_read_memory (struct gdbarch *gdbarch, CORE_ADDR memaddr,
+ gdb_byte *myaddr, ssize_t len);
/* A wrapper for target_goto_record that parses ARG as a number. */
extern void record_goto (const char *arg);
diff --git a/gdb/regcache-dump.c b/gdb/regcache-dump.c
index 9387cfd44f1..c73e39f4164 100644
--- a/gdb/regcache-dump.c
+++ b/gdb/regcache-dump.c
@@ -31,13 +31,16 @@
class register_dump_regcache : public register_dump
{
public:
+
register_dump_regcache (regcache *regcache, bool dump_pseudo)
- : register_dump (regcache->arch ()), m_regcache (regcache),
+ : register_dump (regcache->arch ()),
+ m_regcache (regcache),
m_dump_pseudo (dump_pseudo)
{
}
protected:
+
void dump_reg (ui_file *file, int regnum) override
{
if (regnum < 0)
@@ -79,6 +82,7 @@ protected:
}
private:
+
regcache *m_regcache;
/* Dump pseudo registers or not. */
@@ -91,12 +95,15 @@ private:
class register_dump_reg_buffer : public register_dump, reg_buffer
{
public:
+
register_dump_reg_buffer (gdbarch *gdbarch, bool dump_pseudo)
- : register_dump (gdbarch), reg_buffer (gdbarch, dump_pseudo)
+ : register_dump (gdbarch),
+ reg_buffer (gdbarch, dump_pseudo)
{
}
protected:
+
void dump_reg (ui_file *file, int regnum) override
{
if (regnum < 0)
@@ -139,13 +146,15 @@ protected:
class register_dump_none : public register_dump
{
public:
+
register_dump_none (gdbarch *arch)
: register_dump (arch)
- {}
+ {
+ }
protected:
- void dump_reg (ui_file *file, int regnum) override
- {}
+
+ void dump_reg (ui_file *file, int regnum) override {}
};
/* For "maint print remote-registers". */
@@ -153,11 +162,14 @@ protected:
class register_dump_remote : public register_dump
{
public:
+
register_dump_remote (gdbarch *arch)
: register_dump (arch)
- {}
+ {
+ }
protected:
+
void dump_reg (ui_file *file, int regnum) override
{
if (regnum < 0)
@@ -168,8 +180,8 @@ protected:
{
int pnum, poffset;
- if (remote_register_number_and_offset (m_gdbarch, regnum,
- &pnum, &poffset))
+ if (remote_register_number_and_offset (m_gdbarch, regnum, &pnum,
+ &poffset))
gdb_printf (file, "%7d %11d", pnum, poffset);
}
}
@@ -180,11 +192,14 @@ protected:
class register_dump_groups : public register_dump
{
public:
+
register_dump_groups (gdbarch *arch)
: register_dump (arch)
- {}
+ {
+ }
protected:
+
void dump_reg (ui_file *file, int regnum) override
{
if (regnum < 0)
@@ -206,8 +221,10 @@ protected:
enum regcache_dump_what
{
- regcache_dump_none, regcache_dump_raw,
- regcache_dump_cooked, regcache_dump_groups,
+ regcache_dump_none,
+ regcache_dump_raw,
+ regcache_dump_cooked,
+ regcache_dump_groups,
regcache_dump_remote
};
@@ -223,7 +240,7 @@ regcache_print (const char *args, enum regcache_dump_what what_to_dump)
else
{
if (!file.open (args, "w"))
- perror_with_name (_("maintenance print architecture"));
+ perror_with_name (_ ("maintenance print architecture"));
out = &file;
}
@@ -301,32 +318,36 @@ maintenance_print_remote_registers (const char *args, int from_tty)
}
void _initialize_regcache_dump ();
+
void
_initialize_regcache_dump ()
{
add_cmd ("registers", class_maintenance, maintenance_print_registers,
- _("Print the internal register configuration.\n"
- "Takes an optional file parameter."), &maintenanceprintlist);
- add_cmd ("raw-registers", class_maintenance,
- maintenance_print_raw_registers,
- _("Print the internal register configuration "
- "including raw values.\n"
- "Takes an optional file parameter."), &maintenanceprintlist);
+ _ ("Print the internal register configuration.\n"
+ "Takes an optional file parameter."),
+ &maintenanceprintlist);
+ add_cmd ("raw-registers", class_maintenance, maintenance_print_raw_registers,
+ _ ("Print the internal register configuration "
+ "including raw values.\n"
+ "Takes an optional file parameter."),
+ &maintenanceprintlist);
add_cmd ("cooked-registers", class_maintenance,
maintenance_print_cooked_registers,
- _("Print the internal register configuration "
- "including cooked values.\n"
- "Takes an optional file parameter."), &maintenanceprintlist);
+ _ ("Print the internal register configuration "
+ "including cooked values.\n"
+ "Takes an optional file parameter."),
+ &maintenanceprintlist);
add_cmd ("register-groups", class_maintenance,
maintenance_print_register_groups,
- _("Print the internal register configuration "
- "including each register's group.\n"
- "Takes an optional file parameter."),
+ _ ("Print the internal register configuration "
+ "including each register's group.\n"
+ "Takes an optional file parameter."),
&maintenanceprintlist);
add_cmd ("remote-registers", class_maintenance,
- maintenance_print_remote_registers, _("\
+ maintenance_print_remote_registers,
+ _ ("\
Print the internal register configuration including remote register number "
-"and g/G packets offset.\n\
+ "and g/G packets offset.\n\
Takes an optional file parameter."),
&maintenanceprintlist);
}
diff --git a/gdb/regcache.c b/gdb/regcache.c
index 7aee1c16e2e..c185ac3e5ad 100644
--- a/gdb/regcache.c
+++ b/gdb/regcache.c
@@ -74,7 +74,7 @@ struct regcache_descr
};
static const registry<gdbarch>::key<struct regcache_descr>
- regcache_descr_handle;
+ regcache_descr_handle;
static struct regcache_descr *
init_regcache_descr (struct gdbarch *gdbarch)
@@ -197,32 +197,33 @@ reg_buffer::reg_buffer (gdbarch *gdbarch, bool has_pseudo)
if (has_pseudo)
{
m_registers.reset (new gdb_byte[m_descr->sizeof_cooked_registers]);
- m_register_status.reset
- (new register_status[m_descr->nr_cooked_registers] ());
+ m_register_status.reset (
+ new register_status[m_descr->nr_cooked_registers]());
}
else
{
m_registers.reset (new gdb_byte[m_descr->sizeof_raw_registers]);
- m_register_status.reset
- (new register_status[gdbarch_num_regs (gdbarch)] ());
+ m_register_status.reset (
+ new register_status[gdbarch_num_regs (gdbarch)]());
}
}
regcache::regcache (process_stratum_target *target, gdbarch *gdbarch,
const address_space *aspace_)
-/* The register buffers. A read/write register cache can only hold
+ /* The register buffers. A read/write register cache can only hold
[0 .. gdbarch_num_regs). */
- : detached_regcache (gdbarch, false), m_aspace (aspace_), m_target (target)
+ : detached_regcache (gdbarch, false),
+ m_aspace (aspace_),
+ m_target (target)
{
m_ptid = minus_one_ptid;
}
readonly_detached_regcache::readonly_detached_regcache (regcache &src)
: readonly_detached_regcache (src.arch (),
- [&src] (int regnum, gdb_byte *buf)
- {
- return src.cooked_read (regnum, buf);
- })
+ [&src] (int regnum, gdb_byte *buf) {
+ return src.cooked_read (regnum, buf);
+ })
{
}
@@ -348,9 +349,8 @@ using target_pid_ptid_regcache_map
static target_pid_ptid_regcache_map regcaches;
struct regcache *
-get_thread_arch_aspace_regcache (process_stratum_target *target,
- ptid_t ptid, gdbarch *arch,
- struct address_space *aspace)
+get_thread_arch_aspace_regcache (process_stratum_target *target, ptid_t ptid,
+ gdbarch *arch, struct address_space *aspace)
{
gdb_assert (target != nullptr);
@@ -396,8 +396,7 @@ static struct gdbarch *current_thread_arch;
struct regcache *
get_thread_regcache (process_stratum_target *target, ptid_t ptid)
{
- if (!current_thread_arch
- || target != current_thread_target
+ if (!current_thread_arch || target != current_thread_target
|| current_thread_ptid != ptid)
{
gdb_assert (ptid != null_ptid);
@@ -418,8 +417,7 @@ get_thread_regcache (process_stratum_target *target, ptid_t ptid)
struct regcache *
get_thread_regcache (thread_info *thread)
{
- return get_thread_regcache (thread->inf->process_target (),
- thread->ptid);
+ return get_thread_regcache (thread->inf->process_target (), thread->ptid);
}
struct regcache *
@@ -450,15 +448,15 @@ regcache_observer_target_changed (struct target_ops *target)
/* Update regcaches related to OLD_PTID to now use NEW_PTID. */
static void
-regcache_thread_ptid_changed (process_stratum_target *target,
- ptid_t old_ptid, ptid_t new_ptid)
+regcache_thread_ptid_changed (process_stratum_target *target, ptid_t old_ptid,
+ ptid_t new_ptid)
{
/* Look up map for target. */
auto pid_ptid_regc_map_it = regcaches.find (target);
if (pid_ptid_regc_map_it == regcaches.end ())
return;
- /* Look up map for pid. */
+ /* Look up map for pid. */
pid_ptid_regcache_map &pid_ptid_regc_map = pid_ptid_regc_map_it->second;
auto ptid_regc_map_it = pid_ptid_regc_map.find (old_ptid.pid ());
if (ptid_regc_map_it == pid_ptid_regc_map.end ())
@@ -530,12 +528,10 @@ registers_changed_ptid (process_stratum_target *target, ptid_t ptid)
= pid_ptid_regc_map_it->second;
/* Look up map for pid. */
- auto ptid_regc_map_it
- = pid_ptid_regc_map.find (ptid.pid ());
+ auto ptid_regc_map_it = pid_ptid_regc_map.find (ptid.pid ());
if (ptid_regc_map_it != pid_ptid_regc_map.end ())
{
- ptid_regcache_map &ptid_regc_map
- = ptid_regc_map_it->second;
+ ptid_regcache_map &ptid_regc_map = ptid_regc_map_it->second;
ptid_regc_map.erase (ptid);
}
@@ -543,7 +539,7 @@ registers_changed_ptid (process_stratum_target *target, ptid_t ptid)
}
else
{
- /* Non-NULL target and minus_one_ptid, delete all regcaches
+ /* Non-NULL target and minus_one_ptid, delete all regcaches
associated to this target. */
regcaches.erase (target);
}
@@ -610,8 +606,7 @@ readable_regcache::raw_read (int regnum, gdb_byte *buf)
if (m_register_status[regnum] != REG_VALID)
memset (buf, 0, m_descr->sizeof_register[regnum]);
else
- memcpy (buf, register_buffer (regnum),
- m_descr->sizeof_register[regnum]);
+ memcpy (buf, register_buffer (regnum), m_descr->sizeof_register[regnum]);
return m_register_status[regnum];
}
@@ -632,7 +627,7 @@ readable_regcache::raw_read (int regnum, T *val)
gdb_byte *buf = (gdb_byte *) alloca (len);
register_status status = raw_read (regnum, buf);
if (status == REG_VALID)
- *val = extract_integer<T> ({buf, len},
+ *val = extract_integer<T> ({ buf, len },
gdbarch_byte_order (m_descr->gdbarch));
else
*val = 0;
@@ -683,8 +678,8 @@ regcache_raw_get_signed (struct regcache *regcache, int regnum)
status = regcache_raw_read_signed (regcache, regnum, &value);
if (status == REG_UNAVAILABLE)
- throw_error (NOT_AVAILABLE_ERROR,
- _("Register %d is not available"), regnum);
+ throw_error (NOT_AVAILABLE_ERROR, _ ("Register %d is not available"),
+ regnum);
return value;
}
@@ -695,8 +690,7 @@ readable_regcache::cooked_read (int regnum, gdb_byte *buf)
gdb_assert (regnum < m_descr->nr_cooked_registers);
if (regnum < num_raw_registers ())
return raw_read (regnum, buf);
- else if (m_has_pseudo
- && m_register_status[regnum] != REG_UNKNOWN)
+ else if (m_has_pseudo && m_register_status[regnum] != REG_UNKNOWN)
{
if (m_register_status[regnum] == REG_VALID)
memcpy (buf, register_buffer (regnum),
@@ -713,8 +707,8 @@ readable_regcache::cooked_read (int regnum, gdb_byte *buf)
scoped_value_mark mark;
- computed = gdbarch_pseudo_register_read_value (m_descr->gdbarch,
- this, regnum);
+ computed
+ = gdbarch_pseudo_register_read_value (m_descr->gdbarch, this, regnum);
if (value_entirely_available (computed))
memcpy (buf, value_contents_raw (computed).data (),
m_descr->sizeof_register[regnum]);
@@ -727,8 +721,7 @@ readable_regcache::cooked_read (int regnum, gdb_byte *buf)
return result;
}
else
- return gdbarch_pseudo_register_read (m_descr->gdbarch, this,
- regnum, buf);
+ return gdbarch_pseudo_register_read (m_descr->gdbarch, this, regnum, buf);
}
struct value *
@@ -750,16 +743,15 @@ readable_regcache::cooked_read_value (int regnum)
/* It is more efficient in general to do this delegation in this
direction than in the other one, even though the value-based
API is preferred. */
- if (cooked_read (regnum,
- value_contents_raw (result).data ()) == REG_UNAVAILABLE)
+ if (cooked_read (regnum, value_contents_raw (result).data ())
+ == REG_UNAVAILABLE)
mark_value_bytes_unavailable (result, 0,
value_type (result)->length ());
return result;
}
else
- return gdbarch_pseudo_register_read_value (m_descr->gdbarch,
- this, regnum);
+ return gdbarch_pseudo_register_read_value (m_descr->gdbarch, this, regnum);
}
enum register_status
@@ -779,7 +771,7 @@ readable_regcache::cooked_read (int regnum, T *val)
gdb_byte *buf = (gdb_byte *) alloca (len);
register_status status = cooked_read (regnum, buf);
if (status == REG_VALID)
- *val = extract_integer<T> ({buf, len},
+ *val = extract_integer<T> ({ buf, len },
gdbarch_byte_order (m_descr->gdbarch));
else
*val = 0;
@@ -808,7 +800,7 @@ regcache::cooked_write (int regnum, T val)
{
gdb_byte *buf;
- gdb_assert (regnum >=0 && regnum < m_descr->nr_cooked_registers);
+ gdb_assert (regnum >= 0 && regnum < m_descr->nr_cooked_registers);
buf = (gdb_byte *) alloca (m_descr->sizeof_register[regnum]);
store_integer (buf, m_descr->sizeof_register[regnum],
gdbarch_byte_order (m_descr->gdbarch), val);
@@ -826,7 +818,6 @@ regcache_cooked_write_unsigned (struct regcache *regcache, int regnum,
void
regcache::raw_write (int regnum, const gdb_byte *buf)
{
-
gdb_assert (buf != NULL);
assert_regnum (regnum);
@@ -839,7 +830,8 @@ regcache::raw_write (int regnum, const gdb_byte *buf)
value, then don't bother doing the actual store. */
if (get_register_status (regnum) == REG_VALID
&& (memcmp (register_buffer (regnum), buf,
- m_descr->sizeof_register[regnum]) == 0))
+ m_descr->sizeof_register[regnum])
+ == 0))
return;
target_prepare_to_store (this);
@@ -847,8 +839,7 @@ regcache::raw_write (int regnum, const gdb_byte *buf)
/* Invalidate the register after it is written, in case of a
failure. */
- auto invalidator
- = make_scope_exit ([&] { this->invalidate (regnum); });
+ auto invalidator = make_scope_exit ([&] { this->invalidate (regnum); });
target_store_registers (this, regnum);
@@ -865,15 +856,14 @@ regcache::cooked_write (int regnum, const gdb_byte *buf)
if (regnum < num_raw_registers ())
raw_write (regnum, buf);
else
- gdbarch_pseudo_register_write (m_descr->gdbarch, this,
- regnum, buf);
+ gdbarch_pseudo_register_write (m_descr->gdbarch, this, regnum, buf);
}
/* See regcache.h. */
enum register_status
-readable_regcache::read_part (int regnum, int offset, int len,
- gdb_byte *out, bool is_raw)
+readable_regcache::read_part (int regnum, int offset, int len, gdb_byte *out,
+ bool is_raw)
{
int reg_size = register_size (arch (), regnum);
@@ -939,8 +929,8 @@ reg_buffer::raw_collect_part (int regnum, int offset, int len,
/* See regcache.h. */
enum register_status
-regcache::write_part (int regnum, int offset, int len,
- const gdb_byte *in, bool is_raw)
+regcache::write_part (int regnum, int offset, int len, const gdb_byte *in,
+ bool is_raw)
{
int reg_size = register_size (arch (), regnum);
@@ -1020,8 +1010,7 @@ readable_regcache::raw_read_part (int regnum, int offset, int len,
/* See regcache.h. */
void
-regcache::raw_write_part (int regnum, int offset, int len,
- const gdb_byte *buf)
+regcache::raw_write_part (int regnum, int offset, int len, const gdb_byte *buf)
{
assert_regnum (regnum);
write_part (regnum, offset, len, buf, true);
@@ -1078,8 +1067,8 @@ reg_buffer::raw_supply (int regnum, const void *buf)
/* See regcache.h. */
void
-reg_buffer::raw_supply_integer (int regnum, const gdb_byte *addr,
- int addr_len, bool is_signed)
+reg_buffer::raw_supply_integer (int regnum, const gdb_byte *addr, int addr_len,
+ bool is_signed)
{
enum bfd_endian byte_order = gdbarch_byte_order (m_descr->gdbarch);
gdb_byte *regbuf;
@@ -1186,16 +1175,15 @@ regcache::transfer_regset_register (struct regcache *out_regcache, int regnum,
void
regcache::transfer_regset (const struct regset *regset, int regbase,
- struct regcache *out_regcache,
- int regnum, const gdb_byte *in_buf,
- gdb_byte *out_buf, size_t size) const
+ struct regcache *out_regcache, int regnum,
+ const gdb_byte *in_buf, gdb_byte *out_buf,
+ size_t size) const
{
const struct regcache_map_entry *map;
int offs = 0, count;
for (map = (const struct regcache_map_entry *) regset->regmap;
- (count = map->count) != 0;
- map++)
+ (count = map->count) != 0; map++)
{
int regno = map->regno;
int slot_size = map->size;
@@ -1207,9 +1195,8 @@ regcache::transfer_regset (const struct regset *regset, int regbase,
slot_size = m_descr->sizeof_register[regno];
if (regno == REGCACHE_MAP_SKIP
- || (regnum != -1
- && (regnum < regno || regnum >= regno + count)))
- offs += count * slot_size;
+ || (regnum != -1 && (regnum < regno || regnum >= regno + count)))
+ offs += count * slot_size;
else if (regnum == -1)
for (; count--; regno++, offs += slot_size)
@@ -1239,8 +1226,7 @@ regcache::transfer_regset (const struct regset *regset, int regbase,
If BUF is NULL, set the register(s) to "unavailable" status. */
void
-regcache_supply_regset (const struct regset *regset,
- struct regcache *regcache,
+regcache_supply_regset (const struct regset *regset, struct regcache *regcache,
int regnum, const void *buf, size_t size)
{
regcache->supply_regset (regset, regnum, (const gdb_byte *) buf, size);
@@ -1249,8 +1235,8 @@ regcache_supply_regset (const struct regset *regset,
/* See regcache.h. */
void
-regcache::supply_regset (const struct regset *regset, int regbase,
- int regnum, const void *buf, size_t size)
+regcache::supply_regset (const struct regset *regset, int regbase, int regnum,
+ const void *buf, size_t size)
{
transfer_regset (regset, regbase, this, regnum, (const gdb_byte *) buf,
nullptr, size);
@@ -1262,8 +1248,8 @@ regcache::supply_regset (const struct regset *regset, int regbase,
void
regcache_collect_regset (const struct regset *regset,
- const struct regcache *regcache,
- int regnum, void *buf, size_t size)
+ const struct regcache *regcache, int regnum,
+ void *buf, size_t size)
{
regcache->collect_regset (regset, regnum, (gdb_byte *) buf, size);
}
@@ -1271,8 +1257,8 @@ regcache_collect_regset (const struct regset *regset,
/* See regcache.h */
void
-regcache::collect_regset (const struct regset *regset, int regbase,
- int regnum, void *buf, size_t size) const
+regcache::collect_regset (const struct regset *regset, int regbase, int regnum,
+ void *buf, size_t size) const
{
transfer_regset (regset, regbase, nullptr, regnum, nullptr, (gdb_byte *) buf,
size);
@@ -1334,15 +1320,15 @@ regcache_read_pc (struct regcache *regcache)
{
ULONGEST raw_val;
- if (regcache_cooked_read_unsigned (regcache,
- gdbarch_pc_regnum (gdbarch),
- &raw_val) == REG_UNAVAILABLE)
- throw_error (NOT_AVAILABLE_ERROR, _("PC register is not available"));
+ if (regcache_cooked_read_unsigned (regcache, gdbarch_pc_regnum (gdbarch),
+ &raw_val)
+ == REG_UNAVAILABLE)
+ throw_error (NOT_AVAILABLE_ERROR, _ ("PC register is not available"));
pc_val = gdbarch_addr_bits_remove (gdbarch, raw_val);
}
else
- internal_error (_("regcache_read_pc: Unable to find PC"));
+ internal_error (_ ("regcache_read_pc: Unable to find PC"));
return pc_val;
}
@@ -1372,10 +1358,9 @@ regcache_write_pc (struct regcache *regcache, CORE_ADDR pc)
if (gdbarch_write_pc_p (gdbarch))
gdbarch_write_pc (gdbarch, regcache, pc);
else if (gdbarch_pc_regnum (gdbarch) >= 0)
- regcache_cooked_write_unsigned (regcache,
- gdbarch_pc_regnum (gdbarch), pc);
+ regcache_cooked_write_unsigned (regcache, gdbarch_pc_regnum (gdbarch), pc);
else
- internal_error (_("regcache_write_pc: Unable to update PC"));
+ internal_error (_ ("regcache_write_pc: Unable to update PC"));
/* Writing the PC (for instance, from "load") invalidates the
current frame. */
@@ -1389,15 +1374,14 @@ reg_buffer::num_raw_registers () const
}
void
-regcache::debug_print_register (const char *func, int regno)
+regcache::debug_print_register (const char *func, int regno)
{
struct gdbarch *gdbarch = arch ();
gdb_printf (gdb_stdlog, "%s ", func);
if (regno >= 0 && regno < gdbarch_num_regs (gdbarch)
&& gdbarch_register_name (gdbarch, regno)[0] != '\0')
- gdb_printf (gdb_stdlog, "(%s)",
- gdbarch_register_name (gdbarch, regno));
+ gdb_printf (gdb_stdlog, "(%s)", gdbarch_register_name (gdbarch, regno));
else
gdb_printf (gdb_stdlog, "(%d)", regno);
if (regno >= 0 && regno < gdbarch_num_regs (gdbarch))
@@ -1415,8 +1399,8 @@ regcache::debug_print_register (const char *func, int regno)
{
ULONGEST val = extract_unsigned_integer (buf, size, byte_order);
- gdb_printf (gdb_stdlog, " %s %s",
- core_addr_to_string_nz (val), plongest (val));
+ gdb_printf (gdb_stdlog, " %s %s", core_addr_to_string_nz (val),
+ plongest (val));
}
}
gdb_printf (gdb_stdlog, "\n");
@@ -1430,7 +1414,7 @@ reg_flush_command (const char *command, int from_tty)
/* Force-flush the register cache. */
registers_changed ();
if (from_tty)
- gdb_printf (_("Register cache flushed.\n"));
+ gdb_printf (_ ("Register cache flushed.\n"));
}
void
@@ -1472,22 +1456,19 @@ register_dump::dump (ui_file *file)
else if (regnum < gdbarch_num_regs (m_gdbarch))
gdb_printf (file, " %4d", regnum);
else
- gdb_printf (file, " %4d",
- (regnum - gdbarch_num_regs (m_gdbarch)));
+ gdb_printf (file, " %4d", (regnum - gdbarch_num_regs (m_gdbarch)));
/* Offset. */
if (regnum < 0)
gdb_printf (file, " %6s ", "Offset");
else
{
- gdb_printf (file, " %6ld",
- descr->register_offset[regnum]);
+ gdb_printf (file, " %6ld", descr->register_offset[regnum]);
if (register_offset != descr->register_offset[regnum]
|| (regnum > 0
&& (descr->register_offset[regnum]
!= (descr->register_offset[regnum - 1]
- + descr->sizeof_register[regnum - 1])))
- )
+ + descr->sizeof_register[regnum - 1]))))
{
if (!footnote_register_offset)
footnote_register_offset = ++footnote_nr;
@@ -1521,8 +1502,8 @@ register_dump::dump (ui_file *file)
{
if (!footnote_register_type_name_null)
footnote_register_type_name_null = ++footnote_nr;
- name_holder = string_printf ("*%d",
- footnote_register_type_name_null);
+ name_holder
+ = string_printf ("*%d", footnote_register_type_name_null);
t = name_holder.c_str ();
}
/* Chop a leading builtin_type. */
@@ -1544,8 +1525,7 @@ register_dump::dump (ui_file *file)
gdb_printf (file, "*%d: Inconsistent register offsets.\n",
footnote_register_offset);
if (footnote_register_type_name_null)
- gdb_printf (file,
- "*%d: Register type's name NULL.\n",
+ gdb_printf (file, "*%d: Register type's name NULL.\n",
footnote_register_type_name_null);
}
@@ -1554,7 +1534,8 @@ register_dump::dump (ui_file *file)
#include "selftest-arch.h"
#include "target-float.h"
-namespace selftests {
+namespace selftests
+{
static size_t
regcaches_size ()
@@ -1562,18 +1543,15 @@ regcaches_size ()
size_t size = 0;
for (auto pid_ptid_regc_map_it = regcaches.cbegin ();
- pid_ptid_regc_map_it != regcaches.cend ();
- ++pid_ptid_regc_map_it)
+ pid_ptid_regc_map_it != regcaches.cend (); ++pid_ptid_regc_map_it)
{
const pid_ptid_regcache_map &pid_ptid_regc_map
= pid_ptid_regc_map_it->second;
for (auto ptid_regc_map_it = pid_ptid_regc_map.cbegin ();
- ptid_regc_map_it != pid_ptid_regc_map.cend ();
- ++ptid_regc_map_it)
+ ptid_regc_map_it != pid_ptid_regc_map.cend (); ++ptid_regc_map_it)
{
- const ptid_regcache_map &ptid_regc_map
- = ptid_regc_map_it->second;
+ const ptid_regcache_map &ptid_regc_map = ptid_regc_map_it->second;
size += ptid_regc_map.size ();
}
@@ -1670,13 +1648,13 @@ populate_regcaches_for_test ()
{
for (long lwp : { 1, 2, 3 })
{
- get_thread_arch_aspace_regcache_and_check
- (&data->test_target1, ptid_t (pid, lwp));
+ get_thread_arch_aspace_regcache_and_check (&data->test_target1,
+ ptid_t (pid, lwp));
expected_regcache_size++;
SELF_CHECK (regcaches_size () == expected_regcache_size);
- get_thread_arch_aspace_regcache_and_check
- (&data->test_target2, ptid_t (pid, lwp));
+ get_thread_arch_aspace_regcache_and_check (&data->test_target2,
+ ptid_t (pid, lwp));
expected_regcache_size++;
SELF_CHECK (regcaches_size () == expected_regcache_size);
}
@@ -1694,11 +1672,12 @@ get_thread_arch_aspace_regcache_test ()
size_t regcaches_size_before = regcaches_size ();
/* Test that getting an existing regcache doesn't create a new one. */
- get_thread_arch_aspace_regcache_and_check (&data->test_target1, ptid_t (2, 2));
+ get_thread_arch_aspace_regcache_and_check (&data->test_target1,
+ ptid_t (2, 2));
SELF_CHECK (regcaches_size () == regcaches_size_before);
}
- /* Test marking all regcaches of all targets as changed. */
+/* Test marking all regcaches of all targets as changed. */
static void
registers_changed_ptid_all_test ()
@@ -1758,9 +1737,11 @@ registers_changed_ptid_target_ptid_test ()
class target_ops_no_register : public test_target_ops
{
public:
+
target_ops_no_register ()
: test_target_ops {}
- {}
+ {
+ }
void reset ()
{
@@ -1813,10 +1794,11 @@ target_ops_no_register::xfer_partial (enum target_object object,
class readwrite_regcache : public regcache
{
public:
- readwrite_regcache (process_stratum_target *target,
- struct gdbarch *gdbarch)
+
+ readwrite_regcache (process_stratum_target *target, struct gdbarch *gdbarch)
: regcache (target, gdbarch, nullptr)
- {}
+ {
+ }
};
/* Return true if regcache::cooked_{read,write}_test should be skipped for
@@ -1833,8 +1815,7 @@ selftest_skiparch (struct gdbarch *gdbarch)
Stack backtrace will not work.
We could instead capture the output and then filter out the warning, but
that seems more trouble than it's worth. */
- return (strcmp (name, "m68hc11") == 0
- || strcmp (name, "m68hc12") == 0
+ return (strcmp (name, "m68hc11") == 0 || strcmp (name, "m68hc12") == 0
|| strcmp (name, "m68hc12:HCS12") == 0);
}
@@ -1854,8 +1835,7 @@ cooked_read_test (struct gdbarch *gdbarch)
/* Find a raw register which size isn't zero. */
int nonzero_regnum;
- for (nonzero_regnum = 0;
- nonzero_regnum < gdbarch_num_regs (gdbarch);
+ for (nonzero_regnum = 0; nonzero_regnum < gdbarch_num_regs (gdbarch);
nonzero_regnum++)
{
if (register_size (gdbarch, nonzero_regnum) != 0)
@@ -1886,8 +1866,8 @@ cooked_read_test (struct gdbarch *gdbarch)
gdb::def_vector<gdb_byte> inner_buf (register_size (gdbarch, regnum));
- SELF_CHECK (REG_VALID == readwrite.cooked_read (regnum,
- inner_buf.data ()));
+ SELF_CHECK (REG_VALID
+ == readwrite.cooked_read (regnum, inner_buf.data ()));
SELF_CHECK (mockctx.mock_target.fetch_registers_called == 0);
SELF_CHECK (mockctx.mock_target.store_registers_called == 0);
@@ -1908,22 +1888,22 @@ cooked_read_test (struct gdbarch *gdbarch)
continue;
gdb::def_vector<gdb_byte> inner_buf (register_size (gdbarch, regnum));
- enum register_status status = readonly.cooked_read (regnum,
- inner_buf.data ());
+ enum register_status status
+ = readonly.cooked_read (regnum, inner_buf.data ());
if (regnum < gdbarch_num_regs (gdbarch))
{
auto bfd_arch = gdbarch_bfd_arch_info (gdbarch)->arch;
- if (bfd_arch == bfd_arch_amdgcn
- || bfd_arch == bfd_arch_frv || bfd_arch == bfd_arch_h8300
- || bfd_arch == bfd_arch_m32c || bfd_arch == bfd_arch_sh
- || bfd_arch == bfd_arch_alpha || bfd_arch == bfd_arch_v850
- || bfd_arch == bfd_arch_msp430 || bfd_arch == bfd_arch_mep
- || bfd_arch == bfd_arch_mips || bfd_arch == bfd_arch_v850_rh850
- || bfd_arch == bfd_arch_tic6x || bfd_arch == bfd_arch_mn10300
- || bfd_arch == bfd_arch_rl78 || bfd_arch == bfd_arch_score
- || bfd_arch == bfd_arch_riscv || bfd_arch == bfd_arch_csky)
+ if (bfd_arch == bfd_arch_amdgcn || bfd_arch == bfd_arch_frv
+ || bfd_arch == bfd_arch_h8300 || bfd_arch == bfd_arch_m32c
+ || bfd_arch == bfd_arch_sh || bfd_arch == bfd_arch_alpha
+ || bfd_arch == bfd_arch_v850 || bfd_arch == bfd_arch_msp430
+ || bfd_arch == bfd_arch_mep || bfd_arch == bfd_arch_mips
+ || bfd_arch == bfd_arch_v850_rh850 || bfd_arch == bfd_arch_tic6x
+ || bfd_arch == bfd_arch_mn10300 || bfd_arch == bfd_arch_rl78
+ || bfd_arch == bfd_arch_score || bfd_arch == bfd_arch_riscv
+ || bfd_arch == bfd_arch_csky)
{
/* Raw registers. If raw registers are not in save_reggroup,
their status are unknown. */
@@ -1946,13 +1926,10 @@ cooked_read_test (struct gdbarch *gdbarch)
of them are unknown. */
auto bfd_arch = gdbarch_bfd_arch_info (gdbarch)->arch;
- if (bfd_arch == bfd_arch_frv
- || bfd_arch == bfd_arch_m32c
- || bfd_arch == bfd_arch_mep
- || bfd_arch == bfd_arch_sh)
+ if (bfd_arch == bfd_arch_frv || bfd_arch == bfd_arch_m32c
+ || bfd_arch == bfd_arch_mep || bfd_arch == bfd_arch_sh)
SELF_CHECK (status == REG_VALID || status == REG_UNKNOWN);
- else if (bfd_arch == bfd_arch_mips
- || bfd_arch == bfd_arch_h8300)
+ else if (bfd_arch == bfd_arch_mips || bfd_arch == bfd_arch_h8300)
SELF_CHECK (status == REG_UNKNOWN);
else
SELF_CHECK (status == REG_VALID);
@@ -2016,8 +1993,7 @@ cooked_write_test (struct gdbarch *gdbarch)
{
if (bfd_arch == bfd_arch_ia64
|| (regnum >= gdbarch_num_regs (gdbarch)
- && (bfd_arch == bfd_arch_xtensa
- || bfd_arch == bfd_arch_bfin
+ && (bfd_arch == bfd_arch_xtensa || bfd_arch == bfd_arch_bfin
|| bfd_arch == bfd_arch_m32c
/* m68hc11 pseudo registers are in memory. */
|| bfd_arch == bfd_arch_m68hc11
@@ -2122,6 +2098,7 @@ regcache_thread_ptid_changed ()
#endif /* GDB_SELF_TEST */
void _initialize_regcache ();
+
void
_initialize_regcache ()
{
@@ -2134,7 +2111,7 @@ _initialize_regcache ()
cmd_list_element *maintenance_flush_register_cache_cmd
= add_cmd ("register-cache", class_maintenance, reg_flush_command,
- _("Force gdb to flush its register and frame cache."),
+ _ ("Force gdb to flush its register and frame cache."),
&maintenanceflushlist);
c = add_com_alias ("flushregs", maintenance_flush_register_cache_cmd,
class_maintenance, 0);
@@ -2149,8 +2126,9 @@ _initialize_regcache ()
selftests::registers_changed_ptid_target_test);
selftests::register_test ("registers_changed_ptid_target_pid",
selftests::registers_changed_ptid_target_pid_test);
- selftests::register_test ("registers_changed_ptid_target_ptid",
- selftests::registers_changed_ptid_target_ptid_test);
+ selftests::register_test (
+ "registers_changed_ptid_target_ptid",
+ selftests::registers_changed_ptid_target_ptid_test);
selftests::register_test_foreach_arch ("regcache::cooked_read_test",
selftests::cooked_read_test);
diff --git a/gdb/regcache.h b/gdb/regcache.h
index b9ffab9950d..01616d36cdf 100644
--- a/gdb/regcache.h
+++ b/gdb/regcache.h
@@ -37,34 +37,32 @@ extern struct regcache *get_thread_regcache (process_stratum_target *target,
/* Get the regcache of THREAD. */
extern struct regcache *get_thread_regcache (thread_info *thread);
-extern struct regcache *get_thread_arch_regcache
- (process_stratum_target *targ, ptid_t, struct gdbarch *);
-extern struct regcache *get_thread_arch_aspace_regcache
- (process_stratum_target *target, ptid_t,
- struct gdbarch *, struct address_space *);
+extern struct regcache *get_thread_arch_regcache (process_stratum_target *targ,
+ ptid_t, struct gdbarch *);
+extern struct regcache *
+get_thread_arch_aspace_regcache (process_stratum_target *target, ptid_t,
+ struct gdbarch *, struct address_space *);
extern enum register_status
- regcache_raw_read_signed (struct regcache *regcache,
- int regnum, LONGEST *val);
+regcache_raw_read_signed (struct regcache *regcache, int regnum, LONGEST *val);
-extern void regcache_raw_write_signed (struct regcache *regcache,
- int regnum, LONGEST val);
-extern void regcache_raw_write_unsigned (struct regcache *regcache,
- int regnum, ULONGEST val);
+extern void regcache_raw_write_signed (struct regcache *regcache, int regnum,
+ LONGEST val);
+extern void regcache_raw_write_unsigned (struct regcache *regcache, int regnum,
+ ULONGEST val);
/* Return the register's value in signed or throw if it's not
available. */
-extern LONGEST regcache_raw_get_signed (struct regcache *regcache,
- int regnum);
+extern LONGEST regcache_raw_get_signed (struct regcache *regcache, int regnum);
/* Read a register as a signed/unsigned quantity. */
extern enum register_status
- regcache_cooked_read_signed (struct regcache *regcache,
- int regnum, LONGEST *val);
+regcache_cooked_read_signed (struct regcache *regcache, int regnum,
+ LONGEST *val);
extern enum register_status
- regcache_cooked_read_unsigned (struct regcache *regcache,
- int regnum, ULONGEST *val);
+regcache_cooked_read_unsigned (struct regcache *regcache, int regnum,
+ ULONGEST *val);
extern void regcache_cooked_write_signed (struct regcache *regcache,
int regnum, LONGEST val);
extern void regcache_cooked_write_unsigned (struct regcache *regcache,
@@ -116,9 +114,9 @@ struct regcache_map_entry
/* Special value for the 'regno' field in the struct above. */
enum
- {
- REGCACHE_MAP_SKIP = -1,
- };
+{
+ REGCACHE_MAP_SKIP = -1,
+};
/* Calculate and return the total size of all the registers in a
regcache_map_entry. */
@@ -142,14 +140,12 @@ regcache_map_entry_size (const struct regcache_map_entry *map)
'regset_collect' fields in a regset structure. */
extern void regcache_supply_regset (const struct regset *regset,
- struct regcache *regcache,
- int regnum, const void *buf,
- size_t size);
+ struct regcache *regcache, int regnum,
+ const void *buf, size_t size);
extern void regcache_collect_regset (const struct regset *regset,
const struct regcache *regcache,
int regnum, void *buf, size_t size);
-
/* Return true if a set of registers contains the value of the
register numbered REGNUM. The size of the set of registers is
given in SIZE, and the layout of the set of registers is described
@@ -165,10 +161,9 @@ extern bool regcache_map_supplies (const struct regcache_map_entry *map,
extern struct type *register_type (struct gdbarch *gdbarch, int regnum);
-
/* Return the size of register REGNUM. All registers should have only
one size. */
-
+
extern int register_size (struct gdbarch *gdbarch, int regnum);
typedef gdb::function_view<register_status (int regnum, gdb_byte *buf)>
@@ -187,6 +182,7 @@ struct cached_reg_t
class reg_buffer : public reg_buffer_common
{
public:
+
reg_buffer (gdbarch *gdbarch, bool has_pseudo);
DISABLE_COPY_AND_ASSIGN (reg_buffer);
@@ -245,6 +241,7 @@ public:
bool raw_compare (int regnum, const void *buf, int offset) const override;
protected:
+
/* Assert on the range of REGNUM. */
void assert_regnum (int regnum) const;
@@ -274,9 +271,11 @@ protected:
class readable_regcache : public reg_buffer
{
public:
+
readable_regcache (gdbarch *gdbarch, bool has_pseudo)
: reg_buffer (gdbarch, has_pseudo)
- {}
+ {
+ }
/* Transfer a raw register [0..NUM_REGS) from core-gdb to this regcache,
return its value in *BUF and return its availability status. */
@@ -319,12 +318,13 @@ protected:
class detached_regcache : public readable_regcache
{
public:
+
detached_regcache (gdbarch *gdbarch, bool has_pseudo)
: readable_regcache (gdbarch, has_pseudo)
- {}
+ {
+ }
- void raw_update (int regnum) override
- {}
+ void raw_update (int regnum) override {}
DISABLE_COPY_AND_ASSIGN (detached_regcache);
};
@@ -336,13 +336,11 @@ class readonly_detached_regcache;
class regcache : public detached_regcache
{
public:
+
DISABLE_COPY_AND_ASSIGN (regcache);
/* Return REGCACHE's address space. */
- const address_space *aspace () const
- {
- return m_aspace;
- }
+ const address_space *aspace () const { return m_aspace; }
/* Restore 'this' regcache. The set of registers restored into
the regcache determined by the restore_reggroup.
@@ -382,22 +380,22 @@ public:
'struct regcache_map_entry'. The valid register numbers in each
entry in 'struct regcache_map_entry' are offset by REGBASE. */
- void supply_regset (const struct regset *regset, int regbase,
- int regnum, const void *buf, size_t size);
+ void supply_regset (const struct regset *regset, int regbase, int regnum,
+ const void *buf, size_t size);
void collect_regset (const struct regset *regset, int regbase, int regnum,
void *buf, size_t size) const;
/* Same as the above, but with REGBASE == 0. */
- void supply_regset (const struct regset *regset,
- int regnum, const void *buf, size_t size)
+ void supply_regset (const struct regset *regset, int regnum, const void *buf,
+ size_t size)
{
supply_regset (regset, 0, regnum, buf, size);
}
- void collect_regset (const struct regset *regset, int regnum,
- void *buf, size_t size) const
+ void collect_regset (const struct regset *regset, int regnum, void *buf,
+ size_t size) const
{
collect_regset (regset, 0, regnum, buf, size);
}
@@ -411,21 +409,16 @@ public:
return m_ptid;
}
- void set_ptid (const ptid_t ptid)
- {
- this->m_ptid = ptid;
- }
+ void set_ptid (const ptid_t ptid) { this->m_ptid = ptid; }
- process_stratum_target *target () const
- {
- return m_target;
- }
+ process_stratum_target *target () const { return m_target; }
-/* Dump the contents of a register from the register cache to the target
+ /* Dump the contents of a register from the register cache to the target
debug. */
void debug_print_register (const char *func, int regno);
protected:
+
regcache (process_stratum_target *target, gdbarch *gdbarch,
const address_space *aspace);
@@ -440,9 +433,9 @@ private:
set to or from a buffer. This is the main worker function for
regcache_supply_regset and regcache_collect_regset. */
void transfer_regset (const struct regset *regset, int regbase,
- struct regcache *out_regcache,
- int regnum, const gdb_byte *in_buf,
- gdb_byte *out_buf, size_t size) const;
+ struct regcache *out_regcache, int regnum,
+ const gdb_byte *in_buf, gdb_byte *out_buf,
+ size_t size) const;
/* Perform a partial register transfer using a read, modify, write
operation. */
@@ -451,7 +444,7 @@ private:
/* The address space of this register cache (for registers where it
makes sense, like PC or SP). */
- const address_space * const m_aspace;
+ const address_space *const m_aspace;
/* If this is a read-write cache, which thread's registers is
it connected to? */
@@ -469,11 +462,13 @@ using regcache_up = std::unique_ptr<regcache>;
class readonly_detached_regcache : public readable_regcache
{
public:
+
readonly_detached_regcache (regcache &src);
/* Create a readonly regcache by getting contents from COOKED_READ. */
- readonly_detached_regcache (gdbarch *gdbarch, register_read_ftype cooked_read)
+ readonly_detached_regcache (gdbarch *gdbarch,
+ register_read_ftype cooked_read)
: readable_regcache (gdbarch, true)
{
save (cooked_read);
@@ -481,8 +476,7 @@ public:
DISABLE_COPY_AND_ASSIGN (readonly_detached_regcache);
- void raw_update (int regnum) override
- {}
+ void raw_update (int regnum) override {}
};
extern void registers_changed (void);
@@ -498,13 +492,16 @@ extern void registers_changed_thread (thread_info *thread);
class register_dump
{
public:
+
void dump (ui_file *file);
virtual ~register_dump () = default;
protected:
+
register_dump (gdbarch *arch)
: m_gdbarch (arch)
- {}
+ {
+ }
/* Dump the register REGNUM contents. If REGNUM is -1, print the
header. */
diff --git a/gdb/regformats/regdef.h b/gdb/regformats/regdef.h
index 47b1d1ac2bc..cc00dbbf7de 100644
--- a/gdb/regformats/regdef.h
+++ b/gdb/regformats/regdef.h
@@ -19,7 +19,8 @@
#ifndef REGFORMATS_REGDEF_H
#define REGFORMATS_REGDEF_H
-namespace gdb {
+namespace gdb
+{
struct reg
{
@@ -27,13 +28,15 @@ struct reg
: name (""),
offset (_offset),
size (0)
- {}
+ {
+ }
reg (const char *_name, int _offset, int _size)
: name (_name),
offset (_offset),
size (_size)
- {}
+ {
+ }
/* The name of this register - NULL for pad entries. */
const char *name;
@@ -51,15 +54,11 @@ struct reg
bool operator== (const reg &other) const
{
- return (strcmp (name, other.name) == 0
- && offset == other.offset
+ return (strcmp (name, other.name) == 0 && offset == other.offset
&& size == other.size);
}
- bool operator!= (const reg &other) const
- {
- return !(*this == other);
- }
+ bool operator!= (const reg &other) const { return !(*this == other); }
};
} /* namespace gdb */
diff --git a/gdb/reggroups.c b/gdb/reggroups.c
index 744e7bde41b..2944337ce0d 100644
--- a/gdb/reggroups.c
+++ b/gdb/reggroups.c
@@ -25,7 +25,7 @@
#include "gdbtypes.h"
#include "regcache.h"
#include "command.h"
-#include "gdbcmd.h" /* For maintenanceprintlist. */
+#include "gdbcmd.h" /* For maintenanceprintlist. */
#include "gdbsupport/gdb_obstack.h"
/* See reggroups.h. */
@@ -43,8 +43,7 @@ reggroup_gdbarch_new (struct gdbarch *gdbarch, const char *name,
enum reggroup_type type)
{
name = gdbarch_obstack_strdup (gdbarch, name);
- return obstack_new<struct reggroup> (gdbarch_obstack (gdbarch),
- name, type);
+ return obstack_new<struct reggroup> (gdbarch_obstack (gdbarch), name, type);
}
/* A container holding all the register groups for a particular
@@ -72,10 +71,9 @@ struct reggroups
{
gdb_assert (group != nullptr);
- auto find_by_name = [group] (const reggroup *g)
- {
- return streq (group->name (), g->name ());
- };
+ auto find_by_name = [group] (const reggroup *g) {
+ return streq (group->name (), g->name ());
+ };
gdb_assert (std::find_if (m_groups.begin (), m_groups.end (), find_by_name)
== m_groups.end ());
@@ -84,21 +82,20 @@ struct reggroups
/* The number of register groups. */
- std::vector<struct reggroup *>::size_type
- size () const
+ std::vector<struct reggroup *>::size_type size () const
{
return m_groups.size ();
}
/* Return a reference to the list of all groups. */
- const std::vector<const struct reggroup *> &
- groups () const
+ const std::vector<const struct reggroup *> &groups () const
{
return m_groups;
}
private:
+
/* The register groups. */
std::vector<const struct reggroup *> m_groups;
};
@@ -156,9 +153,9 @@ default_register_reggroup_p (struct gdbarch *gdbarch, int regnum,
if (group == all_reggroup)
return 1;
vector_p = register_type (gdbarch, regnum)->is_vector ();
- float_p = (register_type (gdbarch, regnum)->code () == TYPE_CODE_FLT
- || (register_type (gdbarch, regnum)->code ()
- == TYPE_CODE_DECFLOAT));
+ float_p
+ = (register_type (gdbarch, regnum)->code () == TYPE_CODE_FLT
+ || (register_type (gdbarch, regnum)->code () == TYPE_CODE_DECFLOAT));
raw_p = regnum < gdbarch_num_regs (gdbarch);
if (group == float_reggroup)
return float_p;
@@ -210,7 +207,7 @@ reggroups_dump (struct gdbarch *gdbarch, struct ui_file *file)
type = "internal";
break;
default:
- internal_error (_("bad switch"));
+ internal_error (_ ("bad switch"));
}
/* Note: If you change this, be sure to also update the
@@ -234,7 +231,7 @@ maintenance_print_reggroups (const char *args, int from_tty)
stdio_file file;
if (!file.open (args, "w"))
- perror_with_name (_("maintenance print reggroups"));
+ perror_with_name (_ ("maintenance print reggroups"));
reggroups_dump (gdbarch, &file);
}
}
@@ -257,13 +254,12 @@ const reggroup *const save_reggroup = &save_group;
const reggroup *const restore_reggroup = &restore_group;
void _initialize_reggroup ();
+
void
_initialize_reggroup ()
{
- add_cmd ("reggroups", class_maintenance,
- maintenance_print_reggroups, _("\
+ add_cmd ("reggroups", class_maintenance, maintenance_print_reggroups, _ ("\
Print the internal register group names.\n\
Takes an optional file parameter."),
&maintenanceprintlist);
-
}
diff --git a/gdb/reggroups.h b/gdb/reggroups.h
index e4d97637e3d..329c808c32f 100644
--- a/gdb/reggroups.h
+++ b/gdb/reggroups.h
@@ -25,7 +25,8 @@
struct gdbarch;
/* The different register group types. */
-enum reggroup_type {
+enum reggroup_type
+{
/* Used for any register group that should be visible to the user.
Architecture specific register groups, as well as most of the default
groups will have this type. */
@@ -45,17 +46,17 @@ struct reggroup
reggroup (const char *name, enum reggroup_type type)
: m_name (name),
m_type (type)
- { /* Nothing. */ }
+ { /* Nothing. */
+ }
/* Return the name for this register group. */
- const char *name () const
- { return m_name; }
+ const char *name () const { return m_name; }
/* Return the type of this register group. */
- enum reggroup_type type () const
- { return m_type; }
+ enum reggroup_type type () const { return m_type; }
private:
+
/* The name of this register group. */
const char *m_name;
@@ -88,7 +89,7 @@ extern void reggroup_add (struct gdbarch *gdbarch, const reggroup *group);
/* Return the list of all register groups for GDBARCH. */
extern const std::vector<const reggroup *> &
- gdbarch_reggroups (struct gdbarch *gdbarch);
+gdbarch_reggroups (struct gdbarch *gdbarch);
/* Find a reggroup by name. */
extern const reggroup *reggroup_find (struct gdbarch *gdbarch,
diff --git a/gdb/registry.h b/gdb/registry.h
index 070159a82f0..e70653f2f2a 100644
--- a/gdb/registry.h
+++ b/gdb/registry.h
@@ -22,7 +22,8 @@
#include <type_traits>
-template<typename T> class registry;
+template<typename T>
+class registry;
/* An accessor class that is used by registry_key.
@@ -38,10 +39,7 @@ template<typename T>
struct registry_accessor
{
/* Given a container of type T, return its registry. */
- static registry<T> *get (T *obj)
- {
- return &obj->registry_fields;
- }
+ static registry<T> *get (T *obj) { return &obj->registry_fields; }
};
/* In gdb, sometimes there is a need for one module (e.g., the Python
@@ -73,10 +71,7 @@ public:
{
}
- ~registry ()
- {
- clear_registry ();
- }
+ ~registry () { clear_registry (); }
DISABLE_COPY_AND_ASSIGN (registry);
@@ -125,9 +120,8 @@ public:
type and attaches it to OBJ using this key. The arguments, if
any, are forwarded to the constructor. */
template<typename Dummy = DATA *, typename... Args>
- typename std::enable_if<std::is_same<Deleter,
- std::default_delete<DATA>>::value,
- Dummy>::type
+ typename std::enable_if<
+ std::is_same<Deleter, std::default_delete<DATA>>::value, Dummy>::type
emplace (T *obj, Args &&...args) const
{
DATA *result = new DATA (std::forward<Args> (args)...);
@@ -168,15 +162,14 @@ public:
void clear_registry ()
{
/* Call all the free functions. */
- std::vector<registry_data_callback> &registrations
- = get_registrations ();
+ std::vector<registry_data_callback> &registrations = get_registrations ();
unsigned last = registrations.size ();
for (unsigned i = 0; i < last; ++i)
{
void *elt = m_fields[i];
if (elt != nullptr)
{
- registrations[i] (elt);
+ registrations[i](elt);
m_fields[i] = nullptr;
}
}
@@ -193,25 +186,18 @@ private:
to the callback. */
static unsigned new_key (registry_data_callback free)
{
- std::vector<registry_data_callback> &registrations
- = get_registrations ();
+ std::vector<registry_data_callback> &registrations = get_registrations ();
unsigned result = registrations.size ();
registrations.push_back (free);
return result;
}
/* Set the datum associated with KEY in this container. */
- void set (unsigned key, void *datum)
- {
- m_fields[key] = datum;
- }
+ void set (unsigned key, void *datum) { m_fields[key] = datum; }
/* Fetch the datum associated with KEY in this container. If 'set'
has not been called for this key, nullptr is returned. */
- void *get (unsigned key)
- {
- return m_fields[key];
- }
+ void *get (unsigned key) { return m_fields[key]; }
/* The data stored in this instance. */
std::vector<void *> m_fields;
diff --git a/gdb/regset.h b/gdb/regset.h
index 364f6606dd2..aaf7b73bb7b 100644
--- a/gdb/regset.h
+++ b/gdb/regset.h
@@ -27,9 +27,9 @@ struct regcache;
typedef void (supply_regset_ftype) (const struct regset *, struct regcache *,
int, const void *, size_t);
-typedef void (collect_regset_ftype) (const struct regset *,
- const struct regcache *,
- int, void *, size_t);
+typedef void (collect_regset_ftype) (const struct regset *,
+ const struct regcache *, int, void *,
+ size_t);
struct regset
{
@@ -49,7 +49,8 @@ struct regset
/* Values for a regset's 'flags' field. */
-#define REGSET_VARIABLE_SIZE 1 /* Accept a larger regset section size
+#define REGSET_VARIABLE_SIZE \
+ 1 /* Accept a larger regset section size
in a core file without warning. */
#endif /* regset.h */
diff --git a/gdb/remote-fileio.c b/gdb/remote-fileio.c
index 3ff2a65b0ec..5421fbc4b6b 100644
--- a/gdb/remote-fileio.c
+++ b/gdb/remote-fileio.c
@@ -33,18 +33,19 @@
#include <fcntl.h>
#include "gdbsupport/gdb_sys_time.h"
#ifdef __CYGWIN__
-#include <sys/cygwin.h> /* For cygwin_conv_path. */
+#include <sys/cygwin.h> /* For cygwin_conv_path. */
#endif
#include <signal.h>
-static struct {
+static struct
+{
int *fd_map;
int fd_map_size;
} remote_fio_data;
-#define FIO_FD_INVALID -1
-#define FIO_FD_CONSOLE_IN -2
-#define FIO_FD_CONSOLE_OUT -3
+#define FIO_FD_INVALID -1
+#define FIO_FD_CONSOLE_IN -2
+#define FIO_FD_CONSOLE_OUT -3
static int remote_fio_system_call_allowed = 0;
@@ -74,9 +75,9 @@ remote_fileio_resize_fd_map (void)
if (!remote_fio_data.fd_map)
return remote_fileio_init_fd_map ();
remote_fio_data.fd_map_size += 10;
- remote_fio_data.fd_map =
- (int *) xrealloc (remote_fio_data.fd_map,
- remote_fio_data.fd_map_size * sizeof (int));
+ remote_fio_data.fd_map
+ = (int *) xrealloc (remote_fio_data.fd_map,
+ remote_fio_data.fd_map_size * sizeof (int));
for (; i < remote_fio_data.fd_map_size; i++)
remote_fio_data.fd_map[i] = FIO_FD_INVALID;
return remote_fio_data.fd_map_size - 10;
@@ -198,17 +199,17 @@ remote_fileio_seek_flag_to_host (long num, int *flag)
return 0;
switch (num)
{
- case FILEIO_SEEK_SET:
- *flag = SEEK_SET;
- break;
- case FILEIO_SEEK_CUR:
- *flag = SEEK_CUR;
- break;
- case FILEIO_SEEK_END:
- *flag = SEEK_END;
- break;
- default:
- return -1;
+ case FILEIO_SEEK_SET:
+ *flag = SEEK_SET;
+ break;
+ case FILEIO_SEEK_CUR:
+ *flag = SEEK_CUR;
+ break;
+ case FILEIO_SEEK_END:
+ *flag = SEEK_END;
+ break;
+ default:
+ return -1;
}
return 0;
}
@@ -357,8 +358,8 @@ remote_fileio_badfd (remote_target *remote)
static void
remote_fileio_return_errno (remote_target *remote, int retcode)
{
- remote_fileio_reply (remote, retcode, retcode < 0
- ? host_to_fileio_error (errno) : 0);
+ remote_fileio_reply (remote, retcode,
+ retcode < 0 ? host_to_fileio_error (errno) : 0);
}
static void
@@ -501,36 +502,36 @@ remote_fileio_func_read (remote_target *remote, char *buf)
switch (fd)
{
- case FIO_FD_CONSOLE_OUT:
- remote_fileio_badfd (remote);
- return;
- case FIO_FD_CONSOLE_IN:
- {
- static char *remaining_buf = NULL;
- static int remaining_length = 0;
+ case FIO_FD_CONSOLE_OUT:
+ remote_fileio_badfd (remote);
+ return;
+ case FIO_FD_CONSOLE_IN:
+ {
+ static char *remaining_buf = NULL;
+ static int remaining_length = 0;
- buffer = (gdb_byte *) xmalloc (16384);
- if (remaining_buf)
- {
- if (remaining_length > length)
- {
- memcpy (buffer, remaining_buf, length);
- memmove (remaining_buf, remaining_buf + length,
- remaining_length - length);
- remaining_length -= length;
- ret = length;
- }
- else
- {
- memcpy (buffer, remaining_buf, remaining_length);
- xfree (remaining_buf);
- remaining_buf = NULL;
- ret = remaining_length;
- }
- }
- else
- {
- /* Windows (at least XP and Server 2003) has difficulty
+ buffer = (gdb_byte *) xmalloc (16384);
+ if (remaining_buf)
+ {
+ if (remaining_length > length)
+ {
+ memcpy (buffer, remaining_buf, length);
+ memmove (remaining_buf, remaining_buf + length,
+ remaining_length - length);
+ remaining_length -= length;
+ ret = length;
+ }
+ else
+ {
+ memcpy (buffer, remaining_buf, remaining_length);
+ xfree (remaining_buf);
+ remaining_buf = NULL;
+ ret = remaining_length;
+ }
+ }
+ else
+ {
+ /* Windows (at least XP and Server 2003) has difficulty
with large reads from consoles. If a handle is
backed by a real console device, overly large reads
from the handle will fail and set errno == ENOMEM.
@@ -541,35 +542,35 @@ remote_fileio_func_read (remote_target *remote, char *buf)
limit this read to something smaller than that - by a
safe margin, in case the limit depends on system
resources or version. */
- ret = gdb_stdtargin->read ((char *) buffer, 16383);
- if (ret > 0 && (size_t)ret > length)
- {
- remaining_buf = (char *) xmalloc (ret - length);
- remaining_length = ret - length;
- memcpy (remaining_buf, buffer + length, remaining_length);
- ret = length;
- }
- }
- }
- break;
- default:
- buffer = (gdb_byte *) xmalloc (length);
- /* POSIX defines EINTR behaviour of read in a weird way. It's allowed
+ ret = gdb_stdtargin->read ((char *) buffer, 16383);
+ if (ret > 0 && (size_t) ret > length)
+ {
+ remaining_buf = (char *) xmalloc (ret - length);
+ remaining_length = ret - length;
+ memcpy (remaining_buf, buffer + length, remaining_length);
+ ret = length;
+ }
+ }
+ }
+ break;
+ default:
+ buffer = (gdb_byte *) xmalloc (length);
+ /* POSIX defines EINTR behaviour of read in a weird way. It's allowed
for read() to return -1 even if "some" bytes have been read. It
has been corrected in SUSv2 but that doesn't help us much...
Therefore a complete solution must check how many bytes have been
read on EINTR to return a more reliable value to the target */
- old_offset = lseek (fd, 0, SEEK_CUR);
- ret = read (fd, buffer, length);
- if (ret < 0 && errno == EINTR)
- {
- new_offset = lseek (fd, 0, SEEK_CUR);
- /* If some data has been read, return the number of bytes read.
+ old_offset = lseek (fd, 0, SEEK_CUR);
+ ret = read (fd, buffer, length);
+ if (ret < 0 && errno == EINTR)
+ {
+ new_offset = lseek (fd, 0, SEEK_CUR);
+ /* If some data has been read, return the number of bytes read.
The Ctrl-C flag is set in remote_fileio_reply() anyway. */
- if (old_offset != new_offset)
- ret = new_offset - old_offset;
- }
- break;
+ if (old_offset != new_offset)
+ ret = new_offset - old_offset;
+ }
+ break;
}
if (ret > 0)
@@ -623,7 +624,7 @@ remote_fileio_func_write (remote_target *remote, char *buf)
return;
}
length = (size_t) num;
-
+
buffer = (gdb_byte *) xmalloc (length);
if (target_read_memory (ptrval, buffer, length) != 0)
{
@@ -634,24 +635,24 @@ remote_fileio_func_write (remote_target *remote, char *buf)
switch (fd)
{
- case FIO_FD_CONSOLE_IN:
- remote_fileio_badfd (remote);
- xfree (buffer);
- return;
- case FIO_FD_CONSOLE_OUT:
- {
- ui_file *file = target_fd == 1 ? gdb_stdtarg : gdb_stdtargerr;
- file->write ((char *) buffer, length);
- file->flush ();
- ret = length;
- }
- break;
- default:
- ret = write (fd, buffer, length);
- if (ret < 0 && errno == EACCES)
- errno = EBADF; /* Cygwin returns EACCESS when writing to a
+ case FIO_FD_CONSOLE_IN:
+ remote_fileio_badfd (remote);
+ xfree (buffer);
+ return;
+ case FIO_FD_CONSOLE_OUT:
+ {
+ ui_file *file = target_fd == 1 ? gdb_stdtarg : gdb_stdtargerr;
+ file->write ((char *) buffer, length);
+ file->flush ();
+ ret = length;
+ }
+ break;
+ default:
+ ret = write (fd, buffer, length);
+ if (ret < 0 && errno == EACCES)
+ errno = EBADF; /* Cygwin returns EACCESS when writing to a
R/O file. */
- break;
+ break;
}
if (ret < 0)
@@ -706,7 +707,7 @@ remote_fileio_func_lseek (remote_target *remote, char *buf)
remote_fileio_reply (remote, -1, FILEIO_EINVAL);
return;
}
-
+
ret = lseek (fd, offset, flag);
if (ret == (off_t) -1)
@@ -730,14 +731,14 @@ remote_fileio_func_rename (remote_target *remote, char *buf)
remote_fileio_ioerror (remote);
return;
}
-
+
/* 2. Parameter: Ptr to newpath / length incl. trailing zero */
if (remote_fileio_extract_ptr_w_len (&buf, &new_ptr, &new_len))
{
remote_fileio_ioerror (remote);
return;
}
-
+
/* Request oldpath using 'm' packet */
oldpath = (char *) alloca (old_len);
if (target_read_memory (old_ptr, (gdb_byte *) oldpath, old_len) != 0)
@@ -745,7 +746,7 @@ remote_fileio_func_rename (remote_target *remote, char *buf)
remote_fileio_ioerror (remote);
return;
}
-
+
/* Request newpath using 'm' packet */
newpath = (char *) alloca (new_len);
if (target_read_memory (new_ptr, (gdb_byte *) newpath, new_len) != 0)
@@ -753,7 +754,7 @@ remote_fileio_func_rename (remote_target *remote, char *buf)
remote_fileio_ioerror (remote);
return;
}
-
+
/* Only operate on regular files and directories. */
of = stat (oldpath, &ost);
nf = stat (newpath, &nst);
@@ -871,7 +872,7 @@ remote_fileio_func_stat (remote_target *remote, char *buf)
return;
}
statptr = (CORE_ADDR) lnum;
-
+
/* Request pathname using 'm' packet */
pathname = (char *) alloca (namelength);
if (target_read_memory (nameptr, (gdb_byte *) pathname, namelength) != 0)
@@ -1077,7 +1078,7 @@ remote_fileio_func_system (remote_target *remote, char *buf)
return;
}
}
-
+
/* Check if system(3) has been explicitly allowed using the
`set remote system-call-allowed 1' command. If length is 0,
indicating a NULL parameter to the system call, return zero to
@@ -1101,24 +1102,24 @@ remote_fileio_func_system (remote_target *remote, char *buf)
remote_fileio_return_success (remote, WEXITSTATUS (ret));
}
-static struct {
+static struct
+{
const char *name;
- void (*func)(remote_target *remote, char *);
-} remote_fio_func_map[] = {
- { "open", remote_fileio_func_open },
- { "close", remote_fileio_func_close },
- { "read", remote_fileio_func_read },
- { "write", remote_fileio_func_write },
- { "lseek", remote_fileio_func_lseek },
- { "rename", remote_fileio_func_rename },
- { "unlink", remote_fileio_func_unlink },
- { "stat", remote_fileio_func_stat },
- { "fstat", remote_fileio_func_fstat },
- { "gettimeofday", remote_fileio_func_gettimeofday },
- { "isatty", remote_fileio_func_isatty },
- { "system", remote_fileio_func_system },
- { NULL, NULL }
-};
+ void (*func) (remote_target *remote, char *);
+} remote_fio_func_map[]
+ = { { "open", remote_fileio_func_open },
+ { "close", remote_fileio_func_close },
+ { "read", remote_fileio_func_read },
+ { "write", remote_fileio_func_write },
+ { "lseek", remote_fileio_func_lseek },
+ { "rename", remote_fileio_func_rename },
+ { "unlink", remote_fileio_func_unlink },
+ { "stat", remote_fileio_func_stat },
+ { "fstat", remote_fileio_func_fstat },
+ { "gettimeofday", remote_fileio_func_gettimeofday },
+ { "isatty", remote_fileio_func_isatty },
+ { "system", remote_fileio_func_system },
+ { NULL, NULL } };
static void
do_remote_fileio_request (remote_target *remote, char *buf)
@@ -1202,15 +1203,13 @@ remote_fileio_request (remote_target *remote, char *buf, int ctrlc_pending_p)
quit_handler = remote_fileio_o_quit_handler;
}
-
/* Unpack an fio_uint_t. */
static unsigned int
remote_fileio_to_host_uint (fio_uint_t fnum)
{
- return extract_unsigned_integer ((gdb_byte *) fnum, 4,
- BFD_ENDIAN_BIG);
+ return extract_unsigned_integer ((gdb_byte *) fnum, 4, BFD_ENDIAN_BIG);
}
/* Unpack an fio_ulong_t. */
@@ -1218,8 +1217,7 @@ remote_fileio_to_host_uint (fio_uint_t fnum)
static ULONGEST
remote_fileio_to_host_ulong (fio_ulong_t fnum)
{
- return extract_unsigned_integer ((gdb_byte *) fnum, 8,
- BFD_ENDIAN_BIG);
+ return extract_unsigned_integer ((gdb_byte *) fnum, 8, BFD_ENDIAN_BIG);
}
/* Unpack an fio_mode_t. */
@@ -1227,8 +1225,7 @@ remote_fileio_to_host_ulong (fio_ulong_t fnum)
static mode_t
remote_fileio_to_host_mode (fio_mode_t fnum)
{
- return remote_fileio_mode_to_host (remote_fileio_to_host_uint (fnum),
- 0);
+ return remote_fileio_mode_to_host (remote_fileio_to_host_uint (fnum), 0);
}
/* Unpack an fio_time_t. */
@@ -1239,7 +1236,6 @@ remote_fileio_to_host_time (fio_time_t fnum)
return remote_fileio_to_host_uint (fnum);
}
-
/* See remote-fileio.h. */
void
@@ -1265,7 +1261,6 @@ remote_fileio_to_host_stat (struct fio_stat *fst, struct stat *st)
st->st_mtime = remote_fileio_to_host_time (fst->fst_mtime);
st->st_ctime = remote_fileio_to_host_time (fst->fst_ctime);
}
-
static void
set_system_call_allowed (const char *args, int from_tty)
@@ -1281,15 +1276,17 @@ set_system_call_allowed (const char *args, int from_tty)
return;
}
}
- error (_("Illegal argument for \"set remote system-call-allowed\" command"));
+ error (
+ _ ("Illegal argument for \"set remote system-call-allowed\" command"));
}
static void
show_system_call_allowed (const char *args, int from_tty)
{
if (args)
- error (_("Garbage after \"show remote "
- "system-call-allowed\" command: `%s'"), args);
+ error (_ ("Garbage after \"show remote "
+ "system-call-allowed\" command: `%s'"),
+ args);
gdb_printf ("Calling host system(3) call from target is %sallowed\n",
remote_fio_system_call_allowed ? "" : "not ");
}
@@ -1298,12 +1295,10 @@ void
initialize_remote_fileio (struct cmd_list_element **remote_set_cmdlist,
struct cmd_list_element **remote_show_cmdlist)
{
- add_cmd ("system-call-allowed", no_class,
- set_system_call_allowed,
- _("Set if the host system(3) call is allowed for the target."),
+ add_cmd ("system-call-allowed", no_class, set_system_call_allowed,
+ _ ("Set if the host system(3) call is allowed for the target."),
remote_set_cmdlist);
- add_cmd ("system-call-allowed", no_class,
- show_system_call_allowed,
- _("Show if the host system(3) call is allowed for the target."),
+ add_cmd ("system-call-allowed", no_class, show_system_call_allowed,
+ _ ("Show if the host system(3) call is allowed for the target."),
remote_show_cmdlist);
}
diff --git a/gdb/remote-fileio.h b/gdb/remote-fileio.h
index 71d85c618a9..2ee893e2d22 100644
--- a/gdb/remote-fileio.h
+++ b/gdb/remote-fileio.h
@@ -29,19 +29,18 @@ struct remote_target;
/* Unified interface to remote fileio, called in remote.c from
remote_wait () and remote_async_wait (). */
-extern void remote_fileio_request (remote_target *remote,
- char *buf, int ctrlc_pending_p);
+extern void remote_fileio_request (remote_target *remote, char *buf,
+ int ctrlc_pending_p);
/* Cleanup any remote fileio state. */
extern void remote_fileio_reset (void);
/* Called from _initialize_remote (). */
-extern void initialize_remote_fileio (
- struct cmd_list_element **remote_set_cmdlist,
- struct cmd_list_element **remote_show_cmdlist);
+extern void
+initialize_remote_fileio (struct cmd_list_element **remote_set_cmdlist,
+ struct cmd_list_element **remote_show_cmdlist);
/* Unpack a struct fio_stat. */
-extern void remote_fileio_to_host_stat (struct fio_stat *fst,
- struct stat *st);
+extern void remote_fileio_to_host_stat (struct fio_stat *fst, struct stat *st);
#endif
diff --git a/gdb/remote-notif.c b/gdb/remote-notif.c
index dfa1d33a7e1..706b8bf283c 100644
--- a/gdb/remote-notif.c
+++ b/gdb/remote-notif.c
@@ -46,8 +46,7 @@ bool notif_debug = false;
/* Supported clients of notifications. */
-static const notif_client *const notifs[] =
-{
+static const notif_client *const notifs[] = {
&notif_client_stop,
};
@@ -57,14 +56,13 @@ gdb_static_assert (ARRAY_SIZE (notifs) == REMOTE_NOTIF_LAST);
acknowledge. */
void
-remote_notif_ack (remote_target *remote,
- const notif_client *nc, const char *buf)
+remote_notif_ack (remote_target *remote, const notif_client *nc,
+ const char *buf)
{
notif_event_up event = nc->alloc_event ();
if (notif_debug)
- gdb_printf (gdb_stdlog, "notif: ack '%s'\n",
- nc->ack_command);
+ gdb_printf (gdb_stdlog, "notif: ack '%s'\n", nc->ack_command);
nc->parse (remote, nc, buf, event.get ());
nc->ack (remote, nc, buf, event.release ());
@@ -73,8 +71,8 @@ remote_notif_ack (remote_target *remote,
/* Parse the BUF for the expected notification NC. */
struct notif_event *
-remote_notif_parse (remote_target *remote,
- const notif_client *nc, const char *buf)
+remote_notif_parse (remote_target *remote, const notif_client *nc,
+ const char *buf)
{
notif_event_up event = nc->alloc_event ();
@@ -127,8 +125,7 @@ handle_notification (struct remote_notif_state *state, const char *buf)
{
const char *name = notifs[i]->name;
- if (startswith (buf, name)
- && buf[strlen (name)] == ':')
+ if (startswith (buf, name) && buf[strlen (name)] == ':')
break;
}
@@ -137,7 +134,7 @@ handle_notification (struct remote_notif_state *state, const char *buf)
if (i == ARRAY_SIZE (notifs))
return;
- nc = notifs[i];
+ nc = notifs[i];
if (state->pending_event[nc->id] != NULL)
{
@@ -145,8 +142,7 @@ handle_notification (struct remote_notif_state *state, const char *buf)
reason thought we didn't, possibly due to timeout on its side.
Just ignore it. */
if (notif_debug)
- gdb_printf (gdb_stdlog,
- "notif: ignoring resent notification\n");
+ gdb_printf (gdb_stdlog, "notif: ignoring resent notification\n");
}
else
{
@@ -202,8 +198,7 @@ handle_notification (struct remote_notif_state *state, const char *buf)
}
if (notif_debug)
- gdb_printf (gdb_stdlog,
- "notif: Notification '%s' captured\n",
+ gdb_printf (gdb_stdlog, "notif: Notification '%s' captured\n",
nc->name);
}
}
@@ -241,16 +236,16 @@ remote_notif_state::~remote_notif_state ()
}
void _initialize_notif ();
+
void
_initialize_notif ()
{
- add_setshow_boolean_cmd ("notification", no_class, &notif_debug,
- _("\
-Set debugging of async remote notification."), _("\
-Show debugging of async remote notification."), _("\
+ add_setshow_boolean_cmd ("notification", no_class, &notif_debug, _ ("\
+Set debugging of async remote notification."),
+ _ ("\
+Show debugging of async remote notification."),
+ _ ("\
When non-zero, debugging output about async remote notifications"
-" is enabled."),
- NULL,
- NULL,
- &setdebuglist, &showdebuglist);
+ " is enabled."),
+ NULL, NULL, &setdebuglist, &showdebuglist);
}
diff --git a/gdb/remote-notif.h b/gdb/remote-notif.h
index c95e1f6ff14..7a14e925cf1 100644
--- a/gdb/remote-notif.h
+++ b/gdb/remote-notif.h
@@ -27,9 +27,7 @@
struct notif_event
{
- virtual ~notif_event ()
- {
- }
+ virtual ~notif_event () {}
};
/* A unique pointer holding a notif_event. */
@@ -59,15 +57,13 @@ struct notif_client
/* Parse BUF to get the expected event and update EVENT. This
function may throw exception if contents in BUF is not the
expected event. */
- void (*parse) (remote_target *remote,
- const notif_client *self, const char *buf,
- struct notif_event *event);
+ void (*parse) (remote_target *remote, const notif_client *self,
+ const char *buf, struct notif_event *event);
/* Send field <ack_command> to remote, and do some checking. If
something wrong, throw an exception. */
- void (*ack) (remote_target *remote,
- const notif_client *self, const char *buf,
- struct notif_event *event);
+ void (*ack) (remote_target *remote, const notif_client *self,
+ const char *buf, struct notif_event *event);
/* Check this notification client can get pending events in
'remote_notif_process'. */
diff --git a/gdb/remote-sim.c b/gdb/remote-sim.c
index e49375d524a..7fdef1c6235 100644
--- a/gdb/remote-sim.c
+++ b/gdb/remote-sim.c
@@ -69,8 +69,8 @@ static void gdb_os_vprintf_filtered (host_callback *, const char *, va_list);
static void gdb_os_evprintf_filtered (host_callback *, const char *, va_list);
-static void gdb_os_error (host_callback *, const char *, ...)
- ATTRIBUTE_NORETURN;
+static void gdb_os_error (host_callback *, const char *,
+ ...) ATTRIBUTE_NORETURN;
/* Naming convention:
@@ -84,7 +84,8 @@ static int next_pid;
#define INITIAL_PID 42000
/* Simulator-specific, per-inferior state. */
-struct sim_inferior_data {
+struct sim_inferior_data
+{
explicit sim_inferior_data (SIM_DESC desc)
: gdbsim_desc (desc),
remote_sim_ptid (next_pid, 0, next_pid)
@@ -115,19 +116,15 @@ struct sim_inferior_data {
bool resume_step = false;
};
-static const target_info gdbsim_target_info = {
- "sim",
- N_("simulator"),
- N_("Use the compiled-in simulator.")
-};
+static const target_info gdbsim_target_info
+ = { "sim", N_ ("simulator"), N_ ("Use the compiled-in simulator.") };
struct gdbsim_target final
: public memory_breakpoint_target<process_stratum_target>
{
gdbsim_target () = default;
- const target_info &info () const override
- { return gdbsim_target_info; }
+ const target_info &info () const override { return gdbsim_target_info; }
void close () override;
@@ -141,8 +138,7 @@ struct gdbsim_target final
void prepare_to_store (struct regcache *) override;
enum target_xfer_status xfer_partial (enum target_object object,
- const char *annex,
- gdb_byte *readbuf,
+ const char *annex, gdb_byte *readbuf,
const gdb_byte *writebuf,
ULONGEST offset, ULONGEST len,
ULONGEST *xfered_len) override;
@@ -154,8 +150,9 @@ struct gdbsim_target final
void load (const char *, int) override;
bool can_create_inferior () override { return true; }
- void create_inferior (const char *, const std::string &,
- char **, int) override;
+
+ void create_inferior (const char *, const std::string &, char **,
+ int) override;
void mourn_inferior () override;
@@ -165,11 +162,12 @@ struct gdbsim_target final
std::string pid_to_str (ptid_t) override;
- bool has_all_memory () override;
- bool has_memory () override;
+ bool has_all_memory () override;
+ bool has_memory () override;
std::vector<mem_region> memory_map () override;
private:
+
sim_inferior_data *get_inferior_data_by_ptid (ptid_t ptid,
int sim_instance_needed);
void resume_one_inferior (inferior *inf, bool step, gdb_signal siggnal);
@@ -197,7 +195,11 @@ static int callbacks_initialized = 0;
/* Flags indicating whether or not a sim instance is needed. One of these
flags should be passed to get_sim_inferior_data(). */
-enum {SIM_INSTANCE_NOT_NEEDED = 0, SIM_INSTANCE_NEEDED = 1};
+enum
+{
+ SIM_INSTANCE_NOT_NEEDED = 0,
+ SIM_INSTANCE_NEEDED = 1
+};
/* Obtain pointer to per-inferior simulator data, allocating it if necessary.
Attempt to open the sim if SIM_INSTANCE_NEEDED is true. */
@@ -218,7 +220,7 @@ get_sim_inferior_data (struct inferior *inf, int sim_instance_needed)
sim_desc = sim_open (SIM_OPEN_DEBUG, &gdb_callback,
current_program_space->exec_bfd (), sim_argv);
if (sim_desc == NULL)
- error (_("Unable to create simulator instance for inferior %d."),
+ error (_ ("Unable to create simulator instance for inferior %d."),
inf->num);
/* Check if the sim descriptor is the same as that of another
@@ -238,9 +240,10 @@ get_sim_inferior_data (struct inferior *inf, int sim_instance_needed)
done... Note that it *will* ultimately be closed during
cleanup of the other inferior. */
sim_desc = NULL;
- error (
-_("Inferior %d and inferior %d would have identical simulator state.\n"
- "(This simulator does not support the running of more than one inferior.)"),
+ error (_ ("Inferior %d and inferior %d would have identical "
+ "simulator state.\n"
+ "(This simulator does not support the running of more "
+ "than one inferior.)"),
inf->num, other_inf->num);
}
}
@@ -257,7 +260,6 @@ _("Inferior %d and inferior %d would have identical simulator state.\n"
sim_data->gdbsim_desc = sim_desc;
}
-
return sim_data;
}
@@ -266,8 +268,7 @@ _("Inferior %d and inferior %d would have identical simulator state.\n"
when ptid has a zero or negative pid component. */
sim_inferior_data *
-gdbsim_target::get_inferior_data_by_ptid (ptid_t ptid,
- int sim_instance_needed)
+gdbsim_target::get_inferior_data_by_ptid (ptid_t ptid, int sim_instance_needed)
{
struct inferior *inf;
int pid = ptid.pid ();
@@ -396,7 +397,7 @@ gdb_os_flush_stderr (host_callback *p)
/* GDB version of gdb_printf callback. */
static void ATTRIBUTE_PRINTF (2, 3)
-gdb_os_printf_filtered (host_callback * p, const char *format, ...)
+ gdb_os_printf_filtered (host_callback *p, const char *format, ...)
{
va_list args;
@@ -408,7 +409,7 @@ gdb_os_printf_filtered (host_callback * p, const char *format, ...)
/* GDB version of error gdb_vprintf. */
static void ATTRIBUTE_PRINTF (2, 0)
-gdb_os_vprintf_filtered (host_callback * p, const char *format, va_list ap)
+ gdb_os_vprintf_filtered (host_callback *p, const char *format, va_list ap)
{
gdb_vprintf (gdb_stdout, format, ap);
}
@@ -416,7 +417,7 @@ gdb_os_vprintf_filtered (host_callback * p, const char *format, va_list ap)
/* GDB version of error evprintf_filtered. */
static void ATTRIBUTE_PRINTF (2, 0)
-gdb_os_evprintf_filtered (host_callback * p, const char *format, va_list ap)
+ gdb_os_evprintf_filtered (host_callback *p, const char *format, va_list ap)
{
gdb_vprintf (gdb_stderr, format, ap);
}
@@ -424,7 +425,7 @@ gdb_os_evprintf_filtered (host_callback * p, const char *format, va_list ap)
/* GDB version of error callback. */
static void ATTRIBUTE_PRINTF (2, 3)
-gdb_os_error (host_callback * p, const char *format, ...)
+ gdb_os_error (host_callback *p, const char *format, ...)
{
va_list args;
@@ -476,19 +477,18 @@ gdbsim_target::fetch_registers (struct regcache *regcache, int regno)
int nr_bytes;
gdb_assert (regno >= 0 && regno < gdbarch_num_regs (gdbarch));
- nr_bytes = sim_fetch_register (sim_data->gdbsim_desc,
- gdbarch_register_sim_regno
- (gdbarch, regno),
- buf.data (), regsize);
+ nr_bytes
+ = sim_fetch_register (sim_data->gdbsim_desc,
+ gdbarch_register_sim_regno (gdbarch, regno),
+ buf.data (), regsize);
if (nr_bytes > 0 && nr_bytes != regsize && warn_user)
{
gdb_printf (gdb_stderr,
"Size of register %s (%d/%d) "
"incorrect (%d instead of %d))",
- gdbarch_register_name (gdbarch, regno),
- regno,
- gdbarch_register_sim_regno (gdbarch, regno),
- nr_bytes, regsize);
+ gdbarch_register_name (gdbarch, regno), regno,
+ gdbarch_register_sim_regno (gdbarch, regno), nr_bytes,
+ regsize);
warn_user = 0;
}
/* FIXME: cagney/2002-05-27: Should check `nr_bytes == 0'
@@ -499,8 +499,7 @@ gdbsim_target::fetch_registers (struct regcache *regcache, int regno)
regcache->raw_supply (regno, buf.data ());
if (remote_debug)
{
- gdb_printf (gdb_stdlog,
- "gdbsim_fetch_register: %d", regno);
+ gdb_printf (gdb_stdlog, "gdbsim_fetch_register: %d", regno);
/* FIXME: We could print something more intelligible. */
dump_mem (buf.data (), regsize);
}
@@ -509,7 +508,6 @@ gdbsim_target::fetch_registers (struct regcache *regcache, int regno)
}
}
-
void
gdbsim_target::store_registers (struct regcache *regcache, int regno)
{
@@ -531,17 +529,17 @@ gdbsim_target::store_registers (struct regcache *regcache, int regno)
int nr_bytes;
regcache->cooked_read (regno, tmp.data ());
- nr_bytes = sim_store_register (sim_data->gdbsim_desc,
- gdbarch_register_sim_regno
- (gdbarch, regno),
- tmp.data (), regsize);
+ nr_bytes
+ = sim_store_register (sim_data->gdbsim_desc,
+ gdbarch_register_sim_regno (gdbarch, regno),
+ tmp.data (), regsize);
if (nr_bytes > 0 && nr_bytes != regsize)
- internal_error (_("Register size different to expected"));
+ internal_error (_ ("Register size different to expected"));
if (nr_bytes < 0)
- internal_error (_("Register %d not updated"), regno);
+ internal_error (_ ("Register %d not updated"), regno);
if (nr_bytes == 0)
- warning (_("Register %s not updated"),
+ warning (_ ("Register %s not updated"),
gdbarch_register_name (gdbarch, regno));
if (remote_debug)
@@ -579,14 +577,14 @@ gdbsim_target::load (const char *args, int fromtty)
= get_sim_inferior_data (current_inferior (), SIM_INSTANCE_NEEDED);
if (args == NULL)
- error_no_arg (_("program to load"));
+ error_no_arg (_ ("program to load"));
gdb_argv argv (args);
prog = tilde_expand (argv[0]);
if (argv[1] != NULL)
- error (_("GDB sim does not yet support a load offset."));
+ error (_ ("GDB sim does not yet support a load offset."));
if (remote_debug)
gdb_printf (gdb_stdlog, "gdbsim_load: prog \"%s\"\n", prog);
@@ -595,7 +593,7 @@ gdbsim_target::load (const char *args, int fromtty)
Need error to either not print anything if passed NULL or need
another routine that doesn't take any arguments. */
if (sim_load (sim_data->gdbsim_desc, prog, NULL, fromtty) == SIM_RC_FAIL)
- error (_("unable to load program"));
+ error (_ ("unable to load program"));
/* FIXME: If a load command should reset the targets registers then
a call to sim_create_inferior() should go here. */
@@ -603,7 +601,6 @@ gdbsim_target::load (const char *args, int fromtty)
sim_data->program_loaded = true;
}
-
/* Start an inferior process and set inferior_ptid to its pid.
EXEC_FILE is the file to run.
ARGS is a string containing the arguments to the program.
@@ -614,8 +611,8 @@ gdbsim_target::load (const char *args, int fromtty)
void
gdbsim_target::create_inferior (const char *exec_file,
- const std::string &allargs,
- char **env, int from_tty)
+ const std::string &allargs, char **env,
+ int from_tty)
{
struct sim_inferior_data *sim_data
= get_sim_inferior_data (current_inferior (), SIM_INSTANCE_NEEDED);
@@ -624,15 +621,14 @@ gdbsim_target::create_inferior (const char *exec_file,
const char *args = allargs.c_str ();
if (exec_file == 0 || current_program_space->exec_bfd () == 0)
- warning (_("No executable file specified."));
+ warning (_ ("No executable file specified."));
if (!sim_data->program_loaded)
- warning (_("No program loaded."));
+ warning (_ ("No program loaded."));
if (remote_debug)
gdb_printf (gdb_stdlog,
"gdbsim_create_inferior: exec_file \"%s\", args \"%s\"\n",
- (exec_file ? exec_file : "(NULL)"),
- args);
+ (exec_file ? exec_file : "(NULL)"), args);
if (inferior_ptid == sim_data->remote_sim_ptid)
kill ();
@@ -655,14 +651,13 @@ gdbsim_target::create_inferior (const char *exec_file,
current_program_space->exec_bfd (),
built_argv.get (), env)
!= SIM_RC_OK)
- error (_("Unable to create sim inferior."));
+ error (_ ("Unable to create sim inferior."));
- inferior_appeared (current_inferior (),
- sim_data->remote_sim_ptid.pid ());
+ inferior_appeared (current_inferior (), sim_data->remote_sim_ptid.pid ());
thread_info *thr = add_thread_silent (this, sim_data->remote_sim_ptid);
switch_to_thread (thr);
- insert_breakpoints (); /* Needed to get correct instruction
+ insert_breakpoints (); /* Needed to get correct instruction
in cache. */
clear_proceed_status (0);
@@ -686,8 +681,8 @@ gdbsim_target_open (const char *args, int from_tty)
sysroot += strlen (TARGET_SYSROOT_PREFIX);
if (remote_debug)
- gdb_printf (gdb_stdlog,
- "gdbsim_open: args \"%s\"\n", args ? args : "(null)");
+ gdb_printf (gdb_stdlog, "gdbsim_open: args \"%s\"\n",
+ args ? args : "(null)");
/* Ensure that the sim target is not on the target stack. This is
necessary, because if it is on the target stack, the call to
@@ -699,14 +694,12 @@ gdbsim_target_open (const char *args, int from_tty)
if (gdbsim_is_open)
current_inferior ()->unpush_target (&gdbsim_ops);
- len = (7 + 1 /* gdbsim */
- + strlen (" -E little")
- + strlen (" --architecture=xxxxxxxxxx")
- + strlen (" --sysroot=") + strlen (sysroot) +
- + (args ? strlen (args) : 0)
- + 50) /* slack */ ;
+ len = (7 + 1 /* gdbsim */
+ + strlen (" -E little") + strlen (" --architecture=xxxxxxxxxx")
+ + strlen (" --sysroot=") + strlen (sysroot)
+ + +(args ? strlen (args) : 0) + 50) /* slack */;
arg_buf = (char *) alloca (len);
- strcpy (arg_buf, "gdbsim"); /* 7 */
+ strcpy (arg_buf, "gdbsim"); /* 7 */
/* Specify the byte order for the target when it is explicitly
specified by the user (not auto detected). */
switch (selected_byte_order ())
@@ -733,7 +726,7 @@ gdbsim_target_open (const char *args, int from_tty)
/* finally, any explicit args */
if (args)
{
- strcat (arg_buf, " "); /* 1 */
+ strcat (arg_buf, " "); /* 1 */
strcat (arg_buf, args);
}
@@ -748,7 +741,7 @@ gdbsim_target_open (const char *args, int from_tty)
{
freeargv (sim_argv);
sim_argv = NULL;
- error (_("unable to create simulator instance"));
+ error (_ ("unable to create simulator instance"));
}
/* Reset the pid numberings for this batch of sim instances. */
@@ -756,8 +749,8 @@ gdbsim_target_open (const char *args, int from_tty)
/* Allocate the inferior data, but do not allocate a sim instance
since we've already just done that. */
- sim_data = get_sim_inferior_data (current_inferior (),
- SIM_INSTANCE_NOT_NEEDED);
+ sim_data
+ = get_sim_inferior_data (current_inferior (), SIM_INSTANCE_NOT_NEEDED);
sim_data->gdbsim_desc = gdbsim_desc;
@@ -832,7 +825,7 @@ gdbsim_target::detach (inferior *inf, int from_tty)
if (remote_debug)
gdb_printf (gdb_stdlog, "gdbsim_detach\n");
- inf->unpush_target (this); /* calls gdbsim_close to do the real work */
+ inf->unpush_target (this); /* calls gdbsim_close to do the real work */
if (from_tty)
gdb_printf ("Ending simulator %s debugging\n", target_shortname ());
}
@@ -855,7 +848,7 @@ gdbsim_target::resume_one_inferior (inferior *inf, bool step,
if (remote_debug)
gdb_printf (gdb_stdlog,
- _("gdbsim_resume: pid %d, step %d, signal %d\n"),
+ _ ("gdbsim_resume: pid %d, step %d, signal %d\n"),
inf->pid, step, siggnal);
}
}
@@ -881,7 +874,7 @@ gdbsim_target::resume (ptid_t ptid, int step, enum gdb_signal siggnal)
resume_one_inferior (inf, step, siggnal);
}
else
- error (_("The program is not being run."));
+ error (_ ("The program is not being run."));
}
/* Notify the simulator of an asynchronous request to interrupt.
@@ -902,7 +895,7 @@ gdbsim_target::interrupt ()
= get_sim_inferior_data (inf, SIM_INSTANCE_NEEDED);
if (sim_data != nullptr && !sim_stop (sim_data->gdbsim_desc))
- quit ();
+ quit ();
}
}
@@ -915,7 +908,7 @@ gdb_os_poll_quit (host_callback *p)
if (deprecated_ui_loop_hook != NULL)
deprecated_ui_loop_hook (0);
- if (check_quit_flag ()) /* gdb's idea of quit */
+ if (check_quit_flag ()) /* gdb's idea of quit */
return 1;
return 0;
}
@@ -943,20 +936,20 @@ gdbsim_target::wait (ptid_t ptid, struct target_waitstatus *status,
When ptid is minus_one_ptid, just use the current inferior. If we're
given an explicit pid, we'll try to find it and use that instead. */
if (ptid == minus_one_ptid)
- sim_data = get_sim_inferior_data (current_inferior (),
- SIM_INSTANCE_NEEDED);
+ sim_data
+ = get_sim_inferior_data (current_inferior (), SIM_INSTANCE_NEEDED);
else
{
sim_data = get_inferior_data_by_ptid (ptid, SIM_INSTANCE_NEEDED);
if (sim_data == NULL)
- error (_("Unable to wait for pid %d. Inferior not found."),
+ error (_ ("Unable to wait for pid %d. Inferior not found."),
ptid.pid ());
}
if (remote_debug)
gdb_printf (gdb_stdlog, "gdbsim_wait\n");
-#if defined (HAVE_SIGACTION) && defined (SA_RESTART)
+#if defined(HAVE_SIGACTION) && defined(SA_RESTART)
{
struct sigaction sa, osa;
sa.sa_handler = gdbsim_cntrl_c;
@@ -1022,9 +1015,9 @@ gdbsim_target::prepare_to_store (struct regcache *regcache)
Arguments are like target_xfer_partial. */
static enum target_xfer_status
-gdbsim_xfer_memory (struct target_ops *target,
- gdb_byte *readbuf, const gdb_byte *writebuf,
- ULONGEST memaddr, ULONGEST len, ULONGEST *xfered_len)
+gdbsim_xfer_memory (struct target_ops *target, gdb_byte *readbuf,
+ const gdb_byte *writebuf, ULONGEST memaddr, ULONGEST len,
+ ULONGEST *xfered_len)
{
struct sim_inferior_data *sim_data
= get_sim_inferior_data (current_inferior (), SIM_INSTANCE_NOT_NEEDED);
@@ -1037,7 +1030,7 @@ gdbsim_xfer_memory (struct target_ops *target,
return TARGET_XFER_EOF;
if (!sim_data->program_loaded)
- error (_("No program loaded."));
+ error (_ ("No program loaded."));
/* Note that we obtained the sim_data pointer above using
SIM_INSTANCE_NOT_NEEDED. We do this so that we don't needlessly
@@ -1053,8 +1046,7 @@ gdbsim_xfer_memory (struct target_ops *target,
"memaddr %s, len %s\n",
host_address_to_string (readbuf),
host_address_to_string (writebuf),
- paddress (target_gdbarch (), memaddr),
- pulongest (len));
+ paddress (target_gdbarch (), memaddr), pulongest (len));
if (writebuf)
{
@@ -1082,9 +1074,9 @@ gdbsim_xfer_memory (struct target_ops *target,
/* Target to_xfer_partial implementation. */
enum target_xfer_status
-gdbsim_target::xfer_partial (enum target_object object,
- const char *annex, gdb_byte *readbuf,
- const gdb_byte *writebuf, ULONGEST offset, ULONGEST len,
+gdbsim_target::xfer_partial (enum target_object object, const char *annex,
+ gdb_byte *readbuf, const gdb_byte *writebuf,
+ ULONGEST offset, ULONGEST len,
ULONGEST *xfered_len)
{
switch (object)
@@ -1113,8 +1105,8 @@ gdbsim_target::files_info ()
if (current_program_space->exec_bfd ())
{
- gdb_printf ("\tAttached to %s running program %s\n",
- target_shortname (), file);
+ gdb_printf ("\tAttached to %s running program %s\n", target_shortname (),
+ file);
sim_info (sim_data->gdbsim_desc, 0);
}
}
@@ -1149,10 +1141,9 @@ simulator_command (const char *args, int from_tty)
thus allocating memory that would not be garbage collected until
the ultimate destruction of the associated inferior. */
- sim_data = sim_inferior_data_key.get (current_inferior ());
+ sim_data = sim_inferior_data_key.get (current_inferior ());
if (sim_data == NULL || sim_data->gdbsim_desc == NULL)
{
-
/* PREVIOUSLY: The user may give a command before the simulator
is opened. [...] (??? assuming of course one wishes to
continue to allow commands to be sent to unopened simulators,
@@ -1163,7 +1154,7 @@ simulator_command (const char *args, int from_tty)
commands, is restricted to the period when the channel to the
simulator is open. */
- error (_("Not connected to the simulator target"));
+ error (_ ("Not connected to the simulator target"));
}
sim_do_command (sim_data->gdbsim_desc, args);
@@ -1175,8 +1166,8 @@ simulator_command (const char *args, int from_tty)
static void
sim_command_completer (struct cmd_list_element *ignore,
- completion_tracker &tracker,
- const char *text, const char *word)
+ completion_tracker &tracker, const char *text,
+ const char *word)
{
struct sim_inferior_data *sim_data;
@@ -1196,8 +1187,8 @@ sim_command_completer (struct cmd_list_element *ignore,
}
};
- std::unique_ptr<char *[], sim_completions_deleter> sim_completions
- (sim_complete_command (sim_data->gdbsim_desc, text, word));
+ std::unique_ptr<char *[], sim_completions_deleter> sim_completions (
+ sim_complete_command (sim_data->gdbsim_desc, text, word));
if (sim_completions == NULL)
return;
@@ -1285,6 +1276,7 @@ gdbsim_target::memory_map ()
}
void _initialize_remote_sim ();
+
void
_initialize_remote_sim ()
{
@@ -1293,6 +1285,6 @@ _initialize_remote_sim ()
add_target (gdbsim_target_info, gdbsim_target_open);
c = add_com ("sim", class_obscure, simulator_command,
- _("Send a command to the simulator."));
+ _ ("Send a command to the simulator."));
set_cmd_completer (c, sim_command_completer);
}
diff --git a/gdb/remote.c b/gdb/remote.c
index ba7a7520cb4..87926d2b918 100644
--- a/gdb/remote.c
+++ b/gdb/remote.c
@@ -82,7 +82,7 @@
/* The remote target. */
-static const char remote_doc[] = N_("\
+static const char remote_doc[] = N_ ("\
Use a remote computer via a serial line, using a gdb-specific protocol.\n\
Specify the serial device it is connected to\n\
(e.g. /dev/ttyS0, /dev/ttya, COM1, etc.).");
@@ -110,11 +110,11 @@ typedef std::unique_ptr<stop_reply> stop_reply_up;
as allowing GDB to auto-detect support in the remote stub. */
enum packet_support
- {
- PACKET_SUPPORT_UNKNOWN = 0,
- PACKET_ENABLE,
- PACKET_DISABLE
- };
+{
+ PACKET_SUPPORT_UNKNOWN = 0,
+ PACKET_ENABLE,
+ PACKET_DISABLE
+};
/* Convert the packet support auto_boolean to a name used for gdb printing. */
@@ -123,14 +123,14 @@ get_packet_support_name (auto_boolean support)
{
switch (support)
{
- case AUTO_BOOLEAN_TRUE:
- return "on";
- case AUTO_BOOLEAN_FALSE:
- return "off";
- case AUTO_BOOLEAN_AUTO:
- return "auto";
- default:
- gdb_assert_not_reached ("invalid var_auto_boolean");
+ case AUTO_BOOLEAN_TRUE:
+ return "on";
+ case AUTO_BOOLEAN_FALSE:
+ return "off";
+ case AUTO_BOOLEAN_AUTO:
+ return "auto";
+ default:
+ gdb_assert_not_reached ("invalid var_auto_boolean");
}
}
@@ -141,9 +141,9 @@ static const char *
get_target_type_name (bool target_connected)
{
if (target_connected)
- return _("on the current remote target");
+ return _ ("on the current remote target");
else
- return _("on future remote targets");
+ return _ ("on future remote targets");
}
/* Analyze a packet's return value and update the packet config
@@ -158,7 +158,8 @@ enum packet_result
/* Enumeration of packets for a remote target. */
-enum {
+enum
+{
PACKET_vCont = 0,
PACKET_X,
PACKET_qSymbol,
@@ -368,9 +369,9 @@ struct readahead_cache
struct packet_reg
{
- long offset; /* Offset into G packet. */
- long regnum; /* GDB's internal register number. */
- LONGEST pnum; /* Remote protocol register number. */
+ long offset; /* Offset into G packet. */
+ long regnum; /* GDB's internal register number. */
+ LONGEST pnum; /* Remote protocol register number. */
int in_g_packet; /* Always part of G packet. */
/* long size in bytes; == register_size (target_gdbarch (), regnum);
at present. */
@@ -518,7 +519,9 @@ public: /* data */
struct remote_notif_state *notif_state = nullptr;
/* The branch trace configuration. */
- struct btrace_config btrace_config {};
+ struct btrace_config btrace_config
+ {
+ };
/* The argument to the last "vFile:setfs:" packet we sent, used
to avoid sending repeated unnecessary "vFile:setfs:" packets.
@@ -557,18 +560,15 @@ public: /* data */
int wait_forever_enabled_p = 1;
private:
+
/* Mapping of remote protocol data for each gdbarch. Usually there
is only one entry here, though we may see more with stubs that
support multi-process. */
- std::unordered_map<struct gdbarch *, remote_arch_state>
- m_arch_states;
+ std::unordered_map<struct gdbarch *, remote_arch_state> m_arch_states;
};
-static const target_info remote_target_info = {
- "remote",
- N_("Remote target using gdb-specific protocol"),
- remote_doc
-};
+static const target_info remote_target_info
+ = { "remote", N_ ("Remote target using gdb-specific protocol"), remote_doc };
/* Description of a remote packet. */
@@ -614,12 +614,10 @@ struct memory_packet_config
/* These global variables contain the default configuration for every new
remote_feature object. */
-static memory_packet_config memory_read_packet_config =
-{
+static memory_packet_config memory_read_packet_config = {
"memory-read-packet-size",
};
-static memory_packet_config memory_write_packet_config =
-{
+static memory_packet_config memory_write_packet_config = {
"memory-write-packet-size",
};
@@ -643,6 +641,7 @@ struct remote_features
std::end (remote_protocol_packets),
std::begin (m_protocol_packets));
}
+
~remote_features () = default;
DISABLE_COPY_AND_ASSIGN (remote_features);
@@ -653,36 +652,49 @@ struct remote_features
/* Returns the packet's corresponding "set remote foo-packet" command
state. See struct packet_config for more details. */
enum auto_boolean packet_set_cmd_state (int packet) const
- { return m_protocol_packets[packet].detect; }
+ {
+ return m_protocol_packets[packet].detect;
+ }
/* Returns true if the multi-process extensions are in effect. */
int remote_multi_process_p () const
- { return packet_support (PACKET_multiprocess_feature) == PACKET_ENABLE; }
+ {
+ return packet_support (PACKET_multiprocess_feature) == PACKET_ENABLE;
+ }
/* Returns true if fork events are supported. */
int remote_fork_event_p () const
- { return packet_support (PACKET_fork_event_feature) == PACKET_ENABLE; }
+ {
+ return packet_support (PACKET_fork_event_feature) == PACKET_ENABLE;
+ }
/* Returns true if vfork events are supported. */
int remote_vfork_event_p () const
- { return packet_support (PACKET_vfork_event_feature) == PACKET_ENABLE; }
+ {
+ return packet_support (PACKET_vfork_event_feature) == PACKET_ENABLE;
+ }
/* Returns true if exec events are supported. */
int remote_exec_event_p () const
- { return packet_support (PACKET_exec_event_feature) == PACKET_ENABLE; }
+ {
+ return packet_support (PACKET_exec_event_feature) == PACKET_ENABLE;
+ }
/* Returns true if memory tagging is supported, false otherwise. */
bool remote_memory_tagging_p () const
- { return packet_support (PACKET_memory_tagging_feature) == PACKET_ENABLE; }
+ {
+ return packet_support (PACKET_memory_tagging_feature) == PACKET_ENABLE;
+ }
/* Reset all packets back to "unknown support". Called when opening a
new connection to a remote target. */
void reset_all_packet_configs_support ();
-/* Check result value in BUF for packet WHICH_PACKET and update the packet's
+ /* Check result value in BUF for packet WHICH_PACKET and update the packet's
support configuration accordingly. */
packet_result packet_ok (const char *buf, const int which_packet);
- packet_result packet_ok (const gdb::char_vector &buf, const int which_packet);
+ packet_result packet_ok (const gdb::char_vector &buf,
+ const int which_packet);
/* Configuration of a remote target's memory read packet. */
memory_packet_config m_memory_read_packet_config;
@@ -697,16 +709,18 @@ struct remote_features
class remote_target : public process_stratum_target
{
public:
+
remote_target () = default;
~remote_target () override;
- const target_info &info () const override
- { return remote_target_info; }
+ const target_info &info () const override { return remote_target_info; }
const char *connection_string () override;
thread_control_capabilities get_thread_control_capabilities () override
- { return tc_schedlock; }
+ {
+ return tc_schedlock;
+ }
/* Open a remote connection. */
static void open (const char *, int);
@@ -730,7 +744,6 @@ public:
int remove_breakpoint (struct gdbarch *, struct bp_target_info *,
enum remove_bp_reason) override;
-
bool stopped_by_sw_breakpoint () override;
bool supports_stopped_by_sw_breakpoint () override;
@@ -746,9 +759,11 @@ public:
int can_use_hw_breakpoint (enum bptype, int, int) override;
- int insert_hw_breakpoint (struct gdbarch *, struct bp_target_info *) override;
+ int insert_hw_breakpoint (struct gdbarch *,
+ struct bp_target_info *) override;
- int remove_hw_breakpoint (struct gdbarch *, struct bp_target_info *) override;
+ int remove_hw_breakpoint (struct gdbarch *,
+ struct bp_target_info *) override;
int region_ok_for_hw_watchpoint (CORE_ADDR, int) override;
@@ -787,8 +802,8 @@ public:
int handle_len,
inferior *inf) override;
- gdb::byte_vector thread_info_to_thread_handle (struct thread_info *tp)
- override;
+ gdb::byte_vector
+ thread_info_to_thread_handle (struct thread_info *tp) override;
void stop (ptid_t) override;
@@ -797,8 +812,7 @@ public:
void pass_ctrlc () override;
enum target_xfer_status xfer_partial (enum target_object object,
- const char *annex,
- gdb_byte *readbuf,
+ const char *annex, gdb_byte *readbuf,
const gdb_byte *writebuf,
ULONGEST offset, ULONGEST len,
ULONGEST *xfered_len) override;
@@ -814,8 +828,7 @@ public:
serial_log_command (this, cmd);
}
- CORE_ADDR get_thread_local_address (ptid_t ptid,
- CORE_ADDR load_module_addr,
+ CORE_ADDR get_thread_local_address (ptid_t ptid, CORE_ADDR load_module_addr,
CORE_ADDR offset) override;
bool can_execute_reverse () override;
@@ -856,29 +869,27 @@ public:
bool filesystem_is_local () override;
-
- int fileio_open (struct inferior *inf, const char *filename,
- int flags, int mode, int warn_if_slow,
+ int fileio_open (struct inferior *inf, const char *filename, int flags,
+ int mode, int warn_if_slow,
fileio_error *target_errno) override;
int fileio_pwrite (int fd, const gdb_byte *write_buf, int len,
ULONGEST offset, fileio_error *target_errno) override;
- int fileio_pread (int fd, gdb_byte *read_buf, int len,
- ULONGEST offset, fileio_error *target_errno) override;
+ int fileio_pread (int fd, gdb_byte *read_buf, int len, ULONGEST offset,
+ fileio_error *target_errno) override;
- int fileio_fstat (int fd, struct stat *sb, fileio_error *target_errno) override;
+ int fileio_fstat (int fd, struct stat *sb,
+ fileio_error *target_errno) override;
int fileio_close (int fd, fileio_error *target_errno) override;
- int fileio_unlink (struct inferior *inf,
- const char *filename,
+ int fileio_unlink (struct inferior *inf, const char *filename,
fileio_error *target_errno) override;
gdb::optional<std::string>
- fileio_readlink (struct inferior *inf,
- const char *filename,
- fileio_error *target_errno) override;
+ fileio_readlink (struct inferior *inf, const char *filename,
+ fileio_error *target_errno) override;
bool supports_enable_disable_tracepoint () override;
@@ -902,7 +913,8 @@ public:
bool can_download_tracepoint () override;
- void download_trace_state_variable (const trace_state_variable &tsv) override;
+ void
+ download_trace_state_variable (const trace_state_variable &tsv) override;
void enable_tracepoint (struct bp_location *location) override;
@@ -914,13 +926,13 @@ public:
int get_trace_status (struct trace_status *ts) override;
- void get_tracepoint_status (struct breakpoint *tp, struct uploaded_tp *utp)
- override;
+ void get_tracepoint_status (struct breakpoint *tp,
+ struct uploaded_tp *utp) override;
void trace_stop () override;
- int trace_find (enum trace_find_type type, int num,
- CORE_ADDR addr1, CORE_ADDR addr2, int *tpp) override;
+ int trace_find (enum trace_find_type type, int num, CORE_ADDR addr1,
+ CORE_ADDR addr2, int *tpp) override;
bool get_trace_state_variable_value (int tsv, LONGEST *val) override;
@@ -930,7 +942,8 @@ public:
int upload_trace_state_variables (struct uploaded_tsv **utsvp) override;
- LONGEST get_raw_trace_data (gdb_byte *buf, ULONGEST offset, LONGEST len) override;
+ LONGEST get_raw_trace_data (gdb_byte *buf, ULONGEST offset,
+ LONGEST len) override;
int get_min_fast_tracepoint_insn_len () override;
@@ -945,20 +958,18 @@ public:
int core_of_thread (ptid_t ptid) override;
- int verify_memory (const gdb_byte *data,
- CORE_ADDR memaddr, ULONGEST size) override;
-
+ int verify_memory (const gdb_byte *data, CORE_ADDR memaddr,
+ ULONGEST size) override;
bool get_tib_address (ptid_t ptid, CORE_ADDR *addr) override;
void set_permissions () override;
- bool static_tracepoint_marker_at (CORE_ADDR,
- struct static_tracepoint_marker *marker)
- override;
+ bool static_tracepoint_marker_at (
+ CORE_ADDR, struct static_tracepoint_marker *marker) override;
std::vector<static_tracepoint_marker>
- static_tracepoint_markers_by_strid (const char *id) override;
+ static_tracepoint_markers_by_strid (const char *id) override;
traceframe_info_up traceframe_info () override;
@@ -966,7 +977,7 @@ public:
bool can_use_agent () override;
struct btrace_target_info *
- enable_btrace (thread_info *tp, const struct btrace_config *conf) override;
+ enable_btrace (thread_info *tp, const struct btrace_config *conf) override;
void disable_btrace (struct btrace_target_info *tinfo) override;
@@ -976,7 +987,8 @@ public:
struct btrace_target_info *btinfo,
enum btrace_read_type type) override;
- const struct btrace_config *btrace_conf (const struct btrace_target_info *) override;
+ const struct btrace_config *
+ btrace_conf (const struct btrace_target_info *) override;
bool augmented_libraries_svr4_read () override;
void follow_fork (inferior *, ptid_t, target_waitkind, bool, bool) override;
void follow_exec (inferior *, ptid_t, const char *) override;
@@ -990,8 +1002,8 @@ public:
bool supports_memory_tagging () override;
- bool fetch_memtags (CORE_ADDR address, size_t len,
- gdb::byte_vector &tags, int type) override;
+ bool fetch_memtags (CORE_ADDR address, size_t len, gdb::byte_vector &tags,
+ int type) override;
bool store_memtags (CORE_ADDR address, size_t len,
const gdb::byte_vector &tags, int type) override;
@@ -1015,7 +1027,8 @@ public: /* Remote specific methods. */
ULONGEST offset, fileio_error *remote_errno);
int remote_hostio_send_command (int command_bytes, int which_packet,
- fileio_error *remote_errno, const char **attachment,
+ fileio_error *remote_errno,
+ const char **attachment,
int *attachment_len);
int remote_hostio_set_filesystem (struct inferior *inf,
fileio_error *remote_errno);
@@ -1036,14 +1049,13 @@ public: /* Remote specific methods. */
long get_memory_write_packet_size ();
long get_memory_read_packet_size ();
- char *append_pending_thread_resumptions (char *p, char *endp,
- ptid_t ptid);
+ char *append_pending_thread_resumptions (char *p, char *endp, ptid_t ptid);
static void open_1 (const char *name, int from_tty, int extended_p);
void start_remote (int from_tty, int extended_p);
void remote_detach_1 (struct inferior *inf, int from_tty);
- char *append_resumption (char *p, char *endp,
- ptid_t ptid, int step, gdb_signal siggnal);
+ char *append_resumption (char *p, char *endp, ptid_t ptid, int step,
+ gdb_signal siggnal);
int remote_resume_with_vcont (ptid_t scope_ptid, int step,
gdb_signal siggnal);
@@ -1057,8 +1069,8 @@ public: /* Remote specific methods. */
ptid_t process_stop_reply (struct stop_reply *stop_reply,
target_waitstatus *status);
- ptid_t select_thread_for_ambiguous_stop_reply
- (const struct target_waitstatus &status);
+ ptid_t select_thread_for_ambiguous_stop_reply (
+ const struct target_waitstatus &status);
void remote_notice_new_inferior (ptid_t currthread, bool executing);
@@ -1077,8 +1089,8 @@ public: /* Remote specific methods. */
void discard_pending_stop_replies (struct inferior *inf);
int stop_reply_queue_length ();
- void check_pending_events_prevent_wildcard_vcont
- (bool *may_global_wildcard_vcont);
+ void check_pending_events_prevent_wildcard_vcont (
+ bool *may_global_wildcard_vcont);
void discard_pending_stop_replies_in_queue ();
struct stop_reply *remote_notif_remove_queued_reply (ptid_t ptid);
@@ -1105,15 +1117,15 @@ public: /* Remote specific methods. */
char *write_ptid (char *buf, const char *endbuf, ptid_t ptid);
- int remote_unpack_thread_info_response (const char *pkt, threadref *expectedref,
+ int remote_unpack_thread_info_response (const char *pkt,
+ threadref *expectedref,
gdb_ext_thread_info *info);
int remote_get_threadinfo (threadref *threadid, int fieldset,
gdb_ext_thread_info *info);
int parse_threadlist_response (const char *pkt, int result_limit,
threadref *original_echo,
- threadref *resultlist,
- int *doneflag);
+ threadref *resultlist, int *doneflag);
int remote_get_threadlist (int startflag, threadref *nextthread,
int result_limit, int *done, int *result_count,
threadref *threadlist);
@@ -1146,16 +1158,14 @@ public: /* Remote specific methods. */
void remote_vcont_probe ();
- void remote_resume_with_hc (ptid_t ptid, int step,
- gdb_signal siggnal);
+ void remote_resume_with_hc (ptid_t ptid, int step, gdb_signal siggnal);
void send_interrupt_sequence ();
void interrupt_query ();
void remote_notif_get_pending_events (const notif_client *nc);
- int fetch_register_using_p (struct regcache *regcache,
- packet_reg *reg);
+ int fetch_register_using_p (struct regcache *regcache, packet_reg *reg);
int send_g_packet ();
void process_g_packet (struct regcache *regcache);
void fetch_registers_using_g (struct regcache *regcache);
@@ -1167,22 +1177,19 @@ public: /* Remote specific methods. */
void check_binary_download (CORE_ADDR addr);
- target_xfer_status remote_write_bytes_aux (const char *header,
- CORE_ADDR memaddr,
- const gdb_byte *myaddr,
- ULONGEST len_units,
- int unit_size,
- ULONGEST *xfered_len_units,
- char packet_format,
- int use_length);
+ target_xfer_status
+ remote_write_bytes_aux (const char *header, CORE_ADDR memaddr,
+ const gdb_byte *myaddr, ULONGEST len_units,
+ int unit_size, ULONGEST *xfered_len_units,
+ char packet_format, int use_length);
target_xfer_status remote_write_bytes (CORE_ADDR memaddr,
const gdb_byte *myaddr, ULONGEST len,
int unit_size, ULONGEST *xfered_len);
target_xfer_status remote_read_bytes_1 (CORE_ADDR memaddr, gdb_byte *myaddr,
- ULONGEST len_units,
- int unit_size, ULONGEST *xfered_len_units);
+ ULONGEST len_units, int unit_size,
+ ULONGEST *xfered_len_units);
target_xfer_status remote_xfer_live_readonly_partial (gdb_byte *readbuf,
ULONGEST memaddr,
@@ -1190,16 +1197,15 @@ public: /* Remote specific methods. */
int unit_size,
ULONGEST *xfered_len);
- target_xfer_status remote_read_bytes (CORE_ADDR memaddr,
- gdb_byte *myaddr, ULONGEST len,
- int unit_size,
+ target_xfer_status remote_read_bytes (CORE_ADDR memaddr, gdb_byte *myaddr,
+ ULONGEST len, int unit_size,
ULONGEST *xfered_len);
packet_result remote_send_printf (const char *format, ...)
ATTRIBUTE_PRINTF (2, 3);
- target_xfer_status remote_flash_write (ULONGEST address,
- ULONGEST length, ULONGEST *xfered_len,
+ target_xfer_status remote_flash_write (ULONGEST address, ULONGEST length,
+ ULONGEST *xfered_len,
const gdb_byte *data);
int readchar (int timeout);
@@ -1209,10 +1215,7 @@ public: /* Remote specific methods. */
int putpkt (const char *buf);
int putpkt_binary (const char *buf, int cnt);
- int putpkt (const gdb::char_vector &buf)
- {
- return putpkt (buf.data ());
- }
+ int putpkt (const gdb::char_vector &buf) { return putpkt (buf.data ()); }
void skip_frame ();
long read_frame (gdb::char_vector *buf_p);
@@ -1220,32 +1223,27 @@ public: /* Remote specific methods. */
int getpkt_or_notif_sane_1 (gdb::char_vector *buf, int forever,
int expecting_notif, int *is_notif);
int getpkt_sane (gdb::char_vector *buf, int forever);
- int getpkt_or_notif_sane (gdb::char_vector *buf, int forever,
- int *is_notif);
+ int getpkt_or_notif_sane (gdb::char_vector *buf, int forever, int *is_notif);
int remote_vkill (int pid);
void remote_kill_k ();
void extended_remote_disable_randomization (int val);
int extended_remote_run (const std::string &args);
- void send_environment_packet (const char *action,
- const char *packet,
+ void send_environment_packet (const char *action, const char *packet,
const char *value);
void extended_remote_environment_support ();
void extended_remote_set_inferior_cwd ();
- target_xfer_status remote_write_qxfer (const char *object_name,
- const char *annex,
- const gdb_byte *writebuf,
- ULONGEST offset, LONGEST len,
- ULONGEST *xfered_len,
- const unsigned int which_packet);
+ target_xfer_status
+ remote_write_qxfer (const char *object_name, const char *annex,
+ const gdb_byte *writebuf, ULONGEST offset, LONGEST len,
+ ULONGEST *xfered_len, const unsigned int which_packet);
target_xfer_status remote_read_qxfer (const char *object_name,
- const char *annex,
- gdb_byte *readbuf, ULONGEST offset,
- LONGEST len,
+ const char *annex, gdb_byte *readbuf,
+ ULONGEST offset, LONGEST len,
ULONGEST *xfered_len,
const unsigned int which_packet);
@@ -1264,11 +1262,9 @@ private:
remote_state m_remote_state;
};
-static const target_info extended_remote_target_info = {
- "extended-remote",
- N_("Extended remote target using gdb-specific protocol"),
- remote_doc
-};
+static const target_info extended_remote_target_info
+ = { "extended-remote",
+ N_ ("Extended remote target using gdb-specific protocol"), remote_doc };
/* Set up the extended remote target by extending the standard remote
target and adding to it. */
@@ -1276,19 +1272,24 @@ static const target_info extended_remote_target_info = {
class extended_remote_target final : public remote_target
{
public:
+
const target_info &info () const override
- { return extended_remote_target_info; }
+ {
+ return extended_remote_target_info;
+ }
/* Open an extended-remote connection. */
static void open (const char *, int);
bool can_create_inferior () override { return true; }
- void create_inferior (const char *, const std::string &,
- char **, int) override;
+
+ void create_inferior (const char *, const std::string &, char **,
+ int) override;
void detach (inferior *, int) override;
bool can_attach () override { return true; }
+
void attach (const char *, int) override;
void post_attach (int) override;
@@ -1361,7 +1362,10 @@ static std::string remote_exec_file_var;
The alignment chosen is arbitrary; usually data bus width is
important here, not the possibly larger cache line size. */
-enum { REMOTE_ALIGN_WRITES = 16 };
+enum
+{
+ REMOTE_ALIGN_WRITES = 16
+};
/* Prototypes for local functions. */
@@ -1465,16 +1469,10 @@ struct remote_thread_info : public private_thread_info
CORE_ADDR watch_data_address = 0;
/* Get the thread's resume state. */
- enum resume_state get_resume_state () const
- {
- return m_resume_state;
- }
+ enum resume_state get_resume_state () const { return m_resume_state; }
/* Put the thread in the NOT_RESUMED state. */
- void set_not_resumed ()
- {
- m_resume_state = resume_state::NOT_RESUMED;
- }
+ void set_not_resumed () { m_resume_state = resume_state::NOT_RESUMED; }
/* Put the thread in the RESUMED_PENDING_VCONT state. */
void set_resumed_pending_vcont (bool step, gdb_signal sig)
@@ -1496,12 +1494,10 @@ struct remote_thread_info : public private_thread_info
}
/* Put the thread in the VCONT_RESUMED state. */
- void set_resumed ()
- {
- m_resume_state = resume_state::RESUMED;
- }
+ void set_resumed () { m_resume_state = resume_state::RESUMED; }
private:
+
/* Resume state for this thread. This is used to implement vCont action
coalescing (only when the target operates in non-stop mode).
@@ -1539,17 +1535,17 @@ static void
trace_error (char *buf)
{
if (*buf++ != 'E')
- return; /* not an error msg */
+ return; /* not an error msg */
switch (*buf)
{
- case '1': /* malformed packet error */
- if (*++buf == '0') /* general case: */
- error (_("remote.c: error in outgoing packet."));
+ case '1': /* malformed packet error */
+ if (*++buf == '0') /* general case: */
+ error (_ ("remote.c: error in outgoing packet."));
else
- error (_("remote.c: error in outgoing packet at field #%ld."),
+ error (_ ("remote.c: error in outgoing packet at field #%ld."),
strtol (buf, NULL, 16));
default:
- error (_("Target returns error code '%s'."), buf);
+ error (_ ("Target returns error code '%s'."), buf);
}
}
@@ -1560,11 +1556,11 @@ remote_target::remote_get_noisy_reply ()
{
struct remote_state *rs = get_remote_state ();
- do /* Loop on reply from remote stub. */
+ do /* Loop on reply from remote stub. */
{
char *buf;
- QUIT; /* Allow user to bail out with ^C. */
+ QUIT; /* Allow user to bail out with ^C. */
getpkt (&rs->buf, 0);
buf = rs->buf.data ();
if (buf[0] == 'E')
@@ -1580,7 +1576,7 @@ remote_target::remote_get_noisy_reply ()
p = buf + strlen ("qRelocInsn:");
pp = unpack_varlen_hex (p, &ul);
if (*pp != ';')
- error (_("invalid qRelocInsn packet: %s"), buf);
+ error (_ ("invalid qRelocInsn packet: %s"), buf);
from = ul;
p = pp + 1;
@@ -1609,7 +1605,7 @@ remote_target::remote_get_noisy_reply ()
to the stub, so it doesn't get stuck waiting for
a response. */
exception_fprintf (gdb_stderr, ex,
- _("warning: relocating instruction: "));
+ _ ("warning: relocating instruction: "));
}
putpkt ("E01");
}
@@ -1623,9 +1619,9 @@ remote_target::remote_get_noisy_reply ()
}
}
else if (buf[0] == 'O' && buf[1] != 'K')
- remote_console_output (buf + 1); /* 'O' message from stub */
+ remote_console_output (buf + 1); /* 'O' message from stub */
else
- return buf; /* Here's the actual reply. */
+ return buf; /* Here's the actual reply. */
}
while (1);
}
@@ -1738,15 +1734,15 @@ map_regcache_remote_table (struct gdbarch *gdbarch, struct packet_reg *regs)
number. */
remote_regs = XALLOCAVEC (struct packet_reg *, gdbarch_num_regs (gdbarch));
- for (num_remote_regs = 0, regnum = 0;
- regnum < gdbarch_num_regs (gdbarch);
+ for (num_remote_regs = 0, regnum = 0; regnum < gdbarch_num_regs (gdbarch);
regnum++)
if (regs[regnum].pnum != -1)
remote_regs[num_remote_regs++] = &regs[regnum];
std::sort (remote_regs, remote_regs + num_remote_regs,
- [] (const packet_reg *a, const packet_reg *b)
- { return a->pnum < b->pnum; });
+ [] (const packet_reg *a, const packet_reg *b) {
+ return a->pnum < b->pnum;
+ });
for (regnum = 0, offset = 0; regnum < num_remote_regs; regnum++)
{
@@ -1784,7 +1780,7 @@ remote_arch_state::remote_arch_state (struct gdbarch *gdbarch)
{
/* Use the architecture to build a regnum<->pnum table, which will be
1:1 unless a feature set specifies otherwise. */
- this->regs.reset (new packet_reg [gdbarch_num_regs (gdbarch)] ());
+ this->regs.reset (new packet_reg[gdbarch_num_regs (gdbarch)]());
/* Record the maximum possible size of the g packet - it may turn out
to be smaller. */
@@ -1878,36 +1874,28 @@ packet_reg_from_pnum (struct gdbarch *gdbarch, struct remote_arch_state *rsa,
const char interrupt_sequence_control_c[] = "Ctrl-C";
const char interrupt_sequence_break[] = "BREAK";
const char interrupt_sequence_break_g[] = "BREAK-g";
-static const char *const interrupt_sequence_modes[] =
- {
- interrupt_sequence_control_c,
- interrupt_sequence_break,
- interrupt_sequence_break_g,
- NULL
- };
+static const char *const interrupt_sequence_modes[]
+ = { interrupt_sequence_control_c, interrupt_sequence_break,
+ interrupt_sequence_break_g, NULL };
static const char *interrupt_sequence_mode = interrupt_sequence_control_c;
static void
show_interrupt_sequence (struct ui_file *file, int from_tty,
- struct cmd_list_element *c,
- const char *value)
+ struct cmd_list_element *c, const char *value)
{
if (interrupt_sequence_mode == interrupt_sequence_control_c)
- gdb_printf (file,
- _("Send the ASCII ETX character (Ctrl-c) "
- "to the remote target to interrupt the "
- "execution of the program.\n"));
+ gdb_printf (file, _ ("Send the ASCII ETX character (Ctrl-c) "
+ "to the remote target to interrupt the "
+ "execution of the program.\n"));
else if (interrupt_sequence_mode == interrupt_sequence_break)
- gdb_printf (file,
- _("send a break signal to the remote target "
- "to interrupt the execution of the program.\n"));
+ gdb_printf (file, _ ("send a break signal to the remote target "
+ "to interrupt the execution of the program.\n"));
else if (interrupt_sequence_mode == interrupt_sequence_break_g)
- gdb_printf (file,
- _("Send a break signal and 'g' a.k.a. Magic SysRq g to "
- "the remote target to interrupt the execution "
- "of Linux kernel.\n"));
+ gdb_printf (file, _ ("Send a break signal and 'g' a.k.a. Magic SysRq g to "
+ "the remote target to interrupt the execution "
+ "of Linux kernel.\n"));
else
- internal_error (_("Invalid value for interrupt_sequence_mode: %s."),
+ internal_error (_ ("Invalid value for interrupt_sequence_mode: %s."),
interrupt_sequence_mode);
}
@@ -1933,8 +1921,7 @@ set_remotebreak (const char *args, int from_tty, struct cmd_list_element *c)
static void
show_remotebreak (struct ui_file *file, int from_tty,
- struct cmd_list_element *c,
- const char *value)
+ struct cmd_list_element *c, const char *value)
{
}
@@ -1951,7 +1938,6 @@ show_remotebreak (struct ui_file *file, int from_tty,
static unsigned int remote_address_size;
-
/* The default max memory-write-packet-size, when the setting is
"fixed". The 16k is historical. (It came from older GDB's using
alloca for buffers and the knowledge (folklore?) that some hosts
@@ -1991,14 +1977,12 @@ remote_target::get_memory_packet_size (struct memory_packet_config *config)
{
what_they_get = get_remote_packet_size ();
/* Limit the packet to the size specified by the user. */
- if (config->size > 0
- && what_they_get > config->size)
+ if (config->size > 0 && what_they_get > config->size)
what_they_get = config->size;
/* Limit it to the size of the targets ``g'' response unless we have
permission from the stub to use a larger packet size. */
- if (rs->explicit_packet_size == 0
- && rsa->actual_register_packet_size > 0
+ if (rs->explicit_packet_size == 0 && rsa->actual_register_packet_size > 0
&& what_they_get > rsa->actual_register_packet_size)
what_they_get = rsa->actual_register_packet_size;
}
@@ -2024,12 +2008,10 @@ set_memory_packet_size (const char *args, struct memory_packet_config *config,
long size = config->size;
if (args == NULL)
- error (_("Argument required (integer, \"fixed\" or \"limit\")."));
- else if (strcmp (args, "hard") == 0
- || strcmp (args, "fixed") == 0)
+ error (_ ("Argument required (integer, \"fixed\" or \"limit\")."));
+ else if (strcmp (args, "hard") == 0 || strcmp (args, "fixed") == 0)
fixed_p = 1;
- else if (strcmp (args, "soft") == 0
- || strcmp (args, "limit") == 0)
+ else if (strcmp (args, "soft") == 0 || strcmp (args, "limit") == 0)
fixed_p = 0;
else
{
@@ -2037,7 +2019,7 @@ set_memory_packet_size (const char *args, struct memory_packet_config *config,
size = strtoul (args, &end, 0);
if (args == end)
- error (_("Invalid %s (bad syntax)."), config->name);
+ error (_ ("Invalid %s (bad syntax)."), config->name);
/* Instead of explicitly capping the size of a packet to or
disallowing it, the user is allowed to set the size to
@@ -2048,30 +2030,29 @@ set_memory_packet_size (const char *args, struct memory_packet_config *config,
if (fixed_p && !config->fixed_p)
{
/* So that the query shows the correct value. */
- long query_size = (size <= 0
- ? DEFAULT_MAX_MEMORY_PACKET_SIZE_FIXED
- : size);
+ long query_size
+ = (size <= 0 ? DEFAULT_MAX_MEMORY_PACKET_SIZE_FIXED : size);
if (target_connected
- && !query (_("The target may not be able to correctly handle a %s\n"
- "of %ld bytes. Change the packet size? "),
+ && !query (_ ("The target may not be able to correctly handle a %s\n"
+ "of %ld bytes. Change the packet size? "),
config->name, query_size))
- error (_("Packet size not changed."));
- else if (!target_connected
- && !query (_("Future remote targets may not be able to "
- "correctly handle a %s\nof %ld bytes. Change the "
- "packet size for future remote targets? "),
- config->name, query_size))
- error (_("Packet size not changed."));
+ error (_ ("Packet size not changed."));
+ else if (
+ !target_connected
+ && !query (_ ("Future remote targets may not be able to "
+ "correctly handle a %s\nof %ld bytes. Change the "
+ "packet size for future remote targets? "),
+ config->name, query_size))
+ error (_ ("Packet size not changed."));
}
/* Update the config. */
config->fixed_p = fixed_p;
config->size = size;
const char *target_type = get_target_type_name (target_connected);
- gdb_printf (_("The %s %s is set to \"%s\".\n"), config->name, target_type,
+ gdb_printf (_ ("The %s %s is set to \"%s\".\n"), config->name, target_type,
args);
-
}
/* Show the memory-read or write-packet size configuration CONFIG of the
@@ -2084,18 +2065,18 @@ show_memory_packet_size (memory_packet_config *config, remote_target *remote)
const char *target_type = get_target_type_name (remote != nullptr);
if (config->size == 0)
- gdb_printf (_("The %s %s is 0 (default). "), config->name, target_type);
+ gdb_printf (_ ("The %s %s is 0 (default). "), config->name, target_type);
else
- gdb_printf (_("The %s %s is %ld. "), config->name, target_type,
+ gdb_printf (_ ("The %s %s is %ld. "), config->name, target_type,
config->size);
if (config->fixed_p)
- gdb_printf (_("Packets are fixed at %ld bytes.\n"),
+ gdb_printf (_ ("Packets are fixed at %ld bytes.\n"),
get_fixed_memory_packet_size (config));
else
{
if (remote != nullptr)
- gdb_printf (_("Packets are limited to %ld bytes.\n"),
+ gdb_printf (_ ("Packets are limited to %ld bytes.\n"),
remote->get_memory_packet_size (config));
else
gdb_puts ("The actual limit will be further reduced "
@@ -2113,12 +2094,13 @@ set_memory_write_packet_size (const char *args, int from_tty)
remote_target *remote = get_current_remote_target ();
if (remote != nullptr)
{
- set_memory_packet_size
- (args, &remote->m_features.m_memory_write_packet_config, true);
+ set_memory_packet_size (args,
+ &remote->m_features.m_memory_write_packet_config,
+ true);
}
else
{
- memory_packet_config* config = &memory_write_packet_config;
+ memory_packet_config *config = &memory_write_packet_config;
set_memory_packet_size (args, config, false);
}
}
@@ -2142,11 +2124,12 @@ show_memory_write_packet_size (const char *args, int from_tty)
static void
show_hardware_watchpoint_limit (struct ui_file *file, int from_tty,
- struct cmd_list_element *c,
- const char *value)
+ struct cmd_list_element *c, const char *value)
{
- gdb_printf (file, _("The maximum number of target hardware "
- "watchpoints is %s.\n"), value);
+ gdb_printf (file,
+ _ ("The maximum number of target hardware "
+ "watchpoints is %s.\n"),
+ value);
}
/* Show the length limit (in bytes) for hardware watchpoints. */
@@ -2156,19 +2139,22 @@ show_hardware_watchpoint_length_limit (struct ui_file *file, int from_tty,
struct cmd_list_element *c,
const char *value)
{
- gdb_printf (file, _("The maximum length (in bytes) of a target "
- "hardware watchpoint is %s.\n"), value);
+ gdb_printf (file,
+ _ ("The maximum length (in bytes) of a target "
+ "hardware watchpoint is %s.\n"),
+ value);
}
/* Show the number of hardware breakpoints that can be used. */
static void
show_hardware_breakpoint_limit (struct ui_file *file, int from_tty,
- struct cmd_list_element *c,
- const char *value)
+ struct cmd_list_element *c, const char *value)
{
- gdb_printf (file, _("The maximum number of target hardware "
- "breakpoints is %s.\n"), value);
+ gdb_printf (file,
+ _ ("The maximum number of target hardware "
+ "breakpoints is %s.\n"),
+ value);
}
/* Controls the maximum number of characters to display in the debug output
@@ -2181,11 +2167,12 @@ static int remote_packet_max_chars = 512;
static void
show_remote_packet_max_chars (struct ui_file *file, int from_tty,
- struct cmd_list_element *c,
- const char *value)
+ struct cmd_list_element *c, const char *value)
{
- gdb_printf (file, _("Number of remote packet characters to "
- "display is %s.\n"), value);
+ gdb_printf (file,
+ _ ("Number of remote packet characters to "
+ "display is %s.\n"),
+ value);
}
long
@@ -2203,14 +2190,14 @@ set_memory_read_packet_size (const char *args, int from_tty)
{
remote_target *remote = get_current_remote_target ();
if (remote != nullptr)
- set_memory_packet_size
- (args, &remote->m_features.m_memory_read_packet_config, true);
+ set_memory_packet_size (args,
+ &remote->m_features.m_memory_read_packet_config,
+ true);
else
{
- memory_packet_config* config = &memory_read_packet_config;
+ memory_packet_config *config = &memory_read_packet_config;
set_memory_packet_size (args, config, false);
}
-
}
/* Display the memory-read-packet size of the currently selected target. If
@@ -2243,7 +2230,6 @@ remote_target::get_memory_read_packet_size ()
static enum packet_support packet_config_support (const packet_config *config);
-
static void
set_remote_protocol_packet_cmd (const char *args, int from_tty,
cmd_list_element *c)
@@ -2252,8 +2238,8 @@ set_remote_protocol_packet_cmd (const char *args, int from_tty,
gdb_assert (c->var.has_value ());
auto *default_config = static_cast<packet_config *> (c->context ());
- const int packet_idx = std::distance (remote_protocol_packets,
- default_config);
+ const int packet_idx
+ = std::distance (remote_protocol_packets, default_config);
if (packet_idx >= 0 && packet_idx < PACKET_MAX)
{
@@ -2267,12 +2253,12 @@ set_remote_protocol_packet_cmd (const char *args, int from_tty,
else
remote_protocol_packets[packet_idx].detect = value;
- gdb_printf (_("Support for the '%s' packet %s is set to \"%s\".\n"), name,
- target_type, support);
+ gdb_printf (_ ("Support for the '%s' packet %s is set to \"%s\".\n"),
+ name, target_type, support);
return;
}
- internal_error (_("Could not find config for %s"), c->name);
+ internal_error (_ ("Could not find config for %s"), c->name);
}
static void
@@ -2304,15 +2290,14 @@ show_packet_config_cmd (ui_file *file, const unsigned int which_packet,
{
case AUTO_BOOLEAN_AUTO:
gdb_printf (file,
- _("Support for the '%s' packet %s is \"auto\", "
- "currently %s.\n"),
+ _ ("Support for the '%s' packet %s is \"auto\", "
+ "currently %s.\n"),
packets_descriptions[which_packet].name, target_type,
support);
break;
case AUTO_BOOLEAN_TRUE:
case AUTO_BOOLEAN_FALSE:
- gdb_printf (file,
- _("Support for the '%s' packet %s is \"%s\".\n"),
+ gdb_printf (file, _ ("Support for the '%s' packet %s is \"%s\".\n"),
packets_descriptions[which_packet].name, target_type,
get_packet_support_name (config->detect));
break;
@@ -2329,8 +2314,7 @@ add_packet_config_cmd (const unsigned int which_packet, const char *name,
packet_config *config = &remote_protocol_packets[which_packet];
gdb::unique_xmalloc_ptr<char> set_doc
- = xstrprintf ("Set use of remote protocol `%s' (%s) packet.",
- name, title);
+ = xstrprintf ("Set use of remote protocol `%s' (%s) packet.", name, title);
gdb::unique_xmalloc_ptr<char> show_doc
= xstrprintf ("Show current use of remote protocol `%s' (%s) packet.",
name, title);
@@ -2370,8 +2354,7 @@ packet_check_result (const char *buf)
{
/* The stub recognized the packet request. Check that the
operation succeeded. */
- if (buf[0] == 'E'
- && isxdigit (buf[1]) && isxdigit (buf[2])
+ if (buf[0] == 'E' && isxdigit (buf[1]) && isxdigit (buf[2])
&& buf[3] == '\0')
/* "Enn" - definitely an error. */
return PACKET_ERROR;
@@ -2403,9 +2386,8 @@ remote_features::packet_ok (const char *buf, const int which_packet)
enum packet_result result;
- if (config->detect != AUTO_BOOLEAN_TRUE
- && config->support == PACKET_DISABLE)
- internal_error (_("packet_ok: attempt to use a disabled packet"));
+ if (config->detect != AUTO_BOOLEAN_TRUE && config->support == PACKET_DISABLE)
+ internal_error (_ ("packet_ok: attempt to use a disabled packet"));
result = packet_check_result (buf);
switch (result)
@@ -2415,8 +2397,8 @@ remote_features::packet_ok (const char *buf, const int which_packet)
/* The stub recognized the packet request. */
if (config->support == PACKET_SUPPORT_UNKNOWN)
{
- remote_debug_printf ("Packet %s (%s) is supported",
- descr->name, descr->title);
+ remote_debug_printf ("Packet %s (%s) is supported", descr->name,
+ descr->title);
config->support = PACKET_ENABLE;
}
break;
@@ -2427,13 +2409,13 @@ remote_features::packet_ok (const char *buf, const int which_packet)
{
/* If the stub previously indicated that the packet was
supported then there is a protocol error. */
- error (_("Protocol error: %s (%s) conflicting enabled responses."),
+ error (_ ("Protocol error: %s (%s) conflicting enabled responses."),
descr->name, descr->title);
}
else if (config->detect == AUTO_BOOLEAN_TRUE)
{
/* The user set it wrong. */
- error (_("Enabled packet %s (%s) not recognized by stub"),
+ error (_ ("Enabled packet %s (%s) not recognized by stub"),
descr->name, descr->title);
}
@@ -2447,7 +2429,8 @@ remote_features::packet_ok (const char *buf, const int which_packet)
}
packet_result
-remote_features::packet_ok (const gdb::char_vector &buf, const int which_packet)
+remote_features::packet_ok (const gdb::char_vector &buf,
+ const int which_packet)
{
return packet_ok (buf.data (), which_packet);
}
@@ -2481,22 +2464,21 @@ remote_features::packet_support (int packet) const
static void
show_remote_protocol_packet_cmd (struct ui_file *file, int from_tty,
- struct cmd_list_element *c,
- const char *value)
+ struct cmd_list_element *c, const char *value)
{
remote_target *remote = get_current_remote_target ();
gdb_assert (c->var.has_value ());
auto *default_config = static_cast<packet_config *> (c->context ());
- const int packet_idx = std::distance (remote_protocol_packets,
- default_config);
+ const int packet_idx
+ = std::distance (remote_protocol_packets, default_config);
if (packet_idx >= 0 && packet_idx < PACKET_MAX)
{
- show_packet_config_cmd (file, packet_idx, remote);
- return;
+ show_packet_config_cmd (file, packet_idx, remote);
+ return;
}
- internal_error (_("Could not find config for %s"), c->name);
+ internal_error (_ ("Could not find config for %s"), c->name);
}
/* Should we try one of the 'Z' requests? */
@@ -2534,9 +2516,8 @@ set_remote_protocol_Z_packet_cmd (const char *args, int from_tty,
const char *support = get_packet_support_name (remote_Z_packet_detect);
const char *target_type = get_target_type_name (remote != nullptr);
- gdb_printf (_("Use of Z packets %s is set to \"%s\".\n"), target_type,
+ gdb_printf (_ ("Use of Z packets %s is set to \"%s\".\n"), target_type,
support);
-
}
static void
@@ -2605,8 +2586,6 @@ remote_target::remove_exec_catchpoint (int pid)
return 0;
}
-
-
/* Take advantage of the fact that the TID field is not used, to tag
special ptids with it set to != 0. */
static const ptid_t magic_null_ptid (42000, -1, 1);
@@ -2640,7 +2619,7 @@ remote_target::remote_query_attached (int pid)
return 1;
break;
case PACKET_ERROR:
- warning (_("Remote failure reply: %s"), rs->buf.data ());
+ warning (_ ("Remote failure reply: %s"), rs->buf.data ());
break;
case PACKET_UNKNOWN:
break;
@@ -2797,8 +2776,7 @@ remote_target::remote_notice_new_inferior (ptid_t currthread, bool executing)
struct inferior *inf = NULL;
int pid = currthread.pid ();
- if (inferior_ptid.is_pid ()
- && pid == inferior_ptid.pid ())
+ if (inferior_ptid.is_pid () && pid == inferior_ptid.pid ())
{
/* inferior_ptid has no thread member yet. This can happen
with the vAttach -> remote_wait,"TAAthread:" path if the
@@ -2835,8 +2813,7 @@ remote_target::remote_notice_new_inferior (ptid_t currthread, bool executing)
{
bool fake_pid_p = !m_features.remote_multi_process_p ();
- inf = remote_add_inferior (fake_pid_p,
- currthread.pid (), -1, 1);
+ inf = remote_add_inferior (fake_pid_p, currthread.pid (), -1, 1);
}
/* This is really a new thread. Add it. */
@@ -2908,7 +2885,8 @@ remote_target::pass_signals (gdb::array_view<const unsigned char> pass_signals)
if (pass_signals[i])
count++;
}
- pass_packet = (char *) xmalloc (count * 3 + strlen ("QPassSignals:") + 1);
+ pass_packet
+ = (char *) xmalloc (count * 3 + strlen ("QPassSignals:") + 1);
strcpy (pass_packet, "QPassSignals:");
p = pass_packet + strlen (pass_packet);
for (size_t i = 0; i < pass_signals.size (); i++)
@@ -2943,8 +2921,9 @@ remote_target::pass_signals (gdb::array_view<const unsigned char> pass_signals)
to report syscalls to GDB. */
int
-remote_target::set_syscall_catchpoint (int pid, bool needed, int any_count,
- gdb::array_view<const int> syscall_counts)
+remote_target::set_syscall_catchpoint (
+ int pid, bool needed, int any_count,
+ gdb::array_view<const int> syscall_counts)
{
const char *catch_packet;
enum packet_result result;
@@ -2966,8 +2945,8 @@ remote_target::set_syscall_catchpoint (int pid, bool needed, int any_count,
}
}
- remote_debug_printf ("pid %d needed %d any_count %d n_sysno %d",
- pid, needed, any_count, n_sysno);
+ remote_debug_printf ("pid %d needed %d any_count %d n_sysno %d", pid, needed,
+ any_count, n_sysno);
std::string built_packet;
if (needed)
@@ -3129,7 +3108,6 @@ remote_target::set_general_process ()
set_general_thread (inferior_ptid);
}
-
/* Return nonzero if this is the main thread that we made up ourselves
to model non-threaded targets as single-threaded. */
@@ -3202,22 +3180,22 @@ remote_target::thread_name (struct thread_info *info)
/* Right now, the internal structure is int. We want it to be bigger.
Plan to fix this. */
-typedef int gdb_threadref; /* Internal GDB thread reference. */
+typedef int gdb_threadref; /* Internal GDB thread reference. */
/* gdb_ext_thread_info is an internal GDB data structure which is
equivalent to the reply of the remote threadinfo packet. */
struct gdb_ext_thread_info
- {
- threadref threadid; /* External form of thread reference. */
- int active; /* Has state interesting to GDB?
+{
+ threadref threadid; /* External form of thread reference. */
+ int active; /* Has state interesting to GDB?
regs, stack. */
- char display[256]; /* Brief state display, name,
+ char display[256]; /* Brief state display, name,
blocked/suspended. */
- char shortname[32]; /* To be used to name threads. */
- char more_display[256]; /* Long info, statistics, queue depth,
+ char shortname[32]; /* To be used to name threads. */
+ char more_display[256]; /* Long info, statistics, queue depth,
whatever. */
- };
+};
/* The volume of remote transfers can be limited by submitting
a mask containing bits specifying the desired information.
@@ -3254,16 +3232,13 @@ static void copy_threadref (threadref *dest, threadref *src);
static int threadmatch (threadref *dest, threadref *src);
-static char *pack_threadinfo_request (char *pkt, int mode,
- threadref *id);
+static char *pack_threadinfo_request (char *pkt, int mode, threadref *id);
static char *pack_threadlist_request (char *pkt, int startflag,
- int threadcount,
- threadref *nextthread);
+ int threadcount, threadref *nextthread);
static int remote_newthread_step (threadref *ref, void *context);
-
/* Write a PTID to BUF. ENDBUF points to one-passed-the-end of the
buffer we're allowed to write to. Returns
BUF+CHARACTERS_WRITTEN. */
@@ -3306,7 +3281,7 @@ read_ptid (const char *buf, const char **obuf)
/* Multi-process ptid. */
pp = unpack_varlen_hex (p + 1, &pid);
if (*pp != '.')
- error (_("invalid remote ptid: %s"), p);
+ error (_ ("invalid remote ptid: %s"), p);
p = pp;
pp = unpack_varlen_hex (p + 1, &tid);
@@ -3401,7 +3376,7 @@ unpack_int (const char *buf, int *value)
return buf + 8;
}
-#if 0 /* Currently unused, uncomment when needed. */
+#if 0 /* Currently unused, uncomment when needed. */
static char *pack_string (char *pkt, char *string);
static char *
@@ -3447,7 +3422,6 @@ pack_threadid (char *pkt, threadref *id)
return pkt;
}
-
static const char *
unpack_threadid (const char *inbuf, threadref *id)
{
@@ -3546,11 +3520,11 @@ threadmatch (threadref *dest, threadref *src)
static char *
pack_threadinfo_request (char *pkt, int mode, threadref *id)
{
- *pkt++ = 'q'; /* Info Query */
- *pkt++ = 'P'; /* process or thread info */
- pkt = pack_int (pkt, mode); /* mode */
- pkt = pack_threadid (pkt, id); /* threadid */
- *pkt = '\0'; /* terminate */
+ *pkt++ = 'q'; /* Info Query */
+ *pkt++ = 'P'; /* process or thread info */
+ pkt = pack_int (pkt, mode); /* mode */
+ pkt = pack_threadid (pkt, id); /* threadid */
+ *pkt = '\0'; /* terminate */
return pkt;
}
@@ -3558,12 +3532,14 @@ pack_threadinfo_request (char *pkt, int mode, threadref *id)
/* Tagging the fields allows us to request specific fields and to
add more fields as time goes by. */
-#define TAG_THREADID 1 /* Echo the thread identifier. */
-#define TAG_EXISTS 2 /* Is this process defined enough to
+#define TAG_THREADID 1 /* Echo the thread identifier. */
+#define TAG_EXISTS \
+ 2 /* Is this process defined enough to
fetch registers and its stack? */
-#define TAG_DISPLAY 4 /* A short thing maybe to put on a window */
-#define TAG_THREADNAME 8 /* string, maps 1-to-1 with a thread is. */
-#define TAG_MOREDISPLAY 16 /* Whatever the kernel wants to say about
+#define TAG_DISPLAY 4 /* A short thing maybe to put on a window */
+#define TAG_THREADNAME 8 /* string, maps 1-to-1 with a thread is. */
+#define TAG_MOREDISPLAY \
+ 16 /* Whatever the kernel wants to say about
the process. */
int
@@ -3586,14 +3562,14 @@ remote_target::remote_unpack_thread_info_response (const char *pkt,
/* Assume the characters indicating the packet type have been
stripped. */
- pkt = unpack_int (pkt, &mask); /* arg mask */
+ pkt = unpack_int (pkt, &mask); /* arg mask */
pkt = unpack_threadid (pkt, &ref);
if (mask == 0)
- warning (_("Incomplete response to threadinfo request."));
+ warning (_ ("Incomplete response to threadinfo request."));
if (!threadmatch (&ref, expectedref))
- { /* This is an answer to a different request. */
- warning (_("ERROR RMT Thread info mismatch."));
+ { /* This is an answer to a different request. */
+ warning (_ ("ERROR RMT Thread info mismatch."));
return 0;
}
copy_threadref (&info->threadid, &ref);
@@ -3604,10 +3580,10 @@ remote_target::remote_unpack_thread_info_response (const char *pkt,
while ((pkt < limit) && mask && *pkt)
{
pkt = unpack_int (pkt, &tag); /* tag */
- pkt = unpack_byte (pkt, &length); /* length */
+ pkt = unpack_byte (pkt, &length); /* length */
if (!(tag & mask)) /* Tags out of synch with mask. */
{
- warning (_("ERROR RMT: threadinfo tag mismatch."));
+ warning (_ ("ERROR RMT: threadinfo tag mismatch."));
retval = 0;
break;
}
@@ -3615,7 +3591,7 @@ remote_target::remote_unpack_thread_info_response (const char *pkt,
{
if (length != 16)
{
- warning (_("ERROR RMT: length of threadid is not 16."));
+ warning (_ ("ERROR RMT: length of threadid is not 16."));
retval = 0;
break;
}
@@ -3630,7 +3606,7 @@ remote_target::remote_unpack_thread_info_response (const char *pkt,
mask = mask & ~(TAG_EXISTS);
if (length > 8)
{
- warning (_("ERROR RMT: 'exists' length too long."));
+ warning (_ ("ERROR RMT: 'exists' length too long."));
retval = 0;
break;
}
@@ -3654,15 +3630,14 @@ remote_target::remote_unpack_thread_info_response (const char *pkt,
mask = mask & ~TAG_MOREDISPLAY;
continue;
}
- warning (_("ERROR RMT: unknown thread info tag."));
- break; /* Not a tag we know about. */
+ warning (_ ("ERROR RMT: unknown thread info tag."));
+ break; /* Not a tag we know about. */
}
return retval;
}
int
-remote_target::remote_get_threadinfo (threadref *threadid,
- int fieldset,
+remote_target::remote_get_threadinfo (threadref *threadid, int fieldset,
gdb_ext_thread_info *info)
{
struct remote_state *rs = get_remote_state ();
@@ -3675,8 +3650,7 @@ remote_target::remote_get_threadinfo (threadref *threadid,
if (rs->buf[0] == '\0')
return 0;
- result = remote_unpack_thread_info_response (&rs->buf[2],
- threadid, info);
+ result = remote_unpack_thread_info_response (&rs->buf[2], threadid, info);
return result;
}
@@ -3686,11 +3660,11 @@ static char *
pack_threadlist_request (char *pkt, int startflag, int threadcount,
threadref *nextthread)
{
- *pkt++ = 'q'; /* info query packet */
- *pkt++ = 'L'; /* Process LIST or threadLIST request */
- pkt = pack_nibble (pkt, startflag); /* initflag 1 bytes */
- pkt = pack_hex_byte (pkt, threadcount); /* threadcount 2 bytes */
- pkt = pack_threadid (pkt, nextthread); /* 64 bit thread identifier */
+ *pkt++ = 'q'; /* info query packet */
+ *pkt++ = 'L'; /* Process LIST or threadLIST request */
+ pkt = pack_nibble (pkt, startflag); /* initflag 1 bytes */
+ pkt = pack_hex_byte (pkt, threadcount); /* threadcount 2 bytes */
+ pkt = pack_threadid (pkt, nextthread); /* 64 bit thread identifier */
*pkt = '\0';
return pkt;
}
@@ -3700,8 +3674,7 @@ pack_threadlist_request (char *pkt, int startflag, int threadcount,
int
remote_target::parse_threadlist_response (const char *pkt, int result_limit,
threadref *original_echo,
- threadref *resultlist,
- int *doneflag)
+ threadref *resultlist, int *doneflag)
{
struct remote_state *rs = get_remote_state ();
int count, resultcount, done;
@@ -3710,10 +3683,10 @@ remote_target::parse_threadlist_response (const char *pkt, int result_limit,
/* Assume the 'q' and 'M chars have been stripped. */
const char *limit = pkt + (rs->buf.size () - BUF_THREAD_ID_SIZE);
/* done parse past here */
- pkt = unpack_byte (pkt, &count); /* count field */
+ pkt = unpack_byte (pkt, &count); /* count field */
pkt = unpack_nibble (pkt, &done);
/* The first threadid is the argument threadid. */
- pkt = unpack_threadid (pkt, original_echo); /* should match query packet */
+ pkt = unpack_threadid (pkt, original_echo); /* should match query packet */
while ((count-- > 0) && (pkt < limit))
{
pkt = unpack_threadid (pkt, resultlist++);
@@ -3730,8 +3703,8 @@ remote_target::parse_threadlist_response (const char *pkt, int result_limit,
int
remote_target::remote_get_threadlist (int startflag, threadref *nextthread,
- int result_limit, int *done, int *result_count,
- threadref *threadlist)
+ int result_limit, int *done,
+ int *result_count, threadref *threadlist)
{
struct remote_state *rs = get_remote_state ();
int result = 1;
@@ -3751,9 +3724,9 @@ remote_target::remote_get_threadlist (int startflag, threadref *nextthread,
return -1;
}
- *result_count =
- parse_threadlist_response (&rs->buf[2], result_limit,
- &rs->echo_nextthread, threadlist, done);
+ *result_count
+ = parse_threadlist_response (&rs->buf[2], result_limit,
+ &rs->echo_nextthread, threadlist, done);
if (!threadmatch (&rs->echo_nextthread, nextthread))
{
@@ -3765,22 +3738,22 @@ remote_target::remote_get_threadlist (int startflag, threadref *nextthread,
exit
wait for packet, then exit
*/
- warning (_("HMM: threadlist did not echo arg thread, dropping it."));
- return 0; /* I choose simply exiting. */
+ warning (_ ("HMM: threadlist did not echo arg thread, dropping it."));
+ return 0; /* I choose simply exiting. */
}
if (*result_count <= 0)
{
if (*done != 1)
{
- warning (_("RMT ERROR : failed to get remote thread list."));
+ warning (_ ("RMT ERROR : failed to get remote thread list."));
result = 0;
}
- return result; /* break; */
+ return result; /* break; */
}
if (*result_count > result_limit)
{
*result_count = 0;
- warning (_("RMT ERROR: threadlist response longer than requested."));
+ warning (_ ("RMT ERROR: threadlist response longer than requested."));
return 0;
}
return result;
@@ -3808,13 +3781,12 @@ remote_target::remote_threadlist_iterator (rmt_thread_action stepfunction,
if (loopcount++ > looplimit)
{
result = 0;
- warning (_("Remote fetch threadlist -infinite loop-."));
+ warning (_ ("Remote fetch threadlist -infinite loop-."));
break;
}
result = remote_get_threadlist (startflag, &rs->nextthread,
- MAXTHREADLISTRESULTS,
- &done, &result_count,
- rs->resultthreadlist);
+ MAXTHREADLISTRESULTS, &done,
+ &result_count, rs->resultthreadlist);
if (result <= 0)
break;
/* Clear for later iterations. */
@@ -3841,8 +3813,9 @@ remote_target::remote_threadlist_iterator (rmt_thread_action stepfunction,
struct thread_item
{
explicit thread_item (ptid_t ptid_)
- : ptid (ptid_)
- {}
+ : ptid (ptid_)
+ {
+ }
thread_item (thread_item &&other) = default;
thread_item &operator= (thread_item &&other) = default;
@@ -3876,14 +3849,11 @@ struct threads_listing_context
bool contains_thread (ptid_t ptid) const
{
- auto match_ptid = [&] (const thread_item &item)
- {
- return item.ptid == ptid;
- };
+ auto match_ptid
+ = [&] (const thread_item &item) { return item.ptid == ptid; };
- auto it = std::find_if (this->items.begin (),
- this->items.end (),
- match_ptid);
+ auto it
+ = std::find_if (this->items.begin (), this->items.end (), match_ptid);
return it != this->items.end ();
}
@@ -3892,14 +3862,11 @@ struct threads_listing_context
void remove_thread (ptid_t ptid)
{
- auto match_ptid = [&] (const thread_item &item)
- {
- return item.ptid == ptid;
- };
+ auto match_ptid
+ = [&] (const thread_item &item) { return item.ptid == ptid; };
- auto it = std::remove_if (this->items.begin (),
- this->items.end (),
- match_ptid);
+ auto it
+ = std::remove_if (this->items.begin (), this->items.end (), match_ptid);
if (it != this->items.end ())
this->items.erase (it);
@@ -3920,7 +3887,7 @@ remote_newthread_step (threadref *ref, void *data)
context->items.emplace_back (ptid);
- return 1; /* continue iterator */
+ return 1; /* continue iterator */
}
#define CRAZY_MAX_THREADS 1000
@@ -3953,7 +3920,8 @@ int
remote_target::remote_get_threads_with_ql (threads_listing_context *context)
{
if (remote_threadlist_iterator (remote_newthread_step, context,
- CRAZY_MAX_THREADS) >= 0)
+ CRAZY_MAX_THREADS)
+ >= 0)
return 1;
return 0;
@@ -3963,8 +3931,7 @@ remote_target::remote_get_threads_with_ql (threads_listing_context *context)
static void
start_thread (struct gdb_xml_parser *parser,
- const struct gdb_xml_element *element,
- void *user_data,
+ const struct gdb_xml_element *element, void *user_data,
std::vector<gdb_xml_value> &attributes)
{
struct threads_listing_context *data
@@ -3992,8 +3959,8 @@ start_thread (struct gdb_xml_parser *parser,
static void
end_thread (struct gdb_xml_parser *parser,
- const struct gdb_xml_element *element,
- void *user_data, const char *body_text)
+ const struct gdb_xml_element *element, void *user_data,
+ const char *body_text)
{
struct threads_listing_context *data
= (struct threads_listing_context *) user_data;
@@ -4002,30 +3969,25 @@ end_thread (struct gdb_xml_parser *parser,
data->items.back ().extra = body_text;
}
-const struct gdb_xml_attribute thread_attributes[] = {
- { "id", GDB_XML_AF_NONE, NULL, NULL },
- { "core", GDB_XML_AF_OPTIONAL, gdb_xml_parse_attr_ulongest, NULL },
- { "name", GDB_XML_AF_OPTIONAL, NULL, NULL },
- { "handle", GDB_XML_AF_OPTIONAL, NULL, NULL },
- { NULL, GDB_XML_AF_NONE, NULL, NULL }
-};
+const struct gdb_xml_attribute thread_attributes[]
+ = { { "id", GDB_XML_AF_NONE, NULL, NULL },
+ { "core", GDB_XML_AF_OPTIONAL, gdb_xml_parse_attr_ulongest, NULL },
+ { "name", GDB_XML_AF_OPTIONAL, NULL, NULL },
+ { "handle", GDB_XML_AF_OPTIONAL, NULL, NULL },
+ { NULL, GDB_XML_AF_NONE, NULL, NULL } };
-const struct gdb_xml_element thread_children[] = {
- { NULL, NULL, NULL, GDB_XML_EF_NONE, NULL, NULL }
-};
+const struct gdb_xml_element thread_children[]
+ = { { NULL, NULL, NULL, GDB_XML_EF_NONE, NULL, NULL } };
-const struct gdb_xml_element threads_children[] = {
- { "thread", thread_attributes, thread_children,
- GDB_XML_EF_REPEATABLE | GDB_XML_EF_OPTIONAL,
- start_thread, end_thread },
- { NULL, NULL, NULL, GDB_XML_EF_NONE, NULL, NULL }
-};
+const struct gdb_xml_element threads_children[]
+ = { { "thread", thread_attributes, thread_children,
+ GDB_XML_EF_REPEATABLE | GDB_XML_EF_OPTIONAL, start_thread,
+ end_thread },
+ { NULL, NULL, NULL, GDB_XML_EF_NONE, NULL, NULL } };
-const struct gdb_xml_element threads_elements[] = {
- { "threads", NULL, threads_children,
- GDB_XML_EF_NONE, NULL, NULL },
- { NULL, NULL, NULL, GDB_XML_EF_NONE, NULL, NULL }
-};
+const struct gdb_xml_element threads_elements[]
+ = { { "threads", NULL, threads_children, GDB_XML_EF_NONE, NULL, NULL },
+ { NULL, NULL, NULL, GDB_XML_EF_NONE, NULL, NULL } };
#endif
@@ -4042,8 +4004,8 @@ remote_target::remote_get_threads_with_qxfer (threads_listing_context *context)
if (xml && (*xml)[0] != '\0')
{
- gdb_xml_parse_quick (_("threads"), "threads.dtd",
- threads_elements, xml->data (), context);
+ gdb_xml_parse_quick (_ ("threads"), "threads.dtd", threads_elements,
+ xml->data (), context);
}
return 1;
@@ -4056,7 +4018,8 @@ remote_target::remote_get_threads_with_qxfer (threads_listing_context *context)
/* List remote threads using qfThreadInfo/qsThreadInfo. */
int
-remote_target::remote_get_threads_with_qthreadinfo (threads_listing_context *context)
+remote_target::remote_get_threads_with_qthreadinfo (
+ threads_listing_context *context)
{
struct remote_state *rs = get_remote_state ();
@@ -4067,16 +4030,16 @@ remote_target::remote_get_threads_with_qthreadinfo (threads_listing_context *con
putpkt ("qfThreadInfo");
getpkt (&rs->buf, 0);
bufp = rs->buf.data ();
- if (bufp[0] != '\0') /* q packet recognized */
+ if (bufp[0] != '\0') /* q packet recognized */
{
- while (*bufp++ == 'm') /* reply contains one or more TID */
+ while (*bufp++ == 'm') /* reply contains one or more TID */
{
do
{
ptid_t ptid = read_ptid (bufp, &bufp);
context->items.emplace_back (ptid);
}
- while (*bufp++ == ','); /* comma-separated list */
+ while (*bufp++ == ','); /* comma-separated list */
putpkt ("qsThreadInfo");
getpkt (&rs->buf, 0);
bufp = rs->buf.data ();
@@ -4123,8 +4086,7 @@ remote_target::update_thread_list ()
{
got_list = 1;
- if (context.items.empty ()
- && remote_thread_always_alive (inferior_ptid))
+ if (context.items.empty () && remote_thread_always_alive (inferior_ptid))
{
/* Some targets don't really support threads, but still
reply an (empty) thread list in response to the thread
@@ -4212,8 +4174,8 @@ remote_target::extra_thread_info (thread_info *tp)
threadref id;
struct gdb_ext_thread_info threadinfo;
- if (rs->remote_desc == 0) /* paranoia */
- internal_error (_("remote_threads_extra_info"));
+ if (rs->remote_desc == 0) /* paranoia */
+ internal_error (_ ("remote_threads_extra_info"));
if (tp->ptid == magic_null_ptid
|| (tp->ptid.pid () != 0 && tp->ptid.lwp () == 0))
@@ -4256,8 +4218,8 @@ remote_target::extra_thread_info (thread_info *tp)
/* If the above query fails, fall back to the old method. */
rs->use_threadextra_query = 0;
- set = TAG_THREADID | TAG_EXISTS | TAG_THREADNAME
- | TAG_MOREDISPLAY | TAG_DISPLAY;
+ set = TAG_THREADID | TAG_EXISTS | TAG_THREADNAME | TAG_MOREDISPLAY
+ | TAG_DISPLAY;
int_to_threadref (&id, tp->ptid.lwp ());
if (remote_get_threadinfo (&id, set, &threadinfo))
if (threadinfo.active)
@@ -4280,11 +4242,10 @@ remote_target::extra_thread_info (thread_info *tp)
}
return NULL;
}
-
bool
-remote_target::static_tracepoint_marker_at (CORE_ADDR addr,
- struct static_tracepoint_marker *marker)
+remote_target::static_tracepoint_marker_at (
+ CORE_ADDR addr, struct static_tracepoint_marker *marker)
{
struct remote_state *rs = get_remote_state ();
char *p = rs->buf.data ();
@@ -4297,7 +4258,7 @@ remote_target::static_tracepoint_marker_at (CORE_ADDR addr,
p = rs->buf.data ();
if (*p == 'E')
- error (_("Remote failure reply: %s"), p);
+ error (_ ("Remote failure reply: %s"), p);
if (*p++ == 'm')
{
@@ -4322,7 +4283,7 @@ remote_target::static_tracepoint_markers_by_strid (const char *strid)
getpkt (&rs->buf, 0);
p = rs->buf.data ();
if (*p == 'E')
- error (_("Remote failure reply: %s"), p);
+ error (_ ("Remote failure reply: %s"), p);
while (*p++ == 'm')
{
@@ -4333,7 +4294,7 @@ remote_target::static_tracepoint_markers_by_strid (const char *strid)
if (strid == NULL || marker.str_id == strid)
markers.push_back (std::move (marker));
}
- while (*p++ == ','); /* comma-separated list */
+ while (*p++ == ','); /* comma-separated list */
/* Ask for another packet of static tracepoint definition. */
putpkt ("qTsSTM");
getpkt (&rs->buf, 0);
@@ -4343,7 +4304,6 @@ remote_target::static_tracepoint_markers_by_strid (const char *strid)
return markers;
}
-
/* Implement the to_get_ada_task_ptid function for the remote targets. */
ptid_t
@@ -4351,7 +4311,6 @@ remote_target::get_ada_task_ptid (long lwp, ULONGEST thread)
{
return ptid_t (inferior_ptid.pid (), lwp);
}
-
/* Restart the remote side; this is an extended protocol operation. */
@@ -4367,7 +4326,7 @@ remote_target::extended_remote_restart ()
remote_fileio_reset ();
}
-
+
/* Clean up connection to a remote debugger. */
void
@@ -4421,11 +4380,11 @@ remote_target::get_offsets ()
buf = rs->buf.data ();
if (buf[0] == '\000')
- return; /* Return silently. Stub doesn't support
+ return; /* Return silently. Stub doesn't support
this command. */
if (buf[0] == 'E')
{
- warning (_("Remote failure reply: %s"), buf);
+ warning (_ ("Remote failure reply: %s"), buf);
return;
}
@@ -4460,7 +4419,7 @@ remote_target::get_offsets ()
bss_addr = (bss_addr << 4) + fromhex (*ptr++);
if (bss_addr != data_addr)
- warning (_("Target reported unsupported offsets: %s"), buf);
+ warning (_ ("Target reported unsupported offsets: %s"), buf);
}
else
lose = 1;
@@ -4485,9 +4444,9 @@ remote_target::get_offsets ()
lose = 1;
if (lose)
- error (_("Malformed response to offset query, %s"), buf);
+ error (_ ("Malformed response to offset query, %s"), buf);
else if (*ptr != '\0')
- warning (_("Target reported unsupported offsets: %s"), buf);
+ warning (_ ("Target reported unsupported offsets: %s"), buf);
objfile *objf = current_program_space->symfile_object_file;
section_offsets offs = objf->section_offsets;
@@ -4527,13 +4486,13 @@ remote_target::get_offsets ()
if (do_segments)
{
- int ret = symfile_map_offsets_to_segments (objf->obfd.get (),
- data.get (), offs,
- num_segments, segments);
+ int ret
+ = symfile_map_offsets_to_segments (objf->obfd.get (), data.get (),
+ offs, num_segments, segments);
if (ret == 0 && !do_sections)
- error (_("Can not handle qOffsets TextSeg "
- "response with this symbol file"));
+ error (_ ("Can not handle qOffsets TextSeg "
+ "response with this symbol file"));
if (ret > 0)
do_sections = 0;
@@ -4572,11 +4531,10 @@ remote_target::send_interrupt_sequence ()
remote_serial_write ("g", 1);
}
else
- internal_error (_("Invalid value for interrupt_sequence_mode: %s."),
+ internal_error (_ ("Invalid value for interrupt_sequence_mode: %s."),
interrupt_sequence_mode);
}
-
/* If STOP_REPLY is a T stop reply, look for the "thread" register,
and extract the PTID. Returns NULL_PTID if not found. */
@@ -4785,8 +4743,7 @@ remote_target::process_initial_stop_replies (int from_tty)
ws.set_stopped (sig);
}
- if (ws.kind () != TARGET_WAITKIND_STOPPED
- || ws.sig () != GDB_SIGNAL_0)
+ if (ws.kind () != TARGET_WAITKIND_STOPPED || ws.sig () != GDB_SIGNAL_0)
evthread->set_pending_waitstatus (ws);
set_executing (this, event_ptid, false);
@@ -4818,7 +4775,10 @@ remote_target::process_initial_stop_replies (int from_tty)
the poll in stop_all_threads to consider events from it, so enable
it temporarily. */
gdb_assert (!this->is_async_p ());
- SCOPE_EXIT { target_async (false); };
+ SCOPE_EXIT
+ {
+ target_async (false);
+ };
target_async (true);
stop_all_threads ("remote connect in all-stop");
}
@@ -4852,8 +4812,7 @@ remote_target::process_initial_stop_replies (int from_tty)
if (selected == nullptr && thread->has_pending_waitstatus ())
selected = thread;
- if (lowest_stopped == NULL
- || thread->inf->num < lowest_stopped->inf->num
+ if (lowest_stopped == NULL || thread->inf->num < lowest_stopped->inf->num
|| thread->per_inf_num < lowest_stopped->per_inf_num)
lowest_stopped = thread;
@@ -4887,15 +4846,15 @@ struct scoped_mark_target_starting
scoped_mark_target_starting (remote_target *target)
: m_remote_target (remote_target_ref::new_reference (target)),
m_restore_starting_up (set_starting_up_flag (target))
- { /* Nothing. */ }
+ { /* Nothing. */
+ }
private:
/* Helper function, set the starting_up flag on TARGET and return an
object which, when it goes out of scope, will restore the previous
value of the starting_up flag. */
- static scoped_restore_tmpl<bool>
- set_starting_up_flag (remote_target *target)
+ static scoped_restore_tmpl<bool> set_starting_up_flag (remote_target *target)
{
remote_state *rs = target->get_remote_state ();
gdb_assert (!rs->starting_up);
@@ -4972,7 +4931,7 @@ remote_target::start_remote_1 (int from_tty, int extended_p)
= PACKET_DISABLE;
}
else if (strcmp (rs->buf.data (), "") != 0)
- error (_("Remote replied unexpectedly to '%s': %s"), v_mustreplyempty,
+ error (_ ("Remote replied unexpectedly to '%s': %s"), v_mustreplyempty,
rs->buf.data ());
}
@@ -5024,14 +4983,14 @@ remote_target::start_remote_1 (int from_tty, int extended_p)
if (target_is_non_stop_p ())
{
if (m_features.packet_support (PACKET_QNonStop) != PACKET_ENABLE)
- error (_("Non-stop mode requested, but remote "
- "does not support non-stop"));
+ error (_ ("Non-stop mode requested, but remote "
+ "does not support non-stop"));
putpkt ("QNonStop:1");
getpkt (&rs->buf, 0);
if (strcmp (rs->buf.data (), "OK") != 0)
- error (_("Remote refused setting non-stop mode with: %s"),
+ error (_ ("Remote refused setting non-stop mode with: %s"),
rs->buf.data ());
/* Find about threads and processes the stub is already
@@ -5048,7 +5007,7 @@ remote_target::start_remote_1 (int from_tty, int extended_p)
getpkt (&rs->buf, 0);
if (strcmp (rs->buf.data (), "OK") != 0)
- error (_("Remote refused setting all-stop mode with: %s"),
+ error (_ ("Remote refused setting all-stop mode with: %s"),
rs->buf.data ());
}
@@ -5074,7 +5033,7 @@ remote_target::start_remote_1 (int from_tty, int extended_p)
if (rs->buf[0] == 'W' || rs->buf[0] == 'X')
{
if (!extended_p)
- error (_("The target is not running (try extended-remote?)"));
+ error (_ ("The target is not running (try extended-remote?)"));
return false;
}
else
@@ -5115,8 +5074,8 @@ remote_target::start_remote_1 (int from_tty, int extended_p)
remote_debug_printf ("warning: couldn't determine remote "
"current thread; picking first in list.");
- for (thread_info *tp : all_non_exited_threads (this,
- minus_one_ptid))
+ for (thread_info *tp :
+ all_non_exited_threads (this, minus_one_ptid))
{
switch_to_thread (tp);
break;
@@ -5137,7 +5096,7 @@ remote_target::start_remote_1 (int from_tty, int extended_p)
manipulation. */
init_wait_for_inferior ();
- get_offsets (); /* Get text, data & bss offsets. */
+ get_offsets (); /* Get text, data & bss offsets. */
/* If we could not find a description using qXfer, and we know
how to do it some other way, try again. This is not
@@ -5186,7 +5145,7 @@ remote_target::start_remote_1 (int from_tty, int extended_p)
if (thread_count (this) == 0)
{
if (!extended_p)
- error (_("The target is not running (try extended-remote?)"));
+ error (_ ("The target is not running (try extended-remote?)"));
return false;
}
@@ -5228,7 +5187,7 @@ remote_target::start_remote_1 (int from_tty, int extended_p)
struct uploaded_tp *uploaded_tps = NULL;
if (current_trace_status ()->running)
- gdb_printf (_("Trace is already running on the target.\n"));
+ gdb_printf (_ ("Trace is already running on the target.\n"));
upload_tracepoints (&uploaded_tps);
@@ -5340,7 +5299,7 @@ remote_target::remote_check_symbols ()
struct bound_minimal_symbol sym;
tmp = &reply[8];
- end = hex2bin (tmp, reinterpret_cast <gdb_byte *> (msg.data ()),
+ end = hex2bin (tmp, reinterpret_cast<gdb_byte *> (msg.data ()),
strlen (tmp) / 2);
msg[end] = '\0';
sym = lookup_minimal_symbol (msg.data (), NULL, NULL);
@@ -5354,8 +5313,8 @@ remote_target::remote_check_symbols ()
/* If this is a function address, return the start of code
instead of any data function descriptor. */
- sym_addr = gdbarch_convert_from_func_ptr_addr
- (target_gdbarch (), sym_addr, current_inferior ()->top_target ());
+ sym_addr = gdbarch_convert_from_func_ptr_addr (
+ target_gdbarch (), sym_addr, current_inferior ()->top_target ());
xsnprintf (msg.data (), get_remote_packet_size (), "qSymbol:%s:%s",
phex_nz (sym_addr, addr_size), &reply[8]);
@@ -5377,9 +5336,9 @@ remote_serial_open (const char *name)
to be. */
if (!udp_warning && startswith (name, "udp:"))
{
- warning (_("The remote protocol may be unreliable over UDP.\n"
- "Some events may be lost, rendering further debugging "
- "impossible."));
+ warning (_ ("The remote protocol may be unreliable over UDP.\n"
+ "Some events may be lost, rendering further debugging "
+ "impossible."));
udp_warning = 1;
}
@@ -5400,20 +5359,20 @@ remote_target::set_permissions ()
{
struct remote_state *rs = get_remote_state ();
- xsnprintf (rs->buf.data (), get_remote_packet_size (), "QAllow:"
+ xsnprintf (rs->buf.data (), get_remote_packet_size (),
+ "QAllow:"
"WriteReg:%x;WriteMem:%x;"
"InsertBreak:%x;InsertTrace:%x;"
"InsertFastTrace:%x;Stop:%x",
- may_write_registers, may_write_memory,
- may_insert_breakpoints, may_insert_tracepoints,
- may_insert_fast_tracepoints, may_stop);
+ may_write_registers, may_write_memory, may_insert_breakpoints,
+ may_insert_tracepoints, may_insert_fast_tracepoints, may_stop);
putpkt (rs->buf);
getpkt (&rs->buf, 0);
/* If the target didn't like the packet, warn the user. Do not try
to undo the user's settings, that would just be maddening. */
if (strcmp (rs->buf.data (), "OK") != 0)
- warning (_("Remote refused setting permissions with: %s"),
+ warning (_ ("Remote refused setting permissions with: %s"),
rs->buf.data ());
}
@@ -5447,13 +5406,13 @@ struct protocol_feature
static void
remote_supported_packet (remote_target *remote,
const struct protocol_feature *feature,
- enum packet_support support,
- const char *argument)
+ enum packet_support support, const char *argument)
{
if (argument)
{
- warning (_("Remote qSupported response supplied an unexpected value for"
- " \"%s\"."), feature->name);
+ warning (_ ("Remote qSupported response supplied an unexpected value for"
+ " \"%s\"."),
+ feature->name);
return;
}
@@ -5462,7 +5421,8 @@ remote_supported_packet (remote_target *remote,
void
remote_target::remote_packet_size (const protocol_feature *feature,
- enum packet_support support, const char *value)
+ enum packet_support support,
+ const char *value)
{
struct remote_state *rs = get_remote_state ();
@@ -5474,7 +5434,7 @@ remote_target::remote_packet_size (const protocol_feature *feature,
if (value == NULL || *value == '\0')
{
- warning (_("Remote target reported \"%s\" without a size."),
+ warning (_ ("Remote target reported \"%s\" without a size."),
feature->name);
return;
}
@@ -5483,7 +5443,7 @@ remote_target::remote_packet_size (const protocol_feature *feature,
packet_size = strtol (value, &value_end, 16);
if (errno != 0 || *value_end != '\0' || packet_size < 0)
{
- warning (_("Remote target reported \"%s\" with a bad size: \"%s\"."),
+ warning (_ ("Remote target reported \"%s\" with a bad size: \"%s\"."),
feature->name, value);
return;
}
@@ -5511,8 +5471,8 @@ static const struct protocol_feature remote_protocol_features[] = {
PACKET_qXfer_libraries },
{ "qXfer:libraries-svr4:read", PACKET_DISABLE, remote_supported_packet,
PACKET_qXfer_libraries_svr4 },
- { "augmented-libraries-svr4-read", PACKET_DISABLE,
- remote_supported_packet, PACKET_augmented_libraries_svr4_read_feature },
+ { "augmented-libraries-svr4-read", PACKET_DISABLE, remote_supported_packet,
+ PACKET_augmented_libraries_svr4_read_feature },
{ "qXfer:memory-map:read", PACKET_DISABLE, remote_supported_packet,
PACKET_qXfer_memory_map },
{ "qXfer:osdata:read", PACKET_DISABLE, remote_supported_packet,
@@ -5556,18 +5516,15 @@ static const struct protocol_feature remote_protocol_features[] = {
PACKET_FastTracepoints },
{ "StaticTracepoints", PACKET_DISABLE, remote_supported_packet,
PACKET_StaticTracepoints },
- {"InstallInTrace", PACKET_DISABLE, remote_supported_packet,
- PACKET_InstallInTrace},
+ { "InstallInTrace", PACKET_DISABLE, remote_supported_packet,
+ PACKET_InstallInTrace },
{ "DisconnectedTracing", PACKET_DISABLE, remote_supported_packet,
PACKET_DisconnectedTracing_feature },
- { "ReverseContinue", PACKET_DISABLE, remote_supported_packet,
- PACKET_bc },
- { "ReverseStep", PACKET_DISABLE, remote_supported_packet,
- PACKET_bs },
+ { "ReverseContinue", PACKET_DISABLE, remote_supported_packet, PACKET_bc },
+ { "ReverseStep", PACKET_DISABLE, remote_supported_packet, PACKET_bs },
{ "TracepointSource", PACKET_DISABLE, remote_supported_packet,
PACKET_TracepointSource },
- { "QAllow", PACKET_DISABLE, remote_supported_packet,
- PACKET_QAllow },
+ { "QAllow", PACKET_DISABLE, remote_supported_packet, PACKET_QAllow },
{ "EnableDisableTracepoints", PACKET_DISABLE, remote_supported_packet,
PACKET_EnableDisableTracepoints_feature },
{ "qXfer:fdpic:read", PACKET_DISABLE, remote_supported_packet,
@@ -5576,12 +5533,15 @@ static const struct protocol_feature remote_protocol_features[] = {
PACKET_qXfer_uib },
{ "QDisableRandomization", PACKET_DISABLE, remote_supported_packet,
PACKET_QDisableRandomization },
- { "QAgent", PACKET_DISABLE, remote_supported_packet, PACKET_QAgent},
- { "QTBuffer:size", PACKET_DISABLE,
- remote_supported_packet, PACKET_QTBuffer_size},
- { "tracenz", PACKET_DISABLE, remote_supported_packet, PACKET_tracenz_feature },
- { "Qbtrace:off", PACKET_DISABLE, remote_supported_packet, PACKET_Qbtrace_off },
- { "Qbtrace:bts", PACKET_DISABLE, remote_supported_packet, PACKET_Qbtrace_bts },
+ { "QAgent", PACKET_DISABLE, remote_supported_packet, PACKET_QAgent },
+ { "QTBuffer:size", PACKET_DISABLE, remote_supported_packet,
+ PACKET_QTBuffer_size },
+ { "tracenz", PACKET_DISABLE, remote_supported_packet,
+ PACKET_tracenz_feature },
+ { "Qbtrace:off", PACKET_DISABLE, remote_supported_packet,
+ PACKET_Qbtrace_off },
+ { "Qbtrace:bts", PACKET_DISABLE, remote_supported_packet,
+ PACKET_Qbtrace_bts },
{ "Qbtrace:pt", PACKET_DISABLE, remote_supported_packet, PACKET_Qbtrace_pt },
{ "qXfer:btrace:read", PACKET_DISABLE, remote_supported_packet,
PACKET_qXfer_btrace },
@@ -5589,8 +5549,10 @@ static const struct protocol_feature remote_protocol_features[] = {
PACKET_qXfer_btrace_conf },
{ "Qbtrace-conf:bts:size", PACKET_DISABLE, remote_supported_packet,
PACKET_Qbtrace_conf_bts_size },
- { "swbreak", PACKET_DISABLE, remote_supported_packet, PACKET_swbreak_feature },
- { "hwbreak", PACKET_DISABLE, remote_supported_packet, PACKET_hwbreak_feature },
+ { "swbreak", PACKET_DISABLE, remote_supported_packet,
+ PACKET_swbreak_feature },
+ { "hwbreak", PACKET_DISABLE, remote_supported_packet,
+ PACKET_hwbreak_feature },
{ "fork-events", PACKET_DISABLE, remote_supported_packet,
PACKET_fork_event_feature },
{ "vfork-events", PACKET_DISABLE, remote_supported_packet,
@@ -5599,8 +5561,10 @@ static const struct protocol_feature remote_protocol_features[] = {
PACKET_exec_event_feature },
{ "Qbtrace-conf:pt:size", PACKET_DISABLE, remote_supported_packet,
PACKET_Qbtrace_conf_pt_size },
- { "vContSupported", PACKET_DISABLE, remote_supported_packet, PACKET_vContSupported },
- { "QThreadEvents", PACKET_DISABLE, remote_supported_packet, PACKET_QThreadEvents },
+ { "vContSupported", PACKET_DISABLE, remote_supported_packet,
+ PACKET_vContSupported },
+ { "QThreadEvents", PACKET_DISABLE, remote_supported_packet,
+ PACKET_QThreadEvents },
{ "no-resumed", PACKET_DISABLE, remote_supported_packet, PACKET_no_resumed },
{ "memory-tagging", PACKET_DISABLE, remote_supported_packet,
PACKET_memory_tagging_feature },
@@ -5634,9 +5598,8 @@ register_remote_support_xml (const char *xml)
while ((p = strtok_r (NULL, ",", &saveptr)) != NULL);
xfree (copy);
- remote_support_xml = reconcat (remote_support_xml,
- remote_support_xml, ",", xml,
- (char *) NULL);
+ remote_support_xml = reconcat (remote_support_xml, remote_support_xml,
+ ",", xml, (char *) NULL);
}
#endif
}
@@ -5655,7 +5618,7 @@ remote_target::remote_query_supported ()
struct remote_state *rs = get_remote_state ();
char *next;
int i;
- unsigned char seen [ARRAY_SIZE (remote_protocol_features)];
+ unsigned char seen[ARRAY_SIZE (remote_protocol_features)];
/* The packet support flags are handled differently for this packet
than for most others. We treat an error, a disabled packet, and
@@ -5727,7 +5690,7 @@ remote_target::remote_query_supported ()
buffer to empty and go on to disable features. */
if (m_features.packet_ok (rs->buf, PACKET_qSupported) == PACKET_ERROR)
{
- warning (_("Remote failure reply: %s"), rs->buf.data ());
+ warning (_ ("Remote failure reply: %s"), rs->buf.data ());
rs->buf[0] = 0;
}
}
@@ -5757,7 +5720,7 @@ remote_target::remote_query_supported ()
if (end == p)
{
- warning (_("empty item in \"qSupported\" response"));
+ warning (_ ("empty item in \"qSupported\" response"));
continue;
}
}
@@ -5788,8 +5751,9 @@ remote_target::remote_query_supported ()
break;
default:
- warning (_("unrecognized item \"%s\" "
- "in \"qSupported\" response"), p);
+ warning (_ ("unrecognized item \"%s\" "
+ "in \"qSupported\" response"),
+ p);
continue;
}
end[-1] = '\0';
@@ -5861,8 +5825,8 @@ remote_target::remote_serial_quit_handler ()
quit ();
else if (rs->got_ctrlc_during_io)
{
- if (query (_("The target is not responding to GDB commands.\n"
- "Stop debugging it? ")))
+ if (query (_ ("The target is not responding to GDB commands.\n"
+ "Stop debugging it? ")))
remote_unpush_and_throw (this);
}
/* If ^C has already been sent once, offer to disconnect. */
@@ -5919,7 +5883,7 @@ static void
remote_unpush_and_throw (remote_target *target)
{
remote_unpush_target (target);
- throw_error (TARGET_CLOSE_ERROR, _("Disconnected from target."));
+ throw_error (TARGET_CLOSE_ERROR, _ ("Disconnected from target."));
}
void
@@ -5928,18 +5892,19 @@ remote_target::open_1 (const char *name, int from_tty, int extended_p)
remote_target *curr_remote = get_current_remote_target ();
if (name == 0)
- error (_("To open a remote debug connection, you need to specify what\n"
- "serial device is attached to the remote system\n"
- "(e.g. /dev/ttyS0, /dev/ttya, COM1, etc.)."));
+ error (_ ("To open a remote debug connection, you need to specify what\n"
+ "serial device is attached to the remote system\n"
+ "(e.g. /dev/ttyS0, /dev/ttya, COM1, etc.)."));
/* If we're connected to a running target, target_preopen will kill it.
Ask this question first, before target_preopen has a chance to kill
anything. */
if (curr_remote != NULL && !target_has_execution ())
{
- if (from_tty
- && !query (_("Already connected to a remote target. Disconnect? ")))
- error (_("Still connected."));
+ if (
+ from_tty
+ && !query (_ ("Already connected to a remote target. Disconnect? ")))
+ error (_ ("Still connected."));
}
/* Here the possibly existing remote target gets unpushed. */
@@ -6053,7 +6018,6 @@ remote_target::open_1 (const char *name, int from_tty, int extended_p)
all the ``target ....'' commands to share a common callback
function. See cli-dump.c. */
{
-
try
{
remote->start_remote (from_tty, extended_p);
@@ -6079,8 +6043,7 @@ remote_target::open_1 (const char *name, int from_tty, int extended_p)
static bool
is_fork_status (target_waitkind kind)
{
- return (kind == TARGET_WAITKIND_FORKED
- || kind == TARGET_WAITKIND_VFORKED);
+ return (kind == TARGET_WAITKIND_FORKED || kind == TARGET_WAITKIND_VFORKED);
}
/* Return THREAD's pending status if it is a pending fork parent, else
@@ -6090,9 +6053,8 @@ static const target_waitstatus *
thread_pending_fork_status (struct thread_info *thread)
{
const target_waitstatus &ws
- = (thread->has_pending_waitstatus ()
- ? thread->pending_waitstatus ()
- : thread->pending_follow);
+ = (thread->has_pending_waitstatus () ? thread->pending_waitstatus ()
+ : thread->pending_follow);
if (!is_fork_status (ws.kind ()))
return nullptr;
@@ -6126,9 +6088,9 @@ remote_target::remote_detach_pid (int pid)
if (rs->buf[0] == 'O' && rs->buf[1] == 'K')
;
else if (rs->buf[0] == '\0')
- error (_("Remote doesn't know how to detach"));
+ error (_ ("Remote doesn't know how to detach"));
else
- error (_("Can't detach process."));
+ error (_ ("Can't detach process."));
}
/* This detaches a program to which we previously attached, using
@@ -6145,7 +6107,7 @@ remote_target::remote_detach_1 (inferior *inf, int from_tty)
int is_fork_parent;
if (!target_has_execution ())
- error (_("No process to detach from."));
+ error (_ ("No process to detach from."));
target_announce_detach (from_tty);
@@ -6164,7 +6126,7 @@ remote_target::remote_detach_1 (inferior *inf, int from_tty)
/* Exit only if this is the only active inferior. */
if (from_tty && !rs->extended && number_of_live_inferiors (this) == 1)
- gdb_puts (_("Ending remote debugging.\n"));
+ gdb_puts (_ ("Ending remote debugging.\n"));
/* See if any thread of the inferior we are detaching has a pending fork
status. In that case, we must detach from the child resulting from
@@ -6196,8 +6158,8 @@ remote_target::remote_detach_1 (inferior *inf, int from_tty)
/* Check to see if we are detaching a fork parent. Note that if we
are detaching a fork child, tp == NULL. */
- is_fork_parent = (tp != NULL
- && tp->pending_follow.kind () == TARGET_WAITKIND_FORKED);
+ is_fork_parent
+ = (tp != NULL && tp->pending_follow.kind () == TARGET_WAITKIND_FORKED);
/* If doing detach-on-fork, we don't mourn, because that will delete
breakpoints that should be available for the followed inferior. */
@@ -6209,8 +6171,8 @@ remote_target::remote_detach_1 (inferior *inf, int from_tty)
target_mourn_inferior (inferior_ptid);
if (print_inferior_events)
- gdb_printf (_("[Inferior %d (%s) detached]\n"),
- inf->num, infpid.c_str ());
+ gdb_printf (_ ("[Inferior %d (%s) detached]\n"), inf->num,
+ infpid.c_str ());
}
else
{
@@ -6243,8 +6205,8 @@ remote_target::follow_fork (inferior *child_inf, ptid_t child_ptid,
target_waitkind fork_kind, bool follow_child,
bool detach_fork)
{
- process_stratum_target::follow_fork (child_inf, child_ptid,
- fork_kind, follow_child, detach_fork);
+ process_stratum_target::follow_fork (child_inf, child_ptid, fork_kind,
+ follow_child, detach_fork);
if ((fork_kind == TARGET_WAITKIND_FORKED
&& m_features.remote_fork_event_p ())
@@ -6288,7 +6250,7 @@ void
remote_target::disconnect (const char *args, int from_tty)
{
if (args)
- error (_("Argument given to \"disconnect\" when remotely debugging."));
+ error (_ ("Argument given to \"disconnect\" when remotely debugging."));
/* Make sure we unpush even the extended remote targets. Calling
target_mourn_inferior won't unpush, and
@@ -6316,7 +6278,7 @@ extended_remote_target::attach (const char *args, int from_tty)
way as in other targets. */
if (m_features.packet_support (PACKET_vAttach) == PACKET_DISABLE)
- error (_("This target does not support attaching to a process"));
+ error (_ ("This target does not support attaching to a process"));
target_announce_attach (from_tty, pid);
@@ -6334,14 +6296,13 @@ extended_remote_target::attach (const char *args, int from_tty)
strcpy (wait_status, rs->buf.data ());
}
else if (strcmp (rs->buf.data (), "OK") != 0)
- error (_("Attaching to %s failed with: %s"),
- target_pid_to_str (ptid_t (pid)).c_str (),
- rs->buf.data ());
+ error (_ ("Attaching to %s failed with: %s"),
+ target_pid_to_str (ptid_t (pid)).c_str (), rs->buf.data ());
break;
case PACKET_UNKNOWN:
- error (_("This target does not support attaching to a process"));
+ error (_ ("This target does not support attaching to a process"));
default:
- error (_("Attaching to %s failed"),
+ error (_ ("Attaching to %s failed"),
target_pid_to_str (ptid_t (pid)).c_str ());
}
@@ -6384,7 +6345,7 @@ extended_remote_target::attach (const char *args, int from_tty)
gdb_assert (wait_status != NULL);
struct notif_event *reply
- = remote_notif_parse (this, &notif_client_stop, wait_status);
+ = remote_notif_parse (this, &notif_client_stop, wait_status);
push_stop_reply ((struct stop_reply *) reply);
}
@@ -6410,10 +6371,9 @@ extended_remote_target::post_attach (int pid)
present (on Linux) and the binary itself hadn't changed since the
debugging process was started. */
if (current_program_space->symfile_object_file != NULL)
- remote_check_symbols();
+ remote_check_symbols ();
}
-
/* Check for the availability of vCont. This function should also check
the response. */
@@ -6478,8 +6438,8 @@ remote_target::remote_vcont_probe ()
resumed. */
char *
-remote_target::append_resumption (char *p, char *endp,
- ptid_t ptid, int step, gdb_signal siggnal)
+remote_target::append_resumption (char *p, char *endp, ptid_t ptid, int step,
+ gdb_signal siggnal)
{
struct remote_state *rs = get_remote_state ();
@@ -6513,10 +6473,8 @@ remote_target::append_resumption (char *p, char *endp,
int addr_size = gdbarch_addr_bit (target_gdbarch ()) / 8;
p += xsnprintf (p, endp - p, ";r%s,%s",
- phex_nz (tp->control.step_range_start,
- addr_size),
- phex_nz (tp->control.step_range_end,
- addr_size));
+ phex_nz (tp->control.step_range_start, addr_size),
+ phex_nz (tp->control.step_range_end, addr_size));
}
else
p += xsnprintf (p, endp - p, ";s");
@@ -6572,8 +6530,8 @@ remote_target::append_pending_thread_resumptions (char *p, char *endp,
if (inferior_ptid != thread->ptid
&& thread->stop_signal () != GDB_SIGNAL_0)
{
- p = append_resumption (p, endp, thread->ptid,
- 0, thread->stop_signal ());
+ p = append_resumption (p, endp, thread->ptid, 0,
+ thread->stop_signal ());
thread->set_stop_signal (GDB_SIGNAL_0);
resume_clear_thread_private_info (thread);
}
@@ -6609,13 +6567,13 @@ remote_target::remote_resume_with_hc (ptid_t ptid, int step,
{
/* We don't pass signals to the target in reverse exec mode. */
if (info_verbose && siggnal != GDB_SIGNAL_0)
- warning (_(" - Can't pass signal %d to target in reverse: ignored."),
+ warning (_ (" - Can't pass signal %d to target in reverse: ignored."),
siggnal);
if (step && m_features.packet_support (PACKET_bs) == PACKET_DISABLE)
- error (_("Remote reverse-step not supported."));
+ error (_ ("Remote reverse-step not supported."));
if (!step && m_features.packet_support (PACKET_bc) == PACKET_DISABLE)
- error (_("Remote reverse-continue not supported."));
+ error (_ ("Remote reverse-continue not supported."));
strcpy (buf, step ? "bs" : "bc");
}
@@ -6688,7 +6646,7 @@ remote_target::remote_resume_with_vcont (ptid_t scope_ptid, int step,
p = append_pending_thread_resumptions (p, endp, scope_ptid);
/* And continue others without a signal. */
- append_resumption (p, endp, scope_ptid, /*step=*/ 0, GDB_SIGNAL_0);
+ append_resumption (p, endp, scope_ptid, /*step=*/0, GDB_SIGNAL_0);
}
else
{
@@ -6706,7 +6664,7 @@ remote_target::remote_resume_with_vcont (ptid_t scope_ptid, int step,
notification. */
getpkt (&rs->buf, 0);
if (strcmp (rs->buf.data (), "OK") != 0)
- error (_("Unexpected vCont reply in non-stop mode: %s"),
+ error (_ ("Unexpected vCont reply in non-stop mode: %s"),
rs->buf.data ());
}
@@ -6734,7 +6692,8 @@ remote_target::resume (ptid_t scope_ptid, int step, enum gdb_signal siggnal)
/* We don't expect the core to ask to resume an already resumed (from
its point of view) thread. */
- gdb_assert (remote_thr->get_resume_state () == resume_state::NOT_RESUMED);
+ gdb_assert (remote_thr->get_resume_state ()
+ == resume_state::NOT_RESUMED);
remote_thr->set_resumed_pending_vcont (step, siggnal);
@@ -6802,6 +6761,7 @@ get_remote_inferior (inferior *inf)
class vcont_builder
{
public:
+
explicit vcont_builder (remote_target *remote)
: m_remote (remote)
{
@@ -6812,6 +6772,7 @@ public:
void push_action (ptid_t ptid, bool step, gdb_signal siggnal);
private:
+
void restart ();
/* The remote target. */
@@ -6856,7 +6817,7 @@ vcont_builder::flush ()
m_remote->putpkt (rs->buf);
m_remote->getpkt (&rs->buf, 0);
if (strcmp (rs->buf.data (), "OK") != 0)
- error (_("Unexpected vCont reply in non-stop mode: %s"), rs->buf.data ());
+ error (_ ("Unexpected vCont reply in non-stop mode: %s"), rs->buf.data ());
}
/* The largest action is range-stepping, with its two addresses. This
@@ -6875,8 +6836,8 @@ vcont_builder::push_action (ptid_t ptid, bool step, gdb_signal siggnal)
{
char buf[MAX_ACTION_SIZE + 1];
- char *endp = m_remote->append_resumption (buf, buf + sizeof (buf),
- ptid, step, siggnal);
+ char *endp = m_remote->append_resumption (buf, buf + sizeof (buf), ptid,
+ step, siggnal);
/* Check whether this new action would fit in the vCont packet along
with previous actions. If not, send what we've got so far and
@@ -7019,7 +6980,8 @@ remote_target::commit_resumed ()
/* If the thread was previously vCont-resumed, no need to send a specific
action for it. If we didn't receive a resume request for it, don't
send an action for it either. */
- if (remote_thr->get_resume_state () != resume_state::RESUMED_PENDING_VCONT)
+ if (remote_thr->get_resume_state ()
+ != resume_state::RESUMED_PENDING_VCONT)
continue;
gdb_assert (!thread_is_in_step_over_chain (tp));
@@ -7064,8 +7026,7 @@ remote_target::commit_resumed ()
continue action for each running process, if any. */
if (may_global_wildcard_vcont)
{
- vcont_builder.push_action (minus_one_ptid,
- false, GDB_SIGNAL_0);
+ vcont_builder.push_action (minus_one_ptid, false, GDB_SIGNAL_0);
}
else
{
@@ -7073,8 +7034,8 @@ remote_target::commit_resumed ()
{
if (get_remote_inferior (inf)->may_wildcard_vcont)
{
- vcont_builder.push_action (ptid_t (inf->pid),
- false, GDB_SIGNAL_0);
+ vcont_builder.push_action (ptid_t (inf->pid), false,
+ GDB_SIGNAL_0);
}
}
}
@@ -7103,8 +7064,6 @@ remote_target::has_pending_events ()
return false;
}
-
-
/* Non-stop version of target_stop. Uses `vCont;t' to stop a remote
thread, all threads of a remote process, or all threads of all
processes. */
@@ -7151,10 +7110,10 @@ remote_target::remote_stop_ns (ptid_t ptid)
if (remote_thr->get_resume_state ()
== resume_state::RESUMED_PENDING_VCONT)
{
- remote_debug_printf ("Enqueueing phony stop reply for thread pending "
- "vCont-resume (%d, %ld, %s)", tp->ptid.pid(),
- tp->ptid.lwp (),
- pulongest (tp->ptid.tid ()));
+ remote_debug_printf (
+ "Enqueueing phony stop reply for thread pending "
+ "vCont-resume (%d, %ld, %s)",
+ tp->ptid.pid (), tp->ptid.lwp (), pulongest (tp->ptid.tid ()));
/* Check that the thread wasn't resumed with a signal.
Generating a phony stop would result in losing the
@@ -7185,7 +7144,7 @@ remote_target::remote_stop_ns (ptid_t ptid)
}
if (!rs->supports_vCont.t)
- error (_("Remote server does not support stopping threads"));
+ error (_ ("Remote server does not support stopping threads"));
if (ptid == minus_one_ptid
|| (!m_features.remote_multi_process_p () && ptid.is_pid ()))
@@ -7197,7 +7156,7 @@ remote_target::remote_stop_ns (ptid_t ptid)
p += xsnprintf (p, endp - p, "vCont;t:");
if (ptid.is_pid ())
- /* All (-1) threads of process. */
+ /* All (-1) threads of process. */
nptid = ptid_t (ptid.pid (), -1);
else
{
@@ -7218,7 +7177,7 @@ remote_target::remote_stop_ns (ptid_t ptid)
putpkt (rs->buf);
getpkt (&rs->buf, 0);
if (strcmp (rs->buf.data (), "OK") != 0)
- error (_("Stopping %s failed: %s"), target_pid_to_str (ptid).c_str (),
+ error (_ ("Stopping %s failed: %s"), target_pid_to_str (ptid).c_str (),
rs->buf.data ());
}
@@ -7267,9 +7226,9 @@ remote_target::remote_interrupt_ns ()
case PACKET_OK:
break;
case PACKET_UNKNOWN:
- error (_("No support for interrupting the remote target."));
+ error (_ ("No support for interrupting the remote target."));
case PACKET_ERROR:
- error (_("Interrupting target failed: %s"), rs->buf.data ());
+ error (_ ("Interrupting target failed: %s"), rs->buf.data ());
}
}
@@ -7332,17 +7291,17 @@ remote_target::interrupt_query ()
if (rs->waiting_for_stop_reply && rs->ctrlc_pending_p)
{
- if (query (_("The target is not responding to interrupt requests.\n"
- "Stop debugging it? ")))
+ if (query (_ ("The target is not responding to interrupt requests.\n"
+ "Stop debugging it? ")))
{
remote_unpush_target (this);
- throw_error (TARGET_CLOSE_ERROR, _("Disconnected from target."));
+ throw_error (TARGET_CLOSE_ERROR, _ ("Disconnected from target."));
}
}
else
{
- if (query (_("Interrupted while waiting for the program.\n"
- "Give up waiting? ")))
+ if (query (_ ("Interrupted while waiting for the program.\n"
+ "Give up waiting? ")))
quit ();
}
}
@@ -7392,17 +7351,15 @@ remote_target::stop_reply_queue_length ()
}
static void
-remote_notif_stop_parse (remote_target *remote,
- const notif_client *self, const char *buf,
- struct notif_event *event)
+remote_notif_stop_parse (remote_target *remote, const notif_client *self,
+ const char *buf, struct notif_event *event)
{
remote->remote_parse_stop_reply (buf, (struct stop_reply *) event);
}
static void
-remote_notif_stop_ack (remote_target *remote,
- const notif_client *self, const char *buf,
- struct notif_event *event)
+remote_notif_stop_ack (remote_target *remote, const notif_client *self,
+ const char *buf, struct notif_event *event)
{
struct stop_reply *stop_reply = (struct stop_reply *) event;
@@ -7444,8 +7401,7 @@ remote_notif_stop_alloc_reply ()
/* A client of notification Stop. */
-const notif_client notif_client_stop =
-{
+const notif_client notif_client_stop = {
"Stop",
"vStopped",
remote_notif_stop_parse,
@@ -7497,8 +7453,8 @@ remote_target::remove_new_fork_children (threads_listing_context *context)
wildcard resume (vCont;c:pPID.-1). */
void
-remote_target::check_pending_events_prevent_wildcard_vcont
- (bool *may_global_wildcard)
+remote_target::check_pending_events_prevent_wildcard_vcont (
+ bool *may_global_wildcard)
{
const notif_client *notif = &notif_client_stop;
@@ -7548,10 +7504,9 @@ remote_target::discard_pending_stop_replies (struct inferior *inf)
/* Leave the notification pending, since the server expects that
we acknowledge it with vStopped. But clear its contents, so
that later on when we acknowledge it, we also discard it. */
- remote_debug_printf
- ("discarding in-flight notification: ptid: %s, ws: %s\n",
- reply->ptid.to_string().c_str(),
- reply->ws.to_string ().c_str ());
+ remote_debug_printf (
+ "discarding in-flight notification: ptid: %s, ws: %s\n",
+ reply->ptid.to_string ().c_str (), reply->ws.to_string ().c_str ());
reply->ws.set_ignore ();
}
@@ -7559,15 +7514,13 @@ remote_target::discard_pending_stop_replies (struct inferior *inf)
vStopped. */
auto iter = std::remove_if (rs->stop_reply_queue.begin (),
rs->stop_reply_queue.end (),
- [=] (const stop_reply_up &event)
- {
- return event->ptid.pid () == inf->pid;
- });
+ [=] (const stop_reply_up &event) {
+ return event->ptid.pid () == inf->pid;
+ });
for (auto it = iter; it != rs->stop_reply_queue.end (); ++it)
- remote_debug_printf
- ("discarding queued stop reply: ptid: %s, ws: %s\n",
- reply->ptid.to_string().c_str(),
- reply->ws.to_string ().c_str ());
+ remote_debug_printf ("discarding queued stop reply: ptid: %s, ws: %s\n",
+ reply->ptid.to_string ().c_str (),
+ reply->ws.to_string ().c_str ());
rs->stop_reply_queue.erase (iter, rs->stop_reply_queue.end ());
}
@@ -7582,10 +7535,9 @@ remote_target::discard_pending_stop_replies_in_queue ()
vStopped. */
auto iter = std::remove_if (rs->stop_reply_queue.begin (),
rs->stop_reply_queue.end (),
- [=] (const stop_reply_up &event)
- {
- return event->rs == rs;
- });
+ [=] (const stop_reply_up &event) {
+ return event->rs == rs;
+ });
rs->stop_reply_queue.erase (iter, rs->stop_reply_queue.end ());
}
@@ -7597,12 +7549,11 @@ remote_target::remote_notif_remove_queued_reply (ptid_t ptid)
{
remote_state *rs = get_remote_state ();
- auto iter = std::find_if (rs->stop_reply_queue.begin (),
- rs->stop_reply_queue.end (),
- [=] (const stop_reply_up &event)
- {
- return event->ptid.matches (ptid);
- });
+ auto iter
+ = std::find_if (rs->stop_reply_queue.begin (), rs->stop_reply_queue.end (),
+ [=] (const stop_reply_up &event) {
+ return event->ptid.matches (ptid);
+ });
struct stop_reply *result;
if (iter == rs->stop_reply_queue.end ())
result = nullptr;
@@ -7613,8 +7564,7 @@ remote_target::remote_notif_remove_queued_reply (ptid_t ptid)
}
if (notif_debug)
- gdb_printf (gdb_stdlog,
- "notif: discard queued event: 'Stop' in %s\n",
+ gdb_printf (gdb_stdlog, "notif: discard queued event: 'Stop' in %s\n",
ptid.to_string ().c_str ());
return result;
@@ -7651,8 +7601,7 @@ remote_target::push_stop_reply (struct stop_reply *new_event)
rs->stop_reply_queue.push_back (stop_reply_up (new_event));
if (notif_debug)
- gdb_printf (gdb_stdlog,
- "notif: push 'Stop' %s to queue %d\n",
+ gdb_printf (gdb_stdlog, "notif: push 'Stop' %s to queue %d\n",
new_event->ptid.to_string ().c_str (),
int (rs->stop_reply_queue.size ()));
@@ -7671,8 +7620,7 @@ remote_target::peek_stop_reply (ptid_t ptid)
{
remote_state *rs = get_remote_state ();
for (auto &event : rs->stop_reply_queue)
- if (ptid == event->ptid
- && event->ws.kind () == TARGET_WAITKIND_STOPPED)
+ if (ptid == event->ptid && event->ws.kind () == TARGET_WAITKIND_STOPPED)
return 1;
return 0;
}
@@ -7683,7 +7631,7 @@ remote_target::peek_stop_reply (ptid_t ptid)
static int
strprefix (const char *p, const char *pend, const char *prefix)
{
- for ( ; p < pend; p++, prefix++)
+ for (; p < pend; p++, prefix++)
if (*p != *prefix)
return 0;
return *prefix == '\0';
@@ -7709,7 +7657,7 @@ remote_target::remote_parse_stop_reply (const char *buf, stop_reply *event)
switch (buf[0])
{
- case 'T': /* Status with PC, SP, FP, ... */
+ case 'T': /* Status with PC, SP, FP, ... */
/* Expedited reply, containing Signal, {regno, reg} repeat. */
/* format is: 'Tssn...:r...;n...:r...;n...:r...;#cc', where
ss = signal number
@@ -7717,7 +7665,7 @@ remote_target::remote_parse_stop_reply (const char *buf, stop_reply *event)
r... = register contents
*/
- p = &buf[3]; /* after Txx */
+ p = &buf[3]; /* after Txx */
while (*p)
{
const char *p1;
@@ -7725,11 +7673,11 @@ remote_target::remote_parse_stop_reply (const char *buf, stop_reply *event)
p1 = strchr (p, ':');
if (p1 == NULL)
- error (_("Malformed packet(a) (missing colon): %s\n\
+ error (_ ("Malformed packet(a) (missing colon): %s\n\
Packet: '%s'\n"),
p, buf);
if (p == p1)
- error (_("Malformed packet(a) (missing register number): %s\n\
+ error (_ ("Malformed packet(a) (missing register number): %s\n\
Packet: '%s'\n"),
p, buf);
@@ -7756,8 +7704,7 @@ Packet: '%s'\n"),
p = unpack_varlen_hex (++p1, &sysno);
event->ws.set_syscall_return ((int) sysno);
}
- else if (strprefix (p, p1, "watch")
- || strprefix (p, p1, "rwatch")
+ else if (strprefix (p, p1, "watch") || strprefix (p, p1, "rwatch")
|| strprefix (p, p1, "awatch"))
{
event->stop_reason = TARGET_STOPPED_BY_WATCHPOINT;
@@ -7772,7 +7719,7 @@ Packet: '%s'\n"),
with qSupported. */
if (m_features.packet_support (PACKET_swbreak_feature)
!= PACKET_ENABLE)
- error (_("Unexpected swbreak stop reason"));
+ error (_ ("Unexpected swbreak stop reason"));
/* The value part is documented as "must be empty",
though we ignore it, in case we ever decide to make
@@ -7787,7 +7734,7 @@ Packet: '%s'\n"),
with qSupported. */
if (m_features.packet_support (PACKET_hwbreak_feature)
!= PACKET_ENABLE)
- error (_("Unexpected hwbreak stop reason"));
+ error (_ ("Unexpected hwbreak stop reason"));
/* See above. */
p = strchrnul (p1 + 1, ';');
@@ -7831,8 +7778,8 @@ Packet: '%s'\n"),
/* Save the pathname for event reporting and for
the next run command. */
- gdb::unique_xmalloc_ptr<char> pathname
- ((char *) xmalloc (pathlen + 1));
+ gdb::unique_xmalloc_ptr<char> pathname ((char *) xmalloc (pathlen
+ + 1));
hex2bin (p1, (gdb_byte *) pathname.get (), pathlen);
pathname.get ()[pathlen] = '\0';
@@ -7879,16 +7826,16 @@ Packet: '%s'\n"),
thread. */
const char *thr = strstr (p1 + 1, ";thread:");
if (thr != NULL)
- event->ptid = read_ptid (thr + strlen (";thread:"),
- NULL);
+ event->ptid
+ = read_ptid (thr + strlen (";thread:"), NULL);
}
if (rsa == NULL)
{
inferior *inf
= (event->ptid == null_ptid
- ? NULL
- : find_inferior_ptid (this, event->ptid));
+ ? NULL
+ : find_inferior_ptid (this, event->ptid));
/* If this is the first time we learn anything
about this process, skip the registers
included in this packet, since we don't yet
@@ -7914,20 +7861,22 @@ Packet: '%s'\n"),
cached_reg_t cached_reg;
if (reg == NULL)
- error (_("Remote sent bad register number %s: %s\n\
+ error (_ ("Remote sent bad register number %s: %s\n\
Packet: '%s'\n"),
hex_string (pnum), p, buf);
cached_reg.num = reg->regnum;
- cached_reg.data = (gdb_byte *)
- xmalloc (register_size (event->arch, reg->regnum));
+ cached_reg.data
+ = (gdb_byte *) xmalloc (register_size (event->arch,
+ reg->regnum));
p = p1 + 1;
- fieldsize = hex2bin (p, cached_reg.data,
- register_size (event->arch, reg->regnum));
+ fieldsize
+ = hex2bin (p, cached_reg.data,
+ register_size (event->arch, reg->regnum));
p += 2 * fieldsize;
if (fieldsize < register_size (event->arch, reg->regnum))
- warning (_("Remote reply is too short: %s"), buf);
+ warning (_ ("Remote reply is too short: %s"), buf);
event->regcache.push_back (cached_reg);
}
@@ -7940,8 +7889,8 @@ Packet: '%s'\n"),
}
if (*p != ';')
- error (_("Remote register badly formatted: %s\nhere: %s"),
- buf, p);
+ error (_ ("Remote register badly formatted: %s\nhere: %s"), buf,
+ p);
++p;
}
@@ -7949,7 +7898,7 @@ Packet: '%s'\n"),
break;
/* fall through */
- case 'S': /* Old style status, just signal only. */
+ case 'S': /* Old style status, just signal only. */
{
int sig;
@@ -7960,18 +7909,18 @@ Packet: '%s'\n"),
event->ws.set_stopped (GDB_SIGNAL_UNKNOWN);
}
break;
- case 'w': /* Thread exited. */
+ case 'w': /* Thread exited. */
{
ULONGEST value;
p = unpack_varlen_hex (&buf[1], &value);
event->ws.set_thread_exited (value);
if (*p != ';')
- error (_("stop reply packet badly formatted: %s"), buf);
+ error (_ ("stop reply packet badly formatted: %s"), buf);
event->ptid = read_ptid (++p, NULL);
break;
}
- case 'W': /* Target exited. */
+ case 'W': /* Target exited. */
case 'X':
{
ULONGEST value;
@@ -8015,10 +7964,10 @@ Packet: '%s'\n"),
pid = upid;
}
else
- error (_("unknown stop reply packet: %s"), buf);
+ error (_ ("unknown stop reply packet: %s"), buf);
}
else
- error (_("unknown stop reply packet: %s"), buf);
+ error (_ ("unknown stop reply packet: %s"), buf);
event->ptid = ptid_t (pid);
}
break;
@@ -8079,8 +8028,7 @@ remote_target::remote_notif_get_pending_events (const notif_client *nc)
if (rs->notif_state->pending_event[nc->id] != NULL)
{
if (notif_debug)
- gdb_printf (gdb_stdlog,
- "notif: process: '%s' ack pending event\n",
+ gdb_printf (gdb_stdlog, "notif: process: '%s' ack pending event\n",
nc->name);
/* acknowledge */
@@ -8100,8 +8048,7 @@ remote_target::remote_notif_get_pending_events (const notif_client *nc)
else
{
if (notif_debug)
- gdb_printf (gdb_stdlog,
- "notif: process: '%s' no pending reply\n",
+ gdb_printf (gdb_stdlog, "notif: process: '%s' no pending reply\n",
nc->name);
}
}
@@ -8148,16 +8095,15 @@ remote_notif_get_pending_events (remote_target *remote, const notif_client *nc)
yet. */
ptid_t
-remote_target::select_thread_for_ambiguous_stop_reply
- (const target_waitstatus &status)
+remote_target::select_thread_for_ambiguous_stop_reply (
+ const target_waitstatus &status)
{
REMOTE_SCOPED_DEBUG_ENTER_EXIT;
/* Some stop events apply to all threads in an inferior, while others
only apply to a single thread. */
- bool process_wide_stop
- = (status.kind () == TARGET_WAITKIND_EXITED
- || status.kind () == TARGET_WAITKIND_SIGNALLED);
+ bool process_wide_stop = (status.kind () == TARGET_WAITKIND_EXITED
+ || status.kind () == TARGET_WAITKIND_SIGNALLED);
remote_debug_printf ("process_wide_stop = %d", process_wide_stop);
@@ -8206,13 +8152,13 @@ remote_target::select_thread_for_ambiguous_stop_reply
without including a process-id, when the target has
multiple running inferiors. */
if (process_wide_stop)
- warning (_("multi-inferior target stopped without "
- "sending a process-id, using first "
- "non-exited inferior"));
+ warning (_ ("multi-inferior target stopped without "
+ "sending a process-id, using first "
+ "non-exited inferior"));
else
- warning (_("multi-threaded target stopped without "
- "sending a thread-id, using first "
- "non-exited thread"));
+ warning (_ ("multi-threaded target stopped without "
+ "sending a thread-id, using first "
+ "non-exited thread"));
warned = true;
}
}
@@ -8306,17 +8252,17 @@ remote_target::wait_ns (ptid_t ptid, struct target_waitstatus *status,
if (ret != -1 && !is_notif)
switch (rs->buf[0])
{
- case 'E': /* Error of some sort. */
+ case 'E': /* Error of some sort. */
/* We're out of sync with the target now. Did it continue
or not? We can't tell which thread it was in non-stop,
so just ignore this. */
- warning (_("Remote failure reply: %s"), rs->buf.data ());
+ warning (_ ("Remote failure reply: %s"), rs->buf.data ());
break;
- case 'O': /* Console output. */
+ case 'O': /* Console output. */
remote_console_output (&rs->buf[1]);
break;
default:
- warning (_("Invalid remote reply: %s"), rs->buf.data ());
+ warning (_ ("Invalid remote reply: %s"), rs->buf.data ());
break;
}
@@ -8366,7 +8312,7 @@ remote_target::wait_as (ptid_t ptid, target_waitstatus *status,
char *buf;
struct stop_reply *stop_reply;
- again:
+again:
status->set_ignore ();
@@ -8380,8 +8326,8 @@ remote_target::wait_as (ptid_t ptid, target_waitstatus *status,
}
else
{
- int forever = ((options & TARGET_WNOHANG) == 0
- && rs->wait_forever_enabled_p);
+ int forever
+ = ((options & TARGET_WNOHANG) == 0 && rs->wait_forever_enabled_p);
if (!rs->waiting_for_stop_reply)
{
@@ -8413,15 +8359,15 @@ remote_target::wait_as (ptid_t ptid, target_waitstatus *status,
switch (buf[0])
{
- case 'E': /* Error of some sort. */
+ case 'E': /* Error of some sort. */
/* We're out of sync with the target now. Did it continue or
not? Not is more likely, so report a stop. */
rs->waiting_for_stop_reply = 0;
- warning (_("Remote failure reply: %s"), buf);
+ warning (_ ("Remote failure reply: %s"), buf);
status->set_stopped (GDB_SIGNAL_0);
break;
- case 'F': /* File-I/O request. */
+ case 'F': /* File-I/O request. */
/* GDB may access the inferior memory while handling the File-I/O
request, but we don't want GDB accessing memory while waiting
for a stop reply. See the comments in putpkt_binary. Set
@@ -8433,7 +8379,11 @@ remote_target::wait_as (ptid_t ptid, target_waitstatus *status,
again. Keep waiting for events. */
rs->waiting_for_stop_reply = 1;
break;
- case 'N': case 'T': case 'S': case 'X': case 'W':
+ case 'N':
+ case 'T':
+ case 'S':
+ case 'X':
+ case 'W':
{
/* There is a stop reply to handle. */
rs->waiting_for_stop_reply = 0;
@@ -8446,7 +8396,7 @@ remote_target::wait_as (ptid_t ptid, target_waitstatus *status,
event_ptid = process_stop_reply (stop_reply, status);
break;
}
- case 'O': /* Console output. */
+ case 'O': /* Console output. */
remote_console_output (buf + 1);
break;
case '\0':
@@ -8455,9 +8405,9 @@ remote_target::wait_as (ptid_t ptid, target_waitstatus *status,
/* Zero length reply means that we tried 'S' or 'C' and the
remote system doesn't support it. */
target_terminal::ours_for_output ();
- gdb_printf
- ("Can't send signals to this remote system. %s not sent.\n",
- gdb_signal_to_name (rs->last_sent_signal));
+ gdb_printf (
+ "Can't send signals to this remote system. %s not sent.\n",
+ gdb_signal_to_name (rs->last_sent_signal));
rs->last_sent_signal = GDB_SIGNAL_0;
target_terminal::inferior ();
@@ -8467,7 +8417,7 @@ remote_target::wait_as (ptid_t ptid, target_waitstatus *status,
}
/* fallthrough */
default:
- warning (_("Invalid remote reply: %s"), buf);
+ warning (_ ("Invalid remote reply: %s"), buf);
break;
}
}
@@ -8523,8 +8473,8 @@ remote_target::wait (ptid_t ptid, struct target_waitstatus *status,
if (target_is_async_p ())
clear_async_event_handler (rs->remote_async_inferior_event_token);
else
- gdb_assert (!async_event_handler_marked
- (rs->remote_async_inferior_event_token));
+ gdb_assert (
+ !async_event_handler_marked (rs->remote_async_inferior_event_token));
ptid_t event_ptid;
@@ -8579,10 +8529,8 @@ remote_target::fetch_register_using_p (struct regcache *regcache,
case PACKET_UNKNOWN:
return 0;
case PACKET_ERROR:
- error (_("Could not fetch register \"%s\"; remote failure reply '%s'"),
- gdbarch_register_name (regcache->arch (),
- reg->regnum),
- buf);
+ error (_ ("Could not fetch register \"%s\"; remote failure reply '%s'"),
+ gdbarch_register_name (regcache->arch (), reg->regnum), buf);
}
/* If this register is unfetchable, tell the regcache. */
@@ -8598,7 +8546,7 @@ remote_target::fetch_register_using_p (struct regcache *regcache,
while (p[0] != 0)
{
if (p[1] == 0)
- error (_("fetch_register_using_p: early buf termination"));
+ error (_ ("fetch_register_using_p: early buf termination"));
regp[i++] = fromhex (p[0]) * 16 + fromhex (p[1]);
p += 2;
@@ -8619,7 +8567,7 @@ remote_target::send_g_packet ()
putpkt (rs->buf);
getpkt (&rs->buf, 0);
if (packet_check_result (rs->buf) == PACKET_ERROR)
- error (_("Could not read registers; remote failure reply '%s'"),
+ error (_ ("Could not read registers; remote failure reply '%s'"),
rs->buf.data ());
/* We can get out of synch in various cases. If the first character
@@ -8628,7 +8576,7 @@ remote_target::send_g_packet ()
while ((rs->buf[0] < '0' || rs->buf[0] > '9')
&& (rs->buf[0] < 'A' || rs->buf[0] > 'F')
&& (rs->buf[0] < 'a' || rs->buf[0] > 'f')
- && rs->buf[0] != 'x') /* New: unavailable register value. */
+ && rs->buf[0] != 'x') /* New: unavailable register value. */
{
remote_debug_printf ("Bad register packet; fetching a new packet");
getpkt (&rs->buf, 0);
@@ -8638,7 +8586,8 @@ remote_target::send_g_packet ()
/* Sanity check the received packet. */
if (buf_len % 2 != 0)
- error (_("Remote 'g' packet reply is of odd length: %s"), rs->buf.data ());
+ error (_ ("Remote 'g' packet reply is of odd length: %s"),
+ rs->buf.data ());
return buf_len / 2;
}
@@ -8657,10 +8606,10 @@ remote_target::process_g_packet (struct regcache *regcache)
/* Further sanity checks, with knowledge of the architecture. */
if (buf_len > 2 * rsa->sizeof_g_packet)
- error (_("Remote 'g' packet reply is too long (expected %ld bytes, got %d "
- "bytes): %s"),
- rsa->sizeof_g_packet, buf_len / 2,
- rs->buf.data ());
+ error (
+ _ ("Remote 'g' packet reply is too long (expected %ld bytes, got %d "
+ "bytes): %s"),
+ rsa->sizeof_g_packet, buf_len / 2, rs->buf.data ());
/* Save the size of the packet sent to us by the target. It is used
as a heuristic when determining the max size of packets that the
@@ -8687,7 +8636,7 @@ remote_target::process_g_packet (struct regcache *regcache)
if (offset >= sizeof_g_packet)
rsa->regs[i].in_g_packet = 0;
else if (offset + reg_size > sizeof_g_packet)
- error (_("Truncated register %d in remote 'g' packet"), i);
+ error (_ ("Truncated register %d in remote 'g' packet"), i);
else
rsa->regs[i].in_g_packet = 1;
}
@@ -8715,10 +8664,10 @@ remote_target::process_g_packet (struct regcache *regcache)
{
if (p[0] == 0 || p[1] == 0)
/* This shouldn't happen - we adjusted sizeof_g_packet above. */
- internal_error (_("unexpected end of 'g' packet reply"));
+ internal_error (_ ("unexpected end of 'g' packet reply"));
if (p[0] == 'x' && p[1] == 'x')
- regs[i] = 0; /* 'x' */
+ regs[i] = 0; /* 'x' */
else
regs[i] = fromhex (p[0]) * 16 + fromhex (p[1]);
p += 2;
@@ -8733,7 +8682,7 @@ remote_target::process_g_packet (struct regcache *regcache)
{
if ((r->offset + reg_size) * 2 > strlen (rs->buf.data ()))
/* This shouldn't happen - we adjusted in_g_packet above. */
- internal_error (_("unexpected end of 'g' packet reply"));
+ internal_error (_ ("unexpected end of 'g' packet reply"));
else if (rs->buf[r->offset * 2] == 'x')
{
gdb_assert (r->offset * 2 < strlen (rs->buf.data ()));
@@ -8769,12 +8718,12 @@ remote_target::set_remote_traceframe ()
/* Avoid recursion, remote_trace_find calls us again. */
rs->remote_traceframe_number = get_traceframe_number ();
- newnum = target_trace_find (tfind_number,
- get_traceframe_number (), 0, 0, NULL);
+ newnum
+ = target_trace_find (tfind_number, get_traceframe_number (), 0, 0, NULL);
/* Should not happen. If it does, all bets are off. */
if (newnum != get_traceframe_number ())
- warning (_("could not set remote traceframe"));
+ warning (_ ("could not set remote traceframe"));
}
void
@@ -8883,12 +8832,12 @@ remote_target::store_register_using_P (const struct regcache *regcache,
case PACKET_OK:
return 1;
case PACKET_ERROR:
- error (_("Could not write register \"%s\"; remote failure reply '%s'"),
+ error (_ ("Could not write register \"%s\"; remote failure reply '%s'"),
gdbarch_register_name (gdbarch, reg->regnum), rs->buf.data ());
case PACKET_UNKNOWN:
return 0;
default:
- internal_error (_("Bad result from packet_ok"));
+ internal_error (_ ("Bad result from packet_ok"));
}
}
@@ -8927,7 +8876,7 @@ remote_target::store_registers_using_G (const struct regcache *regcache)
putpkt (rs->buf);
getpkt (&rs->buf, 0);
if (packet_check_result (rs->buf) == PACKET_ERROR)
- error (_("Could not write registers; remote failure reply '%s'"),
+ error (_ ("Could not write registers; remote failure reply '%s'"),
rs->buf.data ());
}
@@ -8977,7 +8926,6 @@ remote_target::store_registers (struct regcache *regcache, int regnum)
/* See above for why we do not issue an error here. */
continue;
}
-
/* Return the number of hex digits in num. */
@@ -9002,7 +8950,6 @@ hexnumstr (char *buf, ULONGEST num)
return hexnumnstr (buf, num, len);
}
-
/* Set BUF to the hex digits representing NUM, padded to WIDTH characters. */
static int
@@ -9032,8 +8979,7 @@ remote_address_masked (CORE_ADDR addr)
if (!address_size)
address_size = gdbarch_addr_bit (target_gdbarch ());
- if (address_size > 0
- && address_size < (sizeof (ULONGEST) * 8))
+ if (address_size > 0 && address_size < (sizeof (ULONGEST) * 8))
{
/* Only create a mask when that mask can safely be constructed
in a ULONGEST variable. */
@@ -9145,8 +9091,7 @@ align_for_efficient_write (int todo, CORE_ADDR memaddr)
target_xfer_status
remote_target::remote_write_bytes_aux (const char *header, CORE_ADDR memaddr,
const gdb_byte *myaddr,
- ULONGEST len_units,
- int unit_size,
+ ULONGEST len_units, int unit_size,
ULONGEST *xfered_len_units,
char packet_format, int use_length)
{
@@ -9160,7 +9105,7 @@ remote_target::remote_write_bytes_aux (const char *header, CORE_ADDR memaddr,
int payload_length_bytes;
if (packet_format != 'X' && packet_format != 'M')
- internal_error (_("remote_write_bytes_aux: bad packet format"));
+ internal_error (_ ("remote_write_bytes_aux: bad packet format"));
if (len_units == 0)
return TARGET_XFER_EOF;
@@ -9190,8 +9135,8 @@ remote_target::remote_write_bytes_aux (const char *header, CORE_ADDR memaddr,
if (packet_format == 'X')
{
/* Best guess at number of bytes that will fit. */
- todo_units = std::min (len_units,
- (ULONGEST) payload_capacity_bytes / unit_size);
+ todo_units
+ = std::min (len_units, (ULONGEST) payload_capacity_bytes / unit_size);
if (use_length)
payload_capacity_bytes -= hexnumlen (todo_units);
todo_units = std::min (todo_units, payload_capacity_bytes / unit_size);
@@ -9204,12 +9149,12 @@ remote_target::remote_write_bytes_aux (const char *header, CORE_ADDR memaddr,
(ULONGEST) (payload_capacity_bytes / unit_size) / 2);
if (use_length)
payload_capacity_bytes -= hexnumlen (todo_units);
- todo_units = std::min (todo_units,
- (payload_capacity_bytes / unit_size) / 2);
+ todo_units
+ = std::min (todo_units, (payload_capacity_bytes / unit_size) / 2);
}
if (todo_units <= 0)
- internal_error (_("minimum packet size too small to write data"));
+ internal_error (_ ("minimum packet size too small to write data"));
/* If we already need another packet, then try to align the end
of this packet to a useful boundary. */
@@ -9242,22 +9187,23 @@ remote_target::remote_write_bytes_aux (const char *header, CORE_ADDR memaddr,
/* Binary mode. Send target system values byte by byte, in
increasing byte addresses. Only escape certain critical
characters. */
- payload_length_bytes =
- remote_escape_output (myaddr, todo_units, unit_size, (gdb_byte *) p,
+ payload_length_bytes
+ = remote_escape_output (myaddr, todo_units, unit_size, (gdb_byte *) p,
&units_written, payload_capacity_bytes);
/* If not all TODO units fit, then we'll need another packet. Make
a second try to keep the end of the packet aligned. Don't do
this if the packet is tiny. */
- if (units_written < todo_units && units_written > 2 * REMOTE_ALIGN_WRITES)
+ if (units_written < todo_units
+ && units_written > 2 * REMOTE_ALIGN_WRITES)
{
int new_todo_units;
new_todo_units = align_for_efficient_write (units_written, memaddr);
if (new_todo_units != units_written)
- payload_length_bytes =
- remote_escape_output (myaddr, new_todo_units, unit_size,
+ payload_length_bytes
+ = remote_escape_output (myaddr, new_todo_units, unit_size,
(gdb_byte *) p, &units_written,
payload_capacity_bytes);
}
@@ -9269,9 +9215,8 @@ remote_target::remote_write_bytes_aux (const char *header, CORE_ADDR memaddr,
and we have actually sent fewer units than planned.
Fix-up the length field of the packet. Use the same
number of characters as before. */
- plen += hexnumnstr (plen, (ULONGEST) units_written,
- plenlen);
- *plen = ':'; /* overwrite \0 from hexnumnstr() */
+ plen += hexnumnstr (plen, (ULONGEST) units_written, plenlen);
+ *plen = ':'; /* overwrite \0 from hexnumnstr() */
}
}
else
@@ -9324,14 +9269,13 @@ remote_target::remote_write_bytes (CORE_ADDR memaddr, const gdb_byte *myaddr,
packet_format = "M";
break;
case PACKET_SUPPORT_UNKNOWN:
- internal_error (_("remote_write_bytes: bad internal state"));
+ internal_error (_ ("remote_write_bytes: bad internal state"));
default:
- internal_error (_("bad switch"));
+ internal_error (_ ("bad switch"));
}
- return remote_write_bytes_aux (packet_format,
- memaddr, myaddr, len, unit_size, xfered_len,
- packet_format[0], 1);
+ return remote_write_bytes_aux (packet_format, memaddr, myaddr, len,
+ unit_size, xfered_len, packet_format[0], 1);
}
/* Read memory data directly from the remote machine.
@@ -9350,11 +9294,11 @@ remote_target::remote_write_bytes (CORE_ADDR memaddr, const gdb_byte *myaddr,
target_xfer_status
remote_target::remote_read_bytes_1 (CORE_ADDR memaddr, gdb_byte *myaddr,
- ULONGEST len_units,
- int unit_size, ULONGEST *xfered_len_units)
+ ULONGEST len_units, int unit_size,
+ ULONGEST *xfered_len_units)
{
struct remote_state *rs = get_remote_state ();
- int buf_size_bytes; /* Max size of packet output buffer. */
+ int buf_size_bytes; /* Max size of packet output buffer. */
char *p;
int todo_units;
int decoded_bytes;
@@ -9364,8 +9308,8 @@ remote_target::remote_read_bytes_1 (CORE_ADDR memaddr, gdb_byte *myaddr,
get_memory_packet_size ensures this. */
/* Number of units that will fit. */
- todo_units = std::min (len_units,
- (ULONGEST) (buf_size_bytes / unit_size) / 2);
+ todo_units
+ = std::min (len_units, (ULONGEST) (buf_size_bytes / unit_size) / 2);
/* Construct "m"<memaddr>","<len>". */
memaddr = remote_address_masked (memaddr);
@@ -9377,8 +9321,7 @@ remote_target::remote_read_bytes_1 (CORE_ADDR memaddr, gdb_byte *myaddr,
*p = '\0';
putpkt (rs->buf);
getpkt (&rs->buf, 0);
- if (rs->buf[0] == 'E'
- && isxdigit (rs->buf[1]) && isxdigit (rs->buf[2])
+ if (rs->buf[0] == 'E' && isxdigit (rs->buf[1]) && isxdigit (rs->buf[2])
&& rs->buf[3] == '\0')
return TARGET_XFER_E_IO;
/* Reply describes memory byte by byte, each byte encoded as two hex
@@ -9399,8 +9342,7 @@ remote_target::remote_read_bytes_1 (CORE_ADDR memaddr, gdb_byte *myaddr,
target_xfer_status
remote_target::remote_xfer_live_readonly_partial (gdb_byte *readbuf,
ULONGEST memaddr,
- ULONGEST len,
- int unit_size,
+ ULONGEST len, int unit_size,
ULONGEST *xfered_len)
{
const struct target_section *secp;
@@ -9446,8 +9388,8 @@ remote_target::remote_xfer_live_readonly_partial (gdb_byte *readbuf,
Otherwise, fall back to remote_read_bytes_1. */
target_xfer_status
-remote_target::remote_read_bytes (CORE_ADDR memaddr,
- gdb_byte *myaddr, ULONGEST len, int unit_size,
+remote_target::remote_read_bytes (CORE_ADDR memaddr, gdb_byte *myaddr,
+ ULONGEST len, int unit_size,
ULONGEST *xfered_len)
{
if (len == 0)
@@ -9478,8 +9420,8 @@ remote_target::remote_read_bytes (CORE_ADDR memaddr,
}
/* This goes through the topmost target again. */
- res = remote_xfer_live_readonly_partial (myaddr, memaddr,
- len, unit_size, xfered_len);
+ res = remote_xfer_live_readonly_partial (myaddr, memaddr, len,
+ unit_size, xfered_len);
if (res == TARGET_XFER_OK)
return TARGET_XFER_OK;
else
@@ -9487,8 +9429,8 @@ remote_target::remote_read_bytes (CORE_ADDR memaddr,
/* No use trying further, we know some memory starting
at MEMADDR isn't available. */
*xfered_len = len;
- return (*xfered_len != 0) ?
- TARGET_XFER_UNAVAILABLE : TARGET_XFER_EOF;
+ return (*xfered_len != 0) ? TARGET_XFER_UNAVAILABLE
+ : TARGET_XFER_EOF;
}
}
@@ -9503,8 +9445,6 @@ remote_target::remote_read_bytes (CORE_ADDR memaddr,
return remote_read_bytes_1 (memaddr, myaddr, len, unit_size, xfered_len);
}
-
-
/* Sends a packet with content determined by the printf format string
FORMAT and the remaining arguments, then gets the reply. Returns
whether the packet was a success, a failure, or unknown. */
@@ -9524,10 +9464,10 @@ remote_target::remote_send_printf (const char *format, ...)
va_end (ap);
if (size >= max_size)
- internal_error (_("Too long remote packet."));
+ internal_error (_ ("Too long remote packet."));
if (putpkt (rs->buf) < 0)
- error (_("Communication problem with target."));
+ error (_ ("Communication problem with target."));
rs->buf[0] = '\0';
getpkt (&rs->buf, 0);
@@ -9548,29 +9488,27 @@ remote_target::flash_erase (ULONGEST address, LONGEST length)
scoped_restore restore_timeout
= make_scoped_restore (&remote_timeout, remote_flash_timeout);
- ret = remote_send_printf ("vFlashErase:%s,%s",
- phex (address, addr_size),
+ ret = remote_send_printf ("vFlashErase:%s,%s", phex (address, addr_size),
phex (length, 4));
switch (ret)
{
case PACKET_UNKNOWN:
- error (_("Remote target does not support flash erase"));
+ error (_ ("Remote target does not support flash erase"));
case PACKET_ERROR:
- error (_("Error erasing flash with vFlashErase packet"));
+ error (_ ("Error erasing flash with vFlashErase packet"));
default:
break;
}
}
target_xfer_status
-remote_target::remote_flash_write (ULONGEST address,
- ULONGEST length, ULONGEST *xfered_len,
- const gdb_byte *data)
+remote_target::remote_flash_write (ULONGEST address, ULONGEST length,
+ ULONGEST *xfered_len, const gdb_byte *data)
{
scoped_restore restore_timeout
= make_scoped_restore (&remote_timeout, remote_flash_timeout);
return remote_write_bytes_aux ("vFlashWrite:", address, data, length, 1,
- xfered_len,'X', 0);
+ xfered_len, 'X', 0);
}
void
@@ -9586,15 +9524,14 @@ remote_target::flash_done ()
switch (ret)
{
case PACKET_UNKNOWN:
- error (_("Remote target does not support vFlashDone"));
+ error (_ ("Remote target does not support vFlashDone"));
case PACKET_ERROR:
- error (_("Error finishing flash operation"));
+ error (_ ("Error finishing flash operation"));
default:
break;
}
}
-
/* Stuff for dealing with the packets which are part of this protocol.
See comment at top of file for details. */
@@ -9623,6 +9560,7 @@ int
remote_target::readchar (int timeout)
{
int ch;
+
struct remote_state *rs = get_remote_state ();
{
@@ -9646,11 +9584,11 @@ remote_target::readchar (int timeout)
{
case SERIAL_EOF:
remote_unpush_target (this);
- throw_error (TARGET_CLOSE_ERROR, _("Remote connection closed"));
+ throw_error (TARGET_CLOSE_ERROR, _ ("Remote connection closed"));
/* no return */
case SERIAL_ERROR:
- unpush_and_perror (this, _("Remote communication error. "
- "Target disconnected."));
+ unpush_and_perror (this, _ ("Remote communication error. "
+ "Target disconnected."));
/* no return */
case SERIAL_TIMEOUT:
break;
@@ -9678,8 +9616,8 @@ remote_target::remote_serial_write (const char *str, int len)
if (serial_write (rs->remote_desc, str, len))
{
- unpush_and_perror (this, _("Remote communication error. "
- "Target disconnected."));
+ unpush_and_perror (this, _ ("Remote communication error. "
+ "Target disconnected."));
}
if (rs->got_ctrlc_during_io)
@@ -9739,13 +9677,12 @@ remote_target::putpkt_binary (const char *buf, int cnt)
case it's not possible to issue a command while the target is
running. This is not a problem in non-stop mode, because in that
case, the stub is always ready to process serial input. */
- if (!target_is_non_stop_p ()
- && target_is_async_p ()
+ if (!target_is_non_stop_p () && target_is_async_p ()
&& rs->waiting_for_stop_reply)
{
- error (_("Cannot execute this command while the target is running.\n"
- "Use the \"interrupt\" command to stop the target\n"
- "and then try again."));
+ error (_ ("Cannot execute this command while the target is running.\n"
+ "Use the \"interrupt\" command to stop the target\n"
+ "and then try again."));
}
/* Copy the packet into buffer BUF2, encapsulating it
@@ -9779,13 +9716,12 @@ remote_target::putpkt_binary (const char *buf, int cnt)
else
max_chars = remote_packet_max_chars;
- std::string str
- = escape_buffer (buf2, std::min (len, max_chars));
+ std::string str = escape_buffer (buf2, std::min (len, max_chars));
if (len > max_chars)
- remote_debug_printf_nofunc
- ("Sending packet: %s [%d bytes omitted]", str.c_str (),
- len - max_chars);
+ remote_debug_printf_nofunc (
+ "Sending packet: %s [%d bytes omitted]", str.c_str (),
+ len - max_chars);
else
remote_debug_printf_nofunc ("Sending packet: %s", str.c_str ());
}
@@ -9814,7 +9750,7 @@ remote_target::putpkt_binary (const char *buf, int cnt)
tcount++;
if (tcount > 3)
return 0;
- break; /* Retransmit buffer. */
+ break; /* Retransmit buffer. */
case '$':
{
remote_debug_printf ("Packet instead of Ack, ignoring it");
@@ -9824,7 +9760,7 @@ remote_target::putpkt_binary (const char *buf, int cnt)
packet. */
skip_frame ();
remote_serial_write ("+", 1);
- continue; /* Now, go look for +. */
+ continue; /* Now, go look for +. */
}
case '%':
@@ -9838,9 +9774,9 @@ remote_target::putpkt_binary (const char *buf, int cnt)
val = read_frame (&rs->buf);
if (val >= 0)
{
- remote_debug_printf_nofunc
- (" Notification received: %s",
- escape_buffer (rs->buf.data (), val).c_str ());
+ remote_debug_printf_nofunc (
+ " Notification received: %s",
+ escape_buffer (rs->buf.data (), val).c_str ());
handle_notification (rs->notif_state, rs->buf.data ());
/* We're in sync now, rewait for the ack. */
@@ -9857,7 +9793,7 @@ remote_target::putpkt_binary (const char *buf, int cnt)
rs->buf.data ());
continue;
}
- break; /* Here to retransmit. */
+ break; /* Here to retransmit. */
}
#if 0
@@ -9900,7 +9836,7 @@ remote_target::skip_frame ()
c = readchar (remote_timeout);
return;
- case '*': /* Run length encoding. */
+ case '*': /* Run length encoding. */
/* Discard the repeat count. */
c = readchar (remote_timeout);
if (c < 0)
@@ -9945,7 +9881,7 @@ remote_target::read_frame (gdb::char_vector *buf_p)
case '$':
remote_debug_printf ("Saw new packet start in middle of old one");
- return -1; /* Start a new packet, count retries. */
+ return -1; /* Start a new packet, count retries. */
case '#':
{
@@ -9980,22 +9916,22 @@ remote_target::read_frame (gdb::char_vector *buf_p)
if (csum == pktcsum)
return bc;
- remote_debug_printf
- ("Bad checksum, sentsum=0x%x, csum=0x%x, buf=%s",
- pktcsum, csum, escape_buffer (buf, bc).c_str ());
+ remote_debug_printf (
+ "Bad checksum, sentsum=0x%x, csum=0x%x, buf=%s", pktcsum, csum,
+ escape_buffer (buf, bc).c_str ());
/* Number of characters in buffer ignoring trailing
NULL. */
return -1;
}
- case '*': /* Run length encoding. */
+ case '*': /* Run length encoding. */
{
int repeat;
csum += c;
c = readchar (remote_timeout);
csum += c;
- repeat = c - ' ' + 3; /* Compute repeat count. */
+ repeat = c - ' ' + 3; /* Compute repeat count. */
/* The character before ``*'' is repeated. */
@@ -10014,7 +9950,7 @@ remote_target::read_frame (gdb::char_vector *buf_p)
}
buf[bc] = '\0';
- gdb_printf (_("Invalid run length encoding: %s\n"), buf);
+ gdb_printf (_ ("Invalid run length encoding: %s\n"), buf);
return -1;
}
default:
@@ -10039,11 +9975,12 @@ remote_target::read_frame (gdb::char_vector *buf_p)
and one with slow communications. */
static int watchdog = 0;
+
static void
-show_watchdog (struct ui_file *file, int from_tty,
- struct cmd_list_element *c, const char *value)
+show_watchdog (struct ui_file *file, int from_tty, struct cmd_list_element *c,
+ const char *value)
{
- gdb_printf (file, _("Watchdog timer is %s.\n"), value);
+ gdb_printf (file, _ ("Watchdog timer is %s.\n"), value);
}
/* Read a packet from the remote machine, with error checking, and
@@ -10062,7 +9999,6 @@ remote_target::getpkt (gdb::char_vector *buf, int forever)
getpkt_sane (buf, forever);
}
-
/* Read a packet from the remote machine, with error checking, and
store it in *BUF. Resize *BUF if necessary to hold the result. If
FOREVER, wait forever rather than timing out; this is used (in
@@ -10075,9 +10011,8 @@ remote_target::getpkt (gdb::char_vector *buf, int forever)
holds a notification or not (a regular packet). */
int
-remote_target::getpkt_or_notif_sane_1 (gdb::char_vector *buf,
- int forever, int expecting_notif,
- int *is_notif)
+remote_target::getpkt_or_notif_sane_1 (gdb::char_vector *buf, int forever,
+ int expecting_notif, int *is_notif)
{
struct remote_state *rs = get_remote_state ();
int c;
@@ -10124,12 +10059,12 @@ remote_target::getpkt_or_notif_sane_1 (gdb::char_vector *buf,
return -1; /* Don't complain, it's normal to not get
anything in this case. */
- if (forever) /* Watchdog went off? Kill the target. */
+ if (forever) /* Watchdog went off? Kill the target. */
{
remote_unpush_target (this);
throw_error (TARGET_CLOSE_ERROR,
- _("Watchdog timeout has expired. "
- "Target detached."));
+ _ ("Watchdog timeout has expired. "
+ "Target detached."));
}
remote_debug_printf ("Timed out.");
@@ -10150,7 +10085,7 @@ remote_target::getpkt_or_notif_sane_1 (gdb::char_vector *buf,
{
/* We have tried hard enough, and just can't receive the
packet/notification. Give up. */
- gdb_printf (_("Ignoring packet error, continuing...\n"));
+ gdb_printf (_ ("Ignoring packet error, continuing...\n"));
/* Skip the ack char if we're in no-ack mode. */
if (!rs->noack_mode)
@@ -10171,13 +10106,12 @@ remote_target::getpkt_or_notif_sane_1 (gdb::char_vector *buf,
max_chars = remote_packet_max_chars;
std::string str
- = escape_buffer (buf->data (),
- std::min (val, max_chars));
+ = escape_buffer (buf->data (), std::min (val, max_chars));
if (val > max_chars)
- remote_debug_printf_nofunc
- ("Packet received: %s [%d bytes omitted]", str.c_str (),
- val - max_chars);
+ remote_debug_printf_nofunc (
+ "Packet received: %s [%d bytes omitted]", str.c_str (),
+ val - max_chars);
else
remote_debug_printf_nofunc ("Packet received: %s",
str.c_str ());
@@ -10191,15 +10125,15 @@ remote_target::getpkt_or_notif_sane_1 (gdb::char_vector *buf,
return val;
}
- /* If we got a notification, handle it, and go back to looking
+ /* If we got a notification, handle it, and go back to looking
for a packet. */
else
{
gdb_assert (c == '%');
- remote_debug_printf_nofunc
- (" Notification received: %s",
- escape_buffer (buf->data (), val).c_str ());
+ remote_debug_printf_nofunc (
+ " Notification received: %s",
+ escape_buffer (buf->data (), val).c_str ());
if (is_notif != NULL)
*is_notif = 1;
@@ -10249,7 +10183,7 @@ remote_target::kill_new_fork_children (inferior *inf)
int res = remote_vkill (child_pid);
if (res != 0)
- error (_("Can't kill fork child process %d"), child_pid);
+ error (_ ("Can't kill fork child process %d"), child_pid);
}
/* Check for any pending fork events (not reported or processed yet)
@@ -10267,11 +10201,10 @@ remote_target::kill_new_fork_children (inferior *inf)
int res = remote_vkill (child_pid);
if (res != 0)
- error (_("Can't kill fork child process %d"), child_pid);
+ error (_ ("Can't kill fork child process %d"), child_pid);
}
}
-
/* Target hook to kill the current inferior. */
void
@@ -10315,7 +10248,7 @@ remote_target::kill ()
return;
}
- error (_("Can't kill process"));
+ error (_ ("Can't kill process"));
}
/* Send a kill request to the target using the 'vKill' packet. */
@@ -10342,7 +10275,7 @@ remote_target::remote_vkill (int pid)
case PACKET_UNKNOWN:
return -1;
default:
- internal_error (_("Bad result from packet_ok"));
+ internal_error (_ ("Bad result from packet_ok"));
}
}
@@ -10444,9 +10377,9 @@ remote_target::extended_remote_disable_randomization (int val)
putpkt (rs->buf);
reply = remote_get_noisy_reply ();
if (*reply == '\0')
- error (_("Target does not support QDisableRandomization."));
+ error (_ ("Target does not support QDisableRandomization."));
if (strcmp (reply, "OK") != 0)
- error (_("Bogus QDisableRandomization reply from target: %s"), reply);
+ error (_ ("Bogus QDisableRandomization reply from target: %s"), reply);
}
int
@@ -10465,9 +10398,10 @@ remote_target::extended_remote_run (const std::string &args)
len = strlen (rs->buf.data ());
if (strlen (remote_exec_file) * 2 + len >= get_remote_packet_size ())
- error (_("Remote file name too long for run packet"));
- len += 2 * bin2hex ((gdb_byte *) remote_exec_file, rs->buf.data () + len,
- strlen (remote_exec_file));
+ error (_ ("Remote file name too long for run packet"));
+ len += 2
+ * bin2hex ((gdb_byte *) remote_exec_file, rs->buf.data () + len,
+ strlen (remote_exec_file));
if (!args.empty ())
{
@@ -10477,10 +10411,11 @@ remote_target::extended_remote_run (const std::string &args)
for (i = 0; argv[i] != NULL; i++)
{
if (strlen (argv[i]) * 2 + 1 + len >= get_remote_packet_size ())
- error (_("Argument list too long for run packet"));
+ error (_ ("Argument list too long for run packet"));
rs->buf[len++] = ';';
- len += 2 * bin2hex ((gdb_byte *) argv[i], rs->buf.data () + len,
- strlen (argv[i]));
+ len += 2
+ * bin2hex ((gdb_byte *) argv[i], rs->buf.data () + len,
+ strlen (argv[i]));
}
}
@@ -10498,10 +10433,11 @@ remote_target::extended_remote_run (const std::string &args)
return -1;
case PACKET_ERROR:
if (remote_exec_file[0] == '\0')
- error (_("Running the default executable on the remote target failed; "
- "try \"set remote exec-file\"?"));
+ error (
+ _ ("Running the default executable on the remote target failed; "
+ "try \"set remote exec-file\"?"));
else
- error (_("Running \"%s\" on the remote target failed"),
+ error (_ ("Running \"%s\" on the remote target failed"),
remote_exec_file);
default:
gdb_assert_not_reached ("bad switch");
@@ -10514,25 +10450,24 @@ remote_target::extended_remote_run (const std::string &args)
sent. */
void
-remote_target::send_environment_packet (const char *action,
- const char *packet,
+remote_target::send_environment_packet (const char *action, const char *packet,
const char *value)
{
remote_state *rs = get_remote_state ();
/* Convert the environment variable to an hex string, which
is the best format to be transmitted over the wire. */
- std::string encoded_value = bin2hex ((const gdb_byte *) value,
- strlen (value));
+ std::string encoded_value
+ = bin2hex ((const gdb_byte *) value, strlen (value));
- xsnprintf (rs->buf.data (), get_remote_packet_size (),
- "%s:%s", packet, encoded_value.c_str ());
+ xsnprintf (rs->buf.data (), get_remote_packet_size (), "%s:%s", packet,
+ encoded_value.c_str ());
putpkt (rs->buf);
getpkt (&rs->buf, 0);
if (strcmp (rs->buf.data (), "OK") != 0)
- warning (_("Unable to %s environment variable '%s' on remote."),
- action, value);
+ warning (_ ("Unable to %s environment variable '%s' on remote."), action,
+ value);
}
/* Helper function to handle the QEnvironment* packets. */
@@ -10547,7 +10482,7 @@ remote_target::extended_remote_environment_support ()
putpkt ("QEnvironmentReset");
getpkt (&rs->buf, 0);
if (strcmp (rs->buf.data (), "OK") != 0)
- warning (_("Unable to reset environment on remote."));
+ warning (_ ("Unable to reset environment on remote."));
}
gdb_environ *e = &current_inferior ()->environment;
@@ -10556,11 +10491,9 @@ remote_target::extended_remote_environment_support ()
!= PACKET_DISABLE)
{
for (const std::string &el : e->user_set_env ())
- send_environment_packet ("set", "QEnvironmentHexEncoded",
- el.c_str ());
+ send_environment_packet ("set", "QEnvironmentHexEncoded", el.c_str ());
}
-
if (m_features.packet_support (PACKET_QEnvironmentUnset) != PACKET_DISABLE)
for (const std::string &el : e->user_unset_env ())
send_environment_packet ("unset", "QEnvironmentUnset", el.c_str ());
@@ -10597,11 +10530,10 @@ remote_target::extended_remote_set_inferior_cwd ()
putpkt (rs->buf);
getpkt (&rs->buf, 0);
if (m_features.packet_ok (rs->buf, PACKET_QSetWorkingDir) != PACKET_OK)
- error (_("\
+ error (_ ("\
Remote replied unexpectedly while setting the inferior's working\n\
directory: %s"),
rs->buf.data ());
-
}
}
@@ -10613,8 +10545,8 @@ directory: %s"),
void
extended_remote_target::create_inferior (const char *exec_file,
- const std::string &args,
- char **env, int from_tty)
+ const std::string &args, char **env,
+ int from_tty)
{
int run_worked;
char *stop_reply;
@@ -10639,7 +10571,7 @@ extended_remote_target::create_inferior (const char *exec_file,
putpkt (rs->buf);
getpkt (&rs->buf, 0);
if (strcmp (rs->buf.data (), "OK") != 0)
- error (_("\
+ error (_ ("\
Remote replied unexpectedly while setting startup-with-shell: %s"),
rs->buf.data ());
}
@@ -10655,9 +10587,9 @@ Remote replied unexpectedly while setting startup-with-shell: %s"),
/* vRun was not supported. Fail if we need it to do what the
user requested. */
if (remote_exec_file[0])
- error (_("Remote target does not support \"set remote exec-file\""));
+ error (_ ("Remote target does not support \"set remote exec-file\""));
if (!args.empty ())
- error (_("Remote target does not support \"set args\" or run ARGS"));
+ error (_ ("Remote target does not support \"set args\" or run ARGS"));
/* Fall back to "R". */
extended_remote_restart ();
@@ -10670,7 +10602,6 @@ Remote replied unexpectedly while setting startup-with-shell: %s"),
/* Get updated offsets, if the stub uses qOffsets. */
get_offsets ();
}
-
/* Given a location's target info BP_TGT and the packet buffer BUF, output
the list of conditions (in agent expression bytecode format), if any, the
@@ -10783,7 +10714,7 @@ remote_target::insert_breakpoint (struct gdbarch *gdbarch,
/* If this breakpoint has target-side commands but this stub doesn't
support Z0 packets, throw error. */
if (!bp_tgt->tcommands.empty ())
- throw_error (NOT_SUPPORTED_ERROR, _("\
+ throw_error (NOT_SUPPORTED_ERROR, _ ("\
Target doesn't support breakpoints that have target side commands."));
return memory_insert_breakpoint (this, gdbarch, bp_tgt);
@@ -10839,13 +10770,14 @@ watchpoint_to_Z_packet (int type)
return Z_PACKET_ACCESS_WP;
break;
default:
- internal_error (_("hw_bp_to_z: bad watchpoint type %d"), type);
+ internal_error (_ ("hw_bp_to_z: bad watchpoint type %d"), type);
}
}
int
remote_target::insert_watchpoint (CORE_ADDR addr, int len,
- enum target_hw_bp_type type, struct expression *cond)
+ enum target_hw_bp_type type,
+ struct expression *cond)
{
struct remote_state *rs = get_remote_state ();
char *endbuf = rs->buf.data () + get_remote_packet_size ();
@@ -10878,22 +10810,22 @@ remote_target::insert_watchpoint (CORE_ADDR addr, int len,
case PACKET_OK:
return 0;
}
- internal_error (_("remote_insert_watchpoint: reached end of function"));
+ internal_error (_ ("remote_insert_watchpoint: reached end of function"));
}
bool
-remote_target::watchpoint_addr_within_range (CORE_ADDR addr,
- CORE_ADDR start, int length)
+remote_target::watchpoint_addr_within_range (CORE_ADDR addr, CORE_ADDR start,
+ int length)
{
CORE_ADDR diff = remote_address_masked (addr - start);
return diff < length;
}
-
int
remote_target::remove_watchpoint (CORE_ADDR addr, int len,
- enum target_hw_bp_type type, struct expression *cond)
+ enum target_hw_bp_type type,
+ struct expression *cond)
{
struct remote_state *rs = get_remote_state ();
char *endbuf = rs->buf.data () + get_remote_packet_size ();
@@ -10924,10 +10856,9 @@ remote_target::remove_watchpoint (CORE_ADDR addr, int len,
case PACKET_OK:
return 0;
}
- internal_error (_("remote_remove_watchpoint: reached end of function"));
+ internal_error (_ ("remote_remove_watchpoint: reached end of function"));
}
-
static int remote_hw_watchpoint_limit = -1;
static int remote_hw_watchpoint_length_limit = -1;
static int remote_hw_breakpoint_limit = -1;
@@ -11039,7 +10970,6 @@ remote_target::stopped_data_address (CORE_ADDR *addr_p)
return false;
}
-
int
remote_target::insert_hw_breakpoint (struct gdbarch *gdbarch,
struct bp_target_info *bp_tgt)
@@ -11085,7 +11015,7 @@ remote_target::insert_hw_breakpoint (struct gdbarch *gdbarch,
{
message = strchr (&rs->buf[2], '.');
if (message)
- error (_("Remote failure reply: %s"), message + 1);
+ error (_ ("Remote failure reply: %s"), message + 1);
}
return -1;
case PACKET_UNKNOWN:
@@ -11093,10 +11023,9 @@ remote_target::insert_hw_breakpoint (struct gdbarch *gdbarch,
case PACKET_OK:
return 0;
}
- internal_error (_("remote_insert_hw_breakpoint: reached end of function"));
+ internal_error (_ ("remote_insert_hw_breakpoint: reached end of function"));
}
-
int
remote_target::remove_hw_breakpoint (struct gdbarch *gdbarch,
struct bp_target_info *bp_tgt)
@@ -11120,7 +11049,7 @@ remote_target::remove_hw_breakpoint (struct gdbarch *gdbarch,
addr = remote_address_masked (bp_tgt->placed_address);
p += hexnumstr (p, (ULONGEST) addr);
- xsnprintf (p, endbuf - p, ",%x", bp_tgt->kind);
+ xsnprintf (p, endbuf - p, ",%x", bp_tgt->kind);
putpkt (rs->buf);
getpkt (&rs->buf, 0);
@@ -11133,13 +11062,14 @@ remote_target::remove_hw_breakpoint (struct gdbarch *gdbarch,
case PACKET_OK:
return 0;
}
- internal_error (_("remote_remove_hw_breakpoint: reached end of function"));
+ internal_error (_ ("remote_remove_hw_breakpoint: reached end of function"));
}
/* Verify memory using the "qCRC:" request. */
int
-remote_target::verify_memory (const gdb_byte *data, CORE_ADDR lma, ULONGEST size)
+remote_target::verify_memory (const gdb_byte *data, CORE_ADDR lma,
+ ULONGEST size)
{
struct remote_state *rs = get_remote_state ();
unsigned long host_crc, target_crc;
@@ -11200,7 +11130,7 @@ compare_sections_command (const char *args, int from_tty)
int read_only = 0;
if (!current_program_space->exec_bfd ())
- error (_("command cannot be used without an exec file"));
+ error (_ ("command cannot be used without an exec file"));
if (args != NULL && strcmp (args, "-r") == 0)
{
@@ -11211,20 +11141,20 @@ compare_sections_command (const char *args, int from_tty)
for (s = current_program_space->exec_bfd ()->sections; s; s = s->next)
{
if (!(s->flags & SEC_LOAD))
- continue; /* Skip non-loadable section. */
+ continue; /* Skip non-loadable section. */
if (read_only && (s->flags & SEC_READONLY) == 0)
- continue; /* Skip writeable sections */
+ continue; /* Skip writeable sections */
size = bfd_section_size (s);
if (size == 0)
- continue; /* Skip zero-length section. */
+ continue; /* Skip zero-length section. */
sectname = bfd_section_name (s);
if (args && strcmp (args, sectname) != 0)
- continue; /* Not the section selected by user. */
+ continue; /* Not the section selected by user. */
- matched = 1; /* Do this section. */
+ matched = 1; /* Do this section. */
lma = s->lma;
gdb::byte_vector sectdata (size);
@@ -11234,7 +11164,7 @@ compare_sections_command (const char *args, int from_tty)
res = target_verify_memory (sectdata.data (), lma, size);
if (res == -1)
- error (_("target memory fault, section %s, range %s -- %s"), sectname,
+ error (_ ("target memory fault, section %s, range %s -- %s"), sectname,
paddress (target_gdbarch (), lma),
paddress (target_gdbarch (), lma + size));
@@ -11250,10 +11180,10 @@ compare_sections_command (const char *args, int from_tty)
}
}
if (mismatched > 0)
- warning (_("One or more sections of the target image does not match\n\
+ warning (_ ("One or more sections of the target image does not match\n\
the loaded file\n"));
if (args && !matched)
- gdb_printf (_("No loaded section named '%s'.\n"), args);
+ gdb_printf (_ ("No loaded section named '%s'.\n"), args);
}
/* Write LEN bytes from WRITEBUF into OBJECT_NAME/ANNEX at OFFSET
@@ -11261,30 +11191,29 @@ the loaded file\n"));
target is returned, or -1 for error. */
target_xfer_status
-remote_target::remote_write_qxfer (const char *object_name,
- const char *annex, const gdb_byte *writebuf,
- ULONGEST offset, LONGEST len,
- ULONGEST *xfered_len,
+remote_target::remote_write_qxfer (const char *object_name, const char *annex,
+ const gdb_byte *writebuf, ULONGEST offset,
+ LONGEST len, ULONGEST *xfered_len,
const unsigned int which_packet)
{
int i, buf_len;
ULONGEST n;
struct remote_state *rs = get_remote_state ();
- int max_size = get_memory_write_packet_size ();
+ int max_size = get_memory_write_packet_size ();
if (m_features.packet_support (which_packet) == PACKET_DISABLE)
return TARGET_XFER_E_IO;
/* Insert header. */
- i = snprintf (rs->buf.data (), max_size,
- "qXfer:%s:write:%s:%s:",
- object_name, annex ? annex : "",
+ i = snprintf (rs->buf.data (), max_size,
+ "qXfer:%s:write:%s:%s:", object_name, annex ? annex : "",
phex_nz (offset, sizeof offset));
max_size -= (i + 1);
/* Escape as much data as fits into rs->buf. */
- buf_len = remote_escape_output
- (writebuf, len, 1, (gdb_byte *) rs->buf.data () + i, &max_size, max_size);
+ buf_len
+ = remote_escape_output (writebuf, len, 1, (gdb_byte *) rs->buf.data () + i,
+ &max_size, max_size);
if (putpkt_binary (rs->buf.data (), i + buf_len) < 0
|| getpkt_sane (&rs->buf, 0) < 0
@@ -11305,11 +11234,9 @@ remote_target::remote_write_qxfer (const char *object_name,
target supports this object. */
target_xfer_status
-remote_target::remote_read_qxfer (const char *object_name,
- const char *annex,
+remote_target::remote_read_qxfer (const char *object_name, const char *annex,
gdb_byte *readbuf, ULONGEST offset,
- LONGEST len,
- ULONGEST *xfered_len,
+ LONGEST len, ULONGEST *xfered_len,
const unsigned int which_packet)
{
struct remote_state *rs = get_remote_state ();
@@ -11327,7 +11254,6 @@ remote_target::remote_read_qxfer (const char *object_name,
&& offset == rs->finished_offset)
return TARGET_XFER_EOF;
-
/* Otherwise, we're now reading something different. Discard
the cache. */
xfree (rs->finished_object);
@@ -11342,10 +11268,8 @@ remote_target::remote_read_qxfer (const char *object_name,
five to account for the response type and the protocol frame. */
n = std::min<LONGEST> (get_remote_packet_size () - 5, len);
snprintf (rs->buf.data (), get_remote_packet_size () - 4,
- "qXfer:%s:read:%s:%s,%s",
- object_name, annex ? annex : "",
- phex_nz (offset, sizeof offset),
- phex_nz (n, sizeof n));
+ "qXfer:%s:read:%s:%s,%s", object_name, annex ? annex : "",
+ phex_nz (offset, sizeof offset), phex_nz (n, sizeof n));
i = putpkt (rs->buf);
if (i < 0)
return TARGET_XFER_E_IO;
@@ -11357,17 +11281,17 @@ remote_target::remote_read_qxfer (const char *object_name,
return TARGET_XFER_E_IO;
if (rs->buf[0] != 'l' && rs->buf[0] != 'm')
- error (_("Unknown remote qXfer reply: %s"), rs->buf.data ());
+ error (_ ("Unknown remote qXfer reply: %s"), rs->buf.data ());
/* 'm' means there is (or at least might be) more data after this
batch. That does not make sense unless there's at least one byte
of data in this reply. */
if (rs->buf[0] == 'm' && packet_len == 1)
- error (_("Remote qXfer reply contained no data."));
+ error (_ ("Remote qXfer reply contained no data."));
/* Got some data. */
- i = remote_unescape_input ((gdb_byte *) rs->buf.data () + 1,
- packet_len - 1, readbuf, n);
+ i = remote_unescape_input ((gdb_byte *) rs->buf.data () + 1, packet_len - 1,
+ readbuf, n);
/* 'l' is an EOF marker, possibly including a final block of data,
or possibly empty. If we have the final block of a non-empty
@@ -11389,9 +11313,9 @@ remote_target::remote_read_qxfer (const char *object_name,
}
enum target_xfer_status
-remote_target::xfer_partial (enum target_object object,
- const char *annex, gdb_byte *readbuf,
- const gdb_byte *writebuf, ULONGEST offset, ULONGEST len,
+remote_target::xfer_partial (enum target_object object, const char *annex,
+ gdb_byte *readbuf, const gdb_byte *writebuf,
+ ULONGEST offset, ULONGEST len,
ULONGEST *xfered_len)
{
struct remote_state *rs;
@@ -11418,8 +11342,7 @@ remote_target::xfer_partial (enum target_object object,
return remote_write_bytes (offset, writebuf, len, unit_size,
xfered_len);
else
- return remote_read_bytes (offset, readbuf, len, unit_size,
- xfered_len);
+ return remote_read_bytes (offset, readbuf, len, unit_size, xfered_len);
}
/* Handle extra signal info using qxfer packets. */
@@ -11436,9 +11359,8 @@ remote_target::xfer_partial (enum target_object object,
if (object == TARGET_OBJECT_STATIC_TRACE_DATA)
{
if (readbuf)
- return remote_read_qxfer ("statictrace", annex,
- readbuf, offset, len, xfered_len,
- PACKET_qXfer_statictrace_read);
+ return remote_read_qxfer ("statictrace", annex, readbuf, offset, len,
+ xfered_len, PACKET_qXfer_statictrace_read);
else
return TARGET_XFER_E_IO;
}
@@ -11449,8 +11371,7 @@ remote_target::xfer_partial (enum target_object object,
switch (object)
{
case TARGET_OBJECT_FLASH:
- return remote_flash_write (offset, len, xfered_len,
- writebuf);
+ return remote_flash_write (offset, len, xfered_len, writebuf);
default:
return TARGET_XFER_E_IO;
@@ -11467,71 +11388,61 @@ remote_target::xfer_partial (enum target_object object,
case TARGET_OBJECT_AUXV:
gdb_assert (annex == NULL);
- return remote_read_qxfer
- ("auxv", annex, readbuf, offset, len, xfered_len, PACKET_qXfer_auxv);
+ return remote_read_qxfer ("auxv", annex, readbuf, offset, len,
+ xfered_len, PACKET_qXfer_auxv);
case TARGET_OBJECT_AVAILABLE_FEATURES:
- return remote_read_qxfer
- ("features", annex, readbuf, offset, len, xfered_len,
- PACKET_qXfer_features);
+ return remote_read_qxfer ("features", annex, readbuf, offset, len,
+ xfered_len, PACKET_qXfer_features);
case TARGET_OBJECT_LIBRARIES:
- return remote_read_qxfer
- ("libraries", annex, readbuf, offset, len, xfered_len,
- PACKET_qXfer_libraries);
+ return remote_read_qxfer ("libraries", annex, readbuf, offset, len,
+ xfered_len, PACKET_qXfer_libraries);
case TARGET_OBJECT_LIBRARIES_SVR4:
- return remote_read_qxfer
- ("libraries-svr4", annex, readbuf, offset, len, xfered_len,
- PACKET_qXfer_libraries_svr4);
+ return remote_read_qxfer ("libraries-svr4", annex, readbuf, offset, len,
+ xfered_len, PACKET_qXfer_libraries_svr4);
case TARGET_OBJECT_MEMORY_MAP:
gdb_assert (annex == NULL);
- return remote_read_qxfer
- ("memory-map", annex, readbuf, offset, len, xfered_len,
- PACKET_qXfer_memory_map);
+ return remote_read_qxfer ("memory-map", annex, readbuf, offset, len,
+ xfered_len, PACKET_qXfer_memory_map);
case TARGET_OBJECT_OSDATA:
/* Should only get here if we're connected. */
gdb_assert (rs->remote_desc);
- return remote_read_qxfer
- ("osdata", annex, readbuf, offset, len, xfered_len,
- PACKET_qXfer_osdata);
+ return remote_read_qxfer ("osdata", annex, readbuf, offset, len,
+ xfered_len, PACKET_qXfer_osdata);
case TARGET_OBJECT_THREADS:
gdb_assert (annex == NULL);
- return remote_read_qxfer
- ("threads", annex, readbuf, offset, len, xfered_len,
- PACKET_qXfer_threads);
+ return remote_read_qxfer ("threads", annex, readbuf, offset, len,
+ xfered_len, PACKET_qXfer_threads);
case TARGET_OBJECT_TRACEFRAME_INFO:
gdb_assert (annex == NULL);
- return remote_read_qxfer
- ("traceframe-info", annex, readbuf, offset, len, xfered_len,
- PACKET_qXfer_traceframe_info);
+ return remote_read_qxfer ("traceframe-info", annex, readbuf, offset, len,
+ xfered_len, PACKET_qXfer_traceframe_info);
case TARGET_OBJECT_FDPIC:
- return remote_read_qxfer
- ("fdpic", annex, readbuf, offset, len, xfered_len, PACKET_qXfer_fdpic);
+ return remote_read_qxfer ("fdpic", annex, readbuf, offset, len,
+ xfered_len, PACKET_qXfer_fdpic);
case TARGET_OBJECT_OPENVMS_UIB:
- return remote_read_qxfer
- ("uib", annex, readbuf, offset, len, xfered_len, PACKET_qXfer_uib);
+ return remote_read_qxfer ("uib", annex, readbuf, offset, len, xfered_len,
+ PACKET_qXfer_uib);
case TARGET_OBJECT_BTRACE:
- return remote_read_qxfer
- ("btrace", annex, readbuf, offset, len, xfered_len,
- PACKET_qXfer_btrace);
+ return remote_read_qxfer ("btrace", annex, readbuf, offset, len,
+ xfered_len, PACKET_qXfer_btrace);
case TARGET_OBJECT_BTRACE_CONF:
- return remote_read_qxfer
- ("btrace-conf", annex, readbuf, offset, len, xfered_len,
- PACKET_qXfer_btrace_conf);
+ return remote_read_qxfer ("btrace-conf", annex, readbuf, offset, len,
+ xfered_len, PACKET_qXfer_btrace_conf);
case TARGET_OBJECT_EXEC_FILE:
- return remote_read_qxfer
- ("exec-file", annex, readbuf, offset, len, xfered_len,
- PACKET_qXfer_exec_file);
+ return remote_read_qxfer ("exec-file", annex, readbuf, offset, len,
+ xfered_len, PACKET_qXfer_exec_file);
default:
return TARGET_XFER_E_IO;
@@ -11545,7 +11456,7 @@ remote_target::xfer_partial (enum target_object object,
/* Except for querying the minimum buffer size, target must be open. */
if (!rs->remote_desc)
- error (_("remote query is only available after target open"));
+ error (_ ("remote query is only available after target open"));
gdb_assert (annex != NULL);
gdb_assert (readbuf != NULL);
@@ -11607,11 +11518,10 @@ remote_target::search_memory (CORE_ADDR start_addr, ULONGEST search_space_len,
int found;
ULONGEST found_addr;
- auto read_memory = [=] (CORE_ADDR addr, gdb_byte *result, size_t len)
- {
- return (target_read (this, TARGET_OBJECT_MEMORY, NULL, result, addr, len)
- == len);
- };
+ auto read_memory = [=] (CORE_ADDR addr, gdb_byte *result, size_t len) {
+ return (target_read (this, TARGET_OBJECT_MEMORY, NULL, result, addr, len)
+ == len);
+ };
/* Don't go to the target if we don't have to. This is done before
checking packet_support to avoid the possibility that a success for this
@@ -11639,21 +11549,19 @@ remote_target::search_memory (CORE_ADDR start_addr, ULONGEST search_space_len,
set_general_process ();
/* Insert header. */
- i = snprintf (rs->buf.data (), max_size,
- "qSearch:memory:%s;%s;",
+ i = snprintf (rs->buf.data (), max_size, "qSearch:memory:%s;%s;",
phex_nz (start_addr, addr_size),
phex_nz (search_space_len, sizeof (search_space_len)));
max_size -= (i + 1);
/* Escape as much data as fits into rs->buf. */
- escaped_pattern_len =
- remote_escape_output (pattern, pattern_len, 1,
- (gdb_byte *) rs->buf.data () + i,
- &used_pattern_len, max_size);
+ escaped_pattern_len = remote_escape_output (pattern, pattern_len, 1,
+ (gdb_byte *) rs->buf.data () + i,
+ &used_pattern_len, max_size);
/* Bail if the pattern is too large. */
if (used_pattern_len != pattern_len)
- error (_("Pattern is too large to transmit to remote target."));
+ error (_ ("Pattern is too large to transmit to remote target."));
if (putpkt_binary (rs->buf.data (), i + escaped_pattern_len) < 0
|| getpkt_sane (&rs->buf, 0) < 0
@@ -11663,8 +11571,9 @@ remote_target::search_memory (CORE_ADDR start_addr, ULONGEST search_space_len,
supported. If so, fall back to the simple way. */
if (m_features.packet_support (PACKET_qSearch_memory) == PACKET_DISABLE)
{
- return simple_search_memory (read_memory, start_addr, search_space_len,
- pattern, pattern_len, found_addrp);
+ return simple_search_memory (read_memory, start_addr,
+ search_space_len, pattern, pattern_len,
+ found_addrp);
}
return -1;
}
@@ -11675,12 +11584,12 @@ remote_target::search_memory (CORE_ADDR start_addr, ULONGEST search_space_len,
{
found = 1;
if (rs->buf[1] != ',')
- error (_("Unknown qSearch:memory reply: %s"), rs->buf.data ());
+ error (_ ("Unknown qSearch:memory reply: %s"), rs->buf.data ());
unpack_varlen_hex (&rs->buf[2], &found_addr);
*found_addrp = found_addr;
}
else
- error (_("Unknown qSearch:memory reply: %s"), rs->buf.data ());
+ error (_ ("Unknown qSearch:memory reply: %s"), rs->buf.data ());
return found;
}
@@ -11692,7 +11601,7 @@ remote_target::rcmd (const char *command, struct ui_file *outbuf)
char *p = rs->buf.data ();
if (!rs->remote_desc)
- error (_("remote rcmd is only available after target open"));
+ error (_ ("remote rcmd is only available after target open"));
/* Send a NULL command across as an empty command. */
if (command == NULL)
@@ -11702,15 +11611,15 @@ remote_target::rcmd (const char *command, struct ui_file *outbuf)
strcpy (rs->buf.data (), "qRcmd,");
p = strchr (rs->buf.data (), '\0');
- if ((strlen (rs->buf.data ()) + strlen (command) * 2 + 8/*misc*/)
+ if ((strlen (rs->buf.data ()) + strlen (command) * 2 + 8 /*misc*/)
> get_remote_packet_size ())
- error (_("\"monitor\" command ``%s'' is too long."), command);
+ error (_ ("\"monitor\" command ``%s'' is too long."), command);
/* Encode the actual command. */
bin2hex ((const gdb_byte *) command, p, strlen (command));
if (putpkt (rs->buf) < 0)
- error (_("Communication problem with target."));
+ error (_ ("Communication problem with target."));
/* get/display the response */
while (1)
@@ -11718,10 +11627,10 @@ remote_target::rcmd (const char *command, struct ui_file *outbuf)
char *buf;
/* XXX - see also remote_get_noisy_reply(). */
- QUIT; /* Allow user to bail out with ^C. */
+ QUIT; /* Allow user to bail out with ^C. */
rs->buf[0] = '\0';
if (getpkt_sane (&rs->buf, 0) == -1)
- {
+ {
/* Timeout. Continue to (try to) read responses.
This is better than stopping with an error, assuming the stub
is still executing the (long) monitor command.
@@ -11731,7 +11640,7 @@ remote_target::rcmd (const char *command, struct ui_file *outbuf)
}
buf = rs->buf.data ();
if (buf[0] == '\0')
- error (_("Target does not support this command."));
+ error (_ ("Target does not support this command."));
if (buf[0] == 'O' && buf[1] != 'K')
{
remote_console_output (buf + 1); /* 'O' message from stub. */
@@ -11739,10 +11648,10 @@ remote_target::rcmd (const char *command, struct ui_file *outbuf)
}
if (strcmp (buf, "OK") == 0)
break;
- if (strlen (buf) == 3 && buf[0] == 'E'
- && isxdigit (buf[1]) && isxdigit (buf[2]))
+ if (strlen (buf) == 3 && buf[0] == 'E' && isxdigit (buf[1])
+ && isxdigit (buf[2]))
{
- error (_("Protocol error with Rcmd"));
+ error (_ ("Protocol error with Rcmd"));
}
for (p = buf; p[0] != '\0' && p[1] != '\0'; p += 2)
{
@@ -11796,8 +11705,7 @@ private:
/* Print BUF o gdb_stdout. Any non-printable bytes in BUF are printed as
'\x??' with '??' replaced by the hexadecimal value of the byte. */
- static void
- print_packet (gdb::array_view<const char> &buf)
+ static void print_packet (gdb::array_view<const char> &buf)
{
string_file stb;
@@ -11821,11 +11729,11 @@ send_remote_packet (gdb::array_view<const char> &buf,
send_remote_packet_callbacks *callbacks)
{
if (buf.size () == 0 || buf.data ()[0] == '\0')
- error (_("a remote packet must not be empty"));
+ error (_ ("a remote packet must not be empty"));
remote_target *remote = get_current_remote_target ();
if (remote == nullptr)
- error (_("packets can only be sent to a remote target"));
+ error (_ ("packets can only be sent to a remote target"));
callbacks->sending (buf);
@@ -11834,7 +11742,7 @@ send_remote_packet (gdb::array_view<const char> &buf,
int bytes = remote->getpkt_sane (&rs->buf, 0);
if (bytes < 0)
- error (_("error while fetching packet from remote target"));
+ error (_ ("error while fetching packet from remote target"));
gdb::array_view<const char> view (&rs->buf[0], bytes);
callbacks->received (view);
@@ -11872,7 +11780,7 @@ static void threadlist_update_test_cmd (char *cmd, int tty);
static void init_remote_threadtests (void);
-#define SAMPLE_THREAD 0x05060708 /* Truncated 64 bit threadid. */
+#define SAMPLE_THREAD 0x05060708 /* Truncated 64 bit threadid. */
static void
threadset_test_cmd (const char *cmd, int tty)
@@ -12032,8 +11940,7 @@ remote_target::pid_to_str (ptid_t ptid)
if (ptid.lwp () == 0)
return normal_pid_to_str (ptid);
else
- return string_printf ("Thread %d.%ld",
- ptid.pid (), ptid.lwp ());
+ return string_printf ("Thread %d.%ld", ptid.pid (), ptid.lwp ());
else
return string_printf ("Thread %ld", ptid.lwp ());
}
@@ -12074,14 +11981,15 @@ remote_target::get_thread_local_address (ptid_t ptid, CORE_ADDR lm,
}
else if (result == PACKET_UNKNOWN)
throw_error (TLS_GENERIC_ERROR,
- _("Remote target doesn't support qGetTLSAddr packet"));
+ _ ("Remote target doesn't support qGetTLSAddr packet"));
else
- throw_error (TLS_GENERIC_ERROR,
- _("Remote target failed to process qGetTLSAddr request"));
+ throw_error (
+ TLS_GENERIC_ERROR,
+ _ ("Remote target failed to process qGetTLSAddr request"));
}
else
throw_error (TLS_GENERIC_ERROR,
- _("TLS not supported or disabled on this target"));
+ _ ("TLS not supported or disabled on this target"));
/* Not reached. */
return 0;
}
@@ -12116,12 +12024,12 @@ remote_target::get_tib_address (ptid_t ptid, CORE_ADDR *addr)
return true;
}
else if (result == PACKET_UNKNOWN)
- error (_("Remote target doesn't support qGetTIBAddr packet"));
+ error (_ ("Remote target doesn't support qGetTIBAddr packet"));
else
- error (_("Remote target failed to process qGetTIBAddr request"));
+ error (_ ("Remote target failed to process qGetTIBAddr request"));
}
else
- error (_("qGetTIBAddr not supported or disabled on this target"));
+ error (_ ("qGetTIBAddr not supported or disabled on this target"));
/* Not reached. */
return false;
}
@@ -12150,7 +12058,7 @@ struct remote_g_packet_data
};
static const registry<gdbarch>::key<struct remote_g_packet_data>
- remote_g_packet_data_handle;
+ remote_g_packet_data_handle;
static struct remote_g_packet_data *
get_g_packet_data (struct gdbarch *gdbarch)
@@ -12172,7 +12080,7 @@ register_remote_g_packet_guess (struct gdbarch *gdbarch, int bytes,
for (const remote_g_packet_guess &guess : data->guesses)
if (guess.bytes == bytes)
- internal_error (_("Duplicate g packet description added for size %d"),
+ internal_error (_ ("Duplicate g packet description added for size %d"),
bytes);
data->guesses.emplace_back (bytes, tdesc);
@@ -12228,7 +12136,7 @@ remote_buffer_add_string (char **buffer, int *left, const char *string)
int len = strlen (string);
if (len > *left)
- error (_("Packet too long for target."));
+ error (_ ("Packet too long for target."));
memcpy (*buffer, string, len);
*buffer += len;
@@ -12249,7 +12157,7 @@ remote_buffer_add_bytes (char **buffer, int *left, const gdb_byte *bytes,
int len)
{
if (2 * len > *left)
- error (_("Packet too long for target."));
+ error (_ ("Packet too long for target."));
bin2hex (bytes, *buffer, len);
*buffer += 2 * len;
@@ -12271,7 +12179,7 @@ remote_buffer_add_int (char **buffer, int *left, ULONGEST value)
int len = hexnumlen (value);
if (len > *left)
- error (_("Packet too long for target."));
+ error (_ ("Packet too long for target."));
hexnumstr (*buffer, value);
*buffer += len;
@@ -12294,7 +12202,8 @@ remote_buffer_add_int (char **buffer, int *left, ULONGEST value)
static int
remote_hostio_parse_result (const char *buffer, int *retcode,
- fileio_error *remote_errno, const char **attachment)
+ fileio_error *remote_errno,
+ const char **attachment)
{
char *p, *p2;
@@ -12350,7 +12259,8 @@ remote_hostio_parse_result (const char *buffer, int *retcode,
int
remote_target::remote_hostio_send_command (int command_bytes, int which_packet,
- fileio_error *remote_errno, const char **attachment,
+ fileio_error *remote_errno,
+ const char **attachment,
int *attachment_len)
{
struct remote_state *rs = get_remote_state ();
@@ -12482,14 +12392,13 @@ remote_target::remote_hostio_open (inferior *inf, const char *filename,
{
static int warning_issued = 0;
- gdb_printf (_("Reading %s from remote target...\n"),
- filename);
+ gdb_printf (_ ("Reading %s from remote target...\n"), filename);
if (!warning_issued)
{
- warning (_("File transfers from remote targets can be slow."
- " Use \"set sysroot\" to access files locally"
- " instead."));
+ warning (_ ("File transfers from remote targets can be slow."
+ " Use \"set sysroot\" to access files locally"
+ " instead."));
warning_issued = 1;
}
}
@@ -12524,8 +12433,9 @@ remote_target::fileio_open (struct inferior *inf, const char *filename,
/* Implementation of to_fileio_pwrite. */
int
-remote_target::remote_hostio_pwrite (int fd, const gdb_byte *write_buf, int len,
- ULONGEST offset, fileio_error *remote_errno)
+remote_target::remote_hostio_pwrite (int fd, const gdb_byte *write_buf,
+ int len, ULONGEST offset,
+ fileio_error *remote_errno)
{
struct remote_state *rs = get_remote_state ();
char *p = rs->buf.data ();
@@ -12562,7 +12472,8 @@ remote_target::fileio_pwrite (int fd, const gdb_byte *write_buf, int len,
int
remote_target::remote_hostio_pread_vFile (int fd, gdb_byte *read_buf, int len,
- ULONGEST offset, fileio_error *remote_errno)
+ ULONGEST offset,
+ fileio_error *remote_errno)
{
struct remote_state *rs = get_remote_state ();
char *p = rs->buf.data ();
@@ -12581,9 +12492,9 @@ remote_target::remote_hostio_pread_vFile (int fd, gdb_byte *read_buf, int len,
remote_buffer_add_int (&p, &left, offset);
- ret = remote_hostio_send_command (p - rs->buf.data (), PACKET_vFile_pread,
- remote_errno, &attachment,
- &attachment_len);
+ ret
+ = remote_hostio_send_command (p - rs->buf.data (), PACKET_vFile_pread,
+ remote_errno, &attachment, &attachment_len);
if (ret < 0)
return ret;
@@ -12591,7 +12502,7 @@ remote_target::remote_hostio_pread_vFile (int fd, gdb_byte *read_buf, int len,
read_len = remote_unescape_input ((gdb_byte *) attachment, attachment_len,
read_buf, len);
if (read_len != ret)
- error (_("Read returned %d, but %d bytes."), ret, (int) read_len);
+ error (_ ("Read returned %d, but %d bytes."), ret, (int) read_len);
return ret;
}
@@ -12602,8 +12513,7 @@ int
readahead_cache::pread (int fd, gdb_byte *read_buf, size_t len,
ULONGEST offset)
{
- if (this->fd == fd
- && this->offset <= offset
+ if (this->fd == fd && this->offset <= offset
&& offset < this->offset + this->bufsize)
{
ULONGEST max = this->offset + this->bufsize;
@@ -12622,7 +12532,8 @@ readahead_cache::pread (int fd, gdb_byte *read_buf, size_t len,
int
remote_target::remote_hostio_pread (int fd, gdb_byte *read_buf, int len,
- ULONGEST offset, fileio_error *remote_errno)
+ ULONGEST offset,
+ fileio_error *remote_errno)
{
int ret;
struct remote_state *rs = get_remote_state ();
@@ -12742,9 +12653,9 @@ remote_target::fileio_readlink (struct inferior *inf, const char *filename,
remote_buffer_add_bytes (&p, &left, (const gdb_byte *) filename,
strlen (filename));
- len = remote_hostio_send_command (p - rs->buf.data (), PACKET_vFile_readlink,
- remote_errno, &attachment,
- &attachment_len);
+ len
+ = remote_hostio_send_command (p - rs->buf.data (), PACKET_vFile_readlink,
+ remote_errno, &attachment, &attachment_len);
if (len < 0)
return {};
@@ -12754,7 +12665,7 @@ remote_target::fileio_readlink (struct inferior *inf, const char *filename,
read_len = remote_unescape_input ((gdb_byte *) attachment, attachment_len,
(gdb_byte *) &ret[0], len);
if (read_len != len)
- error (_("Readlink returned %d, but %d bytes."), len, read_len);
+ error (_ ("Readlink returned %d, but %d bytes."), len, read_len);
return ret;
}
@@ -12762,7 +12673,8 @@ remote_target::fileio_readlink (struct inferior *inf, const char *filename,
/* Implementation of to_fileio_fstat. */
int
-remote_target::fileio_fstat (int fd, struct stat *st, fileio_error *remote_errno)
+remote_target::fileio_fstat (int fd, struct stat *st,
+ fileio_error *remote_errno)
{
struct remote_state *rs = get_remote_state ();
char *p = rs->buf.data ();
@@ -12776,9 +12688,9 @@ remote_target::fileio_fstat (int fd, struct stat *st, fileio_error *remote_errno
remote_buffer_add_int (&p, &left, fd);
- ret = remote_hostio_send_command (p - rs->buf.data (), PACKET_vFile_fstat,
- remote_errno, &attachment,
- &attachment_len);
+ ret
+ = remote_hostio_send_command (p - rs->buf.data (), PACKET_vFile_fstat,
+ remote_errno, &attachment, &attachment_len);
if (ret < 0)
{
if (*remote_errno != FILEIO_ENOSYS)
@@ -12806,11 +12718,11 @@ remote_target::fileio_fstat (int fd, struct stat *st, fileio_error *remote_errno
(gdb_byte *) &fst, sizeof (fst));
if (read_len != ret)
- error (_("vFile:fstat returned %d, but %d bytes."), ret, read_len);
+ error (_ ("vFile:fstat returned %d, but %d bytes."), ret, read_len);
if (read_len != sizeof (fst))
- error (_("vFile:fstat returned %d bytes, but expecting %d."),
- read_len, (int) sizeof (fst));
+ error (_ ("vFile:fstat returned %d bytes, but expecting %d."), read_len,
+ (int) sizeof (fst));
remote_fileio_to_host_stat (&fst, st);
@@ -12840,9 +12752,8 @@ remote_target::filesystem_is_local ()
/* Try opening a file to probe support. The supplied
filename is irrelevant, we only care about whether
the stub recognizes the packet or not. */
- fd = remote_hostio_open (NULL, "just probing",
- FILEIO_O_RDONLY, 0700, 0,
- &remote_errno);
+ fd = remote_hostio_open (NULL, "just probing", FILEIO_O_RDONLY, 0700,
+ 0, &remote_errno);
if (fd >= 0)
remote_hostio_close (fd, &remote_errno);
@@ -12856,9 +12767,9 @@ remote_target::filesystem_is_local ()
if (!warning_issued)
{
- warning (_("remote target does not support file"
- " transfer, attempting to access files"
- " from local filesystem."));
+ warning (_ ("remote target does not support file"
+ " transfer, attempting to access files"
+ " from local filesystem."));
warning_issued = 1;
}
@@ -12875,9 +12786,9 @@ remote_hostio_error (fileio_error errnum)
int host_error = fileio_error_to_host (errnum);
if (host_error == -1)
- error (_("Unknown remote I/O error %d"), errnum);
+ error (_ ("Unknown remote I/O error %d"), errnum);
else
- error (_("Remote I/O error: %s"), safe_strerror (host_error));
+ error (_ ("Remote I/O error: %s"), safe_strerror (host_error));
}
/* A RAII wrapper around a remote file descriptor. */
@@ -12885,8 +12796,10 @@ remote_hostio_error (fileio_error errnum)
class scoped_remote_fd
{
public:
+
scoped_remote_fd (remote_target *remote, int fd)
- : m_remote (remote), m_fd (fd)
+ : m_remote (remote),
+ m_fd (fd)
{
}
@@ -12919,12 +12832,10 @@ public:
}
/* Return the owned file descriptor. */
- int get () const noexcept
- {
- return m_fd;
- }
+ int get () const noexcept { return m_fd; }
private:
+
/* The remote target. */
remote_target *m_remote;
@@ -12938,14 +12849,14 @@ remote_file_put (const char *local_file, const char *remote_file, int from_tty)
remote_target *remote = get_current_remote_target ();
if (remote == nullptr)
- error (_("command can only be used with remote target"));
+ error (_ ("command can only be used with remote target"));
remote->remote_file_put (local_file, remote_file, from_tty);
}
void
-remote_target::remote_file_put (const char *local_file, const char *remote_file,
- int from_tty)
+remote_target::remote_file_put (const char *local_file,
+ const char *remote_file, int from_tty)
{
int retcode, bytes, io_size;
fileio_error remote_errno;
@@ -12957,11 +12868,11 @@ remote_target::remote_file_put (const char *local_file, const char *remote_file,
if (file == NULL)
perror_with_name (local_file);
- scoped_remote_fd fd
- (this, remote_hostio_open (NULL,
- remote_file, (FILEIO_O_WRONLY | FILEIO_O_CREAT
- | FILEIO_O_TRUNC),
- 0700, 0, &remote_errno));
+ scoped_remote_fd fd (this,
+ remote_hostio_open (NULL, remote_file,
+ (FILEIO_O_WRONLY | FILEIO_O_CREAT
+ | FILEIO_O_TRUNC),
+ 0700, 0, &remote_errno));
if (fd.get () == -1)
remote_hostio_error (remote_errno);
@@ -12978,12 +12889,11 @@ remote_target::remote_file_put (const char *local_file, const char *remote_file,
if (!saw_eof)
{
bytes = fread (buffer.data () + bytes_in_buffer, 1,
- io_size - bytes_in_buffer,
- file.get ());
+ io_size - bytes_in_buffer, file.get ());
if (bytes == 0)
{
if (ferror (file.get ()))
- error (_("Error reading %s."), local_file);
+ error (_ ("Error reading %s."), local_file);
else
{
/* EOF. Unless there is something still in the
@@ -13000,13 +12910,13 @@ remote_target::remote_file_put (const char *local_file, const char *remote_file,
bytes += bytes_in_buffer;
bytes_in_buffer = 0;
- retcode = remote_hostio_pwrite (fd.get (), buffer.data (), bytes,
- offset, &remote_errno);
+ retcode = remote_hostio_pwrite (fd.get (), buffer.data (), bytes, offset,
+ &remote_errno);
if (retcode < 0)
remote_hostio_error (remote_errno);
else if (retcode == 0)
- error (_("Remote write of %d bytes returned 0!"), bytes);
+ error (_ ("Remote write of %d bytes returned 0!"), bytes);
else if (retcode < bytes)
{
/* Short write. Save the rest of the read data for the next
@@ -13022,7 +12932,7 @@ remote_target::remote_file_put (const char *local_file, const char *remote_file,
remote_hostio_error (remote_errno);
if (from_tty)
- gdb_printf (_("Successfully sent file \"%s\".\n"), local_file);
+ gdb_printf (_ ("Successfully sent file \"%s\".\n"), local_file);
}
void
@@ -13031,23 +12941,22 @@ remote_file_get (const char *remote_file, const char *local_file, int from_tty)
remote_target *remote = get_current_remote_target ();
if (remote == nullptr)
- error (_("command can only be used with remote target"));
+ error (_ ("command can only be used with remote target"));
remote->remote_file_get (remote_file, local_file, from_tty);
}
void
-remote_target::remote_file_get (const char *remote_file, const char *local_file,
- int from_tty)
+remote_target::remote_file_get (const char *remote_file,
+ const char *local_file, int from_tty)
{
fileio_error remote_errno;
int bytes, io_size;
ULONGEST offset;
- scoped_remote_fd fd
- (this, remote_hostio_open (NULL,
- remote_file, FILEIO_O_RDONLY, 0, 0,
- &remote_errno));
+ scoped_remote_fd fd (this,
+ remote_hostio_open (NULL, remote_file, FILEIO_O_RDONLY,
+ 0, 0, &remote_errno));
if (fd.get () == -1)
remote_hostio_error (remote_errno);
@@ -13082,7 +12991,7 @@ remote_target::remote_file_get (const char *remote_file, const char *local_file,
remote_hostio_error (remote_errno);
if (from_tty)
- gdb_printf (_("Successfully fetched file \"%s\".\n"), remote_file);
+ gdb_printf (_ ("Successfully fetched file \"%s\".\n"), remote_file);
}
void
@@ -13091,7 +13000,7 @@ remote_file_delete (const char *remote_file, int from_tty)
remote_target *remote = get_current_remote_target ();
if (remote == nullptr)
- error (_("command can only be used with remote target"));
+ error (_ ("command can only be used with remote target"));
remote->remote_file_delete (remote_file, from_tty);
}
@@ -13107,18 +13016,18 @@ remote_target::remote_file_delete (const char *remote_file, int from_tty)
remote_hostio_error (remote_errno);
if (from_tty)
- gdb_printf (_("Successfully deleted file \"%s\".\n"), remote_file);
+ gdb_printf (_ ("Successfully deleted file \"%s\".\n"), remote_file);
}
static void
remote_put_command (const char *args, int from_tty)
{
if (args == NULL)
- error_no_arg (_("file to put"));
+ error_no_arg (_ ("file to put"));
gdb_argv argv (args);
if (argv[0] == NULL || argv[1] == NULL || argv[2] != NULL)
- error (_("Invalid parameters to remote put"));
+ error (_ ("Invalid parameters to remote put"));
remote_file_put (argv[0], argv[1], from_tty);
}
@@ -13127,11 +13036,11 @@ static void
remote_get_command (const char *args, int from_tty)
{
if (args == NULL)
- error_no_arg (_("file to get"));
+ error_no_arg (_ ("file to get"));
gdb_argv argv (args);
if (argv[0] == NULL || argv[1] == NULL || argv[2] != NULL)
- error (_("Invalid parameters to remote get"));
+ error (_ ("Invalid parameters to remote get"));
remote_file_get (argv[0], argv[1], from_tty);
}
@@ -13140,11 +13049,11 @@ static void
remote_delete_command (const char *args, int from_tty)
{
if (args == NULL)
- error_no_arg (_("file to delete"));
+ error_no_arg (_ ("file to delete"));
gdb_argv argv (args);
if (argv[0] == NULL || argv[1] != NULL)
- error (_("Invalid parameters to remote delete"));
+ error (_ ("Invalid parameters to remote delete"));
remote_file_delete (argv[0], from_tty);
}
@@ -13226,7 +13135,8 @@ remote_target::supports_string_tracing ()
bool
remote_target::can_run_breakpoint_commands ()
{
- return m_features.packet_support (PACKET_BreakpointCommands) == PACKET_ENABLE;
+ return m_features.packet_support (PACKET_BreakpointCommands)
+ == PACKET_ENABLE;
}
void
@@ -13237,7 +13147,7 @@ remote_target::trace_init ()
putpkt ("QTinit");
remote_get_noisy_reply ();
if (strcmp (rs->buf.data (), "OK") != 0)
- error (_("Target does not support this command."));
+ error (_ ("Target does not support this command."));
}
/* Recursive routine to walk through command list including loops, and
@@ -13252,7 +13162,7 @@ remote_target::remote_download_command_source (int num, ULONGEST addr,
for (cmd = cmds; cmd; cmd = cmd->next)
{
- QUIT; /* Allow user to bail out with ^C. */
+ QUIT; /* Allow user to bail out with ^C. */
strcpy (rs->buf.data (), "QTDPsrc:");
encode_source_string (num, addr, "cmd", cmd->line,
rs->buf.data () + strlen (rs->buf.data ()),
@@ -13260,14 +13170,14 @@ remote_target::remote_download_command_source (int num, ULONGEST addr,
putpkt (rs->buf);
remote_get_noisy_reply ();
if (strcmp (rs->buf.data (), "OK"))
- warning (_("Target does not support source download."));
+ warning (_ ("Target does not support source download."));
if (cmd->control_type == while_control
|| cmd->control_type == while_stepping_control)
{
remote_download_command_source (num, addr, cmd->body_list_0.get ());
- QUIT; /* Allow user to bail out with ^C. */
+ QUIT; /* Allow user to bail out with ^C. */
strcpy (rs->buf.data (), "QTDPsrc:");
encode_source_string (num, addr, "cmd", "end",
rs->buf.data () + strlen (rs->buf.data ()),
@@ -13275,7 +13185,7 @@ remote_target::remote_download_command_source (int num, ULONGEST addr,
putpkt (rs->buf);
remote_get_noisy_reply ();
if (strcmp (rs->buf.data (), "OK"))
- warning (_("Target does not support source download."));
+ warning (_ ("Target does not support source download."));
}
}
}
@@ -13292,7 +13202,7 @@ remote_target::download_tracepoint (struct bp_location *loc)
struct tracepoint *t = (struct tracepoint *) b;
struct remote_state *rs = get_remote_state ();
int ret;
- const char *err_msg = _("Tracepoint packet too large for target.");
+ const char *err_msg = _ ("Tracepoint packet too large for target.");
size_t size_left;
/* We use a buffer other than rs->buf because we'll build strings
@@ -13304,10 +13214,10 @@ remote_target::download_tracepoint (struct bp_location *loc)
tpaddr = loc->address;
strcpy (addrbuf, phex (tpaddr, sizeof (CORE_ADDR)));
- ret = snprintf (buf.data (), buf.size (), "QTDP:%x:%s:%c:%lx:%x",
- b->number, addrbuf, /* address */
- (b->enable_state == bp_enabled ? 'E' : 'D'),
- t->step_count, t->pass_count);
+ ret = snprintf (buf.data (), buf.size (), "QTDP:%x:%s:%c:%lx:%x", b->number,
+ addrbuf, /* address */
+ (b->enable_state == bp_enabled ? 'E' : 'D'), t->step_count,
+ t->pass_count);
if (ret < 0 || ret >= buf.size ())
error ("%s", err_msg);
@@ -13321,13 +13231,11 @@ remote_target::download_tracepoint (struct bp_location *loc)
target capabilities at definition time. */
if (remote_supports_fast_tracepoints ())
{
- if (gdbarch_fast_tracepoint_valid_at (loc->gdbarch, tpaddr,
- NULL))
+ if (gdbarch_fast_tracepoint_valid_at (loc->gdbarch, tpaddr, NULL))
{
size_left = buf.size () - strlen (buf.data ());
- ret = snprintf (buf.data () + strlen (buf.data ()),
- size_left, ":F%x",
- gdb_insn_length (loc->gdbarch, tpaddr));
+ ret = snprintf (buf.data () + strlen (buf.data ()), size_left,
+ ":F%x", gdb_insn_length (loc->gdbarch, tpaddr));
if (ret < 0 || ret >= size_left)
error ("%s", err_msg);
@@ -13335,14 +13243,15 @@ remote_target::download_tracepoint (struct bp_location *loc)
else
/* If it passed validation at definition but fails now,
something is very wrong. */
- internal_error (_("Fast tracepoint not valid during download"));
+ internal_error (_ ("Fast tracepoint not valid during download"));
}
else
/* Fast tracepoints are functionally identical to regular
tracepoints, so don't take lack of support as a reason to
give up on the trace run. */
- warning (_("Target does not support fast tracepoints, "
- "downloading %d as regular tracepoint"), b->number);
+ warning (_ ("Target does not support fast tracepoints, "
+ "downloading %d as regular tracepoint"),
+ b->number);
}
else if (b->type == bp_static_tracepoint
|| b->type == bp_static_marker_tracepoint)
@@ -13356,20 +13265,20 @@ remote_target::download_tracepoint (struct bp_location *loc)
if (target_static_tracepoint_marker_at (tpaddr, &marker))
{
size_left = buf.size () - strlen (buf.data ());
- ret = snprintf (buf.data () + strlen (buf.data ()),
- size_left, ":S");
+ ret = snprintf (buf.data () + strlen (buf.data ()), size_left,
+ ":S");
if (ret < 0 || ret >= size_left)
error ("%s", err_msg);
}
else
- error (_("Static tracepoint not valid during download"));
+ error (_ ("Static tracepoint not valid during download"));
}
else
/* Fast tracepoints are functionally identical to regular
tracepoints, so don't take lack of support as a reason
to give up on the trace run. */
- error (_("Target does not support static tracepoints"));
+ error (_ ("Target does not support static tracepoints"));
}
/* If the tracepoint has a conditional, make it into an agent
expression and append to the definition. */
@@ -13379,13 +13288,12 @@ remote_target::download_tracepoint (struct bp_location *loc)
capabilities at definition time. */
if (remote_supports_cond_tracepoints ())
{
- agent_expr_up aexpr = gen_eval_for_expr (tpaddr,
- loc->cond.get ());
+ agent_expr_up aexpr = gen_eval_for_expr (tpaddr, loc->cond.get ());
size_left = buf.size () - strlen (buf.data ());
- ret = snprintf (buf.data () + strlen (buf.data ()),
- size_left, ":X%x,", aexpr->len);
+ ret = snprintf (buf.data () + strlen (buf.data ()), size_left,
+ ":X%x,", aexpr->len);
if (ret < 0 || ret >= size_left)
error ("%s", err_msg);
@@ -13404,16 +13312,16 @@ remote_target::download_tracepoint (struct bp_location *loc)
*pkt = '\0';
}
else
- warning (_("Target does not support conditional tracepoints, "
- "ignoring tp %d cond"), b->number);
+ warning (_ ("Target does not support conditional tracepoints, "
+ "ignoring tp %d cond"),
+ b->number);
}
if (b->commands || !default_collect.empty ())
{
size_left = buf.size () - strlen (buf.data ());
- ret = snprintf (buf.data () + strlen (buf.data ()),
- size_left, "-");
+ ret = snprintf (buf.data () + strlen (buf.data ()), size_left, "-");
if (ret < 0 || ret >= size_left)
error ("%s", err_msg);
@@ -13422,21 +13330,20 @@ remote_target::download_tracepoint (struct bp_location *loc)
putpkt (buf.data ());
remote_get_noisy_reply ();
if (strcmp (rs->buf.data (), "OK"))
- error (_("Target does not support tracepoints."));
+ error (_ ("Target does not support tracepoints."));
/* do_single_steps (t); */
- for (auto action_it = tdp_actions.begin ();
- action_it != tdp_actions.end (); action_it++)
+ for (auto action_it = tdp_actions.begin (); action_it != tdp_actions.end ();
+ action_it++)
{
- QUIT; /* Allow user to bail out with ^C. */
+ QUIT; /* Allow user to bail out with ^C. */
bool has_more = ((action_it + 1) != tdp_actions.end ()
|| !stepping_actions.empty ());
- ret = snprintf (buf.data (), buf.size (), "QTDP:-%x:%s:%s%c",
- b->number, addrbuf, /* address */
- action_it->c_str (),
- has_more ? '-' : 0);
+ ret = snprintf (buf.data (), buf.size (), "QTDP:-%x:%s:%s%c", b->number,
+ addrbuf, /* address */
+ action_it->c_str (), has_more ? '-' : 0);
if (ret < 0 || ret >= buf.size ())
error ("%s", err_msg);
@@ -13444,21 +13351,20 @@ remote_target::download_tracepoint (struct bp_location *loc)
putpkt (buf.data ());
remote_get_noisy_reply ();
if (strcmp (rs->buf.data (), "OK"))
- error (_("Error on target while setting tracepoints."));
+ error (_ ("Error on target while setting tracepoints."));
}
for (auto action_it = stepping_actions.begin ();
action_it != stepping_actions.end (); action_it++)
{
- QUIT; /* Allow user to bail out with ^C. */
+ QUIT; /* Allow user to bail out with ^C. */
bool is_first = action_it == stepping_actions.begin ();
bool has_more = (action_it + 1) != stepping_actions.end ();
ret = snprintf (buf.data (), buf.size (), "QTDP:-%x:%s:%s%s%s",
b->number, addrbuf, /* address */
- is_first ? "S" : "",
- action_it->c_str (),
+ is_first ? "S" : "", action_it->c_str (),
has_more ? "-" : "");
if (ret < 0 || ret >= buf.size ())
@@ -13467,7 +13373,7 @@ remote_target::download_tracepoint (struct bp_location *loc)
putpkt (buf.data ());
remote_get_noisy_reply ();
if (strcmp (rs->buf.data (), "OK"))
- error (_("Error on target while setting tracepoints."));
+ error (_ ("Error on target while setting tracepoints."));
}
if (m_features.packet_support (PACKET_TracepointSource) == PACKET_ENABLE)
@@ -13486,7 +13392,7 @@ remote_target::download_tracepoint (struct bp_location *loc)
putpkt (buf.data ());
remote_get_noisy_reply ();
if (strcmp (rs->buf.data (), "OK"))
- warning (_("Target does not support source download."));
+ warning (_ ("Target does not support source download."));
}
if (b->cond_string)
{
@@ -13495,14 +13401,14 @@ remote_target::download_tracepoint (struct bp_location *loc)
if (ret < 0 || ret >= buf.size ())
error ("%s", err_msg);
- encode_source_string (b->number, loc->address,
- "cond", b->cond_string.get (),
+ encode_source_string (b->number, loc->address, "cond",
+ b->cond_string.get (),
buf.data () + strlen (buf.data ()),
buf.size () - strlen (buf.data ()));
putpkt (buf.data ());
remote_get_noisy_reply ();
if (strcmp (rs->buf.data (), "OK"))
- warning (_("Target does not support source download."));
+ warning (_ ("Target does not support source download."));
}
remote_download_command_source (b->number, loc->address,
breakpoint_commands (b));
@@ -13536,28 +13442,27 @@ remote_target::can_download_tracepoint ()
return true;
}
-
void
remote_target::download_trace_state_variable (const trace_state_variable &tsv)
{
struct remote_state *rs = get_remote_state ();
char *p;
- xsnprintf (rs->buf.data (), get_remote_packet_size (), "QTDV:%x:%s:%x:",
- tsv.number, phex ((ULONGEST) tsv.initial_value, 8),
- tsv.builtin);
+ xsnprintf (rs->buf.data (), get_remote_packet_size (),
+ "QTDV:%x:%s:%x:", tsv.number,
+ phex ((ULONGEST) tsv.initial_value, 8), tsv.builtin);
p = rs->buf.data () + strlen (rs->buf.data ());
if ((p - rs->buf.data ()) + tsv.name.length () * 2
>= get_remote_packet_size ())
- error (_("Trace state variable name too long for tsv definition packet"));
+ error (_ ("Trace state variable name too long for tsv definition packet"));
p += 2 * bin2hex ((gdb_byte *) (tsv.name.data ()), p, tsv.name.length ());
*p++ = '\0';
putpkt (rs->buf);
remote_get_noisy_reply ();
if (rs->buf[0] == '\0')
- error (_("Target does not support this command."));
+ error (_ ("Target does not support this command."));
if (strcmp (rs->buf.data (), "OK") != 0)
- error (_("Error on target while downloading trace state variable."));
+ error (_ ("Error on target while downloading trace state variable."));
}
void
@@ -13571,9 +13476,10 @@ remote_target::enable_tracepoint (struct bp_location *location)
putpkt (rs->buf);
remote_get_noisy_reply ();
if (rs->buf[0] == '\0')
- error (_("Target does not support enabling tracepoints while a trace run is ongoing."));
+ error (_ ("Target does not support enabling tracepoints while a trace run "
+ "is ongoing."));
if (strcmp (rs->buf.data (), "OK") != 0)
- error (_("Error on target while enabling tracepoint."));
+ error (_ ("Error on target while enabling tracepoint."));
}
void
@@ -13587,9 +13493,10 @@ remote_target::disable_tracepoint (struct bp_location *location)
putpkt (rs->buf);
remote_get_noisy_reply ();
if (rs->buf[0] == '\0')
- error (_("Target does not support disabling tracepoints while a trace run is ongoing."));
+ error (_ ("Target does not support disabling tracepoints while a trace "
+ "run is ongoing."));
if (strcmp (rs->buf.data (), "OK") != 0)
- error (_("Error on target while disabling tracepoint."));
+ error (_ ("Error on target while disabling tracepoint."));
}
void
@@ -13603,7 +13510,7 @@ remote_target::trace_set_readonly_regions ()
bfd *abfd = current_program_space->exec_bfd ();
if (!abfd)
- return; /* No information to give. */
+ return; /* No information to give. */
struct remote_state *rs = get_remote_state ();
@@ -13629,7 +13536,7 @@ remote_target::trace_set_readonly_regions ()
{
if (m_features.packet_support (PACKET_qXfer_traceframe_info)
!= PACKET_ENABLE)
- warning (_("\
+ warning (_ ("\
Too many sections for read-only sections definition packet."));
break;
}
@@ -13652,9 +13559,9 @@ remote_target::trace_start ()
putpkt ("QTStart");
remote_get_noisy_reply ();
if (rs->buf[0] == '\0')
- error (_("Target does not support this command."));
+ error (_ ("Target does not support this command."));
if (strcmp (rs->buf.data (), "OK") != 0)
- error (_("Bogus reply from target: %s"), rs->buf.data ());
+ error (_ ("Bogus reply from target: %s"), rs->buf.data ());
}
int
@@ -13698,7 +13605,7 @@ remote_target::get_trace_status (struct trace_status *ts)
ts->filename = NULL;
if (*p++ != 'T')
- error (_("Bogus trace status reply from target: %s"), rs->buf.data ());
+ error (_ ("Bogus trace status reply from target: %s"), rs->buf.data ());
/* Function 'parse_trace_status' sets default value of each field of
'ts' at first, so we don't have to do it here. */
@@ -13761,15 +13668,14 @@ remote_target::trace_stop ()
putpkt ("QTStop");
remote_get_noisy_reply ();
if (rs->buf[0] == '\0')
- error (_("Target does not support this command."));
+ error (_ ("Target does not support this command."));
if (strcmp (rs->buf.data (), "OK") != 0)
- error (_("Bogus reply from target: %s"), rs->buf.data ());
+ error (_ ("Bogus reply from target: %s"), rs->buf.data ());
}
int
-remote_target::trace_find (enum trace_find_type type, int num,
- CORE_ADDR addr1, CORE_ADDR addr2,
- int *tpp)
+remote_target::trace_find (enum trace_find_type type, int num, CORE_ADDR addr1,
+ CORE_ADDR addr2, int *tpp)
{
struct remote_state *rs = get_remote_state ();
char *endbuf = rs->buf.data () + get_remote_packet_size ();
@@ -13805,13 +13711,13 @@ remote_target::trace_find (enum trace_find_type type, int num,
phex_nz (addr2, 0));
break;
default:
- error (_("Unknown trace find type %d"), type);
+ error (_ ("Unknown trace find type %d"), type);
}
putpkt (rs->buf);
reply = remote_get_noisy_reply ();
if (*reply == '\0')
- error (_("Target does not support this command."));
+ error (_ ("Target does not support this command."));
while (reply && *reply)
switch (*reply)
@@ -13820,7 +13726,7 @@ remote_target::trace_find (enum trace_find_type type, int num,
p = ++reply;
target_frameno = (int) strtol (p, &reply, 16);
if (reply == p)
- error (_("Unable to parse trace frame number"));
+ error (_ ("Unable to parse trace frame number"));
/* Don't update our remote traceframe number cache on failure
to select a remote traceframe. */
if (target_frameno == -1)
@@ -13830,16 +13736,16 @@ remote_target::trace_find (enum trace_find_type type, int num,
p = ++reply;
target_tracept = (int) strtol (p, &reply, 16);
if (reply == p)
- error (_("Unable to parse tracepoint number"));
+ error (_ ("Unable to parse tracepoint number"));
break;
- case 'O': /* "OK"? */
+ case 'O': /* "OK"? */
if (reply[1] == 'K' && reply[2] == '\0')
reply += 2;
else
- error (_("Bogus reply from target: %s"), reply);
+ error (_ ("Bogus reply from target: %s"), reply);
break;
default:
- error (_("Bogus reply from target: %s"), reply);
+ error (_ ("Bogus reply from target: %s"), reply);
}
if (tpp)
*tpp = target_tracept;
@@ -13883,15 +13789,15 @@ remote_target::save_trace_data (const char *filename)
p += strlen (p);
if ((p - rs->buf.data ()) + strlen (filename) * 2
>= get_remote_packet_size ())
- error (_("Remote file name too long for trace save packet"));
+ error (_ ("Remote file name too long for trace save packet"));
p += 2 * bin2hex ((gdb_byte *) filename, p, strlen (filename));
*p++ = '\0';
putpkt (rs->buf);
reply = remote_get_noisy_reply ();
if (*reply == '\0')
- error (_("Target does not support this command."));
+ error (_ ("Target does not support this command."));
if (strcmp (reply, "OK") != 0)
- error (_("Bogus reply from target: %s"), reply);
+ error (_ ("Bogus reply from target: %s"), reply);
return 0;
}
@@ -13953,12 +13859,12 @@ remote_target::set_disconnected_tracing (int val)
putpkt (rs->buf);
reply = remote_get_noisy_reply ();
if (*reply == '\0')
- error (_("Target does not support this command."));
+ error (_ ("Target does not support this command."));
if (strcmp (reply, "OK") != 0)
- error (_("Bogus reply from target: %s"), reply);
+ error (_ ("Bogus reply from target: %s"), reply);
}
else if (val)
- warning (_("Target does not support disconnected tracing."));
+ warning (_ ("Target does not support disconnected tracing."));
}
int
@@ -13983,9 +13889,9 @@ remote_target::set_circular_trace_buffer (int val)
putpkt (rs->buf);
reply = remote_get_noisy_reply ();
if (*reply == '\0')
- error (_("Target does not support this command."));
+ error (_ ("Target does not support this command."));
if (strcmp (reply, "OK") != 0)
- error (_("Bogus reply from target: %s"), reply);
+ error (_ ("Bogus reply from target: %s"), reply);
}
traceframe_info_up
@@ -13993,8 +13899,7 @@ remote_target::traceframe_info ()
{
gdb::optional<gdb::char_vector> text
= target_read_stralloc (current_inferior ()->top_target (),
- TARGET_OBJECT_TRACEFRAME_INFO,
- NULL);
+ TARGET_OBJECT_TRACEFRAME_INFO, NULL);
if (text)
return parse_traceframe_info (text->data ());
@@ -14061,7 +13966,7 @@ remote_target::set_trace_buffer_size (LONGEST val)
result = m_features.packet_ok (rs->buf, PACKET_QTBuffer_size);
if (result != PACKET_OK)
- warning (_("Bogus reply from target: %s"), rs->buf.data ());
+ warning (_ ("Bogus reply from target: %s"), rs->buf.data ());
}
}
@@ -14106,7 +14011,7 @@ remote_target::set_trace_notes (const char *user, const char *notes,
return false;
if (strcmp (reply, "OK") != 0)
- error (_("Bogus reply from target: %s"), reply);
+ error (_ ("Bogus reply from target: %s"), reply);
return true;
}
@@ -14172,9 +14077,10 @@ remote_target::btrace_sync_conf (const btrace_config *conf)
&& conf->bts.size != rs->btrace_config.bts.size)
{
pos = buf;
- pos += xsnprintf (pos, endbuf - pos, "%s=0x%x",
- packets_descriptions[PACKET_Qbtrace_conf_bts_size].name,
- conf->bts.size);
+ pos
+ += xsnprintf (pos, endbuf - pos, "%s=0x%x",
+ packets_descriptions[PACKET_Qbtrace_conf_bts_size].name,
+ conf->bts.size);
putpkt (buf);
getpkt (&rs->buf, 0);
@@ -14183,9 +14089,9 @@ remote_target::btrace_sync_conf (const btrace_config *conf)
== PACKET_ERROR)
{
if (buf[0] == 'E' && buf[1] == '.')
- error (_("Failed to configure the BTS buffer size: %s"), buf + 2);
+ error (_ ("Failed to configure the BTS buffer size: %s"), buf + 2);
else
- error (_("Failed to configure the BTS buffer size."));
+ error (_ ("Failed to configure the BTS buffer size."));
}
rs->btrace_config.bts.size = conf->bts.size;
@@ -14206,9 +14112,10 @@ remote_target::btrace_sync_conf (const btrace_config *conf)
== PACKET_ERROR)
{
if (buf[0] == 'E' && buf[1] == '.')
- error (_("Failed to configure the trace buffer size: %s"), buf + 2);
+ error (_ ("Failed to configure the trace buffer size: %s"),
+ buf + 2);
else
- error (_("Failed to configure the trace buffer size."));
+ error (_ ("Failed to configure the trace buffer size."));
}
rs->btrace_config.pt.size = conf->pt.size;
@@ -14238,7 +14145,7 @@ remote_target::remote_btrace_maybe_reopen ()
{
struct remote_state *rs = get_remote_state ();
int btrace_target_pushed = 0;
-#if !defined (HAVE_LIBIPT)
+#if !defined(HAVE_LIBIPT)
int warned = 0;
#endif
@@ -14255,14 +14162,14 @@ remote_target::remote_btrace_maybe_reopen ()
if (rs->btrace_config.format == BTRACE_FORMAT_NONE)
continue;
-#if !defined (HAVE_LIBIPT)
+#if !defined(HAVE_LIBIPT)
if (rs->btrace_config.format == BTRACE_FORMAT_PT)
{
if (!warned)
{
warned = 1;
- warning (_("Target is recording using Intel Processor Trace "
- "but support was disabled at compile time."));
+ warning (_ ("Target is recording using Intel Processor Trace "
+ "but support was disabled at compile time."));
}
continue;
@@ -14276,7 +14183,7 @@ remote_target::remote_btrace_maybe_reopen ()
{
btrace_target_pushed = 1;
record_btrace_push_target ();
- gdb_printf (_("Target is recording using %s.\n"),
+ gdb_printf (_ ("Target is recording using %s.\n"),
btrace_format_string (rs->btrace_config.format));
}
@@ -14301,20 +14208,20 @@ remote_target::enable_btrace (thread_info *tp,
unsigned int which_packet;
switch (conf->format)
{
- case BTRACE_FORMAT_BTS:
- which_packet = PACKET_Qbtrace_bts;
- break;
- case BTRACE_FORMAT_PT:
- which_packet = PACKET_Qbtrace_pt;
- break;
- default:
- internal_error (_("Bad branch btrace format: %u."),
- (unsigned int) conf->format);
+ case BTRACE_FORMAT_BTS:
+ which_packet = PACKET_Qbtrace_bts;
+ break;
+ case BTRACE_FORMAT_PT:
+ which_packet = PACKET_Qbtrace_pt;
+ break;
+ default:
+ internal_error (_ ("Bad branch btrace format: %u."),
+ (unsigned int) conf->format);
}
packet = &m_features.m_protocol_packets[which_packet];
if (packet == NULL || packet_config_support (packet) != PACKET_ENABLE)
- error (_("Target does not support branch tracing."));
+ error (_ ("Target does not support branch tracing."));
btrace_sync_conf (conf);
@@ -14329,10 +14236,10 @@ remote_target::enable_btrace (thread_info *tp,
if (m_features.packet_ok (rs->buf, which_packet) == PACKET_ERROR)
{
if (rs->buf[0] == 'E' && rs->buf[1] == '.')
- error (_("Could not enable branch tracing for %s: %s"),
+ error (_ ("Could not enable branch tracing for %s: %s"),
target_pid_to_str (ptid).c_str (), &rs->buf[2]);
else
- error (_("Could not enable branch tracing for %s."),
+ error (_ ("Could not enable branch tracing for %s."),
target_pid_to_str (ptid).c_str ());
}
@@ -14364,7 +14271,7 @@ remote_target::disable_btrace (struct btrace_target_info *tinfo)
char *endbuf = buf + get_remote_packet_size ();
if (m_features.packet_support (PACKET_Qbtrace_off) != PACKET_ENABLE)
- error (_("Target does not support branch tracing."));
+ error (_ ("Target does not support branch tracing."));
set_general_thread (tinfo->ptid);
@@ -14376,10 +14283,10 @@ remote_target::disable_btrace (struct btrace_target_info *tinfo)
if (m_features.packet_ok (rs->buf, PACKET_Qbtrace_off) == PACKET_ERROR)
{
if (rs->buf[0] == 'E' && rs->buf[1] == '.')
- error (_("Could not disable branch tracing for %s: %s"),
+ error (_ ("Could not disable branch tracing for %s: %s"),
target_pid_to_str (tinfo->ptid).c_str (), &rs->buf[2]);
else
- error (_("Could not disable branch tracing for %s."),
+ error (_ ("Could not disable branch tracing for %s."),
target_pid_to_str (tinfo->ptid).c_str ());
}
@@ -14405,10 +14312,11 @@ remote_target::read_btrace (struct btrace_data *btrace,
const char *annex;
if (m_features.packet_support (PACKET_qXfer_btrace) != PACKET_ENABLE)
- error (_("Target does not support branch tracing."));
+ error (_ ("Target does not support branch tracing."));
#if !defined(HAVE_LIBEXPAT)
- error (_("Cannot process branch tracing result. XML parsing not supported."));
+ error (
+ _ ("Cannot process branch tracing result. XML parsing not supported."));
#endif
switch (type)
@@ -14423,7 +14331,7 @@ remote_target::read_btrace (struct btrace_data *btrace,
annex = "delta";
break;
default:
- internal_error (_("Bad branch tracing read type: %u."),
+ internal_error (_ ("Bad branch tracing read type: %u."),
(unsigned int) type);
}
@@ -14447,9 +14355,9 @@ remote_target::btrace_conf (const struct btrace_target_info *tinfo)
bool
remote_target::augmented_libraries_svr4_read ()
{
- return
- (m_features.packet_support (PACKET_augmented_libraries_svr4_read_feature)
- == PACKET_ENABLE);
+ return (
+ m_features.packet_support (PACKET_augmented_libraries_svr4_read_feature)
+ == PACKET_ENABLE);
}
/* Implementation of to_load. */
@@ -14475,7 +14383,7 @@ remote_target::pid_to_exec_file (int pid)
inferior *inf = find_inferior_pid (this, pid);
if (inf == NULL)
- internal_error (_("not currently attached to process %d"), pid);
+ internal_error (_ ("not currently attached to process %d"), pid);
if (!inf->fake_pid_p)
{
@@ -14527,8 +14435,7 @@ remote_target::execution_direction ()
thread_info *
remote_target::thread_handle_to_thread_info (const gdb_byte *thread_handle,
- int handle_len,
- inferior *inf)
+ int handle_len, inferior *inf)
{
for (thread_info *tp : all_non_exited_threads (this))
{
@@ -14537,10 +14444,10 @@ remote_target::thread_handle_to_thread_info (const gdb_byte *thread_handle,
if (tp->inf == inf && priv != NULL)
{
if (handle_len != priv->thread_handle.size ())
- error (_("Thread handle size mismatch: %d vs %zu (from remote)"),
+ error (_ ("Thread handle size mismatch: %d vs %zu (from remote)"),
handle_len, priv->thread_handle.size ());
- if (memcmp (thread_handle, priv->thread_handle.data (),
- handle_len) == 0)
+ if (memcmp (thread_handle, priv->thread_handle.data (), handle_len)
+ == 0)
return tp;
}
}
@@ -14653,10 +14560,11 @@ remote_target::thread_events (int enable)
{
case PACKET_OK:
if (strcmp (rs->buf.data (), "OK") != 0)
- error (_("Remote refused setting thread events: %s"), rs->buf.data ());
+ error (_ ("Remote refused setting thread events: %s"),
+ rs->buf.data ());
break;
case PACKET_ERROR:
- warning (_("Remote failure reply: %s"), rs->buf.data ());
+ warning (_ ("Remote failure reply: %s"), rs->buf.data ());
break;
case PACKET_UNKNOWN:
break;
@@ -14692,7 +14600,6 @@ show_remote_cmd (const char *args, int from_tty)
}
}
-
/* Function to be called whenever a new objfile (shlib) is detected. */
static void
remote_new_objfile (struct objfile *objfile)
@@ -14745,14 +14652,14 @@ remote_new_objfile (struct objfile *objfile)
switch_to_thread (thread);
remote->remote_check_symbols ();
}
- }
+ }
}
/* Pull all the tracepoints defined on the target and create local
data structures representing them. We don't want to create real
tracepoints yet, we don't want to mess up the user's existing
collection. */
-
+
int
remote_target::upload_tracepoints (struct uploaded_tp **utpp)
{
@@ -14799,12 +14706,12 @@ remote_target::upload_trace_state_variables (struct uploaded_tsv **utsvp)
static void
show_range_stepping (struct ui_file *file, int from_tty,
- struct cmd_list_element *c,
- const char *value)
+ struct cmd_list_element *c, const char *value)
{
gdb_printf (file,
- _("Debugger's willingness to use range stepping "
- "is %s.\n"), value);
+ _ ("Debugger's willingness to use range stepping "
+ "is %s.\n"),
+ value);
}
/* Return true if the vCont;r action is supported by the remote
@@ -14828,9 +14735,8 @@ set_range_stepping (const char *ignore_args, int from_tty,
if (use_range_stepping)
{
remote_target *remote = get_current_remote_target ();
- if (remote == NULL
- || !remote->vcont_r_supported ())
- warning (_("Range stepping is not supported by the current target"));
+ if (remote == NULL || !remote->vcont_r_supported ())
+ warning (_ ("Range stepping is not supported by the current target"));
}
}
@@ -14838,16 +14744,14 @@ static void
show_remote_debug (struct ui_file *file, int from_tty,
struct cmd_list_element *c, const char *value)
{
- gdb_printf (file, _("Debugging of remote protocol is %s.\n"),
- value);
+ gdb_printf (file, _ ("Debugging of remote protocol is %s.\n"), value);
}
static void
show_remote_timeout (struct ui_file *file, int from_tty,
struct cmd_list_element *c, const char *value)
{
- gdb_printf (file,
- _("Timeout limit to wait for target to respond is %s.\n"),
+ gdb_printf (file, _ ("Timeout limit to wait for target to respond is %s.\n"),
value);
}
@@ -14867,10 +14771,10 @@ create_fetch_memtags_request (gdb::char_vector &packet, CORE_ADDR address,
{
int addr_size = gdbarch_addr_bit (target_gdbarch ()) / 8;
- std::string request = string_printf ("qMemTags:%s,%s:%s",
- phex_nz (address, addr_size),
- phex_nz (len, sizeof (len)),
- phex_nz (type, sizeof (type)));
+ std::string request
+ = string_printf ("qMemTags:%s,%s:%s", phex_nz (address, addr_size),
+ phex_nz (len, sizeof (len)),
+ phex_nz (type, sizeof (type)));
strcpy (packet.data (), request.c_str ());
}
@@ -14902,15 +14806,15 @@ create_store_memtags_request (gdb::char_vector &packet, CORE_ADDR address,
int addr_size = gdbarch_addr_bit (target_gdbarch ()) / 8;
/* Put together the main packet, address and length. */
- std::string request = string_printf ("QMemTags:%s,%s:%s:",
- phex_nz (address, addr_size),
- phex_nz (len, sizeof (len)),
- phex_nz (type, sizeof (type)));
+ std::string request
+ = string_printf ("QMemTags:%s,%s:%s:", phex_nz (address, addr_size),
+ phex_nz (len, sizeof (len)),
+ phex_nz (type, sizeof (type)));
request += bin2hex (tags.data (), tags.size ());
/* Check if we have exceeded the maximum packet size. */
if (packet.size () < request.length ())
- error (_("Contents too big for packet QMemTags."));
+ error (_ ("Contents too big for packet QMemTags."));
strcpy (packet.data (), request.c_str ());
}
@@ -14923,7 +14827,8 @@ remote_target::fetch_memtags (CORE_ADDR address, size_t len,
{
/* Make sure the qMemTags packet is supported. */
if (!m_features.remote_memory_tagging_p ())
- gdb_assert_not_reached ("remote fetch_memtags called with packet disabled");
+ gdb_assert_not_reached (
+ "remote fetch_memtags called with packet disabled");
struct remote_state *rs = get_remote_state ();
@@ -14943,7 +14848,8 @@ remote_target::store_memtags (CORE_ADDR address, size_t len,
{
/* Make sure the QMemTags packet is supported. */
if (!m_features.remote_memory_tagging_p ())
- gdb_assert_not_reached ("remote store_memtags called with packet disabled");
+ gdb_assert_not_reached (
+ "remote store_memtags called with packet disabled");
struct remote_state *rs = get_remote_state ();
@@ -14969,7 +14875,8 @@ remote_target_is_non_stop_p (remote_target *t)
#if GDB_SELF_TEST
-namespace selftests {
+namespace selftests
+{
static void
test_memory_tagging_functions ()
@@ -15037,8 +14944,8 @@ test_memory_tagging_functions ()
tags.resize (0);
expected = "QMemTags:0,0:0:";
create_store_memtags_request (packet, 0x0, 0x0, 0, tags);
- SELF_CHECK (memcmp (packet.data (), expected.c_str (),
- expected.length ()) == 0);
+ SELF_CHECK (memcmp (packet.data (), expected.c_str (), expected.length ())
+ == 0);
/* Non-empty tag data. */
tags.resize (0);
@@ -15046,14 +14953,15 @@ test_memory_tagging_functions ()
tags.push_back (i);
expected = "QMemTags:deadbeef,ff:1:0001020304";
create_store_memtags_request (packet, 0xdeadbeef, 255, 1, tags);
- SELF_CHECK (memcmp (packet.data (), expected.c_str (),
- expected.length ()) == 0);
+ SELF_CHECK (memcmp (packet.data (), expected.c_str (), expected.length ())
+ == 0);
}
} // namespace selftests
#endif /* GDB_SELF_TEST */
void _initialize_remote ();
+
void
_initialize_remote ()
{
@@ -15069,26 +14977,24 @@ _initialize_remote ()
/* set/show remote ... */
- add_basic_prefix_cmd ("remote", class_maintenance, _("\
+ add_basic_prefix_cmd ("remote", class_maintenance, _ ("\
Remote protocol specific variables.\n\
Configure various remote-protocol specific variables such as\n\
the packets being used."),
- &remote_set_cmdlist,
- 0 /* allow-unknown */, &setlist);
- add_prefix_cmd ("remote", class_maintenance, show_remote_cmd, _("\
+ &remote_set_cmdlist, 0 /* allow-unknown */, &setlist);
+ add_prefix_cmd ("remote", class_maintenance, show_remote_cmd, _ ("\
Remote protocol specific variables.\n\
Configure various remote-protocol specific variables such as\n\
the packets being used."),
- &remote_show_cmdlist,
- 0 /* allow-unknown */, &showlist);
+ &remote_show_cmdlist, 0 /* allow-unknown */, &showlist);
- add_cmd ("compare-sections", class_obscure, compare_sections_command, _("\
+ add_cmd ("compare-sections", class_obscure, compare_sections_command, _ ("\
Compare section data on target to the exec file.\n\
Argument is a single section name (default: all loaded sections).\n\
To compare only read-only loaded sections, specify the -r option."),
&cmdlist);
- add_cmd ("packet", class_maintenance, cli_packet_command, _("\
+ add_cmd ("packet", class_maintenance, cli_packet_command, _ ("\
Send an arbitrary packet to a remote target.\n\
maintenance packet TEXT\n\
If GDB is talking to an inferior via the GDB serial protocol, then\n\
@@ -15098,96 +15004,106 @@ terminating `#' character and checksum."),
&maintenancelist);
set_show_commands remotebreak_cmds
- = add_setshow_boolean_cmd ("remotebreak", no_class, &remote_break, _("\
-Set whether to send break if interrupted."), _("\
-Show whether to send break if interrupted."), _("\
+ = add_setshow_boolean_cmd ("remotebreak", no_class, &remote_break, _ ("\
+Set whether to send break if interrupted."),
+ _ ("\
+Show whether to send break if interrupted."),
+ _ ("\
If set, a break, instead of a cntrl-c, is sent to the remote target."),
- set_remotebreak, show_remotebreak,
- &setlist, &showlist);
+ set_remotebreak, show_remotebreak, &setlist,
+ &showlist);
deprecate_cmd (remotebreak_cmds.set, "set remote interrupt-sequence");
deprecate_cmd (remotebreak_cmds.show, "show remote interrupt-sequence");
add_setshow_enum_cmd ("interrupt-sequence", class_support,
interrupt_sequence_modes, &interrupt_sequence_mode,
- _("\
-Set interrupt sequence to remote target."), _("\
-Show interrupt sequence to remote target."), _("\
+ _ ("\
+Set interrupt sequence to remote target."),
+ _ ("\
+Show interrupt sequence to remote target."),
+ _ ("\
Valid value is \"Ctrl-C\", \"BREAK\" or \"BREAK-g\". The default is \"Ctrl-C\"."),
- NULL, show_interrupt_sequence,
- &remote_set_cmdlist,
+ NULL, show_interrupt_sequence, &remote_set_cmdlist,
&remote_show_cmdlist);
add_setshow_boolean_cmd ("interrupt-on-connect", class_support,
- &interrupt_on_connect, _("\
-Set whether interrupt-sequence is sent to remote target when gdb connects to."), _("\
-Show whether interrupt-sequence is sent to remote target when gdb connects to."), _("\
+ &interrupt_on_connect, _ ("\
+Set whether interrupt-sequence is sent to remote target when gdb connects to."),
+ _ ("\
+Show whether interrupt-sequence is sent to remote target when gdb connects to."),
+ _ ("\
If set, interrupt sequence is sent to remote target."),
- NULL, NULL,
- &remote_set_cmdlist, &remote_show_cmdlist);
+ NULL, NULL, &remote_set_cmdlist,
+ &remote_show_cmdlist);
/* Install commands for configuring memory read/write packets. */
- add_cmd ("remotewritesize", no_class, set_memory_write_packet_size, _("\
+ add_cmd ("remotewritesize", no_class, set_memory_write_packet_size, _ ("\
Set the maximum number of bytes per memory write packet (deprecated)."),
&setlist);
- add_cmd ("remotewritesize", no_class, show_memory_write_packet_size, _("\
+ add_cmd ("remotewritesize", no_class, show_memory_write_packet_size, _ ("\
Show the maximum number of bytes per memory write packet (deprecated)."),
&showlist);
- add_cmd ("memory-write-packet-size", no_class,
- set_memory_write_packet_size, _("\
+ add_cmd ("memory-write-packet-size", no_class, set_memory_write_packet_size,
+ _ ("\
Set the maximum number of bytes per memory-write packet.\n\
Specify the number of bytes in a packet or 0 (zero) for the\n\
default packet size. The actual limit is further reduced\n\
dependent on the target. Specify \"fixed\" to disable the\n\
further restriction and \"limit\" to enable that restriction."),
&remote_set_cmdlist);
- add_cmd ("memory-read-packet-size", no_class,
- set_memory_read_packet_size, _("\
+ add_cmd ("memory-read-packet-size", no_class, set_memory_read_packet_size,
+ _ ("\
Set the maximum number of bytes per memory-read packet.\n\
Specify the number of bytes in a packet or 0 (zero) for the\n\
default packet size. The actual limit is further reduced\n\
dependent on the target. Specify \"fixed\" to disable the\n\
further restriction and \"limit\" to enable that restriction."),
&remote_set_cmdlist);
- add_cmd ("memory-write-packet-size", no_class,
- show_memory_write_packet_size,
- _("Show the maximum number of bytes per memory-write packet."),
+ add_cmd ("memory-write-packet-size", no_class, show_memory_write_packet_size,
+ _ ("Show the maximum number of bytes per memory-write packet."),
&remote_show_cmdlist);
- add_cmd ("memory-read-packet-size", no_class,
- show_memory_read_packet_size,
- _("Show the maximum number of bytes per memory-read packet."),
+ add_cmd ("memory-read-packet-size", no_class, show_memory_read_packet_size,
+ _ ("Show the maximum number of bytes per memory-read packet."),
&remote_show_cmdlist);
add_setshow_zuinteger_unlimited_cmd ("hardware-watchpoint-limit", no_class,
- &remote_hw_watchpoint_limit, _("\
-Set the maximum number of target hardware watchpoints."), _("\
-Show the maximum number of target hardware watchpoints."), _("\
+ &remote_hw_watchpoint_limit, _ ("\
+Set the maximum number of target hardware watchpoints."),
+ _ ("\
+Show the maximum number of target hardware watchpoints."),
+ _ ("\
Specify \"unlimited\" for unlimited hardware watchpoints."),
- NULL, show_hardware_watchpoint_limit,
- &remote_set_cmdlist,
- &remote_show_cmdlist);
- add_setshow_zuinteger_unlimited_cmd ("hardware-watchpoint-length-limit",
- no_class,
- &remote_hw_watchpoint_length_limit, _("\
-Set the maximum length (in bytes) of a target hardware watchpoint."), _("\
-Show the maximum length (in bytes) of a target hardware watchpoint."), _("\
+ NULL, show_hardware_watchpoint_limit,
+ &remote_set_cmdlist,
+ &remote_show_cmdlist);
+ add_setshow_zuinteger_unlimited_cmd (
+ "hardware-watchpoint-length-limit", no_class,
+ &remote_hw_watchpoint_length_limit, _ ("\
+Set the maximum length (in bytes) of a target hardware watchpoint."),
+ _ ("\
+Show the maximum length (in bytes) of a target hardware watchpoint."),
+ _ ("\
Specify \"unlimited\" to allow watchpoints of unlimited size."),
- NULL, show_hardware_watchpoint_length_limit,
- &remote_set_cmdlist, &remote_show_cmdlist);
+ NULL, show_hardware_watchpoint_length_limit, &remote_set_cmdlist,
+ &remote_show_cmdlist);
add_setshow_zuinteger_unlimited_cmd ("hardware-breakpoint-limit", no_class,
- &remote_hw_breakpoint_limit, _("\
-Set the maximum number of target hardware breakpoints."), _("\
-Show the maximum number of target hardware breakpoints."), _("\
+ &remote_hw_breakpoint_limit, _ ("\
+Set the maximum number of target hardware breakpoints."),
+ _ ("\
+Show the maximum number of target hardware breakpoints."),
+ _ ("\
Specify \"unlimited\" for unlimited hardware breakpoints."),
- NULL, show_hardware_breakpoint_limit,
- &remote_set_cmdlist, &remote_show_cmdlist);
+ NULL, show_hardware_breakpoint_limit,
+ &remote_set_cmdlist,
+ &remote_show_cmdlist);
add_setshow_zuinteger_cmd ("remoteaddresssize", class_obscure,
- &remote_address_size, _("\
-Set the maximum size of the address (in bits) in a memory packet."), _("\
-Show the maximum size of the address (in bits) in a memory packet."), NULL,
- NULL,
- NULL, /* FIXME: i18n: */
+ &remote_address_size, _ ("\
+Set the maximum size of the address (in bits) in a memory packet."),
+ _ ("\
+Show the maximum size of the address (in bits) in a memory packet."),
+ NULL, NULL, NULL, /* FIXME: i18n: */
&setlist, &showlist);
init_all_packet_configs ();
@@ -15211,8 +15127,9 @@ Show the maximum size of the address (in bits) in a memory packet."), NULL,
add_packet_config_cmd (PACKET_QStartupWithShell, "QStartupWithShell",
"startup-with-shell", 0);
- add_packet_config_cmd (PACKET_QEnvironmentHexEncoded,"QEnvironmentHexEncoded",
- "environment-hex-encoded", 0);
+ add_packet_config_cmd (PACKET_QEnvironmentHexEncoded,
+ "QEnvironmentHexEncoded", "environment-hex-encoded",
+ 0);
add_packet_config_cmd (PACKET_QEnvironmentReset, "QEnvironmentReset",
"environment-reset", 0);
@@ -15242,8 +15159,8 @@ Show the maximum size of the address (in bits) in a memory packet."), NULL,
add_packet_config_cmd (PACKET_qXfer_exec_file, "qXfer:exec-file:read",
"pid-to-exec-file", 0);
- add_packet_config_cmd (PACKET_qXfer_features,
- "qXfer:features:read", "target-features", 0);
+ add_packet_config_cmd (PACKET_qXfer_features, "qXfer:features:read",
+ "target-features", 0);
add_packet_config_cmd (PACKET_qXfer_libraries, "qXfer:libraries:read",
"library-info", 0);
@@ -15254,7 +15171,8 @@ Show the maximum size of the address (in bits) in a memory packet."), NULL,
add_packet_config_cmd (PACKET_qXfer_memory_map, "qXfer:memory-map:read",
"memory-map", 0);
- add_packet_config_cmd (PACKET_qXfer_osdata, "qXfer:osdata:read", "osdata", 0);
+ add_packet_config_cmd (PACKET_qXfer_osdata, "qXfer:osdata:read", "osdata",
+ 0);
add_packet_config_cmd (PACKET_qXfer_threads, "qXfer:threads:read", "threads",
0);
@@ -15312,7 +15230,8 @@ Show the maximum size of the address (in bits) in a memory packet."), NULL,
add_packet_config_cmd (PACKET_vRun, "vRun", "run", 0);
- add_packet_config_cmd (PACKET_QStartNoAckMode, "QStartNoAckMode", "noack", 0);
+ add_packet_config_cmd (PACKET_QStartNoAckMode, "QStartNoAckMode", "noack",
+ 0);
add_packet_config_cmd (PACKET_vKill, "vKill", "kill", 0);
@@ -15360,13 +15279,14 @@ Show the maximum size of the address (in bits) in a memory packet."), NULL,
add_packet_config_cmd (PACKET_Qbtrace_off, "Qbtrace:off", "disable-btrace",
0);
- add_packet_config_cmd (PACKET_Qbtrace_bts, "Qbtrace:bts", "enable-btrace-bts",
- 0);
+ add_packet_config_cmd (PACKET_Qbtrace_bts, "Qbtrace:bts",
+ "enable-btrace-bts", 0);
add_packet_config_cmd (PACKET_Qbtrace_pt, "Qbtrace:pt", "enable-btrace-pt",
0);
- add_packet_config_cmd (PACKET_qXfer_btrace, "qXfer:btrace", "read-btrace", 0);
+ add_packet_config_cmd (PACKET_qXfer_btrace, "qXfer:btrace", "read-btrace",
+ 0);
add_packet_config_cmd (PACKET_qXfer_btrace_conf, "qXfer:btrace-conf",
"read-btrace-conf", 0);
@@ -15400,14 +15320,15 @@ Show the maximum size of the address (in bits) in a memory packet."), NULL,
add_packet_config_cmd (PACKET_vCtrlC, "vCtrlC", "ctrl-c", 0);
- add_packet_config_cmd (PACKET_QThreadEvents, "QThreadEvents", "thread-events",
- 0);
+ add_packet_config_cmd (PACKET_QThreadEvents, "QThreadEvents",
+ "thread-events", 0);
add_packet_config_cmd (PACKET_no_resumed, "N stop reply",
"no-resumed-stop-reply", 0);
add_packet_config_cmd (PACKET_memory_tagging_feature,
- "memory-tagging-feature", "memory-tagging-feature", 0);
+ "memory-tagging-feature", "memory-tagging-feature",
+ 0);
/* Assert that we've registered "set remote foo-packet" commands
for all packet configs. */
@@ -15448,9 +15369,11 @@ Show the maximum size of the address (in bits) in a memory packet."), NULL,
have sets to this variable in their .gdbinit files (or in their
documentation). */
add_setshow_auto_boolean_cmd ("Z-packet", class_obscure,
- &remote_Z_packet_detect, _("\
-Set use of remote protocol `Z' packets."), _("\
-Show use of remote protocol `Z' packets."), _("\
+ &remote_Z_packet_detect, _ ("\
+Set use of remote protocol `Z' packets."),
+ _ ("\
+Show use of remote protocol `Z' packets."),
+ _ ("\
When set, GDB will attempt to use the remote breakpoint and watchpoint\n\
packets."),
set_remote_protocol_Z_packet_cmd,
@@ -15459,84 +15382,81 @@ packets."),
`Z' packets is %s. */
&remote_set_cmdlist, &remote_show_cmdlist);
- add_basic_prefix_cmd ("remote", class_files, _("\
+ add_basic_prefix_cmd ("remote", class_files, _ ("\
Manipulate files on the remote system.\n\
Transfer files to and from the remote target system."),
- &remote_cmdlist,
- 0 /* allow-unknown */, &cmdlist);
+ &remote_cmdlist, 0 /* allow-unknown */, &cmdlist);
add_cmd ("put", class_files, remote_put_command,
- _("Copy a local file to the remote system."),
- &remote_cmdlist);
+ _ ("Copy a local file to the remote system."), &remote_cmdlist);
add_cmd ("get", class_files, remote_get_command,
- _("Copy a remote file to the local system."),
- &remote_cmdlist);
+ _ ("Copy a remote file to the local system."), &remote_cmdlist);
add_cmd ("delete", class_files, remote_delete_command,
- _("Delete a remote file."),
- &remote_cmdlist);
+ _ ("Delete a remote file."), &remote_cmdlist);
add_setshow_string_noescape_cmd ("exec-file", class_files,
- &remote_exec_file_var, _("\
-Set the remote pathname for \"run\"."), _("\
-Show the remote pathname for \"run\"."), NULL,
- set_remote_exec_file,
- show_remote_exec_file,
- &remote_set_cmdlist,
+ &remote_exec_file_var, _ ("\
+Set the remote pathname for \"run\"."),
+ _ ("\
+Show the remote pathname for \"run\"."),
+ NULL, set_remote_exec_file,
+ show_remote_exec_file, &remote_set_cmdlist,
&remote_show_cmdlist);
- add_setshow_boolean_cmd ("range-stepping", class_run,
- &use_range_stepping, _("\
-Enable or disable range stepping."), _("\
-Show whether target-assisted range stepping is enabled."), _("\
+ add_setshow_boolean_cmd ("range-stepping", class_run, &use_range_stepping,
+ _ ("\
+Enable or disable range stepping."),
+ _ ("\
+Show whether target-assisted range stepping is enabled."),
+ _ ("\
If on, and the target supports it, when stepping a source line, GDB\n\
tells the target to step the corresponding range of addresses itself instead\n\
of issuing multiple single-steps. This speeds up source level\n\
stepping. If off, GDB always issues single-steps, even if range\n\
stepping is supported by the target. The default is on."),
- set_range_stepping,
- show_range_stepping,
- &setlist,
+ set_range_stepping, show_range_stepping, &setlist,
&showlist);
- add_setshow_zinteger_cmd ("watchdog", class_maintenance, &watchdog, _("\
-Set watchdog timer."), _("\
-Show watchdog timer."), _("\
+ add_setshow_zinteger_cmd ("watchdog", class_maintenance, &watchdog, _ ("\
+Set watchdog timer."),
+ _ ("\
+Show watchdog timer."),
+ _ ("\
When non-zero, this timeout is used instead of waiting forever for a target\n\
to finish a low-level step or continue operation. If the specified amount\n\
of time passes without a response from the target, an error occurs."),
- NULL,
- show_watchdog,
- &setlist, &showlist);
+ NULL, show_watchdog, &setlist, &showlist);
add_setshow_zuinteger_unlimited_cmd ("remote-packet-max-chars", no_class,
- &remote_packet_max_chars, _("\
-Set the maximum number of characters to display for each remote packet."), _("\
-Show the maximum number of characters to display for each remote packet."), _("\
+ &remote_packet_max_chars, _ ("\
+Set the maximum number of characters to display for each remote packet."),
+ _ ("\
+Show the maximum number of characters to display for each remote packet."),
+ _ ("\
Specify \"unlimited\" to display all the characters."),
NULL, show_remote_packet_max_chars,
&setdebuglist, &showdebuglist);
add_setshow_boolean_cmd ("remote", no_class, &remote_debug,
- _("Set debugging of remote protocol."),
- _("Show debugging of remote protocol."),
- _("\
+ _ ("Set debugging of remote protocol."),
+ _ ("Show debugging of remote protocol."), _ ("\
When enabled, each packet sent or received with the remote target\n\
is displayed."),
- NULL,
- show_remote_debug,
- &setdebuglist, &showdebuglist);
+ NULL, show_remote_debug, &setdebuglist,
+ &showdebuglist);
add_setshow_zuinteger_unlimited_cmd ("remotetimeout", no_class,
- &remote_timeout, _("\
-Set timeout limit to wait for target to respond."), _("\
-Show timeout limit to wait for target to respond."), _("\
+ &remote_timeout, _ ("\
+Set timeout limit to wait for target to respond."),
+ _ ("\
+Show timeout limit to wait for target to respond."),
+ _ ("\
This value is used to set the time limit for gdb to wait for a response\n\
from the target."),
- NULL,
- show_remote_timeout,
- &setlist, &showlist);
+ NULL, show_remote_timeout, &setlist,
+ &showlist);
/* Eventually initialize fileio. See fileio.c */
initialize_remote_fileio (&remote_set_cmdlist, &remote_show_cmdlist);
diff --git a/gdb/remote.h b/gdb/remote.h
index 74366cdbcfb..0bb352ed3c7 100644
--- a/gdb/remote.h
+++ b/gdb/remote.h
@@ -37,9 +37,9 @@ extern bool remote_debug;
/* Same as the above, but don't include the function name. */
-#define remote_debug_printf_nofunc(fmt, ...) \
- debug_prefixed_printf_cond_nofunc (remote_debug, "remote", \
- fmt, ##__VA_ARGS__)
+#define remote_debug_printf_nofunc(fmt, ...) \
+ debug_prefixed_printf_cond_nofunc (remote_debug, "remote", fmt, \
+ ##__VA_ARGS__)
/* Print "remote" enter/exit debug statements. */
@@ -52,8 +52,8 @@ extern bool remote_debug;
rather than timing out; this is used (in synchronous mode) to wait
for a target that is is executing user code to stop. */
-extern void getpkt (remote_target *remote,
- char **buf, long *sizeof_buf, int forever);
+extern void getpkt (remote_target *remote, char **buf, long *sizeof_buf,
+ int forever);
/* Send a packet to the remote machine, with error checking. The data
of the packet is in BUF. The string in BUF can be at most PBUFSIZ
@@ -115,7 +115,6 @@ struct send_remote_packet_callbacks
extern void send_remote_packet (gdb::array_view<const char> &buf,
send_remote_packet_callbacks *callbacks);
-
/* Return true if TARGET is a remote, or extended-remote target, otherwise,
return false. */
diff --git a/gdb/reverse.c b/gdb/reverse.c
index 0a9cc298aeb..f29c53f817b 100644
--- a/gdb/reverse.c
+++ b/gdb/reverse.c
@@ -41,11 +41,12 @@ exec_reverse_once (const char *cmd, const char *args, int from_tty)
enum exec_direction_kind dir = execution_direction;
if (dir == EXEC_REVERSE)
- error (_("Already in reverse mode. Use '%s' or 'set exec-dir forward'."),
+ error (_ ("Already in reverse mode. Use '%s' or 'set exec-dir forward'."),
cmd);
if (!target_can_execute_reverse ())
- error (_("Target %s does not support this command."), target_shortname ());
+ error (_ ("Target %s does not support this command."),
+ target_shortname ());
std::string reverse_command = string_printf ("%s %s", cmd, args ? args : "");
scoped_restore restore_exec_dir
@@ -91,7 +92,8 @@ reverse_finish (const char *args, int from_tty)
/* Data structures for a bookmark list. */
-struct bookmark {
+struct bookmark
+{
int number = 0;
CORE_ADDR pc = 0;
struct symtab_and_line sal;
@@ -119,7 +121,7 @@ save_bookmark_command (const char *args, int from_tty)
dont_repeat ();
if (bookmark_id == NULL)
- error (_("target_get_bookmark failed."));
+ error (_ ("target_get_bookmark failed."));
/* Set up a bookmark struct. */
all_bookmarks.emplace_back ();
@@ -130,7 +132,7 @@ save_bookmark_command (const char *args, int from_tty)
b.sal.pspace = get_frame_program_space (get_current_frame ());
b.opaque_data.reset (bookmark_id);
- gdb_printf (_("Saved bookmark %d at %s\n"), b.number,
+ gdb_printf (_ ("Saved bookmark %d at %s\n"), b.number,
paddress (gdbarch, b.sal.pc));
}
@@ -140,8 +142,7 @@ static bool
delete_one_bookmark (int num)
{
/* Find bookmark with corresponding number. */
- for (auto iter = all_bookmarks.begin ();
- iter != all_bookmarks.end ();
+ for (auto iter = all_bookmarks.begin (); iter != all_bookmarks.end ();
++iter)
{
if (iter->number == num)
@@ -164,13 +165,13 @@ delete_bookmark_command (const char *args, int from_tty)
{
if (all_bookmarks.empty ())
{
- warning (_("No bookmarks."));
+ warning (_ ("No bookmarks."));
return;
}
if (args == NULL || args[0] == '\0')
{
- if (from_tty && !query (_("Delete all bookmarks? ")))
+ if (from_tty && !query (_ ("Delete all bookmarks? ")))
return;
delete_all_bookmarks ();
return;
@@ -182,7 +183,7 @@ delete_bookmark_command (const char *args, int from_tty)
int num = parser.get_number ();
if (!delete_one_bookmark (num))
/* Not found. */
- warning (_("No bookmark #%d."), num);
+ warning (_ ("No bookmark #%d."), num);
}
}
@@ -195,10 +196,9 @@ goto_bookmark_command (const char *args, int from_tty)
const char *p = args;
if (args == NULL || args[0] == '\0')
- error (_("Command requires an argument."));
+ error (_ ("Command requires an argument."));
- if (startswith (args, "start")
- || startswith (args, "begin")
+ if (startswith (args, "start") || startswith (args, "begin")
|| startswith (args, "end"))
{
/* Special case. Give target opportunity to handle. */
@@ -210,7 +210,7 @@ goto_bookmark_command (const char *args, int from_tty)
{
/* Special case -- quoted string. Pass on to target. */
if (args[strlen (args) - 1] != args[0])
- error (_("Unbalanced quotes: %s"), args);
+ error (_ ("Unbalanced quotes: %s"), args);
target_goto_bookmark ((gdb_byte *) args, from_tty);
return;
}
@@ -219,7 +219,7 @@ goto_bookmark_command (const char *args, int from_tty)
num = get_number (&args);
if (num == 0)
- error (_("goto-bookmark: invalid bookmark number '%s'."), p);
+ error (_ ("goto-bookmark: invalid bookmark number '%s'."), p);
for (const bookmark &iter : all_bookmarks)
{
@@ -231,7 +231,7 @@ goto_bookmark_command (const char *args, int from_tty)
}
}
/* Not found. */
- error (_("goto-bookmark: no bookmark found for '%s'."), p);
+ error (_ ("goto-bookmark: no bookmark found for '%s'."), p);
}
static int
@@ -244,10 +244,8 @@ bookmark_1 (int bnum)
{
if (bnum == -1 || bnum == iter.number)
{
- gdb_printf (" %d %s '%s'\n",
- iter.number,
- paddress (gdbarch, iter.pc),
- iter.opaque_data.get ());
+ gdb_printf (" %d %s '%s'\n", iter.number,
+ paddress (gdbarch, iter.pc), iter.opaque_data.get ());
matched++;
}
}
@@ -264,7 +262,7 @@ static void
info_bookmarks_command (const char *args, int from_tty)
{
if (all_bookmarks.empty ())
- gdb_printf (_("No bookmarks.\n"));
+ gdb_printf (_ ("No bookmarks.\n"));
else if (args == NULL || *args == '\0')
bookmark_1 (-1);
else
@@ -279,17 +277,18 @@ info_bookmarks_command (const char *args, int from_tty)
}
void _initialize_reverse ();
+
void
_initialize_reverse ()
{
cmd_list_element *reverse_step_cmd
- = add_com ("reverse-step", class_run, reverse_step, _("\
+ = add_com ("reverse-step", class_run, reverse_step, _ ("\
Step program backward until it reaches the beginning of another source line.\n\
Argument N means do this N times (or till program stops for another reason)."));
add_com_alias ("rs", reverse_step_cmd, class_run, 1);
cmd_list_element *reverse_next_cmd
- = add_com ("reverse-next", class_run, reverse_next, _("\
+ = add_com ("reverse-next", class_run, reverse_next, _ ("\
Step program backward, proceeding through subroutine calls.\n\
Like the \"reverse-step\" command as long as subroutine calls do not happen;\n\
when they do, the call is treated as one instruction.\n\
@@ -297,43 +296,43 @@ Argument N means do this N times (or till program stops for another reason)."));
add_com_alias ("rn", reverse_next_cmd, class_run, 1);
cmd_list_element *reverse_stepi_cmd
- = add_com ("reverse-stepi", class_run, reverse_stepi, _("\
+ = add_com ("reverse-stepi", class_run, reverse_stepi, _ ("\
Step backward exactly one instruction.\n\
Argument N means do this N times (or till program stops for another reason)."));
add_com_alias ("rsi", reverse_stepi_cmd, class_run, 0);
cmd_list_element *reverse_nexti_cmd
- = add_com ("reverse-nexti", class_run, reverse_nexti, _("\
+ = add_com ("reverse-nexti", class_run, reverse_nexti, _ ("\
Step backward one instruction, but proceed through called subroutines.\n\
Argument N means do this N times (or till program stops for another reason)."));
add_com_alias ("rni", reverse_nexti_cmd, class_run, 0);
cmd_list_element *reverse_continue_cmd
- = add_com ("reverse-continue", class_run, reverse_continue, _("\
+ = add_com ("reverse-continue", class_run, reverse_continue, _ ("\
Continue program being debugged but run it in reverse.\n\
If proceeding from breakpoint, a number N may be used as an argument,\n\
which means to set the ignore count of that breakpoint to N - 1 (so that\n\
the breakpoint won't break until the Nth time it is reached)."));
add_com_alias ("rc", reverse_continue_cmd, class_run, 0);
- add_com ("reverse-finish", class_run, reverse_finish, _("\
+ add_com ("reverse-finish", class_run, reverse_finish, _ ("\
Execute backward until just before selected stack frame is called."));
- add_com ("bookmark", class_bookmark, save_bookmark_command, _("\
+ add_com ("bookmark", class_bookmark, save_bookmark_command, _ ("\
Set a bookmark in the program's execution history.\n\
A bookmark represents a point in the execution history \n\
that can be returned to at a later point in the debug session."));
- add_info ("bookmarks", info_bookmarks_command, _("\
+ add_info ("bookmarks", info_bookmarks_command, _ ("\
Status of user-settable bookmarks.\n\
Bookmarks are user-settable markers representing a point in the \n\
execution history that can be returned to later in the same debug \n\
session."));
- add_cmd ("bookmark", class_bookmark, delete_bookmark_command, _("\
+ add_cmd ("bookmark", class_bookmark, delete_bookmark_command, _ ("\
Delete a bookmark from the bookmark list.\n\
Argument is a bookmark number or numbers,\n\
or no argument to delete all bookmarks."),
&deletelist);
- add_com ("goto-bookmark", class_bookmark, goto_bookmark_command, _("\
+ add_com ("goto-bookmark", class_bookmark, goto_bookmark_command, _ ("\
Go to an earlier-bookmarked point in the program's execution history.\n\
Argument is the bookmark number of a bookmark saved earlier by using \n\
the 'bookmark' command, or the special arguments:\n\
diff --git a/gdb/riscv-fbsd-nat.c b/gdb/riscv-fbsd-nat.c
index a6fc1fed073..e99d862afd9 100644
--- a/gdb/riscv-fbsd-nat.c
+++ b/gdb/riscv-fbsd-nat.c
@@ -42,8 +42,7 @@ static riscv_fbsd_nat_target the_riscv_fbsd_nat_target;
for all registers. */
void
-riscv_fbsd_nat_target::fetch_registers (struct regcache *regcache,
- int regnum)
+riscv_fbsd_nat_target::fetch_registers (struct regcache *regcache, int regnum)
{
if (regnum == -1 || regnum == RISCV_ZERO_REGNUM)
regcache->raw_supply_zeroed (RISCV_ZERO_REGNUM);
@@ -57,8 +56,7 @@ riscv_fbsd_nat_target::fetch_registers (struct regcache *regcache,
this for all registers. */
void
-riscv_fbsd_nat_target::store_registers (struct regcache *regcache,
- int regnum)
+riscv_fbsd_nat_target::store_registers (struct regcache *regcache, int regnum)
{
store_register_set<struct reg> (regcache, regnum, PT_GETREGS, PT_SETREGS,
&riscv_fbsd_gregset);
@@ -67,6 +65,7 @@ riscv_fbsd_nat_target::store_registers (struct regcache *regcache,
}
void _initialize_riscv_fbsd_nat ();
+
void
_initialize_riscv_fbsd_nat ()
{
diff --git a/gdb/riscv-fbsd-tdep.c b/gdb/riscv-fbsd-tdep.c
index 8ae4a1953bc..a9ffc935354 100644
--- a/gdb/riscv-fbsd-tdep.c
+++ b/gdb/riscv-fbsd-tdep.c
@@ -30,40 +30,32 @@
/* Register maps. */
-static const struct regcache_map_entry riscv_fbsd_gregmap[] =
- {
- { 1, RISCV_RA_REGNUM, 0 },
- { 1, RISCV_SP_REGNUM, 0 },
- { 1, RISCV_GP_REGNUM, 0 },
- { 1, RISCV_TP_REGNUM, 0 },
- { 3, 5, 0 }, /* t0 - t2 */
- { 4, 28, 0 }, /* t3 - t6 */
- { 2, RISCV_FP_REGNUM, 0 }, /* s0 - s1 */
- { 10, 18, 0 }, /* s2 - s11 */
- { 8, RISCV_A0_REGNUM, 0 }, /* a0 - a7 */
- { 1, RISCV_PC_REGNUM, 0 },
- { 1, RISCV_CSR_SSTATUS_REGNUM, 0 },
- { 0 }
- };
-
-static const struct regcache_map_entry riscv_fbsd_fpregmap[] =
- {
- { 32, RISCV_FIRST_FP_REGNUM, 16 },
- { 1, RISCV_CSR_FCSR_REGNUM, 8 },
- { 0 }
- };
+static const struct regcache_map_entry riscv_fbsd_gregmap[]
+ = { { 1, RISCV_RA_REGNUM, 0 },
+ { 1, RISCV_SP_REGNUM, 0 },
+ { 1, RISCV_GP_REGNUM, 0 },
+ { 1, RISCV_TP_REGNUM, 0 },
+ { 3, 5, 0 }, /* t0 - t2 */
+ { 4, 28, 0 }, /* t3 - t6 */
+ { 2, RISCV_FP_REGNUM, 0 }, /* s0 - s1 */
+ { 10, 18, 0 }, /* s2 - s11 */
+ { 8, RISCV_A0_REGNUM, 0 }, /* a0 - a7 */
+ { 1, RISCV_PC_REGNUM, 0 },
+ { 1, RISCV_CSR_SSTATUS_REGNUM, 0 },
+ { 0 } };
+
+static const struct regcache_map_entry riscv_fbsd_fpregmap[]
+ = { { 32, RISCV_FIRST_FP_REGNUM, 16 },
+ { 1, RISCV_CSR_FCSR_REGNUM, 8 },
+ { 0 } };
/* Register set definitions. */
-const struct regset riscv_fbsd_gregset =
- {
- riscv_fbsd_gregmap, riscv_supply_regset, regcache_collect_regset
- };
+const struct regset riscv_fbsd_gregset
+ = { riscv_fbsd_gregmap, riscv_supply_regset, regcache_collect_regset };
-const struct regset riscv_fbsd_fpregset =
- {
- riscv_fbsd_fpregmap, riscv_supply_regset, regcache_collect_regset
- };
+const struct regset riscv_fbsd_fpregset
+ = { riscv_fbsd_fpregmap, riscv_supply_regset, regcache_collect_regset };
/* Implement the "iterate_over_regset_sections" gdbarch method. */
@@ -74,8 +66,8 @@ riscv_fbsd_iterate_over_regset_sections (struct gdbarch *gdbarch,
const struct regcache *regcache)
{
cb (".reg", RISCV_FBSD_NUM_GREGS * riscv_isa_xlen (gdbarch),
- RISCV_FBSD_NUM_GREGS * riscv_isa_xlen (gdbarch),
- &riscv_fbsd_gregset, NULL, cb_data);
+ RISCV_FBSD_NUM_GREGS * riscv_isa_xlen (gdbarch), &riscv_fbsd_gregset,
+ NULL, cb_data);
cb (".reg2", RISCV_FBSD_SIZEOF_FPREGSET, RISCV_FBSD_SIZEOF_FPREGSET,
&riscv_fbsd_fpregset, NULL, cb_data);
}
@@ -100,25 +92,22 @@ riscv_fbsd_iterate_over_regset_sections (struct gdbarch *gdbarch,
by the floating point register set. The floating point register
set is only valid if the _MC_FP_VALID flag is set in mc_flags. */
-#define RISCV_SIGFRAME_UCONTEXT_OFFSET 80
-#define RISCV_UCONTEXT_MCONTEXT_OFFSET 16
-#define RISCV_MCONTEXT_FLAG_FP_VALID 0x1
+#define RISCV_SIGFRAME_UCONTEXT_OFFSET 80
+#define RISCV_UCONTEXT_MCONTEXT_OFFSET 16
+#define RISCV_MCONTEXT_FLAG_FP_VALID 0x1
/* Implement the "init" method of struct tramp_frame. */
static void
riscv_fbsd_sigframe_init (const struct tramp_frame *self,
frame_info_ptr this_frame,
- struct trad_frame_cache *this_cache,
- CORE_ADDR func)
+ struct trad_frame_cache *this_cache, CORE_ADDR func)
{
struct gdbarch *gdbarch = get_frame_arch (this_frame);
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
CORE_ADDR sp = get_frame_register_unsigned (this_frame, RISCV_SP_REGNUM);
CORE_ADDR mcontext_addr
- = (sp
- + RISCV_SIGFRAME_UCONTEXT_OFFSET
- + RISCV_UCONTEXT_MCONTEXT_OFFSET);
+ = (sp + RISCV_SIGFRAME_UCONTEXT_OFFSET + RISCV_UCONTEXT_MCONTEXT_OFFSET);
gdb_byte buf[4];
trad_frame_set_reg_regmap (this_cache, riscv_fbsd_gregmap, mcontext_addr,
@@ -126,8 +115,7 @@ riscv_fbsd_sigframe_init (const struct tramp_frame *self,
CORE_ADDR fpregs_addr
= mcontext_addr + RISCV_FBSD_NUM_GREGS * riscv_isa_xlen (gdbarch);
- CORE_ADDR fp_flags_addr
- = fpregs_addr + RISCV_FBSD_SIZEOF_FPREGSET;
+ CORE_ADDR fp_flags_addr = fpregs_addr + RISCV_FBSD_SIZEOF_FPREGSET;
if (target_read_memory (fp_flags_addr, buf, 4) == 0
&& (extract_unsigned_integer (buf, 4, byte_order)
& RISCV_MCONTEXT_FLAG_FP_VALID))
@@ -143,22 +131,18 @@ riscv_fbsd_sigframe_init (const struct tramp_frame *self,
claim that all instructions are 16 bits and use two "slots" for
32-bit instructions. */
-static const struct tramp_frame riscv_fbsd_sigframe =
-{
- SIGTRAMP_FRAME,
- 2,
- {
- {0x850a, ULONGEST_MAX}, /* mov a0, sp */
- {0x0513, ULONGEST_MAX}, /* addi a0, a0, #SF_UC */
- {0x0505, ULONGEST_MAX},
- {0x0293, ULONGEST_MAX}, /* li t0, #SYS_sigreturn */
- {0x1a10, ULONGEST_MAX},
- {0x0073, ULONGEST_MAX}, /* ecall */
- {0x0000, ULONGEST_MAX},
- {TRAMP_SENTINEL_INSN, ULONGEST_MAX}
- },
- riscv_fbsd_sigframe_init
-};
+static const struct tramp_frame riscv_fbsd_sigframe
+ = { SIGTRAMP_FRAME,
+ 2,
+ { { 0x850a, ULONGEST_MAX }, /* mov a0, sp */
+ { 0x0513, ULONGEST_MAX }, /* addi a0, a0, #SF_UC */
+ { 0x0505, ULONGEST_MAX },
+ { 0x0293, ULONGEST_MAX }, /* li t0, #SYS_sigreturn */
+ { 0x1a10, ULONGEST_MAX },
+ { 0x0073, ULONGEST_MAX }, /* ecall */
+ { 0x0000, ULONGEST_MAX },
+ { TRAMP_SENTINEL_INSN, ULONGEST_MAX } },
+ riscv_fbsd_sigframe_init };
/* Implement the "get_thread_local_address" gdbarch method. */
@@ -175,7 +159,7 @@ riscv_fbsd_get_thread_local_address (struct gdbarch *gdbarch, ptid_t ptid,
ULONGEST tp;
if (regcache->cooked_read (RISCV_TP_REGNUM, &tp) != REG_VALID)
- error (_("Unable to fetch %%tp"));
+ error (_ ("Unable to fetch %%tp"));
/* %tp points to the end of the TCB which contains two pointers.
The first pointer in the TCB points to the DTV array. */
@@ -193,15 +177,15 @@ riscv_fbsd_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
set_gdbarch_software_single_step (gdbarch, riscv_software_single_step);
- set_solib_svr4_fetch_link_map_offsets (gdbarch,
- (riscv_isa_xlen (gdbarch) == 4
- ? svr4_ilp32_fetch_link_map_offsets
- : svr4_lp64_fetch_link_map_offsets));
+ set_solib_svr4_fetch_link_map_offsets (
+ gdbarch,
+ (riscv_isa_xlen (gdbarch) == 4 ? svr4_ilp32_fetch_link_map_offsets
+ : svr4_lp64_fetch_link_map_offsets));
tramp_frame_prepend_unwinder (gdbarch, &riscv_fbsd_sigframe);
- set_gdbarch_iterate_over_regset_sections
- (gdbarch, riscv_fbsd_iterate_over_regset_sections);
+ set_gdbarch_iterate_over_regset_sections (
+ gdbarch, riscv_fbsd_iterate_over_regset_sections);
set_gdbarch_fetch_tls_load_module_address (gdbarch,
svr4_fetch_objfile_link_map);
@@ -210,6 +194,7 @@ riscv_fbsd_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
}
void _initialize_riscv_fbsd_tdep ();
+
void
_initialize_riscv_fbsd_tdep ()
{
diff --git a/gdb/riscv-fbsd-tdep.h b/gdb/riscv-fbsd-tdep.h
index ee5bb2b296e..0000026f15b 100644
--- a/gdb/riscv-fbsd-tdep.h
+++ b/gdb/riscv-fbsd-tdep.h
@@ -24,7 +24,7 @@
/* The general-purpose regset consists of 31 X registers, EPC, and
SSTATUS. */
-#define RISCV_FBSD_NUM_GREGS 33
+#define RISCV_FBSD_NUM_GREGS 33
/* The fp regset always consists of 32 128-bit registers, plus a
64-bit CSR_FCSR. If 'Q' is not supported, only the low 64-bits of
diff --git a/gdb/riscv-linux-nat.c b/gdb/riscv-linux-nat.c
index 8be4a5ac3e5..7729d69380a 100644
--- a/gdb/riscv-linux-nat.c
+++ b/gdb/riscv-linux-nat.c
@@ -31,7 +31,7 @@
/* Work around glibc header breakage causing ELF_NFPREG not to be usable. */
#ifndef NFPREG
-# define NFPREG 33
+#define NFPREG 33
#endif
/* RISC-V Linux native additions to the default linux support. */
@@ -39,6 +39,7 @@
class riscv_linux_nat_target final : public linux_nat_target
{
public:
+
/* Add our register access methods. */
void fetch_registers (struct regcache *regcache, int regnum) override;
void store_registers (struct regcache *regcache, int regnum) override;
@@ -95,19 +96,19 @@ supply_fpregset_regnum (struct regcache *regcache, const prfpregset_t *fpregs,
int regnum)
{
int flen = register_size (regcache->arch (), RISCV_FIRST_FP_REGNUM);
+
union
- {
- const prfpregset_t *fpregs;
- const gdb_byte *buf;
- }
- fpbuf = { .fpregs = fpregs };
+ {
+ const prfpregset_t *fpregs;
+ const gdb_byte *buf;
+ } fpbuf = { .fpregs = fpregs };
+
int i;
if (regnum == -1)
{
/* We only support the FP registers and FCSR here. */
- for (i = RISCV_FIRST_FP_REGNUM;
- i <= RISCV_LAST_FP_REGNUM;
+ for (i = RISCV_FIRST_FP_REGNUM; i <= RISCV_LAST_FP_REGNUM;
i++, fpbuf.buf += flen)
regcache->raw_supply (i, fpbuf.buf);
@@ -166,19 +167,19 @@ fill_fpregset (const struct regcache *regcache, prfpregset_t *fpregs,
int regnum)
{
int flen = register_size (regcache->arch (), RISCV_FIRST_FP_REGNUM);
+
union
- {
- prfpregset_t *fpregs;
- gdb_byte *buf;
- }
- fpbuf = { .fpregs = fpregs };
+ {
+ prfpregset_t *fpregs;
+ gdb_byte *buf;
+ } fpbuf = { .fpregs = fpregs };
+
int i;
if (regnum == -1)
{
/* We only support the FP registers and FCSR here. */
- for (i = RISCV_FIRST_FP_REGNUM;
- i <= RISCV_LAST_FP_REGNUM;
+ for (i = RISCV_FIRST_FP_REGNUM; i <= RISCV_LAST_FP_REGNUM;
i++, fpbuf.buf += flen)
regcache->raw_collect (i, fpbuf.buf);
@@ -214,7 +215,7 @@ riscv_linux_nat_target::fetch_registers (struct regcache *regcache, int regnum)
{
int tid;
- tid = get_ptrace_pid (regcache->ptid());
+ tid = get_ptrace_pid (regcache->ptid ());
if ((regnum >= RISCV_ZERO_REGNUM && regnum <= RISCV_PC_REGNUM)
|| (regnum == -1))
@@ -225,35 +226,32 @@ riscv_linux_nat_target::fetch_registers (struct regcache *regcache, int regnum)
iov.iov_base = &regs;
iov.iov_len = sizeof (regs);
- if (ptrace (PTRACE_GETREGSET, tid, NT_PRSTATUS,
- (PTRACE_TYPE_ARG3) &iov) == -1)
- perror_with_name (_("Couldn't get registers"));
+ if (ptrace (PTRACE_GETREGSET, tid, NT_PRSTATUS, (PTRACE_TYPE_ARG3) &iov)
+ == -1)
+ perror_with_name (_ ("Couldn't get registers"));
else
supply_gregset_regnum (regcache, &regs, regnum);
}
- if ((regnum >= RISCV_FIRST_FP_REGNUM
- && regnum <= RISCV_LAST_FP_REGNUM)
- || (regnum == RISCV_CSR_FCSR_REGNUM)
- || (regnum == -1))
+ if ((regnum >= RISCV_FIRST_FP_REGNUM && regnum <= RISCV_LAST_FP_REGNUM)
+ || (regnum == RISCV_CSR_FCSR_REGNUM) || (regnum == -1))
{
struct iovec iov;
elf_fpregset_t regs;
iov.iov_base = &regs;
- iov.iov_len = ELF_NFPREG * register_size (regcache->arch (),
- RISCV_FIRST_FP_REGNUM);
+ iov.iov_len = ELF_NFPREG
+ * register_size (regcache->arch (), RISCV_FIRST_FP_REGNUM);
gdb_assert (iov.iov_len <= sizeof (regs));
- if (ptrace (PTRACE_GETREGSET, tid, NT_FPREGSET,
- (PTRACE_TYPE_ARG3) &iov) == -1)
- perror_with_name (_("Couldn't get registers"));
+ if (ptrace (PTRACE_GETREGSET, tid, NT_FPREGSET, (PTRACE_TYPE_ARG3) &iov)
+ == -1)
+ perror_with_name (_ ("Couldn't get registers"));
else
supply_fpregset_regnum (regcache, &regs, regnum);
}
- if ((regnum == RISCV_CSR_MISA_REGNUM)
- || (regnum == -1))
+ if ((regnum == RISCV_CSR_MISA_REGNUM) || (regnum == -1))
{
/* TODO: Need to add a ptrace call for this. */
regcache->raw_supply_zeroed (RISCV_CSR_MISA_REGNUM);
@@ -282,42 +280,42 @@ riscv_linux_nat_target::store_registers (struct regcache *regcache, int regnum)
iov.iov_base = &regs;
iov.iov_len = sizeof (regs);
- if (ptrace (PTRACE_GETREGSET, tid, NT_PRSTATUS,
- (PTRACE_TYPE_ARG3) &iov) == -1)
- perror_with_name (_("Couldn't get registers"));
+ if (ptrace (PTRACE_GETREGSET, tid, NT_PRSTATUS, (PTRACE_TYPE_ARG3) &iov)
+ == -1)
+ perror_with_name (_ ("Couldn't get registers"));
else
{
fill_gregset (regcache, &regs, regnum);
if (ptrace (PTRACE_SETREGSET, tid, NT_PRSTATUS,
- (PTRACE_TYPE_ARG3) &iov) == -1)
- perror_with_name (_("Couldn't set registers"));
+ (PTRACE_TYPE_ARG3) &iov)
+ == -1)
+ perror_with_name (_ ("Couldn't set registers"));
}
}
- if ((regnum >= RISCV_FIRST_FP_REGNUM
- && regnum <= RISCV_LAST_FP_REGNUM)
- || (regnum == RISCV_CSR_FCSR_REGNUM)
- || (regnum == -1))
+ if ((regnum >= RISCV_FIRST_FP_REGNUM && regnum <= RISCV_LAST_FP_REGNUM)
+ || (regnum == RISCV_CSR_FCSR_REGNUM) || (regnum == -1))
{
struct iovec iov;
elf_fpregset_t regs;
iov.iov_base = &regs;
- iov.iov_len = ELF_NFPREG * register_size (regcache->arch (),
- RISCV_FIRST_FP_REGNUM);
+ iov.iov_len = ELF_NFPREG
+ * register_size (regcache->arch (), RISCV_FIRST_FP_REGNUM);
gdb_assert (iov.iov_len <= sizeof (regs));
- if (ptrace (PTRACE_GETREGSET, tid, NT_FPREGSET,
- (PTRACE_TYPE_ARG3) &iov) == -1)
- perror_with_name (_("Couldn't get registers"));
+ if (ptrace (PTRACE_GETREGSET, tid, NT_FPREGSET, (PTRACE_TYPE_ARG3) &iov)
+ == -1)
+ perror_with_name (_ ("Couldn't get registers"));
else
{
fill_fpregset (regcache, &regs, regnum);
if (ptrace (PTRACE_SETREGSET, tid, NT_FPREGSET,
- (PTRACE_TYPE_ARG3) &iov) == -1)
- perror_with_name (_("Couldn't set registers"));
+ (PTRACE_TYPE_ARG3) &iov)
+ == -1)
+ perror_with_name (_ ("Couldn't set registers"));
}
}
@@ -328,6 +326,7 @@ riscv_linux_nat_target::store_registers (struct regcache *regcache, int regnum)
/* Initialize RISC-V Linux native support. */
void _initialize_riscv_linux_nat ();
+
void
_initialize_riscv_linux_nat ()
{
diff --git a/gdb/riscv-linux-tdep.c b/gdb/riscv-linux-tdep.c
index 292d7a4ef7c..a736969f21e 100644
--- a/gdb/riscv-linux-tdep.c
+++ b/gdb/riscv-linux-tdep.c
@@ -36,36 +36,28 @@
gdb puts it at offset 32. Register x0 is always 0 and can be ignored.
Registers x1 to x31 are in the same place. */
-static const struct regcache_map_entry riscv_linux_gregmap[] =
-{
- { 1, RISCV_PC_REGNUM, 0 },
- { 31, RISCV_RA_REGNUM, 0 }, /* x1 to x31 */
- { 0 }
-};
+static const struct regcache_map_entry riscv_linux_gregmap[]
+ = { { 1, RISCV_PC_REGNUM, 0 },
+ { 31, RISCV_RA_REGNUM, 0 }, /* x1 to x31 */
+ { 0 } };
/* Define the FP register mapping. The kernel puts the 32 FP regs first, and
then FCSR. */
-static const struct regcache_map_entry riscv_linux_fregmap[] =
-{
- { 32, RISCV_FIRST_FP_REGNUM, 0 },
- { 1, RISCV_CSR_FCSR_REGNUM, 0 },
- { 0 }
-};
+static const struct regcache_map_entry riscv_linux_fregmap[]
+ = { { 32, RISCV_FIRST_FP_REGNUM, 0 },
+ { 1, RISCV_CSR_FCSR_REGNUM, 0 },
+ { 0 } };
/* Define the general register regset. */
-static const struct regset riscv_linux_gregset =
-{
- riscv_linux_gregmap, riscv_supply_regset, regcache_collect_regset
-};
+static const struct regset riscv_linux_gregset
+ = { riscv_linux_gregmap, riscv_supply_regset, regcache_collect_regset };
/* Define the FP register regset. */
-static const struct regset riscv_linux_fregset =
-{
- riscv_linux_fregmap, riscv_supply_regset, regcache_collect_regset
-};
+static const struct regset riscv_linux_fregset
+ = { riscv_linux_fregmap, riscv_supply_regset, regcache_collect_regset };
/* Define hook for core file support. */
@@ -79,8 +71,8 @@ riscv_linux_iterate_over_regset_sections (struct gdbarch *gdbarch,
&riscv_linux_gregset, NULL, cb_data);
/* The kernel is adding 8 bytes for FCSR. */
cb (".reg2", (32 * riscv_isa_flen (gdbarch)) + 8,
- (32 * riscv_isa_flen (gdbarch)) + 8,
- &riscv_linux_fregset, NULL, cb_data);
+ (32 * riscv_isa_flen (gdbarch)) + 8, &riscv_linux_fregset, NULL,
+ cb_data);
}
/* Signal trampoline support. */
@@ -90,20 +82,17 @@ static void riscv_linux_sigframe_init (const struct tramp_frame *self,
struct trad_frame_cache *this_cache,
CORE_ADDR func);
-#define RISCV_INST_LI_A7_SIGRETURN 0x08b00893
-#define RISCV_INST_ECALL 0x00000073
-
-static const struct tramp_frame riscv_linux_sigframe = {
- SIGTRAMP_FRAME,
- 4,
- {
- { RISCV_INST_LI_A7_SIGRETURN, ULONGEST_MAX },
- { RISCV_INST_ECALL, ULONGEST_MAX },
- { TRAMP_SENTINEL_INSN }
- },
- riscv_linux_sigframe_init,
- NULL
-};
+#define RISCV_INST_LI_A7_SIGRETURN 0x08b00893
+#define RISCV_INST_ECALL 0x00000073
+
+static const struct tramp_frame riscv_linux_sigframe
+ = { SIGTRAMP_FRAME,
+ 4,
+ { { RISCV_INST_LI_A7_SIGRETURN, ULONGEST_MAX },
+ { RISCV_INST_ECALL, ULONGEST_MAX },
+ { TRAMP_SENTINEL_INSN } },
+ riscv_linux_sigframe_init,
+ NULL };
/* Runtime signal frames look like this:
struct rt_sigframe {
@@ -120,14 +109,13 @@ static const struct tramp_frame riscv_linux_sigframe = {
mcontext_t uc_mcontext;
}; */
-#define SIGFRAME_SIGINFO_SIZE 128
-#define UCONTEXT_MCONTEXT_OFFSET 176
+#define SIGFRAME_SIGINFO_SIZE 128
+#define UCONTEXT_MCONTEXT_OFFSET 176
static void
riscv_linux_sigframe_init (const struct tramp_frame *self,
frame_info_ptr this_frame,
- struct trad_frame_cache *this_cache,
- CORE_ADDR func)
+ struct trad_frame_cache *this_cache, CORE_ADDR func)
{
struct gdbarch *gdbarch = get_frame_arch (this_frame);
int xlen = riscv_isa_xlen (gdbarch);
@@ -185,10 +173,10 @@ riscv_linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
set_gdbarch_software_single_step (gdbarch, riscv_software_single_step);
- set_solib_svr4_fetch_link_map_offsets (gdbarch,
- (riscv_isa_xlen (gdbarch) == 4
- ? linux_ilp32_fetch_link_map_offsets
- : linux_lp64_fetch_link_map_offsets));
+ set_solib_svr4_fetch_link_map_offsets (
+ gdbarch,
+ (riscv_isa_xlen (gdbarch) == 4 ? linux_ilp32_fetch_link_map_offsets
+ : linux_lp64_fetch_link_map_offsets));
/* GNU/Linux uses SVR4-style shared libraries. */
set_gdbarch_skip_trampoline_code (gdbarch, find_solib_trampoline_target);
@@ -200,8 +188,8 @@ riscv_linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
set_gdbarch_fetch_tls_load_module_address (gdbarch,
svr4_fetch_objfile_link_map);
- set_gdbarch_iterate_over_regset_sections
- (gdbarch, riscv_linux_iterate_over_regset_sections);
+ set_gdbarch_iterate_over_regset_sections (
+ gdbarch, riscv_linux_iterate_over_regset_sections);
tramp_frame_prepend_unwinder (gdbarch, &riscv_linux_sigframe);
@@ -211,6 +199,7 @@ riscv_linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
/* Initialize RISC-V Linux target support. */
void _initialize_riscv_linux_tdep ();
+
void
_initialize_riscv_linux_tdep ()
{
diff --git a/gdb/riscv-none-tdep.c b/gdb/riscv-none-tdep.c
index 54445214f12..2cf93ef988a 100644
--- a/gdb/riscv-none-tdep.c
+++ b/gdb/riscv-none-tdep.c
@@ -35,45 +35,35 @@
gdb puts it at offset 32. Register x0 is always 0 and can be ignored.
Registers x1 to x31 are in the same place. */
-static const struct regcache_map_entry riscv_gregmap[] =
-{
- { 1, RISCV_PC_REGNUM, 0 },
- { 31, RISCV_RA_REGNUM, 0 }, /* x1 to x31 */
- { 0 }
-};
+static const struct regcache_map_entry riscv_gregmap[]
+ = { { 1, RISCV_PC_REGNUM, 0 },
+ { 31, RISCV_RA_REGNUM, 0 }, /* x1 to x31 */
+ { 0 } };
/* Define the FP register mapping. This follows the same format as the
RISC-V linux corefile. The kernel puts the 32 FP regs first, and then
FCSR. */
-static const struct regcache_map_entry riscv_fregmap[] =
-{
- { 32, RISCV_FIRST_FP_REGNUM, 0 },
- { 1, RISCV_CSR_FCSR_REGNUM, 4 }, /* Always stored as 4-bytes. */
- { 0 }
-};
+static const struct regcache_map_entry riscv_fregmap[]
+ = { { 32, RISCV_FIRST_FP_REGNUM, 0 },
+ { 1, RISCV_CSR_FCSR_REGNUM, 4 }, /* Always stored as 4-bytes. */
+ { 0 } };
/* Define the general register regset. */
-static const struct regset riscv_gregset =
-{
- riscv_gregmap, riscv_supply_regset, regcache_collect_regset
-};
+static const struct regset riscv_gregset
+ = { riscv_gregmap, riscv_supply_regset, regcache_collect_regset };
/* Define the FP register regset. */
-static const struct regset riscv_fregset =
-{
- riscv_fregmap, riscv_supply_regset, regcache_collect_regset
-};
+static const struct regset riscv_fregset
+ = { riscv_fregmap, riscv_supply_regset, regcache_collect_regset };
/* Define the CSR regset, this is not constant as the regmap field is
updated dynamically based on the current target description. */
-static struct regset riscv_csrset =
-{
- nullptr, regcache_supply_regset, regcache_collect_regset
-};
+static struct regset riscv_csrset
+ = { nullptr, regcache_supply_regset, regcache_collect_regset };
/* Update the regmap field of RISCV_CSRSET based on the CSRs available in
the current target description. */
@@ -90,16 +80,16 @@ riscv_update_csrmap (struct gdbarch *gdbarch,
/* Now create a register map for every csr found in the target
description. */
struct regcache_map_entry *riscv_csrmap
- = new struct regcache_map_entry[feature_csr->registers.size() + 1];
+ = new struct regcache_map_entry[feature_csr->registers.size () + 1];
for (auto &csr : feature_csr->registers)
{
- int regnum = user_reg_map_name_to_regnum (gdbarch, csr->name.c_str(),
- csr->name.length());
- riscv_csrmap[i++] = {1, regnum, 0};
+ int regnum = user_reg_map_name_to_regnum (gdbarch, csr->name.c_str (),
+ csr->name.length ());
+ riscv_csrmap[i++] = { 1, regnum, 0 };
}
/* Mark the end of the array. */
- riscv_csrmap[i] = {0};
+ riscv_csrmap[i] = { 0 };
riscv_csrset.regmap = riscv_csrmap;
}
@@ -134,13 +124,13 @@ riscv_iterate_over_regset_sections (struct gdbarch *gdbarch,
if (tdesc != nullptr)
{
const struct tdesc_feature *feature_csr
- = tdesc_find_feature (tdesc, riscv_feature_name_csr);
+ = tdesc_find_feature (tdesc, riscv_feature_name_csr);
if (feature_csr != nullptr && feature_csr->registers.size () > 0)
{
riscv_update_csrmap (gdbarch, feature_csr);
cb (".reg-riscv-csr",
- (feature_csr->registers.size() * riscv_isa_xlen (gdbarch)),
- (feature_csr->registers.size() * riscv_isa_xlen (gdbarch)),
+ (feature_csr->registers.size () * riscv_isa_xlen (gdbarch)),
+ (feature_csr->registers.size () * riscv_isa_xlen (gdbarch)),
&riscv_csrset, NULL, cb_data);
}
}
@@ -157,14 +147,14 @@ riscv_none_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
/* Iterate over registers for reading and writing bare metal RISC-V core
files. */
- set_gdbarch_iterate_over_regset_sections
- (gdbarch, riscv_iterate_over_regset_sections);
-
+ set_gdbarch_iterate_over_regset_sections (
+ gdbarch, riscv_iterate_over_regset_sections);
}
/* Initialize RISC-V bare-metal target support. */
void _initialize_riscv_none_tdep ();
+
void
_initialize_riscv_none_tdep ()
{
diff --git a/gdb/riscv-tdep.c b/gdb/riscv-tdep.c
index 60de60382c8..788ac6d4580 100644
--- a/gdb/riscv-tdep.c
+++ b/gdb/riscv-tdep.c
@@ -66,10 +66,10 @@
/* Define a series of is_XXX_insn functions to check if the value INSN
is an instance of instruction XXX. */
#define DECLARE_INSN(INSN_NAME, INSN_MATCH, INSN_MASK) \
-static inline bool is_ ## INSN_NAME ## _insn (long insn) \
-{ \
- return (insn & INSN_MASK) == INSN_MATCH; \
-}
+ static inline bool is_##INSN_NAME##_insn (long insn) \
+ { \
+ return (insn & INSN_MASK) == INSN_MATCH; \
+ }
#include "opcode/riscv-opc.h"
#undef DECLARE_INSN
@@ -146,12 +146,14 @@ value_of_riscv_user_reg (frame_info_ptr frame, const void *baton)
class riscv_pending_register_alias
{
public:
+
/* Constructor. */
riscv_pending_register_alias (const char *name, const void *baton)
: m_name (name),
m_baton (baton)
- { /* Nothing. */ }
+ { /* Nothing. */
+ }
/* Convert this into a user register for GDBARCH. */
@@ -161,6 +163,7 @@ public:
}
private:
+
/* The name for this alias. */
const char *m_name;
@@ -177,7 +180,8 @@ struct riscv_register_feature
{
explicit riscv_register_feature (const char *feature_name)
: m_feature_name (feature_name)
- { /* Delete. */ }
+ { /* Delete. */
+ }
riscv_register_feature () = delete;
DISABLE_COPY_AND_ASSIGN (riscv_register_feature);
@@ -198,21 +202,20 @@ struct riscv_register_feature
TDESC_DATA and add all its aliases to the ALIASES list.
PREFER_FIRST_NAME_P is used when deciding which aliases to create. */
bool check (struct tdesc_arch_data *tdesc_data,
- const struct tdesc_feature *feature,
- bool prefer_first_name_p,
+ const struct tdesc_feature *feature, bool prefer_first_name_p,
std::vector<riscv_pending_register_alias> *aliases) const;
};
/* Return the name of this feature. */
- const char *name () const
- { return m_feature_name; }
+ const char *name () const { return m_feature_name; }
protected:
/* Return a target description feature extracted from TDESC for this
register feature. Will return nullptr if there is no feature in TDESC
with the name M_FEATURE_NAME. */
- const struct tdesc_feature *tdesc_feature (const struct target_desc *tdesc) const
+ const struct tdesc_feature *
+ tdesc_feature (const struct target_desc *tdesc) const
{
return tdesc_find_feature (tdesc, name ());
}
@@ -231,16 +234,15 @@ private:
/* See description in the class declaration above. */
bool
-riscv_register_feature::register_info::check
- (struct tdesc_arch_data *tdesc_data,
- const struct tdesc_feature *feature,
- bool prefer_first_name_p,
- std::vector<riscv_pending_register_alias> *aliases) const
+riscv_register_feature::register_info::check (
+ struct tdesc_arch_data *tdesc_data, const struct tdesc_feature *feature,
+ bool prefer_first_name_p,
+ std::vector<riscv_pending_register_alias> *aliases) const
{
for (const char *name : this->names)
{
- bool found = tdesc_numbered_register (feature, tdesc_data,
- this->regnum, name);
+ bool found
+ = tdesc_numbered_register (feature, tdesc_data, this->regnum, name);
if (found)
{
/* We know that the target description mentions this
@@ -268,41 +270,39 @@ struct riscv_xreg_feature : public riscv_register_feature
riscv_xreg_feature ()
: riscv_register_feature (riscv_feature_name_cpu)
{
- m_registers = {
- { RISCV_ZERO_REGNUM + 0, { "zero", "x0" } },
- { RISCV_ZERO_REGNUM + 1, { "ra", "x1" } },
- { RISCV_ZERO_REGNUM + 2, { "sp", "x2" } },
- { RISCV_ZERO_REGNUM + 3, { "gp", "x3" } },
- { RISCV_ZERO_REGNUM + 4, { "tp", "x4" } },
- { RISCV_ZERO_REGNUM + 5, { "t0", "x5" } },
- { RISCV_ZERO_REGNUM + 6, { "t1", "x6" } },
- { RISCV_ZERO_REGNUM + 7, { "t2", "x7" } },
- { RISCV_ZERO_REGNUM + 8, { "fp", "x8", "s0" } },
- { RISCV_ZERO_REGNUM + 9, { "s1", "x9" } },
- { RISCV_ZERO_REGNUM + 10, { "a0", "x10" } },
- { RISCV_ZERO_REGNUM + 11, { "a1", "x11" } },
- { RISCV_ZERO_REGNUM + 12, { "a2", "x12" } },
- { RISCV_ZERO_REGNUM + 13, { "a3", "x13" } },
- { RISCV_ZERO_REGNUM + 14, { "a4", "x14" } },
- { RISCV_ZERO_REGNUM + 15, { "a5", "x15" } },
- { RISCV_ZERO_REGNUM + 16, { "a6", "x16" } },
- { RISCV_ZERO_REGNUM + 17, { "a7", "x17" } },
- { RISCV_ZERO_REGNUM + 18, { "s2", "x18" } },
- { RISCV_ZERO_REGNUM + 19, { "s3", "x19" } },
- { RISCV_ZERO_REGNUM + 20, { "s4", "x20" } },
- { RISCV_ZERO_REGNUM + 21, { "s5", "x21" } },
- { RISCV_ZERO_REGNUM + 22, { "s6", "x22" } },
- { RISCV_ZERO_REGNUM + 23, { "s7", "x23" } },
- { RISCV_ZERO_REGNUM + 24, { "s8", "x24" } },
- { RISCV_ZERO_REGNUM + 25, { "s9", "x25" } },
- { RISCV_ZERO_REGNUM + 26, { "s10", "x26" } },
- { RISCV_ZERO_REGNUM + 27, { "s11", "x27" } },
- { RISCV_ZERO_REGNUM + 28, { "t3", "x28" } },
- { RISCV_ZERO_REGNUM + 29, { "t4", "x29" } },
- { RISCV_ZERO_REGNUM + 30, { "t5", "x30" } },
- { RISCV_ZERO_REGNUM + 31, { "t6", "x31" } },
- { RISCV_ZERO_REGNUM + 32, { "pc" } }
- };
+ m_registers = { { RISCV_ZERO_REGNUM + 0, { "zero", "x0" } },
+ { RISCV_ZERO_REGNUM + 1, { "ra", "x1" } },
+ { RISCV_ZERO_REGNUM + 2, { "sp", "x2" } },
+ { RISCV_ZERO_REGNUM + 3, { "gp", "x3" } },
+ { RISCV_ZERO_REGNUM + 4, { "tp", "x4" } },
+ { RISCV_ZERO_REGNUM + 5, { "t0", "x5" } },
+ { RISCV_ZERO_REGNUM + 6, { "t1", "x6" } },
+ { RISCV_ZERO_REGNUM + 7, { "t2", "x7" } },
+ { RISCV_ZERO_REGNUM + 8, { "fp", "x8", "s0" } },
+ { RISCV_ZERO_REGNUM + 9, { "s1", "x9" } },
+ { RISCV_ZERO_REGNUM + 10, { "a0", "x10" } },
+ { RISCV_ZERO_REGNUM + 11, { "a1", "x11" } },
+ { RISCV_ZERO_REGNUM + 12, { "a2", "x12" } },
+ { RISCV_ZERO_REGNUM + 13, { "a3", "x13" } },
+ { RISCV_ZERO_REGNUM + 14, { "a4", "x14" } },
+ { RISCV_ZERO_REGNUM + 15, { "a5", "x15" } },
+ { RISCV_ZERO_REGNUM + 16, { "a6", "x16" } },
+ { RISCV_ZERO_REGNUM + 17, { "a7", "x17" } },
+ { RISCV_ZERO_REGNUM + 18, { "s2", "x18" } },
+ { RISCV_ZERO_REGNUM + 19, { "s3", "x19" } },
+ { RISCV_ZERO_REGNUM + 20, { "s4", "x20" } },
+ { RISCV_ZERO_REGNUM + 21, { "s5", "x21" } },
+ { RISCV_ZERO_REGNUM + 22, { "s6", "x22" } },
+ { RISCV_ZERO_REGNUM + 23, { "s7", "x23" } },
+ { RISCV_ZERO_REGNUM + 24, { "s8", "x24" } },
+ { RISCV_ZERO_REGNUM + 25, { "s9", "x25" } },
+ { RISCV_ZERO_REGNUM + 26, { "s10", "x26" } },
+ { RISCV_ZERO_REGNUM + 27, { "s11", "x27" } },
+ { RISCV_ZERO_REGNUM + 28, { "t3", "x28" } },
+ { RISCV_ZERO_REGNUM + 29, { "t4", "x29" } },
+ { RISCV_ZERO_REGNUM + 30, { "t5", "x30" } },
+ { RISCV_ZERO_REGNUM + 31, { "t6", "x31" } },
+ { RISCV_ZERO_REGNUM + 32, { "pc" } } };
}
/* Return the preferred name for the register with gdb register number
@@ -365,7 +365,7 @@ struct riscv_freg_feature : public riscv_register_feature
riscv_freg_feature ()
: riscv_register_feature (riscv_feature_name_fpu)
{
- m_registers = {
+ m_registers = {
{ RISCV_FIRST_FP_REGNUM + 0, { "ft0", "f0" } },
{ RISCV_FIRST_FP_REGNUM + 1, { "ft1", "f1" } },
{ RISCV_FIRST_FP_REGNUM + 2, { "ft2", "f2" } },
@@ -493,9 +493,7 @@ struct riscv_virtual_feature : public riscv_register_feature
riscv_virtual_feature ()
: riscv_register_feature (riscv_feature_name_virtual)
{
- m_registers = {
- { RISCV_PRIV_REGNUM, { "priv" } }
- };
+ m_registers = { { RISCV_PRIV_REGNUM, { "priv" } } };
}
bool check (const struct target_desc *tdesc,
@@ -530,8 +528,8 @@ struct riscv_csr_feature : public riscv_register_feature
: riscv_register_feature (riscv_feature_name_csr)
{
m_registers = {
-#define DECLARE_CSR(NAME,VALUE,CLASS,DEFINE_VER,ABORT_VER) \
- { RISCV_ ## VALUE ## _REGNUM, { # NAME } },
+#define DECLARE_CSR(NAME, VALUE, CLASS, DEFINE_VER, ABORT_VER) \
+ { RISCV_##VALUE##_REGNUM, { #NAME } },
#include "opcode/riscv-opc.h"
#undef DECLARE_CSR
};
@@ -562,8 +560,7 @@ private:
/* Complete RISCV_CSR_FEATURE, building the CSR alias names and adding them
to the name list for each register. */
- void
- riscv_create_csr_aliases ()
+ void riscv_create_csr_aliases ()
{
for (auto &reg : m_registers)
{
@@ -585,39 +582,23 @@ struct riscv_vector_feature : public riscv_register_feature
riscv_vector_feature ()
: riscv_register_feature (riscv_feature_name_vector)
{
- m_registers = {
- { RISCV_V0_REGNUM + 0, { "v0" } },
- { RISCV_V0_REGNUM + 1, { "v1" } },
- { RISCV_V0_REGNUM + 2, { "v2" } },
- { RISCV_V0_REGNUM + 3, { "v3" } },
- { RISCV_V0_REGNUM + 4, { "v4" } },
- { RISCV_V0_REGNUM + 5, { "v5" } },
- { RISCV_V0_REGNUM + 6, { "v6" } },
- { RISCV_V0_REGNUM + 7, { "v7" } },
- { RISCV_V0_REGNUM + 8, { "v8" } },
- { RISCV_V0_REGNUM + 9, { "v9" } },
- { RISCV_V0_REGNUM + 10, { "v10" } },
- { RISCV_V0_REGNUM + 11, { "v11" } },
- { RISCV_V0_REGNUM + 12, { "v12" } },
- { RISCV_V0_REGNUM + 13, { "v13" } },
- { RISCV_V0_REGNUM + 14, { "v14" } },
- { RISCV_V0_REGNUM + 15, { "v15" } },
- { RISCV_V0_REGNUM + 16, { "v16" } },
- { RISCV_V0_REGNUM + 17, { "v17" } },
- { RISCV_V0_REGNUM + 18, { "v18" } },
- { RISCV_V0_REGNUM + 19, { "v19" } },
- { RISCV_V0_REGNUM + 20, { "v20" } },
- { RISCV_V0_REGNUM + 21, { "v21" } },
- { RISCV_V0_REGNUM + 22, { "v22" } },
- { RISCV_V0_REGNUM + 23, { "v23" } },
- { RISCV_V0_REGNUM + 24, { "v24" } },
- { RISCV_V0_REGNUM + 25, { "v25" } },
- { RISCV_V0_REGNUM + 26, { "v26" } },
- { RISCV_V0_REGNUM + 27, { "v27" } },
- { RISCV_V0_REGNUM + 28, { "v28" } },
- { RISCV_V0_REGNUM + 29, { "v29" } },
- { RISCV_V0_REGNUM + 30, { "v30" } },
- { RISCV_V0_REGNUM + 31, { "v31" } },
+ m_registers = {
+ { RISCV_V0_REGNUM + 0, { "v0" } }, { RISCV_V0_REGNUM + 1, { "v1" } },
+ { RISCV_V0_REGNUM + 2, { "v2" } }, { RISCV_V0_REGNUM + 3, { "v3" } },
+ { RISCV_V0_REGNUM + 4, { "v4" } }, { RISCV_V0_REGNUM + 5, { "v5" } },
+ { RISCV_V0_REGNUM + 6, { "v6" } }, { RISCV_V0_REGNUM + 7, { "v7" } },
+ { RISCV_V0_REGNUM + 8, { "v8" } }, { RISCV_V0_REGNUM + 9, { "v9" } },
+ { RISCV_V0_REGNUM + 10, { "v10" } }, { RISCV_V0_REGNUM + 11, { "v11" } },
+ { RISCV_V0_REGNUM + 12, { "v12" } }, { RISCV_V0_REGNUM + 13, { "v13" } },
+ { RISCV_V0_REGNUM + 14, { "v14" } }, { RISCV_V0_REGNUM + 15, { "v15" } },
+ { RISCV_V0_REGNUM + 16, { "v16" } }, { RISCV_V0_REGNUM + 17, { "v17" } },
+ { RISCV_V0_REGNUM + 18, { "v18" } }, { RISCV_V0_REGNUM + 19, { "v19" } },
+ { RISCV_V0_REGNUM + 20, { "v20" } }, { RISCV_V0_REGNUM + 21, { "v21" } },
+ { RISCV_V0_REGNUM + 22, { "v22" } }, { RISCV_V0_REGNUM + 23, { "v23" } },
+ { RISCV_V0_REGNUM + 24, { "v24" } }, { RISCV_V0_REGNUM + 25, { "v25" } },
+ { RISCV_V0_REGNUM + 26, { "v26" } }, { RISCV_V0_REGNUM + 27, { "v27" } },
+ { RISCV_V0_REGNUM + 28, { "v28" } }, { RISCV_V0_REGNUM + 29, { "v29" } },
+ { RISCV_V0_REGNUM + 30, { "v30" } }, { RISCV_V0_REGNUM + 31, { "v31" } },
};
}
@@ -626,8 +607,7 @@ struct riscv_vector_feature : public riscv_register_feature
RISCV_V0_REGNUM + 31. */
const char *register_name (int regnum) const
{
- gdb_assert (regnum >= RISCV_V0_REGNUM
- && regnum <= RISCV_V0_REGNUM + 31);
+ gdb_assert (regnum >= RISCV_V0_REGNUM && regnum <= RISCV_V0_REGNUM + 31);
regnum -= RISCV_V0_REGNUM;
return m_registers[regnum].names[0];
}
@@ -697,12 +677,12 @@ static enum auto_boolean use_compressed_breakpoints;
static void
show_use_compressed_breakpoints (struct ui_file *file, int from_tty,
- struct cmd_list_element *c,
- const char *value)
+ struct cmd_list_element *c, const char *value)
{
gdb_printf (file,
- _("Debugger's use of compressed breakpoints is set "
- "to %s.\n"), value);
+ _ ("Debugger's use of compressed breakpoints is set "
+ "to %s.\n"),
+ value);
}
/* The set and show lists for 'set riscv' and 'show riscv' prefixes. */
@@ -719,12 +699,10 @@ static struct cmd_list_element *showdebugriscvcmdlist = NULL;
static void
show_riscv_debug_variable (struct ui_file *file, int from_tty,
- struct cmd_list_element *c,
- const char *value)
+ struct cmd_list_element *c, const char *value)
{
- gdb_printf (file,
- _("RiscV debug variable `%s' is set to: %s\n"),
- c->name, value);
+ gdb_printf (file, _ ("RiscV debug variable `%s' is set to: %s\n"), c->name,
+ value);
}
/* See riscv-tdep.h. */
@@ -794,8 +772,7 @@ riscv_has_fp_abi (struct gdbarch *gdbarch)
static bool
riscv_is_fp_regno_p (int regno)
{
- return (regno >= RISCV_FIRST_FP_REGNUM
- && regno <= RISCV_LAST_FP_REGNUM);
+ return (regno >= RISCV_FIRST_FP_REGNUM && regno <= RISCV_LAST_FP_REGNUM);
}
/* Implement the breakpoint_kind_from_pc gdbarch method. */
@@ -828,11 +805,12 @@ riscv_breakpoint_kind_from_pc (struct gdbarch *gdbarch, CORE_ADDR *pcptr)
if (riscv_debug_breakpoints)
{
- const char *bp = (unaligned_p || riscv_insn_length (buf[0]) == 2
- ? "C.EBREAK" : "EBREAK");
+ const char *bp
+ = (unaligned_p || riscv_insn_length (buf[0]) == 2 ? "C.EBREAK"
+ : "EBREAK");
- gdb_printf (gdb_stdlog, "Using %s for breakpoint at %s ",
- bp, paddress (gdbarch, *pcptr));
+ gdb_printf (gdb_stdlog, "Using %s for breakpoint at %s ", bp,
+ paddress (gdbarch, *pcptr));
if (unaligned_p)
gdb_printf (gdb_stdlog, "(unaligned address)\n");
else
@@ -855,7 +833,12 @@ riscv_breakpoint_kind_from_pc (struct gdbarch *gdbarch, CORE_ADDR *pcptr)
static const gdb_byte *
riscv_sw_breakpoint_from_kind (struct gdbarch *gdbarch, int kind, int *size)
{
- static const gdb_byte ebreak[] = { 0x73, 0x00, 0x10, 0x00, };
+ static const gdb_byte ebreak[] = {
+ 0x73,
+ 0x00,
+ 0x10,
+ 0x00,
+ };
static const gdb_byte c_ebreak[] = { 0x02, 0x90 };
*size = kind;
@@ -938,8 +921,8 @@ riscv_register_name (struct gdbarch *gdbarch, int regnum)
static enum register_status
riscv_pseudo_register_read (struct gdbarch *gdbarch,
- readable_regcache *regcache,
- int regnum, gdb_byte *buf)
+ readable_regcache *regcache, int regnum,
+ gdb_byte *buf)
{
riscv_gdbarch_tdep *tdep = gdbarch_tdep<riscv_gdbarch_tdep> (gdbarch);
@@ -1028,8 +1011,8 @@ riscv_fpreg_d_type (struct gdbarch *gdbarch)
struct type *t;
- t = arch_composite_type (gdbarch,
- "__gdb_builtin_type_fpreg_d", TYPE_CODE_UNION);
+ t = arch_composite_type (gdbarch, "__gdb_builtin_type_fpreg_d",
+ TYPE_CODE_UNION);
append_composite_type_field (t, "float", bt->builtin_float);
append_composite_type_field (t, "double", bt->builtin_double);
t->set_is_vector (true);
@@ -1062,33 +1045,25 @@ riscv_register_type (struct gdbarch *gdbarch, int regnum)
converts to 'double' on 64-bit). In these cases its better to
present the registers using a union type. */
int flen = riscv_isa_flen (gdbarch);
- if (flen == 8
- && type->code () == TYPE_CODE_FLT
+ if (flen == 8 && type->code () == TYPE_CODE_FLT
&& type->length () == flen
&& (strcmp (type->name (), "builtin_type_ieee_double") == 0
|| strcmp (type->name (), "double") == 0))
type = riscv_fpreg_d_type (gdbarch);
}
- if ((regnum == gdbarch_pc_regnum (gdbarch)
- || regnum == RISCV_RA_REGNUM
- || regnum == RISCV_FP_REGNUM
- || regnum == RISCV_SP_REGNUM
- || regnum == RISCV_GP_REGNUM
- || regnum == RISCV_TP_REGNUM)
- && type->code () == TYPE_CODE_INT
- && type->length () == xlen)
+ if ((regnum == gdbarch_pc_regnum (gdbarch) || regnum == RISCV_RA_REGNUM
+ || regnum == RISCV_FP_REGNUM || regnum == RISCV_SP_REGNUM
+ || regnum == RISCV_GP_REGNUM || regnum == RISCV_TP_REGNUM)
+ && type->code () == TYPE_CODE_INT && type->length () == xlen)
{
/* This spots the case where some interesting registers are defined
as simple integers of the expected size, we force these registers
to be pointers as we believe that is more useful. */
- if (regnum == gdbarch_pc_regnum (gdbarch)
- || regnum == RISCV_RA_REGNUM)
+ if (regnum == gdbarch_pc_regnum (gdbarch) || regnum == RISCV_RA_REGNUM)
type = builtin_type (gdbarch)->builtin_func_ptr;
- else if (regnum == RISCV_FP_REGNUM
- || regnum == RISCV_SP_REGNUM
- || regnum == RISCV_GP_REGNUM
- || regnum == RISCV_TP_REGNUM)
+ else if (regnum == RISCV_FP_REGNUM || regnum == RISCV_SP_REGNUM
+ || regnum == RISCV_GP_REGNUM || regnum == RISCV_TP_REGNUM)
type = builtin_type (gdbarch)->builtin_data_ptr;
}
@@ -1099,16 +1074,18 @@ riscv_register_type (struct gdbarch *gdbarch, int regnum)
REGNUM. */
static void
-riscv_print_one_register_info (struct gdbarch *gdbarch,
- struct ui_file *file,
- frame_info_ptr frame,
- int regnum)
+riscv_print_one_register_info (struct gdbarch *gdbarch, struct ui_file *file,
+ frame_info_ptr frame, int regnum)
{
const char *name = gdbarch_register_name (gdbarch, regnum);
struct value *val;
struct type *regtype;
int print_raw_format;
- enum tab_stops { value_column_1 = 15 };
+
+ enum tab_stops
+ {
+ value_column_1 = 15
+ };
gdb_puts (name, file);
print_spaces (value_column_1 - strlen (name), file);
@@ -1126,16 +1103,14 @@ riscv_print_one_register_info (struct gdbarch *gdbarch,
return;
}
- print_raw_format = (value_entirely_available (val)
- && !value_optimized_out (val));
+ print_raw_format
+ = (value_entirely_available (val) && !value_optimized_out (val));
if (regtype->code () == TYPE_CODE_FLT
- || (regtype->code () == TYPE_CODE_UNION
- && regtype->num_fields () == 2
+ || (regtype->code () == TYPE_CODE_UNION && regtype->num_fields () == 2
&& regtype->field (0).type ()->code () == TYPE_CODE_FLT
&& regtype->field (1).type ()->code () == TYPE_CODE_FLT)
- || (regtype->code () == TYPE_CODE_UNION
- && regtype->num_fields () == 3
+ || (regtype->code () == TYPE_CODE_UNION && regtype->num_fields () == 3
&& regtype->field (0).type ()->code () == TYPE_CODE_FLT
&& regtype->field (1).type ()->code () == TYPE_CODE_FLT
&& regtype->field (2).type ()->code () == TYPE_CODE_FLT))
@@ -1184,22 +1159,14 @@ riscv_print_one_register_info (struct gdbarch *gdbarch,
"FS:%X MPP:%x HPP:%X SPP:%X MPIE:%X HPIE:%X "
"SPIE:%X UPIE:%X MIE:%X HIE:%X SIE:%X UIE:%X",
(int) ((d >> (xlen - 1)) & 0x1),
- (int) ((d >> 24) & 0x1f),
- (int) ((d >> 19) & 0x1),
- (int) ((d >> 18) & 0x1),
- (int) ((d >> 17) & 0x1),
- (int) ((d >> 15) & 0x3),
- (int) ((d >> 13) & 0x3),
- (int) ((d >> 11) & 0x3),
- (int) ((d >> 9) & 0x3),
- (int) ((d >> 8) & 0x1),
- (int) ((d >> 7) & 0x1),
- (int) ((d >> 6) & 0x1),
- (int) ((d >> 5) & 0x1),
- (int) ((d >> 4) & 0x1),
- (int) ((d >> 3) & 0x1),
- (int) ((d >> 2) & 0x1),
- (int) ((d >> 1) & 0x1),
+ (int) ((d >> 24) & 0x1f), (int) ((d >> 19) & 0x1),
+ (int) ((d >> 18) & 0x1), (int) ((d >> 17) & 0x1),
+ (int) ((d >> 15) & 0x3), (int) ((d >> 13) & 0x3),
+ (int) ((d >> 11) & 0x3), (int) ((d >> 9) & 0x3),
+ (int) ((d >> 8) & 0x1), (int) ((d >> 7) & 0x1),
+ (int) ((d >> 6) & 0x1), (int) ((d >> 5) & 0x1),
+ (int) ((d >> 4) & 0x1), (int) ((d >> 3) & 0x1),
+ (int) ((d >> 2) & 0x1), (int) ((d >> 1) & 0x1),
(int) ((d >> 0) & 0x1));
}
else if (regnum == RISCV_CSR_MISA_REGNUM)
@@ -1234,36 +1201,31 @@ riscv_print_one_register_info (struct gdbarch *gdbarch,
gdb_printf (file, "\t");
if (regnum != tdep->frm_regnum)
- gdb_printf (file,
- "NV:%d DZ:%d OF:%d UF:%d NX:%d",
- (int) ((d >> 4) & 0x1),
- (int) ((d >> 3) & 0x1),
- (int) ((d >> 2) & 0x1),
- (int) ((d >> 1) & 0x1),
+ gdb_printf (file, "NV:%d DZ:%d OF:%d UF:%d NX:%d",
+ (int) ((d >> 4) & 0x1), (int) ((d >> 3) & 0x1),
+ (int) ((d >> 2) & 0x1), (int) ((d >> 1) & 0x1),
(int) ((d >> 0) & 0x1));
if (regnum != tdep->fflags_regnum)
{
- static const char * const sfrm[] =
- {
- _("RNE (round to nearest; ties to even)"),
- _("RTZ (Round towards zero)"),
- _("RDN (Round down towards -INF)"),
- _("RUP (Round up towards +INF)"),
- _("RMM (Round to nearest; ties to max magnitude)"),
- _("INVALID[5]"),
- _("INVALID[6]"),
- /* A value of 0x7 indicates dynamic rounding mode when
+ static const char *const sfrm[] = {
+ _ ("RNE (round to nearest; ties to even)"),
+ _ ("RTZ (Round towards zero)"),
+ _ ("RDN (Round down towards -INF)"),
+ _ ("RUP (Round up towards +INF)"),
+ _ ("RMM (Round to nearest; ties to max magnitude)"),
+ _ ("INVALID[5]"),
+ _ ("INVALID[6]"),
+ /* A value of 0x7 indicates dynamic rounding mode when
used within an instructions rounding-mode field, but
is invalid within the FRM register. */
- _("INVALID[7] (Dynamic rounding mode)"),
- };
- int frm = ((regnum == RISCV_CSR_FCSR_REGNUM)
- ? (d >> 5) : d) & 0x7;
+ _ ("INVALID[7] (Dynamic rounding mode)"),
+ };
+ int frm
+ = ((regnum == RISCV_CSR_FCSR_REGNUM) ? (d >> 5) : d) & 0x7;
gdb_printf (file, "%sFRM:%i [%s]",
- (regnum == RISCV_CSR_FCSR_REGNUM
- ? " " : ""),
+ (regnum == RISCV_CSR_FCSR_REGNUM ? " " : ""),
frm, sfrm[frm]);
}
}
@@ -1277,15 +1239,10 @@ riscv_print_one_register_info (struct gdbarch *gdbarch,
if (priv < 4)
{
- static const char * const sprv[] =
- {
- "User/Application",
- "Supervisor",
- "Hypervisor",
- "Machine"
- };
- gdb_printf (file, "\tprv:%d [%s]",
- priv, sprv[priv]);
+ static const char *const sprv[]
+ = { "User/Application", "Supervisor", "Hypervisor",
+ "Machine" };
+ gdb_printf (file, "\tprv:%d [%s]", priv, sprv[priv]);
}
else
gdb_printf (file, "\tprv:%d [INVALID]", priv);
@@ -1318,7 +1275,8 @@ riscv_is_regnum_a_named_csr (int regnum)
switch (regnum)
{
-#define DECLARE_CSR(name, num, class, define_ver, abort_ver) case RISCV_ ## num ## _REGNUM:
+#define DECLARE_CSR(name, num, class, define_ver, abort_ver) \
+ case RISCV_##num##_REGNUM:
#include "opcode/riscv-opc.h"
#undef DECLARE_CSR
return true;
@@ -1336,15 +1294,15 @@ riscv_is_unknown_csr (struct gdbarch *gdbarch, int regnum)
{
riscv_gdbarch_tdep *tdep = gdbarch_tdep<riscv_gdbarch_tdep> (gdbarch);
return (regnum >= tdep->unknown_csrs_first_regnum
- && regnum < (tdep->unknown_csrs_first_regnum
- + tdep->unknown_csrs_count));
+ && regnum
+ < (tdep->unknown_csrs_first_regnum + tdep->unknown_csrs_count));
}
/* Implement the register_reggroup_p gdbarch method. Is REGNUM a member
of REGGROUP? */
static int
-riscv_register_reggroup_p (struct gdbarch *gdbarch, int regnum,
+riscv_register_reggroup_p (struct gdbarch *gdbarch, int regnum,
const struct reggroup *reggroup)
{
riscv_gdbarch_tdep *tdep = gdbarch_tdep<riscv_gdbarch_tdep> (gdbarch);
@@ -1368,7 +1326,7 @@ riscv_register_reggroup_p (struct gdbarch *gdbarch, int regnum,
if (riscv_is_unknown_csr (gdbarch, regnum))
{
if (reggroup == restore_reggroup || reggroup == save_reggroup
- || reggroup == general_reggroup)
+ || reggroup == general_reggroup)
return 0;
else if (reggroup == system_reggroup || reggroup == csr_reggroup)
return 1;
@@ -1393,10 +1351,8 @@ riscv_register_reggroup_p (struct gdbarch *gdbarch, int regnum,
return 0;
}
else if (reggroup == float_reggroup)
- return (riscv_is_fp_regno_p (regnum)
- || regnum == RISCV_CSR_FCSR_REGNUM
- || regnum == tdep->fflags_regnum
- || regnum == tdep->frm_regnum);
+ return (riscv_is_fp_regno_p (regnum) || regnum == RISCV_CSR_FCSR_REGNUM
+ || regnum == tdep->fflags_regnum || regnum == tdep->frm_regnum);
else if (reggroup == general_reggroup)
return regnum < RISCV_FIRST_FP_REGNUM;
else if (reggroup == restore_reggroup || reggroup == save_reggroup)
@@ -1448,7 +1404,7 @@ riscv_pseudo_register_type (struct gdbarch *gdbarch, int regnum)
riscv_gdbarch_tdep *tdep = gdbarch_tdep<riscv_gdbarch_tdep> (gdbarch);
if (regnum == tdep->fflags_regnum || regnum == tdep->frm_regnum)
- return builtin_type (gdbarch)->builtin_int32;
+ return builtin_type (gdbarch)->builtin_int32;
else
gdb_assert_not_reached ("unknown pseudo register number %d", regnum);
}
@@ -1468,16 +1424,14 @@ riscv_pseudo_register_reggroup_p (struct gdbarch *gdbarch, int regnum,
'info registers' and 'info all-registers'. */
static void
-riscv_print_registers_info (struct gdbarch *gdbarch,
- struct ui_file *file,
- frame_info_ptr frame,
- int regnum, int print_all)
+riscv_print_registers_info (struct gdbarch *gdbarch, struct ui_file *file,
+ frame_info_ptr frame, int regnum, int print_all)
{
if (regnum != -1)
{
/* Print one specified register. */
if (*(gdbarch_register_name (gdbarch, regnum)) == '\0')
- error (_("Not a valid register for the current processor type"));
+ error (_ ("Not a valid register for the current processor type"));
riscv_print_one_register_info (gdbarch, file, frame, regnum);
}
else
@@ -1516,42 +1470,42 @@ public:
/* Enum of all the opcodes that GDB cares about during the prologue scan. */
enum opcode
- {
- /* Unknown value is used at initialisation time. */
- UNKNOWN = 0,
+ {
+ /* Unknown value is used at initialisation time. */
+ UNKNOWN = 0,
- /* These instructions are all the ones we are interested in during the
+ /* These instructions are all the ones we are interested in during the
prologue scan. */
- ADD,
- ADDI,
- ADDIW,
- ADDW,
- AUIPC,
- LUI,
- SD,
- SW,
- LD,
- LW,
- MV,
- /* These are needed for software breakpoint support. */
- JAL,
- JALR,
- BEQ,
- BNE,
- BLT,
- BGE,
- BLTU,
- BGEU,
- /* These are needed for stepping over atomic sequences. */
- LR,
- SC,
- /* This instruction is used to do a syscall. */
- ECALL,
-
- /* Other instructions are not interesting during the prologue scan, and
+ ADD,
+ ADDI,
+ ADDIW,
+ ADDW,
+ AUIPC,
+ LUI,
+ SD,
+ SW,
+ LD,
+ LW,
+ MV,
+ /* These are needed for software breakpoint support. */
+ JAL,
+ JALR,
+ BEQ,
+ BNE,
+ BLT,
+ BGE,
+ BLTU,
+ BGEU,
+ /* These are needed for stepping over atomic sequences. */
+ LR,
+ SC,
+ /* This instruction is used to do a syscall. */
+ ECALL,
+
+ /* Other instructions are not interesting during the prologue scan, and
are ignored. */
- OTHER
- };
+ OTHER
+ };
riscv_insn ()
: m_length (0),
@@ -1566,34 +1520,28 @@ public:
void decode (struct gdbarch *gdbarch, CORE_ADDR pc);
/* Get the length of the instruction in bytes. */
- int length () const
- { return m_length; }
+ int length () const { return m_length; }
/* Get the opcode for this instruction. */
- enum opcode opcode () const
- { return m_opcode; }
+ enum opcode opcode () const { return m_opcode; }
/* Get destination register field for this instruction. This is only
valid if the OPCODE implies there is such a field for this
instruction. */
- int rd () const
- { return m_rd; }
+ int rd () const { return m_rd; }
/* Get the RS1 register field for this instruction. This is only valid
if the OPCODE implies there is such a field for this instruction. */
- int rs1 () const
- { return m_rs1; }
+ int rs1 () const { return m_rs1; }
/* Get the RS2 register field for this instruction. This is only valid
if the OPCODE implies there is such a field for this instruction. */
- int rs2 () const
- { return m_rs2; }
+ int rs2 () const { return m_rs2; }
/* Get the immediate for this instruction in signed form. This is only
valid if the OPCODE implies there is such a field for this
instruction. */
- int imm_signed () const
- { return m_imm.s; }
+ int imm_signed () const { return m_imm.s; }
private:
@@ -1726,8 +1674,8 @@ private:
/* Fetch instruction from target memory at ADDR, return the content of
the instruction, and update LEN with the instruction length. */
- static ULONGEST fetch_instruction (struct gdbarch *gdbarch,
- CORE_ADDR addr, int *len);
+ static ULONGEST fetch_instruction (struct gdbarch *gdbarch, CORE_ADDR addr,
+ int *len);
/* The length of the instruction in bytes. Should be 2 or 4. */
int m_length;
@@ -1765,8 +1713,8 @@ private:
instruction, and update LEN with the instruction length. */
ULONGEST
-riscv_insn::fetch_instruction (struct gdbarch *gdbarch,
- CORE_ADDR addr, int *len)
+riscv_insn::fetch_instruction (struct gdbarch *gdbarch, CORE_ADDR addr,
+ int *len)
{
enum bfd_endian byte_order = gdbarch_byte_order_for_code (gdbarch);
gdb_byte buf[RISCV_MAX_INSN_LEN];
@@ -1949,9 +1897,8 @@ riscv_insn::decode (struct gdbarch *gdbarch, CORE_ADDR pc)
can unwind register values when there is no DWARF information. */
static CORE_ADDR
-riscv_scan_prologue (struct gdbarch *gdbarch,
- CORE_ADDR start_pc, CORE_ADDR end_pc,
- struct riscv_unwind_cache *cache)
+riscv_scan_prologue (struct gdbarch *gdbarch, CORE_ADDR start_pc,
+ CORE_ADDR end_pc, struct riscv_unwind_cache *cache)
{
CORE_ADDR cur_pc, next_pc, after_prologue_pc;
CORE_ADDR end_prologue_addr = 0;
@@ -1961,7 +1908,7 @@ riscv_scan_prologue (struct gdbarch *gdbarch,
that bound, then use an arbitrary large number as the upper bound. */
after_prologue_pc = skip_prologue_using_sal (gdbarch, start_pc);
if (after_prologue_pc == 0)
- after_prologue_pc = start_pc + 100; /* Arbitrary large number. */
+ after_prologue_pc = start_pc + 100; /* Arbitrary large number. */
if (after_prologue_pc < end_pc)
end_pc = after_prologue_pc;
@@ -1971,11 +1918,9 @@ riscv_scan_prologue (struct gdbarch *gdbarch,
pv_area stack (RISCV_SP_REGNUM, gdbarch_addr_bit (gdbarch));
if (riscv_debug_unwinder)
- gdb_printf
- (gdb_stdlog,
- "Prologue scan for function starting at %s (limit %s)\n",
- core_addr_to_string (start_pc),
- core_addr_to_string (end_pc));
+ gdb_printf (gdb_stdlog,
+ "Prologue scan for function starting at %s (limit %s)\n",
+ core_addr_to_string (start_pc), core_addr_to_string (end_pc));
for (next_pc = cur_pc = start_pc; cur_pc < end_pc; cur_pc = next_pc)
{
@@ -1990,8 +1935,7 @@ riscv_scan_prologue (struct gdbarch *gdbarch,
/* Look for common stack adjustment insns. */
if ((insn.opcode () == riscv_insn::ADDI
|| insn.opcode () == riscv_insn::ADDIW)
- && insn.rd () == RISCV_SP_REGNUM
- && insn.rs1 () == RISCV_SP_REGNUM)
+ && insn.rd () == RISCV_SP_REGNUM && insn.rs1 () == RISCV_SP_REGNUM)
{
/* Handle: addi sp, sp, -i
or: addiw sp, sp, -i */
@@ -2000,10 +1944,9 @@ riscv_scan_prologue (struct gdbarch *gdbarch,
regs[insn.rd ()]
= pv_add_constant (regs[insn.rs1 ()], insn.imm_signed ());
}
- else if ((insn.opcode () == riscv_insn::SW
- || insn.opcode () == riscv_insn::SD)
- && (insn.rs1 () == RISCV_SP_REGNUM
- || insn.rs1 () == RISCV_FP_REGNUM))
+ else if (
+ (insn.opcode () == riscv_insn::SW || insn.opcode () == riscv_insn::SD)
+ && (insn.rs1 () == RISCV_SP_REGNUM || insn.rs1 () == RISCV_FP_REGNUM))
{
/* Handle: sw reg, offset(sp)
or: sd reg, offset(sp)
@@ -2013,8 +1956,8 @@ riscv_scan_prologue (struct gdbarch *gdbarch,
gdb_assert (insn.rs1 () < RISCV_NUM_INTEGER_REGS);
gdb_assert (insn.rs2 () < RISCV_NUM_INTEGER_REGS);
stack.store (pv_add_constant (regs[insn.rs1 ()], insn.imm_signed ()),
- (insn.opcode () == riscv_insn::SW ? 4 : 8),
- regs[insn.rs2 ()]);
+ (insn.opcode () == riscv_insn::SW ? 4 : 8),
+ regs[insn.rs2 ()]);
}
else if (insn.opcode () == riscv_insn::ADDI
&& insn.rd () == RISCV_FP_REGNUM
@@ -2144,8 +2087,7 @@ riscv_scan_prologue (struct gdbarch *gdbarch,
the frame base address to the registers location on
the stack, with a descending stack this means the
offsets are always negative. */
- gdb_printf (gdb_stdlog,
- "Register $%s at stack offset %s\n",
+ gdb_printf (gdb_stdlog, "Register $%s at stack offset %s\n",
gdbarch_register_name (gdbarch, i),
plongest ((LONGEST) offset));
}
@@ -2222,10 +2164,8 @@ riscv_push_dummy_code (struct gdbarch *gdbarch, CORE_ADDR sp,
int status = target_write_memory (*bp_addr, nop_insn, sizeof (nop_insn));
if (riscv_debug_breakpoints || riscv_debug_infcall)
- gdb_printf (gdb_stdlog,
- "Writing %s-byte nop instruction to %s: %s\n",
- plongest (sizeof (nop_insn)),
- paddress (gdbarch, *bp_addr),
+ gdb_printf (gdb_stdlog, "Writing %s-byte nop instruction to %s: %s\n",
+ plongest (sizeof (nop_insn)), paddress (gdbarch, *bp_addr),
(status == 0 ? "success" : "failed"));
return sp;
@@ -2272,18 +2212,18 @@ struct riscv_arg_info
{
/* What type of location this is. */
enum location_type
- {
- /* Argument passed in a register. */
- in_reg,
+ {
+ /* Argument passed in a register. */
+ in_reg,
- /* Argument passed as an on stack argument. */
- on_stack,
+ /* Argument passed as an on stack argument. */
+ on_stack,
- /* Argument passed by reference. The second location is always
+ /* Argument passed by reference. The second location is always
valid for a BY_REF argument, and describes where the address
of the BY_REF argument should be placed. */
- by_ref
- } loc_type;
+ by_ref
+ } loc_type;
/* Information that depends on the location type. */
union
@@ -2432,8 +2372,7 @@ riscv_arg_regs_available (struct riscv_arg_reg *reg)
static bool
riscv_assign_reg_location (struct riscv_arg_info::location *loc,
- struct riscv_arg_reg *reg,
- int length, int offset)
+ struct riscv_arg_reg *reg, int length, int offset)
{
if (reg->next_regnum <= reg->last_regnum)
{
@@ -2458,12 +2397,11 @@ riscv_assign_reg_location (struct riscv_arg_info::location *loc,
static void
riscv_assign_stack_location (struct riscv_arg_info::location *loc,
- struct riscv_memory_offsets *memory,
- int length, int align)
+ struct riscv_memory_offsets *memory, int length,
+ int align)
{
loc->loc_type = riscv_arg_info::location::on_stack;
- memory->arg_offset
- = align_up (memory->arg_offset, align);
+ memory->arg_offset = align_up (memory->arg_offset, align);
loc->loc_data.offset = memory->arg_offset;
memory->arg_offset += length;
loc->c_length = length;
@@ -2495,8 +2433,7 @@ riscv_call_arg_scalar_int (struct riscv_arg_info *ainfo,
|| ainfo->length > (2 * cinfo->xlen))
{
/* Argument is going to be passed by reference. */
- ainfo->argloc[0].loc_type
- = riscv_arg_info::location::by_ref;
+ ainfo->argloc[0].loc_type = riscv_arg_info::location::by_ref;
cinfo->memory.ref_offset
= align_up (cinfo->memory.ref_offset, ainfo->align);
ainfo->argloc[0].loc_data.offset = cinfo->memory.ref_offset;
@@ -2506,12 +2443,10 @@ riscv_call_arg_scalar_int (struct riscv_arg_info *ainfo,
/* The second location for this argument is given over to holding the
address of the by-reference data. Pass 0 for the offset as this
is not part of the actual argument value. */
- if (!riscv_assign_reg_location (&ainfo->argloc[1],
- &cinfo->int_regs,
+ if (!riscv_assign_reg_location (&ainfo->argloc[1], &cinfo->int_regs,
cinfo->xlen, 0))
- riscv_assign_stack_location (&ainfo->argloc[1],
- &cinfo->memory, cinfo->xlen,
- cinfo->xlen);
+ riscv_assign_stack_location (&ainfo->argloc[1], &cinfo->memory,
+ cinfo->xlen, cinfo->xlen);
}
else
{
@@ -2524,19 +2459,18 @@ riscv_call_arg_scalar_int (struct riscv_arg_info *ainfo,
&& cinfo->int_regs.next_regnum & 1)
cinfo->int_regs.next_regnum++;
- if (!riscv_assign_reg_location (&ainfo->argloc[0],
- &cinfo->int_regs, len, 0))
- riscv_assign_stack_location (&ainfo->argloc[0],
- &cinfo->memory, len, align);
+ if (!riscv_assign_reg_location (&ainfo->argloc[0], &cinfo->int_regs, len,
+ 0))
+ riscv_assign_stack_location (&ainfo->argloc[0], &cinfo->memory, len,
+ align);
if (len < ainfo->length)
{
len = ainfo->length - len;
- if (!riscv_assign_reg_location (&ainfo->argloc[1],
- &cinfo->int_regs, len,
- cinfo->xlen))
- riscv_assign_stack_location (&ainfo->argloc[1],
- &cinfo->memory, len, cinfo->xlen);
+ if (!riscv_assign_reg_location (&ainfo->argloc[1], &cinfo->int_regs,
+ len, cinfo->xlen))
+ riscv_assign_stack_location (&ainfo->argloc[1], &cinfo->memory,
+ len, cinfo->xlen);
}
}
}
@@ -2552,8 +2486,7 @@ riscv_call_arg_scalar_float (struct riscv_arg_info *ainfo,
return riscv_call_arg_scalar_int (ainfo, cinfo);
else
{
- if (!riscv_assign_reg_location (&ainfo->argloc[0],
- &cinfo->float_regs,
+ if (!riscv_assign_reg_location (&ainfo->argloc[0], &cinfo->float_regs,
ainfo->length, 0))
return riscv_call_arg_scalar_int (ainfo, cinfo);
}
@@ -2594,6 +2527,7 @@ riscv_call_arg_complex_float (struct riscv_arg_info *ainfo,
class riscv_struct_info
{
public:
+
riscv_struct_info ()
: m_number_of_fields (0),
m_types { nullptr, nullptr },
@@ -2604,18 +2538,14 @@ public:
/* Analyse TYPE descending into nested structures, count the number of
scalar fields and record the types of the first two fields found. */
- void analyse (struct type *type)
- {
- analyse_inner (type, 0);
- }
+ void analyse (struct type *type) { analyse_inner (type, 0); }
/* The number of scalar fields found in the analysed type. This is
currently only accurate if the value returned is 0, 1, or 2 as the
analysis stops counting when the number of fields is 3. This is
because the RiscV ABI only has special cases for 1 or 2 fields,
anything else we just don't care about. */
- int number_of_fields () const
- { return m_number_of_fields; }
+ int number_of_fields () const { return m_number_of_fields; }
/* Return the type for scalar field INDEX within the analysed type. Will
return nullptr if there is no field at that index. Only INDEX values
@@ -2638,6 +2568,7 @@ public:
}
private:
+
/* The number of scalar fields found within the structure after recursing
into nested structures. */
int m_number_of_fields;
@@ -2720,7 +2651,7 @@ riscv_call_arg_struct (struct riscv_arg_info *ainfo,
sinfo.analyse (ainfo->type);
if (sinfo.number_of_fields () == 1
- && sinfo.field_type(0)->code () == TYPE_CODE_COMPLEX)
+ && sinfo.field_type (0)->code () == TYPE_CODE_COMPLEX)
{
/* The following is similar to RISCV_CALL_ARG_COMPLEX_FLOAT,
except we use the type of the complex field instead of the
@@ -2734,9 +2665,9 @@ riscv_call_arg_struct (struct riscv_arg_info *ainfo,
int len = sinfo.field_type (0)->length () / 2;
int offset = sinfo.field_offset (0);
- result = riscv_assign_reg_location (&ainfo->argloc[0],
- &cinfo->float_regs, len,
- offset);
+ result
+ = riscv_assign_reg_location (&ainfo->argloc[0],
+ &cinfo->float_regs, len, offset);
gdb_assert (result);
result = riscv_assign_reg_location (&ainfo->argloc[1],
@@ -2750,7 +2681,7 @@ riscv_call_arg_struct (struct riscv_arg_info *ainfo,
}
if (sinfo.number_of_fields () == 1
- && sinfo.field_type(0)->code () == TYPE_CODE_FLT)
+ && sinfo.field_type (0)->code () == TYPE_CODE_FLT)
{
/* The following is similar to RISCV_CALL_ARG_SCALAR_FLOAT,
except we use the type of the first scalar field instead of
@@ -2765,17 +2696,16 @@ riscv_call_arg_struct (struct riscv_arg_info *ainfo,
int len = sinfo.field_type (0)->length ();
if (!riscv_assign_reg_location (&ainfo->argloc[0],
- &cinfo->float_regs,
- len, offset))
+ &cinfo->float_regs, len, offset))
riscv_call_arg_scalar_int (ainfo, cinfo);
}
return;
}
if (sinfo.number_of_fields () == 2
- && sinfo.field_type(0)->code () == TYPE_CODE_FLT
+ && sinfo.field_type (0)->code () == TYPE_CODE_FLT
&& sinfo.field_type (0)->length () <= cinfo->flen
- && sinfo.field_type(1)->code () == TYPE_CODE_FLT
+ && sinfo.field_type (1)->code () == TYPE_CODE_FLT
&& sinfo.field_type (1)->length () <= cinfo->flen
&& riscv_arg_regs_available (&cinfo->float_regs) >= 2)
{
@@ -2783,7 +2713,7 @@ riscv_call_arg_struct (struct riscv_arg_info *ainfo,
int offset = sinfo.field_offset (0);
if (!riscv_assign_reg_location (&ainfo->argloc[0],
&cinfo->float_regs, len0, offset))
- error (_("failed during argument setup"));
+ error (_ ("failed during argument setup"));
int len1 = sinfo.field_type (1)->length ();
offset = sinfo.field_offset (1);
@@ -2791,31 +2721,30 @@ riscv_call_arg_struct (struct riscv_arg_info *ainfo,
- sinfo.field_type (0)->length ()));
if (!riscv_assign_reg_location (&ainfo->argloc[1],
- &cinfo->float_regs,
- len1, offset))
- error (_("failed during argument setup"));
+ &cinfo->float_regs, len1, offset))
+ error (_ ("failed during argument setup"));
return;
}
if (sinfo.number_of_fields () == 2
&& riscv_arg_regs_available (&cinfo->int_regs) >= 1
- && (sinfo.field_type(0)->code () == TYPE_CODE_FLT
+ && (sinfo.field_type (0)->code () == TYPE_CODE_FLT
&& sinfo.field_type (0)->length () <= cinfo->flen
&& is_integral_type (sinfo.field_type (1))
&& sinfo.field_type (1)->length () <= cinfo->xlen))
{
- int len0 = sinfo.field_type (0)->length ();
+ int len0 = sinfo.field_type (0)->length ();
int offset = sinfo.field_offset (0);
if (!riscv_assign_reg_location (&ainfo->argloc[0],
&cinfo->float_regs, len0, offset))
- error (_("failed during argument setup"));
+ error (_ ("failed during argument setup"));
int len1 = sinfo.field_type (1)->length ();
offset = sinfo.field_offset (1);
gdb_assert (len1 <= cinfo->xlen);
- if (!riscv_assign_reg_location (&ainfo->argloc[1],
- &cinfo->int_regs, len1, offset))
- error (_("failed during argument setup"));
+ if (!riscv_assign_reg_location (&ainfo->argloc[1], &cinfo->int_regs,
+ len1, offset))
+ error (_ ("failed during argument setup"));
return;
}
@@ -2823,7 +2752,7 @@ riscv_call_arg_struct (struct riscv_arg_info *ainfo,
&& riscv_arg_regs_available (&cinfo->int_regs) >= 1
&& (is_integral_type (sinfo.field_type (0))
&& sinfo.field_type (0)->length () <= cinfo->xlen
- && sinfo.field_type(1)->code () == TYPE_CODE_FLT
+ && sinfo.field_type (1)->code () == TYPE_CODE_FLT
&& sinfo.field_type (1)->length () <= cinfo->flen))
{
int len0 = sinfo.field_type (0)->length ();
@@ -2833,15 +2762,14 @@ riscv_call_arg_struct (struct riscv_arg_info *ainfo,
gdb_assert (len1 <= cinfo->flen);
int offset = sinfo.field_offset (0);
- if (!riscv_assign_reg_location (&ainfo->argloc[0],
- &cinfo->int_regs, len0, offset))
- error (_("failed during argument setup"));
+ if (!riscv_assign_reg_location (&ainfo->argloc[0], &cinfo->int_regs,
+ len0, offset))
+ error (_ ("failed during argument setup"));
offset = sinfo.field_offset (1);
if (!riscv_assign_reg_location (&ainfo->argloc[1],
- &cinfo->float_regs,
- len1, offset))
- error (_("failed during argument setup"));
+ &cinfo->float_regs, len1, offset))
+ error (_ ("failed during argument setup"));
return;
}
@@ -2863,10 +2791,9 @@ riscv_call_arg_struct (struct riscv_arg_info *ainfo,
After assigning a location to AINFO, CINFO will have been updated. */
static void
-riscv_arg_location (struct gdbarch *gdbarch,
- struct riscv_arg_info *ainfo,
- struct riscv_call_info *cinfo,
- struct type *type, bool is_unnamed)
+riscv_arg_location (struct gdbarch *gdbarch, struct riscv_arg_info *ainfo,
+ struct riscv_call_info *cinfo, struct type *type,
+ bool is_unnamed)
{
ainfo->type = type;
ainfo->length = ainfo->type->length ();
@@ -2930,26 +2857,25 @@ riscv_arg_location (struct gdbarch *gdbarch,
static void
riscv_print_arg_location (ui_file *stream, struct gdbarch *gdbarch,
- struct riscv_arg_info *info,
- CORE_ADDR sp_refs, CORE_ADDR sp_args)
+ struct riscv_arg_info *info, CORE_ADDR sp_refs,
+ CORE_ADDR sp_args)
{
gdb_printf (stream, "type: '%s', length: 0x%x, alignment: 0x%x",
TYPE_SAFE_NAME (info->type), info->length, info->align);
switch (info->argloc[0].loc_type)
{
case riscv_arg_info::location::in_reg:
- gdb_printf
- (stream, ", register %s",
- gdbarch_register_name (gdbarch, info->argloc[0].loc_data.regno));
+ gdb_printf (stream, ", register %s",
+ gdbarch_register_name (gdbarch,
+ info->argloc[0].loc_data.regno));
if (info->argloc[0].c_length < info->length)
{
switch (info->argloc[1].loc_type)
{
case riscv_arg_info::location::in_reg:
- gdb_printf
- (stream, ", register %s",
- gdbarch_register_name (gdbarch,
- info->argloc[1].loc_data.regno));
+ gdb_printf (stream, ", register %s",
+ gdbarch_register_name (
+ gdbarch, info->argloc[1].loc_data.regno));
break;
case riscv_arg_info::location::on_stack:
@@ -2962,13 +2888,12 @@ riscv_print_arg_location (ui_file *stream, struct gdbarch *gdbarch,
/* The second location should never be a reference, any
argument being passed by reference just places its address
in the first location and is done. */
- error (_("invalid argument location"));
+ error (_ ("invalid argument location"));
break;
}
if (info->argloc[1].c_offset > info->argloc[0].c_length)
- gdb_printf (stream, " (offset 0x%x)",
- info->argloc[1].c_offset);
+ gdb_printf (stream, " (offset 0x%x)", info->argloc[1].c_offset);
}
break;
@@ -2978,23 +2903,22 @@ riscv_print_arg_location (ui_file *stream, struct gdbarch *gdbarch,
break;
case riscv_arg_info::location::by_ref:
- gdb_printf
- (stream, ", by reference, data at offset 0x%x (%s)",
- info->argloc[0].loc_data.offset,
- core_addr_to_string (sp_refs + info->argloc[0].loc_data.offset));
- if (info->argloc[1].loc_type
- == riscv_arg_info::location::in_reg)
- gdb_printf
- (stream, ", address in register %s",
- gdbarch_register_name (gdbarch, info->argloc[1].loc_data.regno));
+ gdb_printf (stream, ", by reference, data at offset 0x%x (%s)",
+ info->argloc[0].loc_data.offset,
+ core_addr_to_string (sp_refs
+ + info->argloc[0].loc_data.offset));
+ if (info->argloc[1].loc_type == riscv_arg_info::location::in_reg)
+ gdb_printf (stream, ", address in register %s",
+ gdbarch_register_name (gdbarch,
+ info->argloc[1].loc_data.regno));
else
{
gdb_assert (info->argloc[1].loc_type
== riscv_arg_info::location::on_stack);
- gdb_printf
- (stream, ", address on stack at offset 0x%x (%s)",
- info->argloc[1].loc_data.offset,
- core_addr_to_string (sp_args + info->argloc[1].loc_data.offset));
+ gdb_printf (stream, ", address on stack at offset 0x%x (%s)",
+ info->argloc[1].loc_data.offset,
+ core_addr_to_string (sp_args
+ + info->argloc[1].loc_data.offset));
}
break;
@@ -3012,7 +2936,7 @@ static void
riscv_regcache_cooked_write (int regnum, const gdb_byte *data, int len,
struct regcache *regcache, int flen)
{
- gdb_byte tmp [sizeof (ULONGEST)];
+ gdb_byte tmp[sizeof (ULONGEST)];
/* FP values in FP registers must be NaN-boxed. */
if (riscv_is_fp_regno_p (regnum) && len < flen)
@@ -3026,13 +2950,9 @@ riscv_regcache_cooked_write (int regnum, const gdb_byte *data, int len,
/* Implement the push dummy call gdbarch callback. */
static CORE_ADDR
-riscv_push_dummy_call (struct gdbarch *gdbarch,
- struct value *function,
- struct regcache *regcache,
- CORE_ADDR bp_addr,
- int nargs,
- struct value **args,
- CORE_ADDR sp,
+riscv_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
+ struct regcache *regcache, CORE_ADDR bp_addr, int nargs,
+ struct value **args, CORE_ADDR sp,
function_call_return_method return_method,
CORE_ADDR struct_addr)
{
@@ -3040,8 +2960,9 @@ riscv_push_dummy_call (struct gdbarch *gdbarch,
CORE_ADDR sp_args, sp_refs;
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
- struct riscv_arg_info *arg_info =
- (struct riscv_arg_info *) alloca (nargs * sizeof (struct riscv_arg_info));
+ struct riscv_arg_info *arg_info
+ = (struct riscv_arg_info *) alloca (nargs
+ * sizeof (struct riscv_arg_info));
struct riscv_call_info call_info (gdbarch);
@@ -3082,21 +3003,20 @@ riscv_push_dummy_call (struct gdbarch *gdbarch,
gdb_printf (gdb_stdlog, "dummy call args:\n");
gdb_printf (gdb_stdlog, ": floating point ABI %s in use\n",
(riscv_has_fp_abi (gdbarch) ? "is" : "is not"));
- gdb_printf (gdb_stdlog, ": xlen: %d\n: flen: %d\n",
- call_info.xlen, call_info.flen);
+ gdb_printf (gdb_stdlog, ": xlen: %d\n: flen: %d\n", call_info.xlen,
+ call_info.flen);
if (return_method == return_method_struct)
- gdb_printf (gdb_stdlog,
- "[*] struct return pointer in register $A0\n");
+ gdb_printf (gdb_stdlog, "[*] struct return pointer in register $A0\n");
for (i = 0; i < nargs; ++i)
{
- struct riscv_arg_info *info = &arg_info [i];
+ struct riscv_arg_info *info = &arg_info[i];
gdb_printf (gdb_stdlog, "[%2d] ", i);
- riscv_print_arg_location (gdb_stdlog, gdbarch, info, sp_refs, sp_args);
+ riscv_print_arg_location (gdb_stdlog, gdbarch, info, sp_refs,
+ sp_args);
gdb_printf (gdb_stdlog, "\n");
}
- if (call_info.memory.arg_offset > 0
- || call_info.memory.ref_offset > 0)
+ if (call_info.memory.arg_offset > 0 || call_info.memory.ref_offset > 0)
{
gdb_printf (gdb_stdlog, " Original sp: %s\n",
core_addr_to_string (osp));
@@ -3124,7 +3044,7 @@ riscv_push_dummy_call (struct gdbarch *gdbarch,
CORE_ADDR dst;
int second_arg_length = 0;
const gdb_byte *second_arg_data;
- struct riscv_arg_info *info = &arg_info [i];
+ struct riscv_arg_info *info = &arg_info[i];
gdb_assert (info->length > 0);
@@ -3137,11 +3057,13 @@ riscv_push_dummy_call (struct gdbarch *gdbarch,
riscv_regcache_cooked_write (info->argloc[0].loc_data.regno,
(info->contents
+ info->argloc[0].c_offset),
- info->argloc[0].c_length,
- regcache, call_info.flen);
- second_arg_length =
- (((info->argloc[0].c_length + info->argloc[0].c_offset) < info->length)
- ? info->argloc[1].c_length : 0);
+ info->argloc[0].c_length, regcache,
+ call_info.flen);
+ second_arg_length
+ = (((info->argloc[0].c_length + info->argloc[0].c_offset)
+ < info->length)
+ ? info->argloc[1].c_length
+ : 0);
second_arg_data = info->contents + info->argloc[1].c_offset;
}
break;
@@ -3170,13 +3092,14 @@ riscv_push_dummy_call (struct gdbarch *gdbarch,
{
case riscv_arg_info::location::in_reg:
{
- gdb_assert ((riscv_is_fp_regno_p (info->argloc[1].loc_data.regno)
- && second_arg_length <= call_info.flen)
- || second_arg_length <= call_info.xlen);
+ gdb_assert (
+ (riscv_is_fp_regno_p (info->argloc[1].loc_data.regno)
+ && second_arg_length <= call_info.flen)
+ || second_arg_length <= call_info.xlen);
riscv_regcache_cooked_write (info->argloc[1].loc_data.regno,
second_arg_data,
- second_arg_length,
- regcache, call_info.flen);
+ second_arg_length, regcache,
+ call_info.flen);
}
break;
@@ -3194,7 +3117,7 @@ riscv_push_dummy_call (struct gdbarch *gdbarch,
/* The second location should never be a reference, any
argument being passed by reference just places its address
in the first location and is done. */
- error (_("invalid argument location"));
+ error (_ ("invalid argument location"));
break;
}
}
@@ -3211,8 +3134,7 @@ riscv_push_dummy_call (struct gdbarch *gdbarch,
/* Finally, update the stack pointer. */
if (riscv_debug_infcall > 0)
- gdb_printf (gdb_stdlog, ": writing $sp = %s\n",
- core_addr_to_string (sp));
+ gdb_printf (gdb_stdlog, ": writing $sp = %s\n", core_addr_to_string (sp));
regcache_cooked_write_unsigned (regcache, RISCV_SP_REGNUM, sp);
return sp;
@@ -3221,12 +3143,9 @@ riscv_push_dummy_call (struct gdbarch *gdbarch,
/* Implement the return_value gdbarch method. */
static enum return_value_convention
-riscv_return_value (struct gdbarch *gdbarch,
- struct value *function,
- struct type *type,
- struct regcache *regcache,
- struct value **read_value,
- const gdb_byte *writebuf)
+riscv_return_value (struct gdbarch *gdbarch, struct value *function,
+ struct type *type, struct regcache *regcache,
+ struct value **read_value, const gdb_byte *writebuf)
{
struct riscv_call_info call_info (gdbarch);
struct riscv_arg_info info;
@@ -3309,8 +3228,7 @@ riscv_return_value (struct gdbarch *gdbarch,
if (readbuf)
{
gdb_byte *ptr = readbuf + info.argloc[0].c_offset;
- regcache->cooked_read_part (regnum, 0,
- info.argloc[0].c_length,
+ regcache->cooked_read_part (regnum, 0, info.argloc[0].c_length,
ptr);
}
@@ -3318,8 +3236,8 @@ riscv_return_value (struct gdbarch *gdbarch,
{
const gdb_byte *ptr = writebuf + info.argloc[0].c_offset;
riscv_regcache_cooked_write (regnum, ptr,
- info.argloc[0].c_length,
- regcache, call_info.flen);
+ info.argloc[0].c_length, regcache,
+ call_info.flen);
}
/* A return value in register can have a second part in a
@@ -3332,7 +3250,8 @@ riscv_return_value (struct gdbarch *gdbarch,
regnum = info.argloc[1].loc_data.regno;
gdb_assert ((info.argloc[0].c_length
- + info.argloc[1].c_length) <= arg_len);
+ + info.argloc[1].c_length)
+ <= arg_len);
gdb_assert (info.argloc[1].c_length
<= register_size (gdbarch, regnum));
@@ -3348,16 +3267,16 @@ riscv_return_value (struct gdbarch *gdbarch,
{
const gdb_byte *ptr
= writebuf + info.argloc[1].c_offset;
- riscv_regcache_cooked_write
- (regnum, ptr, info.argloc[1].c_length,
- regcache, call_info.flen);
+ riscv_regcache_cooked_write (regnum, ptr,
+ info.argloc[1].c_length,
+ regcache, call_info.flen);
}
break;
case riscv_arg_info::location::by_ref:
case riscv_arg_info::location::on_stack:
default:
- error (_("invalid argument location"));
+ error (_ ("invalid argument location"));
break;
}
}
@@ -3369,8 +3288,7 @@ riscv_return_value (struct gdbarch *gdbarch,
{
ULONGEST addr;
- regcache_cooked_read_unsigned (regcache, RISCV_A0_REGNUM,
- &addr);
+ regcache_cooked_read_unsigned (regcache, RISCV_A0_REGNUM, &addr);
if (read_value != nullptr)
{
abi_val = value_at_non_lval (type, addr);
@@ -3389,7 +3307,7 @@ riscv_return_value (struct gdbarch *gdbarch,
case riscv_arg_info::location::on_stack:
default:
- error (_("invalid argument location"));
+ error (_ ("invalid argument location"));
break;
}
@@ -3426,7 +3344,7 @@ riscv_return_value (struct gdbarch *gdbarch,
return RETURN_VALUE_ABI_PRESERVES_ADDRESS;
case riscv_arg_info::location::on_stack:
default:
- error (_("invalid argument location"));
+ error (_ ("invalid argument location"));
}
}
@@ -3468,8 +3386,7 @@ riscv_frame_cache (frame_info_ptr this_frame, void **this_cache)
if (riscv_debug_unwinder)
gdb_printf (gdb_stdlog, "Frame base is %s ($%s + 0x%x)\n",
core_addr_to_string (cache->frame_base),
- gdbarch_register_name (gdbarch,
- cache->frame_base_reg),
+ gdbarch_register_name (gdbarch, cache->frame_base_reg),
cache->frame_base_offset);
/* The prologue scanner sets the address of registers stored to the stack
@@ -3503,8 +3420,7 @@ riscv_frame_cache (frame_info_ptr this_frame, void **this_cache)
/* Implement the this_id callback for RiscV frame unwinder. */
static void
-riscv_frame_this_id (frame_info_ptr this_frame,
- void **prologue_cache,
+riscv_frame_this_id (frame_info_ptr this_frame, void **prologue_cache,
struct frame_id *this_id)
{
struct riscv_unwind_cache *cache;
@@ -3524,8 +3440,7 @@ riscv_frame_this_id (frame_info_ptr this_frame,
/* Implement the prev_register callback for RiscV frame unwinder. */
static struct value *
-riscv_frame_prev_register (frame_info_ptr this_frame,
- void **prologue_cache,
+riscv_frame_prev_register (frame_info_ptr this_frame, void **prologue_cache,
int regnum)
{
struct riscv_unwind_cache *cache;
@@ -3538,17 +3453,16 @@ riscv_frame_prev_register (frame_info_ptr this_frame,
are the fallback unwinder (DWARF unwinder is used first), we use the
default frame sniffer, which always accepts the frame. */
-static const struct frame_unwind riscv_frame_unwind =
-{
- /*.name =*/ "riscv prologue",
- /*.type =*/ NORMAL_FRAME,
- /*.stop_reason =*/ default_frame_unwind_stop_reason,
- /*.this_id =*/ riscv_frame_this_id,
- /*.prev_register =*/ riscv_frame_prev_register,
- /*.unwind_data =*/ NULL,
- /*.sniffer =*/ default_frame_sniffer,
- /*.dealloc_cache =*/ NULL,
- /*.prev_arch =*/ NULL,
+static const struct frame_unwind riscv_frame_unwind = {
+ /*.name =*/"riscv prologue",
+ /*.type =*/NORMAL_FRAME,
+ /*.stop_reason =*/default_frame_unwind_stop_reason,
+ /*.this_id =*/riscv_frame_this_id,
+ /*.prev_register =*/riscv_frame_prev_register,
+ /*.unwind_data =*/NULL,
+ /*.sniffer =*/default_frame_sniffer,
+ /*.dealloc_cache =*/NULL,
+ /*.prev_arch =*/NULL,
};
/* Extract a set of required target features out of ABFD. If ABFD is
@@ -3575,7 +3489,7 @@ riscv_features_from_bfd (const bfd *abfd)
else if (eclass == ELFCLASS64)
features.xlen = 8;
else
- internal_error (_("unknown ELF header class %d"), eclass);
+ internal_error (_ ("unknown ELF header class %d"), eclass);
if (e_flags & EF_RISCV_FLOAT_ABI_DOUBLE)
features.flen = 8;
@@ -3586,7 +3500,7 @@ riscv_features_from_bfd (const bfd *abfd)
{
if (features.xlen == 8)
{
- warning (_("64-bit ELF with RV32E flag set! Assuming 32-bit"));
+ warning (_ ("64-bit ELF with RV32E flag set! Assuming 32-bit"));
features.xlen = 4;
}
features.embedded = true;
@@ -3604,8 +3518,7 @@ static const struct target_desc *
riscv_find_default_target_description (const struct gdbarch_info info)
{
/* Extract desired feature set from INFO. */
- struct riscv_gdbarch_features features
- = riscv_features_from_bfd (info.abfd);
+ struct riscv_gdbarch_features features = riscv_features_from_bfd (info.abfd);
/* If the XLEN field is still 0 then we got nothing useful from INFO.BFD,
maybe there was no bfd object. In this case we fall back to a minimal
@@ -3758,8 +3671,8 @@ riscv_tdesc_unknown_reg (struct gdbarch *gdbarch, tdesc_feature *feature,
riscv_gdbarch_tdep *tdep = gdbarch_tdep<riscv_gdbarch_tdep> (gdbarch);
if (tdep->unknown_csrs_first_regnum == -1)
tdep->unknown_csrs_first_regnum = possible_regnum;
- gdb_assert (tdep->unknown_csrs_first_regnum
- + tdep->unknown_csrs_count == possible_regnum);
+ gdb_assert (tdep->unknown_csrs_first_regnum + tdep->unknown_csrs_count
+ == possible_regnum);
tdep->unknown_csrs_count++;
return possible_regnum;
}
@@ -3788,8 +3701,7 @@ riscv_gnu_triplet_regexp (struct gdbarch *gdbarch)
reading a binary file. */
static struct gdbarch *
-riscv_gdbarch_init (struct gdbarch_info info,
- struct gdbarch_list *arches)
+riscv_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
{
struct riscv_gdbarch_features features;
const struct target_desc *tdesc = info.target_desc;
@@ -3845,18 +3757,17 @@ riscv_gdbarch_init (struct gdbarch_info info,
however, this has not been tested in GDB yet, so for now we require
that the requested xlen match the targets xlen. */
if (abi_features.xlen != features.xlen)
- error (_("bfd requires xlen %d, but target has xlen %d"),
- abi_features.xlen, features.xlen);
+ error (_ ("bfd requires xlen %d, but target has xlen %d"),
+ abi_features.xlen, features.xlen);
/* We do support running binaries compiled for 32-bit float on targets
with 64-bit float, so we only complain if the binary requires more
than the target has available. */
if (abi_features.flen > features.flen)
- error (_("bfd requires flen %d, but target has flen %d"),
- abi_features.flen, features.flen);
+ error (_ ("bfd requires flen %d, but target has flen %d"),
+ abi_features.flen, features.flen);
/* Find a candidate among the list of pre-declared architectures. */
- for (arches = gdbarch_list_lookup_by_info (arches, &info);
- arches != NULL;
+ for (arches = gdbarch_list_lookup_by_info (arches, &info); arches != NULL;
arches = gdbarch_list_lookup_by_info (arches->next, &info))
{
/* Check that the feature set of the ARCHES matches the feature set
@@ -4035,8 +3946,7 @@ static CORE_ADDR
riscv_next_pc (struct regcache *regcache, CORE_ADDR pc)
{
struct gdbarch *gdbarch = regcache->arch ();
- const riscv_gdbarch_tdep *tdep
- = gdbarch_tdep<riscv_gdbarch_tdep> (gdbarch);
+ const riscv_gdbarch_tdep *tdep = gdbarch_tdep<riscv_gdbarch_tdep> (gdbarch);
struct riscv_insn insn;
CORE_ADDR next_pc;
@@ -4167,11 +4077,11 @@ riscv_software_single_step (struct regcache *regcache)
pc = regcache_read_pc (regcache);
if (riscv_next_pc_atomic_sequence (regcache, pc, &next_pc))
- return {next_pc};
+ return { next_pc };
next_pc = riscv_next_pc (regcache, pc);
- return {next_pc};
+ return { next_pc };
}
/* Create RISC-V specific reggroups. */
@@ -4185,9 +4095,8 @@ riscv_init_reggroups ()
/* See riscv-tdep.h. */
void
-riscv_supply_regset (const struct regset *regset,
- struct regcache *regcache, int regnum,
- const void *regs, size_t len)
+riscv_supply_regset (const struct regset *regset, struct regcache *regcache,
+ int regnum, const void *regs, size_t len)
{
regcache->supply_regset (regset, regnum, regs, len);
@@ -4197,8 +4106,7 @@ riscv_supply_regset (const struct regset *regset,
struct gdbarch *gdbarch = regcache->arch ();
riscv_gdbarch_tdep *tdep = gdbarch_tdep<riscv_gdbarch_tdep> (gdbarch);
- if (regnum == -1
- || regnum == tdep->fflags_regnum
+ if (regnum == -1 || regnum == tdep->fflags_regnum
|| regnum == tdep->frm_regnum)
{
int fcsr_regnum = RISCV_CSR_FCSR_REGNUM;
@@ -4239,7 +4147,7 @@ riscv_supply_regset (const struct regset *regset,
if ((regnum == -1 || regnum == tdep->frm_regnum)
&& tdep->frm_regnum < gdbarch_num_regs (gdbarch))
regcache->raw_supply_integer (tdep->frm_regnum,
- (gdb_byte *)&frm_val,
+ (gdb_byte *) &frm_val,
sizeof (fflags_val),
/* is_signed */ false);
}
@@ -4247,6 +4155,7 @@ riscv_supply_regset (const struct regset *regset,
}
void _initialize_riscv_tdep ();
+
void
_initialize_riscv_tdep ()
{
@@ -4257,71 +4166,71 @@ _initialize_riscv_tdep ()
/* Add root prefix command for all "set debug riscv" and "show debug
riscv" commands. */
add_setshow_prefix_cmd ("riscv", no_class,
- _("RISC-V specific debug commands."),
- _("RISC-V specific debug commands."),
+ _ ("RISC-V specific debug commands."),
+ _ ("RISC-V specific debug commands."),
&setdebugriscvcmdlist, &showdebugriscvcmdlist,
&setdebuglist, &showdebuglist);
add_setshow_zuinteger_cmd ("breakpoints", class_maintenance,
- &riscv_debug_breakpoints, _("\
-Set riscv breakpoint debugging."), _("\
-Show riscv breakpoint debugging."), _("\
+ &riscv_debug_breakpoints, _ ("\
+Set riscv breakpoint debugging."),
+ _ ("\
+Show riscv breakpoint debugging."),
+ _ ("\
When non-zero, print debugging information for the riscv specific parts\n\
of the breakpoint mechanism."),
- NULL,
- show_riscv_debug_variable,
+ NULL, show_riscv_debug_variable,
&setdebugriscvcmdlist, &showdebugriscvcmdlist);
add_setshow_zuinteger_cmd ("infcall", class_maintenance,
- &riscv_debug_infcall, _("\
-Set riscv inferior call debugging."), _("\
-Show riscv inferior call debugging."), _("\
+ &riscv_debug_infcall, _ ("\
+Set riscv inferior call debugging."),
+ _ ("\
+Show riscv inferior call debugging."),
+ _ ("\
When non-zero, print debugging information for the riscv specific parts\n\
of the inferior call mechanism."),
- NULL,
- show_riscv_debug_variable,
+ NULL, show_riscv_debug_variable,
&setdebugriscvcmdlist, &showdebugriscvcmdlist);
add_setshow_zuinteger_cmd ("unwinder", class_maintenance,
- &riscv_debug_unwinder, _("\
-Set riscv stack unwinding debugging."), _("\
-Show riscv stack unwinding debugging."), _("\
+ &riscv_debug_unwinder, _ ("\
+Set riscv stack unwinding debugging."),
+ _ ("\
+Show riscv stack unwinding debugging."),
+ _ ("\
When non-zero, print debugging information for the riscv specific parts\n\
of the stack unwinding mechanism."),
- NULL,
- show_riscv_debug_variable,
+ NULL, show_riscv_debug_variable,
&setdebugriscvcmdlist, &showdebugriscvcmdlist);
add_setshow_zuinteger_cmd ("gdbarch", class_maintenance,
- &riscv_debug_gdbarch, _("\
-Set riscv gdbarch initialisation debugging."), _("\
-Show riscv gdbarch initialisation debugging."), _("\
+ &riscv_debug_gdbarch, _ ("\
+Set riscv gdbarch initialisation debugging."),
+ _ ("\
+Show riscv gdbarch initialisation debugging."),
+ _ ("\
When non-zero, print debugging information for the riscv gdbarch\n\
initialisation process."),
- NULL,
- show_riscv_debug_variable,
+ NULL, show_riscv_debug_variable,
&setdebugriscvcmdlist, &showdebugriscvcmdlist);
/* Add root prefix command for all "set riscv" and "show riscv" commands. */
- add_setshow_prefix_cmd ("riscv", no_class,
- _("RISC-V specific commands."),
- _("RISC-V specific commands."),
- &setriscvcmdlist, &showriscvcmdlist,
- &setlist, &showlist);
-
+ add_setshow_prefix_cmd ("riscv", no_class, _ ("RISC-V specific commands."),
+ _ ("RISC-V specific commands."), &setriscvcmdlist,
+ &showriscvcmdlist, &setlist, &showlist);
use_compressed_breakpoints = AUTO_BOOLEAN_AUTO;
add_setshow_auto_boolean_cmd ("use-compressed-breakpoints", no_class,
- &use_compressed_breakpoints,
- _("\
-Set debugger's use of compressed breakpoints."), _(" \
-Show debugger's use of compressed breakpoints."), _("\
+ &use_compressed_breakpoints, _ ("\
+Set debugger's use of compressed breakpoints."),
+ _ (" \
+Show debugger's use of compressed breakpoints."),
+ _ ("\
Debugging compressed code requires compressed breakpoints to be used. If\n\
left to 'auto' then gdb will use them if the existing instruction is a\n\
compressed instruction. If that doesn't give the correct behavior, then\n\
this option can be used."),
- NULL,
- show_use_compressed_breakpoints,
- &setriscvcmdlist,
- &showriscvcmdlist);
+ NULL, show_use_compressed_breakpoints,
+ &setriscvcmdlist, &showriscvcmdlist);
}
diff --git a/gdb/riscv-tdep.h b/gdb/riscv-tdep.h
index 4c3afb08e07..a259d050fe0 100644
--- a/gdb/riscv-tdep.h
+++ b/gdb/riscv-tdep.h
@@ -27,27 +27,28 @@
/* RiscV register numbers. */
enum
{
- RISCV_ZERO_REGNUM = 0, /* Read-only register, always 0. */
- RISCV_RA_REGNUM = 1, /* Return Address. */
- RISCV_SP_REGNUM = 2, /* Stack Pointer. */
- RISCV_GP_REGNUM = 3, /* Global Pointer. */
- RISCV_TP_REGNUM = 4, /* Thread Pointer. */
- RISCV_FP_REGNUM = 8, /* Frame Pointer. */
- RISCV_A0_REGNUM = 10, /* First argument. */
- RISCV_A1_REGNUM = 11, /* Second argument. */
- RISCV_A7_REGNUM = 17, /* Seventh argument. */
- RISCV_PC_REGNUM = 32, /* Program Counter. */
+ RISCV_ZERO_REGNUM = 0, /* Read-only register, always 0. */
+ RISCV_RA_REGNUM = 1, /* Return Address. */
+ RISCV_SP_REGNUM = 2, /* Stack Pointer. */
+ RISCV_GP_REGNUM = 3, /* Global Pointer. */
+ RISCV_TP_REGNUM = 4, /* Thread Pointer. */
+ RISCV_FP_REGNUM = 8, /* Frame Pointer. */
+ RISCV_A0_REGNUM = 10, /* First argument. */
+ RISCV_A1_REGNUM = 11, /* Second argument. */
+ RISCV_A7_REGNUM = 17, /* Seventh argument. */
+ RISCV_PC_REGNUM = 32, /* Program Counter. */
RISCV_NUM_INTEGER_REGS = 32,
- RISCV_FIRST_FP_REGNUM = 33, /* First Floating Point Register */
+ RISCV_FIRST_FP_REGNUM = 33, /* First Floating Point Register */
RISCV_FA0_REGNUM = 43,
RISCV_FA1_REGNUM = RISCV_FA0_REGNUM + 1,
- RISCV_LAST_FP_REGNUM = 64, /* Last Floating Point Register */
+ RISCV_LAST_FP_REGNUM = 64, /* Last Floating Point Register */
+
+ RISCV_FIRST_CSR_REGNUM = 65, /* First CSR */
- RISCV_FIRST_CSR_REGNUM = 65, /* First CSR */
#define DECLARE_CSR(name, num, class, define_version, abort_version) \
- RISCV_ ## num ## _REGNUM = RISCV_FIRST_CSR_REGNUM + num,
+ RISCV_##num##_REGNUM = RISCV_FIRST_CSR_REGNUM + num,
#include "opcode/riscv-opc.h"
#undef DECLARE_CSR
RISCV_LAST_CSR_REGNUM = 4160,
@@ -115,7 +116,6 @@ struct riscv_gdbarch_tdep : gdbarch_tdep_base
CORE_ADDR (*syscall_next_pc) (frame_info_ptr frame) = nullptr;
};
-
/* Return the width in bytes of the general purpose registers for GDBARCH.
Possible return values are 4, 8, or 16 for RiscV variants RV32, RV64, or
RV128. */
@@ -151,8 +151,8 @@ extern int riscv_abi_flen (struct gdbarch *gdbarch);
extern bool riscv_abi_embedded (struct gdbarch *gdbarch);
/* Single step based on where the current instruction will take us. */
-extern std::vector<CORE_ADDR> riscv_software_single_step
- (struct regcache *regcache);
+extern std::vector<CORE_ADDR>
+riscv_software_single_step (struct regcache *regcache);
/* Supply register REGNUM from the buffer REGS (length LEN) into
REGCACHE. REGSET describes the layout of the buffer. If REGNUM is -1
@@ -174,8 +174,8 @@ extern std::vector<CORE_ADDR> riscv_software_single_step
in use. */
extern void riscv_supply_regset (const struct regset *regset,
- struct regcache *regcache, int regnum,
- const void *regs, size_t len);
+ struct regcache *regcache, int regnum,
+ const void *regs, size_t len);
/* The names of the RISC-V target description features. */
extern const char *riscv_feature_name_csr;
diff --git a/gdb/rl78-tdep.c b/gdb/rl78-tdep.c
index 4979e09b15f..b7ea0f8a4d2 100644
--- a/gdb/rl78-tdep.c
+++ b/gdb/rl78-tdep.c
@@ -92,16 +92,16 @@ enum
RL78_RAW_BANK3_R6_REGNUM,
RL78_RAW_BANK3_R7_REGNUM,
- RL78_PSW_REGNUM, /* 8 bits */
- RL78_ES_REGNUM, /* 8 bits */
- RL78_CS_REGNUM, /* 8 bits */
- RL78_RAW_PC_REGNUM, /* 20 bits; we'll use 32 bits for it. */
+ RL78_PSW_REGNUM, /* 8 bits */
+ RL78_ES_REGNUM, /* 8 bits */
+ RL78_CS_REGNUM, /* 8 bits */
+ RL78_RAW_PC_REGNUM, /* 20 bits; we'll use 32 bits for it. */
/* Fixed address SFRs (some of those above are SFRs too.) */
- RL78_SPL_REGNUM, /* 8 bits; lower half of SP */
- RL78_SPH_REGNUM, /* 8 bits; upper half of SP */
- RL78_PMC_REGNUM, /* 8 bits */
- RL78_MEM_REGNUM, /* 8 bits ?? */
+ RL78_SPL_REGNUM, /* 8 bits; lower half of SP */
+ RL78_SPH_REGNUM, /* 8 bits; upper half of SP */
+ RL78_PMC_REGNUM, /* 8 bits */
+ RL78_MEM_REGNUM, /* 8 bits ?? */
RL78_NUM_REGS,
@@ -206,7 +206,7 @@ enum
RL78_NUM_PSEUDO_REGS = RL78_NUM_TOTAL_REGS - RL78_NUM_REGS
};
-#define RL78_SP_ADDR 0xffff8
+#define RL78_SP_ADDR 0xffff8
/* Architecture specific data. */
@@ -215,16 +215,11 @@ struct rl78_gdbarch_tdep : gdbarch_tdep_base
/* The ELF header flags specify the multilib used. */
int elf_flags = 0;
- struct type *rl78_void = nullptr,
- *rl78_uint8 = nullptr,
- *rl78_int8 = nullptr,
- *rl78_uint16 = nullptr,
- *rl78_int16 = nullptr,
- *rl78_uint32 = nullptr,
- *rl78_int32 = nullptr,
- *rl78_data_pointer = nullptr,
- *rl78_code_pointer = nullptr,
- *rl78_psw_type = nullptr;
+ struct type *rl78_void = nullptr, *rl78_uint8 = nullptr,
+ *rl78_int8 = nullptr, *rl78_uint16 = nullptr,
+ *rl78_int16 = nullptr, *rl78_uint32 = nullptr,
+ *rl78_int32 = nullptr, *rl78_data_pointer = nullptr,
+ *rl78_code_pointer = nullptr, *rl78_psw_type = nullptr;
};
/* This structure holds the results of a prologue analysis. */
@@ -271,8 +266,8 @@ rl78_psw_type (struct gdbarch *gdbarch)
if (tdep->rl78_psw_type == NULL)
{
- tdep->rl78_psw_type = arch_flags_type (gdbarch,
- "builtin_type_rl78_psw", 8);
+ tdep->rl78_psw_type
+ = arch_flags_type (gdbarch, "builtin_type_rl78_psw", 8);
append_flags_type_flag (tdep->rl78_psw_type, 0, "CY");
append_flags_type_flag (tdep->rl78_psw_type, 1, "ISP0");
append_flags_type_flag (tdep->rl78_psw_type, 2, "ISP1");
@@ -305,7 +300,7 @@ rl78_register_type (struct gdbarch *gdbarch, int reg_nr)
&& reg_nr <= RL78_BANK3_R7_REGNUM))
return tdep->rl78_int8;
else if (reg_nr == RL78_SP_REGNUM
- || (RL78_BANK0_RP0_PTR_REGNUM <= reg_nr
+ || (RL78_BANK0_RP0_PTR_REGNUM <= reg_nr
&& reg_nr <= RL78_BANK3_RP3_PTR_REGNUM))
return tdep->rl78_data_pointer;
else
@@ -317,132 +312,79 @@ rl78_register_type (struct gdbarch *gdbarch, int reg_nr)
static const char *
rl78_register_name (struct gdbarch *gdbarch, int regnr)
{
- static const char *const reg_names[] =
- {
- "", /* bank0_r0 */
- "", /* bank0_r1 */
- "", /* bank0_r2 */
- "", /* bank0_r3 */
- "", /* bank0_r4 */
- "", /* bank0_r5 */
- "", /* bank0_r6 */
- "", /* bank0_r7 */
-
- "", /* bank1_r0 */
- "", /* bank1_r1 */
- "", /* bank1_r2 */
- "", /* bank1_r3 */
- "", /* bank1_r4 */
- "", /* bank1_r5 */
- "", /* bank1_r6 */
- "", /* bank1_r7 */
-
- "", /* bank2_r0 */
- "", /* bank2_r1 */
- "", /* bank2_r2 */
- "", /* bank2_r3 */
- "", /* bank2_r4 */
- "", /* bank2_r5 */
- "", /* bank2_r6 */
- "", /* bank2_r7 */
-
- "", /* bank3_r0 */
- "", /* bank3_r1 */
- "", /* bank3_r2 */
- "", /* bank3_r3 */
- "", /* bank3_r4 */
- "", /* bank3_r5 */
- "", /* bank3_r6 */
- "", /* bank3_r7 */
-
- "psw",
- "es",
- "cs",
- "",
-
- "", /* spl */
- "", /* sph */
- "pmc",
- "mem",
-
- "pc",
- "sp",
-
- "x",
- "a",
- "c",
- "b",
- "e",
- "d",
- "l",
- "h",
-
- "ax",
- "bc",
- "de",
- "hl",
-
- "bank0_r0",
- "bank0_r1",
- "bank0_r2",
- "bank0_r3",
- "bank0_r4",
- "bank0_r5",
- "bank0_r6",
- "bank0_r7",
-
- "bank1_r0",
- "bank1_r1",
- "bank1_r2",
- "bank1_r3",
- "bank1_r4",
- "bank1_r5",
- "bank1_r6",
- "bank1_r7",
-
- "bank2_r0",
- "bank2_r1",
- "bank2_r2",
- "bank2_r3",
- "bank2_r4",
- "bank2_r5",
- "bank2_r6",
- "bank2_r7",
-
- "bank3_r0",
- "bank3_r1",
- "bank3_r2",
- "bank3_r3",
- "bank3_r4",
- "bank3_r5",
- "bank3_r6",
- "bank3_r7",
-
- "bank0_rp0",
- "bank0_rp1",
- "bank0_rp2",
- "bank0_rp3",
-
- "bank1_rp0",
- "bank1_rp1",
- "bank1_rp2",
- "bank1_rp3",
-
- "bank2_rp0",
- "bank2_rp1",
- "bank2_rp2",
- "bank2_rp3",
-
- "bank3_rp0",
- "bank3_rp1",
- "bank3_rp2",
- "bank3_rp3",
-
- /* The 16 register slots would be named
+ static const char *const reg_names[]
+ = { "", /* bank0_r0 */
+ "", /* bank0_r1 */
+ "", /* bank0_r2 */
+ "", /* bank0_r3 */
+ "", /* bank0_r4 */
+ "", /* bank0_r5 */
+ "", /* bank0_r6 */
+ "", /* bank0_r7 */
+
+ "", /* bank1_r0 */
+ "", /* bank1_r1 */
+ "", /* bank1_r2 */
+ "", /* bank1_r3 */
+ "", /* bank1_r4 */
+ "", /* bank1_r5 */
+ "", /* bank1_r6 */
+ "", /* bank1_r7 */
+
+ "", /* bank2_r0 */
+ "", /* bank2_r1 */
+ "", /* bank2_r2 */
+ "", /* bank2_r3 */
+ "", /* bank2_r4 */
+ "", /* bank2_r5 */
+ "", /* bank2_r6 */
+ "", /* bank2_r7 */
+
+ "", /* bank3_r0 */
+ "", /* bank3_r1 */
+ "", /* bank3_r2 */
+ "", /* bank3_r3 */
+ "", /* bank3_r4 */
+ "", /* bank3_r5 */
+ "", /* bank3_r6 */
+ "", /* bank3_r7 */
+
+ "psw", "es", "cs", "",
+
+ "", /* spl */
+ "", /* sph */
+ "pmc", "mem",
+
+ "pc", "sp",
+
+ "x", "a", "c", "b", "e", "d", "l", "h",
+
+ "ax", "bc", "de", "hl",
+
+ "bank0_r0", "bank0_r1", "bank0_r2", "bank0_r3", "bank0_r4", "bank0_r5",
+ "bank0_r6", "bank0_r7",
+
+ "bank1_r0", "bank1_r1", "bank1_r2", "bank1_r3", "bank1_r4", "bank1_r5",
+ "bank1_r6", "bank1_r7",
+
+ "bank2_r0", "bank2_r1", "bank2_r2", "bank2_r3", "bank2_r4", "bank2_r5",
+ "bank2_r6", "bank2_r7",
+
+ "bank3_r0", "bank3_r1", "bank3_r2", "bank3_r3", "bank3_r4", "bank3_r5",
+ "bank3_r6", "bank3_r7",
+
+ "bank0_rp0", "bank0_rp1", "bank0_rp2", "bank0_rp3",
+
+ "bank1_rp0", "bank1_rp1", "bank1_rp2", "bank1_rp3",
+
+ "bank2_rp0", "bank2_rp1", "bank2_rp2", "bank2_rp3",
+
+ "bank3_rp0", "bank3_rp1", "bank3_rp2", "bank3_rp3",
+
+ /* The 16 register slots would be named
bank0_rp0_ptr_regnum ... bank3_rp3_ptr_regnum, but we don't
want these to be user visible registers. */
- "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", ""
- };
+ "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "" };
return reg_names[regnr];
}
@@ -452,132 +394,76 @@ rl78_register_name (struct gdbarch *gdbarch, int regnr)
static const char *
rl78_g10_register_name (struct gdbarch *gdbarch, int regnr)
{
- static const char *const reg_names[] =
- {
- "", /* bank0_r0 */
- "", /* bank0_r1 */
- "", /* bank0_r2 */
- "", /* bank0_r3 */
- "", /* bank0_r4 */
- "", /* bank0_r5 */
- "", /* bank0_r6 */
- "", /* bank0_r7 */
-
- "", /* bank1_r0 */
- "", /* bank1_r1 */
- "", /* bank1_r2 */
- "", /* bank1_r3 */
- "", /* bank1_r4 */
- "", /* bank1_r5 */
- "", /* bank1_r6 */
- "", /* bank1_r7 */
-
- "", /* bank2_r0 */
- "", /* bank2_r1 */
- "", /* bank2_r2 */
- "", /* bank2_r3 */
- "", /* bank2_r4 */
- "", /* bank2_r5 */
- "", /* bank2_r6 */
- "", /* bank2_r7 */
-
- "", /* bank3_r0 */
- "", /* bank3_r1 */
- "", /* bank3_r2 */
- "", /* bank3_r3 */
- "", /* bank3_r4 */
- "", /* bank3_r5 */
- "", /* bank3_r6 */
- "", /* bank3_r7 */
-
- "psw",
- "es",
- "cs",
- "",
-
- "", /* spl */
- "", /* sph */
- "pmc",
- "mem",
-
- "pc",
- "sp",
-
- "x",
- "a",
- "c",
- "b",
- "e",
- "d",
- "l",
- "h",
-
- "ax",
- "bc",
- "de",
- "hl",
-
- "bank0_r0",
- "bank0_r1",
- "bank0_r2",
- "bank0_r3",
- "bank0_r4",
- "bank0_r5",
- "bank0_r6",
- "bank0_r7",
-
- "",
- "",
- "",
- "",
- "",
- "",
- "",
- "",
-
- "",
- "",
- "",
- "",
- "",
- "",
- "",
- "",
-
- "",
- "",
- "",
- "",
- "",
- "",
- "",
- "",
-
- "bank0_rp0",
- "bank0_rp1",
- "bank0_rp2",
- "bank0_rp3",
-
- "",
- "",
- "",
- "",
-
- "",
- "",
- "",
- "",
-
- "",
- "",
- "",
- "",
-
- /* The 16 register slots would be named
+ static const char *const reg_names[]
+ = { "", /* bank0_r0 */
+ "", /* bank0_r1 */
+ "", /* bank0_r2 */
+ "", /* bank0_r3 */
+ "", /* bank0_r4 */
+ "", /* bank0_r5 */
+ "", /* bank0_r6 */
+ "", /* bank0_r7 */
+
+ "", /* bank1_r0 */
+ "", /* bank1_r1 */
+ "", /* bank1_r2 */
+ "", /* bank1_r3 */
+ "", /* bank1_r4 */
+ "", /* bank1_r5 */
+ "", /* bank1_r6 */
+ "", /* bank1_r7 */
+
+ "", /* bank2_r0 */
+ "", /* bank2_r1 */
+ "", /* bank2_r2 */
+ "", /* bank2_r3 */
+ "", /* bank2_r4 */
+ "", /* bank2_r5 */
+ "", /* bank2_r6 */
+ "", /* bank2_r7 */
+
+ "", /* bank3_r0 */
+ "", /* bank3_r1 */
+ "", /* bank3_r2 */
+ "", /* bank3_r3 */
+ "", /* bank3_r4 */
+ "", /* bank3_r5 */
+ "", /* bank3_r6 */
+ "", /* bank3_r7 */
+
+ "psw", "es", "cs", "",
+
+ "", /* spl */
+ "", /* sph */
+ "pmc", "mem",
+
+ "pc", "sp",
+
+ "x", "a", "c", "b", "e", "d", "l", "h",
+
+ "ax", "bc", "de", "hl",
+
+ "bank0_r0", "bank0_r1", "bank0_r2", "bank0_r3", "bank0_r4", "bank0_r5",
+ "bank0_r6", "bank0_r7",
+
+ "", "", "", "", "", "", "", "",
+
+ "", "", "", "", "", "", "", "",
+
+ "", "", "", "", "", "", "", "",
+
+ "bank0_rp0", "bank0_rp1", "bank0_rp2", "bank0_rp3",
+
+ "", "", "", "",
+
+ "", "", "", "",
+
+ "", "", "", "",
+
+ /* The 16 register slots would be named
bank0_rp0_ptr_regnum ... bank3_rp3_ptr_regnum, but we don't
want these to be user visible registers. */
- "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", ""
- };
+ "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "" };
return reg_names[regnr];
}
@@ -594,24 +480,18 @@ rl78_register_reggroup_p (struct gdbarch *gdbarch, int regnum,
/* All other registers are saved and restored. */
if (group == save_reggroup || group == restore_reggroup)
{
- if ((regnum < RL78_NUM_REGS
- && regnum != RL78_SPL_REGNUM
- && regnum != RL78_SPH_REGNUM
- && regnum != RL78_RAW_PC_REGNUM)
- || regnum == RL78_SP_REGNUM
- || regnum == RL78_PC_REGNUM)
+ if ((regnum < RL78_NUM_REGS && regnum != RL78_SPL_REGNUM
+ && regnum != RL78_SPH_REGNUM && regnum != RL78_RAW_PC_REGNUM)
+ || regnum == RL78_SP_REGNUM || regnum == RL78_PC_REGNUM)
return 1;
else
return 0;
}
if ((RL78_BANK0_R0_REGNUM <= regnum && regnum <= RL78_BANK3_R7_REGNUM)
- || regnum == RL78_ES_REGNUM
- || regnum == RL78_CS_REGNUM
- || regnum == RL78_SPL_REGNUM
- || regnum == RL78_SPH_REGNUM
- || regnum == RL78_PMC_REGNUM
- || regnum == RL78_MEM_REGNUM
+ || regnum == RL78_ES_REGNUM || regnum == RL78_CS_REGNUM
+ || regnum == RL78_SPL_REGNUM || regnum == RL78_SPH_REGNUM
+ || regnum == RL78_PMC_REGNUM || regnum == RL78_MEM_REGNUM
|| regnum == RL78_RAW_PC_REGNUM
|| (RL78_BANK0_RP0_REGNUM <= regnum && regnum <= RL78_BANK3_RP3_REGNUM))
return group == system_reggroup;
@@ -641,31 +521,31 @@ rl78_make_data_address (CORE_ADDR addr)
static enum register_status
rl78_pseudo_register_read (struct gdbarch *gdbarch,
- readable_regcache *regcache,
- int reg, gdb_byte *buffer)
+ readable_regcache *regcache, int reg,
+ gdb_byte *buffer)
{
enum register_status status;
if (RL78_BANK0_R0_REGNUM <= reg && reg <= RL78_BANK3_R7_REGNUM)
{
- int raw_regnum = RL78_RAW_BANK0_R0_REGNUM
- + (reg - RL78_BANK0_R0_REGNUM);
+ int raw_regnum = RL78_RAW_BANK0_R0_REGNUM + (reg - RL78_BANK0_R0_REGNUM);
status = regcache->raw_read (raw_regnum, buffer);
}
else if (RL78_BANK0_RP0_REGNUM <= reg && reg <= RL78_BANK3_RP3_REGNUM)
{
- int raw_regnum = 2 * (reg - RL78_BANK0_RP0_REGNUM)
- + RL78_RAW_BANK0_R0_REGNUM;
+ int raw_regnum
+ = 2 * (reg - RL78_BANK0_RP0_REGNUM) + RL78_RAW_BANK0_R0_REGNUM;
status = regcache->raw_read (raw_regnum, buffer);
if (status == REG_VALID)
status = regcache->raw_read (raw_regnum + 1, buffer + 1);
}
- else if (RL78_BANK0_RP0_PTR_REGNUM <= reg && reg <= RL78_BANK3_RP3_PTR_REGNUM)
+ else if (RL78_BANK0_RP0_PTR_REGNUM <= reg
+ && reg <= RL78_BANK3_RP3_PTR_REGNUM)
{
- int raw_regnum = 2 * (reg - RL78_BANK0_RP0_PTR_REGNUM)
- + RL78_RAW_BANK0_R0_REGNUM;
+ int raw_regnum
+ = 2 * (reg - RL78_BANK0_RP0_PTR_REGNUM) + RL78_RAW_BANK0_R0_REGNUM;
status = regcache->raw_read (raw_regnum, buffer);
if (status == REG_VALID)
@@ -722,29 +602,28 @@ rl78_pseudo_register_read (struct gdbarch *gdbarch,
/* Implement the "pseudo_register_write" gdbarch method. */
static void
-rl78_pseudo_register_write (struct gdbarch *gdbarch,
- struct regcache *regcache,
+rl78_pseudo_register_write (struct gdbarch *gdbarch, struct regcache *regcache,
int reg, const gdb_byte *buffer)
{
if (RL78_BANK0_R0_REGNUM <= reg && reg <= RL78_BANK3_R7_REGNUM)
{
- int raw_regnum = RL78_RAW_BANK0_R0_REGNUM
- + (reg - RL78_BANK0_R0_REGNUM);
+ int raw_regnum = RL78_RAW_BANK0_R0_REGNUM + (reg - RL78_BANK0_R0_REGNUM);
regcache->raw_write (raw_regnum, buffer);
}
else if (RL78_BANK0_RP0_REGNUM <= reg && reg <= RL78_BANK3_RP3_REGNUM)
{
- int raw_regnum = 2 * (reg - RL78_BANK0_RP0_REGNUM)
- + RL78_RAW_BANK0_R0_REGNUM;
+ int raw_regnum
+ = 2 * (reg - RL78_BANK0_RP0_REGNUM) + RL78_RAW_BANK0_R0_REGNUM;
regcache->raw_write (raw_regnum, buffer);
regcache->raw_write (raw_regnum + 1, buffer + 1);
}
- else if (RL78_BANK0_RP0_PTR_REGNUM <= reg && reg <= RL78_BANK3_RP3_PTR_REGNUM)
+ else if (RL78_BANK0_RP0_PTR_REGNUM <= reg
+ && reg <= RL78_BANK3_RP3_PTR_REGNUM)
{
- int raw_regnum = 2 * (reg - RL78_BANK0_RP0_PTR_REGNUM)
- + RL78_RAW_BANK0_R0_REGNUM;
+ int raw_regnum
+ = 2 * (reg - RL78_BANK0_RP0_PTR_REGNUM) + RL78_RAW_BANK0_R0_REGNUM;
regcache->raw_write (raw_regnum, buffer);
regcache->raw_write (raw_regnum + 1, buffer + 1);
@@ -812,45 +691,44 @@ opc_reg_to_gdb_regnum (int opcreg)
{
switch (opcreg)
{
- case RL78_Reg_X:
- return RL78_X_REGNUM;
- case RL78_Reg_A:
- return RL78_A_REGNUM;
- case RL78_Reg_C:
- return RL78_C_REGNUM;
- case RL78_Reg_B:
- return RL78_B_REGNUM;
- case RL78_Reg_E:
- return RL78_E_REGNUM;
- case RL78_Reg_D:
- return RL78_D_REGNUM;
- case RL78_Reg_L:
- return RL78_L_REGNUM;
- case RL78_Reg_H:
- return RL78_H_REGNUM;
- case RL78_Reg_AX:
- return RL78_AX_REGNUM;
- case RL78_Reg_BC:
- return RL78_BC_REGNUM;
- case RL78_Reg_DE:
- return RL78_DE_REGNUM;
- case RL78_Reg_HL:
- return RL78_HL_REGNUM;
- case RL78_Reg_SP:
- return RL78_SP_REGNUM;
- case RL78_Reg_PSW:
- return RL78_PSW_REGNUM;
- case RL78_Reg_CS:
- return RL78_CS_REGNUM;
- case RL78_Reg_ES:
- return RL78_ES_REGNUM;
- case RL78_Reg_PMC:
- return RL78_PMC_REGNUM;
- case RL78_Reg_MEM:
- return RL78_MEM_REGNUM;
- default:
- internal_error (_("Undefined mapping for opc reg %d"),
- opcreg);
+ case RL78_Reg_X:
+ return RL78_X_REGNUM;
+ case RL78_Reg_A:
+ return RL78_A_REGNUM;
+ case RL78_Reg_C:
+ return RL78_C_REGNUM;
+ case RL78_Reg_B:
+ return RL78_B_REGNUM;
+ case RL78_Reg_E:
+ return RL78_E_REGNUM;
+ case RL78_Reg_D:
+ return RL78_D_REGNUM;
+ case RL78_Reg_L:
+ return RL78_L_REGNUM;
+ case RL78_Reg_H:
+ return RL78_H_REGNUM;
+ case RL78_Reg_AX:
+ return RL78_AX_REGNUM;
+ case RL78_Reg_BC:
+ return RL78_BC_REGNUM;
+ case RL78_Reg_DE:
+ return RL78_DE_REGNUM;
+ case RL78_Reg_HL:
+ return RL78_HL_REGNUM;
+ case RL78_Reg_SP:
+ return RL78_SP_REGNUM;
+ case RL78_Reg_PSW:
+ return RL78_PSW_REGNUM;
+ case RL78_Reg_CS:
+ return RL78_CS_REGNUM;
+ case RL78_Reg_ES:
+ return RL78_ES_REGNUM;
+ case RL78_Reg_PMC:
+ return RL78_PMC_REGNUM;
+ case RL78_Reg_MEM:
+ return RL78_MEM_REGNUM;
+ default:
+ internal_error (_ ("Undefined mapping for opc reg %d"), opcreg);
}
/* Not reached. */
@@ -889,13 +767,11 @@ rl78_get_opcode_byte (void *handle)
register was saved, record its offset. */
static void
-check_for_saved (void *result_untyped, pv_t addr, CORE_ADDR size,
- pv_t value)
+check_for_saved (void *result_untyped, pv_t addr, CORE_ADDR size, pv_t value)
{
struct rl78_prologue *result = (struct rl78_prologue *) result_untyped;
- if (value.kind == pvk_register
- && value.k == 0
+ if (value.kind == pvk_register && value.k == 0
&& pv_is_register (addr, RL78_SP_REGNUM)
&& size == register_size (target_gdbarch (), value.reg))
result->reg_offset[value.reg] = addr.k;
@@ -905,8 +781,8 @@ check_for_saved (void *result_untyped, pv_t addr, CORE_ADDR size,
LIMIT_PC. Fill in RESULT as appropriate. */
static void
-rl78_analyze_prologue (CORE_ADDR start_pc,
- CORE_ADDR limit_pc, struct rl78_prologue *result)
+rl78_analyze_prologue (CORE_ADDR start_pc, CORE_ADDR limit_pc,
+ struct rl78_prologue *result)
{
CORE_ADDR pc, next_pc;
int rn;
@@ -944,13 +820,12 @@ rl78_analyze_prologue (CORE_ADDR start_pc,
{
bank = opc.op[1].addend;
}
- else if (opc.id == RLO_mov
- && opc.op[0].type == RL78_Operand_PreDec
+ else if (opc.id == RLO_mov && opc.op[0].type == RL78_Operand_PreDec
&& opc.op[0].reg == RL78_Reg_SP
&& opc.op[1].type == RL78_Operand_Register)
{
- int rsrc = (bank * RL78_REGS_PER_BANK)
- + 2 * (opc.op[1].reg - RL78_Reg_AX);
+ int rsrc
+ = (bank * RL78_REGS_PER_BANK) + 2 * (opc.op[1].reg - RL78_Reg_AX);
reg[RL78_SP_REGNUM] = pv_add_constant (reg[RL78_SP_REGNUM], -1);
stack.store (reg[RL78_SP_REGNUM], 1, reg[rsrc]);
@@ -958,28 +833,23 @@ rl78_analyze_prologue (CORE_ADDR start_pc,
stack.store (reg[RL78_SP_REGNUM], 1, reg[rsrc + 1]);
after_last_frame_setup_insn = next_pc;
}
- else if (opc.id == RLO_sub
- && opc.op[0].type == RL78_Operand_Register
+ else if (opc.id == RLO_sub && opc.op[0].type == RL78_Operand_Register
&& opc.op[0].reg == RL78_Reg_SP
&& opc.op[1].type == RL78_Operand_Immediate)
{
int addend = opc.op[1].addend;
- reg[RL78_SP_REGNUM] = pv_add_constant (reg[RL78_SP_REGNUM],
- -addend);
+ reg[RL78_SP_REGNUM] = pv_add_constant (reg[RL78_SP_REGNUM], -addend);
after_last_frame_setup_insn = next_pc;
}
- else if (opc.id == RLO_mov
- && opc.size == RL78_Word
+ else if (opc.id == RLO_mov && opc.size == RL78_Word
&& opc.op[0].type == RL78_Operand_Register
&& opc.op[1].type == RL78_Operand_Indirect
&& opc.op[1].addend == RL78_SP_ADDR)
{
- reg[opc_reg_to_gdb_regnum (opc.op[0].reg)]
- = reg[RL78_SP_REGNUM];
+ reg[opc_reg_to_gdb_regnum (opc.op[0].reg)] = reg[RL78_SP_REGNUM];
}
- else if (opc.id == RLO_sub
- && opc.size == RL78_Word
+ else if (opc.id == RLO_sub && opc.size == RL78_Word
&& opc.op[0].type == RL78_Operand_Register
&& opc.op[1].type == RL78_Operand_Immediate)
{
@@ -988,14 +858,12 @@ rl78_analyze_prologue (CORE_ADDR start_pc,
reg[regnum] = pv_add_constant (reg[regnum], -addend);
}
- else if (opc.id == RLO_mov
- && opc.size == RL78_Word
+ else if (opc.id == RLO_mov && opc.size == RL78_Word
&& opc.op[0].type == RL78_Operand_Indirect
&& opc.op[0].addend == RL78_SP_ADDR
&& opc.op[1].type == RL78_Operand_Register)
{
- reg[RL78_SP_REGNUM]
- = reg[opc_reg_to_gdb_regnum (opc.op[1].reg)];
+ reg[RL78_SP_REGNUM] = reg[opc_reg_to_gdb_regnum (opc.op[1].reg)];
after_last_frame_setup_insn = next_pc;
}
else
@@ -1028,30 +896,27 @@ rl78_addr_bits_remove (struct gdbarch *gdbarch, CORE_ADDR addr)
/* Implement the "address_to_pointer" gdbarch method. */
static void
-rl78_address_to_pointer (struct gdbarch *gdbarch,
- struct type *type, gdb_byte *buf, CORE_ADDR addr)
+rl78_address_to_pointer (struct gdbarch *gdbarch, struct type *type,
+ gdb_byte *buf, CORE_ADDR addr)
{
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
- store_unsigned_integer (buf, type->length (), byte_order,
- addr & 0xffffff);
+ store_unsigned_integer (buf, type->length (), byte_order, addr & 0xffffff);
}
/* Implement the "pointer_to_address" gdbarch method. */
static CORE_ADDR
-rl78_pointer_to_address (struct gdbarch *gdbarch,
- struct type *type, const gdb_byte *buf)
+rl78_pointer_to_address (struct gdbarch *gdbarch, struct type *type,
+ const gdb_byte *buf)
{
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
- CORE_ADDR addr
- = extract_unsigned_integer (buf, type->length (), byte_order);
+ CORE_ADDR addr = extract_unsigned_integer (buf, type->length (), byte_order);
/* Is it a code address? */
if (type->target_type ()->code () == TYPE_CODE_FUNC
|| type->target_type ()->code () == TYPE_CODE_METHOD
- || TYPE_CODE_SPACE (type->target_type ())
- || type->length () == 4)
+ || TYPE_CODE_SPACE (type->target_type ()) || type->length () == 4)
return rl78_make_instruction_address (addr);
else
return rl78_make_data_address (addr);
@@ -1079,9 +944,8 @@ rl78_skip_prologue (struct gdbarch *gdbarch, CORE_ADDR pc)
static CORE_ADDR
rl78_unwind_pc (struct gdbarch *arch, frame_info_ptr next_frame)
{
- return rl78_addr_bits_remove
- (arch, frame_unwind_register_unsigned (next_frame,
- RL78_PC_REGNUM));
+ return rl78_addr_bits_remove (
+ arch, frame_unwind_register_unsigned (next_frame, RL78_PC_REGNUM));
}
/* Given a frame described by THIS_FRAME, decode the prologue of its
@@ -1091,7 +955,7 @@ rl78_unwind_pc (struct gdbarch *arch, frame_info_ptr next_frame)
static struct rl78_prologue *
rl78_analyze_frame_prologue (frame_info_ptr this_frame,
- void **this_prologue_cache)
+ void **this_prologue_cache)
{
if (!*this_prologue_cache)
{
@@ -1129,19 +993,18 @@ rl78_frame_base (frame_info_ptr this_frame, void **this_prologue_cache)
/* Implement the "frame_this_id" method for unwinding frames. */
static void
-rl78_this_id (frame_info_ptr this_frame,
- void **this_prologue_cache, struct frame_id *this_id)
+rl78_this_id (frame_info_ptr this_frame, void **this_prologue_cache,
+ struct frame_id *this_id)
{
- *this_id = frame_id_build (rl78_frame_base (this_frame,
- this_prologue_cache),
+ *this_id = frame_id_build (rl78_frame_base (this_frame, this_prologue_cache),
get_frame_func (this_frame));
}
/* Implement the "frame_prev_register" method for unwinding frames. */
static struct value *
-rl78_prev_register (frame_info_ptr this_frame,
- void **this_prologue_cache, int regnum)
+rl78_prev_register (frame_info_ptr this_frame, void **this_prologue_cache,
+ int regnum)
{
struct rl78_prologue *p
= rl78_analyze_frame_prologue (this_frame, this_prologue_cache);
@@ -1151,8 +1014,7 @@ rl78_prev_register (frame_info_ptr this_frame,
return frame_unwind_got_constant (this_frame, regnum, frame_base);
else if (regnum == RL78_SPL_REGNUM)
- return frame_unwind_got_constant (this_frame, regnum,
- (frame_base & 0xff));
+ return frame_unwind_got_constant (this_frame, regnum, (frame_base & 0xff));
else if (regnum == RL78_SPH_REGNUM)
return frame_unwind_got_constant (this_frame, regnum,
@@ -1162,9 +1024,9 @@ rl78_prev_register (frame_info_ptr this_frame,
return a description of the stack slot holding it. */
else if (p->reg_offset[regnum] != 1)
{
- struct value *rv =
- frame_unwind_got_memory (this_frame, regnum,
- frame_base + p->reg_offset[regnum]);
+ struct value *rv
+ = frame_unwind_got_memory (this_frame, regnum,
+ frame_base + p->reg_offset[regnum]);
if (regnum == RL78_PC_REGNUM)
{
@@ -1181,14 +1043,9 @@ rl78_prev_register (frame_info_ptr this_frame,
return frame_unwind_got_register (this_frame, regnum, regnum);
}
-static const struct frame_unwind rl78_unwind =
-{
- "rl78 prologue",
- NORMAL_FRAME,
- default_frame_unwind_stop_reason,
- rl78_this_id,
- rl78_prev_register,
- NULL,
+static const struct frame_unwind rl78_unwind = {
+ "rl78 prologue", NORMAL_FRAME, default_frame_unwind_stop_reason,
+ rl78_this_id, rl78_prev_register, NULL,
default_frame_sniffer
};
@@ -1210,7 +1067,7 @@ rl78_dwarf_reg_to_regnum (struct gdbarch *gdbarch, int reg)
else if (reg == 32)
return RL78_SP_REGNUM;
else if (reg == 33)
- return -1; /* ap */
+ return -1; /* ap */
else if (reg == 34)
return RL78_PSW_REGNUM;
else if (reg == 35)
@@ -1239,10 +1096,8 @@ rl78_register_sim_regno (struct gdbarch *gdbarch, int regnum)
/* Implement the "return_value" gdbarch method. */
static enum return_value_convention
-rl78_return_value (struct gdbarch *gdbarch,
- struct value *function,
- struct type *valtype,
- struct regcache *regcache,
+rl78_return_value (struct gdbarch *gdbarch, struct value *function,
+ struct type *valtype, struct regcache *regcache,
gdb_byte *readbuf, const gdb_byte *writebuf)
{
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
@@ -1285,10 +1140,11 @@ rl78_return_value (struct gdbarch *gdbarch,
while (valtype_len > 0)
{
u = extract_unsigned_integer (writebuf + offset, 1, byte_order);
- if (is_g10) {
- gdb_byte b = u & 0xff;
- write_memory (g10_raddr, &b, 1);
- }
+ if (is_g10)
+ {
+ gdb_byte b = u & 0xff;
+ write_memory (g10_raddr, &b, 1);
+ }
else
regcache_cooked_write_unsigned (regcache, argreg, u);
valtype_len -= 1;
@@ -1301,7 +1157,6 @@ rl78_return_value (struct gdbarch *gdbarch,
return RETURN_VALUE_REGISTER_CONVENTION;
}
-
/* Implement the "frame_align" gdbarch method. */
static CORE_ADDR
@@ -1310,26 +1165,22 @@ rl78_frame_align (struct gdbarch *gdbarch, CORE_ADDR sp)
return rl78_make_data_address (align_down (sp, 2));
}
-
/* Implement the "dummy_id" gdbarch method. */
static struct frame_id
rl78_dummy_id (struct gdbarch *gdbarch, frame_info_ptr this_frame)
{
- return
- frame_id_build (rl78_make_data_address
- (get_frame_register_unsigned
- (this_frame, RL78_SP_REGNUM)),
- get_frame_pc (this_frame));
+ return frame_id_build (rl78_make_data_address (get_frame_register_unsigned (
+ this_frame, RL78_SP_REGNUM)),
+ get_frame_pc (this_frame));
}
-
/* Implement the "push_dummy_call" gdbarch method. */
static CORE_ADDR
rl78_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
- struct regcache *regcache, CORE_ADDR bp_addr,
- int nargs, struct value **args, CORE_ADDR sp,
+ struct regcache *regcache, CORE_ADDR bp_addr, int nargs,
+ struct value **args, CORE_ADDR sp,
function_call_return_method return_method,
CORE_ADDR struct_addr)
{
@@ -1384,11 +1235,9 @@ rl78_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
else
elf_flags = 0;
-
/* Try to find the architecture in the list of already defined
architectures. */
- for (arches = gdbarch_list_lookup_by_info (arches, &info);
- arches != NULL;
+ for (arches = gdbarch_list_lookup_by_info (arches, &info); arches != NULL;
arches = gdbarch_list_lookup_by_info (arches->next, &info))
{
rl78_gdbarch_tdep *tdep
@@ -1409,8 +1258,8 @@ rl78_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
tdep->elf_flags = elf_flags;
/* Initialize types. */
- tdep->rl78_void = arch_type (gdbarch, TYPE_CODE_VOID, TARGET_CHAR_BIT,
- "void");
+ tdep->rl78_void
+ = arch_type (gdbarch, TYPE_CODE_VOID, TARGET_CHAR_BIT, "void");
tdep->rl78_uint8 = arch_integer_type (gdbarch, 8, 1, "uint8_t");
tdep->rl78_int8 = arch_integer_type (gdbarch, 8, 0, "int8_t");
tdep->rl78_uint16 = arch_integer_type (gdbarch, 16, 1, "uint16_t");
@@ -1486,6 +1335,7 @@ rl78_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
/* Register the above initialization routine. */
void _initialize_rl78_tdep ();
+
void
_initialize_rl78_tdep ()
{
diff --git a/gdb/rs6000-aix-nat.c b/gdb/rs6000-aix-nat.c
index 8c9dc1a6e68..bbfdd077912 100644
--- a/gdb/rs6000-aix-nat.c
+++ b/gdb/rs6000-aix-nat.c
@@ -49,8 +49,8 @@
#include <sys/stat.h>
#include "gdb_bfd.h"
#include <sys/core.h>
-#define __LDINFO_PTRACE32__ /* for __ld_info32 */
-#define __LDINFO_PTRACE64__ /* for __ld_info64 */
+#define __LDINFO_PTRACE32__ /* for __ld_info32 */
+#define __LDINFO_PTRACE64__ /* for __ld_info64 */
#include <sys/ldr.h>
#include <sys/systemcfg.h>
@@ -65,33 +65,33 @@
/* In 32-bit compilation mode (which is the only mode from which ptrace()
works on 4.3), __ld_info32 is #defined as equivalent to ld_info. */
-#if defined (__ld_info32) || defined (__ld_info64)
-# define ARCH3264
+#if defined(__ld_info32) || defined(__ld_info64)
+#define ARCH3264
#endif
/* Return whether the current architecture is 64-bit. */
#ifndef ARCH3264
-# define ARCH64() 0
+#define ARCH64() 0
#else
-# define ARCH64() (register_size (target_gdbarch (), 0) == 8)
+#define ARCH64() (register_size (target_gdbarch (), 0) == 8)
#endif
class rs6000_nat_target final : public inf_ptrace_target
{
public:
+
void fetch_registers (struct regcache *, int) override;
void store_registers (struct regcache *, int) override;
enum target_xfer_status xfer_partial (enum target_object object,
- const char *annex,
- gdb_byte *readbuf,
+ const char *annex, gdb_byte *readbuf,
const gdb_byte *writebuf,
ULONGEST offset, ULONGEST len,
ULONGEST *xfered_len) override;
- void create_inferior (const char *, const std::string &,
- char **, int) override;
+ void create_inferior (const char *, const std::string &, char **,
+ int) override;
ptid_t wait (ptid_t, struct target_waitstatus *, target_wait_flags) override;
@@ -104,12 +104,11 @@ protected:
void post_startup_inferior (ptid_t ptid) override;
private:
+
enum target_xfer_status
- xfer_shared_libraries (enum target_object object,
- const char *annex, gdb_byte *readbuf,
- const gdb_byte *writebuf,
- ULONGEST offset, ULONGEST len,
- ULONGEST *xfered_len);
+ xfer_shared_libraries (enum target_object object, const char *annex,
+ gdb_byte *readbuf, const gdb_byte *writebuf,
+ ULONGEST offset, ULONGEST len, ULONGEST *xfered_len);
};
static rs6000_nat_target the_rs6000_nat_target;
@@ -144,8 +143,9 @@ find_my_aix_parent (pid_t child_pid)
{
struct procsinfo ProcessBuffer1;
- if (getprocs (&ProcessBuffer1, sizeof (ProcessBuffer1),
- NULL, 0, &child_pid, 1) != 1)
+ if (getprocs (&ProcessBuffer1, sizeof (ProcessBuffer1), NULL, 0, &child_pid,
+ 1)
+ != 1)
return 0;
else
return ProcessBuffer1.pi_ppid;
@@ -159,12 +159,11 @@ static pid_t
has_my_aix_child_reported (pid_t parent_pid)
{
pid_t child = 0;
- auto it = std::find_if (aix_pending_children.begin (),
- aix_pending_children.end (),
- [=] (pid_t child_pid)
- {
- return find_my_aix_parent (child_pid) == parent_pid;
- });
+ auto it
+ = std::find_if (aix_pending_children.begin (), aix_pending_children.end (),
+ [=] (pid_t child_pid) {
+ return find_my_aix_parent (child_pid) == parent_pid;
+ });
if (it != aix_pending_children.end ())
{
child = *it;
@@ -181,8 +180,7 @@ static pid_t
has_my_aix_parent_reported (pid_t child_pid)
{
pid_t my_parent = find_my_aix_parent (child_pid);
- auto it = std::find (aix_pending_parent.begin (),
- aix_pending_parent.end (),
+ auto it = std::find (aix_pending_parent.begin (), aix_pending_parent.end (),
my_parent);
if (it != aix_pending_parent.end ())
{
@@ -206,8 +204,7 @@ regmap (struct gdbarch *gdbarch, int regno, int *isfloat)
if (tdep->ppc_gp0_regnum <= regno
&& regno < tdep->ppc_gp0_regnum + ppc_num_gprs)
return regno;
- else if (tdep->ppc_fp0_regnum >= 0
- && tdep->ppc_fp0_regnum <= regno
+ else if (tdep->ppc_fp0_regnum >= 0 && tdep->ppc_fp0_regnum <= regno
&& regno < tdep->ppc_fp0_regnum + ppc_num_fprs)
{
*isfloat = 1;
@@ -225,8 +222,7 @@ regmap (struct gdbarch *gdbarch, int regno, int *isfloat)
return CTR;
else if (regno == tdep->ppc_xer_regnum)
return XER;
- else if (tdep->ppc_fpscr_regnum >= 0
- && regno == tdep->ppc_fpscr_regnum)
+ else if (tdep->ppc_fpscr_regnum >= 0 && regno == tdep->ppc_fpscr_regnum)
return FPSCR;
else if (tdep->ppc_mq_regnum >= 0 && regno == tdep->ppc_mq_regnum)
return MQ;
@@ -242,7 +238,7 @@ rs6000_ptrace32 (int req, int id, int *addr, int data, int *buf)
#ifdef HAVE_PTRACE64
int ret = ptrace64 (req, id, (uintptr_t) addr, data, buf);
#else
- int ret = ptrace (req, id, (int *)addr, data, buf);
+ int ret = ptrace (req, id, (int *) addr, data, buf);
#endif
#if 0
printf ("rs6000_ptrace32 (%d, %d, 0x%x, %08x, 0x%x) = 0x%x\n",
@@ -257,11 +253,11 @@ static int
rs6000_ptrace64 (int req, int id, long long addr, int data, void *buf)
{
#ifdef ARCH3264
-# ifdef HAVE_PTRACE64
+#ifdef HAVE_PTRACE64
int ret = ptrace64 (req, id, addr, data, (PTRACE_TYPE_ARG5) buf);
-# else
+#else
int ret = ptracex (req, id, addr, data, (PTRACE_TYPE_ARG5) buf);
-# endif
+#endif
#else
int ret = 0;
#endif
@@ -272,18 +268,18 @@ rs6000_ptrace64 (int req, int id, long long addr, int data, void *buf)
return ret;
}
-void rs6000_nat_target::post_startup_inferior (ptid_t ptid)
+void
+rs6000_nat_target::post_startup_inferior (ptid_t ptid)
{
-
/* In AIX to turn on multi process debugging in ptrace
PT_MULTI is the option to be passed,
with the process ID which can fork () and
the data parameter [fourth parameter] must be 1. */
if (!ARCH64 ())
- rs6000_ptrace32 (PT_MULTI, ptid.pid(), 0, 1, 0);
+ rs6000_ptrace32 (PT_MULTI, ptid.pid (), 0, 1, 0);
else
- rs6000_ptrace64 (PT_MULTI, ptid.pid(), 0, 1, 0);
+ rs6000_ptrace64 (PT_MULTI, ptid.pid (), 0, 1, 0);
}
void
@@ -291,7 +287,6 @@ rs6000_nat_target::follow_fork (inferior *child_inf, ptid_t child_ptid,
target_waitkind fork_kind, bool follow_child,
bool detach_fork)
{
-
/* Once the fork event is detected the infrun.c code
calls the target_follow_fork to take care of
follow child and detach the child activity which is
@@ -305,12 +300,12 @@ rs6000_nat_target::follow_fork (inferior *child_inf, ptid_t child_ptid,
detach it. */
if (detach_fork && !follow_child)
- {
- if (ARCH64 ())
- rs6000_ptrace64 (PT_DETACH, child_ptid.pid (), 0, 0, 0);
- else
- rs6000_ptrace32 (PT_DETACH, child_ptid.pid (), 0, 0, 0);
- }
+ {
+ if (ARCH64 ())
+ rs6000_ptrace64 (PT_DETACH, child_ptid.pid (), 0, 0, 0);
+ else
+ rs6000_ptrace32 (PT_DETACH, child_ptid.pid (), 0, 0, 0);
+ }
}
/* Fetch register REGNO from the inferior. */
@@ -336,8 +331,7 @@ fetch_register (struct regcache *regcache, int regno)
else if (nr < 0)
{
if (regno >= gdbarch_num_regs (gdbarch))
- gdb_printf (gdb_stderr,
- "gdb error: register no %d not implemented.\n",
+ gdb_printf (gdb_stderr, "gdb error: register no %d not implemented.\n",
regno);
return;
}
@@ -398,8 +392,7 @@ store_register (struct regcache *regcache, int regno)
else if (nr < 0)
{
if (regno >= gdbarch_num_regs (gdbarch))
- gdb_printf (gdb_stderr,
- "gdb error: register no %d not implemented.\n",
+ gdb_printf (gdb_stderr, "gdb error: register no %d not implemented.\n",
regno);
}
@@ -426,7 +419,7 @@ store_register (struct regcache *regcache, int regno)
if (errno)
{
- perror (_("ptrace write"));
+ perror (_ ("ptrace write"));
errno = 0;
}
}
@@ -447,8 +440,7 @@ rs6000_nat_target::fetch_registers (struct regcache *regcache, int regno)
/* Read 32 general purpose registers. */
for (regno = tdep->ppc_gp0_regnum;
- regno < tdep->ppc_gp0_regnum + ppc_num_gprs;
- regno++)
+ regno < tdep->ppc_gp0_regnum + ppc_num_gprs; regno++)
{
fetch_register (regcache, regno);
}
@@ -489,8 +481,7 @@ rs6000_nat_target::store_registers (struct regcache *regcache, int regno)
/* Write general purpose registers first. */
for (regno = tdep->ppc_gp0_regnum;
- regno < tdep->ppc_gp0_regnum + ppc_num_gprs;
- regno++)
+ regno < tdep->ppc_gp0_regnum + ppc_num_gprs; regno++)
{
store_register (regcache, regno);
}
@@ -517,9 +508,8 @@ rs6000_nat_target::store_registers (struct regcache *regcache, int regno)
/* Implement the to_xfer_partial target_ops method. */
enum target_xfer_status
-rs6000_nat_target::xfer_partial (enum target_object object,
- const char *annex, gdb_byte *readbuf,
- const gdb_byte *writebuf,
+rs6000_nat_target::xfer_partial (enum target_object object, const char *annex,
+ gdb_byte *readbuf, const gdb_byte *writebuf,
ULONGEST offset, ULONGEST len,
ULONGEST *xfered_len)
{
@@ -529,9 +519,8 @@ rs6000_nat_target::xfer_partial (enum target_object object,
switch (object)
{
case TARGET_OBJECT_LIBRARIES_AIX:
- return xfer_shared_libraries (object, annex,
- readbuf, writebuf,
- offset, len, xfered_len);
+ return xfer_shared_libraries (object, annex, readbuf, writebuf, offset,
+ len, xfered_len);
case TARGET_OBJECT_MEMORY:
{
union
@@ -539,6 +528,7 @@ rs6000_nat_target::xfer_partial (enum target_object object,
PTRACE_TYPE_RET word;
gdb_byte byte[sizeof (PTRACE_TYPE_RET)];
} buffer;
+
ULONGEST rounded_offset;
LONGEST partial_len;
@@ -569,25 +559,25 @@ rs6000_nat_target::xfer_partial (enum target_object object,
buffer.word = rs6000_ptrace64 (PT_READ_I, pid,
rounded_offset, 0, NULL);
else
- buffer.word = rs6000_ptrace32 (PT_READ_I, pid,
- (int *) (uintptr_t)
- rounded_offset,
- 0, NULL);
+ buffer.word
+ = rs6000_ptrace32 (PT_READ_I, pid,
+ (int *) (uintptr_t) rounded_offset, 0,
+ NULL);
}
/* Copy data to be written over corresponding part of
buffer. */
- memcpy (buffer.byte + (offset - rounded_offset),
- writebuf, partial_len);
+ memcpy (buffer.byte + (offset - rounded_offset), writebuf,
+ partial_len);
errno = 0;
if (arch64)
- rs6000_ptrace64 (PT_WRITE_D, pid,
- rounded_offset, buffer.word, NULL);
+ rs6000_ptrace64 (PT_WRITE_D, pid, rounded_offset, buffer.word,
+ NULL);
else
rs6000_ptrace32 (PT_WRITE_D, pid,
- (int *) (uintptr_t) rounded_offset,
- buffer.word, NULL);
+ (int *) (uintptr_t) rounded_offset, buffer.word,
+ NULL);
if (errno)
return TARGET_XFER_EOF;
}
@@ -596,12 +586,13 @@ rs6000_nat_target::xfer_partial (enum target_object object,
{
errno = 0;
if (arch64)
- buffer.word = rs6000_ptrace64 (PT_READ_I, pid,
- rounded_offset, 0, NULL);
+ buffer.word
+ = rs6000_ptrace64 (PT_READ_I, pid, rounded_offset, 0, NULL);
else
- buffer.word = rs6000_ptrace32 (PT_READ_I, pid,
- (int *)(uintptr_t)rounded_offset,
- 0, NULL);
+ buffer.word
+ = rs6000_ptrace32 (PT_READ_I, pid,
+ (int *) (uintptr_t) rounded_offset, 0,
+ NULL);
if (errno)
return TARGET_XFER_EOF;
@@ -646,7 +637,7 @@ rs6000_nat_target::wait (ptid_t ptid, struct target_waitstatus *ourstatus,
if (pid == -1)
{
gdb_printf (gdb_stderr,
- _("Child process unexpectedly missing: %s.\n"),
+ _ ("Child process unexpectedly missing: %s.\n"),
safe_strerror (save_errno));
ourstatus->set_ignore ();
@@ -714,15 +705,14 @@ rs6000_nat_target::wait (ptid_t ptid, struct target_waitstatus *ourstatus,
return ptid_t (pid);
}
-
/* Set the current architecture from the host running GDB. Called when
starting a child process. */
void
rs6000_nat_target::create_inferior (const char *exec_file,
- const std::string &allargs,
- char **env, int from_tty)
+ const std::string &allargs, char **env,
+ int from_tty)
{
enum bfd_architecture arch;
unsigned long mach;
@@ -766,10 +756,9 @@ rs6000_nat_target::create_inferior (const char *exec_file,
info.abfd = current_program_space->exec_bfd ();
if (!gdbarch_update_p (info))
- internal_error (_("rs6000_create_inferior: failed "
- "to select architecture"));
+ internal_error (_ ("rs6000_create_inferior: failed "
+ "to select architecture"));
}
-
/* Shared Object support. */
@@ -789,14 +778,14 @@ rs6000_ptrace_ldinfo (ptid_t ptid)
rc = rs6000_ptrace64 (PT_LDINFO, pid, (unsigned long) ldi.data (),
ldi.size (), NULL);
else
- rc = rs6000_ptrace32 (PT_LDINFO, pid, (int *) ldi.data (),
- ldi.size (), NULL);
+ rc = rs6000_ptrace32 (PT_LDINFO, pid, (int *) ldi.data (), ldi.size (),
+ NULL);
if (rc != -1)
break; /* Success, we got the entire ld_info data. */
if (errno != ENOMEM)
- perror_with_name (_("ptrace ldinfo"));
+ perror_with_name (_ ("ptrace ldinfo"));
/* ldi is not big enough. Double it and try again. */
ldi.resize (ldi.size () * 2);
@@ -809,10 +798,11 @@ rs6000_ptrace_ldinfo (ptid_t ptid)
TARGET_OBJECT_LIBRARIES_AIX objects. */
enum target_xfer_status
-rs6000_nat_target::xfer_shared_libraries
- (enum target_object object,
- const char *annex, gdb_byte *readbuf, const gdb_byte *writebuf,
- ULONGEST offset, ULONGEST len, ULONGEST *xfered_len)
+rs6000_nat_target::xfer_shared_libraries (enum target_object object,
+ const char *annex, gdb_byte *readbuf,
+ const gdb_byte *writebuf,
+ ULONGEST offset, ULONGEST len,
+ ULONGEST *xfered_len)
{
ULONGEST result;
@@ -837,6 +827,7 @@ rs6000_nat_target::xfer_shared_libraries
}
void _initialize_rs6000_nat ();
+
void
_initialize_rs6000_nat ()
{
diff --git a/gdb/rs6000-aix-tdep.c b/gdb/rs6000-aix-tdep.c
index 2c610af1613..2d74efb940a 100644
--- a/gdb/rs6000-aix-tdep.c
+++ b/gdb/rs6000-aix-tdep.c
@@ -69,8 +69,7 @@
#define AIX_TEXT_SEGMENT_BASE 0x10000000
static struct trad_frame_cache *
-aix_sighandle_frame_cache (frame_info_ptr this_frame,
- void **this_cache)
+aix_sighandle_frame_cache (frame_info_ptr this_frame, void **this_cache)
{
LONGEST backchain;
CORE_ADDR base, base_orig, func;
@@ -85,31 +84,30 @@ aix_sighandle_frame_cache (frame_info_ptr this_frame,
this_trad_cache = trad_frame_cache_zalloc (this_frame);
(*this_cache) = this_trad_cache;
- base = get_frame_register_unsigned (this_frame,
- gdbarch_sp_regnum (gdbarch));
+ base = get_frame_register_unsigned (this_frame, gdbarch_sp_regnum (gdbarch));
base_orig = base;
if (tdep->wordsize == 4)
{
- func = read_memory_unsigned_integer (base_orig +
- SIG_FRAME_PC_OFFSET + 8,
+ func = read_memory_unsigned_integer (base_orig + SIG_FRAME_PC_OFFSET + 8,
tdep->wordsize, byte_order);
safe_read_memory_integer (base_orig + SIG_FRAME_FP_OFFSET + 8,
tdep->wordsize, byte_order, &backchain);
- base = (CORE_ADDR)backchain;
+ base = (CORE_ADDR) backchain;
}
else
{
- func = read_memory_unsigned_integer (base_orig +
- SIG_FRAME_LR_OFFSET64,
+ func = read_memory_unsigned_integer (base_orig + SIG_FRAME_LR_OFFSET64,
tdep->wordsize, byte_order);
safe_read_memory_integer (base_orig + SIG_FRAME_FP_OFFSET64,
tdep->wordsize, byte_order, &backchain);
- base = (CORE_ADDR)backchain;
+ base = (CORE_ADDR) backchain;
}
- trad_frame_set_reg_value (this_trad_cache, gdbarch_pc_regnum (gdbarch), func);
- trad_frame_set_reg_value (this_trad_cache, gdbarch_sp_regnum (gdbarch), base);
+ trad_frame_set_reg_value (this_trad_cache, gdbarch_pc_regnum (gdbarch),
+ func);
+ trad_frame_set_reg_value (this_trad_cache, gdbarch_sp_regnum (gdbarch),
+ base);
if (tdep->wordsize == 4)
trad_frame_set_reg_addr (this_trad_cache, tdep->ppc_lr_regnum,
@@ -157,59 +155,55 @@ aix_sighandle_frame_sniffer (const struct frame_unwind *self,
/* AIX signal handler frame unwinder */
-static const struct frame_unwind aix_sighandle_frame_unwind = {
- "rs6000 aix sighandle",
- SIGTRAMP_FRAME,
- default_frame_unwind_stop_reason,
- aix_sighandle_frame_this_id,
- aix_sighandle_frame_prev_register,
- NULL,
- aix_sighandle_frame_sniffer
-};
+static const struct frame_unwind aix_sighandle_frame_unwind
+ = { "rs6000 aix sighandle",
+ SIGTRAMP_FRAME,
+ default_frame_unwind_stop_reason,
+ aix_sighandle_frame_this_id,
+ aix_sighandle_frame_prev_register,
+ NULL,
+ aix_sighandle_frame_sniffer };
/* Core file support. */
-static struct ppc_reg_offsets rs6000_aix32_reg_offsets =
-{
+static struct ppc_reg_offsets rs6000_aix32_reg_offsets = {
/* General-purpose registers. */
208, /* r0_offset */
- 4, /* gpr_size */
- 4, /* xr_size */
- 24, /* pc_offset */
- 28, /* ps_offset */
- 32, /* cr_offset */
- 36, /* lr_offset */
- 40, /* ctr_offset */
- 44, /* xer_offset */
- 48, /* mq_offset */
+ 4, /* gpr_size */
+ 4, /* xr_size */
+ 24, /* pc_offset */
+ 28, /* ps_offset */
+ 32, /* cr_offset */
+ 36, /* lr_offset */
+ 40, /* ctr_offset */
+ 44, /* xer_offset */
+ 48, /* mq_offset */
/* Floating-point registers. */
336, /* f0_offset */
- 56, /* fpscr_offset */
- 4 /* fpscr_size */
+ 56, /* fpscr_offset */
+ 4 /* fpscr_size */
};
-static struct ppc_reg_offsets rs6000_aix64_reg_offsets =
-{
+static struct ppc_reg_offsets rs6000_aix64_reg_offsets = {
/* General-purpose registers. */
- 0, /* r0_offset */
- 8, /* gpr_size */
- 4, /* xr_size */
+ 0, /* r0_offset */
+ 8, /* gpr_size */
+ 4, /* xr_size */
264, /* pc_offset */
256, /* ps_offset */
288, /* cr_offset */
272, /* lr_offset */
280, /* ctr_offset */
292, /* xer_offset */
- -1, /* mq_offset */
+ -1, /* mq_offset */
/* Floating-point registers. */
312, /* f0_offset */
296, /* fpscr_offset */
- 4 /* fpscr_size */
+ 4 /* fpscr_size */
};
-
/* Supply register REGNUM in the general-purpose register set REGSET
from the buffer specified by GREGS and LEN to register cache
REGCACHE. If REGNUM is -1, do this for all registers in REGSET. */
@@ -239,15 +233,13 @@ rs6000_aix_collect_regset (const struct regset *regset,
/* AIX register set. */
-static const struct regset rs6000_aix32_regset =
-{
+static const struct regset rs6000_aix32_regset = {
&rs6000_aix32_reg_offsets,
rs6000_aix_supply_regset,
rs6000_aix_collect_regset,
};
-static const struct regset rs6000_aix64_regset =
-{
+static const struct regset rs6000_aix64_regset = {
&rs6000_aix64_reg_offsets,
rs6000_aix_supply_regset,
rs6000_aix_collect_regset,
@@ -268,7 +260,6 @@ rs6000_aix_iterate_over_regset_sections (struct gdbarch *gdbarch,
cb (".reg", 576, 576, &rs6000_aix64_regset, NULL, cb_data);
}
-
/* Pass the arguments in either registers, or in the stack. In RS/6000,
the first eight words of the argument list (that might be less than
eight parameters if some parameters occupy more than one word) are
@@ -296,10 +287,10 @@ rs6000_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
int ii;
int len = 0;
- int argno; /* current argument number */
- int argbytes; /* current argument byte */
+ int argno; /* current argument number */
+ int argbytes; /* current argument byte */
gdb_byte tmp_buffer[50];
- int f_argno = 0; /* current floating point argno */
+ int f_argno = 0; /* current floating point argno */
int wordsize = tdep->wordsize;
CORE_ADDR func_addr = find_function_addr (function, NULL);
@@ -328,7 +319,7 @@ rs6000_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
ii++;
}
-/* effectively indirect call... gcc does...
+ /* effectively indirect call... gcc does...
return_val example( float, int);
@@ -375,16 +366,13 @@ rs6000_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
if (len > reg_size)
{
-
/* Argument takes more than one register. */
while (argbytes < len)
{
gdb_byte word[PPC_MAX_REGISTER_SIZE];
memset (word, 0, reg_size);
- memcpy (word,
- ((char *) value_contents (arg).data ()) + argbytes,
- (len - argbytes) > reg_size
- ? reg_size : len - argbytes);
+ memcpy (word, ((char *) value_contents (arg).data ()) + argbytes,
+ (len - argbytes) > reg_size ? reg_size : len - argbytes);
regcache->cooked_write (tdep->ppc_gp0_regnum + 3 + ii, word);
++ii, argbytes += reg_size;
@@ -400,24 +388,23 @@ rs6000_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
gdb_byte word[PPC_MAX_REGISTER_SIZE];
memset (word, 0, reg_size);
- if (type->code () == TYPE_CODE_INT
- || type->code () == TYPE_CODE_ENUM
- || type->code () == TYPE_CODE_BOOL
- || type->code () == TYPE_CODE_CHAR)
+ if (type->code () == TYPE_CODE_INT || type->code () == TYPE_CODE_ENUM
+ || type->code () == TYPE_CODE_BOOL
+ || type->code () == TYPE_CODE_CHAR)
/* Sign or zero extend the "int" into a "word". */
- store_unsigned_integer (word, reg_size, byte_order,
- unpack_long (type, value_contents (arg).data ()));
+ store_unsigned_integer (
+ word, reg_size, byte_order,
+ unpack_long (type, value_contents (arg).data ()));
else
memcpy (word, value_contents (arg).data (), len);
- regcache->cooked_write (tdep->ppc_gp0_regnum + 3 +ii, word);
+ regcache->cooked_write (tdep->ppc_gp0_regnum + 3 + ii, word);
}
++argno;
}
ran_out_of_registers_for_arguments:
- regcache_cooked_read_unsigned (regcache,
- gdbarch_sp_regnum (gdbarch),
+ regcache_cooked_read_unsigned (regcache, gdbarch_sp_regnum (gdbarch),
&saved_sp);
/* Location for 8 parameters are always reserved. */
@@ -460,8 +447,7 @@ ran_out_of_registers_for_arguments:
to use this area. So, update %sp first before doing anything
else. */
- regcache_raw_write_signed (regcache,
- gdbarch_sp_regnum (gdbarch), sp);
+ regcache_raw_write_signed (regcache, gdbarch_sp_regnum (gdbarch), sp);
/* If the last argument copied into the registers didn't fit there
completely, push the rest of it into stack. */
@@ -478,17 +464,14 @@ ran_out_of_registers_for_arguments:
/* Push the rest of the arguments into stack. */
for (; argno < nargs; ++argno)
{
-
arg = args[argno];
type = check_typedef (value_type (arg));
len = type->length ();
-
/* Float types should be passed in fpr's, as well as in the
stack. */
if (type->code () == TYPE_CODE_FLT && f_argno < 13)
{
-
gdb_assert (len <= 8);
regcache->cooked_write (tdep->ppc_fp0_regnum + 1 + f_argno,
@@ -586,7 +569,7 @@ rs6000_return_value (struct gdbarch *gdbarch, struct value *function,
}
return RETURN_VALUE_REGISTER_CONVENTION;
- }
+ }
/* Values of the types int, long, short, pointer, and char (length
is less than or equal to four bytes), as well as bit values of
@@ -664,8 +647,7 @@ rs6000_return_value (struct gdbarch *gdbarch, struct value *function,
space and is therefore a special function pointer. */
static CORE_ADDR
-rs6000_convert_from_func_ptr_addr (struct gdbarch *gdbarch,
- CORE_ADDR addr,
+rs6000_convert_from_func_ptr_addr (struct gdbarch *gdbarch, CORE_ADDR addr,
struct target_ops *targ)
{
ppc_gdbarch_tdep *tdep = gdbarch_tdep<ppc_gdbarch_tdep> (gdbarch);
@@ -704,12 +686,11 @@ rs6000_convert_from_func_ptr_addr (struct gdbarch *gdbarch,
return addr;
}
-
/* Calculate the destination of a branch/jump. Return -1 if not a branch. */
static CORE_ADDR
-branch_dest (struct regcache *regcache, int opcode, int instr,
- CORE_ADDR pc, CORE_ADDR safety)
+branch_dest (struct regcache *regcache, int opcode, int instr, CORE_ADDR pc,
+ CORE_ADDR safety)
{
struct gdbarch *gdbarch = regcache->arch ();
ppc_gdbarch_tdep *tdep = gdbarch_tdep<ppc_gdbarch_tdep> (gdbarch);
@@ -724,7 +705,7 @@ branch_dest (struct regcache *regcache, int opcode, int instr,
switch (opcode)
{
case 18:
- immediate = ((instr & ~3) << 6) >> 6; /* br unconditional */
+ immediate = ((instr & ~3) << 6) >> 6; /* br unconditional */
if (absolute)
dest = immediate;
else
@@ -732,7 +713,7 @@ branch_dest (struct regcache *regcache, int opcode, int instr,
break;
case 16:
- immediate = ((instr & ~3) << 16) >> 16; /* br conditional */
+ immediate = ((instr & ~3) << 16) >> 16; /* br conditional */
if (absolute)
dest = immediate;
else
@@ -742,9 +723,10 @@ branch_dest (struct regcache *regcache, int opcode, int instr,
case 19:
ext_op = (instr >> 1) & 0x3ff;
- if (ext_op == 16) /* br conditional register */
+ if (ext_op == 16) /* br conditional register */
{
- dest = regcache_raw_get_unsigned (regcache, tdep->ppc_lr_regnum) & ~3;
+ dest
+ = regcache_raw_get_unsigned (regcache, tdep->ppc_lr_regnum) & ~3;
/* If we are about to return from a signal handler, dest is
something like 0x3c90. The current frame is a signal handler
@@ -754,23 +736,23 @@ branch_dest (struct regcache *regcache, int opcode, int instr,
{
frame_info_ptr frame = get_current_frame ();
- dest = read_memory_unsigned_integer
- (get_frame_base (frame) + SIG_FRAME_PC_OFFSET,
- tdep->wordsize, byte_order);
+ dest = read_memory_unsigned_integer (get_frame_base (frame)
+ + SIG_FRAME_PC_OFFSET,
+ tdep->wordsize, byte_order);
}
}
- else if (ext_op == 528) /* br cond to count reg */
+ else if (ext_op == 528) /* br cond to count reg */
{
- dest = regcache_raw_get_unsigned (regcache,
- tdep->ppc_ctr_regnum) & ~3;
+ dest
+ = regcache_raw_get_unsigned (regcache, tdep->ppc_ctr_regnum) & ~3;
/* If we are about to execute a system call, dest is something
like 0x22fc or 0x3b00. Upon completion the system call
will return to the address in the link register. */
if (dest < AIX_TEXT_SEGMENT_BASE)
- dest = regcache_raw_get_unsigned (regcache,
- tdep->ppc_lr_regnum) & ~3;
+ dest
+ = regcache_raw_get_unsigned (regcache, tdep->ppc_lr_regnum) & ~3;
}
else
return -1;
@@ -801,7 +783,7 @@ rs6000_software_single_step (struct regcache *regcache)
std::vector<CORE_ADDR> next_pcs = ppc_deal_with_atomic_sequence (regcache);
if (!next_pcs.empty ())
return next_pcs;
-
+
breaks[0] = loc + PPC_INSN_SIZE;
opcode = insn >> 26;
breaks[1] = branch_dest (regcache, opcode, insn, loc, breaks[0]);
@@ -819,7 +801,7 @@ rs6000_software_single_step (struct regcache *regcache)
next_pcs.push_back (breaks[ii]);
}
- errno = 0; /* FIXME, don't ignore errors! */
+ errno = 0; /* FIXME, don't ignore errors! */
/* What errors? {read,write}_memory call error(). */
return next_pcs;
}
@@ -888,15 +870,13 @@ struct ld_info_desc
#define __LDINFO_PTRACE64__
#include <sys/ldr.h>
-#define pinfo(type,member) \
- { \
- struct type ldi = {0}; \
- \
- printf (" {%d, %d},\t/* %s */\n", \
- offsetof (struct type, member), \
- sizeof (ldi.member), \
- #member); \
- } \
+#define pinfo(type, member) \
+ { \
+ struct type ldi = { 0 }; \
+ \
+ printf (" {%d, %d},\t/* %s */\n", offsetof (struct type, member), \
+ sizeof (ldi.member), #member); \
+ } \
while (0)
int
@@ -930,28 +910,26 @@ main (void)
/* Layout of the 32bit version of struct ld_info. */
-static const struct ld_info_desc ld_info32_desc =
-{
- {0, 4}, /* ldinfo_next */
- {4, 4}, /* ldinfo_fd */
- {8, 4}, /* ldinfo_textorg */
- {12, 4}, /* ldinfo_textsize */
- {16, 4}, /* ldinfo_dataorg */
- {20, 4}, /* ldinfo_datasize */
- {24, 2}, /* ldinfo_filename */
+static const struct ld_info_desc ld_info32_desc = {
+ { 0, 4 }, /* ldinfo_next */
+ { 4, 4 }, /* ldinfo_fd */
+ { 8, 4 }, /* ldinfo_textorg */
+ { 12, 4 }, /* ldinfo_textsize */
+ { 16, 4 }, /* ldinfo_dataorg */
+ { 20, 4 }, /* ldinfo_datasize */
+ { 24, 2 }, /* ldinfo_filename */
};
/* Layout of the 64bit version of struct ld_info. */
-static const struct ld_info_desc ld_info64_desc =
-{
- {0, 4}, /* ldinfo_next */
- {8, 4}, /* ldinfo_fd */
- {16, 8}, /* ldinfo_textorg */
- {24, 8}, /* ldinfo_textsize */
- {32, 8}, /* ldinfo_dataorg */
- {40, 8}, /* ldinfo_datasize */
- {48, 2}, /* ldinfo_filename */
+static const struct ld_info_desc ld_info64_desc = {
+ { 0, 4 }, /* ldinfo_next */
+ { 8, 4 }, /* ldinfo_fd */
+ { 16, 8 }, /* ldinfo_textorg */
+ { 24, 8 }, /* ldinfo_textsize */
+ { 32, 8 }, /* ldinfo_dataorg */
+ { 40, 8 }, /* ldinfo_datasize */
+ { 48, 2 }, /* ldinfo_filename */
};
/* A structured representation of one entry read from the ld_info
@@ -977,8 +955,7 @@ struct ld_info
while the struct ld_info object returned is in use. */
static struct ld_info
-rs6000_aix_extract_ld_info (struct gdbarch *gdbarch,
- const gdb_byte *ldi_buf)
+rs6000_aix_extract_ld_info (struct gdbarch *gdbarch, const gdb_byte *ldi_buf)
{
ppc_gdbarch_tdep *tdep = gdbarch_tdep<ppc_gdbarch_tdep> (gdbarch);
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
@@ -988,23 +965,19 @@ rs6000_aix_extract_ld_info (struct gdbarch *gdbarch,
struct ld_info info;
info.next = extract_unsigned_integer (ldi_buf + desc.ldinfo_next.offset,
- desc.ldinfo_next.size,
- byte_order);
+ desc.ldinfo_next.size, byte_order);
info.fd = extract_signed_integer (ldi_buf + desc.ldinfo_fd.offset,
- desc.ldinfo_fd.size,
- byte_order);
- info.textorg = extract_typed_address (ldi_buf + desc.ldinfo_textorg.offset,
- ptr_type);
+ desc.ldinfo_fd.size, byte_order);
+ info.textorg
+ = extract_typed_address (ldi_buf + desc.ldinfo_textorg.offset, ptr_type);
info.textsize
= extract_unsigned_integer (ldi_buf + desc.ldinfo_textsize.offset,
- desc.ldinfo_textsize.size,
- byte_order);
- info.dataorg = extract_typed_address (ldi_buf + desc.ldinfo_dataorg.offset,
- ptr_type);
+ desc.ldinfo_textsize.size, byte_order);
+ info.dataorg
+ = extract_typed_address (ldi_buf + desc.ldinfo_dataorg.offset, ptr_type);
info.datasize
= extract_unsigned_integer (ldi_buf + desc.ldinfo_datasize.offset,
- desc.ldinfo_datasize.size,
- byte_order);
+ desc.ldinfo_datasize.size, byte_order);
info.filename = (char *) ldi_buf + desc.ldinfo_filename.offset;
info.member_name = info.filename + strlen (info.filename) + 1;
@@ -1016,8 +989,7 @@ rs6000_aix_extract_ld_info (struct gdbarch *gdbarch,
format. */
static void
-rs6000_aix_shared_library_to_xml (struct ld_info *ldi,
- struct obstack *obstack)
+rs6000_aix_shared_library_to_xml (struct ld_info *ldi, struct obstack *obstack)
{
obstack_grow_str (obstack, "<library name=\"");
std::string p = xml_escape_text (ldi->filename);
@@ -1096,7 +1068,7 @@ rs6000_aix_ld_info_to_xml (struct gdbarch *gdbarch, const gdb_byte *ldi_buf,
buf = (const char *) obstack_finish (&obstack);
len_avail = strlen (buf);
if (offset >= len_avail)
- len= 0;
+ len = 0;
else
{
if (len > len_avail - offset)
@@ -1112,8 +1084,7 @@ rs6000_aix_ld_info_to_xml (struct gdbarch *gdbarch, const gdb_byte *ldi_buf,
static ULONGEST
rs6000_aix_core_xfer_shared_libraries_aix (struct gdbarch *gdbarch,
- gdb_byte *readbuf,
- ULONGEST offset,
+ gdb_byte *readbuf, ULONGEST offset,
ULONGEST len)
{
struct bfd_section *ldinfo_sec;
@@ -1121,16 +1092,16 @@ rs6000_aix_core_xfer_shared_libraries_aix (struct gdbarch *gdbarch,
ldinfo_sec = bfd_get_section_by_name (core_bfd, ".ldinfo");
if (ldinfo_sec == NULL)
- error (_("cannot find .ldinfo section from core file: %s"),
+ error (_ ("cannot find .ldinfo section from core file: %s"),
bfd_errmsg (bfd_get_error ()));
ldinfo_size = bfd_section_size (ldinfo_sec);
gdb::byte_vector ldinfo_buf (ldinfo_size);
- if (! bfd_get_section_contents (core_bfd, ldinfo_sec,
- ldinfo_buf.data (), 0, ldinfo_size))
- error (_("unable to read .ldinfo section from core file: %s"),
- bfd_errmsg (bfd_get_error ()));
+ if (!bfd_get_section_contents (core_bfd, ldinfo_sec, ldinfo_buf.data (), 0,
+ ldinfo_size))
+ error (_ ("unable to read .ldinfo section from core file: %s"),
+ bfd_errmsg (bfd_get_error ()));
return rs6000_aix_ld_info_to_xml (gdbarch, ldinfo_buf.data (), readbuf,
offset, len, 0);
@@ -1158,14 +1129,14 @@ rs6000_aix_init_osabi (struct gdbarch_info info, struct gdbarch *gdbarch)
/* Handle RS/6000 function pointers (which are really function
descriptors). */
- set_gdbarch_convert_from_func_ptr_addr
- (gdbarch, rs6000_convert_from_func_ptr_addr);
+ set_gdbarch_convert_from_func_ptr_addr (gdbarch,
+ rs6000_convert_from_func_ptr_addr);
/* Core file support. */
- set_gdbarch_iterate_over_regset_sections
- (gdbarch, rs6000_aix_iterate_over_regset_sections);
- set_gdbarch_core_xfer_shared_libraries_aix
- (gdbarch, rs6000_aix_core_xfer_shared_libraries_aix);
+ set_gdbarch_iterate_over_regset_sections (
+ gdbarch, rs6000_aix_iterate_over_regset_sections);
+ set_gdbarch_core_xfer_shared_libraries_aix (
+ gdbarch, rs6000_aix_core_xfer_shared_libraries_aix);
if (tdep->wordsize == 8)
tdep->lr_frame_offset = 16;
@@ -1193,14 +1164,13 @@ rs6000_aix_init_osabi (struct gdbarch_info info, struct gdbarch *gdbarch)
}
void _initialize_rs6000_aix_tdep ();
+
void
_initialize_rs6000_aix_tdep ()
{
- gdbarch_register_osabi_sniffer (bfd_arch_rs6000,
- bfd_target_xcoff_flavour,
+ gdbarch_register_osabi_sniffer (bfd_arch_rs6000, bfd_target_xcoff_flavour,
rs6000_aix_osabi_sniffer);
- gdbarch_register_osabi_sniffer (bfd_arch_powerpc,
- bfd_target_xcoff_flavour,
+ gdbarch_register_osabi_sniffer (bfd_arch_powerpc, bfd_target_xcoff_flavour,
rs6000_aix_osabi_sniffer);
gdbarch_register_osabi (bfd_arch_rs6000, 0, GDB_OSABI_AIX,
@@ -1208,4 +1178,3 @@ _initialize_rs6000_aix_tdep ()
gdbarch_register_osabi (bfd_arch_powerpc, 0, GDB_OSABI_AIX,
rs6000_aix_init_osabi);
}
-
diff --git a/gdb/rs6000-aix-tdep.h b/gdb/rs6000-aix-tdep.h
index de9fa12d609..666d7085dfd 100644
--- a/gdb/rs6000-aix-tdep.h
+++ b/gdb/rs6000-aix-tdep.h
@@ -20,9 +20,7 @@
extern ULONGEST rs6000_aix_ld_info_to_xml (struct gdbarch *gdbarch,
const gdb_byte *ldi_buf,
- gdb_byte *readbuf,
- ULONGEST offset,
- ULONGEST len,
- int close_ldinfo_fd);
+ gdb_byte *readbuf, ULONGEST offset,
+ ULONGEST len, int close_ldinfo_fd);
#endif /* RS6000_AIX_TDEP_H */
diff --git a/gdb/rs6000-lynx178-tdep.c b/gdb/rs6000-lynx178-tdep.c
index 042e6e60d91..9cf087956cb 100644
--- a/gdb/rs6000-lynx178-tdep.c
+++ b/gdb/rs6000-lynx178-tdep.c
@@ -40,10 +40,10 @@ rs6000_lynx178_push_dummy_call (struct gdbarch *gdbarch,
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
int ii;
int len = 0;
- int argno; /* current argument number */
- int argbytes; /* current argument byte */
+ int argno; /* current argument number */
+ int argbytes; /* current argument byte */
gdb_byte tmp_buffer[50];
- int f_argno = 0; /* current floating point argno */
+ int f_argno = 0; /* current floating point argno */
int wordsize = tdep->wordsize;
struct value *arg = 0;
@@ -98,7 +98,6 @@ rs6000_lynx178_push_dummy_call (struct gdbarch *gdbarch,
if (type->code () == TYPE_CODE_FLT)
{
-
/* Floating point arguments are passed in fpr's, as well as gpr's.
There are 13 fpr's reserved for passing parameters. At this point
there is no way we would run out of them.
@@ -119,16 +118,13 @@ rs6000_lynx178_push_dummy_call (struct gdbarch *gdbarch,
if (len > reg_size)
{
-
/* Argument takes more than one register. */
while (argbytes < len)
{
gdb_byte word[PPC_MAX_REGISTER_SIZE];
memset (word, 0, reg_size);
- memcpy (word,
- ((char *) value_contents (arg).data ()) + argbytes,
- (len - argbytes) > reg_size
- ? reg_size : len - argbytes);
+ memcpy (word, ((char *) value_contents (arg).data ()) + argbytes,
+ (len - argbytes) > reg_size ? reg_size : len - argbytes);
regcache->cooked_write (tdep->ppc_gp0_regnum + 3 + ii, word);
++ii, argbytes += reg_size;
@@ -145,15 +141,14 @@ rs6000_lynx178_push_dummy_call (struct gdbarch *gdbarch,
memset (word, 0, reg_size);
memcpy (word, value_contents (arg).data (), len);
- regcache->cooked_write (tdep->ppc_gp0_regnum + 3 +ii, word);
+ regcache->cooked_write (tdep->ppc_gp0_regnum + 3 + ii, word);
}
++argno;
}
ran_out_of_registers_for_arguments:
- regcache_cooked_read_unsigned (regcache,
- gdbarch_sp_regnum (gdbarch),
+ regcache_cooked_read_unsigned (regcache, gdbarch_sp_regnum (gdbarch),
&saved_sp);
/* Location for 8 parameters are always reserved. */
@@ -197,8 +192,7 @@ ran_out_of_registers_for_arguments:
to use this area. So, update %sp first before doing anything
else. */
- regcache_raw_write_signed (regcache,
- gdbarch_sp_regnum (gdbarch), sp);
+ regcache_raw_write_signed (regcache, gdbarch_sp_regnum (gdbarch), sp);
/* If the last argument copied into the registers didn't fit there
completely, push the rest of it into stack. */
@@ -215,17 +209,14 @@ ran_out_of_registers_for_arguments:
/* Push the rest of the arguments into stack. */
for (; argno < nargs; ++argno)
{
-
arg = args[argno];
type = check_typedef (value_type (arg));
len = type->length ();
-
/* Float types should be passed in fpr's, as well as in the
stack. */
if (type->code () == TYPE_CODE_FLT && f_argno < 13)
{
-
gdb_assert (len <= 8);
regcache->cooked_write (tdep->ppc_fp0_regnum + 1 + f_argno,
@@ -321,7 +312,7 @@ rs6000_lynx178_return_value (struct gdbarch *gdbarch, struct value *function,
}
return RETURN_VALUE_REGISTER_CONVENTION;
- }
+ }
/* Values of the types int, long, short, pointer, and char (length
is less than or equal to four bytes), as well as bit values of
@@ -408,13 +399,12 @@ rs6000_lynx178_init_osabi (struct gdbarch_info info, struct gdbarch *gdbarch)
}
void _initialize_rs6000_lynx178_tdep ();
+
void
_initialize_rs6000_lynx178_tdep ()
{
- gdbarch_register_osabi_sniffer (bfd_arch_rs6000,
- bfd_target_xcoff_flavour,
+ gdbarch_register_osabi_sniffer (bfd_arch_rs6000, bfd_target_xcoff_flavour,
rs6000_lynx178_osabi_sniffer);
gdbarch_register_osabi (bfd_arch_rs6000, 0, GDB_OSABI_LYNXOS178,
rs6000_lynx178_init_osabi);
}
-
diff --git a/gdb/rs6000-tdep.c b/gdb/rs6000-tdep.c
index 592b447948e..03792ecfa71 100644
--- a/gdb/rs6000-tdep.c
+++ b/gdb/rs6000-tdep.c
@@ -43,8 +43,8 @@
#include "record-full.h"
#include "auxv.h"
-#include "coff/internal.h" /* for libcoff.h */
-#include "libcoff.h" /* for xcoff_data */
+#include "coff/internal.h" /* for libcoff.h */
+#include "libcoff.h" /* for xcoff_data */
#include "coff/xcoff.h"
#include "libxcoff.h"
@@ -87,47 +87,47 @@
#include "features/rs6000/rs6000.c"
/* Determine if regnum is an SPE pseudo-register. */
-#define IS_SPE_PSEUDOREG(tdep, regnum) ((tdep)->ppc_ev0_regnum >= 0 \
- && (regnum) >= (tdep)->ppc_ev0_regnum \
- && (regnum) < (tdep)->ppc_ev0_regnum + 32)
+#define IS_SPE_PSEUDOREG(tdep, regnum) \
+ ((tdep)->ppc_ev0_regnum >= 0 && (regnum) >= (tdep)->ppc_ev0_regnum \
+ && (regnum) < (tdep)->ppc_ev0_regnum + 32)
/* Determine if regnum is a decimal float pseudo-register. */
-#define IS_DFP_PSEUDOREG(tdep, regnum) ((tdep)->ppc_dl0_regnum >= 0 \
- && (regnum) >= (tdep)->ppc_dl0_regnum \
- && (regnum) < (tdep)->ppc_dl0_regnum + 16)
+#define IS_DFP_PSEUDOREG(tdep, regnum) \
+ ((tdep)->ppc_dl0_regnum >= 0 && (regnum) >= (tdep)->ppc_dl0_regnum \
+ && (regnum) < (tdep)->ppc_dl0_regnum + 16)
/* Determine if regnum is a "vX" alias for the raw "vrX" vector
registers. */
-#define IS_V_ALIAS_PSEUDOREG(tdep, regnum) (\
- (tdep)->ppc_v0_alias_regnum >= 0 \
- && (regnum) >= (tdep)->ppc_v0_alias_regnum \
- && (regnum) < (tdep)->ppc_v0_alias_regnum + ppc_num_vrs)
+#define IS_V_ALIAS_PSEUDOREG(tdep, regnum) \
+ ((tdep)->ppc_v0_alias_regnum >= 0 \
+ && (regnum) >= (tdep)->ppc_v0_alias_regnum \
+ && (regnum) < (tdep)->ppc_v0_alias_regnum + ppc_num_vrs)
/* Determine if regnum is a POWER7 VSX register. */
-#define IS_VSX_PSEUDOREG(tdep, regnum) ((tdep)->ppc_vsr0_regnum >= 0 \
- && (regnum) >= (tdep)->ppc_vsr0_regnum \
- && (regnum) < (tdep)->ppc_vsr0_regnum + ppc_num_vsrs)
+#define IS_VSX_PSEUDOREG(tdep, regnum) \
+ ((tdep)->ppc_vsr0_regnum >= 0 && (regnum) >= (tdep)->ppc_vsr0_regnum \
+ && (regnum) < (tdep)->ppc_vsr0_regnum + ppc_num_vsrs)
/* Determine if regnum is a POWER7 Extended FP register. */
-#define IS_EFP_PSEUDOREG(tdep, regnum) ((tdep)->ppc_efpr0_regnum >= 0 \
- && (regnum) >= (tdep)->ppc_efpr0_regnum \
- && (regnum) < (tdep)->ppc_efpr0_regnum + ppc_num_efprs)
+#define IS_EFP_PSEUDOREG(tdep, regnum) \
+ ((tdep)->ppc_efpr0_regnum >= 0 && (regnum) >= (tdep)->ppc_efpr0_regnum \
+ && (regnum) < (tdep)->ppc_efpr0_regnum + ppc_num_efprs)
/* Determine if regnum is a checkpointed decimal float
pseudo-register. */
-#define IS_CDFP_PSEUDOREG(tdep, regnum) ((tdep)->ppc_cdl0_regnum >= 0 \
- && (regnum) >= (tdep)->ppc_cdl0_regnum \
- && (regnum) < (tdep)->ppc_cdl0_regnum + 16)
+#define IS_CDFP_PSEUDOREG(tdep, regnum) \
+ ((tdep)->ppc_cdl0_regnum >= 0 && (regnum) >= (tdep)->ppc_cdl0_regnum \
+ && (regnum) < (tdep)->ppc_cdl0_regnum + 16)
/* Determine if regnum is a Checkpointed POWER7 VSX register. */
-#define IS_CVSX_PSEUDOREG(tdep, regnum) ((tdep)->ppc_cvsr0_regnum >= 0 \
- && (regnum) >= (tdep)->ppc_cvsr0_regnum \
- && (regnum) < (tdep)->ppc_cvsr0_regnum + ppc_num_vsrs)
+#define IS_CVSX_PSEUDOREG(tdep, regnum) \
+ ((tdep)->ppc_cvsr0_regnum >= 0 && (regnum) >= (tdep)->ppc_cvsr0_regnum \
+ && (regnum) < (tdep)->ppc_cvsr0_regnum + ppc_num_vsrs)
/* Determine if regnum is a Checkpointed POWER7 Extended FP register. */
-#define IS_CEFP_PSEUDOREG(tdep, regnum) ((tdep)->ppc_cefpr0_regnum >= 0 \
- && (regnum) >= (tdep)->ppc_cefpr0_regnum \
- && (regnum) < (tdep)->ppc_cefpr0_regnum + ppc_num_efprs)
+#define IS_CEFP_PSEUDOREG(tdep, regnum) \
+ ((tdep)->ppc_cefpr0_regnum >= 0 && (regnum) >= (tdep)->ppc_cefpr0_regnum \
+ && (regnum) < (tdep)->ppc_cefpr0_regnum + ppc_num_efprs)
/* Holds the current set of options to be passed to the disassembler. */
static char *powerpc_disassembler_options;
@@ -140,14 +140,8 @@ static struct cmd_list_element *showpowerpccmdlist = NULL;
static enum auto_boolean powerpc_soft_float_global = AUTO_BOOLEAN_AUTO;
/* The vector ABI to use. Keep this in sync with powerpc_vector_abi. */
-static const char *const powerpc_vector_strings[] =
-{
- "auto",
- "generic",
- "altivec",
- "spe",
- NULL
-};
+static const char *const powerpc_vector_strings[]
+ = { "auto", "generic", "altivec", "spe", NULL };
/* A variable that can be configured by the user. */
static enum powerpc_vector_abi powerpc_vector_abi_global = POWERPC_VEC_AUTO;
@@ -173,29 +167,28 @@ get_ppc_per_inferior (inferior *inf)
/* To be used by skip_prologue. */
struct rs6000_framedata
- {
- int offset; /* total size of frame --- the distance
+{
+ int offset; /* total size of frame --- the distance
by which we decrement sp to allocate
the frame */
- int saved_gpr; /* smallest # of saved gpr */
- unsigned int gpr_mask; /* Each bit is an individual saved GPR. */
- int saved_fpr; /* smallest # of saved fpr */
- int saved_vr; /* smallest # of saved vr */
- int saved_ev; /* smallest # of saved ev */
- int alloca_reg; /* alloca register number (frame ptr) */
- char frameless; /* true if frameless functions. */
- char nosavedpc; /* true if pc not saved. */
- char used_bl; /* true if link register clobbered */
- int gpr_offset; /* offset of saved gprs from prev sp */
- int fpr_offset; /* offset of saved fprs from prev sp */
- int vr_offset; /* offset of saved vrs from prev sp */
- int ev_offset; /* offset of saved evs from prev sp */
- int lr_offset; /* offset of saved lr */
- int lr_register; /* register of saved lr, if trustworthy */
- int cr_offset; /* offset of saved cr */
- int vrsave_offset; /* offset of saved vrsave register */
- };
-
+ int saved_gpr; /* smallest # of saved gpr */
+ unsigned int gpr_mask; /* Each bit is an individual saved GPR. */
+ int saved_fpr; /* smallest # of saved fpr */
+ int saved_vr; /* smallest # of saved vr */
+ int saved_ev; /* smallest # of saved ev */
+ int alloca_reg; /* alloca register number (frame ptr) */
+ char frameless; /* true if frameless functions. */
+ char nosavedpc; /* true if pc not saved. */
+ char used_bl; /* true if link register clobbered */
+ int gpr_offset; /* offset of saved gprs from prev sp */
+ int fpr_offset; /* offset of saved fprs from prev sp */
+ int vr_offset; /* offset of saved vrs from prev sp */
+ int ev_offset; /* offset of saved evs from prev sp */
+ int lr_offset; /* offset of saved lr */
+ int lr_register; /* register of saved lr, if trustworthy */
+ int cr_offset; /* offset of saved cr */
+ int vrsave_offset; /* offset of saved vrsave register */
+};
/* Is REGNO a VSX register? Return 1 if so, 0 otherwise. */
int
@@ -205,8 +198,8 @@ vsx_register_p (struct gdbarch *gdbarch, int regno)
if (tdep->ppc_vsr0_regnum < 0)
return 0;
else
- return (regno >= tdep->ppc_vsr0_upper_regnum && regno
- <= tdep->ppc_vsr0_upper_regnum + 31);
+ return (regno >= tdep->ppc_vsr0_upper_regnum
+ && regno <= tdep->ppc_vsr0_upper_regnum + 31);
}
/* Is REGNO an AltiVec register? Return 1 if so, 0 otherwise. */
@@ -220,38 +213,33 @@ altivec_register_p (struct gdbarch *gdbarch, int regno)
return (regno >= tdep->ppc_vr0_regnum && regno <= tdep->ppc_vrsave_regnum);
}
-
/* Return true if REGNO is an SPE register, false otherwise. */
int
spe_register_p (struct gdbarch *gdbarch, int regno)
{
ppc_gdbarch_tdep *tdep = gdbarch_tdep<ppc_gdbarch_tdep> (gdbarch);
-
+
/* Is it a reference to EV0 -- EV31, and do we have those? */
if (IS_SPE_PSEUDOREG (tdep, regno))
return 1;
/* Is it a reference to one of the raw upper GPR halves? */
- if (tdep->ppc_ev0_upper_regnum >= 0
- && tdep->ppc_ev0_upper_regnum <= regno
+ if (tdep->ppc_ev0_upper_regnum >= 0 && tdep->ppc_ev0_upper_regnum <= regno
&& regno < tdep->ppc_ev0_upper_regnum + ppc_num_gprs)
return 1;
/* Is it a reference to the 64-bit accumulator, and do we have that? */
- if (tdep->ppc_acc_regnum >= 0
- && tdep->ppc_acc_regnum == regno)
+ if (tdep->ppc_acc_regnum >= 0 && tdep->ppc_acc_regnum == regno)
return 1;
/* Is it a reference to the SPE floating-point status and control register,
and do we have that? */
- if (tdep->ppc_spefscr_regnum >= 0
- && tdep->ppc_spefscr_regnum == regno)
+ if (tdep->ppc_spefscr_regnum >= 0 && tdep->ppc_spefscr_regnum == regno)
return 1;
return 0;
}
-
/* Return non-zero if the architecture described by GDBARCH has
floating-point registers (f0 --- f31 and fpscr). */
int
@@ -259,8 +247,7 @@ ppc_floating_point_unit_p (struct gdbarch *gdbarch)
{
ppc_gdbarch_tdep *tdep = gdbarch_tdep<ppc_gdbarch_tdep> (gdbarch);
- return (tdep->ppc_fp0_regnum >= 0
- && tdep->ppc_fpscr_regnum >= 0);
+ return (tdep->ppc_fp0_regnum >= 0 && tdep->ppc_fpscr_regnum >= 0);
}
/* Return non-zero if the architecture described by GDBARCH has
@@ -270,8 +257,7 @@ ppc_altivec_support_p (struct gdbarch *gdbarch)
{
ppc_gdbarch_tdep *tdep = gdbarch_tdep<ppc_gdbarch_tdep> (gdbarch);
- return (tdep->ppc_vr0_regnum >= 0
- && tdep->ppc_vrsave_regnum >= 0);
+ return (tdep->ppc_vr0_regnum >= 0 && tdep->ppc_vrsave_regnum >= 0);
}
/* Check that TABLE[GDB_REGNO] is not already initialized, and then
@@ -290,7 +276,6 @@ set_sim_regno (int *table, int gdb_regno, int sim_regno)
table[gdb_regno] = sim_regno;
}
-
/* Initialize ARCH->tdep->sim_regno, the table mapping GDB register
numbers to simulator register numbers, based on the values placed
in the ARCH->tdep->ppc_foo_regnum members. */
@@ -301,10 +286,9 @@ init_sim_regno_table (struct gdbarch *arch)
int total_regs = gdbarch_num_regs (arch);
int *sim_regno = GDBARCH_OBSTACK_CALLOC (arch, total_regs, int);
int i;
- static const char *const segment_regs[] = {
- "sr0", "sr1", "sr2", "sr3", "sr4", "sr5", "sr6", "sr7",
- "sr8", "sr9", "sr10", "sr11", "sr12", "sr13", "sr14", "sr15"
- };
+ static const char *const segment_regs[]
+ = { "sr0", "sr1", "sr2", "sr3", "sr4", "sr5", "sr6", "sr7",
+ "sr8", "sr9", "sr10", "sr11", "sr12", "sr13", "sr14", "sr15" };
/* Presume that all registers not explicitly mentioned below are
unavailable from the sim. */
@@ -314,12 +298,11 @@ init_sim_regno_table (struct gdbarch *arch)
/* General-purpose registers. */
for (i = 0; i < ppc_num_gprs; i++)
set_sim_regno (sim_regno, tdep->ppc_gp0_regnum + i, sim_ppc_r0_regnum + i);
-
+
/* Floating-point registers. */
if (tdep->ppc_fp0_regnum >= 0)
for (i = 0; i < ppc_num_fprs; i++)
- set_sim_regno (sim_regno,
- tdep->ppc_fp0_regnum + i,
+ set_sim_regno (sim_regno, tdep->ppc_fp0_regnum + i,
sim_ppc_f0_regnum + i);
if (tdep->ppc_fpscr_regnum >= 0)
set_sim_regno (sim_regno, tdep->ppc_fpscr_regnum, sim_ppc_fpscr_regnum);
@@ -342,14 +325,12 @@ init_sim_regno_table (struct gdbarch *arch)
if (tdep->ppc_vr0_regnum >= 0)
{
for (i = 0; i < ppc_num_vrs; i++)
- set_sim_regno (sim_regno,
- tdep->ppc_vr0_regnum + i,
+ set_sim_regno (sim_regno, tdep->ppc_vr0_regnum + i,
sim_ppc_vr0_regnum + i);
/* FIXME: jimb/2004-07-15: when we have tdep->ppc_vscr_regnum,
we can treat this more like the other cases. */
- set_sim_regno (sim_regno,
- tdep->ppc_vr0_regnum + ppc_num_vrs,
+ set_sim_regno (sim_regno, tdep->ppc_vr0_regnum + ppc_num_vrs,
sim_ppc_vscr_regnum);
}
/* vsave is a special-purpose register, so the code below handles it. */
@@ -357,12 +338,11 @@ init_sim_regno_table (struct gdbarch *arch)
/* SPE APU (E500) registers. */
if (tdep->ppc_ev0_upper_regnum >= 0)
for (i = 0; i < ppc_num_gprs; i++)
- set_sim_regno (sim_regno,
- tdep->ppc_ev0_upper_regnum + i,
+ set_sim_regno (sim_regno, tdep->ppc_ev0_upper_regnum + i,
sim_ppc_rh0_regnum + i);
if (tdep->ppc_acc_regnum >= 0)
set_sim_regno (sim_regno, tdep->ppc_acc_regnum, sim_ppc_acc_regnum);
- /* spefscr is a special-purpose register, so the code below handles it. */
+ /* spefscr is a special-purpose register, so the code below handles it. */
#ifdef WITH_PPC_SIM
/* Now handle all special-purpose registers. Verify that they
@@ -385,7 +365,6 @@ init_sim_regno_table (struct gdbarch *arch)
tdep->sim_regno = sim_regno;
}
-
/* Given a GDB register number REG, return the corresponding SIM
register number. */
static int
@@ -406,16 +385,14 @@ rs6000_register_sim_regno (struct gdbarch *gdbarch, int reg)
return LEGACY_SIM_REGNO_IGNORE;
}
-
-
/* Register set support functions. */
/* REGS + OFFSET contains register REGNUM in a field REGSIZE wide.
Write the register to REGCACHE. */
void
-ppc_supply_reg (struct regcache *regcache, int regnum,
- const gdb_byte *regs, size_t offset, int regsize)
+ppc_supply_reg (struct regcache *regcache, int regnum, const gdb_byte *regs,
+ size_t offset, int regsize)
{
if (regnum != -1 && offset != -1)
{
@@ -435,8 +412,8 @@ ppc_supply_reg (struct regcache *regcache, int regnum,
in a field REGSIZE wide. Zero pad as necessary. */
void
-ppc_collect_reg (const struct regcache *regcache, int regnum,
- gdb_byte *regs, size_t offset, int regsize)
+ppc_collect_reg (const struct regcache *regcache, int regnum, gdb_byte *regs,
+ size_t offset, int regsize)
{
if (regnum != -1 && offset != -1)
{
@@ -459,12 +436,10 @@ ppc_collect_reg (const struct regcache *regcache, int regnum,
regcache->raw_collect (regnum, regs + offset);
}
}
-
+
static int
-ppc_greg_offset (struct gdbarch *gdbarch,
- ppc_gdbarch_tdep *tdep,
- const struct ppc_reg_offsets *offsets,
- int regnum,
+ppc_greg_offset (struct gdbarch *gdbarch, ppc_gdbarch_tdep *tdep,
+ const struct ppc_reg_offsets *offsets, int regnum,
int *regsize)
{
*regsize = offsets->gpr_size;
@@ -500,8 +475,7 @@ ppc_greg_offset (struct gdbarch *gdbarch,
static int
ppc_fpreg_offset (ppc_gdbarch_tdep *tdep,
- const struct ppc_reg_offsets *offsets,
- int regnum)
+ const struct ppc_reg_offsets *offsets, int regnum)
{
if (regnum >= tdep->ppc_fp0_regnum
&& regnum < tdep->ppc_fp0_regnum + ppc_num_fprs)
@@ -534,28 +508,24 @@ ppc_supply_gregset (const struct regset *regset, struct regcache *regcache,
int gpr_size = offsets->gpr_size;
for (i = tdep->ppc_gp0_regnum, offset = offsets->r0_offset;
- i < tdep->ppc_gp0_regnum + ppc_num_gprs;
- i++, offset += gpr_size)
+ i < tdep->ppc_gp0_regnum + ppc_num_gprs; i++, offset += gpr_size)
ppc_supply_reg (regcache, i, (const gdb_byte *) gregs, offset,
gpr_size);
ppc_supply_reg (regcache, gdbarch_pc_regnum (gdbarch),
(const gdb_byte *) gregs, offsets->pc_offset, gpr_size);
- ppc_supply_reg (regcache, tdep->ppc_ps_regnum,
- (const gdb_byte *) gregs, offsets->ps_offset, gpr_size);
- ppc_supply_reg (regcache, tdep->ppc_lr_regnum,
- (const gdb_byte *) gregs, offsets->lr_offset, gpr_size);
- ppc_supply_reg (regcache, tdep->ppc_ctr_regnum,
- (const gdb_byte *) gregs, offsets->ctr_offset, gpr_size);
- ppc_supply_reg (regcache, tdep->ppc_cr_regnum,
- (const gdb_byte *) gregs, offsets->cr_offset,
- offsets->xr_size);
- ppc_supply_reg (regcache, tdep->ppc_xer_regnum,
- (const gdb_byte *) gregs, offsets->xer_offset,
- offsets->xr_size);
- ppc_supply_reg (regcache, tdep->ppc_mq_regnum,
- (const gdb_byte *) gregs, offsets->mq_offset,
- offsets->xr_size);
+ ppc_supply_reg (regcache, tdep->ppc_ps_regnum, (const gdb_byte *) gregs,
+ offsets->ps_offset, gpr_size);
+ ppc_supply_reg (regcache, tdep->ppc_lr_regnum, (const gdb_byte *) gregs,
+ offsets->lr_offset, gpr_size);
+ ppc_supply_reg (regcache, tdep->ppc_ctr_regnum, (const gdb_byte *) gregs,
+ offsets->ctr_offset, gpr_size);
+ ppc_supply_reg (regcache, tdep->ppc_cr_regnum, (const gdb_byte *) gregs,
+ offsets->cr_offset, offsets->xr_size);
+ ppc_supply_reg (regcache, tdep->ppc_xer_regnum, (const gdb_byte *) gregs,
+ offsets->xer_offset, offsets->xr_size);
+ ppc_supply_reg (regcache, tdep->ppc_mq_regnum, (const gdb_byte *) gregs,
+ offsets->mq_offset, offsets->xr_size);
return;
}
@@ -585,8 +555,7 @@ ppc_supply_fpregset (const struct regset *regset, struct regcache *regcache,
int i;
for (i = tdep->ppc_fp0_regnum, offset = offsets->f0_offset;
- i < tdep->ppc_fp0_regnum + ppc_num_fprs;
- i++, offset += 8)
+ i < tdep->ppc_fp0_regnum + ppc_num_fprs; i++, offset += 8)
ppc_supply_reg (regcache, i, (const gdb_byte *) fpregs, offset, 8);
ppc_supply_reg (regcache, tdep->ppc_fpscr_regnum,
@@ -607,8 +576,8 @@ ppc_supply_fpregset (const struct regset *regset, struct regcache *regcache,
void
ppc_collect_gregset (const struct regset *regset,
- const struct regcache *regcache,
- int regnum, void *gregs, size_t len)
+ const struct regcache *regcache, int regnum, void *gregs,
+ size_t len)
{
struct gdbarch *gdbarch = regcache->arch ();
ppc_gdbarch_tdep *tdep = gdbarch_tdep<ppc_gdbarch_tdep> (gdbarch);
@@ -623,27 +592,23 @@ ppc_collect_gregset (const struct regset *regset,
int gpr_size = offsets->gpr_size;
for (i = tdep->ppc_gp0_regnum, offset = offsets->r0_offset;
- i < tdep->ppc_gp0_regnum + ppc_num_gprs;
- i++, offset += gpr_size)
+ i < tdep->ppc_gp0_regnum + ppc_num_gprs; i++, offset += gpr_size)
ppc_collect_reg (regcache, i, (gdb_byte *) gregs, offset, gpr_size);
ppc_collect_reg (regcache, gdbarch_pc_regnum (gdbarch),
(gdb_byte *) gregs, offsets->pc_offset, gpr_size);
- ppc_collect_reg (regcache, tdep->ppc_ps_regnum,
- (gdb_byte *) gregs, offsets->ps_offset, gpr_size);
- ppc_collect_reg (regcache, tdep->ppc_lr_regnum,
- (gdb_byte *) gregs, offsets->lr_offset, gpr_size);
- ppc_collect_reg (regcache, tdep->ppc_ctr_regnum,
- (gdb_byte *) gregs, offsets->ctr_offset, gpr_size);
- ppc_collect_reg (regcache, tdep->ppc_cr_regnum,
- (gdb_byte *) gregs, offsets->cr_offset,
- offsets->xr_size);
- ppc_collect_reg (regcache, tdep->ppc_xer_regnum,
- (gdb_byte *) gregs, offsets->xer_offset,
- offsets->xr_size);
- ppc_collect_reg (regcache, tdep->ppc_mq_regnum,
- (gdb_byte *) gregs, offsets->mq_offset,
- offsets->xr_size);
+ ppc_collect_reg (regcache, tdep->ppc_ps_regnum, (gdb_byte *) gregs,
+ offsets->ps_offset, gpr_size);
+ ppc_collect_reg (regcache, tdep->ppc_lr_regnum, (gdb_byte *) gregs,
+ offsets->lr_offset, gpr_size);
+ ppc_collect_reg (regcache, tdep->ppc_ctr_regnum, (gdb_byte *) gregs,
+ offsets->ctr_offset, gpr_size);
+ ppc_collect_reg (regcache, tdep->ppc_cr_regnum, (gdb_byte *) gregs,
+ offsets->cr_offset, offsets->xr_size);
+ ppc_collect_reg (regcache, tdep->ppc_xer_regnum, (gdb_byte *) gregs,
+ offsets->xer_offset, offsets->xr_size);
+ ppc_collect_reg (regcache, tdep->ppc_mq_regnum, (gdb_byte *) gregs,
+ offsets->mq_offset, offsets->xr_size);
return;
}
@@ -658,8 +623,8 @@ ppc_collect_gregset (const struct regset *regset,
void
ppc_collect_fpregset (const struct regset *regset,
- const struct regcache *regcache,
- int regnum, void *fpregs, size_t len)
+ const struct regcache *regcache, int regnum,
+ void *fpregs, size_t len)
{
struct gdbarch *gdbarch = regcache->arch ();
const struct ppc_reg_offsets *offsets;
@@ -675,13 +640,11 @@ ppc_collect_fpregset (const struct regset *regset,
int i;
for (i = tdep->ppc_fp0_regnum, offset = offsets->f0_offset;
- i < tdep->ppc_fp0_regnum + ppc_num_fprs;
- i++, offset += 8)
+ i < tdep->ppc_fp0_regnum + ppc_num_fprs; i++, offset += 8)
ppc_collect_reg (regcache, i, (gdb_byte *) fpregs, offset, 8);
- ppc_collect_reg (regcache, tdep->ppc_fpscr_regnum,
- (gdb_byte *) fpregs, offsets->fpscr_offset,
- offsets->fpscr_size);
+ ppc_collect_reg (regcache, tdep->ppc_fpscr_regnum, (gdb_byte *) fpregs,
+ offsets->fpscr_offset, offsets->fpscr_size);
return;
}
@@ -705,22 +668,22 @@ insn_changes_sp_or_jumps (unsigned long insn)
in a funtion's epilogue. */
if (opcode == 31 && subcode == 444 && a == 1)
- return 1; /* mr R1,Rn */
+ return 1; /* mr R1,Rn */
if (opcode == 14 && sd == 1)
- return 1; /* addi R1,Rn,simm */
+ return 1; /* addi R1,Rn,simm */
if (opcode == 58 && sd == 1)
- return 1; /* ld R1,ds(Rn) */
+ return 1; /* ld R1,ds(Rn) */
/* Transfers control. */
if (opcode == 18)
- return 1; /* b */
+ return 1; /* b */
if (opcode == 16)
- return 1; /* bc */
+ return 1; /* bc */
if (opcode == 19 && subcode == 16)
- return 1; /* bclr */
+ return 1; /* bclr */
if (opcode == 19 && subcode == 528)
- return 1; /* bcctr */
+ return 1; /* bcctr */
return 0;
}
@@ -758,17 +721,19 @@ rs6000_in_function_epilogue_frame_p (frame_info_ptr curfrm,
return 0;
epilogue_start = pc - PPC_MAX_EPILOGUE_INSTRUCTIONS * PPC_INSN_SIZE;
- if (epilogue_start < func_start) epilogue_start = func_start;
+ if (epilogue_start < func_start)
+ epilogue_start = func_start;
epilogue_end = pc + PPC_MAX_EPILOGUE_INSTRUCTIONS * PPC_INSN_SIZE;
- if (epilogue_end > func_end) epilogue_end = func_end;
+ if (epilogue_end > func_end)
+ epilogue_end = func_end;
/* Scan forward until next 'blr'. */
for (scan_pc = pc; scan_pc < epilogue_end; scan_pc += PPC_INSN_SIZE)
{
if (!safe_frame_unwind_memory (curfrm, scan_pc,
- {insn_buf, PPC_INSN_SIZE}))
+ { insn_buf, PPC_INSN_SIZE }))
return 0;
insn = extract_unsigned_integer (insn_buf, PPC_INSN_SIZE, byte_order);
if (insn == 0x4e800020)
@@ -777,8 +742,8 @@ rs6000_in_function_epilogue_frame_p (frame_info_ptr curfrm,
this function. */
if (insn == 0x4e800420)
{
- CORE_ADDR ctr = get_frame_register_unsigned (curfrm,
- tdep->ppc_ctr_regnum);
+ CORE_ADDR ctr
+ = get_frame_register_unsigned (curfrm, tdep->ppc_ctr_regnum);
if (ctr > func_start && ctr < func_end)
return 0;
else
@@ -790,12 +755,11 @@ rs6000_in_function_epilogue_frame_p (frame_info_ptr curfrm,
/* Scan backward until adjustment to stack pointer (R1). */
- for (scan_pc = pc - PPC_INSN_SIZE;
- scan_pc >= epilogue_start;
+ for (scan_pc = pc - PPC_INSN_SIZE; scan_pc >= epilogue_start;
scan_pc -= PPC_INSN_SIZE)
{
if (!safe_frame_unwind_memory (curfrm, scan_pc,
- {insn_buf, PPC_INSN_SIZE}))
+ { insn_buf, PPC_INSN_SIZE }))
return 0;
insn = extract_unsigned_integer (insn_buf, PPC_INSN_SIZE, byte_order);
if (insn_changes_sp_or_jumps (insn))
@@ -810,13 +774,13 @@ rs6000_in_function_epilogue_frame_p (frame_info_ptr curfrm,
static int
rs6000_stack_frame_destroyed_p (struct gdbarch *gdbarch, CORE_ADDR pc)
{
- return rs6000_in_function_epilogue_frame_p (get_current_frame (),
- gdbarch, pc);
+ return rs6000_in_function_epilogue_frame_p (get_current_frame (), gdbarch,
+ pc);
}
/* Get the ith function argument for the current function. */
static CORE_ADDR
-rs6000_fetch_pointer_argument (frame_info_ptr frame, int argi,
+rs6000_fetch_pointer_argument (frame_info_ptr frame, int argi,
struct type *type)
{
return get_frame_register_unsigned (frame, 3 + argi);
@@ -827,8 +791,8 @@ rs6000_fetch_pointer_argument (frame_info_ptr frame, int argi,
constexpr gdb_byte big_breakpoint[] = { 0x7f, 0xe0, 0x00, 0x08 };
constexpr gdb_byte little_breakpoint[] = { 0x08, 0x00, 0xe0, 0x7f };
-typedef BP_MANIPULATION_ENDIAN (little_breakpoint, big_breakpoint)
- rs6000_breakpoint;
+typedef BP_MANIPULATION_ENDIAN (little_breakpoint,
+ big_breakpoint) rs6000_breakpoint;
/* Instruction masks for displaced stepping. */
#define OP_MASK 0xfc000000
@@ -854,10 +818,10 @@ typedef BP_MANIPULATION_ENDIAN (little_breakpoint, big_breakpoint)
#define STQCX_INSTRUCTION 0x7c00016d
/* Instruction masks for single-stepping of addpcis/lnia. */
-#define ADDPCIS_INSN 0x4c000004
-#define ADDPCIS_INSN_MASK 0xfc00003e
+#define ADDPCIS_INSN 0x4c000004
+#define ADDPCIS_INSN_MASK 0xfc00003e
#define ADDPCIS_TARGET_REGISTER 0x03F00000
-#define ADDPCIS_INSN_REGSHIFT 21
+#define ADDPCIS_INSN_REGSHIFT 21
#define PNOP_MASK 0xfff3ffff
#define PNOP_INSN 0x07000000
@@ -866,18 +830,20 @@ typedef BP_MANIPULATION_ENDIAN (little_breakpoint, big_breakpoint)
/* Check if insn is one of the Load And Reserve instructions used for atomic
sequences. */
-#define IS_LOAD_AND_RESERVE_INSN(insn) ((insn & LOAD_AND_RESERVE_MASK) == LWARX_INSTRUCTION \
- || (insn & LOAD_AND_RESERVE_MASK) == LDARX_INSTRUCTION \
- || (insn & LOAD_AND_RESERVE_MASK) == LBARX_INSTRUCTION \
- || (insn & LOAD_AND_RESERVE_MASK) == LHARX_INSTRUCTION \
- || (insn & LOAD_AND_RESERVE_MASK) == LQARX_INSTRUCTION)
+#define IS_LOAD_AND_RESERVE_INSN(insn) \
+ ((insn & LOAD_AND_RESERVE_MASK) == LWARX_INSTRUCTION \
+ || (insn & LOAD_AND_RESERVE_MASK) == LDARX_INSTRUCTION \
+ || (insn & LOAD_AND_RESERVE_MASK) == LBARX_INSTRUCTION \
+ || (insn & LOAD_AND_RESERVE_MASK) == LHARX_INSTRUCTION \
+ || (insn & LOAD_AND_RESERVE_MASK) == LQARX_INSTRUCTION)
/* Check if insn is one of the Store Conditional instructions used for atomic
sequences. */
-#define IS_STORE_CONDITIONAL_INSN(insn) ((insn & STORE_CONDITIONAL_MASK) == STWCX_INSTRUCTION \
- || (insn & STORE_CONDITIONAL_MASK) == STDCX_INSTRUCTION \
- || (insn & STORE_CONDITIONAL_MASK) == STBCX_INSTRUCTION \
- || (insn & STORE_CONDITIONAL_MASK) == STHCX_INSTRUCTION \
- || (insn & STORE_CONDITIONAL_MASK) == STQCX_INSTRUCTION)
+#define IS_STORE_CONDITIONAL_INSN(insn) \
+ ((insn & STORE_CONDITIONAL_MASK) == STWCX_INSTRUCTION \
+ || (insn & STORE_CONDITIONAL_MASK) == STDCX_INSTRUCTION \
+ || (insn & STORE_CONDITIONAL_MASK) == STBCX_INSTRUCTION \
+ || (insn & STORE_CONDITIONAL_MASK) == STHCX_INSTRUCTION \
+ || (insn & STORE_CONDITIONAL_MASK) == STQCX_INSTRUCTION)
typedef buf_displaced_step_copy_insn_closure
ppc_displaced_step_copy_insn_closure;
@@ -885,19 +851,18 @@ typedef buf_displaced_step_copy_insn_closure
/* We can't displaced step atomic sequences. */
static displaced_step_copy_insn_closure_up
-ppc_displaced_step_copy_insn (struct gdbarch *gdbarch,
- CORE_ADDR from, CORE_ADDR to,
- struct regcache *regs)
+ppc_displaced_step_copy_insn (struct gdbarch *gdbarch, CORE_ADDR from,
+ CORE_ADDR to, struct regcache *regs)
{
size_t len = gdbarch_max_insn_length (gdbarch);
- std::unique_ptr<ppc_displaced_step_copy_insn_closure> closure
- (new ppc_displaced_step_copy_insn_closure (len));
+ std::unique_ptr<ppc_displaced_step_copy_insn_closure> closure (
+ new ppc_displaced_step_copy_insn_closure (len));
gdb_byte *buf = closure->buf.data ();
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
int insn;
- len = target_read (current_inferior()->top_target(), TARGET_OBJECT_MEMORY, NULL,
- buf, from, len);
+ len = target_read (current_inferior ()->top_target (), TARGET_OBJECT_MEMORY,
+ NULL, buf, from, len);
if ((ssize_t) len < PPC_INSN_SIZE)
memory_error (TARGET_XFER_E_IO, from);
@@ -910,11 +875,11 @@ ppc_displaced_step_copy_insn (struct gdbarch *gdbarch,
into a displaced location, so decline to displace those instructions. */
if ((insn & OP_MASK) == 1 << 26)
{
- if (((insn & PNOP_MASK) != PNOP_INSN)
- && ((insn & R_MASK) != R_ZERO))
+ if (((insn & PNOP_MASK) != PNOP_INSN) && ((insn & R_MASK) != R_ZERO))
{
- displaced_debug_printf ("Not displacing prefixed instruction %08x at %s",
- insn, paddress (gdbarch, from));
+ displaced_debug_printf (
+ "Not displacing prefixed instruction %08x at %s", insn,
+ paddress (gdbarch, from));
return NULL;
}
}
@@ -937,8 +902,8 @@ ppc_displaced_step_copy_insn (struct gdbarch *gdbarch,
write_memory (to, buf, len);
- displaced_debug_printf ("copy %s->%s: %s",
- paddress (gdbarch, from), paddress (gdbarch, to),
+ displaced_debug_printf ("copy %s->%s: %s", paddress (gdbarch, from),
+ paddress (gdbarch, to),
displaced_step_dump_bytes (buf, len).c_str ());
/* This is a work around for a problem with g++ 4.8. */
@@ -950,15 +915,14 @@ ppc_displaced_step_copy_insn (struct gdbarch *gdbarch,
static void
ppc_displaced_step_fixup (struct gdbarch *gdbarch,
struct displaced_step_copy_insn_closure *closure_,
- CORE_ADDR from, CORE_ADDR to,
- struct regcache *regs)
+ CORE_ADDR from, CORE_ADDR to, struct regcache *regs)
{
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
/* Our closure is a copy of the instruction. */
ppc_displaced_step_copy_insn_closure *closure
= (ppc_displaced_step_copy_insn_closure *) closure_;
- ULONGEST insn = extract_unsigned_integer (closure->buf.data (),
- PPC_INSN_SIZE, byte_order);
+ ULONGEST insn = extract_unsigned_integer (closure->buf.data (),
+ PPC_INSN_SIZE, byte_order);
ULONGEST opcode;
/* Offset for non PC-relative instructions. */
LONGEST offset;
@@ -971,8 +935,8 @@ ppc_displaced_step_fixup (struct gdbarch *gdbarch,
else
offset = PPC_INSN_SIZE;
- displaced_debug_printf ("(ppc) fixup (%s, %s)",
- paddress (gdbarch, from), paddress (gdbarch, to));
+ displaced_debug_printf ("(ppc) fixup (%s, %s)", paddress (gdbarch, from),
+ paddress (gdbarch, to));
/* Handle the addpcis/lnia instruction. */
if ((insn & ADDPCIS_INSN_MASK) == ADDPCIS_INSN)
@@ -984,16 +948,16 @@ ppc_displaced_step_fixup (struct gdbarch *gdbarch,
/* Identify the target register that was updated by the instruction. */
int regnum = (insn & ADDPCIS_TARGET_REGISTER) >> ADDPCIS_INSN_REGSHIFT;
/* Read and update the target value. */
- regcache_cooked_read_unsigned (regs, regnum , &current_val);
- displaced_debug_printf ("addpcis target regnum %d was %s now %s",
- regnum, paddress (gdbarch, current_val),
- paddress (gdbarch, current_val
- + displaced_offset));
+ regcache_cooked_read_unsigned (regs, regnum, &current_val);
+ displaced_debug_printf ("addpcis target regnum %d was %s now %s", regnum,
+ paddress (gdbarch, current_val),
+ paddress (gdbarch,
+ current_val + displaced_offset));
regcache_cooked_write_unsigned (regs, regnum,
- current_val + displaced_offset);
+ current_val + displaced_offset);
/* point the PC back at the non-displaced instruction. */
regcache_cooked_write_unsigned (regs, gdbarch_pc_regnum (gdbarch),
- from + offset);
+ from + offset);
}
/* Handle PC-relative branch instructions. */
else if (opcode == B_INSN || opcode == BC_INSN || opcode == BXL_INSN)
@@ -1004,7 +968,7 @@ ppc_displaced_step_fixup (struct gdbarch *gdbarch,
in a displaced location. Calculate the offset to be applied to the
original PC value before the displaced stepping. */
regcache_cooked_read_unsigned (regs, gdbarch_pc_regnum (gdbarch),
- &current_pc);
+ &current_pc);
offset = current_pc - to;
if (opcode != BXL_INSN)
@@ -1043,12 +1007,10 @@ ppc_displaced_step_fixup (struct gdbarch *gdbarch,
{
/* Link register needs to be set to the next instruction's PC. */
ppc_gdbarch_tdep *tdep = gdbarch_tdep<ppc_gdbarch_tdep> (gdbarch);
- regcache_cooked_write_unsigned (regs,
- tdep->ppc_lr_regnum,
+ regcache_cooked_write_unsigned (regs, tdep->ppc_lr_regnum,
from + PPC_INSN_SIZE);
displaced_debug_printf ("(ppc) adjusted LR to %s",
paddress (gdbarch, from + PPC_INSN_SIZE));
-
}
}
/* Check for breakpoints in the inferior. If we've found one, place the PC
@@ -1067,8 +1029,8 @@ ppc_displaced_step_fixup (struct gdbarch *gdbarch,
/* Implementation of gdbarch_displaced_step_prepare. */
static displaced_step_prepare_status
-ppc_displaced_step_prepare (gdbarch *arch, thread_info *thread,
- CORE_ADDR &displaced_pc)
+ppc_displaced_step_prepare (gdbarch *arch, thread_info *thread,
+ CORE_ADDR &displaced_pc)
{
ppc_inferior_data *per_inferior = get_ppc_per_inferior (thread->inf);
@@ -1087,8 +1049,7 @@ ppc_displaced_step_prepare (gdbarch *arch, thread_info *thread,
/* Implementation of gdbarch_displaced_step_finish. */
static displaced_step_finish_status
-ppc_displaced_step_finish (gdbarch *arch, thread_info *thread,
- gdb_signal sig)
+ppc_displaced_step_finish (gdbarch *arch, thread_info *thread, gdb_signal sig)
{
ppc_inferior_data *per_inferior = get_ppc_per_inferior (thread->inf);
@@ -1104,8 +1065,7 @@ ppc_displaced_step_restore_all_in_ptid (inferior *parent_inf, ptid_t ptid)
{
ppc_inferior_data *per_inferior = ppc_inferior_data_key.get (parent_inf);
- if (per_inferior == nullptr
- || !per_inferior->disp_step_buf.has_value ())
+ if (per_inferior == nullptr || !per_inferior->disp_step_buf.has_value ())
return;
per_inferior->disp_step_buf->restore_in_ptid (ptid);
@@ -1129,13 +1089,13 @@ ppc_deal_with_atomic_sequence (struct regcache *regcache)
struct gdbarch *gdbarch = regcache->arch ();
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
CORE_ADDR pc = regcache_read_pc (regcache);
- CORE_ADDR breaks[2] = {CORE_ADDR_MAX, CORE_ADDR_MAX};
+ CORE_ADDR breaks[2] = { CORE_ADDR_MAX, CORE_ADDR_MAX };
CORE_ADDR loc = pc;
CORE_ADDR closing_insn; /* Instruction that closes the atomic sequence. */
int insn = read_memory_integer (loc, PPC_INSN_SIZE, byte_order);
int insn_count;
int index;
- int last_breakpoint = 0; /* Defaults to 0 (no breakpoints placed). */
+ int last_breakpoint = 0; /* Defaults to 0 (no breakpoints placed). */
const int atomic_sequence_length = 16; /* Instruction sequence length. */
int bc_insn_count = 0; /* Conditional branch instruction count. */
@@ -1164,7 +1124,7 @@ ppc_deal_with_atomic_sequence (struct regcache *regcache)
if (bc_insn_count >= 1)
return {}; /* More than one conditional branch found, fallback
to the standard single-step code. */
-
+
if (absolute)
breaks[1] = immediate;
else
@@ -1204,11 +1164,9 @@ ppc_deal_with_atomic_sequence (struct regcache *regcache)
return next_pcs;
}
-
-#define SIGNED_SHORT(x) \
- ((sizeof (short) == 2) \
- ? ((int)(short)(x)) \
- : ((int)((((x) & 0xffff) ^ 0x8000) - 0x8000)))
+#define SIGNED_SHORT(x) \
+ ((sizeof (short) == 2) ? ((int) (short) (x)) \
+ : ((int) ((((x) &0xffff) ^ 0x8000) - 0x8000)))
#define GET_SRC_REG(x) (((x) >> 21) & 0x1f)
@@ -1225,7 +1183,7 @@ static int
store_param_on_stack_p (unsigned long op, int framep, int *r0_contains_arg)
{
/* Move parameters from argument registers to temporary register. */
- if ((op & 0xfc0007fe) == 0x7c000378) /* mr(.) Rx,Ry */
+ if ((op & 0xfc0007fe) == 0x7c000378) /* mr(.) Rx,Ry */
{
/* Rx must be scratch register r0. */
const int rx_regno = (op >> 16) & 31;
@@ -1243,21 +1201,21 @@ store_param_on_stack_p (unsigned long op, int framep, int *r0_contains_arg)
/* Save a General Purpose Register on stack. */
- if ((op & 0xfc1f0003) == 0xf8010000 || /* std Rx,NUM(r1) */
- (op & 0xfc1f0000) == 0xd8010000) /* stfd Rx,NUM(r1) */
+ if ((op & 0xfc1f0003) == 0xf8010000 || /* std Rx,NUM(r1) */
+ (op & 0xfc1f0000) == 0xd8010000) /* stfd Rx,NUM(r1) */
{
/* Rx: Only r3 - r10 are used for parameter passing. */
const int rx_regno = GET_SRC_REG (op);
return (rx_regno >= 3 && rx_regno <= 10);
}
-
+
/* Save a General Purpose Register on stack via the Frame Pointer. */
- if (framep &&
- ((op & 0xfc1f0000) == 0x901f0000 || /* st rx,NUM(r31) */
- (op & 0xfc1f0000) == 0x981f0000 || /* stb Rx,NUM(r31) */
- (op & 0xfc1f0000) == 0xd81f0000)) /* stfd Rx,NUM(r31) */
+ if (framep
+ && ((op & 0xfc1f0000) == 0x901f0000 || /* st rx,NUM(r31) */
+ (op & 0xfc1f0000) == 0x981f0000 || /* stb Rx,NUM(r31) */
+ (op & 0xfc1f0000) == 0xd81f0000)) /* stfd Rx,NUM(r31) */
{
/* Rx: Usually, only r3 - r10 are used for parameter passing.
However, the compiler sometimes uses r0 to hold an argument. */
@@ -1267,7 +1225,7 @@ store_param_on_stack_p (unsigned long op, int framep, int *r0_contains_arg)
|| (rx_regno == 0 && *r0_contains_arg));
}
- if ((op & 0xfc1f0000) == 0xfc010000) /* frsp, fp?,NUM(r1) */
+ if ((op & 0xfc1f0000) == 0xfc010000) /* frsp, fp?,NUM(r1) */
{
/* Only f2 - f8 are used for parameter passing. */
const int src_regno = GET_SRC_REG (op);
@@ -1275,7 +1233,7 @@ store_param_on_stack_p (unsigned long op, int framep, int *r0_contains_arg)
return (src_regno >= 2 && src_regno <= 8);
}
- if (framep && ((op & 0xfc1f0000) == 0xfc1f0000)) /* frsp, fp?,NUM(r31) */
+ if (framep && ((op & 0xfc1f0000) == 0xfc1f0000)) /* frsp, fp?,NUM(r31) */
{
/* Only f2 - f8 are used for parameter passing. */
const int src_regno = GET_SRC_REG (op);
@@ -1325,8 +1283,8 @@ bl_to_blrl_insn_p (CORE_ADDR pc, int insn, enum bfd_endian byte_order)
Return false otherwise.
*/
static bool
-store_insn_p (unsigned long op, unsigned long rs,
- unsigned long ra, bool with_update)
+store_insn_p (unsigned long op, unsigned long rs, unsigned long ra,
+ bool with_update)
{
rs = rs << 21;
ra = ra << 16;
@@ -1382,7 +1340,7 @@ rs6000_fetch_instruction (struct gdbarch *gdbarch, const CORE_ADDR pc)
of each function prologue when compiling with -fstack-check. If one of
such sequences starts at START_PC, then return the address of the
instruction immediately past this sequence. Otherwise, return START_PC. */
-
+
static CORE_ADDR
rs6000_skip_stack_check (struct gdbarch *gdbarch, const CORE_ADDR start_pc)
{
@@ -1392,7 +1350,7 @@ rs6000_skip_stack_check (struct gdbarch *gdbarch, const CORE_ADDR start_pc)
/* First possible sequence: A small number of probes.
stw 0, -<some immediate>(1)
[repeat this instruction any (small) number of times]. */
-
+
if ((op & 0xffff0000) == 0x90010000)
{
while ((op & 0xffff0000) == 0x90010000)
@@ -1522,7 +1480,7 @@ rs6000_skip_stack_check (struct gdbarch *gdbarch, const CORE_ADDR start_pc)
op = rs6000_fetch_instruction (gdbarch, pc);
if ((op & 0xffff0000) != 0x3d800000)
break;
-
+
/* lwz 12,<some immediate>(12) */
pc = pc + 4;
op = rs6000_fetch_instruction (gdbarch, pc);
@@ -1628,7 +1586,7 @@ skip_prologue (struct gdbarch *gdbarch, CORE_ADDR pc, CORE_ADDR lim_pc,
op = extract_unsigned_integer (buf, 4, byte_order);
if ((op & 0xfc1fffff) == 0x7c0802a6)
- { /* mflr Rx */
+ { /* mflr Rx */
/* Since shared library / PIC code, which needs to get its
address at runtime, can appear to save more than one link
register vis:
@@ -1653,15 +1611,14 @@ skip_prologue (struct gdbarch *gdbarch, CORE_ADDR pc, CORE_ADDR lim_pc,
continue;
}
else if ((op & 0xfc1fffff) == 0x7c000026)
- { /* mfcr Rx */
+ { /* mfcr Rx */
cr_reg = (op & 0x03e00000) >> 21;
if (cr_reg == 0)
r0_contains_arg = 0;
continue;
-
}
else if ((op & 0xfc1f0000) == 0xd8010000)
- { /* stfd Rx,NUM(r1) */
+ { /* stfd Rx,NUM(r1) */
reg = GET_SRC_REG (op);
if (fdata->saved_fpr == -1 || fdata->saved_fpr > reg)
{
@@ -1669,14 +1626,13 @@ skip_prologue (struct gdbarch *gdbarch, CORE_ADDR pc, CORE_ADDR lim_pc,
fdata->fpr_offset = SIGNED_SHORT (op) + offset;
}
continue;
-
}
- else if (((op & 0xfc1f0000) == 0xbc010000) || /* stm Rx, NUM(r1) */
- (((op & 0xfc1f0000) == 0x90010000 || /* st rx,NUM(r1) */
- (op & 0xfc1f0003) == 0xf8010000) && /* std rx,NUM(r1) */
- (op & 0x03e00000) >= 0x01a00000)) /* rx >= r13 */
+ else if (((op & 0xfc1f0000) == 0xbc010000) || /* stm Rx, NUM(r1) */
+ (((op & 0xfc1f0000) == 0x90010000 || /* st rx,NUM(r1) */
+ (op & 0xfc1f0003) == 0xf8010000)
+ && /* std rx,NUM(r1) */
+ (op & 0x03e00000) >= 0x01a00000)) /* rx >= r13 */
{
-
reg = GET_SRC_REG (op);
if ((op & 0xfc1f0000) == 0xbc010000)
fdata->gpr_mask |= ~((1U << reg) - 1);
@@ -1690,7 +1646,6 @@ skip_prologue (struct gdbarch *gdbarch, CORE_ADDR pc, CORE_ADDR lim_pc,
fdata->gpr_offset = SIGNED_SHORT (op) + offset;
}
continue;
-
}
else if ((op & 0xffff0000) == 0x3c4c0000
|| (op & 0xffff0000) == 0x3c400000
@@ -1712,30 +1667,27 @@ skip_prologue (struct gdbarch *gdbarch, CORE_ADDR pc, CORE_ADDR lim_pc,
instructions. */
prev_insn_was_prologue_insn = 0;
continue;
-
}
else if ((op & 0xffff0000) == 0x3c000000)
- { /* addis 0,0,NUM, used for >= 32k frames */
+ { /* addis 0,0,NUM, used for >= 32k frames */
fdata->offset = (op & 0x0000ffff) << 16;
fdata->frameless = 0;
r0_contains_arg = 0;
continue;
-
}
else if ((op & 0xffff0000) == 0x60000000)
- { /* ori 0,0,NUM, 2nd half of >= 32k frames */
+ { /* ori 0,0,NUM, 2nd half of >= 32k frames */
fdata->offset |= (op & 0x0000ffff);
fdata->frameless = 0;
r0_contains_arg = 0;
continue;
-
}
- else if (lr_reg >= 0 &&
- ((store_insn_p (op, lr_reg, 1, true)) ||
- (framep &&
- (store_insn_p (op, lr_reg,
- fdata->alloca_reg - tdep->ppc_gp0_regnum,
- false)))))
+ else if (lr_reg >= 0
+ && ((store_insn_p (op, lr_reg, 1, true))
+ || (framep
+ && (store_insn_p (
+ op, lr_reg, fdata->alloca_reg - tdep->ppc_gp0_regnum,
+ false)))))
{
if (store_insn_p (op, lr_reg, 1, true))
fdata->lr_offset = offset;
@@ -1746,30 +1698,27 @@ skip_prologue (struct gdbarch *gdbarch, CORE_ADDR pc, CORE_ADDR lim_pc,
/* Invalidate lr_reg, but don't set it to -1.
That would mean that it had never been set. */
lr_reg = -2;
- if ((op & 0xfc000003) == 0xf8000000 || /* std */
- (op & 0xfc000000) == 0x90000000) /* stw */
+ if ((op & 0xfc000003) == 0xf8000000 || /* std */
+ (op & 0xfc000000) == 0x90000000) /* stw */
{
/* Does not update r1, so add displacement to lr_offset. */
fdata->lr_offset += SIGNED_SHORT (op);
}
continue;
-
}
- else if (cr_reg >= 0 &&
- (store_insn_p (op, cr_reg, 1, true)))
+ else if (cr_reg >= 0 && (store_insn_p (op, cr_reg, 1, true)))
{
fdata->cr_offset = offset;
/* Invalidate cr_reg, but don't set it to -1.
That would mean that it had never been set. */
cr_reg = -2;
- if ((op & 0xfc000003) == 0xf8000000 ||
- (op & 0xfc000000) == 0x90000000)
+ if ((op & 0xfc000003) == 0xf8000000
+ || (op & 0xfc000000) == 0x90000000)
{
/* Does not update r1, so add displacement to cr_offset. */
fdata->cr_offset += SIGNED_SHORT (op);
}
continue;
-
}
else if ((op & 0xfe80ffff) == 0x42800005 && lr_reg != -1)
{
@@ -1779,26 +1728,23 @@ skip_prologue (struct gdbarch *gdbarch, CORE_ADDR pc, CORE_ADDR lim_pc,
continue;
}
else if (op == 0x48000005)
- { /* bl .+4 used in
+ { /* bl .+4 used in
-mrelocatable */
fdata->used_bl = 1;
continue;
-
}
else if (op == 0x48000004)
- { /* b .+4 (xlc) */
+ { /* b .+4 (xlc) */
break;
-
}
- else if ((op & 0xffff0000) == 0x3fc00000 || /* addis 30,0,foo@ha, used
+ else if ((op & 0xffff0000) == 0x3fc00000 || /* addis 30,0,foo@ha, used
in V.4 -mminimal-toc */
(op & 0xffff0000) == 0x3bde0000)
- { /* addi 30,30,foo@l */
+ { /* addi 30,30,foo@l */
continue;
-
}
else if ((op & 0xfc000001) == 0x48000001)
- { /* bl foo,
+ { /* bl foo,
to save fprs??? */
fdata->frameless = 0;
@@ -1833,8 +1779,8 @@ skip_prologue (struct gdbarch *gdbarch, CORE_ADDR pc, CORE_ADDR lim_pc,
and nothing else). If the next is not a nop, this branch
was part of the function prologue. */
- if (op == 0x4def7b82 || op == 0) /* crorc 15, 15, 15 */
- break; /* Don't skip over
+ if (op == 0x4def7b82 || op == 0) /* crorc 15, 15, 15 */
+ break; /* Don't skip over
this branch. */
fdata->used_bl = 1;
@@ -1842,28 +1788,28 @@ skip_prologue (struct gdbarch *gdbarch, CORE_ADDR pc, CORE_ADDR lim_pc,
}
/* update stack pointer */
else if ((op & 0xfc1f0000) == 0x94010000)
- { /* stu rX,NUM(r1) || stwu rX,NUM(r1) */
+ { /* stu rX,NUM(r1) || stwu rX,NUM(r1) */
fdata->frameless = 0;
fdata->offset = SIGNED_SHORT (op);
offset = fdata->offset;
continue;
}
else if ((op & 0xfc1f07fa) == 0x7c01016a)
- { /* stwux rX,r1,rY || stdux rX,r1,rY */
+ { /* stwux rX,r1,rY || stdux rX,r1,rY */
/* No way to figure out what r1 is going to be. */
fdata->frameless = 0;
offset = fdata->offset;
continue;
}
else if ((op & 0xfc1f0003) == 0xf8010001)
- { /* stdu rX,NUM(r1) */
+ { /* stdu rX,NUM(r1) */
fdata->frameless = 0;
fdata->offset = SIGNED_SHORT (op & ~3UL);
offset = fdata->offset;
continue;
}
else if ((op & 0xffff0000) == 0x38210000)
- { /* addi r1,r1,SIMM */
+ { /* addi r1,r1,SIMM */
fdata->frameless = 0;
fdata->offset += SIGNED_SHORT (op);
offset = fdata->offset;
@@ -1871,10 +1817,9 @@ skip_prologue (struct gdbarch *gdbarch, CORE_ADDR pc, CORE_ADDR lim_pc,
}
/* Load up minimal toc pointer. Do not treat an epilogue restore
of r31 as a minimal TOC load. */
- else if (((op >> 22) == 0x20f || /* l r31,... or l r30,... */
- (op >> 22) == 0x3af) /* ld r31,... or ld r30,... */
- && !framep
- && !minimal_toc_loaded)
+ else if (((op >> 22) == 0x20f || /* l r31,... or l r30,... */
+ (op >> 22) == 0x3af) /* ld r31,... or ld r30,... */
+ && !framep && !minimal_toc_loaded)
{
minimal_toc_loaded = 1;
continue;
@@ -1882,11 +1827,11 @@ skip_prologue (struct gdbarch *gdbarch, CORE_ADDR pc, CORE_ADDR lim_pc,
/* move parameters from argument registers to local variable
registers */
}
- else if ((op & 0xfc0007fe) == 0x7c000378 && /* mr(.) Rx,Ry */
- (((op >> 21) & 31) >= 3) && /* R3 >= Ry >= R10 */
- (((op >> 21) & 31) <= 10) &&
- ((long) ((op >> 16) & 31)
- >= fdata->saved_gpr)) /* Rx: local var reg */
+ else if ((op & 0xfc0007fe) == 0x7c000378 && /* mr(.) Rx,Ry */
+ (((op >> 21) & 31) >= 3) && /* R3 >= Ry >= R10 */
+ (((op >> 21) & 31) <= 10)
+ && ((long) ((op >> 16) & 31)
+ >= fdata->saved_gpr)) /* Rx: local var reg */
{
continue;
@@ -1899,7 +1844,7 @@ skip_prologue (struct gdbarch *gdbarch, CORE_ADDR pc, CORE_ADDR lim_pc,
/* Set up frame pointer */
}
- else if (op == 0x603d0000) /* oril r29, r1, 0x0 */
+ else if (op == 0x603d0000) /* oril r29, r1, 0x0 */
{
fdata->frameless = 0;
framep = 1;
@@ -1909,9 +1854,9 @@ skip_prologue (struct gdbarch *gdbarch, CORE_ADDR pc, CORE_ADDR lim_pc,
/* Another way to set up the frame pointer. */
}
- else if (op == 0x603f0000 /* oril r31, r1, 0x0 */
+ else if (op == 0x603f0000 /* oril r31, r1, 0x0 */
|| op == 0x7c3f0b78)
- { /* mr r31, r1 */
+ { /* mr r31, r1 */
fdata->frameless = 0;
framep = 1;
fdata->alloca_reg = (tdep->ppc_gp0_regnum + 31);
@@ -1921,11 +1866,11 @@ skip_prologue (struct gdbarch *gdbarch, CORE_ADDR pc, CORE_ADDR lim_pc,
/* Another way to set up the frame pointer. */
}
else if ((op & 0xfc1fffff) == 0x38010000)
- { /* addi rX, r1, 0x0 */
+ { /* addi rX, r1, 0x0 */
fdata->frameless = 0;
framep = 1;
- fdata->alloca_reg = (tdep->ppc_gp0_regnum
- + ((op & ~0x38010000) >> 21));
+ fdata->alloca_reg
+ = (tdep->ppc_gp0_regnum + ((op & ~0x38010000) >> 21));
alloca_reg_offset = offset;
continue;
}
@@ -1937,12 +1882,12 @@ skip_prologue (struct gdbarch *gdbarch, CORE_ADDR pc, CORE_ADDR lim_pc,
and mtspr SPR256, Rn. */
/* mfspr Rn SPR256 == 011111 nnnnn 0000001000 01010100110
mtspr SPR256 Rn == 011111 nnnnn 0000001000 01110100110 */
- else if ((op & 0xfc1fffff) == 0x7c0042a6) /* mfvrsave Rn */
+ else if ((op & 0xfc1fffff) == 0x7c0042a6) /* mfvrsave Rn */
{
vrsave_reg = GET_SRC_REG (op);
continue;
}
- else if ((op & 0xfc1fffff) == 0x7c0043a6) /* mtvrsave Rn */
+ else if ((op & 0xfc1fffff) == 0x7c0043a6) /* mtvrsave Rn */
{
continue;
}
@@ -1950,7 +1895,7 @@ skip_prologue (struct gdbarch *gdbarch, CORE_ADDR pc, CORE_ADDR lim_pc,
rS is the register where vrsave was stored in a previous
instruction. */
/* 100100 sssss 00001 dddddddd dddddddd */
- else if ((op & 0xfc1f0000) == 0x90010000) /* stw rS, d(r1) */
+ else if ((op & 0xfc1f0000) == 0x90010000) /* stw rS, d(r1) */
{
if (vrsave_reg == GET_SRC_REG (op))
{
@@ -1961,8 +1906,8 @@ skip_prologue (struct gdbarch *gdbarch, CORE_ADDR pc, CORE_ADDR lim_pc,
}
/* Compute the new value of vrsave, by modifying the register
where vrsave was saved to. */
- else if (((op & 0xfc000000) == 0x64000000) /* oris Ra, Rs, UIMM */
- || ((op & 0xfc000000) == 0x60000000))/* ori Ra, Rs, UIMM */
+ else if (((op & 0xfc000000) == 0x64000000) /* oris Ra, Rs, UIMM */
+ || ((op & 0xfc000000) == 0x60000000)) /* ori Ra, Rs, UIMM */
{
continue;
}
@@ -1971,8 +1916,8 @@ skip_prologue (struct gdbarch *gdbarch, CORE_ADDR pc, CORE_ADDR lim_pc,
stack. */
/* 001110 00000 00000 iiii iiii iiii iiii */
/* 001110 01110 00000 iiii iiii iiii iiii */
- else if ((op & 0xffff0000) == 0x38000000 /* li r0, SIMM */
- || (op & 0xffff0000) == 0x39c00000) /* li r14, SIMM */
+ else if ((op & 0xffff0000) == 0x38000000 /* li r0, SIMM */
+ || (op & 0xffff0000) == 0x39c00000) /* li r14, SIMM */
{
if ((op & 0xffff0000) == 0x38000000)
r0_contains_arg = 0;
@@ -1984,9 +1929,9 @@ skip_prologue (struct gdbarch *gdbarch, CORE_ADDR pc, CORE_ADDR lim_pc,
record this insn as part of the prologue yet. */
prev_insn_was_prologue_insn = 0;
}
- /* Store vector register S at (r31+r0) aligned to 16 bytes. */
+ /* Store vector register S at (r31+r0) aligned to 16 bytes. */
/* 011111 sssss 11111 00000 00111001110 */
- else if ((op & 0xfc1fffff) == 0x7c1f01ce) /* stvx Vs, R31, R0 */
+ else if ((op & 0xfc1fffff) == 0x7c1f01ce) /* stvx Vs, R31, R0 */
{
if (pc == (li_found_pc + 4))
{
@@ -2011,9 +1956,9 @@ skip_prologue (struct gdbarch *gdbarch, CORE_ADDR pc, CORE_ADDR lim_pc,
Any register less than r13 is volatile, so we don't care. */
/* 000100 sssss 11111 iiiii 01100100001 */
else if (arch_info->mach == bfd_mach_ppc_e500
- && (op & 0xfc1f07ff) == 0x101f0321) /* evstdd Rs,uimm(R31) */
+ && (op & 0xfc1f07ff) == 0x101f0321) /* evstdd Rs,uimm(R31) */
{
- if ((op & 0x03e00000) >= 0x01a00000) /* Rs >= r13 */
+ if ((op & 0x03e00000) >= 0x01a00000) /* Rs >= r13 */
{
unsigned int imm;
ev_reg = GET_SRC_REG (op);
@@ -2033,7 +1978,7 @@ skip_prologue (struct gdbarch *gdbarch, CORE_ADDR pc, CORE_ADDR lim_pc,
/* Store gen register rS at (r1+rB). */
/* 000100 sssss 00001 bbbbb 01100100000 */
else if (arch_info->mach == bfd_mach_ppc_e500
- && (op & 0xffe007ff) == 0x13e00320) /* evstddx RS,R1,Rb */
+ && (op & 0xffe007ff) == 0x13e00320) /* evstddx RS,R1,Rb */
{
if (pc == (li_found_pc + 4))
{
@@ -2056,7 +2001,7 @@ skip_prologue (struct gdbarch *gdbarch, CORE_ADDR pc, CORE_ADDR lim_pc,
/* Store gen register r31 at (rA+uimm). */
/* 000100 11111 aaaaa iiiii 01100100001 */
else if (arch_info->mach == bfd_mach_ppc_e500
- && (op & 0xffe007ff) == 0x13e00321) /* evstdd R31,Ra,UIMM */
+ && (op & 0xffe007ff) == 0x13e00321) /* evstdd R31,Ra,UIMM */
{
/* Wwe know that the source register is 31 already, but
it can't hurt to compute it. */
@@ -2077,7 +2022,7 @@ skip_prologue (struct gdbarch *gdbarch, CORE_ADDR pc, CORE_ADDR lim_pc,
Store param on stack when offset from SP bigger than 4 bytes. */
/* 000100 sssss 11111 00000 01100100000 */
else if (arch_info->mach == bfd_mach_ppc_e500
- && (op & 0xfc1fffff) == 0x101f0320) /* evstddx Rs,R31,R0 */
+ && (op & 0xfc1fffff) == 0x101f0320) /* evstddx Rs,R31,R0 */
{
if (pc == (li_found_pc + 4))
{
@@ -2119,8 +2064,8 @@ skip_prologue (struct gdbarch *gdbarch, CORE_ADDR pc, CORE_ADDR lim_pc,
break;
}
- if (op == 0x4e800020 /* blr */
- || op == 0x4e800420) /* bctr */
+ if (op == 0x4e800020 /* blr */
+ || op == 0x4e800420) /* bctr */
/* Do not scan past epilogue in frameless functions or
trampolines. */
break;
@@ -2207,7 +2152,7 @@ rs6000_skip_prologue (struct gdbarch *gdbarch, CORE_ADDR pc)
that bound, then use an arbitrary large number as the upper bound. */
limit_pc = skip_prologue_using_sal (gdbarch, pc);
if (limit_pc == 0)
- limit_pc = pc + 100; /* Magic. */
+ limit_pc = pc + 100; /* Magic. */
/* Do not allow limit_pc to be past the function end, if we know
where that end is... */
@@ -2246,8 +2191,7 @@ rs6000_skip_main_prologue (struct gdbarch *gdbarch, CORE_ADDR pc)
/* We check for ___eabi (three leading underscores) in addition
to __eabi in case the GCC option "-fleading-underscore" was
used to compile the program. */
- if (s.minsym != NULL
- && s.minsym->linkage_name () != NULL
+ if (s.minsym != NULL && s.minsym->linkage_name () != NULL
&& (strcmp (s.minsym->linkage_name (), "__eabi") == 0
|| strcmp (s.minsym->linkage_name (), "___eabi") == 0))
pc += 4;
@@ -2286,8 +2230,8 @@ rs6000_frame_align (struct gdbarch *gdbarch, CORE_ADDR addr)
@FIX code. */
static int
-rs6000_in_solib_return_trampoline (struct gdbarch *gdbarch,
- CORE_ADDR pc, const char *name)
+rs6000_in_solib_return_trampoline (struct gdbarch *gdbarch, CORE_ADDR pc,
+ const char *name)
{
return name && startswith (name, "@FIX");
}
@@ -2317,17 +2261,14 @@ rs6000_skip_trampoline_code (frame_info_ptr frame, CORE_ADDR pc)
CORE_ADDR solib_target_pc;
struct bound_minimal_symbol msymbol;
- static unsigned trampoline_code[] =
- {
- 0x800b0000, /* l r0,0x0(r11) */
- 0x90410014, /* st r2,0x14(r1) */
- 0x7c0903a6, /* mtctr r0 */
- 0x804b0004, /* l r2,0x4(r11) */
- 0x816b0008, /* l r11,0x8(r11) */
- 0x4e800420, /* bctr */
- 0x4e800020, /* br */
- 0
- };
+ static unsigned trampoline_code[] = { 0x800b0000, /* l r0,0x0(r11) */
+ 0x90410014, /* st r2,0x14(r1) */
+ 0x7c0903a6, /* mtctr r0 */
+ 0x804b0004, /* l r2,0x4(r11) */
+ 0x816b0008, /* l r11,0x8(r11) */
+ 0x4e800420, /* bctr */
+ 0x4e800020, /* br */
+ 0 };
/* Check for bigtoc fixup code. */
msymbol = lookup_minimal_symbol_by_pc (pc);
@@ -2341,7 +2282,7 @@ rs6000_skip_trampoline_code (frame_info_ptr frame, CORE_ADDR pc)
{
/* Extract bits 6-29 as a signed 24-bit relative word address and
add it to the containing PC. */
- rel = ((int)(op << 6) >> 6);
+ rel = ((int) (op << 6) >> 6);
return pc + 8 + rel;
}
}
@@ -2357,7 +2298,7 @@ rs6000_skip_trampoline_code (frame_info_ptr frame, CORE_ADDR pc)
if (op != trampoline_code[ii])
return 0;
}
- ii = get_frame_register_unsigned (frame, 11); /* r11 holds destination
+ ii = get_frame_register_unsigned (frame, 11); /* r11 holds destination
addr. */
pc = read_memory_unsigned_integer (ii, tdep->wordsize, byte_order);
return pc;
@@ -2388,8 +2329,8 @@ rs6000_builtin_type_vec64 (struct gdbarch *gdbarch)
struct type *t;
- t = arch_composite_type (gdbarch,
- "__ppc_builtin_type_vec64", TYPE_CODE_UNION);
+ t = arch_composite_type (gdbarch, "__ppc_builtin_type_vec64",
+ TYPE_CODE_UNION);
append_composite_type_field (t, "uint64", bt->builtin_int64);
append_composite_type_field (t, "v2_float",
init_vector_type (bt->builtin_float, 2));
@@ -2438,8 +2379,8 @@ rs6000_builtin_type_vec128 (struct gdbarch *gdbarch)
struct type *t;
- t = arch_composite_type (gdbarch,
- "__ppc_builtin_type_vec128", TYPE_CODE_UNION);
+ t = arch_composite_type (gdbarch, "__ppc_builtin_type_vec128",
+ TYPE_CODE_UNION);
append_composite_type_field (t, "float128", t_float128);
append_composite_type_field (t, "uint128", bt->builtin_uint128);
append_composite_type_field (t, "v2_double",
@@ -2472,14 +2413,12 @@ rs6000_register_name (struct gdbarch *gdbarch, int regno)
/* The upper half "registers" have names in the XML description,
but we present only the low GPRs and the full 64-bit registers
to the user. */
- if (tdep->ppc_ev0_upper_regnum >= 0
- && tdep->ppc_ev0_upper_regnum <= regno
+ if (tdep->ppc_ev0_upper_regnum >= 0 && tdep->ppc_ev0_upper_regnum <= regno
&& regno < tdep->ppc_ev0_upper_regnum + ppc_num_gprs)
return "";
/* Hide the upper halves of the vs0~vs31 registers. */
- if (tdep->ppc_vsr0_regnum >= 0
- && tdep->ppc_vsr0_upper_regnum <= regno
+ if (tdep->ppc_vsr0_regnum >= 0 && tdep->ppc_vsr0_upper_regnum <= regno
&& regno < tdep->ppc_vsr0_upper_regnum + ppc_num_gprs)
return "";
@@ -2492,8 +2431,8 @@ rs6000_register_name (struct gdbarch *gdbarch, int regno)
if (IS_SPE_PSEUDOREG (tdep, regno))
{
static const char *const spe_regnames[] = {
- "ev0", "ev1", "ev2", "ev3", "ev4", "ev5", "ev6", "ev7",
- "ev8", "ev9", "ev10", "ev11", "ev12", "ev13", "ev14", "ev15",
+ "ev0", "ev1", "ev2", "ev3", "ev4", "ev5", "ev6", "ev7",
+ "ev8", "ev9", "ev10", "ev11", "ev12", "ev13", "ev14", "ev15",
"ev16", "ev17", "ev18", "ev19", "ev20", "ev21", "ev22", "ev23",
"ev24", "ev25", "ev26", "ev27", "ev28", "ev29", "ev30", "ev31",
};
@@ -2503,66 +2442,56 @@ rs6000_register_name (struct gdbarch *gdbarch, int regno)
/* Check if the decimal128 pseudo-registers are available. */
if (IS_DFP_PSEUDOREG (tdep, regno))
{
- static const char *const dfp128_regnames[] = {
- "dl0", "dl1", "dl2", "dl3",
- "dl4", "dl5", "dl6", "dl7",
- "dl8", "dl9", "dl10", "dl11",
- "dl12", "dl13", "dl14", "dl15"
- };
+ static const char *const dfp128_regnames[]
+ = { "dl0", "dl1", "dl2", "dl3", "dl4", "dl5", "dl6", "dl7",
+ "dl8", "dl9", "dl10", "dl11", "dl12", "dl13", "dl14", "dl15" };
return dfp128_regnames[regno - tdep->ppc_dl0_regnum];
}
/* Check if this is a vX alias for a raw vrX vector register. */
if (IS_V_ALIAS_PSEUDOREG (tdep, regno))
{
- static const char *const vector_alias_regnames[] = {
- "v0", "v1", "v2", "v3", "v4", "v5", "v6", "v7",
- "v8", "v9", "v10", "v11", "v12", "v13", "v14", "v15",
- "v16", "v17", "v18", "v19", "v20", "v21", "v22", "v23",
- "v24", "v25", "v26", "v27", "v28", "v29", "v30", "v31"
- };
+ static const char *const vector_alias_regnames[]
+ = { "v0", "v1", "v2", "v3", "v4", "v5", "v6", "v7",
+ "v8", "v9", "v10", "v11", "v12", "v13", "v14", "v15",
+ "v16", "v17", "v18", "v19", "v20", "v21", "v22", "v23",
+ "v24", "v25", "v26", "v27", "v28", "v29", "v30", "v31" };
return vector_alias_regnames[regno - tdep->ppc_v0_alias_regnum];
}
/* Check if this is a VSX pseudo-register. */
if (IS_VSX_PSEUDOREG (tdep, regno))
{
- static const char *const vsx_regnames[] = {
- "vs0", "vs1", "vs2", "vs3", "vs4", "vs5", "vs6", "vs7",
- "vs8", "vs9", "vs10", "vs11", "vs12", "vs13", "vs14",
- "vs15", "vs16", "vs17", "vs18", "vs19", "vs20", "vs21",
- "vs22", "vs23", "vs24", "vs25", "vs26", "vs27", "vs28",
- "vs29", "vs30", "vs31", "vs32", "vs33", "vs34", "vs35",
- "vs36", "vs37", "vs38", "vs39", "vs40", "vs41", "vs42",
- "vs43", "vs44", "vs45", "vs46", "vs47", "vs48", "vs49",
- "vs50", "vs51", "vs52", "vs53", "vs54", "vs55", "vs56",
- "vs57", "vs58", "vs59", "vs60", "vs61", "vs62", "vs63"
- };
+ static const char *const vsx_regnames[]
+ = { "vs0", "vs1", "vs2", "vs3", "vs4", "vs5", "vs6", "vs7",
+ "vs8", "vs9", "vs10", "vs11", "vs12", "vs13", "vs14", "vs15",
+ "vs16", "vs17", "vs18", "vs19", "vs20", "vs21", "vs22", "vs23",
+ "vs24", "vs25", "vs26", "vs27", "vs28", "vs29", "vs30", "vs31",
+ "vs32", "vs33", "vs34", "vs35", "vs36", "vs37", "vs38", "vs39",
+ "vs40", "vs41", "vs42", "vs43", "vs44", "vs45", "vs46", "vs47",
+ "vs48", "vs49", "vs50", "vs51", "vs52", "vs53", "vs54", "vs55",
+ "vs56", "vs57", "vs58", "vs59", "vs60", "vs61", "vs62", "vs63" };
return vsx_regnames[regno - tdep->ppc_vsr0_regnum];
}
/* Check if the this is a Extended FP pseudo-register. */
if (IS_EFP_PSEUDOREG (tdep, regno))
{
- static const char *const efpr_regnames[] = {
- "f32", "f33", "f34", "f35", "f36", "f37", "f38",
- "f39", "f40", "f41", "f42", "f43", "f44", "f45",
- "f46", "f47", "f48", "f49", "f50", "f51",
- "f52", "f53", "f54", "f55", "f56", "f57",
- "f58", "f59", "f60", "f61", "f62", "f63"
- };
+ static const char *const efpr_regnames[]
+ = { "f32", "f33", "f34", "f35", "f36", "f37", "f38", "f39",
+ "f40", "f41", "f42", "f43", "f44", "f45", "f46", "f47",
+ "f48", "f49", "f50", "f51", "f52", "f53", "f54", "f55",
+ "f56", "f57", "f58", "f59", "f60", "f61", "f62", "f63" };
return efpr_regnames[regno - tdep->ppc_efpr0_regnum];
}
/* Check if this is a Checkpointed DFP pseudo-register. */
if (IS_CDFP_PSEUDOREG (tdep, regno))
{
- static const char *const cdfp128_regnames[] = {
- "cdl0", "cdl1", "cdl2", "cdl3",
- "cdl4", "cdl5", "cdl6", "cdl7",
- "cdl8", "cdl9", "cdl10", "cdl11",
- "cdl12", "cdl13", "cdl14", "cdl15"
- };
+ static const char *const cdfp128_regnames[]
+ = { "cdl0", "cdl1", "cdl2", "cdl3", "cdl4", "cdl5",
+ "cdl6", "cdl7", "cdl8", "cdl9", "cdl10", "cdl11",
+ "cdl12", "cdl13", "cdl14", "cdl15" };
return cdfp128_regnames[regno - tdep->ppc_cdl0_regnum];
}
@@ -2570,15 +2499,14 @@ rs6000_register_name (struct gdbarch *gdbarch, int regno)
if (IS_CVSX_PSEUDOREG (tdep, regno))
{
static const char *const cvsx_regnames[] = {
- "cvs0", "cvs1", "cvs2", "cvs3", "cvs4", "cvs5", "cvs6", "cvs7",
- "cvs8", "cvs9", "cvs10", "cvs11", "cvs12", "cvs13", "cvs14",
- "cvs15", "cvs16", "cvs17", "cvs18", "cvs19", "cvs20", "cvs21",
- "cvs22", "cvs23", "cvs24", "cvs25", "cvs26", "cvs27", "cvs28",
- "cvs29", "cvs30", "cvs31", "cvs32", "cvs33", "cvs34", "cvs35",
- "cvs36", "cvs37", "cvs38", "cvs39", "cvs40", "cvs41", "cvs42",
- "cvs43", "cvs44", "cvs45", "cvs46", "cvs47", "cvs48", "cvs49",
- "cvs50", "cvs51", "cvs52", "cvs53", "cvs54", "cvs55", "cvs56",
- "cvs57", "cvs58", "cvs59", "cvs60", "cvs61", "cvs62", "cvs63"
+ "cvs0", "cvs1", "cvs2", "cvs3", "cvs4", "cvs5", "cvs6", "cvs7",
+ "cvs8", "cvs9", "cvs10", "cvs11", "cvs12", "cvs13", "cvs14", "cvs15",
+ "cvs16", "cvs17", "cvs18", "cvs19", "cvs20", "cvs21", "cvs22", "cvs23",
+ "cvs24", "cvs25", "cvs26", "cvs27", "cvs28", "cvs29", "cvs30", "cvs31",
+ "cvs32", "cvs33", "cvs34", "cvs35", "cvs36", "cvs37", "cvs38", "cvs39",
+ "cvs40", "cvs41", "cvs42", "cvs43", "cvs44", "cvs45", "cvs46", "cvs47",
+ "cvs48", "cvs49", "cvs50", "cvs51", "cvs52", "cvs53", "cvs54", "cvs55",
+ "cvs56", "cvs57", "cvs58", "cvs59", "cvs60", "cvs61", "cvs62", "cvs63"
};
return cvsx_regnames[regno - tdep->ppc_cvsr0_regnum];
}
@@ -2586,13 +2514,11 @@ rs6000_register_name (struct gdbarch *gdbarch, int regno)
/* Check if the this is a Checkpointed Extended FP pseudo-register. */
if (IS_CEFP_PSEUDOREG (tdep, regno))
{
- static const char *const cefpr_regnames[] = {
- "cf32", "cf33", "cf34", "cf35", "cf36", "cf37", "cf38",
- "cf39", "cf40", "cf41", "cf42", "cf43", "cf44", "cf45",
- "cf46", "cf47", "cf48", "cf49", "cf50", "cf51",
- "cf52", "cf53", "cf54", "cf55", "cf56", "cf57",
- "cf58", "cf59", "cf60", "cf61", "cf62", "cf63"
- };
+ static const char *const cefpr_regnames[]
+ = { "cf32", "cf33", "cf34", "cf35", "cf36", "cf37", "cf38", "cf39",
+ "cf40", "cf41", "cf42", "cf43", "cf44", "cf45", "cf46", "cf47",
+ "cf48", "cf49", "cf50", "cf51", "cf52", "cf53", "cf54", "cf55",
+ "cf56", "cf57", "cf58", "cf59", "cf60", "cf61", "cf62", "cf63" };
return cefpr_regnames[regno - tdep->ppc_cefpr0_regnum];
}
@@ -2610,26 +2536,22 @@ rs6000_pseudo_register_type (struct gdbarch *gdbarch, int regnum)
/* These are the e500 pseudo-registers. */
if (IS_SPE_PSEUDOREG (tdep, regnum))
return rs6000_builtin_type_vec64 (gdbarch);
- else if (IS_DFP_PSEUDOREG (tdep, regnum)
- || IS_CDFP_PSEUDOREG (tdep, regnum))
+ else if (IS_DFP_PSEUDOREG (tdep, regnum) || IS_CDFP_PSEUDOREG (tdep, regnum))
/* PPC decimal128 pseudo-registers. */
return builtin_type (gdbarch)->builtin_declong;
else if (IS_V_ALIAS_PSEUDOREG (tdep, regnum))
return gdbarch_register_type (gdbarch,
tdep->ppc_vr0_regnum
- + (regnum
- - tdep->ppc_v0_alias_regnum));
- else if (IS_VSX_PSEUDOREG (tdep, regnum)
- || IS_CVSX_PSEUDOREG (tdep, regnum))
+ + (regnum - tdep->ppc_v0_alias_regnum));
+ else if (IS_VSX_PSEUDOREG (tdep, regnum) || IS_CVSX_PSEUDOREG (tdep, regnum))
/* POWER7 VSX pseudo-registers. */
return rs6000_builtin_type_vec128 (gdbarch);
- else if (IS_EFP_PSEUDOREG (tdep, regnum)
- || IS_CEFP_PSEUDOREG (tdep, regnum))
+ else if (IS_EFP_PSEUDOREG (tdep, regnum) || IS_CEFP_PSEUDOREG (tdep, regnum))
/* POWER7 Extended FP pseudo-registers. */
return builtin_type (gdbarch)->builtin_double;
else
- internal_error (_("rs6000_pseudo_register_type: "
- "called on unexpected register '%s' (%d)"),
+ internal_error (_ ("rs6000_pseudo_register_type: "
+ "called on unexpected register '%s' (%d)"),
gdbarch_register_name (gdbarch, regnum), regnum);
}
@@ -2660,8 +2582,7 @@ rs6000_convert_register_p (struct gdbarch *gdbarch, int regnum,
{
ppc_gdbarch_tdep *tdep = gdbarch_tdep<ppc_gdbarch_tdep> (gdbarch);
- return (tdep->ppc_fp0_regnum >= 0
- && regnum >= tdep->ppc_fp0_regnum
+ return (tdep->ppc_fp0_regnum >= 0 && regnum >= tdep->ppc_fp0_regnum
&& regnum < tdep->ppc_fp0_regnum + ppc_num_fprs
&& type->code () == TYPE_CODE_FLT
&& (type->length ()
@@ -2669,34 +2590,28 @@ rs6000_convert_register_p (struct gdbarch *gdbarch, int regnum,
}
static int
-rs6000_register_to_value (frame_info_ptr frame,
- int regnum,
- struct type *type,
- gdb_byte *to,
- int *optimizedp, int *unavailablep)
+rs6000_register_to_value (frame_info_ptr frame, int regnum, struct type *type,
+ gdb_byte *to, int *optimizedp, int *unavailablep)
{
struct gdbarch *gdbarch = get_frame_arch (frame);
gdb_byte from[PPC_MAX_REGISTER_SIZE];
-
+
gdb_assert (type->code () == TYPE_CODE_FLT);
- if (!get_frame_register_bytes (frame, regnum, 0,
- gdb::make_array_view (from,
- register_size (gdbarch,
- regnum)),
- optimizedp, unavailablep))
+ if (!get_frame_register_bytes (
+ frame, regnum, 0,
+ gdb::make_array_view (from, register_size (gdbarch, regnum)),
+ optimizedp, unavailablep))
return 0;
- target_float_convert (from, builtin_type (gdbarch)->builtin_double,
- to, type);
+ target_float_convert (from, builtin_type (gdbarch)->builtin_double, to,
+ type);
*optimizedp = *unavailablep = 0;
return 1;
}
static void
-rs6000_value_to_register (frame_info_ptr frame,
- int regnum,
- struct type *type,
+rs6000_value_to_register (frame_info_ptr frame, int regnum, struct type *type,
const gdb_byte *from)
{
struct gdbarch *gdbarch = get_frame_arch (frame);
@@ -2704,15 +2619,15 @@ rs6000_value_to_register (frame_info_ptr frame,
gdb_assert (type->code () == TYPE_CODE_FLT);
- target_float_convert (from, type,
- to, builtin_type (gdbarch)->builtin_double);
+ target_float_convert (from, type, to,
+ builtin_type (gdbarch)->builtin_double);
put_frame_register (frame, regnum, to);
}
- /* The type of a function that moves the value of REG between CACHE
+/* The type of a function that moves the value of REG between CACHE
or BUF --- in either direction. */
-typedef enum register_status (*move_ev_register_func) (struct regcache *,
- int, void *);
+typedef enum register_status (*move_ev_register_func) (struct regcache *, int,
+ void *);
/* Move SPE vector register values between a 64-bit buffer and the two
32-bit raw register halves in a regcache. This function handles
@@ -2739,8 +2654,8 @@ typedef enum register_status (*move_ev_register_func) (struct regcache *,
co-variant type qualifiers, ... */
static enum register_status
-e500_move_ev_register (move_ev_register_func move,
- struct regcache *regcache, int ev_reg, void *buffer)
+e500_move_ev_register (move_ev_register_func move, struct regcache *regcache,
+ int ev_reg, void *buffer)
{
struct gdbarch *arch = regcache->arch ();
ppc_gdbarch_tdep *tdep = gdbarch_tdep<ppc_gdbarch_tdep> (arch);
@@ -2754,11 +2669,11 @@ e500_move_ev_register (move_ev_register_func move,
if (gdbarch_byte_order (arch) == BFD_ENDIAN_BIG)
{
- status = move (regcache, tdep->ppc_ev0_upper_regnum + reg_index,
- byte_buffer);
+ status
+ = move (regcache, tdep->ppc_ev0_upper_regnum + reg_index, byte_buffer);
if (status == REG_VALID)
- status = move (regcache, tdep->ppc_gp0_regnum + reg_index,
- byte_buffer + 4);
+ status
+ = move (regcache, tdep->ppc_gp0_regnum + reg_index, byte_buffer + 4);
}
else
{
@@ -2780,8 +2695,9 @@ do_regcache_raw_write (struct regcache *regcache, int regnum, void *buffer)
}
static enum register_status
-e500_pseudo_register_read (struct gdbarch *gdbarch, readable_regcache *regcache,
- int ev_reg, gdb_byte *buffer)
+e500_pseudo_register_read (struct gdbarch *gdbarch,
+ readable_regcache *regcache, int ev_reg,
+ gdb_byte *buffer)
{
struct gdbarch *arch = regcache->arch ();
ppc_gdbarch_tdep *tdep = gdbarch_tdep<ppc_gdbarch_tdep> (gdbarch);
@@ -2794,11 +2710,11 @@ e500_pseudo_register_read (struct gdbarch *gdbarch, readable_regcache *regcache,
if (gdbarch_byte_order (arch) == BFD_ENDIAN_BIG)
{
- status = regcache->raw_read (tdep->ppc_ev0_upper_regnum + reg_index,
- buffer);
+ status
+ = regcache->raw_read (tdep->ppc_ev0_upper_regnum + reg_index, buffer);
if (status == REG_VALID)
- status = regcache->raw_read (tdep->ppc_gp0_regnum + reg_index,
- buffer + 4);
+ status
+ = regcache->raw_read (tdep->ppc_gp0_regnum + reg_index, buffer + 4);
}
else
{
@@ -2809,21 +2725,20 @@ e500_pseudo_register_read (struct gdbarch *gdbarch, readable_regcache *regcache,
}
return status;
-
}
static void
e500_pseudo_register_write (struct gdbarch *gdbarch, struct regcache *regcache,
int reg_nr, const gdb_byte *buffer)
{
- e500_move_ev_register (do_regcache_raw_write, regcache,
- reg_nr, (void *) buffer);
+ e500_move_ev_register (do_regcache_raw_write, regcache, reg_nr,
+ (void *) buffer);
}
/* Read method for DFP pseudo-registers. */
static enum register_status
dfp_pseudo_register_read (struct gdbarch *gdbarch, readable_regcache *regcache,
- int reg_nr, gdb_byte *buffer)
+ int reg_nr, gdb_byte *buffer)
{
ppc_gdbarch_tdep *tdep = gdbarch_tdep<ppc_gdbarch_tdep> (gdbarch);
int reg_index, fp0;
@@ -2847,8 +2762,7 @@ dfp_pseudo_register_read (struct gdbarch *gdbarch, readable_regcache *regcache,
/* Read two FP registers to form a whole dl register. */
status = regcache->raw_read (fp0 + 2 * reg_index, buffer);
if (status == REG_VALID)
- status = regcache->raw_read (fp0 + 2 * reg_index + 1,
- buffer + 8);
+ status = regcache->raw_read (fp0 + 2 * reg_index + 1, buffer + 8);
}
else
{
@@ -2863,7 +2777,7 @@ dfp_pseudo_register_read (struct gdbarch *gdbarch, readable_regcache *regcache,
/* Write method for DFP pseudo-registers. */
static void
dfp_pseudo_register_write (struct gdbarch *gdbarch, struct regcache *regcache,
- int reg_nr, const gdb_byte *buffer)
+ int reg_nr, const gdb_byte *buffer)
{
ppc_gdbarch_tdep *tdep = gdbarch_tdep<ppc_gdbarch_tdep> (gdbarch);
int reg_index, fp0;
@@ -2906,7 +2820,7 @@ v_alias_pseudo_register_read (struct gdbarch *gdbarch,
gdb_assert (IS_V_ALIAS_PSEUDOREG (tdep, reg_nr));
return regcache->raw_read (tdep->ppc_vr0_regnum
- + (reg_nr - tdep->ppc_v0_alias_regnum),
+ + (reg_nr - tdep->ppc_v0_alias_regnum),
buffer);
}
@@ -2914,20 +2828,21 @@ v_alias_pseudo_register_read (struct gdbarch *gdbarch,
static void
v_alias_pseudo_register_write (struct gdbarch *gdbarch,
- struct regcache *regcache,
- int reg_nr, const gdb_byte *buffer)
+ struct regcache *regcache, int reg_nr,
+ const gdb_byte *buffer)
{
ppc_gdbarch_tdep *tdep = gdbarch_tdep<ppc_gdbarch_tdep> (gdbarch);
gdb_assert (IS_V_ALIAS_PSEUDOREG (tdep, reg_nr));
regcache->raw_write (tdep->ppc_vr0_regnum
- + (reg_nr - tdep->ppc_v0_alias_regnum), buffer);
+ + (reg_nr - tdep->ppc_v0_alias_regnum),
+ buffer);
}
/* Read method for POWER7 VSX pseudo-registers. */
static enum register_status
vsx_pseudo_register_read (struct gdbarch *gdbarch, readable_regcache *regcache,
- int reg_nr, gdb_byte *buffer)
+ int reg_nr, gdb_byte *buffer)
{
ppc_gdbarch_tdep *tdep = gdbarch_tdep<ppc_gdbarch_tdep> (gdbarch);
int reg_index, vr0, fp0, vsr0_upper;
@@ -2959,8 +2874,7 @@ vsx_pseudo_register_read (struct gdbarch *gdbarch, readable_regcache *regcache,
{
status = regcache->raw_read (fp0 + reg_index, buffer);
if (status == REG_VALID)
- status = regcache->raw_read (vsr0_upper + reg_index,
- buffer + 8);
+ status = regcache->raw_read (vsr0_upper + reg_index, buffer + 8);
}
else
{
@@ -2975,7 +2889,7 @@ vsx_pseudo_register_read (struct gdbarch *gdbarch, readable_regcache *regcache,
/* Write method for POWER7 VSX pseudo-registers. */
static void
vsx_pseudo_register_write (struct gdbarch *gdbarch, struct regcache *regcache,
- int reg_nr, const gdb_byte *buffer)
+ int reg_nr, const gdb_byte *buffer)
{
ppc_gdbarch_tdep *tdep = gdbarch_tdep<ppc_gdbarch_tdep> (gdbarch);
int reg_index, vr0, fp0, vsr0_upper;
@@ -3017,7 +2931,7 @@ vsx_pseudo_register_write (struct gdbarch *gdbarch, struct regcache *regcache,
/* Read method for POWER7 Extended FP pseudo-registers. */
static enum register_status
efp_pseudo_register_read (struct gdbarch *gdbarch, readable_regcache *regcache,
- int reg_nr, gdb_byte *buffer)
+ int reg_nr, gdb_byte *buffer)
{
ppc_gdbarch_tdep *tdep = gdbarch_tdep<ppc_gdbarch_tdep> (gdbarch);
int reg_index, vr0;
@@ -3039,14 +2953,13 @@ efp_pseudo_register_read (struct gdbarch *gdbarch, readable_regcache *regcache,
/* Read the portion that overlaps the VMX register. */
return regcache->raw_read_part (vr0 + reg_index, offset,
- register_size (gdbarch, reg_nr),
- buffer);
+ register_size (gdbarch, reg_nr), buffer);
}
/* Write method for POWER7 Extended FP pseudo-registers. */
static void
efp_pseudo_register_write (struct gdbarch *gdbarch, struct regcache *regcache,
- int reg_nr, const gdb_byte *buffer)
+ int reg_nr, const gdb_byte *buffer)
{
ppc_gdbarch_tdep *tdep = gdbarch_tdep<ppc_gdbarch_tdep> (gdbarch);
int reg_index, vr0;
@@ -3069,8 +2982,8 @@ efp_pseudo_register_write (struct gdbarch *gdbarch, struct regcache *regcache,
so we check this manually and throw an error if needed. */
regcache->raw_update (vr0 + reg_index);
if (regcache->get_register_status (vr0 + reg_index) != REG_VALID)
- error (_("Cannot write to the checkpointed EFP register, "
- "the corresponding vector register is unavailable."));
+ error (_ ("Cannot write to the checkpointed EFP register, "
+ "the corresponding vector register is unavailable."));
}
/* Write the portion that overlaps the VMX register. */
@@ -3080,8 +2993,8 @@ efp_pseudo_register_write (struct gdbarch *gdbarch, struct regcache *regcache,
static enum register_status
rs6000_pseudo_register_read (struct gdbarch *gdbarch,
- readable_regcache *regcache,
- int reg_nr, gdb_byte *buffer)
+ readable_regcache *regcache, int reg_nr,
+ gdb_byte *buffer)
{
struct gdbarch *regcache_arch = regcache->arch ();
ppc_gdbarch_tdep *tdep = gdbarch_tdep<ppc_gdbarch_tdep> (gdbarch);
@@ -3090,28 +3003,24 @@ rs6000_pseudo_register_read (struct gdbarch *gdbarch,
if (IS_SPE_PSEUDOREG (tdep, reg_nr))
return e500_pseudo_register_read (gdbarch, regcache, reg_nr, buffer);
- else if (IS_DFP_PSEUDOREG (tdep, reg_nr)
- || IS_CDFP_PSEUDOREG (tdep, reg_nr))
+ else if (IS_DFP_PSEUDOREG (tdep, reg_nr) || IS_CDFP_PSEUDOREG (tdep, reg_nr))
return dfp_pseudo_register_read (gdbarch, regcache, reg_nr, buffer);
else if (IS_V_ALIAS_PSEUDOREG (tdep, reg_nr))
- return v_alias_pseudo_register_read (gdbarch, regcache, reg_nr,
- buffer);
- else if (IS_VSX_PSEUDOREG (tdep, reg_nr)
- || IS_CVSX_PSEUDOREG (tdep, reg_nr))
+ return v_alias_pseudo_register_read (gdbarch, regcache, reg_nr, buffer);
+ else if (IS_VSX_PSEUDOREG (tdep, reg_nr) || IS_CVSX_PSEUDOREG (tdep, reg_nr))
return vsx_pseudo_register_read (gdbarch, regcache, reg_nr, buffer);
- else if (IS_EFP_PSEUDOREG (tdep, reg_nr)
- || IS_CEFP_PSEUDOREG (tdep, reg_nr))
+ else if (IS_EFP_PSEUDOREG (tdep, reg_nr) || IS_CEFP_PSEUDOREG (tdep, reg_nr))
return efp_pseudo_register_read (gdbarch, regcache, reg_nr, buffer);
else
- internal_error (_("rs6000_pseudo_register_read: "
- "called on unexpected register '%s' (%d)"),
+ internal_error (_ ("rs6000_pseudo_register_read: "
+ "called on unexpected register '%s' (%d)"),
gdbarch_register_name (gdbarch, reg_nr), reg_nr);
}
static void
rs6000_pseudo_register_write (struct gdbarch *gdbarch,
- struct regcache *regcache,
- int reg_nr, const gdb_byte *buffer)
+ struct regcache *regcache, int reg_nr,
+ const gdb_byte *buffer)
{
struct gdbarch *regcache_arch = regcache->arch ();
ppc_gdbarch_tdep *tdep = gdbarch_tdep<ppc_gdbarch_tdep> (gdbarch);
@@ -3120,20 +3029,17 @@ rs6000_pseudo_register_write (struct gdbarch *gdbarch,
if (IS_SPE_PSEUDOREG (tdep, reg_nr))
e500_pseudo_register_write (gdbarch, regcache, reg_nr, buffer);
- else if (IS_DFP_PSEUDOREG (tdep, reg_nr)
- || IS_CDFP_PSEUDOREG (tdep, reg_nr))
+ else if (IS_DFP_PSEUDOREG (tdep, reg_nr) || IS_CDFP_PSEUDOREG (tdep, reg_nr))
dfp_pseudo_register_write (gdbarch, regcache, reg_nr, buffer);
else if (IS_V_ALIAS_PSEUDOREG (tdep, reg_nr))
v_alias_pseudo_register_write (gdbarch, regcache, reg_nr, buffer);
- else if (IS_VSX_PSEUDOREG (tdep, reg_nr)
- || IS_CVSX_PSEUDOREG (tdep, reg_nr))
+ else if (IS_VSX_PSEUDOREG (tdep, reg_nr) || IS_CVSX_PSEUDOREG (tdep, reg_nr))
vsx_pseudo_register_write (gdbarch, regcache, reg_nr, buffer);
- else if (IS_EFP_PSEUDOREG (tdep, reg_nr)
- || IS_CEFP_PSEUDOREG (tdep, reg_nr))
+ else if (IS_EFP_PSEUDOREG (tdep, reg_nr) || IS_CEFP_PSEUDOREG (tdep, reg_nr))
efp_pseudo_register_write (gdbarch, regcache, reg_nr, buffer);
else
- internal_error (_("rs6000_pseudo_register_write: "
- "called on unexpected register '%s' (%d)"),
+ internal_error (_ ("rs6000_pseudo_register_write: "
+ "called on unexpected register '%s' (%d)"),
gdbarch_register_name (gdbarch, reg_nr), reg_nr);
}
@@ -3141,8 +3047,8 @@ rs6000_pseudo_register_write (struct gdbarch *gdbarch,
checkpointed DFP pseudo-register REG_NR. */
static void
-dfp_ax_pseudo_register_collect (struct gdbarch *gdbarch,
- struct agent_expr *ax, int reg_nr)
+dfp_ax_pseudo_register_collect (struct gdbarch *gdbarch, struct agent_expr *ax,
+ int reg_nr)
{
ppc_gdbarch_tdep *tdep = gdbarch_tdep<ppc_gdbarch_tdep> (gdbarch);
int reg_index, fp0;
@@ -3174,16 +3080,16 @@ v_alias_pseudo_register_collect (struct gdbarch *gdbarch,
ppc_gdbarch_tdep *tdep = gdbarch_tdep<ppc_gdbarch_tdep> (gdbarch);
gdb_assert (IS_V_ALIAS_PSEUDOREG (tdep, reg_nr));
- ax_reg_mask (ax, tdep->ppc_vr0_regnum
- + (reg_nr - tdep->ppc_v0_alias_regnum));
+ ax_reg_mask (ax,
+ tdep->ppc_vr0_regnum + (reg_nr - tdep->ppc_v0_alias_regnum));
}
/* Set the register mask in AX with the registers that form the VSX or
checkpointed VSX pseudo-register REG_NR. */
static void
-vsx_ax_pseudo_register_collect (struct gdbarch *gdbarch,
- struct agent_expr *ax, int reg_nr)
+vsx_ax_pseudo_register_collect (struct gdbarch *gdbarch, struct agent_expr *ax,
+ int reg_nr)
{
ppc_gdbarch_tdep *tdep = gdbarch_tdep<ppc_gdbarch_tdep> (gdbarch);
int reg_index, vr0, fp0, vsr0_upper;
@@ -3220,8 +3126,8 @@ vsx_ax_pseudo_register_collect (struct gdbarch *gdbarch,
the EFP or checkpointed EFP pseudo-register REG_NR. */
static void
-efp_ax_pseudo_register_collect (struct gdbarch *gdbarch,
- struct agent_expr *ax, int reg_nr)
+efp_ax_pseudo_register_collect (struct gdbarch *gdbarch, struct agent_expr *ax,
+ int reg_nr)
{
ppc_gdbarch_tdep *tdep = gdbarch_tdep<ppc_gdbarch_tdep> (gdbarch);
int reg_index, vr0;
@@ -3253,8 +3159,7 @@ rs6000_ax_pseudo_register_collect (struct gdbarch *gdbarch,
ax_reg_mask (ax, tdep->ppc_gp0_regnum + reg_index);
ax_reg_mask (ax, tdep->ppc_ev0_upper_regnum + reg_index);
}
- else if (IS_DFP_PSEUDOREG (tdep, reg_nr)
- || IS_CDFP_PSEUDOREG (tdep, reg_nr))
+ else if (IS_DFP_PSEUDOREG (tdep, reg_nr) || IS_CDFP_PSEUDOREG (tdep, reg_nr))
{
dfp_ax_pseudo_register_collect (gdbarch, ax, reg_nr);
}
@@ -3262,28 +3167,24 @@ rs6000_ax_pseudo_register_collect (struct gdbarch *gdbarch,
{
v_alias_pseudo_register_collect (gdbarch, ax, reg_nr);
}
- else if (IS_VSX_PSEUDOREG (tdep, reg_nr)
- || IS_CVSX_PSEUDOREG (tdep, reg_nr))
+ else if (IS_VSX_PSEUDOREG (tdep, reg_nr) || IS_CVSX_PSEUDOREG (tdep, reg_nr))
{
vsx_ax_pseudo_register_collect (gdbarch, ax, reg_nr);
}
- else if (IS_EFP_PSEUDOREG (tdep, reg_nr)
- || IS_CEFP_PSEUDOREG (tdep, reg_nr))
+ else if (IS_EFP_PSEUDOREG (tdep, reg_nr) || IS_CEFP_PSEUDOREG (tdep, reg_nr))
{
efp_ax_pseudo_register_collect (gdbarch, ax, reg_nr);
}
else
- internal_error (_("rs6000_pseudo_register_collect: "
- "called on unexpected register '%s' (%d)"),
+ internal_error (_ ("rs6000_pseudo_register_collect: "
+ "called on unexpected register '%s' (%d)"),
gdbarch_register_name (gdbarch, reg_nr), reg_nr);
return 0;
}
-
static void
-rs6000_gen_return_address (struct gdbarch *gdbarch,
- struct agent_expr *ax, struct axs_value *value,
- CORE_ADDR scope)
+rs6000_gen_return_address (struct gdbarch *gdbarch, struct agent_expr *ax,
+ struct axs_value *value, CORE_ADDR scope)
{
ppc_gdbarch_tdep *tdep = gdbarch_tdep<ppc_gdbarch_tdep> (gdbarch);
value->type = register_type (gdbarch, tdep->ppc_lr_regnum);
@@ -3291,7 +3192,6 @@ rs6000_gen_return_address (struct gdbarch *gdbarch,
value->u.reg = tdep->ppc_lr_regnum;
}
-
/* Convert a DBX STABS register number to a GDB register number. */
static int
rs6000_stab_reg_to_regnum (struct gdbarch *gdbarch, int num)
@@ -3312,13 +3212,13 @@ rs6000_stab_reg_to_regnum (struct gdbarch *gdbarch, int num)
else
switch (num)
{
- case 64:
+ case 64:
return tdep->ppc_mq_regnum;
case 65:
return tdep->ppc_lr_regnum;
- case 66:
+ case 66:
return tdep->ppc_ctr_regnum;
- case 76:
+ case 76:
return tdep->ppc_xer_regnum;
case 109:
return tdep->ppc_vrsave_regnum;
@@ -3328,12 +3228,11 @@ rs6000_stab_reg_to_regnum (struct gdbarch *gdbarch, int num)
return tdep->ppc_acc_regnum;
case 112:
return tdep->ppc_spefscr_regnum;
- default:
+ default:
return num;
}
}
-
/* Convert a Dwarf 2 register number to a GDB register number. */
static int
rs6000_dwarf2_reg_to_regnum (struct gdbarch *gdbarch, int num)
@@ -3412,7 +3311,7 @@ rs6000_adjust_frame_regnum (struct gdbarch *gdbarch, int num, int eh_frame_p)
/* .eh_frame is GCC specific. For binary compatibility, it uses GCC
internal register numbering; translate that to the standard DWARF2
register numbering. */
- if (0 <= num && num <= 63) /* r0-r31,fp0-fp31 */
+ if (0 <= num && num <= 63) /* r0-r31,fp0-fp31 */
return num;
else if (68 <= num && num <= 75) /* cr0-cr8 */
return num - 68 + 86;
@@ -3441,86 +3340,83 @@ rs6000_adjust_frame_regnum (struct gdbarch *gdbarch, int num, int eh_frame_p)
return num;
}
}
-
/* Handling the various POWER/PowerPC variants. */
/* Information about a particular processor variant. */
struct ppc_variant
- {
- /* Name of this variant. */
- const char *name;
-
- /* English description of the variant. */
- const char *description;
+{
+ /* Name of this variant. */
+ const char *name;
- /* bfd_arch_info.arch corresponding to variant. */
- enum bfd_architecture arch;
+ /* English description of the variant. */
+ const char *description;
- /* bfd_arch_info.mach corresponding to variant. */
- unsigned long mach;
+ /* bfd_arch_info.arch corresponding to variant. */
+ enum bfd_architecture arch;
- /* Target description for this variant. */
- const struct target_desc **tdesc;
- };
+ /* bfd_arch_info.mach corresponding to variant. */
+ unsigned long mach;
-static struct ppc_variant variants[] =
-{
- {"powerpc", "PowerPC user-level", bfd_arch_powerpc,
- bfd_mach_ppc, &tdesc_powerpc_altivec32},
- {"power", "POWER user-level", bfd_arch_rs6000,
- bfd_mach_rs6k, &tdesc_rs6000},
- {"403", "IBM PowerPC 403", bfd_arch_powerpc,
- bfd_mach_ppc_403, &tdesc_powerpc_403},
- {"405", "IBM PowerPC 405", bfd_arch_powerpc,
- bfd_mach_ppc_405, &tdesc_powerpc_405},
- {"601", "Motorola PowerPC 601", bfd_arch_powerpc,
- bfd_mach_ppc_601, &tdesc_powerpc_601},
- {"602", "Motorola PowerPC 602", bfd_arch_powerpc,
- bfd_mach_ppc_602, &tdesc_powerpc_602},
- {"603", "Motorola/IBM PowerPC 603 or 603e", bfd_arch_powerpc,
- bfd_mach_ppc_603, &tdesc_powerpc_603},
- {"604", "Motorola PowerPC 604 or 604e", bfd_arch_powerpc,
- 604, &tdesc_powerpc_604},
- {"403GC", "IBM PowerPC 403GC", bfd_arch_powerpc,
- bfd_mach_ppc_403gc, &tdesc_powerpc_403gc},
- {"505", "Motorola PowerPC 505", bfd_arch_powerpc,
- bfd_mach_ppc_505, &tdesc_powerpc_505},
- {"860", "Motorola PowerPC 860 or 850", bfd_arch_powerpc,
- bfd_mach_ppc_860, &tdesc_powerpc_860},
- {"750", "Motorola/IBM PowerPC 750 or 740", bfd_arch_powerpc,
- bfd_mach_ppc_750, &tdesc_powerpc_750},
- {"7400", "Motorola/IBM PowerPC 7400 (G4)", bfd_arch_powerpc,
- bfd_mach_ppc_7400, &tdesc_powerpc_7400},
- {"e500", "Motorola PowerPC e500", bfd_arch_powerpc,
- bfd_mach_ppc_e500, &tdesc_powerpc_e500},
-
- /* 64-bit */
- {"powerpc64", "PowerPC 64-bit user-level", bfd_arch_powerpc,
- bfd_mach_ppc64, &tdesc_powerpc_altivec64},
- {"620", "Motorola PowerPC 620", bfd_arch_powerpc,
- bfd_mach_ppc_620, &tdesc_powerpc_64},
- {"630", "Motorola PowerPC 630", bfd_arch_powerpc,
- bfd_mach_ppc_630, &tdesc_powerpc_64},
- {"a35", "PowerPC A35", bfd_arch_powerpc,
- bfd_mach_ppc_a35, &tdesc_powerpc_64},
- {"rs64ii", "PowerPC rs64ii", bfd_arch_powerpc,
- bfd_mach_ppc_rs64ii, &tdesc_powerpc_64},
- {"rs64iii", "PowerPC rs64iii", bfd_arch_powerpc,
- bfd_mach_ppc_rs64iii, &tdesc_powerpc_64},
-
- /* FIXME: I haven't checked the register sets of the following. */
- {"rs1", "IBM POWER RS1", bfd_arch_rs6000,
- bfd_mach_rs6k_rs1, &tdesc_rs6000},
- {"rsc", "IBM POWER RSC", bfd_arch_rs6000,
- bfd_mach_rs6k_rsc, &tdesc_rs6000},
- {"rs2", "IBM POWER RS2", bfd_arch_rs6000,
- bfd_mach_rs6k_rs2, &tdesc_rs6000},
-
- {0, 0, (enum bfd_architecture) 0, 0, 0}
+ /* Target description for this variant. */
+ const struct target_desc **tdesc;
};
+static struct ppc_variant variants[]
+ = { { "powerpc", "PowerPC user-level", bfd_arch_powerpc, bfd_mach_ppc,
+ &tdesc_powerpc_altivec32 },
+ { "power", "POWER user-level", bfd_arch_rs6000, bfd_mach_rs6k,
+ &tdesc_rs6000 },
+ { "403", "IBM PowerPC 403", bfd_arch_powerpc, bfd_mach_ppc_403,
+ &tdesc_powerpc_403 },
+ { "405", "IBM PowerPC 405", bfd_arch_powerpc, bfd_mach_ppc_405,
+ &tdesc_powerpc_405 },
+ { "601", "Motorola PowerPC 601", bfd_arch_powerpc, bfd_mach_ppc_601,
+ &tdesc_powerpc_601 },
+ { "602", "Motorola PowerPC 602", bfd_arch_powerpc, bfd_mach_ppc_602,
+ &tdesc_powerpc_602 },
+ { "603", "Motorola/IBM PowerPC 603 or 603e", bfd_arch_powerpc,
+ bfd_mach_ppc_603, &tdesc_powerpc_603 },
+ { "604", "Motorola PowerPC 604 or 604e", bfd_arch_powerpc, 604,
+ &tdesc_powerpc_604 },
+ { "403GC", "IBM PowerPC 403GC", bfd_arch_powerpc, bfd_mach_ppc_403gc,
+ &tdesc_powerpc_403gc },
+ { "505", "Motorola PowerPC 505", bfd_arch_powerpc, bfd_mach_ppc_505,
+ &tdesc_powerpc_505 },
+ { "860", "Motorola PowerPC 860 or 850", bfd_arch_powerpc,
+ bfd_mach_ppc_860, &tdesc_powerpc_860 },
+ { "750", "Motorola/IBM PowerPC 750 or 740", bfd_arch_powerpc,
+ bfd_mach_ppc_750, &tdesc_powerpc_750 },
+ { "7400", "Motorola/IBM PowerPC 7400 (G4)", bfd_arch_powerpc,
+ bfd_mach_ppc_7400, &tdesc_powerpc_7400 },
+ { "e500", "Motorola PowerPC e500", bfd_arch_powerpc, bfd_mach_ppc_e500,
+ &tdesc_powerpc_e500 },
+
+ /* 64-bit */
+ { "powerpc64", "PowerPC 64-bit user-level", bfd_arch_powerpc,
+ bfd_mach_ppc64, &tdesc_powerpc_altivec64 },
+ { "620", "Motorola PowerPC 620", bfd_arch_powerpc, bfd_mach_ppc_620,
+ &tdesc_powerpc_64 },
+ { "630", "Motorola PowerPC 630", bfd_arch_powerpc, bfd_mach_ppc_630,
+ &tdesc_powerpc_64 },
+ { "a35", "PowerPC A35", bfd_arch_powerpc, bfd_mach_ppc_a35,
+ &tdesc_powerpc_64 },
+ { "rs64ii", "PowerPC rs64ii", bfd_arch_powerpc, bfd_mach_ppc_rs64ii,
+ &tdesc_powerpc_64 },
+ { "rs64iii", "PowerPC rs64iii", bfd_arch_powerpc, bfd_mach_ppc_rs64iii,
+ &tdesc_powerpc_64 },
+
+ /* FIXME: I haven't checked the register sets of the following. */
+ { "rs1", "IBM POWER RS1", bfd_arch_rs6000, bfd_mach_rs6k_rs1,
+ &tdesc_rs6000 },
+ { "rsc", "IBM POWER RSC", bfd_arch_rs6000, bfd_mach_rs6k_rsc,
+ &tdesc_rs6000 },
+ { "rs2", "IBM POWER RS2", bfd_arch_rs6000, bfd_mach_rs6k_rs2,
+ &tdesc_rs6000 },
+
+ { 0, 0, (enum bfd_architecture) 0, 0, 0 } };
+
/* Return the variant corresponding to architecture ARCH and machine number
MACH. If no such variant exists, return null. */
@@ -3536,8 +3432,6 @@ find_variant_by_arch (enum bfd_architecture arch, unsigned long mach)
return NULL;
}
-
-
struct rs6000_frame_cache
{
CORE_ADDR base;
@@ -3584,8 +3478,8 @@ rs6000_frame_cache (frame_info_ptr this_frame, void **this_cache)
->frame pointed to the outer-most address of the frame. In
the mean time, the address of the prev frame is used as the
base address of this frame. */
- cache->base = get_frame_register_unsigned
- (this_frame, gdbarch_sp_regnum (gdbarch));
+ cache->base = get_frame_register_unsigned (this_frame,
+ gdbarch_sp_regnum (gdbarch));
}
catch (const gdb_exception_error &ex)
{
@@ -3630,8 +3524,8 @@ rs6000_frame_cache (frame_info_ptr this_frame, void **this_cache)
/* Frameless really means stackless. */
ULONGEST backchain;
- if (safe_read_memory_unsigned_integer (cache->base, wordsize,
- byte_order, &backchain))
+ if (safe_read_memory_unsigned_integer (cache->base, wordsize, byte_order,
+ &backchain))
cache->base = (CORE_ADDR) backchain;
}
@@ -3723,14 +3617,14 @@ rs6000_frame_cache (frame_info_ptr this_frame, void **this_cache)
else if (fdata.lr_register != -1)
cache->saved_regs[tdep->ppc_lr_regnum].set_realreg (fdata.lr_register);
/* The PC is found in the link register. */
- cache->saved_regs[gdbarch_pc_regnum (gdbarch)] =
- cache->saved_regs[tdep->ppc_lr_regnum];
+ cache->saved_regs[gdbarch_pc_regnum (gdbarch)]
+ = cache->saved_regs[tdep->ppc_lr_regnum];
/* If != 0, fdata.vrsave_offset is the offset from the frame that
holds the VRSAVE. */
if (fdata.vrsave_offset != 0)
- cache->saved_regs[tdep->ppc_vrsave_regnum].set_addr (cache->base
- + fdata.vrsave_offset);
+ cache->saved_regs[tdep->ppc_vrsave_regnum].set_addr (
+ cache->base + fdata.vrsave_offset);
if (fdata.alloca_reg < 0)
/* If no alloca register used, then fi->frame is the value of the
@@ -3749,8 +3643,8 @@ static void
rs6000_frame_this_id (frame_info_ptr this_frame, void **this_cache,
struct frame_id *this_id)
{
- struct rs6000_frame_cache *info = rs6000_frame_cache (this_frame,
- this_cache);
+ struct rs6000_frame_cache *info
+ = rs6000_frame_cache (this_frame, this_cache);
if (!info->base_p)
{
@@ -3766,24 +3660,22 @@ rs6000_frame_this_id (frame_info_ptr this_frame, void **this_cache,
}
static struct value *
-rs6000_frame_prev_register (frame_info_ptr this_frame,
- void **this_cache, int regnum)
+rs6000_frame_prev_register (frame_info_ptr this_frame, void **this_cache,
+ int regnum)
{
- struct rs6000_frame_cache *info = rs6000_frame_cache (this_frame,
- this_cache);
+ struct rs6000_frame_cache *info
+ = rs6000_frame_cache (this_frame, this_cache);
return trad_frame_get_prev_register (this_frame, info->saved_regs, regnum);
}
-static const struct frame_unwind rs6000_frame_unwind =
-{
- "rs6000 prologue",
- NORMAL_FRAME,
- default_frame_unwind_stop_reason,
- rs6000_frame_this_id,
- rs6000_frame_prev_register,
- NULL,
- default_frame_sniffer
-};
+static const struct frame_unwind rs6000_frame_unwind
+ = { "rs6000 prologue",
+ NORMAL_FRAME,
+ default_frame_unwind_stop_reason,
+ rs6000_frame_this_id,
+ rs6000_frame_prev_register,
+ NULL,
+ default_frame_sniffer };
/* Allocate and initialize a frame cache for an epilogue frame.
SP is restored and prev-PC is stored in LR. */
@@ -3808,7 +3700,8 @@ rs6000_epilogue_frame_cache (frame_info_ptr this_frame, void **this_cache)
function, and the return address is stored in LR. */
CORE_ADDR sp, lr;
- sp = get_frame_register_unsigned (this_frame, gdbarch_sp_regnum (gdbarch));
+ sp = get_frame_register_unsigned (this_frame,
+ gdbarch_sp_regnum (gdbarch));
lr = get_frame_register_unsigned (this_frame, tdep->ppc_lr_regnum);
cache->base = sp;
@@ -3829,12 +3722,12 @@ rs6000_epilogue_frame_cache (frame_info_ptr this_frame, void **this_cache)
Return the frame ID of an epilogue frame. */
static void
-rs6000_epilogue_frame_this_id (frame_info_ptr this_frame,
- void **this_cache, struct frame_id *this_id)
+rs6000_epilogue_frame_this_id (frame_info_ptr this_frame, void **this_cache,
+ struct frame_id *this_id)
{
CORE_ADDR pc;
- struct rs6000_frame_cache *info =
- rs6000_epilogue_frame_cache (this_frame, this_cache);
+ struct rs6000_frame_cache *info
+ = rs6000_epilogue_frame_cache (this_frame, this_cache);
pc = get_frame_func (this_frame);
if (info->base == 0)
@@ -3850,8 +3743,8 @@ static struct value *
rs6000_epilogue_frame_prev_register (frame_info_ptr this_frame,
void **this_cache, int regnum)
{
- struct rs6000_frame_cache *info =
- rs6000_epilogue_frame_cache (this_frame, this_cache);
+ struct rs6000_frame_cache *info
+ = rs6000_epilogue_frame_cache (this_frame, this_cache);
return trad_frame_get_prev_register (this_frame, info->saved_regs, regnum);
}
@@ -3874,31 +3767,26 @@ rs6000_epilogue_frame_sniffer (const struct frame_unwind *self,
/* Frame unwinder for epilogue frame. This is required for reverse step-over
a function without debug information. */
-static const struct frame_unwind rs6000_epilogue_frame_unwind =
-{
- "rs6000 epilogue",
- NORMAL_FRAME,
- default_frame_unwind_stop_reason,
- rs6000_epilogue_frame_this_id, rs6000_epilogue_frame_prev_register,
- NULL,
- rs6000_epilogue_frame_sniffer
-};
-
+static const struct frame_unwind rs6000_epilogue_frame_unwind
+ = { "rs6000 epilogue",
+ NORMAL_FRAME,
+ default_frame_unwind_stop_reason,
+ rs6000_epilogue_frame_this_id,
+ rs6000_epilogue_frame_prev_register,
+ NULL,
+ rs6000_epilogue_frame_sniffer };
static CORE_ADDR
rs6000_frame_base_address (frame_info_ptr this_frame, void **this_cache)
{
- struct rs6000_frame_cache *info = rs6000_frame_cache (this_frame,
- this_cache);
+ struct rs6000_frame_cache *info
+ = rs6000_frame_cache (this_frame, this_cache);
return info->initial_sp;
}
-static const struct frame_base rs6000_frame_base = {
- &rs6000_frame_unwind,
- rs6000_frame_base_address,
- rs6000_frame_base_address,
- rs6000_frame_base_address
-};
+static const struct frame_base rs6000_frame_base
+ = { &rs6000_frame_unwind, rs6000_frame_base_address,
+ rs6000_frame_base_address, rs6000_frame_base_address };
static const struct frame_base *
rs6000_frame_base_sniffer (frame_info_ptr this_frame)
@@ -3911,8 +3799,8 @@ rs6000_frame_base_sniffer (frame_info_ptr this_frame)
static void
ppc_dwarf2_frame_init_reg (struct gdbarch *gdbarch, int regnum,
- struct dwarf2_frame_state_reg *reg,
- frame_info_ptr this_frame)
+ struct dwarf2_frame_state_reg *reg,
+ frame_info_ptr this_frame)
{
ppc_gdbarch_tdep *tdep = gdbarch_tdep<ppc_gdbarch_tdep> (gdbarch);
@@ -3921,13 +3809,13 @@ ppc_dwarf2_frame_init_reg (struct gdbarch *gdbarch, int regnum,
/* Call-saved GP registers. */
if ((regnum >= tdep->ppc_gp0_regnum + 14
- && regnum <= tdep->ppc_gp0_regnum + 31)
+ && regnum <= tdep->ppc_gp0_regnum + 31)
|| (regnum == tdep->ppc_gp0_regnum + 1))
reg->how = DWARF2_FRAME_REG_SAME_VALUE;
/* Call-clobbered GP registers. */
if ((regnum >= tdep->ppc_gp0_regnum + 3
- && regnum <= tdep->ppc_gp0_regnum + 12)
+ && regnum <= tdep->ppc_gp0_regnum + 12)
|| (regnum == tdep->ppc_gp0_regnum))
reg->how = DWARF2_FRAME_REG_UNDEFINED;
@@ -3936,12 +3824,12 @@ ppc_dwarf2_frame_init_reg (struct gdbarch *gdbarch, int regnum,
{
/* Call-saved FP registers. */
if ((regnum >= tdep->ppc_fp0_regnum + 14
- && regnum <= tdep->ppc_fp0_regnum + 31))
+ && regnum <= tdep->ppc_fp0_regnum + 31))
reg->how = DWARF2_FRAME_REG_SAME_VALUE;
/* Call-clobbered FP registers. */
if ((regnum >= tdep->ppc_fp0_regnum
- && regnum <= tdep->ppc_fp0_regnum + 13))
+ && regnum <= tdep->ppc_fp0_regnum + 13))
reg->how = DWARF2_FRAME_REG_UNDEFINED;
}
@@ -3950,13 +3838,13 @@ ppc_dwarf2_frame_init_reg (struct gdbarch *gdbarch, int regnum,
{
/* Call-saved Altivec registers. */
if ((regnum >= tdep->ppc_vr0_regnum + 20
- && regnum <= tdep->ppc_vr0_regnum + 31)
+ && regnum <= tdep->ppc_vr0_regnum + 31)
|| regnum == tdep->ppc_vrsave_regnum)
reg->how = DWARF2_FRAME_REG_SAME_VALUE;
/* Call-clobbered Altivec registers. */
if ((regnum >= tdep->ppc_vr0_regnum
- && regnum <= tdep->ppc_vr0_regnum + 19))
+ && regnum <= tdep->ppc_vr0_regnum + 19))
reg->how = DWARF2_FRAME_REG_UNDEFINED;
}
@@ -3967,7 +3855,6 @@ ppc_dwarf2_frame_init_reg (struct gdbarch *gdbarch, int regnum,
reg->how = DWARF2_FRAME_REG_CFA;
}
-
/* Return true if a .gnu_attributes section exists in BFD and it
indicates we are using SPE extensions OR if a .PPC.EMB.apuinfo
section exists in BFD and it indicates that SPE extensions are in
@@ -3990,8 +3877,8 @@ bfd_uses_spe_extensions (bfd *abfd)
/* Using Tag_GNU_Power_ABI_Vector here is a bit of a hack, as the user
could be using the SPE vector abi without actually using any spe
bits whatsoever. But it's close enough for now. */
- int vector_abi = bfd_elf_get_obj_attr_int (abfd, OBJ_ATTR_GNU,
- Tag_GNU_Power_ABI_Vector);
+ int vector_abi
+ = bfd_elf_get_obj_attr_int (abfd, OBJ_ATTR_GNU, Tag_GNU_Power_ABI_Vector);
if (vector_abi == 3)
return 1;
#endif
@@ -4044,8 +3931,7 @@ bfd_uses_spe_extensions (bfd *abfd)
ptr += 12;
/* The name must be "APUinfo\0". */
- if (name_len != 8
- && strcmp ((const char *) ptr, "APUinfo") != 0)
+ if (name_len != 8 && strcmp ((const char *) ptr, "APUinfo") != 0)
break;
ptr += name_len;
@@ -4089,52 +3975,51 @@ bfd_uses_spe_extensions (bfd *abfd)
/* These are macros for parsing instruction fields (I.1.6.28) */
#define PPC_FIELD(value, from, len) \
- (((value) >> (32 - (from) - (len))) & ((1 << (len)) - 1))
-#define PPC_SEXT(v, bs) \
- ((((CORE_ADDR) (v) & (((CORE_ADDR) 1 << (bs)) - 1)) \
- ^ ((CORE_ADDR) 1 << ((bs) - 1))) \
- - ((CORE_ADDR) 1 << ((bs) - 1)))
-#define PPC_OP6(insn) PPC_FIELD (insn, 0, 6)
-#define PPC_EXTOP(insn) PPC_FIELD (insn, 21, 10)
-#define PPC_RT(insn) PPC_FIELD (insn, 6, 5)
-#define PPC_RS(insn) PPC_FIELD (insn, 6, 5)
-#define PPC_RA(insn) PPC_FIELD (insn, 11, 5)
-#define PPC_RB(insn) PPC_FIELD (insn, 16, 5)
-#define PPC_NB(insn) PPC_FIELD (insn, 16, 5)
-#define PPC_VRT(insn) PPC_FIELD (insn, 6, 5)
-#define PPC_FRT(insn) PPC_FIELD (insn, 6, 5)
-#define PPC_SPR(insn) (PPC_FIELD (insn, 11, 5) \
- | (PPC_FIELD (insn, 16, 5) << 5))
-#define PPC_BO(insn) PPC_FIELD (insn, 6, 5)
-#define PPC_T(insn) PPC_FIELD (insn, 6, 5)
-#define PPC_D(insn) PPC_SEXT (PPC_FIELD (insn, 16, 16), 16)
-#define PPC_DS(insn) PPC_SEXT (PPC_FIELD (insn, 16, 14), 14)
-#define PPC_DQ(insn) PPC_SEXT (PPC_FIELD (insn, 16, 12), 12)
-#define PPC_BIT(insn,n) ((insn & (1 << (31 - (n)))) ? 1 : 0)
-#define PPC_OE(insn) PPC_BIT (insn, 21)
-#define PPC_RC(insn) PPC_BIT (insn, 31)
-#define PPC_Rc(insn) PPC_BIT (insn, 21)
-#define PPC_LK(insn) PPC_BIT (insn, 31)
-#define PPC_TX(insn) PPC_BIT (insn, 31)
-#define PPC_LEV(insn) PPC_FIELD (insn, 20, 7)
-
-#define PPC_XT(insn) ((PPC_TX (insn) << 5) | PPC_T (insn))
-#define PPC_XTp(insn) ((PPC_BIT (insn, 10) << 5) \
- | PPC_FIELD (insn, 6, 4) << 1)
-#define PPC_XSp(insn) ((PPC_BIT (insn, 10) << 5) \
- | PPC_FIELD (insn, 6, 4) << 1)
-#define PPC_XER_NB(xer) (xer & 0x7f)
+ (((value) >> (32 - (from) - (len))) & ((1 << (len)) - 1))
+#define PPC_SEXT(v, bs) \
+ ((((CORE_ADDR) (v) & (((CORE_ADDR) 1 << (bs)) - 1)) \
+ ^ ((CORE_ADDR) 1 << ((bs) -1))) \
+ - ((CORE_ADDR) 1 << ((bs) -1)))
+#define PPC_OP6(insn) PPC_FIELD (insn, 0, 6)
+#define PPC_EXTOP(insn) PPC_FIELD (insn, 21, 10)
+#define PPC_RT(insn) PPC_FIELD (insn, 6, 5)
+#define PPC_RS(insn) PPC_FIELD (insn, 6, 5)
+#define PPC_RA(insn) PPC_FIELD (insn, 11, 5)
+#define PPC_RB(insn) PPC_FIELD (insn, 16, 5)
+#define PPC_NB(insn) PPC_FIELD (insn, 16, 5)
+#define PPC_VRT(insn) PPC_FIELD (insn, 6, 5)
+#define PPC_FRT(insn) PPC_FIELD (insn, 6, 5)
+#define PPC_SPR(insn) \
+ (PPC_FIELD (insn, 11, 5) | (PPC_FIELD (insn, 16, 5) << 5))
+#define PPC_BO(insn) PPC_FIELD (insn, 6, 5)
+#define PPC_T(insn) PPC_FIELD (insn, 6, 5)
+#define PPC_D(insn) PPC_SEXT (PPC_FIELD (insn, 16, 16), 16)
+#define PPC_DS(insn) PPC_SEXT (PPC_FIELD (insn, 16, 14), 14)
+#define PPC_DQ(insn) PPC_SEXT (PPC_FIELD (insn, 16, 12), 12)
+#define PPC_BIT(insn, n) ((insn & (1 << (31 - (n)))) ? 1 : 0)
+#define PPC_OE(insn) PPC_BIT (insn, 21)
+#define PPC_RC(insn) PPC_BIT (insn, 31)
+#define PPC_Rc(insn) PPC_BIT (insn, 21)
+#define PPC_LK(insn) PPC_BIT (insn, 31)
+#define PPC_TX(insn) PPC_BIT (insn, 31)
+#define PPC_LEV(insn) PPC_FIELD (insn, 20, 7)
+
+#define PPC_XT(insn) ((PPC_TX (insn) << 5) | PPC_T (insn))
+#define PPC_XTp(insn) ((PPC_BIT (insn, 10) << 5) | PPC_FIELD (insn, 6, 4) << 1)
+#define PPC_XSp(insn) ((PPC_BIT (insn, 10) << 5) | PPC_FIELD (insn, 6, 4) << 1)
+#define PPC_XER_NB(xer) (xer & 0x7f)
/* The following macros are for the prefixed instructions. */
-#define P_PPC_D(insn_prefix, insn_suffix) \
+#define P_PPC_D(insn_prefix, insn_suffix) \
PPC_SEXT (PPC_FIELD (insn_prefix, 14, 18) << 16 \
- | PPC_FIELD (insn_suffix, 16, 16), 34)
-#define P_PPC_TX5(insn_sufix) PPC_BIT (insn_suffix, 5)
+ | PPC_FIELD (insn_suffix, 16, 16), \
+ 34)
+#define P_PPC_TX5(insn_sufix) PPC_BIT (insn_suffix, 5)
#define P_PPC_TX15(insn_suffix) PPC_BIT (insn_suffix, 15)
-#define P_PPC_XT(insn_suffix) ((PPC_TX (insn_suffix) << 5) \
- | PPC_T (insn_suffix))
-#define P_PPC_XT5(insn_suffix) ((P_PPC_TX5 (insn_suffix) << 5) \
- | PPC_T (insn_suffix))
+#define P_PPC_XT(insn_suffix) \
+ ((PPC_TX (insn_suffix) << 5) | PPC_T (insn_suffix))
+#define P_PPC_XT5(insn_suffix) \
+ ((P_PPC_TX5 (insn_suffix) << 5) | PPC_T (insn_suffix))
#define P_PPC_XT15(insn_suffix) \
((P_PPC_TX15 (insn_suffix) << 5) | PPC_T (insn_suffix))
@@ -4151,7 +4036,8 @@ ppc_record_vsr (struct regcache *regcache, ppc_gdbarch_tdep *tdep, int vsr)
if (vsr >= 32)
{
if (tdep->ppc_vr0_regnum >= 0)
- record_full_arch_list_add_reg (regcache, tdep->ppc_vr0_regnum + vsr - 32);
+ record_full_arch_list_add_reg (regcache,
+ tdep->ppc_vr0_regnum + vsr - 32);
}
else
{
@@ -4205,11 +4091,10 @@ ppc_record_ACC_fpscr (struct regcache *regcache, ppc_gdbarch_tdep *tdep,
/* ACC maps over the same VSR space as the fp registers. */
for (i = 0; i < 4; i++)
{
- record_full_arch_list_add_reg (regcache, tdep->ppc_fp0_regnum
- + entry * 4 + i);
record_full_arch_list_add_reg (regcache,
- tdep->ppc_vsr0_upper_regnum
- + entry * 4 + i);
+ tdep->ppc_fp0_regnum + entry * 4 + i);
+ record_full_arch_list_add_reg (regcache, tdep->ppc_vsr0_upper_regnum
+ + entry * 4 + i);
}
if (save_fpscr)
@@ -4231,61 +4116,61 @@ ppc_process_record_op4 (struct gdbarch *gdbarch, struct regcache *regcache,
switch (ext & 0x3f)
{
- case 32: /* Vector Multiply-High-Add Signed Halfword Saturate */
- case 33: /* Vector Multiply-High-Round-Add Signed Halfword Saturate */
- case 39: /* Vector Multiply-Sum Unsigned Halfword Saturate */
- case 41: /* Vector Multiply-Sum Signed Halfword Saturate */
+ case 32: /* Vector Multiply-High-Add Signed Halfword Saturate */
+ case 33: /* Vector Multiply-High-Round-Add Signed Halfword Saturate */
+ case 39: /* Vector Multiply-Sum Unsigned Halfword Saturate */
+ case 41: /* Vector Multiply-Sum Signed Halfword Saturate */
record_full_arch_list_add_reg (regcache, PPC_VSCR_REGNUM);
/* FALL-THROUGH */
- case 20: /* Move To VSR Byte Mask Immediate opcode, b2 = 0,
+ case 20: /* Move To VSR Byte Mask Immediate opcode, b2 = 0,
ignore bit 31 */
- case 21: /* Move To VSR Byte Mask Immediate opcode, b2 = 1,
+ case 21: /* Move To VSR Byte Mask Immediate opcode, b2 = 1,
ignore bit 31 */
- case 23: /* Vector Multiply-Sum & write Carry-out Unsigned
+ case 23: /* Vector Multiply-Sum & write Carry-out Unsigned
Doubleword */
- case 24: /* Vector Extract Double Unsigned Byte to VSR
+ case 24: /* Vector Extract Double Unsigned Byte to VSR
using GPR-specified Left-Index */
- case 25: /* Vector Extract Double Unsigned Byte to VSR
+ case 25: /* Vector Extract Double Unsigned Byte to VSR
using GPR-specified Right-Index */
- case 26: /* Vector Extract Double Unsigned Halfword to VSR
+ case 26: /* Vector Extract Double Unsigned Halfword to VSR
using GPR-specified Left-Index */
- case 27: /* Vector Extract Double Unsigned Halfword to VSR
+ case 27: /* Vector Extract Double Unsigned Halfword to VSR
using GPR-specified Right-Index */
- case 28: /* Vector Extract Double Unsigned Word to VSR
+ case 28: /* Vector Extract Double Unsigned Word to VSR
using GPR-specified Left-Index */
- case 29: /* Vector Extract Double Unsigned Word to VSR
+ case 29: /* Vector Extract Double Unsigned Word to VSR
using GPR-specified Right-Index */
- case 30: /* Vector Extract Double Unsigned Doubleword to VSR
+ case 30: /* Vector Extract Double Unsigned Doubleword to VSR
using GPR-specified Left-Index */
- case 31: /* Vector Extract Double Unsigned Doubleword to VSR
+ case 31: /* Vector Extract Double Unsigned Doubleword to VSR
using GPR-specified Right-Index */
- case 42: /* Vector Select */
- case 43: /* Vector Permute */
- case 59: /* Vector Permute Right-indexed */
- case 22: /* Vector Shift
+ case 42: /* Vector Select */
+ case 43: /* Vector Permute */
+ case 59: /* Vector Permute Right-indexed */
+ case 22: /* Vector Shift
Left Double by Bit Immediate if insn[21] = 0
Right Double by Bit Immediate if insn[21] = 1 */
- case 44: /* Vector Shift Left Double by Octet Immediate */
- case 45: /* Vector Permute and Exclusive-OR */
- case 60: /* Vector Add Extended Unsigned Quadword Modulo */
- case 61: /* Vector Add Extended & write Carry Unsigned Quadword */
- case 62: /* Vector Subtract Extended Unsigned Quadword Modulo */
- case 63: /* Vector Subtract Extended & write Carry Unsigned Quadword */
- case 34: /* Vector Multiply-Low-Add Unsigned Halfword Modulo */
- case 35: /* Vector Multiply-Sum Unsigned Doubleword Modulo */
- case 36: /* Vector Multiply-Sum Unsigned Byte Modulo */
- case 37: /* Vector Multiply-Sum Mixed Byte Modulo */
- case 38: /* Vector Multiply-Sum Unsigned Halfword Modulo */
- case 40: /* Vector Multiply-Sum Signed Halfword Modulo */
- case 46: /* Vector Multiply-Add Single-Precision */
- case 47: /* Vector Negative Multiply-Subtract Single-Precision */
+ case 44: /* Vector Shift Left Double by Octet Immediate */
+ case 45: /* Vector Permute and Exclusive-OR */
+ case 60: /* Vector Add Extended Unsigned Quadword Modulo */
+ case 61: /* Vector Add Extended & write Carry Unsigned Quadword */
+ case 62: /* Vector Subtract Extended Unsigned Quadword Modulo */
+ case 63: /* Vector Subtract Extended & write Carry Unsigned Quadword */
+ case 34: /* Vector Multiply-Low-Add Unsigned Halfword Modulo */
+ case 35: /* Vector Multiply-Sum Unsigned Doubleword Modulo */
+ case 36: /* Vector Multiply-Sum Unsigned Byte Modulo */
+ case 37: /* Vector Multiply-Sum Mixed Byte Modulo */
+ case 38: /* Vector Multiply-Sum Unsigned Halfword Modulo */
+ case 40: /* Vector Multiply-Sum Signed Halfword Modulo */
+ case 46: /* Vector Multiply-Add Single-Precision */
+ case 47: /* Vector Negative Multiply-Subtract Single-Precision */
record_full_arch_list_add_reg (regcache,
tdep->ppc_vr0_regnum + PPC_VRT (insn));
return 0;
- case 48: /* Multiply-Add High Doubleword */
- case 49: /* Multiply-Add High Doubleword Unsigned */
- case 51: /* Multiply-Add Low Doubleword */
+ case 48: /* Multiply-Add High Doubleword */
+ case 49: /* Multiply-Add High Doubleword Unsigned */
+ case 51: /* Multiply-Add Low Doubleword */
record_full_arch_list_add_reg (regcache,
tdep->ppc_gp0_regnum + PPC_RT (insn));
return 0;
@@ -4300,19 +4185,19 @@ ppc_process_record_op4 (struct gdbarch *gdbarch, struct regcache *regcache,
&& vra != 5 /* Decimal Convert To National */
&& vra != 6 /* Decimal Convert From Zoned */
&& vra != 7 /* Decimal Convert From National */
- && vra != 31) /* Decimal Set Sign */
+ && vra != 31) /* Decimal Set Sign */
break;
/* Fall through. */
- /* 5.16 Decimal Integer Arithmetic Instructions */
- case 1: /* Decimal Add Modulo */
- case 65: /* Decimal Subtract Modulo */
+ /* 5.16 Decimal Integer Arithmetic Instructions */
+ case 1: /* Decimal Add Modulo */
+ case 65: /* Decimal Subtract Modulo */
- case 193: /* Decimal Shift */
- case 129: /* Decimal Unsigned Shift */
- case 449: /* Decimal Shift and Round */
+ case 193: /* Decimal Shift */
+ case 129: /* Decimal Unsigned Shift */
+ case 449: /* Decimal Shift and Round */
- case 257: /* Decimal Truncate */
- case 321: /* Decimal Unsigned Truncate */
+ case 257: /* Decimal Truncate */
+ case 321: /* Decimal Unsigned Truncate */
/* Bit-21 should be set. */
if (!PPC_BIT (insn, 21))
@@ -4327,34 +4212,34 @@ ppc_process_record_op4 (struct gdbarch *gdbarch, struct regcache *regcache,
/* Bit-21 is used for RC */
switch (ext & 0x3ff)
{
- case 5: /* Vector Rotate Left Quadword */
- case 69: /* Vector Rotate Left Quadword then Mask Insert */
- case 325: /* Vector Rotate Left Quadword then AND with Mask */
- case 6: /* Vector Compare Equal To Unsigned Byte */
- case 70: /* Vector Compare Equal To Unsigned Halfword */
- case 134: /* Vector Compare Equal To Unsigned Word */
- case 199: /* Vector Compare Equal To Unsigned Doubleword */
- case 774: /* Vector Compare Greater Than Signed Byte */
- case 838: /* Vector Compare Greater Than Signed Halfword */
- case 902: /* Vector Compare Greater Than Signed Word */
- case 967: /* Vector Compare Greater Than Signed Doubleword */
- case 903: /* Vector Compare Greater Than Signed Quadword */
- case 518: /* Vector Compare Greater Than Unsigned Byte */
- case 646: /* Vector Compare Greater Than Unsigned Word */
- case 582: /* Vector Compare Greater Than Unsigned Halfword */
- case 711: /* Vector Compare Greater Than Unsigned Doubleword */
- case 647: /* Vector Compare Greater Than Unsigned Quadword */
- case 966: /* Vector Compare Bounds Single-Precision */
- case 198: /* Vector Compare Equal To Single-Precision */
- case 454: /* Vector Compare Greater Than or Equal To Single-Precision */
- case 455: /* Vector Compare Equal Quadword */
- case 710: /* Vector Compare Greater Than Single-Precision */
- case 7: /* Vector Compare Not Equal Byte */
- case 71: /* Vector Compare Not Equal Halfword */
- case 135: /* Vector Compare Not Equal Word */
- case 263: /* Vector Compare Not Equal or Zero Byte */
- case 327: /* Vector Compare Not Equal or Zero Halfword */
- case 391: /* Vector Compare Not Equal or Zero Word */
+ case 5: /* Vector Rotate Left Quadword */
+ case 69: /* Vector Rotate Left Quadword then Mask Insert */
+ case 325: /* Vector Rotate Left Quadword then AND with Mask */
+ case 6: /* Vector Compare Equal To Unsigned Byte */
+ case 70: /* Vector Compare Equal To Unsigned Halfword */
+ case 134: /* Vector Compare Equal To Unsigned Word */
+ case 199: /* Vector Compare Equal To Unsigned Doubleword */
+ case 774: /* Vector Compare Greater Than Signed Byte */
+ case 838: /* Vector Compare Greater Than Signed Halfword */
+ case 902: /* Vector Compare Greater Than Signed Word */
+ case 967: /* Vector Compare Greater Than Signed Doubleword */
+ case 903: /* Vector Compare Greater Than Signed Quadword */
+ case 518: /* Vector Compare Greater Than Unsigned Byte */
+ case 646: /* Vector Compare Greater Than Unsigned Word */
+ case 582: /* Vector Compare Greater Than Unsigned Halfword */
+ case 711: /* Vector Compare Greater Than Unsigned Doubleword */
+ case 647: /* Vector Compare Greater Than Unsigned Quadword */
+ case 966: /* Vector Compare Bounds Single-Precision */
+ case 198: /* Vector Compare Equal To Single-Precision */
+ case 454: /* Vector Compare Greater Than or Equal To Single-Precision */
+ case 455: /* Vector Compare Equal Quadword */
+ case 710: /* Vector Compare Greater Than Single-Precision */
+ case 7: /* Vector Compare Not Equal Byte */
+ case 71: /* Vector Compare Not Equal Halfword */
+ case 135: /* Vector Compare Not Equal Word */
+ case 263: /* Vector Compare Not Equal or Zero Byte */
+ case 327: /* Vector Compare Not Equal or Zero Halfword */
+ case 391: /* Vector Compare Not Equal or Zero Word */
if (PPC_Rc (insn))
record_full_arch_list_add_reg (regcache, tdep->ppc_cr_regnum);
record_full_arch_list_add_reg (regcache,
@@ -4362,50 +4247,49 @@ ppc_process_record_op4 (struct gdbarch *gdbarch, struct regcache *regcache,
return 0;
case 13:
- switch (vra) /* Bit-21 is used for RC */
+ switch (vra) /* Bit-21 is used for RC */
{
- case 0: /* Vector String Isolate Byte Left-justified */
- case 1: /* Vector String Isolate Byte Right-justified */
- case 2: /* Vector String Isolate Halfword Left-justified */
- case 3: /* Vector String Isolate Halfword Right-justified */
+ case 0: /* Vector String Isolate Byte Left-justified */
+ case 1: /* Vector String Isolate Byte Right-justified */
+ case 2: /* Vector String Isolate Halfword Left-justified */
+ case 3: /* Vector String Isolate Halfword Right-justified */
if (PPC_Rc (insn))
record_full_arch_list_add_reg (regcache, tdep->ppc_cr_regnum);
- record_full_arch_list_add_reg (regcache,
- tdep->ppc_vr0_regnum
- + PPC_VRT (insn));
- return 0;
+ record_full_arch_list_add_reg (regcache, tdep->ppc_vr0_regnum
+ + PPC_VRT (insn));
+ return 0;
}
}
- if (ext == 1538)
+ if (ext == 1538)
{
switch (vra)
{
- case 0: /* Vector Count Leading Zero Least-Significant Bits
+ case 0: /* Vector Count Leading Zero Least-Significant Bits
Byte */
- case 1: /* Vector Count Trailing Zero Least-Significant Bits
+ case 1: /* Vector Count Trailing Zero Least-Significant Bits
Byte */
record_full_arch_list_add_reg (regcache,
tdep->ppc_gp0_regnum + PPC_RT (insn));
return 0;
- case 6: /* Vector Negate Word */
- case 7: /* Vector Negate Doubleword */
- case 8: /* Vector Parity Byte Word */
- case 9: /* Vector Parity Byte Doubleword */
- case 10: /* Vector Parity Byte Quadword */
- case 16: /* Vector Extend Sign Byte To Word */
- case 17: /* Vector Extend Sign Halfword To Word */
- case 24: /* Vector Extend Sign Byte To Doubleword */
- case 25: /* Vector Extend Sign Halfword To Doubleword */
- case 26: /* Vector Extend Sign Word To Doubleword */
- case 27: /* Vector Extend Sign Doubleword To Quadword */
- case 28: /* Vector Count Trailing Zeros Byte */
- case 29: /* Vector Count Trailing Zeros Halfword */
- case 30: /* Vector Count Trailing Zeros Word */
- case 31: /* Vector Count Trailing Zeros Doubleword */
- record_full_arch_list_add_reg (regcache,
- tdep->ppc_vr0_regnum + PPC_VRT (insn));
+ case 6: /* Vector Negate Word */
+ case 7: /* Vector Negate Doubleword */
+ case 8: /* Vector Parity Byte Word */
+ case 9: /* Vector Parity Byte Doubleword */
+ case 10: /* Vector Parity Byte Quadword */
+ case 16: /* Vector Extend Sign Byte To Word */
+ case 17: /* Vector Extend Sign Halfword To Word */
+ case 24: /* Vector Extend Sign Byte To Doubleword */
+ case 25: /* Vector Extend Sign Halfword To Doubleword */
+ case 26: /* Vector Extend Sign Word To Doubleword */
+ case 27: /* Vector Extend Sign Doubleword To Quadword */
+ case 28: /* Vector Count Trailing Zeros Byte */
+ case 29: /* Vector Count Trailing Zeros Halfword */
+ case 30: /* Vector Count Trailing Zeros Word */
+ case 31: /* Vector Count Trailing Zeros Doubleword */
+ record_full_arch_list_add_reg (regcache, tdep->ppc_vr0_regnum
+ + PPC_VRT (insn));
return 0;
}
}
@@ -4414,34 +4298,34 @@ ppc_process_record_op4 (struct gdbarch *gdbarch, struct regcache *regcache,
{
switch (vra)
{
- case 0: /* Vector Expand Byte Mask */
- case 1: /* Vector Expand Halfword Mask */
- case 2: /* Vector Expand Word Mask */
- case 3: /* Vector Expand Doubleword Mask */
- case 4: /* Vector Expand Quadword Mask */
- case 16: /* Move to VSR Byte Mask */
- case 17: /* Move to VSR Halfword Mask */
- case 18: /* Move to VSR Word Mask */
- case 19: /* Move to VSR Doubleword Mask */
- case 20: /* Move to VSR Quadword Mask */
+ case 0: /* Vector Expand Byte Mask */
+ case 1: /* Vector Expand Halfword Mask */
+ case 2: /* Vector Expand Word Mask */
+ case 3: /* Vector Expand Doubleword Mask */
+ case 4: /* Vector Expand Quadword Mask */
+ case 16: /* Move to VSR Byte Mask */
+ case 17: /* Move to VSR Halfword Mask */
+ case 18: /* Move to VSR Word Mask */
+ case 19: /* Move to VSR Doubleword Mask */
+ case 20: /* Move to VSR Quadword Mask */
ppc_record_vsr (regcache, tdep, PPC_VRT (insn) + 32);
return 0;
- case 8: /* Vector Extract Byte Mask */
- case 9: /* Vector Extract Halfword Mask */
- case 10: /* Vector Extract Word Mask */
- case 11: /* Vector Extract Doubleword Mask */
- case 12: /* Vector Extract Quadword Mask */
+ case 8: /* Vector Extract Byte Mask */
+ case 9: /* Vector Extract Halfword Mask */
+ case 10: /* Vector Extract Word Mask */
+ case 11: /* Vector Extract Doubleword Mask */
+ case 12: /* Vector Extract Quadword Mask */
/* Ignore the MP bit in the LSB position of the vra value. */
- case 24: /* Vector Count Mask Bits Byte, MP = 0 */
- case 25: /* Vector Count Mask Bits Byte, MP = 1 */
- case 26: /* Vector Count Mask Bits Halfword, MP = 0 */
- case 27: /* Vector Count Mask Bits Halfword, MP = 1 */
- case 28: /* Vector Count Mask Bits Word, MP = 0 */
- case 29: /* Vector Count Mask Bits Word, MP = 1 */
- case 30: /* Vector Count Mask Bits Doubleword, MP = 0 */
- case 31: /* Vector Count Mask Bits Doubleword, MP = 1 */
+ case 24: /* Vector Count Mask Bits Byte, MP = 0 */
+ case 25: /* Vector Count Mask Bits Byte, MP = 1 */
+ case 26: /* Vector Count Mask Bits Halfword, MP = 0 */
+ case 27: /* Vector Count Mask Bits Halfword, MP = 1 */
+ case 28: /* Vector Count Mask Bits Word, MP = 0 */
+ case 29: /* Vector Count Mask Bits Word, MP = 1 */
+ case 30: /* Vector Count Mask Bits Doubleword, MP = 0 */
+ case 31: /* Vector Count Mask Bits Doubleword, MP = 1 */
record_full_arch_list_add_reg (regcache,
tdep->ppc_gp0_regnum + PPC_RT (insn));
record_full_arch_list_add_reg (regcache,
@@ -4452,311 +4336,312 @@ ppc_process_record_op4 (struct gdbarch *gdbarch, struct regcache *regcache,
switch (ext)
{
-
- case 257: /* Vector Compare Unsigned Quadword */
- case 321: /* Vector Compare Signed Quadword */
+ case 257: /* Vector Compare Unsigned Quadword */
+ case 321: /* Vector Compare Signed Quadword */
/* Comparison tests that always set CR field BF */
record_full_arch_list_add_reg (regcache, tdep->ppc_cr_regnum);
record_full_arch_list_add_reg (regcache,
tdep->ppc_vr0_regnum + PPC_VRT (insn));
return 0;
- case 142: /* Vector Pack Unsigned Halfword Unsigned Saturate */
- case 206: /* Vector Pack Unsigned Word Unsigned Saturate */
- case 270: /* Vector Pack Signed Halfword Unsigned Saturate */
- case 334: /* Vector Pack Signed Word Unsigned Saturate */
- case 398: /* Vector Pack Signed Halfword Signed Saturate */
- case 462: /* Vector Pack Signed Word Signed Saturate */
- case 1230: /* Vector Pack Unsigned Doubleword Unsigned Saturate */
- case 1358: /* Vector Pack Signed Doubleword Unsigned Saturate */
- case 1486: /* Vector Pack Signed Doubleword Signed Saturate */
- case 512: /* Vector Add Unsigned Byte Saturate */
- case 576: /* Vector Add Unsigned Halfword Saturate */
- case 640: /* Vector Add Unsigned Word Saturate */
- case 768: /* Vector Add Signed Byte Saturate */
- case 832: /* Vector Add Signed Halfword Saturate */
- case 896: /* Vector Add Signed Word Saturate */
- case 1536: /* Vector Subtract Unsigned Byte Saturate */
- case 1600: /* Vector Subtract Unsigned Halfword Saturate */
- case 1664: /* Vector Subtract Unsigned Word Saturate */
- case 1792: /* Vector Subtract Signed Byte Saturate */
- case 1856: /* Vector Subtract Signed Halfword Saturate */
- case 1920: /* Vector Subtract Signed Word Saturate */
-
- case 1544: /* Vector Sum across Quarter Unsigned Byte Saturate */
- case 1800: /* Vector Sum across Quarter Signed Byte Saturate */
- case 1608: /* Vector Sum across Quarter Signed Halfword Saturate */
- case 1672: /* Vector Sum across Half Signed Word Saturate */
- case 1928: /* Vector Sum across Signed Word Saturate */
- case 970: /* Vector Convert To Signed Fixed-Point Word Saturate */
- case 906: /* Vector Convert To Unsigned Fixed-Point Word Saturate */
+ case 142: /* Vector Pack Unsigned Halfword Unsigned Saturate */
+ case 206: /* Vector Pack Unsigned Word Unsigned Saturate */
+ case 270: /* Vector Pack Signed Halfword Unsigned Saturate */
+ case 334: /* Vector Pack Signed Word Unsigned Saturate */
+ case 398: /* Vector Pack Signed Halfword Signed Saturate */
+ case 462: /* Vector Pack Signed Word Signed Saturate */
+ case 1230: /* Vector Pack Unsigned Doubleword Unsigned Saturate */
+ case 1358: /* Vector Pack Signed Doubleword Unsigned Saturate */
+ case 1486: /* Vector Pack Signed Doubleword Signed Saturate */
+ case 512: /* Vector Add Unsigned Byte Saturate */
+ case 576: /* Vector Add Unsigned Halfword Saturate */
+ case 640: /* Vector Add Unsigned Word Saturate */
+ case 768: /* Vector Add Signed Byte Saturate */
+ case 832: /* Vector Add Signed Halfword Saturate */
+ case 896: /* Vector Add Signed Word Saturate */
+ case 1536: /* Vector Subtract Unsigned Byte Saturate */
+ case 1600: /* Vector Subtract Unsigned Halfword Saturate */
+ case 1664: /* Vector Subtract Unsigned Word Saturate */
+ case 1792: /* Vector Subtract Signed Byte Saturate */
+ case 1856: /* Vector Subtract Signed Halfword Saturate */
+ case 1920: /* Vector Subtract Signed Word Saturate */
+
+ case 1544: /* Vector Sum across Quarter Unsigned Byte Saturate */
+ case 1800: /* Vector Sum across Quarter Signed Byte Saturate */
+ case 1608: /* Vector Sum across Quarter Signed Halfword Saturate */
+ case 1672: /* Vector Sum across Half Signed Word Saturate */
+ case 1928: /* Vector Sum across Signed Word Saturate */
+ case 970: /* Vector Convert To Signed Fixed-Point Word Saturate */
+ case 906: /* Vector Convert To Unsigned Fixed-Point Word Saturate */
record_full_arch_list_add_reg (regcache, PPC_VSCR_REGNUM);
/* FALL-THROUGH */
- case 12: /* Vector Merge High Byte */
- case 14: /* Vector Pack Unsigned Halfword Unsigned Modulo */
- case 76: /* Vector Merge High Halfword */
- case 78: /* Vector Pack Unsigned Word Unsigned Modulo */
- case 140: /* Vector Merge High Word */
- case 268: /* Vector Merge Low Byte */
- case 332: /* Vector Merge Low Halfword */
- case 396: /* Vector Merge Low Word */
- case 397: /* Vector Clear Leftmost Bytes */
- case 461: /* Vector Clear Rightmost Bytes */
- case 526: /* Vector Unpack High Signed Byte */
- case 590: /* Vector Unpack High Signed Halfword */
- case 654: /* Vector Unpack Low Signed Byte */
- case 718: /* Vector Unpack Low Signed Halfword */
- case 782: /* Vector Pack Pixel */
- case 846: /* Vector Unpack High Pixel */
- case 974: /* Vector Unpack Low Pixel */
- case 1102: /* Vector Pack Unsigned Doubleword Unsigned Modulo */
- case 1614: /* Vector Unpack High Signed Word */
- case 1676: /* Vector Merge Odd Word */
- case 1742: /* Vector Unpack Low Signed Word */
- case 1932: /* Vector Merge Even Word */
- case 524: /* Vector Splat Byte */
- case 588: /* Vector Splat Halfword */
- case 652: /* Vector Splat Word */
- case 780: /* Vector Splat Immediate Signed Byte */
- case 844: /* Vector Splat Immediate Signed Halfword */
- case 908: /* Vector Splat Immediate Signed Word */
- case 261: /* Vector Shift Left Quadword */
- case 452: /* Vector Shift Left */
- case 517: /* Vector Shift Right Quadword */
- case 708: /* Vector Shift Right */
- case 773: /* Vector Shift Right Algebraic Quadword */
- case 1036: /* Vector Shift Left by Octet */
- case 1100: /* Vector Shift Right by Octet */
- case 0: /* Vector Add Unsigned Byte Modulo */
- case 64: /* Vector Add Unsigned Halfword Modulo */
- case 128: /* Vector Add Unsigned Word Modulo */
- case 192: /* Vector Add Unsigned Doubleword Modulo */
- case 256: /* Vector Add Unsigned Quadword Modulo */
- case 320: /* Vector Add & write Carry Unsigned Quadword */
- case 384: /* Vector Add and Write Carry-Out Unsigned Word */
- case 8: /* Vector Multiply Odd Unsigned Byte */
- case 72: /* Vector Multiply Odd Unsigned Halfword */
- case 136: /* Vector Multiply Odd Unsigned Word */
- case 200: /* Vector Multiply Odd Unsigned Doubleword */
- case 264: /* Vector Multiply Odd Signed Byte */
- case 328: /* Vector Multiply Odd Signed Halfword */
- case 392: /* Vector Multiply Odd Signed Word */
- case 456: /* Vector Multiply Odd Signed Doubleword */
- case 520: /* Vector Multiply Even Unsigned Byte */
- case 584: /* Vector Multiply Even Unsigned Halfword */
- case 648: /* Vector Multiply Even Unsigned Word */
- case 712: /* Vector Multiply Even Unsigned Doubleword */
- case 776: /* Vector Multiply Even Signed Byte */
- case 840: /* Vector Multiply Even Signed Halfword */
- case 904: /* Vector Multiply Even Signed Word */
- case 968: /* Vector Multiply Even Signed Doubleword */
- case 457: /* Vector Multiply Low Doubleword */
- case 649: /* Vector Multiply High Unsigned Word */
- case 713: /* Vector Multiply High Unsigned Doubleword */
- case 905: /* Vector Multiply High Signed Word */
- case 969: /* Vector Multiply High Signed Doubleword */
- case 11: /* Vector Divide Unsigned Quadword */
- case 203: /* Vector Divide Unsigned Doubleword */
- case 139: /* Vector Divide Unsigned Word */
- case 267: /* Vector Divide Signed Quadword */
- case 459: /* Vector Divide Signed Doubleword */
- case 395: /* Vector Divide Signed Word */
- case 523: /* Vector Divide Extended Unsigned Quadword */
- case 715: /* Vector Divide Extended Unsigned Doubleword */
- case 651: /* Vector Divide Extended Unsigned Word */
- case 779: /* Vector Divide Extended Signed Quadword */
- case 971: /* Vector Divide Extended Signed Doubleword */
- case 907: /* Vector Divide Extended Unsigned Word */
- case 1547: /* Vector Modulo Unsigned Quadword */
- case 1675: /* Vector Modulo Unsigned Word */
- case 1739: /* Vector Modulo Unsigned Doubleword */
- case 1803: /* Vector Modulo Signed Quadword */
- case 1931: /* Vector Modulo Signed Word */
- case 1995: /* Vector Modulo Signed Doubleword */
-
- case 137: /* Vector Multiply Unsigned Word Modulo */
- case 1024: /* Vector Subtract Unsigned Byte Modulo */
- case 1088: /* Vector Subtract Unsigned Halfword Modulo */
- case 1152: /* Vector Subtract Unsigned Word Modulo */
- case 1216: /* Vector Subtract Unsigned Doubleword Modulo */
- case 1280: /* Vector Subtract Unsigned Quadword Modulo */
- case 1344: /* Vector Subtract & write Carry Unsigned Quadword */
- case 1408: /* Vector Subtract and Write Carry-Out Unsigned Word */
- case 1282: /* Vector Average Signed Byte */
- case 1346: /* Vector Average Signed Halfword */
- case 1410: /* Vector Average Signed Word */
- case 1026: /* Vector Average Unsigned Byte */
- case 1090: /* Vector Average Unsigned Halfword */
- case 1154: /* Vector Average Unsigned Word */
- case 258: /* Vector Maximum Signed Byte */
- case 322: /* Vector Maximum Signed Halfword */
- case 386: /* Vector Maximum Signed Word */
- case 450: /* Vector Maximum Signed Doubleword */
- case 2: /* Vector Maximum Unsigned Byte */
- case 66: /* Vector Maximum Unsigned Halfword */
- case 130: /* Vector Maximum Unsigned Word */
- case 194: /* Vector Maximum Unsigned Doubleword */
- case 770: /* Vector Minimum Signed Byte */
- case 834: /* Vector Minimum Signed Halfword */
- case 898: /* Vector Minimum Signed Word */
- case 962: /* Vector Minimum Signed Doubleword */
- case 514: /* Vector Minimum Unsigned Byte */
- case 578: /* Vector Minimum Unsigned Halfword */
- case 642: /* Vector Minimum Unsigned Word */
- case 706: /* Vector Minimum Unsigned Doubleword */
- case 1028: /* Vector Logical AND */
- case 1668: /* Vector Logical Equivalent */
- case 1092: /* Vector Logical AND with Complement */
- case 1412: /* Vector Logical NAND */
- case 1348: /* Vector Logical OR with Complement */
- case 1156: /* Vector Logical OR */
- case 1284: /* Vector Logical NOR */
- case 1220: /* Vector Logical XOR */
- case 4: /* Vector Rotate Left Byte */
- case 132: /* Vector Rotate Left Word VX-form */
- case 68: /* Vector Rotate Left Halfword */
- case 196: /* Vector Rotate Left Doubleword */
- case 260: /* Vector Shift Left Byte */
- case 388: /* Vector Shift Left Word */
- case 324: /* Vector Shift Left Halfword */
- case 1476: /* Vector Shift Left Doubleword */
- case 516: /* Vector Shift Right Byte */
- case 644: /* Vector Shift Right Word */
- case 580: /* Vector Shift Right Halfword */
- case 1732: /* Vector Shift Right Doubleword */
- case 772: /* Vector Shift Right Algebraic Byte */
- case 900: /* Vector Shift Right Algebraic Word */
- case 836: /* Vector Shift Right Algebraic Halfword */
- case 964: /* Vector Shift Right Algebraic Doubleword */
- case 10: /* Vector Add Single-Precision */
- case 74: /* Vector Subtract Single-Precision */
- case 1034: /* Vector Maximum Single-Precision */
- case 1098: /* Vector Minimum Single-Precision */
- case 842: /* Vector Convert From Signed Fixed-Point Word */
- case 778: /* Vector Convert From Unsigned Fixed-Point Word */
- case 714: /* Vector Round to Single-Precision Integer toward -Infinity */
- case 522: /* Vector Round to Single-Precision Integer Nearest */
- case 650: /* Vector Round to Single-Precision Integer toward +Infinity */
- case 586: /* Vector Round to Single-Precision Integer toward Zero */
- case 394: /* Vector 2 Raised to the Exponent Estimate Floating-Point */
- case 458: /* Vector Log Base 2 Estimate Floating-Point */
- case 266: /* Vector Reciprocal Estimate Single-Precision */
- case 330: /* Vector Reciprocal Square Root Estimate Single-Precision */
- case 1288: /* Vector AES Cipher */
- case 1289: /* Vector AES Cipher Last */
- case 1352: /* Vector AES Inverse Cipher */
- case 1353: /* Vector AES Inverse Cipher Last */
- case 1480: /* Vector AES SubBytes */
- case 1730: /* Vector SHA-512 Sigma Doubleword */
- case 1666: /* Vector SHA-256 Sigma Word */
- case 1032: /* Vector Polynomial Multiply-Sum Byte */
- case 1160: /* Vector Polynomial Multiply-Sum Word */
- case 1096: /* Vector Polynomial Multiply-Sum Halfword */
- case 1224: /* Vector Polynomial Multiply-Sum Doubleword */
- case 1292: /* Vector Gather Bits by Bytes by Doubleword */
- case 1794: /* Vector Count Leading Zeros Byte */
- case 1858: /* Vector Count Leading Zeros Halfword */
- case 1922: /* Vector Count Leading Zeros Word */
- case 1924: /* Vector Count Leading Zeros Doubleword under
+ case 12: /* Vector Merge High Byte */
+ case 14: /* Vector Pack Unsigned Halfword Unsigned Modulo */
+ case 76: /* Vector Merge High Halfword */
+ case 78: /* Vector Pack Unsigned Word Unsigned Modulo */
+ case 140: /* Vector Merge High Word */
+ case 268: /* Vector Merge Low Byte */
+ case 332: /* Vector Merge Low Halfword */
+ case 396: /* Vector Merge Low Word */
+ case 397: /* Vector Clear Leftmost Bytes */
+ case 461: /* Vector Clear Rightmost Bytes */
+ case 526: /* Vector Unpack High Signed Byte */
+ case 590: /* Vector Unpack High Signed Halfword */
+ case 654: /* Vector Unpack Low Signed Byte */
+ case 718: /* Vector Unpack Low Signed Halfword */
+ case 782: /* Vector Pack Pixel */
+ case 846: /* Vector Unpack High Pixel */
+ case 974: /* Vector Unpack Low Pixel */
+ case 1102: /* Vector Pack Unsigned Doubleword Unsigned Modulo */
+ case 1614: /* Vector Unpack High Signed Word */
+ case 1676: /* Vector Merge Odd Word */
+ case 1742: /* Vector Unpack Low Signed Word */
+ case 1932: /* Vector Merge Even Word */
+ case 524: /* Vector Splat Byte */
+ case 588: /* Vector Splat Halfword */
+ case 652: /* Vector Splat Word */
+ case 780: /* Vector Splat Immediate Signed Byte */
+ case 844: /* Vector Splat Immediate Signed Halfword */
+ case 908: /* Vector Splat Immediate Signed Word */
+ case 261: /* Vector Shift Left Quadword */
+ case 452: /* Vector Shift Left */
+ case 517: /* Vector Shift Right Quadword */
+ case 708: /* Vector Shift Right */
+ case 773: /* Vector Shift Right Algebraic Quadword */
+ case 1036: /* Vector Shift Left by Octet */
+ case 1100: /* Vector Shift Right by Octet */
+ case 0: /* Vector Add Unsigned Byte Modulo */
+ case 64: /* Vector Add Unsigned Halfword Modulo */
+ case 128: /* Vector Add Unsigned Word Modulo */
+ case 192: /* Vector Add Unsigned Doubleword Modulo */
+ case 256: /* Vector Add Unsigned Quadword Modulo */
+ case 320: /* Vector Add & write Carry Unsigned Quadword */
+ case 384: /* Vector Add and Write Carry-Out Unsigned Word */
+ case 8: /* Vector Multiply Odd Unsigned Byte */
+ case 72: /* Vector Multiply Odd Unsigned Halfword */
+ case 136: /* Vector Multiply Odd Unsigned Word */
+ case 200: /* Vector Multiply Odd Unsigned Doubleword */
+ case 264: /* Vector Multiply Odd Signed Byte */
+ case 328: /* Vector Multiply Odd Signed Halfword */
+ case 392: /* Vector Multiply Odd Signed Word */
+ case 456: /* Vector Multiply Odd Signed Doubleword */
+ case 520: /* Vector Multiply Even Unsigned Byte */
+ case 584: /* Vector Multiply Even Unsigned Halfword */
+ case 648: /* Vector Multiply Even Unsigned Word */
+ case 712: /* Vector Multiply Even Unsigned Doubleword */
+ case 776: /* Vector Multiply Even Signed Byte */
+ case 840: /* Vector Multiply Even Signed Halfword */
+ case 904: /* Vector Multiply Even Signed Word */
+ case 968: /* Vector Multiply Even Signed Doubleword */
+ case 457: /* Vector Multiply Low Doubleword */
+ case 649: /* Vector Multiply High Unsigned Word */
+ case 713: /* Vector Multiply High Unsigned Doubleword */
+ case 905: /* Vector Multiply High Signed Word */
+ case 969: /* Vector Multiply High Signed Doubleword */
+ case 11: /* Vector Divide Unsigned Quadword */
+ case 203: /* Vector Divide Unsigned Doubleword */
+ case 139: /* Vector Divide Unsigned Word */
+ case 267: /* Vector Divide Signed Quadword */
+ case 459: /* Vector Divide Signed Doubleword */
+ case 395: /* Vector Divide Signed Word */
+ case 523: /* Vector Divide Extended Unsigned Quadword */
+ case 715: /* Vector Divide Extended Unsigned Doubleword */
+ case 651: /* Vector Divide Extended Unsigned Word */
+ case 779: /* Vector Divide Extended Signed Quadword */
+ case 971: /* Vector Divide Extended Signed Doubleword */
+ case 907: /* Vector Divide Extended Unsigned Word */
+ case 1547: /* Vector Modulo Unsigned Quadword */
+ case 1675: /* Vector Modulo Unsigned Word */
+ case 1739: /* Vector Modulo Unsigned Doubleword */
+ case 1803: /* Vector Modulo Signed Quadword */
+ case 1931: /* Vector Modulo Signed Word */
+ case 1995: /* Vector Modulo Signed Doubleword */
+
+ case 137: /* Vector Multiply Unsigned Word Modulo */
+ case 1024: /* Vector Subtract Unsigned Byte Modulo */
+ case 1088: /* Vector Subtract Unsigned Halfword Modulo */
+ case 1152: /* Vector Subtract Unsigned Word Modulo */
+ case 1216: /* Vector Subtract Unsigned Doubleword Modulo */
+ case 1280: /* Vector Subtract Unsigned Quadword Modulo */
+ case 1344: /* Vector Subtract & write Carry Unsigned Quadword */
+ case 1408: /* Vector Subtract and Write Carry-Out Unsigned Word */
+ case 1282: /* Vector Average Signed Byte */
+ case 1346: /* Vector Average Signed Halfword */
+ case 1410: /* Vector Average Signed Word */
+ case 1026: /* Vector Average Unsigned Byte */
+ case 1090: /* Vector Average Unsigned Halfword */
+ case 1154: /* Vector Average Unsigned Word */
+ case 258: /* Vector Maximum Signed Byte */
+ case 322: /* Vector Maximum Signed Halfword */
+ case 386: /* Vector Maximum Signed Word */
+ case 450: /* Vector Maximum Signed Doubleword */
+ case 2: /* Vector Maximum Unsigned Byte */
+ case 66: /* Vector Maximum Unsigned Halfword */
+ case 130: /* Vector Maximum Unsigned Word */
+ case 194: /* Vector Maximum Unsigned Doubleword */
+ case 770: /* Vector Minimum Signed Byte */
+ case 834: /* Vector Minimum Signed Halfword */
+ case 898: /* Vector Minimum Signed Word */
+ case 962: /* Vector Minimum Signed Doubleword */
+ case 514: /* Vector Minimum Unsigned Byte */
+ case 578: /* Vector Minimum Unsigned Halfword */
+ case 642: /* Vector Minimum Unsigned Word */
+ case 706: /* Vector Minimum Unsigned Doubleword */
+ case 1028: /* Vector Logical AND */
+ case 1668: /* Vector Logical Equivalent */
+ case 1092: /* Vector Logical AND with Complement */
+ case 1412: /* Vector Logical NAND */
+ case 1348: /* Vector Logical OR with Complement */
+ case 1156: /* Vector Logical OR */
+ case 1284: /* Vector Logical NOR */
+ case 1220: /* Vector Logical XOR */
+ case 4: /* Vector Rotate Left Byte */
+ case 132: /* Vector Rotate Left Word VX-form */
+ case 68: /* Vector Rotate Left Halfword */
+ case 196: /* Vector Rotate Left Doubleword */
+ case 260: /* Vector Shift Left Byte */
+ case 388: /* Vector Shift Left Word */
+ case 324: /* Vector Shift Left Halfword */
+ case 1476: /* Vector Shift Left Doubleword */
+ case 516: /* Vector Shift Right Byte */
+ case 644: /* Vector Shift Right Word */
+ case 580: /* Vector Shift Right Halfword */
+ case 1732: /* Vector Shift Right Doubleword */
+ case 772: /* Vector Shift Right Algebraic Byte */
+ case 900: /* Vector Shift Right Algebraic Word */
+ case 836: /* Vector Shift Right Algebraic Halfword */
+ case 964: /* Vector Shift Right Algebraic Doubleword */
+ case 10: /* Vector Add Single-Precision */
+ case 74: /* Vector Subtract Single-Precision */
+ case 1034: /* Vector Maximum Single-Precision */
+ case 1098: /* Vector Minimum Single-Precision */
+ case 842: /* Vector Convert From Signed Fixed-Point Word */
+ case 778: /* Vector Convert From Unsigned Fixed-Point Word */
+ case 714: /* Vector Round to Single-Precision Integer toward -Infinity */
+ case 522: /* Vector Round to Single-Precision Integer Nearest */
+ case 650: /* Vector Round to Single-Precision Integer toward +Infinity */
+ case 586: /* Vector Round to Single-Precision Integer toward Zero */
+ case 394: /* Vector 2 Raised to the Exponent Estimate Floating-Point */
+ case 458: /* Vector Log Base 2 Estimate Floating-Point */
+ case 266: /* Vector Reciprocal Estimate Single-Precision */
+ case 330: /* Vector Reciprocal Square Root Estimate Single-Precision */
+ case 1288: /* Vector AES Cipher */
+ case 1289: /* Vector AES Cipher Last */
+ case 1352: /* Vector AES Inverse Cipher */
+ case 1353: /* Vector AES Inverse Cipher Last */
+ case 1480: /* Vector AES SubBytes */
+ case 1730: /* Vector SHA-512 Sigma Doubleword */
+ case 1666: /* Vector SHA-256 Sigma Word */
+ case 1032: /* Vector Polynomial Multiply-Sum Byte */
+ case 1160: /* Vector Polynomial Multiply-Sum Word */
+ case 1096: /* Vector Polynomial Multiply-Sum Halfword */
+ case 1224: /* Vector Polynomial Multiply-Sum Doubleword */
+ case 1292: /* Vector Gather Bits by Bytes by Doubleword */
+ case 1794: /* Vector Count Leading Zeros Byte */
+ case 1858: /* Vector Count Leading Zeros Halfword */
+ case 1922: /* Vector Count Leading Zeros Word */
+ case 1924: /* Vector Count Leading Zeros Doubleword under
bit Mask*/
- case 1986: /* Vector Count Leading Zeros Doubleword */
- case 1988: /* Vector Count Trailing Zeros Doubleword under bit
+ case 1986: /* Vector Count Leading Zeros Doubleword */
+ case 1988: /* Vector Count Trailing Zeros Doubleword under bit
Mask */
- case 1795: /* Vector Population Count Byte */
- case 1859: /* Vector Population Count Halfword */
- case 1923: /* Vector Population Count Word */
- case 1987: /* Vector Population Count Doubleword */
- case 1356: /* Vector Bit Permute Quadword */
- case 1484: /* Vector Bit Permute Doubleword */
- case 513: /* Vector Multiply-by-10 Unsigned Quadword */
- case 1: /* Vector Multiply-by-10 & write Carry Unsigned
+ case 1795: /* Vector Population Count Byte */
+ case 1859: /* Vector Population Count Halfword */
+ case 1923: /* Vector Population Count Word */
+ case 1987: /* Vector Population Count Doubleword */
+ case 1356: /* Vector Bit Permute Quadword */
+ case 1484: /* Vector Bit Permute Doubleword */
+ case 513: /* Vector Multiply-by-10 Unsigned Quadword */
+ case 1: /* Vector Multiply-by-10 & write Carry Unsigned
Quadword */
- case 577: /* Vector Multiply-by-10 Extended Unsigned Quadword */
- case 65: /* Vector Multiply-by-10 Extended & write Carry
+ case 577: /* Vector Multiply-by-10 Extended Unsigned Quadword */
+ case 65: /* Vector Multiply-by-10 Extended & write Carry
Unsigned Quadword */
- case 1027: /* Vector Absolute Difference Unsigned Byte */
- case 1091: /* Vector Absolute Difference Unsigned Halfword */
- case 1155: /* Vector Absolute Difference Unsigned Word */
- case 1796: /* Vector Shift Right Variable */
- case 1860: /* Vector Shift Left Variable */
- case 133: /* Vector Rotate Left Word then Mask Insert */
- case 197: /* Vector Rotate Left Doubleword then Mask Insert */
- case 389: /* Vector Rotate Left Word then AND with Mask */
- case 453: /* Vector Rotate Left Doubleword then AND with Mask */
- case 525: /* Vector Extract Unsigned Byte */
- case 589: /* Vector Extract Unsigned Halfword */
- case 653: /* Vector Extract Unsigned Word */
- case 717: /* Vector Extract Doubleword */
- case 15: /* Vector Insert Byte from VSR using GPR-specified
+ case 1027: /* Vector Absolute Difference Unsigned Byte */
+ case 1091: /* Vector Absolute Difference Unsigned Halfword */
+ case 1155: /* Vector Absolute Difference Unsigned Word */
+ case 1796: /* Vector Shift Right Variable */
+ case 1860: /* Vector Shift Left Variable */
+ case 133: /* Vector Rotate Left Word then Mask Insert */
+ case 197: /* Vector Rotate Left Doubleword then Mask Insert */
+ case 389: /* Vector Rotate Left Word then AND with Mask */
+ case 453: /* Vector Rotate Left Doubleword then AND with Mask */
+ case 525: /* Vector Extract Unsigned Byte */
+ case 589: /* Vector Extract Unsigned Halfword */
+ case 653: /* Vector Extract Unsigned Word */
+ case 717: /* Vector Extract Doubleword */
+ case 15: /* Vector Insert Byte from VSR using GPR-specified
Left-Index */
- case 79: /* Vector Insert Halfword from VSR using GPR-specified
+ case 79: /* Vector Insert Halfword from VSR using GPR-specified
Left-Index */
- case 143: /* Vector Insert Word from VSR using GPR-specified
+ case 143: /* Vector Insert Word from VSR using GPR-specified
Left-Index */
- case 207: /* Vector Insert Word from GPR using
+ case 207: /* Vector Insert Word from GPR using
immediate-specified index */
- case 463: /* Vector Insert Doubleword from GPR using
+ case 463: /* Vector Insert Doubleword from GPR using
immediate-specified index */
- case 271: /* Vector Insert Byte from VSR using GPR-specified
+ case 271: /* Vector Insert Byte from VSR using GPR-specified
Right-Index */
- case 335: /* Vector Insert Halfword from VSR using GPR-specified
+ case 335: /* Vector Insert Halfword from VSR using GPR-specified
Right-Index */
- case 399: /* Vector Insert Word from VSR using GPR-specified
+ case 399: /* Vector Insert Word from VSR using GPR-specified
Right-Index */
- case 527: /* Vector Insert Byte from GPR using GPR-specified
+ case 527: /* Vector Insert Byte from GPR using GPR-specified
Left-Index */
- case 591: /* Vector Insert Halfword from GPR using GPR-specified
+ case 591: /* Vector Insert Halfword from GPR using GPR-specified
Left-Index */
- case 655: /* Vector Insert Word from GPR using GPR-specified
+ case 655: /* Vector Insert Word from GPR using GPR-specified
Left-Index */
- case 719: /* Vector Insert Doubleword from GPR using
+ case 719: /* Vector Insert Doubleword from GPR using
GPR-specified Left-Index */
- case 783: /* Vector Insert Byte from GPR using GPR-specified
+ case 783: /* Vector Insert Byte from GPR using GPR-specified
Right-Index */
- case 847: /* Vector Insert Halfword from GPR using GPR-specified
+ case 847: /* Vector Insert Halfword from GPR using GPR-specified
Left-Index */
- case 911: /* Vector Insert Word from GPR using GPR-specified
+ case 911: /* Vector Insert Word from GPR using GPR-specified
Left-Index */
- case 975: /* Vector Insert Doubleword from GPR using
+ case 975: /* Vector Insert Doubleword from GPR using
GPR-specified Right-Index */
- case 781: /* Vector Insert Byte */
- case 845: /* Vector Insert Halfword */
- case 909: /* Vector Insert Word */
- case 973: /* Vector Insert Doubleword */
- case 1357: /* Vector Centrifuge Doubleword */
- case 1421: /* Vector Parallel Bits Extract Doubleword */
- case 1485: /* Vector Parallel Bits Deposit Doubleword */
+ case 781: /* Vector Insert Byte */
+ case 845: /* Vector Insert Halfword */
+ case 909: /* Vector Insert Word */
+ case 973: /* Vector Insert Doubleword */
+ case 1357: /* Vector Centrifuge Doubleword */
+ case 1421: /* Vector Parallel Bits Extract Doubleword */
+ case 1485: /* Vector Parallel Bits Deposit Doubleword */
record_full_arch_list_add_reg (regcache,
tdep->ppc_vr0_regnum + PPC_VRT (insn));
return 0;
- case 1228: /* Vector Gather every Nth Bit */
- case 1549: /* Vector Extract Unsigned Byte Left-Indexed */
- case 1613: /* Vector Extract Unsigned Halfword Left-Indexed */
- case 1677: /* Vector Extract Unsigned Word Left-Indexed */
- case 1805: /* Vector Extract Unsigned Byte Right-Indexed */
- case 1869: /* Vector Extract Unsigned Halfword Right-Indexed */
- case 1933: /* Vector Extract Unsigned Word Right-Indexed */
+ case 1228: /* Vector Gather every Nth Bit */
+ case 1549: /* Vector Extract Unsigned Byte Left-Indexed */
+ case 1613: /* Vector Extract Unsigned Halfword Left-Indexed */
+ case 1677: /* Vector Extract Unsigned Word Left-Indexed */
+ case 1805: /* Vector Extract Unsigned Byte Right-Indexed */
+ case 1869: /* Vector Extract Unsigned Halfword Right-Indexed */
+ case 1933: /* Vector Extract Unsigned Word Right-Indexed */
record_full_arch_list_add_reg (regcache,
tdep->ppc_gp0_regnum + PPC_RT (insn));
return 0;
- case 1604: /* Move To Vector Status and Control Register */
+ case 1604: /* Move To Vector Status and Control Register */
record_full_arch_list_add_reg (regcache, PPC_VSCR_REGNUM);
return 0;
- case 1540: /* Move From Vector Status and Control Register */
+ case 1540: /* Move From Vector Status and Control Register */
record_full_arch_list_add_reg (regcache,
tdep->ppc_vr0_regnum + PPC_VRT (insn));
return 0;
- case 833: /* Decimal Copy Sign */
+ case 833: /* Decimal Copy Sign */
record_full_arch_list_add_reg (regcache,
tdep->ppc_vr0_regnum + PPC_VRT (insn));
record_full_arch_list_add_reg (regcache, tdep->ppc_cr_regnum);
return 0;
}
- gdb_printf (gdb_stdlog, "Warning: Don't know how to record %08x "
- "at %s, 4-%d.\n", insn, paddress (gdbarch, addr), ext);
+ gdb_printf (gdb_stdlog,
+ "Warning: Don't know how to record %08x "
+ "at %s, 4-%d.\n",
+ insn, paddress (gdbarch, addr), ext);
return -1;
}
@@ -4773,11 +4658,11 @@ ppc_process_record_op6 (struct gdbarch *gdbarch, struct regcache *regcache,
switch (subtype)
{
- case 0: /* Load VSX Vector Paired */
+ case 0: /* Load VSX Vector Paired */
ppc_record_vsr (regcache, tdep, PPC_XTp (insn));
ppc_record_vsr (regcache, tdep, PPC_XTp (insn) + 1);
return 0;
- case 1: /* Store VSX Vector Paired */
+ case 1: /* Store VSX Vector Paired */
if (PPC_RA (insn) != 0)
regcache_raw_read_unsigned (regcache,
tdep->ppc_gp0_regnum + PPC_RA (insn), &ea);
@@ -4793,14 +4678,14 @@ ppc_process_record_op6 (struct gdbarch *gdbarch, struct regcache *regcache,
static int
ppc_process_record_op19 (struct gdbarch *gdbarch, struct regcache *regcache,
- CORE_ADDR addr, uint32_t insn)
+ CORE_ADDR addr, uint32_t insn)
{
ppc_gdbarch_tdep *tdep = gdbarch_tdep<ppc_gdbarch_tdep> (gdbarch);
int ext = PPC_EXTOP (insn);
switch (ext & 0x01f)
{
- case 2: /* Add PC Immediate Shifted */
+ case 2: /* Add PC Immediate Shifted */
record_full_arch_list_add_reg (regcache,
tdep->ppc_gp0_regnum + PPC_RT (insn));
return 0;
@@ -4808,35 +4693,37 @@ ppc_process_record_op19 (struct gdbarch *gdbarch, struct regcache *regcache,
switch (ext)
{
- case 0: /* Move Condition Register Field */
- case 33: /* Condition Register NOR */
- case 129: /* Condition Register AND with Complement */
- case 193: /* Condition Register XOR */
- case 225: /* Condition Register NAND */
- case 257: /* Condition Register AND */
- case 289: /* Condition Register Equivalent */
- case 417: /* Condition Register OR with Complement */
- case 449: /* Condition Register OR */
+ case 0: /* Move Condition Register Field */
+ case 33: /* Condition Register NOR */
+ case 129: /* Condition Register AND with Complement */
+ case 193: /* Condition Register XOR */
+ case 225: /* Condition Register NAND */
+ case 257: /* Condition Register AND */
+ case 289: /* Condition Register Equivalent */
+ case 417: /* Condition Register OR with Complement */
+ case 449: /* Condition Register OR */
record_full_arch_list_add_reg (regcache, tdep->ppc_cr_regnum);
return 0;
- case 16: /* Branch Conditional */
- case 560: /* Branch Conditional to Branch Target Address Register */
+ case 16: /* Branch Conditional */
+ case 560: /* Branch Conditional to Branch Target Address Register */
if ((PPC_BO (insn) & 0x4) == 0)
record_full_arch_list_add_reg (regcache, tdep->ppc_ctr_regnum);
/* FALL-THROUGH */
- case 528: /* Branch Conditional to Count Register */
+ case 528: /* Branch Conditional to Count Register */
if (PPC_LK (insn))
record_full_arch_list_add_reg (regcache, tdep->ppc_lr_regnum);
return 0;
- case 150: /* Instruction Synchronize */
+ case 150: /* Instruction Synchronize */
/* Do nothing. */
return 0;
}
- gdb_printf (gdb_stdlog, "Warning: Don't know how to record %08x "
- "at %s, 19-%d.\n", insn, paddress (gdbarch, addr), ext);
+ gdb_printf (gdb_stdlog,
+ "Warning: Don't know how to record %08x "
+ "at %s, 19-%d.\n",
+ insn, paddress (gdbarch, addr), ext);
return -1;
}
@@ -4846,18 +4733,17 @@ ppc_process_record_op19 (struct gdbarch *gdbarch, struct regcache *regcache,
static int
ppc_process_record_op31_177 (struct gdbarch *gdbarch,
- struct regcache *regcache,
- uint32_t insn)
+ struct regcache *regcache, uint32_t insn)
{
- int RA_opcode = PPC_RA(insn);
+ int RA_opcode = PPC_RA (insn);
int as = PPC_FIELD (insn, 6, 3);
ppc_gdbarch_tdep *tdep = gdbarch_tdep<ppc_gdbarch_tdep> (gdbarch);
switch (RA_opcode)
{
- case 0: /* VSX Move From Accumulator, xxmfacc */
- case 1: /* VSX Move To Accumulator, xxmtacc */
- case 3: /* VSX Set Accumulator to Zero, xxsetaccz */
+ case 0: /* VSX Move From Accumulator, xxmfacc */
+ case 1: /* VSX Move To Accumulator, xxmtacc */
+ case 3: /* VSX Set Accumulator to Zero, xxsetaccz */
ppc_record_ACC_fpscr (regcache, tdep, as, false);
return 0;
}
@@ -4869,7 +4755,7 @@ ppc_process_record_op31_177 (struct gdbarch *gdbarch,
static int
ppc_process_record_op31 (struct gdbarch *gdbarch, struct regcache *regcache,
- CORE_ADDR addr, uint32_t insn)
+ CORE_ADDR addr, uint32_t insn)
{
ppc_gdbarch_tdep *tdep = gdbarch_tdep<ppc_gdbarch_tdep> (gdbarch);
int ext = PPC_EXTOP (insn);
@@ -4882,14 +4768,14 @@ ppc_process_record_op31 (struct gdbarch *gdbarch, struct regcache *regcache,
switch (ext & 0x1ff)
{
/* These write RT and XER. Update CR if RC is set. */
- case 8: /* Subtract from carrying */
- case 10: /* Add carrying */
- case 136: /* Subtract from extended */
- case 138: /* Add extended */
- case 200: /* Subtract from zero extended */
- case 202: /* Add to zero extended */
- case 232: /* Subtract from minus one extended */
- case 234: /* Add to minus one extended */
+ case 8: /* Subtract from carrying */
+ case 10: /* Add carrying */
+ case 136: /* Subtract from extended */
+ case 138: /* Add extended */
+ case 200: /* Subtract from zero extended */
+ case 202: /* Add to zero extended */
+ case 232: /* Subtract from minus one extended */
+ case 234: /* Add to minus one extended */
/* CA is always altered, but SO/OV are only altered when OE=1.
In any case, XER is always altered. */
record_full_arch_list_add_reg (regcache, tdep->ppc_xer_regnum);
@@ -4900,26 +4786,26 @@ ppc_process_record_op31 (struct gdbarch *gdbarch, struct regcache *regcache,
return 0;
/* These write RT. Update CR if RC is set and update XER if OE is set. */
- case 40: /* Subtract from */
- case 104: /* Negate */
- case 233: /* Multiply low doubleword */
- case 235: /* Multiply low word */
- case 266: /* Add */
- case 393: /* Divide Doubleword Extended Unsigned */
- case 395: /* Divide Word Extended Unsigned */
- case 425: /* Divide Doubleword Extended */
- case 427: /* Divide Word Extended */
- case 457: /* Divide Doubleword Unsigned */
- case 459: /* Divide Word Unsigned */
- case 489: /* Divide Doubleword */
- case 491: /* Divide Word */
+ case 40: /* Subtract from */
+ case 104: /* Negate */
+ case 233: /* Multiply low doubleword */
+ case 235: /* Multiply low word */
+ case 266: /* Add */
+ case 393: /* Divide Doubleword Extended Unsigned */
+ case 395: /* Divide Word Extended Unsigned */
+ case 425: /* Divide Doubleword Extended */
+ case 427: /* Divide Word Extended */
+ case 457: /* Divide Doubleword Unsigned */
+ case 459: /* Divide Word Unsigned */
+ case 489: /* Divide Doubleword */
+ case 491: /* Divide Word */
if (PPC_OE (insn))
record_full_arch_list_add_reg (regcache, tdep->ppc_xer_regnum);
/* FALL-THROUGH */
- case 9: /* Multiply High Doubleword Unsigned */
- case 11: /* Multiply High Word Unsigned */
- case 73: /* Multiply High Doubleword */
- case 75: /* Multiply High Word */
+ case 9: /* Multiply High Doubleword Unsigned */
+ case 11: /* Multiply High Word Unsigned */
+ case 73: /* Multiply High Doubleword */
+ case 75: /* Multiply High Word */
if (PPC_RC (insn))
record_full_arch_list_add_reg (regcache, tdep->ppc_cr_regnum);
record_full_arch_list_add_reg (regcache,
@@ -4946,7 +4832,7 @@ ppc_process_record_op31 (struct gdbarch *gdbarch, struct regcache *regcache,
switch (ext)
{
- case 78: /* Determine Leftmost Zero Byte */
+ case 78: /* Determine Leftmost Zero Byte */
if (PPC_RC (insn))
record_full_arch_list_add_reg (regcache, tdep->ppc_cr_regnum);
record_full_arch_list_add_reg (regcache, tdep->ppc_xer_regnum);
@@ -4955,112 +4841,112 @@ ppc_process_record_op31 (struct gdbarch *gdbarch, struct regcache *regcache,
return 0;
/* These only write RT. */
- case 19: /* Move from condition register */
- /* Move From One Condition Register Field */
- case 74: /* Add and Generate Sixes */
- case 74 | 0x200: /* Add and Generate Sixes (bit-21 dont-care) */
- case 302: /* Move From Branch History Rolling Buffer */
- case 339: /* Move From Special Purpose Register */
- case 371: /* Move From Time Base [Phased-Out] */
- case 309: /* Load Doubleword Monitored Indexed */
- case 128: /* Set Boolean */
- case 384: /* Set Boolean Condition */
- case 416: /* Set Boolean Condition Reverse */
- case 448: /* Set Negative Boolean Condition */
- case 480: /* Set Negative Boolean Condition Reverse */
- case 755: /* Deliver A Random Number */
+ case 19: /* Move from condition register */
+ /* Move From One Condition Register Field */
+ case 74: /* Add and Generate Sixes */
+ case 74 | 0x200: /* Add and Generate Sixes (bit-21 dont-care) */
+ case 302: /* Move From Branch History Rolling Buffer */
+ case 339: /* Move From Special Purpose Register */
+ case 371: /* Move From Time Base [Phased-Out] */
+ case 309: /* Load Doubleword Monitored Indexed */
+ case 128: /* Set Boolean */
+ case 384: /* Set Boolean Condition */
+ case 416: /* Set Boolean Condition Reverse */
+ case 448: /* Set Negative Boolean Condition */
+ case 480: /* Set Negative Boolean Condition Reverse */
+ case 755: /* Deliver A Random Number */
record_full_arch_list_add_reg (regcache,
tdep->ppc_gp0_regnum + PPC_RT (insn));
return 0;
/* These only write to RA. */
- case 51: /* Move From VSR Doubleword */
- case 59: /* Count Leading Zeros Doubleword under bit Mask */
- case 115: /* Move From VSR Word and Zero */
- case 122: /* Population count bytes */
- case 155: /* Byte-Reverse Word */
- case 156: /* Parallel Bits Deposit Doubleword */
- case 187: /* Byte-Reverse Doubleword */
- case 188: /* Parallel Bits Extract Doubleword */
- case 219: /* Byte-Reverse Halfword */
- case 220: /* Centrifuge Doubleword */
- case 378: /* Population count words */
- case 506: /* Population count doublewords */
- case 154: /* Parity Word */
- case 186: /* Parity Doubleword */
- case 252: /* Bit Permute Doubleword */
- case 282: /* Convert Declets To Binary Coded Decimal */
- case 314: /* Convert Binary Coded Decimal To Declets */
- case 508: /* Compare bytes */
- case 307: /* Move From VSR Lower Doubleword */
- case 571: /* Count Trailing Zeros Doubleword under bit Mask */
+ case 51: /* Move From VSR Doubleword */
+ case 59: /* Count Leading Zeros Doubleword under bit Mask */
+ case 115: /* Move From VSR Word and Zero */
+ case 122: /* Population count bytes */
+ case 155: /* Byte-Reverse Word */
+ case 156: /* Parallel Bits Deposit Doubleword */
+ case 187: /* Byte-Reverse Doubleword */
+ case 188: /* Parallel Bits Extract Doubleword */
+ case 219: /* Byte-Reverse Halfword */
+ case 220: /* Centrifuge Doubleword */
+ case 378: /* Population count words */
+ case 506: /* Population count doublewords */
+ case 154: /* Parity Word */
+ case 186: /* Parity Doubleword */
+ case 252: /* Bit Permute Doubleword */
+ case 282: /* Convert Declets To Binary Coded Decimal */
+ case 314: /* Convert Binary Coded Decimal To Declets */
+ case 508: /* Compare bytes */
+ case 307: /* Move From VSR Lower Doubleword */
+ case 571: /* Count Trailing Zeros Doubleword under bit Mask */
record_full_arch_list_add_reg (regcache,
tdep->ppc_gp0_regnum + PPC_RA (insn));
return 0;
/* These write CR and optional RA. */
- case 792: /* Shift Right Algebraic Word */
- case 794: /* Shift Right Algebraic Doubleword */
- case 824: /* Shift Right Algebraic Word Immediate */
- case 826: /* Shift Right Algebraic Doubleword Immediate (413) */
- case 826 | 1: /* Shift Right Algebraic Doubleword Immediate (413) */
+ case 792: /* Shift Right Algebraic Word */
+ case 794: /* Shift Right Algebraic Doubleword */
+ case 824: /* Shift Right Algebraic Word Immediate */
+ case 826: /* Shift Right Algebraic Doubleword Immediate (413) */
+ case 826 | 1: /* Shift Right Algebraic Doubleword Immediate (413) */
record_full_arch_list_add_reg (regcache, tdep->ppc_xer_regnum);
record_full_arch_list_add_reg (regcache,
tdep->ppc_gp0_regnum + PPC_RA (insn));
/* FALL-THROUGH */
- case 0: /* Compare */
- case 32: /* Compare logical */
- case 144: /* Move To Condition Register Fields */
- /* Move To One Condition Register Field */
- case 192: /* Compare Ranged Byte */
- case 224: /* Compare Equal Byte */
- case 576: /* Move XER to CR Extended */
- case 902: /* Paste (should always fail due to single-stepping and
+ case 0: /* Compare */
+ case 32: /* Compare logical */
+ case 144: /* Move To Condition Register Fields */
+ /* Move To One Condition Register Field */
+ case 192: /* Compare Ranged Byte */
+ case 224: /* Compare Equal Byte */
+ case 576: /* Move XER to CR Extended */
+ case 902: /* Paste (should always fail due to single-stepping and
the memory location might not be accessible, so
record only CR) */
record_full_arch_list_add_reg (regcache, tdep->ppc_cr_regnum);
return 0;
/* These write to RT. Update RA if 'update indexed.' */
- case 53: /* Load Doubleword with Update Indexed */
- case 119: /* Load Byte and Zero with Update Indexed */
- case 311: /* Load Halfword and Zero with Update Indexed */
- case 55: /* Load Word and Zero with Update Indexed */
- case 375: /* Load Halfword Algebraic with Update Indexed */
- case 373: /* Load Word Algebraic with Update Indexed */
+ case 53: /* Load Doubleword with Update Indexed */
+ case 119: /* Load Byte and Zero with Update Indexed */
+ case 311: /* Load Halfword and Zero with Update Indexed */
+ case 55: /* Load Word and Zero with Update Indexed */
+ case 375: /* Load Halfword Algebraic with Update Indexed */
+ case 373: /* Load Word Algebraic with Update Indexed */
record_full_arch_list_add_reg (regcache,
tdep->ppc_gp0_regnum + PPC_RA (insn));
/* FALL-THROUGH */
- case 21: /* Load Doubleword Indexed */
- case 52: /* Load Byte And Reserve Indexed */
- case 116: /* Load Halfword And Reserve Indexed */
- case 20: /* Load Word And Reserve Indexed */
- case 84: /* Load Doubleword And Reserve Indexed */
- case 87: /* Load Byte and Zero Indexed */
- case 279: /* Load Halfword and Zero Indexed */
- case 23: /* Load Word and Zero Indexed */
- case 343: /* Load Halfword Algebraic Indexed */
- case 341: /* Load Word Algebraic Indexed */
- case 790: /* Load Halfword Byte-Reverse Indexed */
- case 534: /* Load Word Byte-Reverse Indexed */
- case 532: /* Load Doubleword Byte-Reverse Indexed */
- case 582: /* Load Word Atomic */
- case 614: /* Load Doubleword Atomic */
- case 265: /* Modulo Unsigned Doubleword */
- case 777: /* Modulo Signed Doubleword */
- case 267: /* Modulo Unsigned Word */
- case 779: /* Modulo Signed Word */
+ case 21: /* Load Doubleword Indexed */
+ case 52: /* Load Byte And Reserve Indexed */
+ case 116: /* Load Halfword And Reserve Indexed */
+ case 20: /* Load Word And Reserve Indexed */
+ case 84: /* Load Doubleword And Reserve Indexed */
+ case 87: /* Load Byte and Zero Indexed */
+ case 279: /* Load Halfword and Zero Indexed */
+ case 23: /* Load Word and Zero Indexed */
+ case 343: /* Load Halfword Algebraic Indexed */
+ case 341: /* Load Word Algebraic Indexed */
+ case 790: /* Load Halfword Byte-Reverse Indexed */
+ case 534: /* Load Word Byte-Reverse Indexed */
+ case 532: /* Load Doubleword Byte-Reverse Indexed */
+ case 582: /* Load Word Atomic */
+ case 614: /* Load Doubleword Atomic */
+ case 265: /* Modulo Unsigned Doubleword */
+ case 777: /* Modulo Signed Doubleword */
+ case 267: /* Modulo Unsigned Word */
+ case 779: /* Modulo Signed Word */
record_full_arch_list_add_reg (regcache,
tdep->ppc_gp0_regnum + PPC_RT (insn));
return 0;
- case 597: /* Load String Word Immediate */
- case 533: /* Load String Word Indexed */
+ case 597: /* Load String Word Immediate */
+ case 533: /* Load String Word Indexed */
if (ext == 597)
{
- nr = PPC_NB (insn);
- if (nr == 0)
- nr = 32;
+ nr = PPC_NB (insn);
+ if (nr == 0)
+ nr = 32;
}
else
{
@@ -5077,107 +4963,106 @@ ppc_process_record_op31 (struct gdbarch *gdbarch, struct regcache *regcache,
for (i = 0; i < nr; i++)
record_full_arch_list_add_reg (regcache,
tdep->ppc_gp0_regnum
- + ((PPC_RT (insn) + i) & 0x1f));
+ + ((PPC_RT (insn) + i) & 0x1f));
return 0;
- case 276: /* Load Quadword And Reserve Indexed */
+ case 276: /* Load Quadword And Reserve Indexed */
tmp = tdep->ppc_gp0_regnum + (PPC_RT (insn) & ~1);
record_full_arch_list_add_reg (regcache, tmp);
record_full_arch_list_add_reg (regcache, tmp + 1);
return 0;
/* These write VRT. */
- case 6: /* Load Vector for Shift Left Indexed */
- case 38: /* Load Vector for Shift Right Indexed */
- case 7: /* Load Vector Element Byte Indexed */
- case 39: /* Load Vector Element Halfword Indexed */
- case 71: /* Load Vector Element Word Indexed */
- case 103: /* Load Vector Indexed */
- case 359: /* Load Vector Indexed LRU */
+ case 6: /* Load Vector for Shift Left Indexed */
+ case 38: /* Load Vector for Shift Right Indexed */
+ case 7: /* Load Vector Element Byte Indexed */
+ case 39: /* Load Vector Element Halfword Indexed */
+ case 71: /* Load Vector Element Word Indexed */
+ case 103: /* Load Vector Indexed */
+ case 359: /* Load Vector Indexed LRU */
record_full_arch_list_add_reg (regcache,
tdep->ppc_vr0_regnum + PPC_VRT (insn));
return 0;
/* These write FRT. Update RA if 'update indexed.' */
- case 567: /* Load Floating-Point Single with Update Indexed */
- case 631: /* Load Floating-Point Double with Update Indexed */
+ case 567: /* Load Floating-Point Single with Update Indexed */
+ case 631: /* Load Floating-Point Double with Update Indexed */
record_full_arch_list_add_reg (regcache,
tdep->ppc_gp0_regnum + PPC_RA (insn));
/* FALL-THROUGH */
- case 535: /* Load Floating-Point Single Indexed */
- case 599: /* Load Floating-Point Double Indexed */
- case 855: /* Load Floating-Point as Integer Word Algebraic Indexed */
- case 887: /* Load Floating-Point as Integer Word and Zero Indexed */
+ case 535: /* Load Floating-Point Single Indexed */
+ case 599: /* Load Floating-Point Double Indexed */
+ case 855: /* Load Floating-Point as Integer Word Algebraic Indexed */
+ case 887: /* Load Floating-Point as Integer Word and Zero Indexed */
record_full_arch_list_add_reg (regcache,
tdep->ppc_fp0_regnum + PPC_FRT (insn));
return 0;
- case 791: /* Load Floating-Point Double Pair Indexed */
+ case 791: /* Load Floating-Point Double Pair Indexed */
tmp = tdep->ppc_fp0_regnum + (PPC_FRT (insn) & ~1);
record_full_arch_list_add_reg (regcache, tmp);
record_full_arch_list_add_reg (regcache, tmp + 1);
return 0;
/* These write to destination register PPC_XT. */
- case 179: /* Move To VSR Doubleword */
- case 211: /* Move To VSR Word Algebraic */
- case 243: /* Move To VSR Word and Zero */
- case 588: /* Load VSX Scalar Doubleword Indexed */
- case 524: /* Load VSX Scalar Single-Precision Indexed */
- case 76: /* Load VSX Scalar as Integer Word Algebraic Indexed */
- case 12: /* Load VSX Scalar as Integer Word and Zero Indexed */
- case 13: /* Load VSX Vector Rightmost Byte Indexed */
- case 45: /* Load VSX Vector Rightmost Halfword Indexed */
- case 77: /* Load VSX Vector Rightmost Word Indexed */
- case 109: /* Load VSX Vector Rightmost Doubleword Indexed */
- case 844: /* Load VSX Vector Doubleword*2 Indexed */
- case 332: /* Load VSX Vector Doubleword & Splat Indexed */
- case 780: /* Load VSX Vector Word*4 Indexed */
- case 268: /* Load VSX Vector Indexed */
- case 364: /* Load VSX Vector Word & Splat Indexed */
- case 812: /* Load VSX Vector Halfword*8 Indexed */
- case 876: /* Load VSX Vector Byte*16 Indexed */
- case 269: /* Load VSX Vector with Length */
- case 301: /* Load VSX Vector Left-justified with Length */
- case 781: /* Load VSX Scalar as Integer Byte & Zero Indexed */
- case 813: /* Load VSX Scalar as Integer Halfword & Zero Indexed */
- case 403: /* Move To VSR Word & Splat */
- case 435: /* Move To VSR Double Doubleword */
+ case 179: /* Move To VSR Doubleword */
+ case 211: /* Move To VSR Word Algebraic */
+ case 243: /* Move To VSR Word and Zero */
+ case 588: /* Load VSX Scalar Doubleword Indexed */
+ case 524: /* Load VSX Scalar Single-Precision Indexed */
+ case 76: /* Load VSX Scalar as Integer Word Algebraic Indexed */
+ case 12: /* Load VSX Scalar as Integer Word and Zero Indexed */
+ case 13: /* Load VSX Vector Rightmost Byte Indexed */
+ case 45: /* Load VSX Vector Rightmost Halfword Indexed */
+ case 77: /* Load VSX Vector Rightmost Word Indexed */
+ case 109: /* Load VSX Vector Rightmost Doubleword Indexed */
+ case 844: /* Load VSX Vector Doubleword*2 Indexed */
+ case 332: /* Load VSX Vector Doubleword & Splat Indexed */
+ case 780: /* Load VSX Vector Word*4 Indexed */
+ case 268: /* Load VSX Vector Indexed */
+ case 364: /* Load VSX Vector Word & Splat Indexed */
+ case 812: /* Load VSX Vector Halfword*8 Indexed */
+ case 876: /* Load VSX Vector Byte*16 Indexed */
+ case 269: /* Load VSX Vector with Length */
+ case 301: /* Load VSX Vector Left-justified with Length */
+ case 781: /* Load VSX Scalar as Integer Byte & Zero Indexed */
+ case 813: /* Load VSX Scalar as Integer Halfword & Zero Indexed */
+ case 403: /* Move To VSR Word & Splat */
+ case 435: /* Move To VSR Double Doubleword */
ppc_record_vsr (regcache, tdep, PPC_XT (insn));
return 0;
- case 333: /* Load VSX Vector Paired Indexed */
+ case 333: /* Load VSX Vector Paired Indexed */
ppc_record_vsr (regcache, tdep, PPC_XTp (insn));
ppc_record_vsr (regcache, tdep, PPC_XTp (insn) + 1);
return 0;
/* These write RA. Update CR if RC is set. */
- case 24: /* Shift Left Word */
- case 26: /* Count Leading Zeros Word */
- case 27: /* Shift Left Doubleword */
- case 28: /* AND */
- case 58: /* Count Leading Zeros Doubleword */
- case 60: /* AND with Complement */
- case 124: /* NOR */
- case 284: /* Equivalent */
- case 316: /* XOR */
- case 476: /* NAND */
- case 412: /* OR with Complement */
- case 444: /* OR */
- case 536: /* Shift Right Word */
- case 539: /* Shift Right Doubleword */
- case 922: /* Extend Sign Halfword */
- case 954: /* Extend Sign Byte */
- case 986: /* Extend Sign Word */
- case 538: /* Count Trailing Zeros Word */
- case 570: /* Count Trailing Zeros Doubleword */
- case 890: /* Extend-Sign Word and Shift Left Immediate (445) */
- case 890 | 1: /* Extend-Sign Word and Shift Left Immediate (445) */
+ case 24: /* Shift Left Word */
+ case 26: /* Count Leading Zeros Word */
+ case 27: /* Shift Left Doubleword */
+ case 28: /* AND */
+ case 58: /* Count Leading Zeros Doubleword */
+ case 60: /* AND with Complement */
+ case 124: /* NOR */
+ case 284: /* Equivalent */
+ case 316: /* XOR */
+ case 476: /* NAND */
+ case 412: /* OR with Complement */
+ case 444: /* OR */
+ case 536: /* Shift Right Word */
+ case 539: /* Shift Right Doubleword */
+ case 922: /* Extend Sign Halfword */
+ case 954: /* Extend Sign Byte */
+ case 986: /* Extend Sign Word */
+ case 538: /* Count Trailing Zeros Word */
+ case 570: /* Count Trailing Zeros Doubleword */
+ case 890: /* Extend-Sign Word and Shift Left Immediate (445) */
+ case 890 | 1: /* Extend-Sign Word and Shift Left Immediate (445) */
if (ext == 444 && tdep->ppc_ppr_regnum >= 0
&& (PPC_RS (insn) == PPC_RA (insn))
- && (PPC_RA (insn) == PPC_RB (insn))
- && !PPC_RC (insn))
+ && (PPC_RA (insn) == PPC_RB (insn)) && !PPC_RC (insn))
{
/* or Rx,Rx,Rx alters PRI in PPR. */
record_full_arch_list_add_reg (regcache, tdep->ppc_ppr_regnum);
@@ -5191,46 +5076,46 @@ ppc_process_record_op31 (struct gdbarch *gdbarch, struct regcache *regcache,
return 0;
/* Store memory. */
- case 181: /* Store Doubleword with Update Indexed */
- case 183: /* Store Word with Update Indexed */
- case 247: /* Store Byte with Update Indexed */
- case 439: /* Store Half Word with Update Indexed */
- case 695: /* Store Floating-Point Single with Update Indexed */
- case 759: /* Store Floating-Point Double with Update Indexed */
+ case 181: /* Store Doubleword with Update Indexed */
+ case 183: /* Store Word with Update Indexed */
+ case 247: /* Store Byte with Update Indexed */
+ case 439: /* Store Half Word with Update Indexed */
+ case 695: /* Store Floating-Point Single with Update Indexed */
+ case 759: /* Store Floating-Point Double with Update Indexed */
record_full_arch_list_add_reg (regcache,
tdep->ppc_gp0_regnum + PPC_RA (insn));
/* FALL-THROUGH */
- case 135: /* Store Vector Element Byte Indexed */
- case 167: /* Store Vector Element Halfword Indexed */
- case 199: /* Store Vector Element Word Indexed */
- case 231: /* Store Vector Indexed */
- case 487: /* Store Vector Indexed LRU */
- case 716: /* Store VSX Scalar Doubleword Indexed */
- case 140: /* Store VSX Scalar as Integer Word Indexed */
- case 652: /* Store VSX Scalar Single-Precision Indexed */
- case 972: /* Store VSX Vector Doubleword*2 Indexed */
- case 908: /* Store VSX Vector Word*4 Indexed */
- case 149: /* Store Doubleword Indexed */
- case 151: /* Store Word Indexed */
- case 215: /* Store Byte Indexed */
- case 407: /* Store Half Word Indexed */
- case 694: /* Store Byte Conditional Indexed */
- case 726: /* Store Halfword Conditional Indexed */
- case 150: /* Store Word Conditional Indexed */
- case 214: /* Store Doubleword Conditional Indexed */
- case 182: /* Store Quadword Conditional Indexed */
- case 662: /* Store Word Byte-Reverse Indexed */
- case 918: /* Store Halfword Byte-Reverse Indexed */
- case 660: /* Store Doubleword Byte-Reverse Indexed */
- case 663: /* Store Floating-Point Single Indexed */
- case 727: /* Store Floating-Point Double Indexed */
- case 919: /* Store Floating-Point Double Pair Indexed */
- case 983: /* Store Floating-Point as Integer Word Indexed */
- case 396: /* Store VSX Vector Indexed */
- case 940: /* Store VSX Vector Halfword*8 Indexed */
- case 1004: /* Store VSX Vector Byte*16 Indexed */
- case 909: /* Store VSX Scalar as Integer Byte Indexed */
- case 941: /* Store VSX Scalar as Integer Halfword Indexed */
+ case 135: /* Store Vector Element Byte Indexed */
+ case 167: /* Store Vector Element Halfword Indexed */
+ case 199: /* Store Vector Element Word Indexed */
+ case 231: /* Store Vector Indexed */
+ case 487: /* Store Vector Indexed LRU */
+ case 716: /* Store VSX Scalar Doubleword Indexed */
+ case 140: /* Store VSX Scalar as Integer Word Indexed */
+ case 652: /* Store VSX Scalar Single-Precision Indexed */
+ case 972: /* Store VSX Vector Doubleword*2 Indexed */
+ case 908: /* Store VSX Vector Word*4 Indexed */
+ case 149: /* Store Doubleword Indexed */
+ case 151: /* Store Word Indexed */
+ case 215: /* Store Byte Indexed */
+ case 407: /* Store Half Word Indexed */
+ case 694: /* Store Byte Conditional Indexed */
+ case 726: /* Store Halfword Conditional Indexed */
+ case 150: /* Store Word Conditional Indexed */
+ case 214: /* Store Doubleword Conditional Indexed */
+ case 182: /* Store Quadword Conditional Indexed */
+ case 662: /* Store Word Byte-Reverse Indexed */
+ case 918: /* Store Halfword Byte-Reverse Indexed */
+ case 660: /* Store Doubleword Byte-Reverse Indexed */
+ case 663: /* Store Floating-Point Single Indexed */
+ case 727: /* Store Floating-Point Double Indexed */
+ case 919: /* Store Floating-Point Double Pair Indexed */
+ case 983: /* Store Floating-Point as Integer Word Indexed */
+ case 396: /* Store VSX Vector Indexed */
+ case 940: /* Store VSX Vector Halfword*8 Indexed */
+ case 1004: /* Store VSX Vector Byte*16 Indexed */
+ case 909: /* Store VSX Scalar as Integer Byte Indexed */
+ case 941: /* Store VSX Scalar as Integer Halfword Indexed */
if (ext == 694 || ext == 726 || ext == 150 || ext == 214 || ext == 182)
record_full_arch_list_add_reg (regcache, tdep->ppc_cr_regnum);
@@ -5244,51 +5129,51 @@ ppc_process_record_op31 (struct gdbarch *gdbarch, struct regcache *regcache,
switch (ext)
{
- case 183: /* Store Word with Update Indexed */
- case 199: /* Store Vector Element Word Indexed */
- case 140: /* Store VSX Scalar as Integer Word Indexed */
- case 652: /* Store VSX Scalar Single-Precision Indexed */
- case 151: /* Store Word Indexed */
- case 150: /* Store Word Conditional Indexed */
- case 662: /* Store Word Byte-Reverse Indexed */
- case 663: /* Store Floating-Point Single Indexed */
- case 695: /* Store Floating-Point Single with Update Indexed */
- case 983: /* Store Floating-Point as Integer Word Indexed */
+ case 183: /* Store Word with Update Indexed */
+ case 199: /* Store Vector Element Word Indexed */
+ case 140: /* Store VSX Scalar as Integer Word Indexed */
+ case 652: /* Store VSX Scalar Single-Precision Indexed */
+ case 151: /* Store Word Indexed */
+ case 150: /* Store Word Conditional Indexed */
+ case 662: /* Store Word Byte-Reverse Indexed */
+ case 663: /* Store Floating-Point Single Indexed */
+ case 695: /* Store Floating-Point Single with Update Indexed */
+ case 983: /* Store Floating-Point as Integer Word Indexed */
size = 4;
break;
- case 247: /* Store Byte with Update Indexed */
- case 135: /* Store Vector Element Byte Indexed */
- case 215: /* Store Byte Indexed */
- case 694: /* Store Byte Conditional Indexed */
- case 909: /* Store VSX Scalar as Integer Byte Indexed */
+ case 247: /* Store Byte with Update Indexed */
+ case 135: /* Store Vector Element Byte Indexed */
+ case 215: /* Store Byte Indexed */
+ case 694: /* Store Byte Conditional Indexed */
+ case 909: /* Store VSX Scalar as Integer Byte Indexed */
size = 1;
break;
- case 439: /* Store Halfword with Update Indexed */
- case 167: /* Store Vector Element Halfword Indexed */
- case 407: /* Store Halfword Indexed */
- case 726: /* Store Halfword Conditional Indexed */
- case 918: /* Store Halfword Byte-Reverse Indexed */
- case 941: /* Store VSX Scalar as Integer Halfword Indexed */
+ case 439: /* Store Halfword with Update Indexed */
+ case 167: /* Store Vector Element Halfword Indexed */
+ case 407: /* Store Halfword Indexed */
+ case 726: /* Store Halfword Conditional Indexed */
+ case 918: /* Store Halfword Byte-Reverse Indexed */
+ case 941: /* Store VSX Scalar as Integer Halfword Indexed */
size = 2;
break;
- case 181: /* Store Doubleword with Update Indexed */
- case 716: /* Store VSX Scalar Doubleword Indexed */
- case 149: /* Store Doubleword Indexed */
- case 214: /* Store Doubleword Conditional Indexed */
- case 660: /* Store Doubleword Byte-Reverse Indexed */
- case 727: /* Store Floating-Point Double Indexed */
- case 759: /* Store Floating-Point Double with Update Indexed */
+ case 181: /* Store Doubleword with Update Indexed */
+ case 716: /* Store VSX Scalar Doubleword Indexed */
+ case 149: /* Store Doubleword Indexed */
+ case 214: /* Store Doubleword Conditional Indexed */
+ case 660: /* Store Doubleword Byte-Reverse Indexed */
+ case 727: /* Store Floating-Point Double Indexed */
+ case 759: /* Store Floating-Point Double with Update Indexed */
size = 8;
break;
- case 972: /* Store VSX Vector Doubleword*2 Indexed */
- case 908: /* Store VSX Vector Word*4 Indexed */
- case 182: /* Store Quadword Conditional Indexed */
- case 231: /* Store Vector Indexed */
- case 487: /* Store Vector Indexed LRU */
- case 919: /* Store Floating-Point Double Pair Indexed */
- case 396: /* Store VSX Vector Indexed */
- case 940: /* Store VSX Vector Halfword*8 Indexed */
- case 1004: /* Store VSX Vector Byte*16 Indexed */
+ case 972: /* Store VSX Vector Doubleword*2 Indexed */
+ case 908: /* Store VSX Vector Word*4 Indexed */
+ case 182: /* Store Quadword Conditional Indexed */
+ case 231: /* Store Vector Indexed */
+ case 487: /* Store Vector Indexed LRU */
+ case 919: /* Store Floating-Point Double Pair Indexed */
+ case 396: /* Store VSX Vector Indexed */
+ case 940: /* Store VSX Vector Halfword*8 Indexed */
+ case 1004: /* Store VSX Vector Byte*16 Indexed */
size = 16;
break;
default:
@@ -5298,16 +5183,16 @@ ppc_process_record_op31 (struct gdbarch *gdbarch, struct regcache *regcache,
/* Align address for Store Vector instructions. */
switch (ext)
{
- case 167: /* Store Vector Element Halfword Indexed */
+ case 167: /* Store Vector Element Halfword Indexed */
ea = ea & ~0x1ULL;
break;
- case 199: /* Store Vector Element Word Indexed */
+ case 199: /* Store Vector Element Word Indexed */
ea = ea & ~0x3ULL;
break;
- case 231: /* Store Vector Indexed */
- case 487: /* Store Vector Indexed LRU */
+ case 231: /* Store Vector Indexed */
+ case 487: /* Store Vector Indexed LRU */
ea = ea & ~0xfULL;
break;
}
@@ -5315,19 +5200,23 @@ ppc_process_record_op31 (struct gdbarch *gdbarch, struct regcache *regcache,
record_full_arch_list_add_mem (ea, size);
return 0;
- case 141: /* Store VSX Vector Rightmost Byte Indexed */
- case 173: /* Store VSX Vector Rightmost Halfword Indexed */
- case 205: /* Store VSX Vector Rightmost Word Indexed */
- case 237: /* Store VSX Vector Rightmost Doubleword Indexed */
- switch(ext)
+ case 141: /* Store VSX Vector Rightmost Byte Indexed */
+ case 173: /* Store VSX Vector Rightmost Halfword Indexed */
+ case 205: /* Store VSX Vector Rightmost Word Indexed */
+ case 237: /* Store VSX Vector Rightmost Doubleword Indexed */
+ switch (ext)
{
- case 141: nb = 1;
+ case 141:
+ nb = 1;
break;
- case 173: nb = 2;
+ case 173:
+ nb = 2;
break;
- case 205: nb = 4;
+ case 205:
+ nb = 4;
break;
- case 237: nb = 8;
+ case 237:
+ nb = 8;
break;
}
ra = 0;
@@ -5335,13 +5224,13 @@ ppc_process_record_op31 (struct gdbarch *gdbarch, struct regcache *regcache,
regcache_raw_read_unsigned (regcache,
tdep->ppc_gp0_regnum + PPC_RA (insn), &ra);
regcache_raw_read_unsigned (regcache,
- tdep->ppc_gp0_regnum + PPC_RB (insn), &rb);
+ tdep->ppc_gp0_regnum + PPC_RB (insn), &rb);
ea = ra + rb;
record_full_arch_list_add_mem (ea, nb);
return 0;
- case 397: /* Store VSX Vector with Length */
- case 429: /* Store VSX Vector Left-justified with Length */
+ case 397: /* Store VSX Vector with Length */
+ case 429: /* Store VSX Vector Left-justified with Length */
ra = 0;
if (PPC_RA (insn) != 0)
regcache_raw_read_unsigned (regcache,
@@ -5355,12 +5244,12 @@ ppc_process_record_op31 (struct gdbarch *gdbarch, struct regcache *regcache,
record_full_arch_list_add_mem (ea, nb);
return 0;
- case 461: /* Store VSX Vector Paired Indexed */
+ case 461: /* Store VSX Vector Paired Indexed */
{
if (PPC_RA (insn) != 0)
regcache_raw_read_unsigned (regcache,
- tdep->ppc_gp0_regnum
- + PPC_RA (insn), &ea);
+ tdep->ppc_gp0_regnum + PPC_RA (insn),
+ &ea);
regcache_raw_read_unsigned (regcache,
tdep->ppc_gp0_regnum + PPC_RB (insn), &rb);
ea += rb;
@@ -5368,8 +5257,8 @@ ppc_process_record_op31 (struct gdbarch *gdbarch, struct regcache *regcache,
return 0;
}
- case 710: /* Store Word Atomic */
- case 742: /* Store Doubleword Atomic */
+ case 710: /* Store Word Atomic */
+ case 742: /* Store Doubleword Atomic */
ra = 0;
if (PPC_RA (insn) != 0)
regcache_raw_read_unsigned (regcache,
@@ -5377,10 +5266,10 @@ ppc_process_record_op31 (struct gdbarch *gdbarch, struct regcache *regcache,
ea = ra;
switch (ext)
{
- case 710: /* Store Word Atomic */
+ case 710: /* Store Word Atomic */
size = 8;
break;
- case 742: /* Store Doubleword Atomic */
+ case 742: /* Store Doubleword Atomic */
size = 16;
break;
default:
@@ -5389,7 +5278,7 @@ ppc_process_record_op31 (struct gdbarch *gdbarch, struct regcache *regcache,
record_full_arch_list_add_mem (ea, size);
return 0;
- case 725: /* Store String Word Immediate */
+ case 725: /* Store String Word Immediate */
ra = 0;
if (PPC_RA (insn) != 0)
regcache_raw_read_unsigned (regcache,
@@ -5404,7 +5293,7 @@ ppc_process_record_op31 (struct gdbarch *gdbarch, struct regcache *regcache,
return 0;
- case 661: /* Store String Word Indexed */
+ case 661: /* Store String Word Indexed */
ra = 0;
if (PPC_RA (insn) != 0)
regcache_raw_read_unsigned (regcache,
@@ -5425,31 +5314,31 @@ ppc_process_record_op31 (struct gdbarch *gdbarch, struct regcache *regcache,
return 0;
- case 467: /* Move To Special Purpose Register */
+ case 467: /* Move To Special Purpose Register */
switch (PPC_SPR (insn))
{
- case 1: /* XER */
+ case 1: /* XER */
record_full_arch_list_add_reg (regcache, tdep->ppc_xer_regnum);
return 0;
- case 3: /* DSCR */
+ case 3: /* DSCR */
if (tdep->ppc_dscr_regnum >= 0)
record_full_arch_list_add_reg (regcache, tdep->ppc_dscr_regnum);
return 0;
- case 8: /* LR */
+ case 8: /* LR */
record_full_arch_list_add_reg (regcache, tdep->ppc_lr_regnum);
return 0;
- case 9: /* CTR */
+ case 9: /* CTR */
record_full_arch_list_add_reg (regcache, tdep->ppc_ctr_regnum);
return 0;
- case 256: /* VRSAVE */
+ case 256: /* VRSAVE */
record_full_arch_list_add_reg (regcache, tdep->ppc_vrsave_regnum);
return 0;
- case 815: /* TAR */
+ case 815: /* TAR */
if (tdep->ppc_tar_regnum >= 0)
record_full_arch_list_add_reg (regcache, tdep->ppc_tar_regnum);
return 0;
case 896:
- case 898: /* PPR */
+ case 898: /* PPR */
if (tdep->ppc_ppr_regnum >= 0)
record_full_arch_list_add_reg (regcache, tdep->ppc_ppr_regnum);
return 0;
@@ -5457,50 +5346,49 @@ ppc_process_record_op31 (struct gdbarch *gdbarch, struct regcache *regcache,
goto UNKNOWN_OP;
- case 147: /* Move To Split Little Endian */
+ case 147: /* Move To Split Little Endian */
record_full_arch_list_add_reg (regcache, tdep->ppc_ps_regnum);
return 0;
- case 512: /* Move to Condition Register from XER */
+ case 512: /* Move to Condition Register from XER */
record_full_arch_list_add_reg (regcache, tdep->ppc_cr_regnum);
record_full_arch_list_add_reg (regcache, tdep->ppc_xer_regnum);
return 0;
- case 4: /* Trap Word */
- case 68: /* Trap Doubleword */
- case 430: /* Clear BHRB */
- case 598: /* Synchronize */
- case 62: /* Wait for Interrupt */
- case 30: /* Wait */
- case 22: /* Instruction Cache Block Touch */
- case 854: /* Enforce In-order Execution of I/O */
- case 246: /* Data Cache Block Touch for Store */
- case 54: /* Data Cache Block Store */
- case 86: /* Data Cache Block Flush */
- case 278: /* Data Cache Block Touch */
- case 758: /* Data Cache Block Allocate */
- case 982: /* Instruction Cache Block Invalidate */
- case 774: /* Copy */
- case 838: /* CP_Abort */
+ case 4: /* Trap Word */
+ case 68: /* Trap Doubleword */
+ case 430: /* Clear BHRB */
+ case 598: /* Synchronize */
+ case 62: /* Wait for Interrupt */
+ case 30: /* Wait */
+ case 22: /* Instruction Cache Block Touch */
+ case 854: /* Enforce In-order Execution of I/O */
+ case 246: /* Data Cache Block Touch for Store */
+ case 54: /* Data Cache Block Store */
+ case 86: /* Data Cache Block Flush */
+ case 278: /* Data Cache Block Touch */
+ case 758: /* Data Cache Block Allocate */
+ case 982: /* Instruction Cache Block Invalidate */
+ case 774: /* Copy */
+ case 838: /* CP_Abort */
return 0;
- case 654: /* Transaction Begin */
- case 686: /* Transaction End */
- case 750: /* Transaction Suspend or Resume */
- case 782: /* Transaction Abort Word Conditional */
- case 814: /* Transaction Abort Doubleword Conditional */
- case 846: /* Transaction Abort Word Conditional Immediate */
- case 878: /* Transaction Abort Doubleword Conditional Immediate */
- case 910: /* Transaction Abort */
+ case 654: /* Transaction Begin */
+ case 686: /* Transaction End */
+ case 750: /* Transaction Suspend or Resume */
+ case 782: /* Transaction Abort Word Conditional */
+ case 814: /* Transaction Abort Doubleword Conditional */
+ case 846: /* Transaction Abort Word Conditional Immediate */
+ case 878: /* Transaction Abort Doubleword Conditional Immediate */
+ case 910: /* Transaction Abort */
record_full_arch_list_add_reg (regcache, tdep->ppc_ps_regnum);
/* FALL-THROUGH */
- case 718: /* Transaction Check */
+ case 718: /* Transaction Check */
record_full_arch_list_add_reg (regcache, tdep->ppc_cr_regnum);
return 0;
- case 1014: /* Data Cache Block set to Zero */
- if (target_auxv_search (AT_DCACHEBSIZE, &at_dcsz) <= 0
- || at_dcsz == 0)
+ case 1014: /* Data Cache Block set to Zero */
+ if (target_auxv_search (AT_DCACHEBSIZE, &at_dcsz) <= 0 || at_dcsz == 0)
at_dcsz = 128; /* Assume 128-byte cache line size (POWER8) */
ra = 0;
@@ -5519,8 +5407,10 @@ ppc_process_record_op31 (struct gdbarch *gdbarch, struct regcache *regcache,
}
UNKNOWN_OP:
- gdb_printf (gdb_stdlog, "Warning: Don't know how to record %08x "
- "at %s, 31-%d.\n", insn, paddress (gdbarch, addr), ext);
+ gdb_printf (gdb_stdlog,
+ "Warning: Don't know how to record %08x "
+ "at %s, 31-%d.\n",
+ insn, paddress (gdbarch, addr), ext);
return -1;
}
@@ -5541,17 +5431,17 @@ ppc_process_record_op59 (struct gdbarch *gdbarch, struct regcache *regcache,
switch (ext & 0x1f)
{
- case 18: /* Floating Divide */
- case 20: /* Floating Subtract */
- case 21: /* Floating Add */
- case 22: /* Floating Square Root */
- case 24: /* Floating Reciprocal Estimate */
- case 25: /* Floating Multiply */
- case 26: /* Floating Reciprocal Square Root Estimate */
- case 28: /* Floating Multiply-Subtract */
- case 29: /* Floating Multiply-Add */
- case 30: /* Floating Negative Multiply-Subtract */
- case 31: /* Floating Negative Multiply-Add */
+ case 18: /* Floating Divide */
+ case 20: /* Floating Subtract */
+ case 21: /* Floating Add */
+ case 22: /* Floating Square Root */
+ case 24: /* Floating Reciprocal Estimate */
+ case 25: /* Floating Multiply */
+ case 26: /* Floating Reciprocal Square Root Estimate */
+ case 28: /* Floating Multiply-Subtract */
+ case 29: /* Floating Multiply-Add */
+ case 30: /* Floating Negative Multiply-Subtract */
+ case 31: /* Floating Negative Multiply-Add */
record_full_arch_list_add_reg (regcache,
tdep->ppc_fp0_regnum + PPC_FRT (insn));
if (PPC_RC (insn))
@@ -5562,70 +5452,70 @@ ppc_process_record_op59 (struct gdbarch *gdbarch, struct regcache *regcache,
}
/* MMA instructions, keep looking. */
- switch (ext >> 2) /* Additional opcode field is upper 8-bits of ext */
+ switch (ext >> 2) /* Additional opcode field is upper 8-bits of ext */
{
- case 3: /* VSX Vector 8-bit Signed/Unsigned Integer GER, xvi8ger4 */
- case 2: /* VSX Vector 8-bit Signed/Unsigned Integer GER Positive
+ case 3: /* VSX Vector 8-bit Signed/Unsigned Integer GER, xvi8ger4 */
+ case 2: /* VSX Vector 8-bit Signed/Unsigned Integer GER Positive
multiply, Positive accumulate, xvi8ger4pp */
- case 99: /* VSX Vector 8-bit Signed/Unsigned Integer GER with
+ case 99: /* VSX Vector 8-bit Signed/Unsigned Integer GER with
Saturate Positive multiply, Positive accumulate,
xvi8ger4spp */
- case 35: /* VSX Vector 4-bit Signed Integer GER, xvi4ger8 */
- case 34: /* VSX Vector 4-bit Signed Integer GER Positive multiply,
+ case 35: /* VSX Vector 4-bit Signed Integer GER, xvi4ger8 */
+ case 34: /* VSX Vector 4-bit Signed Integer GER Positive multiply,
Positive accumulate, xvi4ger8pp */
- case 75: /* VSX Vector 16-bit Signed Integer GER, xvi16ger2 */
- case 107: /* VSX Vector 16-bit Signed Integer GER Positive multiply,
+ case 75: /* VSX Vector 16-bit Signed Integer GER, xvi16ger2 */
+ case 107: /* VSX Vector 16-bit Signed Integer GER Positive multiply,
Positive accumulate, xvi16ger2pp */
- case 43: /* VSX Vector 16-bit Signed Integer GER with Saturation,
+ case 43: /* VSX Vector 16-bit Signed Integer GER with Saturation,
xvi16ger2s */
- case 42: /* VSX Vector 16-bit Signed Integer GER with Saturation
+ case 42: /* VSX Vector 16-bit Signed Integer GER with Saturation
Positive multiply, Positive accumulate, xvi16ger2spp */
ppc_record_ACC_fpscr (regcache, tdep, at, false);
return 0;
- case 19: /* VSX Vector 16-bit Floating-Point GER, xvf16ger2 */
- case 18: /* VSX Vector 16-bit Floating-Point GER Positive multiply,
+ case 19: /* VSX Vector 16-bit Floating-Point GER, xvf16ger2 */
+ case 18: /* VSX Vector 16-bit Floating-Point GER Positive multiply,
Positive accumulate, xvf16ger2pp */
- case 146: /* VSX Vector 16-bit Floating-Point GER Positive multiply,
+ case 146: /* VSX Vector 16-bit Floating-Point GER Positive multiply,
Negative accumulate, xvf16ger2pn */
- case 82: /* VSX Vector 16-bit Floating-Point GER Negative multiply,
+ case 82: /* VSX Vector 16-bit Floating-Point GER Negative multiply,
Positive accumulate, xvf16ger2np */
- case 210: /* VSX Vector 16-bit Floating-Point GER Negative multiply,
+ case 210: /* VSX Vector 16-bit Floating-Point GER Negative multiply,
Negative accumulate, xvf16ger2nn */
- case 27: /* VSX Vector 32-bit Floating-Point GER, xvf32ger */
- case 26: /* VSX Vector 32-bit Floating-Point GER Positive multiply,
+ case 27: /* VSX Vector 32-bit Floating-Point GER, xvf32ger */
+ case 26: /* VSX Vector 32-bit Floating-Point GER Positive multiply,
Positive accumulate, xvf32gerpp */
- case 154: /* VSX Vector 32-bit Floating-Point GER Positive multiply,
+ case 154: /* VSX Vector 32-bit Floating-Point GER Positive multiply,
Negative accumulate, xvf32gerpn */
- case 90: /* VSX Vector 32-bit Floating-Point GER Negative multiply,
+ case 90: /* VSX Vector 32-bit Floating-Point GER Negative multiply,
Positive accumulate, xvf32gernp */
- case 218: /* VSX Vector 32-bit Floating-Point GER Negative multiply,
+ case 218: /* VSX Vector 32-bit Floating-Point GER Negative multiply,
Negative accumulate, xvf32gernn */
- case 59: /* VSX Vector 64-bit Floating-Point GER, pmdmxvf64ger
+ case 59: /* VSX Vector 64-bit Floating-Point GER, pmdmxvf64ger
(pmxvf64ger) */
- case 58: /* VSX Vector 64-bit Floating-Point GER Positive multiply,
+ case 58: /* VSX Vector 64-bit Floating-Point GER Positive multiply,
Positive accumulate, xvf64gerpp */
- case 186: /* VSX Vector 64-bit Floating-Point GER Positive multiply,
+ case 186: /* VSX Vector 64-bit Floating-Point GER Positive multiply,
Negative accumulate, xvf64gerpn */
- case 122: /* VSX Vector 64-bit Floating-Point GER Negative multiply,
+ case 122: /* VSX Vector 64-bit Floating-Point GER Negative multiply,
Positive accumulate, xvf64gernp */
- case 250: /* VSX Vector 64-bit Floating-Point GER Negative multiply,
+ case 250: /* VSX Vector 64-bit Floating-Point GER Negative multiply,
Negative accumulate, pmdmxvf64gernn (pmxvf64gernn) */
- case 51: /* VSX Vector bfloat16 GER, xvbf16ger2 */
- case 50: /* VSX Vector bfloat16 GER Positive multiply,
+ case 51: /* VSX Vector bfloat16 GER, xvbf16ger2 */
+ case 50: /* VSX Vector bfloat16 GER Positive multiply,
Positive accumulate, xvbf16ger2pp */
- case 178: /* VSX Vector bfloat16 GER Positive multiply,
+ case 178: /* VSX Vector bfloat16 GER Positive multiply,
Negative accumulate, xvbf16ger2pn */
- case 114: /* VSX Vector bfloat16 GER Negative multiply,
+ case 114: /* VSX Vector bfloat16 GER Negative multiply,
Positive accumulate, xvbf16ger2np */
- case 242: /* VSX Vector bfloat16 GER Negative multiply,
+ case 242: /* VSX Vector bfloat16 GER Negative multiply,
Negative accumulate, xvbf16ger2nn */
ppc_record_ACC_fpscr (regcache, tdep, at, true);
return 0;
@@ -5633,20 +5523,20 @@ ppc_process_record_op59 (struct gdbarch *gdbarch, struct regcache *regcache,
switch (ext)
{
- case 2: /* DFP Add */
- case 3: /* DFP Quantize */
- case 34: /* DFP Multiply */
- case 35: /* DFP Reround */
- case 67: /* DFP Quantize Immediate */
- case 99: /* DFP Round To FP Integer With Inexact */
- case 227: /* DFP Round To FP Integer Without Inexact */
- case 258: /* DFP Convert To DFP Long! */
- case 290: /* DFP Convert To Fixed */
- case 514: /* DFP Subtract */
- case 546: /* DFP Divide */
- case 770: /* DFP Round To DFP Short! */
- case 802: /* DFP Convert From Fixed */
- case 834: /* DFP Encode BCD To DPD */
+ case 2: /* DFP Add */
+ case 3: /* DFP Quantize */
+ case 34: /* DFP Multiply */
+ case 35: /* DFP Reround */
+ case 67: /* DFP Quantize Immediate */
+ case 99: /* DFP Round To FP Integer With Inexact */
+ case 227: /* DFP Round To FP Integer Without Inexact */
+ case 258: /* DFP Convert To DFP Long! */
+ case 290: /* DFP Convert To Fixed */
+ case 514: /* DFP Subtract */
+ case 546: /* DFP Divide */
+ case 770: /* DFP Round To DFP Short! */
+ case 802: /* DFP Convert From Fixed */
+ case 834: /* DFP Encode BCD To DPD */
if (PPC_RC (insn))
record_full_arch_list_add_reg (regcache, tdep->ppc_cr_regnum);
record_full_arch_list_add_reg (regcache,
@@ -5654,30 +5544,30 @@ ppc_process_record_op59 (struct gdbarch *gdbarch, struct regcache *regcache,
record_full_arch_list_add_reg (regcache, tdep->ppc_fpscr_regnum);
return 0;
- case 130: /* DFP Compare Ordered */
- case 162: /* DFP Test Exponent */
- case 194: /* DFP Test Data Class */
- case 226: /* DFP Test Data Group */
- case 642: /* DFP Compare Unordered */
- case 674: /* DFP Test Significance */
- case 675: /* DFP Test Significance Immediate */
+ case 130: /* DFP Compare Ordered */
+ case 162: /* DFP Test Exponent */
+ case 194: /* DFP Test Data Class */
+ case 226: /* DFP Test Data Group */
+ case 642: /* DFP Compare Unordered */
+ case 674: /* DFP Test Significance */
+ case 675: /* DFP Test Significance Immediate */
record_full_arch_list_add_reg (regcache, tdep->ppc_cr_regnum);
record_full_arch_list_add_reg (regcache, tdep->ppc_fpscr_regnum);
return 0;
- case 66: /* DFP Shift Significand Left Immediate */
- case 98: /* DFP Shift Significand Right Immediate */
- case 322: /* DFP Decode DPD To BCD */
- case 354: /* DFP Extract Biased Exponent */
- case 866: /* DFP Insert Biased Exponent */
+ case 66: /* DFP Shift Significand Left Immediate */
+ case 98: /* DFP Shift Significand Right Immediate */
+ case 322: /* DFP Decode DPD To BCD */
+ case 354: /* DFP Extract Biased Exponent */
+ case 866: /* DFP Insert Biased Exponent */
record_full_arch_list_add_reg (regcache,
tdep->ppc_fp0_regnum + PPC_FRT (insn));
if (PPC_RC (insn))
record_full_arch_list_add_reg (regcache, tdep->ppc_cr_regnum);
return 0;
- case 846: /* Floating Convert From Integer Doubleword Single */
- case 974: /* Floating Convert From Integer Doubleword Unsigned
+ case 846: /* Floating Convert From Integer Doubleword Single */
+ case 974: /* Floating Convert From Integer Doubleword Unsigned
Single */
record_full_arch_list_add_reg (regcache,
tdep->ppc_fp0_regnum + PPC_FRT (insn));
@@ -5688,8 +5578,10 @@ ppc_process_record_op59 (struct gdbarch *gdbarch, struct regcache *regcache,
return 0;
}
- gdb_printf (gdb_stdlog, "Warning: Don't know how to record %08x "
- "at %s, 59-%d.\n", insn, paddress (gdbarch, addr), ext);
+ gdb_printf (gdb_stdlog,
+ "Warning: Don't know how to record %08x "
+ "at %s, 59-%d.\n",
+ insn, paddress (gdbarch, addr), ext);
return -1;
}
@@ -5698,36 +5590,36 @@ ppc_process_record_op59 (struct gdbarch *gdbarch, struct regcache *regcache,
static int
ppc_process_record_op60_XX2 (struct gdbarch *gdbarch,
- struct regcache *regcache,
- CORE_ADDR addr, uint32_t insn)
+ struct regcache *regcache, CORE_ADDR addr,
+ uint32_t insn)
{
ppc_gdbarch_tdep *tdep = gdbarch_tdep<ppc_gdbarch_tdep> (gdbarch);
- int RA_opcode = PPC_RA(insn);
+ int RA_opcode = PPC_RA (insn);
switch (RA_opcode)
{
- case 2: /* VSX Vector Test Least-Significant Bit by Byte */
- case 25: /* VSX Vector round and Convert Single-Precision format
+ case 2: /* VSX Vector Test Least-Significant Bit by Byte */
+ case 25: /* VSX Vector round and Convert Single-Precision format
to Half-Precision format. Only changes the CR
field. */
record_full_arch_list_add_reg (regcache, tdep->ppc_cr_regnum);
return 0;
- case 17: /* VSX Vector Convert with round Single-Precision
+ case 17: /* VSX Vector Convert with round Single-Precision
to bfloat16 format */
- case 24: /* VSX Vector Convert Half-Precision format to
+ case 24: /* VSX Vector Convert Half-Precision format to
Single-Precision format */
record_full_arch_list_add_reg (regcache, tdep->ppc_fpscr_regnum);
/* Fall-through */
- case 0: /* VSX Vector Extract Exponent Double-Precision */
- case 1: /* VSX Vector Extract Significand Double-Precision */
- case 7: /* VSX Vector Byte-Reverse Halfword */
- case 8: /* VSX Vector Extract Exponent Single-Precision */
- case 9: /* VSX Vector Extract Significand Single-Precision */
- case 15: /* VSX Vector Byte-Reverse Word */
- case 16: /* VSX Vector Convert bfloat16 to Single-Precision
+ case 0: /* VSX Vector Extract Exponent Double-Precision */
+ case 1: /* VSX Vector Extract Significand Double-Precision */
+ case 7: /* VSX Vector Byte-Reverse Halfword */
+ case 8: /* VSX Vector Extract Exponent Single-Precision */
+ case 9: /* VSX Vector Extract Significand Single-Precision */
+ case 15: /* VSX Vector Byte-Reverse Word */
+ case 16: /* VSX Vector Convert bfloat16 to Single-Precision
format Non-signaling */
- case 23: /* VSX Vector Byte-Reverse Doubleword */
- case 31: /* VSX Vector Byte-Reverse Quadword */
+ case 23: /* VSX Vector Byte-Reverse Doubleword */
+ case 31: /* VSX Vector Byte-Reverse Quadword */
ppc_record_vsr (regcache, tdep, PPC_XT (insn));
return 0;
}
@@ -5740,118 +5632,118 @@ ppc_process_record_op60_XX2 (struct gdbarch *gdbarch,
static int
ppc_process_record_op60 (struct gdbarch *gdbarch, struct regcache *regcache,
- CORE_ADDR addr, uint32_t insn)
+ CORE_ADDR addr, uint32_t insn)
{
ppc_gdbarch_tdep *tdep = gdbarch_tdep<ppc_gdbarch_tdep> (gdbarch);
int ext = PPC_EXTOP (insn);
switch (ext >> 2)
{
- case 0: /* VSX Scalar Add Single-Precision */
- case 32: /* VSX Scalar Add Double-Precision */
- case 24: /* VSX Scalar Divide Single-Precision */
- case 56: /* VSX Scalar Divide Double-Precision */
- case 176: /* VSX Scalar Copy Sign Double-Precision */
- case 33: /* VSX Scalar Multiply-Add Double-Precision */
- case 41: /* ditto */
- case 1: /* VSX Scalar Multiply-Add Single-Precision */
- case 9: /* ditto */
- case 160: /* VSX Scalar Maximum Double-Precision */
- case 168: /* VSX Scalar Minimum Double-Precision */
- case 49: /* VSX Scalar Multiply-Subtract Double-Precision */
- case 57: /* ditto */
- case 17: /* VSX Scalar Multiply-Subtract Single-Precision */
- case 25: /* ditto */
- case 48: /* VSX Scalar Multiply Double-Precision */
- case 16: /* VSX Scalar Multiply Single-Precision */
- case 161: /* VSX Scalar Negative Multiply-Add Double-Precision */
- case 169: /* ditto */
- case 129: /* VSX Scalar Negative Multiply-Add Single-Precision */
- case 137: /* ditto */
- case 177: /* VSX Scalar Negative Multiply-Subtract Double-Precision */
- case 185: /* ditto */
- case 145: /* VSX Scalar Negative Multiply-Subtract Single-Precision */
- case 153: /* ditto */
- case 40: /* VSX Scalar Subtract Double-Precision */
- case 8: /* VSX Scalar Subtract Single-Precision */
- case 96: /* VSX Vector Add Double-Precision */
- case 64: /* VSX Vector Add Single-Precision */
- case 120: /* VSX Vector Divide Double-Precision */
- case 88: /* VSX Vector Divide Single-Precision */
- case 97: /* VSX Vector Multiply-Add Double-Precision */
- case 105: /* ditto */
- case 65: /* VSX Vector Multiply-Add Single-Precision */
- case 73: /* ditto */
- case 224: /* VSX Vector Maximum Double-Precision */
- case 192: /* VSX Vector Maximum Single-Precision */
- case 232: /* VSX Vector Minimum Double-Precision */
- case 200: /* VSX Vector Minimum Single-Precision */
- case 113: /* VSX Vector Multiply-Subtract Double-Precision */
- case 121: /* ditto */
- case 81: /* VSX Vector Multiply-Subtract Single-Precision */
- case 89: /* ditto */
- case 112: /* VSX Vector Multiply Double-Precision */
- case 80: /* VSX Vector Multiply Single-Precision */
- case 225: /* VSX Vector Negative Multiply-Add Double-Precision */
- case 233: /* ditto */
- case 193: /* VSX Vector Negative Multiply-Add Single-Precision */
- case 201: /* ditto */
- case 241: /* VSX Vector Negative Multiply-Subtract Double-Precision */
- case 249: /* ditto */
- case 209: /* VSX Vector Negative Multiply-Subtract Single-Precision */
- case 217: /* ditto */
- case 104: /* VSX Vector Subtract Double-Precision */
- case 72: /* VSX Vector Subtract Single-Precision */
- case 128: /* VSX Scalar Maximum Type-C Double-Precision */
- case 136: /* VSX Scalar Minimum Type-C Double-Precision */
- case 144: /* VSX Scalar Maximum Type-J Double-Precision */
- case 152: /* VSX Scalar Minimum Type-J Double-Precision */
- case 3: /* VSX Scalar Compare Equal Double-Precision */
- case 11: /* VSX Scalar Compare Greater Than Double-Precision */
- case 19: /* VSX Scalar Compare Greater Than or Equal
+ case 0: /* VSX Scalar Add Single-Precision */
+ case 32: /* VSX Scalar Add Double-Precision */
+ case 24: /* VSX Scalar Divide Single-Precision */
+ case 56: /* VSX Scalar Divide Double-Precision */
+ case 176: /* VSX Scalar Copy Sign Double-Precision */
+ case 33: /* VSX Scalar Multiply-Add Double-Precision */
+ case 41: /* ditto */
+ case 1: /* VSX Scalar Multiply-Add Single-Precision */
+ case 9: /* ditto */
+ case 160: /* VSX Scalar Maximum Double-Precision */
+ case 168: /* VSX Scalar Minimum Double-Precision */
+ case 49: /* VSX Scalar Multiply-Subtract Double-Precision */
+ case 57: /* ditto */
+ case 17: /* VSX Scalar Multiply-Subtract Single-Precision */
+ case 25: /* ditto */
+ case 48: /* VSX Scalar Multiply Double-Precision */
+ case 16: /* VSX Scalar Multiply Single-Precision */
+ case 161: /* VSX Scalar Negative Multiply-Add Double-Precision */
+ case 169: /* ditto */
+ case 129: /* VSX Scalar Negative Multiply-Add Single-Precision */
+ case 137: /* ditto */
+ case 177: /* VSX Scalar Negative Multiply-Subtract Double-Precision */
+ case 185: /* ditto */
+ case 145: /* VSX Scalar Negative Multiply-Subtract Single-Precision */
+ case 153: /* ditto */
+ case 40: /* VSX Scalar Subtract Double-Precision */
+ case 8: /* VSX Scalar Subtract Single-Precision */
+ case 96: /* VSX Vector Add Double-Precision */
+ case 64: /* VSX Vector Add Single-Precision */
+ case 120: /* VSX Vector Divide Double-Precision */
+ case 88: /* VSX Vector Divide Single-Precision */
+ case 97: /* VSX Vector Multiply-Add Double-Precision */
+ case 105: /* ditto */
+ case 65: /* VSX Vector Multiply-Add Single-Precision */
+ case 73: /* ditto */
+ case 224: /* VSX Vector Maximum Double-Precision */
+ case 192: /* VSX Vector Maximum Single-Precision */
+ case 232: /* VSX Vector Minimum Double-Precision */
+ case 200: /* VSX Vector Minimum Single-Precision */
+ case 113: /* VSX Vector Multiply-Subtract Double-Precision */
+ case 121: /* ditto */
+ case 81: /* VSX Vector Multiply-Subtract Single-Precision */
+ case 89: /* ditto */
+ case 112: /* VSX Vector Multiply Double-Precision */
+ case 80: /* VSX Vector Multiply Single-Precision */
+ case 225: /* VSX Vector Negative Multiply-Add Double-Precision */
+ case 233: /* ditto */
+ case 193: /* VSX Vector Negative Multiply-Add Single-Precision */
+ case 201: /* ditto */
+ case 241: /* VSX Vector Negative Multiply-Subtract Double-Precision */
+ case 249: /* ditto */
+ case 209: /* VSX Vector Negative Multiply-Subtract Single-Precision */
+ case 217: /* ditto */
+ case 104: /* VSX Vector Subtract Double-Precision */
+ case 72: /* VSX Vector Subtract Single-Precision */
+ case 128: /* VSX Scalar Maximum Type-C Double-Precision */
+ case 136: /* VSX Scalar Minimum Type-C Double-Precision */
+ case 144: /* VSX Scalar Maximum Type-J Double-Precision */
+ case 152: /* VSX Scalar Minimum Type-J Double-Precision */
+ case 3: /* VSX Scalar Compare Equal Double-Precision */
+ case 11: /* VSX Scalar Compare Greater Than Double-Precision */
+ case 19: /* VSX Scalar Compare Greater Than or Equal
Double-Precision */
record_full_arch_list_add_reg (regcache, tdep->ppc_fpscr_regnum);
/* FALL-THROUGH */
- case 240: /* VSX Vector Copy Sign Double-Precision */
- case 208: /* VSX Vector Copy Sign Single-Precision */
- case 130: /* VSX Logical AND */
- case 138: /* VSX Logical AND with Complement */
- case 186: /* VSX Logical Equivalence */
- case 178: /* VSX Logical NAND */
- case 170: /* VSX Logical OR with Complement */
- case 162: /* VSX Logical NOR */
- case 146: /* VSX Logical OR */
- case 154: /* VSX Logical XOR */
- case 18: /* VSX Merge High Word */
- case 50: /* VSX Merge Low Word */
- case 10: /* VSX Permute Doubleword Immediate (DM=0) */
- case 10 | 0x20: /* VSX Permute Doubleword Immediate (DM=1) */
- case 10 | 0x40: /* VSX Permute Doubleword Immediate (DM=2) */
- case 10 | 0x60: /* VSX Permute Doubleword Immediate (DM=3) */
- case 2: /* VSX Shift Left Double by Word Immediate (SHW=0) */
- case 2 | 0x20: /* VSX Shift Left Double by Word Immediate (SHW=1) */
- case 2 | 0x40: /* VSX Shift Left Double by Word Immediate (SHW=2) */
- case 2 | 0x60: /* VSX Shift Left Double by Word Immediate (SHW=3) */
- case 216: /* VSX Vector Insert Exponent Single-Precision */
- case 248: /* VSX Vector Insert Exponent Double-Precision */
- case 26: /* VSX Vector Permute */
- case 58: /* VSX Vector Permute Right-indexed */
- case 213: /* VSX Vector Test Data Class Single-Precision (DC=0) */
- case 213 | 0x8: /* VSX Vector Test Data Class Single-Precision (DC=1) */
- case 245: /* VSX Vector Test Data Class Double-Precision (DC=0) */
- case 245 | 0x8: /* VSX Vector Test Data Class Double-Precision (DC=1) */
+ case 240: /* VSX Vector Copy Sign Double-Precision */
+ case 208: /* VSX Vector Copy Sign Single-Precision */
+ case 130: /* VSX Logical AND */
+ case 138: /* VSX Logical AND with Complement */
+ case 186: /* VSX Logical Equivalence */
+ case 178: /* VSX Logical NAND */
+ case 170: /* VSX Logical OR with Complement */
+ case 162: /* VSX Logical NOR */
+ case 146: /* VSX Logical OR */
+ case 154: /* VSX Logical XOR */
+ case 18: /* VSX Merge High Word */
+ case 50: /* VSX Merge Low Word */
+ case 10: /* VSX Permute Doubleword Immediate (DM=0) */
+ case 10 | 0x20: /* VSX Permute Doubleword Immediate (DM=1) */
+ case 10 | 0x40: /* VSX Permute Doubleword Immediate (DM=2) */
+ case 10 | 0x60: /* VSX Permute Doubleword Immediate (DM=3) */
+ case 2: /* VSX Shift Left Double by Word Immediate (SHW=0) */
+ case 2 | 0x20: /* VSX Shift Left Double by Word Immediate (SHW=1) */
+ case 2 | 0x40: /* VSX Shift Left Double by Word Immediate (SHW=2) */
+ case 2 | 0x60: /* VSX Shift Left Double by Word Immediate (SHW=3) */
+ case 216: /* VSX Vector Insert Exponent Single-Precision */
+ case 248: /* VSX Vector Insert Exponent Double-Precision */
+ case 26: /* VSX Vector Permute */
+ case 58: /* VSX Vector Permute Right-indexed */
+ case 213: /* VSX Vector Test Data Class Single-Precision (DC=0) */
+ case 213 | 0x8: /* VSX Vector Test Data Class Single-Precision (DC=1) */
+ case 245: /* VSX Vector Test Data Class Double-Precision (DC=0) */
+ case 245 | 0x8: /* VSX Vector Test Data Class Double-Precision (DC=1) */
ppc_record_vsr (regcache, tdep, PPC_XT (insn));
return 0;
- case 61: /* VSX Scalar Test for software Divide Double-Precision */
- case 125: /* VSX Vector Test for software Divide Double-Precision */
- case 93: /* VSX Vector Test for software Divide Single-Precision */
+ case 61: /* VSX Scalar Test for software Divide Double-Precision */
+ case 125: /* VSX Vector Test for software Divide Double-Precision */
+ case 93: /* VSX Vector Test for software Divide Single-Precision */
record_full_arch_list_add_reg (regcache, tdep->ppc_cr_regnum);
return 0;
- case 35: /* VSX Scalar Compare Unordered Double-Precision */
- case 43: /* VSX Scalar Compare Ordered Double-Precision */
- case 59: /* VSX Scalar Compare Exponents Double-Precision */
+ case 35: /* VSX Scalar Compare Unordered Double-Precision */
+ case 43: /* VSX Scalar Compare Ordered Double-Precision */
+ case 59: /* VSX Scalar Compare Exponents Double-Precision */
record_full_arch_list_add_reg (regcache, tdep->ppc_cr_regnum);
record_full_arch_list_add_reg (regcache, tdep->ppc_fpscr_regnum);
return 0;
@@ -5859,14 +5751,14 @@ ppc_process_record_op60 (struct gdbarch *gdbarch, struct regcache *regcache,
switch ((ext >> 2) & 0x7f) /* Mask out Rc-bit. */
{
- case 99: /* VSX Vector Compare Equal To Double-Precision */
- case 67: /* VSX Vector Compare Equal To Single-Precision */
- case 115: /* VSX Vector Compare Greater Than or
+ case 99: /* VSX Vector Compare Equal To Double-Precision */
+ case 67: /* VSX Vector Compare Equal To Single-Precision */
+ case 115: /* VSX Vector Compare Greater Than or
Equal To Double-Precision */
- case 83: /* VSX Vector Compare Greater Than or
+ case 83: /* VSX Vector Compare Greater Than or
Equal To Single-Precision */
- case 107: /* VSX Vector Compare Greater Than Double-Precision */
- case 75: /* VSX Vector Compare Greater Than Single-Precision */
+ case 107: /* VSX Vector Compare Greater Than Double-Precision */
+ case 75: /* VSX Vector Compare Greater Than Single-Precision */
if (PPC_Rc (insn))
record_full_arch_list_add_reg (regcache, tdep->ppc_cr_regnum);
record_full_arch_list_add_reg (regcache, tdep->ppc_fpscr_regnum);
@@ -5876,157 +5768,157 @@ ppc_process_record_op60 (struct gdbarch *gdbarch, struct regcache *regcache,
switch (ext >> 1)
{
- case 265: /* VSX Scalar round Double-Precision to
+ case 265: /* VSX Scalar round Double-Precision to
Single-Precision and Convert to
Single-Precision format */
- case 344: /* VSX Scalar truncate Double-Precision to
+ case 344: /* VSX Scalar truncate Double-Precision to
Integer and Convert to Signed Integer
Doubleword format with Saturate */
- case 88: /* VSX Scalar truncate Double-Precision to
+ case 88: /* VSX Scalar truncate Double-Precision to
Integer and Convert to Signed Integer Word
Format with Saturate */
- case 328: /* VSX Scalar truncate Double-Precision integer
+ case 328: /* VSX Scalar truncate Double-Precision integer
and Convert to Unsigned Integer Doubleword
Format with Saturate */
- case 72: /* VSX Scalar truncate Double-Precision to
+ case 72: /* VSX Scalar truncate Double-Precision to
Integer and Convert to Unsigned Integer Word
Format with Saturate */
- case 329: /* VSX Scalar Convert Single-Precision to
+ case 329: /* VSX Scalar Convert Single-Precision to
Double-Precision format */
- case 376: /* VSX Scalar Convert Signed Integer
+ case 376: /* VSX Scalar Convert Signed Integer
Doubleword to floating-point format and
Round to Double-Precision format */
- case 312: /* VSX Scalar Convert Signed Integer
+ case 312: /* VSX Scalar Convert Signed Integer
Doubleword to floating-point format and
round to Single-Precision */
- case 360: /* VSX Scalar Convert Unsigned Integer
+ case 360: /* VSX Scalar Convert Unsigned Integer
Doubleword to floating-point format and
Round to Double-Precision format */
- case 296: /* VSX Scalar Convert Unsigned Integer
+ case 296: /* VSX Scalar Convert Unsigned Integer
Doubleword to floating-point format and
Round to Single-Precision */
- case 73: /* VSX Scalar Round to Double-Precision Integer
+ case 73: /* VSX Scalar Round to Double-Precision Integer
Using Round to Nearest Away */
- case 107: /* VSX Scalar Round to Double-Precision Integer
+ case 107: /* VSX Scalar Round to Double-Precision Integer
Exact using Current rounding mode */
- case 121: /* VSX Scalar Round to Double-Precision Integer
+ case 121: /* VSX Scalar Round to Double-Precision Integer
Using Round toward -Infinity */
- case 105: /* VSX Scalar Round to Double-Precision Integer
+ case 105: /* VSX Scalar Round to Double-Precision Integer
Using Round toward +Infinity */
- case 89: /* VSX Scalar Round to Double-Precision Integer
+ case 89: /* VSX Scalar Round to Double-Precision Integer
Using Round toward Zero */
- case 90: /* VSX Scalar Reciprocal Estimate Double-Precision */
- case 26: /* VSX Scalar Reciprocal Estimate Single-Precision */
- case 281: /* VSX Scalar Round to Single-Precision */
- case 74: /* VSX Scalar Reciprocal Square Root Estimate
+ case 90: /* VSX Scalar Reciprocal Estimate Double-Precision */
+ case 26: /* VSX Scalar Reciprocal Estimate Single-Precision */
+ case 281: /* VSX Scalar Round to Single-Precision */
+ case 74: /* VSX Scalar Reciprocal Square Root Estimate
Double-Precision */
- case 10: /* VSX Scalar Reciprocal Square Root Estimate
+ case 10: /* VSX Scalar Reciprocal Square Root Estimate
Single-Precision */
- case 75: /* VSX Scalar Square Root Double-Precision */
- case 11: /* VSX Scalar Square Root Single-Precision */
- case 393: /* VSX Vector round Double-Precision to
+ case 75: /* VSX Scalar Square Root Double-Precision */
+ case 11: /* VSX Scalar Square Root Single-Precision */
+ case 393: /* VSX Vector round Double-Precision to
Single-Precision and Convert to
Single-Precision format */
- case 472: /* VSX Vector truncate Double-Precision to
+ case 472: /* VSX Vector truncate Double-Precision to
Integer and Convert to Signed Integer
Doubleword format with Saturate */
- case 216: /* VSX Vector truncate Double-Precision to
+ case 216: /* VSX Vector truncate Double-Precision to
Integer and Convert to Signed Integer Word
Format with Saturate */
- case 456: /* VSX Vector truncate Double-Precision to
+ case 456: /* VSX Vector truncate Double-Precision to
Integer and Convert to Unsigned Integer
Doubleword format with Saturate */
- case 200: /* VSX Vector truncate Double-Precision to
+ case 200: /* VSX Vector truncate Double-Precision to
Integer and Convert to Unsigned Integer Word
Format with Saturate */
- case 457: /* VSX Vector Convert Single-Precision to
+ case 457: /* VSX Vector Convert Single-Precision to
Double-Precision format */
- case 408: /* VSX Vector truncate Single-Precision to
+ case 408: /* VSX Vector truncate Single-Precision to
Integer and Convert to Signed Integer
Doubleword format with Saturate */
- case 152: /* VSX Vector truncate Single-Precision to
+ case 152: /* VSX Vector truncate Single-Precision to
Integer and Convert to Signed Integer Word
Format with Saturate */
- case 392: /* VSX Vector truncate Single-Precision to
+ case 392: /* VSX Vector truncate Single-Precision to
Integer and Convert to Unsigned Integer
Doubleword format with Saturate */
- case 136: /* VSX Vector truncate Single-Precision to
+ case 136: /* VSX Vector truncate Single-Precision to
Integer and Convert to Unsigned Integer Word
Format with Saturate */
- case 504: /* VSX Vector Convert and round Signed Integer
+ case 504: /* VSX Vector Convert and round Signed Integer
Doubleword to Double-Precision format */
- case 440: /* VSX Vector Convert and round Signed Integer
+ case 440: /* VSX Vector Convert and round Signed Integer
Doubleword to Single-Precision format */
- case 248: /* VSX Vector Convert Signed Integer Word to
+ case 248: /* VSX Vector Convert Signed Integer Word to
Double-Precision format */
- case 184: /* VSX Vector Convert and round Signed Integer
+ case 184: /* VSX Vector Convert and round Signed Integer
Word to Single-Precision format */
- case 488: /* VSX Vector Convert and round Unsigned
+ case 488: /* VSX Vector Convert and round Unsigned
Integer Doubleword to Double-Precision format */
- case 424: /* VSX Vector Convert and round Unsigned
+ case 424: /* VSX Vector Convert and round Unsigned
Integer Doubleword to Single-Precision format */
- case 232: /* VSX Vector Convert and round Unsigned
+ case 232: /* VSX Vector Convert and round Unsigned
Integer Word to Double-Precision format */
- case 168: /* VSX Vector Convert and round Unsigned
+ case 168: /* VSX Vector Convert and round Unsigned
Integer Word to Single-Precision format */
- case 201: /* VSX Vector Round to Double-Precision
+ case 201: /* VSX Vector Round to Double-Precision
Integer using round to Nearest Away */
- case 235: /* VSX Vector Round to Double-Precision
+ case 235: /* VSX Vector Round to Double-Precision
Integer Exact using Current rounding mode */
- case 249: /* VSX Vector Round to Double-Precision
+ case 249: /* VSX Vector Round to Double-Precision
Integer using round toward -Infinity */
- case 233: /* VSX Vector Round to Double-Precision
+ case 233: /* VSX Vector Round to Double-Precision
Integer using round toward +Infinity */
- case 217: /* VSX Vector Round to Double-Precision
+ case 217: /* VSX Vector Round to Double-Precision
Integer using round toward Zero */
- case 218: /* VSX Vector Reciprocal Estimate Double-Precision */
- case 154: /* VSX Vector Reciprocal Estimate Single-Precision */
- case 137: /* VSX Vector Round to Single-Precision Integer
+ case 218: /* VSX Vector Reciprocal Estimate Double-Precision */
+ case 154: /* VSX Vector Reciprocal Estimate Single-Precision */
+ case 137: /* VSX Vector Round to Single-Precision Integer
Using Round to Nearest Away */
- case 171: /* VSX Vector Round to Single-Precision Integer
+ case 171: /* VSX Vector Round to Single-Precision Integer
Exact Using Current rounding mode */
- case 185: /* VSX Vector Round to Single-Precision Integer
+ case 185: /* VSX Vector Round to Single-Precision Integer
Using Round toward -Infinity */
- case 169: /* VSX Vector Round to Single-Precision Integer
+ case 169: /* VSX Vector Round to Single-Precision Integer
Using Round toward +Infinity */
- case 153: /* VSX Vector Round to Single-Precision Integer
+ case 153: /* VSX Vector Round to Single-Precision Integer
Using round toward Zero */
- case 202: /* VSX Vector Reciprocal Square Root Estimate
+ case 202: /* VSX Vector Reciprocal Square Root Estimate
Double-Precision */
- case 138: /* VSX Vector Reciprocal Square Root Estimate
+ case 138: /* VSX Vector Reciprocal Square Root Estimate
Single-Precision */
- case 203: /* VSX Vector Square Root Double-Precision */
- case 139: /* VSX Vector Square Root Single-Precision */
+ case 203: /* VSX Vector Square Root Double-Precision */
+ case 139: /* VSX Vector Square Root Single-Precision */
record_full_arch_list_add_reg (regcache, tdep->ppc_fpscr_regnum);
/* FALL-THROUGH */
- case 345: /* VSX Scalar Absolute Value Double-Precision */
- case 267: /* VSX Scalar Convert Scalar Single-Precision to
+ case 345: /* VSX Scalar Absolute Value Double-Precision */
+ case 267: /* VSX Scalar Convert Scalar Single-Precision to
Vector Single-Precision format Non-signalling */
- case 331: /* VSX Scalar Convert Single-Precision to
+ case 331: /* VSX Scalar Convert Single-Precision to
Double-Precision format Non-signalling */
- case 361: /* VSX Scalar Negative Absolute Value Double-Precision */
- case 377: /* VSX Scalar Negate Double-Precision */
- case 473: /* VSX Vector Absolute Value Double-Precision */
- case 409: /* VSX Vector Absolute Value Single-Precision */
- case 489: /* VSX Vector Negative Absolute Value Double-Precision */
- case 425: /* VSX Vector Negative Absolute Value Single-Precision */
- case 505: /* VSX Vector Negate Double-Precision */
- case 441: /* VSX Vector Negate Single-Precision */
- case 164: /* VSX Splat Word */
- case 165: /* VSX Vector Extract Unsigned Word */
- case 181: /* VSX Vector Insert Word */
+ case 361: /* VSX Scalar Negative Absolute Value Double-Precision */
+ case 377: /* VSX Scalar Negate Double-Precision */
+ case 473: /* VSX Vector Absolute Value Double-Precision */
+ case 409: /* VSX Vector Absolute Value Single-Precision */
+ case 489: /* VSX Vector Negative Absolute Value Double-Precision */
+ case 425: /* VSX Vector Negative Absolute Value Single-Precision */
+ case 505: /* VSX Vector Negate Double-Precision */
+ case 441: /* VSX Vector Negate Single-Precision */
+ case 164: /* VSX Splat Word */
+ case 165: /* VSX Vector Extract Unsigned Word */
+ case 181: /* VSX Vector Insert Word */
ppc_record_vsr (regcache, tdep, PPC_XT (insn));
return 0;
- case 298: /* VSX Scalar Test Data Class Single-Precision */
- case 362: /* VSX Scalar Test Data Class Double-Precision */
+ case 298: /* VSX Scalar Test Data Class Single-Precision */
+ case 362: /* VSX Scalar Test Data Class Double-Precision */
record_full_arch_list_add_reg (regcache, tdep->ppc_fpscr_regnum);
/* FALL-THROUGH */
- case 106: /* VSX Scalar Test for software Square Root
+ case 106: /* VSX Scalar Test for software Square Root
Double-Precision */
- case 234: /* VSX Vector Test for software Square Root
+ case 234: /* VSX Vector Test for software Square Root
Double-Precision */
- case 170: /* VSX Vector Test for software Square Root
+ case 170: /* VSX Vector Test for software Square Root
Single-Precision */
record_full_arch_list_add_reg (regcache, tdep->ppc_cr_regnum);
return 0;
@@ -6034,14 +5926,14 @@ ppc_process_record_op60 (struct gdbarch *gdbarch, struct regcache *regcache,
case 347:
switch (PPC_FIELD (insn, 11, 5))
{
- case 0: /* VSX Scalar Extract Exponent Double-Precision */
- case 1: /* VSX Scalar Extract Significand Double-Precision */
+ case 0: /* VSX Scalar Extract Exponent Double-Precision */
+ case 1: /* VSX Scalar Extract Significand Double-Precision */
record_full_arch_list_add_reg (regcache,
tdep->ppc_gp0_regnum + PPC_RT (insn));
return 0;
- case 16: /* VSX Scalar Convert Half-Precision format to
+ case 16: /* VSX Scalar Convert Half-Precision format to
Double-Precision format */
- case 17: /* VSX Scalar round & Convert Double-Precision format
+ case 17: /* VSX Scalar round & Convert Double-Precision format
to Half-Precision format */
record_full_arch_list_add_reg (regcache, tdep->ppc_fpscr_regnum);
ppc_record_vsr (regcache, tdep, PPC_XT (insn));
@@ -6058,35 +5950,37 @@ ppc_process_record_op60 (struct gdbarch *gdbarch, struct regcache *regcache,
switch (ext)
{
case 360:
- if (PPC_FIELD (insn, 11, 2) == 0) /* VSX Vector Splat Immediate Byte */
+ if (PPC_FIELD (insn, 11, 2) == 0) /* VSX Vector Splat Immediate Byte */
{
ppc_record_vsr (regcache, tdep, PPC_XT (insn));
return 0;
}
- if (PPC_FIELD (insn, 11, 5) == 31) /* Load VSX Vector Special Value
+ if (PPC_FIELD (insn, 11, 5) == 31) /* Load VSX Vector Special Value
Quadword */
{
ppc_record_vsr (regcache, tdep, PPC_XT (insn));
return 0;
}
break;
- case 916: /* VSX Vector Generate PCV from Byte Mask */
- case 917: /* VSX Vector Generate PCV from Halfword Mask */
- case 948: /* VSX Vector Generate PCV from Word Mask */
- case 949: /* VSX Vector Generate PCV from Doubleword Mask */
- case 918: /* VSX Scalar Insert Exponent Double-Precision */
+ case 916: /* VSX Vector Generate PCV from Byte Mask */
+ case 917: /* VSX Vector Generate PCV from Halfword Mask */
+ case 948: /* VSX Vector Generate PCV from Word Mask */
+ case 949: /* VSX Vector Generate PCV from Doubleword Mask */
+ case 918: /* VSX Scalar Insert Exponent Double-Precision */
ppc_record_vsr (regcache, tdep, PPC_XT (insn));
return 0;
}
- if (((ext >> 3) & 0x3) == 3) /* VSX Select */
+ if (((ext >> 3) & 0x3) == 3) /* VSX Select */
{
ppc_record_vsr (regcache, tdep, PPC_XT (insn));
return 0;
}
- gdb_printf (gdb_stdlog, "Warning: Don't know how to record %08x "
- "at %s, 60-%d.\n", insn, paddress (gdbarch, addr), ext);
+ gdb_printf (gdb_stdlog,
+ "Warning: Don't know how to record %08x "
+ "at %s, 60-%d.\n",
+ insn, paddress (gdbarch, addr), ext);
return -1;
}
@@ -6095,7 +5989,7 @@ ppc_process_record_op60 (struct gdbarch *gdbarch, struct regcache *regcache,
static int
ppc_process_record_op61 (struct gdbarch *gdbarch, struct regcache *regcache,
- CORE_ADDR addr, uint32_t insn)
+ CORE_ADDR addr, uint32_t insn)
{
ppc_gdbarch_tdep *tdep = gdbarch_tdep<ppc_gdbarch_tdep> (gdbarch);
ULONGEST ea = 0;
@@ -6103,23 +5997,22 @@ ppc_process_record_op61 (struct gdbarch *gdbarch, struct regcache *regcache,
switch (insn & 0x3)
{
- case 0: /* Store Floating-Point Double Pair */
- case 2: /* Store VSX Scalar Doubleword */
- case 3: /* Store VSX Scalar Single */
+ case 0: /* Store Floating-Point Double Pair */
+ case 2: /* Store VSX Scalar Doubleword */
+ case 3: /* Store VSX Scalar Single */
if (PPC_RA (insn) != 0)
regcache_raw_read_unsigned (regcache,
- tdep->ppc_gp0_regnum + PPC_RA (insn),
- &ea);
+ tdep->ppc_gp0_regnum + PPC_RA (insn), &ea);
ea += PPC_DS (insn) << 2;
switch (insn & 0x3)
{
- case 0: /* Store Floating-Point Double Pair */
+ case 0: /* Store Floating-Point Double Pair */
size = 16;
break;
- case 2: /* Store VSX Scalar Doubleword */
+ case 2: /* Store VSX Scalar Doubleword */
size = 8;
break;
- case 3: /* Store VSX Scalar Single */
+ case 3: /* Store VSX Scalar Single */
size = 4;
break;
default:
@@ -6131,21 +6024,22 @@ ppc_process_record_op61 (struct gdbarch *gdbarch, struct regcache *regcache,
switch (insn & 0x7)
{
- case 1: /* Load VSX Vector */
+ case 1: /* Load VSX Vector */
ppc_record_vsr (regcache, tdep, PPC_XT (insn));
return 0;
- case 5: /* Store VSX Vector */
+ case 5: /* Store VSX Vector */
if (PPC_RA (insn) != 0)
regcache_raw_read_unsigned (regcache,
- tdep->ppc_gp0_regnum + PPC_RA (insn),
- &ea);
+ tdep->ppc_gp0_regnum + PPC_RA (insn), &ea);
ea += PPC_DQ (insn) << 4;
record_full_arch_list_add_mem (ea, 16);
return 0;
}
- gdb_printf (gdb_stdlog, "Warning: Don't know how to record %08x "
- "at %s.\n", insn, paddress (gdbarch, addr));
+ gdb_printf (gdb_stdlog,
+ "Warning: Don't know how to record %08x "
+ "at %s.\n",
+ insn, paddress (gdbarch, addr));
return -1;
}
@@ -6154,7 +6048,7 @@ ppc_process_record_op61 (struct gdbarch *gdbarch, struct regcache *regcache,
static int
ppc_process_record_op63 (struct gdbarch *gdbarch, struct regcache *regcache,
- CORE_ADDR addr, uint32_t insn)
+ CORE_ADDR addr, uint32_t insn)
{
ppc_gdbarch_tdep *tdep = gdbarch_tdep<ppc_gdbarch_tdep> (gdbarch);
int ext = PPC_EXTOP (insn);
@@ -6162,17 +6056,17 @@ ppc_process_record_op63 (struct gdbarch *gdbarch, struct regcache *regcache,
switch (ext & 0x1f)
{
- case 18: /* Floating Divide */
- case 20: /* Floating Subtract */
- case 21: /* Floating Add */
- case 22: /* Floating Square Root */
- case 24: /* Floating Reciprocal Estimate */
- case 25: /* Floating Multiply */
- case 26: /* Floating Reciprocal Square Root Estimate */
- case 28: /* Floating Multiply-Subtract */
- case 29: /* Floating Multiply-Add */
- case 30: /* Floating Negative Multiply-Subtract */
- case 31: /* Floating Negative Multiply-Add */
+ case 18: /* Floating Divide */
+ case 20: /* Floating Subtract */
+ case 21: /* Floating Add */
+ case 22: /* Floating Square Root */
+ case 24: /* Floating Reciprocal Estimate */
+ case 25: /* Floating Multiply */
+ case 26: /* Floating Reciprocal Square Root Estimate */
+ case 28: /* Floating Multiply-Subtract */
+ case 29: /* Floating Multiply-Add */
+ case 30: /* Floating Negative Multiply-Subtract */
+ case 31: /* Floating Negative Multiply-Add */
record_full_arch_list_add_reg (regcache,
tdep->ppc_fp0_regnum + PPC_FRT (insn));
if (PPC_RC (insn))
@@ -6180,7 +6074,7 @@ ppc_process_record_op63 (struct gdbarch *gdbarch, struct regcache *regcache,
record_full_arch_list_add_reg (regcache, tdep->ppc_fpscr_regnum);
return 0;
- case 23: /* Floating Select */
+ case 23: /* Floating Select */
record_full_arch_list_add_reg (regcache,
tdep->ppc_fp0_regnum + PPC_FRT (insn));
if (PPC_RC (insn))
@@ -6190,8 +6084,8 @@ ppc_process_record_op63 (struct gdbarch *gdbarch, struct regcache *regcache,
switch (ext & 0xff)
{
- case 5: /* VSX Scalar Round to Quad-Precision Integer */
- case 37: /* VSX Scalar Round Quad-Precision to Double-Extended
+ case 5: /* VSX Scalar Round to Quad-Precision Integer */
+ case 37: /* VSX Scalar Round Quad-Precision to Double-Extended
Precision */
record_full_arch_list_add_reg (regcache, tdep->ppc_fpscr_regnum);
ppc_record_vsr (regcache, tdep, PPC_VRT (insn) + 32);
@@ -6200,19 +6094,19 @@ ppc_process_record_op63 (struct gdbarch *gdbarch, struct regcache *regcache,
switch (ext)
{
- case 2: /* DFP Add Quad */
- case 3: /* DFP Quantize Quad */
- case 34: /* DFP Multiply Quad */
- case 35: /* DFP Reround Quad */
- case 67: /* DFP Quantize Immediate Quad */
- case 99: /* DFP Round To FP Integer With Inexact Quad */
- case 227: /* DFP Round To FP Integer Without Inexact Quad */
- case 258: /* DFP Convert To DFP Extended Quad */
- case 514: /* DFP Subtract Quad */
- case 546: /* DFP Divide Quad */
- case 770: /* DFP Round To DFP Long Quad */
- case 802: /* DFP Convert From Fixed Quad */
- case 834: /* DFP Encode BCD To DPD Quad */
+ case 2: /* DFP Add Quad */
+ case 3: /* DFP Quantize Quad */
+ case 34: /* DFP Multiply Quad */
+ case 35: /* DFP Reround Quad */
+ case 67: /* DFP Quantize Immediate Quad */
+ case 99: /* DFP Round To FP Integer With Inexact Quad */
+ case 227: /* DFP Round To FP Integer Without Inexact Quad */
+ case 258: /* DFP Convert To DFP Extended Quad */
+ case 514: /* DFP Subtract Quad */
+ case 546: /* DFP Divide Quad */
+ case 770: /* DFP Round To DFP Long Quad */
+ case 802: /* DFP Convert From Fixed Quad */
+ case 834: /* DFP Encode BCD To DPD Quad */
if (PPC_RC (insn))
record_full_arch_list_add_reg (regcache, tdep->ppc_cr_regnum);
tmp = tdep->ppc_fp0_regnum + (PPC_FRT (insn) & ~1);
@@ -6221,21 +6115,21 @@ ppc_process_record_op63 (struct gdbarch *gdbarch, struct regcache *regcache,
record_full_arch_list_add_reg (regcache, tdep->ppc_fpscr_regnum);
return 0;
- case 130: /* DFP Compare Ordered Quad */
- case 162: /* DFP Test Exponent Quad */
- case 194: /* DFP Test Data Class Quad */
- case 226: /* DFP Test Data Group Quad */
- case 642: /* DFP Compare Unordered Quad */
- case 674: /* DFP Test Significance Quad */
- case 675: /* DFP Test Significance Immediate Quad */
+ case 130: /* DFP Compare Ordered Quad */
+ case 162: /* DFP Test Exponent Quad */
+ case 194: /* DFP Test Data Class Quad */
+ case 226: /* DFP Test Data Group Quad */
+ case 642: /* DFP Compare Unordered Quad */
+ case 674: /* DFP Test Significance Quad */
+ case 675: /* DFP Test Significance Immediate Quad */
record_full_arch_list_add_reg (regcache, tdep->ppc_cr_regnum);
record_full_arch_list_add_reg (regcache, tdep->ppc_fpscr_regnum);
return 0;
- case 66: /* DFP Shift Significand Left Immediate Quad */
- case 98: /* DFP Shift Significand Right Immediate Quad */
- case 322: /* DFP Decode DPD To BCD Quad */
- case 866: /* DFP Insert Biased Exponent Quad */
+ case 66: /* DFP Shift Significand Left Immediate Quad */
+ case 98: /* DFP Shift Significand Right Immediate Quad */
+ case 322: /* DFP Decode DPD To BCD Quad */
+ case 866: /* DFP Insert Biased Exponent Quad */
tmp = tdep->ppc_fp0_regnum + (PPC_FRT (insn) & ~1);
record_full_arch_list_add_reg (regcache, tmp);
record_full_arch_list_add_reg (regcache, tmp + 1);
@@ -6243,7 +6137,7 @@ ppc_process_record_op63 (struct gdbarch *gdbarch, struct regcache *regcache,
record_full_arch_list_add_reg (regcache, tdep->ppc_cr_regnum);
return 0;
- case 290: /* DFP Convert To Fixed Quad */
+ case 290: /* DFP Convert To Fixed Quad */
record_full_arch_list_add_reg (regcache,
tdep->ppc_fp0_regnum + PPC_FRT (insn));
if (PPC_RC (insn))
@@ -6251,32 +6145,32 @@ ppc_process_record_op63 (struct gdbarch *gdbarch, struct regcache *regcache,
record_full_arch_list_add_reg (regcache, tdep->ppc_fpscr_regnum);
return 0;
- case 354: /* DFP Extract Biased Exponent Quad */
+ case 354: /* DFP Extract Biased Exponent Quad */
record_full_arch_list_add_reg (regcache,
tdep->ppc_fp0_regnum + PPC_FRT (insn));
if (PPC_RC (insn))
record_full_arch_list_add_reg (regcache, tdep->ppc_cr_regnum);
return 0;
- case 12: /* Floating Round to Single-Precision */
- case 14: /* Floating Convert To Integer Word */
- case 15: /* Floating Convert To Integer Word
+ case 12: /* Floating Round to Single-Precision */
+ case 14: /* Floating Convert To Integer Word */
+ case 15: /* Floating Convert To Integer Word
with round toward Zero */
- case 142: /* Floating Convert To Integer Word Unsigned */
- case 143: /* Floating Convert To Integer Word Unsigned
+ case 142: /* Floating Convert To Integer Word Unsigned */
+ case 143: /* Floating Convert To Integer Word Unsigned
with round toward Zero */
- case 392: /* Floating Round to Integer Nearest */
- case 424: /* Floating Round to Integer Toward Zero */
- case 456: /* Floating Round to Integer Plus */
- case 488: /* Floating Round to Integer Minus */
- case 814: /* Floating Convert To Integer Doubleword */
- case 815: /* Floating Convert To Integer Doubleword
+ case 392: /* Floating Round to Integer Nearest */
+ case 424: /* Floating Round to Integer Toward Zero */
+ case 456: /* Floating Round to Integer Plus */
+ case 488: /* Floating Round to Integer Minus */
+ case 814: /* Floating Convert To Integer Doubleword */
+ case 815: /* Floating Convert To Integer Doubleword
with round toward Zero */
- case 846: /* Floating Convert From Integer Doubleword */
- case 942: /* Floating Convert To Integer Doubleword Unsigned */
- case 943: /* Floating Convert To Integer Doubleword Unsigned
+ case 846: /* Floating Convert From Integer Doubleword */
+ case 942: /* Floating Convert To Integer Doubleword Unsigned */
+ case 943: /* Floating Convert To Integer Doubleword Unsigned
with round toward Zero */
- case 974: /* Floating Convert From Integer Doubleword Unsigned */
+ case 974: /* Floating Convert From Integer Doubleword Unsigned */
record_full_arch_list_add_reg (regcache,
tdep->ppc_fp0_regnum + PPC_FRT (insn));
if (PPC_RC (insn))
@@ -6287,120 +6181,117 @@ ppc_process_record_op63 (struct gdbarch *gdbarch, struct regcache *regcache,
case 583:
switch (PPC_FIELD (insn, 11, 5))
{
- case 1: /* Move From FPSCR & Clear Enables */
- case 20: /* Move From FPSCR Control & set DRN */
- case 21: /* Move From FPSCR Control & set DRN Immediate */
- case 22: /* Move From FPSCR Control & set RN */
- case 23: /* Move From FPSCR Control & set RN Immediate */
- record_full_arch_list_add_reg (regcache, tdep->ppc_fpscr_regnum);
- /* Fall through. */
- case 0: /* Move From FPSCR */
- case 24: /* Move From FPSCR Lightweight */
- if (PPC_FIELD (insn, 11, 5) == 0 && PPC_RC (insn))
- record_full_arch_list_add_reg (regcache, tdep->ppc_cr_regnum);
- record_full_arch_list_add_reg (regcache,
- tdep->ppc_fp0_regnum
- + PPC_FRT (insn));
- return 0;
+ case 1: /* Move From FPSCR & Clear Enables */
+ case 20: /* Move From FPSCR Control & set DRN */
+ case 21: /* Move From FPSCR Control & set DRN Immediate */
+ case 22: /* Move From FPSCR Control & set RN */
+ case 23: /* Move From FPSCR Control & set RN Immediate */
+ record_full_arch_list_add_reg (regcache, tdep->ppc_fpscr_regnum);
+ /* Fall through. */
+ case 0: /* Move From FPSCR */
+ case 24: /* Move From FPSCR Lightweight */
+ if (PPC_FIELD (insn, 11, 5) == 0 && PPC_RC (insn))
+ record_full_arch_list_add_reg (regcache, tdep->ppc_cr_regnum);
+ record_full_arch_list_add_reg (regcache, tdep->ppc_fp0_regnum
+ + PPC_FRT (insn));
+ return 0;
}
break;
- case 8: /* Floating Copy Sign */
- case 40: /* Floating Negate */
- case 72: /* Floating Move Register */
- case 136: /* Floating Negative Absolute Value */
- case 264: /* Floating Absolute Value */
+ case 8: /* Floating Copy Sign */
+ case 40: /* Floating Negate */
+ case 72: /* Floating Move Register */
+ case 136: /* Floating Negative Absolute Value */
+ case 264: /* Floating Absolute Value */
record_full_arch_list_add_reg (regcache,
tdep->ppc_fp0_regnum + PPC_FRT (insn));
if (PPC_RC (insn))
record_full_arch_list_add_reg (regcache, tdep->ppc_cr_regnum);
return 0;
- case 838: /* Floating Merge Odd Word */
- case 966: /* Floating Merge Even Word */
+ case 838: /* Floating Merge Odd Word */
+ case 966: /* Floating Merge Even Word */
record_full_arch_list_add_reg (regcache,
tdep->ppc_fp0_regnum + PPC_FRT (insn));
return 0;
- case 38: /* Move To FPSCR Bit 1 */
- case 70: /* Move To FPSCR Bit 0 */
- case 134: /* Move To FPSCR Field Immediate */
- case 711: /* Move To FPSCR Fields */
+ case 38: /* Move To FPSCR Bit 1 */
+ case 70: /* Move To FPSCR Bit 0 */
+ case 134: /* Move To FPSCR Field Immediate */
+ case 711: /* Move To FPSCR Fields */
if (PPC_RC (insn))
record_full_arch_list_add_reg (regcache, tdep->ppc_cr_regnum);
record_full_arch_list_add_reg (regcache, tdep->ppc_fpscr_regnum);
return 0;
- case 0: /* Floating Compare Unordered */
- case 32: /* Floating Compare Ordered */
- case 64: /* Move to Condition Register from FPSCR */
- case 132: /* VSX Scalar Compare Ordered Quad-Precision */
- case 164: /* VSX Scalar Compare Exponents Quad-Precision */
- case 644: /* VSX Scalar Compare Unordered Quad-Precision */
- case 708: /* VSX Scalar Test Data Class Quad-Precision */
+ case 0: /* Floating Compare Unordered */
+ case 32: /* Floating Compare Ordered */
+ case 64: /* Move to Condition Register from FPSCR */
+ case 132: /* VSX Scalar Compare Ordered Quad-Precision */
+ case 164: /* VSX Scalar Compare Exponents Quad-Precision */
+ case 644: /* VSX Scalar Compare Unordered Quad-Precision */
+ case 708: /* VSX Scalar Test Data Class Quad-Precision */
record_full_arch_list_add_reg (regcache, tdep->ppc_fpscr_regnum);
/* FALL-THROUGH */
- case 128: /* Floating Test for software Divide */
- case 160: /* Floating Test for software Square Root */
+ case 128: /* Floating Test for software Divide */
+ case 160: /* Floating Test for software Square Root */
record_full_arch_list_add_reg (regcache, tdep->ppc_cr_regnum);
return 0;
- case 4: /* VSX Scalar Add Quad-Precision */
- case 36: /* VSX Scalar Multiply Quad-Precision */
- case 388: /* VSX Scalar Multiply-Add Quad-Precision */
- case 420: /* VSX Scalar Multiply-Subtract Quad-Precision */
- case 452: /* VSX Scalar Negative Multiply-Add Quad-Precision */
- case 484: /* VSX Scalar Negative Multiply-Subtract
+ case 4: /* VSX Scalar Add Quad-Precision */
+ case 36: /* VSX Scalar Multiply Quad-Precision */
+ case 388: /* VSX Scalar Multiply-Add Quad-Precision */
+ case 420: /* VSX Scalar Multiply-Subtract Quad-Precision */
+ case 452: /* VSX Scalar Negative Multiply-Add Quad-Precision */
+ case 484: /* VSX Scalar Negative Multiply-Subtract
Quad-Precision */
- case 516: /* VSX Scalar Subtract Quad-Precision */
- case 548: /* VSX Scalar Divide Quad-Precision */
+ case 516: /* VSX Scalar Subtract Quad-Precision */
+ case 548: /* VSX Scalar Divide Quad-Precision */
case 994:
{
- switch (PPC_FIELD (insn, 11, 5))
- {
- case 0: /* DFP Convert From Fixed Quadword Quad */
- record_full_arch_list_add_reg (regcache, tdep->ppc_fpscr_regnum);
+ switch (PPC_FIELD (insn, 11, 5))
+ {
+ case 0: /* DFP Convert From Fixed Quadword Quad */
+ record_full_arch_list_add_reg (regcache, tdep->ppc_fpscr_regnum);
- record_full_arch_list_add_reg (regcache,
- tdep->ppc_fp0_regnum
- + PPC_FRT (insn));
- record_full_arch_list_add_reg (regcache,
- tdep->ppc_fp0_regnum
- + PPC_FRT (insn) + 1);
- return 0;
- case 1: /* DFP Convert To Fixed Quadword Quad */
- record_full_arch_list_add_reg (regcache, tdep->ppc_fpscr_regnum);
- ppc_record_vsr (regcache, tdep, PPC_VRT (insn) + 32);
- return 0;
- }
+ record_full_arch_list_add_reg (regcache, tdep->ppc_fp0_regnum
+ + PPC_FRT (insn));
+ record_full_arch_list_add_reg (regcache, tdep->ppc_fp0_regnum
+ + PPC_FRT (insn) + 1);
+ return 0;
+ case 1: /* DFP Convert To Fixed Quadword Quad */
+ record_full_arch_list_add_reg (regcache, tdep->ppc_fpscr_regnum);
+ ppc_record_vsr (regcache, tdep, PPC_VRT (insn) + 32);
+ return 0;
+ }
}
record_full_arch_list_add_reg (regcache, tdep->ppc_fpscr_regnum);
/* FALL-THROUGH */
- case 68: /* VSX Scalar Compare Equal Quad-Precision */
- case 196: /* VSX Scalar Compare Greater Than or Equal
+ case 68: /* VSX Scalar Compare Equal Quad-Precision */
+ case 196: /* VSX Scalar Compare Greater Than or Equal
Quad-Precision */
- case 228: /* VSX Scalar Compare Greater Than Quad-Precision */
- case 676: /* VSX Scalar Maximum Type-C Quad-Precision */
- case 740: /* VSX Scalar Minimum Type-C Quad-Precision */
+ case 228: /* VSX Scalar Compare Greater Than Quad-Precision */
+ case 676: /* VSX Scalar Maximum Type-C Quad-Precision */
+ case 740: /* VSX Scalar Minimum Type-C Quad-Precision */
record_full_arch_list_add_reg (regcache, tdep->ppc_fpscr_regnum);
/* FALL-THROUGH */
- case 100: /* VSX Scalar Copy Sign Quad-Precision */
- case 868: /* VSX Scalar Insert Exponent Quad-Precision */
+ case 100: /* VSX Scalar Copy Sign Quad-Precision */
+ case 868: /* VSX Scalar Insert Exponent Quad-Precision */
ppc_record_vsr (regcache, tdep, PPC_VRT (insn) + 32);
return 0;
case 804:
switch (PPC_FIELD (insn, 11, 5))
{
- case 27: /* VSX Scalar Square Root Quad-Precision */
+ case 27: /* VSX Scalar Square Root Quad-Precision */
record_full_arch_list_add_reg (regcache, tdep->ppc_fpscr_regnum);
/* FALL-THROUGH */
- case 0: /* VSX Scalar Absolute Quad-Precision */
- case 2: /* VSX Scalar Extract Exponent Quad-Precision */
- case 8: /* VSX Scalar Negative Absolute Quad-Precision */
- case 16: /* VSX Scalar Negate Quad-Precision */
- case 18: /* VSX Scalar Extract Significand Quad-Precision */
+ case 0: /* VSX Scalar Absolute Quad-Precision */
+ case 2: /* VSX Scalar Extract Exponent Quad-Precision */
+ case 8: /* VSX Scalar Negative Absolute Quad-Precision */
+ case 16: /* VSX Scalar Negate Quad-Precision */
+ case 18: /* VSX Scalar Extract Significand Quad-Precision */
ppc_record_vsr (regcache, tdep, PPC_VRT (insn) + 32);
return 0;
}
@@ -6409,29 +6300,29 @@ ppc_process_record_op63 (struct gdbarch *gdbarch, struct regcache *regcache,
case 836:
switch (PPC_FIELD (insn, 11, 5))
{
- case 0: /* VSX Scalar Convert with round to zero
+ case 0: /* VSX Scalar Convert with round to zero
Quad-Precision to Unsigned Quadword */
- case 1: /* VSX Scalar truncate & Convert Quad-Precision format
+ case 1: /* VSX Scalar truncate & Convert Quad-Precision format
to Unsigned Word format */
- case 2: /* VSX Scalar Convert Unsigned Doubleword format to
+ case 2: /* VSX Scalar Convert Unsigned Doubleword format to
Quad-Precision format */
- case 3: /* VSX Scalar Convert with round
+ case 3: /* VSX Scalar Convert with round
Unsigned Quadword to Quad-Precision */
- case 8: /* VSX Scalar Convert with round to zero
+ case 8: /* VSX Scalar Convert with round to zero
Quad-Precision to Signed Quadword */
- case 9: /* VSX Scalar truncate & Convert Quad-Precision format
+ case 9: /* VSX Scalar truncate & Convert Quad-Precision format
to Signed Word format */
- case 10: /* VSX Scalar Convert Signed Doubleword format to
+ case 10: /* VSX Scalar Convert Signed Doubleword format to
Quad-Precision format */
- case 11: /* VSX Scalar Convert with round
+ case 11: /* VSX Scalar Convert with round
Signed Quadword to Quad-Precision */
- case 17: /* VSX Scalar truncate & Convert Quad-Precision format
+ case 17: /* VSX Scalar truncate & Convert Quad-Precision format
to Unsigned Doubleword format */
- case 20: /* VSX Scalar round & Convert Quad-Precision format to
+ case 20: /* VSX Scalar round & Convert Quad-Precision format to
Double-Precision format */
- case 22: /* VSX Scalar Convert Double-Precision format to
+ case 22: /* VSX Scalar Convert Double-Precision format to
Quad-Precision format */
- case 25: /* VSX Scalar truncate & Convert Quad-Precision format
+ case 25: /* VSX Scalar truncate & Convert Quad-Precision format
to Signed Doubleword format */
record_full_arch_list_add_reg (regcache, tdep->ppc_fpscr_regnum);
ppc_record_vsr (regcache, tdep, PPC_VRT (insn) + 32);
@@ -6439,8 +6330,10 @@ ppc_process_record_op63 (struct gdbarch *gdbarch, struct regcache *regcache,
}
}
- gdb_printf (gdb_stdlog, "Warning: Don't know how to record %08x "
- "at %s, 63-%d.\n", insn, paddress (gdbarch, addr), ext);
+ gdb_printf (gdb_stdlog,
+ "Warning: Don't know how to record %08x "
+ "at %s, 63-%d.\n",
+ insn, paddress (gdbarch, addr), ext);
return -1;
}
@@ -6462,13 +6355,12 @@ ppc_process_record_prefix_op42 (struct gdbarch *gdbarch,
switch (type)
{
- case 0: /* Prefixed Load VSX Scalar Doubleword, plxsd */
+ case 0: /* Prefixed Load VSX Scalar Doubleword, plxsd */
ppc_record_vsr (regcache, tdep, PPC_VRT (insn_suffix) + 32);
break;
- case 2: /* Prefixed Load Halfword Algebraic, plha */
- record_full_arch_list_add_reg (regcache,
- tdep->ppc_gp0_regnum
- + PPC_RT (insn_suffix));
+ case 2: /* Prefixed Load Halfword Algebraic, plha */
+ record_full_arch_list_add_reg (regcache, tdep->ppc_gp0_regnum
+ + PPC_RT (insn_suffix));
break;
default:
return -1;
@@ -6502,93 +6394,93 @@ ppc_process_record_prefix_op59_XX3 (struct gdbarch *gdbarch,
if (ST4 == 9)
switch (opcode)
{
- case 35: /* Prefixed Masked VSX Vector 4-bit Signed Integer GER
+ case 35: /* Prefixed Masked VSX Vector 4-bit Signed Integer GER
MMIRR, pmdmxvi4ger8 (pmxvi4ger8) */
- case 34: /* Prefixed Masked VSX Vector 4-bit Signed Integer GER
+ case 34: /* Prefixed Masked VSX Vector 4-bit Signed Integer GER
MMIRR, pmdmxvi4ger8pp (pmxvi4ger8pp) */
- case 99: /* Prefixed Masked VSX Vector 8-bit Signed/Unsigned
+ case 99: /* Prefixed Masked VSX Vector 8-bit Signed/Unsigned
Integer GER with Saturate Positive multiply,
Positive accumulate, xvi8ger4spp */
- case 3: /* Prefixed Masked VSX Vector 8-bit Signed/Unsigned
+ case 3: /* Prefixed Masked VSX Vector 8-bit Signed/Unsigned
Integer GER MMIRR, pmdmxvi8ger4 (pmxvi8ger4) */
- case 2: /* Prefixed Masked VSX Vector 8-bit Signed/Unsigned
+ case 2: /* Prefixed Masked VSX Vector 8-bit Signed/Unsigned
Integer GER Positive multiply, Positive accumulate
MMIRR, pmdmxvi8ger4pp (pmxvi8ger4pp) */
- case 75: /* Prefixed Masked VSX Vector 16-bit Signed Integer
+ case 75: /* Prefixed Masked VSX Vector 16-bit Signed Integer
GER MMIRR, pmdmxvi16ger2 (pmxvi16ger2) */
- case 107: /* Prefixed Masked VSX Vector 16-bit Signed Integer
+ case 107: /* Prefixed Masked VSX Vector 16-bit Signed Integer
GER Positive multiply, Positive accumulate,
pmdmxvi16ger2pp (pmxvi16ger2pp) */
- case 43: /* Prefixed Masked VSX Vector 16-bit Signed Integer
+ case 43: /* Prefixed Masked VSX Vector 16-bit Signed Integer
GER with Saturation MMIRR, pmdmxvi16ger2s
(pmxvi16ger2s) */
- case 42: /* Prefixed Masked VSX Vector 16-bit Signed Integer
+ case 42: /* Prefixed Masked VSX Vector 16-bit Signed Integer
GER with Saturation Positive multiply, Positive
accumulate MMIRR, pmdmxvi16ger2spp (pmxvi16ger2spp)
*/
ppc_record_ACC_fpscr (regcache, tdep, at, false);
return 0;
- case 19: /* Prefixed Masked VSX Vector 16-bit Floating-Point
+ case 19: /* Prefixed Masked VSX Vector 16-bit Floating-Point
GER MMIRR, pmdmxvf16ger2 (pmxvf16ger2) */
- case 18: /* Prefixed Masked VSX Vector 16-bit Floating-Point
+ case 18: /* Prefixed Masked VSX Vector 16-bit Floating-Point
GER Positive multiply, Positive accumulate MMIRR,
pmdmxvf16ger2pp (pmxvf16ger2pp) */
- case 146: /* Prefixed Masked VSX Vector 16-bit Floating-Point
+ case 146: /* Prefixed Masked VSX Vector 16-bit Floating-Point
GER Positive multiply, Negative accumulate MMIRR,
pmdmxvf16ger2pn (pmxvf16ger2pn) */
- case 82: /* Prefixed Masked VSX Vector 16-bit Floating-Point
+ case 82: /* Prefixed Masked VSX Vector 16-bit Floating-Point
GER Negative multiply, Positive accumulate MMIRR,
pmdmxvf16ger2np (pmxvf16ger2np) */
- case 210: /* Prefixed Masked VSX Vector 16-bit Floating-Point
+ case 210: /* Prefixed Masked VSX Vector 16-bit Floating-Point
GER Negative multiply, Negative accumulate MMIRR,
pmdmxvf16ger2nn (pmxvf16ger2nn) */
- case 27: /* Prefixed Masked VSX Vector 32-bit Floating-Point
+ case 27: /* Prefixed Masked VSX Vector 32-bit Floating-Point
GER MMIRR, pmdmxvf32ger (pmxvf32ger) */
- case 26: /* Prefixed Masked VSX Vector 32-bit Floating-Point
+ case 26: /* Prefixed Masked VSX Vector 32-bit Floating-Point
GER Positive multiply, Positive accumulate MMIRR,
pmdmxvf32gerpp (pmxvf32gerpp) */
- case 154: /* Prefixed Masked VSX Vector 32-bit Floating-Point
+ case 154: /* Prefixed Masked VSX Vector 32-bit Floating-Point
GER Positive multiply, Negative accumulate MMIRR,
pmdmxvf32gerpn (pmxvf32gerpn) */
- case 90: /* Prefixed Masked VSX Vector 32-bit Floating-Point
+ case 90: /* Prefixed Masked VSX Vector 32-bit Floating-Point
GER Negative multiply, Positive accumulate MMIRR,
pmdmxvf32gernp (pmxvf32gernp )*/
- case 218: /* Prefixed Masked VSX Vector 32-bit Floating-Point
+ case 218: /* Prefixed Masked VSX Vector 32-bit Floating-Point
GER Negative multiply, Negative accumulate MMIRR,
pmdmxvf32gernn (pmxvf32gernn) */
- case 59: /* Prefixed Masked VSX Vector 64-bit Floating-Point
+ case 59: /* Prefixed Masked VSX Vector 64-bit Floating-Point
GER MMIRR, pmdmxvf64ger (pmxvf64ger) */
- case 58: /* Floating-Point GER Positive multiply, Positive
+ case 58: /* Floating-Point GER Positive multiply, Positive
accumulate MMIRR, pmdmxvf64gerpp (pmxvf64gerpp) */
- case 186: /* Prefixed Masked VSX Vector 64-bit Floating-Point
+ case 186: /* Prefixed Masked VSX Vector 64-bit Floating-Point
GER Positive multiply, Negative accumulate MMIRR,
pmdmxvf64gerpn (pmxvf64gerpn) */
- case 122: /* Prefixed Masked VSX Vector 64-bit Floating-Point
+ case 122: /* Prefixed Masked VSX Vector 64-bit Floating-Point
GER Negative multiply, Positive accumulate MMIRR,
pmdmxvf64gernp (pmxvf64gernp) */
- case 250: /* Prefixed Masked VSX Vector 64-bit Floating-Point
+ case 250: /* Prefixed Masked VSX Vector 64-bit Floating-Point
GER Negative multiply, Negative accumulate MMIRR,
pmdmxvf64gernn (pmxvf64gernn) */
- case 51: /* Prefixed Masked VSX Vector bfloat16 GER MMIRR,
+ case 51: /* Prefixed Masked VSX Vector bfloat16 GER MMIRR,
pmdmxvbf16ger2 (pmxvbf16ger2) */
- case 50: /* Prefixed Masked VSX Vector bfloat16 GER Positive
+ case 50: /* Prefixed Masked VSX Vector bfloat16 GER Positive
multiply, Positive accumulate MMIRR,
pmdmxvbf16ger2pp (pmxvbf16ger2pp) */
- case 178: /* Prefixed Masked VSX Vector bfloat16 GER Positive
+ case 178: /* Prefixed Masked VSX Vector bfloat16 GER Positive
multiply, Negative accumulate MMIRR,
pmdmxvbf16ger2pn (pmxvbf16ger2pn) */
- case 114: /* Prefixed Masked VSX Vector bfloat16 GER Negative
+ case 114: /* Prefixed Masked VSX Vector bfloat16 GER Negative
multiply, Positive accumulate MMIRR,
pmdmxvbf16ger2np (pmxvbf16ger2np) */
- case 242: /* Prefixed Masked VSX Vector bfloat16 GER Negative
+ case 242: /* Prefixed Masked VSX Vector bfloat16 GER Negative
multiply, Negative accumulate MMIRR,
pmdmxvbf16ger2nn (pmxvbf16ger2nn) */
ppc_record_ACC_fpscr (regcache, tdep, at, true);
@@ -6607,9 +6499,8 @@ ppc_process_record_prefix_op59_XX3 (struct gdbarch *gdbarch,
static int
ppc_process_record_prefix_store (struct gdbarch *gdbarch,
- struct regcache *regcache,
- CORE_ADDR addr, uint32_t insn_prefix,
- uint32_t insn_suffix)
+ struct regcache *regcache, CORE_ADDR addr,
+ uint32_t insn_prefix, uint32_t insn_suffix)
{
ppc_gdbarch_tdep *tdep = gdbarch_tdep<ppc_gdbarch_tdep> (gdbarch);
ULONGEST iaddr = 0;
@@ -6620,34 +6511,35 @@ ppc_process_record_prefix_store (struct gdbarch *gdbarch,
if (R == 0)
{
if (PPC_RA (insn_suffix) != 0)
- regcache_raw_read_unsigned (regcache, tdep->ppc_gp0_regnum
- + PPC_RA (insn_suffix), &iaddr);
+ regcache_raw_read_unsigned (
+ regcache, tdep->ppc_gp0_regnum + PPC_RA (insn_suffix), &iaddr);
}
else
{
- iaddr = addr; /* PC relative */
+ iaddr = addr; /* PC relative */
}
switch (op6)
{
case 38:
- size = 1; /* store byte, pstb */
+ size = 1; /* store byte, pstb */
break;
case 44:
- size = 2; /* store halfword, psth */
+ size = 2; /* store halfword, psth */
break;
case 36:
case 52:
- size = 4; /* store word, pstw, pstfs */
+ size = 4; /* store word, pstw, pstfs */
break;
case 54:
case 61:
- size = 8; /* store double word, pstd, pstfd */
+ size = 8; /* store double word, pstd, pstfd */
break;
case 60:
- size = 16; /* store quadword, pstq */
+ size = 16; /* store quadword, pstq */
break;
- default: return -1;
+ default:
+ return -1;
}
iaddr += P_PPC_D (insn_prefix, insn_suffix);
@@ -6675,16 +6567,16 @@ ppc_process_record_prefix_op32 (struct gdbarch *gdbarch,
{
switch (PPC_FIELD (insn_suffix, 11, 3))
{
- case 0: /* VSX Vector Splat Immediate Word 8RR, xxsplti32dx */
+ case 0: /* VSX Vector Splat Immediate Word 8RR, xxsplti32dx */
ppc_record_vsr (regcache, tdep, P_PPC_XT15 (insn_suffix));
return 0;
}
switch (PPC_FIELD (insn_suffix, 11, 4))
{
- case 2: /* VSX Vector Splat Immediate Double-Precision
+ case 2: /* VSX Vector Splat Immediate Double-Precision
8RR, xxspltidp */
- case 3: /* VSX Vector Splat Immediate Word 8RR, xxspltiw */
+ case 3: /* VSX Vector Splat Immediate Word 8RR, xxspltiw */
ppc_record_vsr (regcache, tdep, P_PPC_XT15 (insn_suffix));
return 0;
default:
@@ -6693,16 +6585,14 @@ ppc_process_record_prefix_op32 (struct gdbarch *gdbarch,
}
else
return -1;
-
}
else if (type == 2)
{
- if (ST1 == 0) /* Prefixed Load Word and Zero, plwz */
+ if (ST1 == 0) /* Prefixed Load Word and Zero, plwz */
record_full_arch_list_add_reg (regcache, tdep->ppc_gp0_regnum
- + PPC_RT (insn_suffix));
+ + PPC_RT (insn_suffix));
else
return -1;
-
}
else
return -1;
@@ -6728,18 +6618,17 @@ ppc_process_record_prefix_op33 (struct gdbarch *gdbarch,
if (ST4 == 0)
switch (PPC_FIELD (insn_suffix, 26, 2))
{
- case 0: /* VSX Vector Blend Variable Byte 8RR, xxblendvb */
- case 1: /* VSX Vector Blend Variable Halfword, xxblendvh */
- case 2: /* VSX Vector Blend Variable Word, xxblendvw */
- case 3: /* VSX Vector Blend Variable Doubleword, xxblendvd */
+ case 0: /* VSX Vector Blend Variable Byte 8RR, xxblendvb */
+ case 1: /* VSX Vector Blend Variable Halfword, xxblendvh */
+ case 2: /* VSX Vector Blend Variable Word, xxblendvw */
+ case 3: /* VSX Vector Blend Variable Doubleword, xxblendvd */
ppc_record_vsr (regcache, tdep, PPC_XT (insn_suffix));
- break;
+ break;
default:
return -1;
}
else
return -1;
-
}
else
return -1;
@@ -6766,8 +6655,8 @@ ppc_process_record_prefix_op34 (struct gdbarch *gdbarch,
if (ST4 == 0)
switch (PPC_FIELD (insn_suffix, 26, 2))
{
- case 0: /* VSX Vector Permute Extended 8RR, xxpermx */
- case 1: /* VSX Vector Evaluate 8RR, xxeval */
+ case 0: /* VSX Vector Permute Extended 8RR, xxpermx */
+ case 1: /* VSX Vector Evaluate 8RR, xxeval */
ppc_record_vsr (regcache, tdep, P_PPC_XT (insn_suffix));
break;
default:
@@ -6775,17 +6664,14 @@ ppc_process_record_prefix_op34 (struct gdbarch *gdbarch,
}
else
return -1;
-
}
else if (type == 2)
{
- if (ST1 == 0) /* Prefixed Load Word and Zero, plbz */
- record_full_arch_list_add_reg (regcache,
- tdep->ppc_gp0_regnum
- + PPC_RT (insn_suffix));
+ if (ST1 == 0) /* Prefixed Load Word and Zero, plbz */
+ record_full_arch_list_add_reg (regcache, tdep->ppc_gp0_regnum
+ + PPC_RT (insn_suffix));
else
return -1;
-
}
else
return -1;
@@ -6817,23 +6703,21 @@ ppc_process_record_prefix_store_vsx_ds_form (struct gdbarch *gdbarch,
if (R == 0)
{
if (PPC_RA (insn_suffix) != 0)
- regcache_raw_read_unsigned (regcache,
- tdep->ppc_gp0_regnum
- + PPC_RA (insn_suffix),
- &ea);
+ regcache_raw_read_unsigned (
+ regcache, tdep->ppc_gp0_regnum + PPC_RA (insn_suffix), &ea);
}
else
{
- ea = addr; /* PC relative */
+ ea = addr; /* PC relative */
}
ea += P_PPC_D (insn_prefix, insn_suffix);
switch (PPC_FIELD (insn_suffix, 0, 6))
{
- case 46: /* Prefixed Store VSX Scalar Doubleword, pstxsd */
+ case 46: /* Prefixed Store VSX Scalar Doubleword, pstxsd */
size = 8;
break;
- case 47: /* Prefixed,Store VSX Scalar Single-Precision, pstxssp */
+ case 47: /* Prefixed,Store VSX Scalar Single-Precision, pstxssp */
size = 4;
break;
default:
@@ -6841,7 +6725,7 @@ ppc_process_record_prefix_store_vsx_ds_form (struct gdbarch *gdbarch,
}
record_full_arch_list_add_mem (ea, size);
return 0;
- }
+ }
else
return -1;
}
@@ -6854,8 +6738,7 @@ ppc_process_record_prefix_store_vsx_ds_form (struct gdbarch *gdbarch,
static int
ppc_process_record_prefix_vsx_d_form (struct gdbarch *gdbarch,
struct regcache *regcache,
- CORE_ADDR addr,
- uint32_t insn_prefix,
+ CORE_ADDR addr, uint32_t insn_prefix,
uint32_t insn_suffix)
{
ppc_gdbarch_tdep *tdep = gdbarch_tdep<ppc_gdbarch_tdep> (gdbarch);
@@ -6869,10 +6752,10 @@ ppc_process_record_prefix_vsx_d_form (struct gdbarch *gdbarch,
{
switch (PPC_FIELD (insn_suffix, 0, 5))
{
- case 25: /* Prefixed Load VSX Vector, plxv */
+ case 25: /* Prefixed Load VSX Vector, plxv */
ppc_record_vsr (regcache, tdep, P_PPC_XT5 (insn_prefix));
return 0;
- case 27: /* Prefixed Store VSX Vector 8LS, pstxv */
+ case 27: /* Prefixed Store VSX Vector 8LS, pstxv */
{
size = 16;
if (R == 0)
@@ -6880,12 +6763,12 @@ ppc_process_record_prefix_vsx_d_form (struct gdbarch *gdbarch,
if (PPC_RA (insn_suffix) != 0)
regcache_raw_read_unsigned (regcache,
tdep->ppc_gp0_regnum
- + PPC_RA (insn_suffix),
+ + PPC_RA (insn_suffix),
&ea);
}
else
{
- ea = addr; /* PC relative */
+ ea = addr; /* PC relative */
}
ea += P_PPC_D (insn_prefix, insn_suffix);
@@ -6910,7 +6793,7 @@ ppc_process_record_prefix_vsx_d_form (struct gdbarch *gdbarch,
static int
ppc_process_prefix_instruction (int insn_prefix, int insn_suffix,
- CORE_ADDR addr, struct gdbarch *gdbarch,
+ CORE_ADDR addr, struct gdbarch *gdbarch,
struct regcache *regcache)
{
int type = PPC_FIELD (insn_prefix, 6, 2);
@@ -6919,84 +6802,90 @@ ppc_process_prefix_instruction (int insn_prefix, int insn_suffix,
int op6;
/* D-form has uses a 5-bit opcode in the instruction suffix */
- if (ppc_process_record_prefix_vsx_d_form ( gdbarch, regcache, addr,
- insn_prefix, insn_suffix) == 0)
+ if (ppc_process_record_prefix_vsx_d_form (gdbarch, regcache, addr,
+ insn_prefix, insn_suffix)
+ == 0)
goto SUCCESS;
- op6 = PPC_OP6 (insn_suffix); /* 6-bit opcode in the instruction suffix */
+ op6 = PPC_OP6 (insn_suffix); /* 6-bit opcode in the instruction suffix */
switch (op6)
{
- case 14: /* Prefixed Add Immediate, paddi */
+ case 14: /* Prefixed Add Immediate, paddi */
if ((type == 2) && (ST1 == 0))
- record_full_arch_list_add_reg (regcache,
- tdep->ppc_gp0_regnum
- + PPC_RT (insn_suffix));
+ record_full_arch_list_add_reg (regcache, tdep->ppc_gp0_regnum
+ + PPC_RT (insn_suffix));
else
goto UNKNOWN_PREFIX_OP;
break;
case 32:
- if (ppc_process_record_prefix_op32 (gdbarch, regcache,
- insn_prefix, insn_suffix) != 0)
+ if (ppc_process_record_prefix_op32 (gdbarch, regcache, insn_prefix,
+ insn_suffix)
+ != 0)
goto UNKNOWN_PREFIX_OP;
break;
case 33:
- if (ppc_process_record_prefix_op33 (gdbarch, regcache,
- insn_prefix, insn_suffix) != 0)
+ if (ppc_process_record_prefix_op33 (gdbarch, regcache, insn_prefix,
+ insn_suffix)
+ != 0)
goto UNKNOWN_PREFIX_OP;
break;
- case 34: /* Prefixed Load Byte and Zero, plbz */
- if (ppc_process_record_prefix_op34 (gdbarch, regcache,
- insn_prefix, insn_suffix) != 0)
+ case 34: /* Prefixed Load Byte and Zero, plbz */
+ if (ppc_process_record_prefix_op34 (gdbarch, regcache, insn_prefix,
+ insn_suffix)
+ != 0)
goto UNKNOWN_PREFIX_OP;
break;
- case 40: /* Prefixed Load Halfword and Zero, plhz */
+ case 40: /* Prefixed Load Halfword and Zero, plhz */
if ((type == 2) && (ST1 == 0))
- record_full_arch_list_add_reg (regcache,
- tdep->ppc_gp0_regnum
- + PPC_RT (insn_suffix));
+ record_full_arch_list_add_reg (regcache, tdep->ppc_gp0_regnum
+ + PPC_RT (insn_suffix));
else
goto UNKNOWN_PREFIX_OP;
break;
break;
- case 36: /* Prefixed Store Word, pstw */
- case 38: /* Prefixed Store Byte, pstb */
- case 44: /* Prefixed Store Halfword, psth */
- case 52: /* Prefixed Store Floating-Point Single, pstfs */
- case 54: /* Prefixed Store Floating-Point Double, pstfd */
- case 60: /* Prefixed Store Quadword, pstq */
- case 61: /* Prefixed Store Doubleword, pstd */
+ case 36: /* Prefixed Store Word, pstw */
+ case 38: /* Prefixed Store Byte, pstb */
+ case 44: /* Prefixed Store Halfword, psth */
+ case 52: /* Prefixed Store Floating-Point Single, pstfs */
+ case 54: /* Prefixed Store Floating-Point Double, pstfd */
+ case 60: /* Prefixed Store Quadword, pstq */
+ case 61: /* Prefixed Store Doubleword, pstd */
if (ppc_process_record_prefix_store (gdbarch, regcache, addr,
- insn_prefix, insn_suffix) != 0)
+ insn_prefix, insn_suffix)
+ != 0)
goto UNKNOWN_PREFIX_OP;
break;
case 42:
- if (ppc_process_record_prefix_op42 (gdbarch, regcache,
- insn_prefix, insn_suffix) != 0)
+ if (ppc_process_record_prefix_op42 (gdbarch, regcache, insn_prefix,
+ insn_suffix)
+ != 0)
goto UNKNOWN_PREFIX_OP;
break;
- case 43: /* Prefixed Load VSX Scalar Single-Precision, plxssp */
+ case 43: /* Prefixed Load VSX Scalar Single-Precision, plxssp */
if ((type == 0) && (ST1 == 0))
- ppc_record_vsr (regcache, tdep, PPC_VRT (insn_suffix) + 32);
+ ppc_record_vsr (regcache, tdep, PPC_VRT (insn_suffix) + 32);
else
- goto UNKNOWN_PREFIX_OP;
+ goto UNKNOWN_PREFIX_OP;
break;
case 46:
case 47:
if (ppc_process_record_prefix_store_vsx_ds_form (gdbarch, regcache, addr,
- insn_prefix, insn_suffix) != 0)
+ insn_prefix,
+ insn_suffix)
+ != 0)
goto UNKNOWN_PREFIX_OP;
break;
- case 56: /* Prefixed Load Quadword, plq */
+ case 56: /* Prefixed Load Quadword, plq */
{
if ((type == 0) && (ST1 == 0))
{
@@ -7010,27 +6899,25 @@ ppc_process_prefix_instruction (int insn_prefix, int insn_suffix,
break;
}
- case 41: /* Prefixed Load Word Algebraic, plwa */
- case 57: /* Prefixed Load Doubleword, pld */
+ case 41: /* Prefixed Load Word Algebraic, plwa */
+ case 57: /* Prefixed Load Doubleword, pld */
if ((type == 0) && (ST1 == 0))
- record_full_arch_list_add_reg (regcache,
- tdep->ppc_gp0_regnum
- + PPC_RT (insn_suffix));
+ record_full_arch_list_add_reg (regcache, tdep->ppc_gp0_regnum
+ + PPC_RT (insn_suffix));
else
goto UNKNOWN_PREFIX_OP;
break;
- case 48: /* Prefixed Load Floating-Point Single, plfs */
- case 50: /* Prefixed Load Floating-Point Double, plfd */
+ case 48: /* Prefixed Load Floating-Point Single, plfs */
+ case 50: /* Prefixed Load Floating-Point Double, plfd */
if ((type == 2) && (ST1 == 0))
- record_full_arch_list_add_reg (regcache,
- tdep->ppc_fp0_regnum
- + PPC_FRT (insn_suffix));
+ record_full_arch_list_add_reg (regcache, tdep->ppc_fp0_regnum
+ + PPC_FRT (insn_suffix));
else
goto UNKNOWN_PREFIX_OP;
break;
- case 58: /* Prefixed Load VSX Vector Paired, plxvp */
+ case 58: /* Prefixed Load VSX Vector Paired, plxvp */
if ((type == 0) && (ST1 == 0))
{
ppc_record_vsr (regcache, tdep, PPC_XTp (insn_suffix));
@@ -7042,11 +6929,12 @@ ppc_process_prefix_instruction (int insn_prefix, int insn_suffix,
case 59:
if (ppc_process_record_prefix_op59_XX3 (gdbarch, regcache, insn_prefix,
- insn_suffix) != 0)
+ insn_suffix)
+ != 0)
goto UNKNOWN_PREFIX_OP;
break;
- case 62: /* Prefixed Store VSX Vector Paired 8LS, pstxvp */
+ case 62: /* Prefixed Store VSX Vector Paired 8LS, pstxvp */
if ((type == 0) && (ST1 == 0))
{
int R = PPC_BIT (insn_prefix, 11);
@@ -7055,13 +6943,12 @@ ppc_process_prefix_instruction (int insn_prefix, int insn_suffix,
if (R == 0)
{
if (PPC_RA (insn_suffix) != 0)
- regcache_raw_read_unsigned (regcache,
- tdep->ppc_gp0_regnum
- + PPC_RA (insn_suffix), &ea);
+ regcache_raw_read_unsigned (
+ regcache, tdep->ppc_gp0_regnum + PPC_RA (insn_suffix), &ea);
}
else
{
- ea = addr; /* PC relative */
+ ea = addr; /* PC relative */
}
ea += P_PPC_D (insn_prefix, insn_suffix) << 4;
@@ -7072,16 +6959,15 @@ ppc_process_prefix_instruction (int insn_prefix, int insn_suffix,
break;
default:
-UNKNOWN_PREFIX_OP:
+ UNKNOWN_PREFIX_OP:
gdb_printf (gdb_stdlog,
"Warning: Don't know how to record prefix instruction "
"%08x %08x at %s, %d.\n",
- insn_prefix, insn_suffix, paddress (gdbarch, addr),
- op6);
+ insn_prefix, insn_suffix, paddress (gdbarch, addr), op6);
return -1;
}
- SUCCESS:
+SUCCESS:
if (record_full_arch_list_add_reg (regcache, PPC_PC_REGNUM))
return -1;
@@ -7092,7 +6978,7 @@ UNKNOWN_PREFIX_OP:
int
ppc_process_record (struct gdbarch *gdbarch, struct regcache *regcache,
- CORE_ADDR addr)
+ CORE_ADDR addr)
{
ppc_gdbarch_tdep *tdep = gdbarch_tdep<ppc_gdbarch_tdep> (gdbarch);
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
@@ -7104,29 +6990,29 @@ ppc_process_record (struct gdbarch *gdbarch, struct regcache *regcache,
switch (op6)
{
- case 1: /* prefixed instruction */
+ case 1: /* prefixed instruction */
{
/* Get the lower 32-bits of the prefixed instruction. */
- insn_suffix = read_memory_unsigned_integer (addr+4, 4, byte_order);
+ insn_suffix = read_memory_unsigned_integer (addr + 4, 4, byte_order);
return ppc_process_prefix_instruction (insn, insn_suffix, addr,
gdbarch, regcache);
}
- case 2: /* Trap Doubleword Immediate */
- case 3: /* Trap Word Immediate */
+ case 2: /* Trap Doubleword Immediate */
+ case 3: /* Trap Word Immediate */
/* Do nothing. */
break;
- case 4: /* Vector Integer, Compare, Logical, Shift, etc. */
+ case 4: /* Vector Integer, Compare, Logical, Shift, etc. */
if (ppc_process_record_op4 (gdbarch, regcache, addr, insn) != 0)
return -1;
break;
- case 6: /* Vector Load and Store */
+ case 6: /* Vector Load and Store */
if (ppc_process_record_op6 (gdbarch, regcache, addr, insn) != 0)
return -1;
break;
- case 17: /* System call */
+ case 17: /* System call */
if (PPC_LEV (insn) != 0)
goto UNKNOWN_OP;
@@ -7137,44 +7023,44 @@ ppc_process_record (struct gdbarch *gdbarch, struct regcache *regcache,
}
else
{
- gdb_printf (gdb_stderr, _("no syscall record support\n"));
+ gdb_printf (gdb_stderr, _ ("no syscall record support\n"));
return -1;
}
break;
- case 7: /* Multiply Low Immediate */
+ case 7: /* Multiply Low Immediate */
record_full_arch_list_add_reg (regcache,
tdep->ppc_gp0_regnum + PPC_RT (insn));
break;
- case 8: /* Subtract From Immediate Carrying */
+ case 8: /* Subtract From Immediate Carrying */
record_full_arch_list_add_reg (regcache, tdep->ppc_xer_regnum);
record_full_arch_list_add_reg (regcache,
tdep->ppc_gp0_regnum + PPC_RT (insn));
break;
- case 10: /* Compare Logical Immediate */
- case 11: /* Compare Immediate */
+ case 10: /* Compare Logical Immediate */
+ case 11: /* Compare Immediate */
record_full_arch_list_add_reg (regcache, tdep->ppc_cr_regnum);
break;
- case 13: /* Add Immediate Carrying and Record */
+ case 13: /* Add Immediate Carrying and Record */
record_full_arch_list_add_reg (regcache, tdep->ppc_cr_regnum);
/* FALL-THROUGH */
- case 12: /* Add Immediate Carrying */
+ case 12: /* Add Immediate Carrying */
record_full_arch_list_add_reg (regcache, tdep->ppc_xer_regnum);
/* FALL-THROUGH */
- case 14: /* Add Immediate */
- case 15: /* Add Immediate Shifted */
+ case 14: /* Add Immediate */
+ case 15: /* Add Immediate Shifted */
record_full_arch_list_add_reg (regcache,
tdep->ppc_gp0_regnum + PPC_RT (insn));
break;
- case 16: /* Branch Conditional */
+ case 16: /* Branch Conditional */
if ((PPC_BO (insn) & 0x4) == 0)
record_full_arch_list_add_reg (regcache, tdep->ppc_ctr_regnum);
/* FALL-THROUGH */
- case 18: /* Branch */
+ case 18: /* Branch */
if (PPC_LK (insn))
record_full_arch_list_add_reg (regcache, tdep->ppc_lr_regnum);
break;
@@ -7184,29 +7070,29 @@ ppc_process_record (struct gdbarch *gdbarch, struct regcache *regcache,
return -1;
break;
- case 20: /* Rotate Left Word Immediate then Mask Insert */
- case 21: /* Rotate Left Word Immediate then AND with Mask */
- case 23: /* Rotate Left Word then AND with Mask */
- case 30: /* Rotate Left Doubleword Immediate then Clear Left */
- /* Rotate Left Doubleword Immediate then Clear Right */
- /* Rotate Left Doubleword Immediate then Clear */
- /* Rotate Left Doubleword then Clear Left */
- /* Rotate Left Doubleword then Clear Right */
- /* Rotate Left Doubleword Immediate then Mask Insert */
+ case 20: /* Rotate Left Word Immediate then Mask Insert */
+ case 21: /* Rotate Left Word Immediate then AND with Mask */
+ case 23: /* Rotate Left Word then AND with Mask */
+ case 30: /* Rotate Left Doubleword Immediate then Clear Left */
+ /* Rotate Left Doubleword Immediate then Clear Right */
+ /* Rotate Left Doubleword Immediate then Clear */
+ /* Rotate Left Doubleword then Clear Left */
+ /* Rotate Left Doubleword then Clear Right */
+ /* Rotate Left Doubleword Immediate then Mask Insert */
if (PPC_RC (insn))
record_full_arch_list_add_reg (regcache, tdep->ppc_cr_regnum);
record_full_arch_list_add_reg (regcache,
tdep->ppc_gp0_regnum + PPC_RA (insn));
break;
- case 28: /* AND Immediate */
- case 29: /* AND Immediate Shifted */
+ case 28: /* AND Immediate */
+ case 29: /* AND Immediate Shifted */
record_full_arch_list_add_reg (regcache, tdep->ppc_cr_regnum);
/* FALL-THROUGH */
- case 24: /* OR Immediate */
- case 25: /* OR Immediate Shifted */
- case 26: /* XOR Immediate */
- case 27: /* XOR Immediate Shifted */
+ case 24: /* OR Immediate */
+ case 25: /* OR Immediate Shifted */
+ case 26: /* XOR Immediate */
+ case 27: /* XOR Immediate Shifted */
record_full_arch_list_add_reg (regcache,
tdep->ppc_gp0_regnum + PPC_RA (insn));
break;
@@ -7216,105 +7102,105 @@ ppc_process_record (struct gdbarch *gdbarch, struct regcache *regcache,
return -1;
break;
- case 33: /* Load Word and Zero with Update */
- case 35: /* Load Byte and Zero with Update */
- case 41: /* Load Halfword and Zero with Update */
- case 43: /* Load Halfword Algebraic with Update */
+ case 33: /* Load Word and Zero with Update */
+ case 35: /* Load Byte and Zero with Update */
+ case 41: /* Load Halfword and Zero with Update */
+ case 43: /* Load Halfword Algebraic with Update */
record_full_arch_list_add_reg (regcache,
tdep->ppc_gp0_regnum + PPC_RA (insn));
/* FALL-THROUGH */
- case 32: /* Load Word and Zero */
- case 34: /* Load Byte and Zero */
- case 40: /* Load Halfword and Zero */
- case 42: /* Load Halfword Algebraic */
+ case 32: /* Load Word and Zero */
+ case 34: /* Load Byte and Zero */
+ case 40: /* Load Halfword and Zero */
+ case 42: /* Load Halfword Algebraic */
record_full_arch_list_add_reg (regcache,
tdep->ppc_gp0_regnum + PPC_RT (insn));
break;
- case 46: /* Load Multiple Word */
+ case 46: /* Load Multiple Word */
for (i = PPC_RT (insn); i < 32; i++)
record_full_arch_list_add_reg (regcache, tdep->ppc_gp0_regnum + i);
break;
- case 56: /* Load Quadword */
+ case 56: /* Load Quadword */
tmp = tdep->ppc_gp0_regnum + (PPC_RT (insn) & ~1);
record_full_arch_list_add_reg (regcache, tmp);
record_full_arch_list_add_reg (regcache, tmp + 1);
break;
- case 49: /* Load Floating-Point Single with Update */
- case 51: /* Load Floating-Point Double with Update */
+ case 49: /* Load Floating-Point Single with Update */
+ case 51: /* Load Floating-Point Double with Update */
record_full_arch_list_add_reg (regcache,
tdep->ppc_gp0_regnum + PPC_RA (insn));
/* FALL-THROUGH */
- case 48: /* Load Floating-Point Single */
- case 50: /* Load Floating-Point Double */
+ case 48: /* Load Floating-Point Single */
+ case 50: /* Load Floating-Point Double */
record_full_arch_list_add_reg (regcache,
tdep->ppc_fp0_regnum + PPC_FRT (insn));
break;
- case 47: /* Store Multiple Word */
- {
- ULONGEST iaddr = 0;
+ case 47: /* Store Multiple Word */
+ {
+ ULONGEST iaddr = 0;
- if (PPC_RA (insn) != 0)
- regcache_raw_read_unsigned (regcache,
- tdep->ppc_gp0_regnum + PPC_RA (insn),
- &iaddr);
+ if (PPC_RA (insn) != 0)
+ regcache_raw_read_unsigned (regcache,
+ tdep->ppc_gp0_regnum + PPC_RA (insn),
+ &iaddr);
- iaddr += PPC_D (insn);
- record_full_arch_list_add_mem (iaddr, 4 * (32 - PPC_RS (insn)));
- }
+ iaddr += PPC_D (insn);
+ record_full_arch_list_add_mem (iaddr, 4 * (32 - PPC_RS (insn)));
+ }
break;
- case 37: /* Store Word with Update */
- case 39: /* Store Byte with Update */
- case 45: /* Store Halfword with Update */
- case 53: /* Store Floating-Point Single with Update */
- case 55: /* Store Floating-Point Double with Update */
+ case 37: /* Store Word with Update */
+ case 39: /* Store Byte with Update */
+ case 45: /* Store Halfword with Update */
+ case 53: /* Store Floating-Point Single with Update */
+ case 55: /* Store Floating-Point Double with Update */
record_full_arch_list_add_reg (regcache,
tdep->ppc_gp0_regnum + PPC_RA (insn));
/* FALL-THROUGH */
- case 36: /* Store Word */
- case 38: /* Store Byte */
- case 44: /* Store Halfword */
- case 52: /* Store Floating-Point Single */
- case 54: /* Store Floating-Point Double */
- {
- ULONGEST iaddr = 0;
- int size = -1;
-
- if (PPC_RA (insn) != 0)
- regcache_raw_read_unsigned (regcache,
- tdep->ppc_gp0_regnum + PPC_RA (insn),
- &iaddr);
- iaddr += PPC_D (insn);
-
- if (op6 == 36 || op6 == 37 || op6 == 52 || op6 == 53)
- size = 4;
- else if (op6 == 54 || op6 == 55)
- size = 8;
- else if (op6 == 44 || op6 == 45)
- size = 2;
- else if (op6 == 38 || op6 == 39)
- size = 1;
- else
- gdb_assert (0);
+ case 36: /* Store Word */
+ case 38: /* Store Byte */
+ case 44: /* Store Halfword */
+ case 52: /* Store Floating-Point Single */
+ case 54: /* Store Floating-Point Double */
+ {
+ ULONGEST iaddr = 0;
+ int size = -1;
- record_full_arch_list_add_mem (iaddr, size);
- }
+ if (PPC_RA (insn) != 0)
+ regcache_raw_read_unsigned (regcache,
+ tdep->ppc_gp0_regnum + PPC_RA (insn),
+ &iaddr);
+ iaddr += PPC_D (insn);
+
+ if (op6 == 36 || op6 == 37 || op6 == 52 || op6 == 53)
+ size = 4;
+ else if (op6 == 54 || op6 == 55)
+ size = 8;
+ else if (op6 == 44 || op6 == 45)
+ size = 2;
+ else if (op6 == 38 || op6 == 39)
+ size = 1;
+ else
+ gdb_assert (0);
+
+ record_full_arch_list_add_mem (iaddr, size);
+ }
break;
case 57:
switch (insn & 0x3)
{
- case 0: /* Load Floating-Point Double Pair */
+ case 0: /* Load Floating-Point Double Pair */
tmp = tdep->ppc_fp0_regnum + (PPC_RT (insn) & ~1);
record_full_arch_list_add_reg (regcache, tmp);
record_full_arch_list_add_reg (regcache, tmp + 1);
break;
- case 2: /* Load VSX Scalar Doubleword */
- case 3: /* Load VSX Scalar Single */
+ case 2: /* Load VSX Scalar Doubleword */
+ case 3: /* Load VSX Scalar Single */
ppc_record_vsr (regcache, tdep, PPC_VRT (insn) + 32);
break;
default:
@@ -7322,9 +7208,9 @@ ppc_process_record (struct gdbarch *gdbarch, struct regcache *regcache,
}
break;
- case 58: /* Load Doubleword */
- /* Load Doubleword with Update */
- /* Load Word Algebraic */
+ case 58: /* Load Doubleword */
+ /* Load Doubleword with Update */
+ /* Load Word Algebraic */
if (PPC_FIELD (insn, 30, 2) > 2)
goto UNKNOWN_OP;
@@ -7350,34 +7236,33 @@ ppc_process_record (struct gdbarch *gdbarch, struct regcache *regcache,
return -1;
break;
- case 62: /* Store Doubleword */
- /* Store Doubleword with Update */
- /* Store Quadword with Update */
- {
- ULONGEST iaddr = 0;
- int size;
- int sub2 = PPC_FIELD (insn, 30, 2);
+ case 62: /* Store Doubleword */
+ /* Store Doubleword with Update */
+ /* Store Quadword with Update */
+ {
+ ULONGEST iaddr = 0;
+ int size;
+ int sub2 = PPC_FIELD (insn, 30, 2);
- if (sub2 > 2)
- goto UNKNOWN_OP;
+ if (sub2 > 2)
+ goto UNKNOWN_OP;
- if (PPC_RA (insn) != 0)
- regcache_raw_read_unsigned (regcache,
- tdep->ppc_gp0_regnum + PPC_RA (insn),
- &iaddr);
+ if (PPC_RA (insn) != 0)
+ regcache_raw_read_unsigned (regcache,
+ tdep->ppc_gp0_regnum + PPC_RA (insn),
+ &iaddr);
- size = (sub2 == 2) ? 16 : 8;
+ size = (sub2 == 2) ? 16 : 8;
- iaddr += PPC_DS (insn) << 2;
- record_full_arch_list_add_mem (iaddr, size);
+ iaddr += PPC_DS (insn) << 2;
+ record_full_arch_list_add_mem (iaddr, size);
- if (op6 == 62 && sub2 == 1)
- record_full_arch_list_add_reg (regcache,
- tdep->ppc_gp0_regnum +
- PPC_RA (insn));
+ if (op6 == 62 && sub2 == 1)
+ record_full_arch_list_add_reg (regcache,
+ tdep->ppc_gp0_regnum + PPC_RA (insn));
- break;
- }
+ break;
+ }
case 63:
if (ppc_process_record_op63 (gdbarch, regcache, addr, insn) != 0)
@@ -7385,9 +7270,11 @@ ppc_process_record (struct gdbarch *gdbarch, struct regcache *regcache,
break;
default:
-UNKNOWN_OP:
- gdb_printf (gdb_stdlog, "Warning: Don't know how to record %08x "
- "at %s, %d.\n", insn, paddress (gdbarch, addr), op6);
+ UNKNOWN_OP:
+ gdb_printf (gdb_stdlog,
+ "Warning: Don't know how to record %08x "
+ "at %s, %d.\n",
+ insn, paddress (gdbarch, addr), op6);
return -1;
}
@@ -7447,15 +7334,15 @@ rs6000_program_breakpoint_here_p (gdbarch *gdbarch, CORE_ADDR address)
if (target_read_memory (address, target_mem, PPC_INSN_SIZE) == 0)
{
- uint32_t insn = (uint32_t) extract_unsigned_integer
- (target_mem, PPC_INSN_SIZE, gdbarch_byte_order_for_code (gdbarch));
+ uint32_t insn = (uint32_t) extract_unsigned_integer (
+ target_mem, PPC_INSN_SIZE, gdbarch_byte_order_for_code (gdbarch));
/* Check if INSN is a TW, TWI, TD or TDI instruction. There
are multiple choices of such instructions with different registers
and / or immediate values but they all cause a break. */
if (is_tw_insn (insn) || is_twi_insn (insn) || is_td_insn (insn)
- || is_tdi_insn (insn))
- return true;
+ || is_tdi_insn (insn))
+ return true;
}
return false;
@@ -7492,11 +7379,11 @@ rs6000_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
int num_pseudoregs = 0;
int cur_reg;
- from_xcoff_exec = info.abfd && info.abfd->format == bfd_object &&
- bfd_get_flavour (info.abfd) == bfd_target_xcoff_flavour;
+ from_xcoff_exec = info.abfd && info.abfd->format == bfd_object
+ && bfd_get_flavour (info.abfd) == bfd_target_xcoff_flavour;
- from_elf_exec = info.abfd && info.abfd->format == bfd_object &&
- bfd_get_flavour (info.abfd) == bfd_target_elf_flavour;
+ from_elf_exec = info.abfd && info.abfd->format == bfd_object
+ && bfd_get_flavour (info.abfd) == bfd_target_elf_flavour;
/* Check word size. If INFO is from a binary file, infer it from
that, else choose a likely default. */
@@ -7547,7 +7434,7 @@ rs6000_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
/* Find a default target description which describes our register
layout, if we do not already have one. */
- if (! tdesc_has_registers (tdesc))
+ if (!tdesc_has_registers (tdesc))
{
const struct ppc_variant *v;
@@ -7564,20 +7451,18 @@ rs6000_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
/* Check any target description for validity. */
if (tdesc_has_registers (tdesc))
{
- static const char *const gprs[] = {
- "r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7",
- "r8", "r9", "r10", "r11", "r12", "r13", "r14", "r15",
- "r16", "r17", "r18", "r19", "r20", "r21", "r22", "r23",
- "r24", "r25", "r26", "r27", "r28", "r29", "r30", "r31"
- };
+ static const char *const gprs[]
+ = { "r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7",
+ "r8", "r9", "r10", "r11", "r12", "r13", "r14", "r15",
+ "r16", "r17", "r18", "r19", "r20", "r21", "r22", "r23",
+ "r24", "r25", "r26", "r27", "r28", "r29", "r30", "r31" };
const struct tdesc_feature *feature;
int i, valid_p;
static const char *const msr_names[] = { "msr", "ps" };
static const char *const cr_names[] = { "cr", "cnd" };
static const char *const ctr_names[] = { "ctr", "cnt" };
- feature = tdesc_find_feature (tdesc,
- "org.gnu.gdb.power.core");
+ feature = tdesc_find_feature (tdesc, "org.gnu.gdb.power.core");
if (feature == NULL)
return NULL;
@@ -7585,8 +7470,8 @@ rs6000_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
valid_p = 1;
for (i = 0; i < ppc_num_gprs; i++)
- valid_p &= tdesc_numbered_register (feature, tdesc_data.get (),
- i, gprs[i]);
+ valid_p
+ &= tdesc_numbered_register (feature, tdesc_data.get (), i, gprs[i]);
valid_p &= tdesc_numbered_register (feature, tdesc_data.get (),
PPC_PC_REGNUM, "pc");
valid_p &= tdesc_numbered_register (feature, tdesc_data.get (),
@@ -7613,16 +7498,14 @@ rs6000_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
if (wordsize == -1)
wordsize = tdesc_wordsize;
- feature = tdesc_find_feature (tdesc,
- "org.gnu.gdb.power.fpu");
+ feature = tdesc_find_feature (tdesc, "org.gnu.gdb.power.fpu");
if (feature != NULL)
{
- static const char *const fprs[] = {
- "f0", "f1", "f2", "f3", "f4", "f5", "f6", "f7",
- "f8", "f9", "f10", "f11", "f12", "f13", "f14", "f15",
- "f16", "f17", "f18", "f19", "f20", "f21", "f22", "f23",
- "f24", "f25", "f26", "f27", "f28", "f29", "f30", "f31"
- };
+ static const char *const fprs[]
+ = { "f0", "f1", "f2", "f3", "f4", "f5", "f6", "f7",
+ "f8", "f9", "f10", "f11", "f12", "f13", "f14", "f15",
+ "f16", "f17", "f18", "f19", "f20", "f21", "f22", "f23",
+ "f24", "f25", "f26", "f27", "f28", "f29", "f30", "f31" };
valid_p = 1;
for (i = 0; i < ppc_num_fprs; i++)
valid_p &= tdesc_numbered_register (feature, tdesc_data.get (),
@@ -7643,22 +7526,21 @@ rs6000_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
else
have_fpu = 0;
- feature = tdesc_find_feature (tdesc,
- "org.gnu.gdb.power.altivec");
+ feature = tdesc_find_feature (tdesc, "org.gnu.gdb.power.altivec");
if (feature != NULL)
{
static const char *const vector_regs[] = {
- "vr0", "vr1", "vr2", "vr3", "vr4", "vr5", "vr6", "vr7",
- "vr8", "vr9", "vr10", "vr11", "vr12", "vr13", "vr14", "vr15",
+ "vr0", "vr1", "vr2", "vr3", "vr4", "vr5", "vr6", "vr7",
+ "vr8", "vr9", "vr10", "vr11", "vr12", "vr13", "vr14", "vr15",
"vr16", "vr17", "vr18", "vr19", "vr20", "vr21", "vr22", "vr23",
"vr24", "vr25", "vr26", "vr27", "vr28", "vr29", "vr30", "vr31"
};
valid_p = 1;
for (i = 0; i < ppc_num_gprs; i++)
- valid_p &= tdesc_numbered_register (feature, tdesc_data.get (),
- PPC_VR0_REGNUM + i,
- vector_regs[i]);
+ valid_p
+ &= tdesc_numbered_register (feature, tdesc_data.get (),
+ PPC_VR0_REGNUM + i, vector_regs[i]);
valid_p &= tdesc_numbered_register (feature, tdesc_data.get (),
PPC_VSCR_REGNUM, "vscr");
valid_p &= tdesc_numbered_register (feature, tdesc_data.get (),
@@ -7672,19 +7554,16 @@ rs6000_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
have_altivec = 0;
/* Check for POWER7 VSX registers support. */
- feature = tdesc_find_feature (tdesc,
- "org.gnu.gdb.power.vsx");
+ feature = tdesc_find_feature (tdesc, "org.gnu.gdb.power.vsx");
if (feature != NULL)
{
- static const char *const vsx_regs[] = {
- "vs0h", "vs1h", "vs2h", "vs3h", "vs4h", "vs5h",
- "vs6h", "vs7h", "vs8h", "vs9h", "vs10h", "vs11h",
- "vs12h", "vs13h", "vs14h", "vs15h", "vs16h", "vs17h",
- "vs18h", "vs19h", "vs20h", "vs21h", "vs22h", "vs23h",
- "vs24h", "vs25h", "vs26h", "vs27h", "vs28h", "vs29h",
- "vs30h", "vs31h"
- };
+ static const char *const vsx_regs[]
+ = { "vs0h", "vs1h", "vs2h", "vs3h", "vs4h", "vs5h", "vs6h",
+ "vs7h", "vs8h", "vs9h", "vs10h", "vs11h", "vs12h", "vs13h",
+ "vs14h", "vs15h", "vs16h", "vs17h", "vs18h", "vs19h", "vs20h",
+ "vs21h", "vs22h", "vs23h", "vs24h", "vs25h", "vs26h", "vs27h",
+ "vs28h", "vs29h", "vs30h", "vs31h" };
valid_p = 1;
@@ -7714,20 +7593,15 @@ rs6000_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
Thus, the target description is expected to supply the upper
halves separately. */
- feature = tdesc_find_feature (tdesc,
- "org.gnu.gdb.power.spe");
+ feature = tdesc_find_feature (tdesc, "org.gnu.gdb.power.spe");
if (feature != NULL)
{
- static const char *const upper_spe[] = {
- "ev0h", "ev1h", "ev2h", "ev3h",
- "ev4h", "ev5h", "ev6h", "ev7h",
- "ev8h", "ev9h", "ev10h", "ev11h",
- "ev12h", "ev13h", "ev14h", "ev15h",
- "ev16h", "ev17h", "ev18h", "ev19h",
- "ev20h", "ev21h", "ev22h", "ev23h",
- "ev24h", "ev25h", "ev26h", "ev27h",
- "ev28h", "ev29h", "ev30h", "ev31h"
- };
+ static const char *const upper_spe[]
+ = { "ev0h", "ev1h", "ev2h", "ev3h", "ev4h", "ev5h", "ev6h",
+ "ev7h", "ev8h", "ev9h", "ev10h", "ev11h", "ev12h", "ev13h",
+ "ev14h", "ev15h", "ev16h", "ev17h", "ev18h", "ev19h", "ev20h",
+ "ev21h", "ev22h", "ev23h", "ev24h", "ev25h", "ev26h", "ev27h",
+ "ev28h", "ev29h", "ev30h", "ev31h" };
valid_p = 1;
for (i = 0; i < ppc_num_gprs; i++)
@@ -7747,8 +7621,7 @@ rs6000_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
have_spe = 0;
/* Program Priority Register. */
- feature = tdesc_find_feature (tdesc,
- "org.gnu.gdb.power.ppr");
+ feature = tdesc_find_feature (tdesc, "org.gnu.gdb.power.ppr");
if (feature != NULL)
{
valid_p = 1;
@@ -7763,8 +7636,7 @@ rs6000_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
have_ppr = 0;
/* Data Stream Control Register. */
- feature = tdesc_find_feature (tdesc,
- "org.gnu.gdb.power.dscr");
+ feature = tdesc_find_feature (tdesc, "org.gnu.gdb.power.dscr");
if (feature != NULL)
{
valid_p = 1;
@@ -7779,8 +7651,7 @@ rs6000_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
have_dscr = 0;
/* Target Address Register. */
- feature = tdesc_find_feature (tdesc,
- "org.gnu.gdb.power.tar");
+ feature = tdesc_find_feature (tdesc, "org.gnu.gdb.power.tar");
if (feature != NULL)
{
valid_p = 1;
@@ -7795,19 +7666,16 @@ rs6000_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
have_tar = 0;
/* Event-based Branching Registers. */
- feature = tdesc_find_feature (tdesc,
- "org.gnu.gdb.power.ebb");
+ feature = tdesc_find_feature (tdesc, "org.gnu.gdb.power.ebb");
if (feature != NULL)
{
- static const char *const ebb_regs[] = {
- "bescr", "ebbhr", "ebbrr"
- };
+ static const char *const ebb_regs[] = { "bescr", "ebbhr", "ebbrr" };
valid_p = 1;
for (i = 0; i < ARRAY_SIZE (ebb_regs); i++)
- valid_p &= tdesc_numbered_register (feature, tdesc_data.get (),
- PPC_BESCR_REGNUM + i,
- ebb_regs[i]);
+ valid_p
+ &= tdesc_numbered_register (feature, tdesc_data.get (),
+ PPC_BESCR_REGNUM + i, ebb_regs[i]);
if (!valid_p)
return NULL;
have_ebb = 1;
@@ -7817,27 +7685,21 @@ rs6000_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
/* Subset of the ISA 2.07 Performance Monitor Registers provided
by Linux. */
- feature = tdesc_find_feature (tdesc,
- "org.gnu.gdb.power.linux.pmu");
+ feature = tdesc_find_feature (tdesc, "org.gnu.gdb.power.linux.pmu");
if (feature != NULL)
{
valid_p = 1;
valid_p &= tdesc_numbered_register (feature, tdesc_data.get (),
- PPC_MMCR0_REGNUM,
- "mmcr0");
+ PPC_MMCR0_REGNUM, "mmcr0");
valid_p &= tdesc_numbered_register (feature, tdesc_data.get (),
- PPC_MMCR2_REGNUM,
- "mmcr2");
+ PPC_MMCR2_REGNUM, "mmcr2");
valid_p &= tdesc_numbered_register (feature, tdesc_data.get (),
- PPC_SIAR_REGNUM,
- "siar");
+ PPC_SIAR_REGNUM, "siar");
valid_p &= tdesc_numbered_register (feature, tdesc_data.get (),
- PPC_SDAR_REGNUM,
- "sdar");
+ PPC_SDAR_REGNUM, "sdar");
valid_p &= tdesc_numbered_register (feature, tdesc_data.get (),
- PPC_SIER_REGNUM,
- "sier");
+ PPC_SIER_REGNUM, "sier");
if (!valid_p)
return NULL;
@@ -7847,13 +7709,11 @@ rs6000_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
have_pmu = 0;
/* Hardware Transactional Memory Registers. */
- feature = tdesc_find_feature (tdesc,
- "org.gnu.gdb.power.htm.spr");
+ feature = tdesc_find_feature (tdesc, "org.gnu.gdb.power.htm.spr");
if (feature != NULL)
{
- static const char *const tm_spr_regs[] = {
- "tfhar", "texasr", "tfiar"
- };
+ static const char *const tm_spr_regs[]
+ = { "tfhar", "texasr", "tfiar" };
valid_p = 1;
for (i = 0; i < ARRAY_SIZE (tm_spr_regs); i++)
@@ -7868,24 +7728,21 @@ rs6000_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
else
have_htm_spr = 0;
- feature = tdesc_find_feature (tdesc,
- "org.gnu.gdb.power.htm.core");
+ feature = tdesc_find_feature (tdesc, "org.gnu.gdb.power.htm.core");
if (feature != NULL)
{
- static const char *const cgprs[] = {
- "cr0", "cr1", "cr2", "cr3", "cr4", "cr5", "cr6", "cr7",
- "cr8", "cr9", "cr10", "cr11", "cr12", "cr13", "cr14",
- "cr15", "cr16", "cr17", "cr18", "cr19", "cr20", "cr21",
- "cr22", "cr23", "cr24", "cr25", "cr26", "cr27", "cr28",
- "cr29", "cr30", "cr31", "ccr", "cxer", "clr", "cctr"
- };
+ static const char *const cgprs[]
+ = { "cr0", "cr1", "cr2", "cr3", "cr4", "cr5", "cr6", "cr7",
+ "cr8", "cr9", "cr10", "cr11", "cr12", "cr13", "cr14", "cr15",
+ "cr16", "cr17", "cr18", "cr19", "cr20", "cr21", "cr22", "cr23",
+ "cr24", "cr25", "cr26", "cr27", "cr28", "cr29", "cr30", "cr31",
+ "ccr", "cxer", "clr", "cctr" };
valid_p = 1;
for (i = 0; i < ARRAY_SIZE (cgprs); i++)
valid_p &= tdesc_numbered_register (feature, tdesc_data.get (),
- PPC_CR0_REGNUM + i,
- cgprs[i]);
+ PPC_CR0_REGNUM + i, cgprs[i]);
if (!valid_p)
return NULL;
@@ -7894,24 +7751,21 @@ rs6000_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
else
have_htm_core = 0;
- feature = tdesc_find_feature (tdesc,
- "org.gnu.gdb.power.htm.fpu");
+ feature = tdesc_find_feature (tdesc, "org.gnu.gdb.power.htm.fpu");
if (feature != NULL)
{
valid_p = 1;
- static const char *const cfprs[] = {
- "cf0", "cf1", "cf2", "cf3", "cf4", "cf5", "cf6", "cf7",
- "cf8", "cf9", "cf10", "cf11", "cf12", "cf13", "cf14", "cf15",
- "cf16", "cf17", "cf18", "cf19", "cf20", "cf21", "cf22",
- "cf23", "cf24", "cf25", "cf26", "cf27", "cf28", "cf29",
- "cf30", "cf31", "cfpscr"
- };
+ static const char *const cfprs[]
+ = { "cf0", "cf1", "cf2", "cf3", "cf4", "cf5", "cf6",
+ "cf7", "cf8", "cf9", "cf10", "cf11", "cf12", "cf13",
+ "cf14", "cf15", "cf16", "cf17", "cf18", "cf19", "cf20",
+ "cf21", "cf22", "cf23", "cf24", "cf25", "cf26", "cf27",
+ "cf28", "cf29", "cf30", "cf31", "cfpscr" };
for (i = 0; i < ARRAY_SIZE (cfprs); i++)
valid_p &= tdesc_numbered_register (feature, tdesc_data.get (),
- PPC_CF0_REGNUM + i,
- cfprs[i]);
+ PPC_CF0_REGNUM + i, cfprs[i]);
if (!valid_p)
return NULL;
@@ -7920,25 +7774,21 @@ rs6000_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
else
have_htm_fpu = 0;
- feature = tdesc_find_feature (tdesc,
- "org.gnu.gdb.power.htm.altivec");
+ feature = tdesc_find_feature (tdesc, "org.gnu.gdb.power.htm.altivec");
if (feature != NULL)
{
valid_p = 1;
- static const char *const cvmx[] = {
- "cvr0", "cvr1", "cvr2", "cvr3", "cvr4", "cvr5", "cvr6",
- "cvr7", "cvr8", "cvr9", "cvr10", "cvr11", "cvr12", "cvr13",
- "cvr14", "cvr15","cvr16", "cvr17", "cvr18", "cvr19", "cvr20",
- "cvr21", "cvr22", "cvr23", "cvr24", "cvr25", "cvr26",
- "cvr27", "cvr28", "cvr29", "cvr30", "cvr31", "cvscr",
- "cvrsave"
- };
+ static const char *const cvmx[]
+ = { "cvr0", "cvr1", "cvr2", "cvr3", "cvr4", "cvr5", "cvr6",
+ "cvr7", "cvr8", "cvr9", "cvr10", "cvr11", "cvr12", "cvr13",
+ "cvr14", "cvr15", "cvr16", "cvr17", "cvr18", "cvr19", "cvr20",
+ "cvr21", "cvr22", "cvr23", "cvr24", "cvr25", "cvr26", "cvr27",
+ "cvr28", "cvr29", "cvr30", "cvr31", "cvscr", "cvrsave" };
for (i = 0; i < ARRAY_SIZE (cvmx); i++)
valid_p &= tdesc_numbered_register (feature, tdesc_data.get (),
- PPC_CVR0_REGNUM + i,
- cvmx[i]);
+ PPC_CVR0_REGNUM + i, cvmx[i]);
if (!valid_p)
return NULL;
@@ -7947,25 +7797,22 @@ rs6000_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
else
have_htm_altivec = 0;
- feature = tdesc_find_feature (tdesc,
- "org.gnu.gdb.power.htm.vsx");
+ feature = tdesc_find_feature (tdesc, "org.gnu.gdb.power.htm.vsx");
if (feature != NULL)
{
valid_p = 1;
- static const char *const cvsx[] = {
- "cvs0h", "cvs1h", "cvs2h", "cvs3h", "cvs4h", "cvs5h",
- "cvs6h", "cvs7h", "cvs8h", "cvs9h", "cvs10h", "cvs11h",
- "cvs12h", "cvs13h", "cvs14h", "cvs15h", "cvs16h", "cvs17h",
- "cvs18h", "cvs19h", "cvs20h", "cvs21h", "cvs22h", "cvs23h",
- "cvs24h", "cvs25h", "cvs26h", "cvs27h", "cvs28h", "cvs29h",
- "cvs30h", "cvs31h"
- };
+ static const char *const cvsx[]
+ = { "cvs0h", "cvs1h", "cvs2h", "cvs3h", "cvs4h", "cvs5h",
+ "cvs6h", "cvs7h", "cvs8h", "cvs9h", "cvs10h", "cvs11h",
+ "cvs12h", "cvs13h", "cvs14h", "cvs15h", "cvs16h", "cvs17h",
+ "cvs18h", "cvs19h", "cvs20h", "cvs21h", "cvs22h", "cvs23h",
+ "cvs24h", "cvs25h", "cvs26h", "cvs27h", "cvs28h", "cvs29h",
+ "cvs30h", "cvs31h" };
for (i = 0; i < ARRAY_SIZE (cvsx); i++)
valid_p &= tdesc_numbered_register (feature, tdesc_data.get (),
- (PPC_CVSR0_UPPER_REGNUM
- + i),
+ (PPC_CVSR0_UPPER_REGNUM + i),
cvsx[i]);
if (!valid_p || !have_htm_fpu || !have_htm_altivec)
@@ -7975,8 +7822,7 @@ rs6000_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
else
have_htm_vsx = 0;
- feature = tdesc_find_feature (tdesc,
- "org.gnu.gdb.power.htm.ppr");
+ feature = tdesc_find_feature (tdesc, "org.gnu.gdb.power.htm.ppr");
if (feature != NULL)
{
valid_p = tdesc_numbered_register (feature, tdesc_data.get (),
@@ -7989,8 +7835,7 @@ rs6000_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
else
have_htm_ppr = 0;
- feature = tdesc_find_feature (tdesc,
- "org.gnu.gdb.power.htm.dscr");
+ feature = tdesc_find_feature (tdesc, "org.gnu.gdb.power.htm.dscr");
if (feature != NULL)
{
valid_p = tdesc_numbered_register (feature, tdesc_data.get (),
@@ -8003,8 +7848,7 @@ rs6000_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
else
have_htm_dscr = 0;
- feature = tdesc_find_feature (tdesc,
- "org.gnu.gdb.power.htm.tar");
+ feature = tdesc_find_feature (tdesc, "org.gnu.gdb.power.htm.tar");
if (feature != NULL)
{
valid_p = tdesc_numbered_register (feature, tdesc_data.get (),
@@ -8051,7 +7895,8 @@ rs6000_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
if (soft_float_flag == AUTO_BOOLEAN_AUTO && from_elf_exec)
{
switch (bfd_elf_get_obj_attr_int (info.abfd, OBJ_ATTR_GNU,
- Tag_GNU_Power_ABI_FP) & 3)
+ Tag_GNU_Power_ABI_FP)
+ & 3)
{
case 1:
soft_float_flag = AUTO_BOOLEAN_FALSE;
@@ -8067,7 +7912,8 @@ rs6000_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
if (long_double_abi == POWERPC_LONG_DOUBLE_AUTO && from_elf_exec)
{
switch (bfd_elf_get_obj_attr_int (info.abfd, OBJ_ATTR_GNU,
- Tag_GNU_Power_ABI_FP) >> 2)
+ Tag_GNU_Power_ABI_FP)
+ >> 2)
{
case 1:
long_double_abi = POWERPC_LONG_DOUBLE_IBM128;
@@ -8149,8 +7995,7 @@ rs6000_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
do not yet know what hardware we'll decide we have. Yuck! FIXME! */
/* Find a candidate among extant architectures. */
- for (arches = gdbarch_list_lookup_by_info (arches, &info);
- arches != NULL;
+ for (arches = gdbarch_list_lookup_by_info (arches, &info); arches != NULL;
arches = gdbarch_list_lookup_by_info (arches->next, &info))
{
/* Word size in the various PowerPC bfd_arch_info structs isn't
@@ -8257,14 +8102,14 @@ rs6000_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
else
tdep->lr_frame_offset = 4;
- if (have_spe || have_dfp || have_altivec
- || have_vsx || have_htm_fpu || have_htm_vsx)
+ if (have_spe || have_dfp || have_altivec || have_vsx || have_htm_fpu
+ || have_htm_vsx)
{
set_gdbarch_pseudo_register_read (gdbarch, rs6000_pseudo_register_read);
set_gdbarch_pseudo_register_write (gdbarch,
rs6000_pseudo_register_write);
- set_gdbarch_ax_pseudo_register_collect (gdbarch,
- rs6000_ax_pseudo_register_collect);
+ set_gdbarch_ax_pseudo_register_collect (
+ gdbarch, rs6000_ax_pseudo_register_collect);
}
set_gdbarch_gen_return_address (gdbarch, rs6000_gen_return_address);
@@ -8318,7 +8163,8 @@ rs6000_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
set_gdbarch_push_dummy_call (gdbarch, ppc64_sysv_abi_push_dummy_call);
set_gdbarch_skip_prologue (gdbarch, rs6000_skip_prologue);
- set_gdbarch_stack_frame_destroyed_p (gdbarch, rs6000_stack_frame_destroyed_p);
+ set_gdbarch_stack_frame_destroyed_p (gdbarch,
+ rs6000_stack_frame_destroyed_p);
set_gdbarch_skip_main_prologue (gdbarch, rs6000_skip_main_prologue);
set_gdbarch_inner_than (gdbarch, core_addr_lessthan);
@@ -8328,7 +8174,7 @@ rs6000_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
set_gdbarch_sw_breakpoint_from_kind (gdbarch,
rs6000_breakpoint::bp_from_kind);
set_gdbarch_program_breakpoint_here_p (gdbarch,
- rs6000_program_breakpoint_here_p);
+ rs6000_program_breakpoint_here_p);
/* The value of symbols of type N_SO and N_FUN maybe null when
it shouldn't be. */
@@ -8336,7 +8182,7 @@ rs6000_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
/* Handles single stepping of atomic sequences. */
set_gdbarch_software_single_step (gdbarch, ppc_deal_with_atomic_sequence);
-
+
/* Not sure on this. FIXMEmgo */
set_gdbarch_frame_args_skip (gdbarch, 8);
@@ -8344,8 +8190,8 @@ rs6000_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
set_gdbarch_fetch_pointer_argument (gdbarch, rs6000_fetch_pointer_argument);
/* Trampoline. */
- set_gdbarch_in_solib_return_trampoline
- (gdbarch, rs6000_in_solib_return_trampoline);
+ set_gdbarch_in_solib_return_trampoline (gdbarch,
+ rs6000_in_solib_return_trampoline);
set_gdbarch_skip_trampoline_code (gdbarch, rs6000_skip_trampoline_code);
/* Hook in the DWARF CFI frame unwinder. */
@@ -8356,15 +8202,14 @@ rs6000_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
dwarf2_frame_set_init_reg (gdbarch, ppc_dwarf2_frame_init_reg);
/* Setup displaced stepping. */
- set_gdbarch_displaced_step_copy_insn (gdbarch,
- ppc_displaced_step_copy_insn);
+ set_gdbarch_displaced_step_copy_insn (gdbarch, ppc_displaced_step_copy_insn);
set_gdbarch_displaced_step_hw_singlestep (gdbarch,
ppc_displaced_step_hw_singlestep);
set_gdbarch_displaced_step_fixup (gdbarch, ppc_displaced_step_fixup);
set_gdbarch_displaced_step_prepare (gdbarch, ppc_displaced_step_prepare);
set_gdbarch_displaced_step_finish (gdbarch, ppc_displaced_step_finish);
- set_gdbarch_displaced_step_restore_all_in_ptid
- (gdbarch, ppc_displaced_step_restore_all_in_ptid);
+ set_gdbarch_displaced_step_restore_all_in_ptid (
+ gdbarch, ppc_displaced_step_restore_all_in_ptid);
set_gdbarch_max_insn_length (gdbarch, 2 * PPC_INSN_SIZE);
@@ -8480,7 +8325,7 @@ powerpc_set_soft_float (const char *args, int from_tty,
/* Update the architecture. */
if (!gdbarch_update_p (info))
- internal_error (_("could not update architecture"));
+ internal_error (_ ("could not update architecture"));
}
static void
@@ -8489,34 +8334,32 @@ powerpc_set_vector_abi (const char *args, int from_tty,
{
int vector_abi;
- for (vector_abi = POWERPC_VEC_AUTO;
- vector_abi != POWERPC_VEC_LAST;
+ for (vector_abi = POWERPC_VEC_AUTO; vector_abi != POWERPC_VEC_LAST;
vector_abi++)
- if (strcmp (powerpc_vector_abi_string,
- powerpc_vector_strings[vector_abi]) == 0)
+ if (strcmp (powerpc_vector_abi_string, powerpc_vector_strings[vector_abi])
+ == 0)
{
powerpc_vector_abi_global = (enum powerpc_vector_abi) vector_abi;
break;
}
if (vector_abi == POWERPC_VEC_LAST)
- internal_error (_("Invalid vector ABI accepted: %s."),
+ internal_error (_ ("Invalid vector ABI accepted: %s."),
powerpc_vector_abi_string);
/* Update the architecture. */
gdbarch_info info;
if (!gdbarch_update_p (info))
- internal_error (_("could not update architecture"));
+ internal_error (_ ("could not update architecture"));
}
/* Show the current setting of the exact watchpoints flag. */
static void
show_powerpc_exact_watchpoints (struct ui_file *file, int from_tty,
- struct cmd_list_element *c,
- const char *value)
+ struct cmd_list_element *c, const char *value)
{
- gdb_printf (file, _("Use of exact watchpoints is %s.\n"), value);
+ gdb_printf (file, _ ("Use of exact watchpoints is %s.\n"), value);
}
/* Read a PPC instruction from memory. */
@@ -8593,12 +8436,13 @@ ppc_insn_prefix_dform (unsigned int insn1, unsigned int insn2)
{
/* result is 34-bits */
return (CORE_ADDR) ((((insn1 & 0x3ffff) ^ 0x20000) - 0x20000) << 16)
- | (CORE_ADDR)(insn2 & 0xffff);
+ | (CORE_ADDR) (insn2 & 0xffff);
}
/* Initialization code. */
void _initialize_rs6000_tdep ();
+
void
_initialize_rs6000_tdep ()
{
@@ -8629,34 +8473,31 @@ _initialize_rs6000_tdep ()
/* Add root prefix command for all "set powerpc"/"show powerpc"
commands. */
add_setshow_prefix_cmd ("powerpc", no_class,
- _("Various PowerPC-specific commands."),
- _("Various PowerPC-specific commands."),
- &setpowerpccmdlist, &showpowerpccmdlist,
- &setlist, &showlist);
+ _ ("Various PowerPC-specific commands."),
+ _ ("Various PowerPC-specific commands."),
+ &setpowerpccmdlist, &showpowerpccmdlist, &setlist,
+ &showlist);
/* Add a command to allow the user to force the ABI. */
add_setshow_auto_boolean_cmd ("soft-float", class_support,
&powerpc_soft_float_global,
- _("Set whether to use a soft-float ABI."),
- _("Show whether to use a soft-float ABI."),
- NULL,
- powerpc_set_soft_float, NULL,
+ _ ("Set whether to use a soft-float ABI."),
+ _ ("Show whether to use a soft-float ABI."),
+ NULL, powerpc_set_soft_float, NULL,
&setpowerpccmdlist, &showpowerpccmdlist);
add_setshow_enum_cmd ("vector-abi", class_support, powerpc_vector_strings,
- &powerpc_vector_abi_string,
- _("Set the vector ABI."),
- _("Show the vector ABI."),
- NULL, powerpc_set_vector_abi, NULL,
- &setpowerpccmdlist, &showpowerpccmdlist);
+ &powerpc_vector_abi_string, _ ("Set the vector ABI."),
+ _ ("Show the vector ABI."), NULL,
+ powerpc_set_vector_abi, NULL, &setpowerpccmdlist,
+ &showpowerpccmdlist);
add_setshow_boolean_cmd ("exact-watchpoints", class_support,
- &target_exact_watchpoints,
- _("\
+ &target_exact_watchpoints, _ ("\
Set whether to use just one debug register for watchpoints on scalars."),
- _("\
+ _ ("\
Show whether to use just one debug register for watchpoints on scalars."),
- _("\
+ _ ("\
If true, GDB will use only one debug register when watching a variable of\n\
scalar type, thus assuming that the variable is accessed through the address\n\
of its first byte."),
diff --git a/gdb/run-on-main-thread.c b/gdb/run-on-main-thread.c
index c7d9de0afc8..833ca2f7f3b 100644
--- a/gdb/run-on-main-thread.c
+++ b/gdb/run-on-main-thread.c
@@ -107,6 +107,7 @@ is_main_thread ()
}
void _initialize_run_on_main_thread ();
+
void
_initialize_run_on_main_thread ()
{
diff --git a/gdb/rust-exp.h b/gdb/rust-exp.h
index 36cd17e756f..a6b6e3f48d5 100644
--- a/gdb/rust-exp.h
+++ b/gdb/rust-exp.h
@@ -27,39 +27,35 @@ extern struct value *eval_op_rust_complement (struct type *expect_type,
enum noside noside,
enum exp_opcode opcode,
struct value *value);
-extern struct value *eval_op_rust_array (struct type *expect_type,
- struct expression *exp,
- enum noside noside,
- enum exp_opcode opcode,
- struct value *ncopies,
- struct value *elt);
+extern struct value *
+eval_op_rust_array (struct type *expect_type, struct expression *exp,
+ enum noside noside, enum exp_opcode opcode,
+ struct value *ncopies, struct value *elt);
extern struct value *rust_subscript (struct type *expect_type,
struct expression *exp,
enum noside noside, bool for_addr,
struct value *lhs, struct value *rhs);
extern struct value *rust_range (struct type *expect_type,
- struct expression *exp,
- enum noside noside, enum range_flag kind,
- struct value *low, struct value *high);
+ struct expression *exp, enum noside noside,
+ enum range_flag kind, struct value *low,
+ struct value *high);
namespace expr
{
-using rust_unop_compl_operation = unop_operation<UNOP_COMPLEMENT,
- eval_op_rust_complement>;
-using rust_array_operation = binop_operation<OP_RUST_ARRAY,
- eval_op_rust_array>;
+using rust_unop_compl_operation
+ = unop_operation<UNOP_COMPLEMENT, eval_op_rust_complement>;
+using rust_array_operation
+ = binop_operation<OP_RUST_ARRAY, eval_op_rust_array>;
/* The Rust indirection operation. */
-class rust_unop_ind_operation
- : public unop_ind_operation
+class rust_unop_ind_operation : public unop_ind_operation
{
public:
using unop_ind_operation::unop_ind_operation;
- value *evaluate (struct type *expect_type,
- struct expression *exp,
+ value *evaluate (struct type *expect_type, struct expression *exp,
enum noside noside) override;
};
@@ -71,8 +67,7 @@ public:
using tuple_holding_operation::tuple_holding_operation;
- value *evaluate (struct type *expect_type,
- struct expression *exp,
+ value *evaluate (struct type *expect_type, struct expression *exp,
enum noside noside) override
{
value *arg1 = std::get<0> (m_storage)->evaluate (nullptr, exp, noside);
@@ -80,8 +75,7 @@ public:
return rust_subscript (expect_type, exp, noside, false, arg1, arg2);
}
- value *slice (struct type *expect_type,
- struct expression *exp,
+ value *slice (struct type *expect_type, struct expression *exp,
enum noside noside)
{
value *arg1 = std::get<0> (m_storage)->evaluate (nullptr, exp, noside);
@@ -89,19 +83,16 @@ public:
return rust_subscript (expect_type, exp, noside, true, arg1, arg2);
}
- enum exp_opcode opcode () const override
- { return BINOP_SUBSCRIPT; }
+ enum exp_opcode opcode () const override { return BINOP_SUBSCRIPT; }
};
-class rust_unop_addr_operation
- : public tuple_holding_operation<operation_up>
+class rust_unop_addr_operation : public tuple_holding_operation<operation_up>
{
public:
using tuple_holding_operation::tuple_holding_operation;
- value *evaluate (struct type *expect_type,
- struct expression *exp,
+ value *evaluate (struct type *expect_type, struct expression *exp,
enum noside noside) override
{
operation *oper = std::get<0> (m_storage).get ();
@@ -112,8 +103,7 @@ public:
return oper->evaluate_for_address (exp, noside);
}
- enum exp_opcode opcode () const override
- { return UNOP_ADDR; }
+ enum exp_opcode opcode () const override { return UNOP_ADDR; }
};
/* The Rust range operators. */
@@ -124,8 +114,7 @@ public:
using tuple_holding_operation::tuple_holding_operation;
- value *evaluate (struct type *expect_type,
- struct expression *exp,
+ value *evaluate (struct type *expect_type, struct expression *exp,
enum noside noside) override
{
auto kind = std::get<0> (m_storage);
@@ -138,63 +127,53 @@ public:
return rust_range (expect_type, exp, noside, kind, low, high);
}
- enum exp_opcode opcode () const override
- { return OP_RANGE; }
+ enum exp_opcode opcode () const override { return OP_RANGE; }
};
/* Tuple field reference (using an integer). */
-class rust_struct_anon
- : public tuple_holding_operation<int, operation_up>
+class rust_struct_anon : public tuple_holding_operation<int, operation_up>
{
public:
using tuple_holding_operation::tuple_holding_operation;
- value *evaluate (struct type *expect_type,
- struct expression *exp,
+ value *evaluate (struct type *expect_type, struct expression *exp,
enum noside noside) override;
- enum exp_opcode opcode () const override
- { return STRUCTOP_ANONYMOUS; }
+ enum exp_opcode opcode () const override { return STRUCTOP_ANONYMOUS; }
};
/* Structure (or union or enum) field reference. */
-class rust_structop
- : public structop_base_operation
+class rust_structop : public structop_base_operation
{
public:
using structop_base_operation::structop_base_operation;
- value *evaluate (struct type *expect_type,
- struct expression *exp,
+ value *evaluate (struct type *expect_type, struct expression *exp,
enum noside noside) override;
- value *evaluate_funcall (struct type *expect_type,
- struct expression *exp,
+ value *evaluate_funcall (struct type *expect_type, struct expression *exp,
enum noside noside,
const std::vector<operation_up> &args) override;
- enum exp_opcode opcode () const override
- { return STRUCTOP_STRUCT; }
+ enum exp_opcode opcode () const override { return STRUCTOP_STRUCT; }
};
/* Rust aggregate initialization. */
class rust_aggregate_operation
- : public tuple_holding_operation<struct type *, operation_up,
- std::vector<std::pair<std::string,
- operation_up>>>
+ : public tuple_holding_operation<
+ struct type *, operation_up,
+ std::vector<std::pair<std::string, operation_up>>>
{
public:
using tuple_holding_operation::tuple_holding_operation;
- value *evaluate (struct type *expect_type,
- struct expression *exp,
+ value *evaluate (struct type *expect_type, struct expression *exp,
enum noside noside) override;
- enum exp_opcode opcode () const override
- { return OP_AGGREGATE; }
+ enum exp_opcode opcode () const override { return OP_AGGREGATE; }
};
/* Rust parenthesized operation. This is needed to distinguish
@@ -210,8 +189,7 @@ public:
{
}
- value *evaluate (struct type *expect_type,
- struct expression *exp,
+ value *evaluate (struct type *expect_type, struct expression *exp,
enum noside noside) override
{
return std::get<0> (m_storage)->evaluate (expect_type, exp, noside);
diff --git a/gdb/rust-lang.c b/gdb/rust-lang.c
index 6653f7a9c64..579828ed709 100644
--- a/gdb/rust-lang.c
+++ b/gdb/rust-lang.c
@@ -100,7 +100,7 @@ rust_enum_variant (struct type *type)
/* Perhaps we could get here by trying to print an Ada variant
record in Rust mode. Unlikely, but an error is safer than an
assert. */
- error (_("Could not find active enum variant"));
+ error (_ ("Could not find active enum variant"));
}
/* See rust-lang.h. */
@@ -111,8 +111,7 @@ rust_tuple_type_p (struct type *type)
/* The current implementation is a bit of a hack, but there's
nothing else in the debuginfo to distinguish a tuple from a
struct. */
- return (type->code () == TYPE_CODE_STRUCT
- && type->name () != NULL
+ return (type->code () == TYPE_CODE_STRUCT && type->name () != NULL
&& type->name ()[0] == '(');
}
@@ -159,8 +158,7 @@ rust_tuple_struct_type_p (struct type *type)
static bool
rust_slice_type_p (struct type *type)
{
- if (type->code () == TYPE_CODE_STRUCT
- && type->name () != NULL
+ if (type->code () == TYPE_CODE_STRUCT && type->name () != NULL
&& type->num_fields () == 2)
{
/* The order of fields doesn't matter. While it would be nice
@@ -181,10 +179,8 @@ rust_range_type_p (struct type *type)
{
int i;
- if (type->code () != TYPE_CODE_STRUCT
- || type->num_fields () > 2
- || type->name () == NULL
- || strstr (type->name (), "::Range") == NULL)
+ if (type->code () != TYPE_CODE_STRUCT || type->num_fields () > 2
+ || type->name () == NULL || strstr (type->name (), "::Range") == NULL)
return false;
if (type->num_fields () == 0)
@@ -222,8 +218,7 @@ rust_inclusive_range_type_p (struct type *type)
static bool
rust_u8_type_p (struct type *type)
{
- return (type->code () == TYPE_CODE_INT
- && type->is_unsigned ()
+ return (type->code () == TYPE_CODE_INT && type->is_unsigned ()
&& type->length () == 1);
}
@@ -232,8 +227,7 @@ rust_u8_type_p (struct type *type)
static bool
rust_chartype_p (struct type *type)
{
- return (type->code () == TYPE_CODE_CHAR
- && type->length () == 4
+ return (type->code () == TYPE_CODE_CHAR && type->length () == 4
&& type->is_unsigned ());
}
@@ -270,8 +264,6 @@ rust_get_trait_object_pointer (struct value *value)
return value_cast (pointer_type, value_field (value, 1 - vtable_field));
}
-
-
/* See language.h. */
void
@@ -292,9 +284,8 @@ rust_language::printstr (struct ui_file *stream, struct type *type,
{
/* This is probably some C string, so let's let C deal with
it. */
- language_defn::printstr (stream, type, string, length,
- user_encoding, force_ellipses,
- options);
+ language_defn::printstr (stream, type, string, length, user_encoding,
+ force_ellipses, options);
return;
}
}
@@ -304,20 +295,10 @@ rust_language::printstr (struct ui_file *stream, struct type *type,
'"', 0, options);
}
-
-
-static const struct generic_val_print_decorations rust_decorations =
-{
+static const struct generic_val_print_decorations rust_decorations = {
/* Complex isn't used in Rust, but we provide C-ish values just in
case. */
- "",
- " + ",
- " * I",
- "true",
- "false",
- "()",
- "[",
- "]"
+ "", " + ", " * I", "true", "false", "()", "[", "]"
};
/* Helper function to print a slice. */
@@ -326,8 +307,7 @@ static void
rust_val_print_slice (struct value *val, struct ui_file *stream, int recurse,
const struct value_print_options *options)
{
- struct value *base = value_struct_elt (&val, {}, "data_ptr", NULL,
- "slice");
+ struct value *base = value_struct_elt (&val, {}, "data_ptr", NULL, "slice");
struct value *len = value_struct_elt (&val, {}, "length", NULL, "slice");
struct type *type = check_typedef (value_type (val));
@@ -347,8 +327,8 @@ rust_val_print_slice (struct value *val, struct ui_file *stream, int recurse,
else
{
struct type *elt_type = value_type (base)->target_type ();
- struct type *array_type = lookup_array_range_type (elt_type, 0,
- llen - 1);
+ struct type *array_type
+ = lookup_array_range_type (elt_type, 0, llen - 1);
struct value *array = allocate_value_lazy (array_type);
VALUE_LVAL (array) = lval_memory;
set_value_address (array, value_as_address (base));
@@ -362,9 +342,9 @@ rust_val_print_slice (struct value *val, struct ui_file *stream, int recurse,
/* See rust-lang.h. */
void
-rust_language::val_print_struct
- (struct value *val, struct ui_file *stream, int recurse,
- const struct value_print_options *options) const
+rust_language::val_print_struct (
+ struct value *val, struct ui_file *stream, int recurse,
+ const struct value_print_options *options) const
{
int i;
int first_field;
@@ -421,8 +401,8 @@ rust_language::val_print_struct
if (!is_tuple && !is_tuple_struct)
{
- fputs_styled (type->field (i).name (),
- variable_name_style.style (), stream);
+ fputs_styled (type->field (i).name (), variable_name_style.style (),
+ stream);
gdb_puts (": ", stream);
}
@@ -455,16 +435,14 @@ rust_language::print_enum (struct value *val, struct ui_file *stream,
opts.deref_ref = false;
gdb_assert (rust_enum_p (type));
- gdb::array_view<const gdb_byte> view
- (value_contents_for_printing (val).data (),
- value_type (val)->length ());
+ gdb::array_view<const gdb_byte> view (
+ value_contents_for_printing (val).data (), value_type (val)->length ());
type = resolve_dynamic_type (type, view, value_address (val));
if (rust_empty_enum_p (type))
{
/* Print the enum type name here to be more clear. */
- gdb_printf (stream, _("%s {%p[<No data fields>%p]}"),
- type->name (),
+ gdb_printf (stream, _ ("%s {%p[<No data fields>%p]}"), type->name (),
metadata_style.style ().ptr (), nullptr);
return;
}
@@ -519,16 +497,16 @@ rust_language::print_enum (struct value *val, struct ui_file *stream,
/* See language.h. */
void
-rust_language::value_print_inner
- (struct value *val, struct ui_file *stream, int recurse,
- const struct value_print_options *options) const
+rust_language::value_print_inner (
+ struct value *val, struct ui_file *stream, int recurse,
+ const struct value_print_options *options) const
{
struct value_print_options opts = *options;
opts.deref_ref = true;
if (opts.prettyformat == Val_prettyformat_default)
- opts.prettyformat = (opts.prettyformat_structs
- ? Val_prettyformat : Val_no_prettyformat);
+ opts.prettyformat
+ = (opts.prettyformat_structs ? Val_prettyformat : Val_no_prettyformat);
struct type *type = check_typedef (value_type (val));
switch (type->code ())
@@ -536,7 +514,7 @@ rust_language::value_print_inner
case TYPE_CODE_PTR:
{
LONGEST low_bound, high_bound;
-
+
if (type->target_type ()->code () == TYPE_CODE_ARRAY
&& rust_u8_type_p (type->target_type ()->target_type ())
&& get_array_bounds (type->target_type (), &low_bound,
@@ -556,8 +534,7 @@ rust_language::value_print_inner
gdb_puts ("b", stream);
val_print_string (elttype->target_type (), "ASCII", addr,
- high_bound - low_bound + 1, stream,
- &opts);
+ high_bound - low_bound + 1, stream, &opts);
break;
}
}
@@ -565,8 +542,8 @@ rust_language::value_print_inner
case TYPE_CODE_INT:
/* Recognize the unit type. */
- if (type->is_unsigned () && type->length () == 0
- && type->name () != NULL && strcmp (type->name (), "()") == 0)
+ if (type->is_unsigned () && type->length () == 0 && type->name () != NULL
+ && strcmp (type->name (), "()") == 0)
{
gdb_puts ("()", stream);
break;
@@ -578,7 +555,7 @@ rust_language::value_print_inner
LONGEST low_bound, high_bound;
if (!get_array_bounds (type, &low_bound, &high_bound))
- error (_("Could not determine the array bounds"));
+ error (_ ("Could not determine the array bounds"));
/* If we see a plain TYPE_CODE_STRING, then we're printing a
byte string, hence the choice of "ASCII" as the
@@ -628,9 +605,8 @@ rust_language::value_print_inner
/* See language.h. */
void
-rust_language::value_print
- (struct value *val, struct ui_file *stream,
- const struct value_print_options *options) const
+rust_language::value_print (struct value *val, struct ui_file *stream,
+ const struct value_print_options *options) const
{
value_print_options opts = *options;
opts.deref_ref = true;
@@ -646,13 +622,12 @@ rust_language::value_print
return common_val_print (val, stream, 0, &opts, this);
}
-
-
-static void
-rust_internal_print_type (struct type *type, const char *varstring,
- struct ui_file *stream, int show, int level,
- const struct type_print_options *flags,
- bool for_rust_enum, print_offset_data *podata);
+static void rust_internal_print_type (struct type *type, const char *varstring,
+ struct ui_file *stream, int show,
+ int level,
+ const struct type_print_options *flags,
+ bool for_rust_enum,
+ print_offset_data *podata);
/* Print a struct or union typedef. */
static void
@@ -730,19 +705,16 @@ rust_print_struct_def (struct type *type, const char *varstring,
fields.push_back (i);
}
if (flags->print_offsets)
- std::sort (fields.begin (), fields.end (),
- [&] (int a, int b)
- {
- return (type->field (a).loc_bitpos ()
- < type->field (b).loc_bitpos ());
- });
+ std::sort (fields.begin (), fields.end (), [&] (int a, int b) {
+ return (type->field (a).loc_bitpos () < type->field (b).loc_bitpos ());
+ });
for (int i : fields)
{
QUIT;
gdb_assert (!field_is_static (&type->field (i)));
- gdb_assert (! (is_enum && TYPE_FIELD_ARTIFICIAL (type, i)));
+ gdb_assert (!(is_enum && TYPE_FIELD_ARTIFICIAL (type, i)));
if (flags->print_offsets)
podata->update (type, i, stream);
@@ -763,9 +735,9 @@ rust_print_struct_def (struct type *type, const char *varstring,
styled_string (variable_name_style.style (),
type->field (i).name ()));
- rust_internal_print_type (type->field (i).type (), NULL,
- stream, (is_enum ? show : show - 1),
- level + 2, flags, is_enum, podata);
+ rust_internal_print_type (type->field (i).type (), NULL, stream,
+ (is_enum ? show : show - 1), level + 2, flags,
+ is_enum, podata);
if (!for_rust_enum || flags->print_offsets)
gdb_puts (",\n", stream);
/* Note that this check of "I" is ok because we only sorted the
@@ -798,8 +770,7 @@ rust_internal_print_type (struct type *type, const char *varstring,
bool for_rust_enum, print_offset_data *podata)
{
QUIT;
- if (show <= 0
- && type->name () != NULL)
+ if (show <= 0 && type->name () != NULL)
{
/* Rust calls the unit type "void" in its debuginfo,
but we don't want to print it as that. */
@@ -835,16 +806,16 @@ rust_internal_print_type (struct type *type, const char *varstring,
QUIT;
if (i > 0)
gdb_puts (", ", stream);
- rust_internal_print_type (type->field (i).type (), "", stream,
- -1, 0, flags, false, podata);
+ rust_internal_print_type (type->field (i).type (), "", stream, -1, 0,
+ flags, false, podata);
}
gdb_puts (")", stream);
/* If it returns unit, we can omit the return type. */
if (type->target_type ()->code () != TYPE_CODE_VOID)
{
gdb_puts (" -> ", stream);
- rust_internal_print_type (type->target_type (), "", stream,
- -1, 0, flags, false, podata);
+ rust_internal_print_type (type->target_type (), "", stream, -1, 0,
+ flags, false, podata);
}
break;
@@ -853,16 +824,14 @@ rust_internal_print_type (struct type *type, const char *varstring,
LONGEST low_bound, high_bound;
gdb_puts ("[", stream);
- rust_internal_print_type (type->target_type (), NULL,
- stream, show - 1, level, flags, false,
- podata);
+ rust_internal_print_type (type->target_type (), NULL, stream, show - 1,
+ level, flags, false, podata);
if (type->bounds ()->high.kind () == PROP_LOCEXPR
|| type->bounds ()->high.kind () == PROP_LOCLIST)
gdb_printf (stream, "; variable length");
else if (get_array_bounds (type, &low_bound, &high_bound))
- gdb_printf (stream, "; %s",
- plongest (high_bound - low_bound + 1));
+ gdb_printf (stream, "; %s", plongest (high_bound - low_bound + 1));
gdb_puts ("]", stream);
}
break;
@@ -892,15 +861,11 @@ rust_internal_print_type (struct type *type, const char *varstring,
QUIT;
- if (len > 0
- && strncmp (name, type->name (), len) == 0
- && name[len] == ':'
- && name[len + 1] == ':')
+ if (len > 0 && strncmp (name, type->name (), len) == 0
+ && name[len] == ':' && name[len + 1] == ':')
name += len + 2;
- gdb_printf (stream, "%*s%ps,\n",
- level + 2, "",
- styled_string (variable_name_style.style (),
- name));
+ gdb_printf (stream, "%*s%ps,\n", level + 2, "",
+ styled_string (variable_name_style.style (), name));
}
gdb_puts ("}", stream);
@@ -928,14 +893,11 @@ rust_internal_print_type (struct type *type, const char *varstring,
}
}
-
-
/* Like arch_composite_type, but uses TYPE to decide how to allocate
-- either on an obstack or on a gdbarch. */
static struct type *
-rust_composite_type (struct type *original,
- const char *name,
+rust_composite_type (struct type *original, const char *name,
const char *field1, struct type *type1,
const char *field2, struct type *type2)
{
@@ -952,8 +914,8 @@ rust_composite_type (struct type *original,
result->set_name (name);
result->set_num_fields (nfields);
- result->set_fields
- ((struct field *) TYPE_ZALLOC (result, nfields * sizeof (struct field)));
+ result->set_fields ((struct field *)
+ TYPE_ZALLOC (result, nfields * sizeof (struct field)));
i = 0;
bitpos = 0;
@@ -1004,21 +966,18 @@ rust_slice_type (const char *name, struct type *elt_type,
struct type *type;
elt_type = lookup_pointer_type (elt_type);
- type = rust_composite_type (elt_type, name,
- "data_ptr", elt_type,
- "length", usize_type);
+ type = rust_composite_type (elt_type, name, "data_ptr", elt_type, "length",
+ usize_type);
return type;
}
-
-
/* A helper for rust_evaluate_subexp that handles OP_RANGE. */
struct value *
rust_range (struct type *expect_type, struct expression *exp,
- enum noside noside, enum range_flag kind,
- struct value *low, struct value *high)
+ enum noside noside, enum range_flag kind, struct value *low,
+ struct value *high)
{
struct value *addrval, *result;
CORE_ADDR addr;
@@ -1039,8 +998,8 @@ rust_range (struct type *expect_type, struct expression *exp,
else
{
index_type = value_type (high);
- name = (inclusive
- ? "std::ops::RangeToInclusive" : "std::ops::RangeTo");
+ name
+ = (inclusive ? "std::ops::RangeToInclusive" : "std::ops::RangeTo");
}
}
else
@@ -1053,7 +1012,7 @@ rust_range (struct type *expect_type, struct expression *exp,
else
{
if (!types_equal (value_type (low), value_type (high)))
- error (_("Range expression with different types"));
+ error (_ ("Range expression with different types"));
index_type = value_type (low);
name = inclusive ? "std::ops::RangeInclusive" : "std::ops::Range";
}
@@ -1062,8 +1021,8 @@ rust_range (struct type *expect_type, struct expression *exp,
/* If we don't have an index type, just allocate this on the
arch. Here any type will do. */
temp_type = (index_type == NULL
- ? language_bool_type (exp->language_defn, exp->gdbarch)
- : index_type);
+ ? language_bool_type (exp->language_defn, exp->gdbarch)
+ : index_type);
/* It would be nicer to cache the range type. */
range_type = rust_composite_type (temp_type, name,
low == NULL ? NULL : "start", index_type,
@@ -1078,16 +1037,15 @@ rust_range (struct type *expect_type, struct expression *exp,
if (low != NULL)
{
- struct value *start = value_struct_elt (&result, {}, "start", NULL,
- "range");
+ struct value *start
+ = value_struct_elt (&result, {}, "start", NULL, "range");
value_assign (start, low);
}
if (high != NULL)
{
- struct value *end = value_struct_elt (&result, {}, "end", NULL,
- "range");
+ struct value *end = value_struct_elt (&result, {}, "end", NULL, "range");
value_assign (end, high);
}
@@ -1105,9 +1063,8 @@ rust_range (struct type *expect_type, struct expression *exp,
determine whether LOW or HIGH are valid. */
static void
-rust_compute_range (struct type *type, struct value *range,
- LONGEST *low, LONGEST *high,
- range_flags *kind)
+rust_compute_range (struct type *type, struct value *range, LONGEST *low,
+ LONGEST *high, range_flags *kind)
{
int i;
@@ -1125,11 +1082,11 @@ rust_compute_range (struct type *type, struct value *range,
*low = value_as_long (value_field (range, 0));
++i;
}
- if (type->num_fields () > i
- && strcmp (type->field (i).name (), "end") == 0)
+ if (type->num_fields () > i && strcmp (type->field (i).name (), "end") == 0)
{
*kind = (*kind == (RANGE_LOW_BOUND_DEFAULT | RANGE_HIGH_BOUND_DEFAULT)
- ? RANGE_LOW_BOUND_DEFAULT : RANGE_STANDARD);
+ ? RANGE_LOW_BOUND_DEFAULT
+ : RANGE_STANDARD);
*high = value_as_long (value_field (range, i));
if (rust_inclusive_range_type_p (type))
@@ -1141,8 +1098,8 @@ rust_compute_range (struct type *type, struct value *range,
struct value *
rust_subscript (struct type *expect_type, struct expression *exp,
- enum noside noside, bool for_addr,
- struct value *lhs, struct value *rhs)
+ enum noside noside, bool for_addr, struct value *lhs,
+ struct value *rhs)
{
struct value *result;
struct type *rhstype;
@@ -1156,7 +1113,7 @@ rust_subscript (struct type *expect_type, struct expression *exp,
if (rust_range_type_p (rhstype))
{
if (!for_addr)
- error (_("Can't take slice of array without '&'"));
+ error (_ ("Can't take slice of array without '&'"));
rust_compute_range (rhstype, rhs, &low, &high, &kind);
want_slice = 1;
}
@@ -1180,12 +1137,12 @@ rust_subscript (struct type *expect_type, struct expression *exp,
}
}
if (base_type == nullptr)
- error (_("Could not find 'data_ptr' in slice type"));
+ error (_ ("Could not find 'data_ptr' in slice type"));
}
else if (type->code () == TYPE_CODE_PTR)
base_type = type->target_type ();
else
- error (_("Cannot subscript non-array type"));
+ error (_ ("Cannot subscript non-array type"));
struct type *new_type;
if (want_slice)
@@ -1196,8 +1153,7 @@ rust_subscript (struct type *expect_type, struct expression *exp,
{
struct type *usize
= language_lookup_primitive_type (exp->language_defn,
- exp->gdbarch,
- "usize");
+ exp->gdbarch, "usize");
new_type = rust_slice_type ("&[*gdb*]", base_type, usize);
}
}
@@ -1215,9 +1171,9 @@ rust_subscript (struct type *expect_type, struct expression *exp,
{
base = lhs;
if (!get_array_bounds (type, &low_bound, &high_bound))
- error (_("Can't compute array bounds"));
+ error (_ ("Can't compute array bounds"));
if (low_bound != 0)
- error (_("Found array with non-zero lower bound"));
+ error (_ ("Found array with non-zero lower bound"));
++high_bound;
}
else if (rust_slice_type_p (type))
@@ -1236,14 +1192,14 @@ rust_subscript (struct type *expect_type, struct expression *exp,
high_bound = LONGEST_MAX;
}
else
- error (_("Cannot subscript non-array type"));
+ error (_ ("Cannot subscript non-array type"));
if (want_slice && (kind & RANGE_LOW_BOUND_DEFAULT))
low = low_bound;
if (low < 0)
- error (_("Index less than zero"));
+ error (_ ("Index less than zero"));
if (low > high_bound)
- error (_("Index greater than length"));
+ error (_ ("Index greater than length"));
result = value_subscript (base, low);
}
@@ -1259,18 +1215,17 @@ rust_subscript (struct type *expect_type, struct expression *exp,
if (kind & RANGE_HIGH_BOUND_DEFAULT)
high = high_bound;
if (high < 0)
- error (_("High index less than zero"));
+ error (_ ("High index less than zero"));
if (low > high)
- error (_("Low index greater than high index"));
+ error (_ ("Low index greater than high index"));
if (high > high_bound)
- error (_("High index greater than length"));
+ error (_ ("High index greater than length"));
usize = language_lookup_primitive_type (exp->language_defn,
- exp->gdbarch,
- "usize");
- const char *new_name = ((type != nullptr
- && rust_slice_type_p (type))
- ? type->name () : "&[*gdb*]");
+ exp->gdbarch, "usize");
+ const char *new_name
+ = ((type != nullptr && rust_slice_type_p (type)) ? type->name ()
+ : "&[*gdb*]");
slice = rust_slice_type (new_name, value_type (result), usize);
@@ -1296,14 +1251,13 @@ namespace expr
struct value *
rust_unop_ind_operation::evaluate (struct type *expect_type,
- struct expression *exp,
- enum noside noside)
+ struct expression *exp, enum noside noside)
{
if (noside != EVAL_NORMAL)
return unop_ind_operation::evaluate (expect_type, exp, noside);
- struct value *value = std::get<0> (m_storage)->evaluate (nullptr, exp,
- noside);
+ struct value *value
+ = std::get<0> (m_storage)->evaluate (nullptr, exp, noside);
struct value *trait_ptr = rust_get_trait_object_pointer (value);
if (trait_ptr != NULL)
value = trait_ptr;
@@ -1317,8 +1271,7 @@ rust_unop_ind_operation::evaluate (struct type *expect_type,
struct value *
eval_op_rust_complement (struct type *expect_type, struct expression *exp,
- enum noside noside,
- enum exp_opcode opcode,
+ enum noside noside, enum exp_opcode opcode,
struct value *value)
{
if (value_type (value)->code () == TYPE_CODE_BOOL)
@@ -1330,13 +1283,12 @@ eval_op_rust_complement (struct type *expect_type, struct expression *exp,
struct value *
eval_op_rust_array (struct type *expect_type, struct expression *exp,
- enum noside noside,
- enum exp_opcode opcode,
+ enum noside noside, enum exp_opcode opcode,
struct value *elt, struct value *ncopies)
{
int copies = value_as_long (ncopies);
if (copies < 0)
- error (_("Array with negative number of elements"));
+ error (_ ("Array with negative number of elements"));
if (noside == EVAL_NORMAL)
{
@@ -1359,8 +1311,7 @@ namespace expr
{
struct value *
-rust_struct_anon::evaluate (struct type *expect_type,
- struct expression *exp,
+rust_struct_anon::evaluate (struct type *expect_type, struct expression *exp,
enum noside noside)
{
value *lhs = std::get<1> (m_storage)->evaluate (nullptr, exp, noside);
@@ -1378,8 +1329,8 @@ rust_struct_anon::evaluate (struct type *expect_type,
value_address (lhs));
if (rust_empty_enum_p (type))
- error (_("Cannot access field %d of empty enum %s"),
- field_number, type->name ());
+ error (_ ("Cannot access field %d of empty enum %s"), field_number,
+ type->name ());
int fieldno = rust_enum_variant (type);
lhs = value_primitive_field (lhs, 0, fieldno, type);
@@ -1393,41 +1344,39 @@ rust_struct_anon::evaluate (struct type *expect_type,
if (field_number >= nfields || field_number < 0)
{
if (outer_type != NULL)
- error(_("Cannot access field %d of variant %s::%s, "
- "there are only %d fields"),
- field_number, outer_type->name (),
- rust_last_path_segment (type->name ()),
- nfields);
+ error (_ ("Cannot access field %d of variant %s::%s, "
+ "there are only %d fields"),
+ field_number, outer_type->name (),
+ rust_last_path_segment (type->name ()), nfields);
else
- error(_("Cannot access field %d of %s, "
- "there are only %d fields"),
- field_number, type->name (), nfields);
+ error (_ ("Cannot access field %d of %s, "
+ "there are only %d fields"),
+ field_number, type->name (), nfields);
}
/* Tuples are tuple structs too. */
if (!rust_tuple_struct_type_p (type))
{
if (outer_type != NULL)
- error(_("Variant %s::%s is not a tuple variant"),
- outer_type->name (),
- rust_last_path_segment (type->name ()));
+ error (_ ("Variant %s::%s is not a tuple variant"),
+ outer_type->name (),
+ rust_last_path_segment (type->name ()));
else
- error(_("Attempting to access anonymous field %d "
- "of %s, which is not a tuple, tuple struct, or "
- "tuple-like variant"),
- field_number, type->name ());
+ error (_ ("Attempting to access anonymous field %d "
+ "of %s, which is not a tuple, tuple struct, or "
+ "tuple-like variant"),
+ field_number, type->name ());
}
return value_primitive_field (lhs, 0, field_number, type);
}
else
- error(_("Anonymous field access is only allowed on tuples, \
+ error (_ ("Anonymous field access is only allowed on tuples, \
tuple structs, and tuple-like enum variants"));
}
struct value *
-rust_structop::evaluate (struct type *expect_type,
- struct expression *exp,
+rust_structop::evaluate (struct type *expect_type, struct expression *exp,
enum noside noside)
{
value *lhs = std::get<0> (m_storage)->evaluate (nullptr, exp, noside);
@@ -1441,8 +1390,8 @@ rust_structop::evaluate (struct type *expect_type,
value_address (lhs));
if (rust_empty_enum_p (type))
- error (_("Cannot access field %s of empty enum %s"),
- field_name, type->name ());
+ error (_ ("Cannot access field %s of empty enum %s"), field_name,
+ type->name ());
int fieldno = rust_enum_variant (type);
lhs = value_primitive_field (lhs, 0, fieldno, type);
@@ -1450,19 +1399,18 @@ rust_structop::evaluate (struct type *expect_type,
struct type *outer_type = type;
type = value_type (lhs);
if (rust_tuple_type_p (type) || rust_tuple_struct_type_p (type))
- error (_("Attempting to access named field %s of tuple "
- "variant %s::%s, which has only anonymous fields"),
+ error (_ ("Attempting to access named field %s of tuple "
+ "variant %s::%s, which has only anonymous fields"),
field_name, outer_type->name (),
rust_last_path_segment (type->name ()));
try
{
- result = value_struct_elt (&lhs, {}, field_name,
- NULL, "structure");
+ result = value_struct_elt (&lhs, {}, field_name, NULL, "structure");
}
catch (const gdb_exception_error &except)
{
- error (_("Could not find field %s of struct variant %s::%s"),
+ error (_ ("Could not find field %s of struct variant %s::%s"),
field_name, outer_type->name (),
rust_last_path_segment (type->name ()));
}
@@ -1476,8 +1424,7 @@ rust_structop::evaluate (struct type *expect_type,
value *
rust_aggregate_operation::evaluate (struct type *expect_type,
- struct expression *exp,
- enum noside noside)
+ struct expression *exp, enum noside noside)
{
struct type *type = std::get<0> (m_storage);
CORE_ADDR addr = 0;
@@ -1493,8 +1440,8 @@ rust_aggregate_operation::evaluate (struct type *expect_type,
if (std::get<1> (m_storage) != nullptr)
{
- struct value *init = std::get<1> (m_storage)->evaluate (nullptr, exp,
- noside);
+ struct value *init
+ = std::get<1> (m_storage)->evaluate (nullptr, exp, noside);
if (noside == EVAL_NORMAL)
{
@@ -1511,8 +1458,8 @@ rust_aggregate_operation::evaluate (struct type *expect_type,
if (noside == EVAL_NORMAL)
{
const char *fieldname = item.first.c_str ();
- value *field = value_struct_elt (&result, {}, fieldname,
- nullptr, "structure");
+ value *field
+ = value_struct_elt (&result, {}, fieldname, nullptr, "structure");
value_assign (field, val);
}
}
@@ -1527,8 +1474,7 @@ rust_aggregate_operation::evaluate (struct type *expect_type,
value *
rust_structop::evaluate_funcall (struct type *expect_type,
- struct expression *exp,
- enum noside noside,
+ struct expression *exp, enum noside noside,
const std::vector<operation_up> &ops)
{
std::vector<struct value *> args (ops.size () + 1);
@@ -1541,26 +1487,25 @@ rust_structop::evaluate_funcall (struct type *expect_type,
args[0] = value_ind (args[0]);
struct type *type = value_type (args[0]);
- if ((type->code () != TYPE_CODE_STRUCT
- && type->code () != TYPE_CODE_UNION
+ if ((type->code () != TYPE_CODE_STRUCT && type->code () != TYPE_CODE_UNION
&& type->code () != TYPE_CODE_ENUM)
|| rust_tuple_type_p (type))
- error (_("Method calls only supported on struct or enum types"));
+ error (_ ("Method calls only supported on struct or enum types"));
if (type->name () == NULL)
- error (_("Method call on nameless type"));
+ error (_ ("Method call on nameless type"));
- std::string name = (std::string (type->name ()) + "::"
- + std::get<1> (m_storage));
+ std::string name
+ = (std::string (type->name ()) + "::" + std::get<1> (m_storage));
const struct block *block = get_selected_block (0);
- struct block_symbol sym = lookup_symbol (name.c_str (), block,
- VAR_DOMAIN, NULL);
+ struct block_symbol sym
+ = lookup_symbol (name.c_str (), block, VAR_DOMAIN, NULL);
if (sym.symbol == NULL)
- error (_("Could not find function named '%s'"), name.c_str ());
+ error (_ ("Could not find function named '%s'"), name.c_str ());
struct type *fn_type = sym.symbol->type ();
if (fn_type->num_fields () == 0)
- error (_("Function '%s' takes no arguments"), name.c_str ());
+ error (_ ("Function '%s' takes no arguments"), name.c_str ());
if (fn_type->field (0).type ()->code () == TYPE_CODE_PTR)
args[0] = value_addr (args[0]);
@@ -1575,9 +1520,7 @@ rust_structop::evaluate_funcall (struct type *expect_type,
return call_function_by_hand (function, NULL, args);
}
-}
-
-
+} // namespace expr
/* See language.h. */
@@ -1588,18 +1531,16 @@ rust_language::language_arch_info (struct gdbarch *gdbarch,
const struct builtin_type *builtin = builtin_type (gdbarch);
/* Helper function to allow shorter lines below. */
- auto add = [&] (struct type * t) -> struct type *
+ auto add = [&](struct type * t) -> struct type *
{
lai->add_primitive_type (t);
return t;
};
- struct type *bool_type
- = add (arch_boolean_type (gdbarch, 8, 1, "bool"));
+ struct type *bool_type = add (arch_boolean_type (gdbarch, 8, 1, "bool"));
add (arch_character_type (gdbarch, 32, 1, "char"));
add (arch_integer_type (gdbarch, 8, 0, "i8"));
- struct type *u8_type
- = add (arch_integer_type (gdbarch, 8, 1, "u8"));
+ struct type *u8_type = add (arch_integer_type (gdbarch, 8, 1, "u8"));
add (arch_integer_type (gdbarch, 16, 0, "i16"));
add (arch_integer_type (gdbarch, 16, 1, "u16"));
add (arch_integer_type (gdbarch, 32, 0, "i32"));
@@ -1631,15 +1572,15 @@ rust_language::print_type (struct type *type, const char *varstring,
const struct type_print_options *flags) const
{
print_offset_data podata (flags);
- rust_internal_print_type (type, varstring, stream, show, level,
- flags, false, &podata);
+ rust_internal_print_type (type, varstring, stream, show, level, flags, false,
+ &podata);
}
/* See language.h. */
void
-rust_language::emitchar (int ch, struct type *chtype,
- struct ui_file *stream, int quoter) const
+rust_language::emitchar (int ch, struct type *chtype, struct ui_file *stream,
+ int quoter) const
{
if (!rust_chartype_p (chtype))
generic_emit_char (ch, chtype, stream, quoter,
@@ -1676,8 +1617,7 @@ rust_language::is_string_type_p (struct type *type) const
&& rust_u8_type_p (type->target_type ()->target_type ())
&& get_array_bounds (type->target_type (), &low_bound,
&high_bound)))
- || (type->code () == TYPE_CODE_STRUCT
- && !rust_enum_p (type)
+ || (type->code () == TYPE_CODE_STRUCT && !rust_enum_p (type)
&& rust_slice_type_p (type)
&& strcmp (type->name (), "&str") == 0));
}
diff --git a/gdb/rust-lang.h b/gdb/rust-lang.h
index 89e03550fb7..3350cc55a8d 100644
--- a/gdb/rust-lang.h
+++ b/gdb/rust-lang.h
@@ -55,24 +55,23 @@ extern struct type *rust_slice_type (const char *name, struct type *elt_type,
class rust_language : public language_defn
{
public:
+
rust_language ()
: language_defn (language_rust)
- { /* Nothing. */ }
+ { /* Nothing. */
+ }
/* See language.h. */
- const char *name () const override
- { return "rust"; }
+ const char *name () const override { return "rust"; }
/* See language.h. */
- const char *natural_name () const override
- { return "Rust"; }
+ const char *natural_name () const override { return "Rust"; }
/* See language.h. */
- const char *get_digit_separator () const override
- { return "_"; }
+ const char *get_digit_separator () const override { return "_"; }
/* See language.h. */
@@ -89,9 +88,9 @@ public:
/* See language.h. */
- bool sniff_from_mangled_name
- (const char *mangled, gdb::unique_xmalloc_ptr<char> *demangled)
- const override
+ bool sniff_from_mangled_name (
+ const char *mangled,
+ gdb::unique_xmalloc_ptr<char> *demangled) const override
{
*demangled = gdb_demangle (mangled, DMGL_PARAMS | DMGL_ANSI);
return *demangled != NULL;
@@ -107,10 +106,7 @@ public:
/* See language.h. */
- bool can_print_type_offsets () const override
- {
- return true;
- }
+ bool can_print_type_offsets () const override { return true; }
/* See language.h. */
@@ -120,8 +116,8 @@ public:
/* See language.h. */
- gdb::unique_xmalloc_ptr<char> watch_location_expression
- (struct type *type, CORE_ADDR addr) const override
+ gdb::unique_xmalloc_ptr<char>
+ watch_location_expression (struct type *type, CORE_ADDR addr) const override
{
type = check_typedef (check_typedef (type)->target_type ());
std::string name = type_to_string (type);
@@ -131,9 +127,9 @@ public:
/* See language.h. */
- void value_print_inner
- (struct value *val, struct ui_file *stream, int recurse,
- const struct value_print_options *options) const override;
+ void
+ value_print_inner (struct value *val, struct ui_file *stream, int recurse,
+ const struct value_print_options *options) const override;
/* See language.h. */
@@ -142,16 +138,16 @@ public:
/* See language.h. */
- struct block_symbol lookup_symbol_nonlocal
- (const char *name, const struct block *block,
- const domain_enum domain) const override
+ struct block_symbol
+ lookup_symbol_nonlocal (const char *name, const struct block *block,
+ const domain_enum domain) const override
{
struct block_symbol result = {};
- symbol_lookup_debug_printf
- ("rust_lookup_symbol_non_local (%s, %s (scope %s), %s)",
- name, host_address_to_string (block), block_scope (block),
- domain_name (domain));
+ symbol_lookup_debug_printf (
+ "rust_lookup_symbol_non_local (%s, %s (scope %s), %s)", name,
+ host_address_to_string (block), block_scope (block),
+ domain_name (domain));
/* Look up bare names in the block's scope. */
std::string scopedname;
@@ -183,8 +179,8 @@ public:
/* See language.h. */
- void emitchar (int ch, struct type *chtype,
- struct ui_file *stream, int quoter) const override;
+ void emitchar (int ch, struct type *chtype, struct ui_file *stream,
+ int quoter) const override;
/* See language.h. */
@@ -220,8 +216,7 @@ public:
/* See language.h. */
- bool range_checking_on_by_default () const override
- { return true; }
+ bool range_checking_on_by_default () const override { return true; }
private:
diff --git a/gdb/rust-parse.c b/gdb/rust-parse.c
index 489be4b87e3..680405cea63 100644
--- a/gdb/rust-parse.c
+++ b/gdb/rust-parse.c
@@ -49,7 +49,7 @@ static const char number_regex_text[] =
"[0-9][0-9_]*\\.[0-9][0-9_]*([eE][-+]?[0-9][0-9_]*)?(f32|f64)?"
#define FLOAT_TYPE1 3
"|"
- /* Recognize exponent without decimal point, with optional type
+/* Recognize exponent without decimal point, with optional type
suffix.
subexpression 4: if present, type suffix
*/
@@ -61,7 +61,7 @@ static const char number_regex_text[] =
separately. */
"[0-9][0-9_]*\\."
"|"
- /* Finally come integers.
+/* Finally come integers.
subexpression 5: text of integer
subexpression 6: if present, type suffix
subexpression 7: allows use of alternation, otherwise uninteresting
@@ -149,8 +149,7 @@ struct token_info
/* Identifier tokens. */
-static const struct token_info identifier_tokens[] =
-{
+static const struct token_info identifier_tokens[] = {
{ "as", KW_AS, OP_NULL },
{ "false", KW_FALSE, OP_NULL },
{ "if", 0, OP_NULL },
@@ -166,33 +165,31 @@ static const struct token_info identifier_tokens[] =
/* Operator tokens, sorted longest first. */
-static const struct token_info operator_tokens[] =
-{
- { ">>=", COMPOUND_ASSIGN, BINOP_RSH },
- { "<<=", COMPOUND_ASSIGN, BINOP_LSH },
-
- { "<<", LSH, OP_NULL },
- { ">>", RSH, OP_NULL },
- { "&&", ANDAND, OP_NULL },
- { "||", OROR, OP_NULL },
- { "==", EQEQ, OP_NULL },
- { "!=", NOTEQ, OP_NULL },
- { "<=", LTEQ, OP_NULL },
- { ">=", GTEQ, OP_NULL },
- { "+=", COMPOUND_ASSIGN, BINOP_ADD },
- { "-=", COMPOUND_ASSIGN, BINOP_SUB },
- { "*=", COMPOUND_ASSIGN, BINOP_MUL },
- { "/=", COMPOUND_ASSIGN, BINOP_DIV },
- { "%=", COMPOUND_ASSIGN, BINOP_REM },
- { "&=", COMPOUND_ASSIGN, BINOP_BITWISE_AND },
- { "|=", COMPOUND_ASSIGN, BINOP_BITWISE_IOR },
- { "^=", COMPOUND_ASSIGN, BINOP_BITWISE_XOR },
- { "..=", DOTDOTEQ, OP_NULL },
-
- { "::", COLONCOLON, OP_NULL },
- { "..", DOTDOT, OP_NULL },
- { "->", ARROW, OP_NULL }
-};
+static const struct token_info operator_tokens[]
+ = { { ">>=", COMPOUND_ASSIGN, BINOP_RSH },
+ { "<<=", COMPOUND_ASSIGN, BINOP_LSH },
+
+ { "<<", LSH, OP_NULL },
+ { ">>", RSH, OP_NULL },
+ { "&&", ANDAND, OP_NULL },
+ { "||", OROR, OP_NULL },
+ { "==", EQEQ, OP_NULL },
+ { "!=", NOTEQ, OP_NULL },
+ { "<=", LTEQ, OP_NULL },
+ { ">=", GTEQ, OP_NULL },
+ { "+=", COMPOUND_ASSIGN, BINOP_ADD },
+ { "-=", COMPOUND_ASSIGN, BINOP_SUB },
+ { "*=", COMPOUND_ASSIGN, BINOP_MUL },
+ { "/=", COMPOUND_ASSIGN, BINOP_DIV },
+ { "%=", COMPOUND_ASSIGN, BINOP_REM },
+ { "&=", COMPOUND_ASSIGN, BINOP_BITWISE_AND },
+ { "|=", COMPOUND_ASSIGN, BINOP_BITWISE_IOR },
+ { "^=", COMPOUND_ASSIGN, BINOP_BITWISE_XOR },
+ { "..=", DOTDOTEQ, OP_NULL },
+
+ { "::", COLONCOLON, OP_NULL },
+ { "..", DOTDOT, OP_NULL },
+ { "->", ARROW, OP_NULL } };
/* An instance of this is created before parsing, and destroyed when
parsing is finished. */
@@ -207,16 +204,10 @@ struct rust_parser
DISABLE_COPY_AND_ASSIGN (rust_parser);
/* Return the parser's language. */
- const struct language_defn *language () const
- {
- return pstate->language ();
- }
+ const struct language_defn *language () const { return pstate->language (); }
/* Return the parser's gdbarch. */
- struct gdbarch *arch () const
- {
- return pstate->gdbarch ();
- }
+ struct gdbarch *arch () const { return pstate->gdbarch (); }
/* A helper to look up a Rust type, or fail. This only works for
types defined by rust_language_arch_info. */
@@ -227,7 +218,7 @@ struct rust_parser
type = language_lookup_primitive_type (language (), arch (), name);
if (type == NULL)
- error (_("Could not find Rust type %s"), name);
+ error (_ ("Could not find Rust type %s"), name);
return type;
}
@@ -246,10 +237,7 @@ struct rust_parser
/* The main interface to lexing. Lexes one token and updates the
internal state. */
- void lex ()
- {
- current_token = lex_one_token ();
- }
+ void lex () { current_token = lex_one_token (); }
/* Assuming the current token is TYPE, lex the next token. */
void assume (int type)
@@ -263,7 +251,7 @@ struct rust_parser
void require (char type)
{
if (current_token != type)
- error (_("'%c' expected"), type);
+ error (_ ("'%c' expected"), type);
lex ();
}
@@ -273,7 +261,7 @@ struct rust_parser
lex ();
operation_up result = parse_expr ();
if (current_token != 0)
- error (_("Syntax error near '%s'"), pstate->prev_lexptr);
+ error (_ ("Syntax error near '%s'"), pstate->prev_lexptr);
return result;
}
@@ -345,7 +333,10 @@ struct rust_parser
/* The current token's payload, if any. */
typed_val_int current_int_val {};
typed_val_float current_float_val {};
- struct stoken current_string_val {};
+
+ struct stoken current_string_val
+ {
+ };
enum exp_opcode current_opcode = OP_NULL;
/* When completing, this may be set to the field operation to
@@ -362,7 +353,7 @@ rust_parser::crate_name (const std::string &name)
std::string crate = rust_crate_for_block (pstate->expression_context_block);
if (crate.empty ())
- error (_("Could not find crate for current location"));
+ error (_ ("Could not find crate for current location"));
return "::" + crate + "::" + name;
}
@@ -377,7 +368,7 @@ rust_parser::super_name (const std::string &ident, unsigned int n_supers)
int offset;
if (scope[0] == '\0')
- error (_("Couldn't find namespace scope for self::"));
+ error (_ ("Couldn't find namespace scope for self::"));
if (n_supers > 0)
{
@@ -392,13 +383,12 @@ rust_parser::super_name (const std::string &ident, unsigned int n_supers)
gdb_assert (scope[current_len] == ':');
/* The "::". */
current_len += 2;
- current_len += cp_find_first_component (scope
- + current_len);
+ current_len += cp_find_first_component (scope + current_len);
}
len = offsets.size ();
if (n_supers >= len)
- error (_("Too many super:: uses from '%s'"), scope);
+ error (_ ("Too many super:: uses from '%s'"), scope);
offset = offsets[len - n_supers];
}
@@ -503,11 +493,11 @@ rust_parser::lex_hex (int min, int max)
}
if (len < min)
- error (_("Not enough hex digits seen"));
+ error (_ ("Not enough hex digits seen"));
if (len > max)
{
gdb_assert (min != max);
- error (_("Overlong hex escape"));
+ error (_ ("Overlong hex escape"));
}
return result;
@@ -532,15 +522,15 @@ rust_parser::lex_escape (int is_byte)
case 'u':
if (is_byte)
- error (_("Unicode escape in byte literal"));
+ error (_ ("Unicode escape in byte literal"));
++pstate->lexptr;
if (pstate->lexptr[0] != '{')
- error (_("Missing '{' in Unicode escape"));
+ error (_ ("Missing '{' in Unicode escape"));
++pstate->lexptr;
result = lex_hex (1, 6);
/* Could do range checks here. */
if (pstate->lexptr[0] != '}')
- error (_("Missing '}' in Unicode escape"));
+ error (_ ("Missing '}' in Unicode escape"));
++pstate->lexptr;
break;
@@ -574,7 +564,7 @@ rust_parser::lex_escape (int is_byte)
break;
default:
- error (_("Invalid escape \\%c in literal"), pstate->lexptr[0]);
+ error (_ ("Invalid escape \\%c in literal"), pstate->lexptr[0]);
}
return result;
@@ -599,12 +589,12 @@ lex_multibyte_char (const char *text, int *len)
auto_obstack result;
convert_between_encodings (host_charset (), HOST_UTF32,
- (const gdb_byte *) text,
- quote, 1, &result, translit_none);
+ (const gdb_byte *) text, quote, 1, &result,
+ translit_none);
int size = obstack_object_size (&result);
if (size > 4)
- error (_("overlong character literal"));
+ error (_ ("overlong character literal"));
uint32_t value;
memcpy (&value, obstack_finish (&result), size);
return value;
@@ -626,7 +616,7 @@ rust_parser::lex_character ()
gdb_assert (pstate->lexptr[0] == '\'');
++pstate->lexptr;
if (pstate->lexptr[0] == '\'')
- error (_("empty character literal"));
+ error (_ ("empty character literal"));
else if (pstate->lexptr[0] == '\\')
value = lex_escape (is_byte);
else
@@ -637,7 +627,7 @@ rust_parser::lex_character ()
}
if (pstate->lexptr[0] != '\'')
- error (_("Unterminated character literal"));
+ error (_ ("Unterminated character literal"));
++pstate->lexptr;
current_int_val.val = value;
@@ -700,19 +690,19 @@ rust_parser::lex_string ()
if (raw_length > 0)
{
- if (pstate->lexptr[0] == '"' && ends_raw_string (pstate->lexptr,
- raw_length - 1))
+ if (pstate->lexptr[0] == '"'
+ && ends_raw_string (pstate->lexptr, raw_length - 1))
{
/* Exit with lexptr pointing after the final "#". */
pstate->lexptr += raw_length;
break;
}
else if (pstate->lexptr[0] == '\0')
- error (_("Unexpected EOF in string"));
+ error (_ ("Unexpected EOF in string"));
value = pstate->lexptr[0] & 0xff;
if (is_byte && value > 127)
- error (_("Non-ASCII value in raw byte string"));
+ error (_ ("Non-ASCII value in raw byte string"));
obstack_1grow (&obstack, value);
++pstate->lexptr;
@@ -731,17 +721,17 @@ rust_parser::lex_string ()
obstack_1grow (&obstack, value);
else
convert_between_encodings (HOST_UTF32, "UTF-8",
- (gdb_byte *) &value,
- sizeof (value), sizeof (value),
- &obstack, translit_none);
+ (gdb_byte *) &value, sizeof (value),
+ sizeof (value), &obstack,
+ translit_none);
}
else if (pstate->lexptr[0] == '\0')
- error (_("Unexpected EOF in string"));
+ error (_ ("Unexpected EOF in string"));
else
{
value = pstate->lexptr[0] & 0xff;
if (is_byte && value > 127)
- error (_("Non-ASCII value in byte string"));
+ error (_ ("Non-ASCII value in byte string"));
obstack_1grow (&obstack, value);
++pstate->lexptr;
}
@@ -772,9 +762,7 @@ space_then_number (const char *string)
static bool
rust_identifier_start_p (char c)
{
- return ((c >= 'a' && c <= 'z')
- || (c >= 'A' && c <= 'Z')
- || c == '_'
+ return ((c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z') || c == '_'
|| c == '$'
/* Allow any non-ASCII character as an identifier. There
doesn't seem to be a need to be picky about this. */
@@ -791,8 +779,7 @@ rust_parser::lex_identifier ()
int is_gdb_var = pstate->lexptr[0] == '$';
bool is_raw = false;
- if (pstate->lexptr[0] == 'r'
- && pstate->lexptr[1] == '#'
+ if (pstate->lexptr[0] == 'r' && pstate->lexptr[1] == '#'
&& rust_identifier_start_p (pstate->lexptr[2]))
{
is_raw = true;
@@ -814,7 +801,6 @@ rust_parser::lex_identifier ()
|| (pstate->lexptr[0] & 0x80) != 0)
++pstate->lexptr;
-
length = pstate->lexptr - start;
token = NULL;
if (!is_raw)
@@ -839,8 +825,7 @@ rust_parser::lex_identifier ()
return 0;
}
}
- else if (token == NULL
- && !is_raw
+ else if (token == NULL && !is_raw
&& (strncmp (start, "thread", length) == 0
|| strncmp (start, "task", length) == 0)
&& space_then_number (pstate->lexptr))
@@ -880,8 +865,8 @@ rust_parser::lex_operator ()
for (const auto &candidate : operator_tokens)
{
- if (strncmp (candidate.name, pstate->lexptr,
- strlen (candidate.name)) == 0)
+ if (strncmp (candidate.name, pstate->lexptr, strlen (candidate.name))
+ == 0)
{
pstate->lexptr += strlen (candidate.name);
token = &candidate;
@@ -979,10 +964,10 @@ rust_parser::lex_number ()
if (type_name == NULL)
{
gdb_assert (type_index != -1);
- type_name_holder = std::string ((pstate->lexptr
- + subexps[type_index].rm_so),
- (subexps[type_index].rm_eo
- - subexps[type_index].rm_so));
+ type_name_holder
+ = std::string ((pstate->lexptr + subexps[type_index].rm_so),
+ (subexps[type_index].rm_eo
+ - subexps[type_index].rm_so));
type_name = type_name_holder.c_str ();
}
@@ -1027,7 +1012,7 @@ rust_parser::lex_number ()
const char *trailer;
value = strtoulst (number.c_str () + offset, &trailer, radix);
if (*trailer != '\0')
- error (_("Integer literal is too large"));
+ error (_ ("Integer literal is too large"));
if (implicit_i32 && value >= ((uint64_t) 1) << 31)
type = get_type ("i64");
@@ -1037,9 +1022,9 @@ rust_parser::lex_number ()
else
{
current_float_val.type = type;
- bool parsed = parse_float (number.c_str (), number.length (),
- current_float_val.type,
- current_float_val.val.data ());
+ bool parsed
+ = parse_float (number.c_str (), number.length (),
+ current_float_val.type, current_float_val.val.data ());
gdb_assert (parsed);
}
@@ -1052,10 +1037,8 @@ int
rust_parser::lex_one_token ()
{
/* Skip all leading whitespace. */
- while (pstate->lexptr[0] == ' '
- || pstate->lexptr[0] == '\t'
- || pstate->lexptr[0] == '\r'
- || pstate->lexptr[0] == '\n')
+ while (pstate->lexptr[0] == ' ' || pstate->lexptr[0] == '\t'
+ || pstate->lexptr[0] == '\r' || pstate->lexptr[0] == '\n')
++pstate->lexptr;
/* If we hit EOF and we're completing, then return COMPLETE -- maybe
@@ -1068,7 +1051,7 @@ rust_parser::lex_one_token ()
{
if (pstate->parse_completion)
{
- current_string_val.length =0;
+ current_string_val.length = 0;
current_string_val.ptr = "";
return COMPLETE;
}
@@ -1120,8 +1103,6 @@ rust_parser::push_back (char c)
gdb_assert (*pstate->lexptr == c);
}
-
-
/* Parse a tuple or paren expression. */
operation_up
@@ -1149,7 +1130,7 @@ rust_parser::parse_tuple ()
while (current_token != ')')
{
if (current_token != ',')
- error (_("',' or ')' expected"));
+ error (_ ("',' or ')' expected"));
lex ();
/* A trailing "," is ok. */
@@ -1159,7 +1140,7 @@ rust_parser::parse_tuple ()
assume (')');
- error (_("Tuple expressions not supported yet"));
+ error (_ ("Tuple expressions not supported yet"));
}
/* Parse an array expression. */
@@ -1188,7 +1169,7 @@ rust_parser::parse_array ()
while (current_token != ']')
{
if (current_token != ',')
- error (_("',' or ']' expected"));
+ error (_ ("',' or ']' expected"));
lex ();
ops.push_back (parse_expr ());
}
@@ -1197,7 +1178,7 @@ rust_parser::parse_array ()
result = make_operation<array_operation> (0, len, std::move (ops));
}
else if (current_token != ']')
- error (_("',', ';', or ']' expected"));
+ error (_ ("',', ';', or ']' expected"));
require (']');
@@ -1209,9 +1190,9 @@ rust_parser::parse_array ()
operation_up
rust_parser::name_to_operation (const std::string &name)
{
- struct block_symbol sym = lookup_symbol (name.c_str (),
- pstate->expression_context_block,
- VAR_DOMAIN);
+ struct block_symbol sym
+ = lookup_symbol (name.c_str (), pstate->expression_context_block,
+ VAR_DOMAIN);
if (sym.symbol != nullptr && sym.symbol->aclass () != LOC_TYPEDEF)
return make_operation<var_value_operation> (sym);
@@ -1225,7 +1206,7 @@ rust_parser::name_to_operation (const std::string &name)
if (type == nullptr)
type = rust_lookup_type (name.c_str ());
if (type == nullptr)
- error (_("No symbol '%s' in current context"), name.c_str ());
+ error (_ ("No symbol '%s' in current context"), name.c_str ());
if (type->code () == TYPE_CODE_STRUCT && type->num_fields () == 0)
{
@@ -1244,16 +1225,15 @@ rust_parser::parse_struct_expr (struct type *type)
{
assume ('{');
- if (type->code () != TYPE_CODE_STRUCT
- || rust_tuple_type_p (type)
+ if (type->code () != TYPE_CODE_STRUCT || rust_tuple_type_p (type)
|| rust_tuple_struct_type_p (type))
- error (_("Struct expression applied to non-struct type"));
+ error (_ ("Struct expression applied to non-struct type"));
std::vector<std::pair<std::string, operation_up>> field_v;
while (current_token != '}' && current_token != DOTDOT)
{
if (current_token != IDENT)
- error (_("'}', '..', or identifier expected"));
+ error (_ ("'}', '..', or identifier expected"));
std::string name = get_string ();
lex ();
@@ -1283,8 +1263,7 @@ rust_parser::parse_struct_expr (struct type *type)
require ('}');
- return make_operation<rust_aggregate_operation> (type,
- std::move (others),
+ return make_operation<rust_aggregate_operation> (type, std::move (others),
std::move (field_v));
}
@@ -1323,25 +1302,25 @@ rust_parser::parse_binop (bool required)
TYPE is the operation type corresponding to the operator.
Assignment operations are handled specially, not via this
table; they have precedence 0. */
-#define ALL_OPS \
- OPERATION ('*', 10, mul_operation) \
- OPERATION ('/', 10, div_operation) \
- OPERATION ('%', 10, rem_operation) \
- OPERATION ('@', 9, repeat_operation) \
- OPERATION ('+', 8, add_operation) \
- OPERATION ('-', 8, sub_operation) \
- OPERATION (LSH, 7, lsh_operation) \
- OPERATION (RSH, 7, rsh_operation) \
- OPERATION ('&', 6, bitwise_and_operation) \
- OPERATION ('^', 5, bitwise_xor_operation) \
- OPERATION ('|', 4, bitwise_ior_operation) \
- OPERATION (EQEQ, 3, equal_operation) \
- OPERATION (NOTEQ, 3, notequal_operation) \
- OPERATION ('<', 3, less_operation) \
- OPERATION (LTEQ, 3, leq_operation) \
- OPERATION ('>', 3, gtr_operation) \
- OPERATION (GTEQ, 3, geq_operation) \
- OPERATION (ANDAND, 2, logical_and_operation) \
+#define ALL_OPS \
+ OPERATION ('*', 10, mul_operation) \
+ OPERATION ('/', 10, div_operation) \
+ OPERATION ('%', 10, rem_operation) \
+ OPERATION ('@', 9, repeat_operation) \
+ OPERATION ('+', 8, add_operation) \
+ OPERATION ('-', 8, sub_operation) \
+ OPERATION (LSH, 7, lsh_operation) \
+ OPERATION (RSH, 7, rsh_operation) \
+ OPERATION ('&', 6, bitwise_and_operation) \
+ OPERATION ('^', 5, bitwise_xor_operation) \
+ OPERATION ('|', 4, bitwise_ior_operation) \
+ OPERATION (EQEQ, 3, equal_operation) \
+ OPERATION (NOTEQ, 3, notequal_operation) \
+ OPERATION ('<', 3, less_operation) \
+ OPERATION (LTEQ, 3, leq_operation) \
+ OPERATION ('>', 3, gtr_operation) \
+ OPERATION (GTEQ, 3, geq_operation) \
+ OPERATION (ANDAND, 2, logical_and_operation) \
OPERATION (OROR, 1, logical_or_operation)
#define ASSIGN_PREC 0
@@ -1364,11 +1343,11 @@ rust_parser::parse_binop (bool required)
switch (this_token)
{
-#define OPERATION(TOKEN, PRECEDENCE, TYPE) \
- case TOKEN: \
- precedence = PRECEDENCE; \
- lex (); \
- break;
+#define OPERATION(TOKEN, PRECEDENCE, TYPE) \
+ case TOKEN: \
+ precedence = PRECEDENCE; \
+ lex (); \
+ break;
ALL_OPS
@@ -1388,8 +1367,8 @@ rust_parser::parse_binop (bool required)
lex ();
rustop_item &lhs = operator_stack.back ();
struct type *type = parse_type ();
- lhs.op = make_operation<unop_cast_operation> (std::move (lhs.op),
- type);
+ lhs.op
+ = make_operation<unop_cast_operation> (std::move (lhs.op), type);
}
/* Bypass the rest of the loop. */
continue;
@@ -1398,13 +1377,13 @@ rust_parser::parse_binop (bool required)
/* Arrange to pop the entire stack. */
precedence = -2;
break;
- }
+ }
/* Make sure that assignments are right-associative while other
operations are left-associative. */
while ((precedence == ASSIGN_PREC
- ? precedence < operator_stack.back ().precedence
- : precedence <= operator_stack.back ().precedence)
+ ? precedence < operator_stack.back ().precedence
+ : precedence <= operator_stack.back ().precedence)
&& operator_stack.size () > 1)
{
rustop_item rhs = std::move (operator_stack.back ());
@@ -1414,11 +1393,10 @@ rust_parser::parse_binop (bool required)
switch (rhs.token)
{
-#define OPERATION(TOKEN, PRECEDENCE, TYPE) \
- case TOKEN: \
- lhs.op = make_operation<TYPE> (std::move (lhs.op), \
- std::move (rhs.op)); \
- break;
+#define OPERATION(TOKEN, PRECEDENCE, TYPE) \
+ case TOKEN: \
+ lhs.op = make_operation<TYPE> (std::move (lhs.op), std::move (rhs.op)); \
+ break;
ALL_OPS
@@ -1428,18 +1406,18 @@ rust_parser::parse_binop (bool required)
case COMPOUND_ASSIGN:
{
if (rhs.token == '=')
- lhs.op = (make_operation<assign_operation>
- (std::move (lhs.op), std::move (rhs.op)));
+ lhs.op
+ = (make_operation<assign_operation> (std::move (lhs.op),
+ std::move (rhs.op)));
else
- lhs.op = (make_operation<assign_modify_operation>
- (rhs.opcode, std::move (lhs.op),
- std::move (rhs.op)));
+ lhs.op = (make_operation<assign_modify_operation> (
+ rhs.opcode, std::move (lhs.op), std::move (rhs.op)));
struct type *unit_type = get_type ("()");
operation_up nil (new long_const_operation (unit_type, 0));
- lhs.op = (make_operation<comma_operation>
- (std::move (lhs.op), std::move (nil)));
+ lhs.op = (make_operation<comma_operation> (std::move (lhs.op),
+ std::move (nil)));
}
break;
@@ -1465,8 +1443,7 @@ rust_parser::parse_binop (bool required)
operation_up
rust_parser::parse_range ()
{
- enum range_flag kind = (RANGE_HIGH_BOUND_DEFAULT
- | RANGE_LOW_BOUND_DEFAULT);
+ enum range_flag kind = (RANGE_HIGH_BOUND_DEFAULT | RANGE_LOW_BOUND_DEFAULT);
operation_up lhs;
if (current_token != DOTDOT && current_token != DOTDOTEQ)
@@ -1487,8 +1464,7 @@ rust_parser::parse_range ()
if (rhs != nullptr)
kind &= ~RANGE_HIGH_BOUND_DEFAULT;
- return make_operation<rust_range_operation> (kind,
- std::move (lhs),
+ return make_operation<rust_range_operation> (kind, std::move (lhs),
std::move (rhs));
}
@@ -1547,7 +1523,7 @@ rust_parser::parse_field (operation_up &&lhs)
completion_op.reset (struct_op);
pstate->mark_struct_expression (struct_op);
/* Throw to the outermost level of the parser. */
- error (_("not really an error"));
+ error (_ ("not really an error"));
}
result.reset (struct_op);
}
@@ -1560,10 +1536,10 @@ rust_parser::parse_field (operation_up &&lhs)
break;
case INTEGER:
- error (_("'_' not allowed in integers in anonymous field references"));
+ error (_ ("'_' not allowed in integers in anonymous field references"));
default:
- error (_("field name expected"));
+ error (_ ("field name expected"));
}
return result;
@@ -1595,7 +1571,7 @@ rust_parser::parse_paren_args ()
if (!args.empty ())
{
if (current_token != ',')
- error (_("',' or ')' expected"));
+ error (_ ("',' or ')' expected"));
lex ();
}
@@ -1614,8 +1590,7 @@ rust_parser::parse_call (operation_up &&lhs)
{
std::vector<operation_up> args = parse_paren_args ();
- return make_operation<funcall_operation> (std::move (lhs),
- std::move (args));
+ return make_operation<funcall_operation> (std::move (lhs), std::move (args));
}
/* Parse a list of types. */
@@ -1656,7 +1631,7 @@ rust_parser::parse_array_type ()
require (';');
if (current_token != INTEGER && current_token != DECIMAL_INTEGER)
- error (_("integer expected"));
+ error (_ ("integer expected"));
ULONGEST val = current_int_val.val;
lex ();
require (']');
@@ -1710,12 +1685,12 @@ rust_parser::parse_function_type ()
assume (KW_FN);
if (current_token != '(')
- error (_("'(' expected"));
+ error (_ ("'(' expected"));
std::vector<struct type *> types = parse_maybe_type_list ();
if (current_token != ARROW)
- error (_("'->' expected"));
+ error (_ ("'->' expected"));
lex ();
struct type *result_type = parse_type ();
@@ -1725,8 +1700,7 @@ rust_parser::parse_function_type ()
argtypes = types.data ();
result_type = lookup_function_type_with_arguments (result_type,
- types.size (),
- argtypes);
+ types.size (), argtypes);
return lookup_pointer_type (result_type);
}
@@ -1755,7 +1729,7 @@ rust_parser::parse_tuple_type ()
looking up existing tuple types. */
struct type *result = rust_lookup_type (name);
if (result == nullptr)
- error (_("could not find tuple type '%s'"), name);
+ error (_ ("could not find tuple type '%s'"), name);
return result;
}
@@ -1786,11 +1760,11 @@ rust_parser::parse_type ()
std::string path = parse_path (false);
struct type *result = rust_lookup_type (path.c_str ());
if (result == nullptr)
- error (_("No type name '%s' in current context"), path.c_str ());
+ error (_ ("No type name '%s' in current context"), path.c_str ());
return result;
}
default:
- error (_("type expected"));
+ error (_ ("type expected"));
}
}
@@ -1816,7 +1790,7 @@ rust_parser::parse_path (bool for_expr)
++n_supers;
lex ();
if (current_token != COLONCOLON)
- error (_("'::' expected"));
+ error (_ ("'::' expected"));
lex ();
}
break;
@@ -1834,7 +1808,7 @@ rust_parser::parse_path (bool for_expr)
}
if (current_token != IDENT)
- error (_("identifier expected"));
+ error (_ ("identifier expected"));
std::string path = get_string ();
bool saw_ident = true;
lex ();
@@ -1857,7 +1831,7 @@ rust_parser::parse_path (bool for_expr)
else if (current_token == COLONCOLON)
{
/* The code below won't detect this scenario. */
- error (_("unexpected '::'"));
+ error (_ ("unexpected '::'"));
}
}
@@ -1890,7 +1864,7 @@ rust_parser::parse_path (bool for_expr)
lex ();
}
else
- error (_("'>' expected"));
+ error (_ ("'>' expected"));
path += "<";
for (int i = 0; i < types.size (); ++i)
@@ -1933,7 +1907,7 @@ rust_parser::parse_string ()
/* Wrap the raw string in the &str struct. */
struct type *type = rust_lookup_type ("&str");
if (type == nullptr)
- error (_("Could not find type '&str'"));
+ error (_ ("Could not find type '&str'"));
std::vector<std::pair<std::string, operation_up>> field_v;
@@ -1947,8 +1921,7 @@ rust_parser::parse_string ()
operation_up lenop = make_operation<long_const_operation> (valtype, len);
field_v.emplace_back ("length", std::move (lenop));
- return make_operation<rust_aggregate_operation> (type,
- operation_up (),
+ return make_operation<rust_aggregate_operation> (type, operation_up (),
std::move (field_v));
}
@@ -1963,8 +1936,8 @@ rust_parser::parse_tuple_struct (struct type *type)
for (int i = 0; i < args.size (); ++i)
field_v[i] = { string_printf ("__%d", i), std::move (args[i]) };
- return (make_operation<rust_aggregate_operation>
- (type, operation_up (), std::move (field_v)));
+ return (make_operation<rust_aggregate_operation> (type, operation_up (),
+ std::move (field_v)));
}
/* Parse a path expression. */
@@ -1978,8 +1951,8 @@ rust_parser::parse_path_expr ()
{
struct type *type = rust_lookup_type (path.c_str ());
if (type == nullptr)
- error (_("Could not find type '%s'"), path.c_str ());
-
+ error (_ ("Could not find type '%s'"), path.c_str ());
+
return parse_struct_expr (type);
}
else if (current_token == '(')
@@ -1990,7 +1963,7 @@ rust_parser::parse_path_expr ()
if (type != nullptr)
{
if (!rust_tuple_struct_type_p (type))
- error (_("Type %s is not a tuple struct"), path.c_str ());
+ error (_ ("Type %s is not a tuple struct"), path.c_str ());
return parse_tuple_struct (type);
}
}
@@ -2089,7 +2062,7 @@ rust_parser::parse_atom (bool required)
default:
if (!required)
return {};
- error (_("unexpected token"));
+ error (_ ("unexpected token"));
}
/* Now parse suffixes. */
@@ -2115,8 +2088,6 @@ rust_parser::parse_atom (bool required)
}
}
-
-
/* The parser as exposed to gdb. */
int
@@ -2146,8 +2117,6 @@ rust_language::parser (struct parser_state *state) const
return 0;
}
-
-
#if GDB_SELF_TEST
/* A test helper that lexes a string, expecting a single token. */
@@ -2172,8 +2141,8 @@ rust_lex_test_one (rust_parser *parser, const char *input, int expected)
/* Test that INPUT lexes as the integer VALUE. */
static void
-rust_lex_int_test (rust_parser *parser, const char *input,
- ULONGEST value, int kind)
+rust_lex_int_test (rust_parser *parser, const char *input, ULONGEST value,
+ int kind)
{
rust_lex_test_one (parser, input, kind);
SELF_CHECK (parser->current_int_val.val == value);
@@ -2393,9 +2362,8 @@ rust_lex_tests (void)
#endif /* GDB_SELF_TEST */
-
-
void _initialize_rust_exp ();
+
void
_initialize_rust_exp ()
{
diff --git a/gdb/rx-tdep.c b/gdb/rx-tdep.c
index 675c51cfee9..83ca26a080c 100644
--- a/gdb/rx-tdep.c
+++ b/gdb/rx-tdep.c
@@ -62,7 +62,8 @@ enum
};
/* RX frame types. */
-enum rx_frame_type {
+enum rx_frame_type
+{
RX_FRAME_TYPE_NORMAL,
RX_FRAME_TYPE_EXCEPTION,
RX_FRAME_TYPE_FAST_INTERRUPT
@@ -121,13 +122,11 @@ struct rx_prologue
/* RX register names */
static const char *const rx_register_names[] = {
- "r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7",
- "r8", "r9", "r10", "r11", "r12", "r13", "r14", "r15",
- "usp", "isp", "psw", "pc", "intb", "bpsw","bpc","fintv",
- "fpsw", "acc",
+ "r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7", "r8",
+ "r9", "r10", "r11", "r12", "r13", "r14", "r15", "usp", "isp",
+ "psw", "pc", "intb", "bpsw", "bpc", "fintv", "fpsw", "acc",
};
-
/* Function for finding saved registers in a 'struct pv_area'; this
function is passed to pv_area::scan.
@@ -139,8 +138,7 @@ check_for_saved (void *result_untyped, pv_t addr, CORE_ADDR size, pv_t value)
{
struct rx_prologue *result = (struct rx_prologue *) result_untyped;
- if (value.kind == pvk_register
- && value.k == 0
+ if (value.kind == pvk_register && value.k == 0
&& pv_is_register (addr, RX_SP_REGNUM)
&& size == register_size (target_gdbarch (), value.reg))
result->reg_offset[value.reg] = addr.k;
@@ -180,8 +178,7 @@ rx_get_opcode_byte (void *handle)
static void
rx_analyze_prologue (CORE_ADDR start_pc, CORE_ADDR limit_pc,
- enum rx_frame_type frame_type,
- struct rx_prologue *result)
+ enum rx_frame_type frame_type, struct rx_prologue *result)
{
CORE_ADDR pc, next_pc;
int rn;
@@ -221,10 +218,8 @@ rx_analyze_prologue (CORE_ADDR start_pc, CORE_ADDR limit_pc,
address on the stack. */
reg[RX_SP_REGNUM] = pv_add_constant (reg[RX_SP_REGNUM], -4);
stack.store (reg[RX_SP_REGNUM], 4, reg[RX_PC_REGNUM]);
-
}
-
pc = start_pc;
while (pc < limit_pc)
{
@@ -233,11 +228,11 @@ rx_analyze_prologue (CORE_ADDR start_pc, CORE_ADDR limit_pc,
RX_Opcode_Decoded opc;
opcode_handle.pc = pc;
- bytes_read = rx_decode_opcode (pc, &opc, rx_get_opcode_byte,
- &opcode_handle);
+ bytes_read
+ = rx_decode_opcode (pc, &opc, rx_get_opcode_byte, &opcode_handle);
next_pc = pc + bytes_read;
- if (opc.id == RXO_pushm /* pushm r1, r2 */
+ if (opc.id == RXO_pushm /* pushm r1, r2 */
&& opc.op[1].type == RX_Operand_Register
&& opc.op[2].type == RX_Operand_Register)
{
@@ -253,10 +248,9 @@ rx_analyze_prologue (CORE_ADDR start_pc, CORE_ADDR limit_pc,
}
after_last_frame_setup_insn = next_pc;
}
- else if (opc.id == RXO_mov /* mov.l rdst, rsrc */
+ else if (opc.id == RXO_mov /* mov.l rdst, rsrc */
&& opc.op[0].type == RX_Operand_Register
- && opc.op[1].type == RX_Operand_Register
- && opc.size == RX_Long)
+ && opc.op[1].type == RX_Operand_Register && opc.size == RX_Long)
{
int rdst, rsrc;
@@ -266,11 +260,10 @@ rx_analyze_prologue (CORE_ADDR start_pc, CORE_ADDR limit_pc,
if (rdst == RX_FP_REGNUM && rsrc == RX_SP_REGNUM)
after_last_frame_setup_insn = next_pc;
}
- else if (opc.id == RXO_mov /* mov.l rsrc, [-SP] */
+ else if (opc.id == RXO_mov /* mov.l rsrc, [-SP] */
&& opc.op[0].type == RX_Operand_Predec
&& opc.op[0].reg == RX_SP_REGNUM
- && opc.op[1].type == RX_Operand_Register
- && opc.size == RX_Long)
+ && opc.op[1].type == RX_Operand_Register && opc.size == RX_Long)
{
int rsrc;
@@ -279,7 +272,7 @@ rx_analyze_prologue (CORE_ADDR start_pc, CORE_ADDR limit_pc,
stack.store (reg[RX_SP_REGNUM], 4, reg[rsrc]);
after_last_frame_setup_insn = next_pc;
}
- else if (opc.id == RXO_add /* add #const, rsrc, rdst */
+ else if (opc.id == RXO_add /* add #const, rsrc, rdst */
&& opc.op[0].type == RX_Operand_Register
&& opc.op[1].type == RX_Operand_Immediate
&& opc.op[2].type == RX_Operand_Register)
@@ -293,20 +286,16 @@ rx_analyze_prologue (CORE_ADDR start_pc, CORE_ADDR limit_pc,
if ((rdst == RX_SP_REGNUM || rdst == RX_FP_REGNUM) && addend < 0)
after_last_frame_setup_insn = next_pc;
}
- else if (opc.id == RXO_mov
- && opc.op[0].type == RX_Operand_Indirect
- && opc.op[1].type == RX_Operand_Register
- && opc.size == RX_Long
- && (opc.op[0].reg == RX_SP_REGNUM
- || opc.op[0].reg == RX_FP_REGNUM)
- && (RX_R1_REGNUM <= opc.op[1].reg
- && opc.op[1].reg <= RX_R4_REGNUM))
+ else if (
+ opc.id == RXO_mov && opc.op[0].type == RX_Operand_Indirect
+ && opc.op[1].type == RX_Operand_Register && opc.size == RX_Long
+ && (opc.op[0].reg == RX_SP_REGNUM || opc.op[0].reg == RX_FP_REGNUM)
+ && (RX_R1_REGNUM <= opc.op[1].reg && opc.op[1].reg <= RX_R4_REGNUM))
{
/* This moves an argument register to the stack. Don't
record it, but allow it to be a part of the prologue. */
}
- else if (opc.id == RXO_branch
- && opc.op[0].type == RX_Operand_Immediate
+ else if (opc.id == RXO_branch && opc.op[0].type == RX_Operand_Immediate
&& next_pc < opc.op[0].addend)
{
/* When a loop appears as the first statement of a function
@@ -329,7 +318,7 @@ rx_analyze_prologue (CORE_ADDR start_pc, CORE_ADDR limit_pc,
case below. */
after_last_frame_setup_insn = opc.op[0].addend;
- break; /* Scan no further if we hit this case. */
+ break; /* Scan no further if we hit this case. */
}
else
{
@@ -357,7 +346,6 @@ rx_analyze_prologue (CORE_ADDR start_pc, CORE_ADDR limit_pc,
result->prologue_end = after_last_frame_setup_insn;
}
-
/* Implement the "skip_prologue" gdbarch method. */
static CORE_ADDR
rx_skip_prologue (struct gdbarch *gdbarch, CORE_ADDR pc)
@@ -432,9 +420,9 @@ rx_frame_type (frame_info_ptr this_frame, void **this_cache)
/* No cached value; scan the function. The frame type is cached in
rx_analyze_prologue / rx_analyze_frame_prologue. */
-
+
pc = get_frame_pc (this_frame);
-
+
/* Attempt to find the last address in the function. If it cannot
be determined, set the limit to be a short ways past the frame's
pc. */
@@ -444,8 +432,8 @@ rx_frame_type (frame_info_ptr this_frame, void **this_cache)
while (pc < lim_pc)
{
opcode_handle.pc = pc;
- bytes_read = rx_decode_opcode (pc, &opc, rx_get_opcode_byte,
- &opcode_handle);
+ bytes_read
+ = rx_decode_opcode (pc, &opc, rx_get_opcode_byte, &opcode_handle);
if (bytes_read <= 0 || opc.id == RXO_rts)
return RX_FRAME_TYPE_NORMAL;
@@ -460,7 +448,6 @@ rx_frame_type (frame_info_ptr this_frame, void **this_cache)
return RX_FRAME_TYPE_NORMAL;
}
-
/* Given the next frame and a prologue cache, return this frame's
base. */
@@ -517,11 +504,11 @@ rx_frame_prev_register (frame_info_ptr this_frame, void **this_cache,
struct value *psw_val;
CORE_ADDR psw;
- psw_val = rx_frame_prev_register (this_frame, this_cache,
- RX_PSW_REGNUM);
- psw = extract_unsigned_integer
- (value_contents_all (psw_val).data (), 4,
- gdbarch_byte_order (get_frame_arch (this_frame)));
+ psw_val
+ = rx_frame_prev_register (this_frame, this_cache, RX_PSW_REGNUM);
+ psw = extract_unsigned_integer (
+ value_contents_all (psw_val).data (), 4,
+ gdbarch_byte_order (get_frame_arch (this_frame)));
if ((psw & 0x20000 /* U bit */) != 0)
return rx_frame_prev_register (this_frame, this_cache,
@@ -536,11 +523,9 @@ rx_frame_prev_register (frame_info_ptr this_frame, void **this_cache,
if (frame_type == RX_FRAME_TYPE_FAST_INTERRUPT)
{
if (regnum == RX_PC_REGNUM)
- return rx_frame_prev_register (this_frame, this_cache,
- RX_BPC_REGNUM);
+ return rx_frame_prev_register (this_frame, this_cache, RX_BPC_REGNUM);
if (regnum == RX_PSW_REGNUM)
- return rx_frame_prev_register (this_frame, this_cache,
- RX_BPSW_REGNUM);
+ return rx_frame_prev_register (this_frame, this_cache, RX_BPSW_REGNUM);
}
/* If prologue analysis says we saved this register somewhere,
@@ -576,9 +561,8 @@ exception_frame_p (enum rx_frame_type frame_type)
static int
rx_frame_sniffer_common (const struct frame_unwind *self,
- frame_info_ptr this_frame,
- void **this_cache,
- int (*sniff_p)(enum rx_frame_type) )
+ frame_info_ptr this_frame, void **this_cache,
+ int (*sniff_p) (enum rx_frame_type))
{
gdb_assert (this_cache != NULL);
@@ -590,7 +574,8 @@ rx_frame_sniffer_common (const struct frame_unwind *self,
{
/* The call below will fill in the cache, including the frame
type. */
- (void) rx_analyze_frame_prologue (this_frame, frame_type, this_cache);
+ (void) rx_analyze_frame_prologue (this_frame, frame_type,
+ this_cache);
return 1;
}
@@ -608,8 +593,7 @@ rx_frame_sniffer_common (const struct frame_unwind *self,
/* Frame sniffer for normal (non-exception) frames. */
static int
-rx_frame_sniffer (const struct frame_unwind *self,
- frame_info_ptr this_frame,
+rx_frame_sniffer (const struct frame_unwind *self, frame_info_ptr this_frame,
void **this_cache)
{
return rx_frame_sniffer_common (self, this_frame, this_cache,
@@ -620,8 +604,7 @@ rx_frame_sniffer (const struct frame_unwind *self,
static int
rx_exception_sniffer (const struct frame_unwind *self,
- frame_info_ptr this_frame,
- void **this_cache)
+ frame_info_ptr this_frame, void **this_cache)
{
return rx_frame_sniffer_common (self, this_frame, this_cache,
exception_frame_p);
@@ -631,12 +614,8 @@ rx_exception_sniffer (const struct frame_unwind *self,
analyzer. */
static const struct frame_unwind rx_frame_unwind = {
- "rx prologue",
- NORMAL_FRAME,
- default_frame_unwind_stop_reason,
- rx_frame_this_id,
- rx_frame_prev_register,
- NULL,
+ "rx prologue", NORMAL_FRAME, default_frame_unwind_stop_reason,
+ rx_frame_this_id, rx_frame_prev_register, NULL,
rx_frame_sniffer
};
@@ -646,12 +625,8 @@ static const struct frame_unwind rx_frame_unwind = {
static const struct frame_unwind rx_exception_unwind = {
"rx exception",
/* SIGTRAMP_FRAME could be used here, but backtraces are less informative. */
- NORMAL_FRAME,
- default_frame_unwind_stop_reason,
- rx_frame_this_id,
- rx_frame_prev_register,
- NULL,
- rx_exception_sniffer
+ NORMAL_FRAME, default_frame_unwind_stop_reason, rx_frame_this_id,
+ rx_frame_prev_register, NULL, rx_exception_sniffer
};
/* Implement the "push_dummy_call" gdbarch method. */
@@ -712,8 +687,7 @@ rx_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
gdb_assert (return_type->code () == TYPE_CODE_STRUCT
|| func_type->code () == TYPE_CODE_UNION);
- if (return_type->length () > 16
- || return_type->length () % 4 != 0)
+ if (return_type->length () > 16 || return_type->length () % 4 != 0)
{
if (write_pass)
regcache_cooked_write_unsigned (regcache, RX_R15_REGNUM,
@@ -732,8 +706,8 @@ rx_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
if (i == 0 && struct_addr != 0
&& return_method != return_method_struct
&& arg_type->code () == TYPE_CODE_PTR
- && extract_unsigned_integer (arg_bits, 4,
- byte_order) == struct_addr)
+ && extract_unsigned_integer (arg_bits, 4, byte_order)
+ == struct_addr)
{
/* This argument represents the address at which C++ (and
possibly other languages) store their return value.
@@ -743,8 +717,7 @@ rx_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
struct_addr);
}
else if (arg_type->code () != TYPE_CODE_STRUCT
- && arg_type->code () != TYPE_CODE_UNION
- && arg_size <= 8)
+ && arg_type->code () != TYPE_CODE_UNION && arg_size <= 8)
{
/* Argument is a scalar. */
if (arg_size == 8)
@@ -757,15 +730,14 @@ rx_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
must be available. */
if (write_pass)
{
- regcache_cooked_write_unsigned (regcache, arg_reg,
- extract_unsigned_integer
- (arg_bits, 4,
- byte_order));
- regcache_cooked_write_unsigned (regcache,
- arg_reg + 1,
- extract_unsigned_integer
- (arg_bits + 4, 4,
- byte_order));
+ regcache_cooked_write_unsigned (
+ regcache, arg_reg,
+ extract_unsigned_integer (arg_bits, 4,
+ byte_order));
+ regcache_cooked_write_unsigned (
+ regcache, arg_reg + 1,
+ extract_unsigned_integer (arg_bits + 4, 4,
+ byte_order));
}
arg_reg += 2;
}
@@ -784,8 +756,8 @@ rx_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
gdb_assert (arg_size <= 4);
- u =
- extract_unsigned_integer (arg_bits, arg_size, byte_order);
+ u = extract_unsigned_integer (arg_bits, arg_size,
+ byte_order);
if (i < num_register_candidate_args
&& arg_reg <= RX_R4_REGNUM)
@@ -801,17 +773,16 @@ rx_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
if (func_type->is_prototyped ()
&& i < func_type->num_fields ())
{
- struct type *p_arg_type =
- func_type->field (i).type ();
+ struct type *p_arg_type
+ = func_type->field (i).type ();
p_arg_size = p_arg_type->length ();
}
sp_off = align_up (sp_off, p_arg_size);
if (write_pass)
- write_memory_unsigned_integer (sp + sp_off,
- p_arg_size, byte_order,
- u);
+ write_memory_unsigned_integer (sp + sp_off, p_arg_size,
+ byte_order, u);
sp_off += p_arg_size;
}
}
@@ -830,10 +801,10 @@ rx_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
int len = std::min (arg_size, (ULONGEST) 4);
if (write_pass)
- regcache_cooked_write_unsigned (regcache, arg_reg,
- extract_unsigned_integer
- (arg_bits, len,
- byte_order));
+ regcache_cooked_write_unsigned (
+ regcache, arg_reg,
+ extract_unsigned_integer (arg_bits, len,
+ byte_order));
arg_bits += len;
arg_size -= len;
arg_reg++;
@@ -867,10 +838,8 @@ rx_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
/* Implement the "return_value" gdbarch method. */
static enum return_value_convention
-rx_return_value (struct gdbarch *gdbarch,
- struct value *function,
- struct type *valtype,
- struct regcache *regcache,
+rx_return_value (struct gdbarch *gdbarch, struct value *function,
+ struct type *valtype, struct regcache *regcache,
gdb_byte *readbuf, const gdb_byte *writebuf)
{
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
@@ -955,15 +924,12 @@ rx_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
else
elf_flags = 0;
-
/* Try to find the architecture in the list of already defined
architectures. */
- for (arches = gdbarch_list_lookup_by_info (arches, &info);
- arches != NULL;
+ for (arches = gdbarch_list_lookup_by_info (arches, &info); arches != NULL;
arches = gdbarch_list_lookup_by_info (arches->next, &info))
{
- rx_gdbarch_tdep *tdep
- = gdbarch_tdep<rx_gdbarch_tdep> (arches->gdbarch);
+ rx_gdbarch_tdep *tdep = gdbarch_tdep<rx_gdbarch_tdep> (arches->gdbarch);
if (tdep->elf_flags != elf_flags)
continue;
@@ -972,7 +938,7 @@ rx_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
}
if (tdesc == NULL)
- tdesc = tdesc_rx;
+ tdesc = tdesc_rx;
/* Check any target description for validity. */
if (tdesc_has_registers (tdesc))
@@ -994,7 +960,7 @@ rx_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
return NULL;
}
- gdb_assert(tdesc_data != NULL);
+ gdb_assert (tdesc_data != NULL);
gdbarch *gdbarch
= gdbarch_alloc (&info, gdbarch_tdep_up (new rx_gdbarch_tdep));
@@ -1061,6 +1027,7 @@ rx_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
/* Register the above initialization routine. */
void _initialize_rx_tdep ();
+
void
_initialize_rx_tdep ()
{
diff --git a/gdb/s12z-tdep.c b/gdb/s12z-tdep.c
index 4781eab083e..ee3345b8f1f 100644
--- a/gdb/s12z-tdep.c
+++ b/gdb/s12z-tdep.c
@@ -39,37 +39,22 @@
the CCW register. */
#define N_PHYSICAL_REGISTERS (S12Z_N_REGISTERS - 2)
-
/* A permutation of all the physical registers. Indexing this array
with an integer from gdb's internal representation will return the
register enum. */
-static const int reg_perm[N_PHYSICAL_REGISTERS] =
- {
- REG_D0,
- REG_D1,
- REG_D2,
- REG_D3,
- REG_D4,
- REG_D5,
- REG_D6,
- REG_D7,
- REG_X,
- REG_Y,
- REG_S,
- REG_P,
- REG_CCW
- };
+static const int reg_perm[N_PHYSICAL_REGISTERS]
+ = { REG_D0, REG_D1, REG_D2, REG_D3, REG_D4, REG_D5, REG_D6,
+ REG_D7, REG_X, REG_Y, REG_S, REG_P, REG_CCW };
/* The inverse of the above permutation. Indexing this
array with a register enum (e.g. REG_D2) will return the register
number in gdb's internal representation. */
-static const int inv_reg_perm[N_PHYSICAL_REGISTERS] =
- {
- 2, 3, 4, 5, /* d2, d3, d4, d5 */
- 0, 1, /* d0, d1 */
- 6, 7, /* d6, d7 */
- 8, 9, 10, 11, 12 /* x, y, s, p, ccw */
- };
+static const int inv_reg_perm[N_PHYSICAL_REGISTERS] = {
+ 2, 3, 4, 5, /* d2, d3, d4, d5 */
+ 0, 1, /* d0, d1 */
+ 6, 7, /* d6, d7 */
+ 8, 9, 10, 11, 12 /* x, y, s, p, ccw */
+};
/* Return the name of the register REGNUM. */
static const char *
@@ -92,8 +77,8 @@ s12z_skip_prologue (struct gdbarch *gdbarch, CORE_ADDR pc)
return prologue_end;
}
- warning (_("%s Failed to find end of prologue PC = %08x"),
- __FUNCTION__, (unsigned int) pc);
+ warning (_ ("%s Failed to find end of prologue PC = %08x"), __FUNCTION__,
+ (unsigned int) pc);
return pc;
}
@@ -117,28 +102,37 @@ s12z_register_type (struct gdbarch *gdbarch, int reg_nr)
return builtin_type (gdbarch)->builtin_int0;
}
-
static int
s12z_dwarf_reg_to_regnum (struct gdbarch *gdbarch, int num)
{
switch (num)
{
- case 15: return REG_S;
- case 7: return REG_X;
- case 8: return REG_Y;
- case 42: return REG_D0;
- case 43: return REG_D1;
- case 44: return REG_D2;
- case 45: return REG_D3;
- case 46: return REG_D4;
- case 47: return REG_D5;
- case 48: return REG_D6;
- case 49: return REG_D7;
+ case 15:
+ return REG_S;
+ case 7:
+ return REG_X;
+ case 8:
+ return REG_Y;
+ case 42:
+ return REG_D0;
+ case 43:
+ return REG_D1;
+ case 44:
+ return REG_D2;
+ case 45:
+ return REG_D3;
+ case 46:
+ return REG_D4;
+ case 47:
+ return REG_D5;
+ case 48:
+ return REG_D6;
+ case 49:
+ return REG_D7;
}
return -1;
}
-
/* Support functions for frame handling. */
/* A struct (based on mem_read_abstraction_base) to read memory
@@ -146,8 +140,8 @@ s12z_dwarf_reg_to_regnum (struct gdbarch *gdbarch, int num)
struct mem_read_abstraction
{
struct mem_read_abstraction_base base; /* The parent struct. */
- bfd_vma memaddr; /* Where to read from. */
- struct disassemble_info* info; /* The disassembler to use for reading. */
+ bfd_vma memaddr; /* Where to read from. */
+ struct disassemble_info *info; /* The disassembler to use for reading. */
};
/* Advance the reader by one byte. */
@@ -170,15 +164,13 @@ posn (struct mem_read_abstraction_base *b)
It is the caller's responsibility to ensure that this is of at least N
in size. */
static int
-abstract_read_memory (struct mem_read_abstraction_base *b,
- int offset,
+abstract_read_memory (struct mem_read_abstraction_base *b, int offset,
size_t n, bfd_byte *bytes)
{
struct mem_read_abstraction *mra = (struct mem_read_abstraction *) b;
- int status =
- (*mra->info->read_memory_func) (mra->memaddr + offset,
- bytes, n, mra->info);
+ int status = (*mra->info->read_memory_func) (mra->memaddr + offset, bytes, n,
+ mra->info);
if (status != 0)
{
@@ -189,7 +181,6 @@ abstract_read_memory (struct mem_read_abstraction_base *b,
return 0;
}
-
/* Return the stack adjustment caused by a push or pull instruction. */
static int
push_pull_get_stack_adjustment (int n_operands,
@@ -198,7 +189,7 @@ push_pull_get_stack_adjustment (int n_operands,
int stack_adjustment = 0;
gdb_assert (n_operands > 0);
if (operands[0]->cl == OPND_CL_REGISTER_ALL)
- stack_adjustment = 26; /* All the regs are involved. */
+ stack_adjustment = 26; /* All the regs are involved. */
else if (operands[0]->cl == OPND_CL_REGISTER_ALL16)
stack_adjustment = 4 * 2; /* All four 16 bit regs are involved. */
else
@@ -231,7 +222,8 @@ push_pull_get_stack_adjustment (int n_operands,
stack_adjustment += 1;
break;
default:
- gdb_assert_not_reached ("Invalid register in push/pull operation.");
+ gdb_assert_not_reached (
+ "Invalid register in push/pull operation.");
break;
}
}
@@ -267,15 +259,15 @@ s12z_frame_cache (frame_info_ptr this_frame, void **prologue_cache)
/* Get the stack pointer if we have one (if there's no process executing
yet we won't have a frame. */
- this_sp = (NULL == this_frame) ? 0 :
- get_frame_register_unsigned (this_frame, REG_S);
+ this_sp = (NULL == this_frame)
+ ? 0
+ : get_frame_register_unsigned (this_frame, REG_S);
/* Return early if GDB couldn't find the function. */
if (start_addr == 0)
{
- warning (_("Couldn't find function including address %s SP is %s"),
- paddress (gdbarch, this_pc),
- paddress (gdbarch, this_sp));
+ warning (_ ("Couldn't find function including address %s SP is %s"),
+ paddress (gdbarch, this_pc), paddress (gdbarch, this_sp));
/* JPB: 28-Apr-11. This is a temporary patch, to get round GDB
crashing right at the beginning. Build the frame ID as best we
@@ -304,7 +296,7 @@ s12z_frame_cache (frame_info_ptr this_frame, void **prologue_cache)
have executed the code. Check we have a sane prologue size, and if
zero we are frameless and can give up here. */
if (end_addr < start_addr)
- error (_("end addr %s is less than start addr %s"),
+ error (_ ("end addr %s is less than start addr %s"),
paddress (gdbarch, end_addr), paddress (gdbarch, start_addr));
CORE_ADDR addr = start_addr; /* Where we have got to? */
@@ -314,9 +306,9 @@ s12z_frame_cache (frame_info_ptr this_frame, void **prologue_cache)
struct gdb_non_printing_memory_disassembler dis (gdbarch);
struct mem_read_abstraction mra;
- mra.base.read = (int (*)(mem_read_abstraction_base*,
- int, size_t, bfd_byte*)) abstract_read_memory;
- mra.base.advance = advance ;
+ mra.base.read = (int (*) (mem_read_abstraction_base *, int, size_t,
+ bfd_byte *)) abstract_read_memory;
+ mra.base.advance = advance;
mra.base.posn = posn;
mra.info = dis.disasm_info ();
@@ -327,9 +319,8 @@ s12z_frame_cache (frame_info_ptr this_frame, void **prologue_cache)
int n_operands = 0;
struct operand *operands[6];
mra.memaddr = addr;
- int n_bytes =
- decode_s12z (&optr, &osize, &n_operands, operands,
- (mem_read_abstraction_base *) &mra);
+ int n_bytes = decode_s12z (&optr, &osize, &n_operands, operands,
+ (mem_read_abstraction_base *) &mra);
switch (optr)
{
@@ -366,14 +357,13 @@ s12z_frame_cache (frame_info_ptr this_frame, void **prologue_cache)
if ((reg == REG_S) && (operands[1]->cl == OPND_CL_MEMORY))
{
const struct memory_operand *mo
- = (const struct memory_operand * ) operands[1];
- if (mo->n_regs == 1 && !mo->indirect
- && mo->regs[0] == REG_S
+ = (const struct memory_operand *) operands[1];
+ if (mo->n_regs == 1 && !mo->indirect && mo->regs[0] == REG_S
&& mo->mutation == OPND_RM_NONE)
{
/* LEA S, (xxx, S) -- Decrement the stack. This is
almost certainly the start of a frame. */
- int simm = (signed char) mo->base_offset;
+ int simm = (signed char) mo->base_offset;
frame_size -= simm;
}
}
@@ -406,12 +396,10 @@ s12z_frame_cache (frame_info_ptr this_frame, void **prologue_cache)
/* The stack pointer of the prev frame is frame_size greater
than the stack pointer of this frame plus one address
size (caused by the JSR or BSR). */
- trad_frame_set_reg_value (info, REG_S,
- this_sp + frame_size + 3);
+ trad_frame_set_reg_value (info, REG_S, this_sp + frame_size + 3);
trad_frame_set_reg_addr (info, REG_P, this_sp + frame_size);
}
-
/* Build the frame ID. */
trad_frame_set_id (info, frame_id_build (this_sp_for_id, start_addr));
@@ -420,23 +408,22 @@ s12z_frame_cache (frame_info_ptr this_frame, void **prologue_cache)
/* Implement the this_id function for the stub unwinder. */
static void
-s12z_frame_this_id (frame_info_ptr this_frame,
- void **prologue_cache, struct frame_id *this_id)
+s12z_frame_this_id (frame_info_ptr this_frame, void **prologue_cache,
+ struct frame_id *this_id)
{
- struct trad_frame_cache *info = s12z_frame_cache (this_frame,
- prologue_cache);
+ struct trad_frame_cache *info
+ = s12z_frame_cache (this_frame, prologue_cache);
trad_frame_get_id (info, this_id);
}
-
/* Implement the prev_register function for the stub unwinder. */
static struct value *
-s12z_frame_prev_register (frame_info_ptr this_frame,
- void **prologue_cache, int regnum)
+s12z_frame_prev_register (frame_info_ptr this_frame, void **prologue_cache,
+ int regnum)
{
- struct trad_frame_cache *info = s12z_frame_cache (this_frame,
- prologue_cache);
+ struct trad_frame_cache *info
+ = s12z_frame_cache (this_frame, prologue_cache);
return trad_frame_get_register (info, this_frame, regnum);
}
@@ -453,8 +440,7 @@ static const struct frame_unwind s12z_frame_unwind = {
NULL,
};
-
-constexpr gdb_byte s12z_break_insn[] = {0x00};
+constexpr gdb_byte s12z_break_insn[] = { 0x00 };
typedef BP_MANIPULATION (s12z_break_insn) s12z_breakpoint;
@@ -465,34 +451,26 @@ struct s12z_gdbarch_tdep : gdbarch_tdep_base
/* A vector of human readable characters representing the
bits in the CCW register. Unused bits are represented as '-'.
Lowest significant bit comes first. */
-static const char ccw_bits[] =
- {
- 'C', /* Carry */
- 'V', /* Two's Complement Overflow */
- 'Z', /* Zero */
- 'N', /* Negative */
- 'I', /* Interrupt */
- '-',
- 'X', /* Non-Maskable Interrupt */
- 'S', /* STOP Disable */
- '0', /* Interrupt priority level */
- '0', /* ditto */
- '0', /* ditto */
- '-',
- '-',
- '-',
- '-',
- 'U' /* User/Supervisor State. */
- };
+static const char ccw_bits[] = {
+ 'C', /* Carry */
+ 'V', /* Two's Complement Overflow */
+ 'Z', /* Zero */
+ 'N', /* Negative */
+ 'I', /* Interrupt */
+ '-', 'X', /* Non-Maskable Interrupt */
+ 'S', /* STOP Disable */
+ '0', /* Interrupt priority level */
+ '0', /* ditto */
+ '0', /* ditto */
+ '-', '-', '-', '-', 'U' /* User/Supervisor State. */
+};
/* Print a human readable representation of the CCW register.
For example: "u----000SX-Inzvc" corresponds to the value
0xD0. */
static void
-s12z_print_ccw_info (struct gdbarch *gdbarch,
- struct ui_file *file,
- frame_info_ptr frame,
- int reg)
+s12z_print_ccw_info (struct gdbarch *gdbarch, struct ui_file *file,
+ frame_info_ptr frame, int reg)
{
struct value *v = value_of_register (reg, frame);
const char *name = gdbarch_register_name (gdbarch, reg);
@@ -522,13 +500,11 @@ s12z_print_ccw_info (struct gdbarch *gdbarch,
}
static void
-s12z_print_registers_info (struct gdbarch *gdbarch,
- struct ui_file *file,
- frame_info_ptr frame,
- int regnum, int print_all)
+s12z_print_registers_info (struct gdbarch *gdbarch, struct ui_file *file,
+ frame_info_ptr frame, int regnum, int print_all)
{
- const int numregs = (gdbarch_num_regs (gdbarch)
- + gdbarch_num_pseudo_regs (gdbarch));
+ const int numregs
+ = (gdbarch_num_regs (gdbarch) + gdbarch_num_pseudo_regs (gdbarch));
if (regnum == -1)
{
@@ -548,18 +524,15 @@ s12z_print_registers_info (struct gdbarch *gdbarch,
default_print_registers_info (gdbarch, file, frame, regnum, print_all);
}
-
-
-
static void
s12z_extract_return_value (struct type *type, struct regcache *regcache,
- void *valbuf)
+ void *valbuf)
{
int reg = -1;
switch (type->length ())
{
- case 0: /* Nothing to do */
+ case 0: /* Nothing to do */
return;
case 1:
@@ -579,7 +552,7 @@ s12z_extract_return_value (struct type *type, struct regcache *regcache,
break;
default:
- error (_("bad size for return value"));
+ error (_ ("bad size for return value"));
return;
}
@@ -591,10 +564,8 @@ s12z_return_value (struct gdbarch *gdbarch, struct value *function,
struct type *type, struct regcache *regcache,
gdb_byte *readbuf, const gdb_byte *writebuf)
{
- if (type->code () == TYPE_CODE_STRUCT
- || type->code () == TYPE_CODE_UNION
- || type->code () == TYPE_CODE_ARRAY
- || type->length () > 4)
+ if (type->code () == TYPE_CODE_STRUCT || type->code () == TYPE_CODE_UNION
+ || type->code () == TYPE_CODE_ARRAY || type->length () > 4)
return RETURN_VALUE_STRUCT_CONVENTION;
if (readbuf)
@@ -603,14 +574,13 @@ s12z_return_value (struct gdbarch *gdbarch, struct value *function,
return RETURN_VALUE_REGISTER_CONVENTION;
}
-
static void
show_bdccsr_command (const char *args, int from_tty)
{
struct string_file output;
target_rcmd ("bdccsr", &output);
- gdb_printf ("The current BDCCSR value is %s\n", output.string().c_str());
+ gdb_printf ("The current BDCCSR value is %s\n", output.string ().c_str ());
}
static struct gdbarch *
@@ -620,7 +590,7 @@ s12z_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
= gdbarch_alloc (&info, gdbarch_tdep_up (new s12z_gdbarch_tdep));
add_cmd ("bdccsr", class_support, show_bdccsr_command,
- _("Show the current value of the microcontroller's BDCCSR."),
+ _ ("Show the current value of the microcontroller's BDCCSR."),
&maintenanceinfolist);
/* Target data types. */
@@ -636,13 +606,10 @@ s12z_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
set_gdbarch_pc_regnum (gdbarch, REG_P);
set_gdbarch_sp_regnum (gdbarch, REG_S);
-
set_gdbarch_print_registers_info (gdbarch, s12z_print_registers_info);
- set_gdbarch_breakpoint_kind_from_pc (gdbarch,
- s12z_breakpoint::kind_from_pc);
- set_gdbarch_sw_breakpoint_from_kind (gdbarch,
- s12z_breakpoint::bp_from_kind);
+ set_gdbarch_breakpoint_kind_from_pc (gdbarch, s12z_breakpoint::kind_from_pc);
+ set_gdbarch_sw_breakpoint_from_kind (gdbarch, s12z_breakpoint::bp_from_kind);
set_gdbarch_num_regs (gdbarch, N_PHYSICAL_REGISTERS);
set_gdbarch_register_name (gdbarch, s12z_register_name);
@@ -663,6 +630,7 @@ s12z_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
}
void _initialize_s12z_tdep ();
+
void
_initialize_s12z_tdep ()
{
diff --git a/gdb/s390-linux-nat.c b/gdb/s390-linux-nat.c
index fc3917d30be..f0beb0168d7 100644
--- a/gdb/s390-linux-nat.c
+++ b/gdb/s390-linux-nat.c
@@ -63,37 +63,50 @@ static int have_regset_gs = 0;
kernel. */
#ifdef __s390x__
-static const struct regcache_map_entry s390_64_regmap_gregset[] =
- {
- /* Skip PSWM and PSWA, since they must be handled specially. */
- { 2, REGCACHE_MAP_SKIP, 8 },
- { 1, S390_R0_UPPER_REGNUM, 4 }, { 1, S390_R0_REGNUM, 4 },
- { 1, S390_R1_UPPER_REGNUM, 4 }, { 1, S390_R1_REGNUM, 4 },
- { 1, S390_R2_UPPER_REGNUM, 4 }, { 1, S390_R2_REGNUM, 4 },
- { 1, S390_R3_UPPER_REGNUM, 4 }, { 1, S390_R3_REGNUM, 4 },
- { 1, S390_R4_UPPER_REGNUM, 4 }, { 1, S390_R4_REGNUM, 4 },
- { 1, S390_R5_UPPER_REGNUM, 4 }, { 1, S390_R5_REGNUM, 4 },
- { 1, S390_R6_UPPER_REGNUM, 4 }, { 1, S390_R6_REGNUM, 4 },
- { 1, S390_R7_UPPER_REGNUM, 4 }, { 1, S390_R7_REGNUM, 4 },
- { 1, S390_R8_UPPER_REGNUM, 4 }, { 1, S390_R8_REGNUM, 4 },
- { 1, S390_R9_UPPER_REGNUM, 4 }, { 1, S390_R9_REGNUM, 4 },
- { 1, S390_R10_UPPER_REGNUM, 4 }, { 1, S390_R10_REGNUM, 4 },
- { 1, S390_R11_UPPER_REGNUM, 4 }, { 1, S390_R11_REGNUM, 4 },
- { 1, S390_R12_UPPER_REGNUM, 4 }, { 1, S390_R12_REGNUM, 4 },
- { 1, S390_R13_UPPER_REGNUM, 4 }, { 1, S390_R13_REGNUM, 4 },
- { 1, S390_R14_UPPER_REGNUM, 4 }, { 1, S390_R14_REGNUM, 4 },
- { 1, S390_R15_UPPER_REGNUM, 4 }, { 1, S390_R15_REGNUM, 4 },
- { 16, S390_A0_REGNUM, 4 },
- { 1, REGCACHE_MAP_SKIP, 4 }, { 1, S390_ORIG_R2_REGNUM, 4 },
- { 0 }
- };
-
-static const struct regset s390_64_gregset =
- {
- s390_64_regmap_gregset,
- regcache_supply_regset,
- regcache_collect_regset
- };
+static const struct regcache_map_entry s390_64_regmap_gregset[] = {
+ /* Skip PSWM and PSWA, since they must be handled specially. */
+ { 2, REGCACHE_MAP_SKIP, 8 },
+ { 1, S390_R0_UPPER_REGNUM, 4 },
+ { 1, S390_R0_REGNUM, 4 },
+ { 1, S390_R1_UPPER_REGNUM, 4 },
+ { 1, S390_R1_REGNUM, 4 },
+ { 1, S390_R2_UPPER_REGNUM, 4 },
+ { 1, S390_R2_REGNUM, 4 },
+ { 1, S390_R3_UPPER_REGNUM, 4 },
+ { 1, S390_R3_REGNUM, 4 },
+ { 1, S390_R4_UPPER_REGNUM, 4 },
+ { 1, S390_R4_REGNUM, 4 },
+ { 1, S390_R5_UPPER_REGNUM, 4 },
+ { 1, S390_R5_REGNUM, 4 },
+ { 1, S390_R6_UPPER_REGNUM, 4 },
+ { 1, S390_R6_REGNUM, 4 },
+ { 1, S390_R7_UPPER_REGNUM, 4 },
+ { 1, S390_R7_REGNUM, 4 },
+ { 1, S390_R8_UPPER_REGNUM, 4 },
+ { 1, S390_R8_REGNUM, 4 },
+ { 1, S390_R9_UPPER_REGNUM, 4 },
+ { 1, S390_R9_REGNUM, 4 },
+ { 1, S390_R10_UPPER_REGNUM, 4 },
+ { 1, S390_R10_REGNUM, 4 },
+ { 1, S390_R11_UPPER_REGNUM, 4 },
+ { 1, S390_R11_REGNUM, 4 },
+ { 1, S390_R12_UPPER_REGNUM, 4 },
+ { 1, S390_R12_REGNUM, 4 },
+ { 1, S390_R13_UPPER_REGNUM, 4 },
+ { 1, S390_R13_REGNUM, 4 },
+ { 1, S390_R14_UPPER_REGNUM, 4 },
+ { 1, S390_R14_REGNUM, 4 },
+ { 1, S390_R15_UPPER_REGNUM, 4 },
+ { 1, S390_R15_REGNUM, 4 },
+ { 16, S390_A0_REGNUM, 4 },
+ { 1, REGCACHE_MAP_SKIP, 4 },
+ { 1, S390_ORIG_R2_REGNUM, 4 },
+ { 0 }
+};
+
+static const struct regset s390_64_gregset
+ = { s390_64_regmap_gregset, regcache_supply_regset,
+ regcache_collect_regset };
#define S390_PSWM_OFFSET 0
#define S390_PSWA_OFFSET 8
@@ -101,28 +114,29 @@ static const struct regset s390_64_gregset =
/* PER-event mask bits and PER control bits (CR9). */
-#define PER_BIT(n) (1UL << (63 - (n)))
-#define PER_EVENT_BRANCH PER_BIT (32)
-#define PER_EVENT_IFETCH PER_BIT (33)
-#define PER_EVENT_STORE PER_BIT (34)
-#define PER_EVENT_NULLIFICATION PER_BIT (39)
-#define PER_CONTROL_BRANCH_ADDRESS PER_BIT (40)
-#define PER_CONTROL_SUSPENSION PER_BIT (41)
-#define PER_CONTROL_ALTERATION PER_BIT (42)
+#define PER_BIT(n) (1UL << (63 - (n)))
+#define PER_EVENT_BRANCH PER_BIT (32)
+#define PER_EVENT_IFETCH PER_BIT (33)
+#define PER_EVENT_STORE PER_BIT (34)
+#define PER_EVENT_NULLIFICATION PER_BIT (39)
+#define PER_CONTROL_BRANCH_ADDRESS PER_BIT (40)
+#define PER_CONTROL_SUSPENSION PER_BIT (41)
+#define PER_CONTROL_ALTERATION PER_BIT (42)
class s390_linux_nat_target final : public linux_nat_target
{
public:
+
/* Add our register access methods. */
void fetch_registers (struct regcache *, int) override;
void store_registers (struct regcache *, int) override;
/* Add our watchpoint methods. */
int can_use_hw_breakpoint (enum bptype, int, int) override;
- int insert_hw_breakpoint (struct gdbarch *, struct bp_target_info *)
- override;
- int remove_hw_breakpoint (struct gdbarch *, struct bp_target_info *)
- override;
+ int insert_hw_breakpoint (struct gdbarch *,
+ struct bp_target_info *) override;
+ int remove_hw_breakpoint (struct gdbarch *,
+ struct bp_target_info *) override;
int region_ok_for_hw_watchpoint (CORE_ADDR, int) override;
bool stopped_by_watchpoint () override;
int insert_watchpoint (CORE_ADDR, int, enum target_hw_bp_type,
@@ -132,9 +146,8 @@ public:
/* Detect target architecture. */
const struct target_desc *read_description () override;
- int auxv_parse (const gdb_byte **readptr,
- const gdb_byte *endptr, CORE_ADDR *typep, CORE_ADDR *valp)
- override;
+ int auxv_parse (const gdb_byte **readptr, const gdb_byte *endptr,
+ CORE_ADDR *typep, CORE_ADDR *valp) override;
/* Override linux_nat_target low methods. */
void low_new_thread (struct lwp_info *lp) override;
@@ -164,12 +177,14 @@ supply_gregset (struct regcache *regcache, const gregset_t *regp)
ULONGEST pswm, pswa;
gdb_byte buf[4];
- regcache_supply_regset (&s390_64_gregset, regcache, -1,
- regp, sizeof (gregset_t));
- pswm = extract_unsigned_integer ((const gdb_byte *) regp
- + S390_PSWM_OFFSET, 8, byte_order);
- pswa = extract_unsigned_integer ((const gdb_byte *) regp
- + S390_PSWA_OFFSET, 8, byte_order);
+ regcache_supply_regset (&s390_64_gregset, regcache, -1, regp,
+ sizeof (gregset_t));
+ pswm
+ = extract_unsigned_integer ((const gdb_byte *) regp + S390_PSWM_OFFSET,
+ 8, byte_order);
+ pswa
+ = extract_unsigned_integer ((const gdb_byte *) regp + S390_PSWA_OFFSET,
+ 8, byte_order);
store_unsigned_integer (buf, 4, byte_order, (pswm >> 32) | 0x80000);
regcache->raw_supply (S390_PSWM_REGNUM, buf);
store_unsigned_integer (buf, 4, byte_order,
@@ -194,11 +209,11 @@ fill_gregset (const struct regcache *regcache, gregset_t *regp, int regno)
struct gdbarch *gdbarch = regcache->arch ();
if (gdbarch_ptr_bit (gdbarch) == 32)
{
- regcache_collect_regset (&s390_64_gregset, regcache, regno,
- regp, sizeof (gregset_t));
+ regcache_collect_regset (&s390_64_gregset, regcache, regno, regp,
+ sizeof (gregset_t));
- if (regno == -1
- || regno == S390_PSWM_REGNUM || regno == S390_PSWA_REGNUM)
+ if (regno == -1 || regno == S390_PSWM_REGNUM
+ || regno == S390_PSWA_REGNUM)
{
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
ULONGEST pswa, pswm;
@@ -212,8 +227,9 @@ fill_gregset (const struct regcache *regcache, gregset_t *regp, int regno)
{
pswm &= 0x80000000;
regcache->raw_collect (S390_PSWM_REGNUM, buf);
- pswm |= (extract_unsigned_integer (buf, 4, byte_order)
- & 0xfff7ffff) << 32;
+ pswm
+ |= (extract_unsigned_integer (buf, 4, byte_order) & 0xfff7ffff)
+ << 32;
}
if (regno == -1 || regno == S390_PSWA_REGNUM)
@@ -278,7 +294,7 @@ fetch_regs (struct regcache *regcache, int tid)
parea.process_addr = (addr_t) &regs;
parea.kernel_addr = offsetof (struct user_regs_struct, psw);
if (ptrace (PTRACE_PEEKUSR_AREA, tid, (long) &parea, 0) < 0)
- perror_with_name (_("Couldn't get registers"));
+ perror_with_name (_ ("Couldn't get registers"));
supply_gregset (regcache, (const gregset_t *) &regs);
}
@@ -295,12 +311,12 @@ store_regs (const struct regcache *regcache, int tid, int regnum)
parea.process_addr = (addr_t) &regs;
parea.kernel_addr = offsetof (struct user_regs_struct, psw);
if (ptrace (PTRACE_PEEKUSR_AREA, tid, (long) &parea, 0) < 0)
- perror_with_name (_("Couldn't get registers"));
+ perror_with_name (_ ("Couldn't get registers"));
fill_gregset (regcache, &regs, regnum);
if (ptrace (PTRACE_POKEUSR_AREA, tid, (long) &parea, 0) < 0)
- perror_with_name (_("Couldn't write registers"));
+ perror_with_name (_ ("Couldn't write registers"));
}
/* Fetch all floating-point registers from process/thread TID and store
@@ -315,7 +331,7 @@ fetch_fpregs (struct regcache *regcache, int tid)
parea.process_addr = (addr_t) &fpregs;
parea.kernel_addr = offsetof (struct user_regs_struct, fp_regs);
if (ptrace (PTRACE_PEEKUSR_AREA, tid, (long) &parea, 0) < 0)
- perror_with_name (_("Couldn't get floating point status"));
+ perror_with_name (_ ("Couldn't get floating point status"));
supply_fpregset (regcache, (const fpregset_t *) &fpregs);
}
@@ -332,12 +348,12 @@ store_fpregs (const struct regcache *regcache, int tid, int regnum)
parea.process_addr = (addr_t) &fpregs;
parea.kernel_addr = offsetof (struct user_regs_struct, fp_regs);
if (ptrace (PTRACE_PEEKUSR_AREA, tid, (long) &parea, 0) < 0)
- perror_with_name (_("Couldn't get floating point status"));
+ perror_with_name (_ ("Couldn't get floating point status"));
fill_fpregset (regcache, &fpregs, regnum);
if (ptrace (PTRACE_POKEUSR_AREA, tid, (long) &parea, 0) < 0)
- perror_with_name (_("Couldn't write floating point status"));
+ perror_with_name (_ ("Couldn't write floating point status"));
}
/* Fetch all registers in the kernel's register set whose number is
@@ -345,8 +361,8 @@ store_fpregs (const struct regcache *regcache, int tid, int regnum)
REGSET, from process/thread TID and store their values in GDB's
register cache. */
static void
-fetch_regset (struct regcache *regcache, int tid,
- int regset_id, int regsize, const struct regset *regset)
+fetch_regset (struct regcache *regcache, int tid, int regset_id, int regsize,
+ const struct regset *regset)
{
void *buf = alloca (regsize);
struct iovec iov;
@@ -359,7 +375,7 @@ fetch_regset (struct regcache *regcache, int tid,
if (errno == ENODATA)
regcache_supply_regset (regset, regcache, -1, NULL, regsize);
else
- perror_with_name (_("Couldn't get register set"));
+ perror_with_name (_ ("Couldn't get register set"));
}
else
regcache_supply_regset (regset, regcache, -1, buf, regsize);
@@ -369,8 +385,8 @@ fetch_regset (struct regcache *regcache, int tid,
REGSET_ID, whose size is REGSIZE, and whose layout is described by
REGSET, from GDB's register cache back to process/thread TID. */
static void
-store_regset (struct regcache *regcache, int tid,
- int regset_id, int regsize, const struct regset *regset)
+store_regset (struct regcache *regcache, int tid, int regset_id, int regsize,
+ const struct regset *regset)
{
void *buf = alloca (regsize);
struct iovec iov;
@@ -379,12 +395,12 @@ store_regset (struct regcache *regcache, int tid,
iov.iov_len = regsize;
if (ptrace (PTRACE_GETREGSET, tid, (long) regset_id, (long) &iov) < 0)
- perror_with_name (_("Couldn't get register set"));
+ perror_with_name (_ ("Couldn't get register set"));
regcache_collect_regset (regset, regcache, -1, buf, regsize);
if (ptrace (PTRACE_SETREGSET, tid, (long) regset_id, (long) &iov) < 0)
- perror_with_name (_("Couldn't set register set"));
+ perror_with_name (_ ("Couldn't set register set"));
}
/* Check whether the kernel provides a register set with number REGSET
@@ -421,7 +437,8 @@ s390_linux_nat_target::fetch_registers (struct regcache *regcache, int regnum)
if (regnum == -1 || regnum == S390_LAST_BREAK_REGNUM)
fetch_regset (regcache, tid, NT_S390_LAST_BREAK, 8,
(gdbarch_ptr_bit (regcache->arch ()) == 32
- ? &s390_last_break_regset : &s390x_last_break_regset));
+ ? &s390_last_break_regset
+ : &s390x_last_break_regset));
if (have_regset_system_call)
if (regnum == -1 || regnum == S390_SYSTEM_CALL_REGNUM)
@@ -435,26 +452,25 @@ s390_linux_nat_target::fetch_registers (struct regcache *regcache, int regnum)
if (have_regset_vxrs)
{
- if (regnum == -1 || (regnum >= S390_V0_LOWER_REGNUM
- && regnum <= S390_V15_LOWER_REGNUM))
+ if (regnum == -1
+ || (regnum >= S390_V0_LOWER_REGNUM
+ && regnum <= S390_V15_LOWER_REGNUM))
fetch_regset (regcache, tid, NT_S390_VXRS_LOW, 16 * 8,
&s390_vxrs_low_regset);
- if (regnum == -1 || (regnum >= S390_V16_REGNUM
- && regnum <= S390_V31_REGNUM))
+ if (regnum == -1
+ || (regnum >= S390_V16_REGNUM && regnum <= S390_V31_REGNUM))
fetch_regset (regcache, tid, NT_S390_VXRS_HIGH, 16 * 16,
&s390_vxrs_high_regset);
}
if (have_regset_gs)
{
- if (regnum == -1 || (regnum >= S390_GSD_REGNUM
- && regnum <= S390_GSEPLA_REGNUM))
- fetch_regset (regcache, tid, NT_S390_GS_CB, 4 * 8,
- &s390_gs_regset);
- if (regnum == -1 || (regnum >= S390_BC_GSD_REGNUM
- && regnum <= S390_BC_GSEPLA_REGNUM))
- fetch_regset (regcache, tid, NT_S390_GS_BC, 4 * 8,
- &s390_gsbc_regset);
+ if (regnum == -1
+ || (regnum >= S390_GSD_REGNUM && regnum <= S390_GSEPLA_REGNUM))
+ fetch_regset (regcache, tid, NT_S390_GS_CB, 4 * 8, &s390_gs_regset);
+ if (regnum == -1
+ || (regnum >= S390_BC_GSD_REGNUM && regnum <= S390_BC_GSEPLA_REGNUM))
+ fetch_regset (regcache, tid, NT_S390_GS_BC, 4 * 8, &s390_gsbc_regset);
}
}
@@ -480,18 +496,18 @@ s390_linux_nat_target::store_registers (struct regcache *regcache, int regnum)
if (have_regset_vxrs)
{
- if (regnum == -1 || (regnum >= S390_V0_LOWER_REGNUM
- && regnum <= S390_V15_LOWER_REGNUM))
+ if (regnum == -1
+ || (regnum >= S390_V0_LOWER_REGNUM
+ && regnum <= S390_V15_LOWER_REGNUM))
store_regset (regcache, tid, NT_S390_VXRS_LOW, 16 * 8,
&s390_vxrs_low_regset);
- if (regnum == -1 || (regnum >= S390_V16_REGNUM
- && regnum <= S390_V31_REGNUM))
+ if (regnum == -1
+ || (regnum >= S390_V16_REGNUM && regnum <= S390_V31_REGNUM))
store_regset (regcache, tid, NT_S390_VXRS_HIGH, 16 * 16,
&s390_vxrs_high_regset);
}
}
-
/* Hardware-assisted watchpoint handling. */
/* For each process we maintain a list of all currently active
@@ -640,20 +656,16 @@ s390_show_debug_regs (int tid, const char *where)
parea.kernel_addr = offsetof (struct user_regs_struct, per_info);
if (ptrace (PTRACE_PEEKUSR_AREA, tid, &parea, 0) < 0)
- perror_with_name (_("Couldn't retrieve debug regs"));
+ perror_with_name (_ ("Couldn't retrieve debug regs"));
debug_printf ("PER (debug) state for %d -- %s\n"
" cr9-11: %lx %lx %lx\n"
" start, end: %lx %lx\n"
" code/ATMID: %x address: %lx PAID: %x\n",
- tid,
- where,
- per_info.control_regs.words.cr[0],
+ tid, where, per_info.control_regs.words.cr[0],
per_info.control_regs.words.cr[1],
- per_info.control_regs.words.cr[2],
- per_info.starting_addr,
- per_info.ending_addr,
- per_info.lowcore.words.perc_atmid,
+ per_info.control_regs.words.cr[2], per_info.starting_addr,
+ per_info.ending_addr, per_info.lowcore.words.perc_atmid,
per_info.lowcore.words.address,
per_info.lowcore.words.access_id);
}
@@ -676,15 +688,14 @@ s390_linux_nat_target::stopped_by_watchpoint ()
siginfo_t siginfo;
if (!linux_nat_get_siginfo (inferior_ptid, &siginfo))
return false;
- if (siginfo.si_signo != SIGTRAP
- || (siginfo.si_code & 0xffff) != TRAP_HWBKPT)
+ if (siginfo.si_signo != SIGTRAP || (siginfo.si_code & 0xffff) != TRAP_HWBKPT)
return false;
parea.len = sizeof (per_lowcore);
- parea.process_addr = (addr_t) & per_lowcore;
+ parea.process_addr = (addr_t) &per_lowcore;
parea.kernel_addr = offsetof (struct user_regs_struct, per_info.lowcore);
if (ptrace (PTRACE_PEEKUSR_AREA, s390_inferior_tid (), &parea, 0) < 0)
- perror_with_name (_("Couldn't retrieve watchpoint status"));
+ perror_with_name (_ ("Couldn't retrieve watchpoint status"));
bool result = (per_lowcore.perc_storage_alteration == 1
&& per_lowcore.perc_store_real_address == 0);
@@ -703,7 +714,7 @@ s390_linux_nat_target::low_prepare_to_resume (struct lwp_info *lp)
per_struct per_info;
ptrace_area parea;
- CORE_ADDR watch_lo_addr = (CORE_ADDR)-1, watch_hi_addr = 0;
+ CORE_ADDR watch_lo_addr = (CORE_ADDR) -1, watch_hi_addr = 0;
struct arch_lwp_info *lp_priv = lwp_arch_private_info (lp);
struct s390_debug_reg_state *state = s390_get_debug_reg_state (pid);
int step = lwp_is_stepping (lp);
@@ -727,7 +738,7 @@ s390_linux_nat_target::low_prepare_to_resume (struct lwp_info *lp)
tid = pid;
parea.len = sizeof (per_info);
- parea.process_addr = (addr_t) & per_info;
+ parea.process_addr = (addr_t) &per_info;
parea.kernel_addr = offsetof (struct user_regs_struct, per_info);
/* Clear PER info, but adjust the single_step field (used by older
@@ -744,8 +755,8 @@ s390_linux_nat_target::low_prepare_to_resume (struct lwp_info *lp)
}
/* Enable storage-alteration events. */
- per_info.control_regs.words.cr[0] |= (PER_EVENT_STORE
- | PER_CONTROL_ALTERATION);
+ per_info.control_regs.words.cr[0]
+ |= (PER_EVENT_STORE | PER_CONTROL_ALTERATION);
}
if (!state->break_areas.empty ())
@@ -768,16 +779,15 @@ s390_linux_nat_target::low_prepare_to_resume (struct lwp_info *lp)
Otherwise stop after any instruction within the PER area and
after any branch into it (slow). */
if (watch_hi_addr == watch_lo_addr)
- per_info.control_regs.words.cr[0] |= (PER_EVENT_NULLIFICATION
- | PER_EVENT_IFETCH);
+ per_info.control_regs.words.cr[0]
+ |= (PER_EVENT_NULLIFICATION | PER_EVENT_IFETCH);
else
{
/* The PER area must include the instruction before the
first breakpoint address. */
watch_lo_addr = watch_lo_addr > 6 ? watch_lo_addr - 6 : 0;
per_info.control_regs.words.cr[0]
- |= (PER_EVENT_BRANCH
- | PER_EVENT_IFETCH
+ |= (PER_EVENT_BRANCH | PER_EVENT_IFETCH
| PER_CONTROL_BRANCH_ADDRESS);
}
}
@@ -786,7 +796,7 @@ s390_linux_nat_target::low_prepare_to_resume (struct lwp_info *lp)
per_info.ending_addr = watch_hi_addr;
if (ptrace (PTRACE_POKEUSR_AREA, tid, &parea, 0) < 0)
- perror_with_name (_("Couldn't modify watchpoint status"));
+ perror_with_name (_ ("Couldn't modify watchpoint status"));
if (show_debug_regs)
s390_show_debug_regs (tid, "resume");
@@ -877,16 +887,15 @@ s390_linux_nat_target::remove_watchpoint (CORE_ADDR addr, int len,
}
}
- gdb_printf (gdb_stderr,
- "Attempt to remove nonexistent watchpoint.\n");
+ gdb_printf (gdb_stderr, "Attempt to remove nonexistent watchpoint.\n");
return -1;
}
/* Implement the "can_use_hw_breakpoint" target_ops method. */
int
-s390_linux_nat_target::can_use_hw_breakpoint (enum bptype type,
- int cnt, int othertype)
+s390_linux_nat_target::can_use_hw_breakpoint (enum bptype type, int cnt,
+ int othertype)
{
if (type == bp_hardware_watchpoint || type == bp_hardware_breakpoint)
return 1;
@@ -930,8 +939,7 @@ s390_linux_nat_target::remove_hw_breakpoint (struct gdbarch *gdbarch,
}
}
- gdb_printf (gdb_stderr,
- "Attempt to remove nonexistent breakpoint.\n");
+ gdb_printf (gdb_stderr, "Attempt to remove nonexistent breakpoint.\n");
return -1;
}
@@ -989,10 +997,8 @@ s390_linux_nat_target::read_description ()
{
int tid = inferior_ptid.pid ();
- have_regset_last_break
- = check_regset (tid, NT_S390_LAST_BREAK, 8);
- have_regset_system_call
- = check_regset (tid, NT_S390_SYSTEM_CALL, 4);
+ have_regset_last_break = check_regset (tid, NT_S390_LAST_BREAK, 8);
+ have_regset_system_call = check_regset (tid, NT_S390_SYSTEM_CALL, 4);
/* If GDB itself is compiled as 64-bit, we are running on a machine in
z/Architecture mode. If the target is running in 64-bit addressing
@@ -1003,48 +1009,48 @@ s390_linux_nat_target::read_description ()
{
CORE_ADDR hwcap = linux_get_hwcap ();
- have_regset_tdb = (hwcap & HWCAP_S390_TE)
- && check_regset (tid, NT_S390_TDB, s390_sizeof_tdbregset);
+ have_regset_tdb
+ = (hwcap & HWCAP_S390_TE)
+ && check_regset (tid, NT_S390_TDB, s390_sizeof_tdbregset);
have_regset_vxrs = (hwcap & HWCAP_S390_VX)
- && check_regset (tid, NT_S390_VXRS_LOW, 16 * 8)
- && check_regset (tid, NT_S390_VXRS_HIGH, 16 * 16);
+ && check_regset (tid, NT_S390_VXRS_LOW, 16 * 8)
+ && check_regset (tid, NT_S390_VXRS_HIGH, 16 * 16);
have_regset_gs = (hwcap & HWCAP_S390_GS)
- && check_regset (tid, NT_S390_GS_CB, 4 * 8)
- && check_regset (tid, NT_S390_GS_BC, 4 * 8);
+ && check_regset (tid, NT_S390_GS_CB, 4 * 8)
+ && check_regset (tid, NT_S390_GS_BC, 4 * 8);
if (s390_target_wordsize () == 8)
- return (have_regset_gs ? tdesc_s390x_gs_linux64 :
- have_regset_vxrs ?
- (have_regset_tdb ? tdesc_s390x_tevx_linux64 :
- tdesc_s390x_vx_linux64) :
- have_regset_tdb ? tdesc_s390x_te_linux64 :
- have_regset_system_call ? tdesc_s390x_linux64v2 :
- have_regset_last_break ? tdesc_s390x_linux64v1 :
- tdesc_s390x_linux64);
+ return (have_regset_gs ? tdesc_s390x_gs_linux64
+ : have_regset_vxrs ? (have_regset_tdb ? tdesc_s390x_tevx_linux64
+ : tdesc_s390x_vx_linux64)
+ : have_regset_tdb ? tdesc_s390x_te_linux64
+ : have_regset_system_call ? tdesc_s390x_linux64v2
+ : have_regset_last_break ? tdesc_s390x_linux64v1
+ : tdesc_s390x_linux64);
if (hwcap & HWCAP_S390_HIGH_GPRS)
- return (have_regset_gs ? tdesc_s390_gs_linux64 :
- have_regset_vxrs ?
- (have_regset_tdb ? tdesc_s390_tevx_linux64 :
- tdesc_s390_vx_linux64) :
- have_regset_tdb ? tdesc_s390_te_linux64 :
- have_regset_system_call ? tdesc_s390_linux64v2 :
- have_regset_last_break ? tdesc_s390_linux64v1 :
- tdesc_s390_linux64);
+ return (have_regset_gs ? tdesc_s390_gs_linux64
+ : have_regset_vxrs ? (have_regset_tdb ? tdesc_s390_tevx_linux64
+ : tdesc_s390_vx_linux64)
+ : have_regset_tdb ? tdesc_s390_te_linux64
+ : have_regset_system_call ? tdesc_s390_linux64v2
+ : have_regset_last_break ? tdesc_s390_linux64v1
+ : tdesc_s390_linux64);
}
#endif
/* If GDB itself is compiled as 31-bit, or if we're running a 31-bit inferior
on a 64-bit kernel that does not support using 64-bit registers in 31-bit
mode, report s390 architecture with 32-bit GPRs. */
- return (have_regset_system_call? tdesc_s390_linux32v2 :
- have_regset_last_break? tdesc_s390_linux32v1 :
- tdesc_s390_linux32);
+ return (have_regset_system_call ? tdesc_s390_linux32v2
+ : have_regset_last_break ? tdesc_s390_linux32v1
+ : tdesc_s390_linux32);
}
void _initialize_s390_nat ();
+
void
_initialize_s390_nat ()
{
@@ -1054,14 +1060,14 @@ _initialize_s390_nat ()
/* A maintenance command to enable showing the PER state. */
add_setshow_boolean_cmd ("show-debug-regs", class_maintenance,
- &show_debug_regs, _("\
-Set whether to show the PER (debug) hardware state."), _("\
-Show whether to show the PER (debug) hardware state."), _("\
+ &show_debug_regs, _ ("\
+Set whether to show the PER (debug) hardware state."),
+ _ ("\
+Show whether to show the PER (debug) hardware state."),
+ _ ("\
Use \"on\" to enable, \"off\" to disable.\n\
If enabled, the PER state is shown after it is changed by GDB,\n\
and when the inferior triggers a breakpoint or watchpoint."),
- NULL,
- NULL,
- &maintenance_set_cmdlist,
+ NULL, NULL, &maintenance_set_cmdlist,
&maintenance_show_cmdlist);
}
diff --git a/gdb/s390-linux-tdep.c b/gdb/s390-linux-tdep.c
index 414238a4db2..215ec0726bb 100644
--- a/gdb/s390-linux-tdep.c
+++ b/gdb/s390-linux-tdep.c
@@ -61,7 +61,6 @@
#define XML_SYSCALL_FILENAME_S390 "syscalls/s390-linux.xml"
#define XML_SYSCALL_FILENAME_S390X "syscalls/s390x-linux.xml"
-
/* Register handling. */
/* Implement cannot_store_register gdbarch method. */
@@ -96,95 +95,61 @@ s390_write_pc (struct regcache *regcache, CORE_ADDR pc)
/* Maps for register sets. */
-static const struct regcache_map_entry s390_gregmap[] =
- {
- { 1, S390_PSWM_REGNUM },
- { 1, S390_PSWA_REGNUM },
- { 16, S390_R0_REGNUM },
- { 16, S390_A0_REGNUM },
- { 1, S390_ORIG_R2_REGNUM },
- { 0 }
- };
-
-static const struct regcache_map_entry s390_fpregmap[] =
- {
- { 1, S390_FPC_REGNUM, 8 },
- { 16, S390_F0_REGNUM, 8 },
- { 0 }
- };
-
-static const struct regcache_map_entry s390_regmap_upper[] =
- {
- { 16, S390_R0_UPPER_REGNUM, 4 },
- { 0 }
- };
-
-static const struct regcache_map_entry s390_regmap_last_break[] =
- {
- { 1, REGCACHE_MAP_SKIP, 4 },
- { 1, S390_LAST_BREAK_REGNUM, 4 },
- { 0 }
- };
-
-static const struct regcache_map_entry s390x_regmap_last_break[] =
- {
- { 1, S390_LAST_BREAK_REGNUM, 8 },
- { 0 }
- };
-
-static const struct regcache_map_entry s390_regmap_system_call[] =
- {
- { 1, S390_SYSTEM_CALL_REGNUM, 4 },
- { 0 }
- };
-
-static const struct regcache_map_entry s390_regmap_tdb[] =
- {
- { 1, S390_TDB_DWORD0_REGNUM, 8 },
- { 1, S390_TDB_ABORT_CODE_REGNUM, 8 },
- { 1, S390_TDB_CONFLICT_TOKEN_REGNUM, 8 },
- { 1, S390_TDB_ATIA_REGNUM, 8 },
- { 12, REGCACHE_MAP_SKIP, 8 },
- { 16, S390_TDB_R0_REGNUM, 8 },
- { 0 }
- };
-
-static const struct regcache_map_entry s390_regmap_vxrs_low[] =
- {
- { 16, S390_V0_LOWER_REGNUM, 8 },
- { 0 }
- };
-
-static const struct regcache_map_entry s390_regmap_vxrs_high[] =
- {
- { 16, S390_V16_REGNUM, 16 },
- { 0 }
- };
-
-static const struct regcache_map_entry s390_regmap_gs[] =
- {
- { 1, REGCACHE_MAP_SKIP, 8 },
- { 1, S390_GSD_REGNUM, 8 },
- { 1, S390_GSSM_REGNUM, 8 },
- { 1, S390_GSEPLA_REGNUM, 8 },
- { 0 }
- };
-
-static const struct regcache_map_entry s390_regmap_gsbc[] =
- {
- { 1, REGCACHE_MAP_SKIP, 8 },
- { 1, S390_BC_GSD_REGNUM, 8 },
- { 1, S390_BC_GSSM_REGNUM, 8 },
- { 1, S390_BC_GSEPLA_REGNUM, 8 },
- { 0 }
- };
+static const struct regcache_map_entry s390_gregmap[]
+ = { { 1, S390_PSWM_REGNUM }, { 1, S390_PSWA_REGNUM },
+ { 16, S390_R0_REGNUM }, { 16, S390_A0_REGNUM },
+ { 1, S390_ORIG_R2_REGNUM }, { 0 } };
+
+static const struct regcache_map_entry s390_fpregmap[]
+ = { { 1, S390_FPC_REGNUM, 8 }, { 16, S390_F0_REGNUM, 8 }, { 0 } };
+
+static const struct regcache_map_entry s390_regmap_upper[]
+ = { { 16, S390_R0_UPPER_REGNUM, 4 }, { 0 } };
+
+static const struct regcache_map_entry s390_regmap_last_break[]
+ = { { 1, REGCACHE_MAP_SKIP, 4 }, { 1, S390_LAST_BREAK_REGNUM, 4 }, { 0 } };
+
+static const struct regcache_map_entry s390x_regmap_last_break[]
+ = { { 1, S390_LAST_BREAK_REGNUM, 8 }, { 0 } };
+
+static const struct regcache_map_entry s390_regmap_system_call[]
+ = { { 1, S390_SYSTEM_CALL_REGNUM, 4 }, { 0 } };
+
+static const struct regcache_map_entry s390_regmap_tdb[]
+ = { { 1, S390_TDB_DWORD0_REGNUM, 8 },
+ { 1, S390_TDB_ABORT_CODE_REGNUM, 8 },
+ { 1, S390_TDB_CONFLICT_TOKEN_REGNUM, 8 },
+ { 1, S390_TDB_ATIA_REGNUM, 8 },
+ { 12, REGCACHE_MAP_SKIP, 8 },
+ { 16, S390_TDB_R0_REGNUM, 8 },
+ { 0 } };
+
+static const struct regcache_map_entry s390_regmap_vxrs_low[]
+ = { { 16, S390_V0_LOWER_REGNUM, 8 }, { 0 } };
+
+static const struct regcache_map_entry s390_regmap_vxrs_high[]
+ = { { 16, S390_V16_REGNUM, 16 }, { 0 } };
+
+static const struct regcache_map_entry s390_regmap_gs[]
+ = { { 1, REGCACHE_MAP_SKIP, 8 },
+ { 1, S390_GSD_REGNUM, 8 },
+ { 1, S390_GSSM_REGNUM, 8 },
+ { 1, S390_GSEPLA_REGNUM, 8 },
+ { 0 } };
+
+static const struct regcache_map_entry s390_regmap_gsbc[]
+ = { { 1, REGCACHE_MAP_SKIP, 8 },
+ { 1, S390_BC_GSD_REGNUM, 8 },
+ { 1, S390_BC_GSSM_REGNUM, 8 },
+ { 1, S390_BC_GSEPLA_REGNUM, 8 },
+ { 0 } };
/* Supply the TDB regset. Like regcache_supply_regset, but invalidate
the TDB registers unless the TDB format field is valid. */
static void
s390_supply_tdb_regset (const struct regset *regset, struct regcache *regcache,
- int regnum, const void *regs, size_t len)
+ int regnum, const void *regs, size_t len)
{
ULONGEST tdw;
enum register_status ret;
@@ -195,71 +160,41 @@ s390_supply_tdb_regset (const struct regset *regset, struct regcache *regcache,
regcache_supply_regset (regset, regcache, regnum, NULL, len);
}
-const struct regset s390_gregset = {
- s390_gregmap,
- regcache_supply_regset,
- regcache_collect_regset
-};
+const struct regset s390_gregset
+ = { s390_gregmap, regcache_supply_regset, regcache_collect_regset };
-const struct regset s390_fpregset = {
- s390_fpregmap,
- regcache_supply_regset,
- regcache_collect_regset
-};
+const struct regset s390_fpregset
+ = { s390_fpregmap, regcache_supply_regset, regcache_collect_regset };
-static const struct regset s390_upper_regset = {
- s390_regmap_upper,
- regcache_supply_regset,
- regcache_collect_regset
-};
+static const struct regset s390_upper_regset
+ = { s390_regmap_upper, regcache_supply_regset, regcache_collect_regset };
-const struct regset s390_last_break_regset = {
- s390_regmap_last_break,
- regcache_supply_regset,
- regcache_collect_regset
-};
+const struct regset s390_last_break_regset
+ = { s390_regmap_last_break, regcache_supply_regset,
+ regcache_collect_regset };
-const struct regset s390x_last_break_regset = {
- s390x_regmap_last_break,
- regcache_supply_regset,
- regcache_collect_regset
-};
+const struct regset s390x_last_break_regset
+ = { s390x_regmap_last_break, regcache_supply_regset,
+ regcache_collect_regset };
-const struct regset s390_system_call_regset = {
- s390_regmap_system_call,
- regcache_supply_regset,
- regcache_collect_regset
-};
+const struct regset s390_system_call_regset
+ = { s390_regmap_system_call, regcache_supply_regset,
+ regcache_collect_regset };
-const struct regset s390_tdb_regset = {
- s390_regmap_tdb,
- s390_supply_tdb_regset,
- regcache_collect_regset
-};
+const struct regset s390_tdb_regset
+ = { s390_regmap_tdb, s390_supply_tdb_regset, regcache_collect_regset };
-const struct regset s390_vxrs_low_regset = {
- s390_regmap_vxrs_low,
- regcache_supply_regset,
- regcache_collect_regset
-};
+const struct regset s390_vxrs_low_regset
+ = { s390_regmap_vxrs_low, regcache_supply_regset, regcache_collect_regset };
-const struct regset s390_vxrs_high_regset = {
- s390_regmap_vxrs_high,
- regcache_supply_regset,
- regcache_collect_regset
-};
+const struct regset s390_vxrs_high_regset
+ = { s390_regmap_vxrs_high, regcache_supply_regset, regcache_collect_regset };
-const struct regset s390_gs_regset = {
- s390_regmap_gs,
- regcache_supply_regset,
- regcache_collect_regset
-};
+const struct regset s390_gs_regset
+ = { s390_regmap_gs, regcache_supply_regset, regcache_collect_regset };
-const struct regset s390_gsbc_regset = {
- s390_regmap_gsbc,
- regcache_supply_regset,
- regcache_collect_regset
-};
+const struct regset s390_gsbc_regset
+ = { s390_regmap_gsbc, regcache_supply_regset, regcache_collect_regset };
/* Iterate over supported core file register note sections. */
@@ -270,12 +205,13 @@ s390_iterate_over_regset_sections (struct gdbarch *gdbarch,
const struct regcache *regcache)
{
s390_gdbarch_tdep *tdep = gdbarch_tdep<s390_gdbarch_tdep> (gdbarch);
- const int gregset_size = (tdep->abi == ABI_LINUX_S390 ?
- s390_sizeof_gregset : s390x_sizeof_gregset);
+ const int gregset_size
+ = (tdep->abi == ABI_LINUX_S390 ? s390_sizeof_gregset
+ : s390x_sizeof_gregset);
cb (".reg", gregset_size, gregset_size, &s390_gregset, NULL, cb_data);
- cb (".reg2", s390_sizeof_fpregset, s390_sizeof_fpregset, &s390_fpregset, NULL,
- cb_data);
+ cb (".reg2", s390_sizeof_fpregset, s390_sizeof_fpregset, &s390_fpregset,
+ NULL, cb_data);
if (tdep->abi == ABI_LINUX_S390 && tdep->gpr_full_regnum != -1)
cb (".reg-s390-high-gprs", 16 * 4, 16 * 4, &s390_upper_regset,
@@ -283,8 +219,8 @@ s390_iterate_over_regset_sections (struct gdbarch *gdbarch,
if (tdep->have_linux_v1)
cb (".reg-s390-last-break", 8, 8,
- (gdbarch_ptr_bit (gdbarch) == 32
- ? &s390_last_break_regset : &s390x_last_break_regset),
+ (gdbarch_ptr_bit (gdbarch) == 32 ? &s390_last_break_regset
+ : &s390x_last_break_regset),
"s390 last-break address", cb_data);
if (tdep->have_linux_v2)
@@ -328,8 +264,8 @@ s390_iterate_over_regset_sections (struct gdbarch *gdbarch,
/* Implement core_read_description gdbarch method. */
static const struct target_desc *
-s390_core_read_description (struct gdbarch *gdbarch,
- struct target_ops *target, bfd *abfd)
+s390_core_read_description (struct gdbarch *gdbarch, struct target_ops *target,
+ bfd *abfd)
{
asection *section = bfd_get_section_by_name (abfd, ".reg");
gdb::optional<gdb::byte_vector> auxv = target_read_auxv_raw (target);
@@ -339,8 +275,7 @@ s390_core_read_description (struct gdbarch *gdbarch,
if (!section)
return NULL;
- high_gprs = (bfd_get_section_by_name (abfd, ".reg-s390-high-gprs")
- != NULL);
+ high_gprs = (bfd_get_section_by_name (abfd, ".reg-s390-high-gprs") != NULL);
v1 = (bfd_get_section_by_name (abfd, ".reg-s390-last-break") != NULL);
v2 = (bfd_get_section_by_name (abfd, ".reg-s390-system-call") != NULL);
vx = (hwcap & HWCAP_S390_VX);
@@ -351,23 +286,26 @@ s390_core_read_description (struct gdbarch *gdbarch,
{
case s390_sizeof_gregset:
if (high_gprs)
- return (gs ? tdesc_s390_gs_linux64 :
- te && vx ? tdesc_s390_tevx_linux64 :
- vx ? tdesc_s390_vx_linux64 :
- te ? tdesc_s390_te_linux64 :
- v2 ? tdesc_s390_linux64v2 :
- v1 ? tdesc_s390_linux64v1 : tdesc_s390_linux64);
+ return (gs ? tdesc_s390_gs_linux64
+ : te && vx ? tdesc_s390_tevx_linux64
+ : vx ? tdesc_s390_vx_linux64
+ : te ? tdesc_s390_te_linux64
+ : v2 ? tdesc_s390_linux64v2
+ : v1 ? tdesc_s390_linux64v1
+ : tdesc_s390_linux64);
else
- return (v2 ? tdesc_s390_linux32v2 :
- v1 ? tdesc_s390_linux32v1 : tdesc_s390_linux32);
+ return (v2 ? tdesc_s390_linux32v2
+ : v1 ? tdesc_s390_linux32v1
+ : tdesc_s390_linux32);
case s390x_sizeof_gregset:
- return (gs ? tdesc_s390x_gs_linux64 :
- te && vx ? tdesc_s390x_tevx_linux64 :
- vx ? tdesc_s390x_vx_linux64 :
- te ? tdesc_s390x_te_linux64 :
- v2 ? tdesc_s390x_linux64v2 :
- v1 ? tdesc_s390x_linux64v1 : tdesc_s390x_linux64);
+ return (gs ? tdesc_s390x_gs_linux64
+ : te && vx ? tdesc_s390x_tevx_linux64
+ : vx ? tdesc_s390x_vx_linux64
+ : te ? tdesc_s390x_te_linux64
+ : v2 ? tdesc_s390x_linux64v2
+ : v1 ? tdesc_s390x_linux64v1
+ : tdesc_s390x_linux64);
default:
return NULL;
@@ -378,7 +316,8 @@ s390_core_read_description (struct gdbarch *gdbarch,
/* Signal trampoline stack frames. */
-struct s390_sigtramp_unwind_cache {
+struct s390_sigtramp_unwind_cache
+{
CORE_ADDR frame_base;
trad_frame_saved_reg *saved_regs;
};
@@ -408,7 +347,7 @@ s390_sigtramp_frame_unwind_cache (frame_info_ptr this_frame,
this_sp = get_frame_register_unsigned (this_frame, S390_SP_REGNUM);
next_ra = get_frame_pc (this_frame);
- next_cfa = this_sp + 16*word_size + 32;
+ next_cfa = this_sp + 16 * word_size + 32;
/* New-style RT frame:
retcode + alignment (8 bytes)
@@ -416,7 +355,7 @@ s390_sigtramp_frame_unwind_cache (frame_info_ptr this_frame,
ucontext (contains sigregs at offset 5 words). */
if (next_ra == next_cfa)
{
- sigreg_ptr = next_cfa + 8 + 128 + align_up (5*word_size, 8);
+ sigreg_ptr = next_cfa + 8 + 128 + align_up (5 * word_size, 8);
/* sigregs are followed by uc_sigmask (8 bytes), then by the
upper GPR halves if present. */
sigreg_high_off = 8;
@@ -427,8 +366,8 @@ s390_sigtramp_frame_unwind_cache (frame_info_ptr this_frame,
pointer to sigregs. */
else
{
- sigreg_ptr = read_memory_unsigned_integer (next_cfa + 8,
- word_size, byte_order);
+ sigreg_ptr
+ = read_memory_unsigned_integer (next_cfa + 8, word_size, byte_order);
/* sigregs are followed by signo (4 bytes), then by the
upper GPR halves if present. */
sigreg_high_off = 4;
@@ -484,12 +423,12 @@ s390_sigtramp_frame_unwind_cache (frame_info_ptr this_frame,
}
/* Restore the previous frame's SP. */
- prev_sp = read_memory_unsigned_integer (
- info->saved_regs[S390_SP_REGNUM].addr (),
- word_size, byte_order);
+ prev_sp
+ = read_memory_unsigned_integer (info->saved_regs[S390_SP_REGNUM].addr (),
+ word_size, byte_order);
/* Determine our frame base. */
- info->frame_base = prev_sp + 16*word_size + 32;
+ info->frame_base = prev_sp + 16 * word_size + 32;
return info;
}
@@ -542,15 +481,14 @@ s390_sigtramp_frame_sniffer (const struct frame_unwind *self,
/* S390 sigtramp frame unwinder. */
-static const struct frame_unwind s390_sigtramp_frame_unwind = {
- "s390 linux sigtramp",
- SIGTRAMP_FRAME,
- default_frame_unwind_stop_reason,
- s390_sigtramp_frame_this_id,
- s390_sigtramp_frame_prev_register,
- NULL,
- s390_sigtramp_frame_sniffer
-};
+static const struct frame_unwind s390_sigtramp_frame_unwind
+ = { "s390 linux sigtramp",
+ SIGTRAMP_FRAME,
+ default_frame_unwind_stop_reason,
+ s390_sigtramp_frame_this_id,
+ s390_sigtramp_frame_prev_register,
+ NULL,
+ s390_sigtramp_frame_sniffer };
/* Syscall handling. */
@@ -558,8 +496,7 @@ static const struct frame_unwind s390_sigtramp_frame_unwind = {
upon error. */
static LONGEST
-s390_linux_get_syscall_number (struct gdbarch *gdbarch,
- thread_info *thread)
+s390_linux_get_syscall_number (struct gdbarch *gdbarch, thread_info *thread)
{
struct regcache *regs = get_thread_regcache (thread);
s390_gdbarch_tdep *tdep = gdbarch_tdep<s390_gdbarch_tdep> (gdbarch);
@@ -576,8 +513,8 @@ s390_linux_get_syscall_number (struct gdbarch *gdbarch,
if (opcode != op_svc)
return -1;
- svc_number = read_memory_unsigned_integer ((CORE_ADDR) pc + 1, 1,
- byte_order);
+ svc_number
+ = read_memory_unsigned_integer ((CORE_ADDR) pc + 1, 1, byte_order);
if (svc_number == 0)
regcache_cooked_read_unsigned (regs, S390_R1_REGNUM, &svc_number);
@@ -611,7 +548,8 @@ s390_all_but_pc_registers_record (struct regcache *regcache)
return -1;
if (tdep->v0_full_regnum != -1)
{
- if (record_full_arch_list_add_reg (regcache, S390_V0_LOWER_REGNUM + i))
+ if (record_full_arch_list_add_reg (regcache,
+ S390_V0_LOWER_REGNUM + i))
return -1;
if (record_full_arch_list_add_reg (regcache, S390_V16_REGNUM + i))
return -1;
@@ -640,21 +578,21 @@ s390_canonicalize_syscall (int syscall, enum s390_abi_kind abi)
case 7:
return gdb_sys_restart_syscall;
/* These syscalls work only on 31-bit. */
- case 13: /* time */
- case 16: /* lchown[16] */
- case 23: /* setuid[16] */
- case 24: /* getuid[16] */
- case 25: /* stime */
- case 46: /* setgid[16] */
- case 47: /* getgid[16] */
- case 49: /* seteuid[16] */
- case 50: /* getegid[16] */
- case 70: /* setreuid[16] */
- case 71: /* setregid[16] */
- case 76: /* [old_]getrlimit */
- case 80: /* getgroups[16] */
- case 81: /* setgroups[16] */
- case 95: /* fchown[16] */
+ case 13: /* time */
+ case 16: /* lchown[16] */
+ case 23: /* setuid[16] */
+ case 24: /* getuid[16] */
+ case 25: /* stime */
+ case 46: /* setgid[16] */
+ case 47: /* getgid[16] */
+ case 49: /* seteuid[16] */
+ case 50: /* getegid[16] */
+ case 70: /* setreuid[16] */
+ case 71: /* setregid[16] */
+ case 76: /* [old_]getrlimit */
+ case 80: /* getgroups[16] */
+ case 81: /* setgroups[16] */
+ case 95: /* fchown[16] */
case 101: /* ioperm */
case 138: /* setfsuid[16] */
case 139: /* setfsgid[16] */
@@ -675,22 +613,22 @@ s390_canonicalize_syscall (int syscall, enum s390_abi_kind abi)
return (enum gdb_syscall) syscall;
return gdb_sys_no_syscall;
/* These syscalls don't exist on s390. */
- case 17: /* break */
- case 18: /* oldstat */
- case 28: /* oldfstat */
- case 31: /* stty */
- case 32: /* gtty */
- case 35: /* ftime */
- case 44: /* prof */
- case 53: /* lock */
- case 56: /* mpx */
- case 58: /* ulimit */
- case 59: /* oldolduname */
- case 68: /* sgetmask */
- case 69: /* ssetmask */
- case 82: /* [old_]select */
- case 84: /* oldlstat */
- case 98: /* profil */
+ case 17: /* break */
+ case 18: /* oldstat */
+ case 28: /* oldfstat */
+ case 31: /* stty */
+ case 32: /* gtty */
+ case 35: /* ftime */
+ case 44: /* prof */
+ case 53: /* lock */
+ case 56: /* mpx */
+ case 58: /* ulimit */
+ case 59: /* oldolduname */
+ case 68: /* sgetmask */
+ case 69: /* ssetmask */
+ case 82: /* [old_]select */
+ case 84: /* oldlstat */
+ case 98: /* profil */
case 109: /* olduname */
case 113: /* vm86old */
case 123: /* modify_ldt */
@@ -819,14 +757,13 @@ s390_linux_syscall_record (struct regcache *regcache, LONGEST syscall_native)
if (syscall_gdb < 0)
{
gdb_printf (gdb_stderr,
- _("Process record and replay target doesn't "
- "support syscall number %s\n"),
+ _ ("Process record and replay target doesn't "
+ "support syscall number %s\n"),
plongest (syscall_native));
return -1;
}
- if (syscall_gdb == gdb_sys_sigreturn
- || syscall_gdb == gdb_sys_rt_sigreturn)
+ if (syscall_gdb == gdb_sys_sigreturn || syscall_gdb == gdb_sys_rt_sigreturn)
{
if (s390_all_but_pc_registers_record (regcache))
return -1;
@@ -859,8 +796,9 @@ s390_linux_record_signal (struct gdbarch *gdbarch, struct regcache *regcache,
s390_gdbarch_tdep *tdep = gdbarch_tdep<s390_gdbarch_tdep> (gdbarch);
/* There are two kinds of signal frames on s390. rt_sigframe is always
the larger one, so don't even bother with sigframe. */
- const int sizeof_rt_sigframe = (tdep->abi == ABI_LINUX_ZSERIES ?
- 160 + 8 + 128 + 1024 : 96 + 8 + 128 + 1000);
+ const int sizeof_rt_sigframe
+ = (tdep->abi == ABI_LINUX_ZSERIES ? 160 + 8 + 128 + 1024
+ : 96 + 8 + 128 + 1000);
ULONGEST sp;
int i;
@@ -949,7 +887,7 @@ s390_init_linux_record_tdep (struct linux_record_tdep *record_tdep,
/* stat64 unused */
record_tdep->size_gid_t = 4;
record_tdep->size_uid_t = 4;
- record_tdep->size_PAGE_SIZE = 0x1000; /* 4KB */
+ record_tdep->size_PAGE_SIZE = 0x1000; /* 4KB */
record_tdep->size_flock64 = 32;
record_tdep->size_io_event = 32;
record_tdep->size_iocb = 64;
@@ -1016,7 +954,7 @@ s390_init_linux_record_tdep (struct linux_record_tdep *record_tdep,
record_tdep->size_stat64 = 104;
record_tdep->size_gid_t = 4;
record_tdep->size_uid_t = 4;
- record_tdep->size_PAGE_SIZE = 0x1000; /* 4KB */
+ record_tdep->size_PAGE_SIZE = 0x1000; /* 4KB */
record_tdep->size_flock64 = 32;
record_tdep->size_io_event = 32;
record_tdep->size_iocb = 64;
@@ -1183,6 +1121,7 @@ s390_linux_init_abi_64 (struct gdbarch_info info, struct gdbarch *gdbarch)
}
void _initialize_s390_linux_tdep ();
+
void
_initialize_s390_linux_tdep ()
{
diff --git a/gdb/s390-linux-tdep.h b/gdb/s390-linux-tdep.h
index e89d2c06444..959f23d081c 100644
--- a/gdb/s390-linux-tdep.h
+++ b/gdb/s390-linux-tdep.h
@@ -20,15 +20,15 @@
#ifndef S390_LINUX_TDEP_H
#define S390_LINUX_TDEP_H
-#define S390_IS_GREGSET_REGNUM(i) \
- (((i) >= S390_PSWM_REGNUM && (i) <= S390_A15_REGNUM) \
- || ((i) >= S390_R0_UPPER_REGNUM && (i) <= S390_R15_UPPER_REGNUM) \
+#define S390_IS_GREGSET_REGNUM(i) \
+ (((i) >= S390_PSWM_REGNUM && (i) <= S390_A15_REGNUM) \
+ || ((i) >= S390_R0_UPPER_REGNUM && (i) <= S390_R15_UPPER_REGNUM) \
|| (i) == S390_ORIG_R2_REGNUM)
-#define S390_IS_FPREGSET_REGNUM(i) \
+#define S390_IS_FPREGSET_REGNUM(i) \
((i) >= S390_FPC_REGNUM && (i) <= S390_F15_REGNUM)
-#define S390_IS_TDBREGSET_REGNUM(i) \
+#define S390_IS_TDBREGSET_REGNUM(i) \
((i) >= S390_TDB_DWORD0_REGNUM && (i) <= S390_TDB_R15_REGNUM)
/* Core file register sets, defined in s390-linux-tdep.c. */
diff --git a/gdb/s390-tdep.c b/gdb/s390-tdep.c
index 17933997d8c..d950e095e7d 100644
--- a/gdb/s390-tdep.c
+++ b/gdb/s390-tdep.c
@@ -138,8 +138,7 @@ is_ri (bfd_byte *insn, int op1, int op2, unsigned int *r1, int *i2)
/* Test for RIL instruction format. See comment on is_ri for details. */
static int
-is_ril (bfd_byte *insn, int op1, int op2,
- unsigned int *r1, int *i2)
+is_ril (bfd_byte *insn, int op1, int op2, unsigned int *r1, int *i2)
{
if (insn[0] == op1 && (insn[1] & 0xf) == op2)
{
@@ -147,10 +146,9 @@ is_ril (bfd_byte *insn, int op1, int op2,
/* i2 is a signed quantity. If the host 'int' is 32 bits long,
no sign extension is necessary, but we don't want to assume
that. */
- *i2 = (((insn[2] << 24)
- | (insn[3] << 16)
- | (insn[4] << 8)
- | (insn[5])) ^ 0x80000000) - 0x80000000;
+ *i2 = (((insn[2] << 24) | (insn[3] << 16) | (insn[4] << 8) | (insn[5]))
+ ^ 0x80000000)
+ - 0x80000000;
return 1;
}
else
@@ -191,8 +189,8 @@ is_rre (bfd_byte *insn, int op, unsigned int *r1, unsigned int *r2)
/* Test for RS instruction format. See comment on is_ri for details. */
static int
-is_rs (bfd_byte *insn, int op,
- unsigned int *r1, unsigned int *r3, int *d2, unsigned int *b2)
+is_rs (bfd_byte *insn, int op, unsigned int *r1, unsigned int *r3, int *d2,
+ unsigned int *b2)
{
if (insn[0] == op)
{
@@ -209,18 +207,17 @@ is_rs (bfd_byte *insn, int op,
/* Test for RSY instruction format. See comment on is_ri for details. */
static int
-is_rsy (bfd_byte *insn, int op1, int op2,
- unsigned int *r1, unsigned int *r3, int *d2, unsigned int *b2)
+is_rsy (bfd_byte *insn, int op1, int op2, unsigned int *r1, unsigned int *r3,
+ int *d2, unsigned int *b2)
{
- if (insn[0] == op1
- && insn[5] == op2)
+ if (insn[0] == op1 && insn[5] == op2)
{
*r1 = (insn[1] >> 4) & 0xf;
*r3 = insn[1] & 0xf;
*b2 = (insn[2] >> 4) & 0xf;
/* The 'long displacement' is a 20-bit signed integer. */
- *d2 = ((((insn[2] & 0xf) << 8) | insn[3] | (insn[4] << 12))
- ^ 0x80000) - 0x80000;
+ *d2 = ((((insn[2] & 0xf) << 8) | insn[3] | (insn[4] << 12)) ^ 0x80000)
+ - 0x80000;
return 1;
}
else
@@ -230,8 +227,8 @@ is_rsy (bfd_byte *insn, int op1, int op2,
/* Test for RX instruction format. See comment on is_ri for details. */
static int
-is_rx (bfd_byte *insn, int op,
- unsigned int *r1, int *d2, unsigned int *x2, unsigned int *b2)
+is_rx (bfd_byte *insn, int op, unsigned int *r1, int *d2, unsigned int *x2,
+ unsigned int *b2)
{
if (insn[0] == op)
{
@@ -248,18 +245,17 @@ is_rx (bfd_byte *insn, int op,
/* Test for RXY instruction format. See comment on is_ri for details. */
static int
-is_rxy (bfd_byte *insn, int op1, int op2,
- unsigned int *r1, int *d2, unsigned int *x2, unsigned int *b2)
+is_rxy (bfd_byte *insn, int op1, int op2, unsigned int *r1, int *d2,
+ unsigned int *x2, unsigned int *b2)
{
- if (insn[0] == op1
- && insn[5] == op2)
+ if (insn[0] == op1 && insn[5] == op2)
{
*r1 = (insn[1] >> 4) & 0xf;
*x2 = insn[1] & 0xf;
*b2 = (insn[2] >> 4) & 0xf;
/* The 'long displacement' is a 20-bit signed integer. */
- *d2 = ((((insn[2] & 0xf) << 8) | insn[3] | (insn[4] << 12))
- ^ 0x80000) - 0x80000;
+ *d2 = ((((insn[2] & 0xf) << 8) | insn[3] | (insn[4] << 12)) ^ 0x80000)
+ - 0x80000;
return 1;
}
else
@@ -358,13 +354,13 @@ s390_software_single_step (struct regcache *regcache)
return {};
insn = read_memory_integer (loc + 2, 2, byte_order);
- if (insn != (uint16_t) -(len / 2))
+ if (insn != (uint16_t) - (len / 2))
return {};
loc += 4;
/* Found it, step past the whole thing. */
- return {loc};
+ return { loc };
}
/* Displaced stepping. */
@@ -428,13 +424,12 @@ typedef buf_displaced_step_copy_insn_closure
/* Implementation of gdbarch_displaced_step_copy_insn. */
static displaced_step_copy_insn_closure_up
-s390_displaced_step_copy_insn (struct gdbarch *gdbarch,
- CORE_ADDR from, CORE_ADDR to,
- struct regcache *regs)
+s390_displaced_step_copy_insn (struct gdbarch *gdbarch, CORE_ADDR from,
+ CORE_ADDR to, struct regcache *regs)
{
size_t len = gdbarch_max_insn_length (gdbarch);
- std::unique_ptr<s390_displaced_step_copy_insn_closure> closure
- (new s390_displaced_step_copy_insn_closure (len));
+ std::unique_ptr<s390_displaced_step_copy_insn_closure> closure (
+ new s390_displaced_step_copy_insn_closure (len));
gdb_byte *buf = closure->buf.data ();
read_memory (from, buf, len);
@@ -456,8 +451,10 @@ s390_displaced_step_copy_insn (struct gdbarch *gdbarch,
{
/* Let the core fall back to stepping over the breakpoint
in-line. */
- displaced_debug_printf ("can't displaced step RIL instruction: offset "
- "%s out of range", plongest (offset));
+ displaced_debug_printf (
+ "can't displaced step RIL instruction: offset "
+ "%s out of range",
+ plongest (offset));
return NULL;
}
@@ -467,8 +464,8 @@ s390_displaced_step_copy_insn (struct gdbarch *gdbarch,
write_memory (to, buf, len);
- displaced_debug_printf ("copy %s->%s: %s",
- paddress (gdbarch, from), paddress (gdbarch, to),
+ displaced_debug_printf ("copy %s->%s: %s", paddress (gdbarch, from),
+ paddress (gdbarch, to),
displaced_step_dump_bytes (buf, len).c_str ());
/* This is a work around for a problem with g++ 4.8. */
@@ -481,8 +478,7 @@ s390_displaced_step_copy_insn (struct gdbarch *gdbarch,
static void
s390_displaced_step_fixup (struct gdbarch *gdbarch,
displaced_step_copy_insn_closure *closure_,
- CORE_ADDR from, CORE_ADDR to,
- struct regcache *regs)
+ CORE_ADDR from, CORE_ADDR to, struct regcache *regs)
{
/* Our closure is a copy of the instruction. */
s390_displaced_step_copy_insn_closure *closure
@@ -511,8 +507,7 @@ s390_displaced_step_fixup (struct gdbarch *gdbarch,
/* Handle absolute branch and save instructions. */
int op_basr_p = is_rr (insn, op_basr, &r1, &r2);
- if (op_basr_p
- || is_rx (insn, op_bas, &r1, &d2, &x2, &b2))
+ if (op_basr_p || is_rx (insn, op_bas, &r1, &d2, &x2, &b2))
{
/* Recompute saved return address in R1. */
regcache_cooked_write_unsigned (regs, S390_R0_REGNUM + r1,
@@ -584,8 +579,8 @@ s390_displaced_step_hw_singlestep (struct gdbarch *gdbarch)
/* Prologue analysis. */
-struct s390_prologue_data {
-
+struct s390_prologue_data
+{
/* The stack. */
struct pv_area *stack;
@@ -622,8 +617,8 @@ struct s390_prologue_data {
means that r0 can't be used as either X2 or B2. */
static pv_t
-s390_addr (struct s390_prologue_data *data,
- int d2, unsigned int x2, unsigned int b2)
+s390_addr (struct s390_prologue_data *data, int d2, unsigned int x2,
+ unsigned int b2)
{
pv_t result;
@@ -639,9 +634,8 @@ s390_addr (struct s390_prologue_data *data,
/* Do a SIZE-byte store of VALUE to D2(X2,B2). */
static void
-s390_store (struct s390_prologue_data *data,
- int d2, unsigned int x2, unsigned int b2, CORE_ADDR size,
- pv_t value)
+s390_store (struct s390_prologue_data *data, int d2, unsigned int x2,
+ unsigned int b2, CORE_ADDR size, pv_t value)
{
pv_t addr = s390_addr (data, d2, x2, b2);
pv_t offset;
@@ -650,8 +644,7 @@ s390_store (struct s390_prologue_data *data,
offset = pv_subtract (data->gpr[S390_SP_REGNUM - S390_R0_REGNUM], addr);
if (pv_is_constant (offset) && offset.k == 0)
- if (size == data->gpr_size
- && pv_is_register_k (value, S390_SP_REGNUM, 0))
+ if (size == data->gpr_size && pv_is_register_k (value, S390_SP_REGNUM, 0))
{
data->back_chain_saved_p = 1;
return;
@@ -672,8 +665,8 @@ s390_store (struct s390_prologue_data *data,
/* Do a SIZE-byte load from D2(X2,B2). */
static pv_t
-s390_load (struct s390_prologue_data *data,
- int d2, unsigned int x2, unsigned int b2, CORE_ADDR size)
+s390_load (struct s390_prologue_data *data, int d2, unsigned int x2,
+ unsigned int b2, CORE_ADDR size)
{
pv_t addr = s390_addr (data, d2, x2, b2);
@@ -706,8 +699,8 @@ s390_load (struct s390_prologue_data *data,
PROLOGUE_UNTYPED. */
static void
-s390_check_for_saved (void *data_untyped, pv_t addr,
- CORE_ADDR size, pv_t value)
+s390_check_for_saved (void *data_untyped, pv_t addr, CORE_ADDR size,
+ pv_t value)
{
struct s390_prologue_data *data = (struct s390_prologue_data *) data_untyped;
int i, offset;
@@ -724,8 +717,7 @@ s390_check_for_saved (void *data_untyped, pv_t addr,
for (i = 0; i < S390_NUM_GPRS; i++)
if (size == data->gpr_size
&& pv_is_register_k (value, S390_R0_REGNUM + i, 0))
- if (data->gpr_slot[i] == 0
- || data->gpr_slot[i] > offset)
+ if (data->gpr_slot[i] == 0 || data->gpr_slot[i] > offset)
{
data->gpr_slot[i] = offset;
return;
@@ -734,8 +726,7 @@ s390_check_for_saved (void *data_untyped, pv_t addr,
for (i = 0; i < S390_NUM_FPRS; i++)
if (size == data->fpr_size
&& pv_is_register_k (value, S390_F0_REGNUM + i, 0))
- if (data->fpr_slot[i] == 0
- || data->fpr_slot[i] > offset)
+ if (data->fpr_slot[i] == 0 || data->fpr_slot[i] > offset)
{
data->fpr_slot[i] = offset;
return;
@@ -749,10 +740,8 @@ s390_check_for_saved (void *data_untyped, pv_t addr,
chain; or zero on error. */
static CORE_ADDR
-s390_analyze_prologue (struct gdbarch *gdbarch,
- CORE_ADDR start_pc,
- CORE_ADDR current_pc,
- struct s390_prologue_data *data)
+s390_analyze_prologue (struct gdbarch *gdbarch, CORE_ADDR start_pc,
+ CORE_ADDR current_pc, struct s390_prologue_data *data)
{
int word_size = gdbarch_ptr_bit (gdbarch) / 8;
@@ -789,10 +778,10 @@ s390_analyze_prologue (struct gdbarch *gdbarch,
data->fpr[i] = pv_register (S390_F0_REGNUM + i, 0);
for (i = 0; i < S390_NUM_GPRS; i++)
- data->gpr_slot[i] = 0;
+ data->gpr_slot[i] = 0;
for (i = 0; i < S390_NUM_FPRS; i++)
- data->fpr_slot[i] = 0;
+ data->fpr_slot[i] = 0;
data->back_chain_saved_p = 0;
}
@@ -891,8 +880,8 @@ s390_analyze_prologue (struct gdbarch *gdbarch,
/* ALGFI r1, i2 --- add logical immediate (64-bit version). */
else if (is_ril (insn32, op1_alfi, op2_alfi, &r1, &i2)
|| is_ril (insn64, op1_algfi, op2_algfi, &r1, &i2))
- data->gpr[r1] = pv_add_constant (data->gpr[r1],
- (CORE_ADDR)i2 & 0xffffffff);
+ data->gpr[r1]
+ = pv_add_constant (data->gpr[r1], (CORE_ADDR) i2 & 0xffffffff);
/* AR r1, r2 -- add register. */
/* AGR r1, r2 -- add register (64-bit version). */
@@ -913,8 +902,8 @@ s390_analyze_prologue (struct gdbarch *gdbarch,
/* SLGFI r1, i2 --- subtract logical immediate (64-bit version). */
else if (is_ril (insn32, op1_slfi, op2_slfi, &r1, &i2)
|| is_ril (insn64, op1_slgfi, op2_slgfi, &r1, &i2))
- data->gpr[r1] = pv_add_constant (data->gpr[r1],
- -((CORE_ADDR)i2 & 0xffffffff));
+ data->gpr[r1]
+ = pv_add_constant (data->gpr[r1], -((CORE_ADDR) i2 & 0xffffffff));
/* SR r1, r2 -- subtract register. */
/* SGR r1, r2 -- subtract register (64-bit version). */
@@ -928,8 +917,9 @@ s390_analyze_prologue (struct gdbarch *gdbarch,
else if (is_rx (insn32, op_s, &r1, &d2, &x2, &b2)
|| is_rxy (insn32, op1_sy, op2_sy, &r1, &d2, &x2, &b2)
|| is_rxy (insn64, op1_sg, op2_sg, &r1, &d2, &x2, &b2))
- data->gpr[r1] = pv_subtract (data->gpr[r1],
- s390_load (data, d2, x2, b2, data->gpr_size));
+ data->gpr[r1]
+ = pv_subtract (data->gpr[r1],
+ s390_load (data, d2, x2, b2, data->gpr_size));
/* LA r1, d2(x2, b2) --- load address. */
/* LAY r1, d2(x2, b2) --- load address (long-displacement version). */
@@ -943,8 +933,7 @@ s390_analyze_prologue (struct gdbarch *gdbarch,
/* BASR r1, 0 --- branch and save.
Since r2 is zero, this saves the PC in r1, but doesn't branch. */
- else if (is_rr (insn, op_basr, &r1, &r2)
- && r2 == 0)
+ else if (is_rr (insn, op_basr, &r1, &r2) && r2 == 0)
data->gpr[r1] = pv_constant (next_pc);
/* BRAS r1, i2 --- branch relative and save. */
@@ -1000,11 +989,11 @@ s390_analyze_prologue (struct gdbarch *gdbarch,
pv_t sp = data->gpr[S390_SP_REGNUM - S390_R0_REGNUM];
pv_t fp = data->gpr[S390_FRAME_REGNUM - S390_R0_REGNUM];
- if ((! pv_is_identical (pre_insn_sp, sp)
- && ! pv_is_register_k (sp, S390_SP_REGNUM, 0)
+ if ((!pv_is_identical (pre_insn_sp, sp)
+ && !pv_is_register_k (sp, S390_SP_REGNUM, 0)
&& sp.kind != pvk_unknown)
- || (! pv_is_identical (pre_insn_fp, fp)
- && ! pv_is_register_k (fp, S390_FRAME_REGNUM, 0)
+ || (!pv_is_identical (pre_insn_fp, fp)
+ && !pv_is_register_k (fp, S390_FRAME_REGNUM, 0)
&& fp.kind != pvk_unknown)
|| pre_insn_back_chain_saved_p != data->back_chain_saved_p)
result = next_pc;
@@ -1034,7 +1023,7 @@ s390_skip_prologue (struct gdbarch *gdbarch, CORE_ADDR pc)
return std::max (pc, post_prologue_pc);
}
- skip_pc = s390_analyze_prologue (gdbarch, pc, (CORE_ADDR)-1, &data);
+ skip_pc = s390_analyze_prologue (gdbarch, pc, (CORE_ADDR) -1, &data);
return skip_pc ? skip_pc : pc;
}
@@ -1073,8 +1062,7 @@ s390_register_call_saved (struct gdbarch *gdbarch, int regnum)
static void
s390_guess_tracepoint_registers (struct gdbarch *gdbarch,
- struct regcache *regcache,
- CORE_ADDR addr)
+ struct regcache *regcache, CORE_ADDR addr)
{
s390_gdbarch_tdep *tdep = gdbarch_tdep<s390_gdbarch_tdep> (gdbarch);
int sz = register_size (gdbarch, S390_PSWA_REGNUM);
@@ -1109,62 +1097,138 @@ s390_guess_tracepoint_registers (struct gdbarch *gdbarch,
static const char *
s390_register_name (struct gdbarch *gdbarch, int regnum)
{
- if (regnum >= S390_V0_LOWER_REGNUM
- && regnum <= S390_V15_LOWER_REGNUM)
+ if (regnum >= S390_V0_LOWER_REGNUM && regnum <= S390_V15_LOWER_REGNUM)
return "";
return tdesc_register_name (gdbarch, regnum);
}
/* DWARF Register Mapping. */
-static const short s390_dwarf_regmap[] =
-{
+static const short s390_dwarf_regmap[] = {
/* 0-15: General Purpose Registers. */
- S390_R0_REGNUM, S390_R1_REGNUM, S390_R2_REGNUM, S390_R3_REGNUM,
- S390_R4_REGNUM, S390_R5_REGNUM, S390_R6_REGNUM, S390_R7_REGNUM,
- S390_R8_REGNUM, S390_R9_REGNUM, S390_R10_REGNUM, S390_R11_REGNUM,
- S390_R12_REGNUM, S390_R13_REGNUM, S390_R14_REGNUM, S390_R15_REGNUM,
+ S390_R0_REGNUM,
+ S390_R1_REGNUM,
+ S390_R2_REGNUM,
+ S390_R3_REGNUM,
+ S390_R4_REGNUM,
+ S390_R5_REGNUM,
+ S390_R6_REGNUM,
+ S390_R7_REGNUM,
+ S390_R8_REGNUM,
+ S390_R9_REGNUM,
+ S390_R10_REGNUM,
+ S390_R11_REGNUM,
+ S390_R12_REGNUM,
+ S390_R13_REGNUM,
+ S390_R14_REGNUM,
+ S390_R15_REGNUM,
/* 16-31: Floating Point Registers / Vector Registers 0-15. */
- S390_F0_REGNUM, S390_F2_REGNUM, S390_F4_REGNUM, S390_F6_REGNUM,
- S390_F1_REGNUM, S390_F3_REGNUM, S390_F5_REGNUM, S390_F7_REGNUM,
- S390_F8_REGNUM, S390_F10_REGNUM, S390_F12_REGNUM, S390_F14_REGNUM,
- S390_F9_REGNUM, S390_F11_REGNUM, S390_F13_REGNUM, S390_F15_REGNUM,
+ S390_F0_REGNUM,
+ S390_F2_REGNUM,
+ S390_F4_REGNUM,
+ S390_F6_REGNUM,
+ S390_F1_REGNUM,
+ S390_F3_REGNUM,
+ S390_F5_REGNUM,
+ S390_F7_REGNUM,
+ S390_F8_REGNUM,
+ S390_F10_REGNUM,
+ S390_F12_REGNUM,
+ S390_F14_REGNUM,
+ S390_F9_REGNUM,
+ S390_F11_REGNUM,
+ S390_F13_REGNUM,
+ S390_F15_REGNUM,
/* 32-47: Control Registers (not mapped). */
- -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
/* 48-63: Access Registers. */
- S390_A0_REGNUM, S390_A1_REGNUM, S390_A2_REGNUM, S390_A3_REGNUM,
- S390_A4_REGNUM, S390_A5_REGNUM, S390_A6_REGNUM, S390_A7_REGNUM,
- S390_A8_REGNUM, S390_A9_REGNUM, S390_A10_REGNUM, S390_A11_REGNUM,
- S390_A12_REGNUM, S390_A13_REGNUM, S390_A14_REGNUM, S390_A15_REGNUM,
+ S390_A0_REGNUM,
+ S390_A1_REGNUM,
+ S390_A2_REGNUM,
+ S390_A3_REGNUM,
+ S390_A4_REGNUM,
+ S390_A5_REGNUM,
+ S390_A6_REGNUM,
+ S390_A7_REGNUM,
+ S390_A8_REGNUM,
+ S390_A9_REGNUM,
+ S390_A10_REGNUM,
+ S390_A11_REGNUM,
+ S390_A12_REGNUM,
+ S390_A13_REGNUM,
+ S390_A14_REGNUM,
+ S390_A15_REGNUM,
/* 64-65: Program Status Word. */
S390_PSWM_REGNUM,
S390_PSWA_REGNUM,
/* 66-67: Reserved. */
- -1, -1,
+ -1,
+ -1,
/* 68-83: Vector Registers 16-31. */
- S390_V16_REGNUM, S390_V18_REGNUM, S390_V20_REGNUM, S390_V22_REGNUM,
- S390_V17_REGNUM, S390_V19_REGNUM, S390_V21_REGNUM, S390_V23_REGNUM,
- S390_V24_REGNUM, S390_V26_REGNUM, S390_V28_REGNUM, S390_V30_REGNUM,
- S390_V25_REGNUM, S390_V27_REGNUM, S390_V29_REGNUM, S390_V31_REGNUM,
+ S390_V16_REGNUM,
+ S390_V18_REGNUM,
+ S390_V20_REGNUM,
+ S390_V22_REGNUM,
+ S390_V17_REGNUM,
+ S390_V19_REGNUM,
+ S390_V21_REGNUM,
+ S390_V23_REGNUM,
+ S390_V24_REGNUM,
+ S390_V26_REGNUM,
+ S390_V28_REGNUM,
+ S390_V30_REGNUM,
+ S390_V25_REGNUM,
+ S390_V27_REGNUM,
+ S390_V29_REGNUM,
+ S390_V31_REGNUM,
/* End of "official" DWARF registers. The remainder of the map is
for GDB internal use only. */
/* GPR Lower Half Access. */
- S390_R0_REGNUM, S390_R1_REGNUM, S390_R2_REGNUM, S390_R3_REGNUM,
- S390_R4_REGNUM, S390_R5_REGNUM, S390_R6_REGNUM, S390_R7_REGNUM,
- S390_R8_REGNUM, S390_R9_REGNUM, S390_R10_REGNUM, S390_R11_REGNUM,
- S390_R12_REGNUM, S390_R13_REGNUM, S390_R14_REGNUM, S390_R15_REGNUM,
+ S390_R0_REGNUM,
+ S390_R1_REGNUM,
+ S390_R2_REGNUM,
+ S390_R3_REGNUM,
+ S390_R4_REGNUM,
+ S390_R5_REGNUM,
+ S390_R6_REGNUM,
+ S390_R7_REGNUM,
+ S390_R8_REGNUM,
+ S390_R9_REGNUM,
+ S390_R10_REGNUM,
+ S390_R11_REGNUM,
+ S390_R12_REGNUM,
+ S390_R13_REGNUM,
+ S390_R14_REGNUM,
+ S390_R15_REGNUM,
};
-enum { s390_dwarf_reg_r0l = ARRAY_SIZE (s390_dwarf_regmap) - 16 };
+enum
+{
+ s390_dwarf_reg_r0l = ARRAY_SIZE (s390_dwarf_regmap) - 16
+};
/* Convert DWARF register number REG to the appropriate register
number used by GDB. */
@@ -1207,8 +1271,7 @@ s390_dwarf_reg_to_regnum (struct gdbarch *gdbarch, int reg)
static int
regnum_is_gpr_full (s390_gdbarch_tdep *tdep, int regnum)
{
- return (tdep->gpr_full_regnum != -1
- && regnum >= tdep->gpr_full_regnum
+ return (tdep->gpr_full_regnum != -1 && regnum >= tdep->gpr_full_regnum
&& regnum <= tdep->gpr_full_regnum + 15);
}
@@ -1218,8 +1281,7 @@ regnum_is_gpr_full (s390_gdbarch_tdep *tdep, int regnum)
static int
regnum_is_vxr_full (s390_gdbarch_tdep *tdep, int regnum)
{
- return (tdep->v0_full_regnum != -1
- && regnum >= tdep->v0_full_regnum
+ return (tdep->v0_full_regnum != -1 && regnum >= tdep->v0_full_regnum
&& regnum <= tdep->v0_full_regnum + 15);
}
@@ -1232,8 +1294,8 @@ s390_value_from_register (struct gdbarch *gdbarch, struct type *type,
int regnum, struct frame_id frame_id)
{
s390_gdbarch_tdep *tdep = gdbarch_tdep<s390_gdbarch_tdep> (gdbarch);
- struct value *value = default_value_from_register (gdbarch, type,
- regnum, frame_id);
+ struct value *value
+ = default_value_from_register (gdbarch, type, regnum, frame_id);
check_typedef (type);
if ((regnum >= S390_F0_REGNUM && regnum <= S390_F15_REGNUM
@@ -1260,23 +1322,21 @@ s390_pseudo_register_name (struct gdbarch *gdbarch, int regnum)
if (regnum_is_gpr_full (tdep, regnum))
{
- static const char *full_name[] = {
- "r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7",
- "r8", "r9", "r10", "r11", "r12", "r13", "r14", "r15"
- };
+ static const char *full_name[]
+ = { "r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7",
+ "r8", "r9", "r10", "r11", "r12", "r13", "r14", "r15" };
return full_name[regnum - tdep->gpr_full_regnum];
}
if (regnum_is_vxr_full (tdep, regnum))
{
- static const char *full_name[] = {
- "v0", "v1", "v2", "v3", "v4", "v5", "v6", "v7",
- "v8", "v9", "v10", "v11", "v12", "v13", "v14", "v15"
- };
+ static const char *full_name[]
+ = { "v0", "v1", "v2", "v3", "v4", "v5", "v6", "v7",
+ "v8", "v9", "v10", "v11", "v12", "v13", "v14", "v15" };
return full_name[regnum - tdep->v0_full_regnum];
}
- internal_error (_("invalid regnum"));
+ internal_error (_ ("invalid regnum"));
}
/* Implement pseudo_register_type tdesc method. */
@@ -1299,14 +1359,15 @@ s390_pseudo_register_type (struct gdbarch *gdbarch, int regnum)
if (regnum_is_vxr_full (tdep, regnum))
return tdesc_register_type (gdbarch, S390_V16_REGNUM);
- internal_error (_("invalid regnum"));
+ internal_error (_ ("invalid regnum"));
}
/* Implement pseudo_register_read gdbarch method. */
static enum register_status
-s390_pseudo_register_read (struct gdbarch *gdbarch, readable_regcache *regcache,
- int regnum, gdb_byte *buf)
+s390_pseudo_register_read (struct gdbarch *gdbarch,
+ readable_regcache *regcache, int regnum,
+ gdb_byte *buf)
{
s390_gdbarch_tdep *tdep = gdbarch_tdep<s390_gdbarch_tdep> (gdbarch);
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
@@ -1352,8 +1413,8 @@ s390_pseudo_register_read (struct gdbarch *gdbarch, readable_regcache *regcache,
status = regcache->raw_read (S390_R0_REGNUM + regnum, &val);
if (status == REG_VALID)
- status = regcache->raw_read (S390_R0_UPPER_REGNUM + regnum,
- &val_upper);
+ status
+ = regcache->raw_read (S390_R0_UPPER_REGNUM + regnum, &val_upper);
if (status == REG_VALID)
{
val |= val_upper << 32;
@@ -1374,7 +1435,7 @@ s390_pseudo_register_read (struct gdbarch *gdbarch, readable_regcache *regcache,
return status;
}
- internal_error (_("invalid regnum"));
+ internal_error (_ ("invalid regnum"));
}
/* Implement pseudo_register_write gdbarch method. */
@@ -1405,9 +1466,9 @@ s390_pseudo_register_write (struct gdbarch *gdbarch, struct regcache *regcache,
val = extract_unsigned_integer (buf, regsize, byte_order);
regcache_raw_read_unsigned (regcache, S390_PSWM_REGNUM, &psw);
if (register_size (gdbarch, S390_PSWA_REGNUM) == 4)
- val = (psw & ~((ULONGEST)3 << 12)) | ((val & 3) << 12);
+ val = (psw & ~((ULONGEST) 3 << 12)) | ((val & 3) << 12);
else
- val = (psw & ~((ULONGEST)3 << 44)) | ((val & 3) << 44);
+ val = (psw & ~((ULONGEST) 3 << 44)) | ((val & 3) << 44);
regcache_raw_write_unsigned (regcache, S390_PSWM_REGNUM, val);
return;
}
@@ -1431,7 +1492,7 @@ s390_pseudo_register_write (struct gdbarch *gdbarch, struct regcache *regcache,
return;
}
- internal_error (_("invalid regnum"));
+ internal_error (_ ("invalid regnum"));
}
/* Register groups. */
@@ -1493,7 +1554,7 @@ s390_ax_pseudo_register_collect (struct gdbarch *gdbarch,
}
else
{
- internal_error (_("invalid regnum"));
+ internal_error (_ ("invalid regnum"));
}
return 0;
}
@@ -1539,7 +1600,7 @@ s390_ax_pseudo_register_push_stack (struct gdbarch *gdbarch,
}
else
{
- internal_error (_("invalid regnum"));
+ internal_error (_ ("invalid regnum"));
}
return 0;
}
@@ -1549,9 +1610,8 @@ s390_ax_pseudo_register_push_stack (struct gdbarch *gdbarch,
the full unwinder here, just collect the link register. */
static void
-s390_gen_return_address (struct gdbarch *gdbarch,
- struct agent_expr *ax, struct axs_value *value,
- CORE_ADDR scope)
+s390_gen_return_address (struct gdbarch *gdbarch, struct agent_expr *ax,
+ struct axs_value *value, CORE_ADDR scope)
{
value->type = register_type (gdbarch, S390_R14_REGNUM);
value->kind = axs_lvalue_register;
@@ -1710,12 +1770,9 @@ s390_function_arg_integer (struct type *type)
if (type->length () > 8)
return 0;
- if (code == TYPE_CODE_INT
- || code == TYPE_CODE_ENUM
- || code == TYPE_CODE_RANGE
- || code == TYPE_CODE_CHAR
- || code == TYPE_CODE_BOOL
- || code == TYPE_CODE_PTR
+ if (code == TYPE_CODE_INT || code == TYPE_CODE_ENUM
+ || code == TYPE_CODE_RANGE || code == TYPE_CODE_CHAR
+ || code == TYPE_CODE_BOOL || code == TYPE_CODE_PTR
|| TYPE_IS_REFERENCE (type))
return 1;
@@ -1727,17 +1784,17 @@ s390_function_arg_integer (struct type *type)
routines of s390_push_dummy_call. */
struct s390_arg_state
- {
- /* Register cache, or NULL, if we are in "preparation mode". */
- struct regcache *regcache;
- /* Next available general/floating-point/vector register for
+{
+ /* Register cache, or NULL, if we are in "preparation mode". */
+ struct regcache *regcache;
+ /* Next available general/floating-point/vector register for
argument passing. */
- int gr, fr, vr;
- /* Current pointer to copy area (grows downwards). */
- CORE_ADDR copy;
- /* Current pointer to parameter area (grows upwards). */
- CORE_ADDR argp;
- };
+ int gr, fr, vr;
+ /* Current pointer to copy area (grows downwards). */
+ CORE_ADDR copy;
+ /* Current pointer to parameter area (grows upwards). */
+ CORE_ADDR argp;
+};
/* Prepare one argument ARG for a dummy call and update the argument
passing state AS accordingly. If the regcache field in AS is set,
@@ -1763,7 +1820,8 @@ s390_handle_arg (struct s390_arg_state *as, struct value *arg,
/* When we store a single-precision value in an FP register,
it occupies the leftmost bits. */
if (write_mode)
- as->regcache->cooked_write_part (S390_F0_REGNUM + as->fr, 0, length,
+ as->regcache->cooked_write_part (S390_F0_REGNUM + as->fr, 0,
+ length,
value_contents (arg).data ());
as->fr += 2;
}
@@ -1780,7 +1838,7 @@ s390_handle_arg (struct s390_arg_state *as, struct value *arg,
else if (tdep->vector_abi == S390_VECTOR_ABI_128
&& s390_function_arg_vector (type))
{
- static const char use_vr[] = {24, 26, 28, 30, 25, 27, 29, 31};
+ static const char use_vr[] = { 24, 26, 28, 30, 25, 27, 29, 31 };
if (!is_unnamed && as->vr < ARRAY_SIZE (use_vr))
{
@@ -1809,25 +1867,24 @@ s390_handle_arg (struct s390_arg_state *as, struct value *arg,
memory word and sign- or zero-extend to full word size.
This also applies to a struct or union. */
val = type->is_unsigned ()
- ? extract_unsigned_integer (value_contents (arg).data (),
- length, byte_order)
- : extract_signed_integer (value_contents (arg).data (),
- length, byte_order);
+ ? extract_unsigned_integer (value_contents (arg).data (),
+ length, byte_order)
+ : extract_signed_integer (value_contents (arg).data (),
+ length, byte_order);
}
if (as->gr <= 6)
{
if (write_mode)
regcache_cooked_write_unsigned (as->regcache,
- S390_R0_REGNUM + as->gr,
- val);
+ S390_R0_REGNUM + as->gr, val);
as->gr++;
}
else
{
if (write_mode)
- write_memory_unsigned_integer (as->argp, word_size,
- byte_order, val);
+ write_memory_unsigned_integer (as->argp, word_size, byte_order,
+ val);
as->argp += word_size;
}
}
@@ -1839,9 +1896,9 @@ s390_handle_arg (struct s390_arg_state *as, struct value *arg,
{
as->regcache->cooked_write (S390_R0_REGNUM + as->gr,
value_contents (arg).data ());
- as->regcache->cooked_write
- (S390_R0_REGNUM + as->gr + 1,
- value_contents (arg).data () + word_size);
+ as->regcache->cooked_write (S390_R0_REGNUM + as->gr + 1,
+ value_contents (arg).data ()
+ + word_size);
}
as->gr += 2;
}
@@ -1869,15 +1926,14 @@ s390_handle_arg (struct s390_arg_state *as, struct value *arg,
{
if (write_mode)
regcache_cooked_write_unsigned (as->regcache,
- S390_R0_REGNUM + as->gr,
- as->copy);
+ S390_R0_REGNUM + as->gr, as->copy);
as->gr++;
}
else
{
if (write_mode)
- write_memory_unsigned_integer (as->argp, word_size,
- byte_order, as->copy);
+ write_memory_unsigned_integer (as->argp, word_size, byte_order,
+ as->copy);
as->argp += word_size;
}
}
@@ -1900,8 +1956,8 @@ s390_handle_arg (struct s390_arg_state *as, struct value *arg,
static CORE_ADDR
s390_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
- struct regcache *regcache, CORE_ADDR bp_addr,
- int nargs, struct value **args, CORE_ADDR sp,
+ struct regcache *regcache, CORE_ADDR bp_addr, int nargs,
+ struct value **args, CORE_ADDR sp,
function_call_return_method return_method,
CORE_ADDR struct_addr)
{
@@ -1943,7 +1999,7 @@ s390_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
high bit set, which causes confusion elsewhere. Note that if we
error out here, stack and registers remain untouched. */
if (gdbarch_addr_bits_remove (gdbarch, new_sp) != new_sp)
- error (_("Stack overflow"));
+ error (_ ("Stack overflow"));
/* Pass the structure return address in general register 2. */
if (return_method == return_method_struct)
@@ -1988,8 +2044,7 @@ s390_dummy_id (struct gdbarch *gdbarch, frame_info_ptr this_frame)
CORE_ADDR sp = get_frame_register_unsigned (this_frame, S390_SP_REGNUM);
sp = gdbarch_addr_bits_remove (gdbarch, sp);
- return frame_id_build (sp + 16*word_size + 32,
- get_frame_pc (this_frame));
+ return frame_id_build (sp + 16 * word_size + 32, get_frame_pc (this_frame));
}
/* Implement frame_align gdbarch method. */
@@ -2007,8 +2062,8 @@ s390_frame_align (struct gdbarch *gdbarch, CORE_ADDR addr)
static void
s390_register_return_value (struct gdbarch *gdbarch, struct type *type,
- struct regcache *regcache,
- gdb_byte *out, const gdb_byte *in)
+ struct regcache *regcache, gdb_byte *out,
+ const gdb_byte *in)
{
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
int word_size = gdbarch_ptr_bit (gdbarch) / 8;
@@ -2038,13 +2093,13 @@ s390_register_return_value (struct gdbarch *gdbarch, struct type *type,
regcache->cooked_read_part (S390_R2_REGNUM, word_size - length, length,
out);
else if (type->is_unsigned ())
- regcache_cooked_write_unsigned
- (regcache, S390_R2_REGNUM,
- extract_unsigned_integer (in, length, byte_order));
+ regcache_cooked_write_unsigned (regcache, S390_R2_REGNUM,
+ extract_unsigned_integer (in, length,
+ byte_order));
else
- regcache_cooked_write_signed
- (regcache, S390_R2_REGNUM,
- extract_signed_integer (in, length, byte_order));
+ regcache_cooked_write_signed (regcache, S390_R2_REGNUM,
+ extract_signed_integer (in, length,
+ byte_order));
}
else if (length == 2 * word_size)
{
@@ -2061,15 +2116,15 @@ s390_register_return_value (struct gdbarch *gdbarch, struct type *type,
}
}
else
- internal_error (_("invalid return type"));
+ internal_error (_ ("invalid return type"));
}
/* Implement the 'return_value' gdbarch method. */
static enum return_value_convention
s390_return_value (struct gdbarch *gdbarch, struct value *function,
- struct type *type, struct regcache *regcache,
- gdb_byte *out, const gdb_byte *in)
+ struct type *type, struct regcache *regcache, gdb_byte *out,
+ const gdb_byte *in)
{
enum return_value_convention rvc;
@@ -2085,16 +2140,15 @@ s390_return_value (struct gdbarch *gdbarch, struct value *function,
case TYPE_CODE_ARRAY:
{
s390_gdbarch_tdep *tdep = gdbarch_tdep<s390_gdbarch_tdep> (gdbarch);
- rvc = (tdep->vector_abi == S390_VECTOR_ABI_128
- && type->length () <= 16 && type->is_vector ())
- ? RETURN_VALUE_REGISTER_CONVENTION
- : RETURN_VALUE_STRUCT_CONVENTION;
+ rvc = (tdep->vector_abi == S390_VECTOR_ABI_128 && type->length () <= 16
+ && type->is_vector ())
+ ? RETURN_VALUE_REGISTER_CONVENTION
+ : RETURN_VALUE_STRUCT_CONVENTION;
break;
}
default:
- rvc = type->length () <= 8
- ? RETURN_VALUE_REGISTER_CONVENTION
- : RETURN_VALUE_STRUCT_CONVENTION;
+ rvc = type->length () <= 8 ? RETURN_VALUE_REGISTER_CONVENTION
+ : RETURN_VALUE_STRUCT_CONVENTION;
}
if (in != NULL || out != NULL)
@@ -2102,9 +2156,9 @@ s390_return_value (struct gdbarch *gdbarch, struct value *function,
if (rvc == RETURN_VALUE_REGISTER_CONVENTION)
s390_register_return_value (gdbarch, type, regcache, out, in);
else if (in != NULL)
- error (_("Cannot set function return value."));
+ error (_ ("Cannot set function return value."));
else
- error (_("Function return value unknown."));
+ error (_ ("Function return value unknown."));
}
return rvc;
@@ -2142,20 +2196,17 @@ s390_stack_frame_destroyed_p (struct gdbarch *gdbarch, CORE_ADDR pc)
unsigned int r1, r3, b2;
int d2;
- if (word_size == 4
- && !target_read_memory (pc - 4, insn, 4)
+ if (word_size == 4 && !target_read_memory (pc - 4, insn, 4)
&& is_rs (insn, op_lm, &r1, &r3, &d2, &b2)
&& r3 == S390_SP_REGNUM - S390_R0_REGNUM)
return 1;
- if (word_size == 4
- && !target_read_memory (pc - 6, insn, 6)
+ if (word_size == 4 && !target_read_memory (pc - 6, insn, 6)
&& is_rsy (insn, op1_lmy, op2_lmy, &r1, &r3, &d2, &b2)
&& r3 == S390_SP_REGNUM - S390_R0_REGNUM)
return 1;
- if (word_size == 8
- && !target_read_memory (pc - 6, insn, 6)
+ if (word_size == 8 && !target_read_memory (pc - 6, insn, 6)
&& is_rsy (insn, op1_lmg, op2_lmg, &r1, &r3, &d2, &b2)
&& r3 == S390_SP_REGNUM - S390_R0_REGNUM)
return 1;
@@ -2304,8 +2355,7 @@ s390_dwarf2_frame_init_reg (struct gdbarch *gdbarch, int regnum,
struct value *
s390_trad_frame_prev_register (frame_info_ptr this_frame,
- trad_frame_saved_reg saved_regs[],
- int regnum)
+ trad_frame_saved_reg saved_regs[], int regnum)
{
if (regnum < S390_NUM_REGS)
return trad_frame_get_prev_register (this_frame, saved_regs, regnum);
@@ -2315,8 +2365,8 @@ s390_trad_frame_prev_register (frame_info_ptr this_frame,
/* Normal stack frames. */
-struct s390_unwind_cache {
-
+struct s390_unwind_cache
+{
CORE_ADDR func;
CORE_ADDR frame_base;
CORE_ADDR local_base;
@@ -2358,8 +2408,8 @@ s390_prologue_frame_unwind_cache (frame_info_ptr this_frame,
func = info->func;
/* Try to analyze the prologue. */
- result = s390_analyze_prologue (gdbarch, func,
- get_frame_pc (this_frame), &data);
+ result
+ = s390_analyze_prologue (gdbarch, func, get_frame_pc (this_frame), &data);
if (!result)
return 0;
@@ -2404,9 +2454,8 @@ s390_prologue_frame_unwind_cache (frame_info_ptr this_frame,
struct s390_prologue_data data2;
pv_t *sp2 = &data2.gpr[S390_SP_REGNUM - S390_R0_REGNUM];
- if (!(s390_analyze_prologue (gdbarch, func, (CORE_ADDR)-1, &data2)
- && pv_is_register (*sp2, S390_SP_REGNUM)
- && sp2->k != 0))
+ if (!(s390_analyze_prologue (gdbarch, func, (CORE_ADDR) -1, &data2)
+ && pv_is_register (*sp2, S390_SP_REGNUM) && sp2->k != 0))
return 0;
}
}
@@ -2451,7 +2500,7 @@ s390_prologue_frame_unwind_cache (frame_info_ptr this_frame,
add back the frame size to arrive that the previous frame's
stack pointer value. */
prev_sp = get_frame_register_unsigned (this_frame, frame_pointer) + size;
- cfa = prev_sp + 16*word_size + 32;
+ cfa = prev_sp + 16 * word_size + 32;
/* Set up ABI call-saved/call-clobbered registers. */
for (i = 0; i < S390_NUM_REGS; i++)
@@ -2483,8 +2532,7 @@ s390_prologue_frame_unwind_cache (frame_info_ptr this_frame,
address to the PC. However, if we actually stored to the
save area, use that -- we might only think the function frameless
because we're in the middle of the prologue ... */
- if (size == 0
- && !info->saved_regs[S390_PSWA_REGNUM].is_addr ())
+ if (size == 0 && !info->saved_regs[S390_PSWA_REGNUM].is_addr ())
{
info->saved_regs[S390_PSWA_REGNUM].set_realreg (S390_RETADDR_REGNUM);
}
@@ -2504,7 +2552,7 @@ s390_prologue_frame_unwind_cache (frame_info_ptr this_frame,
and the top of the register save area as frame_base. */
if (prev_sp != -1)
{
- info->frame_base = prev_sp + 16*word_size + 32;
+ info->frame_base = prev_sp + 16 * word_size + 32;
info->local_base = prev_sp - size;
}
@@ -2545,15 +2593,16 @@ s390_backchain_frame_unwind_cache (frame_info_ptr this_frame,
save area pointed to by the backchain in fact links back to
the save area. */
if (backchain != 0
- && safe_read_memory_integer (backchain + 15*word_size,
- word_size, byte_order, &sp)
- && (CORE_ADDR)sp == backchain)
+ && safe_read_memory_integer (backchain + 15 * word_size, word_size,
+ byte_order, &sp)
+ && (CORE_ADDR) sp == backchain)
{
/* We don't know which registers were saved, but it will have
to be at least %r14 and %r15. This will allow us to continue
unwinding, but other prev-frame registers may be incorrect ... */
- info->saved_regs[S390_SP_REGNUM].set_addr (backchain + 15*word_size);
- info->saved_regs[S390_RETADDR_REGNUM].set_addr (backchain + 14*word_size);
+ info->saved_regs[S390_SP_REGNUM].set_addr (backchain + 15 * word_size);
+ info->saved_regs[S390_RETADDR_REGNUM].set_addr (backchain
+ + 14 * word_size);
/* Function return will set PC to %r14. */
info->saved_regs[S390_PSWA_REGNUM]
@@ -2561,7 +2610,7 @@ s390_backchain_frame_unwind_cache (frame_info_ptr this_frame,
/* We use the current value of the frame register as local_base,
and the top of the register save area as frame_base. */
- info->frame_base = backchain + 16*word_size + 32;
+ info->frame_base = backchain + 16 * word_size + 32;
info->local_base = reg;
}
@@ -2572,8 +2621,7 @@ s390_backchain_frame_unwind_cache (frame_info_ptr this_frame,
s390_frame_unwind and s390_frame_base. */
static struct s390_unwind_cache *
-s390_frame_unwind_cache (frame_info_ptr this_frame,
- void **this_prologue_cache)
+s390_frame_unwind_cache (frame_info_ptr this_frame, void **this_prologue_cache)
{
struct s390_unwind_cache *info;
@@ -2606,8 +2654,7 @@ s390_frame_unwind_cache (frame_info_ptr this_frame,
/* Implement this_id frame_unwind method for s390_frame_unwind. */
static void
-s390_frame_this_id (frame_info_ptr this_frame,
- void **this_prologue_cache,
+s390_frame_this_id (frame_info_ptr this_frame, void **this_prologue_cache,
struct frame_id *this_id)
{
struct s390_unwind_cache *info
@@ -2637,15 +2684,14 @@ s390_frame_prev_register (frame_info_ptr this_frame,
/* Default S390 frame unwinder. */
-static const struct frame_unwind s390_frame_unwind = {
- "s390 prologue",
- NORMAL_FRAME,
- default_frame_unwind_stop_reason,
- s390_frame_this_id,
- s390_frame_prev_register,
- NULL,
- default_frame_sniffer
-};
+static const struct frame_unwind s390_frame_unwind
+ = { "s390 prologue",
+ NORMAL_FRAME,
+ default_frame_unwind_stop_reason,
+ s390_frame_this_id,
+ s390_frame_prev_register,
+ NULL,
+ default_frame_sniffer };
/* Code stubs and their stack frames. For things like PLTs and NULL
function calls (where there is no true frame and the return address
@@ -2681,7 +2727,7 @@ s390_stub_frame_unwind_cache (frame_info_ptr this_frame,
/* Retrieve stack pointer and determine our frame base. */
reg = get_frame_register_unsigned (this_frame, S390_SP_REGNUM);
- info->frame_base = reg + 16*word_size + 32;
+ info->frame_base = reg + 16 * word_size + 32;
return info;
}
@@ -2689,8 +2735,7 @@ s390_stub_frame_unwind_cache (frame_info_ptr this_frame,
/* Implement this_id frame_unwind method for s390_stub_frame_unwind. */
static void
-s390_stub_frame_this_id (frame_info_ptr this_frame,
- void **this_prologue_cache,
+s390_stub_frame_this_id (frame_info_ptr this_frame, void **this_prologue_cache,
struct frame_id *this_id)
{
struct s390_stub_unwind_cache *info
@@ -2713,8 +2758,7 @@ s390_stub_frame_prev_register (frame_info_ptr this_frame,
static int
s390_stub_frame_sniffer (const struct frame_unwind *self,
- frame_info_ptr this_frame,
- void **this_prologue_cache)
+ frame_info_ptr this_frame, void **this_prologue_cache)
{
CORE_ADDR addr_in_block;
bfd_byte insn[S390_MAX_INSTR_SIZE];
@@ -2731,15 +2775,14 @@ s390_stub_frame_sniffer (const struct frame_unwind *self,
/* S390 stub frame unwinder. */
-static const struct frame_unwind s390_stub_frame_unwind = {
- "s390 stub",
- NORMAL_FRAME,
- default_frame_unwind_stop_reason,
- s390_stub_frame_this_id,
- s390_stub_frame_prev_register,
- NULL,
- s390_stub_frame_sniffer
-};
+static const struct frame_unwind s390_stub_frame_unwind
+ = { "s390 stub",
+ NORMAL_FRAME,
+ default_frame_unwind_stop_reason,
+ s390_stub_frame_this_id,
+ s390_stub_frame_prev_register,
+ NULL,
+ s390_stub_frame_sniffer };
/* Frame base handling. */
@@ -2759,12 +2802,9 @@ s390_local_base_address (frame_info_ptr this_frame, void **this_cache)
return info->local_base;
}
-static const struct frame_base s390_frame_base = {
- &s390_frame_unwind,
- s390_frame_base_address,
- s390_local_base_address,
- s390_local_base_address
-};
+static const struct frame_base s390_frame_base
+ = { &s390_frame_unwind, s390_frame_base_address, s390_local_base_address,
+ s390_local_base_address };
/* Process record-replay */
@@ -2807,11 +2847,12 @@ s390_record_address_mask (struct gdbarch *gdbarch, struct regcache *regcache,
dh should be set to 0 if unused. */
static CORE_ADDR
-s390_record_calc_disp_common (struct gdbarch *gdbarch, struct regcache *regcache,
- ULONGEST x, uint16_t bd, int8_t dh)
+s390_record_calc_disp_common (struct gdbarch *gdbarch,
+ struct regcache *regcache, ULONGEST x,
+ uint16_t bd, int8_t dh)
{
uint8_t rb = bd >> 12 & 0xf;
- int32_t d = (bd & 0xfff) | ((int32_t)dh << 12);
+ int32_t d = (bd & 0xfff) | ((int32_t) dh << 12);
ULONGEST b;
CORE_ADDR res = d + x;
if (rb)
@@ -2864,12 +2905,14 @@ s390_record_calc_rl (struct gdbarch *gdbarch, struct regcache *regcache,
CORE_ADDR addr, uint16_t i1, uint16_t i2)
{
int32_t ri = i1 << 16 | i2;
- return s390_record_address_mask (gdbarch, regcache, addr + (LONGEST)ri * 2);
+ return s390_record_address_mask (gdbarch, regcache, addr + (LONGEST) ri * 2);
}
/* Population count helper. */
-static int s390_popcnt (unsigned int x) {
+static int
+s390_popcnt (unsigned int x)
+{
int res = 0;
while (x)
{
@@ -2940,7 +2983,7 @@ s390_process_record (struct gdbarch *gdbarch, struct regcache *regcache,
CORE_ADDR addr)
{
s390_gdbarch_tdep *tdep = gdbarch_tdep<s390_gdbarch_tdep> (gdbarch);
- uint16_t insn[3] = {0};
+ uint16_t insn[3] = { 0 };
/* Instruction as bytes. */
uint8_t ibyte[6];
/* Instruction as nibbles. */
@@ -2964,24 +3007,24 @@ ex:
insn[0] |= ex & 0xff;
/* Two highest bits determine instruction size. */
if (insn[0] >= 0x4000)
- insn[1] = read_memory_unsigned_integer (addr+2, 2, byte_order);
+ insn[1] = read_memory_unsigned_integer (addr + 2, 2, byte_order);
else
/* Not necessary, but avoids uninitialized variable warnings. */
insn[1] = 0;
if (insn[0] >= 0xc000)
- insn[2] = read_memory_unsigned_integer (addr+4, 2, byte_order);
+ insn[2] = read_memory_unsigned_integer (addr + 4, 2, byte_order);
else
insn[2] = 0;
/* Split instruction into bytes and nibbles. */
for (i = 0; i < 3; i++)
{
- ibyte[i*2] = insn[i] >> 8 & 0xff;
- ibyte[i*2+1] = insn[i] & 0xff;
+ ibyte[i * 2] = insn[i] >> 8 & 0xff;
+ ibyte[i * 2 + 1] = insn[i] & 0xff;
}
for (i = 0; i < 6; i++)
{
- inib[i*2] = ibyte[i] >> 4 & 0xf;
- inib[i*2+1] = ibyte[i] & 0xf;
+ inib[i * 2] = ibyte[i] >> 4 & 0xf;
+ inib[i * 2 + 1] = ibyte[i] & 0xf;
}
/* Compute vector registers, if applicable. */
ivec[0] = (inib[9] >> 3 & 1) << 4 | inib[2];
@@ -2991,20 +3034,20 @@ ex:
switch (ibyte[0])
{
- /* 0x00 undefined */
+ /* 0x00 undefined */
case 0x01:
/* E-format instruction */
switch (ibyte[1])
{
- /* 0x00 undefined */
- /* 0x01 unsupported: PR - program return */
- /* 0x02 unsupported: UPT */
- /* 0x03 undefined */
- /* 0x04 privileged: PTFF - perform timing facility function */
- /* 0x05-0x06 undefined */
- /* 0x07 privileged: SCKPF - set clock programmable field */
- /* 0x08-0x09 undefined */
+ /* 0x00 undefined */
+ /* 0x01 unsupported: PR - program return */
+ /* 0x02 unsupported: UPT */
+ /* 0x03 undefined */
+ /* 0x04 privileged: PTFF - perform timing facility function */
+ /* 0x05-0x06 undefined */
+ /* 0x07 privileged: SCKPF - set clock programmable field */
+ /* 0x08-0x09 undefined */
case 0x0a: /* PFPO - perform floating point operation */
regcache_raw_read_unsigned (regcache, S390_R0_REGNUM, &tmp);
@@ -3031,8 +3074,9 @@ ex:
return -1;
break;
default:
- gdb_printf (gdb_stdlog, "Warning: Unknown PFPO OFC %02x at %s.\n",
- ofc, paddress (gdbarch, addr));
+ gdb_printf (gdb_stdlog,
+ "Warning: Unknown PFPO OFC %02x at %s.\n", ofc,
+ paddress (gdbarch, addr));
return -1;
}
@@ -3053,17 +3097,17 @@ ex:
return -1;
break;
- /* 0x0f-0xfe undefined */
+ /* 0x0f-0xfe undefined */
- /* 0xff unsupported: TRAP */
+ /* 0xff unsupported: TRAP */
default:
goto UNKNOWN_OP;
}
break;
- /* 0x02 undefined */
- /* 0x03 undefined */
+ /* 0x02 undefined */
+ /* 0x03 undefined */
case 0x04: /* SPM - set program mask */
if (record_full_arch_list_add_reg (regcache, S390_PSWM_REGNUM))
@@ -3091,8 +3135,8 @@ ex:
/* No effect other than PC transfer. */
break;
- /* 0x08 undefined */
- /* 0x09 undefined */
+ /* 0x08 undefined */
+ /* 0x09 undefined */
case 0x0a:
/* SVC - supervisor call */
@@ -3103,7 +3147,7 @@ ex:
}
else
{
- gdb_printf (gdb_stderr, _("no syscall record support\n"));
+ gdb_printf (gdb_stderr, _ ("no syscall record support\n"));
return -1;
}
break;
@@ -3126,17 +3170,20 @@ ex:
case 0x0e: /* MVCL - move long [interruptible] */
regcache_raw_read_unsigned (regcache, S390_R0_REGNUM + inib[2], &tmp);
oaddr = s390_record_address_mask (gdbarch, regcache, tmp);
- regcache_raw_read_unsigned (regcache, S390_R0_REGNUM + (inib[2] | 1), &tmp);
+ regcache_raw_read_unsigned (regcache, S390_R0_REGNUM + (inib[2] | 1),
+ &tmp);
tmp &= 0xffffff;
if (record_full_arch_list_add_mem (oaddr, tmp))
return -1;
if (record_full_arch_list_add_reg (regcache, S390_R0_REGNUM + inib[2]))
return -1;
- if (record_full_arch_list_add_reg (regcache, S390_R0_REGNUM + (inib[2] | 1)))
+ if (record_full_arch_list_add_reg (regcache,
+ S390_R0_REGNUM + (inib[2] | 1)))
return -1;
if (record_full_arch_list_add_reg (regcache, S390_R0_REGNUM + inib[3]))
return -1;
- if (record_full_arch_list_add_reg (regcache, S390_R0_REGNUM + (inib[3] | 1)))
+ if (record_full_arch_list_add_reg (regcache,
+ S390_R0_REGNUM + (inib[3] | 1)))
return -1;
if (record_full_arch_list_add_reg (regcache, S390_PSWM_REGNUM))
return -1;
@@ -3146,11 +3193,13 @@ ex:
case 0xa9: /* CLCLE - compare logical long extended [partial] */
if (record_full_arch_list_add_reg (regcache, S390_R0_REGNUM + inib[2]))
return -1;
- if (record_full_arch_list_add_reg (regcache, S390_R0_REGNUM + (inib[2] | 1)))
+ if (record_full_arch_list_add_reg (regcache,
+ S390_R0_REGNUM + (inib[2] | 1)))
return -1;
if (record_full_arch_list_add_reg (regcache, S390_R0_REGNUM + inib[3]))
return -1;
- if (record_full_arch_list_add_reg (regcache, S390_R0_REGNUM + (inib[3] | 1)))
+ if (record_full_arch_list_add_reg (regcache,
+ S390_R0_REGNUM + (inib[3] | 1)))
return -1;
if (record_full_arch_list_add_reg (regcache, S390_PSWM_REGNUM))
return -1;
@@ -3226,7 +3275,8 @@ ex:
/* 32-bit pair destination, no flags */
if (record_full_arch_list_add_reg (regcache, S390_R0_REGNUM + inib[2]))
return -1;
- if (record_full_arch_list_add_reg (regcache, S390_R0_REGNUM + (inib[2] | 1)))
+ if (record_full_arch_list_add_reg (regcache,
+ S390_R0_REGNUM + (inib[2] | 1)))
return -1;
break;
@@ -3288,7 +3338,8 @@ ex:
/* float pair destination, no flags */
if (record_full_arch_list_add_reg (regcache, S390_F0_REGNUM + inib[2]))
return -1;
- if (record_full_arch_list_add_reg (regcache, S390_F0_REGNUM + (inib[2] | 2)))
+ if (record_full_arch_list_add_reg (regcache,
+ S390_F0_REGNUM + (inib[2] | 2)))
return -1;
break;
@@ -3297,7 +3348,8 @@ ex:
/* float pair destination + flags */
if (record_full_arch_list_add_reg (regcache, S390_F0_REGNUM + inib[2]))
return -1;
- if (record_full_arch_list_add_reg (regcache, S390_F0_REGNUM + (inib[2] | 2)))
+ if (record_full_arch_list_add_reg (regcache,
+ S390_F0_REGNUM + (inib[2] | 2)))
return -1;
if (record_full_arch_list_add_reg (regcache, S390_PSWM_REGNUM))
return -1;
@@ -3325,7 +3377,8 @@ ex:
addr = s390_record_calc_disp (gdbarch, regcache, inib[3], insn[1], 0);
if (inib[2])
{
- regcache_raw_read_unsigned (regcache, S390_R0_REGNUM + inib[2], &tmp);
+ regcache_raw_read_unsigned (regcache, S390_R0_REGNUM + inib[2],
+ &tmp);
ex = tmp & 0xff;
}
else
@@ -3363,24 +3416,25 @@ ex:
return -1;
break;
- /* 0x52 undefined */
- /* 0x53 undefined */
+ /* 0x52 undefined */
+ /* 0x53 undefined */
- /* 0x61-0x66 undefined */
+ /* 0x61-0x66 undefined */
- /* 0x72-0x77 undefined */
+ /* 0x72-0x77 undefined */
- /* 0x80 privileged: SSM - set system mask */
- /* 0x81 undefined */
- /* 0x82 privileged: LPSW - load PSW */
- /* 0x83 privileged: diagnose */
+ /* 0x80 privileged: SSM - set system mask */
+ /* 0x81 undefined */
+ /* 0x82 privileged: LPSW - load PSW */
+ /* 0x83 privileged: diagnose */
case 0x8e: /* SRDA - shift right double */
case 0x8f: /* SLDA - shift left double */
/* 32-bit pair destination + flags */
if (record_full_arch_list_add_reg (regcache, S390_R0_REGNUM + inib[2]))
return -1;
- if (record_full_arch_list_add_reg (regcache, S390_R0_REGNUM + (inib[2] | 1)))
+ if (record_full_arch_list_add_reg (regcache,
+ S390_R0_REGNUM + (inib[2] | 1)))
return -1;
if (record_full_arch_list_add_reg (regcache, S390_PSWM_REGNUM))
return -1;
@@ -3422,7 +3476,7 @@ ex:
return -1;
break;
- /* 0x99 privileged: TRACE */
+ /* 0x99 privileged: TRACE */
case 0x9a: /* LAM - load access multiple */
for (i = inib[2]; i != inib[3]; i++, i &= 0xf)
@@ -3432,8 +3486,8 @@ ex:
return -1;
break;
- /* 0x9c-0x9f privileged and obsolete (old I/O) */
- /* 0xa0-0xa4 undefined */
+ /* 0x9c-0x9f privileged and obsolete (old I/O) */
+ /* 0xa0-0xa4 undefined */
case 0xa5:
case 0xa7:
@@ -3454,7 +3508,8 @@ ex:
case 0xa78: /* LHI - load halfword immediate */
case 0xa7c: /* MHI - multiply halfword immediate */
/* 32-bit or native destination */
- if (record_full_arch_list_add_reg (regcache, S390_R0_REGNUM + inib[2]))
+ if (record_full_arch_list_add_reg (regcache,
+ S390_R0_REGNUM + inib[2]))
return -1;
break;
@@ -3475,7 +3530,8 @@ ex:
case 0xa5b: /* OILL - or immediate */
case 0xa7a: /* AHI - add halfword immediate */
/* 32-bit destination + flags */
- if (record_full_arch_list_add_reg (regcache, S390_R0_REGNUM + inib[2]))
+ if (record_full_arch_list_add_reg (regcache,
+ S390_R0_REGNUM + inib[2]))
return -1;
if (record_full_arch_list_add_reg (regcache, S390_PSWM_REGNUM))
return -1;
@@ -3521,33 +3577,36 @@ ex:
}
break;
- /* 0xa6 undefined */
+ /* 0xa6 undefined */
case 0xa8: /* MVCLE - move long extended [partial] */
regcache_raw_read_unsigned (regcache, S390_R0_REGNUM + inib[2], &tmp);
oaddr = s390_record_address_mask (gdbarch, regcache, tmp);
- regcache_raw_read_unsigned (regcache, S390_R0_REGNUM + (inib[2] | 1), &tmp);
+ regcache_raw_read_unsigned (regcache, S390_R0_REGNUM + (inib[2] | 1),
+ &tmp);
if (record_full_arch_list_add_mem (oaddr, tmp))
return -1;
if (record_full_arch_list_add_reg (regcache, S390_R0_REGNUM + inib[2]))
return -1;
- if (record_full_arch_list_add_reg (regcache, S390_R0_REGNUM + (inib[2] | 1)))
+ if (record_full_arch_list_add_reg (regcache,
+ S390_R0_REGNUM + (inib[2] | 1)))
return -1;
if (record_full_arch_list_add_reg (regcache, S390_R0_REGNUM + inib[3]))
return -1;
- if (record_full_arch_list_add_reg (regcache, S390_R0_REGNUM + (inib[3] | 1)))
+ if (record_full_arch_list_add_reg (regcache,
+ S390_R0_REGNUM + (inib[3] | 1)))
return -1;
if (record_full_arch_list_add_reg (regcache, S390_PSWM_REGNUM))
return -1;
break;
- /* 0xaa-0xab undefined */
- /* 0xac privileged: STNSM - store then and system mask */
- /* 0xad privileged: STOSM - store then or system mask */
- /* 0xae privileged: SIGP - signal processor */
- /* 0xaf unsupported: MC - monitor call */
- /* 0xb0 undefined */
- /* 0xb1 privileged: LRA - load real address */
+ /* 0xaa-0xab undefined */
+ /* 0xac privileged: STNSM - store then and system mask */
+ /* 0xad privileged: STOSM - store then or system mask */
+ /* 0xae privileged: SIGP - signal processor */
+ /* 0xaf unsupported: MC - monitor call */
+ /* 0xb0 undefined */
+ /* 0xb1 privileged: LRA - load real address */
case 0xb2:
case 0xb3:
@@ -3555,7 +3614,7 @@ ex:
/* S/RRD/RRE/RRF/IE-format instruction */
switch (insn[0])
{
- /* 0xb200-0xb204 undefined or privileged */
+ /* 0xb200-0xb204 undefined or privileged */
case 0xb205: /* STCK - store clock */
case 0xb27c: /* STCKF - store clock fast */
@@ -3566,9 +3625,9 @@ ex:
return -1;
break;
- /* 0xb206-0xb219 undefined, privileged, or unsupported */
- /* 0xb21a unsupported: CFC */
- /* 0xb21b-0xb221 undefined or privileged */
+ /* 0xb206-0xb219 undefined, privileged, or unsupported */
+ /* 0xb21a unsupported: CFC */
+ /* 0xb21b-0xb221 undefined or privileged */
case 0xb222: /* IPM - insert program mask */
case 0xb24f: /* EAR - extract access */
@@ -3582,11 +3641,12 @@ ex:
case 0xb995: /* LLHR - load logical halfword */
case 0xb9f2: /* LOCR - load on condition */
/* 32-bit gpr destination */
- if (record_full_arch_list_add_reg (regcache, S390_R0_REGNUM + inib[6]))
+ if (record_full_arch_list_add_reg (regcache,
+ S390_R0_REGNUM + inib[6]))
return -1;
break;
- /* 0xb223-0xb22c privileged or unsupported */
+ /* 0xb223-0xb22c privileged or unsupported */
case 0xb22d: /* DXR - divide */
case 0xb325: /* LXDR - load lengthened */
@@ -3599,26 +3659,31 @@ ex:
case 0xb3c6: /* CXGR - convert from fixed */
case 0xb3fe: /* IEXTR - insert biased exponent */
/* float pair destination */
- if (record_full_arch_list_add_reg (regcache, S390_F0_REGNUM + inib[6]))
+ if (record_full_arch_list_add_reg (regcache,
+ S390_F0_REGNUM + inib[6]))
return -1;
- if (record_full_arch_list_add_reg (regcache, S390_F0_REGNUM + (inib[6] | 2)))
+ if (record_full_arch_list_add_reg (regcache,
+ S390_F0_REGNUM + (inib[6] | 2)))
return -1;
break;
- /* 0xb22e-0xb240 undefined, privileged, or unsupported */
+ /* 0xb22e-0xb240 undefined, privileged, or unsupported */
case 0xb241: /* CKSM - checksum [partial] */
- if (record_full_arch_list_add_reg (regcache, S390_R0_REGNUM + inib[6]))
+ if (record_full_arch_list_add_reg (regcache,
+ S390_R0_REGNUM + inib[6]))
return -1;
- if (record_full_arch_list_add_reg (regcache, S390_R0_REGNUM + inib[7]))
+ if (record_full_arch_list_add_reg (regcache,
+ S390_R0_REGNUM + inib[7]))
return -1;
- if (record_full_arch_list_add_reg (regcache, S390_R0_REGNUM + (inib[7] | 1)))
+ if (record_full_arch_list_add_reg (regcache,
+ S390_R0_REGNUM + (inib[7] | 1)))
return -1;
if (record_full_arch_list_add_reg (regcache, S390_PSWM_REGNUM))
return -1;
break;
- /* 0xb242-0xb243 undefined */
+ /* 0xb242-0xb243 undefined */
case 0xb244: /* SQDR - square root */
case 0xb245: /* SQER - square root */
@@ -3640,20 +3705,22 @@ ex:
case 0xb3c5: /* CDGR - convert from fixed */
case 0xb3f6: /* IEDTR - insert biased exponent */
/* float destination */
- if (record_full_arch_list_add_reg (regcache, S390_F0_REGNUM + inib[6]))
+ if (record_full_arch_list_add_reg (regcache,
+ S390_F0_REGNUM + inib[6]))
return -1;
break;
- /* 0xb246-0xb24c: privileged or unsupported */
+ /* 0xb246-0xb24c: privileged or unsupported */
case 0xb24d: /* CPYA - copy access */
case 0xb24e: /* SAR - set access */
- if (record_full_arch_list_add_reg (regcache, S390_A0_REGNUM + inib[6]))
+ if (record_full_arch_list_add_reg (regcache,
+ S390_A0_REGNUM + inib[6]))
return -1;
break;
- /* 0xb250-0xb251 undefined or privileged */
- /* 0xb253-0xb254 undefined or privileged */
+ /* 0xb250-0xb251 undefined or privileged */
+ /* 0xb253-0xb254 undefined or privileged */
case 0xb255: /* MVST - move string [partial] */
{
@@ -3664,73 +3731,91 @@ ex:
regcache_raw_read_unsigned (regcache, S390_R0_REGNUM, &tmp);
end = tmp & 0xff;
/* Get address of second operand. */
- regcache_raw_read_unsigned (regcache, S390_R0_REGNUM + inib[7], &tmp);
+ regcache_raw_read_unsigned (regcache, S390_R0_REGNUM + inib[7],
+ &tmp);
oaddr = s390_record_address_mask (gdbarch, regcache, tmp);
/* Search for ending byte and compute length. */
- do {
- num++;
- if (target_read_memory (oaddr, &cur, 1))
- return -1;
- oaddr++;
- } while (cur != end);
+ do
+ {
+ num++;
+ if (target_read_memory (oaddr, &cur, 1))
+ return -1;
+ oaddr++;
+ }
+ while (cur != end);
/* Get address of first operand and record it. */
- regcache_raw_read_unsigned (regcache, S390_R0_REGNUM + inib[6], &tmp);
+ regcache_raw_read_unsigned (regcache, S390_R0_REGNUM + inib[6],
+ &tmp);
oaddr = s390_record_address_mask (gdbarch, regcache, tmp);
if (record_full_arch_list_add_mem (oaddr, num))
return -1;
/* Record the registers. */
- if (record_full_arch_list_add_reg (regcache, S390_R0_REGNUM + inib[6]))
+ if (record_full_arch_list_add_reg (regcache,
+ S390_R0_REGNUM + inib[6]))
return -1;
- if (record_full_arch_list_add_reg (regcache, S390_R0_REGNUM + inib[7]))
+ if (record_full_arch_list_add_reg (regcache,
+ S390_R0_REGNUM + inib[7]))
return -1;
if (record_full_arch_list_add_reg (regcache, S390_PSWM_REGNUM))
return -1;
}
break;
- /* 0xb256 undefined */
+ /* 0xb256 undefined */
case 0xb257: /* CUSE - compare until substring equal [interruptible] */
- if (record_full_arch_list_add_reg (regcache, S390_R0_REGNUM + inib[6]))
+ if (record_full_arch_list_add_reg (regcache,
+ S390_R0_REGNUM + inib[6]))
return -1;
- if (record_full_arch_list_add_reg (regcache, S390_R0_REGNUM + (inib[6] | 1)))
+ if (record_full_arch_list_add_reg (regcache,
+ S390_R0_REGNUM + (inib[6] | 1)))
return -1;
- if (record_full_arch_list_add_reg (regcache, S390_R0_REGNUM + inib[7]))
+ if (record_full_arch_list_add_reg (regcache,
+ S390_R0_REGNUM + inib[7]))
return -1;
- if (record_full_arch_list_add_reg (regcache, S390_R0_REGNUM + (inib[7] | 1)))
+ if (record_full_arch_list_add_reg (regcache,
+ S390_R0_REGNUM + (inib[7] | 1)))
return -1;
if (record_full_arch_list_add_reg (regcache, S390_PSWM_REGNUM))
return -1;
break;
- /* 0xb258-0xb25c undefined, privileged, or unsupported */
+ /* 0xb258-0xb25c undefined, privileged, or unsupported */
case 0xb25d: /* CLST - compare logical string [partial] */
case 0xb25e: /* SRST - search string [partial] */
case 0xb9be: /* SRSTU - search string unicode [partial] */
- if (record_full_arch_list_add_reg (regcache, S390_R0_REGNUM + inib[6]))
+ if (record_full_arch_list_add_reg (regcache,
+ S390_R0_REGNUM + inib[6]))
return -1;
- if (record_full_arch_list_add_reg (regcache, S390_R0_REGNUM + inib[7]))
+ if (record_full_arch_list_add_reg (regcache,
+ S390_R0_REGNUM + inib[7]))
return -1;
if (record_full_arch_list_add_reg (regcache, S390_PSWM_REGNUM))
return -1;
break;
- /* 0xb25f-0xb262 undefined */
+ /* 0xb25f-0xb262 undefined */
case 0xb263: /* CMPSC - compression call [interruptible] */
- regcache_raw_read_unsigned (regcache, S390_R0_REGNUM + inib[6], &tmp);
+ regcache_raw_read_unsigned (regcache, S390_R0_REGNUM + inib[6],
+ &tmp);
oaddr = s390_record_address_mask (gdbarch, regcache, tmp);
- regcache_raw_read_unsigned (regcache, S390_R0_REGNUM + (inib[6] | 1), &tmp);
+ regcache_raw_read_unsigned (regcache, S390_R0_REGNUM + (inib[6] | 1),
+ &tmp);
if (record_full_arch_list_add_mem (oaddr, tmp))
return -1;
- if (record_full_arch_list_add_reg (regcache, S390_R0_REGNUM + inib[6]))
+ if (record_full_arch_list_add_reg (regcache,
+ S390_R0_REGNUM + inib[6]))
return -1;
- if (record_full_arch_list_add_reg (regcache, S390_R0_REGNUM + (inib[6] | 1)))
+ if (record_full_arch_list_add_reg (regcache,
+ S390_R0_REGNUM + (inib[6] | 1)))
return -1;
- if (record_full_arch_list_add_reg (regcache, S390_R0_REGNUM + inib[7]))
+ if (record_full_arch_list_add_reg (regcache,
+ S390_R0_REGNUM + inib[7]))
return -1;
- if (record_full_arch_list_add_reg (regcache, S390_R0_REGNUM + (inib[7] | 1)))
+ if (record_full_arch_list_add_reg (regcache,
+ S390_R0_REGNUM + (inib[7] | 1)))
return -1;
if (record_full_arch_list_add_reg (regcache, S390_R1_REGNUM))
return -1;
@@ -3741,7 +3826,7 @@ ex:
return -1;
break;
- /* 0xb264-0xb277 undefined, privileged, or unsupported */
+ /* 0xb264-0xb277 undefined, privileged, or unsupported */
case 0xb278: /* STCKE - store clock extended */
oaddr = s390_record_calc_disp (gdbarch, regcache, 0, insn[1], 0);
@@ -3751,8 +3836,8 @@ ex:
return -1;
break;
- /* 0xb279-0xb27b undefined or unsupported */
- /* 0xb27d-0xb298 undefined or privileged */
+ /* 0xb279-0xb27b undefined or unsupported */
+ /* 0xb27d-0xb298 undefined or privileged */
case 0xb299: /* SRNM - set rounding mode */
case 0xb2b8: /* SRNMB - set bfp rounding mode */
@@ -3770,7 +3855,7 @@ ex:
return -1;
break;
- /* 0xb29a-0xb29b undefined */
+ /* 0xb29a-0xb29b undefined */
case 0xb29c: /* STFPC - store fpc */
oaddr = s390_record_calc_disp (gdbarch, regcache, 0, insn[1], 0);
@@ -3778,17 +3863,21 @@ ex:
return -1;
break;
- /* 0xb29e-0xb2a4 undefined */
+ /* 0xb29e-0xb2a4 undefined */
case 0xb2a5: /* TRE - translate extended [partial] */
- regcache_raw_read_unsigned (regcache, S390_R0_REGNUM + inib[6], &tmp);
+ regcache_raw_read_unsigned (regcache, S390_R0_REGNUM + inib[6],
+ &tmp);
oaddr = s390_record_address_mask (gdbarch, regcache, tmp);
- regcache_raw_read_unsigned (regcache, S390_R0_REGNUM + (inib[6] | 1), &tmp);
+ regcache_raw_read_unsigned (regcache, S390_R0_REGNUM + (inib[6] | 1),
+ &tmp);
if (record_full_arch_list_add_mem (oaddr, tmp))
return -1;
- if (record_full_arch_list_add_reg (regcache, S390_R0_REGNUM + inib[6]))
+ if (record_full_arch_list_add_reg (regcache,
+ S390_R0_REGNUM + inib[6]))
return -1;
- if (record_full_arch_list_add_reg (regcache, S390_R0_REGNUM + (inib[6] | 1)))
+ if (record_full_arch_list_add_reg (regcache,
+ S390_R0_REGNUM + (inib[6] | 1)))
return -1;
if (record_full_arch_list_add_reg (regcache, S390_PSWM_REGNUM))
return -1;
@@ -3800,24 +3889,30 @@ ex:
case 0xb9b1: /* CU24 - convert UTF-16 to UTF-32 [partial] */
case 0xb9b2: /* CU41 - convert UTF-32 to UTF-8 [partial] */
case 0xb9b3: /* CU42 - convert UTF-32 to UTF-16 [partial] */
- regcache_raw_read_unsigned (regcache, S390_R0_REGNUM + inib[6], &tmp);
+ regcache_raw_read_unsigned (regcache, S390_R0_REGNUM + inib[6],
+ &tmp);
oaddr = s390_record_address_mask (gdbarch, regcache, tmp);
- regcache_raw_read_unsigned (regcache, S390_R0_REGNUM + (inib[6] | 1), &tmp);
+ regcache_raw_read_unsigned (regcache, S390_R0_REGNUM + (inib[6] | 1),
+ &tmp);
if (record_full_arch_list_add_mem (oaddr, tmp))
return -1;
- if (record_full_arch_list_add_reg (regcache, S390_R0_REGNUM + inib[6]))
+ if (record_full_arch_list_add_reg (regcache,
+ S390_R0_REGNUM + inib[6]))
return -1;
- if (record_full_arch_list_add_reg (regcache, S390_R0_REGNUM + (inib[6] | 1)))
+ if (record_full_arch_list_add_reg (regcache,
+ S390_R0_REGNUM + (inib[6] | 1)))
return -1;
- if (record_full_arch_list_add_reg (regcache, S390_R0_REGNUM + inib[7]))
+ if (record_full_arch_list_add_reg (regcache,
+ S390_R0_REGNUM + inib[7]))
return -1;
- if (record_full_arch_list_add_reg (regcache, S390_R0_REGNUM + (inib[7] | 1)))
+ if (record_full_arch_list_add_reg (regcache,
+ S390_R0_REGNUM + (inib[7] | 1)))
return -1;
if (record_full_arch_list_add_reg (regcache, S390_PSWM_REGNUM))
return -1;
break;
- /* 0xb2a8-0xb2af undefined */
+ /* 0xb2a8-0xb2af undefined */
case 0xb2b0: /* STFLE - store facility list extended */
oaddr = s390_record_calc_disp (gdbarch, regcache, 0, insn[1], 0);
@@ -3831,23 +3926,23 @@ ex:
return -1;
break;
- /* 0xb2b1-0xb2b7 undefined or privileged */
- /* 0xb2ba-0xb2bc undefined */
- /* 0xb2be-0xb2e7 undefined */
- /* 0xb2e9-0xb2eb undefined */
- /* 0xb2ed-0xb2f7 undefined */
- /* 0xb2f8 unsupported: TEND */
- /* 0xb2f9 undefined */
+ /* 0xb2b1-0xb2b7 undefined or privileged */
+ /* 0xb2ba-0xb2bc undefined */
+ /* 0xb2be-0xb2e7 undefined */
+ /* 0xb2e9-0xb2eb undefined */
+ /* 0xb2ed-0xb2f7 undefined */
+ /* 0xb2f8 unsupported: TEND */
+ /* 0xb2f9 undefined */
case 0xb2e8: /* PPA - perform processor assist */
case 0xb2fa: /* NIAI - next instruction access intent */
/* no visible effects */
break;
- /* 0xb2fb undefined */
- /* 0xb2fc unsupported: TABORT */
- /* 0xb2fd-0xb2fe undefined */
- /* 0xb2ff unsupported: TRAP */
+ /* 0xb2fb undefined */
+ /* 0xb2fc unsupported: TABORT */
+ /* 0xb2fd-0xb2fe undefined */
+ /* 0xb2ff unsupported: TRAP */
case 0xb300: /* LPEBR - load positive */
case 0xb301: /* LNEBR - load negative */
@@ -3860,7 +3955,8 @@ ex:
case 0xb358: /* THDER - convert bfp to hfp */
case 0xb359: /* THDR - convert bfp to hfp */
/* float destination + flags */
- if (record_full_arch_list_add_reg (regcache, S390_F0_REGNUM + inib[6]))
+ if (record_full_arch_list_add_reg (regcache,
+ S390_F0_REGNUM + inib[6]))
return -1;
if (record_full_arch_list_add_reg (regcache, S390_PSWM_REGNUM))
return -1;
@@ -3902,7 +3998,8 @@ ex:
case 0xb952: /* CDLGTR - convert from logical */
case 0xb953: /* CDLFTR - convert from logical */
/* float destination + fpc */
- if (record_full_arch_list_add_reg (regcache, S390_F0_REGNUM + inib[6]))
+ if (record_full_arch_list_add_reg (regcache,
+ S390_F0_REGNUM + inib[6]))
return -1;
if (record_full_arch_list_add_reg (regcache, S390_FPC_REGNUM))
return -1;
@@ -3932,9 +4029,11 @@ ex:
case 0xb95a: /* CXLGTR - convert from logical */
case 0xb95b: /* CXLFTR - convert from logical */
/* float pair destination + fpc */
- if (record_full_arch_list_add_reg (regcache, S390_F0_REGNUM + inib[6]))
+ if (record_full_arch_list_add_reg (regcache,
+ S390_F0_REGNUM + inib[6]))
return -1;
- if (record_full_arch_list_add_reg (regcache, S390_F0_REGNUM + (inib[6] | 2)))
+ if (record_full_arch_list_add_reg (regcache,
+ S390_F0_REGNUM + (inib[6] | 2)))
return -1;
if (record_full_arch_list_add_reg (regcache, S390_FPC_REGNUM))
return -1;
@@ -3967,7 +4066,8 @@ ex:
case 0xb3d3: /* SDTR - subtract */
case 0xb3d6: /* LTDTR - load and test */
/* float destination + flags + fpc */
- if (record_full_arch_list_add_reg (regcache, S390_F0_REGNUM + inib[6]))
+ if (record_full_arch_list_add_reg (regcache,
+ S390_F0_REGNUM + inib[6]))
return -1;
if (record_full_arch_list_add_reg (regcache, S390_PSWM_REGNUM))
return -1;
@@ -3980,14 +4080,15 @@ ex:
case 0xb31e: /* MADBR - multiply and add */
case 0xb31f: /* MSDBR - multiply and subtract */
/* float destination [RRD] + fpc */
- if (record_full_arch_list_add_reg (regcache, S390_F0_REGNUM + inib[4]))
+ if (record_full_arch_list_add_reg (regcache,
+ S390_F0_REGNUM + inib[4]))
return -1;
if (record_full_arch_list_add_reg (regcache, S390_FPC_REGNUM))
return -1;
break;
- /* 0xb320-0xb323 undefined */
- /* 0xb327-0xb32d undefined */
+ /* 0xb320-0xb323 undefined */
+ /* 0xb327-0xb32d undefined */
case 0xb32e: /* MAER - multiply and add */
case 0xb32f: /* MSER - multiply and subtract */
@@ -3998,18 +4099,21 @@ ex:
case 0xb33e: /* MADR - multiply and add */
case 0xb33f: /* MSDR - multiply and subtract */
/* float destination [RRD] */
- if (record_full_arch_list_add_reg (regcache, S390_F0_REGNUM + inib[4]))
+ if (record_full_arch_list_add_reg (regcache,
+ S390_F0_REGNUM + inib[4]))
return -1;
break;
- /* 0xb330-0xb335 undefined */
+ /* 0xb330-0xb335 undefined */
case 0xb33a: /* MAYR - multiply and add unnormalized */
case 0xb33b: /* MYR - multiply unnormalized */
/* float pair destination [RRD] */
- if (record_full_arch_list_add_reg (regcache, S390_F0_REGNUM + inib[4]))
+ if (record_full_arch_list_add_reg (regcache,
+ S390_F0_REGNUM + inib[4]))
return -1;
- if (record_full_arch_list_add_reg (regcache, S390_F0_REGNUM + (inib[4] | 2)))
+ if (record_full_arch_list_add_reg (regcache,
+ S390_F0_REGNUM + (inib[4] | 2)))
return -1;
break;
@@ -4021,9 +4125,11 @@ ex:
case 0xb362: /* LTXR - load and test */
case 0xb363: /* LCXR - load complement */
/* float pair destination + flags */
- if (record_full_arch_list_add_reg (regcache, S390_F0_REGNUM + inib[6]))
+ if (record_full_arch_list_add_reg (regcache,
+ S390_F0_REGNUM + inib[6]))
return -1;
- if (record_full_arch_list_add_reg (regcache, S390_F0_REGNUM + (inib[6] | 2)))
+ if (record_full_arch_list_add_reg (regcache,
+ S390_F0_REGNUM + (inib[6] | 2)))
return -1;
if (record_full_arch_list_add_reg (regcache, S390_PSWM_REGNUM))
return -1;
@@ -4036,9 +4142,11 @@ ex:
case 0xb3db: /* SXTR - subtract */
case 0xb3de: /* LTXTR - load and test */
/* float pair destination + flags + fpc */
- if (record_full_arch_list_add_reg (regcache, S390_F0_REGNUM + inib[6]))
+ if (record_full_arch_list_add_reg (regcache,
+ S390_F0_REGNUM + inib[6]))
return -1;
- if (record_full_arch_list_add_reg (regcache, S390_F0_REGNUM + (inib[6] | 2)))
+ if (record_full_arch_list_add_reg (regcache,
+ S390_F0_REGNUM + (inib[6] | 2)))
return -1;
if (record_full_arch_list_add_reg (regcache, S390_PSWM_REGNUM))
return -1;
@@ -4046,15 +4154,17 @@ ex:
return -1;
break;
- /* 0xb34e-0xb34f undefined */
- /* 0xb352 undefined */
+ /* 0xb34e-0xb34f undefined */
+ /* 0xb352 undefined */
case 0xb353: /* DIEBR - divide to integer */
case 0xb35b: /* DIDBR - divide to integer */
/* two float destinations + flags + fpc */
- if (record_full_arch_list_add_reg (regcache, S390_F0_REGNUM + inib[4]))
+ if (record_full_arch_list_add_reg (regcache,
+ S390_F0_REGNUM + inib[4]))
return -1;
- if (record_full_arch_list_add_reg (regcache, S390_F0_REGNUM + inib[6]))
+ if (record_full_arch_list_add_reg (regcache,
+ S390_F0_REGNUM + inib[6]))
return -1;
if (record_full_arch_list_add_reg (regcache, S390_PSWM_REGNUM))
return -1;
@@ -4062,12 +4172,12 @@ ex:
return -1;
break;
- /* 0xb354-0xb356 undefined */
- /* 0xb35a undefined */
+ /* 0xb354-0xb356 undefined */
+ /* 0xb35a undefined */
- /* 0xb35c-0xb35e undefined */
- /* 0xb364 undefined */
- /* 0xb368 undefined */
+ /* 0xb35c-0xb35e undefined */
+ /* 0xb364 undefined */
+ /* 0xb368 undefined */
case 0xb369: /* CXR - compare */
case 0xb3f4: /* CEDTR - compare biased exponent */
@@ -4085,13 +4195,13 @@ ex:
return -1;
break;
- /* 0xb36a-0xb36f undefined */
- /* 0xb377-0xb37e undefined */
- /* 0xb380-0xb383 undefined */
- /* 0xb386-0xb38b undefined */
- /* 0xb38d-0xb38f undefined */
- /* 0xb393 undefined */
- /* 0xb397 undefined */
+ /* 0xb36a-0xb36f undefined */
+ /* 0xb377-0xb37e undefined */
+ /* 0xb380-0xb383 undefined */
+ /* 0xb386-0xb38b undefined */
+ /* 0xb38d-0xb38f undefined */
+ /* 0xb393 undefined */
+ /* 0xb397 undefined */
case 0xb398: /* CFEBR - convert to fixed */
case 0xb399: /* CFDBR - convert to fixed */
@@ -4104,7 +4214,8 @@ ex:
case 0xb943: /* CLFDTR - convert to logical */
case 0xb94b: /* CLFXTR - convert to logical */
/* 32-bit gpr destination + flags + fpc */
- if (record_full_arch_list_add_reg (regcache, S390_R0_REGNUM + inib[6]))
+ if (record_full_arch_list_add_reg (regcache,
+ S390_R0_REGNUM + inib[6]))
return -1;
if (record_full_arch_list_add_reg (regcache, S390_PSWM_REGNUM))
return -1;
@@ -4112,11 +4223,11 @@ ex:
return -1;
break;
- /* 0xb39b undefined */
- /* 0xb39f undefined */
+ /* 0xb39b undefined */
+ /* 0xb39f undefined */
- /* 0xb3a3 undefined */
- /* 0xb3a7 undefined */
+ /* 0xb3a3 undefined */
+ /* 0xb3a7 undefined */
case 0xb3a8: /* CGEBR - convert to fixed */
case 0xb3a9: /* CGDBR - convert to fixed */
@@ -4137,9 +4248,9 @@ ex:
return -1;
break;
- /* 0xb3ab undefined */
- /* 0xb3af-0xb3b3 undefined */
- /* 0xb3b7 undefined */
+ /* 0xb3ab undefined */
+ /* 0xb3af-0xb3b3 undefined */
+ /* 0xb3b7 undefined */
case 0xb3b8: /* CFER - convert to fixed */
case 0xb3b9: /* CFDR - convert to fixed */
@@ -4155,7 +4266,8 @@ ex:
case 0xb9fa: /* ALRK - add logical */
case 0xb9fb: /* SLRK - subtract logical */
/* 32-bit gpr destination + flags */
- if (record_full_arch_list_add_reg (regcache, S390_R0_REGNUM + inib[6]))
+ if (record_full_arch_list_add_reg (regcache,
+ S390_R0_REGNUM + inib[6]))
return -1;
if (record_full_arch_list_add_reg (regcache, S390_PSWM_REGNUM))
return -1;
@@ -4214,10 +4326,10 @@ ex:
return -1;
break;
- /* 0xb3bb-0xb3c0 undefined */
- /* 0xb3c2-0xb3c3 undefined */
- /* 0xb3c7 undefined */
- /* 0xb3cb-0xb3cc undefined */
+ /* 0xb3bb-0xb3c0 undefined */
+ /* 0xb3c2-0xb3c3 undefined */
+ /* 0xb3c7 undefined */
+ /* 0xb3cb-0xb3cc undefined */
case 0xb3cd: /* LGDR - load gr from fpr */
case 0xb3e2: /* CUDTR - convert to unsigned packed */
@@ -4244,8 +4356,8 @@ ex:
return -1;
break;
- /* 0xb3ce-0xb3cf undefined */
- /* 0xb3e6 undefined */
+ /* 0xb3ce-0xb3cf undefined */
+ /* 0xb3e6 undefined */
case 0xb3ea: /* CUXTR - convert to unsigned packed */
case 0xb3eb: /* CSXTR - convert to signed packed */
@@ -4261,15 +4373,15 @@ ex:
return -1;
break;
- /* 0xb3ee undefined */
- /* 0xb3f0 undefined */
- /* 0xb3f8 undefined */
+ /* 0xb3ee undefined */
+ /* 0xb3f0 undefined */
+ /* 0xb3f8 undefined */
- /* 0xb905 privileged */
+ /* 0xb905 privileged */
- /* 0xb90e unsupported: EREGG */
+ /* 0xb90e unsupported: EREGG */
- /* 0xb915 undefined */
+ /* 0xb915 undefined */
case 0xb91e: /* KMAC - compute message authentication code [partial] */
regcache_raw_read_unsigned (regcache, S390_R1_REGNUM, &tmp);
@@ -4278,50 +4390,53 @@ ex:
tmp &= 0xff;
switch (tmp)
{
- case 0x00: /* KMAC-Query */
- if (record_full_arch_list_add_mem (oaddr, 16))
- return -1;
- break;
-
- case 0x01: /* KMAC-DEA */
- case 0x02: /* KMAC-TDEA-128 */
- case 0x03: /* KMAC-TDEA-192 */
- case 0x09: /* KMAC-Encrypted-DEA */
- case 0x0a: /* KMAC-Encrypted-TDEA-128 */
- case 0x0b: /* KMAC-Encrypted-TDEA-192 */
- if (record_full_arch_list_add_mem (oaddr, 8))
- return -1;
- break;
+ case 0x00: /* KMAC-Query */
+ if (record_full_arch_list_add_mem (oaddr, 16))
+ return -1;
+ break;
- case 0x12: /* KMAC-AES-128 */
- case 0x13: /* KMAC-AES-192 */
- case 0x14: /* KMAC-AES-256 */
- case 0x1a: /* KMAC-Encrypted-AES-128 */
- case 0x1b: /* KMAC-Encrypted-AES-192 */
- case 0x1c: /* KMAC-Encrypted-AES-256 */
- if (record_full_arch_list_add_mem (oaddr, 16))
- return -1;
- break;
+ case 0x01: /* KMAC-DEA */
+ case 0x02: /* KMAC-TDEA-128 */
+ case 0x03: /* KMAC-TDEA-192 */
+ case 0x09: /* KMAC-Encrypted-DEA */
+ case 0x0a: /* KMAC-Encrypted-TDEA-128 */
+ case 0x0b: /* KMAC-Encrypted-TDEA-192 */
+ if (record_full_arch_list_add_mem (oaddr, 8))
+ return -1;
+ break;
- default:
- gdb_printf (gdb_stdlog, "Warning: Unknown KMAC function %02x at %s.\n",
- (int)tmp, paddress (gdbarch, addr));
+ case 0x12: /* KMAC-AES-128 */
+ case 0x13: /* KMAC-AES-192 */
+ case 0x14: /* KMAC-AES-256 */
+ case 0x1a: /* KMAC-Encrypted-AES-128 */
+ case 0x1b: /* KMAC-Encrypted-AES-192 */
+ case 0x1c: /* KMAC-Encrypted-AES-256 */
+ if (record_full_arch_list_add_mem (oaddr, 16))
return -1;
+ break;
+
+ default:
+ gdb_printf (gdb_stdlog,
+ "Warning: Unknown KMAC function %02x at %s.\n",
+ (int) tmp, paddress (gdbarch, addr));
+ return -1;
}
if (tmp != 0)
{
- if (record_full_arch_list_add_reg (regcache, S390_R0_REGNUM + inib[7]))
+ if (record_full_arch_list_add_reg (regcache,
+ S390_R0_REGNUM + inib[7]))
return -1;
- if (record_full_arch_list_add_reg (regcache, S390_R0_REGNUM + (inib[7] | 1)))
+ if (record_full_arch_list_add_reg (regcache, S390_R0_REGNUM
+ + (inib[7] | 1)))
return -1;
}
if (record_full_arch_list_add_reg (regcache, S390_PSWM_REGNUM))
return -1;
break;
- /* 0xb922-0xb924 undefined */
- /* 0xb925 privileged */
- /* 0xb928 privileged */
+ /* 0xb922-0xb924 undefined */
+ /* 0xb925 privileged */
+ /* 0xb928 privileged */
case 0xb929: /* KMA - cipher message with authentication */
case 0xb92a: /* KMF - cipher message with cipher feedback [partial] */
@@ -4333,58 +4448,65 @@ ex:
tmp &= 0x7f;
switch (tmp)
{
- case 0x00: /* KM*-Query */
- if (record_full_arch_list_add_mem (oaddr, 16))
- return -1;
- break;
-
- case 0x01: /* KM*-DEA */
- case 0x02: /* KM*-TDEA-128 */
- case 0x03: /* KM*-TDEA-192 */
- case 0x09: /* KM*-Encrypted-DEA */
- case 0x0a: /* KM*-Encrypted-TDEA-128 */
- case 0x0b: /* KM*-Encrypted-TDEA-192 */
- if (record_full_arch_list_add_mem (oaddr, 8))
- return -1;
- break;
+ case 0x00: /* KM*-Query */
+ if (record_full_arch_list_add_mem (oaddr, 16))
+ return -1;
+ break;
- case 0x12: /* KM*-AES-128 */
- case 0x13: /* KM*-AES-192 */
- case 0x14: /* KM*-AES-256 */
- case 0x1a: /* KM*-Encrypted-AES-128 */
- case 0x1b: /* KM*-Encrypted-AES-192 */
- case 0x1c: /* KM*-Encrypted-AES-256 */
- if (record_full_arch_list_add_mem (oaddr, 16))
- return -1;
- break;
+ case 0x01: /* KM*-DEA */
+ case 0x02: /* KM*-TDEA-128 */
+ case 0x03: /* KM*-TDEA-192 */
+ case 0x09: /* KM*-Encrypted-DEA */
+ case 0x0a: /* KM*-Encrypted-TDEA-128 */
+ case 0x0b: /* KM*-Encrypted-TDEA-192 */
+ if (record_full_arch_list_add_mem (oaddr, 8))
+ return -1;
+ break;
- case 0x43: /* KMC-PRNG */
- /* Only valid for KMC. */
- if (insn[0] == 0xb92f)
- {
- if (record_full_arch_list_add_mem (oaddr, 8))
- return -1;
- break;
- }
- /* For other instructions... */
- /* Fall through. */
- default:
- gdb_printf (gdb_stdlog, "Warning: Unknown KM* function %02x at %s.\n",
- (int)tmp, paddress (gdbarch, addr));
+ case 0x12: /* KM*-AES-128 */
+ case 0x13: /* KM*-AES-192 */
+ case 0x14: /* KM*-AES-256 */
+ case 0x1a: /* KM*-Encrypted-AES-128 */
+ case 0x1b: /* KM*-Encrypted-AES-192 */
+ case 0x1c: /* KM*-Encrypted-AES-256 */
+ if (record_full_arch_list_add_mem (oaddr, 16))
return -1;
+ break;
+
+ case 0x43: /* KMC-PRNG */
+ /* Only valid for KMC. */
+ if (insn[0] == 0xb92f)
+ {
+ if (record_full_arch_list_add_mem (oaddr, 8))
+ return -1;
+ break;
+ }
+ /* For other instructions... */
+ /* Fall through. */
+ default:
+ gdb_printf (gdb_stdlog,
+ "Warning: Unknown KM* function %02x at %s.\n",
+ (int) tmp, paddress (gdbarch, addr));
+ return -1;
}
if (tmp != 0)
{
- regcache_raw_read_unsigned (regcache, S390_R0_REGNUM + inib[6], &tmp);
+ regcache_raw_read_unsigned (regcache, S390_R0_REGNUM + inib[6],
+ &tmp);
oaddr2 = s390_record_address_mask (gdbarch, regcache, tmp);
- regcache_raw_read_unsigned (regcache, S390_R0_REGNUM + (inib[7] | 1), &tmp);
+ regcache_raw_read_unsigned (regcache,
+ S390_R0_REGNUM + (inib[7] | 1),
+ &tmp);
if (record_full_arch_list_add_mem (oaddr2, tmp))
return -1;
- if (record_full_arch_list_add_reg (regcache, S390_R0_REGNUM + inib[6]))
+ if (record_full_arch_list_add_reg (regcache,
+ S390_R0_REGNUM + inib[6]))
return -1;
- if (record_full_arch_list_add_reg (regcache, S390_R0_REGNUM + inib[7]))
+ if (record_full_arch_list_add_reg (regcache,
+ S390_R0_REGNUM + inib[7]))
return -1;
- if (record_full_arch_list_add_reg (regcache, S390_R0_REGNUM + (inib[7] | 1)))
+ if (record_full_arch_list_add_reg (regcache, S390_R0_REGNUM
+ + (inib[7] | 1)))
return -1;
}
if (tmp != 0 && insn[0] == 0xb929)
@@ -4392,8 +4514,8 @@ ex:
if (record_full_arch_list_add_reg (regcache,
S390_R0_REGNUM + inib[4]))
return -1;
- if (record_full_arch_list_add_reg (regcache,
- S390_R0_REGNUM + (inib[4] | 1)))
+ if (record_full_arch_list_add_reg (regcache, S390_R0_REGNUM
+ + (inib[4] | 1)))
return -1;
}
if (record_full_arch_list_add_reg (regcache, S390_PSWM_REGNUM))
@@ -4407,55 +4529,56 @@ ex:
tmp &= 0x7f;
switch (tmp)
{
- case 0x00: /* PCC-Query */
- if (record_full_arch_list_add_mem (oaddr, 16))
- return -1;
- break;
-
- case 0x01: /* PCC-Compute-Last-Block-CMAC-Using-DEA */
- case 0x02: /* PCC-Compute-Last-Block-CMAC-Using-TDEA-128 */
- case 0x03: /* PCC-Compute-Last-Block-CMAC-Using-TDEA-192 */
- case 0x09: /* PCC-Compute-Last-Block-CMAC-Using-Encrypted-DEA */
- case 0x0a: /* PCC-Compute-Last-Block-CMAC-Using-Encrypted-TDEA-128 */
- case 0x0b: /* PCC-Compute-Last-Block-CMAC-Using-Encrypted-TDEA-192 */
- if (record_full_arch_list_add_mem (oaddr + 0x10, 8))
- return -1;
- break;
+ case 0x00: /* PCC-Query */
+ if (record_full_arch_list_add_mem (oaddr, 16))
+ return -1;
+ break;
- case 0x12: /* PCC-Compute-Last-Block-CMAC-Using-AES-128 */
- case 0x13: /* PCC-Compute-Last-Block-CMAC-Using-AES-192 */
- case 0x14: /* PCC-Compute-Last-Block-CMAC-Using-AES-256 */
- case 0x1a: /* PCC-Compute-Last-Block-CMAC-Using-Encrypted-AES-128 */
- case 0x1b: /* PCC-Compute-Last-Block-CMAC-Using-Encrypted-AES-192 */
- case 0x1c: /* PCC-Compute-Last-Block-CMAC-Using-Encrypted-AES-256 */
- if (record_full_arch_list_add_mem (oaddr + 0x18, 16))
- return -1;
- break;
+ case 0x01: /* PCC-Compute-Last-Block-CMAC-Using-DEA */
+ case 0x02: /* PCC-Compute-Last-Block-CMAC-Using-TDEA-128 */
+ case 0x03: /* PCC-Compute-Last-Block-CMAC-Using-TDEA-192 */
+ case 0x09: /* PCC-Compute-Last-Block-CMAC-Using-Encrypted-DEA */
+ case 0x0a: /* PCC-Compute-Last-Block-CMAC-Using-Encrypted-TDEA-128 */
+ case 0x0b: /* PCC-Compute-Last-Block-CMAC-Using-Encrypted-TDEA-192 */
+ if (record_full_arch_list_add_mem (oaddr + 0x10, 8))
+ return -1;
+ break;
- case 0x32: /* PCC-Compute-XTS-Parameter-Using-AES-128 */
- if (record_full_arch_list_add_mem (oaddr + 0x30, 32))
- return -1;
- break;
+ case 0x12: /* PCC-Compute-Last-Block-CMAC-Using-AES-128 */
+ case 0x13: /* PCC-Compute-Last-Block-CMAC-Using-AES-192 */
+ case 0x14: /* PCC-Compute-Last-Block-CMAC-Using-AES-256 */
+ case 0x1a: /* PCC-Compute-Last-Block-CMAC-Using-Encrypted-AES-128 */
+ case 0x1b: /* PCC-Compute-Last-Block-CMAC-Using-Encrypted-AES-192 */
+ case 0x1c: /* PCC-Compute-Last-Block-CMAC-Using-Encrypted-AES-256 */
+ if (record_full_arch_list_add_mem (oaddr + 0x18, 16))
+ return -1;
+ break;
- case 0x34: /* PCC-Compute-XTS-Parameter-Using-AES-256 */
- if (record_full_arch_list_add_mem (oaddr + 0x40, 32))
- return -1;
- break;
+ case 0x32: /* PCC-Compute-XTS-Parameter-Using-AES-128 */
+ if (record_full_arch_list_add_mem (oaddr + 0x30, 32))
+ return -1;
+ break;
- case 0x3a: /* PCC-Compute-XTS-Parameter-Using-Encrypted-AES-128 */
- if (record_full_arch_list_add_mem (oaddr + 0x50, 32))
- return -1;
- break;
+ case 0x34: /* PCC-Compute-XTS-Parameter-Using-AES-256 */
+ if (record_full_arch_list_add_mem (oaddr + 0x40, 32))
+ return -1;
+ break;
- case 0x3c: /* PCC-Compute-XTS-Parameter-Using-Encrypted-AES-256 */
- if (record_full_arch_list_add_mem (oaddr + 0x60, 32))
- return -1;
- break;
+ case 0x3a: /* PCC-Compute-XTS-Parameter-Using-Encrypted-AES-128 */
+ if (record_full_arch_list_add_mem (oaddr + 0x50, 32))
+ return -1;
+ break;
- default:
- gdb_printf (gdb_stdlog, "Warning: Unknown PCC function %02x at %s.\n",
- (int)tmp, paddress (gdbarch, addr));
+ case 0x3c: /* PCC-Compute-XTS-Parameter-Using-Encrypted-AES-256 */
+ if (record_full_arch_list_add_mem (oaddr + 0x60, 32))
return -1;
+ break;
+
+ default:
+ gdb_printf (gdb_stdlog,
+ "Warning: Unknown PCC function %02x at %s.\n",
+ (int) tmp, paddress (gdbarch, addr));
+ return -1;
}
if (record_full_arch_list_add_reg (regcache, S390_PSWM_REGNUM))
return -1;
@@ -4468,44 +4591,52 @@ ex:
tmp &= 0x7f;
switch (tmp)
{
- case 0x00: /* KMCTR-Query */
- if (record_full_arch_list_add_mem (oaddr, 16))
- return -1;
- break;
+ case 0x00: /* KMCTR-Query */
+ if (record_full_arch_list_add_mem (oaddr, 16))
+ return -1;
+ break;
- case 0x01: /* KMCTR-DEA */
- case 0x02: /* KMCTR-TDEA-128 */
- case 0x03: /* KMCTR-TDEA-192 */
- case 0x09: /* KMCTR-Encrypted-DEA */
- case 0x0a: /* KMCTR-Encrypted-TDEA-128 */
- case 0x0b: /* KMCTR-Encrypted-TDEA-192 */
- case 0x12: /* KMCTR-AES-128 */
- case 0x13: /* KMCTR-AES-192 */
- case 0x14: /* KMCTR-AES-256 */
- case 0x1a: /* KMCTR-Encrypted-AES-128 */
- case 0x1b: /* KMCTR-Encrypted-AES-192 */
- case 0x1c: /* KMCTR-Encrypted-AES-256 */
- break;
+ case 0x01: /* KMCTR-DEA */
+ case 0x02: /* KMCTR-TDEA-128 */
+ case 0x03: /* KMCTR-TDEA-192 */
+ case 0x09: /* KMCTR-Encrypted-DEA */
+ case 0x0a: /* KMCTR-Encrypted-TDEA-128 */
+ case 0x0b: /* KMCTR-Encrypted-TDEA-192 */
+ case 0x12: /* KMCTR-AES-128 */
+ case 0x13: /* KMCTR-AES-192 */
+ case 0x14: /* KMCTR-AES-256 */
+ case 0x1a: /* KMCTR-Encrypted-AES-128 */
+ case 0x1b: /* KMCTR-Encrypted-AES-192 */
+ case 0x1c: /* KMCTR-Encrypted-AES-256 */
+ break;
- default:
- gdb_printf (gdb_stdlog, "Warning: Unknown KMCTR function %02x at %s.\n",
- (int)tmp, paddress (gdbarch, addr));
- return -1;
+ default:
+ gdb_printf (gdb_stdlog,
+ "Warning: Unknown KMCTR function %02x at %s.\n",
+ (int) tmp, paddress (gdbarch, addr));
+ return -1;
}
if (tmp != 0)
{
- regcache_raw_read_unsigned (regcache, S390_R0_REGNUM + inib[6], &tmp);
+ regcache_raw_read_unsigned (regcache, S390_R0_REGNUM + inib[6],
+ &tmp);
oaddr2 = s390_record_address_mask (gdbarch, regcache, tmp);
- regcache_raw_read_unsigned (regcache, S390_R0_REGNUM + (inib[7] | 1), &tmp);
+ regcache_raw_read_unsigned (regcache,
+ S390_R0_REGNUM + (inib[7] | 1),
+ &tmp);
if (record_full_arch_list_add_mem (oaddr2, tmp))
return -1;
- if (record_full_arch_list_add_reg (regcache, S390_R0_REGNUM + inib[6]))
+ if (record_full_arch_list_add_reg (regcache,
+ S390_R0_REGNUM + inib[6]))
return -1;
- if (record_full_arch_list_add_reg (regcache, S390_R0_REGNUM + inib[7]))
+ if (record_full_arch_list_add_reg (regcache,
+ S390_R0_REGNUM + inib[7]))
return -1;
- if (record_full_arch_list_add_reg (regcache, S390_R0_REGNUM + (inib[7] | 1)))
+ if (record_full_arch_list_add_reg (regcache, S390_R0_REGNUM
+ + (inib[7] | 1)))
return -1;
- if (record_full_arch_list_add_reg (regcache, S390_R0_REGNUM + inib[4]))
+ if (record_full_arch_list_add_reg (regcache,
+ S390_R0_REGNUM + inib[4]))
return -1;
}
if (record_full_arch_list_add_reg (regcache, S390_PSWM_REGNUM))
@@ -4519,75 +4650,82 @@ ex:
tmp &= 0x7f;
switch (tmp)
{
- case 0x00: /* KM-Query */
- if (record_full_arch_list_add_mem (oaddr, 16))
- return -1;
- break;
-
- case 0x01: /* KM-DEA */
- case 0x02: /* KM-TDEA-128 */
- case 0x03: /* KM-TDEA-192 */
- case 0x09: /* KM-Encrypted-DEA */
- case 0x0a: /* KM-Encrypted-TDEA-128 */
- case 0x0b: /* KM-Encrypted-TDEA-192 */
- case 0x12: /* KM-AES-128 */
- case 0x13: /* KM-AES-192 */
- case 0x14: /* KM-AES-256 */
- case 0x1a: /* KM-Encrypted-AES-128 */
- case 0x1b: /* KM-Encrypted-AES-192 */
- case 0x1c: /* KM-Encrypted-AES-256 */
- break;
+ case 0x00: /* KM-Query */
+ if (record_full_arch_list_add_mem (oaddr, 16))
+ return -1;
+ break;
- case 0x32: /* KM-XTS-AES-128 */
- if (record_full_arch_list_add_mem (oaddr + 0x10, 16))
- return -1;
- break;
+ case 0x01: /* KM-DEA */
+ case 0x02: /* KM-TDEA-128 */
+ case 0x03: /* KM-TDEA-192 */
+ case 0x09: /* KM-Encrypted-DEA */
+ case 0x0a: /* KM-Encrypted-TDEA-128 */
+ case 0x0b: /* KM-Encrypted-TDEA-192 */
+ case 0x12: /* KM-AES-128 */
+ case 0x13: /* KM-AES-192 */
+ case 0x14: /* KM-AES-256 */
+ case 0x1a: /* KM-Encrypted-AES-128 */
+ case 0x1b: /* KM-Encrypted-AES-192 */
+ case 0x1c: /* KM-Encrypted-AES-256 */
+ break;
- case 0x34: /* KM-XTS-AES-256 */
- if (record_full_arch_list_add_mem (oaddr + 0x20, 16))
- return -1;
- break;
+ case 0x32: /* KM-XTS-AES-128 */
+ if (record_full_arch_list_add_mem (oaddr + 0x10, 16))
+ return -1;
+ break;
- case 0x3a: /* KM-XTS-Encrypted-AES-128 */
- if (record_full_arch_list_add_mem (oaddr + 0x30, 16))
- return -1;
- break;
+ case 0x34: /* KM-XTS-AES-256 */
+ if (record_full_arch_list_add_mem (oaddr + 0x20, 16))
+ return -1;
+ break;
- case 0x3c: /* KM-XTS-Encrypted-AES-256 */
- if (record_full_arch_list_add_mem (oaddr + 0x40, 16))
- return -1;
- break;
+ case 0x3a: /* KM-XTS-Encrypted-AES-128 */
+ if (record_full_arch_list_add_mem (oaddr + 0x30, 16))
+ return -1;
+ break;
- default:
- gdb_printf (gdb_stdlog, "Warning: Unknown KM function %02x at %s.\n",
- (int)tmp, paddress (gdbarch, addr));
+ case 0x3c: /* KM-XTS-Encrypted-AES-256 */
+ if (record_full_arch_list_add_mem (oaddr + 0x40, 16))
return -1;
+ break;
+
+ default:
+ gdb_printf (gdb_stdlog,
+ "Warning: Unknown KM function %02x at %s.\n",
+ (int) tmp, paddress (gdbarch, addr));
+ return -1;
}
if (tmp != 0)
{
- regcache_raw_read_unsigned (regcache, S390_R0_REGNUM + inib[6], &tmp);
+ regcache_raw_read_unsigned (regcache, S390_R0_REGNUM + inib[6],
+ &tmp);
oaddr2 = s390_record_address_mask (gdbarch, regcache, tmp);
- regcache_raw_read_unsigned (regcache, S390_R0_REGNUM + (inib[7] | 1), &tmp);
+ regcache_raw_read_unsigned (regcache,
+ S390_R0_REGNUM + (inib[7] | 1),
+ &tmp);
if (record_full_arch_list_add_mem (oaddr2, tmp))
return -1;
- if (record_full_arch_list_add_reg (regcache, S390_R0_REGNUM + inib[6]))
+ if (record_full_arch_list_add_reg (regcache,
+ S390_R0_REGNUM + inib[6]))
return -1;
- if (record_full_arch_list_add_reg (regcache, S390_R0_REGNUM + inib[7]))
+ if (record_full_arch_list_add_reg (regcache,
+ S390_R0_REGNUM + inib[7]))
return -1;
- if (record_full_arch_list_add_reg (regcache, S390_R0_REGNUM + (inib[7] | 1)))
+ if (record_full_arch_list_add_reg (regcache, S390_R0_REGNUM
+ + (inib[7] | 1)))
return -1;
}
if (record_full_arch_list_add_reg (regcache, S390_PSWM_REGNUM))
return -1;
break;
- /* 0xb932-0xb937 undefined */
+ /* 0xb932-0xb937 undefined */
- /* 0xb938 unsupported: SORTL - sort lists */
- /* 0xb939 unsupported: DFLTCC - deflate conversion call */
- /* 0xb93a unsupported: KDSA - compute dig. signature auth. */
+ /* 0xb938 unsupported: SORTL - sort lists */
+ /* 0xb939 unsupported: DFLTCC - deflate conversion call */
+ /* 0xb93a unsupported: KDSA - compute dig. signature auth. */
- /* 0xb93b undefined */
+ /* 0xb93b undefined */
case 0xb93c: /* PPNO - perform pseudorandom number operation [partial] */
regcache_raw_read_unsigned (regcache, S390_R1_REGNUM, &tmp);
@@ -4596,39 +4734,47 @@ ex:
tmp &= 0xff;
switch (tmp)
{
- case 0x00: /* PPNO-Query */
- case 0x80: /* PPNO-Query */
- if (record_full_arch_list_add_mem (oaddr, 16))
- return -1;
- break;
-
- case 0x03: /* PPNO-SHA-512-DRNG - generate */
- if (record_full_arch_list_add_mem (oaddr, 240))
- return -1;
- regcache_raw_read_unsigned (regcache, S390_R0_REGNUM + inib[6], &tmp);
- oaddr2 = s390_record_address_mask (gdbarch, regcache, tmp);
- regcache_raw_read_unsigned (regcache, S390_R0_REGNUM + (inib[6] | 1), &tmp);
- if (record_full_arch_list_add_mem (oaddr2, tmp))
- return -1;
- if (record_full_arch_list_add_reg (regcache, S390_R0_REGNUM + inib[6]))
- return -1;
- if (record_full_arch_list_add_reg (regcache, S390_R0_REGNUM + (inib[6] | 1)))
- return -1;
- break;
+ case 0x00: /* PPNO-Query */
+ case 0x80: /* PPNO-Query */
+ if (record_full_arch_list_add_mem (oaddr, 16))
+ return -1;
+ break;
- case 0x83: /* PPNO-SHA-512-DRNG - seed */
- if (record_full_arch_list_add_mem (oaddr, 240))
- return -1;
- if (record_full_arch_list_add_reg (regcache, S390_R0_REGNUM + inib[7]))
- return -1;
- if (record_full_arch_list_add_reg (regcache, S390_R0_REGNUM + (inib[7] | 1)))
- return -1;
- break;
+ case 0x03: /* PPNO-SHA-512-DRNG - generate */
+ if (record_full_arch_list_add_mem (oaddr, 240))
+ return -1;
+ regcache_raw_read_unsigned (regcache, S390_R0_REGNUM + inib[6],
+ &tmp);
+ oaddr2 = s390_record_address_mask (gdbarch, regcache, tmp);
+ regcache_raw_read_unsigned (regcache,
+ S390_R0_REGNUM + (inib[6] | 1),
+ &tmp);
+ if (record_full_arch_list_add_mem (oaddr2, tmp))
+ return -1;
+ if (record_full_arch_list_add_reg (regcache,
+ S390_R0_REGNUM + inib[6]))
+ return -1;
+ if (record_full_arch_list_add_reg (regcache, S390_R0_REGNUM
+ + (inib[6] | 1)))
+ return -1;
+ break;
- default:
- gdb_printf (gdb_stdlog, "Warning: Unknown PPNO function %02x at %s.\n",
- (int)tmp, paddress (gdbarch, addr));
+ case 0x83: /* PPNO-SHA-512-DRNG - seed */
+ if (record_full_arch_list_add_mem (oaddr, 240))
+ return -1;
+ if (record_full_arch_list_add_reg (regcache,
+ S390_R0_REGNUM + inib[7]))
+ return -1;
+ if (record_full_arch_list_add_reg (regcache, S390_R0_REGNUM
+ + (inib[7] | 1)))
return -1;
+ break;
+
+ default:
+ gdb_printf (gdb_stdlog,
+ "Warning: Unknown PPNO function %02x at %s.\n",
+ (int) tmp, paddress (gdbarch, addr));
+ return -1;
}
/* DXC may be written */
if (record_full_arch_list_add_reg (regcache, S390_FPC_REGNUM))
@@ -4637,7 +4783,7 @@ ex:
return -1;
break;
- /* 0xb93d undefined */
+ /* 0xb93d undefined */
case 0xb93e: /* KIMD - compute intermediate message digest [partial] */
case 0xb93f: /* KLMD - compute last message digest [partial] */
@@ -4647,60 +4793,63 @@ ex:
tmp &= 0xff;
switch (tmp)
{
- case 0x00: /* K*MD-Query */
- if (record_full_arch_list_add_mem (oaddr, 16))
- return -1;
- break;
-
- case 0x01: /* K*MD-SHA-1 */
- if (record_full_arch_list_add_mem (oaddr, 20))
- return -1;
- break;
+ case 0x00: /* K*MD-Query */
+ if (record_full_arch_list_add_mem (oaddr, 16))
+ return -1;
+ break;
- case 0x02: /* K*MD-SHA-256 */
- if (record_full_arch_list_add_mem (oaddr, 32))
- return -1;
- break;
+ case 0x01: /* K*MD-SHA-1 */
+ if (record_full_arch_list_add_mem (oaddr, 20))
+ return -1;
+ break;
- case 0x03: /* K*MD-SHA-512 */
- if (record_full_arch_list_add_mem (oaddr, 64))
- return -1;
- break;
+ case 0x02: /* K*MD-SHA-256 */
+ if (record_full_arch_list_add_mem (oaddr, 32))
+ return -1;
+ break;
- case 0x41: /* KIMD-GHASH */
- /* Only valid for KIMD. */
- if (insn[0] == 0xb93e)
- {
- if (record_full_arch_list_add_mem (oaddr, 16))
- return -1;
- break;
- }
- /* For KLMD... */
- /* Fall through. */
- default:
- gdb_printf (gdb_stdlog, "Warning: Unknown KMAC function %02x at %s.\n",
- (int)tmp, paddress (gdbarch, addr));
+ case 0x03: /* K*MD-SHA-512 */
+ if (record_full_arch_list_add_mem (oaddr, 64))
return -1;
+ break;
+
+ case 0x41: /* KIMD-GHASH */
+ /* Only valid for KIMD. */
+ if (insn[0] == 0xb93e)
+ {
+ if (record_full_arch_list_add_mem (oaddr, 16))
+ return -1;
+ break;
+ }
+ /* For KLMD... */
+ /* Fall through. */
+ default:
+ gdb_printf (gdb_stdlog,
+ "Warning: Unknown KMAC function %02x at %s.\n",
+ (int) tmp, paddress (gdbarch, addr));
+ return -1;
}
if (tmp != 0)
{
- if (record_full_arch_list_add_reg (regcache, S390_R0_REGNUM + inib[7]))
+ if (record_full_arch_list_add_reg (regcache,
+ S390_R0_REGNUM + inib[7]))
return -1;
- if (record_full_arch_list_add_reg (regcache, S390_R0_REGNUM + (inib[7] | 1)))
+ if (record_full_arch_list_add_reg (regcache, S390_R0_REGNUM
+ + (inib[7] | 1)))
return -1;
}
if (record_full_arch_list_add_reg (regcache, S390_PSWM_REGNUM))
return -1;
break;
- /* 0xb940 undefined */
- /* 0xb944-0xb945 undefined */
- /* 0xb947-0xb948 undefined */
- /* 0xb94c-0xb950 undefined */
- /* 0xb954-0xb958 undefined */
- /* 0xb95c-0xb95f undefined */
- /* 0xb962-0xb971 undefined */
- /* 0xb974-0xb97f undefined */
+ /* 0xb940 undefined */
+ /* 0xb944-0xb945 undefined */
+ /* 0xb947-0xb948 undefined */
+ /* 0xb94c-0xb950 undefined */
+ /* 0xb954-0xb958 undefined */
+ /* 0xb95c-0xb95f undefined */
+ /* 0xb962-0xb971 undefined */
+ /* 0xb974-0xb97f undefined */
case 0xb983: /* FLOGR - find leftmost one */
/* 64-bit gpr pair destination + flags */
@@ -4712,26 +4861,30 @@ ex:
return -1;
break;
- /* 0xb98a privileged */
- /* 0xb98b-0xb98c undefined */
+ /* 0xb98a privileged */
+ /* 0xb98b-0xb98c undefined */
case 0xb98d: /* EPSW - extract psw */
- if (record_full_arch_list_add_reg (regcache, S390_R0_REGNUM + inib[6]))
+ if (record_full_arch_list_add_reg (regcache,
+ S390_R0_REGNUM + inib[6]))
return -1;
if (inib[7])
- if (record_full_arch_list_add_reg (regcache, S390_R0_REGNUM + inib[7]))
+ if (record_full_arch_list_add_reg (regcache,
+ S390_R0_REGNUM + inib[7]))
return -1;
break;
- /* 0xb98e-0xb98f privileged */
+ /* 0xb98e-0xb98f privileged */
case 0xb990: /* TRTT - translate two to two [partial] */
case 0xb991: /* TRTO - translate two to one [partial] */
case 0xb992: /* TROT - translate one to two [partial] */
case 0xb993: /* TROO - translate one to one [partial] */
- regcache_raw_read_unsigned (regcache, S390_R0_REGNUM + inib[6], &tmp);
+ regcache_raw_read_unsigned (regcache, S390_R0_REGNUM + inib[6],
+ &tmp);
oaddr = s390_record_address_mask (gdbarch, regcache, tmp);
- regcache_raw_read_unsigned (regcache, S390_R0_REGNUM + (inib[6] | 1), &tmp);
+ regcache_raw_read_unsigned (regcache, S390_R0_REGNUM + (inib[6] | 1),
+ &tmp);
/* tmp is source length, we want destination length. Adjust. */
if (insn[0] == 0xb991)
tmp >>= 1;
@@ -4739,11 +4892,14 @@ ex:
tmp <<= 1;
if (record_full_arch_list_add_mem (oaddr, tmp))
return -1;
- if (record_full_arch_list_add_reg (regcache, S390_R0_REGNUM + inib[6]))
+ if (record_full_arch_list_add_reg (regcache,
+ S390_R0_REGNUM + inib[6]))
return -1;
- if (record_full_arch_list_add_reg (regcache, S390_R0_REGNUM + (inib[6] | 1)))
+ if (record_full_arch_list_add_reg (regcache,
+ S390_R0_REGNUM + (inib[6] | 1)))
return -1;
- if (record_full_arch_list_add_reg (regcache, S390_R0_REGNUM + inib[7]))
+ if (record_full_arch_list_add_reg (regcache,
+ S390_R0_REGNUM + inib[7]))
return -1;
if (record_full_arch_list_add_reg (regcache, S390_PSWM_REGNUM))
return -1;
@@ -4752,28 +4908,33 @@ ex:
case 0xb996: /* MLR - multiply logical */
case 0xb997: /* DLR - divide logical */
/* 32-bit gpr pair destination */
- if (record_full_arch_list_add_reg (regcache, S390_R0_REGNUM + inib[6]))
+ if (record_full_arch_list_add_reg (regcache,
+ S390_R0_REGNUM + inib[6]))
return -1;
- if (record_full_arch_list_add_reg (regcache, S390_R0_REGNUM + (inib[6] | 1)))
+ if (record_full_arch_list_add_reg (regcache,
+ S390_R0_REGNUM + (inib[6] | 1)))
return -1;
break;
- /* 0xb99a-0xb9af unsupported, privileged, or undefined */
- /* 0xb9b4-0xb9bc undefined */
+ /* 0xb99a-0xb9af unsupported, privileged, or undefined */
+ /* 0xb9b4-0xb9bc undefined */
case 0xb9bd: /* TRTRE - translate and test reverse extended [partial] */
case 0xb9bf: /* TRTE - translate and test extended [partial] */
- if (record_full_arch_list_add_reg (regcache, S390_R0_REGNUM + inib[6]))
+ if (record_full_arch_list_add_reg (regcache,
+ S390_R0_REGNUM + inib[6]))
return -1;
- if (record_full_arch_list_add_reg (regcache, S390_R0_REGNUM + (inib[6] | 1)))
+ if (record_full_arch_list_add_reg (regcache,
+ S390_R0_REGNUM + (inib[6] | 1)))
return -1;
- if (record_full_arch_list_add_reg (regcache, S390_R0_REGNUM + inib[7]))
+ if (record_full_arch_list_add_reg (regcache,
+ S390_R0_REGNUM + inib[7]))
return -1;
if (record_full_arch_list_add_reg (regcache, S390_PSWM_REGNUM))
return -1;
break;
- /* 0xb9c0-0xb9c7 undefined */
+ /* 0xb9c0-0xb9c7 undefined */
case 0xb9c8: /* AHHHR - add high */
case 0xb9c9: /* SHHHR - subtract high */
@@ -4790,11 +4951,11 @@ ex:
return -1;
break;
- /* 0xb9cc undefined */
- /* 0xb9ce undefined */
- /* 0xb9d0-0xb9d7 undefined */
- /* 0xb9dc undefined */
- /* 0xb9de undefined */
+ /* 0xb9cc undefined */
+ /* 0xb9ce undefined */
+ /* 0xb9d0-0xb9d7 undefined */
+ /* 0xb9dc undefined */
+ /* 0xb9de undefined */
case 0xb9e0: /* LOCFHR - load high on condition */
/* 32-bit high gpr destination */
@@ -4802,23 +4963,23 @@ ex:
return -1;
break;
- /* 0xb9e3 undefined */
- /* 0xb9e5 undefined */
- /* 0xb9ee-0xb9f1 undefined */
- /* 0xb9f3 undefined */
- /* 0xb9f5 undefined */
- /* 0xb9fc undefined */
- /* 0xb9fe -0xb9ff undefined */
+ /* 0xb9e3 undefined */
+ /* 0xb9e5 undefined */
+ /* 0xb9ee-0xb9f1 undefined */
+ /* 0xb9f3 undefined */
+ /* 0xb9f5 undefined */
+ /* 0xb9fc undefined */
+ /* 0xb9fe -0xb9ff undefined */
default:
goto UNKNOWN_OP;
}
break;
- /* 0xb4-0xb5 undefined */
- /* 0xb6 privileged: STCTL - store control */
- /* 0xb7 privileged: LCTL - load control */
- /* 0xb8 undefined */
+ /* 0xb4-0xb5 undefined */
+ /* 0xb6 privileged: STCTL - store control */
+ /* 0xb7 privileged: LCTL - load control */
+ /* 0xb8 undefined */
case 0xba: /* CS - compare and swap */
oaddr = s390_record_calc_disp (gdbarch, regcache, 0, insn[1], 0);
@@ -4836,13 +4997,14 @@ ex:
return -1;
if (record_full_arch_list_add_reg (regcache, S390_R0_REGNUM + inib[2]))
return -1;
- if (record_full_arch_list_add_reg (regcache, S390_R0_REGNUM + (inib[2] | 1)))
+ if (record_full_arch_list_add_reg (regcache,
+ S390_R0_REGNUM + (inib[2] | 1)))
return -1;
if (record_full_arch_list_add_reg (regcache, S390_PSWM_REGNUM))
return -1;
break;
- /* 0xbc undefined */
+ /* 0xbc undefined */
case 0xbe: /* STCM - store characters under mask */
oaddr = s390_record_calc_disp (gdbarch, regcache, 0, insn[1], 0);
@@ -4866,7 +5028,8 @@ ex:
case 0xc45: /* LHRL - load halfword relative long */
case 0xc4d: /* LRL - load relative long */
/* 32-bit or native gpr destination */
- if (record_full_arch_list_add_reg (regcache, S390_R0_REGNUM + inib[2]))
+ if (record_full_arch_list_add_reg (regcache,
+ S390_R0_REGNUM + inib[2]))
return -1;
break;
@@ -4884,7 +5047,7 @@ ex:
return -1;
break;
- /* 0xc02-0xc03 undefined */
+ /* 0xc02-0xc03 undefined */
case 0xc04: /* BRCL - branch relative on condition long */
case 0xc62: /* PFDRL - prefetch data relative long */
@@ -4909,7 +5072,8 @@ ex:
case 0xc29: /* AFI - add immediate */
case 0xc2b: /* ALFI - add logical immediate */
/* 32-bit gpr destination + flags */
- if (record_full_arch_list_add_reg (regcache, S390_R0_REGNUM + inib[2]))
+ if (record_full_arch_list_add_reg (regcache,
+ S390_R0_REGNUM + inib[2]))
return -1;
if (record_full_arch_list_add_reg (regcache, S390_PSWM_REGNUM))
return -1;
@@ -4923,7 +5087,7 @@ ex:
return -1;
break;
- /* 0xc22-0xc23 undefined */
+ /* 0xc22-0xc23 undefined */
case 0xc24: /* SLGFI - subtract logical immediate */
case 0xc28: /* AGFI - add immediate */
@@ -4935,7 +5099,7 @@ ex:
return -1;
break;
- /* 0xc26-0xc27 undefined */
+ /* 0xc26-0xc27 undefined */
case 0xc2c: /* CGFI - compare immediate */
case 0xc2d: /* CFI - compare immediate */
@@ -4958,25 +5122,28 @@ ex:
return -1;
break;
- /* 0xc40-0xc41 undefined */
- /* 0xc43 undefined */
+ /* 0xc40-0xc41 undefined */
+ /* 0xc43 undefined */
case 0xc47: /* STHRL - store halfword relative long */
- oaddr = s390_record_calc_rl (gdbarch, regcache, addr, insn[1], insn[2]);
+ oaddr
+ = s390_record_calc_rl (gdbarch, regcache, addr, insn[1], insn[2]);
if (record_full_arch_list_add_mem (oaddr, 2))
return -1;
break;
- /* 0xc49-0xc4a undefined */
+ /* 0xc49-0xc4a undefined */
case 0xc4b: /* STGRL - store relative long */
- oaddr = s390_record_calc_rl (gdbarch, regcache, addr, insn[1], insn[2]);
+ oaddr
+ = s390_record_calc_rl (gdbarch, regcache, addr, insn[1], insn[2]);
if (record_full_arch_list_add_mem (oaddr, 8))
return -1;
break;
case 0xc4f: /* STRL - store relative long */
- oaddr = s390_record_calc_rl (gdbarch, regcache, addr, insn[1], insn[2]);
+ oaddr
+ = s390_record_calc_rl (gdbarch, regcache, addr, insn[1], insn[2]);
if (record_full_arch_list_add_mem (oaddr, 4))
return -1;
break;
@@ -4988,10 +5155,12 @@ ex:
paddress (gdbarch, addr));
return -1;
}
- addr = s390_record_calc_rl (gdbarch, regcache, addr, insn[1], insn[2]);
+ addr
+ = s390_record_calc_rl (gdbarch, regcache, addr, insn[1], insn[2]);
if (inib[2])
{
- regcache_raw_read_unsigned (regcache, S390_R0_REGNUM + inib[2], &tmp);
+ regcache_raw_read_unsigned (regcache, S390_R0_REGNUM + inib[2],
+ &tmp);
ex = tmp & 0xff;
}
else
@@ -5000,23 +5169,23 @@ ex:
}
goto ex;
- /* 0xc61 undefined */
- /* 0xc63 undefined */
- /* 0xc69 undefined */
- /* 0xc6b undefined */
- /* 0xcc0-0xcc5 undefined */
- /* 0xcc7 undefined */
- /* 0xcc9 undefined */
- /* 0xccc undefined */
- /* 0xcce undefined */
+ /* 0xc61 undefined */
+ /* 0xc63 undefined */
+ /* 0xc69 undefined */
+ /* 0xc6b undefined */
+ /* 0xcc0-0xcc5 undefined */
+ /* 0xcc7 undefined */
+ /* 0xcc9 undefined */
+ /* 0xccc undefined */
+ /* 0xcce undefined */
default:
goto UNKNOWN_OP;
}
break;
- /* 0xc1 undefined */
- /* 0xc3 undefined */
+ /* 0xc1 undefined */
+ /* 0xc3 undefined */
case 0xc5: /* BPRP - branch prediction relative preload */
case 0xc7: /* BPP - branch prediction preload */
@@ -5027,7 +5196,7 @@ ex:
/* SSF-format instruction */
switch (ibyte[0] << 4 | inib[3])
{
- /* 0xc80 unsupported */
+ /* 0xc80 unsupported */
case 0xc81: /* ECTG - extract cpu time */
if (s390_record_gpr_g (gdbarch, regcache, inib[2]))
@@ -5049,41 +5218,44 @@ ex:
oaddr = s390_record_calc_disp (gdbarch, regcache, 0, insn[1], 0);
switch (fc)
{
- case 0x00: /* 32-bit */
- if (record_full_arch_list_add_reg (regcache, S390_R0_REGNUM + inib[2]))
- return -1;
- if (record_full_arch_list_add_mem (oaddr, 4))
- return -1;
- break;
-
- case 0x01: /* 64-bit */
- if (s390_record_gpr_g (gdbarch, regcache, inib[2]))
- return -1;
- if (record_full_arch_list_add_mem (oaddr, 8))
- return -1;
- break;
+ case 0x00: /* 32-bit */
+ if (record_full_arch_list_add_reg (regcache,
+ S390_R0_REGNUM + inib[2]))
+ return -1;
+ if (record_full_arch_list_add_mem (oaddr, 4))
+ return -1;
+ break;
- case 0x02: /* 128-bit */
- if (s390_record_gpr_g (gdbarch, regcache, inib[2]))
- return -1;
- if (s390_record_gpr_g (gdbarch, regcache, inib[2] | 1))
- return -1;
- if (record_full_arch_list_add_mem (oaddr, 16))
- return -1;
- break;
+ case 0x01: /* 64-bit */
+ if (s390_record_gpr_g (gdbarch, regcache, inib[2]))
+ return -1;
+ if (record_full_arch_list_add_mem (oaddr, 8))
+ return -1;
+ break;
- default:
- gdb_printf (gdb_stdlog, "Warning: Unknown CSST FC %02x at %s.\n",
- fc, paddress (gdbarch, addr));
+ case 0x02: /* 128-bit */
+ if (s390_record_gpr_g (gdbarch, regcache, inib[2]))
+ return -1;
+ if (s390_record_gpr_g (gdbarch, regcache, inib[2] | 1))
+ return -1;
+ if (record_full_arch_list_add_mem (oaddr, 16))
return -1;
+ break;
+
+ default:
+ gdb_printf (gdb_stdlog,
+ "Warning: Unknown CSST FC %02x at %s.\n", fc,
+ paddress (gdbarch, addr));
+ return -1;
}
/* Second operand. */
oaddr2 = s390_record_calc_disp (gdbarch, regcache, 0, insn[2], 0);
if (sc > 4)
{
- gdb_printf (gdb_stdlog, "Warning: Unknown CSST FC %02x at %s.\n",
- sc, paddress (gdbarch, addr));
+ gdb_printf (gdb_stdlog,
+ "Warning: Unknown CSST FC %02x at %s.\n", sc,
+ paddress (gdbarch, addr));
return -1;
}
@@ -5096,12 +5268,14 @@ ex:
}
break;
- /* 0xc83 undefined */
+ /* 0xc83 undefined */
case 0xc84: /* LPD - load pair disjoint */
- if (record_full_arch_list_add_reg (regcache, S390_R0_REGNUM + inib[2]))
+ if (record_full_arch_list_add_reg (regcache,
+ S390_R0_REGNUM + inib[2]))
return -1;
- if (record_full_arch_list_add_reg (regcache, S390_R0_REGNUM + (inib[2] | 1)))
+ if (record_full_arch_list_add_reg (regcache,
+ S390_R0_REGNUM + (inib[2] | 1)))
return -1;
if (record_full_arch_list_add_reg (regcache, S390_PSWM_REGNUM))
return -1;
@@ -5116,15 +5290,15 @@ ex:
return -1;
break;
- /* 0xc86-0xc8f undefined */
+ /* 0xc86-0xc8f undefined */
default:
goto UNKNOWN_OP;
}
break;
- /* 0xc9-0xcb undefined */
- /* 0xcd-0xcf undefined */
+ /* 0xc9-0xcb undefined */
+ /* 0xcd-0xcf undefined */
case 0xd0: /* TRTR - translate and test reversed */
case 0xdd: /* TRT - translate and test */
@@ -5182,11 +5356,11 @@ ex:
return -1;
break;
- /* 0xd8 undefined */
- /* 0xd9 unsupported: MVCK - move with key */
- /* 0xda unsupported: MVCP - move to primary */
- /* 0xdb unsupported: MVCS - move to secondary */
- /* 0xe0 undefined */
+ /* 0xd8 undefined */
+ /* 0xd9 unsupported: MVCK - move with key */
+ /* 0xda unsupported: MVCP - move to primary */
+ /* 0xdb unsupported: MVCS - move to secondary */
+ /* 0xe0 undefined */
case 0xe1: /* PKU - pack unicode */
case 0xe9: /* PKA - pack ASCII */
@@ -5203,7 +5377,7 @@ ex:
/* RXY/RXE/RXF/RSL/RSY/SIY/V*-format instruction */
switch (ibyte[0] << 8 | ibyte[5])
{
- /* 0xe300-0xe301 undefined */
+ /* 0xe300-0xe301 undefined */
case 0xe302: /* LTG - load and test */
case 0xe308: /* AG - add */
@@ -5229,7 +5403,7 @@ ex:
return -1;
break;
- /* 0xe303 privileged */
+ /* 0xe303 privileged */
case 0xe304: /* LG - load */
case 0xe30c: /* MSG - multiply single */
@@ -5258,17 +5432,18 @@ ex:
return -1;
break;
- /* 0xe305 undefined */
+ /* 0xe305 undefined */
case 0xe306: /* CVBY - convert to binary */
/* 32-bit or native gpr destination + FPC (DXC write) */
- if (record_full_arch_list_add_reg (regcache, S390_R0_REGNUM + inib[2]))
+ if (record_full_arch_list_add_reg (regcache,
+ S390_R0_REGNUM + inib[2]))
return -1;
if (record_full_arch_list_add_reg (regcache, S390_FPC_REGNUM))
return -1;
break;
- /* 0xe307 undefined */
+ /* 0xe307 undefined */
case 0xe30d: /* DSG - divide single */
case 0xe31d: /* DSGF - divide single */
@@ -5291,7 +5466,7 @@ ex:
return -1;
break;
- /* 0xe310-0xe311 undefined */
+ /* 0xe310-0xe311 undefined */
case 0xe312: /* LT - load and test */
case 0xe338: /* AGH - add halfword to 64 bit value */
@@ -5314,13 +5489,14 @@ ex:
case 0xebdc: /* SRAK - shift left single */
case 0xebdd: /* SLAK - shift left single */
/* 32/64-bit gpr destination + flags */
- if (record_full_arch_list_add_reg (regcache, S390_R0_REGNUM + inib[2]))
+ if (record_full_arch_list_add_reg (regcache,
+ S390_R0_REGNUM + inib[2]))
return -1;
if (record_full_arch_list_add_reg (regcache, S390_PSWM_REGNUM))
return -1;
break;
- /* 0xe313 privileged */
+ /* 0xe313 privileged */
case 0xe31e: /* LRV - load reversed */
case 0xe31f: /* LRVH - load reversed */
@@ -5339,7 +5515,8 @@ ex:
case 0xebdf: /* SLLK - shift left single logical */
case 0xebf2: /* LOC - load on condition */
/* 32-bit or native gpr destination */
- if (record_full_arch_list_add_reg (regcache, S390_R0_REGNUM + inib[2]))
+ if (record_full_arch_list_add_reg (regcache,
+ S390_R0_REGNUM + inib[2]))
return -1;
break;
@@ -5372,42 +5549,45 @@ ex:
return -1;
break;
- /* 0xe322-0xe323 undefined */
+ /* 0xe322-0xe323 undefined */
case 0xe324: /* STG - store */
case 0xe325: /* NTSTG - nontransactional store */
case 0xe326: /* CVDY - convert to decimal */
case 0xe32f: /* STRVG - store reversed */
case 0xed67: /* STDY - store */
- oaddr = s390_record_calc_disp (gdbarch, regcache, inib[3], insn[1], ibyte[4]);
+ oaddr = s390_record_calc_disp (gdbarch, regcache, inib[3], insn[1],
+ ibyte[4]);
if (record_full_arch_list_add_mem (oaddr, 8))
return -1;
break;
- /* 0xe327-0xe329 undefined */
- /* 0xe32b-0xe32d undefined */
+ /* 0xe327-0xe329 undefined */
+ /* 0xe32b-0xe32d undefined */
case 0xe32e: /* CVDG - convert to decimal */
case 0xe38e: /* STPQ - store pair to quadword */
- oaddr = s390_record_calc_disp (gdbarch, regcache, inib[3], insn[1], ibyte[4]);
+ oaddr = s390_record_calc_disp (gdbarch, regcache, inib[3], insn[1],
+ ibyte[4]);
if (record_full_arch_list_add_mem (oaddr, 16))
return -1;
break;
- /* 0xe333 undefined */
- /* 0xe335 undefined */
+ /* 0xe333 undefined */
+ /* 0xe335 undefined */
case 0xe336: /* PFD - prefetch data */
break;
- /* 0xe337 undefined */
- /* 0xe33c-0xe33d undefined */
+ /* 0xe337 undefined */
+ /* 0xe33c-0xe33d undefined */
case 0xe33e: /* STRV - store reversed */
case 0xe350: /* STY - store */
case 0xe3cb: /* STFH - store high */
case 0xed66: /* STEY - store */
- oaddr = s390_record_calc_disp (gdbarch, regcache, inib[3], insn[1], ibyte[4]);
+ oaddr = s390_record_calc_disp (gdbarch, regcache, inib[3], insn[1],
+ ibyte[4]);
if (record_full_arch_list_add_mem (oaddr, 4))
return -1;
break;
@@ -5415,49 +5595,55 @@ ex:
case 0xe33f: /* STRVH - store reversed */
case 0xe370: /* STHY - store halfword */
case 0xe3c7: /* STHH - store halfword high */
- oaddr = s390_record_calc_disp (gdbarch, regcache, inib[3], insn[1], ibyte[4]);
+ oaddr = s390_record_calc_disp (gdbarch, regcache, inib[3], insn[1],
+ ibyte[4]);
if (record_full_arch_list_add_mem (oaddr, 2))
return -1;
break;
- /* 0xe340-0xe345 undefined */
+ /* 0xe340-0xe345 undefined */
case 0xe347: /* BIC - branch indirect on condition */
break;
- /* 0xe348-0xe34f undefined */
- /* 0xe352 undefined */
+ /* 0xe348-0xe34f undefined */
+ /* 0xe352 undefined */
case 0xe35c: /* MFY - multiply */
case 0xe396: /* ML - multiply logical */
case 0xe397: /* DL - divide logical */
/* 32-bit gpr pair destination */
- if (record_full_arch_list_add_reg (regcache, S390_R0_REGNUM + inib[2]))
+ if (record_full_arch_list_add_reg (regcache,
+ S390_R0_REGNUM + inib[2]))
return -1;
- if (record_full_arch_list_add_reg (regcache, S390_R0_REGNUM + (inib[2] | 1)))
+ if (record_full_arch_list_add_reg (regcache,
+ S390_R0_REGNUM + (inib[2] | 1)))
return -1;
break;
- /* 0xe35d undefined */
- /* 0xe360-0xe36f undefined */
+ /* 0xe35d undefined */
+ /* 0xe360-0xe36f undefined */
case 0xe372: /* STCY - store character */
case 0xe3c3: /* STCH - store character high */
- oaddr = s390_record_calc_disp (gdbarch, regcache, inib[3], insn[1], ibyte[4]);
+ oaddr = s390_record_calc_disp (gdbarch, regcache, inib[3], insn[1],
+ ibyte[4]);
if (record_full_arch_list_add_mem (oaddr, 1))
return -1;
break;
- /* 0xe374 undefined */
+ /* 0xe374 undefined */
case 0xe375: /* LAEY - load address extended */
- if (record_full_arch_list_add_reg (regcache, S390_R0_REGNUM + inib[2]))
+ if (record_full_arch_list_add_reg (regcache,
+ S390_R0_REGNUM + inib[2]))
return -1;
- if (record_full_arch_list_add_reg (regcache, S390_A0_REGNUM + inib[2]))
+ if (record_full_arch_list_add_reg (regcache,
+ S390_A0_REGNUM + inib[2]))
return -1;
break;
- /* 0xe37d-0xe37f undefined */
+ /* 0xe37d-0xe37f undefined */
case 0xe385: /* LGAT - load and trap */
case 0xe39c: /* LLGTAT - load logical thirty one bits and trap */
@@ -5472,20 +5658,21 @@ ex:
return -1;
break;
- /* 0xe38a-0xe38d undefined */
- /* 0xe392-0xe393 undefined */
- /* 0xe39a-0xe39b undefined */
- /* 0xe39e undefined */
+ /* 0xe38a-0xe38d undefined */
+ /* 0xe392-0xe393 undefined */
+ /* 0xe39a-0xe39b undefined */
+ /* 0xe39e undefined */
case 0xe39f: /* LAT - load and trap */
/* 32-bit gpr destination + fpc for possible DXC write */
- if (record_full_arch_list_add_reg (regcache, S390_R0_REGNUM + inib[2]))
+ if (record_full_arch_list_add_reg (regcache,
+ S390_R0_REGNUM + inib[2]))
return -1;
if (record_full_arch_list_add_reg (regcache, S390_FPC_REGNUM))
return -1;
break;
- /* 0xe3a0-0xe3bf undefined */
+ /* 0xe3a0-0xe3bf undefined */
case 0xe3c0: /* LBH - load byte high */
case 0xe3c2: /* LLCH - load logical character high */
@@ -5498,8 +5685,8 @@ ex:
return -1;
break;
- /* 0xe3c1 undefined */
- /* 0xe3c5 undefined */
+ /* 0xe3c1 undefined */
+ /* 0xe3c5 undefined */
case 0xe3c8: /* LFHAT - load high and trap */
/* 32-bit high gpr destination + fpc for possible DXC write */
@@ -5509,10 +5696,10 @@ ex:
return -1;
break;
- /* 0xe3c9 undefined */
- /* 0xe3cc undefined */
- /* 0xe3ce undefined */
- /* 0xe3d0-0xe3ff undefined */
+ /* 0xe3c9 undefined */
+ /* 0xe3cc undefined */
+ /* 0xe3ce undefined */
+ /* 0xe3d0-0xe3ff undefined */
case 0xe601: /* VLEBRH - vector load byte reversed element */
case 0xe602: /* VLEBRG - vector load byte reversed element */
@@ -5661,7 +5848,8 @@ ex:
break;
case 0xe708: /* VSTEB - vector store element */
- oaddr = s390_record_calc_disp (gdbarch, regcache, inib[3], insn[1], 0);
+ oaddr
+ = s390_record_calc_disp (gdbarch, regcache, inib[3], insn[1], 0);
if (record_full_arch_list_add_mem (oaddr, 1))
return -1;
if (record_full_arch_list_add_reg (regcache, S390_FPC_REGNUM))
@@ -5670,7 +5858,8 @@ ex:
case 0xe609: /* VSTEBRH - vector store byte reversed element */
case 0xe709: /* VSTEH - vector store element */
- oaddr = s390_record_calc_disp (gdbarch, regcache, inib[3], insn[1], 0);
+ oaddr
+ = s390_record_calc_disp (gdbarch, regcache, inib[3], insn[1], 0);
if (record_full_arch_list_add_mem (oaddr, 2))
return -1;
if (record_full_arch_list_add_reg (regcache, S390_FPC_REGNUM))
@@ -5679,7 +5868,8 @@ ex:
case 0xe60a: /* VSTEBRG - vector store byte reversed element */
case 0xe70a: /* VSTEG - vector store element */
- oaddr = s390_record_calc_disp (gdbarch, regcache, inib[3], insn[1], 0);
+ oaddr
+ = s390_record_calc_disp (gdbarch, regcache, inib[3], insn[1], 0);
if (record_full_arch_list_add_mem (oaddr, 8))
return -1;
if (record_full_arch_list_add_reg (regcache, S390_FPC_REGNUM))
@@ -5688,30 +5878,33 @@ ex:
case 0xe60b: /* VSTEBRF - vector store byte reversed element */
case 0xe70b: /* VSTEF - vector store element */
- oaddr = s390_record_calc_disp (gdbarch, regcache, inib[3], insn[1], 0);
+ oaddr
+ = s390_record_calc_disp (gdbarch, regcache, inib[3], insn[1], 0);
if (record_full_arch_list_add_mem (oaddr, 4))
return -1;
if (record_full_arch_list_add_reg (regcache, S390_FPC_REGNUM))
return -1;
break;
- /* 0xe70c-0xe70d undefined */
+ /* 0xe70c-0xe70d undefined */
case 0xe60e: /* VSTBR - vector store byte reversed elements */
case 0xe60f: /* VSTER - vector store elements reversed */
case 0xe70e: /* VST - vector store */
- oaddr = s390_record_calc_disp (gdbarch, regcache, inib[3], insn[1], 0);
+ oaddr
+ = s390_record_calc_disp (gdbarch, regcache, inib[3], insn[1], 0);
if (record_full_arch_list_add_mem (oaddr, 16))
return -1;
if (record_full_arch_list_add_reg (regcache, S390_FPC_REGNUM))
return -1;
break;
- /* 0xe70f-0xe711 undefined */
- /* 0xe714-0xe719 undefined */
+ /* 0xe70f-0xe711 undefined */
+ /* 0xe714-0xe719 undefined */
case 0xe71a: /* VSCEG - vector scatter element */
- if (s390_record_calc_disp_vsce (gdbarch, regcache, ivec[1], inib[8], 8, insn[1], 0, &oaddr))
+ if (s390_record_calc_disp_vsce (gdbarch, regcache, ivec[1], inib[8],
+ 8, insn[1], 0, &oaddr))
return -1;
if (record_full_arch_list_add_mem (oaddr, 8))
return -1;
@@ -5720,7 +5913,8 @@ ex:
break;
case 0xe71b: /* VSCEF - vector scatter element */
- if (s390_record_calc_disp_vsce (gdbarch, regcache, ivec[1], inib[8], 4, insn[1], 0, &oaddr))
+ if (s390_record_calc_disp_vsce (gdbarch, regcache, ivec[1], inib[8],
+ 4, insn[1], 0, &oaddr))
return -1;
if (record_full_arch_list_add_mem (oaddr, 4))
return -1;
@@ -5728,11 +5922,11 @@ ex:
return -1;
break;
- /* 0xe71c-0xe720 undefined */
- /* 0xe723-0xe726 undefined */
- /* 0xe728-0xe72f undefined */
- /* 0xe731-0xe732 undefined */
- /* 0xe734-0xe735 undefined */
+ /* 0xe71c-0xe720 undefined */
+ /* 0xe723-0xe726 undefined */
+ /* 0xe728-0xe72f undefined */
+ /* 0xe731-0xe732 undefined */
+ /* 0xe734-0xe735 undefined */
case 0xe736: /* VLM - vector load multiple */
for (i = ivec[0]; i != ivec[1]; i++, i &= 0x1f)
@@ -5744,8 +5938,8 @@ ex:
return -1;
break;
- /* 0xe739 undefined */
- /* 0xe73b-0xe73d undefined */
+ /* 0xe739 undefined */
+ /* 0xe73b-0xe73d undefined */
case 0xe73e: /* VSTM - vector store multiple */
oaddr = s390_record_calc_disp (gdbarch, regcache, 0, insn[1], 0);
@@ -5770,7 +5964,8 @@ ex:
case 0xe63f: /* VSTRLR - vector store rightmost with length */
case 0xe73f: /* VSTL - vector store with length */
oaddr = s390_record_calc_disp (gdbarch, regcache, 0, insn[1], 0);
- regcache_raw_read_unsigned (regcache, S390_R0_REGNUM + inib[3], &tmp);
+ regcache_raw_read_unsigned (regcache, S390_R0_REGNUM + inib[3],
+ &tmp);
tmp &= 0xffffffffu;
if (tmp > 15)
tmp = 15;
@@ -5780,7 +5975,7 @@ ex:
return -1;
break;
- /* 0xe747-0xe749 undefined */
+ /* 0xe747-0xe749 undefined */
case 0xe658: /* VCVD - vector convert to decimal 32 bit */
case 0xe659: /* VSRP - vector shift and round decimal */
@@ -5824,31 +6019,31 @@ ex:
return -1;
break;
- /* 0xe74b-0xe74c undefined */
- /* 0xe74e-0xe74f undefined */
- /* 0xe751 undefined */
- /* 0xe754-0xe755 undefined */
- /* 0xe757-0xe75b undefined */
- /* 0xe75d-0xe75e undefined */
- /* 0xe763 undefined */
- /* 0xe771 undefined */
- /* 0xe776 undefined */
- /* 0xe779 undefined */
- /* 0xe77b undefined */
- /* 0xe783 undefined */
- /* 0xe786-0xe789 undefined */
- /* 0xe78b undefined */
- /* 0xe790-0xe793 undefined */
- /* 0xe796 undefined */
- /* 0xe798-0xe79d undefined */
- /* 0xe7a0 undefined */
- /* 0xe7a8 undefined */
- /* 0xe7b0-0xe7b3 undefined */
- /* 0xe7b5-0xe7b7 undefined */
- /* 0xe7ba undefined */
- /* 0xe7be undefined */
- /* 0xe7c6 undefined */
- /* 0xe7c8-0xe7c9 undefined */
+ /* 0xe74b-0xe74c undefined */
+ /* 0xe74e-0xe74f undefined */
+ /* 0xe751 undefined */
+ /* 0xe754-0xe755 undefined */
+ /* 0xe757-0xe75b undefined */
+ /* 0xe75d-0xe75e undefined */
+ /* 0xe763 undefined */
+ /* 0xe771 undefined */
+ /* 0xe776 undefined */
+ /* 0xe779 undefined */
+ /* 0xe77b undefined */
+ /* 0xe783 undefined */
+ /* 0xe786-0xe789 undefined */
+ /* 0xe78b undefined */
+ /* 0xe790-0xe793 undefined */
+ /* 0xe796 undefined */
+ /* 0xe798-0xe79d undefined */
+ /* 0xe7a0 undefined */
+ /* 0xe7a8 undefined */
+ /* 0xe7b0-0xe7b3 undefined */
+ /* 0xe7b5-0xe7b7 undefined */
+ /* 0xe7ba undefined */
+ /* 0xe7be undefined */
+ /* 0xe7c6 undefined */
+ /* 0xe7c8-0xe7c9 undefined */
case 0xe677: /* VCP - vector compare decimal */
case 0xe7ca: /* WFK - vector fp compare and signal scalar */
@@ -5867,20 +6062,20 @@ ex:
return -1;
break;
- /* 0xe7cd undefined */
- /* 0xe7cf-0xe7d3 undefined */
- /* 0xe7da undefined */
- /* 0xe7dc-0xe7dd undefined */
- /* 0xe7e0-0xe7e1 undefined */
- /* 0xe7e4 undefined */
- /* 0xe7e6 undefined */
- /* 0xe7e9 undefined */
- /* 0xe7ec-0xe7ed undefined */
- /* 0xe7f4 undefined */
- /* 0xe7f6 undefined */
- /* 0xe7fa undefined */
+ /* 0xe7cd undefined */
+ /* 0xe7cf-0xe7d3 undefined */
+ /* 0xe7da undefined */
+ /* 0xe7dc-0xe7dd undefined */
+ /* 0xe7e0-0xe7e1 undefined */
+ /* 0xe7e4 undefined */
+ /* 0xe7e6 undefined */
+ /* 0xe7e9 undefined */
+ /* 0xe7ec-0xe7ed undefined */
+ /* 0xe7f4 undefined */
+ /* 0xe7f6 undefined */
+ /* 0xe7fa undefined */
- /* 0xeb00-0xeb03 undefined */
+ /* 0xeb00-0xeb03 undefined */
case 0xeb04: /* LMG - load multiple */
for (i = inib[2]; i != inib[3]; i++, i &= 0xf)
@@ -5890,10 +6085,10 @@ ex:
return -1;
break;
- /* 0xeb05-0xeb09 undefined */
- /* 0xeb0e undefined */
- /* 0xeb0f privileged: TRACG */
- /* 0xeb10-0xeb13 undefined */
+ /* 0xeb05-0xeb09 undefined */
+ /* 0xeb0e undefined */
+ /* 0xeb0f privileged: TRACG */
+ /* 0xeb10-0xeb13 undefined */
case 0xeb14: /* CSY - compare and swap */
case 0xebf4: /* LAN - load and and */
@@ -5901,18 +6096,20 @@ ex:
case 0xebf7: /* LAX - load and xor */
case 0xebf8: /* LAA - load and add */
case 0xebfa: /* LAAL - load and add logical */
- oaddr = s390_record_calc_disp (gdbarch, regcache, 0, insn[1], ibyte[4]);
+ oaddr
+ = s390_record_calc_disp (gdbarch, regcache, 0, insn[1], ibyte[4]);
if (record_full_arch_list_add_mem (oaddr, 4))
return -1;
- if (record_full_arch_list_add_reg (regcache, S390_R0_REGNUM + inib[2]))
+ if (record_full_arch_list_add_reg (regcache,
+ S390_R0_REGNUM + inib[2]))
return -1;
if (record_full_arch_list_add_reg (regcache, S390_PSWM_REGNUM))
return -1;
break;
- /* 0xeb15-0xeb1b undefined */
- /* 0xeb1e-0xeb1f undefined */
- /* 0xeb22 undefined */
+ /* 0xeb15-0xeb1b undefined */
+ /* 0xeb1e-0xeb1f undefined */
+ /* 0xeb22 undefined */
case 0xeb23: /* CLT - compare logical and trap */
case 0xeb2b: /* CLGT - compare logical and trap */
@@ -5922,7 +6119,8 @@ ex:
break;
case 0xeb24: /* STMG - store multiple */
- oaddr = s390_record_calc_disp (gdbarch, regcache, 0, insn[1], ibyte[4]);
+ oaddr
+ = s390_record_calc_disp (gdbarch, regcache, 0, insn[1], ibyte[4]);
if (inib[2] <= inib[3])
n = inib[3] - inib[2] + 1;
else
@@ -5931,12 +6129,13 @@ ex:
return -1;
break;
- /* 0xeb25 privileged */
+ /* 0xeb25 privileged */
case 0xeb26: /* STMH - store multiple high */
case 0xeb90: /* STMY - store multiple */
case 0xeb9b: /* STAMY - store access multiple */
- oaddr = s390_record_calc_disp (gdbarch, regcache, 0, insn[1], ibyte[4]);
+ oaddr
+ = s390_record_calc_disp (gdbarch, regcache, 0, insn[1], ibyte[4]);
if (inib[2] <= inib[3])
n = inib[3] - inib[2] + 1;
else
@@ -5945,17 +6144,18 @@ ex:
return -1;
break;
- /* 0xeb27-0xeb2a undefined */
+ /* 0xeb27-0xeb2a undefined */
case 0xeb2c: /* STCMH - store characters under mask */
case 0xeb2d: /* STCMY - store characters under mask */
- oaddr = s390_record_calc_disp (gdbarch, regcache, 0, insn[1], ibyte[4]);
+ oaddr
+ = s390_record_calc_disp (gdbarch, regcache, 0, insn[1], ibyte[4]);
if (record_full_arch_list_add_mem (oaddr, s390_popcnt (inib[3])))
return -1;
break;
- /* 0xeb2e undefined */
- /* 0xeb2f privileged */
+ /* 0xeb2e undefined */
+ /* 0xeb2f privileged */
case 0xeb30: /* CSG - compare and swap */
case 0xebe4: /* LANG - load and and */
@@ -5963,7 +6163,8 @@ ex:
case 0xebe7: /* LAXG - load and xor */
case 0xebe8: /* LAAG - load and add */
case 0xebea: /* LAALG - load and add logical */
- oaddr = s390_record_calc_disp (gdbarch, regcache, 0, insn[1], ibyte[4]);
+ oaddr
+ = s390_record_calc_disp (gdbarch, regcache, 0, insn[1], ibyte[4]);
if (record_full_arch_list_add_mem (oaddr, 8))
return -1;
if (s390_record_gpr_g (gdbarch, regcache, inib[2]))
@@ -5973,21 +6174,25 @@ ex:
break;
case 0xeb31: /* CDSY - compare double and swap */
- oaddr = s390_record_calc_disp (gdbarch, regcache, 0, insn[1], ibyte[4]);
+ oaddr
+ = s390_record_calc_disp (gdbarch, regcache, 0, insn[1], ibyte[4]);
if (record_full_arch_list_add_mem (oaddr, 8))
return -1;
- if (record_full_arch_list_add_reg (regcache, S390_R0_REGNUM + inib[2]))
+ if (record_full_arch_list_add_reg (regcache,
+ S390_R0_REGNUM + inib[2]))
return -1;
- if (record_full_arch_list_add_reg (regcache, S390_R0_REGNUM + (inib[2] | 1)))
+ if (record_full_arch_list_add_reg (regcache,
+ S390_R0_REGNUM + (inib[2] | 1)))
return -1;
if (record_full_arch_list_add_reg (regcache, S390_PSWM_REGNUM))
return -1;
break;
- /* 0xeb32-0xeb3d undefined */
+ /* 0xeb32-0xeb3d undefined */
case 0xeb3e: /* CDSG - compare double and swap */
- oaddr = s390_record_calc_disp (gdbarch, regcache, 0, insn[1], ibyte[4]);
+ oaddr
+ = s390_record_calc_disp (gdbarch, regcache, 0, insn[1], ibyte[4]);
if (record_full_arch_list_add_mem (oaddr, 16))
return -1;
if (s390_record_gpr_g (gdbarch, regcache, inib[2]))
@@ -5998,12 +6203,13 @@ ex:
return -1;
break;
- /* 0xeb3f-0xeb43 undefined */
- /* 0xeb46-0xeb4b undefined */
- /* 0xeb4d-0xeb50 undefined */
+ /* 0xeb3f-0xeb43 undefined */
+ /* 0xeb46-0xeb4b undefined */
+ /* 0xeb4d-0xeb50 undefined */
case 0xeb52: /* MVIY - move */
- oaddr = s390_record_calc_disp (gdbarch, regcache, 0, insn[1], ibyte[4]);
+ oaddr
+ = s390_record_calc_disp (gdbarch, regcache, 0, insn[1], ibyte[4]);
if (record_full_arch_list_add_mem (oaddr, 1))
return -1;
break;
@@ -6011,39 +6217,42 @@ ex:
case 0xeb54: /* NIY - and */
case 0xeb56: /* OIY - or */
case 0xeb57: /* XIY - xor */
- oaddr = s390_record_calc_disp (gdbarch, regcache, 0, insn[1], ibyte[4]);
+ oaddr
+ = s390_record_calc_disp (gdbarch, regcache, 0, insn[1], ibyte[4]);
if (record_full_arch_list_add_mem (oaddr, 1))
return -1;
if (record_full_arch_list_add_reg (regcache, S390_PSWM_REGNUM))
return -1;
break;
- /* 0xeb53 undefined */
- /* 0xeb58-0xeb69 undefined */
+ /* 0xeb53 undefined */
+ /* 0xeb58-0xeb69 undefined */
case 0xeb6a: /* ASI - add immediate */
case 0xeb6e: /* ALSI - add immediate */
- oaddr = s390_record_calc_disp (gdbarch, regcache, 0, insn[1], ibyte[4]);
+ oaddr
+ = s390_record_calc_disp (gdbarch, regcache, 0, insn[1], ibyte[4]);
if (record_full_arch_list_add_mem (oaddr, 4))
return -1;
if (record_full_arch_list_add_reg (regcache, S390_PSWM_REGNUM))
return -1;
break;
- /* 0xeb6b-0xeb6d undefined */
- /* 0xeb6f-0xeb79 undefined */
+ /* 0xeb6b-0xeb6d undefined */
+ /* 0xeb6f-0xeb79 undefined */
case 0xeb7a: /* AGSI - add immediate */
case 0xeb7e: /* ALGSI - add immediate */
- oaddr = s390_record_calc_disp (gdbarch, regcache, 0, insn[1], ibyte[4]);
+ oaddr
+ = s390_record_calc_disp (gdbarch, regcache, 0, insn[1], ibyte[4]);
if (record_full_arch_list_add_mem (oaddr, 8))
return -1;
if (record_full_arch_list_add_reg (regcache, S390_PSWM_REGNUM))
return -1;
break;
- /* 0xeb7b-0xeb7d undefined */
- /* 0xeb7f undefined */
+ /* 0xeb7b-0xeb7d undefined */
+ /* 0xeb7f undefined */
case 0xeb80: /* ICMH - insert characters under mask */
/* 32-bit high gpr destination + flags */
@@ -6053,40 +6262,50 @@ ex:
return -1;
break;
- /* 0xeb82-0xeb8d undefined */
+ /* 0xeb82-0xeb8d undefined */
case 0xeb8e: /* MVCLU - move long unicode [partial] */
- regcache_raw_read_unsigned (regcache, S390_R0_REGNUM + inib[2], &tmp);
+ regcache_raw_read_unsigned (regcache, S390_R0_REGNUM + inib[2],
+ &tmp);
oaddr = s390_record_address_mask (gdbarch, regcache, tmp);
- regcache_raw_read_unsigned (regcache, S390_R0_REGNUM + (inib[2] | 1), &tmp);
+ regcache_raw_read_unsigned (regcache, S390_R0_REGNUM + (inib[2] | 1),
+ &tmp);
if (record_full_arch_list_add_mem (oaddr, tmp))
return -1;
- if (record_full_arch_list_add_reg (regcache, S390_R0_REGNUM + inib[2]))
+ if (record_full_arch_list_add_reg (regcache,
+ S390_R0_REGNUM + inib[2]))
return -1;
- if (record_full_arch_list_add_reg (regcache, S390_R0_REGNUM + (inib[2] | 1)))
+ if (record_full_arch_list_add_reg (regcache,
+ S390_R0_REGNUM + (inib[2] | 1)))
return -1;
- if (record_full_arch_list_add_reg (regcache, S390_R0_REGNUM + inib[3]))
+ if (record_full_arch_list_add_reg (regcache,
+ S390_R0_REGNUM + inib[3]))
return -1;
- if (record_full_arch_list_add_reg (regcache, S390_R0_REGNUM + (inib[3] | 1)))
+ if (record_full_arch_list_add_reg (regcache,
+ S390_R0_REGNUM + (inib[3] | 1)))
return -1;
if (record_full_arch_list_add_reg (regcache, S390_PSWM_REGNUM))
return -1;
break;
case 0xeb8f: /* CLCLU - compare logical long unicode [partial] */
- if (record_full_arch_list_add_reg (regcache, S390_R0_REGNUM + inib[2]))
+ if (record_full_arch_list_add_reg (regcache,
+ S390_R0_REGNUM + inib[2]))
return -1;
- if (record_full_arch_list_add_reg (regcache, S390_R0_REGNUM + (inib[2] | 1)))
+ if (record_full_arch_list_add_reg (regcache,
+ S390_R0_REGNUM + (inib[2] | 1)))
return -1;
- if (record_full_arch_list_add_reg (regcache, S390_R0_REGNUM + inib[3]))
+ if (record_full_arch_list_add_reg (regcache,
+ S390_R0_REGNUM + inib[3]))
return -1;
- if (record_full_arch_list_add_reg (regcache, S390_R0_REGNUM + (inib[3] | 1)))
+ if (record_full_arch_list_add_reg (regcache,
+ S390_R0_REGNUM + (inib[3] | 1)))
return -1;
if (record_full_arch_list_add_reg (regcache, S390_PSWM_REGNUM))
return -1;
break;
- /* 0xeb91-0xeb95 undefined */
+ /* 0xeb91-0xeb95 undefined */
case 0xeb96: /* LMH - load multiple high */
for (i = inib[2]; i != inib[3]; i++, i &= 0xf)
@@ -6096,50 +6315,54 @@ ex:
return -1;
break;
- /* 0xeb97 undefined */
+ /* 0xeb97 undefined */
case 0xeb98: /* LMY - load multiple */
for (i = inib[2]; i != inib[3]; i++, i &= 0xf)
if (record_full_arch_list_add_reg (regcache, S390_R0_REGNUM + i))
return -1;
- if (record_full_arch_list_add_reg (regcache, S390_R0_REGNUM + inib[3]))
+ if (record_full_arch_list_add_reg (regcache,
+ S390_R0_REGNUM + inib[3]))
return -1;
break;
- /* 0xeb99 undefined */
+ /* 0xeb99 undefined */
case 0xeb9a: /* LAMY - load access multiple */
for (i = inib[2]; i != inib[3]; i++, i &= 0xf)
if (record_full_arch_list_add_reg (regcache, S390_A0_REGNUM + i))
return -1;
- if (record_full_arch_list_add_reg (regcache, S390_A0_REGNUM + inib[3]))
+ if (record_full_arch_list_add_reg (regcache,
+ S390_A0_REGNUM + inib[3]))
return -1;
break;
- /* 0xeb9c-0xebbf undefined */
- /* 0xebc1-0xebdb undefined */
+ /* 0xeb9c-0xebbf undefined */
+ /* 0xebc1-0xebdb undefined */
case 0xebe1: /* STOCFH - store high on condition */
case 0xebf3: /* STOC - store on condition */
- oaddr = s390_record_calc_disp (gdbarch, regcache, 0, insn[1], ibyte[4]);
+ oaddr
+ = s390_record_calc_disp (gdbarch, regcache, 0, insn[1], ibyte[4]);
if (record_full_arch_list_add_mem (oaddr, 4))
return -1;
break;
case 0xebe3: /* STOCG - store on condition */
- oaddr = s390_record_calc_disp (gdbarch, regcache, 0, insn[1], ibyte[4]);
+ oaddr
+ = s390_record_calc_disp (gdbarch, regcache, 0, insn[1], ibyte[4]);
if (record_full_arch_list_add_mem (oaddr, 8))
return -1;
break;
- /* 0xebe5 undefined */
- /* 0xebe9 undefined */
- /* 0xebeb-0xebf1 undefined */
- /* 0xebf5 undefined */
- /* 0xebf9 undefined */
- /* 0xebfb-0xebff undefined */
+ /* 0xebe5 undefined */
+ /* 0xebe9 undefined */
+ /* 0xebeb-0xebf1 undefined */
+ /* 0xebf5 undefined */
+ /* 0xebf9 undefined */
+ /* 0xebfb-0xebff undefined */
- /* 0xed00-0xed03 undefined */
+ /* 0xed00-0xed03 undefined */
case 0xed04: /* LDEB - load lengthened */
case 0xed0c: /* MDEB - multiply */
@@ -6150,7 +6373,8 @@ ex:
case 0xed1c: /* MDB - multiply */
case 0xed1d: /* DDB - divide */
/* float destination + fpc */
- if (record_full_arch_list_add_reg (regcache, S390_F0_REGNUM + inib[2]))
+ if (record_full_arch_list_add_reg (regcache,
+ S390_F0_REGNUM + inib[2]))
return -1;
if (record_full_arch_list_add_reg (regcache, S390_FPC_REGNUM))
return -1;
@@ -6160,9 +6384,11 @@ ex:
case 0xed06: /* LXEB - load lengthened */
case 0xed07: /* MXDB - multiply */
/* float pair destination + fpc */
- if (record_full_arch_list_add_reg (regcache, S390_F0_REGNUM + inib[2]))
+ if (record_full_arch_list_add_reg (regcache,
+ S390_F0_REGNUM + inib[2]))
return -1;
- if (record_full_arch_list_add_reg (regcache, S390_F0_REGNUM + (inib[2] | 2)))
+ if (record_full_arch_list_add_reg (regcache,
+ S390_F0_REGNUM + (inib[2] | 2)))
return -1;
if (record_full_arch_list_add_reg (regcache, S390_FPC_REGNUM))
return -1;
@@ -6173,7 +6399,8 @@ ex:
case 0xed1a: /* ADB - add */
case 0xed1b: /* SDB - subtract */
/* float destination + flags + fpc */
- if (record_full_arch_list_add_reg (regcache, S390_F0_REGNUM + inib[2]))
+ if (record_full_arch_list_add_reg (regcache,
+ S390_F0_REGNUM + inib[2]))
return -1;
if (record_full_arch_list_add_reg (regcache, S390_PSWM_REGNUM))
return -1;
@@ -6190,15 +6417,16 @@ ex:
case 0xedaa: /* CDZT - convert from zoned */
case 0xedae: /* CDPT - convert from packed */
/* float destination [RXF] + fpc */
- if (record_full_arch_list_add_reg (regcache, S390_F0_REGNUM + inib[8]))
+ if (record_full_arch_list_add_reg (regcache,
+ S390_F0_REGNUM + inib[8]))
return -1;
if (record_full_arch_list_add_reg (regcache, S390_FPC_REGNUM))
return -1;
break;
- /* 0xed13 undefined */
- /* 0xed16 undefined */
- /* 0xed20-0xed23 undefined */
+ /* 0xed13 undefined */
+ /* 0xed16 undefined */
+ /* 0xed20-0xed23 undefined */
case 0xed24: /* LDE - load lengthened */
case 0xed34: /* SQE - square root */
@@ -6207,20 +6435,23 @@ ex:
case 0xed64: /* LEY - load */
case 0xed65: /* LDY - load */
/* float destination */
- if (record_full_arch_list_add_reg (regcache, S390_F0_REGNUM + inib[2]))
+ if (record_full_arch_list_add_reg (regcache,
+ S390_F0_REGNUM + inib[2]))
return -1;
break;
case 0xed25: /* LXD - load lengthened */
case 0xed26: /* LXE - load lengthened */
/* float pair destination */
- if (record_full_arch_list_add_reg (regcache, S390_F0_REGNUM + inib[2]))
+ if (record_full_arch_list_add_reg (regcache,
+ S390_F0_REGNUM + inib[2]))
return -1;
- if (record_full_arch_list_add_reg (regcache, S390_F0_REGNUM + (inib[2] | 2)))
+ if (record_full_arch_list_add_reg (regcache,
+ S390_F0_REGNUM + (inib[2] | 2)))
return -1;
break;
- /* 0xed27-0xed2d undefined */
+ /* 0xed27-0xed2d undefined */
case 0xed2e: /* MAE - multiply and add */
case 0xed2f: /* MSE - multiply and subtract */
@@ -6231,42 +6462,47 @@ ex:
case 0xed3e: /* MAD - multiply and add */
case 0xed3f: /* MSD - multiply and subtract */
/* float destination [RXF] */
- if (record_full_arch_list_add_reg (regcache, S390_F0_REGNUM + inib[8]))
+ if (record_full_arch_list_add_reg (regcache,
+ S390_F0_REGNUM + inib[8]))
return -1;
break;
- /* 0xed30-0xed33 undefined */
- /* 0xed36 undefined */
+ /* 0xed30-0xed33 undefined */
+ /* 0xed36 undefined */
case 0xed3a: /* MAY - multiply and add unnormalized */
case 0xed3b: /* MY - multiply unnormalized */
/* float pair destination [RXF] */
- if (record_full_arch_list_add_reg (regcache, S390_F0_REGNUM + inib[8]))
+ if (record_full_arch_list_add_reg (regcache,
+ S390_F0_REGNUM + inib[8]))
return -1;
- if (record_full_arch_list_add_reg (regcache, S390_F0_REGNUM + (inib[8] | 2)))
+ if (record_full_arch_list_add_reg (regcache,
+ S390_F0_REGNUM + (inib[8] | 2)))
return -1;
break;
- /* 0xed42-0xed47 undefined */
+ /* 0xed42-0xed47 undefined */
case 0xed48: /* SLXT - shift significand left */
case 0xed49: /* SRXT - shift significand right */
case 0xedab: /* CXZT - convert from zoned */
case 0xedaf: /* CXPT - convert from packed */
/* float pair destination [RXF] + fpc */
- if (record_full_arch_list_add_reg (regcache, S390_F0_REGNUM + inib[8]))
+ if (record_full_arch_list_add_reg (regcache,
+ S390_F0_REGNUM + inib[8]))
return -1;
- if (record_full_arch_list_add_reg (regcache, S390_F0_REGNUM + (inib[8] | 2)))
+ if (record_full_arch_list_add_reg (regcache,
+ S390_F0_REGNUM + (inib[8] | 2)))
return -1;
if (record_full_arch_list_add_reg (regcache, S390_FPC_REGNUM))
return -1;
break;
- /* 0xed4a-0xed4f undefined */
- /* 0xed52-0xed53 undefined */
- /* 0xed56-0xed57 undefined */
- /* 0xed5a-0xed63 undefined */
- /* 0xed68-0xeda7 undefined */
+ /* 0xed4a-0xed4f undefined */
+ /* 0xed52-0xed53 undefined */
+ /* 0xed56-0xed57 undefined */
+ /* 0xed5a-0xed63 undefined */
+ /* 0xed68-0xeda7 undefined */
case 0xeda8: /* CZDT - convert to zoned */
case 0xeda9: /* CZXT - convert to zoned */
@@ -6279,20 +6515,20 @@ ex:
return -1;
break;
- /* 0xedb0-0xedff undefined */
+ /* 0xedb0-0xedff undefined */
default:
goto UNKNOWN_OP;
}
break;
- /* 0xe4 undefined */
+ /* 0xe4 undefined */
case 0xe5:
/* SSE/SIL-format instruction */
switch (insn[0])
{
- /* 0xe500-0xe509 undefined, privileged, or unsupported */
+ /* 0xe500-0xe509 undefined, privileged, or unsupported */
case 0xe50a: /* MVCRL - move right to left */
regcache_raw_read_unsigned (regcache, S390_R0_REGNUM, &tmp);
@@ -6301,7 +6537,7 @@ ex:
return -1;
break;
- /* 0xe50b-0xe543 undefined, privileged, or unsupported */
+ /* 0xe50b-0xe543 undefined, privileged, or unsupported */
case 0xe544: /* MVHHI - move */
oaddr = s390_record_calc_disp (gdbarch, regcache, 0, insn[1], 0);
@@ -6309,7 +6545,7 @@ ex:
return -1;
break;
- /* 0xe545-0xe547 undefined */
+ /* 0xe545-0xe547 undefined */
case 0xe548: /* MVGHI - move */
oaddr = s390_record_calc_disp (gdbarch, regcache, 0, insn[1], 0);
@@ -6317,7 +6553,7 @@ ex:
return -1;
break;
- /* 0xe549-0xe54b undefined */
+ /* 0xe549-0xe54b undefined */
case 0xe54c: /* MVHI - move */
oaddr = s390_record_calc_disp (gdbarch, regcache, 0, insn[1], 0);
@@ -6325,7 +6561,7 @@ ex:
return -1;
break;
- /* 0xe54d-0xe553 undefined */
+ /* 0xe54d-0xe553 undefined */
case 0xe554: /* CHHSI - compare halfword immediate */
case 0xe555: /* CLHHSI - compare logical immediate */
@@ -6337,9 +6573,9 @@ ex:
return -1;
break;
- /* 0xe556-0xe557 undefined */
- /* 0xe55a-0xe55b undefined */
- /* 0xe55e-0xe55f undefined */
+ /* 0xe556-0xe557 undefined */
+ /* 0xe55a-0xe55b undefined */
+ /* 0xe55e-0xe55f undefined */
case 0xe560: /* TBEGIN - transaction begin */
/* The transaction will be immediately aborted after this
@@ -6356,22 +6592,25 @@ ex:
/* Transaction diagnostic block - supervisor. */
if (record_full_arch_list_add_reg (regcache, S390_TDB_DWORD0_REGNUM))
return -1;
- if (record_full_arch_list_add_reg (regcache, S390_TDB_ABORT_CODE_REGNUM))
+ if (record_full_arch_list_add_reg (regcache,
+ S390_TDB_ABORT_CODE_REGNUM))
return -1;
- if (record_full_arch_list_add_reg (regcache, S390_TDB_CONFLICT_TOKEN_REGNUM))
+ if (record_full_arch_list_add_reg (regcache,
+ S390_TDB_CONFLICT_TOKEN_REGNUM))
return -1;
if (record_full_arch_list_add_reg (regcache, S390_TDB_ATIA_REGNUM))
return -1;
for (i = 0; i < 16; i++)
- if (record_full_arch_list_add_reg (regcache, S390_TDB_R0_REGNUM + i))
+ if (record_full_arch_list_add_reg (regcache,
+ S390_TDB_R0_REGNUM + i))
return -1;
/* And flags. */
if (record_full_arch_list_add_reg (regcache, S390_PSWM_REGNUM))
return -1;
break;
- /* 0xe561 unsupported: TBEGINC */
- /* 0xe562-0xe5ff undefined */
+ /* 0xe561 unsupported: TBEGINC */
+ /* 0xe562-0xe5ff undefined */
default:
goto UNKNOWN_OP;
@@ -6382,16 +6621,17 @@ ex:
/* RIE/RIS/RRS-format instruction */
switch (ibyte[0] << 8 | ibyte[5])
{
- /* 0xec00-0xec41 undefined */
+ /* 0xec00-0xec41 undefined */
case 0xec42: /* LOCHI - load halfword immediate on condition */
case 0xec51: /* RISBLG - rotate then insert selected bits low */
/* 32-bit or native gpr destination */
- if (record_full_arch_list_add_reg (regcache, S390_R0_REGNUM + inib[2]))
+ if (record_full_arch_list_add_reg (regcache,
+ S390_R0_REGNUM + inib[2]))
return -1;
break;
- /* 0xec43 undefined */
+ /* 0xec43 undefined */
case 0xec44: /* BRXHG - branch relative on index high */
case 0xec45: /* BRXLG - branch relative on index low or equal */
@@ -6402,7 +6642,7 @@ ex:
return -1;
break;
- /* 0xec47-0xec4d undefined */
+ /* 0xec47-0xec4d undefined */
case 0xec4e: /* LOCHHI - load halfword immediate on condition */
case 0xec5d: /* RISBHG - rotate then insert selected bits high */
@@ -6411,8 +6651,8 @@ ex:
return -1;
break;
- /* 0xec4f-0xec50 undefined */
- /* 0xec52-0xec53 undefined */
+ /* 0xec4f-0xec50 undefined */
+ /* 0xec52-0xec53 undefined */
case 0xec54: /* RNSBG - rotate then and selected bits */
case 0xec55: /* RISBG - rotate then insert selected bits */
@@ -6427,9 +6667,9 @@ ex:
return -1;
break;
- /* 0xec58 undefined */
- /* 0xec5a-0xec5c undefined */
- /* 0xec5e-0xec63 undefined */
+ /* 0xec58 undefined */
+ /* 0xec5a-0xec5c undefined */
+ /* 0xec5e-0xec63 undefined */
case 0xec64: /* CGRJ - compare and branch relative */
case 0xec65: /* CLGRJ - compare logical and branch relative */
@@ -6449,7 +6689,7 @@ ex:
case 0xecff: /* CLIB - compare logical immediate and branch */
break;
- /* 0xec66-0xec6f undefined */
+ /* 0xec66-0xec6f undefined */
case 0xec70: /* CGIT - compare immediate and trap */
case 0xec71: /* CLGIT - compare logical immediate and trap */
@@ -6460,23 +6700,24 @@ ex:
return -1;
break;
- /* 0xec74-0xec75 undefined */
- /* 0xec78-0xec7b undefined */
+ /* 0xec74-0xec75 undefined */
+ /* 0xec78-0xec7b undefined */
- /* 0xec80-0xecd7 undefined */
+ /* 0xec80-0xecd7 undefined */
case 0xecd8: /* AHIK - add immediate */
case 0xecda: /* ALHSIK - add logical immediate */
/* 32-bit gpr destination + flags */
- if (record_full_arch_list_add_reg (regcache, S390_R0_REGNUM + inib[2]))
+ if (record_full_arch_list_add_reg (regcache,
+ S390_R0_REGNUM + inib[2]))
return -1;
if (record_full_arch_list_add_reg (regcache, S390_PSWM_REGNUM))
return -1;
break;
- /* 0xecdc-0xece3 undefined */
- /* 0xece6-0xecf5 undefined */
- /* 0xecf8-0xecfb undefined */
+ /* 0xecdc-0xece3 undefined */
+ /* 0xece6-0xecf5 undefined */
+ /* 0xecf8-0xecfb undefined */
default:
goto UNKNOWN_OP;
@@ -6495,10 +6736,12 @@ ex:
{
case 0x00: /* CL */
/* op1c */
- if (record_full_arch_list_add_reg (regcache, S390_R0_REGNUM + inib[2]))
+ if (record_full_arch_list_add_reg (regcache,
+ S390_R0_REGNUM + inib[2]))
return -1;
/* op3 */
- if (record_full_arch_list_add_reg (regcache, S390_R0_REGNUM + inib[3]))
+ if (record_full_arch_list_add_reg (regcache,
+ S390_R0_REGNUM + inib[3]))
return -1;
break;
@@ -6531,7 +6774,8 @@ ex:
case 0x08: /* DCS */
/* op3c */
- if (record_full_arch_list_add_reg (regcache, S390_R0_REGNUM + inib[3]))
+ if (record_full_arch_list_add_reg (regcache,
+ S390_R0_REGNUM + inib[3]))
return -1;
/* fallthru */
case 0x0c: /* CSST */
@@ -6566,9 +6810,10 @@ ex:
return -1;
/* fallthru */
case 0x04: /* CS */
-CS:
+ CS:
/* op1c */
- if (record_full_arch_list_add_reg (regcache, S390_R0_REGNUM + inib[2]))
+ if (record_full_arch_list_add_reg (regcache,
+ S390_R0_REGNUM + inib[2]))
return -1;
/* op2 */
if (record_full_arch_list_add_mem (oaddr, 4))
@@ -6600,7 +6845,7 @@ CS:
return -1;
/* fallthru */
case 0x0d: /* CSSTG */
-CSSTG:
+ CSSTG:
/* op4 */
if (target_read_memory (oaddr2 + 0x48, buf, 8))
return -1;
@@ -6655,7 +6900,7 @@ CSSTG:
return -1;
/* fallthru */
case 0x06: /* CSGR */
-CSGR:
+ CSGR:
/* op1c */
if (s390_record_gpr_g (gdbarch, regcache, inib[2]))
return -1;
@@ -6689,7 +6934,7 @@ CSGR:
return -1;
/* fallthru */
case 0x0f: /* CSSTX */
-CSSTX:
+ CSSTX:
/* op4 */
if (target_read_memory (oaddr2 + 0x48, buf, 8))
return -1;
@@ -6747,7 +6992,7 @@ CSSTX:
return -1;
break;
- /* 0xf4-0xf7 undefined */
+ /* 0xf4-0xf7 undefined */
case 0xf9: /* CP - compare decimal */
if (record_full_arch_list_add_reg (regcache, S390_PSWM_REGNUM))
@@ -6767,14 +7012,16 @@ CSSTX:
return -1;
break;
- /* 0xfe-0xff undefined */
+ /* 0xfe-0xff undefined */
default:
-UNKNOWN_OP:
- gdb_printf (gdb_stdlog, "Warning: Don't know how to record %04x "
- "at %s.\n", insn[0], paddress (gdbarch, addr));
+ UNKNOWN_OP:
+ gdb_printf (gdb_stdlog,
+ "Warning: Don't know how to record %04x "
+ "at %s.\n",
+ insn[0], paddress (gdbarch, addr));
return -1;
- }
+ }
if (record_full_arch_list_add_reg (regcache, S390_PSWA_REGNUM))
return -1;
@@ -6813,71 +7060,67 @@ s390_stap_is_single_operand (struct gdbarch *gdbarch, const char *s)
{
return ((isdigit (*s) && s[1] == '(' && s[2] == '%') /* Displacement
or indirection. */
- || *s == '%' /* Register access. */
- || isdigit (*s)); /* Literal number. */
+ || *s == '%' /* Register access. */
+ || isdigit (*s)); /* Literal number. */
}
/* gdbarch init. */
/* Validate the range of registers. NAMES must be known at compile time. */
-#define s390_validate_reg_range(feature, tdesc_data, start, names) \
-do \
-{ \
- for (int i = 0; i < ARRAY_SIZE (names); i++) \
- if (!tdesc_numbered_register (feature, tdesc_data, start + i, names[i])) \
- return false; \
-} \
-while (0)
+#define s390_validate_reg_range(feature, tdesc_data, start, names) \
+ do \
+ { \
+ for (int i = 0; i < ARRAY_SIZE (names); i++) \
+ if (!tdesc_numbered_register (feature, tdesc_data, start + i, \
+ names[i])) \
+ return false; \
+ } \
+ while (0)
/* Validate the target description. Also numbers registers contained in
tdesc. */
static bool
-s390_tdesc_valid (s390_gdbarch_tdep *tdep,
- struct tdesc_arch_data *tdesc_data)
+s390_tdesc_valid (s390_gdbarch_tdep *tdep, struct tdesc_arch_data *tdesc_data)
{
- static const char *const psw[] = {
- "pswm", "pswa"
- };
- static const char *const gprs[] = {
- "r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7",
- "r8", "r9", "r10", "r11", "r12", "r13", "r14", "r15"
- };
- static const char *const fprs[] = {
- "f0", "f1", "f2", "f3", "f4", "f5", "f6", "f7",
- "f8", "f9", "f10", "f11", "f12", "f13", "f14", "f15"
- };
- static const char *const acrs[] = {
- "acr0", "acr1", "acr2", "acr3", "acr4", "acr5", "acr6", "acr7",
- "acr8", "acr9", "acr10", "acr11", "acr12", "acr13", "acr14", "acr15"
- };
- static const char *const gprs_lower[] = {
- "r0l", "r1l", "r2l", "r3l", "r4l", "r5l", "r6l", "r7l",
- "r8l", "r9l", "r10l", "r11l", "r12l", "r13l", "r14l", "r15l"
- };
- static const char *const gprs_upper[] = {
- "r0h", "r1h", "r2h", "r3h", "r4h", "r5h", "r6h", "r7h",
- "r8h", "r9h", "r10h", "r11h", "r12h", "r13h", "r14h", "r15h"
- };
- static const char *const tdb_regs[] = {
- "tdb0", "tac", "tct", "atia",
- "tr0", "tr1", "tr2", "tr3", "tr4", "tr5", "tr6", "tr7",
- "tr8", "tr9", "tr10", "tr11", "tr12", "tr13", "tr14", "tr15"
- };
+ static const char *const psw[] = { "pswm", "pswa" };
+ static const char *const gprs[]
+ = { "r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7",
+ "r8", "r9", "r10", "r11", "r12", "r13", "r14", "r15" };
+ static const char *const fprs[]
+ = { "f0", "f1", "f2", "f3", "f4", "f5", "f6", "f7",
+ "f8", "f9", "f10", "f11", "f12", "f13", "f14", "f15" };
+ static const char *const acrs[]
+ = { "acr0", "acr1", "acr2", "acr3", "acr4", "acr5", "acr6", "acr7",
+ "acr8", "acr9", "acr10", "acr11", "acr12", "acr13", "acr14", "acr15" };
+ static const char *const gprs_lower[]
+ = { "r0l", "r1l", "r2l", "r3l", "r4l", "r5l", "r6l", "r7l",
+ "r8l", "r9l", "r10l", "r11l", "r12l", "r13l", "r14l", "r15l" };
+ static const char *const gprs_upper[]
+ = { "r0h", "r1h", "r2h", "r3h", "r4h", "r5h", "r6h", "r7h",
+ "r8h", "r9h", "r10h", "r11h", "r12h", "r13h", "r14h", "r15h" };
+ static const char *const tdb_regs[]
+ = { "tdb0", "tac", "tct", "atia", "tr0", "tr1", "tr2",
+ "tr3", "tr4", "tr5", "tr6", "tr7", "tr8", "tr9",
+ "tr10", "tr11", "tr12", "tr13", "tr14", "tr15" };
static const char *const vxrs_low[] = {
- "v0l", "v1l", "v2l", "v3l", "v4l", "v5l", "v6l", "v7l", "v8l",
- "v9l", "v10l", "v11l", "v12l", "v13l", "v14l", "v15l",
+ "v0l", "v1l", "v2l", "v3l", "v4l", "v5l", "v6l", "v7l",
+ "v8l", "v9l", "v10l", "v11l", "v12l", "v13l", "v14l", "v15l",
};
static const char *const vxrs_high[] = {
- "v16", "v17", "v18", "v19", "v20", "v21", "v22", "v23", "v24",
- "v25", "v26", "v27", "v28", "v29", "v30", "v31",
+ "v16", "v17", "v18", "v19", "v20", "v21", "v22", "v23",
+ "v24", "v25", "v26", "v27", "v28", "v29", "v30", "v31",
};
static const char *const gs_cb[] = {
- "gsd", "gssm", "gsepla",
+ "gsd",
+ "gssm",
+ "gsepla",
};
static const char *const gs_bc[] = {
- "bc_gsd", "bc_gssm", "bc_gsepla",
+ "bc_gsd",
+ "bc_gssm",
+ "bc_gsepla",
};
const struct target_desc *tdesc = tdep->tdesc;
@@ -6927,11 +7170,11 @@ s390_tdesc_valid (s390_gdbarch_tdep *tdep,
feature = tdesc_find_feature (tdesc, "org.gnu.gdb.s390.linux");
if (feature)
{
- tdesc_numbered_register (feature, tdesc_data,
- S390_ORIG_R2_REGNUM, "orig_r2");
+ tdesc_numbered_register (feature, tdesc_data, S390_ORIG_R2_REGNUM,
+ "orig_r2");
- if (tdesc_numbered_register (feature, tdesc_data,
- S390_LAST_BREAK_REGNUM, "last_break"))
+ if (tdesc_numbered_register (feature, tdesc_data, S390_LAST_BREAK_REGNUM,
+ "last_break"))
tdep->have_linux_v1 = true;
if (tdesc_numbered_register (feature, tdesc_data,
@@ -6976,8 +7219,7 @@ s390_tdesc_valid (s390_gdbarch_tdep *tdep,
{
if (!tdep->have_gs)
return false;
- s390_validate_reg_range (feature, tdesc_data, S390_BC_GSD_REGNUM,
- gs_bc);
+ s390_validate_reg_range (feature, tdesc_data, S390_BC_GSD_REGNUM, gs_bc);
}
return true;
@@ -7020,10 +7262,10 @@ s390_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
const struct target_desc *tdesc = info.target_desc;
int first_pseudo_reg, last_pseudo_reg;
static const char *const stap_register_prefixes[] = { "%", NULL };
- static const char *const stap_register_indirection_prefixes[] = { "(",
- NULL };
- static const char *const stap_register_indirection_suffixes[] = { ")",
- NULL };
+ static const char *const stap_register_indirection_prefixes[]
+ = { "(", NULL };
+ static const char *const stap_register_indirection_suffixes[]
+ = { ")", NULL };
gdbarch *gdbarch = gdbarch_alloc (&info, s390_gdbarch_tdep_alloc ());
s390_gdbarch_tdep *tdep = gdbarch_tdep<s390_gdbarch_tdep> (gdbarch);
@@ -7053,7 +7295,8 @@ s390_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
set_gdbarch_displaced_step_copy_insn (gdbarch,
s390_displaced_step_copy_insn);
set_gdbarch_displaced_step_fixup (gdbarch, s390_displaced_step_fixup);
- set_gdbarch_displaced_step_hw_singlestep (gdbarch, s390_displaced_step_hw_singlestep);
+ set_gdbarch_displaced_step_hw_singlestep (gdbarch,
+ s390_displaced_step_hw_singlestep);
set_gdbarch_software_single_step (gdbarch, s390_software_single_step);
set_gdbarch_max_insn_length (gdbarch, S390_MAX_INSTR_SIZE);
@@ -7079,8 +7322,8 @@ s390_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
s390_pseudo_register_reggroup_p);
set_gdbarch_ax_pseudo_register_collect (gdbarch,
s390_ax_pseudo_register_collect);
- set_gdbarch_ax_pseudo_register_push_stack
- (gdbarch, s390_ax_pseudo_register_push_stack);
+ set_gdbarch_ax_pseudo_register_push_stack (
+ gdbarch, s390_ax_pseudo_register_push_stack);
set_gdbarch_gen_return_address (gdbarch, s390_gen_return_address);
/* Inferior function calls. */
@@ -7111,19 +7354,19 @@ s390_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
set_gdbarch_ptr_bit (gdbarch, 64);
set_gdbarch_address_class_type_flags (gdbarch,
s390_address_class_type_flags);
- set_gdbarch_address_class_type_flags_to_name (gdbarch,
- s390_address_class_type_flags_to_name);
- set_gdbarch_address_class_name_to_type_flags (gdbarch,
- s390_address_class_name_to_type_flags);
+ set_gdbarch_address_class_type_flags_to_name (
+ gdbarch, s390_address_class_type_flags_to_name);
+ set_gdbarch_address_class_name_to_type_flags (
+ gdbarch, s390_address_class_name_to_type_flags);
break;
}
/* SystemTap functions. */
set_gdbarch_stap_register_prefixes (gdbarch, stap_register_prefixes);
- set_gdbarch_stap_register_indirection_prefixes (gdbarch,
- stap_register_indirection_prefixes);
- set_gdbarch_stap_register_indirection_suffixes (gdbarch,
- stap_register_indirection_suffixes);
+ set_gdbarch_stap_register_indirection_prefixes (
+ gdbarch, stap_register_indirection_prefixes);
+ set_gdbarch_stap_register_indirection_suffixes (
+ gdbarch, stap_register_indirection_suffixes);
set_gdbarch_disassembler_options (gdbarch, &s390_disassembler_options);
set_gdbarch_valid_disassembler_options (gdbarch,
@@ -7159,20 +7402,18 @@ s390_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
return NULL;
}
- /* Determine vector ABI. */
+ /* Determine vector ABI. */
#ifdef HAVE_ELF
- if (tdep->have_vx
- && info.abfd != NULL
- && info.abfd->format == bfd_object
+ if (tdep->have_vx && info.abfd != NULL && info.abfd->format == bfd_object
&& bfd_get_flavour (info.abfd) == bfd_target_elf_flavour
&& bfd_elf_get_obj_attr_int (info.abfd, OBJ_ATTR_GNU,
- Tag_GNU_S390_ABI_Vector) == 2)
+ Tag_GNU_S390_ABI_Vector)
+ == 2)
tdep->vector_abi = S390_VECTOR_ABI_128;
#endif
/* Find a candidate among extant architectures. */
- for (arches = gdbarch_list_lookup_by_info (arches, &info);
- arches != NULL;
+ for (arches = gdbarch_list_lookup_by_info (arches, &info); arches != NULL;
arches = gdbarch_list_lookup_by_info (arches->next, &info))
{
s390_gdbarch_tdep *tmp
@@ -7222,6 +7463,7 @@ s390_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
}
void _initialize_s390_tdep ();
+
void
_initialize_s390_tdep ()
{
diff --git a/gdb/s390-tdep.h b/gdb/s390-tdep.h
index 7a9a3530723..f186caa22f3 100644
--- a/gdb/s390-tdep.h
+++ b/gdb/s390-tdep.h
@@ -44,10 +44,14 @@ struct s390_gdbarch_tdep : gdbarch_tdep_base
const struct target_desc *tdesc = nullptr;
/* ABI version. */
- enum s390_abi_kind abi {};
+ enum s390_abi_kind abi
+ {
+ };
/* Vector ABI. */
- enum s390_vector_abi_kind vector_abi {};
+ enum s390_vector_abi_kind vector_abi
+ {
+ };
/* Pseudo register numbers. */
int gpr_full_regnum = 0;
@@ -77,70 +81,106 @@ using s390_gdbarch_tdep_up = std::unique_ptr<s390_gdbarch_tdep>;
enum
{
- op1_lhi = 0xa7, op2_lhi = 0x08,
- op1_lghi = 0xa7, op2_lghi = 0x09,
- op1_lgfi = 0xc0, op2_lgfi = 0x01,
- op_lr = 0x18,
- op_lgr = 0xb904,
- op_l = 0x58,
- op1_ly = 0xe3, op2_ly = 0x58,
- op1_lg = 0xe3, op2_lg = 0x04,
- op_lm = 0x98,
- op1_lmy = 0xeb, op2_lmy = 0x98,
- op1_lmg = 0xeb, op2_lmg = 0x04,
- op_st = 0x50,
- op1_sty = 0xe3, op2_sty = 0x50,
- op1_stg = 0xe3, op2_stg = 0x24,
- op_std = 0x60,
- op_stm = 0x90,
- op1_stmy = 0xeb, op2_stmy = 0x90,
- op1_stmg = 0xeb, op2_stmg = 0x24,
- op1_aghi = 0xa7, op2_aghi = 0x0b,
- op1_ahi = 0xa7, op2_ahi = 0x0a,
- op1_agfi = 0xc2, op2_agfi = 0x08,
- op1_afi = 0xc2, op2_afi = 0x09,
- op1_algfi= 0xc2, op2_algfi= 0x0a,
- op1_alfi = 0xc2, op2_alfi = 0x0b,
- op_ar = 0x1a,
- op_agr = 0xb908,
- op_a = 0x5a,
- op1_ay = 0xe3, op2_ay = 0x5a,
- op1_ag = 0xe3, op2_ag = 0x08,
- op1_slgfi= 0xc2, op2_slgfi= 0x04,
- op1_slfi = 0xc2, op2_slfi = 0x05,
- op_sr = 0x1b,
- op_sgr = 0xb909,
- op_s = 0x5b,
- op1_sy = 0xe3, op2_sy = 0x5b,
- op1_sg = 0xe3, op2_sg = 0x09,
- op_nr = 0x14,
- op_ngr = 0xb980,
- op_la = 0x41,
- op1_lay = 0xe3, op2_lay = 0x71,
- op1_larl = 0xc0, op2_larl = 0x00,
- op_basr = 0x0d,
- op_bas = 0x4d,
- op_bcr = 0x07,
- op_bc = 0x47,
- op_bctr = 0x06,
+ op1_lhi = 0xa7,
+ op2_lhi = 0x08,
+ op1_lghi = 0xa7,
+ op2_lghi = 0x09,
+ op1_lgfi = 0xc0,
+ op2_lgfi = 0x01,
+ op_lr = 0x18,
+ op_lgr = 0xb904,
+ op_l = 0x58,
+ op1_ly = 0xe3,
+ op2_ly = 0x58,
+ op1_lg = 0xe3,
+ op2_lg = 0x04,
+ op_lm = 0x98,
+ op1_lmy = 0xeb,
+ op2_lmy = 0x98,
+ op1_lmg = 0xeb,
+ op2_lmg = 0x04,
+ op_st = 0x50,
+ op1_sty = 0xe3,
+ op2_sty = 0x50,
+ op1_stg = 0xe3,
+ op2_stg = 0x24,
+ op_std = 0x60,
+ op_stm = 0x90,
+ op1_stmy = 0xeb,
+ op2_stmy = 0x90,
+ op1_stmg = 0xeb,
+ op2_stmg = 0x24,
+ op1_aghi = 0xa7,
+ op2_aghi = 0x0b,
+ op1_ahi = 0xa7,
+ op2_ahi = 0x0a,
+ op1_agfi = 0xc2,
+ op2_agfi = 0x08,
+ op1_afi = 0xc2,
+ op2_afi = 0x09,
+ op1_algfi = 0xc2,
+ op2_algfi = 0x0a,
+ op1_alfi = 0xc2,
+ op2_alfi = 0x0b,
+ op_ar = 0x1a,
+ op_agr = 0xb908,
+ op_a = 0x5a,
+ op1_ay = 0xe3,
+ op2_ay = 0x5a,
+ op1_ag = 0xe3,
+ op2_ag = 0x08,
+ op1_slgfi = 0xc2,
+ op2_slgfi = 0x04,
+ op1_slfi = 0xc2,
+ op2_slfi = 0x05,
+ op_sr = 0x1b,
+ op_sgr = 0xb909,
+ op_s = 0x5b,
+ op1_sy = 0xe3,
+ op2_sy = 0x5b,
+ op1_sg = 0xe3,
+ op2_sg = 0x09,
+ op_nr = 0x14,
+ op_ngr = 0xb980,
+ op_la = 0x41,
+ op1_lay = 0xe3,
+ op2_lay = 0x71,
+ op1_larl = 0xc0,
+ op2_larl = 0x00,
+ op_basr = 0x0d,
+ op_bas = 0x4d,
+ op_bcr = 0x07,
+ op_bc = 0x47,
+ op_bctr = 0x06,
op_bctgr = 0xb946,
- op_bct = 0x46,
- op1_bctg = 0xe3, op2_bctg = 0x46,
- op_bxh = 0x86,
- op1_bxhg = 0xeb, op2_bxhg = 0x44,
- op_bxle = 0x87,
- op1_bxleg= 0xeb, op2_bxleg= 0x45,
- op1_bras = 0xa7, op2_bras = 0x05,
- op1_brasl= 0xc0, op2_brasl= 0x05,
- op1_brc = 0xa7, op2_brc = 0x04,
- op1_brcl = 0xc0, op2_brcl = 0x04,
- op1_brct = 0xa7, op2_brct = 0x06,
- op1_brctg= 0xa7, op2_brctg= 0x07,
- op_brxh = 0x84,
- op1_brxhg= 0xec, op2_brxhg= 0x44,
+ op_bct = 0x46,
+ op1_bctg = 0xe3,
+ op2_bctg = 0x46,
+ op_bxh = 0x86,
+ op1_bxhg = 0xeb,
+ op2_bxhg = 0x44,
+ op_bxle = 0x87,
+ op1_bxleg = 0xeb,
+ op2_bxleg = 0x45,
+ op1_bras = 0xa7,
+ op2_bras = 0x05,
+ op1_brasl = 0xc0,
+ op2_brasl = 0x05,
+ op1_brc = 0xa7,
+ op2_brc = 0x04,
+ op1_brcl = 0xc0,
+ op2_brcl = 0x04,
+ op1_brct = 0xa7,
+ op2_brct = 0x06,
+ op1_brctg = 0xa7,
+ op2_brctg = 0x07,
+ op_brxh = 0x84,
+ op1_brxhg = 0xec,
+ op2_brxhg = 0x44,
op_brxle = 0x85,
- op1_brxlg= 0xec, op2_brxlg= 0x45,
- op_svc = 0x0a,
+ op1_brxlg = 0xec,
+ op2_brxlg = 0x45,
+ op_svc = 0x0a,
};
/* Hardware capabilities. */
@@ -315,9 +355,10 @@ enum
/* Frame unwinding. */
-extern struct value *s390_trad_frame_prev_register
- (frame_info_ptr this_frame, struct trad_frame_saved_reg saved_regs[],
- int regnum);
+extern struct value *
+s390_trad_frame_prev_register (frame_info_ptr this_frame,
+ struct trad_frame_saved_reg saved_regs[],
+ int regnum);
extern const struct target_desc *tdesc_s390_linux32;
extern const struct target_desc *tdesc_s390x_linux64;
diff --git a/gdb/scoped-mock-context.h b/gdb/scoped-mock-context.h
index 9ad7ebf5f0c..08cd268d787 100644
--- a/gdb/scoped-mock-context.h
+++ b/gdb/scoped-mock-context.h
@@ -26,7 +26,8 @@
#include "progspace-and-thread.h"
#if GDB_SELF_TEST
-namespace selftests {
+namespace selftests
+{
/* RAII type to create (and switch to) a temporary mock context. An
inferior with a thread, with a process_stratum target pushed. */
@@ -37,10 +38,10 @@ struct scoped_mock_context
/* Order here is important. */
Target mock_target;
- ptid_t mock_ptid {1, 1};
- program_space mock_pspace {new address_space ()};
- inferior mock_inferior {mock_ptid.pid ()};
- thread_info mock_thread {&mock_inferior, mock_ptid};
+ ptid_t mock_ptid { 1, 1 };
+ program_space mock_pspace { new address_space () };
+ inferior mock_inferior { mock_ptid.pid () };
+ thread_info mock_thread { &mock_inferior, mock_ptid };
scoped_restore_current_pspace_and_thread restore_pspace_thread;
diff --git a/gdb/selftest-arch.c b/gdb/selftest-arch.c
index 691c40c14d7..04c55f01918 100644
--- a/gdb/selftest-arch.c
+++ b/gdb/selftest-arch.c
@@ -24,9 +24,11 @@
#include "selftest-arch.h"
#include "arch-utils.h"
-namespace selftests {
+namespace selftests
+{
-static bool skip_arch (const char *arch)
+static bool
+skip_arch (const char *arch)
{
if (strcmp ("powerpc:EC603e", arch) == 0
|| strcmp ("powerpc:e500mc", arch) == 0
@@ -61,14 +63,12 @@ foreach_arch_test_generator (const std::string &name,
info.bfd_arch_info = bfd_scan_arch (arch);
info.osabi = GDB_OSABI_NONE;
- auto test_fn
- = ([=] ()
- {
- struct gdbarch *gdbarch = gdbarch_find_by_info (info);
- SELF_CHECK (gdbarch != NULL);
- function (gdbarch);
- reset ();
- });
+ auto test_fn = ([=] () {
+ struct gdbarch *gdbarch = gdbarch_find_by_info (info);
+ SELF_CHECK (gdbarch != NULL);
+ function (gdbarch);
+ reset ();
+ });
std::string id;
@@ -77,7 +77,8 @@ foreach_arch_test_generator (const std::string &name,
/* Avoid avr::avr:1. */
id = arch;
else if (strncasecmp (info.bfd_arch_info->arch_name, arch,
- strlen (info.bfd_arch_info->arch_name)) == 0)
+ strlen (info.bfd_arch_info->arch_name))
+ == 0)
/* Avoid arm::arm. */
id = arch;
else
@@ -98,10 +99,9 @@ void
register_test_foreach_arch (const std::string &name,
self_test_foreach_arch_function *function)
{
- add_lazy_generator ([=] ()
- {
- return foreach_arch_test_generator (name, function);
- });
+ add_lazy_generator ([=] () {
+ return foreach_arch_test_generator (name, function);
+ });
}
void
diff --git a/gdb/selftest-arch.h b/gdb/selftest-arch.h
index a925e5a00dc..2d8f6710010 100644
--- a/gdb/selftest-arch.h
+++ b/gdb/selftest-arch.h
@@ -27,8 +27,8 @@ namespace selftests
/* Register a selftest running FUNCTION for each arch supported by GDB. */
extern void
- register_test_foreach_arch (const std::string &name,
- self_test_foreach_arch_function *function);
-}
+register_test_foreach_arch (const std::string &name,
+ self_test_foreach_arch_function *function);
+} // namespace selftests
#endif /* SELFTEST_ARCH_H */
diff --git a/gdb/sentinel-frame.c b/gdb/sentinel-frame.c
index f323de3bb5d..e09beba0759 100644
--- a/gdb/sentinel-frame.c
+++ b/gdb/sentinel-frame.c
@@ -17,7 +17,6 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
-
#include "defs.h"
#include "regcache.h"
#include "sentinel-frame.h"
@@ -32,8 +31,8 @@ struct frame_unwind_cache
void *
sentinel_frame_cache (struct regcache *regcache)
{
- struct frame_unwind_cache *cache =
- FRAME_OBSTACK_ZALLOC (struct frame_unwind_cache);
+ struct frame_unwind_cache *cache
+ = FRAME_OBSTACK_ZALLOC (struct frame_unwind_cache);
cache->regcache = regcache;
return cache;
@@ -43,8 +42,7 @@ sentinel_frame_cache (struct regcache *regcache)
static struct value *
sentinel_frame_prev_register (frame_info_ptr this_frame,
- void **this_prologue_cache,
- int regnum)
+ void **this_prologue_cache, int regnum)
{
struct frame_unwind_cache *cache
= (struct frame_unwind_cache *) *this_prologue_cache;
@@ -57,14 +55,13 @@ sentinel_frame_prev_register (frame_info_ptr this_frame,
}
static void
-sentinel_frame_this_id (frame_info_ptr this_frame,
- void **this_prologue_cache,
+sentinel_frame_this_id (frame_info_ptr this_frame, void **this_prologue_cache,
struct frame_id *this_id)
{
/* The sentinel frame is used as a starting point for creating the
previous (inner most) frame. That frame's THIS_ID method will be
called to determine the inner most frame's ID. Not this one. */
- internal_error (_("sentinel_frame_this_id called"));
+ internal_error (_ ("sentinel_frame_this_id called"));
}
static struct gdbarch *
@@ -77,8 +74,7 @@ sentinel_frame_prev_arch (frame_info_ptr this_frame,
return cache->regcache->arch ();
}
-const struct frame_unwind sentinel_frame_unwind =
-{
+const struct frame_unwind sentinel_frame_unwind = {
"sentinel",
SENTINEL_FRAME,
default_frame_unwind_stop_reason,
diff --git a/gdb/sentinel-frame.h b/gdb/sentinel-frame.h
index 8aacd631eff..6e323788cd6 100644
--- a/gdb/sentinel-frame.h
+++ b/gdb/sentinel-frame.h
@@ -17,7 +17,7 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
-#if !defined (SENTINEL_FRAME_H)
+#if !defined(SENTINEL_FRAME_H)
#define SENTINEL_FRAME_H 1
struct frame_unwind;
diff --git a/gdb/ser-base.c b/gdb/ser-base.c
index 0883305ac2b..9d512074ed0 100644
--- a/gdb/ser-base.c
+++ b/gdb/ser-base.c
@@ -28,7 +28,6 @@
#include <winsock2.h>
#endif
-
static timer_handler_func push_event;
static handler_func fd_event;
@@ -42,7 +41,8 @@ static handler_func fd_event;
is told to go away. */
/* Value of scb->async_state: */
-enum {
+enum
+{
/* When >= 0, this contains the ID of the currently scheduled timer event.
This state is rarely encountered. Timer events are one-off so as soon as
the event is delivered the state is changed to NOTHING_SCHEDULED. */
@@ -108,13 +108,11 @@ reschedule (struct serial *scb)
{
case FD_SCHEDULED:
if (scb->async_state != FD_SCHEDULED)
- gdb_printf (gdb_stdlog, "[fd%d->fd-scheduled]\n",
- scb->fd);
+ gdb_printf (gdb_stdlog, "[fd%d->fd-scheduled]\n", scb->fd);
break;
default: /* TIMER SCHEDULED */
if (scb->async_state == FD_SCHEDULED)
- gdb_printf (gdb_stdlog, "[fd%d->timer-scheduled]\n",
- scb->fd);
+ gdb_printf (gdb_stdlog, "[fd%d->timer-scheduled]\n", scb->fd);
break;
}
}
@@ -248,7 +246,7 @@ ser_base_wait_for (struct serial *scb, int timeout)
else if (errno == EINTR)
continue;
else
- return SERIAL_ERROR; /* Got an error from select or
+ return SERIAL_ERROR; /* Got an error from select or
poll. */
}
@@ -274,7 +272,7 @@ ser_base_read_error_fd (struct serial *scb, int close_fd)
int num_bytes = -1;
if (scb->ops->avail)
- num_bytes = (scb->ops->avail)(scb, scb->error_fd);
+ num_bytes = (scb->ops->avail) (scb, scb->error_fd);
if (num_bytes != -1)
to_read = (num_bytes < to_read) ? num_bytes : to_read;
@@ -312,7 +310,7 @@ ser_base_read_error_fd (struct serial *scb, int close_fd)
}
gdb_puts (current, gdb_stderr);
- }
+ }
}
}
@@ -400,7 +398,7 @@ do_ser_base_readchar (struct serial *scb, int timeout)
return SERIAL_EOF;
else
/* Got an error from read. */
- return SERIAL_ERROR;
+ return SERIAL_ERROR;
}
scb->bufcnt = status;
@@ -529,7 +527,7 @@ ser_base_drain_output (struct serial *scb)
void
ser_base_raw (struct serial *scb)
{
- return; /* Always in raw mode. */
+ return; /* Always in raw mode. */
}
serial_ttystate
@@ -553,8 +551,7 @@ ser_base_set_tty_state (struct serial *scb, serial_ttystate ttystate)
}
void
-ser_base_print_tty_state (struct serial *scb,
- serial_ttystate ttystate,
+ser_base_print_tty_state (struct serial *scb, serial_ttystate ttystate,
struct ui_file *stream)
{
/* Nothing to print. */
@@ -564,13 +561,13 @@ ser_base_print_tty_state (struct serial *scb,
int
ser_base_setbaudrate (struct serial *scb, int rate)
{
- return 0; /* Never fails! */
+ return 0; /* Never fails! */
}
int
ser_base_setstopbits (struct serial *scb, int num)
{
- return 0; /* Never fails! */
+ return 0; /* Never fails! */
}
/* Implement the "setparity" serial_ops callback. */
@@ -578,22 +575,20 @@ ser_base_setstopbits (struct serial *scb, int num)
int
ser_base_setparity (struct serial *scb, int parity)
{
- return 0; /* Never fails! */
+ return 0; /* Never fails! */
}
/* Put the SERIAL device into/out-of ASYNC mode. */
void
-ser_base_async (struct serial *scb,
- int async_p)
+ser_base_async (struct serial *scb, int async_p)
{
if (async_p)
{
/* Force a re-schedule. */
scb->async_state = NOTHING_SCHEDULED;
if (serial_debug_p (scb))
- gdb_printf (gdb_stdlog, "[fd%d->asynchronous]\n",
- scb->fd);
+ gdb_printf (gdb_stdlog, "[fd%d->asynchronous]\n", scb->fd);
reschedule (scb);
if (scb->error_fd != -1)
@@ -602,8 +597,7 @@ ser_base_async (struct serial *scb,
else
{
if (serial_debug_p (scb))
- gdb_printf (gdb_stdlog, "[fd%d->synchronous]\n",
- scb->fd);
+ gdb_printf (gdb_stdlog, "[fd%d->synchronous]\n", scb->fd);
/* De-schedule whatever tasks are currently scheduled. */
switch (scb->async_state)
{
diff --git a/gdb/ser-base.h b/gdb/ser-base.h
index 4c6537f7adf..f3e1762011c 100644
--- a/gdb/ser-base.h
+++ b/gdb/ser-base.h
@@ -20,7 +20,7 @@
#ifndef SER_BASE_H
#define SER_BASE_H
-#include "serial.h" /* For serial_ttystate. */
+#include "serial.h" /* For serial_ttystate. */
struct serial;
struct ui_file;
diff --git a/gdb/ser-event.c b/gdb/ser-event.c
index 5865e847bb5..5695e8cb001 100644
--- a/gdb/ser-event.c
+++ b/gdb/ser-event.c
@@ -35,16 +35,16 @@
nothing ever actually waits on that file descriptor. */
struct serial_event_state
- {
+{
#ifdef USE_WIN32API
- /* The Windows event object, created with CreateEvent. */
- HANDLE event;
+ /* The Windows event object, created with CreateEvent. */
+ HANDLE event;
#else
- /* The write side of the pipe. The read side is in
+ /* The write side of the pipe. The read side is in
serial->fd. */
- int write_fd;
+ int write_fd;
#endif
- };
+};
/* Open a new serial event. */
@@ -127,8 +127,7 @@ serial_event_wait_handle (struct serial *scb, HANDLE *read, HANDLE *except)
is internal implementation detail never to be used by remote
targets for protocol transport. */
-static const struct serial_ops serial_event_ops =
-{
+static const struct serial_ops serial_event_ops = {
"event",
serial_event_open,
serial_event_close,
@@ -183,7 +182,7 @@ serial_event_set (struct serial_event *event)
struct serial_event_state *state = (struct serial_event_state *) ser->state;
#ifndef USE_WIN32API
int r;
- char c = '+'; /* Anything. */
+ char c = '+'; /* Anything. */
do
{
diff --git a/gdb/ser-go32.c b/gdb/ser-go32.c
index 1141f126971..da670958289 100644
--- a/gdb/ser-go32.c
+++ b/gdb/ser-go32.c
@@ -28,22 +28,22 @@
* NS16550 UART registers
*/
-#define COM1ADDR 0x3f8
-#define COM2ADDR 0x2f8
-#define COM3ADDR 0x3e8
-#define COM4ADDR 0x3e0
-
-#define com_data 0 /* data register (R/W) */
-#define com_dlbl 0 /* divisor latch low (W) */
-#define com_ier 1 /* interrupt enable (W) */
-#define com_dlbh 1 /* divisor latch high (W) */
-#define com_iir 2 /* interrupt identification (R) */
-#define com_fifo 2 /* FIFO control (W) */
-#define com_lctl 3 /* line control register (R/W) */
-#define com_cfcr 3 /* line control register (R/W) */
-#define com_mcr 4 /* modem control register (R/W) */
-#define com_lsr 5 /* line status register (R/W) */
-#define com_msr 6 /* modem status register (R/W) */
+#define COM1ADDR 0x3f8
+#define COM2ADDR 0x2f8
+#define COM3ADDR 0x3e8
+#define COM4ADDR 0x3e0
+
+#define com_data 0 /* data register (R/W) */
+#define com_dlbl 0 /* divisor latch low (W) */
+#define com_ier 1 /* interrupt enable (W) */
+#define com_dlbh 1 /* divisor latch high (W) */
+#define com_iir 2 /* interrupt identification (R) */
+#define com_fifo 2 /* FIFO control (W) */
+#define com_lctl 3 /* line control register (R/W) */
+#define com_cfcr 3 /* line control register (R/W) */
+#define com_mcr 4 /* modem control register (R/W) */
+#define com_lsr 5 /* line status register (R/W) */
+#define com_msr 6 /* modem status register (R/W) */
/*
* Constants for computing 16 bit baud rate divisor (lower byte
@@ -51,77 +51,76 @@
* 1.8432 MHz / (16 * X) for X bps. If the baud rate can't be set
* to within +- (desired_rate*SPEED_TOLERANCE/1000) bps, we fail.
*/
-#define COMTICK (1843200/16)
-#define SPEED_TOLERANCE 30 /* thousandths; real == desired +- 3.0% */
+#define COMTICK (1843200 / 16)
+#define SPEED_TOLERANCE 30 /* thousandths; real == desired +- 3.0% */
/* interrupt enable register */
-#define IER_ERXRDY 0x1 /* int on rx ready */
-#define IER_ETXRDY 0x2 /* int on tx ready */
-#define IER_ERLS 0x4 /* int on line status change */
-#define IER_EMSC 0x8 /* int on modem status change */
+#define IER_ERXRDY 0x1 /* int on rx ready */
+#define IER_ETXRDY 0x2 /* int on tx ready */
+#define IER_ERLS 0x4 /* int on line status change */
+#define IER_EMSC 0x8 /* int on modem status change */
/* interrupt identification register */
-#define IIR_FIFO_MASK 0xc0 /* set if FIFOs are enabled */
-#define IIR_IMASK 0xf /* interrupt cause mask */
-#define IIR_NOPEND 0x1 /* nothing pending */
-#define IIR_RLS 0x6 /* receive line status */
-#define IIR_RXRDY 0x4 /* receive ready */
-#define IIR_RXTOUT 0xc /* receive timeout */
-#define IIR_TXRDY 0x2 /* transmit ready */
-#define IIR_MLSC 0x0 /* modem status */
-
+#define IIR_FIFO_MASK 0xc0 /* set if FIFOs are enabled */
+#define IIR_IMASK 0xf /* interrupt cause mask */
+#define IIR_NOPEND 0x1 /* nothing pending */
+#define IIR_RLS 0x6 /* receive line status */
+#define IIR_RXRDY 0x4 /* receive ready */
+#define IIR_RXTOUT 0xc /* receive timeout */
+#define IIR_TXRDY 0x2 /* transmit ready */
+#define IIR_MLSC 0x0 /* modem status */
/* fifo control register */
-#define FIFO_ENABLE 0x01 /* enable fifo */
-#define FIFO_RCV_RST 0x02 /* reset receive fifo */
-#define FIFO_XMT_RST 0x04 /* reset transmit fifo */
-#define FIFO_DMA_MODE 0x08 /* enable dma mode */
-#define FIFO_TRIGGER_1 0x00 /* trigger at 1 char */
-#define FIFO_TRIGGER_4 0x40 /* trigger at 4 chars */
-#define FIFO_TRIGGER_8 0x80 /* trigger at 8 chars */
-#define FIFO_TRIGGER_14 0xc0 /* trigger at 14 chars */
+#define FIFO_ENABLE 0x01 /* enable fifo */
+#define FIFO_RCV_RST 0x02 /* reset receive fifo */
+#define FIFO_XMT_RST 0x04 /* reset transmit fifo */
+#define FIFO_DMA_MODE 0x08 /* enable dma mode */
+#define FIFO_TRIGGER_1 0x00 /* trigger at 1 char */
+#define FIFO_TRIGGER_4 0x40 /* trigger at 4 chars */
+#define FIFO_TRIGGER_8 0x80 /* trigger at 8 chars */
+#define FIFO_TRIGGER_14 0xc0 /* trigger at 14 chars */
/* character format control register */
-#define CFCR_DLAB 0x80 /* divisor latch */
-#define CFCR_SBREAK 0x40 /* send break */
-#define CFCR_PZERO 0x30 /* zero parity */
-#define CFCR_PONE 0x20 /* one parity */
-#define CFCR_PEVEN 0x10 /* even parity */
-#define CFCR_PODD 0x00 /* odd parity */
-#define CFCR_PENAB 0x08 /* parity enable */
-#define CFCR_STOPB 0x04 /* 2 stop bits */
-#define CFCR_8BITS 0x03 /* 8 data bits */
-#define CFCR_7BITS 0x02 /* 7 data bits */
-#define CFCR_6BITS 0x01 /* 6 data bits */
-#define CFCR_5BITS 0x00 /* 5 data bits */
+#define CFCR_DLAB 0x80 /* divisor latch */
+#define CFCR_SBREAK 0x40 /* send break */
+#define CFCR_PZERO 0x30 /* zero parity */
+#define CFCR_PONE 0x20 /* one parity */
+#define CFCR_PEVEN 0x10 /* even parity */
+#define CFCR_PODD 0x00 /* odd parity */
+#define CFCR_PENAB 0x08 /* parity enable */
+#define CFCR_STOPB 0x04 /* 2 stop bits */
+#define CFCR_8BITS 0x03 /* 8 data bits */
+#define CFCR_7BITS 0x02 /* 7 data bits */
+#define CFCR_6BITS 0x01 /* 6 data bits */
+#define CFCR_5BITS 0x00 /* 5 data bits */
/* modem control register */
-#define MCR_LOOPBACK 0x10 /* loopback */
-#define MCR_IENABLE 0x08 /* output 2 = int enable */
-#define MCR_DRS 0x04 /* output 1 = xxx */
-#define MCR_RTS 0x02 /* enable RTS */
-#define MCR_DTR 0x01 /* enable DTR */
+#define MCR_LOOPBACK 0x10 /* loopback */
+#define MCR_IENABLE 0x08 /* output 2 = int enable */
+#define MCR_DRS 0x04 /* output 1 = xxx */
+#define MCR_RTS 0x02 /* enable RTS */
+#define MCR_DTR 0x01 /* enable DTR */
/* line status register */
-#define LSR_RCV_FIFO 0x80 /* error in receive fifo */
-#define LSR_TSRE 0x40 /* transmitter empty */
-#define LSR_TXRDY 0x20 /* transmitter ready */
-#define LSR_BI 0x10 /* break detected */
-#define LSR_FE 0x08 /* framing error */
-#define LSR_PE 0x04 /* parity error */
-#define LSR_OE 0x02 /* overrun error */
-#define LSR_RXRDY 0x01 /* receiver ready */
-#define LSR_RCV_MASK 0x1f
+#define LSR_RCV_FIFO 0x80 /* error in receive fifo */
+#define LSR_TSRE 0x40 /* transmitter empty */
+#define LSR_TXRDY 0x20 /* transmitter ready */
+#define LSR_BI 0x10 /* break detected */
+#define LSR_FE 0x08 /* framing error */
+#define LSR_PE 0x04 /* parity error */
+#define LSR_OE 0x02 /* overrun error */
+#define LSR_RXRDY 0x01 /* receiver ready */
+#define LSR_RCV_MASK 0x1f
/* modem status register */
-#define MSR_DCD 0x80
-#define MSR_RI 0x40
-#define MSR_DSR 0x20
-#define MSR_CTS 0x10
-#define MSR_DDCD 0x08
-#define MSR_TERI 0x04
-#define MSR_DDSR 0x02
-#define MSR_DCTS 0x01
+#define MSR_DCD 0x80
+#define MSR_RI 0x40
+#define MSR_DSR 0x20
+#define MSR_CTS 0x10
+#define MSR_DDCD 0x08
+#define MSR_TERI 0x04
+#define MSR_DDSR 0x02
+#define MSR_DCTS 0x01
#include <time.h>
#include <dos.h>
@@ -130,29 +129,26 @@
typedef unsigned long u_long;
/* 16550 rx fifo trigger point */
-#define FIFO_TRIGGER FIFO_TRIGGER_4
+#define FIFO_TRIGGER FIFO_TRIGGER_4
/* input buffer size */
-#define CBSIZE 4096
+#define CBSIZE 4096
-#define RAWHZ 18
+#define RAWHZ 18
#ifdef DOS_STATS
-#define CNT_RX 16
-#define CNT_TX 17
-#define CNT_STRAY 18
-#define CNT_ORUN 19
-#define NCNT 20
+#define CNT_RX 16
+#define CNT_TX 17
+#define CNT_STRAY 18
+#define CNT_ORUN 19
+#define NCNT 20
static int intrcnt;
static size_t cnts[NCNT];
-static char *cntnames[NCNT] =
-{
+static char *cntnames[NCNT] = {
/* h/w interrupt counts. */
- "mlsc", "nopend", "txrdy", "?3",
- "rxrdy", "?5", "rls", "?7",
- "?8", "?9", "?a", "?b",
- "rxtout", "?d", "?e", "?f",
+ "mlsc", "nopend", "txrdy", "?3", "rxrdy", "?5", "rls", "?7", "?8", "?9",
+ "?a", "?b", "rxtout", "?d", "?e", "?f",
/* s/w counts. */
"rxcnt", "txcnt", "stray", "swoflo"
};
@@ -163,65 +159,48 @@ static char *cntnames[NCNT] =
#endif
/* Main interrupt controller port addresses. */
-#define ICU_BASE 0x20
-#define ICU_OCW2 (ICU_BASE + 0)
-#define ICU_MASK (ICU_BASE + 1)
+#define ICU_BASE 0x20
+#define ICU_OCW2 (ICU_BASE + 0)
+#define ICU_MASK (ICU_BASE + 1)
/* Original interrupt controller mask register. */
unsigned char icu_oldmask;
/* Maximum of 8 interrupts (we don't handle the slave icu yet). */
-#define NINTR 8
+#define NINTR 8
static struct intrupt
- {
- char inuse;
- struct dos_ttystate *port;
- _go32_dpmi_seginfo old_rmhandler;
- _go32_dpmi_seginfo old_pmhandler;
- _go32_dpmi_seginfo new_rmhandler;
- _go32_dpmi_seginfo new_pmhandler;
- _go32_dpmi_registers regs;
- }
-intrupts[NINTR];
-
+{
+ char inuse;
+ struct dos_ttystate *port;
+ _go32_dpmi_seginfo old_rmhandler;
+ _go32_dpmi_seginfo old_pmhandler;
+ _go32_dpmi_seginfo new_rmhandler;
+ _go32_dpmi_seginfo new_pmhandler;
+ _go32_dpmi_registers regs;
+} intrupts[NINTR];
static struct dos_ttystate
- {
- int base;
- int irq;
- int refcnt;
- struct intrupt *intrupt;
- int fifo;
- int baudrate;
- unsigned char cbuf[CBSIZE];
- unsigned int first;
- unsigned int count;
- int txbusy;
- unsigned char old_mcr;
- int ferr;
- int perr;
- int oflo;
- int msr;
- }
-ports[4] =
{
- {
- COM1ADDR, 4, 0, NULL, 0, 0, "", 0, 0, 0, 0, 0, 0, 0, 0
- }
- ,
- {
- COM2ADDR, 3, 0, NULL, 0, 0, "", 0, 0, 0, 0, 0, 0, 0, 0
- }
- ,
- {
- COM3ADDR, 4, 0, NULL, 0, 0, "", 0, 0, 0, 0, 0, 0, 0, 0
- }
- ,
- {
- COM4ADDR, 3, 0, NULL, 0, 0, "", 0, 0, 0, 0, 0, 0, 0, 0
- }
-};
+ int base;
+ int irq;
+ int refcnt;
+ struct intrupt *intrupt;
+ int fifo;
+ int baudrate;
+ unsigned char cbuf[CBSIZE];
+ unsigned int first;
+ unsigned int count;
+ int txbusy;
+ unsigned char old_mcr;
+ int ferr;
+ int perr;
+ int oflo;
+ int msr;
+} ports[4] = { { COM1ADDR, 4, 0, NULL, 0, 0, "", 0, 0, 0, 0, 0, 0, 0, 0 },
+ { COM2ADDR, 3, 0, NULL, 0, 0, "", 0, 0, 0, 0, 0, 0, 0, 0 },
+ { COM3ADDR, 4, 0, NULL, 0, 0, "", 0, 0, 0, 0, 0, 0, 0, 0 },
+ { COM4ADDR, 3, 0, NULL, 0, 0, "", 0, 0, 0, 0, 0, 0, 0, 0 } };
static int dos_open (struct serial *scb, const char *name);
static void dos_raw (struct serial *scb);
@@ -233,11 +212,10 @@ static serial_ttystate dos_get_tty_state (struct serial *scb);
static int dos_set_tty_state (struct serial *scb, serial_ttystate state);
static int dos_baudconv (int rate);
-#define inb(p,a) inportb((p)->base + (a))
-#define outb(p,a,v) outportb((p)->base + (a), (v))
-#define disable() asm volatile ("cli");
-#define enable() asm volatile ("sti");
-
+#define inb(p, a) inportb ((p)->base + (a))
+#define outb(p, a, v) outportb ((p)->base + (a), (v))
+#define disable() asm volatile ("cli");
+#define enable() asm volatile ("sti");
static int
dos_getc (volatile struct dos_ttystate *port)
@@ -255,7 +233,6 @@ dos_getc (volatile struct dos_ttystate *port)
return c;
}
-
static int
dos_putc (int c, struct dos_ttystate *port)
{
@@ -265,8 +242,6 @@ dos_putc (int c, struct dos_ttystate *port)
port->count++;
return 0;
}
-
-
static void
dos_comisr (int irq)
@@ -274,8 +249,8 @@ dos_comisr (int irq)
struct dos_ttystate *port;
unsigned char iir, lsr, c;
- disable (); /* Paranoia */
- outportb (ICU_OCW2, 0x20); /* End-Of-Interrupt */
+ disable (); /* Paranoia */
+ outportb (ICU_OCW2, 0x20); /* End-Of-Interrupt */
#ifdef DOS_STATS
++intrcnt;
#endif
@@ -284,7 +259,7 @@ dos_comisr (int irq)
if (!port)
{
COUNT (CNT_STRAY);
- return; /* not open */
+ return; /* not open */
}
while (1)
@@ -292,7 +267,6 @@ dos_comisr (int irq)
iir = inb (port, com_iir) & IIR_IMASK;
switch (iir)
{
-
case IIR_RLS:
lsr = inb (port, com_lsr);
goto rx;
@@ -349,20 +323,22 @@ dos_comisr (int irq)
}
#define ISRNAME(x) dos_comisr##x
-#define ISR(x) static void ISRNAME(x)(void) {dos_comisr(x);}
+#define ISR(x) \
+ static void ISRNAME (x) (void) \
+ { \
+ dos_comisr (x); \
+ }
+/* clang-format off */
ISR (0) ISR (1) ISR (2) ISR (3) /* OK */
ISR (4) ISR (5) ISR (6) ISR (7) /* OK */
+ /* clang-format on */
-typedef void (*isr_t) (void);
-
-static isr_t isrs[NINTR] =
- {
- ISRNAME (0), ISRNAME (1), ISRNAME (2), ISRNAME (3),
- ISRNAME (4), ISRNAME (5), ISRNAME (6), ISRNAME (7)
- };
-
+ typedef void (*isr_t) (void);
+static isr_t isrs[NINTR]
+ = { ISRNAME (0), ISRNAME (1), ISRNAME (2), ISRNAME (3),
+ ISRNAME (4), ISRNAME (5), ISRNAME (6), ISRNAME (7) };
static struct intrupt *
dos_hookirq (unsigned int irq)
@@ -419,7 +395,6 @@ dos_hookirq (unsigned int irq)
return intr;
}
-
static void
dos_unhookirq (struct intrupt *intr)
{
@@ -444,8 +419,6 @@ dos_unhookirq (struct intrupt *intr)
_go32_dpmi_free_iret_wrapper (&intr->new_pmhandler);
intr->inuse = 0;
}
-
-
static int
dos_open (struct serial *scb, const char *name)
@@ -490,7 +463,7 @@ dos_open (struct serial *scb, const char *name)
{
if ((inb (port, com_iir) & 0x38) == 0)
goto ok;
- (void) inb (port, com_data); /* clear recv */
+ (void) inb (port, com_data); /* clear recv */
}
errno = ENODEV;
return -1;
@@ -551,7 +524,6 @@ ok:
return 0;
}
-
static void
dos_close (struct serial *scb)
{
@@ -584,14 +556,11 @@ dos_close (struct serial *scb)
/* Check for overflow errors. */
if (port->oflo)
{
- gdb_printf (gdb_stderr,
- "Serial input overruns occurred.\n");
+ gdb_printf (gdb_stderr, "Serial input overruns occurred.\n");
gdb_printf (gdb_stderr, "This system %s handle %d baud.\n",
- port->fifo ? "cannot" : "needs a 16550 to",
- port->baudrate);
+ port->fifo ? "cannot" : "needs a 16550 to", port->baudrate);
}
}
-
/* Implementation of the serial_ops flush_output method. */
@@ -642,7 +611,6 @@ dos_readchar (struct serial *scb, int timeout)
return c;
}
-
static serial_ttystate
dos_get_tty_state (struct serial *scb)
{
@@ -717,7 +685,7 @@ dos_baudconv (int rate)
if (rate <= 0)
return -1;
-#define divrnd(n, q) (((n) * 2 / (q) + 1) / 2) /* Divide and round off. */
+#define divrnd(n, q) (((n) *2 / (q) + 1) / 2) /* Divide and round off. */
x = divrnd (COMTICK, rate);
if (x <= 0)
return -1;
@@ -731,7 +699,6 @@ dos_baudconv (int rate)
return x;
}
-
static int
dos_setbaudrate (struct serial *scb, int rate)
{
@@ -814,7 +781,7 @@ dos_write (struct serial *scb, const void *buf, size_t count)
str += cnt;
count -= cnt;
#else
- for ( ; cnt > 0; cnt--, count--)
+ for (; cnt > 0; cnt--, count--)
outportb (port->base + com_data, *str++);
#endif
#ifdef DOS_STATS
@@ -834,7 +801,6 @@ dos_write (struct serial *scb, const void *buf, size_t count)
return 0;
}
-
static int
dos_sendbreak (struct serial *scb)
{
@@ -854,13 +820,11 @@ dos_sendbreak (struct serial *scb)
return 0;
}
-
-static const struct serial_ops dos_ops =
-{
+static const struct serial_ops dos_ops = {
"hardwire",
dos_open,
dos_close,
- NULL, /* fdopen, not implemented */
+ NULL, /* fdopen, not implemented */
dos_readchar,
dos_write,
dos_flush_output,
@@ -875,7 +839,7 @@ static const struct serial_ops dos_ops =
dos_setstopbits,
dos_setparity,
dos_drain_output,
- (void (*)(struct serial *, int))NULL /* Change into async mode. */
+ (void (*) (struct serial *, int)) NULL /* Change into async mode. */
};
int
@@ -898,13 +862,13 @@ info_serial_command (const char *arg, int from_tty)
{
if (port->baudrate == 0)
continue;
- gdb_printf ("Port:\tCOM%ld (%sactive)\n", (long)(port - ports) + 1,
+ gdb_printf ("Port:\tCOM%ld (%sactive)\n", (long) (port - ports) + 1,
port->intrupt ? "" : "not ");
gdb_printf ("Addr:\t0x%03x (irq %d)\n", port->base, port->irq);
gdb_printf ("16550:\t%s\n", port->fifo ? "yes" : "no");
gdb_printf ("Speed:\t%d baud\n", port->baudrate);
- gdb_printf ("Errs:\tframing %d parity %d overflow %d\n\n",
- port->ferr, port->perr, port->oflo);
+ gdb_printf ("Errs:\tframing %d parity %d overflow %d\n\n", port->ferr,
+ port->perr, port->oflo);
}
#ifdef DOS_STATS
@@ -916,6 +880,7 @@ info_serial_command (const char *arg, int from_tty)
}
void _initialize_ser_dos ();
+
void
_initialize_ser_dos ()
{
@@ -925,66 +890,66 @@ _initialize_ser_dos ()
icu_oldmask = inportb (ICU_MASK);
/* Mark fixed motherboard irqs as inuse. */
- intrupts[0].inuse = /* timer tick */
- intrupts[1].inuse = /* keyboard */
- intrupts[2].inuse = 1; /* slave icu */
-
- add_setshow_zinteger_cmd ("com1base", class_obscure, &ports[0].base, _("\
-Set COM1 base i/o port address."), _("\
-Show COM1 base i/o port address."), NULL,
- NULL,
- NULL, /* FIXME: i18n: */
+ intrupts[0].inuse = /* timer tick */
+ intrupts[1].inuse = /* keyboard */
+ intrupts[2].inuse = 1; /* slave icu */
+
+ add_setshow_zinteger_cmd ("com1base", class_obscure, &ports[0].base, _ ("\
+Set COM1 base i/o port address."),
+ _ ("\
+Show COM1 base i/o port address."),
+ NULL, NULL, NULL, /* FIXME: i18n: */
&setlist, &showlist);
- add_setshow_zinteger_cmd ("com1irq", class_obscure, &ports[0].irq, _("\
-Set COM1 interrupt request."), _("\
-Show COM1 interrupt request."), NULL,
- NULL,
- NULL, /* FIXME: i18n: */
+ add_setshow_zinteger_cmd ("com1irq", class_obscure, &ports[0].irq, _ ("\
+Set COM1 interrupt request."),
+ _ ("\
+Show COM1 interrupt request."),
+ NULL, NULL, NULL, /* FIXME: i18n: */
&setlist, &showlist);
- add_setshow_zinteger_cmd ("com2base", class_obscure, &ports[1].base, _("\
-Set COM2 base i/o port address."), _("\
-Show COM2 base i/o port address."), NULL,
- NULL,
- NULL, /* FIXME: i18n: */
+ add_setshow_zinteger_cmd ("com2base", class_obscure, &ports[1].base, _ ("\
+Set COM2 base i/o port address."),
+ _ ("\
+Show COM2 base i/o port address."),
+ NULL, NULL, NULL, /* FIXME: i18n: */
&setlist, &showlist);
- add_setshow_zinteger_cmd ("com2irq", class_obscure, &ports[1].irq, _("\
-Set COM2 interrupt request."), _("\
-Show COM2 interrupt request."), NULL,
- NULL,
- NULL, /* FIXME: i18n: */
+ add_setshow_zinteger_cmd ("com2irq", class_obscure, &ports[1].irq, _ ("\
+Set COM2 interrupt request."),
+ _ ("\
+Show COM2 interrupt request."),
+ NULL, NULL, NULL, /* FIXME: i18n: */
&setlist, &showlist);
- add_setshow_zinteger_cmd ("com3base", class_obscure, &ports[2].base, _("\
-Set COM3 base i/o port address."), _("\
-Show COM3 base i/o port address."), NULL,
- NULL,
- NULL, /* FIXME: i18n: */
+ add_setshow_zinteger_cmd ("com3base", class_obscure, &ports[2].base, _ ("\
+Set COM3 base i/o port address."),
+ _ ("\
+Show COM3 base i/o port address."),
+ NULL, NULL, NULL, /* FIXME: i18n: */
&setlist, &showlist);
- add_setshow_zinteger_cmd ("com3irq", class_obscure, &ports[2].irq, _("\
-Set COM3 interrupt request."), _("\
-Show COM3 interrupt request."), NULL,
- NULL,
- NULL, /* FIXME: i18n: */
+ add_setshow_zinteger_cmd ("com3irq", class_obscure, &ports[2].irq, _ ("\
+Set COM3 interrupt request."),
+ _ ("\
+Show COM3 interrupt request."),
+ NULL, NULL, NULL, /* FIXME: i18n: */
&setlist, &showlist);
- add_setshow_zinteger_cmd ("com4base", class_obscure, &ports[3].base, _("\
-Set COM4 base i/o port address."), _("\
-Show COM4 base i/o port address."), NULL,
- NULL,
- NULL, /* FIXME: i18n: */
+ add_setshow_zinteger_cmd ("com4base", class_obscure, &ports[3].base, _ ("\
+Set COM4 base i/o port address."),
+ _ ("\
+Show COM4 base i/o port address."),
+ NULL, NULL, NULL, /* FIXME: i18n: */
&setlist, &showlist);
- add_setshow_zinteger_cmd ("com4irq", class_obscure, &ports[3].irq, _("\
-Set COM4 interrupt request."), _("\
-Show COM4 interrupt request."), NULL,
- NULL,
- NULL, /* FIXME: i18n: */
+ add_setshow_zinteger_cmd ("com4irq", class_obscure, &ports[3].irq, _ ("\
+Set COM4 interrupt request."),
+ _ ("\
+Show COM4 interrupt request."),
+ NULL, NULL, NULL, /* FIXME: i18n: */
&setlist, &showlist);
add_info ("serial", info_serial_command,
- _("Print DOS serial port status."));
+ _ ("Print DOS serial port status."));
}
diff --git a/gdb/ser-mingw.c b/gdb/ser-mingw.c
index 7de55f6d7ac..95b58482c3e 100644
--- a/gdb/ser-mingw.c
+++ b/gdb/ser-mingw.c
@@ -55,8 +55,8 @@ ser_windows_open (struct serial *scb, const char *name)
struct ser_windows_state *state;
COMMTIMEOUTS timeouts;
- h = CreateFile (name, GENERIC_READ | GENERIC_WRITE, 0, NULL,
- OPEN_EXISTING, FILE_FLAG_OVERLAPPED, NULL);
+ h = CreateFile (name, GENERIC_READ | GENERIC_WRITE, 0, NULL, OPEN_EXISTING,
+ FILE_FLAG_OVERLAPPED, NULL);
if (h == INVALID_HANDLE_VALUE)
{
errno = ENOENT;
@@ -163,7 +163,7 @@ ser_windows_raw (struct serial *scb)
state.ByteSize = 8;
if (SetCommState (h, &state) == 0)
- warning (_("SetCommState failed"));
+ warning (_ ("SetCommState failed"));
}
static int
@@ -289,10 +289,10 @@ ser_windows_wait_handle (struct serial *scb, HANDLE *read, HANDLE *except)
cleared, and we get a duplicated event, if the last batch
of characters included at least two arriving close together. */
if (!SetCommMask (h, 0))
- warning (_("ser_windows_wait_handle: reseting mask failed"));
+ warning (_ ("ser_windows_wait_handle: reseting mask failed"));
if (!SetCommMask (h, EV_RXCHAR))
- warning (_("ser_windows_wait_handle: reseting mask failed (2)"));
+ warning (_ ("ser_windows_wait_handle: reseting mask failed (2)"));
/* There's a potential race condition here; we must check cbInQue
and not wait if that's nonzero. */
@@ -384,7 +384,8 @@ ser_windows_write_prim (struct serial *scb, const void *buf, size_t len)
wait_handle_done functions, which return the threads to the stopped
state. */
-enum select_thread_state {
+enum select_thread_state
+{
STS_STARTED,
STS_STOPPED
};
@@ -436,24 +437,23 @@ select_thread_wait (struct ser_console_state *state)
the started state, or that we exit this thread. */
wait_events[0] = state->start_select;
wait_events[1] = state->exit_select;
- if (WaitForMultipleObjects (2, wait_events, FALSE, INFINITE)
+ if (WaitForMultipleObjects (2, wait_events, FALSE, INFINITE)
!= WAIT_OBJECT_0)
/* Either the EXIT_SELECT event was signaled (requesting that the
thread exit) or an error has occurred. In either case, we exit
the thread. */
ExitThread (0);
-
+
/* We are now in the started state. */
SetEvent (state->have_started);
}
-typedef DWORD WINAPI (*thread_fn_type)(void *);
+typedef DWORD WINAPI (*thread_fn_type) (void *);
/* Create a new select thread for SCB executing THREAD_FN. The STATE
will be filled in by this function before return. */
static void
-create_select_thread (thread_fn_type thread_fn,
- struct serial *scb,
+create_select_thread (thread_fn_type thread_fn, struct serial *scb,
struct ser_console_state *state)
{
DWORD threadId;
@@ -548,8 +548,8 @@ console_select_thread (void *arg)
wait_events[0] = state->stop_select;
wait_events[1] = h;
- event_index = WaitForMultipleObjects (2, wait_events,
- FALSE, INFINITE);
+ event_index
+ = WaitForMultipleObjects (2, wait_events, FALSE, INFINITE);
if (event_index == WAIT_OBJECT_0
|| WaitForSingleObject (state->stop_select, 0) == WAIT_OBJECT_0)
@@ -583,16 +583,11 @@ console_select_thread (void *arg)
control key alone. */
if (record.Event.KeyEvent.uChar.AsciiChar != 0
- || keycode == VK_PRIOR
- || keycode == VK_NEXT
- || keycode == VK_END
- || keycode == VK_HOME
- || keycode == VK_LEFT
- || keycode == VK_UP
- || keycode == VK_RIGHT
- || keycode == VK_DOWN
- || keycode == VK_INSERT
- || keycode == VK_DELETE)
+ || keycode == VK_PRIOR || keycode == VK_NEXT
+ || keycode == VK_END || keycode == VK_HOME
+ || keycode == VK_LEFT || keycode == VK_UP
+ || keycode == VK_RIGHT || keycode == VK_DOWN
+ || keycode == VK_INSERT || keycode == VK_DELETE)
{
/* This is really a keypress. */
SetEvent (state->read_event);
@@ -609,7 +604,7 @@ console_select_thread (void *arg)
ReadConsoleInput (h, &record, 1, &n_records);
}
- SetEvent(state->have_stopped);
+ SetEvent (state->have_stopped);
}
return 0;
}
@@ -851,10 +846,7 @@ free_pipe_state (struct pipe_state *ps)
struct pipe_state_destroyer
{
- void operator() (pipe_state *ps) const
- {
- free_pipe_state (ps);
- }
+ void operator() (pipe_state *ps) const { free_pipe_state (ps); }
};
typedef std::unique_ptr<pipe_state, pipe_state_destroyer> pipe_state_up;
@@ -865,7 +857,7 @@ pipe_windows_open (struct serial *scb, const char *name)
FILE *pex_stderr;
if (name == NULL)
- error_no_arg (_("child command"));
+ error_no_arg (_ ("child command"));
if (*name == '|')
{
@@ -875,25 +867,24 @@ pipe_windows_open (struct serial *scb, const char *name)
gdb_argv argv (name);
- if (! argv[0] || argv[0][0] == '\0')
- error (_("missing child command"));
+ if (!argv[0] || argv[0][0] == '\0')
+ error (_ ("missing child command"));
pipe_state_up ps (make_pipe_state ());
ps->pex = pex_init (PEX_USE_PIPES, "target remote pipe", NULL);
- if (! ps->pex)
+ if (!ps->pex)
return -1;
ps->input = pex_input_pipe (ps->pex, 1);
- if (! ps->input)
+ if (!ps->input)
return -1;
{
int err;
- const char *err_msg
- = pex_run (ps->pex, PEX_SEARCH | PEX_BINARY_INPUT | PEX_BINARY_OUTPUT
- | PEX_STDERR_TO_PIPE,
- argv[0], argv.get (), NULL, NULL,
- &err);
+ const char *err_msg = pex_run (ps->pex,
+ PEX_SEARCH | PEX_BINARY_INPUT
+ | PEX_BINARY_OUTPUT | PEX_STDERR_TO_PIPE,
+ argv[0], argv.get (), NULL, NULL, &err);
if (err_msg)
{
@@ -902,21 +893,20 @@ pipe_windows_open (struct serial *scb, const char *name)
all the same information here, plus err_msg provided by
pex_run, so we just raise the error here. */
if (err)
- error (_("error starting child process '%s': %s: %s"),
- name, err_msg, safe_strerror (err));
+ error (_ ("error starting child process '%s': %s: %s"), name,
+ err_msg, safe_strerror (err));
else
- error (_("error starting child process '%s': %s"),
- name, err_msg);
+ error (_ ("error starting child process '%s': %s"), name, err_msg);
}
}
ps->output = pex_read_output (ps->pex, 1);
- if (! ps->output)
+ if (!ps->output)
return -1;
scb->fd = fileno (ps->output);
pex_stderr = pex_read_err (ps->pex, 1);
- if (! pex_stderr)
+ if (!pex_stderr)
return -1;
scb->error_fd = fileno (pex_stderr);
@@ -933,11 +923,11 @@ pipe_windows_fdopen (struct serial *scb, int fd)
ps = make_pipe_state ();
ps->input = fdopen (fd, "r+");
- if (! ps->input)
+ if (!ps->input)
goto fail;
ps->output = fdopen (fd, "r+");
- if (! ps->output)
+ if (!ps->output)
goto fail;
scb->fd = fd;
@@ -945,7 +935,7 @@ pipe_windows_fdopen (struct serial *scb, int fd)
return 0;
- fail:
+fail:
free_pipe_state (ps);
return -1;
}
@@ -962,7 +952,6 @@ pipe_windows_close (struct serial *scb)
free_pipe_state (ps);
}
-
static int
pipe_windows_read (struct serial *scb, size_t count)
{
@@ -973,19 +962,18 @@ pipe_windows_read (struct serial *scb, size_t count)
if (pipeline_out == INVALID_HANDLE_VALUE)
return -1;
- if (! PeekNamedPipe (pipeline_out, NULL, 0, NULL, &available, NULL))
+ if (!PeekNamedPipe (pipeline_out, NULL, 0, NULL, &available, NULL))
return -1;
if (count > available)
count = available;
- if (! ReadFile (pipeline_out, scb->buf, count, &bytes_read, NULL))
+ if (!ReadFile (pipeline_out, scb->buf, count, &bytes_read, NULL))
return -1;
return bytes_read;
}
-
static int
pipe_windows_write (struct serial *scb, const void *buf, size_t count)
{
@@ -1001,13 +989,12 @@ pipe_windows_write (struct serial *scb, const void *buf, size_t count)
if (pipeline_in == INVALID_HANDLE_VALUE)
return -1;
- if (! WriteFile (pipeline_in, buf, count, &written, NULL))
+ if (!WriteFile (pipeline_in, buf, count, &written, NULL))
return -1;
return written;
}
-
static void
pipe_wait_handle (struct serial *scb, HANDLE *read, HANDLE *except)
{
@@ -1064,7 +1051,7 @@ gdb_pipe (int pdes[2])
struct net_windows_state
{
struct ser_console_state base;
-
+
HANDLE sock_event;
};
@@ -1116,10 +1103,12 @@ net_windows_select_thread (void *arg)
/* Wait for something to happen on the socket. */
while (1)
{
- event_index = WaitForMultipleObjects (2, wait_events, FALSE, INFINITE);
+ event_index
+ = WaitForMultipleObjects (2, wait_events, FALSE, INFINITE);
if (event_index == WAIT_OBJECT_0
- || WaitForSingleObject (state->base.stop_select, 0) == WAIT_OBJECT_0)
+ || WaitForSingleObject (state->base.stop_select, 0)
+ == WAIT_OBJECT_0)
{
/* We have been requested to stop. */
break;
@@ -1213,7 +1202,6 @@ net_windows_open (struct serial *scb, const char *name)
return 0;
}
-
static void
net_windows_close (struct serial *scb)
{
@@ -1229,127 +1217,102 @@ net_windows_close (struct serial *scb)
/* The serial port driver. */
-static const struct serial_ops hardwire_ops =
-{
- "hardwire",
- ser_windows_open,
- ser_windows_close,
- NULL,
- ser_base_readchar,
- ser_base_write,
- ser_windows_flush_output,
- ser_windows_flush_input,
- ser_windows_send_break,
- ser_windows_raw,
- /* These are only used for stdin; we do not need them for serial
+static const struct serial_ops hardwire_ops
+ = { "hardwire", ser_windows_open, ser_windows_close, NULL, ser_base_readchar,
+ ser_base_write, ser_windows_flush_output, ser_windows_flush_input,
+ ser_windows_send_break, ser_windows_raw,
+ /* These are only used for stdin; we do not need them for serial
ports, so supply the standard dummies. */
- ser_base_get_tty_state,
- ser_base_copy_tty_state,
- ser_base_set_tty_state,
- ser_base_print_tty_state,
- ser_windows_setbaudrate,
- ser_windows_setstopbits,
- ser_windows_setparity,
- ser_windows_drain_output,
- ser_base_async,
- ser_windows_read_prim,
- ser_windows_write_prim,
- NULL,
- ser_windows_wait_handle
-};
+ ser_base_get_tty_state, ser_base_copy_tty_state, ser_base_set_tty_state,
+ ser_base_print_tty_state, ser_windows_setbaudrate,
+ ser_windows_setstopbits, ser_windows_setparity, ser_windows_drain_output,
+ ser_base_async, ser_windows_read_prim, ser_windows_write_prim, NULL,
+ ser_windows_wait_handle };
/* The dummy serial driver used for terminals. We only provide the
TTY-related methods. */
-static const struct serial_ops tty_ops =
-{
- "terminal",
- NULL,
- ser_console_close,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- ser_console_get_tty_state,
- ser_base_copy_tty_state,
- ser_base_set_tty_state,
- ser_base_print_tty_state,
- NULL,
- NULL,
- NULL,
- ser_base_drain_output,
- NULL,
- NULL,
- NULL,
- NULL,
- ser_console_wait_handle,
- ser_console_done_wait_handle
-};
+static const struct serial_ops tty_ops = { "terminal",
+ NULL,
+ ser_console_close,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ ser_console_get_tty_state,
+ ser_base_copy_tty_state,
+ ser_base_set_tty_state,
+ ser_base_print_tty_state,
+ NULL,
+ NULL,
+ NULL,
+ ser_base_drain_output,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ ser_console_wait_handle,
+ ser_console_done_wait_handle };
/* The pipe interface. */
-static const struct serial_ops pipe_ops =
-{
- "pipe",
- pipe_windows_open,
- pipe_windows_close,
- pipe_windows_fdopen,
- ser_base_readchar,
- ser_base_write,
- ser_base_flush_output,
- ser_base_flush_input,
- ser_base_send_break,
- ser_base_raw,
- ser_base_get_tty_state,
- ser_base_copy_tty_state,
- ser_base_set_tty_state,
- ser_base_print_tty_state,
- ser_base_setbaudrate,
- ser_base_setstopbits,
- ser_base_setparity,
- ser_base_drain_output,
- ser_base_async,
- pipe_windows_read,
- pipe_windows_write,
- pipe_avail,
- pipe_wait_handle,
- pipe_done_wait_handle
-};
+static const struct serial_ops pipe_ops = { "pipe",
+ pipe_windows_open,
+ pipe_windows_close,
+ pipe_windows_fdopen,
+ ser_base_readchar,
+ ser_base_write,
+ ser_base_flush_output,
+ ser_base_flush_input,
+ ser_base_send_break,
+ ser_base_raw,
+ ser_base_get_tty_state,
+ ser_base_copy_tty_state,
+ ser_base_set_tty_state,
+ ser_base_print_tty_state,
+ ser_base_setbaudrate,
+ ser_base_setstopbits,
+ ser_base_setparity,
+ ser_base_drain_output,
+ ser_base_async,
+ pipe_windows_read,
+ pipe_windows_write,
+ pipe_avail,
+ pipe_wait_handle,
+ pipe_done_wait_handle };
/* The TCP/UDP socket driver. */
-static const struct serial_ops tcp_ops =
-{
- "tcp",
- net_windows_open,
- net_windows_close,
- NULL,
- ser_base_readchar,
- ser_base_write,
- ser_base_flush_output,
- ser_base_flush_input,
- ser_tcp_send_break,
- ser_base_raw,
- ser_base_get_tty_state,
- ser_base_copy_tty_state,
- ser_base_set_tty_state,
- ser_base_print_tty_state,
- ser_base_setbaudrate,
- ser_base_setstopbits,
- ser_base_setparity,
- ser_base_drain_output,
- ser_base_async,
- net_read_prim,
- net_write_prim,
- NULL,
- net_windows_wait_handle,
- net_windows_done_wait_handle
-};
+static const struct serial_ops tcp_ops = { "tcp",
+ net_windows_open,
+ net_windows_close,
+ NULL,
+ ser_base_readchar,
+ ser_base_write,
+ ser_base_flush_output,
+ ser_base_flush_input,
+ ser_tcp_send_break,
+ ser_base_raw,
+ ser_base_get_tty_state,
+ ser_base_copy_tty_state,
+ ser_base_set_tty_state,
+ ser_base_print_tty_state,
+ ser_base_setbaudrate,
+ ser_base_setstopbits,
+ ser_base_setparity,
+ ser_base_drain_output,
+ ser_base_async,
+ net_read_prim,
+ net_write_prim,
+ NULL,
+ net_windows_wait_handle,
+ net_windows_done_wait_handle };
void _initialize_ser_windows ();
+
void
_initialize_ser_windows ()
{
diff --git a/gdb/ser-pipe.c b/gdb/ser-pipe.c
index 47ccd33cece..9d129ae22a4 100644
--- a/gdb/ser-pipe.c
+++ b/gdb/ser-pipe.c
@@ -38,9 +38,9 @@ static int pipe_open (struct serial *scb, const char *name);
static void pipe_close (struct serial *scb);
struct pipe_state
- {
- int pid;
- };
+{
+ int pid;
+};
/* Open up a raw pipe. */
@@ -82,7 +82,7 @@ pipe_open (struct serial *scb, const char *name)
fork() due to the fact that autoconf will ``#define vfork fork''
on certain platforms. */
pid = vfork ();
-
+
/* Error. */
if (pid == -1)
{
@@ -175,8 +175,8 @@ pipe_close (struct serial *scb)
wait_result = -1;
#ifdef HAVE_WAITPID
- wait_result = wait_to_die_with_timeout (state->pid, &status,
- PIPE_CLOSE_TIMEOUT);
+ wait_result
+ = wait_to_die_with_timeout (state->pid, &status, PIPE_CLOSE_TIMEOUT);
#endif
if (wait_result == -1)
{
@@ -212,32 +212,30 @@ gdb_pipe (int pdes[2])
#endif
}
-static const struct serial_ops pipe_ops =
-{
- "pipe",
- pipe_open,
- pipe_close,
- NULL,
- ser_base_readchar,
- ser_base_write,
- ser_base_flush_output,
- ser_base_flush_input,
- ser_base_send_break,
- ser_base_raw,
- ser_base_get_tty_state,
- ser_base_copy_tty_state,
- ser_base_set_tty_state,
- ser_base_print_tty_state,
- ser_base_setbaudrate,
- ser_base_setstopbits,
- ser_base_setparity,
- ser_base_drain_output,
- ser_base_async,
- ser_unix_read_prim,
- ser_unix_write_prim
-};
+static const struct serial_ops pipe_ops = { "pipe",
+ pipe_open,
+ pipe_close,
+ NULL,
+ ser_base_readchar,
+ ser_base_write,
+ ser_base_flush_output,
+ ser_base_flush_input,
+ ser_base_send_break,
+ ser_base_raw,
+ ser_base_get_tty_state,
+ ser_base_copy_tty_state,
+ ser_base_set_tty_state,
+ ser_base_print_tty_state,
+ ser_base_setbaudrate,
+ ser_base_setstopbits,
+ ser_base_setparity,
+ ser_base_drain_output,
+ ser_base_async,
+ ser_unix_read_prim,
+ ser_unix_write_prim };
void _initialize_ser_pipe ();
+
void
_initialize_ser_pipe ()
{
diff --git a/gdb/ser-tcp.c b/gdb/ser-tcp.c
index 6083bd61e62..484f0f3cfa2 100644
--- a/gdb/ser-tcp.c
+++ b/gdb/ser-tcp.c
@@ -30,10 +30,10 @@
#include <sys/types.h>
#ifdef HAVE_SYS_FILIO_H
-#include <sys/filio.h> /* For FIONBIO. */
+#include <sys/filio.h> /* For FIONBIO. */
#endif
#ifdef HAVE_SYS_IOCTL_H
-#include <sys/ioctl.h> /* For FIONBIO. */
+#include <sys/ioctl.h> /* For FIONBIO. */
#endif
#include "gdbsupport/gdb_sys_time.h"
@@ -169,7 +169,7 @@ try_connect (const struct addrinfo *ainfo, unsigned int *polls)
if (sock < 0)
return -1;
- /* Set socket nonblocking. */
+ /* Set socket nonblocking. */
#ifdef USE_WIN32API
u_long ioarg = 1;
#else
@@ -183,7 +183,7 @@ try_connect (const struct addrinfo *ainfo, unsigned int *polls)
if (connect (sock, ainfo->ai_addr, ainfo->ai_addrlen) < 0)
{
#ifdef USE_WIN32API
- int err = WSAGetLastError();
+ int err = WSAGetLastError ();
#else
int err = errno;
#endif
@@ -192,11 +192,11 @@ try_connect (const struct addrinfo *ainfo, unsigned int *polls)
-1. The caller will know what to do. */
if (
#ifdef USE_WIN32API
- err == WSAECONNREFUSED
+ err == WSAECONNREFUSED
#else
- err == ECONNREFUSED
+ err == ECONNREFUSED
#endif
- )
+ )
{
close (sock);
errno = err;
@@ -204,18 +204,18 @@ try_connect (const struct addrinfo *ainfo, unsigned int *polls)
}
if (
- /* Any other error (except EINPROGRESS) will be "swallowed"
+ /* Any other error (except EINPROGRESS) will be "swallowed"
here. We return without specifying a return value, and
set errno if the caller wants to inspect what
happened. */
#ifdef USE_WIN32API
- /* Under Windows, calling "connect" with a non-blocking socket
+ /* Under Windows, calling "connect" with a non-blocking socket
results in WSAEWOULDBLOCK, not WSAEINPROGRESS. */
- err != WSAEWOULDBLOCK
+ err != WSAEWOULDBLOCK
#else
- err != EINPROGRESS
+ err != EINPROGRESS
#endif
- )
+ )
{
close (sock);
errno = err;
@@ -288,16 +288,15 @@ net_open (struct serial *scb, const char *name)
parsed_connection_spec parsed = parse_connection_spec (name, &hint);
if (parsed.port_str.empty ())
- error (_("Missing port on hostname '%s'"), name);
+ error (_ ("Missing port on hostname '%s'"), name);
- int r = getaddrinfo (parsed.host_str.c_str (),
- parsed.port_str.c_str (),
+ int r = getaddrinfo (parsed.host_str.c_str (), parsed.port_str.c_str (),
&hint, &ainfo);
if (r != 0)
{
- gdb_printf (gdb_stderr, _("%s: cannot resolve name: %s\n"),
- name, gai_strerror (r));
+ gdb_printf (gdb_stderr, _ ("%s: cannot resolve name: %s\n"), name,
+ gai_strerror (r));
errno = ENOENT;
return -1;
}
@@ -336,11 +335,11 @@ net_open (struct serial *scb, const char *name)
}
else if (
#ifdef USE_WIN32API
- errno == WSAECONNREFUSED
+ errno == WSAECONNREFUSED
#else
- errno == ECONNREFUSED
+ errno == ECONNREFUSED
#endif
- )
+ )
got_connrefused = true;
}
}
@@ -350,9 +349,7 @@ net_open (struct serial *scb, const char *name)
- We haven't gotten a connection yet, and
- Any of our connection attempts returned with ECONNREFUSED, and
- wait_for_connect signals that we can keep going. */
- while (tcp_auto_retry
- && success_ainfo == NULL
- && got_connrefused
+ while (tcp_auto_retry && success_ainfo == NULL && got_connrefused
&& wait_for_connect (-1, &polls) >= 0);
if (success_ainfo == NULL)
@@ -361,7 +358,7 @@ net_open (struct serial *scb, const char *name)
return -1;
}
- /* Turn off nonblocking. */
+ /* Turn off nonblocking. */
#ifdef USE_WIN32API
u_long ioarg = 0;
#else
@@ -375,8 +372,8 @@ net_open (struct serial *scb, const char *name)
/* Disable Nagle algorithm. Needed in some cases. */
int tmp = 1;
- setsockopt (scb->fd, IPPROTO_TCP, TCP_NODELAY,
- (char *) &tmp, sizeof (tmp));
+ setsockopt (scb->fd, IPPROTO_TCP, TCP_NODELAY, (char *) &tmp,
+ sizeof (tmp));
}
#ifdef SIGPIPE
@@ -428,34 +425,32 @@ ser_tcp_send_break (struct serial *scb)
/* The TCP ops. */
-static const struct serial_ops tcp_ops =
-{
- "tcp",
- net_open,
- net_close,
- NULL,
- ser_base_readchar,
- ser_base_write,
- ser_base_flush_output,
- ser_base_flush_input,
- ser_tcp_send_break,
- ser_base_raw,
- ser_base_get_tty_state,
- ser_base_copy_tty_state,
- ser_base_set_tty_state,
- ser_base_print_tty_state,
- ser_base_setbaudrate,
- ser_base_setstopbits,
- ser_base_setparity,
- ser_base_drain_output,
- ser_base_async,
- net_read_prim,
- net_write_prim
-};
+static const struct serial_ops tcp_ops = { "tcp",
+ net_open,
+ net_close,
+ NULL,
+ ser_base_readchar,
+ ser_base_write,
+ ser_base_flush_output,
+ ser_base_flush_input,
+ ser_tcp_send_break,
+ ser_base_raw,
+ ser_base_get_tty_state,
+ ser_base_copy_tty_state,
+ ser_base_set_tty_state,
+ ser_base_print_tty_state,
+ ser_base_setbaudrate,
+ ser_base_setstopbits,
+ ser_base_setparity,
+ ser_base_drain_output,
+ ser_base_async,
+ net_read_prim,
+ net_write_prim };
#endif /* USE_WIN32API */
void _initialize_ser_tcp ();
+
void
_initialize_ser_tcp ()
{
@@ -466,30 +461,30 @@ _initialize_ser_tcp ()
serial_add_interface (&tcp_ops);
#endif /* USE_WIN32API */
- add_setshow_prefix_cmd ("tcp", class_maintenance,
- _("\
+ add_setshow_prefix_cmd ("tcp", class_maintenance, _ ("\
TCP protocol specific variables.\n\
Configure variables specific to remote TCP connections."),
- _("\
+ _ ("\
TCP protocol specific variables.\n\
Configure variables specific to remote TCP connections."),
- &tcp_set_cmdlist, &tcp_show_cmdlist,
- &setlist, &showlist);
+ &tcp_set_cmdlist, &tcp_show_cmdlist, &setlist,
+ &showlist);
- add_setshow_boolean_cmd ("auto-retry", class_obscure,
- &tcp_auto_retry, _("\
-Set auto-retry on socket connect."), _("\
+ add_setshow_boolean_cmd ("auto-retry", class_obscure, &tcp_auto_retry, _ ("\
+Set auto-retry on socket connect."),
+ _ ("\
Show auto-retry on socket connect."),
- NULL, NULL, NULL,
- &tcp_set_cmdlist, &tcp_show_cmdlist);
-
- add_setshow_uinteger_cmd ("connect-timeout", class_obscure,
- &tcp_retry_limit, _("\
-Set timeout limit in seconds for socket connection."), _("\
-Show timeout limit in seconds for socket connection."), _("\
+ NULL, NULL, NULL, &tcp_set_cmdlist,
+ &tcp_show_cmdlist);
+
+ add_setshow_uinteger_cmd ("connect-timeout", class_obscure, &tcp_retry_limit,
+ _ ("\
+Set timeout limit in seconds for socket connection."),
+ _ ("\
+Show timeout limit in seconds for socket connection."),
+ _ ("\
If set to \"unlimited\", GDB will keep attempting to establish a\n\
connection forever, unless interrupted with Ctrl-c.\n\
The default is 15 seconds."),
- NULL, NULL,
- &tcp_set_cmdlist, &tcp_show_cmdlist);
+ NULL, NULL, &tcp_set_cmdlist, &tcp_show_cmdlist);
}
diff --git a/gdb/ser-uds.c b/gdb/ser-uds.c
index 665aab912da..d179481cc12 100644
--- a/gdb/ser-uds.c
+++ b/gdb/ser-uds.c
@@ -25,7 +25,7 @@
#include <sys/un.h>
#ifndef UNIX_PATH_MAX
-#define UNIX_PATH_MAX sizeof(((struct sockaddr_un *) NULL)->sun_path)
+#define UNIX_PATH_MAX sizeof (((struct sockaddr_un *) NULL)->sun_path)
#endif
/* Open an AF_UNIX socket. */
@@ -37,9 +37,9 @@ uds_open (struct serial *scb, const char *name)
if (strlen (name) > UNIX_PATH_MAX - 1)
{
- warning
- (_("The socket name is too long. It may be no longer than %s bytes."),
- pulongest (UNIX_PATH_MAX - 1L));
+ warning (
+ _ ("The socket name is too long. It may be no longer than %s bytes."),
+ pulongest (UNIX_PATH_MAX - 1L));
return -1;
}
@@ -49,8 +49,8 @@ uds_open (struct serial *scb, const char *name)
int sock = socket (AF_UNIX, SOCK_STREAM, 0);
- if (connect (sock, (struct sockaddr *) &addr,
- sizeof (struct sockaddr_un)) < 0)
+ if (connect (sock, (struct sockaddr *) &addr, sizeof (struct sockaddr_un))
+ < 0)
{
close (sock);
scb->fd = -1;
@@ -86,32 +86,30 @@ uds_write_prim (struct serial *scb, const void *buf, size_t count)
/* The local socket ops. */
-static const struct serial_ops uds_ops =
-{
- "local",
- uds_open,
- uds_close,
- NULL,
- ser_base_readchar,
- ser_base_write,
- ser_base_flush_output,
- ser_base_flush_input,
- ser_base_send_break,
- ser_base_raw,
- ser_base_get_tty_state,
- ser_base_copy_tty_state,
- ser_base_set_tty_state,
- ser_base_print_tty_state,
- ser_base_setbaudrate,
- ser_base_setstopbits,
- ser_base_setparity,
- ser_base_drain_output,
- ser_base_async,
- uds_read_prim,
- uds_write_prim
-};
+static const struct serial_ops uds_ops = { "local",
+ uds_open,
+ uds_close,
+ NULL,
+ ser_base_readchar,
+ ser_base_write,
+ ser_base_flush_output,
+ ser_base_flush_input,
+ ser_base_send_break,
+ ser_base_raw,
+ ser_base_get_tty_state,
+ ser_base_copy_tty_state,
+ ser_base_set_tty_state,
+ ser_base_print_tty_state,
+ ser_base_setbaudrate,
+ ser_base_setstopbits,
+ ser_base_setparity,
+ ser_base_drain_output,
+ ser_base_async,
+ uds_read_prim,
+ uds_write_prim };
void _initialize_ser_socket ();
+
void
_initialize_ser_socket ()
{
diff --git a/gdb/ser-unix.c b/gdb/ser-unix.c
index ede2a58308a..b469fb29707 100644
--- a/gdb/ser-unix.c
+++ b/gdb/ser-unix.c
@@ -35,18 +35,19 @@
#include "gdbsupport/scoped_ignore_sigttou.h"
struct hardwire_ttystate
- {
- struct termios termios;
- };
+{
+ struct termios termios;
+};
#ifdef CRTSCTS
/* Boolean to explicitly enable or disable h/w flow control. */
static bool serial_hwflow;
+
static void
show_serial_hwflow (struct ui_file *file, int from_tty,
struct cmd_list_element *c, const char *value)
{
- gdb_printf (file, _("Hardware flow control is %s.\n"), value);
+ gdb_printf (file, _ ("Hardware flow control is %s.\n"), value);
}
#endif
@@ -56,10 +57,8 @@ static int rate_to_code (int rate);
static int hardwire_setbaudrate (struct serial *scb, int rate);
static int hardwire_setparity (struct serial *scb, int parity);
static void hardwire_close (struct serial *scb);
-static int get_tty_state (struct serial *scb,
- struct hardwire_ttystate * state);
-static int set_tty_state (struct serial *scb,
- struct hardwire_ttystate * state);
+static int get_tty_state (struct serial *scb, struct hardwire_ttystate *state);
+static int set_tty_state (struct serial *scb, struct hardwire_ttystate *state);
static serial_ttystate hardwire_get_tty_state (struct serial *scb);
static int hardwire_set_tty_state (struct serial *scb, serial_ttystate state);
static void hardwire_print_tty_state (struct serial *, serial_ttystate,
@@ -135,19 +134,16 @@ hardwire_set_tty_state (struct serial *scb, serial_ttystate ttystate)
}
static void
-hardwire_print_tty_state (struct serial *scb,
- serial_ttystate ttystate,
+hardwire_print_tty_state (struct serial *scb, serial_ttystate ttystate,
struct ui_file *stream)
{
struct hardwire_ttystate *state = (struct hardwire_ttystate *) ttystate;
int i;
gdb_printf (stream, "c_iflag = 0x%x, c_oflag = 0x%x,\n",
- (int) state->termios.c_iflag,
- (int) state->termios.c_oflag);
+ (int) state->termios.c_iflag, (int) state->termios.c_oflag);
gdb_printf (stream, "c_cflag = 0x%x, c_lflag = 0x%x\n",
- (int) state->termios.c_cflag,
- (int) state->termios.c_lflag);
+ (int) state->termios.c_cflag, (int) state->termios.c_lflag);
#if 0
/* This not in POSIX, and is not really documented by those systems
which have it (at least not Sun). */
@@ -241,97 +237,24 @@ static struct
{
int rate;
int code;
-}
-baudtab[] =
-{
- {
- 50, B50
- }
- ,
- {
- 75, B75
- }
- ,
- {
- 110, B110
- }
- ,
- {
- 134, B134
- }
- ,
- {
- 150, B150
- }
- ,
- {
- 200, B200
- }
- ,
- {
- 300, B300
- }
- ,
- {
- 600, B600
- }
- ,
- {
- 1200, B1200
- }
- ,
- {
- 1800, B1800
- }
- ,
- {
- 2400, B2400
- }
- ,
- {
- 4800, B4800
- }
- ,
- {
- 9600, B9600
- }
- ,
- {
- 19200, B19200
- }
- ,
- {
- 38400, B38400
- }
- ,
+} baudtab[] = {
+ { 50, B50 }, { 75, B75 }, { 110, B110 }, { 134, B134 },
+ { 150, B150 }, { 200, B200 }, { 300, B300 }, { 600, B600 },
+ { 1200, B1200 }, { 1800, B1800 }, { 2400, B2400 }, { 4800, B4800 },
+ { 9600, B9600 }, { 19200, B19200 }, { 38400, B38400 },
#ifdef B57600
- {
- 57600, B57600
- }
- ,
+ { 57600, B57600 },
#endif
#ifdef B115200
- {
- 115200, B115200
- }
- ,
+ { 115200, B115200 },
#endif
#ifdef B230400
- {
- 230400, B230400
- }
- ,
+ { 230400, B230400 },
#endif
#ifdef B460800
- {
- 460800, B460800
- }
- ,
+ { 460800, B460800 },
#endif
- {
- -1, -1
- }
- ,
+ { -1, -1 },
};
static int
@@ -351,23 +274,23 @@ rate_to_code (int rate)
{
if (i)
{
- warning (_("Invalid baud rate %d. "
- "Closest values are %d and %d."),
+ warning (_ ("Invalid baud rate %d. "
+ "Closest values are %d and %d."),
rate, baudtab[i - 1].rate, baudtab[i].rate);
}
else
{
- warning (_("Invalid baud rate %d. Minimum value is %d."),
+ warning (_ ("Invalid baud rate %d. Minimum value is %d."),
rate, baudtab[0].rate);
}
return -1;
}
}
}
-
+
/* The requested speed was too large. */
- warning (_("Invalid baud rate %d. Maximum value is %d."),
- rate, baudtab[i - 1].rate);
+ warning (_ ("Invalid baud rate %d. Maximum value is %d."), rate,
+ baudtab[i - 1].rate);
return -1;
}
@@ -376,7 +299,7 @@ hardwire_setbaudrate (struct serial *scb, int rate)
{
struct hardwire_ttystate state;
int baud_code = rate_to_code (rate);
-
+
if (baud_code < 0)
{
/* The baud rate was not valid.
@@ -419,7 +342,7 @@ hardwire_setstopbits (struct serial *scb, int num)
if (!newbit)
state.termios.c_cflag &= ~CSTOPB;
else
- state.termios.c_cflag |= CSTOPB; /* two bits */
+ state.termios.c_cflag |= CSTOPB; /* two bits */
return set_tty_state (scb, &state);
}
@@ -457,7 +380,6 @@ hardwire_setparity (struct serial *scb, int parity)
return set_tty_state (scb, &state);
}
-
static void
hardwire_close (struct serial *scb)
{
@@ -467,52 +389,47 @@ hardwire_close (struct serial *scb)
close (scb->fd);
scb->fd = -1;
}
-
-
/* The hardwire ops. */
-static const struct serial_ops hardwire_ops =
-{
- "hardwire",
- hardwire_open,
- hardwire_close,
- NULL,
- ser_base_readchar,
- ser_base_write,
- hardwire_flush_output,
- hardwire_flush_input,
- hardwire_send_break,
- hardwire_raw,
- hardwire_get_tty_state,
- hardwire_copy_tty_state,
- hardwire_set_tty_state,
- hardwire_print_tty_state,
- hardwire_setbaudrate,
- hardwire_setstopbits,
- hardwire_setparity,
- hardwire_drain_output,
- ser_base_async,
- ser_unix_read_prim,
- ser_unix_write_prim
-};
+static const struct serial_ops hardwire_ops = { "hardwire",
+ hardwire_open,
+ hardwire_close,
+ NULL,
+ ser_base_readchar,
+ ser_base_write,
+ hardwire_flush_output,
+ hardwire_flush_input,
+ hardwire_send_break,
+ hardwire_raw,
+ hardwire_get_tty_state,
+ hardwire_copy_tty_state,
+ hardwire_set_tty_state,
+ hardwire_print_tty_state,
+ hardwire_setbaudrate,
+ hardwire_setstopbits,
+ hardwire_setparity,
+ hardwire_drain_output,
+ ser_base_async,
+ ser_unix_read_prim,
+ ser_unix_write_prim };
void _initialize_ser_hardwire ();
+
void
_initialize_ser_hardwire ()
{
serial_add_interface (&hardwire_ops);
#ifdef CRTSCTS
- add_setshow_boolean_cmd ("remoteflow", no_class,
- &serial_hwflow, _("\
-Set use of hardware flow control for remote serial I/O."), _("\
-Show use of hardware flow control for remote serial I/O."), _("\
+ add_setshow_boolean_cmd ("remoteflow", no_class, &serial_hwflow, _ ("\
+Set use of hardware flow control for remote serial I/O."),
+ _ ("\
+Show use of hardware flow control for remote serial I/O."),
+ _ ("\
Enable or disable hardware flow control (RTS/CTS) on the serial port\n\
when debugging using remote targets."),
- NULL,
- show_serial_hwflow,
- &setlist, &showlist);
+ NULL, show_serial_hwflow, &setlist, &showlist);
#endif
}
diff --git a/gdb/ser-unix.h b/gdb/ser-unix.h
index fc38f282fb1..88583d16a49 100644
--- a/gdb/ser-unix.h
+++ b/gdb/ser-unix.h
@@ -21,7 +21,7 @@
#define SER_UNIX_H
extern int ser_unix_read_prim (struct serial *scb, size_t count);
-extern int ser_unix_write_prim (struct serial *scb, const void *buf,
+extern int ser_unix_write_prim (struct serial *scb, const void *buf,
size_t count);
#endif
diff --git a/gdb/serial.c b/gdb/serial.c
index 8a8bab46ead..83a71b0a1dc 100644
--- a/gdb/serial.c
+++ b/gdb/serial.c
@@ -42,15 +42,14 @@ static std::string serial_logfile;
static struct ui_file *serial_logfp = NULL;
static const struct serial_ops *serial_interface_lookup (const char *);
-static void serial_logchar (struct ui_file *stream,
- int ch_type, int ch, int timeout);
+static void serial_logchar (struct ui_file *stream, int ch_type, int ch,
+ int timeout);
static const char logbase_hex[] = "hex";
static const char logbase_octal[] = "octal";
static const char logbase_ascii[] = "ascii";
-static const char *const logbase_enums[] =
-{logbase_hex, logbase_octal, logbase_ascii, NULL};
+static const char *const logbase_enums[]
+ = { logbase_hex, logbase_octal, logbase_ascii, NULL };
static const char *serial_logbase = logbase_ascii;
-
static int serial_current_type = 0;
@@ -116,8 +115,7 @@ serial_logchar (struct ui_file *stream, int ch_type, int ch, int timeout)
gdb_puts ("\\v", stream);
break;
default:
- gdb_printf (stream,
- isprint (ch) ? "%c" : "\\x%02x", ch & 0xFF);
+ gdb_printf (stream, isprint (ch) ? "%c" : "\\x%02x", ch & 0xFF);
break;
}
}
@@ -139,7 +137,6 @@ serial_log_command (struct target_ops *self, const char *cmd)
gdb_flush (serial_logfp);
}
-
static const struct serial_ops *
serial_interface_lookup (const char *name)
{
@@ -387,7 +384,7 @@ serial_readchar (struct serial *scb, int timeout)
/* FIXME: cagney/1999-10-11: Don't enable this check until the ASYNC
code is finished. */
if (0 && serial_is_async_p (scb) && timeout < 0)
- internal_error (_("serial_readchar: blocking read in async mode"));
+ internal_error (_ ("serial_readchar: blocking read in async mode"));
ch = scb->ops->readchar (scb, timeout);
if (serial_logfp != NULL)
@@ -505,8 +502,7 @@ serial_set_tty_state (struct serial *scb, serial_ttystate ttystate)
}
void
-serial_print_tty_state (struct serial *scb,
- serial_ttystate ttystate,
+serial_print_tty_state (struct serial *scb, serial_ttystate ttystate,
struct ui_file *stream)
{
scb->ops->print_tty_state (scb, ttystate, stream);
@@ -545,9 +541,7 @@ serial_is_async_p (struct serial *scb)
}
void
-serial_async (struct serial *scb,
- serial_event_ftype *handler,
- void *context)
+serial_async (struct serial *scb, serial_event_ftype *handler, void *context)
{
int changed = ((scb->async_handler == NULL) != (handler == NULL));
@@ -625,8 +619,7 @@ static void
serial_baud_show_cmd (struct ui_file *file, int from_tty,
struct cmd_list_element *c, const char *value)
{
- gdb_printf (file, _("Baud rate for remote serial I/O is %s.\n"),
- value);
+ gdb_printf (file, _ ("Baud rate for remote serial I/O is %s.\n"), value);
}
/* See serial.h. */
@@ -636,8 +629,8 @@ int serial_parity = GDBPARITY_NONE;
static const char parity_none[] = "none";
static const char parity_odd[] = "odd";
static const char parity_even[] = "even";
-static const char *const parity_enums[] =
- {parity_none, parity_odd, parity_even, NULL};
+static const char *const parity_enums[]
+ = { parity_none, parity_odd, parity_even, NULL };
static const char *parity = parity_none;
/* Set serial_parity value. */
@@ -654,6 +647,7 @@ set_parity (const char *ignore_args, int from_tty, struct cmd_list_element *c)
}
void _initialize_serial ();
+
void
_initialize_serial ()
{
@@ -663,54 +657,56 @@ Connect the terminal directly up to the command monitor.\n\
Use <CR>~. or <CR>~^D to break out."));
#endif /* 0 */
- add_setshow_prefix_cmd ("serial", class_maintenance,
- _("Set default serial/parallel port configuration."),
- _("Show default serial/parallel port configuration."),
- &serial_set_cmdlist, &serial_show_cmdlist,
- &setlist, &showlist);
+ add_setshow_prefix_cmd (
+ "serial", class_maintenance,
+ _ ("Set default serial/parallel port configuration."),
+ _ ("Show default serial/parallel port configuration."),
+ &serial_set_cmdlist, &serial_show_cmdlist, &setlist, &showlist);
/* If target is open when baud changes, it doesn't take effect until
the next open (I think, not sure). */
- add_setshow_zinteger_cmd ("baud", no_class, &baud_rate, _("\
-Set baud rate for remote serial I/O."), _("\
-Show baud rate for remote serial I/O."), _("\
+ add_setshow_zinteger_cmd ("baud", no_class, &baud_rate, _ ("\
+Set baud rate for remote serial I/O."),
+ _ ("\
+Show baud rate for remote serial I/O."),
+ _ ("\
This value is used to set the speed of the serial port when debugging\n\
using remote targets."),
- NULL,
- serial_baud_show_cmd,
- &serial_set_cmdlist, &serial_show_cmdlist);
-
- add_setshow_enum_cmd ("parity", no_class, parity_enums,
- &parity, _("\
-Set parity for remote serial I/O."), _("\
-Show parity for remote serial I/O."), NULL,
- set_parity,
- NULL, /* FIXME: i18n: */
+ NULL, serial_baud_show_cmd, &serial_set_cmdlist,
+ &serial_show_cmdlist);
+
+ add_setshow_enum_cmd ("parity", no_class, parity_enums, &parity, _ ("\
+Set parity for remote serial I/O."),
+ _ ("\
+Show parity for remote serial I/O."),
+ NULL, set_parity, NULL, /* FIXME: i18n: */
&serial_set_cmdlist, &serial_show_cmdlist);
- add_setshow_filename_cmd ("remotelogfile", no_class, &serial_logfile, _("\
-Set filename for remote session recording."), _("\
-Show filename for remote session recording."), _("\
+ add_setshow_filename_cmd ("remotelogfile", no_class, &serial_logfile, _ ("\
+Set filename for remote session recording."),
+ _ ("\
+Show filename for remote session recording."),
+ _ ("\
This file is used to record the remote session for future playback\n\
by gdbserver."),
- NULL,
- NULL, /* FIXME: i18n: */
+ NULL, NULL, /* FIXME: i18n: */
&setlist, &showlist);
add_setshow_enum_cmd ("remotelogbase", no_class, logbase_enums,
- &serial_logbase, _("\
-Set numerical base for remote session logging."), _("\
-Show numerical base for remote session logging."), NULL,
- NULL,
- NULL, /* FIXME: i18n: */
+ &serial_logbase, _ ("\
+Set numerical base for remote session logging."),
+ _ ("\
+Show numerical base for remote session logging."),
+ NULL, NULL, NULL, /* FIXME: i18n: */
&setlist, &showlist);
add_setshow_zuinteger_cmd ("serial", class_maintenance,
- &global_serial_debug_p, _("\
-Set serial debugging."), _("\
-Show serial debugging."), _("\
+ &global_serial_debug_p, _ ("\
+Set serial debugging."),
+ _ ("\
+Show serial debugging."),
+ _ ("\
When non-zero, serial port debugging is enabled."),
- NULL,
- NULL, /* FIXME: i18n: */
+ NULL, NULL, /* FIXME: i18n: */
&setdebuglist, &showdebuglist);
}
diff --git a/gdb/serial.h b/gdb/serial.h
index 3b861200302..5b52633b4f6 100644
--- a/gdb/serial.h
+++ b/gdb/serial.h
@@ -106,13 +106,14 @@ extern void serial_un_fdopen (struct serial *scb);
one of the following codes. Note that all error return-codes are
guaranteed to be < 0. */
-enum serial_rc {
- SERIAL_ERROR = -1, /* General error. */
- SERIAL_TIMEOUT = -2, /* Timeout or data-not-ready during read.
+enum serial_rc
+{
+ SERIAL_ERROR = -1, /* General error. */
+ SERIAL_TIMEOUT = -2, /* Timeout or data-not-ready during read.
Unfortunately, through
deprecated_ui_loop_hook (), this can also
be a QUIT indication. */
- SERIAL_EOF = -3 /* General end-of-file or remote target
+ SERIAL_EOF = -3 /* General end-of-file or remote target
connection closed, indication. Includes
things like the line dropping dead. */
};
@@ -126,8 +127,8 @@ extern int serial_write (struct serial *scb, const void *buf, size_t count);
/* Write a printf style string onto the serial port. */
-extern void serial_printf (struct serial *desc,
- const char *,...) ATTRIBUTE_PRINTF (2, 3);
+extern void serial_printf (struct serial *desc, const char *, ...)
+ ATTRIBUTE_PRINTF (2, 3);
/* Allow pending output to drain. */
@@ -186,14 +187,14 @@ extern int serial_setbaudrate (struct serial *scb, int rate);
success, -1 for failure. */
#define SERIAL_1_STOPBITS 1
-#define SERIAL_1_AND_A_HALF_STOPBITS 2 /* 1.5 bits, snicker... */
+#define SERIAL_1_AND_A_HALF_STOPBITS 2 /* 1.5 bits, snicker... */
#define SERIAL_2_STOPBITS 3
extern int serial_setstopbits (struct serial *scb, int num);
-#define GDBPARITY_NONE 0
-#define GDBPARITY_ODD 1
-#define GDBPARITY_EVEN 2
+#define GDBPARITY_NONE 0
+#define GDBPARITY_ODD 1
+#define GDBPARITY_EVEN 2
/* Set parity for serial port. Returns 0 for success, -1 for failure. */
@@ -214,8 +215,8 @@ extern int serial_is_async_p (struct serial *scb);
callback. */
typedef void (serial_event_ftype) (struct serial *scb, void *context);
-extern void serial_async (struct serial *scb,
- serial_event_ftype *handler, void *context);
+extern void serial_async (struct serial *scb, serial_event_ftype *handler,
+ void *context);
/* Trace/debug mechanism.
@@ -226,90 +227,88 @@ extern void serial_debug (struct serial *scb, int debug_p);
extern int serial_debug_p (struct serial *scb);
-
/* Details of an instance of a serial object. */
struct serial
- {
- /* serial objects are ref counted (but not the underlying
+{
+ /* serial objects are ref counted (but not the underlying
connection, just the object's lifetime in memory). */
- int refcnt;
+ int refcnt;
- int fd; /* File descriptor */
- /* File descriptor for a separate error stream that should be
+ int fd; /* File descriptor */
+ /* File descriptor for a separate error stream that should be
immediately forwarded to gdb_stderr. This may be -1.
If != -1, this descriptor should be non-blocking or
ops->avail should be non-NULL. */
- int error_fd;
- const struct serial_ops *ops; /* Function vector */
- void *state; /* Local context info for open FD */
- serial_ttystate ttystate; /* Not used (yet) */
- int bufcnt; /* Amount of data remaining in receive
+ int error_fd;
+ const struct serial_ops *ops; /* Function vector */
+ void *state; /* Local context info for open FD */
+ serial_ttystate ttystate; /* Not used (yet) */
+ int bufcnt; /* Amount of data remaining in receive
buffer. -ve for sticky errors. */
- unsigned char *bufp; /* Current byte */
- unsigned char buf[BUFSIZ]; /* Da buffer itself */
- char *name; /* The name of the device or host */
- struct serial *next; /* Pointer to the next `struct serial *' */
- int debug_p; /* Trace this serial devices operation. */
- int async_state; /* Async internal state. */
- void *async_context; /* Async event thread's context */
- serial_event_ftype *async_handler;/* Async event handler */
- };
+ unsigned char *bufp; /* Current byte */
+ unsigned char buf[BUFSIZ]; /* Da buffer itself */
+ char *name; /* The name of the device or host */
+ struct serial *next; /* Pointer to the next `struct serial *' */
+ int debug_p; /* Trace this serial devices operation. */
+ int async_state; /* Async internal state. */
+ void *async_context; /* Async event thread's context */
+ serial_event_ftype *async_handler; /* Async event handler */
+};
struct serial_ops
- {
- const char *name;
- int (*open) (struct serial *, const char *name);
- void (*close) (struct serial *);
- int (*fdopen) (struct serial *, int fd);
- int (*readchar) (struct serial *, int timeout);
- int (*write) (struct serial *, const void *buf, size_t count);
- /* Discard pending output */
- int (*flush_output) (struct serial *);
- /* Discard pending input */
- int (*flush_input) (struct serial *);
- int (*send_break) (struct serial *);
- void (*go_raw) (struct serial *);
- serial_ttystate (*get_tty_state) (struct serial *);
- serial_ttystate (*copy_tty_state) (struct serial *, serial_ttystate);
- int (*set_tty_state) (struct serial *, serial_ttystate);
- void (*print_tty_state) (struct serial *, serial_ttystate,
- struct ui_file *);
- int (*setbaudrate) (struct serial *, int rate);
- int (*setstopbits) (struct serial *, int num);
- /* Set the value PARITY as parity setting for serial object.
+{
+ const char *name;
+ int (*open) (struct serial *, const char *name);
+ void (*close) (struct serial *);
+ int (*fdopen) (struct serial *, int fd);
+ int (*readchar) (struct serial *, int timeout);
+ int (*write) (struct serial *, const void *buf, size_t count);
+ /* Discard pending output */
+ int (*flush_output) (struct serial *);
+ /* Discard pending input */
+ int (*flush_input) (struct serial *);
+ int (*send_break) (struct serial *);
+ void (*go_raw) (struct serial *);
+ serial_ttystate (*get_tty_state) (struct serial *);
+ serial_ttystate (*copy_tty_state) (struct serial *, serial_ttystate);
+ int (*set_tty_state) (struct serial *, serial_ttystate);
+ void (*print_tty_state) (struct serial *, serial_ttystate, struct ui_file *);
+ int (*setbaudrate) (struct serial *, int rate);
+ int (*setstopbits) (struct serial *, int num);
+ /* Set the value PARITY as parity setting for serial object.
Return 0 in the case of success. */
- int (*setparity) (struct serial *, int parity);
- /* Wait for output to drain. */
- int (*drain_output) (struct serial *);
- /* Change the serial device into/out of asynchronous mode, call
+ int (*setparity) (struct serial *, int parity);
+ /* Wait for output to drain. */
+ int (*drain_output) (struct serial *);
+ /* Change the serial device into/out of asynchronous mode, call
the specified function when ever there is something
interesting. */
- void (*async) (struct serial *scb, int async_p);
- /* Perform a low-level read operation, reading (at most) COUNT
+ void (*async) (struct serial *scb, int async_p);
+ /* Perform a low-level read operation, reading (at most) COUNT
bytes into SCB->BUF. Return zero at end of file. */
- int (*read_prim)(struct serial *scb, size_t count);
- /* Perform a low-level write operation, writing (at most) COUNT
+ int (*read_prim) (struct serial *scb, size_t count);
+ /* Perform a low-level write operation, writing (at most) COUNT
bytes from BUF. */
- int (*write_prim)(struct serial *scb, const void *buf, size_t count);
- /* Return that number of bytes that can be read from FD
+ int (*write_prim) (struct serial *scb, const void *buf, size_t count);
+ /* Return that number of bytes that can be read from FD
without blocking. Return value of -1 means that the
read will not block even if less that requested bytes
are available. */
- int (*avail)(struct serial *scb, int fd);
+ int (*avail) (struct serial *scb, int fd);
#ifdef USE_WIN32API
- /* Return a handle to wait on, indicating available data from SCB
+ /* Return a handle to wait on, indicating available data from SCB
when signaled, in *READ. Return a handle indicating errors
in *EXCEPT. */
- void (*wait_handle) (struct serial *scb, HANDLE *read, HANDLE *except);
- void (*done_wait_handle) (struct serial *scb);
+ void (*wait_handle) (struct serial *scb, HANDLE *read, HANDLE *except);
+ void (*done_wait_handle) (struct serial *scb);
#endif /* USE_WIN32API */
- };
+};
/* Add a new serial interface to the interface list. */
-extern void serial_add_interface (const struct serial_ops * optable);
+extern void serial_add_interface (const struct serial_ops *optable);
/* File in which to record the remote debugging session. */
diff --git a/gdb/sh-linux-tdep.c b/gdb/sh-linux-tdep.c
index f1367b8e92e..ffc75de386e 100644
--- a/gdb/sh-linux-tdep.c
+++ b/gdb/sh-linux-tdep.c
@@ -31,60 +31,43 @@
#include "linux-tdep.h"
#include "gdbarch.h"
-#define REGSx16(base) \
- {(base), 0}, \
- {(base) + 1, 4}, \
- {(base) + 2, 8}, \
- {(base) + 3, 12}, \
- {(base) + 4, 16}, \
- {(base) + 5, 20}, \
- {(base) + 6, 24}, \
- {(base) + 7, 28}, \
- {(base) + 8, 32}, \
- {(base) + 9, 36}, \
- {(base) + 10, 40}, \
- {(base) + 11, 44}, \
- {(base) + 12, 48}, \
- {(base) + 13, 52}, \
- {(base) + 14, 56}, \
- {(base) + 15, 60}
+#define REGSx16(base) \
+ { (base), 0 }, { (base) + 1, 4 }, { (base) + 2, 8 }, { (base) + 3, 12 }, \
+ { (base) + 4, 16 }, { (base) + 5, 20 }, { (base) + 6, 24 }, \
+ { (base) + 7, 28 }, { (base) + 8, 32 }, { (base) + 9, 36 }, \
+ { (base) + 10, 40 }, { (base) + 11, 44 }, { (base) + 12, 48 }, \
+ { (base) + 13, 52 }, { (base) + 14, 56 }, \
+ { \
+ (base) + 15, 60 \
+ }
/* Describe the contents of the .reg section of the core file. */
-static const struct sh_corefile_regmap gregs_table[] =
-{
- REGSx16 (R0_REGNUM),
- {PC_REGNUM, 64},
- {PR_REGNUM, 68},
- {SR_REGNUM, 72},
- {GBR_REGNUM, 76},
- {MACH_REGNUM, 80},
- {MACL_REGNUM, 84},
- {-1 /* Terminator. */, 0}
-};
+static const struct sh_corefile_regmap gregs_table[]
+ = { REGSx16 (R0_REGNUM), { PC_REGNUM, 64 }, { PR_REGNUM, 68 },
+ { SR_REGNUM, 72 }, { GBR_REGNUM, 76 }, { MACH_REGNUM, 80 },
+ { MACL_REGNUM, 84 }, { -1 /* Terminator. */, 0 } };
/* Describe the contents of the .reg2 section of the core file. */
-static const struct sh_corefile_regmap fpregs_table[] =
-{
- REGSx16 (FR0_REGNUM),
- /* REGSx16 xfp_regs omitted. */
- {FPSCR_REGNUM, 128},
- {FPUL_REGNUM, 132},
- {-1 /* Terminator. */, 0}
-};
+static const struct sh_corefile_regmap fpregs_table[]
+ = { REGSx16 (FR0_REGNUM),
+ /* REGSx16 xfp_regs omitted. */
+ { FPSCR_REGNUM, 128 },
+ { FPUL_REGNUM, 132 },
+ { -1 /* Terminator. */, 0 } };
/* SH signal handler frame support. */
static void
sh_linux_sigtramp_cache (frame_info_ptr this_frame,
- struct trad_frame_cache *this_cache,
- CORE_ADDR func, int regs_offset)
+ struct trad_frame_cache *this_cache, CORE_ADDR func,
+ int regs_offset)
{
int i;
struct gdbarch *gdbarch = get_frame_arch (this_frame);
- CORE_ADDR base = get_frame_register_unsigned (this_frame,
- gdbarch_sp_regnum (gdbarch));
+ CORE_ADDR base
+ = get_frame_register_unsigned (this_frame, gdbarch_sp_regnum (gdbarch));
CORE_ADDR regs = base + regs_offset;
for (i = 0; i < 18; i++)
@@ -115,8 +98,7 @@ sh_linux_sigtramp_cache (frame_info_ptr this_frame,
static void
sh_linux_sigreturn_init (const struct tramp_frame *self,
frame_info_ptr this_frame,
- struct trad_frame_cache *this_cache,
- CORE_ADDR func)
+ struct trad_frame_cache *this_cache, CORE_ADDR func)
{
/* SH 32-bit sigframe: sigcontext at start of sigframe,
registers start after a single 'oldmask' word. */
@@ -133,53 +115,47 @@ sh_linux_rt_sigreturn_init (const struct tramp_frame *self,
we can find sigcontext embedded within a ucontext (offset 20 bytes).
Then registers start after a single 'oldmask' word. */
sh_linux_sigtramp_cache (this_frame, this_cache, func,
- 128 /* sizeof (struct siginfo) */
- + 20 /* offsetof (struct ucontext, uc_mcontext) */
- + 4 /* oldmask word at start of sigcontext */);
+ 128 /* sizeof (struct siginfo) */
+ + 20 /* offsetof (struct ucontext, uc_mcontext) */
+ + 4 /* oldmask word at start of sigcontext */);
}
/* Instruction patterns. */
-#define SH_MOVW 0x9305
-#define SH_TRAP 0xc300
-#define SH_OR_R0_R0 0x200b
+#define SH_MOVW 0x9305
+#define SH_TRAP 0xc300
+#define SH_OR_R0_R0 0x200b
/* SH sigreturn syscall numbers. */
#define SH_NR_SIGRETURN 0x0077
#define SH_NR_RT_SIGRETURN 0x00ad
-static struct tramp_frame sh_linux_sigreturn_tramp_frame = {
- SIGTRAMP_FRAME,
- 2,
- {
- { SH_MOVW, 0xffff },
- { SH_TRAP, 0xff00 }, /* #imm argument part filtered out. */
- { SH_OR_R0_R0, 0xffff },
- { SH_OR_R0_R0, 0xffff },
- { SH_OR_R0_R0, 0xffff },
- { SH_OR_R0_R0, 0xffff },
- { SH_OR_R0_R0, 0xffff },
- { SH_NR_SIGRETURN, 0xffff },
- { TRAMP_SENTINEL_INSN }
- },
- sh_linux_sigreturn_init
-};
-
-static struct tramp_frame sh_linux_rt_sigreturn_tramp_frame = {
- SIGTRAMP_FRAME,
- 2,
- {
- { SH_MOVW, 0xffff },
- { SH_TRAP, 0xff00 }, /* #imm argument part filtered out. */
- { SH_OR_R0_R0, 0xffff },
- { SH_OR_R0_R0, 0xffff },
- { SH_OR_R0_R0, 0xffff },
- { SH_OR_R0_R0, 0xffff },
- { SH_OR_R0_R0, 0xffff },
- { SH_NR_RT_SIGRETURN, 0xffff },
- { TRAMP_SENTINEL_INSN }
- },
- sh_linux_rt_sigreturn_init
-};
+static struct tramp_frame sh_linux_sigreturn_tramp_frame
+ = { SIGTRAMP_FRAME,
+ 2,
+ { { SH_MOVW, 0xffff },
+ { SH_TRAP, 0xff00 }, /* #imm argument part filtered out. */
+ { SH_OR_R0_R0, 0xffff },
+ { SH_OR_R0_R0, 0xffff },
+ { SH_OR_R0_R0, 0xffff },
+ { SH_OR_R0_R0, 0xffff },
+ { SH_OR_R0_R0, 0xffff },
+ { SH_NR_SIGRETURN, 0xffff },
+ { TRAMP_SENTINEL_INSN } },
+ sh_linux_sigreturn_init };
+
+static struct tramp_frame sh_linux_rt_sigreturn_tramp_frame
+ = { SIGTRAMP_FRAME,
+ 2,
+ { { SH_MOVW, 0xffff },
+ { SH_TRAP, 0xff00 }, /* #imm argument part filtered out. */
+ { SH_OR_R0_R0, 0xffff },
+ { SH_OR_R0_R0, 0xffff },
+ { SH_OR_R0_R0, 0xffff },
+ { SH_OR_R0_R0, 0xffff },
+ { SH_OR_R0_R0, 0xffff },
+ { SH_NR_RT_SIGRETURN, 0xffff },
+ { TRAMP_SENTINEL_INSN } },
+ sh_linux_rt_sigreturn_init };
static void
sh_linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
@@ -188,8 +164,8 @@ sh_linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
/* GNU/Linux uses SVR4-style shared libraries. */
set_gdbarch_skip_trampoline_code (gdbarch, find_solib_trampoline_target);
- set_solib_svr4_fetch_link_map_offsets
- (gdbarch, linux_ilp32_fetch_link_map_offsets);
+ set_solib_svr4_fetch_link_map_offsets (gdbarch,
+ linux_ilp32_fetch_link_map_offsets);
set_gdbarch_skip_solib_resolver (gdbarch, glibc_skip_solib_resolver);
set_gdbarch_fetch_tls_load_module_address (gdbarch,
@@ -209,6 +185,7 @@ sh_linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
}
void _initialize_sh_linux_tdep ();
+
void
_initialize_sh_linux_tdep ()
{
diff --git a/gdb/sh-netbsd-nat.c b/gdb/sh-netbsd-nat.c
index 409fe28634c..167b91fe990 100644
--- a/gdb/sh-netbsd-nat.c
+++ b/gdb/sh-netbsd-nat.c
@@ -40,14 +40,14 @@ struct sh_nbsd_nat_target final : public nbsd_nat_target
static sh_nbsd_nat_target the_sh_nbsd_nat_target;
/* Determine if PT_GETREGS fetches this register. */
-#define GETREGS_SUPPLIES(gdbarch, regno) \
- (((regno) >= R0_REGNUM && (regno) <= (R0_REGNUM + 15)) \
-|| (regno) == gdbarch_pc_regnum (gdbarch) || (regno) == PR_REGNUM \
-|| (regno) == MACH_REGNUM || (regno) == MACL_REGNUM \
-|| (regno) == SR_REGNUM)
+#define GETREGS_SUPPLIES(gdbarch, regno) \
+ (((regno) >= R0_REGNUM && (regno) <= (R0_REGNUM + 15)) \
+ || (regno) == gdbarch_pc_regnum (gdbarch) || (regno) == PR_REGNUM \
+ || (regno) == MACH_REGNUM || (regno) == MACL_REGNUM \
+ || (regno) == SR_REGNUM)
/* Sizeof `struct reg' in <machine/reg.h>. */
-#define SHNBSD_SIZEOF_GREGS (21 * 4)
+#define SHNBSD_SIZEOF_GREGS (21 * 4)
void
sh_nbsd_nat_target::fetch_registers (struct regcache *regcache, int regno)
@@ -59,9 +59,9 @@ sh_nbsd_nat_target::fetch_registers (struct regcache *regcache, int regno)
{
struct reg inferior_registers;
- if (ptrace (PT_GETREGS, pid,
- (PTRACE_TYPE_ARG3) &inferior_registers, lwp) == -1)
- perror_with_name (_("Couldn't get registers"));
+ if (ptrace (PT_GETREGS, pid, (PTRACE_TYPE_ARG3) &inferior_registers, lwp)
+ == -1)
+ perror_with_name (_ ("Couldn't get registers"));
sh_corefile_supply_regset (&sh_corefile_gregset, regcache, regno,
(char *) &inferior_registers,
@@ -82,17 +82,17 @@ sh_nbsd_nat_target::store_registers (struct regcache *regcache, int regno)
{
struct reg inferior_registers;
- if (ptrace (PT_GETREGS, pid,
- (PTRACE_TYPE_ARG3) &inferior_registers, lwp) == -1)
- perror_with_name (_("Couldn't get registers"));
+ if (ptrace (PT_GETREGS, pid, (PTRACE_TYPE_ARG3) &inferior_registers, lwp)
+ == -1)
+ perror_with_name (_ ("Couldn't get registers"));
sh_corefile_collect_regset (&sh_corefile_gregset, regcache, regno,
(char *) &inferior_registers,
SHNBSD_SIZEOF_GREGS);
- if (ptrace (PT_SETREGS, pid,
- (PTRACE_TYPE_ARG3) &inferior_registers, lwp) == -1)
- perror_with_name (_("Couldn't set registers"));
+ if (ptrace (PT_SETREGS, pid, (PTRACE_TYPE_ARG3) &inferior_registers, lwp)
+ == -1)
+ perror_with_name (_ ("Couldn't set registers"));
if (regno != -1)
return;
@@ -100,6 +100,7 @@ sh_nbsd_nat_target::store_registers (struct regcache *regcache, int regno)
}
void _initialize_shnbsd_nat ();
+
void
_initialize_shnbsd_nat ()
{
diff --git a/gdb/sh-netbsd-tdep.c b/gdb/sh-netbsd-tdep.c
index f7734f1e1ce..bf94268b025 100644
--- a/gdb/sh-netbsd-tdep.c
+++ b/gdb/sh-netbsd-tdep.c
@@ -32,53 +32,37 @@
/* Convert a register number into an offset into a ptrace
register structure. */
-static const struct sh_corefile_regmap regmap[] =
-{
- {R0_REGNUM, 20 * 4},
- {R0_REGNUM + 1, 19 * 4},
- {R0_REGNUM + 2, 18 * 4},
- {R0_REGNUM + 3, 17 * 4},
- {R0_REGNUM + 4, 16 * 4},
- {R0_REGNUM + 5, 15 * 4},
- {R0_REGNUM + 6, 14 * 4},
- {R0_REGNUM + 7, 13 * 4},
- {R0_REGNUM + 8, 12 * 4},
- {R0_REGNUM + 9, 11 * 4},
- {R0_REGNUM + 10, 10 * 4},
- {R0_REGNUM + 11, 9 * 4},
- {R0_REGNUM + 12, 8 * 4},
- {R0_REGNUM + 13, 7 * 4},
- {R0_REGNUM + 14, 6 * 4},
- {R0_REGNUM + 15, 5 * 4},
- {PC_REGNUM, 0 * 4},
- {SR_REGNUM, 1 * 4},
- {PR_REGNUM, 2 * 4},
- {MACH_REGNUM, 3 * 4},
- {MACL_REGNUM, 4 * 4},
- {-1 /* Terminator. */, 0}
-};
-
+static const struct sh_corefile_regmap regmap[]
+ = { { R0_REGNUM, 20 * 4 }, { R0_REGNUM + 1, 19 * 4 },
+ { R0_REGNUM + 2, 18 * 4 }, { R0_REGNUM + 3, 17 * 4 },
+ { R0_REGNUM + 4, 16 * 4 }, { R0_REGNUM + 5, 15 * 4 },
+ { R0_REGNUM + 6, 14 * 4 }, { R0_REGNUM + 7, 13 * 4 },
+ { R0_REGNUM + 8, 12 * 4 }, { R0_REGNUM + 9, 11 * 4 },
+ { R0_REGNUM + 10, 10 * 4 }, { R0_REGNUM + 11, 9 * 4 },
+ { R0_REGNUM + 12, 8 * 4 }, { R0_REGNUM + 13, 7 * 4 },
+ { R0_REGNUM + 14, 6 * 4 }, { R0_REGNUM + 15, 5 * 4 },
+ { PC_REGNUM, 0 * 4 }, { SR_REGNUM, 1 * 4 },
+ { PR_REGNUM, 2 * 4 }, { MACH_REGNUM, 3 * 4 },
+ { MACL_REGNUM, 4 * 4 }, { -1 /* Terminator. */, 0 } };
static void
-shnbsd_init_abi (struct gdbarch_info info,
- struct gdbarch *gdbarch)
+shnbsd_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
{
sh_gdbarch_tdep *tdep = gdbarch_tdep<sh_gdbarch_tdep> (gdbarch);
nbsd_init_abi (info, gdbarch);
- tdep->core_gregmap = (struct sh_corefile_regmap *)regmap;
+ tdep->core_gregmap = (struct sh_corefile_regmap *) regmap;
tdep->sizeof_gregset = 84;
- set_solib_svr4_fetch_link_map_offsets
- (gdbarch, svr4_ilp32_fetch_link_map_offsets);
+ set_solib_svr4_fetch_link_map_offsets (gdbarch,
+ svr4_ilp32_fetch_link_map_offsets);
}
void _initialize_shnbsd_tdep ();
+
void
_initialize_shnbsd_tdep ()
{
- gdbarch_register_osabi (bfd_arch_sh, 0, GDB_OSABI_NETBSD,
- shnbsd_init_abi);
- gdbarch_register_osabi (bfd_arch_sh, 0, GDB_OSABI_OPENBSD,
- shnbsd_init_abi);
+ gdbarch_register_osabi (bfd_arch_sh, 0, GDB_OSABI_NETBSD, shnbsd_init_abi);
+ gdbarch_register_osabi (bfd_arch_sh, 0, GDB_OSABI_OPENBSD, shnbsd_init_abi);
}
diff --git a/gdb/sh-tdep.c b/gdb/sh-tdep.c
index a816e6b00cd..6d3af0958e3 100644
--- a/gdb/sh-tdep.c
+++ b/gdb/sh-tdep.c
@@ -58,11 +58,7 @@ static struct cmd_list_element *showshcmdlist = NULL;
static const char sh_cc_gcc[] = "gcc";
static const char sh_cc_renesas[] = "renesas";
-static const char *const sh_cc_enum[] = {
- sh_cc_gcc,
- sh_cc_renesas,
- NULL
-};
+static const char *const sh_cc_enum[] = { sh_cc_gcc, sh_cc_renesas, NULL };
static const char *sh_active_calling_convention = sh_cc_gcc;
@@ -109,11 +105,10 @@ sh_is_renesas_calling_convention (struct type *func_type)
static const char *
sh_sh_register_name (struct gdbarch *gdbarch, int reg_nr)
{
- static const char *register_names[] = {
- "r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7",
- "r8", "r9", "r10", "r11", "r12", "r13", "r14", "r15",
- "pc", "pr", "gbr", "vbr", "mach", "macl", "sr"
- };
+ static const char *register_names[]
+ = { "r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7",
+ "r8", "r9", "r10", "r11", "r12", "r13", "r14", "r15",
+ "pc", "pr", "gbr", "vbr", "mach", "macl", "sr" };
if (reg_nr >= ARRAY_SIZE (register_names))
return "";
@@ -124,15 +119,13 @@ static const char *
sh_sh3_register_name (struct gdbarch *gdbarch, int reg_nr)
{
static const char *register_names[] = {
- "r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7",
- "r8", "r9", "r10", "r11", "r12", "r13", "r14", "r15",
- "pc", "pr", "gbr", "vbr", "mach", "macl", "sr",
- "", "",
- "", "", "", "", "", "", "", "",
- "", "", "", "", "", "", "", "",
- "ssr", "spc",
- "r0b0", "r1b0", "r2b0", "r3b0", "r4b0", "r5b0", "r6b0", "r7b0",
- "r0b1", "r1b1", "r2b1", "r3b1", "r4b1", "r5b1", "r6b1", "r7b1",
+ "r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7", "r8",
+ "r9", "r10", "r11", "r12", "r13", "r14", "r15", "pc", "pr",
+ "gbr", "vbr", "mach", "macl", "sr", "", "", "", "",
+ "", "", "", "", "", "", "", "", "",
+ "", "", "", "", "", "ssr", "spc", "r0b0", "r1b0",
+ "r2b0", "r3b0", "r4b0", "r5b0", "r6b0", "r7b0", "r0b1", "r1b1", "r2b1",
+ "r3b1", "r4b1", "r5b1", "r6b1", "r7b1",
};
if (reg_nr >= ARRAY_SIZE (register_names))
@@ -144,15 +137,13 @@ static const char *
sh_sh3e_register_name (struct gdbarch *gdbarch, int reg_nr)
{
static const char *register_names[] = {
- "r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7",
- "r8", "r9", "r10", "r11", "r12", "r13", "r14", "r15",
- "pc", "pr", "gbr", "vbr", "mach", "macl", "sr",
- "fpul", "fpscr",
- "fr0", "fr1", "fr2", "fr3", "fr4", "fr5", "fr6", "fr7",
- "fr8", "fr9", "fr10", "fr11", "fr12", "fr13", "fr14", "fr15",
- "ssr", "spc",
- "r0b0", "r1b0", "r2b0", "r3b0", "r4b0", "r5b0", "r6b0", "r7b0",
- "r0b1", "r1b1", "r2b1", "r3b1", "r4b1", "r5b1", "r6b1", "r7b1",
+ "r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7", "r8",
+ "r9", "r10", "r11", "r12", "r13", "r14", "r15", "pc", "pr",
+ "gbr", "vbr", "mach", "macl", "sr", "fpul", "fpscr", "fr0", "fr1",
+ "fr2", "fr3", "fr4", "fr5", "fr6", "fr7", "fr8", "fr9", "fr10",
+ "fr11", "fr12", "fr13", "fr14", "fr15", "ssr", "spc", "r0b0", "r1b0",
+ "r2b0", "r3b0", "r4b0", "r5b0", "r6b0", "r7b0", "r0b1", "r1b1", "r2b1",
+ "r3b1", "r4b1", "r5b1", "r6b1", "r7b1",
};
if (reg_nr >= ARRAY_SIZE (register_names))
return "";
@@ -163,12 +154,11 @@ static const char *
sh_sh2e_register_name (struct gdbarch *gdbarch, int reg_nr)
{
static const char *register_names[] = {
- "r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7",
- "r8", "r9", "r10", "r11", "r12", "r13", "r14", "r15",
- "pc", "pr", "gbr", "vbr", "mach", "macl", "sr",
- "fpul", "fpscr",
- "fr0", "fr1", "fr2", "fr3", "fr4", "fr5", "fr6", "fr7",
- "fr8", "fr9", "fr10", "fr11", "fr12", "fr13", "fr14", "fr15",
+ "r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7", "r8",
+ "r9", "r10", "r11", "r12", "r13", "r14", "r15", "pc", "pr",
+ "gbr", "vbr", "mach", "macl", "sr", "fpul", "fpscr", "fr0", "fr1",
+ "fr2", "fr3", "fr4", "fr5", "fr6", "fr7", "fr8", "fr9", "fr10",
+ "fr11", "fr12", "fr13", "fr14", "fr15",
};
if (reg_nr >= ARRAY_SIZE (register_names))
return "";
@@ -180,33 +170,95 @@ sh_sh2a_register_name (struct gdbarch *gdbarch, int reg_nr)
{
static const char *register_names[] = {
/* general registers 0-15 */
- "r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7",
- "r8", "r9", "r10", "r11", "r12", "r13", "r14", "r15",
+ "r0",
+ "r1",
+ "r2",
+ "r3",
+ "r4",
+ "r5",
+ "r6",
+ "r7",
+ "r8",
+ "r9",
+ "r10",
+ "r11",
+ "r12",
+ "r13",
+ "r14",
+ "r15",
/* 16 - 22 */
- "pc", "pr", "gbr", "vbr", "mach", "macl", "sr",
+ "pc",
+ "pr",
+ "gbr",
+ "vbr",
+ "mach",
+ "macl",
+ "sr",
/* 23, 24 */
- "fpul", "fpscr",
+ "fpul",
+ "fpscr",
/* floating point registers 25 - 40 */
- "fr0", "fr1", "fr2", "fr3", "fr4", "fr5", "fr6", "fr7",
- "fr8", "fr9", "fr10", "fr11", "fr12", "fr13", "fr14", "fr15",
+ "fr0",
+ "fr1",
+ "fr2",
+ "fr3",
+ "fr4",
+ "fr5",
+ "fr6",
+ "fr7",
+ "fr8",
+ "fr9",
+ "fr10",
+ "fr11",
+ "fr12",
+ "fr13",
+ "fr14",
+ "fr15",
/* 41, 42 */
- "", "",
+ "",
+ "",
/* 43 - 62. Banked registers. The bank number used is determined by
the bank register (63). */
- "r0b", "r1b", "r2b", "r3b", "r4b", "r5b", "r6b", "r7b",
- "r8b", "r9b", "r10b", "r11b", "r12b", "r13b", "r14b",
- "machb", "ivnb", "prb", "gbrb", "maclb",
+ "r0b",
+ "r1b",
+ "r2b",
+ "r3b",
+ "r4b",
+ "r5b",
+ "r6b",
+ "r7b",
+ "r8b",
+ "r9b",
+ "r10b",
+ "r11b",
+ "r12b",
+ "r13b",
+ "r14b",
+ "machb",
+ "ivnb",
+ "prb",
+ "gbrb",
+ "maclb",
/* 63: register bank number, not a real register but used to
communicate the register bank currently get/set. This register
is hidden to the user, who manipulates it using the pseudo
register called "bank" (67). See below. */
"",
/* 64 - 66 */
- "ibcr", "ibnr", "tbr",
+ "ibcr",
+ "ibnr",
+ "tbr",
/* 67: register bank number, the user visible pseudo register. */
"bank",
/* double precision (pseudo) 68 - 75 */
- "dr0", "dr2", "dr4", "dr6", "dr8", "dr10", "dr12", "dr14",
+ "dr0",
+ "dr2",
+ "dr4",
+ "dr6",
+ "dr8",
+ "dr10",
+ "dr12",
+ "dr14",
};
if (reg_nr >= ARRAY_SIZE (register_names))
return "";
@@ -218,22 +270,21 @@ sh_sh2a_nofpu_register_name (struct gdbarch *gdbarch, int reg_nr)
{
static const char *register_names[] = {
/* general registers 0-15 */
- "r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7",
- "r8", "r9", "r10", "r11", "r12", "r13", "r14", "r15",
+ "r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7", "r8", "r9", "r10", "r11",
+ "r12", "r13", "r14", "r15",
/* 16 - 22 */
"pc", "pr", "gbr", "vbr", "mach", "macl", "sr",
/* 23, 24 */
"", "",
/* floating point registers 25 - 40 */
- "", "", "", "", "", "", "", "",
- "", "", "", "", "", "", "", "",
+ "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
/* 41, 42 */
"", "",
/* 43 - 62. Banked registers. The bank number used is determined by
the bank register (63). */
- "r0b", "r1b", "r2b", "r3b", "r4b", "r5b", "r6b", "r7b",
- "r8b", "r9b", "r10b", "r11b", "r12b", "r13b", "r14b",
- "machb", "ivnb", "prb", "gbrb", "maclb",
+ "r0b", "r1b", "r2b", "r3b", "r4b", "r5b", "r6b", "r7b", "r8b", "r9b",
+ "r10b", "r11b", "r12b", "r13b", "r14b", "machb", "ivnb", "prb", "gbrb",
+ "maclb",
/* 63: register bank number, not a real register but used to
communicate the register bank currently get/set. This register
is hidden to the user, who manipulates it using the pseudo
@@ -254,14 +305,11 @@ static const char *
sh_sh_dsp_register_name (struct gdbarch *gdbarch, int reg_nr)
{
static const char *register_names[] = {
- "r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7",
- "r8", "r9", "r10", "r11", "r12", "r13", "r14", "r15",
- "pc", "pr", "gbr", "vbr", "mach", "macl", "sr",
- "", "dsr",
- "a0g", "a0", "a1g", "a1", "m0", "m1", "x0", "x1",
- "y0", "y1", "", "", "", "", "", "mod",
- "", "",
- "rs", "re",
+ "r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7", "r8",
+ "r9", "r10", "r11", "r12", "r13", "r14", "r15", "pc", "pr",
+ "gbr", "vbr", "mach", "macl", "sr", "", "dsr", "a0g", "a0",
+ "a1g", "a1", "m0", "m1", "x0", "x1", "y0", "y1", "",
+ "", "", "", "", "mod", "", "", "rs", "re",
};
if (reg_nr >= ARRAY_SIZE (register_names))
return "";
@@ -272,15 +320,12 @@ static const char *
sh_sh3_dsp_register_name (struct gdbarch *gdbarch, int reg_nr)
{
static const char *register_names[] = {
- "r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7",
- "r8", "r9", "r10", "r11", "r12", "r13", "r14", "r15",
- "pc", "pr", "gbr", "vbr", "mach", "macl", "sr",
- "", "dsr",
- "a0g", "a0", "a1g", "a1", "m0", "m1", "x0", "x1",
- "y0", "y1", "", "", "", "", "", "mod",
- "ssr", "spc",
- "rs", "re", "", "", "", "", "", "",
- "r0b", "r1b", "r2b", "r3b", "r4b", "r5b", "r6b", "r7b",
+ "r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7", "r8", "r9",
+ "r10", "r11", "r12", "r13", "r14", "r15", "pc", "pr", "gbr", "vbr",
+ "mach", "macl", "sr", "", "dsr", "a0g", "a0", "a1g", "a1", "m0",
+ "m1", "x0", "x1", "y0", "y1", "", "", "", "", "",
+ "mod", "ssr", "spc", "rs", "re", "", "", "", "", "",
+ "", "r0b", "r1b", "r2b", "r3b", "r4b", "r5b", "r6b", "r7b",
};
if (reg_nr >= ARRAY_SIZE (register_names))
return "";
@@ -292,15 +337,15 @@ sh_sh4_register_name (struct gdbarch *gdbarch, int reg_nr)
{
static const char *register_names[] = {
/* general registers 0-15 */
- "r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7",
- "r8", "r9", "r10", "r11", "r12", "r13", "r14", "r15",
+ "r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7", "r8", "r9", "r10", "r11",
+ "r12", "r13", "r14", "r15",
/* 16 - 22 */
"pc", "pr", "gbr", "vbr", "mach", "macl", "sr",
/* 23, 24 */
"fpul", "fpscr",
/* floating point registers 25 - 40 */
- "fr0", "fr1", "fr2", "fr3", "fr4", "fr5", "fr6", "fr7",
- "fr8", "fr9", "fr10", "fr11", "fr12", "fr13", "fr14", "fr15",
+ "fr0", "fr1", "fr2", "fr3", "fr4", "fr5", "fr6", "fr7", "fr8", "fr9",
+ "fr10", "fr11", "fr12", "fr13", "fr14", "fr15",
/* 41, 42 */
"ssr", "spc",
/* bank 0 43 - 50 */
@@ -328,15 +373,14 @@ sh_sh4_nofpu_register_name (struct gdbarch *gdbarch, int reg_nr)
{
static const char *register_names[] = {
/* general registers 0-15 */
- "r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7",
- "r8", "r9", "r10", "r11", "r12", "r13", "r14", "r15",
+ "r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7", "r8", "r9", "r10", "r11",
+ "r12", "r13", "r14", "r15",
/* 16 - 22 */
"pc", "pr", "gbr", "vbr", "mach", "macl", "sr",
/* 23, 24 */
"", "",
/* floating point registers 25 - 40 -- not for nofpu target */
- "", "", "", "", "", "", "", "",
- "", "", "", "", "", "", "", "",
+ "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
/* 41, 42 */
"ssr", "spc",
/* bank 0 43 - 50 */
@@ -361,15 +405,12 @@ static const char *
sh_sh4al_dsp_register_name (struct gdbarch *gdbarch, int reg_nr)
{
static const char *register_names[] = {
- "r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7",
- "r8", "r9", "r10", "r11", "r12", "r13", "r14", "r15",
- "pc", "pr", "gbr", "vbr", "mach", "macl", "sr",
- "", "dsr",
- "a0g", "a0", "a1g", "a1", "m0", "m1", "x0", "x1",
- "y0", "y1", "", "", "", "", "", "mod",
- "ssr", "spc",
- "rs", "re", "", "", "", "", "", "",
- "r0b", "r1b", "r2b", "r3b", "r4b", "r5b", "r6b", "r7b",
+ "r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7", "r8", "r9",
+ "r10", "r11", "r12", "r13", "r14", "r15", "pc", "pr", "gbr", "vbr",
+ "mach", "macl", "sr", "", "dsr", "a0g", "a0", "a1g", "a1", "m0",
+ "m1", "x0", "x1", "y0", "y1", "", "", "", "", "",
+ "mod", "ssr", "spc", "rs", "re", "", "", "", "", "",
+ "", "r0b", "r1b", "r2b", "r3b", "r4b", "r5b", "r6b", "r7b",
};
if (reg_nr >= ARRAY_SIZE (register_names))
return "";
@@ -421,38 +462,38 @@ sh_sw_breakpoint_from_kind (struct gdbarch *gdbarch, int kind, int *size)
Actually it can be more complicated than this but that's it, basically. */
-#define GET_SOURCE_REG(x) (((x) >> 4) & 0xf)
-#define GET_TARGET_REG(x) (((x) >> 8) & 0xf)
+#define GET_SOURCE_REG(x) (((x) >> 4) & 0xf)
+#define GET_TARGET_REG(x) (((x) >> 8) & 0xf)
/* JSR @Rm 0100mmmm00001011 */
-#define IS_JSR(x) (((x) & 0xf0ff) == 0x400b)
+#define IS_JSR(x) (((x) &0xf0ff) == 0x400b)
/* STS.L PR,@-r15 0100111100100010
r15-4-->r15, PR-->(r15) */
-#define IS_STS(x) ((x) == 0x4f22)
+#define IS_STS(x) ((x) == 0x4f22)
/* STS.L MACL,@-r15 0100111100010010
r15-4-->r15, MACL-->(r15) */
-#define IS_MACL_STS(x) ((x) == 0x4f12)
+#define IS_MACL_STS(x) ((x) == 0x4f12)
/* MOV.L Rm,@-r15 00101111mmmm0110
r15-4-->r15, Rm-->(R15) */
-#define IS_PUSH(x) (((x) & 0xff0f) == 0x2f06)
+#define IS_PUSH(x) (((x) &0xff0f) == 0x2f06)
/* MOV r15,r14 0110111011110011
r15-->r14 */
-#define IS_MOV_SP_FP(x) ((x) == 0x6ef3)
+#define IS_MOV_SP_FP(x) ((x) == 0x6ef3)
/* ADD #imm,r15 01111111iiiiiiii
r15+imm-->r15 */
-#define IS_ADD_IMM_SP(x) (((x) & 0xff00) == 0x7f00)
+#define IS_ADD_IMM_SP(x) (((x) &0xff00) == 0x7f00)
-#define IS_MOV_R3(x) (((x) & 0xff00) == 0x1a00)
-#define IS_SHLL_R3(x) ((x) == 0x4300)
+#define IS_MOV_R3(x) (((x) &0xff00) == 0x1a00)
+#define IS_SHLL_R3(x) ((x) == 0x4300)
/* ADD r3,r15 0011111100111100
r15+r3-->r15 */
-#define IS_ADD_R3SP(x) ((x) == 0x3f3c)
+#define IS_ADD_R3SP(x) ((x) == 0x3f3c)
/* FMOV.S FRm,@-Rn Rn-4-->Rn, FRm-->(Rn) 1111nnnnmmmm1011
FMOV DRm,@-Rn Rn-8-->Rn, DRm-->(Rn) 1111nnnnmmm01011
@@ -460,47 +501,43 @@ sh_sw_breakpoint_from_kind (struct gdbarch *gdbarch, int kind, int *size)
/* CV, 2003-08-28: Only suitable with Rn == SP, therefore name changed to
make this entirely clear. */
/* #define IS_FMOV(x) (((x) & 0xf00f) == 0xf00b) */
-#define IS_FPUSH(x) (((x) & 0xff0f) == 0xff0b)
+#define IS_FPUSH(x) (((x) &0xff0f) == 0xff0b)
/* MOV Rm,Rn Rm-->Rn 0110nnnnmmmm0011 4 <= m <= 7 */
-#define IS_MOV_ARG_TO_REG(x) \
- (((x) & 0xf00f) == 0x6003 && \
- ((x) & 0x00f0) >= 0x0040 && \
- ((x) & 0x00f0) <= 0x0070)
+#define IS_MOV_ARG_TO_REG(x) \
+ (((x) &0xf00f) == 0x6003 && ((x) &0x00f0) >= 0x0040 \
+ && ((x) &0x00f0) <= 0x0070)
/* MOV.L Rm,@Rn 0010nnnnmmmm0010 n = 14, 4 <= m <= 7 */
-#define IS_MOV_ARG_TO_IND_R14(x) \
- (((x) & 0xff0f) == 0x2e02 && \
- ((x) & 0x00f0) >= 0x0040 && \
- ((x) & 0x00f0) <= 0x0070)
+#define IS_MOV_ARG_TO_IND_R14(x) \
+ (((x) &0xff0f) == 0x2e02 && ((x) &0x00f0) >= 0x0040 \
+ && ((x) &0x00f0) <= 0x0070)
/* MOV.L Rm,@(disp*4,Rn) 00011110mmmmdddd n = 14, 4 <= m <= 7 */
-#define IS_MOV_ARG_TO_IND_R14_WITH_DISP(x) \
- (((x) & 0xff00) == 0x1e00 && \
- ((x) & 0x00f0) >= 0x0040 && \
- ((x) & 0x00f0) <= 0x0070)
+#define IS_MOV_ARG_TO_IND_R14_WITH_DISP(x) \
+ (((x) &0xff00) == 0x1e00 && ((x) &0x00f0) >= 0x0040 \
+ && ((x) &0x00f0) <= 0x0070)
/* MOV.W @(disp*2,PC),Rn 1001nnnndddddddd */
-#define IS_MOVW_PCREL_TO_REG(x) (((x) & 0xf000) == 0x9000)
+#define IS_MOVW_PCREL_TO_REG(x) (((x) &0xf000) == 0x9000)
/* MOV.L @(disp*4,PC),Rn 1101nnnndddddddd */
-#define IS_MOVL_PCREL_TO_REG(x) (((x) & 0xf000) == 0xd000)
+#define IS_MOVL_PCREL_TO_REG(x) (((x) &0xf000) == 0xd000)
/* MOVI20 #imm20,Rn 0000nnnniiii0000 */
-#define IS_MOVI20(x) (((x) & 0xf00f) == 0x0000)
+#define IS_MOVI20(x) (((x) &0xf00f) == 0x0000)
/* SUB Rn,R15 00111111nnnn1000 */
-#define IS_SUB_REG_FROM_SP(x) (((x) & 0xff0f) == 0x3f08)
+#define IS_SUB_REG_FROM_SP(x) (((x) &0xff0f) == 0x3f08)
-#define FPSCR_SZ (1 << 20)
+#define FPSCR_SZ (1 << 20)
/* The following instructions are used for epilogue testing. */
-#define IS_RESTORE_FP(x) ((x) == 0x6ef6)
-#define IS_RTS(x) ((x) == 0x000b)
-#define IS_LDS(x) ((x) == 0x4f26)
-#define IS_MACL_LDS(x) ((x) == 0x4f16)
-#define IS_MOV_FP_SP(x) ((x) == 0x6fe3)
-#define IS_ADD_REG_TO_FP(x) (((x) & 0xff0f) == 0x3e0c)
-#define IS_ADD_IMM_FP(x) (((x) & 0xff00) == 0x7e00)
+#define IS_RESTORE_FP(x) ((x) == 0x6ef6)
+#define IS_RTS(x) ((x) == 0x000b)
+#define IS_LDS(x) ((x) == 0x4f26)
+#define IS_MACL_LDS(x) ((x) == 0x4f16)
+#define IS_MOV_FP_SP(x) ((x) == 0x6fe3)
+#define IS_ADD_REG_TO_FP(x) (((x) &0xff0f) == 0x3e0c)
+#define IS_ADD_IMM_FP(x) (((x) &0xff00) == 0x7e00)
static CORE_ADDR
-sh_analyze_prologue (struct gdbarch *gdbarch,
- CORE_ADDR pc, CORE_ADDR limit_pc,
+sh_analyze_prologue (struct gdbarch *gdbarch, CORE_ADDR pc, CORE_ADDR limit_pc,
struct sh_frame_cache *cache, ULONGEST fpscr)
{
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
@@ -556,8 +593,8 @@ sh_analyze_prologue (struct gdbarch *gdbarch,
{
sav_reg = reg;
offset = (inst & 0xff) << 1;
- sav_offset =
- read_memory_integer ((pc + 4) + offset, 2, byte_order);
+ sav_offset
+ = read_memory_integer ((pc + 4) + offset, 2, byte_order);
}
}
}
@@ -570,14 +607,13 @@ sh_analyze_prologue (struct gdbarch *gdbarch,
{
sav_reg = reg;
offset = (inst & 0xff) << 2;
- sav_offset =
- read_memory_integer (((pc & 0xfffffffc) + 4) + offset,
- 4, byte_order);
+ sav_offset
+ = read_memory_integer (((pc & 0xfffffffc) + 4) + offset, 4,
+ byte_order);
}
}
}
- else if (IS_MOVI20 (inst)
- && (pc + 2 < limit_pc))
+ else if (IS_MOVI20 (inst) && (pc + 2 < limit_pc))
{
if (sav_reg < 0)
{
@@ -669,7 +705,7 @@ sh_analyze_prologue (struct gdbarch *gdbarch,
}
break;
}
-#if 0 /* This used to just stop when it found an instruction
+#if 0 /* This used to just stop when it found an instruction
that was not considered part of the prologue. Now,
we just keep going looking for likely
instructions. */
@@ -776,8 +812,9 @@ sh_use_struct_convention (int renesas_abi, struct type *type)
int nelem = type->num_fields ();
/* The Renesas ABI returns aggregate types always on stack. */
- if (renesas_abi && (type->code () == TYPE_CODE_STRUCT
- || type->code () == TYPE_CODE_UNION))
+ if (renesas_abi
+ && (type->code () == TYPE_CODE_STRUCT
+ || type->code () == TYPE_CODE_UNION))
return 1;
/* Non-power of 2 length types and types bigger than 8 bytes (which don't
@@ -1017,12 +1054,10 @@ sh_treat_as_flt_p (struct type *type)
}
static CORE_ADDR
-sh_push_dummy_call_fpu (struct gdbarch *gdbarch,
- struct value *function,
- struct regcache *regcache,
- CORE_ADDR bp_addr, int nargs,
- struct value **args,
- CORE_ADDR sp, function_call_return_method return_method,
+sh_push_dummy_call_fpu (struct gdbarch *gdbarch, struct value *function,
+ struct regcache *regcache, CORE_ADDR bp_addr,
+ int nargs, struct value **args, CORE_ADDR sp,
+ function_call_return_method return_method,
CORE_ADDR struct_addr)
{
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
@@ -1088,8 +1123,7 @@ sh_push_dummy_call_fpu (struct gdbarch *gdbarch,
while (len > 0)
{
if ((treat_as_flt && flt_argreg > FLOAT_ARGLAST_REGNUM)
- || (!treat_as_flt && (argreg > ARGLAST_REGNUM
- || pass_on_stack))
+ || (!treat_as_flt && (argreg > ARGLAST_REGNUM || pass_on_stack))
|| argnum > last_reg_arg)
{
/* The data goes entirely on the stack, 4-byte aligned. */
@@ -1116,8 +1150,8 @@ sh_push_dummy_call_fpu (struct gdbarch *gdbarch,
regval);
val += reg_size;
len -= reg_size;
- regval = extract_unsigned_integer (val, reg_size,
- byte_order);
+ regval
+ = extract_unsigned_integer (val, reg_size, byte_order);
}
regcache_cooked_write_unsigned (regcache, flt_argreg++, regval);
}
@@ -1144,27 +1178,23 @@ sh_push_dummy_call_fpu (struct gdbarch *gdbarch,
else
/* Using the gcc ABI, the "struct return pointer" pseudo-argument has
its own dedicated register. */
- regcache_cooked_write_unsigned (regcache,
- STRUCT_RETURN_REGNUM, struct_addr);
+ regcache_cooked_write_unsigned (regcache, STRUCT_RETURN_REGNUM,
+ struct_addr);
}
/* Store return address. */
regcache_cooked_write_unsigned (regcache, PR_REGNUM, bp_addr);
/* Update stack pointer. */
- regcache_cooked_write_unsigned (regcache,
- gdbarch_sp_regnum (gdbarch), sp);
+ regcache_cooked_write_unsigned (regcache, gdbarch_sp_regnum (gdbarch), sp);
return sp;
}
static CORE_ADDR
-sh_push_dummy_call_nofpu (struct gdbarch *gdbarch,
- struct value *function,
- struct regcache *regcache,
- CORE_ADDR bp_addr,
- int nargs, struct value **args,
- CORE_ADDR sp,
+sh_push_dummy_call_nofpu (struct gdbarch *gdbarch, struct value *function,
+ struct regcache *regcache, CORE_ADDR bp_addr,
+ int nargs, struct value **args, CORE_ADDR sp,
function_call_return_method return_method,
CORE_ADDR struct_addr)
{
@@ -1248,16 +1278,15 @@ sh_push_dummy_call_nofpu (struct gdbarch *gdbarch,
else
/* Using the gcc ABI, the "struct return pointer" pseudo-argument has
its own dedicated register. */
- regcache_cooked_write_unsigned (regcache,
- STRUCT_RETURN_REGNUM, struct_addr);
+ regcache_cooked_write_unsigned (regcache, STRUCT_RETURN_REGNUM,
+ struct_addr);
}
/* Store return address. */
regcache_cooked_write_unsigned (regcache, PR_REGNUM, bp_addr);
/* Update stack pointer. */
- regcache_cooked_write_unsigned (regcache,
- gdbarch_sp_regnum (gdbarch), sp);
+ regcache_cooked_write_unsigned (regcache, gdbarch_sp_regnum (gdbarch), sp);
return sp;
}
@@ -1288,7 +1317,7 @@ sh_extract_return_value_nofpu (struct type *type, struct regcache *regcache,
regcache->raw_read (regnum++, valbuf + i);
}
else
- error (_("bad size for return value"));
+ error (_ ("bad size for return value"));
}
static void
@@ -1302,8 +1331,7 @@ sh_extract_return_value_fpu (struct type *type, struct regcache *regcache,
int i, regnum = gdbarch_fp0_regnum (gdbarch);
for (i = 0; i < len; i += 4)
if (gdbarch_byte_order (gdbarch) == BFD_ENDIAN_LITTLE)
- regcache->raw_read (regnum++,
- valbuf + len - 4 - i);
+ regcache->raw_read (regnum++, valbuf + len - 4 - i);
else
regcache->raw_read (regnum++, valbuf + i);
}
@@ -1350,8 +1378,7 @@ sh_store_return_value_fpu (struct type *type, struct regcache *regcache,
int i, regnum = gdbarch_fp0_regnum (gdbarch);
for (i = 0; i < len; i += 4)
if (gdbarch_byte_order (gdbarch) == BFD_ENDIAN_LITTLE)
- regcache->raw_write (regnum++,
- valbuf + len - 4 - i);
+ regcache->raw_write (regnum++, valbuf + len - 4 - i);
else
regcache->raw_write (regnum++, valbuf + i);
}
@@ -1366,8 +1393,8 @@ sh_return_value_nofpu (struct gdbarch *gdbarch, struct value *function,
{
struct type *func_type = function ? value_type (function) : NULL;
- if (sh_use_struct_convention_nofpu
- (sh_is_renesas_calling_convention (func_type), type))
+ if (sh_use_struct_convention_nofpu (
+ sh_is_renesas_calling_convention (func_type), type))
return RETURN_VALUE_STRUCT_CONVENTION;
if (writebuf)
sh_store_return_value_nofpu (type, regcache, writebuf);
@@ -1383,8 +1410,8 @@ sh_return_value_fpu (struct gdbarch *gdbarch, struct value *function,
{
struct type *func_type = function ? value_type (function) : NULL;
- if (sh_use_struct_convention (
- sh_is_renesas_calling_convention (func_type), type))
+ if (sh_use_struct_convention (sh_is_renesas_calling_convention (func_type),
+ type))
return RETURN_VALUE_STRUCT_CONVENTION;
if (writebuf)
sh_store_return_value_fpu (type, regcache, writebuf);
@@ -1396,8 +1423,8 @@ sh_return_value_fpu (struct gdbarch *gdbarch, struct value *function,
static struct type *
sh_sh2a_register_type (struct gdbarch *gdbarch, int reg_nr)
{
- if ((reg_nr >= gdbarch_fp0_regnum (gdbarch)
- && (reg_nr <= FP_LAST_REGNUM)) || (reg_nr == FPUL_REGNUM))
+ if ((reg_nr >= gdbarch_fp0_regnum (gdbarch) && (reg_nr <= FP_LAST_REGNUM))
+ || (reg_nr == FPUL_REGNUM))
return builtin_type (gdbarch)->builtin_float;
else if (reg_nr >= DR0_REGNUM && reg_nr <= DR_LAST_REGNUM)
return builtin_type (gdbarch)->builtin_double;
@@ -1410,8 +1437,8 @@ sh_sh2a_register_type (struct gdbarch *gdbarch, int reg_nr)
static struct type *
sh_sh3e_register_type (struct gdbarch *gdbarch, int reg_nr)
{
- if ((reg_nr >= gdbarch_fp0_regnum (gdbarch)
- && (reg_nr <= FP_LAST_REGNUM)) || (reg_nr == FPUL_REGNUM))
+ if ((reg_nr >= gdbarch_fp0_regnum (gdbarch) && (reg_nr <= FP_LAST_REGNUM))
+ || (reg_nr == FPUL_REGNUM))
return builtin_type (gdbarch)->builtin_float;
else
return builtin_type (gdbarch)->builtin_int;
@@ -1420,15 +1447,15 @@ sh_sh3e_register_type (struct gdbarch *gdbarch, int reg_nr)
static struct type *
sh_sh4_build_float_register_type (struct gdbarch *gdbarch, int high)
{
- return lookup_array_range_type (builtin_type (gdbarch)->builtin_float,
- 0, high);
+ return lookup_array_range_type (builtin_type (gdbarch)->builtin_float, 0,
+ high);
}
static struct type *
sh_sh4_register_type (struct gdbarch *gdbarch, int reg_nr)
{
- if ((reg_nr >= gdbarch_fp0_regnum (gdbarch)
- && (reg_nr <= FP_LAST_REGNUM)) || (reg_nr == FPUL_REGNUM))
+ if ((reg_nr >= gdbarch_fp0_regnum (gdbarch) && (reg_nr <= FP_LAST_REGNUM))
+ || (reg_nr == FPUL_REGNUM))
return builtin_type (gdbarch)->builtin_float;
else if (reg_nr >= DR0_REGNUM && reg_nr <= DR_LAST_REGNUM)
return builtin_type (gdbarch)->builtin_double;
@@ -1456,8 +1483,7 @@ sh_register_reggroup_p (struct gdbarch *gdbarch, int regnum,
return 0;
if (reggroup == float_reggroup
- && (regnum == FPUL_REGNUM
- || regnum == FPSCR_REGNUM))
+ && (regnum == FPUL_REGNUM || regnum == FPSCR_REGNUM))
return 1;
if (regnum >= FV0_REGNUM && regnum <= FV_LAST_REGNUM)
@@ -1468,11 +1494,8 @@ sh_register_reggroup_p (struct gdbarch *gdbarch, int regnum,
return 0;
}
- if (regnum == VBR_REGNUM
- || regnum == SR_REGNUM
- || regnum == FPSCR_REGNUM
- || regnum == SSR_REGNUM
- || regnum == SPC_REGNUM)
+ if (regnum == VBR_REGNUM || regnum == SR_REGNUM || regnum == FPSCR_REGNUM
+ || regnum == SSR_REGNUM || regnum == SPC_REGNUM)
{
if (reggroup == system_reggroup)
return 1;
@@ -1525,7 +1548,8 @@ sh_littlebyte_bigword_type (struct gdbarch *gdbarch)
static void
sh_register_convert_to_virtual (struct gdbarch *gdbarch, int regnum,
- struct type *type, gdb_byte *from, gdb_byte *to)
+ struct type *type, gdb_byte *from,
+ gdb_byte *to)
{
if (gdbarch_byte_order (gdbarch) != BFD_ENDIAN_LITTLE)
{
@@ -1535,11 +1559,11 @@ sh_register_convert_to_virtual (struct gdbarch *gdbarch, int regnum,
}
if (regnum >= DR0_REGNUM && regnum <= DR_LAST_REGNUM)
- target_float_convert (from, sh_littlebyte_bigword_type (gdbarch),
- to, type);
+ target_float_convert (from, sh_littlebyte_bigword_type (gdbarch), to,
+ type);
else
- error
- ("sh_register_convert_to_virtual called with non DR register number");
+ error (
+ "sh_register_convert_to_virtual called with non DR register number");
}
static void
@@ -1554,10 +1578,11 @@ sh_register_convert_to_raw (struct gdbarch *gdbarch, struct type *type,
}
if (regnum >= DR0_REGNUM && regnum <= DR_LAST_REGNUM)
- target_float_convert (from, type,
- to, sh_littlebyte_bigword_type (gdbarch));
+ target_float_convert (from, type, to,
+ sh_littlebyte_bigword_type (gdbarch));
else
- error (_("sh_register_convert_to_raw called with non DR register number"));
+ error (
+ _ ("sh_register_convert_to_raw called with non DR register number"));
}
/* For vectors of 4 floating point registers. */
@@ -1566,8 +1591,7 @@ fv_reg_base_num (struct gdbarch *gdbarch, int fv_regnum)
{
int fp_regnum;
- fp_regnum = gdbarch_fp0_regnum (gdbarch)
- + (fv_regnum - FV0_REGNUM) * 4;
+ fp_regnum = gdbarch_fp0_regnum (gdbarch) + (fv_regnum - FV0_REGNUM) * 4;
return fp_regnum;
}
@@ -1577,8 +1601,7 @@ dr_reg_base_num (struct gdbarch *gdbarch, int dr_regnum)
{
int fp_regnum;
- fp_regnum = gdbarch_fp0_regnum (gdbarch)
- + (dr_regnum - DR0_REGNUM) * 2;
+ fp_regnum = gdbarch_fp0_regnum (gdbarch) + (dr_regnum - DR0_REGNUM) * 2;
return fp_regnum;
}
@@ -1587,8 +1610,7 @@ dr_reg_base_num (struct gdbarch *gdbarch, int dr_regnum)
static enum register_status
pseudo_register_read_portions (struct gdbarch *gdbarch,
- readable_regcache *regcache,
- int portions,
+ readable_regcache *regcache, int portions,
int base_regnum, gdb_byte *buffer)
{
int portion;
@@ -1624,8 +1646,8 @@ sh_pseudo_register_read (struct gdbarch *gdbarch, readable_regcache *regcache,
/* Build the value in the provided buffer. */
/* Read the real regs for which this one is an alias. */
- status = pseudo_register_read_portions (gdbarch, regcache,
- 2, base_regnum, temp_buffer);
+ status = pseudo_register_read_portions (gdbarch, regcache, 2,
+ base_regnum, temp_buffer);
if (status == REG_VALID)
{
/* We must pay attention to the endianness. */
@@ -1640,8 +1662,8 @@ sh_pseudo_register_read (struct gdbarch *gdbarch, readable_regcache *regcache,
base_regnum = fv_reg_base_num (gdbarch, reg_nr);
/* Read the real regs for which this one is an alias. */
- return pseudo_register_read_portions (gdbarch, regcache,
- 4, base_regnum, buffer);
+ return pseudo_register_read_portions (gdbarch, regcache, 4, base_regnum,
+ buffer);
}
else
gdb_assert_not_reached ("invalid pseudo register number");
@@ -1677,10 +1699,9 @@ sh_pseudo_register_write (struct gdbarch *gdbarch, struct regcache *regcache,
/* Write the real regs for which this one is an alias. */
for (portion = 0; portion < 2; portion++)
- regcache->raw_write (base_regnum + portion,
- (temp_buffer
- + register_size (gdbarch,
- base_regnum) * portion));
+ regcache->raw_write (
+ base_regnum + portion,
+ (temp_buffer + register_size (gdbarch, base_regnum) * portion));
}
else if (reg_nr >= FV0_REGNUM && reg_nr <= FV_LAST_REGNUM)
{
@@ -1688,10 +1709,9 @@ sh_pseudo_register_write (struct gdbarch *gdbarch, struct regcache *regcache,
/* Write the real regs for which this one is an alias. */
for (portion = 0; portion < 4; portion++)
- regcache->raw_write (base_regnum + portion,
- (buffer
- + register_size (gdbarch,
- base_regnum) * portion));
+ regcache->raw_write (
+ base_regnum + portion,
+ (buffer + register_size (gdbarch, base_regnum) * portion));
}
}
@@ -1718,26 +1738,26 @@ sh_sh2a_register_sim_regno (struct gdbarch *gdbarch, int nr)
{
switch (nr)
{
- case TBR_REGNUM:
- return SIM_SH_TBR_REGNUM;
- case IBNR_REGNUM:
- return SIM_SH_IBNR_REGNUM;
- case IBCR_REGNUM:
- return SIM_SH_IBCR_REGNUM;
- case BANK_REGNUM:
- return SIM_SH_BANK_REGNUM;
- case MACLB_REGNUM:
- return SIM_SH_BANK_MACL_REGNUM;
- case GBRB_REGNUM:
- return SIM_SH_BANK_GBR_REGNUM;
- case PRB_REGNUM:
- return SIM_SH_BANK_PR_REGNUM;
- case IVNB_REGNUM:
- return SIM_SH_BANK_IVN_REGNUM;
- case MACHB_REGNUM:
- return SIM_SH_BANK_MACH_REGNUM;
- default:
- break;
+ case TBR_REGNUM:
+ return SIM_SH_TBR_REGNUM;
+ case IBNR_REGNUM:
+ return SIM_SH_IBNR_REGNUM;
+ case IBCR_REGNUM:
+ return SIM_SH_IBCR_REGNUM;
+ case BANK_REGNUM:
+ return SIM_SH_BANK_REGNUM;
+ case MACLB_REGNUM:
+ return SIM_SH_BANK_MACL_REGNUM;
+ case GBRB_REGNUM:
+ return SIM_SH_BANK_GBR_REGNUM;
+ case PRB_REGNUM:
+ return SIM_SH_BANK_PR_REGNUM;
+ case IVNB_REGNUM:
+ return SIM_SH_BANK_IVN_REGNUM;
+ case MACHB_REGNUM:
+ return SIM_SH_BANK_MACH_REGNUM;
+ default:
+ break;
}
return legacy_register_sim_regno (gdbarch, nr);
}
@@ -1766,30 +1786,26 @@ sh_dwarf2_frame_init_reg (struct gdbarch *gdbarch, int regnum,
while the below is SH specific. */
/* Caller save registers. */
- else if ((regnum >= R0_REGNUM && regnum <= R0_REGNUM+7)
- || (regnum >= FR0_REGNUM && regnum <= FR0_REGNUM+11)
- || (regnum >= DR0_REGNUM && regnum <= DR0_REGNUM+5)
- || (regnum >= FV0_REGNUM && regnum <= FV0_REGNUM+2)
- || (regnum == MACH_REGNUM)
- || (regnum == MACL_REGNUM)
- || (regnum == FPUL_REGNUM)
- || (regnum == SR_REGNUM))
+ else if ((regnum >= R0_REGNUM && regnum <= R0_REGNUM + 7)
+ || (regnum >= FR0_REGNUM && regnum <= FR0_REGNUM + 11)
+ || (regnum >= DR0_REGNUM && regnum <= DR0_REGNUM + 5)
+ || (regnum >= FV0_REGNUM && regnum <= FV0_REGNUM + 2)
+ || (regnum == MACH_REGNUM) || (regnum == MACL_REGNUM)
+ || (regnum == FPUL_REGNUM) || (regnum == SR_REGNUM))
reg->how = DWARF2_FRAME_REG_UNDEFINED;
/* Callee save registers. */
- else if ((regnum >= R0_REGNUM+8 && regnum <= R0_REGNUM+15)
- || (regnum >= FR0_REGNUM+12 && regnum <= FR0_REGNUM+15)
- || (regnum >= DR0_REGNUM+6 && regnum <= DR0_REGNUM+8)
- || (regnum == FV0_REGNUM+3))
+ else if ((regnum >= R0_REGNUM + 8 && regnum <= R0_REGNUM + 15)
+ || (regnum >= FR0_REGNUM + 12 && regnum <= FR0_REGNUM + 15)
+ || (regnum >= DR0_REGNUM + 6 && regnum <= DR0_REGNUM + 8)
+ || (regnum == FV0_REGNUM + 3))
reg->how = DWARF2_FRAME_REG_SAME_VALUE;
/* Other registers. These are not in the ABI and may or may not
mean anything in frames >0 so don't show them. */
- else if ((regnum >= R0_BANK0_REGNUM && regnum <= R0_BANK0_REGNUM+15)
- || (regnum == GBR_REGNUM)
- || (regnum == VBR_REGNUM)
- || (regnum == FPSCR_REGNUM)
- || (regnum == SSR_REGNUM)
+ else if ((regnum >= R0_BANK0_REGNUM && regnum <= R0_BANK0_REGNUM + 15)
+ || (regnum == GBR_REGNUM) || (regnum == VBR_REGNUM)
+ || (regnum == FPSCR_REGNUM) || (regnum == SSR_REGNUM)
|| (regnum == SPC_REGNUM))
reg->how = DWARF2_FRAME_REG_UNDEFINED;
}
@@ -1871,8 +1887,8 @@ sh_frame_cache (frame_info_ptr this_frame, void **this_cache)
setup yet. Try to reconstruct the base address for the stack
frame by looking at the stack pointer. For truly "frameless"
functions this might work too. */
- cache->base = get_frame_register_unsigned
- (this_frame, gdbarch_sp_regnum (gdbarch));
+ cache->base = get_frame_register_unsigned (this_frame,
+ gdbarch_sp_regnum (gdbarch));
}
/* Now that we have the base address for the stack frame we can
@@ -1889,8 +1905,8 @@ sh_frame_cache (frame_info_ptr this_frame, void **this_cache)
}
static struct value *
-sh_frame_prev_register (frame_info_ptr this_frame,
- void **this_cache, int regnum)
+sh_frame_prev_register (frame_info_ptr this_frame, void **this_cache,
+ int regnum)
{
struct gdbarch *gdbarch = get_frame_arch (this_frame);
struct sh_frame_cache *cache = sh_frame_cache (this_frame, this_cache);
@@ -1926,15 +1942,14 @@ sh_frame_this_id (frame_info_ptr this_frame, void **this_cache,
*this_id = frame_id_build (cache->saved_sp, cache->pc);
}
-static const struct frame_unwind sh_frame_unwind = {
- "sh prologue",
- NORMAL_FRAME,
- default_frame_unwind_stop_reason,
- sh_frame_this_id,
- sh_frame_prev_register,
- NULL,
- default_frame_sniffer
-};
+static const struct frame_unwind sh_frame_unwind
+ = { "sh prologue",
+ NORMAL_FRAME,
+ default_frame_unwind_stop_reason,
+ sh_frame_this_id,
+ sh_frame_prev_register,
+ NULL,
+ default_frame_sniffer };
static CORE_ADDR
sh_frame_base_address (frame_info_ptr this_frame, void **this_cache)
@@ -1944,12 +1959,9 @@ sh_frame_base_address (frame_info_ptr this_frame, void **this_cache)
return cache->base;
}
-static const struct frame_base sh_frame_base = {
- &sh_frame_unwind,
- sh_frame_base_address,
- sh_frame_base_address,
- sh_frame_base_address
-};
+static const struct frame_base sh_frame_base
+ = { &sh_frame_unwind, sh_frame_base_address, sh_frame_base_address,
+ sh_frame_base_address };
static struct sh_frame_cache *
sh_make_stub_cache (frame_info_ptr this_frame)
@@ -1980,8 +1992,7 @@ sh_stub_this_id (frame_info_ptr this_frame, void **this_cache,
static int
sh_stub_unwind_sniffer (const struct frame_unwind *self,
- frame_info_ptr this_frame,
- void **this_prologue_cache)
+ frame_info_ptr this_frame, void **this_prologue_cache)
{
CORE_ADDR addr_in_block;
@@ -1992,16 +2003,14 @@ sh_stub_unwind_sniffer (const struct frame_unwind *self,
return 0;
}
-static const struct frame_unwind sh_stub_unwind =
-{
- "sh stub",
- NORMAL_FRAME,
- default_frame_unwind_stop_reason,
- sh_stub_this_id,
- sh_frame_prev_register,
- NULL,
- sh_stub_unwind_sniffer
-};
+static const struct frame_unwind sh_stub_unwind
+ = { "sh stub",
+ NORMAL_FRAME,
+ default_frame_unwind_stop_reason,
+ sh_stub_this_id,
+ sh_frame_prev_register,
+ NULL,
+ sh_stub_unwind_sniffer };
/* Implement the stack_frame_destroyed_p gdbarch method.
@@ -2093,7 +2102,6 @@ sh_stack_frame_destroyed_p (struct gdbarch *gdbarch, CORE_ADDR pc)
return 0;
}
-
/* Supply register REGNUM from the buffer specified by REGS and LEN
in the register set REGSET to register cache REGCACHE.
REGTABLE specifies where each register can be found in REGS.
@@ -2101,22 +2109,22 @@ sh_stack_frame_destroyed_p (struct gdbarch *gdbarch, CORE_ADDR pc)
void
sh_corefile_supply_regset (const struct regset *regset,
- struct regcache *regcache,
- int regnum, const void *regs, size_t len)
+ struct regcache *regcache, int regnum,
+ const void *regs, size_t len)
{
struct gdbarch *gdbarch = regcache->arch ();
sh_gdbarch_tdep *tdep = gdbarch_tdep<sh_gdbarch_tdep> (gdbarch);
- const struct sh_corefile_regmap *regmap = (regset == &sh_corefile_gregset
- ? tdep->core_gregmap
- : tdep->core_fpregmap);
+ const struct sh_corefile_regmap *regmap
+ = (regset == &sh_corefile_gregset ? tdep->core_gregmap
+ : tdep->core_fpregmap);
int i;
for (i = 0; regmap[i].regnum != -1; i++)
{
if ((regnum == -1 || regnum == regmap[i].regnum)
&& regmap[i].offset + 4 <= len)
- regcache->raw_supply
- (regmap[i].regnum, (char *) regs + regmap[i].offset);
+ regcache->raw_supply (regmap[i].regnum,
+ (char *) regs + regmap[i].offset);
}
}
@@ -2127,14 +2135,14 @@ sh_corefile_supply_regset (const struct regset *regset,
void
sh_corefile_collect_regset (const struct regset *regset,
- const struct regcache *regcache,
- int regnum, void *regs, size_t len)
+ const struct regcache *regcache, int regnum,
+ void *regs, size_t len)
{
struct gdbarch *gdbarch = regcache->arch ();
sh_gdbarch_tdep *tdep = gdbarch_tdep<sh_gdbarch_tdep> (gdbarch);
- const struct sh_corefile_regmap *regmap = (regset == &sh_corefile_gregset
- ? tdep->core_gregmap
- : tdep->core_fpregmap);
+ const struct sh_corefile_regmap *regmap
+ = (regset == &sh_corefile_gregset ? tdep->core_gregmap
+ : tdep->core_fpregmap);
int i;
for (i = 0; regmap[i].regnum != -1; i++)
@@ -2142,26 +2150,18 @@ sh_corefile_collect_regset (const struct regset *regset,
if ((regnum == -1 || regnum == regmap[i].regnum)
&& regmap[i].offset + 4 <= len)
regcache->raw_collect (regmap[i].regnum,
- (char *)regs + regmap[i].offset);
+ (char *) regs + regmap[i].offset);
}
}
/* The following two regsets have the same contents, so it is tempting to
unify them, but they are distiguished by their address, so don't. */
-const struct regset sh_corefile_gregset =
-{
- NULL,
- sh_corefile_supply_regset,
- sh_corefile_collect_regset
-};
+const struct regset sh_corefile_gregset
+ = { NULL, sh_corefile_supply_regset, sh_corefile_collect_regset };
-static const struct regset sh_corefile_fpregset =
-{
- NULL,
- sh_corefile_supply_regset,
- sh_corefile_collect_regset
-};
+static const struct regset sh_corefile_fpregset
+ = { NULL, sh_corefile_supply_regset, sh_corefile_collect_regset };
static void
sh_iterate_over_regset_sections (struct gdbarch *gdbarch,
@@ -2184,14 +2184,11 @@ sh_iterate_over_regset_sections (struct gdbarch *gdbarch,
return_in_first_hidden_param_p. */
static int
-sh_return_in_first_hidden_param_p (struct gdbarch *gdbarch,
- struct type *type)
+sh_return_in_first_hidden_param_p (struct gdbarch *gdbarch, struct type *type)
{
return 0;
}
-
-
static struct gdbarch *
sh_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
{
@@ -2238,8 +2235,8 @@ sh_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
set_gdbarch_inner_than (gdbarch, core_addr_lessthan);
set_gdbarch_push_dummy_call (gdbarch, sh_push_dummy_call_nofpu);
- set_gdbarch_return_in_first_hidden_param_p (gdbarch,
- sh_return_in_first_hidden_param_p);
+ set_gdbarch_return_in_first_hidden_param_p (
+ gdbarch, sh_return_in_first_hidden_param_p);
set_gdbarch_believe_pcc_promotion (gdbarch, 1);
@@ -2250,8 +2247,8 @@ sh_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
dwarf2_frame_set_init_reg (gdbarch, sh_dwarf2_frame_init_reg);
- set_gdbarch_iterate_over_regset_sections
- (gdbarch, sh_iterate_over_regset_sections);
+ set_gdbarch_iterate_over_regset_sections (gdbarch,
+ sh_iterate_over_regset_sections);
switch (info.bfd_arch_info->mach)
{
@@ -2367,25 +2364,24 @@ sh_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
}
void _initialize_sh_tdep ();
+
void
_initialize_sh_tdep ()
{
gdbarch_register (bfd_arch_sh, sh_gdbarch_init, NULL);
- add_setshow_prefix_cmd ("sh", no_class,
- _("SH specific commands."),
- _("SH specific commands."),
- &setshcmdlist, &showshcmdlist,
- &setlist, &showlist);
-
- add_setshow_enum_cmd ("calling-convention", class_vars, sh_cc_enum,
- &sh_active_calling_convention,
- _("Set calling convention used when calling target "
- "functions from GDB."),
- _("Show calling convention used when calling target "
- "functions from GDB."),
- _("gcc - Use GCC calling convention (default).\n"
- "renesas - Enforce Renesas calling convention."),
- NULL, NULL,
- &setshcmdlist, &showshcmdlist);
+ add_setshow_prefix_cmd ("sh", no_class, _ ("SH specific commands."),
+ _ ("SH specific commands."), &setshcmdlist,
+ &showshcmdlist, &setlist, &showlist);
+
+ add_setshow_enum_cmd (
+ "calling-convention", class_vars, sh_cc_enum,
+ &sh_active_calling_convention,
+ _ ("Set calling convention used when calling target "
+ "functions from GDB."),
+ _ ("Show calling convention used when calling target "
+ "functions from GDB."),
+ _ ("gcc - Use GCC calling convention (default).\n"
+ "renesas - Enforce Renesas calling convention."),
+ NULL, NULL, &setshcmdlist, &showshcmdlist);
}
diff --git a/gdb/sh-tdep.h b/gdb/sh-tdep.h
index f1a79e488a8..4a24db26c76 100644
--- a/gdb/sh-tdep.h
+++ b/gdb/sh-tdep.h
@@ -25,64 +25,64 @@
/* Registers for all SH variants. Used also by sh3-rom.c. */
enum
- {
- R0_REGNUM = 0,
- STRUCT_RETURN_REGNUM = 2,
- ARG0_REGNUM = 4,
- ARGLAST_REGNUM = 7,
- FP_REGNUM = 14,
- PC_REGNUM = 16,
- PR_REGNUM = 17,
- GBR_REGNUM = 18,
- VBR_REGNUM = 19,
- MACH_REGNUM = 20,
- MACL_REGNUM = 21,
- SR_REGNUM = 22,
- FPUL_REGNUM = 23,
- /* Floating point registers */
- FPSCR_REGNUM = 24,
- FR0_REGNUM = 25,
- FLOAT_ARG0_REGNUM = 29,
- FLOAT_ARGLAST_REGNUM = 36,
- FP_LAST_REGNUM = 40,
- /* sh3,sh4 registers */
- SSR_REGNUM = 41,
- SPC_REGNUM = 42,
- /* DSP registers */
- DSR_REGNUM = 24,
- A0G_REGNUM = 25,
- A0_REGNUM = 26,
- A1G_REGNUM = 27,
- A1_REGNUM = 28,
- M0_REGNUM = 29,
- M1_REGNUM = 30,
- X0_REGNUM = 31,
- X1_REGNUM = 32,
- Y0_REGNUM = 33,
- Y1_REGNUM = 34,
- MOD_REGNUM = 40,
- RS_REGNUM = 43,
- RE_REGNUM = 44,
- DSP_R0_BANK_REGNUM = 51,
- DSP_R7_BANK_REGNUM = 58,
- /* sh2a register */
- R0_BANK0_REGNUM = 43,
- MACHB_REGNUM = 58,
- IVNB_REGNUM = 59,
- PRB_REGNUM = 60,
- GBRB_REGNUM = 61,
- MACLB_REGNUM = 62,
- BANK_REGNUM = 63,
- IBCR_REGNUM = 64,
- IBNR_REGNUM = 65,
- TBR_REGNUM = 66,
- PSEUDO_BANK_REGNUM = 67,
- /* Floating point pseudo registers */
- DR0_REGNUM = 68,
- DR_LAST_REGNUM = 75,
- FV0_REGNUM = 76,
- FV_LAST_REGNUM = 79
- };
+{
+ R0_REGNUM = 0,
+ STRUCT_RETURN_REGNUM = 2,
+ ARG0_REGNUM = 4,
+ ARGLAST_REGNUM = 7,
+ FP_REGNUM = 14,
+ PC_REGNUM = 16,
+ PR_REGNUM = 17,
+ GBR_REGNUM = 18,
+ VBR_REGNUM = 19,
+ MACH_REGNUM = 20,
+ MACL_REGNUM = 21,
+ SR_REGNUM = 22,
+ FPUL_REGNUM = 23,
+ /* Floating point registers */
+ FPSCR_REGNUM = 24,
+ FR0_REGNUM = 25,
+ FLOAT_ARG0_REGNUM = 29,
+ FLOAT_ARGLAST_REGNUM = 36,
+ FP_LAST_REGNUM = 40,
+ /* sh3,sh4 registers */
+ SSR_REGNUM = 41,
+ SPC_REGNUM = 42,
+ /* DSP registers */
+ DSR_REGNUM = 24,
+ A0G_REGNUM = 25,
+ A0_REGNUM = 26,
+ A1G_REGNUM = 27,
+ A1_REGNUM = 28,
+ M0_REGNUM = 29,
+ M1_REGNUM = 30,
+ X0_REGNUM = 31,
+ X1_REGNUM = 32,
+ Y0_REGNUM = 33,
+ Y1_REGNUM = 34,
+ MOD_REGNUM = 40,
+ RS_REGNUM = 43,
+ RE_REGNUM = 44,
+ DSP_R0_BANK_REGNUM = 51,
+ DSP_R7_BANK_REGNUM = 58,
+ /* sh2a register */
+ R0_BANK0_REGNUM = 43,
+ MACHB_REGNUM = 58,
+ IVNB_REGNUM = 59,
+ PRB_REGNUM = 60,
+ GBRB_REGNUM = 61,
+ MACLB_REGNUM = 62,
+ BANK_REGNUM = 63,
+ IBCR_REGNUM = 64,
+ IBNR_REGNUM = 65,
+ TBR_REGNUM = 66,
+ PSEUDO_BANK_REGNUM = 67,
+ /* Floating point pseudo registers */
+ DR0_REGNUM = 68,
+ DR_LAST_REGNUM = 75,
+ FV0_REGNUM = 76,
+ FV_LAST_REGNUM = 79
+};
/* This structure describes a register in a core-file. */
struct sh_corefile_regmap
@@ -110,9 +110,9 @@ struct sh_gdbarch_tdep : gdbarch_tdep_base
extern const struct regset sh_corefile_gregset;
void sh_corefile_supply_regset (const struct regset *regset,
- struct regcache *regcache,
- int regnum, const void *regs, size_t len);
+ struct regcache *regcache, int regnum,
+ const void *regs, size_t len);
void sh_corefile_collect_regset (const struct regset *regset,
- const struct regcache *regcache,
- int regnum, void *regs, size_t len);
+ const struct regcache *regcache, int regnum,
+ void *regs, size_t len);
#endif /* SH_TDEP_H */
diff --git a/gdb/sim-regno.h b/gdb/sim-regno.h
index aacfcf2449d..29be20f2306 100644
--- a/gdb/sim-regno.h
+++ b/gdb/sim-regno.h
@@ -27,7 +27,8 @@
cardinal. When there is no corresponding register, it returns a
negative value. */
-enum sim_regno {
+enum sim_regno
+{
/* Normal sane architecture. The simulator is known to not model
this register. */
SIM_REGNO_DOES_NOT_EXIST = -1,
diff --git a/gdb/skip.c b/gdb/skip.c
index f3b1bec9e4c..8841f1014f2 100644
--- a/gdb/skip.c
+++ b/gdb/skip.c
@@ -46,11 +46,10 @@ static bool debug_skip = false;
class skiplist_entry
{
public:
+
/* Create a skiplist_entry object and add it to the chain. */
- static void add_entry (bool file_is_glob,
- std::string &&file,
- bool function_is_regexp,
- std::string &&function);
+ static void add_entry (bool file_is_glob, std::string &&file,
+ bool function_is_regexp, std::string &&function);
/* Return true if the skip entry has a file or glob-style file
pattern that matches FUNCTION_SAL. */
@@ -62,14 +61,20 @@ public:
/* Getters. */
int number () const { return m_number; };
+
bool enabled () const { return m_enabled; };
+
bool file_is_glob () const { return m_file_is_glob; }
+
const std::string &file () const { return m_file; }
+
const std::string &function () const { return m_function; }
+
bool function_is_regexp () const { return m_function_is_regexp; }
/* Setters. */
void enable () { m_enabled = true; };
+
void disable () { m_enabled = false; };
/* Disable copy. */
@@ -77,9 +82,14 @@ public:
void operator= (const skiplist_entry &) = delete;
private:
+
/* Key that grants access to the constructor. */
- struct private_key {};
+ struct private_key
+ {
+ };
+
public:
+
/* Public so we can construct with container::emplace_back. Since
it requires a private class key, it can't be called from outside.
Use the add_entry static factory method to construct instead. */
@@ -88,6 +98,7 @@ public:
private_key);
private:
+
/* Return true if we're stopped at a file to be skipped. */
bool do_skip_file_p (const symtab_and_line &function_sal) const;
@@ -95,6 +106,7 @@ private:
bool do_skip_gfile_p (const symtab_and_line &function_sal) const;
private: /* data */
+
int m_number = -1;
/* True if FILE is a glob-style pattern.
@@ -122,11 +134,9 @@ private: /* data */
static std::list<skiplist_entry> skiplist_entries;
static int highest_skiplist_entry_num = 0;
-skiplist_entry::skiplist_entry (bool file_is_glob,
- std::string &&file,
+skiplist_entry::skiplist_entry (bool file_is_glob, std::string &&file,
bool function_is_regexp,
- std::string &&function,
- private_key)
+ std::string &&function, private_key)
: m_file_is_glob (file_is_glob),
m_file (std::move (file)),
m_function_is_regexp (function_is_regexp),
@@ -142,7 +152,7 @@ skiplist_entry::skiplist_entry (bool file_is_glob,
gdb_assert (!m_function.empty ());
m_compiled_function_regexp.emplace (m_function.c_str (),
REG_NOSUB | REG_EXTENDED,
- _("regexp"));
+ _ ("regexp"));
}
}
@@ -150,10 +160,8 @@ void
skiplist_entry::add_entry (bool file_is_glob, std::string &&file,
bool function_is_regexp, std::string &&function)
{
- skiplist_entries.emplace_back (file_is_glob,
- std::move (file),
- function_is_regexp,
- std::move (function),
+ skiplist_entries.emplace_back (file_is_glob, std::move (file),
+ function_is_regexp, std::move (function),
private_key {});
/* Incremented after push_back, in case push_back throws. */
@@ -172,7 +180,7 @@ skip_file_command (const char *arg, int from_tty)
{
symtab = get_last_displayed_symtab ();
if (symtab == NULL)
- error (_("No default file now."));
+ error (_ ("No default file now."));
/* It is not a typo, symtab_to_filename_for_display would be needlessly
ambiguous. */
@@ -181,10 +189,10 @@ skip_file_command (const char *arg, int from_tty)
else
filename = arg;
- skiplist_entry::add_entry (false, std::string (filename),
- false, std::string ());
+ skiplist_entry::add_entry (false, std::string (filename), false,
+ std::string ());
- gdb_printf (_("File %s will be skipped when stepping.\n"), filename);
+ gdb_printf (_ ("File %s will be skipped when stepping.\n"), filename);
}
/* Create a skiplist entry for the given function NAME and add it to the
@@ -195,7 +203,7 @@ skip_function (const char *name)
{
skiplist_entry::add_entry (false, std::string (), false, std::string (name));
- gdb_printf (_("Function %s will be skipped when stepping.\n"), name);
+ gdb_printf (_ ("Function %s will be skipped when stepping.\n"), name);
}
static void
@@ -204,14 +212,14 @@ skip_function_command (const char *arg, int from_tty)
/* Default to the current function if no argument is given. */
if (arg == NULL)
{
- frame_info_ptr fi = get_selected_frame (_("No default function now."));
+ frame_info_ptr fi = get_selected_frame (_ ("No default function now."));
struct symbol *sym = get_frame_function (fi);
const char *name = NULL;
if (sym != NULL)
name = sym->print_name ();
else
- error (_("No function found containing current program point %s."),
+ error (_ ("No function found containing current program point %s."),
paddress (get_current_arch (), get_frame_pc (fi)));
skip_function (name);
return;
@@ -244,40 +252,36 @@ skip_command (const char *arg, int from_tty)
const char *p = argv[i];
const char *value = argv[i + 1];
- if (strcmp (p, "-fi") == 0
- || strcmp (p, "-file") == 0)
+ if (strcmp (p, "-fi") == 0 || strcmp (p, "-file") == 0)
{
if (value == NULL)
- error (_("Missing value for %s option."), p);
+ error (_ ("Missing value for %s option."), p);
file = value;
++i;
}
- else if (strcmp (p, "-gfi") == 0
- || strcmp (p, "-gfile") == 0)
+ else if (strcmp (p, "-gfi") == 0 || strcmp (p, "-gfile") == 0)
{
if (value == NULL)
- error (_("Missing value for %s option."), p);
+ error (_ ("Missing value for %s option."), p);
gfile = value;
++i;
}
- else if (strcmp (p, "-fu") == 0
- || strcmp (p, "-function") == 0)
+ else if (strcmp (p, "-fu") == 0 || strcmp (p, "-function") == 0)
{
if (value == NULL)
- error (_("Missing value for %s option."), p);
+ error (_ ("Missing value for %s option."), p);
function = value;
++i;
}
- else if (strcmp (p, "-rfu") == 0
- || strcmp (p, "-rfunction") == 0)
+ else if (strcmp (p, "-rfu") == 0 || strcmp (p, "-rfunction") == 0)
{
if (value == NULL)
- error (_("Missing value for %s option."), p);
+ error (_ ("Missing value for %s option."), p);
rfunction = value;
++i;
}
else if (*p == '-')
- error (_("Invalid skip option: %s"), p);
+ error (_ ("Invalid skip option: %s"), p);
else if (i == 0)
{
/* Assume the user entered "skip FUNCTION-NAME".
@@ -288,19 +292,19 @@ skip_command (const char *arg, int from_tty)
return;
}
else
- error (_("Invalid argument: %s"), p);
+ error (_ ("Invalid argument: %s"), p);
}
if (file != NULL && gfile != NULL)
- error (_("Cannot specify both -file and -gfile."));
+ error (_ ("Cannot specify both -file and -gfile."));
if (function != NULL && rfunction != NULL)
- error (_("Cannot specify both -function and -rfunction."));
+ error (_ ("Cannot specify both -function and -rfunction."));
/* This shouldn't happen as "skip" by itself gets punted to
skip_function_command. */
- gdb_assert (file != NULL || gfile != NULL
- || function != NULL || rfunction != NULL);
+ gdb_assert (file != NULL || gfile != NULL || function != NULL
+ || rfunction != NULL);
std::string entry_file;
if (file != NULL)
@@ -324,27 +328,27 @@ skip_command (const char *arg, int from_tty)
{
const char *file_to_print = file != NULL ? file : gfile;
const char *function_to_print = function != NULL ? function : rfunction;
- const char *file_text = gfile != NULL ? _("File(s)") : _("File");
- const char *lower_file_text = gfile != NULL ? _("file(s)") : _("file");
+ const char *file_text = gfile != NULL ? _ ("File(s)") : _ ("File");
+ const char *lower_file_text = gfile != NULL ? _ ("file(s)") : _ ("file");
const char *function_text
- = rfunction != NULL ? _("Function(s)") : _("Function");
+ = rfunction != NULL ? _ ("Function(s)") : _ ("Function");
if (function_to_print == NULL)
{
- gdb_printf (_("%s %s will be skipped when stepping.\n"),
- file_text, file_to_print);
+ gdb_printf (_ ("%s %s will be skipped when stepping.\n"), file_text,
+ file_to_print);
}
else if (file_to_print == NULL)
{
- gdb_printf (_("%s %s will be skipped when stepping.\n"),
+ gdb_printf (_ ("%s %s will be skipped when stepping.\n"),
function_text, function_to_print);
}
else
{
- gdb_printf (_("%s %s in %s %s will be skipped"
- " when stepping.\n"),
- function_text, function_to_print,
- lower_file_text, file_to_print);
+ gdb_printf (_ ("%s %s in %s %s will be skipped"
+ " when stepping.\n"),
+ function_text, function_to_print, lower_file_text,
+ file_to_print);
}
}
}
@@ -366,10 +370,10 @@ info_skip_command (const char *arg, int from_tty)
if (num_printable_entries == 0)
{
if (arg == NULL)
- current_uiout->message (_("Not skipping any files or functions.\n"));
+ current_uiout->message (_ ("Not skipping any files or functions.\n"));
else
current_uiout->message (
- _("No skiplist entries found with number %s.\n"), arg);
+ _ ("No skiplist entries found with number %s.\n"), arg);
return;
}
@@ -377,11 +381,11 @@ info_skip_command (const char *arg, int from_tty)
ui_out_emit_table table_emitter (current_uiout, 6, num_printable_entries,
"SkiplistTable");
- current_uiout->table_header (5, ui_left, "number", "Num"); /* 1 */
- current_uiout->table_header (3, ui_left, "enabled", "Enb"); /* 2 */
- current_uiout->table_header (4, ui_right, "regexp", "Glob"); /* 3 */
- current_uiout->table_header (20, ui_left, "file", "File"); /* 4 */
- current_uiout->table_header (2, ui_right, "regexp", "RE"); /* 5 */
+ current_uiout->table_header (5, ui_left, "number", "Num"); /* 1 */
+ current_uiout->table_header (3, ui_left, "enabled", "Enb"); /* 2 */
+ current_uiout->table_header (4, ui_right, "regexp", "Glob"); /* 3 */
+ current_uiout->table_header (20, ui_left, "file", "File"); /* 4 */
+ current_uiout->table_header (2, ui_right, "regexp", "RE"); /* 5 */
current_uiout->table_header (40, ui_noalign, "function", "Function"); /* 6 */
current_uiout->table_body ();
@@ -406,21 +410,19 @@ info_skip_command (const char *arg, int from_tty)
current_uiout->field_string ("file",
e.file ().empty () ? "<none>"
- : e.file ().c_str (),
+ : e.file ().c_str (),
e.file ().empty ()
- ? metadata_style.style ()
- : file_name_style.style ()); /* 4 */
+ ? metadata_style.style ()
+ : file_name_style.style ()); /* 4 */
if (e.function_is_regexp ())
current_uiout->field_string ("regexp", "y"); /* 5 */
else
current_uiout->field_string ("regexp", "n"); /* 5 */
- current_uiout->field_string ("function",
- e.function ().empty () ? "<none>"
- : e.function ().c_str (),
- e.function ().empty ()
- ? metadata_style.style ()
- : function_name_style.style ()); /* 6 */
+ current_uiout->field_string (
+ "function", e.function ().empty () ? "<none>" : e.function ().c_str (),
+ e.function ().empty () ? metadata_style.style ()
+ : function_name_style.style ()); /* 6 */
current_uiout->text ("\n");
}
@@ -439,7 +441,7 @@ skip_enable_command (const char *arg, int from_tty)
}
if (!found)
- error (_("No skiplist entries found with number %s."), arg);
+ error (_ ("No skiplist entries found with number %s."), arg);
}
static void
@@ -455,7 +457,7 @@ skip_disable_command (const char *arg, int from_tty)
}
if (!found)
- error (_("No skiplist entries found with number %s."), arg);
+ error (_ ("No skiplist entries found with number %s."), arg);
}
static void
@@ -463,8 +465,7 @@ skip_delete_command (const char *arg, int from_tty)
{
bool found = false;
- for (auto it = skiplist_entries.begin (),
- end = skiplist_entries.end ();
+ for (auto it = skiplist_entries.begin (), end = skiplist_entries.end ();
it != end;)
{
const skiplist_entry &e = *it;
@@ -479,15 +480,14 @@ skip_delete_command (const char *arg, int from_tty)
}
if (!found)
- error (_("No skiplist entries found with number %s."), arg);
+ error (_ ("No skiplist entries found with number %s."), arg);
}
bool
skiplist_entry::do_skip_file_p (const symtab_and_line &function_sal) const
{
if (debug_skip)
- gdb_printf (gdb_stdlog,
- "skip: checking if file %s matches non-glob %s...",
+ gdb_printf (gdb_stdlog, "skip: checking if file %s matches non-glob %s...",
function_sal.symtab->filename, m_file.c_str ());
bool result;
@@ -502,7 +502,8 @@ skiplist_entry::do_skip_file_p (const symtab_and_line &function_sal) const
files are involved, do a quick comparison of the basenames. */
else if (!basenames_may_differ
&& filename_cmp (lbasename (function_sal.symtab->filename),
- lbasename (m_file.c_str ())) != 0)
+ lbasename (m_file.c_str ()))
+ != 0)
result = false;
else
{
@@ -522,8 +523,7 @@ bool
skiplist_entry::do_skip_gfile_p (const symtab_and_line &function_sal) const
{
if (debug_skip)
- gdb_printf (gdb_stdlog,
- "skip: checking if file %s matches glob %s...",
+ gdb_printf (gdb_stdlog, "skip: checking if file %s matches glob %s...",
function_sal.symtab->filename, m_file.c_str ());
bool result;
@@ -531,7 +531,8 @@ skiplist_entry::do_skip_gfile_p (const symtab_and_line &function_sal) const
/* Check first sole SYMTAB->FILENAME. It may not be a substring of
symtab_to_fullname as it may contain "./" etc. */
if (gdb_filename_fnmatch (m_file.c_str (), function_sal.symtab->filename,
- FNM_FILE_NAME | FNM_NOESCAPE) == 0)
+ FNM_FILE_NAME | FNM_NOESCAPE)
+ == 0)
result = true;
/* Before we invoke symtab_to_fullname, which is expensive, do a quick
@@ -540,9 +541,10 @@ skiplist_entry::do_skip_gfile_p (const symtab_and_line &function_sal) const
If the basename of the glob pattern is something like "*.c" then this
isn't much of a win. Oh well. */
else if (!basenames_may_differ
- && gdb_filename_fnmatch (lbasename (m_file.c_str ()),
- lbasename (function_sal.symtab->filename),
- FNM_FILE_NAME | FNM_NOESCAPE) != 0)
+ && gdb_filename_fnmatch (lbasename (m_file.c_str ()),
+ lbasename (function_sal.symtab->filename),
+ FNM_FILE_NAME | FNM_NOESCAPE)
+ != 0)
result = false;
else
{
@@ -643,8 +645,7 @@ function_name_is_marked_for_skip (const char *function_name,
/* Completer for skip numbers. */
static void
-complete_skip_number (cmd_list_element *cmd,
- completion_tracker &completer,
+complete_skip_number (cmd_list_element *cmd, completion_tracker &completer,
const char *text, const char *word)
{
size_t word_len = strlen (word);
@@ -658,13 +659,14 @@ complete_skip_number (cmd_list_element *cmd,
}
void _initialize_step_skip ();
+
void
_initialize_step_skip ()
{
static struct cmd_list_element *skiplist = NULL;
struct cmd_list_element *c;
- add_prefix_cmd ("skip", class_breakpoint, skip_command, _("\
+ add_prefix_cmd ("skip", class_breakpoint, skip_command, _ ("\
Ignore a function while stepping.\n\
\n\
Usage: skip [FUNCTION-NAME]\n\
@@ -679,21 +681,21 @@ FUNCTION-SPEC is one of:\n\
-rfu|-rfunction FUNCTION-NAME-REGULAR-EXPRESSION"),
&skiplist, 1, &cmdlist);
- c = add_cmd ("file", class_breakpoint, skip_file_command, _("\
+ c = add_cmd ("file", class_breakpoint, skip_file_command, _ ("\
Ignore a file while stepping.\n\
Usage: skip file [FILE-NAME]\n\
If no filename is given, ignore the current file."),
&skiplist);
set_cmd_completer (c, filename_completer);
- c = add_cmd ("function", class_breakpoint, skip_function_command, _("\
+ c = add_cmd ("function", class_breakpoint, skip_function_command, _ ("\
Ignore a function while stepping.\n\
Usage: skip function [FUNCTION-NAME]\n\
If no function name is given, skip the current function."),
&skiplist);
set_cmd_completer (c, location_completer);
- c = add_cmd ("enable", class_breakpoint, skip_enable_command, _("\
+ c = add_cmd ("enable", class_breakpoint, skip_enable_command, _ ("\
Enable skip entries.\n\
Usage: skip enable [NUMBER | RANGE]...\n\
You can specify numbers (e.g. \"skip enable 1 3\"),\n\
@@ -702,7 +704,7 @@ If you don't specify any numbers or ranges, we'll enable all skip entries."),
&skiplist);
set_cmd_completer (c, complete_skip_number);
- c = add_cmd ("disable", class_breakpoint, skip_disable_command, _("\
+ c = add_cmd ("disable", class_breakpoint, skip_disable_command, _ ("\
Disable skip entries.\n\
Usage: skip disable [NUMBER | RANGE]...\n\
You can specify numbers (e.g. \"skip disable 1 3\"),\n\
@@ -711,7 +713,7 @@ If you don't specify any numbers or ranges, we'll disable all skip entries."),
&skiplist);
set_cmd_completer (c, complete_skip_number);
- c = add_cmd ("delete", class_breakpoint, skip_delete_command, _("\
+ c = add_cmd ("delete", class_breakpoint, skip_delete_command, _ ("\
Delete skip entries.\n\
Usage: skip delete [NUMBER | RANGES]...\n\
You can specify numbers (e.g. \"skip delete 1 3\"),\n\
@@ -720,7 +722,7 @@ If you don't specify any numbers or ranges, we'll delete all skip entries."),
&skiplist);
set_cmd_completer (c, complete_skip_number);
- add_info ("skip", info_skip_command, _("\
+ add_info ("skip", info_skip_command, _ ("\
Display the status of skips.\n\
Usage: info skip [NUMBER | RANGES]...\n\
You can specify numbers (e.g. \"info skip 1 3\"), \n\
@@ -728,13 +730,11 @@ ranges (e.g. \"info skip 4-8\"), or both (e.g. \"info skip 1 3 4-8\").\n\n\
If you don't specify any numbers or ranges, we'll show all skips."));
set_cmd_completer (c, complete_skip_number);
- add_setshow_boolean_cmd ("skip", class_maintenance,
- &debug_skip, _("\
+ add_setshow_boolean_cmd ("skip", class_maintenance, &debug_skip, _ ("\
Set whether to print the debug output about skipping files and functions."),
- _("\
+ _ ("\
Show whether the debug output about skipping files and functions is printed."),
- _("\
+ _ ("\
When non-zero, debug output about skipping files and functions is displayed."),
- NULL, NULL,
- &setdebuglist, &showdebuglist);
+ NULL, NULL, &setdebuglist, &showdebuglist);
}
diff --git a/gdb/skip.h b/gdb/skip.h
index 104781799a5..576e3cad801 100644
--- a/gdb/skip.h
+++ b/gdb/skip.h
@@ -15,7 +15,7 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
-#if !defined (SKIP_H)
+#if !defined(SKIP_H)
#define SKIP_H
struct symtab_and_line;
diff --git a/gdb/sol-thread.c b/gdb/sol-thread.c
index 8945c2041db..4f69e5b76a5 100644
--- a/gdb/sol-thread.c
+++ b/gdb/sol-thread.c
@@ -69,17 +69,15 @@
#include "minsyms.h"
#include "objfiles.h"
-static const target_info thread_db_target_info = {
- "solaris-threads",
- N_("Solaris threads and pthread."),
- N_("Solaris threads and pthread support.")
-};
+static const target_info thread_db_target_info
+ = { "solaris-threads", N_ ("Solaris threads and pthread."),
+ N_ ("Solaris threads and pthread support.") };
class sol_thread_target final : public target_ops
{
public:
- const target_info &info () const override
- { return thread_db_target_info; }
+
+ const target_info &info () const override { return thread_db_target_info; }
strata stratum () const override { return thread_stratum; }
@@ -94,8 +92,7 @@ public:
void store_registers (struct regcache *, int) override;
enum target_xfer_status xfer_partial (enum target_object object,
- const char *annex,
- gdb_byte *readbuf,
+ const char *annex, gdb_byte *readbuf,
const gdb_byte *writebuf,
ULONGEST offset, ULONGEST len,
ULONGEST *xfered_len) override;
@@ -133,54 +130,53 @@ static int sol_thread_active = 0;
/* Types of the libthread_db functions. */
-typedef void (td_log_ftype)(const int on_off);
-typedef td_err_e (td_ta_new_ftype)(const struct ps_prochandle *ph_p,
- td_thragent_t **ta_pp);
-typedef td_err_e (td_ta_delete_ftype)(td_thragent_t *ta_p);
-typedef td_err_e (td_init_ftype)(void);
-typedef td_err_e (td_ta_get_ph_ftype)(const td_thragent_t *ta_p,
- struct ps_prochandle **ph_pp);
-typedef td_err_e (td_ta_get_nthreads_ftype)(const td_thragent_t *ta_p,
- int *nthread_p);
-typedef td_err_e (td_ta_tsd_iter_ftype)(const td_thragent_t *ta_p,
- td_key_iter_f *cb, void *cbdata_p);
-typedef td_err_e (td_ta_thr_iter_ftype)(const td_thragent_t *ta_p,
- td_thr_iter_f *cb, void *cbdata_p,
- td_thr_state_e state, int ti_pri,
- sigset_t *ti_sigmask_p,
- unsigned ti_user_flags);
-typedef td_err_e (td_thr_validate_ftype)(const td_thrhandle_t *th_p);
-typedef td_err_e (td_thr_tsd_ftype)(const td_thrhandle_t * th_p,
- const thread_key_t key, void **data_pp);
-typedef td_err_e (td_thr_get_info_ftype)(const td_thrhandle_t *th_p,
- td_thrinfo_t *ti_p);
-typedef td_err_e (td_thr_getfpregs_ftype)(const td_thrhandle_t *th_p,
- prfpregset_t *fpregset);
-typedef td_err_e (td_thr_getxregsize_ftype)(const td_thrhandle_t *th_p,
- int *xregsize);
-typedef td_err_e (td_thr_getxregs_ftype)(const td_thrhandle_t *th_p,
- const caddr_t xregset);
-typedef td_err_e (td_thr_sigsetmask_ftype)(const td_thrhandle_t *th_p,
- const sigset_t ti_sigmask);
-typedef td_err_e (td_thr_setprio_ftype)(const td_thrhandle_t *th_p,
- const int ti_pri);
-typedef td_err_e (td_thr_setsigpending_ftype)(const td_thrhandle_t *th_p,
- const uchar_t ti_pending_flag,
- const sigset_t ti_pending);
-typedef td_err_e (td_thr_setfpregs_ftype)(const td_thrhandle_t *th_p,
- const prfpregset_t *fpregset);
-typedef td_err_e (td_thr_setxregs_ftype)(const td_thrhandle_t *th_p,
- const caddr_t xregset);
-typedef td_err_e (td_ta_map_id2thr_ftype)(const td_thragent_t *ta_p,
- thread_t tid,
- td_thrhandle_t *th_p);
-typedef td_err_e (td_ta_map_lwp2thr_ftype)(const td_thragent_t *ta_p,
- lwpid_t lwpid,
- td_thrhandle_t *th_p);
-typedef td_err_e (td_thr_getgregs_ftype)(const td_thrhandle_t *th_p,
- prgregset_t regset);
-typedef td_err_e (td_thr_setgregs_ftype)(const td_thrhandle_t *th_p,
- const prgregset_t regset);
+typedef void (td_log_ftype) (const int on_off);
+typedef td_err_e (td_ta_new_ftype) (const struct ps_prochandle *ph_p,
+ td_thragent_t **ta_pp);
+typedef td_err_e (td_ta_delete_ftype) (td_thragent_t *ta_p);
+typedef td_err_e (td_init_ftype) (void);
+typedef td_err_e (td_ta_get_ph_ftype) (const td_thragent_t *ta_p,
+ struct ps_prochandle **ph_pp);
+typedef td_err_e (td_ta_get_nthreads_ftype) (const td_thragent_t *ta_p,
+ int *nthread_p);
+typedef td_err_e (td_ta_tsd_iter_ftype) (const td_thragent_t *ta_p,
+ td_key_iter_f *cb, void *cbdata_p);
+typedef td_err_e (td_ta_thr_iter_ftype) (const td_thragent_t *ta_p,
+ td_thr_iter_f *cb, void *cbdata_p,
+ td_thr_state_e state, int ti_pri,
+ sigset_t *ti_sigmask_p,
+ unsigned ti_user_flags);
+typedef td_err_e (td_thr_validate_ftype) (const td_thrhandle_t *th_p);
+typedef td_err_e (td_thr_tsd_ftype) (const td_thrhandle_t *th_p,
+ const thread_key_t key, void **data_pp);
+typedef td_err_e (td_thr_get_info_ftype) (const td_thrhandle_t *th_p,
+ td_thrinfo_t *ti_p);
+typedef td_err_e (td_thr_getfpregs_ftype) (const td_thrhandle_t *th_p,
+ prfpregset_t *fpregset);
+typedef td_err_e (td_thr_getxregsize_ftype) (const td_thrhandle_t *th_p,
+ int *xregsize);
+typedef td_err_e (td_thr_getxregs_ftype) (const td_thrhandle_t *th_p,
+ const caddr_t xregset);
+typedef td_err_e (td_thr_sigsetmask_ftype) (const td_thrhandle_t *th_p,
+ const sigset_t ti_sigmask);
+typedef td_err_e (td_thr_setprio_ftype) (const td_thrhandle_t *th_p,
+ const int ti_pri);
+typedef td_err_e (td_thr_setsigpending_ftype) (const td_thrhandle_t *th_p,
+ const uchar_t ti_pending_flag,
+ const sigset_t ti_pending);
+typedef td_err_e (td_thr_setfpregs_ftype) (const td_thrhandle_t *th_p,
+ const prfpregset_t *fpregset);
+typedef td_err_e (td_thr_setxregs_ftype) (const td_thrhandle_t *th_p,
+ const caddr_t xregset);
+typedef td_err_e (td_ta_map_id2thr_ftype) (const td_thragent_t *ta_p,
+ thread_t tid, td_thrhandle_t *th_p);
+typedef td_err_e (td_ta_map_lwp2thr_ftype) (const td_thragent_t *ta_p,
+ lwpid_t lwpid,
+ td_thrhandle_t *th_p);
+typedef td_err_e (td_thr_getgregs_ftype) (const td_thrhandle_t *th_p,
+ prgregset_t regset);
+typedef td_err_e (td_thr_setgregs_ftype) (const td_thrhandle_t *th_p,
+ const prgregset_t regset);
/* Pointers to routines from libthread_db resolved by dlopen(). */
@@ -207,7 +203,6 @@ static td_ta_map_id2thr_ftype *p_td_ta_map_id2thr;
static td_ta_map_lwp2thr_ftype *p_td_ta_map_lwp2thr;
static td_thr_getgregs_ftype *p_td_thr_getgregs;
static td_thr_setgregs_ftype *p_td_thr_setgregs;
-
/* Return the libthread_db error string associated with ERRCODE. If
ERRCODE is unknown, return an appropriate message. */
@@ -215,30 +210,28 @@ static td_thr_setgregs_ftype *p_td_thr_setgregs;
static const char *
td_err_string (td_err_e errcode)
{
- static struct string_map td_err_table[] =
- {
- { TD_OK, "generic \"call succeeded\"" },
- { TD_ERR, "generic error." },
- { TD_NOTHR, "no thread can be found to satisfy query" },
- { TD_NOSV, "no synch. variable can be found to satisfy query" },
- { TD_NOLWP, "no lwp can be found to satisfy query" },
- { TD_BADPH, "invalid process handle" },
- { TD_BADTH, "invalid thread handle" },
- { TD_BADSH, "invalid synchronization handle" },
- { TD_BADTA, "invalid thread agent" },
- { TD_BADKEY, "invalid key" },
- { TD_NOMSG, "td_thr_event_getmsg() called when there was no message" },
- { TD_NOFPREGS, "FPU register set not available for given thread" },
- { TD_NOLIBTHREAD, "application not linked with libthread" },
- { TD_NOEVENT, "requested event is not supported" },
- { TD_NOCAPAB, "capability not available" },
- { TD_DBERR, "Debugger service failed" },
- { TD_NOAPLIC, "Operation not applicable to" },
- { TD_NOTSD, "No thread specific data for this thread" },
- { TD_MALLOC, "Malloc failed" },
- { TD_PARTIALREG, "Only part of register set was written/read" },
- { TD_NOXREGS, "X register set not available for given thread" }
- };
+ static struct string_map td_err_table[]
+ = { { TD_OK, "generic \"call succeeded\"" },
+ { TD_ERR, "generic error." },
+ { TD_NOTHR, "no thread can be found to satisfy query" },
+ { TD_NOSV, "no synch. variable can be found to satisfy query" },
+ { TD_NOLWP, "no lwp can be found to satisfy query" },
+ { TD_BADPH, "invalid process handle" },
+ { TD_BADTH, "invalid thread handle" },
+ { TD_BADSH, "invalid synchronization handle" },
+ { TD_BADTA, "invalid thread agent" },
+ { TD_BADKEY, "invalid key" },
+ { TD_NOMSG, "td_thr_event_getmsg() called when there was no message" },
+ { TD_NOFPREGS, "FPU register set not available for given thread" },
+ { TD_NOLIBTHREAD, "application not linked with libthread" },
+ { TD_NOEVENT, "requested event is not supported" },
+ { TD_NOCAPAB, "capability not available" },
+ { TD_DBERR, "Debugger service failed" },
+ { TD_NOAPLIC, "Operation not applicable to" },
+ { TD_NOTSD, "No thread specific data for this thread" },
+ { TD_MALLOC, "Malloc failed" },
+ { TD_PARTIALREG, "Only part of register set was written/read" },
+ { TD_NOXREGS, "X register set not available for given thread" } };
const int td_err_size = sizeof td_err_table / sizeof (struct string_map);
int i;
static char buf[50];
@@ -259,19 +252,17 @@ td_err_string (td_err_e errcode)
static const char *
td_state_string (td_thr_state_e statecode)
{
- static struct string_map td_thr_state_table[] =
- {
- { TD_THR_ANY_STATE, "any state" },
- { TD_THR_UNKNOWN, "unknown" },
- { TD_THR_STOPPED, "stopped" },
- { TD_THR_RUN, "run" },
- { TD_THR_ACTIVE, "active" },
- { TD_THR_ZOMBIE, "zombie" },
- { TD_THR_SLEEP, "sleep" },
- { TD_THR_STOPPED_ASLEEP, "stopped asleep" }
- };
- const int td_thr_state_table_size =
- sizeof td_thr_state_table / sizeof (struct string_map);
+ static struct string_map td_thr_state_table[]
+ = { { TD_THR_ANY_STATE, "any state" },
+ { TD_THR_UNKNOWN, "unknown" },
+ { TD_THR_STOPPED, "stopped" },
+ { TD_THR_RUN, "run" },
+ { TD_THR_ACTIVE, "active" },
+ { TD_THR_ZOMBIE, "zombie" },
+ { TD_THR_SLEEP, "sleep" },
+ { TD_THR_STOPPED_ASLEEP, "stopped asleep" } };
+ const int td_thr_state_table_size
+ = sizeof td_thr_state_table / sizeof (struct string_map);
int i;
static char buf[50];
@@ -284,7 +275,6 @@ td_state_string (td_thr_state_e statecode)
return buf;
}
-
/* Convert a POSIX or Solaris thread ID into a LWP ID. If THREAD_ID
doesn't exist, that's an error. If it's an inactive thread, return
@@ -300,27 +290,27 @@ thread_to_lwp (ptid_t thread_id, int default_lwp)
td_err_e val;
if (thread_id.lwp_p ())
- return thread_id; /* It's already an LWP ID. */
+ return thread_id; /* It's already an LWP ID. */
/* It's a thread. Convert to LWP. */
val = p_td_ta_map_id2thr (main_ta, thread_id.tid (), &th);
if (val == TD_NOTHR)
- return ptid_t (-1); /* Thread must have terminated. */
+ return ptid_t (-1); /* Thread must have terminated. */
else if (val != TD_OK)
- error (_("thread_to_lwp: td_ta_map_id2thr %s"), td_err_string (val));
+ error (_ ("thread_to_lwp: td_ta_map_id2thr %s"), td_err_string (val));
val = p_td_thr_get_info (&th, &ti);
if (val == TD_NOTHR)
- return ptid_t (-1); /* Thread must have terminated. */
+ return ptid_t (-1); /* Thread must have terminated. */
else if (val != TD_OK)
- error (_("thread_to_lwp: td_thr_get_info: %s"), td_err_string (val));
+ error (_ ("thread_to_lwp: td_thr_get_info: %s"), td_err_string (val));
if (ti.ti_state != TD_THR_ACTIVE)
{
if (default_lwp != -1)
return ptid_t (default_lwp);
- error (_("thread_to_lwp: thread state not active: %s"),
+ error (_ ("thread_to_lwp: thread state not active: %s"),
td_state_string (ti.ti_state));
}
@@ -340,34 +330,33 @@ lwp_to_thread (ptid_t lwp)
td_err_e val;
if (lwp.tid_p ())
- return lwp; /* It's already a thread ID. */
+ return lwp; /* It's already a thread ID. */
/* It's an LWP. Convert it to a thread ID. */
if (!target_thread_alive (lwp))
- return ptid_t (-1); /* Must be a defunct LPW. */
+ return ptid_t (-1); /* Must be a defunct LPW. */
val = p_td_ta_map_lwp2thr (main_ta, lwp.lwp (), &th);
if (val == TD_NOTHR)
- return ptid_t (-1); /* Thread must have terminated. */
+ return ptid_t (-1); /* Thread must have terminated. */
else if (val != TD_OK)
- error (_("lwp_to_thread: td_ta_map_lwp2thr: %s."), td_err_string (val));
+ error (_ ("lwp_to_thread: td_ta_map_lwp2thr: %s."), td_err_string (val));
val = p_td_thr_validate (&th);
if (val == TD_NOTHR)
- return lwp; /* Unknown to libthread; just return LPW, */
+ return lwp; /* Unknown to libthread; just return LPW, */
else if (val != TD_OK)
- error (_("lwp_to_thread: td_thr_validate: %s."), td_err_string (val));
+ error (_ ("lwp_to_thread: td_thr_validate: %s."), td_err_string (val));
val = p_td_thr_get_info (&th, &ti);
if (val == TD_NOTHR)
- return ptid_t (-1); /* Thread must have terminated. */
+ return ptid_t (-1); /* Thread must have terminated. */
else if (val != TD_OK)
- error (_("lwp_to_thread: td_thr_get_info: %s."), td_err_string (val));
+ error (_ ("lwp_to_thread: td_thr_get_info: %s."), td_err_string (val));
- return ptid_t (lwp.pid (), 0 , ti.ti_tid);
+ return ptid_t (lwp.pid (), 0, ti.ti_tid);
}
-
/* Most target vector functions from here on actually just pass
through to the layer beneath, as they don't need to do anything
@@ -410,10 +399,10 @@ sol_thread_target::resume (ptid_t ptid, int step, enum gdb_signal signo)
ptid_t save_ptid = ptid;
ptid = thread_to_lwp (ptid, -2);
- if (ptid.pid () == -2) /* Inactive thread. */
- error (_("This version of Solaris can't start inactive threads."));
+ if (ptid.pid () == -2) /* Inactive thread. */
+ error (_ ("This version of Solaris can't start inactive threads."));
if (info_verbose && ptid.pid () == -1)
- warning (_("Specified thread %s seems to have terminated"),
+ warning (_ ("Specified thread %s seems to have terminated"),
pulongest (save_ptid.tid ()));
}
@@ -432,10 +421,10 @@ sol_thread_target::wait (ptid_t ptid, struct target_waitstatus *ourstatus,
ptid_t ptid_for_warning = ptid;
ptid = thread_to_lwp (ptid, -2);
- if (ptid.pid () == -2) /* Inactive thread. */
- error (_("This version of Solaris can't start inactive threads."));
+ if (ptid.pid () == -2) /* Inactive thread. */
+ error (_ ("This version of Solaris can't start inactive threads."));
if (info_verbose && ptid.pid () == -1)
- warning (_("Specified thread %s seems to have terminated"),
+ warning (_ ("Specified thread %s seems to have terminated"),
pulongest (ptid_for_warning.tid ()));
}
@@ -490,18 +479,18 @@ sol_thread_target::fetch_registers (struct regcache *regcache, int regnum)
/* Solaris thread: convert PTID into a td_thrhandle_t. */
thread = ptid.tid ();
if (thread == 0)
- error (_("sol_thread_fetch_registers: thread == 0"));
+ error (_ ("sol_thread_fetch_registers: thread == 0"));
val = p_td_ta_map_id2thr (main_ta, thread, &thandle);
if (val != TD_OK)
- error (_("sol_thread_fetch_registers: td_ta_map_id2thr: %s"),
+ error (_ ("sol_thread_fetch_registers: td_ta_map_id2thr: %s"),
td_err_string (val));
/* Get the general-purpose registers. */
val = p_td_thr_getgregs (&thandle, gregset);
if (val != TD_OK && val != TD_PARTIALREG)
- error (_("sol_thread_fetch_registers: td_thr_getgregs %s"),
+ error (_ ("sol_thread_fetch_registers: td_thr_getgregs %s"),
td_err_string (val));
/* For SPARC, TD_PARTIALREG means that only %i0...%i7, %l0..%l7, %pc
@@ -511,7 +500,7 @@ sol_thread_target::fetch_registers (struct regcache *regcache, int regnum)
val = p_td_thr_getfpregs (&thandle, &fpregset);
if (val != TD_OK && val != TD_NOFPREGS)
- error (_("sol_thread_fetch_registers: td_thr_getfpregs %s"),
+ error (_ ("sol_thread_fetch_registers: td_thr_getfpregs %s"),
td_err_string (val));
/* Note that we must call supply_gregset and supply_fpregset *after*
@@ -544,18 +533,18 @@ sol_thread_target::store_registers (struct regcache *regcache, int regnum)
val = p_td_ta_map_id2thr (main_ta, thread, &thandle);
if (val != TD_OK)
- error (_("sol_thread_store_registers: td_ta_map_id2thr %s"),
+ error (_ ("sol_thread_store_registers: td_ta_map_id2thr %s"),
td_err_string (val));
if (regnum != -1)
{
val = p_td_thr_getgregs (&thandle, gregset);
if (val != TD_OK)
- error (_("sol_thread_store_registers: td_thr_getgregs %s"),
+ error (_ ("sol_thread_store_registers: td_thr_getgregs %s"),
td_err_string (val));
val = p_td_thr_getfpregs (&thandle, &fpregset);
if (val != TD_OK)
- error (_("sol_thread_store_registers: td_thr_getfpregs %s"),
+ error (_ ("sol_thread_store_registers: td_thr_getfpregs %s"),
td_err_string (val));
}
@@ -564,11 +553,11 @@ sol_thread_target::store_registers (struct regcache *regcache, int regnum)
val = p_td_thr_setgregs (&thandle, gregset);
if (val != TD_OK)
- error (_("sol_thread_store_registers: td_thr_setgregs %s"),
+ error (_ ("sol_thread_store_registers: td_thr_setgregs %s"),
td_err_string (val));
val = p_td_thr_setfpregs (&thandle, &fpregset);
if (val != TD_OK)
- error (_("sol_thread_store_registers: td_thr_setfpregs %s"),
+ error (_ ("sol_thread_store_registers: td_thr_setfpregs %s"),
td_err_string (val));
}
@@ -577,9 +566,8 @@ sol_thread_target::store_registers (struct regcache *regcache, int regnum)
one, of readbuf or writebuf must be non-NULL. */
enum target_xfer_status
-sol_thread_target::xfer_partial (enum target_object object,
- const char *annex, gdb_byte *readbuf,
- const gdb_byte *writebuf,
+sol_thread_target::xfer_partial (enum target_object object, const char *annex,
+ gdb_byte *readbuf, const gdb_byte *writebuf,
ULONGEST offset, ULONGEST len,
ULONGEST *xfered_len)
{
@@ -595,8 +583,8 @@ sol_thread_target::xfer_partial (enum target_object object,
inferior_ptid = procfs_first_available ();
}
- return beneath ()->xfer_partial (object, annex, readbuf,
- writebuf, offset, len, xfered_len);
+ return beneath ()->xfer_partial (object, annex, readbuf, writebuf, offset,
+ len, xfered_len);
}
static void
@@ -625,7 +613,7 @@ check_for_thread_db (void)
err = p_td_init ();
if (err != TD_OK)
{
- warning (_("sol_thread_new_objfile: td_init: %s"), td_err_string (err));
+ warning (_ ("sol_thread_new_objfile: td_init: %s"), td_err_string (err));
return;
}
@@ -638,7 +626,7 @@ check_for_thread_db (void)
break;
case TD_OK:
- gdb_printf (_("[Thread debugging using libthread_db enabled]\n"));
+ gdb_printf (_ ("[Thread debugging using libthread_db enabled]\n"));
/* The thread library was detected. Activate the sol_thread target. */
current_inferior ()->push_target (&sol_thread_ops);
@@ -653,7 +641,7 @@ check_for_thread_db (void)
break;
default:
- warning (_("Cannot initialize thread debugging library: %s"),
+ warning (_ ("Cannot initialize thread debugging library: %s"),
td_err_string (err));
break;
}
@@ -701,11 +689,11 @@ sol_thread_target::thread_alive (ptid_t ptid)
pid = ptid.tid ();
val = p_td_ta_map_id2thr (main_ta, pid, &th);
if (val != TD_OK)
- return false; /* Thread not found. */
+ return false; /* Thread not found. */
val = p_td_thr_validate (&th);
if (val != TD_OK)
- return false; /* Thread not valid. */
- return true; /* Known thread. */
+ return false; /* Thread not valid. */
+ return true; /* Known thread. */
}
else
{
@@ -714,7 +702,6 @@ sol_thread_target::thread_alive (ptid_t ptid)
}
}
-
/* These routines implement the lower half of the thread_db interface,
i.e. the ps_* routines. */
@@ -791,7 +778,7 @@ rw_common (int dowrite, const struct ps_prochandle *ph, psaddr_t addr,
inferior_ptid = procfs_first_available ();
}
-#if defined (__sparcv9)
+#if defined(__sparcv9)
/* For Sparc64 cross Sparc32, make sure the address has not been
accidentally sign-extended (or whatever) to beyond 32 bits. */
if (bfd_get_arch_size (current_program_space->exec_bfd ()) == 32)
@@ -817,8 +804,8 @@ ps_pdread (struct ps_prochandle *ph, psaddr_t addr, void *buf, size_t size)
/* Copies SIZE bytes from debugger memory .data segment to target process. */
ps_err_e
-ps_pdwrite (struct ps_prochandle *ph, psaddr_t addr,
- const void *buf, size_t size)
+ps_pdwrite (struct ps_prochandle *ph, psaddr_t addr, const void *buf,
+ size_t size)
{
return rw_common (1, ph, addr, (gdb_byte *) buf, size);
}
@@ -834,8 +821,8 @@ ps_ptread (struct ps_prochandle *ph, psaddr_t addr, void *buf, size_t size)
/* Copies SIZE bytes from debugger memory .text segment to target process. */
ps_err_e
-ps_ptwrite (struct ps_prochandle *ph, psaddr_t addr,
- const void *buf, size_t size)
+ps_ptwrite (struct ps_prochandle *ph, psaddr_t addr, const void *buf,
+ size_t size)
{
return rw_common (1, ph, addr, (gdb_byte *) buf, size);
}
@@ -847,8 +834,8 @@ ps_lgetregs (struct ps_prochandle *ph, lwpid_t lwpid, prgregset_t gregset)
{
ptid_t ptid = ptid_t (current_inferior ()->pid, lwpid, 0);
struct regcache *regcache
- = get_thread_arch_regcache (current_inferior ()->process_target (),
- ptid, target_gdbarch ());
+ = get_thread_arch_regcache (current_inferior ()->process_target (), ptid,
+ target_gdbarch ());
target_fetch_registers (regcache, -1);
fill_gregset (regcache, (gdb_gregset_t *) gregset, -1);
@@ -864,8 +851,8 @@ ps_lsetregs (struct ps_prochandle *ph, lwpid_t lwpid,
{
ptid_t ptid = ptid_t (current_inferior ()->pid, lwpid, 0);
struct regcache *regcache
- = get_thread_arch_regcache (current_inferior ()->process_target (),
- ptid, target_gdbarch ());
+ = get_thread_arch_regcache (current_inferior ()->process_target (), ptid,
+ target_gdbarch ());
supply_gregset (regcache, (const gdb_gregset_t *) gregset);
target_store_registers (regcache, -1);
@@ -912,13 +899,12 @@ ps_lsetxregs (struct ps_prochandle *ph, lwpid_t lwpid, caddr_t xregset)
/* Get floating-point registers for LWP. */
ps_err_e
-ps_lgetfpregs (struct ps_prochandle *ph, lwpid_t lwpid,
- prfpregset_t *fpregset)
+ps_lgetfpregs (struct ps_prochandle *ph, lwpid_t lwpid, prfpregset_t *fpregset)
{
ptid_t ptid = ptid_t (current_inferior ()->pid, lwpid, 0);
struct regcache *regcache
- = get_thread_arch_regcache (current_inferior ()->process_target (),
- ptid, target_gdbarch ());
+ = get_thread_arch_regcache (current_inferior ()->process_target (), ptid,
+ target_gdbarch ());
target_fetch_registers (regcache, -1);
fill_fpregset (regcache, (gdb_fpregset_t *) fpregset, -1);
@@ -930,12 +916,12 @@ ps_lgetfpregs (struct ps_prochandle *ph, lwpid_t lwpid,
ps_err_e
ps_lsetfpregs (struct ps_prochandle *ph, lwpid_t lwpid,
- const prfpregset_t * fpregset)
+ const prfpregset_t *fpregset)
{
ptid_t ptid = ptid_t (current_inferior ()->pid, lwpid, 0);
struct regcache *regcache
- = get_thread_arch_regcache (current_inferior ()->process_target (),
- ptid, target_gdbarch ());
+ = get_thread_arch_regcache (current_inferior ()->process_target (), ptid,
+ target_gdbarch ());
supply_fpregset (regcache, (const gdb_fpregset_t *) fpregset);
target_store_registers (regcache, -1);
@@ -959,7 +945,6 @@ ps_pdmodel (struct ps_prochandle *ph, int *data_model)
return PS_OK;
}
-
/* Convert PTID to printable form. */
@@ -973,21 +958,18 @@ sol_thread_target::pid_to_str (ptid_t ptid)
lwp = thread_to_lwp (ptid, -2);
if (lwp.pid () == -1)
- return string_printf ("Thread %s (defunct)",
- pulongest (ptid.tid ()));
+ return string_printf ("Thread %s (defunct)", pulongest (ptid.tid ()));
else if (lwp.pid () != -2)
- return string_printf ("Thread %s (LWP %ld)",
- pulongest (ptid.tid ()), lwp.lwp ());
+ return string_printf ("Thread %s (LWP %ld)", pulongest (ptid.tid ()),
+ lwp.lwp ());
else
- return string_printf ("Thread %s ",
- pulongest (ptid.tid ()));
+ return string_printf ("Thread %s ", pulongest (ptid.tid ()));
}
else if (ptid.lwp () != 0)
return string_printf ("LWP %ld ", ptid.lwp ());
else
return string_printf ("process %d ", ptid.pid ());
}
-
/* Worker bee for update_thread_list. Callback function that gets
called once per user-level thread (i.e. not for LWP's). */
@@ -1025,8 +1007,8 @@ sol_thread_target::update_thread_list ()
/* Then find any new user-level threads. */
p_td_ta_thr_iter (main_ta, sol_update_thread_list_callback, (void *) 0,
- TD_THR_ANY_STATE, TD_THR_LOWEST_PRIORITY,
- TD_SIGNO_MASK, TD_THR_ANY_USER_FLAGS);
+ TD_THR_ANY_STATE, TD_THR_LOWEST_PRIORITY, TD_SIGNO_MASK,
+ TD_THR_ANY_USER_FLAGS);
}
/* Worker bee for the "info sol-thread" command. This is a callback
@@ -1044,8 +1026,8 @@ info_cb (const td_thrhandle_t *th, void *s)
if (ret == TD_OK)
{
gdb_printf ("%s thread #%d, lwp %d, ",
- ti.ti_type == TD_THR_SYSTEM ? "system" : "user ",
- ti.ti_tid, ti.ti_lid);
+ ti.ti_type == TD_THR_SYSTEM ? "system" : "user ", ti.ti_tid,
+ ti.ti_lid);
switch (ti.ti_state)
{
default:
@@ -1079,8 +1061,8 @@ info_cb (const td_thrhandle_t *th, void *s)
gdb_printf (" startfunc=%s",
msym.minsym
- ? msym.minsym->print_name ()
- : paddress (target_gdbarch (), ti.ti_startfunc));
+ ? msym.minsym->print_name ()
+ : paddress (target_gdbarch (), ti.ti_startfunc));
}
/* If thread is asleep, print function that went to sleep. */
@@ -1090,15 +1072,14 @@ info_cb (const td_thrhandle_t *th, void *s)
= lookup_minimal_symbol_by_pc (ti.ti_pc);
gdb_printf (" sleepfunc=%s",
- msym.minsym
- ? msym.minsym->print_name ()
- : paddress (target_gdbarch (), ti.ti_pc));
+ msym.minsym ? msym.minsym->print_name ()
+ : paddress (target_gdbarch (), ti.ti_pc));
}
gdb_printf ("\n");
}
else
- warning (_("info sol-thread: failed to get info for thread."));
+ warning (_ ("info sol-thread: failed to get info for thread."));
return 0;
}
@@ -1109,9 +1090,9 @@ info_cb (const td_thrhandle_t *th, void *s)
static void
info_solthreads (const char *args, int from_tty)
{
- p_td_ta_thr_iter (main_ta, info_cb, (void *) args,
- TD_THR_ANY_STATE, TD_THR_LOWEST_PRIORITY,
- TD_SIGNO_MASK, TD_THR_ANY_USER_FLAGS);
+ p_td_ta_thr_iter (main_ta, info_cb, (void *) args, TD_THR_ANY_STATE,
+ TD_THR_LOWEST_PRIORITY, TD_SIGNO_MASK,
+ TD_THR_ANY_USER_FLAGS);
}
/* Callback routine used to find a thread based on the TID part of
@@ -1131,16 +1112,16 @@ thread_db_find_thread_from_tid (struct thread_info *thread, void *data)
ptid_t
sol_thread_target::get_ada_task_ptid (long lwp, ULONGEST thread)
{
- struct thread_info *thread_info =
- iterate_over_threads (thread_db_find_thread_from_tid, &thread);
+ struct thread_info *thread_info
+ = iterate_over_threads (thread_db_find_thread_from_tid, &thread);
if (thread_info == NULL)
{
/* The list of threads is probably not up to date. Find any
thread that is missing from the list, and try again. */
update_thread_list ();
- thread_info = iterate_over_threads (thread_db_find_thread_from_tid,
- &thread);
+ thread_info
+ = iterate_over_threads (thread_db_find_thread_from_tid, &thread);
}
gdb_assert (thread_info != NULL);
@@ -1149,6 +1130,7 @@ sol_thread_target::get_ada_task_ptid (long lwp, ULONGEST thread)
}
void _initialize_sol_thread ();
+
void
_initialize_sol_thread ()
{
@@ -1158,8 +1140,8 @@ _initialize_sol_thread ()
if (!dlhandle)
goto die;
-#define resolve(X) \
- if (!(p_##X = (X ## _ftype *) dlsym (dlhandle, #X))) \
+#define resolve(X) \
+ if (!(p_##X = (X##_ftype *) dlsym (dlhandle, #X))) \
goto die;
resolve (td_log);
@@ -1187,15 +1169,16 @@ _initialize_sol_thread ()
resolve (td_thr_setgregs);
add_cmd ("sol-threads", class_maintenance, info_solthreads,
- _("Show info on Solaris user threads."), &maintenanceinfolist);
+ _ ("Show info on Solaris user threads."), &maintenanceinfolist);
/* Hook into new_objfile notification. */
gdb::observers::new_objfile.attach (sol_thread_new_objfile, "sol-thread");
return;
- die:
+die:
gdb_printf (gdb_stderr, "\
-[GDB will not be able to debug user-mode threads: %s]\n", dlerror ());
+[GDB will not be able to debug user-mode threads: %s]\n",
+ dlerror ());
if (dlhandle)
dlclose (dlhandle);
diff --git a/gdb/sol2-tdep.c b/gdb/sol2-tdep.c
index 50811486cf5..7b0e6b8db15 100644
--- a/gdb/sol2-tdep.c
+++ b/gdb/sol2-tdep.c
@@ -44,9 +44,10 @@
static int
sol2_pc_in_sigtramp (CORE_ADDR pc, const char *name)
{
- return (name && (strcmp (name, "sigacthandler") == 0
- || strcmp (name, "ucbsigvechandler") == 0
- || strcmp (name, "__sighndlr") == 0));
+ return (name
+ && (strcmp (name, "sigacthandler") == 0
+ || strcmp (name, "ucbsigvechandler") == 0
+ || strcmp (name, "__sighndlr") == 0));
}
/* Return whether THIS_FRAME corresponds to a Solaris sigtramp routine. */
@@ -66,7 +67,7 @@ sol2_skip_solib_resolver (struct gdbarch *gdbarch, CORE_ADDR pc)
{
struct bound_minimal_symbol msym;
- msym = lookup_minimal_symbol("elf_bndr", NULL, NULL);
+ msym = lookup_minimal_symbol ("elf_bndr", NULL, NULL);
if (msym.minsym && msym.value_address () == pc)
return frame_unwind_caller_pc (get_current_frame ());
diff --git a/gdb/solib-aix.c b/gdb/solib-aix.c
index 726f0727723..4f43316c51d 100644
--- a/gdb/solib-aix.c
+++ b/gdb/solib-aix.c
@@ -102,8 +102,8 @@ solib_aix_parse_libraries (const char *library)
if (!have_warned)
{
have_warned = 1;
- warning (_("Can not parse XML library list; XML support was disabled "
- "at compile time"));
+ warning (_ ("Can not parse XML library list; XML support was disabled "
+ "at compile time"));
}
return {};
@@ -133,16 +133,16 @@ library_list_start_library (struct gdb_xml_parser *parser,
item.member_name = (const char *) attr->value.get ();
attr = xml_find_attribute (attributes, "text_addr");
- item.text_addr = * (ULONGEST *) attr->value.get ();
+ item.text_addr = *(ULONGEST *) attr->value.get ();
attr = xml_find_attribute (attributes, "text_size");
- item.text_size = * (ULONGEST *) attr->value.get ();
+ item.text_size = *(ULONGEST *) attr->value.get ();
attr = xml_find_attribute (attributes, "data_addr");
- item.data_addr = * (ULONGEST *) attr->value.get ();
+ item.data_addr = *(ULONGEST *) attr->value.get ();
attr = xml_find_attribute (attributes, "data_size");
- item.data_size = * (ULONGEST *) attr->value.get ();
+ item.data_size = *(ULONGEST *) attr->value.get ();
list->push_back (std::move (item));
}
@@ -159,45 +159,36 @@ library_list_start_list (struct gdb_xml_parser *parser,
= (char *) xml_find_attribute (attributes, "version")->value.get ();
if (strcmp (version, "1.0") != 0)
- gdb_xml_error (parser,
- _("Library list has unsupported version \"%s\""),
+ gdb_xml_error (parser, _ ("Library list has unsupported version \"%s\""),
version);
}
/* The allowed elements and attributes for an AIX library list
described in XML format. The root element is a <library-list-aix>. */
-static const struct gdb_xml_attribute library_attributes[] =
-{
- { "name", GDB_XML_AF_NONE, NULL, NULL },
- { "member", GDB_XML_AF_OPTIONAL, NULL, NULL },
- { "text_addr", GDB_XML_AF_NONE, gdb_xml_parse_attr_ulongest, NULL },
- { "text_size", GDB_XML_AF_NONE, gdb_xml_parse_attr_ulongest, NULL },
- { "data_addr", GDB_XML_AF_NONE, gdb_xml_parse_attr_ulongest, NULL },
- { "data_size", GDB_XML_AF_NONE, gdb_xml_parse_attr_ulongest, NULL },
- { NULL, GDB_XML_AF_NONE, NULL, NULL }
-};
-
-static const struct gdb_xml_element library_list_children[] =
-{
- { "library", library_attributes, NULL,
- GDB_XML_EF_REPEATABLE | GDB_XML_EF_OPTIONAL,
- library_list_start_library, NULL},
- { NULL, NULL, NULL, GDB_XML_EF_NONE, NULL, NULL }
-};
-
-static const struct gdb_xml_attribute library_list_attributes[] =
-{
- { "version", GDB_XML_AF_NONE, NULL, NULL },
- { NULL, GDB_XML_AF_NONE, NULL, NULL }
-};
-
-static const struct gdb_xml_element library_list_elements[] =
-{
- { "library-list-aix", library_list_attributes, library_list_children,
- GDB_XML_EF_NONE, library_list_start_list, NULL },
- { NULL, NULL, NULL, GDB_XML_EF_NONE, NULL, NULL }
-};
+static const struct gdb_xml_attribute library_attributes[]
+ = { { "name", GDB_XML_AF_NONE, NULL, NULL },
+ { "member", GDB_XML_AF_OPTIONAL, NULL, NULL },
+ { "text_addr", GDB_XML_AF_NONE, gdb_xml_parse_attr_ulongest, NULL },
+ { "text_size", GDB_XML_AF_NONE, gdb_xml_parse_attr_ulongest, NULL },
+ { "data_addr", GDB_XML_AF_NONE, gdb_xml_parse_attr_ulongest, NULL },
+ { "data_size", GDB_XML_AF_NONE, gdb_xml_parse_attr_ulongest, NULL },
+ { NULL, GDB_XML_AF_NONE, NULL, NULL } };
+
+static const struct gdb_xml_element library_list_children[]
+ = { { "library", library_attributes, NULL,
+ GDB_XML_EF_REPEATABLE | GDB_XML_EF_OPTIONAL,
+ library_list_start_library, NULL },
+ { NULL, NULL, NULL, GDB_XML_EF_NONE, NULL, NULL } };
+
+static const struct gdb_xml_attribute library_list_attributes[]
+ = { { "version", GDB_XML_AF_NONE, NULL, NULL },
+ { NULL, GDB_XML_AF_NONE, NULL, NULL } };
+
+static const struct gdb_xml_element library_list_elements[]
+ = { { "library-list-aix", library_list_attributes, library_list_children,
+ GDB_XML_EF_NONE, library_list_start_list, NULL },
+ { NULL, NULL, NULL, GDB_XML_EF_NONE, NULL, NULL } };
/* Parse LIBRARY, a string containing the loader info in XML format,
and return a vector of lm_info_aix objects.
@@ -209,8 +200,9 @@ solib_aix_parse_libraries (const char *library)
{
std::vector<lm_info_aix> result;
- if (gdb_xml_parse_quick (_("aix library list"), "library-list-aix.dtd",
- library_list_elements, library, &result) == 0)
+ if (gdb_xml_parse_quick (_ ("aix library list"), "library-list-aix.dtd",
+ library_list_elements, library, &result)
+ == 0)
return result;
return {};
@@ -240,11 +232,10 @@ solib_aix_get_library_list (struct inferior *inf, const char *warning_msg)
gdb::optional<gdb::char_vector> library_document
= target_read_stralloc (current_inferior ()->top_target (),
- TARGET_OBJECT_LIBRARIES_AIX,
- NULL);
+ TARGET_OBJECT_LIBRARIES_AIX, NULL);
if (!library_document && warning_msg != NULL)
{
- warning (_("%s (failed to read TARGET_OBJECT_LIBRARIES_AIX)"),
+ warning (_ ("%s (failed to read TARGET_OBJECT_LIBRARIES_AIX)"),
warning_msg);
return data->library_list;
}
@@ -254,7 +245,7 @@ solib_aix_get_library_list (struct inferior *inf, const char *warning_msg)
data->library_list = solib_aix_parse_libraries (library_document->data ());
if (!data->library_list.has_value () && warning_msg != NULL)
- warning (_("%s (missing XML support?)"), warning_msg);
+ warning (_ ("%s (missing XML support?)"), warning_msg);
return data->library_list;
}
@@ -345,8 +336,7 @@ solib_aix_relocate_section_addresses (struct so_list *so,
apply it to the .bss section as well. If the .data section
is not defined (which seems highly unlikely), do our best
by assuming no relocation. */
- struct bfd_section *data_sect
- = bfd_get_section_by_name (abfd, ".data");
+ struct bfd_section *data_sect = bfd_get_section_by_name (abfd, ".data");
CORE_ADDR data_offset = 0;
if (data_sect != NULL)
@@ -388,8 +378,7 @@ solib_aix_clear_solib (void)
the associated loader info (INFO). */
static section_offsets
-solib_aix_get_section_offsets (struct objfile *objfile,
- lm_info_aix *info)
+solib_aix_get_section_offsets (struct objfile *objfile, lm_info_aix *info)
{
bfd *abfd = objfile->obfd.get ();
@@ -423,12 +412,10 @@ solib_aix_get_section_offsets (struct objfile *objfile,
of the .data section. If no .data section (which seems hard to
believe it is possible), assume it is zero. */
- if (objfile->sect_index_bss != -1
- && objfile->sect_index_data != -1)
+ if (objfile->sect_index_bss != -1 && objfile->sect_index_data != -1)
{
- offsets[objfile->sect_index_bss]
- = (offsets[objfile->sect_index_data]
- + solib_aix_bss_data_overlap (abfd));
+ offsets[objfile->sect_index_bss] = (offsets[objfile->sect_index_data]
+ + solib_aix_bss_data_overlap (abfd));
}
/* All other sections should not need relocation. */
@@ -448,11 +435,11 @@ solib_aix_solib_create_inferior_hook (int from_tty)
gdb::optional<std::vector<lm_info_aix>> &library_list
= solib_aix_get_library_list (current_inferior (), warning_msg);
if (!library_list.has_value ())
- return; /* Warning already printed. */
+ return; /* Warning already printed. */
if (library_list->empty ())
{
- warning (_("unable to relocate main executable (no info from loader)"));
+ warning (_ ("unable to relocate main executable (no info from loader)"));
return;
}
@@ -460,8 +447,8 @@ solib_aix_solib_create_inferior_hook (int from_tty)
if (current_program_space->symfile_object_file != NULL)
{
objfile *objf = current_program_space->symfile_object_file;
- section_offsets offsets = solib_aix_get_section_offsets (objf,
- &exec_info);
+ section_offsets offsets
+ = solib_aix_get_section_offsets (objf, &exec_info);
objfile_relocate (objf, offsets);
}
@@ -491,20 +478,20 @@ solib_aix_current_sos (void)
lm_info_aix &info = (*library_list)[ix];
if (info.member_name.empty ())
{
- /* INFO.FILENAME is probably not an archive, but rather
+ /* INFO.FILENAME is probably not an archive, but rather
a shared object. Unusual, but it should be possible
to link a program against a shared object directory,
without having to put it in an archive first. */
- so_name = info.filename;
+ so_name = info.filename;
}
else
{
- /* This is the usual case on AIX, where the shared object
+ /* This is the usual case on AIX, where the shared object
is a member of an archive. Create a synthetic so_name
that follows the same convention as AIX's ldd tool
(Eg: "/lib/libc.a(shr.o)"). */
- so_name = string_printf ("%s(%s)", info.filename.c_str (),
- info.member_name.c_str ());
+ so_name = string_printf ("%s(%s)", info.filename.c_str (),
+ info.member_name.c_str ());
}
strncpy (new_solib->so_original_name, so_name.c_str (),
SO_NAME_MAX_PATH_SIZE - 1);
@@ -568,7 +555,7 @@ solib_aix_bfd_open (const char *pathname)
/* Should never happen, but recover as best as we can (trying
to open pathname without decoding, possibly leading to
a failure), rather than triggering an assert failure). */
- warning (_("missing '(' in shared object pathname: %s"), pathname);
+ warning (_ ("missing '(' in shared object pathname: %s"), pathname);
return solib_bfd_open (pathname);
}
filename_len = sep - pathname;
@@ -583,12 +570,12 @@ solib_aix_bfd_open (const char *pathname)
gdb::unique_xmalloc_ptr<char> found_pathname
= solib_find (filename.c_str (), &found_file);
if (found_pathname == NULL)
- perror_with_name (pathname);
+ perror_with_name (pathname);
gdb_bfd_ref_ptr archive_bfd (solib_bfd_fopen (found_pathname.get (),
found_file));
if (archive_bfd == NULL)
{
- warning (_("Could not open `%s' as an executable file: %s"),
+ warning (_ ("Could not open `%s' as an executable file: %s"),
filename.c_str (), bfd_errmsg (bfd_get_error ()));
return NULL;
}
@@ -596,15 +583,15 @@ solib_aix_bfd_open (const char *pathname)
if (bfd_check_format (archive_bfd.get (), bfd_object))
return archive_bfd;
- if (! bfd_check_format (archive_bfd.get (), bfd_archive))
+ if (!bfd_check_format (archive_bfd.get (), bfd_archive))
{
- warning (_("\"%s\": not in executable format: %s."),
- filename.c_str (), bfd_errmsg (bfd_get_error ()));
+ warning (_ ("\"%s\": not in executable format: %s."), filename.c_str (),
+ bfd_errmsg (bfd_get_error ()));
return NULL;
}
- gdb_bfd_ref_ptr object_bfd
- (gdb_bfd_openr_next_archived_file (archive_bfd.get (), NULL));
+ gdb_bfd_ref_ptr object_bfd (
+ gdb_bfd_openr_next_archived_file (archive_bfd.get (), NULL));
while (object_bfd != NULL)
{
if (member_name == bfd_get_filename (object_bfd.get ()))
@@ -616,16 +603,15 @@ solib_aix_bfd_open (const char *pathname)
if (object_bfd == NULL)
{
- warning (_("\"%s\": member \"%s\" missing."), filename.c_str (),
+ warning (_ ("\"%s\": member \"%s\" missing."), filename.c_str (),
member_name.c_str ());
return NULL;
}
- if (! bfd_check_format (object_bfd.get (), bfd_object))
+ if (!bfd_check_format (object_bfd.get (), bfd_object))
{
- warning (_("%s(%s): not in object format: %s."),
- filename.c_str (), member_name.c_str (),
- bfd_errmsg (bfd_get_error ()));
+ warning (_ ("%s(%s): not in object format: %s."), filename.c_str (),
+ member_name.c_str (), bfd_errmsg (bfd_get_error ()));
return NULL;
}
@@ -633,9 +619,8 @@ solib_aix_bfd_open (const char *pathname)
along with appended parenthesized member name in order to allow commands
listing all shared libraries to display. Otherwise, we would only be
displaying the name of the archive member object. */
- std::string fname = string_printf ("%s%s",
- bfd_get_filename (archive_bfd.get ()),
- sep);
+ std::string fname
+ = string_printf ("%s%s", bfd_get_filename (archive_bfd.get ()), sep);
bfd_set_filename (object_bfd.get (), fname.c_str ());
return object_bfd;
@@ -668,14 +653,14 @@ solib_aix_get_toc_value (CORE_ADDR pc)
CORE_ADDR result;
if (pc_osect == NULL)
- error (_("unable to find TOC entry for pc %s "
- "(no section contains this PC)"),
+ error (_ ("unable to find TOC entry for pc %s "
+ "(no section contains this PC)"),
core_addr_to_string (pc));
data_osect = data_obj_section_from_objfile (pc_osect->objfile);
if (data_osect == NULL)
- error (_("unable to find TOC entry for pc %s "
- "(%s has no data section)"),
+ error (_ ("unable to find TOC entry for pc %s "
+ "(%s has no data section)"),
core_addr_to_string (pc), objfile_name (pc_osect->objfile));
result = data_osect->addr () + xcoff_get_toc_offset (pc_osect->objfile);
@@ -701,8 +686,7 @@ solib_aix_normal_stop_observer (struct bpstat *unused_1, int unused_2)
}
/* The target_so_ops for AIX targets. */
-const struct target_so_ops solib_aix_so_ops =
-{
+const struct target_so_ops solib_aix_so_ops = {
solib_aix_relocate_section_addresses,
solib_aix_free_so,
nullptr,
@@ -715,6 +699,7 @@ const struct target_so_ops solib_aix_so_ops =
};
void _initialize_solib_aix ();
+
void
_initialize_solib_aix ()
{
diff --git a/gdb/solib-darwin.c b/gdb/solib-darwin.c
index 1f52dd46352..b3091494dcf 100644
--- a/gdb/solib-darwin.c
+++ b/gdb/solib-darwin.c
@@ -77,7 +77,9 @@ struct darwin_info
CORE_ADDR all_image_addr = 0;
/* Gdb copy of dyld_all_info_infos. */
- struct gdb_dyld_all_image_infos all_image {};
+ struct gdb_dyld_all_image_infos all_image
+ {
+ };
};
/* Per-program-space data key. */
@@ -105,7 +107,7 @@ static int
darwin_dyld_version_ok (const struct darwin_info *info)
{
return info->all_image.version >= DYLD_VERSION_MIN
- && info->all_image.version <= DYLD_VERSION_MAX;
+ && info->all_image.version <= DYLD_VERSION_MAX;
}
/* Read dyld_all_image from inferior. */
@@ -139,8 +141,8 @@ darwin_load_image_infos (struct darwin_info *info)
info->all_image.count = extract_unsigned_integer (buf + 4, 4, byte_order);
info->all_image.info = extract_typed_address (buf + 8, ptr_type);
- info->all_image.notifier = extract_typed_address
- (buf + 8 + ptr_type->length (), ptr_type);
+ info->all_image.notifier
+ = extract_typed_address (buf + 8 + ptr_type->length (), ptr_type);
}
/* Link map info to include in an allocated so_list entry. */
@@ -201,7 +203,8 @@ find_program_interpreter (void)
bfd_mach_o_load_command *cmd;
if (bfd_mach_o_lookup_command (current_program_space->exec_bfd (),
- BFD_MACH_O_LC_LOAD_DYLINKER, &cmd) == 1)
+ BFD_MACH_O_LC_LOAD_DYLINKER, &cmd)
+ == 1)
return cmd->command.dylinker.name_str;
}
@@ -266,13 +269,13 @@ darwin_current_sos (void)
if (target_read_memory (load_addr, (gdb_byte *) &hdr, sizeof (hdr) - 4))
break;
/* Discard wrong magic numbers. Shouldn't happen. */
- hdr_val = extract_unsigned_integer
- (hdr.magic, sizeof (hdr.magic), byte_order);
+ hdr_val
+ = extract_unsigned_integer (hdr.magic, sizeof (hdr.magic), byte_order);
if (hdr_val != BFD_MACH_O_MH_MAGIC && hdr_val != BFD_MACH_O_MH_MAGIC_64)
continue;
/* Discard executable. Should happen only once. */
- hdr_val = extract_unsigned_integer
- (hdr.filetype, sizeof (hdr.filetype), byte_order);
+ hdr_val = extract_unsigned_integer (hdr.filetype, sizeof (hdr.filetype),
+ byte_order);
if (hdr_val == BFD_MACH_O_MH_EXECUTE)
continue;
@@ -317,14 +320,14 @@ darwin_validate_exec_header (CORE_ADDR load_addr)
return 0;
/* Discard wrong magic numbers. Shouldn't happen. */
- hdr_val = extract_unsigned_integer
- (hdr.magic, sizeof (hdr.magic), byte_order);
+ hdr_val
+ = extract_unsigned_integer (hdr.magic, sizeof (hdr.magic), byte_order);
if (hdr_val != BFD_MACH_O_MH_MAGIC && hdr_val != BFD_MACH_O_MH_MAGIC_64)
return 0;
/* Check executable. */
- hdr_val = extract_unsigned_integer
- (hdr.filetype, sizeof (hdr.filetype), byte_order);
+ hdr_val = extract_unsigned_integer (hdr.filetype, sizeof (hdr.filetype),
+ byte_order);
if (hdr_val == BFD_MACH_O_MH_EXECUTE)
return load_addr;
@@ -378,7 +381,8 @@ darwin_read_exec_load_addr_at_init (struct darwin_info *info)
/* Get SP. */
if (regcache_cooked_read_unsigned (get_current_regcache (),
gdbarch_sp_regnum (gdbarch),
- &load_ptr_addr) != REG_VALID)
+ &load_ptr_addr)
+ != REG_VALID)
return 0;
/* Read value at SP (image load address). */
@@ -440,9 +444,9 @@ darwin_get_dyld_bfd ()
gdb_bfd_ref_ptr dyld_bfd (gdb_bfd_open (interp_name, gnutarget));
if (dyld_bfd != NULL)
{
- gdb_bfd_ref_ptr sub
- (gdb_bfd_mach_o_fat_extract (dyld_bfd.get (), bfd_object,
- gdbarch_bfd_arch_info (target_gdbarch ())));
+ gdb_bfd_ref_ptr sub (gdb_bfd_mach_o_fat_extract (
+ dyld_bfd.get (), bfd_object,
+ gdbarch_bfd_arch_info (target_gdbarch ())));
dyld_bfd = sub;
}
return dyld_bfd;
@@ -467,8 +471,8 @@ darwin_solib_get_all_image_info_addr_at_init (struct darwin_info *info)
- bfd_get_start_address (dyld_bfd.get ()));
/* Now try to set a breakpoint in the dynamic linker. */
- info->all_image_addr =
- lookup_symbol_from_bfd (dyld_bfd.get (), "_dyld_all_image_infos");
+ info->all_image_addr
+ = lookup_symbol_from_bfd (dyld_bfd.get (), "_dyld_all_image_infos");
if (info->all_image_addr == 0)
return;
@@ -491,8 +495,8 @@ darwin_solib_read_all_image_info_addr (struct darwin_info *info)
return;
len = target_read (current_inferior ()->top_target (),
- TARGET_OBJECT_DARWIN_DYLD_INFO,
- NULL, buf, 0, ptr_type->length ());
+ TARGET_OBJECT_DARWIN_DYLD_INFO, NULL, buf, 0,
+ ptr_type->length ());
if (len <= 0)
return;
@@ -527,7 +531,7 @@ darwin_solib_create_inferior_hook (int from_tty)
if (!darwin_dyld_version_ok (info))
{
- warning (_("unhandled dyld version (%d)"), info->all_image.version);
+ warning (_ ("unhandled dyld version (%d)"), info->all_image.version);
return;
}
@@ -551,7 +555,8 @@ darwin_solib_create_inferior_hook (int from_tty)
CORE_ADDR vmaddr;
/* Find the base address of the executable. */
- vmaddr = bfd_mach_o_get_base_address (current_program_space->exec_bfd ());
+ vmaddr
+ = bfd_mach_o_get_base_address (current_program_space->exec_bfd ());
/* Relocate. */
if (vmaddr != load_addr)
@@ -579,7 +584,7 @@ darwin_solib_create_inferior_hook (int from_tty)
CORE_ADDR dyld_relocated_base_address;
CORE_ADDR pc;
- dyld_bfd_start_address = bfd_get_start_address (dyld_bfd.get());
+ dyld_bfd_start_address = bfd_get_start_address (dyld_bfd.get ());
/* We find the dynamic linker's base address by examining
the current pc (which should point at the entry point
@@ -645,7 +650,7 @@ darwin_relocate_section_addresses (struct so_list *so,
if (sec->addr < so->addr_low)
so->addr_low = sec->addr;
}
-
+
static gdb_bfd_ref_ptr
darwin_bfd_open (const char *pathname)
{
@@ -660,11 +665,10 @@ darwin_bfd_open (const char *pathname)
/* Open bfd for shared library. */
gdb_bfd_ref_ptr abfd (solib_bfd_fopen (found_pathname.get (), found_file));
- gdb_bfd_ref_ptr res
- (gdb_bfd_mach_o_fat_extract (abfd.get (), bfd_object,
- gdbarch_bfd_arch_info (target_gdbarch ())));
+ gdb_bfd_ref_ptr res (gdb_bfd_mach_o_fat_extract (
+ abfd.get (), bfd_object, gdbarch_bfd_arch_info (target_gdbarch ())));
if (res == NULL)
- error (_("`%s': not a shared-library: %s"),
+ error (_ ("`%s': not a shared-library: %s"),
bfd_get_filename (abfd.get ()), bfd_errmsg (bfd_get_error ()));
/* The current filename for fat-binary BFDs is a name generated
@@ -675,8 +679,7 @@ darwin_bfd_open (const char *pathname)
return res;
}
-const struct target_so_ops darwin_so_ops =
-{
+const struct target_so_ops darwin_so_ops = {
darwin_relocate_section_addresses,
darwin_free_so,
nullptr,
diff --git a/gdb/solib-dsbt.c b/gdb/solib-dsbt.c
index 557df74eb00..38605b71151 100644
--- a/gdb/solib-dsbt.c
+++ b/gdb/solib-dsbt.c
@@ -16,7 +16,6 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
-
#include "defs.h"
#include "inferior.h"
#include "gdbcore.h"
@@ -37,7 +36,10 @@
static unsigned int solib_dsbt_debug = 0;
/* TIC6X pointers are four bytes wide. */
-enum { TIC6X_PTR_SIZE = 4 };
+enum
+{
+ TIC6X_PTR_SIZE = 4
+};
/* Representation of loadmap and related structs for the TIC6X DSBT. */
@@ -58,7 +60,8 @@ struct ext_elf32_dsbt_loadseg
ext_Elf32_Word p_memsz;
};
-struct ext_elf32_dsbt_loadmap {
+struct ext_elf32_dsbt_loadmap
+{
/* Protocol version number, must be zero. */
ext_Elf32_Word version;
/* A pointer to the DSBT table; the DSBT size and the index of this
@@ -105,7 +108,7 @@ typedef gdb_byte ext_ptr[4];
struct ext_elf32_dsbt_loadaddr
{
- ext_ptr map; /* struct elf32_dsbt_loadmap *map; */
+ ext_ptr map; /* struct elf32_dsbt_loadmap *map; */
};
struct dbst_ext_link_map
@@ -113,23 +116,20 @@ struct dbst_ext_link_map
struct ext_elf32_dsbt_loadaddr l_addr;
/* Absolute file name object was found in. */
- ext_ptr l_name; /* char *l_name; */
+ ext_ptr l_name; /* char *l_name; */
/* Dynamic section of the shared object. */
- ext_ptr l_ld; /* ElfW(Dyn) *l_ld; */
+ ext_ptr l_ld; /* ElfW(Dyn) *l_ld; */
/* Chain of loaded objects. */
- ext_ptr l_next, l_prev; /* struct link_map *l_next, *l_prev; */
+ ext_ptr l_next, l_prev; /* struct link_map *l_next, *l_prev; */
};
/* Link map info to include in an allocated so_list entry */
struct lm_info_dsbt : public lm_info_base
{
- ~lm_info_dsbt ()
- {
- xfree (this->map);
- }
+ ~lm_info_dsbt () { xfree (this->map); }
/* The loadmap, digested into an easier to use form. */
int_elf32_dsbt_loadmap *map = NULL;
@@ -182,7 +182,6 @@ get_dsbt_info (void)
return solib_dsbt_pspace_data.emplace (current_program_space);
}
-
static void
dsbt_print_loadmap (struct int_elf32_dsbt_loadmap *map)
{
@@ -191,21 +190,20 @@ dsbt_print_loadmap (struct int_elf32_dsbt_loadmap *map)
if (map == NULL)
gdb_printf ("(null)\n");
else if (map->version != 0)
- gdb_printf (_("Unsupported map version: %d\n"), map->version);
+ gdb_printf (_ ("Unsupported map version: %d\n"), map->version);
else
{
gdb_printf ("version %d\n", map->version);
for (i = 0; i < map->nsegs; i++)
- gdb_printf ("%s:%s -> %s:%s\n",
- print_core_address (target_gdbarch (),
- map->segs[i].p_vaddr),
- print_core_address (target_gdbarch (),
- map->segs[i].p_vaddr
- + map->segs[i].p_memsz),
- print_core_address (target_gdbarch (), map->segs[i].addr),
- print_core_address (target_gdbarch (), map->segs[i].addr
- + map->segs[i].p_memsz));
+ gdb_printf (
+ "%s:%s -> %s:%s\n",
+ print_core_address (target_gdbarch (), map->segs[i].p_vaddr),
+ print_core_address (target_gdbarch (),
+ map->segs[i].p_vaddr + map->segs[i].p_memsz),
+ print_core_address (target_gdbarch (), map->segs[i].addr),
+ print_core_address (target_gdbarch (),
+ map->segs[i].addr + map->segs[i].p_memsz));
}
}
@@ -225,8 +223,7 @@ decode_loadmap (const gdb_byte *buf)
/* Extract the version. */
version = extract_unsigned_integer (ext_ldmbuf->version,
- sizeof ext_ldmbuf->version,
- byte_order);
+ sizeof ext_ldmbuf->version, byte_order);
if (version != 0)
{
/* We only handle version 0. */
@@ -235,8 +232,7 @@ decode_loadmap (const gdb_byte *buf)
/* Extract the number of segments. */
nsegs = extract_unsigned_integer (ext_ldmbuf->nsegs,
- sizeof ext_ldmbuf->nsegs,
- byte_order);
+ sizeof ext_ldmbuf->nsegs, byte_order);
if (nsegs <= 0)
return NULL;
@@ -269,7 +265,6 @@ decode_loadmap (const gdb_byte *buf)
return int_ldmbuf;
}
-
static struct dsbt_info *get_dsbt_info (void);
/* Interrogate the Linux kernel to find out where the program was loaded.
@@ -287,7 +282,7 @@ dsbt_get_initial_loadmaps (void)
if (!buf || buf->empty ())
{
info->exec_loadmap = NULL;
- error (_("Error reading DSBT exec loadmap"));
+ error (_ ("Error reading DSBT exec loadmap"));
}
info->exec_loadmap = decode_loadmap (buf->data ());
if (solib_dsbt_debug)
@@ -298,7 +293,7 @@ dsbt_get_initial_loadmaps (void)
if (!buf || buf->empty ())
{
info->interp_loadmap = NULL;
- error (_("Error reading DSBT interp loadmap"));
+ error (_ ("Error reading DSBT interp loadmap"));
}
info->interp_loadmap = decode_loadmap (buf->data ());
if (solib_dsbt_debug)
@@ -330,9 +325,9 @@ fetch_loadmap (CORE_ADDR ldmaddr)
}
/* Extract the version. */
- version = extract_unsigned_integer (ext_ldmbuf_partial.version,
- sizeof ext_ldmbuf_partial.version,
- byte_order);
+ version
+ = extract_unsigned_integer (ext_ldmbuf_partial.version,
+ sizeof ext_ldmbuf_partial.version, byte_order);
if (version != 0)
{
/* We only handle version 0. */
@@ -340,16 +335,16 @@ fetch_loadmap (CORE_ADDR ldmaddr)
}
/* Extract the number of segments. */
- nsegs = extract_unsigned_integer (ext_ldmbuf_partial.nsegs,
- sizeof ext_ldmbuf_partial.nsegs,
- byte_order);
+ nsegs
+ = extract_unsigned_integer (ext_ldmbuf_partial.nsegs,
+ sizeof ext_ldmbuf_partial.nsegs, byte_order);
if (nsegs <= 0)
return NULL;
/* Allocate space for the complete (external) loadmap. */
ext_ldmbuf_size = sizeof (struct ext_elf32_dsbt_loadmap)
- + (nsegs - 1) * sizeof (struct ext_elf32_dsbt_loadseg);
+ + (nsegs - 1) * sizeof (struct ext_elf32_dsbt_loadseg);
ext_ldmbuf = (struct ext_elf32_dsbt_loadmap *) xmalloc (ext_ldmbuf_size);
/* Copy over the portion of the loadmap that's already been read. */
@@ -368,7 +363,7 @@ fetch_loadmap (CORE_ADDR ldmaddr)
/* Allocate space into which to put information extract from the
external loadsegs. I.e, allocate the internal loadsegs. */
int_ldmbuf_size = sizeof (struct int_elf32_dsbt_loadmap)
- + (nsegs - 1) * sizeof (struct int_elf32_dsbt_loadseg);
+ + (nsegs - 1) * sizeof (struct int_elf32_dsbt_loadseg);
int_ldmbuf = (struct int_elf32_dsbt_loadmap *) xmalloc (int_ldmbuf_size);
/* Place extracted information in internal structs. */
@@ -410,8 +405,7 @@ open_symbol_file_object (int from_tty)
to relocate the address. */
static CORE_ADDR
-displacement_from_map (struct int_elf32_dsbt_loadmap *map,
- CORE_ADDR addr)
+displacement_from_map (struct int_elf32_dsbt_loadmap *map, CORE_ADDR addr)
{
int seg;
@@ -467,8 +461,8 @@ lm_base (void)
(unsigned int) addr);
}
else if (gdb_bfd_scan_elf_dyntag (DT_PLTGOT,
- current_program_space->exec_bfd (),
- &addr, NULL))
+ current_program_space->exec_bfd (), &addr,
+ NULL))
{
struct int_elf32_dsbt_loadmap *ldm;
@@ -476,22 +470,19 @@ lm_base (void)
ldm = info->exec_loadmap;
addr += displacement_from_map (ldm, addr);
if (solib_dsbt_debug)
- gdb_printf (gdb_stdlog,
- "lm_base: get addr %x by DT_PLTGOT.\n",
+ gdb_printf (gdb_stdlog, "lm_base: get addr %x by DT_PLTGOT.\n",
(unsigned int) addr);
}
else
{
if (solib_dsbt_debug)
- gdb_printf (gdb_stdlog,
- "lm_base: _GLOBAL_OFFSET_TABLE_ not found.\n");
+ gdb_printf (gdb_stdlog, "lm_base: _GLOBAL_OFFSET_TABLE_ not found.\n");
return 0;
}
addr += GOT_MODULE_OFFSET;
if (solib_dsbt_debug)
- gdb_printf (gdb_stdlog,
- "lm_base: _GLOBAL_OFFSET_TABLE_ + %d = %s\n",
+ gdb_printf (gdb_stdlog, "lm_base: _GLOBAL_OFFSET_TABLE_ + %d = %s\n",
GOT_MODULE_OFFSET, hex_string_custom (addr, 8));
if (target_read_memory (addr, buf, sizeof buf) != 0)
@@ -499,14 +490,12 @@ lm_base (void)
info->lm_base_cache = extract_unsigned_integer (buf, sizeof buf, byte_order);
if (solib_dsbt_debug)
- gdb_printf (gdb_stdlog,
- "lm_base: lm_base_cache = %s\n",
+ gdb_printf (gdb_stdlog, "lm_base: lm_base_cache = %s\n",
hex_string_custom (info->lm_base_cache, 8));
return info->lm_base_cache;
}
-
/* Build a list of `struct so_list' objects describing the shared
objects currently loaded in the inferior. This list does not
include an entry for the main executable file.
@@ -554,33 +543,33 @@ dsbt_current_sos (void)
int ret;
if (solib_dsbt_debug)
- gdb_printf (gdb_stdlog,
- "current_sos: reading link_map entry at %s\n",
+ gdb_printf (gdb_stdlog, "current_sos: reading link_map entry at %s\n",
hex_string_custom (lm_addr, 8));
- ret = target_read_memory (lm_addr, (gdb_byte *) &lm_buf, sizeof (lm_buf));
+ ret
+ = target_read_memory (lm_addr, (gdb_byte *) &lm_buf, sizeof (lm_buf));
if (ret)
{
- warning (_("dsbt_current_sos: Unable to read link map entry."
- " Shared object chain may be incomplete."));
+ warning (_ ("dsbt_current_sos: Unable to read link map entry."
+ " Shared object chain may be incomplete."));
break;
}
/* Fetch the load map address. */
- map_addr = extract_unsigned_integer (lm_buf.l_addr.map,
- sizeof lm_buf.l_addr.map,
- byte_order);
+ map_addr
+ = extract_unsigned_integer (lm_buf.l_addr.map,
+ sizeof lm_buf.l_addr.map, byte_order);
ret = target_read_memory (map_addr + 12, (gdb_byte *) &indexword,
sizeof indexword);
if (ret)
{
- warning (_("dsbt_current_sos: Unable to read dsbt index."
- " Shared object chain may be incomplete."));
+ warning (_ ("dsbt_current_sos: Unable to read dsbt index."
+ " Shared object chain may be incomplete."));
break;
}
- dsbt_index = extract_unsigned_integer (indexword, sizeof indexword,
- byte_order);
+ dsbt_index
+ = extract_unsigned_integer (indexword, sizeof indexword, byte_order);
/* If the DSBT index is zero, then we're looking at the entry
for the main executable. By convention, we don't include
@@ -594,8 +583,8 @@ dsbt_current_sos (void)
loadmap = fetch_loadmap (map_addr);
if (loadmap == NULL)
{
- warning (_("dsbt_current_sos: Unable to fetch load map."
- " Shared object chain may be incomplete."));
+ warning (_ ("dsbt_current_sos: Unable to fetch load map."
+ " Shared object chain may be incomplete."));
break;
}
@@ -605,20 +594,20 @@ dsbt_current_sos (void)
li->map = loadmap;
/* Fetch the name. */
addr = extract_unsigned_integer (lm_buf.l_name,
- sizeof (lm_buf.l_name),
- byte_order);
+ sizeof (lm_buf.l_name), byte_order);
gdb::unique_xmalloc_ptr<char> name_buf
= target_read_string (addr, SO_NAME_MAX_PATH_SIZE - 1);
if (name_buf == nullptr)
- warning (_("Can't read pathname for link map entry."));
+ warning (_ ("Can't read pathname for link map entry."));
else
{
if (solib_dsbt_debug)
gdb_printf (gdb_stdlog, "current_sos: name = %s\n",
name_buf.get ());
- strncpy (sop->so_name, name_buf.get (), SO_NAME_MAX_PATH_SIZE - 1);
+ strncpy (sop->so_name, name_buf.get (),
+ SO_NAME_MAX_PATH_SIZE - 1);
sop->so_name[SO_NAME_MAX_PATH_SIZE - 1] = '\0';
strcpy (sop->so_original_name, sop->so_name);
}
@@ -646,9 +635,10 @@ dsbt_in_dynsym_resolve_code (CORE_ADDR pc)
{
struct dsbt_info *info = get_dsbt_info ();
- return ((pc >= info->interp_text_sect_low && pc < info->interp_text_sect_high)
- || (pc >= info->interp_plt_sect_low && pc < info->interp_plt_sect_high)
- || in_plt_section (pc));
+ return (
+ (pc >= info->interp_text_sect_low && pc < info->interp_text_sect_high)
+ || (pc >= info->interp_plt_sect_low && pc < info->interp_plt_sect_high)
+ || in_plt_section (pc));
}
/* Print a warning about being unable to set the dynamic linker
@@ -657,9 +647,9 @@ dsbt_in_dynsym_resolve_code (CORE_ADDR pc)
static void
enable_break_failure_warning (void)
{
- warning (_("Unable to find dynamic linker breakpoint function.\n"
- "GDB will be unable to debug shared library initializers\n"
- "and track explicitly loaded dynamic code."));
+ warning (_ ("Unable to find dynamic linker breakpoint function.\n"
+ "GDB will be unable to debug shared library initializers\n"
+ "and track explicitly loaded dynamic code."));
}
/* Helper function for gdb_bfd_lookup_symbol. */
@@ -699,8 +689,8 @@ enable_break (void)
/* Find the .interp section; if not found, warn the user and drop
into the old breakpoint at symbol code. */
- interp_sect = bfd_get_section_by_name (current_program_space->exec_bfd (),
- ".interp");
+ interp_sect
+ = bfd_get_section_by_name (current_program_space->exec_bfd (), ".interp");
if (interp_sect)
{
unsigned int interp_sect_size;
@@ -759,20 +749,22 @@ enable_break (void)
= info->interp_plt_sect_low + bfd_section_size (interp_sect);
}
- addr = gdb_bfd_lookup_symbol (tmp_bfd.get (), cmp_name,
- "_dl_debug_state");
+ addr
+ = gdb_bfd_lookup_symbol (tmp_bfd.get (), cmp_name, "_dl_debug_state");
if (addr != 0)
{
if (solib_dsbt_debug)
- gdb_printf (gdb_stdlog,
- "enable_break: _dl_debug_state (prior to relocation) = %s\n",
- hex_string_custom (addr, 8));
+ gdb_printf (
+ gdb_stdlog,
+ "enable_break: _dl_debug_state (prior to relocation) = %s\n",
+ hex_string_custom (addr, 8));
addr += displacement_from_map (ldm, addr);
if (solib_dsbt_debug)
- gdb_printf (gdb_stdlog,
- "enable_break: _dl_debug_state (after relocation) = %s\n",
- hex_string_custom (addr, 8));
+ gdb_printf (
+ gdb_stdlog,
+ "enable_break: _dl_debug_state (after relocation) = %s\n",
+ hex_string_custom (addr, 8));
/* Now (finally!) create the solib breakpoint. */
create_solib_event_breakpoint (target_gdbarch (), addr);
@@ -872,7 +864,7 @@ dsbt_solib_create_inferior_hook (int from_tty)
/* Enable shared library breakpoints. */
if (!enable_break ())
{
- warning (_("shared library handler failed to enable breakpoint"));
+ warning (_ ("shared library handler failed to enable breakpoint"));
return;
}
}
@@ -918,15 +910,15 @@ dsbt_relocate_section_addresses (struct so_list *so,
}
}
}
+
static void
show_dsbt_debug (struct ui_file *file, int from_tty,
struct cmd_list_element *c, const char *value)
{
- gdb_printf (file, _("solib-dsbt debugging is %s.\n"), value);
+ gdb_printf (file, _ ("solib-dsbt debugging is %s.\n"), value);
}
-const struct target_so_ops dsbt_so_ops =
-{
+const struct target_so_ops dsbt_so_ops = {
dsbt_relocate_section_addresses,
dsbt_free_so,
nullptr,
@@ -939,16 +931,18 @@ const struct target_so_ops dsbt_so_ops =
};
void _initialize_dsbt_solib ();
+
void
_initialize_dsbt_solib ()
{
/* Debug this file's internals. */
add_setshow_zuinteger_cmd ("solib-dsbt", class_maintenance,
- &solib_dsbt_debug, _("\
-Set internal debugging of shared library code for DSBT ELF."), _("\
-Show internal debugging of shared library code for DSBT ELF."), _("\
+ &solib_dsbt_debug, _ ("\
+Set internal debugging of shared library code for DSBT ELF."),
+ _ ("\
+Show internal debugging of shared library code for DSBT ELF."),
+ _ ("\
When non-zero, DSBT solib specific internal debugging is enabled."),
- NULL,
- show_dsbt_debug,
- &setdebuglist, &showdebuglist);
+ NULL, show_dsbt_debug, &setdebuglist,
+ &showdebuglist);
}
diff --git a/gdb/solib-frv.c b/gdb/solib-frv.c
index 38aed7a6ca4..a76b667853c 100644
--- a/gdb/solib-frv.c
+++ b/gdb/solib-frv.c
@@ -16,7 +16,6 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
-
#include "defs.h"
#include "inferior.h"
#include "gdbcore.h"
@@ -32,7 +31,10 @@
#include "gdb_bfd.h"
/* FR-V pointers are four bytes wide. */
-enum { FRV_PTR_SIZE = 4 };
+enum
+{
+ FRV_PTR_SIZE = 4
+};
/* Representation of loadmap and related structs for the FR-V FDPIC ABI. */
@@ -53,7 +55,8 @@ struct ext_elf32_fdpic_loadseg
ext_Elf32_Word p_memsz;
};
-struct ext_elf32_fdpic_loadmap {
+struct ext_elf32_fdpic_loadmap
+{
/* Protocol version number, must be zero. */
ext_Elf32_Half version;
/* Number of segments in this map. */
@@ -75,7 +78,8 @@ struct int_elf32_fdpic_loadseg
long p_memsz;
};
-struct int_elf32_fdpic_loadmap {
+struct int_elf32_fdpic_loadmap
+{
/* Protocol version number, must be zero. */
int version;
/* Number of segments in this map. */
@@ -109,9 +113,9 @@ fetch_loadmap (CORE_ADDR ldmaddr)
}
/* Extract the version. */
- version = extract_unsigned_integer (ext_ldmbuf_partial.version,
- sizeof ext_ldmbuf_partial.version,
- byte_order);
+ version
+ = extract_unsigned_integer (ext_ldmbuf_partial.version,
+ sizeof ext_ldmbuf_partial.version, byte_order);
if (version != 0)
{
/* We only handle version 0. */
@@ -119,16 +123,16 @@ fetch_loadmap (CORE_ADDR ldmaddr)
}
/* Extract the number of segments. */
- nsegs = extract_unsigned_integer (ext_ldmbuf_partial.nsegs,
- sizeof ext_ldmbuf_partial.nsegs,
- byte_order);
+ nsegs
+ = extract_unsigned_integer (ext_ldmbuf_partial.nsegs,
+ sizeof ext_ldmbuf_partial.nsegs, byte_order);
if (nsegs <= 0)
return NULL;
/* Allocate space for the complete (external) loadmap. */
ext_ldmbuf_size = sizeof (struct ext_elf32_fdpic_loadmap)
- + (nsegs - 1) * sizeof (struct ext_elf32_fdpic_loadseg);
+ + (nsegs - 1) * sizeof (struct ext_elf32_fdpic_loadseg);
ext_ldmbuf = (struct ext_elf32_fdpic_loadmap *) xmalloc (ext_ldmbuf_size);
/* Copy over the portion of the loadmap that's already been read. */
@@ -147,7 +151,7 @@ fetch_loadmap (CORE_ADDR ldmaddr)
/* Allocate space into which to put information extract from the
external loadsegs. I.e, allocate the internal loadsegs. */
int_ldmbuf_size = sizeof (struct int_elf32_fdpic_loadmap)
- + (nsegs - 1) * sizeof (struct int_elf32_fdpic_loadseg);
+ + (nsegs - 1) * sizeof (struct int_elf32_fdpic_loadseg);
int_ldmbuf = (struct int_elf32_fdpic_loadmap *) xmalloc (int_ldmbuf_size);
/* Place extracted information in internal structs. */
@@ -179,8 +183,8 @@ typedef gdb_byte ext_ptr[4];
struct ext_elf32_fdpic_loadaddr
{
- ext_ptr map; /* struct elf32_fdpic_loadmap *map; */
- ext_ptr got_value; /* void *got_value; */
+ ext_ptr map; /* struct elf32_fdpic_loadmap *map; */
+ ext_ptr got_value; /* void *got_value; */
};
struct ext_link_map
@@ -188,13 +192,13 @@ struct ext_link_map
struct ext_elf32_fdpic_loadaddr l_addr;
/* Absolute file name object was found in. */
- ext_ptr l_name; /* char *l_name; */
+ ext_ptr l_name; /* char *l_name; */
/* Dynamic section of the shared object. */
- ext_ptr l_ld; /* ElfW(Dyn) *l_ld; */
+ ext_ptr l_ld; /* ElfW(Dyn) *l_ld; */
/* Chain of loaded objects. */
- ext_ptr l_next, l_prev; /* struct link_map *l_next, *l_prev; */
+ ext_ptr l_next, l_prev; /* struct link_map *l_next, *l_prev; */
};
/* Link map info to include in an allocated so_list entry. */
@@ -227,7 +231,7 @@ struct lm_info_frv : public lm_info_base
caching of the dynamic relocations could be dispensed with. */
asymbol **dyn_syms = NULL;
arelent **dyn_relocs = NULL;
- int dyn_reloc_count = 0; /* Number of dynamic relocs. */
+ int dyn_reloc_count = 0; /* Number of dynamic relocs. */
};
/* The load map, got value, etc. are not available from the chain
@@ -306,7 +310,6 @@ lm_base (void)
return lm_base_cache;
}
-
/* Implement the "current_sos" target_so_ops method. */
static struct so_list *
@@ -348,18 +351,17 @@ frv_current_sos (void)
solib_debug_printf ("reading link_map entry at %s",
hex_string_custom (lm_addr, 8));
- if (target_read_memory (lm_addr, (gdb_byte *) &lm_buf,
- sizeof (lm_buf)) != 0)
+ if (target_read_memory (lm_addr, (gdb_byte *) &lm_buf, sizeof (lm_buf))
+ != 0)
{
- warning (_("frv_current_sos: Unable to read link map entry. "
- "Shared object chain may be incomplete."));
+ warning (_ ("frv_current_sos: Unable to read link map entry. "
+ "Shared object chain may be incomplete."));
break;
}
- got_addr
- = extract_unsigned_integer (lm_buf.l_addr.got_value,
- sizeof (lm_buf.l_addr.got_value),
- byte_order);
+ got_addr = extract_unsigned_integer (lm_buf.l_addr.got_value,
+ sizeof (lm_buf.l_addr.got_value),
+ byte_order);
/* If the got_addr is the same as mgotr, then we're looking at the
entry for the main executable. By convention, we don't include
this in the list of shared objects. */
@@ -370,14 +372,14 @@ frv_current_sos (void)
CORE_ADDR addr;
/* Fetch the load map address. */
- addr = extract_unsigned_integer (lm_buf.l_addr.map,
- sizeof lm_buf.l_addr.map,
- byte_order);
+ addr
+ = extract_unsigned_integer (lm_buf.l_addr.map,
+ sizeof lm_buf.l_addr.map, byte_order);
loadmap = fetch_loadmap (addr);
if (loadmap == NULL)
{
- warning (_("frv_current_sos: Unable to fetch load map. "
- "Shared object chain may be incomplete."));
+ warning (_ ("frv_current_sos: Unable to fetch load map. "
+ "Shared object chain may be incomplete."));
break;
}
@@ -389,15 +391,14 @@ frv_current_sos (void)
li->lm_addr = lm_addr;
/* Fetch the name. */
addr = extract_unsigned_integer (lm_buf.l_name,
- sizeof (lm_buf.l_name),
- byte_order);
+ sizeof (lm_buf.l_name), byte_order);
gdb::unique_xmalloc_ptr<char> name_buf
= target_read_string (addr, SO_NAME_MAX_PATH_SIZE - 1);
solib_debug_printf ("name = %s", name_buf.get ());
if (name_buf == nullptr)
- warning (_("Can't read pathname for link map entry."));
+ warning (_ ("Can't read pathname for link map entry."));
else
{
strncpy (sop->so_name, name_buf.get (),
@@ -423,7 +424,6 @@ frv_current_sos (void)
return sos_head;
}
-
/* Return 1 if PC lies in the dynamic symbol resolution code of the
run time loader. */
@@ -444,8 +444,7 @@ frv_in_dynsym_resolve_code (CORE_ADDR pc)
to relocate the address. */
static CORE_ADDR
-displacement_from_map (struct int_elf32_fdpic_loadmap *map,
- CORE_ADDR addr)
+displacement_from_map (struct int_elf32_fdpic_loadmap *map, CORE_ADDR addr)
{
int seg;
@@ -467,9 +466,9 @@ displacement_from_map (struct int_elf32_fdpic_loadmap *map,
static void
enable_break_failure_warning (void)
{
- warning (_("Unable to find dynamic linker breakpoint function.\n"
- "GDB will be unable to debug shared library initializers\n"
- "and track explicitly loaded dynamic code."));
+ warning (_ ("Unable to find dynamic linker breakpoint function.\n"
+ "GDB will be unable to debug shared library initializers\n"
+ "and track explicitly loaded dynamic code."));
}
/* Helper function for gdb_bfd_lookup_symbol. */
@@ -518,8 +517,8 @@ enable_break2 (void)
/* Find the .interp section; if not found, warn the user and drop
into the old breakpoint at symbol code. */
- interp_sect = bfd_get_section_by_name (current_program_space->exec_bfd (),
- ".interp");
+ interp_sect
+ = bfd_get_section_by_name (current_program_space->exec_bfd (), ".interp");
if (interp_sect)
{
unsigned int interp_sect_size;
@@ -564,7 +563,7 @@ enable_break2 (void)
&interp_loadmap_addr, 0);
if (status < 0)
{
- warning (_("Unable to determine dynamic linker loadmap address."));
+ warning (_ ("Unable to determine dynamic linker loadmap address."));
enable_break_failure_warning ();
return 0;
}
@@ -575,7 +574,7 @@ enable_break2 (void)
ldm = fetch_loadmap (interp_loadmap_addr);
if (ldm == NULL)
{
- warning (_("Unable to load dynamic linker loadmap at address %s."),
+ warning (_ ("Unable to load dynamic linker loadmap at address %s."),
hex_string_custom (interp_loadmap_addr, 8));
enable_break_failure_warning ();
return 0;
@@ -598,16 +597,17 @@ enable_break2 (void)
interp_plt_sect_low = bfd_section_vma (interp_sect);
interp_plt_sect_low
+= displacement_from_map (ldm, interp_plt_sect_low);
- interp_plt_sect_high =
- interp_plt_sect_low + bfd_section_size (interp_sect);
+ interp_plt_sect_high
+ = interp_plt_sect_low + bfd_section_size (interp_sect);
}
- addr = gdb_bfd_lookup_symbol (tmp_bfd.get (), cmp_name, "_dl_debug_addr");
+ addr
+ = gdb_bfd_lookup_symbol (tmp_bfd.get (), cmp_name, "_dl_debug_addr");
if (addr == 0)
{
- warning (_("Could not find symbol _dl_debug_addr "
- "in dynamic linker"));
+ warning (_ ("Could not find symbol _dl_debug_addr "
+ "in dynamic linker"));
enable_break_failure_warning ();
return 0;
}
@@ -623,8 +623,8 @@ enable_break2 (void)
/* Fetch the address of the r_debug struct. */
if (target_read_memory (addr, addr_buf, sizeof addr_buf) != 0)
{
- warning (_("Unable to fetch contents of _dl_debug_addr "
- "(at address %s) from dynamic linker"),
+ warning (_ ("Unable to fetch contents of _dl_debug_addr "
+ "(at address %s) from dynamic linker"),
hex_string_custom (addr, 8));
}
addr = extract_unsigned_integer (addr_buf, sizeof addr_buf, byte_order);
@@ -645,8 +645,8 @@ enable_break2 (void)
_dl_debug_addr. */
if (target_read_memory (addr + 8, addr_buf, sizeof addr_buf) != 0)
{
- warning (_("Unable to fetch _dl_debug_addr->r_brk "
- "(at address %s) from dynamic linker"),
+ warning (_ ("Unable to fetch _dl_debug_addr->r_brk "
+ "(at address %s) from dynamic linker"),
hex_string_custom (addr + 8, 8));
enable_break_failure_warning ();
return 0;
@@ -656,8 +656,8 @@ enable_break2 (void)
/* Now fetch the function entry point. */
if (target_read_memory (addr, addr_buf, sizeof addr_buf) != 0)
{
- warning (_("Unable to fetch _dl_debug_addr->.r_brk entry point "
- "(at address %s) from dynamic linker"),
+ warning (_ ("Unable to fetch _dl_debug_addr->.r_brk entry point "
+ "(at address %s) from dynamic linker"),
hex_string_custom (addr, 8));
enable_break_failure_warning ();
return 0;
@@ -707,8 +707,8 @@ enable_break (void)
/* Check for the presence of a .interp section. If there is no
such section, the executable is statically linked. */
- interp_sect = bfd_get_section_by_name (current_program_space->exec_bfd (),
- ".interp");
+ interp_sect
+ = bfd_get_section_by_name (current_program_space->exec_bfd (), ".interp");
if (interp_sect == NULL)
{
@@ -732,8 +732,8 @@ frv_relocate_main_executable (void)
int changed;
struct obj_section *osect;
- status = frv_fdpic_loadmap_addresses (target_gdbarch (),
- &interp_addr, &exec_addr);
+ status = frv_fdpic_loadmap_addresses (target_gdbarch (), &interp_addr,
+ &exec_addr);
if (status < 0 || (exec_addr == 0 && interp_addr == 0))
{
@@ -744,7 +744,7 @@ frv_relocate_main_executable (void)
/* Fetch the loadmap located at ``exec_addr''. */
ldm = fetch_loadmap (exec_addr);
if (ldm == NULL)
- error (_("Unable to load the executable's loadmap."));
+ error (_ ("Unable to load the executable's loadmap."));
delete main_executable_lm_info;
main_executable_lm_info = new lm_info_frv;
@@ -759,7 +759,7 @@ frv_relocate_main_executable (void)
CORE_ADDR orig_addr, addr, offset;
int osect_idx;
int seg;
-
+
osect_idx = osect - objf->sections;
/* Current address of section. */
@@ -807,7 +807,7 @@ frv_solib_create_inferior_hook (int from_tty)
/* Enable shared library breakpoints. */
if (!enable_break ())
{
- warning (_("shared library handler failed to enable breakpoint"));
+ warning (_ ("shared library handler failed to enable breakpoint"));
return;
}
}
@@ -832,8 +832,7 @@ frv_free_so (struct so_list *so)
}
static void
-frv_relocate_section_addresses (struct so_list *so,
- struct target_section *sec)
+frv_relocate_section_addresses (struct so_list *so, struct target_section *sec)
{
int seg;
lm_info_frv *li = (lm_info_frv *) so->lm_info;
@@ -894,8 +893,10 @@ frv_fdpic_find_global_pointer (CORE_ADDR addr)
}
/* Forward declarations for frv_fdpic_find_canonical_descriptor(). */
-static CORE_ADDR find_canonical_descriptor_in_load_object
- (CORE_ADDR, CORE_ADDR, const char *, bfd *, lm_info_frv *);
+static CORE_ADDR find_canonical_descriptor_in_load_object (CORE_ADDR,
+ CORE_ADDR,
+ const char *, bfd *,
+ lm_info_frv *);
/* Given a function entry point, attempt to find the canonical descriptor
associated with that entry point. Return 0 if no canonical descriptor
@@ -923,9 +924,9 @@ frv_fdpic_find_canonical_descriptor (CORE_ADDR entry_point)
/* Check the main executable. */
objfile *objf = current_program_space->symfile_object_file;
- addr = find_canonical_descriptor_in_load_object
- (entry_point, got_value, name, objf->obfd.get (),
- main_executable_lm_info);
+ addr = find_canonical_descriptor_in_load_object (entry_point, got_value,
+ name, objf->obfd.get (),
+ main_executable_lm_info);
/* If descriptor not found via main executable, check each load object
in list of shared objects. */
@@ -935,8 +936,9 @@ frv_fdpic_find_canonical_descriptor (CORE_ADDR entry_point)
{
lm_info_frv *li = (lm_info_frv *) so->lm_info;
- addr = find_canonical_descriptor_in_load_object
- (entry_point, got_value, name, so->abfd, li);
+ addr
+ = find_canonical_descriptor_in_load_object (entry_point, got_value,
+ name, so->abfd, li);
if (addr != 0)
break;
@@ -947,9 +949,10 @@ frv_fdpic_find_canonical_descriptor (CORE_ADDR entry_point)
}
static CORE_ADDR
-find_canonical_descriptor_in_load_object
- (CORE_ADDR entry_point, CORE_ADDR got_value, const char *name, bfd *abfd,
- lm_info_frv *lm)
+find_canonical_descriptor_in_load_object (CORE_ADDR entry_point,
+ CORE_ADDR got_value,
+ const char *name, bfd *abfd,
+ lm_info_frv *lm)
{
enum bfd_endian byte_order = gdbarch_byte_order (target_gdbarch ());
arelent *rel;
@@ -1008,7 +1011,7 @@ find_canonical_descriptor_in_load_object
lm->dyn_relocs = (arelent **) xmalloc (storage_needed);
/* Fetch the dynamic relocs. */
- lm->dyn_reloc_count
+ lm->dyn_reloc_count
= bfd_canonicalize_dynamic_reloc (abfd, lm->dyn_relocs, lm->dyn_syms);
}
@@ -1036,7 +1039,7 @@ find_canonical_descriptor_in_load_object
if ((name == 0 || strcmp (name, (*rel->sym_ptr_ptr)->name) == 0)
&& rel->howto->type == R_FRV_FUNCDESC)
{
- gdb_byte buf [FRV_PTR_SIZE];
+ gdb_byte buf[FRV_PTR_SIZE];
/* Compute address of address of candidate descriptor. */
addr = rel->address + displacement_from_map (lm->map, rel->address);
@@ -1095,8 +1098,7 @@ frv_fetch_objfile_link_map (struct objfile *objfile)
return 0;
}
-const struct target_so_ops frv_so_ops =
-{
+const struct target_so_ops frv_so_ops = {
frv_relocate_section_addresses,
frv_free_so,
nullptr,
diff --git a/gdb/solib-rocm.c b/gdb/solib-rocm.c
index 2b965acc790..7d28ef52226 100644
--- a/gdb/solib-rocm.c
+++ b/gdb/solib-rocm.c
@@ -61,7 +61,6 @@ rocm_free_solib_list (struct solib_info *info)
info->solib_list = nullptr;
}
-
/* Fetch the solib_info data for INF. */
static struct solib_info *
@@ -165,7 +164,8 @@ rocm_solib_current_sos ()
return head;
}
-namespace {
+namespace
+{
/* Interface to interact with a ROCm code object stream. */
@@ -189,6 +189,7 @@ struct rocm_code_object_stream
virtual ~rocm_code_object_stream () = default;
protected:
+
rocm_code_object_stream () = default;
/* Return the size of the object file, or -1 if the size cannot be
@@ -238,15 +239,17 @@ protected:
ULONGEST m_size;
};
-rocm_code_object_stream_file::rocm_code_object_stream_file
- (int fd, ULONGEST offset, ULONGEST size)
- : m_fd (fd), m_offset (offset), m_size (size)
+rocm_code_object_stream_file::rocm_code_object_stream_file (int fd,
+ ULONGEST offset,
+ ULONGEST size)
+ : m_fd (fd),
+ m_offset (offset),
+ m_size (size)
{
}
file_ptr
-rocm_code_object_stream_file::read (void *buf, file_ptr size,
- file_ptr offset)
+rocm_code_object_stream_file::read (void *buf, file_ptr size, file_ptr offset)
{
fileio_error target_errno;
file_ptr nbytes = 0;
@@ -326,14 +329,11 @@ protected:
releases or re-uses this memory before GDB is done using it. */
gdb::byte_vector m_objfile_image;
- LONGEST size () override
- {
- return m_objfile_image.size ();
- }
+ LONGEST size () override { return m_objfile_image.size (); }
};
-rocm_code_object_stream_memory::rocm_code_object_stream_memory
- (gdb::byte_vector buffer)
+rocm_code_object_stream_memory::rocm_code_object_stream_memory (
+ gdb::byte_vector buffer)
: m_objfile_image (std::move (buffer))
{
}
@@ -374,9 +374,7 @@ rocm_bfd_iovec_open (bfd *abfd, void *inferior_void)
std::string decoded_path;
decoded_path.reserve (path.length ());
for (size_t i = 0; i < path.length (); ++i)
- if (path[i] == '%'
- && i < path.length () - 2
- && std::isxdigit (path[i + 1])
+ if (path[i] == '%' && i < path.length () - 2 && std::isxdigit (path[i + 1])
&& std::isxdigit (path[i + 2]))
{
gdb::string_view hex_digits = path.substr (i + 1, 2);
@@ -399,8 +397,8 @@ rocm_bfd_iovec_open (bfd *abfd, void *inferior_void)
tokens.emplace_back (uri.substr (last));
/* Create a tag-value map from the tokenized query/fragment. */
- std::unordered_map<gdb::string_view, gdb::string_view,
- gdb::string_view_hash> params;
+ std::unordered_map<gdb::string_view, gdb::string_view, gdb::string_view_hash>
+ params;
for (gdb::string_view token : tokens)
{
size_t delim = token.find ('=');
@@ -418,19 +416,18 @@ rocm_bfd_iovec_open (bfd *abfd, void *inferior_void)
ULONGEST size = 0;
inferior *inferior = static_cast<struct inferior *> (inferior_void);
- auto try_strtoulst = [] (gdb::string_view v)
- {
- errno = 0;
- ULONGEST value = strtoulst (v.data (), nullptr, 0);
- if (errno != 0)
- {
- /* The actual message doesn't matter, the exception is caught
+ auto try_strtoulst = [] (gdb::string_view v) {
+ errno = 0;
+ ULONGEST value = strtoulst (v.data (), nullptr, 0);
+ if (errno != 0)
+ {
+ /* The actual message doesn't matter, the exception is caught
below, transformed in a BFD error, and the message is lost. */
- error (_("Failed to parse integer."));
- }
+ error (_ ("Failed to parse integer."));
+ }
- return value;
- };
+ return value;
+ };
auto offset_it = params.find ("offset");
if (offset_it != params.end ())
@@ -441,7 +438,7 @@ rocm_bfd_iovec_open (bfd *abfd, void *inferior_void)
{
size = try_strtoulst (size_it->second);
if (size == 0)
- error (_("Invalid size value"));
+ error (_ ("Invalid size value"));
}
if (protocol == "file")
@@ -467,7 +464,7 @@ rocm_bfd_iovec_open (bfd *abfd, void *inferior_void)
ULONGEST pid = try_strtoulst (path);
if (pid != inferior->pid)
{
- warning (_("`%s': code object is from another inferior"),
+ warning (_ ("`%s': code object is from another inferior"),
gdb::to_string (uri).c_str ());
bfd_set_error (bfd_error_bad_value);
return nullptr;
@@ -476,7 +473,7 @@ rocm_bfd_iovec_open (bfd *abfd, void *inferior_void)
gdb::byte_vector buffer (size);
if (target_read_memory (offset, buffer.data (), size) != 0)
{
- warning (_("Failed to copy the code object from the inferior"));
+ warning (_ ("Failed to copy the code object from the inferior"));
bfd_set_error (bfd_error_bad_value);
return nullptr;
}
@@ -484,7 +481,7 @@ rocm_bfd_iovec_open (bfd *abfd, void *inferior_void)
return new rocm_code_object_stream_memory (std::move (buffer));
}
- warning (_("`%s': protocol not supported: %s"),
+ warning (_ ("`%s': protocol not supported: %s"),
gdb::to_string (uri).c_str (), protocol.c_str ());
bfd_set_error (bfd_error_bad_value);
return nullptr;
@@ -537,12 +534,12 @@ rocm_solib_bfd_open (const char *pathname)
rocm_bfd_iovec_close, rocm_bfd_iovec_stat);
if (abfd == nullptr)
- error (_("Could not open `%s' as an executable file: %s"), pathname,
+ error (_ ("Could not open `%s' as an executable file: %s"), pathname,
bfd_errmsg (bfd_get_error ()));
/* Check bfd format. */
if (!bfd_check_format (abfd.get (), bfd_object))
- error (_("`%s': not in executable format: %s"),
+ error (_ ("`%s': not in executable format: %s"),
bfd_get_filename (abfd.get ()), bfd_errmsg (bfd_get_error ()));
unsigned char osabi = elf_elfheader (abfd)->e_ident[EI_OSABI];
@@ -550,12 +547,12 @@ rocm_solib_bfd_open (const char *pathname)
/* Check that the code object is using the HSA OS ABI. */
if (osabi != ELFOSABI_AMDGPU_HSA)
- error (_("`%s': ELF file OS ABI is not supported (%d)."),
+ error (_ ("`%s': ELF file OS ABI is not supported (%d)."),
bfd_get_filename (abfd.get ()), osabi);
/* We support HSA code objects V3 and greater. */
if (osabiversion < ELFABIVERSION_AMDGPU_HSA_V3)
- error (_("`%s': ELF file HSA OS ABI version is not supported (%d)."),
+ error (_ ("`%s': ELF file HSA OS ABI version is not supported (%d)."),
bfd_get_filename (abfd.get ()), osabiversion);
return abfd;
@@ -591,7 +588,7 @@ rocm_update_solib_list ()
&code_object_list, nullptr);
if (status != AMD_DBGAPI_STATUS_SUCCESS)
{
- warning (_("amd_dbgapi_process_code_object_list failed (%s)"),
+ warning (_ ("amd_dbgapi_process_code_object_list failed (%s)"),
get_status_string (status));
return;
}
@@ -601,15 +598,15 @@ rocm_update_solib_list ()
CORE_ADDR l_addr;
char *uri_bytes;
- status = amd_dbgapi_code_object_get_info
- (code_object_list[i], AMD_DBGAPI_CODE_OBJECT_INFO_LOAD_ADDRESS,
- sizeof (l_addr), &l_addr);
+ status = amd_dbgapi_code_object_get_info (
+ code_object_list[i], AMD_DBGAPI_CODE_OBJECT_INFO_LOAD_ADDRESS,
+ sizeof (l_addr), &l_addr);
if (status != AMD_DBGAPI_STATUS_SUCCESS)
continue;
- status = amd_dbgapi_code_object_get_info
- (code_object_list[i], AMD_DBGAPI_CODE_OBJECT_INFO_URI_NAME,
- sizeof (uri_bytes), &uri_bytes);
+ status = amd_dbgapi_code_object_get_info (
+ code_object_list[i], AMD_DBGAPI_CODE_OBJECT_INFO_URI_NAME,
+ sizeof (uri_bytes), &uri_bytes);
if (status != AMD_DBGAPI_STATUS_SUCCESS)
continue;
@@ -672,8 +669,7 @@ _initialize_rocm_solib ()
/* The dependency on the amd-dbgapi exists because solib-rocm's
inferior_created observer needs amd-dbgapi to have attached the process,
which happens in amd_dbgapi_target's inferior_created observer. */
- gdb::observers::inferior_created.attach
- (rocm_solib_target_inferior_created,
- "solib-rocm",
- { &get_amd_dbgapi_target_inferior_created_observer_token () });
+ gdb::observers::inferior_created.attach (
+ rocm_solib_target_inferior_created, "solib-rocm",
+ { &get_amd_dbgapi_target_inferior_created_observer_token () });
}
diff --git a/gdb/solib-svr4.c b/gdb/solib-svr4.c
index 33577b7ddd2..3ff61658e67 100644
--- a/gdb/solib-svr4.c
+++ b/gdb/solib-svr4.c
@@ -53,10 +53,9 @@ static int svr4_have_link_map_offsets (void);
static void svr4_relocate_main_executable (void);
static void svr4_free_library_list (so_list *solist);
static void probes_table_remove_objfile_probes (struct objfile *objfile);
-static void svr4_iterate_over_objfiles_in_search_order
- (gdbarch *gdbarch, iterate_over_objfiles_in_search_order_cb_ftype cb,
- objfile *current_objfile);
-
+static void svr4_iterate_over_objfiles_in_search_order (
+ gdbarch *gdbarch, iterate_over_objfiles_in_search_order_cb_ftype cb,
+ objfile *current_objfile);
/* On SVR4 systems, a list of symbols in the dynamic linker where
GDB can try to place a breakpoint to monitor shared library
@@ -66,31 +65,18 @@ static void svr4_iterate_over_objfiles_in_search_order
SVR4 systems will fall back to using a symbol as the "startup
mapping complete" breakpoint address. */
-static const char * const solib_break_names[] =
-{
- "r_debug_state",
- "_r_debug_state",
- "_dl_debug_state",
- "rtld_db_dlactivity",
- "__dl_rtld_db_dlactivity",
- "_rtld_debug_state",
+static const char *const solib_break_names[] = { "r_debug_state",
+ "_r_debug_state",
+ "_dl_debug_state",
+ "rtld_db_dlactivity",
+ "__dl_rtld_db_dlactivity",
+ "_rtld_debug_state",
- NULL
-};
+ NULL };
-static const char * const bkpt_names[] =
-{
- "_start",
- "__start",
- "main",
- NULL
-};
+static const char *const bkpt_names[] = { "_start", "__start", "main", NULL };
-static const char * const main_name_list[] =
-{
- "main_$main",
- NULL
-};
+static const char *const main_name_list[] = { "main_$main", NULL };
/* What to do when a probe stop occurs. */
@@ -128,8 +114,7 @@ struct probe_info
probes are present in the dynamic linker then the probes-based
interface will be used. */
-static const struct probe_info probe_info[] =
-{
+static const struct probe_info probe_info[] = {
{ "init_start", DO_NOTHING },
{ "init_complete", FULL_RELOAD },
{ "map_start", DO_NOTHING },
@@ -197,24 +182,25 @@ lm_info_read (CORE_ADDR lm_addr)
gdb::byte_vector lm (lmo->link_map_size);
if (target_read_memory (lm_addr, lm.data (), lmo->link_map_size) != 0)
- warning (_("Error reading shared library list entry at %s"),
+ warning (_ ("Error reading shared library list entry at %s"),
paddress (target_gdbarch (), lm_addr));
else
{
- struct type *ptr_type = builtin_type (target_gdbarch ())->builtin_data_ptr;
+ struct type *ptr_type
+ = builtin_type (target_gdbarch ())->builtin_data_ptr;
lm_info.reset (new lm_info_svr4);
lm_info->lm_addr = lm_addr;
- lm_info->l_addr_inferior = extract_typed_address (&lm[lmo->l_addr_offset],
- ptr_type);
+ lm_info->l_addr_inferior
+ = extract_typed_address (&lm[lmo->l_addr_offset], ptr_type);
lm_info->l_ld = extract_typed_address (&lm[lmo->l_ld_offset], ptr_type);
- lm_info->l_next = extract_typed_address (&lm[lmo->l_next_offset],
- ptr_type);
- lm_info->l_prev = extract_typed_address (&lm[lmo->l_prev_offset],
- ptr_type);
- lm_info->l_name = extract_typed_address (&lm[lmo->l_name_offset],
- ptr_type);
+ lm_info->l_next
+ = extract_typed_address (&lm[lmo->l_next_offset], ptr_type);
+ lm_info->l_prev
+ = extract_typed_address (&lm[lmo->l_prev_offset], ptr_type);
+ lm_info->l_name
+ = extract_typed_address (&lm[lmo->l_name_offset], ptr_type);
}
return lm_info;
@@ -240,7 +226,7 @@ lm_addr_check (const struct so_list *so, bfd *abfd)
l_addr = li->l_addr_inferior;
- if (! abfd || ! has_lm_dynamic_from_link_map ())
+ if (!abfd || !has_lm_dynamic_from_link_map ())
goto set_addr;
l_dynaddr = li->l_ld;
@@ -303,10 +289,9 @@ lm_addr_check (const struct so_list *so, bfd *abfd)
&& (l_addr & align) == ((l_dynaddr - dynaddr) & align))
{
if (info_verbose)
- gdb_printf (_("Using PIC (Position Independent Code) "
- "prelink displacement %s for \"%s\".\n"),
- paddress (target_gdbarch (), l_addr),
- so->so_name);
+ gdb_printf (_ ("Using PIC (Position Independent Code) "
+ "prelink displacement %s for \"%s\".\n"),
+ paddress (target_gdbarch (), l_addr), so->so_name);
}
else
{
@@ -319,9 +304,10 @@ lm_addr_check (const struct so_list *so, bfd *abfd)
of the DYNAMIC segment. Still the found address is the best
one GDB could find. */
- warning (_(".dynamic section for \"%s\" "
- "is not at the expected address "
- "(wrong library or version mismatch?)"), so->so_name);
+ warning (_ (".dynamic section for \"%s\" "
+ "is not at the expected address "
+ "(wrong library or version mismatch?)"),
+ so->so_name);
}
}
@@ -412,8 +398,7 @@ free_probes_table (struct svr4_info *info)
static void
free_solib_lists (svr4_info *info)
{
- for (const std::pair<CORE_ADDR, so_list *> tuple
- : info->solib_lists)
+ for (const std::pair<CORE_ADDR, so_list *> tuple : info->solib_lists)
svr4_free_library_list (tuple.second);
info->solib_lists.clear ();
@@ -497,17 +482,17 @@ read_program_header (int type, int *p_arch_size, CORE_ADDR *base_addr)
int p_type;
if (target_read_memory (at_phdr + i * sizeof (phdr),
- (gdb_byte *)&phdr, sizeof (phdr)))
+ (gdb_byte *) &phdr, sizeof (phdr)))
return {};
- p_type = extract_unsigned_integer ((gdb_byte *) phdr.p_type,
- 4, byte_order);
+ p_type = extract_unsigned_integer ((gdb_byte *) phdr.p_type, 4,
+ byte_order);
if (p_type == PT_PHDR)
{
pt_phdr_p = 1;
- pt_phdr = extract_unsigned_integer ((gdb_byte *) phdr.p_vaddr,
- 4, byte_order);
+ pt_phdr = extract_unsigned_integer ((gdb_byte *) phdr.p_vaddr, 4,
+ byte_order);
}
if (p_type == type)
@@ -518,10 +503,10 @@ read_program_header (int type, int *p_arch_size, CORE_ADDR *base_addr)
return {};
/* Retrieve address and size. */
- sect_addr = extract_unsigned_integer ((gdb_byte *)phdr.p_vaddr,
- 4, byte_order);
- sect_size = extract_unsigned_integer ((gdb_byte *)phdr.p_memsz,
- 4, byte_order);
+ sect_addr
+ = extract_unsigned_integer ((gdb_byte *) phdr.p_vaddr, 4, byte_order);
+ sect_size
+ = extract_unsigned_integer ((gdb_byte *) phdr.p_memsz, 4, byte_order);
}
else
{
@@ -534,17 +519,17 @@ read_program_header (int type, int *p_arch_size, CORE_ADDR *base_addr)
int p_type;
if (target_read_memory (at_phdr + i * sizeof (phdr),
- (gdb_byte *)&phdr, sizeof (phdr)))
+ (gdb_byte *) &phdr, sizeof (phdr)))
return {};
- p_type = extract_unsigned_integer ((gdb_byte *) phdr.p_type,
- 4, byte_order);
+ p_type = extract_unsigned_integer ((gdb_byte *) phdr.p_type, 4,
+ byte_order);
if (p_type == PT_PHDR)
{
pt_phdr_p = 1;
- pt_phdr = extract_unsigned_integer ((gdb_byte *) phdr.p_vaddr,
- 8, byte_order);
+ pt_phdr = extract_unsigned_integer ((gdb_byte *) phdr.p_vaddr, 8,
+ byte_order);
}
if (p_type == type)
@@ -555,10 +540,10 @@ read_program_header (int type, int *p_arch_size, CORE_ADDR *base_addr)
return {};
/* Retrieve address and size. */
- sect_addr = extract_unsigned_integer ((gdb_byte *)phdr.p_vaddr,
- 8, byte_order);
- sect_size = extract_unsigned_integer ((gdb_byte *)phdr.p_memsz,
- 8, byte_order);
+ sect_addr
+ = extract_unsigned_integer ((gdb_byte *) phdr.p_vaddr, 8, byte_order);
+ sect_size
+ = extract_unsigned_integer ((gdb_byte *) phdr.p_memsz, 8, byte_order);
}
/* PT_PHDR is optional, but we really need it
@@ -584,7 +569,6 @@ read_program_header (int type, int *p_arch_size, CORE_ADDR *base_addr)
return buf;
}
-
/* Return program interpreter string. */
static gdb::optional<gdb::byte_vector>
find_program_interpreter (void)
@@ -593,29 +577,30 @@ find_program_interpreter (void)
if (current_program_space->exec_bfd ()
&& (bfd_get_flavour (current_program_space->exec_bfd ())
== bfd_target_elf_flavour))
- {
- struct bfd_section *interp_sect;
+ {
+ struct bfd_section *interp_sect;
- interp_sect = bfd_get_section_by_name (current_program_space->exec_bfd (),
- ".interp");
- if (interp_sect != NULL)
- {
- int sect_size = bfd_section_size (interp_sect);
-
- gdb::byte_vector buf (sect_size);
- bool res
- = bfd_get_section_contents (current_program_space->exec_bfd (),
- interp_sect, buf.data (), 0, sect_size);
- if (res)
- return buf;
- }
- }
+ interp_sect
+ = bfd_get_section_by_name (current_program_space->exec_bfd (),
+ ".interp");
+ if (interp_sect != NULL)
+ {
+ int sect_size = bfd_section_size (interp_sect);
+
+ gdb::byte_vector buf (sect_size);
+ bool res
+ = bfd_get_section_contents (current_program_space->exec_bfd (),
+ interp_sect, buf.data (), 0,
+ sect_size);
+ if (res)
+ return buf;
+ }
+ }
/* If we didn't find it, use the target auxiliary vector. */
return read_program_header (PT_INTERP, NULL, NULL);
}
-
/* Scan for DESIRED_DYNTAG in .dynamic section of the target's main executable,
found by consulting the OS auxillary vector. If DESIRED_DYNTAG is found, 1
is returned and the corresponding PTR is set. */
@@ -641,39 +626,39 @@ scan_dyntag_auxv (const int desired_dyntag, CORE_ADDR *ptr,
: sizeof (Elf64_External_Dyn);
for (gdb_byte *buf = ph_data->data (), *bufend = buf + ph_data->size ();
buf < bufend; buf += step)
- {
- if (arch_size == 32)
- {
- Elf32_External_Dyn *dynp = (Elf32_External_Dyn *) buf;
+ {
+ if (arch_size == 32)
+ {
+ Elf32_External_Dyn *dynp = (Elf32_External_Dyn *) buf;
- current_dyntag = extract_unsigned_integer ((gdb_byte *) dynp->d_tag,
- 4, byte_order);
- dyn_ptr = extract_unsigned_integer ((gdb_byte *) dynp->d_un.d_ptr,
- 4, byte_order);
- }
- else
- {
- Elf64_External_Dyn *dynp = (Elf64_External_Dyn *) buf;
+ current_dyntag = extract_unsigned_integer ((gdb_byte *) dynp->d_tag,
+ 4, byte_order);
+ dyn_ptr = extract_unsigned_integer ((gdb_byte *) dynp->d_un.d_ptr, 4,
+ byte_order);
+ }
+ else
+ {
+ Elf64_External_Dyn *dynp = (Elf64_External_Dyn *) buf;
- current_dyntag = extract_unsigned_integer ((gdb_byte *) dynp->d_tag,
- 8, byte_order);
- dyn_ptr = extract_unsigned_integer ((gdb_byte *) dynp->d_un.d_ptr,
- 8, byte_order);
- }
- if (current_dyntag == DT_NULL)
- break;
+ current_dyntag = extract_unsigned_integer ((gdb_byte *) dynp->d_tag,
+ 8, byte_order);
+ dyn_ptr = extract_unsigned_integer ((gdb_byte *) dynp->d_un.d_ptr, 8,
+ byte_order);
+ }
+ if (current_dyntag == DT_NULL)
+ break;
- if (current_dyntag == desired_dyntag)
- {
- if (ptr)
- *ptr = dyn_ptr;
+ if (current_dyntag == desired_dyntag)
+ {
+ if (ptr)
+ *ptr = dyn_ptr;
- if (ptr_addr)
- *ptr_addr = base_addr + buf - ph_data->data ();
+ if (ptr_addr)
+ *ptr_addr = base_addr + buf - ph_data->data ();
- return 1;
- }
- }
+ return 1;
+ }
+ }
return 0;
}
@@ -703,11 +688,12 @@ elf_locate_base (void)
instead of DT_DEBUG, although they sometimes contain an unused
DT_DEBUG. */
if (gdb_bfd_scan_elf_dyntag (DT_MIPS_RLD_MAP,
- current_program_space->exec_bfd (),
- &dyn_ptr, NULL)
+ current_program_space->exec_bfd (), &dyn_ptr,
+ NULL)
|| scan_dyntag_auxv (DT_MIPS_RLD_MAP, &dyn_ptr, NULL))
{
- struct type *ptr_type = builtin_type (target_gdbarch ())->builtin_data_ptr;
+ struct type *ptr_type
+ = builtin_type (target_gdbarch ())->builtin_data_ptr;
gdb_byte *pbuf;
int pbuf_size = ptr_type->length ();
@@ -723,11 +709,12 @@ elf_locate_base (void)
because of needing to support PIE. DT_MIPS_RLD_MAP will also exist
in non-PIE. */
if (gdb_bfd_scan_elf_dyntag (DT_MIPS_RLD_MAP_REL,
- current_program_space->exec_bfd (),
- &dyn_ptr, &dyn_ptr_addr)
+ current_program_space->exec_bfd (), &dyn_ptr,
+ &dyn_ptr_addr)
|| scan_dyntag_auxv (DT_MIPS_RLD_MAP_REL, &dyn_ptr, &dyn_ptr_addr))
{
- struct type *ptr_type = builtin_type (target_gdbarch ())->builtin_data_ptr;
+ struct type *ptr_type
+ = builtin_type (target_gdbarch ())->builtin_data_ptr;
gdb_byte *pbuf;
int pbuf_size = ptr_type->length ();
@@ -773,8 +760,8 @@ solib_svr4_r_map (CORE_ADDR debug_base)
try
{
- addr = read_memory_typed_address (debug_base + lmo->r_map_offset,
- ptr_type);
+ addr
+ = read_memory_typed_address (debug_base + lmo->r_map_offset, ptr_type);
}
catch (const gdb_exception_error &ex)
{
@@ -811,9 +798,9 @@ solib_svr4_r_ldsomap (struct svr4_info *info)
{
/* Check version, and return zero if `struct r_debug' doesn't have
the r_ldsomap member. */
- version
- = read_memory_unsigned_integer (info->debug_base + lmo->r_version_offset,
- lmo->r_version_size, byte_order);
+ version = read_memory_unsigned_integer (info->debug_base
+ + lmo->r_version_offset,
+ lmo->r_version_size, byte_order);
}
catch (const gdb_exception_error &ex)
{
@@ -852,8 +839,7 @@ solib_svr4_r_next (CORE_ADDR debug_base)
if (version < 2 || lmo->r_next_offset == -1)
return 0;
- return read_memory_typed_address (debug_base + lmo->r_next_offset,
- ptr_type);
+ return read_memory_typed_address (debug_base + lmo->r_next_offset, ptr_type);
}
/* On Solaris systems with some versions of the dynamic linker,
@@ -903,18 +889,18 @@ open_symbol_file_object (int from_tty)
add_flags |= SYMFILE_VERBOSE;
if (current_program_space->symfile_object_file)
- if (!query (_("Attempt to reload symbols from process? ")))
+ if (!query (_ ("Attempt to reload symbols from process? ")))
return 0;
/* Always locate the debug struct, in case it has moved. */
info->debug_base = elf_locate_base ();
if (info->debug_base == 0)
- return 0; /* failed somehow... */
+ return 0; /* failed somehow... */
/* First link map member should be the executable. */
lm = solib_svr4_r_map (info->debug_base);
if (lm == 0)
- return 0; /* failed somehow... */
+ return 0; /* failed somehow... */
/* Read address of name from target memory to GDB. */
read_memory (lm + lmo->l_name_offset, l_name_buf.data (), l_name_size);
@@ -923,7 +909,7 @@ open_symbol_file_object (int from_tty)
l_name = extract_typed_address (l_name_buf.data (), ptr_type);
if (l_name == 0)
- return 0; /* No filename. */
+ return 0; /* No filename. */
/* Now fetch the filename from target memory. */
gdb::unique_xmalloc_ptr<char> filename
@@ -931,7 +917,7 @@ open_symbol_file_object (int from_tty)
if (filename == nullptr)
{
- warning (_("failed to read exec filename from attached file"));
+ warning (_ ("failed to read exec filename from attached file"));
return 0;
}
@@ -1115,7 +1101,7 @@ svr4_library_list_start_list (struct gdb_xml_parser *parser,
if (strcmp (version, "1.0") != 0)
gdb_xml_error (parser,
- _("SVR4 Library list has unsupported version \"%s\""),
+ _ ("SVR4 Library list has unsupported version \"%s\""),
version);
if (main_lm)
@@ -1131,39 +1117,30 @@ svr4_library_list_start_list (struct gdb_xml_parser *parser,
/* The allowed elements and attributes for an XML library list.
The root element is a <library-list>. */
-static const struct gdb_xml_attribute svr4_library_attributes[] =
-{
- { "name", GDB_XML_AF_NONE, NULL, NULL },
- { "lm", GDB_XML_AF_NONE, gdb_xml_parse_attr_ulongest, NULL },
- { "l_addr", GDB_XML_AF_NONE, gdb_xml_parse_attr_ulongest, NULL },
- { "l_ld", GDB_XML_AF_NONE, gdb_xml_parse_attr_ulongest, NULL },
- { "lmid", GDB_XML_AF_NONE, gdb_xml_parse_attr_ulongest, NULL },
- { NULL, GDB_XML_AF_NONE, NULL, NULL }
-};
-
-static const struct gdb_xml_element svr4_library_list_children[] =
-{
- {
- "library", svr4_library_attributes, NULL,
- GDB_XML_EF_REPEATABLE | GDB_XML_EF_OPTIONAL,
- library_list_start_library, NULL
- },
- { NULL, NULL, NULL, GDB_XML_EF_NONE, NULL, NULL }
-};
-
-static const struct gdb_xml_attribute svr4_library_list_attributes[] =
-{
- { "version", GDB_XML_AF_NONE, NULL, NULL },
- { "main-lm", GDB_XML_AF_OPTIONAL, gdb_xml_parse_attr_ulongest, NULL },
- { NULL, GDB_XML_AF_NONE, NULL, NULL }
-};
-
-static const struct gdb_xml_element svr4_library_list_elements[] =
-{
- { "library-list-svr4", svr4_library_list_attributes, svr4_library_list_children,
- GDB_XML_EF_NONE, svr4_library_list_start_list, NULL },
- { NULL, NULL, NULL, GDB_XML_EF_NONE, NULL, NULL }
-};
+static const struct gdb_xml_attribute svr4_library_attributes[]
+ = { { "name", GDB_XML_AF_NONE, NULL, NULL },
+ { "lm", GDB_XML_AF_NONE, gdb_xml_parse_attr_ulongest, NULL },
+ { "l_addr", GDB_XML_AF_NONE, gdb_xml_parse_attr_ulongest, NULL },
+ { "l_ld", GDB_XML_AF_NONE, gdb_xml_parse_attr_ulongest, NULL },
+ { "lmid", GDB_XML_AF_NONE, gdb_xml_parse_attr_ulongest, NULL },
+ { NULL, GDB_XML_AF_NONE, NULL, NULL } };
+
+static const struct gdb_xml_element svr4_library_list_children[]
+ = { { "library", svr4_library_attributes, NULL,
+ GDB_XML_EF_REPEATABLE | GDB_XML_EF_OPTIONAL,
+ library_list_start_library, NULL },
+ { NULL, NULL, NULL, GDB_XML_EF_NONE, NULL, NULL } };
+
+static const struct gdb_xml_attribute svr4_library_list_attributes[]
+ = { { "version", GDB_XML_AF_NONE, NULL, NULL },
+ { "main-lm", GDB_XML_AF_OPTIONAL, gdb_xml_parse_attr_ulongest, NULL },
+ { NULL, GDB_XML_AF_NONE, NULL, NULL } };
+
+static const struct gdb_xml_element svr4_library_list_elements[]
+ = { { "library-list-svr4", svr4_library_list_attributes,
+ svr4_library_list_children, GDB_XML_EF_NONE,
+ svr4_library_list_start_list, NULL },
+ { NULL, NULL, NULL, GDB_XML_EF_NONE, NULL, NULL } };
/* Parse qXfer:libraries:read packet into *SO_LIST_RETURN. Return 1 if
@@ -1174,18 +1151,17 @@ static const struct gdb_xml_element svr4_library_list_elements[] =
static int
svr4_parse_libraries (const char *document, struct svr4_library_list *list)
{
- auto cleanup = make_scope_exit ([list] ()
- {
- for (const std::pair<CORE_ADDR, so_list *> tuple
- : list->solib_lists)
- svr4_free_library_list (tuple.second);
- });
+ auto cleanup = make_scope_exit ([list] () {
+ for (const std::pair<CORE_ADDR, so_list *> tuple : list->solib_lists)
+ svr4_free_library_list (tuple.second);
+ });
list->tailp = nullptr;
list->main_lm = 0;
list->solib_lists.clear ();
- if (gdb_xml_parse_quick (_("target library list"), "library-list-svr4.dtd",
- svr4_library_list_elements, document, list) == 0)
+ if (gdb_xml_parse_quick (_ ("target library list"), "library-list-svr4.dtd",
+ svr4_library_list_elements, document, list)
+ == 0)
{
/* Parsed successfully, keep the result. */
cleanup.release ();
@@ -1214,8 +1190,7 @@ svr4_current_sos_via_xfer_libraries (struct svr4_library_list *list,
/* Fetch the list of shared libraries. */
gdb::optional<gdb::char_vector> svr4_library_document
= target_read_stralloc (current_inferior ()->top_target (),
- TARGET_OBJECT_LIBRARIES_SVR4,
- annex);
+ TARGET_OBJECT_LIBRARIES_SVR4, annex);
if (!svr4_library_document)
return 0;
@@ -1252,7 +1227,8 @@ svr4_default_sos (svr4_info *info)
li->l_addr = li->l_addr_inferior = info->debug_loader_offset;
li->l_addr_p = 1;
- strncpy (newobj->so_name, info->debug_loader_name, SO_NAME_MAX_PATH_SIZE - 1);
+ strncpy (newobj->so_name, info->debug_loader_name,
+ SO_NAME_MAX_PATH_SIZE - 1);
newobj->so_name[SO_NAME_MAX_PATH_SIZE - 1] = '\0';
strcpy (newobj->so_original_name, newobj->so_name);
@@ -1287,7 +1263,7 @@ svr4_read_so_list (svr4_info *info, CORE_ADDR lm, CORE_ADDR prev_lm,
if (li->l_prev != prev_lm)
{
- warning (_("Corrupted shared library list: %s != %s"),
+ warning (_ ("Corrupted shared library list: %s != %s"),
paddress (target_gdbarch (), prev_lm),
paddress (target_gdbarch (), li->l_prev));
return 0;
@@ -1315,7 +1291,7 @@ svr4_read_so_list (svr4_info *info, CORE_ADDR lm, CORE_ADDR prev_lm,
object, but (most likely) a vDSO. In this case, silently
skip it; otherwise emit a warning. */
if (first_l_name == 0 || li->l_name != first_l_name)
- warning (_("Can't read pathname for load map."));
+ warning (_ ("Can't read pathname for load map."));
continue;
}
@@ -1325,7 +1301,7 @@ svr4_read_so_list (svr4_info *info, CORE_ADDR lm, CORE_ADDR prev_lm,
/* If this entry has no name, or its name matches the name
for the main executable, don't include it in the list. */
- if (! newobj->so_name[0] || match_main (newobj->so_name))
+ if (!newobj->so_name[0] || match_main (newobj->so_name))
continue;
newobj->next = 0;
@@ -1360,8 +1336,7 @@ svr4_current_sos_direct (struct svr4_info *info)
Unfortunately statically linked inferiors will also fall back through this
suboptimal code path. */
- info->using_xfer = svr4_current_sos_via_xfer_libraries (&library_list,
- NULL);
+ info->using_xfer = svr4_current_sos_via_xfer_libraries (&library_list, NULL);
if (info->using_xfer)
{
if (library_list.main_lm)
@@ -1393,15 +1368,13 @@ svr4_current_sos_direct (struct svr4_info *info)
late by a static executable. */
if (current_program_space->exec_bfd ()
&& bfd_get_section_by_name (current_program_space->exec_bfd (),
- ".dynamic") == NULL)
+ ".dynamic")
+ == NULL)
ignore_first = false;
else
ignore_first = true;
- auto cleanup = make_scope_exit ([info] ()
- {
- free_solib_lists (info);
- });
+ auto cleanup = make_scope_exit ([info] () { free_solib_lists (info); });
/* Collect the sos in each namespace. */
CORE_ADDR debug_base = info->debug_base;
@@ -1451,8 +1424,7 @@ svr4_collect_probes_sos (svr4_info *info)
so_list *sos = nullptr;
so_list **pnext = &sos;
- for (const std::pair<CORE_ADDR, so_list *> tuple
- : info->solib_lists)
+ for (const std::pair<CORE_ADDR, so_list *> tuple : info->solib_lists)
{
so_list *solist = tuple.second;
@@ -1621,7 +1593,7 @@ svr4_fetch_objfile_link_map (struct objfile *objfile)
static int
match_main (const char *soname)
{
- const char * const *mainp;
+ const char *const *mainp;
for (mainp = main_name_list; *mainp != NULL; mainp++)
{
@@ -1640,12 +1612,10 @@ svr4_in_dynsym_resolve_code (CORE_ADDR pc)
{
struct svr4_info *info = get_svr4_info (current_program_space);
- return ((pc >= info->interp_text_sect_low
- && pc < info->interp_text_sect_high)
- || (pc >= info->interp_plt_sect_low
- && pc < info->interp_plt_sect_high)
- || in_plt_section (pc)
- || in_gnu_ifunc_stub (pc));
+ return (
+ (pc >= info->interp_text_sect_low && pc < info->interp_text_sect_high)
+ || (pc >= info->interp_plt_sect_low && pc < info->interp_plt_sect_high)
+ || in_plt_section (pc) || in_gnu_ifunc_stub (pc));
}
/* Given an executable's ABFD and target, compute the entry-point
@@ -1664,9 +1634,9 @@ exec_entry_point (struct bfd *abfd, struct target_ops *targ)
gdbarch_convert_from_func_ptr_addr(). The method
gdbarch_convert_from_func_ptr_addr() is the merely the identify
function for targets which don't use function descriptors. */
- addr = gdbarch_convert_from_func_ptr_addr (target_gdbarch (),
- bfd_get_start_address (abfd),
- targ);
+ addr
+ = gdbarch_convert_from_func_ptr_addr (target_gdbarch (),
+ bfd_get_start_address (abfd), targ);
return gdbarch_addr_bits_remove (target_gdbarch (), addr);
}
@@ -1749,8 +1719,8 @@ register_solib_event_probe (svr4_info *info, struct objfile *objfile,
/* Create the probes table, if necessary. */
if (info->probes_table == NULL)
info->probes_table.reset (htab_create_alloc (1, hash_probe_and_action,
- equal_probe_and_action,
- xfree, xcalloc, xfree));
+ equal_probe_and_action, xfree,
+ xcalloc, xfree));
lookup.address = address;
slot = htab_find_slot (info->probes_table.get (), &lookup, INSERT);
@@ -1847,8 +1817,7 @@ solist_update_full (struct svr4_info *info)
failure. */
static int
-solist_update_incremental (svr4_info *info, CORE_ADDR debug_base,
- CORE_ADDR lm)
+solist_update_incremental (svr4_info *info, CORE_ADDR debug_base, CORE_ADDR lm)
{
/* Fall back to a full update if we are using a remote target
that does not support incremental transfers. */
@@ -1926,8 +1895,8 @@ solist_update_incremental (svr4_info *info, CORE_ADDR debug_base,
}
/* ...but nothing else. */
- for (const std::pair<CORE_ADDR, so_list *> tuple
- : library_list.solib_lists)
+ for (const std::pair<CORE_ADDR, so_list *> tuple :
+ library_list.solib_lists)
gdb_assert (tuple.second == nullptr);
*pnext = sos;
@@ -1952,8 +1921,8 @@ solist_update_incremental (svr4_info *info, CORE_ADDR debug_base,
static void
disable_probes_interface (svr4_info *info)
{
- warning (_("Probes-based dynamic linker interface failed.\n"
- "Reverting to original interface."));
+ warning (_ ("Probes-based dynamic linker interface failed.\n"
+ "Reverting to original interface."));
free_probes_table (info);
free_solib_lists (info);
@@ -1989,10 +1958,8 @@ svr4_handle_solib_event (void)
/* If anything goes wrong we revert to the original linker
interface. */
- auto cleanup = make_scope_exit ([info] ()
- {
- disable_probes_interface (info);
- });
+ auto cleanup
+ = make_scope_exit ([info] () { disable_probes_interface (info); });
action = solib_event_probe_action (pa);
if (action == PROBES_INTERFACE_FAILED)
@@ -2260,8 +2227,8 @@ svr4_find_and_create_probe_breakpoints (svr4_info *info,
catch (const gdb_exception_error &ex)
{
exception_print (gdb_stderr, ex);
- warning (_("Initializing probes-based dynamic linker interface "
- "failed.\nReverting to original interface."));
+ warning (_ ("Initializing probes-based dynamic linker interface "
+ "failed.\nReverting to original interface."));
return false;
}
}
@@ -2293,7 +2260,8 @@ svr4_create_solib_event_breakpoints (svr4_info *info, struct gdbarch *gdbarch,
if (os == nullptr
|| (!svr4_find_and_create_probe_breakpoints (info, gdbarch, os, false)
- && !svr4_find_and_create_probe_breakpoints (info, gdbarch, os, true)))
+ && !svr4_find_and_create_probe_breakpoints (info, gdbarch, os,
+ true)))
{
solib_debug_printf ("falling back to r_brk breakpoint: addr=%s",
paddress (gdbarch, address));
@@ -2309,6 +2277,7 @@ cmp_name_and_sec_flags (const asymbol *sym, const void *data)
return (strcmp (sym->name, (const char *) data) == 0
&& (sym->section->flags & (SEC_CODE | SEC_DATA)) != 0);
}
+
/* Arrange for dynamic linker to hit breakpoint.
Both the SunOS and the SVR4 dynamic linkers have, as part of their
@@ -2345,7 +2314,7 @@ static int
enable_break (struct svr4_info *info, int from_tty)
{
struct bound_minimal_symbol msymbol;
- const char * const *bkpt_namep;
+ const char *const *bkpt_namep;
asection *interp_sect;
CORE_ADDR sym_addr;
@@ -2366,10 +2335,11 @@ enable_break (struct svr4_info *info, int from_tty)
{
struct obj_section *os;
- sym_addr = gdbarch_addr_bits_remove
- (target_gdbarch (),
- gdbarch_convert_from_func_ptr_addr
- (target_gdbarch (), sym_addr, current_inferior ()->top_target ()));
+ sym_addr
+ = gdbarch_addr_bits_remove (target_gdbarch (),
+ gdbarch_convert_from_func_ptr_addr (
+ target_gdbarch (), sym_addr,
+ current_inferior ()->top_target ()));
/* On at least some versions of Solaris there's a dynamic relocation
on _r_debug.r_brk and SYM_ADDR may not be relocated yet, e.g., if
@@ -2418,7 +2388,8 @@ enable_break (struct svr4_info *info, int from_tty)
= info->interp_plt_sect_low + bfd_section_size (interp_sect);
}
- svr4_create_solib_event_breakpoints (info, target_gdbarch (), sym_addr);
+ svr4_create_solib_event_breakpoints (info, target_gdbarch (),
+ sym_addr);
return 1;
}
}
@@ -2490,8 +2461,8 @@ enable_break (struct svr4_info *info, int from_tty)
if (addr_bit < (sizeof (CORE_ADDR) * HOST_CHAR_BIT))
{
CORE_ADDR space_size = (CORE_ADDR) 1 << addr_bit;
- CORE_ADDR tmp_entry_point = exec_entry_point (tmp_bfd.get (),
- tmp_bfd_target);
+ CORE_ADDR tmp_entry_point
+ = exec_entry_point (tmp_bfd.get (), tmp_bfd_target);
gdb_assert (load_addr < space_size);
@@ -2553,9 +2524,9 @@ enable_break (struct svr4_info *info, int from_tty)
/* Now try to set a breakpoint in the dynamic linker. */
for (bkpt_namep = solib_break_names; *bkpt_namep != NULL; bkpt_namep++)
{
- sym_addr = gdb_bfd_lookup_symbol (tmp_bfd.get (),
- cmp_name_and_sec_flags,
- *bkpt_namep);
+ sym_addr
+ = gdb_bfd_lookup_symbol (tmp_bfd.get (), cmp_name_and_sec_flags,
+ *bkpt_namep);
if (sym_addr != 0)
break;
}
@@ -2564,9 +2535,9 @@ enable_break (struct svr4_info *info, int from_tty)
/* Convert 'sym_addr' from a function pointer to an address.
Because we pass tmp_bfd_target instead of the current
target, this will always produce an unrelocated value. */
- sym_addr = gdbarch_convert_from_func_ptr_addr (target_gdbarch (),
- sym_addr,
- tmp_bfd_target);
+ sym_addr
+ = gdbarch_convert_from_func_ptr_addr (target_gdbarch (), sym_addr,
+ tmp_bfd_target);
/* We're done with both the temporary bfd and target. Closing
the target closes the underlying bfd, because it holds the
@@ -2583,9 +2554,9 @@ enable_break (struct svr4_info *info, int from_tty)
/* For whatever reason we couldn't set a breakpoint in the dynamic
linker. Warn and drop into the old code. */
bkpt_at_symbol:
- warning (_("Unable to find dynamic linker breakpoint function.\n"
- "GDB will be unable to debug shared library initializers\n"
- "and track explicitly loaded dynamic code."));
+ warning (_ ("Unable to find dynamic linker breakpoint function.\n"
+ "GDB will be unable to debug shared library initializers\n"
+ "and track explicitly loaded dynamic code."));
}
/* Scan through the lists of symbols, trying to look up the symbol and
@@ -2595,12 +2566,11 @@ enable_break (struct svr4_info *info, int from_tty)
for (bkpt_namep = solib_break_names; *bkpt_namep != NULL; bkpt_namep++)
{
msymbol = lookup_minimal_symbol (*bkpt_namep, NULL, objf);
- if ((msymbol.minsym != NULL)
- && (msymbol.value_address () != 0))
+ if ((msymbol.minsym != NULL) && (msymbol.value_address () != 0))
{
sym_addr = msymbol.value_address ();
- sym_addr = gdbarch_convert_from_func_ptr_addr
- (target_gdbarch (), sym_addr, current_inferior ()->top_target ());
+ sym_addr = gdbarch_convert_from_func_ptr_addr (
+ target_gdbarch (), sym_addr, current_inferior ()->top_target ());
svr4_create_solib_event_breakpoints (info, target_gdbarch (),
sym_addr);
return 1;
@@ -2612,13 +2582,12 @@ enable_break (struct svr4_info *info, int from_tty)
for (bkpt_namep = bkpt_names; *bkpt_namep != NULL; bkpt_namep++)
{
msymbol = lookup_minimal_symbol (*bkpt_namep, NULL, objf);
- if ((msymbol.minsym != NULL)
- && (msymbol.value_address () != 0))
+ if ((msymbol.minsym != NULL) && (msymbol.value_address () != 0))
{
sym_addr = msymbol.value_address ();
- sym_addr = gdbarch_convert_from_func_ptr_addr
- (target_gdbarch (), sym_addr,
- current_inferior ()->top_target ());
+ sym_addr = gdbarch_convert_from_func_ptr_addr (
+ target_gdbarch (), sym_addr,
+ current_inferior ()->top_target ());
svr4_create_solib_event_breakpoints (info, target_gdbarch (),
sym_addr);
return 1;
@@ -2765,11 +2734,13 @@ svr4_exec_displacement (CORE_ADDR *displacementp)
content offset for the verification purpose. */
if (phdrs_target->size () != phdrs_binary->size ()
- || bfd_get_arch_size (current_program_space->exec_bfd ()) != arch_size)
+ || bfd_get_arch_size (current_program_space->exec_bfd ())
+ != arch_size)
return 0;
else if (arch_size == 32
&& phdrs_target->size () >= sizeof (Elf32_External_Phdr)
- && phdrs_target->size () % sizeof (Elf32_External_Phdr) == 0)
+ && phdrs_target->size () % sizeof (Elf32_External_Phdr)
+ == 0)
{
Elf_Internal_Ehdr *ehdr2
= elf_tdata (current_program_space->exec_bfd ())->elf_header;
@@ -2792,16 +2763,17 @@ svr4_exec_displacement (CORE_ADDR *displacementp)
CORE_ADDR displacement_vaddr = 0;
CORE_ADDR displacement_paddr = 0;
- phdrp = &((Elf32_External_Phdr *) phdrs_target->data ())[i];
+ phdrp
+ = &((Elf32_External_Phdr *) phdrs_target->data ())[i];
buf_vaddr_p = (gdb_byte *) &phdrp->p_vaddr;
buf_paddr_p = (gdb_byte *) &phdrp->p_paddr;
- vaddr = extract_unsigned_integer (buf_vaddr_p, 4,
- byte_order);
+ vaddr
+ = extract_unsigned_integer (buf_vaddr_p, 4, byte_order);
displacement_vaddr = vaddr - phdr2[i].p_vaddr;
- paddr = extract_unsigned_integer (buf_paddr_p, 4,
- byte_order);
+ paddr
+ = extract_unsigned_integer (buf_paddr_p, 4, byte_order);
displacement_paddr = paddr - phdr2[i].p_paddr;
if (displacement_vaddr == displacement_paddr)
@@ -2836,13 +2808,13 @@ svr4_exec_displacement (CORE_ADDR *displacementp)
/* Check also other adjustment combinations - PR 11786. */
- vaddr = extract_unsigned_integer (buf_vaddr_p, 4,
- byte_order);
+ vaddr
+ = extract_unsigned_integer (buf_vaddr_p, 4, byte_order);
vaddr -= displacement;
store_unsigned_integer (buf_vaddr_p, 4, byte_order, vaddr);
- paddr = extract_unsigned_integer (buf_paddr_p, 4,
- byte_order);
+ paddr
+ = extract_unsigned_integer (buf_paddr_p, 4, byte_order);
paddr -= displacement;
store_unsigned_integer (buf_paddr_p, 4, byte_order, paddr);
@@ -2882,8 +2854,9 @@ svr4_exec_displacement (CORE_ADDR *displacementp)
gdb_byte *buf_filesz_p = (gdb_byte *) &phdrp->p_filesz;
CORE_ADDR filesz;
- content2 = (bfd_section_flags (plt2_asect)
- & SEC_HAS_CONTENTS) != 0;
+ content2
+ = (bfd_section_flags (plt2_asect) & SEC_HAS_CONTENTS)
+ != 0;
filesz = extract_unsigned_integer (buf_filesz_p, 4,
byte_order);
@@ -2907,7 +2880,8 @@ svr4_exec_displacement (CORE_ADDR *displacementp)
}
else if (arch_size == 64
&& phdrs_target->size () >= sizeof (Elf64_External_Phdr)
- && phdrs_target->size () % sizeof (Elf64_External_Phdr) == 0)
+ && phdrs_target->size () % sizeof (Elf64_External_Phdr)
+ == 0)
{
Elf_Internal_Ehdr *ehdr2
= elf_tdata (current_program_space->exec_bfd ())->elf_header;
@@ -2930,16 +2904,17 @@ svr4_exec_displacement (CORE_ADDR *displacementp)
CORE_ADDR displacement_vaddr = 0;
CORE_ADDR displacement_paddr = 0;
- phdrp = &((Elf64_External_Phdr *) phdrs_target->data ())[i];
+ phdrp
+ = &((Elf64_External_Phdr *) phdrs_target->data ())[i];
buf_vaddr_p = (gdb_byte *) &phdrp->p_vaddr;
buf_paddr_p = (gdb_byte *) &phdrp->p_paddr;
- vaddr = extract_unsigned_integer (buf_vaddr_p, 8,
- byte_order);
+ vaddr
+ = extract_unsigned_integer (buf_vaddr_p, 8, byte_order);
displacement_vaddr = vaddr - phdr2[i].p_vaddr;
- paddr = extract_unsigned_integer (buf_paddr_p, 8,
- byte_order);
+ paddr
+ = extract_unsigned_integer (buf_paddr_p, 8, byte_order);
displacement_paddr = paddr - phdr2[i].p_paddr;
if (displacement_vaddr == displacement_paddr)
@@ -2973,13 +2948,13 @@ svr4_exec_displacement (CORE_ADDR *displacementp)
/* Check also other adjustment combinations - PR 11786. */
- vaddr = extract_unsigned_integer (buf_vaddr_p, 8,
- byte_order);
+ vaddr
+ = extract_unsigned_integer (buf_vaddr_p, 8, byte_order);
vaddr -= displacement;
store_unsigned_integer (buf_vaddr_p, 8, byte_order, vaddr);
- paddr = extract_unsigned_integer (buf_paddr_p, 8,
- byte_order);
+ paddr
+ = extract_unsigned_integer (buf_paddr_p, 8, byte_order);
paddr -= displacement;
store_unsigned_integer (buf_paddr_p, 8, byte_order, paddr);
@@ -3011,17 +2986,17 @@ svr4_exec_displacement (CORE_ADDR *displacementp)
}
/* prelink can convert .plt SHT_NOBITS to SHT_PROGBITS. */
- plt2_asect
- = bfd_get_section_by_name (current_program_space->exec_bfd (),
- ".plt");
+ plt2_asect = bfd_get_section_by_name (
+ current_program_space->exec_bfd (), ".plt");
if (plt2_asect)
{
int content2;
gdb_byte *buf_filesz_p = (gdb_byte *) &phdrp->p_filesz;
CORE_ADDR filesz;
- content2 = (bfd_section_flags (plt2_asect)
- & SEC_HAS_CONTENTS) != 0;
+ content2
+ = (bfd_section_flags (plt2_asect) & SEC_HAS_CONTENTS)
+ != 0;
filesz = extract_unsigned_integer (buf_filesz_p, 8,
byte_order);
@@ -3055,8 +3030,8 @@ svr4_exec_displacement (CORE_ADDR *displacementp)
the executable symbols/file has been already relocated to
displacement. */
- gdb_printf (_("Using PIE (Position Independent Executable) "
- "displacement %s for \"%s\".\n"),
+ gdb_printf (_ ("Using PIE (Position Independent Executable) "
+ "displacement %s for \"%s\".\n"),
paddress (target_gdbarch (), exec_displacement),
bfd_get_filename (current_program_space->exec_bfd ()));
}
@@ -3101,7 +3076,7 @@ svr4_relocate_main_executable (void)
- The section offsets were not reset earlier, and the best we can
hope is that the old offsets are still applicable to the new run. */
- if (! svr4_exec_displacement (&displacement))
+ if (!svr4_exec_displacement (&displacement))
return;
/* Even DISPLACEMENT 0 is a valid new difference of in-memory vs. in-file
@@ -3207,7 +3182,6 @@ svr4_truncate_ptr (CORE_ADDR addr)
return addr & (((CORE_ADDR) 1 << gdbarch_ptr_bit (target_gdbarch ())) - 1);
}
-
static void
svr4_relocate_section_addresses (struct so_list *so,
struct target_section *sec)
@@ -3217,14 +3191,13 @@ svr4_relocate_section_addresses (struct so_list *so,
sec->addr = svr4_truncate_ptr (sec->addr + lm_addr_check (so, abfd));
sec->endaddr = svr4_truncate_ptr (sec->endaddr + lm_addr_check (so, abfd));
}
-
/* Architecture-specific operations. */
struct solib_svr4_ops
{
/* Return a description of the layout of `struct link_map'. */
- struct link_map_offsets *(*fetch_link_map_offsets)(void) = nullptr;
+ struct link_map_offsets *(*fetch_link_map_offsets) (void) = nullptr;
};
/* Per-architecture data key. */
@@ -3245,16 +3218,16 @@ get_ops (struct gdbarch *gdbarch)
GDBARCH to FLMO. Also, install SVR4 solib_ops into GDBARCH. */
void
-set_solib_svr4_fetch_link_map_offsets (struct gdbarch *gdbarch,
- struct link_map_offsets *(*flmo) (void))
+set_solib_svr4_fetch_link_map_offsets (
+ struct gdbarch *gdbarch, struct link_map_offsets *(*flmo) (void) )
{
struct solib_svr4_ops *ops = get_ops (gdbarch);
ops->fetch_link_map_offsets = flmo;
set_gdbarch_so_ops (gdbarch, &svr4_so_ops);
- set_gdbarch_iterate_over_objfiles_in_search_order
- (gdbarch, svr4_iterate_over_objfiles_in_search_order);
+ set_gdbarch_iterate_over_objfiles_in_search_order (
+ gdbarch, svr4_iterate_over_objfiles_in_search_order);
}
/* Fetch a link_map_offsets structure using the architecture-specific
@@ -3278,7 +3251,6 @@ svr4_have_link_map_offsets (void)
return (ops->fetch_link_map_offsets != NULL);
}
-
/* Most OS'es that have SVR4-style ELF dynamic libraries define a
`struct r_debug' and a `struct link_map' that are binary compatible
@@ -3347,7 +3319,6 @@ svr4_lp64_fetch_link_map_offsets (void)
return lmp;
}
-
/* Return the DSO matching OBJFILE or nullptr if none can be found. */
@@ -3384,8 +3355,7 @@ find_debug_base_for_solib (so_list *solib)
svr4_info *info = get_svr4_info (current_program_space);
gdb_assert (info != nullptr);
- for (const std::pair<CORE_ADDR, so_list *> tuple
- : info->solib_lists)
+ for (const std::pair<CORE_ADDR, so_list *> tuple : info->solib_lists)
{
CORE_ADDR debug_base = tuple.first;
so_list *solist = tuple.second;
@@ -3405,9 +3375,9 @@ find_debug_base_for_solib (so_list *solib)
the initial namespace. */
static void
-svr4_iterate_over_objfiles_in_search_order
- (gdbarch *gdbarch, iterate_over_objfiles_in_search_order_cb_ftype cb,
- objfile *current_objfile)
+svr4_iterate_over_objfiles_in_search_order (
+ gdbarch *gdbarch, iterate_over_objfiles_in_search_order_cb_ftype cb,
+ objfile *current_objfile)
{
bool checked_current_objfile = false;
if (current_objfile != nullptr)
@@ -3423,7 +3393,8 @@ svr4_iterate_over_objfiles_in_search_order
abfd = current_objfile->obfd.get ();
if (abfd != nullptr
- && gdb_bfd_scan_elf_dyntag (DT_SYMBOLIC, abfd, nullptr, nullptr) == 1)
+ && gdb_bfd_scan_elf_dyntag (DT_SYMBOLIC, abfd, nullptr, nullptr)
+ == 1)
{
checked_current_objfile = true;
if (cb (current_objfile))
@@ -3463,8 +3434,7 @@ svr4_iterate_over_objfiles_in_search_order
}
}
-const struct target_so_ops svr4_so_ops =
-{
+const struct target_so_ops svr4_so_ops = {
svr4_relocate_section_addresses,
svr4_free_so,
svr4_clear_so,
@@ -3482,6 +3452,7 @@ const struct target_so_ops svr4_so_ops =
};
void _initialize_svr4_solib ();
+
void
_initialize_svr4_solib ()
{
diff --git a/gdb/solib-svr4.h b/gdb/solib-svr4.h
index ff15603476e..65b13a17734 100644
--- a/gdb/solib-svr4.h
+++ b/gdb/solib-svr4.h
@@ -53,49 +53,49 @@ struct lm_info_svr4 : public lm_info_base
in bytes unless otherwise specified. */
struct link_map_offsets
- {
- /* Offset and size of r_debug.r_version. */
- int r_version_offset, r_version_size;
+{
+ /* Offset and size of r_debug.r_version. */
+ int r_version_offset, r_version_size;
- /* Offset of r_debug.r_map. */
- int r_map_offset;
+ /* Offset of r_debug.r_map. */
+ int r_map_offset;
- /* Offset of r_debug.r_brk. */
- int r_brk_offset;
+ /* Offset of r_debug.r_brk. */
+ int r_brk_offset;
- /* Offset of r_debug.r_ldsomap. */
- int r_ldsomap_offset;
+ /* Offset of r_debug.r_ldsomap. */
+ int r_ldsomap_offset;
- /* Offset of r_debug_extended.r_next. */
- int r_next_offset;
+ /* Offset of r_debug_extended.r_next. */
+ int r_next_offset;
- /* Size of struct link_map (or equivalent), or at least enough of it
+ /* Size of struct link_map (or equivalent), or at least enough of it
to be able to obtain the fields below. */
- int link_map_size;
+ int link_map_size;
- /* Offset to l_addr field in struct link_map. */
- int l_addr_offset;
+ /* Offset to l_addr field in struct link_map. */
+ int l_addr_offset;
- /* Offset to l_ld field in struct link_map. */
- int l_ld_offset;
+ /* Offset to l_ld field in struct link_map. */
+ int l_ld_offset;
- /* Offset to l_next field in struct link_map. */
- int l_next_offset;
+ /* Offset to l_next field in struct link_map. */
+ int l_next_offset;
- /* Offset to l_prev field in struct link_map. */
- int l_prev_offset;
+ /* Offset to l_prev field in struct link_map. */
+ int l_prev_offset;
- /* Offset to l_name field in struct link_map. */
- int l_name_offset;
- };
+ /* Offset to l_name field in struct link_map. */
+ int l_name_offset;
+};
/* set_solib_svr4_fetch_link_map_offsets() is intended to be called by
a <arch>_gdbarch_init() function. It is used to establish an
architecture specific link_map_offsets fetcher for the architecture
being defined. */
-extern void set_solib_svr4_fetch_link_map_offsets
- (struct gdbarch *gdbarch, struct link_map_offsets *(*func) (void));
+extern void set_solib_svr4_fetch_link_map_offsets (
+ struct gdbarch *gdbarch, struct link_map_offsets *(*func) (void) );
/* This function is called by thread_db.c. Return the address of the
link map for the given objfile. */
diff --git a/gdb/solib-target.c b/gdb/solib-target.c
index ca9478f2ec3..4e7fd0ddd27 100644
--- a/gdb/solib-target.c
+++ b/gdb/solib-target.c
@@ -62,8 +62,8 @@ solib_target_parse_libraries (const char *library)
if (!have_warned)
{
have_warned = 1;
- warning (_("Can not parse XML library list; XML support was disabled "
- "at compile time"));
+ warning (_ ("Can not parse XML library list; XML support was disabled "
+ "at compile time"));
}
return lm_info_vector ();
@@ -88,8 +88,7 @@ library_list_start_segment (struct gdb_xml_parser *parser,
CORE_ADDR address = (CORE_ADDR) *address_p;
if (!last->section_bases.empty ())
- gdb_xml_error (parser,
- _("Library list with both segments and sections"));
+ gdb_xml_error (parser, _ ("Library list with both segments and sections"));
last->segment_bases.push_back (address);
}
@@ -107,8 +106,7 @@ library_list_start_section (struct gdb_xml_parser *parser,
CORE_ADDR address = (CORE_ADDR) *address_p;
if (!last->segment_bases.empty ())
- gdb_xml_error (parser,
- _("Library list with both segments and sections"));
+ gdb_xml_error (parser, _ ("Library list with both segments and sections"));
last->section_bases.push_back (address);
}
@@ -138,10 +136,9 @@ library_list_end_library (struct gdb_xml_parser *parser,
lm_info_target *lm_info = list->back ().get ();
if (lm_info->segment_bases.empty () && lm_info->section_bases.empty ())
- gdb_xml_error (parser, _("No segment or section bases defined"));
+ gdb_xml_error (parser, _ ("No segment or section bases defined"));
}
-
/* Handle the start of a <library-list> element. */
static void
@@ -159,7 +156,7 @@ library_list_start_list (struct gdb_xml_parser *parser,
if (strcmp (string, "1.0") != 0)
gdb_xml_error (parser,
- _("Library list has unsupported version \"%s\""),
+ _ ("Library list has unsupported version \"%s\""),
string);
}
}
@@ -167,56 +164,50 @@ library_list_start_list (struct gdb_xml_parser *parser,
/* The allowed elements and attributes for an XML library list.
The root element is a <library-list>. */
-static const struct gdb_xml_attribute segment_attributes[] = {
- { "address", GDB_XML_AF_NONE, gdb_xml_parse_attr_ulongest, NULL },
- { NULL, GDB_XML_AF_NONE, NULL, NULL }
-};
-
-static const struct gdb_xml_attribute section_attributes[] = {
- { "address", GDB_XML_AF_NONE, gdb_xml_parse_attr_ulongest, NULL },
- { NULL, GDB_XML_AF_NONE, NULL, NULL }
-};
-
-static const struct gdb_xml_element library_children[] = {
- { "segment", segment_attributes, NULL,
- GDB_XML_EF_REPEATABLE | GDB_XML_EF_OPTIONAL,
- library_list_start_segment, NULL },
- { "section", section_attributes, NULL,
- GDB_XML_EF_REPEATABLE | GDB_XML_EF_OPTIONAL,
- library_list_start_section, NULL },
- { NULL, NULL, NULL, GDB_XML_EF_NONE, NULL, NULL }
-};
-
-static const struct gdb_xml_attribute library_attributes[] = {
- { "name", GDB_XML_AF_NONE, NULL, NULL },
- { NULL, GDB_XML_AF_NONE, NULL, NULL }
-};
-
-static const struct gdb_xml_element library_list_children[] = {
- { "library", library_attributes, library_children,
- GDB_XML_EF_REPEATABLE | GDB_XML_EF_OPTIONAL,
- library_list_start_library, library_list_end_library },
- { NULL, NULL, NULL, GDB_XML_EF_NONE, NULL, NULL }
-};
-
-static const struct gdb_xml_attribute library_list_attributes[] = {
- { "version", GDB_XML_AF_OPTIONAL, NULL, NULL },
- { NULL, GDB_XML_AF_NONE, NULL, NULL }
-};
-
-static const struct gdb_xml_element library_list_elements[] = {
- { "library-list", library_list_attributes, library_list_children,
- GDB_XML_EF_NONE, library_list_start_list, NULL },
- { NULL, NULL, NULL, GDB_XML_EF_NONE, NULL, NULL }
-};
+static const struct gdb_xml_attribute segment_attributes[]
+ = { { "address", GDB_XML_AF_NONE, gdb_xml_parse_attr_ulongest, NULL },
+ { NULL, GDB_XML_AF_NONE, NULL, NULL } };
+
+static const struct gdb_xml_attribute section_attributes[]
+ = { { "address", GDB_XML_AF_NONE, gdb_xml_parse_attr_ulongest, NULL },
+ { NULL, GDB_XML_AF_NONE, NULL, NULL } };
+
+static const struct gdb_xml_element library_children[]
+ = { { "segment", segment_attributes, NULL,
+ GDB_XML_EF_REPEATABLE | GDB_XML_EF_OPTIONAL,
+ library_list_start_segment, NULL },
+ { "section", section_attributes, NULL,
+ GDB_XML_EF_REPEATABLE | GDB_XML_EF_OPTIONAL,
+ library_list_start_section, NULL },
+ { NULL, NULL, NULL, GDB_XML_EF_NONE, NULL, NULL } };
+
+static const struct gdb_xml_attribute library_attributes[]
+ = { { "name", GDB_XML_AF_NONE, NULL, NULL },
+ { NULL, GDB_XML_AF_NONE, NULL, NULL } };
+
+static const struct gdb_xml_element library_list_children[]
+ = { { "library", library_attributes, library_children,
+ GDB_XML_EF_REPEATABLE | GDB_XML_EF_OPTIONAL,
+ library_list_start_library, library_list_end_library },
+ { NULL, NULL, NULL, GDB_XML_EF_NONE, NULL, NULL } };
+
+static const struct gdb_xml_attribute library_list_attributes[]
+ = { { "version", GDB_XML_AF_OPTIONAL, NULL, NULL },
+ { NULL, GDB_XML_AF_NONE, NULL, NULL } };
+
+static const struct gdb_xml_element library_list_elements[]
+ = { { "library-list", library_list_attributes, library_list_children,
+ GDB_XML_EF_NONE, library_list_start_list, NULL },
+ { NULL, NULL, NULL, GDB_XML_EF_NONE, NULL, NULL } };
static lm_info_vector
solib_target_parse_libraries (const char *library)
{
lm_info_vector result;
- if (gdb_xml_parse_quick (_("target library list"), "library-list.dtd",
- library_list_elements, library, &result) == 0)
+ if (gdb_xml_parse_quick (_ ("target library list"), "library-list.dtd",
+ library_list_elements, library, &result)
+ == 0)
{
/* Parsed successfully. */
return result;
@@ -318,14 +309,13 @@ solib_target_relocate_section_addresses (struct so_list *so,
asection *sect;
int num_alloc_sections = 0;
- for (i = 0, sect = so->abfd->sections;
- sect != NULL;
+ for (i = 0, sect = so->abfd->sections; sect != NULL;
i++, sect = sect->next)
if ((bfd_section_flags (sect) & SEC_ALLOC))
num_alloc_sections++;
if (num_alloc_sections != li->section_bases.size ())
- warning (_("\
+ warning (_ ("\
Could not relocate shared library \"%s\": wrong number of ALLOC sections"),
so->so_name);
else
@@ -335,8 +325,7 @@ Could not relocate shared library \"%s\": wrong number of ALLOC sections"),
so->addr_low = ~(CORE_ADDR) 0;
so->addr_high = 0;
- for (i = 0, sect = so->abfd->sections;
- sect != NULL;
+ for (i = 0, sect = so->abfd->sections; sect != NULL;
i++, sect = sect->next)
{
if (!(bfd_section_flags (sect) & SEC_ALLOC))
@@ -365,12 +354,12 @@ Could not relocate shared library \"%s\": wrong number of ALLOC sections"),
}
else if (!li->segment_bases.empty ())
{
- symfile_segment_data_up data
- = get_symfile_segment_data (so->abfd);
+ symfile_segment_data_up data = get_symfile_segment_data (so->abfd);
if (data == NULL)
- warning (_("\
-Could not relocate shared library \"%s\": no segments"), so->so_name);
+ warning (_ ("\
+Could not relocate shared library \"%s\": no segments"),
+ so->so_name);
else
{
ULONGEST orig_delta;
@@ -380,8 +369,9 @@ Could not relocate shared library \"%s\": no segments"), so->so_name);
li->offsets,
li->segment_bases.size (),
li->segment_bases.data ()))
- warning (_("\
-Could not relocate shared library \"%s\": bad offsets"), so->so_name);
+ warning (_ ("\
+Could not relocate shared library \"%s\": bad offsets"),
+ so->so_name);
/* Find the range of addresses to report for this library in
"info sharedlibrary". Report any consecutive segments
@@ -405,8 +395,7 @@ Could not relocate shared library \"%s\": bad offsets"), so->so_name);
so->addr_low = li->segment_bases[0];
so->addr_high = (data->segments[i - 1].base
- + data->segments[i - 1].size
- + orig_delta);
+ + data->segments[i - 1].size + orig_delta);
gdb_assert (so->addr_low <= so->addr_high);
}
}
@@ -435,8 +424,7 @@ solib_target_in_dynsym_resolve_code (CORE_ADDR pc)
return in_plt_section (pc);
}
-const struct target_so_ops solib_target_so_ops =
-{
+const struct target_so_ops solib_target_so_ops = {
solib_target_relocate_section_addresses,
solib_target_free_so,
nullptr,
diff --git a/gdb/solib.c b/gdb/solib.c
index 60bdf46cb91..0daef481663 100644
--- a/gdb/solib.c
+++ b/gdb/solib.c
@@ -38,7 +38,7 @@
#include "completer.h"
#include "elf/external.h"
#include "elf/common.h"
-#include "filenames.h" /* for DOSish file names */
+#include "filenames.h" /* for DOSish file names */
#include "exec.h"
#include "solist.h"
#include "observable.h"
@@ -63,20 +63,22 @@ bool debug_solib;
symbol files. This takes precedence over the environment variables PATH
and LD_LIBRARY_PATH. */
static std::string solib_search_path;
+
static void
show_solib_search_path (struct ui_file *file, int from_tty,
struct cmd_list_element *c, const char *value)
{
- gdb_printf (file, _("The search path for loading non-absolute "
- "shared library symbol files is %s.\n"),
+ gdb_printf (file,
+ _ ("The search path for loading non-absolute "
+ "shared library symbol files is %s.\n"),
value);
}
/* Same as HAVE_DOS_BASED_FILE_SYSTEM, but useable as an rvalue. */
#if (HAVE_DOS_BASED_FILE_SYSTEM)
-# define DOS_BASED_FILE_SYSTEM 1
+#define DOS_BASED_FILE_SYSTEM 1
#else
-# define DOS_BASED_FILE_SYSTEM 0
+#define DOS_BASED_FILE_SYSTEM 0
#endif
/* Return the full pathname of a binary file (the main executable or a
@@ -221,29 +223,27 @@ solib_find_1 (const char *in_pathname, int *fd, bool is_solib)
}
/* Now see if we can open it. */
- found_file = gdb_open_cloexec (temp_pathname.get (),
- O_RDONLY | O_BINARY, 0).release ();
+ found_file = gdb_open_cloexec (temp_pathname.get (), O_RDONLY | O_BINARY, 0)
+ .release ();
/* If the search in gdb_sysroot failed, and the path name has a
drive spec (e.g, c:/foo), try stripping ':' from the drive spec,
and retrying in the sysroot:
c:/foo/bar.dll ==> /sysroot/c/foo/bar.dll. */
- if (found_file < 0
- && sysroot != NULL
+ if (found_file < 0 && sysroot != NULL
&& HAS_TARGET_DRIVE_SPEC (fskind, in_pathname))
{
bool need_dir_separator = !IS_DIR_SEPARATOR (in_pathname[2]);
char drive[2] = { in_pathname[0], '\0' };
- temp_pathname.reset (concat (sysroot,
- SLASH_STRING,
- drive,
+ temp_pathname.reset (concat (sysroot, SLASH_STRING, drive,
need_dir_separator ? SLASH_STRING : "",
in_pathname + 2, (char *) NULL));
- found_file = gdb_open_cloexec (temp_pathname.get (),
- O_RDONLY | O_BINARY, 0).release ();
+ found_file
+ = gdb_open_cloexec (temp_pathname.get (), O_RDONLY | O_BINARY, 0)
+ .release ();
if (found_file < 0)
{
/* If the search in gdb_sysroot still failed, try fully
@@ -256,8 +256,9 @@ solib_find_1 (const char *in_pathname, int *fd, bool is_solib)
need_dir_separator ? SLASH_STRING : "",
in_pathname + 2, (char *) NULL));
- found_file = gdb_open_cloexec (temp_pathname.get (),
- O_RDONLY | O_BINARY, 0).release ();
+ found_file
+ = gdb_open_cloexec (temp_pathname.get (), O_RDONLY | O_BINARY, 0)
+ .release ();
}
}
@@ -288,8 +289,8 @@ solib_find_1 (const char *in_pathname, int *fd, bool is_solib)
solib_search_path (if any). */
if (is_solib && found_file < 0 && !solib_search_path.empty ())
found_file = openp (solib_search_path.c_str (),
- OPF_TRY_CWD_FIRST | OPF_RETURN_REALPATH,
- in_pathname, O_RDONLY | O_BINARY, &temp_pathname);
+ OPF_TRY_CWD_FIRST | OPF_RETURN_REALPATH, in_pathname,
+ O_RDONLY | O_BINARY, &temp_pathname);
/* If not found, and we're looking for a solib, next search the
solib_search_path (if any) for the basename only (ignoring the
@@ -316,10 +317,10 @@ solib_find_1 (const char *in_pathname, int *fd, bool is_solib)
/* If not found, and we're looking for a solib, next search the
inferior's $LD_LIBRARY_PATH environment variable. */
if (is_solib && found_file < 0 && sysroot == NULL)
- found_file = openp (current_inferior ()->environment.get
- ("LD_LIBRARY_PATH"),
- OPF_TRY_CWD_FIRST | OPF_RETURN_REALPATH, in_pathname,
- O_RDONLY | O_BINARY, &temp_pathname);
+ found_file
+ = openp (current_inferior ()->environment.get ("LD_LIBRARY_PATH"),
+ OPF_TRY_CWD_FIRST | OPF_RETURN_REALPATH, in_pathname,
+ O_RDONLY | O_BINARY, &temp_pathname);
if (fd == NULL)
{
@@ -436,8 +437,8 @@ solib_bfd_fopen (const char *pathname, int fd)
if (abfd == NULL)
{
/* Arrange to free PATHNAME when the error is thrown. */
- error (_("Could not open `%s' as an executable file: %s"),
- pathname, bfd_errmsg (bfd_get_error ()));
+ error (_ ("Could not open `%s' as an executable file: %s"), pathname,
+ bfd_errmsg (bfd_get_error ()));
}
return abfd;
@@ -469,16 +470,16 @@ solib_bfd_open (const char *pathname)
/* Check bfd format. */
if (!bfd_check_format (abfd.get (), bfd_object))
- error (_("`%s': not in executable format: %s"),
+ error (_ ("`%s': not in executable format: %s"),
bfd_get_filename (abfd.get ()), bfd_errmsg (bfd_get_error ()));
/* Check bfd arch. */
b = gdbarch_bfd_arch_info (target_gdbarch ());
if (!b->compatible (b, bfd_get_arch_info (abfd.get ())))
- error (_("`%s': Shared library architecture %s is not compatible "
- "with target architecture %s."), bfd_get_filename (abfd.get ()),
- bfd_get_arch_info (abfd.get ())->printable_name,
- b->printable_name);
+ error (_ ("`%s': Shared library architecture %s is not compatible "
+ "with target architecture %s."),
+ bfd_get_filename (abfd.get ()),
+ bfd_get_arch_info (abfd.get ())->printable_name, b->printable_name);
return abfd;
}
@@ -491,20 +492,20 @@ typedef std::unordered_map<std::string, std::string> soname_build_id_map;
/* Key used to associate a soname_build_id_map to a core file bfd. */
static const struct registry<bfd>::key<soname_build_id_map>
- cbfd_soname_build_id_data_key;
+ cbfd_soname_build_id_data_key;
/* See solib.h. */
void
-set_cbfd_soname_build_id (gdb_bfd_ref_ptr abfd,
- const char *soname,
+set_cbfd_soname_build_id (gdb_bfd_ref_ptr abfd, const char *soname,
const bfd_build_id *build_id)
{
gdb_assert (abfd.get () != nullptr);
gdb_assert (soname != nullptr);
gdb_assert (build_id != nullptr);
- soname_build_id_map *mapptr = cbfd_soname_build_id_data_key.get (abfd.get ());
+ soname_build_id_map *mapptr
+ = cbfd_soname_build_id_data_key.get (abfd.get ());
if (mapptr == nullptr)
mapptr = cbfd_soname_build_id_data_key.emplace (abfd.get ());
@@ -571,15 +572,16 @@ solib_map_sections (struct so_list *so)
}
if (abfd == nullptr || mismatch)
{
- scoped_fd fd = debuginfod_exec_query ((const unsigned char*)
- build_id_hexstr.get (),
- 0, so->so_name, &filename);
+ scoped_fd fd = debuginfod_exec_query (
+ (const unsigned char *) build_id_hexstr.get (), 0, so->so_name,
+ &filename);
if (fd.get () >= 0)
abfd = ops->bfd_open (filename.get ());
else if (mismatch)
- warning (_("Build-id of %ps does not match core file."),
- styled_string (file_name_style.style (), filename.get ()));
+ warning (_ ("Build-id of %ps does not match core file."),
+ styled_string (file_name_style.style (),
+ filename.get ()));
}
}
@@ -596,7 +598,7 @@ solib_map_sections (struct so_list *so)
that objfile's path, and the target is different from the host,
GDB/MI will not provide the correct host-side path. */
if (strlen (bfd_get_filename (so->abfd)) >= SO_NAME_MAX_PATH_SIZE)
- error (_("Shared library file name is too long."));
+ error (_ ("Shared library file name is too long."));
strcpy (so->so_name, bfd_get_filename (so->abfd));
if (so->sections == nullptr)
@@ -687,7 +689,6 @@ free_so (struct so_list *so)
xfree (so);
}
-
/* Read in symbols for shared object SO. If SYMFILE_VERBOSE is set in FLAGS,
be chatty about it. Return true if any symbols were actually loaded. */
@@ -705,7 +706,6 @@ solib_read_symbols (struct so_list *so, symfile_add_flags flags)
}
else
{
-
flags |= current_inferior ()->symfile_flags;
try
@@ -725,11 +725,11 @@ solib_read_symbols (struct so_list *so, symfile_add_flags flags)
{
section_addr_info sap
= build_section_addr_info_from_section_table (*so->sections);
- gdb_bfd_ref_ptr tmp_bfd
- (gdb_bfd_ref_ptr::new_reference (so->abfd));
- so->objfile = symbol_file_add_from_bfd (tmp_bfd, so->so_name,
- flags, &sap,
- OBJF_SHARED, NULL);
+ gdb_bfd_ref_ptr tmp_bfd (
+ gdb_bfd_ref_ptr::new_reference (so->abfd));
+ so->objfile
+ = symbol_file_add_from_bfd (tmp_bfd, so->so_name, flags, &sap,
+ OBJF_SHARED, NULL);
so->objfile->addr_low = so->addr_low;
}
@@ -737,8 +737,9 @@ solib_read_symbols (struct so_list *so, symfile_add_flags flags)
}
catch (const gdb_exception_error &e)
{
- exception_fprintf (gdb_stderr, e, _("Error while reading shared"
- " library symbols for %s:\n"),
+ exception_fprintf (gdb_stderr, e,
+ _ ("Error while reading shared"
+ " library symbols for %s:\n"),
so->so_name);
}
@@ -766,7 +767,7 @@ void
update_solib_list (int from_tty)
{
const struct target_so_ops *ops = gdbarch_so_ops (target_gdbarch ());
- struct so_list *inferior = ops->current_sos();
+ struct so_list *inferior = ops->current_sos ();
struct so_list *gdb, **gdb_link;
/* We can reach here due to changing solib-search-path or the
@@ -836,8 +837,8 @@ update_solib_list (int from_tty)
}
else
{
- if (! filename_cmp (gdb->so_original_name, i->so_original_name))
- break;
+ if (!filename_cmp (gdb->so_original_name, i->so_original_name))
+ break;
}
i_link = &i->next;
@@ -867,7 +868,7 @@ update_solib_list (int from_tty)
*gdb_link = gdb->next;
/* Unless the user loaded it explicitly, free SO's objfile. */
- if (gdb->objfile && ! (gdb->objfile->flags & OBJF_USERLOADED)
+ if (gdb->objfile && !(gdb->objfile->flags & OBJF_USERLOADED)
&& !solib_used (gdb))
gdb->objfile->unlink ();
@@ -896,7 +897,6 @@ update_solib_list (int from_tty)
/* Fill in the rest of each of the `struct so_list' nodes. */
for (i = inferior; i; i = i->next)
{
-
i->pspace = current_program_space;
current_program_space->added_solibs.push_back (i);
@@ -914,8 +914,8 @@ update_solib_list (int from_tty)
catch (const gdb_exception_error &e)
{
exception_fprintf (gdb_stderr, e,
- _("Error while mapping shared "
- "library sections:\n"));
+ _ ("Error while mapping shared "
+ "library sections:\n"));
}
/* Notify any observer that the shared object has been
@@ -931,12 +931,12 @@ update_solib_list (int from_tty)
stand out well. */
if (not_found == 1)
- warning (_("Could not load shared library symbols for %s.\n"
- "Do you need \"set solib-search-path\" "
- "or \"set sysroot\"?"),
+ warning (_ ("Could not load shared library symbols for %s.\n"
+ "Do you need \"set solib-search-path\" "
+ "or \"set sysroot\"?"),
not_found_filename);
else if (not_found > 1)
- warning (_("\
+ warning (_ ("\
Could not load shared library symbols for %d libraries, e.g. %s.\n\
Use the \"info sharedlibrary\" command to see the complete listing.\n\
Do you need \"set solib-search-path\" or \"set sysroot\"?"),
@@ -944,7 +944,6 @@ Do you need \"set solib-search-path\" or \"set sysroot\"?"),
}
}
-
/* Return non-zero if NAME is the libpthread shared library.
Uses a fairly simplistic heuristic approach where we check
@@ -959,7 +958,7 @@ bool
libpthread_name_p (const char *name)
{
return (strstr (name, "/libpthread") != NULL
- || strstr (name, "/libc.") != NULL );
+ || strstr (name, "/libc.") != NULL);
}
/* Return non-zero if SO is the libpthread shared library. */
@@ -986,11 +985,11 @@ solib_add (const char *pattern, int from_tty, int readsyms)
{
if (pattern != NULL)
{
- gdb_printf (_("Loading symbols for shared libraries: %s\n"),
+ gdb_printf (_ ("Loading symbols for shared libraries: %s\n"),
pattern);
}
else
- gdb_printf (_("Loading symbols for shared libraries.\n"));
+ gdb_printf (_ ("Loading symbols for shared libraries.\n"));
}
current_program_space->solib_add_generation++;
@@ -1000,7 +999,7 @@ solib_add (const char *pattern, int from_tty, int readsyms)
char *re_err = re_comp (pattern);
if (re_err)
- error (_("Invalid regexp: %s"), re_err);
+ error (_ ("Invalid regexp: %s"), re_err);
}
update_solib_list (from_tty);
@@ -1014,18 +1013,17 @@ solib_add (const char *pattern, int from_tty, int readsyms)
symfile_add_flags add_flags = SYMFILE_DEFER_BP_RESET;
if (from_tty)
- add_flags |= SYMFILE_VERBOSE;
+ add_flags |= SYMFILE_VERBOSE;
for (struct so_list *gdb : current_program_space->solibs ())
- if (! pattern || re_exec (gdb->so_name))
+ if (!pattern || re_exec (gdb->so_name))
{
/* Normally, we would read the symbols from that library
only if READSYMS is set. However, we're making a small
exception for the pthread library, because we sometimes
need the library symbols to be loaded in order to provide
thread support (x86-linux for instance). */
- const int add_this_solib =
- (readsyms || libpthread_solib_p (gdb));
+ const int add_this_solib = (readsyms || libpthread_solib_p (gdb));
any_matches = true;
if (add_this_solib)
@@ -1035,7 +1033,7 @@ solib_add (const char *pattern, int from_tty, int readsyms)
/* If no pattern was given, be quiet for shared
libraries we have already loaded. */
if (pattern && (from_tty || info_verbose))
- gdb_printf (_("Symbols already loaded for %s\n"),
+ gdb_printf (_ ("Symbols already loaded for %s\n"),
gdb->so_name);
}
else if (solib_read_symbols (gdb, add_flags))
@@ -1046,9 +1044,9 @@ solib_add (const char *pattern, int from_tty, int readsyms)
if (loaded_any_symbols)
breakpoint_re_set ();
- if (from_tty && pattern && ! any_matches)
- gdb_printf
- ("No loaded shared libraries match the pattern `%s'.\n", pattern);
+ if (from_tty && pattern && !any_matches)
+ gdb_printf ("No loaded shared libraries match the pattern `%s'.\n",
+ pattern);
if (loaded_any_symbols)
{
@@ -1078,7 +1076,7 @@ info_sharedlibrary_command (const char *pattern, int from_tty)
char *re_err = re_comp (pattern);
if (re_err)
- error (_("Invalid regexp: %s"), re_err);
+ error (_ ("Invalid regexp: %s"), re_err);
}
/* "0x", a little whitespace, and two hex digits per byte of pointers. */
@@ -1094,7 +1092,7 @@ info_sharedlibrary_command (const char *pattern, int from_tty)
{
if (so->so_name[0])
{
- if (pattern && ! re_exec (so->so_name))
+ if (pattern && !re_exec (so->so_name))
continue;
++nr_libs;
}
@@ -1113,9 +1111,9 @@ info_sharedlibrary_command (const char *pattern, int from_tty)
for (struct so_list *so : current_program_space->solibs ())
{
- if (! so->so_name[0])
+ if (!so->so_name[0])
continue;
- if (pattern && ! re_exec (so->so_name))
+ if (pattern && !re_exec (so->so_name))
continue;
ui_out_emit_tuple tuple_emitter (uiout, "lib");
@@ -1131,9 +1129,8 @@ info_sharedlibrary_command (const char *pattern, int from_tty)
uiout->field_skip ("to");
}
- if (! top_level_interpreter ()->interp_ui_out ()->is_mi_like_p ()
- && so->symbols_loaded
- && !objfile_has_symbols (so->objfile))
+ if (!top_level_interpreter ()->interp_ui_out ()->is_mi_like_p ()
+ && so->symbols_loaded && !objfile_has_symbols (so->objfile))
{
so_missing_debug_info = true;
uiout->field_string ("syms-read", "Yes (*)");
@@ -1150,23 +1147,22 @@ info_sharedlibrary_command (const char *pattern, int from_tty)
if (nr_libs == 0)
{
if (pattern)
- uiout->message (_("No shared libraries matched.\n"));
+ uiout->message (_ ("No shared libraries matched.\n"));
else
- uiout->message (_("No shared libraries loaded at this time.\n"));
+ uiout->message (_ ("No shared libraries loaded at this time.\n"));
}
else
{
if (so_missing_debug_info)
- uiout->message (_("(*): Shared library is missing "
- "debugging information.\n"));
+ uiout->message (_ ("(*): Shared library is missing "
+ "debugging information.\n"));
}
}
/* See solib.h. */
bool
-solib_contains_address_p (const struct so_list *const solib,
- CORE_ADDR address)
+solib_contains_address_p (const struct so_list *const solib, CORE_ADDR address)
{
if (solib->sections == nullptr)
return false;
@@ -1323,7 +1319,7 @@ static void
reload_shared_libraries_1 (int from_tty)
{
if (print_symbol_loading_p (from_tty, 0, 0))
- gdb_printf (_("Loading symbols for shared libraries.\n"));
+ gdb_printf (_ ("Loading symbols for shared libraries.\n"));
for (struct so_list *so : current_program_space->solibs ())
{
@@ -1334,8 +1330,8 @@ reload_shared_libraries_1 (int from_tty)
if (from_tty)
add_flags |= SYMFILE_VERBOSE;
- gdb::unique_xmalloc_ptr<char> filename
- (tilde_expand (so->so_original_name));
+ gdb::unique_xmalloc_ptr<char> filename (
+ tilde_expand (so->so_original_name));
gdb_bfd_ref_ptr abfd (solib_bfd_open (filename.get ()));
if (abfd != NULL)
found_pathname = bfd_get_filename (abfd.get ());
@@ -1346,7 +1342,7 @@ reload_shared_libraries_1 (int from_tty)
|| (found_pathname != NULL
&& filename_cmp (found_pathname, so->so_name) != 0))
{
- if (so->objfile && ! (so->objfile->flags & OBJF_USERLOADED)
+ if (so->objfile && !(so->objfile->flags & OBJF_USERLOADED)
&& !solib_used (so))
so->objfile->unlink ();
current_program_space->remove_target_sections (so);
@@ -1356,8 +1352,7 @@ reload_shared_libraries_1 (int from_tty)
/* If this shared library is now associated with a new symbol
file, open it. */
if (found_pathname != NULL
- && (!was_loaded
- || filename_cmp (found_pathname, so->so_name) != 0))
+ && (!was_loaded || filename_cmp (found_pathname, so->so_name) != 0))
{
bool got_error = false;
@@ -1369,14 +1364,14 @@ reload_shared_libraries_1 (int from_tty)
catch (const gdb_exception_error &e)
{
exception_fprintf (gdb_stderr, e,
- _("Error while mapping "
- "shared library sections:\n"));
+ _ ("Error while mapping "
+ "shared library sections:\n"));
got_error = true;
}
- if (!got_error
- && (auto_solib_add || was_loaded || libpthread_solib_p (so)))
- solib_read_symbols (so, add_flags);
+ if (!got_error
+ && (auto_solib_add || was_loaded || libpthread_solib_p (so)))
+ solib_read_symbols (so, add_flags);
}
}
}
@@ -1452,9 +1447,9 @@ gdb_sysroot_changed (const char *ignored, int from_tty,
if (!warning_issued)
{
- warning (_("\"%s\" is deprecated, use \"%s\" instead."),
- old_prefix, new_prefix);
- warning (_("sysroot set to \"%s\"."), gdb_sysroot.c_str ());
+ warning (_ ("\"%s\" is deprecated, use \"%s\" instead."), old_prefix,
+ new_prefix);
+ warning (_ ("sysroot set to \"%s\"."), gdb_sysroot.c_str ());
warning_issued = true;
}
@@ -1467,11 +1462,10 @@ static void
show_auto_solib_add (struct ui_file *file, int from_tty,
struct cmd_list_element *c, const char *value)
{
- gdb_printf (file, _("Autoloading of shared library symbols is %s.\n"),
+ gdb_printf (file, _ ("Autoloading of shared library symbols is %s.\n"),
value);
}
-
/* Lookup the value for a specific symbol from dynamic symbol table. Look
up symbol from ABFD. MATCH_SYM is a callback function to determine
whether to pick up a symbol. DATA is the input of this callback
@@ -1492,12 +1486,12 @@ gdb_bfd_lookup_symbol_from_symtab (bfd *abfd,
gdb::def_vector<asymbol *> storage (storage_needed / sizeof (asymbol *));
asymbol **symbol_table = storage.data ();
- unsigned int number_of_symbols =
- bfd_canonicalize_symtab (abfd, symbol_table);
+ unsigned int number_of_symbols
+ = bfd_canonicalize_symtab (abfd, symbol_table);
for (i = 0; i < number_of_symbols; i++)
{
- asymbol *sym = *symbol_table++;
+ asymbol *sym = *symbol_table++;
if (match_sym (sym, data))
{
@@ -1513,7 +1507,9 @@ gdb_bfd_lookup_symbol_from_symtab (bfd *abfd,
if (bfd_get_flavour (abfd) == bfd_target_elf_flavour
&& gdbarch_elf_make_msymbol_special_p (gdbarch))
{
- struct minimal_symbol msym {};
+ struct minimal_symbol msym
+ {
+ };
msym.set_value_address (symaddr);
gdbarch_elf_make_msymbol_special (gdbarch, sym, &msym);
@@ -1560,8 +1556,8 @@ gdb_bfd_scan_elf_dyntag (const int desired_dyntag, bfd *abfd, CORE_ADDR *ptr,
return 0;
bool found = false;
- for (const target_section &target_section
- : current_program_space->target_sections ())
+ for (const target_section &target_section :
+ current_program_space->target_sections ())
if (sect == target_section.the_bfd_section)
{
dyn_addr = target_section.addr;
@@ -1582,52 +1578,49 @@ gdb_bfd_scan_elf_dyntag (const int desired_dyntag, bfd *abfd, CORE_ADDR *ptr,
from memory later. */
sect_size = bfd_section_size (sect);
buf = bufstart = (gdb_byte *) alloca (sect_size);
- if (!bfd_get_section_contents (abfd, sect,
- buf, 0, sect_size))
+ if (!bfd_get_section_contents (abfd, sect, buf, 0, sect_size))
return 0;
/* Iterate over BUF and scan for DYNTAG. If found, set PTR and return. */
step = (arch_size == 32) ? sizeof (Elf32_External_Dyn)
: sizeof (Elf64_External_Dyn);
- for (bufend = buf + sect_size;
- buf < bufend;
- buf += step)
- {
- if (arch_size == 32)
- {
- x_dynp_32 = (Elf32_External_Dyn *) buf;
- current_dyntag = bfd_h_get_32 (abfd, (bfd_byte *) x_dynp_32->d_tag);
- dyn_ptr = bfd_h_get_32 (abfd, (bfd_byte *) x_dynp_32->d_un.d_ptr);
- }
- else
- {
- x_dynp_64 = (Elf64_External_Dyn *) buf;
- current_dyntag = bfd_h_get_64 (abfd, (bfd_byte *) x_dynp_64->d_tag);
- dyn_ptr = bfd_h_get_64 (abfd, (bfd_byte *) x_dynp_64->d_un.d_ptr);
- }
- if (current_dyntag == DT_NULL)
- return 0;
- if (current_dyntag == desired_dyntag)
- {
- /* If requested, try to read the runtime value of this .dynamic
+ for (bufend = buf + sect_size; buf < bufend; buf += step)
+ {
+ if (arch_size == 32)
+ {
+ x_dynp_32 = (Elf32_External_Dyn *) buf;
+ current_dyntag = bfd_h_get_32 (abfd, (bfd_byte *) x_dynp_32->d_tag);
+ dyn_ptr = bfd_h_get_32 (abfd, (bfd_byte *) x_dynp_32->d_un.d_ptr);
+ }
+ else
+ {
+ x_dynp_64 = (Elf64_External_Dyn *) buf;
+ current_dyntag = bfd_h_get_64 (abfd, (bfd_byte *) x_dynp_64->d_tag);
+ dyn_ptr = bfd_h_get_64 (abfd, (bfd_byte *) x_dynp_64->d_un.d_ptr);
+ }
+ if (current_dyntag == DT_NULL)
+ return 0;
+ if (current_dyntag == desired_dyntag)
+ {
+ /* If requested, try to read the runtime value of this .dynamic
entry. */
- if (ptr)
- {
- struct type *ptr_type;
- gdb_byte ptr_buf[8];
- CORE_ADDR ptr_addr_1;
-
- ptr_type = builtin_type (target_gdbarch ())->builtin_data_ptr;
- ptr_addr_1 = dyn_addr + (buf - bufstart) + arch_size / 8;
- if (target_read_memory (ptr_addr_1, ptr_buf, arch_size / 8) == 0)
- dyn_ptr = extract_typed_address (ptr_buf, ptr_type);
- *ptr = dyn_ptr;
- if (ptr_addr)
- *ptr_addr = dyn_addr + (buf - bufstart);
- }
- return 1;
- }
- }
+ if (ptr)
+ {
+ struct type *ptr_type;
+ gdb_byte ptr_buf[8];
+ CORE_ADDR ptr_addr_1;
+
+ ptr_type = builtin_type (target_gdbarch ())->builtin_data_ptr;
+ ptr_addr_1 = dyn_addr + (buf - bufstart) + arch_size / 8;
+ if (target_read_memory (ptr_addr_1, ptr_buf, arch_size / 8) == 0)
+ dyn_ptr = extract_typed_address (ptr_buf, ptr_type);
+ *ptr = dyn_ptr;
+ if (ptr_addr)
+ *ptr_addr = dyn_addr + (buf - bufstart);
+ }
+ return 1;
+ }
+ }
return 0;
}
@@ -1651,7 +1644,8 @@ gdb_bfd_read_elf_soname (const char *filename)
if (!gdb_bfd_scan_elf_dyntag (DT_SONAME, abfd.get (), &idx, nullptr))
return {};
- struct bfd_section *dynstr = bfd_get_section_by_name (abfd.get (), ".dynstr");
+ struct bfd_section *dynstr
+ = bfd_get_section_by_name (abfd.get (), ".dynstr");
int sect_size = bfd_section_size (dynstr);
if (dynstr == nullptr || sect_size <= idx)
return {};
@@ -1688,8 +1682,8 @@ bfd_lookup_symbol_from_dyn_symtab (bfd *abfd,
unsigned int i;
gdb::def_vector<asymbol *> storage (storage_needed / sizeof (asymbol *));
asymbol **symbol_table = storage.data ();
- unsigned int number_of_symbols =
- bfd_canonicalize_dynamic_symtab (abfd, symbol_table);
+ unsigned int number_of_symbols
+ = bfd_canonicalize_dynamic_symtab (abfd, symbol_table);
for (i = 0; i < number_of_symbols; i++)
{
@@ -1717,7 +1711,8 @@ gdb_bfd_lookup_symbol (bfd *abfd,
int (*match_sym) (const asymbol *, const void *),
const void *data)
{
- CORE_ADDR symaddr = gdb_bfd_lookup_symbol_from_symtab (abfd, match_sym, data);
+ CORE_ADDR symaddr
+ = gdb_bfd_lookup_symbol_from_symtab (abfd, match_sym, data);
/* On FreeBSD, the dynamic linker is stripped by default. So we'll
have to check the dynamic string table too. */
@@ -1744,49 +1739,49 @@ remove_user_added_objfile (struct objfile *objfile)
}
void _initialize_solib ();
+
void
_initialize_solib ()
{
- gdb::observers::free_objfile.attach (remove_user_added_objfile,
- "solib");
- gdb::observers::inferior_execd.attach ([] (inferior *inf)
- {
- solib_create_inferior_hook (0);
- }, "solib");
+ gdb::observers::free_objfile.attach (remove_user_added_objfile, "solib");
+ gdb::observers::inferior_execd.attach (
+ [] (inferior *inf) { solib_create_inferior_hook (0); }, "solib");
- add_com ("sharedlibrary", class_files, sharedlibrary_command,
- _("Load shared object library symbols for files matching REGEXP."));
+ add_com (
+ "sharedlibrary", class_files, sharedlibrary_command,
+ _ ("Load shared object library symbols for files matching REGEXP."));
cmd_list_element *info_sharedlibrary_cmd
= add_info ("sharedlibrary", info_sharedlibrary_command,
- _("Status of loaded shared object libraries."));
+ _ ("Status of loaded shared object libraries."));
add_info_alias ("dll", info_sharedlibrary_cmd, 1);
add_com ("nosharedlibrary", class_files, no_shared_libraries,
- _("Unload all shared object library symbols."));
-
- add_setshow_boolean_cmd ("auto-solib-add", class_support,
- &auto_solib_add, _("\
-Set autoloading of shared library symbols."), _("\
-Show autoloading of shared library symbols."), _("\
+ _ ("Unload all shared object library symbols."));
+
+ add_setshow_boolean_cmd ("auto-solib-add", class_support, &auto_solib_add,
+ _ ("\
+Set autoloading of shared library symbols."),
+ _ ("\
+Show autoloading of shared library symbols."),
+ _ ("\
If \"on\", symbols from all shared object libraries will be loaded\n\
automatically when the inferior begins execution, when the dynamic linker\n\
informs gdb that a new library has been loaded, or when attaching to the\n\
inferior. Otherwise, symbols must be loaded manually, using \
`sharedlibrary'."),
- NULL,
- show_auto_solib_add,
- &setlist, &showlist);
+ NULL, show_auto_solib_add, &setlist, &showlist);
set_show_commands sysroot_cmds
= add_setshow_optional_filename_cmd ("sysroot", class_support,
- &gdb_sysroot, _("\
-Set an alternate system root."), _("\
-Show the current system root."), _("\
+ &gdb_sysroot, _ ("\
+Set an alternate system root."),
+ _ ("\
+Show the current system root."),
+ _ ("\
The system root is used to load absolute shared library symbol files.\n\
For other (relative) files, you can add directories using\n\
`set solib-search-path'."),
- gdb_sysroot_changed,
- NULL,
- &setlist, &showlist);
+ gdb_sysroot_changed, NULL, &setlist,
+ &showlist);
add_alias_cmd ("solib-absolute-prefix", sysroot_cmds.set, class_support, 0,
&setlist);
@@ -1794,22 +1789,22 @@ For other (relative) files, you can add directories using\n\
&showlist);
add_setshow_optional_filename_cmd ("solib-search-path", class_support,
- &solib_search_path, _("\
+ &solib_search_path, _ ("\
Set the search path for loading non-absolute shared library symbol files."),
- _("\
+ _ ("\
Show the search path for loading non-absolute shared library symbol files."),
- _("\
+ _ ("\
This takes precedence over the environment variables \
PATH and LD_LIBRARY_PATH."),
reload_shared_libraries,
- show_solib_search_path,
- &setlist, &showlist);
-
- add_setshow_boolean_cmd ("solib", class_maintenance,
- &debug_solib, _("\
-Set solib debugging."), _("\
-Show solib debugging."), _("\
+ show_solib_search_path, &setlist,
+ &showlist);
+
+ add_setshow_boolean_cmd ("solib", class_maintenance, &debug_solib, _ ("\
+Set solib debugging."),
+ _ ("\
+Show solib debugging."),
+ _ ("\
When true, solib-related debugging output is enabled."),
- nullptr, nullptr,
- &setdebuglist, &showdebuglist);
+ nullptr, nullptr, &setdebuglist, &showdebuglist);
}
diff --git a/gdb/solib.h b/gdb/solib.h
index 24c365a0ae0..5ae3f4bdf3f 100644
--- a/gdb/solib.h
+++ b/gdb/solib.h
@@ -114,11 +114,9 @@ extern CORE_ADDR gdb_bfd_lookup_symbol (bfd *abfd,
/* Look up symbol from symbol table. */
-extern CORE_ADDR gdb_bfd_lookup_symbol_from_symtab (bfd *abfd,
- int (*match_sym)
- (const asymbol *,
- const void *),
- const void *data);
+extern CORE_ADDR gdb_bfd_lookup_symbol_from_symtab (
+ bfd *abfd, int (*match_sym) (const asymbol *, const void *),
+ const void *data);
/* Scan for DESIRED_DYNTAG in .dynamic section of ABFD. If DESIRED_DYNTAG is
found, 1 is returned and the corresponding PTR and PTR_ADDR are set. */
@@ -129,8 +127,8 @@ extern int gdb_bfd_scan_elf_dyntag (const int desired_dyntag, bfd *abfd,
/* If FILENAME refers to an ELF shared object then attempt to return the
string referred to by its DT_SONAME tag. */
-extern gdb::unique_xmalloc_ptr<char> gdb_bfd_read_elf_soname
- (const char *filename);
+extern gdb::unique_xmalloc_ptr<char>
+gdb_bfd_read_elf_soname (const char *filename);
/* Enable or disable optional solib event breakpoints as appropriate. */
@@ -143,15 +141,14 @@ extern void handle_solib_event (void);
/* Associate SONAME with BUILD_ID in ABFD's registry so that it can be
retrieved with get_cbfd_soname_build_id. */
-extern void set_cbfd_soname_build_id (gdb_bfd_ref_ptr abfd,
- const char *soname,
+extern void set_cbfd_soname_build_id (gdb_bfd_ref_ptr abfd, const char *soname,
const bfd_build_id *build_id);
/* If SONAME had a build-id associated with it in ABFD's registry by a
previous call to set_cbfd_soname_build_id then return the build-id
as a NULL-terminated hex string. */
-extern gdb::unique_xmalloc_ptr<char> get_cbfd_soname_build_id
- (gdb_bfd_ref_ptr abfd, const char *soname);
+extern gdb::unique_xmalloc_ptr<char>
+get_cbfd_soname_build_id (gdb_bfd_ref_ptr abfd, const char *soname);
#endif /* SOLIB_H */
diff --git a/gdb/solist.h b/gdb/solist.h
index 5275a79d811..7b7cc64c830 100644
--- a/gdb/solist.h
+++ b/gdb/solist.h
@@ -19,7 +19,7 @@
#ifndef SOLIST_H
#define SOLIST_H
-#define SO_NAME_MAX_PATH_SIZE 512 /* FIXME: Should be dynamic */
+#define SO_NAME_MAX_PATH_SIZE 512 /* FIXME: Should be dynamic */
/* For domain_enum domain. */
#include "symtab.h"
#include "gdb_bfd.h"
@@ -37,7 +37,7 @@ struct so_list
dynamic linker's tables in the inferior, and are initialized by
current_sos. */
- struct so_list *next; /* next structure in linked list */
+ struct so_list *next; /* next structure in linked list */
/* A pointer to target specific link map information. Often this
will be a copy of struct link_map from the user process, but
@@ -65,7 +65,7 @@ struct so_list
current_sos must initialize these fields to 0. */
bfd *abfd;
- char symbols_loaded; /* flag: symbols read in yet? */
+ char symbols_loaded; /* flag: symbols read in yet? */
/* objfile with symbols for a loaded library. Target memory is read from
ABFD. OBJFILE may be NULL either before symbols have been loaded, if
@@ -130,8 +130,7 @@ struct target_so_ops
If TEMP_PATHNAME is non-NULL: If the file is successfully opened a
pointer to a malloc'd and realpath'd copy of SONAME is stored there,
otherwise NULL is stored there. */
- int (*find_and_open_solib) (const char *soname,
- unsigned o_flags,
+ int (*find_and_open_solib) (const char *soname, unsigned o_flags,
gdb::unique_xmalloc_ptr<char> *temp_pathname);
/* Given two so_list objects, one from the GDB thread list
@@ -146,8 +145,7 @@ struct target_so_ops
handled correctly when the core file is loaded. This only
applies when the section would otherwise not be kept in the
core file (in particular, for readonly sections). */
- int (*keep_data_in_core) (CORE_ADDR vaddr,
- unsigned long size);
+ int (*keep_data_in_core) (CORE_ADDR vaddr, unsigned long size);
/* Enable or disable optional solib event breakpoints as
appropriate. This should be called whenever
@@ -171,10 +169,7 @@ void free_so (struct so_list *so);
/* A deleter that calls free_so. */
struct so_deleter
{
- void operator() (struct so_list *so) const
- {
- free_so (so);
- }
+ void operator() (struct so_list *so) const { free_so (so); }
};
/* A unique pointer to a so_list. */
diff --git a/gdb/source-cache.c b/gdb/source-cache.c
index b7410d46293..a902b77c4c3 100644
--- a/gdb/source-cache.c
+++ b/gdb/source-cache.c
@@ -56,20 +56,18 @@ static bool use_gnu_source_highlight;
/* The "maint show gnu-source-highlight enabled" command. */
static void
-show_use_gnu_source_highlight_enabled (struct ui_file *file, int from_tty,
- struct cmd_list_element *c,
- const char *value)
+show_use_gnu_source_highlight_enabled (struct ui_file *file, int from_tty,
+ struct cmd_list_element *c,
+ const char *value)
{
- gdb_printf (file,
- _("Use of GNU Source Highlight library is \"%s\".\n"),
+ gdb_printf (file, _ ("Use of GNU Source Highlight library is \"%s\".\n"),
value);
}
/* The "maint set gnu-source-highlight enabled" command. */
static void
-set_use_gnu_source_highlight_enabled (const char *ignore_args,
- int from_tty,
+set_use_gnu_source_highlight_enabled (const char *ignore_args, int from_tty,
struct cmd_list_element *c)
{
#ifndef HAVE_SOURCE_HIGHLIGHT
@@ -78,7 +76,7 @@ set_use_gnu_source_highlight_enabled (const char *ignore_args,
if (use_gnu_source_highlight)
{
use_gnu_source_highlight = false;
- error (_("the GNU Source Highlight library is not available"));
+ error (_ ("the GNU Source Highlight library is not available"));
}
#else
/* We (might) have just changed how we style source code, discard any
@@ -114,12 +112,11 @@ source_cache::get_plain_source_lines (struct symtab *s,
mtime = current_program_space->ebfd_mtime;
if (mtime && mtime < st.st_mtime)
- warning (_("Source file is more recent than executable."));
+ warning (_ ("Source file is more recent than executable."));
std::vector<off_t> offsets;
offsets.push_back (0);
- for (size_t offset = lines.find ('\n');
- offset != std::string::npos;
+ for (size_t offset = lines.find ('\n'); offset != std::string::npos;
offset = lines.find ('\n', offset))
{
++offset;
@@ -205,8 +202,7 @@ source_cache::ensure (struct symtab *s)
{
/* This should always hold, because we create the file offsets
when reading the file. */
- gdb_assert (m_offset_cache.find (fullname)
- != m_offset_cache.end ());
+ gdb_assert (m_offset_cache.find (fullname) != m_offset_cache.end ());
/* Not strictly LRU, but at least ensure that the most
recently used entry is always the last candidate for
deletion. Note that this property is relied upon by at
@@ -335,8 +331,7 @@ extract_lines (const std::string &text, int first_line, int last_line,
if (lineno == last_line || pos == std::string::npos)
{
/* A newline at the end does not start a new line. */
- if (first_pos == std::string::npos
- || first_pos == text.size ())
+ if (first_pos == std::string::npos || first_pos == text.size ())
return false;
if (pos == std::string::npos)
pos = text.size ();
@@ -364,8 +359,8 @@ source_cache::get_source_lines (struct symtab *s, int first_line,
if (!ensure (s))
return false;
- return extract_lines (m_source_map.back ().contents,
- first_line, last_line, lines);
+ return extract_lines (m_source_map.back ().contents, first_line, last_line,
+ lines);
}
/* Implement 'maint flush source-cache' command. */
@@ -374,34 +369,34 @@ static void
source_cache_flush_command (const char *command, int from_tty)
{
forget_cached_source_info ();
- gdb_printf (_("Source cache flushed.\n"));
+ gdb_printf (_ ("Source cache flushed.\n"));
}
#if GDB_SELF_TEST
namespace selftests
{
-static void extract_lines_test ()
+static void
+extract_lines_test ()
{
std::string input_text = "abc\ndef\nghi\njkl\n";
std::string result;
- SELF_CHECK (extract_lines (input_text, 1, 1, &result)
- && result == "abc\n");
+ SELF_CHECK (extract_lines (input_text, 1, 1, &result) && result == "abc\n");
SELF_CHECK (!extract_lines (input_text, 2, 1, &result));
SELF_CHECK (extract_lines (input_text, 1, 2, &result)
&& result == "abc\ndef\n");
- SELF_CHECK (extract_lines ("abc", 1, 1, &result)
- && result == "abc");
-}
+ SELF_CHECK (extract_lines ("abc", 1, 1, &result) && result == "abc");
}
+} // namespace selftests
#endif
void _initialize_source_cache ();
+
void
_initialize_source_cache ()
{
add_cmd ("source-cache", class_maintenance, source_cache_flush_command,
- _("Force gdb to flush its source code cache."),
+ _ ("Force gdb to flush its source code cache."),
&maintenanceflushlist);
/* All the 'maint set|show gnu-source-highlight' sub-commands. */
@@ -410,18 +405,19 @@ _initialize_source_cache ()
/* Adds 'maint set|show gnu-source-highlight'. */
add_setshow_prefix_cmd ("gnu-source-highlight", class_maintenance,
- _("Set gnu-source-highlight specific variables."),
- _("Show gnu-source-highlight specific variables."),
+ _ ("Set gnu-source-highlight specific variables."),
+ _ ("Show gnu-source-highlight specific variables."),
&maint_set_gnu_source_highlight_cmdlist,
&maint_show_gnu_source_highlight_cmdlist,
- &maintenance_set_cmdlist,
- &maintenance_show_cmdlist);
+ &maintenance_set_cmdlist, &maintenance_show_cmdlist);
/* Adds 'maint set|show gnu-source-highlight enabled'. */
add_setshow_boolean_cmd ("enabled", class_maintenance,
- &use_gnu_source_highlight, _("\
-Set whether the GNU Source Highlight library should be used."), _("\
-Show whether the GNU Source Highlight library is being used."),_("\
+ &use_gnu_source_highlight, _ ("\
+Set whether the GNU Source Highlight library should be used."),
+ _ ("\
+Show whether the GNU Source Highlight library is being used."),
+ _ ("\
When enabled, GDB will use the GNU Source Highlight library to apply\n\
styling to source code lines that are shown."),
set_use_gnu_source_highlight_enabled,
diff --git a/gdb/source-cache.h b/gdb/source-cache.h
index bec6598ff9f..51b43510bb2 100644
--- a/gdb/source-cache.h
+++ b/gdb/source-cache.h
@@ -37,9 +37,7 @@ class source_cache
{
public:
- source_cache ()
- {
- }
+ source_cache () {}
/* This returns the vector of file offsets for the symtab S,
computing the vector first if needed.
@@ -49,8 +47,7 @@ public:
On success, returns true and sets *OFFSETS. This pointer is not
guaranteed to remain valid across other calls to get_source_lines
or get_line_charpos. */
- bool get_line_charpos (struct symtab *s,
- const std::vector<off_t> **offsets);
+ bool get_line_charpos (struct symtab *s, const std::vector<off_t> **offsets);
/* Get the source text for the source file in symtab S. FIRST_LINE
and LAST_LINE are the first and last lines to return; line
@@ -58,8 +55,8 @@ public:
numbers are out of range, false is returned. Otherwise,
LINES_OUT is set to the desired text. The returned text may
include ANSI terminal escapes. */
- bool get_source_lines (struct symtab *s, int first_line,
- int last_line, std::string *lines_out);
+ bool get_source_lines (struct symtab *s, int first_line, int last_line,
+ std::string *lines_out);
/* Remove all the items from the source cache. */
void clear ()
diff --git a/gdb/source.c b/gdb/source.c
index be5af180c49..8e6298e7768 100644
--- a/gdb/source.c
+++ b/gdb/source.c
@@ -37,7 +37,7 @@
#include "annotate.h"
#include "gdbtypes.h"
#include "linespec.h"
-#include "filenames.h" /* for DOSish file names */
+#include "filenames.h" /* for DOSish file names */
#include "completer.h"
#include "ui-out.h"
#include "readline/tilde.h"
@@ -93,16 +93,10 @@ public:
}
/* Get the symtab. */
- struct symtab *symtab () const
- {
- return m_symtab;
- }
+ struct symtab *symtab () const { return m_symtab; }
/* Get the line number. */
- int line () const
- {
- return m_line;
- }
+ int line () const { return m_line; }
private:
@@ -116,7 +110,7 @@ private:
};
static const registry<program_space>::key<current_source_location>
- current_source_key;
+ current_source_key;
/* Default number of lines to print with commands like "list".
This is based on guessing how many long (i.e. more than chars_per_line
@@ -125,13 +119,14 @@ static const registry<program_space>::key<current_source_location>
things are wrapping, but that would be a fair amount of work. */
static int lines_to_list = 10;
+
static void
show_lines_to_list (struct ui_file *file, int from_tty,
struct cmd_list_element *c, const char *value)
{
gdb_printf (file,
- _("Number of source lines gdb "
- "will list by default is %s.\n"),
+ _ ("Number of source lines gdb "
+ "will list by default is %s.\n"),
value);
}
@@ -140,12 +135,9 @@ static const char filename_display_basename[] = "basename";
static const char filename_display_relative[] = "relative";
static const char filename_display_absolute[] = "absolute";
-static const char *const filename_display_kind_names[] = {
- filename_display_basename,
- filename_display_relative,
- filename_display_absolute,
- NULL
-};
+static const char *const filename_display_kind_names[]
+ = { filename_display_basename, filename_display_relative,
+ filename_display_absolute, NULL };
static const char *filename_display_string = filename_display_relative;
@@ -153,7 +145,7 @@ static void
show_filename_display_string (struct ui_file *file, int from_tty,
struct cmd_list_element *c, const char *value)
{
- gdb_printf (file, _("Filenames are displayed as \"%s\".\n"), value);
+ gdb_printf (file, _ ("Filenames are displayed as \"%s\".\n"), value);
}
/* When true GDB will stat and open source files as required, but when
@@ -167,7 +159,7 @@ static void
show_source_open (struct ui_file *file, int from_tty,
struct cmd_list_element *c, const char *value)
{
- gdb_printf (file, _("Source opening is \"%s\".\n"), value);
+ gdb_printf (file, _ ("Source opening is \"%s\".\n"), value);
}
/* Line number of last line printed. Default for various commands.
@@ -186,7 +178,7 @@ static int first_line_listed;
static struct symtab *last_source_visited = NULL;
static bool last_source_error = false;
-
+
/* Return the first line listed by print_source_lines.
Used by command interpreters to request listing from
a previous point. */
@@ -224,8 +216,7 @@ get_lines_to_list (void)
static current_source_location *
get_source_location (program_space *pspace)
{
- current_source_location *loc
- = current_source_key.get (pspace);
+ current_source_location *loc = current_source_key.get (pspace);
if (loc == nullptr)
loc = current_source_key.emplace (pspace);
return loc;
@@ -233,7 +224,7 @@ get_source_location (program_space *pspace)
/* Return the current source file for listing and next line to list.
NOTE: The returned sal pc and end fields are not valid. */
-
+
struct symtab_and_line
get_current_source_symtab_and_line (void)
{
@@ -245,7 +236,7 @@ get_current_source_symtab_and_line (void)
cursal.line = loc->line ();
cursal.pc = 0;
cursal.end = 0;
-
+
return cursal;
}
@@ -256,12 +247,12 @@ get_current_source_symtab_and_line (void)
process of determining a new default may call the caller!
Use get_current_source_symtab_and_line only to get whatever
we have without erroring out or trying to get a default. */
-
+
void
set_default_source_symtab_and_line (void)
{
if (!have_full_symbols () && !have_partial_symbols ())
- error (_("No symbol table is loaded. Use the \"file\" command."));
+ error (_ ("No symbol table is loaded. Use the \"file\" command."));
/* Pull in a current source symtab if necessary. */
current_source_location *loc = get_source_location (current_program_space);
@@ -273,7 +264,7 @@ set_default_source_symtab_and_line (void)
(the returned sal pc and end fields are not valid.)
and set the current default to whatever is in SAL.
NOTE: The returned sal pc and end fields are not valid. */
-
+
struct symtab_and_line
set_current_source_symtab_and_line (const symtab_and_line &sal)
{
@@ -350,8 +341,9 @@ select_source_symtab (struct symtab *s)
const char *name = symtab->filename;
int len = strlen (name);
- if (!(len > 2 && (strcmp (&name[len - 2], ".h") == 0
- || strcmp (name, "<<C++-namespaces>>") == 0)))
+ if (!(len > 2
+ && (strcmp (&name[len - 2], ".h") == 0
+ || strcmp (name, "<<C++-namespaces>>") == 0)))
new_symtab = symtab;
}
}
@@ -369,20 +361,20 @@ select_source_symtab (struct symtab *s)
}
if (new_symtab != nullptr)
{
- loc->set (new_symtab,1);
+ loc->set (new_symtab, 1);
return;
}
- error (_("Can't find a default source file"));
+ error (_ ("Can't find a default source file"));
}
-
+
/* Handler for "set directories path-list" command.
"set dir mumble" doesn't prepend paths, it resets the entire
path list. The theory is that set(show(dir)) should be a no-op. */
static void
-set_directories_command (const char *args,
- int from_tty, struct cmd_list_element *c)
+set_directories_command (const char *args, int from_tty,
+ struct cmd_list_element *c)
{
/* This is the value that was set.
It needs to be processed to maintain $cdir:$cwd and remove dups. */
@@ -470,7 +462,7 @@ directory_command (const char *dirname, int from_tty)
/* FIXME, this goes to "delete dir"... */
if (dirname == 0)
{
- if (!from_tty || query (_("Reinitialize source path to empty? ")))
+ if (!from_tty || query (_ ("Reinitialize source path to empty? ")))
{
init_source_path ();
value_changed = true;
@@ -548,13 +540,12 @@ add_path (const char *dirname, char **which_path, int parse_separators)
P is the '\0' following the end. */
p = name_up.get () + strlen (name);
- while (!(IS_DIR_SEPARATOR (*name) && p <= name + 1) /* "/" */
+ while (!(IS_DIR_SEPARATOR (*name) && p <= name + 1) /* "/" */
#ifdef HAVE_DOS_BASED_FILE_SYSTEM
- /* On MS-DOS and MS-Windows, h:\ is different from h: */
- && !(p == name + 3 && name[1] == ':') /* "d:/" */
+ /* On MS-DOS and MS-Windows, h:\ is different from h: */
+ && !(p == name + 3 && name[1] == ':') /* "d:/" */
#endif
- && p > name
- && IS_DIR_SEPARATOR (p[-1]))
+ && p > name && IS_DIR_SEPARATOR (p[-1]))
/* Sigh. "foo/" => "foo" */
--p;
*p = '\0';
@@ -588,7 +579,7 @@ add_path (const char *dirname, char **which_path, int parse_separators)
}
if (name[0] == '\0')
- goto skip_dup;
+ goto skip_dup;
if (name[0] == '~')
new_name_holder
= gdb::unique_xmalloc_ptr<char[]> (tilde_expand (name)).get ();
@@ -623,7 +614,7 @@ add_path (const char *dirname, char **which_path, int parse_separators)
print_sys_errmsg (name, save_errno);
}
else if ((st.st_mode & S_IFMT) != S_IFDIR)
- warning (_("%s is not a directory."), name);
+ warning (_ ("%s is not a directory."), name);
}
append:
@@ -670,21 +661,20 @@ add_path (const char *dirname, char **which_path, int parse_separators)
if (prefix)
{
std::string temp = std::string (old, prefix) + tinybuf + name;
- *which_path = concat (temp.c_str (), &old[prefix],
- (char *) nullptr);
+ *which_path
+ = concat (temp.c_str (), &old[prefix], (char *) nullptr);
prefix = temp.length ();
}
else
{
- *which_path = concat (name, (old[0] ? tinybuf : old),
- old, (char *)NULL);
+ *which_path
+ = concat (name, (old[0] ? tinybuf : old), old, (char *) NULL);
prefix = strlen (name);
}
xfree (old);
old = *which_path;
}
- skip_dup:
- ;
+ skip_dup:;
}
}
@@ -703,40 +693,38 @@ add_path (const char *dirname, std::string &which_path, int parse_separators)
static void
info_source_command (const char *ignore, int from_tty)
{
- current_source_location *loc
- = get_source_location (current_program_space);
+ current_source_location *loc = get_source_location (current_program_space);
struct symtab *s = loc->symtab ();
struct compunit_symtab *cust;
if (!s)
{
- gdb_printf (_("No current source file.\n"));
+ gdb_printf (_ ("No current source file.\n"));
return;
}
cust = s->compunit ();
- gdb_printf (_("Current source file is %s\n"), s->filename);
+ gdb_printf (_ ("Current source file is %s\n"), s->filename);
if (s->compunit ()->dirname () != NULL)
- gdb_printf (_("Compilation directory is %s\n"), s->compunit ()->dirname ());
+ gdb_printf (_ ("Compilation directory is %s\n"),
+ s->compunit ()->dirname ());
if (s->fullname)
- gdb_printf (_("Located in %s\n"), s->fullname);
+ gdb_printf (_ ("Located in %s\n"), s->fullname);
const std::vector<off_t> *offsets;
if (g_source_cache.get_line_charpos (s, &offsets))
- gdb_printf (_("Contains %d line%s.\n"), (int) offsets->size (),
+ gdb_printf (_ ("Contains %d line%s.\n"), (int) offsets->size (),
offsets->size () == 1 ? "" : "s");
- gdb_printf (_("Source language is %s.\n"),
- language_str (s->language ()));
- gdb_printf (_("Producer is %s.\n"),
- (cust->producer ()) != nullptr
- ? cust->producer () : _("unknown"));
- gdb_printf (_("Compiled with %s debugging format.\n"),
+ gdb_printf (_ ("Source language is %s.\n"), language_str (s->language ()));
+ gdb_printf (_ ("Producer is %s.\n"), (cust->producer ()) != nullptr
+ ? cust->producer ()
+ : _ ("unknown"));
+ gdb_printf (_ ("Compiled with %s debugging format.\n"),
cust->debugformat ());
- gdb_printf (_("%s preprocessor macro info.\n"),
- (cust->macro_table () != nullptr
- ? "Includes" : "Does not include"));
+ gdb_printf (_ ("%s preprocessor macro info.\n"),
+ (cust->macro_table () != nullptr ? "Includes"
+ : "Does not include"));
}
-
/* Helper function to remove characters from the start of PATH so that
PATH can then be appended to a directory name. We remove leading drive
@@ -756,7 +744,7 @@ prepare_path_for_appending (const char *path)
old_path = path;
/* /foo => foo, to avoid multiple slashes that Emacs doesn't like. */
- while (IS_DIR_SEPARATOR(path[0]))
+ while (IS_DIR_SEPARATOR (path[0]))
path++;
/* ./foo => foo */
@@ -802,8 +790,8 @@ prepare_path_for_appending (const char *path)
/* >>>> This should only allow files of certain types,
>>>> eg executable, non-directory. */
int
-openp (const char *path, openp_flags opts, const char *string,
- int mode, gdb::unique_xmalloc_ptr<char> *filename_opened)
+openp (const char *path, openp_flags opts, const char *string, int mode,
+ gdb::unique_xmalloc_ptr<char> *filename_opened)
{
int fd;
char *filename;
@@ -893,9 +881,9 @@ openp (const char *path, openp_flags opts, const char *string,
}
strcpy (filename, current_directory);
}
- else if (strchr(dir, '~'))
+ else if (strchr (dir, '~'))
{
- /* See whether we need to expand the tilde. */
+ /* See whether we need to expand the tilde. */
int newlen;
gdb::unique_xmalloc_ptr<char> tilde_expanded (tilde_expand (dir));
@@ -961,7 +949,6 @@ done:
return fd;
}
-
/* This is essentially a convenience, for clients that want the behaviour
of openp, using source_path, but that really don't want the file to be
opened but want instead just to know what the full pathname is (as
@@ -1050,15 +1037,14 @@ rewrite_source_path (const char *path)
/* Compute the rewritten path and return it. */
- return (gdb::unique_xmalloc_ptr<char>
- (concat (rule->to.c_str (), path + rule->from.length (), nullptr)));
+ return (gdb::unique_xmalloc_ptr<char> (
+ concat (rule->to.c_str (), path + rule->from.length (), nullptr)));
}
/* See source.h. */
scoped_fd
-find_and_open_source (const char *filename,
- const char *dirname,
+find_and_open_source (const char *filename, const char *dirname,
gdb::unique_xmalloc_ptr<char> *fullname)
{
const char *path = source_path.c_str ();
@@ -1105,9 +1091,9 @@ find_and_open_source (const char *filename,
if (rewritten_dirname != NULL)
dirname = rewritten_dirname.get ();
- /* Replace a path entry of $cdir with the compilation directory
+ /* Replace a path entry of $cdir with the compilation directory
name. */
-#define cdir_len 5
+#define cdir_len 5
p = strstr (source_path.c_str (), "$cdir");
if (p && (p == path || p[-1] == DIRNAME_SEPARATOR)
&& (p[cdir_len] == DIRNAME_SEPARATOR || p[cdir_len] == '\0'))
@@ -1200,10 +1186,8 @@ open_source_file (struct symtab *s)
/* Query debuginfod for the source file. */
if (build_id != nullptr && !srcpath.empty ())
- fd = debuginfod_source_query (build_id->data,
- build_id->size,
- srcpath.c_str (),
- &fullname);
+ fd = debuginfod_source_query (build_id->data, build_id->size,
+ srcpath.c_str (), &fullname);
}
}
@@ -1227,8 +1211,8 @@ find_source_or_rewrite (const char *filename, const char *dirname)
if (dirname == nullptr || IS_ABSOLUTE_PATH (filename))
fullname.reset (xstrdup (filename));
else
- fullname.reset (concat (dirname, SLASH_STRING,
- filename, (char *) nullptr));
+ fullname.reset (concat (dirname, SLASH_STRING, filename,
+ (char *) nullptr));
gdb::unique_xmalloc_ptr<char> rewritten
= rewrite_source_path (fullname.get ());
@@ -1276,7 +1260,7 @@ symtab_to_fullname (struct symtab *s)
if (s->fullname == NULL)
s->fullname = fullname.release ();
}
- }
+ }
return s->fullname;
}
@@ -1293,11 +1277,9 @@ symtab_to_filename_for_display (struct symtab *symtab)
else if (filename_display_string == filename_display_relative)
return symtab->filename;
else
- internal_error (_("invalid filename_display_string"));
+ internal_error (_ ("invalid filename_display_string"));
}
-
-
/* Print source lines from the file of symtab S,
starting with line number LINE and stopping before line number STOPLINE. */
@@ -1310,8 +1292,7 @@ print_source_lines_base (struct symtab *s, int line, int stopline,
struct ui_out *uiout = current_uiout;
/* Regardless of whether we can open the file, set current_source_symtab. */
- current_source_location *loc
- = get_source_location (current_program_space);
+ current_source_location *loc = get_source_location (current_program_space);
loc->set (s, line);
first_line_listed = line;
@@ -1398,8 +1379,8 @@ print_source_lines_base (struct symtab *s, int line, int stopline,
{
const std::vector<off_t> *offsets = nullptr;
g_source_cache.get_line_charpos (s, &offsets);
- error (_("Line number %d out of range; %s has %d lines."),
- line, symtab_to_filename_for_display (s),
+ error (_ ("Line number %d out of range; %s has %d lines."), line,
+ symtab_to_filename_for_display (s),
offsets == nullptr ? 0 : (int) offsets->size ());
}
@@ -1473,7 +1454,6 @@ print_source_lines_base (struct symtab *s, int line, int stopline,
loc->set (loc->symtab (), new_lineno);
}
-
/* See source.h. */
@@ -1490,12 +1470,10 @@ void
print_source_lines (struct symtab *s, source_lines_range line_range,
print_source_lines_flags flags)
{
- print_source_lines_base (s, line_range.startline (),
- line_range.stopline (), flags);
+ print_source_lines_base (s, line_range.startline (), line_range.stopline (),
+ flags);
}
-
-
/* Print info on range of pc's in a specified line. */
static void
@@ -1522,8 +1500,8 @@ info_line_command (const char *arg, int from_tty)
}
else
{
- decoded_sals = decode_line_with_last_displayed (arg,
- DECODE_LINE_LIST_MODE);
+ decoded_sals
+ = decode_line_with_last_displayed (arg, DECODE_LINE_LIST_MODE);
sals = decoded_sals;
dont_repeat ();
@@ -1540,7 +1518,7 @@ info_line_command (const char *arg, int from_tty)
{
struct gdbarch *gdbarch = get_current_arch ();
- gdb_printf (_("No line number information available"));
+ gdb_printf (_ ("No line number information available"));
if (sal.pc != 0)
{
/* This is useful for "info line *0x7f34". If we can't tell the
@@ -1554,15 +1532,13 @@ info_line_command (const char *arg, int from_tty)
gdb_printf (".");
gdb_printf ("\n");
}
- else if (sal.line > 0
- && find_line_pc_range (sal, &start_pc, &end_pc))
+ else if (sal.line > 0 && find_line_pc_range (sal, &start_pc, &end_pc))
{
gdbarch *gdbarch = sal.symtab->compunit ()->objfile ()->arch ();
if (start_pc == end_pc)
{
- gdb_printf ("Line %d of \"%s\"",
- sal.line,
+ gdb_printf ("Line %d of \"%s\"", sal.line,
symtab_to_filename_for_display (sal.symtab));
gdb_stdout->wrap_here (2);
gdb_printf (" is at address ");
@@ -1572,8 +1548,7 @@ info_line_command (const char *arg, int from_tty)
}
else
{
- gdb_printf ("Line %d of \"%s\"",
- sal.line,
+ gdb_printf ("Line %d of \"%s\"", sal.line,
symtab_to_filename_for_display (sal.symtab));
gdb_stdout->wrap_here (2);
gdb_printf (" starts at address ");
@@ -1599,11 +1574,11 @@ info_line_command (const char *arg, int from_tty)
/* Is there any case in which we get here, and have an address
which the user would want to see? If we have debugging symbols
and no line numbers? */
- gdb_printf (_("Line number %d is out of range for \"%s\".\n"),
+ gdb_printf (_ ("Line number %d is out of range for \"%s\".\n"),
sal.line, symtab_to_filename_for_display (sal.symtab));
}
}
-
+
/* Commands to search the source file for a regexp. */
/* Helper for forward_search_command/reverse_search_command. FORWARD
@@ -1617,27 +1592,23 @@ search_command_helper (const char *regex, int from_tty, bool forward)
if (msg)
error (("%s"), msg);
- current_source_location *loc
- = get_source_location (current_program_space);
+ current_source_location *loc = get_source_location (current_program_space);
if (loc->symtab () == nullptr)
select_source_symtab (0);
if (!source_open)
- error (_("source code access disabled"));
+ error (_ ("source code access disabled"));
scoped_fd desc (open_source_file (loc->symtab ()));
if (desc.get () < 0)
perror_with_name (symtab_to_filename_for_display (loc->symtab ()));
- int line = (forward
- ? last_line_listed + 1
- : last_line_listed - 1);
+ int line = (forward ? last_line_listed + 1 : last_line_listed - 1);
const std::vector<off_t> *offsets;
- if (line < 1
- || !g_source_cache.get_line_charpos (loc->symtab (), &offsets)
+ if (line < 1 || !g_source_cache.get_line_charpos (loc->symtab (), &offsets)
|| line > offsets->size ())
- error (_("Expression not found"));
+ error (_ ("Expression not found"));
if (lseek (desc.get (), (*offsets)[line - 1], 0) < 0)
perror_with_name (symtab_to_filename_for_display (loc->symtab ()));
@@ -1697,7 +1668,7 @@ search_command_helper (const char *regex, int from_tty, bool forward)
}
}
- gdb_printf (_("Expression not found\n"));
+ gdb_printf (_ ("Expression not found\n"));
}
static void
@@ -1720,7 +1691,7 @@ strip_trailing_directory_separator (char *path)
const int last = strlen (path) - 1;
if (last < 0)
- return; /* No stripping is needed if PATH is the empty string. */
+ return; /* No stripping is needed if PATH is the empty string. */
if (IS_DIR_SEPARATOR (path[last]))
path[last] = '\0';
@@ -1741,13 +1712,13 @@ static void
show_substitute_path_command (const char *args, int from_tty)
{
char *from = NULL;
-
+
gdb_argv argv (args);
/* We expect zero or one argument. */
if (argv != NULL && argv[0] != NULL && argv[1] != NULL)
- error (_("Too many arguments in command"));
+ error (_ ("Too many arguments in command"));
if (argv != NULL && argv[0] != NULL)
from = argv[0];
@@ -1755,16 +1726,14 @@ show_substitute_path_command (const char *args, int from_tty)
/* Print the substitution rules. */
if (from != NULL)
- gdb_printf
- (_("Source path substitution rule matching `%s':\n"), from);
+ gdb_printf (_ ("Source path substitution rule matching `%s':\n"), from);
else
- gdb_printf (_("List of all source path substitution rules:\n"));
+ gdb_printf (_ ("List of all source path substitution rules:\n"));
for (substitute_path_rule &rule : substitute_path_rules)
{
if (from == NULL || substitute_path_rule_matches (&rule, from) != 0)
- gdb_printf (" `%s' -> `%s'.\n", rule.from.c_str (),
- rule.to.c_str ());
+ gdb_printf (" `%s' -> `%s'.\n", rule.from.c_str (), rule.to.c_str ());
}
}
@@ -1779,7 +1748,7 @@ unset_substitute_path_command (const char *args, int from_tty)
/* This function takes either 0 or 1 argument. */
if (argv != NULL && argv[0] != NULL && argv[1] != NULL)
- error (_("Incorrect usage, too many arguments in command"));
+ error (_ ("Incorrect usage, too many arguments in command"));
if (argv != NULL && argv[0] != NULL)
from = argv[0];
@@ -1789,8 +1758,8 @@ unset_substitute_path_command (const char *args, int from_tty)
is performed. */
if (from == NULL
- && !query (_("Delete all source path substitution rules? ")))
- error (_("Canceled"));
+ && !query (_ ("Delete all source path substitution rules? ")))
+ error (_ ("Canceled"));
/* Delete the rule matching the argument. No argument means that
all rules should be deleted. */
@@ -1799,14 +1768,11 @@ unset_substitute_path_command (const char *args, int from_tty)
substitute_path_rules.clear ();
else
{
- auto iter
- = std::remove_if (substitute_path_rules.begin (),
- substitute_path_rules.end (),
- [&] (const substitute_path_rule &rule)
- {
- return FILENAME_CMP (from,
- rule.from.c_str ()) == 0;
- });
+ auto iter = std::remove_if (substitute_path_rules.begin (),
+ substitute_path_rules.end (),
+ [&] (const substitute_path_rule &rule) {
+ return FILENAME_CMP (from, rule.from.c_str ()) == 0;
+ });
bool rule_found = iter != substitute_path_rules.end ();
substitute_path_rules.erase (iter, substitute_path_rules.end ());
@@ -1814,7 +1780,7 @@ unset_substitute_path_command (const char *args, int from_tty)
we could not find it, then report an error. */
if (!rule_found)
- error (_("No substitution rule defined for `%s'"), from);
+ error (_ ("No substitution rule defined for `%s'"), from);
}
forget_cached_source_info ();
@@ -1827,14 +1793,14 @@ set_substitute_path_command (const char *args, int from_tty)
{
gdb_argv argv (args);
- if (argv == NULL || argv[0] == NULL || argv [1] == NULL)
- error (_("Incorrect usage, too few arguments in command"));
+ if (argv == NULL || argv[0] == NULL || argv[1] == NULL)
+ error (_ ("Incorrect usage, too few arguments in command"));
if (argv[2] != NULL)
- error (_("Incorrect usage, too many arguments in command"));
+ error (_ ("Incorrect usage, too many arguments in command"));
if (*(argv[0]) == '\0')
- error (_("First argument must be at least one character long"));
+ error (_ ("First argument must be at least one character long"));
/* Strip any trailing directory separator character in either FROM
or TO. The substitution rule already implicitly contains them. */
@@ -1844,13 +1810,11 @@ set_substitute_path_command (const char *args, int from_tty)
/* If a rule with the same "from" was previously defined, then
delete it. This new rule replaces it. */
- auto iter
- = std::remove_if (substitute_path_rules.begin (),
- substitute_path_rules.end (),
- [&] (const substitute_path_rule &rule)
- {
- return FILENAME_CMP (argv[0], rule.from.c_str ()) == 0;
- });
+ auto iter = std::remove_if (substitute_path_rules.begin (),
+ substitute_path_rules.end (),
+ [&] (const substitute_path_rule &rule) {
+ return FILENAME_CMP (argv[0], rule.from.c_str ()) == 0;
+ });
substitute_path_rules.erase (iter, substitute_path_rules.end ());
/* Insert the new substitution rule. */
@@ -1866,22 +1830,22 @@ source_lines_range::source_lines_range (int startline,
{
if (dir == source_lines_range::FORWARD)
{
- LONGEST end = static_cast <LONGEST> (startline) + get_lines_to_list ();
+ LONGEST end = static_cast<LONGEST> (startline) + get_lines_to_list ();
if (end > INT_MAX)
end = INT_MAX;
m_startline = startline;
- m_stopline = static_cast <int> (end);
+ m_stopline = static_cast<int> (end);
}
else
{
- LONGEST start = static_cast <LONGEST> (startline) - get_lines_to_list ();
+ LONGEST start = static_cast<LONGEST> (startline) - get_lines_to_list ();
if (start < 1)
start = 1;
- m_startline = static_cast <int> (start);
+ m_startline = static_cast<int> (start);
m_stopline = startline;
}
}
@@ -1902,8 +1866,8 @@ show_source (const char *args, int from_tty)
help_list (showsourcelist, "show source ", all_commands, gdb_stdout);
}
-
void _initialize_source ();
+
void
_initialize_source ()
{
@@ -1916,7 +1880,7 @@ _initialize_source ()
re_set_syntax (RE_SYNTAX_GREP);
cmd_list_element *directory_cmd
- = add_cmd ("directory", class_files, directory_command, _("\
+ = add_cmd ("directory", class_files, directory_command, _ ("\
Add directory DIR to beginning of search path for source files.\n\
Forget cached info on source file locations and line positions.\n\
DIR can also be $cwd for the current working directory, or $cdir for the\n\
@@ -1926,27 +1890,25 @@ With no argument, reset the search path to $cdir:$cwd, the default."),
set_cmd_completer (directory_cmd, filename_completer);
- add_setshow_optional_filename_cmd ("directories",
- class_files,
- &source_path,
- _("\
+ add_setshow_optional_filename_cmd ("directories", class_files, &source_path,
+ _ ("\
Set the search path for finding source files."),
- _("\
+ _ ("\
Show the search path for finding source files."),
- _("\
+ _ ("\
$cwd in the path means the current working directory.\n\
$cdir in the path means the compilation directory of the source file.\n\
GDB ensures the search path always ends with $cdir:$cwd by\n\
appending these directories if necessary.\n\
Setting the value to an empty string sets it to $cdir:$cwd, the default."),
- set_directories_command,
- show_directories_command,
- &setlist, &showlist);
+ set_directories_command,
+ show_directories_command, &setlist,
+ &showlist);
add_info ("source", info_source_command,
- _("Information about the current source file."));
+ _ ("Information about the current source file."));
- add_info ("line", info_line_command, _("\
+ add_info ("line", info_line_command, _ ("\
Core addresses of the code for a source line.\n\
Line can be specified as\n\
LINENUM, to list around that line in current file,\n\
@@ -1959,30 +1921,29 @@ so that \"x/i\" suffices to start examining the machine code.\n\
The address is also stored as the value of \"$_\"."));
cmd_list_element *forward_search_cmd
- = add_com ("forward-search", class_files, forward_search_command, _("\
+ = add_com ("forward-search", class_files, forward_search_command, _ ("\
Search for regular expression (see regex(3)) from last line listed.\n\
The matching line number is also stored as the value of \"$_\"."));
add_com_alias ("search", forward_search_cmd, class_files, 0);
add_com_alias ("fo", forward_search_cmd, class_files, 1);
cmd_list_element *reverse_search_cmd
- = add_com ("reverse-search", class_files, reverse_search_command, _("\
+ = add_com ("reverse-search", class_files, reverse_search_command, _ ("\
Search backward for regular expression (see regex(3)) from last line listed.\n\
The matching line number is also stored as the value of \"$_\"."));
add_com_alias ("rev", reverse_search_cmd, class_files, 1);
- add_setshow_integer_cmd ("listsize", class_support, &lines_to_list, _("\
-Set number of source lines gdb will list by default."), _("\
-Show number of source lines gdb will list by default."), _("\
+ add_setshow_integer_cmd ("listsize", class_support, &lines_to_list, _ ("\
+Set number of source lines gdb will list by default."),
+ _ ("\
+Show number of source lines gdb will list by default."),
+ _ ("\
Use this to choose how many source lines the \"list\" displays (unless\n\
the \"list\" argument explicitly specifies some other number).\n\
A value of \"unlimited\", or zero, means there's no limit."),
- NULL,
- show_lines_to_list,
- &setlist, &showlist);
+ NULL, show_lines_to_list, &setlist, &showlist);
- add_cmd ("substitute-path", class_files, set_substitute_path_command,
- _("\
+ add_cmd ("substitute-path", class_files, set_substitute_path_command, _ ("\
Add a substitution rule to rewrite the source directories.\n\
Usage: set substitute-path FROM TO\n\
The rule is applied only if the directory name starts with FROM\n\
@@ -1991,8 +1952,7 @@ If a substitution rule was previously set for FROM, the old rule\n\
is replaced by the new one."),
&setlist);
- add_cmd ("substitute-path", class_files, unset_substitute_path_command,
- _("\
+ add_cmd ("substitute-path", class_files, unset_substitute_path_command, _ ("\
Delete one or all substitution rules rewriting the source directories.\n\
Usage: unset substitute-path [FROM]\n\
Delete the rule for substituting FROM in source directories. If FROM\n\
@@ -2000,8 +1960,7 @@ is not specified, all substituting rules are deleted.\n\
If the debugger cannot find a rule for FROM, it will display a warning."),
&unsetlist);
- add_cmd ("substitute-path", class_files, show_substitute_path_command,
- _("\
+ add_cmd ("substitute-path", class_files, show_substitute_path_command, _ ("\
Show one or all substitution rules rewriting the source directories.\n\
Usage: show substitute-path [FROM]\n\
Print the rule for substituting FROM in source directories. If FROM\n\
@@ -2009,30 +1968,33 @@ is not specified, print all substitution rules."),
&showlist);
add_setshow_enum_cmd ("filename-display", class_files,
- filename_display_kind_names,
- &filename_display_string, _("\
-Set how to display filenames."), _("\
-Show how to display filenames."), _("\
+ filename_display_kind_names, &filename_display_string,
+ _ ("\
+Set how to display filenames."),
+ _ ("\
+Show how to display filenames."),
+ _ ("\
filename-display can be:\n\
basename - display only basename of a filename\n\
relative - display a filename relative to the compilation directory\n\
absolute - display an absolute filename\n\
By default, relative filenames are displayed."),
- NULL,
- show_filename_display_string,
- &setlist, &showlist);
+ NULL, show_filename_display_string, &setlist,
+ &showlist);
add_prefix_cmd ("source", no_class, set_source,
- _("Generic command for setting how sources are handled."),
- &setsourcelist, 0, &setlist);
+ _ ("Generic command for setting how sources are handled."),
+ &setsourcelist, 0, &setlist);
add_prefix_cmd ("source", no_class, show_source,
- _("Generic command for showing source settings."),
- &showsourcelist, 0, &showlist);
-
- add_setshow_boolean_cmd ("open", class_files, &source_open, _("\
-Set whether GDB should open source files."), _("\
-Show whether GDB should open source files."), _("\
+ _ ("Generic command for showing source settings."),
+ &showsourcelist, 0, &showlist);
+
+ add_setshow_boolean_cmd ("open", class_files, &source_open, _ ("\
+Set whether GDB should open source files."),
+ _ ("\
+Show whether GDB should open source files."),
+ _ ("\
When this option is on GDB will open source files and display the\n\
contents when appropriate, for example, when GDB stops, or the list\n\
command is used.\n\
@@ -2040,7 +2002,6 @@ When this option is off GDB will not try to open source files, instead\n\
GDB will print the file and line number that would have been displayed.\n\
This can be useful if access to source code files is slow, for example\n\
due to the source being located over a slow network connection."),
- NULL,
- show_source_open,
- &setsourcelist, &showsourcelist);
+ NULL, show_source_open, &setsourcelist,
+ &showsourcelist);
}
diff --git a/gdb/source.h b/gdb/source.h
index 61d1bcd883b..7e4718793d8 100644
--- a/gdb/source.h
+++ b/gdb/source.h
@@ -32,7 +32,7 @@ enum openp_flag
OPF_RETURN_REALPATH = 0x04,
};
-DEF_ENUM_FLAGS_TYPE(openp_flag, openp_flags);
+DEF_ENUM_FLAGS_TYPE (openp_flag, openp_flags);
extern int openp (const char *, openp_flags, const char *, int,
gdb::unique_xmalloc_ptr<char> *);
@@ -69,16 +69,16 @@ extern void init_source_path (void);
On Failure
An invalid file descriptor is returned (the return value is negative).
FULLNAME is set to NULL. */
-extern scoped_fd find_and_open_source (const char *filename,
- const char *dirname,
- gdb::unique_xmalloc_ptr<char> *fullname);
+extern scoped_fd
+find_and_open_source (const char *filename, const char *dirname,
+ gdb::unique_xmalloc_ptr<char> *fullname);
/* A wrapper for find_and_open_source that returns the full name. If
the full name cannot be found, a full name is constructed based on
the parameters, passing them through rewrite_source_path. */
-extern gdb::unique_xmalloc_ptr<char> find_source_or_rewrite
- (const char *filename, const char *dirname);
+extern gdb::unique_xmalloc_ptr<char>
+find_source_or_rewrite (const char *filename, const char *dirname);
/* Open a source file given a symtab S. Returns a file descriptor or
negative number for error. */
@@ -121,8 +121,8 @@ extern void set_default_source_symtab_and_line (void);
(the returned sal pc and end fields are not valid.)
and set the current default to whatever is in SAL.
NOTE: The returned sal pc and end fields are not valid. */
-extern symtab_and_line set_current_source_symtab_and_line
- (const symtab_and_line &sal);
+extern symtab_and_line
+set_current_source_symtab_and_line (const symtab_and_line &sal);
/* Reset any information stored about a default file and line to print. */
extern void clear_current_source_symtab_and_line (void);
@@ -132,13 +132,14 @@ extern void add_substitute_path_rule (const char *, const char *);
/* Flags passed as 4th argument to print_source_lines. */
enum print_source_lines_flag
- {
- /* Do not print an error message. */
- PRINT_SOURCE_LINES_NOERROR = (1 << 0),
+{
+ /* Do not print an error message. */
+ PRINT_SOURCE_LINES_NOERROR = (1 << 0),
+
+ /* Print the filename in front of the source lines. */
+ PRINT_SOURCE_LINES_FILENAME = (1 << 1)
+};
- /* Print the filename in front of the source lines. */
- PRINT_SOURCE_LINES_FILENAME = (1 << 1)
- };
DEF_ENUM_FLAGS_TYPE (enum print_source_lines_flag, print_source_lines_flags);
/* Show source lines from the file of symtab S, starting with line
@@ -155,12 +156,13 @@ extern void print_source_lines (struct symtab *s, int line, int stopline,
class source_lines_range
{
public:
+
/* When constructing the range from a single line number, does the line
range extend forward, or backward. */
enum direction
{
- FORWARD,
- BACKWARD
+ FORWARD,
+ BACKWARD
};
/* Construct a SOURCE_LINES_RANGE starting at STARTLINE and extending in
@@ -174,15 +176,14 @@ public:
explicit source_lines_range (int startline, int stopline)
: m_startline (startline),
m_stopline (stopline)
- { /* Nothing. */ }
+ { /* Nothing. */
+ }
/* Return the line to start listing from. */
- int startline () const
- { return m_startline; }
+ int startline () const { return m_startline; }
/* Return the line after the last line that should be listed. */
- int stopline () const
- { return m_stopline; }
+ int stopline () const { return m_stopline; }
private:
diff --git a/gdb/sparc-linux-nat.c b/gdb/sparc-linux-nat.c
index 66a9aea4cca..c0c563495f5 100644
--- a/gdb/sparc-linux-nat.c
+++ b/gdb/sparc-linux-nat.c
@@ -31,12 +31,17 @@
class sparc_linux_nat_target final : public linux_nat_target
{
public:
+
/* Add our register access methods. */
void fetch_registers (struct regcache *regcache, int regnum) override
- { sparc_fetch_inferior_registers (this, regcache, regnum); }
+ {
+ sparc_fetch_inferior_registers (this, regcache, regnum);
+ }
void store_registers (struct regcache *regcache, int regnum) override
- { sparc_store_inferior_registers (this, regcache, regnum); }
+ {
+ sparc_store_inferior_registers (this, regcache, regnum);
+ }
};
static sparc_linux_nat_target the_sparc_linux_nat_target;
@@ -60,13 +65,14 @@ fill_gregset (const struct regcache *regcache, prgregset_t *gregs, int regnum)
}
void
-fill_fpregset (const struct regcache *regcache,
- prfpregset_t *fpregs, int regnum)
+fill_fpregset (const struct regcache *regcache, prfpregset_t *fpregs,
+ int regnum)
{
sparc32_collect_fpregset (sparc_fpregmap, regcache, regnum, fpregs);
}
void _initialize_sparc_linux_nat ();
+
void
_initialize_sparc_linux_nat ()
{
diff --git a/gdb/sparc-linux-tdep.c b/gdb/sparc-linux-tdep.c
index 5f9d3cb0246..f3fe1b0fc7c 100644
--- a/gdb/sparc-linux-tdep.c
+++ b/gdb/sparc-linux-tdep.c
@@ -63,32 +63,24 @@ static void sparc32_linux_sigframe_init (const struct tramp_frame *self,
the effect is to call the system call sigreturn. This is unlikely
to occur anywhere other than a signal trampoline. */
-static const struct tramp_frame sparc32_linux_sigframe =
-{
- SIGTRAMP_FRAME,
- 4,
- {
- { 0x821020d8, ULONGEST_MAX }, /* mov __NR_sigreturn, %g1 */
- { 0x91d02010, ULONGEST_MAX }, /* ta 0x10 */
- { TRAMP_SENTINEL_INSN, ULONGEST_MAX }
- },
- sparc32_linux_sigframe_init
-};
+static const struct tramp_frame sparc32_linux_sigframe
+ = { SIGTRAMP_FRAME,
+ 4,
+ { { 0x821020d8, ULONGEST_MAX }, /* mov __NR_sigreturn, %g1 */
+ { 0x91d02010, ULONGEST_MAX }, /* ta 0x10 */
+ { TRAMP_SENTINEL_INSN, ULONGEST_MAX } },
+ sparc32_linux_sigframe_init };
/* The instruction sequence for RT signals is slightly different. The
effect is to call the system call rt_sigreturn. */
-static const struct tramp_frame sparc32_linux_rt_sigframe =
-{
- SIGTRAMP_FRAME,
- 4,
- {
- { 0x82102065, ULONGEST_MAX }, /* mov __NR_rt_sigreturn, %g1 */
- { 0x91d02010, ULONGEST_MAX }, /* ta 0x10 */
- { TRAMP_SENTINEL_INSN, ULONGEST_MAX }
- },
- sparc32_linux_sigframe_init
-};
+static const struct tramp_frame sparc32_linux_rt_sigframe
+ = { SIGTRAMP_FRAME,
+ 4,
+ { { 0x82102065, ULONGEST_MAX }, /* mov __NR_rt_sigreturn, %g1 */
+ { 0x91d02010, ULONGEST_MAX }, /* ta 0x10 */
+ { TRAMP_SENTINEL_INSN, ULONGEST_MAX } },
+ sparc32_linux_sigframe_init };
/* This enum represents the signals' numbers on the SPARC
architecture. It just contains the signal definitions which are
@@ -98,22 +90,22 @@ static const struct tramp_frame sparc32_linux_rt_sigframe =
from the Linux kernel tree. */
enum
- {
- SPARC_LINUX_SIGEMT = 7,
- SPARC_LINUX_SIGBUS = 10,
- SPARC_LINUX_SIGSYS = 12,
- SPARC_LINUX_SIGURG = 16,
- SPARC_LINUX_SIGSTOP = 17,
- SPARC_LINUX_SIGTSTP = 18,
- SPARC_LINUX_SIGCONT = 19,
- SPARC_LINUX_SIGCHLD = 20,
- SPARC_LINUX_SIGIO = 23,
- SPARC_LINUX_SIGPOLL = SPARC_LINUX_SIGIO,
- SPARC_LINUX_SIGLOST = 29,
- SPARC_LINUX_SIGPWR = SPARC_LINUX_SIGLOST,
- SPARC_LINUX_SIGUSR1 = 30,
- SPARC_LINUX_SIGUSR2 = 31,
- };
+{
+ SPARC_LINUX_SIGEMT = 7,
+ SPARC_LINUX_SIGBUS = 10,
+ SPARC_LINUX_SIGSYS = 12,
+ SPARC_LINUX_SIGURG = 16,
+ SPARC_LINUX_SIGSTOP = 17,
+ SPARC_LINUX_SIGTSTP = 18,
+ SPARC_LINUX_SIGCONT = 19,
+ SPARC_LINUX_SIGCHLD = 20,
+ SPARC_LINUX_SIGIO = 23,
+ SPARC_LINUX_SIGPOLL = SPARC_LINUX_SIGIO,
+ SPARC_LINUX_SIGLOST = 29,
+ SPARC_LINUX_SIGPWR = SPARC_LINUX_SIGLOST,
+ SPARC_LINUX_SIGUSR1 = 30,
+ SPARC_LINUX_SIGUSR2 = 31,
+};
static void
sparc32_linux_sigframe_init (const struct tramp_frame *self,
@@ -154,7 +146,7 @@ sparc32_linux_sigframe_init (const struct tramp_frame *self,
}
trad_frame_set_id (this_cache, frame_id_build (base, func));
}
-
+
/* Return the address of a system call's alternative return
address. */
@@ -196,29 +188,26 @@ sparc32_linux_step_trap (frame_info_ptr frame, unsigned long insn)
return 0;
}
-
-const struct sparc_gregmap sparc32_linux_core_gregmap =
-{
- 32 * 4, /* %psr */
- 33 * 4, /* %pc */
- 34 * 4, /* %npc */
- 35 * 4, /* %y */
- -1, /* %wim */
- -1, /* %tbr */
- 1 * 4, /* %g1 */
- 16 * 4, /* %l0 */
- 4, /* y size */
+const struct sparc_gregmap sparc32_linux_core_gregmap = {
+ 32 * 4, /* %psr */
+ 33 * 4, /* %pc */
+ 34 * 4, /* %npc */
+ 35 * 4, /* %y */
+ -1, /* %wim */
+ -1, /* %tbr */
+ 1 * 4, /* %g1 */
+ 16 * 4, /* %l0 */
+ 4, /* y size */
};
-
static void
sparc32_linux_supply_core_gregset (const struct regset *regset,
- struct regcache *regcache,
- int regnum, const void *gregs, size_t len)
+ struct regcache *regcache, int regnum,
+ const void *gregs, size_t len)
{
- sparc32_supply_gregset (&sparc32_linux_core_gregmap,
- regcache, regnum, gregs);
+ sparc32_supply_gregset (&sparc32_linux_core_gregmap, regcache, regnum,
+ gregs);
}
static void
@@ -226,14 +215,14 @@ sparc32_linux_collect_core_gregset (const struct regset *regset,
const struct regcache *regcache,
int regnum, void *gregs, size_t len)
{
- sparc32_collect_gregset (&sparc32_linux_core_gregmap,
- regcache, regnum, gregs);
+ sparc32_collect_gregset (&sparc32_linux_core_gregmap, regcache, regnum,
+ gregs);
}
static void
sparc32_linux_supply_core_fpregset (const struct regset *regset,
- struct regcache *regcache,
- int regnum, const void *fpregs, size_t len)
+ struct regcache *regcache, int regnum,
+ const void *fpregs, size_t len)
{
sparc32_supply_fpregset (&sparc32_bsd_fpregmap, regcache, regnum, fpregs);
}
@@ -248,7 +237,7 @@ sparc32_linux_collect_core_fpregset (const struct regset *regset,
/* Set the program counter for process PTID to PC. */
-#define PSR_SYSCALL 0x00004000
+#define PSR_SYSCALL 0x00004000
static void
sparc_linux_write_pc (struct regcache *regcache, CORE_ADDR pc)
@@ -274,8 +263,7 @@ sparc_linux_write_pc (struct regcache *regcache, CORE_ADDR pc)
}
static LONGEST
-sparc32_linux_get_syscall_number (struct gdbarch *gdbarch,
- thread_info *thread)
+sparc32_linux_get_syscall_number (struct gdbarch *gdbarch, thread_info *thread)
{
struct regcache *regcache = get_thread_regcache (thread);
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
@@ -298,8 +286,7 @@ sparc32_linux_get_syscall_number (struct gdbarch *gdbarch,
gdbarch.h. */
static enum gdb_signal
-sparc32_linux_gdb_signal_from_target (struct gdbarch *gdbarch,
- int signal)
+sparc32_linux_gdb_signal_from_target (struct gdbarch *gdbarch, int signal)
{
switch (signal)
{
@@ -402,21 +389,13 @@ sparc32_linux_gdb_signal_to_target (struct gdbarch *gdbarch,
return linux_gdb_signal_to_target (gdbarch, signal);
}
-
+static const struct regset sparc32_linux_gregset
+ = { NULL, sparc32_linux_supply_core_gregset,
+ sparc32_linux_collect_core_gregset };
-static const struct regset sparc32_linux_gregset =
- {
- NULL,
- sparc32_linux_supply_core_gregset,
- sparc32_linux_collect_core_gregset
- };
-
-static const struct regset sparc32_linux_fpregset =
- {
- NULL,
- sparc32_linux_supply_core_fpregset,
- sparc32_linux_collect_core_fpregset
- };
+static const struct regset sparc32_linux_fpregset
+ = { NULL, sparc32_linux_supply_core_fpregset,
+ sparc32_linux_collect_core_fpregset };
static void
sparc32_linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
@@ -436,8 +415,8 @@ sparc32_linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
/* GNU/Linux has SVR4-style shared libraries... */
set_gdbarch_skip_trampoline_code (gdbarch, find_solib_trampoline_target);
- set_solib_svr4_fetch_link_map_offsets
- (gdbarch, linux_ilp32_fetch_link_map_offsets);
+ set_solib_svr4_fetch_link_map_offsets (gdbarch,
+ linux_ilp32_fetch_link_map_offsets);
/* ...which means that we need some special handling when doing
prologue analysis. */
@@ -457,8 +436,7 @@ sparc32_linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
/* Functions for 'catch syscall'. */
set_xml_syscall_file_name (gdbarch, XML_SYSCALL_FILENAME_SPARC32);
- set_gdbarch_get_syscall_number (gdbarch,
- sparc32_linux_get_syscall_number);
+ set_gdbarch_get_syscall_number (gdbarch, sparc32_linux_get_syscall_number);
set_gdbarch_gdb_signal_from_target (gdbarch,
sparc32_linux_gdb_signal_from_target);
@@ -467,6 +445,7 @@ sparc32_linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
}
void _initialize_sparc_linux_tdep ();
+
void
_initialize_sparc_linux_tdep ()
{
diff --git a/gdb/sparc-nat.c b/gdb/sparc-nat.c
index b9f48b356d4..e85b5e9851c 100644
--- a/gdb/sparc-nat.c
+++ b/gdb/sparc-nat.c
@@ -53,7 +53,7 @@
#ifdef HAVE_STRUCT_REG
typedef struct reg gregset_t;
typedef struct fpreg fpregset_t;
-#else
+#else
typedef struct regs gregset_t;
typedef struct fp_status fpregset_t;
#endif
@@ -94,14 +94,14 @@ gdb_ptrace (PTRACE_TYPE_ARG1 request, ptid_t ptid, PTRACE_TYPE_ARG3 addr)
/* Register set description. */
const struct sparc_gregmap *sparc_gregmap;
const struct sparc_fpregmap *sparc_fpregmap;
-void (*sparc_supply_gregset) (const struct sparc_gregmap *,
- struct regcache *, int , const void *);
+void (*sparc_supply_gregset) (const struct sparc_gregmap *, struct regcache *,
+ int, const void *);
void (*sparc_collect_gregset) (const struct sparc_gregmap *,
const struct regcache *, int, void *);
void (*sparc_supply_fpregset) (const struct sparc_fpregmap *,
- struct regcache *, int , const void *);
+ struct regcache *, int, const void *);
void (*sparc_collect_fpregset) (const struct sparc_fpregmap *,
- const struct regcache *, int , void *);
+ const struct regcache *, int, void *);
int (*sparc_gregset_supplies_p) (struct gdbarch *, int);
int (*sparc_fpregset_supplies_p) (struct gdbarch *, int);
@@ -118,10 +118,8 @@ sparc32_gregset_supplies_p (struct gdbarch *gdbarch, int regnum)
return 1;
/* Control registers. */
- if (regnum == SPARC32_PC_REGNUM
- || regnum == SPARC32_NPC_REGNUM
- || regnum == SPARC32_PSR_REGNUM
- || regnum == SPARC32_Y_REGNUM)
+ if (regnum == SPARC32_PC_REGNUM || regnum == SPARC32_NPC_REGNUM
+ || regnum == SPARC32_PSR_REGNUM || regnum == SPARC32_Y_REGNUM)
return 1;
return 0;
@@ -166,7 +164,7 @@ sparc_fetch_inferior_registers (process_stratum_target *proc_target,
gregset_t regs;
if (gdb_ptrace (PTRACE_GETREGS, ptid, (PTRACE_TYPE_ARG3) &regs) == -1)
- perror_with_name (_("Couldn't get registers"));
+ perror_with_name (_ ("Couldn't get registers"));
/* Deep down, sparc_supply_rwindow reads memory, so needs the global
thread context to be set. */
@@ -182,8 +180,9 @@ sparc_fetch_inferior_registers (process_stratum_target *proc_target,
{
fpregset_t fpregs;
- if (gdb_ptrace (PTRACE_GETFPREGS, ptid, (PTRACE_TYPE_ARG3) &fpregs) == -1)
- perror_with_name (_("Couldn't get floating point status"));
+ if (gdb_ptrace (PTRACE_GETFPREGS, ptid, (PTRACE_TYPE_ARG3) &fpregs)
+ == -1)
+ perror_with_name (_ ("Couldn't get floating point status"));
sparc_supply_fpregset (sparc_fpregmap, regcache, -1, &fpregs);
}
@@ -201,12 +200,12 @@ sparc_store_inferior_registers (process_stratum_target *proc_target,
gregset_t regs;
if (gdb_ptrace (PTRACE_GETREGS, ptid, (PTRACE_TYPE_ARG3) &regs) == -1)
- perror_with_name (_("Couldn't get registers"));
+ perror_with_name (_ ("Couldn't get registers"));
sparc_collect_gregset (sparc_gregmap, regcache, regnum, &regs);
if (gdb_ptrace (PTRACE_SETREGS, ptid, (PTRACE_TYPE_ARG3) &regs) == -1)
- perror_with_name (_("Couldn't write registers"));
+ perror_with_name (_ ("Couldn't write registers"));
/* Deal with the stack regs. */
if (regnum == -1 || regnum == SPARC_SP_REGNUM
@@ -232,8 +231,9 @@ sparc_store_inferior_registers (process_stratum_target *proc_target,
{
fpregset_t fpregs, saved_fpregs;
- if (gdb_ptrace (PTRACE_GETFPREGS, ptid, (PTRACE_TYPE_ARG3) &fpregs) == -1)
- perror_with_name (_("Couldn't get floating-point registers"));
+ if (gdb_ptrace (PTRACE_GETFPREGS, ptid, (PTRACE_TYPE_ARG3) &fpregs)
+ == -1)
+ perror_with_name (_ ("Couldn't get floating-point registers"));
memcpy (&saved_fpregs, &fpregs, sizeof (fpregs));
sparc_collect_fpregset (sparc_fpregmap, regcache, regnum, &fpregs);
@@ -244,9 +244,9 @@ sparc_store_inferior_registers (process_stratum_target *proc_target,
to write the registers if nothing changed. */
if (memcmp (&saved_fpregs, &fpregs, sizeof (fpregs)) != 0)
{
- if (gdb_ptrace (PTRACE_SETFPREGS, ptid,
- (PTRACE_TYPE_ARG3) &fpregs) == -1)
- perror_with_name (_("Couldn't write floating-point registers"));
+ if (gdb_ptrace (PTRACE_SETFPREGS, ptid, (PTRACE_TYPE_ARG3) &fpregs)
+ == -1)
+ perror_with_name (_ ("Couldn't write floating-point registers"));
}
if (regnum != -1)
@@ -254,24 +254,22 @@ sparc_store_inferior_registers (process_stratum_target *proc_target,
}
}
-
/* Implement the to_xfer_partial target_ops method for
TARGET_OBJECT_WCOOKIE. Fetch StackGhost Per-Process XOR cookie. */
enum target_xfer_status
-sparc_xfer_wcookie (enum target_object object,
- const char *annex, gdb_byte *readbuf,
- const gdb_byte *writebuf, ULONGEST offset, ULONGEST len,
- ULONGEST *xfered_len)
+sparc_xfer_wcookie (enum target_object object, const char *annex,
+ gdb_byte *readbuf, const gdb_byte *writebuf,
+ ULONGEST offset, ULONGEST len, ULONGEST *xfered_len)
{
unsigned long wcookie = 0;
- char *buf = (char *)&wcookie;
+ char *buf = (char *) &wcookie;
gdb_assert (object == TARGET_OBJECT_WCOOKIE);
gdb_assert (readbuf && writebuf == NULL);
if (offset == sizeof (unsigned long))
- return TARGET_XFER_EOF; /* Signal EOF. */
+ return TARGET_XFER_EOF; /* Signal EOF. */
if (offset > sizeof (unsigned long))
return TARGET_XFER_E_IO;
@@ -292,7 +290,7 @@ sparc_xfer_wcookie (enum target_object object,
if (ptrace (PT_WCOOKIE, pid, (PTRACE_TYPE_ARG3) &wcookie, 0) == -1)
{
if (errno != EINVAL)
- perror_with_name (_("Couldn't get StackGhost cookie"));
+ perror_with_name (_ ("Couldn't get StackGhost cookie"));
/* Although PT_WCOOKIE is defined on OpenBSD 3.1 and later,
the request wasn't implemented until after OpenBSD 3.4. If
@@ -310,9 +308,9 @@ sparc_xfer_wcookie (enum target_object object,
*xfered_len = (ULONGEST) len;
return TARGET_XFER_OK;
}
-
void _initialize_sparc_nat ();
+
void
_initialize_sparc_nat ()
{
diff --git a/gdb/sparc-nat.h b/gdb/sparc-nat.h
index e5055e66891..330441b68b1 100644
--- a/gdb/sparc-nat.h
+++ b/gdb/sparc-nat.h
@@ -28,31 +28,30 @@ struct sparc_fpregmap;
extern const struct sparc_gregmap *sparc_gregmap;
extern const struct sparc_fpregmap *sparc_fpregmap;
extern void (*sparc_supply_gregset) (const struct sparc_gregmap *,
- struct regcache *, int , const void *);
+ struct regcache *, int, const void *);
extern void (*sparc_collect_gregset) (const struct sparc_gregmap *,
const struct regcache *, int, void *);
extern void (*sparc_supply_fpregset) (const struct sparc_fpregmap *,
- struct regcache *, int , const void *);
+ struct regcache *, int, const void *);
extern void (*sparc_collect_fpregset) (const struct sparc_fpregmap *,
- const struct regcache *, int , void *);
+ const struct regcache *, int, void *);
extern int (*sparc_gregset_supplies_p) (struct gdbarch *gdbarch, int);
extern int (*sparc_fpregset_supplies_p) (struct gdbarch *gdbarch, int);
extern int sparc32_gregset_supplies_p (struct gdbarch *gdbarch, int regnum);
extern int sparc32_fpregset_supplies_p (struct gdbarch *gdbarch, int regnum);
-extern void sparc_fetch_inferior_registers (process_stratum_target *proc_target,
- regcache *, int);
-extern void sparc_store_inferior_registers (process_stratum_target *proc_target,
- regcache *, int);
+extern void
+sparc_fetch_inferior_registers (process_stratum_target *proc_target,
+ regcache *, int);
+extern void
+sparc_store_inferior_registers (process_stratum_target *proc_target,
+ regcache *, int);
-extern target_xfer_status sparc_xfer_wcookie (enum target_object object,
- const char *annex,
- gdb_byte *readbuf,
- const gdb_byte *writebuf,
- ULONGEST offset,
- ULONGEST len,
- ULONGEST *xfered_len);
+extern target_xfer_status
+sparc_xfer_wcookie (enum target_object object, const char *annex,
+ gdb_byte *readbuf, const gdb_byte *writebuf,
+ ULONGEST offset, ULONGEST len, ULONGEST *xfered_len);
/* A prototype generic SPARC target. The client can override
it with local methods. */
@@ -61,24 +60,27 @@ template<typename BaseTarget>
struct sparc_target : public BaseTarget
{
void fetch_registers (struct regcache *regcache, int regnum) override
- { sparc_fetch_inferior_registers (this, regcache, regnum); }
+ {
+ sparc_fetch_inferior_registers (this, regcache, regnum);
+ }
void store_registers (struct regcache *regcache, int regnum) override
- { sparc_store_inferior_registers (this, regcache, regnum); }
+ {
+ sparc_store_inferior_registers (this, regcache, regnum);
+ }
enum target_xfer_status xfer_partial (enum target_object object,
- const char *annex,
- gdb_byte *readbuf,
+ const char *annex, gdb_byte *readbuf,
const gdb_byte *writebuf,
ULONGEST offset, ULONGEST len,
ULONGEST *xfered_len) override
{
if (object == TARGET_OBJECT_WCOOKIE)
- return sparc_xfer_wcookie (object, annex, readbuf, writebuf,
- offset, len, xfered_len);
+ return sparc_xfer_wcookie (object, annex, readbuf, writebuf, offset, len,
+ xfered_len);
- return BaseTarget::xfer_partial (object, annex, readbuf, writebuf,
- offset, len, xfered_len);
+ return BaseTarget::xfer_partial (object, annex, readbuf, writebuf, offset,
+ len, xfered_len);
}
};
diff --git a/gdb/sparc-netbsd-nat.c b/gdb/sparc-netbsd-nat.c
index d208730cf34..127c1145c6d 100644
--- a/gdb/sparc-netbsd-nat.c
+++ b/gdb/sparc-netbsd-nat.c
@@ -58,6 +58,7 @@ sparc32nbsd_supply_pcb (struct regcache *regcache, struct pcb *pcb)
static sparc_target<inf_ptrace_target> the_sparc_nbsd_nat_target;
void _initialize_sparcnbsd_nat ();
+
void
_initialize_sparcnbsd_nat ()
{
diff --git a/gdb/sparc-netbsd-tdep.c b/gdb/sparc-netbsd-tdep.c
index 0f3338a07be..634acd2dbd5 100644
--- a/gdb/sparc-netbsd-tdep.c
+++ b/gdb/sparc-netbsd-tdep.c
@@ -36,25 +36,24 @@
/* Macros to extract fields from SPARC instructions. */
#define X_RS1(i) (((i) >> 14) & 0x1f)
-#define X_RS2(i) ((i) & 0x1f)
+#define X_RS2(i) ((i) &0x1f)
#define X_I(i) (((i) >> 13) & 1)
-const struct sparc_gregmap sparc32nbsd_gregmap =
-{
- 0 * 4, /* %psr */
- 1 * 4, /* %pc */
- 2 * 4, /* %npc */
- 3 * 4, /* %y */
- -1, /* %wim */
- -1, /* %tbr */
- 5 * 4, /* %g1 */
- -1 /* %l0 */
+const struct sparc_gregmap sparc32nbsd_gregmap = {
+ 0 * 4, /* %psr */
+ 1 * 4, /* %pc */
+ 2 * 4, /* %npc */
+ 3 * 4, /* %y */
+ -1, /* %wim */
+ -1, /* %tbr */
+ 5 * 4, /* %g1 */
+ -1 /* %l0 */
};
static void
sparc32nbsd_supply_gregset (const struct regset *regset,
- struct regcache *regcache,
- int regnum, const void *gregs, size_t len)
+ struct regcache *regcache, int regnum,
+ const void *gregs, size_t len)
{
sparc32_supply_gregset (&sparc32nbsd_gregmap, regcache, regnum, gregs);
@@ -68,13 +67,12 @@ sparc32nbsd_supply_gregset (const struct regset *regset,
static void
sparc32nbsd_supply_fpregset (const struct regset *regset,
- struct regcache *regcache,
- int regnum, const void *fpregs, size_t len)
+ struct regcache *regcache, int regnum,
+ const void *fpregs, size_t len)
{
sparc32_supply_fpregset (&sparc32_bsd_fpregmap, regcache, regnum, fpregs);
}
-
/* Signal trampolines. */
/* The following variables describe the location of an on-stack signal
@@ -140,8 +138,8 @@ sparc32nbsd_sigcontext_saved_regs (frame_info_ptr this_frame)
save area. */
addr = saved_regs[SPARC_SP_REGNUM].addr ();
addr = get_frame_memory_unsigned (this_frame, addr, 4);
- for (regnum = SPARC_L0_REGNUM;
- regnum <= SPARC_I7_REGNUM; regnum++, addr += 4)
+ for (regnum = SPARC_L0_REGNUM; regnum <= SPARC_I7_REGNUM;
+ regnum++, addr += 4)
saved_regs[regnum].set_addr (addr);
/* Handle StackGhost. */
@@ -161,7 +159,7 @@ sparc32nbsd_sigcontext_saved_regs (frame_info_ptr this_frame)
/* The floating-point registers are only saved if the EF bit in %prs
has been set. */
-#define PSR_EF 0x00001000
+#define PSR_EF 0x00001000
addr = saved_regs[SPARC32_PSR_REGNUM].addr ();
psr = get_frame_memory_unsigned (this_frame, addr, 4);
@@ -215,8 +213,8 @@ sparc32nbsd_sigcontext_frame_this_id (frame_info_ptr this_frame,
void **this_cache,
struct frame_id *this_id)
{
- struct sparc_frame_cache *cache =
- sparc32nbsd_sigcontext_frame_cache (this_frame, this_cache);
+ struct sparc_frame_cache *cache
+ = sparc32nbsd_sigcontext_frame_cache (this_frame, this_cache);
(*this_id) = frame_id_build (cache->base, cache->pc);
}
@@ -225,8 +223,8 @@ static struct value *
sparc32nbsd_sigcontext_frame_prev_register (frame_info_ptr this_frame,
void **this_cache, int regnum)
{
- struct sparc_frame_cache *cache =
- sparc32nbsd_sigcontext_frame_cache (this_frame, this_cache);
+ struct sparc_frame_cache *cache
+ = sparc32nbsd_sigcontext_frame_cache (this_frame, this_cache);
return trad_frame_get_prev_register (this_frame, cache->saved_regs, regnum);
}
@@ -249,17 +247,15 @@ sparc32nbsd_sigcontext_frame_sniffer (const struct frame_unwind *self,
return 0;
}
-static const struct frame_unwind sparc32nbsd_sigcontext_frame_unwind =
-{
- "sparc32 netbsd sigcontext",
- SIGTRAMP_FRAME,
- default_frame_unwind_stop_reason,
- sparc32nbsd_sigcontext_frame_this_id,
- sparc32nbsd_sigcontext_frame_prev_register,
- NULL,
- sparc32nbsd_sigcontext_frame_sniffer
-};
-
+static const struct frame_unwind sparc32nbsd_sigcontext_frame_unwind
+ = { "sparc32 netbsd sigcontext",
+ SIGTRAMP_FRAME,
+ default_frame_unwind_stop_reason,
+ sparc32nbsd_sigcontext_frame_this_id,
+ sparc32nbsd_sigcontext_frame_prev_register,
+ NULL,
+ sparc32nbsd_sigcontext_frame_sniffer };
+
/* Return the address of a system call's alternative return
address. */
@@ -280,17 +276,12 @@ sparcnbsd_step_trap (frame_info_ptr frame, unsigned long insn)
return 0;
}
-
-static const struct regset sparc32nbsd_gregset =
- {
- NULL, sparc32nbsd_supply_gregset, NULL
- };
+static const struct regset sparc32nbsd_gregset
+ = { NULL, sparc32nbsd_supply_gregset, NULL };
-static const struct regset sparc32nbsd_fpregset =
- {
- NULL, sparc32nbsd_supply_fpregset, NULL
- };
+static const struct regset sparc32nbsd_fpregset
+ = { NULL, sparc32nbsd_supply_fpregset, NULL };
void
sparc32nbsd_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
@@ -314,11 +305,12 @@ sparc32nbsd_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
frame_unwind_append_unwinder (gdbarch, &sparc32nbsd_sigcontext_frame_unwind);
- set_solib_svr4_fetch_link_map_offsets
- (gdbarch, svr4_ilp32_fetch_link_map_offsets);
+ set_solib_svr4_fetch_link_map_offsets (gdbarch,
+ svr4_ilp32_fetch_link_map_offsets);
}
void _initialize_sparcnbsd_tdep ();
+
void
_initialize_sparcnbsd_tdep ()
{
diff --git a/gdb/sparc-obsd-tdep.c b/gdb/sparc-obsd-tdep.c
index d95e6ac618b..4b7ddc06927 100644
--- a/gdb/sparc-obsd-tdep.c
+++ b/gdb/sparc-obsd-tdep.c
@@ -68,8 +68,7 @@ sparc32obsd_pc_in_sigtramp (CORE_ADDR pc, const char *name)
}
static struct sparc_frame_cache *
-sparc32obsd_sigtramp_frame_cache (frame_info_ptr this_frame,
- void **this_cache)
+sparc32obsd_sigtramp_frame_cache (frame_info_ptr this_frame, void **this_cache)
{
struct sparc_frame_cache *cache;
CORE_ADDR addr;
@@ -104,8 +103,8 @@ sparc32obsd_sigtramp_frame_this_id (frame_info_ptr this_frame,
void **this_cache,
struct frame_id *this_id)
{
- struct sparc_frame_cache *cache =
- sparc32obsd_sigtramp_frame_cache (this_frame, this_cache);
+ struct sparc_frame_cache *cache
+ = sparc32obsd_sigtramp_frame_cache (this_frame, this_cache);
(*this_id) = frame_id_build (cache->base, cache->pc);
}
@@ -114,8 +113,8 @@ static struct value *
sparc32obsd_sigtramp_frame_prev_register (frame_info_ptr this_frame,
void **this_cache, int regnum)
{
- struct sparc_frame_cache *cache =
- sparc32obsd_sigtramp_frame_cache (this_frame, this_cache);
+ struct sparc_frame_cache *cache
+ = sparc32obsd_sigtramp_frame_cache (this_frame, this_cache);
return trad_frame_get_prev_register (this_frame, cache->saved_regs, regnum);
}
@@ -134,26 +133,22 @@ sparc32obsd_sigtramp_frame_sniffer (const struct frame_unwind *self,
return 0;
}
-static const struct frame_unwind sparc32obsd_sigtramp_frame_unwind =
-{
- "sparc32 openbsd sigtramp",
- SIGTRAMP_FRAME,
- default_frame_unwind_stop_reason,
- sparc32obsd_sigtramp_frame_this_id,
- sparc32obsd_sigtramp_frame_prev_register,
- NULL,
- sparc32obsd_sigtramp_frame_sniffer
-};
-
-
+static const struct frame_unwind sparc32obsd_sigtramp_frame_unwind
+ = { "sparc32 openbsd sigtramp",
+ SIGTRAMP_FRAME,
+ default_frame_unwind_stop_reason,
+ sparc32obsd_sigtramp_frame_this_id,
+ sparc32obsd_sigtramp_frame_prev_register,
+ NULL,
+ sparc32obsd_sigtramp_frame_sniffer };
/* Offset wthin the thread structure where we can find %fp and %i7. */
-#define SPARC32OBSD_UTHREAD_FP_OFFSET 128
-#define SPARC32OBSD_UTHREAD_PC_OFFSET 132
+#define SPARC32OBSD_UTHREAD_FP_OFFSET 128
+#define SPARC32OBSD_UTHREAD_PC_OFFSET 132
static void
-sparc32obsd_supply_uthread (struct regcache *regcache,
- int regnum, CORE_ADDR addr)
+sparc32obsd_supply_uthread (struct regcache *regcache, int regnum,
+ CORE_ADDR addr)
{
struct gdbarch *gdbarch = regcache->arch ();
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
@@ -200,8 +195,8 @@ sparc32obsd_supply_uthread (struct regcache *regcache,
}
static void
-sparc32obsd_collect_uthread(const struct regcache *regcache,
- int regnum, CORE_ADDR addr)
+sparc32obsd_collect_uthread (const struct regcache *regcache, int regnum,
+ CORE_ADDR addr)
{
struct gdbarch *gdbarch = regcache->arch ();
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
@@ -218,7 +213,7 @@ sparc32obsd_collect_uthread(const struct regcache *regcache,
CORE_ADDR fp_addr = addr + SPARC32OBSD_UTHREAD_FP_OFFSET;
regcache->raw_collect (SPARC_SP_REGNUM, buf);
- write_memory (fp_addr,buf, 4);
+ write_memory (fp_addr, buf, 4);
}
if (regnum == SPARC32_PC_REGNUM || regnum == -1)
@@ -237,7 +232,6 @@ sparc32obsd_collect_uthread(const struct regcache *regcache,
sp = extract_unsigned_integer (buf, 4, byte_order);
sparc_collect_rwindow (regcache, sp, regnum);
}
-
static void
sparc32obsd_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
@@ -255,6 +249,7 @@ sparc32obsd_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
}
void _initialize_sparc32obsd_tdep ();
+
void
_initialize_sparc32obsd_tdep ()
{
diff --git a/gdb/sparc-ravenscar-thread.c b/gdb/sparc-ravenscar-thread.c
index 52027fa2b11..5436c28026b 100644
--- a/gdb/sparc-ravenscar-thread.c
+++ b/gdb/sparc-ravenscar-thread.c
@@ -31,10 +31,9 @@
number. The Thread_Descriptor layout and the stack layout are documented
in the GNAT sources, in sparc-bb.h. */
-static const int sparc_register_offsets[] =
-{
+static const int sparc_register_offsets[] = {
/* G0 - G7 */
- -1, 0x24, 0x28, 0x2C, 0x30, 0x34, 0x38, 0x3C,
+ -1, 0x24, 0x28, 0x2C, 0x30, 0x34, 0x38, 0x3C,
/* O0 - O7 */
0x00, 0x04, 0x08, 0x0C, 0x10, 0x14, 0x18, 0x1C,
/* L0 - L7 */
@@ -42,12 +41,11 @@ static const int sparc_register_offsets[] =
/* I0 - I7 */
0x20, 0x24, 0x28, 0x2C, 0x30, 0x34, 0x38, 0x3C,
/* F0 - F31 */
- 0x50, 0x54, 0x58, 0x5C, 0x60, 0x64, 0x68, 0x6C,
- 0x70, 0x74, 0x78, 0x7C, 0x80, 0x84, 0x88, 0x8C,
- 0x90, 0x94, 0x99, 0x9C, 0xA0, 0xA4, 0xA8, 0xAC,
- 0xB0, 0xB4, 0xBB, 0xBC, 0xC0, 0xC4, 0xC8, 0xCC,
+ 0x50, 0x54, 0x58, 0x5C, 0x60, 0x64, 0x68, 0x6C, 0x70, 0x74, 0x78, 0x7C, 0x80,
+ 0x84, 0x88, 0x8C, 0x90, 0x94, 0x99, 0x9C, 0xA0, 0xA4, 0xA8, 0xAC, 0xB0, 0xB4,
+ 0xBB, 0xBC, 0xC0, 0xC4, 0xC8, 0xCC,
/* Y PSR WIM TBR PC NPC FPSR CPSR */
- 0x40, 0x20, 0x44, -1, 0x1C, -1, 0x4C, -1
+ 0x40, 0x20, 0x44, -1, 0x1C, -1, 0x4C, -1
};
static struct ravenscar_arch_ops sparc_ravenscar_ops (sparc_register_offsets,
diff --git a/gdb/sparc-sol2-nat.c b/gdb/sparc-sol2-nat.c
index d4d13ffdf0c..86d1101b6a6 100644
--- a/gdb/sparc-sol2-nat.c
+++ b/gdb/sparc-sol2-nat.c
@@ -86,8 +86,8 @@ fill_gregset (const struct regcache *regcache, prgregset_t *gregs, int regnum)
}
void
-fill_fpregset (const struct regcache *regcache,
- prfpregset_t *fpregs, int regnum)
+fill_fpregset (const struct regcache *regcache, prfpregset_t *fpregs,
+ int regnum)
{
sparc_collect_fpregset (&sparc_sol2_fpregmap, regcache, regnum, fpregs);
}
diff --git a/gdb/sparc-sol2-tdep.c b/gdb/sparc-sol2-tdep.c
index 8e451867efa..68422012b5a 100644
--- a/gdb/sparc-sol2-tdep.c
+++ b/gdb/sparc-sol2-tdep.c
@@ -34,44 +34,42 @@
#include "solib-svr4.h"
/* From <sys/regset.h>. */
-const struct sparc_gregmap sparc32_sol2_gregmap =
-{
- 32 * 4, /* %psr */
- 33 * 4, /* %pc */
- 34 * 4, /* %npc */
- 35 * 4, /* %y */
- 36 * 4, /* %wim */
- 37 * 4, /* %tbr */
- 1 * 4, /* %g1 */
- 16 * 4, /* %l0 */
+const struct sparc_gregmap sparc32_sol2_gregmap = {
+ 32 * 4, /* %psr */
+ 33 * 4, /* %pc */
+ 34 * 4, /* %npc */
+ 35 * 4, /* %y */
+ 36 * 4, /* %wim */
+ 37 * 4, /* %tbr */
+ 1 * 4, /* %g1 */
+ 16 * 4, /* %l0 */
};
-const struct sparc_fpregmap sparc32_sol2_fpregmap =
-{
- 0 * 4, /* %f0 */
- 33 * 4, /* %fsr */
+const struct sparc_fpregmap sparc32_sol2_fpregmap = {
+ 0 * 4, /* %f0 */
+ 33 * 4, /* %fsr */
};
static void
sparc32_sol2_supply_core_gregset (const struct regset *regset,
- struct regcache *regcache,
- int regnum, const void *gregs, size_t len)
+ struct regcache *regcache, int regnum,
+ const void *gregs, size_t len)
{
sparc32_supply_gregset (&sparc32_sol2_gregmap, regcache, regnum, gregs);
}
static void
sparc32_sol2_collect_core_gregset (const struct regset *regset,
- const struct regcache *regcache,
- int regnum, void *gregs, size_t len)
+ const struct regcache *regcache, int regnum,
+ void *gregs, size_t len)
{
sparc32_collect_gregset (&sparc32_sol2_gregmap, regcache, regnum, gregs);
}
static void
sparc32_sol2_supply_core_fpregset (const struct regset *regset,
- struct regcache *regcache,
- int regnum, const void *fpregs, size_t len)
+ struct regcache *regcache, int regnum,
+ const void *fpregs, size_t len)
{
sparc32_supply_fpregset (&sparc32_sol2_fpregmap, regcache, regnum, fpregs);
}
@@ -84,20 +82,13 @@ sparc32_sol2_collect_core_fpregset (const struct regset *regset,
sparc32_collect_fpregset (&sparc32_sol2_fpregmap, regcache, regnum, fpregs);
}
-static const struct regset sparc32_sol2_gregset =
- {
- NULL,
- sparc32_sol2_supply_core_gregset,
- sparc32_sol2_collect_core_gregset
- };
-
-static const struct regset sparc32_sol2_fpregset =
- {
- NULL,
- sparc32_sol2_supply_core_fpregset,
- sparc32_sol2_collect_core_fpregset
- };
-
+static const struct regset sparc32_sol2_gregset
+ = { NULL, sparc32_sol2_supply_core_gregset,
+ sparc32_sol2_collect_core_gregset };
+
+static const struct regset sparc32_sol2_fpregset
+ = { NULL, sparc32_sol2_supply_core_fpregset,
+ sparc32_sol2_collect_core_fpregset };
static struct sparc_frame_cache *
sparc32_sol2_sigtramp_frame_cache (frame_info_ptr this_frame,
@@ -118,8 +109,8 @@ sparc32_sol2_sigtramp_frame_cache (frame_info_ptr this_frame,
/* The third argument is a pointer to an instance of `ucontext_t',
which has a member `uc_mcontext' that contains the saved
registers. */
- regnum =
- (cache->copied_regs_mask & 0x04) ? SPARC_I2_REGNUM : SPARC_O2_REGNUM;
+ regnum
+ = (cache->copied_regs_mask & 0x04) ? SPARC_I2_REGNUM : SPARC_O2_REGNUM;
mcontext_addr = get_frame_register_unsigned (this_frame, regnum) + 40;
cache->saved_regs[SPARC32_PSR_REGNUM].set_addr (mcontext_addr + 0 * 4);
@@ -142,8 +133,8 @@ sparc32_sol2_sigtramp_frame_cache (frame_info_ptr this_frame,
{
addr = cache->saved_regs[SPARC_SP_REGNUM].addr ();
addr = get_frame_memory_unsigned (this_frame, addr, 4);
- for (regnum = SPARC_L0_REGNUM;
- regnum <= SPARC_I7_REGNUM; regnum++, addr += 4)
+ for (regnum = SPARC_L0_REGNUM; regnum <= SPARC_I7_REGNUM;
+ regnum++, addr += 4)
cache->saved_regs[regnum].set_addr (addr);
}
@@ -155,19 +146,18 @@ sparc32_sol2_sigtramp_frame_this_id (frame_info_ptr this_frame,
void **this_cache,
struct frame_id *this_id)
{
- struct sparc_frame_cache *cache =
- sparc32_sol2_sigtramp_frame_cache (this_frame, this_cache);
+ struct sparc_frame_cache *cache
+ = sparc32_sol2_sigtramp_frame_cache (this_frame, this_cache);
(*this_id) = frame_id_build (cache->base, cache->pc);
}
static struct value *
sparc32_sol2_sigtramp_frame_prev_register (frame_info_ptr this_frame,
- void **this_cache,
- int regnum)
+ void **this_cache, int regnum)
{
- struct sparc_frame_cache *cache =
- sparc32_sol2_sigtramp_frame_cache (this_frame, this_cache);
+ struct sparc_frame_cache *cache
+ = sparc32_sol2_sigtramp_frame_cache (this_frame, this_cache);
return trad_frame_get_prev_register (this_frame, cache->saved_regs, regnum);
}
@@ -180,18 +170,14 @@ sparc32_sol2_sigtramp_frame_sniffer (const struct frame_unwind *self,
return sol2_sigtramp_p (this_frame);
}
-static const struct frame_unwind sparc32_sol2_sigtramp_frame_unwind =
-{
- "sparc32 solaris sigtramp",
- SIGTRAMP_FRAME,
- default_frame_unwind_stop_reason,
- sparc32_sol2_sigtramp_frame_this_id,
- sparc32_sol2_sigtramp_frame_prev_register,
- NULL,
- sparc32_sol2_sigtramp_frame_sniffer
-};
-
-
+static const struct frame_unwind sparc32_sol2_sigtramp_frame_unwind
+ = { "sparc32 solaris sigtramp",
+ SIGTRAMP_FRAME,
+ default_frame_unwind_stop_reason,
+ sparc32_sol2_sigtramp_frame_this_id,
+ sparc32_sol2_sigtramp_frame_prev_register,
+ NULL,
+ sparc32_sol2_sigtramp_frame_sniffer };
static void
sparc32_sol2_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
@@ -208,8 +194,8 @@ sparc32_sol2_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
/* Solaris has SVR4-style shared libraries... */
set_gdbarch_skip_trampoline_code (gdbarch, find_solib_trampoline_target);
- set_solib_svr4_fetch_link_map_offsets
- (gdbarch, svr4_ilp32_fetch_link_map_offsets);
+ set_solib_svr4_fetch_link_map_offsets (gdbarch,
+ svr4_ilp32_fetch_link_map_offsets);
/* ...which means that we need some special handling when doing
prologue analysis. */
@@ -222,9 +208,10 @@ sparc32_sol2_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
}
void _initialize_sparc_sol2_tdep ();
+
void
_initialize_sparc_sol2_tdep ()
{
- gdbarch_register_osabi (bfd_arch_sparc, 0,
- GDB_OSABI_SOLARIS, sparc32_sol2_init_abi);
+ gdbarch_register_osabi (bfd_arch_sparc, 0, GDB_OSABI_SOLARIS,
+ sparc32_sol2_init_abi);
}
diff --git a/gdb/sparc-tdep.c b/gdb/sparc-tdep.c
index bd3dc946f87..83cf1e13056 100644
--- a/gdb/sparc-tdep.c
+++ b/gdb/sparc-tdep.c
@@ -73,16 +73,17 @@ struct regset;
#define X_A(i) (((i) >> 29) & 1)
#define X_COND(i) (((i) >> 25) & 0xf)
#define X_OP2(i) (((i) >> 22) & 0x7)
-#define X_IMM22(i) ((i) & 0x3fffff)
+#define X_IMM22(i) ((i) &0x3fffff)
#define X_OP3(i) (((i) >> 19) & 0x3f)
#define X_RS1(i) (((i) >> 14) & 0x1f)
-#define X_RS2(i) ((i) & 0x1f)
+#define X_RS2(i) ((i) &0x1f)
#define X_I(i) (((i) >> 13) & 1)
/* Sign extension macros. */
#define X_DISP22(i) ((X_IMM22 (i) ^ 0x200000) - 0x200000)
-#define X_DISP19(i) ((((i) & 0x7ffff) ^ 0x40000) - 0x40000)
-#define X_DISP10(i) ((((((i) >> 11) && 0x300) | (((i) >> 5) & 0xff)) ^ 0x200) - 0x200)
-#define X_SIMM13(i) ((((i) & 0x1fff) ^ 0x1000) - 0x1000)
+#define X_DISP19(i) ((((i) &0x7ffff) ^ 0x40000) - 0x40000)
+#define X_DISP10(i) \
+ ((((((i) >> 11) && 0x300) | (((i) >> 5) & 0xff)) ^ 0x200) - 0x200)
+#define X_SIMM13(i) ((((i) &0x1fff) ^ 0x1000) - 0x1000)
/* Macros to identify some instructions. */
/* RETURN (RETT in V8) */
#define X_RETTURN(i) ((X_OP (i) == 0x2) && (X_OP3 (i) == 0x39))
@@ -106,7 +107,6 @@ sparc_fetch_instruction (CORE_ADDR pc)
insn = (insn << 8) | buf[i];
return insn;
}
-
/* Return non-zero if the instruction corresponding to PC is an "unimp"
instruction. */
@@ -115,7 +115,7 @@ static int
sparc_is_unimp_insn (CORE_ADDR pc)
{
const unsigned long insn = sparc_fetch_instruction (pc);
-
+
return ((insn & 0xc1c00000) == 0);
}
@@ -198,7 +198,6 @@ sparc_fetch_wcookie (struct gdbarch *gdbarch)
return extract_unsigned_integer (buf, len, byte_order);
}
-
/* The functions on this page are intended to be used to classify
function arguments. */
@@ -351,30 +350,22 @@ sparc_arg_by_memory_p (const struct type *type)
}
/* Register information. */
-#define SPARC32_FPU_REGISTERS \
- "f0", "f1", "f2", "f3", "f4", "f5", "f6", "f7", \
- "f8", "f9", "f10", "f11", "f12", "f13", "f14", "f15", \
- "f16", "f17", "f18", "f19", "f20", "f21", "f22", "f23", \
- "f24", "f25", "f26", "f27", "f28", "f29", "f30", "f31"
+#define SPARC32_FPU_REGISTERS \
+ "f0", "f1", "f2", "f3", "f4", "f5", "f6", "f7", "f8", "f9", "f10", "f11", \
+ "f12", "f13", "f14", "f15", "f16", "f17", "f18", "f19", "f20", "f21", \
+ "f22", "f23", "f24", "f25", "f26", "f27", "f28", "f29", "f30", "f31"
#define SPARC32_CP0_REGISTERS \
"y", "psr", "wim", "tbr", "pc", "npc", "fsr", "csr"
-static const char * const sparc_core_register_names[] = {
- SPARC_CORE_REGISTERS
-};
-static const char * const sparc32_fpu_register_names[] = {
- SPARC32_FPU_REGISTERS
-};
-static const char * const sparc32_cp0_register_names[] = {
- SPARC32_CP0_REGISTERS
-};
+static const char *const sparc_core_register_names[]
+ = { SPARC_CORE_REGISTERS };
+static const char *const sparc32_fpu_register_names[]
+ = { SPARC32_FPU_REGISTERS };
+static const char *const sparc32_cp0_register_names[]
+ = { SPARC32_CP0_REGISTERS };
-static const char * const sparc32_register_names[] =
-{
- SPARC_CORE_REGISTERS,
- SPARC32_FPU_REGISTERS,
- SPARC32_CP0_REGISTERS
-};
+static const char *const sparc32_register_names[]
+ = { SPARC_CORE_REGISTERS, SPARC32_FPU_REGISTERS, SPARC32_CP0_REGISTERS };
/* Total number of registers. */
#define SPARC32_NUM_REGS ARRAY_SIZE (sparc32_register_names)
@@ -382,11 +373,9 @@ static const char * const sparc32_register_names[] =
/* We provide the aliases %d0..%d30 for the floating registers as
"psuedo" registers. */
-static const char * const sparc32_pseudo_register_names[] =
-{
- "d0", "d2", "d4", "d6", "d8", "d10", "d12", "d14",
- "d16", "d18", "d20", "d22", "d24", "d26", "d28", "d30"
-};
+static const char *const sparc32_pseudo_register_names[]
+ = { "d0", "d2", "d4", "d6", "d8", "d10", "d12", "d14",
+ "d16", "d18", "d20", "d22", "d24", "d26", "d28", "d30" };
/* Total number of pseudo registers. */
#define SPARC32_NUM_PSEUDO_REGS ARRAY_SIZE (sparc32_pseudo_register_names)
@@ -415,7 +404,7 @@ sparc32_register_name (struct gdbarch *gdbarch, int regnum)
return sparc32_pseudo_register_name (gdbarch, regnum);
}
-
+
/* Construct types for ISA-specific registers. */
static struct type *
@@ -484,7 +473,7 @@ sparc32_pseudo_register_type (struct gdbarch *gdbarch, int regnum)
if (regnum >= SPARC32_D0_REGNUM && regnum <= SPARC32_D30_REGNUM)
return builtin_type (gdbarch)->builtin_double;
- internal_error (_("sparc32_pseudo_register_type: bad register number %d"),
+ internal_error (_ ("sparc32_pseudo_register_type: bad register number %d"),
regnum);
}
@@ -520,8 +509,8 @@ sparc32_register_type (struct gdbarch *gdbarch, int regnum)
static enum register_status
sparc32_pseudo_register_read (struct gdbarch *gdbarch,
- readable_regcache *regcache,
- int regnum, gdb_byte *buf)
+ readable_regcache *regcache, int regnum,
+ gdb_byte *buf)
{
enum register_status status;
@@ -537,8 +526,8 @@ sparc32_pseudo_register_read (struct gdbarch *gdbarch,
static void
sparc32_pseudo_register_write (struct gdbarch *gdbarch,
- struct regcache *regcache,
- int regnum, const gdb_byte *buf)
+ struct regcache *regcache, int regnum,
+ const gdb_byte *buf)
{
regnum -= gdbarch_num_regs (gdbarch);
gdb_assert (regnum >= SPARC32_D0_REGNUM && regnum <= SPARC32_D30_REGNUM);
@@ -547,7 +536,7 @@ sparc32_pseudo_register_write (struct gdbarch *gdbarch,
regcache->raw_write (regnum, buf);
regcache->raw_write (regnum + 1, buf + 4);
}
-
+
/* Implement the stack_frame_destroyed_p gdbarch method. */
int
@@ -570,7 +559,6 @@ sparc_stack_frame_destroyed_p (struct gdbarch *gdbarch, CORE_ADDR pc)
return X_RETTURN (insn);
}
-
static CORE_ADDR
sparc32_frame_align (struct gdbarch *gdbarch, CORE_ADDR address)
@@ -581,11 +569,9 @@ sparc32_frame_align (struct gdbarch *gdbarch, CORE_ADDR address)
static CORE_ADDR
sparc32_push_dummy_code (struct gdbarch *gdbarch, CORE_ADDR sp,
- CORE_ADDR funcaddr,
- struct value **args, int nargs,
- struct type *value_type,
- CORE_ADDR *real_pc, CORE_ADDR *bp_addr,
- struct regcache *regcache)
+ CORE_ADDR funcaddr, struct value **args, int nargs,
+ struct type *value_type, CORE_ADDR *real_pc,
+ CORE_ADDR *bp_addr, struct regcache *regcache)
{
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
@@ -713,8 +699,8 @@ sparc32_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
function_call_return_method return_method,
CORE_ADDR struct_addr)
{
- CORE_ADDR call_pc = (return_method == return_method_struct
- ? (bp_addr - 12) : (bp_addr - 8));
+ CORE_ADDR call_pc
+ = (return_method == return_method_struct ? (bp_addr - 12) : (bp_addr - 8));
/* Set return address. */
regcache_cooked_write_unsigned (regcache, SPARC_O7_REGNUM, call_pc);
@@ -734,7 +720,6 @@ sparc32_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
return sp;
}
-
/* Use the program counter to determine the contents and size of a
breakpoint instruction. Return a pointer to a string of bytes that
@@ -744,7 +729,6 @@ sparc32_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
constexpr gdb_byte sparc_break_insn[] = { 0x91, 0xd0, 0x20, 0x01 };
typedef BP_MANIPULATION (sparc_break_insn) sparc_breakpoint;
-
/* Allocate and initialize a frame cache. */
@@ -773,7 +757,7 @@ sparc_alloc_frame_cache (void)
of each function prologue when compiling with -fstack-check. If one of
such sequences starts at START_PC, then return the address of the
instruction immediately past this sequence. Otherwise, return START_PC. */
-
+
static CORE_ADDR
sparc_skip_stack_check (const CORE_ADDR start_pc)
{
@@ -819,7 +803,7 @@ sparc_skip_stack_check (const CORE_ADDR start_pc)
}
/* sub %sp, %g1, %g1 */
- if (!(X_OP (insn) == 2 && X_OP3 (insn) == 0x4 && !X_I(insn)
+ if (!(X_OP (insn) == 2 && X_OP3 (insn) == 0x4 && !X_I (insn)
&& X_RD (insn) == 1 && X_RS1 (insn) == 14 && X_RS2 (insn) == 1))
return start_pc;
@@ -839,7 +823,7 @@ sparc_skip_stack_check (const CORE_ADDR start_pc)
clr [%g1 - some immediate] */
/* clr [%g1 - some immediate] */
- if (X_OP (insn) == 3 && X_OP3(insn) == 0x4 && X_I(insn)
+ if (X_OP (insn) == 3 && X_OP3 (insn) == 0x4 && X_I (insn)
&& X_RS1 (insn) == 1 && X_RD (insn) == 0)
{
/* Valid stack-check sequence, return the new PC. */
@@ -855,35 +839,35 @@ sparc_skip_stack_check (const CORE_ADDR start_pc)
clr [%g1 - some immediate] */
/* clr [%g1] */
- else if (X_OP (insn) == 3 && X_OP3(insn) == 0x4 && !X_I(insn)
- && X_RS1 (insn) == 1 && X_RD (insn) == 0)
+ else if (X_OP (insn) == 3 && X_OP3 (insn) == 0x4 && !X_I (insn)
+ && X_RS1 (insn) == 1 && X_RD (insn) == 0)
{
while (1)
{
/* add %g1, -<some immediate>, %g1 */
insn = sparc_fetch_instruction (pc);
pc = pc + 4;
- if (!(X_OP (insn) == 2 && X_OP3(insn) == 0 && X_I(insn)
+ if (!(X_OP (insn) == 2 && X_OP3 (insn) == 0 && X_I (insn)
&& X_RS1 (insn) == 1 && X_RD (insn) == 1))
break;
/* clr [%g1] */
insn = sparc_fetch_instruction (pc);
pc = pc + 4;
- if (!(X_OP (insn) == 3 && X_OP3(insn) == 0x4 && !X_I(insn)
+ if (!(X_OP (insn) == 3 && X_OP3 (insn) == 0x4 && !X_I (insn)
&& X_RD (insn) == 0 && X_RS1 (insn) == 1))
return start_pc;
}
/* clr [%g1 - some immediate] */
- if (!(X_OP (insn) == 3 && X_OP3(insn) == 0x4 && X_I(insn)
+ if (!(X_OP (insn) == 3 && X_OP3 (insn) == 0x4 && X_I (insn)
&& X_RS1 (insn) == 1 && X_RD (insn) == 0))
return start_pc;
/* We found a valid stack-check sequence, return the new PC. */
return pc;
}
-
+
/* Third sequence: A probing loop.
[first three instructions above]
sub %g1, %g4, %g4
@@ -900,14 +884,14 @@ sparc_skip_stack_check (const CORE_ADDR start_pc)
if (probing_loop)
{
/* sub %g1, %g4, %g4 */
- if (!(X_OP (insn) == 2 && X_OP3 (insn) == 0x4 && !X_I(insn)
+ if (!(X_OP (insn) == 2 && X_OP3 (insn) == 0x4 && !X_I (insn)
&& X_RD (insn) == 4 && X_RS1 (insn) == 1 && X_RS2 (insn) == 4))
return start_pc;
/* cmp %g1, %g4 */
insn = sparc_fetch_instruction (pc);
pc = pc + 4;
- if (!(X_OP (insn) == 2 && X_OP3 (insn) == 0x14 && !X_I(insn)
+ if (!(X_OP (insn) == 2 && X_OP3 (insn) == 0x14 && !X_I (insn)
&& X_RD (insn) == 0 && X_RS1 (insn) == 1 && X_RS2 (insn) == 4))
return start_pc;
@@ -920,7 +904,7 @@ sparc_skip_stack_check (const CORE_ADDR start_pc)
/* add %g1, -<some immediate>, %g1 */
insn = sparc_fetch_instruction (pc);
pc = pc + 4;
- if (!(X_OP (insn) == 2 && X_OP3(insn) == 0 && X_I(insn)
+ if (!(X_OP (insn) == 2 && X_OP3 (insn) == 0 && X_I (insn)
&& X_RS1 (insn) == 1 && X_RD (insn) == 1))
return start_pc;
@@ -933,9 +917,8 @@ sparc_skip_stack_check (const CORE_ADDR start_pc)
/* clr [%g1] (st %g0, [%g1] or st %g0, [%g1+0]) */
insn = sparc_fetch_instruction (pc);
pc = pc + 4;
- if (!(X_OP (insn) == 3 && X_OP3(insn) == 0x4
- && X_RD (insn) == 0 && X_RS1 (insn) == 1
- && (!X_I(insn) || X_SIMM13 (insn) == 0)))
+ if (!(X_OP (insn) == 3 && X_OP3 (insn) == 0x4 && X_RD (insn) == 0
+ && X_RS1 (insn) == 1 && (!X_I (insn) || X_SIMM13 (insn) == 0)))
return start_pc;
/* We found a valid stack-check sequence, return the new PC. */
@@ -943,7 +926,7 @@ sparc_skip_stack_check (const CORE_ADDR start_pc)
/* optional: clr [%g4 - some immediate] */
insn = sparc_fetch_instruction (pc);
pc = pc + 4;
- if (!(X_OP (insn) == 3 && X_OP3(insn) == 0x4 && X_I(insn)
+ if (!(X_OP (insn) == 3 && X_OP3 (insn) == 0x4 && X_I (insn)
&& X_RS1 (insn) == 4 && X_RD (insn) == 0))
return pc - 4;
else
@@ -1020,9 +1003,10 @@ sparc_analyze_prologue (struct gdbarch *gdbarch, CORE_ADDR pc,
/* Recognize stores into the corresponding stack slots. */
if (regnum >= SPARC_L0_REGNUM && regnum <= SPARC_I7_REGNUM
&& ((X_I (insn)
- && X_SIMM13 (insn) == (X_OP3 (insn) == 0xe
- ? (regnum - SPARC_L0_REGNUM) * 8 + BIAS
- : (regnum - SPARC_L0_REGNUM) * 4))
+ && X_SIMM13 (insn)
+ == (X_OP3 (insn) == 0xe
+ ? (regnum - SPARC_L0_REGNUM) * 8 + BIAS
+ : (regnum - SPARC_L0_REGNUM) * 4))
|| (!X_I (insn) && regnum == SPARC_L0_REGNUM)))
{
cache->saved_regs_mask |= (1 << (regnum - SPARC_L0_REGNUM));
@@ -1062,10 +1046,8 @@ sparc_analyze_prologue (struct gdbarch *gdbarch, CORE_ADDR pc,
}
/* Check for an arithmetic operation on %sp. */
- if (X_OP (insn) == 2
- && (X_OP3 (insn) == 0 || X_OP3 (insn) == 0x4)
- && X_RS1 (insn) == SPARC_SP_REGNUM
- && X_RD (insn) == SPARC_SP_REGNUM)
+ if (X_OP (insn) == 2 && (X_OP3 (insn) == 0 || X_OP3 (insn) == 0x4)
+ && X_RS1 (insn) == SPARC_SP_REGNUM && X_RD (insn) == SPARC_SP_REGNUM)
{
if (X_I (insn))
{
@@ -1078,10 +1060,8 @@ sparc_analyze_prologue (struct gdbarch *gdbarch, CORE_ADDR pc,
insn = sparc_fetch_instruction (pc + offset);
/* Check for an arithmetic operation that sets up the frame. */
- if (X_OP (insn) == 2
- && (X_OP3 (insn) == 0 || X_OP3 (insn) == 0x4)
- && X_RS1 (insn) == SPARC_SP_REGNUM
- && X_RD (insn) == SPARC_FP_REGNUM)
+ if (X_OP (insn) == 2 && (X_OP3 (insn) == 0 || X_OP3 (insn) == 0x4)
+ && X_RS1 (insn) == SPARC_SP_REGNUM && X_RD (insn) == SPARC_FP_REGNUM)
{
cache->frameless_p = 0;
cache->frame_offset = 0;
@@ -1094,15 +1074,12 @@ sparc_analyze_prologue (struct gdbarch *gdbarch, CORE_ADDR pc,
}
/* Check for a move (or) operation that copies the return register. */
- if (X_OP (insn) == 2
- && X_OP3 (insn) == 0x2
- && !X_I (insn)
- && X_RS1 (insn) == SPARC_G0_REGNUM
- && X_RS2 (insn) == SPARC_O7_REGNUM
+ if (X_OP (insn) == 2 && X_OP3 (insn) == 0x2 && !X_I (insn)
+ && X_RS1 (insn) == SPARC_G0_REGNUM && X_RS2 (insn) == SPARC_O7_REGNUM
&& X_RD (insn) == SPARC_I7_REGNUM)
{
- cache->copied_regs_mask |= 0x80;
- offset += 4;
+ cache->copied_regs_mask |= 0x80;
+ offset += 4;
}
return pc + offset;
@@ -1149,8 +1126,8 @@ sparc32_skip_prologue (struct gdbarch *gdbarch, CORE_ADDR start_pc)
/* Recognize instructions that store incoming arguments into the
corresponding stack slots. */
- if (X_OP (insn) == 3 && (X_OP3 (insn) & 0x3c) == 0x04
- && X_I (insn) && X_RS1 (insn) == SPARC_FP_REGNUM)
+ if (X_OP (insn) == 3 && (X_OP3 (insn) & 0x3c) == 0x04 && X_I (insn)
+ && X_RS1 (insn) == SPARC_FP_REGNUM)
{
int regnum = X_RD (insn);
@@ -1202,15 +1179,13 @@ sparc_frame_cache (frame_info_ptr this_frame, void **this_cache)
/* This function is frameless, so %fp (%i6) holds the frame
pointer for our calling frame. Use %sp (%o6) as this frame's
base address. */
- cache->base =
- get_frame_register_unsigned (this_frame, SPARC_SP_REGNUM);
+ cache->base = get_frame_register_unsigned (this_frame, SPARC_SP_REGNUM);
}
else
{
/* For normal frames, %fp (%i6) holds the frame pointer, the
base address for the current stack frame. */
- cache->base =
- get_frame_register_unsigned (this_frame, SPARC_FP_REGNUM);
+ cache->base = get_frame_register_unsigned (this_frame, SPARC_FP_REGNUM);
}
cache->base += cache->frame_offset;
@@ -1263,8 +1238,8 @@ sparc32_frame_cache (frame_info_ptr this_frame, void **this_cache)
an "unimp" instruction. If it is, then it is a struct-return
function. */
CORE_ADDR pc;
- int regnum =
- (cache->copied_regs_mask & 0x80) ? SPARC_I7_REGNUM : SPARC_O7_REGNUM;
+ int regnum
+ = (cache->copied_regs_mask & 0x80) ? SPARC_I7_REGNUM : SPARC_O7_REGNUM;
pc = get_frame_register_unsigned (this_frame, regnum) + 8;
if (sparc_is_unimp_insn (pc))
@@ -1278,8 +1253,8 @@ static void
sparc32_frame_this_id (frame_info_ptr this_frame, void **this_cache,
struct frame_id *this_id)
{
- struct sparc_frame_cache *cache =
- sparc32_frame_cache (this_frame, this_cache);
+ struct sparc_frame_cache *cache
+ = sparc32_frame_cache (this_frame, this_cache);
/* This marks the outermost frame. */
if (cache->base == 0)
@@ -1289,12 +1264,12 @@ sparc32_frame_this_id (frame_info_ptr this_frame, void **this_cache,
}
static struct value *
-sparc32_frame_prev_register (frame_info_ptr this_frame,
- void **this_cache, int regnum)
+sparc32_frame_prev_register (frame_info_ptr this_frame, void **this_cache,
+ int regnum)
{
struct gdbarch *gdbarch = get_frame_arch (this_frame);
- struct sparc_frame_cache *cache =
- sparc32_frame_cache (this_frame, this_cache);
+ struct sparc_frame_cache *cache
+ = sparc32_frame_cache (this_frame, this_cache);
if (regnum == SPARC32_PC_REGNUM || regnum == SPARC32_NPC_REGNUM)
{
@@ -1306,8 +1281,8 @@ sparc32_frame_prev_register (frame_info_ptr this_frame,
if (cache->struct_return_p)
pc += 4;
- regnum =
- (cache->copied_regs_mask & 0x80) ? SPARC_I7_REGNUM : SPARC_O7_REGNUM;
+ regnum
+ = (cache->copied_regs_mask & 0x80) ? SPARC_I7_REGNUM : SPARC_O7_REGNUM;
pc += get_frame_register_unsigned (this_frame, regnum) + 8;
return frame_unwind_got_constant (this_frame, regnum, pc);
}
@@ -1346,34 +1321,27 @@ sparc32_frame_prev_register (frame_info_ptr this_frame,
return frame_unwind_got_register (this_frame, regnum, regnum);
}
-static const struct frame_unwind sparc32_frame_unwind =
-{
- "sparc32 prologue",
- NORMAL_FRAME,
- default_frame_unwind_stop_reason,
- sparc32_frame_this_id,
- sparc32_frame_prev_register,
- NULL,
- default_frame_sniffer
-};
-
+static const struct frame_unwind sparc32_frame_unwind
+ = { "sparc32 prologue",
+ NORMAL_FRAME,
+ default_frame_unwind_stop_reason,
+ sparc32_frame_this_id,
+ sparc32_frame_prev_register,
+ NULL,
+ default_frame_sniffer };
static CORE_ADDR
sparc32_frame_base_address (frame_info_ptr this_frame, void **this_cache)
{
- struct sparc_frame_cache *cache =
- sparc32_frame_cache (this_frame, this_cache);
+ struct sparc_frame_cache *cache
+ = sparc32_frame_cache (this_frame, this_cache);
return cache->base;
}
-static const struct frame_base sparc32_frame_base =
-{
- &sparc32_frame_unwind,
- sparc32_frame_base_address,
- sparc32_frame_base_address,
- sparc32_frame_base_address
-};
+static const struct frame_base sparc32_frame_base
+ = { &sparc32_frame_unwind, sparc32_frame_base_address,
+ sparc32_frame_base_address, sparc32_frame_base_address };
static struct frame_id
sparc_dummy_id (struct gdbarch *gdbarch, frame_info_ptr this_frame)
@@ -1385,7 +1353,6 @@ sparc_dummy_id (struct gdbarch *gdbarch, frame_info_ptr this_frame)
sp += BIAS;
return frame_id_build (sp, get_frame_pc (this_frame));
}
-
/* Extract a function return value of TYPE from REGCACHE, and copy
that into VALBUF. */
@@ -1618,19 +1585,18 @@ sparc_execute_dwarf_cfa_vendor_op (struct gdbarch *gdbarch, gdb_byte op,
return true;
}
-
/* The SPARC Architecture doesn't have hardware single-step support,
and most operating systems don't implement it either, so we provide
software single-step mechanism. */
static CORE_ADDR
-sparc_analyze_control_transfer (struct regcache *regcache,
- CORE_ADDR pc, CORE_ADDR *npc)
+sparc_analyze_control_transfer (struct regcache *regcache, CORE_ADDR pc,
+ CORE_ADDR *npc)
{
unsigned long insn = sparc_fetch_instruction (pc);
int conditional_p = X_COND (insn) & 0x7;
int branch_p = 0, fused_p = 0;
- long offset = 0; /* Must be signed for sign-extend. */
+ long offset = 0; /* Must be signed for sign-extend. */
if (X_OP (insn) == 0 && X_OP2 (insn) == 3)
{
@@ -1765,7 +1731,6 @@ sparc_write_pc (struct regcache *regcache, CORE_ADDR pc)
regcache_cooked_write_unsigned (regcache, tdep->pc_regnum, pc);
regcache_cooked_write_unsigned (regcache, tdep->npc_regnum, pc + 4);
}
-
/* Iterate over core file register note sections. */
@@ -1782,15 +1747,13 @@ sparc_iterate_over_regset_sections (struct gdbarch *gdbarch,
cb (".reg2", tdep->sizeof_fpregset, tdep->sizeof_fpregset, tdep->fpregset,
NULL, cb_data);
}
-
static int
validate_tdesc_registers (const struct target_desc *tdesc,
struct tdesc_arch_data *tdesc_data,
const char *feature_name,
- const char * const register_names[],
- unsigned int registers_num,
- unsigned int reg_start)
+ const char *const register_names[],
+ unsigned int registers_num, unsigned int reg_start)
{
int valid_p = 1;
const struct tdesc_feature *feature;
@@ -1800,8 +1763,7 @@ validate_tdesc_registers (const struct target_desc *tdesc,
return 0;
for (unsigned int i = 0; i < registers_num; i++)
- valid_p &= tdesc_numbered_register (feature, tdesc_data,
- reg_start + i,
+ valid_p &= tdesc_numbered_register (feature, tdesc_data, reg_start + i,
register_names[i]);
return valid_p;
@@ -1847,9 +1809,9 @@ sparc32_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
set_gdbarch_pseudo_register_write (gdbarch, sparc32_pseudo_register_write);
/* Register numbers of various important registers. */
- set_gdbarch_sp_regnum (gdbarch, SPARC_SP_REGNUM); /* %sp */
+ set_gdbarch_sp_regnum (gdbarch, SPARC_SP_REGNUM); /* %sp */
set_gdbarch_pc_regnum (gdbarch, SPARC32_PC_REGNUM); /* %pc */
- set_gdbarch_fp0_regnum (gdbarch, SPARC_F0_REGNUM); /* %f0 */
+ set_gdbarch_fp0_regnum (gdbarch, SPARC_F0_REGNUM); /* %f0 */
/* Call dummy code. */
set_gdbarch_frame_align (gdbarch, sparc32_frame_align);
@@ -1858,8 +1820,8 @@ sparc32_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
set_gdbarch_push_dummy_call (gdbarch, sparc32_push_dummy_call);
set_gdbarch_return_value_as_value (gdbarch, sparc32_return_value);
- set_gdbarch_stabs_argument_has_addr
- (gdbarch, sparc32_stabs_argument_has_addr);
+ set_gdbarch_stabs_argument_has_addr (gdbarch,
+ sparc32_stabs_argument_has_addr);
set_gdbarch_skip_prologue (gdbarch, sparc32_skip_prologue);
@@ -1899,22 +1861,23 @@ sparc32_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
/* Validate that the descriptor provides the mandatory registers
and allocate their numbers. */
- valid_p &= validate_tdesc_registers (tdesc, tdesc_data.get (),
- "org.gnu.gdb.sparc.cpu",
- sparc_core_register_names,
- ARRAY_SIZE (sparc_core_register_names),
- SPARC_G0_REGNUM);
- valid_p &= validate_tdesc_registers (tdesc, tdesc_data.get (),
- "org.gnu.gdb.sparc.fpu",
- tdep->fpu_register_names,
- tdep->fpu_registers_num,
- SPARC_F0_REGNUM);
+ valid_p
+ &= validate_tdesc_registers (tdesc, tdesc_data.get (),
+ "org.gnu.gdb.sparc.cpu",
+ sparc_core_register_names,
+ ARRAY_SIZE (sparc_core_register_names),
+ SPARC_G0_REGNUM);
+ valid_p
+ &= validate_tdesc_registers (tdesc, tdesc_data.get (),
+ "org.gnu.gdb.sparc.fpu",
+ tdep->fpu_register_names,
+ tdep->fpu_registers_num, SPARC_F0_REGNUM);
valid_p &= validate_tdesc_registers (tdesc, tdesc_data.get (),
"org.gnu.gdb.sparc.cp0",
tdep->cp0_register_names,
tdep->cp0_registers_num,
SPARC_F0_REGNUM
- + tdep->fpu_registers_num);
+ + tdep->fpu_registers_num);
if (!valid_p)
return NULL;
@@ -1925,14 +1888,14 @@ sparc32_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
/* If we have register sets, enable the generic core file support. */
if (tdep->gregset)
- set_gdbarch_iterate_over_regset_sections
- (gdbarch, sparc_iterate_over_regset_sections);
+ set_gdbarch_iterate_over_regset_sections (
+ gdbarch, sparc_iterate_over_regset_sections);
register_sparc_ravenscar_ops (gdbarch);
return gdbarch;
}
-
+
/* Helper functions for dealing with register windows. */
void
@@ -2012,8 +1975,8 @@ sparc_supply_rwindow (struct regcache *regcache, CORE_ADDR sp, int regnum)
}
void
-sparc_collect_rwindow (const struct regcache *regcache,
- CORE_ADDR sp, int regnum)
+sparc_collect_rwindow (const struct regcache *regcache, CORE_ADDR sp,
+ int regnum)
{
struct gdbarch *gdbarch = regcache->arch ();
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
@@ -2087,8 +2050,8 @@ sparc_collect_rwindow (const struct regcache *regcache,
void
sparc32_supply_gregset (const struct sparc_gregmap *gregmap,
- struct regcache *regcache,
- int regnum, const void *gregs)
+ struct regcache *regcache, int regnum,
+ const void *gregs)
{
const gdb_byte *regs = (const gdb_byte *) gregs;
gdb_byte zero[4] = { 0 };
@@ -2148,8 +2111,8 @@ sparc32_supply_gregset (const struct sparc_gregmap *gregmap,
void
sparc32_collect_gregset (const struct sparc_gregmap *gregmap,
- const struct regcache *regcache,
- int regnum, void *gregs)
+ const struct regcache *regcache, int regnum,
+ void *gregs)
{
gdb_byte *regs = (gdb_byte *) gregs;
int i;
@@ -2199,8 +2162,8 @@ sparc32_collect_gregset (const struct sparc_gregmap *gregmap,
void
sparc32_supply_fpregset (const struct sparc_fpregmap *fpregmap,
- struct regcache *regcache,
- int regnum, const void *fpregs)
+ struct regcache *regcache, int regnum,
+ const void *fpregs)
{
const gdb_byte *regs = (const gdb_byte *) fpregs;
int i;
@@ -2218,8 +2181,8 @@ sparc32_supply_fpregset (const struct sparc_fpregmap *fpregmap,
void
sparc32_collect_fpregset (const struct sparc_fpregmap *fpregmap,
- const struct regcache *regcache,
- int regnum, void *fpregs)
+ const struct regcache *regcache, int regnum,
+ void *fpregs)
{
gdb_byte *regs = (gdb_byte *) fpregs;
int i;
@@ -2232,39 +2195,35 @@ sparc32_collect_fpregset (const struct sparc_fpregmap *fpregmap,
}
if (regnum == SPARC32_FSR_REGNUM || regnum == -1)
- regcache->raw_collect (SPARC32_FSR_REGNUM,
- regs + fpregmap->r_fsr_offset);
+ regcache->raw_collect (SPARC32_FSR_REGNUM, regs + fpregmap->r_fsr_offset);
}
-
/* SunOS 4. */
/* From <machine/reg.h>. */
-const struct sparc_gregmap sparc32_sunos4_gregmap =
-{
- 0 * 4, /* %psr */
- 1 * 4, /* %pc */
- 2 * 4, /* %npc */
- 3 * 4, /* %y */
- -1, /* %wim */
- -1, /* %tbr */
- 4 * 4, /* %g1 */
- -1 /* %l0 */
+const struct sparc_gregmap sparc32_sunos4_gregmap = {
+ 0 * 4, /* %psr */
+ 1 * 4, /* %pc */
+ 2 * 4, /* %npc */
+ 3 * 4, /* %y */
+ -1, /* %wim */
+ -1, /* %tbr */
+ 4 * 4, /* %g1 */
+ -1 /* %l0 */
};
-const struct sparc_fpregmap sparc32_sunos4_fpregmap =
-{
- 0 * 4, /* %f0 */
- 33 * 4, /* %fsr */
+const struct sparc_fpregmap sparc32_sunos4_fpregmap = {
+ 0 * 4, /* %f0 */
+ 33 * 4, /* %fsr */
};
-const struct sparc_fpregmap sparc32_bsd_fpregmap =
-{
- 0 * 4, /* %f0 */
- 32 * 4, /* %fsr */
+const struct sparc_fpregmap sparc32_bsd_fpregmap = {
+ 0 * 4, /* %f0 */
+ 32 * 4, /* %fsr */
};
void _initialize_sparc_tdep ();
+
void
_initialize_sparc_tdep ()
{
diff --git a/gdb/sparc-tdep.h b/gdb/sparc-tdep.h
index 1967dca3a62..4ecc6a96ec0 100644
--- a/gdb/sparc-tdep.h
+++ b/gdb/sparc-tdep.h
@@ -22,11 +22,10 @@
#include "gdbarch.h"
-#define SPARC_CORE_REGISTERS \
- "g0", "g1", "g2", "g3", "g4", "g5", "g6", "g7", \
- "o0", "o1", "o2", "o3", "o4", "o5", "sp", "o7", \
- "l0", "l1", "l2", "l3", "l4", "l5", "l6", "l7", \
- "i0", "i1", "i2", "i3", "i4", "i5", "fp", "i7"
+#define SPARC_CORE_REGISTERS \
+ "g0", "g1", "g2", "g3", "g4", "g5", "g6", "g7", "o0", "o1", "o2", "o3", \
+ "o4", "o5", "sp", "o7", "l0", "l1", "l2", "l3", "l4", "l5", "l6", "l7", \
+ "i0", "i1", "i2", "i3", "i4", "i5", "fp", "i7"
class frame_info_ptr;
struct gdbarch;
@@ -66,9 +65,9 @@ struct sparc_gdbarch_tdep : gdbarch_tdep_base
int npc_regnum = 0;
/* Register names specific for architecture (sparc32 vs. sparc64) */
- const char * const *fpu_register_names = nullptr;
+ const char *const *fpu_register_names = nullptr;
size_t fpu_registers_num = 0;
- const char * const *cp0_register_names = nullptr;
+ const char *const *cp0_register_names = nullptr;
size_t cp0_registers_num = 0;
/* Register sets. */
@@ -85,8 +84,7 @@ struct sparc_gdbarch_tdep : gdbarch_tdep_base
size_t plt_entry_size = 0;
/* Alternative location for trap return. Used for single-stepping. */
- CORE_ADDR (*step_trap) (frame_info_ptr frame, unsigned long insn)
- = nullptr;
+ CORE_ADDR (*step_trap) (frame_info_ptr frame, unsigned long insn) = nullptr;
/* ISA-specific data types. */
struct type *sparc_psr_type = nullptr;
@@ -101,39 +99,39 @@ struct sparc_gdbarch_tdep : gdbarch_tdep_base
enum sparc_regnum
{
- SPARC_G0_REGNUM = 0, /* %g0 */
+ SPARC_G0_REGNUM = 0, /* %g0 */
SPARC_G1_REGNUM,
SPARC_G2_REGNUM,
SPARC_G3_REGNUM,
SPARC_G4_REGNUM,
SPARC_G5_REGNUM,
SPARC_G6_REGNUM,
- SPARC_G7_REGNUM, /* %g7 */
- SPARC_O0_REGNUM, /* %o0 */
+ SPARC_G7_REGNUM, /* %g7 */
+ SPARC_O0_REGNUM, /* %o0 */
SPARC_O1_REGNUM,
SPARC_O2_REGNUM,
SPARC_O3_REGNUM,
SPARC_O4_REGNUM,
SPARC_O5_REGNUM,
- SPARC_SP_REGNUM, /* %sp (%o6) */
- SPARC_O7_REGNUM, /* %o7 */
- SPARC_L0_REGNUM, /* %l0 */
+ SPARC_SP_REGNUM, /* %sp (%o6) */
+ SPARC_O7_REGNUM, /* %o7 */
+ SPARC_L0_REGNUM, /* %l0 */
SPARC_L1_REGNUM,
SPARC_L2_REGNUM,
SPARC_L3_REGNUM,
SPARC_L4_REGNUM,
SPARC_L5_REGNUM,
SPARC_L6_REGNUM,
- SPARC_L7_REGNUM, /* %l7 */
- SPARC_I0_REGNUM, /* %i0 */
+ SPARC_L7_REGNUM, /* %l7 */
+ SPARC_I0_REGNUM, /* %i0 */
SPARC_I1_REGNUM,
SPARC_I2_REGNUM,
SPARC_I3_REGNUM,
SPARC_I4_REGNUM,
SPARC_I5_REGNUM,
- SPARC_FP_REGNUM, /* %fp (%i6) */
- SPARC_I7_REGNUM, /* %i7 */
- SPARC_F0_REGNUM, /* %f0 */
+ SPARC_FP_REGNUM, /* %fp (%i6) */
+ SPARC_I7_REGNUM, /* %i7 */
+ SPARC_F0_REGNUM, /* %f0 */
SPARC_F1_REGNUM,
SPARC_F2_REGNUM,
SPARC_F3_REGNUM,
@@ -141,31 +139,30 @@ enum sparc_regnum
SPARC_F5_REGNUM,
SPARC_F6_REGNUM,
SPARC_F7_REGNUM,
- SPARC_F31_REGNUM /* %f31 */
+ SPARC_F31_REGNUM /* %f31 */
= SPARC_F0_REGNUM + 31
};
enum sparc32_regnum
{
- SPARC32_Y_REGNUM /* %y */
+ SPARC32_Y_REGNUM /* %y */
= SPARC_F31_REGNUM + 1,
- SPARC32_PSR_REGNUM, /* %psr */
- SPARC32_WIM_REGNUM, /* %wim */
- SPARC32_TBR_REGNUM, /* %tbr */
- SPARC32_PC_REGNUM, /* %pc */
- SPARC32_NPC_REGNUM, /* %npc */
- SPARC32_FSR_REGNUM, /* %fsr */
- SPARC32_CSR_REGNUM, /* %csr */
+ SPARC32_PSR_REGNUM, /* %psr */
+ SPARC32_WIM_REGNUM, /* %wim */
+ SPARC32_TBR_REGNUM, /* %tbr */
+ SPARC32_PC_REGNUM, /* %pc */
+ SPARC32_NPC_REGNUM, /* %npc */
+ SPARC32_FSR_REGNUM, /* %fsr */
+ SPARC32_CSR_REGNUM, /* %csr */
};
/* Pseudo registers. */
enum sparc32_pseudo_regnum
{
- SPARC32_D0_REGNUM = 0, /* %d0 */
- SPARC32_D30_REGNUM /* %d30 */
+ SPARC32_D0_REGNUM = 0, /* %d0 */
+ SPARC32_D30_REGNUM /* %d30 */
= SPARC32_D0_REGNUM + 15
};
-
struct sparc_frame_cache
{
@@ -202,23 +199,21 @@ extern ULONGEST sparc_fetch_wcookie (struct gdbarch *gdbarch);
extern void sparc_record_save_insn (struct sparc_frame_cache *cache);
/* Do a full analysis of the prologue at PC and update CACHE accordingly. */
-extern CORE_ADDR sparc_analyze_prologue (struct gdbarch *gdbarch,
- CORE_ADDR pc, CORE_ADDR current_pc,
+extern CORE_ADDR sparc_analyze_prologue (struct gdbarch *gdbarch, CORE_ADDR pc,
+ CORE_ADDR current_pc,
struct sparc_frame_cache *cache);
-extern struct sparc_frame_cache *
- sparc_frame_cache (frame_info_ptr this_frame, void **this_cache);
+extern struct sparc_frame_cache *sparc_frame_cache (frame_info_ptr this_frame,
+ void **this_cache);
extern struct sparc_frame_cache *
- sparc32_frame_cache (frame_info_ptr this_frame, void **this_cache);
-
-extern int
- sparc_stack_frame_destroyed_p (struct gdbarch *gdbarch, CORE_ADDR pc);
+sparc32_frame_cache (frame_info_ptr this_frame, void **this_cache);
-
+extern int sparc_stack_frame_destroyed_p (struct gdbarch *gdbarch,
+ CORE_ADDR pc);
-extern void sparc_supply_rwindow (struct regcache *regcache,
- CORE_ADDR sp, int regnum);
+extern void sparc_supply_rwindow (struct regcache *regcache, CORE_ADDR sp,
+ int regnum);
extern void sparc_collect_rwindow (const struct regcache *regcache,
CORE_ADDR sp, int regnum);
@@ -228,14 +223,14 @@ extern const struct sparc_fpregmap sparc32_sunos4_fpregmap;
extern const struct sparc_fpregmap sparc32_bsd_fpregmap;
extern void sparc32_supply_gregset (const struct sparc_gregmap *gregmap,
- struct regcache *regcache,
- int regnum, const void *gregs);
+ struct regcache *regcache, int regnum,
+ const void *gregs);
extern void sparc32_collect_gregset (const struct sparc_gregmap *gregmap,
const struct regcache *regcache,
int regnum, void *gregs);
extern void sparc32_supply_fpregset (const struct sparc_fpregmap *fpregmap,
- struct regcache *regcache,
- int regnum, const void *fpregs);
+ struct regcache *regcache, int regnum,
+ const void *fpregs);
extern void sparc32_collect_fpregset (const struct sparc_fpregmap *fpregmap,
const struct regcache *regcache,
int regnum, void *fpregs);
@@ -262,6 +257,6 @@ extern void sparc32nbsd_init_abi (struct gdbarch_info info,
struct gdbarch *gdbarch);
extern struct trad_frame_saved_reg *
- sparc32nbsd_sigcontext_saved_regs (frame_info_ptr next_frame);
+sparc32nbsd_sigcontext_saved_regs (frame_info_ptr next_frame);
#endif /* sparc-tdep.h */
diff --git a/gdb/sparc64-fbsd-nat.c b/gdb/sparc64-fbsd-nat.c
index 90786057ac9..16e3aaddfc5 100644
--- a/gdb/sparc64-fbsd-nat.c
+++ b/gdb/sparc64-fbsd-nat.c
@@ -24,7 +24,6 @@
#include "fbsd-nat.h"
#include "sparc64-tdep.h"
#include "sparc-nat.h"
-
/* Support for debugging kernel virtual memory images. */
@@ -63,6 +62,7 @@ sparc64fbsd_kvm_supply_pcb (struct regcache *regcache, struct pcb *pcb)
static sparc_target<fbsd_nat_target> the_sparc64_fbsd_nat_target;
void _initialize_sparc64fbsd_nat ();
+
void
_initialize_sparc64fbsd_nat ()
{
diff --git a/gdb/sparc64-fbsd-tdep.c b/gdb/sparc64-fbsd-tdep.c
index 07ee57c808c..d950a3cfacd 100644
--- a/gdb/sparc64-fbsd-tdep.c
+++ b/gdb/sparc64-fbsd-tdep.c
@@ -33,52 +33,48 @@
#include "gdbarch.h"
/* From <machine/reg.h>. */
-const struct sparc_gregmap sparc64fbsd_gregmap =
-{
- 26 * 8, /* "tstate" */
- 25 * 8, /* %pc */
- 24 * 8, /* %npc */
- 28 * 8, /* %y */
- 16 * 8, /* %fprs */
- -1,
- 1 * 8, /* %g1 */
- -1, /* %l0 */
- 8 /* sizeof (%y) */
+const struct sparc_gregmap sparc64fbsd_gregmap = {
+ 26 * 8, /* "tstate" */
+ 25 * 8, /* %pc */
+ 24 * 8, /* %npc */
+ 28 * 8, /* %y */
+ 16 * 8, /* %fprs */
+ -1, 1 * 8, /* %g1 */
+ -1, /* %l0 */
+ 8 /* sizeof (%y) */
};
-
static void
sparc64fbsd_supply_gregset (const struct regset *regset,
- struct regcache *regcache,
- int regnum, const void *gregs, size_t len)
+ struct regcache *regcache, int regnum,
+ const void *gregs, size_t len)
{
sparc64_supply_gregset (&sparc64fbsd_gregmap, regcache, regnum, gregs);
}
static void
sparc64fbsd_collect_gregset (const struct regset *regset,
- const struct regcache *regcache,
- int regnum, void *gregs, size_t len)
+ const struct regcache *regcache, int regnum,
+ void *gregs, size_t len)
{
sparc64_collect_gregset (&sparc64fbsd_gregmap, regcache, regnum, gregs);
}
static void
sparc64fbsd_supply_fpregset (const struct regset *regset,
- struct regcache *regcache,
- int regnum, const void *fpregs, size_t len)
+ struct regcache *regcache, int regnum,
+ const void *fpregs, size_t len)
{
sparc64_supply_fpregset (&sparc64_bsd_fpregmap, regcache, regnum, fpregs);
}
static void
sparc64fbsd_collect_fpregset (const struct regset *regset,
- const struct regcache *regcache,
- int regnum, void *fpregs, size_t len)
+ const struct regcache *regcache, int regnum,
+ void *fpregs, size_t len)
{
sparc64_collect_fpregset (&sparc64_bsd_fpregmap, regcache, regnum, fpregs);
}
-
/* Signal trampolines. */
@@ -89,8 +85,7 @@ sparc64fbsd_pc_in_sigtramp (CORE_ADDR pc, const char *name)
}
static struct sparc_frame_cache *
-sparc64fbsd_sigtramp_frame_cache (frame_info_ptr this_frame,
- void **this_cache)
+sparc64fbsd_sigtramp_frame_cache (frame_info_ptr this_frame, void **this_cache)
{
struct sparc_frame_cache *cache;
CORE_ADDR addr, mcontext_addr, sp;
@@ -136,14 +131,14 @@ sparc64fbsd_sigtramp_frame_cache (frame_info_ptr this_frame,
save area. */
addr = cache->saved_regs[SPARC_SP_REGNUM].addr ();
sp = get_frame_memory_unsigned (this_frame, addr, 8);
- for (regnum = SPARC_L0_REGNUM, addr = sp + BIAS;
- regnum <= SPARC_I7_REGNUM; regnum++, addr += 8)
+ for (regnum = SPARC_L0_REGNUM, addr = sp + BIAS; regnum <= SPARC_I7_REGNUM;
+ regnum++, addr += 8)
cache->saved_regs[regnum].set_addr (addr);
- /* The floating-point registers are only saved if the FEF bit in
+ /* The floating-point registers are only saved if the FEF bit in
%fprs has been set. */
-#define FPRS_FEF (1 << 2)
+#define FPRS_FEF (1 << 2)
addr = cache->saved_regs[SPARC64_FPRS_REGNUM].addr ();
fprs = get_frame_memory_unsigned (this_frame, addr, 8);
@@ -153,8 +148,8 @@ sparc64fbsd_sigtramp_frame_cache (frame_info_ptr this_frame,
regnum <= SPARC_F31_REGNUM; regnum++, addr += 4)
cache->saved_regs[regnum].set_addr (addr);
- for (regnum = SPARC64_F32_REGNUM;
- regnum <= SPARC64_F62_REGNUM; regnum++, addr += 8)
+ for (regnum = SPARC64_F32_REGNUM; regnum <= SPARC64_F62_REGNUM;
+ regnum++, addr += 8)
cache->saved_regs[regnum].set_addr (addr);
}
@@ -166,8 +161,8 @@ sparc64fbsd_sigtramp_frame_this_id (frame_info_ptr this_frame,
void **this_cache,
struct frame_id *this_id)
{
- struct sparc_frame_cache *cache =
- sparc64fbsd_sigtramp_frame_cache (this_frame, this_cache);
+ struct sparc_frame_cache *cache
+ = sparc64fbsd_sigtramp_frame_cache (this_frame, this_cache);
(*this_id) = frame_id_build (cache->base, cache->pc);
}
@@ -176,8 +171,8 @@ static struct value *
sparc64fbsd_sigtramp_frame_prev_register (frame_info_ptr this_frame,
void **this_cache, int regnum)
{
- struct sparc_frame_cache *cache =
- sparc64fbsd_sigtramp_frame_cache (this_frame, this_cache);
+ struct sparc_frame_cache *cache
+ = sparc64fbsd_sigtramp_frame_cache (this_frame, this_cache);
return trad_frame_get_prev_register (this_frame, cache->saved_regs, regnum);
}
@@ -197,27 +192,20 @@ sparc64fbsd_sigtramp_frame_sniffer (const struct frame_unwind *self,
return 0;
}
-static const struct frame_unwind sparc64fbsd_sigtramp_frame_unwind =
-{
- "sparc64 freebsd sigtramp",
- SIGTRAMP_FRAME,
- default_frame_unwind_stop_reason,
- sparc64fbsd_sigtramp_frame_this_id,
- sparc64fbsd_sigtramp_frame_prev_register,
- NULL,
- sparc64fbsd_sigtramp_frame_sniffer
-};
-
+static const struct frame_unwind sparc64fbsd_sigtramp_frame_unwind
+ = { "sparc64 freebsd sigtramp",
+ SIGTRAMP_FRAME,
+ default_frame_unwind_stop_reason,
+ sparc64fbsd_sigtramp_frame_this_id,
+ sparc64fbsd_sigtramp_frame_prev_register,
+ NULL,
+ sparc64fbsd_sigtramp_frame_sniffer };
-static const struct regset sparc64fbsd_gregset =
- {
- NULL, sparc64fbsd_supply_gregset, sparc64fbsd_collect_gregset
- };
+static const struct regset sparc64fbsd_gregset
+ = { NULL, sparc64fbsd_supply_gregset, sparc64fbsd_collect_gregset };
-static const struct regset sparc64fbsd_fpregset =
- {
- NULL, sparc64fbsd_supply_fpregset, sparc64fbsd_collect_fpregset
- };
+static const struct regset sparc64fbsd_fpregset
+ = { NULL, sparc64fbsd_supply_fpregset, sparc64fbsd_collect_fpregset };
static void
sparc64fbsd_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
@@ -239,14 +227,15 @@ sparc64fbsd_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
/* FreeBSD/sparc64 has SVR4-style shared libraries. */
set_gdbarch_skip_trampoline_code (gdbarch, find_solib_trampoline_target);
- set_solib_svr4_fetch_link_map_offsets
- (gdbarch, svr4_lp64_fetch_link_map_offsets);
+ set_solib_svr4_fetch_link_map_offsets (gdbarch,
+ svr4_lp64_fetch_link_map_offsets);
}
void _initialize_sparc64fbsd_tdep ();
+
void
_initialize_sparc64fbsd_tdep ()
{
- gdbarch_register_osabi (bfd_arch_sparc, bfd_mach_sparc_v9,
- GDB_OSABI_FREEBSD, sparc64fbsd_init_abi);
+ gdbarch_register_osabi (bfd_arch_sparc, bfd_mach_sparc_v9, GDB_OSABI_FREEBSD,
+ sparc64fbsd_init_abi);
}
diff --git a/gdb/sparc64-linux-nat.c b/gdb/sparc64-linux-nat.c
index eb6730e4063..a82e292414e 100644
--- a/gdb/sparc64-linux-nat.c
+++ b/gdb/sparc64-linux-nat.c
@@ -33,35 +33,40 @@
class sparc64_linux_nat_target final : public linux_nat_target
{
public:
+
/* Add our register access methods. */
void fetch_registers (struct regcache *regcache, int regnum) override
- { sparc_fetch_inferior_registers (this, regcache, regnum); }
+ {
+ sparc_fetch_inferior_registers (this, regcache, regnum);
+ }
void store_registers (struct regcache *regcache, int regnum) override
- { sparc_store_inferior_registers (this, regcache, regnum); }
+ {
+ sparc_store_inferior_registers (this, regcache, regnum);
+ }
/* Override linux_nat_target low methods. */
/* ADI support */
void low_forget_process (pid_t pid) override
- { sparc64_forget_process (pid); }
+ {
+ sparc64_forget_process (pid);
+ }
};
static sparc64_linux_nat_target the_sparc64_linux_nat_target;
-static const struct sparc_gregmap sparc64_linux_ptrace_gregmap =
-{
- 16 * 8, /* "tstate" */
- 17 * 8, /* %pc */
- 18 * 8, /* %npc */
- 19 * 8, /* %y */
- -1, /* %wim */
- -1, /* %tbr */
- 0 * 8, /* %g1 */
- -1, /* %l0 */
- 4 /* sizeof (%y) */
+static const struct sparc_gregmap sparc64_linux_ptrace_gregmap = {
+ 16 * 8, /* "tstate" */
+ 17 * 8, /* %pc */
+ 18 * 8, /* %npc */
+ 19 * 8, /* %y */
+ -1, /* %wim */
+ -1, /* %tbr */
+ 0 * 8, /* %g1 */
+ -1, /* %l0 */
+ 4 /* sizeof (%y) */
};
-
void
supply_gregset (struct regcache *regcache, const prgregset_t *gregs)
@@ -82,13 +87,14 @@ fill_gregset (const struct regcache *regcache, prgregset_t *gregs, int regnum)
}
void
-fill_fpregset (const struct regcache *regcache,
- prfpregset_t *fpregs, int regnum)
+fill_fpregset (const struct regcache *regcache, prfpregset_t *fpregs,
+ int regnum)
{
sparc64_collect_fpregset (&sparc64_bsd_fpregmap, regcache, regnum, fpregs);
}
void _initialize_sparc64_linux_nat ();
+
void
_initialize_sparc64_linux_nat ()
{
diff --git a/gdb/sparc64-linux-tdep.c b/gdb/sparc64-linux-tdep.c
index beff812eeef..5bc89e0c0d9 100644
--- a/gdb/sparc64-linux-tdep.c
+++ b/gdb/sparc64-linux-tdep.c
@@ -35,13 +35,13 @@
/* ADI specific si_code */
#ifndef SEGV_ACCADI
-#define SEGV_ACCADI 3
+#define SEGV_ACCADI 3
#endif
#ifndef SEGV_ADIDERR
-#define SEGV_ADIDERR 4
+#define SEGV_ADIDERR 4
#endif
#ifndef SEGV_ADIPERR
-#define SEGV_ADIPERR 5
+#define SEGV_ADIPERR 5
#endif
/* The syscall's XML filename for sparc 64-bit. */
@@ -59,17 +59,13 @@ static void sparc64_linux_sigframe_init (const struct tramp_frame *self,
/* See sparc-linux-tdep.c for details. Note that 64-bit binaries only
use RT signals. */
-static const struct tramp_frame sparc64_linux_rt_sigframe =
-{
- SIGTRAMP_FRAME,
- 4,
- {
- { 0x82102065, ULONGEST_MAX }, /* mov __NR_rt_sigreturn, %g1 */
- { 0x91d0206d, ULONGEST_MAX }, /* ta 0x6d */
- { TRAMP_SENTINEL_INSN, ULONGEST_MAX }
- },
- sparc64_linux_sigframe_init
-};
+static const struct tramp_frame sparc64_linux_rt_sigframe
+ = { SIGTRAMP_FRAME,
+ 4,
+ { { 0x82102065, ULONGEST_MAX }, /* mov __NR_rt_sigreturn, %g1 */
+ { 0x91d0206d, ULONGEST_MAX }, /* ta 0x6d */
+ { TRAMP_SENTINEL_INSN, ULONGEST_MAX } },
+ sparc64_linux_sigframe_init };
static void
sparc64_linux_sigframe_init (const struct tramp_frame *self,
@@ -121,7 +117,8 @@ sparc64_linux_sigframe_init (const struct tramp_frame *self,
Displays information related to ADI memory corruptions. */
static void
-sparc64_linux_report_signal_info (struct gdbarch *gdbarch, struct ui_out *uiout,
+sparc64_linux_report_signal_info (struct gdbarch *gdbarch,
+ struct ui_out *uiout,
enum gdb_signal siggnal)
{
if (gdbarch_bfd_arch_info (gdbarch)->bits_per_word != 64
@@ -147,31 +144,29 @@ sparc64_linux_report_signal_info (struct gdbarch *gdbarch, struct ui_out *uiout,
/* Print out ADI event based on sig_code value */
switch (si_code)
{
- case SEGV_ACCADI: /* adi not enabled */
+ case SEGV_ACCADI: /* adi not enabled */
uiout->text ("\n");
- uiout->field_string ("sigcode-meaning", _("ADI disabled"));
- uiout->text (_(" while accessing address "));
+ uiout->field_string ("sigcode-meaning", _ ("ADI disabled"));
+ uiout->text (_ (" while accessing address "));
uiout->field_core_addr ("bound-access", gdbarch, addr);
break;
- case SEGV_ADIDERR: /* disrupting mismatch */
+ case SEGV_ADIDERR: /* disrupting mismatch */
uiout->text ("\n");
- uiout->field_string ("sigcode-meaning", _("ADI deferred mismatch"));
- uiout->text (_(" while accessing address "));
+ uiout->field_string ("sigcode-meaning", _ ("ADI deferred mismatch"));
+ uiout->text (_ (" while accessing address "));
uiout->field_core_addr ("bound-access", gdbarch, addr);
break;
- case SEGV_ADIPERR: /* precise mismatch */
+ case SEGV_ADIPERR: /* precise mismatch */
uiout->text ("\n");
- uiout->field_string ("sigcode-meaning", _("ADI precise mismatch"));
- uiout->text (_(" while accessing address "));
+ uiout->field_string ("sigcode-meaning", _ ("ADI precise mismatch"));
+ uiout->text (_ (" while accessing address "));
uiout->field_core_addr ("bound-access", gdbarch, addr);
break;
default:
break;
}
-
}
-
/* Return the address of a system call's alternative return
address. */
@@ -198,35 +193,32 @@ sparc64_linux_step_trap (frame_info_ptr frame, unsigned long insn)
register save area. The saved PC sits at a 136 byte offset
into there. */
- return read_memory_unsigned_integer (sp + 192 + 128 + 136,
- 8, byte_order);
+ return read_memory_unsigned_integer (sp + 192 + 128 + 136, 8,
+ byte_order);
}
return 0;
}
-
-const struct sparc_gregmap sparc64_linux_core_gregmap =
-{
- 32 * 8, /* %tstate */
- 33 * 8, /* %tpc */
- 34 * 8, /* %tnpc */
- 35 * 8, /* %y */
- -1, /* %wim */
- -1, /* %tbr */
- 1 * 8, /* %g1 */
- 16 * 8, /* %l0 */
- 8, /* y size */
+const struct sparc_gregmap sparc64_linux_core_gregmap = {
+ 32 * 8, /* %tstate */
+ 33 * 8, /* %tpc */
+ 34 * 8, /* %tnpc */
+ 35 * 8, /* %y */
+ -1, /* %wim */
+ -1, /* %tbr */
+ 1 * 8, /* %g1 */
+ 16 * 8, /* %l0 */
+ 8, /* y size */
};
-
static void
sparc64_linux_supply_core_gregset (const struct regset *regset,
- struct regcache *regcache,
- int regnum, const void *gregs, size_t len)
+ struct regcache *regcache, int regnum,
+ const void *gregs, size_t len)
{
- sparc64_supply_gregset (&sparc64_linux_core_gregmap,
- regcache, regnum, gregs);
+ sparc64_supply_gregset (&sparc64_linux_core_gregmap, regcache, regnum,
+ gregs);
}
static void
@@ -234,14 +226,14 @@ sparc64_linux_collect_core_gregset (const struct regset *regset,
const struct regcache *regcache,
int regnum, void *gregs, size_t len)
{
- sparc64_collect_gregset (&sparc64_linux_core_gregmap,
- regcache, regnum, gregs);
+ sparc64_collect_gregset (&sparc64_linux_core_gregmap, regcache, regnum,
+ gregs);
}
static void
sparc64_linux_supply_core_fpregset (const struct regset *regset,
- struct regcache *regcache,
- int regnum, const void *fpregs, size_t len)
+ struct regcache *regcache, int regnum,
+ const void *fpregs, size_t len)
{
sparc64_supply_fpregset (&sparc64_bsd_fpregmap, regcache, regnum, fpregs);
}
@@ -256,7 +248,7 @@ sparc64_linux_collect_core_fpregset (const struct regset *regset,
/* Set the program counter for process PTID to PC. */
-#define TSTATE_SYSCALL 0x0000000000000020ULL
+#define TSTATE_SYSCALL 0x0000000000000020ULL
static void
sparc64_linux_write_pc (struct regcache *regcache, CORE_ADDR pc)
@@ -282,8 +274,7 @@ sparc64_linux_write_pc (struct regcache *regcache, CORE_ADDR pc)
}
static LONGEST
-sparc64_linux_get_syscall_number (struct gdbarch *gdbarch,
- thread_info *thread)
+sparc64_linux_get_syscall_number (struct gdbarch *gdbarch, thread_info *thread)
{
struct regcache *regcache = get_thread_regcache (thread);
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
@@ -302,7 +293,6 @@ sparc64_linux_get_syscall_number (struct gdbarch *gdbarch,
return ret;
}
-
/* Implement the "get_longjmp_target" gdbarch method. */
static int
@@ -339,27 +329,19 @@ sparc64_linux_get_longjmp_target (frame_info_ptr frame, CORE_ADDR *pc)
*pc = extract_unsigned_integer (buf, 8, gdbarch_byte_order (gdbarch));
if (!sparc_is_annulled_branch_insn (*pc))
- *pc += 4; /* delay slot insn */
- *pc += 4; /* call insn */
+ *pc += 4; /* delay slot insn */
+ *pc += 4; /* call insn */
return 1;
}
-
-
-static const struct regset sparc64_linux_gregset =
- {
- NULL,
- sparc64_linux_supply_core_gregset,
- sparc64_linux_collect_core_gregset
- };
+static const struct regset sparc64_linux_gregset
+ = { NULL, sparc64_linux_supply_core_gregset,
+ sparc64_linux_collect_core_gregset };
-static const struct regset sparc64_linux_fpregset =
- {
- NULL,
- sparc64_linux_supply_core_fpregset,
- sparc64_linux_collect_core_fpregset
- };
+static const struct regset sparc64_linux_fpregset
+ = { NULL, sparc64_linux_supply_core_fpregset,
+ sparc64_linux_collect_core_fpregset };
static void
sparc64_linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
@@ -383,8 +365,8 @@ sparc64_linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
/* GNU/Linux has SVR4-style shared libraries... */
set_gdbarch_skip_trampoline_code (gdbarch, find_solib_trampoline_target);
- set_solib_svr4_fetch_link_map_offsets
- (gdbarch, linux_lp64_fetch_link_map_offsets);
+ set_solib_svr4_fetch_link_map_offsets (gdbarch,
+ linux_lp64_fetch_link_map_offsets);
/* ...which means that we need some special handling when doing
prologue analysis. */
@@ -404,15 +386,15 @@ sparc64_linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
/* Functions for 'catch syscall'. */
set_xml_syscall_file_name (gdbarch, XML_SYSCALL_FILENAME_SPARC64);
- set_gdbarch_get_syscall_number (gdbarch,
- sparc64_linux_get_syscall_number);
+ set_gdbarch_get_syscall_number (gdbarch, sparc64_linux_get_syscall_number);
set_gdbarch_report_signal_info (gdbarch, sparc64_linux_report_signal_info);
}
void _initialize_sparc64_linux_tdep ();
+
void
_initialize_sparc64_linux_tdep ()
{
- gdbarch_register_osabi (bfd_arch_sparc, bfd_mach_sparc_v9,
- GDB_OSABI_LINUX, sparc64_linux_init_abi);
+ gdbarch_register_osabi (bfd_arch_sparc, bfd_mach_sparc_v9, GDB_OSABI_LINUX,
+ sparc64_linux_init_abi);
}
diff --git a/gdb/sparc64-nat.c b/gdb/sparc64-nat.c
index cc7b55ff20a..5bad4ed0311 100644
--- a/gdb/sparc64-nat.c
+++ b/gdb/sparc64-nat.c
@@ -39,10 +39,8 @@ sparc64_gregset_supplies_p (struct gdbarch *gdbarch, int regnum)
return 1;
/* Control registers. */
- if (regnum == SPARC64_PC_REGNUM
- || regnum == SPARC64_NPC_REGNUM
- || regnum == SPARC64_STATE_REGNUM
- || regnum == SPARC64_Y_REGNUM
+ if (regnum == SPARC64_PC_REGNUM || regnum == SPARC64_NPC_REGNUM
+ || regnum == SPARC64_STATE_REGNUM || regnum == SPARC64_Y_REGNUM
|| regnum == SPARC64_FPRS_REGNUM)
return 1;
@@ -70,6 +68,7 @@ sparc64_fpregset_supplies_p (struct gdbarch *gdbarch, int regnum)
}
void _initialize_sparc64_nat ();
+
void
_initialize_sparc64_nat ()
{
diff --git a/gdb/sparc64-netbsd-nat.c b/gdb/sparc64-netbsd-nat.c
index 4119b9425bd..ab43c3257c8 100644
--- a/gdb/sparc64-netbsd-nat.c
+++ b/gdb/sparc64-netbsd-nat.c
@@ -31,8 +31,8 @@
static void
sparc64nbsd_supply_gregset (const struct sparc_gregmap *gregmap,
- struct regcache *regcache,
- int regnum, const void *gregs)
+ struct regcache *regcache, int regnum,
+ const void *gregs)
{
int sparc32 = (gdbarch_ptr_bit (regcache->arch ()) == 32);
@@ -44,8 +44,8 @@ sparc64nbsd_supply_gregset (const struct sparc_gregmap *gregmap,
static void
sparc64nbsd_collect_gregset (const struct sparc_gregmap *gregmap,
- const struct regcache *regcache,
- int regnum, void *gregs)
+ const struct regcache *regcache, int regnum,
+ void *gregs)
{
int sparc32 = (gdbarch_ptr_bit (regcache->arch ()) == 32);
@@ -57,8 +57,8 @@ sparc64nbsd_collect_gregset (const struct sparc_gregmap *gregmap,
static void
sparc64nbsd_supply_fpregset (const struct sparc_fpregmap *fpregmap,
- struct regcache *regcache,
- int regnum, const void *fpregs)
+ struct regcache *regcache, int regnum,
+ const void *fpregs)
{
int sparc32 = (gdbarch_ptr_bit (regcache->arch ()) == 32);
@@ -70,8 +70,8 @@ sparc64nbsd_supply_fpregset (const struct sparc_fpregmap *fpregmap,
static void
sparc64nbsd_collect_fpregset (const struct sparc_fpregmap *fpregmap,
- const struct regcache *regcache,
- int regnum, void *fpregs)
+ const struct regcache *regcache, int regnum,
+ void *fpregs)
{
int sparc32 = (gdbarch_ptr_bit (regcache->arch ()) == 32);
@@ -97,10 +97,8 @@ sparc64nbsd_gregset_supplies_p (struct gdbarch *gdbarch, int regnum)
return 1;
/* Control registers. */
- if (regnum == SPARC64_PC_REGNUM
- || regnum == SPARC64_NPC_REGNUM
- || regnum == SPARC64_STATE_REGNUM
- || regnum == SPARC64_Y_REGNUM)
+ if (regnum == SPARC64_PC_REGNUM || regnum == SPARC64_NPC_REGNUM
+ || regnum == SPARC64_STATE_REGNUM || regnum == SPARC64_Y_REGNUM)
return 1;
return 0;
@@ -125,7 +123,6 @@ sparc64nbsd_fpregset_supplies_p (struct gdbarch *gdbarch, int regnum)
return 0;
}
-
/* Support for debugging kernel virtual memory images. */
@@ -153,8 +150,8 @@ sparc64nbsd_supply_pcb (struct regcache *regcache, struct pcb *pcb)
/* If the program counter is zero, this is probably a core dump, and
we can get %pc from the stack. */
if (pcb->pcb_pc == 0)
- read_memory(pcb->pcb_sp + BIAS - 176 + (11 * 8),
- (gdb_byte *)&pcb->pcb_pc, sizeof pcb->pcb_pc);
+ read_memory (pcb->pcb_sp + BIAS - 176 + (11 * 8),
+ (gdb_byte *) &pcb->pcb_pc, sizeof pcb->pcb_pc);
regcache->raw_supply (SPARC_SP_REGNUM, &pcb->pcb_sp);
regcache->raw_supply (SPARC64_PC_REGNUM, &pcb->pcb_pc);
@@ -171,6 +168,7 @@ sparc64nbsd_supply_pcb (struct regcache *regcache, struct pcb *pcb)
static sparc_target<inf_ptrace_target> the_sparc64_nbsd_nat_target;
void _initialize_sparc64nbsd_nat ();
+
void
_initialize_sparc64nbsd_nat ()
{
diff --git a/gdb/sparc64-netbsd-tdep.c b/gdb/sparc64-netbsd-tdep.c
index c53ee4bc4e4..52e46fbabe0 100644
--- a/gdb/sparc64-netbsd-tdep.c
+++ b/gdb/sparc64-netbsd-tdep.c
@@ -34,36 +34,32 @@
#include "netbsd-tdep.h"
/* From <machine/reg.h>. */
-const struct sparc_gregmap sparc64nbsd_gregmap =
-{
- 0 * 8, /* "tstate" */
- 1 * 8, /* %pc */
- 2 * 8, /* %npc */
- 3 * 8, /* %y */
- -1, /* %fprs */
- -1,
- 5 * 8, /* %g1 */
- -1, /* %l0 */
- 4 /* sizeof (%y) */
+const struct sparc_gregmap sparc64nbsd_gregmap = {
+ 0 * 8, /* "tstate" */
+ 1 * 8, /* %pc */
+ 2 * 8, /* %npc */
+ 3 * 8, /* %y */
+ -1, /* %fprs */
+ -1, 5 * 8, /* %g1 */
+ -1, /* %l0 */
+ 4 /* sizeof (%y) */
};
-
static void
sparc64nbsd_supply_gregset (const struct regset *regset,
- struct regcache *regcache,
- int regnum, const void *gregs, size_t len)
+ struct regcache *regcache, int regnum,
+ const void *gregs, size_t len)
{
sparc64_supply_gregset (&sparc64nbsd_gregmap, regcache, regnum, gregs);
}
static void
sparc64nbsd_supply_fpregset (const struct regset *regset,
- struct regcache *regcache,
- int regnum, const void *fpregs, size_t len)
+ struct regcache *regcache, int regnum,
+ const void *fpregs, size_t len)
{
sparc64_supply_fpregset (&sparc64_bsd_fpregmap, regcache, regnum, fpregs);
}
-
/* Signal trampolines. */
@@ -125,8 +121,8 @@ sparc64nbsd_sigcontext_saved_regs (CORE_ADDR sigcontext_addr,
save area. */
addr = saved_regs[SPARC_SP_REGNUM].addr ();
sp = get_frame_memory_unsigned (this_frame, addr, 8);
- for (regnum = SPARC_L0_REGNUM, addr = sp + BIAS;
- regnum <= SPARC_I7_REGNUM; regnum++, addr += 8)
+ for (regnum = SPARC_L0_REGNUM, addr = sp + BIAS; regnum <= SPARC_I7_REGNUM;
+ regnum++, addr += 8)
saved_regs[regnum].set_addr (addr);
/* Handle StackGhost. */
@@ -189,8 +185,8 @@ sparc64nbsd_sigcontext_frame_this_id (frame_info_ptr this_frame,
void **this_cache,
struct frame_id *this_id)
{
- struct sparc_frame_cache *cache =
- sparc64nbsd_sigcontext_frame_cache (this_frame, this_cache);
+ struct sparc_frame_cache *cache
+ = sparc64nbsd_sigcontext_frame_cache (this_frame, this_cache);
(*this_id) = frame_id_build (cache->base, cache->pc);
}
@@ -199,8 +195,8 @@ static struct value *
sparc64nbsd_sigcontext_frame_prev_register (frame_info_ptr this_frame,
void **this_cache, int regnum)
{
- struct sparc_frame_cache *cache =
- sparc64nbsd_sigcontext_frame_cache (this_frame, this_cache);
+ struct sparc_frame_cache *cache
+ = sparc64nbsd_sigcontext_frame_cache (this_frame, this_cache);
return trad_frame_get_prev_register (this_frame, cache->saved_regs, regnum);
}
@@ -223,27 +219,20 @@ sparc64nbsd_sigtramp_frame_sniffer (const struct frame_unwind *self,
return 0;
}
-static const struct frame_unwind sparc64nbsd_sigcontext_frame_unwind =
-{
- "sparc64 netbsd sigcontext",
- SIGTRAMP_FRAME,
- default_frame_unwind_stop_reason,
- sparc64nbsd_sigcontext_frame_this_id,
- sparc64nbsd_sigcontext_frame_prev_register,
- NULL,
- sparc64nbsd_sigtramp_frame_sniffer
-};
-
+static const struct frame_unwind sparc64nbsd_sigcontext_frame_unwind
+ = { "sparc64 netbsd sigcontext",
+ SIGTRAMP_FRAME,
+ default_frame_unwind_stop_reason,
+ sparc64nbsd_sigcontext_frame_this_id,
+ sparc64nbsd_sigcontext_frame_prev_register,
+ NULL,
+ sparc64nbsd_sigtramp_frame_sniffer };
-static const struct regset sparc64nbsd_gregset =
- {
- NULL, sparc64nbsd_supply_gregset, NULL
- };
+static const struct regset sparc64nbsd_gregset
+ = { NULL, sparc64nbsd_supply_gregset, NULL };
-static const struct regset sparc64nbsd_fpregset =
- {
- NULL, sparc64nbsd_supply_fpregset, NULL
- };
+static const struct regset sparc64nbsd_fpregset
+ = { NULL, sparc64nbsd_supply_fpregset, NULL };
static void
sparc64nbsd_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
@@ -255,7 +244,7 @@ sparc64nbsd_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
tdep->gregset = &sparc64nbsd_gregset;
tdep->sizeof_gregset = 160;
- tdep->fpregset = &sparc64nbsd_fpregset;
+ tdep->fpregset = &sparc64nbsd_fpregset;
tdep->sizeof_fpregset = 272;
/* Make sure we can single-step "new" syscalls. */
@@ -267,14 +256,15 @@ sparc64nbsd_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
/* NetBSD/sparc64 has SVR4-style shared libraries. */
set_gdbarch_skip_trampoline_code (gdbarch, find_solib_trampoline_target);
- set_solib_svr4_fetch_link_map_offsets
- (gdbarch, svr4_lp64_fetch_link_map_offsets);
+ set_solib_svr4_fetch_link_map_offsets (gdbarch,
+ svr4_lp64_fetch_link_map_offsets);
}
void _initialize_sparc64nbsd_tdep ();
+
void
_initialize_sparc64nbsd_tdep ()
{
- gdbarch_register_osabi (bfd_arch_sparc, bfd_mach_sparc_v9,
- GDB_OSABI_NETBSD, sparc64nbsd_init_abi);
+ gdbarch_register_osabi (bfd_arch_sparc, bfd_mach_sparc_v9, GDB_OSABI_NETBSD,
+ sparc64nbsd_init_abi);
}
diff --git a/gdb/sparc64-obsd-nat.c b/gdb/sparc64-obsd-nat.c
index cf35abcabdf..e9f2a708dfd 100644
--- a/gdb/sparc64-obsd-nat.c
+++ b/gdb/sparc64-obsd-nat.c
@@ -39,10 +39,8 @@ sparc64obsd_gregset_supplies_p (struct gdbarch *gdbarch, int regnum)
return 1;
/* Control registers. */
- if (regnum == SPARC64_PC_REGNUM
- || regnum == SPARC64_NPC_REGNUM
- || regnum == SPARC64_STATE_REGNUM
- || regnum == SPARC64_Y_REGNUM)
+ if (regnum == SPARC64_PC_REGNUM || regnum == SPARC64_NPC_REGNUM
+ || regnum == SPARC64_STATE_REGNUM || regnum == SPARC64_Y_REGNUM)
return 1;
return 0;
@@ -64,7 +62,6 @@ sparc64obsd_fpregset_supplies_p (struct gdbarch *gdbarch, int regnum)
return 0;
}
-
/* Support for debugging kernel virtual memory images. */
@@ -92,8 +89,8 @@ sparc64obsd_supply_pcb (struct regcache *regcache, struct pcb *pcb)
/* If the program counter is zero, this is probably a core dump, and
we can get %pc from the stack. */
if (pcb->pcb_pc == 0)
- read_memory(pcb->pcb_sp + BIAS - 176 + (11 * 8),
- (gdb_byte *)&pcb->pcb_pc, sizeof pcb->pcb_pc);
+ read_memory (pcb->pcb_sp + BIAS - 176 + (11 * 8),
+ (gdb_byte *) &pcb->pcb_pc, sizeof pcb->pcb_pc);
regcache->raw_supply (SPARC_SP_REGNUM, &pcb->pcb_sp);
regcache->raw_supply (SPARC64_PC_REGNUM, &pcb->pcb_pc);
@@ -110,6 +107,7 @@ sparc64obsd_supply_pcb (struct regcache *regcache, struct pcb *pcb)
static sparc_target<obsd_nat_target> the_sparc64_obsd_nat_target;
void _initialize_sparc64obsd_nat ();
+
void
_initialize_sparc64obsd_nat ()
{
diff --git a/gdb/sparc64-obsd-tdep.c b/gdb/sparc64-obsd-tdep.c
index a4ab4535078..9c2b7f046b9 100644
--- a/gdb/sparc64-obsd-tdep.c
+++ b/gdb/sparc64-obsd-tdep.c
@@ -45,38 +45,34 @@
match the ptrace(2) layout. */
/* From <machine/reg.h>. */
-const struct sparc_gregmap sparc64obsd_gregmap =
-{
- 0 * 8, /* "tstate" */
- 1 * 8, /* %pc */
- 2 * 8, /* %npc */
- 3 * 8, /* %y */
- -1, /* %fprs */
- -1,
- 5 * 8, /* %g1 */
- 20 * 8, /* %l0 */
- 4 /* sizeof (%y) */
+const struct sparc_gregmap sparc64obsd_gregmap = {
+ 0 * 8, /* "tstate" */
+ 1 * 8, /* %pc */
+ 2 * 8, /* %npc */
+ 3 * 8, /* %y */
+ -1, /* %fprs */
+ -1, 5 * 8, /* %g1 */
+ 20 * 8, /* %l0 */
+ 4 /* sizeof (%y) */
};
-const struct sparc_gregmap sparc64obsd_core_gregmap =
-{
- 0 * 8, /* "tstate" */
- 1 * 8, /* %pc */
- 2 * 8, /* %npc */
- 3 * 8, /* %y */
- -1, /* %fprs */
- -1,
- 7 * 8, /* %g1 */
- 22 * 8, /* %l0 */
- 4 /* sizeof (%y) */
+const struct sparc_gregmap sparc64obsd_core_gregmap = {
+ 0 * 8, /* "tstate" */
+ 1 * 8, /* %pc */
+ 2 * 8, /* %npc */
+ 3 * 8, /* %y */
+ -1, /* %fprs */
+ -1, 7 * 8, /* %g1 */
+ 22 * 8, /* %l0 */
+ 4 /* sizeof (%y) */
};
static void
sparc64obsd_supply_gregset (const struct regset *regset,
- struct regcache *regcache,
- int regnum, const void *gregs, size_t len)
+ struct regcache *regcache, int regnum,
+ const void *gregs, size_t len)
{
- const void *fpregs = (char *)gregs + 288;
+ const void *fpregs = (char *) gregs + 288;
if (len < 832)
{
@@ -90,12 +86,11 @@ sparc64obsd_supply_gregset (const struct regset *regset,
static void
sparc64obsd_supply_fpregset (const struct regset *regset,
- struct regcache *regcache,
- int regnum, const void *fpregs, size_t len)
+ struct regcache *regcache, int regnum,
+ const void *fpregs, size_t len)
{
sparc64_supply_fpregset (&sparc64_bsd_fpregmap, regcache, regnum, fpregs);
}
-
/* Signal trampolines. */
@@ -114,12 +109,10 @@ sparc64obsd_supply_fpregset (const struct regset *regset,
static const int sparc64obsd_page_size = 8192;
/* Offset for sigreturn(2). */
-static const int sparc64obsd_sigreturn_offset[] = {
- 0xf0, /* OpenBSD 3.8 */
- 0xec, /* OpenBSD 3.6 */
- 0xe8, /* OpenBSD 3.2 */
- -1
-};
+static const int sparc64obsd_sigreturn_offset[] = { 0xf0, /* OpenBSD 3.8 */
+ 0xec, /* OpenBSD 3.6 */
+ 0xe8, /* OpenBSD 3.2 */
+ -1 };
static int
sparc64obsd_pc_in_sigtramp (CORE_ADDR pc, const char *name)
@@ -189,18 +182,18 @@ static void
sparc64obsd_frame_this_id (frame_info_ptr this_frame, void **this_cache,
struct frame_id *this_id)
{
- struct sparc_frame_cache *cache =
- sparc64obsd_frame_cache (this_frame, this_cache);
+ struct sparc_frame_cache *cache
+ = sparc64obsd_frame_cache (this_frame, this_cache);
(*this_id) = frame_id_build (cache->base, cache->pc);
}
static struct value *
-sparc64obsd_frame_prev_register (frame_info_ptr this_frame,
- void **this_cache, int regnum)
+sparc64obsd_frame_prev_register (frame_info_ptr this_frame, void **this_cache,
+ int regnum)
{
- struct sparc_frame_cache *cache =
- sparc64obsd_frame_cache (this_frame, this_cache);
+ struct sparc_frame_cache *cache
+ = sparc64obsd_frame_cache (this_frame, this_cache);
return trad_frame_get_prev_register (this_frame, cache->saved_regs, regnum);
}
@@ -220,17 +213,12 @@ sparc64obsd_sigtramp_frame_sniffer (const struct frame_unwind *self,
return 0;
}
-static const struct frame_unwind sparc64obsd_frame_unwind =
-{
- "sparc64 openbsd sigtramp",
- SIGTRAMP_FRAME,
- default_frame_unwind_stop_reason,
- sparc64obsd_frame_this_id,
- sparc64obsd_frame_prev_register,
- NULL,
- sparc64obsd_sigtramp_frame_sniffer
-};
-
+static const struct frame_unwind sparc64obsd_frame_unwind
+ = { "sparc64 openbsd sigtramp", SIGTRAMP_FRAME,
+ default_frame_unwind_stop_reason, sparc64obsd_frame_this_id,
+ sparc64obsd_frame_prev_register, NULL,
+ sparc64obsd_sigtramp_frame_sniffer };
+
/* Kernel debugging support. */
static struct sparc_frame_cache *
@@ -263,11 +251,11 @@ sparc64obsd_trapframe_cache (frame_info_ptr this_frame, void **this_cache)
}
static void
-sparc64obsd_trapframe_this_id (frame_info_ptr this_frame,
- void **this_cache, struct frame_id *this_id)
+sparc64obsd_trapframe_this_id (frame_info_ptr this_frame, void **this_cache,
+ struct frame_id *this_id)
{
- struct sparc_frame_cache *cache =
- sparc64obsd_trapframe_cache (this_frame, this_cache);
+ struct sparc_frame_cache *cache
+ = sparc64obsd_trapframe_cache (this_frame, this_cache);
(*this_id) = frame_id_build (cache->base, cache->pc);
}
@@ -276,16 +264,15 @@ static struct value *
sparc64obsd_trapframe_prev_register (frame_info_ptr this_frame,
void **this_cache, int regnum)
{
- struct sparc_frame_cache *cache =
- sparc64obsd_trapframe_cache (this_frame, this_cache);
+ struct sparc_frame_cache *cache
+ = sparc64obsd_trapframe_cache (this_frame, this_cache);
return trad_frame_get_prev_register (this_frame, cache->saved_regs, regnum);
}
static int
sparc64obsd_trapframe_sniffer (const struct frame_unwind *self,
- frame_info_ptr this_frame,
- void **this_cache)
+ frame_info_ptr this_frame, void **this_cache)
{
CORE_ADDR pc;
ULONGEST pstate;
@@ -304,27 +291,24 @@ sparc64obsd_trapframe_sniffer (const struct frame_unwind *self,
return 0;
}
-static const struct frame_unwind sparc64obsd_trapframe_unwind =
-{
- "sparc64 openbsd trap",
- NORMAL_FRAME,
- default_frame_unwind_stop_reason,
- sparc64obsd_trapframe_this_id,
- sparc64obsd_trapframe_prev_register,
- NULL,
- sparc64obsd_trapframe_sniffer
-};
-
+static const struct frame_unwind sparc64obsd_trapframe_unwind
+ = { "sparc64 openbsd trap",
+ NORMAL_FRAME,
+ default_frame_unwind_stop_reason,
+ sparc64obsd_trapframe_this_id,
+ sparc64obsd_trapframe_prev_register,
+ NULL,
+ sparc64obsd_trapframe_sniffer };
/* Threads support. */
/* Offset wthin the thread structure where we can find %fp and %i7. */
-#define SPARC64OBSD_UTHREAD_FP_OFFSET 232
-#define SPARC64OBSD_UTHREAD_PC_OFFSET 240
+#define SPARC64OBSD_UTHREAD_FP_OFFSET 232
+#define SPARC64OBSD_UTHREAD_PC_OFFSET 240
static void
-sparc64obsd_supply_uthread (struct regcache *regcache,
- int regnum, CORE_ADDR addr)
+sparc64obsd_supply_uthread (struct regcache *regcache, int regnum,
+ CORE_ADDR addr)
{
struct gdbarch *gdbarch = regcache->arch ();
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
@@ -371,8 +355,8 @@ sparc64obsd_supply_uthread (struct regcache *regcache,
}
static void
-sparc64obsd_collect_uthread(const struct regcache *regcache,
- int regnum, CORE_ADDR addr)
+sparc64obsd_collect_uthread (const struct regcache *regcache, int regnum,
+ CORE_ADDR addr)
{
struct gdbarch *gdbarch = regcache->arch ();
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
@@ -389,7 +373,7 @@ sparc64obsd_collect_uthread(const struct regcache *regcache,
CORE_ADDR fp_addr = addr + SPARC64OBSD_UTHREAD_FP_OFFSET;
regcache->raw_collect (SPARC_SP_REGNUM, buf);
- write_memory (fp_addr,buf, 8);
+ write_memory (fp_addr, buf, 8);
}
if (regnum == SPARC64_PC_REGNUM || regnum == -1)
@@ -408,17 +392,12 @@ sparc64obsd_collect_uthread(const struct regcache *regcache,
sp = extract_unsigned_integer (buf, 8, byte_order);
sparc_collect_rwindow (regcache, sp, regnum);
}
-
-static const struct regset sparc64obsd_gregset =
- {
- NULL, sparc64obsd_supply_gregset, NULL
- };
+static const struct regset sparc64obsd_gregset
+ = { NULL, sparc64obsd_supply_gregset, NULL };
-static const struct regset sparc64obsd_fpregset =
- {
- NULL, sparc64obsd_supply_fpregset, NULL
- };
+static const struct regset sparc64obsd_fpregset
+ = { NULL, sparc64obsd_supply_fpregset, NULL };
static void
sparc64obsd_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
@@ -440,8 +419,8 @@ sparc64obsd_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
obsd_init_abi (info, gdbarch);
/* OpenBSD/sparc64 has SVR4-style shared libraries. */
- set_solib_svr4_fetch_link_map_offsets
- (gdbarch, svr4_lp64_fetch_link_map_offsets);
+ set_solib_svr4_fetch_link_map_offsets (gdbarch,
+ svr4_lp64_fetch_link_map_offsets);
set_gdbarch_skip_solib_resolver (gdbarch, obsd_skip_solib_resolver);
/* OpenBSD provides a user-level threads implementation. */
@@ -450,9 +429,10 @@ sparc64obsd_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
}
void _initialize_sparc64obsd_tdep ();
+
void
_initialize_sparc64obsd_tdep ()
{
- gdbarch_register_osabi (bfd_arch_sparc, bfd_mach_sparc_v9,
- GDB_OSABI_OPENBSD, sparc64obsd_init_abi);
+ gdbarch_register_osabi (bfd_arch_sparc, bfd_mach_sparc_v9, GDB_OSABI_OPENBSD,
+ sparc64obsd_init_abi);
}
diff --git a/gdb/sparc64-sol2-tdep.c b/gdb/sparc64-sol2-tdep.c
index 9daefa25a6b..f4bd63cdc20 100644
--- a/gdb/sparc64-sol2-tdep.c
+++ b/gdb/sparc64-sol2-tdep.c
@@ -32,45 +32,43 @@
#include "solib-svr4.h"
/* From <sys/regset.h>. */
-const struct sparc_gregmap sparc64_sol2_gregmap =
-{
- 32 * 8, /* "tstate" */
- 33 * 8, /* %pc */
- 34 * 8, /* %npc */
- 35 * 8, /* %y */
- -1, /* %wim */
- -1, /* %tbr */
- 1 * 8, /* %g1 */
- 16 * 8, /* %l0 */
- 8 /* sizeof (%y) */
+const struct sparc_gregmap sparc64_sol2_gregmap = {
+ 32 * 8, /* "tstate" */
+ 33 * 8, /* %pc */
+ 34 * 8, /* %npc */
+ 35 * 8, /* %y */
+ -1, /* %wim */
+ -1, /* %tbr */
+ 1 * 8, /* %g1 */
+ 16 * 8, /* %l0 */
+ 8 /* sizeof (%y) */
};
-const struct sparc_fpregmap sparc64_sol2_fpregmap =
-{
- 0 * 8, /* %f0 */
- 33 * 8, /* %fsr */
+const struct sparc_fpregmap sparc64_sol2_fpregmap = {
+ 0 * 8, /* %f0 */
+ 33 * 8, /* %fsr */
};
static void
sparc64_sol2_supply_core_gregset (const struct regset *regset,
- struct regcache *regcache,
- int regnum, const void *gregs, size_t len)
+ struct regcache *regcache, int regnum,
+ const void *gregs, size_t len)
{
sparc64_supply_gregset (&sparc64_sol2_gregmap, regcache, regnum, gregs);
}
static void
sparc64_sol2_collect_core_gregset (const struct regset *regset,
- const struct regcache *regcache,
- int regnum, void *gregs, size_t len)
+ const struct regcache *regcache, int regnum,
+ void *gregs, size_t len)
{
sparc64_collect_gregset (&sparc64_sol2_gregmap, regcache, regnum, gregs);
}
static void
sparc64_sol2_supply_core_fpregset (const struct regset *regset,
- struct regcache *regcache,
- int regnum, const void *fpregs, size_t len)
+ struct regcache *regcache, int regnum,
+ const void *fpregs, size_t len)
{
sparc64_supply_fpregset (&sparc64_sol2_fpregmap, regcache, regnum, fpregs);
}
@@ -83,20 +81,13 @@ sparc64_sol2_collect_core_fpregset (const struct regset *regset,
sparc64_collect_fpregset (&sparc64_sol2_fpregmap, regcache, regnum, fpregs);
}
-static const struct regset sparc64_sol2_gregset =
- {
- NULL,
- sparc64_sol2_supply_core_gregset,
- sparc64_sol2_collect_core_gregset
- };
-
-static const struct regset sparc64_sol2_fpregset =
- {
- NULL,
- sparc64_sol2_supply_core_fpregset,
- sparc64_sol2_collect_core_fpregset
- };
-
+static const struct regset sparc64_sol2_gregset
+ = { NULL, sparc64_sol2_supply_core_gregset,
+ sparc64_sol2_collect_core_gregset };
+
+static const struct regset sparc64_sol2_fpregset
+ = { NULL, sparc64_sol2_supply_core_fpregset,
+ sparc64_sol2_collect_core_fpregset };
static struct sparc_frame_cache *
sparc64_sol2_sigtramp_frame_cache (frame_info_ptr this_frame,
@@ -117,8 +108,8 @@ sparc64_sol2_sigtramp_frame_cache (frame_info_ptr this_frame,
/* The third argument is a pointer to an instance of `ucontext_t',
which has a member `uc_mcontext' that contains the saved
registers. */
- regnum =
- (cache->copied_regs_mask & 0x04) ? SPARC_I2_REGNUM : SPARC_O2_REGNUM;
+ regnum
+ = (cache->copied_regs_mask & 0x04) ? SPARC_I2_REGNUM : SPARC_O2_REGNUM;
mcontext_addr = get_frame_register_unsigned (this_frame, regnum) + 64;
cache->saved_regs[SPARC64_CCR_REGNUM].set_addr (mcontext_addr + 0 * 8);
@@ -158,19 +149,18 @@ sparc64_sol2_sigtramp_frame_this_id (frame_info_ptr this_frame,
void **this_cache,
struct frame_id *this_id)
{
- struct sparc_frame_cache *cache =
- sparc64_sol2_sigtramp_frame_cache (this_frame, this_cache);
+ struct sparc_frame_cache *cache
+ = sparc64_sol2_sigtramp_frame_cache (this_frame, this_cache);
(*this_id) = frame_id_build (cache->base, cache->pc);
}
static struct value *
sparc64_sol2_sigtramp_frame_prev_register (frame_info_ptr this_frame,
- void **this_cache,
- int regnum)
+ void **this_cache, int regnum)
{
- struct sparc_frame_cache *cache =
- sparc64_sol2_sigtramp_frame_cache (this_frame, this_cache);
+ struct sparc_frame_cache *cache
+ = sparc64_sol2_sigtramp_frame_cache (this_frame, this_cache);
return trad_frame_get_prev_register (this_frame, cache->saved_regs, regnum);
}
@@ -183,18 +173,14 @@ sparc64_sol2_sigtramp_frame_sniffer (const struct frame_unwind *self,
return sol2_sigtramp_p (this_frame);
}
-static const struct frame_unwind sparc64_sol2_sigtramp_frame_unwind =
-{
- "sparc64 solaris sigtramp",
- SIGTRAMP_FRAME,
- default_frame_unwind_stop_reason,
- sparc64_sol2_sigtramp_frame_this_id,
- sparc64_sol2_sigtramp_frame_prev_register,
- NULL,
- sparc64_sol2_sigtramp_frame_sniffer
-};
-
-
+static const struct frame_unwind sparc64_sol2_sigtramp_frame_unwind
+ = { "sparc64 solaris sigtramp",
+ SIGTRAMP_FRAME,
+ default_frame_unwind_stop_reason,
+ sparc64_sol2_sigtramp_frame_this_id,
+ sparc64_sol2_sigtramp_frame_prev_register,
+ NULL,
+ sparc64_sol2_sigtramp_frame_sniffer };
static void
sparc64_sol2_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
@@ -215,8 +201,8 @@ sparc64_sol2_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
/* Solaris has SVR4-style shared libraries... */
set_gdbarch_skip_trampoline_code (gdbarch, find_solib_trampoline_target);
- set_solib_svr4_fetch_link_map_offsets
- (gdbarch, svr4_lp64_fetch_link_map_offsets);
+ set_solib_svr4_fetch_link_map_offsets (gdbarch,
+ svr4_lp64_fetch_link_map_offsets);
/* ...which means that we need some special handling when doing
prologue analysis. */
@@ -227,9 +213,10 @@ sparc64_sol2_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
}
void _initialize_sparc64_sol2_tdep ();
+
void
_initialize_sparc64_sol2_tdep ()
{
- gdbarch_register_osabi (bfd_arch_sparc, bfd_mach_sparc_v9,
- GDB_OSABI_SOLARIS, sparc64_sol2_init_abi);
+ gdbarch_register_osabi (bfd_arch_sparc, bfd_mach_sparc_v9, GDB_OSABI_SOLARIS,
+ sparc64_sol2_init_abi);
}
diff --git a/gdb/sparc64-tdep.c b/gdb/sparc64-tdep.c
index 96910be3f0e..2f2160b24f3 100644
--- a/gdb/sparc64-tdep.c
+++ b/gdb/sparc64-tdep.c
@@ -44,7 +44,7 @@
/* Please use the sparc32_-prefix for 32-bit specific code, the
sparc64_-prefix for 64-bit specific code and the sparc_-prefix for
code can handle both. */
-
+
/* The M7 processor supports an Application Data Integrity (ADI) feature
that detects invalid data accesses. When software allocates memory and
enables ADI on the allocated memory, it chooses a 4-bit version number,
@@ -63,23 +63,22 @@
Note that 32-bit applications cannot use ADI. */
-
#include <algorithm>
#include "cli/cli-utils.h"
#include "gdbcmd.h"
#include "auxv.h"
-#define MAX_PROC_NAME_SIZE sizeof("/proc/99999/lwp/9999/adi/lstatus")
+#define MAX_PROC_NAME_SIZE sizeof ("/proc/99999/lwp/9999/adi/lstatus")
/* ELF Auxiliary vectors */
#ifndef AT_ADI_BLKSZ
-#define AT_ADI_BLKSZ 34
+#define AT_ADI_BLKSZ 34
#endif
#ifndef AT_ADI_NBITS
-#define AT_ADI_NBITS 35
+#define AT_ADI_NBITS 35
#endif
#ifndef AT_ADI_UEONADI
-#define AT_ADI_UEONADI 36
+#define AT_ADI_UEONADI 36
#endif
/* ADI command list. */
@@ -107,7 +106,6 @@ struct adi_stat_t
/* ADI is available. */
bool is_avail = false;
-
};
/* Per-process ADI stat info. */
@@ -116,29 +114,27 @@ struct sparc64_adi_info
{
sparc64_adi_info (pid_t pid_)
: pid (pid_)
- {}
+ {
+ }
/* The process identifier. */
pid_t pid;
/* The ADI stat. */
adi_stat_t stat = {};
-
};
static std::forward_list<sparc64_adi_info> adi_proc_list;
-
/* Get ADI info for process PID, creating one if it doesn't exist. */
-static sparc64_adi_info *
+static sparc64_adi_info *
get_adi_info_proc (pid_t pid)
{
auto found = std::find_if (adi_proc_list.begin (), adi_proc_list.end (),
- [&pid] (const sparc64_adi_info &info)
- {
- return info.pid == pid;
- });
+ [&pid] (const sparc64_adi_info &info) {
+ return info.pid == pid;
+ });
if (found == adi_proc_list.end ())
{
@@ -151,7 +147,7 @@ get_adi_info_proc (pid_t pid)
}
}
-static adi_stat_t
+static adi_stat_t
get_adi_info (pid_t pid)
{
sparc64_adi_info *proc;
@@ -168,14 +164,12 @@ sparc64_forget_process (pid_t pid)
{
fileio_error target_errno;
- for (auto pit = adi_proc_list.before_begin (),
- it = std::next (pit);
- it != adi_proc_list.end ();
- )
+ for (auto pit = adi_proc_list.before_begin (), it = std::next (pit);
+ it != adi_proc_list.end ();)
{
if ((*it).pid == pid)
{
- if ((*it).stat.tag_fd > 0)
+ if ((*it).stat.tag_fd > 0)
target_fileio_close ((*it).stat.tag_fd, &target_errno);
adi_proc_list.erase_after (pit);
break;
@@ -183,14 +177,12 @@ sparc64_forget_process (pid_t pid)
else
pit = it++;
}
-
}
/* Read attributes of a maps entry in /proc/[pid]/adi/maps. */
static void
-read_maps_entry (const char *line,
- ULONGEST *addr, ULONGEST *endaddr)
+read_maps_entry (const char *line, ULONGEST *addr, ULONGEST *endaddr)
{
const char *p = line;
@@ -284,9 +276,9 @@ adi_tag_fd (void)
return proc->stat.tag_fd;
char cl_name[MAX_PROC_NAME_SIZE];
- snprintf (cl_name, sizeof(cl_name), "/proc/%ld/adi/tags", (long) pid);
+ snprintf (cl_name, sizeof (cl_name), "/proc/%ld/adi/tags", (long) pid);
fileio_error target_errno;
- proc->stat.tag_fd = target_fileio_open (NULL, cl_name, O_RDWR|O_EXCL,
+ proc->stat.tag_fd = target_fileio_open (NULL, cl_name, O_RDWR | O_EXCL,
false, 0, &target_errno);
return proc->stat.tag_fd;
}
@@ -309,8 +301,7 @@ adi_is_addr_mapped (CORE_ADDR vaddr, size_t cnt)
{
adi_stat_t adi_stat = get_adi_info (pid);
char *saveptr;
- for (char *line = strtok_r (data.get (), "\n", &saveptr);
- line;
+ for (char *line = strtok_r (data.get (), "\n", &saveptr); line;
line = strtok_r (NULL, "\n", &saveptr))
{
ULONGEST addr, endaddr;
@@ -324,9 +315,9 @@ adi_is_addr_mapped (CORE_ADDR vaddr, size_t cnt)
return true;
}
}
- }
+ }
else
- warning (_("unable to open /proc file '%s'"), filename);
+ warning (_ ("unable to open /proc file '%s'"), filename);
return false;
}
@@ -344,8 +335,8 @@ adi_read_versions (CORE_ADDR vaddr, size_t size, gdb_byte *tags)
if (!adi_is_addr_mapped (vaddr, size))
{
adi_stat_t ast = get_adi_info (inferior_ptid.pid ());
- error(_("Address at %s is not in ADI maps"),
- paddress (target_gdbarch (), vaddr * ast.blksize));
+ error (_ ("Address at %s is not in ADI maps"),
+ paddress (target_gdbarch (), vaddr * ast.blksize));
}
fileio_error target_errno;
@@ -365,8 +356,8 @@ adi_write_versions (CORE_ADDR vaddr, size_t size, unsigned char *tags)
if (!adi_is_addr_mapped (vaddr, size))
{
adi_stat_t ast = get_adi_info (inferior_ptid.pid ());
- error(_("Address at %s is not in ADI maps"),
- paddress (target_gdbarch (), vaddr * ast.blksize));
+ error (_ ("Address at %s is not in ADI maps"),
+ paddress (target_gdbarch (), vaddr * ast.blksize));
}
fileio_error target_errno;
@@ -380,7 +371,7 @@ static void
adi_print_versions (CORE_ADDR vaddr, size_t cnt, gdb_byte *tags)
{
int v_idx = 0;
- const int maxelts = 8; /* # of elements per line */
+ const int maxelts = 8; /* # of elements per line */
adi_stat_t adi_stat = get_adi_info (inferior_ptid.pid ());
@@ -391,7 +382,7 @@ adi_print_versions (CORE_ADDR vaddr, size_t cnt, gdb_byte *tags)
paddress (target_gdbarch (), vaddr * adi_stat.blksize));
for (int i = maxelts; i > 0 && cnt > 0; i--, cnt--)
{
- if (tags[v_idx] == 0xff) /* no version tag */
+ if (tags[v_idx] == 0xff) /* no version tag */
gdb_printf ("-");
else
gdb_printf ("%1X", tags[v_idx]);
@@ -414,9 +405,10 @@ do_examine (CORE_ADDR start, int bcnt)
gdb::def_vector<gdb_byte> buf (cnt);
int read_cnt = adi_read_versions (vstart, cnt, buf.data ());
if (read_cnt == -1)
- error (_("No ADI information"));
+ error (_ ("No ADI information"));
else if (read_cnt < cnt)
- error(_("No ADI information at %s"), paddress (target_gdbarch (), vaddr));
+ error (_ ("No ADI information at %s"),
+ paddress (target_gdbarch (), vaddr));
adi_print_versions (vstart, cnt, buf.data ());
}
@@ -432,10 +424,10 @@ do_assign (CORE_ADDR start, size_t bcnt, int version)
int set_cnt = adi_write_versions (vstart, cnt, buf.data ());
if (set_cnt == -1)
- error (_("No ADI information"));
+ error (_ ("No ADI information"));
else if (set_cnt < cnt)
- error(_("No ADI information at %s"), paddress (target_gdbarch (), vaddr));
-
+ error (_ ("No ADI information at %s"),
+ paddress (target_gdbarch (), vaddr));
}
/* ADI examine version tag command.
@@ -449,10 +441,10 @@ adi_examine_command (const char *args, int from_tty)
{
/* make sure program is active and adi is available */
if (!target_has_execution ())
- error (_("ADI command requires a live process/thread"));
+ error (_ ("ADI command requires a live process/thread"));
if (!adi_available ())
- error (_("No ADI information"));
+ error (_ ("No ADI information"));
int cnt = 1;
const char *p = args;
@@ -466,7 +458,7 @@ adi_examine_command (const char *args, int from_tty)
if (p != 0 && *p != 0)
next_address = parse_and_eval_address (p);
if (!cnt || !next_address)
- error (_("Usage: adi examine|x[/COUNT] [ADDR]"));
+ error (_ ("Usage: adi examine|x[/COUNT] [ADDR]"));
do_examine (next_address, cnt);
}
@@ -481,24 +473,24 @@ static void
adi_assign_command (const char *args, int from_tty)
{
static const char *adi_usage
- = N_("Usage: adi assign|a[/COUNT] ADDR = VERSION");
+ = N_ ("Usage: adi assign|a[/COUNT] ADDR = VERSION");
/* make sure program is active and adi is available */
if (!target_has_execution ())
- error (_("ADI command requires a live process/thread"));
+ error (_ ("ADI command requires a live process/thread"));
if (!adi_available ())
- error (_("No ADI information"));
+ error (_ ("No ADI information"));
const char *exp = args;
if (exp == 0)
- error_no_arg (_(adi_usage));
+ error_no_arg (_ (adi_usage));
char *q = (char *) strchr (exp, '=');
if (q)
*q++ = 0;
else
- error ("%s", _(adi_usage));
+ error ("%s", _ (adi_usage));
size_t cnt = 1;
const char *p = args;
@@ -512,36 +504,35 @@ adi_assign_command (const char *args, int from_tty)
if (p != 0 && *p != 0)
next_address = parse_and_eval_address (p);
else
- error ("%s", _(adi_usage));
+ error ("%s", _ (adi_usage));
int version = 0;
- if (q != NULL) /* parse version tag */
+ if (q != NULL) /* parse version tag */
{
adi_stat_t ast = get_adi_info (inferior_ptid.pid ());
version = parse_and_eval_long (q);
if (version < 0 || version > ast.max_version)
- error (_("Invalid ADI version tag %d"), version);
+ error (_ ("Invalid ADI version tag %d"), version);
}
do_assign (next_address, cnt, version);
}
void _initialize_sparc64_adi_tdep ();
+
void
_initialize_sparc64_adi_tdep ()
{
add_basic_prefix_cmd ("adi", class_support,
- _("ADI version related commands."),
- &sparc64adilist, 0, &cmdlist);
+ _ ("ADI version related commands."), &sparc64adilist,
+ 0, &cmdlist);
cmd_list_element *adi_examine_cmd
= add_cmd ("examine", class_support, adi_examine_command,
- _("Examine ADI versions."), &sparc64adilist);
+ _ ("Examine ADI versions."), &sparc64adilist);
add_alias_cmd ("x", adi_examine_cmd, no_class, 1, &sparc64adilist);
add_cmd ("assign", class_support, adi_assign_command,
- _("Assign ADI versions."), &sparc64adilist);
-
+ _ ("Assign ADI versions."), &sparc64adilist);
}
-
/* The functions on this page are intended to be used to classify
function arguments. */
@@ -639,7 +630,6 @@ sparc64_structure_or_union_p (const struct type *type)
return 0;
}
-
/* Construct types for ISA-specific registers. */
@@ -748,36 +738,25 @@ sparc64_fprs_type (struct gdbarch *gdbarch)
return tdep->sparc64_fprs_type;
}
-
/* Register information. */
-#define SPARC64_FPU_REGISTERS \
- "f0", "f1", "f2", "f3", "f4", "f5", "f6", "f7", \
- "f8", "f9", "f10", "f11", "f12", "f13", "f14", "f15", \
- "f16", "f17", "f18", "f19", "f20", "f21", "f22", "f23", \
- "f24", "f25", "f26", "f27", "f28", "f29", "f30", "f31", \
- "f32", "f34", "f36", "f38", "f40", "f42", "f44", "f46", \
- "f48", "f50", "f52", "f54", "f56", "f58", "f60", "f62"
-#define SPARC64_CP0_REGISTERS \
- "pc", "npc", \
- /* FIXME: Give "state" a name until we start using register groups. */ \
- "state", \
- "fsr", \
- "fprs", \
- "y"
-
-static const char * const sparc64_fpu_register_names[] = {
- SPARC64_FPU_REGISTERS
-};
-static const char * const sparc64_cp0_register_names[] = {
- SPARC64_CP0_REGISTERS
-};
-
-static const char * const sparc64_register_names[] =
-{
- SPARC_CORE_REGISTERS,
- SPARC64_FPU_REGISTERS,
- SPARC64_CP0_REGISTERS
-};
+#define SPARC64_FPU_REGISTERS \
+ "f0", "f1", "f2", "f3", "f4", "f5", "f6", "f7", "f8", "f9", "f10", "f11", \
+ "f12", "f13", "f14", "f15", "f16", "f17", "f18", "f19", "f20", "f21", \
+ "f22", "f23", "f24", "f25", "f26", "f27", "f28", "f29", "f30", "f31", \
+ "f32", "f34", "f36", "f38", "f40", "f42", "f44", "f46", "f48", "f50", \
+ "f52", "f54", "f56", "f58", "f60", "f62"
+#define SPARC64_CP0_REGISTERS \
+ "pc", \
+ "npc", /* FIXME: Give "state" a name until we start using register groups. */ \
+ "state", "fsr", "fprs", "y"
+
+static const char *const sparc64_fpu_register_names[]
+ = { SPARC64_FPU_REGISTERS };
+static const char *const sparc64_cp0_register_names[]
+ = { SPARC64_CP0_REGISTERS };
+
+static const char *const sparc64_register_names[]
+ = { SPARC_CORE_REGISTERS, SPARC64_FPU_REGISTERS, SPARC64_CP0_REGISTERS };
/* Total number of registers. */
#define SPARC64_NUM_REGS ARRAY_SIZE (sparc64_register_names)
@@ -785,17 +764,16 @@ static const char * const sparc64_register_names[] =
/* We provide the aliases %d0..%d62 and %q0..%q60 for the floating
registers as "psuedo" registers. */
-static const char * const sparc64_pseudo_register_names[] =
-{
+static const char *const sparc64_pseudo_register_names[] = {
"cwp", "pstate", "asi", "ccr",
- "d0", "d2", "d4", "d6", "d8", "d10", "d12", "d14",
- "d16", "d18", "d20", "d22", "d24", "d26", "d28", "d30",
- "d32", "d34", "d36", "d38", "d40", "d42", "d44", "d46",
- "d48", "d50", "d52", "d54", "d56", "d58", "d60", "d62",
+ "d0", "d2", "d4", "d6", "d8", "d10", "d12", "d14",
+ "d16", "d18", "d20", "d22", "d24", "d26", "d28", "d30",
+ "d32", "d34", "d36", "d38", "d40", "d42", "d44", "d46",
+ "d48", "d50", "d52", "d54", "d56", "d58", "d60", "d62",
- "q0", "q4", "q8", "q12", "q16", "q20", "q24", "q28",
- "q32", "q36", "q40", "q44", "q48", "q52", "q56", "q60",
+ "q0", "q4", "q8", "q12", "q16", "q20", "q24", "q28",
+ "q32", "q36", "q40", "q44", "q48", "q52", "q56", "q60",
};
/* Total number of pseudo registers. */
@@ -847,7 +825,7 @@ sparc64_pseudo_register_type (struct gdbarch *gdbarch, int regnum)
if (regnum >= SPARC64_Q0_REGNUM && regnum <= SPARC64_Q60_REGNUM)
return builtin_type (gdbarch)->builtin_long_double;
- internal_error (_("sparc64_pseudo_register_type: bad register number %d"),
+ internal_error (_ ("sparc64_pseudo_register_type: bad register number %d"),
regnum);
}
@@ -888,13 +866,13 @@ sparc64_register_type (struct gdbarch *gdbarch, int regnum)
if (regnum >= gdbarch_num_regs (gdbarch))
return sparc64_pseudo_register_type (gdbarch, regnum);
- internal_error (_("invalid regnum"));
+ internal_error (_ ("invalid regnum"));
}
static enum register_status
sparc64_pseudo_register_read (struct gdbarch *gdbarch,
- readable_regcache *regcache,
- int regnum, gdb_byte *buf)
+ readable_regcache *regcache, int regnum,
+ gdb_byte *buf)
{
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
enum register_status status;
@@ -938,10 +916,8 @@ sparc64_pseudo_register_read (struct gdbarch *gdbarch,
return status;
}
- else if (regnum == SPARC64_CWP_REGNUM
- || regnum == SPARC64_PSTATE_REGNUM
- || regnum == SPARC64_ASI_REGNUM
- || regnum == SPARC64_CCR_REGNUM)
+ else if (regnum == SPARC64_CWP_REGNUM || regnum == SPARC64_PSTATE_REGNUM
+ || regnum == SPARC64_ASI_REGNUM || regnum == SPARC64_CCR_REGNUM)
{
ULONGEST state;
@@ -972,8 +948,8 @@ sparc64_pseudo_register_read (struct gdbarch *gdbarch,
static void
sparc64_pseudo_register_write (struct gdbarch *gdbarch,
- struct regcache *regcache,
- int regnum, const gdb_byte *buf)
+ struct regcache *regcache, int regnum,
+ const gdb_byte *buf)
{
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
@@ -1004,10 +980,8 @@ sparc64_pseudo_register_write (struct gdbarch *gdbarch,
regcache->raw_write (regnum, buf);
regcache->raw_write (regnum + 1, buf + 8);
}
- else if (regnum == SPARC64_CWP_REGNUM
- || regnum == SPARC64_PSTATE_REGNUM
- || regnum == SPARC64_ASI_REGNUM
- || regnum == SPARC64_CCR_REGNUM)
+ else if (regnum == SPARC64_CWP_REGNUM || regnum == SPARC64_PSTATE_REGNUM
+ || regnum == SPARC64_ASI_REGNUM || regnum == SPARC64_CCR_REGNUM)
{
ULONGEST state, bits;
@@ -1031,7 +1005,6 @@ sparc64_pseudo_register_write (struct gdbarch *gdbarch,
regcache_raw_write_unsigned (regcache, SPARC64_STATE_REGNUM, state);
}
}
-
/* Return PC of first real instruction of the function starting at
START_PC. */
@@ -1049,8 +1022,7 @@ sparc64_skip_prologue (struct gdbarch *gdbarch, CORE_ADDR start_pc)
{
sal = find_pc_line (func_start, 0);
- if (sal.end < func_end
- && start_pc <= sal.end)
+ if (sal.end < func_end && start_pc <= sal.end)
return sal.end;
}
@@ -1070,8 +1042,8 @@ static void
sparc64_frame_this_id (frame_info_ptr this_frame, void **this_cache,
struct frame_id *this_id)
{
- struct sparc_frame_cache *cache =
- sparc64_frame_cache (this_frame, this_cache);
+ struct sparc_frame_cache *cache
+ = sparc64_frame_cache (this_frame, this_cache);
/* This marks the outermost frame. */
if (cache->base == 0)
@@ -1085,15 +1057,15 @@ sparc64_frame_prev_register (frame_info_ptr this_frame, void **this_cache,
int regnum)
{
struct gdbarch *gdbarch = get_frame_arch (this_frame);
- struct sparc_frame_cache *cache =
- sparc64_frame_cache (this_frame, this_cache);
+ struct sparc_frame_cache *cache
+ = sparc64_frame_cache (this_frame, this_cache);
if (regnum == SPARC64_PC_REGNUM || regnum == SPARC64_NPC_REGNUM)
{
CORE_ADDR pc = (regnum == SPARC64_NPC_REGNUM) ? 4 : 0;
- regnum =
- (cache->copied_regs_mask & 0x80) ? SPARC_I7_REGNUM : SPARC_O7_REGNUM;
+ regnum
+ = (cache->copied_regs_mask & 0x80) ? SPARC_I7_REGNUM : SPARC_O7_REGNUM;
pc += get_frame_register_unsigned (this_frame, regnum) + 8;
return frame_unwind_got_constant (this_frame, regnum, pc);
}
@@ -1132,35 +1104,28 @@ sparc64_frame_prev_register (frame_info_ptr this_frame, void **this_cache,
return frame_unwind_got_register (this_frame, regnum, regnum);
}
-static const struct frame_unwind sparc64_frame_unwind =
-{
- "sparc64 prologue",
- NORMAL_FRAME,
- default_frame_unwind_stop_reason,
- sparc64_frame_this_id,
- sparc64_frame_prev_register,
- NULL,
- default_frame_sniffer
-};
-
+static const struct frame_unwind sparc64_frame_unwind
+ = { "sparc64 prologue",
+ NORMAL_FRAME,
+ default_frame_unwind_stop_reason,
+ sparc64_frame_this_id,
+ sparc64_frame_prev_register,
+ NULL,
+ default_frame_sniffer };
static CORE_ADDR
sparc64_frame_base_address (frame_info_ptr this_frame, void **this_cache)
{
- struct sparc_frame_cache *cache =
- sparc64_frame_cache (this_frame, this_cache);
+ struct sparc_frame_cache *cache
+ = sparc64_frame_cache (this_frame, this_cache);
return cache->base;
}
-static const struct frame_base sparc64_frame_base =
-{
- &sparc64_frame_unwind,
- sparc64_frame_base_address,
- sparc64_frame_base_address,
- sparc64_frame_base_address
-};
-
+static const struct frame_base sparc64_frame_base
+ = { &sparc64_frame_unwind, sparc64_frame_base_address,
+ sparc64_frame_base_address, sparc64_frame_base_address };
+
/* Check whether TYPE must be 16-byte aligned. */
static int
@@ -1224,7 +1189,7 @@ sparc64_store_floating_fields (struct regcache *regcache, struct type *type,
regcache->cooked_write (regnum + n, valbuf + n * 4);
}
else if (sparc64_floating_p (type)
- || (sparc64_complex_floating_p (type) && len <= 16))
+ || (sparc64_complex_floating_p (type) && len <= 16))
{
int regnum;
@@ -1233,15 +1198,16 @@ sparc64_store_floating_fields (struct regcache *regcache, struct type *type,
gdb_assert (bitpos == 0);
gdb_assert ((element % 2) == 0);
- regnum = gdbarch_num_regs (gdbarch) + SPARC64_Q0_REGNUM + element / 2;
+ regnum
+ = gdbarch_num_regs (gdbarch) + SPARC64_Q0_REGNUM + element / 2;
regcache->cooked_write (regnum, valbuf);
}
else if (len == 8)
{
gdb_assert (bitpos == 0 || bitpos == 64);
- regnum = gdbarch_num_regs (gdbarch) + SPARC64_D0_REGNUM
- + element + bitpos / 64;
+ regnum = gdbarch_num_regs (gdbarch) + SPARC64_D0_REGNUM + element
+ + bitpos / 64;
regcache->cooked_write (regnum, valbuf + (bitpos / 8));
}
else
@@ -1262,8 +1228,8 @@ sparc64_store_floating_fields (struct regcache *regcache, struct type *type,
struct type *subtype = check_typedef (type->field (i).type ());
int subpos = bitpos + type->field (i).loc_bitpos ();
- sparc64_store_floating_fields (regcache, subtype, valbuf,
- element, subpos);
+ sparc64_store_floating_fields (regcache, subtype, valbuf, element,
+ subpos);
}
/* GCC has an interesting bug. If TYPE is a structure that has
@@ -1299,7 +1265,7 @@ sparc64_extract_floating_fields (struct regcache *regcache, struct type *type,
if (type->code () == TYPE_CODE_ARRAY)
{
int len = type->length ();
- int regnum = SPARC_F0_REGNUM + bitpos / 32;
+ int regnum = SPARC_F0_REGNUM + bitpos / 32;
valbuf += bitpos / 8;
if (len < 4)
@@ -1321,15 +1287,16 @@ sparc64_extract_floating_fields (struct regcache *regcache, struct type *type,
{
gdb_assert (bitpos == 0 || bitpos == 128);
- regnum = gdbarch_num_regs (gdbarch) + SPARC64_Q0_REGNUM
- + bitpos / 128;
+ regnum
+ = gdbarch_num_regs (gdbarch) + SPARC64_Q0_REGNUM + bitpos / 128;
regcache->cooked_read (regnum, valbuf + (bitpos / 8));
}
else if (len == 8)
{
gdb_assert (bitpos % 64 == 0 && bitpos >= 0 && bitpos < 256);
- regnum = gdbarch_num_regs (gdbarch) + SPARC64_D0_REGNUM + bitpos / 64;
+ regnum
+ = gdbarch_num_regs (gdbarch) + SPARC64_D0_REGNUM + bitpos / 64;
regcache->cooked_read (regnum, valbuf + (bitpos / 8));
}
else
@@ -1446,8 +1413,8 @@ sparc64_store_arguments (struct regcache *regcache, int nargs,
caller to an extended word according to the signed-ness
of the argument type." */
if (len < 8)
- args[i] = value_cast (builtin_type (gdbarch)->builtin_int64,
- args[i]);
+ args[i]
+ = value_cast (builtin_type (gdbarch)->builtin_int64, args[i]);
num_elements++;
}
}
@@ -1513,7 +1480,8 @@ sparc64_store_arguments (struct regcache *regcache, int nargs,
/* Float Complex or double Complex arguments. */
if (element < 16)
{
- regnum = gdbarch_num_regs (gdbarch) + SPARC64_D0_REGNUM + element;
+ regnum
+ = gdbarch_num_regs (gdbarch) + SPARC64_D0_REGNUM + element;
if (len == 16)
{
@@ -1539,8 +1507,8 @@ sparc64_store_arguments (struct regcache *regcache, int nargs,
else if (len == 8)
{
if (element < 16)
- regnum = gdbarch_num_regs (gdbarch) + SPARC64_D0_REGNUM
- + element;
+ regnum
+ = gdbarch_num_regs (gdbarch) + SPARC64_D0_REGNUM + element;
}
else if (len == 4)
{
@@ -1555,8 +1523,8 @@ sparc64_store_arguments (struct regcache *regcache, int nargs,
valbuf = buf;
len = 8;
if (element < 16)
- regnum = gdbarch_num_regs (gdbarch) + SPARC64_D0_REGNUM
- + element;
+ regnum
+ = gdbarch_num_regs (gdbarch) + SPARC64_D0_REGNUM + element;
}
}
else
@@ -1583,7 +1551,8 @@ sparc64_store_arguments (struct regcache *regcache, int nargs,
regnum = SPARC_O0_REGNUM + element;
regcache->cooked_write (regnum, valbuf);
}
- else if (regnum >= SPARC64_Q0_REGNUM && regnum <= SPARC64_Q8_REGNUM)
+ else if (regnum >= SPARC64_Q0_REGNUM
+ && regnum <= SPARC64_Q8_REGNUM)
{
gdb_assert (element < 5);
regnum = SPARC_O0_REGNUM + element;
@@ -1637,7 +1606,6 @@ sparc64_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
return sp + BIAS;
}
-
/* Extract from an array REGBUF containing the (raw) register state, a
function return value of TYPE, and copy that into VALBUF. */
@@ -1759,7 +1727,6 @@ sparc64_return_value (struct gdbarch *gdbarch, struct value *function,
return RETURN_VALUE_REGISTER_CONVENTION;
}
-
static void
sparc64_dwarf2_frame_init_reg (struct gdbarch *gdbarch, int regnum,
@@ -1836,8 +1803,8 @@ sparc64_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
set_gdbarch_return_value (gdbarch, sparc64_return_value);
set_gdbarch_return_value_as_value (gdbarch, default_gdbarch_return_value);
- set_gdbarch_stabs_argument_has_addr
- (gdbarch, default_stabs_argument_has_addr);
+ set_gdbarch_stabs_argument_has_addr (gdbarch,
+ default_stabs_argument_has_addr);
set_gdbarch_skip_prologue (gdbarch, sparc64_skip_prologue);
set_gdbarch_stack_frame_destroyed_p (gdbarch, sparc_stack_frame_destroyed_p);
@@ -1852,29 +1819,28 @@ sparc64_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
set_gdbarch_addr_bits_remove (gdbarch, sparc64_addr_bits_remove);
}
-
/* Helper functions for dealing with register sets. */
-#define TSTATE_CWP 0x000000000000001fULL
-#define TSTATE_ICC 0x0000000f00000000ULL
-#define TSTATE_XCC 0x000000f000000000ULL
+#define TSTATE_CWP 0x000000000000001fULL
+#define TSTATE_ICC 0x0000000f00000000ULL
+#define TSTATE_XCC 0x000000f000000000ULL
-#define PSR_S 0x00000080
+#define PSR_S 0x00000080
#ifndef PSR_ICC
-#define PSR_ICC 0x00f00000
+#define PSR_ICC 0x00f00000
#endif
-#define PSR_VERS 0x0f000000
+#define PSR_VERS 0x0f000000
#ifndef PSR_IMPL
-#define PSR_IMPL 0xf0000000
+#define PSR_IMPL 0xf0000000
#endif
-#define PSR_V8PLUS 0xff000000
-#define PSR_XCC 0x000f0000
+#define PSR_V8PLUS 0xff000000
+#define PSR_XCC 0x000f0000
void
sparc64_supply_gregset (const struct sparc_gregmap *gregmap,
- struct regcache *regcache,
- int regnum, const void *gregs)
+ struct regcache *regcache, int regnum,
+ const void *gregs)
{
struct gdbarch *gdbarch = regcache->arch ();
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
@@ -1919,8 +1885,7 @@ sparc64_supply_gregset (const struct sparc_gregmap *gregmap,
regs + gregmap->r_tstate_offset);
if (regnum == SPARC64_PC_REGNUM || regnum == -1)
- regcache->raw_supply (SPARC64_PC_REGNUM,
- regs + gregmap->r_pc_offset);
+ regcache->raw_supply (SPARC64_PC_REGNUM, regs + gregmap->r_pc_offset);
if (regnum == SPARC64_NPC_REGNUM || regnum == -1)
regcache->raw_supply (SPARC64_NPC_REGNUM,
@@ -1931,8 +1896,8 @@ sparc64_supply_gregset (const struct sparc_gregmap *gregmap,
gdb_byte buf[8];
memset (buf, 0, 8);
- memcpy (buf + 8 - gregmap->r_y_size,
- regs + gregmap->r_y_offset, gregmap->r_y_size);
+ memcpy (buf + 8 - gregmap->r_y_size, regs + gregmap->r_y_offset,
+ gregmap->r_y_size);
regcache->raw_supply (SPARC64_Y_REGNUM, buf);
}
@@ -1990,8 +1955,8 @@ sparc64_supply_gregset (const struct sparc_gregmap *gregmap,
void
sparc64_collect_gregset (const struct sparc_gregmap *gregmap,
- const struct regcache *regcache,
- int regnum, void *gregs)
+ const struct regcache *regcache, int regnum,
+ void *gregs)
{
struct gdbarch *gdbarch = regcache->arch ();
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
@@ -2038,8 +2003,7 @@ sparc64_collect_gregset (const struct sparc_gregmap *gregmap,
regs + gregmap->r_tstate_offset);
if (regnum == SPARC64_PC_REGNUM || regnum == -1)
- regcache->raw_collect (SPARC64_PC_REGNUM,
- regs + gregmap->r_pc_offset);
+ regcache->raw_collect (SPARC64_PC_REGNUM, regs + gregmap->r_pc_offset);
if (regnum == SPARC64_NPC_REGNUM || regnum == -1)
regcache->raw_collect (SPARC64_NPC_REGNUM,
@@ -2050,15 +2014,14 @@ sparc64_collect_gregset (const struct sparc_gregmap *gregmap,
gdb_byte buf[8];
regcache->raw_collect (SPARC64_Y_REGNUM, buf);
- memcpy (regs + gregmap->r_y_offset,
- buf + 8 - gregmap->r_y_size, gregmap->r_y_size);
+ memcpy (regs + gregmap->r_y_offset, buf + 8 - gregmap->r_y_size,
+ gregmap->r_y_size);
}
if ((regnum == SPARC64_FPRS_REGNUM || regnum == -1)
&& gregmap->r_fprs_offset != -1)
regcache->raw_collect (SPARC64_FPRS_REGNUM,
regs + gregmap->r_fprs_offset);
-
}
if ((regnum >= SPARC_G1_REGNUM && regnum <= SPARC_O7_REGNUM) || regnum == -1)
@@ -2100,8 +2063,8 @@ sparc64_collect_gregset (const struct sparc_gregmap *gregmap,
void
sparc64_supply_fpregset (const struct sparc_fpregmap *fpregmap,
- struct regcache *regcache,
- int regnum, const void *fpregs)
+ struct regcache *regcache, int regnum,
+ const void *fpregs)
{
int sparc32 = (gdbarch_ptr_bit (regcache->arch ()) == 32);
const gdb_byte *regs = (const gdb_byte *) fpregs;
@@ -2118,16 +2081,16 @@ sparc64_supply_fpregset (const struct sparc_fpregmap *fpregmap,
{
if (regnum == SPARC32_FSR_REGNUM || regnum == -1)
regcache->raw_supply (SPARC32_FSR_REGNUM,
- regs + fpregmap->r_fsr_offset);
+ regs + fpregmap->r_fsr_offset);
}
else
{
for (i = 0; i < 16; i++)
{
if (regnum == (SPARC64_F32_REGNUM + i) || regnum == -1)
- regcache->raw_supply
- (SPARC64_F32_REGNUM + i,
- regs + fpregmap->r_f0_offset + (32 * 4) + (i * 8));
+ regcache->raw_supply (SPARC64_F32_REGNUM + i,
+ regs + fpregmap->r_f0_offset + (32 * 4)
+ + (i * 8));
}
if (regnum == SPARC64_FSR_REGNUM || regnum == -1)
@@ -2138,8 +2101,8 @@ sparc64_supply_fpregset (const struct sparc_fpregmap *fpregmap,
void
sparc64_collect_fpregset (const struct sparc_fpregmap *fpregmap,
- const struct regcache *regcache,
- int regnum, void *fpregs)
+ const struct regcache *regcache, int regnum,
+ void *fpregs)
{
int sparc32 = (gdbarch_ptr_bit (regcache->arch ()) == 32);
gdb_byte *regs = (gdb_byte *) fpregs;
@@ -2164,8 +2127,8 @@ sparc64_collect_fpregset (const struct sparc_fpregmap *fpregmap,
{
if (regnum == (SPARC64_F32_REGNUM + i) || regnum == -1)
regcache->raw_collect (SPARC64_F32_REGNUM + i,
- (regs + fpregmap->r_f0_offset
- + (32 * 4) + (i * 8)));
+ (regs + fpregmap->r_f0_offset + (32 * 4)
+ + (i * 8)));
}
if (regnum == SPARC64_FSR_REGNUM || regnum == -1)
@@ -2174,8 +2137,7 @@ sparc64_collect_fpregset (const struct sparc_fpregmap *fpregmap,
}
}
-const struct sparc_fpregmap sparc64_bsd_fpregmap =
-{
- 0 * 8, /* %f0 */
- 32 * 8, /* %fsr */
+const struct sparc_fpregmap sparc64_bsd_fpregmap = {
+ 0 * 8, /* %f0 */
+ 32 * 8, /* %fsr */
};
diff --git a/gdb/sparc64-tdep.h b/gdb/sparc64-tdep.h
index 398e38ad17d..686ad9e710a 100644
--- a/gdb/sparc64-tdep.h
+++ b/gdb/sparc64-tdep.h
@@ -46,69 +46,69 @@ struct trad_frame_saved_reg;
enum sparc64_regnum
{
- SPARC64_F32_REGNUM /* %f32 */
+ SPARC64_F32_REGNUM /* %f32 */
= SPARC_F0_REGNUM + 32,
- SPARC64_F62_REGNUM /* %f62 */
+ SPARC64_F62_REGNUM /* %f62 */
= SPARC64_F32_REGNUM + 15,
- SPARC64_PC_REGNUM, /* %pc */
- SPARC64_NPC_REGNUM, /* %npc */
+ SPARC64_PC_REGNUM, /* %pc */
+ SPARC64_NPC_REGNUM, /* %npc */
SPARC64_STATE_REGNUM,
- SPARC64_FSR_REGNUM, /* %fsr */
- SPARC64_FPRS_REGNUM, /* %fprs */
- SPARC64_Y_REGNUM, /* %y */
+ SPARC64_FSR_REGNUM, /* %fsr */
+ SPARC64_FPRS_REGNUM, /* %fprs */
+ SPARC64_Y_REGNUM, /* %y */
};
/* Pseudo registers. */
enum sparc64_pseudo_regnum
{
- SPARC64_CWP_REGNUM = 0, /* %cwp */
- SPARC64_PSTATE_REGNUM, /* %pstate */
- SPARC64_ASI_REGNUM, /* %asi */
- SPARC64_CCR_REGNUM, /* %ccr */
- SPARC64_D0_REGNUM, /* %d0 */
- SPARC64_D10_REGNUM /* %d10 */
+ SPARC64_CWP_REGNUM = 0, /* %cwp */
+ SPARC64_PSTATE_REGNUM, /* %pstate */
+ SPARC64_ASI_REGNUM, /* %asi */
+ SPARC64_CCR_REGNUM, /* %ccr */
+ SPARC64_D0_REGNUM, /* %d0 */
+ SPARC64_D10_REGNUM /* %d10 */
= SPARC64_D0_REGNUM + 5,
- SPARC64_D30_REGNUM /* %d30 */
+ SPARC64_D30_REGNUM /* %d30 */
= SPARC64_D0_REGNUM + 15,
- SPARC64_D32_REGNUM /* %d32 */
+ SPARC64_D32_REGNUM /* %d32 */
= SPARC64_D0_REGNUM + 16,
- SPARC64_D62_REGNUM /* %d62 */
+ SPARC64_D62_REGNUM /* %d62 */
= SPARC64_D0_REGNUM + 31,
- SPARC64_Q0_REGNUM, /* %q0 */
- SPARC64_Q8_REGNUM /* %q8 */
+ SPARC64_Q0_REGNUM, /* %q0 */
+ SPARC64_Q8_REGNUM /* %q8 */
= SPARC64_Q0_REGNUM + 2,
- SPARC64_Q28_REGNUM /* %q28 */
+ SPARC64_Q28_REGNUM /* %q28 */
= SPARC64_Q0_REGNUM + 7,
- SPARC64_Q32_REGNUM /* %q32 */
+ SPARC64_Q32_REGNUM /* %q32 */
= SPARC64_Q0_REGNUM + 8,
- SPARC64_Q60_REGNUM /* %q60 */
+ SPARC64_Q60_REGNUM /* %q60 */
= SPARC64_Q0_REGNUM + 15
};
/* Processor state bits. */
-#define SPARC64_PSTATE_AG 0x001
-#define SPARC64_PSTATE_IE 0x002
-#define SPARC64_PSTATE_PRIV 0x004
-#define SPARC64_PSTATE_AM 0x008
-#define SPARC64_PSTATE_PEF 0x010
-#define SPARC64_PSTATE_RED 0x020
-#define SPARC64_PSTATE_TLE 0x100
-#define SPARC64_PSTATE_CLE 0x200
-#define SPARC64_PSTATE_PID0 0x400
-#define SPARC64_PSTATE_PID1 0x800
+#define SPARC64_PSTATE_AG 0x001
+#define SPARC64_PSTATE_IE 0x002
+#define SPARC64_PSTATE_PRIV 0x004
+#define SPARC64_PSTATE_AM 0x008
+#define SPARC64_PSTATE_PEF 0x010
+#define SPARC64_PSTATE_RED 0x020
+#define SPARC64_PSTATE_TLE 0x100
+#define SPARC64_PSTATE_CLE 0x200
+#define SPARC64_PSTATE_PID0 0x400
+#define SPARC64_PSTATE_PID1 0x800
extern void sparc64_init_abi (struct gdbarch_info info,
struct gdbarch *gdbarch);
extern void sparc64_supply_gregset (const struct sparc_gregmap *gregmap,
- struct regcache *regcache,
- int regnum, const void *gregs);
+ struct regcache *regcache, int regnum,
+ const void *gregs);
extern void sparc64_collect_gregset (const struct sparc_gregmap *gregmap,
const struct regcache *regcache,
int regnum, void *gregs);
extern void sparc64_supply_fpregset (const struct sparc_fpregmap *fpregmap,
- struct regcache *regcache,
- int regnum, const void *fpregs);
+ struct regcache *regcache, int regnum,
+ const void *fpregs);
extern void sparc64_collect_fpregset (const struct sparc_fpregmap *fpregmap,
const struct regcache *regcache,
int regnum, void *fpregs);
@@ -130,8 +130,8 @@ extern const struct sparc_gregmap sparc64fbsd_gregmap;
extern const struct sparc_gregmap sparc64nbsd_gregmap;
extern struct trad_frame_saved_reg *
- sparc64nbsd_sigcontext_saved_regs (CORE_ADDR sigcontext_addr,
- frame_info_ptr next_frame);
+sparc64nbsd_sigcontext_saved_regs (CORE_ADDR sigcontext_addr,
+ frame_info_ptr next_frame);
extern const struct sparc_fpregmap sparc64_bsd_fpregmap;
diff --git a/gdb/split-name.c b/gdb/split-name.c
index a50a6fa4946..6f6eeae46ec 100644
--- a/gdb/split-name.c
+++ b/gdb/split-name.c
@@ -47,8 +47,7 @@ split_name (const char *name, split_style style)
case split_style::UNDERSCORE:
/* Handle the Ada encoded (aka mangled) form here. */
- for (const char *iter = strstr (name, "__");
- iter != nullptr;
+ for (const char *iter = strstr (name, "__"); iter != nullptr;
iter = strstr (iter, "__"))
{
result.emplace_back (&name[previous_len],
@@ -60,8 +59,7 @@ split_name (const char *name, split_style style)
case split_style::DOT:
/* D and Go-style names. */
- for (const char *iter = strchr (name, '.');
- iter != nullptr;
+ for (const char *iter = strchr (name, '.'); iter != nullptr;
iter = strchr (iter, '.'))
{
result.emplace_back (&name[previous_len],
@@ -78,4 +76,3 @@ split_name (const char *name, split_style style)
result.emplace_back (&name[previous_len]);
return result;
}
-
diff --git a/gdb/stabsread.c b/gdb/stabsread.c
index ca9132b37d0..3445d31a4c5 100644
--- a/gdb/stabsread.c
+++ b/gdb/stabsread.c
@@ -32,7 +32,7 @@
#include "expression.h"
#include "symfile.h"
#include "objfiles.h"
-#include "aout/stab_gnu.h" /* We always use GNU stabs, not native. */
+#include "aout/stab_gnu.h" /* We always use GNU stabs, not native. */
#include "libaout.h"
#include "aout/aout64.h"
#include "gdb-stabs.h"
@@ -86,16 +86,16 @@ struct next_fnfieldlist
expected to eventually go away... (FIXME) */
struct stab_field_info
- {
- struct stabs_nextfield *list = nullptr;
- struct next_fnfieldlist *fnlist = nullptr;
+{
+ struct stabs_nextfield *list = nullptr;
+ struct next_fnfieldlist *fnlist = nullptr;
- auto_obstack obstack;
- };
+ auto_obstack obstack;
+};
-static void
-read_one_struct_field (struct stab_field_info *, const char **, const char *,
- struct type *, struct objfile *);
+static void read_one_struct_field (struct stab_field_info *, const char **,
+ const char *, struct type *,
+ struct objfile *);
static struct type *dbx_alloc_type (int[2], struct objfile *);
@@ -103,42 +103,38 @@ static long read_huge_number (const char **, int, int *, int);
static struct type *error_type (const char **, struct objfile *);
-static void
-patch_block_stabs (struct pending *, struct pending_stabs *,
- struct objfile *);
+static void patch_block_stabs (struct pending *, struct pending_stabs *,
+ struct objfile *);
static int read_type_number (const char **, int *);
static struct type *read_type (const char **, struct objfile *);
-static struct type *read_range_type (const char **, int[2],
- int, struct objfile *);
+static struct type *read_range_type (const char **, int[2], int,
+ struct objfile *);
-static struct type *read_sun_builtin_type (const char **,
- int[2], struct objfile *);
+static struct type *read_sun_builtin_type (const char **, int[2],
+ struct objfile *);
static struct type *read_sun_floating_type (const char **, int[2],
struct objfile *);
-static struct type *read_enum_type (const char **, struct type *, struct objfile *);
+static struct type *read_enum_type (const char **, struct type *,
+ struct objfile *);
static struct type *rs6000_builtin_type (int, struct objfile *);
-static int
-read_member_functions (struct stab_field_info *, const char **, struct type *,
- struct objfile *);
+static int read_member_functions (struct stab_field_info *, const char **,
+ struct type *, struct objfile *);
-static int
-read_struct_fields (struct stab_field_info *, const char **, struct type *,
- struct objfile *);
+static int read_struct_fields (struct stab_field_info *, const char **,
+ struct type *, struct objfile *);
-static int
-read_baseclasses (struct stab_field_info *, const char **, struct type *,
- struct objfile *);
+static int read_baseclasses (struct stab_field_info *, const char **,
+ struct type *, struct objfile *);
-static int
-read_tilde_fields (struct stab_field_info *, const char **, struct type *,
- struct objfile *);
+static int read_tilde_fields (struct stab_field_info *, const char **,
+ struct type *, struct objfile *);
static int attach_fn_fields_to_type (struct stab_field_info *, struct type *);
@@ -146,20 +142,18 @@ static int attach_fields_to_type (struct stab_field_info *, struct type *,
struct objfile *);
static struct type *read_struct_type (const char **, struct type *,
- enum type_code,
- struct objfile *);
+ enum type_code, struct objfile *);
static struct type *read_array_type (const char **, struct type *,
struct objfile *);
-static struct field *read_args (const char **, int, struct objfile *,
- int *, int *);
+static struct field *read_args (const char **, int, struct objfile *, int *,
+ int *);
static void add_undefined_type (struct type *, int[2]);
-static int
-read_cpp_abbrev (struct stab_field_info *, const char **, struct type *,
- struct objfile *);
+static int read_cpp_abbrev (struct stab_field_info *, const char **,
+ struct type *, struct objfile *);
static const char *find_name_end (const char *name);
@@ -173,14 +167,14 @@ static const char vb_name[] = "_vb$";
static void
invalid_cpp_abbrev_complaint (const char *arg1)
{
- complaint (_("invalid C++ abbreviation `%s'"), arg1);
+ complaint (_ ("invalid C++ abbreviation `%s'"), arg1);
}
static void
reg_value_complaint (int regnum, int num_regs, const char *sym)
{
- complaint (_("bad register number %d (max %d) in symbol %s"),
- regnum, num_regs - 1, sym);
+ complaint (_ ("bad register number %d (max %d) in symbol %s"), regnum,
+ num_regs - 1, sym);
}
static void
@@ -211,11 +205,13 @@ static int noname_undefs_allocated;
static int noname_undefs_length;
/* Check for and handle cretinous stabs symbol name continuation! */
-#define STABS_CONTINUE(pp,objfile) \
- do { \
- if (**(pp) == '\\' || (**(pp) == '?' && (*(pp))[1] == '\0')) \
- *(pp) = next_symbol_text (objfile); \
- } while (0)
+#define STABS_CONTINUE(pp, objfile) \
+ do \
+ { \
+ if (**(pp) == '\\' || (**(pp) == '?' && (*(pp))[1] == '\0')) \
+ *(pp) = next_symbol_text (objfile); \
+ } \
+ while (0)
/* Vector of types defined so far, indexed by their type numbers.
(In newer sun systems, dbx uses a pair of numbers in parens,
@@ -233,7 +229,6 @@ static int type_vector_length;
realloc'd down to the size actually used, when completed. */
#define INITIAL_TYPE_VECTOR_LENGTH 160
-
/* Look up a dbx type-number pair. Return the address of the slot
where the type for that number-pair is stored.
@@ -252,13 +247,13 @@ dbx_lookup_type (int typenums[2], struct objfile *objfile)
struct header_file *f;
int f_orig_length;
- if (filenum == -1) /* -1,-1 is for temporary types. */
+ if (filenum == -1) /* -1,-1 is for temporary types. */
return 0;
if (filenum < 0 || filenum >= n_this_object_header_files)
{
- complaint (_("Invalid symbol data: type number "
- "(%d,%d) out of range at symtab pos %d."),
+ complaint (_ ("Invalid symbol data: type number "
+ "(%d,%d) out of range at symtab pos %d."),
filenum, index, symnum);
goto error_return;
}
@@ -292,9 +287,9 @@ dbx_lookup_type (int typenums[2], struct objfile *objfile)
{
type_vector_length *= 2;
}
- type_vector = (struct type **)
- xrealloc ((char *) type_vector,
- (type_vector_length * sizeof (struct type *)));
+ type_vector = (struct type **) xrealloc ((char *) type_vector,
+ (type_vector_length
+ * sizeof (struct type *)));
memset (&type_vector[old_len], 0,
(type_vector_length - old_len) * sizeof (struct type *));
}
@@ -308,7 +303,7 @@ dbx_lookup_type (int typenums[2], struct objfile *objfile)
{
static struct type *temp_type;
- warning (_("GDB internal error: bad real_filenum"));
+ warning (_ ("GDB internal error: bad real_filenum"));
error_return:
temp_type = objfile_type (objfile)->builtin_error;
@@ -324,8 +319,9 @@ dbx_lookup_type (int typenums[2], struct objfile *objfile)
{
f->length *= 2;
}
- f->vector = (struct type **)
- xrealloc ((char *) f->vector, f->length * sizeof (struct type *));
+ f->vector
+ = (struct type **) xrealloc ((char *) f->vector,
+ f->length * sizeof (struct type *));
memset (&f->vector[f_orig_length], 0,
(f->length - f_orig_length) * sizeof (struct type *));
}
@@ -401,7 +397,7 @@ patch_block_stabs (struct pending *symbols, struct pending_stabs *stabs,
{
name = stabs->stab[ii];
pp = (char *) strchr (name, ':');
- gdb_assert (pp); /* Must find a ':' or game's over. */
+ gdb_assert (pp); /* Must find a ':' or game's over. */
while (pp[1] == ':')
{
pp += 2;
@@ -424,16 +420,16 @@ patch_block_stabs (struct pending *symbols, struct pending_stabs *stabs,
sym = new (&objfile->objfile_obstack) symbol;
sym->set_domain (VAR_DOMAIN);
sym->set_aclass_index (LOC_OPTIMIZED_OUT);
- sym->set_linkage_name
- (obstack_strndup (&objfile->objfile_obstack, name, pp - name));
+ sym->set_linkage_name (
+ obstack_strndup (&objfile->objfile_obstack, name, pp - name));
pp += 2;
if (*(pp - 1) == 'F' || *(pp - 1) == 'f')
{
/* I don't think the linker does this with functions,
so as far as I know this is never executed.
But it doesn't hurt to check. */
- sym->set_type
- (lookup_function_type (read_type (&pp, objfile)));
+ sym->set_type (lookup_function_type (read_type (&pp,
+ objfile)));
}
else
{
@@ -446,8 +442,8 @@ patch_block_stabs (struct pending *symbols, struct pending_stabs *stabs,
pp += 2;
if (*(pp - 1) == 'F' || *(pp - 1) == 'f')
{
- sym->set_type
- (lookup_function_type (read_type (&pp, objfile)));
+ sym->set_type (lookup_function_type (read_type (&pp,
+ objfile)));
}
else
{
@@ -457,7 +453,6 @@ patch_block_stabs (struct pending *symbols, struct pending_stabs *stabs,
}
}
}
-
/* Read a number by which a type is referred to in dbx data,
or perhaps read a pair (FILENUM, TYPENUM) in parentheses.
@@ -491,12 +486,11 @@ read_type_number (const char **pp, int *typenums)
}
return 0;
}
-
-#define VISIBILITY_PRIVATE '0' /* Stabs character for private field */
-#define VISIBILITY_PROTECTED '1' /* Stabs character for protected fld */
-#define VISIBILITY_PUBLIC '2' /* Stabs character for public field */
-#define VISIBILITY_IGNORE '9' /* Optimized out or zero length */
+#define VISIBILITY_PRIVATE '0' /* Stabs character for private field */
+#define VISIBILITY_PROTECTED '1' /* Stabs character for protected fld */
+#define VISIBILITY_PUBLIC '2' /* Stabs character for public field */
+#define VISIBILITY_IGNORE '9' /* Optimized out or zero length */
/* Structure for storing pointers to reference definitions for fast lookup
during "process_later". */
@@ -510,7 +504,7 @@ struct ref_map
#define MAX_CHUNK_REFS 100
#define REF_CHUNK_SIZE (MAX_CHUNK_REFS * sizeof (struct ref_map))
-#define REF_MAP_SIZE(ref_chunk) ((ref_chunk) * REF_CHUNK_SIZE)
+#define REF_MAP_SIZE(ref_chunk) ((ref_chunk) *REF_CHUNK_SIZE)
static struct ref_map *ref_map;
@@ -546,9 +540,10 @@ ref_add (int refnum, struct symbol *sym, const char *stabs, CORE_ADDR value)
int new_slots = ref_count - ref_chunk * MAX_CHUNK_REFS;
int new_chunks = new_slots / MAX_CHUNK_REFS + 1;
- ref_map = (struct ref_map *)
- xrealloc (ref_map, REF_MAP_SIZE (ref_chunk + new_chunks));
- memset (ref_map + ref_chunk * MAX_CHUNK_REFS, 0,
+ ref_map
+ = (struct ref_map *) xrealloc (ref_map,
+ REF_MAP_SIZE (ref_chunk + new_chunks));
+ memset (ref_map + ref_chunk * MAX_CHUNK_REFS, 0,
new_chunks * REF_CHUNK_SIZE);
ref_chunk += new_chunks;
}
@@ -634,9 +629,8 @@ stab_reg_to_regnum (struct symbol *sym, struct gdbarch *gdbarch)
return regno;
}
-static const struct symbol_register_ops stab_register_funcs = {
- stab_reg_to_regnum
-};
+static const struct symbol_register_ops stab_register_funcs
+ = { stab_reg_to_regnum };
/* The "aclass" indices for computed symbols. */
@@ -675,8 +669,7 @@ define_symbol (CORE_ADDR valu, const char *string, int desc, int type,
p = strchr (p, ':');
if (p == NULL)
{
- complaint (
- _("Bad stabs string '%s'"), string);
+ complaint (_ ("Bad stabs string '%s'"), string);
return NULL;
}
}
@@ -695,7 +688,7 @@ define_symbol (CORE_ADDR valu, const char *string, int desc, int type,
}
else
{
- sym->set_line (0); /* unknown */
+ sym->set_line (0); /* unknown */
}
sym->set_language (get_current_subfile ()->language,
@@ -710,7 +703,7 @@ define_symbol (CORE_ADDR valu, const char *string, int desc, int type,
sym->set_linkage_name ("this");
break;
- case 'v': /* $vtbl_ptr_type */
+ case 'v': /* $vtbl_ptr_type */
goto normal;
case 'e':
@@ -722,9 +715,8 @@ define_symbol (CORE_ADDR valu, const char *string, int desc, int type,
goto normal;
default:
- complaint (_("Unknown C++ symbol name `%s'"),
- string);
- goto normal; /* Do *something* with it. */
+ complaint (_ ("Unknown C++ symbol name `%s'"), string);
+ goto normal; /* Do *something* with it. */
}
}
else
@@ -745,13 +737,12 @@ define_symbol (CORE_ADDR valu, const char *string, int desc, int type,
if (new_name != nullptr)
sym->compute_and_set_names (new_name.get (), true, objfile->per_bfd);
else
- sym->compute_and_set_names (gdb::string_view (string, p - string), true,
- objfile->per_bfd);
+ sym->compute_and_set_names (gdb::string_view (string, p - string),
+ true, objfile->per_bfd);
if (sym->language () == language_cplus)
cp_scan_for_anonymous_namespaces (get_buildsym_compunit (), sym,
objfile);
-
}
p++;
@@ -768,9 +759,8 @@ define_symbol (CORE_ADDR valu, const char *string, int desc, int type,
#else
if (isdigit (*p) || *p == '(' || *p == '-')
#endif
- deftype = 'l';
- else
- deftype = *p++;
+ deftype = 'l';
+ else deftype = *p++;
switch (deftype)
{
@@ -798,9 +788,8 @@ define_symbol (CORE_ADDR valu, const char *string, int desc, int type,
struct type *dbl_type;
dbl_type = objfile_type (objfile)->builtin_double;
- dbl_valu
- = (gdb_byte *) obstack_alloc (&objfile->objfile_obstack,
- dbl_type->length ());
+ dbl_valu = (gdb_byte *) obstack_alloc (&objfile->objfile_obstack,
+ dbl_type->length ());
target_float_from_string (dbl_valu, dbl_type, std::string (p));
@@ -858,7 +847,7 @@ define_symbol (CORE_ADDR valu, const char *string, int desc, int type,
ind++;
p += 2;
}
- else if (*p)
+ else if (*p)
{
string_local[ind] = (gdb_byte) (*p);
ind++;
@@ -880,11 +869,11 @@ define_symbol (CORE_ADDR valu, const char *string, int desc, int type,
= create_static_range_type (NULL,
objfile_type (objfile)->builtin_int,
0, ind);
- sym->set_type
- (create_array_type (NULL, objfile_type (objfile)->builtin_char,
- range_type));
+ sym->set_type (create_array_type (
+ NULL, objfile_type (objfile)->builtin_char, range_type));
string_value
- = (gdb_byte *) obstack_alloc (&objfile->objfile_obstack, ind + 1);
+ = (gdb_byte *) obstack_alloc (&objfile->objfile_obstack,
+ ind + 1);
memcpy (string_value, string_local, ind + 1);
p++;
@@ -980,9 +969,8 @@ define_symbol (CORE_ADDR valu, const char *string, int desc, int type,
}
/* Allocate parameter information fields and fill them in. */
- ftype->set_fields
- ((struct field *)
- TYPE_ALLOC (ftype, nsemi * sizeof (struct field)));
+ ftype->set_fields ((struct field *) TYPE_ALLOC (
+ ftype, nsemi * sizeof (struct field)));
while (*p++ == ';')
{
struct type *ptype;
@@ -1057,9 +1045,8 @@ define_symbol (CORE_ADDR valu, const char *string, int desc, int type,
Translate it into a pointer-to-function type. */
{
p++;
- sym->set_type
- (lookup_pointer_type
- (lookup_function_type (read_type (&p, objfile))));
+ sym->set_type (lookup_pointer_type (
+ lookup_function_type (read_type (&p, objfile))));
}
else
sym->set_type (read_type (&p, objfile));
@@ -1087,13 +1074,12 @@ define_symbol (CORE_ADDR valu, const char *string, int desc, int type,
/* If PCC says a parameter is a short or a char, it is
really an int. */
if (sym->type ()->length ()
- < gdbarch_int_bit (gdbarch) / TARGET_CHAR_BIT
+ < gdbarch_int_bit (gdbarch) / TARGET_CHAR_BIT
&& sym->type ()->code () == TYPE_CODE_INT)
{
- sym->set_type
- (sym->type ()->is_unsigned ()
- ? objfile_type (objfile)->builtin_unsigned_int
- : objfile_type (objfile)->builtin_int);
+ sym->set_type (sym->type ()->is_unsigned ()
+ ? objfile_type (objfile)->builtin_unsigned_int
+ : objfile_type (objfile)->builtin_int);
}
break;
}
@@ -1148,8 +1134,7 @@ define_symbol (CORE_ADDR valu, const char *string, int desc, int type,
from a decent compiler. */
struct pending *local_symbols = *get_local_symbols ();
- if (local_symbols
- && local_symbols->nsyms > 0
+ if (local_symbols && local_symbols->nsyms > 0
&& gdbarch_stabs_argument_has_addr (gdbarch, sym->type ()))
{
struct symbol *prev_sym;
@@ -1157,8 +1142,8 @@ define_symbol (CORE_ADDR valu, const char *string, int desc, int type,
prev_sym = local_symbols->symbol[local_symbols->nsyms - 1];
if ((prev_sym->aclass () == LOC_REF_ARG
|| prev_sym->aclass () == LOC_ARG)
- && strcmp (prev_sym->linkage_name (),
- sym->linkage_name ()) == 0)
+ && strcmp (prev_sym->linkage_name (), sym->linkage_name ())
+ == 0)
{
prev_sym->set_aclass_index (stab_register_index);
/* Use the type from the LOC_REGISTER; that is the type
@@ -1225,8 +1210,8 @@ define_symbol (CORE_ADDR valu, const char *string, int desc, int type,
for (j = TYPE_N_BASECLASSES (sym->type ()) - 1; j >= 0; j--)
if (TYPE_BASECLASS_NAME (sym->type (), j) == 0)
- sym->type ()->field (j).set_name
- (TYPE_BASECLASS (sym->type (), j)->name ());
+ sym->type ()->field (j).set_name (
+ TYPE_BASECLASS (sym->type (), j)->name ());
}
if (sym->type ()->name () == NULL)
@@ -1290,9 +1275,9 @@ define_symbol (CORE_ADDR valu, const char *string, int desc, int type,
struct_sym->set_value_longest (valu);
struct_sym->set_domain (STRUCT_DOMAIN);
if (sym->type ()->name () == 0)
- sym->type ()->set_name
- (obconcat (&objfile->objfile_obstack, sym->linkage_name (),
- (char *) NULL));
+ sym->type ()->set_name (obconcat (&objfile->objfile_obstack,
+ sym->linkage_name (),
+ (char *) NULL));
add_symbol_to_list (struct_sym, get_file_symbols ());
}
@@ -1307,7 +1292,7 @@ define_symbol (CORE_ADDR valu, const char *string, int desc, int type,
p++;
sym->set_type (read_type (&p, objfile));
-
+
/* For a nameless type, we don't want a create a symbol, thus we
did not use `sym'. Return without further processing. */
if (nameless)
@@ -1317,9 +1302,9 @@ define_symbol (CORE_ADDR valu, const char *string, int desc, int type,
sym->set_value_longest (valu);
sym->set_domain (STRUCT_DOMAIN);
if (sym->type ()->name () == 0)
- sym->type ()->set_name
- (obconcat (&objfile->objfile_obstack, sym->linkage_name (),
- (char *) NULL));
+ sym->type ()->set_name (obconcat (&objfile->objfile_obstack,
+ sym->linkage_name (),
+ (char *) NULL));
add_symbol_to_list (sym, get_file_symbols ());
if (synonym)
@@ -1332,9 +1317,9 @@ define_symbol (CORE_ADDR valu, const char *string, int desc, int type,
typedef_sym->set_value_longest (valu);
typedef_sym->set_domain (VAR_DOMAIN);
if (sym->type ()->name () == 0)
- sym->type ()->set_name
- (obconcat (&objfile->objfile_obstack, sym->linkage_name (),
- (char *) NULL));
+ sym->type ()->set_name (obconcat (&objfile->objfile_obstack,
+ sym->linkage_name (),
+ (char *) NULL));
add_symbol_to_list (typedef_sym, get_file_symbols ());
}
break;
@@ -1441,7 +1426,7 @@ define_symbol (CORE_ADDR valu, const char *string, int desc, int type,
static struct type *
error_type (const char **pp, struct objfile *objfile)
{
- complaint (_("couldn't parse type; debugger out of date?"));
+ complaint (_ ("couldn't parse type; debugger out of date?"));
while (1)
{
/* Skip to end of symbol. */
@@ -1462,7 +1447,6 @@ error_type (const char **pp, struct objfile *objfile)
}
return objfile_type (objfile)->builtin_error;
}
-
/* Read type information or a type definition; return the type. Even
though this routine accepts either type information or a type
@@ -1491,9 +1475,7 @@ read_type (const char **pp, struct objfile *objfile)
/* Read type number if present. The type number may be omitted.
for instance in a two-dimensional array declared with type
"ar1;1;10;ar1;1;10;4". */
- if ((**pp >= '0' && **pp <= '9')
- || **pp == '('
- || **pp == '-')
+ if ((**pp >= '0' && **pp <= '9') || **pp == '(' || **pp == '-')
{
if (read_type_number (pp, typenums) != 0)
return error_type (pp, objfile);
@@ -1561,7 +1543,7 @@ again:
{
/* Complain and keep going, so compilers can invent new
cross-reference types. */
- complaint (_("Unrecognized cross-reference type `%c'"),
+ complaint (_ ("Unrecognized cross-reference type `%c'"),
(*pp)[0]);
code = TYPE_CODE_STRUCT;
break;
@@ -1610,8 +1592,9 @@ again:
}
if (type_name == NULL)
{
- char *to = type_name = (char *)
- obstack_alloc (&objfile->objfile_obstack, p - *pp + 1);
+ char *to = type_name
+ = (char *) obstack_alloc (&objfile->objfile_obstack,
+ p - *pp + 1);
/* Copy the name. */
from = *pp + 1;
@@ -1662,7 +1645,7 @@ again:
return type;
}
- case '-': /* RS/6000 built-in type */
+ case '-': /* RS/6000 built-in type */
case '0':
case '1':
case '2':
@@ -1735,23 +1718,23 @@ again:
forward-referenced), and we must change it to a pointer, function,
reference, or whatever, *in-place*. */
- case '*': /* Pointer to another type */
+ case '*': /* Pointer to another type */
type1 = read_type (pp, objfile);
type = make_pointer_type (type1, dbx_lookup_type (typenums, objfile));
break;
- case '&': /* Reference to another type */
+ case '&': /* Reference to another type */
type1 = read_type (pp, objfile);
type = make_reference_type (type1, dbx_lookup_type (typenums, objfile),
TYPE_CODE_REF);
break;
- case 'f': /* Function returning another type */
+ case 'f': /* Function returning another type */
type1 = read_type (pp, objfile);
type = make_function_type (type1, dbx_lookup_type (typenums, objfile));
break;
- case 'g': /* Prototyped function. (Sun) */
+ case 'g': /* Prototyped function. (Sun) */
{
/* Unresolved questions:
@@ -1773,10 +1756,13 @@ again:
struct type *func_type
= make_function_type (return_type,
dbx_lookup_type (typenums, objfile));
- struct type_list {
+
+ struct type_list
+ {
struct type *type;
struct type_list *next;
} *arg_types = 0;
+
int num_args = 0;
while (**pp && **pp != '#')
@@ -1792,21 +1778,19 @@ again:
++*pp;
else
{
- complaint (_("Prototyped function type didn't "
- "end arguments with `#':\n%s"),
+ complaint (_ ("Prototyped function type didn't "
+ "end arguments with `#':\n%s"),
type_start);
}
/* If there is just one argument whose type is `void', then
that's just an empty argument list. */
- if (arg_types
- && ! arg_types->next
+ if (arg_types && !arg_types->next
&& arg_types->type->code () == TYPE_CODE_VOID)
num_args = 0;
- func_type->set_fields
- ((struct field *) TYPE_ALLOC (func_type,
- num_args * sizeof (struct field)));
+ func_type->set_fields ((struct field *) TYPE_ALLOC (
+ func_type, num_args * sizeof (struct field)));
memset (func_type->fields (), 0, num_args * sizeof (struct field));
{
int i;
@@ -1825,13 +1809,13 @@ again:
break;
}
- case 'k': /* Const qualifier on some type (Sun) */
+ case 'k': /* Const qualifier on some type (Sun) */
type = read_type (pp, objfile);
type = make_cv_type (1, TYPE_VOLATILE (type), type,
dbx_lookup_type (typenums, objfile));
break;
- case 'B': /* Volatile qual on some type (Sun) */
+ case 'B': /* Volatile qual on some type (Sun) */
type = read_type (pp, objfile);
type = make_cv_type (TYPE_CONST (type), 1, type,
dbx_lookup_type (typenums, objfile));
@@ -1839,7 +1823,7 @@ again:
case '@':
if (isdigit (**pp) || **pp == '(' || **pp == '-')
- { /* Member (class & variable) type */
+ { /* Member (class & variable) type */
/* FIXME -- we should be doing smash_to_XXX types here. */
struct type *domain = read_type (pp, objfile);
@@ -1865,22 +1849,22 @@ again:
if (**pp == '\0')
return error_type (pp, objfile);
else
- ++ * pp; /* Skip the semicolon. */
+ ++*pp; /* Skip the semicolon. */
switch (*attr)
{
- case 's': /* Size attribute */
+ case 's': /* Size attribute */
type_size = atoi (attr + 1);
if (type_size <= 0)
type_size = -1;
break;
- case 'S': /* String attribute */
+ case 'S': /* String attribute */
/* FIXME: check to see if following type is array? */
is_string = 1;
break;
- case 'V': /* Vector attribute */
+ case 'V': /* Vector attribute */
/* FIXME: check to see if following type is array? */
is_vector = 1;
break;
@@ -1895,7 +1879,7 @@ again:
}
break;
- case '#': /* Method (class & fn) type */
+ case '#': /* Method (class & fn) type */
if ((*pp)[0] == '#')
{
/* We'll get the parameter types from the name. */
@@ -1904,8 +1888,8 @@ again:
(*pp)++;
return_type = read_type (pp, objfile);
if (*(*pp)++ != ';')
- complaint (_("invalid (minimal) member type "
- "data format at symtab pos %d."),
+ complaint (_ ("invalid (minimal) member type "
+ "data format at symtab pos %d."),
symnum);
type = allocate_stub_method (return_type);
if (typenums[0] != -1)
@@ -1929,41 +1913,41 @@ again:
if (args == NULL)
return error_type (pp, objfile);
type = dbx_alloc_type (typenums, objfile);
- smash_to_method_type (type, domain, return_type, args,
- nargs, varargs);
+ smash_to_method_type (type, domain, return_type, args, nargs,
+ varargs);
}
break;
- case 'r': /* Range type */
+ case 'r': /* Range type */
type = read_range_type (pp, typenums, type_size, objfile);
if (typenums[0] != -1)
*dbx_lookup_type (typenums, objfile) = type;
break;
case 'b':
- {
- /* Sun ACC builtin int type */
- type = read_sun_builtin_type (pp, typenums, objfile);
- if (typenums[0] != -1)
- *dbx_lookup_type (typenums, objfile) = type;
- }
+ {
+ /* Sun ACC builtin int type */
+ type = read_sun_builtin_type (pp, typenums, objfile);
+ if (typenums[0] != -1)
+ *dbx_lookup_type (typenums, objfile) = type;
+ }
break;
- case 'R': /* Sun ACC builtin float type */
+ case 'R': /* Sun ACC builtin float type */
type = read_sun_floating_type (pp, typenums, objfile);
if (typenums[0] != -1)
*dbx_lookup_type (typenums, objfile) = type;
break;
- case 'e': /* Enumeration type */
+ case 'e': /* Enumeration type */
type = dbx_alloc_type (typenums, objfile);
type = read_enum_type (pp, type, objfile);
if (typenums[0] != -1)
*dbx_lookup_type (typenums, objfile) = type;
break;
- case 's': /* Struct type */
- case 'u': /* Union type */
+ case 's': /* Struct type */
+ case 'u': /* Union type */
{
enum type_code type_code = TYPE_CODE_UNDEF;
type = dbx_alloc_type (typenums, objfile);
@@ -1980,7 +1964,7 @@ again:
break;
}
- case 'a': /* Array type */
+ case 'a': /* Array type */
if (**pp != 'r')
return error_type (pp, objfile);
++*pp;
@@ -1993,7 +1977,7 @@ again:
make_vector_type (type);
break;
- case 'S': /* Set type */
+ case 'S': /* Set type */
type1 = read_type (pp, objfile);
type = create_set_type (NULL, type1);
if (typenums[0] != -1)
@@ -2001,14 +1985,14 @@ again:
break;
default:
- --*pp; /* Go back to the symbol in error. */
+ --*pp; /* Go back to the symbol in error. */
/* Particularly important if it was \0! */
return error_type (pp, objfile);
}
if (type == 0)
{
- warning (_("GDB internal error, type is NULL in stabsread.c."));
+ warning (_ ("GDB internal error, type is NULL in stabsread.c."));
return error_type (pp, objfile);
}
@@ -2018,7 +2002,7 @@ again:
return type;
}
-
+
/* RS/6000 xlc/dbx combination uses a set of builtin types, starting from -1.
Return the proper type node for a given builtin type number. */
@@ -2037,7 +2021,7 @@ rs6000_builtin_type (int typenum, struct objfile *objfile)
if (typenum >= 0 || typenum < -NUMBER_RECOGNIZED)
{
- complaint (_("Unknown builtin type %d"), typenum);
+ complaint (_ ("Unknown builtin type %d"), typenum);
return objfile_type (objfile)->builtin_error;
}
@@ -2054,7 +2038,7 @@ rs6000_builtin_type (int typenum, struct objfile *objfile)
#if TARGET_CHAR_BIT != 8
#error This code wrong for TARGET_CHAR_BIT not 8
- /* These definitions all assume that TARGET_CHAR_BIT is 8. I think
+ /* These definitions all assume that TARGET_CHAR_BIT is 8. I think
that if that ever becomes not true, the correct fix will be to
make the size in the struct type to be in bits, not in units of
TARGET_CHAR_BIT. */
@@ -2103,13 +2087,13 @@ rs6000_builtin_type (int typenum, struct objfile *objfile)
break;
case 12:
/* IEEE single precision (32 bit). */
- rettype = init_float_type (objfile, 32, "float",
- floatformats_ieee_single);
+ rettype
+ = init_float_type (objfile, 32, "float", floatformats_ieee_single);
break;
case 13:
/* IEEE double precision (64 bit). */
- rettype = init_float_type (objfile, 64, "double",
- floatformats_ieee_double);
+ rettype
+ = init_float_type (objfile, 64, "double", floatformats_ieee_double);
break;
case 14:
/* This is an IEEE double on the RS/6000, and different machines with
@@ -2129,8 +2113,8 @@ rs6000_builtin_type (int typenum, struct objfile *objfile)
floatformats_ieee_single);
break;
case 18:
- rettype = init_float_type (objfile, 64, "real",
- floatformats_ieee_double);
+ rettype
+ = init_float_type (objfile, 64, "real", floatformats_ieee_double);
break;
case 19:
rettype = init_type (objfile, TYPE_CODE_ERROR, 0, "stringptr");
@@ -2152,8 +2136,8 @@ rs6000_builtin_type (int typenum, struct objfile *objfile)
break;
case 25:
/* Complex type consisting of two IEEE single precision values. */
- rettype = init_complex_type ("complex",
- rs6000_builtin_type (12, objfile));
+ rettype
+ = init_complex_type ("complex", rs6000_builtin_type (12, objfile));
break;
case 26:
/* Complex type consisting of two IEEE double precision values. */
@@ -2188,7 +2172,7 @@ rs6000_builtin_type (int typenum, struct objfile *objfile)
negative_types[-typenum] = rettype;
return rettype;
}
-
+
/* This page contains subroutines of read_type. */
/* Wrapper around method_name_from_physname to flag a complaint
@@ -2203,7 +2187,7 @@ stabs_method_name_from_physname (const char *physname)
if (method_name == NULL)
{
- complaint (_("Method has bad physname %s\n"), physname);
+ complaint (_ ("Method has bad physname %s\n"), physname);
return NULL;
}
@@ -2232,12 +2216,12 @@ read_member_functions (struct stab_field_info *fip, const char **pp,
int nfn_fields = 0;
int length = 0;
int i;
+
struct next_fnfield
- {
- struct next_fnfield *next;
- struct fn_field fn_field;
- }
- *sublist;
+ {
+ struct next_fnfield *next;
+ struct fn_field fn_field;
+ } *sublist;
struct type *look_ahead_type;
struct next_fnfieldlist *new_fnlist;
struct next_fnfield *new_sublist;
@@ -2363,33 +2347,33 @@ read_member_functions (struct stab_field_info *fip, const char **pp,
STABS_CONTINUE (pp, objfile);
switch (**pp)
{
- case 'A': /* Normal functions. */
+ case 'A': /* Normal functions. */
new_sublist->fn_field.is_const = 0;
new_sublist->fn_field.is_volatile = 0;
(*pp)++;
break;
- case 'B': /* `const' member functions. */
+ case 'B': /* `const' member functions. */
new_sublist->fn_field.is_const = 1;
new_sublist->fn_field.is_volatile = 0;
(*pp)++;
break;
- case 'C': /* `volatile' member function. */
+ case 'C': /* `volatile' member function. */
new_sublist->fn_field.is_const = 0;
new_sublist->fn_field.is_volatile = 1;
(*pp)++;
break;
- case 'D': /* `const volatile' member function. */
+ case 'D': /* `const volatile' member function. */
new_sublist->fn_field.is_const = 1;
new_sublist->fn_field.is_volatile = 1;
(*pp)++;
break;
- case '*': /* File compiled with g++ version 1 --
+ case '*': /* File compiled with g++ version 1 --
no info. */
case '?':
case '.':
break;
default:
- complaint (_("const/volatile indicator missing, got '%c'"),
+ complaint (_ ("const/volatile indicator missing, got '%c'"),
**pp);
break;
}
@@ -2406,8 +2390,8 @@ read_member_functions (struct stab_field_info *fip, const char **pp,
on 16 bit machine, and by 2 on 32 bit machine, forcing
the sign bit out, and usable as a valid index into
the array. Remove the sign bit here. */
- new_sublist->fn_field.voffset =
- (0x7fffffff & read_huge_number (pp, ';', &nbits, 0)) + 2;
+ new_sublist->fn_field.voffset
+ = (0x7fffffff & read_huge_number (pp, ';', &nbits, 0)) + 2;
if (nbits != 0)
return 0;
@@ -2460,8 +2444,9 @@ read_member_functions (struct stab_field_info *fip, const char **pp,
the member function name, followed by two underscores.
GCC v3 currently always emits stubbed member functions,
but with fully mangled physnames, which start with _Z. */
- if (!(strncmp (new_sublist->fn_field.physname,
- main_fn_name, slen) == 0
+ if (!(strncmp (new_sublist->fn_field.physname, main_fn_name,
+ slen)
+ == 0
&& new_sublist->fn_field.physname[slen] == '_'
&& new_sublist->fn_field.physname[slen + 1] == '_'))
{
@@ -2472,7 +2457,7 @@ read_member_functions (struct stab_field_info *fip, const char **pp,
default:
/* error */
- complaint (_("member function type missing, got '%c'"),
+ complaint (_ ("member function type missing, got '%c'"),
(*pp)[-1]);
/* Normal member function. */
/* Fall through. */
@@ -2586,18 +2571,18 @@ read_member_functions (struct stab_field_info *fip, const char **pp,
/* Create a new fn_fieldlist for the destructors. */
- destr_fnlist = OBSTACK_ZALLOC (&fip->obstack,
- struct next_fnfieldlist);
+ destr_fnlist
+ = OBSTACK_ZALLOC (&fip->obstack, struct next_fnfieldlist);
destr_fnlist->fn_fieldlist.name
= obconcat (&objfile->objfile_obstack, "~",
new_fnlist->fn_fieldlist.name, (char *) NULL);
- destr_fnlist->fn_fieldlist.fn_fields =
- XOBNEWVEC (&objfile->objfile_obstack,
- struct fn_field, has_destructor);
+ destr_fnlist->fn_fieldlist.fn_fields
+ = XOBNEWVEC (&objfile->objfile_obstack, struct fn_field,
+ has_destructor);
memset (destr_fnlist->fn_fieldlist.fn_fields, 0,
- sizeof (struct fn_field) * has_destructor);
+ sizeof (struct fn_field) * has_destructor);
tmp_sublist = sublist;
last_sublist = NULL;
i = 0;
@@ -2608,7 +2593,7 @@ read_member_functions (struct stab_field_info *fip, const char **pp,
tmp_sublist = tmp_sublist->next;
continue;
}
-
+
destr_fnlist->fn_fieldlist.fn_fields[i++]
= tmp_sublist->fn_field;
if (last_sublist)
@@ -2633,12 +2618,12 @@ read_member_functions (struct stab_field_info *fip, const char **pp,
- in -gstabs instead of -gstabs+
- or for static methods, which are output as a function type
instead of a method type. */
- char *new_method_name =
- stabs_method_name_from_physname (sublist->fn_field.physname);
+ char *new_method_name
+ = stabs_method_name_from_physname (sublist->fn_field.physname);
if (new_method_name != NULL
- && strcmp (new_method_name,
- new_fnlist->fn_fieldlist.name) != 0)
+ && strcmp (new_method_name, new_fnlist->fn_fieldlist.name)
+ != 0)
{
new_fnlist->fn_fieldlist.name = new_method_name;
xfree (main_fn_name);
@@ -2648,9 +2633,9 @@ read_member_functions (struct stab_field_info *fip, const char **pp,
}
else if (has_destructor && new_fnlist->fn_fieldlist.name[0] != '~')
{
- new_fnlist->fn_fieldlist.name =
- obconcat (&objfile->objfile_obstack,
- "~", main_fn_name, (char *)NULL);
+ new_fnlist->fn_fieldlist.name
+ = obconcat (&objfile->objfile_obstack, "~", main_fn_name,
+ (char *) NULL);
xfree (main_fn_name);
}
@@ -2712,22 +2697,23 @@ read_cpp_abbrev (struct stab_field_info *fip, const char **pp,
switch (cpp_abbrev)
{
- case 'f': /* $vf -- a virtual function table pointer */
+ case 'f': /* $vf -- a virtual function table pointer */
name = context->name ();
if (name == NULL)
{
name = "";
}
fip->list->field.set_name (obconcat (&objfile->objfile_obstack,
- vptr_name, name, (char *) NULL));
+ vptr_name, name,
+ (char *) NULL));
break;
- case 'b': /* $vb -- a virtual bsomethingorother */
+ case 'b': /* $vb -- a virtual bsomethingorother */
name = context->name ();
if (name == NULL)
{
- complaint (_("C++ abbreviated type name "
- "unknown at symtab pos %d"),
+ complaint (_ ("C++ abbreviated type name "
+ "unknown at symtab pos %d"),
symnum);
name = "FOO";
}
@@ -2754,14 +2740,15 @@ read_cpp_abbrev (struct stab_field_info *fip, const char **pp,
}
fip->list->field.set_type (read_type (pp, objfile));
if (**pp == ',')
- (*pp)++; /* Skip the comma. */
+ (*pp)++; /* Skip the comma. */
else
return 0;
{
int nbits;
- fip->list->field.set_loc_bitpos (read_huge_number (pp, ';', &nbits, 0));
+ fip->list->field.set_loc_bitpos (read_huge_number (pp, ';', &nbits,
+ 0));
if (nbits != 0)
return 0;
}
@@ -2787,8 +2774,8 @@ read_one_struct_field (struct stab_field_info *fip, const char **pp,
{
struct gdbarch *gdbarch = objfile->arch ();
- fip->list->field.set_name
- (obstack_strndup (&objfile->objfile_obstack, *pp, p - *pp));
+ fip->list->field.set_name (obstack_strndup (&objfile->objfile_obstack, *pp,
+ p - *pp));
*pp = p + 1;
/* This means we have a visibility for a field coming. */
@@ -2833,7 +2820,7 @@ read_one_struct_field (struct stab_field_info *fip, const char **pp,
return;
}
- (*pp)++; /* Skip the comma. */
+ (*pp)++; /* Skip the comma. */
{
int nbits;
@@ -2889,20 +2876,17 @@ read_one_struct_field (struct stab_field_info *fip, const char **pp,
FIELD_BITSIZE (fip->list->field) = 0;
}
if ((FIELD_BITSIZE (fip->list->field)
- == TARGET_CHAR_BIT * field_type->length ()
+ == TARGET_CHAR_BIT * field_type->length ()
|| (field_type->code () == TYPE_CODE_ENUM
&& FIELD_BITSIZE (fip->list->field)
- == gdbarch_int_bit (gdbarch))
- )
- &&
- fip->list->field.loc_bitpos () % 8 == 0)
+ == gdbarch_int_bit (gdbarch)))
+ && fip->list->field.loc_bitpos () % 8 == 0)
{
FIELD_BITSIZE (fip->list->field) = 0;
}
}
}
-
/* Read struct or class data fields. They have the form:
NAME : [VISIBILITY] TYPENUM , BITPOS , BITSIZE ;
@@ -2992,6 +2976,7 @@ read_struct_fields (struct stab_field_info *fip, const char **pp,
}
return 1;
}
+
/* *INDENT-OFF* */
/* The stabs for C++ derived classes contain baseclass information which
is marked by a '!' character after the total size. This function is
@@ -3018,8 +3003,6 @@ read_struct_fields (struct stab_field_info *fip, const char **pp,
Return 1 for success, 0 for (error-type-inducing) failure. */
/* *INDENT-ON* */
-
-
static int
read_baseclasses (struct stab_field_info *fip, const char **pp,
struct type *type, struct objfile *objfile)
@@ -3069,7 +3052,7 @@ read_baseclasses (struct stab_field_info *fip, const char **pp,
newobj->next = fip->list;
fip->list = newobj;
- FIELD_BITSIZE (newobj->field) = 0; /* This should be an unpacked
+ FIELD_BITSIZE (newobj->field) = 0; /* This should be an unpacked
field! */
STABS_CONTINUE (pp, objfile);
@@ -3084,7 +3067,7 @@ read_baseclasses (struct stab_field_info *fip, const char **pp,
default:
/* Unknown character. Complain and treat it as non-virtual. */
{
- complaint (_("Unknown virtual character `%c' for baseclass"),
+ complaint (_ ("Unknown virtual character `%c' for baseclass"),
**pp);
}
}
@@ -3101,7 +3084,7 @@ read_baseclasses (struct stab_field_info *fip, const char **pp,
/* Bad visibility format. Complain and treat it as
public. */
{
- complaint (_("Unknown visibility `%c' for baseclass"),
+ complaint (_ ("Unknown visibility `%c' for baseclass"),
newobj->visibility);
newobj->visibility = VISIBILITY_PUBLIC;
}
@@ -3193,11 +3176,9 @@ read_tilde_fields (struct stab_field_info *fip, const char **pp,
}
set_type_vptr_basetype (type, t);
- if (type == t) /* Our own class provides vtbl ptr. */
+ if (type == t) /* Our own class provides vtbl ptr. */
{
- for (i = t->num_fields () - 1;
- i >= TYPE_N_BASECLASSES (t);
- --i)
+ for (i = t->num_fields () - 1; i >= TYPE_N_BASECLASSES (t); --i)
{
const char *name = t->field (i).name ();
@@ -3209,8 +3190,8 @@ read_tilde_fields (struct stab_field_info *fip, const char **pp,
}
}
/* Virtual function table field not found. */
- complaint (_("virtual function table pointer "
- "not found when defining class `%s'"),
+ complaint (_ ("virtual function table pointer "
+ "not found when defining class `%s'"),
type->name ());
return 0;
}
@@ -3231,11 +3212,10 @@ attach_fn_fields_to_type (struct stab_field_info *fip, struct type *type)
{
int n;
- for (n = TYPE_NFN_FIELDS (type);
- fip->fnlist != NULL;
+ for (n = TYPE_NFN_FIELDS (type); fip->fnlist != NULL;
fip->fnlist = fip->fnlist->next)
{
- --n; /* Circumvent Sun3 compiler bug. */
+ --n; /* Circumvent Sun3 compiler bug. */
TYPE_FN_FIELDLISTS (type)[n] = fip->fnlist->fn_fieldlist;
}
return 1;
@@ -3272,25 +3252,24 @@ attach_fields_to_type (struct stab_field_info *fip, struct type *type,
array of fields, and create blank visibility bitfields if necessary. */
type->set_num_fields (nfields);
- type->set_fields
- ((struct field *)
- TYPE_ALLOC (type, sizeof (struct field) * nfields));
+ type->set_fields ((struct field *) TYPE_ALLOC (type, sizeof (struct field)
+ * nfields));
memset (type->fields (), 0, sizeof (struct field) * nfields);
if (non_public_fields)
{
ALLOCATE_CPLUS_STRUCT_TYPE (type);
- TYPE_FIELD_PRIVATE_BITS (type) =
- (B_TYPE *) TYPE_ALLOC (type, B_BYTES (nfields));
+ TYPE_FIELD_PRIVATE_BITS (type)
+ = (B_TYPE *) TYPE_ALLOC (type, B_BYTES (nfields));
B_CLRALL (TYPE_FIELD_PRIVATE_BITS (type), nfields);
- TYPE_FIELD_PROTECTED_BITS (type) =
- (B_TYPE *) TYPE_ALLOC (type, B_BYTES (nfields));
+ TYPE_FIELD_PROTECTED_BITS (type)
+ = (B_TYPE *) TYPE_ALLOC (type, B_BYTES (nfields));
B_CLRALL (TYPE_FIELD_PROTECTED_BITS (type), nfields);
- TYPE_FIELD_IGNORE_BITS (type) =
- (B_TYPE *) TYPE_ALLOC (type, B_BYTES (nfields));
+ TYPE_FIELD_IGNORE_BITS (type)
+ = (B_TYPE *) TYPE_ALLOC (type, B_BYTES (nfields));
B_CLRALL (TYPE_FIELD_IGNORE_BITS (type), nfields);
}
@@ -3322,7 +3301,7 @@ attach_fields_to_type (struct stab_field_info *fip, struct type *type,
default:
/* Unknown visibility. Complain and treat it as public. */
{
- complaint (_("Unknown visibility `%c' for field"),
+ complaint (_ ("Unknown visibility `%c' for field"),
fip->list->visibility);
}
break;
@@ -3332,10 +3311,9 @@ attach_fields_to_type (struct stab_field_info *fip, struct type *type,
return 1;
}
-
/* Complain that the compiler has emitted more than one definition for the
structure type TYPE. */
-static void
+static void
complain_about_struct_wipeout (struct type *type)
{
const char *name = "";
@@ -3346,10 +3324,17 @@ complain_about_struct_wipeout (struct type *type)
name = type->name ();
switch (type->code ())
{
- case TYPE_CODE_STRUCT: kind = "struct "; break;
- case TYPE_CODE_UNION: kind = "union "; break;
- case TYPE_CODE_ENUM: kind = "enum "; break;
- default: kind = "";
+ case TYPE_CODE_STRUCT:
+ kind = "struct ";
+ break;
+ case TYPE_CODE_UNION:
+ kind = "union ";
+ break;
+ case TYPE_CODE_ENUM:
+ kind = "enum ";
+ break;
+ default:
+ kind = "";
}
}
else
@@ -3358,7 +3343,7 @@ complain_about_struct_wipeout (struct type *type)
kind = "";
}
- complaint (_("struct/union type gets multiply defined: %s%s"), kind, name);
+ complaint (_ ("struct/union type gets multiply defined: %s%s"), kind, name);
}
/* Set the length for all variants of a same main_type, which are
@@ -3429,8 +3414,7 @@ read_struct_type (const char **pp, struct type *type, enum type_code type_code,
Obviously, GDB can't fix this by itself, but it can at least avoid
scribbling on existing structure type objects when new definitions
appear. */
- if (! (type->code () == TYPE_CODE_UNDEF
- || type->is_stub ()))
+ if (!(type->code () == TYPE_CODE_UNDEF || type->is_stub ()))
{
complain_about_struct_wipeout (type);
@@ -3477,8 +3461,7 @@ read_struct_type (const char **pp, struct type *type, enum type_code type_code,
array. */
static struct type *
-read_array_type (const char **pp, struct type *type,
- struct objfile *objfile)
+read_array_type (const char **pp, struct type *type, struct objfile *objfile)
{
struct type *index_type, *element_type, *range_type;
int lower, upper;
@@ -3492,13 +3475,13 @@ read_array_type (const char **pp, struct type *type,
Fortran adjustable arrays use Adigits or Tdigits for lower or upper;
for these, produce a type like float[][]. */
- {
- index_type = read_type (pp, objfile);
- if (**pp != ';')
- /* Improper format of array type decl. */
- return error_type (pp, objfile);
- ++*pp;
- }
+ {
+ index_type = read_type (pp, objfile);
+ if (**pp != ';')
+ /* Improper format of array type decl. */
+ return error_type (pp, objfile);
+ ++*pp;
+ }
if (!(**pp >= '0' && **pp <= '9') && **pp != '-')
{
@@ -3527,21 +3510,18 @@ read_array_type (const char **pp, struct type *type,
upper = -1;
}
- range_type =
- create_static_range_type (NULL, index_type, lower, upper);
+ range_type = create_static_range_type (NULL, index_type, lower, upper);
type = create_array_type (type, element_type, range_type);
return type;
}
-
/* Read a definition of an enumeration type,
and create and return a suitable type object.
Also defines the symbols that represent the values of the type. */
static struct type *
-read_enum_type (const char **pp, struct type *type,
- struct objfile *objfile)
+read_enum_type (const char **pp, struct type *type, struct objfile *objfile)
{
struct gdbarch *gdbarch = objfile->arch ();
const char *p;
@@ -3563,7 +3543,7 @@ read_enum_type (const char **pp, struct type *type,
symlist = get_local_symbols ();
else
#endif
- symlist = get_file_symbols ();
+ symlist = get_file_symbols ();
osyms = *symlist;
o_nsyms = osyms ? osyms->nsyms : 0;
@@ -3608,7 +3588,7 @@ read_enum_type (const char **pp, struct type *type,
}
if (**pp == ';')
- (*pp)++; /* Skip the semicolon. */
+ (*pp)++; /* Skip the semicolon. */
/* Now fill in the fields of the type-structure. */
@@ -3619,9 +3599,8 @@ read_enum_type (const char **pp, struct type *type,
if (unsigned_enum)
type->set_is_unsigned (true);
type->set_num_fields (nsyms);
- type->set_fields
- ((struct field *)
- TYPE_ALLOC (type, sizeof (struct field) * nsyms));
+ type->set_fields ((struct field *) TYPE_ALLOC (type, sizeof (struct field)
+ * nsyms));
memset (type->fields (), 0, sizeof (struct field) * nsyms);
/* Find the symbols for the values and put them into the type.
@@ -3667,7 +3646,8 @@ read_enum_type (const char **pp, struct type *type,
FIXME. */
static struct type *
-read_sun_builtin_type (const char **pp, int typenums[2], struct objfile *objfile)
+read_sun_builtin_type (const char **pp, int typenums[2],
+ struct objfile *objfile)
{
int type_bits;
int nbits;
@@ -3729,8 +3709,8 @@ read_sun_builtin_type (const char **pp, int typenums[2], struct objfile *objfile
if (type_bits == 0)
{
- struct type *type = init_type (objfile, TYPE_CODE_VOID,
- TARGET_CHAR_BIT, NULL);
+ struct type *type
+ = init_type (objfile, TYPE_CODE_VOID, TARGET_CHAR_BIT, NULL);
if (unsigned_type)
type->set_is_unsigned (true);
@@ -3880,7 +3860,7 @@ read_huge_number (const char **pp, int end, int *bits,
{
/* unsigned representation */
n *= radix;
- n += c - '0'; /* FIXME this overflows anyway. */
+ n += c - '0'; /* FIXME this overflows anyway. */
}
}
else
@@ -3974,8 +3954,7 @@ read_range_type (const char **pp, int typenums[2], int type_size,
In C it is usually 0, 1 or the type being defined. */
if (read_type_number (pp, rangenums) != 0)
return error_type (pp, objfile);
- self_subrange = (rangenums[0] == typenums[0] &&
- rangenums[1] == typenums[1]);
+ self_subrange = (rangenums[0] == typenums[0] && rangenums[1] == typenums[1]);
if (**pp == '=')
{
@@ -4089,8 +4068,8 @@ read_range_type (const char **pp, int typenums[2], int type_size,
itself with range 0-127. */
else if (self_subrange && n2 == 0 && n3 == 127)
{
- struct type *type = init_integer_type (objfile, TARGET_CHAR_BIT,
- 0, NULL);
+ struct type *type
+ = init_integer_type (objfile, TARGET_CHAR_BIT, 0, NULL);
type->set_has_no_signedness (true);
return type;
}
@@ -4125,8 +4104,7 @@ read_range_type (const char **pp, int typenums[2], int type_size,
of self_subrange. */
else if (n3 == 0 && n2 < 0
&& (self_subrange
- || n2 == -gdbarch_long_long_bit
- (gdbarch) / TARGET_CHAR_BIT))
+ || n2 == -gdbarch_long_long_bit (gdbarch) / TARGET_CHAR_BIT))
return init_integer_type (objfile, -n2 * TARGET_CHAR_BIT, 0, NULL);
else if (n2 == -n3 - 1)
{
@@ -4151,13 +4129,13 @@ handle_true_range:
/* Does this actually ever happen? Is that why we are worrying
about dealing with it rather than just calling error_type? */
- complaint (_("base type %d of range type is not defined"), rangenums[1]);
+ complaint (_ ("base type %d of range type is not defined"),
+ rangenums[1]);
index_type = objfile_type (objfile)->builtin_int;
}
- result_type
- = create_static_range_type (NULL, index_type, n2, n3);
+ result_type = create_static_range_type (NULL, index_type, n2, n3);
return (result_type);
}
@@ -4170,7 +4148,7 @@ read_args (const char **pp, int end, struct objfile *objfile, int *nargsp,
int *varargsp)
{
/* FIXME! Remove this arbitrary limit! */
- struct type *types[1024]; /* Allow for fns of 1023 parameters. */
+ struct type *types[1024]; /* Allow for fns of 1023 parameters. */
int n = 0, i;
struct field *rval;
@@ -4183,7 +4161,7 @@ read_args (const char **pp, int end, struct objfile *objfile, int *nargsp,
STABS_CONTINUE (pp, objfile);
types[n++] = read_type (pp, objfile);
}
- (*pp)++; /* get past `end' (the ':' character). */
+ (*pp)++; /* get past `end' (the ':' character). */
if (n == 0)
{
@@ -4192,7 +4170,7 @@ read_args (const char **pp, int end, struct objfile *objfile, int *nargsp,
have been present ";-16,(0,43)" reference instead. This way the
excessive ";" marker prematurely stops the parameters parsing. */
- complaint (_("Invalid (empty) method arguments"));
+ complaint (_ ("Invalid (empty) method arguments"));
*varargsp = 0;
}
else if (types[n - 1]->code () != TYPE_CODE_VOID)
@@ -4209,7 +4187,7 @@ read_args (const char **pp, int end, struct objfile *objfile, int *nargsp,
*nargsp = n;
return rval;
}
-
+
/* Common block handling. */
/* List of symbols declared since the last BCOMM. This list is a tail
@@ -4234,7 +4212,7 @@ common_block_start (const char *name, struct objfile *objfile)
{
if (common_block_name != NULL)
{
- complaint (_("Invalid symbol data: common block within common block"));
+ complaint (_ ("Invalid symbol data: common block within common block"));
}
common_block = *get_local_symbols ();
common_block_i = common_block ? common_block->nsyms : 0;
@@ -4259,7 +4237,7 @@ common_block_end (struct objfile *objfile)
if (common_block_name == NULL)
{
- complaint (_("ECOMM symbol unmatched by BCOMM"));
+ complaint (_ ("ECOMM symbol unmatched by BCOMM"));
return;
}
@@ -4271,8 +4249,7 @@ common_block_end (struct objfile *objfile)
/* Now we copy all the symbols which have been defined since the BCOMM. */
/* Copy all the struct pendings before common_block. */
- for (next = *get_local_symbols ();
- next != NULL && next != common_block;
+ for (next = *get_local_symbols (); next != NULL && next != common_block;
next = next->next)
{
for (j = 0; j < next->nsyms; j++)
@@ -4313,14 +4290,12 @@ fix_common_block (struct symbol *sym, CORE_ADDR valu, int section_index)
for (j = next->nsyms - 1; j >= 0; j--)
{
- next->symbol[j]->set_value_address
- (next->symbol[j]->value_address () + valu);
+ next->symbol[j]->set_value_address (next->symbol[j]->value_address ()
+ + valu);
next->symbol[j]->set_section_index (section_index);
}
}
}
-
-
/* Add {TYPE, TYPENUMS} to the NONAME_UNDEFS vector.
See add_undefined_type for more details. */
@@ -4330,16 +4305,16 @@ add_undefined_type_noname (struct type *type, int typenums[2])
{
struct nat nat;
- nat.typenums[0] = typenums [0];
- nat.typenums[1] = typenums [1];
+ nat.typenums[0] = typenums[0];
+ nat.typenums[1] = typenums[1];
nat.type = type;
if (noname_undefs_length == noname_undefs_allocated)
{
noname_undefs_allocated *= 2;
- noname_undefs = (struct nat *)
- xrealloc ((char *) noname_undefs,
- noname_undefs_allocated * sizeof (struct nat));
+ noname_undefs = (struct nat *) xrealloc ((char *) noname_undefs,
+ noname_undefs_allocated
+ * sizeof (struct nat));
}
noname_undefs[noname_undefs_length++] = nat;
}
@@ -4353,9 +4328,9 @@ add_undefined_type_1 (struct type *type)
if (undef_types_length == undef_types_allocated)
{
undef_types_allocated *= 2;
- undef_types = (struct type **)
- xrealloc ((char *) undef_types,
- undef_types_allocated * sizeof (struct type *));
+ undef_types = (struct type **) xrealloc ((char *) undef_types,
+ undef_types_allocated
+ * sizeof (struct type *));
}
undef_types[undef_types_length++] = type;
}
@@ -4447,7 +4422,6 @@ cleanup_undefined_types_1 (void)
{
switch ((*type)->code ())
{
-
case TYPE_CODE_STRUCT:
case TYPE_CODE_UNION:
case TYPE_CODE_ENUM:
@@ -4465,7 +4439,7 @@ cleanup_undefined_types_1 (void)
if (type_name == NULL)
{
- complaint (_("need a type name"));
+ complaint (_ ("need a type name"));
break;
}
for (ppt = *get_file_symbols (); ppt; ppt = ppt->next)
@@ -4489,8 +4463,8 @@ cleanup_undefined_types_1 (void)
default:
{
- complaint (_("forward-referenced types left unresolved, "
- "type code %d."),
+ complaint (_ ("forward-referenced types left unresolved, "
+ "type code %d."),
(*type)->code ());
}
break;
@@ -4585,12 +4559,12 @@ scan_file_globals (struct objfile *objfile)
if (sym)
{
if (sym->aclass () == LOC_BLOCK)
- fix_common_block
- (sym, msymbol->value_address (resolve_objfile),
- msymbol->section_index ());
+ fix_common_block (
+ sym, msymbol->value_address (resolve_objfile),
+ msymbol->section_index ());
else
- sym->set_value_address
- (msymbol->value_address (resolve_objfile));
+ sym->set_value_address (
+ msymbol->value_address (resolve_objfile));
sym->set_section_index (msymbol->section_index ());
}
@@ -4633,8 +4607,8 @@ scan_file_globals (struct objfile *objfile)
if (prev->aclass () == LOC_STATIC)
prev->set_aclass_index (LOC_UNRESOLVED);
else
- complaint (_("%s: common block `%s' from "
- "global_sym_chain unresolved"),
+ complaint (_ ("%s: common block `%s' from "
+ "global_sym_chain unresolved"),
objfile_name (objfile), prev->print_name ());
}
}
@@ -4667,7 +4641,7 @@ stabsread_new_init (void)
void
start_stabs (void)
{
- global_stabs = NULL; /* AIX COFF */
+ global_stabs = NULL; /* AIX COFF */
/* Leave FILENUM of 0 free for builtin types and this file's types. */
n_this_object_header_files = 1;
type_vector_length = 0;
@@ -4715,12 +4689,12 @@ find_name_end (const char *name)
/* Must be an ObjC method symbol. */
if (s[1] != '[')
{
- error (_("invalid symbol name \"%s\""), name);
+ error (_ ("invalid symbol name \"%s\""), name);
}
s = strchr (s, ']');
if (s == NULL)
{
- error (_("invalid symbol name \"%s\""), name);
+ error (_ ("invalid symbol name \"%s\""), name);
}
return strchr (s, ':');
}
@@ -4741,6 +4715,7 @@ hashname (const char *name)
/* Initializer for this module. */
void _initialize_stabsread ();
+
void
_initialize_stabsread ()
{
@@ -4752,8 +4727,8 @@ _initialize_stabsread ()
noname_undefs_length = 0;
noname_undefs = XNEWVEC (struct nat, noname_undefs_allocated);
- stab_register_index = register_symbol_register_impl (LOC_REGISTER,
- &stab_register_funcs);
- stab_regparm_index = register_symbol_register_impl (LOC_REGPARM_ADDR,
- &stab_register_funcs);
+ stab_register_index
+ = register_symbol_register_impl (LOC_REGISTER, &stab_register_funcs);
+ stab_regparm_index
+ = register_symbol_register_impl (LOC_REGPARM_ADDR, &stab_register_funcs);
}
diff --git a/gdb/stabsread.h b/gdb/stabsread.h
index 9df79bc7dfa..a26e0cd9161 100644
--- a/gdb/stabsread.h
+++ b/gdb/stabsread.h
@@ -26,7 +26,8 @@ enum language;
/* Definitions, prototypes, etc for stabs debugging format support
functions. */
-#define HASHSIZE 127 /* Size of things hashed via
+#define HASHSIZE \
+ 127 /* Size of things hashed via
hashname(). */
/* Compute a small integer hash code for the given name. */
@@ -37,7 +38,7 @@ extern int hashname (const char *name);
extern unsigned int symnum;
-#define next_symbol_text(objfile) (*next_symbol_text_func)(objfile)
+#define next_symbol_text(objfile) (*next_symbol_text_func) (objfile)
/* Function to invoke get the next symbol. Return the symbol name. */
@@ -69,11 +70,11 @@ extern void common_block_end (struct objfile *);
/* Kludge for xcoffread.c */
struct pending_stabs
- {
- int count;
- int length;
- char *stab[1];
- };
+{
+ int count;
+ int length;
+ char *stab[1];
+};
extern struct pending_stabs *global_stabs;
@@ -81,7 +82,7 @@ extern struct pending_stabs *global_stabs;
Used to detect pairs of N_SO symbols. */
extern int previous_stab_code;
-
+
/* Support for Sun changes to dbx symbol format. */
/* For each identified header file, we have a table of types defined
@@ -103,27 +104,25 @@ extern int previous_stab_code;
used to match header-file references to their corresponding data. */
struct header_file
- {
-
- /* Name of header file */
+{
+ /* Name of header file */
- char *name;
+ char *name;
- /* Numeric code distinguishing instances of one header file that
+ /* Numeric code distinguishing instances of one header file that
produced different results when included. It comes from the
N_BINCL or N_EXCL. */
- int instance;
+ int instance;
- /* Pointer to vector of types */
+ /* Pointer to vector of types */
- struct type **vector;
+ struct type **vector;
- /* Allocated length (# elts) of that vector */
+ /* Allocated length (# elts) of that vector */
- int length;
-
- };
+ int length;
+};
/* The table of header_files of this OBJFILE. */
#define HEADER_FILES(OBJFILE) (DBX_SYMFILE_INFO (OBJFILE)->header_files)
@@ -167,32 +166,30 @@ extern void start_stabs (void);
extern void end_stabs (void);
extern void finish_global_stabs (struct objfile *objfile);
-
+
/* Functions exported by dbxread.c. These are not in stabsread.c because
they are only used by some stabs readers. */
-extern legacy_psymtab *dbx_end_psymtab
- (struct objfile *objfile, psymtab_storage *partial_symtabs,
- legacy_psymtab *pst,
- const char **include_list, int num_includes,
- int capping_symbol_offset, CORE_ADDR capping_text,
- legacy_psymtab **dependency_list, int number_dependencies,
- int textlow_not_set);
+extern legacy_psymtab *
+dbx_end_psymtab (struct objfile *objfile, psymtab_storage *partial_symtabs,
+ legacy_psymtab *pst, const char **include_list,
+ int num_includes, int capping_symbol_offset,
+ CORE_ADDR capping_text, legacy_psymtab **dependency_list,
+ int number_dependencies, int textlow_not_set);
extern void process_one_symbol (int, int, CORE_ADDR, const char *,
- const section_offsets &,
- struct objfile *, enum language);
+ const section_offsets &, struct objfile *,
+ enum language);
extern void elfstab_build_psymtabs (struct objfile *objfile,
- asection *stabsect,
- file_ptr stabstroffset,
+ asection *stabsect, file_ptr stabstroffset,
unsigned int stabstrsize);
-extern void coffstab_build_psymtabs
- (struct objfile *objfile,
- CORE_ADDR textaddr, unsigned int textsize,
- const std::vector<asection *> &stabs,
- file_ptr stabstroffset, unsigned int stabstrsize);
+extern void coffstab_build_psymtabs (struct objfile *objfile,
+ CORE_ADDR textaddr, unsigned int textsize,
+ const std::vector<asection *> &stabs,
+ file_ptr stabstroffset,
+ unsigned int stabstrsize);
extern void stabsect_build_psymtabs (struct objfile *objfile, char *stab_name,
char *stabstr_name, char *text_name);
diff --git a/gdb/stack.c b/gdb/stack.c
index c36f144f093..00c034053cf 100644
--- a/gdb/stack.c
+++ b/gdb/stack.c
@@ -65,14 +65,9 @@ const char print_frame_arguments_scalars[] = "scalars";
const char print_frame_arguments_none[] = "none";
const char print_frame_arguments_presence[] = "presence";
-static const char *const print_frame_arguments_choices[] =
-{
- print_frame_arguments_all,
- print_frame_arguments_scalars,
- print_frame_arguments_none,
- print_frame_arguments_presence,
- NULL
-};
+static const char *const print_frame_arguments_choices[]
+ = { print_frame_arguments_all, print_frame_arguments_scalars,
+ print_frame_arguments_none, print_frame_arguments_presence, NULL };
/* The possible choices of "set print frame-info", and the value
of this setting. */
@@ -84,22 +79,20 @@ const char print_frame_info_source_and_location[] = "source-and-location";
const char print_frame_info_location_and_address[] = "location-and-address";
const char print_frame_info_short_location[] = "short-location";
-static const char *const print_frame_info_choices[] =
-{
- print_frame_info_auto,
- print_frame_info_source_line,
- print_frame_info_location,
- print_frame_info_source_and_location,
- print_frame_info_location_and_address,
- print_frame_info_short_location,
- NULL
-};
+static const char *const print_frame_info_choices[]
+ = { print_frame_info_auto,
+ print_frame_info_source_line,
+ print_frame_info_location,
+ print_frame_info_source_and_location,
+ print_frame_info_location_and_address,
+ print_frame_info_short_location,
+ NULL };
/* print_frame_info_print_what[i] maps a choice to the corresponding
print_what enum. */
-static const gdb::optional<enum print_what> print_frame_info_print_what[] =
- {{}, /* Empty value for "auto". */
- SRC_LINE, LOCATION, SRC_AND_LOC, LOC_AND_ADDRESS, SHORT_LOCATION};
+static const gdb::optional<enum print_what> print_frame_info_print_what[]
+ = { {}, /* Empty value for "auto". */
+ SRC_LINE, LOCATION, SRC_AND_LOC, LOC_AND_ADDRESS, SHORT_LOCATION };
/* The possible choices of "set print entry-values", and the value
of this setting. */
@@ -111,17 +104,11 @@ const char print_entry_values_if_needed[] = "if-needed";
const char print_entry_values_both[] = "both";
const char print_entry_values_compact[] = "compact";
const char print_entry_values_default[] = "default";
-static const char *const print_entry_values_choices[] =
-{
- print_entry_values_no,
- print_entry_values_only,
- print_entry_values_preferred,
- print_entry_values_if_needed,
- print_entry_values_both,
- print_entry_values_compact,
- print_entry_values_default,
- NULL
-};
+static const char *const print_entry_values_choices[]
+ = { print_entry_values_no, print_entry_values_only,
+ print_entry_values_preferred, print_entry_values_if_needed,
+ print_entry_values_both, print_entry_values_compact,
+ print_entry_values_default, NULL };
/* See frame.h. */
frame_print_options user_frame_print_options;
@@ -131,8 +118,7 @@ frame_print_options user_frame_print_options;
using boolean_option_def
= gdb::option::boolean_option_def<frame_print_options>;
-using enum_option_def
- = gdb::option::enum_option_def<frame_print_options>;
+using enum_option_def = gdb::option::enum_option_def<frame_print_options>;
static const gdb::option::option_def frame_print_option_defs[] = {
@@ -141,42 +127,38 @@ static const gdb::option::option_def frame_print_option_defs[] = {
print_entry_values_choices,
[] (frame_print_options *opt) { return &opt->print_entry_values; },
NULL, /* show_cmd_cb */
- N_("Set printing of function arguments at function entry."),
- N_("Show printing of function arguments at function entry."),
- N_("GDB can sometimes determine the values of function arguments at entry,\n\
+ N_ ("Set printing of function arguments at function entry."),
+ N_ ("Show printing of function arguments at function entry."),
+ N_ (
+ "GDB can sometimes determine the values of function arguments at entry,\n\
in addition to their current values. This option tells GDB whether\n\
to print the current value, the value at entry (marked as val@entry),\n\
or both. Note that one or both of these values may be <optimized out>."),
},
enum_option_def {
- "frame-arguments",
- print_frame_arguments_choices,
+ "frame-arguments", print_frame_arguments_choices,
[] (frame_print_options *opt) { return &opt->print_frame_arguments; },
NULL, /* show_cmd_cb */
- N_("Set printing of non-scalar frame arguments."),
- N_("Show printing of non-scalar frame arguments."),
- NULL /* help_doc */
+ N_ ("Set printing of non-scalar frame arguments."),
+ N_ ("Show printing of non-scalar frame arguments."), NULL /* help_doc */
},
boolean_option_def {
"raw-frame-arguments",
[] (frame_print_options *opt) { return &opt->print_raw_frame_arguments; },
NULL, /* show_cmd_cb */
- N_("Set whether to print frame arguments in raw form."),
- N_("Show whether to print frame arguments in raw form."),
- N_("If set, frame arguments are printed in raw form, bypassing any\n\
-pretty-printers for that value.")
- },
+ N_ ("Set whether to print frame arguments in raw form."),
+ N_ ("Show whether to print frame arguments in raw form."),
+ N_ ("If set, frame arguments are printed in raw form, bypassing any\n\
+pretty-printers for that value.") },
enum_option_def {
- "frame-info",
- print_frame_info_choices,
+ "frame-info", print_frame_info_choices,
[] (frame_print_options *opt) { return &opt->print_frame_info; },
NULL, /* show_cmd_cb */
- N_("Set printing of frame information."),
- N_("Show printing of frame information."),
- NULL /* help_doc */
+ N_ ("Set printing of frame information."),
+ N_ ("Show printing of frame information."), NULL /* help_doc */
}
};
@@ -190,40 +172,35 @@ struct backtrace_cmd_options
bool hide = false;
};
-using bt_flag_option_def
- = gdb::option::flag_option_def<backtrace_cmd_options>;
+using bt_flag_option_def = gdb::option::flag_option_def<backtrace_cmd_options>;
static const gdb::option::option_def backtrace_command_option_defs[] = {
- bt_flag_option_def {
- "full",
- [] (backtrace_cmd_options *opt) { return &opt->full; },
- N_("Print values of local variables.")
- },
+ bt_flag_option_def { "full",
+ [] (backtrace_cmd_options *opt) { return &opt->full; },
+ N_ ("Print values of local variables.") },
bt_flag_option_def {
"no-filters",
[] (backtrace_cmd_options *opt) { return &opt->no_filters; },
- N_("Prohibit frame filters from executing on a backtrace."),
+ N_ ("Prohibit frame filters from executing on a backtrace."),
},
bt_flag_option_def {
"hide",
[] (backtrace_cmd_options *opt) { return &opt->hide; },
- N_("Causes Python frame filter elided frames to not be printed."),
+ N_ ("Causes Python frame filter elided frames to not be printed."),
},
};
/* Prototypes for local functions. */
-static void print_frame_local_vars (frame_info_ptr frame,
- bool quiet,
+static void print_frame_local_vars (frame_info_ptr frame, bool quiet,
const char *regexp, const char *t_regexp,
int num_tabs, struct ui_file *stream);
-static void print_frame (const frame_print_options &opts,
- frame_info_ptr frame, int print_level,
- enum print_what print_what, int print_args,
- struct symtab_and_line sal);
+static void print_frame (const frame_print_options &opts, frame_info_ptr frame,
+ int print_level, enum print_what print_what,
+ int print_args, struct symtab_and_line sal);
static frame_info_ptr find_frame_for_function (const char *);
static frame_info_ptr find_frame_for_address (CORE_ADDR);
@@ -241,29 +218,25 @@ int annotation_level = 0;
class last_displayed_symtab_info_type
{
public:
+
/* True if the cached information is valid. */
- bool is_valid () const
- { return m_valid; }
+ bool is_valid () const { return m_valid; }
/* Return the cached program_space. If the cache is invalid nullptr is
returned. */
- struct program_space *pspace () const
- { return m_pspace; }
+ struct program_space *pspace () const { return m_pspace; }
/* Return the cached CORE_ADDR address. If the cache is invalid 0 is
returned. */
- CORE_ADDR address () const
- { return m_address; }
+ CORE_ADDR address () const { return m_address; }
/* Return the cached symtab. If the cache is invalid nullptr is
returned. */
- struct symtab *symtab () const
- { return m_symtab; }
+ struct symtab *symtab () const { return m_symtab; }
/* Return the cached line number. If the cache is invalid 0 is
returned. */
- int line () const
- { return m_line; }
+ int line () const { return m_line; }
/* Invalidate the cache, reset all the members to their default value. */
void invalidate ()
@@ -289,6 +262,7 @@ public:
}
private:
+
/* True when the cache is valid. */
bool m_valid = false;
@@ -309,13 +283,10 @@ private:
displayed. */
static last_displayed_symtab_info_type last_displayed_symtab_info;
-
-
/* See stack.h. */
bool
-frame_show_address (frame_info_ptr frame,
- struct symtab_and_line sal)
+frame_show_address (frame_info_ptr frame, struct symtab_and_line sal)
{
/* If there is a line number, but no PC, then there is no location
information associated with this sal. The only way that should
@@ -354,19 +325,16 @@ print_stack_frame_to_uiout (struct ui_out *uiout, frame_info_ptr frame,
void
print_stack_frame (frame_info_ptr frame, int print_level,
- enum print_what print_what,
- int set_current_sal)
+ enum print_what print_what, int set_current_sal)
{
-
/* For mi, always print location and address. */
if (current_uiout->is_mi_like_p ())
print_what = LOC_AND_ADDRESS;
try
{
- print_frame_info (user_frame_print_options,
- frame, print_level, print_what, 1 /* print_args */,
- set_current_sal);
+ print_frame_info (user_frame_print_options, frame, print_level,
+ print_what, 1 /* print_args */, set_current_sal);
if (set_current_sal)
set_current_sal_from_frame (frame);
}
@@ -396,8 +364,8 @@ print_frame_nameless_args (frame_info_ptr frame, long start, int num,
argsaddr = get_frame_args_address (frame);
if (!argsaddr)
return;
- arg_value = read_memory_integer (argsaddr + start,
- sizeof (int), byte_order);
+ arg_value
+ = read_memory_integer (argsaddr + start, sizeof (int), byte_order);
if (!first)
gdb_printf (stream, ", ");
gdb_printf (stream, "%ld", arg_value);
@@ -451,7 +419,7 @@ print_frame_arg (const frame_print_options &fp_opts,
{
if (arg->error)
{
- stb.printf (_("<error reading variable: %s>"), arg->error.get ());
+ stb.printf (_ ("<error reading variable: %s>"), arg->error.get ());
style = metadata_style.style ();
}
else
@@ -465,7 +433,7 @@ print_frame_arg (const frame_print_options &fp_opts,
just want to print their addresses. Print ??? for args whose
address we do not know. We pass 2 as "recurse" to val_print
because our standard indentation here is 4 spaces, and
- val_print indents 2 for each recurse. */
+ val_print indents 2 for each recurse. */
annotate_arg_value (value_type (arg->val));
@@ -481,15 +449,14 @@ print_frame_arg (const frame_print_options &fp_opts,
vp_opts.raw = fp_opts.print_raw_frame_arguments;
/* True in "summary" mode, false otherwise. */
- vp_opts.summary
- = fp_opts.print_frame_arguments == print_frame_arguments_scalars;
+ vp_opts.summary = fp_opts.print_frame_arguments
+ == print_frame_arguments_scalars;
common_val_print_checked (arg->val, &stb, 2, &vp_opts, language);
}
catch (const gdb_exception_error &except)
{
- stb.printf (_("<error reading variable: %s>"),
- except.what ());
+ stb.printf (_ ("<error reading variable: %s>"), except.what ());
style = metadata_style.style ();
}
}
@@ -524,9 +491,9 @@ read_frame_local (struct symbol *sym, frame_info_ptr frame,
function never throws an exception. */
void
-read_frame_arg (const frame_print_options &fp_opts,
- symbol *sym, frame_info_ptr frame,
- struct frame_arg *argp, struct frame_arg *entryargp)
+read_frame_arg (const frame_print_options &fp_opts, symbol *sym,
+ frame_info_ptr frame, struct frame_arg *argp,
+ struct frame_arg *entryargp)
{
struct value *val = NULL, *entryval = NULL;
char *val_error = NULL, *entryval_error = NULL;
@@ -549,8 +516,8 @@ read_frame_arg (const frame_print_options &fp_opts,
if (SYMBOL_COMPUTED_OPS (sym) != NULL
&& SYMBOL_COMPUTED_OPS (sym)->read_variable_at_entry != NULL
&& fp_opts.print_entry_values != print_entry_values_no
- && (fp_opts.print_entry_values != print_entry_values_if_needed
- || !val || value_optimized_out (val)))
+ && (fp_opts.print_entry_values != print_entry_values_if_needed || !val
+ || value_optimized_out (val)))
{
try
{
@@ -610,9 +577,8 @@ read_frame_arg (const frame_print_options &fp_opts,
/* If the reference addresses match but dereferenced
content does not match print them. */
if (val != val_deref
- && value_contents_eq (val_deref, 0,
- entryval_deref, 0,
- type_deref->length ()))
+ && value_contents_eq (val_deref, 0, entryval_deref,
+ 0, type_deref->length ()))
val_equal = 1;
}
catch (const gdb_exception_error &except)
@@ -693,7 +659,7 @@ read_frame_arg (const frame_print_options &fp_opts,
if (!val && !val_error)
argp->entry_kind = print_entry_values_only;
else if ((fp_opts.print_entry_values == print_entry_values_compact
- || fp_opts.print_entry_values == print_entry_values_default)
+ || fp_opts.print_entry_values == print_entry_values_default)
&& val_equal)
{
argp->entry_kind = print_entry_values_compact;
@@ -721,9 +687,8 @@ read_frame_arg (const frame_print_options &fp_opts,
ints of arguments according to the stack frame". */
static void
-print_frame_args (const frame_print_options &fp_opts,
- struct symbol *func, frame_info_ptr frame,
- int num, struct ui_file *stream)
+print_frame_args (const frame_print_options &fp_opts, struct symbol *func,
+ frame_info_ptr frame, int num, struct ui_file *stream)
{
struct ui_out *uiout = current_uiout;
int first = 1;
@@ -783,14 +748,13 @@ print_frame_args (const frame_print_options &fp_opts,
/* Compute address of next argument by adding the size of
this argument and rounding to an int boundary. */
- current_offset =
- ((current_offset + arg_size + sizeof (int) - 1)
- & ~(sizeof (int) - 1));
+ current_offset
+ = ((current_offset + arg_size + sizeof (int) - 1)
+ & ~(sizeof (int) - 1));
/* If this is the highest offset seen yet, set
highest_offset. */
- if (highest_offset == -1
- || (current_offset > highest_offset))
+ if (highest_offset == -1 || (current_offset > highest_offset))
highest_offset = current_offset;
/* Add the number of ints we're about to print to
@@ -825,11 +789,11 @@ print_frame_args (const frame_print_options &fp_opts,
{
struct symbol *nsym;
- nsym = lookup_symbol_search_name (sym->search_name (),
- b, VAR_DOMAIN).symbol;
+ nsym = lookup_symbol_search_name (sym->search_name (), b,
+ VAR_DOMAIN)
+ .symbol;
gdb_assert (nsym != NULL);
- if (nsym->aclass () == LOC_REGISTER
- && !nsym->is_argument ())
+ if (nsym->aclass () == LOC_REGISTER && !nsym->is_argument ())
{
/* There is a LOC_ARG/LOC_REGISTER pair. This means
that it was passed on the stack and loaded into a
@@ -919,8 +883,8 @@ print_frame_args (const frame_print_options &fp_opts,
if (!print_names && !first && num > 0)
uiout->text ("...");
else
- print_frame_nameless_args (frame, start, num - args_printed,
- first, stream);
+ print_frame_nameless_args (frame, start, num - args_printed, first,
+ stream);
}
}
@@ -946,12 +910,11 @@ static enum auto_boolean disassemble_next_line;
static void
show_disassemble_next_line (struct ui_file *file, int from_tty,
- struct cmd_list_element *c,
- const char *value)
+ struct cmd_list_element *c, const char *value)
{
gdb_printf (file,
- _("Debugger's willingness to use "
- "disassemble-next-line is %s.\n"),
+ _ ("Debugger's willingness to use "
+ "disassemble-next-line is %s.\n"),
value);
}
@@ -959,14 +922,12 @@ show_disassemble_next_line (struct ui_file *file, int from_tty,
because it will be broken by filter sometime. */
static void
-do_gdb_disassembly (struct gdbarch *gdbarch,
- int how_many, CORE_ADDR low, CORE_ADDR high)
+do_gdb_disassembly (struct gdbarch *gdbarch, int how_many, CORE_ADDR low,
+ CORE_ADDR high)
{
-
try
{
- gdb_disassembly (gdbarch, current_uiout,
- DISASSEMBLY_RAW_INSN, how_many,
+ gdb_disassembly (gdbarch, current_uiout, DISASSEMBLY_RAW_INSN, how_many,
low, high);
}
catch (const gdb_exception_error &exception)
@@ -988,8 +949,7 @@ print_frame_info_to_print_what (const char *print_frame_info)
if (print_frame_info == print_frame_info_choices[i])
return print_frame_info_print_what[i];
- internal_error ("Unexpected print frame-info value `%s'.",
- print_frame_info);
+ internal_error ("Unexpected print frame-info value `%s'.", print_frame_info);
}
/* Print the PC from FRAME, plus any flags, to UIOUT. */
@@ -1014,9 +974,8 @@ print_pc (struct ui_out *uiout, struct gdbarch *gdbarch, frame_info_ptr frame,
void
get_user_print_what_frame_info (gdb::optional<enum print_what> *what)
{
- *what
- = print_frame_info_to_print_what
- (user_frame_print_options.print_frame_info);
+ *what = print_frame_info_to_print_what (
+ user_frame_print_options.print_frame_info);
}
/* Print information about frame FRAME. The output is format according
@@ -1029,9 +988,8 @@ get_user_print_what_frame_info (gdb::optional<enum print_what> *what)
messages. */
void
-print_frame_info (const frame_print_options &fp_opts,
- frame_info_ptr frame, int print_level,
- enum print_what print_what, int print_args,
+print_frame_info (const frame_print_options &fp_opts, frame_info_ptr frame,
+ int print_level, enum print_what print_what, int print_args,
int set_current_sal)
{
struct gdbarch *gdbarch = get_frame_arch (frame);
@@ -1094,8 +1052,8 @@ print_frame_info (const frame_print_options &fp_opts,
instruction. */
if (disassemble_next_line == AUTO_BOOLEAN_AUTO
|| disassemble_next_line == AUTO_BOOLEAN_TRUE)
- do_gdb_disassembly (get_frame_arch (frame), 1,
- get_frame_pc (frame), get_frame_pc (frame) + 1);
+ do_gdb_disassembly (get_frame_arch (frame), 1, get_frame_pc (frame),
+ get_frame_pc (frame) + 1);
return;
}
@@ -1108,10 +1066,9 @@ print_frame_info (const frame_print_options &fp_opts,
to get the line containing FRAME->pc. */
symtab_and_line sal = find_frame_sal (frame);
- location_print = (print_what == LOCATION
- || print_what == SRC_AND_LOC
- || print_what == LOC_AND_ADDRESS
- || print_what == SHORT_LOCATION);
+ location_print
+ = (print_what == LOCATION || print_what == SRC_AND_LOC
+ || print_what == LOC_AND_ADDRESS || print_what == SHORT_LOCATION);
if (location_print || !sal.symtab)
print_frame (fp_opts, frame, print_level, print_what, print_args, sal);
@@ -1122,13 +1079,13 @@ print_frame_info (const frame_print_options &fp_opts,
if ((disassemble_next_line == AUTO_BOOLEAN_AUTO
|| disassemble_next_line == AUTO_BOOLEAN_TRUE)
&& source_print && !sal.symtab)
- do_gdb_disassembly (get_frame_arch (frame), 1,
- get_frame_pc (frame), get_frame_pc (frame) + 1);
+ do_gdb_disassembly (get_frame_arch (frame), 1, get_frame_pc (frame),
+ get_frame_pc (frame) + 1);
if (source_print && sal.symtab)
{
- int mid_statement = ((print_what == SRC_LINE)
- && frame_show_address (frame, sal));
+ int mid_statement
+ = ((print_what == SRC_LINE) && frame_show_address (frame, sal));
if (annotation_level > 0
&& annotate_source_line (sal.symtab, sal.line, mid_statement,
get_frame_pc (frame)))
@@ -1227,7 +1184,7 @@ get_last_displayed_addr (void)
/* See stack.h. */
-struct symtab*
+struct symtab *
get_last_displayed_symtab (void)
{
return last_displayed_symtab_info.symtab ();
@@ -1259,7 +1216,6 @@ get_last_displayed_sal ()
return sal;
}
-
/* Attempt to obtain the name, FUNLANG and optionally FUNCP of the function
corresponding to FRAME. */
@@ -1317,9 +1273,8 @@ find_frame_funname (frame_info_ptr frame, enum language *funlang,
}
static void
-print_frame (const frame_print_options &fp_opts,
- frame_info_ptr frame, int print_level,
- enum print_what print_what, int print_args,
+print_frame (const frame_print_options &fp_opts, frame_info_ptr frame,
+ int print_level, enum print_what print_what, int print_args,
struct symtab_and_line sal)
{
struct gdbarch *gdbarch = get_frame_arch (frame);
@@ -1349,8 +1304,7 @@ print_frame (const frame_print_options &fp_opts,
}
get_user_print_options (&opts);
if (opts.addressprint)
- if (!sal.symtab
- || frame_show_address (frame, sal)
+ if (!sal.symtab || frame_show_address (frame, sal)
|| print_what == LOC_AND_ADDRESS)
{
annotate_frame_address ();
@@ -1382,7 +1336,7 @@ print_frame (const frame_print_options &fp_opts,
}
else
numargs = -1;
-
+
{
ui_out_emit_list list_emitter (uiout, "args");
try
@@ -1393,16 +1347,16 @@ print_frame (const frame_print_options &fp_opts,
{
}
- /* FIXME: ARGS must be a list. If one argument is a string it
+ /* FIXME: ARGS must be a list. If one argument is a string it
will have " that will not be properly escaped. */
- }
+ }
QUIT;
}
uiout->text (")");
if (print_what != SHORT_LOCATION && sal.symtab)
{
const char *filename_display;
-
+
filename_display = symtab_to_filename_for_display (sal.symtab);
annotate_frame_source_begin ();
uiout->wrap_hint (3);
@@ -1423,8 +1377,8 @@ print_frame (const frame_print_options &fp_opts,
annotate_frame_source_end ();
}
- if (print_what != SHORT_LOCATION
- && pc_p && (funname == NULL || sal.symtab == NULL))
+ if (print_what != SHORT_LOCATION && pc_p
+ && (funname == NULL || sal.symtab == NULL))
{
const char *lib
= solib_name_from_address (get_frame_program_space (frame),
@@ -1445,7 +1399,6 @@ print_frame (const frame_print_options &fp_opts,
uiout->text ("\n");
}
-
/* Completion function for "frame function", "info frame function", and
"select-frame function" commands. */
@@ -1460,10 +1413,9 @@ frame_selection_by_function_completer (struct cmd_list_element *ignore,
However, this would mean unwinding the stack to completion, which
could take too long, or on a corrupted stack, possibly not end.
Instead, we offer all symbol names as a safer choice. */
- collect_symbol_completion_matches (tracker,
- complete_symbol_mode::EXPRESSION,
- symbol_name_match_type::EXPRESSION,
- text, word);
+ collect_symbol_completion_matches (tracker, complete_symbol_mode::EXPRESSION,
+ symbol_name_match_type::EXPRESSION, text,
+ word);
}
/* Core of all the "info frame" sub-commands. Print information about a
@@ -1542,12 +1494,11 @@ info_frame_command_core (frame_info_ptr fi, bool selected_frame_p)
if (selected_frame_p && frame_relative_level (fi) >= 0)
{
- gdb_printf (_("Stack level %d, frame at "),
- frame_relative_level (fi));
+ gdb_printf (_ ("Stack level %d, frame at "), frame_relative_level (fi));
}
else
{
- gdb_printf (_("Stack frame at "));
+ gdb_printf (_ ("Stack frame at "));
}
gdb_puts (paddress (gdbarch, get_frame_base (fi)));
gdb_printf (":\n");
@@ -1565,11 +1516,10 @@ info_frame_command_core (frame_info_ptr fi, bool selected_frame_p)
}
gdb_stdout->wrap_here (3);
if (sal.symtab)
- gdb_printf
- (" (%ps:%d)",
- styled_string (file_name_style.style (),
- symtab_to_filename_for_display (sal.symtab)),
- sal.line);
+ gdb_printf (" (%ps:%d)",
+ styled_string (file_name_style.style (),
+ symtab_to_filename_for_display (sal.symtab)),
+ sal.line);
gdb_puts ("; ");
gdb_stdout->wrap_here (4);
gdb_printf ("saved %s = ", pc_regname);
@@ -1595,8 +1545,7 @@ info_frame_command_core (frame_info_ptr fi, bool selected_frame_p)
break;
default:
fprintf_styled (gdb_stdout, metadata_style.style (),
- _("<error: %s>"),
- ex.what ());
+ _ ("<error: %s>"), ex.what ());
break;
}
}
@@ -1612,7 +1561,7 @@ info_frame_command_core (frame_info_ptr fi, bool selected_frame_p)
reason = get_frame_unwind_stop_reason (fi);
if (reason != UNWIND_NO_REASON)
- gdb_printf (_(" Outermost frame: %s\n"),
+ gdb_printf (_ (" Outermost frame: %s\n"),
frame_stop_reason_string (fi));
}
else if (get_frame_type (fi) == TAILCALL_FRAME)
@@ -1637,8 +1586,7 @@ info_frame_command_core (frame_info_ptr fi, bool selected_frame_p)
gdb_puts ("\n");
if (s)
- gdb_printf (" source language %s.\n",
- language_str (s->language ()));
+ gdb_printf (" source language %s.\n", language_str (s->language ()));
{
/* Address of the argument list for this frame, or 0. */
@@ -1671,8 +1619,8 @@ info_frame_command_core (frame_info_ptr fi, bool selected_frame_p)
gdb_printf (" %d args: ", numargs);
}
- print_frame_args (user_frame_print_options,
- func, fi, numargs, gdb_stdout);
+ print_frame_args (user_frame_print_options, func, fi, numargs,
+ gdb_stdout);
gdb_puts ("\n");
}
}
@@ -1716,8 +1664,8 @@ info_frame_command_core (frame_info_ptr fi, bool selected_frame_p)
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
int sp_size = register_size (gdbarch, sp_regnum);
- sp = extract_unsigned_integer
- (value_contents_all (value).data (), sp_size, byte_order);
+ sp = extract_unsigned_integer (
+ value_contents_all (value).data (), sp_size, byte_order);
gdb_printf (" Previous frame's sp is ");
gdb_puts (paddress (gdbarch, sp));
@@ -1756,8 +1704,8 @@ info_frame_command_core (frame_info_ptr fi, bool selected_frame_p)
/* Find out the location of the saved register without
fetching the corresponding value. */
- frame_register_unwind (fi, i, &optimized, &unavailable,
- &lval, &addr, &realnum, NULL);
+ frame_register_unwind (fi, i, &optimized, &unavailable, &lval, &addr,
+ &realnum, NULL);
/* For moment, only display registers that were saved on the
stack. */
if (!optimized && !unavailable && lval == lval_memory)
@@ -1767,8 +1715,7 @@ info_frame_command_core (frame_info_ptr fi, bool selected_frame_p)
else
gdb_puts (",");
gdb_stdout->wrap_here (1);
- gdb_printf (" %s at ",
- gdbarch_register_name (gdbarch, i));
+ gdb_printf (" %s at ", gdbarch_register_name (gdbarch, i));
gdb_puts (paddress (gdbarch, addr));
count++;
}
@@ -1871,21 +1818,19 @@ frame_command_core (frame_info_ptr fi, bool ignored)
'frame' will all cause SELECTED_FRAME_P to be true. In all other cases
SELECTED_FRAME_P is false. */
-template <void (*FPTR) (frame_info_ptr fi, bool selected_frame_p)>
+template<void (*FPTR) (frame_info_ptr fi, bool selected_frame_p)>
class frame_command_helper
{
public:
/* The "frame level" family of commands. The ARG is an integer that is
the frame's level in the stack. */
- static void
- level (const char *arg, int from_tty)
+ static void level (const char *arg, int from_tty)
{
int level = value_as_long (parse_and_eval (arg));
- frame_info_ptr fid
- = find_relative_frame (get_current_frame (), &level);
+ frame_info_ptr fid = find_relative_frame (get_current_frame (), &level);
if (level != 0)
- error (_("No frame at level %s."), arg);
+ error (_ ("No frame at level %s."), arg);
FPTR (fid, false);
}
@@ -1893,13 +1838,12 @@ public:
address for an existing frame. This command does not allow new
frames to be created. */
- static void
- address (const char *arg, int from_tty)
+ static void address (const char *arg, int from_tty)
{
CORE_ADDR addr = value_as_address (parse_and_eval (arg));
frame_info_ptr fid = find_frame_for_address (addr);
if (fid == NULL)
- error (_("No frame at address %s."), arg);
+ error (_ ("No frame at address %s."), arg);
FPTR (fid, false);
}
@@ -1907,13 +1851,12 @@ public:
is used to view a frame that might be outside the current backtrace.
The addresses are stack-pointer address, and (optional) pc-address. */
- static void
- view (const char *args, int from_tty)
+ static void view (const char *args, int from_tty)
{
frame_info_ptr fid;
if (args == NULL)
- error (_("Missing address argument to view a frame"));
+ error (_ ("Missing address argument to view a frame"));
gdb_argv argv (args);
@@ -1921,8 +1864,8 @@ public:
{
CORE_ADDR addr[2];
- addr [0] = value_as_address (parse_and_eval (argv[0]));
- addr [1] = value_as_address (parse_and_eval (argv[1]));
+ addr[0] = value_as_address (parse_and_eval (argv[0]));
+ addr[1] = value_as_address (parse_and_eval (argv[1]));
fid = create_new_frame (addr[0], addr[1]);
}
else
@@ -1937,14 +1880,13 @@ public:
function within the stack, the first function (searching from frame
0) with that name will be selected. */
- static void
- function (const char *arg, int from_tty)
+ static void function (const char *arg, int from_tty)
{
if (arg == NULL)
- error (_("Missing function name argument"));
+ error (_ ("Missing function name argument"));
frame_info_ptr fid = find_frame_for_function (arg);
if (fid == NULL)
- error (_("No frame for function \"%s\"."), arg);
+ error (_ ("No frame for function \"%s\"."), arg);
FPTR (fid, false);
}
@@ -1955,11 +1897,10 @@ public:
If no argument is provided, then the current frame is selected. */
- static void
- base_command (const char *arg, int from_tty)
+ static void base_command (const char *arg, int from_tty)
{
if (arg == NULL)
- FPTR (get_selected_frame (_("No stack.")), true);
+ FPTR (get_selected_frame (_ ("No stack.")), true);
else
level (arg, from_tty);
}
@@ -1968,9 +1909,9 @@ public:
/* Instantiate three FRAME_COMMAND_HELPER instances to implement the
sub-commands for 'info frame', 'frame', and 'select-frame' commands. */
-static frame_command_helper <info_frame_command_core> info_frame_cmd;
-static frame_command_helper <frame_command_core> frame_cmd;
-static frame_command_helper <select_frame_command_core> select_frame_cmd;
+static frame_command_helper<info_frame_command_core> info_frame_cmd;
+static frame_command_helper<frame_command_core> frame_cmd;
+static frame_command_helper<select_frame_command_core> select_frame_cmd;
/* Print briefly all stack frames or just the innermost COUNT_EXP
frames. */
@@ -1987,7 +1928,7 @@ backtrace_command_1 (const frame_print_options &fp_opts,
enum ext_lang_bt_status result = EXT_LANG_BT_ERROR;
if (!target_has_stack ())
- error (_("No stack."));
+ error (_ ("No stack."));
if (count_exp)
{
@@ -2034,9 +1975,9 @@ backtrace_command_1 (const frame_print_options &fp_opts,
else
gdb_assert (0);
- result = apply_ext_lang_frame_filter (get_current_frame (), flags,
- arg_type, current_uiout,
- py_start, py_end);
+ result
+ = apply_ext_lang_frame_filter (get_current_frame (), flags, arg_type,
+ current_uiout, py_start, py_end);
}
/* Run the inbuilt backtrace if there are no filters registered, or
@@ -2077,7 +2018,7 @@ backtrace_command_1 (const frame_print_options &fp_opts,
/* If we've stopped before the end, mention that. */
if (fi && from_tty)
- gdb_printf (_("(More stack frames follow...)\n"));
+ gdb_printf (_ ("(More stack frames follow...)\n"));
/* If we've run out of frames, and the reason appears to be an error
condition, print it. */
@@ -2087,7 +2028,7 @@ backtrace_command_1 (const frame_print_options &fp_opts,
reason = get_frame_unwind_stop_reason (trailing);
if (reason >= UNWIND_FIRST_ERROR)
- gdb_printf (_("Backtrace stopped: %s\n"),
+ gdb_printf (_ ("Backtrace stopped: %s\n"),
frame_stop_reason_string (trailing));
}
}
@@ -2101,11 +2042,9 @@ make_backtrace_options_def_group (frame_print_options *fp_opts,
backtrace_cmd_options *bt_cmd_opts,
set_backtrace_options *set_bt_opts)
{
- return {{
- { {frame_print_option_defs}, fp_opts },
- { {set_backtrace_option_defs}, set_bt_opts },
- { {backtrace_command_option_defs}, bt_cmd_opts }
- }};
+ return { { { { frame_print_option_defs }, fp_opts },
+ { { set_backtrace_option_defs }, set_bt_opts },
+ { { backtrace_command_option_defs }, bt_cmd_opts } } };
}
/* Parse the backtrace command's qualifiers. Returns ARG advanced
@@ -2156,8 +2095,8 @@ backtrace_command (const char *arg, int from_tty)
auto grp
= make_backtrace_options_def_group (&fp_opts, &bt_cmd_opts, &set_bt_opts);
- gdb::option::process_options
- (&arg, gdb::option::PROCESS_OPTIONS_UNKNOWN_IS_OPERAND, grp);
+ gdb::option::process_options (
+ &arg, gdb::option::PROCESS_OPTIONS_UNKNOWN_IS_OPERAND, grp);
/* Parse non-'-'-prefixed qualifiers, for backwards
compatibility. */
@@ -2180,13 +2119,14 @@ backtrace_command (const char *arg, int from_tty)
static void
backtrace_command_completer (struct cmd_list_element *ignore,
- completion_tracker &tracker,
- const char *text, const char */*word*/)
+ completion_tracker &tracker, const char *text,
+ const char * /*word*/)
{
const auto group
= make_backtrace_options_def_group (nullptr, nullptr, nullptr);
- if (gdb::option::complete_options
- (tracker, &text, gdb::option::PROCESS_OPTIONS_UNKNOWN_IS_OPERAND, group))
+ if (gdb::option::complete_options (
+ tracker, &text, gdb::option::PROCESS_OPTIONS_UNKNOWN_IS_OPERAND,
+ group))
return;
if (*text != '\0')
@@ -2195,10 +2135,13 @@ backtrace_command_completer (struct cmd_list_element *ignore,
if (*p == '\0')
{
static const char *const backtrace_cmd_qualifier_choices[] = {
- "full", "no-filters", "hide", nullptr,
+ "full",
+ "no-filters",
+ "hide",
+ nullptr,
};
- complete_on_enum (tracker, backtrace_cmd_qualifier_choices,
- text, text);
+ complete_on_enum (tracker, backtrace_cmd_qualifier_choices, text,
+ text);
if (tracker.have_completions ())
return;
@@ -2290,11 +2233,9 @@ print_variable_and_value_data::operator() (const char *print_name,
{
frame_info_ptr frame;
- if (preg.has_value ()
- && preg->exec (sym->natural_name (), 0, NULL, 0) != 0)
+ if (preg.has_value () && preg->exec (sym->natural_name (), 0, NULL, 0) != 0)
return;
- if (treg.has_value ()
- && !treg_matches_sym_type_name (*treg, sym))
+ if (treg.has_value () && !treg_matches_sym_type_name (*treg, sym))
return;
if (language_def (sym->language ())->symbol_printing_suppressed (sym))
return;
@@ -2302,7 +2243,7 @@ print_variable_and_value_data::operator() (const char *print_name,
frame = frame_find_by_id (frame_id);
if (frame == NULL)
{
- warning (_("Unable to restore previously selected frame."));
+ warning (_ ("Unable to restore previously selected frame."));
return;
}
@@ -2322,9 +2263,9 @@ prepare_reg (const char *regexp, gdb::optional<compiled_regex> *reg)
{
if (regexp != NULL)
{
- int cflags = REG_NOSUB | (case_sensitivity == case_sensitive_off
- ? REG_ICASE : 0);
- reg->emplace (regexp, cflags, _("Invalid regexp"));
+ int cflags
+ = REG_NOSUB | (case_sensitivity == case_sensitive_off ? REG_ICASE : 0);
+ reg->emplace (regexp, cflags, _ ("Invalid regexp"));
}
else
reg->reset ();
@@ -2342,10 +2283,9 @@ prepare_reg (const char *regexp, gdb::optional<compiled_regex> *reg)
This function will invalidate FRAME. */
static void
-print_frame_local_vars (frame_info_ptr frame,
- bool quiet,
- const char *regexp, const char *t_regexp,
- int num_tabs, struct ui_file *stream)
+print_frame_local_vars (frame_info_ptr frame, bool quiet, const char *regexp,
+ const char *t_regexp, int num_tabs,
+ struct ui_file *stream)
{
struct print_variable_and_value_data cb_data;
const struct block *block;
@@ -2354,8 +2294,7 @@ print_frame_local_vars (frame_info_ptr frame,
if (!get_frame_pc_if_available (frame, &pc))
{
if (!quiet)
- gdb_printf (stream,
- _("PC unavailable, cannot determine locals.\n"));
+ gdb_printf (stream, _ ("PC unavailable, cannot determine locals.\n"));
return;
}
@@ -2385,9 +2324,9 @@ print_frame_local_vars (frame_info_ptr frame,
if (!cb_data.values_printed && !quiet)
{
if (regexp == NULL && t_regexp == NULL)
- gdb_printf (stream, _("No locals.\n"));
+ gdb_printf (stream, _ ("No locals.\n"));
else
- gdb_printf (stream, _("No matching locals.\n"));
+ gdb_printf (stream, _ ("No matching locals.\n"));
}
}
@@ -2403,21 +2342,18 @@ struct info_print_options
/* The options used by the 'info locals' and 'info args' commands. */
-static const gdb::option::option_def info_print_options_defs[] = {
- gdb::option::boolean_option_def<info_print_options> {
- "q",
- [] (info_print_options *opt) { return &opt->quiet; },
- nullptr, /* show_cmd_cb */
- nullptr /* set_doc */
- },
+static const gdb::option::option_def info_print_options_defs[]
+ = { gdb::option::boolean_option_def<info_print_options> {
+ "q", [] (info_print_options *opt) { return &opt->quiet; },
+ nullptr, /* show_cmd_cb */
+ nullptr /* set_doc */
+ },
- gdb::option::string_option_def<info_print_options> {
- "t",
- [] (info_print_options *opt) { return &opt->type_regexp; },
- nullptr, /* show_cmd_cb */
- nullptr /* set_doc */
- }
-};
+ gdb::option::string_option_def<info_print_options> {
+ "t", [] (info_print_options *opt) { return &opt->type_regexp; },
+ nullptr, /* show_cmd_cb */
+ nullptr /* set_doc */
+ } };
/* Returns the option group used by 'info locals' and 'info args'
commands. */
@@ -2425,20 +2361,20 @@ static const gdb::option::option_def info_print_options_defs[] = {
static gdb::option::option_def_group
make_info_print_options_def_group (info_print_options *opts)
{
- return {{info_print_options_defs}, opts};
+ return { { info_print_options_defs }, opts };
}
/* Command completer for 'info locals' and 'info args'. */
static void
info_print_command_completer (struct cmd_list_element *ignore,
- completion_tracker &tracker,
- const char *text, const char * /* word */)
+ completion_tracker &tracker, const char *text,
+ const char * /* word */)
{
- const auto group
- = make_info_print_options_def_group (nullptr);
- if (gdb::option::complete_options
- (tracker, &text, gdb::option::PROCESS_OPTIONS_UNKNOWN_IS_OPERAND, group))
+ const auto group = make_info_print_options_def_group (nullptr);
+ if (gdb::option::complete_options (
+ tracker, &text, gdb::option::PROCESS_OPTIONS_UNKNOWN_IS_OPERAND,
+ group))
return;
const char *word = advance_to_expression_complete_word_point (tracker, text);
@@ -2452,16 +2388,17 @@ info_locals_command (const char *args, int from_tty)
{
info_print_options opts;
auto grp = make_info_print_options_def_group (&opts);
- gdb::option::process_options
- (&args, gdb::option::PROCESS_OPTIONS_UNKNOWN_IS_OPERAND, grp);
+ gdb::option::process_options (
+ &args, gdb::option::PROCESS_OPTIONS_UNKNOWN_IS_OPERAND, grp);
if (args != nullptr && *args == '\0')
args = nullptr;
- print_frame_local_vars
- (get_selected_frame (_("No frame selected.")),
- opts.quiet, args,
- opts.type_regexp.empty () ? nullptr : opts.type_regexp.c_str (),
- 0, gdb_stdout);
+ print_frame_local_vars (get_selected_frame (_ ("No frame selected.")),
+ opts.quiet, args,
+ opts.type_regexp.empty ()
+ ? nullptr
+ : opts.type_regexp.c_str (),
+ 0, gdb_stdout);
}
/* Iterate over all the argument variables in block B. */
@@ -2489,8 +2426,8 @@ iterate_over_block_arg_vars (const struct block *b,
float). There are also LOC_ARG/LOC_REGISTER pairs which
are not combined in symbol-reading. */
- sym2 = lookup_symbol_search_name (sym->search_name (),
- b, VAR_DOMAIN).symbol;
+ sym2 = lookup_symbol_search_name (sym->search_name (), b, VAR_DOMAIN)
+ .symbol;
cb (sym->print_name (), sym2);
}
}
@@ -2508,10 +2445,8 @@ iterate_over_block_arg_vars (const struct block *b,
This function will invalidate FRAME. */
static void
-print_frame_arg_vars (frame_info_ptr frame,
- bool quiet,
- const char *regexp, const char *t_regexp,
- struct ui_file *stream)
+print_frame_arg_vars (frame_info_ptr frame, bool quiet, const char *regexp,
+ const char *t_regexp, struct ui_file *stream)
{
struct print_variable_and_value_data cb_data;
struct symbol *func;
@@ -2522,8 +2457,7 @@ print_frame_arg_vars (frame_info_ptr frame,
if (!get_frame_pc_if_available (frame, &pc))
{
if (!quiet)
- gdb_printf (stream,
- _("PC unavailable, cannot determine args.\n"));
+ gdb_printf (stream, _ ("PC unavailable, cannot determine args.\n"));
return;
}
@@ -2531,7 +2465,7 @@ print_frame_arg_vars (frame_info_ptr frame,
if (func == NULL)
{
if (!quiet)
- gdb_printf (stream, _("No symbol table info available.\n"));
+ gdb_printf (stream, _ ("No symbol table info available.\n"));
return;
}
@@ -2550,9 +2484,9 @@ print_frame_arg_vars (frame_info_ptr frame,
if (!cb_data.values_printed && !quiet)
{
if (regexp == NULL && t_regexp == NULL)
- gdb_printf (stream, _("No arguments.\n"));
+ gdb_printf (stream, _ ("No arguments.\n"));
else
- gdb_printf (stream, _("No matching arguments.\n"));
+ gdb_printf (stream, _ ("No matching arguments.\n"));
}
}
@@ -2563,18 +2497,18 @@ info_args_command (const char *args, int from_tty)
{
info_print_options opts;
auto grp = make_info_print_options_def_group (&opts);
- gdb::option::process_options
- (&args, gdb::option::PROCESS_OPTIONS_UNKNOWN_IS_OPERAND, grp);
+ gdb::option::process_options (
+ &args, gdb::option::PROCESS_OPTIONS_UNKNOWN_IS_OPERAND, grp);
if (args != nullptr && *args == '\0')
args = nullptr;
- print_frame_arg_vars
- (get_selected_frame (_("No frame selected.")),
- opts.quiet, args,
- opts.type_regexp.empty () ? nullptr : opts.type_regexp.c_str (),
- gdb_stdout);
+ print_frame_arg_vars (get_selected_frame (_ ("No frame selected.")),
+ opts.quiet, args,
+ opts.type_regexp.empty () ? nullptr
+ : opts.type_regexp.c_str (),
+ gdb_stdout);
}
-
+
/* Return the symbol-block in which the selected frame is executing.
Can return zero under various legitimate circumstances.
@@ -2643,7 +2577,7 @@ up_silently_base (const char *count_exp)
frame = find_relative_frame (get_selected_frame ("No stack."), &count);
if (count != 0 && count_exp == NULL)
- error (_("Initial frame selected; you cannot go up."));
+ error (_ ("Initial frame selected; you cannot go up."));
select_frame (frame);
}
@@ -2680,7 +2614,7 @@ down_silently_base (const char *count_exp)
impossible), but "down 9999" can be used to mean go all the
way down without getting an error. */
- error (_("Bottom (innermost) frame selected; you cannot go down."));
+ error (_ ("Bottom (innermost) frame selected; you cannot go down."));
}
select_frame (frame);
@@ -2716,7 +2650,7 @@ return_command (const char *retval_exp, int from_tty)
gdbarch = get_frame_arch (thisframe);
if (get_frame_type (get_current_frame ()) == INLINE_FRAME)
- error (_("Can not force return from an inlined function."));
+ error (_ ("Can not force return from an inlined function."));
/* Compute the return value. If the computation triggers an error,
let it bail. If the return type can't be handled, set
@@ -2739,9 +2673,9 @@ return_command (const char *retval_exp, int from_tty)
{
if (retval_expr->first_opcode () != UNOP_CAST
&& retval_expr->first_opcode () != UNOP_CAST_TYPE)
- error (_("Return value type not available for selected "
- "stack frame.\n"
- "Please use an explicit cast of the value to return."));
+ error (_ ("Return value type not available for selected "
+ "stack frame.\n"
+ "Please use an explicit cast of the value to return."));
return_type = value_type (return_value);
}
return_type = check_typedef (return_type);
@@ -2767,13 +2701,13 @@ return_command (const char *retval_exp, int from_tty)
{
if (is_nocall_function (check_typedef (value_type (function))))
{
- query_prefix =
- string_printf ("Function '%s' does not follow the target "
- "calling convention.\n"
- "If you continue, setting the return value "
- "will probably lead to unpredictable "
- "behaviors.\n",
- thisfun->print_name ());
+ query_prefix
+ = string_printf ("Function '%s' does not follow the target "
+ "calling convention.\n"
+ "If you continue, setting the return value "
+ "will probably lead to unpredictable "
+ "behaviors.\n",
+ thisfun->print_name ());
}
rv_conv = struct_return_convention (gdbarch, function, return_type);
@@ -2781,9 +2715,9 @@ return_command (const char *retval_exp, int from_tty)
|| rv_conv == RETURN_VALUE_ABI_RETURNS_ADDRESS)
{
query_prefix = "The location at which to store the "
- "function's return value is unknown.\n"
- "If you continue, the return value "
- "that you specified will be ignored.\n";
+ "function's return value is unknown.\n"
+ "If you continue, the return value "
+ "that you specified will be ignored.\n";
return_value = NULL;
}
}
@@ -2797,18 +2731,17 @@ return_command (const char *retval_exp, int from_tty)
int confirmed;
if (thisfun == NULL)
- confirmed = query (_("%sMake selected stack frame return now? "),
+ confirmed = query (_ ("%sMake selected stack frame return now? "),
query_prefix.c_str ());
else
{
if (TYPE_NO_RETURN (thisfun->type ()))
- warning (_("Function does not return normally to caller."));
- confirmed = query (_("%sMake %s return now? "),
- query_prefix.c_str (),
- thisfun->print_name ());
+ warning (_ ("Function does not return normally to caller."));
+ confirmed = query (_ ("%sMake %s return now? "),
+ query_prefix.c_str (), thisfun->print_name ());
}
if (!confirmed)
- error (_("Not confirmed"));
+ error (_ ("Not confirmed"));
}
/* Discard the selected frame and all frames inner-to it. */
@@ -2822,10 +2755,9 @@ return_command (const char *retval_exp, int from_tty)
gdb_assert (rv_conv != RETURN_VALUE_STRUCT_CONVENTION
&& rv_conv != RETURN_VALUE_ABI_RETURNS_ADDRESS);
- gdbarch_return_value_as_value
- (cache_arch, function, return_type,
- get_current_regcache (), NULL /*read*/,
- value_contents (return_value).data () /*write*/);
+ gdbarch_return_value_as_value (
+ cache_arch, function, return_type, get_current_regcache (),
+ NULL /*read*/, value_contents (return_value).data () /*write*/);
}
/* If we are at the end of a call dummy now, pop the dummy frame
@@ -2851,6 +2783,7 @@ find_frame_for_function (const char *function_name)
{
CORE_ADDR low, high;
};
+
frame_info_ptr frame;
bool found = false;
int level = 1;
@@ -2869,7 +2802,8 @@ find_frame_for_function (const char *function_name)
else if (sals[i].pc == 0
|| find_pc_partial_function (sals[i].pc, NULL,
&func_bounds[i].low,
- &func_bounds[i].high) == 0)
+ &func_bounds[i].high)
+ == 0)
func_bounds[i].low = func_bounds[i].high = 0;
}
@@ -2895,23 +2829,25 @@ find_frame_for_function (const char *function_name)
/* The qcs command line flags for the "frame apply" commands. Keep
this in sync with the "thread apply" commands. */
-using qcs_flag_option_def
- = gdb::option::flag_option_def<qcs_flags>;
+using qcs_flag_option_def = gdb::option::flag_option_def<qcs_flags>;
static const gdb::option::option_def fr_qcs_flags_option_defs[] = {
qcs_flag_option_def {
- "q", [] (qcs_flags *opt) { return &opt->quiet; },
- N_("Disables printing the frame location information."),
+ "q",
+ [] (qcs_flags *opt) { return &opt->quiet; },
+ N_ ("Disables printing the frame location information."),
},
qcs_flag_option_def {
- "c", [] (qcs_flags *opt) { return &opt->cont; },
- N_("Print any error raised by COMMAND and continue."),
+ "c",
+ [] (qcs_flags *opt) { return &opt->cont; },
+ N_ ("Print any error raised by COMMAND and continue."),
},
qcs_flag_option_def {
- "s", [] (qcs_flags *opt) { return &opt->silent; },
- N_("Silently ignore any errors or empty output produced by COMMAND."),
+ "s",
+ [] (qcs_flags *opt) { return &opt->silent; },
+ N_ ("Silently ignore any errors or empty output produced by COMMAND."),
},
};
@@ -2922,10 +2858,10 @@ static inline std::array<gdb::option::option_def_group, 2>
make_frame_apply_options_def_group (qcs_flags *flags,
set_backtrace_options *set_bt_opts)
{
- return {{
- { {fr_qcs_flags_option_defs}, flags },
- { {set_backtrace_option_defs}, set_bt_opts },
- }};
+ return { {
+ { { fr_qcs_flags_option_defs }, flags },
+ { { set_backtrace_option_defs }, set_bt_opts },
+ } };
}
/* Apply a GDB command to all stack frames, or a set of identified frames,
@@ -2952,21 +2888,20 @@ make_frame_apply_options_def_group (qcs_flags *flags,
for error messages. */
static void
-frame_apply_command_count (const char *which_command,
- const char *cmd, int from_tty,
- frame_info_ptr trailing, int count)
+frame_apply_command_count (const char *which_command, const char *cmd,
+ int from_tty, frame_info_ptr trailing, int count)
{
qcs_flags flags;
set_backtrace_options set_bt_opts = user_set_backtrace_options;
auto group = make_frame_apply_options_def_group (&flags, &set_bt_opts);
- gdb::option::process_options
- (&cmd, gdb::option::PROCESS_OPTIONS_UNKNOWN_IS_OPERAND, group);
+ gdb::option::process_options (
+ &cmd, gdb::option::PROCESS_OPTIONS_UNKNOWN_IS_OPERAND, group);
validate_flags_qcs (which_command, &flags);
if (cmd == NULL || *cmd == '\0')
- error (_("Please specify a command to apply on the selected frames"));
+ error (_ ("Please specify a command to apply on the selected frames"));
/* The below will restore the current inferior/thread/frame.
Usually, only the frame is effectively to be restored.
@@ -2993,11 +2928,11 @@ frame_apply_command_count (const char *which_command,
set to the selected frame. */
scoped_restore_current_thread restore_fi_current_frame;
- execute_command_to_string
- (cmd_result, cmd, from_tty, gdb_stdout->term_out ());
+ execute_command_to_string (cmd_result, cmd, from_tty,
+ gdb_stdout->term_out ());
}
- fi = get_selected_frame (_("frame apply "
- "unable to get selected frame."));
+ fi = get_selected_frame (_ ("frame apply "
+ "unable to get selected frame."));
if (!flags.silent || cmd_result.length () > 0)
{
if (!flags.quiet)
@@ -3007,8 +2942,8 @@ frame_apply_command_count (const char *which_command,
}
catch (const gdb_exception_error &ex)
{
- fi = get_selected_frame (_("frame apply "
- "unable to get selected frame."));
+ fi = get_selected_frame (_ ("frame apply "
+ "unable to get selected frame."));
if (!flags.silent)
{
if (!flags.quiet)
@@ -3028,8 +2963,9 @@ static void
frame_apply_completer (completion_tracker &tracker, const char *text)
{
const auto group = make_frame_apply_options_def_group (nullptr, nullptr);
- if (gdb::option::complete_options
- (tracker, &text, gdb::option::PROCESS_OPTIONS_UNKNOWN_IS_OPERAND, group))
+ if (gdb::option::complete_options (
+ tracker, &text, gdb::option::PROCESS_OPTIONS_UNKNOWN_IS_OPERAND,
+ group))
return;
complete_nested_command_line (tracker, text);
@@ -3039,8 +2975,8 @@ frame_apply_completer (completion_tracker &tracker, const char *text)
static void
frame_apply_level_cmd_completer (struct cmd_list_element *ignore,
- completion_tracker &tracker,
- const char *text, const char */*word*/)
+ completion_tracker &tracker, const char *text,
+ const char * /*word*/)
{
/* Do this explicitly because there's an early return below. */
tracker.set_use_custom_word_point (true);
@@ -3075,8 +3011,7 @@ frame_apply_level_cmd_completer (struct cmd_list_element *ignore,
}
/* Check if we're past a valid LEVEL already. */
- if (levels.finished ()
- && cmd > text && !isspace (cmd[-1]))
+ if (levels.finished () && cmd > text && !isspace (cmd[-1]))
return;
/* We're past LEVELs, advance word point. */
@@ -3090,8 +3025,8 @@ frame_apply_level_cmd_completer (struct cmd_list_element *ignore,
void
frame_apply_all_cmd_completer (struct cmd_list_element *ignore,
- completion_tracker &tracker,
- const char *text, const char */*word*/)
+ completion_tracker &tracker, const char *text,
+ const char * /*word*/)
{
frame_apply_completer (tracker, text);
}
@@ -3100,8 +3035,8 @@ frame_apply_all_cmd_completer (struct cmd_list_element *ignore,
static void
frame_apply_cmd_completer (struct cmd_list_element *ignore,
- completion_tracker &tracker,
- const char *text, const char */*word*/)
+ completion_tracker &tracker, const char *text,
+ const char * /*word*/)
{
const char *cmd = text;
@@ -3126,7 +3061,7 @@ static void
frame_apply_level_command (const char *cmd, int from_tty)
{
if (!target_has_stack ())
- error (_("No stack."));
+ error (_ ("No stack."));
bool level_found = false;
const char *levels_str = cmd;
@@ -3144,7 +3079,7 @@ frame_apply_level_command (const char *cmd, int from_tty)
}
if (!level_found)
- error (_("Missing or invalid LEVEL... argument"));
+ error (_ ("Missing or invalid LEVEL... argument"));
cmd = levels.cur_tok ();
@@ -3164,7 +3099,8 @@ frame_apply_level_command (const char *cmd, int from_tty)
n_frames = 1;
frame_apply_command_count ("frame apply level", cmd, from_tty,
- leading_innermost_frame (level_beg), n_frames);
+ leading_innermost_frame (level_beg),
+ n_frames);
}
}
@@ -3174,7 +3110,7 @@ static void
frame_apply_all_command (const char *cmd, int from_tty)
{
if (!target_has_stack ())
- error (_("No stack."));
+ error (_ ("No stack."));
frame_apply_command_count ("frame apply all", cmd, from_tty,
get_current_frame (), INT_MAX);
@@ -3183,19 +3119,19 @@ frame_apply_all_command (const char *cmd, int from_tty)
/* Implementation of the "frame apply" command. */
static void
-frame_apply_command (const char* cmd, int from_tty)
+frame_apply_command (const char *cmd, int from_tty)
{
int count;
frame_info_ptr trailing;
if (!target_has_stack ())
- error (_("No stack."));
+ error (_ ("No stack."));
if (cmd == NULL)
- error (_("Missing COUNT argument."));
+ error (_ ("Missing COUNT argument."));
count = get_number_trailer (&cmd, 0);
if (count == 0)
- error (_("Invalid COUNT argument."));
+ error (_ ("Invalid COUNT argument."));
if (count < 0)
{
@@ -3205,8 +3141,7 @@ frame_apply_command (const char* cmd, int from_tty)
else
trailing = get_current_frame ();
- frame_apply_command_count ("frame apply", cmd, from_tty,
- trailing, count);
+ frame_apply_command_count ("frame apply", cmd, from_tty, trailing, count);
}
/* Implementation of the "faas" command. */
@@ -3215,12 +3150,11 @@ static void
faas_command (const char *cmd, int from_tty)
{
if (cmd == NULL || *cmd == '\0')
- error (_("Please specify a command to apply on all frames"));
+ error (_ ("Please specify a command to apply on all frames"));
std::string expanded = std::string ("frame apply all -s ") + cmd;
execute_command (expanded.c_str (), from_tty);
}
-
/* Find inner-mode frame with frame address ADDRESS. Return NULL if no
matching frame can be found. */
@@ -3236,9 +3170,7 @@ find_frame_for_address (CORE_ADDR address)
what (s)he gets. Still, give the highest one that matches.
(NOTE: cagney/2004-10-29: Why highest, or outer-most, I don't
know). */
- for (fid = get_current_frame ();
- fid != NULL;
- fid = get_prev_frame (fid))
+ for (fid = get_current_frame (); fid != NULL; fid = get_prev_frame (fid))
{
if (id == get_frame_id (fid))
{
@@ -3247,8 +3179,7 @@ find_frame_for_address (CORE_ADDR address)
while (1)
{
prev_frame = get_prev_frame (fid);
- if (!prev_frame
- || id != get_frame_id (prev_frame))
+ if (!prev_frame || id != get_frame_id (prev_frame))
break;
fid = prev_frame;
}
@@ -3258,8 +3189,6 @@ find_frame_for_address (CORE_ADDR address)
return NULL;
}
-
-
/* Commands with a prefix of `frame apply'. */
static struct cmd_list_element *frame_apply_cmd_list = NULL;
@@ -3273,44 +3202,45 @@ static struct cmd_list_element *select_frame_cmd_list = NULL;
static struct cmd_list_element *info_frame_cmd_list = NULL;
void _initialize_stack ();
+
void
_initialize_stack ()
{
struct cmd_list_element *cmd;
- add_com ("return", class_stack, return_command, _("\
+ add_com ("return", class_stack, return_command, _ ("\
Make selected stack frame return to its caller.\n\
Control remains in the debugger, but when you continue\n\
execution will resume in the frame above the one now selected.\n\
If an argument is given, it is an expression for the value to return."));
- add_com ("up", class_stack, up_command, _("\
+ add_com ("up", class_stack, up_command, _ ("\
Select and print stack frame that called this one.\n\
An argument says how many frames up to go."));
- add_com ("up-silently", class_support, up_silently_command, _("\
+ add_com ("up-silently", class_support, up_silently_command, _ ("\
Same as the `up' command, but does not print anything.\n\
This is useful in command scripts."));
cmd_list_element *down_cmd
- = add_com ("down", class_stack, down_command, _("\
+ = add_com ("down", class_stack, down_command, _ ("\
Select and print stack frame called by this one.\n\
An argument says how many frames down to go."));
add_com_alias ("do", down_cmd, class_stack, 1);
add_com_alias ("dow", down_cmd, class_stack, 1);
- add_com ("down-silently", class_support, down_silently_command, _("\
+ add_com ("down-silently", class_support, down_silently_command, _ ("\
Same as the `down' command, but does not print anything.\n\
This is useful in command scripts."));
cmd_list_element *frame_cmd_el
- = add_prefix_cmd ("frame", class_stack,
- &frame_cmd.base_command, _("\
+ = add_prefix_cmd ("frame", class_stack, &frame_cmd.base_command, _ ("\
Select and print a stack frame.\n\
With no argument, print the selected stack frame. (See also \"info frame\").\n\
A single numerical argument specifies the frame to select."),
&frame_cmd_list, 1, &cmdlist);
add_com_alias ("f", frame_cmd_el, class_stack, 1);
-#define FRAME_APPLY_OPTION_HELP "\
+#define FRAME_APPLY_OPTION_HELP \
+ "\
Prints the frame location information followed by COMMAND output.\n\
\n\
By default, an error raised during the execution of COMMAND\n\
@@ -3322,131 +3252,117 @@ Options:\n\
const auto frame_apply_opts
= make_frame_apply_options_def_group (nullptr, nullptr);
- static std::string frame_apply_cmd_help = gdb::option::build_help (_("\
+ static std::string frame_apply_cmd_help
+ = gdb::option::build_help (_ ("\
Apply a command to a number of frames.\n\
Usage: frame apply COUNT [OPTION]... COMMAND\n\
-With a negative COUNT argument, applies the command on outermost -COUNT frames.\n"
- FRAME_APPLY_OPTION_HELP),
+With a negative COUNT argument, applies the command on outermost -COUNT frames.\n" FRAME_APPLY_OPTION_HELP),
frame_apply_opts);
cmd = add_prefix_cmd ("apply", class_stack, frame_apply_command,
- frame_apply_cmd_help.c_str (),
- &frame_apply_cmd_list, 1,
- &frame_cmd_list);
+ frame_apply_cmd_help.c_str (), &frame_apply_cmd_list,
+ 1, &frame_cmd_list);
set_cmd_completer_handle_brkchars (cmd, frame_apply_cmd_completer);
- static std::string frame_apply_all_cmd_help = gdb::option::build_help (_("\
+ static std::string frame_apply_all_cmd_help
+ = gdb::option::build_help (_ ("\
Apply a command to all frames.\n\
\n\
-Usage: frame apply all [OPTION]... COMMAND\n"
- FRAME_APPLY_OPTION_HELP),
+Usage: frame apply all [OPTION]... COMMAND\n" FRAME_APPLY_OPTION_HELP),
frame_apply_opts);
cmd = add_cmd ("all", class_stack, frame_apply_all_command,
- frame_apply_all_cmd_help.c_str (),
- &frame_apply_cmd_list);
+ frame_apply_all_cmd_help.c_str (), &frame_apply_cmd_list);
set_cmd_completer_handle_brkchars (cmd, frame_apply_all_cmd_completer);
- static std::string frame_apply_level_cmd_help = gdb::option::build_help (_("\
+ static std::string frame_apply_level_cmd_help
+ = gdb::option::build_help (_ ("\
Apply a command to a list of frames.\n\
\n\
Usage: frame apply level LEVEL... [OPTION]... COMMAND\n\
-LEVEL is a space-separated list of levels of frames to apply COMMAND on.\n"
- FRAME_APPLY_OPTION_HELP),
+LEVEL is a space-separated list of levels of frames to apply COMMAND on.\n" FRAME_APPLY_OPTION_HELP),
frame_apply_opts);
cmd = add_cmd ("level", class_stack, frame_apply_level_command,
- frame_apply_level_cmd_help.c_str (),
- &frame_apply_cmd_list);
+ frame_apply_level_cmd_help.c_str (), &frame_apply_cmd_list);
set_cmd_completer_handle_brkchars (cmd, frame_apply_level_cmd_completer);
- cmd = add_com ("faas", class_stack, faas_command, _("\
+ cmd = add_com ("faas", class_stack, faas_command, _ ("\
Apply a command to all frames (ignoring errors and empty output).\n\
Usage: faas [OPTION]... COMMAND\n\
shortcut for 'frame apply all -s [OPTION]... COMMAND'\n\
See \"help frame apply all\" for available options."));
set_cmd_completer_handle_brkchars (cmd, frame_apply_all_cmd_completer);
- add_cmd ("address", class_stack, &frame_cmd.address,
- _("\
+ add_cmd ("address", class_stack, &frame_cmd.address, _ ("\
Select and print a stack frame by stack address.\n\
\n\
Usage: frame address STACK-ADDRESS"),
&frame_cmd_list);
- add_cmd ("view", class_stack, &frame_cmd.view,
- _("\
+ add_cmd ("view", class_stack, &frame_cmd.view, _ ("\
View a stack frame that might be outside the current backtrace.\n\
\n\
Usage: frame view STACK-ADDRESS\n\
frame view STACK-ADDRESS PC-ADDRESS"),
&frame_cmd_list);
- cmd = add_cmd ("function", class_stack, &frame_cmd.function,
- _("\
+ cmd = add_cmd ("function", class_stack, &frame_cmd.function, _ ("\
Select and print a stack frame by function name.\n\
\n\
Usage: frame function NAME\n\
\n\
The innermost frame that visited function NAME is selected."),
- &frame_cmd_list);
+ &frame_cmd_list);
set_cmd_completer (cmd, frame_selection_by_function_completer);
-
- add_cmd ("level", class_stack, &frame_cmd.level,
- _("\
+ add_cmd ("level", class_stack, &frame_cmd.level, _ ("\
Select and print a stack frame by level.\n\
\n\
Usage: frame level LEVEL"),
&frame_cmd_list);
- cmd = add_prefix_cmd_suppress_notification ("select-frame", class_stack,
- &select_frame_cmd.base_command, _("\
+ cmd = add_prefix_cmd_suppress_notification (
+ "select-frame", class_stack, &select_frame_cmd.base_command, _ ("\
Select a stack frame without printing anything.\n\
A single numerical argument specifies the frame to select."),
- &select_frame_cmd_list, 1, &cmdlist,
- &cli_suppress_notification.user_selected_context);
+ &select_frame_cmd_list, 1, &cmdlist,
+ &cli_suppress_notification.user_selected_context);
- add_cmd_suppress_notification ("address", class_stack,
- &select_frame_cmd.address, _("\
+ add_cmd_suppress_notification (
+ "address", class_stack, &select_frame_cmd.address, _ ("\
Select a stack frame by stack address.\n\
\n\
Usage: select-frame address STACK-ADDRESS"),
- &select_frame_cmd_list,
- &cli_suppress_notification.user_selected_context);
+ &select_frame_cmd_list, &cli_suppress_notification.user_selected_context);
-
- add_cmd_suppress_notification ("view", class_stack,
- &select_frame_cmd.view, _("\
+ add_cmd_suppress_notification (
+ "view", class_stack, &select_frame_cmd.view, _ ("\
Select a stack frame that might be outside the current backtrace.\n\
\n\
Usage: select-frame view STACK-ADDRESS\n\
select-frame view STACK-ADDRESS PC-ADDRESS"),
- &select_frame_cmd_list,
- &cli_suppress_notification.user_selected_context);
+ &select_frame_cmd_list, &cli_suppress_notification.user_selected_context);
- cmd = add_cmd_suppress_notification ("function", class_stack,
- &select_frame_cmd.function, _("\
+ cmd = add_cmd_suppress_notification (
+ "function", class_stack, &select_frame_cmd.function, _ ("\
Select a stack frame by function name.\n\
\n\
Usage: select-frame function NAME"),
- &select_frame_cmd_list,
- &cli_suppress_notification.user_selected_context);
+ &select_frame_cmd_list, &cli_suppress_notification.user_selected_context);
set_cmd_completer (cmd, frame_selection_by_function_completer);
- add_cmd_suppress_notification ("level", class_stack,
- &select_frame_cmd.level, _("\
+ add_cmd_suppress_notification (
+ "level", class_stack, &select_frame_cmd.level, _ ("\
Select a stack frame by level.\n\
\n\
Usage: select-frame level LEVEL"),
- &select_frame_cmd_list,
- &cli_suppress_notification.user_selected_context);
+ &select_frame_cmd_list, &cli_suppress_notification.user_selected_context);
const auto backtrace_opts
= make_backtrace_options_def_group (nullptr, nullptr, nullptr);
- static std::string backtrace_help
- = gdb::option::build_help (_("\
+ static std::string backtrace_help = gdb::option::build_help (_ ("\
Print backtrace of all stack frames, or innermost COUNT frames.\n\
Usage: backtrace [OPTION]... [QUALIFIER]... [COUNT | -COUNT]\n\
\n\
@@ -3460,98 +3376,92 @@ For backward compatibility, the following qualifiers are supported:\n\
hide - same as -hide.\n\
\n\
With a negative COUNT, print outermost -COUNT frames."),
- backtrace_opts);
+ backtrace_opts);
cmd_list_element *backtrace_cmd
= add_com ("backtrace", class_stack, backtrace_command,
backtrace_help.c_str ());
- set_cmd_completer_handle_brkchars (backtrace_cmd, backtrace_command_completer);
+ set_cmd_completer_handle_brkchars (backtrace_cmd,
+ backtrace_command_completer);
add_com_alias ("bt", backtrace_cmd, class_stack, 0);
add_com_alias ("where", backtrace_cmd, class_stack, 0);
cmd_list_element *info_stack_cmd
= add_info ("stack", backtrace_command,
- _("Backtrace of the stack, or innermost COUNT frames."));
+ _ ("Backtrace of the stack, or innermost COUNT frames."));
add_info_alias ("s", info_stack_cmd, 1);
cmd_list_element *info_frame_cmd_el
= add_prefix_cmd ("frame", class_info, &info_frame_cmd.base_command,
- _("All about the selected stack frame.\n\
+ _ ("All about the selected stack frame.\n\
With no arguments, displays information about the currently selected stack\n\
frame. Alternatively a frame specification may be provided (See \"frame\")\n\
the information is then printed about the specified frame."),
&info_frame_cmd_list, 1, &infolist);
add_info_alias ("f", info_frame_cmd_el, 1);
- add_cmd ("address", class_stack, &info_frame_cmd.address,
- _("\
+ add_cmd ("address", class_stack, &info_frame_cmd.address, _ ("\
Print information about a stack frame selected by stack address.\n\
\n\
Usage: info frame address STACK-ADDRESS"),
&info_frame_cmd_list);
- add_cmd ("view", class_stack, &info_frame_cmd.view,
- _("\
+ add_cmd ("view", class_stack, &info_frame_cmd.view, _ ("\
Print information about a stack frame outside the current backtrace.\n\
\n\
Usage: info frame view STACK-ADDRESS\n\
info frame view STACK-ADDRESS PC-ADDRESS"),
&info_frame_cmd_list);
- cmd = add_cmd ("function", class_stack, &info_frame_cmd.function,
- _("\
+ cmd = add_cmd ("function", class_stack, &info_frame_cmd.function, _ ("\
Print information about a stack frame selected by function name.\n\
\n\
Usage: info frame function NAME"),
- &info_frame_cmd_list);
+ &info_frame_cmd_list);
set_cmd_completer (cmd, frame_selection_by_function_completer);
- add_cmd ("level", class_stack, &info_frame_cmd.level,
- _("\
+ add_cmd ("level", class_stack, &info_frame_cmd.level, _ ("\
Print information about a stack frame selected by level.\n\
\n\
Usage: info frame level LEVEL"),
&info_frame_cmd_list);
cmd = add_info ("locals", info_locals_command,
- info_print_args_help (_("\
+ info_print_args_help (_ ("\
All local variables of current stack frame or those matching REGEXPs.\n\
Usage: info locals [-q] [-t TYPEREGEXP] [NAMEREGEXP]\n\
Prints the local variables of the current stack frame.\n"),
- _("local variables"),
- false));
+ _ ("local variables"), false));
set_cmd_completer_handle_brkchars (cmd, info_print_command_completer);
cmd = add_info ("args", info_args_command,
- info_print_args_help (_("\
+ info_print_args_help (_ ("\
All argument variables of current stack frame or those matching REGEXPs.\n\
Usage: info args [-q] [-t TYPEREGEXP] [NAMEREGEXP]\n\
Prints the argument variables of the current stack frame.\n"),
- _("argument variables"),
- false));
+ _ ("argument variables"), false));
set_cmd_completer_handle_brkchars (cmd, info_print_command_completer);
/* Install "set print raw frame-arguments", a deprecated spelling of
"set print raw-frame-arguments". */
- set_show_commands set_show_frame_args
- = add_setshow_boolean_cmd
- ("frame-arguments", no_class,
- &user_frame_print_options.print_raw_frame_arguments,
- _("\
-Set whether to print frame arguments in raw form."), _("\
-Show whether to print frame arguments in raw form."), _("\
+ set_show_commands set_show_frame_args = add_setshow_boolean_cmd (
+ "frame-arguments", no_class,
+ &user_frame_print_options.print_raw_frame_arguments, _ ("\
+Set whether to print frame arguments in raw form."),
+ _ ("\
+Show whether to print frame arguments in raw form."),
+ _ ("\
If set, frame arguments are printed in raw form, bypassing any\n\
pretty-printers for that value."),
- NULL, NULL,
- &setprintrawlist, &showprintrawlist);
+ NULL, NULL, &setprintrawlist, &showprintrawlist);
deprecate_cmd (set_show_frame_args.set, "set print raw-frame-arguments");
add_setshow_auto_boolean_cmd ("disassemble-next-line", class_stack,
- &disassemble_next_line, _("\
+ &disassemble_next_line, _ ("\
Set whether to disassemble next source line or insn when execution stops."),
- _("\
+ _ ("\
Show whether to disassemble next source line or insn when execution stops."),
- _("\
+ _ ("\
If ON, GDB will display disassembly of the next source line, in addition\n\
to displaying the source line itself. If the next source line cannot\n\
be displayed (e.g., source is unavailable or there's no line info), GDB\n\
@@ -3561,12 +3471,12 @@ If AUTO, display disassembly of next instruction only if the source line\n\
cannot be displayed.\n\
If OFF (which is the default), never display the disassembly of the next\n\
source line."),
- NULL,
- show_disassemble_next_line,
- &setlist, &showlist);
+ NULL, show_disassemble_next_line, &setlist,
+ &showlist);
disassemble_next_line = AUTO_BOOLEAN_FALSE;
- gdb::option::add_setshow_cmds_for_options
- (class_stack, &user_frame_print_options,
- frame_print_option_defs, &setprintlist, &showprintlist);
+ gdb::option::add_setshow_cmds_for_options (class_stack,
+ &user_frame_print_options,
+ frame_print_option_defs,
+ &setprintlist, &showprintlist);
}
diff --git a/gdb/stack.h b/gdb/stack.h
index 1b0c2b342a4..2d34e7e24b9 100644
--- a/gdb/stack.h
+++ b/gdb/stack.h
@@ -25,7 +25,7 @@ gdb::unique_xmalloc_ptr<char> find_frame_funname (frame_info_ptr frame,
struct symbol **funcp);
typedef gdb::function_view<void (const char *print_name, struct symbol *sym)>
- iterate_over_block_arg_local_vars_cb;
+ iterate_over_block_arg_local_vars_cb;
void iterate_over_block_arg_vars (const struct block *block,
iterate_over_block_arg_local_vars_cb cb);
@@ -57,7 +57,7 @@ bool last_displayed_sal_is_valid (void);
/* Get the pspace of the last sal we displayed, if it's valid, otherwise
return nullptr. */
-struct program_space* get_last_displayed_pspace (void);
+struct program_space *get_last_displayed_pspace (void);
/* Get the address of the last sal we displayed, if it's valid, otherwise
return an address of 0. */
@@ -67,7 +67,7 @@ CORE_ADDR get_last_displayed_addr (void);
/* Get the symtab of the last sal we displayed, if it's valid, otherwise
return nullptr. */
-struct symtab* get_last_displayed_symtab (void);
+struct symtab *get_last_displayed_symtab (void);
/* Get the line of the last sal we displayed, if it's valid, otherwise
return 0. */
@@ -82,6 +82,6 @@ symtab_and_line get_last_displayed_sal ();
/* Completer for the "frame apply all" command. */
void frame_apply_all_cmd_completer (struct cmd_list_element *ignore,
completion_tracker &tracker,
- const char *text, const char */*word*/);
+ const char *text, const char * /*word*/);
#endif /* #ifndef STACK_H */
diff --git a/gdb/stap-probe.c b/gdb/stap-probe.c
index c7ad35db06f..4327e56e47c 100644
--- a/gdb/stap-probe.c
+++ b/gdb/stap-probe.c
@@ -86,8 +86,11 @@ struct stap_probe_arg
/* Constructor for stap_probe_arg. */
stap_probe_arg (enum stap_arg_bitness bitness_, struct type *atype_,
expression_up &&aexpr_)
- : bitness (bitness_), atype (atype_), aexpr (std::move (aexpr_))
- {}
+ : bitness (bitness_),
+ atype (atype_),
+ aexpr (std::move (aexpr_))
+ {
+ }
/* The bitness of this argument. */
enum stap_arg_bitness bitness;
@@ -104,11 +107,10 @@ struct stap_probe_arg
class stap_static_probe_ops : public static_probe_ops
{
public:
+
/* We need a user-provided constructor to placate some compilers.
See PR build/24937. */
- stap_static_probe_ops ()
- {
- }
+ stap_static_probe_ops () {}
/* See probe.h. */
bool is_linespec (const char **linespecp) const override;
@@ -121,8 +123,8 @@ public:
const char *type_name () const override;
/* See probe.h. */
- std::vector<struct info_probe_column> gen_info_probes_table_header
- () const override;
+ std::vector<struct info_probe_column>
+ gen_info_probes_table_header () const override;
};
/* SystemTap static_probe_ops. */
@@ -132,13 +134,16 @@ const stap_static_probe_ops stap_static_probe_ops {};
class stap_probe : public probe
{
public:
+
/* Constructor for stap_probe. */
stap_probe (std::string &&name_, std::string &&provider_, CORE_ADDR address_,
struct gdbarch *arch_, CORE_ADDR sem_addr, const char *args_text)
: probe (std::move (name_), std::move (provider_), address_, arch_),
m_sem_addr (sem_addr),
- m_have_parsed_args (false), m_unparsed_args_text (args_text)
- {}
+ m_have_parsed_args (false),
+ m_unparsed_args_text (args_text)
+ {
+ }
/* See probe.h. */
CORE_ADDR get_relocated_address (struct objfile *objfile) override;
@@ -150,12 +155,10 @@ public:
bool can_evaluate_arguments () const override;
/* See probe.h. */
- struct value *evaluate_argument (unsigned n,
- frame_info_ptr frame) override;
+ struct value *evaluate_argument (unsigned n, frame_info_ptr frame) override;
/* See probe.h. */
- void compile_to_ax (struct agent_expr *aexpr,
- struct axs_value *axs_value,
+ void compile_to_ax (struct agent_expr *aexpr, struct axs_value *axs_value,
unsigned n) override;
/* See probe.h. */
@@ -185,17 +188,18 @@ public:
gdb_assert (m_have_parsed_args);
if (m_parsed_args.empty ())
- internal_error (_("Probe '%s' apparently does not have arguments, but \n"
- "GDB is requesting its argument number %u anyway. "
- "This should not happen. Please report this bug."),
- this->get_name ().c_str (), n);
+ internal_error (
+ _ ("Probe '%s' apparently does not have arguments, but \n"
+ "GDB is requesting its argument number %u anyway. "
+ "This should not happen. Please report this bug."),
+ this->get_name ().c_str (), n);
if (n > m_parsed_args.size ())
- internal_error (_("Probe '%s' has %d arguments, but GDB is requesting\n"
- "argument %u. This should not happen. Please\n"
- "report this bug."),
- this->get_name ().c_str (),
- (int) m_parsed_args.size (), n);
+ internal_error (_ ("Probe '%s' has %d arguments, but GDB is requesting\n"
+ "argument %u. This should not happen. Please\n"
+ "report this bug."),
+ this->get_name ().c_str (), (int) m_parsed_args.size (),
+ n);
return &m_parsed_args[n];
}
@@ -214,6 +218,7 @@ public:
void parse_arguments (struct gdbarch *gdbarch);
private:
+
/* If the probe has a semaphore associated, then this is the value of
it, relative to SECT_OFF_DATA. */
CORE_ADDR m_sem_addr;
@@ -263,13 +268,12 @@ enum stap_operand_prec
STAP_OPERAND_PREC_MUL
};
-static expr::operation_up stap_parse_argument_1 (struct stap_parse_info *p,
- expr::operation_up &&lhs,
- enum stap_operand_prec prec)
- ATTRIBUTE_UNUSED_RESULT;
+static expr::operation_up
+stap_parse_argument_1 (struct stap_parse_info *p, expr::operation_up &&lhs,
+ enum stap_operand_prec prec) ATTRIBUTE_UNUSED_RESULT;
-static expr::operation_up stap_parse_argument_conditionally
- (struct stap_parse_info *p) ATTRIBUTE_UNUSED_RESULT;
+static expr::operation_up stap_parse_argument_conditionally (
+ struct stap_parse_info *p) ATTRIBUTE_UNUSED_RESULT;
/* Returns true if *S is an operator, false otherwise. */
@@ -279,7 +283,7 @@ static void
show_stapexpressiondebug (struct ui_file *file, int from_tty,
struct cmd_list_element *c, const char *value)
{
- gdb_printf (file, _("SystemTap Probe expression debugging is %s.\n"),
+ gdb_printf (file, _ ("SystemTap Probe expression debugging is %s.\n"),
value);
}
@@ -349,7 +353,7 @@ stap_get_opcode (const char **s)
case '%':
op = BINOP_REM;
- break;
+ break;
case '<':
op = BINOP_LESS;
@@ -368,7 +372,7 @@ stap_get_opcode (const char **s)
*s += 1;
op = BINOP_NOTEQUAL;
}
- break;
+ break;
case '>':
op = BINOP_GTR;
@@ -382,7 +386,7 @@ stap_get_opcode (const char **s)
*s += 1;
op = BINOP_GEQ;
}
- break;
+ break;
case '|':
op = BINOP_BITWISE_IOR;
@@ -391,7 +395,7 @@ stap_get_opcode (const char **s)
*s += 1;
op = BINOP_LOGICAL_OR;
}
- break;
+ break;
case '&':
op = BINOP_BITWISE_AND;
@@ -400,7 +404,7 @@ stap_get_opcode (const char **s)
*s += 1;
op = BINOP_LOGICAL_AND;
}
- break;
+ break;
case '^':
op = BINOP_BITWISE_XOR;
@@ -424,8 +428,9 @@ stap_get_opcode (const char **s)
break;
default:
- error (_("Invalid opcode in expression `%s' for SystemTap"
- "probe"), *s);
+ error (_ ("Invalid opcode in expression `%s' for SystemTap"
+ "probe"),
+ *s);
}
return op;
@@ -436,7 +441,8 @@ typedef expr::operation_up binop_maker_ftype (expr::operation_up &&,
/* Map from an expression opcode to a function that can create a
binary operation of that type. */
static std::unordered_map<exp_opcode, binop_maker_ftype *,
- gdb::hash_enum<exp_opcode>> stap_maker_map;
+ gdb::hash_enum<exp_opcode>>
+ stap_maker_map;
/* Helper function to create a binary operation. */
static expr::operation_up
@@ -490,7 +496,7 @@ stap_get_expected_argument_type (struct gdbarch *gdbarch,
return builtin_type (gdbarch)->builtin_uint64;
default:
- error (_("Undefined bitness for probe '%s'."), probe_name);
+ error (_ ("Undefined bitness for probe '%s'."), probe_name);
break;
}
}
@@ -505,8 +511,8 @@ stap_get_expected_argument_type (struct gdbarch *gdbarch,
Return true if any prefix has been found, false otherwise. */
static bool
-stap_is_generic_prefix (struct gdbarch *gdbarch, const char *s,
- const char **r, const char *const *prefixes)
+stap_is_generic_prefix (struct gdbarch *gdbarch, const char *s, const char **r,
+ const char *const *prefixes)
{
const char *const *p;
@@ -564,8 +570,7 @@ stap_is_register_indirection_prefix (struct gdbarch *gdbarch, const char *s,
case-insensitive match. */
static bool
-stap_is_integer_prefix (struct gdbarch *gdbarch, const char *s,
- const char **r)
+stap_is_integer_prefix (struct gdbarch *gdbarch, const char *s, const char **r)
{
const char *const *t = gdbarch_stap_integer_prefixes (gdbarch);
const char *const *p;
@@ -757,7 +762,7 @@ stap_parse_register_operand (struct stap_parse_info *p)
}
if (disp_op != nullptr && !indirect_p)
- error (_("Invalid register displacement syntax on expression `%s'."),
+ error (_ ("Invalid register displacement syntax on expression `%s'."),
p->saved_arg);
/* Getting rid of register prefix. */
@@ -785,12 +790,12 @@ stap_parse_register_operand (struct stap_parse_info *p)
regname += gdb_reg_suffix;
}
- int regnum = user_reg_map_name_to_regnum (gdbarch, regname.c_str (),
- regname.size ());
+ int regnum
+ = user_reg_map_name_to_regnum (gdbarch, regname.c_str (), regname.size ());
/* Is this a valid register name? */
if (regnum == -1)
- error (_("Invalid register name `%s' on expression `%s'."),
+ error (_ ("Invalid register name `%s' on expression `%s'."),
regname.c_str (), p->saved_arg);
/* Check if there's any special treatment that the arch-specific
@@ -809,8 +814,8 @@ stap_parse_register_operand (struct stap_parse_info *p)
newregname.size ());
if (regnum == -1)
- internal_error (_("Invalid register name '%s' after replacing it"
- " (previous name was '%s')"),
+ internal_error (_ ("Invalid register name '%s' after replacing it"
+ " (previous name was '%s')"),
newregname.c_str (), regname.c_str ());
regname = std::move (newregname);
@@ -842,8 +847,8 @@ stap_parse_register_operand (struct stap_parse_info *p)
/* Casting to the expected type. */
struct type *arg_ptr_type = lookup_pointer_type (p->arg_type);
- reg = make_operation<unop_cast_operation> (std::move (reg),
- arg_ptr_type);
+ reg
+ = make_operation<unop_cast_operation> (std::move (reg), arg_ptr_type);
reg = make_operation<unop_ind_operation> (std::move (reg));
}
@@ -851,7 +856,7 @@ stap_parse_register_operand (struct stap_parse_info *p)
if (stap_check_register_suffix (gdbarch, p->arg, &reg_suffix))
p->arg += strlen (reg_suffix);
else
- error (_("Missing register name suffix on expression `%s'."),
+ error (_ ("Missing register name suffix on expression `%s'."),
p->saved_arg);
/* Getting rid of the register indirection suffix. */
@@ -861,7 +866,7 @@ stap_parse_register_operand (struct stap_parse_info *p)
&reg_ind_suffix))
p->arg += strlen (reg_ind_suffix);
else
- error (_("Missing indirection suffix on expression `%s'."),
+ error (_ ("Missing indirection suffix on expression `%s'."),
p->saved_arg);
}
@@ -934,14 +939,15 @@ stap_parse_single_operand (struct stap_parse_info *p)
has_digit = true;
}
- if (has_digit && stap_is_register_indirection_prefix (gdbarch, tmp,
- NULL))
+ if (has_digit
+ && stap_is_register_indirection_prefix (gdbarch, tmp, NULL))
{
/* If we are here, it means it is a displacement. The only
operations allowed here are `-' and `+'. */
if (c != '-' && c != '+')
- error (_("Invalid operator `%c' for register displacement "
- "on expression `%s'."), c, p->saved_arg);
+ error (_ ("Invalid operator `%c' for register displacement "
+ "on expression `%s'."),
+ c, p->saved_arg);
result = stap_parse_register_operand (p);
}
@@ -954,11 +960,11 @@ stap_parse_single_operand (struct stap_parse_info *p)
if (c == '-')
result = make_operation<unary_neg_operation> (std::move (result));
else if (c == '~')
- result = (make_operation<unary_complement_operation>
- (std::move (result)));
+ result = (make_operation<unary_complement_operation> (
+ std::move (result)));
else if (c == '!')
- result = (make_operation<unary_logical_not_operation>
- (std::move (result)));
+ result = (make_operation<unary_logical_not_operation> (
+ std::move (result)));
}
}
else if (isdigit (*p->arg))
@@ -993,14 +999,13 @@ stap_parse_single_operand (struct stap_parse_info *p)
if (stap_check_integer_suffix (gdbarch, p->arg, &int_suffix))
p->arg += strlen (int_suffix);
else
- error (_("Invalid constant suffix on expression `%s'."),
+ error (_ ("Invalid constant suffix on expression `%s'."),
p->saved_arg);
}
else if (stap_is_register_indirection_prefix (gdbarch, tmp, NULL))
result = stap_parse_register_operand (p);
else
- error (_("Unknown numeric token on expression `%s'."),
- p->saved_arg);
+ error (_ ("Unknown numeric token on expression `%s'."), p->saved_arg);
}
else if (stap_is_integer_prefix (gdbarch, p->arg, &int_prefix))
{
@@ -1018,15 +1023,15 @@ stap_parse_single_operand (struct stap_parse_info *p)
if (stap_check_integer_suffix (gdbarch, p->arg, &int_suffix))
p->arg += strlen (int_suffix);
else
- error (_("Invalid constant suffix on expression `%s'."),
+ error (_ ("Invalid constant suffix on expression `%s'."),
p->saved_arg);
}
else if (stap_is_register_prefix (gdbarch, p->arg, NULL)
|| stap_is_register_indirection_prefix (gdbarch, p->arg, NULL))
result = stap_parse_register_operand (p);
else
- error (_("Operator `%c' not recognized on expression `%s'."),
- *p->arg, p->saved_arg);
+ error (_ ("Operator `%c' not recognized on expression `%s'."), *p->arg,
+ p->saved_arg);
return result;
}
@@ -1060,7 +1065,7 @@ stap_parse_argument_conditionally (struct stap_parse_info *p)
p->arg = skip_spaces (p->arg);
if (*p->arg != ')')
- error (_("Missing close-parenthesis on expression `%s'."),
+ error (_ ("Missing close-parenthesis on expression `%s'."),
p->saved_arg);
--p->inside_paren_p;
@@ -1069,7 +1074,7 @@ stap_parse_argument_conditionally (struct stap_parse_info *p)
p->arg = skip_spaces (p->arg);
}
else
- error (_("Cannot parse expression `%s'."), p->saved_arg);
+ error (_ ("Cannot parse expression `%s'."), p->saved_arg);
return result;
}
@@ -1078,8 +1083,7 @@ stap_parse_argument_conditionally (struct stap_parse_info *p)
better understand what this function does. */
static expr::operation_up ATTRIBUTE_UNUSED_RESULT
-stap_parse_argument_1 (struct stap_parse_info *p,
- expr::operation_up &&lhs_in,
+stap_parse_argument_1 (struct stap_parse_info *p, expr::operation_up &&lhs_in,
enum stap_operand_prec prec)
{
/* This is an operator-precedence parser.
@@ -1120,7 +1124,7 @@ stap_parse_argument_1 (struct stap_parse_info *p,
enum stap_operand_prec cur_prec;
if (!stap_is_operator (p->arg))
- error (_("Invalid operator `%c' on expression `%s'."), *p->arg,
+ error (_ ("Invalid operator `%c' on expression `%s'."), *p->arg,
p->saved_arg);
/* We have to save the current value of the expression buffer because
@@ -1228,8 +1232,7 @@ stap_parse_argument (const char **arg, struct type *atype,
/* We need to initialize the expression buffer, in order to begin
our parsing efforts. We use language_c here because we may need
to do pointer arithmetics. */
- struct stap_parse_info p (*arg, atype, language_def (language_c),
- gdbarch);
+ struct stap_parse_info p (*arg, atype, language_def (language_c), gdbarch);
using namespace expr;
operation_up result = stap_parse_argument_1 (&p, {}, STAP_OPERAND_PREC_NONE);
@@ -1287,29 +1290,29 @@ stap_probe::parse_arguments (struct gdbarch *gdbarch)
{
case '1':
bitness = (got_minus ? STAP_ARG_BITNESS_8BIT_SIGNED
- : STAP_ARG_BITNESS_8BIT_UNSIGNED);
+ : STAP_ARG_BITNESS_8BIT_UNSIGNED);
break;
case '2':
bitness = (got_minus ? STAP_ARG_BITNESS_16BIT_SIGNED
- : STAP_ARG_BITNESS_16BIT_UNSIGNED);
+ : STAP_ARG_BITNESS_16BIT_UNSIGNED);
break;
case '4':
bitness = (got_minus ? STAP_ARG_BITNESS_32BIT_SIGNED
- : STAP_ARG_BITNESS_32BIT_UNSIGNED);
+ : STAP_ARG_BITNESS_32BIT_UNSIGNED);
break;
case '8':
bitness = (got_minus ? STAP_ARG_BITNESS_64BIT_SIGNED
- : STAP_ARG_BITNESS_64BIT_UNSIGNED);
+ : STAP_ARG_BITNESS_64BIT_UNSIGNED);
break;
default:
{
/* We have an error, because we don't expect anything
except 1, 2, 4 and 8. */
- warning (_("unrecognized bitness %s%c' for probe `%s'"),
+ warning (_ ("unrecognized bitness %s%c' for probe `%s'"),
got_minus ? "`-" : "`", *cur,
this->get_name ().c_str ());
return;
@@ -1369,10 +1372,12 @@ stap_probe::get_argument_count (struct gdbarch *gdbarch)
if (!have_warned_stap_incomplete)
{
- warning (_(
-"The SystemTap SDT probe support is not fully implemented on this target;\n"
-"you will not be able to inspect the arguments of the probes.\n"
-"Please report a bug against GDB requesting a port to this target."));
+ warning (_ ("The SystemTap SDT probe support is not fully "
+ "implemented on this target;\n"
+ "you will not be able to inspect the arguments of "
+ "the probes.\n"
+ "Please report a bug against GDB requesting a port "
+ "to this target."));
have_warned_stap_incomplete = true;
}
@@ -1463,7 +1468,6 @@ stap_probe::compile_to_ax (struct agent_expr *expr, struct axs_value *value,
require_rvalue (expr, value);
value->type = arg->atype;
}
-
/* Set or clear a SystemTap semaphore. ADDRESS is the semaphore's
address. SET is zero if the semaphore should be cleared, or one if
@@ -1481,7 +1485,7 @@ stap_modify_semaphore (CORE_ADDR address, int set, struct gdbarch *gdbarch)
/* Swallow errors. */
if (target_read_memory (address, bytes, type->length ()) != 0)
{
- warning (_("Could not read the value of a SystemTap semaphore."));
+ warning (_ ("Could not read the value of a SystemTap semaphore."));
return;
}
@@ -1497,7 +1501,7 @@ stap_modify_semaphore (CORE_ADDR address, int set, struct gdbarch *gdbarch)
store_unsigned_integer (bytes, type->length (), byte_order, value);
if (target_write_memory (address, bytes, type->length ()) != 0)
- warning (_("Could not write the value of a SystemTap semaphore."));
+ warning (_ ("Could not write the value of a SystemTap semaphore."));
}
/* Implementation of the 'set_semaphore' method.
@@ -1570,13 +1574,13 @@ handle_stap_probe (struct objfile *objfile, struct sdt_note *el,
/* Provider and the name of the probe. */
const char *provider = (const char *) &el->data[3 * size];
- const char *name = ((const char *)
- memchr (provider, '\0',
+ const char *name
+ = ((const char *) memchr (provider, '\0',
(char *) el->data + el->size - provider));
/* Making sure there is a name. */
if (name == NULL)
{
- complaint (_("corrupt probe name when reading `%s'"),
+ complaint (_ ("corrupt probe name when reading `%s'"),
objfile_name (objfile));
/* There is no way to use a probe without a name or a provider, so
@@ -1601,9 +1605,9 @@ handle_stap_probe (struct objfile *objfile, struct sdt_note *el,
/* Arguments. We can only extract the argument format if there is a valid
name for this probe. */
- const char *probe_args = ((const char*)
- memchr (name, '\0',
- (char *) el->data + el->size - name));
+ const char *probe_args
+ = ((const char *) memchr (name, '\0',
+ (char *) el->data + el->size - name));
if (probe_args != NULL)
++probe_args;
@@ -1612,7 +1616,7 @@ handle_stap_probe (struct objfile *objfile, struct sdt_note *el,
|| (memchr (probe_args, '\0', (char *) el->data + el->size - name)
!= el->data + el->size - 1))
{
- complaint (_("corrupt probe argument when reading `%s'"),
+ complaint (_ ("corrupt probe argument when reading `%s'"),
objfile_name (objfile));
/* If the argument string is NULL, it means some problem happened with
it. So we return. */
@@ -1639,14 +1643,14 @@ get_stap_base_address (bfd *obfd, bfd_vma *base)
asection *ret = NULL;
for (asection *sect : gdb_bfd_sections (obfd))
- if ((sect->flags & (SEC_DATA | SEC_ALLOC | SEC_HAS_CONTENTS))
- && sect->name && !strcmp (sect->name, STAP_BASE_SECTION_NAME))
+ if ((sect->flags & (SEC_DATA | SEC_ALLOC | SEC_HAS_CONTENTS)) && sect->name
+ && !strcmp (sect->name, STAP_BASE_SECTION_NAME))
ret = sect;
if (ret == NULL)
{
- complaint (_("could not obtain base address for "
- "SystemTap section on objfile `%s'."),
+ complaint (_ ("could not obtain base address for "
+ "SystemTap section on objfile `%s'."),
bfd_get_filename (obfd));
return 0;
}
@@ -1670,9 +1674,8 @@ stap_static_probe_ops::is_linespec (const char **linespecp) const
/* Implementation of the 'get_probes' method. */
void
-stap_static_probe_ops::get_probes
- (std::vector<std::unique_ptr<probe>> *probesp,
- struct objfile *objfile) const
+stap_static_probe_ops::get_probes (
+ std::vector<std::unique_ptr<probe>> *probesp, struct objfile *objfile) const
{
/* If we are here, then this is the first time we are parsing the
SystemTap probe's information. We basically have to count how many
@@ -1703,9 +1706,7 @@ stap_static_probe_ops::get_probes
}
/* Parsing each probe's information. */
- for (iter = elf_tdata (obfd)->sdt_note_head;
- iter != NULL;
- iter = iter->next)
+ for (iter = elf_tdata (obfd)->sdt_note_head; iter != NULL; iter = iter->next)
{
/* We first have to handle all the information about the
probe which is present in the section. */
@@ -1716,7 +1717,7 @@ stap_static_probe_ops::get_probes
{
/* If we are here, it means we have failed to parse every known
probe. */
- complaint (_("could not parse SystemTap probe(s) from inferior"));
+ complaint (_ ("could not parse SystemTap probe(s) from inferior"));
return;
}
}
@@ -1737,7 +1738,7 @@ stap_static_probe_ops::gen_info_probes_table_header () const
struct info_probe_column stap_probe_column;
stap_probe_column.field_name = "semaphore";
- stap_probe_column.print_name = _("Semaphore");
+ stap_probe_column.print_name = _ ("Semaphore");
return std::vector<struct info_probe_column> { stap_probe_column };
}
@@ -1751,6 +1752,7 @@ info_probes_stap_command (const char *arg, int from_tty)
}
void _initialize_stap_probe ();
+
void
_initialize_stap_probe ()
{
@@ -1758,16 +1760,14 @@ _initialize_stap_probe ()
add_setshow_zuinteger_cmd ("stap-expression", class_maintenance,
&stap_expression_debug,
- _("Set SystemTap expression debugging."),
- _("Show SystemTap expression debugging."),
- _("When non-zero, the internal representation "
- "of SystemTap expressions will be printed."),
- NULL,
- show_stapexpressiondebug,
- &setdebuglist, &showdebuglist);
-
- add_cmd ("stap", class_info, info_probes_stap_command,
- _("\
+ _ ("Set SystemTap expression debugging."),
+ _ ("Show SystemTap expression debugging."),
+ _ ("When non-zero, the internal representation "
+ "of SystemTap expressions will be printed."),
+ NULL, show_stapexpressiondebug, &setdebuglist,
+ &showdebuglist);
+
+ add_cmd ("stap", class_info, info_probes_stap_command, _ ("\
Show information about SystemTap static probes.\n\
Usage: info probes stap [PROVIDER [NAME [OBJECT]]]\n\
Each argument is a regular expression, used to select probes.\n\
@@ -1776,7 +1776,6 @@ NAME matches the probe names.\n\
OBJECT matches the executable or shared library name."),
info_probes_cmdlist_get ());
-
using namespace expr;
stap_maker_map[BINOP_ADD] = make_operation<add_operation>;
stap_maker_map[BINOP_BITWISE_AND] = make_operation<bitwise_and_operation>;
diff --git a/gdb/stap-probe.h b/gdb/stap-probe.h
index 381853ce880..6355b961469 100644
--- a/gdb/stap-probe.h
+++ b/gdb/stap-probe.h
@@ -17,7 +17,7 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
-#if !defined (STAP_PROBE_H)
+#if !defined(STAP_PROBE_H)
#define STAP_PROBE_H 1
#include "parser-defs.h"
@@ -28,8 +28,7 @@
struct stap_parse_info
{
stap_parse_info (const char *arg_, struct type *arg_type_,
- const struct language_defn *lang,
- struct gdbarch *gdbarch)
+ const struct language_defn *lang, struct gdbarch *gdbarch)
: arg (arg_),
pstate (lang, gdbarch),
saved_arg (arg_),
diff --git a/gdb/std-regs.c b/gdb/std-regs.c
index 4458c244122..790bddf20c2 100644
--- a/gdb/std-regs.c
+++ b/gdb/std-regs.c
@@ -38,16 +38,15 @@ value_of_builtin_frame_fp_reg (frame_info_ptr frame, const void *baton)
An architecture wanting to implement "$fp" as alias for a raw
register can do so by adding "fp" to register name table (mind
you, doing this is probably a dangerous thing). */
- return value_of_register (gdbarch_deprecated_fp_regnum (gdbarch),
- frame);
+ return value_of_register (gdbarch_deprecated_fp_regnum (gdbarch), frame);
else
{
struct type *data_ptr_type = builtin_type (gdbarch)->builtin_data_ptr;
struct value *val = allocate_value (data_ptr_type);
gdb_byte *buf = value_contents_raw (val).data ();
- gdbarch_address_to_pointer (gdbarch, data_ptr_type,
- buf, get_frame_base_address (frame));
+ gdbarch_address_to_pointer (gdbarch, data_ptr_type, buf,
+ get_frame_base_address (frame));
return val;
}
}
@@ -65,8 +64,8 @@ value_of_builtin_frame_pc_reg (frame_info_ptr frame, const void *baton)
struct value *val = allocate_value (func_ptr_type);
gdb_byte *buf = value_contents_raw (val).data ();
- gdbarch_address_to_pointer (gdbarch, func_ptr_type,
- buf, get_frame_pc (frame));
+ gdbarch_address_to_pointer (gdbarch, func_ptr_type, buf,
+ get_frame_pc (frame));
return val;
}
}
@@ -78,7 +77,7 @@ value_of_builtin_frame_sp_reg (frame_info_ptr frame, const void *baton)
if (gdbarch_sp_regnum (gdbarch) >= 0)
return value_of_register (gdbarch_sp_regnum (gdbarch), frame);
- error (_("Standard register ``$sp'' is not available for this target"));
+ error (_ ("Standard register ``$sp'' is not available for this target"));
}
static struct value *
@@ -88,10 +87,11 @@ value_of_builtin_frame_ps_reg (frame_info_ptr frame, const void *baton)
if (gdbarch_ps_regnum (gdbarch) >= 0)
return value_of_register (gdbarch_ps_regnum (gdbarch), frame);
- error (_("Standard register ``$ps'' is not available for this target"));
+ error (_ ("Standard register ``$ps'' is not available for this target"));
}
void _initialize_frame_reg ();
+
void
_initialize_frame_reg ()
{
diff --git a/gdb/stub-termcap.c b/gdb/stub-termcap.c
index b8ee61c72e9..b1c19c419d7 100644
--- a/gdb/stub-termcap.c
+++ b/gdb/stub-termcap.c
@@ -19,19 +19,17 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
-
#include "defs.h"
-extern "C" {
-
-/* -Wmissing-prototypes */
-extern int tgetent (char *buffer, char *termtype);
-extern int tgetnum (char *name);
-extern int tgetflag (char *name);
-extern char* tgetstr (char *name, char **area);
-extern int tputs (char *string, int nlines, int (*outfun) (int));
-extern char *tgoto (const char *cap, int col, int row);
-
+extern "C"
+{
+ /* -Wmissing-prototypes */
+ extern int tgetent (char *buffer, char *termtype);
+ extern int tgetnum (char *name);
+ extern int tgetflag (char *name);
+ extern char *tgetstr (char *name, char **area);
+ extern int tputs (char *string, int nlines, int (*outfun) (int));
+ extern char *tgoto (const char *cap, int col, int row);
}
/* These globals below are global termcap variables that readline
@@ -47,9 +45,9 @@ extern char *tgoto (const char *cap, int col, int row);
file originally was Windows only, and we only needed this when we
made it work on other hosts, it should be OK. */
#ifndef __MINGW32__
-char PC __attribute__((weak));
-char *BC __attribute__((weak));
-char *UP __attribute__((weak));
+char PC __attribute__ ((weak));
+char *BC __attribute__ ((weak));
+char *UP __attribute__ ((weak));
#endif
/* Each of the files below is a minimal implementation of the standard
diff --git a/gdb/stubs/i386-stub.c b/gdb/stubs/i386-stub.c
index 04996b75cf6..094db32ad00 100644
--- a/gdb/stubs/i386-stub.c
+++ b/gdb/stubs/i386-stub.c
@@ -97,32 +97,47 @@
* external low-level support routines
*/
-extern void putDebugChar(); /* write a single character */
-extern int getDebugChar(); /* read and return a single char */
-extern void exceptionHandler(); /* assign an exception handler */
+extern void putDebugChar (); /* write a single character */
+extern int getDebugChar (); /* read and return a single char */
+extern void exceptionHandler (); /* assign an exception handler */
/************************************************************************/
/* BUFMAX defines the maximum number of characters in inbound/outbound buffers*/
/* at least NUMREGBYTES*2 are needed for register packets */
#define BUFMAX 400
-static char initialized; /* boolean flag. != 0 means we've been initialized */
+static char initialized; /* boolean flag. != 0 means we've been initialized */
-int remote_debug;
+int remote_debug;
/* debug > 0 prints ill-formed commands in valid packets & checksum errors */
-static const char hexchars[]="0123456789abcdef";
+static const char hexchars[] = "0123456789abcdef";
/* Number of registers. */
-#define NUMREGS 16
+#define NUMREGS 16
/* Number of bytes of registers. */
#define NUMREGBYTES (NUMREGS * 4)
-enum regnames {EAX, ECX, EDX, EBX, ESP, EBP, ESI, EDI,
- PC /* also known as eip */,
- PS /* also known as eflags */,
- CS, SS, DS, ES, FS, GS};
+enum regnames
+{
+ EAX,
+ ECX,
+ EDX,
+ EBX,
+ ESP,
+ EBP,
+ ESI,
+ EDI,
+ PC /* also known as eip */,
+ PS /* also known as eflags */,
+ CS,
+ SS,
+ DS,
+ ES,
+ FS,
+ GS
+};
/*
* these should not be static cuz they can be used outside this module
@@ -130,45 +145,44 @@ enum regnames {EAX, ECX, EDX, EBX, ESP, EBP, ESI, EDI,
int registers[NUMREGS];
#define STACKSIZE 10000
-int remcomStack[STACKSIZE/sizeof(int)];
-static int* stackPtr = &remcomStack[STACKSIZE/sizeof(int) - 1];
+int remcomStack[STACKSIZE / sizeof (int)];
+static int *stackPtr = &remcomStack[STACKSIZE / sizeof (int) - 1];
/*************************** ASSEMBLY CODE MACROS *************************/
/* */
-extern void
-return_to_prog ();
+extern void return_to_prog ();
/* Restore the program's registers (including the stack pointer, which
means we get the right stack and don't have to worry about popping our
return address and any stack frames and so on) and return. */
-asm(".text");
-asm(".globl _return_to_prog");
-asm("_return_to_prog:");
-asm(" movw _registers+44, %ss");
-asm(" movl _registers+16, %esp");
-asm(" movl _registers+4, %ecx");
-asm(" movl _registers+8, %edx");
-asm(" movl _registers+12, %ebx");
-asm(" movl _registers+20, %ebp");
-asm(" movl _registers+24, %esi");
-asm(" movl _registers+28, %edi");
-asm(" movw _registers+48, %ds");
-asm(" movw _registers+52, %es");
-asm(" movw _registers+56, %fs");
-asm(" movw _registers+60, %gs");
-asm(" movl _registers+36, %eax");
-asm(" pushl %eax"); /* saved eflags */
-asm(" movl _registers+40, %eax");
-asm(" pushl %eax"); /* saved cs */
-asm(" movl _registers+32, %eax");
-asm(" pushl %eax"); /* saved eip */
-asm(" movl _registers, %eax");
+asm (".text");
+asm (".globl _return_to_prog");
+asm ("_return_to_prog:");
+asm (" movw _registers+44, %ss");
+asm (" movl _registers+16, %esp");
+asm (" movl _registers+4, %ecx");
+asm (" movl _registers+8, %edx");
+asm (" movl _registers+12, %ebx");
+asm (" movl _registers+20, %ebp");
+asm (" movl _registers+24, %esi");
+asm (" movl _registers+28, %edi");
+asm (" movw _registers+48, %ds");
+asm (" movw _registers+52, %es");
+asm (" movw _registers+56, %fs");
+asm (" movw _registers+60, %gs");
+asm (" movl _registers+36, %eax");
+asm (" pushl %eax"); /* saved eflags */
+asm (" movl _registers+40, %eax");
+asm (" pushl %eax"); /* saved cs */
+asm (" movl _registers+32, %eax");
+asm (" pushl %eax"); /* saved eip */
+asm (" movl _registers, %eax");
/* use iret to restore pc and flags together so
that trace flag works right. */
-asm(" iret");
+asm (" iret");
-#define BREAKPOINT() asm(" int $3");
+#define BREAKPOINT() asm (" int $3");
/* Put the error code here just in case the user cares. */
int gdb_i386errcode;
@@ -178,42 +192,42 @@ int gdb_i386vector = -1;
/* GDB stores segment registers in 32-bit words (that's just the way
m-i386v.h is written). So zero the appropriate areas in registers. */
-#define SAVE_REGISTERS1() \
- asm ("movl %eax, _registers"); \
- asm ("movl %ecx, _registers+4"); \
- asm ("movl %edx, _registers+8"); \
- asm ("movl %ebx, _registers+12"); \
- asm ("movl %ebp, _registers+20"); \
- asm ("movl %esi, _registers+24"); \
- asm ("movl %edi, _registers+28"); \
- asm ("movw $0, %ax"); \
- asm ("movw %ds, _registers+48"); \
- asm ("movw %ax, _registers+50"); \
- asm ("movw %es, _registers+52"); \
- asm ("movw %ax, _registers+54"); \
- asm ("movw %fs, _registers+56"); \
- asm ("movw %ax, _registers+58"); \
- asm ("movw %gs, _registers+60"); \
+#define SAVE_REGISTERS1() \
+ asm ("movl %eax, _registers"); \
+ asm ("movl %ecx, _registers+4"); \
+ asm ("movl %edx, _registers+8"); \
+ asm ("movl %ebx, _registers+12"); \
+ asm ("movl %ebp, _registers+20"); \
+ asm ("movl %esi, _registers+24"); \
+ asm ("movl %edi, _registers+28"); \
+ asm ("movw $0, %ax"); \
+ asm ("movw %ds, _registers+48"); \
+ asm ("movw %ax, _registers+50"); \
+ asm ("movw %es, _registers+52"); \
+ asm ("movw %ax, _registers+54"); \
+ asm ("movw %fs, _registers+56"); \
+ asm ("movw %ax, _registers+58"); \
+ asm ("movw %gs, _registers+60"); \
asm ("movw %ax, _registers+62");
#define SAVE_ERRCODE() \
- asm ("popl %ebx"); \
+ asm ("popl %ebx"); \
asm ("movl %ebx, _gdb_i386errcode");
-#define SAVE_REGISTERS2() \
- asm ("popl %ebx"); /* old eip */ \
- asm ("movl %ebx, _registers+32"); \
- asm ("popl %ebx"); /* old cs */ \
- asm ("movl %ebx, _registers+40"); \
- asm ("movw %ax, _registers+42"); \
- asm ("popl %ebx"); /* old eflags */ \
- asm ("movl %ebx, _registers+36"); \
- /* Now that we've done the pops, we can save the stack pointer."); */ \
- asm ("movw %ss, _registers+44"); \
- asm ("movw %ax, _registers+46"); \
+#define SAVE_REGISTERS2() \
+ asm ("popl %ebx"); /* old eip */ \
+ asm ("movl %ebx, _registers+32"); \
+ asm ("popl %ebx"); /* old cs */ \
+ asm ("movl %ebx, _registers+40"); \
+ asm ("movw %ax, _registers+42"); \
+ asm ("popl %ebx"); /* old eflags */ \
+ asm ("movl %ebx, _registers+36"); \
+ /* Now that we've done the pops, we can save the stack pointer."); */ \
+ asm ("movw %ss, _registers+44"); \
+ asm ("movw %ax, _registers+46"); \
asm ("movl %esp, _registers+16");
/* See if mem_fault_routine is set, if so just IRET to that address. */
-#define CHECK_FAULT() \
- asm ("cmpl $0, _mem_fault_routine"); \
+#define CHECK_FAULT() \
+ asm ("cmpl $0, _mem_fault_routine"); \
asm ("jne mem_fault");
asm (".text");
@@ -246,7 +260,7 @@ asm (" movl %eax, _mem_fault_routine");
asm ("iret");
-#define CALL_HOOK() asm("call _remcomHandler");
+#define CALL_HOOK() asm ("call _remcomHandler");
/* This function is called when a i386 exception occurs. It saves
* all the cpu regs in the _registers array, munges the stack a bit,
@@ -258,127 +272,127 @@ asm ("iret");
* old eip
*
*/
-extern void _catchException3();
-asm(".text");
-asm(".globl __catchException3");
-asm("__catchException3:");
-SAVE_REGISTERS1();
-SAVE_REGISTERS2();
+extern void _catchException3 ();
+asm (".text");
+asm (".globl __catchException3");
+asm ("__catchException3:");
+SAVE_REGISTERS1 ();
+SAVE_REGISTERS2 ();
asm ("pushl $3");
-CALL_HOOK();
+CALL_HOOK ();
/* Same thing for exception 1. */
-extern void _catchException1();
-asm(".text");
-asm(".globl __catchException1");
-asm("__catchException1:");
-SAVE_REGISTERS1();
-SAVE_REGISTERS2();
+extern void _catchException1 ();
+asm (".text");
+asm (".globl __catchException1");
+asm ("__catchException1:");
+SAVE_REGISTERS1 ();
+SAVE_REGISTERS2 ();
asm ("pushl $1");
-CALL_HOOK();
+CALL_HOOK ();
/* Same thing for exception 0. */
-extern void _catchException0();
-asm(".text");
-asm(".globl __catchException0");
-asm("__catchException0:");
-SAVE_REGISTERS1();
-SAVE_REGISTERS2();
+extern void _catchException0 ();
+asm (".text");
+asm (".globl __catchException0");
+asm ("__catchException0:");
+SAVE_REGISTERS1 ();
+SAVE_REGISTERS2 ();
asm ("pushl $0");
-CALL_HOOK();
+CALL_HOOK ();
/* Same thing for exception 4. */
-extern void _catchException4();
-asm(".text");
-asm(".globl __catchException4");
-asm("__catchException4:");
-SAVE_REGISTERS1();
-SAVE_REGISTERS2();
+extern void _catchException4 ();
+asm (".text");
+asm (".globl __catchException4");
+asm ("__catchException4:");
+SAVE_REGISTERS1 ();
+SAVE_REGISTERS2 ();
asm ("pushl $4");
-CALL_HOOK();
+CALL_HOOK ();
/* Same thing for exception 5. */
-extern void _catchException5();
-asm(".text");
-asm(".globl __catchException5");
-asm("__catchException5:");
-SAVE_REGISTERS1();
-SAVE_REGISTERS2();
+extern void _catchException5 ();
+asm (".text");
+asm (".globl __catchException5");
+asm ("__catchException5:");
+SAVE_REGISTERS1 ();
+SAVE_REGISTERS2 ();
asm ("pushl $5");
-CALL_HOOK();
+CALL_HOOK ();
/* Same thing for exception 6. */
-extern void _catchException6();
-asm(".text");
-asm(".globl __catchException6");
-asm("__catchException6:");
-SAVE_REGISTERS1();
-SAVE_REGISTERS2();
+extern void _catchException6 ();
+asm (".text");
+asm (".globl __catchException6");
+asm ("__catchException6:");
+SAVE_REGISTERS1 ();
+SAVE_REGISTERS2 ();
asm ("pushl $6");
-CALL_HOOK();
+CALL_HOOK ();
/* Same thing for exception 7. */
-extern void _catchException7();
-asm(".text");
-asm(".globl __catchException7");
-asm("__catchException7:");
-SAVE_REGISTERS1();
-SAVE_REGISTERS2();
+extern void _catchException7 ();
+asm (".text");
+asm (".globl __catchException7");
+asm ("__catchException7:");
+SAVE_REGISTERS1 ();
+SAVE_REGISTERS2 ();
asm ("pushl $7");
-CALL_HOOK();
+CALL_HOOK ();
/* Same thing for exception 8. */
-extern void _catchException8();
-asm(".text");
-asm(".globl __catchException8");
-asm("__catchException8:");
-SAVE_REGISTERS1();
-SAVE_ERRCODE();
-SAVE_REGISTERS2();
+extern void _catchException8 ();
+asm (".text");
+asm (".globl __catchException8");
+asm ("__catchException8:");
+SAVE_REGISTERS1 ();
+SAVE_ERRCODE ();
+SAVE_REGISTERS2 ();
asm ("pushl $8");
-CALL_HOOK();
+CALL_HOOK ();
/* Same thing for exception 9. */
-extern void _catchException9();
-asm(".text");
-asm(".globl __catchException9");
-asm("__catchException9:");
-SAVE_REGISTERS1();
-SAVE_REGISTERS2();
+extern void _catchException9 ();
+asm (".text");
+asm (".globl __catchException9");
+asm ("__catchException9:");
+SAVE_REGISTERS1 ();
+SAVE_REGISTERS2 ();
asm ("pushl $9");
-CALL_HOOK();
+CALL_HOOK ();
/* Same thing for exception 10. */
-extern void _catchException10();
-asm(".text");
-asm(".globl __catchException10");
-asm("__catchException10:");
-SAVE_REGISTERS1();
-SAVE_ERRCODE();
-SAVE_REGISTERS2();
+extern void _catchException10 ();
+asm (".text");
+asm (".globl __catchException10");
+asm ("__catchException10:");
+SAVE_REGISTERS1 ();
+SAVE_ERRCODE ();
+SAVE_REGISTERS2 ();
asm ("pushl $10");
-CALL_HOOK();
+CALL_HOOK ();
/* Same thing for exception 12. */
-extern void _catchException12();
-asm(".text");
-asm(".globl __catchException12");
-asm("__catchException12:");
-SAVE_REGISTERS1();
-SAVE_ERRCODE();
-SAVE_REGISTERS2();
+extern void _catchException12 ();
+asm (".text");
+asm (".globl __catchException12");
+asm ("__catchException12:");
+SAVE_REGISTERS1 ();
+SAVE_ERRCODE ();
+SAVE_REGISTERS2 ();
asm ("pushl $12");
-CALL_HOOK();
+CALL_HOOK ();
/* Same thing for exception 16. */
-extern void _catchException16();
-asm(".text");
-asm(".globl __catchException16");
-asm("__catchException16:");
-SAVE_REGISTERS1();
-SAVE_REGISTERS2();
+extern void _catchException16 ();
+asm (".text");
+asm (".globl __catchException16");
+asm ("__catchException16:");
+SAVE_REGISTERS1 ();
+SAVE_REGISTERS2 ();
asm ("pushl $16");
-CALL_HOOK();
+CALL_HOOK ();
/* For 13, 11, and 14 we have to deal with the CHECK_FAULT stuff. */
@@ -387,47 +401,47 @@ extern void _catchException13 ();
asm (".text");
asm (".globl __catchException13");
asm ("__catchException13:");
-CHECK_FAULT();
-SAVE_REGISTERS1();
-SAVE_ERRCODE();
-SAVE_REGISTERS2();
+CHECK_FAULT ();
+SAVE_REGISTERS1 ();
+SAVE_ERRCODE ();
+SAVE_REGISTERS2 ();
asm ("pushl $13");
-CALL_HOOK();
+CALL_HOOK ();
/* Same thing for exception 11. */
extern void _catchException11 ();
asm (".text");
asm (".globl __catchException11");
asm ("__catchException11:");
-CHECK_FAULT();
-SAVE_REGISTERS1();
-SAVE_ERRCODE();
-SAVE_REGISTERS2();
+CHECK_FAULT ();
+SAVE_REGISTERS1 ();
+SAVE_ERRCODE ();
+SAVE_REGISTERS2 ();
asm ("pushl $11");
-CALL_HOOK();
+CALL_HOOK ();
/* Same thing for exception 14. */
extern void _catchException14 ();
asm (".text");
asm (".globl __catchException14");
asm ("__catchException14:");
-CHECK_FAULT();
-SAVE_REGISTERS1();
-SAVE_ERRCODE();
-SAVE_REGISTERS2();
+CHECK_FAULT ();
+SAVE_REGISTERS1 ();
+SAVE_ERRCODE ();
+SAVE_REGISTERS2 ();
asm ("pushl $14");
-CALL_HOOK();
+CALL_HOOK ();
/*
* remcomHandler is a front end for handle_exception. It moves the
* stack pointer into an area reserved for debugger use.
*/
-asm("_remcomHandler:");
-asm(" popl %eax"); /* pop off return address */
-asm(" popl %eax"); /* get the exception number */
-asm(" movl _stackPtr, %esp"); /* move to remcom stack area */
-asm(" pushl %eax"); /* push exception onto stack */
-asm(" call _handle_exception"); /* this never returns */
+asm ("_remcomHandler:");
+asm (" popl %eax"); /* pop off return address */
+asm (" popl %eax"); /* get the exception number */
+asm (" movl _stackPtr, %esp"); /* move to remcom stack area */
+asm (" pushl %eax"); /* push exception onto stack */
+asm (" call _handle_exception"); /* this never returns */
void
_returnFromException ()
@@ -437,7 +451,7 @@ _returnFromException ()
int
hex (ch)
- char ch;
+char ch;
{
if ((ch >= 'a') && (ch <= 'f'))
return (ch - 'a' + 10);
@@ -498,15 +512,16 @@ getpacket (void)
{
if (remote_debug)
{
- fprintf (stderr,
- "bad checksum. My count = 0x%x, sent=0x%x. buf=%s\n",
- checksum, xmitcsum, buffer);
+ fprintf (
+ stderr,
+ "bad checksum. My count = 0x%x, sent=0x%x. buf=%s\n",
+ checksum, xmitcsum, buffer);
}
- putDebugChar ('-'); /* failed checksum */
+ putDebugChar ('-'); /* failed checksum */
}
else
{
- putDebugChar ('+'); /* successful transfer */
+ putDebugChar ('+'); /* successful transfer */
/* if a sequence char is present, reply the sequence ID */
if (buffer[2] == ':')
@@ -549,15 +564,12 @@ putpacket (unsigned char *buffer)
putDebugChar ('#');
putDebugChar (hexchars[checksum >> 4]);
putDebugChar (hexchars[checksum % 16]);
-
}
while (getDebugChar () != '+');
}
-void
-debug_error (format, parm)
- char *format;
- char *parm;
+void debug_error (format, parm) char *format;
+char *parm;
{
if (remote_debug)
fprintf (stderr, format, parm);
@@ -598,10 +610,10 @@ set_char (char *addr, int val)
a fault; if zero treat a fault like any other fault in the stub. */
char *
mem2hex (mem, buf, count, may_fault)
- char *mem;
- char *buf;
- int count;
- int may_fault;
+char *mem;
+char *buf;
+int count;
+int may_fault;
{
int i;
unsigned char ch;
@@ -626,10 +638,10 @@ mem2hex (mem, buf, count, may_fault)
/* return a pointer to the character AFTER the last byte written */
char *
hex2mem (buf, mem, count, may_fault)
- char *buf;
- char *mem;
- int count;
- int may_fault;
+char *buf;
+char *mem;
+int count;
+int may_fault;
{
int i;
unsigned char ch;
@@ -659,51 +671,51 @@ computeSignal (int exceptionVector)
{
case 0:
sigval = 8;
- break; /* divide by zero */
+ break; /* divide by zero */
case 1:
sigval = 5;
- break; /* debug exception */
+ break; /* debug exception */
case 3:
sigval = 5;
- break; /* breakpoint */
+ break; /* breakpoint */
case 4:
sigval = 16;
- break; /* into instruction (overflow) */
+ break; /* into instruction (overflow) */
case 5:
sigval = 16;
- break; /* bound instruction */
+ break; /* bound instruction */
case 6:
sigval = 4;
- break; /* Invalid opcode */
+ break; /* Invalid opcode */
case 7:
sigval = 8;
- break; /* coprocessor not available */
+ break; /* coprocessor not available */
case 8:
sigval = 7;
- break; /* double fault */
+ break; /* double fault */
case 9:
sigval = 11;
- break; /* coprocessor segment overrun */
+ break; /* coprocessor segment overrun */
case 10:
sigval = 11;
- break; /* Invalid TSS */
+ break; /* Invalid TSS */
case 11:
sigval = 11;
- break; /* Segment not present */
+ break; /* Segment not present */
case 12:
sigval = 11;
- break; /* stack exception */
+ break; /* stack exception */
case 13:
sigval = 11;
- break; /* general protection */
+ break; /* general protection */
case 14:
sigval = 11;
- break; /* page fault */
+ break; /* page fault */
case 16:
sigval = 7;
- break; /* coprocessor error */
+ break; /* coprocessor error */
default:
- sigval = 7; /* "software generated" */
+ sigval = 7; /* "software generated" */
}
return (sigval);
}
@@ -752,8 +764,8 @@ handle_exception (int exceptionVector)
if (remote_debug)
{
- printf ("vector=%d, sr=0x%x, pc=0x%x\n",
- exceptionVector, registers[PS], registers[PC]);
+ printf ("vector=%d, sr=0x%x, pc=0x%x\n", exceptionVector, registers[PS],
+ registers[PC]);
}
/* reply to host that an exception has occurred */
@@ -761,28 +773,28 @@ handle_exception (int exceptionVector)
ptr = remcomOutBuffer;
- *ptr++ = 'T'; /* notify gdb with signo, PC, FP and SP */
+ *ptr++ = 'T'; /* notify gdb with signo, PC, FP and SP */
*ptr++ = hexchars[sigval >> 4];
*ptr++ = hexchars[sigval & 0xf];
- *ptr++ = hexchars[ESP];
+ *ptr++ = hexchars[ESP];
*ptr++ = ':';
- ptr = mem2hex((char *)&registers[ESP], ptr, 4, 0); /* SP */
+ ptr = mem2hex ((char *) &registers[ESP], ptr, 4, 0); /* SP */
*ptr++ = ';';
- *ptr++ = hexchars[EBP];
+ *ptr++ = hexchars[EBP];
*ptr++ = ':';
- ptr = mem2hex((char *)&registers[EBP], ptr, 4, 0); /* FP */
+ ptr = mem2hex ((char *) &registers[EBP], ptr, 4, 0); /* FP */
*ptr++ = ';';
- *ptr++ = hexchars[PC];
+ *ptr++ = hexchars[PC];
*ptr++ = ':';
- ptr = mem2hex((char *)&registers[PC], ptr, 4, 0); /* PC */
+ ptr = mem2hex ((char *) &registers[PC], ptr, 4, 0); /* PC */
*ptr++ = ';';
*ptr = '\0'
- putpacket (remcomOutBuffer);
+ putpacket (remcomOutBuffer);
stepping = 0;
@@ -800,16 +812,16 @@ handle_exception (int exceptionVector)
remcomOutBuffer[3] = 0;
break;
case 'd':
- remote_debug = !(remote_debug); /* toggle debug flag */
+ remote_debug = !(remote_debug); /* toggle debug flag */
break;
- case 'g': /* return the value of the CPU registers */
+ case 'g': /* return the value of the CPU registers */
mem2hex ((char *) registers, remcomOutBuffer, NUMREGBYTES, 0);
break;
- case 'G': /* set the value of the CPU registers - return OK */
+ case 'G': /* set the value of the CPU registers - return OK */
hex2mem (ptr, (char *) registers, NUMREGBYTES, 0);
strcpy (remcomOutBuffer, "OK");
break;
- case 'P': /* set the value of a single CPU register - return OK */
+ case 'P': /* set the value of a single CPU register - return OK */
{
int regno;
@@ -895,18 +907,18 @@ handle_exception (int exceptionVector)
if (stepping)
registers[PS] |= 0x100;
- _returnFromException (); /* this is a jump */
+ _returnFromException (); /* this is a jump */
break;
/* kill the program */
- case 'k': /* do nothing */
+ case 'k': /* do nothing */
#if 0
/* Huh? This doesn't look like "nothing".
m68k-stub.c and sparc-stub.c don't have it. */
BREAKPOINT ();
#endif
break;
- } /* switch */
+ } /* switch */
/* reply to the request */
putpacket (remcomOutBuffer);
diff --git a/gdb/stubs/ia64vms-stub.c b/gdb/stubs/ia64vms-stub.c
index 8e8132e93b6..f983598a315 100644
--- a/gdb/stubs/ia64vms-stub.c
+++ b/gdb/stubs/ia64vms-stub.c
@@ -74,8 +74,8 @@
/* Declared in lib$ots. */
extern void ots$fill (void *addr, size_t len, unsigned char b);
extern void ots$move (void *dst, size_t len, const void *src);
-extern int ots$strcmp_eql (const void *str1, size_t str1len,
- const void *str2, size_t str2len);
+extern int ots$strcmp_eql (const void *str1, size_t str1len, const void *str2,
+ size_t str2len);
/* Stub port number. */
static unsigned int serv_port = 1234;
@@ -84,7 +84,7 @@ static unsigned int serv_port = 1234;
struct dbgext_control_block
{
unsigned short dbgext$w_function_code;
-#define DBGEXT$K_NEXT_TASK 3
+#define DBGEXT$K_NEXT_TASK 3
#define DBGEXT$K_STOP_ALL_OTHER_TASKS 31
#define DBGEXT$K_GET_REGS 33
unsigned short dbgext$w_facility_id;
@@ -99,8 +99,8 @@ struct dbgext_control_block
unsigned int dbgext$l_task_number;
unsigned int dbgext$l_ada_flags;
unsigned int dbgext$l_stop_value;
-#define dbgext$l_priority dbgext$l_stop_value;
-#define dbgext$l_symb_addr dbgext$l_stop_value;
+#define dbgext$l_priority dbgext$l_stop_value;
+#define dbgext$l_symb_addr dbgext$l_stop_value;
#define dbgext$l_time_slice dbgext$l_stop_value;
unsigned int dbgext$l_active_registers;
};
@@ -130,28 +130,29 @@ struct debug_flag
};
/* Macro to define a debugging flag. */
-#define DEBUG_FLAG_ENTRY(str) \
- { { sizeof (str) - 1, DSC$K_DTYPE_T, DSC$K_CLASS_S, str }, 0}
+#define DEBUG_FLAG_ENTRY(str) \
+ { \
+ { sizeof (str) - 1, DSC$K_DTYPE_T, DSC$K_CLASS_S, str }, 0 \
+ }
-static struct debug_flag debug_flags[] =
-{
+static struct debug_flag debug_flags[] = {
/* Disp packets exchanged with gdb. */
- DEBUG_FLAG_ENTRY("packets"),
+ DEBUG_FLAG_ENTRY ("packets"),
#define trace_pkt (debug_flags[0].val)
/* Display entry point informations. */
- DEBUG_FLAG_ENTRY("entry"),
+ DEBUG_FLAG_ENTRY ("entry"),
#define trace_entry (debug_flags[1].val)
/* Be verbose about exceptions. */
- DEBUG_FLAG_ENTRY("excp"),
+ DEBUG_FLAG_ENTRY ("excp"),
#define trace_excp (debug_flags[2].val)
/* Be verbose about unwinding. */
- DEBUG_FLAG_ENTRY("unwind"),
+ DEBUG_FLAG_ENTRY ("unwind"),
#define trace_unwind (debug_flags[3].val)
/* Display image at startup. */
- DEBUG_FLAG_ENTRY("images"),
+ DEBUG_FLAG_ENTRY ("images"),
#define trace_images (debug_flags[4].val)
/* Display pthread_debug info. */
- DEBUG_FLAG_ENTRY("pthreaddbg")
+ DEBUG_FLAG_ENTRY ("pthreaddbg")
#define trace_pthreaddbg (debug_flags[5].val)
};
@@ -173,7 +174,7 @@ struct sockchar
};
/* Chain of images loaded. */
-extern IMCB* ctl$gl_imglstptr;
+extern IMCB *ctl$gl_imglstptr;
/* IA64 integer register representation. */
union ia64_ireg
@@ -183,74 +184,74 @@ union ia64_ireg
};
/* IA64 register numbers, as defined by ia64-tdep.h. */
-#define IA64_GR0_REGNUM 0
-#define IA64_GR32_REGNUM (IA64_GR0_REGNUM + 32)
+#define IA64_GR0_REGNUM 0
+#define IA64_GR32_REGNUM (IA64_GR0_REGNUM + 32)
/* Floating point registers; 128 82-bit wide registers. */
-#define IA64_FR0_REGNUM 128
+#define IA64_FR0_REGNUM 128
/* Predicate registers; There are 64 of these one bit registers. It'd
be more convenient (implementation-wise) to use a single 64 bit
word with all of these register in them. Note that there's also a
IA64_PR_REGNUM below which contains all the bits and is used for
communicating the actual values to the target. */
-#define IA64_PR0_REGNUM 256
+#define IA64_PR0_REGNUM 256
/* Branch registers: 8 64-bit registers for holding branch targets. */
-#define IA64_BR0_REGNUM 320
+#define IA64_BR0_REGNUM 320
/* Virtual frame pointer; this matches IA64_FRAME_POINTER_REGNUM in
gcc/config/ia64/ia64.h. */
-#define IA64_VFP_REGNUM 328
+#define IA64_VFP_REGNUM 328
/* Virtual return address pointer; this matches
IA64_RETURN_ADDRESS_POINTER_REGNUM in gcc/config/ia64/ia64.h. */
-#define IA64_VRAP_REGNUM 329
+#define IA64_VRAP_REGNUM 329
/* Predicate registers: There are 64 of these 1-bit registers. We
define a single register which is used to communicate these values
to/from the target. We will somehow contrive to make it appear
that IA64_PR0_REGNUM thru IA64_PR63_REGNUM hold the actual values. */
-#define IA64_PR_REGNUM 330
+#define IA64_PR_REGNUM 330
/* Instruction pointer: 64 bits wide. */
-#define IA64_IP_REGNUM 331
+#define IA64_IP_REGNUM 331
/* Process Status Register. */
-#define IA64_PSR_REGNUM 332
+#define IA64_PSR_REGNUM 332
/* Current Frame Marker (raw form may be the cr.ifs). */
-#define IA64_CFM_REGNUM 333
+#define IA64_CFM_REGNUM 333
/* Application registers; 128 64-bit wide registers possible, but some
of them are reserved. */
-#define IA64_AR0_REGNUM 334
-#define IA64_KR0_REGNUM (IA64_AR0_REGNUM + 0)
-#define IA64_KR7_REGNUM (IA64_KR0_REGNUM + 7)
-
-#define IA64_RSC_REGNUM (IA64_AR0_REGNUM + 16)
-#define IA64_BSP_REGNUM (IA64_AR0_REGNUM + 17)
-#define IA64_BSPSTORE_REGNUM (IA64_AR0_REGNUM + 18)
-#define IA64_RNAT_REGNUM (IA64_AR0_REGNUM + 19)
-#define IA64_FCR_REGNUM (IA64_AR0_REGNUM + 21)
-#define IA64_EFLAG_REGNUM (IA64_AR0_REGNUM + 24)
-#define IA64_CSD_REGNUM (IA64_AR0_REGNUM + 25)
-#define IA64_SSD_REGNUM (IA64_AR0_REGNUM + 26)
-#define IA64_CFLG_REGNUM (IA64_AR0_REGNUM + 27)
-#define IA64_FSR_REGNUM (IA64_AR0_REGNUM + 28)
-#define IA64_FIR_REGNUM (IA64_AR0_REGNUM + 29)
-#define IA64_FDR_REGNUM (IA64_AR0_REGNUM + 30)
-#define IA64_CCV_REGNUM (IA64_AR0_REGNUM + 32)
-#define IA64_UNAT_REGNUM (IA64_AR0_REGNUM + 36)
-#define IA64_FPSR_REGNUM (IA64_AR0_REGNUM + 40)
-#define IA64_ITC_REGNUM (IA64_AR0_REGNUM + 44)
-#define IA64_PFS_REGNUM (IA64_AR0_REGNUM + 64)
-#define IA64_LC_REGNUM (IA64_AR0_REGNUM + 65)
-#define IA64_EC_REGNUM (IA64_AR0_REGNUM + 66)
+#define IA64_AR0_REGNUM 334
+#define IA64_KR0_REGNUM (IA64_AR0_REGNUM + 0)
+#define IA64_KR7_REGNUM (IA64_KR0_REGNUM + 7)
+
+#define IA64_RSC_REGNUM (IA64_AR0_REGNUM + 16)
+#define IA64_BSP_REGNUM (IA64_AR0_REGNUM + 17)
+#define IA64_BSPSTORE_REGNUM (IA64_AR0_REGNUM + 18)
+#define IA64_RNAT_REGNUM (IA64_AR0_REGNUM + 19)
+#define IA64_FCR_REGNUM (IA64_AR0_REGNUM + 21)
+#define IA64_EFLAG_REGNUM (IA64_AR0_REGNUM + 24)
+#define IA64_CSD_REGNUM (IA64_AR0_REGNUM + 25)
+#define IA64_SSD_REGNUM (IA64_AR0_REGNUM + 26)
+#define IA64_CFLG_REGNUM (IA64_AR0_REGNUM + 27)
+#define IA64_FSR_REGNUM (IA64_AR0_REGNUM + 28)
+#define IA64_FIR_REGNUM (IA64_AR0_REGNUM + 29)
+#define IA64_FDR_REGNUM (IA64_AR0_REGNUM + 30)
+#define IA64_CCV_REGNUM (IA64_AR0_REGNUM + 32)
+#define IA64_UNAT_REGNUM (IA64_AR0_REGNUM + 36)
+#define IA64_FPSR_REGNUM (IA64_AR0_REGNUM + 40)
+#define IA64_ITC_REGNUM (IA64_AR0_REGNUM + 44)
+#define IA64_PFS_REGNUM (IA64_AR0_REGNUM + 64)
+#define IA64_LC_REGNUM (IA64_AR0_REGNUM + 65)
+#define IA64_EC_REGNUM (IA64_AR0_REGNUM + 66)
/* NAT (Not A Thing) Bits for the general registers; there are 128 of
these. */
-#define IA64_NAT0_REGNUM 462
+#define IA64_NAT0_REGNUM 462
/* Process registers when a condition is caught. */
struct ia64_all_regs
@@ -295,14 +296,14 @@ term_raw_write (const char *str, unsigned int len)
unsigned short status;
struct _iosb iosb;
- status = sys$qiow (EFN$C_ENF, /* Event flag. */
- term_chan, /* I/O channel. */
- IO$_WRITEVBLK, /* I/O function code. */
- &iosb, /* I/O status block. */
- 0, /* Ast service routine. */
- 0, /* Ast parameter. */
- (char *)str, /* P1 - buffer address. */
- len, /* P2 - buffer length. */
+ status = sys$qiow (EFN$C_ENF, /* Event flag. */
+ term_chan, /* I/O channel. */
+ IO$_WRITEVBLK, /* I/O function code. */
+ &iosb, /* I/O status block. */
+ 0, /* Ast service routine. */
+ 0, /* Ast parameter. */
+ (char *) str, /* P1 - buffer address. */
+ len, /* P2 - buffer length. */
0, 0, 0, 0);
if (status & STS$M_SUCCESS)
@@ -384,8 +385,8 @@ term_fao (const char *str, unsigned int str_len, ...)
int i;
__int64 *args;
int status;
- struct dsc$descriptor_s dstr =
- { str_len, DSC$K_DTYPE_T, DSC$K_CLASS_S, (__char_ptr32)str };
+ struct dsc$descriptor_s dstr
+ = { str_len, DSC$K_DTYPE_T, DSC$K_CLASS_S, (__char_ptr32) str };
char buf[128];
$DESCRIPTOR (buf_desc, buf);
@@ -407,7 +408,7 @@ term_fao (const char *str, unsigned int str_len, ...)
term_flush ();
}
}
-
+
va_end (vargs);
}
@@ -426,7 +427,7 @@ term_putnl (void)
static void
term_init (void)
{
- unsigned int status,i;
+ unsigned int status, i;
unsigned short len;
char resstring[LNM$C_NAMLENGTH];
static const $DESCRIPTOR (tabdesc, "LNM$FILE_DEV");
@@ -442,11 +443,11 @@ term_init (void)
item_lst[1].ile3$w_code = 0;
/* Translate the logical name. */
- status = SYS$TRNLNM (0, /* Attr of the logical name. */
+ status = SYS$TRNLNM (0, /* Attr of the logical name. */
(void *) &tabdesc, /* Logical name table. */
(void *) &logdesc, /* Logical name. */
- 0, /* Access mode. */
- item_lst); /* Item list. */
+ 0, /* Access mode. */
+ item_lst); /* Item list. */
if (!(status & STS$M_SUCCESS))
LIB$SIGNAL (status);
@@ -460,9 +461,9 @@ term_init (void)
}
/* Assign a channel. */
- status = sys$assign (&term_desc, /* Device name. */
- &term_chan, /* I/O channel. */
- 0, /* Access mode. */
+ status = sys$assign (&term_desc, /* Device name. */
+ &term_chan, /* I/O channel. */
+ 0, /* Access mode. */
0);
if (!(status & STS$M_SUCCESS))
LIB$SIGNAL (status);
@@ -508,7 +509,7 @@ sock_init (void)
/* Initialize socket characteristics. */
listen_sockchar.prot = TCPIP$C_TCP;
listen_sockchar.type = TCPIP$C_STREAM;
- listen_sockchar.af = TCPIP$C_AF_INET;
+ listen_sockchar.af = TCPIP$C_AF_INET;
/* Assign I/O channels to network device. */
status = sys$assign ((void *) &inet_device, &listen_channel, 0, 0);
@@ -521,13 +522,13 @@ sock_init (void)
}
/* Create a listen socket. */
- status = sys$qiow (EFN$C_ENF, /* Event flag. */
- listen_channel, /* I/O channel. */
- IO$_SETMODE, /* I/O function code. */
- &iosb, /* I/O status block. */
- 0, /* Ast service routine. */
- 0, /* Ast parameter. */
- &listen_sockchar, /* P1 - socket characteristics. */
+ status = sys$qiow (EFN$C_ENF, /* Event flag. */
+ listen_channel, /* I/O channel. */
+ IO$_SETMODE, /* I/O function code. */
+ &iosb, /* I/O status block. */
+ 0, /* Ast service routine. */
+ 0, /* Ast parameter. */
+ &listen_sockchar, /* P1 - socket characteristics. */
0, 0, 0, 0, 0);
if (status & STS$M_SUCCESS)
status = iosb.iosb$w_status;
@@ -539,25 +540,25 @@ sock_init (void)
/* Set reuse address option. */
/* Initialize reuseaddr's item-list element. */
- reuseaddr_itemlst.ile2$w_length = sizeof (optval);
- reuseaddr_itemlst.ile2$w_code = TCPIP$C_REUSEADDR;
+ reuseaddr_itemlst.ile2$w_length = sizeof (optval);
+ reuseaddr_itemlst.ile2$w_code = TCPIP$C_REUSEADDR;
reuseaddr_itemlst.ile2$ps_bufaddr = &optval;
/* Initialize setsockopt's item-list descriptor. */
- sockopt_itemlst.ile2$w_length = sizeof (reuseaddr_itemlst);
- sockopt_itemlst.ile2$w_code = TCPIP$C_SOCKOPT;
+ sockopt_itemlst.ile2$w_length = sizeof (reuseaddr_itemlst);
+ sockopt_itemlst.ile2$w_code = TCPIP$C_SOCKOPT;
sockopt_itemlst.ile2$ps_bufaddr = &reuseaddr_itemlst;
- status = sys$qiow (EFN$C_ENF, /* Event flag. */
- listen_channel, /* I/O channel. */
- IO$_SETMODE, /* I/O function code. */
- &iosb, /* I/O status block. */
- 0, /* Ast service routine. */
- 0, /* Ast parameter. */
- 0, /* P1. */
- 0, /* P2. */
- 0, /* P3. */
- 0, /* P4. */
+ status = sys$qiow (EFN$C_ENF, /* Event flag. */
+ listen_channel, /* I/O channel. */
+ IO$_SETMODE, /* I/O function code. */
+ &iosb, /* I/O status block. */
+ 0, /* Ast service routine. */
+ 0, /* Ast parameter. */
+ 0, /* P1. */
+ 0, /* P2. */
+ 0, /* P3. */
+ 0, /* P4. */
(__int64) &sockopt_itemlst, /* P5 - socket options. */
0);
if (status & STS$M_SUCCESS)
@@ -576,18 +577,18 @@ sock_init (void)
serv_addr.sin_addr.s_addr = TCPIP$C_INADDR_ANY;
/* Initialize server's item-list descriptor. */
- serv_itemlst.ile2$w_length = sizeof (serv_addr);
- serv_itemlst.ile2$w_code = TCPIP$C_SOCK_NAME;
+ serv_itemlst.ile2$w_length = sizeof (serv_addr);
+ serv_itemlst.ile2$w_code = TCPIP$C_SOCK_NAME;
serv_itemlst.ile2$ps_bufaddr = &serv_addr;
- status = sys$qiow (EFN$C_ENF, /* Event flag. */
- listen_channel, /* I/O channel. */
- IO$_SETMODE, /* I/O function code. */
- &iosb, /* I/O status block. */
- 0, /* Ast service routine. */
- 0, /* Ast parameter. */
- 0, /* P1. */
- 0, /* P2. */
+ status = sys$qiow (EFN$C_ENF, /* Event flag. */
+ listen_channel, /* I/O channel. */
+ IO$_SETMODE, /* I/O function code. */
+ &iosb, /* I/O status block. */
+ 0, /* Ast service routine. */
+ 0, /* Ast parameter. */
+ 0, /* P1. */
+ 0, /* P2. */
(__int64) &serv_itemlst, /* P3 - local socket name. */
0, 0, 0);
if (status & STS$M_SUCCESS)
@@ -599,16 +600,16 @@ sock_init (void)
}
/* Set socket as a listen socket. */
- status = sys$qiow (EFN$C_ENF, /* Event flag. */
- listen_channel, /* I/O channel. */
- IO$_SETMODE, /* I/O function code. */
- &iosb, /* I/O status block. */
- 0, /* Ast service routine. */
- 0, /* Ast parameter. */
- 0, /* P1. */
- 0, /* P2. */
- 0, /* P3. */
- 1, /* P4 - connection backlog. */
+ status = sys$qiow (EFN$C_ENF, /* Event flag. */
+ listen_channel, /* I/O channel. */
+ IO$_SETMODE, /* I/O function code. */
+ &iosb, /* I/O status block. */
+ 0, /* Ast service routine. */
+ 0, /* Ast parameter. */
+ 0, /* P1. */
+ 0, /* P2. */
+ 0, /* P3. */
+ 1, /* P4 - connection backlog. */
0, 0);
if (status & STS$M_SUCCESS)
status = iosb.iosb$w_status;
@@ -622,15 +623,15 @@ sock_init (void)
TERM_FAO ("Waiting for a client connection on port: !ZW!/",
wordswap (serv_addr.sin_port));
- status = sys$qiow (EFN$C_ENF, /* Event flag. */
- listen_channel, /* I/O channel. */
- IO$_ACCESS|IO$M_ACCEPT, /* I/O function code. */
- &iosb, /* I/O status block. */
- 0, /* Ast service routine. */
- 0, /* Ast parameter. */
- 0, /* P1. */
- 0, /* P2. */
- 0, /* P3. */
+ status = sys$qiow (EFN$C_ENF, /* Event flag. */
+ listen_channel, /* I/O channel. */
+ IO$_ACCESS | IO$M_ACCEPT, /* I/O function code. */
+ &iosb, /* I/O status block. */
+ 0, /* Ast service routine. */
+ 0, /* Ast parameter. */
+ 0, /* P1. */
+ 0, /* P2. */
+ 0, /* P3. */
(__int64) &conn_channel, /* P4 - I/O channel for conn. */
0, 0);
@@ -647,17 +648,17 @@ sock_init (void)
cli_itemlst.ile3$w_code = TCPIP$C_SOCK_NAME;
cli_itemlst.ile3$ps_bufaddr = &cli_addr;
cli_itemlst.ile3$ps_retlen_addr = &cli_addrlen;
- ots$fill (&cli_addr, sizeof(cli_addr), 0);
- status = sys$qiow (EFN$C_ENF, /* Event flag. */
- conn_channel, /* I/O channel. */
- IO$_SENSEMODE, /* I/O function code. */
- &iosb, /* I/O status block. */
- 0, /* Ast service routine. */
- 0, /* Ast parameter. */
- 0, /* P1. */
- 0, /* P2. */
- 0, /* P3. */
- (__int64) &cli_itemlst, /* P4 - peer socket name. */
+ ots$fill (&cli_addr, sizeof (cli_addr), 0);
+ status = sys$qiow (EFN$C_ENF, /* Event flag. */
+ conn_channel, /* I/O channel. */
+ IO$_SENSEMODE, /* I/O function code. */
+ &iosb, /* I/O status block. */
+ 0, /* Ast service routine. */
+ 0, /* Ast parameter. */
+ 0, /* P1. */
+ 0, /* P2. */
+ 0, /* P3. */
+ (__int64) &cli_itemlst, /* P4 - peer socket name. */
0, 0);
if (status & STS$M_SUCCESS)
status = iosb.iosb$w_status;
@@ -684,12 +685,12 @@ sock_close (void)
unsigned int status;
/* Close socket. */
- status = sys$qiow (EFN$C_ENF, /* Event flag. */
- conn_channel, /* I/O channel. */
- IO$_DEACCESS, /* I/O function code. */
- &iosb, /* I/O status block. */
- 0, /* Ast service routine. */
- 0, /* Ast parameter. */
+ status = sys$qiow (EFN$C_ENF, /* Event flag. */
+ conn_channel, /* I/O channel. */
+ IO$_DEACCESS, /* I/O function code. */
+ &iosb, /* I/O status block. */
+ 0, /* Ast service routine. */
+ 0, /* Ast parameter. */
0, 0, 0, 0, 0, 0);
if (status & STS$M_SUCCESS)
@@ -720,8 +721,8 @@ page_set_rw (unsigned __int64 startva, unsigned __int64 len,
unsigned __int64 retva;
unsigned __int64 retlen;
- status = SYS$SETPRT_64 ((void *)startva, len, PSL$C_USER, PRT$C_UW,
- (void *)&retva, &retlen, oldprot);
+ status = SYS$SETPRT_64 ((void *) startva, len, PSL$C_USER, PRT$C_UW,
+ (void *) &retva, &retlen, oldprot);
return status;
}
@@ -729,15 +730,15 @@ page_set_rw (unsigned __int64 startva, unsigned __int64 len,
static void
page_restore_rw (unsigned __int64 startva, unsigned __int64 len,
- unsigned int prot)
+ unsigned int prot)
{
unsigned int status;
unsigned __int64 retva;
unsigned __int64 retlen;
unsigned int oldprot;
- status = SYS$SETPRT_64 ((void *)startva, len, PSL$C_USER, prot,
- (void *)&retva, &retlen, &oldprot);
+ status = SYS$SETPRT_64 ((void *) startva, len, PSL$C_USER, prot,
+ (void *) &retva, &retlen, &oldprot);
if (!(status & STS$M_SUCCESS))
LIB$SIGNAL (status);
}
@@ -747,7 +748,7 @@ page_restore_rw (unsigned __int64 startva, unsigned __int64 len,
static pthread_t
get_teb (void)
{
- return (pthread_t)__getReg (_IA64_REG_TP);
+ return (pthread_t) __getReg (_IA64_REG_TP);
}
/* Enable thread scheduling if VAL is true. */
@@ -768,8 +769,8 @@ set_thread_scheduling (int val)
status = dbgext_func (&blk);
if (!(status & STS$M_SUCCESS))
{
- TERM_FAO ("set_thread_scheduling error, val=!SL, status=!XL!/",
- val, blk.dbgext$l_status);
+ TERM_FAO ("set_thread_scheduling error, val=!SL, status=!XL!/", val,
+ blk.dbgext$l_status);
lib$signal (status);
}
@@ -802,10 +803,8 @@ thread_next (unsigned int thr)
/* Pthread Debug callbacks. */
static int
-read_callback (pthreadDebugClient_t context,
- pthreadDebugTargetAddr_t addr,
- pthreadDebugAddr_t buf,
- size_t size)
+read_callback (pthreadDebugClient_t context, pthreadDebugTargetAddr_t addr,
+ pthreadDebugAddr_t buf, size_t size)
{
if (trace_pthreaddbg)
TERM_FAO ("read_callback (!XH, !XH, !SL)!/", addr, buf, size);
@@ -814,10 +813,8 @@ read_callback (pthreadDebugClient_t context,
}
static int
-write_callback (pthreadDebugClient_t context,
- pthreadDebugTargetAddr_t addr,
- pthreadDebugLongConstAddr_t buf,
- size_t size)
+write_callback (pthreadDebugClient_t context, pthreadDebugTargetAddr_t addr,
+ pthreadDebugLongConstAddr_t buf, size_t size)
{
if (trace_pthreaddbg)
TERM_FAO ("write_callback (!XH, !XH, !SL)!/", addr, buf, size);
@@ -840,8 +837,7 @@ resume_callback (pthreadDebugClient_t context)
}
static int
-kthdinfo_callback (pthreadDebugClient_t context,
- pthreadDebugKId_t kid,
+kthdinfo_callback (pthreadDebugClient_t context, pthreadDebugKId_t kid,
pthreadDebugKThreadInfo_p thread_info)
{
if (trace_pthreaddbg)
@@ -850,8 +846,7 @@ kthdinfo_callback (pthreadDebugClient_t context,
}
static int
-hold_callback (pthreadDebugClient_t context,
- pthreadDebugKId_t kid)
+hold_callback (pthreadDebugClient_t context, pthreadDebugKId_t kid)
{
if (trace_pthreaddbg)
term_puts ("hold_callback");
@@ -859,8 +854,7 @@ hold_callback (pthreadDebugClient_t context,
}
static int
-unhold_callback (pthreadDebugClient_t context,
- pthreadDebugKId_t kid)
+unhold_callback (pthreadDebugClient_t context, pthreadDebugKId_t kid)
{
if (trace_pthreaddbg)
term_puts ("unhold_callback");
@@ -868,8 +862,7 @@ unhold_callback (pthreadDebugClient_t context,
}
static int
-getfreg_callback (pthreadDebugClient_t context,
- pthreadDebugFregs_t *reg,
+getfreg_callback (pthreadDebugClient_t context, pthreadDebugFregs_t *reg,
pthreadDebugKId_t kid)
{
if (trace_pthreaddbg)
@@ -878,8 +871,7 @@ getfreg_callback (pthreadDebugClient_t context,
}
static int
-setfreg_callback (pthreadDebugClient_t context,
- const pthreadDebugFregs_t *reg,
+setfreg_callback (pthreadDebugClient_t context, const pthreadDebugFregs_t *reg,
pthreadDebugKId_t kid)
{
if (trace_pthreaddbg)
@@ -888,8 +880,7 @@ setfreg_callback (pthreadDebugClient_t context,
}
static int
-getreg_callback (pthreadDebugClient_t context,
- pthreadDebugRegs_t *reg,
+getreg_callback (pthreadDebugClient_t context, pthreadDebugRegs_t *reg,
pthreadDebugKId_t kid)
{
if (trace_pthreaddbg)
@@ -898,8 +889,7 @@ getreg_callback (pthreadDebugClient_t context,
}
static int
-setreg_callback (pthreadDebugClient_t context,
- const pthreadDebugRegs_t *reg,
+setreg_callback (pthreadDebugClient_t context, const pthreadDebugRegs_t *reg,
pthreadDebugKId_t kid)
{
if (trace_pthreaddbg)
@@ -908,8 +898,7 @@ setreg_callback (pthreadDebugClient_t context,
}
static int
-output_callback (pthreadDebugClient_t context,
- pthreadDebugConstString_t line)
+output_callback (pthreadDebugClient_t context, pthreadDebugConstString_t line)
{
term_puts (line);
term_putnl ();
@@ -917,8 +906,7 @@ output_callback (pthreadDebugClient_t context,
}
static int
-error_callback (pthreadDebugClient_t context,
- pthreadDebugConstString_t line)
+error_callback (pthreadDebugClient_t context, pthreadDebugConstString_t line)
{
term_puts (line);
term_putnl ();
@@ -938,8 +926,8 @@ malloc_callback (pthreadDebugClient_t caller_context, size_t size)
LIB$SIGNAL (status);
if (trace_pthreaddbg)
TERM_FAO ("malloc_callback (!UL) -> !XA!/", size, res);
- *(unsigned int *)res = len;
- return (char *)res + 16;
+ *(unsigned int *) res = len;
+ return (char *) res + 16;
}
static void
@@ -949,8 +937,8 @@ free_callback (pthreadDebugClient_t caller_context, pthreadDebugAddr_t address)
unsigned int res;
int len;
- res = (unsigned int)address - 16;
- len = *(unsigned int *)res;
+ res = (unsigned int) address - 16;
+ len = *(unsigned int *) res;
if (trace_pthreaddbg)
TERM_FAO ("free_callback (!XA)!/", address);
status = lib$free_vm (&len, &res, 0);
@@ -966,25 +954,13 @@ speckthd_callback (pthreadDebugClient_t caller_context,
return ENOTSUP;
}
-static pthreadDebugCallbacks_t pthread_debug_callbacks = {
- PTHREAD_DEBUG_VERSION,
- read_callback,
- write_callback,
- suspend_callback,
- resume_callback,
- kthdinfo_callback,
- hold_callback,
- unhold_callback,
- getfreg_callback,
- setfreg_callback,
- getreg_callback,
- setreg_callback,
- output_callback,
- error_callback,
- malloc_callback,
- free_callback,
- speckthd_callback
-};
+static pthreadDebugCallbacks_t pthread_debug_callbacks
+ = { PTHREAD_DEBUG_VERSION, read_callback, write_callback,
+ suspend_callback, resume_callback, kthdinfo_callback,
+ hold_callback, unhold_callback, getfreg_callback,
+ setfreg_callback, getreg_callback, setreg_callback,
+ output_callback, error_callback, malloc_callback,
+ free_callback, speckthd_callback };
/* Name of the pthread shared library. */
static const $DESCRIPTOR (pthread_rtl_desc, "PTHREAD$RTL");
@@ -997,18 +973,20 @@ struct pthread_debug_entry
__void_ptr32 func;
};
-#define DEBUG_ENTRY(str) { sizeof(str) - 1, str, 0 }
-
-static struct pthread_debug_entry pthread_debug_entries[] = {
- DEBUG_ENTRY("pthreadDebugContextInit"),
- DEBUG_ENTRY("pthreadDebugThdSeqInit"),
- DEBUG_ENTRY("pthreadDebugThdSeqNext"),
- DEBUG_ENTRY("pthreadDebugThdSeqDestroy"),
- DEBUG_ENTRY("pthreadDebugThdGetInfo"),
- DEBUG_ENTRY("pthreadDebugThdGetInfoAddr"),
- DEBUG_ENTRY("pthreadDebugThdGetReg"),
- DEBUG_ENTRY("pthreadDebugCmd")
-};
+#define DEBUG_ENTRY(str) \
+ { \
+ sizeof (str) - 1, str, 0 \
+ }
+
+static struct pthread_debug_entry pthread_debug_entries[]
+ = { DEBUG_ENTRY ("pthreadDebugContextInit"),
+ DEBUG_ENTRY ("pthreadDebugThdSeqInit"),
+ DEBUG_ENTRY ("pthreadDebugThdSeqNext"),
+ DEBUG_ENTRY ("pthreadDebugThdSeqDestroy"),
+ DEBUG_ENTRY ("pthreadDebugThdGetInfo"),
+ DEBUG_ENTRY ("pthreadDebugThdGetInfoAddr"),
+ DEBUG_ENTRY ("pthreadDebugThdGetReg"),
+ DEBUG_ENTRY ("pthreadDebugCmd") };
/* Pthread debug context. */
static pthreadDebugContext_t debug_context;
@@ -1018,53 +996,47 @@ static pthreadDebugContext_t debug_context;
static int
pthread_debug_thd_seq_init (pthreadDebugId_t *id)
{
- return ((int (*)())pthread_debug_entries[1].func)
- (debug_context, id);
+ return ((int (*) ()) pthread_debug_entries[1].func) (debug_context, id);
}
static int
pthread_debug_thd_seq_next (pthreadDebugId_t *id)
{
- return ((int (*)())pthread_debug_entries[2].func)
- (debug_context, id);
+ return ((int (*) ()) pthread_debug_entries[2].func) (debug_context, id);
}
static int
pthread_debug_thd_seq_destroy (void)
{
- return ((int (*)())pthread_debug_entries[3].func)
- (debug_context);
+ return ((int (*) ()) pthread_debug_entries[3].func) (debug_context);
}
static int
pthread_debug_thd_get_info (pthreadDebugId_t id,
pthreadDebugThreadInfo_t *info)
{
- return ((int (*)())pthread_debug_entries[4].func)
- (debug_context, id, info);
+ return ((int (*) ()) pthread_debug_entries[4].func) (debug_context, id,
+ info);
}
static int
-pthread_debug_thd_get_info_addr (pthread_t thr,
- pthreadDebugThreadInfo_t *info)
+pthread_debug_thd_get_info_addr (pthread_t thr, pthreadDebugThreadInfo_t *info)
{
- return ((int (*)())pthread_debug_entries[5].func)
- (debug_context, thr, info);
+ return ((int (*) ()) pthread_debug_entries[5].func) (debug_context, thr,
+ info);
}
static int
-pthread_debug_thd_get_reg (pthreadDebugId_t thr,
- pthreadDebugRegs_t *regs)
+pthread_debug_thd_get_reg (pthreadDebugId_t thr, pthreadDebugRegs_t *regs)
{
- return ((int (*)())pthread_debug_entries[6].func)
- (debug_context, thr, regs);
+ return ((int (*) ()) pthread_debug_entries[6].func) (debug_context, thr,
+ regs);
}
static int
stub_pthread_debug_cmd (const char *cmd)
{
- return ((int (*)())pthread_debug_entries[7].func)
- (debug_context, cmd);
+ return ((int (*) ()) pthread_debug_entries[7].func) (debug_context, cmd);
}
/* Show all the threads. */
@@ -1109,15 +1081,14 @@ threads_init (void)
int i;
void *caller_context = 0;
- status = lib$find_image_symbol
- ((void *) &pthread_rtl_desc, (void *) &dbgext_desc,
- (int *) &dbgext_func);
+ status = lib$find_image_symbol ((void *) &pthread_rtl_desc,
+ (void *) &dbgext_desc, (int *) &dbgext_func);
if (!(status & STS$M_SUCCESS))
LIB$SIGNAL (status);
-
- status = lib$find_image_symbol
- ((void *) &pthread_rtl_desc, (void *) &dbgsymtable_desc,
- (int *) &dbg_symtable);
+
+ status = lib$find_image_symbol ((void *) &pthread_rtl_desc,
+ (void *) &dbgsymtable_desc,
+ (int *) &dbg_symtable);
if (!(status & STS$M_SUCCESS))
LIB$SIGNAL (status);
@@ -1126,21 +1097,20 @@ threads_init (void)
i < sizeof (pthread_debug_entries) / sizeof (pthread_debug_entries[0]);
i++)
{
- struct dsc$descriptor_s sym =
- { pthread_debug_entries[i].namelen,
- DSC$K_DTYPE_T, DSC$K_CLASS_S,
- pthread_debug_entries[i].name };
- status = lib$find_image_symbol
- ((void *) &pthread_debug_desc, (void *) &sym,
- (int *) &pthread_debug_entries[i].func);
+ struct dsc$descriptor_s sym
+ = { pthread_debug_entries[i].namelen, DSC$K_DTYPE_T, DSC$K_CLASS_S,
+ pthread_debug_entries[i].name };
+ status
+ = lib$find_image_symbol ((void *) &pthread_debug_desc, (void *) &sym,
+ (int *) &pthread_debug_entries[i].func);
if (!(status & STS$M_SUCCESS))
lib$signal (status);
}
if (trace_pthreaddbg)
TERM_FAO ("debug symtable: !XH!/", dbg_symtable);
- status = ((int (*)()) pthread_debug_entries[0].func)
- (&caller_context, &pthread_debug_callbacks, dbg_symtable, &debug_context);
+ status = ((int (*) ()) pthread_debug_entries[0].func) (
+ &caller_context, &pthread_debug_callbacks, dbg_symtable, &debug_context);
if (status != 0)
TERM_FAO ("cannot initialize pthread_debug: !UL!/", status);
TERM_FAO ("pthread debug done!/", 0);
@@ -1341,16 +1311,18 @@ handle_q_packet (const unsigned char *pkt, unsigned int pktlen)
return;
}
else if (pktlen > XFER_UIB_LEN
- && ots$strcmp_eql (pkt, XFER_UIB_LEN, xfer_uib, XFER_UIB_LEN))
+ && ots$strcmp_eql (pkt, XFER_UIB_LEN, xfer_uib, XFER_UIB_LEN))
{
/* Get unwind information block. */
unsigned __int64 pc;
unsigned int pos = XFER_UIB_LEN;
unsigned int off;
unsigned int len;
+
union
{
unsigned char bytes[32];
+
struct
{
unsigned __int64 code_start_va;
@@ -1359,6 +1331,7 @@ handle_q_packet (const unsigned char *pkt, unsigned int pktlen)
unsigned __int64 gp_value;
} data;
} uei;
+
int res;
int i;
@@ -1392,8 +1365,8 @@ handle_q_packet (const unsigned char *pkt, unsigned int pktlen)
mem2bin (uei.bytes, sizeof (uei.bytes));
}
else if (pktlen == QFTHREADINFO_LEN
- && ots$strcmp_eql (pkt, QFTHREADINFO_LEN,
- qfthreadinfo, QFTHREADINFO_LEN))
+ && ots$strcmp_eql (pkt, QFTHREADINFO_LEN, qfthreadinfo,
+ QFTHREADINFO_LEN))
{
/* Get first thread(s). */
gdb_buf[0] = '$';
@@ -1410,8 +1383,8 @@ handle_q_packet (const unsigned char *pkt, unsigned int pktlen)
long2pkt (first_thread);
}
else if (pktlen == QSTHREADINFO_LEN
- && ots$strcmp_eql (pkt, QSTHREADINFO_LEN,
- qsthreadinfo, QSTHREADINFO_LEN))
+ && ots$strcmp_eql (pkt, QSTHREADINFO_LEN, qsthreadinfo,
+ QSTHREADINFO_LEN))
{
/* Get subsequent threads. */
gdb_buf[0] = '$';
@@ -1435,8 +1408,8 @@ handle_q_packet (const unsigned char *pkt, unsigned int pktlen)
gdb_buf[1] = 'l';
}
else if (pktlen > QTHREADEXTRAINFO_LEN
- && ots$strcmp_eql (pkt, QTHREADEXTRAINFO_LEN,
- qthreadextrainfo, QTHREADEXTRAINFO_LEN))
+ && ots$strcmp_eql (pkt, QTHREADEXTRAINFO_LEN, qthreadextrainfo,
+ QTHREADEXTRAINFO_LEN))
{
/* Get extra info about a thread. */
pthread_t thr;
@@ -1459,18 +1432,17 @@ handle_q_packet (const unsigned char *pkt, unsigned int pktlen)
}
gdb_buf[0] = '$';
gdb_blen = 1;
- mem2hex ((const unsigned char *)"VMS-thread", 11);
+ mem2hex ((const unsigned char *) "VMS-thread", 11);
}
else if (pktlen > QSUPPORTED_LEN
- && ots$strcmp_eql (pkt, QSUPPORTED_LEN,
- qsupported, QSUPPORTED_LEN))
+ && ots$strcmp_eql (pkt, QSUPPORTED_LEN, qsupported, QSUPPORTED_LEN))
{
/* Get supported features. */
pthread_t thr;
unsigned int pos = QSUPPORTED_LEN;
pthreadDebugThreadInfo_t info;
int res;
-
+
/* Ignore gdb features. */
gdb_buf[0] = '$';
gdb_blen = 1;
@@ -1483,7 +1455,7 @@ handle_q_packet (const unsigned char *pkt, unsigned int pktlen)
if (trace_pkt)
{
term_puts ("unknown <: ");
- term_write ((char *)pkt, pktlen);
+ term_write ((char *) pkt, pktlen);
term_putnl ();
}
return;
@@ -1512,7 +1484,7 @@ handle_v_packet (const unsigned char *pkt, unsigned int pktlen)
if (trace_pkt)
{
term_puts ("unknown <: ");
- term_write ((char *)pkt, pktlen);
+ term_write ((char *) pkt, pktlen);
term_putnl ();
}
return 0;
@@ -1601,7 +1573,7 @@ handle_packet (unsigned char *pkt, unsigned int len)
if (len == 1)
{
/* Clear psr.ss. */
- excp_regs.psr.v &= ~(unsigned __int64)PSR$M_SS;
+ excp_regs.psr.v &= ~(unsigned __int64) PSR$M_SS;
return 1;
}
else
@@ -1626,7 +1598,7 @@ handle_packet (unsigned char *pkt, unsigned int len)
int res;
unsigned __int64 val;
pthreadDebugThreadInfo_t info;
-
+
pos++;
val = pkt2val (pkt, &pos);
if (pos != len)
@@ -1715,7 +1687,7 @@ handle_packet (unsigned char *pkt, unsigned int len)
/* Transfer. */
for (i = 0; i < l; i++)
- byte2hex (gdb_buf + 1 + 2 * i, ((unsigned char *)addr)[i]);
+ byte2hex (gdb_buf + 1 + 2 * i, ((unsigned char *) addr)[i]);
gdb_blen += 2 * l;
}
break;
@@ -1764,7 +1736,7 @@ handle_packet (unsigned char *pkt, unsigned int len)
{
int v = hex2byte (pkt + pos);
pos += 2;
- ((unsigned char *)addr)[i] = v;
+ ((unsigned char *) addr)[i] = v;
}
/* Sync caches. */
@@ -1826,7 +1798,7 @@ handle_packet (unsigned char *pkt, unsigned int len)
if (len == 1)
{
/* Set psr.ss. */
- excp_regs.psr.v |= (unsigned __int64)PSR$M_SS;
+ excp_regs.psr.v |= (unsigned __int64) PSR$M_SS;
return 1;
}
else
@@ -1844,7 +1816,7 @@ handle_packet (unsigned char *pkt, unsigned int len)
int res;
unsigned __int64 val;
unsigned int fthr, thr;
-
+
val = pkt2val (pkt, &pos);
/* Default is error (but only after parsing is complete). */
packet_error (0);
@@ -1878,7 +1850,7 @@ handle_packet (unsigned char *pkt, unsigned int len)
if (has_threads)
{
pkt[len] = 0;
- stub_pthread_debug_cmd ((char *)pkt + 4);
+ stub_pthread_debug_cmd ((char *) pkt + 4);
packet_ok ();
}
else
@@ -1889,7 +1861,7 @@ handle_packet (unsigned char *pkt, unsigned int len)
if (trace_pkt)
{
term_puts ("unknown <: ");
- term_write ((char *)pkt, len);
+ term_write ((char *) pkt, len);
term_putnl ();
}
break;
@@ -1906,14 +1878,14 @@ sock_write (const unsigned char *buf, int len)
unsigned int status;
/* Write data to connection. */
- status = sys$qiow (EFN$C_ENF, /* Event flag. */
- conn_channel, /* I/O channel. */
- IO$_WRITEVBLK, /* I/O function code. */
- &iosb, /* I/O status block. */
- 0, /* Ast service routine. */
- 0, /* Ast parameter. */
- (char *)buf, /* P1 - buffer address. */
- len, /* P2 - buffer length. */
+ status = sys$qiow (EFN$C_ENF, /* Event flag. */
+ conn_channel, /* I/O channel. */
+ IO$_WRITEVBLK, /* I/O function code. */
+ &iosb, /* I/O status block. */
+ 0, /* Ast service routine. */
+ 0, /* Ast parameter. */
+ (char *) buf, /* P1 - buffer address. */
+ len, /* P2 - buffer length. */
0, 0, 0, 0);
if (status & STS$M_SUCCESS)
status = iosb.iosb$w_status;
@@ -1943,7 +1915,7 @@ send_pkt (void)
if (trace_pkt > 1)
{
term_puts (">: ");
- term_write ((char *)gdb_buf, gdb_blen + 3);
+ term_write ((char *) gdb_buf, gdb_blen + 3);
term_putnl ();
}
}
@@ -1968,26 +1940,26 @@ one_command (void)
while (1)
{
/* Read data from connection. */
- status = sys$qiow (EFN$C_ENF, /* Event flag. */
- conn_channel, /* I/O channel. */
- IO$_READVBLK, /* I/O function code. */
- &iosb, /* I/O status block. */
- 0, /* Ast service routine. */
- 0, /* Ast parameter. */
- gdb_buf + off, /* P1 - buffer address. */
+ status = sys$qiow (EFN$C_ENF, /* Event flag. */
+ conn_channel, /* I/O channel. */
+ IO$_READVBLK, /* I/O function code. */
+ &iosb, /* I/O status block. */
+ 0, /* Ast service routine. */
+ 0, /* Ast parameter. */
+ gdb_buf + off, /* P1 - buffer address. */
sizeof (gdb_buf) - off, /* P2 - buffer leng. */
0, 0, 0, 0);
if (status & STS$M_SUCCESS)
status = iosb.iosb$w_status;
if (!(status & STS$M_SUCCESS))
{
- term_puts ("Failed to read data from connection\n" );
+ term_puts ("Failed to read data from connection\n");
LIB$SIGNAL (status);
}
#ifdef RAW_DUMP
term_puts ("{: ");
- term_write ((char *)gdb_buf + off, iosb.iosb$w_bcnt);
+ term_write ((char *) gdb_buf + off, iosb.iosb$w_bcnt);
term_putnl ();
#endif
@@ -2006,8 +1978,7 @@ one_command (void)
continue;
}
/* Search for '#'. */
- for (sharp_off = dollar_off + 1;
- sharp_off < gdb_blen;
+ for (sharp_off = dollar_off + 1; sharp_off < gdb_blen;
sharp_off++)
if (gdb_buf[sharp_off] == '#')
break;
@@ -2048,7 +2019,7 @@ one_command (void)
}
else
{
- sock_write ((const unsigned char *)"+", 1);
+ sock_write ((const unsigned char *) "+", 1);
break;
}
}
@@ -2057,14 +2028,15 @@ one_command (void)
if (trace_pkt > 1)
{
term_puts ("<: ");
- term_write ((char *)gdb_buf + dollar_off, sharp_off - dollar_off + 1);
+ term_write ((char *) gdb_buf + dollar_off, sharp_off - dollar_off + 1);
term_putnl ();
}
cmd_off = dollar_off + 1;
cmd_len = sharp_off - dollar_off - 1;
- if (handle_packet (gdb_buf + dollar_off + 1, sharp_off - dollar_off - 1) == 1)
+ if (handle_packet (gdb_buf + dollar_off + 1, sharp_off - dollar_off - 1)
+ == 1)
return 1;
send_pkt ();
@@ -2087,8 +2059,8 @@ display_excp (struct chf64$signal_array *sig64, struct chf$mech_array *mech)
{
char msg2[160];
unsigned short msg2len;
- struct dsc$descriptor_s msg2_desc =
- { sizeof (msg2), DSC$K_DTYPE_T, DSC$K_CLASS_S, msg2};
+ struct dsc$descriptor_s msg2_desc
+ = { sizeof (msg2), DSC$K_DTYPE_T, DSC$K_CLASS_S, msg2 };
msg_desc.dsc$w_length = msglen;
status = SYS$FAOL_64 (&msg_desc, &msg2len, &msg2_desc,
&sig64->chf64$q_sig_arg1);
@@ -2101,9 +2073,8 @@ display_excp (struct chf64$signal_array *sig64, struct chf$mech_array *mech)
if (trace_excp > 1)
{
- TERM_FAO (" Frame: !XH, Depth: !4SL, Esf: !XH!/",
- mech->chf$q_mch_frame, mech->chf$q_mch_depth,
- mech->chf$q_mch_esf_addr);
+ TERM_FAO (" Frame: !XH, Depth: !4SL, Esf: !XH!/", mech->chf$q_mch_frame,
+ mech->chf$q_mch_depth, mech->chf$q_mch_esf_addr);
}
}
@@ -2112,10 +2083,9 @@ display_excp (struct chf64$signal_array *sig64, struct chf$mech_array *mech)
static void
read_all_registers (struct chf$mech_array *mech)
{
- struct _intstk *intstk =
- (struct _intstk *)mech->chf$q_mch_esf_addr;
- struct chf64$signal_array *sig64 =
- (struct chf64$signal_array *)mech->chf$ph_mch_sig64_addr;
+ struct _intstk *intstk = (struct _intstk *) mech->chf$q_mch_esf_addr;
+ struct chf64$signal_array *sig64
+ = (struct chf64$signal_array *) mech->chf$ph_mch_sig64_addr;
unsigned int cnt = sig64->chf64$w_sig_arg_count;
unsigned __int64 pc = (&sig64->chf64$q_sig_name)[cnt - 2];
@@ -2144,7 +2114,7 @@ read_all_registers (struct chf$mech_array *mech)
excp_regs.gr[9].v = intstk->intstk$q_r9;
excp_regs.gr[10].v = intstk->intstk$q_r10;
excp_regs.gr[11].v = intstk->intstk$q_r11;
- excp_regs.gr[12].v = (unsigned __int64)intstk + intstk->intstk$l_stkalign;
+ excp_regs.gr[12].v = (unsigned __int64) intstk + intstk->intstk$l_stkalign;
excp_regs.gr[13].v = intstk->intstk$q_r13;
excp_regs.gr[14].v = intstk->intstk$q_r14;
excp_regs.gr[15].v = intstk->intstk$q_r15;
@@ -2179,8 +2149,7 @@ read_all_registers (struct chf$mech_array *mech)
static void
write_all_registers (struct chf$mech_array *mech)
{
- struct _intstk *intstk =
- (struct _intstk *)mech->chf$q_mch_esf_addr;
+ struct _intstk *intstk = (struct _intstk *) mech->chf$q_mch_esf_addr;
intstk->intstk$q_ipsr = excp_regs.psr.v;
}
@@ -2190,8 +2159,7 @@ write_all_registers (struct chf$mech_array *mech)
static void
do_debug (struct chf$mech_array *mech)
{
- struct _intstk *intstk =
- (struct _intstk *)mech->chf$q_mch_esf_addr;
+ struct _intstk *intstk = (struct _intstk *) mech->chf$q_mch_esf_addr;
unsigned int old_ast;
unsigned int old_sch;
unsigned int status;
@@ -2239,11 +2207,10 @@ do_debug (struct chf$mech_array *mech)
/* The condition handler. That's the core of the stub. */
static int
-excp_handler (struct chf$signal_array *sig,
- struct chf$mech_array *mech)
+excp_handler (struct chf$signal_array *sig, struct chf$mech_array *mech)
{
- struct chf64$signal_array *sig64 =
- (struct chf64$signal_array *)mech->chf$ph_mch_sig64_addr;
+ struct chf64$signal_array *sig64
+ = (struct chf64$signal_array *) mech->chf$ph_mch_sig64_addr;
unsigned int code = sig->chf$l_sig_name & STS$M_COND_ID;
unsigned int cnt = sig64->chf64$w_sig_arg_count;
unsigned __int64 pc;
@@ -2254,7 +2221,7 @@ excp_handler (struct chf$signal_array *sig,
/* Completely ignore some conditions (signaled indirectly by this stub). */
switch (code)
{
- case LIB$_KEYNOTFOU & STS$M_COND_ID:
+ case LIB$_KEYNOTFOU &STS$M_COND_ID:
return SS$_RESIGNAL_64;
default:
break;
@@ -2275,9 +2242,7 @@ excp_handler (struct chf$signal_array *sig,
TERM_FAO ("excp_handler: code: !XL, pc=!XH!/", code, pc);
/* If break on the entry point, restore the bundle. */
- if (code == (SS$_BREAK & STS$M_COND_ID)
- && pc == entry_pc
- && entry_pc != 0)
+ if (code == (SS$_BREAK & STS$M_COND_ID) && pc == entry_pc && entry_pc != 0)
{
static unsigned int entry_prot;
@@ -2285,32 +2250,31 @@ excp_handler (struct chf$signal_array *sig,
term_puts ("initial entry breakpoint\n");
page_set_rw (entry_pc, 16, &entry_prot);
- ots$move ((void *)entry_pc, 16, entry_saved);
+ ots$move ((void *) entry_pc, 16, entry_saved);
__fc (entry_pc);
page_restore_rw (entry_pc, 16, entry_prot);
}
switch (code)
{
- case SS$_ACCVIO & STS$M_COND_ID:
+ case SS$_ACCVIO &STS$M_COND_ID:
if (trace_excp <= 1)
display_excp (sig64, mech);
/* Fall through. */
- case SS$_BREAK & STS$M_COND_ID:
- case SS$_OPCDEC & STS$M_COND_ID:
- case SS$_TBIT & STS$M_COND_ID:
- case SS$_DEBUG & STS$M_COND_ID:
+ case SS$_BREAK &STS$M_COND_ID:
+ case SS$_OPCDEC &STS$M_COND_ID:
+ case SS$_TBIT &STS$M_COND_ID:
+ case SS$_DEBUG &STS$M_COND_ID:
if (trace_excp > 1)
{
int i;
- struct _intstk *intstk =
- (struct _intstk *)mech->chf$q_mch_esf_addr;
+ struct _intstk *intstk = (struct _intstk *) mech->chf$q_mch_esf_addr;
display_excp (sig64, mech);
TERM_FAO (" intstk: !XH!/", intstk);
for (i = 0; i < cnt + 1; i++)
- TERM_FAO (" !XH!/", ((unsigned __int64 *)sig64)[i]);
+ TERM_FAO (" !XH!/", ((unsigned __int64 *) sig64)[i]);
}
do_debug (mech);
ret = SS$_CONTINUE_64;
@@ -2349,11 +2313,11 @@ trace_init (void)
item_lst[1].ile3$w_code = 0;
/* Translate the logical name. */
- status = SYS$TRNLNM (0, /* Attributes of the logical name. */
- (void *)&tabdesc, /* Logical name table. */
- (void *)&logdesc, /* Logical name. */
- 0, /* Access mode. */
- &item_lst); /* Item list. */
+ status = SYS$TRNLNM (0, /* Attributes of the logical name. */
+ (void *) &tabdesc, /* Logical name table. */
+ (void *) &logdesc, /* Logical name. */
+ 0, /* Access mode. */
+ &item_lst); /* Item list. */
if (status == SS$_NOLOGNAM)
return;
if (!(status & STS$M_SUCCESS))
@@ -2371,8 +2335,9 @@ trace_init (void)
sub_desc.dsc$w_length = i - start;
for (j = 0; j < NBR_DEBUG_FLAGS; j++)
- if (str$case_blind_compare (&sub_desc,
- (void *)&debug_flags[j].name) == 0)
+ if (str$case_blind_compare (&sub_desc,
+ (void *) &debug_flags[j].name)
+ == 0)
{
debug_flags[j].val++;
break;
@@ -2391,13 +2356,11 @@ trace_init (void)
term_putnl ();
}
-
/* Entry point. */
static int
-stub_start (unsigned __int64 *progxfer, void *cli_util,
- EIHD *imghdr, IFD *imgfile,
- unsigned int linkflag, unsigned int cliflag)
+stub_start (unsigned __int64 *progxfer, void *cli_util, EIHD *imghdr,
+ IFD *imgfile, unsigned int linkflag, unsigned int cliflag)
{
static int initialized;
int i;
@@ -2423,8 +2386,8 @@ stub_start (unsigned __int64 *progxfer, void *cli_util,
if (trace_entry && !is_attached)
{
- TERM_FAO ("xfer: !XH, imghdr: !XH, ifd: !XH!/",
- progxfer, imghdr, imgfile);
+ TERM_FAO ("xfer: !XH, imghdr: !XH, ifd: !XH!/", progxfer, imghdr,
+ imgfile);
for (i = -2; i < 8; i++)
TERM_FAO (" at !2SW: !XH!/", i, progxfer[i]);
}
@@ -2444,15 +2407,14 @@ stub_start (unsigned __int64 *progxfer, void *cli_util,
return 0;
}
else
- TERM_FAO ("Entry: !XH!/",entry_pc);
+ TERM_FAO ("Entry: !XH!/", entry_pc);
}
}
else
entry_pc = progxfer[0];
has_threads = 0;
- for (imcb = ctl$gl_imglstptr->imcb$l_flink;
- imcb != ctl$gl_imglstptr;
+ for (imcb = ctl$gl_imglstptr->imcb$l_flink; imcb != ctl$gl_imglstptr;
imcb = imcb->imcb$l_flink)
{
if (ots$strcmp_eql (pthread_rtl_desc.dsc$a_pointer,
@@ -2460,15 +2422,14 @@ stub_start (unsigned __int64 *progxfer, void *cli_util,
imcb->imcb$t_log_image_name + 1,
imcb->imcb$t_log_image_name[0]))
has_threads = 1;
-
+
if (trace_images)
{
unsigned int j;
LDRIMG *ldrimg = imcb->imcb$l_ldrimg;
LDRISD *ldrisd;
- TERM_FAO ("!XA-!XA ",
- imcb->imcb$l_starting_address,
+ TERM_FAO ("!XA-!XA ", imcb->imcb$l_starting_address,
imcb->imcb$l_end_address);
switch (imcb->imcb$b_act_code)
@@ -2485,8 +2446,7 @@ stub_start (unsigned __int64 *progxfer, void *cli_util,
default:
term_puts ("????");
}
- TERM_FAO (" !AD !40AC!/",
- 1, "KESU" + (imcb->imcb$b_access_mode & 3),
+ TERM_FAO (" !AD !40AC!/", 1, "KESU" + (imcb->imcb$b_access_mode & 3),
imcb->imcb$t_log_image_name);
if ((long) ldrimg < 0 || trace_images < 2)
@@ -2502,17 +2462,15 @@ stub_start (unsigned __int64 *progxfer, void *cli_util,
term_puts (flags & 0x01000000 ? " Prot" : " ");
term_puts (flags & 0x04000000 ? " Shrt" : " ");
term_puts (flags & 0x08000000 ? " Shrd" : " ");
- TERM_FAO (" !XA-!XA!/",
- ldrisd[j].ldrisd$p_base,
- (unsigned __int64) ldrisd[j].ldrisd$p_base
- + ldrisd[j].ldrisd$i_len - 1);
+ TERM_FAO (" !XA-!XA!/", ldrisd[j].ldrisd$p_base,
+ (unsigned __int64) ldrisd[j].ldrisd$p_base
+ + ldrisd[j].ldrisd$i_len - 1);
}
ldrisd = ldrimg->ldrimg$l_dyn_seg;
if (ldrisd)
- TERM_FAO (" dynamic !XA-!XA!/",
- ldrisd->ldrisd$p_base,
- (unsigned __int64) ldrisd->ldrisd$p_base
- + ldrisd->ldrisd$i_len - 1);
+ TERM_FAO (" dynamic !XA-!XA!/", ldrisd->ldrisd$p_base,
+ (unsigned __int64) ldrisd->ldrisd$p_base
+ + ldrisd->ldrisd$i_len - 1);
}
}
@@ -2543,13 +2501,12 @@ stub_start (unsigned __int64 *progxfer, void *cli_util,
00 00 00 02 00 00 nop.i 0x0
00 00 04 00 nop.i 0x0;;
*/
- static const unsigned char initbp[16] =
- { 0x01, 0x08, 0x00, 0x40, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x02, 0x00, 0x00,
- 0x00, 0x00, 0x04, 0x00 };
+ static const unsigned char initbp[16]
+ = { 0x01, 0x08, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00 };
unsigned int entry_prot;
unsigned int status;
-
+
status = page_set_rw (entry_pc, 16, &entry_prot);
if (!(status & STS$M_SUCCESS))
@@ -2564,11 +2521,11 @@ stub_start (unsigned __int64 *progxfer, void *cli_util,
else
LIB$SIGNAL (status);
}
-
+
if (entry_pc != 0)
{
- ots$move (entry_saved, 16, (void *)entry_pc);
- ots$move ((void *)entry_pc, 16, (void *)initbp);
+ ots$move (entry_saved, 16, (void *) entry_pc);
+ ots$move ((void *) entry_pc, 16, (void *) initbp);
__fc (entry_pc);
page_restore_rw (entry_pc, 16, entry_prot);
}
@@ -2597,5 +2554,5 @@ struct xfer_vector
#pragma __extern_model save
#pragma __extern_model strict_refdef "XFER_PSECT"
-struct xfer_vector xfer_vector = {0, 0, stub_start};
+struct xfer_vector xfer_vector = { 0, 0, stub_start };
#pragma __extern_model restore
diff --git a/gdb/stubs/m32r-stub.c b/gdb/stubs/m32r-stub.c
index e52188edc71..bbe05abc241 100644
--- a/gdb/stubs/m32r-stub.c
+++ b/gdb/stubs/m32r-stub.c
@@ -91,14 +91,13 @@
*
****************************************************************************/
-
/************************************************************************
*
* external low-level support routines
*/
-extern void putDebugChar (); /* write a single character */
-extern int getDebugChar (); /* read and return a single char */
-extern void exceptionHandler (); /* assign an exception handler */
+extern void putDebugChar (); /* write a single character */
+extern int getDebugChar (); /* read and return a single char */
+extern void exceptionHandler (); /* assign an exception handler */
/*****************************************************************************
* BUFMAX defines the maximum number of characters in inbound/outbound buffers
@@ -106,7 +105,7 @@ extern void exceptionHandler (); /* assign an exception handler */
*/
#define BUFMAX 400
-static char initialized; /* boolean flag. != 0 means we've been initialized */
+static char initialized; /* boolean flag. != 0 means we've been initialized */
int remote_debug;
/* debug > 0 prints ill-formed commands in valid packets & checksum errors */
@@ -117,10 +116,33 @@ static const unsigned char hexchars[] = "0123456789abcdef";
/* Number of bytes of registers. */
#define NUMREGBYTES (NUMREGS * 4)
+
enum regnames
-{ R0, R1, R2, R3, R4, R5, R6, R7,
- R8, R9, R10, R11, R12, R13, R14, R15,
- PSW, CBR, SPI, SPU, BPC, PC, ACCL, ACCH
+{
+ R0,
+ R1,
+ R2,
+ R3,
+ R4,
+ R5,
+ R6,
+ R7,
+ R8,
+ R9,
+ R10,
+ R11,
+ R12,
+ R13,
+ R14,
+ R15,
+ PSW,
+ CBR,
+ SPI,
+ SPU,
+ BPC,
+ PC,
+ ACCL,
+ ACCH
};
enum SYS_calls
@@ -158,7 +180,7 @@ static unsigned char remcomOutBuffer[BUFMAX];
static int remcomStack[STACKSIZE / sizeof (int)];
static int *stackPtr = &remcomStack[STACKSIZE / sizeof (int) - 1];
-static unsigned int save_vectors[18]; /* previous exception vectors */
+static unsigned int save_vectors[18]; /* previous exception vectors */
/* Indicate to caller of mem2hex or hex2mem that there has been an error. */
static volatile int mem_err = 0;
@@ -168,7 +190,7 @@ static volatile int mem_err = 0;
int gdb_m32r_vector = -1;
#if 0
-#include "syscall.h" /* for SYS_exit, SYS_write etc. */
+#include "syscall.h" /* for SYS_exit, SYS_write etc. */
#endif
/* Global entry points:
@@ -215,7 +237,7 @@ handle_exception (int exceptionVector)
int binary;
if (!finish_from_step ())
- return; /* "false step": let the target continue */
+ return; /* "false step": let the target continue */
gdb_m32r_vector = exceptionVector;
@@ -232,30 +254,30 @@ handle_exception (int exceptionVector)
ptr = remcomOutBuffer;
- *ptr++ = 'T'; /* notify gdb with signo, PC, FP and SP */
+ *ptr++ = 'T'; /* notify gdb with signo, PC, FP and SP */
*ptr++ = hexchars[sigval >> 4];
*ptr++ = hexchars[sigval & 0xf];
*ptr++ = hexchars[PC >> 4];
*ptr++ = hexchars[PC & 0xf];
*ptr++ = ':';
- ptr = mem2hex ((unsigned char *) &registers[PC], ptr, 4, 0); /* PC */
+ ptr = mem2hex ((unsigned char *) &registers[PC], ptr, 4, 0); /* PC */
*ptr++ = ';';
*ptr++ = hexchars[R13 >> 4];
*ptr++ = hexchars[R13 & 0xf];
*ptr++ = ':';
- ptr = mem2hex ((unsigned char *) &registers[R13], ptr, 4, 0); /* FP */
+ ptr = mem2hex ((unsigned char *) &registers[R13], ptr, 4, 0); /* FP */
*ptr++ = ';';
*ptr++ = hexchars[R15 >> 4];
*ptr++ = hexchars[R15 & 0xf];
*ptr++ = ':';
- ptr = mem2hex ((unsigned char *) &registers[R15], ptr, 4, 0); /* SP */
+ ptr = mem2hex ((unsigned char *) &registers[R15], ptr, 4, 0); /* SP */
*ptr++ = ';';
*ptr++ = 0;
- if (exceptionVector == 0) /* simulated SYS call stuff */
+ if (exceptionVector == 0) /* simulated SYS call stuff */
{
mem2hex ((unsigned char *) &registers[PC], buf, 4, 0);
switch (registers[R0])
@@ -279,11 +301,11 @@ handle_exception (int exceptionVector)
gdb_error ("Target attempts SYS_read call at %s\n", buf);
break;
case SYS_write:
- if (registers[R1] == 1 || /* write to stdout */
- registers[R1] == 2) /* write to stderr */
- { /* (we can do that) */
- registers[R0] =
- gdb_write ((void *) registers[R2], registers[R3]);
+ if (registers[R1] == 1 || /* write to stdout */
+ registers[R1] == 2) /* write to stderr */
+ { /* (we can do that) */
+ registers[R0]
+ = gdb_write ((void *) registers[R2], registers[R3]);
return;
}
else
@@ -321,7 +343,7 @@ handle_exception (int exceptionVector)
binary = 0;
switch (*ptr++)
{
- default: /* Unknown code. Return an empty reply message. */
+ default: /* Unknown code. Return an empty reply message. */
break;
case 'R':
if (hexToInt (&ptr, &addr))
@@ -331,9 +353,9 @@ handle_exception (int exceptionVector)
case '!':
strcpy (remcomOutBuffer, "OK");
break;
- case 'X': /* XAA..AA,LLLL:<binary data>#cs */
+ case 'X': /* XAA..AA,LLLL:<binary data>#cs */
binary = 1;
- case 'M': /* MAA..AA,LLLL: Write LLLL bytes at address AA.AA return OK */
+ case 'M': /* MAA..AA,LLLL: Write LLLL bytes at address AA.AA return OK */
/* TRY TO READ '%x,%x:'. IF SUCCEED, SET PTR = 0 */
{
if (hexToInt (&ptr, &addr))
@@ -363,7 +385,7 @@ handle_exception (int exceptionVector)
}
}
break;
- case 'm': /* mAA..AA,LLLL Read LLLL bytes at address AA..AA */
+ case 'm': /* mAA..AA,LLLL Read LLLL bytes at address AA..AA */
/* TRY TO READ %x,%x. IF SUCCEED, SET PTR = 0 */
if (hexToInt (&ptr, &addr))
if (*(ptr++) == ',')
@@ -371,8 +393,7 @@ handle_exception (int exceptionVector)
{
ptr = 0;
mem_err = 0;
- mem2hex ((unsigned char *) addr, remcomOutBuffer, length,
- 1);
+ mem2hex ((unsigned char *) addr, remcomOutBuffer, length, 1);
if (mem_err)
{
strcpy (remcomOutBuffer, "E03");
@@ -391,13 +412,13 @@ handle_exception (int exceptionVector)
remcomOutBuffer[3] = 0;
break;
case 'd':
- remote_debug = !(remote_debug); /* toggle debug flag */
+ remote_debug = !(remote_debug); /* toggle debug flag */
break;
- case 'g': /* return the value of the CPU registers */
+ case 'g': /* return the value of the CPU registers */
mem2hex ((unsigned char *) registers, remcomOutBuffer, NUMREGBYTES,
0);
break;
- case 'P': /* set the value of a single CPU register - return OK */
+ case 'P': /* set the value of a single CPU register - return OK */
{
int regno;
@@ -412,28 +433,30 @@ handle_exception (int exceptionVector)
* make sure to keep the several stack pointers consistant.
*/
stackmode = registers[PSW] & 0x80;
- if (regno == R15) /* stack pointer changed */
- { /* need to change SPI or SPU */
+ if (regno == R15) /* stack pointer changed */
+ { /* need to change SPI or SPU */
if (stackmode == 0)
registers[SPI] = registers[R15];
else
registers[SPU] = registers[R15];
}
- else if (regno == SPU) /* "user" stack pointer changed */
+ else if (regno == SPU) /* "user" stack pointer changed */
{
- if (stackmode != 0) /* stack in user mode: copy SP */
+ if (stackmode != 0) /* stack in user mode: copy SP */
registers[R15] = registers[SPU];
}
- else if (regno == SPI) /* "interrupt" stack pointer changed */
+ else if (regno
+ == SPI) /* "interrupt" stack pointer changed */
{
- if (stackmode == 0) /* stack in interrupt mode: copy SP */
+ if (stackmode
+ == 0) /* stack in interrupt mode: copy SP */
registers[R15] = registers[SPI];
}
- else if (regno == PSW) /* stack mode may have changed! */
- { /* force SP to either SPU or SPI */
- if (stackmode == 0) /* stack in user mode */
+ else if (regno == PSW) /* stack mode may have changed! */
+ { /* force SP to either SPU or SPI */
+ if (stackmode == 0) /* stack in user mode */
registers[R15] = registers[SPI];
- else /* stack in interrupt mode */
+ else /* stack in interrupt mode */
registers[R15] = registers[SPU];
}
strcpy (remcomOutBuffer, "OK");
@@ -442,53 +465,51 @@ handle_exception (int exceptionVector)
strcpy (remcomOutBuffer, "E01");
break;
}
- case 'G': /* set the value of the CPU registers - return OK */
+ case 'G': /* set the value of the CPU registers - return OK */
hex2mem (ptr, (unsigned char *) registers, NUMREGBYTES, 0);
strcpy (remcomOutBuffer, "OK");
break;
- case 's': /* sAA..AA Step one instruction from AA..AA(optional) */
+ case 's': /* sAA..AA Step one instruction from AA..AA(optional) */
stepping = 1;
- case 'c': /* cAA..AA Continue from address AA..AA(optional) */
+ case 'c': /* cAA..AA Continue from address AA..AA(optional) */
/* try to read optional parameter, pc unchanged if no parm */
if (hexToInt (&ptr, &addr))
registers[PC] = addr;
- if (stepping) /* single-stepping */
+ if (stepping) /* single-stepping */
{
- if (!prepare_to_step (0)) /* set up for single-step */
+ if (!prepare_to_step (0)) /* set up for single-step */
{
/* prepare_to_step has already emulated the target insn:
Send SIGTRAP to gdb, don't resume the target at all. */
ptr = remcomOutBuffer;
- *ptr++ = 'T'; /* Simulate stopping with SIGTRAP */
+ *ptr++ = 'T'; /* Simulate stopping with SIGTRAP */
*ptr++ = '0';
*ptr++ = '5';
- *ptr++ = hexchars[PC >> 4]; /* send PC */
+ *ptr++ = hexchars[PC >> 4]; /* send PC */
*ptr++ = hexchars[PC & 0xf];
*ptr++ = ':';
ptr = mem2hex ((unsigned char *) &registers[PC], ptr, 4, 0);
*ptr++ = ';';
- *ptr++ = hexchars[R13 >> 4]; /* send FP */
+ *ptr++ = hexchars[R13 >> 4]; /* send FP */
*ptr++ = hexchars[R13 & 0xf];
*ptr++ = ':';
- ptr =
- mem2hex ((unsigned char *) &registers[R13], ptr, 4, 0);
+ ptr = mem2hex ((unsigned char *) &registers[R13], ptr, 4, 0);
*ptr++ = ';';
- *ptr++ = hexchars[R15 >> 4]; /* send SP */
+ *ptr++ = hexchars[R15 >> 4]; /* send SP */
*ptr++ = hexchars[R15 & 0xf];
*ptr++ = ':';
- ptr =
- mem2hex ((unsigned char *) &registers[R15], ptr, 4, 0);
+ ptr = mem2hex ((unsigned char *) &registers[R15], ptr, 4, 0);
*ptr++ = ';';
*ptr++ = 0;
break;
}
}
- else /* continuing, not single-stepping */
+ else /* continuing, not single-stepping */
{
/* OK, about to do a "continue". First check to see if the
target pc is on an odd boundary (second instruction in the
@@ -500,7 +521,7 @@ handle_exception (int exceptionVector)
return;
- case 'D': /* Detach */
+ case 'D': /* Detach */
#if 0
/* I am interpreting this to mean, release the board from control
by the remote stub. To do this, I am restoring the original
@@ -515,25 +536,24 @@ handle_exception (int exceptionVector)
break;
#endif
case 'q':
- if (*ptr++ == 'C' &&
- *ptr++ == 'R' && *ptr++ == 'C' && *ptr++ == ':')
+ if (*ptr++ == 'C' && *ptr++ == 'R' && *ptr++ == 'C' && *ptr++ == ':')
{
unsigned long start, len, our_crc;
- if (hexToInt (&ptr, (int *) &start) &&
- *ptr++ == ',' && hexToInt (&ptr, (int *) &len))
+ if (hexToInt (&ptr, (int *) &start) && *ptr++ == ','
+ && hexToInt (&ptr, (int *) &len))
{
remcomOutBuffer[0] = 'C';
our_crc = crc32 ((unsigned char *) start, len, 0xffffffff);
- mem2hex ((char *) &our_crc,
- &remcomOutBuffer[1], sizeof (long), 0);
- } /* else do nothing */
- } /* else do nothing */
+ mem2hex ((char *) &our_crc, &remcomOutBuffer[1],
+ sizeof (long), 0);
+ } /* else do nothing */
+ } /* else do nothing */
break;
- case 'k': /* kill the program */
+ case 'k': /* kill the program */
continue;
- } /* switch */
+ } /* switch */
/* reply to the request */
putpacket (remcomOutBuffer);
@@ -637,11 +657,11 @@ getpacket (void)
gdb_error ("sent count = %s\n", buf);
gdb_error (" -- Bad buffer: \"%s\"\n", buffer);
}
- putDebugChar ('-'); /* failed checksum */
+ putDebugChar ('-'); /* failed checksum */
}
else
{
- putDebugChar ('+'); /* successful transfer */
+ putDebugChar ('+'); /* successful transfer */
/* if a sequence char is present, reply the sequence ID */
if (buffer[2] == ':')
@@ -705,19 +725,19 @@ set_mem_err (void)
static int
mem_safe (unsigned char *addr)
{
-#define BAD_RANGE_ONE_START ((unsigned char *) 0x600000)
-#define BAD_RANGE_ONE_END ((unsigned char *) 0xa00000)
-#define BAD_RANGE_TWO_START ((unsigned char *) 0xff680000)
-#define BAD_RANGE_TWO_END ((unsigned char *) 0xff800000)
+#define BAD_RANGE_ONE_START ((unsigned char *) 0x600000)
+#define BAD_RANGE_ONE_END ((unsigned char *) 0xa00000)
+#define BAD_RANGE_TWO_START ((unsigned char *) 0xff680000)
+#define BAD_RANGE_TWO_END ((unsigned char *) 0xff800000)
if (addr < BAD_RANGE_ONE_START)
- return 1; /* safe */
+ return 1; /* safe */
if (addr < BAD_RANGE_ONE_END)
- return 0; /* unsafe */
+ return 0; /* unsafe */
if (addr < BAD_RANGE_TWO_START)
- return 1; /* safe */
+ return 1; /* safe */
if (addr < BAD_RANGE_TWO_END)
- return 0; /* unsafe */
+ return 0; /* unsafe */
}
/* These are separate functions so that they are so short and sweet
@@ -822,9 +842,9 @@ bin2mem (unsigned char *buf, unsigned char *mem, int count, int may_fault)
{
switch (*(buf + 1))
{
- case 0x3: /* # */
- case 0x4: /* $ */
- case 0x5d: /* escape char */
+ case 0x3: /* # */
+ case 0x4: /* $ */
+ case 0x5d: /* escape char */
buf++;
*buf |= 0x20;
break;
@@ -856,61 +876,61 @@ computeSignal (int exceptionVector)
{
case 0:
sigval = 23;
- break; /* I/O trap */
+ break; /* I/O trap */
case 1:
sigval = 5;
- break; /* breakpoint */
+ break; /* breakpoint */
case 2:
sigval = 5;
- break; /* breakpoint */
+ break; /* breakpoint */
case 3:
sigval = 5;
- break; /* breakpoint */
+ break; /* breakpoint */
case 4:
sigval = 5;
- break; /* breakpoint */
+ break; /* breakpoint */
case 5:
sigval = 5;
- break; /* breakpoint */
+ break; /* breakpoint */
case 6:
sigval = 5;
- break; /* breakpoint */
+ break; /* breakpoint */
case 7:
sigval = 5;
- break; /* breakpoint */
+ break; /* breakpoint */
case 8:
sigval = 5;
- break; /* breakpoint */
+ break; /* breakpoint */
case 9:
sigval = 5;
- break; /* breakpoint */
+ break; /* breakpoint */
case 10:
sigval = 5;
- break; /* breakpoint */
+ break; /* breakpoint */
case 11:
sigval = 5;
- break; /* breakpoint */
+ break; /* breakpoint */
case 12:
sigval = 5;
- break; /* breakpoint */
+ break; /* breakpoint */
case 13:
sigval = 5;
- break; /* breakpoint */
+ break; /* breakpoint */
case 14:
sigval = 5;
- break; /* breakpoint */
+ break; /* breakpoint */
case 15:
sigval = 5;
- break; /* breakpoint */
+ break; /* breakpoint */
case 16:
sigval = 10;
- break; /* BUS ERROR (alignment) */
+ break; /* BUS ERROR (alignment) */
case 17:
sigval = 2;
- break; /* INTerrupt */
+ break; /* INTerrupt */
default:
sigval = 7;
- break; /* "software generated" */
+ break; /* "software generated" */
}
return (sigval);
}
@@ -968,18 +988,18 @@ hexToInt (unsigned char **ptr, int *intValue)
static int
isShortBranch (unsigned char *instr)
{
- unsigned char instr0 = instr[0] & 0x7F; /* mask off high bit */
+ unsigned char instr0 = instr[0] & 0x7F; /* mask off high bit */
- if (instr0 == 0x10 && instr[1] == 0xB6) /* RTE */
- return 1; /* return from trap or exception */
+ if (instr0 == 0x10 && instr[1] == 0xB6) /* RTE */
+ return 1; /* return from trap or exception */
- if (instr0 == 0x1E || instr0 == 0x1F) /* JL or JMP */
+ if (instr0 == 0x1E || instr0 == 0x1F) /* JL or JMP */
if ((instr[1] & 0xF0) == 0xC0)
- return 2; /* jump thru a register */
+ return 2; /* jump thru a register */
- if (instr0 == 0x7C || instr0 == 0x7D || /* BC, BNC, BL, BRA */
+ if (instr0 == 0x7C || instr0 == 0x7D || /* BC, BNC, BL, BRA */
instr0 == 0x7E || instr0 == 0x7F)
- return 3; /* eight bit PC offset */
+ return 3; /* eight bit PC offset */
return 0;
}
@@ -987,18 +1007,18 @@ isShortBranch (unsigned char *instr)
static int
isLongBranch (unsigned char *instr)
{
- if (instr[0] == 0xFC || instr[0] == 0xFD || /* BRA, BNC, BL, BC */
- instr[0] == 0xFE || instr[0] == 0xFF) /* 24 bit relative */
+ if (instr[0] == 0xFC || instr[0] == 0xFD || /* BRA, BNC, BL, BC */
+ instr[0] == 0xFE || instr[0] == 0xFF) /* 24 bit relative */
return 4;
- if ((instr[0] & 0xF0) == 0xB0) /* 16 bit relative */
+ if ((instr[0] & 0xF0) == 0xB0) /* 16 bit relative */
{
- if ((instr[1] & 0xF0) == 0x00 || /* BNE, BEQ */
+ if ((instr[1] & 0xF0) == 0x00 || /* BNE, BEQ */
(instr[1] & 0xF0) == 0x10)
return 5;
- if (instr[0] == 0xB0) /* BNEZ, BLTZ, BLEZ, BGTZ, BGEZ, BEQZ */
- if ((instr[1] & 0xF0) == 0x80 || (instr[1] & 0xF0) == 0x90 ||
- (instr[1] & 0xF0) == 0xA0 || (instr[1] & 0xF0) == 0xB0 ||
- (instr[1] & 0xF0) == 0xC0 || (instr[1] & 0xF0) == 0xD0)
+ if (instr[0] == 0xB0) /* BNEZ, BLTZ, BLEZ, BGTZ, BGEZ, BEQZ */
+ if ((instr[1] & 0xF0) == 0x80 || (instr[1] & 0xF0) == 0x90
+ || (instr[1] & 0xF0) == 0xA0 || (instr[1] & 0xF0) == 0xB0
+ || (instr[1] & 0xF0) == 0xC0 || (instr[1] & 0xF0) == 0xD0)
return 6;
}
return 0;
@@ -1008,7 +1028,7 @@ isLongBranch (unsigned char *instr)
then it's a 2-byte instruction, else it's a 4-byte instruction. */
#define INSTRUCTION_SIZE(addr) \
- ((((int) addr & 2) || (((unsigned char *) addr)[0] & 0x80) == 0) ? 2 : 4)
+ ((((int) addr & 2) || (((unsigned char *) addr)[0] & 0x80) == 0) ? 2 : 4)
static int
isBranch (unsigned char *instr)
@@ -1025,54 +1045,54 @@ willBranch (unsigned char *instr, int branchCode)
switch (branchCode)
{
case 0:
- return 0; /* not a branch */
+ return 0; /* not a branch */
case 1:
- return 1; /* RTE */
+ return 1; /* RTE */
case 2:
- return 1; /* JL or JMP */
- case 3: /* BC, BNC, BL, BRA (short) */
- case 4: /* BC, BNC, BL, BRA (long) */
+ return 1; /* JL or JMP */
+ case 3: /* BC, BNC, BL, BRA (short) */
+ case 4: /* BC, BNC, BL, BRA (long) */
switch (instr[0] & 0x0F)
{
- case 0xC: /* Branch if Condition Register */
+ case 0xC: /* Branch if Condition Register */
return (registers[CBR] != 0);
- case 0xD: /* Branch if NOT Condition Register */
+ case 0xD: /* Branch if NOT Condition Register */
return (registers[CBR] == 0);
- case 0xE: /* Branch and Link */
- case 0xF: /* Branch (unconditional) */
+ case 0xE: /* Branch and Link */
+ case 0xF: /* Branch (unconditional) */
return 1;
- default: /* oops? */
+ default: /* oops? */
return 0;
}
- case 5: /* BNE, BEQ */
+ case 5: /* BNE, BEQ */
switch (instr[1] & 0xF0)
{
- case 0x00: /* Branch if r1 equal to r2 */
+ case 0x00: /* Branch if r1 equal to r2 */
return (registers[instr[0] & 0x0F] == registers[instr[1] & 0x0F]);
- case 0x10: /* Branch if r1 NOT equal to r2 */
+ case 0x10: /* Branch if r1 NOT equal to r2 */
return (registers[instr[0] & 0x0F] != registers[instr[1] & 0x0F]);
- default: /* oops? */
+ default: /* oops? */
return 0;
}
- case 6: /* BNEZ, BLTZ, BLEZ, BGTZ, BGEZ ,BEQZ */
+ case 6: /* BNEZ, BLTZ, BLEZ, BGTZ, BGEZ ,BEQZ */
switch (instr[1] & 0xF0)
{
- case 0x80: /* Branch if reg equal to zero */
+ case 0x80: /* Branch if reg equal to zero */
return (registers[instr[1] & 0x0F] == 0);
- case 0x90: /* Branch if reg NOT equal to zero */
+ case 0x90: /* Branch if reg NOT equal to zero */
return (registers[instr[1] & 0x0F] != 0);
- case 0xA0: /* Branch if reg less than zero */
+ case 0xA0: /* Branch if reg less than zero */
return (registers[instr[1] & 0x0F] < 0);
- case 0xB0: /* Branch if reg greater or equal to zero */
+ case 0xB0: /* Branch if reg greater or equal to zero */
return (registers[instr[1] & 0x0F] >= 0);
- case 0xC0: /* Branch if reg less than or equal to zero */
+ case 0xC0: /* Branch if reg less than or equal to zero */
return (registers[instr[1] & 0x0F] <= 0);
- case 0xD0: /* Branch if reg greater than zero */
+ case 0xD0: /* Branch if reg greater than zero */
return (registers[instr[1] & 0x0F] > 0);
- default: /* oops? */
+ default: /* oops? */
return 0;
}
- default: /* oops? */
+ default: /* oops? */
return 0;
}
}
@@ -1083,20 +1103,20 @@ branchDestination (unsigned char *instr, int branchCode)
switch (branchCode)
{
default:
- case 0: /* not a branch */
+ case 0: /* not a branch */
return 0;
- case 1: /* RTE */
- return registers[BPC] & ~3; /* pop BPC into PC */
- case 2: /* JL or JMP */
- return registers[instr[1] & 0x0F] & ~3; /* jump thru a register */
- case 3: /* BC, BNC, BL, BRA (short, 8-bit relative offset) */
+ case 1: /* RTE */
+ return registers[BPC] & ~3; /* pop BPC into PC */
+ case 2: /* JL or JMP */
+ return registers[instr[1] & 0x0F] & ~3; /* jump thru a register */
+ case 3: /* BC, BNC, BL, BRA (short, 8-bit relative offset) */
return (((int) instr) & ~3) + ((char) instr[1] << 2);
- case 4: /* BC, BNC, BL, BRA (long, 24-bit relative offset) */
- return ((int) instr +
- ((((char) instr[1] << 16) | (instr[2] << 8) | (instr[3])) <<
- 2));
- case 5: /* BNE, BEQ (16-bit relative offset) */
- case 6: /* BNEZ, BLTZ, BLEZ, BGTZ, BGEZ ,BEQZ (ditto) */
+ case 4: /* BC, BNC, BL, BRA (long, 24-bit relative offset) */
+ return ((int) instr
+ + ((((char) instr[1] << 16) | (instr[2] << 8) | (instr[3]))
+ << 2));
+ case 5: /* BNE, BEQ (16-bit relative offset) */
+ case 6: /* BNEZ, BLTZ, BLEZ, BGTZ, BGEZ ,BEQZ (ditto) */
return ((int) instr + ((((char) instr[2] << 8) | (instr[3])) << 2));
}
@@ -1115,31 +1135,31 @@ branchSideEffects (unsigned char *instr, int branchCode)
{
switch (branchCode)
{
- case 1: /* RTE */
- return; /* I <THINK> this is already handled... */
- case 2: /* JL (or JMP) */
- case 3: /* BL (or BC, BNC, BRA) */
+ case 1: /* RTE */
+ return; /* I <THINK> this is already handled... */
+ case 2: /* JL (or JMP) */
+ case 3: /* BL (or BC, BNC, BRA) */
case 4:
- if ((instr[0] & 0x0F) == 0x0E) /* branch/jump and link */
+ if ((instr[0] & 0x0F) == 0x0E) /* branch/jump and link */
registers[R14] = (registers[PC] & ~3) + 4;
return;
- default: /* any other branch has no side effects */
+ default: /* any other branch has no side effects */
return;
}
}
static struct STEPPING_CONTEXT
{
- int stepping; /* true when we've started a single-step */
- unsigned long target_addr; /* the instr we're trying to execute */
- unsigned long target_size; /* the size of the target instr */
- unsigned long noop_addr; /* where we've inserted a no-op, if any */
- unsigned long trap1_addr; /* the trap following the target instr */
- unsigned long trap2_addr; /* the trap at a branch destination, if any */
- unsigned short noop_save; /* instruction overwritten by our no-op */
- unsigned short trap1_save; /* instruction overwritten by trap1 */
- unsigned short trap2_save; /* instruction overwritten by trap2 */
- unsigned short continue_p; /* true if NOT returning to gdb after step */
+ int stepping; /* true when we've started a single-step */
+ unsigned long target_addr; /* the instr we're trying to execute */
+ unsigned long target_size; /* the size of the target instr */
+ unsigned long noop_addr; /* where we've inserted a no-op, if any */
+ unsigned long trap1_addr; /* the trap following the target instr */
+ unsigned long trap2_addr; /* the trap at a branch destination, if any */
+ unsigned short noop_save; /* instruction overwritten by our no-op */
+ unsigned short trap1_save; /* instruction overwritten by trap1 */
+ unsigned short trap2_save; /* instruction overwritten by trap2 */
+ unsigned short continue_p; /* true if NOT returning to gdb after step */
} stepping;
/* Function: prepare_to_step
@@ -1153,15 +1173,15 @@ static struct STEPPING_CONTEXT
in which case we simply report to GDB that the instruction
has already been executed. */
-#define TRAP1 0x10f1; /* trap #1 instruction */
-#define NOOP 0x7000; /* noop instruction */
+#define TRAP1 0x10f1; /* trap #1 instruction */
+#define NOOP 0x7000; /* noop instruction */
static unsigned short trap1 = TRAP1;
static unsigned short noop = NOOP;
static int
prepare_to_step (continue_p)
- int continue_p; /* if this isn't REALLY a single-step (see below) */
+int continue_p; /* if this isn't REALLY a single-step (see below) */
{
unsigned long pc = registers[PC];
int branchCode = isBranch ((unsigned char *) pc);
@@ -1173,16 +1193,16 @@ prepare_to_step (continue_p)
p < ((unsigned char *) &stepping) + sizeof (stepping); p++)
*p = 0;
- if (branchCode != 0) /* next instruction is a branch */
+ if (branchCode != 0) /* next instruction is a branch */
{
branchSideEffects ((unsigned char *) pc, branchCode);
if (willBranch ((unsigned char *) pc, branchCode))
registers[PC] = branchDestination ((unsigned char *) pc, branchCode);
else
registers[PC] = pc + INSTRUCTION_SIZE (pc);
- return 0; /* branch "executed" -- just notify GDB */
+ return 0; /* branch "executed" -- just notify GDB */
}
- else if (((int) pc & 2) != 0) /* "second-slot" instruction */
+ else if (((int) pc & 2) != 0) /* "second-slot" instruction */
{
/* insert no-op before pc */
stepping.noop_addr = pc - 2;
@@ -1193,7 +1213,7 @@ prepare_to_step (continue_p)
stepping.trap1_save = *(unsigned short *) stepping.trap1_addr;
*(unsigned short *) stepping.trap1_addr = trap1;
}
- else /* "first-slot" instruction */
+ else /* "first-slot" instruction */
{
/* insert trap after pc */
stepping.trap1_addr = pc + INSTRUCTION_SIZE (pc);
@@ -1205,7 +1225,7 @@ prepare_to_step (continue_p)
one single-step before continuing, because the PC is on a half-word
boundary. There's no way to simply resume at such an address. */
stepping.continue_p = continue_p;
- stepping.stepping = 1; /* starting a single-step */
+ stepping.stepping = 1; /* starting a single-step */
return 1;
}
@@ -1223,39 +1243,39 @@ prepare_to_step (continue_p)
static int
finish_from_step (void)
{
- if (stepping.stepping) /* anything to do? */
+ if (stepping.stepping) /* anything to do? */
{
int continue_p = stepping.continue_p;
unsigned char *p;
- if (stepping.noop_addr) /* replace instr "under" our no-op */
+ if (stepping.noop_addr) /* replace instr "under" our no-op */
*(unsigned short *) stepping.noop_addr = stepping.noop_save;
- if (stepping.trap1_addr) /* replace instr "under" our trap */
+ if (stepping.trap1_addr) /* replace instr "under" our trap */
*(unsigned short *) stepping.trap1_addr = stepping.trap1_save;
- if (stepping.trap2_addr) /* ditto our other trap, if any */
+ if (stepping.trap2_addr) /* ditto our other trap, if any */
*(unsigned short *) stepping.trap2_addr = stepping.trap2_save;
- for (p = (unsigned char *) &stepping; /* zero out the stepping context */
+ for (p = (unsigned char *) &stepping; /* zero out the stepping context */
p < ((unsigned char *) &stepping) + sizeof (stepping); p++)
*p = 0;
return !(continue_p);
}
- else /* we didn't single-step, therefore this must be a legitimate stop */
+ else /* we didn't single-step, therefore this must be a legitimate stop */
return 1;
}
struct PSWreg
-{ /* separate out the bit flags in the PSW register */
- int pad1:16;
- int bsm:1;
- int bie:1;
- int pad2:5;
- int bc:1;
- int sm:1;
- int ie:1;
- int pad3:5;
- int c:1;
+{ /* separate out the bit flags in the PSW register */
+ int pad1 : 16;
+ int bsm : 1;
+ int bie : 1;
+ int pad2 : 5;
+ int bc : 1;
+ int sm : 1;
+ int ie : 1;
+ int pad3 : 5;
+ int c : 1;
} *psw;
/* Upon entry the value for LR to save has been pushed.
@@ -1314,13 +1334,13 @@ stash_registers:\n\
static void
cleanup_stash (void)
{
- psw = (struct PSWreg *) &registers[PSW]; /* fields of PSW register */
- psw->sm = psw->bsm; /* fix up pre-trap values of psw fields */
+ psw = (struct PSWreg *) &registers[PSW]; /* fields of PSW register */
+ psw->sm = psw->bsm; /* fix up pre-trap values of psw fields */
psw->ie = psw->bie;
psw->c = psw->bc;
- registers[CBR] = psw->bc; /* fix up pre-trap "C" register */
+ registers[CBR] = psw->bc; /* fix up pre-trap "C" register */
-#if 0 /* FIXME: Was in previous version. Necessary?
+#if 0 /* FIXME: Was in previous version. Necessary?
(Remember that we use the "rte" insn to return from the
trap/interrupt so the values of bsm, bie, bc are important. */
psw->bsm = psw->bie = psw->bc = 0; /* zero post-trap values */
@@ -1328,10 +1348,10 @@ cleanup_stash (void)
/* FIXME: Copied from previous version. This can probably be deleted
since methinks stash_registers has already done this. */
- registers[PC] = registers[BPC]; /* pre-trap PC */
+ registers[PC] = registers[BPC]; /* pre-trap PC */
/* FIXME: Copied from previous version. Necessary? */
- if (psw->sm) /* copy R15 into (psw->sm ? SPU : SPI) */
+ if (psw->sm) /* copy R15 into (psw->sm ? SPU : SPI) */
registers[SPU] = registers[R15];
else
registers[SPI] = registers[R15];
@@ -1389,7 +1409,8 @@ process_exception (int num)
ld r15, @r1 ; setup local stack (protect user stack)\n\
mv r0, %0\n\
bl handle_exception\n\
- bl restore_and_return"::"r" (num):"r0", "r1");
+ bl restore_and_return" ::"r"(num)
+ : "r0", "r1");
}
void _catchException0 ();
@@ -1582,7 +1603,6 @@ _catchException17:\n\
ldi r0, #17\n\
bl process_exception");
-
/* this function is used to set up exception handlers for tracing and
breakpoints */
void
@@ -1591,8 +1611,8 @@ set_debug_traps (void)
/* extern void remcomHandler(); */
int i;
- for (i = 0; i < 18; i++) /* keep a copy of old vectors */
- if (save_vectors[i] == 0) /* only copy them the first time */
+ for (i = 0; i < 18; i++) /* keep a copy of old vectors */
+ if (save_vectors[i] == 0) /* only copy them the first time */
save_vectors[i] = getExceptionHandler (i);
stackPtr = &remcomStack[STACKSIZE / sizeof (int) - 1];
@@ -1673,8 +1693,8 @@ gdb_write (char *data, int len)
i = 0;
while (i < len)
{
- for (cpy = buf + 1;
- i < len && cpy < buf + sizeof (remcomOutBuffer) - 3; i++)
+ for (cpy = buf + 1; i < len && cpy < buf + sizeof (remcomOutBuffer) - 3;
+ i++)
{
*cpy++ = hexchars[data[i] >> 4];
*cpy++ = hexchars[data[i] & 0x0F];
@@ -1711,16 +1731,16 @@ gdb_error (char *format, char *parm)
if (format && *format)
len = strlen (format);
else
- return; /* empty input */
+ return; /* empty input */
if (parm && *parm)
len += strlen (parm);
for (cpy = buf; *format;)
{
- if (format[0] == '%' && format[1] == 's') /* include second string */
+ if (format[0] == '%' && format[1] == 's') /* include second string */
{
- format += 2; /* advance two chars instead of just one */
+ format += 2; /* advance two chars instead of just one */
while (parm && *parm)
*cpy++ = *parm++;
}
diff --git a/gdb/stubs/m68k-stub.c b/gdb/stubs/m68k-stub.c
index 826f92288d5..e31f6811a57 100644
--- a/gdb/stubs/m68k-stub.c
+++ b/gdb/stubs/m68k-stub.c
@@ -113,44 +113,69 @@
*
* external low-level support routines
*/
-typedef void (*ExceptionHook)(int); /* pointer to function with int parm */
-typedef void (*Function)(); /* pointer to a function */
+typedef void (*ExceptionHook) (int); /* pointer to function with int parm */
+typedef void (*Function) (); /* pointer to a function */
-extern void putDebugChar(); /* write a single character */
-extern int getDebugChar(); /* read and return a single char */
+extern void putDebugChar (); /* write a single character */
+extern int getDebugChar (); /* read and return a single char */
-extern Function exceptionHandler(); /* assign an exception handler */
+extern Function exceptionHandler (); /* assign an exception handler */
extern ExceptionHook exceptionHook; /* hook variable for errors/exceptions */
/************************/
/* FORWARD DECLARATIONS */
/************************/
-static void
-initializeRemcomErrorFrame ();
+static void initializeRemcomErrorFrame ();
/************************************************************************/
/* BUFMAX defines the maximum number of characters in inbound/outbound buffers*/
/* at least NUMREGBYTES*2 are needed for register packets */
#define BUFMAX 400
-static char initialized; /* boolean flag. != 0 means we've been initialized */
+static char initialized; /* boolean flag. != 0 means we've been initialized */
-int remote_debug;
-/* debug > 0 prints ill-formed commands in valid packets & checksum errors */
+int remote_debug;
+/* debug > 0 prints ill-formed commands in valid packets & checksum errors */
-static const char hexchars[]="0123456789abcdef";
+static const char hexchars[] = "0123456789abcdef";
/* there are 180 bytes of registers on a 68020 w/68881 */
/* many of the fpa registers are 12 byte (96 bit) registers */
#define NUMREGBYTES 180
-enum regnames {D0,D1,D2,D3,D4,D5,D6,D7,
- A0,A1,A2,A3,A4,A5,A6,A7,
- PS,PC,
- FP0,FP1,FP2,FP3,FP4,FP5,FP6,FP7,
- FPCONTROL,FPSTATUS,FPIADDR
- };
-
-
+
+enum regnames
+{
+ D0,
+ D1,
+ D2,
+ D3,
+ D4,
+ D5,
+ D6,
+ D7,
+ A0,
+ A1,
+ A2,
+ A3,
+ A4,
+ A5,
+ A6,
+ A7,
+ PS,
+ PC,
+ FP0,
+ FP1,
+ FP2,
+ FP3,
+ FP4,
+ FP5,
+ FP6,
+ FP7,
+ FPCONTROL,
+ FPSTATUS,
+ FPIADDR
+};
+
/* We keep a whole frame cache here. "Why?", I hear you cry, "doesn't
GDB handle that sort of thing?" Well, yes, I believe the only
reason for this cache is to save and restore floating point state
@@ -161,30 +186,30 @@ enum regnames {D0,D1,D2,D3,D4,D5,D6,D7,
typedef struct FrameStruct
{
- struct FrameStruct *previous;
- int exceptionPC; /* pc value when this frame created */
- int exceptionVector; /* cpu vector causing exception */
- short frameSize; /* size of cpu frame in words */
- short sr; /* for 68000, this not always sr */
- int pc;
- short format;
- int fsaveHeader;
- int morejunk[0]; /* exception frame, fp save... */
+ struct FrameStruct *previous;
+ int exceptionPC; /* pc value when this frame created */
+ int exceptionVector; /* cpu vector causing exception */
+ short frameSize; /* size of cpu frame in words */
+ short sr; /* for 68000, this not always sr */
+ int pc;
+ short format;
+ int fsaveHeader;
+ int morejunk[0]; /* exception frame, fp save... */
} Frame;
#define FRAMESIZE 500
-int gdbFrameStack[FRAMESIZE];
+int gdbFrameStack[FRAMESIZE];
static Frame *lastFrame;
/*
* these should not be static cuz they can be used outside this module
*/
-int registers[NUMREGBYTES/4];
+int registers[NUMREGBYTES / 4];
int superStack;
#define STACKSIZE 10000
-int remcomStack[STACKSIZE/sizeof(int)];
-static int* stackPtr = &remcomStack[STACKSIZE/sizeof(int) - 1];
+int remcomStack[STACKSIZE / sizeof (int)];
+static int *stackPtr = &remcomStack[STACKSIZE / sizeof (int) - 1];
/*
* In many cases, the system will want to continue exception processing
@@ -199,11 +224,13 @@ static ExceptionHook oldExceptionHook;
* exception. The following table is the number of WORDS used
* for each exception format.
*/
-const short exceptionSize[] = { 4,4,6,4,4,4,4,4,29,10,16,46,12,4,4,4 };
+const short exceptionSize[]
+ = { 4, 4, 6, 4, 4, 4, 4, 4, 29, 10, 16, 46, 12, 4, 4, 4 };
#endif
#ifdef mc68332
-static const short exceptionSize[] = { 4,4,6,4,4,4,4,4,4,4,4,4,16,4,4,4 };
+static const short exceptionSize[]
+ = { 4, 4, 6, 4, 4, 4, 4, 4, 4, 4, 4, 4, 16, 4, 4, 4 };
#endif
/************* jump buffer used for setjmp/longjmp **************************/
@@ -214,11 +241,12 @@ jmp_buf remcomEnv;
#ifdef __HAVE_68881__
/* do an fsave, then remember the address to begin a restore from */
-#define SAVE_FP_REGS() asm(" fsave a0@-"); \
- asm(" fmovemx fp0-fp7,_registers+72"); \
- asm(" fmoveml fpcr/fpsr/fpi,_registers+168");
-#define RESTORE_FP_REGS() \
-asm(" \n\
+#define SAVE_FP_REGS() \
+ asm (" fsave a0@-"); \
+ asm (" fmovemx fp0-fp7,_registers+72"); \
+ asm (" fmoveml fpcr/fpsr/fpi,_registers+168");
+#define RESTORE_FP_REGS() \
+ asm (" \n\
fmoveml _registers+168,fpcr/fpsr/fpi \n\
fmovemx _registers+72,fp0-fp7 \n\
cmpl #-1,a0@ | skip frestore flag set ? \n\
@@ -232,8 +260,8 @@ skip_frestore: \n\
#define RESTORE_FP_REGS()
#endif /* __HAVE_68881__ */
-void return_to_super();
-void return_to_user();
+void return_to_super ();
+void return_to_user ();
asm("
.text
@@ -256,9 +284,9 @@ return_to_any:
movew a0@+,d0 /* get # of words in cpu frame */
addw d0,a0 /* point to end of data */
addw d0,a0 /* point to end of data */
- movel a0,a1
-#
-# copy the stack frame
+ movel a0,a1
+#
+#copy the stack frame
subql #1,d0
copyUserLoop:
movew a1@-,sp@-
@@ -266,10 +294,10 @@ copyUserLoop:
");
RESTORE_FP_REGS()
asm(" moveml _registers,d0-d7/a0-a6");
- asm(" rte"); /* pop and go! */
+ asm(" rte"); /* pop and go! */
-#define DISABLE_INTERRUPTS() asm(" oriw #0x0700,sr");
-#define BREAKPOINT() asm(" trap #1");
+#define DISABLE_INTERRUPTS() asm (" oriw #0x0700,sr");
+#define BREAKPOINT() asm (" trap #1");
/* this function is called immediately when a level 7 interrupt occurs */
/* if the previous interrupt level was 7 then we're already servicing */
@@ -280,7 +308,7 @@ asm("
.globl __debug_level7
__debug_level7:
movew d0,sp@-");
-#if defined (mc68020) || defined (mc68332)
+#if defined(mc68020) || defined(mc68332)
asm(" movew sp@(2),d0");
#else
asm(" movew sp@(6),d0");
@@ -292,14 +320,14 @@ asm(" andiw #0x700,d0
bra __catchException
_already7:
movew sp@+,d0");
-#if !defined (mc68020) && !defined (mc68332)
+#if !defined(mc68020) && !defined(mc68332)
asm(" lea sp@(4),sp"); /* pull off 68000 return address */
#endif
asm(" rte");
extern void _catchException ();
-#if defined (mc68020) || defined (mc68332)
+#if defined(mc68020) || defined(mc68332)
/* This function is called when a 68020 exception occurs. It saves
* all the cpu and fpcp regs in the _registers array, creates a frame on a
* linked list of frames which has the cpu and fpcp stack frames needed
@@ -333,7 +361,7 @@ asm("
movel a4,a5@(68) /* save pc in _regisers[] */
#
-# figure out how many bytes in the stack frame
+#figure out how many bytes in the stack frame
movew sp@(6),d0 /* get '020 exception format */
movew d0,d2 /* make a copy of format word */
andiw #0xf000,d0 /* mask off format type */
@@ -347,13 +375,13 @@ asm("
movel a0,a1 /* copy save pointer */
subql #1,d0 /* predecrement loop counter */
#
-# copy the frame
+#copy the frame
saveFrameLoop:
movew sp@+,a1@+
dbf d0,saveFrameLoop
#
-# now that the stack has been clenaed,
-# save the a7 in use at time of exception
+#now that the stack has been clenaed,
+#save the a7 in use at time of exception
movel sp,_superStack /* save supervisor sp */
andiw #0x2000,d1 /* were we in supervisor mode ? */
beq userMode
@@ -365,19 +393,19 @@ userMode:
a7saveDone:
#
-# save size of frame
+#save size of frame
movew d3,a0@-
#
-# compute exception number
+#compute exception number
andl #0xfff,d2 /* mask off vector offset */
lsrw #2,d2 /* divide by 4 to get vect num */
movel d2,a0@- /* save it */
#
-# save pc causing exception
+#save pc causing exception
movel a4,a0@-
#
-# save old frame link and set the new value
+#save old frame link and set the new value
movel _lastFrame,a1 /* last frame pointer */
movel a1,a0@- /* save pointer to prev frame */
movel a0,_lastFrame
@@ -450,7 +478,7 @@ saveDone:
movel a4,a0@- /* push exception pc */
#
-# save old frame link and set the new value
+#save old frame link and set the new value
movel _lastFrame,a1 /* last frame pointer */
movel a1,a0@- /* save pointer to prev frame */
movel a0,_lastFrame
@@ -486,10 +514,10 @@ _returnFromException (Frame * frame)
frame = lastFrame;
frame->frameSize = 4;
frame->format = 0;
- frame->fsaveHeader = -1; /* restore regs, but we dont have fsave info */
+ frame->fsaveHeader = -1; /* restore regs, but we dont have fsave info */
}
-#if !defined (mc68020) && !defined (mc68332)
+#if !defined(mc68020) && !defined(mc68332)
/* a 68000 cannot use the internal info pushed onto a bus error
* or address error frame when doing an RTE so don't put this info
* onto the stack or the stack will creep every time this happens.
@@ -509,7 +537,7 @@ _returnFromException (Frame * frame)
return_to_super ();
}
else
- { /* return to user mode */
+ { /* return to user mode */
return_to_user ();
}
}
@@ -577,15 +605,16 @@ getpacket (void)
{
if (remote_debug)
{
- fprintf (stderr,
- "bad checksum. My count = 0x%x, sent=0x%x. buf=%s\n",
- checksum, xmitcsum, buffer);
+ fprintf (
+ stderr,
+ "bad checksum. My count = 0x%x, sent=0x%x. buf=%s\n",
+ checksum, xmitcsum, buffer);
}
- putDebugChar ('-'); /* failed checksum */
+ putDebugChar ('-'); /* failed checksum */
}
else
{
- putDebugChar ('+'); /* successful transfer */
+ putDebugChar ('+'); /* successful transfer */
/* if a sequence char is present, reply the sequence ID */
if (buffer[2] == ':')
@@ -629,7 +658,6 @@ putpacket (buffer)
putDebugChar ('#');
putDebugChar (hexchars[checksum >> 4]);
putDebugChar (hexchars[checksum % 16]);
-
}
while (getDebugChar () != '+');
@@ -703,34 +731,34 @@ computeSignal (exceptionVector)
{
case 2:
sigval = 10;
- break; /* bus error */
+ break; /* bus error */
case 3:
sigval = 10;
- break; /* address error */
+ break; /* address error */
case 4:
sigval = 4;
- break; /* illegal instruction */
+ break; /* illegal instruction */
case 5:
sigval = 8;
- break; /* zero divide */
+ break; /* zero divide */
case 6:
sigval = 8;
- break; /* chk instruction */
+ break; /* chk instruction */
case 7:
sigval = 8;
- break; /* trapv instruction */
+ break; /* trapv instruction */
case 8:
sigval = 11;
- break; /* privilege violation */
+ break; /* privilege violation */
case 9:
sigval = 5;
- break; /* trace trap */
+ break; /* trace trap */
case 10:
sigval = 4;
- break; /* line 1010 emulator */
+ break; /* line 1010 emulator */
case 11:
sigval = 4;
- break; /* line 1111 emulator */
+ break; /* line 1111 emulator */
/* Coprocessor protocol violation. Using a standard MMU or FPU
this cannot be triggered by software. Call it a SIGBUS. */
@@ -740,10 +768,10 @@ computeSignal (exceptionVector)
case 31:
sigval = 2;
- break; /* interrupt */
+ break; /* interrupt */
case 33:
sigval = 5;
- break; /* breakpoint */
+ break; /* breakpoint */
/* This is a trap #8 instruction. Apparently it is someone's software
convention for some sort of SIGFPE condition. Whose? How many
@@ -751,31 +779,31 @@ computeSignal (exceptionVector)
Is there a clean solution? */
case 40:
sigval = 8;
- break; /* floating point err */
+ break; /* floating point err */
case 48:
sigval = 8;
- break; /* floating point err */
+ break; /* floating point err */
case 49:
sigval = 8;
- break; /* floating point err */
+ break; /* floating point err */
case 50:
sigval = 8;
- break; /* zero divide */
+ break; /* zero divide */
case 51:
sigval = 8;
- break; /* underflow */
+ break; /* underflow */
case 52:
sigval = 8;
- break; /* operand error */
+ break; /* operand error */
case 53:
sigval = 8;
- break; /* overflow */
+ break; /* overflow */
case 54:
sigval = 8;
- break; /* NAN */
+ break; /* NAN */
default:
- sigval = 7; /* "software generated" */
+ sigval = 7; /* "software generated" */
}
return (sigval);
}
@@ -822,8 +850,8 @@ handle_exception (int exceptionVector)
Frame *frame;
if (remote_debug)
- printf ("vector=%d, sr=0x%x, pc=0x%x\n",
- exceptionVector, registers[PS], registers[PC]);
+ printf ("vector=%d, sr=0x%x, pc=0x%x\n", exceptionVector, registers[PS],
+ registers[PC]);
/* reply to host that an exception has occurred */
sigval = computeSignal (exceptionVector);
@@ -849,12 +877,12 @@ handle_exception (int exceptionVector)
remcomOutBuffer[3] = 0;
break;
case 'd':
- remote_debug = !(remote_debug); /* toggle debug flag */
+ remote_debug = !(remote_debug); /* toggle debug flag */
break;
- case 'g': /* return the value of the CPU registers */
+ case 'g': /* return the value of the CPU registers */
mem2hex ((char *) registers, remcomOutBuffer, NUMREGBYTES);
break;
- case 'G': /* set the value of the CPU registers - return OK */
+ case 'G': /* set the value of the CPU registers - return OK */
hex2mem (ptr, (char *) registers, NUMREGBYTES);
strcpy (remcomOutBuffer, "OK");
break;
@@ -951,21 +979,21 @@ handle_exception (int exceptionVector)
while (frame)
{
if (remote_debug)
- printf ("frame at 0x%x has pc=0x%x, except#=%d\n",
- frame, frame->exceptionPC, frame->exceptionVector);
+ printf ("frame at 0x%x has pc=0x%x, except#=%d\n", frame,
+ frame->exceptionPC, frame->exceptionVector);
if (frame->exceptionPC == newPC)
- break; /* bingo! a match */
+ break; /* bingo! a match */
/*
* for a breakpoint instruction, the saved pc may
* be off by two due to re-executing the instruction
* replaced by the trap instruction. Check for this.
*/
- if ((frame->exceptionVector == 33) &&
- (frame->exceptionPC == (newPC + 2)))
+ if ((frame->exceptionVector == 33)
+ && (frame->exceptionPC == (newPC + 2)))
break;
if (frame == frame->previous)
{
- frame = 0; /* no match found */
+ frame = 0; /* no match found */
break;
}
frame = frame->previous;
@@ -979,16 +1007,16 @@ handle_exception (int exceptionVector)
*/
if (frame)
{
- if ((frame->exceptionVector != 9) &&
- (frame->exceptionVector != 31) &&
- (frame->exceptionVector != 33))
+ if ((frame->exceptionVector != 9)
+ && (frame->exceptionVector != 31)
+ && (frame->exceptionVector != 33))
{
/*
* invoke the previous handler.
*/
if (oldExceptionHook)
(*oldExceptionHook) (frame->exceptionVector);
- newPC = registers[PC]; /* pc may have changed */
+ newPC = registers[PC]; /* pc may have changed */
if (newPC != frame->exceptionPC)
{
if (remote_debug)
@@ -997,7 +1025,7 @@ handle_exception (int exceptionVector)
frame->exceptionVector);
/* re-use the last frame, we're skipping it (longjump?) */
frame = (Frame *) 0;
- _returnFromException (frame); /* this is a jump */
+ _returnFromException (frame); /* this is a jump */
}
}
}
@@ -1019,17 +1047,17 @@ handle_exception (int exceptionVector)
}
frame->previous = lastFrame;
lastFrame = frame;
- frame = 0; /* null so _return... will properly initialize it */
+ frame = 0; /* null so _return... will properly initialize it */
}
- _returnFromException (frame); /* this is a jump */
+ _returnFromException (frame); /* this is a jump */
break;
/* kill the program */
- case 'k': /* do nothing */
+ case 'k': /* do nothing */
break;
- } /* switch */
+ } /* switch */
/* reply to the request */
putpacket (remcomOutBuffer);
@@ -1040,7 +1068,7 @@ handle_exception (int exceptionVector)
void
initializeRemcomErrorFrame (void)
{
- lastFrame = ((Frame *) & gdbFrameStack[FRAMESIZE - 1]) - 1;
+ lastFrame = ((Frame *) &gdbFrameStack[FRAMESIZE - 1]) - 1;
lastFrame->previous = lastFrame;
}
diff --git a/gdb/stubs/sh-stub.c b/gdb/stubs/sh-stub.c
index 03a865eeded..151e8f12a90 100644
--- a/gdb/stubs/sh-stub.c
+++ b/gdb/stubs/sh-stub.c
@@ -26,7 +26,6 @@
****************************************************************************/
-
/* Remote communication protocol.
A debug packet whose contents are <data>
@@ -149,31 +148,31 @@
/* Renesas SH architecture instruction encoding masks */
-#define COND_BR_MASK 0xff00
+#define COND_BR_MASK 0xff00
#define UCOND_DBR_MASK 0xe000
#define UCOND_RBR_MASK 0xf0df
-#define TRAPA_MASK 0xff00
+#define TRAPA_MASK 0xff00
-#define COND_DISP 0x00ff
-#define UCOND_DISP 0x0fff
-#define UCOND_REG 0x0f00
+#define COND_DISP 0x00ff
+#define UCOND_DISP 0x0fff
+#define UCOND_REG 0x0f00
/* Renesas SH instruction opcodes */
-#define BF_INSTR 0x8b00
-#define BT_INSTR 0x8900
-#define BRA_INSTR 0xa000
-#define BSR_INSTR 0xb000
-#define JMP_INSTR 0x402b
-#define JSR_INSTR 0x400b
-#define RTS_INSTR 0x000b
-#define RTE_INSTR 0x002b
-#define TRAPA_INSTR 0xc300
-#define SSTEP_INSTR 0xc3ff
+#define BF_INSTR 0x8b00
+#define BT_INSTR 0x8900
+#define BRA_INSTR 0xa000
+#define BSR_INSTR 0xb000
+#define JMP_INSTR 0x402b
+#define JSR_INSTR 0x400b
+#define RTS_INSTR 0x000b
+#define RTE_INSTR 0x002b
+#define TRAPA_INSTR 0xc300
+#define SSTEP_INSTR 0xc3ff
/* Renesas SH processor register masks */
-#define T_BIT_MASK 0x0001
+#define T_BIT_MASK 0x0001
/*
* BUFMAX defines the maximum number of characters in inbound/outbound
@@ -184,7 +183,7 @@
/*
* Number of bytes for registers
*/
-#define NUMREGBYTES 112 /* 92 */
+#define NUMREGBYTES 112 /* 92 */
/*
* typedef
@@ -204,7 +203,7 @@ static void putpacket (char *);
static void handle_buserror (void);
static int computeSignal (int exceptionVector);
static void handle_exception (int exceptionVector);
-void init_serial();
+void init_serial ();
void putDebugChar (char);
char getDebugChar (void);
@@ -219,36 +218,32 @@ void catch_exception_32 (void);
void catch_exception_33 (void);
void catch_exception_255 (void);
-
-
-#define catch_exception_random catch_exception_255 /* Treat all odd ones like 255 */
+#define catch_exception_random \
+ catch_exception_255 /* Treat all odd ones like 255 */
void breakpoint (void);
+#define init_stack_size \
+ 8 * 1024 /* if you change this you should also modify BINIT */
+#define stub_stack_size 8 * 1024
-#define init_stack_size 8*1024 /* if you change this you should also modify BINIT */
-#define stub_stack_size 8*1024
-
-int init_stack[init_stack_size] __attribute__ ((section ("stack"))) = {0};
-int stub_stack[stub_stack_size] __attribute__ ((section ("stack"))) = {0};
-
+int init_stack[init_stack_size] __attribute__ ((section ("stack"))) = { 0 };
+int stub_stack[stub_stack_size] __attribute__ ((section ("stack"))) = { 0 };
void INIT ();
void BINIT ();
-#define CPU_BUS_ERROR_VEC 9
+#define CPU_BUS_ERROR_VEC 9
#define DMA_BUS_ERROR_VEC 10
-#define NMI_VEC 11
-#define INVALID_INSN_VEC 4
-#define INVALID_SLOT_VEC 6
-#define TRAP_VEC 32
-#define IO_VEC 33
-#define USER_VEC 255
+#define NMI_VEC 11
+#define INVALID_INSN_VEC 4
+#define INVALID_SLOT_VEC 6
+#define TRAP_VEC 32
+#define IO_VEC 33
+#define USER_VEC 255
-
-
-char in_nmi; /* Set when handling an NMI, so we don't reenter */
-int dofault; /* Non zero, bus errors will raise exception */
+char in_nmi; /* Set when handling an NMI, so we don't reenter */
+int dofault; /* Non zero, bus errors will raise exception */
int *stub_sp;
@@ -259,19 +254,42 @@ int remote_debug;
jmp_buf remcomEnv;
enum regnames
- {
- R0, R1, R2, R3, R4, R5, R6, R7,
- R8, R9, R10, R11, R12, R13, R14,
- R15, PC, PR, GBR, VBR, MACH, MACL, SR,
- TICKS, STALLS, CYCLES, INSTS, PLR
- };
+{
+ R0,
+ R1,
+ R2,
+ R3,
+ R4,
+ R5,
+ R6,
+ R7,
+ R8,
+ R9,
+ R10,
+ R11,
+ R12,
+ R13,
+ R14,
+ R15,
+ PC,
+ PR,
+ GBR,
+ VBR,
+ MACH,
+ MACL,
+ SR,
+ TICKS,
+ STALLS,
+ CYCLES,
+ INSTS,
+ PLR
+};
typedef struct
- {
- short *memAddr;
- short oldInstr;
- }
-stepData;
+{
+ short *memAddr;
+ short oldInstr;
+} stepData;
int registers[NUMREGBYTES / 4];
stepData instrBuffer;
@@ -280,12 +298,14 @@ static const char hexchars[] = "0123456789abcdef";
static char remcomInBuffer[BUFMAX];
static char remcomOutBuffer[BUFMAX];
-char highhex(int x)
+char
+highhex (int x)
{
return hexchars[(x >> 4) & 0xf];
}
-char lowhex(int x)
+char
+lowhex (int x)
{
return hexchars[x & 0xf];
}
@@ -294,8 +314,7 @@ char lowhex(int x)
* Assembly macros
*/
-#define BREAKPOINT() asm("trapa #0x20"::);
-
+#define BREAKPOINT() asm ("trapa #0x20" ::);
/*
* Routines to handle hex data
@@ -397,7 +416,7 @@ getpacket (void)
while ((ch = getDebugChar ()) != '$')
;
-retry:
+ retry:
checksum = 0;
xmitcsum = -1;
count = 0;
@@ -425,11 +444,11 @@ retry:
if (checksum != xmitcsum)
{
- putDebugChar ('-'); /* failed checksum */
+ putDebugChar ('-'); /* failed checksum */
}
else
{
- putDebugChar ('+'); /* successful transfer */
+ putDebugChar ('+'); /* successful transfer */
/* if a sequence char is present, reply the sequence ID */
if (buffer[2] == ':')
@@ -446,7 +465,6 @@ retry:
}
}
-
/* send the packet in buffer. */
static void
@@ -467,11 +485,11 @@ putpacket (char *buffer)
int runlen;
/* Do run length encoding */
- for (runlen = 0; runlen < 100; runlen ++)
+ for (runlen = 0; runlen < 100; runlen++)
{
- if (src[0] != src[runlen])
+ if (src[0] != src[runlen])
{
- if (runlen > 3)
+ if (runlen > 3)
{
int encode;
/* Got a useful amount */
@@ -494,15 +512,13 @@ putpacket (char *buffer)
}
}
-
putDebugChar ('#');
- putDebugChar (highhex(checksum));
- putDebugChar (lowhex(checksum));
+ putDebugChar (highhex (checksum));
+ putDebugChar (lowhex (checksum));
}
- while (getDebugChar() != '+');
+ while (getDebugChar () != '+');
}
-
/* a bus error has occurred, perform a longjmp
to return execution and allow handling of the error */
@@ -524,19 +540,19 @@ computeSignal (int exceptionVector)
{
case INVALID_INSN_VEC:
sigval = 4;
- break;
+ break;
case INVALID_SLOT_VEC:
sigval = 4;
- break;
+ break;
case CPU_BUS_ERROR_VEC:
sigval = 10;
- break;
+ break;
case DMA_BUS_ERROR_VEC:
sigval = 10;
- break;
+ break;
case NMI_VEC:
sigval = 2;
- break;
+ break;
case TRAP_VEC:
case USER_VEC:
@@ -544,7 +560,7 @@ computeSignal (int exceptionVector)
break;
default:
- sigval = 7; /* "software generated"*/
+ sigval = 7; /* "software generated"*/
break;
}
return (sigval);
@@ -627,7 +643,6 @@ doSStep (void)
*instrMem = SSTEP_INSTR;
}
-
/* Undo the effect of a previous doSStep. If we single stepped,
restore the old instruction. */
@@ -635,7 +650,8 @@ void
undoSStep (void)
{
if (stepped)
- { short *instrMem;
+ {
+ short *instrMem;
instrMem = instrBuffer.memAddr;
*instrMem = instrBuffer.oldInstr;
}
@@ -651,7 +667,6 @@ When in the monitor mode we talk a human on the serial line rather than gdb.
*/
-
void
gdb_handle_exception (int exceptionVector)
{
@@ -662,7 +677,7 @@ gdb_handle_exception (int exceptionVector)
/* reply to host that an exception has occurred */
sigval = computeSignal (exceptionVector);
remcomOutBuffer[0] = 'S';
- remcomOutBuffer[1] = highhex(sigval);
+ remcomOutBuffer[1] = highhex (sigval);
remcomOutBuffer[2] = lowhex (sigval);
remcomOutBuffer[3] = 0;
@@ -674,8 +689,7 @@ gdb_handle_exception (int exceptionVector)
* PC by one instruction, since this instruction
* will later be replaced by its original one!
*/
- if (exceptionVector == 0xff
- || exceptionVector == 0x20)
+ if (exceptionVector == 0xff || exceptionVector == 0x20)
registers[PC] -= 2;
/*
@@ -700,12 +714,12 @@ gdb_handle_exception (int exceptionVector)
remcomOutBuffer[3] = 0;
break;
case 'd':
- remote_debug = !(remote_debug); /* toggle debug flag */
+ remote_debug = !(remote_debug); /* toggle debug flag */
break;
- case 'g': /* return the value of the CPU registers */
+ case 'g': /* return the value of the CPU registers */
mem2hex ((char *) registers, remcomOutBuffer, NUMREGBYTES);
break;
- case 'G': /* set the value of the CPU registers - return OK */
+ case 'G': /* set the value of the CPU registers - return OK */
hex2mem (ptr, (char *) registers, NUMREGBYTES);
strcpy (remcomOutBuffer, "OK");
break;
@@ -776,37 +790,38 @@ gdb_handle_exception (int exceptionVector)
break;
/* kill the program */
- case 'k': /* do nothing */
+ case 'k': /* do nothing */
break;
- } /* switch */
+ } /* switch */
/* reply to the request */
putpacket (remcomOutBuffer);
}
}
-
-#define GDBCOOKIE 0x5ac
+#define GDBCOOKIE 0x5ac
static int ingdbmode;
+
/* We've had an exception - choose to go into the monitor or
the gdb stub */
-void handle_exception(int exceptionVector)
+void
+handle_exception (int exceptionVector)
{
#ifdef MONITOR
- if (ingdbmode != GDBCOOKIE)
- monitor_handle_exception (exceptionVector);
- else
+ if (ingdbmode != GDBCOOKIE)
+ monitor_handle_exception (exceptionVector);
+ else
#endif
- gdb_handle_exception (exceptionVector);
-
+ gdb_handle_exception (exceptionVector);
}
void
gdb_mode (void)
{
ingdbmode = GDBCOOKIE;
- breakpoint();
+ breakpoint ();
}
+
/* This function will generate a breakpoint exception. It is used at the
beginning of a program to sync up with a debugger and can be used
otherwise as a quick means to stop program execution and "break" into
@@ -815,7 +830,7 @@ gdb_mode (void)
void
breakpoint (void)
{
- BREAKPOINT ();
+ BREAKPOINT ();
}
/**** Processor-specific routines start here ****/
@@ -842,300 +857,177 @@ breakpoint (void)
/* SH1/SH2 exception vector table format */
typedef struct
- {
- void (*func_cold) ();
- int *stack_cold;
- void (*func_warm) ();
- int *stack_warm;
- void (*(handler[256 - 4])) ();
- }
-vec_type;
+{
+ void (*func_cold) ();
+ int *stack_cold;
+ void (*func_warm) ();
+ int *stack_warm;
+ void (*(handler[256 - 4])) ();
+} vec_type;
/* vectable is the SH1/SH2 vector table. It must be at address 0
or wherever your vbr points. */
-const vec_type vectable =
-{
+const vec_type vectable = {
&BINIT, /* 0: Power-on reset PC */
init_stack + init_stack_size, /* 1: Power-on reset SP */
&BINIT, /* 2: Manual reset PC */
init_stack + init_stack_size, /* 3: Manual reset SP */
-{
- &catch_exception_4, /* 4: General invalid instruction */
- &catch_exception_random, /* 5: Reserved for system */
- &catch_exception_6, /* 6: Invalid slot instruction */
- &catch_exception_random, /* 7: Reserved for system */
- &catch_exception_random, /* 8: Reserved for system */
- &catch_exception_9, /* 9: CPU bus error */
- &catch_exception_10, /* 10: DMA bus error */
- &catch_exception_11, /* 11: NMI */
- &catch_exception_random, /* 12: User break */
- &catch_exception_random, /* 13: Reserved for system */
- &catch_exception_random, /* 14: Reserved for system */
- &catch_exception_random, /* 15: Reserved for system */
- &catch_exception_random, /* 16: Reserved for system */
- &catch_exception_random, /* 17: Reserved for system */
- &catch_exception_random, /* 18: Reserved for system */
- &catch_exception_random, /* 19: Reserved for system */
- &catch_exception_random, /* 20: Reserved for system */
- &catch_exception_random, /* 21: Reserved for system */
- &catch_exception_random, /* 22: Reserved for system */
- &catch_exception_random, /* 23: Reserved for system */
- &catch_exception_random, /* 24: Reserved for system */
- &catch_exception_random, /* 25: Reserved for system */
- &catch_exception_random, /* 26: Reserved for system */
- &catch_exception_random, /* 27: Reserved for system */
- &catch_exception_random, /* 28: Reserved for system */
- &catch_exception_random, /* 29: Reserved for system */
- &catch_exception_random, /* 30: Reserved for system */
- &catch_exception_random, /* 31: Reserved for system */
- &catch_exception_32, /* 32: Trap instr (user vectors) */
- &catch_exception_33, /* 33: Trap instr (user vectors) */
- &catch_exception_random, /* 34: Trap instr (user vectors) */
- &catch_exception_random, /* 35: Trap instr (user vectors) */
- &catch_exception_random, /* 36: Trap instr (user vectors) */
- &catch_exception_random, /* 37: Trap instr (user vectors) */
- &catch_exception_random, /* 38: Trap instr (user vectors) */
- &catch_exception_random, /* 39: Trap instr (user vectors) */
- &catch_exception_random, /* 40: Trap instr (user vectors) */
- &catch_exception_random, /* 41: Trap instr (user vectors) */
- &catch_exception_random, /* 42: Trap instr (user vectors) */
- &catch_exception_random, /* 43: Trap instr (user vectors) */
- &catch_exception_random, /* 44: Trap instr (user vectors) */
- &catch_exception_random, /* 45: Trap instr (user vectors) */
- &catch_exception_random, /* 46: Trap instr (user vectors) */
- &catch_exception_random, /* 47: Trap instr (user vectors) */
- &catch_exception_random, /* 48: Trap instr (user vectors) */
- &catch_exception_random, /* 49: Trap instr (user vectors) */
- &catch_exception_random, /* 50: Trap instr (user vectors) */
- &catch_exception_random, /* 51: Trap instr (user vectors) */
- &catch_exception_random, /* 52: Trap instr (user vectors) */
- &catch_exception_random, /* 53: Trap instr (user vectors) */
- &catch_exception_random, /* 54: Trap instr (user vectors) */
- &catch_exception_random, /* 55: Trap instr (user vectors) */
- &catch_exception_random, /* 56: Trap instr (user vectors) */
- &catch_exception_random, /* 57: Trap instr (user vectors) */
- &catch_exception_random, /* 58: Trap instr (user vectors) */
- &catch_exception_random, /* 59: Trap instr (user vectors) */
- &catch_exception_random, /* 60: Trap instr (user vectors) */
- &catch_exception_random, /* 61: Trap instr (user vectors) */
- &catch_exception_random, /* 62: Trap instr (user vectors) */
- &catch_exception_random, /* 63: Trap instr (user vectors) */
- &catch_exception_random, /* 64: IRQ0 */
- &catch_exception_random, /* 65: IRQ1 */
- &catch_exception_random, /* 66: IRQ2 */
- &catch_exception_random, /* 67: IRQ3 */
- &catch_exception_random, /* 68: IRQ4 */
- &catch_exception_random, /* 69: IRQ5 */
- &catch_exception_random, /* 70: IRQ6 */
- &catch_exception_random, /* 71: IRQ7 */
- &catch_exception_random,
- &catch_exception_random,
- &catch_exception_random,
- &catch_exception_random,
- &catch_exception_random,
- &catch_exception_random,
- &catch_exception_random,
- &catch_exception_random,
- &catch_exception_random,
- &catch_exception_random,
- &catch_exception_random,
- &catch_exception_random,
- &catch_exception_random,
- &catch_exception_random,
- &catch_exception_random,
- &catch_exception_random,
- &catch_exception_random,
- &catch_exception_random,
- &catch_exception_random,
- &catch_exception_random,
- &catch_exception_random,
- &catch_exception_random,
- &catch_exception_random,
- &catch_exception_random,
- &catch_exception_random,
- &catch_exception_random,
- &catch_exception_random,
- &catch_exception_random,
- &catch_exception_random,
- &catch_exception_random,
- &catch_exception_random,
- &catch_exception_random,
- &catch_exception_random,
- &catch_exception_random,
- &catch_exception_random,
- &catch_exception_random,
- &catch_exception_random,
- &catch_exception_random,
- &catch_exception_random,
- &catch_exception_random,
- &catch_exception_random,
- &catch_exception_random,
- &catch_exception_random,
- &catch_exception_random,
- &catch_exception_random,
- &catch_exception_random,
- &catch_exception_random,
- &catch_exception_random,
- &catch_exception_random,
- &catch_exception_random,
- &catch_exception_random,
- &catch_exception_random,
- &catch_exception_random,
- &catch_exception_random,
- &catch_exception_random,
- &catch_exception_random,
- &catch_exception_random,
- &catch_exception_random,
- &catch_exception_random,
- &catch_exception_random,
- &catch_exception_random,
- &catch_exception_random,
- &catch_exception_random,
- &catch_exception_random,
- &catch_exception_random,
- &catch_exception_random,
- &catch_exception_random,
- &catch_exception_random,
- &catch_exception_random,
- &catch_exception_random,
- &catch_exception_random,
- &catch_exception_random,
- &catch_exception_random,
- &catch_exception_random,
- &catch_exception_random,
- &catch_exception_random,
- &catch_exception_random,
- &catch_exception_random,
- &catch_exception_random,
- &catch_exception_random,
- &catch_exception_random,
- &catch_exception_random,
- &catch_exception_random,
- &catch_exception_random,
- &catch_exception_random,
- &catch_exception_random,
- &catch_exception_random,
- &catch_exception_random,
- &catch_exception_random,
- &catch_exception_random,
- &catch_exception_random,
- &catch_exception_random,
- &catch_exception_random,
- &catch_exception_random,
- &catch_exception_random,
- &catch_exception_random,
- &catch_exception_random,
- &catch_exception_random,
- &catch_exception_random,
- &catch_exception_random,
- &catch_exception_random,
- &catch_exception_random,
- &catch_exception_random,
- &catch_exception_random,
- &catch_exception_random,
- &catch_exception_random,
- &catch_exception_random,
- &catch_exception_random,
- &catch_exception_random,
- &catch_exception_random,
- &catch_exception_random,
- &catch_exception_random,
- &catch_exception_random,
- &catch_exception_random,
- &catch_exception_random,
- &catch_exception_random,
- &catch_exception_random,
- &catch_exception_random,
- &catch_exception_random,
- &catch_exception_random,
- &catch_exception_random,
- &catch_exception_random,
- &catch_exception_random,
- &catch_exception_random,
- &catch_exception_random,
- &catch_exception_random,
- &catch_exception_random,
- &catch_exception_random,
- &catch_exception_random,
- &catch_exception_random,
- &catch_exception_random,
- &catch_exception_random,
- &catch_exception_random,
- &catch_exception_random,
- &catch_exception_random,
- &catch_exception_random,
- &catch_exception_random,
- &catch_exception_random,
- &catch_exception_random,
- &catch_exception_random,
- &catch_exception_random,
- &catch_exception_random,
- &catch_exception_random,
- &catch_exception_random,
- &catch_exception_random,
- &catch_exception_random,
- &catch_exception_random,
- &catch_exception_random,
- &catch_exception_random,
- &catch_exception_random,
- &catch_exception_random,
- &catch_exception_random,
- &catch_exception_random,
- &catch_exception_random,
- &catch_exception_random,
- &catch_exception_random,
- &catch_exception_random,
- &catch_exception_random,
- &catch_exception_random,
- &catch_exception_random,
- &catch_exception_random,
- &catch_exception_random,
- &catch_exception_random,
- &catch_exception_random,
- &catch_exception_random,
- &catch_exception_random,
- &catch_exception_random,
- &catch_exception_random,
- &catch_exception_random,
- &catch_exception_random,
- &catch_exception_random,
- &catch_exception_random,
- &catch_exception_random,
- &catch_exception_random,
- &catch_exception_random,
- &catch_exception_random,
- &catch_exception_random,
- &catch_exception_random,
- &catch_exception_random,
- &catch_exception_random,
- &catch_exception_random,
- &catch_exception_random,
- &catch_exception_random,
- &catch_exception_255}};
-
-#define BCR (*(volatile short *)(0x05FFFFA0)) /* Bus control register */
-#define BAS (0x800) /* Byte access select */
-#define WCR1 (*(volatile short *)(0x05ffffA2)) /* Wait state control register */
+ { &catch_exception_4, /* 4: General invalid instruction */
+ &catch_exception_random, /* 5: Reserved for system */
+ &catch_exception_6, /* 6: Invalid slot instruction */
+ &catch_exception_random, /* 7: Reserved for system */
+ &catch_exception_random, /* 8: Reserved for system */
+ &catch_exception_9, /* 9: CPU bus error */
+ &catch_exception_10, /* 10: DMA bus error */
+ &catch_exception_11, /* 11: NMI */
+ &catch_exception_random, /* 12: User break */
+ &catch_exception_random, /* 13: Reserved for system */
+ &catch_exception_random, /* 14: Reserved for system */
+ &catch_exception_random, /* 15: Reserved for system */
+ &catch_exception_random, /* 16: Reserved for system */
+ &catch_exception_random, /* 17: Reserved for system */
+ &catch_exception_random, /* 18: Reserved for system */
+ &catch_exception_random, /* 19: Reserved for system */
+ &catch_exception_random, /* 20: Reserved for system */
+ &catch_exception_random, /* 21: Reserved for system */
+ &catch_exception_random, /* 22: Reserved for system */
+ &catch_exception_random, /* 23: Reserved for system */
+ &catch_exception_random, /* 24: Reserved for system */
+ &catch_exception_random, /* 25: Reserved for system */
+ &catch_exception_random, /* 26: Reserved for system */
+ &catch_exception_random, /* 27: Reserved for system */
+ &catch_exception_random, /* 28: Reserved for system */
+ &catch_exception_random, /* 29: Reserved for system */
+ &catch_exception_random, /* 30: Reserved for system */
+ &catch_exception_random, /* 31: Reserved for system */
+ &catch_exception_32, /* 32: Trap instr (user vectors) */
+ &catch_exception_33, /* 33: Trap instr (user vectors) */
+ &catch_exception_random, /* 34: Trap instr (user vectors) */
+ &catch_exception_random, /* 35: Trap instr (user vectors) */
+ &catch_exception_random, /* 36: Trap instr (user vectors) */
+ &catch_exception_random, /* 37: Trap instr (user vectors) */
+ &catch_exception_random, /* 38: Trap instr (user vectors) */
+ &catch_exception_random, /* 39: Trap instr (user vectors) */
+ &catch_exception_random, /* 40: Trap instr (user vectors) */
+ &catch_exception_random, /* 41: Trap instr (user vectors) */
+ &catch_exception_random, /* 42: Trap instr (user vectors) */
+ &catch_exception_random, /* 43: Trap instr (user vectors) */
+ &catch_exception_random, /* 44: Trap instr (user vectors) */
+ &catch_exception_random, /* 45: Trap instr (user vectors) */
+ &catch_exception_random, /* 46: Trap instr (user vectors) */
+ &catch_exception_random, /* 47: Trap instr (user vectors) */
+ &catch_exception_random, /* 48: Trap instr (user vectors) */
+ &catch_exception_random, /* 49: Trap instr (user vectors) */
+ &catch_exception_random, /* 50: Trap instr (user vectors) */
+ &catch_exception_random, /* 51: Trap instr (user vectors) */
+ &catch_exception_random, /* 52: Trap instr (user vectors) */
+ &catch_exception_random, /* 53: Trap instr (user vectors) */
+ &catch_exception_random, /* 54: Trap instr (user vectors) */
+ &catch_exception_random, /* 55: Trap instr (user vectors) */
+ &catch_exception_random, /* 56: Trap instr (user vectors) */
+ &catch_exception_random, /* 57: Trap instr (user vectors) */
+ &catch_exception_random, /* 58: Trap instr (user vectors) */
+ &catch_exception_random, /* 59: Trap instr (user vectors) */
+ &catch_exception_random, /* 60: Trap instr (user vectors) */
+ &catch_exception_random, /* 61: Trap instr (user vectors) */
+ &catch_exception_random, /* 62: Trap instr (user vectors) */
+ &catch_exception_random, /* 63: Trap instr (user vectors) */
+ &catch_exception_random, /* 64: IRQ0 */
+ &catch_exception_random, /* 65: IRQ1 */
+ &catch_exception_random, /* 66: IRQ2 */
+ &catch_exception_random, /* 67: IRQ3 */
+ &catch_exception_random, /* 68: IRQ4 */
+ &catch_exception_random, /* 69: IRQ5 */
+ &catch_exception_random, /* 70: IRQ6 */
+ &catch_exception_random, /* 71: IRQ7 */
+ &catch_exception_random, &catch_exception_random, &catch_exception_random,
+ &catch_exception_random, &catch_exception_random, &catch_exception_random,
+ &catch_exception_random, &catch_exception_random, &catch_exception_random,
+ &catch_exception_random, &catch_exception_random, &catch_exception_random,
+ &catch_exception_random, &catch_exception_random, &catch_exception_random,
+ &catch_exception_random, &catch_exception_random, &catch_exception_random,
+ &catch_exception_random, &catch_exception_random, &catch_exception_random,
+ &catch_exception_random, &catch_exception_random, &catch_exception_random,
+ &catch_exception_random, &catch_exception_random, &catch_exception_random,
+ &catch_exception_random, &catch_exception_random, &catch_exception_random,
+ &catch_exception_random, &catch_exception_random, &catch_exception_random,
+ &catch_exception_random, &catch_exception_random, &catch_exception_random,
+ &catch_exception_random, &catch_exception_random, &catch_exception_random,
+ &catch_exception_random, &catch_exception_random, &catch_exception_random,
+ &catch_exception_random, &catch_exception_random, &catch_exception_random,
+ &catch_exception_random, &catch_exception_random, &catch_exception_random,
+ &catch_exception_random, &catch_exception_random, &catch_exception_random,
+ &catch_exception_random, &catch_exception_random, &catch_exception_random,
+ &catch_exception_random, &catch_exception_random, &catch_exception_random,
+ &catch_exception_random, &catch_exception_random, &catch_exception_random,
+ &catch_exception_random, &catch_exception_random, &catch_exception_random,
+ &catch_exception_random, &catch_exception_random, &catch_exception_random,
+ &catch_exception_random, &catch_exception_random, &catch_exception_random,
+ &catch_exception_random, &catch_exception_random, &catch_exception_random,
+ &catch_exception_random, &catch_exception_random, &catch_exception_random,
+ &catch_exception_random, &catch_exception_random, &catch_exception_random,
+ &catch_exception_random, &catch_exception_random, &catch_exception_random,
+ &catch_exception_random, &catch_exception_random, &catch_exception_random,
+ &catch_exception_random, &catch_exception_random, &catch_exception_random,
+ &catch_exception_random, &catch_exception_random, &catch_exception_random,
+ &catch_exception_random, &catch_exception_random, &catch_exception_random,
+ &catch_exception_random, &catch_exception_random, &catch_exception_random,
+ &catch_exception_random, &catch_exception_random, &catch_exception_random,
+ &catch_exception_random, &catch_exception_random, &catch_exception_random,
+ &catch_exception_random, &catch_exception_random, &catch_exception_random,
+ &catch_exception_random, &catch_exception_random, &catch_exception_random,
+ &catch_exception_random, &catch_exception_random, &catch_exception_random,
+ &catch_exception_random, &catch_exception_random, &catch_exception_random,
+ &catch_exception_random, &catch_exception_random, &catch_exception_random,
+ &catch_exception_random, &catch_exception_random, &catch_exception_random,
+ &catch_exception_random, &catch_exception_random, &catch_exception_random,
+ &catch_exception_random, &catch_exception_random, &catch_exception_random,
+ &catch_exception_random, &catch_exception_random, &catch_exception_random,
+ &catch_exception_random, &catch_exception_random, &catch_exception_random,
+ &catch_exception_random, &catch_exception_random, &catch_exception_random,
+ &catch_exception_random, &catch_exception_random, &catch_exception_random,
+ &catch_exception_random, &catch_exception_random, &catch_exception_random,
+ &catch_exception_random, &catch_exception_random, &catch_exception_random,
+ &catch_exception_random, &catch_exception_random, &catch_exception_random,
+ &catch_exception_random, &catch_exception_random, &catch_exception_random,
+ &catch_exception_random, &catch_exception_random, &catch_exception_random,
+ &catch_exception_random, &catch_exception_random, &catch_exception_random,
+ &catch_exception_random, &catch_exception_random, &catch_exception_random,
+ &catch_exception_random, &catch_exception_random, &catch_exception_random,
+ &catch_exception_random, &catch_exception_random, &catch_exception_random,
+ &catch_exception_random, &catch_exception_random, &catch_exception_random,
+ &catch_exception_random, &catch_exception_random, &catch_exception_random,
+ &catch_exception_random, &catch_exception_random, &catch_exception_random,
+ &catch_exception_random, &catch_exception_random, &catch_exception_random,
+ &catch_exception_random, &catch_exception_random, &catch_exception_random,
+ &catch_exception_random, &catch_exception_random, &catch_exception_random,
+ &catch_exception_255 }
+};
+
+#define BCR (*(volatile short *) (0x05FFFFA0)) /* Bus control register */
+#define BAS (0x800) /* Byte access select */
+#define WCR1 \
+ (*(volatile short *) (0x05ffffA2)) /* Wait state control register */
asm ("_BINIT: mov.l L1,r15");
asm ("bra _INIT");
asm ("nop");
asm ("L1: .long _init_stack + 8*1024*4");
+
void
INIT (void)
{
/* First turn on the ram */
- WCR1 = 0; /* Never sample wait */
- BCR = BAS; /* use lowbyte/high byte */
+ WCR1 = 0; /* Never sample wait */
+ BCR = BAS; /* use lowbyte/high byte */
- init_serial();
+ init_serial ();
#ifdef MONITOR
reset_hook ();
#endif
-
in_nmi = 0;
dofault = 1;
stepped = 0;
@@ -1147,11 +1039,9 @@ INIT (void)
;
}
-
-static void sr()
+static void
+sr ()
{
-
-
/* Calling Reset does the same as pressing the button */
asm (".global _Reset
.global _WarmReset
@@ -1214,10 +1104,10 @@ L_stubstack:
.long _stub_sp
L_hdl_except:
.long _handle_exception");
-
}
-static void rr()
+static void
+rr ()
{
asm("
.align 2
@@ -1263,230 +1153,245 @@ restoreRegisters:
");
}
-
-static __inline__ void code_for_catch_exception(int n)
+static __inline__ void
+code_for_catch_exception (int n)
{
- asm(" .globl _catch_exception_%O0" : : "i" (n) );
- asm(" _catch_exception_%O0:" :: "i" (n) );
-
- asm(" add #-4, r15 ! reserve spot on stack ");
- asm(" mov.l r1, @-r15 ! push R1 ");
+asm (" .globl _catch_exception_%O0" : : "i"(n));
+asm (" _catch_exception_%O0:" ::"i"(n));
- if (n == NMI_VEC)
- {
- /* Special case for NMI - make sure that they don't nest */
- asm(" mov.l r0, @-r15 ! push R0");
- asm(" mov.l L_in_nmi, r0");
- asm(" tas.b @r0 ! Fend off against addtnl NMIs");
- asm(" bt noNMI");
- asm(" mov.l @r15+, r0");
- asm(" mov.l @r15+, r1");
- asm(" add #4, r15");
- asm(" rte");
- asm(" nop");
- asm(".align 2");
- asm("L_in_nmi: .long _in_nmi");
- asm("noNMI:");
- }
- else
- {
+asm (" add #-4, r15 ! reserve "
+ "spot on stack ");
+asm (" mov.l r1, @-r15 ! push "
+ "R1 ");
- if (n == CPU_BUS_ERROR_VEC)
- {
- /* Exception 9 (bus errors) are disasbleable - so that you
+if (n == NMI_VEC)
+ {
+ /* Special case for NMI - make sure that they don't nest */
+ asm (" mov.l r0, @-r15 ! "
+ "push R0");
+ asm (" mov.l L_in_nmi, r0");
+ asm (" tas.b @r0 ! "
+ "Fend off against addtnl NMIs");
+ asm (" bt noNMI");
+ asm (" mov.l @r15+, r0");
+ asm (" mov.l @r15+, r1");
+ asm (" add #4, r15");
+ asm (" rte");
+ asm (" nop");
+ asm (".align 2");
+ asm ("L_in_nmi: .long _in_nmi");
+ asm ("noNMI:");
+ }
+else
+ {
+ if (n == CPU_BUS_ERROR_VEC)
+ {
+ /* Exception 9 (bus errors) are disasbleable - so that you
can probe memory and get zero instead of a fault.
Because the vector table may be in ROM we don't revector
the interrupt like all the other stubs, we check in here
*/
- asm("mov.l L_dofault,r1");
- asm("mov.l @r1,r1");
- asm("tst r1,r1");
- asm("bf faultaway");
- asm("bsr _handle_buserror");
- asm(".align 2");
- asm("L_dofault: .long _dofault");
- asm("faultaway:");
- }
- asm(" mov #15<<4, r1 ");
- asm(" ldc r1, sr ! disable interrupts ");
- asm(" mov.l r0, @-r15 ! push R0 ");
- }
+ asm ("mov.l L_dofault,r1");
+ asm ("mov.l @r1,r1");
+ asm ("tst r1,r1");
+ asm ("bf faultaway");
+ asm ("bsr _handle_buserror");
+ asm (".align 2");
+ asm ("L_dofault: .long _dofault");
+ asm ("faultaway:");
+ }
+ asm (" mov #15<<4, r1 "
+ " ");
+ asm (" ldc r1, sr ! "
+ "disable interrupts ");
+ asm (" mov.l r0, @-r15 ! "
+ "push R0 ");
+ }
- /* Prepare for saving context, we've already pushed r0 and r1, stick exception number
+/* Prepare for saving context, we've already pushed r0 and r1, stick exception number
into the frame */
- asm(" mov r15, r0 ");
- asm(" add #8, r0 ");
- asm(" mov %0,r1" :: "i" (n) );
- asm(" extu.b r1,r1 ");
- asm(" bra saveRegisters ! save register values ");
- asm(" mov.l r1, @r0 ! save exception # ");
+asm (" mov r15, r0 "
+ " ");
+asm (" add #8, r0 "
+ " ");
+asm (" mov %0,r1" ::"i"(n));
+asm (" extu.b r1,r1 "
+ " ");
+asm (" bra saveRegisters ! save "
+ "register values ");
+asm (" mov.l r1, @r0 ! save "
+ "exception # ");
}
-
-static void
+static void
exceptions (void)
{
- code_for_catch_exception (CPU_BUS_ERROR_VEC);
- code_for_catch_exception (DMA_BUS_ERROR_VEC);
- code_for_catch_exception (INVALID_INSN_VEC);
- code_for_catch_exception (INVALID_SLOT_VEC);
- code_for_catch_exception (NMI_VEC);
- code_for_catch_exception (TRAP_VEC);
- code_for_catch_exception (USER_VEC);
- code_for_catch_exception (IO_VEC);
+code_for_catch_exception (CPU_BUS_ERROR_VEC);
+code_for_catch_exception (DMA_BUS_ERROR_VEC);
+code_for_catch_exception (INVALID_INSN_VEC);
+code_for_catch_exception (INVALID_SLOT_VEC);
+code_for_catch_exception (NMI_VEC);
+code_for_catch_exception (TRAP_VEC);
+code_for_catch_exception (USER_VEC);
+code_for_catch_exception (IO_VEC);
}
-
-
-
-
-
/* Support for Serial I/O using on chip uart */
-#define SMR0 (*(volatile char *)(0x05FFFEC0)) /* Channel 0 serial mode register */
-#define BRR0 (*(volatile char *)(0x05FFFEC1)) /* Channel 0 bit rate register */
-#define SCR0 (*(volatile char *)(0x05FFFEC2)) /* Channel 0 serial control register */
-#define TDR0 (*(volatile char *)(0x05FFFEC3)) /* Channel 0 transmit data register */
-#define SSR0 (*(volatile char *)(0x05FFFEC4)) /* Channel 0 serial status register */
-#define RDR0 (*(volatile char *)(0x05FFFEC5)) /* Channel 0 receive data register */
-
-#define SMR1 (*(volatile char *)(0x05FFFEC8)) /* Channel 1 serial mode register */
-#define BRR1 (*(volatile char *)(0x05FFFEC9)) /* Channel 1 bit rate register */
-#define SCR1 (*(volatile char *)(0x05FFFECA)) /* Channel 1 serial control register */
-#define TDR1 (*(volatile char *)(0x05FFFECB)) /* Channel 1 transmit data register */
-#define SSR1 (*(volatile char *)(0x05FFFECC)) /* Channel 1 serial status register */
-#define RDR1 (*(volatile char *)(0x05FFFECD)) /* Channel 1 receive data register */
+#define SMR0 \
+ (*(volatile char *) (0x05FFFEC0)) /* Channel 0 serial mode register */
+#define BRR0 \
+ (*(volatile char *) (0x05FFFEC1)) /* Channel 0 bit rate register */
+#define SCR0 \
+ (*(volatile char *) (0x05FFFEC2)) /* Channel 0 serial control register */
+#define TDR0 \
+ (*(volatile char *) (0x05FFFEC3)) /* Channel 0 transmit data register */
+#define SSR0 \
+ (*(volatile char *) (0x05FFFEC4)) /* Channel 0 serial status register */
+#define RDR0 \
+ (*(volatile char *) (0x05FFFEC5)) /* Channel 0 receive data register */
+
+#define SMR1 \
+ (*(volatile char *) (0x05FFFEC8)) /* Channel 1 serial mode register */
+#define BRR1 \
+ (*(volatile char *) (0x05FFFEC9)) /* Channel 1 bit rate register */
+#define SCR1 \
+ (*(volatile char *) (0x05FFFECA)) /* Channel 1 serial control register */
+#define TDR1 \
+ (*(volatile char *) (0x05FFFECB)) /* Channel 1 transmit data register */
+#define SSR1 \
+ (*(volatile char *) (0x05FFFECC)) /* Channel 1 serial status register */
+#define RDR1 \
+ (*(volatile char *) (0x05FFFECD)) /* Channel 1 receive data register */
/*
* Serial mode register bits
*/
-#define SYNC_MODE 0x80
-#define SEVEN_BIT_DATA 0x40
-#define PARITY_ON 0x20
-#define ODD_PARITY 0x10
-#define STOP_BITS_2 0x08
-#define ENABLE_MULTIP 0x04
-#define PHI_64 0x03
-#define PHI_16 0x02
-#define PHI_4 0x01
+#define SYNC_MODE 0x80
+#define SEVEN_BIT_DATA 0x40
+#define PARITY_ON 0x20
+#define ODD_PARITY 0x10
+#define STOP_BITS_2 0x08
+#define ENABLE_MULTIP 0x04
+#define PHI_64 0x03
+#define PHI_16 0x02
+#define PHI_4 0x01
/*
* Serial control register bits
*/
-#define SCI_TIE 0x80 /* Transmit interrupt enable */
-#define SCI_RIE 0x40 /* Receive interrupt enable */
-#define SCI_TE 0x20 /* Transmit enable */
-#define SCI_RE 0x10 /* Receive enable */
-#define SCI_MPIE 0x08 /* Multiprocessor interrupt enable */
-#define SCI_TEIE 0x04 /* Transmit end interrupt enable */
-#define SCI_CKE1 0x02 /* Clock enable 1 */
-#define SCI_CKE0 0x01 /* Clock enable 0 */
+#define SCI_TIE 0x80 /* Transmit interrupt enable */
+#define SCI_RIE 0x40 /* Receive interrupt enable */
+#define SCI_TE 0x20 /* Transmit enable */
+#define SCI_RE 0x10 /* Receive enable */
+#define SCI_MPIE 0x08 /* Multiprocessor interrupt enable */
+#define SCI_TEIE 0x04 /* Transmit end interrupt enable */
+#define SCI_CKE1 0x02 /* Clock enable 1 */
+#define SCI_CKE0 0x01 /* Clock enable 0 */
/*
* Serial status register bits
*/
-#define SCI_TDRE 0x80 /* Transmit data register empty */
-#define SCI_RDRF 0x40 /* Receive data register full */
-#define SCI_ORER 0x20 /* Overrun error */
-#define SCI_FER 0x10 /* Framing error */
-#define SCI_PER 0x08 /* Parity error */
-#define SCI_TEND 0x04 /* Transmit end */
-#define SCI_MPB 0x02 /* Multiprocessor bit */
-#define SCI_MPBT 0x01 /* Multiprocessor bit transfer */
-
+#define SCI_TDRE 0x80 /* Transmit data register empty */
+#define SCI_RDRF 0x40 /* Receive data register full */
+#define SCI_ORER 0x20 /* Overrun error */
+#define SCI_FER 0x10 /* Framing error */
+#define SCI_PER 0x08 /* Parity error */
+#define SCI_TEND 0x04 /* Transmit end */
+#define SCI_MPB 0x02 /* Multiprocessor bit */
+#define SCI_MPBT 0x01 /* Multiprocessor bit transfer */
/*
* Port B IO Register (PBIOR)
*/
-#define PBIOR (*(volatile char *)(0x05FFFFC6))
-#define PB15IOR 0x8000
-#define PB14IOR 0x4000
-#define PB13IOR 0x2000
-#define PB12IOR 0x1000
-#define PB11IOR 0x0800
-#define PB10IOR 0x0400
-#define PB9IOR 0x0200
-#define PB8IOR 0x0100
-#define PB7IOR 0x0080
-#define PB6IOR 0x0040
-#define PB5IOR 0x0020
-#define PB4IOR 0x0010
-#define PB3IOR 0x0008
-#define PB2IOR 0x0004
-#define PB1IOR 0x0002
-#define PB0IOR 0x0001
+#define PBIOR (*(volatile char *) (0x05FFFFC6))
+#define PB15IOR 0x8000
+#define PB14IOR 0x4000
+#define PB13IOR 0x2000
+#define PB12IOR 0x1000
+#define PB11IOR 0x0800
+#define PB10IOR 0x0400
+#define PB9IOR 0x0200
+#define PB8IOR 0x0100
+#define PB7IOR 0x0080
+#define PB6IOR 0x0040
+#define PB5IOR 0x0020
+#define PB4IOR 0x0010
+#define PB3IOR 0x0008
+#define PB2IOR 0x0004
+#define PB1IOR 0x0002
+#define PB0IOR 0x0001
/*
* Port B Control Register (PBCR1)
*/
-#define PBCR1 (*(volatile short *)(0x05FFFFCC))
-#define PB15MD1 0x8000
-#define PB15MD0 0x4000
-#define PB14MD1 0x2000
-#define PB14MD0 0x1000
-#define PB13MD1 0x0800
-#define PB13MD0 0x0400
-#define PB12MD1 0x0200
-#define PB12MD0 0x0100
-#define PB11MD1 0x0080
-#define PB11MD0 0x0040
-#define PB10MD1 0x0020
-#define PB10MD0 0x0010
-#define PB9MD1 0x0008
-#define PB9MD0 0x0004
-#define PB8MD1 0x0002
-#define PB8MD0 0x0001
-
-#define PB15MD PB15MD1|PB14MD0
-#define PB14MD PB14MD1|PB14MD0
-#define PB13MD PB13MD1|PB13MD0
-#define PB12MD PB12MD1|PB12MD0
-#define PB11MD PB11MD1|PB11MD0
-#define PB10MD PB10MD1|PB10MD0
-#define PB9MD PB9MD1|PB9MD0
-#define PB8MD PB8MD1|PB8MD0
-
-#define PB_TXD1 PB11MD1
-#define PB_RXD1 PB10MD1
-#define PB_TXD0 PB9MD1
-#define PB_RXD0 PB8MD1
+#define PBCR1 (*(volatile short *) (0x05FFFFCC))
+#define PB15MD1 0x8000
+#define PB15MD0 0x4000
+#define PB14MD1 0x2000
+#define PB14MD0 0x1000
+#define PB13MD1 0x0800
+#define PB13MD0 0x0400
+#define PB12MD1 0x0200
+#define PB12MD0 0x0100
+#define PB11MD1 0x0080
+#define PB11MD0 0x0040
+#define PB10MD1 0x0020
+#define PB10MD0 0x0010
+#define PB9MD1 0x0008
+#define PB9MD0 0x0004
+#define PB8MD1 0x0002
+#define PB8MD0 0x0001
+
+#define PB15MD PB15MD1 | PB14MD0
+#define PB14MD PB14MD1 | PB14MD0
+#define PB13MD PB13MD1 | PB13MD0
+#define PB12MD PB12MD1 | PB12MD0
+#define PB11MD PB11MD1 | PB11MD0
+#define PB10MD PB10MD1 | PB10MD0
+#define PB9MD PB9MD1 | PB9MD0
+#define PB8MD PB8MD1 | PB8MD0
+
+#define PB_TXD1 PB11MD1
+#define PB_RXD1 PB10MD1
+#define PB_TXD0 PB9MD1
+#define PB_RXD0 PB8MD1
/*
* Port B Control Register (PBCR2)
*/
-#define PBCR2 0x05FFFFCE
-#define PB7MD1 0x8000
-#define PB7MD0 0x4000
-#define PB6MD1 0x2000
-#define PB6MD0 0x1000
-#define PB5MD1 0x0800
-#define PB5MD0 0x0400
-#define PB4MD1 0x0200
-#define PB4MD0 0x0100
-#define PB3MD1 0x0080
-#define PB3MD0 0x0040
-#define PB2MD1 0x0020
-#define PB2MD0 0x0010
-#define PB1MD1 0x0008
-#define PB1MD0 0x0004
-#define PB0MD1 0x0002
-#define PB0MD0 0x0001
-
-#define PB7MD PB7MD1|PB7MD0
-#define PB6MD PB6MD1|PB6MD0
-#define PB5MD PB5MD1|PB5MD0
-#define PB4MD PB4MD1|PB4MD0
-#define PB3MD PB3MD1|PB3MD0
-#define PB2MD PB2MD1|PB2MD0
-#define PB1MD PB1MD1|PB1MD0
-#define PB0MD PB0MD1|PB0MD0
-
+#define PBCR2 0x05FFFFCE
+#define PB7MD1 0x8000
+#define PB7MD0 0x4000
+#define PB6MD1 0x2000
+#define PB6MD0 0x1000
+#define PB5MD1 0x0800
+#define PB5MD0 0x0400
+#define PB4MD1 0x0200
+#define PB4MD0 0x0100
+#define PB3MD1 0x0080
+#define PB3MD0 0x0040
+#define PB2MD1 0x0020
+#define PB2MD0 0x0010
+#define PB1MD1 0x0008
+#define PB1MD0 0x0004
+#define PB0MD1 0x0002
+#define PB0MD0 0x0001
+
+#define PB7MD PB7MD1 | PB7MD0
+#define PB6MD PB6MD1 | PB6MD0
+#define PB5MD PB5MD1 | PB5MD0
+#define PB4MD PB4MD1 | PB4MD0
+#define PB3MD PB3MD1 | PB3MD0
+#define PB2MD PB2MD1 | PB2MD0
+#define PB1MD PB1MD1 | PB1MD0
+#define PB0MD PB0MD1 | PB0MD0
#ifdef MHZ
-#define BPS 32 * 9600 * MHZ / ( BAUD * 10)
+#define BPS 32 * 9600 * MHZ / (BAUD * 10)
#else
-#define BPS 32 /* 9600 for 10 Mhz */
+#define BPS 32 /* 9600 for 10 Mhz */
#endif
void handleError (char theSSR);
@@ -1494,90 +1399,89 @@ void handleError (char theSSR);
void
nop (void)
{
-
}
-void
+
+void
init_serial (void)
{
- int i;
+int i;
- /* Clear TE and RE in Channel 1's SCR */
- SCR1 &= ~(SCI_TE | SCI_RE);
+/* Clear TE and RE in Channel 1's SCR */
+SCR1 &= ~(SCI_TE | SCI_RE);
- /* Set communication to be async, 8-bit data, no parity, 1 stop bit and use internal clock */
+/* Set communication to be async, 8-bit data, no parity, 1 stop bit and use internal clock */
- SMR1 = 0;
- BRR1 = BPS;
+SMR1 = 0;
+BRR1 = BPS;
- SCR1 &= ~(SCI_CKE1 | SCI_CKE0);
+SCR1 &= ~(SCI_CKE1 | SCI_CKE0);
- /* let the hardware settle */
+/* let the hardware settle */
- for (i = 0; i < 1000; i++)
- nop ();
+for (i = 0; i < 1000; i++)
+ nop ();
- /* Turn on in and out */
- SCR1 |= SCI_RE | SCI_TE;
+/* Turn on in and out */
+SCR1 |= SCI_RE | SCI_TE;
- /* Set the PFC to make RXD1 (pin PB8) an input pin and TXD1 (pin PB9) an output pin */
- PBCR1 &= ~(PB_TXD1 | PB_RXD1);
- PBCR1 |= PB_TXD1 | PB_RXD1;
+/* Set the PFC to make RXD1 (pin PB8) an input pin and TXD1 (pin PB9) an output pin */
+PBCR1 &= ~(PB_TXD1 | PB_RXD1);
+PBCR1 |= PB_TXD1 | PB_RXD1;
}
-
int
getDebugCharReady (void)
{
- char mySSR;
- mySSR = SSR1 & ( SCI_PER | SCI_FER | SCI_ORER );
- if ( mySSR )
- handleError ( mySSR );
- return SSR1 & SCI_RDRF ;
+char mySSR;
+mySSR = SSR1 & (SCI_PER | SCI_FER | SCI_ORER);
+if (mySSR)
+ handleError (mySSR);
+return SSR1 & SCI_RDRF;
}
-char
+char
getDebugChar (void)
{
- char ch;
- char mySSR;
+char ch;
+char mySSR;
- while ( ! getDebugCharReady())
- ;
+while (!getDebugCharReady ())
+ ;
- ch = RDR1;
- SSR1 &= ~SCI_RDRF;
+ch = RDR1;
+SSR1 &= ~SCI_RDRF;
- mySSR = SSR1 & (SCI_PER | SCI_FER | SCI_ORER);
+mySSR = SSR1 & (SCI_PER | SCI_FER | SCI_ORER);
- if (mySSR)
- handleError (mySSR);
+if (mySSR)
+ handleError (mySSR);
- return ch;
+return ch;
}
-int
+int
putDebugCharReady (void)
{
- return (SSR1 & SCI_TDRE);
+return (SSR1 & SCI_TDRE);
}
void
putDebugChar (char ch)
{
- while (!putDebugCharReady())
- ;
+while (!putDebugCharReady ())
+ ;
- /*
+/*
* Write data into TDR and clear TDRE
*/
- TDR1 = ch;
- SSR1 &= ~SCI_TDRE;
+TDR1 = ch;
+SSR1 &= ~SCI_TDRE;
}
-void
+void
handleError (char theSSR)
{
- SSR1 &= ~(SCI_ORER | SCI_PER | SCI_FER);
+SSR1 &= ~(SCI_ORER | SCI_PER | SCI_FER);
}
#endif
diff --git a/gdb/stubs/sparc-stub.c b/gdb/stubs/sparc-stub.c
index acb7743184d..6015b02d75a 100644
--- a/gdb/stubs/sparc-stub.c
+++ b/gdb/stubs/sparc-stub.c
@@ -89,39 +89,106 @@
* external low-level support routines
*/
-extern void putDebugChar(); /* write a single character */
-extern int getDebugChar(); /* read and return a single char */
+extern void putDebugChar (); /* write a single character */
+extern int getDebugChar (); /* read and return a single char */
/************************************************************************/
/* BUFMAX defines the maximum number of characters in inbound/outbound buffers*/
/* at least NUMREGBYTES*2 are needed for register packets */
#define BUFMAX 2048
-static int initialized = 0; /* !0 means we've been initialized */
+static int initialized = 0; /* !0 means we've been initialized */
-static void set_mem_fault_trap();
+static void set_mem_fault_trap ();
-static const char hexchars[]="0123456789abcdef";
+static const char hexchars[] = "0123456789abcdef";
#define NUMREGS 72
/* Number of bytes of registers. */
#define NUMREGBYTES (NUMREGS * 4)
-enum regnames {G0, G1, G2, G3, G4, G5, G6, G7,
- O0, O1, O2, O3, O4, O5, SP, O7,
- L0, L1, L2, L3, L4, L5, L6, L7,
- I0, I1, I2, I3, I4, I5, FP, I7,
- F0, F1, F2, F3, F4, F5, F6, F7,
- F8, F9, F10, F11, F12, F13, F14, F15,
- F16, F17, F18, F19, F20, F21, F22, F23,
- F24, F25, F26, F27, F28, F29, F30, F31,
- Y, PSR, WIM, TBR, PC, NPC, FPSR, CPSR };
+enum regnames
+{
+ G0,
+ G1,
+ G2,
+ G3,
+ G4,
+ G5,
+ G6,
+ G7,
+ O0,
+ O1,
+ O2,
+ O3,
+ O4,
+ O5,
+ SP,
+ O7,
+ L0,
+ L1,
+ L2,
+ L3,
+ L4,
+ L5,
+ L6,
+ L7,
+ I0,
+ I1,
+ I2,
+ I3,
+ I4,
+ I5,
+ FP,
+ I7,
+
+ F0,
+ F1,
+ F2,
+ F3,
+ F4,
+ F5,
+ F6,
+ F7,
+ F8,
+ F9,
+ F10,
+ F11,
+ F12,
+ F13,
+ F14,
+ F15,
+ F16,
+ F17,
+ F18,
+ F19,
+ F20,
+ F21,
+ F22,
+ F23,
+ F24,
+ F25,
+ F26,
+ F27,
+ F28,
+ F29,
+ F30,
+ F31,
+ Y,
+ PSR,
+ WIM,
+ TBR,
+ PC,
+ NPC,
+ FPSR,
+ CPSR
+};
/*************************** ASSEMBLY CODE MACROS *************************/
/* */
-extern void trap_low();
+extern void trap_low ();
asm("
.reserve trapstack, 1000 * 4, \"bss\", 8
@@ -272,11 +339,11 @@ static int
hex (unsigned char ch)
{
if (ch >= 'a' && ch <= 'f')
- return ch-'a'+10;
+ return ch - 'a' + 10;
if (ch >= '0' && ch <= '9')
- return ch-'0';
+ return ch - '0';
if (ch >= 'A' && ch <= 'F')
- return ch-'A'+10;
+ return ch - 'A' + 10;
return -1;
}
@@ -300,7 +367,7 @@ getpacket (void)
while ((ch = getDebugChar ()) != '$')
;
-retry:
+ retry:
checksum = 0;
xmitcsum = -1;
count = 0;
@@ -328,11 +395,11 @@ retry:
if (checksum != xmitcsum)
{
- putDebugChar ('-'); /* failed checksum */
+ putDebugChar ('-'); /* failed checksum */
}
else
{
- putDebugChar ('+'); /* successful transfer */
+ putDebugChar ('+'); /* successful transfer */
/* if a sequence char is present, reply the sequence ID */
if (buffer[2] == ':')
@@ -361,23 +428,22 @@ putpacket (unsigned char *buffer)
/* $<packet info>#<checksum>. */
do
{
- putDebugChar('$');
+ putDebugChar ('$');
checksum = 0;
count = 0;
while (ch = buffer[count])
{
- putDebugChar(ch);
+ putDebugChar (ch);
checksum += ch;
count += 1;
}
- putDebugChar('#');
- putDebugChar(hexchars[checksum >> 4]);
- putDebugChar(hexchars[checksum & 0xf]);
-
+ putDebugChar ('#');
+ putDebugChar (hexchars[checksum >> 4]);
+ putDebugChar (hexchars[checksum & 0xf]);
}
- while (getDebugChar() != '+');
+ while (getDebugChar () != '+');
}
/* Indicate to caller of mem2hex or hex2mem that there has been an
@@ -396,7 +462,7 @@ mem2hex (unsigned char *mem, unsigned char *buf, int count, int may_fault)
{
unsigned char ch;
- set_mem_fault_trap(may_fault);
+ set_mem_fault_trap (may_fault);
while (count-- > 0)
{
@@ -409,7 +475,7 @@ mem2hex (unsigned char *mem, unsigned char *buf, int count, int may_fault)
*buf = 0;
- set_mem_fault_trap(0);
+ set_mem_fault_trap (0);
return buf;
}
@@ -423,18 +489,18 @@ hex2mem (unsigned char *buf, unsigned char *mem, int count, int may_fault)
int i;
unsigned char ch;
- set_mem_fault_trap(may_fault);
+ set_mem_fault_trap (may_fault);
- for (i=0; i<count; i++)
+ for (i = 0; i < count; i++)
{
- ch = hex(*buf++) << 4;
- ch |= hex(*buf++);
+ ch = hex (*buf++) << 4;
+ ch |= hex (*buf++);
*mem++ = ch;
if (mem_err)
return 0;
}
- set_mem_fault_trap(0);
+ set_mem_fault_trap (0);
return mem;
}
@@ -445,8 +511,8 @@ hex2mem (unsigned char *buf, unsigned char *mem, int count, int may_fault)
static struct hard_trap_info
{
- unsigned char tt; /* Trap type code for SPARClite */
- unsigned char signo; /* Signal that we map this trap into */
+ unsigned char tt; /* Trap type code for SPARClite */
+ unsigned char signo; /* Signal that we map this trap into */
} hard_trap_info[] = {
{1, SIGSEGV}, /* instruction access error */
{2, SIGILL}, /* privileged instruction */
@@ -468,7 +534,7 @@ set_debug_traps (void)
struct hard_trap_info *ht;
for (ht = hard_trap_info; ht->tt && ht->signo; ht++)
- exceptionHandler(ht->tt, trap_low);
+ exceptionHandler (ht->tt, trap_low);
initialized = 1;
}
@@ -492,13 +558,13 @@ _fltr_set_mem_err:
static void
set_mem_fault_trap (int enable)
{
- extern void fltr_set_mem_err();
+ extern void fltr_set_mem_err ();
mem_err = 0;
if (enable)
- exceptionHandler(9, fltr_set_mem_err);
+ exceptionHandler (9, fltr_set_mem_err);
else
- exceptionHandler(9, trap_low);
+ exceptionHandler (9, trap_low);
}
/* Convert the SPARC hardware trap type code to a unix signal number. */
@@ -512,7 +578,7 @@ computeSignal (int tt)
if (ht->tt == tt)
return ht->signo;
- return SIGHUP; /* default for things we don't know about */
+ return SIGHUP; /* default for things we don't know about */
}
/*
@@ -530,12 +596,12 @@ hexToInt(char **ptr, int *intValue)
while (**ptr)
{
- hexValue = hex(**ptr);
+ hexValue = hex (**ptr);
if (hexValue < 0)
break;
*intValue = (*intValue << 4) | hexValue;
- numChars ++;
+ numChars++;
(*ptr)++;
}
@@ -554,14 +620,14 @@ extern void breakinst();
static void
handle_exception (unsigned long *registers)
{
- int tt; /* Trap type */
+ int tt; /* Trap type */
int sigval;
int addr;
int length;
char *ptr;
unsigned long *sp;
-/* First, we must force all of the windows to be spilled out */
+ /* First, we must force all of the windows to be spilled out */
asm(" save %sp, -64, %sp
save %sp, -64, %sp
@@ -583,8 +649,8 @@ handle_exception (unsigned long *registers)
if (registers[PC] == (unsigned long)breakinst)
{
- registers[PC] = registers[NPC];
- registers[NPC] += 4;
+ registers[PC] = registers[NPC];
+ registers[NPC] += 4;
}
sp = (unsigned long *)registers[SP];
@@ -635,128 +701,123 @@ handle_exception (unsigned long *registers)
while (1)
{
- remcomOutBuffer[0] = 0;
-
- ptr = getpacket();
- switch (*ptr++)
- {
- case '?':
- remcomOutBuffer[0] = 'S';
- remcomOutBuffer[1] = hexchars[sigval >> 4];
- remcomOutBuffer[2] = hexchars[sigval & 0xf];
- remcomOutBuffer[3] = 0;
- break;
+ remcomOutBuffer[0] = 0;
+
+ ptr = getpacket ();
+ switch (*ptr++)
+ {
+ case '?':
+ remcomOutBuffer[0] = 'S';
+ remcomOutBuffer[1] = hexchars[sigval >> 4];
+ remcomOutBuffer[2] = hexchars[sigval & 0xf];
+ remcomOutBuffer[3] = 0;
+ break;
- case 'd': /* toggle debug flag */
- break;
+ case 'd': /* toggle debug flag */
+ break;
- case 'g': /* return the value of the CPU registers */
- {
- ptr = remcomOutBuffer;
- ptr = mem2hex((char *)registers, ptr, 16 * 4, 0); /* G & O regs */
- ptr = mem2hex(sp + 0, ptr, 16 * 4, 0); /* L & I regs */
- memset(ptr, '0', 32 * 8); /* Floating point */
- mem2hex((char *)&registers[Y],
- ptr + 32 * 4 * 2,
- 8 * 4,
- 0); /* Y, PSR, WIM, TBR, PC, NPC, FPSR, CPSR */
- }
- break;
+ case 'g': /* return the value of the CPU registers */
+ {
+ ptr = remcomOutBuffer;
+ ptr = mem2hex ((char *) registers, ptr, 16 * 4, 0); /* G & O regs */
+ ptr = mem2hex (sp + 0, ptr, 16 * 4, 0); /* L & I regs */
+ memset (ptr, '0', 32 * 8); /* Floating point */
+ mem2hex ((char *) &registers[Y], ptr + 32 * 4 * 2, 8 * 4,
+ 0); /* Y, PSR, WIM, TBR, PC, NPC, FPSR, CPSR */
+ }
+ break;
- case 'G': /* set the value of the CPU registers - return OK */
- {
- unsigned long *newsp, psr;
+ case 'G': /* set the value of the CPU registers - return OK */
+ {
+ unsigned long *newsp, psr;
- psr = registers[PSR];
+ psr = registers[PSR];
- hex2mem(ptr, (char *)registers, 16 * 4, 0); /* G & O regs */
- hex2mem(ptr + 16 * 4 * 2, sp + 0, 16 * 4, 0); /* L & I regs */
- hex2mem(ptr + 64 * 4 * 2, (char *)&registers[Y],
- 8 * 4, 0); /* Y, PSR, WIM, TBR, PC, NPC, FPSR, CPSR */
+ hex2mem (ptr, (char *) registers, 16 * 4, 0); /* G & O regs */
+ hex2mem (ptr + 16 * 4 * 2, sp + 0, 16 * 4, 0); /* L & I regs */
+ hex2mem (ptr + 64 * 4 * 2, (char *) &registers[Y], 8 * 4,
+ 0); /* Y, PSR, WIM, TBR, PC, NPC, FPSR, CPSR */
- /* See if the stack pointer has moved. If so, then copy the saved
+ /* See if the stack pointer has moved. If so, then copy the saved
locals and ins to the new location. This keeps the window
overflow and underflow routines happy. */
- newsp = (unsigned long *)registers[SP];
- if (sp != newsp)
- sp = memcpy(newsp, sp, 16 * 4);
+ newsp = (unsigned long *) registers[SP];
+ if (sp != newsp)
+ sp = memcpy (newsp, sp, 16 * 4);
- /* Don't allow CWP to be modified. */
+ /* Don't allow CWP to be modified. */
- if (psr != registers[PSR])
- registers[PSR] = (psr & 0x1f) | (registers[PSR] & ~0x1f);
+ if (psr != registers[PSR])
+ registers[PSR] = (psr & 0x1f) | (registers[PSR] & ~0x1f);
- strcpy(remcomOutBuffer,"OK");
- }
- break;
+ strcpy (remcomOutBuffer, "OK");
+ }
+ break;
- case 'm': /* mAA..AA,LLLL Read LLLL bytes at address AA..AA */
- /* Try to read %x,%x. */
+ case 'm': /* mAA..AA,LLLL Read LLLL bytes at address AA..AA */
+ /* Try to read %x,%x. */
- if (hexToInt(&ptr, &addr)
- && *ptr++ == ','
- && hexToInt(&ptr, &length))
- {
- if (mem2hex((char *)addr, remcomOutBuffer, length, 1))
- break;
+ if (hexToInt (&ptr, &addr) && *ptr++ == ','
+ && hexToInt (&ptr, &length))
+ {
+ if (mem2hex ((char *) addr, remcomOutBuffer, length, 1))
+ break;
- strcpy (remcomOutBuffer, "E03");
- }
- else
- strcpy(remcomOutBuffer,"E01");
- break;
+ strcpy (remcomOutBuffer, "E03");
+ }
+ else
+ strcpy (remcomOutBuffer, "E01");
+ break;
- case 'M': /* MAA..AA,LLLL: Write LLLL bytes at address AA.AA return OK */
- /* Try to read '%x,%x:'. */
+ case 'M': /* MAA..AA,LLLL: Write LLLL bytes at address AA.AA return OK */
+ /* Try to read '%x,%x:'. */
- if (hexToInt(&ptr, &addr)
- && *ptr++ == ','
- && hexToInt(&ptr, &length)
- && *ptr++ == ':')
- {
- if (hex2mem(ptr, (char *)addr, length, 1))
- strcpy(remcomOutBuffer, "OK");
- else
- strcpy(remcomOutBuffer, "E03");
- }
- else
- strcpy(remcomOutBuffer, "E02");
- break;
+ if (hexToInt (&ptr, &addr) && *ptr++ == ',' && hexToInt (&ptr, &length)
+ && *ptr++ == ':')
+ {
+ if (hex2mem (ptr, (char *) addr, length, 1))
+ strcpy (remcomOutBuffer, "OK");
+ else
+ strcpy (remcomOutBuffer, "E03");
+ }
+ else
+ strcpy (remcomOutBuffer, "E02");
+ break;
- case 'c': /* cAA..AA Continue at address AA..AA(optional) */
- /* try to read optional parameter, pc unchanged if no parm */
+ case 'c': /* cAA..AA Continue at address AA..AA(optional) */
+ /* try to read optional parameter, pc unchanged if no parm */
- if (hexToInt(&ptr, &addr))
- {
- registers[PC] = addr;
- registers[NPC] = addr + 4;
- }
+ if (hexToInt (&ptr, &addr))
+ {
+ registers[PC] = addr;
+ registers[NPC] = addr + 4;
+ }
-/* Need to flush the instruction cache here, as we may have deposited a
+ /* Need to flush the instruction cache here, as we may have deposited a
breakpoint, and the icache probably has no way of knowing that a data ref to
some location may have changed something that is in the instruction cache.
*/
- flush_i_cache();
- return;
+ flush_i_cache ();
+ return;
- /* kill the program */
- case 'k' : /* do nothing */
- break;
+ /* kill the program */
+ case 'k': /* do nothing */
+ break;
#if 0
case 't': /* Test feature */
asm (" std %f30,[%sp]");
break;
#endif
- case 'r': /* Reset */
+ case 'r': /* Reset */
asm ("call 0
nop ");
break;
- } /* switch */
+ } /* switch */
- /* reply to the request */
- putpacket(remcomOutBuffer);
+ /* reply to the request */
+ putpacket (remcomOutBuffer);
}
}
diff --git a/gdb/stubs/z80-stub.c b/gdb/stubs/z80-stub.c
index c85b28c179d..bd4525d9fe6 100644
--- a/gdb/stubs/z80-stub.c
+++ b/gdb/stubs/z80-stub.c
@@ -167,16 +167,16 @@ void debug_nmi (void);
*/
void debug_int (void);
-#define EX_SWBREAK 0 /* sw breakpoint */
-#define EX_HWBREAK -1 /* hw breakpoint */
-#define EX_WWATCH -2 /* memory write watch */
-#define EX_RWATCH -3 /* memory read watch */
-#define EX_AWATCH -4 /* memory access watch */
-#define EX_SIGINT 2
-#define EX_SIGTRAP 5
-#define EX_SIGABRT 6
-#define EX_SIGBUS 10
-#define EX_SIGSEGV 11
+#define EX_SWBREAK 0 /* sw breakpoint */
+#define EX_HWBREAK -1 /* hw breakpoint */
+#define EX_WWATCH -2 /* memory write watch */
+#define EX_RWATCH -3 /* memory read watch */
+#define EX_AWATCH -4 /* memory access watch */
+#define EX_SIGINT 2
+#define EX_SIGTRAP 5
+#define EX_SIGABRT 6
+#define EX_SIGBUS 10
+#define EX_SIGSEGV 11
/* or any standard *nix signal value */
/* Enter to debug mode (after receiving BREAK from GDB, for example)
@@ -188,7 +188,7 @@ void debug_int (void);
void debug_exception (int ex);
/* Prints to debugger console. */
-void debug_print(const char *str);
+void debug_print (const char *str);
/******************************************************************************\
Required functions
\******************************************************************************/
@@ -197,12 +197,12 @@ extern int getDebugChar (void);
extern void putDebugChar (int ch);
#ifdef DBG_SWBREAK
-#define DO_EXPAND(VAL) VAL ## 123456
-#define EXPAND(VAL) DO_EXPAND(VAL)
+#define DO_EXPAND(VAL) VAL##123456
+#define EXPAND(VAL) DO_EXPAND (VAL)
#if EXPAND(DBG_SWBREAK) != 123456
#define DBG_SWBREAK_PROC DBG_SWBREAK
-extern int DBG_SWBREAK(int set, void *addr);
+extern int DBG_SWBREAK (int set, void *addr);
#endif
#undef EXPAND
@@ -210,23 +210,23 @@ extern int DBG_SWBREAK(int set, void *addr);
#endif /* DBG_SWBREAK */
#ifdef DBG_HWBREAK
-extern int DBG_HWBREAK(int set, void *addr);
+extern int DBG_HWBREAK (int set, void *addr);
#endif
#ifdef DBG_MEMCPY
-extern void* DBG_MEMCPY (void *dest, const void *src, unsigned n);
+extern void *DBG_MEMCPY (void *dest, const void *src, unsigned n);
#endif
#ifdef DBG_WWATCH
-extern int DBG_WWATCH(int set, void *addr, unsigned size);
+extern int DBG_WWATCH (int set, void *addr, unsigned size);
#endif
#ifdef DBG_RWATCH
-extern int DBG_RWATCH(int set, void *addr, unsigned size);
+extern int DBG_RWATCH (int set, void *addr, unsigned size);
#endif
#ifdef DBG_AWATCH
-extern int DBG_AWATCH(int set, void *addr, unsigned size);
+extern int DBG_AWATCH (int set, void *addr, unsigned size);
#endif
/******************************************************************************\
@@ -236,7 +236,7 @@ extern int DBG_AWATCH(int set, void *addr, unsigned size);
#include <string.h>
#ifndef NULL
-# define NULL (void*)0
+#define NULL (void *) 0
#endif
typedef unsigned char byte;
@@ -244,40 +244,40 @@ typedef unsigned short word;
/* CPU state */
#ifdef __SDCC_ez80_adl
-# define REG_SIZE 3
+#define REG_SIZE 3
#else
-# define REG_SIZE 2
+#define REG_SIZE 2
#endif /* __SDCC_ez80_adl */
-#define R_AF (0*REG_SIZE)
-#define R_BC (1*REG_SIZE)
-#define R_DE (2*REG_SIZE)
-#define R_HL (3*REG_SIZE)
-#define R_SP (4*REG_SIZE)
-#define R_PC (5*REG_SIZE)
+#define R_AF (0 * REG_SIZE)
+#define R_BC (1 * REG_SIZE)
+#define R_DE (2 * REG_SIZE)
+#define R_HL (3 * REG_SIZE)
+#define R_SP (4 * REG_SIZE)
+#define R_PC (5 * REG_SIZE)
#ifndef __SDCC_gbz80
-#define R_IX (6*REG_SIZE)
-#define R_IY (7*REG_SIZE)
-#define R_AF_ (8*REG_SIZE)
-#define R_BC_ (9*REG_SIZE)
-#define R_DE_ (10*REG_SIZE)
-#define R_HL_ (11*REG_SIZE)
-#define R_IR (12*REG_SIZE)
+#define R_IX (6 * REG_SIZE)
+#define R_IY (7 * REG_SIZE)
+#define R_AF_ (8 * REG_SIZE)
+#define R_BC_ (9 * REG_SIZE)
+#define R_DE_ (10 * REG_SIZE)
+#define R_HL_ (11 * REG_SIZE)
+#define R_IR (12 * REG_SIZE)
#ifdef __SDCC_ez80_adl
-#define R_SPS (13*REG_SIZE)
-#define NUMREGBYTES (14*REG_SIZE)
+#define R_SPS (13 * REG_SIZE)
+#define NUMREGBYTES (14 * REG_SIZE)
#else
-#define NUMREGBYTES (13*REG_SIZE)
+#define NUMREGBYTES (13 * REG_SIZE)
#endif /* __SDCC_ez80_adl */
#else
-#define NUMREGBYTES (6*REG_SIZE)
+#define NUMREGBYTES (6 * REG_SIZE)
#define FASTCALL
#endif /*__SDCC_gbz80 */
static byte state[NUMREGBYTES];
-#if DBG_PACKET_SIZE < (NUMREGBYTES*2+5)
+#if DBG_PACKET_SIZE < (NUMREGBYTES * 2 + 5)
#error "Too small DBG_PACKET_SIZE"
#endif
@@ -288,7 +288,7 @@ static byte state[NUMREGBYTES];
/* dedicated stack */
#ifdef DBG_STACK_SIZE
-#define LOAD_SP ld sp, #_stack + DBG_STACK_SIZE
+#define LOAD_SP ld sp, #_stack + DBG_STACK_SIZE
static char stack[DBG_STACK_SIZE];
@@ -326,22 +326,15 @@ static void rest_cpu_state (void);
void
debug_swbreak (void) __naked
{
- __asm
- ld (#_state + R_SP), sp
- LOAD_SP
- call _save_cpu_state
- ld hl, #-DBG_SWBREAK_SIZE
- push hl
- ld hl, #EX_SWBREAK
- push hl
- call _stub_main
- .globl _break_handler
+ __asm ld (#_state + R_SP), sp LOAD_SP call _save_cpu_state ld hl,
+#- DBG_SWBREAK_SIZE push hl ld hl,
+#EX_SWBREAK push hl call _stub_main.globl _break_handler
#ifdef DBG_SWBREAK_RST
-_break_handler = DBG_SWBREAK_RST
+ _break_handler = DBG_SWBREAK_RST
#else
-_break_handler = _debug_swbreak
+ _break_handler = _debug_swbreak
#endif
- __endasm;
+ __endasm;
}
#endif /* DBG_SWBREAK */
/******************************************************************************/
@@ -352,94 +345,58 @@ _break_handler = _debug_swbreak
void
debug_hwbreak (void) __naked
{
- __asm
- ld (#_state + R_SP), sp
- LOAD_SP
- call _save_cpu_state
- ld hl, #-DBG_HWBREAK_SIZE
- push hl
- ld hl, #EX_HWBREAK
- push hl
- call _stub_main
- __endasm;
+ __asm ld (#_state + R_SP), sp LOAD_SP call _save_cpu_state ld hl,
+#- DBG_HWBREAK_SIZE push hl ld hl,
+#EX_HWBREAK push hl call _stub_main __endasm;
}
#endif /* DBG_HWBREAK_SET */
/******************************************************************************/
void
debug_exception (int ex) __naked
{
- __asm
- ld (#_state + R_SP), sp
- LOAD_SP
- call _save_cpu_state
- ld hl, #0
- push hl
+ __asm ld (#_state + R_SP), sp LOAD_SP call _save_cpu_state ld hl,
+# 0 push hl
#ifdef __SDCC_gbz80
- ld hl, #_state + R_SP
- ld a, (hl+)
- ld h, (hl)
- ld l, a
+ ld hl,
+#_state + R_SP ld a, (hl +) ld h, (hl) ld l,
+ a
#else
- ld hl, (#_state + R_SP)
+ ld hl,
+ (#_state + R_SP)
#endif
- inc hl
- inc hl
- ld e, (hl)
- inc hl
- ld d, (hl)
- push de
- call _stub_main
- __endasm;
- (void)ex;
+ inc hl inc hl ld e,
+ (hl) inc hl ld d, (hl) push de call _stub_main __endasm;
+ (void) ex;
}
+
/******************************************************************************/
#ifndef __SDCC_gbz80
void
-debug_nmi(void) __naked
+debug_nmi (void) __naked
{
- __asm
- ld (#_state + R_SP), sp
- LOAD_SP
- call _save_cpu_state
- ld hl, #0 ;pc_adj
- push hl
- ld hl, #DBG_NMI_EX
- push hl
- ld hl, #_stub_main
- push hl
- push hl
- retn
- __endasm;
+ __asm ld (#_state + R_SP), sp LOAD_SP call _save_cpu_state ld hl, #0;
+ pc_adj push hl ld hl, #DBG_NMI_EX push hl ld hl,
+#_stub_main push hl push hl retn __endasm;
}
#endif
/******************************************************************************/
void
-debug_int(void) __naked
+debug_int (void) __naked
{
- __asm
- ld (#_state + R_SP), sp
- LOAD_SP
- call _save_cpu_state
- ld hl, #0 ;pc_adj
- push hl
- ld hl, #DBG_INT_EX
- push hl
- ld hl, #_stub_main
- push hl
- push hl
- ei
- reti
- __endasm;
+ __asm ld (#_state + R_SP), sp LOAD_SP call _save_cpu_state ld hl, #0;
+ pc_adj push hl ld hl, #DBG_INT_EX push hl ld hl,
+#_stub_main push hl push hl ei reti __endasm;
}
+
/******************************************************************************/
#ifdef DBG_PRINT
void
-debug_print(const char *str)
+debug_print (const char *str)
{
putDebugChar ('$');
putDebugChar ('O');
char csum = 'O';
- for (; *str != '\0'; )
+ for (; *str != '\0';)
{
char c = high_hex (*str);
csum += c;
@@ -455,11 +412,16 @@ debug_print(const char *str)
#endif /* DBG_PRINT */
/******************************************************************************/
static void store_pc_sp (int pc_adj) FASTCALL;
-#define get_reg_value(mem) (*(void* const*)(mem))
-#define set_reg_value(mem,val) do { (*(void**)(mem) = (val)); } while (0)
-static char* byte2hex(char *buf, byte val);
+#define get_reg_value(mem) (*(void *const *) (mem))
+#define set_reg_value(mem, val) \
+ do \
+ { \
+ (*(void **) (mem) = (val)); \
+ } \
+ while (0)
+static char *byte2hex (char *buf, byte val);
static int hex2int (const char **buf) FASTCALL;
-static char* int2hex (char *buf, int v);
+static char *int2hex (char *buf, int v);
static void get_packet (char *buffer);
static void put_packet (const char *buffer);
static char process (char *buffer) FASTCALL;
@@ -468,8 +430,8 @@ static void rest_cpu_state (void);
static void
stub_main (int ex, int pc_adj)
{
- char buffer[DBG_PACKET_SIZE+1];
- sigval = (signed char)ex;
+ char buffer[DBG_PACKET_SIZE + 1];
+ sigval = (signed char) ex;
store_pc_sp (pc_adj);
DBG_ENTER
@@ -500,8 +462,9 @@ get_packet (char *buffer)
for (;; putDebugChar ('-'))
{
/* wait for packet start character */
- while (getDebugChar () != '$');
-retry:
+ while (getDebugChar () != '$')
+ ;
+ retry:
csum = 0;
esc = 0;
p = buffer;
@@ -526,7 +489,7 @@ retry:
csum += ch;
}
while (count != 0);
-finish:
+ finish:
*p = '\0';
if (ch != '#') /* packet is too large */
continue;
@@ -550,15 +513,17 @@ put_packet (const char *buffer)
putDebugChar ('$');
char checksum = put_packet_info (buffer);
putDebugChar ('#');
- putDebugChar (high_hex(checksum));
- putDebugChar (low_hex(checksum));
+ putDebugChar (high_hex (checksum));
+ putDebugChar (low_hex (checksum));
for (;;)
{
char c = getDebugChar ();
switch (c)
{
- case '+': return;
- case '-': break;
+ case '+':
+ return;
+ case '-':
+ break;
default:
putDebugChar (c);
continue;
@@ -617,7 +582,7 @@ process_question (char *p) FASTCALL
sig = sigval;
if (sig <= 0)
sig = EX_SIGTRAP;
- p = byte2hex (p, (byte)sig);
+ p = byte2hex (p, (byte) sig);
*p = '\0';
return 0;
}
@@ -632,11 +597,12 @@ process_question (char *p) FASTCALL
sig = sigval;
if (sig <= 0)
sig = EX_SIGTRAP;
- p = byte2hex (p, (byte)sig);
- p = format_reg_value(p, R_AF/REG_SIZE, &state[R_AF]);
- p = format_reg_value(p, R_SP/REG_SIZE, &state[R_SP]);
- p = format_reg_value(p, R_PC/REG_SIZE, &state[R_PC]);
-#if defined(DBG_SWBREAK_PROC) || defined(DBG_HWBREAK) || defined(DBG_WWATCH) || defined(DBG_RWATCH) || defined(DBG_AWATCH)
+ p = byte2hex (p, (byte) sig);
+ p = format_reg_value (p, R_AF / REG_SIZE, &state[R_AF]);
+ p = format_reg_value (p, R_SP / REG_SIZE, &state[R_SP]);
+ p = format_reg_value (p, R_PC / REG_SIZE, &state[R_PC]);
+#if defined(DBG_SWBREAK_PROC) || defined(DBG_HWBREAK) || defined(DBG_WWATCH) \
+ || defined(DBG_RWATCH) || defined(DBG_AWATCH)
const char *reason;
unsigned addr = 0;
switch (sigval)
@@ -677,7 +643,7 @@ process_question (char *p) FASTCALL
--p;
*p++ = ':';
if (addr != 0)
- p = int2hex(p, addr);
+ p = int2hex (p, addr);
*p++ = ';';
finish:
#endif /* DBG_HWBREAK, DBG_WWATCH, DBG_RWATCH, DBG_AWATCH */
@@ -687,8 +653,8 @@ finish:
#endif /* DBG_MINSIZE */
#define STRING2(x) #x
-#define STRING1(x) STRING2(x)
-#define STRING(x) STRING1(x)
+#define STRING1(x) STRING2 (x)
+#define STRING(x) STRING1 (x)
#ifdef DBG_MEMORY_MAP
static void read_memory_map (char *buffer, unsigned offset, unsigned length);
#endif
@@ -743,7 +709,7 @@ process_q (char *buffer) FASTCALL
{
/* Just report that GDB attached to existing process
if it is not applicable for you, then send patches */
- memcpy(buffer, "1", 2);
+ memcpy (buffer, "1", 2);
return 0;
}
#endif /* DBG_MIN_SIZE */
@@ -769,25 +735,25 @@ process_G (char *buffer) FASTCALL
static signed char
process_m (char *buffer) FASTCALL
-{/* mAA..AA,LLLL Read LLLL bytes at address AA..AA */
+{ /* mAA..AA,LLLL Read LLLL bytes at address AA..AA */
char *p = &buffer[1];
- byte *addr = (void*)hex2int(&p);
+ byte *addr = (void *) hex2int (&p);
if (*p++ != ',')
return 1;
- unsigned len = (unsigned)hex2int(&p);
+ unsigned len = (unsigned) hex2int (&p);
if (len == 0)
return 2;
- if (len > DBG_PACKET_SIZE/2)
+ if (len > DBG_PACKET_SIZE / 2)
return 3;
p = buffer;
#ifdef DBG_MEMCPY
do
{
byte tmp[16];
- unsigned tlen = sizeof(tmp);
+ unsigned tlen = sizeof (tmp);
if (tlen > len)
tlen = len;
- if (!DBG_MEMCPY(tmp, addr, tlen))
+ if (!DBG_MEMCPY (tmp, addr, tlen))
return 4;
p = mem2hex (p, tmp, tlen);
addr += tlen;
@@ -802,31 +768,31 @@ process_m (char *buffer) FASTCALL
static signed char
process_M (char *buffer) FASTCALL
-{/* MAA..AA,LLLL: Write LLLL bytes at address AA.AA return OK */
+{ /* MAA..AA,LLLL: Write LLLL bytes at address AA.AA return OK */
char *p = &buffer[1];
- byte *addr = (void*)hex2int(&p);
+ byte *addr = (void *) hex2int (&p);
if (*p != ',')
return 1;
++p;
- unsigned len = (unsigned)hex2int(&p);
+ unsigned len = (unsigned) hex2int (&p);
if (*p++ != ':')
return 2;
if (len == 0)
goto end;
- if (len*2 + (p - buffer) > DBG_PACKET_SIZE)
+ if (len * 2 + (p - buffer) > DBG_PACKET_SIZE)
return 3;
#ifdef DBG_MEMCPY
do
{
byte tmp[16];
- unsigned tlen = sizeof(tmp);
+ unsigned tlen = sizeof (tmp);
if (tlen > len)
tlen = len;
p = hex2mem (tmp, p, tlen);
- if (!DBG_MEMCPY(addr, tmp, tlen))
+ if (!DBG_MEMCPY (addr, tmp, tlen))
return 4;
addr += tlen;
- len -= tlen;
+ len -= tlen;
}
while (len);
#else
@@ -841,13 +807,13 @@ end:
#ifndef DBG_MIN_SIZE
static signed char
process_X (char *buffer) FASTCALL
-{/* XAA..AA,LLLL: Write LLLL binary bytes at address AA.AA return OK */
+{ /* XAA..AA,LLLL: Write LLLL binary bytes at address AA.AA return OK */
char *p = &buffer[1];
- byte *addr = (void*)hex2int(&p);
+ byte *addr = (void *) hex2int (&p);
if (*p != ',')
return 1;
++p;
- unsigned len = (unsigned)hex2int(&p);
+ unsigned len = (unsigned) hex2int (&p);
if (*p++ != ':')
return 2;
if (len == 0)
@@ -855,7 +821,7 @@ process_X (char *buffer) FASTCALL
if (len + (p - buffer) > DBG_PACKET_SIZE)
return 3;
#ifdef DBG_MEMCPY
- if (!DBG_MEMCPY(addr, p, len))
+ if (!DBG_MEMCPY (addr, p, len))
return 4;
#else
memcpy (addr, p, len);
@@ -865,22 +831,22 @@ end:
*buffer = '\0';
return 0;
}
-#else /* DBG_MIN_SIZE */
+#else /* DBG_MIN_SIZE */
static signed char
process_X (char *buffer) FASTCALL
{
- (void)buffer;
+ (void) buffer;
return -1;
}
#endif /* DBG_MIN_SIZE */
static signed char
process_c (char *buffer) FASTCALL
-{/* 'cAAAA' - Continue at address AAAA(optional) */
+{ /* 'cAAAA' - Continue at address AAAA(optional) */
const char *p = &buffer[1];
if (*p != '\0')
{
- void *addr = (void*)hex2int(&p);
+ void *addr = (void *) hex2int (&p);
set_reg_value (&state[R_PC], addr);
}
rest_cpu_state ();
@@ -889,17 +855,17 @@ process_c (char *buffer) FASTCALL
static signed char
process_D (char *buffer) FASTCALL
-{/* 'D' - detach the program: continue execution */
+{ /* 'D' - detach the program: continue execution */
*buffer = '\0';
return -2;
}
static signed char
process_k (char *buffer) FASTCALL
-{/* 'k' - Kill the program */
+{ /* 'k' - Kill the program */
set_reg_value (&state[R_PC], 0);
rest_cpu_state ();
- (void)buffer;
+ (void) buffer;
return 0;
}
@@ -920,7 +886,7 @@ process_v (char *buffer) FASTCALL
if (buffer[5] == ';' && (buffer[6] == 'c' || buffer[6] == 'C'))
return -2; /* resume execution */
return 1;
- }
+ }
#endif /* DBG_MIN_SIZE */
return -1;
}
@@ -928,42 +894,42 @@ process_v (char *buffer) FASTCALL
static signed char
process_zZ (char *buffer) FASTCALL
{ /* insert/remove breakpoint */
-#if defined(DBG_SWBREAK_PROC) || defined(DBG_HWBREAK) || \
- defined(DBG_WWATCH) || defined(DBG_RWATCH) || defined(DBG_AWATCH)
+#if defined(DBG_SWBREAK_PROC) || defined(DBG_HWBREAK) || defined(DBG_WWATCH) \
+ || defined(DBG_RWATCH) || defined(DBG_AWATCH)
const byte set = (*buffer == 'Z');
const char *p = &buffer[3];
- void *addr = (void*)hex2int(&p);
+ void *addr = (void *) hex2int (&p);
if (*p != ',')
return 1;
p++;
- int kind = hex2int(&p);
+ int kind = hex2int (&p);
*buffer = '\0';
switch (buffer[1])
{
#ifdef DBG_SWBREAK_PROC
case '0': /* sw break */
- return DBG_SWBREAK_PROC(set, addr);
+ return DBG_SWBREAK_PROC (set, addr);
#endif
#ifdef DBG_HWBREAK
case '1': /* hw break */
- return DBG_HWBREAK(set, addr);
+ return DBG_HWBREAK (set, addr);
#endif
#ifdef DBG_WWATCH
case '2': /* write watch */
- return DBG_WWATCH(set, addr, kind);
+ return DBG_WWATCH (set, addr, kind);
#endif
#ifdef DBG_RWATCH
case '3': /* read watch */
- return DBG_RWATCH(set, addr, kind);
+ return DBG_RWATCH (set, addr, kind);
#endif
#ifdef DBG_AWATCH
case '4': /* access watch */
- return DBG_AWATCH(set, addr, kind);
+ return DBG_AWATCH (set, addr, kind);
#endif
default:; /* not supported */
}
#endif
- (void)buffer;
+ (void) buffer;
return -1;
}
@@ -972,20 +938,34 @@ do_process (char *buffer) FASTCALL
{
switch (*buffer)
{
- case '?': return process_question (buffer);
- case 'G': return process_G (buffer);
- case 'k': return process_k (buffer);
- case 'M': return process_M (buffer);
- case 'X': return process_X (buffer);
- case 'Z': return process_zZ (buffer);
- case 'c': return process_c (buffer);
- case 'D': return process_D (buffer);
- case 'g': return process_g (buffer);
- case 'm': return process_m (buffer);
- case 'q': return process_q (buffer);
- case 'v': return process_v (buffer);
- case 'z': return process_zZ (buffer);
- default: return -1; /* empty response */
+ case '?':
+ return process_question (buffer);
+ case 'G':
+ return process_G (buffer);
+ case 'k':
+ return process_k (buffer);
+ case 'M':
+ return process_M (buffer);
+ case 'X':
+ return process_X (buffer);
+ case 'Z':
+ return process_zZ (buffer);
+ case 'c':
+ return process_c (buffer);
+ case 'D':
+ return process_D (buffer);
+ case 'g':
+ return process_g (buffer);
+ case 'm':
+ return process_m (buffer);
+ case 'q':
+ return process_q (buffer);
+ case 'v':
+ return process_v (buffer);
+ case 'z':
+ return process_zZ (buffer);
+ default:
+ return -1; /* empty response */
}
}
@@ -1011,7 +991,7 @@ process (char *buffer) FASTCALL
*p = '\0';
}
else if (*p == '\0')
- memcpy(p, "OK", 3);
+ memcpy (p, "OK", 3);
return ret;
}
@@ -1040,7 +1020,7 @@ hex2byte (const char *p) FASTCALL
signed char l = hex2val (p[1]);
if (h < 0 || l < 0)
return -1;
- return (byte)((byte)h << 4) | (byte)l;
+ return (byte) ((byte) h << 4) | (byte) l;
}
static int
@@ -1049,32 +1029,32 @@ hex2int (const char **buf) FASTCALL
word r = 0;
for (;; (*buf)++)
{
- signed char a = hex2val(**buf);
+ signed char a = hex2val (**buf);
if (a < 0)
break;
r <<= 4;
- r += (byte)a;
+ r += (byte) a;
}
- return (int)r;
+ return (int) r;
}
static char *
int2hex (char *buf, int v)
{
- buf = byte2hex(buf, (word)v >> 8);
- return byte2hex(buf, (byte)v);
+ buf = byte2hex (buf, (word) v >> 8);
+ return byte2hex (buf, (byte) v);
}
static char
high_hex (byte v) FASTCALL
{
- return low_hex(v >> 4);
+ return low_hex (v >> 4);
}
static char
low_hex (byte v) FASTCALL
{
-/*
+ /*
__asm
ld a, l
and a, #0x0f
@@ -1088,7 +1068,7 @@ low_hex (byte v) FASTCALL
*/
v &= 0x0f;
v += '0';
- if (v < '9'+1)
+ if (v < '9' + 1)
return v;
return v + 'a' - '0' - 10;
}
@@ -1134,7 +1114,7 @@ static void
read_memory_map (char *buffer, unsigned offset, unsigned length)
{
const char *map = DBG_MEMORY_MAP;
- const unsigned map_sz = strlen(map);
+ const unsigned map_sz = strlen (map);
if (offset >= map_sz)
{
buffer[0] = 'l';
@@ -1145,7 +1125,7 @@ read_memory_map (char *buffer, unsigned offset, unsigned length)
length = map_sz - offset;
buffer[0] = 'm';
memcpy (&buffer[1], &map[offset], length);
- buffer[1+length] = '\0';
+ buffer[1 + length] = '\0';
}
#endif
@@ -1156,13 +1136,13 @@ format_reg_value (char *p, unsigned reg_num, const byte *value)
{
char *d = p;
unsigned char i;
- d = byte2hex(d, reg_num);
+ d = byte2hex (d, reg_num);
*d++ = ':';
value += REG_SIZE;
i = REG_SIZE;
do
{
- d = byte2hex(d, *--value);
+ d = byte2hex (d, *--value);
}
while (--i != 0);
*d++ = ';';
@@ -1173,133 +1153,69 @@ format_reg_value (char *p, unsigned reg_num, const byte *value)
#ifdef __SDCC_gbz80
/* saves all state.except PC and SP */
static void
-save_cpu_state() __naked
+save_cpu_state () __naked
{
- __asm
- push af
- ld a, l
- ld (#_state + R_HL + 0), a
- ld a, h
- ld (#_state + R_HL + 1), a
- ld hl, #_state + R_HL - 1
- ld (hl), d
- dec hl
- ld (hl), e
- dec hl
- ld (hl), b
- dec hl
- ld (hl), c
- dec hl
- pop bc
- ld (hl), b
- dec hl
- ld (hl), c
- ret
- __endasm;
+ __asm push af ld a, l ld (#_state + R_HL + 0), a ld a,
+ h ld (#_state + R_HL + 1), a ld hl, #_state + R_HL - 1 ld (hl),
+ d dec hl ld (hl), e dec hl ld (hl), b dec hl ld (hl),
+ c dec hl pop bc ld (hl), b dec hl ld (hl), c ret __endasm;
}
/* restore CPU state and continue execution */
static void
-rest_cpu_state() __naked
+rest_cpu_state () __naked
{
- __asm
-;restore SP
- ld a, (#_state + R_SP + 0)
- ld l,a
- ld a, (#_state + R_SP + 1)
- ld h,a
- ld sp, hl
-;push PC value as return address
- ld a, (#_state + R_PC + 0)
- ld l, a
- ld a, (#_state + R_PC + 1)
- ld h, a
- push hl
-;restore registers
- ld hl, #_state + R_AF
- ld c, (hl)
- inc hl
- ld b, (hl)
- inc hl
- push bc
- ld c, (hl)
- inc hl
- ld b, (hl)
- inc hl
- ld e, (hl)
- inc hl
- ld d, (hl)
- inc hl
- ld a, (hl)
- inc hl
- ld h, (hl)
- ld l, a
- pop af
- ret
- __endasm;
+ __asm;
+ restore SP ld a, (#_state + R_SP + 0) ld l, a ld a,
+ (#_state + R_SP + 1) ld h, a ld sp, hl;
+ push PC value as return address ld a, (#_state + R_PC + 0) ld l, a ld a,
+ (#_state + R_PC + 1) ld h, a push hl;
+ restore registers ld hl, #_state + R_AF ld c, (hl) inc hl ld b,
+ (hl) inc hl push bc ld c, (hl) inc hl ld b, (hl) inc hl ld e,
+ (hl) inc hl ld d, (hl) inc hl ld a, (hl) inc hl ld h, (hl) ld l,
+ a pop af ret __endasm;
}
#else
/* saves all state.except PC and SP */
static void
-save_cpu_state() __naked
+save_cpu_state () __naked
{
- __asm
- ld (#_state + R_HL), hl
- ld (#_state + R_DE), de
- ld (#_state + R_BC), bc
- push af
- pop hl
- ld (#_state + R_AF), hl
- ld a, r ;R is increased by 7 or by 8 if called via RST
- ld l, a
- sub a, #7
- xor a, l
- and a, #0x7f
- xor a, l
+ __asm ld (#_state + R_HL), hl ld (#_state + R_DE), de ld (#_state + R_BC),
+ bc push af pop hl ld (#_state + R_AF), hl ld a, r;
+ R is increased by 7 or by 8 if called via RST ld l, a sub a, #7 xor a,
+ l and a, #0x7f xor a,
+ l
#ifdef __SDCC_ez80_adl
- ld hl, i
- ex de, hl
- ld hl, #_state + R_IR
- ld (hl), a
- inc hl
- ld (hl), e
- inc hl
- ld (hl), d
- ld a, MB
- ld (#_state + R_AF+2), a
+ ld hl,
+ i ex de, hl ld hl, #_state + R_IR ld (hl), a inc hl ld (hl),
+ e inc hl ld (hl), d ld a, MB ld (#_state + R_AF + 2),
+ a
#else
- ld l, a
- ld a, i
- ld h, a
- ld (#_state + R_IR), hl
+ ld l,
+ a ld a, i ld h, a ld (#_state + R_IR),
+ hl
#endif /* __SDCC_ez80_adl */
- ld (#_state + R_IX), ix
- ld (#_state + R_IY), iy
- ex af, af' ;'
- exx
- ld (#_state + R_HL_), hl
- ld (#_state + R_DE_), de
- ld (#_state + R_BC_), bc
- push af
- pop hl
- ld (#_state + R_AF_), hl
- ret
- __endasm;
+ ld (#_state + R_IX),
+ ix ld (#_state + R_IY), iy ex af, af ' ;' exx ld (#_state + R_HL_),
+ hl ld (#_state + R_DE_), de ld (#_state + R_BC_),
+ bc push af pop hl ld (#_state + R_AF_), hl ret __endasm;
}
/* restore CPU state and continue execution */
static void
-rest_cpu_state() __naked
+rest_cpu_state () __naked
{
__asm
#ifdef DBG_USE_TRAMPOLINE
- ld sp, _stack + DBG_STACK_SIZE
- ld hl, (#_state + R_PC)
- push hl /* resume address */
+ ld sp,
+ _stack + DBG_STACK_SIZE ld hl,
+ (#_state + R_PC) push hl /* resume address */
#ifdef __SDCC_ez80_adl
- ld hl, 0xc30000 ; use 0xc34000 for jp.s
+ ld hl,
+ 0xc30000; use 0xc34000 for jp.s
#else
- ld hl, 0xc300
+ ld hl,
+ 0xc300
#endif
push hl /* JP opcode */
#endif /* DBG_USE_TRAMPOLINE */
@@ -1316,40 +1232,38 @@ rest_cpu_state() __naked
#ifdef __SDCC_ez80_adl
ld a, (#_state + R_AF + 2)
ld MB, a
- ld hl, (#_state + R_IR + 1) ;I register
- ld i, hl
- ld a, (#_state + R_IR + 0) ; R register
- ld l, a
+ ld hl, (#_state + R_IR + 1) ;
+ I register ld i, hl ld a, (#_state + R_IR + 0);
+ R register ld l,
+ a
#else
- ld hl, (#_state + R_IR)
- ld a, h
- ld i, a
- ld a, l
+ ld hl,
+ (#_state + R_IR) ld a, h ld i, a ld a,
+ l
#endif /* __SDCC_ez80_adl */
- sub a, #10 ;number of M1 cycles after ld r,a
- xor a, l
- and a, #0x7f
- xor a, l
- ld r, a
- ld de, (#_state + R_DE)
- ld bc, (#_state + R_BC)
- ld hl, (#_state + R_AF)
- push hl
- pop af
- ld sp, (#_state + R_SP)
+ sub a,
+# 10;
+ number of M1 cycles after ld r, a xor a, l and a, #0x7f xor a, l ld r,
+ a ld de, (#_state + R_DE) ld bc, (#_state + R_BC) ld hl,
+ (#_state + R_AF) push hl pop af ld sp,
+ (#_state + R_SP)
#ifndef DBG_USE_TRAMPOLINE
- ld hl, (#_state + R_PC)
- push hl
- ld hl, (#_state + R_HL)
- DBG_RESUME
+ ld hl,
+ (#_state + R_PC) push hl ld hl,
+ (#_state + R_HL) DBG_RESUME
#else
- ld hl, (#_state + R_HL)
+ ld hl,
+ (#_state + R_HL)
#ifdef __SDCC_ez80_adl
- jp #_stack + DBG_STACK_SIZE - 4
+ jp #_stack
+ + DBG_STACK_SIZE
+ - 4
#else
- jp #_stack + DBG_STACK_SIZE - 3
+ jp #_stack
+ + DBG_STACK_SIZE
+ - 3
#endif
#endif /* DBG_USE_TRAMPOLINE */
- __endasm;
+ __endasm;
}
#endif /* __SDCC_gbz80 */
diff --git a/gdb/symfile-add-flags.h b/gdb/symfile-add-flags.h
index f18df4e4f60..567132c1644 100644
--- a/gdb/symfile-add-flags.h
+++ b/gdb/symfile-add-flags.h
@@ -17,7 +17,7 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
-#if !defined (SYMFILE_ADD_FLAGS_H)
+#if !defined(SYMFILE_ADD_FLAGS_H)
#define SYMFILE_ADD_FLAGS_H
#include "gdbsupport/enum-flags.h"
@@ -27,30 +27,30 @@
header dependencies. */
enum symfile_add_flag : unsigned
- {
- /* Be chatty about what you are doing. */
- SYMFILE_VERBOSE = 1 << 1,
+{
+ /* Be chatty about what you are doing. */
+ SYMFILE_VERBOSE = 1 << 1,
- /* This is the main symbol file (as opposed to symbol file for
+ /* This is the main symbol file (as opposed to symbol file for
dynamically loaded code). */
- SYMFILE_MAINLINE = 1 << 2,
+ SYMFILE_MAINLINE = 1 << 2,
- /* Do not call breakpoint_re_set when adding this symbol file. */
- SYMFILE_DEFER_BP_RESET = 1 << 3,
+ /* Do not call breakpoint_re_set when adding this symbol file. */
+ SYMFILE_DEFER_BP_RESET = 1 << 3,
- /* Do not immediately read symbols for this file. By default,
+ /* Do not immediately read symbols for this file. By default,
symbols are read when the objfile is created. */
- SYMFILE_NO_READ = 1 << 4,
+ SYMFILE_NO_READ = 1 << 4,
- /* The new objfile should be marked OBJF_NOT_FILENAME. */
- SYMFILE_NOT_FILENAME = 1 << 5,
+ /* The new objfile should be marked OBJF_NOT_FILENAME. */
+ SYMFILE_NOT_FILENAME = 1 << 5,
- /* If SYMFILE_VERBOSE (interpreted as from_tty) and SYMFILE_ALWAYS_CONFIRM,
+ /* If SYMFILE_VERBOSE (interpreted as from_tty) and SYMFILE_ALWAYS_CONFIRM,
always ask user to confirm loading the symbol file.
Without this flag, symbol_file_add_with_addrs asks a confirmation only
for a main symbol file replacing a file having symbols. */
- SYMFILE_ALWAYS_CONFIRM = 1 << 6,
- };
+ SYMFILE_ALWAYS_CONFIRM = 1 << 6,
+};
DEF_ENUM_FLAGS_TYPE (enum symfile_add_flag, symfile_add_flags);
diff --git a/gdb/symfile-debug.c b/gdb/symfile-debug.c
index efc6bcdf2bd..135a07c2d48 100644
--- a/gdb/symfile-debug.c
+++ b/gdb/symfile-debug.c
@@ -42,7 +42,10 @@
struct debug_sym_fns_data
{
const struct sym_fns *real_sf = nullptr;
- struct sym_fns debug_sf {};
+
+ struct sym_fns debug_sf
+ {
+ };
};
/* We need to record a pointer to the real set of functions for each
@@ -69,7 +72,6 @@ debug_symtab_name (struct symtab *symtab)
{
return symtab_to_filename_for_display (symtab);
}
-
/* See objfiles.h. */
@@ -160,23 +162,21 @@ objfile::forget_cached_source_info ()
}
bool
-objfile::map_symtabs_matching_filename
- (const char *name, const char *real_path,
- gdb::function_view<bool (symtab *)> callback)
+objfile::map_symtabs_matching_filename (
+ const char *name, const char *real_path,
+ gdb::function_view<bool (symtab *)> callback)
{
if (debug_symfile)
gdb_printf (gdb_stdlog,
"qf->map_symtabs_matching_filename (%s, \"%s\", "
"\"%s\", %s)\n",
- objfile_debug_name (this), name,
- real_path ? real_path : NULL,
+ objfile_debug_name (this), name, real_path ? real_path : NULL,
host_address_to_string (&callback));
bool retval = true;
const char *name_basename = lbasename (name);
- auto match_one_filename = [&] (const char *filename, bool basenames)
- {
+ auto match_one_filename = [&] (const char *filename, bool basenames) {
if (compare_filenames_for_search (filename, name))
return true;
if (basenames && FILENAME_CMP (name_basename, filename) == 0)
@@ -189,30 +189,24 @@ objfile::map_symtabs_matching_filename
compunit_symtab *last_made = this->compunit_symtabs;
- auto on_expansion = [&] (compunit_symtab *symtab)
- {
+ auto on_expansion = [&] (compunit_symtab *symtab) {
/* The callback to iterate_over_some_symtabs returns false to keep
going and true to continue, so we have to invert the result
here, for expand_symtabs_matching. */
- bool result = !iterate_over_some_symtabs (name, real_path,
- this->compunit_symtabs,
- last_made,
- callback);
+ bool result
+ = !iterate_over_some_symtabs (name, real_path, this->compunit_symtabs,
+ last_made, callback);
last_made = this->compunit_symtabs;
return result;
};
for (const auto &iter : qf_require_partial_symbols ())
{
- if (!iter->expand_symtabs_matching (this,
- match_one_filename,
- nullptr,
- nullptr,
- on_expansion,
+ if (!iter->expand_symtabs_matching (this, match_one_filename, nullptr,
+ nullptr, on_expansion,
(SEARCH_GLOBAL_BLOCK
| SEARCH_STATIC_BLOCK),
- UNDEF_DOMAIN,
- ALL_DOMAIN))
+ UNDEF_DOMAIN, ALL_DOMAIN))
{
retval = false;
break;
@@ -220,8 +214,7 @@ objfile::map_symtabs_matching_filename
}
if (debug_symfile)
- gdb_printf (gdb_stdlog,
- "qf->map_symtabs_matching_filename (...) = %d\n",
+ gdb_printf (gdb_stdlog, "qf->map_symtabs_matching_filename (...) = %d\n",
retval);
/* We must re-invert the return value here to match the caller's
@@ -235,29 +228,25 @@ objfile::lookup_symbol (block_enum kind, const char *name, domain_enum domain)
struct compunit_symtab *retval = nullptr;
if (debug_symfile)
- gdb_printf (gdb_stdlog,
- "qf->lookup_symbol (%s, %d, \"%s\", %s)\n",
- objfile_debug_name (this), kind, name,
- domain_name (domain));
+ gdb_printf (gdb_stdlog, "qf->lookup_symbol (%s, %d, \"%s\", %s)\n",
+ objfile_debug_name (this), kind, name, domain_name (domain));
lookup_name_info lookup_name (name, symbol_name_match_type::FULL);
- auto search_one_symtab = [&] (compunit_symtab *stab)
- {
+ auto search_one_symtab = [&] (compunit_symtab *stab) {
struct symbol *sym, *with_opaque = NULL;
const struct blockvector *bv = stab->blockvector ();
const struct block *block = bv->block (kind);
- sym = block_find_symbol (block, name, domain,
- block_find_non_opaque_type_preferred,
- &with_opaque);
+ sym
+ = block_find_symbol (block, name, domain,
+ block_find_non_opaque_type_preferred, &with_opaque);
/* Some caution must be observed with overloaded functions
and methods, since the index will not contain any overload
information (but NAME might contain it). */
- if (sym != NULL
- && symbol_matches_search_name (sym, lookup_name))
+ if (sym != NULL && symbol_matches_search_name (sym, lookup_name))
{
retval = stab;
/* Found it. */
@@ -273,24 +262,17 @@ objfile::lookup_symbol (block_enum kind, const char *name, domain_enum domain)
for (const auto &iter : qf_require_partial_symbols ())
{
- if (!iter->expand_symtabs_matching (this,
- nullptr,
- &lookup_name,
- nullptr,
- search_one_symtab,
- kind == GLOBAL_BLOCK
- ? SEARCH_GLOBAL_BLOCK
- : SEARCH_STATIC_BLOCK,
- domain,
- ALL_DOMAIN))
+ if (!iter->expand_symtabs_matching (
+ this, nullptr, &lookup_name, nullptr, search_one_symtab,
+ kind == GLOBAL_BLOCK ? SEARCH_GLOBAL_BLOCK : SEARCH_STATIC_BLOCK,
+ domain, ALL_DOMAIN))
break;
}
if (debug_symfile)
gdb_printf (gdb_stdlog, "qf->lookup_symbol (...) = %s\n",
- retval
- ? debug_symtab_name (retval->primary_filetab ())
- : "NULL");
+ retval ? debug_symtab_name (retval->primary_filetab ())
+ : "NULL");
return retval;
}
@@ -310,8 +292,7 @@ void
objfile::dump ()
{
if (debug_symfile)
- gdb_printf (gdb_stdlog, "qf->dump (%s)\n",
- objfile_debug_name (this));
+ gdb_printf (gdb_stdlog, "qf->dump (%s)\n", objfile_debug_name (this));
for (const auto &iter : qf)
iter->dump (this);
@@ -321,23 +302,17 @@ void
objfile::expand_symtabs_for_function (const char *func_name)
{
if (debug_symfile)
- gdb_printf (gdb_stdlog,
- "qf->expand_symtabs_for_function (%s, \"%s\")\n",
+ gdb_printf (gdb_stdlog, "qf->expand_symtabs_for_function (%s, \"%s\")\n",
objfile_debug_name (this), func_name);
lookup_name_info base_lookup (func_name, symbol_name_match_type::FULL);
lookup_name_info lookup_name = base_lookup.make_ignore_params ();
for (const auto &iter : qf_require_partial_symbols ())
- iter->expand_symtabs_matching (this,
- nullptr,
- &lookup_name,
- nullptr,
+ iter->expand_symtabs_matching (this, nullptr, &lookup_name, nullptr,
nullptr,
- (SEARCH_GLOBAL_BLOCK
- | SEARCH_STATIC_BLOCK),
- VAR_DOMAIN,
- ALL_DOMAIN);
+ (SEARCH_GLOBAL_BLOCK | SEARCH_STATIC_BLOCK),
+ VAR_DOMAIN, ALL_DOMAIN);
}
void
@@ -355,39 +330,29 @@ void
objfile::expand_symtabs_with_fullname (const char *fullname)
{
if (debug_symfile)
- gdb_printf (gdb_stdlog,
- "qf->expand_symtabs_with_fullname (%s, \"%s\")\n",
+ gdb_printf (gdb_stdlog, "qf->expand_symtabs_with_fullname (%s, \"%s\")\n",
objfile_debug_name (this), fullname);
const char *basename = lbasename (fullname);
- auto file_matcher = [&] (const char *filename, bool basenames)
- {
+ auto file_matcher = [&] (const char *filename, bool basenames) {
return filename_cmp (basenames ? basename : fullname, filename) == 0;
};
for (const auto &iter : qf_require_partial_symbols ())
- iter->expand_symtabs_matching (this,
- file_matcher,
- nullptr,
- nullptr,
+ iter->expand_symtabs_matching (this, file_matcher, nullptr, nullptr,
nullptr,
- (SEARCH_GLOBAL_BLOCK
- | SEARCH_STATIC_BLOCK),
- UNDEF_DOMAIN,
- ALL_DOMAIN);
+ (SEARCH_GLOBAL_BLOCK | SEARCH_STATIC_BLOCK),
+ UNDEF_DOMAIN, ALL_DOMAIN);
}
void
-objfile::expand_matching_symbols
- (const lookup_name_info &name, domain_enum domain,
- int global,
- symbol_compare_ftype *ordered_compare)
+objfile::expand_matching_symbols (const lookup_name_info &name,
+ domain_enum domain, int global,
+ symbol_compare_ftype *ordered_compare)
{
if (debug_symfile)
- gdb_printf (gdb_stdlog,
- "qf->expand_matching_symbols (%s, %s, %d, %s)\n",
- objfile_debug_name (this),
- domain_name (domain), global,
+ gdb_printf (gdb_stdlog, "qf->expand_matching_symbols (%s, %s, %d, %s)\n",
+ objfile_debug_name (this), domain_name (domain), global,
host_address_to_string (ordered_compare));
for (const auto &iter : qf_require_partial_symbols ())
@@ -396,14 +361,12 @@ objfile::expand_matching_symbols
}
bool
-objfile::expand_symtabs_matching
- (gdb::function_view<expand_symtabs_file_matcher_ftype> file_matcher,
- const lookup_name_info *lookup_name,
- gdb::function_view<expand_symtabs_symbol_matcher_ftype> symbol_matcher,
- gdb::function_view<expand_symtabs_exp_notify_ftype> expansion_notify,
- block_search_flags search_flags,
- domain_enum domain,
- enum search_domain kind)
+objfile::expand_symtabs_matching (
+ gdb::function_view<expand_symtabs_file_matcher_ftype> file_matcher,
+ const lookup_name_info *lookup_name,
+ gdb::function_view<expand_symtabs_symbol_matcher_ftype> symbol_matcher,
+ gdb::function_view<expand_symtabs_exp_notify_ftype> expansion_notify,
+ block_search_flags search_flags, domain_enum domain, enum search_domain kind)
{
/* This invariant is documented in quick-functions.h. */
gdb_assert (lookup_name != nullptr || symbol_matcher == nullptr);
@@ -437,10 +400,8 @@ objfile::find_pc_sect_compunit_symtab (struct bound_minimal_symbol msymbol,
gdb_printf (gdb_stdlog,
"qf->find_pc_sect_compunit_symtab (%s, %s, %s, %s, %d)\n",
objfile_debug_name (this),
- host_address_to_string (msymbol.minsym),
- hex_string (pc),
- host_address_to_string (section),
- warn_if_readin);
+ host_address_to_string (msymbol.minsym), hex_string (pc),
+ host_address_to_string (section), warn_if_readin);
for (const auto &iter : qf_require_partial_symbols ())
{
@@ -451,11 +412,9 @@ objfile::find_pc_sect_compunit_symtab (struct bound_minimal_symbol msymbol,
}
if (debug_symfile)
- gdb_printf (gdb_stdlog,
- "qf->find_pc_sect_compunit_symtab (...) = %s\n",
- retval
- ? debug_symtab_name (retval->primary_filetab ())
- : "NULL");
+ gdb_printf (gdb_stdlog, "qf->find_pc_sect_compunit_symtab (...) = %s\n",
+ retval ? debug_symtab_name (retval->primary_filetab ())
+ : "NULL");
return retval;
}
@@ -465,10 +424,8 @@ objfile::map_symbol_filenames (gdb::function_view<symbol_filename_ftype> fun,
bool need_fullname)
{
if (debug_symfile)
- gdb_printf (gdb_stdlog,
- "qf->map_symbol_filenames (%s, ..., %d)\n",
- objfile_debug_name (this),
- need_fullname);
+ gdb_printf (gdb_stdlog, "qf->map_symbol_filenames (%s, ..., %d)\n",
+ objfile_debug_name (this), need_fullname);
for (const auto &iter : qf_require_partial_symbols ())
iter->map_symbol_filenames (this, fun, need_fullname);
@@ -478,10 +435,8 @@ struct compunit_symtab *
objfile::find_compunit_symtab_by_address (CORE_ADDR address)
{
if (debug_symfile)
- gdb_printf (gdb_stdlog,
- "qf->find_compunit_symtab_by_address (%s, %s)\n",
- objfile_debug_name (this),
- hex_string (address));
+ gdb_printf (gdb_stdlog, "qf->find_compunit_symtab_by_address (%s, %s)\n",
+ objfile_debug_name (this), hex_string (address));
struct compunit_symtab *result = NULL;
for (const auto &iter : qf_require_partial_symbols ())
@@ -492,18 +447,15 @@ objfile::find_compunit_symtab_by_address (CORE_ADDR address)
}
if (debug_symfile)
- gdb_printf (gdb_stdlog,
- "qf->find_compunit_symtab_by_address (...) = %s\n",
- result
- ? debug_symtab_name (result->primary_filetab ())
- : "NULL");
+ gdb_printf (gdb_stdlog, "qf->find_compunit_symtab_by_address (...) = %s\n",
+ result ? debug_symtab_name (result->primary_filetab ())
+ : "NULL");
return result;
}
enum language
-objfile::lookup_global_symbol_language (const char *name,
- domain_enum domain,
+objfile::lookup_global_symbol_language (const char *name, domain_enum domain,
bool *symbol_found_p)
{
enum language result = language_unknown;
@@ -534,7 +486,7 @@ objfile::require_partial_symbols (bool verbose)
{
if (verbose && !printed)
{
- gdb_printf (_("Reading symbols from %s...\n"),
+ gdb_printf (_ ("Reading symbols from %s...\n"),
objfile_name (this));
printed = true;
}
@@ -542,12 +494,11 @@ objfile::require_partial_symbols (bool verbose)
}
}
if (printed && !objfile_has_symbols (this))
- gdb_printf (_("(No debugging symbols found in %s)\n"),
+ gdb_printf (_ ("(No debugging symbols found in %s)\n"),
objfile_name (this));
}
}
-
/* Debugging version of struct sym_probe_fns. */
static const std::vector<std::unique_ptr<probe>> &
@@ -559,19 +510,17 @@ debug_sym_get_probes (struct objfile *objfile)
const std::vector<std::unique_ptr<probe>> &retval
= debug_data->real_sf->sym_probe_fns->sym_get_probes (objfile);
- gdb_printf (gdb_stdlog,
- "probes->sym_get_probes (%s) = %s\n",
+ gdb_printf (gdb_stdlog, "probes->sym_get_probes (%s) = %s\n",
objfile_debug_name (objfile),
host_address_to_string (retval.data ()));
return retval;
}
-static const struct sym_probe_fns debug_sym_probe_fns =
-{
+static const struct sym_probe_fns debug_sym_probe_fns = {
debug_sym_get_probes,
};
-
+
/* Debugging version of struct sym_fns. */
static void
@@ -592,8 +541,7 @@ debug_sym_init (struct objfile *objfile)
const struct debug_sym_fns_data *debug_data
= symfile_debug_objfile_data_key.get (objfile);
- gdb_printf (gdb_stdlog, "sf->sym_init (%s)\n",
- objfile_debug_name (objfile));
+ gdb_printf (gdb_stdlog, "sf->sym_init (%s)\n", objfile_debug_name (objfile));
debug_data->real_sf->sym_init (objfile);
}
@@ -623,15 +571,13 @@ debug_sym_finish (struct objfile *objfile)
}
static void
-debug_sym_offsets (struct objfile *objfile,
- const section_addr_info &info)
+debug_sym_offsets (struct objfile *objfile, const section_addr_info &info)
{
const struct debug_sym_fns_data *debug_data
= symfile_debug_objfile_data_key.get (objfile);
gdb_printf (gdb_stdlog, "sf->sym_offsets (%s, %s)\n",
- objfile_debug_name (objfile),
- host_address_to_string (&info));
+ objfile_debug_name (objfile), host_address_to_string (&info));
debug_data->real_sf->sym_offsets (objfile, info);
}
@@ -666,12 +612,9 @@ debug_sym_relocate (struct objfile *objfile, asection *sectp, bfd_byte *buf)
retval = debug_data->real_sf->sym_relocate (objfile, sectp, buf);
- gdb_printf (gdb_stdlog,
- "sf->sym_relocate (%s, %s, %s) = %s\n",
- objfile_debug_name (objfile),
- host_address_to_string (sectp),
- host_address_to_string (buf),
- host_address_to_string (retval));
+ gdb_printf (gdb_stdlog, "sf->sym_relocate (%s, %s, %s) = %s\n",
+ objfile_debug_name (objfile), host_address_to_string (sectp),
+ host_address_to_string (buf), host_address_to_string (retval));
return retval;
}
@@ -681,19 +624,12 @@ debug_sym_relocate (struct objfile *objfile, asection *sectp, bfd_byte *buf)
installed in real_sf, and then a pointer to the copy is installed in the
objfile. */
-static const struct sym_fns debug_sym_fns =
-{
- debug_sym_new_init,
- debug_sym_init,
- debug_sym_read,
- debug_sym_finish,
- debug_sym_offsets,
- debug_sym_segments,
- debug_sym_read_linetable,
- debug_sym_relocate,
- &debug_sym_probe_fns,
+static const struct sym_fns debug_sym_fns = {
+ debug_sym_new_init, debug_sym_init, debug_sym_read,
+ debug_sym_finish, debug_sym_offsets, debug_sym_segments,
+ debug_sym_read_linetable, debug_sym_relocate, &debug_sym_probe_fns,
};
-
+
/* Install the debugging versions of the symfile functions for OBJFILE.
Do not call this if the debug versions are already installed. */
@@ -711,11 +647,13 @@ install_symfile_debug_logging (struct objfile *objfile)
/* Alas we have to preserve NULL entries in REAL_SF. */
debug_data = new struct debug_sym_fns_data;
-#define COPY_SF_PTR(from, to, name, func) \
- do { \
- if ((from)->name) \
- (to)->debug_sf.name = func; \
- } while (0)
+#define COPY_SF_PTR(from, to, name, func) \
+ do \
+ { \
+ if ((from)->name) \
+ (to)->debug_sf.name = func; \
+ } \
+ while (0)
COPY_SF_PTR (real_sf, debug_data, sym_new_init, debug_sym_new_init);
COPY_SF_PTR (real_sf, debug_data, sym_init, debug_sym_init);
@@ -795,18 +733,21 @@ set_debug_symfile (const char *args, int from_tty, struct cmd_list_element *c)
static void
show_debug_symfile (struct ui_file *file, int from_tty,
- struct cmd_list_element *c, const char *value)
+ struct cmd_list_element *c, const char *value)
{
- gdb_printf (file, _("Symfile debugging is %s.\n"), value);
+ gdb_printf (file, _ ("Symfile debugging is %s.\n"), value);
}
void _initialize_symfile_debug ();
+
void
_initialize_symfile_debug ()
{
- add_setshow_boolean_cmd ("symfile", no_class, &debug_symfile, _("\
-Set debugging of the symfile functions."), _("\
-Show debugging of the symfile functions."), _("\
+ add_setshow_boolean_cmd ("symfile", no_class, &debug_symfile, _ ("\
+Set debugging of the symfile functions."),
+ _ ("\
+Show debugging of the symfile functions."),
+ _ ("\
When enabled, all calls to the symfile functions are logged."),
set_debug_symfile, show_debug_symfile,
&setdebuglist, &showdebuglist);
diff --git a/gdb/symfile-mem.c b/gdb/symfile-mem.c
index d36b9090e7e..ee9202eaa0c 100644
--- a/gdb/symfile-mem.c
+++ b/gdb/symfile-mem.c
@@ -40,7 +40,6 @@
hope BFD will provide a format-independent bfd_from_remote_memory
entry point. */
-
#include "defs.h"
#include "symtab.h"
#include "gdbcore.h"
@@ -81,8 +80,8 @@ target_read_memory_bfd (bfd_vma memaddr, bfd_byte *myaddr, bfd_size_type len)
representing the target's format. NAME is the name to use for this
symbol file in messages; it can be NULL. */
static struct objfile *
-symbol_file_add_from_memory (struct bfd *templ, CORE_ADDR addr,
- size_t size, const char *name, int from_tty)
+symbol_file_add_from_memory (struct bfd *templ, CORE_ADDR addr, size_t size,
+ const char *name, int from_tty)
{
struct objfile *objf;
struct bfd *nbfd;
@@ -91,12 +90,12 @@ symbol_file_add_from_memory (struct bfd *templ, CORE_ADDR addr,
symfile_add_flags add_flags = SYMFILE_NOT_FILENAME;
if (bfd_get_flavour (templ) != bfd_target_elf_flavour)
- error (_("add-symbol-file-from-memory not supported for this target"));
+ error (_ ("add-symbol-file-from-memory not supported for this target"));
nbfd = bfd_elf_bfd_from_remote_memory (templ, addr, size, &loadbase,
target_read_memory_bfd);
if (nbfd == NULL)
- error (_("Failed to read a valid object file image from memory."));
+ error (_ ("Failed to read a valid object file image from memory."));
/* Manage the new reference for the duration of this function. */
gdb_bfd_ref_ptr nbfd_holder = gdb_bfd_ref_ptr::new_reference (nbfd);
@@ -106,15 +105,14 @@ symbol_file_add_from_memory (struct bfd *templ, CORE_ADDR addr,
bfd_set_filename (nbfd, name);
if (!bfd_check_format (nbfd, bfd_object))
- error (_("Got object file from memory but can't read symbols: %s."),
+ error (_ ("Got object file from memory but can't read symbols: %s."),
bfd_errmsg (bfd_get_error ()));
section_addr_info sai;
for (sec = nbfd->sections; sec != NULL; sec = sec->next)
- if ((bfd_section_flags (sec) & (SEC_ALLOC|SEC_LOAD)) != 0)
+ if ((bfd_section_flags (sec) & (SEC_ALLOC | SEC_LOAD)) != 0)
sai.emplace_back (bfd_section_vma (sec) + loadbase,
- bfd_section_name (sec),
- sec->index);
+ bfd_section_name (sec), sec->index);
if (from_tty)
add_flags |= SYMFILE_VERBOSE;
@@ -130,7 +128,6 @@ symbol_file_add_from_memory (struct bfd *templ, CORE_ADDR addr,
return objf;
}
-
static void
add_symbol_file_from_memory_command (const char *args, int from_tty)
{
@@ -138,7 +135,7 @@ add_symbol_file_from_memory_command (const char *args, int from_tty)
struct bfd *templ;
if (args == NULL)
- error (_("add-symbol-file-from-memory requires an expression argument"));
+ error (_ ("add-symbol-file-from-memory requires an expression argument"));
addr = parse_and_eval_address (args);
@@ -148,8 +145,8 @@ add_symbol_file_from_memory_command (const char *args, int from_tty)
else
templ = current_program_space->exec_bfd ();
if (templ == NULL)
- error (_("Must use symbol-file or exec-file "
- "before add-symbol-file-from-memory."));
+ error (_ ("Must use symbol-file or exec-file "
+ "before add-symbol-file-from-memory."));
symbol_file_add_from_memory (templ, addr, 0, NULL, from_tty);
}
@@ -171,30 +168,28 @@ add_vsyscall_page (inferior *inf)
else if (current_program_space->exec_bfd () != NULL)
bfd = current_program_space->exec_bfd ();
else
- /* FIXME: cagney/2004-05-06: Should not require an existing
+ /* FIXME: cagney/2004-05-06: Should not require an existing
BFD when trying to create a run-time BFD of the VSYSCALL
page in the inferior. Unfortunately that's the current
interface so for the moment bail. Introducing a
``bfd_runtime'' (a BFD created using the loaded image) file
format should fix this. */
{
- warning (_("Could not load vsyscall page "
- "because no executable was specified"));
+ warning (_ ("Could not load vsyscall page "
+ "because no executable was specified"));
return;
}
- std::string name = string_printf ("system-supplied DSO at %s",
- paddress (target_gdbarch (),
- vsyscall_range.start));
+ std::string name
+ = string_printf ("system-supplied DSO at %s",
+ paddress (target_gdbarch (), vsyscall_range.start));
try
{
/* Pass zero for FROM_TTY, because the action of loading the
vsyscall DSO was not triggered by the user, even if the
user typed "run" at the TTY. */
- symbol_file_add_from_memory (bfd,
- vsyscall_range.start,
- vsyscall_range.length,
- name.c_str (),
+ symbol_file_add_from_memory (bfd, vsyscall_range.start,
+ vsyscall_range.length, name.c_str (),
0 /* from_tty */);
}
catch (const gdb_exception &ex)
@@ -205,15 +200,16 @@ add_vsyscall_page (inferior *inf)
}
void _initialize_symfile_mem ();
+
void
_initialize_symfile_mem ()
{
add_cmd ("add-symbol-file-from-memory", class_files,
add_symbol_file_from_memory_command,
- _("Load the symbols out of memory from a "
- "dynamically loaded object file.\n"
- "Give an expression for the address "
- "of the file's shared object file header."),
+ _ ("Load the symbols out of memory from a "
+ "dynamically loaded object file.\n"
+ "Give an expression for the address "
+ "of the file's shared object file header."),
&cmdlist);
/* Want to know of each new inferior so that its vsyscall info can
diff --git a/gdb/symfile.c b/gdb/symfile.c
index 373f5592107..6ec6194fd43 100644
--- a/gdb/symfile.c
+++ b/gdb/symfile.c
@@ -38,7 +38,7 @@
#include "demangle.h"
#include "inferior.h"
#include "regcache.h"
-#include "filenames.h" /* for DOSish file names */
+#include "filenames.h" /* for DOSish file names */
#include "gdbsupport/gdb_obstack.h"
#include "completer.h"
#include "bcache.h"
@@ -72,15 +72,14 @@
int (*deprecated_ui_load_progress_hook) (const char *section,
unsigned long num);
void (*deprecated_show_load_progress) (const char *section,
- unsigned long section_sent,
- unsigned long section_size,
- unsigned long total_sent,
- unsigned long total_size);
+ unsigned long section_sent,
+ unsigned long section_size,
+ unsigned long total_sent,
+ unsigned long total_size);
void (*deprecated_pre_add_symbol_hook) (const char *);
void (*deprecated_post_add_symbol_hook) (void);
-using clear_symtab_users_cleanup
- = FORWARD_SCOPE_EXIT (clear_symtab_users);
+using clear_symtab_users_cleanup = FORWARD_SCOPE_EXIT (clear_symtab_users);
/* Global variables owned by this file. */
@@ -94,7 +93,8 @@ int readnever_symbol_files;
/* Functions this file defines. */
-static void symbol_file_add_main_1 (const char *args, symfile_add_flags add_flags,
+static void symbol_file_add_main_1 (const char *args,
+ symfile_add_flags add_flags,
objfile_flags flags, CORE_ADDR reloff);
static const struct sym_fns *find_sym_fns (bfd *);
@@ -119,8 +119,10 @@ static void symfile_find_segment_sections (struct objfile *objfile);
struct registered_sym_fns
{
registered_sym_fns (bfd_flavour sym_flavour_, const struct sym_fns *sym_fns_)
- : sym_flavour (sym_flavour_), sym_fns (sym_fns_)
- {}
+ : sym_flavour (sym_flavour_),
+ sym_fns (sym_fns_)
+ {
+ }
/* BFD flavour that we handle. */
enum bfd_flavour sym_flavour;
@@ -136,19 +138,14 @@ static std::vector<registered_sym_fns> symtab_fns;
const char print_symbol_loading_off[] = "off";
const char print_symbol_loading_brief[] = "brief";
const char print_symbol_loading_full[] = "full";
-static const char *print_symbol_loading_enums[] =
-{
- print_symbol_loading_off,
- print_symbol_loading_brief,
- print_symbol_loading_full,
- NULL
-};
+static const char *print_symbol_loading_enums[]
+ = { print_symbol_loading_off, print_symbol_loading_brief,
+ print_symbol_loading_full, NULL };
static const char *print_symbol_loading = print_symbol_loading_full;
/* See symfile.h. */
bool auto_solib_add = true;
-
/* Return non-zero if symbol-loading messages should be printed.
FROM_TTY is the standard from_tty argument to gdb commands.
@@ -204,9 +201,9 @@ find_lowest_section (asection *sect, asection **lowest)
if (0 == (bfd_section_flags (sect) & (SEC_ALLOC | SEC_LOAD)))
return;
if (!*lowest)
- *lowest = sect; /* First loadable section */
+ *lowest = sect; /* First loadable section */
else if (bfd_section_vma (*lowest) > bfd_section_vma (sect))
- *lowest = sect; /* A lower loadable section */
+ *lowest = sect; /* A lower loadable section */
else if (bfd_section_vma (*lowest) == bfd_section_vma (sect)
&& (bfd_section_size (*lowest) <= bfd_section_size (sect)))
*lowest = sect;
@@ -227,8 +224,7 @@ build_section_addr_info_from_section_table (const target_section_table &table)
if (bfd_section_flags (asect) & (SEC_ALLOC | SEC_LOAD)
&& sap.size () < table.size ())
- sap.emplace_back (stp.addr,
- bfd_section_name (asect),
+ sap.emplace_back (stp.addr, bfd_section_name (asect),
gdb_bfd_section_index (abfd, asect));
}
@@ -245,8 +241,7 @@ build_section_addr_info_from_bfd (bfd *abfd)
section_addr_info sap;
for (sec = abfd->sections; sec != NULL; sec = sec->next)
if (bfd_section_flags (sec) & (SEC_ALLOC | SEC_LOAD))
- sap.emplace_back (bfd_section_vma (sec),
- bfd_section_name (sec),
+ sap.emplace_back (bfd_section_vma (sec), bfd_section_name (sec),
gdb_bfd_section_index (abfd, sec));
return sap;
@@ -356,41 +351,42 @@ place_section (bfd *abfd, asection *sect, section_offsets &offsets,
/* Otherwise, let's try to find a place for the section. */
start_addr = (lowest + align - 1) & -align;
- do {
- asection *cur_sec;
+ do
+ {
+ asection *cur_sec;
- done = 1;
+ done = 1;
- for (cur_sec = abfd->sections; cur_sec != NULL; cur_sec = cur_sec->next)
- {
- int indx = cur_sec->index;
+ for (cur_sec = abfd->sections; cur_sec != NULL; cur_sec = cur_sec->next)
+ {
+ int indx = cur_sec->index;
- /* We don't need to compare against ourself. */
- if (cur_sec == sect)
- continue;
+ /* We don't need to compare against ourself. */
+ if (cur_sec == sect)
+ continue;
- /* We can only conflict with allocated sections. */
- if ((bfd_section_flags (cur_sec) & SEC_ALLOC) == 0)
- continue;
+ /* We can only conflict with allocated sections. */
+ if ((bfd_section_flags (cur_sec) & SEC_ALLOC) == 0)
+ continue;
- /* If the section offset is 0, either the section has not been placed
+ /* If the section offset is 0, either the section has not been placed
yet, or it was the lowest section placed (in which case LOWEST
will be past its end). */
- if (offsets[indx] == 0)
- continue;
+ if (offsets[indx] == 0)
+ continue;
- /* If this section would overlap us, then we must move up. */
- if (start_addr + bfd_section_size (sect) > offsets[indx]
- && start_addr < offsets[indx] + bfd_section_size (cur_sec))
- {
- start_addr = offsets[indx] + bfd_section_size (cur_sec);
- start_addr = (start_addr + align - 1) & -align;
- done = 0;
- break;
- }
+ /* If this section would overlap us, then we must move up. */
+ if (start_addr + bfd_section_size (sect) > offsets[indx]
+ && start_addr < offsets[indx] + bfd_section_size (cur_sec))
+ {
+ start_addr = offsets[indx] + bfd_section_size (cur_sec);
+ start_addr = (start_addr + align - 1) & -align;
+ done = 0;
+ break;
+ }
- /* Otherwise, we appear to be OK. So far. */
- }
+ /* Otherwise, we appear to be OK. So far. */
+ }
}
while (!done);
@@ -494,7 +490,7 @@ addr_info_make_relative (section_addr_info *addrs, bfd *abfd)
find_lowest_section (iter, &lower_sect);
if (lower_sect == NULL)
{
- warning (_("no loadable sections found in added symbol-file %s"),
+ warning (_ ("no loadable sections found in added symbol-file %s"),
bfd_get_filename (abfd));
lower_offset = 0;
}
@@ -521,8 +517,8 @@ addr_info_make_relative (section_addr_info *addrs, bfd *abfd)
/* Now create ADDRS_TO_ABFD_ADDRS from ADDRS_SORTED and
ABFD_ADDRS_SORTED. */
- std::vector<const struct other_sections *>
- addrs_to_abfd_addrs (addrs->size (), nullptr);
+ std::vector<const struct other_sections *> addrs_to_abfd_addrs (
+ addrs->size (), nullptr);
std::vector<const struct other_sections *>::iterator abfd_sorted_iter
= abfd_addrs_sorted.begin ();
@@ -532,12 +528,14 @@ addr_info_make_relative (section_addr_info *addrs, bfd *abfd)
while (abfd_sorted_iter != abfd_addrs_sorted.end ()
&& strcmp (addr_section_name ((*abfd_sorted_iter)->name.c_str ()),
- sect_name) < 0)
+ sect_name)
+ < 0)
abfd_sorted_iter++;
if (abfd_sorted_iter != abfd_addrs_sorted.end ()
&& strcmp (addr_section_name ((*abfd_sorted_iter)->name.c_str ()),
- sect_name) == 0)
+ sect_name)
+ == 0)
{
int index_in_addrs;
@@ -597,17 +595,14 @@ addr_info_make_relative (section_addr_info *addrs, bfd *abfd)
For the sections `.bss' and `.sbss' see addr_section_name. */
- if (!(sect_name == ".gnu.liblist"
- || sect_name == ".gnu.conflict"
- || (sect_name == ".bss"
- && i > 0
+ if (!(sect_name == ".gnu.liblist" || sect_name == ".gnu.conflict"
+ || (sect_name == ".bss" && i > 0
&& (*addrs)[i - 1].name == ".dynbss"
&& addrs_to_abfd_addrs[i - 1] != NULL)
- || (sect_name == ".sbss"
- && i > 0
+ || (sect_name == ".sbss" && i > 0
&& (*addrs)[i - 1].name == ".sdynbss"
&& addrs_to_abfd_addrs[i - 1] != NULL)))
- warning (_("section %s not found in %s"), sect_name.c_str (),
+ warning (_ ("section %s not found in %s"), sect_name.c_str (),
bfd_get_filename (abfd));
(*addrs)[i].addr = 0;
@@ -626,7 +621,8 @@ void
default_symfile_offsets (struct objfile *objfile,
const section_addr_info &addrs)
{
- objfile->section_offsets.resize (gdb_bfd_count_sections (objfile->obfd.get ()));
+ objfile->section_offsets.resize (
+ gdb_bfd_count_sections (objfile->obfd.get ()));
relative_addr_info_to_section_offsets (objfile->section_offsets, addrs);
/* For relocatable files, all loadable sections will start at zero.
@@ -653,8 +649,8 @@ default_symfile_offsets (struct objfile *objfile,
place explicitly. */
CORE_ADDR lowest = 0;
for (asection *sect : gdb_bfd_sections (objfile->obfd.get ()))
- place_section (objfile->obfd.get (), sect, objfile->section_offsets,
- lowest);
+ place_section (objfile->obfd.get (), sect,
+ objfile->section_offsets, lowest);
/* Correctly filling in the section offsets is not quite
enough. Relocatable files have two properties that
@@ -833,13 +829,13 @@ init_entry_point_info (struct objfile *objfile)
if (ei->entry_point_p)
{
struct obj_section *osect;
- CORE_ADDR entry_point = ei->entry_point;
+ CORE_ADDR entry_point = ei->entry_point;
int found;
/* Make certain that the address points at real code, and not a
function descriptor. */
- entry_point = gdbarch_convert_from_func_ptr_addr
- (objfile->arch (), entry_point, current_inferior ()->top_target ());
+ entry_point = gdbarch_convert_from_func_ptr_addr (
+ objfile->arch (), entry_point, current_inferior ()->top_target ());
/* Remove any ISA markers, so that this matches entries in the
symbol table. */
@@ -852,8 +848,8 @@ init_entry_point_info (struct objfile *objfile)
struct bfd_section *sect = osect->the_bfd_section;
if (entry_point >= bfd_section_vma (sect)
- && entry_point < (bfd_section_vma (sect)
- + bfd_section_size (sect)))
+ && entry_point
+ < (bfd_section_vma (sect) + bfd_section_size (sect)))
{
ei->the_bfd_section_index
= gdb_bfd_section_index (objfile->obfd.get (), sect);
@@ -892,8 +888,7 @@ init_entry_point_info (struct objfile *objfile)
breakpoint reset should be deferred. */
static void
-syms_from_objfile_1 (struct objfile *objfile,
- section_addr_info *addrs,
+syms_from_objfile_1 (struct objfile *objfile, section_addr_info *addrs,
symfile_add_flags add_flags)
{
section_addr_info local_addr;
@@ -921,7 +916,7 @@ syms_from_objfile_1 (struct objfile *objfile,
/* If ADDRS is NULL, put together a dummy address list.
We now establish the convention that an addr of zero means
no load address was specified. */
- if (! addrs)
+ if (!addrs)
addrs = &local_addr;
if (mainline)
@@ -977,8 +972,7 @@ syms_from_objfile_1 (struct objfile *objfile,
entry-point info. */
static void
-syms_from_objfile (struct objfile *objfile,
- section_addr_info *addrs,
+syms_from_objfile (struct objfile *objfile, section_addr_info *addrs,
symfile_add_flags add_flags)
{
syms_from_objfile_1 (objfile, addrs, add_flags);
@@ -1034,16 +1028,16 @@ finish_new_objfile (struct objfile *objfile, symfile_add_flags add_flags)
static struct objfile *
symbol_file_add_with_addrs (const gdb_bfd_ref_ptr &abfd, const char *name,
symfile_add_flags add_flags,
- section_addr_info *addrs,
- objfile_flags flags, struct objfile *parent)
+ section_addr_info *addrs, objfile_flags flags,
+ struct objfile *parent)
{
struct objfile *objfile;
const int from_tty = add_flags & SYMFILE_VERBOSE;
const int mainline = add_flags & SYMFILE_MAINLINE;
const int always_confirm = add_flags & SYMFILE_ALWAYS_CONFIRM;
- const int should_print = (print_symbol_loading_p (from_tty, mainline, 1)
- && (readnow_symbol_files
- || (add_flags & SYMFILE_NO_READ) == 0));
+ const int should_print
+ = (print_symbol_loading_p (from_tty, mainline, 1)
+ && (readnow_symbol_files || (add_flags & SYMFILE_NO_READ) == 0));
if (readnow_symbol_files)
{
@@ -1064,10 +1058,9 @@ symbol_file_add_with_addrs (const gdb_bfd_ref_ptr &abfd, const char *name,
if (from_tty
&& (always_confirm
- || ((have_full_symbols () || have_partial_symbols ())
- && mainline))
- && !query (_("Load new symbol table from \"%s\"? "), name))
- error (_("Not confirmed."));
+ || ((have_full_symbols () || have_partial_symbols ()) && mainline))
+ && !query (_ ("Load new symbol table from \"%s\"? "), name))
+ error (_ ("Not confirmed."));
if (mainline)
flags |= OBJF_MAINLINE;
@@ -1081,7 +1074,7 @@ symbol_file_add_with_addrs (const gdb_bfd_ref_ptr &abfd, const char *name,
if (deprecated_pre_add_symbol_hook)
deprecated_pre_add_symbol_hook (name);
else
- gdb_printf (_("Reading symbols from %ps...\n"),
+ gdb_printf (_ ("Reading symbols from %ps...\n"),
styled_string (file_name_style.style (), name));
}
syms_from_objfile (objfile, addrs, add_flags);
@@ -1094,7 +1087,7 @@ symbol_file_add_with_addrs (const gdb_bfd_ref_ptr &abfd, const char *name,
if ((flags & OBJF_READNOW))
{
if (should_print)
- gdb_printf (_("Expanding full symbols from %ps...\n"),
+ gdb_printf (_ ("Expanding full symbols from %ps...\n"),
styled_string (file_name_style.style (), name));
objfile->expand_all_symtabs ();
@@ -1106,7 +1099,7 @@ symbol_file_add_with_addrs (const gdb_bfd_ref_ptr &abfd, const char *name,
file, and so printing it twice is just redundant. */
if (should_print && !objfile_has_symbols (objfile)
&& objfile->separate_debug_objfile == nullptr)
- gdb_printf (_("(No debugging symbols found in %ps)\n"),
+ gdb_printf (_ ("(No debugging symbols found in %ps)\n"),
styled_string (file_name_style.style (), name));
if (should_print)
@@ -1123,7 +1116,7 @@ symbol_file_add_with_addrs (const gdb_bfd_ref_ptr &abfd, const char *name,
if (objfile->sf == NULL)
{
gdb::observers::new_objfile.notify (objfile);
- return objfile; /* No symbols. */
+ return objfile; /* No symbols. */
}
finish_new_objfile (objfile, add_flags);
@@ -1147,11 +1140,11 @@ symbol_file_add_separate (const gdb_bfd_ref_ptr &bfd, const char *name,
vma may have been modified by tools such as prelink. */
section_addr_info sap = build_section_addr_info_from_objfile (objfile);
- symbol_file_add_with_addrs
- (bfd, name, symfile_flags, &sap,
- objfile->flags & (OBJF_REORDERED | OBJF_SHARED | OBJF_READNOW
- | OBJF_USERLOADED | OBJF_MAINLINE),
- objfile);
+ symbol_file_add_with_addrs (bfd, name, symfile_flags, &sap,
+ objfile->flags
+ & (OBJF_REORDERED | OBJF_SHARED | OBJF_READNOW
+ | OBJF_USERLOADED | OBJF_MAINLINE),
+ objfile);
}
/* Process the symbol file ABFD, as either the main file or as a
@@ -1161,8 +1154,8 @@ symbol_file_add_separate (const gdb_bfd_ref_ptr &bfd, const char *name,
struct objfile *
symbol_file_add_from_bfd (const gdb_bfd_ref_ptr &abfd, const char *name,
symfile_add_flags add_flags,
- section_addr_info *addrs,
- objfile_flags flags, struct objfile *parent)
+ section_addr_info *addrs, objfile_flags flags,
+ struct objfile *parent)
{
return symbol_file_add_with_addrs (abfd, name, add_flags, addrs, flags,
parent);
@@ -1177,8 +1170,7 @@ symbol_file_add (const char *name, symfile_add_flags add_flags,
{
gdb_bfd_ref_ptr bfd (symfile_bfd_open (name));
- return symbol_file_add_from_bfd (bfd, name, add_flags, addrs,
- flags, NULL);
+ return symbol_file_add_from_bfd (bfd, name, add_flags, addrs, flags, NULL);
}
/* Call symbol_file_add() with default values and update whatever is
@@ -1216,13 +1208,13 @@ symbol_file_add_main_1 (const char *args, symfile_add_flags add_flags,
void
symbol_file_clear (int from_tty)
{
- if ((have_full_symbols () || have_partial_symbols ())
- && from_tty
- && (current_program_space->symfile_object_file
- ? !query (_("Discard symbol table from `%s'? "),
+ if (
+ (have_full_symbols () || have_partial_symbols ()) && from_tty
+ && (current_program_space->symfile_object_file
+ ? !query (_ ("Discard symbol table from `%s'? "),
objfile_name (current_program_space->symfile_object_file))
- : !query (_("Discard symbol table? "))))
- error (_("Not confirmed."));
+ : !query (_ ("Discard symbol table? "))))
+ error (_ ("Not confirmed."));
/* solib descriptors may have handles to objfiles. Wipe them before their
objfiles get stale by free_all_objfiles. */
@@ -1234,7 +1226,7 @@ symbol_file_clear (int from_tty)
gdb_assert (current_program_space->symfile_object_file == NULL);
if (from_tty)
- gdb_printf (_("No symbol file now.\n"));
+ gdb_printf (_ ("No symbol file now.\n"));
}
/* See symfile.h. */
@@ -1262,7 +1254,7 @@ separate_debug_file_exists (const std::string &name, unsigned long crc,
if (separate_debug_file_debug)
{
- gdb_printf (gdb_stdlog, _(" Trying %s..."), name.c_str ());
+ gdb_printf (gdb_stdlog, _ (" Trying %s..."), name.c_str ());
gdb_flush (gdb_stdlog);
}
@@ -1271,7 +1263,7 @@ separate_debug_file_exists (const std::string &name, unsigned long crc,
if (abfd == NULL)
{
if (separate_debug_file_debug)
- gdb_printf (gdb_stdlog, _(" no, unable to open.\n"));
+ gdb_printf (gdb_stdlog, _ (" no, unable to open.\n"));
return 0;
}
@@ -1287,16 +1279,14 @@ separate_debug_file_exists (const std::string &name, unsigned long crc,
numbers will never set st_ino to zero, this is merely an
optimization, so we do not need to worry about false negatives. */
- if (bfd_stat (abfd.get (), &abfd_stat) == 0
- && abfd_stat.st_ino != 0
+ if (bfd_stat (abfd.get (), &abfd_stat) == 0 && abfd_stat.st_ino != 0
&& bfd_stat (parent_objfile->obfd.get (), &parent_stat) == 0)
{
if (abfd_stat.st_dev == parent_stat.st_dev
&& abfd_stat.st_ino == parent_stat.st_ino)
{
if (separate_debug_file_debug)
- gdb_printf (gdb_stdlog,
- _(" no, same file as the objfile.\n"));
+ gdb_printf (gdb_stdlog, _ (" no, same file as the objfile.\n"));
return 0;
}
@@ -1310,7 +1300,7 @@ separate_debug_file_exists (const std::string &name, unsigned long crc,
if (!file_crc_p)
{
if (separate_debug_file_debug)
- gdb_printf (gdb_stdlog, _(" no, error computing CRC.\n"));
+ gdb_printf (gdb_stdlog, _ (" no, error computing CRC.\n"));
return 0;
}
@@ -1328,8 +1318,7 @@ separate_debug_file_exists (const std::string &name, unsigned long crc,
if (!gdb_bfd_crc (parent_objfile->obfd.get (), &parent_crc))
{
if (separate_debug_file_debug)
- gdb_printf (gdb_stdlog,
- _(" no, error computing CRC.\n"));
+ gdb_printf (gdb_stdlog, _ (" no, error computing CRC.\n"));
return 0;
}
@@ -1338,8 +1327,8 @@ separate_debug_file_exists (const std::string &name, unsigned long crc,
if (verified_as_different || parent_crc != file_crc)
{
std::string msg
- = string_printf (_("the debug information found in \"%s\""
- " does not match \"%s\" (CRC mismatch).\n"),
+ = string_printf (_ ("the debug information found in \"%s\""
+ " does not match \"%s\" (CRC mismatch).\n"),
name.c_str (), objfile_name (parent_objfile));
if (separate_debug_file_debug)
gdb_printf (gdb_stdlog, "%s", msg.c_str ());
@@ -1350,23 +1339,24 @@ separate_debug_file_exists (const std::string &name, unsigned long crc,
}
if (separate_debug_file_debug)
- gdb_printf (gdb_stdlog, _(" yes!\n"));
+ gdb_printf (gdb_stdlog, _ (" yes!\n"));
return 1;
}
std::string debug_file_directory;
+
static void
show_debug_file_directory (struct ui_file *file, int from_tty,
struct cmd_list_element *c, const char *value)
{
gdb_printf (file,
- _("The directory where separate debug "
- "symbols are searched for is \"%s\".\n"),
+ _ ("The directory where separate debug "
+ "symbols are searched for is \"%s\".\n"),
value);
}
-#if ! defined (DEBUG_SUBDIRECTORY)
+#if !defined(DEBUG_SUBDIRECTORY)
#define DEBUG_SUBDIRECTORY ".debug"
#endif
@@ -1382,16 +1372,16 @@ show_debug_file_directory (struct ui_file *file, int from_tty,
WARNINGS_VECTOR, one std::string per warning. */
static std::string
-find_separate_debug_file (const char *dir,
- const char *canon_dir,
- const char *debuglink,
- unsigned long crc32, struct objfile *objfile,
+find_separate_debug_file (const char *dir, const char *canon_dir,
+ const char *debuglink, unsigned long crc32,
+ struct objfile *objfile,
std::vector<std::string> *warnings_vector)
{
if (separate_debug_file_debug)
gdb_printf (gdb_stdlog,
- _("\nLooking for separate debug info (debug link) for "
- "%s\n"), objfile_name (objfile));
+ _ ("\nLooking for separate debug info (debug link) for "
+ "%s\n"),
+ objfile_name (objfile));
/* First try in the same directory as the original file. */
std::string debugfile = dir;
@@ -1421,7 +1411,7 @@ find_separate_debug_file (const char *dir,
gdb::unique_xmalloc_ptr<char> canon_sysroot
= gdb_realpath (gdb_sysroot.c_str ());
- /* MS-Windows/MS-DOS don't allow colons in file names; we must
+ /* MS-Windows/MS-DOS don't allow colons in file names; we must
convert the drive letter into a one-letter directory, so that the
file name resulting from splicing below will be valid.
@@ -1522,7 +1512,7 @@ terminate_after_last_dir_separator (char *path)
/* Strip off the final filename part, leaving the directory name,
followed by a slash. The directory can be relative or absolute. */
- for (i = strlen(path) - 1; i >= 0; i--)
+ for (i = strlen (path) - 1; i >= 0; i--)
if (IS_DIR_SEPARATOR (path[i]))
break;
@@ -1533,13 +1523,13 @@ terminate_after_last_dir_separator (char *path)
/* See symtab.h. */
std::string
-find_separate_debug_file_by_debuglink
- (struct objfile *objfile, std::vector<std::string> *warnings_vector)
+find_separate_debug_file_by_debuglink (
+ struct objfile *objfile, std::vector<std::string> *warnings_vector)
{
unsigned long crc32;
- gdb::unique_xmalloc_ptr<char> debuglink
- (bfd_get_debug_link_info (objfile->obfd.get (), &crc32));
+ gdb::unique_xmalloc_ptr<char> debuglink (
+ bfd_get_debug_link_info (objfile->obfd.get (), &crc32));
if (debuglink == NULL)
{
@@ -1567,20 +1557,19 @@ find_separate_debug_file_by_debuglink
if (lstat (objfile_name (objfile), &st_buf) == 0
&& S_ISLNK (st_buf.st_mode))
{
- gdb::unique_xmalloc_ptr<char> symlink_dir
- (lrealpath (objfile_name (objfile)));
+ gdb::unique_xmalloc_ptr<char> symlink_dir (
+ lrealpath (objfile_name (objfile)));
if (symlink_dir != NULL)
{
terminate_after_last_dir_separator (symlink_dir.get ());
if (dir != symlink_dir.get ())
{
/* Different directory, so try using it. */
- debugfile = find_separate_debug_file (symlink_dir.get (),
- symlink_dir.get (),
- debuglink.get (),
- crc32,
- objfile,
- warnings_vector);
+ debugfile
+ = find_separate_debug_file (symlink_dir.get (),
+ symlink_dir.get (),
+ debuglink.get (), crc32,
+ objfile, warnings_vector);
}
}
}
@@ -1596,7 +1585,7 @@ static void
validate_readnow_readnever (objfile_flags flags)
{
if ((flags & OBJF_READNOW) && (flags & OBJF_READNEVER))
- error (_("-readnow and -readnever cannot be used simultaneously"));
+ error (_ ("-readnow and -readnever cannot be used simultaneously"));
}
/* This is the symbol-file command. Read the file, analyze its
@@ -1643,7 +1632,7 @@ symbol_file_command (const char *args, int from_tty)
if (name == NULL)
name = arg;
else
- error (_("Unrecognized argument \"%s\""), arg);
+ error (_ ("Unrecognized argument \"%s\""), arg);
}
else if (strcmp (arg, "-readnow") == 0)
flags |= OBJF_READNOW;
@@ -1653,18 +1642,18 @@ symbol_file_command (const char *args, int from_tty)
{
arg = built_argv[++idx];
if (arg == NULL)
- error (_("Missing argument to -o"));
+ error (_ ("Missing argument to -o"));
offset = parse_and_eval_address (arg);
}
else if (strcmp (arg, "--") == 0)
stop_processing_options = true;
else
- error (_("Unrecognized argument \"%s\""), arg);
+ error (_ ("Unrecognized argument \"%s\""), arg);
}
if (name == NULL)
- error (_("no symbol file name was specified"));
+ error (_ ("no symbol file name was specified"));
validate_readnow_readnever (flags);
@@ -1701,9 +1690,9 @@ set_initial_language (void)
if (lang == language_unknown)
{
const char *name = main_name ();
- struct symbol *sym
- = lookup_symbol_in_language (name, NULL, VAR_DOMAIN, default_lang,
- NULL).symbol;
+ struct symbol *sym = lookup_symbol_in_language (name, NULL, VAR_DOMAIN,
+ default_lang, NULL)
+ .symbol;
if (sym != NULL)
lang = sym->language ();
@@ -1734,18 +1723,17 @@ symfile_bfd_open (const char *name)
gdb::unique_xmalloc_ptr<char> expanded_name (tilde_expand (name));
/* Look down path for it, allocate 2nd new malloc'd copy. */
- desc = openp (getenv ("PATH"),
- OPF_TRY_CWD_FIRST | OPF_RETURN_REALPATH,
+ desc = openp (getenv ("PATH"), OPF_TRY_CWD_FIRST | OPF_RETURN_REALPATH,
expanded_name.get (), O_RDONLY | O_BINARY, &absolute_name);
-#if defined(__GO32__) || defined(_WIN32) || defined (__CYGWIN__)
+#if defined(__GO32__) || defined(_WIN32) || defined(__CYGWIN__)
if (desc < 0)
{
char *exename = (char *) alloca (strlen (expanded_name.get ()) + 5);
strcat (strcpy (exename, expanded_name.get ()), ".exe");
- desc = openp (getenv ("PATH"),
- OPF_TRY_CWD_FIRST | OPF_RETURN_REALPATH,
- exename, O_RDONLY | O_BINARY, &absolute_name);
+ desc
+ = openp (getenv ("PATH"), OPF_TRY_CWD_FIRST | OPF_RETURN_REALPATH,
+ exename, O_RDONLY | O_BINARY, &absolute_name);
}
#endif
if (desc < 0)
@@ -1756,14 +1744,14 @@ symfile_bfd_open (const char *name)
gdb_bfd_ref_ptr sym_bfd (gdb_bfd_open (name, gnutarget, desc));
if (sym_bfd == NULL)
- error (_("`%s': can't open to read symbols: %s."), name,
+ error (_ ("`%s': can't open to read symbols: %s."), name,
bfd_errmsg (bfd_get_error ()));
if (!gdb_bfd_has_target_filename (sym_bfd.get ()))
bfd_set_cacheable (sym_bfd.get (), 1);
if (!bfd_check_format (sym_bfd.get (), bfd_object))
- error (_("`%s': can't read symbols: %s."), name,
+ error (_ ("`%s': can't read symbols: %s."), name,
bfd_errmsg (bfd_get_error ()));
return sym_bfd;
@@ -1775,7 +1763,8 @@ symfile_bfd_open (const char *name)
int
get_section_index (struct objfile *objfile, const char *section_name)
{
- asection *sect = bfd_get_section_by_name (objfile->obfd.get (), section_name);
+ asection *sect
+ = bfd_get_section_by_name (objfile->obfd.get (), section_name);
if (sect)
return sect->index;
@@ -1808,16 +1797,15 @@ find_sym_fns (bfd *abfd)
if (our_flavour == bfd_target_srec_flavour
|| our_flavour == bfd_target_ihex_flavour
|| our_flavour == bfd_target_tekhex_flavour)
- return NULL; /* No symbols. */
+ return NULL; /* No symbols. */
for (const registered_sym_fns &rsf : symtab_fns)
if (our_flavour == rsf.sym_flavour)
return rsf.sym_fns;
- error (_("I'm sorry, Dave, I can't do that. Symbol format `%s' unknown."),
+ error (_ ("I'm sorry, Dave, I can't do that. Symbol format `%s' unknown."),
bfd_get_target (abfd));
}
-
/* This function runs the load command of our current target. */
@@ -1887,11 +1875,16 @@ struct load_progress_data
struct load_progress_section_data
{
load_progress_section_data (load_progress_data *cumulative_,
- const char *section_name_, ULONGEST section_size_,
- CORE_ADDR lma_, gdb_byte *buffer_)
- : cumulative (cumulative_), section_name (section_name_),
- section_size (section_size_), lma (lma_), buffer (buffer_)
- {}
+ const char *section_name_,
+ ULONGEST section_size_, CORE_ADDR lma_,
+ gdb_byte *buffer_)
+ : cumulative (cumulative_),
+ section_name (section_name_),
+ section_size (section_size_),
+ lma (lma_),
+ buffer (buffer_)
+ {
+ }
struct load_progress_data *cumulative;
@@ -1908,7 +1901,8 @@ struct load_section_data
{
load_section_data (load_progress_data *progress_data_)
: progress_data (progress_data_)
- {}
+ {
+ }
~load_section_data ()
{
@@ -1963,10 +1957,10 @@ load_progress (ULONGEST bytes, void *untyped_arg)
gdb::byte_vector check (bytes);
if (target_read_memory (args->lma, check.data (), bytes) != 0)
- error (_("Download verify read failed at %s"),
+ error (_ ("Download verify read failed at %s"),
paddress (target_gdbarch (), args->lma));
if (memcmp (args->buffer, check.data (), bytes) != 0)
- error (_("Download verify compare failed at %s"),
+ error (_ ("Download verify compare failed at %s"),
paddress (target_gdbarch (), args->lma));
}
totals->data_count += bytes;
@@ -1978,21 +1972,18 @@ load_progress (ULONGEST bytes, void *untyped_arg)
|| (deprecated_ui_load_progress_hook != NULL
&& deprecated_ui_load_progress_hook (args->section_name,
args->section_sent)))
- error (_("Canceled the download"));
+ error (_ ("Canceled the download"));
if (deprecated_show_load_progress != NULL)
- deprecated_show_load_progress (args->section_name,
- args->section_sent,
- args->section_size,
- totals->data_count,
+ deprecated_show_load_progress (args->section_name, args->section_sent,
+ args->section_size, totals->data_count,
totals->total_size);
}
/* Service function for generic_load. */
static void
-load_one_section (bfd *abfd, asection *asec,
- struct load_section_data *args)
+load_one_section (bfd *abfd, asection *asec, struct load_section_data *args)
{
bfd_size_type size = bfd_section_size (asec);
const char *sect_name = bfd_section_name (asec);
@@ -2030,7 +2021,7 @@ generic_load (const char *args, int from_tty)
struct ui_out *uiout = current_uiout;
if (args == NULL)
- error_no_arg (_("file to load"));
+ error_no_arg (_ ("file to load"));
gdb_argv argv (args);
@@ -2045,10 +2036,10 @@ generic_load (const char *args, int from_tty)
/* If the last word was not a valid number then
treat it as a file name with spaces in. */
if (argv[1] == endptr)
- error (_("Invalid download offset:%s."), argv[1]);
+ error (_ ("Invalid download offset:%s."), argv[1]);
if (argv[2] != NULL)
- error (_("Too many parameters."));
+ error (_ ("Too many parameters."));
}
/* Open the file for loading. */
@@ -2058,7 +2049,7 @@ generic_load (const char *args, int from_tty)
if (!bfd_check_format (loadfile_bfd.get (), bfd_object))
{
- error (_("\"%s\" is not an object file: %s"), filename.get (),
+ error (_ ("\"%s\" is not an object file: %s"), filename.get (),
bfd_errmsg (bfd_get_error ()));
}
@@ -2073,8 +2064,9 @@ generic_load (const char *args, int from_tty)
steady_clock::time_point start_time = steady_clock::now ();
if (target_write_memory_blocks (cbdata.requests, flash_discard,
- load_progress) != 0)
- error (_("Load failed"));
+ load_progress)
+ != 0)
+ error (_ ("Load failed"));
steady_clock::time_point end_time = steady_clock::now ();
@@ -2109,8 +2101,7 @@ generic_load (const char *args, int from_tty)
lasted. */
static void
-print_transfer_performance (struct ui_file *stream,
- unsigned long data_count,
+print_transfer_performance (struct ui_file *stream, unsigned long data_count,
unsigned long write_count,
std::chrono::steady_clock::duration time)
{
@@ -2171,8 +2162,7 @@ set_objfile_default_section_offset (struct objfile *objf,
std::vector<const struct other_sections *> addrs_sorted
= addrs_section_sort (addrs);
- section_addr_info objf_addrs
- = build_section_addr_info_from_objfile (objf);
+ section_addr_info objf_addrs = build_section_addr_info_from_objfile (objf);
std::vector<const struct other_sections *> objf_addrs_sorted
= addrs_section_sort (objf_addrs);
@@ -2238,7 +2228,7 @@ add_symbol_file_command (const char *args, int from_tty)
dont_repeat ();
if (args == NULL)
- error (_("add-symbol-file takes a file name and an address"));
+ error (_ ("add-symbol-file takes a file name and an address"));
bool seen_addr = false;
bool seen_offset = false;
@@ -2261,7 +2251,7 @@ add_symbol_file_command (const char *args, int from_tty)
seen_addr = true;
}
else
- error (_("Unrecognized argument \"%s\""), arg);
+ error (_ ("Unrecognized argument \"%s\""), arg);
}
else if (strcmp (arg, "-readnow") == 0)
flags |= OBJF_READNOW;
@@ -2270,9 +2260,9 @@ add_symbol_file_command (const char *args, int from_tty)
else if (strcmp (arg, "-s") == 0)
{
if (argv[argcnt + 1] == NULL)
- error (_("Missing section name after \"-s\""));
+ error (_ ("Missing section name after \"-s\""));
else if (argv[argcnt + 2] == NULL)
- error (_("Missing section address after \"-s\""));
+ error (_ ("Missing section address after \"-s\""));
sect_opt sect = { argv[argcnt + 1], argv[argcnt + 2] };
@@ -2283,7 +2273,7 @@ add_symbol_file_command (const char *args, int from_tty)
{
arg = argv[++argcnt];
if (arg == NULL)
- error (_("Missing argument to -o"));
+ error (_ ("Missing argument to -o"));
offset = parse_and_eval_address (arg);
seen_offset = true;
@@ -2291,11 +2281,11 @@ add_symbol_file_command (const char *args, int from_tty)
else if (strcmp (arg, "--") == 0)
stop_processing_options = true;
else
- error (_("Unrecognized argument \"%s\""), arg);
+ error (_ ("Unrecognized argument \"%s\""), arg);
}
if (filename == NULL)
- error (_("You must provide a filename to be loaded."));
+ error (_ ("You must provide a filename to be loaded."));
validate_readnow_readnever (flags);
@@ -2305,8 +2295,7 @@ add_symbol_file_command (const char *args, int from_tty)
statements because hex_string returns a local static
string. */
- gdb_printf (_("add symbol table from file \"%s\""),
- filename.get ());
+ gdb_printf (_ ("add symbol table from file \"%s\""), filename.get ());
section_addr_info section_addrs;
std::vector<sect_opt>::const_iterator it = sect_opts.begin ();
if (!seen_addr)
@@ -2318,7 +2307,7 @@ add_symbol_file_command (const char *args, int from_tty)
const char *sec = it->name;
if (section_addrs.empty ())
- gdb_printf (_(" at\n"));
+ gdb_printf (_ (" at\n"));
addr = parse_and_eval_address (val);
/* Here we store the section offsets in the order they were
@@ -2328,8 +2317,7 @@ add_symbol_file_command (const char *args, int from_tty)
index is not used for any other purpose.
*/
section_addrs.emplace_back (addr, sec, section_addrs.size ());
- gdb_printf ("\t%s_addr = %s\n", sec,
- paddress (gdbarch, addr));
+ gdb_printf ("\t%s_addr = %s\n", sec, paddress (gdbarch, addr));
/* The object's sections are initialized when a
call is made to build_objfile_section_table (objfile).
@@ -2338,21 +2326,19 @@ add_symbol_file_command (const char *args, int from_tty)
so we can't determine what section names are valid. */
}
if (seen_offset)
- gdb_printf (_("%s offset by %s\n"),
- (section_addrs.empty ()
- ? _(" with all sections")
- : _("with other sections")),
+ gdb_printf (_ ("%s offset by %s\n"),
+ (section_addrs.empty () ? _ (" with all sections")
+ : _ ("with other sections")),
paddress (gdbarch, offset));
else if (section_addrs.empty ())
gdb_printf ("\n");
if (from_tty && (!query ("%s", "")))
- error (_("Not confirmed."));
+ error (_ ("Not confirmed."));
- objf = symbol_file_add (filename.get (), add_flags, &section_addrs,
- flags);
+ objf = symbol_file_add (filename.get (), add_flags, &section_addrs, flags);
if (!objfile_has_symbols (objf) && objf->per_bfd->minimal_symbol_count <= 0)
- warning (_("newly-added symbol file \"%s\" does not provide any symbols"),
+ warning (_ ("newly-added symbol file \"%s\" does not provide any symbols"),
filename.get ());
if (seen_offset)
@@ -2364,7 +2350,6 @@ add_symbol_file_command (const char *args, int from_tty)
frameless. */
reinit_frame_cache ();
}
-
/* This function removes a symbol file that was added via add-symbol-file. */
@@ -2377,7 +2362,7 @@ remove_symbol_file_command (const char *args, int from_tty)
dont_repeat ();
if (args == NULL)
- error (_("remove-symbol-file: no symbol file provided"));
+ error (_ ("remove-symbol-file: no symbol file provided"));
gdb_argv argv (args);
@@ -2387,10 +2372,10 @@ remove_symbol_file_command (const char *args, int from_tty)
CORE_ADDR addr;
if (argv[1] == NULL)
- error (_("Missing address argument"));
+ error (_ ("Missing address argument"));
if (argv[2] != NULL)
- error (_("Junk after %s"), argv[1]);
+ error (_ ("Junk after %s"), argv[1]);
addr = parse_and_eval_address (argv[1]);
@@ -2411,7 +2396,7 @@ remove_symbol_file_command (const char *args, int from_tty)
/* Interpret the current argument as a file name. */
if (argv[1] != NULL)
- error (_("Junk after %s"), argv[0]);
+ error (_ ("Junk after %s"), argv[0]);
gdb::unique_xmalloc_ptr<char> filename (tilde_expand (argv[0]));
@@ -2429,12 +2414,12 @@ remove_symbol_file_command (const char *args, int from_tty)
}
if (objf == NULL)
- error (_("No symbol file found"));
+ error (_ ("No symbol file found"));
if (from_tty
- && !query (_("Remove symbol table from file \"%s\"? "),
+ && !query (_ ("Remove symbol table from file \"%s\"? "),
objfile_name (objf)))
- error (_("Not confirmed."));
+ error (_ ("Not confirmed."));
objf->unlink ();
clear_symtab_users (0);
@@ -2464,20 +2449,21 @@ reread_symbols (int from_tty)
a `shared library' on AIX is also an archive), then you should
stat on the archive name, not member name. */
if (objfile->obfd->my_archive)
- res = stat (bfd_get_filename (objfile->obfd->my_archive), &new_statbuf);
+ res
+ = stat (bfd_get_filename (objfile->obfd->my_archive), &new_statbuf);
else
res = stat (objfile_name (objfile), &new_statbuf);
if (res != 0)
{
/* FIXME, should use print_sys_errmsg but it's not filtered. */
- gdb_printf (_("`%s' has disappeared; keeping its symbols.\n"),
+ gdb_printf (_ ("`%s' has disappeared; keeping its symbols.\n"),
objfile_name (objfile));
continue;
}
new_modtime = new_statbuf.st_mtime;
if (new_modtime != objfile->mtime)
{
- gdb_printf (_("`%s' has changed; re-reading symbols.\n"),
+ gdb_printf (_ ("`%s' has changed; re-reading symbols.\n"),
objfile_name (objfile));
/* There are various functions like symbol_file_add,
@@ -2496,8 +2482,10 @@ reread_symbols (int from_tty)
clear_symtab_users_cleanup defer_clear_users (0);
if (current_program_space->exec_bfd () != NULL
- && filename_cmp (bfd_get_filename (objfile->obfd.get ()),
- bfd_get_filename (current_program_space->exec_bfd ())) == 0)
+ && filename_cmp (
+ bfd_get_filename (objfile->obfd.get ()),
+ bfd_get_filename (current_program_space->exec_bfd ()))
+ == 0)
{
/* Reload EXEC_BFD without asking anything. */
@@ -2541,15 +2529,15 @@ reread_symbols (int from_tty)
gdb_bfd_ref_ptr temp (gdb_bfd_open (obfd_filename, gnutarget));
objfile->obfd = std::move (temp);
if (objfile->obfd == NULL)
- error (_("Can't open %s to read symbols."), obfd_filename);
+ error (_ ("Can't open %s to read symbols."), obfd_filename);
}
std::string original_name = objfile->original_name;
/* bfd_openr sets cacheable to true, which is what we want. */
if (!bfd_check_format (objfile->obfd.get (), bfd_object))
- error (_("Can't read symbols from %s: %s."), objfile_name (objfile),
- bfd_errmsg (bfd_get_error ()));
+ error (_ ("Can't read symbols from %s: %s."),
+ objfile_name (objfile), bfd_errmsg (bfd_get_error ()));
/* NB: after this call to obstack_free, objfiles_changed
will need to be called (see discussion below). */
@@ -2623,10 +2611,11 @@ reread_symbols (int from_tty)
if ((objfile->flags & OBJF_READNOW))
{
const int mainline = objfile->flags & OBJF_MAINLINE;
- const int should_print = (print_symbol_loading_p (from_tty, mainline, 1)
- && readnow_symbol_files);
+ const int should_print
+ = (print_symbol_loading_p (from_tty, mainline, 1)
+ && readnow_symbol_files);
if (should_print)
- gdb_printf (_("Expanding full symbols from %ps...\n"),
+ gdb_printf (_ ("Expanding full symbols from %ps...\n"),
styled_string (file_name_style.style (),
objfile_name (objfile)));
@@ -2636,7 +2625,7 @@ reread_symbols (int from_tty)
if (!objfile_has_symbols (objfile))
{
gdb_stdout->wrap_here (0);
- gdb_printf (_("(no debugging symbols found)\n"));
+ gdb_printf (_ ("(no debugging symbols found)\n"));
gdb_stdout->wrap_here (0);
}
@@ -2677,13 +2666,14 @@ reread_symbols (int from_tty)
gdb::observers::executable_changed.notify ();
}
}
-
struct filename_language
{
filename_language (const std::string &ext_, enum language lang_)
- : ext (ext_), lang (lang_)
- {}
+ : ext (ext_),
+ lang (lang_)
+ {
+ }
std::string ext;
enum language lang;
@@ -2701,34 +2691,36 @@ add_filename_language (const char *ext, enum language lang)
}
static std::string ext_args;
+
static void
-show_ext_args (struct ui_file *file, int from_tty,
- struct cmd_list_element *c, const char *value)
+show_ext_args (struct ui_file *file, int from_tty, struct cmd_list_element *c,
+ const char *value)
{
gdb_printf (file,
- _("Mapping between filename extension "
- "and source language is \"%s\".\n"),
+ _ ("Mapping between filename extension "
+ "and source language is \"%s\".\n"),
value);
}
static void
-set_ext_lang_command (const char *args,
- int from_tty, struct cmd_list_element *e)
+set_ext_lang_command (const char *args, int from_tty,
+ struct cmd_list_element *e)
{
const char *begin = ext_args.c_str ();
const char *end = ext_args.c_str ();
/* First arg is filename extension, starting with '.' */
if (*end != '.')
- error (_("'%s': Filename extension must begin with '.'"), ext_args.c_str ());
+ error (_ ("'%s': Filename extension must begin with '.'"),
+ ext_args.c_str ());
/* Find end of first arg. */
while (*end != '\0' && !isspace (*end))
end++;
if (*end == '\0')
- error (_("'%s': two arguments required -- "
- "filename extension and language"),
+ error (_ ("'%s': two arguments required -- "
+ "filename extension and language"),
ext_args.c_str ());
/* Extract first arg, the extension. */
@@ -2738,8 +2730,8 @@ set_ext_lang_command (const char *args,
begin = skip_spaces (end);
if (*begin == '\0')
- error (_("'%s': two arguments required -- "
- "filename extension and language"),
+ error (_ ("'%s': two arguments required -- "
+ "filename extension and language"),
ext_args.c_str ());
/* Lookup the language from among those we know. */
@@ -2773,11 +2765,10 @@ set_ext_lang_command (const char *args,
static void
info_ext_lang_command (const char *args, int from_tty)
{
- gdb_printf (_("Filename extensions and the languages they represent:"));
+ gdb_printf (_ ("Filename extensions and the languages they represent:"));
gdb_printf ("\n\n");
for (const filename_language &entry : filename_language_table)
- gdb_printf ("\t%s\t- %s\n", entry.ext.c_str (),
- language_str (entry.lang));
+ gdb_printf ("\t%s\t- %s\n", entry.ext.c_str (), language_str (entry.lang));
}
enum language
@@ -2795,7 +2786,7 @@ deduce_language_from_filename (const char *filename)
return language_unknown;
}
-
+
/* Allocate and initialize a new symbol table.
CUST is from the result of allocate_compunit_symtab. */
@@ -2825,8 +2816,8 @@ allocate_symtab (struct compunit_symtab *cust, const char *filename,
{
last_objfile_name = this_objfile_name;
- symtab_create_debug_printf_v
- ("creating one or more symtabs for objfile %s", this_objfile_name);
+ symtab_create_debug_printf_v (
+ "creating one or more symtabs for objfile %s", this_objfile_name);
}
symtab_create_debug_printf_v ("created symtab %s for module %s",
@@ -2849,8 +2840,8 @@ allocate_symtab (struct compunit_symtab *cust, const char *filename,
struct compunit_symtab *
allocate_compunit_symtab (struct objfile *objfile, const char *name)
{
- struct compunit_symtab *cu = OBSTACK_ZALLOC (&objfile->objfile_obstack,
- struct compunit_symtab);
+ struct compunit_symtab *cu
+ = OBSTACK_ZALLOC (&objfile->objfile_obstack, struct compunit_symtab);
const char *saved_name;
cu->set_objfile (objfile);
@@ -2864,8 +2855,7 @@ allocate_compunit_symtab (struct objfile *objfile, const char *name)
cu->set_debugformat ("unknown");
symtab_create_debug_printf_v ("created compunit symtab %s for %s",
- host_address_to_string (cu),
- cu->name);
+ host_address_to_string (cu), cu->name);
return cu;
}
@@ -2878,7 +2868,6 @@ add_compunit_symtab_to_objfile (struct compunit_symtab *cu)
cu->next = cu->objfile ()->compunit_symtabs;
cu->objfile ()->compunit_symtabs = cu;
}
-
/* Reset all data structures in gdb which may contain references to
symbol table data. */
@@ -2903,7 +2892,7 @@ clear_symtab_users (symfile_add_flags add_flags)
if ((add_flags & SYMFILE_DEFER_BP_RESET) == 0)
breakpoint_re_set ();
}
-
+
/* OVERLAYS:
The following code implements an abstraction for debugging overlay sections.
@@ -2955,7 +2944,7 @@ clear_symtab_users (symfile_add_flags add_flags)
/* Overlay debugging state: */
enum overlay_debugging_state overlay_debugging = ovly_off;
-int overlay_cache_invalid = 0; /* True if need to refresh mapped state. */
+int overlay_cache_invalid = 0; /* True if need to refresh mapped state. */
/* Function: section_is_overlay (SECTION)
Returns true if SECTION has VMA not equal to LMA, ie.
@@ -3011,8 +3000,8 @@ section_is_mapped (struct obj_section *osect)
{
default:
case ovly_off:
- return 0; /* overlay debugging off */
- case ovly_auto: /* overlay debugging automatic */
+ return 0; /* overlay debugging off */
+ case ovly_auto: /* overlay debugging automatic */
/* Unles there is a gdbarch_overlay_update function,
there's really nothing useful to do here (can't really go auto). */
gdbarch = osect->objfile->arch ();
@@ -3027,7 +3016,7 @@ section_is_mapped (struct obj_section *osect)
gdbarch_overlay_update (gdbarch, osect);
}
/* fall thru */
- case ovly_on: /* overlay debugging manual */
+ case ovly_on: /* overlay debugging manual */
return osect->ovly_mapped == 1;
}
}
@@ -3062,8 +3051,7 @@ pc_in_mapped_range (CORE_ADDR pc, struct obj_section *section)
{
if (section_is_overlay (section))
{
- if (section->addr () <= pc
- && pc < section->endaddr ())
+ if (section->addr () <= pc && pc < section->endaddr ())
return true;
}
@@ -3238,7 +3226,7 @@ list_overlays_command (const char *args, int from_tty)
}
}
if (nmapped == 0)
- gdb_printf (_("No sections are mapped.\n"));
+ gdb_printf (_ ("No sections are mapped.\n"));
}
/* Function: map_overlay_command
@@ -3250,12 +3238,12 @@ map_overlay_command (const char *args, int from_tty)
struct obj_section *sec, *sec2;
if (!overlay_debugging)
- error (_("Overlay debugging not enabled. Use "
- "either the 'overlay auto' or\n"
- "the 'overlay manual' command."));
+ error (_ ("Overlay debugging not enabled. Use "
+ "either the 'overlay auto' or\n"
+ "the 'overlay manual' command."));
if (args == 0 || *args == 0)
- error (_("Argument required: name of an overlay section"));
+ error (_ ("Argument required: name of an overlay section"));
/* First, find a section matching the user supplied argument. */
for (objfile *obj_file : current_program_space->objfiles ())
@@ -3264,7 +3252,7 @@ map_overlay_command (const char *args, int from_tty)
{
/* Now, check to see if the section is an overlay. */
if (!section_is_overlay (sec))
- continue; /* not an overlay section */
+ continue; /* not an overlay section */
/* Mark the overlay as "mapped". */
sec->ovly_mapped = 1;
@@ -3273,17 +3261,17 @@ map_overlay_command (const char *args, int from_tty)
overlapped by this new section: */
for (objfile *objfile2 : current_program_space->objfiles ())
ALL_OBJFILE_OSECTIONS (objfile2, sec2)
- if (sec2->ovly_mapped && sec != sec2 && sections_overlap (sec,
- sec2))
+ if (sec2->ovly_mapped && sec != sec2
+ && sections_overlap (sec, sec2))
{
if (info_verbose)
- gdb_printf (_("Note: section %s unmapped by overlap\n"),
+ gdb_printf (_ ("Note: section %s unmapped by overlap\n"),
bfd_section_name (sec2->the_bfd_section));
sec2->ovly_mapped = 0; /* sec2 overlaps sec: unmap sec2. */
}
return;
}
- error (_("No overlay section called %s"), args);
+ error (_ ("No overlay section called %s"), args);
}
/* Function: unmap_overlay_command
@@ -3296,12 +3284,12 @@ unmap_overlay_command (const char *args, int from_tty)
struct obj_section *sec = NULL;
if (!overlay_debugging)
- error (_("Overlay debugging not enabled. "
- "Use either the 'overlay auto' or\n"
- "the 'overlay manual' command."));
+ error (_ ("Overlay debugging not enabled. "
+ "Use either the 'overlay auto' or\n"
+ "the 'overlay manual' command."));
if (args == 0 || *args == 0)
- error (_("Argument required: name of an overlay section"));
+ error (_ ("Argument required: name of an overlay section"));
/* First, find a section matching the user supplied argument. */
for (objfile *objfile : current_program_space->objfiles ())
@@ -3309,11 +3297,11 @@ unmap_overlay_command (const char *args, int from_tty)
if (!strcmp (bfd_section_name (sec->the_bfd_section), args))
{
if (!sec->ovly_mapped)
- error (_("Section %s is not mapped"), args);
+ error (_ ("Section %s is not mapped"), args);
sec->ovly_mapped = 0;
return;
}
- error (_("No overlay section called %s"), args);
+ error (_ ("No overlay section called %s"), args);
}
/* Function: overlay_auto_command
@@ -3326,7 +3314,7 @@ overlay_auto_command (const char *args, int from_tty)
overlay_debugging = ovly_auto;
enable_overlay_breakpoints ();
if (info_verbose)
- gdb_printf (_("Automatic overlay debugging enabled."));
+ gdb_printf (_ ("Automatic overlay debugging enabled."));
}
/* Function: overlay_manual_command
@@ -3339,7 +3327,7 @@ overlay_manual_command (const char *args, int from_tty)
overlay_debugging = ovly_on;
disable_overlay_breakpoints ();
if (info_verbose)
- gdb_printf (_("Overlay debugging enabled."));
+ gdb_printf (_ ("Overlay debugging enabled."));
}
/* Function: overlay_off_command
@@ -3352,7 +3340,7 @@ overlay_off_command (const char *args, int from_tty)
overlay_debugging = ovly_off;
disable_overlay_breakpoints ();
if (info_verbose)
- gdb_printf (_("Overlay debugging disabled."));
+ gdb_printf (_ ("Overlay debugging disabled."));
}
static void
@@ -3363,7 +3351,7 @@ overlay_load_command (const char *args, int from_tty)
if (gdbarch_overlay_update_p (gdbarch))
gdbarch_overlay_update (gdbarch, NULL);
else
- error (_("This target does not know how to read its overlay state."));
+ error (_ ("This target does not know how to read its overlay state."));
}
/* Command list chain containing all defined "overlay" subcommands. */
@@ -3406,10 +3394,14 @@ static struct cmd_list_element *overlaylist;
static unsigned (*cache_ovly_table)[4] = 0;
static unsigned cache_novlys = 0;
static CORE_ADDR cache_ovly_table_base = 0;
+
enum ovly_index
- {
- VMA, OSIZE, LMA, MAPPED
- };
+{
+ VMA,
+ OSIZE,
+ LMA,
+ MAPPED
+};
/* Throw away the cached copy of _ovly_table. */
@@ -3426,8 +3418,8 @@ simple_free_overlay_table (void)
Convert to host order. int LEN is number of ints. */
static void
-read_target_long_array (CORE_ADDR memaddr, unsigned int *myaddr,
- int len, int size, enum bfd_endian byte_order)
+read_target_long_array (CORE_ADDR memaddr, unsigned int *myaddr, int len,
+ int size, enum bfd_endian byte_order)
{
/* FIXME (alloca): Not safe if array is very large. */
gdb_byte *buf = (gdb_byte *) alloca (len * size);
@@ -3452,20 +3444,20 @@ simple_read_overlay_table (void)
simple_free_overlay_table ();
novlys_msym = lookup_minimal_symbol ("_novlys", NULL, NULL);
- if (! novlys_msym.minsym)
+ if (!novlys_msym.minsym)
{
- error (_("Error reading inferior's overlay table: "
- "couldn't find `_novlys' variable\n"
- "in inferior. Use `overlay manual' mode."));
+ error (_ ("Error reading inferior's overlay table: "
+ "couldn't find `_novlys' variable\n"
+ "in inferior. Use `overlay manual' mode."));
return 0;
}
ovly_table_msym = lookup_bound_minimal_symbol ("_ovly_table");
- if (! ovly_table_msym.minsym)
+ if (!ovly_table_msym.minsym)
{
- error (_("Error reading inferior's overlay table: couldn't find "
- "`_ovly_table' array\n"
- "in inferior. Use `overlay manual' mode."));
+ error (_ ("Error reading inferior's overlay table: couldn't find "
+ "`_ovly_table' array\n"
+ "in inferior. Use `overlay manual' mode."));
return 0;
}
@@ -3473,16 +3465,17 @@ simple_read_overlay_table (void)
word_size = gdbarch_long_bit (gdbarch) / TARGET_CHAR_BIT;
byte_order = gdbarch_byte_order (gdbarch);
- cache_novlys = read_memory_integer (novlys_msym.value_address (),
- 4, byte_order);
+ cache_novlys
+ = read_memory_integer (novlys_msym.value_address (), 4, byte_order);
cache_ovly_table
- = (unsigned int (*)[4]) xmalloc (cache_novlys * sizeof (*cache_ovly_table));
+ = (unsigned int (*)[4]) xmalloc (cache_novlys
+ * sizeof (*cache_ovly_table));
cache_ovly_table_base = ovly_table_msym.value_address ();
read_target_long_array (cache_ovly_table_base,
- (unsigned int *) cache_ovly_table,
- cache_novlys * 4, word_size, byte_order);
+ (unsigned int *) cache_ovly_table, cache_novlys * 4,
+ word_size, byte_order);
- return 1; /* SUCCESS */
+ return 1; /* SUCCESS */
}
/* Function: simple_overlay_update_1
@@ -3507,15 +3500,15 @@ simple_overlay_update_1 (struct obj_section *osect)
&& cache_ovly_table[i][LMA] == bfd_section_lma (bsect))
{
read_target_long_array (cache_ovly_table_base + i * word_size,
- (unsigned int *) cache_ovly_table[i],
- 4, word_size, byte_order);
+ (unsigned int *) cache_ovly_table[i], 4,
+ word_size, byte_order);
if (cache_ovly_table[i][VMA] == bfd_section_vma (bsect)
&& cache_ovly_table[i][LMA] == bfd_section_lma (bsect))
{
osect->ovly_mapped = cache_ovly_table[i][MAPPED];
return 1;
}
- else /* Warning! Warning! Target's ovly table has changed! */
+ else /* Warning! Warning! Target's ovly table has changed! */
return 0;
}
return 0;
@@ -3543,10 +3536,10 @@ simple_overlay_update (struct obj_section *osect)
= lookup_minimal_symbol ("_ovly_table", NULL, NULL);
if (minsym.minsym == NULL)
- error (_("Error reading inferior's overlay table: couldn't "
- "find `_ovly_table' array\n"
- "in inferior. Use `overlay manual' mode."));
-
+ error (_ ("Error reading inferior's overlay table: couldn't "
+ "find `_ovly_table' array\n"
+ "in inferior. Use `overlay manual' mode."));
+
if (cache_ovly_table_base == minsym.value_address ())
/* Then go ahead and try to look up this single section in
the cache. */
@@ -3559,7 +3552,7 @@ simple_overlay_update (struct obj_section *osect)
Or else we want all the sections, in which case it's actually
more efficient to read the whole table in one block anyway. */
- if (! simple_read_overlay_table ())
+ if (!simple_read_overlay_table ())
return;
/* Now may as well update all sections, even if only one was requested. */
@@ -3575,7 +3568,7 @@ simple_overlay_update (struct obj_section *osect)
&& cache_ovly_table[i][LMA] == bfd_section_lma (bsect))
{ /* obj_section matches i'th entry in ovly_table. */
osect->ovly_mapped = cache_ovly_table[i][MAPPED];
- break; /* finished with inner for loop: break out. */
+ break; /* finished with inner for loop: break out. */
}
}
}
@@ -3621,8 +3614,8 @@ default_symfile_relocate (struct objfile *objfile, asection *sectp,
debug section. */
bfd_byte *
-symfile_relocate_debug_section (struct objfile *objfile,
- asection *sectp, bfd_byte *buf)
+symfile_relocate_debug_section (struct objfile *objfile, asection *sectp,
+ bfd_byte *buf)
{
gdb_assert (objfile->sf->sym_relocate);
@@ -3682,7 +3675,7 @@ symfile_map_offsets_to_segments (bfd *abfd,
/* Don't bother computing offsets for sections that aren't
loaded as part of any segment. */
- if (! which)
+ if (!which)
continue;
/* Use the last SEGMENT_BASES entry as the address of any extra
@@ -3748,22 +3741,17 @@ symfile_free_objfile (struct objfile *objfile)
See quick_symbol_functions.expand_symtabs_matching for details. */
bool
-expand_symtabs_matching
- (gdb::function_view<expand_symtabs_file_matcher_ftype> file_matcher,
- const lookup_name_info &lookup_name,
- gdb::function_view<expand_symtabs_symbol_matcher_ftype> symbol_matcher,
- gdb::function_view<expand_symtabs_exp_notify_ftype> expansion_notify,
- block_search_flags search_flags,
- enum search_domain kind)
+expand_symtabs_matching (
+ gdb::function_view<expand_symtabs_file_matcher_ftype> file_matcher,
+ const lookup_name_info &lookup_name,
+ gdb::function_view<expand_symtabs_symbol_matcher_ftype> symbol_matcher,
+ gdb::function_view<expand_symtabs_exp_notify_ftype> expansion_notify,
+ block_search_flags search_flags, enum search_domain kind)
{
for (objfile *objfile : current_program_space->objfiles ())
- if (!objfile->expand_symtabs_matching (file_matcher,
- &lookup_name,
- symbol_matcher,
- expansion_notify,
- search_flags,
- UNDEF_DOMAIN,
- kind))
+ if (!objfile->expand_symtabs_matching (file_matcher, &lookup_name,
+ symbol_matcher, expansion_notify,
+ search_flags, UNDEF_DOMAIN, kind))
return false;
return true;
}
@@ -3782,10 +3770,13 @@ map_symbol_filenames (gdb::function_view<symbol_filename_ftype> fun,
#if GDB_SELF_TEST
-namespace selftests {
-namespace filename_language {
+namespace selftests
+{
+namespace filename_language
+{
-static void test_filename_language ()
+static void
+test_filename_language ()
{
/* This test messes up the filename_language_table global. */
scoped_restore restore_flt = make_scoped_restore (&filename_language_table);
@@ -3838,6 +3829,7 @@ test_set_ext_lang_command ()
#endif /* GDB_SELF_TEST */
void _initialize_symfile ();
+
void
_initialize_symfile ()
{
@@ -3852,15 +3844,16 @@ faster.\n\
The '-readnever' option will prevent GDB from reading the symbol file's\n\
symbolic debug information."
- c = add_cmd ("symbol-file", class_files, symbol_file_command, _("\
+ c = add_cmd ("symbol-file", class_files, symbol_file_command, _ ("\
Load symbol table from executable file FILE.\n\
Usage: symbol-file [-readnow | -readnever] [-o OFF] FILE\n\
OFF is an optional offset which is added to each section address.\n\
The `file' command can also load symbol tables, as well as setting the file\n\
-to execute.\n" READNOW_READNEVER_HELP), &cmdlist);
+to execute.\n" READNOW_READNEVER_HELP),
+ &cmdlist);
set_cmd_completer (c, filename_completer);
- c = add_cmd ("add-symbol-file", class_files, add_symbol_file_command, _("\
+ c = add_cmd ("add-symbol-file", class_files, add_symbol_file_command, _ ("\
Load symbols from FILE, assuming FILE has been dynamically loaded.\n\
Usage: add-symbol-file FILE [-readnow | -readnever] [-o OFF] [ADDR] \
[-s SECT-NAME SECT-ADDR]...\n\
@@ -3869,13 +3862,12 @@ Each '-s' argument provides a section name and address, and\n\
should be specified if the data and bss segments are not contiguous\n\
with the text. SECT-NAME is a section name to be loaded at SECT-ADDR.\n\
OFF is an optional offset which is added to the default load addresses\n\
-of all sections for which no other address was specified.\n"
-READNOW_READNEVER_HELP),
+of all sections for which no other address was specified.\n" READNOW_READNEVER_HELP),
&cmdlist);
set_cmd_completer (c, filename_completer);
- c = add_cmd ("remove-symbol-file", class_files,
- remove_symbol_file_command, _("\
+ c = add_cmd ("remove-symbol-file", class_files, remove_symbol_file_command,
+ _ ("\
Remove a symbol file added via the add-symbol-file command.\n\
Usage: remove-symbol-file FILENAME\n\
remove-symbol-file -a ADDRESS\n\
@@ -3883,92 +3875,98 @@ The file to remove can be identified by its filename or by an address\n\
that lies within the boundaries of this symbol file in memory."),
&cmdlist);
- c = add_cmd ("load", class_files, load_command, _("\
+ c = add_cmd ("load", class_files, load_command, _ ("\
Dynamically load FILE into the running program.\n\
FILE symbols are recorded for access from GDB.\n\
Usage: load [FILE] [OFFSET]\n\
An optional load OFFSET may also be given as a literal address.\n\
When OFFSET is provided, FILE must also be provided. FILE can be provided\n\
-on its own."), &cmdlist);
+on its own."),
+ &cmdlist);
set_cmd_completer (c, filename_completer);
cmd_list_element *overlay_cmd
= add_basic_prefix_cmd ("overlay", class_support,
- _("Commands for debugging overlays."), &overlaylist,
- 0, &cmdlist);
+ _ ("Commands for debugging overlays."),
+ &overlaylist, 0, &cmdlist);
add_com_alias ("ovly", overlay_cmd, class_support, 1);
add_com_alias ("ov", overlay_cmd, class_support, 1);
add_cmd ("map-overlay", class_support, map_overlay_command,
- _("Assert that an overlay section is mapped."), &overlaylist);
+ _ ("Assert that an overlay section is mapped."), &overlaylist);
add_cmd ("unmap-overlay", class_support, unmap_overlay_command,
- _("Assert that an overlay section is unmapped."), &overlaylist);
+ _ ("Assert that an overlay section is unmapped."), &overlaylist);
add_cmd ("list-overlays", class_support, list_overlays_command,
- _("List mappings of overlay sections."), &overlaylist);
+ _ ("List mappings of overlay sections."), &overlaylist);
add_cmd ("manual", class_support, overlay_manual_command,
- _("Enable overlay debugging."), &overlaylist);
+ _ ("Enable overlay debugging."), &overlaylist);
add_cmd ("off", class_support, overlay_off_command,
- _("Disable overlay debugging."), &overlaylist);
+ _ ("Disable overlay debugging."), &overlaylist);
add_cmd ("auto", class_support, overlay_auto_command,
- _("Enable automatic overlay debugging."), &overlaylist);
+ _ ("Enable automatic overlay debugging."), &overlaylist);
add_cmd ("load-target", class_support, overlay_load_command,
- _("Read the overlay mapping state from the target."), &overlaylist);
+ _ ("Read the overlay mapping state from the target."),
+ &overlaylist);
/* Filename extension to source language lookup table: */
add_setshow_string_noescape_cmd ("extension-language", class_files,
- &ext_args, _("\
-Set mapping between filename extension and source language."), _("\
-Show mapping between filename extension and source language."), _("\
+ &ext_args, _ ("\
+Set mapping between filename extension and source language."),
+ _ ("\
+Show mapping between filename extension and source language."),
+ _ ("\
Usage: set extension-language .foo bar"),
- set_ext_lang_command,
- show_ext_args,
+ set_ext_lang_command, show_ext_args,
&setlist, &showlist);
add_info ("extensions", info_ext_lang_command,
- _("All filename extensions associated with a source language."));
+ _ ("All filename extensions associated with a source language."));
add_setshow_optional_filename_cmd ("debug-file-directory", class_support,
- &debug_file_directory, _("\
-Set the directories where separate debug symbols are searched for."), _("\
-Show the directories where separate debug symbols are searched for."), _("\
+ &debug_file_directory, _ ("\
+Set the directories where separate debug symbols are searched for."),
+ _ ("\
+Show the directories where separate debug symbols are searched for."),
+ _ ("\
Separate debug symbols are first searched for in the same\n\
directory as the binary, then in the `" DEBUG_SUBDIRECTORY "' subdirectory,\n\
and lastly at the path of the directory of the binary with\n\
each global debug-file-directory component prepended."),
- NULL,
- show_debug_file_directory,
- &setlist, &showlist);
-
- add_setshow_enum_cmd ("symbol-loading", no_class,
- print_symbol_loading_enums, &print_symbol_loading,
- _("\
-Set printing of symbol loading messages."), _("\
-Show printing of symbol loading messages."), _("\
+ NULL, show_debug_file_directory, &setlist,
+ &showlist);
+
+ add_setshow_enum_cmd ("symbol-loading", no_class, print_symbol_loading_enums,
+ &print_symbol_loading, _ ("\
+Set printing of symbol loading messages."),
+ _ ("\
+Show printing of symbol loading messages."),
+ _ ("\
off == turn all messages off\n\
brief == print messages for the executable,\n\
and brief messages for shared libraries\n\
full == print messages for the executable,\n\
and messages for each shared library."),
- NULL,
- NULL,
- &setprintlist, &showprintlist);
+ NULL, NULL, &setprintlist, &showprintlist);
add_setshow_boolean_cmd ("separate-debug-file", no_class,
- &separate_debug_file_debug, _("\
-Set printing of separate debug info file search debug."), _("\
-Show printing of separate debug info file search debug."), _("\
+ &separate_debug_file_debug, _ ("\
+Set printing of separate debug info file search debug."),
+ _ ("\
+Show printing of separate debug info file search debug."),
+ _ ("\
When on, GDB prints the searched locations while looking for separate debug \
-info files."), NULL, NULL, &setdebuglist, &showdebuglist);
+info files."),
+ NULL, NULL, &setdebuglist, &showdebuglist);
#if GDB_SELF_TEST
- selftests::register_test
- ("filename_language", selftests::filename_language::test_filename_language);
- selftests::register_test
- ("set_ext_lang_command",
- selftests::filename_language::test_set_ext_lang_command);
+ selftests::register_test (
+ "filename_language", selftests::filename_language::test_filename_language);
+ selftests::register_test (
+ "set_ext_lang_command",
+ selftests::filename_language::test_set_ext_lang_command);
#endif
}
diff --git a/gdb/symfile.h b/gdb/symfile.h
index b433e2be31a..85f4e026c17 100644
--- a/gdb/symfile.h
+++ b/gdb/symfile.h
@@ -17,7 +17,7 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
-#if !defined (SYMFILE_H)
+#if !defined(SYMFILE_H)
#define SYMFILE_H
/* This file requires that you first include "bfd.h". */
@@ -80,8 +80,10 @@ struct symfile_segment_data
struct segment
{
segment (CORE_ADDR base, CORE_ADDR size)
- : base (base), size (size)
- {}
+ : base (base),
+ size (size)
+ {
+ }
/* The original base address the segment. */
CORE_ADDR base;
@@ -109,8 +111,8 @@ using symfile_segment_data_up = std::unique_ptr<symfile_segment_data>;
struct sym_probe_fns
{
/* If non-NULL, return a reference to vector of probe objects. */
- const std::vector<std::unique_ptr<probe>> &(*sym_get_probes)
- (struct objfile *);
+ const std::vector<std::unique_ptr<probe>> &(*sym_get_probes) (
+ struct objfile *);
};
/* Structure to keep track of symbol reading functions for various
@@ -143,7 +145,6 @@ struct sym_fns
void (*sym_finish) (struct objfile *);
-
/* This function produces a file-dependent section_offsets
structure, allocated in the objfile's storage.
@@ -176,13 +177,13 @@ struct sym_fns
};
extern section_addr_info
- build_section_addr_info_from_objfile (const struct objfile *objfile);
+build_section_addr_info_from_objfile (const struct objfile *objfile);
-extern void relative_addr_info_to_section_offsets
- (section_offsets &section_offsets, const section_addr_info &addrs);
+extern void
+relative_addr_info_to_section_offsets (section_offsets &section_offsets,
+ const section_addr_info &addrs);
-extern void addr_info_make_relative (section_addr_info *addrs,
- bfd *abfd);
+extern void addr_info_make_relative (section_addr_info *addrs, bfd *abfd);
/* The default version of sym_fns.sym_offsets for readers that don't
do anything special. */
@@ -201,8 +202,8 @@ extern symfile_segment_data_up default_symfile_segments (bfd *abfd);
extern bfd_byte *default_symfile_relocate (struct objfile *objfile,
asection *sectp, bfd_byte *buf);
-extern struct symtab *allocate_symtab
- (struct compunit_symtab *cust, const char *filename, const char *id)
+extern struct symtab *allocate_symtab (struct compunit_symtab *cust,
+ const char *filename, const char *id)
ATTRIBUTE_NONNULL (1);
/* Same as the above, but passes FILENAME for ID. */
@@ -233,10 +234,10 @@ extern void add_filename_language (const char *ext, enum language lang);
extern struct objfile *symbol_file_add (const char *, symfile_add_flags,
section_addr_info *, objfile_flags);
-extern struct objfile *symbol_file_add_from_bfd (const gdb_bfd_ref_ptr &,
- const char *, symfile_add_flags,
- section_addr_info *,
- objfile_flags, struct objfile *parent);
+extern struct objfile *
+symbol_file_add_from_bfd (const gdb_bfd_ref_ptr &, const char *,
+ symfile_add_flags, section_addr_info *,
+ objfile_flags, struct objfile *parent);
extern void symbol_file_add_separate (const gdb_bfd_ref_ptr &, const char *,
symfile_add_flags, struct objfile *);
@@ -247,16 +248,16 @@ extern void symbol_file_add_separate (const gdb_bfd_ref_ptr &, const char *,
Any warnings generated as part of this lookup are added to
WARNINGS_VECTOR, one std::string per warning. */
-extern std::string find_separate_debug_file_by_debuglink
- (struct objfile *objfile, std::vector<std::string> *warnings_vector);
+extern std::string find_separate_debug_file_by_debuglink (
+ struct objfile *objfile, std::vector<std::string> *warnings_vector);
/* Build (allocate and populate) a section_addr_info struct from an
existing section table. */
extern section_addr_info
- build_section_addr_info_from_section_table (const target_section_table &table);
+build_section_addr_info_from_section_table (const target_section_table &table);
- /* Variables */
+/* Variables */
/* If true, shared library symbols will be added automatically
when the inferior is created, new libraries are loaded, or when
@@ -281,12 +282,12 @@ extern int get_section_index (struct objfile *, const char *);
extern int print_symbol_loading_p (int from_tty, int mainline, int full);
/* Utility functions for overlay sections: */
-extern enum overlay_debugging_state
-{
+extern enum overlay_debugging_state {
ovly_off,
ovly_on,
ovly_auto
} overlay_debugging;
+
extern int overlay_cache_invalid;
/* Return the "mapped" overlay section containing the PC. */
@@ -330,21 +331,19 @@ extern void simple_overlay_update (struct obj_section *);
extern bfd_byte *symfile_relocate_debug_section (struct objfile *, asection *,
bfd_byte *);
-extern int symfile_map_offsets_to_segments (bfd *,
- const struct symfile_segment_data *,
- section_offsets &,
- int, const CORE_ADDR *);
+extern int
+symfile_map_offsets_to_segments (bfd *, const struct symfile_segment_data *,
+ section_offsets &, int, const CORE_ADDR *);
symfile_segment_data_up get_symfile_segment_data (bfd *abfd);
extern scoped_restore_tmpl<int> increment_reading_symtab (void);
-bool expand_symtabs_matching
- (gdb::function_view<expand_symtabs_file_matcher_ftype> file_matcher,
- const lookup_name_info &lookup_name,
- gdb::function_view<expand_symtabs_symbol_matcher_ftype> symbol_matcher,
- gdb::function_view<expand_symtabs_exp_notify_ftype> expansion_notify,
- block_search_flags search_flags,
- enum search_domain kind);
+bool expand_symtabs_matching (
+ gdb::function_view<expand_symtabs_file_matcher_ftype> file_matcher,
+ const lookup_name_info &lookup_name,
+ gdb::function_view<expand_symtabs_symbol_matcher_ftype> symbol_matcher,
+ gdb::function_view<expand_symtabs_exp_notify_ftype> expansion_notify,
+ block_search_flags search_flags, enum search_domain kind);
void map_symbol_filenames (gdb::function_view<symbol_filename_ftype> fun,
bool need_fullname);
diff --git a/gdb/symmisc.c b/gdb/symmisc.c
index 6ff06ccaa93..54c6089435d 100644
--- a/gdb/symmisc.c
+++ b/gdb/symmisc.c
@@ -46,7 +46,6 @@ static int block_depth (const struct block *);
static void print_symbol (struct gdbarch *gdbarch, struct symbol *symbol,
int depth, ui_file *outfile);
-
void
print_objfile_statistics (void)
@@ -57,18 +56,18 @@ print_objfile_statistics (void)
for (objfile *objfile : pspace->objfiles ())
{
QUIT;
- gdb_printf (_("Statistics for '%s':\n"), objfile_name (objfile));
+ gdb_printf (_ ("Statistics for '%s':\n"), objfile_name (objfile));
if (OBJSTAT (objfile, n_stabs) > 0)
- gdb_printf (_(" Number of \"stab\" symbols read: %d\n"),
+ gdb_printf (_ (" Number of \"stab\" symbols read: %d\n"),
OBJSTAT (objfile, n_stabs));
if (objfile->per_bfd->n_minsyms > 0)
- gdb_printf (_(" Number of \"minimal\" symbols read: %d\n"),
+ gdb_printf (_ (" Number of \"minimal\" symbols read: %d\n"),
objfile->per_bfd->n_minsyms);
if (OBJSTAT (objfile, n_syms) > 0)
- gdb_printf (_(" Number of \"full\" symbols read: %d\n"),
+ gdb_printf (_ (" Number of \"full\" symbols read: %d\n"),
OBJSTAT (objfile, n_syms));
if (OBJSTAT (objfile, n_types) > 0)
- gdb_printf (_(" Number of \"types\" defined: %d\n"),
+ gdb_printf (_ (" Number of \"types\" defined: %d\n"),
OBJSTAT (objfile, n_types));
i = linetables = 0;
@@ -83,27 +82,27 @@ print_objfile_statistics (void)
}
blockvectors = std::distance (objfile->compunits ().begin (),
objfile->compunits ().end ());
- gdb_printf (_(" Number of symbol tables: %d\n"), i);
- gdb_printf (_(" Number of symbol tables with line tables: %d\n"),
+ gdb_printf (_ (" Number of symbol tables: %d\n"), i);
+ gdb_printf (_ (" Number of symbol tables with line tables: %d\n"),
linetables);
- gdb_printf (_(" Number of symbol tables with blockvectors: %d\n"),
+ gdb_printf (_ (" Number of symbol tables with blockvectors: %d\n"),
blockvectors);
objfile->print_stats (false);
if (OBJSTAT (objfile, sz_strtab) > 0)
- gdb_printf (_(" Space used by string tables: %d\n"),
+ gdb_printf (_ (" Space used by string tables: %d\n"),
OBJSTAT (objfile, sz_strtab));
- gdb_printf (_(" Total memory used for objfile obstack: %s\n"),
- pulongest (obstack_memory_used (&objfile
- ->objfile_obstack)));
- gdb_printf (_(" Total memory used for BFD obstack: %s\n"),
- pulongest (obstack_memory_used (&objfile->per_bfd
- ->storage_obstack)));
-
- gdb_printf (_(" Total memory used for string cache: %d\n"),
+ gdb_printf (
+ _ (" Total memory used for objfile obstack: %s\n"),
+ pulongest (obstack_memory_used (&objfile->objfile_obstack)));
+ gdb_printf (_ (" Total memory used for BFD obstack: %s\n"),
+ pulongest (obstack_memory_used (
+ &objfile->per_bfd->storage_obstack)));
+
+ gdb_printf (_ (" Total memory used for string cache: %d\n"),
objfile->per_bfd->string_cache.memory_used ());
- gdb_printf (_("Byte cache statistics for '%s':\n"),
+ gdb_printf (_ ("Byte cache statistics for '%s':\n"),
objfile_name (objfile));
objfile->per_bfd->string_cache.print_statistics ("string cache");
objfile->print_stats (true);
@@ -128,8 +127,7 @@ dump_objfile (struct objfile *objfile)
{
for (symtab *symtab : cu->filetabs ())
{
- gdb_printf ("%s at %s",
- symtab_to_filename_for_display (symtab),
+ gdb_printf ("%s at %s", symtab_to_filename_for_display (symtab),
host_address_to_string (symtab));
if (symtab->compunit ()->objfile () != objfile)
gdb_printf (", NOT ON CHAIN!");
@@ -225,7 +223,7 @@ dump_msymbols (struct objfile *objfile, struct ui_file *outfile)
}
if (objfile->per_bfd->minimal_symbol_count != index)
{
- warning (_("internal error: minimal symbol count %d != %d"),
+ warning (_ ("internal error: minimal symbol count %d != %d"),
objfile->per_bfd->minimal_symbol_count, index);
}
gdb_printf (outfile, "\n");
@@ -249,10 +247,8 @@ dump_symtab_1 (struct symtab *symtab, struct ui_file *outfile)
gdb_printf (outfile, "Compilation directory is %s\n",
symtab->compunit ()->dirname ());
gdb_printf (outfile, "Read from object file %s (%s)\n",
- objfile_name (objfile),
- host_address_to_string (objfile));
- gdb_printf (outfile, "Language: %s\n",
- language_str (symtab->language ()));
+ objfile_name (objfile), host_address_to_string (objfile));
+ gdb_printf (outfile, "Language: %s\n", language_str (symtab->language ()));
/* First print the line table. */
l = symtab->linetable ();
@@ -279,8 +275,7 @@ dump_symtab_1 (struct symtab *symtab, struct ui_file *outfile)
{
const block *b = bv->block (i);
depth = block_depth (b) * 2;
- gdb_printf (outfile, "%*sblock #%03d, object at %s",
- depth, "", i,
+ gdb_printf (outfile, "%*sblock #%03d, object at %s", depth, "", i,
host_address_to_string (b));
if (b->superblock ())
gdb_printf (outfile, " under %s",
@@ -328,8 +323,7 @@ dump_symtab_1 (struct symtab *symtab, struct ui_file *outfile)
const char *compunit_filename
= symtab_to_filename_for_display (compunit->primary_filetab ());
- gdb_printf (outfile,
- "\nBlockvector same as owning compunit: %s\n\n",
+ gdb_printf (outfile, "\nBlockvector same as owning compunit: %s\n\n",
compunit_filename);
}
@@ -346,7 +340,7 @@ dump_symtab_1 (struct symtab *symtab, struct ui_file *outfile)
gdb_printf (outfile, "Compunit user: %s\n", addr);
}
if (cust->includes != nullptr)
- for (int i = 0; ; ++i)
+ for (int i = 0;; ++i)
{
struct compunit_symtab *include = cust->includes[i];
if (include == nullptr)
@@ -392,19 +386,19 @@ maintenance_print_symbols (const char *args, int from_tty)
if (strcmp (argv[i], "-pc") == 0)
{
if (argv[i + 1] == NULL)
- error (_("Missing pc value"));
+ error (_ ("Missing pc value"));
address_arg = argv[++i];
}
else if (strcmp (argv[i], "-source") == 0)
{
if (argv[i + 1] == NULL)
- error (_("Missing source file"));
+ error (_ ("Missing source file"));
source_arg = argv[++i];
}
else if (strcmp (argv[i], "-objfile") == 0)
{
if (argv[i + 1] == NULL)
- error (_("Missing objfile name"));
+ error (_ ("Missing objfile name"));
objfile_arg = argv[++i];
}
else if (strcmp (argv[i], "--") == 0)
@@ -416,7 +410,7 @@ maintenance_print_symbols (const char *args, int from_tty)
else if (argv[i][0] == '-')
{
/* Future proofing: Don't allow OUTFILE to begin with "-". */
- error (_("Unknown option: %s"), argv[i]);
+ error (_ ("Unknown option: %s"), argv[i]);
}
else
break;
@@ -424,16 +418,16 @@ maintenance_print_symbols (const char *args, int from_tty)
outfile_idx = i;
if (address_arg != NULL && source_arg != NULL)
- error (_("Must specify at most one of -pc and -source"));
+ error (_ ("Must specify at most one of -pc and -source"));
stdio_file arg_outfile;
if (argv != NULL && argv[outfile_idx] != NULL)
{
if (argv[outfile_idx + 1] != NULL)
- error (_("Junk at end of command"));
- gdb::unique_xmalloc_ptr<char> outfile_name
- (tilde_expand (argv[outfile_idx]));
+ error (_ ("Junk at end of command"));
+ gdb::unique_xmalloc_ptr<char> outfile_name (
+ tilde_expand (argv[outfile_idx]));
if (!arg_outfile.open (outfile_name.get (), FOPEN_WT))
perror_with_name (outfile_name.get ());
outfile = &arg_outfile;
@@ -445,7 +439,7 @@ maintenance_print_symbols (const char *args, int from_tty)
struct symtab *s = find_pc_line_symtab (pc);
if (s == NULL)
- error (_("No symtab for address: %s"), address_arg);
+ error (_ ("No symtab for address: %s"), address_arg);
dump_symtab (s, outfile);
}
else
@@ -472,28 +466,26 @@ maintenance_print_symbols (const char *args, int from_tty)
QUIT;
if (source_arg != NULL)
{
- print_for_source
- = compare_filenames_for_search
- (symtab_to_filename_for_display (s), source_arg);
+ print_for_source = compare_filenames_for_search (
+ symtab_to_filename_for_display (s), source_arg);
found = 1;
}
- if (source_arg == NULL
- || print_for_source)
+ if (source_arg == NULL || print_for_source)
dump_symtab (s, outfile);
}
}
}
if (source_arg != NULL && !found)
- error (_("No symtab for source file: %s"), source_arg);
+ error (_ ("No symtab for source file: %s"), source_arg);
}
}
/* Print symbol SYMBOL on OUTFILE. DEPTH says how far to indent. */
static void
-print_symbol (struct gdbarch *gdbarch, struct symbol *symbol,
- int depth, ui_file *outfile)
+print_symbol (struct gdbarch *gdbarch, struct symbol *symbol, int depth,
+ ui_file *outfile)
{
struct obj_section *section;
@@ -506,8 +498,7 @@ print_symbol (struct gdbarch *gdbarch, struct symbol *symbol,
if (symbol->domain () == LABEL_DOMAIN)
{
gdb_printf (outfile, "label %s at ", symbol->print_name ());
- gdb_puts (paddress (gdbarch, symbol->value_address ()),
- outfile);
+ gdb_puts (paddress (gdbarch, symbol->value_address ()), outfile);
if (section)
gdb_printf (outfile, " section %s\n",
bfd_section_name (section->the_bfd_section));
@@ -527,9 +518,10 @@ print_symbol (struct gdbarch *gdbarch, struct symbol *symbol,
{
gdb_printf (outfile, "%s %s = ",
(symbol->type ()->code () == TYPE_CODE_ENUM
- ? "enum"
- : (symbol->type ()->code () == TYPE_CODE_STRUCT
- ? "struct" : "union")),
+ ? "enum"
+ : (symbol->type ()->code () == TYPE_CODE_STRUCT
+ ? "struct"
+ : "union")),
symbol->linkage_name ());
current_language->print_type (symbol->type (), "", outfile, 1, depth,
&type_print_raw_options);
@@ -545,9 +537,9 @@ print_symbol (struct gdbarch *gdbarch, struct symbol *symbol,
/* Print details of types, except for enums where it's clutter. */
current_language->print_type (symbol->type (), symbol->print_name (),
outfile,
- symbol->type ()->code () != TYPE_CODE_ENUM,
- depth,
- &type_print_raw_options);
+ symbol->type ()->code ()
+ != TYPE_CODE_ENUM,
+ depth, &type_print_raw_options);
gdb_printf (outfile, "; ");
}
else
@@ -566,8 +558,8 @@ print_symbol (struct gdbarch *gdbarch, struct symbol *symbol,
unsigned i;
struct type *type = check_typedef (symbol->type ());
- gdb_printf (outfile, "const %s hex bytes:",
- pulongest (type->length ()));
+ gdb_printf (outfile,
+ "const %s hex bytes:", pulongest (type->length ()));
for (i = 0; i < type->length (); i++)
gdb_printf (outfile, " %02x",
(unsigned) symbol->value_bytes ()[i]);
@@ -623,11 +615,10 @@ print_symbol (struct gdbarch *gdbarch, struct symbol *symbol,
break;
case LOC_BLOCK:
- gdb_printf
- (outfile, "block object %s, %s..%s",
- host_address_to_string (symbol->value_block ()),
- paddress (gdbarch, symbol->value_block()->start ()),
- paddress (gdbarch, symbol->value_block()->end ()));
+ gdb_printf (outfile, "block object %s, %s..%s",
+ host_address_to_string (symbol->value_block ()),
+ paddress (gdbarch, symbol->value_block ()->start ()),
+ paddress (gdbarch, symbol->value_block ()->end ()));
if (section)
gdb_printf (outfile, " section %s",
bfd_section_name (section->the_bfd_section));
@@ -646,8 +637,7 @@ print_symbol (struct gdbarch *gdbarch, struct symbol *symbol,
break;
default:
- gdb_printf (outfile, "botched symbol class %x",
- symbol->aclass ());
+ gdb_printf (outfile, "botched symbol class %x", symbol->aclass ());
break;
}
}
@@ -670,7 +660,7 @@ maintenance_print_msymbols (const char *args, int from_tty)
if (strcmp (argv[i], "-objfile") == 0)
{
if (argv[i + 1] == NULL)
- error (_("Missing objfile name"));
+ error (_ ("Missing objfile name"));
objfile_arg = argv[++i];
}
else if (strcmp (argv[i], "--") == 0)
@@ -682,7 +672,7 @@ maintenance_print_msymbols (const char *args, int from_tty)
else if (argv[i][0] == '-')
{
/* Future proofing: Don't allow OUTFILE to begin with "-". */
- error (_("Unknown option: %s"), argv[i]);
+ error (_ ("Unknown option: %s"), argv[i]);
}
else
break;
@@ -694,9 +684,9 @@ maintenance_print_msymbols (const char *args, int from_tty)
if (argv != NULL && argv[outfile_idx] != NULL)
{
if (argv[outfile_idx + 1] != NULL)
- error (_("Junk at end of command"));
- gdb::unique_xmalloc_ptr<char> outfile_name
- (tilde_expand (argv[outfile_idx]));
+ error (_ ("Junk at end of command"));
+ gdb::unique_xmalloc_ptr<char> outfile_name (
+ tilde_expand (argv[outfile_idx]));
if (!arg_outfile.open (outfile_name.get (), FOPEN_WT))
perror_with_name (outfile_name.get ());
outfile = &arg_outfile;
@@ -706,7 +696,8 @@ maintenance_print_msymbols (const char *args, int from_tty)
{
QUIT;
if (objfile_arg == NULL
- || compare_filenames_for_search (objfile_name (objfile), objfile_arg))
+ || compare_filenames_for_search (objfile_name (objfile),
+ objfile_arg))
dump_msymbols (objfile, outfile);
}
}
@@ -723,8 +714,7 @@ maintenance_print_objfiles (const char *regexp, int from_tty)
for (objfile *objfile : pspace->objfiles ())
{
QUIT;
- if (! regexp
- || re_exec (objfile_name (objfile)))
+ if (!regexp || re_exec (objfile_name (objfile)))
dump_objfile (objfile);
}
}
@@ -754,10 +744,10 @@ maintenance_info_symtabs (const char *regexp, int from_tty)
{
QUIT;
- if (! regexp
+ if (!regexp
|| re_exec (symtab_to_filename_for_display (symtab)))
{
- if (! printed_objfile_start)
+ if (!printed_objfile_start)
{
gdb_printf ("{ objfile %s ", objfile_name (objfile));
gdb_stdout->wrap_here (2);
@@ -765,7 +755,7 @@ maintenance_info_symtabs (const char *regexp, int from_tty)
host_address_to_string (objfile));
printed_objfile_start = 1;
}
- if (! printed_compunit_symtab_start)
+ if (!printed_compunit_symtab_start)
{
gdb_printf (" { ((struct compunit_symtab *) %s)\n",
host_address_to_string (cust));
@@ -773,24 +763,26 @@ maintenance_info_symtabs (const char *regexp, int from_tty)
cust->debugformat ());
gdb_printf (" producer %s\n",
(cust->producer () != nullptr
- ? cust->producer () : "(null)"));
+ ? cust->producer ()
+ : "(null)"));
gdb_printf (" name %s\n", cust->name);
gdb_printf (" dirname %s\n",
(cust->dirname () != NULL
- ? cust->dirname () : "(null)"));
- gdb_printf (" blockvector"
- " ((struct blockvector *) %s)\n",
- host_address_to_string
- (cust->blockvector ()));
+ ? cust->dirname ()
+ : "(null)"));
+ gdb_printf (
+ " blockvector"
+ " ((struct blockvector *) %s)\n",
+ host_address_to_string (cust->blockvector ()));
gdb_printf (" user"
" ((struct compunit_symtab *) %s)\n",
cust->user != nullptr
- ? host_address_to_string (cust->user)
- : "(null)");
+ ? host_address_to_string (cust->user)
+ : "(null)");
if (cust->includes != nullptr)
{
gdb_printf (" ( includes\n");
- for (int i = 0; ; ++i)
+ for (int i = 0;; ++i)
{
struct compunit_symtab *include
= cust->includes[i];
@@ -812,14 +804,12 @@ maintenance_info_symtabs (const char *regexp, int from_tty)
gdb_stdout->wrap_here (4);
gdb_printf ("((struct symtab *) %s)\n",
host_address_to_string (symtab));
- gdb_printf ("\t fullname %s\n",
- symtab->fullname != NULL
- ? symtab->fullname
- : "(null)");
+ gdb_printf ("\t fullname %s\n", symtab->fullname != NULL
+ ? symtab->fullname
+ : "(null)");
gdb_printf ("\t "
"linetable ((struct linetable *) %s)\n",
- host_address_to_string
- (symtab->linetable ()));
+ host_address_to_string (symtab->linetable ()));
gdb_printf ("\t}\n");
}
}
@@ -864,7 +854,7 @@ maintenance_check_symtabs (const char *ignore, int from_tty)
if (found_something)
{
- if (! printed_objfile_start)
+ if (!printed_objfile_start)
{
gdb_printf ("{ objfile %s ", objfile_name (objfile));
gdb_stdout->wrap_here (2);
@@ -902,7 +892,7 @@ maintenance_expand_symtabs (const char *args, int from_tty)
{
regexp = argv[0];
if (argv[1] != NULL)
- error (_("Extra arguments after regexp."));
+ error (_ ("Extra arguments after regexp."));
}
}
@@ -911,21 +901,14 @@ maintenance_expand_symtabs (const char *args, int from_tty)
for (struct program_space *pspace : program_spaces)
for (objfile *objfile : pspace->objfiles ())
- objfile->expand_symtabs_matching
- ([&] (const char *filename, bool basenames)
- {
- /* KISS: Only apply the regexp to the complete file name. */
- return (!basenames
- && (regexp == NULL || re_exec (filename)));
- },
- NULL,
- NULL,
- NULL,
- SEARCH_GLOBAL_BLOCK | SEARCH_STATIC_BLOCK,
- UNDEF_DOMAIN,
- ALL_DOMAIN);
+ objfile->expand_symtabs_matching (
+ [&] (const char *filename, bool basenames) {
+ /* KISS: Only apply the regexp to the complete file name. */
+ return (!basenames && (regexp == NULL || re_exec (filename)));
+ },
+ NULL, NULL, NULL, SEARCH_GLOBAL_BLOCK | SEARCH_STATIC_BLOCK,
+ UNDEF_DOMAIN, ALL_DOMAIN);
}
-
/* Return the nexting depth of a block within other blocks in its symtab. */
@@ -940,7 +923,6 @@ block_depth (const struct block *block)
}
return i;
}
-
/* Used by MAINTENANCE_INFO_LINE_TABLES to print the information about a
single line table. */
@@ -952,51 +934,49 @@ maintenance_print_one_line_table (struct symtab *symtab, void *data)
struct objfile *objfile;
objfile = symtab->compunit ()->objfile ();
- gdb_printf (_("objfile: %ps ((struct objfile *) %s)\n"),
- styled_string (file_name_style.style (),
- objfile_name (objfile)),
+ gdb_printf (_ ("objfile: %ps ((struct objfile *) %s)\n"),
+ styled_string (file_name_style.style (), objfile_name (objfile)),
host_address_to_string (objfile));
- gdb_printf (_("compunit_symtab: %s ((struct compunit_symtab *) %s)\n"),
+ gdb_printf (_ ("compunit_symtab: %s ((struct compunit_symtab *) %s)\n"),
symtab->compunit ()->name,
host_address_to_string (symtab->compunit ()));
- gdb_printf (_("symtab: %ps ((struct symtab *) %s)\n"),
+ gdb_printf (_ ("symtab: %ps ((struct symtab *) %s)\n"),
styled_string (file_name_style.style (),
symtab_to_fullname (symtab)),
host_address_to_string (symtab));
linetable = symtab->linetable ();
- gdb_printf (_("linetable: ((struct linetable *) %s):\n"),
+ gdb_printf (_ ("linetable: ((struct linetable *) %s):\n"),
host_address_to_string (linetable));
if (linetable == NULL)
- gdb_printf (_("No line table.\n"));
+ gdb_printf (_ ("No line table.\n"));
else if (linetable->nitems <= 0)
- gdb_printf (_("Line table has no lines.\n"));
+ gdb_printf (_ ("Line table has no lines.\n"));
else
{
/* Leave space for 6 digits of index and line number. After that the
tables will just not format as well. */
struct ui_out *uiout = current_uiout;
ui_out_emit_table table_emitter (uiout, 5, -1, "line-table");
- uiout->table_header (6, ui_left, "index", _("INDEX"));
- uiout->table_header (6, ui_left, "line", _("LINE"));
- uiout->table_header (18, ui_left, "address", _("ADDRESS"));
- uiout->table_header (7, ui_left, "is-stmt", _("IS-STMT"));
- uiout->table_header (12, ui_left, "prologue-end", _("PROLOGUE-END"));
+ uiout->table_header (6, ui_left, "index", _ ("INDEX"));
+ uiout->table_header (6, ui_left, "line", _ ("LINE"));
+ uiout->table_header (18, ui_left, "address", _ ("ADDRESS"));
+ uiout->table_header (7, ui_left, "is-stmt", _ ("IS-STMT"));
+ uiout->table_header (12, ui_left, "prologue-end", _ ("PROLOGUE-END"));
uiout->table_body ();
for (int i = 0; i < linetable->nitems; ++i)
{
struct linetable_entry *item;
- item = &linetable->item [i];
+ item = &linetable->item[i];
ui_out_emit_tuple tuple_emitter (uiout, nullptr);
uiout->field_signed ("index", i);
if (item->line > 0)
uiout->field_signed ("line", item->line);
else
- uiout->field_string ("line", _("END"));
- uiout->field_core_addr ("address", objfile->arch (),
- item->pc);
+ uiout->field_string ("line", _ ("END"));
+ uiout->field_core_addr ("address", objfile->arch (), item->pc);
uiout->field_string ("is-stmt", item->is_stmt ? "Y" : "");
uiout->field_string ("prologue-end", item->prologue_end ? "Y" : "");
uiout->text ("\n");
@@ -1036,15 +1016,14 @@ maintenance_info_line_tables (const char *regexp, int from_tty)
}
}
-
-
/* Do early runtime initializations. */
void _initialize_symmisc ();
+
void
_initialize_symmisc ()
{
- add_cmd ("symbols", class_maintenance, maintenance_print_symbols, _("\
+ add_cmd ("symbols", class_maintenance, maintenance_print_symbols, _ ("\
Print dump of current symbol definitions.\n\
Usage: mt print symbols [-pc ADDRESS] [--] [OUTFILE]\n\
mt print symbols [-objfile OBJFILE] [-source SOURCE] [--] [OUTFILE]\n\
@@ -1055,7 +1034,7 @@ If SOURCE is provided, dump only that file's symbols.\n\
If OBJFILE is provided, dump only that file's minimal symbols."),
&maintenanceprintlist);
- add_cmd ("msymbols", class_maintenance, maintenance_print_msymbols, _("\
+ add_cmd ("msymbols", class_maintenance, maintenance_print_msymbols, _ ("\
Print dump of current minimal symbol definitions.\n\
Usage: mt print msymbols [-objfile OBJFILE] [--] [OUTFILE]\n\
Entries in the minimal symbol table are dumped to file OUTFILE,\n\
@@ -1064,30 +1043,29 @@ If OBJFILE is provided, dump only that file's minimal symbols."),
&maintenanceprintlist);
add_cmd ("objfiles", class_maintenance, maintenance_print_objfiles,
- _("Print dump of current object file definitions.\n\
+ _ ("Print dump of current object file definitions.\n\
With an argument REGEXP, list the object files with matching names."),
&maintenanceprintlist);
- add_cmd ("symtabs", class_maintenance, maintenance_info_symtabs, _("\
+ add_cmd ("symtabs", class_maintenance, maintenance_info_symtabs, _ ("\
List the full symbol tables for all object files.\n\
This does not include information about individual symbols, blocks, or\n\
linetables --- just the symbol table structures themselves.\n\
With an argument REGEXP, list the symbol tables with matching names."),
&maintenanceinfolist);
- add_cmd ("line-table", class_maintenance, maintenance_info_line_tables, _("\
+ add_cmd ("line-table", class_maintenance, maintenance_info_line_tables, _ ("\
List the contents of all line tables, from all symbol tables.\n\
With an argument REGEXP, list just the line tables for the symbol\n\
tables with matching names."),
&maintenanceinfolist);
- add_cmd ("check-symtabs", class_maintenance, maintenance_check_symtabs,
- _("\
+ add_cmd ("check-symtabs", class_maintenance, maintenance_check_symtabs, _ ("\
Check consistency of currently expanded symtabs."),
&maintenancelist);
add_cmd ("expand-symtabs", class_maintenance, maintenance_expand_symtabs,
- _("Expand symbol tables.\n\
+ _ ("Expand symbol tables.\n\
With an argument REGEXP, only expand the symbol tables with matching names."),
&maintenancelist);
}
diff --git a/gdb/symtab.c b/gdb/symtab.c
index 9d6ee388ca2..0c6f837e5e2 100644
--- a/gdb/symtab.c
+++ b/gdb/symtab.c
@@ -34,7 +34,7 @@
#include "demangle.h"
#include "inferior.h"
#include "source.h"
-#include "filenames.h" /* for FILENAME_CMP */
+#include "filenames.h" /* for FILENAME_CMP */
#include "objc-lang.h"
#include "d-lang.h"
#include "ada-lang.h"
@@ -81,24 +81,18 @@ static void rbreak_command (const char *, int);
static int find_line_common (struct linetable *, int, int *, int);
static struct block_symbol
- lookup_symbol_aux (const char *name,
- symbol_name_match_type match_type,
- const struct block *block,
- const domain_enum domain,
- enum language language,
- struct field_of_this_result *);
-
-static
-struct block_symbol lookup_local_symbol (const char *name,
- symbol_name_match_type match_type,
- const struct block *block,
- const domain_enum domain,
- enum language language);
+lookup_symbol_aux (const char *name, symbol_name_match_type match_type,
+ const struct block *block, const domain_enum domain,
+ enum language language, struct field_of_this_result *);
+
+static struct block_symbol
+lookup_local_symbol (const char *name, symbol_name_match_type match_type,
+ const struct block *block, const domain_enum domain,
+ enum language language);
static struct block_symbol
- lookup_symbol_in_objfile (struct objfile *objfile,
- enum block_enum block_index,
- const char *name, const domain_enum domain);
+lookup_symbol_in_objfile (struct objfile *objfile, enum block_enum block_index,
+ const char *name, const domain_enum domain);
/* Type of the data stored on the program space. */
@@ -106,10 +100,7 @@ struct main_info
{
main_info () = default;
- ~main_info ()
- {
- xfree (name_of_main);
- }
+ ~main_info () { xfree (name_of_main); }
/* Name of "main". */
@@ -134,12 +125,12 @@ static const registry<program_space>::key<main_info> main_progspace_key;
/* The maximum symbol cache size.
There's no method to the decision of what value to use here, other than
there's no point in allowing a user typo to make gdb consume all memory. */
-#define MAX_SYMBOL_CACHE_SIZE (1024*1024)
+#define MAX_SYMBOL_CACHE_SIZE (1024 * 1024)
/* symbol_cache_lookup returns this if a previous lookup failed to find the
symbol in any objfile. */
#define SYMBOL_LOOKUP_FAILED \
- ((struct block_symbol) {(struct symbol *) 1, NULL})
+ ((struct block_symbol) { (struct symbol *) 1, NULL })
#define SYMBOL_LOOKUP_FAILED_P(SIB) (SIB.symbol == (struct symbol *) 1)
/* Recording lookups that don't find the symbol is just as important, if not
@@ -177,6 +168,7 @@ struct symbol_cache_slot
union
{
struct block_symbol found;
+
struct
{
char *name;
@@ -280,13 +272,9 @@ bool basenames_may_differ = false;
const char multiple_symbols_ask[] = "ask";
const char multiple_symbols_all[] = "all";
const char multiple_symbols_cancel[] = "cancel";
-static const char *const multiple_symbols_modes[] =
-{
- multiple_symbols_ask,
- multiple_symbols_all,
- multiple_symbols_cancel,
- NULL
-};
+static const char *const multiple_symbols_modes[]
+ = { multiple_symbols_ask, multiple_symbols_all, multiple_symbols_cancel,
+ NULL };
static const char *multiple_symbols_mode = multiple_symbols_all;
/* When TRUE, ignore the prologue-end flag in linetable_entry when searching
@@ -308,13 +296,20 @@ domain_name (domain_enum e)
{
switch (e)
{
- case UNDEF_DOMAIN: return "UNDEF_DOMAIN";
- case VAR_DOMAIN: return "VAR_DOMAIN";
- case STRUCT_DOMAIN: return "STRUCT_DOMAIN";
- case MODULE_DOMAIN: return "MODULE_DOMAIN";
- case LABEL_DOMAIN: return "LABEL_DOMAIN";
- case COMMON_BLOCK_DOMAIN: return "COMMON_BLOCK_DOMAIN";
- default: gdb_assert_not_reached ("bad domain_enum");
+ case UNDEF_DOMAIN:
+ return "UNDEF_DOMAIN";
+ case VAR_DOMAIN:
+ return "VAR_DOMAIN";
+ case STRUCT_DOMAIN:
+ return "STRUCT_DOMAIN";
+ case MODULE_DOMAIN:
+ return "MODULE_DOMAIN";
+ case LABEL_DOMAIN:
+ return "LABEL_DOMAIN";
+ case COMMON_BLOCK_DOMAIN:
+ return "COMMON_BLOCK_DOMAIN";
+ default:
+ gdb_assert_not_reached ("bad domain_enum");
}
}
@@ -325,12 +320,18 @@ search_domain_name (enum search_domain e)
{
switch (e)
{
- case VARIABLES_DOMAIN: return "VARIABLES_DOMAIN";
- case FUNCTIONS_DOMAIN: return "FUNCTIONS_DOMAIN";
- case TYPES_DOMAIN: return "TYPES_DOMAIN";
- case MODULES_DOMAIN: return "MODULES_DOMAIN";
- case ALL_DOMAIN: return "ALL_DOMAIN";
- default: gdb_assert_not_reached ("bad search_domain");
+ case VARIABLES_DOMAIN:
+ return "VARIABLES_DOMAIN";
+ case FUNCTIONS_DOMAIN:
+ return "FUNCTIONS_DOMAIN";
+ case TYPES_DOMAIN:
+ return "TYPES_DOMAIN";
+ case MODULES_DOMAIN:
+ return "MODULES_DOMAIN";
+ case ALL_DOMAIN:
+ return "ALL_DOMAIN";
+ default:
+ gdb_assert_not_reached ("bad search_domain");
}
}
@@ -346,8 +347,7 @@ compunit_symtab::find_call_site (CORE_ADDR pc) const
CORE_ADDR unrelocated_pc = pc - delta;
struct call_site call_site_local (unrelocated_pc, nullptr, nullptr);
- void **slot
- = htab_find_slot (m_call_site_htab, &call_site_local, NO_INSERT);
+ void **slot = htab_find_slot (m_call_site_htab, &call_site_local, NO_INSERT);
if (slot == nullptr)
return nullptr;
@@ -432,11 +432,8 @@ minimal_symbol::value_address (objfile *objfile) const
bool
minimal_symbol::data_p () const
{
- return m_type == mst_data
- || m_type == mst_bss
- || m_type == mst_abs
- || m_type == mst_file_data
- || m_type == mst_file_bss;
+ return m_type == mst_data || m_type == mst_bss || m_type == mst_abs
+ || m_type == mst_file_data || m_type == mst_file_bss;
}
/* See symtab.h. */
@@ -444,12 +441,9 @@ minimal_symbol::data_p () const
bool
minimal_symbol::text_p () const
{
- return m_type == mst_text
- || m_type == mst_text_gnu_ifunc
- || m_type == mst_data_gnu_ifunc
- || m_type == mst_slot_got_plt
- || m_type == mst_solib_trampoline
- || m_type == mst_file_text;
+ return m_type == mst_text || m_type == mst_text_gnu_ifunc
+ || m_type == mst_data_gnu_ifunc || m_type == mst_slot_got_plt
+ || m_type == mst_solib_trampoline || m_type == mst_file_text;
}
/* See whether FILENAME matches SEARCH_NAME using the rule that we
@@ -511,16 +505,18 @@ compare_glob_filenames_for_search (const char *filename,
{
return (search_path_elements == file_path_elements
&& gdb_filename_fnmatch (search_name, filename,
- FNM_FILE_NAME | FNM_NOESCAPE) == 0);
+ FNM_FILE_NAME | FNM_NOESCAPE)
+ == 0);
}
{
const char *file_to_compare
- = strip_leading_path_elements (filename,
- file_path_elements - search_path_elements);
+ = strip_leading_path_elements (filename, file_path_elements
+ - search_path_elements);
return gdb_filename_fnmatch (search_name, file_to_compare,
- FNM_FILE_NAME | FNM_NOESCAPE) == 0;
+ FNM_FILE_NAME | FNM_NOESCAPE)
+ == 0;
}
}
@@ -539,14 +535,13 @@ compare_glob_filenames_for_search (const char *filename,
search until the end of the list. */
bool
-iterate_over_some_symtabs (const char *name,
- const char *real_path,
+iterate_over_some_symtabs (const char *name, const char *real_path,
struct compunit_symtab *first,
struct compunit_symtab *after_last,
gdb::function_view<bool (symtab *)> callback)
{
struct compunit_symtab *cust;
- const char* base_name = lbasename (name);
+ const char *base_name = lbasename (name);
for (cust = first; cust != NULL && cust != after_last; cust = cust->next)
{
@@ -561,7 +556,7 @@ iterate_over_some_symtabs (const char *name,
/* Before we invoke realpath, which can get expensive when many
files are involved, do a quick comparison of the basenames. */
- if (! basenames_may_differ
+ if (!basenames_may_differ
&& FILENAME_CMP (base_name, lbasename (s->filename)) != 0)
continue;
@@ -644,16 +639,14 @@ lookup_symtab (const char *name)
{
struct symtab *result = NULL;
- iterate_over_symtabs (name, [&] (symtab *symtab)
- {
- result = symtab;
- return true;
- });
+ iterate_over_symtabs (name, [&] (symtab *symtab) {
+ result = symtab;
+ return true;
+ });
return result;
}
-
/* Mangle a GDB method stub type. This actually reassembles the pieces of the
full method name, which consist of the class name (from T), the unadorned
method name from METHOD_ID, and the signature for the specific overload,
@@ -690,8 +683,8 @@ gdb_mangle_name (struct type *type, int method_id, int signature_id)
is_full_physname_constructor = is_constructor_name (physname);
- is_constructor = is_full_physname_constructor
- || (newname && strcmp (field_name, newname) == 0);
+ is_constructor = is_full_physname_constructor
+ || (newname && strcmp (field_name, newname) == 0);
if (!is_destructor)
is_destructor = (startswith (physname, "__dt"));
@@ -717,11 +710,11 @@ gdb_mangle_name (struct type *type, int method_id, int signature_id)
}
else
{
- xsnprintf (buf, sizeof (buf), "__%s%s%d", const_prefix,
- volatile_prefix, len);
+ xsnprintf (buf, sizeof (buf), "__%s%s%d", const_prefix, volatile_prefix,
+ len);
}
- mangled_name_len = ((is_constructor ? 0 : strlen (field_name))
- + strlen (buf) + len + strlen (physname) + 1);
+ mangled_name_len = ((is_constructor ? 0 : strlen (field_name)) + strlen (buf)
+ + len + strlen (physname) + 1);
mangled_name = (char *) xmalloc (mangled_name_len);
if (is_constructor)
@@ -763,7 +756,6 @@ general_symbol_info::set_demangled_name (const char *name,
language_specific.demangled_name = name;
}
-
/* Initialize the language dependent portion of a symbol
depending upon the language for the symbol. */
@@ -772,10 +764,8 @@ general_symbol_info::set_language (enum language language,
struct obstack *obstack)
{
m_language = language;
- if (language == language_cplus
- || language == language_d
- || language == language_go
- || language == language_objc
+ if (language == language_cplus || language == language_d
+ || language == language_go || language == language_objc
|| language == language_fortran)
{
set_demangled_name (NULL, obstack);
@@ -797,7 +787,9 @@ general_symbol_info::set_language (enum language language,
struct demangled_name_entry
{
demangled_name_entry (gdb::string_view mangled_name)
- : mangled (mangled_name) {}
+ : mangled (mangled_name)
+ {
+ }
gdb::string_view mangled;
enum language language;
@@ -831,10 +823,9 @@ eq_demangled_name_entry (const void *a, const void *b)
static void
free_demangled_name_entry (void *data)
{
- struct demangled_name_entry *e
- = (struct demangled_name_entry *) data;
+ struct demangled_name_entry *e = (struct demangled_name_entry *) data;
- e->~demangled_name_entry();
+ e->~demangled_name_entry ();
}
/* Create the hash table used for demangled names. Each hash entry is
@@ -859,9 +850,9 @@ create_demangled_names_hash (struct objfile_per_bfd_storage *per_bfd)
int minsym_based_count = (per_bfd->minimal_symbol_count + 2) / 3 * 4;
int count = std::max (per_bfd->minimal_symbol_count, minsym_based_count);
- per_bfd->demangled_names_hash.reset (htab_create_alloc
- (count, hash_demangled_name_entry, eq_demangled_name_entry,
- free_demangled_name_entry, xcalloc, xfree));
+ per_bfd->demangled_names_hash.reset (htab_create_alloc (
+ count, hash_demangled_name_entry, eq_demangled_name_entry,
+ free_demangled_name_entry, xcalloc, xfree));
}
/* See symtab.h */
@@ -925,9 +916,9 @@ general_symbol_info::compute_and_set_names (gdb::string_view linkage_name,
if (!copy_name)
m_name = linkage_name.data ();
else
- m_name = obstack_strndup (&per_bfd->storage_obstack,
- linkage_name.data (),
- linkage_name.length ());
+ m_name
+ = obstack_strndup (&per_bfd->storage_obstack, linkage_name.data (),
+ linkage_name.length ());
set_demangled_name (NULL, &per_bfd->storage_obstack);
return;
@@ -939,9 +930,8 @@ general_symbol_info::compute_and_set_names (gdb::string_view linkage_name,
struct demangled_name_entry entry (linkage_name);
if (!hash.has_value ())
hash = hash_demangled_name_entry (&entry);
- slot = ((struct demangled_name_entry **)
- htab_find_slot_with_hash (per_bfd->demangled_names_hash.get (),
- &entry, *hash, INSERT));
+ slot = ((struct demangled_name_entry **) htab_find_slot_with_hash (
+ per_bfd->demangled_names_hash.get (), &entry, *hash, INSERT));
/* The const_cast is safe because the only reason it is already
initialized is if we purposefully set it from a background
@@ -950,8 +940,8 @@ general_symbol_info::compute_and_set_names (gdb::string_view linkage_name,
like if we called symbol_find_demangled_name here. If this is
nullptr, we call symbol_find_demangled_name below, but we put
this smart pointer here to be sure that we don't leak this name. */
- gdb::unique_xmalloc_ptr<char> demangled_name
- (const_cast<char *> (language_specific.demangled_name));
+ gdb::unique_xmalloc_ptr<char> demangled_name (
+ const_cast<char *> (language_specific.demangled_name));
/* If this name is not in the hash table, add it. */
if (*slot == NULL
@@ -969,15 +959,15 @@ general_symbol_info::compute_and_set_names (gdb::string_view linkage_name,
memcpy (alloc_name, linkage_name.data (), linkage_name.length ());
alloc_name[linkage_name.length ()] = '\0';
- linkage_name_copy = gdb::string_view (alloc_name,
- linkage_name.length ());
+ linkage_name_copy
+ = gdb::string_view (alloc_name, linkage_name.length ());
}
else
linkage_name_copy = linkage_name;
if (demangled_name.get () == nullptr)
- demangled_name
- = symbol_find_demangled_name (this, linkage_name_copy.data ());
+ demangled_name
+ = symbol_find_demangled_name (this, linkage_name_copy.data ());
/* Suppose we have demangled_name==NULL, copy_name==0, and
linkage_name_copy==linkage_name. In this case, we already have the
@@ -990,26 +980,23 @@ general_symbol_info::compute_and_set_names (gdb::string_view linkage_name,
us better bcache hit rates for partial symbols. */
if (!copy_name)
{
- *slot
- = ((struct demangled_name_entry *)
- obstack_alloc (&per_bfd->storage_obstack,
- sizeof (demangled_name_entry)));
+ *slot = ((struct demangled_name_entry *) obstack_alloc (
+ &per_bfd->storage_obstack, sizeof (demangled_name_entry)));
new (*slot) demangled_name_entry (linkage_name);
}
else
{
/* If we must copy the mangled name, put it directly after
the struct so we can have a single allocation. */
- *slot
- = ((struct demangled_name_entry *)
- obstack_alloc (&per_bfd->storage_obstack,
- sizeof (demangled_name_entry)
- + linkage_name.length () + 1));
+ *slot = ((struct demangled_name_entry *) obstack_alloc (
+ &per_bfd->storage_obstack,
+ sizeof (demangled_name_entry) + linkage_name.length () + 1));
char *mangled_ptr = reinterpret_cast<char *> (*slot + 1);
memcpy (mangled_ptr, linkage_name.data (), linkage_name.length ());
- mangled_ptr [linkage_name.length ()] = '\0';
- new (*slot) demangled_name_entry
- (gdb::string_view (mangled_ptr, linkage_name.length ()));
+ mangled_ptr[linkage_name.length ()] = '\0';
+ new (*slot)
+ demangled_name_entry (gdb::string_view (mangled_ptr,
+ linkage_name.length ()));
}
(*slot)->demangled = std::move (demangled_name);
(*slot)->language = language ();
@@ -1103,8 +1090,6 @@ symbol_matches_search_name (const struct general_symbol_info *gsymbol,
return name_match (gsymbol->search_name (), name, NULL);
}
-
-
/* Return true if the two sections are the same, or if they could
plausibly be copies of each other, one in an original object
file and another in a separated debug file. */
@@ -1113,8 +1098,8 @@ bool
matching_obj_sections (struct obj_section *obj_first,
struct obj_section *obj_second)
{
- asection *first = obj_first? obj_first->the_bfd_section : NULL;
- asection *second = obj_second? obj_second->the_bfd_section : NULL;
+ asection *first = obj_first ? obj_first->the_bfd_section : NULL;
+ asection *second = obj_second ? obj_second->the_bfd_section : NULL;
/* If they're the same section, then they match. */
if (first == second)
@@ -1144,8 +1129,7 @@ matching_obj_sections (struct obj_section *obj_first,
!= bfd_section_vma (second) - bfd_get_start_address (second->owner))
return false;
- if (bfd_section_name (first) == NULL
- || bfd_section_name (second) == NULL
+ if (bfd_section_name (first) == NULL || bfd_section_name (second) == NULL
|| strcmp (bfd_section_name (first), bfd_section_name (second)) != 0)
return false;
@@ -1192,12 +1176,12 @@ expand_symtab_containing_pc (CORE_ADDR pc, struct obj_section *section)
return;
}
}
-
+
/* Hash function for the symbol cache. */
static unsigned int
-hash_symbol_entry (const struct objfile *objfile_context,
- const char *name, domain_enum domain)
+hash_symbol_entry (const struct objfile *objfile_context, const char *name,
+ domain_enum domain)
{
unsigned int hash = (uintptr_t) objfile_context;
@@ -1218,8 +1202,8 @@ hash_symbol_entry (const struct objfile *objfile_context,
static int
eq_symbol_entry (const struct symbol_cache_slot *slot,
- const struct objfile *objfile_context,
- const char *name, domain_enum domain)
+ const struct objfile *objfile_context, const char *name,
+ domain_enum domain)
{
const char *slot_name;
domain_enum slot_domain;
@@ -1309,8 +1293,7 @@ resize_symbol_cache (struct symbol_cache *cache, unsigned int new_size)
of the global symbols cache. */
if ((cache->global_symbols != NULL
&& cache->global_symbols->size == new_size)
- || (cache->global_symbols == NULL
- && new_size == 0))
+ || (cache->global_symbols == NULL && new_size == 0))
return;
destroy_block_symbol_cache (cache->global_symbols);
@@ -1378,7 +1361,7 @@ set_symbol_cache_size_handler (const char *args, int from_tty,
This is the value the "show" command prints. */
new_symbol_cache_size = symbol_cache_size;
- error (_("Symbol cache size is too large, max is %u."),
+ error (_ ("Symbol cache size is too large, max is %u."),
MAX_SYMBOL_CACHE_SIZE);
}
symbol_cache_size = new_symbol_cache_size;
@@ -1427,8 +1410,9 @@ symbol_cache_lookup (struct symbol_cache *cache,
symbol_lookup_debug_printf ("%s block symbol cache hit%s for %s, %s",
block == GLOBAL_BLOCK ? "Global" : "Static",
slot->state == SYMBOL_SLOT_NOT_FOUND
- ? " (not found)" : "", name,
- domain_name (domain));
+ ? " (not found)"
+ : "",
+ name, domain_name (domain));
++bsc->hits;
if (slot->state == SYMBOL_SLOT_NOT_FOUND)
return SYMBOL_LOOKUP_FAILED;
@@ -1453,8 +1437,7 @@ static void
symbol_cache_mark_found (struct block_symbol_cache *bsc,
struct symbol_cache_slot *slot,
struct objfile *objfile_context,
- struct symbol *symbol,
- const struct block *block)
+ struct symbol *symbol, const struct block *block)
{
if (bsc == NULL)
return;
@@ -1476,8 +1459,8 @@ symbol_cache_mark_found (struct block_symbol_cache *bsc,
static void
symbol_cache_mark_not_found (struct block_symbol_cache *bsc,
struct symbol_cache_slot *slot,
- struct objfile *objfile_context,
- const char *name, domain_enum domain)
+ struct objfile *objfile_context, const char *name,
+ domain_enum domain)
{
if (bsc == NULL)
return;
@@ -1512,8 +1495,7 @@ symbol_cache_flush (struct program_space *pspace)
/* If the cache is untouched since the last flush, early exit.
This is important for performance during the startup of a program linked
with 100s (or 1000s) of shared libraries. */
- if (cache->global_symbols->misses == 0
- && cache->static_symbols->misses == 0)
+ if (cache->global_symbols->misses == 0 && cache->static_symbols->misses == 0)
return;
gdb_assert (cache->global_symbols->size == symbol_cache_size);
@@ -1602,11 +1584,10 @@ maintenance_print_symbol_cache (const char *args, int from_tty)
{
struct symbol_cache *cache;
- gdb_printf (_("Symbol cache for pspace %d\n%s:\n"),
- pspace->num,
+ gdb_printf (_ ("Symbol cache for pspace %d\n%s:\n"), pspace->num,
pspace->symfile_object_file != NULL
- ? objfile_name (pspace->symfile_object_file)
- : "(no object file)");
+ ? objfile_name (pspace->symfile_object_file)
+ : "(no object file)");
/* If the cache hasn't been created yet, avoid creating one. */
cache = symbol_cache_key.get (pspace);
@@ -1669,11 +1650,11 @@ maintenance_print_symbol_cache_statistics (const char *args, int from_tty)
{
struct symbol_cache *cache;
- gdb_printf (_("Symbol cache statistics for pspace %d\n%s:\n"),
+ gdb_printf (_ ("Symbol cache statistics for pspace %d\n%s:\n"),
pspace->num,
pspace->symfile_object_file != NULL
- ? objfile_name (pspace->symfile_object_file)
- : "(no object file)");
+ ? objfile_name (pspace->symfile_object_file)
+ : "(no object file)");
/* If the cache hasn't been created yet, avoid creating one. */
cache = symbol_cache_key.get (pspace);
@@ -1700,7 +1681,7 @@ symtab_free_objfile_observer (struct objfile *objfile)
{
symbol_cache_flush (objfile->pspace);
}
-
+
/* See symtab.h. */
void
@@ -1741,8 +1722,8 @@ fixup_symbol_section (struct symbol *sym, struct objfile *objfile)
e.g. on PowerPC64, where the minimal symbol for a function will
point to the function descriptor, while the debug symbol will
point to the actual function code. */
- msym = lookup_minimal_symbol_by_pc_name (addr, sym->linkage_name (),
- objfile);
+ msym
+ = lookup_minimal_symbol_by_pc_name (addr, sym->linkage_name (), objfile);
if (msym)
sym->set_section_index (msym->section_index ());
else
@@ -1814,8 +1795,8 @@ fixup_symbol_section (struct symbol *sym, struct objfile *objfile)
/* See symtab.h. */
-demangle_for_lookup_info::demangle_for_lookup_info
- (const lookup_name_info &lookup_name, language lang)
+demangle_for_lookup_info::demangle_for_lookup_info (
+ const lookup_name_info &lookup_name, language lang)
{
demangle_result_storage storage;
@@ -1828,8 +1809,8 @@ demangle_for_lookup_info::demangle_for_lookup_info
if (without_params != NULL)
{
if (lookup_name.match_type () != symbol_name_match_type::SEARCH_NAME)
- m_demangled_name = demangle_for_lookup (without_params.get (),
- lang, storage);
+ m_demangled_name
+ = demangle_for_lookup (without_params.get (), lang, storage);
return;
}
}
@@ -1837,8 +1818,8 @@ demangle_for_lookup_info::demangle_for_lookup_info
if (lookup_name.match_type () == symbol_name_match_type::SEARCH_NAME)
m_demangled_name = lookup_name.c_str ();
else
- m_demangled_name = demangle_for_lookup (lookup_name.c_str (),
- lang, storage);
+ m_demangled_name
+ = demangle_for_lookup (lookup_name.c_str (), lang, storage);
}
/* See symtab.h. */
@@ -1938,17 +1919,14 @@ lookup_symbol_in_language (const char *name, const struct block *block,
demangle_result_storage storage;
const char *modified_name = demangle_for_lookup (name, lang, storage);
- return lookup_symbol_aux (modified_name,
- symbol_name_match_type::FULL,
- block, domain, lang,
- is_a_field_of_this);
+ return lookup_symbol_aux (modified_name, symbol_name_match_type::FULL, block,
+ domain, lang, is_a_field_of_this);
}
/* See symtab.h. */
struct block_symbol
-lookup_symbol (const char *name, const struct block *block,
- domain_enum domain,
+lookup_symbol (const char *name, const struct block *block, domain_enum domain,
struct field_of_this_result *is_a_field_of_this)
{
return lookup_symbol_in_language (name, block, domain,
@@ -1988,11 +1966,11 @@ lookup_language_this (const struct language_defn *lang,
VAR_DOMAIN);
if (sym != NULL)
{
- symbol_lookup_debug_printf_v
- ("lookup_language_this (...) = %s (%s, block %s)",
- sym->print_name (), host_address_to_string (sym),
- host_address_to_string (block));
- return (struct block_symbol) {sym, block};
+ symbol_lookup_debug_printf_v (
+ "lookup_language_this (...) = %s (%s, block %s)",
+ sym->print_name (), host_address_to_string (sym),
+ host_address_to_string (block));
+ return (struct block_symbol) { sym, block };
}
if (block->function ())
break;
@@ -2053,8 +2031,8 @@ check_field (struct type *type, const char *name,
static struct block_symbol
lookup_symbol_aux (const char *name, symbol_name_match_type match_type,
- const struct block *block,
- const domain_enum domain, enum language language,
+ const struct block *block, const domain_enum domain,
+ enum language language,
struct field_of_this_result *is_a_field_of_this)
{
SYMBOL_LOOKUP_SCOPED_DEBUG_ENTER_EXIT;
@@ -2064,16 +2042,16 @@ lookup_symbol_aux (const char *name, symbol_name_match_type match_type,
if (symbol_lookup_debug)
{
- struct objfile *objfile = (block == nullptr
- ? nullptr : block_objfile (block));
+ struct objfile *objfile
+ = (block == nullptr ? nullptr : block_objfile (block));
- symbol_lookup_debug_printf
- ("demangled symbol name = \"%s\", block @ %s (objfile %s)",
- name, host_address_to_string (block),
- objfile != NULL ? objfile_debug_name (objfile) : "NULL");
- symbol_lookup_debug_printf
- ("domain name = \"%s\", language = \"%s\")",
- domain_name (domain), language_str (language));
+ symbol_lookup_debug_printf (
+ "demangled symbol name = \"%s\", block @ %s (objfile %s)", name,
+ host_address_to_string (block),
+ objfile != NULL ? objfile_debug_name (objfile) : "NULL");
+ symbol_lookup_debug_printf ("domain name = \"%s\", language = \"%s\")",
+ domain_name (domain),
+ language_str (language));
}
/* Make sure we do something sensible with is_a_field_of_this, since
@@ -2089,9 +2067,9 @@ lookup_symbol_aux (const char *name, symbol_name_match_type match_type,
result = lookup_local_symbol (name, match_type, block, domain, language);
if (result.symbol != NULL)
{
- symbol_lookup_debug_printf
- ("found symbol @ %s (using lookup_local_symbol)",
- host_address_to_string (result.symbol));
+ symbol_lookup_debug_printf (
+ "found symbol @ %s (using lookup_local_symbol)",
+ host_address_to_string (result.symbol));
return result;
}
@@ -2117,9 +2095,8 @@ lookup_symbol_aux (const char *name, symbol_name_match_type match_type,
if (t->is_pointer_or_reference ())
t = t->target_type ();
- if (t->code () != TYPE_CODE_STRUCT
- && t->code () != TYPE_CODE_UNION)
- error (_("Internal error: `%s' is not an aggregate"),
+ if (t->code () != TYPE_CODE_STRUCT && t->code () != TYPE_CODE_UNION)
+ error (_ ("Internal error: `%s' is not an aggregate"),
langdef->name_of_this ());
if (check_field (t, name, is_a_field_of_this))
@@ -2136,9 +2113,9 @@ lookup_symbol_aux (const char *name, symbol_name_match_type match_type,
result = langdef->lookup_symbol_nonlocal (name, block, domain);
if (result.symbol != NULL)
{
- symbol_lookup_debug_printf
- ("found symbol @ %s (using language lookup_symbol_nonlocal)",
- host_address_to_string (result.symbol));
+ symbol_lookup_debug_printf (
+ "found symbol @ %s (using language lookup_symbol_nonlocal)",
+ host_address_to_string (result.symbol));
return result;
}
@@ -2146,9 +2123,10 @@ lookup_symbol_aux (const char *name, symbol_name_match_type match_type,
but more useful than an error. */
result = lookup_static_symbol (name, domain);
- symbol_lookup_debug_printf
- ("found symbol @ %s (using lookup_static_symbol)",
- result.symbol != NULL ? host_address_to_string (result.symbol) : "NULL");
+ symbol_lookup_debug_printf ("found symbol @ %s (using lookup_static_symbol)",
+ result.symbol != NULL
+ ? host_address_to_string (result.symbol)
+ : "NULL");
return result;
}
@@ -2156,16 +2134,14 @@ lookup_symbol_aux (const char *name, symbol_name_match_type match_type,
Don't search STATIC_BLOCK or GLOBAL_BLOCK. */
static struct block_symbol
-lookup_local_symbol (const char *name,
- symbol_name_match_type match_type,
- const struct block *block,
- const domain_enum domain,
+lookup_local_symbol (const char *name, symbol_name_match_type match_type,
+ const struct block *block, const domain_enum domain,
enum language language)
{
struct symbol *sym;
const struct block *static_block = block_static_block (block);
const char *scope = block_scope (block);
-
+
/* Check if either no block is specified or it's a global block. */
if (static_block == NULL)
@@ -2175,7 +2151,7 @@ lookup_local_symbol (const char *name,
{
sym = lookup_symbol_in_block (name, match_type, block, domain);
if (sym != NULL)
- return (struct block_symbol) {sym, block};
+ return (struct block_symbol) { sym, block };
if (language == language_cplus || language == language_fortran)
{
@@ -2201,8 +2177,7 @@ lookup_local_symbol (const char *name,
struct symbol *
lookup_symbol_in_block (const char *name, symbol_name_match_type match_type,
- const struct block *block,
- const domain_enum domain)
+ const struct block *block, const domain_enum domain)
{
struct symbol *sym;
@@ -2211,11 +2186,11 @@ lookup_symbol_in_block (const char *name, symbol_name_match_type match_type,
struct objfile *objfile
= block == nullptr ? nullptr : block_objfile (block);
- symbol_lookup_debug_printf_v
- ("lookup_symbol_in_block (%s, %s (objfile %s), %s)",
- name, host_address_to_string (block),
- objfile != nullptr ? objfile_debug_name (objfile) : "NULL",
- domain_name (domain));
+ symbol_lookup_debug_printf_v (
+ "lookup_symbol_in_block (%s, %s (objfile %s), %s)", name,
+ host_address_to_string (block),
+ objfile != nullptr ? objfile_debug_name (objfile) : "NULL",
+ domain_name (domain));
}
sym = block_lookup_symbol (block, name, match_type, domain);
@@ -2235,8 +2210,7 @@ lookup_symbol_in_block (const char *name, symbol_name_match_type match_type,
struct block_symbol
lookup_global_symbol_from_objfile (struct objfile *main_objfile,
enum block_enum block_index,
- const char *name,
- const domain_enum domain)
+ const char *name, const domain_enum domain)
{
gdb_assert (block_index == GLOBAL_BLOCK || block_index == STATIC_BLOCK);
@@ -2259,16 +2233,16 @@ lookup_global_symbol_from_objfile (struct objfile *main_objfile,
static struct block_symbol
lookup_symbol_in_objfile_symtabs (struct objfile *objfile,
- enum block_enum block_index, const char *name,
- const domain_enum domain)
+ enum block_enum block_index,
+ const char *name, const domain_enum domain)
{
gdb_assert (block_index == GLOBAL_BLOCK || block_index == STATIC_BLOCK);
- symbol_lookup_debug_printf_v
- ("lookup_symbol_in_objfile_symtabs (%s, %s, %s, %s)",
- objfile_debug_name (objfile),
- block_index == GLOBAL_BLOCK ? "GLOBAL_BLOCK" : "STATIC_BLOCK",
- name, domain_name (domain));
+ symbol_lookup_debug_printf_v (
+ "lookup_symbol_in_objfile_symtabs (%s, %s, %s, %s)",
+ objfile_debug_name (objfile),
+ block_index == GLOBAL_BLOCK ? "GLOBAL_BLOCK" : "STATIC_BLOCK", name,
+ domain_name (domain));
struct block_symbol other;
other.symbol = NULL;
@@ -2304,15 +2278,15 @@ lookup_symbol_in_objfile_symtabs (struct objfile *objfile,
if (other.symbol != NULL)
{
- symbol_lookup_debug_printf_v
- ("lookup_symbol_in_objfile_symtabs (...) = %s (block %s)",
- host_address_to_string (other.symbol),
- host_address_to_string (other.block));
+ symbol_lookup_debug_printf_v (
+ "lookup_symbol_in_objfile_symtabs (...) = %s (block %s)",
+ host_address_to_string (other.symbol),
+ host_address_to_string (other.block));
return other;
}
- symbol_lookup_debug_printf_v
- ("lookup_symbol_in_objfile_symtabs (...) = NULL");
+ symbol_lookup_debug_printf_v (
+ "lookup_symbol_in_objfile_symtabs (...) = NULL");
return {};
}
@@ -2334,7 +2308,8 @@ lookup_symbol_in_objfile_from_linkage_name (struct objfile *objfile,
struct objfile *main_objfile;
demangle_result_storage storage;
- const char *modified_name = demangle_for_lookup (linkage_name, lang, storage);
+ const char *modified_name
+ = demangle_for_lookup (linkage_name, lang, storage);
if (objfile->separate_debug_objfile_backlink)
main_objfile = objfile->separate_debug_objfile_backlink;
@@ -2364,14 +2339,13 @@ static void ATTRIBUTE_NORETURN
error_in_psymtab_expansion (enum block_enum block_index, const char *name,
struct compunit_symtab *cust)
{
- error (_("\
+ error (_ ("\
Internal: %s symbol `%s' found in %s psymtab but not in symtab.\n\
%s may be an inlined function, or may be a template function\n \
(if a template, try specifying an instantiation: %s<type>)."),
- block_index == GLOBAL_BLOCK ? "global" : "static",
- name,
- symtab_to_filename_for_display (cust->primary_filetab ()),
- name, name);
+ block_index == GLOBAL_BLOCK ? "global" : "static", name,
+ symtab_to_filename_for_display (cust->primary_filetab ()), name,
+ name);
}
/* A helper function for various lookup routines that interfaces with
@@ -2387,31 +2361,30 @@ lookup_symbol_via_quick_fns (struct objfile *objfile,
const struct block *block;
struct block_symbol result;
- symbol_lookup_debug_printf_v
- ("lookup_symbol_via_quick_fns (%s, %s, %s, %s)",
- objfile_debug_name (objfile),
- block_index == GLOBAL_BLOCK ? "GLOBAL_BLOCK" : "STATIC_BLOCK",
- name, domain_name (domain));
+ symbol_lookup_debug_printf_v ("lookup_symbol_via_quick_fns (%s, %s, %s, %s)",
+ objfile_debug_name (objfile),
+ block_index == GLOBAL_BLOCK ? "GLOBAL_BLOCK"
+ : "STATIC_BLOCK",
+ name, domain_name (domain));
cust = objfile->lookup_symbol (block_index, name, domain);
if (cust == NULL)
{
- symbol_lookup_debug_printf_v
- ("lookup_symbol_via_quick_fns (...) = NULL");
+ symbol_lookup_debug_printf_v (
+ "lookup_symbol_via_quick_fns (...) = NULL");
return {};
}
bv = cust->blockvector ();
block = bv->block (block_index);
- result.symbol = block_lookup_symbol (block, name,
- symbol_name_match_type::FULL, domain);
+ result.symbol
+ = block_lookup_symbol (block, name, symbol_name_match_type::FULL, domain);
if (result.symbol == NULL)
error_in_psymtab_expansion (block_index, name, cust);
- symbol_lookup_debug_printf_v
- ("lookup_symbol_via_quick_fns (...) = %s (block %s)",
- host_address_to_string (result.symbol),
- host_address_to_string (block));
+ symbol_lookup_debug_printf_v (
+ "lookup_symbol_via_quick_fns (...) = %s (block %s)",
+ host_address_to_string (result.symbol), host_address_to_string (block));
result.block = block;
return result;
@@ -2448,8 +2421,8 @@ language_defn::lookup_symbol_nonlocal (const char *name,
gdbarch = target_gdbarch ();
else
gdbarch = block_gdbarch (block);
- result.symbol = language_lookup_primitive_type_as_symbol (this,
- gdbarch, name);
+ result.symbol
+ = language_lookup_primitive_type_as_symbol (this, gdbarch, name);
result.block = NULL;
if (result.symbol != NULL)
return result;
@@ -2461,8 +2434,7 @@ language_defn::lookup_symbol_nonlocal (const char *name,
/* See symtab.h. */
struct block_symbol
-lookup_symbol_in_static_block (const char *name,
- const struct block *block,
+lookup_symbol_in_static_block (const char *name, const struct block *block,
const domain_enum domain)
{
const struct block *static_block = block_static_block (block);
@@ -2473,23 +2445,22 @@ lookup_symbol_in_static_block (const char *name,
if (symbol_lookup_debug)
{
- struct objfile *objfile = (block == nullptr
- ? nullptr : block_objfile (block));
+ struct objfile *objfile
+ = (block == nullptr ? nullptr : block_objfile (block));
- symbol_lookup_debug_printf
- ("lookup_symbol_in_static_block (%s, %s (objfile %s), %s)",
- name, host_address_to_string (block),
- objfile != nullptr ? objfile_debug_name (objfile) : "NULL",
- domain_name (domain));
+ symbol_lookup_debug_printf (
+ "lookup_symbol_in_static_block (%s, %s (objfile %s), %s)", name,
+ host_address_to_string (block),
+ objfile != nullptr ? objfile_debug_name (objfile) : "NULL",
+ domain_name (domain));
}
- sym = lookup_symbol_in_block (name,
- symbol_name_match_type::FULL,
+ sym = lookup_symbol_in_block (name, symbol_name_match_type::FULL,
static_block, domain);
symbol_lookup_debug_printf ("lookup_symbol_in_static_block (...) = %s",
- sym != NULL
- ? host_address_to_string (sym) : "NULL");
- return (struct block_symbol) {sym, static_block};
+ sym != NULL ? host_address_to_string (sym)
+ : "NULL");
+ return (struct block_symbol) { sym, static_block };
}
/* Perform the standard symbol lookup of NAME in OBJFILE:
@@ -2507,28 +2478,26 @@ lookup_symbol_in_objfile (struct objfile *objfile, enum block_enum block_index,
symbol_lookup_debug_printf ("lookup_symbol_in_objfile (%s, %s, %s, %s)",
objfile_debug_name (objfile),
- block_index == GLOBAL_BLOCK
- ? "GLOBAL_BLOCK" : "STATIC_BLOCK",
+ block_index == GLOBAL_BLOCK ? "GLOBAL_BLOCK"
+ : "STATIC_BLOCK",
name, domain_name (domain));
- result = lookup_symbol_in_objfile_symtabs (objfile, block_index,
- name, domain);
+ result
+ = lookup_symbol_in_objfile_symtabs (objfile, block_index, name, domain);
if (result.symbol != NULL)
{
- symbol_lookup_debug_printf
- ("lookup_symbol_in_objfile (...) = %s (in symtabs)",
- host_address_to_string (result.symbol));
+ symbol_lookup_debug_printf (
+ "lookup_symbol_in_objfile (...) = %s (in symtabs)",
+ host_address_to_string (result.symbol));
return result;
}
- result = lookup_symbol_via_quick_fns (objfile, block_index,
- name, domain);
+ result = lookup_symbol_via_quick_fns (objfile, block_index, name, domain);
symbol_lookup_debug_printf ("lookup_symbol_in_objfile (...) = %s%s",
result.symbol != NULL
- ? host_address_to_string (result.symbol)
- : "NULL",
- result.symbol != NULL ? " (via quick fns)"
- : "");
+ ? host_address_to_string (result.symbol)
+ : "NULL",
+ result.symbol != NULL ? " (via quick fns)" : "");
return result;
}
@@ -2537,8 +2506,7 @@ lookup_symbol_in_objfile (struct objfile *objfile, enum block_enum block_index,
the objfile to start the lookup in. */
static struct block_symbol
-lookup_global_or_static_symbol (const char *name,
- enum block_enum block_index,
+lookup_global_or_static_symbol (const char *name, enum block_enum block_index,
struct objfile *objfile,
const domain_enum domain)
{
@@ -2563,15 +2531,14 @@ lookup_global_or_static_symbol (const char *name,
/* Do a global search (of global blocks, heh). */
if (result.symbol == NULL)
- gdbarch_iterate_over_objfiles_in_search_order
- (objfile != NULL ? objfile->arch () : target_gdbarch (),
- [&result, block_index, name, domain] (struct objfile *objfile_iter)
- {
- result = lookup_symbol_in_objfile (objfile_iter, block_index,
- name, domain);
- return result.symbol != nullptr;
- },
- objfile);
+ gdbarch_iterate_over_objfiles_in_search_order (
+ objfile != NULL ? objfile->arch () : target_gdbarch (),
+ [&result, block_index, name, domain] (struct objfile *objfile_iter) {
+ result
+ = lookup_symbol_in_objfile (objfile_iter, block_index, name, domain);
+ return result.symbol != nullptr;
+ },
+ objfile);
if (result.symbol != NULL)
symbol_cache_mark_found (bsc, slot, objfile, result.symbol, result.block);
@@ -2592,8 +2559,7 @@ lookup_static_symbol (const char *name, const domain_enum domain)
/* See symtab.h. */
struct block_symbol
-lookup_global_symbol (const char *name,
- const struct block *block,
+lookup_global_symbol (const char *name, const struct block *block,
const domain_enum domain)
{
/* If a block was passed in, we want to search the corresponding
@@ -2603,8 +2569,7 @@ lookup_global_symbol (const char *name,
symbol *sym = NULL;
if (global_block != nullptr)
{
- sym = lookup_symbol_in_block (name,
- symbol_name_match_type::FULL,
+ sym = lookup_symbol_in_block (name, symbol_name_match_type::FULL,
global_block, domain);
if (sym != NULL && best_symbol (sym, domain))
return { sym, global_block };
@@ -2628,15 +2593,12 @@ lookup_global_symbol (const char *name,
bool
symbol_matches_domain (enum language symbol_language,
- domain_enum symbol_domain,
- domain_enum domain)
+ domain_enum symbol_domain, domain_enum domain)
{
/* For C++ "struct foo { ... }" also defines a typedef for "foo".
Similarly, any Ada type declaration implicitly defines a typedef. */
- if (symbol_language == language_cplus
- || symbol_language == language_d
- || symbol_language == language_ada
- || symbol_language == language_rust)
+ if (symbol_language == language_cplus || symbol_language == language_d
+ || symbol_language == language_ada || symbol_language == language_rust)
{
if ((domain == VAR_DOMAIN || domain == STRUCT_DOMAIN)
&& symbol_domain == STRUCT_DOMAIN)
@@ -2687,8 +2649,7 @@ basic_lookup_transparent_type_quick (struct objfile *objfile,
static struct type *
basic_lookup_transparent_type_1 (struct objfile *objfile,
- enum block_enum block_index,
- const char *name)
+ enum block_enum block_index, const char *name)
{
const struct blockvector *bv;
const struct block *block;
@@ -2767,8 +2728,7 @@ basic_lookup_transparent_type (const char *name)
/* See symtab.h. */
bool
-iterate_over_symbols (const struct block *block,
- const lookup_name_info &name,
+iterate_over_symbols (const struct block *block, const lookup_name_info &name,
const domain_enum domain,
gdb::function_view<symbol_found_callback_ftype> callback)
{
@@ -2779,7 +2739,7 @@ iterate_over_symbols (const struct block *block,
{
if (symbol_matches_domain (sym->language (), sym->domain (), domain))
{
- struct block_symbol block_sym = {sym, block};
+ struct block_symbol block_sym = { sym, block };
if (!callback (&block_sym))
return false;
@@ -2791,15 +2751,14 @@ iterate_over_symbols (const struct block *block,
/* See symtab.h. */
bool
-iterate_over_symbols_terminated
- (const struct block *block,
- const lookup_name_info &name,
- const domain_enum domain,
- gdb::function_view<symbol_found_callback_ftype> callback)
+iterate_over_symbols_terminated (
+ const struct block *block, const lookup_name_info &name,
+ const domain_enum domain,
+ gdb::function_view<symbol_found_callback_ftype> callback)
{
if (!iterate_over_symbols (block, name, domain, callback))
return false;
- struct block_symbol block_sym = {nullptr, block};
+ struct block_symbol block_sym = { nullptr, block };
return callback (&block_sym);
}
@@ -2858,11 +2817,10 @@ find_pc_sect_compunit_symtab (CORE_ADDR pc, struct obj_section *section)
}
CORE_ADDR range = end - start;
- if (best_cust != nullptr
- && range >= best_cust_range)
+ if (best_cust != nullptr && range >= best_cust_range)
/* Cust doesn't have a smaller range than best_cust, skip it. */
continue;
-
+
/* For an objfile that has its functions reordered,
find_pc_psymtab will find the proper partial symbol table
and we simply return its corresponding symtab. */
@@ -2873,11 +2831,8 @@ find_pc_sect_compunit_symtab (CORE_ADDR pc, struct obj_section *section)
{
struct compunit_symtab *result;
- result
- = obj_file->find_pc_sect_compunit_symtab (msymbol,
- pc,
- section,
- 0);
+ result = obj_file->find_pc_sect_compunit_symtab (msymbol, pc,
+ section, 0);
if (result != NULL)
return result;
}
@@ -2888,8 +2843,7 @@ find_pc_sect_compunit_symtab (CORE_ADDR pc, struct obj_section *section)
struct block_iterator iter;
for (int b_index = GLOBAL_BLOCK;
- b_index <= STATIC_BLOCK && sym == NULL;
- ++b_index)
+ b_index <= STATIC_BLOCK && sym == NULL; ++b_index)
{
const struct block *b = bv->block (b_index);
ALL_BLOCK_SYMBOLS (b, iter, sym)
@@ -2900,7 +2854,7 @@ find_pc_sect_compunit_symtab (CORE_ADDR pc, struct obj_section *section)
}
}
if (sym == NULL)
- continue; /* No symbol in this symtab matches
+ continue; /* No symbol in this symtab matches
section. */
}
@@ -2943,25 +2897,24 @@ find_symbol_at_address (CORE_ADDR address)
{
/* A helper function to search a given symtab for a symbol matching
ADDR. */
- auto search_symtab = [] (compunit_symtab *symtab, CORE_ADDR addr) -> symbol *
- {
- const struct blockvector *bv = symtab->blockvector ();
+ auto search_symtab
+ = [] (compunit_symtab *symtab, CORE_ADDR addr) -> symbol * {
+ const struct blockvector *bv = symtab->blockvector ();
- for (int i = GLOBAL_BLOCK; i <= STATIC_BLOCK; ++i)
- {
- const struct block *b = bv->block (i);
- struct block_iterator iter;
- struct symbol *sym;
+ for (int i = GLOBAL_BLOCK; i <= STATIC_BLOCK; ++i)
+ {
+ const struct block *b = bv->block (i);
+ struct block_iterator iter;
+ struct symbol *sym;
- ALL_BLOCK_SYMBOLS (b, iter, sym)
- {
- if (sym->aclass () == LOC_STATIC
- && sym->value_address () == addr)
- return sym;
- }
- }
- return nullptr;
- };
+ ALL_BLOCK_SYMBOLS (b, iter, sym)
+ {
+ if (sym->aclass () == LOC_STATIC && sym->value_address () == addr)
+ return sym;
+ }
+ }
+ return nullptr;
+ };
for (objfile *objfile : current_program_space->objfiles ())
{
@@ -2992,8 +2945,6 @@ find_symbol_at_address (CORE_ADDR address)
return NULL;
}
-
-
/* Find the source file and line number for a given PC value and SECTION.
Return a structure containing a symtab pointer, a line number,
and a pc range for the entire source line.
@@ -3101,8 +3052,7 @@ find_pc_sect_line (CORE_ADDR pc, struct obj_section *section, int notcurrent)
if (msymbol.minsym->type () == mst_solib_trampoline)
{
struct bound_minimal_symbol mfunsym
- = lookup_minimal_symbol_text (msymbol.minsym->linkage_name (),
- NULL);
+ = lookup_minimal_symbol_text (msymbol.minsym->linkage_name (), NULL);
if (mfunsym.minsym == NULL)
/* I eliminated this warning since it is coming out
@@ -3118,8 +3068,7 @@ find_pc_sect_line (CORE_ADDR pc, struct obj_section *section, int notcurrent)
msymbol->linkage_name ()); */
;
/* fall through */
- else if (mfunsym.value_address ()
- == msymbol.value_address ())
+ else if (mfunsym.value_address () == msymbol.value_address ())
/* Avoid infinite recursion */
/* See above comment about why warning is commented out. */
/* warning ("In stub for %s; unable to find real function/line info",
@@ -3132,8 +3081,9 @@ find_pc_sect_line (CORE_ADDR pc, struct obj_section *section, int notcurrent)
should occur, we'd like to know about it, so error out,
fatally. */
if (mfunsym.value_address () == pc)
- internal_error (_("Infinite recursion detected in find_pc_sect_line;"
- "please file a bug report"));
+ internal_error (
+ _ ("Infinite recursion detected in find_pc_sect_line;"
+ "please file a bug report"));
return find_pc_line (mfunsym.value_address (), 0);
}
@@ -3175,16 +3125,15 @@ find_pc_sect_line (CORE_ADDR pc, struct obj_section *section, int notcurrent)
}
prev = NULL;
- item = l->item; /* Get first line info. */
+ item = l->item; /* Get first line info. */
/* Is this file's first line closer than the first lines of other files?
If so, record this file, and its first line, as best alternate. */
if (item->pc > pc && (!alt || item->pc < alt->pc))
alt = item;
- auto pc_compare = [](const CORE_ADDR & comp_pc,
- const struct linetable_entry & lhs)->bool
- {
+ auto pc_compare = [] (const CORE_ADDR &comp_pc,
+ const struct linetable_entry &lhs) -> bool {
return comp_pc < lhs.pc;
};
@@ -3192,7 +3141,7 @@ find_pc_sect_line (CORE_ADDR pc, struct obj_section *section, int notcurrent)
struct linetable_entry *last = item + len;
item = std::upper_bound (first, last, pc, pc_compare);
if (item != first)
- prev = item - 1; /* Found a matching item. */
+ prev = item - 1; /* Found a matching item. */
/* At this point, prev points at the line whose start addr is <= pc, and
item points at the next line. If we ran off the end of the linetable
@@ -3305,7 +3254,7 @@ find_pc_line_symtab (CORE_ADDR pc)
sal = find_pc_line (pc, 0);
return sal.symtab;
}
-
+
/* Find line number LINE in any symtab whose name is the same as
SYMTAB.
@@ -3317,10 +3266,10 @@ find_pc_line_symtab (CORE_ADDR pc)
If not found, return NULL. */
struct symtab *
-find_line_symtab (struct symtab *sym_tab, int line,
- int *index, bool *exact_match)
+find_line_symtab (struct symtab *sym_tab, int line, int *index,
+ bool *exact_match)
{
- int exact = 0; /* Initialized here to avoid a compiler warning. */
+ int exact = 0; /* Initialized here to avoid a compiler warning. */
/* BEST_INDEX and BEST_LINETABLE identify the smallest linenumber > LINE
so far seen. */
@@ -3367,8 +3316,9 @@ find_line_symtab (struct symtab *sym_tab, int line,
if (FILENAME_CMP (sym_tab->filename, s->filename) != 0)
continue;
if (FILENAME_CMP (symtab_to_fullname (sym_tab),
- symtab_to_fullname (s)) != 0)
- continue;
+ symtab_to_fullname (s))
+ != 0)
+ continue;
l = s->linetable ();
ind = find_line_common (l, line, &exact, 0);
if (ind >= 0)
@@ -3421,8 +3371,7 @@ find_pcs_for_symtab_line (struct symtab *symtab, int line,
int was_exact;
int idx;
- idx = find_line_common (symtab->linetable (), line, &was_exact,
- start);
+ idx = find_line_common (symtab->linetable (), line, &was_exact, start);
if (idx < 0)
break;
@@ -3444,7 +3393,6 @@ find_pcs_for_symtab_line (struct symtab *symtab, int line,
return result;
}
-
/* Set the PC value for a given source file and line number and return true.
Returns false for invalid line number (and sets the PC to 0).
The source file is specified with a struct symtab. */
@@ -3517,8 +3465,7 @@ find_line_pc_range (struct symtab_and_line sal, CORE_ADDR *startptr,
Set *EXACT_MATCH nonzero if the value returned is an exact match. */
static int
-find_line_common (struct linetable *l, int lineno,
- int *exact_match, int start)
+find_line_common (struct linetable *l, int lineno, int *exact_match, int start)
{
int i;
int len;
@@ -3644,7 +3591,6 @@ find_function_start_sal (symbol *sym, bool funfirstline)
return sal;
}
-
/* Given a function start address FUNC_ADDR and SYMTAB, find the first
address for that function that has an entry in SYMTAB's line info
table. If such an entry cannot be found, return FUNC_ADDR
@@ -3706,18 +3652,16 @@ skip_prologue_using_linetable (CORE_ADDR func_addr)
{
struct linetable *linetable = prologue_sal.symtab->linetable ();
- auto it = std::lower_bound
- (linetable->item, linetable->item + linetable->nitems, start_pc,
- [] (const linetable_entry &lte, CORE_ADDR pc) -> bool
- {
- return lte.pc < pc;
- });
+ auto it
+ = std::lower_bound (linetable->item,
+ linetable->item + linetable->nitems, start_pc,
+ [] (const linetable_entry &lte,
+ CORE_ADDR pc) -> bool { return lte.pc < pc; });
- for (;
- it < linetable->item + linetable->nitems && it->pc <= end_pc;
+ for (; it < linetable->item + linetable->nitems && it->pc <= end_pc;
it++)
if (it->prologue_end)
- return {it->pc};
+ return { it->pc };
}
return {};
@@ -3751,8 +3695,7 @@ skip_prologue_sal (struct symtab_and_line *sal)
not adjust the SAL. The user already has instruction level
visibility in this case, so selecting a line other than one requested
is likely to be the wrong choice. */
- if (sal->symtab != nullptr
- && sal->explicit_line
+ if (sal->symtab != nullptr && sal->explicit_line
&& sal->symtab->language () == language_asm)
return;
@@ -3795,8 +3738,7 @@ skip_prologue_sal (struct symtab_and_line *sal)
/* Be conservative - allow direct PC (without skipping prologue) only if we
have proven the CU (Compilation Unit) supports it. sal->SYMTAB does not
have to be set by the caller so we use SYM instead. */
- if (sym != NULL
- && sym->symtab ()->compunit ()->locations_valid ())
+ if (sym != NULL && sym->symtab ()->compunit ()->locations_valid ())
force_skip = 0;
saved_pc = pc;
@@ -3839,10 +3781,13 @@ skip_prologue_sal (struct symtab_and_line *sal)
/* Check if gdbarch_skip_prologue left us in mid-line, and the next
line is still part of the same function. */
- if (skip && start_sal.pc != pc
- && (sym ? (sym->value_block ()->entry_pc () <= start_sal.end
- && start_sal.end < sym->value_block()->end ())
- : (lookup_minimal_symbol_by_pc_section (start_sal.end, section).minsym
+ if (
+ skip && start_sal.pc != pc
+ && (sym
+ ? (sym->value_block ()->entry_pc () <= start_sal.end
+ && start_sal.end < sym->value_block ()->end ())
+ : (lookup_minimal_symbol_by_pc_section (start_sal.end, section)
+ .minsym
== lookup_minimal_symbol_by_pc_section (pc, section).minsym)))
{
/* First pc of next line */
@@ -3855,8 +3800,8 @@ skip_prologue_sal (struct symtab_and_line *sal)
constructors (ELF with .init has, PE doesn't), gcc emits a call
to `__main' in `main' between the prologue and before user
code. */
- if (gdbarch_skip_main_prologue_p (gdbarch)
- && name && strcmp_iw (name, "main") == 0)
+ if (gdbarch_skip_main_prologue_p (gdbarch) && name
+ && strcmp_iw (name, "main") == 0)
{
pc = gdbarch_skip_main_prologue (gdbarch, pc);
/* Recalculate the line number (might not be N+1). */
@@ -3904,8 +3849,7 @@ skip_prologue_sal (struct symtab_and_line *sal)
break;
b = b->superblock ();
}
- if (function_block != NULL
- && function_block->function ()->line () != 0)
+ if (function_block != NULL && function_block->function ()->line () != 0)
{
sal->line = function_block->function ()->line ();
sal->symtab = function_block->function ()->symtab ();
@@ -3960,9 +3904,8 @@ skip_prologue_using_sal (struct gdbarch *gdbarch, CORE_ADDR func_addr)
|| linetable->item[idx].line == 0)
idx++;
- if (idx+1 < linetable->nitems
- && linetable->item[idx+1].line != 0
- && linetable->item[idx+1].pc == start_pc)
+ if (idx + 1 < linetable->nitems && linetable->item[idx + 1].line != 0
+ && linetable->item[idx + 1].pc == start_pc)
return start_pc;
}
@@ -4036,15 +3979,13 @@ find_function_alias_target (bound_minimal_symbol msymbol)
return NULL;
symbol *sym = find_pc_function (func_addr);
- if (sym != NULL
- && sym->aclass () == LOC_BLOCK
+ if (sym != NULL && sym->aclass () == LOC_BLOCK
&& sym->value_block ()->entry_pc () == func_addr)
return sym;
return NULL;
}
-
/* If P is of the form "operator[ \t]+..." where `...' is
some legitimate operator text, return a pointer to the
beginning of the substring of the operator text.
@@ -4082,27 +4023,27 @@ operator_chars (const char *p, const char **end)
while (*p)
switch (*p)
{
- case '\\': /* regexp quoting */
+ case '\\': /* regexp quoting */
if (p[1] == '*')
{
- if (p[2] == '=') /* 'operator\*=' */
+ if (p[2] == '=') /* 'operator\*=' */
*end = p + 3;
- else /* 'operator\*' */
+ else /* 'operator\*' */
*end = p + 2;
return p;
}
else if (p[1] == '[')
{
if (p[2] == ']')
- error (_("mismatched quoting on brackets, "
- "try 'operator\\[\\]'"));
+ error (_ ("mismatched quoting on brackets, "
+ "try 'operator\\[\\]'"));
else if (p[2] == '\\' && p[3] == ']')
{
- *end = p + 4; /* 'operator\[\]' */
+ *end = p + 4; /* 'operator\[\]' */
return p;
}
else
- error (_("nothing is allowed between '[' and ']'"));
+ error (_ ("nothing is allowed between '[' and ']'"));
}
else
{
@@ -4133,17 +4074,17 @@ operator_chars (const char *p, const char **end)
/* Struct pointer member operator 'operator->'. */
if (p[2] == '*')
{
- *end = p + 3; /* 'operator->*' */
+ *end = p + 3; /* 'operator->*' */
return p;
}
else if (p[2] == '\\')
{
- *end = p + 4; /* Hopefully 'operator->\*' */
+ *end = p + 4; /* Hopefully 'operator->\*' */
return p;
}
else
{
- *end = p + 2; /* 'operator->' */
+ *end = p + 2; /* 'operator->' */
return p;
}
}
@@ -4158,36 +4099,35 @@ operator_chars (const char *p, const char **end)
return p;
case '(':
if (p[1] != ')')
- error (_("`operator ()' must be specified "
- "without whitespace in `()'"));
+ error (_ ("`operator ()' must be specified "
+ "without whitespace in `()'"));
*end = p + 2;
return p;
case '?':
if (p[1] != ':')
- error (_("`operator ?:' must be specified "
- "without whitespace in `?:'"));
+ error (_ ("`operator ?:' must be specified "
+ "without whitespace in `?:'"));
*end = p + 2;
return p;
case '[':
if (p[1] != ']')
- error (_("`operator []' must be specified "
- "without whitespace in `[]'"));
+ error (_ ("`operator []' must be specified "
+ "without whitespace in `[]'"));
*end = p + 2;
return p;
default:
- error (_("`operator %s' not supported"), p);
+ error (_ ("`operator %s' not supported"), p);
break;
}
*end = "";
return *end;
}
-
/* See class declaration. */
info_sources_filter::info_sources_filter (match_on match_type,
- const char *regexp)
+ const char *regexp)
: m_match_type (match_type),
m_regexp (regexp)
{
@@ -4200,7 +4140,7 @@ info_sources_filter::info_sources_filter (match_on match_type,
#ifdef HAVE_CASE_INSENSITIVE_FILE_SYSTEM
cflags |= REG_ICASE;
#endif
- m_c_regexp.emplace (m_regexp, cflags, _("Invalid regexp"));
+ m_c_regexp.emplace (m_regexp, cflags, _ ("Invalid regexp"));
}
}
@@ -4216,23 +4156,23 @@ info_sources_filter::matches (const char *fullname) const
std::string dirname;
switch (m_match_type)
- {
- case match_on::DIRNAME:
- dirname = ldirname (fullname);
- to_match = dirname.c_str ();
- break;
- case match_on::BASENAME:
- to_match = lbasename (fullname);
- break;
- case match_on::FULLNAME:
- to_match = fullname;
- break;
+ {
+ case match_on::DIRNAME:
+ dirname = ldirname (fullname);
+ to_match = dirname.c_str ();
+ break;
+ case match_on::BASENAME:
+ to_match = lbasename (fullname);
+ break;
+ case match_on::FULLNAME:
+ to_match = fullname;
+ break;
default:
gdb_assert_not_reached ("bad m_match_type");
- }
+ }
if (m_c_regexp->exec (to_match, 0, NULL, 0) != 0)
- return false;
+ return false;
}
return true;
@@ -4250,7 +4190,8 @@ struct output_source_filename_data
const info_sources_filter &filter)
: m_filter (filter),
m_uiout (uiout)
- { /* Nothing. */ }
+ { /* Nothing. */
+ }
DISABLE_COPY_AND_ASSIGN (output_source_filename_data);
@@ -4283,10 +4224,7 @@ struct output_source_filename_data
/* Return true if at least one filename has been printed (after a call to
output) since either this object was created, or the last call to
reset_output. */
- bool printed_filename_p () const
- {
- return !m_first;
- }
+ bool printed_filename_p () const { return !m_first; }
private:
@@ -4307,8 +4245,7 @@ private:
void
output_source_filename_data::output (const char *disp_name,
- const char *fullname,
- bool expanded_p)
+ const char *fullname, bool expanded_p)
{
/* Since a single source file can result in several partial symbol
tables, we need to avoid printing it more than once. Note: if
@@ -4339,8 +4276,7 @@ output_source_filename_data::output (const char *disp_name,
{
m_uiout->field_string ("file", disp_name, file_name_style.style ());
if (fullname != nullptr)
- m_uiout->field_string ("fullname", fullname,
- file_name_style.style ());
+ m_uiout->field_string ("fullname", fullname, file_name_style.style ());
m_uiout->field_string ("debug-fully-read",
(expanded_p ? "true" : "false"));
}
@@ -4348,8 +4284,7 @@ output_source_filename_data::output (const char *disp_name,
{
if (fullname == nullptr)
fullname = disp_name;
- m_uiout->field_string ("fullname", fullname,
- file_name_style.style ());
+ m_uiout->field_string ("fullname", fullname, file_name_style.style ());
}
}
@@ -4373,13 +4308,13 @@ static const gdb::option::option_def info_sources_option_defs[] = {
isrc_flag_option_def {
"dirname",
[] (filename_partial_match_opts *opts) { return &opts->dirname; },
- N_("Show only the files having a dirname matching REGEXP."),
+ N_ ("Show only the files having a dirname matching REGEXP."),
},
isrc_flag_option_def {
"basename",
[] (filename_partial_match_opts *opts) { return &opts->basename; },
- N_("Show only the files having a basename matching REGEXP."),
+ N_ ("Show only the files having a basename matching REGEXP."),
},
};
@@ -4390,27 +4325,27 @@ static const gdb::option::option_def info_sources_option_defs[] = {
static inline gdb::option::option_def_group
make_info_sources_options_def_group (filename_partial_match_opts *isrc_opts)
{
- return {{info_sources_option_defs}, isrc_opts};
+ return { { info_sources_option_defs }, isrc_opts };
}
/* Completer for "info sources". */
static void
info_sources_command_completer (cmd_list_element *ignore,
- completion_tracker &tracker,
- const char *text, const char *word)
+ completion_tracker &tracker, const char *text,
+ const char *word)
{
const auto group = make_info_sources_options_def_group (nullptr);
- if (gdb::option::complete_options
- (tracker, &text, gdb::option::PROCESS_OPTIONS_UNKNOWN_IS_OPERAND, group))
+ if (gdb::option::complete_options (
+ tracker, &text, gdb::option::PROCESS_OPTIONS_UNKNOWN_IS_OPERAND,
+ group))
return;
}
/* See symtab.h. */
void
-info_sources_worker (struct ui_out *uiout,
- bool group_by_objfile,
+info_sources_worker (struct ui_out *uiout, bool group_by_objfile,
const info_sources_filter &filter)
{
output_source_filename_data data (uiout, filter);
@@ -4490,22 +4425,24 @@ static void
info_sources_command (const char *args, int from_tty)
{
if (!have_full_symbols () && !have_partial_symbols ())
- error (_("No symbol table is loaded. Use the \"file\" command."));
+ error (_ ("No symbol table is loaded. Use the \"file\" command."));
filename_partial_match_opts match_opts;
auto group = make_info_sources_options_def_group (&match_opts);
- gdb::option::process_options
- (&args, gdb::option::PROCESS_OPTIONS_UNKNOWN_IS_ERROR, group);
+ gdb::option::process_options (&args,
+ gdb::option::PROCESS_OPTIONS_UNKNOWN_IS_ERROR,
+ group);
if (match_opts.dirname && match_opts.basename)
- error (_("You cannot give both -basename and -dirname to 'info sources'."));
+ error (
+ _ ("You cannot give both -basename and -dirname to 'info sources'."));
const char *regex = nullptr;
if (args != NULL && *args != '\000')
regex = args;
if ((match_opts.dirname || match_opts.basename) && regex == nullptr)
- error (_("Missing REGEXP for 'info sources'."));
+ error (_ ("Missing REGEXP for 'info sources'."));
info_sources_filter::match_on match_type;
if (match_opts.dirname)
@@ -4594,8 +4531,8 @@ treg_matches_sym_type_name (const compiled_regex &treg,
/* See symtab.h. */
bool
-global_symbol_searcher::is_suitable_msymbol
- (const enum search_domain kind, const minimal_symbol *msymbol)
+global_symbol_searcher::is_suitable_msymbol (const enum search_domain kind,
+ const minimal_symbol *msymbol)
{
switch (msymbol->type ())
{
@@ -4617,32 +4554,25 @@ global_symbol_searcher::is_suitable_msymbol
/* See symtab.h. */
bool
-global_symbol_searcher::expand_symtabs
- (objfile *objfile, const gdb::optional<compiled_regex> &preg) const
+global_symbol_searcher::expand_symtabs (
+ objfile *objfile, const gdb::optional<compiled_regex> &preg) const
{
enum search_domain kind = m_kind;
bool found_msymbol = false;
- auto do_file_match = [&] (const char *filename, bool basenames)
- {
- return file_matches (filename, filenames, basenames);
- };
+ auto do_file_match = [&] (const char *filename, bool basenames) {
+ return file_matches (filename, filenames, basenames);
+ };
gdb::function_view<expand_symtabs_file_matcher_ftype> file_matcher = nullptr;
if (!filenames.empty ())
file_matcher = do_file_match;
- objfile->expand_symtabs_matching
- (file_matcher,
- &lookup_name_info::match_any (),
- [&] (const char *symname)
- {
- return (!preg.has_value ()
- || preg->exec (symname, 0, NULL, 0) == 0);
- },
- NULL,
- SEARCH_GLOBAL_BLOCK | SEARCH_STATIC_BLOCK,
- UNDEF_DOMAIN,
- kind);
+ objfile->expand_symtabs_matching (
+ file_matcher, &lookup_name_info::match_any (),
+ [&] (const char *symname) {
+ return (!preg.has_value () || preg->exec (symname, 0, NULL, 0) == 0);
+ },
+ NULL, SEARCH_GLOBAL_BLOCK | SEARCH_STATIC_BLOCK, UNDEF_DOMAIN, kind);
/* Here, we search through the minimal symbol tables for functions and
variables that match, and force their symbols to be read. This is in
@@ -4671,8 +4601,7 @@ global_symbol_searcher::expand_symtabs
if (is_suitable_msymbol (kind, msymbol))
{
if (!preg.has_value ()
- || preg->exec (msymbol->natural_name (), 0,
- NULL, 0) == 0)
+ || preg->exec (msymbol->natural_name (), 0, NULL, 0) == 0)
{
/* An important side-effect of these lookup functions is
to expand the symbol table if msymbol is found, later
@@ -4680,12 +4609,13 @@ global_symbol_searcher::expand_symtabs
msymbols to the results list, and that requires that
the symbols tables are expanded. */
if (kind == FUNCTIONS_DOMAIN
- ? (find_pc_compunit_symtab
- (msymbol->value_address (objfile)) == NULL)
- : (lookup_symbol_in_objfile_from_linkage_name
- (objfile, msymbol->linkage_name (),
- VAR_DOMAIN)
- .symbol == NULL))
+ ? (find_pc_compunit_symtab (
+ msymbol->value_address (objfile))
+ == NULL)
+ : (lookup_symbol_in_objfile_from_linkage_name (
+ objfile, msymbol->linkage_name (), VAR_DOMAIN)
+ .symbol
+ == NULL))
found_msymbol = true;
}
}
@@ -4698,18 +4628,17 @@ global_symbol_searcher::expand_symtabs
/* See symtab.h. */
bool
-global_symbol_searcher::add_matching_symbols
- (objfile *objfile,
- const gdb::optional<compiled_regex> &preg,
- const gdb::optional<compiled_regex> &treg,
- std::set<symbol_search> *result_set) const
+global_symbol_searcher::add_matching_symbols (
+ objfile *objfile, const gdb::optional<compiled_regex> &preg,
+ const gdb::optional<compiled_regex> &treg,
+ std::set<symbol_search> *result_set) const
{
enum search_domain kind = m_kind;
/* Add matching symbols (if not already present). */
for (compunit_symtab *cust : objfile->compunits ())
{
- const struct blockvector *bv = cust->blockvector ();
+ const struct blockvector *bv = cust->blockvector ();
for (block_enum block : { GLOBAL_BLOCK, STATIC_BLOCK })
{
@@ -4733,8 +4662,7 @@ global_symbol_searcher::add_matching_symbols
&& file_matches (symtab_to_fullname (real_symtab),
filenames, false)))
&& ((!preg.has_value ()
- || preg->exec (sym->natural_name (), 0,
- NULL, 0) == 0)
+ || preg->exec (sym->natural_name (), 0, NULL, 0) == 0)
&& ((kind == VARIABLES_DOMAIN
&& sym->aclass () != LOC_TYPEDEF
&& sym->aclass () != LOC_UNRESOLVED
@@ -4744,15 +4672,13 @@ global_symbol_searcher::add_matching_symbols
members. We only want to skip enums
here. */
&& !(sym->aclass () == LOC_CONST
- && (sym->type ()->code ()
- == TYPE_CODE_ENUM))
+ && (sym->type ()->code () == TYPE_CODE_ENUM))
&& (!treg.has_value ()
|| treg_matches_sym_type_name (*treg, sym)))
|| (kind == FUNCTIONS_DOMAIN
&& sym->aclass () == LOC_BLOCK
&& (!treg.has_value ()
- || treg_matches_sym_type_name (*treg,
- sym)))
+ || treg_matches_sym_type_name (*treg, sym)))
|| (kind == TYPES_DOMAIN
&& sym->aclass () == LOC_TYPEDEF
&& sym->domain () != MODULE_DOMAIN)
@@ -4780,9 +4706,9 @@ global_symbol_searcher::add_matching_symbols
/* See symtab.h. */
bool
-global_symbol_searcher::add_matching_msymbols
- (objfile *objfile, const gdb::optional<compiled_regex> &preg,
- std::vector<symbol_search> *results) const
+global_symbol_searcher::add_matching_msymbols (
+ objfile *objfile, const gdb::optional<compiled_regex> &preg,
+ std::vector<symbol_search> *results) const
{
enum search_domain kind = m_kind;
@@ -4796,18 +4722,19 @@ global_symbol_searcher::add_matching_msymbols
if (is_suitable_msymbol (kind, msymbol))
{
if (!preg.has_value ()
- || preg->exec (msymbol->natural_name (), 0,
- NULL, 0) == 0)
+ || preg->exec (msymbol->natural_name (), 0, NULL, 0) == 0)
{
/* For functions we can do a quick check of whether the
symbol might be found via find_pc_symtab. */
- if (kind != FUNCTIONS_DOMAIN
- || (find_pc_compunit_symtab
- (msymbol->value_address (objfile)) == NULL))
+ if (
+ kind != FUNCTIONS_DOMAIN
+ || (find_pc_compunit_symtab (msymbol->value_address (objfile))
+ == NULL))
{
- if (lookup_symbol_in_objfile_from_linkage_name
- (objfile, msymbol->linkage_name (),
- VAR_DOMAIN).symbol == NULL)
+ if (lookup_symbol_in_objfile_from_linkage_name (
+ objfile, msymbol->linkage_name (), VAR_DOMAIN)
+ .symbol
+ == NULL)
{
/* Matching msymbol, add it to the results list. */
if (results->size () < m_max_search_results)
@@ -4847,7 +4774,7 @@ global_symbol_searcher::search () const
if (*opname)
{
- int fix = -1; /* -1 means ok; otherwise number of
+ int fix = -1; /* -1 means ok; otherwise number of
spaces needed. */
if (isalpha (*opname) || *opname == '_' || *opname == '$')
@@ -4871,18 +4798,16 @@ global_symbol_searcher::search () const
}
}
- int cflags = REG_NOSUB | (case_sensitivity == case_sensitive_off
- ? REG_ICASE : 0);
- preg.emplace (symbol_name_regexp, cflags,
- _("Invalid regexp"));
+ int cflags
+ = REG_NOSUB | (case_sensitivity == case_sensitive_off ? REG_ICASE : 0);
+ preg.emplace (symbol_name_regexp, cflags, _ ("Invalid regexp"));
}
if (m_symbol_type_regexp != NULL)
{
- int cflags = REG_NOSUB | (case_sensitivity == case_sensitive_off
- ? REG_ICASE : 0);
- treg.emplace (m_symbol_type_regexp, cflags,
- _("Invalid regexp"));
+ int cflags
+ = REG_NOSUB | (case_sensitivity == case_sensitive_off ? REG_ICASE : 0);
+ treg.emplace (m_symbol_type_regexp, cflags, _ ("Invalid regexp"));
}
bool found_msymbol = false;
@@ -4910,8 +4835,7 @@ global_symbol_searcher::search () const
minimal symbol, as we assume that a minimal symbol does not have a
type. */
if ((found_msymbol || (filenames.empty () && m_kind == VARIABLES_DOMAIN))
- && !m_exclude_minsyms
- && !treg.has_value ())
+ && !m_exclude_minsyms && !treg.has_value ())
{
gdb_assert (m_kind == VARIABLES_DOMAIN || m_kind == FUNCTIONS_DOMAIN);
for (objfile *objfile : current_program_space->objfiles ())
@@ -4925,8 +4849,7 @@ global_symbol_searcher::search () const
/* See symtab.h. */
std::string
-symbol_to_info_string (struct symbol *sym, int block,
- enum search_domain kind)
+symbol_to_info_string (struct symbol *sym, int block, enum search_domain kind)
{
std::string str;
@@ -4936,8 +4859,7 @@ symbol_to_info_string (struct symbol *sym, int block,
str += "static ";
/* Typedef that is not a C++ class. */
- if (kind == TYPES_DOMAIN
- && sym->domain () != STRUCT_DOMAIN)
+ if (kind == TYPES_DOMAIN && sym->domain () != STRUCT_DOMAIN)
{
string_file tmp_stream;
@@ -4957,14 +4879,12 @@ symbol_to_info_string (struct symbol *sym, int block,
}
/* variable, func, or typedef-that-is-c++-class. */
else if (kind < TYPES_DOMAIN
- || (kind == TYPES_DOMAIN
- && sym->domain () == STRUCT_DOMAIN))
+ || (kind == TYPES_DOMAIN && sym->domain () == STRUCT_DOMAIN))
{
string_file tmp_stream;
type_print (sym->type (),
- (sym->aclass () == LOC_TYPEDEF
- ? "" : sym->print_name ()),
+ (sym->aclass () == LOC_TYPEDEF ? "" : sym->print_name ()),
&tmp_stream, 0);
str += tmp_stream.string ();
@@ -4987,9 +4907,8 @@ symbol_to_info_string (struct symbol *sym, int block,
printing the filename if it matches LAST. */
static void
-print_symbol_info (enum search_domain kind,
- struct symbol *sym,
- int block, const char *last)
+print_symbol_info (enum search_domain kind, struct symbol *sym, int block,
+ const char *last)
{
scoped_switch_to_sym_language_if_auto l (sym);
struct symtab *s = sym->symtab ();
@@ -5000,9 +4919,8 @@ print_symbol_info (enum search_domain kind,
if (filename_cmp (last, s_filename) != 0)
{
- gdb_printf (_("\nFile %ps:\n"),
- styled_string (file_name_style.style (),
- s_filename));
+ gdb_printf (_ ("\nFile %ps:\n"),
+ styled_string (file_name_style.style (), s_filename));
}
if (sym->line () != 0)
@@ -5025,19 +4943,16 @@ print_msymbol_info (struct bound_minimal_symbol msymbol)
char *tmp;
if (gdbarch_addr_bit (gdbarch) <= 32)
- tmp = hex_string_custom (msymbol.value_address ()
- & (CORE_ADDR) 0xffffffff,
+ tmp = hex_string_custom (msymbol.value_address () & (CORE_ADDR) 0xffffffff,
8);
else
- tmp = hex_string_custom (msymbol.value_address (),
- 16);
+ tmp = hex_string_custom (msymbol.value_address (), 16);
- ui_file_style sym_style = (msymbol.minsym->text_p ()
- ? function_name_style.style ()
- : ui_file_style ());
+ ui_file_style sym_style
+ = (msymbol.minsym->text_p () ? function_name_style.style ()
+ : ui_file_style ());
- gdb_printf (_("%ps %ps\n"),
- styled_string (address_style.style (), tmp),
+ gdb_printf (_ ("%ps %ps\n"), styled_string (address_style.style (), tmp),
styled_string (sym_style, msymbol.minsym->print_name ()));
}
@@ -5047,12 +4962,12 @@ print_msymbol_info (struct bound_minimal_symbol msymbol)
matches. */
static void
-symtab_symbol_info (bool quiet, bool exclude_minsyms,
- const char *regexp, enum search_domain kind,
- const char *t_regexp, int from_tty)
+symtab_symbol_info (bool quiet, bool exclude_minsyms, const char *regexp,
+ enum search_domain kind, const char *t_regexp,
+ int from_tty)
{
- static const char * const classnames[] =
- {"variable", "function", "type", "module"};
+ static const char *const classnames[]
+ = { "variable", "function", "type", "module" };
const char *last_filename = "";
int first = 1;
@@ -5071,23 +4986,22 @@ symtab_symbol_info (bool quiet, bool exclude_minsyms,
if (regexp != NULL)
{
if (t_regexp != NULL)
- gdb_printf
- (_("All %ss matching regular expression \"%s\""
- " with type matching regular expression \"%s\":\n"),
- classnames[kind], regexp, t_regexp);
+ gdb_printf (_ ("All %ss matching regular expression \"%s\""
+ " with type matching regular expression \"%s\":\n"),
+ classnames[kind], regexp, t_regexp);
else
- gdb_printf (_("All %ss matching regular expression \"%s\":\n"),
+ gdb_printf (_ ("All %ss matching regular expression \"%s\":\n"),
classnames[kind], regexp);
}
else
{
if (t_regexp != NULL)
- gdb_printf
- (_("All defined %ss"
+ gdb_printf (
+ _ ("All defined %ss"
" with type matching regular expression \"%s\" :\n"),
- classnames[kind], t_regexp);
+ classnames[kind], t_regexp);
else
- gdb_printf (_("All defined %ss:\n"), classnames[kind]);
+ gdb_printf (_ ("All defined %ss:\n"), classnames[kind]);
}
}
@@ -5100,19 +5014,15 @@ symtab_symbol_info (bool quiet, bool exclude_minsyms,
if (first)
{
if (!quiet)
- gdb_printf (_("\nNon-debugging symbols:\n"));
+ gdb_printf (_ ("\nNon-debugging symbols:\n"));
first = 0;
}
print_msymbol_info (p.msymbol);
}
else
{
- print_symbol_info (kind,
- p.symbol,
- p.block,
- last_filename);
- last_filename
- = symtab_to_filename_for_display (p.symbol->symtab ());
+ print_symbol_info (kind, p.symbol, p.block, last_filename);
+ last_filename = symtab_to_filename_for_display (p.symbol->symtab ());
}
}
}
@@ -5131,28 +5041,25 @@ struct info_vars_funcs_options
/* The options used by the 'info variables' and 'info functions'
commands. */
-static const gdb::option::option_def info_vars_funcs_options_defs[] = {
- gdb::option::boolean_option_def<info_vars_funcs_options> {
- "q",
- [] (info_vars_funcs_options *opt) { return &opt->quiet; },
- nullptr, /* show_cmd_cb */
- nullptr /* set_doc */
- },
-
- gdb::option::boolean_option_def<info_vars_funcs_options> {
- "n",
- [] (info_vars_funcs_options *opt) { return &opt->exclude_minsyms; },
- nullptr, /* show_cmd_cb */
- nullptr /* set_doc */
- },
-
- gdb::option::string_option_def<info_vars_funcs_options> {
- "t",
- [] (info_vars_funcs_options *opt) { return &opt->type_regexp; },
- nullptr, /* show_cmd_cb */
- nullptr /* set_doc */
- }
-};
+static const gdb::option::option_def info_vars_funcs_options_defs[]
+ = { gdb::option::boolean_option_def<info_vars_funcs_options> {
+ "q", [] (info_vars_funcs_options *opt) { return &opt->quiet; },
+ nullptr, /* show_cmd_cb */
+ nullptr /* set_doc */
+ },
+
+ gdb::option::boolean_option_def<info_vars_funcs_options> {
+ "n",
+ [] (info_vars_funcs_options *opt) { return &opt->exclude_minsyms; },
+ nullptr, /* show_cmd_cb */
+ nullptr /* set_doc */
+ },
+
+ gdb::option::string_option_def<info_vars_funcs_options> {
+ "t", [] (info_vars_funcs_options *opt) { return &opt->type_regexp; },
+ nullptr, /* show_cmd_cb */
+ nullptr /* set_doc */
+ } };
/* Returns the option group used by 'info variables' and 'info
functions'. */
@@ -5160,7 +5067,7 @@ static const gdb::option::option_def info_vars_funcs_options_defs[] = {
static gdb::option::option_def_group
make_info_vars_funcs_options_def_group (info_vars_funcs_options *opts)
{
- return {{info_vars_funcs_options_defs}, opts};
+ return { { info_vars_funcs_options_defs }, opts };
}
/* Command completer for 'info variables' and 'info functions'. */
@@ -5170,10 +5077,10 @@ info_vars_funcs_command_completer (struct cmd_list_element *ignore,
completion_tracker &tracker,
const char *text, const char * /* word */)
{
- const auto group
- = make_info_vars_funcs_options_def_group (nullptr);
- if (gdb::option::complete_options
- (tracker, &text, gdb::option::PROCESS_OPTIONS_UNKNOWN_IS_OPERAND, group))
+ const auto group = make_info_vars_funcs_options_def_group (nullptr);
+ if (gdb::option::complete_options (
+ tracker, &text, gdb::option::PROCESS_OPTIONS_UNKNOWN_IS_OPERAND,
+ group))
return;
const char *word = advance_to_expression_complete_word_point (tracker, text);
@@ -5187,15 +5094,15 @@ info_variables_command (const char *args, int from_tty)
{
info_vars_funcs_options opts;
auto grp = make_info_vars_funcs_options_def_group (&opts);
- gdb::option::process_options
- (&args, gdb::option::PROCESS_OPTIONS_UNKNOWN_IS_OPERAND, grp);
+ gdb::option::process_options (
+ &args, gdb::option::PROCESS_OPTIONS_UNKNOWN_IS_OPERAND, grp);
if (args != nullptr && *args == '\0')
args = nullptr;
- symtab_symbol_info
- (opts.quiet, opts.exclude_minsyms, args, VARIABLES_DOMAIN,
- opts.type_regexp.empty () ? nullptr : opts.type_regexp.c_str (),
- from_tty);
+ symtab_symbol_info (opts.quiet, opts.exclude_minsyms, args, VARIABLES_DOMAIN,
+ opts.type_regexp.empty () ? nullptr
+ : opts.type_regexp.c_str (),
+ from_tty);
}
/* Implement the 'info functions' command. */
@@ -5206,15 +5113,15 @@ info_functions_command (const char *args, int from_tty)
info_vars_funcs_options opts;
auto grp = make_info_vars_funcs_options_def_group (&opts);
- gdb::option::process_options
- (&args, gdb::option::PROCESS_OPTIONS_UNKNOWN_IS_OPERAND, grp);
+ gdb::option::process_options (
+ &args, gdb::option::PROCESS_OPTIONS_UNKNOWN_IS_OPERAND, grp);
if (args != nullptr && *args == '\0')
args = nullptr;
- symtab_symbol_info
- (opts.quiet, opts.exclude_minsyms, args, FUNCTIONS_DOMAIN,
- opts.type_regexp.empty () ? nullptr : opts.type_regexp.c_str (),
- from_tty);
+ symtab_symbol_info (opts.quiet, opts.exclude_minsyms, args, FUNCTIONS_DOMAIN,
+ opts.type_regexp.empty () ? nullptr
+ : opts.type_regexp.c_str (),
+ from_tty);
}
/* Holds the -q option for the 'info types' command. */
@@ -5226,21 +5133,19 @@ struct info_types_options
/* The options used by the 'info types' command. */
-static const gdb::option::option_def info_types_options_defs[] = {
- gdb::option::boolean_option_def<info_types_options> {
- "q",
- [] (info_types_options *opt) { return &opt->quiet; },
+static const gdb::option::option_def info_types_options_defs[]
+ = { gdb::option::boolean_option_def<info_types_options> {
+ "q", [] (info_types_options *opt) { return &opt->quiet; },
nullptr, /* show_cmd_cb */
- nullptr /* set_doc */
- }
-};
+ nullptr /* set_doc */
+ } };
/* Returns the option group used by 'info types'. */
static gdb::option::option_def_group
make_info_types_options_def_group (info_types_options *opts)
{
- return {{info_types_options_defs}, opts};
+ return { { info_types_options_defs }, opts };
}
/* Implement the 'info types' command. */
@@ -5251,8 +5156,8 @@ info_types_command (const char *args, int from_tty)
info_types_options opts;
auto grp = make_info_types_options_def_group (&opts);
- gdb::option::process_options
- (&args, gdb::option::PROCESS_OPTIONS_UNKNOWN_IS_OPERAND, grp);
+ gdb::option::process_options (
+ &args, gdb::option::PROCESS_OPTIONS_UNKNOWN_IS_OPERAND, grp);
if (args != nullptr && *args == '\0')
args = nullptr;
symtab_symbol_info (opts.quiet, false, args, TYPES_DOMAIN, NULL, from_tty);
@@ -5262,13 +5167,13 @@ info_types_command (const char *args, int from_tty)
static void
info_types_command_completer (struct cmd_list_element *ignore,
- completion_tracker &tracker,
- const char *text, const char * /* word */)
+ completion_tracker &tracker, const char *text,
+ const char * /* word */)
{
- const auto group
- = make_info_types_options_def_group (nullptr);
- if (gdb::option::complete_options
- (tracker, &text, gdb::option::PROCESS_OPTIONS_UNKNOWN_IS_OPERAND, group))
+ const auto group = make_info_types_options_def_group (nullptr);
+ if (gdb::option::complete_options (
+ tracker, &text, gdb::option::PROCESS_OPTIONS_UNKNOWN_IS_OPERAND,
+ group))
return;
const char *word = advance_to_expression_complete_word_point (tracker, text);
@@ -5283,12 +5188,11 @@ info_modules_command (const char *args, int from_tty)
info_types_options opts;
auto grp = make_info_types_options_def_group (&opts);
- gdb::option::process_options
- (&args, gdb::option::PROCESS_OPTIONS_UNKNOWN_IS_OPERAND, grp);
+ gdb::option::process_options (
+ &args, gdb::option::PROCESS_OPTIONS_UNKNOWN_IS_OPERAND, grp);
if (args != nullptr && *args == '\0')
args = nullptr;
- symtab_symbol_info (opts.quiet, true, args, MODULES_DOMAIN, NULL,
- from_tty);
+ symtab_symbol_info (opts.quiet, true, args, MODULES_DOMAIN, NULL, from_tty);
}
static void
@@ -5302,8 +5206,7 @@ rbreak_command (const char *regexp, int from_tty)
const char *colon = strchr (regexp, ':');
/* Ignore the colon if it is part of a Windows drive. */
- if (HAS_DRIVE_SPEC (regexp)
- && (regexp[2] == '/' || regexp[2] == '\\'))
+ if (HAS_DRIVE_SPEC (regexp) && (regexp[2] == '/' || regexp[2] == '\\'))
colon = strchr (STRIP_DRIVE_SPEC (regexp), ':');
if (colon && *(colon + 1) != ':')
@@ -5335,15 +5238,14 @@ rbreak_command (const char *regexp, int from_tty)
struct symtab *symtab = p.symbol->symtab ();
const char *fullname = symtab_to_fullname (symtab);
- string = string_printf ("%s:'%s'", fullname,
- p.symbol->linkage_name ());
+ string
+ = string_printf ("%s:'%s'", fullname, p.symbol->linkage_name ());
break_command (&string[0], from_tty);
print_symbol_info (FUNCTIONS_DOMAIN, p.symbol, p.block, NULL);
}
else
{
- string = string_printf ("'%s'",
- p.msymbol.minsym->linkage_name ());
+ string = string_printf ("'%s'", p.msymbol.minsym->linkage_name ());
break_command (&string[0], from_tty);
gdb_printf ("<function, no debug info> %s;\n",
@@ -5351,7 +5253,6 @@ rbreak_command (const char *regexp, int from_tty)
}
}
}
-
/* Evaluate if SYMNAME matches LOOKUP_NAME. */
@@ -5372,8 +5273,7 @@ compare_symbol_name (const char *symbol_name, language symbol_language,
bool
completion_list_add_name (completion_tracker &tracker,
- language symbol_language,
- const char *symname,
+ language symbol_language, const char *symname,
const lookup_name_info &lookup_name,
const char *text, const char *word)
{
@@ -5403,8 +5303,8 @@ completion_list_add_name (completion_tracker &tracker,
"std::vector::push_back", "std::string::push_back", etc., and
in this case we want the completion lowest common denominator
to be "push_back" instead of "std::". */
- tracker.add_completion (std::move (completion),
- &match_res.match_for_lcd, text, word);
+ tracker.add_completion (std::move (completion), &match_res.match_for_lcd,
+ text, word);
}
return true;
@@ -5413,14 +5313,13 @@ completion_list_add_name (completion_tracker &tracker,
/* completion_list_add_name wrapper for struct symbol. */
static void
-completion_list_add_symbol (completion_tracker &tracker,
- symbol *sym,
+completion_list_add_symbol (completion_tracker &tracker, symbol *sym,
const lookup_name_info &lookup_name,
const char *text, const char *word)
{
if (!completion_list_add_name (tracker, sym->language (),
- sym->natural_name (),
- lookup_name, text, word))
+ sym->natural_name (), lookup_name, text,
+ word))
return;
/* C++ function symbols include the parameters within both the msymbol
@@ -5431,8 +5330,7 @@ completion_list_add_symbol (completion_tracker &tracker,
completion tracker. The following converts the symbol name back to
the msymbol name and removes the msymbol name from the completion
tracker. */
- if (sym->language () == language_cplus
- && sym->domain () == VAR_DOMAIN
+ if (sym->language () == language_cplus && sym->domain () == VAR_DOMAIN
&& sym->aclass () == LOC_BLOCK)
{
/* The call to canonicalize returns the empty string if the input
@@ -5448,17 +5346,14 @@ completion_list_add_symbol (completion_tracker &tracker,
/* completion_list_add_name wrapper for struct minimal_symbol. */
static void
-completion_list_add_msymbol (completion_tracker &tracker,
- minimal_symbol *sym,
+completion_list_add_msymbol (completion_tracker &tracker, minimal_symbol *sym,
const lookup_name_info &lookup_name,
const char *text, const char *word)
{
- completion_list_add_name (tracker, sym->language (),
- sym->natural_name (),
+ completion_list_add_name (tracker, sym->language (), sym->natural_name (),
lookup_name, text, word);
}
-
/* ObjC: In case we are completing on a selector, look as the msymbol
again and feed all the selectors into the mill. */
@@ -5482,9 +5377,7 @@ completion_list_objc_symbol (completion_tracker &tracker,
if (text[0] == '[')
/* Complete on shortened method method. */
- completion_list_add_name (tracker, language_objc,
- method + 1,
- lookup_name,
+ completion_list_add_name (tracker, language_objc, method + 1, lookup_name,
text, word);
while ((strlen (method) + 1) >= tmplen)
@@ -5506,11 +5399,11 @@ completion_list_objc_symbol (completion_tracker &tracker,
memcpy (tmp, method, (category - method));
tmp[category - method] = ' ';
memcpy (tmp + (category - method) + 1, selector, strlen (selector) + 1);
- completion_list_add_name (tracker, language_objc, tmp,
- lookup_name, text, word);
+ completion_list_add_name (tracker, language_objc, tmp, lookup_name, text,
+ word);
if (text[0] == '[')
- completion_list_add_name (tracker, language_objc, tmp + 1,
- lookup_name, text, word);
+ completion_list_add_name (tracker, language_objc, tmp + 1, lookup_name,
+ text, word);
}
if (selector != NULL)
@@ -5521,8 +5414,8 @@ completion_list_objc_symbol (completion_tracker &tracker,
if (tmp2 != NULL)
*tmp2 = '\0';
- completion_list_add_name (tracker, language_objc, tmp,
- lookup_name, text, word);
+ completion_list_add_name (tracker, language_objc, tmp, lookup_name, text,
+ word);
}
}
@@ -5540,12 +5433,12 @@ language_search_unquoted_string (const char *text, const char *p)
{
if ((current_language->la_language == language_objc))
{
- if (p[-1] == ':') /* Might be part of a method name. */
+ if (p[-1] == ':') /* Might be part of a method name. */
continue;
else if (p[-1] == '[' && (p[-2] == '-' || p[-2] == '+'))
- p -= 2; /* Beginning of a method name. */
+ p -= 2; /* Beginning of a method name. */
else if (p[-1] == ' ' || p[-1] == '(' || p[-1] == ')')
- { /* Might be part of a method name. */
+ { /* Might be part of a method name. */
const char *t = p;
/* Seeing a ' ' or a '(' is not conclusive evidence
@@ -5554,15 +5447,14 @@ language_search_unquoted_string (const char *text, const char *p)
Unfortunately we have to find it now to decide. */
while (t > text)
- if (isalnum (t[-1]) || t[-1] == '_' ||
- t[-1] == ' ' || t[-1] == ':' ||
- t[-1] == '(' || t[-1] == ')')
+ if (isalnum (t[-1]) || t[-1] == '_' || t[-1] == ' '
+ || t[-1] == ':' || t[-1] == '(' || t[-1] == ')')
--t;
else
break;
if (t[-1] == '[' && (t[-2] == '-' || t[-2] == '+'))
- p = t - 2; /* Method name detected. */
+ p = t - 2; /* Method name detected. */
/* Else we leave with p unchanged. */
}
}
@@ -5573,8 +5465,7 @@ language_search_unquoted_string (const char *text, const char *p)
}
static void
-completion_list_add_fields (completion_tracker &tracker,
- struct symbol *sym,
+completion_list_add_fields (completion_tracker &tracker, struct symbol *sym,
const lookup_name_info &lookup_name,
const char *text, const char *word)
{
@@ -5588,8 +5479,8 @@ completion_list_add_fields (completion_tracker &tracker,
for (j = TYPE_N_BASECLASSES (t); j < t->num_fields (); j++)
if (t->field (j).name ())
completion_list_add_name (tracker, sym->language (),
- t->field (j).name (),
- lookup_name, text, word);
+ t->field (j).name (), lookup_name, text,
+ word);
}
}
@@ -5641,29 +5532,28 @@ find_gnu_ifunc (const symbol *sym)
minimal_symbol *ifunc = NULL;
iterate_over_minimal_symbols (objfile, lookup_name,
- [&] (minimal_symbol *minsym)
- {
- if (minsym->type () == mst_text_gnu_ifunc
- || minsym->type () == mst_data_gnu_ifunc)
- {
- CORE_ADDR msym_addr = minsym->value_address (objfile);
- if (minsym->type () == mst_data_gnu_ifunc)
- {
- struct gdbarch *gdbarch = objfile->arch ();
- msym_addr = gdbarch_convert_from_func_ptr_addr
- (gdbarch, msym_addr, current_inferior ()->top_target ());
- }
- if (msym_addr == address)
- {
- ifunc = minsym;
- return true;
- }
- }
- return false;
- });
+ [&] (minimal_symbol *minsym) {
+ if (minsym->type () == mst_text_gnu_ifunc
+ || minsym->type () == mst_data_gnu_ifunc)
+ {
+ CORE_ADDR msym_addr = minsym->value_address (objfile);
+ if (minsym->type () == mst_data_gnu_ifunc)
+ {
+ struct gdbarch *gdbarch = objfile->arch ();
+ msym_addr = gdbarch_convert_from_func_ptr_addr (
+ gdbarch, msym_addr, current_inferior ()->top_target ());
+ }
+ if (msym_addr == address)
+ {
+ ifunc = minsym;
+ return true;
+ }
+ }
+ return false;
+ });
if (ifunc != NULL)
- return {ifunc, objfile};
+ return { ifunc, objfile };
return {};
}
@@ -5671,11 +5561,9 @@ find_gnu_ifunc (const symbol *sym)
static void
add_symtab_completions (struct compunit_symtab *cust,
- completion_tracker &tracker,
- complete_symbol_mode mode,
- const lookup_name_info &lookup_name,
- const char *text, const char *word,
- enum type_code code)
+ completion_tracker &tracker, complete_symbol_mode mode,
+ const lookup_name_info &lookup_name, const char *text,
+ const char *word, enum type_code code)
{
struct symbol *sym;
struct block_iterator iter;
@@ -5697,19 +5585,16 @@ add_symtab_completions (struct compunit_symtab *cust,
if (code == TYPE_CODE_UNDEF
|| (sym->domain () == STRUCT_DOMAIN
&& sym->type ()->code () == code))
- completion_list_add_symbol (tracker, sym,
- lookup_name,
- text, word);
+ completion_list_add_symbol (tracker, sym, lookup_name, text, word);
}
}
}
void
-default_collect_symbol_completion_matches_break_on
- (completion_tracker &tracker, complete_symbol_mode mode,
- symbol_name_match_type name_match_type,
- const char *text, const char *word,
- const char *break_on, enum type_code code)
+default_collect_symbol_completion_matches_break_on (
+ completion_tracker &tracker, complete_symbol_mode mode,
+ symbol_name_match_type name_match_type, const char *text, const char *word,
+ const char *break_on, enum type_code code)
{
/* Problem: All of the symbols have to be copied because readline
frees them. I'm not going to worry about this; hopefully there
@@ -5807,24 +5692,21 @@ default_collect_symbol_completion_matches_break_on
for (objfile *objfile : current_program_space->objfiles ())
{
for (compunit_symtab *cust : objfile->compunits ())
- add_symtab_completions (cust, tracker, mode, lookup_name,
- sym_text, word, code);
+ add_symtab_completions (cust, tracker, mode, lookup_name, sym_text,
+ word, code);
}
/* Look through the partial symtabs for all symbols which begin by
matching SYM_TEXT. Expand all CUs that you find to the list. */
- expand_symtabs_matching (NULL,
- lookup_name,
- NULL,
- [&] (compunit_symtab *symtab) /* expansion notify */
- {
- add_symtab_completions (symtab,
- tracker, mode, lookup_name,
- sym_text, word, code);
- return true;
- },
- SEARCH_GLOBAL_BLOCK | SEARCH_STATIC_BLOCK,
- ALL_DOMAIN);
+ expand_symtabs_matching (
+ NULL, lookup_name, NULL,
+ [&] (compunit_symtab *symtab) /* expansion notify */
+ {
+ add_symtab_completions (symtab, tracker, mode, lookup_name, sym_text, word,
+ code);
+ return true;
+ },
+ SEARCH_GLOBAL_BLOCK | SEARCH_STATIC_BLOCK, ALL_DOMAIN);
/* Search upwards from currently selected frame (so that we can
complete on local vars). Also catch fields of types defined in
@@ -5850,8 +5732,8 @@ default_collect_symbol_completion_matches_break_on
}
else if (sym->domain () == STRUCT_DOMAIN
&& sym->type ()->code () == code)
- completion_list_add_symbol (tracker, sym, lookup_name,
- sym_text, word);
+ completion_list_add_symbol (tracker, sym, lookup_name, sym_text,
+ word);
}
/* Stop when we encounter an enclosing function. Do not stop for
@@ -5868,13 +5750,13 @@ default_collect_symbol_completion_matches_break_on
{
if (surrounding_static_block != NULL)
ALL_BLOCK_SYMBOLS (surrounding_static_block, iter, sym)
- completion_list_add_fields (tracker, sym, lookup_name,
- sym_text, word);
+ completion_list_add_fields (tracker, sym, lookup_name, sym_text,
+ word);
if (surrounding_global_block != NULL)
ALL_BLOCK_SYMBOLS (surrounding_global_block, iter, sym)
- completion_list_add_fields (tracker, sym, lookup_name,
- sym_text, word);
+ completion_list_add_fields (tracker, sym, lookup_name, sym_text,
+ word);
}
/* Skip macros if we are completing a struct tag -- arguable but
@@ -5885,14 +5767,12 @@ default_collect_symbol_completion_matches_break_on
gdb::unique_xmalloc_ptr<struct macro_scope> scope;
/* This adds a macro's name to the current completion list. */
- auto add_macro_name = [&] (const char *macro_name,
- const macro_definition *,
- macro_source_file *,
- int)
- {
- completion_list_add_name (tracker, language_c, macro_name,
- lookup_name, sym_text, word);
- };
+ auto add_macro_name
+ = [&] (const char *macro_name, const macro_definition *,
+ macro_source_file *, int) {
+ completion_list_add_name (tracker, language_c, macro_name, lookup_name,
+ sym_text, word);
+ };
/* Add any macros visible in the default scope. Note that this
may yield the occasional wrong result, because an expression
@@ -5903,8 +5783,7 @@ default_collect_symbol_completion_matches_break_on
completion time. */
scope = default_macro_scope ();
if (scope)
- macro_for_each_in_scope (scope->file, scope->line,
- add_macro_name);
+ macro_for_each_in_scope (scope->file, scope->line, add_macro_name);
/* User-defined macros are always visible. */
macro_for_each (macro_user_macros, add_macro_name);
@@ -5921,9 +5800,8 @@ collect_symbol_completion_matches (completion_tracker &tracker,
const char *text, const char *word)
{
current_language->collect_symbol_completion_matches (tracker, mode,
- name_match_type,
- text, word,
- TYPE_CODE_UNDEF);
+ name_match_type, text,
+ word, TYPE_CODE_UNDEF);
}
/* Like collect_symbol_completion_matches, but only collect
@@ -5937,12 +5815,11 @@ collect_symbol_completion_matches_type (completion_tracker &tracker,
complete_symbol_mode mode = complete_symbol_mode::EXPRESSION;
symbol_name_match_type name_match_type = symbol_name_match_type::EXPRESSION;
- gdb_assert (code == TYPE_CODE_UNION
- || code == TYPE_CODE_STRUCT
+ gdb_assert (code == TYPE_CODE_UNION || code == TYPE_CODE_STRUCT
|| code == TYPE_CODE_ENUM);
current_language->collect_symbol_completion_matches (tracker, mode,
- name_match_type,
- text, word, code);
+ name_match_type, text,
+ word, code);
}
/* Like collect_symbol_completion_matches, but collects a list of
@@ -6008,13 +5885,11 @@ collect_file_symbol_completion_matches (completion_tracker &tracker,
/* Go through symtabs for SRCFILE and check the externs and statics
for symbols which match. */
- iterate_over_symtabs (srcfile, [&] (symtab *s)
- {
- add_symtab_completions (s->compunit (),
- tracker, mode, lookup_name,
- sym_text, word, TYPE_CODE_UNDEF);
- return false;
- });
+ iterate_over_symtabs (srcfile, [&] (symtab *s) {
+ add_symtab_completions (s->compunit (), tracker, mode, lookup_name,
+ sym_text, word, TYPE_CODE_UNDEF);
+ return false;
+ });
}
/* A helper function for make_source_files_completion_list. It adds
@@ -6031,10 +5906,9 @@ add_filename_to_list (const char *fname, const char *text, const char *word,
static int
not_interesting_fname (const char *fname)
{
- static const char *illegal_aliens[] = {
- "_globals_", /* inserted by coff_symtab_read */
- NULL
- };
+ static const char *illegal_aliens[]
+ = { "_globals_", /* inserted by coff_symtab_read */
+ NULL };
int i;
for (i = 0; illegal_aliens[i]; i++)
@@ -6077,8 +5951,7 @@ add_partial_filename_data::operator() (const char *filename,
{
const char *base_name = lbasename (filename);
- if (base_name != filename
- && !filename_seen_cache->seen (base_name)
+ if (base_name != filename && !filename_seen_cache->seen (base_name)
&& filename_ncmp (base_name, text, text_len) == 0)
add_filename_to_list (base_name, text, word, list);
}
@@ -6141,7 +6014,7 @@ make_source_files_completion_list (const char *text, const char *word)
return list;
}
-
+
/* Track MAIN */
/* Return the "main_info" object for the current program space. If
@@ -6258,21 +6131,20 @@ find_main_name (void)
/* Try to find language for main in psymtabs. */
bool symbol_found_p = false;
- gdbarch_iterate_over_objfiles_in_search_order
- (target_gdbarch (),
- [&symbol_found_p] (objfile *obj)
- {
- language lang
- = obj->lookup_global_symbol_language ("main", VAR_DOMAIN,
- &symbol_found_p);
- if (symbol_found_p)
- {
- set_main_name ("main", lang);
- return 1;
- }
-
- return 0;
- }, nullptr);
+ gdbarch_iterate_over_objfiles_in_search_order (
+ target_gdbarch (),
+ [&symbol_found_p] (objfile *obj) {
+ language lang = obj->lookup_global_symbol_language ("main", VAR_DOMAIN,
+ &symbol_found_p);
+ if (symbol_found_p)
+ {
+ set_main_name ("main", lang);
+ return 1;
+ }
+
+ return 0;
+ },
+ nullptr);
if (symbol_found_p)
return;
@@ -6322,14 +6194,12 @@ symtab_observer_executable_changed (void)
bool
producer_is_realview (const char *producer)
{
- static const char *const arm_idents[] = {
- "ARM C Compiler, ADS",
- "Thumb C Compiler, ADS",
- "ARM C++ Compiler, ADS",
- "Thumb C++ Compiler, ADS",
- "ARM/Thumb C/C++ Compiler, RVCT",
- "ARM C/C++ Compiler, RVCT"
- };
+ static const char *const arm_idents[] = { "ARM C Compiler, ADS",
+ "Thumb C Compiler, ADS",
+ "ARM C++ Compiler, ADS",
+ "Thumb C++ Compiler, ADS",
+ "ARM/Thumb C/C++ Compiler, RVCT",
+ "ARM C/C++ Compiler, RVCT" };
if (producer == NULL)
return false;
@@ -6341,8 +6211,6 @@ producer_is_realview (const char *producer)
return false;
}
-
-
/* The next index to hand out in response to a registration request. */
static int next_aclass_value = LOC_FINAL_VALUE;
@@ -6446,8 +6314,6 @@ initialize_ordinary_address_classes (void)
symbol_impl[i].aclass = (enum address_class) i;
}
-
-
/* See symtab.h. */
struct objfile *
@@ -6533,8 +6399,6 @@ get_msymbol_address (struct objfile *objf, const struct minimal_symbol *minsym)
+ objf->section_offsets[minsym->section_index ()]);
}
-
-
/* Hold the sub-commands of 'info module'. */
static struct cmd_list_element *info_module_cmdlist = NULL;
@@ -6578,10 +6442,11 @@ search_module_symbols (const char *module_regexp, const char *regexp,
continue;
if (strncmp (q.symbol->print_name (), prefix.c_str (),
- prefix.size ()) != 0)
+ prefix.size ())
+ != 0)
continue;
- results.push_back ({p, q});
+ results.push_back ({ p, q });
}
}
@@ -6606,37 +6471,35 @@ info_module_subcommand (bool quiet, const char *module_regexp,
{
if (regexp == nullptr)
gdb_printf ((kind == VARIABLES_DOMAIN
- ? _("All variables in all modules:")
- : _("All functions in all modules:")));
+ ? _ ("All variables in all modules:")
+ : _ ("All functions in all modules:")));
else
- gdb_printf
- ((kind == VARIABLES_DOMAIN
- ? _("All variables matching regular expression"
- " \"%s\" in all modules:")
- : _("All functions matching regular expression"
- " \"%s\" in all modules:")),
- regexp);
+ gdb_printf ((kind == VARIABLES_DOMAIN
+ ? _ ("All variables matching regular expression"
+ " \"%s\" in all modules:")
+ : _ ("All functions matching regular expression"
+ " \"%s\" in all modules:")),
+ regexp);
}
else
{
if (regexp == nullptr)
- gdb_printf
- ((kind == VARIABLES_DOMAIN
- ? _("All variables with type matching regular "
- "expression \"%s\" in all modules:")
- : _("All functions with type matching regular "
- "expression \"%s\" in all modules:")),
- type_regexp);
+ gdb_printf ((kind == VARIABLES_DOMAIN
+ ? _ ("All variables with type matching regular "
+ "expression \"%s\" in all modules:")
+ : _ ("All functions with type matching regular "
+ "expression \"%s\" in all modules:")),
+ type_regexp);
else
- gdb_printf
- ((kind == VARIABLES_DOMAIN
- ? _("All variables matching regular expression "
- "\"%s\",\n\twith type matching regular "
- "expression \"%s\" in all modules:")
- : _("All functions matching regular expression "
- "\"%s\",\n\twith type matching regular "
- "expression \"%s\" in all modules:")),
- regexp, type_regexp);
+ gdb_printf (
+ (kind == VARIABLES_DOMAIN
+ ? _ ("All variables matching regular expression "
+ "\"%s\",\n\twith type matching regular "
+ "expression \"%s\" in all modules:")
+ : _ ("All functions matching regular expression "
+ "\"%s\",\n\twith type matching regular "
+ "expression \"%s\" in all modules:")),
+ regexp, type_regexp);
}
}
else
@@ -6644,48 +6507,48 @@ info_module_subcommand (bool quiet, const char *module_regexp,
if (type_regexp == nullptr)
{
if (regexp == nullptr)
- gdb_printf
- ((kind == VARIABLES_DOMAIN
- ? _("All variables in all modules matching regular "
- "expression \"%s\":")
- : _("All functions in all modules matching regular "
- "expression \"%s\":")),
- module_regexp);
+ gdb_printf (
+ (kind == VARIABLES_DOMAIN
+ ? _ ("All variables in all modules matching regular "
+ "expression \"%s\":")
+ : _ ("All functions in all modules matching regular "
+ "expression \"%s\":")),
+ module_regexp);
else
- gdb_printf
- ((kind == VARIABLES_DOMAIN
- ? _("All variables matching regular expression "
- "\"%s\",\n\tin all modules matching regular "
- "expression \"%s\":")
- : _("All functions matching regular expression "
- "\"%s\",\n\tin all modules matching regular "
- "expression \"%s\":")),
- regexp, module_regexp);
+ gdb_printf (
+ (kind == VARIABLES_DOMAIN
+ ? _ ("All variables matching regular expression "
+ "\"%s\",\n\tin all modules matching regular "
+ "expression \"%s\":")
+ : _ ("All functions matching regular expression "
+ "\"%s\",\n\tin all modules matching regular "
+ "expression \"%s\":")),
+ regexp, module_regexp);
}
else
{
if (regexp == nullptr)
- gdb_printf
- ((kind == VARIABLES_DOMAIN
- ? _("All variables with type matching regular "
- "expression \"%s\"\n\tin all modules matching "
- "regular expression \"%s\":")
- : _("All functions with type matching regular "
- "expression \"%s\"\n\tin all modules matching "
- "regular expression \"%s\":")),
- type_regexp, module_regexp);
+ gdb_printf (
+ (kind == VARIABLES_DOMAIN
+ ? _ ("All variables with type matching regular "
+ "expression \"%s\"\n\tin all modules matching "
+ "regular expression \"%s\":")
+ : _ ("All functions with type matching regular "
+ "expression \"%s\"\n\tin all modules matching "
+ "regular expression \"%s\":")),
+ type_regexp, module_regexp);
else
- gdb_printf
- ((kind == VARIABLES_DOMAIN
- ? _("All variables matching regular expression "
- "\"%s\",\n\twith type matching regular expression "
- "\"%s\",\n\tin all modules matching regular "
- "expression \"%s\":")
- : _("All functions matching regular expression "
- "\"%s\",\n\twith type matching regular expression "
- "\"%s\",\n\tin all modules matching regular "
- "expression \"%s\":")),
- regexp, type_regexp, module_regexp);
+ gdb_printf (
+ (kind == VARIABLES_DOMAIN
+ ? _ ("All variables matching regular expression "
+ "\"%s\",\n\twith type matching regular expression "
+ "\"%s\",\n\tin all modules matching regular "
+ "expression \"%s\":")
+ : _ ("All functions matching regular expression "
+ "\"%s\",\n\twith type matching regular expression "
+ "\"%s\",\n\tin all modules matching regular "
+ "expression \"%s\":")),
+ regexp, type_regexp, module_regexp);
}
}
gdb_printf ("\n");
@@ -6698,15 +6561,15 @@ info_module_subcommand (bool quiet, const char *module_regexp,
= search_module_symbols (module_regexp, regexp, type_regexp, kind);
std::sort (module_symbols.begin (), module_symbols.end (),
- [] (const module_symbol_search &a, const module_symbol_search &b)
- {
- if (a.first < b.first)
- return true;
- else if (a.first == b.first)
- return a.second < b.second;
- else
- return false;
- });
+ [] (const module_symbol_search &a,
+ const module_symbol_search &b) {
+ if (a.first < b.first)
+ return true;
+ else if (a.first == b.first)
+ return a.second < b.second;
+ else
+ return false;
+ });
const char *last_filename = "";
const symbol *last_module_symbol = nullptr;
@@ -6720,15 +6583,13 @@ info_module_subcommand (bool quiet, const char *module_regexp,
if (last_module_symbol != p.symbol)
{
gdb_printf ("\n");
- gdb_printf (_("Module \"%s\":\n"), p.symbol->print_name ());
+ gdb_printf (_ ("Module \"%s\":\n"), p.symbol->print_name ());
last_module_symbol = p.symbol;
last_filename = "";
}
- print_symbol_info (FUNCTIONS_DOMAIN, q.symbol, q.block,
- last_filename);
- last_filename
- = symtab_to_filename_for_display (q.symbol->symtab ());
+ print_symbol_info (FUNCTIONS_DOMAIN, q.symbol, q.block, last_filename);
+ last_filename = symtab_to_filename_for_display (q.symbol->symtab ());
}
}
@@ -6744,36 +6605,34 @@ struct info_modules_var_func_options
/* The options used by 'info module variables' and 'info module functions'
commands. */
-static const gdb::option::option_def info_modules_var_func_options_defs [] = {
+static const gdb::option::option_def info_modules_var_func_options_defs[] = {
gdb::option::boolean_option_def<info_modules_var_func_options> {
- "q",
- [] (info_modules_var_func_options *opt) { return &opt->quiet; },
+ "q", [] (info_modules_var_func_options *opt) { return &opt->quiet; },
nullptr, /* show_cmd_cb */
- nullptr /* set_doc */
+ nullptr /* set_doc */
},
gdb::option::string_option_def<info_modules_var_func_options> {
- "t",
- [] (info_modules_var_func_options *opt) { return &opt->type_regexp; },
+ "t", [] (info_modules_var_func_options *opt) { return &opt->type_regexp; },
nullptr, /* show_cmd_cb */
- nullptr /* set_doc */
+ nullptr /* set_doc */
},
gdb::option::string_option_def<info_modules_var_func_options> {
"m",
[] (info_modules_var_func_options *opt) { return &opt->module_regexp; },
nullptr, /* show_cmd_cb */
- nullptr /* set_doc */
+ nullptr /* set_doc */
}
};
/* Return the option group used by the 'info module ...' sub-commands. */
static inline gdb::option::option_def_group
-make_info_modules_var_func_options_def_group
- (info_modules_var_func_options *opts)
+make_info_modules_var_func_options_def_group (
+ info_modules_var_func_options *opts)
{
- return {{info_modules_var_func_options_defs}, opts};
+ return { { info_modules_var_func_options_defs }, opts };
}
/* Implements the 'info module functions' command. */
@@ -6783,16 +6642,16 @@ info_module_functions_command (const char *args, int from_tty)
{
info_modules_var_func_options opts;
auto grp = make_info_modules_var_func_options_def_group (&opts);
- gdb::option::process_options
- (&args, gdb::option::PROCESS_OPTIONS_UNKNOWN_IS_OPERAND, grp);
+ gdb::option::process_options (
+ &args, gdb::option::PROCESS_OPTIONS_UNKNOWN_IS_OPERAND, grp);
if (args != nullptr && *args == '\0')
args = nullptr;
- info_module_subcommand
- (opts.quiet,
- opts.module_regexp.empty () ? nullptr : opts.module_regexp.c_str (), args,
- opts.type_regexp.empty () ? nullptr : opts.type_regexp.c_str (),
- FUNCTIONS_DOMAIN);
+ info_module_subcommand (
+ opts.quiet,
+ opts.module_regexp.empty () ? nullptr : opts.module_regexp.c_str (), args,
+ opts.type_regexp.empty () ? nullptr : opts.type_regexp.c_str (),
+ FUNCTIONS_DOMAIN);
}
/* Implements the 'info module variables' command. */
@@ -6802,16 +6661,16 @@ info_module_variables_command (const char *args, int from_tty)
{
info_modules_var_func_options opts;
auto grp = make_info_modules_var_func_options_def_group (&opts);
- gdb::option::process_options
- (&args, gdb::option::PROCESS_OPTIONS_UNKNOWN_IS_OPERAND, grp);
+ gdb::option::process_options (
+ &args, gdb::option::PROCESS_OPTIONS_UNKNOWN_IS_OPERAND, grp);
if (args != nullptr && *args == '\0')
args = nullptr;
- info_module_subcommand
- (opts.quiet,
- opts.module_regexp.empty () ? nullptr : opts.module_regexp.c_str (), args,
- opts.type_regexp.empty () ? nullptr : opts.type_regexp.c_str (),
- VARIABLES_DOMAIN);
+ info_module_subcommand (
+ opts.quiet,
+ opts.module_regexp.empty () ? nullptr : opts.module_regexp.c_str (), args,
+ opts.type_regexp.empty () ? nullptr : opts.type_regexp.c_str (),
+ VARIABLES_DOMAIN);
}
/* Command completer for 'info module ...' sub-commands. */
@@ -6822,19 +6681,18 @@ info_module_var_func_command_completer (struct cmd_list_element *ignore,
const char *text,
const char * /* word */)
{
-
const auto group = make_info_modules_var_func_options_def_group (nullptr);
- if (gdb::option::complete_options
- (tracker, &text, gdb::option::PROCESS_OPTIONS_UNKNOWN_IS_OPERAND, group))
+ if (gdb::option::complete_options (
+ tracker, &text, gdb::option::PROCESS_OPTIONS_UNKNOWN_IS_OPERAND,
+ group))
return;
const char *word = advance_to_expression_complete_word_point (tracker, text);
symbol_completer (ignore, tracker, text, word);
}
-
-
void _initialize_symtab ();
+
void
_initialize_symtab ()
{
@@ -6843,35 +6701,33 @@ _initialize_symtab ()
initialize_ordinary_address_classes ();
c = add_info ("variables", info_variables_command,
- info_print_args_help (_("\
+ info_print_args_help (_ ("\
All global and static variable names or those matching REGEXPs.\n\
Usage: info variables [-q] [-n] [-t TYPEREGEXP] [NAMEREGEXP]\n\
Prints the global and static variables.\n"),
- _("global and static variables"),
+ _ ("global and static variables"),
true));
set_cmd_completer_handle_brkchars (c, info_vars_funcs_command_completer);
c = add_info ("functions", info_functions_command,
- info_print_args_help (_("\
+ info_print_args_help (_ ("\
All function names or those matching REGEXPs.\n\
Usage: info functions [-q] [-n] [-t TYPEREGEXP] [NAMEREGEXP]\n\
Prints the functions.\n"),
- _("functions"),
- true));
+ _ ("functions"), true));
set_cmd_completer_handle_brkchars (c, info_vars_funcs_command_completer);
- c = add_info ("types", info_types_command, _("\
+ c = add_info ("types", info_types_command, _ ("\
All type names, or those matching REGEXP.\n\
Usage: info types [-q] [REGEXP]\n\
Print information about all types matching REGEXP, or all types if no\n\
REGEXP is given. The optional flag -q disables printing of headers."));
set_cmd_completer_handle_brkchars (c, info_types_command_completer);
- const auto info_sources_opts
- = make_info_sources_options_def_group (nullptr);
+ const auto info_sources_opts = make_info_sources_options_def_group (nullptr);
static std::string info_sources_help
- = gdb::option::build_help (_("\
+ = gdb::option::build_help (_ ("\
All source files in the program or those matching REGEXP.\n\
Usage: info sources [OPTION]... [REGEXP]\n\
By default, REGEXP is used to match anywhere in the filename.\n\
@@ -6884,14 +6740,14 @@ Options:\n\
set_cmd_completer_handle_brkchars (c, info_sources_command_completer);
c = add_info ("modules", info_modules_command,
- _("All module names, or those matching REGEXP."));
+ _ ("All module names, or those matching REGEXP."));
set_cmd_completer_handle_brkchars (c, info_types_command_completer);
- add_basic_prefix_cmd ("module", class_info, _("\
+ add_basic_prefix_cmd ("module", class_info, _ ("\
Print information about modules."),
&info_module_cmdlist, 0, &infolist);
- c = add_cmd ("functions", class_info, info_module_functions_command, _("\
+ c = add_cmd ("functions", class_info, info_module_functions_command, _ ("\
Display functions arranged by modules.\n\
Usage: info module functions [-q] [-m MODREGEXP] [-t TYPEREGEXP] [REGEXP]\n\
Print a summary of all functions within each Fortran module, grouped by\n\
@@ -6905,10 +6761,10 @@ type signature matches TYPEREGEXP are listed.\n\
\n\
The -q flag suppresses printing some header information."),
&info_module_cmdlist);
- set_cmd_completer_handle_brkchars
- (c, info_module_var_func_command_completer);
+ set_cmd_completer_handle_brkchars (c,
+ info_module_var_func_command_completer);
- c = add_cmd ("variables", class_info, info_module_variables_command, _("\
+ c = add_cmd ("variables", class_info, info_module_variables_command, _ ("\
Display variables arranged by modules.\n\
Usage: info module variables [-q] [-m MODREGEXP] [-t TYPEREGEXP] [REGEXP]\n\
Print a summary of all variables within each Fortran module, grouped by\n\
@@ -6922,24 +6778,27 @@ type matches TYPEREGEXP are listed.\n\
\n\
The -q flag suppresses printing some header information."),
&info_module_cmdlist);
- set_cmd_completer_handle_brkchars
- (c, info_module_var_func_command_completer);
+ set_cmd_completer_handle_brkchars (c,
+ info_module_var_func_command_completer);
add_com ("rbreak", class_breakpoint, rbreak_command,
- _("Set a breakpoint for all functions matching REGEXP."));
-
- add_setshow_enum_cmd ("multiple-symbols", no_class,
- multiple_symbols_modes, &multiple_symbols_mode,
- _("\
-Set how the debugger handles ambiguities in expressions."), _("\
-Show how the debugger handles ambiguities in expressions."), _("\
+ _ ("Set a breakpoint for all functions matching REGEXP."));
+
+ add_setshow_enum_cmd ("multiple-symbols", no_class, multiple_symbols_modes,
+ &multiple_symbols_mode, _ ("\
+Set how the debugger handles ambiguities in expressions."),
+ _ ("\
+Show how the debugger handles ambiguities in expressions."),
+ _ ("\
Valid values are \"ask\", \"all\", \"cancel\", and the default is \"all\"."),
NULL, NULL, &setlist, &showlist);
add_setshow_boolean_cmd ("basenames-may-differ", class_obscure,
- &basenames_may_differ, _("\
-Set whether a source file may have multiple base names."), _("\
-Show whether a source file may have multiple base names."), _("\
+ &basenames_may_differ, _ ("\
+Set whether a source file may have multiple base names."),
+ _ ("\
+Show whether a source file may have multiple base names."),
+ _ ("\
(A \"base name\" is the name of a file with the directory part removed.\n\
Example: The base name of \"/home/user/hello.c\" is \"hello.c\".)\n\
If set, GDB will canonicalize file names (e.g., expand symlinks)\n\
@@ -6947,31 +6806,30 @@ before comparing them. Canonicalization is an expensive operation,\n\
but it allows the same file be known by more than one base name.\n\
If not set (the default), all source files are assumed to have just\n\
one base name, and gdb will do file name comparisons more efficiently."),
- NULL, NULL,
- &setlist, &showlist);
+ NULL, NULL, &setlist, &showlist);
add_setshow_zuinteger_cmd ("symtab-create", no_class, &symtab_create_debug,
- _("Set debugging of symbol table creation."),
- _("Show debugging of symbol table creation."), _("\
+ _ ("Set debugging of symbol table creation."),
+ _ ("Show debugging of symbol table creation."),
+ _ ("\
When enabled (non-zero), debugging messages are printed when building\n\
symbol tables. A value of 1 (one) normally provides enough information.\n\
A value greater than 1 provides more verbose information."),
- NULL,
- NULL,
- &setdebuglist, &showdebuglist);
+ NULL, NULL, &setdebuglist, &showdebuglist);
add_setshow_zuinteger_cmd ("symbol-lookup", no_class, &symbol_lookup_debug,
- _("\
-Set debugging of symbol lookup."), _("\
-Show debugging of symbol lookup."), _("\
+ _ ("\
+Set debugging of symbol lookup."),
+ _ ("\
+Show debugging of symbol lookup."),
+ _ ("\
When enabled (non-zero), symbol lookups are logged."),
- NULL, NULL,
- &setdebuglist, &showdebuglist);
+ NULL, NULL, &setdebuglist, &showdebuglist);
add_setshow_zuinteger_cmd ("symbol-cache-size", no_class,
&new_symbol_cache_size,
- _("Set the size of the symbol cache."),
- _("Show the size of the symbol cache."), _("\
+ _ ("Set the size of the symbol cache."),
+ _ ("Show the size of the symbol cache."), _ ("\
The size of the symbol cache.\n\
If zero then the symbol cache is disabled."),
set_symbol_cache_size_handler, NULL,
@@ -6980,37 +6838,35 @@ If zero then the symbol cache is disabled."),
add_setshow_boolean_cmd ("ignore-prologue-end-flag", no_class,
&ignore_prologue_end_flag,
- _("Set if the PROLOGUE-END flag is ignored."),
- _("Show if the PROLOGUE-END flag is ignored."),
- _("\
+ _ ("Set if the PROLOGUE-END flag is ignored."),
+ _ ("Show if the PROLOGUE-END flag is ignored."),
+ _ ("\
The PROLOGUE-END flag from the line-table entries is used to place \
breakpoints past the prologue of functions. Disabeling its use use forces \
the use of prologue scanners."),
- nullptr, nullptr,
- &maintenance_set_cmdlist,
+ nullptr, nullptr, &maintenance_set_cmdlist,
&maintenance_show_cmdlist);
-
add_cmd ("symbol-cache", class_maintenance, maintenance_print_symbol_cache,
- _("Dump the symbol cache for each program space."),
+ _ ("Dump the symbol cache for each program space."),
&maintenanceprintlist);
add_cmd ("symbol-cache-statistics", class_maintenance,
maintenance_print_symbol_cache_statistics,
- _("Print symbol cache statistics for each program space."),
+ _ ("Print symbol cache statistics for each program space."),
&maintenanceprintlist);
cmd_list_element *maintenance_flush_symbol_cache_cmd
= add_cmd ("symbol-cache", class_maintenance,
maintenance_flush_symbol_cache,
- _("Flush the symbol cache for each program space."),
+ _ ("Flush the symbol cache for each program space."),
&maintenanceflushlist);
c = add_alias_cmd ("flush-symbol-cache", maintenance_flush_symbol_cache_cmd,
class_maintenance, 0, &maintenancelist);
deprecate_cmd (c, "maintenancelist flush symbol-cache");
- gdb::observers::executable_changed.attach (symtab_observer_executable_changed,
- "symtab");
+ gdb::observers::executable_changed.attach (
+ symtab_observer_executable_changed, "symtab");
gdb::observers::new_objfile.attach (symtab_new_objfile_observer, "symtab");
gdb::observers::free_objfile.attach (symtab_free_objfile_observer, "symtab");
}
diff --git a/gdb/symtab.h b/gdb/symtab.h
index 11ff875c6b8..c85d0c44f78 100644
--- a/gdb/symtab.h
+++ b/gdb/symtab.h
@@ -17,7 +17,7 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
-#if !defined (SYMTAB_H)
+#if !defined(SYMTAB_H)
#define SYMTAB_H 1
#include <array>
@@ -95,7 +95,8 @@ extern unsigned int search_name_hash (enum language language,
class ada_lookup_name_info final
{
- public:
+public:
+
/* Construct. */
explicit ada_lookup_name_info (const lookup_name_info &lookup_name);
@@ -107,22 +108,18 @@ class ada_lookup_name_info final
completion_match_result *comp_match_res) const;
/* The Ada-encoded lookup name. */
- const std::string &lookup_name () const
- { return m_encoded_name; }
+ const std::string &lookup_name () const { return m_encoded_name; }
/* Return true if we're supposed to be doing a wild match look
up. */
- bool wild_match_p () const
- { return m_wild_match_p; }
+ bool wild_match_p () const { return m_wild_match_p; }
/* Return true if we're looking up a name inside package
Standard. */
- bool standard_p () const
- { return m_standard_p; }
+ bool standard_p () const { return m_standard_p; }
/* Return true if doing a verbatim match. */
- bool verbatim_p () const
- { return m_verbatim_p; }
+ bool verbatim_p () const { return m_verbatim_p; }
/* A wrapper for ::split_name that handles some Ada-specific
peculiarities. */
@@ -140,6 +137,7 @@ class ada_lookup_name_info final
}
private:
+
/* The Ada-encoded lookup name. */
std::string m_encoded_name;
@@ -158,7 +156,7 @@ private:
does not understand. */
bool m_verbatim_p : 1;
- /* True if the user specified a symbol name that is inside package
+ /* True if the user specified a symbol name that is inside package
Standard. Symbol names inside package Standard are handled
specially. We always do a non-wild match of the symbol name
without the "standard__" prefix, and only search static and
@@ -177,14 +175,15 @@ private:
struct demangle_for_lookup_info final
{
public:
+
demangle_for_lookup_info (const lookup_name_info &lookup_name,
language lang);
/* The demangled lookup name. */
- const std::string &lookup_name () const
- { return m_demangled_name; }
+ const std::string &lookup_name () const { return m_demangled_name; }
private:
+
/* The demangled lookup name. */
std::string m_demangled_name;
};
@@ -203,42 +202,46 @@ private:
because they're not small.) */
class lookup_name_info final
{
- public:
+public:
+
/* We delete this overload so that the callers are required to
explicitly handle the lifetime of the name. */
- lookup_name_info (std::string &&name,
- symbol_name_match_type match_type,
+ lookup_name_info (std::string &&name, symbol_name_match_type match_type,
bool completion_mode = false,
- bool ignore_parameters = false) = delete;
+ bool ignore_parameters = false)
+ = delete;
/* This overload requires that NAME have a lifetime at least as long
as the lifetime of this object. */
- lookup_name_info (const std::string &name,
- symbol_name_match_type match_type,
+ lookup_name_info (const std::string &name, symbol_name_match_type match_type,
bool completion_mode = false,
bool ignore_parameters = false)
: m_match_type (match_type),
m_completion_mode (completion_mode),
m_ignore_parameters (ignore_parameters),
m_name (name)
- {}
+ {
+ }
/* This overload requires that NAME have a lifetime at least as long
as the lifetime of this object. */
- lookup_name_info (const char *name,
- symbol_name_match_type match_type,
+ lookup_name_info (const char *name, symbol_name_match_type match_type,
bool completion_mode = false,
bool ignore_parameters = false)
: m_match_type (match_type),
m_completion_mode (completion_mode),
m_ignore_parameters (ignore_parameters),
m_name (name)
- {}
+ {
+ }
/* Getters. See description of each corresponding field. */
symbol_name_match_type match_type () const { return m_match_type; }
+
bool completion_mode () const { return m_completion_mode; }
+
gdb::string_view name () const { return m_name; }
+
const bool ignore_parameters () const { return m_ignore_parameters; }
/* Like the "name" method but guarantees that the returned string is
@@ -291,7 +294,7 @@ class lookup_name_info final
}
/* A wrapper for ::split_name (see split-name.h) that splits this
- name, and that handles any language-specific peculiarities. */
+ name, and that handles any language-specific peculiarities. */
std::vector<gdb::string_view> split_name (language lang) const
{
if (lang == language_ada)
@@ -344,9 +347,10 @@ class lookup_name_info final
static const lookup_name_info &match_any ();
private:
+
/* Initialize FIELD, if not initialized yet. */
template<typename Field, typename... Args>
- void maybe_init (Field &field, Args&&... args) const
+ void maybe_init (Field &field, Args &&...args) const
{
if (!field)
field.emplace (*this, std::forward<Args> (args)...);
@@ -395,10 +399,9 @@ private:
LOOKUP_NAME. E.g., in C++, in linespec/wild mode, if the symbol is
"foo::function()" and LOOKUP_NAME is "function(", MATCH_FOR_LCD
points to "function()" inside SYMBOL_SEARCH_NAME. */
-typedef bool (symbol_name_matcher_ftype)
- (const char *symbol_search_name,
- const lookup_name_info &lookup_name,
- completion_match_result *comp_match_res);
+typedef bool (symbol_name_matcher_ftype) (
+ const char *symbol_search_name, const lookup_name_info &lookup_name,
+ completion_match_result *comp_match_res);
/* Some of the structures in this file are space critical.
The space-critical structures are:
@@ -457,8 +460,7 @@ struct general_symbol_info
demangled_name () if you specifically need to know whether natural_name ()
and linkage_name () are different. */
- const char *linkage_name () const
- { return m_name; }
+ const char *linkage_name () const { return m_name; }
/* Return SYMBOL's "natural" name, i.e. the name that it was called in
the original source code. In languages like C++ where symbols may
@@ -473,7 +475,9 @@ struct general_symbol_info
The result should never be NULL. Don't use this for internal
purposes (e.g. storing in a hashtable): it's only suitable for output. */
const char *print_name () const
- { return demangle ? natural_name () : linkage_name (); }
+ {
+ return demangle ? natural_name () : linkage_name ();
+ }
/* Return the demangled name for a symbol based on the language for
that symbol. If no demangled name exists, return NULL. */
@@ -491,16 +495,14 @@ struct general_symbol_info
e.g. struct tags. Unlike compute_and_set_names, linkage_name must
be terminated and either already on the objfile's obstack or
permanently allocated. */
- void set_linkage_name (const char *linkage_name)
- { m_name = linkage_name; }
+ void set_linkage_name (const char *linkage_name) { m_name = linkage_name; }
/* Set the demangled name of this symbol to NAME. NAME must be
already correctly allocated. If the symbol's language is Ada,
then the name is ignored and the obstack is set. */
void set_demangled_name (const char *name, struct obstack *obstack);
- enum language language () const
- { return m_language; }
+ enum language language () const { return m_language; }
/* Initializes the language dependent portion of a symbol
depending upon the language for the symbol. */
@@ -512,17 +514,11 @@ struct general_symbol_info
void compute_and_set_names (gdb::string_view linkage_name, bool copy_name,
struct objfile_per_bfd_storage *per_bfd,
gdb::optional<hashval_t> hash
- = gdb::optional<hashval_t> ());
+ = gdb::optional<hashval_t> ());
- CORE_ADDR value_address () const
- {
- return m_value.address;
- }
+ CORE_ADDR value_address () const { return m_value.address; }
- void set_value_address (CORE_ADDR address)
- {
- m_value.address = address;
- }
+ void set_value_address (CORE_ADDR address) { m_value.address = address; }
/* Name of the symbol. This is a required field. Storage for the
name is allocated on the objfile_obstack for the associated
@@ -555,8 +551,7 @@ struct general_symbol_info
/* For opaque typedef struct chain. */
struct symbol *chain;
- }
- m_value;
+ } m_value;
/* Since one and only one language can apply, wrap the language specific
information inside a union. */
@@ -571,14 +566,13 @@ struct general_symbol_info
/* This is used by languages which wish to store a demangled name.
currently used by Ada, C++, and Objective C. */
const char *demangled_name;
- }
- language_specific;
+ } language_specific;
/* Record the source code language that applies to this symbol.
This is used to select one of the fields from the language specific
union above. */
- ENUM_BITFIELD(language) m_language : LANGUAGE_BITS;
+ ENUM_BITFIELD (language) m_language : LANGUAGE_BITS;
/* This is only used by Ada. If set, then the 'demangled_name' field
of language_specific is valid. Otherwise, the 'obstack' field is
@@ -595,15 +589,13 @@ struct general_symbol_info
objfile) for the section that contains this symbol. See M_SECTION
for more details. */
- void set_section_index (short idx)
- { m_section = idx; }
+ void set_section_index (short idx) { m_section = idx; }
/* Return the index into the obj_section list (within the containing
objfile) for the section that contains this symbol. See M_SECTION
for more details. */
- short section_index () const
- { return m_section; }
+ short section_index () const { return m_section; }
/* Return the obj_section from OBJFILE for this symbol. The symbol
returned is based on the SECTION member variable, and can be nullptr
@@ -628,14 +620,15 @@ extern CORE_ADDR get_symbol_address (const struct symbol *sym);
then set the language appropriately. The returned name is allocated
by the demangler and should be xfree'd. */
-extern gdb::unique_xmalloc_ptr<char> symbol_find_demangled_name
- (struct general_symbol_info *gsymbol, const char *mangled);
+extern gdb::unique_xmalloc_ptr<char>
+symbol_find_demangled_name (struct general_symbol_info *gsymbol,
+ const char *mangled);
/* Return true if NAME matches the "search" name of GSYMBOL, according
to the symbol's language. */
-extern bool symbol_matches_search_name
- (const struct general_symbol_info *gsymbol,
- const lookup_name_info &name);
+extern bool
+symbol_matches_search_name (const struct general_symbol_info *gsymbol,
+ const lookup_name_info &name);
/* Compute the hash of the given symbol search name of a symbol of
language LANGUAGE. */
@@ -652,8 +645,8 @@ extern unsigned int search_name_hash (enum language language,
enum minimal_symbol_type
{
- mst_unknown = 0, /* Unknown type, the default */
- mst_text, /* Generally executable instructions */
+ mst_unknown = 0, /* Unknown type, the default */
+ mst_text, /* Generally executable instructions */
/* A GNU ifunc symbol, in the .text section. GDB uses to know
whether the user is setting a breakpoint on a GNU ifunc function,
@@ -662,7 +655,7 @@ enum minimal_symbol_type
into an ifunc resolver -- the resolver may get a separate
symbol/alias under a different name, but it'll have the same
address as the ifunc symbol. */
- mst_text_gnu_ifunc, /* Executable code returning address
+ mst_text_gnu_ifunc, /* Executable code returning address
of executable code */
/* A GNU ifunc function descriptor symbol, in a data section
@@ -671,13 +664,13 @@ enum minimal_symbol_type
is the address of the descriptor. There'll be a corresponding
mst_text_gnu_ifunc synthetic symbol for the text/entry
address. */
- mst_data_gnu_ifunc, /* Executable code returning address
+ mst_data_gnu_ifunc, /* Executable code returning address
of executable code */
- mst_slot_got_plt, /* GOT entries for .plt sections */
- mst_data, /* Generally initialized data */
- mst_bss, /* Generally uninitialized data */
- mst_abs, /* Generally absolute (nonrelocatable) */
+ mst_slot_got_plt, /* GOT entries for .plt sections */
+ mst_data, /* Generally initialized data */
+ mst_bss, /* Generally uninitialized data */
+ mst_abs, /* Generally absolute (nonrelocatable) */
/* GDB uses mst_solib_trampoline for the start address of a shared
library trampoline entry. Breakpoints for shared library functions
are put there if the shared library is not yet loaded.
@@ -686,12 +679,12 @@ enum minimal_symbol_type
a mst_text symbol) over the mst_solib_trampoline symbol, and the
breakpoints will be moved to their true address in the shared
library via breakpoint_re_set. */
- mst_solib_trampoline, /* Shared library trampoline code */
+ mst_solib_trampoline, /* Shared library trampoline code */
/* For the mst_file* types, the names are only guaranteed to be unique
within a given .o file. */
- mst_file_text, /* Static version of mst_text */
- mst_file_data, /* Static version of mst_data */
- mst_file_bss, /* Static version of mst_bss */
+ mst_file_text, /* Static version of mst_text */
+ mst_file_data, /* Static version of mst_data */
+ mst_file_bss, /* Static version of mst_bss */
nr_minsym_types
};
@@ -723,41 +716,26 @@ extern CORE_ADDR get_msymbol_address (struct objfile *objf,
struct minimal_symbol : public general_symbol_info
{
- LONGEST value_longest () const
- {
- return m_value.ivalue;
- }
+ LONGEST value_longest () const { return m_value.ivalue; }
/* The relocated address of the minimal symbol, using the section
offsets from OBJFILE. */
CORE_ADDR value_address (objfile *objfile) const;
/* The unrelocated address of the minimal symbol. */
- CORE_ADDR value_raw_address () const
- {
- return m_value.address;
- }
+ CORE_ADDR value_raw_address () const { return m_value.address; }
/* Return this minimal symbol's type. */
- minimal_symbol_type type () const
- {
- return m_type;
- }
+ minimal_symbol_type type () const { return m_type; }
/* Set this minimal symbol's type. */
- void set_type (minimal_symbol_type type)
- {
- m_type = type;
- }
+ void set_type (minimal_symbol_type type) { m_type = type; }
/* Return this minimal symbol's size. */
- unsigned long size () const
- {
- return m_size;
- }
+ unsigned long size () const { return m_size; }
/* Set this minimal symbol's size. */
@@ -769,17 +747,11 @@ struct minimal_symbol : public general_symbol_info
/* Return true if this minimal symbol's size is known. */
- bool has_size () const
- {
- return m_has_size;
- }
+ bool has_size () const { return m_has_size; }
/* Return this minimal symbol's first target-specific flag. */
- bool target_flag_1 () const
- {
- return m_target_flag_1;
- }
+ bool target_flag_1 () const { return m_target_flag_1; }
/* Set this minimal symbol's first target-specific flag. */
@@ -790,10 +762,7 @@ struct minimal_symbol : public general_symbol_info
/* Return this minimal symbol's second target-specific flag. */
- bool target_flag_2 () const
- {
- return m_target_flag_2;
- }
+ bool target_flag_2 () const { return m_target_flag_2; }
/* Set this minimal symbol's second target-specific flag. */
@@ -813,7 +782,7 @@ struct minimal_symbol : public general_symbol_info
/* Classification type for this minimal symbol. */
- ENUM_BITFIELD(minimal_symbol_type) m_type : MINSYM_TYPE_BITS;
+ ENUM_BITFIELD (minimal_symbol_type) m_type : MINSYM_TYPE_BITS;
/* Non-zero if this symbol was created by gdb.
Such symbols do not appear in the output of "info var|fun". */
@@ -861,8 +830,6 @@ struct minimal_symbol : public general_symbol_info
#include "minsyms.h"
-
-
/* Represent one symbol name; a variable, constant, function or typedef. */
/* Different name domains for symbols. Looking up a symbol specifies a
@@ -1061,7 +1028,6 @@ gdb_static_assert (LOC_FINAL_VALUE <= (1 << SYMBOL_ACLASS_BITS));
struct symbol_computed_ops
{
-
/* Return the value of the variable SYMBOL, relative to the stack
frame FRAME. If the variable has been optimized out, return
zero.
@@ -1069,8 +1035,7 @@ struct symbol_computed_ops
Iff `read_needs_frame (SYMBOL)' is not SYMBOL_NEEDS_FRAME, then
FRAME may be zero. */
- struct value *(*read_variable) (struct symbol * symbol,
- frame_info_ptr frame);
+ struct value *(*read_variable) (struct symbol *symbol, frame_info_ptr frame);
/* Read variable SYMBOL like read_variable at (callee) FRAME's function
entry. SYMBOL should be a function parameter, otherwise
@@ -1082,12 +1047,12 @@ struct symbol_computed_ops
value determines whether reading the symbol needs memory (e.g., a
global variable), just registers (a thread-local), or a frame (a
local variable). */
- enum symbol_needs_kind (*get_symbol_read_needs) (struct symbol * symbol);
+ enum symbol_needs_kind (*get_symbol_read_needs) (struct symbol *symbol);
/* Write to STREAM a natural-language description of the location of
SYMBOL, in the context of ADDR. */
- void (*describe_location) (struct symbol * symbol, CORE_ADDR addr,
- struct ui_file * stream);
+ void (*describe_location) (struct symbol *symbol, CORE_ADDR addr,
+ struct ui_file *stream);
/* Non-zero if this symbol's address computation is dependent on PC. */
unsigned char location_has_loclist;
@@ -1113,9 +1078,8 @@ struct symbol_computed_ops
void (*generate_c_location) (struct symbol *symbol, string_file *stream,
struct gdbarch *gdbarch,
- std::vector<bool> &registers_used,
- CORE_ADDR pc, const char *result_name);
-
+ std::vector<bool> &registers_used, CORE_ADDR pc,
+ const char *result_name);
};
/* The methods needed to implement LOC_BLOCK for inferior functions.
@@ -1147,8 +1111,7 @@ struct symbol_block_ops
instance, considering DWARF debugging information, the static link is
computed with DW_AT_static_link and this method must be used to compute
the corresponding DW_AT_frame_base attribute. */
- CORE_ADDR (*get_frame_base) (struct symbol *framefunc,
- frame_info_ptr frame);
+ CORE_ADDR (*get_frame_base) (struct symbol *framefunc, frame_info_ptr frame);
};
/* Functions used with LOC_REGISTER and LOC_REGPARM_ADDR. */
@@ -1206,19 +1169,19 @@ struct symbol : public general_symbol_info, public allocate_on_obstack
maybe_copied (0),
subclass (SYMBOL_NONE),
m_artificial (false)
- {
- /* We can't use an initializer list for members of a base class, and
+ {
+ /* We can't use an initializer list for members of a base class, and
general_symbol_info needs to stay a POD type. */
- m_name = nullptr;
- m_value.ivalue = 0;
- language_specific.obstack = nullptr;
- m_language = language_unknown;
- ada_mangled = 0;
- m_section = -1;
- /* GCC 4.8.5 (on CentOS 7) does not correctly compile class-
+ m_name = nullptr;
+ m_value.ivalue = 0;
+ language_specific.obstack = nullptr;
+ m_language = language_unknown;
+ ada_mangled = 0;
+ m_section = -1;
+ /* GCC 4.8.5 (on CentOS 7) does not correctly compile class-
initialization of unions, so we initialize it manually here. */
- owner.symtab = nullptr;
- }
+ owner.symtab = nullptr;
+ }
symbol (const symbol &) = default;
symbol &operator= (const symbol &) = default;
@@ -1233,85 +1196,43 @@ struct symbol : public general_symbol_info, public allocate_on_obstack
return symbol_impls[this->m_aclass_index];
}
- address_class aclass () const
- {
- return this->impl ().aclass;
- }
+ address_class aclass () const { return this->impl ().aclass; }
- domain_enum domain () const
- {
- return m_domain;
- }
+ domain_enum domain () const { return m_domain; }
- void set_domain (domain_enum domain)
- {
- m_domain = domain;
- }
+ void set_domain (domain_enum domain) { m_domain = domain; }
- bool is_objfile_owned () const
- {
- return m_is_objfile_owned;
- }
+ bool is_objfile_owned () const { return m_is_objfile_owned; }
void set_is_objfile_owned (bool is_objfile_owned)
{
m_is_objfile_owned = is_objfile_owned;
}
- bool is_argument () const
- {
- return m_is_argument;
- }
+ bool is_argument () const { return m_is_argument; }
- void set_is_argument (bool is_argument)
- {
- m_is_argument = is_argument;
- }
+ void set_is_argument (bool is_argument) { m_is_argument = is_argument; }
- bool is_inlined () const
- {
- return m_is_inlined;
- }
+ bool is_inlined () const { return m_is_inlined; }
- void set_is_inlined (bool is_inlined)
- {
- m_is_inlined = is_inlined;
- }
+ void set_is_inlined (bool is_inlined) { m_is_inlined = is_inlined; }
bool is_cplus_template_function () const
{
return this->subclass == SYMBOL_TEMPLATE;
}
- struct type *type () const
- {
- return m_type;
- }
+ struct type *type () const { return m_type; }
- void set_type (struct type *type)
- {
- m_type = type;
- }
+ void set_type (struct type *type) { m_type = type; }
- unsigned short line () const
- {
- return m_line;
- }
+ unsigned short line () const { return m_line; }
- void set_line (unsigned short line)
- {
- m_line = line;
- }
+ void set_line (unsigned short line) { m_line = line; }
- LONGEST value_longest () const
- {
- return m_value.ivalue;
- }
+ LONGEST value_longest () const { return m_value.ivalue; }
- void set_value_longest (LONGEST value)
- {
- m_value.ivalue = value;
- }
+ void set_value_longest (LONGEST value) { m_value.ivalue = value; }
CORE_ADDR value_address () const
{
@@ -1321,20 +1242,11 @@ struct symbol : public general_symbol_info, public allocate_on_obstack
return m_value.address;
}
- void set_value_address (CORE_ADDR address)
- {
- m_value.address = address;
- }
+ void set_value_address (CORE_ADDR address) { m_value.address = address; }
- const gdb_byte *value_bytes () const
- {
- return m_value.bytes;
- }
+ const gdb_byte *value_bytes () const { return m_value.bytes; }
- void set_value_bytes (const gdb_byte *bytes)
- {
- m_value.bytes = bytes;
- }
+ void set_value_bytes (const gdb_byte *bytes) { m_value.bytes = bytes; }
const common_block *value_common_block () const
{
@@ -1346,37 +1258,19 @@ struct symbol : public general_symbol_info, public allocate_on_obstack
m_value.common_block = common_block;
}
- const block *value_block () const
- {
- return m_value.block;
- }
+ const block *value_block () const { return m_value.block; }
- void set_value_block (const block *block)
- {
- m_value.block = block;
- }
+ void set_value_block (const block *block) { m_value.block = block; }
- symbol *value_chain () const
- {
- return m_value.chain;
- }
+ symbol *value_chain () const { return m_value.chain; }
- void set_value_chain (symbol *sym)
- {
- m_value.chain = sym;
- }
+ void set_value_chain (symbol *sym) { m_value.chain = sym; }
/* Return true if this symbol was marked as artificial. */
- bool is_artificial () const
- {
- return m_artificial;
- }
+ bool is_artificial () const { return m_artificial; }
/* Set the 'artificial' flag on this symbol. */
- void set_is_artificial (bool artificial)
- {
- m_artificial = artificial;
- }
+ void set_is_artificial (bool artificial) { m_artificial = artificial; }
/* Return the OBJFILE of this symbol. It is an error to call this
if is_objfile_owned is false, which only happens for
@@ -1420,7 +1314,7 @@ struct symbol : public general_symbol_info, public allocate_on_obstack
/* Domain code. */
- ENUM_BITFIELD(domain_enum) m_domain : SYMBOL_DOMAIN_BITS;
+ ENUM_BITFIELD (domain_enum) m_domain : SYMBOL_DOMAIN_BITS;
/* Address class. This holds an index into the 'symbol_impls'
table. The actual enum address_class value is stored there,
@@ -1502,10 +1396,10 @@ struct block_symbol
/* Note: There is no accessor macro for symbol.owner because it is
"private". */
-#define SYMBOL_COMPUTED_OPS(symbol) ((symbol)->impl ().ops_computed)
-#define SYMBOL_BLOCK_OPS(symbol) ((symbol)->impl ().ops_block)
-#define SYMBOL_REGISTER_OPS(symbol) ((symbol)->impl ().ops_register)
-#define SYMBOL_LOCATION_BATON(symbol) (symbol)->aux_value
+#define SYMBOL_COMPUTED_OPS(symbol) ((symbol)->impl ().ops_computed)
+#define SYMBOL_BLOCK_OPS(symbol) ((symbol)->impl ().ops_block)
+#define SYMBOL_REGISTER_OPS(symbol) ((symbol)->impl ().ops_register)
+#define SYMBOL_LOCATION_BATON(symbol) (symbol)->aux_value
extern int register_symbol_computed_impl (enum address_class,
const struct symbol_computed_ops *);
@@ -1539,7 +1433,6 @@ struct rust_vtable_symbol : public symbol
struct type *concrete_type = nullptr;
};
-
/* Each item represents a line-->pc (or the reverse) mapping. This is
somewhat more wasteful of space than one might wish, but since only
the files which are actually debugged are read in to core, we don't
@@ -1601,35 +1494,20 @@ typedef std::vector<CORE_ADDR> section_offsets;
struct symtab
{
- struct compunit_symtab *compunit () const
- {
- return m_compunit;
- }
+ struct compunit_symtab *compunit () const { return m_compunit; }
void set_compunit (struct compunit_symtab *compunit)
{
m_compunit = compunit;
}
- struct linetable *linetable () const
- {
- return m_linetable;
- }
+ struct linetable *linetable () const { return m_linetable; }
- void set_linetable (struct linetable *linetable)
- {
- m_linetable = linetable;
- }
+ void set_linetable (struct linetable *linetable) { m_linetable = linetable; }
- enum language language () const
- {
- return m_language;
- }
+ enum language language () const { return m_language; }
- void set_language (enum language language)
- {
- m_language = language;
- }
+ void set_language (enum language language) { m_language = language; }
/* Unordered chain of all filetabs in the compunit, with the exception
that the "main" source file is the first entry in the list. */
@@ -1712,20 +1590,11 @@ using symtab_range = next_range<symtab>;
struct compunit_symtab
{
- struct objfile *objfile () const
- {
- return m_objfile;
- }
+ struct objfile *objfile () const { return m_objfile; }
- void set_objfile (struct objfile *objfile)
- {
- m_objfile = objfile;
- }
+ void set_objfile (struct objfile *objfile) { m_objfile = objfile; }
- symtab_range filetabs () const
- {
- return symtab_range (m_filetabs);
- }
+ symtab_range filetabs () const { return symtab_range (m_filetabs); }
void add_filetab (symtab *filetab)
{
@@ -1741,75 +1610,45 @@ struct compunit_symtab
}
}
- const char *debugformat () const
- {
- return m_debugformat;
- }
+ const char *debugformat () const { return m_debugformat; }
void set_debugformat (const char *debugformat)
{
m_debugformat = debugformat;
}
- const char *producer () const
- {
- return m_producer;
- }
+ const char *producer () const { return m_producer; }
- void set_producer (const char *producer)
- {
- m_producer = producer;
- }
+ void set_producer (const char *producer) { m_producer = producer; }
- const char *dirname () const
- {
- return m_dirname;
- }
+ const char *dirname () const { return m_dirname; }
- void set_dirname (const char *dirname)
- {
- m_dirname = dirname;
- }
+ void set_dirname (const char *dirname) { m_dirname = dirname; }
- struct blockvector *blockvector ()
- {
- return m_blockvector;
- }
+ struct blockvector *blockvector () { return m_blockvector; }
- const struct blockvector *blockvector () const
- {
- return m_blockvector;
- }
+ const struct blockvector *blockvector () const { return m_blockvector; }
void set_blockvector (struct blockvector *blockvector)
{
m_blockvector = blockvector;
}
- bool locations_valid () const
- {
- return m_locations_valid;
- }
+ bool locations_valid () const { return m_locations_valid; }
void set_locations_valid (bool locations_valid)
{
m_locations_valid = locations_valid;
}
- bool epilogue_unwind_valid () const
- {
- return m_epilogue_unwind_valid;
- }
+ bool epilogue_unwind_valid () const { return m_epilogue_unwind_valid; }
void set_epilogue_unwind_valid (bool epilogue_unwind_valid)
{
m_epilogue_unwind_valid = epilogue_unwind_valid;
}
- struct macro_table *macro_table () const
- {
- return m_macro_table;
- }
+ struct macro_table *macro_table () const { return m_macro_table; }
void set_macro_table (struct macro_table *macro_table)
{
@@ -1917,7 +1756,6 @@ is_main_symtab_of_compunit_symtab (struct symtab *symtab)
{
return symtab == symtab->compunit ()->primary_filetab ();
}
-
/* The virtual function table is now an array of structures which have the
form { int16 offset, delta; void *pfn; }.
@@ -1947,8 +1785,7 @@ extern const char multiple_symbols_cancel[];
const char *multiple_symbols_select_mode (void);
bool symbol_matches_domain (enum language symbol_language,
- domain_enum symbol_domain,
- domain_enum domain);
+ domain_enum symbol_domain, domain_enum domain);
/* lookup a symbol table by source file name. */
@@ -1986,16 +1823,13 @@ struct field_of_this_result
The symbol's section is fixed up if necessary. */
extern struct block_symbol
- lookup_symbol_in_language (const char *,
- const struct block *,
- const domain_enum,
- enum language,
- struct field_of_this_result *);
+lookup_symbol_in_language (const char *, const struct block *,
+ const domain_enum, enum language,
+ struct field_of_this_result *);
/* Same as lookup_symbol_in_language, but using the current language. */
-extern struct block_symbol lookup_symbol (const char *,
- const struct block *,
+extern struct block_symbol lookup_symbol (const char *, const struct block *,
const domain_enum,
struct field_of_this_result *);
@@ -2008,9 +1842,9 @@ extern struct block_symbol lookup_symbol (const char *,
pointer, or NULL if no symbol is found. The symbol's section is
fixed up if necessary. */
-extern struct block_symbol lookup_symbol_search_name (const char *search_name,
- const struct block *block,
- domain_enum domain);
+extern struct block_symbol
+lookup_symbol_search_name (const char *search_name, const struct block *block,
+ domain_enum domain);
/* Some helper functions for languages that need to write their own
lookup_symbol_nonlocal functions. */
@@ -2020,9 +1854,8 @@ extern struct block_symbol lookup_symbol_search_name (const char *search_name,
Upon success fixes up the symbol's section if necessary. */
extern struct block_symbol
- lookup_symbol_in_static_block (const char *name,
- const struct block *block,
- const domain_enum domain);
+lookup_symbol_in_static_block (const char *name, const struct block *block,
+ const domain_enum domain);
/* Search all static file-level symbols for NAME from DOMAIN.
Upon success fixes up the symbol's section if necessary. */
@@ -2041,26 +1874,23 @@ extern struct block_symbol lookup_static_symbol (const char *name,
Upon success fixes up the symbol's section if necessary. */
-extern struct block_symbol
- lookup_global_symbol (const char *name,
- const struct block *block,
- const domain_enum domain);
+extern struct block_symbol lookup_global_symbol (const char *name,
+ const struct block *block,
+ const domain_enum domain);
/* Lookup a symbol in block BLOCK.
Upon success fixes up the symbol's section if necessary. */
extern struct symbol *
- lookup_symbol_in_block (const char *name,
- symbol_name_match_type match_type,
- const struct block *block,
- const domain_enum domain);
+lookup_symbol_in_block (const char *name, symbol_name_match_type match_type,
+ const struct block *block, const domain_enum domain);
/* Look up the `this' symbol for LANG in BLOCK. Return the symbol if
found, or NULL if not found. */
extern struct block_symbol
- lookup_language_this (const struct language_defn *lang,
- const struct block *block);
+lookup_language_this (const struct language_defn *lang,
+ const struct block *block);
/* Lookup a [struct, union, enum] by name, within a specified block. */
@@ -2088,8 +1918,8 @@ extern struct symbol *find_pc_sect_function (CORE_ADDR, struct obj_section *);
section. The return value will be the closest enclosing function,
which might be an inline function. */
-extern struct symbol *find_pc_sect_containing_function
- (CORE_ADDR pc, struct obj_section *section);
+extern struct symbol *
+find_pc_sect_containing_function (CORE_ADDR pc, struct obj_section *section);
/* Find the symbol at the given address. Returns NULL if no symbol
found. Only exact matches for ADDRESS are considered. */
@@ -2140,10 +1970,10 @@ extern bool find_pc_partial_function (CORE_ADDR pc, const char **name,
/* Like find_pc_partial_function, above, but returns the underlying
general_symbol_info (rather than the name) as an out parameter. */
-extern bool find_pc_partial_function_sym
- (CORE_ADDR pc, const general_symbol_info **sym,
- CORE_ADDR *address, CORE_ADDR *endaddr,
- const struct block **block = nullptr);
+extern bool
+find_pc_partial_function_sym (CORE_ADDR pc, const general_symbol_info **sym,
+ CORE_ADDR *address, CORE_ADDR *endaddr,
+ const struct block **block = nullptr);
/* Like find_pc_partial_function, above, but *ADDRESS and *ENDADDR are
set to start and end addresses of the range containing the entry pc.
@@ -2155,8 +1985,7 @@ extern bool find_pc_partial_function_sym
See comment for find_pc_partial_function, above, for further
explanation. */
-extern bool find_function_entry_range_from_pc (CORE_ADDR pc,
- const char **name,
+extern bool find_function_entry_range_from_pc (CORE_ADDR pc, const char **name,
CORE_ADDR *address,
CORE_ADDR *endaddr);
@@ -2187,7 +2016,7 @@ extern struct compunit_symtab *find_pc_compunit_symtab (CORE_ADDR);
/* lookup full symbol table by address and section. */
extern struct compunit_symtab *
- find_pc_sect_compunit_symtab (CORE_ADDR, struct obj_section *);
+find_pc_sect_compunit_symtab (CORE_ADDR, struct obj_section *);
extern bool find_pc_line_pc_range (CORE_ADDR, CORE_ADDR *, CORE_ADDR *);
@@ -2223,7 +2052,7 @@ struct gnu_ifunc_fns
/* See elf_gnu_ifunc_resolve_name for its real implementation. */
bool (*gnu_ifunc_resolve_name) (const char *function_name,
- CORE_ADDR *function_address_p);
+ CORE_ADDR *function_address_p);
/* See elf_gnu_ifunc_resolver_stop for its real implementation. */
void (*gnu_ifunc_resolver_stop) (code_breakpoint *b);
@@ -2272,8 +2101,6 @@ struct symtab_and_line
struct objfile *objfile = NULL;
};
-
-
/* Given a pc value, return line number it is in. Second arg nonzero means
if pc is on the boundary use the previous statement's line number. */
@@ -2304,37 +2131,31 @@ extern void clear_solib (void);
/* The reason we're calling into a completion match list collector
function. */
enum class complete_symbol_mode
- {
- /* Completing an expression. */
- EXPRESSION,
+{
+ /* Completing an expression. */
+ EXPRESSION,
- /* Completing a linespec. */
- LINESPEC,
- };
+ /* Completing a linespec. */
+ LINESPEC,
+};
+
+extern void default_collect_symbol_completion_matches_break_on (
+ completion_tracker &tracker, complete_symbol_mode mode,
+ symbol_name_match_type name_match_type, const char *text, const char *word,
+ const char *break_on, enum type_code code);
+extern void collect_symbol_completion_matches (
+ completion_tracker &tracker, complete_symbol_mode mode,
+ symbol_name_match_type name_match_type, const char *, const char *);
+extern void collect_symbol_completion_matches_type (
+ completion_tracker &tracker, const char *, const char *, enum type_code);
-extern void default_collect_symbol_completion_matches_break_on
- (completion_tracker &tracker,
- complete_symbol_mode mode,
- symbol_name_match_type name_match_type,
- const char *text, const char *word, const char *break_on,
- enum type_code code);
-extern void collect_symbol_completion_matches
- (completion_tracker &tracker,
- complete_symbol_mode mode,
- symbol_name_match_type name_match_type,
- const char *, const char *);
-extern void collect_symbol_completion_matches_type (completion_tracker &tracker,
- const char *, const char *,
- enum type_code);
-
-extern void collect_file_symbol_completion_matches
- (completion_tracker &tracker,
- complete_symbol_mode,
- symbol_name_match_type name_match_type,
- const char *, const char *, const char *);
-
-extern completion_list
- make_source_files_completion_list (const char *, const char *);
+extern void collect_file_symbol_completion_matches (
+ completion_tracker &tracker, complete_symbol_mode,
+ symbol_name_match_type name_match_type, const char *, const char *,
+ const char *);
+
+extern completion_list make_source_files_completion_list (const char *,
+ const char *);
/* Return whether SYM is a function/method, as opposed to a data symbol. */
@@ -2365,8 +2186,8 @@ extern struct symtab *find_line_symtab (struct symtab *, int, int *, bool *);
/* Given a function symbol SYM, find the symtab and line for the start
of the function. If FUNFIRSTLINE is true, we want the first line
of real code inside the function. */
-extern symtab_and_line find_function_start_sal (symbol *sym, bool
- funfirstline);
+extern symtab_and_line find_function_start_sal (symbol *sym,
+ bool funfirstline);
/* Same, but start with a function address/section instead of a
symbol. */
@@ -2385,8 +2206,7 @@ extern CORE_ADDR skip_prologue_using_sal (struct gdbarch *gdbarch,
or examining OBJFILE's sections. Note that SYM's current address
must not have any runtime offsets applied. */
-extern void fixup_symbol_section (struct symbol *sym,
- struct objfile *objfile);
+extern void fixup_symbol_section (struct symbol *sym, struct objfile *objfile);
/* If MSYMBOL is an text symbol, look for a function debug symbol with
the same address. Returns NULL if not found. This is necessary in
@@ -2418,7 +2238,7 @@ struct symbol_search
msymbol.objfile = objfile;
}
- bool operator< (const symbol_search &other) const
+ bool operator<(const symbol_search &other) const
{
return compare_search_syms (*this, other) < 0;
}
@@ -2496,6 +2316,7 @@ public:
std::vector<const char *> filenames;
private:
+
/* The kind of symbols are we searching for.
VARIABLES_DOMAIN - Search all symbols, excluding functions, type
names, and constants (enums).
@@ -2562,9 +2383,9 @@ typedef std::pair<symbol_search, symbol_search> module_symbol_search;
name of the module, REGEXP matches against the name of the symbol within
the module, and TYPE_REGEXP matches against the type of the symbol
within the module. */
-extern std::vector<module_symbol_search> search_module_symbols
- (const char *module_regexp, const char *regexp,
- const char *type_regexp, search_domain kind);
+extern std::vector<module_symbol_search>
+search_module_symbols (const char *module_regexp, const char *regexp,
+ const char *type_regexp, search_domain kind);
/* Convert a global or static symbol SYM (based on BLOCK, which should be
either GLOBAL_BLOCK or STATIC_BLOCK) into a string for use in 'info'
@@ -2589,10 +2410,9 @@ extern enum language main_language (void);
Upon success fixes up the symbol's section if necessary. */
extern struct block_symbol
- lookup_global_symbol_from_objfile (struct objfile *main_objfile,
- enum block_enum block_index,
- const char *name,
- const domain_enum domain);
+lookup_global_symbol_from_objfile (struct objfile *main_objfile,
+ enum block_enum block_index,
+ const char *name, const domain_enum domain);
/* Return 1 if the supplied producer string matches the ARM RealView
compiler (armcc). */
@@ -2602,14 +2422,16 @@ extern unsigned int symtab_create_debug;
/* Print a "symtab-create" debug statement. */
-#define symtab_create_debug_printf(fmt, ...) \
- debug_prefixed_printf_cond (symtab_create_debug >= 1, "symtab-create", fmt, ##__VA_ARGS__)
+#define symtab_create_debug_printf(fmt, ...) \
+ debug_prefixed_printf_cond (symtab_create_debug >= 1, "symtab-create", fmt, \
+ ##__VA_ARGS__)
/* Print a verbose "symtab-create" debug statement, only if
"set debug symtab-create" is set to 2 or higher. */
-#define symtab_create_debug_printf_v(fmt, ...) \
- debug_prefixed_printf_cond (symtab_create_debug >= 2, "symtab-create", fmt, ##__VA_ARGS__)
+#define symtab_create_debug_printf_v(fmt, ...) \
+ debug_prefixed_printf_cond (symtab_create_debug >= 2, "symtab-create", fmt, \
+ ##__VA_ARGS__)
extern unsigned int symbol_lookup_debug;
@@ -2631,13 +2453,13 @@ symbol_lookup_debug_enabled_v ()
/* Print a "symbol-lookup" debug statement if symbol_lookup_debug is >= 1. */
-#define symbol_lookup_debug_printf(fmt, ...) \
- debug_prefixed_printf_cond (symbol_lookup_debug_enabled (), \
+#define symbol_lookup_debug_printf(fmt, ...) \
+ debug_prefixed_printf_cond (symbol_lookup_debug_enabled (), \
"symbol-lookup", fmt, ##__VA_ARGS__)
/* Print a "symbol-lookup" debug statement if symbol_lookup_debug is >= 2. */
-#define symbol_lookup_debug_printf_v(fmt, ...) \
+#define symbol_lookup_debug_printf_v(fmt, ...) \
debug_prefixed_printf_cond (symbol_lookup_debug_enabled_v (), \
"symbol-lookup", fmt, ##__VA_ARGS__)
@@ -2654,8 +2476,7 @@ bool compare_filenames_for_search (const char *filename,
bool compare_glob_filenames_for_search (const char *filename,
const char *search_name);
-bool iterate_over_some_symtabs (const char *name,
- const char *real_path,
+bool iterate_over_some_symtabs (const char *name, const char *real_path,
struct compunit_symtab *first,
struct compunit_symtab *after_last,
gdb::function_view<bool (symtab *)> callback);
@@ -2663,9 +2484,9 @@ bool iterate_over_some_symtabs (const char *name,
void iterate_over_symtabs (const char *name,
gdb::function_view<bool (symtab *)> callback);
-
-std::vector<CORE_ADDR> find_pcs_for_symtab_line
- (struct symtab *symtab, int line, struct linetable_entry **best_entry);
+std::vector<CORE_ADDR>
+find_pcs_for_symtab_line (struct symtab *symtab, int line,
+ struct linetable_entry **best_entry);
/* Prototype for callbacks for LA_ITERATE_OVER_SYMBOLS. The callback
is called once per matching symbol SYM. The callback should return
@@ -2683,20 +2504,19 @@ typedef bool (symbol_found_callback_ftype) (struct block_symbol *bsym);
returns false. Otherwise, the search continues, and the function
eventually returns true. */
-bool iterate_over_symbols (const struct block *block,
- const lookup_name_info &name,
- const domain_enum domain,
- gdb::function_view<symbol_found_callback_ftype> callback);
+bool iterate_over_symbols (
+ const struct block *block, const lookup_name_info &name,
+ const domain_enum domain,
+ gdb::function_view<symbol_found_callback_ftype> callback);
/* Like iterate_over_symbols, but if all calls to CALLBACK return
true, then calls CALLBACK one additional time with a block_symbol
that has a valid block but a NULL symbol. */
-bool iterate_over_symbols_terminated
- (const struct block *block,
- const lookup_name_info &name,
- const domain_enum domain,
- gdb::function_view<symbol_found_callback_ftype> callback);
+bool iterate_over_symbols_terminated (
+ const struct block *block, const lookup_name_info &name,
+ const domain_enum domain,
+ gdb::function_view<symbol_found_callback_ftype> callback);
/* Storage type used by demangle_for_lookup. demangle_for_lookup
either returns a const char * pointer that points to either of the
@@ -2729,9 +2549,8 @@ private:
gdb::unique_xmalloc_ptr<char> m_malloc;
};
-const char *
- demangle_for_lookup (const char *name, enum language lang,
- demangle_result_storage &storage);
+const char *demangle_for_lookup (const char *name, enum language lang,
+ demangle_result_storage &storage);
/* Test to see if the symbol of language SYMBOL_LANGUAGE specified by
SYMNAME (which is already demangled for C++ symbols) matches
@@ -2739,8 +2558,7 @@ const char *
the current completion list and return true. Otherwise, return
false. */
bool completion_list_add_name (completion_tracker &tracker,
- language symbol_language,
- const char *symname,
+ language symbol_language, const char *symname,
const lookup_name_info &lookup_name,
const char *text, const char *word);
@@ -2749,16 +2567,15 @@ bool completion_list_add_name (completion_tracker &tracker,
class symbol_searcher
{
public:
+
/* Returns the symbols found for the search. */
- const std::vector<block_symbol> &
- matching_symbols () const
+ const std::vector<block_symbol> &matching_symbols () const
{
return m_symbols;
}
/* Returns the minimal symbols found for the search. */
- const std::vector<bound_minimal_symbol> &
- matching_msymbols () const
+ const std::vector<bound_minimal_symbol> &matching_msymbols () const
{
return m_minimal_symbols;
}
@@ -2780,8 +2597,9 @@ public:
}
private:
+
/* Matching debug symbols. */
- std::vector<block_symbol> m_symbols;
+ std::vector<block_symbol> m_symbols;
/* Matching non-debug symbols. */
std::vector<bound_minimal_symbol> m_minimal_symbols;
@@ -2842,8 +2660,7 @@ private:
Output is written to UIOUT in CLI or MI style as appropriate. */
-extern void info_sources_worker (struct ui_out *uiout,
- bool group_by_objfile,
+extern void info_sources_worker (struct ui_out *uiout, bool group_by_objfile,
const info_sources_filter &filter);
#endif /* !defined(SYMTAB_H) */
diff --git a/gdb/target-connection.c b/gdb/target-connection.c
index cbd4555b1fa..de9ec98f6ee 100644
--- a/gdb/target-connection.c
+++ b/gdb/target-connection.c
@@ -63,8 +63,7 @@ std::string
make_target_connection_string (process_stratum_target *t)
{
if (t->connection_string () != NULL)
- return string_printf ("%s %s", t->shortname (),
- t->connection_string ());
+ return string_printf ("%s %s", t->shortname (), t->connection_string ());
else
return t->shortname ();
}
@@ -98,7 +97,7 @@ print_connection (struct ui_out *uiout, const char *requested_connections)
if (count == 0)
{
- uiout->message (_("No connections.\n"));
+ uiout->message (_ ("No connections.\n"));
return;
}
@@ -155,8 +154,7 @@ void _initialize_target_connection ();
void
_initialize_target_connection ()
{
- add_info ("connections", info_connections_command,
- _("\
+ add_info ("connections", info_connections_command, _ ("\
Target connections in use.\n\
Shows the list of target connections currently in use."));
}
diff --git a/gdb/target-dcache.c b/gdb/target-dcache.c
index 13c2888e7ea..629d1cdc3e8 100644
--- a/gdb/target-dcache.c
+++ b/gdb/target-dcache.c
@@ -102,7 +102,7 @@ static void
show_stack_cache (struct ui_file *file, int from_tty,
struct cmd_list_element *c, const char *value)
{
- gdb_printf (file, _("Cache use for stack accesses is %s.\n"), value);
+ gdb_printf (file, _ ("Cache use for stack accesses is %s.\n"), value);
}
/* Return true if "stack cache" is enabled, otherwise, return false. */
@@ -142,7 +142,7 @@ static void
show_code_cache (struct ui_file *file, int from_tty,
struct cmd_list_element *c, const char *value)
{
- gdb_printf (file, _("Cache use for code accesses is %s.\n"), value);
+ gdb_printf (file, _ ("Cache use for code accesses is %s.\n"), value);
}
/* Return true if "code cache" is enabled, otherwise, return false. */
@@ -160,38 +160,40 @@ maint_flush_dcache_command (const char *command, int from_tty)
{
target_dcache_invalidate ();
if (from_tty)
- gdb_printf (_("The dcache was flushed.\n"));
+ gdb_printf (_ ("The dcache was flushed.\n"));
}
void _initialize_target_dcache ();
+
void
_initialize_target_dcache ()
{
add_setshow_boolean_cmd ("stack-cache", class_support,
- &stack_cache_enabled_1, _("\
-Set cache use for stack access."), _("\
-Show cache use for stack access."), _("\
+ &stack_cache_enabled_1, _ ("\
+Set cache use for stack access."),
+ _ ("\
+Show cache use for stack access."),
+ _ ("\
When on, use the target memory cache for all stack access, regardless of any\n\
configured memory regions. This improves remote performance significantly.\n\
By default, caching for stack access is on."),
- set_stack_cache,
- show_stack_cache,
- &setlist, &showlist);
-
- add_setshow_boolean_cmd ("code-cache", class_support,
- &code_cache_enabled_1, _("\
-Set cache use for code segment access."), _("\
-Show cache use for code segment access."), _("\
+ set_stack_cache, show_stack_cache, &setlist,
+ &showlist);
+
+ add_setshow_boolean_cmd ("code-cache", class_support, &code_cache_enabled_1,
+ _ ("\
+Set cache use for code segment access."),
+ _ ("\
+Show cache use for code segment access."),
+ _ ("\
When on, use the target memory cache for all code segment accesses,\n\
regardless of any configured memory regions. This improves remote\n\
performance significantly. By default, caching for code segment\n\
access is on."),
- set_code_cache,
- show_code_cache,
- &setlist, &showlist);
+ set_code_cache, show_code_cache, &setlist,
+ &showlist);
- add_cmd ("dcache", class_maintenance, maint_flush_dcache_command,
- _("\
+ add_cmd ("dcache", class_maintenance, maint_flush_dcache_command, _ ("\
Force gdb to flush its target memory data cache.\n\
\n\
The dcache caches all target memory accesses where possible, this\n\
diff --git a/gdb/target-debug.h b/gdb/target-debug.h
index acb01d47e7c..8dccb8d2113 100644
--- a/gdb/target-debug.h
+++ b/gdb/target-debug.h
@@ -38,73 +38,65 @@
more simply done there, and target_xfer_partial additionally
bypasses the debug target. */
-
/* Helper macro. */
-#define target_debug_do_print(E) \
- gdb_puts ((E), gdb_stdlog);
+#define target_debug_do_print(E) gdb_puts ((E), gdb_stdlog);
-#define target_debug_print_enum_target_object(X) \
+#define target_debug_print_enum_target_object(X) \
target_debug_do_print (plongest (X))
-#define target_debug_print_CORE_ADDR(X) \
+#define target_debug_print_CORE_ADDR(X) \
target_debug_do_print (core_addr_to_string (X))
-#define target_debug_print_const_char_p(X) \
+#define target_debug_print_const_char_p(X) \
target_debug_do_print (((X) ? (X) : "(null)"))
-#define target_debug_print_char_p(X) \
+#define target_debug_print_char_p(X) \
target_debug_do_print (((X) ? (X) : "(null)"))
-#define target_debug_print_int(X) \
- target_debug_do_print (plongest (X))
-#define target_debug_print_bool(X) \
+#define target_debug_print_int(X) target_debug_do_print (plongest (X))
+#define target_debug_print_bool(X) \
target_debug_do_print ((X) ? "true" : "false")
-#define target_debug_print_long(X) \
- target_debug_do_print (plongest (X))
-#define target_debug_print_enum_target_xfer_status(X) \
+#define target_debug_print_long(X) target_debug_do_print (plongest (X))
+#define target_debug_print_enum_target_xfer_status(X) \
target_debug_do_print (plongest (X))
-#define target_debug_print_enum_exec_direction_kind(X) \
+#define target_debug_print_enum_exec_direction_kind(X) \
target_debug_do_print (plongest (X))
-#define target_debug_print_enum_trace_find_type(X) \
+#define target_debug_print_enum_trace_find_type(X) \
target_debug_do_print (plongest (X))
-#define target_debug_print_enum_btrace_read_type(X) \
+#define target_debug_print_enum_btrace_read_type(X) \
target_debug_do_print (plongest (X))
#define target_debug_print_enum_btrace_error(X) \
target_debug_do_print (plongest (X))
-#define target_debug_print_ptid_t(X) \
+#define target_debug_print_ptid_t(X) \
target_debug_do_print (plongest (X.pid ()))
-#define target_debug_print_struct_gdbarch_p(X) \
+#define target_debug_print_struct_gdbarch_p(X) \
target_debug_do_print (gdbarch_bfd_arch_info (X)->printable_name)
-#define target_debug_print_const_gdb_byte_p(X) \
+#define target_debug_print_const_gdb_byte_p(X) \
target_debug_do_print (host_address_to_string (X))
-#define target_debug_print_gdb_byte_p(X) \
+#define target_debug_print_gdb_byte_p(X) \
target_debug_do_print (host_address_to_string (X))
-#define target_debug_print_const_gdb_byte_pp(X) \
+#define target_debug_print_const_gdb_byte_pp(X) \
target_debug_do_print (host_address_to_string (*(X)))
-#define target_debug_print_enum_gdb_signal(X) \
+#define target_debug_print_enum_gdb_signal(X) \
target_debug_do_print (gdb_signal_to_name (X))
-#define target_debug_print_ULONGEST(X) \
- target_debug_do_print (hex_string (X))
-#define target_debug_print_ULONGEST_p(X) \
+#define target_debug_print_ULONGEST(X) target_debug_do_print (hex_string (X))
+#define target_debug_print_ULONGEST_p(X) \
target_debug_do_print (hex_string (*(X)))
-#define target_debug_print_LONGEST(X) \
- target_debug_do_print (phex (X, 0))
-#define target_debug_print_LONGEST_p(X) \
- target_debug_do_print (phex (*(X), 0))
-#define target_debug_print_struct_address_space_p(X) \
+#define target_debug_print_LONGEST(X) target_debug_do_print (phex (X, 0))
+#define target_debug_print_LONGEST_p(X) target_debug_do_print (phex (*(X), 0))
+#define target_debug_print_struct_address_space_p(X) \
target_debug_do_print (plongest ((X)->num ()))
-#define target_debug_print_struct_bp_target_info_p(X) \
+#define target_debug_print_struct_bp_target_info_p(X) \
target_debug_do_print (core_addr_to_string ((X)->placed_address))
-#define target_debug_print_struct_expression_p(X) \
+#define target_debug_print_struct_expression_p(X) \
target_debug_do_print (host_address_to_string (X))
-#define target_debug_print_CORE_ADDR_p(X) \
+#define target_debug_print_CORE_ADDR_p(X) \
target_debug_do_print (core_addr_to_string (*(X)))
-#define target_debug_print_int_p(X) \
- target_debug_do_print (plongest (*(X)))
+#define target_debug_print_int_p(X) target_debug_do_print (plongest (*(X)))
#define target_debug_print_struct_regcache_p(X) \
target_debug_do_print (host_address_to_string (X))
-#define target_debug_print_struct_thread_info_p(X) \
+#define target_debug_print_struct_thread_info_p(X) \
target_debug_do_print (host_address_to_string (X))
-#define target_debug_print_struct_ui_file_p(X) \
+#define target_debug_print_struct_ui_file_p(X) \
target_debug_do_print (host_address_to_string (X))
-#define target_debug_print_const_target_section_table_p(X) \
+#define target_debug_print_const_target_section_table_p(X) \
target_debug_do_print (host_address_to_string (X))
#define target_debug_print_void_p(X) \
target_debug_do_print (host_address_to_string (X))
@@ -114,43 +106,42 @@
target_debug_do_print (host_address_to_string (X))
#define target_debug_print_std_vector_mem_region(X) \
target_debug_do_print (host_address_to_string (X.data ()))
-#define target_debug_print_std_vector_static_tracepoint_marker(X) \
+#define target_debug_print_std_vector_static_tracepoint_marker(X) \
target_debug_do_print (host_address_to_string (X.data ()))
-#define target_debug_print_const_struct_target_desc_p(X) \
+#define target_debug_print_const_struct_target_desc_p(X) \
target_debug_do_print (host_address_to_string (X))
-#define target_debug_print_struct_bp_location_p(X) \
+#define target_debug_print_struct_bp_location_p(X) \
target_debug_do_print (host_address_to_string (X))
-#define target_debug_print_const_trace_state_variable_r(X) \
+#define target_debug_print_const_trace_state_variable_r(X) \
target_debug_do_print (host_address_to_string (&X))
-#define target_debug_print_struct_trace_status_p(X) \
+#define target_debug_print_struct_trace_status_p(X) \
target_debug_do_print (host_address_to_string (X))
-#define target_debug_print_struct_breakpoint_p(X) \
+#define target_debug_print_struct_breakpoint_p(X) \
target_debug_do_print (host_address_to_string (X))
-#define target_debug_print_struct_uploaded_tp_p(X) \
+#define target_debug_print_struct_uploaded_tp_p(X) \
target_debug_do_print (host_address_to_string (X))
-#define target_debug_print_struct_uploaded_tp_pp(X) \
+#define target_debug_print_struct_uploaded_tp_pp(X) \
target_debug_do_print (host_address_to_string (X))
-#define target_debug_print_struct_uploaded_tsv_pp(X) \
+#define target_debug_print_struct_uploaded_tsv_pp(X) \
target_debug_do_print (host_address_to_string (X))
-#define target_debug_print_static_tracepoint_marker_p(X) \
+#define target_debug_print_static_tracepoint_marker_p(X) \
target_debug_do_print (host_address_to_string (X))
-#define target_debug_print_struct_btrace_target_info_p(X) \
+#define target_debug_print_struct_btrace_target_info_p(X) \
target_debug_do_print (host_address_to_string (X))
-#define target_debug_print_const_struct_frame_unwind_p(X) \
+#define target_debug_print_const_struct_frame_unwind_p(X) \
target_debug_do_print (host_address_to_string (X))
-#define target_debug_print_struct_btrace_data_p(X) \
+#define target_debug_print_struct_btrace_data_p(X) \
target_debug_do_print (host_address_to_string (X))
-#define target_debug_print_enum_record_method(X) \
+#define target_debug_print_enum_record_method(X) \
target_debug_do_print (plongest (X))
-#define target_debug_print_const_struct_btrace_config_p(X) \
+#define target_debug_print_const_struct_btrace_config_p(X) \
target_debug_do_print (host_address_to_string (X))
-#define target_debug_print_const_struct_btrace_target_info_p(X) \
+#define target_debug_print_const_struct_btrace_target_info_p(X) \
target_debug_do_print (host_address_to_string (X))
#define target_debug_print_enum_target_hw_bp_type(X) \
target_debug_do_print (plongest (X))
-#define target_debug_print_enum_bptype(X) \
- target_debug_do_print (plongest (X))
-#define target_debug_print_struct_inferior_p(X) \
+#define target_debug_print_enum_bptype(X) target_debug_do_print (plongest (X))
+#define target_debug_print_struct_inferior_p(X) \
target_debug_do_print (host_address_to_string (X))
#define target_debug_print_enum_remove_bp_reason(X) \
target_debug_do_print (plongest (X))
@@ -158,7 +149,7 @@
target_debug_do_print (plongest (X))
#define target_debug_print_traceframe_info_up(X) \
target_debug_do_print (host_address_to_string (X.get ()))
-#define target_debug_print_gdb_array_view_const_int(X) \
+#define target_debug_print_gdb_array_view_const_int(X) \
target_debug_do_print (host_address_to_string (X.data ()))
#define target_debug_print_inferior_p(inf) \
target_debug_do_print (host_address_to_string (inf))
@@ -166,11 +157,10 @@
target_debug_do_print (plongest (X))
#define target_debug_print_thread_control_capabilities(X) \
target_debug_do_print (plongest (X))
-#define target_debug_print_thread_info_p(X) \
+#define target_debug_print_thread_info_p(X) \
target_debug_do_print (host_address_to_string (X))
-#define target_debug_print_std_string(X) \
- target_debug_do_print ((X).c_str ())
-#define target_debug_print_gdb_byte_vector(X) \
+#define target_debug_print_std_string(X) target_debug_do_print ((X).c_str ())
+#define target_debug_print_gdb_byte_vector(X) \
target_debug_do_print (host_address_to_string (X.data ()))
#define target_debug_print_gdb_unique_xmalloc_ptr_char(X) \
target_debug_do_print (X.get ())
@@ -178,13 +168,12 @@
target_debug_do_print (pulongest (X))
static void
-target_debug_print_struct_target_waitstatus_p (struct target_waitstatus *status)
+target_debug_print_struct_target_waitstatus_p (
+ struct target_waitstatus *status)
{
gdb_puts (status->to_string ().c_str (), gdb_stdlog);
}
-
-
/* Macros or functions that are used via TARGET_DEBUG_PRINTER. */
#define target_debug_print_step(X) \
@@ -225,8 +214,7 @@ target_debug_print_const_gdb_byte_vector_r (const gdb::byte_vector &vector)
for (size_t i = 0; i < vector.size (); i++)
{
- gdb_printf (gdb_stdlog, " %s",
- phex_nz (vector[i], 1));
+ gdb_printf (gdb_stdlog, " %s", phex_nz (vector[i], 1));
}
gdb_puts (" }", gdb_stdlog);
}
diff --git a/gdb/target-delegates.c b/gdb/target-delegates.c
index ebbc5c8c13d..7269aa31da1 100644
--- a/gdb/target-delegates.c
+++ b/gdb/target-delegates.c
@@ -35,31 +35,42 @@ struct dummy_target : public target_ops
void disconnect (const char *arg0, int arg1) override;
void resume (ptid_t arg0, int arg1, enum gdb_signal arg2) override;
void commit_resumed () override;
- ptid_t wait (ptid_t arg0, struct target_waitstatus *arg1, target_wait_flags arg2) override;
+ ptid_t wait (ptid_t arg0, struct target_waitstatus *arg1,
+ target_wait_flags arg2) override;
void fetch_registers (struct regcache *arg0, int arg1) override;
void store_registers (struct regcache *arg0, int arg1) override;
void prepare_to_store (struct regcache *arg0) override;
void files_info () override;
- int insert_breakpoint (struct gdbarch *arg0, struct bp_target_info *arg1) override;
- int remove_breakpoint (struct gdbarch *arg0, struct bp_target_info *arg1, enum remove_bp_reason arg2) override;
+ int insert_breakpoint (struct gdbarch *arg0,
+ struct bp_target_info *arg1) override;
+ int remove_breakpoint (struct gdbarch *arg0, struct bp_target_info *arg1,
+ enum remove_bp_reason arg2) override;
bool stopped_by_sw_breakpoint () override;
bool supports_stopped_by_sw_breakpoint () override;
bool stopped_by_hw_breakpoint () override;
bool supports_stopped_by_hw_breakpoint () override;
int can_use_hw_breakpoint (enum bptype arg0, int arg1, int arg2) override;
int ranged_break_num_registers () override;
- int insert_hw_breakpoint (struct gdbarch *arg0, struct bp_target_info *arg1) override;
- int remove_hw_breakpoint (struct gdbarch *arg0, struct bp_target_info *arg1) override;
- int remove_watchpoint (CORE_ADDR arg0, int arg1, enum target_hw_bp_type arg2, struct expression *arg3) override;
- int insert_watchpoint (CORE_ADDR arg0, int arg1, enum target_hw_bp_type arg2, struct expression *arg3) override;
- int insert_mask_watchpoint (CORE_ADDR arg0, CORE_ADDR arg1, enum target_hw_bp_type arg2) override;
- int remove_mask_watchpoint (CORE_ADDR arg0, CORE_ADDR arg1, enum target_hw_bp_type arg2) override;
+ int insert_hw_breakpoint (struct gdbarch *arg0,
+ struct bp_target_info *arg1) override;
+ int remove_hw_breakpoint (struct gdbarch *arg0,
+ struct bp_target_info *arg1) override;
+ int remove_watchpoint (CORE_ADDR arg0, int arg1, enum target_hw_bp_type arg2,
+ struct expression *arg3) override;
+ int insert_watchpoint (CORE_ADDR arg0, int arg1, enum target_hw_bp_type arg2,
+ struct expression *arg3) override;
+ int insert_mask_watchpoint (CORE_ADDR arg0, CORE_ADDR arg1,
+ enum target_hw_bp_type arg2) override;
+ int remove_mask_watchpoint (CORE_ADDR arg0, CORE_ADDR arg1,
+ enum target_hw_bp_type arg2) override;
bool stopped_by_watchpoint () override;
bool have_steppable_watchpoint () override;
bool stopped_data_address (CORE_ADDR *arg0) override;
- bool watchpoint_addr_within_range (CORE_ADDR arg0, CORE_ADDR arg1, int arg2) override;
+ bool watchpoint_addr_within_range (CORE_ADDR arg0, CORE_ADDR arg1,
+ int arg2) override;
int region_ok_for_hw_watchpoint (CORE_ADDR arg0, int arg1) override;
- bool can_accel_watchpoint_condition (CORE_ADDR arg0, int arg1, int arg2, struct expression *arg3) override;
+ bool can_accel_watchpoint_condition (CORE_ADDR arg0, int arg1, int arg2,
+ struct expression *arg3) override;
int masked_watch_num_registers (CORE_ADDR arg0, CORE_ADDR arg1) override;
int can_do_single_step () override;
bool supports_terminal_ours () override;
@@ -75,11 +86,13 @@ struct dummy_target : public target_ops
int remove_fork_catchpoint (int arg0) override;
int insert_vfork_catchpoint (int arg0) override;
int remove_vfork_catchpoint (int arg0) override;
- void follow_fork (inferior *arg0, ptid_t arg1, target_waitkind arg2, bool arg3, bool arg4) override;
+ void follow_fork (inferior *arg0, ptid_t arg1, target_waitkind arg2,
+ bool arg3, bool arg4) override;
int insert_exec_catchpoint (int arg0) override;
int remove_exec_catchpoint (int arg0) override;
void follow_exec (inferior *arg0, ptid_t arg1, const char *arg2) override;
- int set_syscall_catchpoint (int arg0, bool arg1, int arg2, gdb::array_view<const int> arg3) override;
+ int set_syscall_catchpoint (int arg0, bool arg1, int arg2,
+ gdb::array_view<const int> arg3) override;
void mourn_inferior () override;
void pass_signals (gdb::array_view<const unsigned char> arg0) override;
void program_signals (gdb::array_view<const unsigned char> arg0) override;
@@ -88,8 +101,10 @@ struct dummy_target : public target_ops
std::string pid_to_str (ptid_t arg0) override;
const char *extra_thread_info (thread_info *arg0) override;
const char *thread_name (thread_info *arg0) override;
- thread_info *thread_handle_to_thread_info (const gdb_byte *arg0, int arg1, inferior *arg2) override;
- gdb::byte_vector thread_info_to_thread_handle (struct thread_info *arg0) override;
+ thread_info *thread_handle_to_thread_info (const gdb_byte *arg0, int arg1,
+ inferior *arg2) override;
+ gdb::byte_vector
+ thread_info_to_thread_handle (struct thread_info *arg0) override;
void stop (ptid_t arg0) override;
void interrupt () override;
void pass_ctrlc () override;
@@ -108,19 +123,27 @@ struct dummy_target : public target_ops
bool supports_non_stop () override;
bool always_non_stop_p () override;
int find_memory_regions (find_memory_region_ftype arg0, void *arg1) override;
- gdb::unique_xmalloc_ptr<char> make_corefile_notes (bfd *arg0, int *arg1) override;
+ gdb::unique_xmalloc_ptr<char> make_corefile_notes (bfd *arg0,
+ int *arg1) override;
gdb_byte *get_bookmark (const char *arg0, int arg1) override;
void goto_bookmark (const gdb_byte *arg0, int arg1) override;
- CORE_ADDR get_thread_local_address (ptid_t arg0, CORE_ADDR arg1, CORE_ADDR arg2) override;
- enum target_xfer_status xfer_partial (enum target_object arg0, const char *arg1, gdb_byte *arg2, const gdb_byte *arg3, ULONGEST arg4, ULONGEST arg5, ULONGEST *arg6) override;
+ CORE_ADDR get_thread_local_address (ptid_t arg0, CORE_ADDR arg1,
+ CORE_ADDR arg2) override;
+ enum target_xfer_status xfer_partial (enum target_object arg0,
+ const char *arg1, gdb_byte *arg2,
+ const gdb_byte *arg3, ULONGEST arg4,
+ ULONGEST arg5,
+ ULONGEST *arg6) override;
ULONGEST get_memory_xfer_limit () override;
std::vector<mem_region> memory_map () override;
void flash_erase (ULONGEST arg0, LONGEST arg1) override;
void flash_done () override;
const struct target_desc *read_description () override;
ptid_t get_ada_task_ptid (long arg0, ULONGEST arg1) override;
- int auxv_parse (const gdb_byte **arg0, const gdb_byte *arg1, CORE_ADDR *arg2, CORE_ADDR *arg3) override;
- int search_memory (CORE_ADDR arg0, ULONGEST arg1, const gdb_byte *arg2, ULONGEST arg3, CORE_ADDR *arg4) override;
+ int auxv_parse (const gdb_byte **arg0, const gdb_byte *arg1, CORE_ADDR *arg2,
+ CORE_ADDR *arg3) override;
+ int search_memory (CORE_ADDR arg0, ULONGEST arg1, const gdb_byte *arg2,
+ ULONGEST arg3, CORE_ADDR *arg4) override;
bool can_execute_reverse () override;
enum exec_direction_kind execution_direction () override;
bool supports_multi_process () override;
@@ -137,39 +160,51 @@ struct dummy_target : public target_ops
void trace_init () override;
void download_tracepoint (struct bp_location *arg0) override;
bool can_download_tracepoint () override;
- void download_trace_state_variable (const trace_state_variable &arg0) override;
+ void
+ download_trace_state_variable (const trace_state_variable &arg0) override;
void enable_tracepoint (struct bp_location *arg0) override;
void disable_tracepoint (struct bp_location *arg0) override;
void trace_set_readonly_regions () override;
void trace_start () override;
int get_trace_status (struct trace_status *arg0) override;
- void get_tracepoint_status (struct breakpoint *arg0, struct uploaded_tp *arg1) override;
+ void get_tracepoint_status (struct breakpoint *arg0,
+ struct uploaded_tp *arg1) override;
void trace_stop () override;
- int trace_find (enum trace_find_type arg0, int arg1, CORE_ADDR arg2, CORE_ADDR arg3, int *arg4) override;
+ int trace_find (enum trace_find_type arg0, int arg1, CORE_ADDR arg2,
+ CORE_ADDR arg3, int *arg4) override;
bool get_trace_state_variable_value (int arg0, LONGEST *arg1) override;
int save_trace_data (const char *arg0) override;
int upload_tracepoints (struct uploaded_tp **arg0) override;
int upload_trace_state_variables (struct uploaded_tsv **arg0) override;
- LONGEST get_raw_trace_data (gdb_byte *arg0, ULONGEST arg1, LONGEST arg2) override;
+ LONGEST get_raw_trace_data (gdb_byte *arg0, ULONGEST arg1,
+ LONGEST arg2) override;
int get_min_fast_tracepoint_insn_len () override;
void set_disconnected_tracing (int arg0) override;
void set_circular_trace_buffer (int arg0) override;
void set_trace_buffer_size (LONGEST arg0) override;
- bool set_trace_notes (const char *arg0, const char *arg1, const char *arg2) override;
+ bool set_trace_notes (const char *arg0, const char *arg1,
+ const char *arg2) override;
int core_of_thread (ptid_t arg0) override;
- int verify_memory (const gdb_byte *arg0, CORE_ADDR arg1, ULONGEST arg2) override;
+ int verify_memory (const gdb_byte *arg0, CORE_ADDR arg1,
+ ULONGEST arg2) override;
bool get_tib_address (ptid_t arg0, CORE_ADDR *arg1) override;
void set_permissions () override;
- bool static_tracepoint_marker_at (CORE_ADDR arg0, static_tracepoint_marker *arg1) override;
- std::vector<static_tracepoint_marker> static_tracepoint_markers_by_strid (const char *arg0) override;
+ bool static_tracepoint_marker_at (CORE_ADDR arg0,
+ static_tracepoint_marker *arg1) override;
+ std::vector<static_tracepoint_marker>
+ static_tracepoint_markers_by_strid (const char *arg0) override;
traceframe_info_up traceframe_info () override;
bool use_agent (bool arg0) override;
bool can_use_agent () override;
- struct btrace_target_info *enable_btrace (thread_info *arg0, const struct btrace_config *arg1) override;
+ struct btrace_target_info *
+ enable_btrace (thread_info *arg0, const struct btrace_config *arg1) override;
void disable_btrace (struct btrace_target_info *arg0) override;
void teardown_btrace (struct btrace_target_info *arg0) override;
- enum btrace_error read_btrace (struct btrace_data *arg0, struct btrace_target_info *arg1, enum btrace_read_type arg2) override;
- const struct btrace_config *btrace_conf (const struct btrace_target_info *arg0) override;
+ enum btrace_error read_btrace (struct btrace_data *arg0,
+ struct btrace_target_info *arg1,
+ enum btrace_read_type arg2) override;
+ const struct btrace_config *
+ btrace_conf (const struct btrace_target_info *arg0) override;
enum record_method record_method (ptid_t arg0) override;
void stop_recording () override;
void info_record () override;
@@ -183,19 +218,25 @@ struct dummy_target : public target_ops
void goto_record_end () override;
void goto_record (ULONGEST arg0) override;
void insn_history (int arg0, gdb_disassembly_flags arg1) override;
- void insn_history_from (ULONGEST arg0, int arg1, gdb_disassembly_flags arg2) override;
- void insn_history_range (ULONGEST arg0, ULONGEST arg1, gdb_disassembly_flags arg2) override;
+ void insn_history_from (ULONGEST arg0, int arg1,
+ gdb_disassembly_flags arg2) override;
+ void insn_history_range (ULONGEST arg0, ULONGEST arg1,
+ gdb_disassembly_flags arg2) override;
void call_history (int arg0, record_print_flags arg1) override;
- void call_history_from (ULONGEST arg0, int arg1, record_print_flags arg2) override;
- void call_history_range (ULONGEST arg0, ULONGEST arg1, record_print_flags arg2) override;
+ void call_history_from (ULONGEST arg0, int arg1,
+ record_print_flags arg2) override;
+ void call_history_range (ULONGEST arg0, ULONGEST arg1,
+ record_print_flags arg2) override;
bool augmented_libraries_svr4_read () override;
const struct frame_unwind *get_unwinder () override;
const struct frame_unwind *get_tailcall_unwinder () override;
void prepare_to_generate_core () override;
void done_generating_core () override;
bool supports_memory_tagging () override;
- bool fetch_memtags (CORE_ADDR arg0, size_t arg1, gdb::byte_vector &arg2, int arg3) override;
- bool store_memtags (CORE_ADDR arg0, size_t arg1, const gdb::byte_vector &arg2, int arg3) override;
+ bool fetch_memtags (CORE_ADDR arg0, size_t arg1, gdb::byte_vector &arg2,
+ int arg3) override;
+ bool store_memtags (CORE_ADDR arg0, size_t arg1,
+ const gdb::byte_vector &arg2, int arg3) override;
};
struct debug_target : public target_ops
@@ -209,31 +250,42 @@ struct debug_target : public target_ops
void disconnect (const char *arg0, int arg1) override;
void resume (ptid_t arg0, int arg1, enum gdb_signal arg2) override;
void commit_resumed () override;
- ptid_t wait (ptid_t arg0, struct target_waitstatus *arg1, target_wait_flags arg2) override;
+ ptid_t wait (ptid_t arg0, struct target_waitstatus *arg1,
+ target_wait_flags arg2) override;
void fetch_registers (struct regcache *arg0, int arg1) override;
void store_registers (struct regcache *arg0, int arg1) override;
void prepare_to_store (struct regcache *arg0) override;
void files_info () override;
- int insert_breakpoint (struct gdbarch *arg0, struct bp_target_info *arg1) override;
- int remove_breakpoint (struct gdbarch *arg0, struct bp_target_info *arg1, enum remove_bp_reason arg2) override;
+ int insert_breakpoint (struct gdbarch *arg0,
+ struct bp_target_info *arg1) override;
+ int remove_breakpoint (struct gdbarch *arg0, struct bp_target_info *arg1,
+ enum remove_bp_reason arg2) override;
bool stopped_by_sw_breakpoint () override;
bool supports_stopped_by_sw_breakpoint () override;
bool stopped_by_hw_breakpoint () override;
bool supports_stopped_by_hw_breakpoint () override;
int can_use_hw_breakpoint (enum bptype arg0, int arg1, int arg2) override;
int ranged_break_num_registers () override;
- int insert_hw_breakpoint (struct gdbarch *arg0, struct bp_target_info *arg1) override;
- int remove_hw_breakpoint (struct gdbarch *arg0, struct bp_target_info *arg1) override;
- int remove_watchpoint (CORE_ADDR arg0, int arg1, enum target_hw_bp_type arg2, struct expression *arg3) override;
- int insert_watchpoint (CORE_ADDR arg0, int arg1, enum target_hw_bp_type arg2, struct expression *arg3) override;
- int insert_mask_watchpoint (CORE_ADDR arg0, CORE_ADDR arg1, enum target_hw_bp_type arg2) override;
- int remove_mask_watchpoint (CORE_ADDR arg0, CORE_ADDR arg1, enum target_hw_bp_type arg2) override;
+ int insert_hw_breakpoint (struct gdbarch *arg0,
+ struct bp_target_info *arg1) override;
+ int remove_hw_breakpoint (struct gdbarch *arg0,
+ struct bp_target_info *arg1) override;
+ int remove_watchpoint (CORE_ADDR arg0, int arg1, enum target_hw_bp_type arg2,
+ struct expression *arg3) override;
+ int insert_watchpoint (CORE_ADDR arg0, int arg1, enum target_hw_bp_type arg2,
+ struct expression *arg3) override;
+ int insert_mask_watchpoint (CORE_ADDR arg0, CORE_ADDR arg1,
+ enum target_hw_bp_type arg2) override;
+ int remove_mask_watchpoint (CORE_ADDR arg0, CORE_ADDR arg1,
+ enum target_hw_bp_type arg2) override;
bool stopped_by_watchpoint () override;
bool have_steppable_watchpoint () override;
bool stopped_data_address (CORE_ADDR *arg0) override;
- bool watchpoint_addr_within_range (CORE_ADDR arg0, CORE_ADDR arg1, int arg2) override;
+ bool watchpoint_addr_within_range (CORE_ADDR arg0, CORE_ADDR arg1,
+ int arg2) override;
int region_ok_for_hw_watchpoint (CORE_ADDR arg0, int arg1) override;
- bool can_accel_watchpoint_condition (CORE_ADDR arg0, int arg1, int arg2, struct expression *arg3) override;
+ bool can_accel_watchpoint_condition (CORE_ADDR arg0, int arg1, int arg2,
+ struct expression *arg3) override;
int masked_watch_num_registers (CORE_ADDR arg0, CORE_ADDR arg1) override;
int can_do_single_step () override;
bool supports_terminal_ours () override;
@@ -249,11 +301,13 @@ struct debug_target : public target_ops
int remove_fork_catchpoint (int arg0) override;
int insert_vfork_catchpoint (int arg0) override;
int remove_vfork_catchpoint (int arg0) override;
- void follow_fork (inferior *arg0, ptid_t arg1, target_waitkind arg2, bool arg3, bool arg4) override;
+ void follow_fork (inferior *arg0, ptid_t arg1, target_waitkind arg2,
+ bool arg3, bool arg4) override;
int insert_exec_catchpoint (int arg0) override;
int remove_exec_catchpoint (int arg0) override;
void follow_exec (inferior *arg0, ptid_t arg1, const char *arg2) override;
- int set_syscall_catchpoint (int arg0, bool arg1, int arg2, gdb::array_view<const int> arg3) override;
+ int set_syscall_catchpoint (int arg0, bool arg1, int arg2,
+ gdb::array_view<const int> arg3) override;
void mourn_inferior () override;
void pass_signals (gdb::array_view<const unsigned char> arg0) override;
void program_signals (gdb::array_view<const unsigned char> arg0) override;
@@ -262,8 +316,10 @@ struct debug_target : public target_ops
std::string pid_to_str (ptid_t arg0) override;
const char *extra_thread_info (thread_info *arg0) override;
const char *thread_name (thread_info *arg0) override;
- thread_info *thread_handle_to_thread_info (const gdb_byte *arg0, int arg1, inferior *arg2) override;
- gdb::byte_vector thread_info_to_thread_handle (struct thread_info *arg0) override;
+ thread_info *thread_handle_to_thread_info (const gdb_byte *arg0, int arg1,
+ inferior *arg2) override;
+ gdb::byte_vector
+ thread_info_to_thread_handle (struct thread_info *arg0) override;
void stop (ptid_t arg0) override;
void interrupt () override;
void pass_ctrlc () override;
@@ -282,19 +338,27 @@ struct debug_target : public target_ops
bool supports_non_stop () override;
bool always_non_stop_p () override;
int find_memory_regions (find_memory_region_ftype arg0, void *arg1) override;
- gdb::unique_xmalloc_ptr<char> make_corefile_notes (bfd *arg0, int *arg1) override;
+ gdb::unique_xmalloc_ptr<char> make_corefile_notes (bfd *arg0,
+ int *arg1) override;
gdb_byte *get_bookmark (const char *arg0, int arg1) override;
void goto_bookmark (const gdb_byte *arg0, int arg1) override;
- CORE_ADDR get_thread_local_address (ptid_t arg0, CORE_ADDR arg1, CORE_ADDR arg2) override;
- enum target_xfer_status xfer_partial (enum target_object arg0, const char *arg1, gdb_byte *arg2, const gdb_byte *arg3, ULONGEST arg4, ULONGEST arg5, ULONGEST *arg6) override;
+ CORE_ADDR get_thread_local_address (ptid_t arg0, CORE_ADDR arg1,
+ CORE_ADDR arg2) override;
+ enum target_xfer_status xfer_partial (enum target_object arg0,
+ const char *arg1, gdb_byte *arg2,
+ const gdb_byte *arg3, ULONGEST arg4,
+ ULONGEST arg5,
+ ULONGEST *arg6) override;
ULONGEST get_memory_xfer_limit () override;
std::vector<mem_region> memory_map () override;
void flash_erase (ULONGEST arg0, LONGEST arg1) override;
void flash_done () override;
const struct target_desc *read_description () override;
ptid_t get_ada_task_ptid (long arg0, ULONGEST arg1) override;
- int auxv_parse (const gdb_byte **arg0, const gdb_byte *arg1, CORE_ADDR *arg2, CORE_ADDR *arg3) override;
- int search_memory (CORE_ADDR arg0, ULONGEST arg1, const gdb_byte *arg2, ULONGEST arg3, CORE_ADDR *arg4) override;
+ int auxv_parse (const gdb_byte **arg0, const gdb_byte *arg1, CORE_ADDR *arg2,
+ CORE_ADDR *arg3) override;
+ int search_memory (CORE_ADDR arg0, ULONGEST arg1, const gdb_byte *arg2,
+ ULONGEST arg3, CORE_ADDR *arg4) override;
bool can_execute_reverse () override;
enum exec_direction_kind execution_direction () override;
bool supports_multi_process () override;
@@ -311,39 +375,51 @@ struct debug_target : public target_ops
void trace_init () override;
void download_tracepoint (struct bp_location *arg0) override;
bool can_download_tracepoint () override;
- void download_trace_state_variable (const trace_state_variable &arg0) override;
+ void
+ download_trace_state_variable (const trace_state_variable &arg0) override;
void enable_tracepoint (struct bp_location *arg0) override;
void disable_tracepoint (struct bp_location *arg0) override;
void trace_set_readonly_regions () override;
void trace_start () override;
int get_trace_status (struct trace_status *arg0) override;
- void get_tracepoint_status (struct breakpoint *arg0, struct uploaded_tp *arg1) override;
+ void get_tracepoint_status (struct breakpoint *arg0,
+ struct uploaded_tp *arg1) override;
void trace_stop () override;
- int trace_find (enum trace_find_type arg0, int arg1, CORE_ADDR arg2, CORE_ADDR arg3, int *arg4) override;
+ int trace_find (enum trace_find_type arg0, int arg1, CORE_ADDR arg2,
+ CORE_ADDR arg3, int *arg4) override;
bool get_trace_state_variable_value (int arg0, LONGEST *arg1) override;
int save_trace_data (const char *arg0) override;
int upload_tracepoints (struct uploaded_tp **arg0) override;
int upload_trace_state_variables (struct uploaded_tsv **arg0) override;
- LONGEST get_raw_trace_data (gdb_byte *arg0, ULONGEST arg1, LONGEST arg2) override;
+ LONGEST get_raw_trace_data (gdb_byte *arg0, ULONGEST arg1,
+ LONGEST arg2) override;
int get_min_fast_tracepoint_insn_len () override;
void set_disconnected_tracing (int arg0) override;
void set_circular_trace_buffer (int arg0) override;
void set_trace_buffer_size (LONGEST arg0) override;
- bool set_trace_notes (const char *arg0, const char *arg1, const char *arg2) override;
+ bool set_trace_notes (const char *arg0, const char *arg1,
+ const char *arg2) override;
int core_of_thread (ptid_t arg0) override;
- int verify_memory (const gdb_byte *arg0, CORE_ADDR arg1, ULONGEST arg2) override;
+ int verify_memory (const gdb_byte *arg0, CORE_ADDR arg1,
+ ULONGEST arg2) override;
bool get_tib_address (ptid_t arg0, CORE_ADDR *arg1) override;
void set_permissions () override;
- bool static_tracepoint_marker_at (CORE_ADDR arg0, static_tracepoint_marker *arg1) override;
- std::vector<static_tracepoint_marker> static_tracepoint_markers_by_strid (const char *arg0) override;
+ bool static_tracepoint_marker_at (CORE_ADDR arg0,
+ static_tracepoint_marker *arg1) override;
+ std::vector<static_tracepoint_marker>
+ static_tracepoint_markers_by_strid (const char *arg0) override;
traceframe_info_up traceframe_info () override;
bool use_agent (bool arg0) override;
bool can_use_agent () override;
- struct btrace_target_info *enable_btrace (thread_info *arg0, const struct btrace_config *arg1) override;
+ struct btrace_target_info *
+ enable_btrace (thread_info *arg0, const struct btrace_config *arg1) override;
void disable_btrace (struct btrace_target_info *arg0) override;
void teardown_btrace (struct btrace_target_info *arg0) override;
- enum btrace_error read_btrace (struct btrace_data *arg0, struct btrace_target_info *arg1, enum btrace_read_type arg2) override;
- const struct btrace_config *btrace_conf (const struct btrace_target_info *arg0) override;
+ enum btrace_error read_btrace (struct btrace_data *arg0,
+ struct btrace_target_info *arg1,
+ enum btrace_read_type arg2) override;
+ const struct btrace_config *
+ btrace_conf (const struct btrace_target_info *arg0) override;
enum record_method record_method (ptid_t arg0) override;
void stop_recording () override;
void info_record () override;
@@ -357,19 +433,25 @@ struct debug_target : public target_ops
void goto_record_end () override;
void goto_record (ULONGEST arg0) override;
void insn_history (int arg0, gdb_disassembly_flags arg1) override;
- void insn_history_from (ULONGEST arg0, int arg1, gdb_disassembly_flags arg2) override;
- void insn_history_range (ULONGEST arg0, ULONGEST arg1, gdb_disassembly_flags arg2) override;
+ void insn_history_from (ULONGEST arg0, int arg1,
+ gdb_disassembly_flags arg2) override;
+ void insn_history_range (ULONGEST arg0, ULONGEST arg1,
+ gdb_disassembly_flags arg2) override;
void call_history (int arg0, record_print_flags arg1) override;
- void call_history_from (ULONGEST arg0, int arg1, record_print_flags arg2) override;
- void call_history_range (ULONGEST arg0, ULONGEST arg1, record_print_flags arg2) override;
+ void call_history_from (ULONGEST arg0, int arg1,
+ record_print_flags arg2) override;
+ void call_history_range (ULONGEST arg0, ULONGEST arg1,
+ record_print_flags arg2) override;
bool augmented_libraries_svr4_read () override;
const struct frame_unwind *get_unwinder () override;
const struct frame_unwind *get_tailcall_unwinder () override;
void prepare_to_generate_core () override;
void done_generating_core () override;
bool supports_memory_tagging () override;
- bool fetch_memtags (CORE_ADDR arg0, size_t arg1, gdb::byte_vector &arg2, int arg3) override;
- bool store_memtags (CORE_ADDR arg0, size_t arg1, const gdb::byte_vector &arg2, int arg3) override;
+ bool fetch_memtags (CORE_ADDR arg0, size_t arg1, gdb::byte_vector &arg2,
+ int arg3) override;
+ bool store_memtags (CORE_ADDR arg0, size_t arg1,
+ const gdb::byte_vector &arg2, int arg3) override;
};
void
@@ -386,9 +468,11 @@ dummy_target::post_attach (int arg0)
void
debug_target::post_attach (int arg0)
{
- gdb_printf (gdb_stdlog, "-> %s->post_attach (...)\n", this->beneath ()->shortname ());
+ gdb_printf (gdb_stdlog, "-> %s->post_attach (...)\n",
+ this->beneath ()->shortname ());
this->beneath ()->post_attach (arg0);
- gdb_printf (gdb_stdlog, "<- %s->post_attach (", this->beneath ()->shortname ());
+ gdb_printf (gdb_stdlog, "<- %s->post_attach (",
+ this->beneath ()->shortname ());
target_debug_print_int (arg0);
gdb_puts (")\n", gdb_stdlog);
}
@@ -407,7 +491,8 @@ dummy_target::detach (inferior *arg0, int arg1)
void
debug_target::detach (inferior *arg0, int arg1)
{
- gdb_printf (gdb_stdlog, "-> %s->detach (...)\n", this->beneath ()->shortname ());
+ gdb_printf (gdb_stdlog, "-> %s->detach (...)\n",
+ this->beneath ()->shortname ());
this->beneath ()->detach (arg0, arg1);
gdb_printf (gdb_stdlog, "<- %s->detach (", this->beneath ()->shortname ());
target_debug_print_inferior_p (arg0);
@@ -431,9 +516,11 @@ dummy_target::disconnect (const char *arg0, int arg1)
void
debug_target::disconnect (const char *arg0, int arg1)
{
- gdb_printf (gdb_stdlog, "-> %s->disconnect (...)\n", this->beneath ()->shortname ());
+ gdb_printf (gdb_stdlog, "-> %s->disconnect (...)\n",
+ this->beneath ()->shortname ());
this->beneath ()->disconnect (arg0, arg1);
- gdb_printf (gdb_stdlog, "<- %s->disconnect (", this->beneath ()->shortname ());
+ gdb_printf (gdb_stdlog, "<- %s->disconnect (",
+ this->beneath ()->shortname ());
target_debug_print_const_char_p (arg0);
gdb_puts (", ", gdb_stdlog);
target_debug_print_int (arg1);
@@ -455,7 +542,8 @@ dummy_target::resume (ptid_t arg0, int arg1, enum gdb_signal arg2)
void
debug_target::resume (ptid_t arg0, int arg1, enum gdb_signal arg2)
{
- gdb_printf (gdb_stdlog, "-> %s->resume (...)\n", this->beneath ()->shortname ());
+ gdb_printf (gdb_stdlog, "-> %s->resume (...)\n",
+ this->beneath ()->shortname ());
this->beneath ()->resume (arg0, arg1, arg2);
gdb_printf (gdb_stdlog, "<- %s->resume (", this->beneath ()->shortname ());
target_debug_print_ptid_t (arg0);
@@ -480,29 +568,35 @@ dummy_target::commit_resumed ()
void
debug_target::commit_resumed ()
{
- gdb_printf (gdb_stdlog, "-> %s->commit_resumed (...)\n", this->beneath ()->shortname ());
+ gdb_printf (gdb_stdlog, "-> %s->commit_resumed (...)\n",
+ this->beneath ()->shortname ());
this->beneath ()->commit_resumed ();
- gdb_printf (gdb_stdlog, "<- %s->commit_resumed (", this->beneath ()->shortname ());
+ gdb_printf (gdb_stdlog, "<- %s->commit_resumed (",
+ this->beneath ()->shortname ());
gdb_puts (")\n", gdb_stdlog);
}
ptid_t
-target_ops::wait (ptid_t arg0, struct target_waitstatus *arg1, target_wait_flags arg2)
+target_ops::wait (ptid_t arg0, struct target_waitstatus *arg1,
+ target_wait_flags arg2)
{
return this->beneath ()->wait (arg0, arg1, arg2);
}
ptid_t
-dummy_target::wait (ptid_t arg0, struct target_waitstatus *arg1, target_wait_flags arg2)
+dummy_target::wait (ptid_t arg0, struct target_waitstatus *arg1,
+ target_wait_flags arg2)
{
return default_target_wait (this, arg0, arg1, arg2);
}
ptid_t
-debug_target::wait (ptid_t arg0, struct target_waitstatus *arg1, target_wait_flags arg2)
+debug_target::wait (ptid_t arg0, struct target_waitstatus *arg1,
+ target_wait_flags arg2)
{
ptid_t result;
- gdb_printf (gdb_stdlog, "-> %s->wait (...)\n", this->beneath ()->shortname ());
+ gdb_printf (gdb_stdlog, "-> %s->wait (...)\n",
+ this->beneath ()->shortname ());
result = this->beneath ()->wait (arg0, arg1, arg2);
gdb_printf (gdb_stdlog, "<- %s->wait (", this->beneath ()->shortname ());
target_debug_print_ptid_t (arg0);
@@ -530,9 +624,11 @@ dummy_target::fetch_registers (struct regcache *arg0, int arg1)
void
debug_target::fetch_registers (struct regcache *arg0, int arg1)
{
- gdb_printf (gdb_stdlog, "-> %s->fetch_registers (...)\n", this->beneath ()->shortname ());
+ gdb_printf (gdb_stdlog, "-> %s->fetch_registers (...)\n",
+ this->beneath ()->shortname ());
this->beneath ()->fetch_registers (arg0, arg1);
- gdb_printf (gdb_stdlog, "<- %s->fetch_registers (", this->beneath ()->shortname ());
+ gdb_printf (gdb_stdlog, "<- %s->fetch_registers (",
+ this->beneath ()->shortname ());
target_debug_print_struct_regcache_p (arg0);
gdb_puts (", ", gdb_stdlog);
target_debug_print_int (arg1);
@@ -554,9 +650,11 @@ dummy_target::store_registers (struct regcache *arg0, int arg1)
void
debug_target::store_registers (struct regcache *arg0, int arg1)
{
- gdb_printf (gdb_stdlog, "-> %s->store_registers (...)\n", this->beneath ()->shortname ());
+ gdb_printf (gdb_stdlog, "-> %s->store_registers (...)\n",
+ this->beneath ()->shortname ());
this->beneath ()->store_registers (arg0, arg1);
- gdb_printf (gdb_stdlog, "<- %s->store_registers (", this->beneath ()->shortname ());
+ gdb_printf (gdb_stdlog, "<- %s->store_registers (",
+ this->beneath ()->shortname ());
target_debug_print_struct_regcache_p (arg0);
gdb_puts (", ", gdb_stdlog);
target_debug_print_int (arg1);
@@ -578,9 +676,11 @@ dummy_target::prepare_to_store (struct regcache *arg0)
void
debug_target::prepare_to_store (struct regcache *arg0)
{
- gdb_printf (gdb_stdlog, "-> %s->prepare_to_store (...)\n", this->beneath ()->shortname ());
+ gdb_printf (gdb_stdlog, "-> %s->prepare_to_store (...)\n",
+ this->beneath ()->shortname ());
this->beneath ()->prepare_to_store (arg0);
- gdb_printf (gdb_stdlog, "<- %s->prepare_to_store (", this->beneath ()->shortname ());
+ gdb_printf (gdb_stdlog, "<- %s->prepare_to_store (",
+ this->beneath ()->shortname ());
target_debug_print_struct_regcache_p (arg0);
gdb_puts (")\n", gdb_stdlog);
}
@@ -599,31 +699,38 @@ dummy_target::files_info ()
void
debug_target::files_info ()
{
- gdb_printf (gdb_stdlog, "-> %s->files_info (...)\n", this->beneath ()->shortname ());
+ gdb_printf (gdb_stdlog, "-> %s->files_info (...)\n",
+ this->beneath ()->shortname ());
this->beneath ()->files_info ();
- gdb_printf (gdb_stdlog, "<- %s->files_info (", this->beneath ()->shortname ());
+ gdb_printf (gdb_stdlog, "<- %s->files_info (",
+ this->beneath ()->shortname ());
gdb_puts (")\n", gdb_stdlog);
}
int
-target_ops::insert_breakpoint (struct gdbarch *arg0, struct bp_target_info *arg1)
+target_ops::insert_breakpoint (struct gdbarch *arg0,
+ struct bp_target_info *arg1)
{
return this->beneath ()->insert_breakpoint (arg0, arg1);
}
int
-dummy_target::insert_breakpoint (struct gdbarch *arg0, struct bp_target_info *arg1)
+dummy_target::insert_breakpoint (struct gdbarch *arg0,
+ struct bp_target_info *arg1)
{
noprocess ();
}
int
-debug_target::insert_breakpoint (struct gdbarch *arg0, struct bp_target_info *arg1)
+debug_target::insert_breakpoint (struct gdbarch *arg0,
+ struct bp_target_info *arg1)
{
int result;
- gdb_printf (gdb_stdlog, "-> %s->insert_breakpoint (...)\n", this->beneath ()->shortname ());
+ gdb_printf (gdb_stdlog, "-> %s->insert_breakpoint (...)\n",
+ this->beneath ()->shortname ());
result = this->beneath ()->insert_breakpoint (arg0, arg1);
- gdb_printf (gdb_stdlog, "<- %s->insert_breakpoint (", this->beneath ()->shortname ());
+ gdb_printf (gdb_stdlog, "<- %s->insert_breakpoint (",
+ this->beneath ()->shortname ());
target_debug_print_struct_gdbarch_p (arg0);
gdb_puts (", ", gdb_stdlog);
target_debug_print_struct_bp_target_info_p (arg1);
@@ -634,24 +741,32 @@ debug_target::insert_breakpoint (struct gdbarch *arg0, struct bp_target_info *ar
}
int
-target_ops::remove_breakpoint (struct gdbarch *arg0, struct bp_target_info *arg1, enum remove_bp_reason arg2)
+target_ops::remove_breakpoint (struct gdbarch *arg0,
+ struct bp_target_info *arg1,
+ enum remove_bp_reason arg2)
{
return this->beneath ()->remove_breakpoint (arg0, arg1, arg2);
}
int
-dummy_target::remove_breakpoint (struct gdbarch *arg0, struct bp_target_info *arg1, enum remove_bp_reason arg2)
+dummy_target::remove_breakpoint (struct gdbarch *arg0,
+ struct bp_target_info *arg1,
+ enum remove_bp_reason arg2)
{
noprocess ();
}
int
-debug_target::remove_breakpoint (struct gdbarch *arg0, struct bp_target_info *arg1, enum remove_bp_reason arg2)
+debug_target::remove_breakpoint (struct gdbarch *arg0,
+ struct bp_target_info *arg1,
+ enum remove_bp_reason arg2)
{
int result;
- gdb_printf (gdb_stdlog, "-> %s->remove_breakpoint (...)\n", this->beneath ()->shortname ());
+ gdb_printf (gdb_stdlog, "-> %s->remove_breakpoint (...)\n",
+ this->beneath ()->shortname ());
result = this->beneath ()->remove_breakpoint (arg0, arg1, arg2);
- gdb_printf (gdb_stdlog, "<- %s->remove_breakpoint (", this->beneath ()->shortname ());
+ gdb_printf (gdb_stdlog, "<- %s->remove_breakpoint (",
+ this->beneath ()->shortname ());
target_debug_print_struct_gdbarch_p (arg0);
gdb_puts (", ", gdb_stdlog);
target_debug_print_struct_bp_target_info_p (arg1);
@@ -679,9 +794,11 @@ bool
debug_target::stopped_by_sw_breakpoint ()
{
bool result;
- gdb_printf (gdb_stdlog, "-> %s->stopped_by_sw_breakpoint (...)\n", this->beneath ()->shortname ());
+ gdb_printf (gdb_stdlog, "-> %s->stopped_by_sw_breakpoint (...)\n",
+ this->beneath ()->shortname ());
result = this->beneath ()->stopped_by_sw_breakpoint ();
- gdb_printf (gdb_stdlog, "<- %s->stopped_by_sw_breakpoint (", this->beneath ()->shortname ());
+ gdb_printf (gdb_stdlog, "<- %s->stopped_by_sw_breakpoint (",
+ this->beneath ()->shortname ());
gdb_puts (") = ", gdb_stdlog);
target_debug_print_bool (result);
gdb_puts ("\n", gdb_stdlog);
@@ -704,9 +821,11 @@ bool
debug_target::supports_stopped_by_sw_breakpoint ()
{
bool result;
- gdb_printf (gdb_stdlog, "-> %s->supports_stopped_by_sw_breakpoint (...)\n", this->beneath ()->shortname ());
+ gdb_printf (gdb_stdlog, "-> %s->supports_stopped_by_sw_breakpoint (...)\n",
+ this->beneath ()->shortname ());
result = this->beneath ()->supports_stopped_by_sw_breakpoint ();
- gdb_printf (gdb_stdlog, "<- %s->supports_stopped_by_sw_breakpoint (", this->beneath ()->shortname ());
+ gdb_printf (gdb_stdlog, "<- %s->supports_stopped_by_sw_breakpoint (",
+ this->beneath ()->shortname ());
gdb_puts (") = ", gdb_stdlog);
target_debug_print_bool (result);
gdb_puts ("\n", gdb_stdlog);
@@ -729,9 +848,11 @@ bool
debug_target::stopped_by_hw_breakpoint ()
{
bool result;
- gdb_printf (gdb_stdlog, "-> %s->stopped_by_hw_breakpoint (...)\n", this->beneath ()->shortname ());
+ gdb_printf (gdb_stdlog, "-> %s->stopped_by_hw_breakpoint (...)\n",
+ this->beneath ()->shortname ());
result = this->beneath ()->stopped_by_hw_breakpoint ();
- gdb_printf (gdb_stdlog, "<- %s->stopped_by_hw_breakpoint (", this->beneath ()->shortname ());
+ gdb_printf (gdb_stdlog, "<- %s->stopped_by_hw_breakpoint (",
+ this->beneath ()->shortname ());
gdb_puts (") = ", gdb_stdlog);
target_debug_print_bool (result);
gdb_puts ("\n", gdb_stdlog);
@@ -754,9 +875,11 @@ bool
debug_target::supports_stopped_by_hw_breakpoint ()
{
bool result;
- gdb_printf (gdb_stdlog, "-> %s->supports_stopped_by_hw_breakpoint (...)\n", this->beneath ()->shortname ());
+ gdb_printf (gdb_stdlog, "-> %s->supports_stopped_by_hw_breakpoint (...)\n",
+ this->beneath ()->shortname ());
result = this->beneath ()->supports_stopped_by_hw_breakpoint ();
- gdb_printf (gdb_stdlog, "<- %s->supports_stopped_by_hw_breakpoint (", this->beneath ()->shortname ());
+ gdb_printf (gdb_stdlog, "<- %s->supports_stopped_by_hw_breakpoint (",
+ this->beneath ()->shortname ());
gdb_puts (") = ", gdb_stdlog);
target_debug_print_bool (result);
gdb_puts ("\n", gdb_stdlog);
@@ -779,9 +902,11 @@ int
debug_target::can_use_hw_breakpoint (enum bptype arg0, int arg1, int arg2)
{
int result;
- gdb_printf (gdb_stdlog, "-> %s->can_use_hw_breakpoint (...)\n", this->beneath ()->shortname ());
+ gdb_printf (gdb_stdlog, "-> %s->can_use_hw_breakpoint (...)\n",
+ this->beneath ()->shortname ());
result = this->beneath ()->can_use_hw_breakpoint (arg0, arg1, arg2);
- gdb_printf (gdb_stdlog, "<- %s->can_use_hw_breakpoint (", this->beneath ()->shortname ());
+ gdb_printf (gdb_stdlog, "<- %s->can_use_hw_breakpoint (",
+ this->beneath ()->shortname ());
target_debug_print_enum_bptype (arg0);
gdb_puts (", ", gdb_stdlog);
target_debug_print_int (arg1);
@@ -809,9 +934,11 @@ int
debug_target::ranged_break_num_registers ()
{
int result;
- gdb_printf (gdb_stdlog, "-> %s->ranged_break_num_registers (...)\n", this->beneath ()->shortname ());
+ gdb_printf (gdb_stdlog, "-> %s->ranged_break_num_registers (...)\n",
+ this->beneath ()->shortname ());
result = this->beneath ()->ranged_break_num_registers ();
- gdb_printf (gdb_stdlog, "<- %s->ranged_break_num_registers (", this->beneath ()->shortname ());
+ gdb_printf (gdb_stdlog, "<- %s->ranged_break_num_registers (",
+ this->beneath ()->shortname ());
gdb_puts (") = ", gdb_stdlog);
target_debug_print_int (result);
gdb_puts ("\n", gdb_stdlog);
@@ -819,24 +946,29 @@ debug_target::ranged_break_num_registers ()
}
int
-target_ops::insert_hw_breakpoint (struct gdbarch *arg0, struct bp_target_info *arg1)
+target_ops::insert_hw_breakpoint (struct gdbarch *arg0,
+ struct bp_target_info *arg1)
{
return this->beneath ()->insert_hw_breakpoint (arg0, arg1);
}
int
-dummy_target::insert_hw_breakpoint (struct gdbarch *arg0, struct bp_target_info *arg1)
+dummy_target::insert_hw_breakpoint (struct gdbarch *arg0,
+ struct bp_target_info *arg1)
{
return -1;
}
int
-debug_target::insert_hw_breakpoint (struct gdbarch *arg0, struct bp_target_info *arg1)
+debug_target::insert_hw_breakpoint (struct gdbarch *arg0,
+ struct bp_target_info *arg1)
{
int result;
- gdb_printf (gdb_stdlog, "-> %s->insert_hw_breakpoint (...)\n", this->beneath ()->shortname ());
+ gdb_printf (gdb_stdlog, "-> %s->insert_hw_breakpoint (...)\n",
+ this->beneath ()->shortname ());
result = this->beneath ()->insert_hw_breakpoint (arg0, arg1);
- gdb_printf (gdb_stdlog, "<- %s->insert_hw_breakpoint (", this->beneath ()->shortname ());
+ gdb_printf (gdb_stdlog, "<- %s->insert_hw_breakpoint (",
+ this->beneath ()->shortname ());
target_debug_print_struct_gdbarch_p (arg0);
gdb_puts (", ", gdb_stdlog);
target_debug_print_struct_bp_target_info_p (arg1);
@@ -847,24 +979,29 @@ debug_target::insert_hw_breakpoint (struct gdbarch *arg0, struct bp_target_info
}
int
-target_ops::remove_hw_breakpoint (struct gdbarch *arg0, struct bp_target_info *arg1)
+target_ops::remove_hw_breakpoint (struct gdbarch *arg0,
+ struct bp_target_info *arg1)
{
return this->beneath ()->remove_hw_breakpoint (arg0, arg1);
}
int
-dummy_target::remove_hw_breakpoint (struct gdbarch *arg0, struct bp_target_info *arg1)
+dummy_target::remove_hw_breakpoint (struct gdbarch *arg0,
+ struct bp_target_info *arg1)
{
return -1;
}
int
-debug_target::remove_hw_breakpoint (struct gdbarch *arg0, struct bp_target_info *arg1)
+debug_target::remove_hw_breakpoint (struct gdbarch *arg0,
+ struct bp_target_info *arg1)
{
int result;
- gdb_printf (gdb_stdlog, "-> %s->remove_hw_breakpoint (...)\n", this->beneath ()->shortname ());
+ gdb_printf (gdb_stdlog, "-> %s->remove_hw_breakpoint (...)\n",
+ this->beneath ()->shortname ());
result = this->beneath ()->remove_hw_breakpoint (arg0, arg1);
- gdb_printf (gdb_stdlog, "<- %s->remove_hw_breakpoint (", this->beneath ()->shortname ());
+ gdb_printf (gdb_stdlog, "<- %s->remove_hw_breakpoint (",
+ this->beneath ()->shortname ());
target_debug_print_struct_gdbarch_p (arg0);
gdb_puts (", ", gdb_stdlog);
target_debug_print_struct_bp_target_info_p (arg1);
@@ -875,24 +1012,32 @@ debug_target::remove_hw_breakpoint (struct gdbarch *arg0, struct bp_target_info
}
int
-target_ops::remove_watchpoint (CORE_ADDR arg0, int arg1, enum target_hw_bp_type arg2, struct expression *arg3)
+target_ops::remove_watchpoint (CORE_ADDR arg0, int arg1,
+ enum target_hw_bp_type arg2,
+ struct expression *arg3)
{
return this->beneath ()->remove_watchpoint (arg0, arg1, arg2, arg3);
}
int
-dummy_target::remove_watchpoint (CORE_ADDR arg0, int arg1, enum target_hw_bp_type arg2, struct expression *arg3)
+dummy_target::remove_watchpoint (CORE_ADDR arg0, int arg1,
+ enum target_hw_bp_type arg2,
+ struct expression *arg3)
{
return -1;
}
int
-debug_target::remove_watchpoint (CORE_ADDR arg0, int arg1, enum target_hw_bp_type arg2, struct expression *arg3)
+debug_target::remove_watchpoint (CORE_ADDR arg0, int arg1,
+ enum target_hw_bp_type arg2,
+ struct expression *arg3)
{
int result;
- gdb_printf (gdb_stdlog, "-> %s->remove_watchpoint (...)\n", this->beneath ()->shortname ());
+ gdb_printf (gdb_stdlog, "-> %s->remove_watchpoint (...)\n",
+ this->beneath ()->shortname ());
result = this->beneath ()->remove_watchpoint (arg0, arg1, arg2, arg3);
- gdb_printf (gdb_stdlog, "<- %s->remove_watchpoint (", this->beneath ()->shortname ());
+ gdb_printf (gdb_stdlog, "<- %s->remove_watchpoint (",
+ this->beneath ()->shortname ());
target_debug_print_CORE_ADDR (arg0);
gdb_puts (", ", gdb_stdlog);
target_debug_print_int (arg1);
@@ -907,24 +1052,32 @@ debug_target::remove_watchpoint (CORE_ADDR arg0, int arg1, enum target_hw_bp_typ
}
int
-target_ops::insert_watchpoint (CORE_ADDR arg0, int arg1, enum target_hw_bp_type arg2, struct expression *arg3)
+target_ops::insert_watchpoint (CORE_ADDR arg0, int arg1,
+ enum target_hw_bp_type arg2,
+ struct expression *arg3)
{
return this->beneath ()->insert_watchpoint (arg0, arg1, arg2, arg3);
}
int
-dummy_target::insert_watchpoint (CORE_ADDR arg0, int arg1, enum target_hw_bp_type arg2, struct expression *arg3)
+dummy_target::insert_watchpoint (CORE_ADDR arg0, int arg1,
+ enum target_hw_bp_type arg2,
+ struct expression *arg3)
{
return -1;
}
int
-debug_target::insert_watchpoint (CORE_ADDR arg0, int arg1, enum target_hw_bp_type arg2, struct expression *arg3)
+debug_target::insert_watchpoint (CORE_ADDR arg0, int arg1,
+ enum target_hw_bp_type arg2,
+ struct expression *arg3)
{
int result;
- gdb_printf (gdb_stdlog, "-> %s->insert_watchpoint (...)\n", this->beneath ()->shortname ());
+ gdb_printf (gdb_stdlog, "-> %s->insert_watchpoint (...)\n",
+ this->beneath ()->shortname ());
result = this->beneath ()->insert_watchpoint (arg0, arg1, arg2, arg3);
- gdb_printf (gdb_stdlog, "<- %s->insert_watchpoint (", this->beneath ()->shortname ());
+ gdb_printf (gdb_stdlog, "<- %s->insert_watchpoint (",
+ this->beneath ()->shortname ());
target_debug_print_CORE_ADDR (arg0);
gdb_puts (", ", gdb_stdlog);
target_debug_print_int (arg1);
@@ -939,24 +1092,29 @@ debug_target::insert_watchpoint (CORE_ADDR arg0, int arg1, enum target_hw_bp_typ
}
int
-target_ops::insert_mask_watchpoint (CORE_ADDR arg0, CORE_ADDR arg1, enum target_hw_bp_type arg2)
+target_ops::insert_mask_watchpoint (CORE_ADDR arg0, CORE_ADDR arg1,
+ enum target_hw_bp_type arg2)
{
return this->beneath ()->insert_mask_watchpoint (arg0, arg1, arg2);
}
int
-dummy_target::insert_mask_watchpoint (CORE_ADDR arg0, CORE_ADDR arg1, enum target_hw_bp_type arg2)
+dummy_target::insert_mask_watchpoint (CORE_ADDR arg0, CORE_ADDR arg1,
+ enum target_hw_bp_type arg2)
{
return 1;
}
int
-debug_target::insert_mask_watchpoint (CORE_ADDR arg0, CORE_ADDR arg1, enum target_hw_bp_type arg2)
+debug_target::insert_mask_watchpoint (CORE_ADDR arg0, CORE_ADDR arg1,
+ enum target_hw_bp_type arg2)
{
int result;
- gdb_printf (gdb_stdlog, "-> %s->insert_mask_watchpoint (...)\n", this->beneath ()->shortname ());
+ gdb_printf (gdb_stdlog, "-> %s->insert_mask_watchpoint (...)\n",
+ this->beneath ()->shortname ());
result = this->beneath ()->insert_mask_watchpoint (arg0, arg1, arg2);
- gdb_printf (gdb_stdlog, "<- %s->insert_mask_watchpoint (", this->beneath ()->shortname ());
+ gdb_printf (gdb_stdlog, "<- %s->insert_mask_watchpoint (",
+ this->beneath ()->shortname ());
target_debug_print_CORE_ADDR (arg0);
gdb_puts (", ", gdb_stdlog);
target_debug_print_CORE_ADDR (arg1);
@@ -969,24 +1127,29 @@ debug_target::insert_mask_watchpoint (CORE_ADDR arg0, CORE_ADDR arg1, enum targe
}
int
-target_ops::remove_mask_watchpoint (CORE_ADDR arg0, CORE_ADDR arg1, enum target_hw_bp_type arg2)
+target_ops::remove_mask_watchpoint (CORE_ADDR arg0, CORE_ADDR arg1,
+ enum target_hw_bp_type arg2)
{
return this->beneath ()->remove_mask_watchpoint (arg0, arg1, arg2);
}
int
-dummy_target::remove_mask_watchpoint (CORE_ADDR arg0, CORE_ADDR arg1, enum target_hw_bp_type arg2)
+dummy_target::remove_mask_watchpoint (CORE_ADDR arg0, CORE_ADDR arg1,
+ enum target_hw_bp_type arg2)
{
return 1;
}
int
-debug_target::remove_mask_watchpoint (CORE_ADDR arg0, CORE_ADDR arg1, enum target_hw_bp_type arg2)
+debug_target::remove_mask_watchpoint (CORE_ADDR arg0, CORE_ADDR arg1,
+ enum target_hw_bp_type arg2)
{
int result;
- gdb_printf (gdb_stdlog, "-> %s->remove_mask_watchpoint (...)\n", this->beneath ()->shortname ());
+ gdb_printf (gdb_stdlog, "-> %s->remove_mask_watchpoint (...)\n",
+ this->beneath ()->shortname ());
result = this->beneath ()->remove_mask_watchpoint (arg0, arg1, arg2);
- gdb_printf (gdb_stdlog, "<- %s->remove_mask_watchpoint (", this->beneath ()->shortname ());
+ gdb_printf (gdb_stdlog, "<- %s->remove_mask_watchpoint (",
+ this->beneath ()->shortname ());
target_debug_print_CORE_ADDR (arg0);
gdb_puts (", ", gdb_stdlog);
target_debug_print_CORE_ADDR (arg1);
@@ -1014,9 +1177,11 @@ bool
debug_target::stopped_by_watchpoint ()
{
bool result;
- gdb_printf (gdb_stdlog, "-> %s->stopped_by_watchpoint (...)\n", this->beneath ()->shortname ());
+ gdb_printf (gdb_stdlog, "-> %s->stopped_by_watchpoint (...)\n",
+ this->beneath ()->shortname ());
result = this->beneath ()->stopped_by_watchpoint ();
- gdb_printf (gdb_stdlog, "<- %s->stopped_by_watchpoint (", this->beneath ()->shortname ());
+ gdb_printf (gdb_stdlog, "<- %s->stopped_by_watchpoint (",
+ this->beneath ()->shortname ());
gdb_puts (") = ", gdb_stdlog);
target_debug_print_bool (result);
gdb_puts ("\n", gdb_stdlog);
@@ -1039,9 +1204,11 @@ bool
debug_target::have_steppable_watchpoint ()
{
bool result;
- gdb_printf (gdb_stdlog, "-> %s->have_steppable_watchpoint (...)\n", this->beneath ()->shortname ());
+ gdb_printf (gdb_stdlog, "-> %s->have_steppable_watchpoint (...)\n",
+ this->beneath ()->shortname ());
result = this->beneath ()->have_steppable_watchpoint ();
- gdb_printf (gdb_stdlog, "<- %s->have_steppable_watchpoint (", this->beneath ()->shortname ());
+ gdb_printf (gdb_stdlog, "<- %s->have_steppable_watchpoint (",
+ this->beneath ()->shortname ());
gdb_puts (") = ", gdb_stdlog);
target_debug_print_bool (result);
gdb_puts ("\n", gdb_stdlog);
@@ -1064,9 +1231,11 @@ bool
debug_target::stopped_data_address (CORE_ADDR *arg0)
{
bool result;
- gdb_printf (gdb_stdlog, "-> %s->stopped_data_address (...)\n", this->beneath ()->shortname ());
+ gdb_printf (gdb_stdlog, "-> %s->stopped_data_address (...)\n",
+ this->beneath ()->shortname ());
result = this->beneath ()->stopped_data_address (arg0);
- gdb_printf (gdb_stdlog, "<- %s->stopped_data_address (", this->beneath ()->shortname ());
+ gdb_printf (gdb_stdlog, "<- %s->stopped_data_address (",
+ this->beneath ()->shortname ());
target_debug_print_CORE_ADDR_p (arg0);
gdb_puts (") = ", gdb_stdlog);
target_debug_print_bool (result);
@@ -1075,24 +1244,29 @@ debug_target::stopped_data_address (CORE_ADDR *arg0)
}
bool
-target_ops::watchpoint_addr_within_range (CORE_ADDR arg0, CORE_ADDR arg1, int arg2)
+target_ops::watchpoint_addr_within_range (CORE_ADDR arg0, CORE_ADDR arg1,
+ int arg2)
{
return this->beneath ()->watchpoint_addr_within_range (arg0, arg1, arg2);
}
bool
-dummy_target::watchpoint_addr_within_range (CORE_ADDR arg0, CORE_ADDR arg1, int arg2)
+dummy_target::watchpoint_addr_within_range (CORE_ADDR arg0, CORE_ADDR arg1,
+ int arg2)
{
return default_watchpoint_addr_within_range (this, arg0, arg1, arg2);
}
bool
-debug_target::watchpoint_addr_within_range (CORE_ADDR arg0, CORE_ADDR arg1, int arg2)
+debug_target::watchpoint_addr_within_range (CORE_ADDR arg0, CORE_ADDR arg1,
+ int arg2)
{
bool result;
- gdb_printf (gdb_stdlog, "-> %s->watchpoint_addr_within_range (...)\n", this->beneath ()->shortname ());
+ gdb_printf (gdb_stdlog, "-> %s->watchpoint_addr_within_range (...)\n",
+ this->beneath ()->shortname ());
result = this->beneath ()->watchpoint_addr_within_range (arg0, arg1, arg2);
- gdb_printf (gdb_stdlog, "<- %s->watchpoint_addr_within_range (", this->beneath ()->shortname ());
+ gdb_printf (gdb_stdlog, "<- %s->watchpoint_addr_within_range (",
+ this->beneath ()->shortname ());
target_debug_print_CORE_ADDR (arg0);
gdb_puts (", ", gdb_stdlog);
target_debug_print_CORE_ADDR (arg1);
@@ -1120,9 +1294,11 @@ int
debug_target::region_ok_for_hw_watchpoint (CORE_ADDR arg0, int arg1)
{
int result;
- gdb_printf (gdb_stdlog, "-> %s->region_ok_for_hw_watchpoint (...)\n", this->beneath ()->shortname ());
+ gdb_printf (gdb_stdlog, "-> %s->region_ok_for_hw_watchpoint (...)\n",
+ this->beneath ()->shortname ());
result = this->beneath ()->region_ok_for_hw_watchpoint (arg0, arg1);
- gdb_printf (gdb_stdlog, "<- %s->region_ok_for_hw_watchpoint (", this->beneath ()->shortname ());
+ gdb_printf (gdb_stdlog, "<- %s->region_ok_for_hw_watchpoint (",
+ this->beneath ()->shortname ());
target_debug_print_CORE_ADDR (arg0);
gdb_puts (", ", gdb_stdlog);
target_debug_print_int (arg1);
@@ -1133,24 +1309,33 @@ debug_target::region_ok_for_hw_watchpoint (CORE_ADDR arg0, int arg1)
}
bool
-target_ops::can_accel_watchpoint_condition (CORE_ADDR arg0, int arg1, int arg2, struct expression *arg3)
+target_ops::can_accel_watchpoint_condition (CORE_ADDR arg0, int arg1, int arg2,
+ struct expression *arg3)
{
- return this->beneath ()->can_accel_watchpoint_condition (arg0, arg1, arg2, arg3);
+ return this->beneath ()->can_accel_watchpoint_condition (arg0, arg1, arg2,
+ arg3);
}
bool
-dummy_target::can_accel_watchpoint_condition (CORE_ADDR arg0, int arg1, int arg2, struct expression *arg3)
+dummy_target::can_accel_watchpoint_condition (CORE_ADDR arg0, int arg1,
+ int arg2,
+ struct expression *arg3)
{
return false;
}
bool
-debug_target::can_accel_watchpoint_condition (CORE_ADDR arg0, int arg1, int arg2, struct expression *arg3)
+debug_target::can_accel_watchpoint_condition (CORE_ADDR arg0, int arg1,
+ int arg2,
+ struct expression *arg3)
{
bool result;
- gdb_printf (gdb_stdlog, "-> %s->can_accel_watchpoint_condition (...)\n", this->beneath ()->shortname ());
- result = this->beneath ()->can_accel_watchpoint_condition (arg0, arg1, arg2, arg3);
- gdb_printf (gdb_stdlog, "<- %s->can_accel_watchpoint_condition (", this->beneath ()->shortname ());
+ gdb_printf (gdb_stdlog, "-> %s->can_accel_watchpoint_condition (...)\n",
+ this->beneath ()->shortname ());
+ result = this->beneath ()->can_accel_watchpoint_condition (arg0, arg1, arg2,
+ arg3);
+ gdb_printf (gdb_stdlog, "<- %s->can_accel_watchpoint_condition (",
+ this->beneath ()->shortname ());
target_debug_print_CORE_ADDR (arg0);
gdb_puts (", ", gdb_stdlog);
target_debug_print_int (arg1);
@@ -1180,9 +1365,11 @@ int
debug_target::masked_watch_num_registers (CORE_ADDR arg0, CORE_ADDR arg1)
{
int result;
- gdb_printf (gdb_stdlog, "-> %s->masked_watch_num_registers (...)\n", this->beneath ()->shortname ());
+ gdb_printf (gdb_stdlog, "-> %s->masked_watch_num_registers (...)\n",
+ this->beneath ()->shortname ());
result = this->beneath ()->masked_watch_num_registers (arg0, arg1);
- gdb_printf (gdb_stdlog, "<- %s->masked_watch_num_registers (", this->beneath ()->shortname ());
+ gdb_printf (gdb_stdlog, "<- %s->masked_watch_num_registers (",
+ this->beneath ()->shortname ());
target_debug_print_CORE_ADDR (arg0);
gdb_puts (", ", gdb_stdlog);
target_debug_print_CORE_ADDR (arg1);
@@ -1208,9 +1395,11 @@ int
debug_target::can_do_single_step ()
{
int result;
- gdb_printf (gdb_stdlog, "-> %s->can_do_single_step (...)\n", this->beneath ()->shortname ());
+ gdb_printf (gdb_stdlog, "-> %s->can_do_single_step (...)\n",
+ this->beneath ()->shortname ());
result = this->beneath ()->can_do_single_step ();
- gdb_printf (gdb_stdlog, "<- %s->can_do_single_step (", this->beneath ()->shortname ());
+ gdb_printf (gdb_stdlog, "<- %s->can_do_single_step (",
+ this->beneath ()->shortname ());
gdb_puts (") = ", gdb_stdlog);
target_debug_print_int (result);
gdb_puts ("\n", gdb_stdlog);
@@ -1233,9 +1422,11 @@ bool
debug_target::supports_terminal_ours ()
{
bool result;
- gdb_printf (gdb_stdlog, "-> %s->supports_terminal_ours (...)\n", this->beneath ()->shortname ());
+ gdb_printf (gdb_stdlog, "-> %s->supports_terminal_ours (...)\n",
+ this->beneath ()->shortname ());
result = this->beneath ()->supports_terminal_ours ();
- gdb_printf (gdb_stdlog, "<- %s->supports_terminal_ours (", this->beneath ()->shortname ());
+ gdb_printf (gdb_stdlog, "<- %s->supports_terminal_ours (",
+ this->beneath ()->shortname ());
gdb_puts (") = ", gdb_stdlog);
target_debug_print_bool (result);
gdb_puts ("\n", gdb_stdlog);
@@ -1256,9 +1447,11 @@ dummy_target::terminal_init ()
void
debug_target::terminal_init ()
{
- gdb_printf (gdb_stdlog, "-> %s->terminal_init (...)\n", this->beneath ()->shortname ());
+ gdb_printf (gdb_stdlog, "-> %s->terminal_init (...)\n",
+ this->beneath ()->shortname ());
this->beneath ()->terminal_init ();
- gdb_printf (gdb_stdlog, "<- %s->terminal_init (", this->beneath ()->shortname ());
+ gdb_printf (gdb_stdlog, "<- %s->terminal_init (",
+ this->beneath ()->shortname ());
gdb_puts (")\n", gdb_stdlog);
}
@@ -1276,9 +1469,11 @@ dummy_target::terminal_inferior ()
void
debug_target::terminal_inferior ()
{
- gdb_printf (gdb_stdlog, "-> %s->terminal_inferior (...)\n", this->beneath ()->shortname ());
+ gdb_printf (gdb_stdlog, "-> %s->terminal_inferior (...)\n",
+ this->beneath ()->shortname ());
this->beneath ()->terminal_inferior ();
- gdb_printf (gdb_stdlog, "<- %s->terminal_inferior (", this->beneath ()->shortname ());
+ gdb_printf (gdb_stdlog, "<- %s->terminal_inferior (",
+ this->beneath ()->shortname ());
gdb_puts (")\n", gdb_stdlog);
}
@@ -1296,9 +1491,11 @@ dummy_target::terminal_save_inferior ()
void
debug_target::terminal_save_inferior ()
{
- gdb_printf (gdb_stdlog, "-> %s->terminal_save_inferior (...)\n", this->beneath ()->shortname ());
+ gdb_printf (gdb_stdlog, "-> %s->terminal_save_inferior (...)\n",
+ this->beneath ()->shortname ());
this->beneath ()->terminal_save_inferior ();
- gdb_printf (gdb_stdlog, "<- %s->terminal_save_inferior (", this->beneath ()->shortname ());
+ gdb_printf (gdb_stdlog, "<- %s->terminal_save_inferior (",
+ this->beneath ()->shortname ());
gdb_puts (")\n", gdb_stdlog);
}
@@ -1316,9 +1513,11 @@ dummy_target::terminal_ours_for_output ()
void
debug_target::terminal_ours_for_output ()
{
- gdb_printf (gdb_stdlog, "-> %s->terminal_ours_for_output (...)\n", this->beneath ()->shortname ());
+ gdb_printf (gdb_stdlog, "-> %s->terminal_ours_for_output (...)\n",
+ this->beneath ()->shortname ());
this->beneath ()->terminal_ours_for_output ();
- gdb_printf (gdb_stdlog, "<- %s->terminal_ours_for_output (", this->beneath ()->shortname ());
+ gdb_printf (gdb_stdlog, "<- %s->terminal_ours_for_output (",
+ this->beneath ()->shortname ());
gdb_puts (")\n", gdb_stdlog);
}
@@ -1336,9 +1535,11 @@ dummy_target::terminal_ours ()
void
debug_target::terminal_ours ()
{
- gdb_printf (gdb_stdlog, "-> %s->terminal_ours (...)\n", this->beneath ()->shortname ());
+ gdb_printf (gdb_stdlog, "-> %s->terminal_ours (...)\n",
+ this->beneath ()->shortname ());
this->beneath ()->terminal_ours ();
- gdb_printf (gdb_stdlog, "<- %s->terminal_ours (", this->beneath ()->shortname ());
+ gdb_printf (gdb_stdlog, "<- %s->terminal_ours (",
+ this->beneath ()->shortname ());
gdb_puts (")\n", gdb_stdlog);
}
@@ -1357,9 +1558,11 @@ dummy_target::terminal_info (const char *arg0, int arg1)
void
debug_target::terminal_info (const char *arg0, int arg1)
{
- gdb_printf (gdb_stdlog, "-> %s->terminal_info (...)\n", this->beneath ()->shortname ());
+ gdb_printf (gdb_stdlog, "-> %s->terminal_info (...)\n",
+ this->beneath ()->shortname ());
this->beneath ()->terminal_info (arg0, arg1);
- gdb_printf (gdb_stdlog, "<- %s->terminal_info (", this->beneath ()->shortname ());
+ gdb_printf (gdb_stdlog, "<- %s->terminal_info (",
+ this->beneath ()->shortname ());
target_debug_print_const_char_p (arg0);
gdb_puts (", ", gdb_stdlog);
target_debug_print_int (arg1);
@@ -1381,7 +1584,8 @@ dummy_target::kill ()
void
debug_target::kill ()
{
- gdb_printf (gdb_stdlog, "-> %s->kill (...)\n", this->beneath ()->shortname ());
+ gdb_printf (gdb_stdlog, "-> %s->kill (...)\n",
+ this->beneath ()->shortname ());
this->beneath ()->kill ();
gdb_printf (gdb_stdlog, "<- %s->kill (", this->beneath ()->shortname ());
gdb_puts (")\n", gdb_stdlog);
@@ -1402,7 +1606,8 @@ dummy_target::load (const char *arg0, int arg1)
void
debug_target::load (const char *arg0, int arg1)
{
- gdb_printf (gdb_stdlog, "-> %s->load (...)\n", this->beneath ()->shortname ());
+ gdb_printf (gdb_stdlog, "-> %s->load (...)\n",
+ this->beneath ()->shortname ());
this->beneath ()->load (arg0, arg1);
gdb_printf (gdb_stdlog, "<- %s->load (", this->beneath ()->shortname ());
target_debug_print_const_char_p (arg0);
@@ -1427,9 +1632,11 @@ int
debug_target::insert_fork_catchpoint (int arg0)
{
int result;
- gdb_printf (gdb_stdlog, "-> %s->insert_fork_catchpoint (...)\n", this->beneath ()->shortname ());
+ gdb_printf (gdb_stdlog, "-> %s->insert_fork_catchpoint (...)\n",
+ this->beneath ()->shortname ());
result = this->beneath ()->insert_fork_catchpoint (arg0);
- gdb_printf (gdb_stdlog, "<- %s->insert_fork_catchpoint (", this->beneath ()->shortname ());
+ gdb_printf (gdb_stdlog, "<- %s->insert_fork_catchpoint (",
+ this->beneath ()->shortname ());
target_debug_print_int (arg0);
gdb_puts (") = ", gdb_stdlog);
target_debug_print_int (result);
@@ -1453,9 +1660,11 @@ int
debug_target::remove_fork_catchpoint (int arg0)
{
int result;
- gdb_printf (gdb_stdlog, "-> %s->remove_fork_catchpoint (...)\n", this->beneath ()->shortname ());
+ gdb_printf (gdb_stdlog, "-> %s->remove_fork_catchpoint (...)\n",
+ this->beneath ()->shortname ());
result = this->beneath ()->remove_fork_catchpoint (arg0);
- gdb_printf (gdb_stdlog, "<- %s->remove_fork_catchpoint (", this->beneath ()->shortname ());
+ gdb_printf (gdb_stdlog, "<- %s->remove_fork_catchpoint (",
+ this->beneath ()->shortname ());
target_debug_print_int (arg0);
gdb_puts (") = ", gdb_stdlog);
target_debug_print_int (result);
@@ -1479,9 +1688,11 @@ int
debug_target::insert_vfork_catchpoint (int arg0)
{
int result;
- gdb_printf (gdb_stdlog, "-> %s->insert_vfork_catchpoint (...)\n", this->beneath ()->shortname ());
+ gdb_printf (gdb_stdlog, "-> %s->insert_vfork_catchpoint (...)\n",
+ this->beneath ()->shortname ());
result = this->beneath ()->insert_vfork_catchpoint (arg0);
- gdb_printf (gdb_stdlog, "<- %s->insert_vfork_catchpoint (", this->beneath ()->shortname ());
+ gdb_printf (gdb_stdlog, "<- %s->insert_vfork_catchpoint (",
+ this->beneath ()->shortname ());
target_debug_print_int (arg0);
gdb_puts (") = ", gdb_stdlog);
target_debug_print_int (result);
@@ -1505,9 +1716,11 @@ int
debug_target::remove_vfork_catchpoint (int arg0)
{
int result;
- gdb_printf (gdb_stdlog, "-> %s->remove_vfork_catchpoint (...)\n", this->beneath ()->shortname ());
+ gdb_printf (gdb_stdlog, "-> %s->remove_vfork_catchpoint (...)\n",
+ this->beneath ()->shortname ());
result = this->beneath ()->remove_vfork_catchpoint (arg0);
- gdb_printf (gdb_stdlog, "<- %s->remove_vfork_catchpoint (", this->beneath ()->shortname ());
+ gdb_printf (gdb_stdlog, "<- %s->remove_vfork_catchpoint (",
+ this->beneath ()->shortname ());
target_debug_print_int (arg0);
gdb_puts (") = ", gdb_stdlog);
target_debug_print_int (result);
@@ -1516,23 +1729,28 @@ debug_target::remove_vfork_catchpoint (int arg0)
}
void
-target_ops::follow_fork (inferior *arg0, ptid_t arg1, target_waitkind arg2, bool arg3, bool arg4)
+target_ops::follow_fork (inferior *arg0, ptid_t arg1, target_waitkind arg2,
+ bool arg3, bool arg4)
{
this->beneath ()->follow_fork (arg0, arg1, arg2, arg3, arg4);
}
void
-dummy_target::follow_fork (inferior *arg0, ptid_t arg1, target_waitkind arg2, bool arg3, bool arg4)
+dummy_target::follow_fork (inferior *arg0, ptid_t arg1, target_waitkind arg2,
+ bool arg3, bool arg4)
{
default_follow_fork (this, arg0, arg1, arg2, arg3, arg4);
}
void
-debug_target::follow_fork (inferior *arg0, ptid_t arg1, target_waitkind arg2, bool arg3, bool arg4)
+debug_target::follow_fork (inferior *arg0, ptid_t arg1, target_waitkind arg2,
+ bool arg3, bool arg4)
{
- gdb_printf (gdb_stdlog, "-> %s->follow_fork (...)\n", this->beneath ()->shortname ());
+ gdb_printf (gdb_stdlog, "-> %s->follow_fork (...)\n",
+ this->beneath ()->shortname ());
this->beneath ()->follow_fork (arg0, arg1, arg2, arg3, arg4);
- gdb_printf (gdb_stdlog, "<- %s->follow_fork (", this->beneath ()->shortname ());
+ gdb_printf (gdb_stdlog, "<- %s->follow_fork (",
+ this->beneath ()->shortname ());
target_debug_print_inferior_p (arg0);
gdb_puts (", ", gdb_stdlog);
target_debug_print_ptid_t (arg1);
@@ -1561,9 +1779,11 @@ int
debug_target::insert_exec_catchpoint (int arg0)
{
int result;
- gdb_printf (gdb_stdlog, "-> %s->insert_exec_catchpoint (...)\n", this->beneath ()->shortname ());
+ gdb_printf (gdb_stdlog, "-> %s->insert_exec_catchpoint (...)\n",
+ this->beneath ()->shortname ());
result = this->beneath ()->insert_exec_catchpoint (arg0);
- gdb_printf (gdb_stdlog, "<- %s->insert_exec_catchpoint (", this->beneath ()->shortname ());
+ gdb_printf (gdb_stdlog, "<- %s->insert_exec_catchpoint (",
+ this->beneath ()->shortname ());
target_debug_print_int (arg0);
gdb_puts (") = ", gdb_stdlog);
target_debug_print_int (result);
@@ -1587,9 +1807,11 @@ int
debug_target::remove_exec_catchpoint (int arg0)
{
int result;
- gdb_printf (gdb_stdlog, "-> %s->remove_exec_catchpoint (...)\n", this->beneath ()->shortname ());
+ gdb_printf (gdb_stdlog, "-> %s->remove_exec_catchpoint (...)\n",
+ this->beneath ()->shortname ());
result = this->beneath ()->remove_exec_catchpoint (arg0);
- gdb_printf (gdb_stdlog, "<- %s->remove_exec_catchpoint (", this->beneath ()->shortname ());
+ gdb_printf (gdb_stdlog, "<- %s->remove_exec_catchpoint (",
+ this->beneath ()->shortname ());
target_debug_print_int (arg0);
gdb_puts (") = ", gdb_stdlog);
target_debug_print_int (result);
@@ -1611,9 +1833,11 @@ dummy_target::follow_exec (inferior *arg0, ptid_t arg1, const char *arg2)
void
debug_target::follow_exec (inferior *arg0, ptid_t arg1, const char *arg2)
{
- gdb_printf (gdb_stdlog, "-> %s->follow_exec (...)\n", this->beneath ()->shortname ());
+ gdb_printf (gdb_stdlog, "-> %s->follow_exec (...)\n",
+ this->beneath ()->shortname ());
this->beneath ()->follow_exec (arg0, arg1, arg2);
- gdb_printf (gdb_stdlog, "<- %s->follow_exec (", this->beneath ()->shortname ());
+ gdb_printf (gdb_stdlog, "<- %s->follow_exec (",
+ this->beneath ()->shortname ());
target_debug_print_inferior_p (arg0);
gdb_puts (", ", gdb_stdlog);
target_debug_print_ptid_t (arg1);
@@ -1623,24 +1847,29 @@ debug_target::follow_exec (inferior *arg0, ptid_t arg1, const char *arg2)
}
int
-target_ops::set_syscall_catchpoint (int arg0, bool arg1, int arg2, gdb::array_view<const int> arg3)
+target_ops::set_syscall_catchpoint (int arg0, bool arg1, int arg2,
+ gdb::array_view<const int> arg3)
{
return this->beneath ()->set_syscall_catchpoint (arg0, arg1, arg2, arg3);
}
int
-dummy_target::set_syscall_catchpoint (int arg0, bool arg1, int arg2, gdb::array_view<const int> arg3)
+dummy_target::set_syscall_catchpoint (int arg0, bool arg1, int arg2,
+ gdb::array_view<const int> arg3)
{
return 1;
}
int
-debug_target::set_syscall_catchpoint (int arg0, bool arg1, int arg2, gdb::array_view<const int> arg3)
+debug_target::set_syscall_catchpoint (int arg0, bool arg1, int arg2,
+ gdb::array_view<const int> arg3)
{
int result;
- gdb_printf (gdb_stdlog, "-> %s->set_syscall_catchpoint (...)\n", this->beneath ()->shortname ());
+ gdb_printf (gdb_stdlog, "-> %s->set_syscall_catchpoint (...)\n",
+ this->beneath ()->shortname ());
result = this->beneath ()->set_syscall_catchpoint (arg0, arg1, arg2, arg3);
- gdb_printf (gdb_stdlog, "<- %s->set_syscall_catchpoint (", this->beneath ()->shortname ());
+ gdb_printf (gdb_stdlog, "<- %s->set_syscall_catchpoint (",
+ this->beneath ()->shortname ());
target_debug_print_int (arg0);
gdb_puts (", ", gdb_stdlog);
target_debug_print_bool (arg1);
@@ -1669,9 +1898,11 @@ dummy_target::mourn_inferior ()
void
debug_target::mourn_inferior ()
{
- gdb_printf (gdb_stdlog, "-> %s->mourn_inferior (...)\n", this->beneath ()->shortname ());
+ gdb_printf (gdb_stdlog, "-> %s->mourn_inferior (...)\n",
+ this->beneath ()->shortname ());
this->beneath ()->mourn_inferior ();
- gdb_printf (gdb_stdlog, "<- %s->mourn_inferior (", this->beneath ()->shortname ());
+ gdb_printf (gdb_stdlog, "<- %s->mourn_inferior (",
+ this->beneath ()->shortname ());
gdb_puts (")\n", gdb_stdlog);
}
@@ -1689,9 +1920,11 @@ dummy_target::pass_signals (gdb::array_view<const unsigned char> arg0)
void
debug_target::pass_signals (gdb::array_view<const unsigned char> arg0)
{
- gdb_printf (gdb_stdlog, "-> %s->pass_signals (...)\n", this->beneath ()->shortname ());
+ gdb_printf (gdb_stdlog, "-> %s->pass_signals (...)\n",
+ this->beneath ()->shortname ());
this->beneath ()->pass_signals (arg0);
- gdb_printf (gdb_stdlog, "<- %s->pass_signals (", this->beneath ()->shortname ());
+ gdb_printf (gdb_stdlog, "<- %s->pass_signals (",
+ this->beneath ()->shortname ());
target_debug_print_signals (arg0);
gdb_puts (")\n", gdb_stdlog);
}
@@ -1710,9 +1943,11 @@ dummy_target::program_signals (gdb::array_view<const unsigned char> arg0)
void
debug_target::program_signals (gdb::array_view<const unsigned char> arg0)
{
- gdb_printf (gdb_stdlog, "-> %s->program_signals (...)\n", this->beneath ()->shortname ());
+ gdb_printf (gdb_stdlog, "-> %s->program_signals (...)\n",
+ this->beneath ()->shortname ());
this->beneath ()->program_signals (arg0);
- gdb_printf (gdb_stdlog, "<- %s->program_signals (", this->beneath ()->shortname ());
+ gdb_printf (gdb_stdlog, "<- %s->program_signals (",
+ this->beneath ()->shortname ());
target_debug_print_signals (arg0);
gdb_puts (")\n", gdb_stdlog);
}
@@ -1733,9 +1968,11 @@ bool
debug_target::thread_alive (ptid_t arg0)
{
bool result;
- gdb_printf (gdb_stdlog, "-> %s->thread_alive (...)\n", this->beneath ()->shortname ());
+ gdb_printf (gdb_stdlog, "-> %s->thread_alive (...)\n",
+ this->beneath ()->shortname ());
result = this->beneath ()->thread_alive (arg0);
- gdb_printf (gdb_stdlog, "<- %s->thread_alive (", this->beneath ()->shortname ());
+ gdb_printf (gdb_stdlog, "<- %s->thread_alive (",
+ this->beneath ()->shortname ());
target_debug_print_ptid_t (arg0);
gdb_puts (") = ", gdb_stdlog);
target_debug_print_bool (result);
@@ -1757,9 +1994,11 @@ dummy_target::update_thread_list ()
void
debug_target::update_thread_list ()
{
- gdb_printf (gdb_stdlog, "-> %s->update_thread_list (...)\n", this->beneath ()->shortname ());
+ gdb_printf (gdb_stdlog, "-> %s->update_thread_list (...)\n",
+ this->beneath ()->shortname ());
this->beneath ()->update_thread_list ();
- gdb_printf (gdb_stdlog, "<- %s->update_thread_list (", this->beneath ()->shortname ());
+ gdb_printf (gdb_stdlog, "<- %s->update_thread_list (",
+ this->beneath ()->shortname ());
gdb_puts (")\n", gdb_stdlog);
}
@@ -1779,9 +2018,11 @@ std::string
debug_target::pid_to_str (ptid_t arg0)
{
std::string result;
- gdb_printf (gdb_stdlog, "-> %s->pid_to_str (...)\n", this->beneath ()->shortname ());
+ gdb_printf (gdb_stdlog, "-> %s->pid_to_str (...)\n",
+ this->beneath ()->shortname ());
result = this->beneath ()->pid_to_str (arg0);
- gdb_printf (gdb_stdlog, "<- %s->pid_to_str (", this->beneath ()->shortname ());
+ gdb_printf (gdb_stdlog, "<- %s->pid_to_str (",
+ this->beneath ()->shortname ());
target_debug_print_ptid_t (arg0);
gdb_puts (") = ", gdb_stdlog);
target_debug_print_std_string (result);
@@ -1804,10 +2045,12 @@ dummy_target::extra_thread_info (thread_info *arg0)
const char *
debug_target::extra_thread_info (thread_info *arg0)
{
- const char * result;
- gdb_printf (gdb_stdlog, "-> %s->extra_thread_info (...)\n", this->beneath ()->shortname ());
+ const char *result;
+ gdb_printf (gdb_stdlog, "-> %s->extra_thread_info (...)\n",
+ this->beneath ()->shortname ());
result = this->beneath ()->extra_thread_info (arg0);
- gdb_printf (gdb_stdlog, "<- %s->extra_thread_info (", this->beneath ()->shortname ());
+ gdb_printf (gdb_stdlog, "<- %s->extra_thread_info (",
+ this->beneath ()->shortname ());
target_debug_print_thread_info_p (arg0);
gdb_puts (") = ", gdb_stdlog);
target_debug_print_const_char_p (result);
@@ -1830,10 +2073,12 @@ dummy_target::thread_name (thread_info *arg0)
const char *
debug_target::thread_name (thread_info *arg0)
{
- const char * result;
- gdb_printf (gdb_stdlog, "-> %s->thread_name (...)\n", this->beneath ()->shortname ());
+ const char *result;
+ gdb_printf (gdb_stdlog, "-> %s->thread_name (...)\n",
+ this->beneath ()->shortname ());
result = this->beneath ()->thread_name (arg0);
- gdb_printf (gdb_stdlog, "<- %s->thread_name (", this->beneath ()->shortname ());
+ gdb_printf (gdb_stdlog, "<- %s->thread_name (",
+ this->beneath ()->shortname ());
target_debug_print_thread_info_p (arg0);
gdb_puts (") = ", gdb_stdlog);
target_debug_print_const_char_p (result);
@@ -1842,24 +2087,29 @@ debug_target::thread_name (thread_info *arg0)
}
thread_info *
-target_ops::thread_handle_to_thread_info (const gdb_byte *arg0, int arg1, inferior *arg2)
+target_ops::thread_handle_to_thread_info (const gdb_byte *arg0, int arg1,
+ inferior *arg2)
{
return this->beneath ()->thread_handle_to_thread_info (arg0, arg1, arg2);
}
thread_info *
-dummy_target::thread_handle_to_thread_info (const gdb_byte *arg0, int arg1, inferior *arg2)
+dummy_target::thread_handle_to_thread_info (const gdb_byte *arg0, int arg1,
+ inferior *arg2)
{
return NULL;
}
thread_info *
-debug_target::thread_handle_to_thread_info (const gdb_byte *arg0, int arg1, inferior *arg2)
+debug_target::thread_handle_to_thread_info (const gdb_byte *arg0, int arg1,
+ inferior *arg2)
{
- thread_info * result;
- gdb_printf (gdb_stdlog, "-> %s->thread_handle_to_thread_info (...)\n", this->beneath ()->shortname ());
+ thread_info *result;
+ gdb_printf (gdb_stdlog, "-> %s->thread_handle_to_thread_info (...)\n",
+ this->beneath ()->shortname ());
result = this->beneath ()->thread_handle_to_thread_info (arg0, arg1, arg2);
- gdb_printf (gdb_stdlog, "<- %s->thread_handle_to_thread_info (", this->beneath ()->shortname ());
+ gdb_printf (gdb_stdlog, "<- %s->thread_handle_to_thread_info (",
+ this->beneath ()->shortname ());
target_debug_print_const_gdb_byte_p (arg0);
gdb_puts (", ", gdb_stdlog);
target_debug_print_int (arg1);
@@ -1887,9 +2137,11 @@ gdb::byte_vector
debug_target::thread_info_to_thread_handle (struct thread_info *arg0)
{
gdb::byte_vector result;
- gdb_printf (gdb_stdlog, "-> %s->thread_info_to_thread_handle (...)\n", this->beneath ()->shortname ());
+ gdb_printf (gdb_stdlog, "-> %s->thread_info_to_thread_handle (...)\n",
+ this->beneath ()->shortname ());
result = this->beneath ()->thread_info_to_thread_handle (arg0);
- gdb_printf (gdb_stdlog, "<- %s->thread_info_to_thread_handle (", this->beneath ()->shortname ());
+ gdb_printf (gdb_stdlog, "<- %s->thread_info_to_thread_handle (",
+ this->beneath ()->shortname ());
target_debug_print_struct_thread_info_p (arg0);
gdb_puts (") = ", gdb_stdlog);
target_debug_print_gdb_byte_vector (result);
@@ -1911,7 +2163,8 @@ dummy_target::stop (ptid_t arg0)
void
debug_target::stop (ptid_t arg0)
{
- gdb_printf (gdb_stdlog, "-> %s->stop (...)\n", this->beneath ()->shortname ());
+ gdb_printf (gdb_stdlog, "-> %s->stop (...)\n",
+ this->beneath ()->shortname ());
this->beneath ()->stop (arg0);
gdb_printf (gdb_stdlog, "<- %s->stop (", this->beneath ()->shortname ());
target_debug_print_ptid_t (arg0);
@@ -1932,9 +2185,11 @@ dummy_target::interrupt ()
void
debug_target::interrupt ()
{
- gdb_printf (gdb_stdlog, "-> %s->interrupt (...)\n", this->beneath ()->shortname ());
+ gdb_printf (gdb_stdlog, "-> %s->interrupt (...)\n",
+ this->beneath ()->shortname ());
this->beneath ()->interrupt ();
- gdb_printf (gdb_stdlog, "<- %s->interrupt (", this->beneath ()->shortname ());
+ gdb_printf (gdb_stdlog, "<- %s->interrupt (",
+ this->beneath ()->shortname ());
gdb_puts (")\n", gdb_stdlog);
}
@@ -1953,9 +2208,11 @@ dummy_target::pass_ctrlc ()
void
debug_target::pass_ctrlc ()
{
- gdb_printf (gdb_stdlog, "-> %s->pass_ctrlc (...)\n", this->beneath ()->shortname ());
+ gdb_printf (gdb_stdlog, "-> %s->pass_ctrlc (...)\n",
+ this->beneath ()->shortname ());
this->beneath ()->pass_ctrlc ();
- gdb_printf (gdb_stdlog, "<- %s->pass_ctrlc (", this->beneath ()->shortname ());
+ gdb_printf (gdb_stdlog, "<- %s->pass_ctrlc (",
+ this->beneath ()->shortname ());
gdb_puts (")\n", gdb_stdlog);
}
@@ -1974,7 +2231,8 @@ dummy_target::rcmd (const char *arg0, struct ui_file *arg1)
void
debug_target::rcmd (const char *arg0, struct ui_file *arg1)
{
- gdb_printf (gdb_stdlog, "-> %s->rcmd (...)\n", this->beneath ()->shortname ());
+ gdb_printf (gdb_stdlog, "-> %s->rcmd (...)\n",
+ this->beneath ()->shortname ());
this->beneath ()->rcmd (arg0, arg1);
gdb_printf (gdb_stdlog, "<- %s->rcmd (", this->beneath ()->shortname ());
target_debug_print_const_char_p (arg0);
@@ -1998,10 +2256,12 @@ dummy_target::pid_to_exec_file (int arg0)
const char *
debug_target::pid_to_exec_file (int arg0)
{
- const char * result;
- gdb_printf (gdb_stdlog, "-> %s->pid_to_exec_file (...)\n", this->beneath ()->shortname ());
+ const char *result;
+ gdb_printf (gdb_stdlog, "-> %s->pid_to_exec_file (...)\n",
+ this->beneath ()->shortname ());
result = this->beneath ()->pid_to_exec_file (arg0);
- gdb_printf (gdb_stdlog, "<- %s->pid_to_exec_file (", this->beneath ()->shortname ());
+ gdb_printf (gdb_stdlog, "<- %s->pid_to_exec_file (",
+ this->beneath ()->shortname ());
target_debug_print_int (arg0);
gdb_puts (") = ", gdb_stdlog);
target_debug_print_const_char_p (result);
@@ -2023,9 +2283,11 @@ dummy_target::log_command (const char *arg0)
void
debug_target::log_command (const char *arg0)
{
- gdb_printf (gdb_stdlog, "-> %s->log_command (...)\n", this->beneath ()->shortname ());
+ gdb_printf (gdb_stdlog, "-> %s->log_command (...)\n",
+ this->beneath ()->shortname ());
this->beneath ()->log_command (arg0);
- gdb_printf (gdb_stdlog, "<- %s->log_command (", this->beneath ()->shortname ());
+ gdb_printf (gdb_stdlog, "<- %s->log_command (",
+ this->beneath ()->shortname ());
target_debug_print_const_char_p (arg0);
gdb_puts (")\n", gdb_stdlog);
}
@@ -2045,10 +2307,12 @@ dummy_target::get_section_table ()
const target_section_table *
debug_target::get_section_table ()
{
- const target_section_table * result;
- gdb_printf (gdb_stdlog, "-> %s->get_section_table (...)\n", this->beneath ()->shortname ());
+ const target_section_table *result;
+ gdb_printf (gdb_stdlog, "-> %s->get_section_table (...)\n",
+ this->beneath ()->shortname ());
result = this->beneath ()->get_section_table ();
- gdb_printf (gdb_stdlog, "<- %s->get_section_table (", this->beneath ()->shortname ());
+ gdb_printf (gdb_stdlog, "<- %s->get_section_table (",
+ this->beneath ()->shortname ());
gdb_puts (") = ", gdb_stdlog);
target_debug_print_const_target_section_table_p (result);
gdb_puts ("\n", gdb_stdlog);
@@ -2071,9 +2335,11 @@ thread_control_capabilities
debug_target::get_thread_control_capabilities ()
{
thread_control_capabilities result;
- gdb_printf (gdb_stdlog, "-> %s->get_thread_control_capabilities (...)\n", this->beneath ()->shortname ());
+ gdb_printf (gdb_stdlog, "-> %s->get_thread_control_capabilities (...)\n",
+ this->beneath ()->shortname ());
result = this->beneath ()->get_thread_control_capabilities ();
- gdb_printf (gdb_stdlog, "<- %s->get_thread_control_capabilities (", this->beneath ()->shortname ());
+ gdb_printf (gdb_stdlog, "<- %s->get_thread_control_capabilities (",
+ this->beneath ()->shortname ());
gdb_puts (") = ", gdb_stdlog);
target_debug_print_thread_control_capabilities (result);
gdb_puts ("\n", gdb_stdlog);
@@ -2096,9 +2362,11 @@ bool
debug_target::attach_no_wait ()
{
bool result;
- gdb_printf (gdb_stdlog, "-> %s->attach_no_wait (...)\n", this->beneath ()->shortname ());
+ gdb_printf (gdb_stdlog, "-> %s->attach_no_wait (...)\n",
+ this->beneath ()->shortname ());
result = this->beneath ()->attach_no_wait ();
- gdb_printf (gdb_stdlog, "<- %s->attach_no_wait (", this->beneath ()->shortname ());
+ gdb_printf (gdb_stdlog, "<- %s->attach_no_wait (",
+ this->beneath ()->shortname ());
gdb_puts (") = ", gdb_stdlog);
target_debug_print_bool (result);
gdb_puts ("\n", gdb_stdlog);
@@ -2121,9 +2389,11 @@ bool
debug_target::can_async_p ()
{
bool result;
- gdb_printf (gdb_stdlog, "-> %s->can_async_p (...)\n", this->beneath ()->shortname ());
+ gdb_printf (gdb_stdlog, "-> %s->can_async_p (...)\n",
+ this->beneath ()->shortname ());
result = this->beneath ()->can_async_p ();
- gdb_printf (gdb_stdlog, "<- %s->can_async_p (", this->beneath ()->shortname ());
+ gdb_printf (gdb_stdlog, "<- %s->can_async_p (",
+ this->beneath ()->shortname ());
gdb_puts (") = ", gdb_stdlog);
target_debug_print_bool (result);
gdb_puts ("\n", gdb_stdlog);
@@ -2146,9 +2416,11 @@ bool
debug_target::is_async_p ()
{
bool result;
- gdb_printf (gdb_stdlog, "-> %s->is_async_p (...)\n", this->beneath ()->shortname ());
+ gdb_printf (gdb_stdlog, "-> %s->is_async_p (...)\n",
+ this->beneath ()->shortname ());
result = this->beneath ()->is_async_p ();
- gdb_printf (gdb_stdlog, "<- %s->is_async_p (", this->beneath ()->shortname ());
+ gdb_printf (gdb_stdlog, "<- %s->is_async_p (",
+ this->beneath ()->shortname ());
gdb_puts (") = ", gdb_stdlog);
target_debug_print_bool (result);
gdb_puts ("\n", gdb_stdlog);
@@ -2170,7 +2442,8 @@ dummy_target::async (bool arg0)
void
debug_target::async (bool arg0)
{
- gdb_printf (gdb_stdlog, "-> %s->async (...)\n", this->beneath ()->shortname ());
+ gdb_printf (gdb_stdlog, "-> %s->async (...)\n",
+ this->beneath ()->shortname ());
this->beneath ()->async (arg0);
gdb_printf (gdb_stdlog, "<- %s->async (", this->beneath ()->shortname ());
target_debug_print_bool (arg0);
@@ -2193,9 +2466,11 @@ int
debug_target::async_wait_fd ()
{
int result;
- gdb_printf (gdb_stdlog, "-> %s->async_wait_fd (...)\n", this->beneath ()->shortname ());
+ gdb_printf (gdb_stdlog, "-> %s->async_wait_fd (...)\n",
+ this->beneath ()->shortname ());
result = this->beneath ()->async_wait_fd ();
- gdb_printf (gdb_stdlog, "<- %s->async_wait_fd (", this->beneath ()->shortname ());
+ gdb_printf (gdb_stdlog, "<- %s->async_wait_fd (",
+ this->beneath ()->shortname ());
gdb_puts (") = ", gdb_stdlog);
target_debug_print_int (result);
gdb_puts ("\n", gdb_stdlog);
@@ -2218,9 +2493,11 @@ bool
debug_target::has_pending_events ()
{
bool result;
- gdb_printf (gdb_stdlog, "-> %s->has_pending_events (...)\n", this->beneath ()->shortname ());
+ gdb_printf (gdb_stdlog, "-> %s->has_pending_events (...)\n",
+ this->beneath ()->shortname ());
result = this->beneath ()->has_pending_events ();
- gdb_printf (gdb_stdlog, "<- %s->has_pending_events (", this->beneath ()->shortname ());
+ gdb_printf (gdb_stdlog, "<- %s->has_pending_events (",
+ this->beneath ()->shortname ());
gdb_puts (") = ", gdb_stdlog);
target_debug_print_bool (result);
gdb_puts ("\n", gdb_stdlog);
@@ -2241,9 +2518,11 @@ dummy_target::thread_events (int arg0)
void
debug_target::thread_events (int arg0)
{
- gdb_printf (gdb_stdlog, "-> %s->thread_events (...)\n", this->beneath ()->shortname ());
+ gdb_printf (gdb_stdlog, "-> %s->thread_events (...)\n",
+ this->beneath ()->shortname ());
this->beneath ()->thread_events (arg0);
- gdb_printf (gdb_stdlog, "<- %s->thread_events (", this->beneath ()->shortname ());
+ gdb_printf (gdb_stdlog, "<- %s->thread_events (",
+ this->beneath ()->shortname ());
target_debug_print_int (arg0);
gdb_puts (")\n", gdb_stdlog);
}
@@ -2264,9 +2543,11 @@ bool
debug_target::supports_non_stop ()
{
bool result;
- gdb_printf (gdb_stdlog, "-> %s->supports_non_stop (...)\n", this->beneath ()->shortname ());
+ gdb_printf (gdb_stdlog, "-> %s->supports_non_stop (...)\n",
+ this->beneath ()->shortname ());
result = this->beneath ()->supports_non_stop ();
- gdb_printf (gdb_stdlog, "<- %s->supports_non_stop (", this->beneath ()->shortname ());
+ gdb_printf (gdb_stdlog, "<- %s->supports_non_stop (",
+ this->beneath ()->shortname ());
gdb_puts (") = ", gdb_stdlog);
target_debug_print_bool (result);
gdb_puts ("\n", gdb_stdlog);
@@ -2289,9 +2570,11 @@ bool
debug_target::always_non_stop_p ()
{
bool result;
- gdb_printf (gdb_stdlog, "-> %s->always_non_stop_p (...)\n", this->beneath ()->shortname ());
+ gdb_printf (gdb_stdlog, "-> %s->always_non_stop_p (...)\n",
+ this->beneath ()->shortname ());
result = this->beneath ()->always_non_stop_p ();
- gdb_printf (gdb_stdlog, "<- %s->always_non_stop_p (", this->beneath ()->shortname ());
+ gdb_printf (gdb_stdlog, "<- %s->always_non_stop_p (",
+ this->beneath ()->shortname ());
gdb_puts (") = ", gdb_stdlog);
target_debug_print_bool (result);
gdb_puts ("\n", gdb_stdlog);
@@ -2314,9 +2597,11 @@ int
debug_target::find_memory_regions (find_memory_region_ftype arg0, void *arg1)
{
int result;
- gdb_printf (gdb_stdlog, "-> %s->find_memory_regions (...)\n", this->beneath ()->shortname ());
+ gdb_printf (gdb_stdlog, "-> %s->find_memory_regions (...)\n",
+ this->beneath ()->shortname ());
result = this->beneath ()->find_memory_regions (arg0, arg1);
- gdb_printf (gdb_stdlog, "<- %s->find_memory_regions (", this->beneath ()->shortname ());
+ gdb_printf (gdb_stdlog, "<- %s->find_memory_regions (",
+ this->beneath ()->shortname ());
target_debug_print_find_memory_region_ftype (arg0);
gdb_puts (", ", gdb_stdlog);
target_debug_print_void_p (arg1);
@@ -2342,9 +2627,11 @@ gdb::unique_xmalloc_ptr<char>
debug_target::make_corefile_notes (bfd *arg0, int *arg1)
{
gdb::unique_xmalloc_ptr<char> result;
- gdb_printf (gdb_stdlog, "-> %s->make_corefile_notes (...)\n", this->beneath ()->shortname ());
+ gdb_printf (gdb_stdlog, "-> %s->make_corefile_notes (...)\n",
+ this->beneath ()->shortname ());
result = this->beneath ()->make_corefile_notes (arg0, arg1);
- gdb_printf (gdb_stdlog, "<- %s->make_corefile_notes (", this->beneath ()->shortname ());
+ gdb_printf (gdb_stdlog, "<- %s->make_corefile_notes (",
+ this->beneath ()->shortname ());
target_debug_print_bfd_p (arg0);
gdb_puts (", ", gdb_stdlog);
target_debug_print_int_p (arg1);
@@ -2369,10 +2656,12 @@ dummy_target::get_bookmark (const char *arg0, int arg1)
gdb_byte *
debug_target::get_bookmark (const char *arg0, int arg1)
{
- gdb_byte * result;
- gdb_printf (gdb_stdlog, "-> %s->get_bookmark (...)\n", this->beneath ()->shortname ());
+ gdb_byte *result;
+ gdb_printf (gdb_stdlog, "-> %s->get_bookmark (...)\n",
+ this->beneath ()->shortname ());
result = this->beneath ()->get_bookmark (arg0, arg1);
- gdb_printf (gdb_stdlog, "<- %s->get_bookmark (", this->beneath ()->shortname ());
+ gdb_printf (gdb_stdlog, "<- %s->get_bookmark (",
+ this->beneath ()->shortname ());
target_debug_print_const_char_p (arg0);
gdb_puts (", ", gdb_stdlog);
target_debug_print_int (arg1);
@@ -2397,9 +2686,11 @@ dummy_target::goto_bookmark (const gdb_byte *arg0, int arg1)
void
debug_target::goto_bookmark (const gdb_byte *arg0, int arg1)
{
- gdb_printf (gdb_stdlog, "-> %s->goto_bookmark (...)\n", this->beneath ()->shortname ());
+ gdb_printf (gdb_stdlog, "-> %s->goto_bookmark (...)\n",
+ this->beneath ()->shortname ());
this->beneath ()->goto_bookmark (arg0, arg1);
- gdb_printf (gdb_stdlog, "<- %s->goto_bookmark (", this->beneath ()->shortname ());
+ gdb_printf (gdb_stdlog, "<- %s->goto_bookmark (",
+ this->beneath ()->shortname ());
target_debug_print_const_gdb_byte_p (arg0);
gdb_puts (", ", gdb_stdlog);
target_debug_print_int (arg1);
@@ -2407,24 +2698,29 @@ debug_target::goto_bookmark (const gdb_byte *arg0, int arg1)
}
CORE_ADDR
-target_ops::get_thread_local_address (ptid_t arg0, CORE_ADDR arg1, CORE_ADDR arg2)
+target_ops::get_thread_local_address (ptid_t arg0, CORE_ADDR arg1,
+ CORE_ADDR arg2)
{
return this->beneath ()->get_thread_local_address (arg0, arg1, arg2);
}
CORE_ADDR
-dummy_target::get_thread_local_address (ptid_t arg0, CORE_ADDR arg1, CORE_ADDR arg2)
+dummy_target::get_thread_local_address (ptid_t arg0, CORE_ADDR arg1,
+ CORE_ADDR arg2)
{
generic_tls_error ();
}
CORE_ADDR
-debug_target::get_thread_local_address (ptid_t arg0, CORE_ADDR arg1, CORE_ADDR arg2)
+debug_target::get_thread_local_address (ptid_t arg0, CORE_ADDR arg1,
+ CORE_ADDR arg2)
{
CORE_ADDR result;
- gdb_printf (gdb_stdlog, "-> %s->get_thread_local_address (...)\n", this->beneath ()->shortname ());
+ gdb_printf (gdb_stdlog, "-> %s->get_thread_local_address (...)\n",
+ this->beneath ()->shortname ());
result = this->beneath ()->get_thread_local_address (arg0, arg1, arg2);
- gdb_printf (gdb_stdlog, "<- %s->get_thread_local_address (", this->beneath ()->shortname ());
+ gdb_printf (gdb_stdlog, "<- %s->get_thread_local_address (",
+ this->beneath ()->shortname ());
target_debug_print_ptid_t (arg0);
gdb_puts (", ", gdb_stdlog);
target_debug_print_CORE_ADDR (arg1);
@@ -2437,24 +2733,34 @@ debug_target::get_thread_local_address (ptid_t arg0, CORE_ADDR arg1, CORE_ADDR a
}
enum target_xfer_status
-target_ops::xfer_partial (enum target_object arg0, const char *arg1, gdb_byte *arg2, const gdb_byte *arg3, ULONGEST arg4, ULONGEST arg5, ULONGEST *arg6)
+target_ops::xfer_partial (enum target_object arg0, const char *arg1,
+ gdb_byte *arg2, const gdb_byte *arg3, ULONGEST arg4,
+ ULONGEST arg5, ULONGEST *arg6)
{
- return this->beneath ()->xfer_partial (arg0, arg1, arg2, arg3, arg4, arg5, arg6);
+ return this->beneath ()->xfer_partial (arg0, arg1, arg2, arg3, arg4, arg5,
+ arg6);
}
enum target_xfer_status
-dummy_target::xfer_partial (enum target_object arg0, const char *arg1, gdb_byte *arg2, const gdb_byte *arg3, ULONGEST arg4, ULONGEST arg5, ULONGEST *arg6)
+dummy_target::xfer_partial (enum target_object arg0, const char *arg1,
+ gdb_byte *arg2, const gdb_byte *arg3,
+ ULONGEST arg4, ULONGEST arg5, ULONGEST *arg6)
{
return TARGET_XFER_E_IO;
}
enum target_xfer_status
-debug_target::xfer_partial (enum target_object arg0, const char *arg1, gdb_byte *arg2, const gdb_byte *arg3, ULONGEST arg4, ULONGEST arg5, ULONGEST *arg6)
+debug_target::xfer_partial (enum target_object arg0, const char *arg1,
+ gdb_byte *arg2, const gdb_byte *arg3,
+ ULONGEST arg4, ULONGEST arg5, ULONGEST *arg6)
{
enum target_xfer_status result;
- gdb_printf (gdb_stdlog, "-> %s->xfer_partial (...)\n", this->beneath ()->shortname ());
- result = this->beneath ()->xfer_partial (arg0, arg1, arg2, arg3, arg4, arg5, arg6);
- gdb_printf (gdb_stdlog, "<- %s->xfer_partial (", this->beneath ()->shortname ());
+ gdb_printf (gdb_stdlog, "-> %s->xfer_partial (...)\n",
+ this->beneath ()->shortname ());
+ result = this->beneath ()->xfer_partial (arg0, arg1, arg2, arg3, arg4, arg5,
+ arg6);
+ gdb_printf (gdb_stdlog, "<- %s->xfer_partial (",
+ this->beneath ()->shortname ());
target_debug_print_enum_target_object (arg0);
gdb_puts (", ", gdb_stdlog);
target_debug_print_const_char_p (arg1);
@@ -2490,9 +2796,11 @@ ULONGEST
debug_target::get_memory_xfer_limit ()
{
ULONGEST result;
- gdb_printf (gdb_stdlog, "-> %s->get_memory_xfer_limit (...)\n", this->beneath ()->shortname ());
+ gdb_printf (gdb_stdlog, "-> %s->get_memory_xfer_limit (...)\n",
+ this->beneath ()->shortname ());
result = this->beneath ()->get_memory_xfer_limit ();
- gdb_printf (gdb_stdlog, "<- %s->get_memory_xfer_limit (", this->beneath ()->shortname ());
+ gdb_printf (gdb_stdlog, "<- %s->get_memory_xfer_limit (",
+ this->beneath ()->shortname ());
gdb_puts (") = ", gdb_stdlog);
target_debug_print_ULONGEST (result);
gdb_puts ("\n", gdb_stdlog);
@@ -2515,9 +2823,11 @@ std::vector<mem_region>
debug_target::memory_map ()
{
std::vector<mem_region> result;
- gdb_printf (gdb_stdlog, "-> %s->memory_map (...)\n", this->beneath ()->shortname ());
+ gdb_printf (gdb_stdlog, "-> %s->memory_map (...)\n",
+ this->beneath ()->shortname ());
result = this->beneath ()->memory_map ();
- gdb_printf (gdb_stdlog, "<- %s->memory_map (", this->beneath ()->shortname ());
+ gdb_printf (gdb_stdlog, "<- %s->memory_map (",
+ this->beneath ()->shortname ());
gdb_puts (") = ", gdb_stdlog);
target_debug_print_std_vector_mem_region (result);
gdb_puts ("\n", gdb_stdlog);
@@ -2539,9 +2849,11 @@ dummy_target::flash_erase (ULONGEST arg0, LONGEST arg1)
void
debug_target::flash_erase (ULONGEST arg0, LONGEST arg1)
{
- gdb_printf (gdb_stdlog, "-> %s->flash_erase (...)\n", this->beneath ()->shortname ());
+ gdb_printf (gdb_stdlog, "-> %s->flash_erase (...)\n",
+ this->beneath ()->shortname ());
this->beneath ()->flash_erase (arg0, arg1);
- gdb_printf (gdb_stdlog, "<- %s->flash_erase (", this->beneath ()->shortname ());
+ gdb_printf (gdb_stdlog, "<- %s->flash_erase (",
+ this->beneath ()->shortname ());
target_debug_print_ULONGEST (arg0);
gdb_puts (", ", gdb_stdlog);
target_debug_print_LONGEST (arg1);
@@ -2563,9 +2875,11 @@ dummy_target::flash_done ()
void
debug_target::flash_done ()
{
- gdb_printf (gdb_stdlog, "-> %s->flash_done (...)\n", this->beneath ()->shortname ());
+ gdb_printf (gdb_stdlog, "-> %s->flash_done (...)\n",
+ this->beneath ()->shortname ());
this->beneath ()->flash_done ();
- gdb_printf (gdb_stdlog, "<- %s->flash_done (", this->beneath ()->shortname ());
+ gdb_printf (gdb_stdlog, "<- %s->flash_done (",
+ this->beneath ()->shortname ());
gdb_puts (")\n", gdb_stdlog);
}
@@ -2584,10 +2898,12 @@ dummy_target::read_description ()
const struct target_desc *
debug_target::read_description ()
{
- const struct target_desc * result;
- gdb_printf (gdb_stdlog, "-> %s->read_description (...)\n", this->beneath ()->shortname ());
+ const struct target_desc *result;
+ gdb_printf (gdb_stdlog, "-> %s->read_description (...)\n",
+ this->beneath ()->shortname ());
result = this->beneath ()->read_description ();
- gdb_printf (gdb_stdlog, "<- %s->read_description (", this->beneath ()->shortname ());
+ gdb_printf (gdb_stdlog, "<- %s->read_description (",
+ this->beneath ()->shortname ());
gdb_puts (") = ", gdb_stdlog);
target_debug_print_const_struct_target_desc_p (result);
gdb_puts ("\n", gdb_stdlog);
@@ -2610,9 +2926,11 @@ ptid_t
debug_target::get_ada_task_ptid (long arg0, ULONGEST arg1)
{
ptid_t result;
- gdb_printf (gdb_stdlog, "-> %s->get_ada_task_ptid (...)\n", this->beneath ()->shortname ());
+ gdb_printf (gdb_stdlog, "-> %s->get_ada_task_ptid (...)\n",
+ this->beneath ()->shortname ());
result = this->beneath ()->get_ada_task_ptid (arg0, arg1);
- gdb_printf (gdb_stdlog, "<- %s->get_ada_task_ptid (", this->beneath ()->shortname ());
+ gdb_printf (gdb_stdlog, "<- %s->get_ada_task_ptid (",
+ this->beneath ()->shortname ());
target_debug_print_long (arg0);
gdb_puts (", ", gdb_stdlog);
target_debug_print_ULONGEST (arg1);
@@ -2623,24 +2941,29 @@ debug_target::get_ada_task_ptid (long arg0, ULONGEST arg1)
}
int
-target_ops::auxv_parse (const gdb_byte **arg0, const gdb_byte *arg1, CORE_ADDR *arg2, CORE_ADDR *arg3)
+target_ops::auxv_parse (const gdb_byte **arg0, const gdb_byte *arg1,
+ CORE_ADDR *arg2, CORE_ADDR *arg3)
{
return this->beneath ()->auxv_parse (arg0, arg1, arg2, arg3);
}
int
-dummy_target::auxv_parse (const gdb_byte **arg0, const gdb_byte *arg1, CORE_ADDR *arg2, CORE_ADDR *arg3)
+dummy_target::auxv_parse (const gdb_byte **arg0, const gdb_byte *arg1,
+ CORE_ADDR *arg2, CORE_ADDR *arg3)
{
return default_auxv_parse (this, arg0, arg1, arg2, arg3);
}
int
-debug_target::auxv_parse (const gdb_byte **arg0, const gdb_byte *arg1, CORE_ADDR *arg2, CORE_ADDR *arg3)
+debug_target::auxv_parse (const gdb_byte **arg0, const gdb_byte *arg1,
+ CORE_ADDR *arg2, CORE_ADDR *arg3)
{
int result;
- gdb_printf (gdb_stdlog, "-> %s->auxv_parse (...)\n", this->beneath ()->shortname ());
+ gdb_printf (gdb_stdlog, "-> %s->auxv_parse (...)\n",
+ this->beneath ()->shortname ());
result = this->beneath ()->auxv_parse (arg0, arg1, arg2, arg3);
- gdb_printf (gdb_stdlog, "<- %s->auxv_parse (", this->beneath ()->shortname ());
+ gdb_printf (gdb_stdlog, "<- %s->auxv_parse (",
+ this->beneath ()->shortname ());
target_debug_print_const_gdb_byte_pp (arg0);
gdb_puts (", ", gdb_stdlog);
target_debug_print_const_gdb_byte_p (arg1);
@@ -2655,24 +2978,31 @@ debug_target::auxv_parse (const gdb_byte **arg0, const gdb_byte *arg1, CORE_ADDR
}
int
-target_ops::search_memory (CORE_ADDR arg0, ULONGEST arg1, const gdb_byte *arg2, ULONGEST arg3, CORE_ADDR *arg4)
+target_ops::search_memory (CORE_ADDR arg0, ULONGEST arg1, const gdb_byte *arg2,
+ ULONGEST arg3, CORE_ADDR *arg4)
{
return this->beneath ()->search_memory (arg0, arg1, arg2, arg3, arg4);
}
int
-dummy_target::search_memory (CORE_ADDR arg0, ULONGEST arg1, const gdb_byte *arg2, ULONGEST arg3, CORE_ADDR *arg4)
+dummy_target::search_memory (CORE_ADDR arg0, ULONGEST arg1,
+ const gdb_byte *arg2, ULONGEST arg3,
+ CORE_ADDR *arg4)
{
return default_search_memory (this, arg0, arg1, arg2, arg3, arg4);
}
int
-debug_target::search_memory (CORE_ADDR arg0, ULONGEST arg1, const gdb_byte *arg2, ULONGEST arg3, CORE_ADDR *arg4)
+debug_target::search_memory (CORE_ADDR arg0, ULONGEST arg1,
+ const gdb_byte *arg2, ULONGEST arg3,
+ CORE_ADDR *arg4)
{
int result;
- gdb_printf (gdb_stdlog, "-> %s->search_memory (...)\n", this->beneath ()->shortname ());
+ gdb_printf (gdb_stdlog, "-> %s->search_memory (...)\n",
+ this->beneath ()->shortname ());
result = this->beneath ()->search_memory (arg0, arg1, arg2, arg3, arg4);
- gdb_printf (gdb_stdlog, "<- %s->search_memory (", this->beneath ()->shortname ());
+ gdb_printf (gdb_stdlog, "<- %s->search_memory (",
+ this->beneath ()->shortname ());
target_debug_print_CORE_ADDR (arg0);
gdb_puts (", ", gdb_stdlog);
target_debug_print_ULONGEST (arg1);
@@ -2704,9 +3034,11 @@ bool
debug_target::can_execute_reverse ()
{
bool result;
- gdb_printf (gdb_stdlog, "-> %s->can_execute_reverse (...)\n", this->beneath ()->shortname ());
+ gdb_printf (gdb_stdlog, "-> %s->can_execute_reverse (...)\n",
+ this->beneath ()->shortname ());
result = this->beneath ()->can_execute_reverse ();
- gdb_printf (gdb_stdlog, "<- %s->can_execute_reverse (", this->beneath ()->shortname ());
+ gdb_printf (gdb_stdlog, "<- %s->can_execute_reverse (",
+ this->beneath ()->shortname ());
gdb_puts (") = ", gdb_stdlog);
target_debug_print_bool (result);
gdb_puts ("\n", gdb_stdlog);
@@ -2729,9 +3061,11 @@ enum exec_direction_kind
debug_target::execution_direction ()
{
enum exec_direction_kind result;
- gdb_printf (gdb_stdlog, "-> %s->execution_direction (...)\n", this->beneath ()->shortname ());
+ gdb_printf (gdb_stdlog, "-> %s->execution_direction (...)\n",
+ this->beneath ()->shortname ());
result = this->beneath ()->execution_direction ();
- gdb_printf (gdb_stdlog, "<- %s->execution_direction (", this->beneath ()->shortname ());
+ gdb_printf (gdb_stdlog, "<- %s->execution_direction (",
+ this->beneath ()->shortname ());
gdb_puts (") = ", gdb_stdlog);
target_debug_print_enum_exec_direction_kind (result);
gdb_puts ("\n", gdb_stdlog);
@@ -2754,9 +3088,11 @@ bool
debug_target::supports_multi_process ()
{
bool result;
- gdb_printf (gdb_stdlog, "-> %s->supports_multi_process (...)\n", this->beneath ()->shortname ());
+ gdb_printf (gdb_stdlog, "-> %s->supports_multi_process (...)\n",
+ this->beneath ()->shortname ());
result = this->beneath ()->supports_multi_process ();
- gdb_printf (gdb_stdlog, "<- %s->supports_multi_process (", this->beneath ()->shortname ());
+ gdb_printf (gdb_stdlog, "<- %s->supports_multi_process (",
+ this->beneath ()->shortname ());
gdb_puts (") = ", gdb_stdlog);
target_debug_print_bool (result);
gdb_puts ("\n", gdb_stdlog);
@@ -2779,9 +3115,11 @@ bool
debug_target::supports_enable_disable_tracepoint ()
{
bool result;
- gdb_printf (gdb_stdlog, "-> %s->supports_enable_disable_tracepoint (...)\n", this->beneath ()->shortname ());
+ gdb_printf (gdb_stdlog, "-> %s->supports_enable_disable_tracepoint (...)\n",
+ this->beneath ()->shortname ());
result = this->beneath ()->supports_enable_disable_tracepoint ();
- gdb_printf (gdb_stdlog, "<- %s->supports_enable_disable_tracepoint (", this->beneath ()->shortname ());
+ gdb_printf (gdb_stdlog, "<- %s->supports_enable_disable_tracepoint (",
+ this->beneath ()->shortname ());
gdb_puts (") = ", gdb_stdlog);
target_debug_print_bool (result);
gdb_puts ("\n", gdb_stdlog);
@@ -2804,9 +3142,11 @@ bool
debug_target::supports_disable_randomization ()
{
bool result;
- gdb_printf (gdb_stdlog, "-> %s->supports_disable_randomization (...)\n", this->beneath ()->shortname ());
+ gdb_printf (gdb_stdlog, "-> %s->supports_disable_randomization (...)\n",
+ this->beneath ()->shortname ());
result = this->beneath ()->supports_disable_randomization ();
- gdb_printf (gdb_stdlog, "<- %s->supports_disable_randomization (", this->beneath ()->shortname ());
+ gdb_printf (gdb_stdlog, "<- %s->supports_disable_randomization (",
+ this->beneath ()->shortname ());
gdb_puts (") = ", gdb_stdlog);
target_debug_print_bool (result);
gdb_puts ("\n", gdb_stdlog);
@@ -2829,9 +3169,11 @@ bool
debug_target::supports_string_tracing ()
{
bool result;
- gdb_printf (gdb_stdlog, "-> %s->supports_string_tracing (...)\n", this->beneath ()->shortname ());
+ gdb_printf (gdb_stdlog, "-> %s->supports_string_tracing (...)\n",
+ this->beneath ()->shortname ());
result = this->beneath ()->supports_string_tracing ();
- gdb_printf (gdb_stdlog, "<- %s->supports_string_tracing (", this->beneath ()->shortname ());
+ gdb_printf (gdb_stdlog, "<- %s->supports_string_tracing (",
+ this->beneath ()->shortname ());
gdb_puts (") = ", gdb_stdlog);
target_debug_print_bool (result);
gdb_puts ("\n", gdb_stdlog);
@@ -2854,9 +3196,13 @@ bool
debug_target::supports_evaluation_of_breakpoint_conditions ()
{
bool result;
- gdb_printf (gdb_stdlog, "-> %s->supports_evaluation_of_breakpoint_conditions (...)\n", this->beneath ()->shortname ());
+ gdb_printf (gdb_stdlog,
+ "-> %s->supports_evaluation_of_breakpoint_conditions (...)\n",
+ this->beneath ()->shortname ());
result = this->beneath ()->supports_evaluation_of_breakpoint_conditions ();
- gdb_printf (gdb_stdlog, "<- %s->supports_evaluation_of_breakpoint_conditions (", this->beneath ()->shortname ());
+ gdb_printf (gdb_stdlog,
+ "<- %s->supports_evaluation_of_breakpoint_conditions (",
+ this->beneath ()->shortname ());
gdb_puts (") = ", gdb_stdlog);
target_debug_print_bool (result);
gdb_puts ("\n", gdb_stdlog);
@@ -2879,9 +3225,11 @@ bool
debug_target::supports_dumpcore ()
{
bool result;
- gdb_printf (gdb_stdlog, "-> %s->supports_dumpcore (...)\n", this->beneath ()->shortname ());
+ gdb_printf (gdb_stdlog, "-> %s->supports_dumpcore (...)\n",
+ this->beneath ()->shortname ());
result = this->beneath ()->supports_dumpcore ();
- gdb_printf (gdb_stdlog, "<- %s->supports_dumpcore (", this->beneath ()->shortname ());
+ gdb_printf (gdb_stdlog, "<- %s->supports_dumpcore (",
+ this->beneath ()->shortname ());
gdb_puts (") = ", gdb_stdlog);
target_debug_print_bool (result);
gdb_puts ("\n", gdb_stdlog);
@@ -2902,7 +3250,8 @@ dummy_target::dumpcore (const char *arg0)
void
debug_target::dumpcore (const char *arg0)
{
- gdb_printf (gdb_stdlog, "-> %s->dumpcore (...)\n", this->beneath ()->shortname ());
+ gdb_printf (gdb_stdlog, "-> %s->dumpcore (...)\n",
+ this->beneath ()->shortname ());
this->beneath ()->dumpcore (arg0);
gdb_printf (gdb_stdlog, "<- %s->dumpcore (", this->beneath ()->shortname ());
target_debug_print_const_char_p (arg0);
@@ -2925,9 +3274,11 @@ bool
debug_target::can_run_breakpoint_commands ()
{
bool result;
- gdb_printf (gdb_stdlog, "-> %s->can_run_breakpoint_commands (...)\n", this->beneath ()->shortname ());
+ gdb_printf (gdb_stdlog, "-> %s->can_run_breakpoint_commands (...)\n",
+ this->beneath ()->shortname ());
result = this->beneath ()->can_run_breakpoint_commands ();
- gdb_printf (gdb_stdlog, "<- %s->can_run_breakpoint_commands (", this->beneath ()->shortname ());
+ gdb_printf (gdb_stdlog, "<- %s->can_run_breakpoint_commands (",
+ this->beneath ()->shortname ());
gdb_puts (") = ", gdb_stdlog);
target_debug_print_bool (result);
gdb_puts ("\n", gdb_stdlog);
@@ -2949,10 +3300,12 @@ dummy_target::thread_architecture (ptid_t arg0)
struct gdbarch *
debug_target::thread_architecture (ptid_t arg0)
{
- struct gdbarch * result;
- gdb_printf (gdb_stdlog, "-> %s->thread_architecture (...)\n", this->beneath ()->shortname ());
+ struct gdbarch *result;
+ gdb_printf (gdb_stdlog, "-> %s->thread_architecture (...)\n",
+ this->beneath ()->shortname ());
result = this->beneath ()->thread_architecture (arg0);
- gdb_printf (gdb_stdlog, "<- %s->thread_architecture (", this->beneath ()->shortname ());
+ gdb_printf (gdb_stdlog, "<- %s->thread_architecture (",
+ this->beneath ()->shortname ());
target_debug_print_ptid_t (arg0);
gdb_puts (") = ", gdb_stdlog);
target_debug_print_struct_gdbarch_p (result);
@@ -2975,10 +3328,12 @@ dummy_target::thread_address_space (ptid_t arg0)
struct address_space *
debug_target::thread_address_space (ptid_t arg0)
{
- struct address_space * result;
- gdb_printf (gdb_stdlog, "-> %s->thread_address_space (...)\n", this->beneath ()->shortname ());
+ struct address_space *result;
+ gdb_printf (gdb_stdlog, "-> %s->thread_address_space (...)\n",
+ this->beneath ()->shortname ());
result = this->beneath ()->thread_address_space (arg0);
- gdb_printf (gdb_stdlog, "<- %s->thread_address_space (", this->beneath ()->shortname ());
+ gdb_printf (gdb_stdlog, "<- %s->thread_address_space (",
+ this->beneath ()->shortname ());
target_debug_print_ptid_t (arg0);
gdb_puts (") = ", gdb_stdlog);
target_debug_print_struct_address_space_p (result);
@@ -3002,9 +3357,11 @@ bool
debug_target::filesystem_is_local ()
{
bool result;
- gdb_printf (gdb_stdlog, "-> %s->filesystem_is_local (...)\n", this->beneath ()->shortname ());
+ gdb_printf (gdb_stdlog, "-> %s->filesystem_is_local (...)\n",
+ this->beneath ()->shortname ());
result = this->beneath ()->filesystem_is_local ();
- gdb_printf (gdb_stdlog, "<- %s->filesystem_is_local (", this->beneath ()->shortname ());
+ gdb_printf (gdb_stdlog, "<- %s->filesystem_is_local (",
+ this->beneath ()->shortname ());
gdb_puts (") = ", gdb_stdlog);
target_debug_print_bool (result);
gdb_puts ("\n", gdb_stdlog);
@@ -3026,9 +3383,11 @@ dummy_target::trace_init ()
void
debug_target::trace_init ()
{
- gdb_printf (gdb_stdlog, "-> %s->trace_init (...)\n", this->beneath ()->shortname ());
+ gdb_printf (gdb_stdlog, "-> %s->trace_init (...)\n",
+ this->beneath ()->shortname ());
this->beneath ()->trace_init ();
- gdb_printf (gdb_stdlog, "<- %s->trace_init (", this->beneath ()->shortname ());
+ gdb_printf (gdb_stdlog, "<- %s->trace_init (",
+ this->beneath ()->shortname ());
gdb_puts (")\n", gdb_stdlog);
}
@@ -3047,9 +3406,11 @@ dummy_target::download_tracepoint (struct bp_location *arg0)
void
debug_target::download_tracepoint (struct bp_location *arg0)
{
- gdb_printf (gdb_stdlog, "-> %s->download_tracepoint (...)\n", this->beneath ()->shortname ());
+ gdb_printf (gdb_stdlog, "-> %s->download_tracepoint (...)\n",
+ this->beneath ()->shortname ());
this->beneath ()->download_tracepoint (arg0);
- gdb_printf (gdb_stdlog, "<- %s->download_tracepoint (", this->beneath ()->shortname ());
+ gdb_printf (gdb_stdlog, "<- %s->download_tracepoint (",
+ this->beneath ()->shortname ());
target_debug_print_struct_bp_location_p (arg0);
gdb_puts (")\n", gdb_stdlog);
}
@@ -3070,9 +3431,11 @@ bool
debug_target::can_download_tracepoint ()
{
bool result;
- gdb_printf (gdb_stdlog, "-> %s->can_download_tracepoint (...)\n", this->beneath ()->shortname ());
+ gdb_printf (gdb_stdlog, "-> %s->can_download_tracepoint (...)\n",
+ this->beneath ()->shortname ());
result = this->beneath ()->can_download_tracepoint ();
- gdb_printf (gdb_stdlog, "<- %s->can_download_tracepoint (", this->beneath ()->shortname ());
+ gdb_printf (gdb_stdlog, "<- %s->can_download_tracepoint (",
+ this->beneath ()->shortname ());
gdb_puts (") = ", gdb_stdlog);
target_debug_print_bool (result);
gdb_puts ("\n", gdb_stdlog);
@@ -3094,9 +3457,11 @@ dummy_target::download_trace_state_variable (const trace_state_variable &arg0)
void
debug_target::download_trace_state_variable (const trace_state_variable &arg0)
{
- gdb_printf (gdb_stdlog, "-> %s->download_trace_state_variable (...)\n", this->beneath ()->shortname ());
+ gdb_printf (gdb_stdlog, "-> %s->download_trace_state_variable (...)\n",
+ this->beneath ()->shortname ());
this->beneath ()->download_trace_state_variable (arg0);
- gdb_printf (gdb_stdlog, "<- %s->download_trace_state_variable (", this->beneath ()->shortname ());
+ gdb_printf (gdb_stdlog, "<- %s->download_trace_state_variable (",
+ this->beneath ()->shortname ());
target_debug_print_const_trace_state_variable_r (arg0);
gdb_puts (")\n", gdb_stdlog);
}
@@ -3116,9 +3481,11 @@ dummy_target::enable_tracepoint (struct bp_location *arg0)
void
debug_target::enable_tracepoint (struct bp_location *arg0)
{
- gdb_printf (gdb_stdlog, "-> %s->enable_tracepoint (...)\n", this->beneath ()->shortname ());
+ gdb_printf (gdb_stdlog, "-> %s->enable_tracepoint (...)\n",
+ this->beneath ()->shortname ());
this->beneath ()->enable_tracepoint (arg0);
- gdb_printf (gdb_stdlog, "<- %s->enable_tracepoint (", this->beneath ()->shortname ());
+ gdb_printf (gdb_stdlog, "<- %s->enable_tracepoint (",
+ this->beneath ()->shortname ());
target_debug_print_struct_bp_location_p (arg0);
gdb_puts (")\n", gdb_stdlog);
}
@@ -3138,9 +3505,11 @@ dummy_target::disable_tracepoint (struct bp_location *arg0)
void
debug_target::disable_tracepoint (struct bp_location *arg0)
{
- gdb_printf (gdb_stdlog, "-> %s->disable_tracepoint (...)\n", this->beneath ()->shortname ());
+ gdb_printf (gdb_stdlog, "-> %s->disable_tracepoint (...)\n",
+ this->beneath ()->shortname ());
this->beneath ()->disable_tracepoint (arg0);
- gdb_printf (gdb_stdlog, "<- %s->disable_tracepoint (", this->beneath ()->shortname ());
+ gdb_printf (gdb_stdlog, "<- %s->disable_tracepoint (",
+ this->beneath ()->shortname ());
target_debug_print_struct_bp_location_p (arg0);
gdb_puts (")\n", gdb_stdlog);
}
@@ -3160,9 +3529,11 @@ dummy_target::trace_set_readonly_regions ()
void
debug_target::trace_set_readonly_regions ()
{
- gdb_printf (gdb_stdlog, "-> %s->trace_set_readonly_regions (...)\n", this->beneath ()->shortname ());
+ gdb_printf (gdb_stdlog, "-> %s->trace_set_readonly_regions (...)\n",
+ this->beneath ()->shortname ());
this->beneath ()->trace_set_readonly_regions ();
- gdb_printf (gdb_stdlog, "<- %s->trace_set_readonly_regions (", this->beneath ()->shortname ());
+ gdb_printf (gdb_stdlog, "<- %s->trace_set_readonly_regions (",
+ this->beneath ()->shortname ());
gdb_puts (")\n", gdb_stdlog);
}
@@ -3181,9 +3552,11 @@ dummy_target::trace_start ()
void
debug_target::trace_start ()
{
- gdb_printf (gdb_stdlog, "-> %s->trace_start (...)\n", this->beneath ()->shortname ());
+ gdb_printf (gdb_stdlog, "-> %s->trace_start (...)\n",
+ this->beneath ()->shortname ());
this->beneath ()->trace_start ();
- gdb_printf (gdb_stdlog, "<- %s->trace_start (", this->beneath ()->shortname ());
+ gdb_printf (gdb_stdlog, "<- %s->trace_start (",
+ this->beneath ()->shortname ());
gdb_puts (")\n", gdb_stdlog);
}
@@ -3203,9 +3576,11 @@ int
debug_target::get_trace_status (struct trace_status *arg0)
{
int result;
- gdb_printf (gdb_stdlog, "-> %s->get_trace_status (...)\n", this->beneath ()->shortname ());
+ gdb_printf (gdb_stdlog, "-> %s->get_trace_status (...)\n",
+ this->beneath ()->shortname ());
result = this->beneath ()->get_trace_status (arg0);
- gdb_printf (gdb_stdlog, "<- %s->get_trace_status (", this->beneath ()->shortname ());
+ gdb_printf (gdb_stdlog, "<- %s->get_trace_status (",
+ this->beneath ()->shortname ());
target_debug_print_struct_trace_status_p (arg0);
gdb_puts (") = ", gdb_stdlog);
target_debug_print_int (result);
@@ -3214,23 +3589,28 @@ debug_target::get_trace_status (struct trace_status *arg0)
}
void
-target_ops::get_tracepoint_status (struct breakpoint *arg0, struct uploaded_tp *arg1)
+target_ops::get_tracepoint_status (struct breakpoint *arg0,
+ struct uploaded_tp *arg1)
{
this->beneath ()->get_tracepoint_status (arg0, arg1);
}
void
-dummy_target::get_tracepoint_status (struct breakpoint *arg0, struct uploaded_tp *arg1)
+dummy_target::get_tracepoint_status (struct breakpoint *arg0,
+ struct uploaded_tp *arg1)
{
tcomplain ();
}
void
-debug_target::get_tracepoint_status (struct breakpoint *arg0, struct uploaded_tp *arg1)
+debug_target::get_tracepoint_status (struct breakpoint *arg0,
+ struct uploaded_tp *arg1)
{
- gdb_printf (gdb_stdlog, "-> %s->get_tracepoint_status (...)\n", this->beneath ()->shortname ());
+ gdb_printf (gdb_stdlog, "-> %s->get_tracepoint_status (...)\n",
+ this->beneath ()->shortname ());
this->beneath ()->get_tracepoint_status (arg0, arg1);
- gdb_printf (gdb_stdlog, "<- %s->get_tracepoint_status (", this->beneath ()->shortname ());
+ gdb_printf (gdb_stdlog, "<- %s->get_tracepoint_status (",
+ this->beneath ()->shortname ());
target_debug_print_struct_breakpoint_p (arg0);
gdb_puts (", ", gdb_stdlog);
target_debug_print_struct_uploaded_tp_p (arg1);
@@ -3252,31 +3632,38 @@ dummy_target::trace_stop ()
void
debug_target::trace_stop ()
{
- gdb_printf (gdb_stdlog, "-> %s->trace_stop (...)\n", this->beneath ()->shortname ());
+ gdb_printf (gdb_stdlog, "-> %s->trace_stop (...)\n",
+ this->beneath ()->shortname ());
this->beneath ()->trace_stop ();
- gdb_printf (gdb_stdlog, "<- %s->trace_stop (", this->beneath ()->shortname ());
+ gdb_printf (gdb_stdlog, "<- %s->trace_stop (",
+ this->beneath ()->shortname ());
gdb_puts (")\n", gdb_stdlog);
}
int
-target_ops::trace_find (enum trace_find_type arg0, int arg1, CORE_ADDR arg2, CORE_ADDR arg3, int *arg4)
+target_ops::trace_find (enum trace_find_type arg0, int arg1, CORE_ADDR arg2,
+ CORE_ADDR arg3, int *arg4)
{
return this->beneath ()->trace_find (arg0, arg1, arg2, arg3, arg4);
}
int
-dummy_target::trace_find (enum trace_find_type arg0, int arg1, CORE_ADDR arg2, CORE_ADDR arg3, int *arg4)
+dummy_target::trace_find (enum trace_find_type arg0, int arg1, CORE_ADDR arg2,
+ CORE_ADDR arg3, int *arg4)
{
return -1;
}
int
-debug_target::trace_find (enum trace_find_type arg0, int arg1, CORE_ADDR arg2, CORE_ADDR arg3, int *arg4)
+debug_target::trace_find (enum trace_find_type arg0, int arg1, CORE_ADDR arg2,
+ CORE_ADDR arg3, int *arg4)
{
int result;
- gdb_printf (gdb_stdlog, "-> %s->trace_find (...)\n", this->beneath ()->shortname ());
+ gdb_printf (gdb_stdlog, "-> %s->trace_find (...)\n",
+ this->beneath ()->shortname ());
result = this->beneath ()->trace_find (arg0, arg1, arg2, arg3, arg4);
- gdb_printf (gdb_stdlog, "<- %s->trace_find (", this->beneath ()->shortname ());
+ gdb_printf (gdb_stdlog, "<- %s->trace_find (",
+ this->beneath ()->shortname ());
target_debug_print_enum_trace_find_type (arg0);
gdb_puts (", ", gdb_stdlog);
target_debug_print_int (arg1);
@@ -3308,9 +3695,11 @@ bool
debug_target::get_trace_state_variable_value (int arg0, LONGEST *arg1)
{
bool result;
- gdb_printf (gdb_stdlog, "-> %s->get_trace_state_variable_value (...)\n", this->beneath ()->shortname ());
+ gdb_printf (gdb_stdlog, "-> %s->get_trace_state_variable_value (...)\n",
+ this->beneath ()->shortname ());
result = this->beneath ()->get_trace_state_variable_value (arg0, arg1);
- gdb_printf (gdb_stdlog, "<- %s->get_trace_state_variable_value (", this->beneath ()->shortname ());
+ gdb_printf (gdb_stdlog, "<- %s->get_trace_state_variable_value (",
+ this->beneath ()->shortname ());
target_debug_print_int (arg0);
gdb_puts (", ", gdb_stdlog);
target_debug_print_LONGEST_p (arg1);
@@ -3336,9 +3725,11 @@ int
debug_target::save_trace_data (const char *arg0)
{
int result;
- gdb_printf (gdb_stdlog, "-> %s->save_trace_data (...)\n", this->beneath ()->shortname ());
+ gdb_printf (gdb_stdlog, "-> %s->save_trace_data (...)\n",
+ this->beneath ()->shortname ());
result = this->beneath ()->save_trace_data (arg0);
- gdb_printf (gdb_stdlog, "<- %s->save_trace_data (", this->beneath ()->shortname ());
+ gdb_printf (gdb_stdlog, "<- %s->save_trace_data (",
+ this->beneath ()->shortname ());
target_debug_print_const_char_p (arg0);
gdb_puts (") = ", gdb_stdlog);
target_debug_print_int (result);
@@ -3362,9 +3753,11 @@ int
debug_target::upload_tracepoints (struct uploaded_tp **arg0)
{
int result;
- gdb_printf (gdb_stdlog, "-> %s->upload_tracepoints (...)\n", this->beneath ()->shortname ());
+ gdb_printf (gdb_stdlog, "-> %s->upload_tracepoints (...)\n",
+ this->beneath ()->shortname ());
result = this->beneath ()->upload_tracepoints (arg0);
- gdb_printf (gdb_stdlog, "<- %s->upload_tracepoints (", this->beneath ()->shortname ());
+ gdb_printf (gdb_stdlog, "<- %s->upload_tracepoints (",
+ this->beneath ()->shortname ());
target_debug_print_struct_uploaded_tp_pp (arg0);
gdb_puts (") = ", gdb_stdlog);
target_debug_print_int (result);
@@ -3388,9 +3781,11 @@ int
debug_target::upload_trace_state_variables (struct uploaded_tsv **arg0)
{
int result;
- gdb_printf (gdb_stdlog, "-> %s->upload_trace_state_variables (...)\n", this->beneath ()->shortname ());
+ gdb_printf (gdb_stdlog, "-> %s->upload_trace_state_variables (...)\n",
+ this->beneath ()->shortname ());
result = this->beneath ()->upload_trace_state_variables (arg0);
- gdb_printf (gdb_stdlog, "<- %s->upload_trace_state_variables (", this->beneath ()->shortname ());
+ gdb_printf (gdb_stdlog, "<- %s->upload_trace_state_variables (",
+ this->beneath ()->shortname ());
target_debug_print_struct_uploaded_tsv_pp (arg0);
gdb_puts (") = ", gdb_stdlog);
target_debug_print_int (result);
@@ -3414,9 +3809,11 @@ LONGEST
debug_target::get_raw_trace_data (gdb_byte *arg0, ULONGEST arg1, LONGEST arg2)
{
LONGEST result;
- gdb_printf (gdb_stdlog, "-> %s->get_raw_trace_data (...)\n", this->beneath ()->shortname ());
+ gdb_printf (gdb_stdlog, "-> %s->get_raw_trace_data (...)\n",
+ this->beneath ()->shortname ());
result = this->beneath ()->get_raw_trace_data (arg0, arg1, arg2);
- gdb_printf (gdb_stdlog, "<- %s->get_raw_trace_data (", this->beneath ()->shortname ());
+ gdb_printf (gdb_stdlog, "<- %s->get_raw_trace_data (",
+ this->beneath ()->shortname ());
target_debug_print_gdb_byte_p (arg0);
gdb_puts (", ", gdb_stdlog);
target_debug_print_ULONGEST (arg1);
@@ -3444,9 +3841,11 @@ int
debug_target::get_min_fast_tracepoint_insn_len ()
{
int result;
- gdb_printf (gdb_stdlog, "-> %s->get_min_fast_tracepoint_insn_len (...)\n", this->beneath ()->shortname ());
+ gdb_printf (gdb_stdlog, "-> %s->get_min_fast_tracepoint_insn_len (...)\n",
+ this->beneath ()->shortname ());
result = this->beneath ()->get_min_fast_tracepoint_insn_len ();
- gdb_printf (gdb_stdlog, "<- %s->get_min_fast_tracepoint_insn_len (", this->beneath ()->shortname ());
+ gdb_printf (gdb_stdlog, "<- %s->get_min_fast_tracepoint_insn_len (",
+ this->beneath ()->shortname ());
gdb_puts (") = ", gdb_stdlog);
target_debug_print_int (result);
gdb_puts ("\n", gdb_stdlog);
@@ -3467,9 +3866,11 @@ dummy_target::set_disconnected_tracing (int arg0)
void
debug_target::set_disconnected_tracing (int arg0)
{
- gdb_printf (gdb_stdlog, "-> %s->set_disconnected_tracing (...)\n", this->beneath ()->shortname ());
+ gdb_printf (gdb_stdlog, "-> %s->set_disconnected_tracing (...)\n",
+ this->beneath ()->shortname ());
this->beneath ()->set_disconnected_tracing (arg0);
- gdb_printf (gdb_stdlog, "<- %s->set_disconnected_tracing (", this->beneath ()->shortname ());
+ gdb_printf (gdb_stdlog, "<- %s->set_disconnected_tracing (",
+ this->beneath ()->shortname ());
target_debug_print_int (arg0);
gdb_puts (")\n", gdb_stdlog);
}
@@ -3488,9 +3889,11 @@ dummy_target::set_circular_trace_buffer (int arg0)
void
debug_target::set_circular_trace_buffer (int arg0)
{
- gdb_printf (gdb_stdlog, "-> %s->set_circular_trace_buffer (...)\n", this->beneath ()->shortname ());
+ gdb_printf (gdb_stdlog, "-> %s->set_circular_trace_buffer (...)\n",
+ this->beneath ()->shortname ());
this->beneath ()->set_circular_trace_buffer (arg0);
- gdb_printf (gdb_stdlog, "<- %s->set_circular_trace_buffer (", this->beneath ()->shortname ());
+ gdb_printf (gdb_stdlog, "<- %s->set_circular_trace_buffer (",
+ this->beneath ()->shortname ());
target_debug_print_int (arg0);
gdb_puts (")\n", gdb_stdlog);
}
@@ -3509,32 +3912,39 @@ dummy_target::set_trace_buffer_size (LONGEST arg0)
void
debug_target::set_trace_buffer_size (LONGEST arg0)
{
- gdb_printf (gdb_stdlog, "-> %s->set_trace_buffer_size (...)\n", this->beneath ()->shortname ());
+ gdb_printf (gdb_stdlog, "-> %s->set_trace_buffer_size (...)\n",
+ this->beneath ()->shortname ());
this->beneath ()->set_trace_buffer_size (arg0);
- gdb_printf (gdb_stdlog, "<- %s->set_trace_buffer_size (", this->beneath ()->shortname ());
+ gdb_printf (gdb_stdlog, "<- %s->set_trace_buffer_size (",
+ this->beneath ()->shortname ());
target_debug_print_LONGEST (arg0);
gdb_puts (")\n", gdb_stdlog);
}
bool
-target_ops::set_trace_notes (const char *arg0, const char *arg1, const char *arg2)
+target_ops::set_trace_notes (const char *arg0, const char *arg1,
+ const char *arg2)
{
return this->beneath ()->set_trace_notes (arg0, arg1, arg2);
}
bool
-dummy_target::set_trace_notes (const char *arg0, const char *arg1, const char *arg2)
+dummy_target::set_trace_notes (const char *arg0, const char *arg1,
+ const char *arg2)
{
return false;
}
bool
-debug_target::set_trace_notes (const char *arg0, const char *arg1, const char *arg2)
+debug_target::set_trace_notes (const char *arg0, const char *arg1,
+ const char *arg2)
{
bool result;
- gdb_printf (gdb_stdlog, "-> %s->set_trace_notes (...)\n", this->beneath ()->shortname ());
+ gdb_printf (gdb_stdlog, "-> %s->set_trace_notes (...)\n",
+ this->beneath ()->shortname ());
result = this->beneath ()->set_trace_notes (arg0, arg1, arg2);
- gdb_printf (gdb_stdlog, "<- %s->set_trace_notes (", this->beneath ()->shortname ());
+ gdb_printf (gdb_stdlog, "<- %s->set_trace_notes (",
+ this->beneath ()->shortname ());
target_debug_print_const_char_p (arg0);
gdb_puts (", ", gdb_stdlog);
target_debug_print_const_char_p (arg1);
@@ -3562,9 +3972,11 @@ int
debug_target::core_of_thread (ptid_t arg0)
{
int result;
- gdb_printf (gdb_stdlog, "-> %s->core_of_thread (...)\n", this->beneath ()->shortname ());
+ gdb_printf (gdb_stdlog, "-> %s->core_of_thread (...)\n",
+ this->beneath ()->shortname ());
result = this->beneath ()->core_of_thread (arg0);
- gdb_printf (gdb_stdlog, "<- %s->core_of_thread (", this->beneath ()->shortname ());
+ gdb_printf (gdb_stdlog, "<- %s->core_of_thread (",
+ this->beneath ()->shortname ());
target_debug_print_ptid_t (arg0);
gdb_puts (") = ", gdb_stdlog);
target_debug_print_int (result);
@@ -3579,18 +3991,22 @@ target_ops::verify_memory (const gdb_byte *arg0, CORE_ADDR arg1, ULONGEST arg2)
}
int
-dummy_target::verify_memory (const gdb_byte *arg0, CORE_ADDR arg1, ULONGEST arg2)
+dummy_target::verify_memory (const gdb_byte *arg0, CORE_ADDR arg1,
+ ULONGEST arg2)
{
return default_verify_memory (this, arg0, arg1, arg2);
}
int
-debug_target::verify_memory (const gdb_byte *arg0, CORE_ADDR arg1, ULONGEST arg2)
+debug_target::verify_memory (const gdb_byte *arg0, CORE_ADDR arg1,
+ ULONGEST arg2)
{
int result;
- gdb_printf (gdb_stdlog, "-> %s->verify_memory (...)\n", this->beneath ()->shortname ());
+ gdb_printf (gdb_stdlog, "-> %s->verify_memory (...)\n",
+ this->beneath ()->shortname ());
result = this->beneath ()->verify_memory (arg0, arg1, arg2);
- gdb_printf (gdb_stdlog, "<- %s->verify_memory (", this->beneath ()->shortname ());
+ gdb_printf (gdb_stdlog, "<- %s->verify_memory (",
+ this->beneath ()->shortname ());
target_debug_print_const_gdb_byte_p (arg0);
gdb_puts (", ", gdb_stdlog);
target_debug_print_CORE_ADDR (arg1);
@@ -3618,9 +4034,11 @@ bool
debug_target::get_tib_address (ptid_t arg0, CORE_ADDR *arg1)
{
bool result;
- gdb_printf (gdb_stdlog, "-> %s->get_tib_address (...)\n", this->beneath ()->shortname ());
+ gdb_printf (gdb_stdlog, "-> %s->get_tib_address (...)\n",
+ this->beneath ()->shortname ());
result = this->beneath ()->get_tib_address (arg0, arg1);
- gdb_printf (gdb_stdlog, "<- %s->get_tib_address (", this->beneath ()->shortname ());
+ gdb_printf (gdb_stdlog, "<- %s->get_tib_address (",
+ this->beneath ()->shortname ());
target_debug_print_ptid_t (arg0);
gdb_puts (", ", gdb_stdlog);
target_debug_print_CORE_ADDR_p (arg1);
@@ -3644,31 +4062,38 @@ dummy_target::set_permissions ()
void
debug_target::set_permissions ()
{
- gdb_printf (gdb_stdlog, "-> %s->set_permissions (...)\n", this->beneath ()->shortname ());
+ gdb_printf (gdb_stdlog, "-> %s->set_permissions (...)\n",
+ this->beneath ()->shortname ());
this->beneath ()->set_permissions ();
- gdb_printf (gdb_stdlog, "<- %s->set_permissions (", this->beneath ()->shortname ());
+ gdb_printf (gdb_stdlog, "<- %s->set_permissions (",
+ this->beneath ()->shortname ());
gdb_puts (")\n", gdb_stdlog);
}
bool
-target_ops::static_tracepoint_marker_at (CORE_ADDR arg0, static_tracepoint_marker *arg1)
+target_ops::static_tracepoint_marker_at (CORE_ADDR arg0,
+ static_tracepoint_marker *arg1)
{
return this->beneath ()->static_tracepoint_marker_at (arg0, arg1);
}
bool
-dummy_target::static_tracepoint_marker_at (CORE_ADDR arg0, static_tracepoint_marker *arg1)
+dummy_target::static_tracepoint_marker_at (CORE_ADDR arg0,
+ static_tracepoint_marker *arg1)
{
return false;
}
bool
-debug_target::static_tracepoint_marker_at (CORE_ADDR arg0, static_tracepoint_marker *arg1)
+debug_target::static_tracepoint_marker_at (CORE_ADDR arg0,
+ static_tracepoint_marker *arg1)
{
bool result;
- gdb_printf (gdb_stdlog, "-> %s->static_tracepoint_marker_at (...)\n", this->beneath ()->shortname ());
+ gdb_printf (gdb_stdlog, "-> %s->static_tracepoint_marker_at (...)\n",
+ this->beneath ()->shortname ());
result = this->beneath ()->static_tracepoint_marker_at (arg0, arg1);
- gdb_printf (gdb_stdlog, "<- %s->static_tracepoint_marker_at (", this->beneath ()->shortname ());
+ gdb_printf (gdb_stdlog, "<- %s->static_tracepoint_marker_at (",
+ this->beneath ()->shortname ());
target_debug_print_CORE_ADDR (arg0);
gdb_puts (", ", gdb_stdlog);
target_debug_print_static_tracepoint_marker_p (arg1);
@@ -3694,9 +4119,11 @@ std::vector<static_tracepoint_marker>
debug_target::static_tracepoint_markers_by_strid (const char *arg0)
{
std::vector<static_tracepoint_marker> result;
- gdb_printf (gdb_stdlog, "-> %s->static_tracepoint_markers_by_strid (...)\n", this->beneath ()->shortname ());
+ gdb_printf (gdb_stdlog, "-> %s->static_tracepoint_markers_by_strid (...)\n",
+ this->beneath ()->shortname ());
result = this->beneath ()->static_tracepoint_markers_by_strid (arg0);
- gdb_printf (gdb_stdlog, "<- %s->static_tracepoint_markers_by_strid (", this->beneath ()->shortname ());
+ gdb_printf (gdb_stdlog, "<- %s->static_tracepoint_markers_by_strid (",
+ this->beneath ()->shortname ());
target_debug_print_const_char_p (arg0);
gdb_puts (") = ", gdb_stdlog);
target_debug_print_std_vector_static_tracepoint_marker (result);
@@ -3720,9 +4147,11 @@ traceframe_info_up
debug_target::traceframe_info ()
{
traceframe_info_up result;
- gdb_printf (gdb_stdlog, "-> %s->traceframe_info (...)\n", this->beneath ()->shortname ());
+ gdb_printf (gdb_stdlog, "-> %s->traceframe_info (...)\n",
+ this->beneath ()->shortname ());
result = this->beneath ()->traceframe_info ();
- gdb_printf (gdb_stdlog, "<- %s->traceframe_info (", this->beneath ()->shortname ());
+ gdb_printf (gdb_stdlog, "<- %s->traceframe_info (",
+ this->beneath ()->shortname ());
gdb_puts (") = ", gdb_stdlog);
target_debug_print_traceframe_info_up (result);
gdb_puts ("\n", gdb_stdlog);
@@ -3745,9 +4174,11 @@ bool
debug_target::use_agent (bool arg0)
{
bool result;
- gdb_printf (gdb_stdlog, "-> %s->use_agent (...)\n", this->beneath ()->shortname ());
+ gdb_printf (gdb_stdlog, "-> %s->use_agent (...)\n",
+ this->beneath ()->shortname ());
result = this->beneath ()->use_agent (arg0);
- gdb_printf (gdb_stdlog, "<- %s->use_agent (", this->beneath ()->shortname ());
+ gdb_printf (gdb_stdlog, "<- %s->use_agent (",
+ this->beneath ()->shortname ());
target_debug_print_bool (arg0);
gdb_puts (") = ", gdb_stdlog);
target_debug_print_bool (result);
@@ -3771,9 +4202,11 @@ bool
debug_target::can_use_agent ()
{
bool result;
- gdb_printf (gdb_stdlog, "-> %s->can_use_agent (...)\n", this->beneath ()->shortname ());
+ gdb_printf (gdb_stdlog, "-> %s->can_use_agent (...)\n",
+ this->beneath ()->shortname ());
result = this->beneath ()->can_use_agent ();
- gdb_printf (gdb_stdlog, "<- %s->can_use_agent (", this->beneath ()->shortname ());
+ gdb_printf (gdb_stdlog, "<- %s->can_use_agent (",
+ this->beneath ()->shortname ());
gdb_puts (") = ", gdb_stdlog);
target_debug_print_bool (result);
gdb_puts ("\n", gdb_stdlog);
@@ -3787,18 +4220,22 @@ target_ops::enable_btrace (thread_info *arg0, const struct btrace_config *arg1)
}
struct btrace_target_info *
-dummy_target::enable_btrace (thread_info *arg0, const struct btrace_config *arg1)
+dummy_target::enable_btrace (thread_info *arg0,
+ const struct btrace_config *arg1)
{
tcomplain ();
}
struct btrace_target_info *
-debug_target::enable_btrace (thread_info *arg0, const struct btrace_config *arg1)
+debug_target::enable_btrace (thread_info *arg0,
+ const struct btrace_config *arg1)
{
- struct btrace_target_info * result;
- gdb_printf (gdb_stdlog, "-> %s->enable_btrace (...)\n", this->beneath ()->shortname ());
+ struct btrace_target_info *result;
+ gdb_printf (gdb_stdlog, "-> %s->enable_btrace (...)\n",
+ this->beneath ()->shortname ());
result = this->beneath ()->enable_btrace (arg0, arg1);
- gdb_printf (gdb_stdlog, "<- %s->enable_btrace (", this->beneath ()->shortname ());
+ gdb_printf (gdb_stdlog, "<- %s->enable_btrace (",
+ this->beneath ()->shortname ());
target_debug_print_thread_info_p (arg0);
gdb_puts (", ", gdb_stdlog);
target_debug_print_const_struct_btrace_config_p (arg1);
@@ -3823,9 +4260,11 @@ dummy_target::disable_btrace (struct btrace_target_info *arg0)
void
debug_target::disable_btrace (struct btrace_target_info *arg0)
{
- gdb_printf (gdb_stdlog, "-> %s->disable_btrace (...)\n", this->beneath ()->shortname ());
+ gdb_printf (gdb_stdlog, "-> %s->disable_btrace (...)\n",
+ this->beneath ()->shortname ());
this->beneath ()->disable_btrace (arg0);
- gdb_printf (gdb_stdlog, "<- %s->disable_btrace (", this->beneath ()->shortname ());
+ gdb_printf (gdb_stdlog, "<- %s->disable_btrace (",
+ this->beneath ()->shortname ());
target_debug_print_struct_btrace_target_info_p (arg0);
gdb_puts (")\n", gdb_stdlog);
}
@@ -3845,32 +4284,42 @@ dummy_target::teardown_btrace (struct btrace_target_info *arg0)
void
debug_target::teardown_btrace (struct btrace_target_info *arg0)
{
- gdb_printf (gdb_stdlog, "-> %s->teardown_btrace (...)\n", this->beneath ()->shortname ());
+ gdb_printf (gdb_stdlog, "-> %s->teardown_btrace (...)\n",
+ this->beneath ()->shortname ());
this->beneath ()->teardown_btrace (arg0);
- gdb_printf (gdb_stdlog, "<- %s->teardown_btrace (", this->beneath ()->shortname ());
+ gdb_printf (gdb_stdlog, "<- %s->teardown_btrace (",
+ this->beneath ()->shortname ());
target_debug_print_struct_btrace_target_info_p (arg0);
gdb_puts (")\n", gdb_stdlog);
}
enum btrace_error
-target_ops::read_btrace (struct btrace_data *arg0, struct btrace_target_info *arg1, enum btrace_read_type arg2)
+target_ops::read_btrace (struct btrace_data *arg0,
+ struct btrace_target_info *arg1,
+ enum btrace_read_type arg2)
{
return this->beneath ()->read_btrace (arg0, arg1, arg2);
}
enum btrace_error
-dummy_target::read_btrace (struct btrace_data *arg0, struct btrace_target_info *arg1, enum btrace_read_type arg2)
+dummy_target::read_btrace (struct btrace_data *arg0,
+ struct btrace_target_info *arg1,
+ enum btrace_read_type arg2)
{
tcomplain ();
}
enum btrace_error
-debug_target::read_btrace (struct btrace_data *arg0, struct btrace_target_info *arg1, enum btrace_read_type arg2)
+debug_target::read_btrace (struct btrace_data *arg0,
+ struct btrace_target_info *arg1,
+ enum btrace_read_type arg2)
{
enum btrace_error result;
- gdb_printf (gdb_stdlog, "-> %s->read_btrace (...)\n", this->beneath ()->shortname ());
+ gdb_printf (gdb_stdlog, "-> %s->read_btrace (...)\n",
+ this->beneath ()->shortname ());
result = this->beneath ()->read_btrace (arg0, arg1, arg2);
- gdb_printf (gdb_stdlog, "<- %s->read_btrace (", this->beneath ()->shortname ());
+ gdb_printf (gdb_stdlog, "<- %s->read_btrace (",
+ this->beneath ()->shortname ());
target_debug_print_struct_btrace_data_p (arg0);
gdb_puts (", ", gdb_stdlog);
target_debug_print_struct_btrace_target_info_p (arg1);
@@ -3897,10 +4346,12 @@ dummy_target::btrace_conf (const struct btrace_target_info *arg0)
const struct btrace_config *
debug_target::btrace_conf (const struct btrace_target_info *arg0)
{
- const struct btrace_config * result;
- gdb_printf (gdb_stdlog, "-> %s->btrace_conf (...)\n", this->beneath ()->shortname ());
+ const struct btrace_config *result;
+ gdb_printf (gdb_stdlog, "-> %s->btrace_conf (...)\n",
+ this->beneath ()->shortname ());
result = this->beneath ()->btrace_conf (arg0);
- gdb_printf (gdb_stdlog, "<- %s->btrace_conf (", this->beneath ()->shortname ());
+ gdb_printf (gdb_stdlog, "<- %s->btrace_conf (",
+ this->beneath ()->shortname ());
target_debug_print_const_struct_btrace_target_info_p (arg0);
gdb_puts (") = ", gdb_stdlog);
target_debug_print_const_struct_btrace_config_p (result);
@@ -3924,9 +4375,11 @@ enum record_method
debug_target::record_method (ptid_t arg0)
{
enum record_method result;
- gdb_printf (gdb_stdlog, "-> %s->record_method (...)\n", this->beneath ()->shortname ());
+ gdb_printf (gdb_stdlog, "-> %s->record_method (...)\n",
+ this->beneath ()->shortname ());
result = this->beneath ()->record_method (arg0);
- gdb_printf (gdb_stdlog, "<- %s->record_method (", this->beneath ()->shortname ());
+ gdb_printf (gdb_stdlog, "<- %s->record_method (",
+ this->beneath ()->shortname ());
target_debug_print_ptid_t (arg0);
gdb_puts (") = ", gdb_stdlog);
target_debug_print_enum_record_method (result);
@@ -3948,9 +4401,11 @@ dummy_target::stop_recording ()
void
debug_target::stop_recording ()
{
- gdb_printf (gdb_stdlog, "-> %s->stop_recording (...)\n", this->beneath ()->shortname ());
+ gdb_printf (gdb_stdlog, "-> %s->stop_recording (...)\n",
+ this->beneath ()->shortname ());
this->beneath ()->stop_recording ();
- gdb_printf (gdb_stdlog, "<- %s->stop_recording (", this->beneath ()->shortname ());
+ gdb_printf (gdb_stdlog, "<- %s->stop_recording (",
+ this->beneath ()->shortname ());
gdb_puts (")\n", gdb_stdlog);
}
@@ -3968,9 +4423,11 @@ dummy_target::info_record ()
void
debug_target::info_record ()
{
- gdb_printf (gdb_stdlog, "-> %s->info_record (...)\n", this->beneath ()->shortname ());
+ gdb_printf (gdb_stdlog, "-> %s->info_record (...)\n",
+ this->beneath ()->shortname ());
this->beneath ()->info_record ();
- gdb_printf (gdb_stdlog, "<- %s->info_record (", this->beneath ()->shortname ());
+ gdb_printf (gdb_stdlog, "<- %s->info_record (",
+ this->beneath ()->shortname ());
gdb_puts (")\n", gdb_stdlog);
}
@@ -3989,9 +4446,11 @@ dummy_target::save_record (const char *arg0)
void
debug_target::save_record (const char *arg0)
{
- gdb_printf (gdb_stdlog, "-> %s->save_record (...)\n", this->beneath ()->shortname ());
+ gdb_printf (gdb_stdlog, "-> %s->save_record (...)\n",
+ this->beneath ()->shortname ());
this->beneath ()->save_record (arg0);
- gdb_printf (gdb_stdlog, "<- %s->save_record (", this->beneath ()->shortname ());
+ gdb_printf (gdb_stdlog, "<- %s->save_record (",
+ this->beneath ()->shortname ());
target_debug_print_const_char_p (arg0);
gdb_puts (")\n", gdb_stdlog);
}
@@ -4012,9 +4471,11 @@ bool
debug_target::supports_delete_record ()
{
bool result;
- gdb_printf (gdb_stdlog, "-> %s->supports_delete_record (...)\n", this->beneath ()->shortname ());
+ gdb_printf (gdb_stdlog, "-> %s->supports_delete_record (...)\n",
+ this->beneath ()->shortname ());
result = this->beneath ()->supports_delete_record ();
- gdb_printf (gdb_stdlog, "<- %s->supports_delete_record (", this->beneath ()->shortname ());
+ gdb_printf (gdb_stdlog, "<- %s->supports_delete_record (",
+ this->beneath ()->shortname ());
gdb_puts (") = ", gdb_stdlog);
target_debug_print_bool (result);
gdb_puts ("\n", gdb_stdlog);
@@ -4036,9 +4497,11 @@ dummy_target::delete_record ()
void
debug_target::delete_record ()
{
- gdb_printf (gdb_stdlog, "-> %s->delete_record (...)\n", this->beneath ()->shortname ());
+ gdb_printf (gdb_stdlog, "-> %s->delete_record (...)\n",
+ this->beneath ()->shortname ());
this->beneath ()->delete_record ();
- gdb_printf (gdb_stdlog, "<- %s->delete_record (", this->beneath ()->shortname ());
+ gdb_printf (gdb_stdlog, "<- %s->delete_record (",
+ this->beneath ()->shortname ());
gdb_puts (")\n", gdb_stdlog);
}
@@ -4058,9 +4521,11 @@ bool
debug_target::record_is_replaying (ptid_t arg0)
{
bool result;
- gdb_printf (gdb_stdlog, "-> %s->record_is_replaying (...)\n", this->beneath ()->shortname ());
+ gdb_printf (gdb_stdlog, "-> %s->record_is_replaying (...)\n",
+ this->beneath ()->shortname ());
result = this->beneath ()->record_is_replaying (arg0);
- gdb_printf (gdb_stdlog, "<- %s->record_is_replaying (", this->beneath ()->shortname ());
+ gdb_printf (gdb_stdlog, "<- %s->record_is_replaying (",
+ this->beneath ()->shortname ());
target_debug_print_ptid_t (arg0);
gdb_puts (") = ", gdb_stdlog);
target_debug_print_bool (result);
@@ -4084,9 +4549,11 @@ bool
debug_target::record_will_replay (ptid_t arg0, int arg1)
{
bool result;
- gdb_printf (gdb_stdlog, "-> %s->record_will_replay (...)\n", this->beneath ()->shortname ());
+ gdb_printf (gdb_stdlog, "-> %s->record_will_replay (...)\n",
+ this->beneath ()->shortname ());
result = this->beneath ()->record_will_replay (arg0, arg1);
- gdb_printf (gdb_stdlog, "<- %s->record_will_replay (", this->beneath ()->shortname ());
+ gdb_printf (gdb_stdlog, "<- %s->record_will_replay (",
+ this->beneath ()->shortname ());
target_debug_print_ptid_t (arg0);
gdb_puts (", ", gdb_stdlog);
target_debug_print_int (arg1);
@@ -4110,9 +4577,11 @@ dummy_target::record_stop_replaying ()
void
debug_target::record_stop_replaying ()
{
- gdb_printf (gdb_stdlog, "-> %s->record_stop_replaying (...)\n", this->beneath ()->shortname ());
+ gdb_printf (gdb_stdlog, "-> %s->record_stop_replaying (...)\n",
+ this->beneath ()->shortname ());
this->beneath ()->record_stop_replaying ();
- gdb_printf (gdb_stdlog, "<- %s->record_stop_replaying (", this->beneath ()->shortname ());
+ gdb_printf (gdb_stdlog, "<- %s->record_stop_replaying (",
+ this->beneath ()->shortname ());
gdb_puts (")\n", gdb_stdlog);
}
@@ -4131,9 +4600,11 @@ dummy_target::goto_record_begin ()
void
debug_target::goto_record_begin ()
{
- gdb_printf (gdb_stdlog, "-> %s->goto_record_begin (...)\n", this->beneath ()->shortname ());
+ gdb_printf (gdb_stdlog, "-> %s->goto_record_begin (...)\n",
+ this->beneath ()->shortname ());
this->beneath ()->goto_record_begin ();
- gdb_printf (gdb_stdlog, "<- %s->goto_record_begin (", this->beneath ()->shortname ());
+ gdb_printf (gdb_stdlog, "<- %s->goto_record_begin (",
+ this->beneath ()->shortname ());
gdb_puts (")\n", gdb_stdlog);
}
@@ -4152,9 +4623,11 @@ dummy_target::goto_record_end ()
void
debug_target::goto_record_end ()
{
- gdb_printf (gdb_stdlog, "-> %s->goto_record_end (...)\n", this->beneath ()->shortname ());
+ gdb_printf (gdb_stdlog, "-> %s->goto_record_end (...)\n",
+ this->beneath ()->shortname ());
this->beneath ()->goto_record_end ();
- gdb_printf (gdb_stdlog, "<- %s->goto_record_end (", this->beneath ()->shortname ());
+ gdb_printf (gdb_stdlog, "<- %s->goto_record_end (",
+ this->beneath ()->shortname ());
gdb_puts (")\n", gdb_stdlog);
}
@@ -4173,9 +4646,11 @@ dummy_target::goto_record (ULONGEST arg0)
void
debug_target::goto_record (ULONGEST arg0)
{
- gdb_printf (gdb_stdlog, "-> %s->goto_record (...)\n", this->beneath ()->shortname ());
+ gdb_printf (gdb_stdlog, "-> %s->goto_record (...)\n",
+ this->beneath ()->shortname ());
this->beneath ()->goto_record (arg0);
- gdb_printf (gdb_stdlog, "<- %s->goto_record (", this->beneath ()->shortname ());
+ gdb_printf (gdb_stdlog, "<- %s->goto_record (",
+ this->beneath ()->shortname ());
target_debug_print_ULONGEST (arg0);
gdb_puts (")\n", gdb_stdlog);
}
@@ -4195,9 +4670,11 @@ dummy_target::insn_history (int arg0, gdb_disassembly_flags arg1)
void
debug_target::insn_history (int arg0, gdb_disassembly_flags arg1)
{
- gdb_printf (gdb_stdlog, "-> %s->insn_history (...)\n", this->beneath ()->shortname ());
+ gdb_printf (gdb_stdlog, "-> %s->insn_history (...)\n",
+ this->beneath ()->shortname ());
this->beneath ()->insn_history (arg0, arg1);
- gdb_printf (gdb_stdlog, "<- %s->insn_history (", this->beneath ()->shortname ());
+ gdb_printf (gdb_stdlog, "<- %s->insn_history (",
+ this->beneath ()->shortname ());
target_debug_print_int (arg0);
gdb_puts (", ", gdb_stdlog);
target_debug_print_gdb_disassembly_flags (arg1);
@@ -4205,23 +4682,28 @@ debug_target::insn_history (int arg0, gdb_disassembly_flags arg1)
}
void
-target_ops::insn_history_from (ULONGEST arg0, int arg1, gdb_disassembly_flags arg2)
+target_ops::insn_history_from (ULONGEST arg0, int arg1,
+ gdb_disassembly_flags arg2)
{
this->beneath ()->insn_history_from (arg0, arg1, arg2);
}
void
-dummy_target::insn_history_from (ULONGEST arg0, int arg1, gdb_disassembly_flags arg2)
+dummy_target::insn_history_from (ULONGEST arg0, int arg1,
+ gdb_disassembly_flags arg2)
{
tcomplain ();
}
void
-debug_target::insn_history_from (ULONGEST arg0, int arg1, gdb_disassembly_flags arg2)
+debug_target::insn_history_from (ULONGEST arg0, int arg1,
+ gdb_disassembly_flags arg2)
{
- gdb_printf (gdb_stdlog, "-> %s->insn_history_from (...)\n", this->beneath ()->shortname ());
+ gdb_printf (gdb_stdlog, "-> %s->insn_history_from (...)\n",
+ this->beneath ()->shortname ());
this->beneath ()->insn_history_from (arg0, arg1, arg2);
- gdb_printf (gdb_stdlog, "<- %s->insn_history_from (", this->beneath ()->shortname ());
+ gdb_printf (gdb_stdlog, "<- %s->insn_history_from (",
+ this->beneath ()->shortname ());
target_debug_print_ULONGEST (arg0);
gdb_puts (", ", gdb_stdlog);
target_debug_print_int (arg1);
@@ -4231,23 +4713,28 @@ debug_target::insn_history_from (ULONGEST arg0, int arg1, gdb_disassembly_flags
}
void
-target_ops::insn_history_range (ULONGEST arg0, ULONGEST arg1, gdb_disassembly_flags arg2)
+target_ops::insn_history_range (ULONGEST arg0, ULONGEST arg1,
+ gdb_disassembly_flags arg2)
{
this->beneath ()->insn_history_range (arg0, arg1, arg2);
}
void
-dummy_target::insn_history_range (ULONGEST arg0, ULONGEST arg1, gdb_disassembly_flags arg2)
+dummy_target::insn_history_range (ULONGEST arg0, ULONGEST arg1,
+ gdb_disassembly_flags arg2)
{
tcomplain ();
}
void
-debug_target::insn_history_range (ULONGEST arg0, ULONGEST arg1, gdb_disassembly_flags arg2)
+debug_target::insn_history_range (ULONGEST arg0, ULONGEST arg1,
+ gdb_disassembly_flags arg2)
{
- gdb_printf (gdb_stdlog, "-> %s->insn_history_range (...)\n", this->beneath ()->shortname ());
+ gdb_printf (gdb_stdlog, "-> %s->insn_history_range (...)\n",
+ this->beneath ()->shortname ());
this->beneath ()->insn_history_range (arg0, arg1, arg2);
- gdb_printf (gdb_stdlog, "<- %s->insn_history_range (", this->beneath ()->shortname ());
+ gdb_printf (gdb_stdlog, "<- %s->insn_history_range (",
+ this->beneath ()->shortname ());
target_debug_print_ULONGEST (arg0);
gdb_puts (", ", gdb_stdlog);
target_debug_print_ULONGEST (arg1);
@@ -4271,9 +4758,11 @@ dummy_target::call_history (int arg0, record_print_flags arg1)
void
debug_target::call_history (int arg0, record_print_flags arg1)
{
- gdb_printf (gdb_stdlog, "-> %s->call_history (...)\n", this->beneath ()->shortname ());
+ gdb_printf (gdb_stdlog, "-> %s->call_history (...)\n",
+ this->beneath ()->shortname ());
this->beneath ()->call_history (arg0, arg1);
- gdb_printf (gdb_stdlog, "<- %s->call_history (", this->beneath ()->shortname ());
+ gdb_printf (gdb_stdlog, "<- %s->call_history (",
+ this->beneath ()->shortname ());
target_debug_print_int (arg0);
gdb_puts (", ", gdb_stdlog);
target_debug_print_record_print_flags (arg1);
@@ -4281,23 +4770,28 @@ debug_target::call_history (int arg0, record_print_flags arg1)
}
void
-target_ops::call_history_from (ULONGEST arg0, int arg1, record_print_flags arg2)
+target_ops::call_history_from (ULONGEST arg0, int arg1,
+ record_print_flags arg2)
{
this->beneath ()->call_history_from (arg0, arg1, arg2);
}
void
-dummy_target::call_history_from (ULONGEST arg0, int arg1, record_print_flags arg2)
+dummy_target::call_history_from (ULONGEST arg0, int arg1,
+ record_print_flags arg2)
{
tcomplain ();
}
void
-debug_target::call_history_from (ULONGEST arg0, int arg1, record_print_flags arg2)
+debug_target::call_history_from (ULONGEST arg0, int arg1,
+ record_print_flags arg2)
{
- gdb_printf (gdb_stdlog, "-> %s->call_history_from (...)\n", this->beneath ()->shortname ());
+ gdb_printf (gdb_stdlog, "-> %s->call_history_from (...)\n",
+ this->beneath ()->shortname ());
this->beneath ()->call_history_from (arg0, arg1, arg2);
- gdb_printf (gdb_stdlog, "<- %s->call_history_from (", this->beneath ()->shortname ());
+ gdb_printf (gdb_stdlog, "<- %s->call_history_from (",
+ this->beneath ()->shortname ());
target_debug_print_ULONGEST (arg0);
gdb_puts (", ", gdb_stdlog);
target_debug_print_int (arg1);
@@ -4307,23 +4801,28 @@ debug_target::call_history_from (ULONGEST arg0, int arg1, record_print_flags arg
}
void
-target_ops::call_history_range (ULONGEST arg0, ULONGEST arg1, record_print_flags arg2)
+target_ops::call_history_range (ULONGEST arg0, ULONGEST arg1,
+ record_print_flags arg2)
{
this->beneath ()->call_history_range (arg0, arg1, arg2);
}
void
-dummy_target::call_history_range (ULONGEST arg0, ULONGEST arg1, record_print_flags arg2)
+dummy_target::call_history_range (ULONGEST arg0, ULONGEST arg1,
+ record_print_flags arg2)
{
tcomplain ();
}
void
-debug_target::call_history_range (ULONGEST arg0, ULONGEST arg1, record_print_flags arg2)
+debug_target::call_history_range (ULONGEST arg0, ULONGEST arg1,
+ record_print_flags arg2)
{
- gdb_printf (gdb_stdlog, "-> %s->call_history_range (...)\n", this->beneath ()->shortname ());
+ gdb_printf (gdb_stdlog, "-> %s->call_history_range (...)\n",
+ this->beneath ()->shortname ());
this->beneath ()->call_history_range (arg0, arg1, arg2);
- gdb_printf (gdb_stdlog, "<- %s->call_history_range (", this->beneath ()->shortname ());
+ gdb_printf (gdb_stdlog, "<- %s->call_history_range (",
+ this->beneath ()->shortname ());
target_debug_print_ULONGEST (arg0);
gdb_puts (", ", gdb_stdlog);
target_debug_print_ULONGEST (arg1);
@@ -4348,9 +4847,11 @@ bool
debug_target::augmented_libraries_svr4_read ()
{
bool result;
- gdb_printf (gdb_stdlog, "-> %s->augmented_libraries_svr4_read (...)\n", this->beneath ()->shortname ());
+ gdb_printf (gdb_stdlog, "-> %s->augmented_libraries_svr4_read (...)\n",
+ this->beneath ()->shortname ());
result = this->beneath ()->augmented_libraries_svr4_read ();
- gdb_printf (gdb_stdlog, "<- %s->augmented_libraries_svr4_read (", this->beneath ()->shortname ());
+ gdb_printf (gdb_stdlog, "<- %s->augmented_libraries_svr4_read (",
+ this->beneath ()->shortname ());
gdb_puts (") = ", gdb_stdlog);
target_debug_print_bool (result);
gdb_puts ("\n", gdb_stdlog);
@@ -4372,10 +4873,12 @@ dummy_target::get_unwinder ()
const struct frame_unwind *
debug_target::get_unwinder ()
{
- const struct frame_unwind * result;
- gdb_printf (gdb_stdlog, "-> %s->get_unwinder (...)\n", this->beneath ()->shortname ());
+ const struct frame_unwind *result;
+ gdb_printf (gdb_stdlog, "-> %s->get_unwinder (...)\n",
+ this->beneath ()->shortname ());
result = this->beneath ()->get_unwinder ();
- gdb_printf (gdb_stdlog, "<- %s->get_unwinder (", this->beneath ()->shortname ());
+ gdb_printf (gdb_stdlog, "<- %s->get_unwinder (",
+ this->beneath ()->shortname ());
gdb_puts (") = ", gdb_stdlog);
target_debug_print_const_struct_frame_unwind_p (result);
gdb_puts ("\n", gdb_stdlog);
@@ -4397,10 +4900,12 @@ dummy_target::get_tailcall_unwinder ()
const struct frame_unwind *
debug_target::get_tailcall_unwinder ()
{
- const struct frame_unwind * result;
- gdb_printf (gdb_stdlog, "-> %s->get_tailcall_unwinder (...)\n", this->beneath ()->shortname ());
+ const struct frame_unwind *result;
+ gdb_printf (gdb_stdlog, "-> %s->get_tailcall_unwinder (...)\n",
+ this->beneath ()->shortname ());
result = this->beneath ()->get_tailcall_unwinder ();
- gdb_printf (gdb_stdlog, "<- %s->get_tailcall_unwinder (", this->beneath ()->shortname ());
+ gdb_printf (gdb_stdlog, "<- %s->get_tailcall_unwinder (",
+ this->beneath ()->shortname ());
gdb_puts (") = ", gdb_stdlog);
target_debug_print_const_struct_frame_unwind_p (result);
gdb_puts ("\n", gdb_stdlog);
@@ -4421,9 +4926,11 @@ dummy_target::prepare_to_generate_core ()
void
debug_target::prepare_to_generate_core ()
{
- gdb_printf (gdb_stdlog, "-> %s->prepare_to_generate_core (...)\n", this->beneath ()->shortname ());
+ gdb_printf (gdb_stdlog, "-> %s->prepare_to_generate_core (...)\n",
+ this->beneath ()->shortname ());
this->beneath ()->prepare_to_generate_core ();
- gdb_printf (gdb_stdlog, "<- %s->prepare_to_generate_core (", this->beneath ()->shortname ());
+ gdb_printf (gdb_stdlog, "<- %s->prepare_to_generate_core (",
+ this->beneath ()->shortname ());
gdb_puts (")\n", gdb_stdlog);
}
@@ -4441,9 +4948,11 @@ dummy_target::done_generating_core ()
void
debug_target::done_generating_core ()
{
- gdb_printf (gdb_stdlog, "-> %s->done_generating_core (...)\n", this->beneath ()->shortname ());
+ gdb_printf (gdb_stdlog, "-> %s->done_generating_core (...)\n",
+ this->beneath ()->shortname ());
this->beneath ()->done_generating_core ();
- gdb_printf (gdb_stdlog, "<- %s->done_generating_core (", this->beneath ()->shortname ());
+ gdb_printf (gdb_stdlog, "<- %s->done_generating_core (",
+ this->beneath ()->shortname ());
gdb_puts (")\n", gdb_stdlog);
}
@@ -4463,9 +4972,11 @@ bool
debug_target::supports_memory_tagging ()
{
bool result;
- gdb_printf (gdb_stdlog, "-> %s->supports_memory_tagging (...)\n", this->beneath ()->shortname ());
+ gdb_printf (gdb_stdlog, "-> %s->supports_memory_tagging (...)\n",
+ this->beneath ()->shortname ());
result = this->beneath ()->supports_memory_tagging ();
- gdb_printf (gdb_stdlog, "<- %s->supports_memory_tagging (", this->beneath ()->shortname ());
+ gdb_printf (gdb_stdlog, "<- %s->supports_memory_tagging (",
+ this->beneath ()->shortname ());
gdb_puts (") = ", gdb_stdlog);
target_debug_print_bool (result);
gdb_puts ("\n", gdb_stdlog);
@@ -4473,24 +4984,29 @@ debug_target::supports_memory_tagging ()
}
bool
-target_ops::fetch_memtags (CORE_ADDR arg0, size_t arg1, gdb::byte_vector &arg2, int arg3)
+target_ops::fetch_memtags (CORE_ADDR arg0, size_t arg1, gdb::byte_vector &arg2,
+ int arg3)
{
return this->beneath ()->fetch_memtags (arg0, arg1, arg2, arg3);
}
bool
-dummy_target::fetch_memtags (CORE_ADDR arg0, size_t arg1, gdb::byte_vector &arg2, int arg3)
+dummy_target::fetch_memtags (CORE_ADDR arg0, size_t arg1,
+ gdb::byte_vector &arg2, int arg3)
{
tcomplain ();
}
bool
-debug_target::fetch_memtags (CORE_ADDR arg0, size_t arg1, gdb::byte_vector &arg2, int arg3)
+debug_target::fetch_memtags (CORE_ADDR arg0, size_t arg1,
+ gdb::byte_vector &arg2, int arg3)
{
bool result;
- gdb_printf (gdb_stdlog, "-> %s->fetch_memtags (...)\n", this->beneath ()->shortname ());
+ gdb_printf (gdb_stdlog, "-> %s->fetch_memtags (...)\n",
+ this->beneath ()->shortname ());
result = this->beneath ()->fetch_memtags (arg0, arg1, arg2, arg3);
- gdb_printf (gdb_stdlog, "<- %s->fetch_memtags (", this->beneath ()->shortname ());
+ gdb_printf (gdb_stdlog, "<- %s->fetch_memtags (",
+ this->beneath ()->shortname ());
target_debug_print_CORE_ADDR (arg0);
gdb_puts (", ", gdb_stdlog);
target_debug_print_size_t (arg1);
@@ -4505,24 +5021,29 @@ debug_target::fetch_memtags (CORE_ADDR arg0, size_t arg1, gdb::byte_vector &arg2
}
bool
-target_ops::store_memtags (CORE_ADDR arg0, size_t arg1, const gdb::byte_vector &arg2, int arg3)
+target_ops::store_memtags (CORE_ADDR arg0, size_t arg1,
+ const gdb::byte_vector &arg2, int arg3)
{
return this->beneath ()->store_memtags (arg0, arg1, arg2, arg3);
}
bool
-dummy_target::store_memtags (CORE_ADDR arg0, size_t arg1, const gdb::byte_vector &arg2, int arg3)
+dummy_target::store_memtags (CORE_ADDR arg0, size_t arg1,
+ const gdb::byte_vector &arg2, int arg3)
{
tcomplain ();
}
bool
-debug_target::store_memtags (CORE_ADDR arg0, size_t arg1, const gdb::byte_vector &arg2, int arg3)
+debug_target::store_memtags (CORE_ADDR arg0, size_t arg1,
+ const gdb::byte_vector &arg2, int arg3)
{
bool result;
- gdb_printf (gdb_stdlog, "-> %s->store_memtags (...)\n", this->beneath ()->shortname ());
+ gdb_printf (gdb_stdlog, "-> %s->store_memtags (...)\n",
+ this->beneath ()->shortname ());
result = this->beneath ()->store_memtags (arg0, arg1, arg2, arg3);
- gdb_printf (gdb_stdlog, "<- %s->store_memtags (", this->beneath ()->shortname ());
+ gdb_printf (gdb_stdlog, "<- %s->store_memtags (",
+ this->beneath ()->shortname ());
target_debug_print_CORE_ADDR (arg0);
gdb_puts (", ", gdb_stdlog);
target_debug_print_size_t (arg1);
@@ -4535,4 +5056,3 @@ debug_target::store_memtags (CORE_ADDR arg0, size_t arg1, const gdb::byte_vector
gdb_puts ("\n", gdb_stdlog);
return result;
}
-
diff --git a/gdb/target-descriptions.c b/gdb/target-descriptions.c
index b08a185dfa2..15933b4c3cf 100644
--- a/gdb/target-descriptions.c
+++ b/gdb/target-descriptions.c
@@ -42,8 +42,10 @@
struct property
{
property (const std::string &key_, const std::string &value_)
- : key (key_), value (value_)
- {}
+ : key (key_),
+ value (value_)
+ {
+ }
std::string key;
std::string value;
@@ -57,15 +59,14 @@ make_gdb_type (struct gdbarch *gdbarch, struct tdesc_type *ttype)
class gdb_type_creator : public tdesc_element_visitor
{
public:
+
gdb_type_creator (struct gdbarch *gdbarch)
: m_gdbarch (gdbarch)
- {}
-
- type *get_type ()
{
- return m_type;
}
+ type *get_type () { return m_type; }
+
void visit (const tdesc_type_builtin *e) override
{
switch (e->kind)
@@ -148,8 +149,8 @@ make_gdb_type (struct gdbarch *gdbarch, struct tdesc_type *ttype)
return;
}
- internal_error ("Type \"%s\" has an unknown kind %d",
- e->name.c_str (), e->kind);
+ internal_error ("Type \"%s\" has an unknown kind %d", e->name.c_str (),
+ e->kind);
}
void visit (const tdesc_type_vector *e) override
@@ -186,8 +187,8 @@ make_gdb_type (struct gdbarch *gdbarch, struct tdesc_type *ttype)
return;
}
- internal_error ("Type \"%s\" has an unknown kind %d",
- e->name.c_str (), e->kind);
+ internal_error ("Type \"%s\" has an unknown kind %d", e->name.c_str (),
+ e->kind);
}
private:
@@ -215,8 +216,9 @@ make_gdb_type (struct gdbarch *gdbarch, struct tdesc_type *ttype)
else
field_gdb_type = builtin_type (m_gdbarch)->builtin_uint32;
- fld = append_composite_type_field_raw
- (m_type, xstrdup (f.name.c_str ()), field_gdb_type);
+ fld = append_composite_type_field_raw (m_type,
+ xstrdup (f.name.c_str ()),
+ field_gdb_type);
/* For little-endian, BITPOS counts from the LSB of
the structure and marks the LSB of the field. For
@@ -237,8 +239,7 @@ make_gdb_type (struct gdbarch *gdbarch, struct tdesc_type *ttype)
{
gdb_assert (f.start == -1 && f.end == -1);
type *field_gdb_type = make_gdb_type (m_gdbarch, f.type);
- append_composite_type_field (m_type,
- xstrdup (f.name.c_str ()),
+ append_composite_type_field (m_type, xstrdup (f.name.c_str ()),
field_gdb_type);
}
}
@@ -254,7 +255,7 @@ make_gdb_type (struct gdbarch *gdbarch, struct tdesc_type *ttype)
for (const tdesc_type_field &f : e->fields)
{
- type* field_gdb_type = make_gdb_type (m_gdbarch, f.type);
+ type *field_gdb_type = make_gdb_type (m_gdbarch, f.type);
append_composite_type_field (m_type, xstrdup (f.name.c_str ()),
field_gdb_type);
@@ -277,8 +278,8 @@ make_gdb_type (struct gdbarch *gdbarch, struct tdesc_type *ttype)
gdb_assert (f.type != NULL);
type *field_gdb_type = make_gdb_type (m_gdbarch, f.type);
- append_flags_type_field (m_type, f.start, bitsize,
- field_gdb_type, f.name.c_str ());
+ append_flags_type_field (m_type, f.start, bitsize, field_gdb_type,
+ f.name.c_str ());
}
}
@@ -320,16 +321,18 @@ make_gdb_type (struct gdbarch *gdbarch, struct tdesc_type *ttype)
class tdesc_compatible_info
{
public:
+
/* Constructor. */
explicit tdesc_compatible_info (const bfd_arch_info_type *arch)
: m_arch (arch)
- { /* Nothing. */ }
+ { /* Nothing. */
+ }
/* Access the contained pointer. */
- const bfd_arch_info_type *arch () const
- { return m_arch; }
+ const bfd_arch_info_type *arch () const { return m_arch; }
private:
+
/* Architecture information looked up from the <compatible> entity within
a target description. */
const bfd_arch_info_type *m_arch;
@@ -339,8 +342,7 @@ private:
struct target_desc : tdesc_element
{
- target_desc ()
- {}
+ target_desc () {}
virtual ~target_desc () = default;
@@ -412,8 +414,10 @@ struct target_desc : tdesc_element
struct tdesc_arch_reg
{
tdesc_arch_reg (tdesc_reg *reg_, struct type *type_)
- : reg (reg_), type (type_)
- {}
+ : reg (reg_),
+ type (type_)
+ {
+ }
struct tdesc_reg *reg;
struct type *type;
@@ -479,18 +483,19 @@ target_find_description (void)
file. */
tdesc_info->tdesc = nullptr;
if (!tdesc_info->filename.empty ())
- tdesc_info->tdesc = file_read_description_xml (tdesc_info->filename.data ());
+ tdesc_info->tdesc
+ = file_read_description_xml (tdesc_info->filename.data ());
/* Next try to read the description from the current target using
target objects. */
if (tdesc_info->tdesc == nullptr)
- tdesc_info->tdesc = target_read_description_xml
- (current_inferior ()->top_target ());
+ tdesc_info->tdesc
+ = target_read_description_xml (current_inferior ()->top_target ());
/* If that failed try a target-specific hook. */
if (tdesc_info->tdesc == nullptr)
- tdesc_info->tdesc = target_read_description
- (current_inferior ()->top_target ());
+ tdesc_info->tdesc
+ = target_read_description (current_inferior ()->top_target ());
/* If a non-NULL description was returned, then update the current
architecture. */
@@ -500,7 +505,7 @@ target_find_description (void)
info.target_desc = tdesc_info->tdesc;
if (!gdbarch_update_p (info))
- warning (_("Architecture rejected target-supplied description"));
+ warning (_ ("Architecture rejected target-supplied description"));
else
{
struct tdesc_arch_data *data;
@@ -508,8 +513,8 @@ target_find_description (void)
data = get_arch_data (target_gdbarch ());
if (tdesc_has_registers (tdesc_info->tdesc)
&& data->arch_regs.empty ())
- warning (_("Target-supplied registers are not supported "
- "by the current architecture"));
+ warning (_ ("Target-supplied registers are not supported "
+ "by the current architecture"));
}
}
@@ -534,7 +539,7 @@ target_clear_description (void)
gdbarch_info info;
if (!gdbarch_update_p (info))
- internal_error (_("Could not remove target-supplied description"));
+ internal_error (_ ("Could not remove target-supplied description"));
}
/* Return the global current target description. This should only be
@@ -561,15 +566,13 @@ tdesc_compatible_p (const struct target_desc *target_desc,
{
for (const tdesc_compatible_info_up &compat : target_desc->compatible)
{
- if (compat->arch () == arch
- || arch->compatible (arch, compat->arch ())
+ if (compat->arch () == arch || arch->compatible (arch, compat->arch ())
|| compat->arch ()->compatible (compat->arch (), arch))
return 1;
}
return 0;
}
-
/* Direct accessors for target descriptions. */
@@ -660,8 +663,7 @@ tdesc_has_registers (const struct target_desc *target_desc)
the named feature is not found. */
const struct tdesc_feature *
-tdesc_find_feature (const struct target_desc *target_desc,
- const char *name)
+tdesc_find_feature (const struct target_desc *target_desc, const char *name)
{
for (const tdesc_feature_up &feature : target_desc->features)
if (feature->name == name)
@@ -687,9 +689,7 @@ tdesc_find_type (struct gdbarch *gdbarch, const char *id)
for (const tdesc_arch_reg &reg : data->arch_regs)
{
- if (reg.reg
- && reg.reg->tdesc_type
- && reg.type
+ if (reg.reg && reg.reg->tdesc_type && reg.type
&& reg.reg->tdesc_type->name == id)
return reg.type;
}
@@ -732,8 +732,8 @@ tdesc_find_register_early (const struct tdesc_feature *feature,
int
tdesc_numbered_register (const struct tdesc_feature *feature,
- struct tdesc_arch_data *data,
- int regno, const char *name)
+ struct tdesc_arch_data *data, int regno,
+ const char *name)
{
struct tdesc_reg *reg = tdesc_find_register_early (feature, name);
@@ -769,8 +769,8 @@ tdesc_unnumbered_register (const struct tdesc_feature *feature,
int
tdesc_numbered_register_choices (const struct tdesc_feature *feature,
- struct tdesc_arch_data *data,
- int regno, const char *const names[])
+ struct tdesc_arch_data *data, int regno,
+ const char *const names[])
{
int i;
@@ -822,7 +822,7 @@ tdesc_find_register (struct gdbarch *gdbarch, int regno)
{
struct tdesc_arch_reg *reg = tdesc_find_arch_register (gdbarch, regno);
- return reg? reg->reg : NULL;
+ return reg ? reg->reg : NULL;
}
/* Return the name of register REGNO, from the target description or
@@ -852,7 +852,7 @@ struct type *
tdesc_register_type (struct gdbarch *gdbarch, int regno)
{
struct tdesc_arch_reg *arch_reg = tdesc_find_arch_register (gdbarch, regno);
- struct tdesc_reg *reg = arch_reg? arch_reg->reg : NULL;
+ struct tdesc_reg *reg = arch_reg ? arch_reg->reg : NULL;
int num_regs = gdbarch_num_regs (gdbarch);
int num_pseudo_regs = gdbarch_num_pseudo_regs (gdbarch);
@@ -885,7 +885,7 @@ tdesc_register_type (struct gdbarch *gdbarch, int regno)
arch_reg->type = builtin_type (gdbarch)->builtin_long_double;
else
{
- warning (_("Register \"%s\" has an unsupported size (%d bits)"),
+ warning (_ ("Register \"%s\" has an unsupported size (%d bits)"),
reg->name.c_str (), reg->bitsize);
arch_reg->type = builtin_type (gdbarch)->builtin_double;
}
@@ -903,11 +903,11 @@ tdesc_register_type (struct gdbarch *gdbarch, int regno)
else if (reg->bitsize == gdbarch_long_long_bit (gdbarch))
arch_reg->type = builtin_type (gdbarch)->builtin_long_long;
else if (reg->bitsize == gdbarch_ptr_bit (gdbarch))
- /* A bit desperate by this point... */
+ /* A bit desperate by this point... */
arch_reg->type = builtin_type (gdbarch)->builtin_data_ptr;
else
{
- warning (_("Register \"%s\" has an unsupported size (%d bits)"),
+ warning (_ ("Register \"%s\" has an unsupported size (%d bits)"),
reg->name.c_str (), reg->bitsize);
arch_reg->type = builtin_type (gdbarch)->builtin_long;
}
@@ -949,9 +949,8 @@ tdesc_register_in_reggroup_p (struct gdbarch *gdbarch, int regno,
{
struct tdesc_reg *reg = tdesc_find_register (gdbarch, regno);
- if (reg != NULL && !reg->group.empty ()
- && (reg->group == reggroup->name ()))
- return 1;
+ if (reg != NULL && !reg->group.empty () && (reg->group == reggroup->name ()))
+ return 1;
if (reg != NULL
&& (reggroup == save_reggroup || reggroup == restore_reggroup))
@@ -1010,9 +1009,9 @@ set_tdesc_pseudo_register_type (struct gdbarch *gdbarch,
}
void
-set_tdesc_pseudo_register_reggroup_p
- (struct gdbarch *gdbarch,
- gdbarch_register_reggroup_p_ftype *pseudo_reggroup_p)
+set_tdesc_pseudo_register_reggroup_p (
+ struct gdbarch *gdbarch,
+ gdbarch_register_reggroup_p_ftype *pseudo_reggroup_p)
{
struct tdesc_arch_data *data = get_arch_data (gdbarch);
@@ -1053,9 +1052,9 @@ tdesc_use_registers (struct gdbarch *gdbarch,
/* Add reggroup if its new. */
if (!reg->group.empty ())
if (reggroup_find (gdbarch, reg->group.c_str ()) == NULL)
- reggroup_add (gdbarch, reggroup_gdbarch_new (gdbarch,
- reg->group.c_str (),
- USER_REGGROUP));
+ reggroup_add (gdbarch,
+ reggroup_gdbarch_new (gdbarch, reg->group.c_str (),
+ USER_REGGROUP));
}
/* Remove any registers which were assigned numbers by the
@@ -1113,8 +1112,7 @@ tdesc_use_registers (struct gdbarch *gdbarch,
set_gdbarch_num_regs (gdbarch, num_regs);
set_gdbarch_register_name (gdbarch, tdesc_register_name);
set_gdbarch_register_type (gdbarch, tdesc_register_type);
- set_gdbarch_remote_register_number (gdbarch,
- tdesc_remote_register_number);
+ set_gdbarch_remote_register_number (gdbarch, tdesc_remote_register_number);
set_gdbarch_register_reggroup_p (gdbarch, tdesc_register_reggroup_p);
}
@@ -1158,23 +1156,22 @@ tdesc_add_compatible (struct target_desc *target_desc,
for (const tdesc_compatible_info_up &compat : target_desc->compatible)
if (compat->arch () == compatible)
- internal_error (_("Attempted to add duplicate "
- "compatible architecture \"%s\""),
+ internal_error (_ ("Attempted to add duplicate "
+ "compatible architecture \"%s\""),
compatible->printable_name);
- target_desc->compatible.push_back
- (std::unique_ptr<tdesc_compatible_info>
- (new tdesc_compatible_info (compatible)));
+ target_desc->compatible.push_back (std::unique_ptr<tdesc_compatible_info> (
+ new tdesc_compatible_info (compatible)));
}
void
-set_tdesc_property (struct target_desc *target_desc,
- const char *key, const char *value)
+set_tdesc_property (struct target_desc *target_desc, const char *key,
+ const char *value)
{
gdb_assert (key != NULL && value != NULL);
if (tdesc_property (target_desc, key) != NULL)
- internal_error (_("Attempted to add duplicate property \"%s\""), key);
+ internal_error (_ ("Attempted to add duplicate property \"%s\""), key);
target_desc->properties.emplace_back (key, value);
}
@@ -1182,8 +1179,7 @@ set_tdesc_property (struct target_desc *target_desc,
/* See gdbsupport/tdesc.h. */
void
-set_tdesc_architecture (struct target_desc *target_desc,
- const char *name)
+set_tdesc_architecture (struct target_desc *target_desc, const char *name)
{
set_tdesc_architecture (target_desc, bfd_scan_arch (name));
}
@@ -1208,7 +1204,6 @@ set_tdesc_osabi (struct target_desc *target_desc, enum gdb_osabi osabi)
{
target_desc->osabi = osabi;
}
-
static struct cmd_list_element *tdesc_set_cmdlist, *tdesc_show_cmdlist;
static struct cmd_list_element *tdesc_unset_cmdlist;
@@ -1229,19 +1224,16 @@ set_tdesc_filename_cmd (const char *args, int from_tty,
static void
show_tdesc_filename_cmd (struct ui_file *file, int from_tty,
- struct cmd_list_element *c,
- const char *value)
+ struct cmd_list_element *c, const char *value)
{
value = current_inferior ()->tdesc_info.filename.data ();
if (value != NULL && *value != '\0')
- gdb_printf (file,
- _("The target description will be read from \"%s\".\n"),
+ gdb_printf (file, _ ("The target description will be read from \"%s\".\n"),
value);
else
- gdb_printf (file,
- _("The target description will be "
- "read from the target.\n"));
+ gdb_printf (file, _ ("The target description will be "
+ "read from the target.\n"));
}
static void
@@ -1259,6 +1251,7 @@ unset_tdesc_filename_cmd (const char *args, int from_tty)
class print_c_tdesc : public tdesc_element_visitor
{
public:
+
print_c_tdesc (std::string &filename_after_features)
: m_filename_after_features (filename_after_features)
{
@@ -1284,10 +1277,7 @@ public:
":set ro:\n");
}
- ~print_c_tdesc ()
- {
- xfree (m_function);
- }
+ ~print_c_tdesc () { xfree (m_function); }
void visit_pre (const target_desc *e) override
{
@@ -1303,29 +1293,28 @@ public:
gdb_printf ("static void\n");
gdb_printf ("initialize_tdesc_%s (void)\n", m_function);
gdb_printf ("{\n");
- gdb_printf
- (" target_desc_up result = allocate_target_description ();\n");
+ gdb_printf (" target_desc_up result = allocate_target_description ();\n");
if (tdesc_architecture (e) != NULL)
{
- gdb_printf
- (" set_tdesc_architecture (result.get (), bfd_scan_arch (\"%s\"));\n",
- tdesc_architecture (e)->printable_name);
+ gdb_printf (" set_tdesc_architecture (result.get (), bfd_scan_arch "
+ "(\"%s\"));\n",
+ tdesc_architecture (e)->printable_name);
gdb_printf ("\n");
}
if (tdesc_osabi (e) > GDB_OSABI_UNKNOWN
&& tdesc_osabi (e) < GDB_OSABI_INVALID)
{
- gdb_printf
- (" set_tdesc_osabi (result.get (), osabi_from_tdesc_string (\"%s\"));\n",
- gdbarch_osabi_name (tdesc_osabi (e)));
+ gdb_printf (" set_tdesc_osabi (result.get (), "
+ "osabi_from_tdesc_string (\"%s\"));\n",
+ gdbarch_osabi_name (tdesc_osabi (e)));
gdb_printf ("\n");
}
for (const tdesc_compatible_info_up &compatible : e->compatible)
- gdb_printf
- (" tdesc_add_compatible (result.get (), bfd_scan_arch (\"%s\"));\n",
- compatible->arch ()->printable_name);
+ gdb_printf (
+ " tdesc_add_compatible (result.get (), bfd_scan_arch (\"%s\"));\n",
+ compatible->arch ()->printable_name);
if (!e->compatible.empty ())
gdb_printf ("\n");
@@ -1339,12 +1328,12 @@ public:
void visit_pre (const tdesc_feature *e) override
{
- gdb_printf ("\n feature = tdesc_create_feature (result.get (), \"%s\");\n",
- e->name.c_str ());
+ gdb_printf (
+ "\n feature = tdesc_create_feature (result.get (), \"%s\");\n",
+ e->name.c_str ());
}
- void visit_post (const tdesc_feature *e) override
- {}
+ void visit_post (const tdesc_feature *e) override {}
void visit_post (const target_desc *e) override
{
@@ -1354,7 +1343,7 @@ public:
void visit (const tdesc_type_builtin *type) override
{
- error (_("C output is not supported type \"%s\"."), type->name.c_str ());
+ error (_ ("C output is not supported type \"%s\"."), type->name.c_str ());
}
void visit (const tdesc_type_vector *type) override
@@ -1365,12 +1354,10 @@ public:
m_printed_element_type = true;
}
- gdb_printf
- (" element_type = tdesc_named_type (feature, \"%s\");\n",
- type->element_type->name.c_str ());
- gdb_printf
- (" tdesc_create_vector (feature, \"%s\", element_type, %d);\n",
- type->name.c_str (), type->count);
+ gdb_printf (" element_type = tdesc_named_type (feature, \"%s\");\n",
+ type->element_type->name.c_str ());
+ gdb_printf (" tdesc_create_vector (feature, \"%s\", element_type, %d);\n",
+ type->name.c_str (), type->count);
gdb_printf ("\n");
}
@@ -1389,18 +1376,18 @@ public:
case TDESC_TYPE_FLAGS:
if (type->kind == TDESC_TYPE_STRUCT)
{
- gdb_printf
- (" type_with_fields = tdesc_create_struct (feature, \"%s\");\n",
- type->name.c_str ());
+ gdb_printf (
+ " type_with_fields = tdesc_create_struct (feature, \"%s\");\n",
+ type->name.c_str ());
if (type->size != 0)
- gdb_printf
- (" tdesc_set_struct_size (type_with_fields, %d);\n", type->size);
+ gdb_printf (" tdesc_set_struct_size (type_with_fields, %d);\n",
+ type->size);
}
else
{
- gdb_printf
- (" type_with_fields = tdesc_create_flags (feature, \"%s\", %d);\n",
- type->name.c_str (), type->size);
+ gdb_printf (" type_with_fields = tdesc_create_flags (feature, "
+ "\"%s\", %d);\n",
+ type->name.c_str (), type->size);
}
for (const tdesc_type_field &f : type->fields)
{
@@ -1417,65 +1404,65 @@ public:
if (f.type->kind == TDESC_TYPE_BOOL)
{
gdb_assert (f.start == f.end);
- gdb_printf
- (" tdesc_add_flag (type_with_fields, %d, \"%s\");\n",
- f.start, f.name.c_str ());
+ gdb_printf (
+ " tdesc_add_flag (type_with_fields, %d, \"%s\");\n",
+ f.start, f.name.c_str ());
}
else if ((type->size == 4 && f.type->kind == TDESC_TYPE_UINT32)
|| (type->size == 8
&& f.type->kind == TDESC_TYPE_UINT64))
{
- gdb_printf
- (" tdesc_add_bitfield (type_with_fields, \"%s\", %d, %d);\n",
- f.name.c_str (), f.start, f.end);
+ gdb_printf (" tdesc_add_bitfield (type_with_fields, "
+ "\"%s\", %d, %d);\n",
+ f.name.c_str (), f.start, f.end);
}
else
{
- printf_field_type_assignment
- ("tdesc_named_type (feature, \"%s\");\n",
- type_name);
- gdb_printf
- (" tdesc_add_typed_bitfield (type_with_fields, \"%s\","
- " %d, %d, field_type);\n",
- f.name.c_str (), f.start, f.end);
+ printf_field_type_assignment (
+ "tdesc_named_type (feature, \"%s\");\n", type_name);
+ gdb_printf (
+ " tdesc_add_typed_bitfield (type_with_fields, \"%s\","
+ " %d, %d, field_type);\n",
+ f.name.c_str (), f.start, f.end);
}
}
else /* Not a bitfield. */
{
gdb_assert (f.end == -1);
gdb_assert (type->kind == TDESC_TYPE_STRUCT);
- printf_field_type_assignment
- ("tdesc_named_type (feature, \"%s\");\n", type_name);
- gdb_printf
- (" tdesc_add_field (type_with_fields, \"%s\", field_type);\n",
- f.name.c_str ());
+ printf_field_type_assignment (
+ "tdesc_named_type (feature, \"%s\");\n", type_name);
+ gdb_printf (" tdesc_add_field (type_with_fields, \"%s\", "
+ "field_type);\n",
+ f.name.c_str ());
}
}
break;
case TDESC_TYPE_UNION:
- gdb_printf
- (" type_with_fields = tdesc_create_union (feature, \"%s\");\n",
- type->name.c_str ());
+ gdb_printf (
+ " type_with_fields = tdesc_create_union (feature, \"%s\");\n",
+ type->name.c_str ());
for (const tdesc_type_field &f : type->fields)
{
- printf_field_type_assignment
- ("tdesc_named_type (feature, \"%s\");\n", f.type->name.c_str ());
- gdb_printf
- (" tdesc_add_field (type_with_fields, \"%s\", field_type);\n",
- f.name.c_str ());
+ printf_field_type_assignment (
+ "tdesc_named_type (feature, \"%s\");\n", f.type->name.c_str ());
+ gdb_printf (
+ " tdesc_add_field (type_with_fields, \"%s\", field_type);\n",
+ f.name.c_str ());
}
break;
case TDESC_TYPE_ENUM:
- gdb_printf
- (" type_with_fields = tdesc_create_enum (feature, \"%s\", %d);\n",
- type->name.c_str (), type->size);
+ gdb_printf (
+ " type_with_fields = tdesc_create_enum (feature, \"%s\", %d);\n",
+ type->name.c_str (), type->size);
for (const tdesc_type_field &f : type->fields)
- gdb_printf
- (" tdesc_add_enum_value (type_with_fields, %d, \"%s\");\n",
- f.start, f.name.c_str ());
+ gdb_printf (
+ " tdesc_add_enum_value (type_with_fields, %d, \"%s\");\n",
+ f.start, f.name.c_str ());
break;
default:
- error (_("C output is not supported type \"%s\"."), type->name.c_str ());
+ error (_ ("C output is not supported type \"%s\"."),
+ type->name.c_str ());
}
gdb_printf ("\n");
@@ -1484,8 +1471,7 @@ public:
void visit (const tdesc_reg *reg) override
{
gdb_printf (" tdesc_create_reg (feature, \"%s\", %ld, %d, ",
- reg->name.c_str (), reg->target_regnum,
- reg->save_restore);
+ reg->name.c_str (), reg->target_regnum, reg->save_restore);
if (!reg->group.empty ())
gdb_printf ("\"%s\", ", reg->group.c_str ());
else
@@ -1494,6 +1480,7 @@ public:
}
protected:
+
std::string m_filename_after_features;
private:
@@ -1501,6 +1488,7 @@ private:
/* Print an assignment to the field_type variable. Print the declaration
of field_type if that has not been done yet. */
ATTRIBUTE_PRINTF (2, 3)
+
void printf_field_type_assignment (const char *fmt, ...)
{
if (!m_printed_field_type)
@@ -1534,6 +1522,7 @@ private:
class print_c_feature : public print_c_tdesc
{
public:
+
print_c_feature (std::string &file)
: print_c_tdesc (file)
{
@@ -1552,8 +1541,7 @@ public:
gdb_printf ("\n");
}
- void visit_post (const target_desc *e) override
- {}
+ void visit_post (const target_desc *e) override {}
void visit_pre (const tdesc_feature *e) override
{
@@ -1572,9 +1560,8 @@ public:
gdb_printf ("{\n");
gdb_printf (" struct tdesc_feature *feature;\n");
- gdb_printf
- ("\n feature = tdesc_create_feature (result, \"%s\");\n",
- e->name.c_str ());
+ gdb_printf ("\n feature = tdesc_create_feature (result, \"%s\");\n",
+ e->name.c_str ());
}
void visit_post (const tdesc_feature *e) override
@@ -1613,11 +1600,9 @@ public:
and also print the message so that it can be saved in the
generated c file. */
- gdb_printf ("ERROR: \"regnum\" attribute %ld ",
- reg->target_regnum);
- gdb_printf ("is not the largest number (%d).\n",
- m_next_regnum);
- error (_("\"regnum\" attribute %ld is not the largest number (%d)."),
+ gdb_printf ("ERROR: \"regnum\" attribute %ld ", reg->target_regnum);
+ gdb_printf ("is not the largest number (%d).\n", m_next_regnum);
+ error (_ ("\"regnum\" attribute %ld is not the largest number (%d)."),
reg->target_regnum, m_next_regnum);
}
@@ -1639,6 +1624,7 @@ public:
}
private:
+
/* The register number to use for the next register we see. */
int m_next_regnum = 0;
};
@@ -1674,14 +1660,13 @@ static const gdb::option::option_def maint_print_c_tdesc_opt_defs[] = {
maint_print_c_tdesc_opt_def {
"single-feature",
[] (maint_print_c_tdesc_options *opt) { return &opt->single_feature; },
- N_("Print C description of just a single feature.")
- },
+ N_ ("Print C description of just a single feature.") },
};
static inline gdb::option::option_def_group
make_maint_print_c_tdesc_options_def_group (maint_print_c_tdesc_options *opts)
{
- return {{maint_print_c_tdesc_opt_defs}, opts};
+ return { { maint_print_c_tdesc_opt_defs }, opts };
}
/* Implement 'maintenance print c-tdesc' command. */
@@ -1694,8 +1679,9 @@ maint_print_c_tdesc_cmd (const char *args, int from_tty)
maint_print_c_tdesc_options opts;
auto grp = make_maint_print_c_tdesc_options_def_group (&opts);
- gdb::option::process_options
- (&args, gdb::option::PROCESS_OPTIONS_UNKNOWN_IS_ERROR, grp);
+ gdb::option::process_options (&args,
+ gdb::option::PROCESS_OPTIONS_UNKNOWN_IS_ERROR,
+ grp);
if (args == NULL)
{
@@ -1715,7 +1701,7 @@ maint_print_c_tdesc_cmd (const char *args, int from_tty)
}
if (tdesc == NULL)
- error (_("There is no target description to print."));
+ error (_ ("There is no target description to print."));
if (filename == NULL)
filename = "fetched from target";
@@ -1732,8 +1718,8 @@ maint_print_c_tdesc_cmd (const char *args, int from_tty)
if (opts.single_feature)
{
if (tdesc->features.size () != 1)
- error (_("only target descriptions with 1 feature can be used "
- "with -single-feature option"));
+ error (_ ("only target descriptions with 1 feature can be used "
+ "with -single-feature option"));
print_c_feature v (filename_after_features);
@@ -1755,8 +1741,8 @@ maint_print_c_tdesc_cmd_completer (struct cmd_list_element *ignore,
const char *text, const char *word)
{
auto grp = make_maint_print_c_tdesc_options_def_group (nullptr);
- if (gdb::option::complete_options
- (tracker, &text, gdb::option::PROCESS_OPTIONS_UNKNOWN_IS_ERROR, grp))
+ if (gdb::option::complete_options (
+ tracker, &text, gdb::option::PROCESS_OPTIONS_UNKNOWN_IS_ERROR, grp))
return;
word = advance_to_filename_complete_word_point (tracker, text);
@@ -1785,7 +1771,7 @@ maint_print_xml_tdesc_cmd (const char *args, int from_tty)
}
if (tdesc == NULL)
- error (_("There is no target description to print."));
+ error (_ ("There is no target description to print."));
std::string buf;
print_xml_feature v (&buf);
@@ -1793,15 +1779,18 @@ maint_print_xml_tdesc_cmd (const char *args, int from_tty)
gdb_puts (buf.c_str ());
}
-namespace selftests {
+namespace selftests
+{
/* A reference target description, used for testing (see record_xml_tdesc). */
struct xml_test_tdesc
{
xml_test_tdesc (const char *name, std::unique_ptr<const target_desc> &&tdesc)
- : name (name), tdesc (std::move (tdesc))
- {}
+ : name (name),
+ tdesc (std::move (tdesc))
+ {
+ }
const char *name;
std::unique_ptr<const target_desc> tdesc;
@@ -1816,24 +1805,25 @@ static std::vector<xml_test_tdesc> xml_tdesc;
void
record_xml_tdesc (const char *xml_file, const struct target_desc *tdesc)
{
- xml_tdesc.emplace_back (xml_file, std::unique_ptr<const target_desc> (tdesc));
+ xml_tdesc.emplace_back (xml_file,
+ std::unique_ptr<const target_desc> (tdesc));
}
#endif
-}
+} // namespace selftests
/* Test the conversion process of a target description to/from xml: Take a target
description TDESC, convert to xml, back to a description, and confirm the new
tdesc is identical to the original. */
static bool
-maintenance_check_tdesc_xml_convert (const target_desc *tdesc, const char *name)
+maintenance_check_tdesc_xml_convert (const target_desc *tdesc,
+ const char *name)
{
const char *xml = tdesc_get_features_xml (tdesc);
if (xml == nullptr || *xml != '@')
{
- gdb_printf (_("Could not convert description for %s to xml.\n"),
- name);
+ gdb_printf (_ ("Could not convert description for %s to xml.\n"), name);
return false;
}
@@ -1841,20 +1831,18 @@ maintenance_check_tdesc_xml_convert (const target_desc *tdesc, const char *name)
if (tdesc_trans == nullptr)
{
- gdb_printf (_("Could not convert description for %s from xml.\n"),
+ gdb_printf (_ ("Could not convert description for %s from xml.\n"),
name);
return false;
}
else if (*tdesc != *tdesc_trans)
{
- gdb_printf (_("Converted description for %s does not match.\n"),
- name);
+ gdb_printf (_ ("Converted description for %s does not match.\n"), name);
return false;
}
return true;
}
-
/* Check that the target descriptions created dynamically by
architecture-specific code equal the descriptions created from XML files
found in the specified directory DIR. */
@@ -1863,7 +1851,7 @@ static void
maintenance_check_xml_descriptions (const char *dir, int from_tty)
{
if (dir == NULL)
- error (_("Missing dir name"));
+ error (_ ("Missing dir name"));
gdb::unique_xmalloc_ptr<char> dir1 (tilde_expand (dir));
std::string feature_dir (dir1.get ());
@@ -1872,58 +1860,58 @@ maintenance_check_xml_descriptions (const char *dir, int from_tty)
for (auto const &e : selftests::xml_tdesc)
{
std::string tdesc_xml = (feature_dir + SLASH_STRING + e.name);
- const target_desc *tdesc
- = file_read_description_xml (tdesc_xml.data ());
+ const target_desc *tdesc = file_read_description_xml (tdesc_xml.data ());
if (tdesc == NULL || *tdesc != *e.tdesc)
{
- gdb_printf ( _("Descriptions for %s do not match.\n"), e.name);
+ gdb_printf (_ ("Descriptions for %s do not match.\n"), e.name);
failed++;
}
else if (!maintenance_check_tdesc_xml_convert (tdesc, e.name)
- || !maintenance_check_tdesc_xml_convert (e.tdesc.get (), e.name))
+ || !maintenance_check_tdesc_xml_convert (e.tdesc.get (),
+ e.name))
failed++;
}
- gdb_printf (_("Tested %lu XML files, %d failed\n"),
+ gdb_printf (_ ("Tested %lu XML files, %d failed\n"),
(long) selftests::xml_tdesc.size (), failed);
}
void _initialize_target_descriptions ();
+
void
_initialize_target_descriptions ()
{
cmd_list_element *cmd;
add_setshow_prefix_cmd ("tdesc", class_maintenance,
- _("Set target description specific variables."),
- _("Show target description specific variables."),
- &tdesc_set_cmdlist, &tdesc_show_cmdlist,
- &setlist, &showlist);
+ _ ("Set target description specific variables."),
+ _ ("Show target description specific variables."),
+ &tdesc_set_cmdlist, &tdesc_show_cmdlist, &setlist,
+ &showlist);
- add_basic_prefix_cmd ("tdesc", class_maintenance, _("\
+ add_basic_prefix_cmd ("tdesc", class_maintenance, _ ("\
Unset target description specific variables."),
- &tdesc_unset_cmdlist,
- 0 /* allow-unknown */, &unsetlist);
+ &tdesc_unset_cmdlist, 0 /* allow-unknown */,
+ &unsetlist);
add_setshow_filename_cmd ("filename", class_obscure,
- &tdesc_filename_cmd_string,
- _("\
-Set the file to read for an XML target description."), _("\
-Show the file to read for an XML target description."), _("\
+ &tdesc_filename_cmd_string, _ ("\
+Set the file to read for an XML target description."),
+ _ ("\
+Show the file to read for an XML target description."),
+ _ ("\
When set, GDB will read the target description from a local\n\
file instead of querying the remote target."),
- set_tdesc_filename_cmd,
- show_tdesc_filename_cmd,
+ set_tdesc_filename_cmd, show_tdesc_filename_cmd,
&tdesc_set_cmdlist, &tdesc_show_cmdlist);
- add_cmd ("filename", class_obscure, unset_tdesc_filename_cmd, _("\
+ add_cmd ("filename", class_obscure, unset_tdesc_filename_cmd, _ ("\
Unset the file to read for an XML target description.\n\
When unset, GDB will read the description from the target."),
&tdesc_unset_cmdlist);
auto grp = make_maint_print_c_tdesc_options_def_group (nullptr);
- static std::string help_text
- = gdb::option::build_help (_("\
+ static std::string help_text = gdb::option::build_help (_ ("\
Print the current target description as a C source file.\n\
Usage: maintenance print c-tdesc [OPTION] [FILENAME]\n\
\n\
@@ -1936,18 +1924,20 @@ FILENAME and printed as a C function.\n\
\n\
When '-single-feature' is used then the target description should\n\
contain a single feature and the generated C code will only create\n\
-that feature within an already existing target_desc object."), grp);
+that feature within an already existing target_desc object."),
+ grp);
cmd = add_cmd ("c-tdesc", class_maintenance, maint_print_c_tdesc_cmd,
help_text.c_str (), &maintenanceprintlist);
set_cmd_completer_handle_brkchars (cmd, maint_print_c_tdesc_cmd_completer);
- cmd = add_cmd ("xml-tdesc", class_maintenance, maint_print_xml_tdesc_cmd, _("\
+ cmd
+ = add_cmd ("xml-tdesc", class_maintenance, maint_print_xml_tdesc_cmd, _ ("\
Print the current target description as an XML file."),
- &maintenanceprintlist);
+ &maintenanceprintlist);
set_cmd_completer (cmd, filename_completer);
cmd = add_cmd ("xml-descriptions", class_maintenance,
- maintenance_check_xml_descriptions, _("\
+ maintenance_check_xml_descriptions, _ ("\
Check equality of GDB target descriptions and XML created descriptions.\n\
Check the target descriptions created in GDB equal the descriptions\n\
created from XML files in the directory.\n\
diff --git a/gdb/target-descriptions.h b/gdb/target-descriptions.h
index ee48fdfaa0c..74399cb2721 100644
--- a/gdb/target-descriptions.h
+++ b/gdb/target-descriptions.h
@@ -51,15 +51,15 @@ const struct target_desc *target_current_description (void);
They are equivalent to the gdbarch methods with similar names,
except that they will only be called for pseudo registers. */
-void set_tdesc_pseudo_register_name
- (struct gdbarch *gdbarch, gdbarch_register_name_ftype *pseudo_name);
+void set_tdesc_pseudo_register_name (struct gdbarch *gdbarch,
+ gdbarch_register_name_ftype *pseudo_name);
-void set_tdesc_pseudo_register_type
- (struct gdbarch *gdbarch, gdbarch_register_type_ftype *pseudo_type);
+void set_tdesc_pseudo_register_type (struct gdbarch *gdbarch,
+ gdbarch_register_type_ftype *pseudo_type);
-void set_tdesc_pseudo_register_reggroup_p
- (struct gdbarch *gdbarch,
- gdbarch_register_reggroup_p_ftype *pseudo_reggroup_p);
+void set_tdesc_pseudo_register_reggroup_p (
+ struct gdbarch *gdbarch,
+ gdbarch_register_reggroup_p_ftype *pseudo_reggroup_p);
/* Pointer to a function that should be called for each unknown register in
a target description, used by TDESC_USE_REGISTERS.
@@ -81,9 +81,10 @@ void set_tdesc_pseudo_register_reggroup_p
appear in the target description. This means all unknown registers
within a single feature will be called one after another. */
-typedef int (*tdesc_unknown_register_ftype)
- (struct gdbarch *gdbarch, tdesc_feature *feature,
- const char *reg_name, int possible_regnum);
+typedef int (*tdesc_unknown_register_ftype) (struct gdbarch *gdbarch,
+ tdesc_feature *feature,
+ const char *reg_name,
+ int possible_regnum);
/* A deleter adapter for a target arch data. */
@@ -126,8 +127,8 @@ tdesc_arch_data_up tdesc_data_alloc ();
0 if it was not. */
int tdesc_numbered_register (const struct tdesc_feature *feature,
- struct tdesc_arch_data *data,
- int regno, const char *name);
+ struct tdesc_arch_data *data, int regno,
+ const char *name);
/* Search FEATURE for a register named NAME, but do not assign a fixed
register number to it. */
@@ -148,8 +149,8 @@ int tdesc_register_bitsize (const struct tdesc_feature *feature,
not. */
int tdesc_numbered_register_choices (const struct tdesc_feature *feature,
- struct tdesc_arch_data *data,
- int regno, const char *const names[]);
+ struct tdesc_arch_data *data, int regno,
+ const char *const names[]);
/* Return true if DATA contains an entry for REGNO, a GDB register
number. */
@@ -161,8 +162,7 @@ extern bool tdesc_found_register (struct tdesc_arch_data *data, int regno);
/* Return the BFD architecture associated with this target
description, or NULL if no architecture was specified. */
-const struct bfd_arch_info *tdesc_architecture
- (const struct target_desc *);
+const struct bfd_arch_info *tdesc_architecture (const struct target_desc *);
/* Return the OSABI associated with this target description, or
GDB_OSABI_UNKNOWN if no osabi was specified. */
@@ -178,8 +178,7 @@ int tdesc_compatible_p (const struct target_desc *,
/* Return the string value of a property named KEY, or NULL if the
property was not specified. */
-const char *tdesc_property (const struct target_desc *,
- const char *key);
+const char *tdesc_property (const struct target_desc *, const char *key);
/* Return 1 if this target description describes any registers. */
@@ -221,21 +220,20 @@ int tdesc_register_in_reggroup_p (struct gdbarch *gdbarch, int regno,
void set_tdesc_architecture (struct target_desc *,
const struct bfd_arch_info *);
void set_tdesc_osabi (struct target_desc *, enum gdb_osabi osabi);
-void set_tdesc_property (struct target_desc *,
- const char *key, const char *value);
-void tdesc_add_compatible (struct target_desc *,
- const struct bfd_arch_info *);
+void set_tdesc_property (struct target_desc *, const char *key,
+ const char *value);
+void tdesc_add_compatible (struct target_desc *, const struct bfd_arch_info *);
#if GDB_SELF_TEST
-namespace selftests {
+namespace selftests
+{
/* Record that XML_FILE should generate a target description that equals
TDESC, to be verified by the "maintenance check xml-descriptions"
command. This function takes ownership of TDESC. */
-void record_xml_tdesc (const char *xml_file,
- const struct target_desc *tdesc);
-}
+void record_xml_tdesc (const char *xml_file, const struct target_desc *tdesc);
+} // namespace selftests
#endif
#endif /* TARGET_DESCRIPTIONS_H */
diff --git a/gdb/target-float.c b/gdb/target-float.c
index d2f78e2167f..456a81289b7 100644
--- a/gdb/target-float.c
+++ b/gdb/target-float.c
@@ -34,33 +34,43 @@
class target_float_ops
{
public:
+
virtual std::string to_string (const gdb_byte *addr, const struct type *type,
- const char *format) const = 0;
+ const char *format) const
+ = 0;
virtual bool from_string (gdb_byte *addr, const struct type *type,
- const std::string &string) const = 0;
+ const std::string &string) const
+ = 0;
virtual LONGEST to_longest (const gdb_byte *addr,
- const struct type *type) const = 0;
+ const struct type *type) const
+ = 0;
virtual void from_longest (gdb_byte *addr, const struct type *type,
- LONGEST val) const = 0;
+ LONGEST val) const
+ = 0;
virtual void from_ulongest (gdb_byte *addr, const struct type *type,
- ULONGEST val) const = 0;
+ ULONGEST val) const
+ = 0;
virtual double to_host_double (const gdb_byte *addr,
- const struct type *type) const = 0;
+ const struct type *type) const
+ = 0;
virtual void from_host_double (gdb_byte *addr, const struct type *type,
- double val) const = 0;
+ double val) const
+ = 0;
virtual void convert (const gdb_byte *from, const struct type *from_type,
- gdb_byte *to, const struct type *to_type) const = 0;
-
- virtual void binop (enum exp_opcode opcode,
- const gdb_byte *x, const struct type *type_x,
- const gdb_byte *y, const struct type *type_y,
- gdb_byte *res, const struct type *type_res) const = 0;
+ gdb_byte *to, const struct type *to_type) const
+ = 0;
+
+ virtual void binop (enum exp_opcode opcode, const gdb_byte *x,
+ const struct type *type_x, const gdb_byte *y,
+ const struct type *type_y, gdb_byte *res,
+ const struct type *type_res) const
+ = 0;
virtual int compare (const gdb_byte *x, const struct type *type_x,
- const gdb_byte *y, const struct type *type_y) const = 0;
+ const gdb_byte *y, const struct type *type_y) const
+ = 0;
};
-
/* Helper routines operating on binary floating-point data. */
#include <cmath>
@@ -69,7 +79,8 @@ public:
/* Different kinds of floatformat numbers recognized by
floatformat_classify. To avoid portability issues, we use local
values instead of the C99 macros (FP_NAN et cetera). */
-enum float_kind {
+enum float_kind
+{
float_nan,
float_infinite,
float_zero,
@@ -90,8 +101,7 @@ enum float_kind {
static size_t
floatformat_totalsize_bytes (const struct floatformat *fmt)
{
- return ((fmt->totalsize + FLOATFORMAT_CHAR_BIT - 1)
- / FLOATFORMAT_CHAR_BIT);
+ return ((fmt->totalsize + FLOATFORMAT_CHAR_BIT - 1) / FLOATFORMAT_CHAR_BIT);
}
/* Return the precision of the floating point format FMT. */
@@ -130,8 +140,8 @@ floatformat_normalize_byteorder (const struct floatformat *fmt,
words = fmt->totalsize / FLOATFORMAT_CHAR_BIT;
words >>= 2;
- swapout = (unsigned char *)to;
- swapin = (const unsigned char *)from;
+ swapout = (unsigned char *) to;
+ swapin = (const unsigned char *) from;
if (fmt->byteorder == floatformat_vax)
{
@@ -196,8 +206,8 @@ get_field (const bfd_byte *data, enum floatformat_byteorders order,
else
{
cur_byte = (start + len) / FLOATFORMAT_CHAR_BIT;
- cur_bitshift =
- ((start + len) % FLOATFORMAT_CHAR_BIT) - FLOATFORMAT_CHAR_BIT;
+ cur_bitshift
+ = ((start + len) % FLOATFORMAT_CHAR_BIT) - FLOATFORMAT_CHAR_BIT;
}
if (cur_bitshift > -FLOATFORMAT_CHAR_BIT)
result = *(data + cur_byte) >> (-cur_bitshift);
@@ -212,7 +222,7 @@ get_field (const bfd_byte *data, enum floatformat_byteorders order,
/* Move towards the most significant part of the field. */
while (cur_bitshift < len)
{
- result |= (unsigned long)*(data + cur_byte) << cur_bitshift;
+ result |= (unsigned long) *(data + cur_byte) << cur_bitshift;
cur_bitshift += FLOATFORMAT_CHAR_BIT;
switch (order)
{
@@ -224,7 +234,7 @@ get_field (const bfd_byte *data, enum floatformat_byteorders order,
break;
}
}
- if (len < sizeof(result) * FLOATFORMAT_CHAR_BIT)
+ if (len < sizeof (result) * FLOATFORMAT_CHAR_BIT)
/* Mask out bits which are not part of the field. */
result &= ((1UL << len) - 1);
return result;
@@ -256,16 +266,16 @@ put_field (unsigned char *data, enum floatformat_byteorders order,
else
{
cur_byte = (start + len) / FLOATFORMAT_CHAR_BIT;
- cur_bitshift =
- ((start + len) % FLOATFORMAT_CHAR_BIT) - FLOATFORMAT_CHAR_BIT;
+ cur_bitshift
+ = ((start + len) % FLOATFORMAT_CHAR_BIT) - FLOATFORMAT_CHAR_BIT;
}
if (cur_bitshift > -FLOATFORMAT_CHAR_BIT)
{
- *(data + cur_byte) &=
- ~(((1 << ((start + len) % FLOATFORMAT_CHAR_BIT)) - 1)
- << (-cur_bitshift));
- *(data + cur_byte) |=
- (stuff_to_put & ((1 << FLOATFORMAT_CHAR_BIT) - 1)) << (-cur_bitshift);
+ *(data + cur_byte)
+ &= ~(((1 << ((start + len) % FLOATFORMAT_CHAR_BIT)) - 1)
+ << (-cur_bitshift));
+ *(data + cur_byte) |= (stuff_to_put & ((1 << FLOATFORMAT_CHAR_BIT) - 1))
+ << (-cur_bitshift);
}
cur_bitshift += FLOATFORMAT_CHAR_BIT;
if (order == floatformat_little)
@@ -279,8 +289,7 @@ put_field (unsigned char *data, enum floatformat_byteorders order,
if (len - cur_bitshift < FLOATFORMAT_CHAR_BIT)
{
/* This is the last byte. */
- *(data + cur_byte) &=
- ~((1 << (len - cur_bitshift)) - 1);
+ *(data + cur_byte) &= ~((1 << (len - cur_bitshift)) - 1);
*(data + cur_byte) |= (stuff_to_put >> cur_bitshift);
}
else
@@ -297,8 +306,7 @@ put_field (unsigned char *data, enum floatformat_byteorders order,
/* Check if VAL (which is assumed to be a floating point number whose
format is described by FMT) is negative. */
static int
-floatformat_is_negative (const struct floatformat *fmt,
- const bfd_byte *uval)
+floatformat_is_negative (const struct floatformat *fmt, const bfd_byte *uval)
{
enum floatformat_byteorders order;
unsigned char newfrom[FLOATFORMAT_LARGEST_BYTES];
@@ -322,8 +330,7 @@ floatformat_is_negative (const struct floatformat *fmt,
/* Check if VAL is "not a number" (NaN) for FMT. */
static enum float_kind
-floatformat_classify (const struct floatformat *fmt,
- const bfd_byte *uval)
+floatformat_classify (const struct floatformat *fmt, const bfd_byte *uval)
{
long exponent;
unsigned long mant;
@@ -349,8 +356,8 @@ floatformat_classify (const struct floatformat *fmt,
if (order != fmt->byteorder)
uval = newfrom;
- exponent = get_field (uval, order, fmt->totalsize, fmt->exp_start,
- fmt->exp_len);
+ exponent
+ = get_field (uval, order, fmt->totalsize, fmt->exp_start, fmt->exp_len);
mant_bits_left = fmt->man_len;
mant_off = fmt->man_start;
@@ -363,8 +370,7 @@ floatformat_classify (const struct floatformat *fmt,
mant = get_field (uval, order, fmt->totalsize, mant_off, mant_bits);
/* If there is an explicit integer bit, mask it off. */
- if (mant_off == fmt->man_start
- && fmt->intbit == floatformat_intbit_yes)
+ if (mant_off == fmt->man_start && fmt->intbit == floatformat_intbit_yes)
mant &= ~(1 << (mant_bits - 1));
if (mant)
@@ -379,7 +385,7 @@ floatformat_classify (const struct floatformat *fmt,
/* If exp_nan is not set, assume that inf, NaN, and subnormals are not
supported. */
- if (! fmt->exp_nan)
+ if (!fmt->exp_nan)
{
if (mant_zero)
return float_zero;
@@ -410,8 +416,7 @@ floatformat_classify (const struct floatformat *fmt,
point number whose format is described by FMT) into a hexadecimal
and store it in a static string. Return a pointer to that string. */
static const char *
-floatformat_mantissa (const struct floatformat *fmt,
- const bfd_byte *val)
+floatformat_mantissa (const struct floatformat *fmt, const bfd_byte *val)
{
unsigned char *uval = (unsigned char *) val;
unsigned long mant;
@@ -442,7 +447,7 @@ floatformat_mantissa (const struct floatformat *fmt,
if (order != fmt->byteorder)
uval = newfrom;
- if (! fmt->exp_nan)
+ if (!fmt->exp_nan)
return 0;
/* Make sure we have enough room to store the mantissa. */
@@ -480,8 +485,8 @@ floatformat_mantissa (const struct floatformat *fmt,
return a format appropriate to print the full precision of a target
floating-point number of format FMT. */
static std::string
-floatformat_printf_format (const struct floatformat *fmt,
- const char *format, char length)
+floatformat_printf_format (const struct floatformat *fmt, const char *format,
+ char length)
{
std::string host_format;
char conversion;
@@ -532,9 +537,11 @@ floatformat_printf_format (const struct floatformat *fmt,
/* Implementation of target_float_ops using the host floating-point type T
as intermediate type. */
-template<typename T> class host_float_ops : public target_float_ops
+template<typename T>
+class host_float_ops : public target_float_ops
{
public:
+
std::string to_string (const gdb_byte *addr, const struct type *type,
const char *format) const override;
bool from_string (gdb_byte *addr, const struct type *type,
@@ -553,25 +560,24 @@ public:
void convert (const gdb_byte *from, const struct type *from_type,
gdb_byte *to, const struct type *to_type) const override;
- void binop (enum exp_opcode opcode,
- const gdb_byte *x, const struct type *type_x,
- const gdb_byte *y, const struct type *type_y,
- gdb_byte *res, const struct type *type_res) const override;
- int compare (const gdb_byte *x, const struct type *type_x,
- const gdb_byte *y, const struct type *type_y) const override;
+ void binop (enum exp_opcode opcode, const gdb_byte *x,
+ const struct type *type_x, const gdb_byte *y,
+ const struct type *type_y, gdb_byte *res,
+ const struct type *type_res) const override;
+ int compare (const gdb_byte *x, const struct type *type_x, const gdb_byte *y,
+ const struct type *type_y) const override;
private:
- void from_target (const struct floatformat *fmt,
- const gdb_byte *from, T *to) const;
- void from_target (const struct type *type,
- const gdb_byte *from, T *to) const;
-
- void to_target (const struct type *type,
- const T *from, gdb_byte *to) const;
- void to_target (const struct floatformat *fmt,
- const T *from, gdb_byte *to) const;
-};
+ void from_target (const struct floatformat *fmt, const gdb_byte *from,
+ T *to) const;
+ void from_target (const struct type *type, const gdb_byte *from,
+ T *to) const;
+
+ void to_target (const struct type *type, const T *from, gdb_byte *to) const;
+ void to_target (const struct floatformat *fmt, const T *from,
+ gdb_byte *to) const;
+};
/* Convert TO/FROM target to the host floating-point format T.
@@ -595,7 +601,8 @@ static const struct floatformat *host_long_double_format
/* Convert target floating-point value at FROM in format FMT to host
floating-point format of type T. */
-template<typename T> void
+template<typename T>
+void
host_float_ops<T>::from_target (const struct floatformat *fmt,
const gdb_byte *from, T *to) const
{
@@ -631,7 +638,7 @@ host_float_ops<T>::from_target (const struct floatformat *fmt,
unsigned long mant;
unsigned int mant_bits, mant_off;
int mant_bits_left;
- int special_exponent; /* It's a NaN, denorm or zero. */
+ int special_exponent; /* It's a NaN, denorm or zero. */
enum floatformat_byteorders order;
unsigned char newfrom[FLOATFORMAT_LARGEST_BYTES];
enum float_kind kind;
@@ -647,7 +654,7 @@ host_float_ops<T>::from_target (const struct floatformat *fmt,
{
double dto;
- floatformat_to_double /* ARI: floatformat_to_double */
+ floatformat_to_double /* ARI: floatformat_to_double */
(fmt->split_half ? fmt->split_half : fmt, from, &dto);
*to = (T) dto;
return;
@@ -676,8 +683,8 @@ host_float_ops<T>::from_target (const struct floatformat *fmt,
return;
}
- exponent = get_field (ufrom, order, fmt->totalsize, fmt->exp_start,
- fmt->exp_len);
+ exponent
+ = get_field (ufrom, order, fmt->totalsize, fmt->exp_start, fmt->exp_len);
/* Note that if exponent indicates a NaN, we can't really do anything useful
(not knowing if the host has NaN's, or how to build one). So it will
end up as an infinity or something close; that is OK. */
@@ -729,18 +736,20 @@ host_float_ops<T>::from_target (const struct floatformat *fmt,
*to = dto;
}
-template<typename T> void
-host_float_ops<T>::from_target (const struct type *type,
- const gdb_byte *from, T *to) const
+template<typename T>
+void
+host_float_ops<T>::from_target (const struct type *type, const gdb_byte *from,
+ T *to) const
{
from_target (floatformat_from_type (type), from, to);
}
/* Convert host floating-point value of type T to target floating-point
value in format FMT and store at TO. */
-template<typename T> void
-host_float_ops<T>::to_target (const struct floatformat *fmt,
- const T *from, gdb_byte *to) const
+template<typename T>
+void
+host_float_ops<T>::to_target (const struct floatformat *fmt, const T *from,
+ gdb_byte *to) const
{
gdb_assert (fmt != NULL);
@@ -808,15 +817,14 @@ host_float_ops<T>::to_target (const struct floatformat *fmt,
}
if (dfrom == 0)
- goto finalize_byteorder; /* Result is zero */
- if (dfrom != dfrom) /* Result is NaN */
+ goto finalize_byteorder; /* Result is zero */
+ if (dfrom != dfrom) /* Result is NaN */
{
/* From is NaN */
- put_field (uto, order, fmt->totalsize, fmt->exp_start,
- fmt->exp_len, fmt->exp_nan);
+ put_field (uto, order, fmt->totalsize, fmt->exp_start, fmt->exp_len,
+ fmt->exp_nan);
/* Be sure it's not infinity, but NaN value is irrel. */
- put_field (uto, order, fmt->totalsize, fmt->man_start,
- fmt->man_len, 1);
+ put_field (uto, order, fmt->totalsize, fmt->man_start, fmt->man_len, 1);
goto finalize_byteorder;
}
@@ -827,14 +835,13 @@ host_float_ops<T>::to_target (const struct floatformat *fmt,
dfrom = -dfrom;
}
- if (dfrom + dfrom == dfrom && dfrom != 0.0) /* Result is Infinity. */
+ if (dfrom + dfrom == dfrom && dfrom != 0.0) /* Result is Infinity. */
{
/* Infinity exponent is same as NaN's. */
- put_field (uto, order, fmt->totalsize, fmt->exp_start,
- fmt->exp_len, fmt->exp_nan);
+ put_field (uto, order, fmt->totalsize, fmt->exp_start, fmt->exp_len,
+ fmt->exp_nan);
/* Infinity mantissa is all zeroes. */
- put_field (uto, order, fmt->totalsize, fmt->man_start,
- fmt->man_len, 0);
+ put_field (uto, order, fmt->totalsize, fmt->man_start, fmt->man_len, 0);
goto finalize_byteorder;
}
@@ -844,10 +851,8 @@ host_float_ops<T>::to_target (const struct floatformat *fmt,
{
/* The value is too small to be expressed in the destination
type (not enough bits in the exponent. Treat as 0. */
- put_field (uto, order, fmt->totalsize, fmt->exp_start,
- fmt->exp_len, 0);
- put_field (uto, order, fmt->totalsize, fmt->man_start,
- fmt->man_len, 0);
+ put_field (uto, order, fmt->totalsize, fmt->exp_start, fmt->exp_len, 0);
+ put_field (uto, order, fmt->totalsize, fmt->man_start, fmt->man_len, 0);
goto finalize_byteorder;
}
@@ -855,10 +860,9 @@ host_float_ops<T>::to_target (const struct floatformat *fmt,
{
/* The value is too large to fit into the destination.
Treat as infinity. */
- put_field (uto, order, fmt->totalsize, fmt->exp_start,
- fmt->exp_len, fmt->exp_nan);
- put_field (uto, order, fmt->totalsize, fmt->man_start,
- fmt->man_len, 0);
+ put_field (uto, order, fmt->totalsize, fmt->exp_start, fmt->exp_len,
+ fmt->exp_nan);
+ put_field (uto, order, fmt->totalsize, fmt->man_start, fmt->man_len, 0);
goto finalize_byteorder;
}
@@ -904,21 +908,21 @@ host_float_ops<T>::to_target (const struct floatformat *fmt,
mant_long >>= 32 - mant_bits;
}
- put_field (uto, order, fmt->totalsize,
- mant_off, mant_bits, mant_long);
+ put_field (uto, order, fmt->totalsize, mant_off, mant_bits, mant_long);
mant_off += mant_bits;
mant_bits_left -= mant_bits;
}
- finalize_byteorder:
+finalize_byteorder:
/* Do we need to byte-swap the words in the result? */
if (order != fmt->byteorder)
floatformat_normalize_byteorder (fmt, newto, to);
}
-template<typename T> void
-host_float_ops<T>::to_target (const struct type *type,
- const T *from, gdb_byte *to) const
+template<typename T>
+void
+host_float_ops<T>::to_target (const struct type *type, const T *from,
+ gdb_byte *to) const
{
/* Ensure possible padding bytes in the target buffer are zeroed out. */
memset (to, 0, type->length ());
@@ -928,15 +932,20 @@ host_float_ops<T>::to_target (const struct type *type,
/* Convert the byte-stream ADDR, interpreted as floating-point type TYPE,
to a string, optionally using the print format FORMAT. */
-template<typename T> struct printf_length_modifier
+template<typename T>
+struct printf_length_modifier
{
static constexpr char value = 0;
};
-template<> struct printf_length_modifier<long double>
+
+template<>
+struct printf_length_modifier<long double>
{
static constexpr char value = 'L';
};
-template<typename T> std::string
+
+template<typename T>
+std::string
host_float_ops<T>::to_string (const gdb_byte *addr, const struct type *type,
const char *format) const
{
@@ -956,19 +965,26 @@ host_float_ops<T>::to_string (const gdb_byte *addr, const struct type *type,
/* Parse string IN into a target floating-number of type TYPE and
store it as byte-stream ADDR. Return whether parsing succeeded. */
-template<typename T> struct scanf_length_modifier
+template<typename T>
+struct scanf_length_modifier
{
static constexpr char value = 0;
};
-template<> struct scanf_length_modifier<double>
+
+template<>
+struct scanf_length_modifier<double>
{
static constexpr char value = 'l';
};
-template<> struct scanf_length_modifier<long double>
+
+template<>
+struct scanf_length_modifier<long double>
{
static constexpr char value = 'L';
};
-template<typename T> bool
+
+template<typename T>
+bool
host_float_ops<T>::from_string (gdb_byte *addr, const struct type *type,
const std::string &in) const
{
@@ -982,7 +998,7 @@ host_float_ops<T>::from_string (gdb_byte *addr, const struct type *type,
DIAGNOSTIC_PUSH
DIAGNOSTIC_IGNORE_FORMAT_NONLITERAL
- num = sscanf (in.c_str (), scan_format.c_str(), &host_float, &n);
+ num = sscanf (in.c_str (), scan_format.c_str (), &host_float, &n);
DIAGNOSTIC_POP
/* The sscanf man page suggests not making any assumptions on the effect
@@ -1001,13 +1017,14 @@ host_float_ops<T>::from_string (gdb_byte *addr, const struct type *type,
/* Convert the byte-stream ADDR, interpreted as floating-point type TYPE,
to an integer value (rounding towards zero). */
-template<typename T> LONGEST
+template<typename T>
+LONGEST
host_float_ops<T>::to_longest (const gdb_byte *addr,
const struct type *type) const
{
T host_float;
from_target (type, addr, &host_float);
- T min_possible_range = static_cast<T>(std::numeric_limits<LONGEST>::min());
+ T min_possible_range = static_cast<T> (std::numeric_limits<LONGEST>::min ());
T max_possible_range = -min_possible_range;
/* host_float can be converted to an integer as long as it's in
the range [min_possible_range, max_possible_range). If not, it is either
@@ -1016,14 +1033,15 @@ host_float_ops<T>::to_longest (const gdb_byte *addr,
if (host_float < max_possible_range && host_float >= min_possible_range)
return static_cast<LONGEST> (host_float);
if (host_float < min_possible_range)
- return std::numeric_limits<LONGEST>::min();
+ return std::numeric_limits<LONGEST>::min ();
/* This line will be executed if host_float is NaN. */
- return std::numeric_limits<LONGEST>::max();
+ return std::numeric_limits<LONGEST>::max ();
}
/* Convert signed integer VAL to a target floating-number of type TYPE
and store it as byte-stream ADDR. */
-template<typename T> void
+template<typename T>
+void
host_float_ops<T>::from_longest (gdb_byte *addr, const struct type *type,
LONGEST val) const
{
@@ -1033,7 +1051,8 @@ host_float_ops<T>::from_longest (gdb_byte *addr, const struct type *type,
/* Convert unsigned integer VAL to a target floating-number of type TYPE
and store it as byte-stream ADDR. */
-template<typename T> void
+template<typename T>
+void
host_float_ops<T>::from_ulongest (gdb_byte *addr, const struct type *type,
ULONGEST val) const
{
@@ -1043,7 +1062,8 @@ host_float_ops<T>::from_ulongest (gdb_byte *addr, const struct type *type,
/* Convert the byte-stream ADDR, interpreted as floating-point type TYPE,
to a floating-point value in the host "double" format. */
-template<typename T> double
+template<typename T>
+double
host_float_ops<T>::to_host_double (const gdb_byte *addr,
const struct type *type) const
{
@@ -1054,7 +1074,8 @@ host_float_ops<T>::to_host_double (const gdb_byte *addr,
/* Convert floating-point value VAL in the host "double" format to a target
floating-number of type TYPE and store it as byte-stream ADDR. */
-template<typename T> void
+template<typename T>
+void
host_float_ops<T>::from_host_double (gdb_byte *addr, const struct type *type,
double val) const
{
@@ -1065,11 +1086,10 @@ host_float_ops<T>::from_host_double (gdb_byte *addr, const struct type *type,
/* Convert a floating-point number of type FROM_TYPE from the target
byte-stream FROM to a floating-point number of type TO_TYPE, and
store it to the target byte-stream TO. */
-template<typename T> void
-host_float_ops<T>::convert (const gdb_byte *from,
- const struct type *from_type,
- gdb_byte *to,
- const struct type *to_type) const
+template<typename T>
+void
+host_float_ops<T>::convert (const gdb_byte *from, const struct type *from_type,
+ gdb_byte *to, const struct type *to_type) const
{
T host_float;
from_target (from_type, from, &host_float);
@@ -1080,11 +1100,12 @@ host_float_ops<T>::convert (const gdb_byte *from,
target byte streams X and Y, interpreted as floating-point numbers of
types TYPE_X and TYPE_Y, respectively. Convert the result to format
TYPE_RES and store it into the byte-stream RES. */
-template<typename T> void
-host_float_ops<T>::binop (enum exp_opcode op,
- const gdb_byte *x, const struct type *type_x,
- const gdb_byte *y, const struct type *type_y,
- gdb_byte *res, const struct type *type_res) const
+template<typename T>
+void
+host_float_ops<T>::binop (enum exp_opcode op, const gdb_byte *x,
+ const struct type *type_x, const gdb_byte *y,
+ const struct type *type_y, gdb_byte *res,
+ const struct type *type_res) const
{
T v1, v2, v = 0;
@@ -1093,41 +1114,40 @@ host_float_ops<T>::binop (enum exp_opcode op,
switch (op)
{
- case BINOP_ADD:
- v = v1 + v2;
- break;
+ case BINOP_ADD:
+ v = v1 + v2;
+ break;
- case BINOP_SUB:
- v = v1 - v2;
- break;
+ case BINOP_SUB:
+ v = v1 - v2;
+ break;
- case BINOP_MUL:
- v = v1 * v2;
- break;
+ case BINOP_MUL:
+ v = v1 * v2;
+ break;
- case BINOP_DIV:
- v = v1 / v2;
- break;
+ case BINOP_DIV:
+ v = v1 / v2;
+ break;
- case BINOP_EXP:
- errno = 0;
- v = pow (v1, v2);
- if (errno)
- error (_("Cannot perform exponentiation: %s"),
- safe_strerror (errno));
- break;
+ case BINOP_EXP:
+ errno = 0;
+ v = pow (v1, v2);
+ if (errno)
+ error (_ ("Cannot perform exponentiation: %s"), safe_strerror (errno));
+ break;
- case BINOP_MIN:
- v = v1 < v2 ? v1 : v2;
- break;
+ case BINOP_MIN:
+ v = v1 < v2 ? v1 : v2;
+ break;
- case BINOP_MAX:
- v = v1 > v2 ? v1 : v2;
- break;
+ case BINOP_MAX:
+ v = v1 > v2 ? v1 : v2;
+ break;
- default:
- error (_("Integer-only operation on floating point number."));
- break;
+ default:
+ error (_ ("Integer-only operation on floating point number."));
+ break;
}
to_target (type_res, &v, res);
@@ -1136,7 +1156,8 @@ host_float_ops<T>::binop (enum exp_opcode op,
/* Compare the two target byte streams X and Y, interpreted as floating-point
numbers of types TYPE_X and TYPE_Y, respectively. Return zero if X and Y
are equal, -1 if X is less than Y, and 1 otherwise. */
-template<typename T> int
+template<typename T>
+int
host_float_ops<T>::compare (const gdb_byte *x, const struct type *type_x,
const gdb_byte *y, const struct type *type_y) const
{
@@ -1152,7 +1173,6 @@ host_float_ops<T>::compare (const gdb_byte *x, const struct type *type_x,
return 1;
}
-
/* Implementation of target_float_ops using the MPFR library
mpfr_t as intermediate type. */
@@ -1163,6 +1183,7 @@ host_float_ops<T>::compare (const gdb_byte *x, const struct type *type_x,
class mpfr_float_ops : public target_float_ops
{
public:
+
std::string to_string (const gdb_byte *addr, const struct type *type,
const char *format) const override;
bool from_string (gdb_byte *addr, const struct type *type,
@@ -1181,18 +1202,20 @@ public:
void convert (const gdb_byte *from, const struct type *from_type,
gdb_byte *to, const struct type *to_type) const override;
- void binop (enum exp_opcode opcode,
- const gdb_byte *x, const struct type *type_x,
- const gdb_byte *y, const struct type *type_y,
- gdb_byte *res, const struct type *type_res) const override;
- int compare (const gdb_byte *x, const struct type *type_x,
- const gdb_byte *y, const struct type *type_y) const override;
+ void binop (enum exp_opcode opcode, const gdb_byte *x,
+ const struct type *type_x, const gdb_byte *y,
+ const struct type *type_y, gdb_byte *res,
+ const struct type *type_res) const override;
+ int compare (const gdb_byte *x, const struct type *type_x, const gdb_byte *y,
+ const struct type *type_y) const override;
private:
+
/* Local wrapper class to handle mpfr_t initialization and cleanup. */
class gdb_mpfr
{
public:
+
mpfr_t val;
gdb_mpfr (const struct type *type)
@@ -1206,24 +1229,20 @@ private:
mpfr_init2 (val, mpfr_get_prec (source.val));
}
- ~gdb_mpfr ()
- {
- mpfr_clear (val);
- }
+ ~gdb_mpfr () { mpfr_clear (val); }
};
- void from_target (const struct floatformat *fmt,
- const gdb_byte *from, gdb_mpfr &to) const;
- void from_target (const struct type *type,
- const gdb_byte *from, gdb_mpfr &to) const;
+ void from_target (const struct floatformat *fmt, const gdb_byte *from,
+ gdb_mpfr &to) const;
+ void from_target (const struct type *type, const gdb_byte *from,
+ gdb_mpfr &to) const;
- void to_target (const struct type *type,
- const gdb_mpfr &from, gdb_byte *to) const;
- void to_target (const struct floatformat *fmt,
- const gdb_mpfr &from, gdb_byte *to) const;
+ void to_target (const struct type *type, const gdb_mpfr &from,
+ gdb_byte *to) const;
+ void to_target (const struct floatformat *fmt, const gdb_mpfr &from,
+ gdb_byte *to) const;
};
-
/* Convert TO/FROM target floating-point format to mpfr_t. */
void
@@ -1235,7 +1254,7 @@ mpfr_float_ops::from_target (const struct floatformat *fmt,
unsigned long mant;
unsigned int mant_bits, mant_off;
int mant_bits_left;
- int special_exponent; /* It's a NaN, denorm or zero. */
+ int special_exponent; /* It's a NaN, denorm or zero. */
enum floatformat_byteorders order;
unsigned char newfrom[FLOATFORMAT_LARGEST_BYTES];
enum float_kind kind;
@@ -1273,13 +1292,13 @@ mpfr_float_ops::from_target (const struct floatformat *fmt,
return;
}
from_target (fmt->split_half,
- from + fmt->totalsize / FLOATFORMAT_CHAR_BIT / 2, bot);
+ from + fmt->totalsize / FLOATFORMAT_CHAR_BIT / 2, bot);
mpfr_add (to.val, top.val, bot.val, MPFR_RNDN);
return;
}
- exponent = get_field (from, order, fmt->totalsize, fmt->exp_start,
- fmt->exp_len);
+ exponent
+ = get_field (from, order, fmt->totalsize, fmt->exp_start, fmt->exp_len);
/* Note that if exponent indicates a NaN, we can't really do anything useful
(not knowing if the host has NaN's, or how to build one). So it will
end up as an infinity or something close; that is OK. */
@@ -1335,15 +1354,15 @@ mpfr_float_ops::from_target (const struct floatformat *fmt,
}
void
-mpfr_float_ops::from_target (const struct type *type,
- const gdb_byte *from, gdb_mpfr &to) const
+mpfr_float_ops::from_target (const struct type *type, const gdb_byte *from,
+ gdb_mpfr &to) const
{
from_target (floatformat_from_type (type), from, to);
}
void
-mpfr_float_ops::to_target (const struct floatformat *fmt,
- const gdb_mpfr &from, gdb_byte *orig_to) const
+mpfr_float_ops::to_target (const struct floatformat *fmt, const gdb_mpfr &from,
+ gdb_byte *orig_to) const
{
unsigned char *to = orig_to;
mpfr_exp_t exponent;
@@ -1381,18 +1400,17 @@ mpfr_float_ops::to_target (const struct floatformat *fmt,
gdb_mpfr tmp (from);
if (mpfr_zero_p (from.val))
- goto finalize_byteorder; /* Result is zero */
+ goto finalize_byteorder; /* Result is zero */
mpfr_set (tmp.val, from.val, MPFR_RNDN);
- if (mpfr_nan_p (tmp.val)) /* Result is NaN */
+ if (mpfr_nan_p (tmp.val)) /* Result is NaN */
{
/* From is NaN */
- put_field (to, order, fmt->totalsize, fmt->exp_start,
- fmt->exp_len, fmt->exp_nan);
+ put_field (to, order, fmt->totalsize, fmt->exp_start, fmt->exp_len,
+ fmt->exp_nan);
/* Be sure it's not infinity, but NaN value is irrel. */
- put_field (to, order, fmt->totalsize, fmt->man_start,
- fmt->man_len, 1);
+ put_field (to, order, fmt->totalsize, fmt->man_start, fmt->man_len, 1);
goto finalize_byteorder;
}
@@ -1403,14 +1421,13 @@ mpfr_float_ops::to_target (const struct floatformat *fmt,
mpfr_neg (tmp.val, tmp.val, MPFR_RNDN);
}
- if (mpfr_inf_p (tmp.val)) /* Result is Infinity. */
+ if (mpfr_inf_p (tmp.val)) /* Result is Infinity. */
{
/* Infinity exponent is same as NaN's. */
- put_field (to, order, fmt->totalsize, fmt->exp_start,
- fmt->exp_len, fmt->exp_nan);
+ put_field (to, order, fmt->totalsize, fmt->exp_start, fmt->exp_len,
+ fmt->exp_nan);
/* Infinity mantissa is all zeroes. */
- put_field (to, order, fmt->totalsize, fmt->man_start,
- fmt->man_len, 0);
+ put_field (to, order, fmt->totalsize, fmt->man_start, fmt->man_len, 0);
goto finalize_byteorder;
}
@@ -1420,10 +1437,8 @@ mpfr_float_ops::to_target (const struct floatformat *fmt,
{
/* The value is too small to be expressed in the destination
type (not enough bits in the exponent. Treat as 0. */
- put_field (to, order, fmt->totalsize, fmt->exp_start,
- fmt->exp_len, 0);
- put_field (to, order, fmt->totalsize, fmt->man_start,
- fmt->man_len, 0);
+ put_field (to, order, fmt->totalsize, fmt->exp_start, fmt->exp_len, 0);
+ put_field (to, order, fmt->totalsize, fmt->man_start, fmt->man_len, 0);
goto finalize_byteorder;
}
@@ -1431,10 +1446,9 @@ mpfr_float_ops::to_target (const struct floatformat *fmt,
{
/* The value is too large to fit into the destination.
Treat as infinity. */
- put_field (to, order, fmt->totalsize, fmt->exp_start,
- fmt->exp_len, fmt->exp_nan);
- put_field (to, order, fmt->totalsize, fmt->man_start,
- fmt->man_len, 0);
+ put_field (to, order, fmt->totalsize, fmt->exp_start, fmt->exp_len,
+ fmt->exp_nan);
+ put_field (to, order, fmt->totalsize, fmt->man_start, fmt->man_len, 0);
goto finalize_byteorder;
}
@@ -1480,21 +1494,20 @@ mpfr_float_ops::to_target (const struct floatformat *fmt,
mant_long >>= 32 - mant_bits;
}
- put_field (to, order, fmt->totalsize,
- mant_off, mant_bits, mant_long);
+ put_field (to, order, fmt->totalsize, mant_off, mant_bits, mant_long);
mant_off += mant_bits;
mant_bits_left -= mant_bits;
}
- finalize_byteorder:
+finalize_byteorder:
/* Do we need to byte-swap the words in the result? */
if (order != fmt->byteorder)
floatformat_normalize_byteorder (fmt, newto, orig_to);
}
void
-mpfr_float_ops::to_target (const struct type *type,
- const gdb_mpfr &from, gdb_byte *to) const
+mpfr_float_ops::to_target (const struct type *type, const gdb_mpfr &from,
+ gdb_byte *to) const
{
/* Ensure possible padding bytes in the target buffer are zeroed out. */
memset (to, 0, type->length ());
@@ -1505,8 +1518,7 @@ mpfr_float_ops::to_target (const struct type *type,
/* Convert the byte-stream ADDR, interpreted as floating-point type TYPE,
to a string, optionally using the print format FORMAT. */
std::string
-mpfr_float_ops::to_string (const gdb_byte *addr,
- const struct type *type,
+mpfr_float_ops::to_string (const gdb_byte *addr, const struct type *type,
const char *format) const
{
const struct floatformat *fmt = floatformat_from_type (type);
@@ -1523,13 +1535,13 @@ mpfr_float_ops::to_string (const gdb_byte *addr,
enum float_kind kind = floatformat_classify (fmt, addr);
if (kind == float_nan)
{
- const char *sign = floatformat_is_negative (fmt, addr)? "-" : "";
+ const char *sign = floatformat_is_negative (fmt, addr) ? "-" : "";
const char *mantissa = floatformat_mantissa (fmt, addr);
return string_printf ("%snan(0x%s)", sign, mantissa);
}
else if (kind == float_infinite)
{
- const char *sign = floatformat_is_negative (fmt, addr)? "-" : "";
+ const char *sign = floatformat_is_negative (fmt, addr) ? "-" : "";
return string_printf ("%sinf", sign);
}
}
@@ -1550,8 +1562,7 @@ mpfr_float_ops::to_string (const gdb_byte *addr,
/* Parse string STRING into a target floating-number of type TYPE and
store it as byte-stream ADDR. Return whether parsing succeeded. */
bool
-mpfr_float_ops::from_string (gdb_byte *addr,
- const struct type *type,
+mpfr_float_ops::from_string (gdb_byte *addr, const struct type *type,
const std::string &in) const
{
gdb_mpfr tmp (type);
@@ -1581,8 +1592,7 @@ mpfr_float_ops::to_longest (const gdb_byte *addr,
/* Convert signed integer VAL to a target floating-number of type TYPE
and store it as byte-stream ADDR. */
void
-mpfr_float_ops::from_longest (gdb_byte *addr,
- const struct type *type,
+mpfr_float_ops::from_longest (gdb_byte *addr, const struct type *type,
LONGEST val) const
{
gdb_mpfr tmp (type);
@@ -1593,8 +1603,7 @@ mpfr_float_ops::from_longest (gdb_byte *addr,
/* Convert unsigned integer VAL to a target floating-number of type TYPE
and store it as byte-stream ADDR. */
void
-mpfr_float_ops::from_ulongest (gdb_byte *addr,
- const struct type *type,
+mpfr_float_ops::from_ulongest (gdb_byte *addr, const struct type *type,
ULONGEST val) const
{
gdb_mpfr tmp (type);
@@ -1616,8 +1625,7 @@ mpfr_float_ops::to_host_double (const gdb_byte *addr,
/* Convert floating-point value VAL in the host "double" format to a target
floating-number of type TYPE and store it as byte-stream ADDR. */
void
-mpfr_float_ops::from_host_double (gdb_byte *addr,
- const struct type *type,
+mpfr_float_ops::from_host_double (gdb_byte *addr, const struct type *type,
double val) const
{
gdb_mpfr tmp (type);
@@ -1629,10 +1637,8 @@ mpfr_float_ops::from_host_double (gdb_byte *addr,
byte-stream FROM to a floating-point number of type TO_TYPE, and
store it to the target byte-stream TO. */
void
-mpfr_float_ops::convert (const gdb_byte *from,
- const struct type *from_type,
- gdb_byte *to,
- const struct type *to_type) const
+mpfr_float_ops::convert (const gdb_byte *from, const struct type *from_type,
+ gdb_byte *to, const struct type *to_type) const
{
gdb_mpfr from_tmp (from_type), to_tmp (to_type);
from_target (from_type, from, from_tmp);
@@ -1645,10 +1651,10 @@ mpfr_float_ops::convert (const gdb_byte *from,
types TYPE_X and TYPE_Y, respectively. Convert the result to type
TYPE_RES and store it into the byte-stream RES. */
void
-mpfr_float_ops::binop (enum exp_opcode op,
- const gdb_byte *x, const struct type *type_x,
- const gdb_byte *y, const struct type *type_y,
- gdb_byte *res, const struct type *type_res) const
+mpfr_float_ops::binop (enum exp_opcode op, const gdb_byte *x,
+ const struct type *type_x, const gdb_byte *y,
+ const struct type *type_y, gdb_byte *res,
+ const struct type *type_res) const
{
gdb_mpfr x_tmp (type_x), y_tmp (type_y), tmp (type_res);
@@ -1657,37 +1663,37 @@ mpfr_float_ops::binop (enum exp_opcode op,
switch (op)
{
- case BINOP_ADD:
- mpfr_add (tmp.val, x_tmp.val, y_tmp.val, MPFR_RNDN);
- break;
+ case BINOP_ADD:
+ mpfr_add (tmp.val, x_tmp.val, y_tmp.val, MPFR_RNDN);
+ break;
- case BINOP_SUB:
- mpfr_sub (tmp.val, x_tmp.val, y_tmp.val, MPFR_RNDN);
- break;
+ case BINOP_SUB:
+ mpfr_sub (tmp.val, x_tmp.val, y_tmp.val, MPFR_RNDN);
+ break;
- case BINOP_MUL:
- mpfr_mul (tmp.val, x_tmp.val, y_tmp.val, MPFR_RNDN);
- break;
+ case BINOP_MUL:
+ mpfr_mul (tmp.val, x_tmp.val, y_tmp.val, MPFR_RNDN);
+ break;
- case BINOP_DIV:
- mpfr_div (tmp.val, x_tmp.val, y_tmp.val, MPFR_RNDN);
- break;
+ case BINOP_DIV:
+ mpfr_div (tmp.val, x_tmp.val, y_tmp.val, MPFR_RNDN);
+ break;
- case BINOP_EXP:
- mpfr_pow (tmp.val, x_tmp.val, y_tmp.val, MPFR_RNDN);
- break;
+ case BINOP_EXP:
+ mpfr_pow (tmp.val, x_tmp.val, y_tmp.val, MPFR_RNDN);
+ break;
- case BINOP_MIN:
- mpfr_min (tmp.val, x_tmp.val, y_tmp.val, MPFR_RNDN);
- break;
+ case BINOP_MIN:
+ mpfr_min (tmp.val, x_tmp.val, y_tmp.val, MPFR_RNDN);
+ break;
- case BINOP_MAX:
- mpfr_max (tmp.val, x_tmp.val, y_tmp.val, MPFR_RNDN);
- break;
+ case BINOP_MAX:
+ mpfr_max (tmp.val, x_tmp.val, y_tmp.val, MPFR_RNDN);
+ break;
- default:
- error (_("Integer-only operation on floating point number."));
- break;
+ default:
+ error (_ ("Integer-only operation on floating point number."));
+ break;
}
to_target (type_res, tmp, res);
@@ -1713,7 +1719,6 @@ mpfr_float_ops::compare (const gdb_byte *x, const struct type *type_x,
return 1;
}
-
/* Helper routines operating on decimal floating-point data. */
/* Decimal floating point is one of the extension to IEEE 754, which is
@@ -1730,7 +1735,7 @@ mpfr_float_ops::compare (const gdb_byte *x, const struct type *type_x,
/* When using decimal128, this is the maximum string length + 1
(value comes from libdecnumber's DECIMAL128_String constant). */
-#define MAX_DECIMAL_STRING 43
+#define MAX_DECIMAL_STRING 43
/* In GDB, we are using an array of gdb_byte to represent decimal values.
They are stored in host byte order. This routine does the conversion if
@@ -1768,15 +1773,15 @@ set_decnumber_context (decContext *ctx, const struct type *type)
switch (type->length ())
{
- case 4:
- decContextDefault (ctx, DEC_INIT_DECIMAL32);
- break;
- case 8:
- decContextDefault (ctx, DEC_INIT_DECIMAL64);
- break;
- case 16:
- decContextDefault (ctx, DEC_INIT_DECIMAL128);
- break;
+ case 4:
+ decContextDefault (ctx, DEC_INIT_DECIMAL32);
+ break;
+ case 8:
+ decContextDefault (ctx, DEC_INIT_DECIMAL64);
+ break;
+ case 16:
+ decContextDefault (ctx, DEC_INIT_DECIMAL128);
+ break;
}
ctx->traps = 0;
@@ -1795,7 +1800,7 @@ decimal_check_errors (decContext *ctx)
{
/* Leave only the error bits in the status flags. */
ctx->status &= DEC_IEEE_854_Invalid_operation;
- error (_("Cannot perform operation: %s"),
+ error (_ ("Cannot perform operation: %s"),
decContextStatusToString (ctx));
}
}
@@ -1803,8 +1808,8 @@ decimal_check_errors (decContext *ctx)
/* Helper function to convert from libdecnumber's appropriate representation
for computation to each size of decimal float. */
static void
-decimal_from_number (const decNumber *from,
- gdb_byte *to, const struct type *type)
+decimal_from_number (const decNumber *from, gdb_byte *to,
+ const struct type *type)
{
gdb_byte dec[16];
@@ -1814,18 +1819,18 @@ decimal_from_number (const decNumber *from,
switch (type->length ())
{
- case 4:
- decimal32FromNumber ((decimal32 *) dec, from, &set);
- break;
- case 8:
- decimal64FromNumber ((decimal64 *) dec, from, &set);
- break;
- case 16:
- decimal128FromNumber ((decimal128 *) dec, from, &set);
- break;
- default:
- error (_("Unknown decimal floating point type."));
- break;
+ case 4:
+ decimal32FromNumber ((decimal32 *) dec, from, &set);
+ break;
+ case 8:
+ decimal64FromNumber ((decimal64 *) dec, from, &set);
+ break;
+ case 16:
+ decimal128FromNumber ((decimal128 *) dec, from, &set);
+ break;
+ default:
+ error (_ ("Unknown decimal floating point type."));
+ break;
}
match_endianness (dec, type, to);
@@ -1842,18 +1847,18 @@ decimal_to_number (const gdb_byte *addr, const struct type *type,
switch (type->length ())
{
- case 4:
- decimal32ToNumber ((decimal32 *) dec, to);
- break;
- case 8:
- decimal64ToNumber ((decimal64 *) dec, to);
- break;
- case 16:
- decimal128ToNumber ((decimal128 *) dec, to);
- break;
- default:
- error (_("Unknown decimal floating point type."));
- break;
+ case 4:
+ decimal32ToNumber ((decimal32 *) dec, to);
+ break;
+ case 8:
+ decimal64ToNumber ((decimal64 *) dec, to);
+ break;
+ case 16:
+ decimal128ToNumber ((decimal128 *) dec, to);
+ break;
+ default:
+ error (_ ("Unknown decimal floating point type."));
+ break;
}
}
@@ -1868,13 +1873,13 @@ decimal_is_zero (const gdb_byte *addr, const struct type *type)
return decNumberIsZero (&number);
}
-
/* Implementation of target_float_ops using the libdecnumber decNumber type
as intermediate format. */
class decimal_float_ops : public target_float_ops
{
public:
+
std::string to_string (const gdb_byte *addr, const struct type *type,
const char *format) const override;
bool from_string (gdb_byte *addr, const struct type *type,
@@ -1886,6 +1891,7 @@ public:
LONGEST val) const override;
void from_ulongest (gdb_byte *addr, const struct type *type,
ULONGEST val) const override;
+
double to_host_double (const gdb_byte *addr,
const struct type *type) const override
{
@@ -1893,6 +1899,7 @@ public:
types and the host double type. */
gdb_assert_not_reached ("invalid operation on decimal float");
}
+
void from_host_double (gdb_byte *addr, const struct type *type,
double val) const override
{
@@ -1900,15 +1907,16 @@ public:
types and the host double type. */
gdb_assert_not_reached ("invalid operation on decimal float");
}
+
void convert (const gdb_byte *from, const struct type *from_type,
gdb_byte *to, const struct type *to_type) const override;
- void binop (enum exp_opcode opcode,
- const gdb_byte *x, const struct type *type_x,
- const gdb_byte *y, const struct type *type_y,
- gdb_byte *res, const struct type *type_res) const override;
- int compare (const gdb_byte *x, const struct type *type_x,
- const gdb_byte *y, const struct type *type_y) const override;
+ void binop (enum exp_opcode opcode, const gdb_byte *x,
+ const struct type *type_x, const gdb_byte *y,
+ const struct type *type_y, gdb_byte *res,
+ const struct type *type_res) const override;
+ int compare (const gdb_byte *x, const struct type *type_x, const gdb_byte *y,
+ const struct type *type_y) const override;
};
/* Convert decimal type to its string representation. LEN is the length
@@ -1927,7 +1935,7 @@ decimal_float_ops::to_string (const gdb_byte *addr, const struct type *type,
/* We don't handle format strings (yet). If the host printf supports
decimal floating point types, just use this. Otherwise, fall back
to printing the number while ignoring the format string. */
-#if defined (PRINTF_HAS_DECFLOAT)
+#if defined(PRINTF_HAS_DECFLOAT)
/* FIXME: This makes unwarranted assumptions about the host ABI! */
return string_printf (format, dec);
#endif
@@ -1938,18 +1946,18 @@ decimal_float_ops::to_string (const gdb_byte *addr, const struct type *type,
switch (type->length ())
{
- case 4:
- decimal32ToString ((decimal32 *) dec, &result[0]);
- break;
- case 8:
- decimal64ToString ((decimal64 *) dec, &result[0]);
- break;
- case 16:
- decimal128ToString ((decimal128 *) dec, &result[0]);
- break;
- default:
- error (_("Unknown decimal floating point type."));
- break;
+ case 4:
+ decimal32ToString ((decimal32 *) dec, &result[0]);
+ break;
+ case 8:
+ decimal64ToString ((decimal64 *) dec, &result[0]);
+ break;
+ case 16:
+ decimal128ToString ((decimal128 *) dec, &result[0]);
+ break;
+ default:
+ error (_ ("Unknown decimal floating point type."));
+ break;
}
return result;
@@ -1969,18 +1977,18 @@ decimal_float_ops::from_string (gdb_byte *addr, const struct type *type,
switch (type->length ())
{
- case 4:
- decimal32FromString ((decimal32 *) dec, string.c_str (), &set);
- break;
- case 8:
- decimal64FromString ((decimal64 *) dec, string.c_str (), &set);
- break;
- case 16:
- decimal128FromString ((decimal128 *) dec, string.c_str (), &set);
- break;
- default:
- error (_("Unknown decimal floating point type."));
- break;
+ case 4:
+ decimal32FromString ((decimal32 *) dec, string.c_str (), &set);
+ break;
+ case 8:
+ decimal64FromString ((decimal64 *) dec, string.c_str (), &set);
+ break;
+ case 16:
+ decimal128FromString ((decimal128 *) dec, string.c_str (), &set);
+ break;
+ default:
+ error (_ ("Unknown decimal floating point type."));
+ break;
}
match_endianness (dec, type, addr);
@@ -2000,8 +2008,8 @@ decimal_float_ops::from_longest (gdb_byte *addr, const struct type *type,
if ((int32_t) from != from)
/* libdecnumber can convert only 32-bit integers. */
- error (_("Conversion of large integer to a "
- "decimal floating type is not supported."));
+ error (_ ("Conversion of large integer to a "
+ "decimal floating type is not supported."));
decNumberFromInt32 (&number, (int32_t) from);
@@ -2017,8 +2025,8 @@ decimal_float_ops::from_ulongest (gdb_byte *addr, const struct type *type,
if ((uint32_t) from != from)
/* libdecnumber can convert only 32-bit integers. */
- error (_("Conversion of large integer to a "
- "decimal floating type is not supported."));
+ error (_ ("Conversion of large integer to a "
+ "decimal floating type is not supported."));
decNumberFromUInt32 (&number, (uint32_t) from);
@@ -2040,10 +2048,10 @@ decimal_float_ops::to_longest (const gdb_byte *addr,
and byte orders BYTE_ORDER_X and BYTE_ORDER_Y, and store value in
RESULT with size LEN_RESULT and byte order BYTE_ORDER_RESULT. */
void
-decimal_float_ops::binop (enum exp_opcode op,
- const gdb_byte *x, const struct type *type_x,
- const gdb_byte *y, const struct type *type_y,
- gdb_byte *res, const struct type *type_res) const
+decimal_float_ops::binop (enum exp_opcode op, const gdb_byte *x,
+ const struct type *type_x, const gdb_byte *y,
+ const struct type *type_y, gdb_byte *res,
+ const struct type *type_res) const
{
decContext set;
decNumber number1, number2, number3;
@@ -2055,24 +2063,24 @@ decimal_float_ops::binop (enum exp_opcode op,
switch (op)
{
- case BINOP_ADD:
- decNumberAdd (&number3, &number1, &number2, &set);
- break;
- case BINOP_SUB:
- decNumberSubtract (&number3, &number1, &number2, &set);
- break;
- case BINOP_MUL:
- decNumberMultiply (&number3, &number1, &number2, &set);
- break;
- case BINOP_DIV:
- decNumberDivide (&number3, &number1, &number2, &set);
- break;
- case BINOP_EXP:
- decNumberPower (&number3, &number1, &number2, &set);
- break;
- default:
- error (_("Operation not valid for decimal floating point number."));
- break;
+ case BINOP_ADD:
+ decNumberAdd (&number3, &number1, &number2, &set);
+ break;
+ case BINOP_SUB:
+ decNumberSubtract (&number3, &number1, &number2, &set);
+ break;
+ case BINOP_MUL:
+ decNumberMultiply (&number3, &number1, &number2, &set);
+ break;
+ case BINOP_DIV:
+ decNumberDivide (&number3, &number1, &number2, &set);
+ break;
+ case BINOP_EXP:
+ decNumberPower (&number3, &number1, &number2, &set);
+ break;
+ default:
+ error (_ ("Operation not valid for decimal floating point number."));
+ break;
}
/* Check for errors in the DFP operation. */
@@ -2105,7 +2113,7 @@ decimal_float_ops::compare (const gdb_byte *x, const struct type *type_x,
decimal_check_errors (&set);
if (decNumberIsNaN (&result))
- error (_("Comparison with an invalid number (NaN)."));
+ error (_ ("Comparison with an invalid number (NaN)."));
else if (decNumberIsZero (&result))
return 0;
else if (decNumberIsNegative (&result))
@@ -2126,7 +2134,6 @@ decimal_float_ops::convert (const gdb_byte *from, const struct type *from_type,
decimal_from_number (&number, to, to_type);
}
-
/* Typed floating-point routines. These routines operate on floating-point
values in target format, represented by a byte buffer interpreted as a
"struct type", which may be either a binary or decimal floating-point
@@ -2143,24 +2150,22 @@ target_float_same_category_p (const struct type *type1,
/* Return whether TYPE1 and TYPE2 use the same floating-point format. */
static bool
-target_float_same_format_p (const struct type *type1,
- const struct type *type2)
+target_float_same_format_p (const struct type *type1, const struct type *type2)
{
if (!target_float_same_category_p (type1, type2))
return false;
switch (type1->code ())
{
- case TYPE_CODE_FLT:
- return floatformat_from_type (type1) == floatformat_from_type (type2);
+ case TYPE_CODE_FLT:
+ return floatformat_from_type (type1) == floatformat_from_type (type2);
- case TYPE_CODE_DECFLOAT:
- return (type1->length () == type2->length ()
- && (type_byte_order (type1)
- == type_byte_order (type2)));
+ case TYPE_CODE_DECFLOAT:
+ return (type1->length () == type2->length ()
+ && (type_byte_order (type1) == type_byte_order (type2)));
- default:
- gdb_assert_not_reached ("unexpected type code");
+ default:
+ gdb_assert_not_reached ("unexpected type code");
}
}
@@ -2171,14 +2176,14 @@ target_float_format_length (const struct type *type)
{
switch (type->code ())
{
- case TYPE_CODE_FLT:
- return floatformat_totalsize_bytes (floatformat_from_type (type));
+ case TYPE_CODE_FLT:
+ return floatformat_totalsize_bytes (floatformat_from_type (type));
- case TYPE_CODE_DECFLOAT:
- return type->length ();
+ case TYPE_CODE_DECFLOAT:
+ return type->length ();
- default:
- gdb_assert_not_reached ("unexpected type code");
+ default:
+ gdb_assert_not_reached ("unexpected type code");
}
}
@@ -2203,30 +2208,30 @@ get_target_float_ops_kind (const struct type *type)
{
switch (type->code ())
{
- case TYPE_CODE_FLT:
- {
- const struct floatformat *fmt = floatformat_from_type (type);
-
- /* Binary floating-point formats matching a host format. */
- if (fmt == host_float_format)
- return target_float_ops_kind::host_float;
- if (fmt == host_double_format)
- return target_float_ops_kind::host_double;
- if (fmt == host_long_double_format)
- return target_float_ops_kind::host_long_double;
-
- /* Any other binary floating-point format. */
- return target_float_ops_kind::binary;
- }
+ case TYPE_CODE_FLT:
+ {
+ const struct floatformat *fmt = floatformat_from_type (type);
- case TYPE_CODE_DECFLOAT:
- {
- /* Any decimal floating-point format. */
- return target_float_ops_kind::decimal;
- }
+ /* Binary floating-point formats matching a host format. */
+ if (fmt == host_float_format)
+ return target_float_ops_kind::host_float;
+ if (fmt == host_double_format)
+ return target_float_ops_kind::host_double;
+ if (fmt == host_long_double_format)
+ return target_float_ops_kind::host_long_double;
+
+ /* Any other binary floating-point format. */
+ return target_float_ops_kind::binary;
+ }
- default:
- gdb_assert_not_reached ("unexpected type code");
+ case TYPE_CODE_DECFLOAT:
+ {
+ /* Any decimal floating-point format. */
+ return target_float_ops_kind::decimal;
+ }
+
+ default:
+ gdb_assert_not_reached ("unexpected type code");
}
}
@@ -2236,46 +2241,46 @@ get_target_float_ops (enum target_float_ops_kind kind)
{
switch (kind)
{
- /* If the type format matches one of the host floating-point
+ /* If the type format matches one of the host floating-point
types, use that type as intermediate format. */
- case target_float_ops_kind::host_float:
- {
- static host_float_ops<float> host_float_ops_float;
- return &host_float_ops_float;
- }
-
- case target_float_ops_kind::host_double:
- {
- static host_float_ops<double> host_float_ops_double;
- return &host_float_ops_double;
- }
-
- case target_float_ops_kind::host_long_double:
- {
- static host_float_ops<long double> host_float_ops_long_double;
- return &host_float_ops_long_double;
- }
-
- /* For binary floating-point formats that do not match any host format,
+ case target_float_ops_kind::host_float:
+ {
+ static host_float_ops<float> host_float_ops_float;
+ return &host_float_ops_float;
+ }
+
+ case target_float_ops_kind::host_double:
+ {
+ static host_float_ops<double> host_float_ops_double;
+ return &host_float_ops_double;
+ }
+
+ case target_float_ops_kind::host_long_double:
+ {
+ static host_float_ops<long double> host_float_ops_long_double;
+ return &host_float_ops_long_double;
+ }
+
+ /* For binary floating-point formats that do not match any host format,
use mpfr_t as intermediate format to provide precise target-floating
point emulation. However, if the MPFR library is not available,
use the largest host floating-point type as intermediate format. */
- case target_float_ops_kind::binary:
- {
- static mpfr_float_ops binary_float_ops;
- return &binary_float_ops;
- }
+ case target_float_ops_kind::binary:
+ {
+ static mpfr_float_ops binary_float_ops;
+ return &binary_float_ops;
+ }
- /* For decimal floating-point types, always use the libdecnumber
+ /* For decimal floating-point types, always use the libdecnumber
decNumber type as intermediate format. */
- case target_float_ops_kind::decimal:
- {
- static decimal_float_ops decimal_float_ops;
- return &decimal_float_ops;
- }
+ case target_float_ops_kind::decimal:
+ {
+ static decimal_float_ops decimal_float_ops;
+ return &decimal_float_ops;
+ }
- default:
- gdb_assert_not_reached ("unexpected target_float_ops_kind");
+ default:
+ gdb_assert_not_reached ("unexpected target_float_ops_kind");
}
}
@@ -2351,13 +2356,13 @@ target_float_to_string (const gdb_byte *addr, const struct type *type,
enum float_kind kind = floatformat_classify (fmt, addr);
if (kind == float_nan)
{
- const char *sign = floatformat_is_negative (fmt, addr)? "-" : "";
+ const char *sign = floatformat_is_negative (fmt, addr) ? "-" : "";
const char *mantissa = floatformat_mantissa (fmt, addr);
return string_printf ("%snan(0x%s)", sign, mantissa);
}
else if (kind == float_infinite)
{
- const char *sign = floatformat_is_negative (fmt, addr)? "-" : "";
+ const char *sign = floatformat_is_negative (fmt, addr) ? "-" : "";
return string_printf ("%sinf", sign);
}
}
@@ -2408,8 +2413,7 @@ target_float_from_ulongest (gdb_byte *addr, const struct type *type,
/* Convert the byte-stream ADDR, interpreted as floating-point type TYPE,
to a floating-point value in the host "double" format. */
double
-target_float_to_host_double (const gdb_byte *addr,
- const struct type *type)
+target_float_to_host_double (const gdb_byte *addr, const struct type *type)
{
const target_float_ops *ops = get_target_float_ops (type);
return ops->to_host_double (addr, type);
@@ -2464,10 +2468,10 @@ target_float_convert (const gdb_byte *from, const struct type *from_type,
all decimal floating-point types. Binary and decimal floating-point
types cannot be mixed within a single operation. */
void
-target_float_binop (enum exp_opcode opcode,
- const gdb_byte *x, const struct type *type_x,
- const gdb_byte *y, const struct type *type_y,
- gdb_byte *res, const struct type *type_res)
+target_float_binop (enum exp_opcode opcode, const gdb_byte *x,
+ const struct type *type_x, const gdb_byte *y,
+ const struct type *type_y, gdb_byte *res,
+ const struct type *type_res)
{
gdb_assert (target_float_same_category_p (type_x, type_res));
gdb_assert (target_float_same_category_p (type_y, type_res));
@@ -2492,4 +2496,3 @@ target_float_compare (const gdb_byte *x, const struct type *type_x,
const target_float_ops *ops = get_target_float_ops (type_x, type_y);
return ops->compare (x, type_x, y, type_y);
}
-
diff --git a/gdb/target-float.h b/gdb/target-float.h
index 029b65c405b..e4fa9efe6e9 100644
--- a/gdb/target-float.h
+++ b/gdb/target-float.h
@@ -30,31 +30,28 @@ extern bool target_float_is_zero (const gdb_byte *addr,
extern std::string target_float_to_string (const gdb_byte *addr,
const struct type *type,
const char *format = nullptr);
-extern bool target_float_from_string (gdb_byte *addr,
- const struct type *type,
+extern bool target_float_from_string (gdb_byte *addr, const struct type *type,
const std::string &string);
extern LONGEST target_float_to_longest (const gdb_byte *addr,
const struct type *type);
-extern void target_float_from_longest (gdb_byte *addr,
- const struct type *type,
+extern void target_float_from_longest (gdb_byte *addr, const struct type *type,
LONGEST val);
extern void target_float_from_ulongest (gdb_byte *addr,
- const struct type *type,
- ULONGEST val);
+ const struct type *type, ULONGEST val);
extern double target_float_to_host_double (const gdb_byte *addr,
const struct type *type);
extern void target_float_from_host_double (gdb_byte *addr,
const struct type *type,
double val);
extern void target_float_convert (const gdb_byte *from,
- const struct type *from_type,
- gdb_byte *to, const struct type *to_type);
+ const struct type *from_type, gdb_byte *to,
+ const struct type *to_type);
-extern void target_float_binop (enum exp_opcode opcode,
- const gdb_byte *x, const struct type *type_x,
- const gdb_byte *y, const struct type *type_y,
- gdb_byte *res, const struct type *type_res);
+extern void target_float_binop (enum exp_opcode opcode, const gdb_byte *x,
+ const struct type *type_x, const gdb_byte *y,
+ const struct type *type_y, gdb_byte *res,
+ const struct type *type_res);
extern int target_float_compare (const gdb_byte *x, const struct type *type_x,
const gdb_byte *y, const struct type *type_y);
diff --git a/gdb/target-memory.c b/gdb/target-memory.c
index 8c058999c6e..c0f862af883 100644
--- a/gdb/target-memory.c
+++ b/gdb/target-memory.c
@@ -41,8 +41,7 @@ compare_block_starting_address (const memory_write_request &a_req,
static void
claim_memory (const std::vector<memory_write_request> &blocks,
- std::vector<memory_write_request> *result,
- ULONGEST begin,
+ std::vector<memory_write_request> *result, ULONGEST begin,
ULONGEST end)
{
ULONGEST claimed_begin;
@@ -87,9 +86,10 @@ claim_memory (const std::vector<memory_write_request> &blocks,
regular memory to REGULAR_BLOCKS. */
static void
-split_regular_and_flash_blocks (const std::vector<memory_write_request> &blocks,
- std::vector<memory_write_request> *regular_blocks,
- std::vector<memory_write_request> *flash_blocks)
+split_regular_and_flash_blocks (
+ const std::vector<memory_write_request> &blocks,
+ std::vector<memory_write_request> *regular_blocks,
+ std::vector<memory_write_request> *flash_blocks)
{
struct mem_region *region;
CORE_ADDR cur_address;
@@ -138,7 +138,8 @@ block_boundaries (CORE_ADDR address, CORE_ADDR *begin, CORE_ADDR *end)
if (begin)
*begin = region->lo + offset_in_region / blocksize * blocksize;
if (end)
- *end = region->lo + (offset_in_region + blocksize - 1) / blocksize * blocksize;
+ *end = region->lo
+ + (offset_in_region + blocksize - 1) / blocksize * blocksize;
}
/* Given the list of memory requests to be WRITTEN, this function
@@ -173,8 +174,9 @@ blocks_to_erase (const std::vector<memory_write_request> &written)
which is only partially filled by "load"). */
static std::vector<memory_write_request>
-compute_garbled_blocks (const std::vector<memory_write_request> &erased_blocks,
- const std::vector<memory_write_request> &written_blocks)
+compute_garbled_blocks (
+ const std::vector<memory_write_request> &erased_blocks,
+ const std::vector<memory_write_request> &written_blocks)
{
std::vector<memory_write_request> result;
@@ -219,8 +221,7 @@ compute_garbled_blocks (const std::vector<memory_write_request> &erased_blocks,
/* If all of ERASED is completely written, we can move on to
the next erased region. */
- if (written->begin <= erased.begin
- && written->end >= erased.end)
+ if (written->begin <= erased.begin && written->end >= erased.end)
{
goto next_erased;
}
@@ -251,8 +252,7 @@ compute_garbled_blocks (const std::vector<memory_write_request> &erased_blocks,
ERASED, then that means it's really erased. */
result.push_back (erased);
- next_erased:
- ;
+ next_erased:;
}
return result;
@@ -305,8 +305,8 @@ target_write_memory_blocks (const std::vector<memory_write_request> &requests,
for (memory_write_request &iter : garbled)
{
gdb_assert (iter.data == NULL);
- gdb::unique_xmalloc_ptr<gdb_byte> holder
- ((gdb_byte *) xmalloc (iter.end - iter.begin));
+ gdb::unique_xmalloc_ptr<gdb_byte> holder (
+ (gdb_byte *) xmalloc (iter.end - iter.begin));
iter.data = holder.get ();
mem_holders.push_back (std::move (holder));
int err = target_read_memory (iter.begin, iter.data,
@@ -337,9 +337,8 @@ target_write_memory_blocks (const std::vector<memory_write_request> &requests,
LONGEST len;
len = target_write_with_progress (current_inferior ()->top_target (),
- TARGET_OBJECT_MEMORY, NULL,
- iter.data, iter.begin,
- iter.end - iter.begin,
+ TARGET_OBJECT_MEMORY, NULL, iter.data,
+ iter.begin, iter.end - iter.begin,
progress_cb, iter.baton);
if (len < (LONGEST) (iter.end - iter.begin))
{
@@ -359,13 +358,13 @@ target_write_memory_blocks (const std::vector<memory_write_request> &requests,
{
LONGEST len;
- len = target_write_with_progress (current_inferior ()->top_target (),
- TARGET_OBJECT_FLASH, NULL,
- iter.data, iter.begin,
- iter.end - iter.begin,
- progress_cb, iter.baton);
+ len
+ = target_write_with_progress (current_inferior ()->top_target (),
+ TARGET_OBJECT_FLASH, NULL, iter.data,
+ iter.begin, iter.end - iter.begin,
+ progress_cb, iter.baton);
if (len < (LONGEST) (iter.end - iter.begin))
- error (_("Error writing data to flash"));
+ error (_ ("Error writing data to flash"));
}
target_flash_done ();
diff --git a/gdb/target.c b/gdb/target.c
index d0aa8f5cc6c..038dd369bf1 100644
--- a/gdb/target.c
+++ b/gdb/target.c
@@ -62,26 +62,25 @@ static void default_terminal_info (struct target_ops *, const char *, int);
static int default_watchpoint_addr_within_range (struct target_ops *,
CORE_ADDR, CORE_ADDR, int);
-static int default_region_ok_for_hw_watchpoint (struct target_ops *,
- CORE_ADDR, int);
+static int default_region_ok_for_hw_watchpoint (struct target_ops *, CORE_ADDR,
+ int);
static void default_rcmd (struct target_ops *, const char *, struct ui_file *);
-static ptid_t default_get_ada_task_ptid (struct target_ops *self,
- long lwp, ULONGEST tid);
+static ptid_t default_get_ada_task_ptid (struct target_ops *self, long lwp,
+ ULONGEST tid);
static void default_mourn_inferior (struct target_ops *self);
-static int default_search_memory (struct target_ops *ops,
- CORE_ADDR start_addr,
+static int default_search_memory (struct target_ops *ops, CORE_ADDR start_addr,
ULONGEST search_space_len,
const gdb_byte *pattern,
ULONGEST pattern_len,
CORE_ADDR *found_addrp);
static int default_verify_memory (struct target_ops *self,
- const gdb_byte *data,
- CORE_ADDR memaddr, ULONGEST size);
+ const gdb_byte *data, CORE_ADDR memaddr,
+ ULONGEST size);
static void tcomplain (void) ATTRIBUTE_NORETURN;
@@ -91,13 +90,14 @@ static int dummy_find_memory_regions (struct target_ops *self,
find_memory_region_ftype ignore1,
void *ignore2);
-static gdb::unique_xmalloc_ptr<char> dummy_make_corefile_notes
- (struct target_ops *self, bfd *ignore1, int *ignore2);
+static gdb::unique_xmalloc_ptr<char>
+dummy_make_corefile_notes (struct target_ops *self, bfd *ignore1,
+ int *ignore2);
static std::string default_pid_to_str (struct target_ops *ops, ptid_t ptid);
-static enum exec_direction_kind default_execution_direction
- (struct target_ops *self);
+static enum exec_direction_kind
+default_execution_direction (struct target_ops *self);
/* Mapping between target_info objects (which have address identity)
and corresponding open/factory function/callback. Each add_target
@@ -147,7 +147,7 @@ bool may_stop = true;
static unsigned int targetdebug = 0;
static void
-set_targetdebug (const char *args, int from_tty, struct cmd_list_element *c)
+set_targetdebug (const char *args, int from_tty, struct cmd_list_element *c)
{
if (targetdebug)
current_inferior ()->push_target (the_debug_target);
@@ -159,14 +159,13 @@ static void
show_targetdebug (struct ui_file *file, int from_tty,
struct cmd_list_element *c, const char *value)
{
- gdb_printf (file, _("Target debugging is %s.\n"), value);
+ gdb_printf (file, _ ("Target debugging is %s.\n"), value);
}
int
target_has_memory ()
{
- for (target_ops *t = current_inferior ()->top_target ();
- t != NULL;
+ for (target_ops *t = current_inferior ()->top_target (); t != NULL;
t = t->beneath ())
if (t->has_memory ())
return 1;
@@ -177,8 +176,7 @@ target_has_memory ()
int
target_has_stack ()
{
- for (target_ops *t = current_inferior ()->top_target ();
- t != NULL;
+ for (target_ops *t = current_inferior ()->top_target (); t != NULL;
t = t->beneath ())
if (t->has_stack ())
return 1;
@@ -189,8 +187,7 @@ target_has_stack ()
int
target_has_registers ()
{
- for (target_ops *t = current_inferior ()->top_target ();
- t != NULL;
+ for (target_ops *t = current_inferior ()->top_target (); t != NULL;
t = t->beneath ())
if (t->has_registers ())
return 1;
@@ -204,8 +201,7 @@ target_has_execution (inferior *inf)
if (inf == nullptr)
inf = current_inferior ();
- for (target_ops *t = inf->top_target ();
- t != nullptr;
+ for (target_ops *t = inf->top_target (); t != nullptr;
t = inf->find_target_beneath (t))
if (t->has_execution (inf))
return true;
@@ -376,7 +372,7 @@ target_can_lock_scheduler ()
{
target_ops *target = current_inferior ()->top_target ();
- return (target->get_thread_control_capabilities ()& tc_schedlock) != 0;
+ return (target->get_thread_control_capabilities () & tc_schedlock) != 0;
}
/* See target.h. */
@@ -531,7 +527,6 @@ target_region_ok_for_hw_watchpoint (CORE_ADDR addr, int len)
return target->region_ok_for_hw_watchpoint (addr, len);
}
-
int
target_can_do_single_step ()
{
@@ -680,8 +675,8 @@ target_trace_stop ()
}
int
-target_trace_find (trace_find_type type, int num,
- CORE_ADDR addr1, CORE_ADDR addr2, int *tpp)
+target_trace_find (trace_find_type type, int num, CORE_ADDR addr1,
+ CORE_ADDR addr2, int *tpp)
{
target_ops *target = current_inferior ()->top_target ();
@@ -822,14 +817,16 @@ bool
target_fetch_memtags (CORE_ADDR address, size_t len, gdb::byte_vector &tags,
int type)
{
- return current_inferior ()->top_target ()->fetch_memtags (address, len, tags, type);
+ return current_inferior ()->top_target ()->fetch_memtags (address, len, tags,
+ type);
}
bool
target_store_memtags (CORE_ADDR address, size_t len,
const gdb::byte_vector &tags, int type)
{
- return current_inferior ()->top_target ()->store_memtags (address, len, tags, type);
+ return current_inferior ()->top_target ()->store_memtags (address, len, tags,
+ type);
}
void
@@ -847,14 +844,13 @@ open_target (const char *args, int from_tty, struct cmd_list_element *command)
target_open_ftype *func = target_factories[ti];
if (targetdebug)
- gdb_printf (gdb_stdlog, "-> %s->open (...)\n",
- ti->shortname);
+ gdb_printf (gdb_stdlog, "-> %s->open (...)\n", ti->shortname);
func (args, from_tty);
if (targetdebug)
- gdb_printf (gdb_stdlog, "<- %s->open (%s, %d)\n",
- ti->shortname, args, from_tty);
+ gdb_printf (gdb_stdlog, "<- %s->open (%s, %d)\n", ti->shortname, args,
+ from_tty);
}
/* See target.h. */
@@ -867,11 +863,11 @@ add_target (const target_info &t, target_open_ftype *func,
auto &func_slot = target_factories[&t];
if (func_slot != nullptr)
- internal_error (_("target already added (\"%s\")."), t.shortname);
+ internal_error (_ ("target already added (\"%s\")."), t.shortname);
func_slot = func;
if (targetlist == NULL)
- add_basic_prefix_cmd ("target", class_run, _("\
+ add_basic_prefix_cmd ("target", class_run, _ ("\
Connect to a target machine or process.\n\
The first argument is the type or protocol of the target machine.\n\
Remaining arguments are interpreted by the target protocol. For more\n\
@@ -907,7 +903,6 @@ add_deprecated_target_alias (const target_info &tinfo, const char *alias)
void
target_kill (void)
{
-
/* If the commit_resume_state of the to-be-killed-inferior's process stratum
is true, and this inferior is the last live inferior with resumed threads
of that target, then we want to leave commit_resume_state to false, as the
@@ -1092,7 +1087,8 @@ target_terminal::ours_for_output ()
return;
target_terminal_is_ours_kind (target_terminal_state::is_ours_for_output);
- target_terminal::m_terminal_state = target_terminal_state::is_ours_for_output;
+ target_terminal::m_terminal_state
+ = target_terminal_state::is_ours_for_output;
}
/* See target/target.h. */
@@ -1123,20 +1119,20 @@ target_supports_terminal_ours (void)
static void
tcomplain (void)
{
- error (_("You can't do that when your target is `%s'"),
+ error (_ ("You can't do that when your target is `%s'"),
current_inferior ()->top_target ()->shortname ());
}
void
noprocess (void)
{
- error (_("You can't do that without a process to debug."));
+ error (_ ("You can't do that without a process to debug."));
}
static void
default_terminal_info (struct target_ops *self, const char *args, int from_tty)
{
- gdb_printf (_("No saved terminal information.\n"));
+ gdb_printf (_ ("No saved terminal information.\n"));
}
/* A default implementation for the to_get_ada_task_ptid target method.
@@ -1216,7 +1212,7 @@ target_stack::unpush (target_ops *t)
strata stratum = t->stratum ();
if (stratum == dummy_stratum)
- internal_error (_("Attempt to unpush the dummy target"));
+ internal_error (_ ("Attempt to unpush the dummy target"));
/* Look for the specified target. Note that a target can only occur
once in the target stack. */
@@ -1257,7 +1253,7 @@ static void
generic_tls_error (void)
{
throw_error (TLS_GENERIC_ERROR,
- _("Cannot find thread-local variables on this target"));
+ _ ("Cannot find thread-local variables on this target"));
}
/* Using the objfile specified in OBJFILE, find the address for the
@@ -1281,10 +1277,9 @@ target_translate_tls_address (struct objfile *objfile, CORE_ADDR offset)
try
{
CORE_ADDR lm_addr;
-
+
/* Fetch the load module address for this objfile. */
- lm_addr = gdbarch_fetch_tls_load_module_address (gdbarch,
- objfile);
+ lm_addr = gdbarch_fetch_tls_load_module_address (gdbarch, objfile);
if (gdbarch_get_thread_local_address_p (gdbarch))
addr = gdbarch_get_thread_local_address (gdbarch, ptid, lm_addr,
@@ -1301,42 +1296,44 @@ target_translate_tls_address (struct objfile *objfile, CORE_ADDR offset)
switch (ex.error)
{
case TLS_NO_LIBRARY_SUPPORT_ERROR:
- error (_("Cannot find thread-local variables "
- "in this thread library."));
+ error (_ ("Cannot find thread-local variables "
+ "in this thread library."));
break;
case TLS_LOAD_MODULE_NOT_FOUND_ERROR:
if (objfile_is_library)
- error (_("Cannot find shared library `%s' in dynamic"
- " linker's load module list"), objfile_name (objfile));
+ error (_ ("Cannot find shared library `%s' in dynamic"
+ " linker's load module list"),
+ objfile_name (objfile));
else
- error (_("Cannot find executable file `%s' in dynamic"
- " linker's load module list"), objfile_name (objfile));
+ error (_ ("Cannot find executable file `%s' in dynamic"
+ " linker's load module list"),
+ objfile_name (objfile));
break;
case TLS_NOT_ALLOCATED_YET_ERROR:
if (objfile_is_library)
- error (_("The inferior has not yet allocated storage for"
- " thread-local variables in\n"
- "the shared library `%s'\n"
- "for %s"),
+ error (_ ("The inferior has not yet allocated storage for"
+ " thread-local variables in\n"
+ "the shared library `%s'\n"
+ "for %s"),
objfile_name (objfile),
target_pid_to_str (ptid).c_str ());
else
- error (_("The inferior has not yet allocated storage for"
- " thread-local variables in\n"
- "the executable `%s'\n"
- "for %s"),
+ error (_ ("The inferior has not yet allocated storage for"
+ " thread-local variables in\n"
+ "the executable `%s'\n"
+ "for %s"),
objfile_name (objfile),
target_pid_to_str (ptid).c_str ());
break;
case TLS_GENERIC_ERROR:
if (objfile_is_library)
- error (_("Cannot find thread-local storage for %s, "
- "shared library %s:\n%s"),
+ error (_ ("Cannot find thread-local storage for %s, "
+ "shared library %s:\n%s"),
target_pid_to_str (ptid).c_str (),
objfile_name (objfile), ex.what ());
else
- error (_("Cannot find thread-local storage for %s, "
- "executable file %s:\n%s"),
+ error (_ ("Cannot find thread-local storage for %s, "
+ "executable file %s:\n%s"),
target_pid_to_str (ptid).c_str (),
objfile_name (objfile), ex.what ());
break;
@@ -1347,7 +1344,7 @@ target_translate_tls_address (struct objfile *objfile, CORE_ADDR offset)
}
}
else
- error (_("Cannot find thread-local variables on this target"));
+ error (_ ("Cannot find thread-local variables on this target"));
return addr;
}
@@ -1355,18 +1352,19 @@ target_translate_tls_address (struct objfile *objfile, CORE_ADDR offset)
const char *
target_xfer_status_to_string (enum target_xfer_status status)
{
-#define CASE(X) case X: return #X
+#define CASE(X) \
+ case X: \
+ return #X
switch (status)
{
- CASE(TARGET_XFER_E_IO);
- CASE(TARGET_XFER_UNAVAILABLE);
+ CASE (TARGET_XFER_E_IO);
+ CASE (TARGET_XFER_UNAVAILABLE);
default:
return "<unknown>";
}
#undef CASE
};
-
const target_section_table *
target_get_section_table (struct target_ops *target)
{
@@ -1435,7 +1433,7 @@ memory_xfer_check_region (gdb_byte *readbuf, const gdb_byte *writebuf,
case MEM_FLASH:
/* We only support writing to flash during "load" for now. */
if (writebuf != NULL)
- error (_("Writing to flash memory forbidden in this context"));
+ error (_ ("Writing to flash memory forbidden in this context"));
break;
case MEM_NONE:
@@ -1457,16 +1455,15 @@ memory_xfer_check_region (gdb_byte *readbuf, const gdb_byte *writebuf,
enum target_xfer_status
raw_memory_xfer_partial (struct target_ops *ops, gdb_byte *readbuf,
- const gdb_byte *writebuf, ULONGEST memaddr, LONGEST len,
- ULONGEST *xfered_len)
+ const gdb_byte *writebuf, ULONGEST memaddr,
+ LONGEST len, ULONGEST *xfered_len)
{
enum target_xfer_status res;
do
{
- res = ops->xfer_partial (TARGET_OBJECT_MEMORY, NULL,
- readbuf, writebuf, memaddr, len,
- xfered_len);
+ res = ops->xfer_partial (TARGET_OBJECT_MEMORY, NULL, readbuf, writebuf,
+ memaddr, len, xfered_len);
if (res == TARGET_XFER_OK)
break;
@@ -1491,9 +1488,7 @@ raw_memory_xfer_partial (struct target_ops *ops, gdb_byte *readbuf,
object was originally being written. Note we do write-through
first, so that if it fails, we don't write to the cache contents
that never made it to the target. */
- if (writebuf != NULL
- && inferior_ptid != null_ptid
- && target_dcache_init_p ()
+ if (writebuf != NULL && inferior_ptid != null_ptid && target_dcache_init_p ()
&& (stack_cache_enabled_p () || code_cache_enabled_p ()))
{
DCACHE *dcache = target_dcache_get ();
@@ -1511,8 +1506,8 @@ raw_memory_xfer_partial (struct target_ops *ops, gdb_byte *readbuf,
static enum target_xfer_status
memory_xfer_partial_1 (struct target_ops *ops, enum target_object object,
- gdb_byte *readbuf, const gdb_byte *writebuf, ULONGEST memaddr,
- ULONGEST len, ULONGEST *xfered_len)
+ gdb_byte *readbuf, const gdb_byte *writebuf,
+ ULONGEST memaddr, ULONGEST len, ULONGEST *xfered_len)
{
enum target_xfer_status res;
ULONGEST reg_len;
@@ -1532,14 +1527,13 @@ memory_xfer_partial_1 (struct target_ops *ops, enum target_object object,
memaddr = overlay_mapped_address (memaddr, section);
- auto match_cb = [=] (const struct target_section *s)
- {
- return (strcmp (section_name, s->the_bfd_section->name) == 0);
- };
+ auto match_cb = [=] (const struct target_section *s) {
+ return (strcmp (section_name, s->the_bfd_section->name) == 0);
+ };
- return section_table_xfer_memory_partial (readbuf, writebuf,
- memaddr, len, xfered_len,
- *table, match_cb);
+ return section_table_xfer_memory_partial (readbuf, writebuf, memaddr,
+ len, xfered_len, *table,
+ match_cb);
}
}
@@ -1552,9 +1546,8 @@ memory_xfer_partial_1 (struct target_ops *ops, enum target_object object,
&& (bfd_section_flags (secp->the_bfd_section) & SEC_READONLY))
{
const target_section_table *table = target_get_section_table (ops);
- return section_table_xfer_memory_partial (readbuf, writebuf,
- memaddr, len, xfered_len,
- *table);
+ return section_table_xfer_memory_partial (readbuf, writebuf, memaddr,
+ len, xfered_len, *table);
}
}
@@ -1642,8 +1635,8 @@ memory_xfer_partial (struct target_ops *ops, enum target_object object,
gdb::byte_vector buf (writebuf, writebuf + len);
breakpoint_xfer_memory (NULL, buf.data (), writebuf, memaddr, len);
- res = memory_xfer_partial_1 (ops, object, NULL, buf.data (), memaddr, len,
- xfered_len);
+ res = memory_xfer_partial_1 (ops, object, NULL, buf.data (), memaddr,
+ len, xfered_len);
}
return res;
@@ -1658,10 +1651,9 @@ make_scoped_restore_show_memory_breakpoints (int show)
/* For docs see target.h, to_xfer_partial. */
enum target_xfer_status
-target_xfer_partial (struct target_ops *ops,
- enum target_object object, const char *annex,
- gdb_byte *readbuf, const gdb_byte *writebuf,
- ULONGEST offset, ULONGEST len,
+target_xfer_partial (struct target_ops *ops, enum target_object object,
+ const char *annex, gdb_byte *readbuf,
+ const gdb_byte *writebuf, ULONGEST offset, ULONGEST len,
ULONGEST *xfered_len)
{
enum target_xfer_status retval;
@@ -1671,7 +1663,7 @@ target_xfer_partial (struct target_ops *ops,
return TARGET_XFER_EOF;
if (writebuf && !may_write_memory)
- error (_("Writing to memory is not allowed (addr %s, len %s)"),
+ error (_ ("Writing to memory is not allowed (addr %s, len %s)"),
core_addr_to_string_nz (offset), plongest (len));
*xfered_len = 0;
@@ -1681,8 +1673,8 @@ target_xfer_partial (struct target_ops *ops,
complicated. */
if (object == TARGET_OBJECT_MEMORY || object == TARGET_OBJECT_STACK_MEMORY
|| object == TARGET_OBJECT_CODE_MEMORY)
- retval = memory_xfer_partial (ops, object, readbuf,
- writebuf, offset, len, xfered_len);
+ retval = memory_xfer_partial (ops, object, readbuf, writebuf, offset, len,
+ xfered_len);
else if (object == TARGET_OBJECT_RAW_MEMORY)
{
/* Skip/avoid accessing the target if the memory region
@@ -1700,8 +1692,8 @@ target_xfer_partial (struct target_ops *ops,
xfered_len);
}
else
- retval = ops->xfer_partial (object, annex, readbuf,
- writebuf, offset, len, xfered_len);
+ retval = ops->xfer_partial (object, annex, readbuf, writebuf, offset, len,
+ xfered_len);
if (targetdebug)
{
@@ -1710,13 +1702,10 @@ target_xfer_partial (struct target_ops *ops,
gdb_printf (gdb_stdlog,
"%s:target_xfer_partial "
"(%d, %s, %s, %s, %s, %s) = %d, %s",
- ops->shortname (),
- (int) object,
- (annex ? annex : "(null)"),
+ ops->shortname (), (int) object, (annex ? annex : "(null)"),
host_address_to_string (readbuf),
host_address_to_string (writebuf),
- core_addr_to_string_nz (offset),
- pulongest (len), retval,
+ core_addr_to_string_nz (offset), pulongest (len), retval,
pulongest (*xfered_len));
if (readbuf)
@@ -1730,7 +1719,7 @@ target_xfer_partial (struct target_ops *ops,
gdb_puts (", bytes =", gdb_stdlog);
for (i = 0; i < *xfered_len; i++)
{
- if ((((intptr_t) &(myaddr[i])) & 0xf) == 0)
+ if ((((intptr_t) & (myaddr[i])) & 0xf) == 0)
{
if (targetdebug < 2 && i > 0)
{
@@ -1770,9 +1759,9 @@ target_xfer_partial (struct target_ops *ops,
int
target_read_memory (CORE_ADDR memaddr, gdb_byte *myaddr, ssize_t len)
{
- if (target_read (current_inferior ()->top_target (),
- TARGET_OBJECT_MEMORY, NULL,
- myaddr, memaddr, len) == len)
+ if (target_read (current_inferior ()->top_target (), TARGET_OBJECT_MEMORY,
+ NULL, myaddr, memaddr, len)
+ == len)
return 0;
else
return -1;
@@ -1802,8 +1791,8 @@ int
target_read_raw_memory (CORE_ADDR memaddr, gdb_byte *myaddr, ssize_t len)
{
if (target_read (current_inferior ()->top_target (),
- TARGET_OBJECT_RAW_MEMORY, NULL,
- myaddr, memaddr, len) == len)
+ TARGET_OBJECT_RAW_MEMORY, NULL, myaddr, memaddr, len)
+ == len)
return 0;
else
return -1;
@@ -1816,8 +1805,8 @@ int
target_read_stack (CORE_ADDR memaddr, gdb_byte *myaddr, ssize_t len)
{
if (target_read (current_inferior ()->top_target (),
- TARGET_OBJECT_STACK_MEMORY, NULL,
- myaddr, memaddr, len) == len)
+ TARGET_OBJECT_STACK_MEMORY, NULL, myaddr, memaddr, len)
+ == len)
return 0;
else
return -1;
@@ -1830,8 +1819,8 @@ int
target_read_code (CORE_ADDR memaddr, gdb_byte *myaddr, ssize_t len)
{
if (target_read (current_inferior ()->top_target (),
- TARGET_OBJECT_CODE_MEMORY, NULL,
- myaddr, memaddr, len) == len)
+ TARGET_OBJECT_CODE_MEMORY, NULL, myaddr, memaddr, len)
+ == len)
return 0;
else
return -1;
@@ -1846,9 +1835,9 @@ target_read_code (CORE_ADDR memaddr, gdb_byte *myaddr, ssize_t len)
int
target_write_memory (CORE_ADDR memaddr, const gdb_byte *myaddr, ssize_t len)
{
- if (target_write (current_inferior ()->top_target (),
- TARGET_OBJECT_MEMORY, NULL,
- myaddr, memaddr, len) == len)
+ if (target_write (current_inferior ()->top_target (), TARGET_OBJECT_MEMORY,
+ NULL, myaddr, memaddr, len)
+ == len)
return 0;
else
return -1;
@@ -1861,11 +1850,12 @@ target_write_memory (CORE_ADDR memaddr, const gdb_byte *myaddr, ssize_t len)
target_write. */
int
-target_write_raw_memory (CORE_ADDR memaddr, const gdb_byte *myaddr, ssize_t len)
+target_write_raw_memory (CORE_ADDR memaddr, const gdb_byte *myaddr,
+ ssize_t len)
{
if (target_write (current_inferior ()->top_target (),
- TARGET_OBJECT_RAW_MEMORY, NULL,
- myaddr, memaddr, len) == len)
+ TARGET_OBJECT_RAW_MEMORY, NULL, myaddr, memaddr, len)
+ == len)
return 0;
else
return -1;
@@ -1894,7 +1884,7 @@ target_memory_map (void)
if (last_one != NULL && last_one->hi > this_one->lo)
{
- warning (_("Overlapping regions in memory map: ignoring"));
+ warning (_ ("Overlapping regions in memory map: ignoring"));
return std::vector<mem_region> ();
}
@@ -1920,29 +1910,25 @@ static void
show_trust_readonly (struct ui_file *file, int from_tty,
struct cmd_list_element *c, const char *value)
{
- gdb_printf (file,
- _("Mode for reading from readonly sections is %s.\n"),
+ gdb_printf (file, _ ("Mode for reading from readonly sections is %s.\n"),
value);
}
/* Target vector read/write partial wrapper functions. */
static enum target_xfer_status
-target_read_partial (struct target_ops *ops,
- enum target_object object,
- const char *annex, gdb_byte *buf,
- ULONGEST offset, ULONGEST len,
- ULONGEST *xfered_len)
+target_read_partial (struct target_ops *ops, enum target_object object,
+ const char *annex, gdb_byte *buf, ULONGEST offset,
+ ULONGEST len, ULONGEST *xfered_len)
{
return target_xfer_partial (ops, object, annex, buf, NULL, offset, len,
xfered_len);
}
static enum target_xfer_status
-target_write_partial (struct target_ops *ops,
- enum target_object object,
- const char *annex, const gdb_byte *buf,
- ULONGEST offset, LONGEST len, ULONGEST *xfered_len)
+target_write_partial (struct target_ops *ops, enum target_object object,
+ const char *annex, const gdb_byte *buf, ULONGEST offset,
+ LONGEST len, ULONGEST *xfered_len)
{
return target_xfer_partial (ops, object, annex, NULL, buf, offset, len,
xfered_len);
@@ -1953,18 +1939,15 @@ target_write_partial (struct target_ops *ops,
/* For docs on target_read see target.h. */
LONGEST
-target_read (struct target_ops *ops,
- enum target_object object,
- const char *annex, gdb_byte *buf,
- ULONGEST offset, LONGEST len)
+target_read (struct target_ops *ops, enum target_object object,
+ const char *annex, gdb_byte *buf, ULONGEST offset, LONGEST len)
{
LONGEST xfered_total = 0;
int unit_size = 1;
/* If we are reading from a memory object, find the length of an addressable
unit for that architecture. */
- if (object == TARGET_OBJECT_MEMORY
- || object == TARGET_OBJECT_STACK_MEMORY
+ if (object == TARGET_OBJECT_MEMORY || object == TARGET_OBJECT_STACK_MEMORY
|| object == TARGET_OBJECT_CODE_MEMORY
|| object == TARGET_OBJECT_RAW_MEMORY)
unit_size = gdbarch_addressable_memory_unit_size (target_gdbarch ());
@@ -1989,7 +1972,6 @@ target_read (struct target_ops *ops,
}
else
return TARGET_XFER_E_IO;
-
}
return len;
}
@@ -2016,9 +1998,8 @@ target_read (struct target_ops *ops,
take care of reading multiple ranges then. */
static void
-read_whatever_is_readable (struct target_ops *ops,
- const ULONGEST begin, const ULONGEST end,
- int unit_size,
+read_whatever_is_readable (struct target_ops *ops, const ULONGEST begin,
+ const ULONGEST end, int unit_size,
std::vector<memory_read_result> *result)
{
ULONGEST current_begin = begin;
@@ -2035,15 +2016,17 @@ read_whatever_is_readable (struct target_ops *ops,
/* Check that either first or the last byte is readable, and give up
if not. This heuristic is meant to permit reading accessible memory
at the boundary of accessible region. */
- if (target_read_partial (ops, TARGET_OBJECT_MEMORY, NULL,
- buf.get (), begin, 1, &xfered_len) == TARGET_XFER_OK)
+ if (target_read_partial (ops, TARGET_OBJECT_MEMORY, NULL, buf.get (), begin,
+ 1, &xfered_len)
+ == TARGET_XFER_OK)
{
forward = 1;
++current_begin;
}
else if (target_read_partial (ops, TARGET_OBJECT_MEMORY, NULL,
buf.get () + (end - begin) - 1, end - 1, 1,
- &xfered_len) == TARGET_XFER_OK)
+ &xfered_len)
+ == TARGET_XFER_OK)
{
forward = 0;
--current_end;
@@ -2080,8 +2063,7 @@ read_whatever_is_readable (struct target_ops *ops,
xfer = target_read (ops, TARGET_OBJECT_MEMORY, NULL,
buf.get () + (first_half_begin - begin) * unit_size,
- first_half_begin,
- first_half_end - first_half_begin);
+ first_half_begin, first_half_end - first_half_begin);
if (xfer == first_half_end - first_half_begin)
{
@@ -2113,8 +2095,8 @@ read_whatever_is_readable (struct target_ops *ops,
/* The [current_end, end) range has been read. */
LONGEST region_len = end - current_end;
- gdb::unique_xmalloc_ptr<gdb_byte> data
- ((gdb_byte *) xmalloc (region_len * unit_size));
+ gdb::unique_xmalloc_ptr<gdb_byte> data (
+ (gdb_byte *) xmalloc (region_len * unit_size));
memcpy (data.get (), buf.get () + (current_end - begin) * unit_size,
region_len * unit_size);
result->emplace_back (current_end, end, std::move (data));
@@ -2122,8 +2104,8 @@ read_whatever_is_readable (struct target_ops *ops,
}
std::vector<memory_read_result>
-read_memory_robust (struct target_ops *ops,
- const ULONGEST offset, const LONGEST len)
+read_memory_robust (struct target_ops *ops, const ULONGEST offset,
+ const LONGEST len)
{
std::vector<memory_read_result> result;
int unit_size = gdbarch_addressable_memory_unit_size (target_gdbarch ());
@@ -2152,11 +2134,11 @@ read_memory_robust (struct target_ops *ops,
else
{
LONGEST to_read = std::min (len - xfered_total, region_len);
- gdb::unique_xmalloc_ptr<gdb_byte> buffer
- ((gdb_byte *) xmalloc (to_read * unit_size));
+ gdb::unique_xmalloc_ptr<gdb_byte> buffer (
+ (gdb_byte *) xmalloc (to_read * unit_size));
- LONGEST xfered_partial =
- target_read (ops, TARGET_OBJECT_MEMORY, NULL, buffer.get (),
+ LONGEST xfered_partial
+ = target_read (ops, TARGET_OBJECT_MEMORY, NULL, buffer.get (),
offset + xfered_total, to_read);
/* Call an observer, notifying them of the xfer progress? */
if (xfered_partial <= 0)
@@ -2182,12 +2164,10 @@ read_memory_robust (struct target_ops *ops,
return result;
}
-
/* An alternative to target_write with progress callbacks. */
LONGEST
-target_write_with_progress (struct target_ops *ops,
- enum target_object object,
+target_write_with_progress (struct target_ops *ops, enum target_object object,
const char *annex, const gdb_byte *buf,
ULONGEST offset, LONGEST len,
void (*progress) (ULONGEST, void *), void *baton)
@@ -2197,8 +2177,7 @@ target_write_with_progress (struct target_ops *ops,
/* If we are writing to a memory object, find the length of an addressable
unit for that architecture. */
- if (object == TARGET_OBJECT_MEMORY
- || object == TARGET_OBJECT_STACK_MEMORY
+ if (object == TARGET_OBJECT_MEMORY || object == TARGET_OBJECT_STACK_MEMORY
|| object == TARGET_OBJECT_CODE_MEMORY
|| object == TARGET_OBJECT_RAW_MEMORY)
unit_size = gdbarch_addressable_memory_unit_size (target_gdbarch ());
@@ -2232,10 +2211,9 @@ target_write_with_progress (struct target_ops *ops,
/* For docs on target_write see target.h. */
LONGEST
-target_write (struct target_ops *ops,
- enum target_object object,
- const char *annex, const gdb_byte *buf,
- ULONGEST offset, LONGEST len)
+target_write (struct target_ops *ops, enum target_object object,
+ const char *annex, const gdb_byte *buf, ULONGEST offset,
+ LONGEST len)
{
return target_write_with_progress (ops, object, annex, buf, offset, len,
NULL, NULL);
@@ -2244,7 +2222,7 @@ target_write (struct target_ops *ops,
/* Help for target_read_alloc and target_read_stralloc. See their comments
for details. */
-template <typename T>
+template<typename T>
gdb::optional<gdb::def_vector<T>>
target_read_alloc_1 (struct target_ops *ops, enum target_object object,
const char *annex)
@@ -2269,10 +2247,9 @@ target_read_alloc_1 (struct target_ops *ops, enum target_object object,
buf.resize (buf_pos + chunk);
- status = target_read_partial (ops, object, annex,
- (gdb_byte *) &buf[buf_pos],
- buf_pos, chunk,
- &xfered_len);
+ status
+ = target_read_partial (ops, object, annex, (gdb_byte *) &buf[buf_pos],
+ buf_pos, chunk, &xfered_len);
if (status == TARGET_XFER_EOF)
{
@@ -2321,8 +2298,8 @@ target_read_stralloc (struct target_ops *ops, enum target_object object,
it != buf->end (); it++)
if (*it != '\0')
{
- warning (_("target object %d, annex %s, "
- "contained unexpected null characters"),
+ warning (_ ("target object %d, annex %s, "
+ "contained unexpected null characters"),
(int) object, annex ? annex : "(none)");
break;
}
@@ -2340,14 +2317,13 @@ get_target_memory (struct target_ops *ops, CORE_ADDR addr, gdb_byte *buf,
target. This read must bypass the overlay support (as symbols
don't match this target), and GDB's internal cache (wrong cache
for this target). */
- if (target_read (ops, TARGET_OBJECT_RAW_MEMORY, NULL, buf, addr, len)
- != len)
+ if (target_read (ops, TARGET_OBJECT_RAW_MEMORY, NULL, buf, addr, len) != len)
memory_error (TARGET_XFER_E_IO, addr);
}
ULONGEST
-get_target_memory_unsigned (struct target_ops *ops, CORE_ADDR addr,
- int len, enum bfd_endian byte_order)
+get_target_memory_unsigned (struct target_ops *ops, CORE_ADDR addr, int len,
+ enum bfd_endian byte_order)
{
gdb_byte buf[sizeof (ULONGEST)];
@@ -2364,7 +2340,7 @@ target_insert_breakpoint (struct gdbarch *gdbarch,
{
if (!may_insert_breakpoints)
{
- warning (_("May not insert breakpoints"));
+ warning (_ ("May not insert breakpoints"));
return 1;
}
@@ -2386,7 +2362,7 @@ target_remove_breakpoint (struct gdbarch *gdbarch,
breakpoints should be left in place. */
if (!may_insert_breakpoints)
{
- warning (_("May not remove breakpoints"));
+ warning (_ ("May not remove breakpoints"));
return 1;
}
@@ -2403,12 +2379,10 @@ info_target_command (const char *args, int from_tty)
if (current_program_space->symfile_object_file != NULL)
{
objfile *objf = current_program_space->symfile_object_file;
- gdb_printf (_("Symbols from \"%s\".\n"),
- objfile_name (objf));
+ gdb_printf (_ ("Symbols from \"%s\".\n"), objfile_name (objf));
}
- for (target_ops *t = current_inferior ()->top_target ();
- t != NULL;
+ for (target_ops *t = current_inferior ()->top_target (); t != NULL;
t = t->beneath ())
{
if (!t->has_memory ())
@@ -2417,8 +2391,8 @@ info_target_command (const char *args, int from_tty)
if ((int) (t->stratum ()) <= (int) dummy_stratum)
continue;
if (has_all_mem)
- gdb_printf (_("\tWhile running this, "
- "GDB does not access memory from...\n"));
+ gdb_printf (_ ("\tWhile running this, "
+ "GDB does not access memory from...\n"));
gdb_printf ("%s:\n", t->longname ());
t->files_info ();
has_all_mem = t->has_all_memory ();
@@ -2482,9 +2456,8 @@ target_preopen (int from_tty)
if (current_inferior ()->pid != 0)
{
- if (!from_tty
- || !target_has_execution ()
- || query (_("A program is being debugged already. Kill it? ")))
+ if (!from_tty || !target_has_execution ()
+ || query (_ ("A program is being debugged already. Kill it? ")))
{
/* Core inferiors actually should be detached, not
killed. */
@@ -2494,7 +2467,7 @@ target_preopen (int from_tty)
target_detach (current_inferior (), 0);
}
else
- error (_("Program not killed."));
+ error (_ ("Program not killed."));
}
/* Calling target_kill may remove the target from the stack. But if
@@ -2532,7 +2505,8 @@ target_detach (inferior *inf, int from_tty)
/* Hold a strong reference because detaching may unpush the
target. */
- auto proc_target_ref = target_ops_ref::new_reference (inf->process_target ());
+ auto proc_target_ref
+ = target_ops_ref::new_reference (inf->process_target ());
current_inferior ()->top_target ()->detach (inf, from_tty);
@@ -2592,8 +2566,8 @@ target_wait (ptid_t ptid, struct target_waitstatus *status,
/* See target.h. */
ptid_t
-default_target_wait (struct target_ops *ops,
- ptid_t ptid, struct target_waitstatus *status,
+default_target_wait (struct target_ops *ops, ptid_t ptid,
+ struct target_waitstatus *status,
target_wait_flags options)
{
status->set_ignore ();
@@ -2616,8 +2590,7 @@ target_thread_name (struct thread_info *info)
struct thread_info *
target_thread_handle_to_thread_info (const gdb_byte *thread_handle,
- int handle_len,
- struct inferior *inf)
+ int handle_len, struct inferior *inf)
{
target_ops *target = current_inferior ()->top_target ();
@@ -2693,7 +2666,7 @@ default_follow_fork (struct target_ops *self, inferior *child_inf,
bool follow_child, bool detach_fork)
{
/* Some target returned a fork event, but did not know how to follow it. */
- internal_error (_("could not find a target to follow fork"));
+ internal_error (_ ("could not find a target to follow fork"));
}
/* See target.h. */
@@ -2732,7 +2705,7 @@ target_follow_exec (inferior *follow_inf, ptid_t ptid,
static void
default_mourn_inferior (struct target_ops *self)
{
- internal_error (_("could not find a target to follow mourn inferior"));
+ internal_error (_ ("could not find a target to follow mourn inferior"));
}
void
@@ -2756,21 +2729,18 @@ target_read_description (struct target_ops *target)
return target->read_description ();
}
-
/* Default implementation of memory-searching. */
static int
-default_search_memory (struct target_ops *self,
- CORE_ADDR start_addr, ULONGEST search_space_len,
- const gdb_byte *pattern, ULONGEST pattern_len,
- CORE_ADDR *found_addrp)
+default_search_memory (struct target_ops *self, CORE_ADDR start_addr,
+ ULONGEST search_space_len, const gdb_byte *pattern,
+ ULONGEST pattern_len, CORE_ADDR *found_addrp)
{
- auto read_memory = [=] (CORE_ADDR addr, gdb_byte *result, size_t len)
- {
- return target_read (current_inferior ()->top_target (),
- TARGET_OBJECT_MEMORY, NULL,
- result, addr, len) == len;
- };
+ auto read_memory = [=] (CORE_ADDR addr, gdb_byte *result, size_t len) {
+ return target_read (current_inferior ()->top_target (),
+ TARGET_OBJECT_MEMORY, NULL, result, addr, len)
+ == len;
+ };
/* Start over from the top of the target stack. */
return simple_search_memory (read_memory, start_addr, search_space_len,
@@ -2802,8 +2772,7 @@ target_search_memory (CORE_ADDR start_addr, ULONGEST search_space_len,
void
target_require_runnable (void)
{
- for (target_ops *t = current_inferior ()->top_target ();
- t != NULL;
+ for (target_ops *t = current_inferior ()->top_target (); t != NULL;
t = t->beneath ())
{
/* If this target knows how to create a new program, then
@@ -2819,15 +2788,15 @@ target_require_runnable (void)
if (t->stratum () > process_stratum)
continue;
- error (_("The \"%s\" target does not support \"run\". "
- "Try \"help target\" or \"continue\"."),
+ error (_ ("The \"%s\" target does not support \"run\". "
+ "Try \"help target\" or \"continue\"."),
t->shortname ());
}
/* This function is only called if the target is running. In that
case there should have been a process_stratum target and it
should either know how to create inferiors, or not... */
- internal_error (_("No targets found"));
+ internal_error (_ ("No targets found"));
}
/* Whether GDB is allowed to fall back to the default run target for
@@ -2839,8 +2808,8 @@ show_auto_connect_native_target (struct ui_file *file, int from_tty,
struct cmd_list_element *c, const char *value)
{
gdb_printf (file,
- _("Whether GDB may automatically connect to the "
- "native target is %s.\n"),
+ _ ("Whether GDB may automatically connect to the "
+ "native target is %s.\n"),
value);
}
@@ -2855,7 +2824,7 @@ void
set_native_target (target_ops *target)
{
if (the_native_target != NULL)
- internal_error (_("native target already set (\"%s\")."),
+ internal_error (_ ("native target already set (\"%s\")."),
the_native_target->longname ());
the_native_target = target;
@@ -2883,7 +2852,7 @@ find_default_run_target (const char *do_mesg)
return the_native_target;
if (do_mesg != NULL)
- error (_("Don't know how to %s. Try \"help target\"."), do_mesg);
+ error (_ ("Don't know how to %s. Try \"help target\"."), do_mesg);
return NULL;
}
@@ -2893,8 +2862,7 @@ struct target_ops *
find_attach_target (void)
{
/* If a target on the current stack can attach, use it. */
- for (target_ops *t = current_inferior ()->top_target ();
- t != NULL;
+ for (target_ops *t = current_inferior ()->top_target (); t != NULL;
t = t->beneath ())
{
if (t->can_attach ())
@@ -2911,8 +2879,7 @@ struct target_ops *
find_run_target (void)
{
/* If a target on the current stack can run, use it. */
- for (target_ops *t = current_inferior ()->top_target ();
- t != NULL;
+ for (target_ops *t = current_inferior ()->top_target (); t != NULL;
t = t->beneath ())
{
if (t->can_create_inferior ())
@@ -2948,8 +2915,8 @@ target_info_proc (const char *args, enum info_proc_what what)
if (t->info_proc (args, what))
{
if (targetdebug)
- gdb_printf (gdb_stdlog,
- "target_info_proc (\"%s\", %d)\n", args, what);
+ gdb_printf (gdb_stdlog, "target_info_proc (\"%s\", %d)\n", args,
+ what);
return 1;
}
@@ -3048,8 +3015,7 @@ target_ops::can_create_inferior ()
}
void
-target_ops::create_inferior (const char *, const std::string &,
- char **, int)
+target_ops::create_inferior (const char *, const std::string &, char **, int)
{
gdb_assert_not_reached ("target_ops::create_inferior called");
}
@@ -3063,8 +3029,7 @@ target_ops::can_run ()
int
target_can_run ()
{
- for (target_ops *t = current_inferior ()->top_target ();
- t != NULL;
+ for (target_ops *t = current_inferior ()->top_target (); t != NULL;
t = t->beneath ())
{
if (t->can_run ())
@@ -3101,10 +3066,7 @@ struct fileio_fh_t
int target_fd;
/* Check whether this fileio_fh_t represents a closed file. */
- bool is_closed ()
- {
- return target_fd < 0;
- }
+ bool is_closed () { return target_fd < 0; }
};
/* Vector of currently open file handles. The value returned by
@@ -3145,9 +3107,9 @@ acquire_fileio_fd (target_ops *target, int target_fd)
/* Push a new handle if no closed handles were found. */
if (lowest_closed_fd == fileio_fhandles.size ())
- fileio_fhandles.push_back (fileio_fh_t {target, target_fd});
+ fileio_fhandles.push_back (fileio_fh_t { target, target_fd });
else
- fileio_fhandles[lowest_closed_fd] = {target, target_fd};
+ fileio_fhandles[lowest_closed_fd] = { target, target_fd };
/* Should no longer be marked closed. */
gdb_assert (!fileio_fhandles[lowest_closed_fd].is_closed ());
@@ -3174,15 +3136,14 @@ fileio_fd_to_fh (int fd)
return &fileio_fhandles[fd];
}
-
/* Default implementations of file i/o methods. We don't want these
to delegate automatically, because we need to know which target
supported the method, in order to call it directly from within
pread/pwrite, etc. */
int
-target_ops::fileio_open (struct inferior *inf, const char *filename,
- int flags, int mode, int warn_if_slow,
+target_ops::fileio_open (struct inferior *inf, const char *filename, int flags,
+ int mode, int warn_if_slow,
fileio_error *target_errno)
{
*target_errno = FILEIO_ENOSYS;
@@ -3198,8 +3159,8 @@ target_ops::fileio_pwrite (int fd, const gdb_byte *write_buf, int len,
}
int
-target_ops::fileio_pread (int fd, gdb_byte *read_buf, int len,
- ULONGEST offset, fileio_error *target_errno)
+target_ops::fileio_pread (int fd, gdb_byte *read_buf, int len, ULONGEST offset,
+ fileio_error *target_errno)
{
*target_errno = FILEIO_ENOSYS;
return -1;
@@ -3238,13 +3199,13 @@ target_ops::fileio_readlink (struct inferior *inf, const char *filename,
/* See target.h. */
int
-target_fileio_open (struct inferior *inf, const char *filename,
- int flags, int mode, bool warn_if_slow, fileio_error *target_errno)
+target_fileio_open (struct inferior *inf, const char *filename, int flags,
+ int mode, bool warn_if_slow, fileio_error *target_errno)
{
for (target_ops *t = default_fileio_target (); t != NULL; t = t->beneath ())
{
- int fd = t->fileio_open (inf, filename, flags, mode,
- warn_if_slow, target_errno);
+ int fd = t->fileio_open (inf, filename, flags, mode, warn_if_slow,
+ target_errno);
if (fd == -1 && *target_errno == FILEIO_ENOSYS)
continue;
@@ -3258,10 +3219,8 @@ target_fileio_open (struct inferior *inf, const char *filename,
gdb_printf (gdb_stdlog,
"target_fileio_open (%d,%s,0x%x,0%o,%d)"
" = %d (%d)\n",
- inf == NULL ? 0 : inf->num,
- filename, flags, mode,
- warn_if_slow, fd,
- fd != -1 ? 0 : *target_errno);
+ inf == NULL ? 0 : inf->num, filename, flags, mode,
+ warn_if_slow, fd, fd != -1 ? 0 : *target_errno);
return fd;
}
@@ -3283,23 +3242,23 @@ target_fileio_pwrite (int fd, const gdb_byte *write_buf, int len,
else if (fh->target == NULL)
*target_errno = FILEIO_EIO;
else
- ret = fh->target->fileio_pwrite (fh->target_fd, write_buf,
- len, offset, target_errno);
+ ret = fh->target->fileio_pwrite (fh->target_fd, write_buf, len, offset,
+ target_errno);
if (targetdebug)
gdb_printf (gdb_stdlog,
"target_fileio_pwrite (%d,...,%d,%s) "
"= %d (%d)\n",
- fd, len, pulongest (offset),
- ret, ret != -1 ? 0 : *target_errno);
+ fd, len, pulongest (offset), ret,
+ ret != -1 ? 0 : *target_errno);
return ret;
}
/* See target.h. */
int
-target_fileio_pread (int fd, gdb_byte *read_buf, int len,
- ULONGEST offset, fileio_error *target_errno)
+target_fileio_pread (int fd, gdb_byte *read_buf, int len, ULONGEST offset,
+ fileio_error *target_errno)
{
fileio_fh_t *fh = fileio_fd_to_fh (fd);
int ret = -1;
@@ -3309,15 +3268,15 @@ target_fileio_pread (int fd, gdb_byte *read_buf, int len,
else if (fh->target == NULL)
*target_errno = FILEIO_EIO;
else
- ret = fh->target->fileio_pread (fh->target_fd, read_buf,
- len, offset, target_errno);
+ ret = fh->target->fileio_pread (fh->target_fd, read_buf, len, offset,
+ target_errno);
if (targetdebug)
gdb_printf (gdb_stdlog,
"target_fileio_pread (%d,...,%d,%s) "
"= %d (%d)\n",
- fd, len, pulongest (offset),
- ret, ret != -1 ? 0 : *target_errno);
+ fd, len, pulongest (offset), ret,
+ ret != -1 ? 0 : *target_errno);
return ret;
}
@@ -3337,9 +3296,8 @@ target_fileio_fstat (int fd, struct stat *sb, fileio_error *target_errno)
ret = fh->target->fileio_fstat (fh->target_fd, sb, target_errno);
if (targetdebug)
- gdb_printf (gdb_stdlog,
- "target_fileio_fstat (%d) = %d (%d)\n",
- fd, ret, ret != -1 ? 0 : *target_errno);
+ gdb_printf (gdb_stdlog, "target_fileio_fstat (%d) = %d (%d)\n", fd, ret,
+ ret != -1 ? 0 : *target_errno);
return ret;
}
@@ -3356,17 +3314,15 @@ target_fileio_close (int fd, fileio_error *target_errno)
else
{
if (fh->target != NULL)
- ret = fh->target->fileio_close (fh->target_fd,
- target_errno);
+ ret = fh->target->fileio_close (fh->target_fd, target_errno);
else
ret = 0;
release_fileio_fd (fd, fh);
}
if (targetdebug)
- gdb_printf (gdb_stdlog,
- "target_fileio_close (%d) = %d (%d)\n",
- fd, ret, ret != -1 ? 0 : *target_errno);
+ gdb_printf (gdb_stdlog, "target_fileio_close (%d) = %d (%d)\n", fd, ret,
+ ret != -1 ? 0 : *target_errno);
return ret;
}
@@ -3387,8 +3343,8 @@ target_fileio_unlink (struct inferior *inf, const char *filename,
gdb_printf (gdb_stdlog,
"target_fileio_unlink (%d,%s)"
" = %d (%d)\n",
- inf == NULL ? 0 : inf->num, filename,
- ret, ret != -1 ? 0 : *target_errno);
+ inf == NULL ? 0 : inf->num, filename, ret,
+ ret != -1 ? 0 : *target_errno);
return ret;
}
@@ -3414,9 +3370,8 @@ target_fileio_readlink (struct inferior *inf, const char *filename,
gdb_printf (gdb_stdlog,
"target_fileio_readlink (%d,%s)"
" = %s (%d)\n",
- inf == NULL ? 0 : inf->num,
- filename, ret ? ret->c_str () : "(nil)",
- ret ? 0 : *target_errno);
+ inf == NULL ? 0 : inf->num, filename,
+ ret ? ret->c_str () : "(nil)", ret ? 0 : *target_errno);
return ret;
}
@@ -3429,6 +3384,7 @@ target_fileio_readlink (struct inferior *inf, const char *filename,
class scoped_target_fd
{
public:
+
explicit scoped_target_fd (int fd) noexcept
: m_fd (fd)
{
@@ -3446,12 +3402,10 @@ public:
DISABLE_COPY_AND_ASSIGN (scoped_target_fd);
- int get () const noexcept
- {
- return m_fd;
- }
+ int get () const noexcept { return m_fd; }
private:
+
int m_fd;
};
@@ -3527,7 +3481,7 @@ target_fileio_read_alloc (struct inferior *inf, const char *filename,
/* See target.h. */
-gdb::unique_xmalloc_ptr<char>
+gdb::unique_xmalloc_ptr<char>
target_fileio_read_stralloc (struct inferior *inf, const char *filename)
{
gdb_byte *buffer;
@@ -3549,8 +3503,8 @@ target_fileio_read_stralloc (struct inferior *inf, const char *filename)
for (i = strlen (bufstr); i < transferred; i++)
if (bufstr[i] != 0)
{
- warning (_("target file %s "
- "contained unexpected null characters"),
+ warning (_ ("target file %s "
+ "contained unexpected null characters"),
filename);
break;
}
@@ -3558,18 +3512,17 @@ target_fileio_read_stralloc (struct inferior *inf, const char *filename)
return gdb::unique_xmalloc_ptr<char> (bufstr);
}
-
static int
-default_region_ok_for_hw_watchpoint (struct target_ops *self,
- CORE_ADDR addr, int len)
+default_region_ok_for_hw_watchpoint (struct target_ops *self, CORE_ADDR addr,
+ int len)
{
return (len <= gdbarch_ptr_bit (target_gdbarch ()) / TARGET_CHAR_BIT);
}
static int
default_watchpoint_addr_within_range (struct target_ops *target,
- CORE_ADDR addr,
- CORE_ADDR start, int length)
+ CORE_ADDR addr, CORE_ADDR start,
+ int length)
{
return addr >= start && addr < start + length;
}
@@ -3595,8 +3548,6 @@ find_target_at (enum strata stratum)
return current_inferior ()->target_at (stratum);
}
-
-
/* See target.h */
void
@@ -3614,7 +3565,7 @@ target_announce_detach (int from_tty)
gdb_printf ("Detaching from pid %s\n",
target_pid_to_str (ptid_t (pid)).c_str ());
else
- gdb_printf (_("Detaching from program: %s, %s\n"), exec_file,
+ gdb_printf (_ ("Detaching from program: %s, %s\n"), exec_file,
target_pid_to_str (ptid_t (pid)).c_str ());
}
@@ -3666,7 +3617,7 @@ generic_mourn_inferior (void)
if (deprecated_detach_hook)
deprecated_detach_hook ();
}
-
+
/* Convert a normal process ID to a string. Returns the string in a
static buffer. */
@@ -3687,16 +3638,15 @@ static int
dummy_find_memory_regions (struct target_ops *self,
find_memory_region_ftype ignore1, void *ignore2)
{
- error (_("Command not implemented for this target."));
+ error (_ ("Command not implemented for this target."));
return 0;
}
/* Error-catcher for target_make_corefile_notes. */
static gdb::unique_xmalloc_ptr<char>
-dummy_make_corefile_notes (struct target_ops *self,
- bfd *ignore1, int *ignore2)
+dummy_make_corefile_notes (struct target_ops *self, bfd *ignore1, int *ignore2)
{
- error (_("Command not implemented for this target."));
+ error (_ ("Command not implemented for this target."));
return NULL;
}
@@ -3715,11 +3665,7 @@ get_dummy_target ()
return &the_dummy_target;
}
-static const target_info dummy_target_info = {
- "None",
- N_("None"),
- ""
-};
+static const target_info dummy_target_info = { "None", N_ ("None"), "" };
strata
dummy_target::stratum () const
@@ -3745,8 +3691,6 @@ debug_target::info () const
return beneath ()->info ();
}
-
-
void
target_close (struct target_ops *targ)
{
@@ -3782,7 +3726,7 @@ target_stop (ptid_t ptid)
if (!may_stop)
{
- warning (_("May not interrupt or stop the target, ignoring attempt"));
+ warning (_ ("May not interrupt or stop the target, ignoring attempt"));
return;
}
@@ -3794,7 +3738,7 @@ target_interrupt ()
{
if (!may_stop)
{
- warning (_("May not interrupt or stop the target, ignoring attempt"));
+ warning (_ ("May not interrupt or stop the target, ignoring attempt"));
return;
}
@@ -3908,8 +3852,7 @@ target_options_to_string (target_wait_flags target_options)
{
std::string ret;
-#define DO_TARG_OPTION(OPT) \
- do_option (&target_options, &ret, OPT, #OPT)
+#define DO_TARG_OPTION(OPT) do_option (&target_options, &ret, OPT, #OPT)
DO_TARG_OPTION (TARGET_WNOHANG);
@@ -3931,7 +3874,7 @@ void
target_store_registers (struct regcache *regcache, int regno)
{
if (!may_write_registers)
- error (_("Writing to registers is not allowed (regno %d)"), regno);
+ error (_ ("Writing to registers is not allowed (regno %d)"), regno);
current_inferior ()->top_target ()->store_registers (regcache, regno);
if (targetdebug)
@@ -3947,8 +3890,8 @@ target_core_of_thread (ptid_t ptid)
}
int
-simple_verify_memory (struct target_ops *ops,
- const gdb_byte *data, CORE_ADDR lma, ULONGEST size)
+simple_verify_memory (struct target_ops *ops, const gdb_byte *data,
+ CORE_ADDR lma, ULONGEST size)
{
LONGEST total_xfered = 0;
@@ -3957,11 +3900,11 @@ simple_verify_memory (struct target_ops *ops,
ULONGEST xfered_len;
enum target_xfer_status status;
gdb_byte buf[1024];
- ULONGEST howmuch = std::min<ULONGEST> (sizeof (buf), size - total_xfered);
+ ULONGEST howmuch
+ = std::min<ULONGEST> (sizeof (buf), size - total_xfered);
- status = target_xfer_partial (ops, TARGET_OBJECT_MEMORY, NULL,
- buf, NULL, lma + total_xfered, howmuch,
- &xfered_len);
+ status = target_xfer_partial (ops, TARGET_OBJECT_MEMORY, NULL, buf, NULL,
+ lma + total_xfered, howmuch, &xfered_len);
if (status == TARGET_XFER_OK
&& memcmp (data + total_xfered, buf, xfered_len) == 0)
{
@@ -3977,12 +3920,12 @@ simple_verify_memory (struct target_ops *ops,
/* Default implementation of memory verification. */
static int
-default_verify_memory (struct target_ops *self,
- const gdb_byte *data, CORE_ADDR memaddr, ULONGEST size)
+default_verify_memory (struct target_ops *self, const gdb_byte *data,
+ CORE_ADDR memaddr, ULONGEST size)
{
/* Start over from the top of the target stack. */
- return simple_verify_memory (current_inferior ()->top_target (),
- data, memaddr, size);
+ return simple_verify_memory (current_inferior ()->top_target (), data,
+ memaddr, size);
}
int
@@ -4180,8 +4123,7 @@ target_insn_history (int size, gdb_disassembly_flags flags)
/* See target.h. */
void
-target_insn_history_from (ULONGEST from, int size,
- gdb_disassembly_flags flags)
+target_insn_history_from (ULONGEST from, int size, gdb_disassembly_flags flags)
{
current_inferior ()->top_target ()->insn_history_from (from, size, flags);
}
@@ -4214,7 +4156,8 @@ target_call_history_from (ULONGEST begin, int size, record_print_flags flags)
/* See target.h. */
void
-target_call_history_range (ULONGEST begin, ULONGEST end, record_print_flags flags)
+target_call_history_range (ULONGEST begin, ULONGEST end,
+ record_print_flags flags)
{
current_inferior ()->top_target ()->call_history_range (begin, end, flags);
}
@@ -4251,10 +4194,8 @@ target_done_generating_core (void)
current_inferior ()->top_target ()->done_generating_core ();
}
-
-
-static char targ_desc[] =
-"Names of targets and files being debugged.\nShows the entire \
+static char targ_desc[]
+ = "Names of targets and files being debugged.\nShows the entire \
stack of targets currently in use (including the exec-file,\n\
core-file, and process, if any), as well as the symbol file name.";
@@ -4262,7 +4203,7 @@ static void
default_rcmd (struct target_ops *self, const char *command,
struct ui_file *output)
{
- error (_("\"monitor\" command not supported by this target."));
+ error (_ ("\"monitor\" command not supported by this target."));
}
static void
@@ -4294,7 +4235,8 @@ flash_erase_command (const char *cmd, int from_tty)
ui_out_emit_tuple tuple_emitter (current_uiout, "erased-regions");
- current_uiout->message (_("Erasing flash memory region at address "));
+ current_uiout->message (
+ _ ("Erasing flash memory region at address "));
current_uiout->field_core_addr ("address", gdbarch, m.lo);
current_uiout->message (", size = ");
current_uiout->field_string ("size", hex_string (m.hi - m.lo));
@@ -4306,7 +4248,7 @@ flash_erase_command (const char *cmd, int from_tty)
if (found_flash_region)
target_flash_done ();
else
- current_uiout->message (_("No flash memory regions found.\n"));
+ current_uiout->message (_ ("No flash memory regions found.\n"));
}
/* Print the name of each layers of our target stack. */
@@ -4314,10 +4256,9 @@ flash_erase_command (const char *cmd, int from_tty)
static void
maintenance_print_target_stack (const char *cmd, int from_tty)
{
- gdb_printf (_("The current target stack is:\n"));
+ gdb_printf (_ ("The current target stack is:\n"));
- for (target_ops *t = current_inferior ()->top_target ();
- t != NULL;
+ for (target_ops *t = current_inferior ()->top_target (); t != NULL;
t = t->beneath ())
{
if (t->stratum () == debug_stratum)
@@ -4354,7 +4295,7 @@ static void
set_maint_target_async (bool permitted)
{
if (have_live_inferiors ())
- error (_("Cannot change this setting while the inferior is running."));
+ error (_ ("Cannot change this setting while the inferior is running."));
target_async_permitted = permitted;
}
@@ -4366,12 +4307,13 @@ get_maint_target_async ()
}
static void
-show_maint_target_async (ui_file *file, int from_tty,
- cmd_list_element *c, const char *value)
+show_maint_target_async (ui_file *file, int from_tty, cmd_list_element *c,
+ const char *value)
{
gdb_printf (file,
- _("Controlling the inferior in "
- "asynchronous mode is %s.\n"), value);
+ _ ("Controlling the inferior in "
+ "asynchronous mode is %s.\n"),
+ value);
}
/* Return true if the target operates in non-stop mode even with "set
@@ -4388,8 +4330,7 @@ target_always_non_stop_p (void)
bool
target_is_non_stop_p ()
{
- return ((non_stop
- || target_non_stop_enabled == AUTO_BOOLEAN_TRUE
+ return ((non_stop || target_non_stop_enabled == AUTO_BOOLEAN_TRUE
|| (target_non_stop_enabled == AUTO_BOOLEAN_AUTO
&& target_always_non_stop_p ()))
&& target_can_async_p ());
@@ -4425,7 +4366,7 @@ static void
set_maint_target_non_stop (auto_boolean enabled)
{
if (have_live_inferiors ())
- error (_("Cannot change this setting while the inferior is running."));
+ error (_ ("Cannot change this setting while the inferior is running."));
target_non_stop_enabled = enabled;
}
@@ -4439,18 +4380,19 @@ get_maint_target_non_stop ()
}
static void
-show_maint_target_non_stop (ui_file *file, int from_tty,
- cmd_list_element *c, const char *value)
+show_maint_target_non_stop (ui_file *file, int from_tty, cmd_list_element *c,
+ const char *value)
{
if (target_non_stop_enabled == AUTO_BOOLEAN_AUTO)
gdb_printf (file,
- _("Whether the target is always in non-stop mode "
- "is %s (currently %s).\n"), value,
- target_always_non_stop_p () ? "on" : "off");
+ _ ("Whether the target is always in non-stop mode "
+ "is %s (currently %s).\n"),
+ value, target_always_non_stop_p () ? "on" : "off");
else
gdb_printf (file,
- _("Whether the target is always in non-stop mode "
- "is %s.\n"), value);
+ _ ("Whether the target is always in non-stop mode "
+ "is %s.\n"),
+ value);
}
/* Temporary copies of permission settings. */
@@ -4485,7 +4427,7 @@ set_target_permissions (const char *args, int from_tty,
if (target_has_execution ())
{
update_target_permissions ();
- error (_("Cannot change this setting while the inferior is running."));
+ error (_ ("Cannot change this setting while the inferior is running."));
}
/* Make the real values match the user-changed values. */
@@ -4501,7 +4443,7 @@ set_target_permissions (const char *args, int from_tty,
static void
set_write_memory_permission (const char *args, int from_tty,
- struct cmd_list_element *c)
+ struct cmd_list_element *c)
{
/* Make the real values match the user-changed values. */
may_write_memory = may_write_memory_1;
@@ -4518,118 +4460,127 @@ _initialize_target ()
add_info ("target", info_target_command, targ_desc);
add_info ("files", info_target_command, targ_desc);
- add_setshow_zuinteger_cmd ("target", class_maintenance, &targetdebug, _("\
-Set target debugging."), _("\
-Show target debugging."), _("\
+ add_setshow_zuinteger_cmd ("target", class_maintenance, &targetdebug, _ ("\
+Set target debugging."),
+ _ ("\
+Show target debugging."),
+ _ ("\
When non-zero, target debugging is enabled. Higher numbers are more\n\
verbose."),
- set_targetdebug,
- show_targetdebug,
- &setdebuglist, &showdebuglist);
+ set_targetdebug, show_targetdebug, &setdebuglist,
+ &showdebuglist);
add_setshow_boolean_cmd ("trust-readonly-sections", class_support,
- &trust_readonly, _("\
-Set mode for reading from readonly sections."), _("\
-Show mode for reading from readonly sections."), _("\
+ &trust_readonly, _ ("\
+Set mode for reading from readonly sections."),
+ _ ("\
+Show mode for reading from readonly sections."),
+ _ ("\
When this mode is on, memory reads from readonly sections (such as .text)\n\
will be read from the object file instead of from the target. This will\n\
result in significant performance improvement for remote targets."),
- NULL,
- show_trust_readonly,
- &setlist, &showlist);
+ NULL, show_trust_readonly, &setlist, &showlist);
add_com ("monitor", class_obscure, do_monitor_command,
- _("Send a command to the remote monitor (remote targets only)."));
+ _ ("Send a command to the remote monitor (remote targets only)."));
add_cmd ("target-stack", class_maintenance, maintenance_print_target_stack,
- _("Print the name of each layer of the internal target stack."),
+ _ ("Print the name of each layer of the internal target stack."),
&maintenanceprintlist);
- add_setshow_boolean_cmd ("target-async", no_class,
- _("\
-Set whether gdb controls the inferior in asynchronous mode."), _("\
-Show whether gdb controls the inferior in asynchronous mode."), _("\
+ add_setshow_boolean_cmd ("target-async", no_class, _ ("\
+Set whether gdb controls the inferior in asynchronous mode."),
+ _ ("\
+Show whether gdb controls the inferior in asynchronous mode."),
+ _ ("\
Tells gdb whether to control the inferior in asynchronous mode."),
- set_maint_target_async,
- get_maint_target_async,
- show_maint_target_async,
- &maintenance_set_cmdlist,
+ set_maint_target_async, get_maint_target_async,
+ show_maint_target_async, &maintenance_set_cmdlist,
&maintenance_show_cmdlist);
- add_setshow_auto_boolean_cmd ("target-non-stop", no_class,
- _("\
-Set whether gdb always controls the inferior in non-stop mode."), _("\
-Show whether gdb always controls the inferior in non-stop mode."), _("\
+ add_setshow_auto_boolean_cmd ("target-non-stop", no_class, _ ("\
+Set whether gdb always controls the inferior in non-stop mode."),
+ _ ("\
+Show whether gdb always controls the inferior in non-stop mode."),
+ _ ("\
Tells gdb whether to control the inferior in non-stop mode."),
- set_maint_target_non_stop,
- get_maint_target_non_stop,
- show_maint_target_non_stop,
- &maintenance_set_cmdlist,
- &maintenance_show_cmdlist);
+ set_maint_target_non_stop,
+ get_maint_target_non_stop,
+ show_maint_target_non_stop,
+ &maintenance_set_cmdlist,
+ &maintenance_show_cmdlist);
add_setshow_boolean_cmd ("may-write-registers", class_support,
- &may_write_registers_1, _("\
-Set permission to write into registers."), _("\
-Show permission to write into registers."), _("\
+ &may_write_registers_1, _ ("\
+Set permission to write into registers."),
+ _ ("\
+Show permission to write into registers."),
+ _ ("\
When this permission is on, GDB may write into the target's registers.\n\
Otherwise, any sort of write attempt will result in an error."),
- set_target_permissions, NULL,
- &setlist, &showlist);
+ set_target_permissions, NULL, &setlist, &showlist);
add_setshow_boolean_cmd ("may-write-memory", class_support,
- &may_write_memory_1, _("\
-Set permission to write into target memory."), _("\
-Show permission to write into target memory."), _("\
+ &may_write_memory_1, _ ("\
+Set permission to write into target memory."),
+ _ ("\
+Show permission to write into target memory."),
+ _ ("\
When this permission is on, GDB may write into the target's memory.\n\
Otherwise, any sort of write attempt will result in an error."),
- set_write_memory_permission, NULL,
- &setlist, &showlist);
+ set_write_memory_permission, NULL, &setlist,
+ &showlist);
add_setshow_boolean_cmd ("may-insert-breakpoints", class_support,
- &may_insert_breakpoints_1, _("\
-Set permission to insert breakpoints in the target."), _("\
-Show permission to insert breakpoints in the target."), _("\
+ &may_insert_breakpoints_1, _ ("\
+Set permission to insert breakpoints in the target."),
+ _ ("\
+Show permission to insert breakpoints in the target."),
+ _ ("\
When this permission is on, GDB may insert breakpoints in the program.\n\
Otherwise, any sort of insertion attempt will result in an error."),
- set_target_permissions, NULL,
- &setlist, &showlist);
+ set_target_permissions, NULL, &setlist, &showlist);
add_setshow_boolean_cmd ("may-insert-tracepoints", class_support,
- &may_insert_tracepoints_1, _("\
-Set permission to insert tracepoints in the target."), _("\
-Show permission to insert tracepoints in the target."), _("\
+ &may_insert_tracepoints_1, _ ("\
+Set permission to insert tracepoints in the target."),
+ _ ("\
+Show permission to insert tracepoints in the target."),
+ _ ("\
When this permission is on, GDB may insert tracepoints in the program.\n\
Otherwise, any sort of insertion attempt will result in an error."),
- set_target_permissions, NULL,
- &setlist, &showlist);
+ set_target_permissions, NULL, &setlist, &showlist);
add_setshow_boolean_cmd ("may-insert-fast-tracepoints", class_support,
- &may_insert_fast_tracepoints_1, _("\
-Set permission to insert fast tracepoints in the target."), _("\
-Show permission to insert fast tracepoints in the target."), _("\
+ &may_insert_fast_tracepoints_1, _ ("\
+Set permission to insert fast tracepoints in the target."),
+ _ ("\
+Show permission to insert fast tracepoints in the target."),
+ _ ("\
When this permission is on, GDB may insert fast tracepoints.\n\
Otherwise, any sort of insertion attempt will result in an error."),
- set_target_permissions, NULL,
- &setlist, &showlist);
+ set_target_permissions, NULL, &setlist, &showlist);
- add_setshow_boolean_cmd ("may-interrupt", class_support,
- &may_stop_1, _("\
-Set permission to interrupt or signal the target."), _("\
-Show permission to interrupt or signal the target."), _("\
+ add_setshow_boolean_cmd ("may-interrupt", class_support, &may_stop_1, _ ("\
+Set permission to interrupt or signal the target."),
+ _ ("\
+Show permission to interrupt or signal the target."),
+ _ ("\
When this permission is on, GDB may interrupt/stop the target's execution.\n\
Otherwise, any attempt to interrupt or stop will be ignored."),
- set_target_permissions, NULL,
- &setlist, &showlist);
+ set_target_permissions, NULL, &setlist, &showlist);
add_com ("flash-erase", no_class, flash_erase_command,
- _("Erase all flash memory regions."));
+ _ ("Erase all flash memory regions."));
add_setshow_boolean_cmd ("auto-connect-native-target", class_support,
- &auto_connect_native_target, _("\
-Set whether GDB may automatically connect to the native target."), _("\
-Show whether GDB may automatically connect to the native target."), _("\
+ &auto_connect_native_target, _ ("\
+Set whether GDB may automatically connect to the native target."),
+ _ ("\
+Show whether GDB may automatically connect to the native target."),
+ _ ("\
When on, and GDB is not connected to a target yet, GDB\n\
attempts \"run\" and other commands with the native target."),
- NULL, show_auto_connect_native_target,
- &setlist, &showlist);
+ NULL, show_auto_connect_native_target, &setlist,
+ &showlist);
}
diff --git a/gdb/target.h b/gdb/target.h
index 2dac86c394d..fc42ec3f56e 100644
--- a/gdb/target.h
+++ b/gdb/target.h
@@ -19,7 +19,7 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
-#if !defined (TARGET_H)
+#if !defined(TARGET_H)
#define TARGET_H
struct objfile;
@@ -39,7 +39,7 @@ struct expression;
struct dcache_struct;
struct inferior;
-#include "infrun.h" /* For enum exec_direction_kind. */
+#include "infrun.h" /* For enum exec_direction_kind. */
#include "breakpoint.h" /* For enum bptype. */
#include "gdbsupport/scoped_restore.h"
#include "gdbsupport/refcounted-object.h"
@@ -86,21 +86,21 @@ struct inferior;
#include "gdbsupport/break-common.h" /* For enum target_hw_bp_type. */
enum strata
- {
- dummy_stratum, /* The lowest of the low */
- file_stratum, /* Executable files, etc */
- process_stratum, /* Executing processes or core dump files */
- thread_stratum, /* Executing threads */
- record_stratum, /* Support record debugging */
- arch_stratum, /* Architecture overrides */
- debug_stratum /* Target debug. Must be last. */
- };
+{
+ dummy_stratum, /* The lowest of the low */
+ file_stratum, /* Executable files, etc */
+ process_stratum, /* Executing processes or core dump files */
+ thread_stratum, /* Executing threads */
+ record_stratum, /* Support record debugging */
+ arch_stratum, /* Architecture overrides */
+ debug_stratum /* Target debug. Must be last. */
+};
enum thread_control_capabilities
- {
- tc_none = 0, /* Default: can't control thread execution. */
- tc_schedlock = 1, /* Can lock the thread scheduler. */
- };
+{
+ tc_none = 0, /* Default: can't control thread execution. */
+ tc_schedlock = 1, /* Can lock the thread scheduler. */
+};
/* The structure below stores information about a system call.
It is basically used in the "catch syscall" command, and in
@@ -109,13 +109,13 @@ enum thread_control_capabilities
It's also good to mention that its fields represent everything
that we currently know about a syscall in GDB. */
struct syscall
- {
- /* The syscall number. */
- int number;
+{
+ /* The syscall number. */
+ int number;
- /* The syscall name. */
- const char *name;
- };
+ /* The syscall name. */
+ const char *name;
+};
/* Return a pretty printed form of TARGET_OPTIONS. */
extern std::string target_options_to_string (target_wait_flags target_options);
@@ -123,14 +123,14 @@ extern std::string target_options_to_string (target_wait_flags target_options);
/* Possible types of events that the inferior handler will have to
deal with. */
enum inferior_event_type
- {
- /* Process a normal inferior event which will result in target_wait
+{
+ /* Process a normal inferior event which will result in target_wait
being called. */
- INF_REG_EVENT,
- /* We are called to do stuff after the inferior stops. */
- INF_EXEC_COMPLETE,
- };
-
+ INF_REG_EVENT,
+ /* We are called to do stuff after the inferior stops. */
+ INF_EXEC_COMPLETE,
+};
+
/* Target objects which can be transfered using target_read,
target_write, et cetera. */
@@ -232,22 +232,19 @@ enum target_xfer_status
/* Return the string form of STATUS. */
extern const char *
- target_xfer_status_to_string (enum target_xfer_status status);
+target_xfer_status_to_string (enum target_xfer_status status);
typedef enum target_xfer_status
- target_xfer_partial_ftype (struct target_ops *ops,
- enum target_object object,
- const char *annex,
- gdb_byte *readbuf,
- const gdb_byte *writebuf,
- ULONGEST offset,
- ULONGEST len,
- ULONGEST *xfered_len);
+target_xfer_partial_ftype (struct target_ops *ops, enum target_object object,
+ const char *annex, gdb_byte *readbuf,
+ const gdb_byte *writebuf, ULONGEST offset,
+ ULONGEST len, ULONGEST *xfered_len);
-enum target_xfer_status
- raw_memory_xfer_partial (struct target_ops *ops, gdb_byte *readbuf,
- const gdb_byte *writebuf, ULONGEST memaddr,
- LONGEST len, ULONGEST *xfered_len);
+enum target_xfer_status raw_memory_xfer_partial (struct target_ops *ops,
+ gdb_byte *readbuf,
+ const gdb_byte *writebuf,
+ ULONGEST memaddr, LONGEST len,
+ ULONGEST *xfered_len);
/* Request that OPS transfer up to LEN addressable units of the target's
OBJECT. When reading from a memory object, the size of an addressable unit
@@ -265,10 +262,9 @@ enum target_xfer_status
to_xfer_partial interface, callers of these functions do not need
to retry partial transfers. */
-extern LONGEST target_read (struct target_ops *ops,
- enum target_object object,
- const char *annex, gdb_byte *buf,
- ULONGEST offset, LONGEST len);
+extern LONGEST target_read (struct target_ops *ops, enum target_object object,
+ const char *annex, gdb_byte *buf, ULONGEST offset,
+ LONGEST len);
struct memory_read_result
{
@@ -294,8 +290,9 @@ struct memory_read_result
gdb::unique_xmalloc_ptr<gdb_byte> data;
};
-extern std::vector<memory_read_result> read_memory_robust
- (struct target_ops *ops, const ULONGEST offset, const LONGEST len);
+extern std::vector<memory_read_result>
+read_memory_robust (struct target_ops *ops, const ULONGEST offset,
+ const LONGEST len);
/* Request that OPS transfer up to LEN addressable units from BUF to the
target's OBJECT. When writing to a memory object, the addressable unit
@@ -312,8 +309,7 @@ extern std::vector<memory_read_result> read_memory_robust
to_xfer_partial interface, callers of these functions do not need to
retry partial transfers. */
-extern LONGEST target_write (struct target_ops *ops,
- enum target_object object,
+extern LONGEST target_write (struct target_ops *ops, enum target_object object,
const char *annex, const gdb_byte *buf,
ULONGEST offset, LONGEST len);
@@ -340,8 +336,9 @@ LONGEST target_write_with_progress (struct target_ops *ops,
size is known in advance. Don't try to read TARGET_OBJECT_MEMORY
through this function. */
-extern gdb::optional<gdb::byte_vector> target_read_alloc
- (struct target_ops *ops, enum target_object object, const char *annex);
+extern gdb::optional<gdb::byte_vector>
+target_read_alloc (struct target_ops *ops, enum target_object object,
+ const char *annex);
/* Read OBJECT/ANNEX using OPS. The result is a NUL-terminated character vector
(therefore usable as a NUL-terminated string). If an error occurs or the
@@ -350,8 +347,9 @@ extern gdb::optional<gdb::byte_vector> target_read_alloc
the returned vector is guaranteed to have at least one element. A warning is
issued if the result contains any embedded NUL bytes. */
-extern gdb::optional<gdb::char_vector> target_read_stralloc
- (struct target_ops *ops, enum target_object object, const char *annex);
+extern gdb::optional<gdb::char_vector>
+target_read_stralloc (struct target_ops *ops, enum target_object object,
+ const char *annex);
/* See target_ops->to_xfer_partial. */
extern target_xfer_partial_ftype target_xfer_partial;
@@ -368,8 +366,8 @@ extern void get_target_memory (struct target_ops *ops, CORE_ADDR addr,
extern ULONGEST get_target_memory_unsigned (struct target_ops *ops,
CORE_ADDR addr, int len,
enum bfd_endian byte_order);
-
-struct thread_info; /* fwd decl for parameter list below: */
+
+struct thread_info; /* fwd decl for parameter list below: */
/* The type of the callback to the to_async method. */
@@ -428,38 +426,35 @@ struct target_info
const char *doc;
};
-struct target_ops
- : public refcounted_object
- {
- /* Return this target's stratum. */
- virtual strata stratum () const = 0;
+struct target_ops : public refcounted_object
+{
+ /* Return this target's stratum. */
+ virtual strata stratum () const = 0;
- /* To the target under this one. */
- target_ops *beneath () const;
+ /* To the target under this one. */
+ target_ops *beneath () const;
- /* Free resources associated with the target. Note that singleton
+ /* Free resources associated with the target. Note that singleton
targets, like e.g., native targets, are global objects, not
heap allocated, and are thus only deleted on GDB exit. The
main teardown entry point is the "close" method, below. */
- virtual ~target_ops () {}
+ virtual ~target_ops () {}
- /* Return a reference to this target's unique target_info
+ /* Return a reference to this target's unique target_info
object. */
- virtual const target_info &info () const = 0;
+ virtual const target_info &info () const = 0;
- /* Name this target type. */
- const char *shortname () const
- { return info ().shortname; }
+ /* Name this target type. */
+ const char *shortname () const { return info ().shortname; }
- const char *longname () const
- { return info ().longname; }
+ const char *longname () const { return info ().longname; }
- /* Close the target. This is where the target can handle
+ /* Close the target. This is where the target can handle
teardown. Heap-allocated targets should delete themselves
before returning. */
- virtual void close ();
+ virtual void close ();
- /* Attaches to a process on the target side. Arguments are as
+ /* Attaches to a process on the target side. Arguments are as
passed to the `attach' command by the user. This routine can
be called when the target is not on the target-stack, if the
target_ops::can_run method returns 1; in that case, it must push
@@ -467,62 +462,55 @@ struct target_ops
for normal operations, and should be ready to deliver the
status of the process immediately (without waiting) to an
upcoming target_wait call. */
- virtual bool can_attach ();
- virtual void attach (const char *, int);
- virtual void post_attach (int)
- TARGET_DEFAULT_IGNORE ();
+ virtual bool can_attach ();
+ virtual void attach (const char *, int);
+ virtual void post_attach (int) TARGET_DEFAULT_IGNORE ();
- /* Detaches from the inferior. Note that on targets that support
+ /* Detaches from the inferior. Note that on targets that support
async execution (i.e., targets where it is possible to detach
from programs with threads running), the target is responsible
for removing breakpoints from the program before the actual
detach, otherwise the program dies when it hits one. */
- virtual void detach (inferior *, int)
- TARGET_DEFAULT_IGNORE ();
+ virtual void detach (inferior *, int) TARGET_DEFAULT_IGNORE ();
- virtual void disconnect (const char *, int)
- TARGET_DEFAULT_NORETURN (tcomplain ());
- virtual void resume (ptid_t,
- int TARGET_DEBUG_PRINTER (target_debug_print_step),
- enum gdb_signal)
- TARGET_DEFAULT_NORETURN (noprocess ());
+ virtual void disconnect (const char *, int)
+ TARGET_DEFAULT_NORETURN (tcomplain ());
+ virtual void resume (ptid_t,
+ int TARGET_DEBUG_PRINTER (target_debug_print_step),
+ enum gdb_signal) TARGET_DEFAULT_NORETURN (noprocess ());
- /* Ensure that all resumed threads are committed to the target.
+ /* Ensure that all resumed threads are committed to the target.
See the description of
process_stratum_target::commit_resumed_state for more
details. */
- virtual void commit_resumed ()
- TARGET_DEFAULT_IGNORE ();
+ virtual void commit_resumed () TARGET_DEFAULT_IGNORE ();
- /* See target_wait's description. Note that implementations of
+ /* See target_wait's description. Note that implementations of
this method must not assume that inferior_ptid on entry is
pointing at the thread or inferior that ends up reporting an
event. The reported event could be for some other thread in
the current inferior or even for a different process of the
current target. inferior_ptid may also be null_ptid on
entry. */
- virtual ptid_t wait (ptid_t, struct target_waitstatus *,
- target_wait_flags options)
- TARGET_DEFAULT_FUNC (default_target_wait);
- virtual void fetch_registers (struct regcache *, int)
- TARGET_DEFAULT_IGNORE ();
- virtual void store_registers (struct regcache *, int)
- TARGET_DEFAULT_NORETURN (noprocess ());
- virtual void prepare_to_store (struct regcache *)
- TARGET_DEFAULT_NORETURN (noprocess ());
-
- virtual void files_info ()
- TARGET_DEFAULT_IGNORE ();
- virtual int insert_breakpoint (struct gdbarch *,
- struct bp_target_info *)
- TARGET_DEFAULT_NORETURN (noprocess ());
- virtual int remove_breakpoint (struct gdbarch *,
- struct bp_target_info *,
+ virtual ptid_t wait (ptid_t, struct target_waitstatus *,
+ target_wait_flags options)
+ TARGET_DEFAULT_FUNC (default_target_wait);
+ virtual void fetch_registers (struct regcache *, int)
+ TARGET_DEFAULT_IGNORE ();
+ virtual void store_registers (struct regcache *, int)
+ TARGET_DEFAULT_NORETURN (noprocess ());
+ virtual void prepare_to_store (struct regcache *)
+ TARGET_DEFAULT_NORETURN (noprocess ());
+
+ virtual void files_info () TARGET_DEFAULT_IGNORE ();
+ virtual int insert_breakpoint (struct gdbarch *, struct bp_target_info *)
+ TARGET_DEFAULT_NORETURN (noprocess ());
+ virtual int remove_breakpoint (struct gdbarch *, struct bp_target_info *,
enum remove_bp_reason)
- TARGET_DEFAULT_NORETURN (noprocess ());
+ TARGET_DEFAULT_NORETURN (noprocess ());
- /* Returns true if the target stopped because it executed a
+ /* Returns true if the target stopped because it executed a
software breakpoint. This is necessary for correct background
execution / non-stop mode operation, and for correct PC
adjustment on targets where the PC needs to be adjusted when a
@@ -531,236 +519,201 @@ struct target_ops
done from the target, so GDB needs to be able to tell whether
it should ignore the event and whether it should adjust the PC.
See adjust_pc_after_break. */
- virtual bool stopped_by_sw_breakpoint ()
- TARGET_DEFAULT_RETURN (false);
- /* Returns true if the above method is supported. */
- virtual bool supports_stopped_by_sw_breakpoint ()
- TARGET_DEFAULT_RETURN (false);
+ virtual bool stopped_by_sw_breakpoint () TARGET_DEFAULT_RETURN (false);
+ /* Returns true if the above method is supported. */
+ virtual bool supports_stopped_by_sw_breakpoint ()
+ TARGET_DEFAULT_RETURN (false);
- /* Returns true if the target stopped for a hardware breakpoint.
+ /* Returns true if the target stopped for a hardware breakpoint.
Likewise, if the target supports hardware breakpoints, this
method is necessary for correct background execution / non-stop
mode operation. Even though hardware breakpoints do not
require PC adjustment, GDB needs to be able to tell whether the
hardware breakpoint event is a delayed event for a breakpoint
that is already gone and should thus be ignored. */
- virtual bool stopped_by_hw_breakpoint ()
- TARGET_DEFAULT_RETURN (false);
- /* Returns true if the above method is supported. */
- virtual bool supports_stopped_by_hw_breakpoint ()
- TARGET_DEFAULT_RETURN (false);
-
- virtual int can_use_hw_breakpoint (enum bptype, int, int)
- TARGET_DEFAULT_RETURN (0);
- virtual int ranged_break_num_registers ()
- TARGET_DEFAULT_RETURN (-1);
- virtual int insert_hw_breakpoint (struct gdbarch *,
- struct bp_target_info *)
- TARGET_DEFAULT_RETURN (-1);
- virtual int remove_hw_breakpoint (struct gdbarch *,
- struct bp_target_info *)
- TARGET_DEFAULT_RETURN (-1);
-
- /* Documentation of what the two routines below are expected to do is
+ virtual bool stopped_by_hw_breakpoint () TARGET_DEFAULT_RETURN (false);
+ /* Returns true if the above method is supported. */
+ virtual bool supports_stopped_by_hw_breakpoint ()
+ TARGET_DEFAULT_RETURN (false);
+
+ virtual int can_use_hw_breakpoint (enum bptype, int, int)
+ TARGET_DEFAULT_RETURN (0);
+ virtual int ranged_break_num_registers () TARGET_DEFAULT_RETURN (-1);
+ virtual int insert_hw_breakpoint (struct gdbarch *, struct bp_target_info *)
+ TARGET_DEFAULT_RETURN (-1);
+ virtual int remove_hw_breakpoint (struct gdbarch *, struct bp_target_info *)
+ TARGET_DEFAULT_RETURN (-1);
+
+ /* Documentation of what the two routines below are expected to do is
provided with the corresponding target_* macros. */
- virtual int remove_watchpoint (CORE_ADDR, int,
- enum target_hw_bp_type, struct expression *)
- TARGET_DEFAULT_RETURN (-1);
- virtual int insert_watchpoint (CORE_ADDR, int,
- enum target_hw_bp_type, struct expression *)
- TARGET_DEFAULT_RETURN (-1);
-
- virtual int insert_mask_watchpoint (CORE_ADDR, CORE_ADDR,
- enum target_hw_bp_type)
- TARGET_DEFAULT_RETURN (1);
- virtual int remove_mask_watchpoint (CORE_ADDR, CORE_ADDR,
- enum target_hw_bp_type)
- TARGET_DEFAULT_RETURN (1);
- virtual bool stopped_by_watchpoint ()
- TARGET_DEFAULT_RETURN (false);
- virtual bool have_steppable_watchpoint ()
- TARGET_DEFAULT_RETURN (false);
- virtual bool stopped_data_address (CORE_ADDR *)
- TARGET_DEFAULT_RETURN (false);
- virtual bool watchpoint_addr_within_range (CORE_ADDR, CORE_ADDR, int)
- TARGET_DEFAULT_FUNC (default_watchpoint_addr_within_range);
-
- /* Documentation of this routine is provided with the corresponding
+ virtual int remove_watchpoint (CORE_ADDR, int, enum target_hw_bp_type,
+ struct expression *)
+ TARGET_DEFAULT_RETURN (-1);
+ virtual int insert_watchpoint (CORE_ADDR, int, enum target_hw_bp_type,
+ struct expression *)
+ TARGET_DEFAULT_RETURN (-1);
+
+ virtual int insert_mask_watchpoint (CORE_ADDR, CORE_ADDR,
+ enum target_hw_bp_type)
+ TARGET_DEFAULT_RETURN (1);
+ virtual int remove_mask_watchpoint (CORE_ADDR, CORE_ADDR,
+ enum target_hw_bp_type)
+ TARGET_DEFAULT_RETURN (1);
+ virtual bool stopped_by_watchpoint () TARGET_DEFAULT_RETURN (false);
+ virtual bool have_steppable_watchpoint () TARGET_DEFAULT_RETURN (false);
+ virtual bool stopped_data_address (CORE_ADDR *)
+ TARGET_DEFAULT_RETURN (false);
+ virtual bool watchpoint_addr_within_range (CORE_ADDR, CORE_ADDR, int)
+ TARGET_DEFAULT_FUNC (default_watchpoint_addr_within_range);
+
+ /* Documentation of this routine is provided with the corresponding
target_* macro. */
- virtual int region_ok_for_hw_watchpoint (CORE_ADDR, int)
- TARGET_DEFAULT_FUNC (default_region_ok_for_hw_watchpoint);
+ virtual int region_ok_for_hw_watchpoint (CORE_ADDR, int)
+ TARGET_DEFAULT_FUNC (default_region_ok_for_hw_watchpoint);
- virtual bool can_accel_watchpoint_condition (CORE_ADDR, int, int,
- struct expression *)
- TARGET_DEFAULT_RETURN (false);
- virtual int masked_watch_num_registers (CORE_ADDR, CORE_ADDR)
- TARGET_DEFAULT_RETURN (-1);
+ virtual bool can_accel_watchpoint_condition (CORE_ADDR, int, int,
+ struct expression *)
+ TARGET_DEFAULT_RETURN (false);
+ virtual int masked_watch_num_registers (CORE_ADDR, CORE_ADDR)
+ TARGET_DEFAULT_RETURN (-1);
- /* Return 1 for sure target can do single step. Return -1 for
+ /* Return 1 for sure target can do single step. Return -1 for
unknown. Return 0 for target can't do. */
- virtual int can_do_single_step ()
- TARGET_DEFAULT_RETURN (-1);
-
- virtual bool supports_terminal_ours ()
- TARGET_DEFAULT_RETURN (false);
- virtual void terminal_init ()
- TARGET_DEFAULT_IGNORE ();
- virtual void terminal_inferior ()
- TARGET_DEFAULT_IGNORE ();
- virtual void terminal_save_inferior ()
- TARGET_DEFAULT_IGNORE ();
- virtual void terminal_ours_for_output ()
- TARGET_DEFAULT_IGNORE ();
- virtual void terminal_ours ()
- TARGET_DEFAULT_IGNORE ();
- virtual void terminal_info (const char *, int)
- TARGET_DEFAULT_FUNC (default_terminal_info);
- virtual void kill ()
- TARGET_DEFAULT_NORETURN (noprocess ());
- virtual void load (const char *, int)
- TARGET_DEFAULT_NORETURN (tcomplain ());
- /* Start an inferior process and set inferior_ptid to its pid.
+ virtual int can_do_single_step () TARGET_DEFAULT_RETURN (-1);
+
+ virtual bool supports_terminal_ours () TARGET_DEFAULT_RETURN (false);
+ virtual void terminal_init () TARGET_DEFAULT_IGNORE ();
+ virtual void terminal_inferior () TARGET_DEFAULT_IGNORE ();
+ virtual void terminal_save_inferior () TARGET_DEFAULT_IGNORE ();
+ virtual void terminal_ours_for_output () TARGET_DEFAULT_IGNORE ();
+ virtual void terminal_ours () TARGET_DEFAULT_IGNORE ();
+ virtual void terminal_info (const char *, int)
+ TARGET_DEFAULT_FUNC (default_terminal_info);
+ virtual void kill () TARGET_DEFAULT_NORETURN (noprocess ());
+ virtual void load (const char *, int) TARGET_DEFAULT_NORETURN (tcomplain ());
+ /* Start an inferior process and set inferior_ptid to its pid.
EXEC_FILE is the file to run.
ALLARGS is a string containing the arguments to the program.
ENV is the environment vector to pass. Errors reported with error().
On VxWorks and various standalone systems, we ignore exec_file. */
- virtual bool can_create_inferior ();
- virtual void create_inferior (const char *, const std::string &,
- char **, int);
- virtual int insert_fork_catchpoint (int)
- TARGET_DEFAULT_RETURN (1);
- virtual int remove_fork_catchpoint (int)
- TARGET_DEFAULT_RETURN (1);
- virtual int insert_vfork_catchpoint (int)
- TARGET_DEFAULT_RETURN (1);
- virtual int remove_vfork_catchpoint (int)
- TARGET_DEFAULT_RETURN (1);
- virtual void follow_fork (inferior *, ptid_t, target_waitkind, bool, bool)
- TARGET_DEFAULT_FUNC (default_follow_fork);
- virtual int insert_exec_catchpoint (int)
- TARGET_DEFAULT_RETURN (1);
- virtual int remove_exec_catchpoint (int)
- TARGET_DEFAULT_RETURN (1);
- virtual void follow_exec (inferior *, ptid_t, const char *)
- TARGET_DEFAULT_IGNORE ();
- virtual int set_syscall_catchpoint (int, bool, int,
- gdb::array_view<const int>)
- TARGET_DEFAULT_RETURN (1);
- virtual void mourn_inferior ()
- TARGET_DEFAULT_FUNC (default_mourn_inferior);
-
- /* Note that can_run is special and can be invoked on an unpushed
+ virtual bool can_create_inferior ();
+ virtual void create_inferior (const char *, const std::string &, char **,
+ int);
+ virtual int insert_fork_catchpoint (int) TARGET_DEFAULT_RETURN (1);
+ virtual int remove_fork_catchpoint (int) TARGET_DEFAULT_RETURN (1);
+ virtual int insert_vfork_catchpoint (int) TARGET_DEFAULT_RETURN (1);
+ virtual int remove_vfork_catchpoint (int) TARGET_DEFAULT_RETURN (1);
+ virtual void follow_fork (inferior *, ptid_t, target_waitkind, bool, bool)
+ TARGET_DEFAULT_FUNC (default_follow_fork);
+ virtual int insert_exec_catchpoint (int) TARGET_DEFAULT_RETURN (1);
+ virtual int remove_exec_catchpoint (int) TARGET_DEFAULT_RETURN (1);
+ virtual void follow_exec (inferior *, ptid_t, const char *)
+ TARGET_DEFAULT_IGNORE ();
+ virtual int set_syscall_catchpoint (int, bool, int,
+ gdb::array_view<const int>)
+ TARGET_DEFAULT_RETURN (1);
+ virtual void mourn_inferior () TARGET_DEFAULT_FUNC (default_mourn_inferior);
+
+ /* Note that can_run is special and can be invoked on an unpushed
target. Targets defining this method must also define
to_can_async_p and to_supports_non_stop. */
- virtual bool can_run ();
+ virtual bool can_run ();
- /* Documentation of this routine is provided with the corresponding
+ /* Documentation of this routine is provided with the corresponding
target_* macro. */
- virtual void pass_signals (gdb::array_view<const unsigned char> TARGET_DEBUG_PRINTER (target_debug_print_signals))
- TARGET_DEFAULT_IGNORE ();
+ virtual void
+ pass_signals (gdb::array_view<const unsigned char> TARGET_DEBUG_PRINTER (
+ target_debug_print_signals)) TARGET_DEFAULT_IGNORE ();
- /* Documentation of this routine is provided with the
+ /* Documentation of this routine is provided with the
corresponding target_* function. */
- virtual void program_signals (gdb::array_view<const unsigned char> TARGET_DEBUG_PRINTER (target_debug_print_signals))
- TARGET_DEFAULT_IGNORE ();
-
- virtual bool thread_alive (ptid_t ptid)
- TARGET_DEFAULT_RETURN (false);
- virtual void update_thread_list ()
- TARGET_DEFAULT_IGNORE ();
- virtual std::string pid_to_str (ptid_t)
- TARGET_DEFAULT_FUNC (default_pid_to_str);
- virtual const char *extra_thread_info (thread_info *)
- TARGET_DEFAULT_RETURN (NULL);
- virtual const char *thread_name (thread_info *)
- TARGET_DEFAULT_RETURN (NULL);
- virtual thread_info *thread_handle_to_thread_info (const gdb_byte *,
- int,
- inferior *inf)
- TARGET_DEFAULT_RETURN (NULL);
- /* See target_thread_info_to_thread_handle. */
- virtual gdb::byte_vector thread_info_to_thread_handle (struct thread_info *)
- TARGET_DEFAULT_RETURN (gdb::byte_vector ());
- virtual void stop (ptid_t)
- TARGET_DEFAULT_IGNORE ();
- virtual void interrupt ()
- TARGET_DEFAULT_IGNORE ();
- virtual void pass_ctrlc ()
- TARGET_DEFAULT_FUNC (default_target_pass_ctrlc);
- virtual void rcmd (const char *command, struct ui_file *output)
- TARGET_DEFAULT_FUNC (default_rcmd);
- virtual const char *pid_to_exec_file (int pid)
- TARGET_DEFAULT_RETURN (NULL);
- virtual void log_command (const char *)
- TARGET_DEFAULT_IGNORE ();
- virtual const target_section_table *get_section_table ()
- TARGET_DEFAULT_RETURN (default_get_section_table ());
-
- /* Provide default values for all "must have" methods. */
- virtual bool has_all_memory () { return false; }
- virtual bool has_memory () { return false; }
- virtual bool has_stack () { return false; }
- virtual bool has_registers () { return false; }
- virtual bool has_execution (inferior *inf) { return false; }
-
- /* Control thread execution. */
- virtual thread_control_capabilities get_thread_control_capabilities ()
- TARGET_DEFAULT_RETURN (tc_none);
- virtual bool attach_no_wait ()
- TARGET_DEFAULT_RETURN (0);
- /* This method must be implemented in some situations. See the
+ virtual void
+ program_signals (gdb::array_view<const unsigned char> TARGET_DEBUG_PRINTER (
+ target_debug_print_signals)) TARGET_DEFAULT_IGNORE ();
+
+ virtual bool thread_alive (ptid_t ptid) TARGET_DEFAULT_RETURN (false);
+ virtual void update_thread_list () TARGET_DEFAULT_IGNORE ();
+ virtual std::string pid_to_str (ptid_t)
+ TARGET_DEFAULT_FUNC (default_pid_to_str);
+ virtual const char *extra_thread_info (thread_info *)
+ TARGET_DEFAULT_RETURN (NULL);
+ virtual const char *thread_name (thread_info *) TARGET_DEFAULT_RETURN (NULL);
+ virtual thread_info *thread_handle_to_thread_info (const gdb_byte *, int,
+ inferior *inf)
+ TARGET_DEFAULT_RETURN (NULL);
+ /* See target_thread_info_to_thread_handle. */
+ virtual gdb::byte_vector thread_info_to_thread_handle (struct thread_info *)
+ TARGET_DEFAULT_RETURN (gdb::byte_vector ());
+ virtual void stop (ptid_t) TARGET_DEFAULT_IGNORE ();
+ virtual void interrupt () TARGET_DEFAULT_IGNORE ();
+ virtual void pass_ctrlc () TARGET_DEFAULT_FUNC (default_target_pass_ctrlc);
+ virtual void rcmd (const char *command, struct ui_file *output)
+ TARGET_DEFAULT_FUNC (default_rcmd);
+ virtual const char *pid_to_exec_file (int pid) TARGET_DEFAULT_RETURN (NULL);
+ virtual void log_command (const char *) TARGET_DEFAULT_IGNORE ();
+ virtual const target_section_table *get_section_table ()
+ TARGET_DEFAULT_RETURN (default_get_section_table ());
+
+ /* Provide default values for all "must have" methods. */
+ virtual bool has_all_memory () { return false; }
+
+ virtual bool has_memory () { return false; }
+
+ virtual bool has_stack () { return false; }
+
+ virtual bool has_registers () { return false; }
+
+ virtual bool has_execution (inferior *inf) { return false; }
+
+ /* Control thread execution. */
+ virtual thread_control_capabilities get_thread_control_capabilities ()
+ TARGET_DEFAULT_RETURN (tc_none);
+ virtual bool attach_no_wait () TARGET_DEFAULT_RETURN (0);
+ /* This method must be implemented in some situations. See the
comment on 'can_run'. */
- virtual bool can_async_p ()
- TARGET_DEFAULT_RETURN (false);
- virtual bool is_async_p ()
- TARGET_DEFAULT_RETURN (false);
- virtual void async (bool)
- TARGET_DEFAULT_NORETURN (tcomplain ());
- virtual int async_wait_fd ()
- TARGET_DEFAULT_NORETURN (noprocess ());
- /* Return true if the target has pending events to report to the
+ virtual bool can_async_p () TARGET_DEFAULT_RETURN (false);
+ virtual bool is_async_p () TARGET_DEFAULT_RETURN (false);
+ virtual void async (bool) TARGET_DEFAULT_NORETURN (tcomplain ());
+ virtual int async_wait_fd () TARGET_DEFAULT_NORETURN (noprocess ());
+ /* Return true if the target has pending events to report to the
core. If true, then GDB avoids resuming the target until all
pending events are consumed, so that multiple resumptions can
be coalesced as an optimization. Most targets can't tell
whether they have pending events without calling target_wait,
so we default to returning false. The only downside is that a
potential optimization is missed. */
- virtual bool has_pending_events ()
- TARGET_DEFAULT_RETURN (false);
- virtual void thread_events (int)
- TARGET_DEFAULT_IGNORE ();
- /* This method must be implemented in some situations. See the
+ virtual bool has_pending_events () TARGET_DEFAULT_RETURN (false);
+ virtual void thread_events (int) TARGET_DEFAULT_IGNORE ();
+ /* This method must be implemented in some situations. See the
comment on 'can_run'. */
- virtual bool supports_non_stop ()
- TARGET_DEFAULT_RETURN (false);
- /* Return true if the target operates in non-stop mode even with
+ virtual bool supports_non_stop () TARGET_DEFAULT_RETURN (false);
+ /* Return true if the target operates in non-stop mode even with
"set non-stop off". */
- virtual bool always_non_stop_p ()
- TARGET_DEFAULT_RETURN (false);
- /* find_memory_regions support method for gcore */
- virtual int find_memory_regions (find_memory_region_ftype func, void *data)
- TARGET_DEFAULT_FUNC (dummy_find_memory_regions);
- /* make_corefile_notes support method for gcore */
- virtual gdb::unique_xmalloc_ptr<char> make_corefile_notes (bfd *, int *)
- TARGET_DEFAULT_FUNC (dummy_make_corefile_notes);
- /* get_bookmark support method for bookmarks */
- virtual gdb_byte *get_bookmark (const char *, int)
- TARGET_DEFAULT_NORETURN (tcomplain ());
- /* goto_bookmark support method for bookmarks */
- virtual void goto_bookmark (const gdb_byte *, int)
- TARGET_DEFAULT_NORETURN (tcomplain ());
- /* Return the thread-local address at OFFSET in the
+ virtual bool always_non_stop_p () TARGET_DEFAULT_RETURN (false);
+ /* find_memory_regions support method for gcore */
+ virtual int find_memory_regions (find_memory_region_ftype func, void *data)
+ TARGET_DEFAULT_FUNC (dummy_find_memory_regions);
+ /* make_corefile_notes support method for gcore */
+ virtual gdb::unique_xmalloc_ptr<char> make_corefile_notes (bfd *, int *)
+ TARGET_DEFAULT_FUNC (dummy_make_corefile_notes);
+ /* get_bookmark support method for bookmarks */
+ virtual gdb_byte *get_bookmark (const char *, int)
+ TARGET_DEFAULT_NORETURN (tcomplain ());
+ /* goto_bookmark support method for bookmarks */
+ virtual void goto_bookmark (const gdb_byte *, int)
+ TARGET_DEFAULT_NORETURN (tcomplain ());
+ /* Return the thread-local address at OFFSET in the
thread-local storage for the thread PTID and the shared library
or executable file given by LOAD_MODULE_ADDR. If that block of
thread-local storage hasn't been allocated yet, this function
may throw an error. LOAD_MODULE_ADDR may be zero for statically
linked multithreaded inferiors. */
- virtual CORE_ADDR get_thread_local_address (ptid_t ptid,
- CORE_ADDR load_module_addr,
- CORE_ADDR offset)
- TARGET_DEFAULT_NORETURN (generic_tls_error ());
+ virtual CORE_ADDR get_thread_local_address (ptid_t ptid,
+ CORE_ADDR load_module_addr,
+ CORE_ADDR offset)
+ TARGET_DEFAULT_NORETURN (generic_tls_error ());
- /* Request that OPS transfer up to LEN addressable units of the target's
+ /* Request that OPS transfer up to LEN addressable units of the target's
OBJECT. When reading from a memory object, the size of an addressable
unit is architecture dependent and can be found using
gdbarch_addressable_memory_unit_size. Otherwise, an addressable unit is
@@ -792,21 +745,19 @@ struct target_ops
See target_read and target_write for more information. One,
and only one, of readbuf or writebuf must be non-NULL. */
- virtual enum target_xfer_status xfer_partial (enum target_object object,
- const char *annex,
- gdb_byte *readbuf,
- const gdb_byte *writebuf,
- ULONGEST offset, ULONGEST len,
- ULONGEST *xfered_len)
- TARGET_DEFAULT_RETURN (TARGET_XFER_E_IO);
+ virtual enum target_xfer_status
+ xfer_partial (enum target_object object, const char *annex,
+ gdb_byte *readbuf, const gdb_byte *writebuf, ULONGEST offset,
+ ULONGEST len, ULONGEST *xfered_len)
+ TARGET_DEFAULT_RETURN (TARGET_XFER_E_IO);
- /* Return the limit on the size of any single memory transfer
+ /* Return the limit on the size of any single memory transfer
for the target. */
- virtual ULONGEST get_memory_xfer_limit ()
- TARGET_DEFAULT_RETURN (ULONGEST_MAX);
+ virtual ULONGEST get_memory_xfer_limit ()
+ TARGET_DEFAULT_RETURN (ULONGEST_MAX);
- /* Returns the memory map for the target. A return value of NULL
+ /* Returns the memory map for the target. A return value of NULL
means that no memory map is available. If a memory address
does not fall within any returned regions, it's assumed to be
RAM. The returned memory regions should not overlap.
@@ -819,25 +770,24 @@ struct target_ops
This method should not cache data; if the memory map could
change unexpectedly, it should be invalidated, and higher
layers will re-fetch it. */
- virtual std::vector<mem_region> memory_map ()
- TARGET_DEFAULT_RETURN (std::vector<mem_region> ());
+ virtual std::vector<mem_region> memory_map ()
+ TARGET_DEFAULT_RETURN (std::vector<mem_region> ());
- /* Erases the region of flash memory starting at ADDRESS, of
+ /* Erases the region of flash memory starting at ADDRESS, of
length LENGTH.
Precondition: both ADDRESS and ADDRESS+LENGTH should be aligned
on flash block boundaries, as reported by 'to_memory_map'. */
- virtual void flash_erase (ULONGEST address, LONGEST length)
- TARGET_DEFAULT_NORETURN (tcomplain ());
+ virtual void flash_erase (ULONGEST address, LONGEST length)
+ TARGET_DEFAULT_NORETURN (tcomplain ());
- /* Finishes a flash memory write sequence. After this operation
+ /* Finishes a flash memory write sequence. After this operation
all flash memory should be available for writing and the result
of reading from areas written by 'to_flash_write' should be
equal to what was written. */
- virtual void flash_done ()
- TARGET_DEFAULT_NORETURN (tcomplain ());
+ virtual void flash_done () TARGET_DEFAULT_NORETURN (tcomplain ());
- /* Describe the architecture-specific features of the current
+ /* Describe the architecture-specific features of the current
inferior.
Returns the description found, or nullptr if no description was
@@ -848,453 +798,424 @@ struct target_ops
accurately describe all threads. In this case, the
thread_architecture method can be used to obtain gdbarches that
accurately describe each thread. */
- virtual const struct target_desc *read_description ()
- TARGET_DEFAULT_RETURN (NULL);
+ virtual const struct target_desc *read_description ()
+ TARGET_DEFAULT_RETURN (NULL);
- /* Build the PTID of the thread on which a given task is running,
+ /* Build the PTID of the thread on which a given task is running,
based on LWP and THREAD. These values are extracted from the
task Private_Data section of the Ada Task Control Block, and
their interpretation depends on the target. */
- virtual ptid_t get_ada_task_ptid (long lwp, ULONGEST thread)
- TARGET_DEFAULT_FUNC (default_get_ada_task_ptid);
+ virtual ptid_t get_ada_task_ptid (long lwp, ULONGEST thread)
+ TARGET_DEFAULT_FUNC (default_get_ada_task_ptid);
- /* Read one auxv entry from *READPTR, not reading locations >= ENDPTR.
+ /* Read one auxv entry from *READPTR, not reading locations >= ENDPTR.
Return 0 if *READPTR is already at the end of the buffer.
Return -1 if there is insufficient buffer for a whole entry.
Return 1 if an entry was read into *TYPEP and *VALP. */
- virtual int auxv_parse (const gdb_byte **readptr,
- const gdb_byte *endptr, CORE_ADDR *typep, CORE_ADDR *valp)
- TARGET_DEFAULT_FUNC (default_auxv_parse);
+ virtual int auxv_parse (const gdb_byte **readptr, const gdb_byte *endptr,
+ CORE_ADDR *typep, CORE_ADDR *valp)
+ TARGET_DEFAULT_FUNC (default_auxv_parse);
- /* Search SEARCH_SPACE_LEN bytes beginning at START_ADDR for the
+ /* Search SEARCH_SPACE_LEN bytes beginning at START_ADDR for the
sequence of bytes in PATTERN with length PATTERN_LEN.
The result is 1 if found, 0 if not found, and -1 if there was an error
requiring halting of the search (e.g. memory read error).
If the pattern is found the address is recorded in FOUND_ADDRP. */
- virtual int search_memory (CORE_ADDR start_addr, ULONGEST search_space_len,
- const gdb_byte *pattern, ULONGEST pattern_len,
- CORE_ADDR *found_addrp)
- TARGET_DEFAULT_FUNC (default_search_memory);
+ virtual int search_memory (CORE_ADDR start_addr, ULONGEST search_space_len,
+ const gdb_byte *pattern, ULONGEST pattern_len,
+ CORE_ADDR *found_addrp)
+ TARGET_DEFAULT_FUNC (default_search_memory);
- /* Can target execute in reverse? */
- virtual bool can_execute_reverse ()
- TARGET_DEFAULT_RETURN (false);
+ /* Can target execute in reverse? */
+ virtual bool can_execute_reverse () TARGET_DEFAULT_RETURN (false);
- /* The direction the target is currently executing. Must be
+ /* The direction the target is currently executing. Must be
implemented on targets that support reverse execution and async
mode. The default simply returns forward execution. */
- virtual enum exec_direction_kind execution_direction ()
- TARGET_DEFAULT_FUNC (default_execution_direction);
+ virtual enum exec_direction_kind execution_direction ()
+ TARGET_DEFAULT_FUNC (default_execution_direction);
- /* Does this target support debugging multiple processes
+ /* Does this target support debugging multiple processes
simultaneously? */
- virtual bool supports_multi_process ()
- TARGET_DEFAULT_RETURN (false);
+ virtual bool supports_multi_process () TARGET_DEFAULT_RETURN (false);
- /* Does this target support enabling and disabling tracepoints while a trace
+ /* Does this target support enabling and disabling tracepoints while a trace
experiment is running? */
- virtual bool supports_enable_disable_tracepoint ()
- TARGET_DEFAULT_RETURN (false);
+ virtual bool supports_enable_disable_tracepoint ()
+ TARGET_DEFAULT_RETURN (false);
- /* Does this target support disabling address space randomization? */
- virtual bool supports_disable_randomization ()
- TARGET_DEFAULT_FUNC (find_default_supports_disable_randomization);
+ /* Does this target support disabling address space randomization? */
+ virtual bool supports_disable_randomization ()
+ TARGET_DEFAULT_FUNC (find_default_supports_disable_randomization);
- /* Does this target support the tracenz bytecode for string collection? */
- virtual bool supports_string_tracing ()
- TARGET_DEFAULT_RETURN (false);
+ /* Does this target support the tracenz bytecode for string collection? */
+ virtual bool supports_string_tracing () TARGET_DEFAULT_RETURN (false);
- /* Does this target support evaluation of breakpoint conditions on its
+ /* Does this target support evaluation of breakpoint conditions on its
end? */
- virtual bool supports_evaluation_of_breakpoint_conditions ()
- TARGET_DEFAULT_RETURN (false);
+ virtual bool supports_evaluation_of_breakpoint_conditions ()
+ TARGET_DEFAULT_RETURN (false);
- /* Does this target support native dumpcore API? */
- virtual bool supports_dumpcore ()
- TARGET_DEFAULT_RETURN (false);
+ /* Does this target support native dumpcore API? */
+ virtual bool supports_dumpcore () TARGET_DEFAULT_RETURN (false);
- /* Generate the core file with native target API. */
- virtual void dumpcore (const char *filename)
- TARGET_DEFAULT_IGNORE ();
+ /* Generate the core file with native target API. */
+ virtual void dumpcore (const char *filename) TARGET_DEFAULT_IGNORE ();
- /* Does this target support evaluation of breakpoint commands on its
+ /* Does this target support evaluation of breakpoint commands on its
end? */
- virtual bool can_run_breakpoint_commands ()
- TARGET_DEFAULT_RETURN (false);
+ virtual bool can_run_breakpoint_commands () TARGET_DEFAULT_RETURN (false);
- /* Determine current architecture of thread PTID.
+ /* Determine current architecture of thread PTID.
The target is supposed to determine the architecture of the code where
the target is currently stopped at. The architecture information is
used to perform decr_pc_after_break adjustment, and also to determine
the frame architecture of the innermost frame. ptrace operations need to
operate according to target_gdbarch (). */
- virtual struct gdbarch *thread_architecture (ptid_t)
- TARGET_DEFAULT_RETURN (NULL);
+ virtual struct gdbarch *thread_architecture (ptid_t)
+ TARGET_DEFAULT_RETURN (NULL);
- /* Determine current address space of thread PTID. */
- virtual struct address_space *thread_address_space (ptid_t)
- TARGET_DEFAULT_RETURN (NULL);
+ /* Determine current address space of thread PTID. */
+ virtual struct address_space *thread_address_space (ptid_t)
+ TARGET_DEFAULT_RETURN (NULL);
- /* Target file operations. */
+ /* Target file operations. */
- /* Return true if the filesystem seen by the current inferior
+ /* Return true if the filesystem seen by the current inferior
is the local filesystem, false otherwise. */
- virtual bool filesystem_is_local ()
- TARGET_DEFAULT_RETURN (true);
+ virtual bool filesystem_is_local () TARGET_DEFAULT_RETURN (true);
- /* Open FILENAME on the target, in the filesystem as seen by INF,
+ /* Open FILENAME on the target, in the filesystem as seen by INF,
using FLAGS and MODE. If INF is NULL, use the filesystem seen
by the debugger (GDB or, for remote targets, the remote stub).
If WARN_IF_SLOW is nonzero, print a warning message if the file
is being accessed over a link that may be slow. Return a
target file descriptor, or -1 if an error occurs (and set
*TARGET_ERRNO). */
- virtual int fileio_open (struct inferior *inf, const char *filename,
- int flags, int mode, int warn_if_slow,
- fileio_error *target_errno);
+ virtual int fileio_open (struct inferior *inf, const char *filename,
+ int flags, int mode, int warn_if_slow,
+ fileio_error *target_errno);
- /* Write up to LEN bytes from WRITE_BUF to FD on the target.
+ /* Write up to LEN bytes from WRITE_BUF to FD on the target.
Return the number of bytes written, or -1 if an error occurs
(and set *TARGET_ERRNO). */
- virtual int fileio_pwrite (int fd, const gdb_byte *write_buf, int len,
- ULONGEST offset, fileio_error *target_errno);
+ virtual int fileio_pwrite (int fd, const gdb_byte *write_buf, int len,
+ ULONGEST offset, fileio_error *target_errno);
- /* Read up to LEN bytes FD on the target into READ_BUF.
+ /* Read up to LEN bytes FD on the target into READ_BUF.
Return the number of bytes read, or -1 if an error occurs
(and set *TARGET_ERRNO). */
- virtual int fileio_pread (int fd, gdb_byte *read_buf, int len,
- ULONGEST offset, fileio_error *target_errno);
+ virtual int fileio_pread (int fd, gdb_byte *read_buf, int len,
+ ULONGEST offset, fileio_error *target_errno);
- /* Get information about the file opened as FD and put it in
+ /* Get information about the file opened as FD and put it in
SB. Return 0 on success, or -1 if an error occurs (and set
*TARGET_ERRNO). */
- virtual int fileio_fstat (int fd, struct stat *sb, fileio_error *target_errno);
+ virtual int fileio_fstat (int fd, struct stat *sb,
+ fileio_error *target_errno);
- /* Close FD on the target. Return 0, or -1 if an error occurs
+ /* Close FD on the target. Return 0, or -1 if an error occurs
(and set *TARGET_ERRNO). */
- virtual int fileio_close (int fd, fileio_error *target_errno);
+ virtual int fileio_close (int fd, fileio_error *target_errno);
- /* Unlink FILENAME on the target, in the filesystem as seen by
+ /* Unlink FILENAME on the target, in the filesystem as seen by
INF. If INF is NULL, use the filesystem seen by the debugger
(GDB or, for remote targets, the remote stub). Return 0, or
-1 if an error occurs (and set *TARGET_ERRNO). */
- virtual int fileio_unlink (struct inferior *inf,
- const char *filename,
- fileio_error *target_errno);
+ virtual int fileio_unlink (struct inferior *inf, const char *filename,
+ fileio_error *target_errno);
- /* Read value of symbolic link FILENAME on the target, in the
+ /* Read value of symbolic link FILENAME on the target, in the
filesystem as seen by INF. If INF is NULL, use the filesystem
seen by the debugger (GDB or, for remote targets, the remote
stub). Return a string, or an empty optional if an error
occurs (and set *TARGET_ERRNO). */
- virtual gdb::optional<std::string> fileio_readlink (struct inferior *inf,
- const char *filename,
- fileio_error *target_errno);
+ virtual gdb::optional<std::string>
+ fileio_readlink (struct inferior *inf, const char *filename,
+ fileio_error *target_errno);
- /* Implement the "info proc" command. Returns true if the target
+ /* Implement the "info proc" command. Returns true if the target
actually implemented the command, false otherwise. */
- virtual bool info_proc (const char *, enum info_proc_what);
+ virtual bool info_proc (const char *, enum info_proc_what);
- /* Tracepoint-related operations. */
+ /* Tracepoint-related operations. */
- /* Prepare the target for a tracing run. */
- virtual void trace_init ()
- TARGET_DEFAULT_NORETURN (tcomplain ());
+ /* Prepare the target for a tracing run. */
+ virtual void trace_init () TARGET_DEFAULT_NORETURN (tcomplain ());
- /* Send full details of a tracepoint location to the target. */
- virtual void download_tracepoint (struct bp_location *location)
- TARGET_DEFAULT_NORETURN (tcomplain ());
+ /* Send full details of a tracepoint location to the target. */
+ virtual void download_tracepoint (struct bp_location *location)
+ TARGET_DEFAULT_NORETURN (tcomplain ());
- /* Is the target able to download tracepoint locations in current
+ /* Is the target able to download tracepoint locations in current
state? */
- virtual bool can_download_tracepoint ()
- TARGET_DEFAULT_RETURN (false);
+ virtual bool can_download_tracepoint () TARGET_DEFAULT_RETURN (false);
- /* Send full details of a trace state variable to the target. */
- virtual void download_trace_state_variable (const trace_state_variable &tsv)
- TARGET_DEFAULT_NORETURN (tcomplain ());
+ /* Send full details of a trace state variable to the target. */
+ virtual void download_trace_state_variable (const trace_state_variable &tsv)
+ TARGET_DEFAULT_NORETURN (tcomplain ());
- /* Enable a tracepoint on the target. */
- virtual void enable_tracepoint (struct bp_location *location)
- TARGET_DEFAULT_NORETURN (tcomplain ());
+ /* Enable a tracepoint on the target. */
+ virtual void enable_tracepoint (struct bp_location *location)
+ TARGET_DEFAULT_NORETURN (tcomplain ());
- /* Disable a tracepoint on the target. */
- virtual void disable_tracepoint (struct bp_location *location)
- TARGET_DEFAULT_NORETURN (tcomplain ());
+ /* Disable a tracepoint on the target. */
+ virtual void disable_tracepoint (struct bp_location *location)
+ TARGET_DEFAULT_NORETURN (tcomplain ());
- /* Inform the target info of memory regions that are readonly
+ /* Inform the target info of memory regions that are readonly
(such as text sections), and so it should return data from
those rather than look in the trace buffer. */
- virtual void trace_set_readonly_regions ()
- TARGET_DEFAULT_NORETURN (tcomplain ());
+ virtual void trace_set_readonly_regions ()
+ TARGET_DEFAULT_NORETURN (tcomplain ());
- /* Start a trace run. */
- virtual void trace_start ()
- TARGET_DEFAULT_NORETURN (tcomplain ());
+ /* Start a trace run. */
+ virtual void trace_start () TARGET_DEFAULT_NORETURN (tcomplain ());
- /* Get the current status of a tracing run. */
- virtual int get_trace_status (struct trace_status *ts)
- TARGET_DEFAULT_RETURN (-1);
+ /* Get the current status of a tracing run. */
+ virtual int get_trace_status (struct trace_status *ts)
+ TARGET_DEFAULT_RETURN (-1);
- virtual void get_tracepoint_status (struct breakpoint *tp,
- struct uploaded_tp *utp)
- TARGET_DEFAULT_NORETURN (tcomplain ());
+ virtual void get_tracepoint_status (struct breakpoint *tp,
+ struct uploaded_tp *utp)
+ TARGET_DEFAULT_NORETURN (tcomplain ());
- /* Stop a trace run. */
- virtual void trace_stop ()
- TARGET_DEFAULT_NORETURN (tcomplain ());
+ /* Stop a trace run. */
+ virtual void trace_stop () TARGET_DEFAULT_NORETURN (tcomplain ());
- /* Ask the target to find a trace frame of the given type TYPE,
+ /* Ask the target to find a trace frame of the given type TYPE,
using NUM, ADDR1, and ADDR2 as search parameters. Returns the
number of the trace frame, and also the tracepoint number at
TPP. If no trace frame matches, return -1. May throw if the
operation fails. */
- virtual int trace_find (enum trace_find_type type, int num,
- CORE_ADDR addr1, CORE_ADDR addr2, int *tpp)
- TARGET_DEFAULT_RETURN (-1);
+ virtual int trace_find (enum trace_find_type type, int num, CORE_ADDR addr1,
+ CORE_ADDR addr2, int *tpp)
+ TARGET_DEFAULT_RETURN (-1);
- /* Get the value of the trace state variable number TSV, returning
+ /* Get the value of the trace state variable number TSV, returning
1 if the value is known and writing the value itself into the
location pointed to by VAL, else returning 0. */
- virtual bool get_trace_state_variable_value (int tsv, LONGEST *val)
- TARGET_DEFAULT_RETURN (false);
+ virtual bool get_trace_state_variable_value (int tsv, LONGEST *val)
+ TARGET_DEFAULT_RETURN (false);
- virtual int save_trace_data (const char *filename)
- TARGET_DEFAULT_NORETURN (tcomplain ());
+ virtual int save_trace_data (const char *filename)
+ TARGET_DEFAULT_NORETURN (tcomplain ());
- virtual int upload_tracepoints (struct uploaded_tp **utpp)
- TARGET_DEFAULT_RETURN (0);
+ virtual int upload_tracepoints (struct uploaded_tp **utpp)
+ TARGET_DEFAULT_RETURN (0);
- virtual int upload_trace_state_variables (struct uploaded_tsv **utsvp)
- TARGET_DEFAULT_RETURN (0);
+ virtual int upload_trace_state_variables (struct uploaded_tsv **utsvp)
+ TARGET_DEFAULT_RETURN (0);
- virtual LONGEST get_raw_trace_data (gdb_byte *buf,
- ULONGEST offset, LONGEST len)
- TARGET_DEFAULT_NORETURN (tcomplain ());
+ virtual LONGEST get_raw_trace_data (gdb_byte *buf, ULONGEST offset,
+ LONGEST len)
+ TARGET_DEFAULT_NORETURN (tcomplain ());
- /* Get the minimum length of instruction on which a fast tracepoint
+ /* Get the minimum length of instruction on which a fast tracepoint
may be set on the target. If this operation is unsupported,
return -1. If for some reason the minimum length cannot be
determined, return 0. */
- virtual int get_min_fast_tracepoint_insn_len ()
- TARGET_DEFAULT_RETURN (-1);
+ virtual int get_min_fast_tracepoint_insn_len () TARGET_DEFAULT_RETURN (-1);
- /* Set the target's tracing behavior in response to unexpected
+ /* Set the target's tracing behavior in response to unexpected
disconnection - set VAL to 1 to keep tracing, 0 to stop. */
- virtual void set_disconnected_tracing (int val)
- TARGET_DEFAULT_IGNORE ();
- virtual void set_circular_trace_buffer (int val)
- TARGET_DEFAULT_IGNORE ();
- /* Set the size of trace buffer in the target. */
- virtual void set_trace_buffer_size (LONGEST val)
- TARGET_DEFAULT_IGNORE ();
-
- /* Add/change textual notes about the trace run, returning true if
+ virtual void set_disconnected_tracing (int val) TARGET_DEFAULT_IGNORE ();
+ virtual void set_circular_trace_buffer (int val) TARGET_DEFAULT_IGNORE ();
+ /* Set the size of trace buffer in the target. */
+ virtual void set_trace_buffer_size (LONGEST val) TARGET_DEFAULT_IGNORE ();
+
+ /* Add/change textual notes about the trace run, returning true if
successful, false otherwise. */
- virtual bool set_trace_notes (const char *user, const char *notes,
- const char *stopnotes)
- TARGET_DEFAULT_RETURN (false);
+ virtual bool set_trace_notes (const char *user, const char *notes,
+ const char *stopnotes)
+ TARGET_DEFAULT_RETURN (false);
- /* Return the processor core that thread PTID was last seen on.
+ /* Return the processor core that thread PTID was last seen on.
This information is updated only when:
- update_thread_list is called
- thread stops
If the core cannot be determined -- either for the specified
thread, or right now, or in this debug session, or for this
target -- return -1. */
- virtual int core_of_thread (ptid_t ptid)
- TARGET_DEFAULT_RETURN (-1);
+ virtual int core_of_thread (ptid_t ptid) TARGET_DEFAULT_RETURN (-1);
- /* Verify that the memory in the [MEMADDR, MEMADDR+SIZE) range
+ /* Verify that the memory in the [MEMADDR, MEMADDR+SIZE) range
matches the contents of [DATA,DATA+SIZE). Returns 1 if there's
a match, 0 if there's a mismatch, and -1 if an error is
encountered while reading memory. */
- virtual int verify_memory (const gdb_byte *data,
- CORE_ADDR memaddr, ULONGEST size)
- TARGET_DEFAULT_FUNC (default_verify_memory);
+ virtual int verify_memory (const gdb_byte *data, CORE_ADDR memaddr,
+ ULONGEST size)
+ TARGET_DEFAULT_FUNC (default_verify_memory);
- /* Return the address of the start of the Thread Information Block
+ /* Return the address of the start of the Thread Information Block
a Windows OS specific feature. */
- virtual bool get_tib_address (ptid_t ptid, CORE_ADDR *addr)
- TARGET_DEFAULT_NORETURN (tcomplain ());
+ virtual bool get_tib_address (ptid_t ptid, CORE_ADDR *addr)
+ TARGET_DEFAULT_NORETURN (tcomplain ());
- /* Send the new settings of write permission variables. */
- virtual void set_permissions ()
- TARGET_DEFAULT_IGNORE ();
+ /* Send the new settings of write permission variables. */
+ virtual void set_permissions () TARGET_DEFAULT_IGNORE ();
- /* Look for a static tracepoint marker at ADDR, and fill in MARKER
+ /* Look for a static tracepoint marker at ADDR, and fill in MARKER
with its details. Return true on success, false on failure. */
- virtual bool static_tracepoint_marker_at (CORE_ADDR,
- static_tracepoint_marker *marker)
- TARGET_DEFAULT_RETURN (false);
+ virtual bool static_tracepoint_marker_at (CORE_ADDR,
+ static_tracepoint_marker *marker)
+ TARGET_DEFAULT_RETURN (false);
- /* Return a vector of all tracepoints markers string id ID, or all
+ /* Return a vector of all tracepoints markers string id ID, or all
markers if ID is NULL. */
- virtual std::vector<static_tracepoint_marker>
- static_tracepoint_markers_by_strid (const char *id)
- TARGET_DEFAULT_NORETURN (tcomplain ());
+ virtual std::vector<static_tracepoint_marker>
+ static_tracepoint_markers_by_strid (const char *id)
+ TARGET_DEFAULT_NORETURN (tcomplain ());
- /* Return a traceframe info object describing the current
+ /* Return a traceframe info object describing the current
traceframe's contents. This method should not cache data;
higher layers take care of caching, invalidating, and
re-fetching when necessary. */
- virtual traceframe_info_up traceframe_info ()
- TARGET_DEFAULT_NORETURN (tcomplain ());
+ virtual traceframe_info_up traceframe_info ()
+ TARGET_DEFAULT_NORETURN (tcomplain ());
- /* Ask the target to use or not to use agent according to USE.
+ /* Ask the target to use or not to use agent according to USE.
Return true if successful, false otherwise. */
- virtual bool use_agent (bool use)
- TARGET_DEFAULT_NORETURN (tcomplain ());
+ virtual bool use_agent (bool use) TARGET_DEFAULT_NORETURN (tcomplain ());
- /* Is the target able to use agent in current state? */
- virtual bool can_use_agent ()
- TARGET_DEFAULT_RETURN (false);
+ /* Is the target able to use agent in current state? */
+ virtual bool can_use_agent () TARGET_DEFAULT_RETURN (false);
- /* Enable branch tracing for TP using CONF configuration.
+ /* Enable branch tracing for TP using CONF configuration.
Return a branch trace target information struct for reading and for
disabling branch trace. */
- virtual struct btrace_target_info *enable_btrace (thread_info *tp,
- const struct btrace_config *conf)
- TARGET_DEFAULT_NORETURN (tcomplain ());
+ virtual struct btrace_target_info *
+ enable_btrace (thread_info *tp, const struct btrace_config *conf)
+ TARGET_DEFAULT_NORETURN (tcomplain ());
- /* Disable branch tracing and deallocate TINFO. */
- virtual void disable_btrace (struct btrace_target_info *tinfo)
- TARGET_DEFAULT_NORETURN (tcomplain ());
+ /* Disable branch tracing and deallocate TINFO. */
+ virtual void disable_btrace (struct btrace_target_info *tinfo)
+ TARGET_DEFAULT_NORETURN (tcomplain ());
- /* Disable branch tracing and deallocate TINFO. This function is similar
+ /* Disable branch tracing and deallocate TINFO. This function is similar
to to_disable_btrace, except that it is called during teardown and is
only allowed to perform actions that are safe. A counter-example would
be attempting to talk to a remote target. */
- virtual void teardown_btrace (struct btrace_target_info *tinfo)
- TARGET_DEFAULT_NORETURN (tcomplain ());
+ virtual void teardown_btrace (struct btrace_target_info *tinfo)
+ TARGET_DEFAULT_NORETURN (tcomplain ());
- /* Read branch trace data for the thread indicated by BTINFO into DATA.
+ /* Read branch trace data for the thread indicated by BTINFO into DATA.
DATA is cleared before new trace is added. */
- virtual enum btrace_error read_btrace (struct btrace_data *data,
- struct btrace_target_info *btinfo,
- enum btrace_read_type type)
- TARGET_DEFAULT_NORETURN (tcomplain ());
+ virtual enum btrace_error read_btrace (struct btrace_data *data,
+ struct btrace_target_info *btinfo,
+ enum btrace_read_type type)
+ TARGET_DEFAULT_NORETURN (tcomplain ());
- /* Get the branch trace configuration. */
- virtual const struct btrace_config *btrace_conf (const struct btrace_target_info *)
- TARGET_DEFAULT_RETURN (NULL);
+ /* Get the branch trace configuration. */
+ virtual const struct btrace_config *
+ btrace_conf (const struct btrace_target_info *) TARGET_DEFAULT_RETURN (NULL);
- /* Current recording method. */
- virtual enum record_method record_method (ptid_t ptid)
- TARGET_DEFAULT_RETURN (RECORD_METHOD_NONE);
+ /* Current recording method. */
+ virtual enum record_method record_method (ptid_t ptid)
+ TARGET_DEFAULT_RETURN (RECORD_METHOD_NONE);
- /* Stop trace recording. */
- virtual void stop_recording ()
- TARGET_DEFAULT_IGNORE ();
+ /* Stop trace recording. */
+ virtual void stop_recording () TARGET_DEFAULT_IGNORE ();
- /* Print information about the recording. */
- virtual void info_record ()
- TARGET_DEFAULT_IGNORE ();
+ /* Print information about the recording. */
+ virtual void info_record () TARGET_DEFAULT_IGNORE ();
- /* Save the recorded execution trace into a file. */
- virtual void save_record (const char *filename)
- TARGET_DEFAULT_NORETURN (tcomplain ());
+ /* Save the recorded execution trace into a file. */
+ virtual void save_record (const char *filename)
+ TARGET_DEFAULT_NORETURN (tcomplain ());
- /* Delete the recorded execution trace from the current position
+ /* Delete the recorded execution trace from the current position
onwards. */
- virtual bool supports_delete_record ()
- TARGET_DEFAULT_RETURN (false);
- virtual void delete_record ()
- TARGET_DEFAULT_NORETURN (tcomplain ());
+ virtual bool supports_delete_record () TARGET_DEFAULT_RETURN (false);
+ virtual void delete_record () TARGET_DEFAULT_NORETURN (tcomplain ());
- /* Query if the record target is currently replaying PTID. */
- virtual bool record_is_replaying (ptid_t ptid)
- TARGET_DEFAULT_RETURN (false);
+ /* Query if the record target is currently replaying PTID. */
+ virtual bool record_is_replaying (ptid_t ptid) TARGET_DEFAULT_RETURN (false);
- /* Query if the record target will replay PTID if it were resumed in
+ /* Query if the record target will replay PTID if it were resumed in
execution direction DIR. */
- virtual bool record_will_replay (ptid_t ptid, int dir)
- TARGET_DEFAULT_RETURN (false);
+ virtual bool record_will_replay (ptid_t ptid, int dir)
+ TARGET_DEFAULT_RETURN (false);
- /* Stop replaying. */
- virtual void record_stop_replaying ()
- TARGET_DEFAULT_IGNORE ();
+ /* Stop replaying. */
+ virtual void record_stop_replaying () TARGET_DEFAULT_IGNORE ();
- /* Go to the begin of the execution trace. */
- virtual void goto_record_begin ()
- TARGET_DEFAULT_NORETURN (tcomplain ());
+ /* Go to the begin of the execution trace. */
+ virtual void goto_record_begin () TARGET_DEFAULT_NORETURN (tcomplain ());
- /* Go to the end of the execution trace. */
- virtual void goto_record_end ()
- TARGET_DEFAULT_NORETURN (tcomplain ());
+ /* Go to the end of the execution trace. */
+ virtual void goto_record_end () TARGET_DEFAULT_NORETURN (tcomplain ());
- /* Go to a specific location in the recorded execution trace. */
- virtual void goto_record (ULONGEST insn)
- TARGET_DEFAULT_NORETURN (tcomplain ());
+ /* Go to a specific location in the recorded execution trace. */
+ virtual void goto_record (ULONGEST insn)
+ TARGET_DEFAULT_NORETURN (tcomplain ());
- /* Disassemble SIZE instructions in the recorded execution trace from
+ /* Disassemble SIZE instructions in the recorded execution trace from
the current position.
If SIZE < 0, disassemble abs (SIZE) preceding instructions; otherwise,
disassemble SIZE succeeding instructions. */
- virtual void insn_history (int size, gdb_disassembly_flags flags)
- TARGET_DEFAULT_NORETURN (tcomplain ());
+ virtual void insn_history (int size, gdb_disassembly_flags flags)
+ TARGET_DEFAULT_NORETURN (tcomplain ());
- /* Disassemble SIZE instructions in the recorded execution trace around
+ /* Disassemble SIZE instructions in the recorded execution trace around
FROM.
If SIZE < 0, disassemble abs (SIZE) instructions before FROM; otherwise,
disassemble SIZE instructions after FROM. */
- virtual void insn_history_from (ULONGEST from, int size,
- gdb_disassembly_flags flags)
- TARGET_DEFAULT_NORETURN (tcomplain ());
+ virtual void insn_history_from (ULONGEST from, int size,
+ gdb_disassembly_flags flags)
+ TARGET_DEFAULT_NORETURN (tcomplain ());
- /* Disassemble a section of the recorded execution trace from instruction
+ /* Disassemble a section of the recorded execution trace from instruction
BEGIN (inclusive) to instruction END (inclusive). */
- virtual void insn_history_range (ULONGEST begin, ULONGEST end,
- gdb_disassembly_flags flags)
- TARGET_DEFAULT_NORETURN (tcomplain ());
+ virtual void insn_history_range (ULONGEST begin, ULONGEST end,
+ gdb_disassembly_flags flags)
+ TARGET_DEFAULT_NORETURN (tcomplain ());
- /* Print a function trace of the recorded execution trace.
+ /* Print a function trace of the recorded execution trace.
If SIZE < 0, print abs (SIZE) preceding functions; otherwise, print SIZE
succeeding functions. */
- virtual void call_history (int size, record_print_flags flags)
- TARGET_DEFAULT_NORETURN (tcomplain ());
+ virtual void call_history (int size, record_print_flags flags)
+ TARGET_DEFAULT_NORETURN (tcomplain ());
- /* Print a function trace of the recorded execution trace starting
+ /* Print a function trace of the recorded execution trace starting
at function FROM.
If SIZE < 0, print abs (SIZE) functions before FROM; otherwise, print
SIZE functions after FROM. */
- virtual void call_history_from (ULONGEST begin, int size, record_print_flags flags)
- TARGET_DEFAULT_NORETURN (tcomplain ());
+ virtual void call_history_from (ULONGEST begin, int size,
+ record_print_flags flags)
+ TARGET_DEFAULT_NORETURN (tcomplain ());
- /* Print a function trace of an execution trace section from function BEGIN
+ /* Print a function trace of an execution trace section from function BEGIN
(inclusive) to function END (inclusive). */
- virtual void call_history_range (ULONGEST begin, ULONGEST end, record_print_flags flags)
- TARGET_DEFAULT_NORETURN (tcomplain ());
+ virtual void call_history_range (ULONGEST begin, ULONGEST end,
+ record_print_flags flags)
+ TARGET_DEFAULT_NORETURN (tcomplain ());
- /* True if TARGET_OBJECT_LIBRARIES_SVR4 may be read with a
+ /* True if TARGET_OBJECT_LIBRARIES_SVR4 may be read with a
non-empty annex. */
- virtual bool augmented_libraries_svr4_read ()
- TARGET_DEFAULT_RETURN (false);
+ virtual bool augmented_libraries_svr4_read () TARGET_DEFAULT_RETURN (false);
- /* Those unwinders are tried before any other arch unwinders. If
+ /* Those unwinders are tried before any other arch unwinders. If
SELF doesn't have unwinders, it should delegate to the
"beneath" target. */
- virtual const struct frame_unwind *get_unwinder ()
- TARGET_DEFAULT_RETURN (NULL);
+ virtual const struct frame_unwind *get_unwinder ()
+ TARGET_DEFAULT_RETURN (NULL);
- virtual const struct frame_unwind *get_tailcall_unwinder ()
- TARGET_DEFAULT_RETURN (NULL);
+ virtual const struct frame_unwind *get_tailcall_unwinder ()
+ TARGET_DEFAULT_RETURN (NULL);
- /* Prepare to generate a core file. */
- virtual void prepare_to_generate_core ()
- TARGET_DEFAULT_IGNORE ();
+ /* Prepare to generate a core file. */
+ virtual void prepare_to_generate_core () TARGET_DEFAULT_IGNORE ();
- /* Cleanup after generating a core file. */
- virtual void done_generating_core ()
- TARGET_DEFAULT_IGNORE ();
+ /* Cleanup after generating a core file. */
+ virtual void done_generating_core () TARGET_DEFAULT_IGNORE ();
- /* Returns true if the target supports memory tagging, false otherwise. */
- virtual bool supports_memory_tagging ()
- TARGET_DEFAULT_RETURN (false);
+ /* Returns true if the target supports memory tagging, false otherwise. */
+ virtual bool supports_memory_tagging () TARGET_DEFAULT_RETURN (false);
- /* Return the allocated memory tags of type TYPE associated with
+ /* Return the allocated memory tags of type TYPE associated with
[ADDRESS, ADDRESS + LEN) in TAGS.
LEN is the number of bytes in the memory range. TAGS is a vector of
@@ -1304,11 +1225,11 @@ struct target_ops
vector and read the tags appropriately.
Returns true if fetching the tags succeeded and false otherwise. */
- virtual bool fetch_memtags (CORE_ADDR address, size_t len,
- gdb::byte_vector &tags, int type)
- TARGET_DEFAULT_NORETURN (tcomplain ());
+ virtual bool fetch_memtags (CORE_ADDR address, size_t len,
+ gdb::byte_vector &tags, int type)
+ TARGET_DEFAULT_NORETURN (tcomplain ());
- /* Write the allocation tags of type TYPE contained in TAGS to the memory
+ /* Write the allocation tags of type TYPE contained in TAGS to the memory
range [ADDRESS, ADDRESS + LEN).
LEN is the number of bytes in the memory range. TAGS is a vector of
@@ -1318,20 +1239,17 @@ struct target_ops
vector and store them appropriately.
Returns true if storing the tags succeeded and false otherwise. */
- virtual bool store_memtags (CORE_ADDR address, size_t len,
- const gdb::byte_vector &tags, int type)
- TARGET_DEFAULT_NORETURN (tcomplain ());
- };
+ virtual bool store_memtags (CORE_ADDR address, size_t len,
+ const gdb::byte_vector &tags, int type)
+ TARGET_DEFAULT_NORETURN (tcomplain ());
+};
/* Deleter for std::unique_ptr. See comments in
target_ops::~target_ops and target_ops::close about heap-allocated
targets. */
struct target_ops_deleter
{
- void operator() (target_ops *target)
- {
- target->close ();
- }
+ void operator() (target_ops *target) { target->close (); }
};
/* A unique pointer for target_ops. */
@@ -1341,10 +1259,7 @@ typedef std::unique_ptr<target_ops, target_ops_deleter> target_ops_up;
struct target_ops_ref_policy
{
- static void incref (target_ops *t)
- {
- t->incref ();
- }
+ static void incref (target_ops *t) { t->incref (); }
/* Decrement the reference count on T, and, if the reference count
reaches zero, close the target. */
@@ -1369,6 +1284,7 @@ extern target_ops *get_native_target ();
class target_stack
{
public:
+
target_stack () = default;
DISABLE_COPY_AND_ASSIGN (target_stack);
@@ -1382,7 +1298,9 @@ public:
/* Returns true if T is pushed on the target stack. */
bool is_pushed (const target_ops *t) const
- { return at (t->stratum ()) == t; }
+ {
+ return at (t->stratum ()) == t;
+ }
/* Return the target at STRATUM. */
target_ops *at (strata stratum) const { return m_stack[stratum].get (); }
@@ -1394,8 +1312,11 @@ public:
target_ops *find_beneath (const target_ops *t) const;
private:
+
/* The stratum of the top target. */
- enum strata m_top {};
+ enum strata m_top
+ {
+ };
/* The stack, represented as an array, with one slot per stratum.
If no target is pushed at some stratum, the corresponding slot is
@@ -1492,8 +1413,8 @@ extern void target_disconnect (const char *, int);
resumption request, but defers the actual resumption to the
target_commit_resume method implementation. See
target_commit_resume below. */
-extern void target_resume (ptid_t scope_ptid,
- int step, enum gdb_signal signal);
+extern void target_resume (ptid_t scope_ptid, int step,
+ enum gdb_signal signal);
/* Ensure that all resumed threads are committed to the target.
@@ -1505,8 +1426,7 @@ extern void target_commit_resumed ();
/* The default target_ops::to_wait implementation. */
-extern ptid_t default_target_wait (struct target_ops *ops,
- ptid_t ptid,
+extern ptid_t default_target_wait (struct target_ops *ops, ptid_t ptid,
struct target_waitstatus *status,
target_wait_flags options);
@@ -1578,7 +1498,8 @@ extern bool target_can_run_breakpoint_commands ();
extern int target_read_raw_memory (CORE_ADDR memaddr, gdb_byte *myaddr,
ssize_t len);
-extern int target_read_stack (CORE_ADDR memaddr, gdb_byte *myaddr, ssize_t len);
+extern int target_read_stack (CORE_ADDR memaddr, gdb_byte *myaddr,
+ ssize_t len);
extern int target_read_code (CORE_ADDR memaddr, gdb_byte *myaddr, ssize_t len);
@@ -1606,8 +1527,12 @@ struct memory_write_request
{
memory_write_request (ULONGEST begin_, ULONGEST end_,
gdb_byte *data_ = nullptr, void *baton_ = nullptr)
- : begin (begin_), end (end_), data (data_), baton (baton_)
- {}
+ : begin (begin_),
+ end (end_),
+ data (data_),
+ baton (baton_)
+ {
+ }
/* Begining address that must be written. */
ULONGEST begin;
@@ -1621,10 +1546,10 @@ struct memory_write_request
/* Enumeration specifying different flash preservation behaviour. */
enum flash_preserve_mode
- {
- flash_preserve,
- flash_discard
- };
+{
+ flash_preserve,
+ flash_discard
+};
/* Write several memory blocks at once. This version can be more
efficient than making several calls to target_write_memory, in
@@ -1643,10 +1568,10 @@ enum flash_preserve_mode
with a NULL baton, when preserved flash sectors are being rewritten.
The function returns 0 on success, and error otherwise. */
-int target_write_memory_blocks
- (const std::vector<memory_write_request> &requests,
- enum flash_preserve_mode preserve_flash_p,
- void (*progress_cb) (ULONGEST, void *));
+int
+target_write_memory_blocks (const std::vector<memory_write_request> &requests,
+ enum flash_preserve_mode preserve_flash_p,
+ void (*progress_cb) (ULONGEST, void *));
/* Print a line about the current target. */
@@ -1752,9 +1677,9 @@ extern int target_remove_exec_catchpoint (int pid);
Return 0 for success, 1 if syscall catchpoints are not supported or -1
for failure. */
-extern int target_set_syscall_catchpoint
- (int pid, bool needed, int any_count,
- gdb::array_view<const int> syscall_counts);
+extern int
+target_set_syscall_catchpoint (int pid, bool needed, int any_count,
+ gdb::array_view<const int> syscall_counts);
/* The debugger has completed a blocking wait() call. There is now
some process event that must be processed. This function should
@@ -1779,8 +1704,8 @@ extern int target_can_run ();
about to receive a signal, it needs to be reported in any case, even
if mentioned in a previous target_pass_signals call. */
-extern void target_pass_signals
- (gdb::array_view<const unsigned char> pass_signals);
+extern void
+target_pass_signals (gdb::array_view<const unsigned char> pass_signals);
/* Set list of signals the target may pass to the inferior. This
directly maps to the "handle SIGNAL pass/nopass" setting.
@@ -1796,8 +1721,8 @@ extern void target_pass_signals
example, when detaching (as threads may have been suspended with
pending signals not reported to GDB). */
-extern void target_program_signals
- (gdb::array_view<const unsigned char> program_signals);
+extern void
+target_program_signals (gdb::array_view<const unsigned char> program_signals);
/* Check to see if a thread is still alive. */
@@ -1927,14 +1852,15 @@ extern const char *target_thread_name (struct thread_info *);
/* Given a pointer to a thread library specific thread handle and
its length, return a pointer to the corresponding thread_info struct. */
-extern struct thread_info *target_thread_handle_to_thread_info
- (const gdb_byte *thread_handle, int handle_len, struct inferior *inf);
+extern struct thread_info *
+target_thread_handle_to_thread_info (const gdb_byte *thread_handle,
+ int handle_len, struct inferior *inf);
/* Given a thread, return the thread handle, a target-specific sequence of
bytes which serves as a thread identifier within the program being
debugged. */
-extern gdb::byte_vector target_thread_info_to_thread_handle
- (struct thread_info *);
+extern gdb::byte_vector
+target_thread_info_to_thread_handle (struct thread_info *);
/* Attempts to find the pathname of the executable file
that was run to create a specified process.
@@ -2142,8 +2068,7 @@ extern ptid_t target_get_ada_task_ptid (long lwp, ULONGEST tid);
/* Main entry point for searching memory. */
extern int target_search_memory (CORE_ADDR start_addr,
ULONGEST search_space_len,
- const gdb_byte *pattern,
- ULONGEST pattern_len,
+ const gdb_byte *pattern, ULONGEST pattern_len,
CORE_ADDR *found_addrp);
/* Target file operations. */
@@ -2159,9 +2084,8 @@ extern bool target_filesystem_is_local ();
a target file descriptor, or -1 if an error occurs (and set
*TARGET_ERRNO). If WARN_IF_SLOW is true, print a warning message
if the file is being accessed over a link that may be slow. */
-extern int target_fileio_open (struct inferior *inf,
- const char *filename, int flags,
- int mode, bool warn_if_slow,
+extern int target_fileio_open (struct inferior *inf, const char *filename,
+ int flags, int mode, bool warn_if_slow,
fileio_error *target_errno);
/* Write up to LEN bytes from WRITE_BUF to FD on the target.
@@ -2190,8 +2114,7 @@ extern int target_fileio_close (int fd, fileio_error *target_errno);
If INF is NULL, use the filesystem seen by the debugger (GDB or,
for remote targets, the remote stub). Return 0, or -1 if an error
occurs (and set *TARGET_ERRNO). */
-extern int target_fileio_unlink (struct inferior *inf,
- const char *filename,
+extern int target_fileio_unlink (struct inferior *inf, const char *filename,
fileio_error *target_errno);
/* Read value of symbolic link FILENAME on the target, in the
@@ -2199,8 +2122,9 @@ extern int target_fileio_unlink (struct inferior *inf,
by the debugger (GDB or, for remote targets, the remote stub).
Return a null-terminated string allocated via xmalloc, or NULL if
an error occurs (and set *TARGET_ERRNO). */
-extern gdb::optional<std::string> target_fileio_readlink
- (struct inferior *inf, const char *filename, fileio_error *target_errno);
+extern gdb::optional<std::string>
+target_fileio_readlink (struct inferior *inf, const char *filename,
+ fileio_error *target_errno);
/* Read target file FILENAME, in the filesystem as seen by INF. If
INF is NULL, use the filesystem seen by the debugger (GDB or, for
@@ -2225,8 +2149,8 @@ extern LONGEST target_fileio_read_alloc (struct inferior *inf,
or the transfer is unsupported, NULL is returned. Empty objects
are returned as allocated but empty strings. A warning is issued
if the result contains any embedded NUL bytes. */
-extern gdb::unique_xmalloc_ptr<char> target_fileio_read_stralloc
- (struct inferior *inf, const char *filename);
+extern gdb::unique_xmalloc_ptr<char>
+target_fileio_read_stralloc (struct inferior *inf, const char *filename);
/* Invalidate the target associated with open handles that were open
on target TARG, since we're about to close (and maybe destroy) the
@@ -2243,7 +2167,8 @@ extern void target_download_tracepoint (bp_location *location);
extern bool target_can_download_tracepoint ();
-extern void target_download_trace_state_variable (const trace_state_variable &tsv);
+extern void
+target_download_trace_state_variable (const trace_state_variable &tsv);
extern void target_enable_tracepoint (bp_location *loc);
@@ -2288,11 +2213,12 @@ extern bool target_get_tib_address (ptid_t ptid, CORE_ADDR *addr);
extern void target_set_permissions ();
-extern bool target_static_tracepoint_marker_at
- (CORE_ADDR addr, static_tracepoint_marker *marker);
+extern bool
+target_static_tracepoint_marker_at (CORE_ADDR addr,
+ static_tracepoint_marker *marker);
extern std::vector<static_tracepoint_marker>
- target_static_tracepoint_markers_by_strid (const char *marker_id);
+target_static_tracepoint_markers_by_strid (const char *marker_id);
extern traceframe_info_up target_traceframe_info ();
@@ -2326,8 +2252,7 @@ extern const struct frame_unwind *target_get_tailcall_unwinder (void);
and performing the comparison here (as opposed to accelerated
verification making use of the qCRC packet, for example). */
-extern int simple_verify_memory (struct target_ops* ops,
- const gdb_byte *data,
+extern int simple_verify_memory (struct target_ops *ops, const gdb_byte *data,
CORE_ADDR memaddr, ULONGEST size);
/* Verify that the memory in the [MEMADDR, MEMADDR+SIZE) range matches
@@ -2335,8 +2260,8 @@ extern int simple_verify_memory (struct target_ops* ops,
if there's a mismatch, and -1 if an error is encountered while
reading memory. Throws an error if the functionality is found not
to be supported by the current target. */
-int target_verify_memory (const gdb_byte *data,
- CORE_ADDR memaddr, ULONGEST size);
+int target_verify_memory (const gdb_byte *data, CORE_ADDR memaddr,
+ ULONGEST size);
/* Routines for maintenance of the target structures...
@@ -2363,8 +2288,7 @@ typedef void target_open_ftype (const char *args, int from_tty);
and add a new command 'target $(INFO->shortname)'. Set COMPLETER
as the command's completer if not NULL. */
-extern void add_target (const target_info &info,
- target_open_ftype *func,
+extern void add_target (const target_info &info, target_open_ftype *func,
completer_ftype *completer = NULL);
/* Adds a command ALIAS for the target described by INFO and marks it
@@ -2399,8 +2323,8 @@ const struct target_section *target_section_by_addr (struct target_ops *target,
/* Return the target section table this target (or the targets
beneath) currently manipulate. */
-extern const target_section_table *target_get_section_table
- (struct target_ops *target);
+extern const target_section_table *
+target_get_section_table (struct target_ops *target);
/* Default implementation of get_section_table for dummy_target. */
@@ -2408,27 +2332,31 @@ extern const target_section_table *default_get_section_table ();
/* From mem-break.c */
-extern int memory_remove_breakpoint (struct target_ops *,
- struct gdbarch *, struct bp_target_info *,
+extern int memory_remove_breakpoint (struct target_ops *, struct gdbarch *,
+ struct bp_target_info *,
enum remove_bp_reason);
-extern int memory_insert_breakpoint (struct target_ops *,
- struct gdbarch *, struct bp_target_info *);
+extern int memory_insert_breakpoint (struct target_ops *, struct gdbarch *,
+ struct bp_target_info *);
/* Convenience template use to add memory breakpoints support to a
target. */
-template <typename BaseTarget>
+template<typename BaseTarget>
struct memory_breakpoint_target : public BaseTarget
{
int insert_breakpoint (struct gdbarch *gdbarch,
struct bp_target_info *bp_tgt) override
- { return memory_insert_breakpoint (this, gdbarch, bp_tgt); }
+ {
+ return memory_insert_breakpoint (this, gdbarch, bp_tgt);
+ }
int remove_breakpoint (struct gdbarch *gdbarch,
struct bp_target_info *bp_tgt,
enum remove_bp_reason reason) override
- { return memory_remove_breakpoint (this, gdbarch, bp_tgt, reason); }
+ {
+ return memory_remove_breakpoint (this, gdbarch, bp_tgt, reason);
+ }
};
/* Check whether the memory at the breakpoint's placed address still
@@ -2443,7 +2371,6 @@ extern int default_memory_remove_breakpoint (struct gdbarch *,
extern int default_memory_insert_breakpoint (struct gdbarch *,
struct bp_target_info *);
-
/* From target.c */
extern void initialize_targets (void);
@@ -2464,16 +2391,13 @@ extern gdb::optional<gdb::char_vector> target_get_osdata (const char *type);
/* Stuff that should be shared among the various remote targets. */
-
/* Timeout limit for response from target. */
extern int remote_timeout;
-
-
/* Set the show memory breakpoints mode to show, and return a
scoped_restore to restore it back to the current value. */
extern scoped_restore_tmpl<int>
- make_scoped_restore_show_memory_breakpoints (int show);
+make_scoped_restore_show_memory_breakpoints (int show);
extern bool may_write_registers;
extern bool may_write_memory;
@@ -2484,12 +2408,11 @@ extern bool may_stop;
extern void update_target_permissions (void);
-
/* Imported from machine dependent code. */
/* See to_enable_btrace in struct target_ops. */
extern struct btrace_target_info *
- target_enable_btrace (thread_info *tp, const struct btrace_config *);
+target_enable_btrace (thread_info *tp, const struct btrace_config *);
/* See to_disable_btrace in struct target_ops. */
extern void target_disable_btrace (struct btrace_target_info *btinfo);
@@ -2504,7 +2427,7 @@ extern enum btrace_error target_read_btrace (struct btrace_data *,
/* See to_btrace_conf in struct target_ops. */
extern const struct btrace_config *
- target_btrace_conf (const struct btrace_target_info *);
+target_btrace_conf (const struct btrace_target_info *);
/* See to_stop_recording in struct target_ops. */
extern void target_stop_recording (void);
diff --git a/gdb/target/target.c b/gdb/target/target.c
index 8089918f1d0..931a96612a4 100644
--- a/gdb/target/target.c
+++ b/gdb/target/target.c
@@ -26,11 +26,10 @@
location pointed to by ERRPTR if ERRPTR is non-null. */
static int
-partial_memory_read (CORE_ADDR memaddr, gdb_byte *myaddr,
- int len, int *errptr)
+partial_memory_read (CORE_ADDR memaddr, gdb_byte *myaddr, int len, int *errptr)
{
- int nread; /* Number of bytes actually read. */
- int errcode; /* Error from last read. */
+ int nread; /* Number of bytes actually read. */
+ int errcode; /* Error from last read. */
/* First try a complete read. */
errcode = target_read_memory (memaddr, myaddr, len);
@@ -64,12 +63,11 @@ partial_memory_read (CORE_ADDR memaddr, gdb_byte *myaddr,
int
target_read_string (CORE_ADDR addr, int len, int width,
unsigned int fetchlimit,
- gdb::unique_xmalloc_ptr<gdb_byte> *buffer,
- int *bytes_read)
+ gdb::unique_xmalloc_ptr<gdb_byte> *buffer, int *bytes_read)
{
- int errcode; /* Errno returned from bad reads. */
- unsigned int nfetch; /* Chars to fetch / chars fetched. */
- gdb_byte *bufptr; /* Pointer to next available byte in
+ int errcode; /* Errno returned from bad reads. */
+ unsigned int nfetch; /* Chars to fetch / chars fetched. */
+ gdb_byte *bufptr; /* Pointer to next available byte in
buffer. */
/* Loop until we either have all the characters, or we encounter
@@ -87,16 +85,16 @@ target_read_string (CORE_ADDR addr, int len, int width,
bufptr = buffer->get ();
nfetch = partial_memory_read (addr, bufptr, fetchlen * width, &errcode)
- / width;
+ / width;
addr += nfetch * width;
bufptr += nfetch * width;
}
else if (len == -1)
{
unsigned long bufsize = 0;
- unsigned int chunksize; /* Size of each fetch, in chars. */
- int found_nul; /* Non-zero if we found the nul char. */
- gdb_byte *limit; /* First location past end of fetch buffer. */
+ unsigned int chunksize; /* Size of each fetch, in chars. */
+ int found_nul; /* Non-zero if we found the nul char. */
+ gdb_byte *limit; /* First location past end of fetch buffer. */
found_nul = 0;
/* We are looking for a NUL terminator to end the fetching, so we
@@ -122,7 +120,7 @@ target_read_string (CORE_ADDR addr, int len, int width,
/* Read as much as we can. */
nfetch = partial_memory_read (addr, bufptr, nfetch * width, &errcode)
- / width;
+ / width;
/* Scan this chunk for the null character that terminates the string
to print. If found, we don't need to fetch any more. Note
@@ -151,12 +149,12 @@ target_read_string (CORE_ADDR addr, int len, int width,
}
}
}
- while (errcode == 0 /* no error */
- && bufptr - buffer->get () < fetchlimit * width /* no overrun */
- && !found_nul); /* haven't found NUL yet */
+ while (errcode == 0 /* no error */
+ && bufptr - buffer->get () < fetchlimit * width /* no overrun */
+ && !found_nul); /* haven't found NUL yet */
}
else
- { /* Length of string is really 0! */
+ { /* Length of string is really 0! */
/* We always allocate *buffer. */
buffer->reset ((gdb_byte *) xmalloc (1));
bufptr = buffer->get ();
diff --git a/gdb/target/target.h b/gdb/target/target.h
index d1a18ee2212..b9c1cf20b43 100644
--- a/gdb/target/target.h
+++ b/gdb/target/target.h
@@ -53,8 +53,8 @@ extern int target_read_uint32 (CORE_ADDR memaddr, uint32_t *result);
in some cases -- but these will not be returned). Returns nullptr
on error. */
-extern gdb::unique_xmalloc_ptr<char> target_read_string
- (CORE_ADDR memaddr, int len, int *bytes_read = nullptr);
+extern gdb::unique_xmalloc_ptr<char>
+target_read_string (CORE_ADDR memaddr, int len, int *bytes_read = nullptr);
/* Read a string from the inferior, at ADDR, with LEN characters of
WIDTH bytes each. Fetch at most FETCHLIMIT characters. BUFFER
@@ -131,17 +131,17 @@ extern int target_supports_multi_process (void);
/* Possible terminal states. */
enum class target_terminal_state
- {
- /* The inferior's terminal settings are in effect. */
- is_inferior = 0,
+{
+ /* The inferior's terminal settings are in effect. */
+ is_inferior = 0,
- /* Some of our terminal settings are in effect, enough to get
+ /* Some of our terminal settings are in effect, enough to get
proper output. */
- is_ours_for_output = 1,
+ is_ours_for_output = 1,
- /* Our terminal settings are in effect, for output and input. */
- is_ours = 2
- };
+ /* Our terminal settings are in effect, for output and input. */
+ is_ours = 2
+};
/* Represents the state of the target terminal. */
class target_terminal
diff --git a/gdb/target/waitstatus.c b/gdb/target/waitstatus.c
index 2b8404fb75b..83ae653123d 100644
--- a/gdb/target/waitstatus.c
+++ b/gdb/target/waitstatus.c
@@ -25,13 +25,13 @@
std::string
target_waitstatus::to_string () const
{
- std::string str = string_printf
- ("status->kind = %s", target_waitkind_str (this->kind ()));
+ std::string str
+ = string_printf ("status->kind = %s", target_waitkind_str (this->kind ()));
-/* Make sure the compiler warns if a new TARGET_WAITKIND enumerator is added
+ /* Make sure the compiler warns if a new TARGET_WAITKIND enumerator is added
but not handled here. */
-DIAGNOSTIC_PUSH
-DIAGNOSTIC_ERROR_SWITCH
+ DIAGNOSTIC_PUSH
+ DIAGNOSTIC_ERROR_SWITCH
switch (this->kind ())
{
case TARGET_WAITKIND_EXITED:
@@ -63,7 +63,7 @@ DIAGNOSTIC_ERROR_SWITCH
case TARGET_WAITKIND_THREAD_CREATED:
return str;
}
-DIAGNOSTIC_POP
+ DIAGNOSTIC_POP
gdb_assert_not_reached ("invalid target_waitkind value: %d",
(int) this->kind ());
diff --git a/gdb/target/waitstatus.h b/gdb/target/waitstatus.h
index 0a88b869044..0fa9e16b45f 100644
--- a/gdb/target/waitstatus.h
+++ b/gdb/target/waitstatus.h
@@ -47,15 +47,15 @@ enum target_waitkind
value.related_pid. I.e., if the child forks, value.related_pid
is the parent's ID. */
TARGET_WAITKIND_FORKED,
-
+
/* The program has vforked. A "related" process's PTID is in
value.related_pid. */
TARGET_WAITKIND_VFORKED,
-
+
/* The program has exec'ed a new executable file. The new file's
pathname is pointed to by value.execd_pathname. */
TARGET_WAITKIND_EXECD,
-
+
/* The program had previously vforked, and now the child is done
with the shared memory region, because it exec'ed or exited.
Note that the event is reported to the vfork parent. This is
@@ -87,11 +87,11 @@ enum target_waitkind
function. This way the event loop is responsive to other events,
like for instance the user typing. */
TARGET_WAITKIND_IGNORE,
-
+
/* The target has run out of history information,
and cannot run backward any further. */
TARGET_WAITKIND_NO_HISTORY,
-
+
/* There are no resumed children left in the program. */
TARGET_WAITKIND_NO_RESUMED,
@@ -107,12 +107,12 @@ enum target_waitkind
static inline const char *
target_waitkind_str (target_waitkind kind)
{
-/* Make sure the compiler warns if a new TARGET_WAITKIND enumerator is added
+ /* Make sure the compiler warns if a new TARGET_WAITKIND enumerator is added
but not handled here. */
-DIAGNOSTIC_PUSH
-DIAGNOSTIC_ERROR_SWITCH
+ DIAGNOSTIC_PUSH
+ DIAGNOSTIC_ERROR_SWITCH
switch (kind)
- {
+ {
case TARGET_WAITKIND_EXITED:
return "EXITED";
case TARGET_WAITKIND_STOPPED:
@@ -145,8 +145,8 @@ DIAGNOSTIC_ERROR_SWITCH
return "THREAD_CREATED";
case TARGET_WAITKIND_THREAD_EXITED:
return "THREAD_EXITED";
- };
-DIAGNOSTIC_POP
+ };
+ DIAGNOSTIC_POP
gdb_assert_not_reached ("invalid target_waitkind value: %d\n", (int) kind);
}
@@ -212,10 +212,7 @@ struct target_waitstatus
/* Destructor. */
- ~target_waitstatus ()
- {
- this->reset ();
- }
+ ~target_waitstatus () { this->reset (); }
/* Setters: set the wait status kind plus any associated data. */
@@ -342,10 +339,7 @@ struct target_waitstatus
/* Get the kind of this wait status. */
- target_waitkind kind () const
- {
- return m_kind;
- }
+ target_waitkind kind () const { return m_kind; }
/* Getters for the associated data.
@@ -394,6 +388,7 @@ struct target_waitstatus
std::string to_string () const;
private:
+
/* Reset the wait status to its original state. */
void reset ()
{
@@ -407,18 +402,18 @@ private:
/* Additional information about the event. */
union
- {
- /* Exit status */
- int exit_status;
- /* Signal number */
- enum gdb_signal sig;
- /* Forked child pid */
- ptid_t child_ptid;
- /* execd pathname */
- char *execd_pathname;
- /* Syscall number */
- int syscall_number;
- } m_value {};
+ {
+ /* Exit status */
+ int exit_status;
+ /* Signal number */
+ enum gdb_signal sig;
+ /* Forked child pid */
+ ptid_t child_ptid;
+ /* execd pathname */
+ char *execd_pathname;
+ /* Syscall number */
+ int syscall_number;
+ } m_value {};
};
/* Extended reasons that can explain why a target/thread stopped for a
diff --git a/gdb/terminal.h b/gdb/terminal.h
index 34ce2281c4f..8e38acf81df 100644
--- a/gdb/terminal.h
+++ b/gdb/terminal.h
@@ -16,7 +16,7 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
-#if !defined (TERMINAL_H)
+#if !defined(TERMINAL_H)
#define TERMINAL_H 1
struct inferior;
diff --git a/gdb/test-target.c b/gdb/test-target.c
index c43a9e5d4d3..3bd6f10b4f6 100644
--- a/gdb/test-target.c
+++ b/gdb/test-target.c
@@ -21,12 +21,13 @@
#include "test-target.h"
#if GDB_SELF_TEST
-namespace selftests {
+namespace selftests
+{
static const target_info test_target_info = {
"test",
- N_("unit tests target"),
- N_("You should never see this"),
+ N_ ("unit tests target"),
+ N_ ("You should never see this"),
};
const target_info &
diff --git a/gdb/test-target.h b/gdb/test-target.h
index 300a733b5be..6a7e7725200 100644
--- a/gdb/test-target.h
+++ b/gdb/test-target.h
@@ -23,7 +23,8 @@
#include "process-stratum-target.h"
#if GDB_SELF_TEST
-namespace selftests {
+namespace selftests
+{
/* A mock process_stratum target_ops that doesn't read/write registers
anywhere. */
@@ -31,32 +32,20 @@ namespace selftests {
class test_target_ops : public process_stratum_target
{
public:
+
test_target_ops () = default;
const target_info &info () const override;
- bool has_registers () override
- {
- return true;
- }
+ bool has_registers () override { return true; }
- bool has_stack () override
- {
- return true;
- }
+ bool has_stack () override { return true; }
- bool has_memory () override
- {
- return true;
- }
+ bool has_memory () override { return true; }
- void prepare_to_store (regcache *regs) override
- {
- }
+ void prepare_to_store (regcache *regs) override {}
- void store_registers (regcache *regs, int regno) override
- {
- }
+ void store_registers (regcache *regs, int regno) override {}
};
} // namespace selftests
diff --git a/gdb/thread-fsm.h b/gdb/thread-fsm.h
index 3720c3098fa..fd0f86e0c42 100644
--- a/gdb/thread-fsm.h
+++ b/gdb/thread-fsm.h
@@ -45,9 +45,7 @@ struct thread_fsm
/* Called to clean up target resources after the FSM. E.g., if the
FSM created internal breakpoints, this is where they should be
deleted. */
- virtual void clean_up (struct thread_info *thread)
- {
- }
+ virtual void clean_up (struct thread_info *thread) {}
/* Called after handle_inferior_event decides the target is done
(that is, after stop_waiting). The FSM is given a chance to
@@ -60,10 +58,7 @@ struct thread_fsm
/* If this FSM saved a function's return value, you can use this
method to retrieve it. Otherwise, this returns NULL. */
- virtual struct return_value_info *return_value ()
- {
- return nullptr;
- }
+ virtual struct return_value_info *return_value () { return nullptr; }
enum async_reply_reason async_reply_reason ()
{
@@ -74,20 +69,11 @@ struct thread_fsm
}
/* Whether the stop should be notified to the user/frontend. */
- virtual bool should_notify_stop ()
- {
- return true;
- }
+ virtual bool should_notify_stop () { return true; }
- void set_finished ()
- {
- finished = true;
- }
+ void set_finished () { finished = true; }
- bool finished_p () const
- {
- return finished;
- }
+ bool finished_p () const { return finished; }
/* The interpreter that issued the execution command that caused
this thread to resume. If the top level interpreter is MI/async,
diff --git a/gdb/thread-iter.c b/gdb/thread-iter.c
index 7295f480429..81dfbf928a6 100644
--- a/gdb/thread-iter.c
+++ b/gdb/thread-iter.c
@@ -81,8 +81,8 @@ all_matching_threads_iterator::m_inf_matches ()
/* See thread-iter.h. */
-all_matching_threads_iterator::all_matching_threads_iterator
- (process_stratum_target *filter_target, ptid_t filter_ptid)
+all_matching_threads_iterator::all_matching_threads_iterator (
+ process_stratum_target *filter_target, ptid_t filter_ptid)
: m_filter_target (filter_target)
{
if (filter_ptid == minus_one_ptid)
@@ -96,8 +96,7 @@ all_matching_threads_iterator::all_matching_threads_iterator
{
m_inf = &inf;
- if (!m_inf_matches ()
- || inf.thread_list.empty ())
+ if (!m_inf_matches () || inf.thread_list.empty ())
continue;
m_thr = &inf.thread_list.front ();
diff --git a/gdb/thread-iter.h b/gdb/thread-iter.h
index 40459bb2df8..f3db8187756 100644
--- a/gdb/thread-iter.h
+++ b/gdb/thread-iter.h
@@ -37,6 +37,7 @@ using inf_threads_iterator
class all_threads_iterator
{
public:
+
typedef all_threads_iterator self_type;
typedef struct thread_info *value_type;
typedef struct thread_info *&reference;
@@ -45,7 +46,9 @@ public:
typedef int difference_type;
/* Tag type. */
- struct begin_t {};
+ struct begin_t
+ {
+ };
/* Create an iterator that points to the first thread of the first
inferior. */
@@ -54,7 +57,8 @@ public:
/* Create a one-past-end iterator. */
all_threads_iterator ()
: m_thr (nullptr)
- {}
+ {
+ }
thread_info *operator* () const { return m_thr; }
@@ -65,16 +69,22 @@ public:
}
bool operator== (const all_threads_iterator &other) const
- { return m_thr == other.m_thr; }
+ {
+ return m_thr == other.m_thr;
+ }
bool operator!= (const all_threads_iterator &other) const
- { return m_thr != other.m_thr; }
+ {
+ return m_thr != other.m_thr;
+ }
private:
+
/* Advance to the next thread. */
void advance ();
private:
+
/* The current inferior and thread. M_THR is NULL if we reached the
end of the threads list of the last inferior. */
inferior *m_inf;
@@ -86,6 +96,7 @@ private:
class all_matching_threads_iterator
{
public:
+
typedef all_matching_threads_iterator self_type;
typedef struct thread_info *value_type;
typedef struct thread_info *&reference;
@@ -110,12 +121,17 @@ public:
}
bool operator== (const all_matching_threads_iterator &other) const
- { return m_thr == other.m_thr; }
+ {
+ return m_thr == other.m_thr;
+ }
bool operator!= (const all_matching_threads_iterator &other) const
- { return m_thr != other.m_thr; }
+ {
+ return m_thr != other.m_thr;
+ }
private:
+
/* Advance to next thread, skipping filtered threads. */
void advance ();
@@ -123,6 +139,7 @@ private:
bool m_inf_matches ();
private:
+
enum class mode
{
/* All threads, possibly filtered down to a single target. */
@@ -167,13 +184,11 @@ using inf_non_exited_threads_iterator
/* Iterate over all threads of all inferiors, safely. */
-using all_threads_safe_iterator
- = basic_safe_iterator<all_threads_iterator>;
+using all_threads_safe_iterator = basic_safe_iterator<all_threads_iterator>;
/* Iterate over all threads of an inferior, safely. */
-using safe_inf_threads_iterator
- = basic_safe_iterator<inf_threads_iterator>;
+using safe_inf_threads_iterator = basic_safe_iterator<inf_threads_iterator>;
/* A range adapter that makes it possible to iterate over all threads
of an inferior with range-for. */
@@ -203,20 +218,32 @@ using all_threads_safe_range = iterator_range<all_threads_safe_iterator>;
struct all_matching_threads_range
{
public:
+
all_matching_threads_range (process_stratum_target *filter_target,
ptid_t filter_ptid)
- : m_filter_target (filter_target), m_filter_ptid (filter_ptid)
- {}
+ : m_filter_target (filter_target),
+ m_filter_ptid (filter_ptid)
+ {
+ }
+
all_matching_threads_range ()
- : m_filter_target (nullptr), m_filter_ptid (minus_one_ptid)
- {}
+ : m_filter_target (nullptr),
+ m_filter_ptid (minus_one_ptid)
+ {
+ }
all_matching_threads_iterator begin () const
- { return all_matching_threads_iterator (m_filter_target, m_filter_ptid); }
+ {
+ return all_matching_threads_iterator (m_filter_target, m_filter_ptid);
+ }
+
all_matching_threads_iterator end () const
- { return all_matching_threads_iterator (); }
+ {
+ return all_matching_threads_iterator ();
+ }
private:
+
/* The filter. */
process_stratum_target *m_filter_target;
ptid_t m_filter_ptid;
@@ -230,21 +257,32 @@ private:
class all_non_exited_threads_range
{
public:
+
all_non_exited_threads_range (process_stratum_target *filter_target,
ptid_t filter_ptid)
- : m_filter_target (filter_target), m_filter_ptid (filter_ptid)
- {}
+ : m_filter_target (filter_target),
+ m_filter_ptid (filter_ptid)
+ {
+ }
all_non_exited_threads_range ()
- : m_filter_target (nullptr), m_filter_ptid (minus_one_ptid)
- {}
+ : m_filter_target (nullptr),
+ m_filter_ptid (minus_one_ptid)
+ {
+ }
all_non_exited_threads_iterator begin () const
- { return all_non_exited_threads_iterator (m_filter_target, m_filter_ptid); }
+ {
+ return all_non_exited_threads_iterator (m_filter_target, m_filter_ptid);
+ }
+
all_non_exited_threads_iterator end () const
- { return all_non_exited_threads_iterator (); }
+ {
+ return all_non_exited_threads_iterator ();
+ }
private:
+
process_stratum_target *m_filter_target;
ptid_t m_filter_ptid;
};
diff --git a/gdb/thread.c b/gdb/thread.c
index 1a852f70206..955cd2b24de 100644
--- a/gdb/thread.c
+++ b/gdb/thread.c
@@ -60,7 +60,7 @@ static void
show_debug_threads (struct ui_file *file, int from_tty,
struct cmd_list_element *c, const char *value)
{
- gdb_printf (file, _("Thread debugging is \"%s\".\n"), value);
+ gdb_printf (file, _ ("Thread debugging is \"%s\".\n"), value);
}
/* Definition of struct thread_info exported to gdbthread.h. */
@@ -80,7 +80,7 @@ is_current_thread (const thread_info *thr)
return thr == current_thread_;
}
-struct thread_info*
+struct thread_info *
inferior_thread (void)
{
gdb_assert (current_thread_ != nullptr);
@@ -294,7 +294,7 @@ add_thread_with_info (process_stratum_target *targ, ptid_t ptid,
result->priv.reset (priv);
if (print_thread_events)
- gdb_printf (_("[New %s]\n"), target_pid_to_str (ptid).c_str ());
+ gdb_printf (_ ("[New %s]\n"), target_pid_to_str (ptid).c_str ());
annotate_new_thread ();
return result;
@@ -309,7 +309,8 @@ add_thread (process_stratum_target *targ, ptid_t ptid)
private_thread_info::~private_thread_info () = default;
thread_info::thread_info (struct inferior *inf_, ptid_t ptid_)
- : ptid (ptid_), inf (inf_)
+ : ptid (ptid_),
+ inf (inf_)
{
gdb_assert (inf_ != NULL);
@@ -468,9 +469,9 @@ delete_thread_1 (thread_info *thr, bool silent)
if (!thr->deletable ())
{
- /* Will be really deleted some other time. */
- return;
- }
+ /* Will be really deleted some other time. */
+ return;
+ }
auto it = thr->inf->thread_list.iterator_to (*thr);
thr->inf->thread_list.erase (it);
@@ -543,8 +544,7 @@ struct thread_info *
find_thread_by_handle (gdb::array_view<const gdb_byte> handle,
struct inferior *inf)
{
- return target_thread_handle_to_thread_info (handle.data (),
- handle.size (),
+ return target_thread_handle_to_thread_info (handle.data (), handle.size (),
inf);
}
@@ -790,8 +790,8 @@ get_last_thread_stack_temporary (thread_info *tp)
}
void
-thread_change_ptid (process_stratum_target *targ,
- ptid_t old_ptid, ptid_t new_ptid)
+thread_change_ptid (process_stratum_target *targ, ptid_t old_ptid,
+ ptid_t new_ptid)
{
struct inferior *inf;
struct thread_info *tp;
@@ -932,13 +932,13 @@ validate_registers_access (void)
{
/* No selected thread, no registers. */
if (inferior_ptid == null_ptid)
- error (_("No thread selected."));
+ error (_ ("No thread selected."));
thread_info *tp = inferior_thread ();
/* Don't try to read from a dead thread. */
if (tp->state == THREAD_EXITED)
- error (_("The current thread has terminated"));
+ error (_ ("The current thread has terminated"));
/* ... or from a spinning thread. FIXME: This isn't actually fully
correct. It'll allow an user-requested access (e.g., "print $pc"
@@ -946,7 +946,7 @@ validate_registers_access (void)
reason, but is marked running from the user's perspective. E.g.,
the thread is waiting for its turn in the step-over queue. */
if (tp->executing ())
- error (_("Selected thread is running."));
+ error (_ ("Selected thread is running."));
}
/* See gdbthread.h. */
@@ -1006,7 +1006,7 @@ should_print_thread (const char *requested_threads, int default_inf_num,
if (pid != -1 && thr->ptid.pid () != pid)
{
if (requested_threads != NULL && *requested_threads != '\0')
- error (_("Requested thread not found in requested process"));
+ error (_ ("Requested thread not found in requested process"));
return 0;
}
@@ -1043,8 +1043,7 @@ thread_target_id_str (thread_info *tp)
static void
print_thread_info_1 (struct ui_out *uiout, const char *requested_threads,
- int global_ids, int pid,
- int show_global_ids)
+ int global_ids, int pid, int show_global_ids)
{
int default_inf_num = current_inferior ()->num;
@@ -1055,8 +1054,8 @@ print_thread_info_1 (struct ui_out *uiout, const char *requested_threads,
/* Whether the current thread is exited. */
bool current_exited = false;
- thread_info *current_thread = (inferior_ptid != null_ptid
- ? inferior_thread () : NULL);
+ thread_info *current_thread
+ = (inferior_ptid != null_ptid ? inferior_thread () : NULL);
{
/* For backward compatibility, we make a list for MI. A table is
@@ -1100,22 +1099,22 @@ print_thread_info_1 (struct ui_out *uiout, const char *requested_threads,
if (n_threads == 0)
{
if (requested_threads == NULL || *requested_threads == '\0')
- uiout->message (_("No threads.\n"));
+ uiout->message (_ ("No threads.\n"));
else
- uiout->message (_("No threads match '%s'.\n"),
+ uiout->message (_ ("No threads match '%s'.\n"),
requested_threads);
return;
}
- table_emitter.emplace (uiout, show_global_ids ? 5 : 4,
- n_threads, "threads");
+ table_emitter.emplace (uiout, show_global_ids ? 5 : 4, n_threads,
+ "threads");
uiout->table_header (1, ui_left, "current", "");
uiout->table_header (4, ui_left, "id-in-tg", "Id");
if (show_global_ids)
uiout->table_header (4, ui_left, "id", "GId");
- uiout->table_header (target_id_col_width, ui_left,
- "target-id", "Target Id");
+ uiout->table_header (target_id_col_width, ui_left, "target-id",
+ "Target Id");
uiout->table_header (1, ui_left, "frame", "Frame");
uiout->table_body ();
}
@@ -1183,8 +1182,7 @@ print_thread_info_1 (struct ui_out *uiout, const char *requested_threads,
frame). */
print_stack_frame (get_selected_frame (NULL),
/* For MI output, print frame level. */
- uiout->is_mi_like_p (),
- LOCATION, 0);
+ uiout->is_mi_like_p (), LOCATION, 0);
}
if (uiout->is_mi_like_p ())
@@ -1243,7 +1241,7 @@ static const gdb::option::option_def info_threads_option_defs[] = {
gdb::option::flag_option_def<info_threads_opts> {
"gid",
[] (info_threads_opts *opts) { return &opts->show_global_ids; },
- N_("Show global thread IDs."),
+ N_ ("Show global thread IDs."),
},
};
@@ -1254,7 +1252,7 @@ static const gdb::option::option_def info_threads_option_defs[] = {
static inline gdb::option::option_def_group
make_info_threads_options_def_group (info_threads_opts *it_opts)
{
- return {{info_threads_option_defs}, it_opts};
+ return { { info_threads_option_defs }, it_opts };
}
/* Implementation of the "info threads" command.
@@ -1269,8 +1267,9 @@ info_threads_command (const char *arg, int from_tty)
info_threads_opts it_opts;
auto grp = make_info_threads_options_def_group (&it_opts);
- gdb::option::process_options
- (&arg, gdb::option::PROCESS_OPTIONS_UNKNOWN_IS_ERROR, grp);
+ gdb::option::process_options (&arg,
+ gdb::option::PROCESS_OPTIONS_UNKNOWN_IS_ERROR,
+ grp);
print_thread_info_1 (current_uiout, arg, 0, -1, it_opts.show_global_ids);
}
@@ -1279,13 +1278,13 @@ info_threads_command (const char *arg, int from_tty)
static void
info_threads_command_completer (struct cmd_list_element *ignore,
- completion_tracker &tracker,
- const char *text, const char *word_ignored)
+ completion_tracker &tracker, const char *text,
+ const char *word_ignored)
{
const auto grp = make_info_threads_options_def_group (nullptr);
- if (gdb::option::complete_options
- (tracker, &text, gdb::option::PROCESS_OPTIONS_UNKNOWN_IS_ERROR, grp))
+ if (gdb::option::complete_options (
+ tracker, &text, gdb::option::PROCESS_OPTIONS_UNKNOWN_IS_ERROR, grp))
return;
/* Convenience to let the user know what the option can accept. */
@@ -1374,12 +1373,9 @@ scoped_restore_current_thread::restore ()
/* The running state of the originally selected thread may have
changed, so we have to recheck it here. */
- if (inferior_ptid != null_ptid
- && m_was_stopped
- && m_thread->state == THREAD_STOPPED
- && target_has_registers ()
- && target_has_stack ()
- && target_has_memory ())
+ if (inferior_ptid != null_ptid && m_was_stopped
+ && m_thread->state == THREAD_STOPPED && target_has_registers ()
+ && target_has_stack () && target_has_memory ())
restore_selected_frame (m_selected_frame_id, m_selected_frame_level);
set_language (m_lang);
@@ -1470,8 +1466,7 @@ tp_array_compar_descending (const thread_info_ref &a, const thread_info_ref &b)
void
thread_try_catch_cmd (thread_info *thr, gdb::optional<int> ada_task,
- const char *cmd, int from_tty,
- const qcs_flags &flags)
+ const char *cmd, int from_tty, const qcs_flags &flags)
{
gdb_assert (is_current_thread (thr));
@@ -1480,17 +1475,17 @@ thread_try_catch_cmd (thread_info *thr, gdb::optional<int> ada_task,
by thread_target_id_str. */
std::string thr_header;
if (ada_task.has_value ())
- thr_header = string_printf (_("\nTask ID %d:\n"), *ada_task);
+ thr_header = string_printf (_ ("\nTask ID %d:\n"), *ada_task);
else
- thr_header = string_printf (_("\nThread %s (%s):\n"),
- print_thread_id (thr),
- thread_target_id_str (thr).c_str ());
+ thr_header
+ = string_printf (_ ("\nThread %s (%s):\n"), print_thread_id (thr),
+ thread_target_id_str (thr).c_str ());
try
{
std::string cmd_result;
- execute_command_to_string
- (cmd_result, cmd, from_tty, gdb_stdout->term_out ());
+ execute_command_to_string (cmd_result, cmd, from_tty,
+ gdb_stdout->term_out ());
if (!flags.silent || cmd_result.length () > 0)
{
if (!flags.quiet)
@@ -1516,7 +1511,7 @@ thread_try_catch_cmd (thread_info *thr, gdb::optional<int> ada_task,
static const gdb::option::flag_option_def<> ascending_option_def = {
"ascending",
- N_("\
+ N_ ("\
Call COMMAND for all threads in ascending order.\n\
The default is descending order."),
};
@@ -1524,23 +1519,25 @@ The default is descending order."),
/* The qcs command line flags for the "thread apply" commands. Keep
this in sync with the "frame apply" commands. */
-using qcs_flag_option_def
- = gdb::option::flag_option_def<qcs_flags>;
+using qcs_flag_option_def = gdb::option::flag_option_def<qcs_flags>;
static const gdb::option::option_def thr_qcs_flags_option_defs[] = {
qcs_flag_option_def {
- "q", [] (qcs_flags *opt) { return &opt->quiet; },
- N_("Disables printing the thread information."),
+ "q",
+ [] (qcs_flags *opt) { return &opt->quiet; },
+ N_ ("Disables printing the thread information."),
},
qcs_flag_option_def {
- "c", [] (qcs_flags *opt) { return &opt->cont; },
- N_("Print any error raised by COMMAND and continue."),
+ "c",
+ [] (qcs_flags *opt) { return &opt->cont; },
+ N_ ("Print any error raised by COMMAND and continue."),
},
qcs_flag_option_def {
- "s", [] (qcs_flags *opt) { return &opt->silent; },
- N_("Silently ignore any errors or empty output produced by COMMAND."),
+ "s",
+ [] (qcs_flags *opt) { return &opt->silent; },
+ N_ ("Silently ignore any errors or empty output produced by COMMAND."),
},
};
@@ -1548,13 +1545,12 @@ static const gdb::option::option_def thr_qcs_flags_option_defs[] = {
ASCENDING and FLAGS as context. */
static inline std::array<gdb::option::option_def_group, 2>
-make_thread_apply_all_options_def_group (bool *ascending,
- qcs_flags *flags)
+make_thread_apply_all_options_def_group (bool *ascending, qcs_flags *flags)
{
- return {{
- { {ascending_option_def.def ()}, ascending},
- { {thr_qcs_flags_option_defs}, flags },
- }};
+ return { {
+ { { ascending_option_def.def () }, ascending },
+ { { thr_qcs_flags_option_defs }, flags },
+ } };
}
/* Create an option_def_group for the "thread apply" options, with
@@ -1563,7 +1559,7 @@ make_thread_apply_all_options_def_group (bool *ascending,
static inline gdb::option::option_def_group
make_thread_apply_options_def_group (qcs_flags *flags)
{
- return {{thr_qcs_flags_option_defs}, flags};
+ return { { thr_qcs_flags_option_defs }, flags };
}
/* Apply a GDB command to a list of threads. List syntax is a whitespace
@@ -1580,15 +1576,14 @@ thread_apply_all_command (const char *cmd, int from_tty)
bool ascending = false;
qcs_flags flags;
- auto group = make_thread_apply_all_options_def_group (&ascending,
- &flags);
- gdb::option::process_options
- (&cmd, gdb::option::PROCESS_OPTIONS_UNKNOWN_IS_OPERAND, group);
+ auto group = make_thread_apply_all_options_def_group (&ascending, &flags);
+ gdb::option::process_options (
+ &cmd, gdb::option::PROCESS_OPTIONS_UNKNOWN_IS_OPERAND, group);
validate_flags_qcs ("thread apply all", &flags);
if (cmd == NULL || *cmd == '\000')
- error (_("Please specify a command at the end of 'thread apply all'"));
+ error (_ ("Please specify a command at the end of 'thread apply all'"));
update_thread_list ();
@@ -1607,9 +1602,8 @@ thread_apply_all_command (const char *cmd, int from_tty)
thr_list_cpy.push_back (thread_info_ref::new_reference (tp));
gdb_assert (thr_list_cpy.size () == tc);
- auto *sorter = (ascending
- ? tp_array_compar_ascending
- : tp_array_compar_descending);
+ auto *sorter
+ = (ascending ? tp_array_compar_ascending : tp_array_compar_descending);
std::sort (thr_list_cpy.begin (), thr_list_cpy.end (), sorter);
scoped_restore_current_thread restore_thread;
@@ -1624,8 +1618,8 @@ thread_apply_all_command (const char *cmd, int from_tty)
static void
thread_apply_command_completer (cmd_list_element *ignore,
- completion_tracker &tracker,
- const char *text, const char * /*word*/)
+ completion_tracker &tracker, const char *text,
+ const char * /*word*/)
{
/* Don't leave this to complete_options because there's an early
return below. */
@@ -1663,8 +1657,7 @@ thread_apply_command_completer (cmd_list_element *ignore,
}
/* Check if we're past a valid thread ID list already. */
- if (parser.finished ()
- && cmd > text && !isspace (cmd[-1]))
+ if (parser.finished () && cmd > text && !isspace (cmd[-1]))
return;
/* We're past the thread ID list, advance word point. */
@@ -1672,8 +1665,9 @@ thread_apply_command_completer (cmd_list_element *ignore,
text = cmd;
const auto group = make_thread_apply_options_def_group (nullptr);
- if (gdb::option::complete_options
- (tracker, &text, gdb::option::PROCESS_OPTIONS_UNKNOWN_IS_OPERAND, group))
+ if (gdb::option::complete_options (
+ tracker, &text, gdb::option::PROCESS_OPTIONS_UNKNOWN_IS_OPERAND,
+ group))
return;
complete_nested_command_line (tracker, text);
@@ -1686,10 +1680,11 @@ thread_apply_all_command_completer (cmd_list_element *ignore,
completion_tracker &tracker,
const char *text, const char *word)
{
- const auto group = make_thread_apply_all_options_def_group (nullptr,
- nullptr);
- if (gdb::option::complete_options
- (tracker, &text, gdb::option::PROCESS_OPTIONS_UNKNOWN_IS_OPERAND, group))
+ const auto group
+ = make_thread_apply_all_options_def_group (nullptr, nullptr);
+ if (gdb::option::complete_options (
+ tracker, &text, gdb::option::PROCESS_OPTIONS_UNKNOWN_IS_OPERAND,
+ group))
return;
complete_nested_command_line (tracker, text);
@@ -1705,7 +1700,7 @@ thread_apply_command (const char *tidlist, int from_tty)
tid_range_parser parser;
if (tidlist == NULL || *tidlist == '\000')
- error (_("Please specify a thread ID list"));
+ error (_ ("Please specify a thread ID list"));
parser.init (tidlist, current_inferior ()->num);
while (!parser.finished ())
@@ -1719,13 +1714,13 @@ thread_apply_command (const char *tidlist, int from_tty)
cmd = parser.cur_tok ();
auto group = make_thread_apply_options_def_group (&flags);
- gdb::option::process_options
- (&cmd, gdb::option::PROCESS_OPTIONS_UNKNOWN_IS_OPERAND, group);
+ gdb::option::process_options (
+ &cmd, gdb::option::PROCESS_OPTIONS_UNKNOWN_IS_OPERAND, group);
validate_flags_qcs ("thread apply", &flags);
if (*cmd == '\0')
- error (_("Please specify a command following the thread ID list"));
+ error (_ ("Please specify a command following the thread ID list"));
if (tidlist == cmd || isdigit (cmd[0]))
invalid_thread_id_error (cmd);
@@ -1748,7 +1743,7 @@ thread_apply_command (const char *tidlist, int from_tty)
{
if (inf == NULL)
{
- warning (_("Unknown inferior %d"), inf_num);
+ warning (_ ("Unknown inferior %d"), inf_num);
parser.skip_range ();
continue;
}
@@ -1766,15 +1761,15 @@ thread_apply_command (const char *tidlist, int from_tty)
if (tp == NULL)
{
if (show_inferior_qualified_tids () || parser.tid_is_qualified ())
- warning (_("Unknown thread %d.%d"), inf_num, thr_num);
+ warning (_ ("Unknown thread %d.%d"), inf_num, thr_num);
else
- warning (_("Unknown thread %d"), thr_num);
+ warning (_ ("Unknown thread %d"), thr_num);
continue;
}
if (!switch_to_thread_if_alive (tp))
{
- warning (_("Thread %s has terminated."), print_thread_id (tp));
+ warning (_ ("Thread %s has terminated."), print_thread_id (tp));
continue;
}
@@ -1782,14 +1777,13 @@ thread_apply_command (const char *tidlist, int from_tty)
}
}
-
/* Implementation of the "taas" command. */
static void
taas_command (const char *cmd, int from_tty)
{
if (cmd == NULL || *cmd == '\0')
- error (_("Please specify a command to apply on all threads"));
+ error (_ ("Please specify a command to apply on all threads"));
std::string expanded = std::string ("thread apply all -s ") + cmd;
execute_command (expanded.c_str (), from_tty);
}
@@ -1800,7 +1794,8 @@ static void
tfaas_command (const char *cmd, int from_tty)
{
if (cmd == NULL || *cmd == '\0')
- error (_("Please specify a command to apply on all frames of all threads"));
+ error (
+ _ ("Please specify a command to apply on all frames of all threads"));
std::string expanded
= std::string ("thread apply all -s -- frame apply all -s ") + cmd;
execute_command (expanded.c_str (), from_tty);
@@ -1814,23 +1809,23 @@ thread_command (const char *tidstr, int from_tty)
if (tidstr == NULL)
{
if (inferior_ptid == null_ptid)
- error (_("No thread selected"));
+ error (_ ("No thread selected"));
if (target_has_stack ())
{
struct thread_info *tp = inferior_thread ();
if (tp->state == THREAD_EXITED)
- gdb_printf (_("[Current thread is %s (%s) (exited)]\n"),
+ gdb_printf (_ ("[Current thread is %s (%s) (exited)]\n"),
print_thread_id (tp),
target_pid_to_str (inferior_ptid).c_str ());
else
- gdb_printf (_("[Current thread is %s (%s)]\n"),
+ gdb_printf (_ ("[Current thread is %s (%s)]\n"),
print_thread_id (tp),
target_pid_to_str (inferior_ptid).c_str ());
}
else
- error (_("No stack."));
+ error (_ ("No stack."));
}
else
{
@@ -1842,14 +1837,13 @@ thread_command (const char *tidstr, int from_tty)
be sent. */
if (inferior_ptid == previous_ptid)
{
- print_selected_thread_frame (current_uiout,
- USER_SELECTED_THREAD
- | USER_SELECTED_FRAME);
+ print_selected_thread_frame (current_uiout, USER_SELECTED_THREAD
+ | USER_SELECTED_FRAME);
}
else
{
- gdb::observers::user_selected_context_changed.notify
- (USER_SELECTED_THREAD | USER_SELECTED_FRAME);
+ gdb::observers::user_selected_context_changed.notify (
+ USER_SELECTED_THREAD | USER_SELECTED_FRAME);
}
}
}
@@ -1862,7 +1856,7 @@ thread_name_command (const char *arg, int from_tty)
struct thread_info *info;
if (inferior_ptid == null_ptid)
- error (_("No thread selected"));
+ error (_ ("No thread selected"));
arg = skip_spaces (arg);
@@ -1879,11 +1873,11 @@ thread_find_command (const char *arg, int from_tty)
unsigned long match = 0;
if (arg == NULL || *arg == '\0')
- error (_("Command requires an argument."));
+ error (_ ("Command requires an argument."));
tmp = re_comp (arg);
if (tmp != 0)
- error (_("Invalid regexp (%s): %s"), tmp, arg);
+ error (_ ("Invalid regexp (%s): %s"), tmp, arg);
/* We're going to be switching threads. */
scoped_restore_current_thread restore_thread;
@@ -1896,15 +1890,15 @@ thread_find_command (const char *arg, int from_tty)
if (tp->name () != nullptr && re_exec (tp->name ()))
{
- gdb_printf (_("Thread %s has name '%s'\n"),
- print_thread_id (tp), tp->name ());
+ gdb_printf (_ ("Thread %s has name '%s'\n"), print_thread_id (tp),
+ tp->name ());
match++;
}
tmp = target_thread_name (tp);
if (tmp != NULL && re_exec (tmp))
{
- gdb_printf (_("Thread %s has target name '%s'\n"),
+ gdb_printf (_ ("Thread %s has target name '%s'\n"),
print_thread_id (tp), tmp);
match++;
}
@@ -1912,7 +1906,7 @@ thread_find_command (const char *arg, int from_tty)
std::string name = target_pid_to_str (tp->ptid);
if (!name.empty () && re_exec (name.c_str ()))
{
- gdb_printf (_("Thread %s has target id '%s'\n"),
+ gdb_printf (_ ("Thread %s has target id '%s'\n"),
print_thread_id (tp), name.c_str ());
match++;
}
@@ -1920,24 +1914,23 @@ thread_find_command (const char *arg, int from_tty)
tmp = target_extra_thread_info (tp);
if (tmp != NULL && re_exec (tmp))
{
- gdb_printf (_("Thread %s has extra info '%s'\n"),
+ gdb_printf (_ ("Thread %s has extra info '%s'\n"),
print_thread_id (tp), tmp);
match++;
}
}
if (!match)
- gdb_printf (_("No threads match '%s'\n"), arg);
+ gdb_printf (_ ("No threads match '%s'\n"), arg);
}
/* Print notices when new threads are attached and detached. */
bool print_thread_events = true;
+
static void
show_print_thread_events (struct ui_file *file, int from_tty,
struct cmd_list_element *c, const char *value)
{
- gdb_printf (file,
- _("Printing of thread events is %s.\n"),
- value);
+ gdb_printf (file, _ ("Printing of thread events is %s.\n"), value);
}
/* See gdbthread.h. */
@@ -1946,7 +1939,7 @@ void
thread_select (const char *tidstr, thread_info *tp)
{
if (!switch_to_thread_if_alive (tp))
- error (_("Thread ID %s has terminated."), tidstr);
+ error (_ ("Thread ID %s has terminated."), tidstr);
annotate_thread_changed ();
@@ -1991,8 +1984,8 @@ print_selected_thread_frame (struct ui_out *uiout,
uiout->text ("\n");
if (has_stack_frames ())
- print_stack_frame_to_uiout (uiout, get_selected_frame (NULL),
- 1, SRC_AND_LOC, 1);
+ print_stack_frame_to_uiout (uiout, get_selected_frame (NULL), 1,
+ SRC_AND_LOC, 1);
}
}
@@ -2108,8 +2101,7 @@ thread_num_make_value_helper (struct gdbarch *gdbarch, int global)
static struct value *
thread_id_per_inf_num_make_value (struct gdbarch *gdbarch,
- struct internalvar *var,
- void *ignore)
+ struct internalvar *var, void *ignore)
{
return thread_num_make_value_helper (gdbarch, 0);
}
@@ -2145,29 +2137,27 @@ struct cmd_list_element *thread_cmd_list = NULL;
/* Implementation of `thread' variable. */
-static const struct internalvar_funcs thread_funcs =
-{
+static const struct internalvar_funcs thread_funcs = {
thread_id_per_inf_num_make_value,
NULL,
};
/* Implementation of `gthread' variable. */
-static const struct internalvar_funcs gthread_funcs =
-{
+static const struct internalvar_funcs gthread_funcs = {
global_thread_id_make_value,
NULL,
};
/* Implementation of `_inferior_thread_count` convenience variable. */
-static const struct internalvar_funcs inferior_thread_count_funcs =
-{
+static const struct internalvar_funcs inferior_thread_count_funcs = {
inferior_thread_count_make_value,
NULL,
};
void _initialize_thread ();
+
void
_initialize_thread ()
{
@@ -2179,7 +2169,7 @@ _initialize_thread ()
/* Note: keep this "ID" in sync with what "info threads [TAB]"
suggests. */
static std::string info_threads_help
- = gdb::option::build_help (_("\
+ = gdb::option::build_help (_ ("\
Display currently known threads.\n\
Usage: info threads [OPTION]... [ID]...\n\
If ID is given, it is a space-separated list of IDs of threads to display.\n\
@@ -2193,14 +2183,15 @@ Options:\n\
set_cmd_completer_handle_brkchars (c, info_threads_command_completer);
cmd_list_element *thread_cmd
- = add_prefix_cmd ("thread", class_run, thread_command, _("\
+ = add_prefix_cmd ("thread", class_run, thread_command, _ ("\
Use this command to switch between threads.\n\
The new thread ID must be currently known."),
&thread_cmd_list, 1, &cmdlist);
add_com_alias ("t", thread_cmd, class_run, 1);
-#define THREAD_APPLY_OPTION_HELP "\
+#define THREAD_APPLY_OPTION_HELP \
+ "\
Prints per-inferior thread number and target system's thread id\n\
followed by COMMAND output.\n\
\n\
@@ -2212,42 +2203,40 @@ Options:\n\
const auto thread_apply_opts = make_thread_apply_options_def_group (nullptr);
- static std::string thread_apply_help = gdb::option::build_help (_("\
+ static std::string thread_apply_help
+ = gdb::option::build_help (_ ("\
Apply a command to a list of threads.\n\
Usage: thread apply ID... [OPTION]... COMMAND\n\
-ID is a space-separated list of IDs of threads to apply COMMAND on.\n"
-THREAD_APPLY_OPTION_HELP),
+ID is a space-separated list of IDs of threads to apply COMMAND on.\n" THREAD_APPLY_OPTION_HELP),
thread_apply_opts);
c = add_prefix_cmd ("apply", class_run, thread_apply_command,
- thread_apply_help.c_str (),
- &thread_apply_list, 1,
+ thread_apply_help.c_str (), &thread_apply_list, 1,
&thread_cmd_list);
set_cmd_completer_handle_brkchars (c, thread_apply_command_completer);
const auto thread_apply_all_opts
= make_thread_apply_all_options_def_group (nullptr, nullptr);
- static std::string thread_apply_all_help = gdb::option::build_help (_("\
+ static std::string thread_apply_all_help
+ = gdb::option::build_help (_ ("\
Apply a command to all threads.\n\
\n\
-Usage: thread apply all [OPTION]... COMMAND\n"
-THREAD_APPLY_OPTION_HELP),
+Usage: thread apply all [OPTION]... COMMAND\n" THREAD_APPLY_OPTION_HELP),
thread_apply_all_opts);
c = add_cmd ("all", class_run, thread_apply_all_command,
- thread_apply_all_help.c_str (),
- &thread_apply_list);
+ thread_apply_all_help.c_str (), &thread_apply_list);
set_cmd_completer_handle_brkchars (c, thread_apply_all_command_completer);
- c = add_com ("taas", class_run, taas_command, _("\
+ c = add_com ("taas", class_run, taas_command, _ ("\
Apply a command to all threads (ignoring errors and empty output).\n\
Usage: taas [OPTION]... COMMAND\n\
shortcut for 'thread apply all -s [OPTION]... COMMAND'\n\
See \"help thread apply all\" for available options."));
set_cmd_completer_handle_brkchars (c, thread_apply_all_command_completer);
- c = add_com ("tfaas", class_run, tfaas_command, _("\
+ c = add_com ("tfaas", class_run, tfaas_command, _ ("\
Apply a command to all frames of all threads (ignoring errors and empty output).\n\
Usage: tfaas [OPTION]... COMMAND\n\
shortcut for 'thread apply all -s -- frame apply all -s [OPTION]... COMMAND'\n\
@@ -2255,31 +2244,33 @@ See \"help frame apply all\" for available options."));
set_cmd_completer_handle_brkchars (c, frame_apply_all_cmd_completer);
add_cmd ("name", class_run, thread_name_command,
- _("Set the current thread's name.\n\
+ _ ("Set the current thread's name.\n\
Usage: thread name [NAME]\n\
-If NAME is not given, then any existing name is removed."), &thread_cmd_list);
+If NAME is not given, then any existing name is removed."),
+ &thread_cmd_list);
- add_cmd ("find", class_run, thread_find_command, _("\
+ add_cmd ("find", class_run, thread_find_command, _ ("\
Find threads that match a regular expression.\n\
Usage: thread find REGEXP\n\
Will display thread ids whose name, target ID, or extra info matches REGEXP."),
&thread_cmd_list);
- add_setshow_boolean_cmd ("thread-events", no_class,
- &print_thread_events, _("\
-Set printing of thread events (such as thread start and exit)."), _("\
-Show printing of thread events (such as thread start and exit)."), NULL,
- NULL,
- show_print_thread_events,
- &setprintlist, &showprintlist);
-
- add_setshow_boolean_cmd ("threads", class_maintenance, &debug_threads, _("\
-Set thread debugging."), _("\
-Show thread debugging."), _("\
+ add_setshow_boolean_cmd ("thread-events", no_class, &print_thread_events,
+ _ ("\
+Set printing of thread events (such as thread start and exit)."),
+ _ ("\
+Show printing of thread events (such as thread start and exit)."),
+ NULL, NULL, show_print_thread_events, &setprintlist,
+ &showprintlist);
+
+ add_setshow_boolean_cmd ("threads", class_maintenance, &debug_threads, _ ("\
+Set thread debugging."),
+ _ ("\
+Show thread debugging."),
+ _ ("\
When on messages about thread creation and deletion are printed."),
- nullptr,
- show_debug_threads,
- &setdebuglist, &showdebuglist);
+ nullptr, show_debug_threads, &setdebuglist,
+ &showdebuglist);
create_internalvar_type_lazy ("_thread", &thread_funcs, NULL);
create_internalvar_type_lazy ("_gthread", &gthread_funcs, NULL);
diff --git a/gdb/tic6x-linux-tdep.c b/gdb/tic6x-linux-tdep.c
index a070a0cddbe..74072563246 100644
--- a/gdb/tic6x-linux-tdep.c
+++ b/gdb/tic6x-linux-tdep.c
@@ -50,22 +50,22 @@ tic6x_register_sigcontext_offset (unsigned int regnum, struct gdbarch *gdbarch)
if (regnum == TIC6X_A4_REGNUM || regnum == TIC6X_A4_REGNUM + 2
|| regnum == TIC6X_A4_REGNUM + 4)
- return 4 * (regnum - TIC6X_A4_REGNUM + 2); /* A4, A6, A8 */
+ return 4 * (regnum - TIC6X_A4_REGNUM + 2); /* A4, A6, A8 */
else if (regnum == TIC6X_A5_REGNUM || regnum == TIC6X_A5_REGNUM + 2
|| regnum == TIC6X_A5_REGNUM + 4)
- return 4 * (regnum - TIC6X_A5_REGNUM + 12); /* A5, A7, A9 */
+ return 4 * (regnum - TIC6X_A5_REGNUM + 12); /* A5, A7, A9 */
else if (regnum == TIC6X_B4_REGNUM || regnum == TIC6X_B4_REGNUM + 2
|| regnum == TIC6X_B4_REGNUM + 4)
- return 4 * (regnum - TIC6X_B4_REGNUM + 3); /* B4, B6, B8 */
+ return 4 * (regnum - TIC6X_B4_REGNUM + 3); /* B4, B6, B8 */
else if (regnum == TIC6X_B5_REGNUM || regnum == TIC6X_B5_REGNUM + 2
|| regnum == TIC6X_B5_REGNUM + 4)
- return 4 * (regnum - TIC6X_B5_REGNUM + 19); /* B5, B7, B9 */
+ return 4 * (regnum - TIC6X_B5_REGNUM + 19); /* B5, B7, B9 */
else if (regnum < TIC6X_A4_REGNUM)
- return 4 * (regnum - 0 + 8); /* A0 - A3 */
+ return 4 * (regnum - 0 + 8); /* A0 - A3 */
else if (regnum >= TIC6X_B0_REGNUM && regnum < TIC6X_B4_REGNUM)
- return 4 * (regnum - TIC6X_B0_REGNUM + 15); /* B0 - B3 */
+ return 4 * (regnum - TIC6X_B0_REGNUM + 15); /* B0 - B3 */
else if (regnum >= 34 && regnum < 34 + 32)
- return 4 * (regnum - 34 + 23); /* A16 - A31, B16 - B31 */
+ return 4 * (regnum - 34 + 23); /* A16 - A31, B16 - B31 */
else if (regnum == TIC6X_PC_REGNUM)
return 4 * (tdep->has_gp ? 55 : 23);
else if (regnum == TIC6X_SP_REGNUM)
@@ -87,17 +87,17 @@ tic6x_linux_rt_sigreturn_init (const struct tramp_frame *self,
CORE_ADDR sp = get_frame_register_unsigned (this_frame, TIC6X_SP_REGNUM);
/* The base of struct sigcontext is computed by examining the definition of
struct rt_sigframe in linux kernel source arch/c6x/kernel/signal.c. */
- CORE_ADDR base = (sp + TIC6X_SP_RT_SIGFRAME
+ CORE_ADDR base = (sp
+ + TIC6X_SP_RT_SIGFRAME
/* Pointer type *pinfo and *puc in struct rt_sigframe. */
- + 4 + 4
- + TIC6X_SIGINFO_SIZE
- + 4 + 4 /* uc_flags and *uc_link in struct ucontext. */
+ + 4 + 4 + TIC6X_SIGINFO_SIZE + 4
+ + 4 /* uc_flags and *uc_link in struct ucontext. */
+ TIC6X_STACK_T_SIZE);
tic6x_gdbarch_tdep *tdep = gdbarch_tdep<tic6x_gdbarch_tdep> (gdbarch);
unsigned int reg_offset;
unsigned int i;
- for (i = 0; i < 10; i++) /* A0 - A9 */
+ for (i = 0; i < 10; i++) /* A0 - A9 */
{
reg_offset = tic6x_register_sigcontext_offset (i, gdbarch);
gdb_assert (reg_offset != 0);
@@ -105,7 +105,7 @@ tic6x_linux_rt_sigreturn_init (const struct tramp_frame *self,
trad_frame_set_reg_addr (this_cache, i, base + reg_offset);
}
- for (i = TIC6X_B0_REGNUM; i < TIC6X_B0_REGNUM + 10; i++) /* B0 - B9 */
+ for (i = TIC6X_B0_REGNUM; i < TIC6X_B0_REGNUM + 10; i++) /* B0 - B9 */
{
reg_offset = tic6x_register_sigcontext_offset (i, gdbarch);
gdb_assert (reg_offset != 0);
@@ -114,7 +114,7 @@ tic6x_linux_rt_sigreturn_init (const struct tramp_frame *self,
}
if (tdep->has_gp)
- for (i = 34; i < 34 + 32; i++) /* A16 - A31, B16 - B31 */
+ for (i = 34; i < 34 + 32; i++) /* A16 - A31, B16 - B31 */
{
reg_offset = tic6x_register_sigcontext_offset (i, gdbarch);
gdb_assert (reg_offset != 0);
@@ -122,28 +122,24 @@ tic6x_linux_rt_sigreturn_init (const struct tramp_frame *self,
trad_frame_set_reg_addr (this_cache, i, base + reg_offset);
}
- trad_frame_set_reg_addr (this_cache, TIC6X_PC_REGNUM,
- base + tic6x_register_sigcontext_offset (TIC6X_PC_REGNUM,
- gdbarch));
- trad_frame_set_reg_addr (this_cache, TIC6X_SP_REGNUM,
- base + tic6x_register_sigcontext_offset (TIC6X_SP_REGNUM,
- gdbarch));
+ trad_frame_set_reg_addr (
+ this_cache, TIC6X_PC_REGNUM,
+ base + tic6x_register_sigcontext_offset (TIC6X_PC_REGNUM, gdbarch));
+ trad_frame_set_reg_addr (
+ this_cache, TIC6X_SP_REGNUM,
+ base + tic6x_register_sigcontext_offset (TIC6X_SP_REGNUM, gdbarch));
/* Save a frame ID. */
trad_frame_set_id (this_cache, frame_id_build (sp, func));
}
-static struct tramp_frame tic6x_linux_rt_sigreturn_tramp_frame =
-{
- SIGTRAMP_FRAME,
- 4,
- {
- {0x000045aa, 0x0fffffff}, /* mvk .S2 139,b0 */
- {0x10000000, ULONGEST_MAX}, /* swe */
- {TRAMP_SENTINEL_INSN}
- },
- tic6x_linux_rt_sigreturn_init
-};
+static struct tramp_frame tic6x_linux_rt_sigreturn_tramp_frame
+ = { SIGTRAMP_FRAME,
+ 4,
+ { { 0x000045aa, 0x0fffffff }, /* mvk .S2 139,b0 */
+ { 0x10000000, ULONGEST_MAX }, /* swe */
+ { TRAMP_SENTINEL_INSN } },
+ tic6x_linux_rt_sigreturn_init };
/* When FRAME is at a syscall instruction, return the PC of the next
instruction to be executed. */
@@ -151,8 +147,8 @@ static struct tramp_frame tic6x_linux_rt_sigreturn_tramp_frame =
static CORE_ADDR
tic6x_linux_syscall_next_pc (frame_info_ptr frame)
{
- ULONGEST syscall_number = get_frame_register_unsigned (frame,
- TIC6X_B0_REGNUM);
+ ULONGEST syscall_number
+ = get_frame_register_unsigned (frame, TIC6X_B0_REGNUM);
CORE_ADDR pc = get_frame_pc (frame);
if (syscall_number == 139 /* rt_sigreturn */)
@@ -161,7 +157,6 @@ tic6x_linux_syscall_next_pc (frame_info_ptr frame)
return pc + 4;
}
-
static void
tic6x_uclinux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
{
@@ -205,6 +200,7 @@ tic6x_uclinux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
}
void _initialize_tic6x_linux_tdep ();
+
void
_initialize_tic6x_linux_tdep ()
{
diff --git a/gdb/tic6x-tdep.c b/gdb/tic6x-tdep.c
index 6c103943b72..e3d4de56cee 100644
--- a/gdb/tic6x-tdep.c
+++ b/gdb/tic6x-tdep.c
@@ -78,19 +78,17 @@ struct tic6x_unwind_cache
CORE_ADDR reg_saved[TIC6X_NUM_CORE_REGS];
};
-
/* Name of TI C6x core registers. */
-static const char *const tic6x_register_names[] =
-{
- "A0", "A1", "A2", "A3", /* 0 1 2 3 */
- "A4", "A5", "A6", "A7", /* 4 5 6 7 */
- "A8", "A9", "A10", "A11", /* 8 9 10 11 */
+static const char *const tic6x_register_names[] = {
+ "A0", "A1", "A2", "A3", /* 0 1 2 3 */
+ "A4", "A5", "A6", "A7", /* 4 5 6 7 */
+ "A8", "A9", "A10", "A11", /* 8 9 10 11 */
"A12", "A13", "A14", "A15", /* 12 13 14 15 */
- "B0", "B1", "B2", "B3", /* 16 17 18 19 */
- "B4", "B5", "B6", "B7", /* 20 21 22 23 */
- "B8", "B9", "B10", "B11", /* 24 25 26 27 */
+ "B0", "B1", "B2", "B3", /* 16 17 18 19 */
+ "B4", "B5", "B6", "B7", /* 20 21 22 23 */
+ "B8", "B9", "B10", "B11", /* 24 25 26 27 */
"B12", "B13", "B14", "B15", /* 28 29 30 31 */
- "CSR", "PC", /* 32 33 */
+ "CSR", "PC", /* 32 33 */
};
/* This array maps the arguments to the register number which passes argument
@@ -115,7 +113,6 @@ tic6x_register_name (struct gdbarch *gdbarch, int regno)
static struct type *
tic6x_register_type (struct gdbarch *gdbarch, int regno)
{
-
if (regno == TIC6X_PC_REGNUM)
return builtin_type (gdbarch)->builtin_func_ptr;
else
@@ -184,11 +181,11 @@ tic6x_analyze_prologue (struct gdbarch *gdbarch, const CORE_ADDR start_pc,
these three kinds of instructions. */
unsigned int ucst5 = (inst >> 13) & 0x1f;
- if ((inst & 0x1ffc) == 0x1dc0) /* SUBAW */
+ if ((inst & 0x1ffc) == 0x1dc0) /* SUBAW */
frame_base_offset_to_sp += ucst5 << 2;
- else if ((inst & 0x1ffc) == 0x1bc0) /* SUBAH */
+ else if ((inst & 0x1ffc) == 0x1bc0) /* SUBAH */
frame_base_offset_to_sp += ucst5 << 1;
- else if ((inst & 0x0ffc) == 0x9c0) /* SUB */
+ else if ((inst & 0x0ffc) == 0x9c0) /* SUB */
frame_base_offset_to_sp += ucst5;
else
gdb_assert_not_reached ("unexpected instruction");
@@ -196,11 +193,11 @@ tic6x_analyze_prologue (struct gdbarch *gdbarch, const CORE_ADDR start_pc,
return_pc = pc + 4;
}
}
- else if ((inst & 0x174) == 0x74) /* stw SRC, *+b15(uconst) */
+ else if ((inst & 0x174) == 0x74) /* stw SRC, *+b15(uconst) */
{
/* The y bit determines which file base is read from. */
- base_reg = tic6x_register_number ((inst >> 18) & 0x1f,
- (inst >> 7) & 1, 0);
+ base_reg
+ = tic6x_register_number ((inst >> 18) & 0x1f, (inst >> 7) & 1, 0);
if (base_reg == TIC6X_SP_REGNUM)
{
@@ -233,7 +230,6 @@ tic6x_analyze_prologue (struct gdbarch *gdbarch, const CORE_ADDR start_pc,
break;
}
-
pc += 4;
}
/* Step 2: Skip insn on setting up dsbt if it is. Usually, it looks like,
@@ -246,9 +242,9 @@ tic6x_analyze_prologue (struct gdbarch *gdbarch, const CORE_ADDR start_pc,
used. */
base_reg = tic6x_register_number ((inst >> 18) & 0x1f, (inst >> 7) & 1, 0);
- if ((inst & 0x164) == 0x64 /* ldw */
- && dst_reg == TIC6X_DP_REGNUM /* dst is B14 */
- && base_reg == TIC6X_DP_REGNUM) /* baseR is B14 */
+ if ((inst & 0x164) == 0x64 /* ldw */
+ && dst_reg == TIC6X_DP_REGNUM /* dst is B14 */
+ && base_reg == TIC6X_DP_REGNUM) /* baseR is B14 */
{
return_pc = pc + 4;
}
@@ -262,8 +258,8 @@ tic6x_analyze_prologue (struct gdbarch *gdbarch, const CORE_ADDR start_pc,
/* If the FP now holds an offset from the CFA then this is a frame
which uses the frame pointer. */
- cache->cfa = get_frame_register_unsigned (this_frame,
- TIC6X_FP_REGNUM);
+ cache->cfa
+ = get_frame_register_unsigned (this_frame, TIC6X_FP_REGNUM);
}
else
{
@@ -369,13 +365,13 @@ tic6x_unwind_pc (struct gdbarch *gdbarch, frame_info_ptr next_frame)
{
gdb_byte buf[8];
- frame_unwind_register (next_frame, TIC6X_PC_REGNUM, buf);
+ frame_unwind_register (next_frame, TIC6X_PC_REGNUM, buf);
return extract_typed_address (buf, builtin_type (gdbarch)->builtin_func_ptr);
}
/* Frame base handling. */
-static struct tic6x_unwind_cache*
+static struct tic6x_unwind_cache *
tic6x_frame_unwind_cache (frame_info_ptr this_frame,
void **this_prologue_cache)
{
@@ -407,8 +403,8 @@ static void
tic6x_frame_this_id (frame_info_ptr this_frame, void **this_cache,
struct frame_id *this_id)
{
- struct tic6x_unwind_cache *cache =
- tic6x_frame_unwind_cache (this_frame, this_cache);
+ struct tic6x_unwind_cache *cache
+ = tic6x_frame_unwind_cache (this_frame, this_cache);
/* This marks the outermost frame. */
if (cache->base == 0)
@@ -421,8 +417,8 @@ static struct value *
tic6x_frame_prev_register (frame_info_ptr this_frame, void **this_cache,
int regnum)
{
- struct tic6x_unwind_cache *cache =
- tic6x_frame_unwind_cache (this_frame, this_cache);
+ struct tic6x_unwind_cache *cache
+ = tic6x_frame_unwind_cache (this_frame, this_cache);
gdb_assert (regnum >= 0);
@@ -452,25 +448,18 @@ tic6x_frame_base_address (frame_info_ptr this_frame, void **this_cache)
return info->base;
}
-static const struct frame_unwind tic6x_frame_unwind =
-{
- "tic6x prologue",
- NORMAL_FRAME,
- default_frame_unwind_stop_reason,
- tic6x_frame_this_id,
- tic6x_frame_prev_register,
- NULL,
- default_frame_sniffer
-};
-
-static const struct frame_base tic6x_frame_base =
-{
- &tic6x_frame_unwind,
- tic6x_frame_base_address,
- tic6x_frame_base_address,
- tic6x_frame_base_address
-};
+static const struct frame_unwind tic6x_frame_unwind
+ = { "tic6x prologue",
+ NORMAL_FRAME,
+ default_frame_unwind_stop_reason,
+ tic6x_frame_this_id,
+ tic6x_frame_prev_register,
+ NULL,
+ default_frame_sniffer };
+static const struct frame_base tic6x_frame_base
+ = { &tic6x_frame_unwind, tic6x_frame_base_address, tic6x_frame_base_address,
+ tic6x_frame_base_address };
static struct tic6x_unwind_cache *
tic6x_make_stub_cache (frame_info_ptr this_frame)
@@ -515,16 +504,14 @@ tic6x_stub_unwind_sniffer (const struct frame_unwind *self,
return 0;
}
-static const struct frame_unwind tic6x_stub_unwind =
-{
- "tic6x stub",
- NORMAL_FRAME,
- default_frame_unwind_stop_reason,
- tic6x_stub_this_id,
- tic6x_frame_prev_register,
- NULL,
- tic6x_stub_unwind_sniffer
-};
+static const struct frame_unwind tic6x_stub_unwind
+ = { "tic6x stub",
+ NORMAL_FRAME,
+ default_frame_unwind_stop_reason,
+ tic6x_stub_this_id,
+ tic6x_frame_prev_register,
+ NULL,
+ tic6x_stub_unwind_sniffer };
/* Return the instruction on address PC. */
@@ -615,9 +602,9 @@ tic6x_get_next_pc (struct regcache *regcache, CORE_ADDR pc)
{
/* B with register */
- register_number = tic6x_register_number ((inst >> 18) & 0x1f,
- INST_S_BIT (inst),
- INST_X_BIT (inst));
+ register_number
+ = tic6x_register_number ((inst >> 18) & 0x1f,
+ INST_S_BIT (inst), INST_X_BIT (inst));
pc = regcache_raw_get_unsigned (regcache, register_number);
break;
}
@@ -643,8 +630,8 @@ tic6x_get_next_pc (struct regcache *regcache, CORE_ADDR pc)
if ((inst & 0x0f830ffe) == 0x00800362)
{
/* BNOP with register */
- register_number = tic6x_register_number ((inst >> 18) & 0x1f,
- 1, INST_X_BIT (inst));
+ register_number = tic6x_register_number ((inst >> 18) & 0x1f, 1,
+ INST_X_BIT (inst));
pc = regcache_raw_get_unsigned (regcache, register_number);
break;
}
@@ -679,9 +666,10 @@ tic6x_get_next_pc (struct regcache *regcache, CORE_ADDR pc)
static std::vector<CORE_ADDR>
tic6x_software_single_step (struct regcache *regcache)
{
- CORE_ADDR next_pc = tic6x_get_next_pc (regcache, regcache_read_pc (regcache));
+ CORE_ADDR next_pc
+ = tic6x_get_next_pc (regcache, regcache_read_pc (regcache));
- return {next_pc};
+ return { next_pc };
}
/* This is the implementation of gdbarch method frame_align. */
@@ -793,11 +781,11 @@ tic6x_return_value (struct gdbarch *gdbarch, struct value *function,
return RETURN_VALUE_STRUCT_CONVENTION;
if (readbuf)
- tic6x_extract_return_value (type, regcache,
- gdbarch_byte_order (gdbarch), readbuf);
+ tic6x_extract_return_value (type, regcache, gdbarch_byte_order (gdbarch),
+ readbuf);
if (writebuf)
- tic6x_store_return_value (type, regcache,
- gdbarch_byte_order (gdbarch), writebuf);
+ tic6x_store_return_value (type, regcache, gdbarch_byte_order (gdbarch),
+ writebuf);
return RETURN_VALUE_REGISTER_CONVENTION;
}
@@ -845,8 +833,7 @@ tic6x_arg_type_alignment (struct type *type)
return 16;
}
else
- internal_error (_("unexpected length %d of type"),
- len);
+ internal_error (_ ("unexpected length %d of type"), len);
}
}
@@ -854,8 +841,8 @@ tic6x_arg_type_alignment (struct type *type)
static CORE_ADDR
tic6x_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
- struct regcache *regcache, CORE_ADDR bp_addr,
- int nargs, struct value **args, CORE_ADDR sp,
+ struct regcache *regcache, CORE_ADDR bp_addr, int nargs,
+ struct value **args, CORE_ADDR sp,
function_call_return_method return_method,
CORE_ADDR struct_addr)
{
@@ -936,8 +923,8 @@ tic6x_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
so, we write the contents in VAL to the lsp of
register. */
if (len < 3 && byte_order == BFD_ENDIAN_BIG)
- regcache->cooked_write_part (arg_regs[argreg], 4 - len, len,
- val);
+ regcache->cooked_write_part (arg_regs[argreg], 4 - len,
+ len, val);
else
regcache->cooked_write (arg_regs[argreg], val);
}
@@ -945,8 +932,8 @@ tic6x_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
{
/* The argument is being passed by value in a single
register. */
- CORE_ADDR regval = extract_unsigned_integer (val, len,
- byte_order);
+ CORE_ADDR regval
+ = extract_unsigned_integer (val, len, byte_order);
regcache_cooked_write_unsigned (regcache, arg_regs[argreg],
regval);
@@ -981,8 +968,8 @@ tic6x_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
{
/* The argument is being passed by value in a pair of
registers. */
- ULONGEST regval = extract_unsigned_integer (val, len,
- byte_order);
+ ULONGEST regval
+ = extract_unsigned_integer (val, len, byte_order);
regcache_cooked_write_unsigned (regcache,
arg_regs[argreg],
@@ -1040,8 +1027,8 @@ tic6x_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
if (len <= 4)
; /* Default is 4-byte aligned. Nothing to be done. */
else if (len <= 8)
- stack_offset = align_up (stack_offset,
- tic6x_arg_type_alignment (arg_type));
+ stack_offset
+ = align_up (stack_offset, tic6x_arg_type_alignment (arg_type));
else if (len == 16)
{
/* _Complex double or _Complex long double */
@@ -1060,14 +1047,13 @@ tic6x_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
store_unsigned_integer ((gdb_byte *) val, 4, byte_order,
addr);
len = 4;
-
}
else
- internal_error (_("unexpected type %d of arg %d"),
- typecode, argnum);
+ internal_error (_ ("unexpected type %d of arg %d"), typecode,
+ argnum);
}
else
- internal_error (_("unexpected length %d of arg %d"), len, argnum);
+ internal_error (_ ("unexpected length %d of arg %d"), len, argnum);
addr = sp + stack_offset;
write_memory (addr, val, len);
@@ -1090,9 +1076,9 @@ tic6x_stack_frame_destroyed_p (struct gdbarch *gdbarch, CORE_ADDR pc)
/* Normally, the epilogue is composed by instruction `b .S2 b3'. */
if ((inst & 0x0f83effc) == 0x360)
{
- unsigned int src2 = tic6x_register_number ((inst >> 18) & 0x1f,
- INST_S_BIT (inst),
- INST_X_BIT (inst));
+ unsigned int src2
+ = tic6x_register_number ((inst >> 18) & 0x1f, INST_S_BIT (inst),
+ INST_X_BIT (inst));
if (src2 == TIC6X_RA_REGNUM)
return 1;
}
@@ -1154,15 +1140,17 @@ tic6x_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
tdesc_data = tdesc_data_alloc ();
valid_p = 1;
- for (i = 0; i < 32; i++) /* A0 - A15, B0 - B15 */
+ for (i = 0; i < 32; i++) /* A0 - A15, B0 - B15 */
valid_p &= tdesc_numbered_register (feature, tdesc_data.get (), i,
tic6x_register_names[i]);
/* CSR */
- valid_p &= tdesc_numbered_register (feature, tdesc_data.get (), i++,
- tic6x_register_names[TIC6X_CSR_REGNUM]);
- valid_p &= tdesc_numbered_register (feature, tdesc_data.get (), i++,
- tic6x_register_names[TIC6X_PC_REGNUM]);
+ valid_p
+ &= tdesc_numbered_register (feature, tdesc_data.get (), i++,
+ tic6x_register_names[TIC6X_CSR_REGNUM]);
+ valid_p
+ &= tdesc_numbered_register (feature, tdesc_data.get (), i++,
+ tic6x_register_names[TIC6X_PC_REGNUM]);
if (!valid_p)
return NULL;
@@ -1171,17 +1159,16 @@ tic6x_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
if (feature)
{
int j = 0;
- static const char *const gp[] =
- {
- "A16", "A17", "A18", "A19", "A20", "A21", "A22", "A23",
- "A24", "A25", "A26", "A27", "A28", "A29", "A30", "A31",
- "B16", "B17", "B18", "B19", "B20", "B21", "B22", "B23",
- "B24", "B25", "B26", "B27", "B28", "B29", "B30", "B31",
- };
+ static const char *const gp[] = {
+ "A16", "A17", "A18", "A19", "A20", "A21", "A22", "A23",
+ "A24", "A25", "A26", "A27", "A28", "A29", "A30", "A31",
+ "B16", "B17", "B18", "B19", "B20", "B21", "B22", "B23",
+ "B24", "B25", "B26", "B27", "B28", "B29", "B30", "B31",
+ };
has_gp = 1;
valid_p = 1;
- for (j = 0; j < 32; j++) /* A16 - A31, B16 - B31 */
+ for (j = 0; j < 32; j++) /* A16 - A31, B16 - B31 */
valid_p &= tdesc_numbered_register (feature, tdesc_data.get (),
i++, gp[j]);
@@ -1192,22 +1179,20 @@ tic6x_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
feature = tdesc_find_feature (tdesc, "org.gnu.gdb.tic6x.c6xp");
if (feature)
{
- valid_p &= tdesc_numbered_register (feature, tdesc_data.get (),
- i++, "TSR");
- valid_p &= tdesc_numbered_register (feature, tdesc_data.get (),
- i++, "ILC");
- valid_p &= tdesc_numbered_register (feature, tdesc_data.get (),
- i++, "RILC");
+ valid_p &= tdesc_numbered_register (feature, tdesc_data.get (), i++,
+ "TSR");
+ valid_p &= tdesc_numbered_register (feature, tdesc_data.get (), i++,
+ "ILC");
+ valid_p &= tdesc_numbered_register (feature, tdesc_data.get (), i++,
+ "RILC");
if (!valid_p)
return NULL;
}
-
}
/* Find a candidate among extant architectures. */
- for (arches = gdbarch_list_lookup_by_info (arches, &info);
- arches != NULL;
+ for (arches = gdbarch_list_lookup_by_info (arches, &info); arches != NULL;
arches = gdbarch_list_lookup_by_info (arches->next, &info))
{
tic6x_gdbarch_tdep *tdep
@@ -1250,10 +1235,8 @@ tic6x_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
set_gdbarch_inner_than (gdbarch, core_addr_lessthan);
set_gdbarch_skip_prologue (gdbarch, tic6x_skip_prologue);
- set_gdbarch_breakpoint_kind_from_pc (gdbarch,
- tic6x_breakpoint_kind_from_pc);
- set_gdbarch_sw_breakpoint_from_kind (gdbarch,
- tic6x_sw_breakpoint_from_kind);
+ set_gdbarch_breakpoint_kind_from_pc (gdbarch, tic6x_breakpoint_kind_from_pc);
+ set_gdbarch_sw_breakpoint_from_kind (gdbarch, tic6x_sw_breakpoint_from_kind);
set_gdbarch_unwind_pc (gdbarch, tic6x_unwind_pc);
@@ -1281,8 +1264,8 @@ tic6x_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
set_gdbarch_stack_frame_destroyed_p (gdbarch, tic6x_stack_frame_destroyed_p);
- set_gdbarch_return_in_first_hidden_param_p (gdbarch,
- tic6x_return_in_first_hidden_param_p);
+ set_gdbarch_return_in_first_hidden_param_p (
+ gdbarch, tic6x_return_in_first_hidden_param_p);
/* Hook in ABI-specific overrides, if they have been registered. */
gdbarch_init_osabi (info, gdbarch);
@@ -1294,6 +1277,7 @@ tic6x_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
}
void _initialize_tic6x_tdep ();
+
void
_initialize_tic6x_tdep ()
{
diff --git a/gdb/tic6x-tdep.h b/gdb/tic6x-tdep.h
index 703c45f7170..8c6fdf65d5d 100644
--- a/gdb/tic6x-tdep.h
+++ b/gdb/tic6x-tdep.h
@@ -26,13 +26,13 @@ enum
{
TIC6X_A4_REGNUM = 4,
TIC6X_A5_REGNUM = 5,
- TIC6X_FP_REGNUM = 15, /* Frame Pointer: A15 */
+ TIC6X_FP_REGNUM = 15, /* Frame Pointer: A15 */
TIC6X_B0_REGNUM = 16,
- TIC6X_RA_REGNUM = 19, /* Return address: B3 */
+ TIC6X_RA_REGNUM = 19, /* Return address: B3 */
TIC6X_B4_REGNUM = 20,
TIC6X_B5_REGNUM = 21,
- TIC6X_DP_REGNUM = 30, /* Data Page Pointer: B14 */
- TIC6X_SP_REGNUM = 31, /* Stack Pointer: B15 */
+ TIC6X_DP_REGNUM = 30, /* Data Page Pointer: B14 */
+ TIC6X_SP_REGNUM = 31, /* Stack Pointer: B15 */
TIC6X_CSR_REGNUM = 32,
TIC6X_PC_REGNUM = 33,
TIC6X_NUM_CORE_REGS = 33, /* The number of core registers */
diff --git a/gdb/tid-parse.c b/gdb/tid-parse.c
index 46c3fccb135..becdca5daf6 100644
--- a/gdb/tid-parse.c
+++ b/gdb/tid-parse.c
@@ -28,7 +28,7 @@
void ATTRIBUTE_NORETURN
invalid_thread_id_error (const char *string)
{
- error (_("Invalid thread ID: %s"), string);
+ error (_ ("Invalid thread ID: %s"), string);
}
/* Wrapper for get_number_trailer that throws an error if we get back
@@ -44,7 +44,7 @@ get_positive_number_trailer (const char **pp, int trailer, const char *string)
num = get_number_trailer (pp, trailer);
if (num < 0)
- error (_("negative value: %s"), string);
+ error (_ ("negative value: %s"), string);
return num;
}
@@ -73,7 +73,7 @@ parse_thread_id (const char *tidstr, const char **end)
inf = find_inferior_id (inf_num);
if (inf == NULL)
- error (_("No inferior number '%d'"), inf_num);
+ error (_ ("No inferior number '%d'"), inf_num);
explicit_inf_id = 1;
p1 = dot + 1;
@@ -100,9 +100,9 @@ parse_thread_id (const char *tidstr, const char **end)
if (tp == NULL)
{
if (show_inferior_qualified_tids () || explicit_inf_id)
- error (_("Unknown thread %d.%d."), inf->num, thr_num);
+ error (_ ("Unknown thread %d.%d."), inf->num, thr_num);
else
- error (_("Unknown thread %d."), thr_num);
+ error (_ ("Unknown thread %d."), thr_num);
}
if (end != NULL)
@@ -113,8 +113,7 @@ parse_thread_id (const char *tidstr, const char **end)
/* See tid-parse.h. */
-tid_range_parser::tid_range_parser (const char *tidlist,
- int default_inferior)
+tid_range_parser::tid_range_parser (const char *tidlist, int default_inferior)
{
init (tidlist, default_inferior);
}
@@ -143,8 +142,7 @@ tid_range_parser::finished () const
or we are not in a range and not in front of an integer, negative
integer, convenience var or negative convenience var. */
return (*m_cur_tok == '\0'
- || !(isdigit (*m_cur_tok)
- || *m_cur_tok == '$'
+ || !(isdigit (*m_cur_tok) || *m_cur_tok == '$'
|| *m_cur_tok == '*'));
case STATE_THREAD_RANGE:
case STATE_STAR_RANGE:
@@ -174,8 +172,7 @@ tid_range_parser::cur_tok () const
void
tid_range_parser::skip_range ()
{
- gdb_assert (m_state == STATE_THREAD_RANGE
- || m_state == STATE_STAR_RANGE);
+ gdb_assert (m_state == STATE_THREAD_RANGE || m_state == STATE_STAR_RANGE);
m_range_parser.skip_range ();
init (m_range_parser.cur_tok (), m_default_inferior);
@@ -194,8 +191,7 @@ tid_range_parser::tid_is_qualified () const
is non-NULL, return a single thread ID otherwise. */
bool
-tid_range_parser::get_tid_or_range (int *inf_num,
- int *thr_start, int *thr_end)
+tid_range_parser::get_tid_or_range (int *inf_num, int *thr_start, int *thr_end)
{
if (m_state == STATE_INFERIOR)
{
@@ -245,7 +241,7 @@ tid_range_parser::get_tid_or_range (int *inf_num,
*inf_num = m_inf_num;
*thr_start = m_range_parser.get_number ();
if (*thr_start < 0)
- error (_("negative value: %s"), m_cur_tok);
+ error (_ ("negative value: %s"), m_cur_tok);
if (*thr_start == 0)
{
m_state = STATE_INFERIOR;
@@ -267,8 +263,7 @@ tid_range_parser::get_tid_or_range (int *inf_num,
/* If we're midway through a range, and the caller wants the end
value, return it and skip to the end of the range. */
if (thr_end != NULL
- && (m_state == STATE_THREAD_RANGE
- || m_state == STATE_STAR_RANGE))
+ && (m_state == STATE_THREAD_RANGE || m_state == STATE_STAR_RANGE))
{
*thr_end = m_range_parser.end_value ();
@@ -281,8 +276,7 @@ tid_range_parser::get_tid_or_range (int *inf_num,
/* See tid-parse.h. */
bool
-tid_range_parser::get_tid_range (int *inf_num,
- int *thr_start, int *thr_end)
+tid_range_parser::get_tid_range (int *inf_num, int *thr_start, int *thr_end)
{
gdb_assert (inf_num != NULL && thr_start != NULL && thr_end != NULL);
@@ -316,8 +310,8 @@ tid_range_parser::in_thread_range () const
/* See tid-parse.h. */
int
-tid_is_in_list (const char *list, int default_inferior,
- int inf_num, int thr_num)
+tid_is_in_list (const char *list, int default_inferior, int inf_num,
+ int thr_num)
{
if (list == NULL || *list == '\0')
return 1;
@@ -331,8 +325,8 @@ tid_is_in_list (const char *list, int default_inferior,
if (!parser.get_tid_range (&tmp_inf, &tmp_thr_start, &tmp_thr_end))
invalid_thread_id_error (parser.cur_tok ());
- if (tmp_inf == inf_num
- && tmp_thr_start <= thr_num && thr_num <= tmp_thr_end)
+ if (tmp_inf == inf_num && tmp_thr_start <= thr_num
+ && thr_num <= tmp_thr_end)
return 1;
}
return 0;
diff --git a/gdb/tid-parse.h b/gdb/tid-parse.h
index 86a49854b72..8b9c4db68bc 100644
--- a/gdb/tid-parse.h
+++ b/gdb/tid-parse.h
@@ -54,6 +54,7 @@ struct thread_info *parse_thread_id (const char *tidstr, const char **end);
class tid_range_parser
{
public:
+
/* Default construction. Must call init before calling get_*. */
tid_range_parser () {}
@@ -134,6 +135,7 @@ public:
bool tid_is_qualified () const;
private:
+
/* No need for these. They are intentionally not defined anywhere. */
tid_range_parser (const tid_range_parser &);
tid_range_parser &operator= (const tid_range_parser &);
@@ -143,16 +145,16 @@ private:
/* The possible states of the tid range parser's state machine,
indicating what sub-component are we expecting. */
enum
- {
- /* Parsing the inferior number. */
- STATE_INFERIOR,
+ {
+ /* Parsing the inferior number. */
+ STATE_INFERIOR,
- /* Parsing the thread number or thread number range. */
- STATE_THREAD_RANGE,
+ /* Parsing the thread number or thread number range. */
+ STATE_THREAD_RANGE,
- /* Parsing a star wildcard thread range. E.g., "1.*". */
- STATE_STAR_RANGE,
- } m_state;
+ /* Parsing a star wildcard thread range. E.g., "1.*". */
+ STATE_STAR_RANGE,
+ } m_state;
/* The string being parsed. When parsing has finished, this points
past the last parsed token. */
@@ -174,7 +176,6 @@ private:
int m_default_inferior;
};
-
/* Accept a string-form list of thread IDs such as is accepted by
tid_range_parser. Return true if the INF_NUM.THR.NUM thread is in
the list. DEFAULT_INFERIOR is the inferior number to assume if a
@@ -183,7 +184,7 @@ private:
By definition, an empty list includes all threads. This is to be
interpreted as typing a command such as "info threads" with no
arguments. */
-extern int tid_is_in_list (const char *list, int default_inferior,
- int inf_num, int thr_num);
+extern int tid_is_in_list (const char *list, int default_inferior, int inf_num,
+ int thr_num);
#endif /* TID_PARSE_H */
diff --git a/gdb/tilegx-linux-nat.c b/gdb/tilegx-linux-nat.c
index bcaee369fa9..a5ece58cc0e 100644
--- a/gdb/tilegx-linux-nat.c
+++ b/gdb/tilegx-linux-nat.c
@@ -37,6 +37,7 @@
class tilegx_linux_nat_target final : public linux_nat_target
{
public:
+
/* Add our register access methods. */
void fetch_registers (struct regcache *, int) override;
void store_registers (struct regcache *, int) override;
@@ -60,18 +61,11 @@ static tilegx_linux_nat_target the_tilegx_linux_nat_target;
format and GDB's register array layout. Note that we map the
first 56 registers (0 thru 55) one-to-one. GDB maps the pc to
slot 64, but ptrace returns it in slot 56. */
-static const int regmap[] =
-{
- 0, 1, 2, 3, 4, 5, 6, 7,
- 8, 9, 10, 11, 12, 13, 14, 15,
- 16, 17, 18, 19, 20, 21, 22, 23,
- 24, 25, 26, 27, 28, 29, 30, 31,
- 32, 33, 34, 35, 36, 37, 38, 39,
- 40, 41, 42, 43, 44, 45, 46, 47,
- 48, 49, 50, 51, 52, 53, 54, 55,
- -1, -1, -1, -1, -1, -1, -1, -1,
- 56, 58
-};
+static const int regmap[]
+ = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16,
+ 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33,
+ 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50,
+ 51, 52, 53, 54, 55, -1, -1, -1, -1, -1, -1, -1, -1, 56, 58 };
/* Transfering the general-purpose registers between GDB, inferiors
and core files. */
@@ -80,8 +74,7 @@ static const int regmap[] =
in *GREGSETP. */
void
-supply_gregset (struct regcache* regcache,
- const elf_gregset_t *gregsetp)
+supply_gregset (struct regcache *regcache, const elf_gregset_t *gregsetp)
{
elf_greg_t *regp = (elf_greg_t *) gregsetp;
int i;
@@ -95,8 +88,8 @@ supply_gregset (struct regcache* regcache,
register array. */
void
-fill_gregset (const struct regcache* regcache,
- elf_gregset_t *gregsetp, int regno)
+fill_gregset (const struct regcache *regcache, elf_gregset_t *gregsetp,
+ int regno)
{
elf_greg_t *regp = (elf_greg_t *) gregsetp;
int i;
@@ -112,8 +105,7 @@ fill_gregset (const struct regcache* regcache,
*FPREGSETP. */
void
-supply_fpregset (struct regcache *regcache,
- const elf_fpregset_t *fpregsetp)
+supply_fpregset (struct regcache *regcache, const elf_fpregset_t *fpregsetp)
{
/* NOTE: There are no floating-point registers for TILE-Gx. */
}
@@ -123,8 +115,8 @@ supply_fpregset (struct regcache *regcache,
do this for all registers. */
void
-fill_fpregset (const struct regcache *regcache,
- elf_fpregset_t *fpregsetp, int regno)
+fill_fpregset (const struct regcache *regcache, elf_fpregset_t *fpregsetp,
+ int regno)
{
/* NOTE: There are no floating-point registers for TILE-Gx. */
}
@@ -140,9 +132,9 @@ tilegx_linux_nat_target::fetch_registers (struct regcache *regcache,
pid_t tid = get_ptrace_pid (regcache->ptid ());
if (ptrace (PTRACE_GETREGS, tid, 0, (PTRACE_TYPE_ARG3) &regs) < 0)
- perror_with_name (_("Couldn't get registers"));
+ perror_with_name (_ ("Couldn't get registers"));
- supply_gregset (regcache, (const elf_gregset_t *)&regs);
+ supply_gregset (regcache, (const elf_gregset_t *) &regs);
}
/* Store register REGNUM back into the inferior. If REGNUM is -1, do
@@ -156,15 +148,16 @@ tilegx_linux_nat_target::store_registers (struct regcache *regcache,
pid_t tid = get_ptrace_pid (regcache->ptid ());
if (ptrace (PTRACE_GETREGS, tid, 0, (PTRACE_TYPE_ARG3) &regs) < 0)
- perror_with_name (_("Couldn't get registers"));
+ perror_with_name (_ ("Couldn't get registers"));
fill_gregset (regcache, &regs, regnum);
if (ptrace (PTRACE_SETREGS, tid, 0, (PTRACE_TYPE_ARG3) &regs) < 0)
- perror_with_name (_("Couldn't write registers"));
+ perror_with_name (_ ("Couldn't write registers"));
}
void _initialize_tile_linux_nat ();
+
void
_initialize_tile_linux_nat ()
{
diff --git a/gdb/tilegx-linux-tdep.c b/gdb/tilegx-linux-tdep.c
index 3da1cf64f16..76b684e1454 100644
--- a/gdb/tilegx-linux-tdep.c
+++ b/gdb/tilegx-linux-tdep.c
@@ -41,8 +41,7 @@ tilegx_linux_sigframe_init (const struct tramp_frame *self,
CORE_ADDR sp = get_frame_register_unsigned (this_frame, 54);
/* Base address of register save area. */
- CORE_ADDR base = sp
- + 16 /* Skip ABI_SAVE_AREA. */
+ CORE_ADDR base = sp + 16 /* Skip ABI_SAVE_AREA. */
+ 128 /* Skip SIGINFO. */
+ 40; /* Skip UCONTEXT. */
@@ -55,44 +54,35 @@ tilegx_linux_sigframe_init (const struct tramp_frame *self,
trad_frame_set_reg_addr (this_cache, i, base + i * 8);
trad_frame_set_reg_value (this_cache, 64,
- get_frame_memory_unsigned (this_frame, prev_pc, 8));
+ get_frame_memory_unsigned (this_frame, prev_pc,
+ 8));
/* Save a frame ID. */
trad_frame_set_id (this_cache, frame_id_build (base, func));
}
-static const struct tramp_frame tilegx_linux_rt_sigframe =
-{
- SIGTRAMP_FRAME,
- 8,
- {
- { 0x00045fe551483000ULL, ULONGEST_MAX }, /* { moveli r10, 139 } */
- { 0x286b180051485000ULL, ULONGEST_MAX }, /* { swint1 } */
- { TRAMP_SENTINEL_INSN, ULONGEST_MAX }
- },
- tilegx_linux_sigframe_init
-};
+static const struct tramp_frame tilegx_linux_rt_sigframe
+ = { SIGTRAMP_FRAME,
+ 8,
+ { { 0x00045fe551483000ULL, ULONGEST_MAX }, /* { moveli r10, 139 } */
+ { 0x286b180051485000ULL, ULONGEST_MAX }, /* { swint1 } */
+ { TRAMP_SENTINEL_INSN, ULONGEST_MAX } },
+ tilegx_linux_sigframe_init };
/* Register map; must match struct pt_regs in "ptrace.h". */
-static const struct regcache_map_entry tilegx_linux_regmap[] =
- {
- { TILEGX_NUM_EASY_REGS, TILEGX_FIRST_EASY_REGNUM, 8 },
- { 1, TILEGX_PC_REGNUM, 8 },
- { 1, TILEGX_FAULTNUM_REGNUM, 8 },
- { 0 }
- };
+static const struct regcache_map_entry tilegx_linux_regmap[]
+ = { { TILEGX_NUM_EASY_REGS, TILEGX_FIRST_EASY_REGNUM, 8 },
+ { 1, TILEGX_PC_REGNUM, 8 },
+ { 1, TILEGX_FAULTNUM_REGNUM, 8 },
+ { 0 } };
#define TILEGX_LINUX_SIZEOF_GREGSET (64 * 8)
/* TILE-Gx Linux kernel register set. */
-static const struct regset tilegx_linux_regset =
-{
- tilegx_linux_regmap,
- regcache_supply_regset, regcache_collect_regset
-};
-
+static const struct regset tilegx_linux_regset
+ = { tilegx_linux_regmap, regcache_supply_regset, regcache_collect_regset };
static void
tilegx_iterate_over_regset_sections (struct gdbarch *gdbarch,
@@ -115,8 +105,8 @@ tilegx_linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
tramp_frame_prepend_unwinder (gdbarch, &tilegx_linux_rt_sigframe);
- set_gdbarch_iterate_over_regset_sections
- (gdbarch, tilegx_iterate_over_regset_sections);
+ set_gdbarch_iterate_over_regset_sections (
+ gdbarch, tilegx_iterate_over_regset_sections);
/* GNU/Linux uses SVR4-style shared libraries. */
if (arch_size == 32)
@@ -136,6 +126,7 @@ tilegx_linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
}
void _initialize_tilegx_linux_tdep ();
+
void
_initialize_tilegx_linux_tdep ()
{
diff --git a/gdb/tilegx-tdep.c b/gdb/tilegx-tdep.c
index 5dfb2376e99..811d77fb213 100644
--- a/gdb/tilegx-tdep.c
+++ b/gdb/tilegx-tdep.c
@@ -55,11 +55,11 @@ struct tilegx_frame_cache
/* Register state values used by analyze_prologue. */
enum reverse_state
- {
- REVERSE_STATE_REGISTER,
- REVERSE_STATE_VALUE,
- REVERSE_STATE_UNKNOWN
- };
+{
+ REVERSE_STATE_REGISTER,
+ REVERSE_STATE_VALUE,
+ REVERSE_STATE_UNKNOWN
+};
/* Register state used by analyze_prologue(). */
struct tilegx_reverse_regs
@@ -69,91 +69,87 @@ struct tilegx_reverse_regs
};
static const struct tilegx_reverse_regs
-template_reverse_regs[TILEGX_NUM_PHYS_REGS] =
- {
- { TILEGX_R0_REGNUM, REVERSE_STATE_REGISTER },
- { TILEGX_R1_REGNUM, REVERSE_STATE_REGISTER },
- { TILEGX_R2_REGNUM, REVERSE_STATE_REGISTER },
- { TILEGX_R3_REGNUM, REVERSE_STATE_REGISTER },
- { TILEGX_R4_REGNUM, REVERSE_STATE_REGISTER },
- { TILEGX_R5_REGNUM, REVERSE_STATE_REGISTER },
- { TILEGX_R6_REGNUM, REVERSE_STATE_REGISTER },
- { TILEGX_R7_REGNUM, REVERSE_STATE_REGISTER },
- { TILEGX_R8_REGNUM, REVERSE_STATE_REGISTER },
- { TILEGX_R9_REGNUM, REVERSE_STATE_REGISTER },
- { TILEGX_R10_REGNUM, REVERSE_STATE_REGISTER },
- { TILEGX_R11_REGNUM, REVERSE_STATE_REGISTER },
- { TILEGX_R12_REGNUM, REVERSE_STATE_REGISTER },
- { TILEGX_R13_REGNUM, REVERSE_STATE_REGISTER },
- { TILEGX_R14_REGNUM, REVERSE_STATE_REGISTER },
- { TILEGX_R15_REGNUM, REVERSE_STATE_REGISTER },
- { TILEGX_R16_REGNUM, REVERSE_STATE_REGISTER },
- { TILEGX_R17_REGNUM, REVERSE_STATE_REGISTER },
- { TILEGX_R18_REGNUM, REVERSE_STATE_REGISTER },
- { TILEGX_R19_REGNUM, REVERSE_STATE_REGISTER },
- { TILEGX_R20_REGNUM, REVERSE_STATE_REGISTER },
- { TILEGX_R21_REGNUM, REVERSE_STATE_REGISTER },
- { TILEGX_R22_REGNUM, REVERSE_STATE_REGISTER },
- { TILEGX_R23_REGNUM, REVERSE_STATE_REGISTER },
- { TILEGX_R24_REGNUM, REVERSE_STATE_REGISTER },
- { TILEGX_R25_REGNUM, REVERSE_STATE_REGISTER },
- { TILEGX_R26_REGNUM, REVERSE_STATE_REGISTER },
- { TILEGX_R27_REGNUM, REVERSE_STATE_REGISTER },
- { TILEGX_R28_REGNUM, REVERSE_STATE_REGISTER },
- { TILEGX_R29_REGNUM, REVERSE_STATE_REGISTER },
- { TILEGX_R30_REGNUM, REVERSE_STATE_REGISTER },
- { TILEGX_R31_REGNUM, REVERSE_STATE_REGISTER },
- { TILEGX_R32_REGNUM, REVERSE_STATE_REGISTER },
- { TILEGX_R33_REGNUM, REVERSE_STATE_REGISTER },
- { TILEGX_R34_REGNUM, REVERSE_STATE_REGISTER },
- { TILEGX_R35_REGNUM, REVERSE_STATE_REGISTER },
- { TILEGX_R36_REGNUM, REVERSE_STATE_REGISTER },
- { TILEGX_R37_REGNUM, REVERSE_STATE_REGISTER },
- { TILEGX_R38_REGNUM, REVERSE_STATE_REGISTER },
- { TILEGX_R39_REGNUM, REVERSE_STATE_REGISTER },
- { TILEGX_R40_REGNUM, REVERSE_STATE_REGISTER },
- { TILEGX_R41_REGNUM, REVERSE_STATE_REGISTER },
- { TILEGX_R42_REGNUM, REVERSE_STATE_REGISTER },
- { TILEGX_R43_REGNUM, REVERSE_STATE_REGISTER },
- { TILEGX_R44_REGNUM, REVERSE_STATE_REGISTER },
- { TILEGX_R45_REGNUM, REVERSE_STATE_REGISTER },
- { TILEGX_R46_REGNUM, REVERSE_STATE_REGISTER },
- { TILEGX_R47_REGNUM, REVERSE_STATE_REGISTER },
- { TILEGX_R48_REGNUM, REVERSE_STATE_REGISTER },
- { TILEGX_R49_REGNUM, REVERSE_STATE_REGISTER },
- { TILEGX_R50_REGNUM, REVERSE_STATE_REGISTER },
- { TILEGX_R51_REGNUM, REVERSE_STATE_REGISTER },
- { TILEGX_R52_REGNUM, REVERSE_STATE_REGISTER },
- { TILEGX_TP_REGNUM, REVERSE_STATE_REGISTER },
- { TILEGX_SP_REGNUM, REVERSE_STATE_REGISTER },
- { TILEGX_LR_REGNUM, REVERSE_STATE_REGISTER },
- { 0, REVERSE_STATE_UNKNOWN },
- { 0, REVERSE_STATE_UNKNOWN },
- { 0, REVERSE_STATE_UNKNOWN },
- { 0, REVERSE_STATE_UNKNOWN },
- { 0, REVERSE_STATE_UNKNOWN },
- { 0, REVERSE_STATE_UNKNOWN },
- { 0, REVERSE_STATE_UNKNOWN },
- { TILEGX_ZERO_REGNUM, REVERSE_STATE_VALUE }
- };
+ template_reverse_regs[TILEGX_NUM_PHYS_REGS]
+ = { { TILEGX_R0_REGNUM, REVERSE_STATE_REGISTER },
+ { TILEGX_R1_REGNUM, REVERSE_STATE_REGISTER },
+ { TILEGX_R2_REGNUM, REVERSE_STATE_REGISTER },
+ { TILEGX_R3_REGNUM, REVERSE_STATE_REGISTER },
+ { TILEGX_R4_REGNUM, REVERSE_STATE_REGISTER },
+ { TILEGX_R5_REGNUM, REVERSE_STATE_REGISTER },
+ { TILEGX_R6_REGNUM, REVERSE_STATE_REGISTER },
+ { TILEGX_R7_REGNUM, REVERSE_STATE_REGISTER },
+ { TILEGX_R8_REGNUM, REVERSE_STATE_REGISTER },
+ { TILEGX_R9_REGNUM, REVERSE_STATE_REGISTER },
+ { TILEGX_R10_REGNUM, REVERSE_STATE_REGISTER },
+ { TILEGX_R11_REGNUM, REVERSE_STATE_REGISTER },
+ { TILEGX_R12_REGNUM, REVERSE_STATE_REGISTER },
+ { TILEGX_R13_REGNUM, REVERSE_STATE_REGISTER },
+ { TILEGX_R14_REGNUM, REVERSE_STATE_REGISTER },
+ { TILEGX_R15_REGNUM, REVERSE_STATE_REGISTER },
+ { TILEGX_R16_REGNUM, REVERSE_STATE_REGISTER },
+ { TILEGX_R17_REGNUM, REVERSE_STATE_REGISTER },
+ { TILEGX_R18_REGNUM, REVERSE_STATE_REGISTER },
+ { TILEGX_R19_REGNUM, REVERSE_STATE_REGISTER },
+ { TILEGX_R20_REGNUM, REVERSE_STATE_REGISTER },
+ { TILEGX_R21_REGNUM, REVERSE_STATE_REGISTER },
+ { TILEGX_R22_REGNUM, REVERSE_STATE_REGISTER },
+ { TILEGX_R23_REGNUM, REVERSE_STATE_REGISTER },
+ { TILEGX_R24_REGNUM, REVERSE_STATE_REGISTER },
+ { TILEGX_R25_REGNUM, REVERSE_STATE_REGISTER },
+ { TILEGX_R26_REGNUM, REVERSE_STATE_REGISTER },
+ { TILEGX_R27_REGNUM, REVERSE_STATE_REGISTER },
+ { TILEGX_R28_REGNUM, REVERSE_STATE_REGISTER },
+ { TILEGX_R29_REGNUM, REVERSE_STATE_REGISTER },
+ { TILEGX_R30_REGNUM, REVERSE_STATE_REGISTER },
+ { TILEGX_R31_REGNUM, REVERSE_STATE_REGISTER },
+ { TILEGX_R32_REGNUM, REVERSE_STATE_REGISTER },
+ { TILEGX_R33_REGNUM, REVERSE_STATE_REGISTER },
+ { TILEGX_R34_REGNUM, REVERSE_STATE_REGISTER },
+ { TILEGX_R35_REGNUM, REVERSE_STATE_REGISTER },
+ { TILEGX_R36_REGNUM, REVERSE_STATE_REGISTER },
+ { TILEGX_R37_REGNUM, REVERSE_STATE_REGISTER },
+ { TILEGX_R38_REGNUM, REVERSE_STATE_REGISTER },
+ { TILEGX_R39_REGNUM, REVERSE_STATE_REGISTER },
+ { TILEGX_R40_REGNUM, REVERSE_STATE_REGISTER },
+ { TILEGX_R41_REGNUM, REVERSE_STATE_REGISTER },
+ { TILEGX_R42_REGNUM, REVERSE_STATE_REGISTER },
+ { TILEGX_R43_REGNUM, REVERSE_STATE_REGISTER },
+ { TILEGX_R44_REGNUM, REVERSE_STATE_REGISTER },
+ { TILEGX_R45_REGNUM, REVERSE_STATE_REGISTER },
+ { TILEGX_R46_REGNUM, REVERSE_STATE_REGISTER },
+ { TILEGX_R47_REGNUM, REVERSE_STATE_REGISTER },
+ { TILEGX_R48_REGNUM, REVERSE_STATE_REGISTER },
+ { TILEGX_R49_REGNUM, REVERSE_STATE_REGISTER },
+ { TILEGX_R50_REGNUM, REVERSE_STATE_REGISTER },
+ { TILEGX_R51_REGNUM, REVERSE_STATE_REGISTER },
+ { TILEGX_R52_REGNUM, REVERSE_STATE_REGISTER },
+ { TILEGX_TP_REGNUM, REVERSE_STATE_REGISTER },
+ { TILEGX_SP_REGNUM, REVERSE_STATE_REGISTER },
+ { TILEGX_LR_REGNUM, REVERSE_STATE_REGISTER },
+ { 0, REVERSE_STATE_UNKNOWN },
+ { 0, REVERSE_STATE_UNKNOWN },
+ { 0, REVERSE_STATE_UNKNOWN },
+ { 0, REVERSE_STATE_UNKNOWN },
+ { 0, REVERSE_STATE_UNKNOWN },
+ { 0, REVERSE_STATE_UNKNOWN },
+ { 0, REVERSE_STATE_UNKNOWN },
+ { TILEGX_ZERO_REGNUM, REVERSE_STATE_VALUE } };
/* Implement the "register_name" gdbarch method. */
static const char *
tilegx_register_name (struct gdbarch *gdbarch, int regnum)
{
- static const char *const register_names[] =
- {
- "r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7",
- "r8", "r9", "r10", "r11", "r12", "r13", "r14", "r15",
- "r16", "r17", "r18", "r19", "r20", "r21", "r22", "r23",
- "r24", "r25", "r26", "r27", "r28", "r29", "r30", "r31",
- "r32", "r33", "r34", "r35", "r36", "r37", "r38", "r39",
- "r40", "r41", "r42", "r43", "r44", "r45", "r46", "r47",
- "r48", "r49", "r50", "r51", "r52", "tp", "sp", "lr",
- "sn", "idn0", "idn1", "udn0", "udn1", "udn2", "udn3", "zero",
- "pc", "faultnum",
- };
+ static const char *const register_names[] = {
+ "r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7", "r8",
+ "r9", "r10", "r11", "r12", "r13", "r14", "r15", "r16", "r17",
+ "r18", "r19", "r20", "r21", "r22", "r23", "r24", "r25", "r26",
+ "r27", "r28", "r29", "r30", "r31", "r32", "r33", "r34", "r35",
+ "r36", "r37", "r38", "r39", "r40", "r41", "r42", "r43", "r44",
+ "r45", "r46", "r47", "r48", "r49", "r50", "r51", "r52", "tp",
+ "sp", "lr", "sn", "idn0", "idn1", "udn0", "udn1", "udn2", "udn3",
+ "zero", "pc", "faultnum",
+ };
gdb_static_assert (TILEGX_NUM_REGS == ARRAY_SIZE (register_names));
return register_names[regnum];
@@ -184,8 +180,7 @@ tilegx_dwarf2_reg_to_regnum (struct gdbarch *gdbarch, int num)
static int
tilegx_type_is_scalar (struct type *t)
{
- return (t->code () != TYPE_CODE_STRUCT
- && t->code () != TYPE_CODE_UNION
+ return (t->code () != TYPE_CODE_STRUCT && t->code () != TYPE_CODE_UNION
&& t->code () != TYPE_CODE_ARRAY);
}
@@ -200,8 +195,8 @@ tilegx_use_struct_convention (struct type *type)
/* Only scalars which fit in R0 - R9 can be returned in registers.
Otherwise, they are returned via a pointer passed in R0. */
return (!tilegx_type_is_scalar (type)
- && (type->length () > (1 + TILEGX_R9_REGNUM - TILEGX_R0_REGNUM)
- * tilegx_reg_size));
+ && (type->length ()
+ > (1 + TILEGX_R9_REGNUM - TILEGX_R0_REGNUM) * tilegx_reg_size));
}
/* Find a function's return value in the appropriate registers (in
@@ -268,16 +263,13 @@ tilegx_frame_align (struct gdbarch *gdbarch, CORE_ADDR addr)
return addr & -8;
}
-
/* Implement the "push_dummy_call" gdbarch method. */
static CORE_ADDR
-tilegx_push_dummy_call (struct gdbarch *gdbarch,
- struct value *function,
- struct regcache *regcache,
- CORE_ADDR bp_addr, int nargs,
- struct value **args,
- CORE_ADDR sp, function_call_return_method return_method,
+tilegx_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
+ struct regcache *regcache, CORE_ADDR bp_addr,
+ int nargs, struct value **args, CORE_ADDR sp,
+ function_call_return_method return_method,
CORE_ADDR struct_addr)
{
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
@@ -350,7 +342,6 @@ tilegx_push_dummy_call (struct gdbarch *gdbarch,
return stack_dest;
}
-
/* Decode the instructions within the given address range.
Decide when we must have reached the end of the function prologue.
If a frame_info pointer is provided, fill in its saved_regs etc.
@@ -359,9 +350,8 @@ tilegx_push_dummy_call (struct gdbarch *gdbarch,
function, and end_addr being the current PC. */
static CORE_ADDR
-tilegx_analyze_prologue (struct gdbarch* gdbarch,
- CORE_ADDR start_addr, CORE_ADDR end_addr,
- struct tilegx_frame_cache *cache,
+tilegx_analyze_prologue (struct gdbarch *gdbarch, CORE_ADDR start_addr,
+ CORE_ADDR end_addr, struct tilegx_frame_cache *cache,
frame_info_ptr next_frame)
{
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
@@ -403,8 +393,7 @@ tilegx_analyze_prologue (struct gdbarch* gdbarch,
instbuf_start = 0;
instbuf_size = 0;
- for (next_addr = start_addr;
- next_addr < end_addr;
+ for (next_addr = start_addr; next_addr < end_addr;
next_addr += TILEGX_BUNDLE_SIZE_IN_BYTES)
{
/* Retrieve the next instruction. */
@@ -420,12 +409,12 @@ tilegx_analyze_prologue (struct gdbarch* gdbarch,
if (instbuf_size > size_on_same_page)
instbuf_size = size_on_same_page;
- instbuf_size = std::min ((CORE_ADDR) instbuf_size,
- (end_addr - next_addr));
+ instbuf_size
+ = std::min ((CORE_ADDR) instbuf_size, (end_addr - next_addr));
instbuf_start = next_addr;
status = safe_frame_unwind_memory (next_frame, instbuf_start,
- {instbuf, instbuf_size});
+ { instbuf, instbuf_size });
if (status == 0)
memory_error (TARGET_XFER_E_IO, next_addr);
}
@@ -449,25 +438,24 @@ tilegx_analyze_prologue (struct gdbarch* gdbarch,
if (cache
&& reverse_frame[operands[0]].state == REVERSE_STATE_VALUE
&& reverse_frame[operands[1]].state
- == REVERSE_STATE_REGISTER)
+ == REVERSE_STATE_REGISTER)
{
LONGEST saved_address = reverse_frame[operands[0]].value;
unsigned saved_register
= (unsigned) reverse_frame[operands[1]].value;
cache->saved_regs[saved_register].set_addr (saved_address);
- }
- else if (cache
- && (operands[0] == TILEGX_SP_REGNUM)
+ }
+ else if (cache && (operands[0] == TILEGX_SP_REGNUM)
&& (operands[1] == TILEGX_LR_REGNUM))
lr_saved_on_stack_p = 1;
break;
case TILEGX_OPC_ADDI:
case TILEGX_OPC_ADDLI:
- if (cache
- && operands[0] == TILEGX_SP_REGNUM
+ if (cache && operands[0] == TILEGX_SP_REGNUM
&& operands[1] == TILEGX_SP_REGNUM
- && reverse_frame[operands[1]].state == REVERSE_STATE_REGISTER)
+ && reverse_frame[operands[1]].state
+ == REVERSE_STATE_REGISTER)
{
/* Special case. We're fixing up the stack frame. */
uint64_t hopefully_sp
@@ -478,8 +466,8 @@ tilegx_analyze_prologue (struct gdbarch* gdbarch,
/* Fix up the sign-extension. */
if (opcode->mnemonic == TILEGX_OPC_ADDI)
op2_as_short = op2_as_char;
- prev_sp_value = (cache->saved_regs[hopefully_sp].addr ()
- - op2_as_short);
+ prev_sp_value
+ = (cache->saved_regs[hopefully_sp].addr () - op2_as_short);
new_reverse_frame[i].state = REVERSE_STATE_VALUE;
new_reverse_frame[i].value
@@ -668,10 +656,10 @@ tilegx_analyze_prologue (struct gdbarch* gdbarch,
/* GCC uses R52 as a frame pointer. Have we seen "move r52, sp"? */
if (reverse_frame[TILEGX_R52_REGNUM].state == REVERSE_STATE_REGISTER
&& reverse_frame[TILEGX_R52_REGNUM].value == TILEGX_SP_REGNUM)
- {
- reverse_frame[TILEGX_R52_REGNUM].state = REVERSE_STATE_VALUE;
- reverse_frame[TILEGX_R52_REGNUM].value = prev_sp_value;
- }
+ {
+ reverse_frame[TILEGX_R52_REGNUM].state = REVERSE_STATE_VALUE;
+ reverse_frame[TILEGX_R52_REGNUM].value = prev_sp_value;
+ }
prev_sp_value = 0;
}
@@ -746,10 +734,7 @@ tilegx_skip_prologue (struct gdbarch *gdbarch, CORE_ADDR start_pc)
end_pc = std::min (end_pc, s->endaddr ());
/* Otherwise, try to skip prologue the hard way. */
- return tilegx_analyze_prologue (gdbarch,
- start_pc,
- end_pc,
- NULL, NULL);
+ return tilegx_analyze_prologue (gdbarch, start_pc, end_pc, NULL, NULL);
}
/* This is the implementation of gdbarch method stack_frame_destroyed_p. */
@@ -825,8 +810,8 @@ tilegx_write_pc (struct regcache *regcache, CORE_ADDR pc)
}
/* 64-bit pattern for a { bpt ; nop } bundle. */
-constexpr gdb_byte tilegx_break_insn[] =
- { 0x00, 0x50, 0x48, 0x51, 0xae, 0x44, 0x6a, 0x28 };
+constexpr gdb_byte tilegx_break_insn[]
+ = { 0x00, 0x50, 0x48, 0x51, 0xae, 0x44, 0x6a, 0x28 };
typedef BP_MANIPULATION (tilegx_break_insn) tilegx_breakpoint;
@@ -853,8 +838,8 @@ tilegx_frame_cache (frame_info_ptr this_frame, void **this_cache)
cache->saved_regs[TILEGX_SP_REGNUM].set_value (cache->base);
if (cache->start_pc)
- tilegx_analyze_prologue (gdbarch, cache->start_pc, current_pc,
- cache, this_frame);
+ tilegx_analyze_prologue (gdbarch, cache->start_pc, current_pc, cache,
+ this_frame);
cache->saved_regs[TILEGX_PC_REGNUM] = cache->saved_regs[TILEGX_LR_REGNUM];
@@ -863,16 +848,14 @@ tilegx_frame_cache (frame_info_ptr this_frame, void **this_cache)
/* Retrieve the value of REGNUM in FRAME. */
-static struct value*
-tilegx_frame_prev_register (frame_info_ptr this_frame,
- void **this_cache,
+static struct value *
+tilegx_frame_prev_register (frame_info_ptr this_frame, void **this_cache,
int regnum)
{
- struct tilegx_frame_cache *info =
- tilegx_frame_cache (this_frame, this_cache);
+ struct tilegx_frame_cache *info
+ = tilegx_frame_cache (this_frame, this_cache);
- return trad_frame_get_prev_register (this_frame, info->saved_regs,
- regnum);
+ return trad_frame_get_prev_register (this_frame, info->saved_regs, regnum);
}
/* Build frame id. */
@@ -881,8 +864,8 @@ static void
tilegx_frame_this_id (frame_info_ptr this_frame, void **this_cache,
struct frame_id *this_id)
{
- struct tilegx_frame_cache *info =
- tilegx_frame_cache (this_frame, this_cache);
+ struct tilegx_frame_cache *info
+ = tilegx_frame_cache (this_frame, this_cache);
/* This marks the outermost frame. */
if (info->base == 0)
@@ -894,8 +877,8 @@ tilegx_frame_this_id (frame_info_ptr this_frame, void **this_cache,
static CORE_ADDR
tilegx_frame_base_address (frame_info_ptr this_frame, void **this_cache)
{
- struct tilegx_frame_cache *cache =
- tilegx_frame_cache (this_frame, this_cache);
+ struct tilegx_frame_cache *cache
+ = tilegx_frame_cache (this_frame, this_cache);
return cache->base;
}
@@ -906,17 +889,14 @@ static const struct frame_unwind tilegx_frame_unwind = {
default_frame_unwind_stop_reason,
tilegx_frame_this_id,
tilegx_frame_prev_register,
- NULL, /* const struct frame_data *unwind_data */
- default_frame_sniffer, /* frame_sniffer_ftype *sniffer */
- NULL /* frame_prev_pc_ftype *prev_pc */
+ NULL, /* const struct frame_data *unwind_data */
+ default_frame_sniffer, /* frame_sniffer_ftype *sniffer */
+ NULL /* frame_prev_pc_ftype *prev_pc */
};
-static const struct frame_base tilegx_frame_base = {
- &tilegx_frame_unwind,
- tilegx_frame_base_address,
- tilegx_frame_base_address,
- tilegx_frame_base_address
-};
+static const struct frame_base tilegx_frame_base
+ = { &tilegx_frame_unwind, tilegx_frame_base_address,
+ tilegx_frame_base_address, tilegx_frame_base_address };
/* We cannot read/write the "special" registers. */
@@ -925,8 +905,7 @@ tilegx_cannot_reference_register (struct gdbarch *gdbarch, int regno)
{
if (regno >= 0 && regno < TILEGX_NUM_EASY_REGS)
return 0;
- else if (regno == TILEGX_PC_REGNUM
- || regno == TILEGX_FAULTNUM_REGNUM)
+ else if (regno == TILEGX_PC_REGNUM || regno == TILEGX_FAULTNUM_REGNUM)
return 0;
else
return 1;
@@ -943,8 +922,7 @@ tilegx_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
arch_size = bfd_get_arch_size (info.abfd);
/* Try to find a pre-existing architecture. */
- for (arches = gdbarch_list_lookup_by_info (arches, &info);
- arches != NULL;
+ for (arches = gdbarch_list_lookup_by_info (arches, &info); arches != NULL;
arches = gdbarch_list_lookup_by_info (arches->next, &info))
{
/* We only have two flavors -- just make sure arch_size matches. */
@@ -997,7 +975,8 @@ tilegx_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
set_gdbarch_skip_prologue (gdbarch, tilegx_skip_prologue);
- set_gdbarch_stack_frame_destroyed_p (gdbarch, tilegx_stack_frame_destroyed_p);
+ set_gdbarch_stack_frame_destroyed_p (gdbarch,
+ tilegx_stack_frame_destroyed_p);
/* Map debug registers into internal register numbers. */
set_gdbarch_dwarf2_reg_to_regnum (gdbarch, tilegx_dwarf2_reg_to_regnum);
@@ -1021,6 +1000,7 @@ tilegx_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
}
void _initialize_tilegx_tdep ();
+
void
_initialize_tilegx_tdep ()
{
diff --git a/gdb/tilegx-tdep.h b/gdb/tilegx-tdep.h
index a78a3cf03e0..6665ffc90f2 100644
--- a/gdb/tilegx-tdep.h
+++ b/gdb/tilegx-tdep.h
@@ -29,82 +29,85 @@
LR (aka R55) is the link register. */
enum tilegx_regnum
- {
- TILEGX_R0_REGNUM,
- TILEGX_FIRST_EASY_REGNUM = TILEGX_R0_REGNUM,
- TILEGX_R1_REGNUM,
- TILEGX_R2_REGNUM,
- TILEGX_R3_REGNUM,
- TILEGX_R4_REGNUM,
- TILEGX_R5_REGNUM,
- TILEGX_R6_REGNUM,
- TILEGX_R7_REGNUM,
- TILEGX_R8_REGNUM,
- TILEGX_R9_REGNUM,
- TILEGX_R10_REGNUM,
- TILEGX_R11_REGNUM,
- TILEGX_R12_REGNUM,
- TILEGX_R13_REGNUM,
- TILEGX_R14_REGNUM,
- TILEGX_R15_REGNUM,
- TILEGX_R16_REGNUM,
- TILEGX_R17_REGNUM,
- TILEGX_R18_REGNUM,
- TILEGX_R19_REGNUM,
- TILEGX_R20_REGNUM,
- TILEGX_R21_REGNUM,
- TILEGX_R22_REGNUM,
- TILEGX_R23_REGNUM,
- TILEGX_R24_REGNUM,
- TILEGX_R25_REGNUM,
- TILEGX_R26_REGNUM,
- TILEGX_R27_REGNUM,
- TILEGX_R28_REGNUM,
- TILEGX_R29_REGNUM,
- TILEGX_R30_REGNUM,
- TILEGX_R31_REGNUM,
- TILEGX_R32_REGNUM,
- TILEGX_R33_REGNUM,
- TILEGX_R34_REGNUM,
- TILEGX_R35_REGNUM,
- TILEGX_R36_REGNUM,
- TILEGX_R37_REGNUM,
- TILEGX_R38_REGNUM,
- TILEGX_R39_REGNUM,
- TILEGX_R40_REGNUM,
- TILEGX_R41_REGNUM,
- TILEGX_R42_REGNUM,
- TILEGX_R43_REGNUM,
- TILEGX_R44_REGNUM,
- TILEGX_R45_REGNUM,
- TILEGX_R46_REGNUM,
- TILEGX_R47_REGNUM,
- TILEGX_R48_REGNUM,
- TILEGX_R49_REGNUM,
- TILEGX_R50_REGNUM,
- TILEGX_R51_REGNUM,
- TILEGX_R52_REGNUM,
- TILEGX_TP_REGNUM,
- TILEGX_SP_REGNUM,
- TILEGX_LR_REGNUM,
+{
+ TILEGX_R0_REGNUM,
+ TILEGX_FIRST_EASY_REGNUM = TILEGX_R0_REGNUM,
+ TILEGX_R1_REGNUM,
+ TILEGX_R2_REGNUM,
+ TILEGX_R3_REGNUM,
+ TILEGX_R4_REGNUM,
+ TILEGX_R5_REGNUM,
+ TILEGX_R6_REGNUM,
+ TILEGX_R7_REGNUM,
+ TILEGX_R8_REGNUM,
+ TILEGX_R9_REGNUM,
+ TILEGX_R10_REGNUM,
+ TILEGX_R11_REGNUM,
+ TILEGX_R12_REGNUM,
+ TILEGX_R13_REGNUM,
+ TILEGX_R14_REGNUM,
+ TILEGX_R15_REGNUM,
+ TILEGX_R16_REGNUM,
+ TILEGX_R17_REGNUM,
+ TILEGX_R18_REGNUM,
+ TILEGX_R19_REGNUM,
+ TILEGX_R20_REGNUM,
+ TILEGX_R21_REGNUM,
+ TILEGX_R22_REGNUM,
+ TILEGX_R23_REGNUM,
+ TILEGX_R24_REGNUM,
+ TILEGX_R25_REGNUM,
+ TILEGX_R26_REGNUM,
+ TILEGX_R27_REGNUM,
+ TILEGX_R28_REGNUM,
+ TILEGX_R29_REGNUM,
+ TILEGX_R30_REGNUM,
+ TILEGX_R31_REGNUM,
+ TILEGX_R32_REGNUM,
+ TILEGX_R33_REGNUM,
+ TILEGX_R34_REGNUM,
+ TILEGX_R35_REGNUM,
+ TILEGX_R36_REGNUM,
+ TILEGX_R37_REGNUM,
+ TILEGX_R38_REGNUM,
+ TILEGX_R39_REGNUM,
+ TILEGX_R40_REGNUM,
+ TILEGX_R41_REGNUM,
+ TILEGX_R42_REGNUM,
+ TILEGX_R43_REGNUM,
+ TILEGX_R44_REGNUM,
+ TILEGX_R45_REGNUM,
+ TILEGX_R46_REGNUM,
+ TILEGX_R47_REGNUM,
+ TILEGX_R48_REGNUM,
+ TILEGX_R49_REGNUM,
+ TILEGX_R50_REGNUM,
+ TILEGX_R51_REGNUM,
+ TILEGX_R52_REGNUM,
+ TILEGX_TP_REGNUM,
+ TILEGX_SP_REGNUM,
+ TILEGX_LR_REGNUM,
- TILEGX_SN_REGNUM,
- TILEGX_NUM_EASY_REGS = TILEGX_SN_REGNUM, /* 56 */
+ TILEGX_SN_REGNUM,
+ TILEGX_NUM_EASY_REGS = TILEGX_SN_REGNUM, /* 56 */
- TILEGX_IO0_REGNUM,
- TILEGX_IO1_REGNUM,
- TILEGX_US0_REGNUM,
- TILEGX_US1_REGNUM,
- TILEGX_US2_REGNUM,
- TILEGX_US3_REGNUM,
- TILEGX_ZERO_REGNUM,
+ TILEGX_IO0_REGNUM,
+ TILEGX_IO1_REGNUM,
+ TILEGX_US0_REGNUM,
+ TILEGX_US1_REGNUM,
+ TILEGX_US2_REGNUM,
+ TILEGX_US3_REGNUM,
+ TILEGX_ZERO_REGNUM,
- TILEGX_PC_REGNUM,
- TILEGX_NUM_PHYS_REGS = TILEGX_PC_REGNUM, /* 64 */
- TILEGX_FAULTNUM_REGNUM,
- TILEGX_NUM_REGS, /* 66 */
- };
+ TILEGX_PC_REGNUM,
+ TILEGX_NUM_PHYS_REGS = TILEGX_PC_REGNUM, /* 64 */
+ TILEGX_FAULTNUM_REGNUM,
+ TILEGX_NUM_REGS, /* 66 */
+};
-enum { tilegx_reg_size = 8 };
+enum
+{
+ tilegx_reg_size = 8
+};
#endif /* tilegx-tdep.h */
diff --git a/gdb/top.c b/gdb/top.c
index 205eb360ba3..f086e3ee644 100644
--- a/gdb/top.c
+++ b/gdb/top.c
@@ -76,11 +76,11 @@
#include "inf-loop.h"
#if defined(TUI)
-# include "tui/tui.h"
+#include "tui/tui.h"
#endif
#ifndef O_NOCTTY
-# define O_NOCTTY 0
+#define O_NOCTTY 0
#endif
extern void initialize_all_files (void);
@@ -92,7 +92,7 @@ extern void initialize_all_files (void);
/* Default command line prompt. This is overridden in some configs. */
#ifndef DEFAULT_PROMPT
-#define DEFAULT_PROMPT "(gdb) "
+#define DEFAULT_PROMPT "(gdb) "
#endif
struct ui_file **
@@ -133,11 +133,12 @@ int inhibit_gdbinit = 0;
bool confirm = true;
static void
-show_confirm (struct ui_file *file, int from_tty,
- struct cmd_list_element *c, const char *value)
+show_confirm (struct ui_file *file, int from_tty, struct cmd_list_element *c,
+ const char *value)
{
- gdb_printf (file, _("Whether to confirm potentially "
- "dangerous operations is %s.\n"),
+ gdb_printf (file,
+ _ ("Whether to confirm potentially "
+ "dangerous operations is %s.\n"),
value);
}
@@ -207,13 +208,10 @@ char *lim_at_start;
int (*deprecated_ui_loop_hook) (int);
-
/* Called from print_frame_info to list the line we stopped in. */
-void (*deprecated_print_frame_info_listing_hook) (struct symtab * s,
- int line,
- int stopline,
- int noerror);
+void (*deprecated_print_frame_info_listing_hook) (struct symtab *s, int line,
+ int stopline, int noerror);
/* Replaces most of query. */
int (*deprecated_query_hook) (const char *, va_list);
@@ -247,7 +245,7 @@ void (*deprecated_detach_hook) (void);
/* Used by UI as a wrapper around command execution. May do various
things like enabling/disabling buttons, etc... */
-void (*deprecated_call_command_hook) (struct cmd_list_element * c,
+void (*deprecated_call_command_hook) (struct cmd_list_element *c,
const char *cmd, int from_tty);
/* Called when the current thread changes. Argument is thread id. */
@@ -351,7 +349,7 @@ open_terminal_stream (const char *name)
{
scoped_fd fd = gdb_open_cloexec (name, O_RDWR | O_NOCTTY, 0);
if (fd.get () < 0)
- perror_with_name (_("opening terminal failed"));
+ perror_with_name (_ ("opening terminal failed"));
return fd.to_file ("w+");
}
@@ -371,7 +369,7 @@ new_ui_command (const char *args, int from_tty)
argc = argv.count ();
if (argc < 2)
- error (_("Usage: new-ui INTERPRETER TTY"));
+ error (_ ("Usage: new-ui INTERPRETER TTY"));
interpreter_name = argv[0];
tty_name = argv[1];
@@ -384,8 +382,8 @@ new_ui_command (const char *args, int from_tty)
with Windows named pipes. */
gdb_file_up stream = open_terminal_stream (tty_name);
- std::unique_ptr<ui> ui
- (new struct ui (stream.get (), stream.get (), stream.get ()));
+ std::unique_ptr<ui> ui (new struct ui (stream.get (), stream.get (),
+ stream.get ()));
ui->async = 1;
@@ -419,7 +417,7 @@ quit_cover (void)
quit_command ((char *) 0, 0);
}
#endif /* defined SIGHUP */
-
+
/* Line number we are currently in, in a file which is being sourced. */
/* NOTE 1999-04-29: This variable will be static again, once we modify
gdb to use the event loop as the default command loop and we merge
@@ -440,8 +438,7 @@ read_command_file (FILE *stream)
unbuffer_stream (stream);
- scoped_restore save_instream
- = make_scoped_restore (&ui->instream, stream);
+ scoped_restore save_instream = make_scoped_restore (&ui->instream, stream);
/* Read commands from `instream' and execute them until end of file
or error reading instream. */
@@ -513,11 +510,10 @@ check_frame_language_change (void)
enum language flang;
flang = get_frame_language (frame);
- if (!warned
- && flang != language_unknown
+ if (!warned && flang != language_unknown
&& flang != current_language->la_language)
{
- gdb_printf ("%s\n", _(lang_frame_mismatch_warn));
+ gdb_printf ("%s\n", _ (lang_frame_mismatch_warn));
warned = 1;
}
}
@@ -553,8 +549,7 @@ maybe_wait_sync_command_done (int was_sync)
command's list, running command hooks or similars), and we
just ran a synchronous command that started the target, wait
for that command to end. */
- if (!current_ui->async
- && !was_sync
+ if (!current_ui->async && !was_sync
&& current_ui->prompt_state == PROMPT_BLOCKED)
wait_sync_command_done ();
}
@@ -636,9 +631,7 @@ execute_command (const char *p, int from_tty)
/* Clear off trailing whitespace, except for set and complete
command. */
std::string without_whitespace;
- if (arg
- && c->type != set_cmd
- && !is_complete_command (c))
+ if (arg && c->type != set_cmd && !is_complete_command (c))
{
const char *old_end = arg + strlen (arg) - 1;
p = old_end;
@@ -660,19 +653,18 @@ execute_command (const char *p, int from_tty)
/* c->user_commands would be NULL in the case of a python command. */
if (c->theclass == class_user && c->user_commands)
execute_user_command (c, arg);
- else if (c->theclass == class_user
- && c->is_prefix () && !c->allow_unknown)
+ else if (c->theclass == class_user && c->is_prefix ()
+ && !c->allow_unknown)
/* If this is a user defined prefix that does not allow unknown
(in other words, C is a prefix command and not a command
that can be followed by its args), report the list of
subcommands. */
{
std::string prefixname = c->prefixname ();
- std::string prefixname_no_space
+ std::string prefixname_no_space
= prefixname.substr (0, prefixname.length () - 1);
- gdb_printf
- ("\"%s\" must be followed by the name of a subcommand.\n",
- prefixname_no_space.c_str ());
+ gdb_printf ("\"%s\" must be followed by the name of a subcommand.\n",
+ prefixname_no_space.c_str ());
help_list (*c->subcommands, prefixname.c_str (), all_commands,
gdb_stdout);
}
@@ -681,7 +673,7 @@ execute_command (const char *p, int from_tty)
else if (c->type == show_cmd)
do_show_command (arg, from_tty, c);
else if (c->is_command_class_help ())
- error (_("That is not a command, just a help topic."));
+ error (_ ("That is not a command, just a help topic."));
else if (deprecated_call_command_hook)
deprecated_call_command_hook (c, arg, from_tty);
else
@@ -719,7 +711,7 @@ execute_command (const char *p, int from_tty)
/* See gdbcmd.h. */
void
-execute_fn_to_ui_file (struct ui_file *file, std::function<void(void)> fn)
+execute_fn_to_ui_file (struct ui_file *file, std::function<void (void)> fn)
{
/* GDB_STDOUT should be better already restored during these
restoration callbacks. */
@@ -730,14 +722,10 @@ execute_fn_to_ui_file (struct ui_file *file, std::function<void(void)> fn)
{
ui_out_redirect_pop redirect_popper (current_uiout, file);
- scoped_restore save_stdout
- = make_scoped_restore (&gdb_stdout, file);
- scoped_restore save_stderr
- = make_scoped_restore (&gdb_stderr, file);
- scoped_restore save_stdlog
- = make_scoped_restore (&gdb_stdlog, file);
- scoped_restore save_stdtarg
- = make_scoped_restore (&gdb_stdtarg, file);
+ scoped_restore save_stdout = make_scoped_restore (&gdb_stdout, file);
+ scoped_restore save_stderr = make_scoped_restore (&gdb_stderr, file);
+ scoped_restore save_stdlog = make_scoped_restore (&gdb_stdlog, file);
+ scoped_restore save_stdtarg = make_scoped_restore (&gdb_stdtarg, file);
scoped_restore save_stdtargerr
= make_scoped_restore (&gdb_stdtargerr, file);
@@ -748,7 +736,7 @@ execute_fn_to_ui_file (struct ui_file *file, std::function<void(void)> fn)
/* See gdbcmd.h. */
void
-execute_fn_to_string (std::string &res, std::function<void(void)> fn,
+execute_fn_to_string (std::string &res, std::function<void (void)> fn,
bool term_out)
{
string_file str_file (term_out);
@@ -771,10 +759,9 @@ execute_fn_to_string (std::string &res, std::function<void(void)> fn,
/* See gdbcmd.h. */
void
-execute_command_to_ui_file (struct ui_file *file,
- const char *p, int from_tty)
+execute_command_to_ui_file (struct ui_file *file, const char *p, int from_tty)
{
- execute_fn_to_ui_file (file, [=]() { execute_command (p, from_tty); });
+ execute_fn_to_ui_file (file, [=] () { execute_command (p, from_tty); });
}
/* See gdbcmd.h. */
@@ -783,21 +770,20 @@ void
execute_command_to_string (std::string &res, const char *p, int from_tty,
bool term_out)
{
- execute_fn_to_string (res, [=]() { execute_command (p, from_tty); },
- term_out);
+ execute_fn_to_string (
+ res, [=] () { execute_command (p, from_tty); }, term_out);
}
/* See gdbcmd.h. */
void
-execute_command_to_string (const char *p, int from_tty,
- bool term_out)
+execute_command_to_string (const char *p, int from_tty, bool term_out)
{
std::string dummy;
- execute_fn_to_string (dummy, [=]() { execute_command (p, from_tty); },
- term_out);
+ execute_fn_to_string (
+ dummy, [=] () { execute_command (p, from_tty); }, term_out);
}
-
+
/* When nonzero, cause dont_repeat to do nothing. This should only be
set via prevent_dont_repeat. */
@@ -838,7 +824,7 @@ repeat_previous ()
const char *prev = skip_spaces (get_saved_command_line ());
if (*prev == '\0')
- error (_("No previous command to relaunch"));
+ error (_ ("No previous command to relaunch"));
return prev;
}
@@ -870,7 +856,6 @@ save_command_line (const char *cmd)
repeat_arguments = NULL;
}
-
/* Read a line from the stream "instream" without command line editing.
It prints PROMPT once at the start.
@@ -975,11 +960,11 @@ show_write_history_p (struct ui_file *file, int from_tty,
struct cmd_list_element *c, const char *value)
{
if (!write_history_p || !history_filename.empty ())
- gdb_printf (file, _("Saving of the history record on exit is %s.\n"),
+ gdb_printf (file, _ ("Saving of the history record on exit is %s.\n"),
value);
else
- gdb_printf (file, _("Saving of the history is disabled due to "
- "the value of 'history filename'.\n"));
+ gdb_printf (file, _ ("Saving of the history is disabled due to "
+ "the value of 'history filename'.\n"));
}
/* The variable associated with the "set/show history size"
@@ -990,8 +975,7 @@ static void
show_history_size (struct ui_file *file, int from_tty,
struct cmd_list_element *c, const char *value)
{
- gdb_printf (file, _("The size of the command history is %s.\n"),
- value);
+ gdb_printf (file, _ ("The size of the command history is %s.\n"), value);
}
/* Variable associated with the "history remove-duplicates" option.
@@ -1003,8 +987,8 @@ show_history_remove_duplicates (struct ui_file *file, int from_tty,
struct cmd_list_element *c, const char *value)
{
gdb_printf (file,
- _("The number of history entries to look back at for "
- "duplicates is %s.\n"),
+ _ ("The number of history entries to look back at for "
+ "duplicates is %s.\n"),
value);
}
@@ -1014,12 +998,13 @@ show_history_filename (struct ui_file *file, int from_tty,
struct cmd_list_element *c, const char *value)
{
if (!history_filename.empty ())
- gdb_printf (file, _("The filename in which to record "
- "the command history is \"%ps\".\n"),
+ gdb_printf (file,
+ _ ("The filename in which to record "
+ "the command history is \"%ps\".\n"),
styled_string (file_name_style.style (), value));
else
- gdb_printf (file, _("There is no filename currently set for "
- "recording the command history in.\n"));
+ gdb_printf (file, _ ("There is no filename currently set for "
+ "recording the command history in.\n"));
}
/* This is like readline(), but it has some gdb-specific behavior.
@@ -1053,7 +1038,6 @@ static char *gdb_readline_wrapper_result;
return. */
static void (*saved_after_char_processing_hook) (void);
-
/* See top.h. */
int
@@ -1062,7 +1046,6 @@ gdb_in_secondary_prompt_p (struct ui *ui)
return ui->secondary_prompt_depth > 0;
}
-
/* This function is called when readline has seen a complete line of
text. */
@@ -1092,10 +1075,12 @@ gdb_readline_wrapper_line (gdb::unique_xmalloc_ptr<char> &&line)
class gdb_readline_wrapper_cleanup
{
public:
+
gdb_readline_wrapper_cleanup ()
: m_handler_orig (current_ui->input_handler),
m_already_prompted_orig (current_ui->command_editing
- ? rl_already_prompted : 0),
+ ? rl_already_prompted
+ : 0),
m_target_is_async_orig (target_is_async_p ()),
m_save_ui (&current_ui)
{
@@ -1175,7 +1160,6 @@ gdb_readline_wrapper (const char *prompt)
return gdb_readline_wrapper_result;
}
-
/* The current saved history number from operate-and-get-next.
This is -1 if not valid. */
static int operate_saved_history = -1;
@@ -1212,7 +1196,7 @@ gdb_rl_operate_and_get_next (int count, int key)
after_char_processing_hook = gdb_rl_operate_and_get_next_completion;
/* Find the current line, and find the next line to use. */
- where = where_history();
+ where = where_history ();
if ((history_is_stifled () && (history_length >= history_max_entries))
|| (where >= history_length - 1))
@@ -1280,13 +1264,14 @@ gdb_safe_append_history (void)
int ret, saved_errno;
std::string local_history_filename
- = string_printf ("%s-gdb%ld~", history_filename.c_str (), (long) getpid ());
+ = string_printf ("%s-gdb%ld~", history_filename.c_str (),
+ (long) getpid ());
ret = rename (history_filename.c_str (), local_history_filename.c_str ());
saved_errno = errno;
if (ret < 0 && saved_errno != ENOENT)
{
- warning (_("Could not rename %ps to %ps: %s"),
+ warning (_ ("Could not rename %ps to %ps: %s"),
styled_string (file_name_style.style (),
history_filename.c_str ()),
styled_string (file_name_style.style (),
@@ -1305,8 +1290,8 @@ gdb_safe_append_history (void)
(not append) our known history to our local history file and try
to move it back anyway. Otherwise a global history file would
never get created! */
- gdb_assert (saved_errno == ENOENT);
- write_history (local_history_filename.c_str ());
+ gdb_assert (saved_errno == ENOENT);
+ write_history (local_history_filename.c_str ());
}
else
{
@@ -1316,10 +1301,11 @@ gdb_safe_append_history (void)
history_max_entries);
}
- ret = rename (local_history_filename.c_str (), history_filename.c_str ());
+ ret
+ = rename (local_history_filename.c_str (), history_filename.c_str ());
saved_errno = errno;
if (ret < 0 && saved_errno != EEXIST)
- warning (_("Could not rename %s to %s: %s"),
+ warning (_ ("Could not rename %s to %s: %s"),
local_history_filename.c_str (), history_filename.c_str (),
safe_strerror (saved_errno));
}
@@ -1352,9 +1338,8 @@ command_line_input (std::string &cmd_line_buffer, const char *prompt_arg,
{
char *local_prompt;
- local_prompt
- = (char *) alloca ((prompt == NULL ? 0 : strlen (prompt))
- + strlen (annotation_suffix) + 40);
+ local_prompt = (char *) alloca ((prompt == NULL ? 0 : strlen (prompt))
+ + strlen (annotation_suffix) + 40);
if (prompt == NULL)
local_prompt[0] = '\0';
else
@@ -1388,14 +1373,12 @@ command_line_input (std::string &cmd_line_buffer, const char *prompt_arg,
printf_unfiltered ("\n\032\032pre-%s\n", annotation_suffix);
/* Don't use fancy stuff if not talking to stdin. */
- if (deprecated_readline_hook
- && from_tty
+ if (deprecated_readline_hook && from_tty
&& current_ui->input_interactive_p ())
{
rl.reset ((*deprecated_readline_hook) (prompt));
}
- else if (command_editing_p
- && from_tty
+ else if (command_editing_p && from_tty
&& current_ui->input_interactive_p ())
{
rl.reset (gdb_readline_wrapper (prompt));
@@ -1405,8 +1388,8 @@ command_line_input (std::string &cmd_line_buffer, const char *prompt_arg,
rl.reset (gdb_readline_no_editing (prompt));
}
- cmd = handle_line_of_input (cmd_line_buffer, rl.get (),
- 0, annotation_suffix);
+ cmd = handle_line_of_input (cmd_line_buffer, rl.get (), 0,
+ annotation_suffix);
if (cmd == (char *) EOF)
{
cmd = NULL;
@@ -1428,7 +1411,7 @@ command_line_input (std::string &cmd_line_buffer, const char *prompt_arg,
return cmd;
}
-
+
/* See top.h. */
void
print_gdb_version (struct ui_file *stream, bool interactive)
@@ -1443,8 +1426,7 @@ print_gdb_version (struct ui_file *stream, bool interactive)
/* Second line is a copyright notice. */
- gdb_printf (stream,
- "Copyright (C) 2023 Free Software Foundation, Inc.\n");
+ gdb_printf (stream, "Copyright (C) 2023 Free Software Foundation, Inc.\n");
/* Following the copyright is a brief statement that the program is
free software, that users are free to copy and change it on
@@ -1455,8 +1437,8 @@ print_gdb_version (struct ui_file *stream, bool interactive)
License GPLv3+: GNU GPL version 3 or later <%ps>\
\nThis is free software: you are free to change and redistribute it.\n\
There is NO WARRANTY, to the extent permitted by law.",
- styled_string (file_name_style.style (),
- "http://gnu.org/licenses/gpl.html"));
+ styled_string (file_name_style.style (),
+ "http://gnu.org/licenses/gpl.html"));
if (!interactive)
return;
@@ -1469,8 +1451,7 @@ There is NO WARRANTY, to the extent permitted by law.",
gdb_printf (stream, "This GDB was configured as \"");
if (strcmp (host_name, target_name) != 0)
{
- gdb_printf (stream, "--host=%s --target=%s",
- host_name, target_name);
+ gdb_printf (stream, "--host=%s --target=%s", host_name, target_name);
}
else
{
@@ -1478,26 +1459,23 @@ There is NO WARRANTY, to the extent permitted by law.",
}
gdb_printf (stream, "\".\n");
- gdb_printf (stream, _("Type \"show configuration\" "
- "for configuration details.\n"));
+ gdb_printf (stream, _ ("Type \"show configuration\" "
+ "for configuration details.\n"));
if (REPORT_BUGS_TO[0])
{
- gdb_printf (stream,
- _("For bug reporting instructions, please see:\n"));
+ gdb_printf (stream, _ ("For bug reporting instructions, please see:\n"));
gdb_printf (stream, "%ps.\n",
- styled_string (file_name_style.style (),
- REPORT_BUGS_TO));
+ styled_string (file_name_style.style (), REPORT_BUGS_TO));
}
- gdb_printf (stream,
- _("Find the GDB manual and other documentation \
+ gdb_printf (
+ stream, _ ("Find the GDB manual and other documentation \
resources online at:\n <%ps>."),
- styled_string (file_name_style.style (),
- "http://www.gnu.org/software/gdb/documentation/"));
+ styled_string (file_name_style.style (),
+ "http://www.gnu.org/software/gdb/documentation/"));
gdb_printf (stream, "\n\n");
- gdb_printf (stream, _("For help, type \"help\".\n"));
- gdb_printf (stream,
- _("Type \"apropos word\" to search for commands \
+ gdb_printf (stream, _ ("For help, type \"help\".\n"));
+ gdb_printf (stream, _ ("Type \"apropos word\" to search for commands \
related to \"word\"."));
}
@@ -1505,194 +1483,211 @@ related to \"word\"."));
void
print_gdb_configuration (struct ui_file *stream)
{
- gdb_printf (stream, _("\
+ gdb_printf (stream, _ ("\
This GDB was configured as follows:\n\
configure --host=%s --target=%s\n\
-"), host_name, target_name);
+"),
+ host_name, target_name);
- gdb_printf (stream, _("\
+ gdb_printf (stream, _ ("\
--with-auto-load-dir=%s\n\
--with-auto-load-safe-path=%s\n\
-"), AUTO_LOAD_DIR, AUTO_LOAD_SAFE_PATH);
+"),
+ AUTO_LOAD_DIR, AUTO_LOAD_SAFE_PATH);
#if HAVE_LIBEXPAT
- gdb_printf (stream, _("\
+ gdb_printf (stream, _ ("\
--with-expat\n\
"));
#else
- gdb_printf (stream, _("\
+ gdb_printf (stream, _ ("\
--without-expat\n\
"));
#endif
if (GDB_DATADIR[0])
- gdb_printf (stream, _("\
+ gdb_printf (stream, _ ("\
--with-gdb-datadir=%s%s\n\
-"), GDB_DATADIR, GDB_DATADIR_RELOCATABLE ? " (relocatable)" : "");
+"),
+ GDB_DATADIR, GDB_DATADIR_RELOCATABLE ? " (relocatable)" : "");
#ifdef ICONV_BIN
- gdb_printf (stream, _("\
+ gdb_printf (stream, _ ("\
--with-iconv-bin=%s%s\n\
-"), ICONV_BIN, ICONV_BIN_RELOCATABLE ? " (relocatable)" : "");
+"),
+ ICONV_BIN, ICONV_BIN_RELOCATABLE ? " (relocatable)" : "");
#endif
if (JIT_READER_DIR[0])
- gdb_printf (stream, _("\
+ gdb_printf (stream, _ ("\
--with-jit-reader-dir=%s%s\n\
-"), JIT_READER_DIR, JIT_READER_DIR_RELOCATABLE ? " (relocatable)" : "");
+"),
+ JIT_READER_DIR,
+ JIT_READER_DIR_RELOCATABLE ? " (relocatable)" : "");
#if HAVE_LIBUNWIND_IA64_H
- gdb_printf (stream, _("\
+ gdb_printf (stream, _ ("\
--with-libunwind-ia64\n\
"));
#else
- gdb_printf (stream, _("\
+ gdb_printf (stream, _ ("\
--without-libunwind-ia64\n\
"));
#endif
#if HAVE_LIBLZMA
- gdb_printf (stream, _("\
+ gdb_printf (stream, _ ("\
--with-lzma\n\
"));
#else
- gdb_printf (stream, _("\
+ gdb_printf (stream, _ ("\
--without-lzma\n\
"));
#endif
#if HAVE_LIBBABELTRACE
- gdb_printf (stream, _("\
+ gdb_printf (stream, _ ("\
--with-babeltrace\n\
"));
#else
- gdb_printf (stream, _("\
+ gdb_printf (stream, _ ("\
--without-babeltrace\n\
"));
#endif
#if HAVE_LIBIPT
- gdb_printf (stream, _("\
+ gdb_printf (stream, _ ("\
--with-intel-pt\n\
"));
#else
- gdb_printf (stream, _("\
+ gdb_printf (stream, _ ("\
--without-intel-pt\n\
"));
#endif
#if HAVE_LIBXXHASH
- gdb_printf (stream, _("\
+ gdb_printf (stream, _ ("\
--with-xxhash\n\
"));
#else
- gdb_printf (stream, _("\
+ gdb_printf (stream, _ ("\
--without-xxhash\n\
"));
#endif
#ifdef WITH_PYTHON_PATH
- gdb_printf (stream, _("\
+ gdb_printf (stream, _ ("\
--with-python=%s%s\n\
-"), WITH_PYTHON_PATH, PYTHON_PATH_RELOCATABLE ? " (relocatable)" : "");
+"),
+ WITH_PYTHON_PATH,
+ PYTHON_PATH_RELOCATABLE ? " (relocatable)" : "");
#else
- gdb_printf (stream, _("\
+ gdb_printf (stream, _ ("\
--without-python\n\
"));
#endif
#ifdef WITH_PYTHON_LIBDIR
- gdb_printf (stream, _("\
+ gdb_printf (stream, _ ("\
--with-python-libdir=%s%s\n\
-"), WITH_PYTHON_LIBDIR, PYTHON_LIBDIR_RELOCATABLE ? " (relocatable)" : "");
+"),
+ WITH_PYTHON_LIBDIR,
+ PYTHON_LIBDIR_RELOCATABLE ? " (relocatable)" : "");
#else
- gdb_printf (stream, _("\
+ gdb_printf (stream, _ ("\
--without-python-libdir\n\
"));
#endif
#if HAVE_LIBDEBUGINFOD
- gdb_printf (stream, _("\
+ gdb_printf (stream, _ ("\
--with-debuginfod\n\
"));
#else
- gdb_printf (stream, _("\
+ gdb_printf (stream, _ ("\
--without-debuginfod\n\
"));
#endif
#if HAVE_GUILE
- gdb_printf (stream, _("\
+ gdb_printf (stream, _ ("\
--with-guile\n\
"));
#else
- gdb_printf (stream, _("\
+ gdb_printf (stream, _ ("\
--without-guile\n\
"));
#endif
#if HAVE_SOURCE_HIGHLIGHT
- gdb_printf (stream, _("\
+ gdb_printf (stream, _ ("\
--enable-source-highlight\n\
"));
#else
- gdb_printf (stream, _("\
+ gdb_printf (stream, _ ("\
--disable-source-highlight\n\
"));
#endif
#if CXX_STD_THREAD
- gdb_printf (stream, _("\
+ gdb_printf (stream, _ ("\
--enable-threading\n\
"));
#else
- gdb_printf (stream, _("\
+ gdb_printf (stream, _ ("\
--disable-threading\n\
"));
#endif
#ifdef TUI
- gdb_printf (stream, _("\
+ gdb_printf (stream, _ ("\
--enable-tui\n\
"));
#else
- gdb_printf (stream, _("\
+ gdb_printf (stream, _ ("\
--disable-tui\n\
"));
#endif
#ifdef RELOC_SRCDIR
- gdb_printf (stream, _("\
+ gdb_printf (stream, _ ("\
--with-relocated-sources=%s\n\
-"), RELOC_SRCDIR);
+"),
+ RELOC_SRCDIR);
#endif
if (DEBUGDIR[0])
- gdb_printf (stream, _("\
+ gdb_printf (stream, _ ("\
--with-separate-debug-dir=%s%s\n\
-"), DEBUGDIR, DEBUGDIR_RELOCATABLE ? " (relocatable)" : "");
+"),
+ DEBUGDIR, DEBUGDIR_RELOCATABLE ? " (relocatable)" : "");
if (TARGET_SYSTEM_ROOT[0])
- gdb_printf (stream, _("\
+ gdb_printf (stream, _ ("\
--with-sysroot=%s%s\n\
-"), TARGET_SYSTEM_ROOT, TARGET_SYSTEM_ROOT_RELOCATABLE ? " (relocatable)" : "");
+"),
+ TARGET_SYSTEM_ROOT,
+ TARGET_SYSTEM_ROOT_RELOCATABLE ? " (relocatable)" : "");
if (SYSTEM_GDBINIT[0])
- gdb_printf (stream, _("\
+ gdb_printf (stream, _ ("\
--with-system-gdbinit=%s%s\n\
-"), SYSTEM_GDBINIT, SYSTEM_GDBINIT_RELOCATABLE ? " (relocatable)" : "");
+"),
+ SYSTEM_GDBINIT,
+ SYSTEM_GDBINIT_RELOCATABLE ? " (relocatable)" : "");
if (SYSTEM_GDBINIT_DIR[0])
- gdb_printf (stream, _("\
+ gdb_printf (stream, _ ("\
--with-system-gdbinit-dir=%s%s\n\
-"), SYSTEM_GDBINIT_DIR, SYSTEM_GDBINIT_DIR_RELOCATABLE ? " (relocatable)" : "");
+"),
+ SYSTEM_GDBINIT_DIR,
+ SYSTEM_GDBINIT_DIR_RELOCATABLE ? " (relocatable)" : "");
/* We assume "relocatable" will be printed at least once, thus we always
print this text. It's a reasonably safe assumption for now. */
- gdb_printf (stream, _("\n\
+ gdb_printf (stream, _ ("\n\
(\"Relocatable\" means the directory can be moved with the GDB installation\n\
tree, and GDB will still find it.)\n\
"));
}
-
/* The current top level prompt, settable with "set prompt", and/or
with the python `gdb.prompt_hook' hook. */
@@ -1713,7 +1708,6 @@ set_prompt (const char *s)
{
top_prompt = s;
}
-
/* Kills or detaches the given inferior, depending on how we originally
gained control of it. */
@@ -1750,12 +1744,10 @@ print_inferior_quit_action (inferior *inf, ui_file *out)
return;
if (inf->attach_flag)
- gdb_printf (out,
- _("\tInferior %d [%s] will be detached.\n"), inf->num,
+ gdb_printf (out, _ ("\tInferior %d [%s] will be detached.\n"), inf->num,
target_pid_to_str (ptid_t (inf->pid)).c_str ());
else
- gdb_printf (out,
- _("\tInferior %d [%s] will be killed.\n"), inf->num,
+ gdb_printf (out, _ ("\tInferior %d [%s] will be killed.\n"), inf->num,
target_pid_to_str (ptid_t (inf->pid)).c_str ());
}
@@ -1772,12 +1764,12 @@ quit_confirm (void)
/* Build the query string as a single string. */
string_file stb;
- stb.puts (_("A debugging session is active.\n\n"));
+ stb.puts (_ ("A debugging session is active.\n\n"));
for (inferior *inf : all_inferiors ())
print_inferior_quit_action (inf, &stb);
- stb.puts (_("\nQuit anyway? "));
+ stb.puts (_ ("\nQuit anyway? "));
return query ("%s", stb.c_str ());
}
@@ -1802,7 +1794,6 @@ undo_terminal_modifications_before_exit (void)
current_ui = saved_top_level;
}
-
/* Quit without asking for confirmation. */
void
@@ -1902,11 +1893,11 @@ static enum auto_boolean interactive_mode = AUTO_BOOLEAN_AUTO;
static void
show_interactive_mode (struct ui_file *file, int from_tty,
- struct cmd_list_element *c,
- const char *value)
+ struct cmd_list_element *c, const char *value)
{
if (interactive_mode == AUTO_BOOLEAN_AUTO)
- gdb_printf (file, "Debugger's interactive mode "
+ gdb_printf (file,
+ "Debugger's interactive mode "
"is %s (currently %s).\n",
value, current_ui->input_interactive_p () ? "on" : "off");
else
@@ -1926,7 +1917,7 @@ ui::input_interactive_p () const
return m_input_interactive_p;
}
-
+
static void
dont_repeat_command (const char *ignored, int from_tty)
{
@@ -1934,11 +1925,12 @@ dont_repeat_command (const char *ignored, int from_tty)
from stdin. */
*saved_command_line = 0;
}
-
+
/* Functions to manipulate command line editing control variables. */
/* Number of commands to print in each call to show_commands. */
#define Hist_print 10
+
void
show_commands (const char *args, int from_tty)
{
@@ -1978,8 +1970,7 @@ show_commands (const char *args, int from_tty)
num = 0;
}
- for (offset = num;
- offset < num + Hist_print && offset < history_length;
+ for (offset = num; offset < num + Hist_print && offset < history_length;
offset++)
{
gdb_printf ("%5d %s\n", history_base + offset,
@@ -2014,13 +2005,13 @@ set_readline_history_size (int history_size)
/* Called by do_setshow_command. */
static void
-set_history_size_command (const char *args,
- int from_tty, struct cmd_list_element *c)
+set_history_size_command (const char *args, int from_tty,
+ struct cmd_list_element *c)
{
set_readline_history_size (history_size_setshow_var);
}
-bool info_verbose = false; /* Default verbose msgs off. */
+bool info_verbose = false; /* Default verbose msgs off. */
/* Called by do_set_command. An elaborate joke. */
void
@@ -2038,13 +2029,13 @@ set_verbose (const char *args, int from_tty, struct cmd_list_element *c)
xfree ((char *) showcmd->doc);
if (info_verbose)
{
- c->doc = _("Set verbose printing of informational messages.");
- showcmd->doc = _("Show verbose printing of informational messages.");
+ c->doc = _ ("Set verbose printing of informational messages.");
+ showcmd->doc = _ ("Show verbose printing of informational messages.");
}
else
{
- c->doc = _("Set verbosity.");
- showcmd->doc = _("Show verbosity.");
+ c->doc = _ ("Set verbosity.");
+ showcmd->doc = _ ("Show verbosity.");
}
c->doc_allocated = 0;
showcmd->doc_allocated = 0;
@@ -2080,8 +2071,7 @@ init_history (void)
with how bash handles HISTSIZE. */
if (*endptr != '\0')
;
- else if (*tmpenv == '\0'
- || var < 0
+ else if (*tmpenv == '\0' || var < 0
|| var > INT_MAX
/* On targets where INT_MAX == LONG_MAX, we have to look at
errno after calling strtol to distinguish between a value that
@@ -2105,10 +2095,10 @@ init_history (void)
}
static void
-show_prompt (struct ui_file *file, int from_tty,
- struct cmd_list_element *c, const char *value)
+show_prompt (struct ui_file *file, int from_tty, struct cmd_list_element *c,
+ const char *value)
{
- gdb_printf (file, _("Gdb's prompt is \"%s\".\n"), value);
+ gdb_printf (file, _ ("Gdb's prompt is \"%s\".\n"), value);
}
/* "set editing" command. */
@@ -2123,27 +2113,29 @@ set_editing (const char *args, int from_tty, struct cmd_list_element *c)
}
static void
-show_editing (struct ui_file *file, int from_tty,
- struct cmd_list_element *c, const char *value)
+show_editing (struct ui_file *file, int from_tty, struct cmd_list_element *c,
+ const char *value)
{
- gdb_printf (file, _("Editing of command lines as "
- "they are typed is %s.\n"),
- current_ui->command_editing ? _("on") : _("off"));
+ gdb_printf (file,
+ _ ("Editing of command lines as "
+ "they are typed is %s.\n"),
+ current_ui->command_editing ? _ ("on") : _ ("off"));
}
static void
show_annotation_level (struct ui_file *file, int from_tty,
struct cmd_list_element *c, const char *value)
{
- gdb_printf (file, _("Annotation_level is %s.\n"), value);
+ gdb_printf (file, _ ("Annotation_level is %s.\n"), value);
}
static void
show_exec_done_display_p (struct ui_file *file, int from_tty,
struct cmd_list_element *c, const char *value)
{
- gdb_printf (file, _("Notification of completion for "
- "asynchronous execution commands is %s.\n"),
+ gdb_printf (file,
+ _ ("Notification of completion for "
+ "asynchronous execution commands is %s.\n"),
value);
}
@@ -2175,16 +2167,15 @@ static void
show_gdb_datadir (struct ui_file *file, int from_tty,
struct cmd_list_element *c, const char *value)
{
- gdb_printf (file, _("GDB's data directory is \"%ps\".\n"),
- styled_string (file_name_style.style (),
- gdb_datadir.c_str ()));
+ gdb_printf (file, _ ("GDB's data directory is \"%ps\".\n"),
+ styled_string (file_name_style.style (), gdb_datadir.c_str ()));
}
/* Implement 'set history filename'. */
static void
-set_history_filename (const char *args,
- int from_tty, struct cmd_list_element *c)
+set_history_filename (const char *args, int from_tty,
+ struct cmd_list_element *c)
{
/* We include the current directory so that if the user changes
directories the file written will be the same as the one
@@ -2210,10 +2201,9 @@ check_quiet_mode ()
static void
show_startup_quiet (struct ui_file *file, int from_tty,
- struct cmd_list_element *c, const char *value)
+ struct cmd_list_element *c, const char *value)
{
- gdb_printf (file, _("Whether to start up quietly is %s.\n"),
- value);
+ gdb_printf (file, _ ("Whether to start up quietly is %s.\n"), value);
}
static void
@@ -2244,55 +2234,56 @@ init_main (void)
15 is Control-o, the same binding this function has in Bash. */
rl_add_defun ("operate-and-get-next", gdb_rl_operate_and_get_next, 15);
- add_setshow_string_cmd ("prompt", class_support,
- &top_prompt,
- _("Set gdb's prompt."),
- _("Show gdb's prompt."),
- NULL, NULL,
- show_prompt,
- &setlist, &showlist);
+ add_setshow_string_cmd ("prompt", class_support, &top_prompt,
+ _ ("Set gdb's prompt."), _ ("Show gdb's prompt."),
+ NULL, NULL, show_prompt, &setlist, &showlist);
- add_com ("dont-repeat", class_support, dont_repeat_command, _("\
+ add_com ("dont-repeat", class_support, dont_repeat_command, _ ("\
Don't repeat this command.\nPrimarily \
used inside of user-defined commands that should not be repeated when\n\
hitting return."));
- add_setshow_boolean_cmd ("editing", class_support,
- &set_editing_cmd_var, _("\
-Set editing of command lines as they are typed."), _("\
-Show editing of command lines as they are typed."), _("\
+ add_setshow_boolean_cmd ("editing", class_support, &set_editing_cmd_var,
+ _ ("\
+Set editing of command lines as they are typed."),
+ _ ("\
+Show editing of command lines as they are typed."),
+ _ ("\
Use \"on\" to enable the editing, and \"off\" to disable it.\n\
Without an argument, command line editing is enabled. To edit, use\n\
EMACS-like or VI-like commands like control-P or ESC."),
- set_editing,
- show_editing,
- &setlist, &showlist);
+ set_editing, show_editing, &setlist, &showlist);
- add_setshow_boolean_cmd ("save", no_class, &write_history_p, _("\
-Set saving of the history record on exit."), _("\
-Show saving of the history record on exit."), _("\
+ add_setshow_boolean_cmd ("save", no_class, &write_history_p, _ ("\
+Set saving of the history record on exit."),
+ _ ("\
+Show saving of the history record on exit."),
+ _ ("\
Use \"on\" to enable the saving, and \"off\" to disable it.\n\
Without an argument, saving is enabled."),
- NULL,
- show_write_history_p,
- &sethistlist, &showhistlist);
+ NULL, show_write_history_p, &sethistlist,
+ &showhistlist);
add_setshow_zuinteger_unlimited_cmd ("size", no_class,
- &history_size_setshow_var, _("\
-Set the size of the command history."), _("\
-Show the size of the command history."), _("\
+ &history_size_setshow_var, _ ("\
+Set the size of the command history."),
+ _ ("\
+Show the size of the command history."),
+ _ ("\
This is the number of previous commands to keep a record of.\n\
If set to \"unlimited\", the number of commands kept in the history\n\
list is unlimited. This defaults to the value of the environment\n\
variable \"GDBHISTSIZE\", or to 256 if this variable is not set."),
- set_history_size_command,
- show_history_size,
- &sethistlist, &showhistlist);
+ set_history_size_command,
+ show_history_size, &sethistlist,
+ &showhistlist);
add_setshow_zuinteger_unlimited_cmd ("remove-duplicates", no_class,
- &history_remove_duplicates, _("\
-Set how far back in history to look for and remove duplicate entries."), _("\
-Show how far back in history to look for and remove duplicate entries."), _("\
+ &history_remove_duplicates, _ ("\
+Set how far back in history to look for and remove duplicate entries."),
+ _ ("\
+Show how far back in history to look for and remove duplicate entries."),
+ _ ("\
If set to a nonzero value N, GDB will look back at the last N history entries\n\
and remove the first history entry that is a duplicate of the most recent\n\
entry, each time a new history entry is added.\n\
@@ -2300,84 +2291,87 @@ If set to \"unlimited\", this lookbehind is unbounded.\n\
Only history entries added during this session are considered for removal.\n\
If set to 0, removal of duplicate history entries is disabled.\n\
By default this option is set to 0."),
- NULL,
- show_history_remove_duplicates,
- &sethistlist, &showhistlist);
-
- add_setshow_optional_filename_cmd ("filename", no_class, &history_filename, _("\
-Set the filename in which to record the command history."), _("\
-Show the filename in which to record the command history."), _("\
+ NULL, show_history_remove_duplicates,
+ &sethistlist, &showhistlist);
+
+ add_setshow_optional_filename_cmd ("filename", no_class, &history_filename,
+ _ ("\
+Set the filename in which to record the command history."),
+ _ ("\
+Show the filename in which to record the command history."),
+ _ ("\
(the list of previous commands of which a record is kept)."),
- set_history_filename,
- show_history_filename,
- &sethistlist, &showhistlist);
-
- add_setshow_boolean_cmd ("confirm", class_support, &confirm, _("\
-Set whether to confirm potentially dangerous operations."), _("\
-Show whether to confirm potentially dangerous operations."), NULL,
- NULL,
- show_confirm,
- &setlist, &showlist);
-
- add_setshow_zinteger_cmd ("annotate", class_obscure, &annotation_level, _("\
-Set annotation_level."), _("\
-Show annotation_level."), _("\
+ set_history_filename,
+ show_history_filename, &sethistlist,
+ &showhistlist);
+
+ add_setshow_boolean_cmd ("confirm", class_support, &confirm, _ ("\
+Set whether to confirm potentially dangerous operations."),
+ _ ("\
+Show whether to confirm potentially dangerous operations."),
+ NULL, NULL, show_confirm, &setlist, &showlist);
+
+ add_setshow_zinteger_cmd ("annotate", class_obscure, &annotation_level, _ ("\
+Set annotation_level."),
+ _ ("\
+Show annotation_level."),
+ _ ("\
0 == normal; 1 == fullname (for use when running under emacs)\n\
2 == output annotated suitably for use by programs that control GDB."),
- NULL,
- show_annotation_level,
- &setlist, &showlist);
+ NULL, show_annotation_level, &setlist, &showlist);
add_setshow_boolean_cmd ("exec-done-display", class_support,
- &exec_done_display_p, _("\
-Set notification of completion for asynchronous execution commands."), _("\
-Show notification of completion for asynchronous execution commands."), _("\
+ &exec_done_display_p, _ ("\
+Set notification of completion for asynchronous execution commands."),
+ _ ("\
+Show notification of completion for asynchronous execution commands."),
+ _ ("\
Use \"on\" to enable the notification, and \"off\" to disable it."),
- NULL,
- show_exec_done_display_p,
- &setlist, &showlist);
+ NULL, show_exec_done_display_p, &setlist,
+ &showlist);
add_setshow_filename_cmd ("data-directory", class_maintenance,
- &staged_gdb_datadir, _("Set GDB's data directory."),
- _("Show GDB's data directory."),
- _("\
+ &staged_gdb_datadir,
+ _ ("Set GDB's data directory."),
+ _ ("Show GDB's data directory."), _ ("\
When set, GDB uses the specified path to search for data files."),
- set_gdb_datadir, show_gdb_datadir,
- &setlist,
+ set_gdb_datadir, show_gdb_datadir, &setlist,
&showlist);
/* Prime the initial value for data-directory. */
staged_gdb_datadir = gdb_datadir;
add_setshow_auto_boolean_cmd ("interactive-mode", class_support,
- &interactive_mode, _("\
-Set whether GDB's standard input is a terminal."), _("\
-Show whether GDB's standard input is a terminal."), _("\
+ &interactive_mode, _ ("\
+Set whether GDB's standard input is a terminal."),
+ _ ("\
+Show whether GDB's standard input is a terminal."),
+ _ ("\
If on, GDB assumes that standard input is a terminal. In practice, it\n\
means that GDB should wait for the user to answer queries associated to\n\
commands entered at the command prompt. If off, GDB assumes that standard\n\
input is not a terminal, and uses the default answer to all queries.\n\
If auto (the default), determine which mode to use based on the standard\n\
input settings."),
- NULL,
- show_interactive_mode,
- &setlist, &showlist);
-
- add_setshow_boolean_cmd ("startup-quietly", class_support,
- &startup_quiet, _("\
-Set whether GDB should start up quietly."), _(" \
-Show whether GDB should start up quietly."), _("\
+ NULL, show_interactive_mode, &setlist,
+ &showlist);
+
+ add_setshow_boolean_cmd ("startup-quietly", class_support, &startup_quiet,
+ _ ("\
+Set whether GDB should start up quietly."),
+ _ (" \
+Show whether GDB should start up quietly."),
+ _ ("\
This setting will not affect the current session. Instead this command\n\
should be added to the .gdbearlyinit file in the users home directory to\n\
affect future GDB sessions."),
- NULL,
- show_startup_quiet,
- &setlist, &showlist);
+ NULL, show_startup_quiet, &setlist, &showlist);
- c = add_cmd ("new-ui", class_support, new_ui_command, _("\
+ c = add_cmd ("new-ui", class_support, new_ui_command, _ ("\
Create a new UI.\n\
Usage: new-ui INTERPRETER TTY\n\
The first argument is the name of the interpreter to run.\n\
-The second argument is the terminal the UI runs on."), &cmdlist);
+The second argument is the terminal the UI runs on."),
+ &cmdlist);
set_cmd_completer (c, interpreter_completer);
struct internalvar *major_version_var = create_internalvar ("_gdb_major");
@@ -2417,7 +2411,7 @@ gdb_init ()
initialize_progspace ();
initialize_inferiors ();
initialize_current_architecture ();
- init_main (); /* But that omits this file! Do it now. */
+ init_main (); /* But that omits this file! Do it now. */
initialize_stdin_serial ();
@@ -2432,10 +2426,11 @@ gdb_init ()
set in a config file or implicitly set by reading an executable
during startup. */
set_language (language_c);
- expected_language = current_language; /* Don't warn about the change. */
+ expected_language = current_language; /* Don't warn about the change. */
}
void _initialize_top ();
+
void
_initialize_top ()
{
diff --git a/gdb/top.h b/gdb/top.h
index 9f9a0281be4..67782acc476 100644
--- a/gdb/top.h
+++ b/gdb/top.h
@@ -174,7 +174,9 @@ class switch_thru_all_uis
{
public:
- switch_thru_all_uis () : m_iter (ui_list), m_save_ui (&current_ui)
+ switch_thru_all_uis ()
+ : m_iter (ui_list),
+ m_save_ui (&current_ui)
{
current_ui = ui_list;
}
@@ -182,10 +184,7 @@ public:
DISABLE_COPY_AND_ASSIGN (switch_thru_all_uis);
/* If done iterating, return true; otherwise return false. */
- bool done () const
- {
- return m_iter == NULL;
- }
+ bool done () const { return m_iter == NULL; }
/* Move to the next UI, setting current_ui if iteration is not yet
complete. */
@@ -196,7 +195,7 @@ public:
current_ui = m_iter;
}
- private:
+private:
/* Used to iterate through the UIs. */
struct ui *m_iter;
@@ -205,16 +204,16 @@ public:
scoped_restore_tmpl<struct ui *> m_save_ui;
};
- /* Traverse through all UI, and switch the current UI to the one
+/* Traverse through all UI, and switch the current UI to the one
being iterated. */
-#define SWITCH_THRU_ALL_UIS() \
+#define SWITCH_THRU_ALL_UIS() \
for (switch_thru_all_uis stau_state; !stau_state.done (); stau_state.next ())
using ui_range = next_range<ui>;
/* An adapter that can be used to traverse over all UIs. */
-static inline
-ui_range all_uis ()
+static inline ui_range
+all_uis ()
{
return ui_range (ui_list);
}
diff --git a/gdb/tracectf.c b/gdb/tracectf.c
index d8d0f05d049..3a21bd0f976 100644
--- a/gdb/tracectf.c
+++ b/gdb/tracectf.c
@@ -36,30 +36,26 @@
/* The CTF target. */
-static const target_info ctf_target_info = {
- "ctf",
- N_("CTF file"),
- N_("(Use a CTF directory as a target.\n\
-Specify the filename of the CTF directory.")
-};
+static const target_info ctf_target_info
+ = { "ctf", N_ ("CTF file"), N_ ("(Use a CTF directory as a target.\n\
+Specify the filename of the CTF directory.") };
class ctf_target final : public tracefile_target
{
public:
- const target_info &info () const override
- { return ctf_target_info; }
+
+ const target_info &info () const override { return ctf_target_info; }
void close () override;
void fetch_registers (struct regcache *, int) override;
enum target_xfer_status xfer_partial (enum target_object object,
- const char *annex,
- gdb_byte *readbuf,
- const gdb_byte *writebuf,
- ULONGEST offset, ULONGEST len,
- ULONGEST *xfered_len) override;
+ const char *annex, gdb_byte *readbuf,
+ const gdb_byte *writebuf,
+ ULONGEST offset, ULONGEST len,
+ ULONGEST *xfered_len) override;
void files_info () override;
- int trace_find (enum trace_find_type type, int num,
- CORE_ADDR addr1, CORE_ADDR addr2, int *tpp) override;
+ int trace_find (enum trace_find_type type, int num, CORE_ADDR addr1,
+ CORE_ADDR addr2, int *tpp) override;
bool get_trace_state_variable_value (int tsv, LONGEST *val) override;
traceframe_info_up traceframe_info () override;
};
@@ -94,12 +90,12 @@ public:
that iterator goes into a new packet or frame. We define event
"frame". */
-#define CTF_MAGIC 0xC1FC1FC1
-#define CTF_SAVE_MAJOR 1
-#define CTF_SAVE_MINOR 8
+#define CTF_MAGIC 0xC1FC1FC1
+#define CTF_SAVE_MAJOR 1
+#define CTF_SAVE_MINOR 8
-#define CTF_METADATA_NAME "metadata"
-#define CTF_DATASTREAM_NAME "datastream"
+#define CTF_METADATA_NAME "metadata"
+#define CTF_DATASTREAM_NAME "datastream"
/* Reserved event id. */
@@ -131,9 +127,8 @@ struct trace_write_handler
/* Write metadata in FORMAT. */
-static void
-ctf_save_write_metadata (struct trace_write_handler *handler,
- const char *format, ...)
+static void ctf_save_write_metadata (struct trace_write_handler *handler,
+ const char *format, ...)
ATTRIBUTE_PRINTF (2, 3);
static void
@@ -144,8 +139,7 @@ ctf_save_write_metadata (struct trace_write_handler *handler,
va_start (args, format);
if (vfprintf (handler->metadata_fd, format, args) < 0)
- error (_("Unable to write metadata file (%s)"),
- safe_strerror (errno));
+ error (_ ("Unable to write metadata file (%s)"), safe_strerror (errno));
va_end (args);
}
@@ -153,11 +147,11 @@ ctf_save_write_metadata (struct trace_write_handler *handler,
HANDLER. */
static int
-ctf_save_write (struct trace_write_handler *handler,
- const gdb_byte *buf, size_t size)
+ctf_save_write (struct trace_write_handler *handler, const gdb_byte *buf,
+ size_t size)
{
if (fwrite (buf, size, 1, handler->datastream_fd) != 1)
- error (_("Unable to write file for saving trace data (%s)"),
+ error (_ ("Unable to write file for saving trace data (%s)"),
safe_strerror (errno));
handler->content_size += size;
@@ -181,15 +175,14 @@ ctf_save_write (struct trace_write_handler *handler,
if WHENCE is SEEK_CUR. */
static int
-ctf_save_fseek (struct trace_write_handler *handler, long offset,
- int whence)
+ctf_save_fseek (struct trace_write_handler *handler, long offset, int whence)
{
gdb_assert (whence != SEEK_END);
gdb_assert (whence != SEEK_SET
|| offset <= handler->content_size + handler->packet_start);
if (fseek (handler->datastream_fd, offset, whence))
- error (_("Unable to seek file for saving trace data (%s)"),
+ error (_ ("Unable to seek file for saving trace data (%s)"),
safe_strerror (errno));
if (whence == SEEK_CUR)
@@ -202,13 +195,11 @@ ctf_save_fseek (struct trace_write_handler *handler, long offset,
and write BUF to datastream file. The size of BUF is SIZE. */
static int
-ctf_save_align_write (struct trace_write_handler *handler,
- const gdb_byte *buf,
+ctf_save_align_write (struct trace_write_handler *handler, const gdb_byte *buf,
size_t size, size_t align_size)
{
long offset
- = (align_up (handler->content_size, align_size)
- - handler->content_size);
+ = (align_up (handler->content_size, align_size) - handler->content_size);
if (ctf_save_fseek (handler, offset, SEEK_CUR))
return -1;
@@ -234,16 +225,14 @@ ctf_save_next_packet (struct trace_write_handler *handler)
static void
ctf_save_metadata_header (struct trace_write_handler *handler)
{
- ctf_save_write_metadata (handler, "/* CTF %d.%d */\n",
- CTF_SAVE_MAJOR, CTF_SAVE_MINOR);
- ctf_save_write_metadata (handler,
- "typealias integer { size = 8; align = 8; "
- "signed = false; encoding = ascii;}"
- " := ascii;\n");
- ctf_save_write_metadata (handler,
- "typealias integer { size = 8; align = 8; "
- "signed = false; }"
- " := uint8_t;\n");
+ ctf_save_write_metadata (handler, "/* CTF %d.%d */\n", CTF_SAVE_MAJOR,
+ CTF_SAVE_MINOR);
+ ctf_save_write_metadata (handler, "typealias integer { size = 8; align = 8; "
+ "signed = false; encoding = ascii;}"
+ " := ascii;\n");
+ ctf_save_write_metadata (handler, "typealias integer { size = 8; align = 8; "
+ "signed = false; }"
+ " := uint8_t;\n");
ctf_save_write_metadata (handler,
"typealias integer { size = 16; align = 16;"
"signed = false; } := uint16_t;\n");
@@ -260,9 +249,8 @@ ctf_save_metadata_header (struct trace_write_handler *handler)
ctf_save_write_metadata (handler,
"typealias integer { size = 64; align = 64;"
"signed = true; } := int64_t;\n");
- ctf_save_write_metadata (handler,
- "typealias string { encoding = ascii;"
- " } := chars;\n");
+ ctf_save_write_metadata (handler, "typealias string { encoding = ascii;"
+ " } := chars;\n");
ctf_save_write_metadata (handler, "\n");
/* Get the byte order of the host and write CTF data in this byte
@@ -293,8 +281,7 @@ ctf_save_metadata_header (struct trace_write_handler *handler)
" uint32_t id;\n"
" };\n"
"};\n",
- CTF_SAVE_MAJOR, CTF_SAVE_MINOR,
- HOST_ENDIANNESS);
+ CTF_SAVE_MAJOR, CTF_SAVE_MINOR, HOST_ENDIANNESS);
ctf_save_write_metadata (handler, "\n");
}
@@ -314,23 +301,20 @@ struct ctf_trace_file_writer
static void
ctf_dtor (struct trace_file_writer *self)
{
- struct ctf_trace_file_writer *writer
- = (struct ctf_trace_file_writer *) self;
+ struct ctf_trace_file_writer *writer = (struct ctf_trace_file_writer *) self;
if (writer->tcs.metadata_fd != NULL)
fclose (writer->tcs.metadata_fd);
if (writer->tcs.datastream_fd != NULL)
fclose (writer->tcs.datastream_fd);
-
}
/* This is the implementation of trace_file_write_ops method
target_save. */
static int
-ctf_target_save (struct trace_file_writer *self,
- const char *dirname)
+ctf_target_save (struct trace_file_writer *self, const char *dirname)
{
/* Don't support save trace file to CTF format in the target. */
return 0;
@@ -343,13 +327,12 @@ ctf_target_save (struct trace_file_writer *self,
static void
ctf_start (struct trace_file_writer *self, const char *dirname)
{
- struct ctf_trace_file_writer *writer
- = (struct ctf_trace_file_writer *) self;
+ struct ctf_trace_file_writer *writer = (struct ctf_trace_file_writer *) self;
mode_t hmode = S_IRUSR | S_IWUSR | S_IXUSR | S_IRGRP | S_IXGRP | S_IROTH;
/* Create DIRNAME. */
if (mkdir (dirname, hmode) && errno != EEXIST)
- error (_("Unable to open directory '%s' for saving trace data (%s)"),
+ error (_ ("Unable to open directory '%s' for saving trace data (%s)"),
dirname, safe_strerror (errno));
memset (&writer->tcs, '\0', sizeof (writer->tcs));
@@ -359,7 +342,7 @@ ctf_start (struct trace_file_writer *self, const char *dirname)
writer->tcs.metadata_fd
= gdb_fopen_cloexec (file_name.c_str (), "w").release ();
if (writer->tcs.metadata_fd == NULL)
- error (_("Unable to open file '%s' for saving trace data (%s)"),
+ error (_ ("Unable to open file '%s' for saving trace data (%s)"),
file_name.c_str (), safe_strerror (errno));
ctf_save_metadata_header (&writer->tcs);
@@ -368,7 +351,7 @@ ctf_start (struct trace_file_writer *self, const char *dirname)
writer->tcs.datastream_fd
= gdb_fopen_cloexec (file_name.c_str (), "w").release ();
if (writer->tcs.datastream_fd == NULL)
- error (_("Unable to open file '%s' for saving trace data (%s)"),
+ error (_ ("Unable to open file '%s' for saving trace data (%s)"),
file_name.c_str (), safe_strerror (errno));
}
@@ -379,9 +362,7 @@ ctf_start (struct trace_file_writer *self, const char *dirname)
static void
ctf_write_header (struct trace_file_writer *self)
{
- struct ctf_trace_file_writer *writer
- = (struct ctf_trace_file_writer *) self;
-
+ struct ctf_trace_file_writer *writer = (struct ctf_trace_file_writer *) self;
ctf_save_write_metadata (&writer->tcs, "\n");
ctf_save_write_metadata (&writer->tcs,
@@ -391,7 +372,8 @@ ctf_write_header (struct trace_file_writer *self)
"\t\tuint16_t length;\n"
"\t\tuint8_t contents[length];\n"
"\t};\n"
- "};\n", CTF_EVENT_ID_MEMORY);
+ "};\n",
+ CTF_EVENT_ID_MEMORY);
ctf_save_write_metadata (&writer->tcs, "\n");
ctf_save_write_metadata (&writer->tcs,
@@ -400,25 +382,28 @@ ctf_write_header (struct trace_file_writer *self)
"\t\tuint64_t val;\n"
"\t\tuint32_t num;\n"
"\t};\n"
- "};\n", CTF_EVENT_ID_TSV);
+ "};\n",
+ CTF_EVENT_ID_TSV);
ctf_save_write_metadata (&writer->tcs, "\n");
ctf_save_write_metadata (&writer->tcs,
"event {\n\tname = \"frame\";\n\tid = %u;\n"
"\tfields := struct { \n"
"\t};\n"
- "};\n", CTF_EVENT_ID_FRAME);
+ "};\n",
+ CTF_EVENT_ID_FRAME);
ctf_save_write_metadata (&writer->tcs, "\n");
ctf_save_write_metadata (&writer->tcs,
- "event {\n\tname = \"tsv_def\";\n"
- "\tid = %u;\n\tfields := struct { \n"
- "\t\tint64_t initial_value;\n"
- "\t\tint32_t number;\n"
- "\t\tint32_t builtin;\n"
- "\t\tchars name;\n"
- "\t};\n"
- "};\n", CTF_EVENT_ID_TSV_DEF);
+ "event {\n\tname = \"tsv_def\";\n"
+ "\tid = %u;\n\tfields := struct { \n"
+ "\t\tint64_t initial_value;\n"
+ "\t\tint32_t number;\n"
+ "\t\tint32_t builtin;\n"
+ "\t\tchars name;\n"
+ "\t};\n"
+ "};\n",
+ CTF_EVENT_ID_TSV_DEF);
ctf_save_write_metadata (&writer->tcs, "\n");
ctf_save_write_metadata (&writer->tcs,
@@ -434,19 +419,20 @@ ctf_write_header (struct trace_file_writer *self)
"\t\tint32_t type;\n"
"\t\tchars cond;\n"
- "\t\tuint32_t action_num;\n"
- "\t\tchars actions[action_num];\n"
+ "\t\tuint32_t action_num;\n"
+ "\t\tchars actions[action_num];\n"
- "\t\tuint32_t step_action_num;\n"
- "\t\tchars step_actions[step_action_num];\n"
+ "\t\tuint32_t step_action_num;\n"
+ "\t\tchars step_actions[step_action_num];\n"
- "\t\tchars at_string;\n"
- "\t\tchars cond_string;\n"
+ "\t\tchars at_string;\n"
+ "\t\tchars cond_string;\n"
- "\t\tuint32_t cmd_num;\n"
- "\t\tchars cmd_strings[cmd_num];\n"
- "\t};\n"
- "};\n", CTF_EVENT_ID_TP_DEF);
+ "\t\tuint32_t cmd_num;\n"
+ "\t\tchars cmd_strings[cmd_num];\n"
+ "\t};\n"
+ "};\n",
+ CTF_EVENT_ID_TP_DEF);
gdb_assert (writer->tcs.content_size == 0);
gdb_assert (writer->tcs.packet_start == 0);
@@ -462,8 +448,7 @@ ctf_write_header (struct trace_file_writer *self)
static void
ctf_write_regblock_type (struct trace_file_writer *self, int size)
{
- struct ctf_trace_file_writer *writer
- = (struct ctf_trace_file_writer *) self;
+ struct ctf_trace_file_writer *writer = (struct ctf_trace_file_writer *) self;
ctf_save_write_metadata (&writer->tcs, "\n");
@@ -480,11 +465,9 @@ ctf_write_regblock_type (struct trace_file_writer *self, int size)
write_status. */
static void
-ctf_write_status (struct trace_file_writer *self,
- struct trace_status *ts)
+ctf_write_status (struct trace_file_writer *self, struct trace_status *ts)
{
- struct ctf_trace_file_writer *writer
- = (struct ctf_trace_file_writer *) self;
+ struct ctf_trace_file_writer *writer = (struct ctf_trace_file_writer *) self;
uint32_t id;
ctf_save_write_metadata (&writer->tcs, "\n");
@@ -524,8 +507,7 @@ static void
ctf_write_uploaded_tsv (struct trace_file_writer *self,
struct uploaded_tsv *tsv)
{
- struct ctf_trace_file_writer *writer
- = (struct ctf_trace_file_writer *) self;
+ struct ctf_trace_file_writer *writer = (struct ctf_trace_file_writer *) self;
int32_t int32;
int64_t int64;
const gdb_byte zero = 0;
@@ -546,8 +528,7 @@ ctf_write_uploaded_tsv (struct trace_file_writer *self,
/* name */
if (tsv->name != NULL)
- ctf_save_write (&writer->tcs, (gdb_byte *) tsv->name,
- strlen (tsv->name));
+ ctf_save_write (&writer->tcs, (gdb_byte *) tsv->name, strlen (tsv->name));
ctf_save_write (&writer->tcs, &zero, 1);
}
@@ -555,11 +536,9 @@ ctf_write_uploaded_tsv (struct trace_file_writer *self,
write_uploaded_tp. */
static void
-ctf_write_uploaded_tp (struct trace_file_writer *self,
- struct uploaded_tp *tp)
+ctf_write_uploaded_tp (struct trace_file_writer *self, struct uploaded_tp *tp)
{
- struct ctf_trace_file_writer *writer
- = (struct ctf_trace_file_writer *) self;
+ struct ctf_trace_file_writer *writer = (struct ctf_trace_file_writer *) self;
int32_t int32;
int64_t int64;
uint32_t u32;
@@ -633,7 +612,6 @@ ctf_write_uploaded_tp (struct trace_file_writer *self,
for (const auto &act : tp->cmd_strings)
ctf_save_write (&writer->tcs, (gdb_byte *) act.get (),
strlen (act.get ()) + 1);
-
}
/* This is the implementation of trace_file_write_ops method
@@ -671,8 +649,7 @@ ctf_end (struct trace_file_writer *self)
static void
ctf_write_frame_start (struct trace_file_writer *self, uint16_t tpnum)
{
- struct ctf_trace_file_writer *writer
- = (struct ctf_trace_file_writer *) self;
+ struct ctf_trace_file_writer *writer = (struct ctf_trace_file_writer *) self;
uint32_t id = CTF_EVENT_ID_FRAME;
uint32_t u32;
@@ -696,11 +673,10 @@ ctf_write_frame_start (struct trace_file_writer *self, uint16_t tpnum)
write_r_block. */
static void
-ctf_write_frame_r_block (struct trace_file_writer *self,
- gdb_byte *buf, int32_t size)
+ctf_write_frame_r_block (struct trace_file_writer *self, gdb_byte *buf,
+ int32_t size)
{
- struct ctf_trace_file_writer *writer
- = (struct ctf_trace_file_writer *) self;
+ struct ctf_trace_file_writer *writer = (struct ctf_trace_file_writer *) self;
uint32_t id = CTF_EVENT_ID_REGISTER;
/* Event Id. */
@@ -714,11 +690,10 @@ ctf_write_frame_r_block (struct trace_file_writer *self,
write_m_block_header. */
static void
-ctf_write_frame_m_block_header (struct trace_file_writer *self,
- uint64_t addr, uint16_t length)
+ctf_write_frame_m_block_header (struct trace_file_writer *self, uint64_t addr,
+ uint16_t length)
{
- struct ctf_trace_file_writer *writer
- = (struct ctf_trace_file_writer *) self;
+ struct ctf_trace_file_writer *writer = (struct ctf_trace_file_writer *) self;
uint32_t event_id = CTF_EVENT_ID_MEMORY;
/* Event Id. */
@@ -735,11 +710,10 @@ ctf_write_frame_m_block_header (struct trace_file_writer *self,
write_m_block_memory. */
static void
-ctf_write_frame_m_block_memory (struct trace_file_writer *self,
- gdb_byte *buf, uint16_t length)
+ctf_write_frame_m_block_memory (struct trace_file_writer *self, gdb_byte *buf,
+ uint16_t length)
{
- struct ctf_trace_file_writer *writer
- = (struct ctf_trace_file_writer *) self;
+ struct ctf_trace_file_writer *writer = (struct ctf_trace_file_writer *) self;
/* Contents. */
ctf_save_align_write (&writer->tcs, (gdb_byte *) buf, length, 1);
@@ -749,11 +723,10 @@ ctf_write_frame_m_block_memory (struct trace_file_writer *self,
write_v_block. */
static void
-ctf_write_frame_v_block (struct trace_file_writer *self,
- int32_t num, uint64_t val)
+ctf_write_frame_v_block (struct trace_file_writer *self, int32_t num,
+ uint64_t val)
{
- struct ctf_trace_file_writer *writer
- = (struct ctf_trace_file_writer *) self;
+ struct ctf_trace_file_writer *writer = (struct ctf_trace_file_writer *) self;
uint32_t id = CTF_EVENT_ID_TSV;
/* Event Id. */
@@ -771,14 +744,12 @@ ctf_write_frame_v_block (struct trace_file_writer *self,
static void
ctf_write_frame_end (struct trace_file_writer *self)
{
- struct ctf_trace_file_writer *writer
- = (struct ctf_trace_file_writer *) self;
+ struct ctf_trace_file_writer *writer = (struct ctf_trace_file_writer *) self;
uint32_t u32;
uint32_t t;
/* Write the content size to packet header. */
- ctf_save_fseek (&writer->tcs, writer->tcs.packet_start + 4,
- SEEK_SET);
+ ctf_save_fseek (&writer->tcs, writer->tcs.packet_start + 4, SEEK_SET);
u32 = writer->tcs.content_size * TARGET_CHAR_BIT;
t = writer->tcs.content_size;
@@ -791,8 +762,7 @@ ctf_write_frame_end (struct trace_file_writer *self)
writer->tcs.content_size = t;
/* Write zero at the end of the packet. */
- ctf_save_fseek (&writer->tcs, writer->tcs.packet_start + t,
- SEEK_SET);
+ ctf_save_fseek (&writer->tcs, writer->tcs.packet_start + t, SEEK_SET);
u32 = 0;
ctf_save_write_uint32 (&writer->tcs, u32);
writer->tcs.content_size = t;
@@ -803,20 +773,15 @@ ctf_write_frame_end (struct trace_file_writer *self)
/* Operations to write various types of trace frames into CTF
format. */
-static const struct trace_frame_write_ops ctf_write_frame_ops =
-{
- ctf_write_frame_start,
- ctf_write_frame_r_block,
- ctf_write_frame_m_block_header,
- ctf_write_frame_m_block_memory,
- ctf_write_frame_v_block,
- ctf_write_frame_end,
+static const struct trace_frame_write_ops ctf_write_frame_ops = {
+ ctf_write_frame_start, ctf_write_frame_r_block,
+ ctf_write_frame_m_block_header, ctf_write_frame_m_block_memory,
+ ctf_write_frame_v_block, ctf_write_frame_end,
};
/* Operations to write trace buffers into CTF format. */
-static const struct trace_file_write_ops ctf_write_ops =
-{
+static const struct trace_file_write_ops ctf_write_ops = {
ctf_dtor,
ctf_target_save,
ctf_start,
@@ -890,17 +855,16 @@ ctf_open_dir (const char *dirname)
{
struct bt_iter_pos begin_pos;
unsigned int count, i;
- struct bt_ctf_event_decl * const *list;
+ struct bt_ctf_event_decl *const *list;
ctx = bt_context_create ();
if (ctx == NULL)
- error (_("Unable to create bt_context"));
+ error (_ ("Unable to create bt_context"));
handle_id = bt_context_add_trace (ctx, dirname, "ctf", NULL, NULL, NULL);
if (handle_id < 0)
{
ctf_destroy ();
- error (_("Unable to use libbabeltrace on directory \"%s\""),
- dirname);
+ error (_ ("Unable to use libbabeltrace on directory \"%s\""), dirname);
}
begin_pos.type = BT_SEEK_BEGIN;
@@ -908,7 +872,7 @@ ctf_open_dir (const char *dirname)
if (ctf_iter == NULL)
{
ctf_destroy ();
- error (_("Unable to create bt_iterator"));
+ error (_ ("Unable to create bt_iterator"));
}
/* Look for the declaration of register block. Get the length of
@@ -918,15 +882,15 @@ ctf_open_dir (const char *dirname)
for (i = 0; i < count; i++)
if (strcmp ("register", bt_ctf_get_decl_event_name (list[i])) == 0)
{
- const struct bt_ctf_field_decl * const *field_list;
+ const struct bt_ctf_field_decl *const *field_list;
const struct bt_declaration *decl;
- bt_ctf_get_decl_fields (list[i], BT_EVENT_FIELDS, &field_list,
- &count);
+ bt_ctf_get_decl_fields (list[i], BT_EVENT_FIELDS, &field_list, &count);
gdb_assert (count == 1);
- gdb_assert (0 == strcmp ("contents",
- bt_ctf_get_decl_field_name (field_list[0])));
+ gdb_assert (0
+ == strcmp ("contents",
+ bt_ctf_get_decl_field_name (field_list[0])));
decl = bt_ctf_get_decl_from_field_decl (field_list[0]);
trace_regblock_size = bt_ctf_get_array_len (decl);
@@ -934,16 +898,13 @@ ctf_open_dir (const char *dirname)
}
}
-#define SET_INT32_FIELD(EVENT, SCOPE, VAR, FIELD) \
- (VAR)->FIELD = (int) bt_ctf_get_int64 (bt_ctf_get_field ((EVENT), \
- (SCOPE), \
- #FIELD))
-
-#define SET_ENUM_FIELD(EVENT, SCOPE, VAR, TYPE, FIELD) \
- (VAR)->FIELD = (TYPE) bt_ctf_get_int64 (bt_ctf_get_field ((EVENT), \
- (SCOPE), \
- #FIELD))
+#define SET_INT32_FIELD(EVENT, SCOPE, VAR, FIELD) \
+ (VAR)->FIELD \
+ = (int) bt_ctf_get_int64 (bt_ctf_get_field ((EVENT), (SCOPE), #FIELD))
+#define SET_ENUM_FIELD(EVENT, SCOPE, VAR, TYPE, FIELD) \
+ (VAR)->FIELD \
+ = (TYPE) bt_ctf_get_int64 (bt_ctf_get_field ((EVENT), (SCOPE), #FIELD))
/* EVENT is the "status" event and TS is filled in. */
@@ -982,19 +943,16 @@ ctf_read_tsv (struct uploaded_tsv **uploaded_tsvs)
struct uploaded_tsv *utsv = NULL;
event = bt_ctf_iter_read_event (ctf_iter);
- scope = bt_ctf_get_top_level_scope (event,
- BT_STREAM_EVENT_HEADER);
- event_id = bt_ctf_get_uint64 (bt_ctf_get_field (event, scope,
- "id"));
+ scope = bt_ctf_get_top_level_scope (event, BT_STREAM_EVENT_HEADER);
+ event_id = bt_ctf_get_uint64 (bt_ctf_get_field (event, scope, "id"));
if (event_id != CTF_EVENT_ID_TSV_DEF)
break;
- scope = bt_ctf_get_top_level_scope (event,
- BT_EVENT_FIELDS);
+ scope = bt_ctf_get_top_level_scope (event, BT_EVENT_FIELDS);
def = bt_ctf_get_field (event, scope, "number");
- utsv = get_uploaded_tsv ((int32_t) bt_ctf_get_int64 (def),
- uploaded_tsvs);
+ utsv
+ = get_uploaded_tsv ((int32_t) bt_ctf_get_int64 (def), uploaded_tsvs);
def = bt_ctf_get_field (event, scope, "builtin");
utsv->builtin = (int32_t) bt_ctf_get_int64 (def);
@@ -1002,53 +960,49 @@ ctf_read_tsv (struct uploaded_tsv **uploaded_tsvs)
utsv->initial_value = bt_ctf_get_int64 (def);
def = bt_ctf_get_field (event, scope, "name");
- utsv->name = xstrdup (bt_ctf_get_string (def));
+ utsv->name = xstrdup (bt_ctf_get_string (def));
if (bt_iter_next (bt_ctf_get_iter (ctf_iter)) < 0)
break;
}
-
}
/* Read the value of element whose index is NUM from CTF and write it
to the corresponding VAR->ARRAY. */
-#define SET_ARRAY_FIELD(EVENT, SCOPE, VAR, NUM, ARRAY) \
- do \
- { \
- uint32_t lu32, i; \
- const struct bt_definition *def; \
- \
- lu32 = (uint32_t) bt_ctf_get_uint64 (bt_ctf_get_field ((EVENT), \
- (SCOPE), \
- #NUM)); \
- def = bt_ctf_get_field ((EVENT), (SCOPE), #ARRAY); \
- for (i = 0; i < lu32; i++) \
- { \
- const struct bt_definition *element \
- = bt_ctf_get_index ((EVENT), def, i); \
- \
- (VAR)->ARRAY.emplace_back \
- (xstrdup (bt_ctf_get_string (element))); \
- } \
- } \
+#define SET_ARRAY_FIELD(EVENT, SCOPE, VAR, NUM, ARRAY) \
+ do \
+ { \
+ uint32_t lu32, i; \
+ const struct bt_definition *def; \
+ \
+ lu32 = (uint32_t) bt_ctf_get_uint64 (bt_ctf_get_field ((EVENT), \
+ (SCOPE), #NUM)); \
+ def = bt_ctf_get_field ((EVENT), (SCOPE), #ARRAY); \
+ for (i = 0; i < lu32; i++) \
+ { \
+ const struct bt_definition *element \
+ = bt_ctf_get_index ((EVENT), def, i); \
+ \
+ (VAR)->ARRAY.emplace_back (xstrdup (bt_ctf_get_string (element))); \
+ } \
+ } \
while (0)
/* Read a string from CTF and set VAR->FIELD. If the length of string
is zero, set VAR->FIELD to NULL. */
-#define SET_STRING_FIELD(EVENT, SCOPE, VAR, FIELD) \
- do \
- { \
- const char *p = bt_ctf_get_string (bt_ctf_get_field ((EVENT), \
- (SCOPE), \
- #FIELD)); \
- \
- if (strlen (p) > 0) \
- (VAR)->FIELD.reset (xstrdup (p)); \
- else \
- (VAR)->FIELD = NULL; \
- } \
+#define SET_STRING_FIELD(EVENT, SCOPE, VAR, FIELD) \
+ do \
+ { \
+ const char *p \
+ = bt_ctf_get_string (bt_ctf_get_field ((EVENT), (SCOPE), #FIELD)); \
+ \
+ if (strlen (p) > 0) \
+ (VAR)->FIELD.reset (xstrdup (p)); \
+ else \
+ (VAR)->FIELD = NULL; \
+ } \
while (0)
/* Read the events "tp_def" one by one, extract its contents and fill
@@ -1069,21 +1023,16 @@ ctf_read_tp (struct uploaded_tp **uploaded_tps)
struct uploaded_tp *utp = NULL;
event = bt_ctf_iter_read_event (ctf_iter);
- scope = bt_ctf_get_top_level_scope (event,
- BT_STREAM_EVENT_HEADER);
- u32 = bt_ctf_get_uint64 (bt_ctf_get_field (event, scope,
- "id"));
+ scope = bt_ctf_get_top_level_scope (event, BT_STREAM_EVENT_HEADER);
+ u32 = bt_ctf_get_uint64 (bt_ctf_get_field (event, scope, "id"));
if (u32 != CTF_EVENT_ID_TP_DEF)
break;
- scope = bt_ctf_get_top_level_scope (event,
- BT_EVENT_FIELDS);
- int32 = (int32_t) bt_ctf_get_int64 (bt_ctf_get_field (event,
- scope,
+ scope = bt_ctf_get_top_level_scope (event, BT_EVENT_FIELDS);
+ int32 = (int32_t) bt_ctf_get_int64 (bt_ctf_get_field (event, scope,
"number"));
- u64 = bt_ctf_get_uint64 (bt_ctf_get_field (event, scope,
- "addr"));
- utp = get_uploaded_tp (int32, u64, uploaded_tps);
+ u64 = bt_ctf_get_uint64 (bt_ctf_get_field (event, scope, "addr"));
+ utp = get_uploaded_tp (int32, u64, uploaded_tps);
SET_INT32_FIELD (event, scope, utp, enabled);
SET_INT32_FIELD (event, scope, utp, step);
@@ -1096,11 +1045,10 @@ ctf_read_tp (struct uploaded_tp **uploaded_tps)
/* Read 'actions'. */
SET_ARRAY_FIELD (event, scope, utp, action_num, actions);
/* Read 'step_actions'. */
- SET_ARRAY_FIELD (event, scope, utp, step_action_num,
- step_actions);
+ SET_ARRAY_FIELD (event, scope, utp, step_action_num, step_actions);
- SET_STRING_FIELD(event, scope, utp, at_string);
- SET_STRING_FIELD(event, scope, utp, cond_string);
+ SET_STRING_FIELD (event, scope, utp, at_string);
+ SET_STRING_FIELD (event, scope, utp, cond_string);
if (bt_iter_next (bt_ctf_get_iter (ctf_iter)) < 0)
break;
@@ -1122,7 +1070,7 @@ ctf_target_open (const char *dirname, int from_tty)
struct uploaded_tp *uploaded_tps = NULL;
if (!dirname)
- error (_("No CTF directory specified."));
+ error (_ ("No CTF directory specified."));
ctf_open_dir (dirname);
@@ -1134,14 +1082,14 @@ ctf_target_open (const char *dirname, int from_tty)
scope = bt_ctf_get_top_level_scope (event, BT_STREAM_EVENT_HEADER);
event_id = bt_ctf_get_uint64 (bt_ctf_get_field (event, scope, "id"));
if (event_id != CTF_EVENT_ID_FRAME)
- error (_("Wrong event id of the first event"));
+ error (_ ("Wrong event id of the first event"));
/* The second event is "status". */
bt_iter_next (bt_ctf_get_iter (ctf_iter));
event = bt_ctf_iter_read_event (ctf_iter);
scope = bt_ctf_get_top_level_scope (event, BT_STREAM_EVENT_HEADER);
event_id = bt_ctf_get_uint64 (bt_ctf_get_field (event, scope, "id"));
if (event_id != CTF_EVENT_ID_STATUS)
- error (_("Wrong event id of the second event"));
+ error (_ ("Wrong event id of the second event"));
ctf_read_status (event, current_trace_status ());
ctf_read_tsv (&uploaded_tsvs);
@@ -1153,12 +1101,10 @@ ctf_target_open (const char *dirname, int from_tty)
events. */
if (event != NULL)
{
- scope = bt_ctf_get_top_level_scope (event,
- BT_STREAM_EVENT_HEADER);
- event_id = bt_ctf_get_uint64 (bt_ctf_get_field (event,
- scope, "id"));
+ scope = bt_ctf_get_top_level_scope (event, BT_STREAM_EVENT_HEADER);
+ event_id = bt_ctf_get_uint64 (bt_ctf_get_field (event, scope, "id"));
if (event_id != CTF_EVENT_ID_FRAME)
- error (_("Wrong event id of the first event of the second packet"));
+ error (_ ("Wrong event id of the first event of the second packet"));
}
start_pos = bt_iter_get_pos (bt_ctf_get_iter (ctf_iter));
@@ -1188,7 +1134,7 @@ ctf_target::close ()
xfree (trace_dirname);
trace_dirname = NULL;
- switch_to_no_thread (); /* Avoid confusion from thread stuff. */
+ switch_to_no_thread (); /* Avoid confusion from thread stuff. */
exit_inferior_silent (current_inferior ());
trace_reset_local_state ();
@@ -1253,8 +1199,7 @@ ctf_target::fetch_registers (struct regcache *regcache, int regno)
{
int offset, regsize, regn;
const struct bt_definition *scope
- = bt_ctf_get_top_level_scope (event,
- BT_EVENT_FIELDS);
+ = bt_ctf_get_top_level_scope (event, BT_EVENT_FIELDS);
const struct bt_definition *array
= bt_ctf_get_field (event, scope, "contents");
gdb_byte *regs = (gdb_byte *) bt_ctf_get_char_array (array);
@@ -1294,17 +1239,16 @@ ctf_target::fetch_registers (struct regcache *regcache, int regno)
READBUF. */
enum target_xfer_status
-ctf_target::xfer_partial (enum target_object object,
- const char *annex, gdb_byte *readbuf,
- const gdb_byte *writebuf, ULONGEST offset,
- ULONGEST len, ULONGEST *xfered_len)
+ctf_target::xfer_partial (enum target_object object, const char *annex,
+ gdb_byte *readbuf, const gdb_byte *writebuf,
+ ULONGEST offset, ULONGEST len, ULONGEST *xfered_len)
{
/* We're only doing regular memory for now. */
if (object != TARGET_OBJECT_MEMORY)
return TARGET_XFER_E_IO;
if (readbuf == NULL)
- error (_("ctf_xfer_partial: trace file is read-only"));
+ error (_ ("ctf_xfer_partial: trace file is read-only"));
if (get_traceframe_number () != -1)
{
@@ -1328,8 +1272,7 @@ ctf_target::xfer_partial (enum target_object object,
uint16_t mlen;
const struct bt_definition *scope;
const struct bt_definition *def;
- struct bt_ctf_event *event
- = bt_ctf_iter_read_event (ctf_iter);
+ struct bt_ctf_event *event = bt_ctf_iter_read_event (ctf_iter);
const char *name = bt_ctf_event_name (event);
if (name == NULL || strcmp (name, "frame") == 0)
@@ -1342,8 +1285,7 @@ ctf_target::xfer_partial (enum target_object object,
continue;
}
- scope = bt_ctf_get_top_level_scope (event,
- BT_EVENT_FIELDS);
+ scope = bt_ctf_get_top_level_scope (event, BT_EVENT_FIELDS);
def = bt_ctf_get_field (event, scope, "address");
maddr = bt_ctf_get_uint64 (def);
@@ -1422,7 +1364,8 @@ ctf_target::xfer_partial (enum target_object object,
else
{
/* Fallback to reading from read-only sections. */
- return section_table_read_available_memory (readbuf, offset, len, xfered_len);
+ return section_table_read_available_memory (readbuf, offset, len,
+ xfered_len);
}
}
@@ -1447,8 +1390,7 @@ ctf_target::get_trace_state_variable_value (int tsvnum, LONGEST *val)
block. */
while (1)
{
- struct bt_ctf_event *event
- = bt_ctf_iter_read_event (ctf_iter);
+ struct bt_ctf_event *event = bt_ctf_iter_read_event (ctf_iter);
const char *name = bt_ctf_event_name (event);
if (name == NULL || strcmp (name, "frame") == 0)
@@ -1458,8 +1400,7 @@ ctf_target::get_trace_state_variable_value (int tsvnum, LONGEST *val)
const struct bt_definition *scope;
const struct bt_definition *def;
- scope = bt_ctf_get_top_level_scope (event,
- BT_EVENT_FIELDS);
+ scope = bt_ctf_get_top_level_scope (event, BT_EVENT_FIELDS);
def = bt_ctf_get_field (event, scope, "num");
if (tsvnum == (int32_t) bt_ctf_get_uint64 (def))
@@ -1505,7 +1446,7 @@ ctf_get_traceframe_address (void)
CORE_ADDR addr = 0;
gdb_assert (ctf_iter != NULL);
- pos = bt_iter_get_pos (bt_ctf_get_iter (ctf_iter));
+ pos = bt_iter_get_pos (bt_ctf_get_iter (ctf_iter));
gdb_assert (pos->type == BT_SEEK_RESTORE);
while (1)
@@ -1532,8 +1473,7 @@ ctf_get_traceframe_address (void)
if (event != NULL)
{
int tpnum = ctf_get_tpnum_from_frame_event (event);
- struct tracepoint *tp
- = get_tracepoint_by_number_on_target (tpnum);
+ struct tracepoint *tp = get_tracepoint_by_number_on_target (tpnum);
if (tp && tp->loc)
addr = tp->loc->address;
@@ -1550,8 +1490,8 @@ ctf_get_traceframe_address (void)
number in it. Return traceframe number when matched. */
int
-ctf_target::trace_find (enum trace_find_type type, int num,
- CORE_ADDR addr1, CORE_ADDR addr2, int *tpp)
+ctf_target::trace_find (enum trace_find_type type, int num, CORE_ADDR addr1,
+ CORE_ADDR addr2, int *tpp)
{
int tfnum = 0;
int found = 0;
@@ -1622,7 +1562,7 @@ ctf_target::trace_find (enum trace_find_type type, int num,
found = 1;
break;
default:
- internal_error (_("unknown tfind type"));
+ internal_error (_ ("unknown tfind type"));
}
}
}
@@ -1665,8 +1605,7 @@ ctf_target::traceframe_info ()
do
{
- struct bt_ctf_event *event
- = bt_ctf_iter_read_event (ctf_iter);
+ struct bt_ctf_event *event = bt_ctf_iter_read_event (ctf_iter);
name = bt_ctf_event_name (event);
@@ -1676,8 +1615,7 @@ ctf_target::traceframe_info ()
else if (strcmp (name, "memory") == 0)
{
const struct bt_definition *scope
- = bt_ctf_get_top_level_scope (event,
- BT_EVENT_FIELDS);
+ = bt_ctf_get_top_level_scope (event, BT_EVENT_FIELDS);
const struct bt_definition *def;
def = bt_ctf_get_field (event, scope, "address");
@@ -1692,8 +1630,7 @@ ctf_target::traceframe_info ()
{
int vnum;
const struct bt_definition *scope
- = bt_ctf_get_top_level_scope (event,
- BT_EVENT_FIELDS);
+ = bt_ctf_get_top_level_scope (event, BT_EVENT_FIELDS);
const struct bt_definition *def;
def = bt_ctf_get_field (event, scope, "num");
@@ -1702,8 +1639,8 @@ ctf_target::traceframe_info ()
}
else
{
- warning (_("Unhandled trace block type (%s) "
- "while building trace frame info."),
+ warning (_ ("Unhandled trace block type (%s) "
+ "while building trace frame info."),
name);
}
@@ -1723,6 +1660,7 @@ ctf_target::traceframe_info ()
/* module initialization */
void _initialize_ctf ();
+
void
_initialize_ctf ()
{
diff --git a/gdb/tracefile-tfile.c b/gdb/tracefile-tfile.c
index 885fefd2df5..e719b2abcfb 100644
--- a/gdb/tracefile-tfile.c
+++ b/gdb/tracefile-tfile.c
@@ -41,30 +41,27 @@
/* The tfile target. */
-static const target_info tfile_target_info = {
- "tfile",
- N_("Local trace dump file"),
- N_("Use a trace file as a target.\n\
-Specify the filename of the trace file.")
-};
+static const target_info tfile_target_info
+ = { "tfile", N_ ("Local trace dump file"),
+ N_ ("Use a trace file as a target.\n\
+Specify the filename of the trace file.") };
class tfile_target final : public tracefile_target
{
- public:
- const target_info &info () const override
- { return tfile_target_info; }
+public:
+
+ const target_info &info () const override { return tfile_target_info; }
void close () override;
void fetch_registers (struct regcache *, int) override;
enum target_xfer_status xfer_partial (enum target_object object,
- const char *annex,
- gdb_byte *readbuf,
- const gdb_byte *writebuf,
- ULONGEST offset, ULONGEST len,
- ULONGEST *xfered_len) override;
+ const char *annex, gdb_byte *readbuf,
+ const gdb_byte *writebuf,
+ ULONGEST offset, ULONGEST len,
+ ULONGEST *xfered_len) override;
void files_info () override;
- int trace_find (enum trace_find_type type, int num,
- CORE_ADDR addr1, CORE_ADDR addr2, int *tpp) override;
+ int trace_find (enum trace_find_type type, int num, CORE_ADDR addr1,
+ CORE_ADDR addr2, int *tpp) override;
bool get_trace_state_variable_value (int tsv, LONGEST *val) override;
traceframe_info_up traceframe_info () override;
@@ -89,8 +86,7 @@ struct tfile_trace_file_writer
target_save_trace_data to do target-side saving. */
static int
-tfile_target_save (struct trace_file_writer *self,
- const char *filename)
+tfile_target_save (struct trace_file_writer *self, const char *filename)
{
int err = target_save_trace_data (filename);
@@ -125,7 +121,7 @@ tfile_start (struct trace_file_writer *self, const char *filename)
writer->pathname = tilde_expand (filename);
writer->fp = gdb_fopen_cloexec (writer->pathname, "wb").release ();
if (writer->fp == NULL)
- error (_("Unable to open file '%s' for saving trace data (%s)"),
+ error (_ ("Unable to open file '%s' for saving trace data (%s)"),
writer->pathname, safe_strerror (errno));
}
@@ -163,14 +159,13 @@ tfile_write_regblock_type (struct trace_file_writer *self, int size)
write_status. */
static void
-tfile_write_status (struct trace_file_writer *self,
- struct trace_status *ts)
+tfile_write_status (struct trace_file_writer *self, struct trace_status *ts)
{
struct tfile_trace_file_writer *writer
= (struct tfile_trace_file_writer *) self;
- fprintf (writer->fp, "status %c;%s",
- (ts->running ? '1' : '0'), stop_reason_names[ts->stop_reason]);
+ fprintf (writer->fp, "status %c;%s", (ts->running ? '1' : '0'),
+ stop_reason_names[ts->stop_reason]);
if (ts->stop_reason == tracepoint_error
|| ts->stop_reason == trace_stop_command)
{
@@ -195,12 +190,12 @@ tfile_write_status (struct trace_file_writer *self,
if (ts->start_time)
{
fprintf (writer->fp, ";starttime:%s",
- phex_nz (ts->start_time, sizeof (ts->start_time)));
+ phex_nz (ts->start_time, sizeof (ts->start_time)));
}
if (ts->stop_time)
{
fprintf (writer->fp, ";stoptime:%s",
- phex_nz (ts->stop_time, sizeof (ts->stop_time)));
+ phex_nz (ts->stop_time, sizeof (ts->stop_time)));
}
if (ts->notes != NULL)
{
@@ -236,9 +231,9 @@ tfile_write_uploaded_tsv (struct trace_file_writer *self,
bin2hex ((gdb_byte *) (utsv->name), buf, strlen (utsv->name));
}
- fprintf (writer->fp, "tsv %x:%s:%x:%s\n",
- utsv->number, phex_nz (utsv->initial_value, 8),
- utsv->builtin, buf != NULL ? buf : "");
+ fprintf (writer->fp, "tsv %x:%s:%x:%s\n", utsv->number,
+ phex_nz (utsv->initial_value, 8), utsv->builtin,
+ buf != NULL ? buf : "");
if (utsv->name)
xfree (buf);
@@ -257,47 +252,42 @@ tfile_write_uploaded_tp (struct trace_file_writer *self,
= (struct tfile_trace_file_writer *) self;
char buf[MAX_TRACE_UPLOAD];
- fprintf (writer->fp, "tp T%x:%s:%c:%x:%x",
- utp->number, phex_nz (utp->addr, sizeof (utp->addr)),
- (utp->enabled ? 'E' : 'D'), utp->step, utp->pass);
+ fprintf (writer->fp, "tp T%x:%s:%c:%x:%x", utp->number,
+ phex_nz (utp->addr, sizeof (utp->addr)), (utp->enabled ? 'E' : 'D'),
+ utp->step, utp->pass);
if (utp->type == bp_fast_tracepoint)
fprintf (writer->fp, ":F%x", utp->orig_size);
if (utp->cond)
- fprintf (writer->fp,
- ":X%x,%s", (unsigned int) strlen (utp->cond.get ()) / 2,
- utp->cond.get ());
+ fprintf (writer->fp, ":X%x,%s",
+ (unsigned int) strlen (utp->cond.get ()) / 2, utp->cond.get ());
fprintf (writer->fp, "\n");
for (const auto &act : utp->actions)
- fprintf (writer->fp, "tp A%x:%s:%s\n",
- utp->number, phex_nz (utp->addr, sizeof (utp->addr)), act.get ());
+ fprintf (writer->fp, "tp A%x:%s:%s\n", utp->number,
+ phex_nz (utp->addr, sizeof (utp->addr)), act.get ());
for (const auto &act : utp->step_actions)
- fprintf (writer->fp, "tp S%x:%s:%s\n",
- utp->number, phex_nz (utp->addr, sizeof (utp->addr)), act.get ());
+ fprintf (writer->fp, "tp S%x:%s:%s\n", utp->number,
+ phex_nz (utp->addr, sizeof (utp->addr)), act.get ());
if (utp->at_string)
{
- encode_source_string (utp->number, utp->addr,
- "at", utp->at_string.get (),
- buf, MAX_TRACE_UPLOAD);
+ encode_source_string (utp->number, utp->addr, "at",
+ utp->at_string.get (), buf, MAX_TRACE_UPLOAD);
fprintf (writer->fp, "tp Z%s\n", buf);
}
if (utp->cond_string)
{
- encode_source_string (utp->number, utp->addr,
- "cond", utp->cond_string.get (),
- buf, MAX_TRACE_UPLOAD);
+ encode_source_string (utp->number, utp->addr, "cond",
+ utp->cond_string.get (), buf, MAX_TRACE_UPLOAD);
fprintf (writer->fp, "tp Z%s\n", buf);
}
for (const auto &act : utp->cmd_strings)
{
- encode_source_string (utp->number, utp->addr, "cmd", act.get (),
- buf, MAX_TRACE_UPLOAD);
+ encode_source_string (utp->number, utp->addr, "cmd", act.get (), buf,
+ MAX_TRACE_UPLOAD);
fprintf (writer->fp, "tp Z%s\n", buf);
}
- fprintf (writer->fp, "tp V%x:%s:%x:%s\n",
- utp->number, phex_nz (utp->addr, sizeof (utp->addr)),
- utp->hit_count,
- phex_nz (utp->traceframe_usage,
- sizeof (utp->traceframe_usage)));
+ fprintf (writer->fp, "tp V%x:%s:%x:%s\n", utp->number,
+ phex_nz (utp->addr, sizeof (utp->addr)), utp->hit_count,
+ phex_nz (utp->traceframe_usage, sizeof (utp->traceframe_usage)));
}
/* This is the implementation of trace_file_write_ops method
@@ -379,8 +369,7 @@ tfile_end (struct trace_file_writer *self)
/* Operations to write trace buffers into TFILE format. */
-static const struct trace_file_write_ops tfile_write_ops =
-{
+static const struct trace_file_write_ops tfile_write_ops = {
tfile_dtor,
tfile_target_save,
tfile_start,
@@ -428,8 +417,7 @@ int trace_regblock_size;
static struct buffer trace_tdesc;
static void tfile_append_tdesc_line (const char *line);
-static void tfile_interp_line (char *line,
- struct uploaded_tp **utpp,
+static void tfile_interp_line (char *line, struct uploaded_tp **utpp,
struct uploaded_tsv **utsvp);
/* Read SIZE bytes into READBUF from the trace frame, starting at
@@ -447,7 +435,7 @@ tfile_read (gdb_byte *readbuf, int size)
if (gotten < 0)
perror_with_name (trace_filename);
else if (gotten < size)
- error (_("Premature end of file while reading trace file"));
+ error (_ ("Premature end of file while reading trace file"));
}
/* Open the tfile target. */
@@ -467,7 +455,7 @@ tfile_target_open (const char *arg, int from_tty)
target_preopen (from_tty);
if (!arg)
- error (_("No trace file specified."));
+ error (_ ("No trace file specified."));
gdb::unique_xmalloc_ptr<char> filename (tilde_expand (arg));
if (!IS_ABSOLUTE_PATH (filename.get ()))
@@ -494,9 +482,8 @@ tfile_target_open (const char *arg, int from_tty)
tfile_read ((gdb_byte *) &header, TRACE_HEADER_SIZE);
bytes += TRACE_HEADER_SIZE;
- if (!(header[0] == 0x7f
- && (startswith (header + 1, "TRACE0\n"))))
- error (_("File is not a valid trace file."));
+ if (!(header[0] == 0x7f && (startswith (header + 1, "TRACE0\n"))))
+ error (_ ("File is not a valid trace file."));
current_inferior ()->push_target (&tfile_ops);
@@ -534,7 +521,7 @@ tfile_target_open (const char *arg, int from_tty)
else
linebuf[i++] = byte;
if (i >= 1000)
- error (_("Excessively long lines in trace file"));
+ error (_ ("Excessively long lines in trace file"));
}
/* By now, tdesc lines have been read from tfile - let's parse them. */
@@ -546,7 +533,7 @@ tfile_target_open (const char *arg, int from_tty)
/* If we don't have a blocksize, we can't interpret the
traceframes. */
if (trace_regblock_size == 0)
- error (_("No register block size recorded in trace file"));
+ error (_ ("No register block size recorded in trace file"));
}
catch (const gdb_exception &ex)
{
@@ -561,7 +548,7 @@ tfile_target_open (const char *arg, int from_tty)
switch_to_thread (thr);
if (ts->traceframe_count <= 0)
- warning (_("No traceframes present in this file."));
+ warning (_ ("No traceframes present in this file."));
/* Add the file's tracepoints and variables into the current mix. */
@@ -609,7 +596,7 @@ tfile_interp_line (char *line, struct uploaded_tp **utpp,
tfile_append_tdesc_line (p);
}
else
- warning (_("Ignoring trace file definition \"%s\""), line);
+ warning (_ ("Ignoring trace file definition \"%s\""), line);
}
/* Close the trace file and generally clean up. */
@@ -619,7 +606,7 @@ tfile_target::close ()
{
gdb_assert (trace_fd != -1);
- switch_to_no_thread (); /* Avoid confusion from thread stuff. */
+ switch_to_no_thread (); /* Avoid confusion from thread stuff. */
exit_inferior_silent (current_inferior ());
::close (trace_fd);
@@ -638,7 +625,8 @@ tfile_target::files_info ()
}
void
-tfile_target::get_tracepoint_status (struct breakpoint *tp, struct uploaded_tp *utp)
+tfile_target::get_tracepoint_status (struct breakpoint *tp,
+ struct uploaded_tp *utp)
{
/* Other bits of trace status were collected as part of opening the
trace files, so nothing to do here. */
@@ -662,9 +650,9 @@ tfile_get_traceframe_address (off_t tframe_offset)
/* Fall back to using tracepoint address. */
lseek (trace_fd, tframe_offset, SEEK_SET);
tfile_read ((gdb_byte *) &tpnum, 2);
- tpnum = (short) extract_signed_integer ((gdb_byte *) &tpnum, 2,
- gdbarch_byte_order
- (target_gdbarch ()));
+ tpnum
+ = (short) extract_signed_integer ((gdb_byte *) &tpnum, 2,
+ gdbarch_byte_order (target_gdbarch ()));
tp = get_tracepoint_by_number_on_target (tpnum);
/* FIXME this is a poor heuristic if multiple locations. */
@@ -683,8 +671,8 @@ tfile_get_traceframe_address (off_t tframe_offset)
each. */
int
-tfile_target::trace_find (enum trace_find_type type, int num,
- CORE_ADDR addr1, CORE_ADDR addr2, int *tpp)
+tfile_target::trace_find (enum trace_find_type type, int num, CORE_ADDR addr1,
+ CORE_ADDR addr2, int *tpp)
{
short tpnum;
int tfnum = 0, found = 0;
@@ -706,16 +694,14 @@ tfile_target::trace_find (enum trace_find_type type, int num,
{
tframe_offset = offset;
tfile_read ((gdb_byte *) &tpnum, 2);
- tpnum = (short) extract_signed_integer ((gdb_byte *) &tpnum, 2,
- gdbarch_byte_order
- (target_gdbarch ()));
+ tpnum = (short) extract_signed_integer (
+ (gdb_byte *) &tpnum, 2, gdbarch_byte_order (target_gdbarch ()));
offset += 2;
if (tpnum == 0)
break;
tfile_read ((gdb_byte *) &data_size, 4);
- data_size = (unsigned int) extract_unsigned_integer
- ((gdb_byte *) &data_size, 4,
- gdbarch_byte_order (target_gdbarch ()));
+ data_size = (unsigned int) extract_unsigned_integer (
+ (gdb_byte *) &data_size, 4, gdbarch_byte_order (target_gdbarch ()));
offset += 4;
if (type == tfind_number)
@@ -752,7 +738,7 @@ tfile_target::trace_find (enum trace_find_type type, int num,
found = 1;
break;
default:
- internal_error (_("unknown tfind type"));
+ internal_error (_ ("unknown tfind type"));
}
}
}
@@ -803,8 +789,8 @@ match_blocktype (char blocktype, void *data)
returned true, indicating that all blocks have been walked. */
static int
-traceframe_walk_blocks (walk_blocks_callback_func callback,
- int pos, void *data)
+traceframe_walk_blocks (walk_blocks_callback_func callback, int pos,
+ void *data)
{
/* Iterate through a traceframe's blocks, looking for a block of the
requested type. */
@@ -831,10 +817,8 @@ traceframe_walk_blocks (walk_blocks_callback_func callback,
case 'M':
lseek (trace_fd, cur_offset + pos + 8, SEEK_SET);
tfile_read ((gdb_byte *) &mlen, 2);
- mlen = (unsigned short)
- extract_unsigned_integer ((gdb_byte *) &mlen, 2,
- gdbarch_byte_order
- (target_gdbarch ()));
+ mlen = (unsigned short) extract_unsigned_integer (
+ (gdb_byte *) &mlen, 2, gdbarch_byte_order (target_gdbarch ()));
lseek (trace_fd, mlen, SEEK_CUR);
pos += (8 + 2 + mlen);
break;
@@ -843,7 +827,7 @@ traceframe_walk_blocks (walk_blocks_callback_func callback,
pos += (4 + 8);
break;
default:
- error (_("Unknown block type '%c' (0x%x) in trace frame"),
+ error (_ ("Unknown block type '%c' (0x%x) in trace frame"),
block_type, block_type);
break;
}
@@ -884,8 +868,8 @@ tfile_target::fetch_registers (struct regcache *regcache, int regno)
for (regn = 0; regn < gdbarch_num_regs (gdbarch); regn++)
{
- if (!remote_register_number_and_offset (regcache->arch (),
- regn, &dummy, &offset))
+ if (!remote_register_number_and_offset (regcache->arch (), regn,
+ &dummy, &offset))
continue;
regsize = register_size (gdbarch, regn);
@@ -911,16 +895,15 @@ tfile_target::fetch_registers (struct regcache *regcache, int regno)
}
static enum target_xfer_status
-tfile_xfer_partial_features (const char *annex,
- gdb_byte *readbuf, const gdb_byte *writebuf,
- ULONGEST offset, ULONGEST len,
- ULONGEST *xfered_len)
+tfile_xfer_partial_features (const char *annex, gdb_byte *readbuf,
+ const gdb_byte *writebuf, ULONGEST offset,
+ ULONGEST len, ULONGEST *xfered_len)
{
if (strcmp (annex, "target.xml"))
return TARGET_XFER_E_IO;
if (readbuf == NULL)
- error (_("tfile_xfer_partial: tdesc is read-only"));
+ error (_ ("tfile_xfer_partial: tdesc is read-only"));
if (trace_tdesc.used_size == 0)
return TARGET_XFER_E_IO;
@@ -938,20 +921,20 @@ tfile_xfer_partial_features (const char *annex,
}
enum target_xfer_status
-tfile_target::xfer_partial (enum target_object object,
- const char *annex, gdb_byte *readbuf,
- const gdb_byte *writebuf, ULONGEST offset, ULONGEST len,
+tfile_target::xfer_partial (enum target_object object, const char *annex,
+ gdb_byte *readbuf, const gdb_byte *writebuf,
+ ULONGEST offset, ULONGEST len,
ULONGEST *xfered_len)
{
/* We're only doing regular memory and tdesc for now. */
if (object == TARGET_OBJECT_AVAILABLE_FEATURES)
- return tfile_xfer_partial_features (annex, readbuf, writebuf,
- offset, len, xfered_len);
+ return tfile_xfer_partial_features (annex, readbuf, writebuf, offset, len,
+ xfered_len);
if (object != TARGET_OBJECT_MEMORY)
return TARGET_XFER_E_IO;
if (readbuf == NULL)
- error (_("tfile_xfer_partial: trace file is read-only"));
+ error (_ ("tfile_xfer_partial: trace file is read-only"));
if (get_traceframe_number () != -1)
{
@@ -970,11 +953,11 @@ tfile_target::xfer_partial (enum target_object object,
enum bfd_endian byte_order = gdbarch_byte_order (target_gdbarch ());
tfile_read ((gdb_byte *) &maddr, 8);
- maddr = extract_unsigned_integer ((gdb_byte *) &maddr, 8,
- byte_order);
+ maddr
+ = extract_unsigned_integer ((gdb_byte *) &maddr, 8, byte_order);
tfile_read ((gdb_byte *) &mlen, 2);
- mlen = (unsigned short)
- extract_unsigned_integer ((gdb_byte *) &mlen, 2, byte_order);
+ mlen = (unsigned short) extract_unsigned_integer ((gdb_byte *) &mlen,
+ 2, byte_order);
/* If the block includes the first part of the desired
range, return as much it has; GDB will re-request the
@@ -1045,15 +1028,14 @@ tfile_target::get_trace_state_variable_value (int tsvnum, LONGEST *val)
int vnum;
tfile_read ((gdb_byte *) &vnum, 4);
- vnum = (int) extract_signed_integer ((gdb_byte *) &vnum, 4,
- gdbarch_byte_order
- (target_gdbarch ()));
+ vnum = (int) extract_signed_integer (
+ (gdb_byte *) &vnum, 4, gdbarch_byte_order (target_gdbarch ()));
if (tsvnum == vnum)
{
tfile_read ((gdb_byte *) val, 8);
- *val = extract_signed_integer ((gdb_byte *) val, 8,
- gdbarch_byte_order
- (target_gdbarch ()));
+ *val
+ = extract_signed_integer ((gdb_byte *) val, 8,
+ gdbarch_byte_order (target_gdbarch ()));
found = true;
}
pos += (4 + 8);
@@ -1078,14 +1060,12 @@ build_traceframe_info (char blocktype, void *data)
unsigned short mlen;
tfile_read ((gdb_byte *) &maddr, 8);
- maddr = extract_unsigned_integer ((gdb_byte *) &maddr, 8,
- gdbarch_byte_order
- (target_gdbarch ()));
+ maddr
+ = extract_unsigned_integer ((gdb_byte *) &maddr, 8,
+ gdbarch_byte_order (target_gdbarch ()));
tfile_read ((gdb_byte *) &mlen, 2);
- mlen = (unsigned short)
- extract_unsigned_integer ((gdb_byte *) &mlen,
- 2, gdbarch_byte_order
- (target_gdbarch ()));
+ mlen = (unsigned short) extract_unsigned_integer (
+ (gdb_byte *) &mlen, 2, gdbarch_byte_order (target_gdbarch ()));
info->memory.emplace_back (maddr, mlen);
break;
@@ -1103,8 +1083,8 @@ build_traceframe_info (char blocktype, void *data)
break;
}
default:
- warning (_("Unhandled trace block type (%d) '%c ' "
- "while building trace frame info."),
+ warning (_ ("Unhandled trace block type (%d) '%c ' "
+ "while building trace frame info."),
blocktype, blocktype);
break;
}
@@ -1133,6 +1113,7 @@ tfile_append_tdesc_line (const char *line)
}
void _initialize_tracefile_tfile ();
+
void
_initialize_tracefile_tfile ()
{
diff --git a/gdb/tracefile.c b/gdb/tracefile.c
index b4543c9bf5f..ce1e8ed3523 100644
--- a/gdb/tracefile.c
+++ b/gdb/tracefile.c
@@ -28,15 +28,13 @@
/* Helper macros. */
-#define TRACE_WRITE_R_BLOCK(writer, buf, size) \
+#define TRACE_WRITE_R_BLOCK(writer, buf, size) \
writer->ops->frame_ops->write_r_block ((writer), (buf), (size))
-#define TRACE_WRITE_M_BLOCK_HEADER(writer, addr, size) \
- writer->ops->frame_ops->write_m_block_header ((writer), (addr), \
- (size))
-#define TRACE_WRITE_M_BLOCK_MEMORY(writer, buf, size) \
- writer->ops->frame_ops->write_m_block_memory ((writer), (buf), \
- (size))
-#define TRACE_WRITE_V_BLOCK(writer, num, val) \
+#define TRACE_WRITE_M_BLOCK_HEADER(writer, addr, size) \
+ writer->ops->frame_ops->write_m_block_header ((writer), (addr), (size))
+#define TRACE_WRITE_M_BLOCK_MEMORY(writer, buf, size) \
+ writer->ops->frame_ops->write_m_block_memory ((writer), (buf), (size))
+#define TRACE_WRITE_V_BLOCK(writer, num, val) \
writer->ops->frame_ops->write_v_block ((writer), (num), (val))
/* A unique pointer policy class for trace_file_writer. */
@@ -53,7 +51,7 @@ struct trace_file_writer_deleter
/* A unique_ptr specialization for trace_file_writer. */
typedef std::unique_ptr<trace_file_writer, trace_file_writer_deleter>
- trace_file_writer_up;
+ trace_file_writer_up;
/* Save tracepoint data to file named FILENAME through WRITER. WRITER
determines the trace file format. If TARGET_DOES_SAVE is non-zero,
@@ -78,8 +76,7 @@ trace_save (const char *filename, struct trace_file_writer *writer,
if (target_does_save)
{
if (!writer->ops->target_save (writer, filename))
- error (_("Target failed to save trace data to '%s'."),
- filename);
+ error (_ ("Target failed to save trace data to '%s'."), filename);
return;
}
@@ -150,7 +147,7 @@ trace_save (const char *filename, struct trace_file_writer *writer,
gotten = target_get_raw_trace_data (buf.data (), offset,
MAX_TRACE_UPLOAD);
if (gotten < 0)
- error (_("Failure to get requested trace buffer data"));
+ error (_ ("Failure to get requested trace buffer data"));
/* No more data is forthcoming, we're done. */
if (gotten == 0)
break;
@@ -173,11 +170,11 @@ trace_save (const char *filename, struct trace_file_writer *writer,
/* Read the first six bytes in, which is the tracepoint
number and trace frame size. */
- tp_num = (uint16_t)
- extract_unsigned_integer (&((buf.data ())[0]), 2, byte_order);
+ tp_num = (uint16_t) extract_unsigned_integer (&((buf.data ())[0]), 2,
+ byte_order);
- tf_size = (uint32_t)
- extract_unsigned_integer (&((buf.data ())[2]), 4, byte_order);
+ tf_size = (uint32_t) extract_unsigned_integer (&((buf.data ())[2]),
+ 4, byte_order);
writer->ops->frame_ops->start (writer, tp_num);
gotten = 6;
@@ -188,17 +185,16 @@ trace_save (const char *filename, struct trace_file_writer *writer,
offset += 6;
- for (block = 0; block < tf_size; )
+ for (block = 0; block < tf_size;)
{
gdb_byte block_type;
/* We'll fetch one block each time, in order to
handle the extremely large 'M' block. We first
fetch one byte to get the type of the block. */
- gotten = target_get_raw_trace_data (buf.data (),
- offset, 1);
+ gotten = target_get_raw_trace_data (buf.data (), offset, 1);
if (gotten < 1)
- error (_("Failure to get requested trace buffer data"));
+ error (_ ("Failure to get requested trace buffer data"));
gotten = 1;
block += 1;
@@ -208,12 +204,11 @@ trace_save (const char *filename, struct trace_file_writer *writer,
switch (block_type)
{
case 'R':
- gotten
- = target_get_raw_trace_data (buf.data (), offset,
- trace_regblock_size);
+ gotten = target_get_raw_trace_data (buf.data (), offset,
+ trace_regblock_size);
if (gotten < trace_regblock_size)
- error (_("Failure to get requested trace"
- " buffer data"));
+ error (_ ("Failure to get requested trace"
+ " buffer data"));
TRACE_WRITE_R_BLOCK (writer, buf.data (),
trace_regblock_size);
@@ -225,30 +220,29 @@ trace_save (const char *filename, struct trace_file_writer *writer,
LONGEST t;
int j;
- t = target_get_raw_trace_data (buf.data (),
- offset, 10);
+ t = target_get_raw_trace_data (buf.data (), offset,
+ 10);
if (t < 10)
- error (_("Failure to get requested trace"
- " buffer data"));
+ error (_ ("Failure to get requested trace"
+ " buffer data"));
offset += 10;
block += 10;
gotten = 0;
- addr = (ULONGEST)
- extract_unsigned_integer (buf.data (), 8,
- byte_order);
- mlen = (unsigned short)
- extract_unsigned_integer (&((buf.data ())[8]), 2,
- byte_order);
+ addr
+ = (ULONGEST) extract_unsigned_integer (buf.data (),
+ 8,
+ byte_order);
+ mlen = (unsigned short) extract_unsigned_integer (
+ &((buf.data ())[8]), 2, byte_order);
- TRACE_WRITE_M_BLOCK_HEADER (writer, addr,
- mlen);
+ TRACE_WRITE_M_BLOCK_HEADER (writer, addr, mlen);
/* The memory contents in 'M' block may be
very large. Fetch the data from the target
and write them into file one by one. */
- for (j = 0; j < mlen; )
+ for (j = 0; j < mlen;)
{
unsigned int read_length;
@@ -261,11 +255,10 @@ trace_save (const char *filename, struct trace_file_writer *writer,
offset + j,
read_length);
if (t < read_length)
- error (_("Failure to get requested"
- " trace buffer data"));
+ error (_ ("Failure to get requested"
+ " trace buffer data"));
- TRACE_WRITE_M_BLOCK_MEMORY (writer,
- buf.data (),
+ TRACE_WRITE_M_BLOCK_MEMORY (writer, buf.data (),
read_length);
j += read_length;
@@ -279,26 +272,23 @@ trace_save (const char *filename, struct trace_file_writer *writer,
int vnum;
LONGEST val;
- gotten
- = target_get_raw_trace_data (buf.data (),
- offset, 12);
+ gotten = target_get_raw_trace_data (buf.data (),
+ offset, 12);
if (gotten < 12)
- error (_("Failure to get requested"
- " trace buffer data"));
+ error (_ ("Failure to get requested"
+ " trace buffer data"));
- vnum = (int) extract_signed_integer (buf.data (),
- 4,
- byte_order);
- val
- = extract_signed_integer (&((buf.data ())[4]),
- 8, byte_order);
+ vnum = (int) extract_signed_integer (buf.data (), 4,
+ byte_order);
+ val = extract_signed_integer (&((buf.data ())[4]), 8,
+ byte_order);
TRACE_WRITE_V_BLOCK (writer, vnum, val);
}
break;
default:
- error (_("Unknown block type '%c' (0x%x) in"
- " trace frame"),
+ error (_ ("Unknown block type '%c' (0x%x) in"
+ " trace frame"),
block_type, block_type);
}
@@ -325,7 +315,7 @@ tsave_command (const char *args, int from_tty)
int generate_ctf = 0;
if (args == NULL)
- error_no_arg (_("file in which to save trace data"));
+ error_no_arg (_ ("file in which to save trace data"));
gdb_argv built_argv (args);
argv = built_argv.get ();
@@ -337,13 +327,13 @@ tsave_command (const char *args, int from_tty)
else if (strcmp (*argv, "-ctf") == 0)
generate_ctf = 1;
else if (**argv == '-')
- error (_("unknown option `%s'"), *argv);
+ error (_ ("unknown option `%s'"), *argv);
else
filename = *argv;
}
if (!filename)
- error_no_arg (_("file in which to save trace data"));
+ error_no_arg (_ ("file in which to save trace data"));
if (generate_ctf)
trace_save_ctf (filename, target_does_save);
@@ -351,7 +341,7 @@ tsave_command (const char *args, int from_tty)
trace_save_tfile (filename, target_does_save);
if (from_tty)
- gdb_printf (_("Trace data saved to %s '%s'.\n"),
+ gdb_printf (_ ("Trace data saved to %s '%s'.\n"),
generate_ctf ? "directory" : "file", filename);
}
@@ -396,23 +386,22 @@ tracefile_fetch_registers (struct regcache *regcache, int regno)
/* But don't try to guess if tracepoint is multi-location... */
if (tp->loc->next)
{
- warning (_("Tracepoint %d has multiple "
- "locations, cannot infer $pc"),
+ warning (_ ("Tracepoint %d has multiple "
+ "locations, cannot infer $pc"),
tp->number);
return;
}
/* ... or does while-stepping. */
else if (tp->step_count > 0)
{
- warning (_("Tracepoint %d does while-stepping, "
- "cannot infer $pc"),
+ warning (_ ("Tracepoint %d does while-stepping, "
+ "cannot infer $pc"),
tp->number);
return;
}
/* Guess what we can from the tracepoint location. */
- gdbarch_guess_tracepoint_registers (gdbarch, regcache,
- tp->loc->address);
+ gdbarch_guess_tracepoint_registers (gdbarch, regcache, tp->loc->address);
}
/* This is the implementation of target_ops method to_has_all_memory. */
@@ -473,10 +462,11 @@ tracefile_target::get_trace_status (struct trace_status *ts)
}
void _initialize_tracefile ();
+
void
_initialize_tracefile ()
{
- add_com ("tsave", class_trace, tsave_command, _("\
+ add_com ("tsave", class_trace, tsave_command, _ ("\
Save the trace data to a file.\n\
Use the '-ctf' option to save the data to CTF format.\n\
Use the '-r' option to direct the target to save directly to the file,\n\
diff --git a/gdb/tracefile.h b/gdb/tracefile.h
index 9c7fdea7297..21ecfad8ec0 100644
--- a/gdb/tracefile.h
+++ b/gdb/tracefile.h
@@ -17,8 +17,8 @@ struct trace_frame_write_ops
/* Write an 'R' block. Buffer BUF contains its contents and SIZE is
its size. */
- void (*write_r_block) (struct trace_file_writer *self,
- gdb_byte *buf, int32_t size);
+ void (*write_r_block) (struct trace_file_writer *self, gdb_byte *buf,
+ int32_t size);
/* Write an 'M' block, the header and memory contents respectively.
The header of 'M' block is composed of the start address and the
@@ -30,14 +30,14 @@ struct trace_frame_write_ops
the operation to 'M' block to two operations. */
/* Write the head of 'M' block. ADDR is the start address of
collected memory and LENGTH is the length of memory contents. */
- void (*write_m_block_header) (struct trace_file_writer *self,
- uint64_t addr, uint16_t length);
+ void (*write_m_block_header) (struct trace_file_writer *self, uint64_t addr,
+ uint16_t length);
/* Write the memory contents of 'M' block. Buffer BUF contains
its contents and LENGTH is its length. This method can be called
multiple times to write large memory contents of a single 'M'
block. */
- void (*write_m_block_memory) (struct trace_file_writer *self,
- gdb_byte *buf, uint16_t length);
+ void (*write_m_block_memory) (struct trace_file_writer *self, gdb_byte *buf,
+ uint16_t length);
/* Write a 'V' block. NUM is the trace variable number and VAL is
the value of the trace variable. */
@@ -59,20 +59,17 @@ struct trace_file_write_ops
/* Save the data to file or directory NAME of desired format in
target side. Return true for success, otherwise return
false. */
- int (*target_save) (struct trace_file_writer *self,
- const char *name);
+ int (*target_save) (struct trace_file_writer *self, const char *name);
/* Write the trace buffers to file or directory NAME. */
- void (*start) (struct trace_file_writer *self,
- const char *name);
+ void (*start) (struct trace_file_writer *self, const char *name);
/* Write the trace header. */
void (*write_header) (struct trace_file_writer *self);
/* Write the type of block about registers. SIZE is the size of
all registers on the target. */
- void (*write_regblock_type) (struct trace_file_writer *self,
- int size);
+ void (*write_regblock_type) (struct trace_file_writer *self, int size);
/* Write trace status TS. */
void (*write_status) (struct trace_file_writer *self,
@@ -94,8 +91,8 @@ struct trace_file_write_ops
/* Write the data of trace buffer without parsing. The content is
in BUF and length is LEN. */
- void (*write_trace_buffer) (struct trace_file_writer *self,
- gdb_byte *buf, LONGEST len);
+ void (*write_trace_buffer) (struct trace_file_writer *self, gdb_byte *buf,
+ LONGEST len);
/* Operations to write trace frames. The user of this field is
responsible to parse the data of trace buffer. Either field
@@ -120,6 +117,7 @@ extern struct trace_file_writer *tfile_trace_file_writer_new (void);
class tracefile_target : public process_stratum_target
{
public:
+
tracefile_target () = default;
int get_trace_status (trace_status *ts) override;
@@ -127,7 +125,9 @@ public:
bool has_memory () override;
bool has_stack () override;
bool has_registers () override;
+
bool has_execution (inferior *inf) override { return false; }
+
bool thread_alive (ptid_t ptid) override;
};
diff --git a/gdb/tracepoint.c b/gdb/tracepoint.c
index 7e172dfb3fc..f2c3b0f737a 100644
--- a/gdb/tracepoint.c
+++ b/gdb/tracepoint.c
@@ -70,7 +70,7 @@
NOTE: expressions get mem2hex'ed otherwise this would be twice as
large. (400 - 31)/2 == 184 */
-#define MAX_AGENT_EXPR_LEN 184
+#define MAX_AGENT_EXPR_LEN 184
/*
Tracepoint.c:
@@ -97,7 +97,6 @@
$tracepoint : tracepoint number of trace frame currently being debugged.
*/
-
/* ======= Important global variables: ======= */
/* The list of all trace state variables. We don't retain pointers to
@@ -161,15 +160,9 @@ static counted_command_line all_tracepoint_actions (struct breakpoint *);
static struct trace_status trace_status;
-const char *stop_reason_names[] = {
- "tunknown",
- "tnotrun",
- "tstop",
- "tfull",
- "tdisconnected",
- "tpasscount",
- "terror"
-};
+const char *stop_reason_names[]
+ = { "tunknown", "tnotrun", "tstop", "tfull",
+ "tdisconnected", "tpasscount", "terror" };
struct trace_status *
current_trace_status (void)
@@ -232,8 +225,7 @@ set_traceframe_context (frame_info_ptr trace_frame)
/* Save func name as "$trace_func", a debugger variable visible to
users. */
- if (traceframe_fun == NULL
- || traceframe_fun->linkage_name () == NULL)
+ if (traceframe_fun == NULL || traceframe_fun->linkage_name () == NULL)
clear_internalvar (lookup_internalvar ("trace_func"));
else
set_internalvar_string (lookup_internalvar ("trace_func"),
@@ -244,8 +236,9 @@ set_traceframe_context (frame_info_ptr trace_frame)
if (traceframe_sal.symtab == NULL)
clear_internalvar (lookup_internalvar ("trace_file"));
else
- set_internalvar_string (lookup_internalvar ("trace_file"),
- symtab_to_filename_for_display (traceframe_sal.symtab));
+ set_internalvar_string (
+ lookup_internalvar ("trace_file"),
+ symtab_to_filename_for_display (traceframe_sal.symtab));
}
/* Create a new trace state variable with the given name. */
@@ -293,7 +286,7 @@ delete_trace_state_variable (const char *name)
return;
}
- warning (_("No trace variable named \"$%s\", not deleting"), name);
+ warning (_ ("No trace variable named \"$%s\", not deleting"), name);
}
/* Throws an error if NAME is not valid syntax for a trace state
@@ -305,19 +298,19 @@ validate_trace_state_variable_name (const char *name)
const char *p;
if (*name == '\0')
- error (_("Must supply a non-empty variable name"));
+ error (_ ("Must supply a non-empty variable name"));
/* All digits in the name is reserved for value history
references. */
for (p = name; isdigit (*p); p++)
;
if (*p == '\0')
- error (_("$%s is not a valid trace state variable name"), name);
+ error (_ ("$%s is not a valid trace state variable name"), name);
for (p = name; isalnum (*p) || *p == '_'; p++)
;
if (*p != '\0')
- error (_("$%s is not a valid trace state variable name"), name);
+ error (_ ("$%s is not a valid trace state variable name"), name);
}
/* The 'tvariable' command collects a name and optional expression to
@@ -331,13 +324,13 @@ trace_variable_command (const char *args, int from_tty)
const char *name_start, *p;
if (!args || !*args)
- error_no_arg (_("Syntax is $NAME [ = EXPR ]"));
+ error_no_arg (_ ("Syntax is $NAME [ = EXPR ]"));
/* Only allow two syntaxes; "$name" and "$name=value". */
p = skip_spaces (args);
if (*p++ != '$')
- error (_("Name of trace variable should start with '$'"));
+ error (_ ("Name of trace variable should start with '$'"));
name_start = p;
while (isalnum (*p) || *p == '_')
@@ -346,7 +339,7 @@ trace_variable_command (const char *args, int from_tty)
p = skip_spaces (p);
if (*p != '=' && *p != '\0')
- error (_("Syntax must be $NAME [ = EXPR ]"));
+ error (_ ("Syntax must be $NAME [ = EXPR ]"));
validate_trace_state_variable_name (name.c_str ());
@@ -362,8 +355,8 @@ trace_variable_command (const char *args, int from_tty)
tsv->initial_value = initval;
gdb::observers::tsv_modified.notify (tsv);
}
- gdb_printf (_("Trace state variable $%s "
- "now has initial value %s.\n"),
+ gdb_printf (_ ("Trace state variable $%s "
+ "now has initial value %s.\n"),
tsv->name.c_str (), plongest (tsv->initial_value));
return;
}
@@ -374,8 +367,8 @@ trace_variable_command (const char *args, int from_tty)
gdb::observers::tsv_created.notify (tsv);
- gdb_printf (_("Trace state variable $%s "
- "created, with initial value %s.\n"),
+ gdb_printf (_ ("Trace state variable $%s "
+ "created, with initial value %s.\n"),
tsv->name.c_str (), plongest (tsv->initial_value));
}
@@ -384,7 +377,7 @@ delete_trace_variable_command (const char *args, int from_tty)
{
if (args == NULL)
{
- if (query (_("Delete all trace state variables? ")))
+ if (query (_ ("Delete all trace state variables? ")))
tvariables.clear ();
dont_repeat ();
gdb::observers::tsv_deleted.notify (NULL);
@@ -398,7 +391,7 @@ delete_trace_variable_command (const char *args, int from_tty)
if (*arg == '$')
delete_trace_state_variable (arg + 1);
else
- warning (_("Name \"%s\" not prefixed with '$', ignoring"), arg);
+ warning (_ ("Name \"%s\" not prefixed with '$', ignoring"), arg);
}
dont_repeat ();
@@ -459,7 +452,7 @@ tvariables_info_1 (void)
}
if (tvariables.empty ())
- uiout->text (_("No trace state variables.\n"));
+ uiout->text (_ ("No trace state variables.\n"));
}
/* List all the trace state variables. */
@@ -498,25 +491,25 @@ save_trace_state_variables (struct ui_file *fp)
static void
end_actions_pseudocommand (const char *args, int from_tty)
{
- error (_("This command cannot be used at the top level."));
+ error (_ ("This command cannot be used at the top level."));
}
static void
while_stepping_pseudocommand (const char *args, int from_tty)
{
- error (_("This command can only be used in a tracepoint actions list."));
+ error (_ ("This command can only be used in a tracepoint actions list."));
}
static void
collect_pseudocommand (const char *args, int from_tty)
{
- error (_("This command can only be used in a tracepoint actions list."));
+ error (_ ("This command can only be used in a tracepoint actions list."));
}
static void
teval_pseudocommand (const char *args, int from_tty)
{
- error (_("This command can only be used in a tracepoint actions list."));
+ error (_ ("This command can only be used in a tracepoint actions list."));
}
/* Parse any collection options, such as /s for strings. */
@@ -551,10 +544,11 @@ decode_agent_options (const char *exp, int *trace_string)
exp++;
}
else
- error (_("Target does not support \"/s\" option for string tracing."));
+ error (
+ _ ("Target does not support \"/s\" option for string tracing."));
}
else
- error (_("Undefined collection format \"%c\"."), *exp);
+ error (_ ("Undefined collection format \"%c\"."), *exp);
exp = skip_spaces (exp);
@@ -570,16 +564,15 @@ actions_command (const char *args, int from_tty)
t = get_tracepoint_by_number (&args, NULL);
if (t)
{
- std::string tmpbuf =
- string_printf ("Enter actions for tracepoint %d, one per line.",
- t->number);
-
- counted_command_line l = read_command_lines (tmpbuf.c_str (),
- from_tty, 1,
- [=] (const char *line)
- {
- validate_actionline (line, t);
- });
+ std::string tmpbuf
+ = string_printf ("Enter actions for tracepoint %d, one per line.",
+ t->number);
+
+ counted_command_line l
+ = read_command_lines (tmpbuf.c_str (), from_tty, 1,
+ [=] (const char *line) {
+ validate_actionline (line, t);
+ });
breakpoint_set_commands (t, std::move (l));
}
/* else just return */
@@ -594,12 +587,12 @@ report_agent_reqs_errors (struct agent_expr *aexpr)
/* All of the "flaws" are serious bytecode generation issues that
should never occur. */
if (aexpr->flaw != agent_flaw_none)
- internal_error (_("expression is malformed"));
+ internal_error (_ ("expression is malformed"));
/* If analysis shows a stack underflow, GDB must have done something
badly wrong in its bytecode generation. */
if (aexpr->min_height < 0)
- internal_error (_("expression has min height < 0"));
+ internal_error (_ ("expression has min height < 0"));
/* Issue this error if the stack is predicted to get too deep. The
limit is rather arbitrary; a better scheme might be for the
@@ -608,7 +601,7 @@ report_agent_reqs_errors (struct agent_expr *aexpr)
amounts to 20 levels of expression nesting, which is actually
a pretty big hairy expression. */
if (aexpr->max_height > 20)
- error (_("Expression is too complicated."));
+ error (_ ("Expression is too complicated."));
}
/* Call ax_reqs on AEXPR and raise an error if something is wrong. */
@@ -619,7 +612,7 @@ finalize_tracepoint_aexpr (struct agent_expr *aexpr)
ax_reqs (aexpr);
if (aexpr->len > MAX_AGENT_EXPR_LEN)
- error (_("Expression is too complicated."));
+ error (_ ("Expression is too complicated."));
report_agent_reqs_errors (aexpr);
}
@@ -640,15 +633,15 @@ validate_actionline (const char *line, struct breakpoint *b)
p = skip_spaces (line);
/* Symbol lookup etc. */
- if (*p == '\0') /* empty line: just prompt for another line. */
+ if (*p == '\0') /* empty line: just prompt for another line. */
return;
- if (*p == '#') /* comment line */
+ if (*p == '#') /* comment line */
return;
c = lookup_cmd (&p, cmdlist, "", NULL, -1, 1);
if (c == 0)
- error (_("`%s' is not a tracepoint action, or is ambiguous."), p);
+ error (_ ("`%s' is not a tracepoint action, or is ambiguous."), p);
if (cmd_simple_func_eq (c, collect_pseudocommand))
{
@@ -658,11 +651,11 @@ validate_actionline (const char *line, struct breakpoint *b)
p = decode_agent_options (p, &trace_string);
do
- { /* Repeat over a comma-separated list. */
- QUIT; /* Allow user to bail out with ^C. */
+ { /* Repeat over a comma-separated list. */
+ QUIT; /* Allow user to bail out with ^C. */
p = skip_spaces (p);
- if (*p == '$') /* Look for special pseudo-symbols. */
+ if (*p == '$') /* Look for special pseudo-symbols. */
{
if (0 == strncasecmp ("reg", p + 1, 3)
|| 0 == strncasecmp ("arg", p + 1, 3)
@@ -686,21 +679,21 @@ validate_actionline (const char *line, struct breakpoint *b)
{
symbol *sym;
expr::var_value_operation *vvop
- = (gdb::checked_static_cast<expr::var_value_operation *>
- (exp->op.get ()));
+ = (gdb::checked_static_cast<expr::var_value_operation *> (
+ exp->op.get ()));
sym = vvop->get_symbol ();
if (sym->aclass () == LOC_CONST)
{
- error (_("constant `%s' (value %s) "
- "will not be collected."),
+ error (_ ("constant `%s' (value %s) "
+ "will not be collected."),
sym->print_name (),
plongest (sym->value_longest ()));
}
else if (sym->aclass () == LOC_OPTIMIZED_OUT)
{
- error (_("`%s' is optimized away "
- "and cannot be collected."),
+ error (_ ("`%s' is optimized away "
+ "and cannot be collected."),
sym->print_name ());
}
}
@@ -708,9 +701,8 @@ validate_actionline (const char *line, struct breakpoint *b)
/* We have something to collect, make sure that the expr to
bytecode translator can handle it and that it's not too
long. */
- agent_expr_up aexpr = gen_trace_for_expr (loc->address,
- exp.get (),
- trace_string);
+ agent_expr_up aexpr
+ = gen_trace_for_expr (loc->address, exp.get (), trace_string);
finalize_tracepoint_aexpr (aexpr.get ());
}
@@ -721,8 +713,8 @@ validate_actionline (const char *line, struct breakpoint *b)
else if (cmd_simple_func_eq (c, teval_pseudocommand))
{
do
- { /* Repeat over a comma-separated list. */
- QUIT; /* Allow user to bail out with ^C. */
+ { /* Repeat over a comma-separated list. */
+ QUIT; /* Allow user to bail out with ^C. */
p = skip_spaces (p);
tmp_p = p;
@@ -737,7 +729,8 @@ validate_actionline (const char *line, struct breakpoint *b)
/* We have something to evaluate, make sure that the expr to
bytecode translator can handle it and that it's not too
long. */
- agent_expr_up aexpr = gen_eval_for_expr (loc->address, exp.get ());
+ agent_expr_up aexpr
+ = gen_eval_for_expr (loc->address, exp.get ());
finalize_tracepoint_aexpr (aexpr.get ());
}
@@ -752,7 +745,7 @@ validate_actionline (const char *line, struct breakpoint *b)
p = skip_spaces (p);
t->step_count = strtol (p, &endp, 0);
if (endp == p || t->step_count == 0)
- error (_("while-stepping step count `%s' is malformed."), line);
+ error (_ ("while-stepping step count `%s' is malformed."), line);
p = endp;
}
@@ -760,10 +753,11 @@ validate_actionline (const char *line, struct breakpoint *b)
;
else
- error (_("`%s' is not a supported tracepoint action."), line);
+ error (_ ("`%s' is not a supported tracepoint action."), line);
}
-enum {
+enum
+{
memrange_absolute = -1
};
@@ -805,9 +799,9 @@ memrange_sortmerge (std::vector<memrange> &memranges)
{
if (memranges[b].end > memranges[a].end)
memranges[a].end = memranges[b].end;
- continue; /* next b, same a */
+ continue; /* next b, same a */
}
- a++; /* next a */
+ a++; /* next a */
if (a != b)
memranges[a] = memranges[b];
}
@@ -837,7 +831,7 @@ collection_list::add_ax_registers (struct agent_expr *aexpr)
{
for (int ndx1 = 0; ndx1 < aexpr->reg_mask_len; ndx1++)
{
- QUIT; /* Allow user to bail out with ^C. */
+ QUIT; /* Allow user to bail out with ^C. */
if (aexpr->reg_mask[ndx1] != 0)
{
/* Assume chars have 8 bits. */
@@ -857,15 +851,14 @@ collection_list::add_ax_registers (struct agent_expr *aexpr)
void
collection_list::add_local_register (struct gdbarch *gdbarch,
- unsigned int regno,
- CORE_ADDR scope)
+ unsigned int regno, CORE_ADDR scope)
{
if (regno < gdbarch_num_regs (gdbarch))
{
int remote_regno = gdbarch_remote_register_number (gdbarch, regno);
if (remote_regno < 0)
- error (_("Can't collect register %d"), regno);
+ error (_ ("Can't collect register %d"), regno);
add_remote_register (remote_regno);
}
@@ -891,9 +884,9 @@ collection_list::add_local_register (struct gdbarch *gdbarch,
/* Add a memrange to a collection list. */
void
-collection_list::add_memrange (struct gdbarch *gdbarch,
- int type, bfd_signed_vma base,
- unsigned long len, CORE_ADDR scope)
+collection_list::add_memrange (struct gdbarch *gdbarch, int type,
+ bfd_signed_vma base, unsigned long len,
+ CORE_ADDR scope)
{
if (info_verbose)
gdb_printf ("(%d,%s,%ld)\n", type, paddress (gdbarch, base), len);
@@ -903,18 +896,16 @@ collection_list::add_memrange (struct gdbarch *gdbarch,
/* len: we actually save end (base + len) for convenience */
m_memranges.emplace_back (type, base, base + len);
- if (type != memrange_absolute) /* Better collect the base register! */
+ if (type != memrange_absolute) /* Better collect the base register! */
add_local_register (gdbarch, type, scope);
}
/* Add a symbol to a collection list. */
void
-collection_list::collect_symbol (struct symbol *sym,
- struct gdbarch *gdbarch,
+collection_list::collect_symbol (struct symbol *sym, struct gdbarch *gdbarch,
long frame_regno, long frame_offset,
- CORE_ADDR scope,
- int trace_string)
+ CORE_ADDR scope, int trace_string)
{
unsigned long len;
unsigned int reg;
@@ -925,8 +916,8 @@ collection_list::collect_symbol (struct symbol *sym,
switch (sym->aclass ())
{
default:
- gdb_printf ("%s: don't know symbol class %d\n",
- sym->print_name (), sym->aclass ());
+ gdb_printf ("%s: don't know symbol class %d\n", sym->print_name (),
+ sym->aclass ());
break;
case LOC_CONST:
gdb_printf ("constant %s (value %s) will not be collected.\n",
@@ -937,8 +928,7 @@ collection_list::collect_symbol (struct symbol *sym,
if (info_verbose)
{
gdb_printf ("LOC_STATIC %s: collect %ld bytes at %s.\n",
- sym->print_name (), len,
- paddress (gdbarch, offset));
+ sym->print_name (), len, paddress (gdbarch, offset));
}
/* A struct may be a C++ class with static fields, go to general
expression handling. */
@@ -954,8 +944,8 @@ collection_list::collect_symbol (struct symbol *sym,
add_local_register (gdbarch, reg, scope);
/* Check for doubles stored in two registers. */
/* FIXME: how about larger types stored in 3 or more regs? */
- if (sym->type ()->code () == TYPE_CODE_FLT &&
- len > register_size (gdbarch, reg))
+ if (sym->type ()->code () == TYPE_CODE_FLT
+ && len > register_size (gdbarch, reg))
add_local_register (gdbarch, reg + 1, scope);
break;
case LOC_REF_ARG:
@@ -968,8 +958,9 @@ collection_list::collect_symbol (struct symbol *sym,
if (info_verbose)
{
gdb_printf ("LOC_LOCAL %s: Collect %ld bytes at offset %s"
- " from frame ptr reg %d\n", sym->print_name (), len,
- paddress (gdbarch, offset), reg);
+ " from frame ptr reg %d\n",
+ sym->print_name (), len, paddress (gdbarch, offset),
+ reg);
}
add_memrange (gdbarch, reg, offset, len, scope);
break;
@@ -979,8 +970,9 @@ collection_list::collect_symbol (struct symbol *sym,
if (info_verbose)
{
gdb_printf ("LOC_REGPARM_ADDR %s: Collect %ld bytes at offset %s"
- " from reg %d\n", sym->print_name (), len,
- paddress (gdbarch, offset), reg);
+ " from reg %d\n",
+ sym->print_name (), len, paddress (gdbarch, offset),
+ reg);
}
add_memrange (gdbarch, reg, offset, len, scope);
break;
@@ -990,8 +982,9 @@ collection_list::collect_symbol (struct symbol *sym,
if (info_verbose)
{
gdb_printf ("LOC_LOCAL %s: Collect %ld bytes at offset %s"
- " from frame ptr reg %d\n", sym->print_name (), len,
- paddress (gdbarch, offset), reg);
+ " from frame ptr reg %d\n",
+ sym->print_name (), len, paddress (gdbarch, offset),
+ reg);
}
add_memrange (gdbarch, reg, offset, len, scope);
break;
@@ -1013,8 +1006,8 @@ collection_list::collect_symbol (struct symbol *sym,
/* Expressions are the most general case. */
if (treat_as_expr)
{
- agent_expr_up aexpr = gen_trace_for_var (scope, gdbarch,
- sym, trace_string);
+ agent_expr_up aexpr
+ = gen_trace_for_var (scope, gdbarch, sym, trace_string);
/* It can happen that the symbol is recorded as a computed
location, but it's been optimized away and doesn't actually
@@ -1045,34 +1038,31 @@ collection_list::add_wholly_collected (const char *print_name)
void
collection_list::add_local_symbols (struct gdbarch *gdbarch, CORE_ADDR pc,
- long frame_regno, long frame_offset, int type,
- int trace_string)
+ long frame_regno, long frame_offset,
+ int type, int trace_string)
{
const struct block *block;
int count = 0;
- auto do_collect_symbol = [&] (const char *print_name,
- struct symbol *sym)
- {
- collect_symbol (sym, gdbarch, frame_regno,
- frame_offset, pc, trace_string);
- count++;
- add_wholly_collected (print_name);
- };
+ auto do_collect_symbol = [&] (const char *print_name, struct symbol *sym) {
+ collect_symbol (sym, gdbarch, frame_regno, frame_offset, pc, trace_string);
+ count++;
+ add_wholly_collected (print_name);
+ };
if (type == 'L')
{
block = block_for_pc (pc);
if (block == NULL)
{
- warning (_("Can't collect locals; "
- "no symbol table info available.\n"));
+ warning (_ ("Can't collect locals; "
+ "no symbol table info available.\n"));
return;
}
iterate_over_block_local_vars (block, do_collect_symbol);
if (count == 0)
- warning (_("No locals found in scope."));
+ warning (_ ("No locals found in scope."));
}
else
{
@@ -1080,13 +1070,13 @@ collection_list::add_local_symbols (struct gdbarch *gdbarch, CORE_ADDR pc,
block = block_for_pc (fn_pc);
if (block == NULL)
{
- warning (_("Can't collect args; no symbol table info available."));
+ warning (_ ("Can't collect args; no symbol table info available."));
return;
}
iterate_over_block_arg_vars (block, do_collect_symbol);
if (count == 0)
- warning (_("No args found in scope."));
+ warning (_ ("No args found in scope."));
}
}
@@ -1104,8 +1094,8 @@ collection_list::collection_list ()
int max_remote_regno = 0;
for (int i = 0; i < gdbarch_num_regs (target_gdbarch ()); i++)
{
- int remote_regno = (gdbarch_remote_register_number
- (target_gdbarch (), i));
+ int remote_regno
+ = (gdbarch_remote_register_number (target_gdbarch (), i));
if (remote_regno >= 0 && remote_regno > max_remote_regno)
max_remote_regno = remote_regno;
@@ -1139,9 +1129,9 @@ collection_list::stringify ()
}
for (i = m_regs_mask.size () - 1; i > 0; i--)
- if (m_regs_mask[i] != 0) /* Skip leading zeroes in regs_mask. */
+ if (m_regs_mask[i] != 0) /* Skip leading zeroes in regs_mask. */
break;
- if (m_regs_mask[i] != 0) /* Prepare to send regs_mask to the stub. */
+ if (m_regs_mask[i] != 0) /* Prepare to send regs_mask to the stub. */
{
if (info_verbose)
gdb_printf ("\nCollecting registers (mask): 0x");
@@ -1156,7 +1146,7 @@ collection_list::stringify ()
*end++ = 'R';
for (; i >= 0; i--)
{
- QUIT; /* Allow user to bail out with ^C. */
+ QUIT; /* Allow user to bail out with ^C. */
if (info_verbose)
gdb_printf ("%02X", m_regs_mask[i]);
@@ -1170,18 +1160,14 @@ collection_list::stringify ()
gdb_printf ("\n");
if (!m_memranges.empty () && info_verbose)
gdb_printf ("Collecting memranges: \n");
- for (i = 0, count = 0, end = temp_buf.data ();
- i < m_memranges.size (); i++)
+ for (i = 0, count = 0, end = temp_buf.data (); i < m_memranges.size (); i++)
{
- QUIT; /* Allow user to bail out with ^C. */
+ QUIT; /* Allow user to bail out with ^C. */
if (info_verbose)
{
- gdb_printf ("(%d, %s, %ld)\n",
- m_memranges[i].type,
- paddress (target_gdbarch (),
- m_memranges[i].start),
- (long) (m_memranges[i].end
- - m_memranges[i].start));
+ gdb_printf ("(%d, %s, %ld)\n", m_memranges[i].type,
+ paddress (target_gdbarch (), m_memranges[i].start),
+ (long) (m_memranges[i].end - m_memranges[i].start));
}
if (count + 27 > MAX_AGENT_EXPR_LEN)
{
@@ -1191,8 +1177,7 @@ collection_list::stringify ()
}
{
- bfd_signed_vma length
- = m_memranges[i].end - m_memranges[i].start;
+ bfd_signed_vma length = m_memranges[i].end - m_memranges[i].start;
/* The "%X" conversion specifier expects an unsigned argument,
so passing -1 (memrange_absolute) to it directly gives you
@@ -1212,7 +1197,7 @@ collection_list::stringify ()
for (i = 0; i < m_aexprs.size (); i++)
{
- QUIT; /* Allow user to bail out with ^C. */
+ QUIT; /* Allow user to bail out with ^C. */
if ((count + 10 + 2 * m_aexprs[i]->len) > MAX_AGENT_EXPR_LEN)
{
str_list.emplace_back (temp_buf.data (), count);
@@ -1220,7 +1205,7 @@ collection_list::stringify ()
end = temp_buf.data ();
}
sprintf (end, "X%08X,", m_aexprs[i]->len);
- end += 10; /* 'X' + 8 hex digits + ',' */
+ end += 10; /* 'X' + 8 hex digits + ',' */
count += 10;
end = mem2hex (m_aexprs[i]->buf, end, m_aexprs[i]->len);
@@ -1252,10 +1237,8 @@ collection_list::finish ()
}
static void
-encode_actions_1 (struct command_line *action,
- struct bp_location *tloc,
- int frame_reg,
- LONGEST frame_offset,
+encode_actions_1 (struct command_line *action, struct bp_location *tloc,
+ int frame_reg, LONGEST frame_offset,
struct collection_list *collect,
struct collection_list *stepping_list)
{
@@ -1266,13 +1249,13 @@ encode_actions_1 (struct command_line *action,
for (; action; action = action->next)
{
- QUIT; /* Allow user to bail out with ^C. */
+ QUIT; /* Allow user to bail out with ^C. */
action_exp = action->line;
action_exp = skip_spaces (action_exp);
cmd = lookup_cmd (&action_exp, cmdlist, "", NULL, -1, 1);
if (cmd == 0)
- error (_("Bad action list item: %s"), action_exp);
+ error (_ ("Bad action list item: %s"), action_exp);
if (cmd_simple_func_eq (cmd, collect_pseudocommand))
{
@@ -1282,17 +1265,17 @@ encode_actions_1 (struct command_line *action,
action_exp = decode_agent_options (action_exp, &trace_string);
do
- { /* Repeat over a comma-separated list. */
- QUIT; /* Allow user to bail out with ^C. */
+ { /* Repeat over a comma-separated list. */
+ QUIT; /* Allow user to bail out with ^C. */
action_exp = skip_spaces (action_exp);
if (0 == strncasecmp ("$reg", action_exp, 4))
{
- for (i = 0; i < gdbarch_num_regs (target_gdbarch ());
- i++)
+ for (i = 0; i < gdbarch_num_regs (target_gdbarch ()); i++)
{
- int remote_regno = (gdbarch_remote_register_number
- (target_gdbarch (), i));
+ int remote_regno
+ = (gdbarch_remote_register_number (target_gdbarch (),
+ i));
/* Ignore arch regnos without a corresponding
remote regno. This can happen for regnos not
@@ -1300,27 +1283,21 @@ encode_actions_1 (struct command_line *action,
if (remote_regno >= 0)
collect->add_remote_register (remote_regno);
}
- action_exp = strchr (action_exp, ','); /* more? */
+ action_exp = strchr (action_exp, ','); /* more? */
}
else if (0 == strncasecmp ("$arg", action_exp, 4))
{
- collect->add_local_symbols (target_gdbarch (),
- tloc->address,
- frame_reg,
- frame_offset,
- 'A',
+ collect->add_local_symbols (target_gdbarch (), tloc->address,
+ frame_reg, frame_offset, 'A',
trace_string);
- action_exp = strchr (action_exp, ','); /* more? */
+ action_exp = strchr (action_exp, ','); /* more? */
}
else if (0 == strncasecmp ("$loc", action_exp, 4))
{
- collect->add_local_symbols (target_gdbarch (),
- tloc->address,
- frame_reg,
- frame_offset,
- 'L',
+ collect->add_local_symbols (target_gdbarch (), tloc->address,
+ frame_reg, frame_offset, 'L',
trace_string);
- action_exp = strchr (action_exp, ','); /* more? */
+ action_exp = strchr (action_exp, ','); /* more? */
}
else if (0 == strncasecmp ("$_ret", action_exp, 5))
{
@@ -1335,40 +1312,40 @@ encode_actions_1 (struct command_line *action,
collect->add_ax_registers (aexpr.get ());
collect->add_aexpr (std::move (aexpr));
- action_exp = strchr (action_exp, ','); /* more? */
+ action_exp = strchr (action_exp, ','); /* more? */
}
else if (0 == strncasecmp ("$_sdata", action_exp, 7))
{
collect->add_static_trace_data ();
- action_exp = strchr (action_exp, ','); /* more? */
+ action_exp = strchr (action_exp, ','); /* more? */
}
else
{
unsigned long addr;
const char *exp_start = action_exp;
- expression_up exp = parse_exp_1 (&action_exp, tloc->address,
- block_for_pc (tloc->address),
- 1);
+ expression_up exp
+ = parse_exp_1 (&action_exp, tloc->address,
+ block_for_pc (tloc->address), 1);
switch (exp->first_opcode ())
{
case OP_REGISTER:
{
expr::register_operation *regop
- = (gdb::checked_static_cast<expr::register_operation *>
- (exp->op.get ()));
+ = (gdb::checked_static_cast<
+ expr::register_operation *> (exp->op.get ()));
const char *name = regop->get_name ();
i = user_reg_map_name_to_regnum (target_gdbarch (),
name, strlen (name));
if (i == -1)
- internal_error (_("Register $%s not available"),
+ internal_error (_ ("Register $%s not available"),
name);
if (info_verbose)
gdb_printf ("OP_REGISTER: ");
- collect->add_local_register (target_gdbarch (),
- i, tloc->address);
+ collect->add_local_register (target_gdbarch (), i,
+ tloc->address);
break;
}
@@ -1378,15 +1355,14 @@ encode_actions_1 (struct command_line *action,
tempval = evaluate_expression (exp.get ());
addr = value_address (tempval);
expr::unop_memval_operation *memop
- = (gdb::checked_static_cast<expr::unop_memval_operation *>
- (exp->op.get ()));
+ = (gdb::checked_static_cast<
+ expr::unop_memval_operation *> (exp->op.get ()));
struct type *type = memop->get_type ();
/* Initialize the TYPE_LENGTH if it is a typedef. */
check_typedef (type);
collect->add_memrange (target_gdbarch (),
memrange_absolute, addr,
- type->length (),
- tloc->address);
+ type->length (), tloc->address);
collect->append_exp (std::string (exp_start,
action_exp));
}
@@ -1395,25 +1371,22 @@ encode_actions_1 (struct command_line *action,
case OP_VAR_VALUE:
{
expr::var_value_operation *vvo
- = (gdb::checked_static_cast<expr::var_value_operation *>
- (exp->op.get ()));
+ = (gdb::checked_static_cast<
+ expr::var_value_operation *> (exp->op.get ()));
struct symbol *sym = vvo->get_symbol ();
const char *name = sym->natural_name ();
- collect->collect_symbol (sym,
- target_gdbarch (),
- frame_reg,
- frame_offset,
- tloc->address,
- trace_string);
+ collect->collect_symbol (sym, target_gdbarch (),
+ frame_reg, frame_offset,
+ tloc->address, trace_string);
collect->add_wholly_collected (name);
}
break;
- default: /* Full-fledged expression. */
- agent_expr_up aexpr = gen_trace_for_expr (tloc->address,
- exp.get (),
- trace_string);
+ default: /* Full-fledged expression. */
+ agent_expr_up aexpr
+ = gen_trace_for_expr (tloc->address, exp.get (),
+ trace_string);
finalize_tracepoint_aexpr (aexpr.get ());
@@ -1424,35 +1397,35 @@ encode_actions_1 (struct command_line *action,
collect->append_exp (std::string (exp_start,
action_exp));
break;
- } /* switch */
- } /* do */
+ } /* switch */
+ } /* do */
}
while (action_exp && *action_exp++ == ',');
- } /* if */
+ } /* if */
else if (cmd_simple_func_eq (cmd, teval_pseudocommand))
{
do
- { /* Repeat over a comma-separated list. */
- QUIT; /* Allow user to bail out with ^C. */
+ { /* Repeat over a comma-separated list. */
+ QUIT; /* Allow user to bail out with ^C. */
action_exp = skip_spaces (action_exp);
- {
- expression_up exp = parse_exp_1 (&action_exp, tloc->address,
- block_for_pc (tloc->address),
- 1);
+ {
+ expression_up exp
+ = parse_exp_1 (&action_exp, tloc->address,
+ block_for_pc (tloc->address), 1);
- agent_expr_up aexpr = gen_eval_for_expr (tloc->address,
- exp.get ());
+ agent_expr_up aexpr
+ = gen_eval_for_expr (tloc->address, exp.get ());
- finalize_tracepoint_aexpr (aexpr.get ());
+ finalize_tracepoint_aexpr (aexpr.get ());
- /* Even though we're not officially collecting, add
+ /* Even though we're not officially collecting, add
to the collect list anyway. */
- collect->add_aexpr (std::move (aexpr));
- } /* do */
+ collect->add_aexpr (std::move (aexpr));
+ } /* do */
}
while (action_exp && *action_exp++ == ',');
- } /* if */
+ } /* if */
else if (cmd_simple_func_eq (cmd, while_stepping_pseudocommand))
{
/* We check against nested while-stepping when setting
@@ -1464,8 +1437,8 @@ encode_actions_1 (struct command_line *action,
frame_offset, stepping_list, NULL);
}
else
- error (_("Invalid tracepoint command '%s'"), action->line);
- } /* for */
+ error (_ ("Invalid tracepoint command '%s'"), action->line);
+ } /* for */
}
/* Encode actions of tracepoint TLOC->owner and fill TRACEPOINT_LIST
@@ -1479,14 +1452,14 @@ encode_actions (struct bp_location *tloc,
int frame_reg;
LONGEST frame_offset;
- gdbarch_virtual_frame_pointer (tloc->gdbarch,
- tloc->address, &frame_reg, &frame_offset);
+ gdbarch_virtual_frame_pointer (tloc->gdbarch, tloc->address, &frame_reg,
+ &frame_offset);
counted_command_line actions = all_tracepoint_actions (tloc->owner);
encode_actions_1 (actions.get (), tloc, frame_reg, frame_offset,
tracepoint_list, stepping_list);
- encode_actions_1 (breakpoint_commands (tloc->owner), tloc,
- frame_reg, frame_offset, tracepoint_list, stepping_list);
+ encode_actions_1 (breakpoint_commands (tloc->owner), tloc, frame_reg,
+ frame_offset, tracepoint_list, stepping_list);
tracepoint_list->finish ();
stepping_list->finish ();
@@ -1544,8 +1517,8 @@ process_tracepoint_on_disconnect (void)
}
if (has_pending_p)
- warning (_("Pending tracepoints will not be resolved while"
- " GDB is disconnected\n"));
+ warning (_ ("Pending tracepoints will not be resolved while"
+ " GDB is disconnected\n"));
}
/* Reset local state of tracing. */
@@ -1569,36 +1542,35 @@ start_tracing (const char *notes)
/* No point in tracing without any tracepoints... */
if (tracepoint_range.begin () == tracepoint_range.end ())
- error (_("No tracepoints defined, not starting trace"));
+ error (_ ("No tracepoints defined, not starting trace"));
for (breakpoint *b : tracepoint_range)
{
if (b->enable_state == bp_enabled)
any_enabled = 1;
- if ((b->type == bp_fast_tracepoint
- ? may_insert_fast_tracepoints
- : may_insert_tracepoints))
+ if ((b->type == bp_fast_tracepoint ? may_insert_fast_tracepoints
+ : may_insert_tracepoints))
++num_to_download;
else
- warning (_("May not insert %stracepoints, skipping tracepoint %d"),
+ warning (_ ("May not insert %stracepoints, skipping tracepoint %d"),
(b->type == bp_fast_tracepoint ? "fast " : ""), b->number);
}
if (!any_enabled)
{
if (target_supports_enable_disable_tracepoint ())
- warning (_("No tracepoints enabled"));
+ warning (_ ("No tracepoints enabled"));
else
{
/* No point in tracing with only disabled tracepoints that
cannot be re-enabled. */
- error (_("No tracepoints enabled, not starting trace"));
+ error (_ ("No tracepoints enabled, not starting trace"));
}
}
if (num_to_download <= 0)
- error (_("No tracepoints that may be downloaded, not starting trace"));
+ error (_ ("No tracepoints that may be downloaded, not starting trace"));
target_trace_init ();
@@ -1611,9 +1583,8 @@ start_tracing (const char *notes)
for (bp_location *loc : b->locations ())
loc->inserted = 0;
- if ((b->type == bp_fast_tracepoint
- ? !may_insert_fast_tracepoints
- : !may_insert_tracepoints))
+ if ((b->type == bp_fast_tracepoint ? !may_insert_fast_tracepoints
+ : !may_insert_tracepoints))
continue;
t->number_on_target = 0;
@@ -1634,8 +1605,7 @@ start_tracing (const char *notes)
for (bp_location *loc : b->locations ())
if (loc->probe.prob != NULL)
- loc->probe.prob->set_semaphore (loc->probe.objfile,
- loc->gdbarch);
+ loc->probe.prob->set_semaphore (loc->probe.objfile, loc->gdbarch);
if (bp_location_downloaded)
gdb::observers::breakpoint_modified.notify (b);
@@ -1644,7 +1614,7 @@ start_tracing (const char *notes)
/* Send down all the trace state variables too. */
for (const trace_state_variable &tsv : tvariables)
target_download_trace_state_variable (tsv);
-
+
/* Tell target to treat text-like sections as transparent. */
target_trace_set_readonly_regions ();
/* Set some mode flags. */
@@ -1658,14 +1628,14 @@ start_tracing (const char *notes)
ret = target_set_trace_notes (trace_user.c_str (), notes, NULL);
if (!ret && (!trace_user.empty () || notes))
- warning (_("Target does not support trace user/notes, info ignored"));
+ warning (_ ("Target does not support trace user/notes, info ignored"));
/* Now insert traps and begin collecting data. */
target_trace_start ();
/* Reset our local state. */
trace_reset_local_state ();
- current_trace_status()->running = 1;
+ current_trace_status ()->running = 1;
}
/* The tstart command requests the target to start a new trace run.
@@ -1677,13 +1647,13 @@ start_tracing (const char *notes)
static void
tstart_command (const char *args, int from_tty)
{
- dont_repeat (); /* Like "run", dangerous to repeat accidentally. */
+ dont_repeat (); /* Like "run", dangerous to repeat accidentally. */
if (current_trace_status ()->running)
{
if (from_tty
- && !query (_("A trace is running already. Start a new run? ")))
- error (_("New trace run not started."));
+ && !query (_ ("A trace is running already. Start a new run? ")))
+ error (_ ("New trace run not started."));
}
start_tracing (args);
@@ -1698,7 +1668,7 @@ static void
tstop_command (const char *args, int from_tty)
{
if (!current_trace_status ()->running)
- error (_("Trace is not running."));
+ error (_ ("Trace is not running."));
stop_tracing (args);
}
@@ -1712,9 +1682,8 @@ stop_tracing (const char *note)
for (breakpoint *t : all_tracepoints ())
{
- if ((t->type == bp_fast_tracepoint
- ? !may_insert_fast_tracepoints
- : !may_insert_tracepoints))
+ if ((t->type == bp_fast_tracepoint ? !may_insert_fast_tracepoints
+ : !may_insert_tracepoints))
continue;
for (bp_location *loc : t->locations ())
@@ -1735,7 +1704,7 @@ stop_tracing (const char *note)
ret = target_set_trace_notes (NULL, NULL, note);
if (!ret && note)
- warning (_("Target does not support trace notes, note ignored"));
+ warning (_ ("Target does not support trace notes, note ignored"));
/* Should change in response to reply? */
current_trace_status ()->running = 0;
@@ -1747,66 +1716,66 @@ tstatus_command (const char *args, int from_tty)
{
struct trace_status *ts = current_trace_status ();
int status;
-
+
status = target_get_trace_status (ts);
if (status == -1)
{
if (ts->filename != NULL)
- gdb_printf (_("Using a trace file.\n"));
+ gdb_printf (_ ("Using a trace file.\n"));
else
{
- gdb_printf (_("Trace can not be run on this target.\n"));
+ gdb_printf (_ ("Trace can not be run on this target.\n"));
return;
}
}
if (!ts->running_known)
{
- gdb_printf (_("Run/stop status is unknown.\n"));
+ gdb_printf (_ ("Run/stop status is unknown.\n"));
}
else if (ts->running)
{
- gdb_printf (_("Trace is running on the target.\n"));
+ gdb_printf (_ ("Trace is running on the target.\n"));
}
else
{
switch (ts->stop_reason)
{
case trace_never_run:
- gdb_printf (_("No trace has been run on the target.\n"));
+ gdb_printf (_ ("No trace has been run on the target.\n"));
break;
case trace_stop_command:
if (ts->stop_desc)
- gdb_printf (_("Trace stopped by a tstop command (%s).\n"),
+ gdb_printf (_ ("Trace stopped by a tstop command (%s).\n"),
ts->stop_desc);
else
- gdb_printf (_("Trace stopped by a tstop command.\n"));
+ gdb_printf (_ ("Trace stopped by a tstop command.\n"));
break;
case trace_buffer_full:
- gdb_printf (_("Trace stopped because the buffer was full.\n"));
+ gdb_printf (_ ("Trace stopped because the buffer was full.\n"));
break;
case trace_disconnected:
- gdb_printf (_("Trace stopped because of disconnection.\n"));
+ gdb_printf (_ ("Trace stopped because of disconnection.\n"));
break;
case tracepoint_passcount:
- gdb_printf (_("Trace stopped by tracepoint %d.\n"),
+ gdb_printf (_ ("Trace stopped by tracepoint %d.\n"),
ts->stopping_tracepoint);
break;
case tracepoint_error:
if (ts->stopping_tracepoint)
- gdb_printf (_("Trace stopped by an "
- "error (%s, tracepoint %d).\n"),
+ gdb_printf (_ ("Trace stopped by an "
+ "error (%s, tracepoint %d).\n"),
ts->stop_desc, ts->stopping_tracepoint);
else
- gdb_printf (_("Trace stopped by an error (%s).\n"),
+ gdb_printf (_ ("Trace stopped by an error (%s).\n"),
ts->stop_desc);
break;
case trace_stop_reason_unknown:
- gdb_printf (_("Trace stopped for an unknown reason.\n"));
+ gdb_printf (_ ("Trace stopped for an unknown reason.\n"));
break;
default:
- gdb_printf (_("Trace stopped for some other reason (%d).\n"),
+ gdb_printf (_ ("Trace stopped for some other reason (%d).\n"),
ts->stop_reason);
break;
}
@@ -1815,54 +1784,52 @@ tstatus_command (const char *args, int from_tty)
if (ts->traceframes_created >= 0
&& ts->traceframe_count != ts->traceframes_created)
{
- gdb_printf (_("Buffer contains %d trace "
- "frames (of %d created total).\n"),
+ gdb_printf (_ ("Buffer contains %d trace "
+ "frames (of %d created total).\n"),
ts->traceframe_count, ts->traceframes_created);
}
else if (ts->traceframe_count >= 0)
{
- gdb_printf (_("Collected %d trace frames.\n"),
- ts->traceframe_count);
+ gdb_printf (_ ("Collected %d trace frames.\n"), ts->traceframe_count);
}
if (ts->buffer_free >= 0)
{
if (ts->buffer_size >= 0)
{
- gdb_printf (_("Trace buffer has %d bytes of %d bytes free"),
+ gdb_printf (_ ("Trace buffer has %d bytes of %d bytes free"),
ts->buffer_free, ts->buffer_size);
if (ts->buffer_size > 0)
- gdb_printf (_(" (%d%% full)"),
- ((int) ((((long long) (ts->buffer_size
- - ts->buffer_free)) * 100)
- / ts->buffer_size)));
- gdb_printf (_(".\n"));
+ gdb_printf (
+ _ (" (%d%% full)"),
+ ((int) ((((long long) (ts->buffer_size - ts->buffer_free)) * 100)
+ / ts->buffer_size)));
+ gdb_printf (_ (".\n"));
}
else
- gdb_printf (_("Trace buffer has %d bytes free.\n"),
- ts->buffer_free);
+ gdb_printf (_ ("Trace buffer has %d bytes free.\n"), ts->buffer_free);
}
if (ts->disconnected_tracing)
- gdb_printf (_("Trace will continue if GDB disconnects.\n"));
+ gdb_printf (_ ("Trace will continue if GDB disconnects.\n"));
else
- gdb_printf (_("Trace will stop if GDB disconnects.\n"));
+ gdb_printf (_ ("Trace will stop if GDB disconnects.\n"));
if (ts->circular_buffer)
- gdb_printf (_("Trace buffer is circular.\n"));
+ gdb_printf (_ ("Trace buffer is circular.\n"));
if (ts->user_name && strlen (ts->user_name) > 0)
- gdb_printf (_("Trace user is %s.\n"), ts->user_name);
+ gdb_printf (_ ("Trace user is %s.\n"), ts->user_name);
if (ts->notes && strlen (ts->notes) > 0)
- gdb_printf (_("Trace notes: %s.\n"), ts->notes);
+ gdb_printf (_ ("Trace notes: %s.\n"), ts->notes);
/* Now report on what we're doing with tfind. */
if (traceframe_number >= 0)
- gdb_printf (_("Looking at trace frame %d, tracepoint %d.\n"),
+ gdb_printf (_ ("Looking at trace frame %d, tracepoint %d.\n"),
traceframe_number, tracepoint_number);
else
- gdb_printf (_("Not looking at any trace frame.\n"));
+ gdb_printf (_ ("Not looking at any trace frame.\n"));
/* Report start/stop times if supplied. */
if (ts->start_time)
@@ -1872,19 +1839,20 @@ tstatus_command (const char *args, int from_tty)
LONGEST run_time = ts->stop_time - ts->start_time;
/* Reporting a run time is more readable than two long numbers. */
- gdb_printf (_("Trace started at %ld.%06ld secs, stopped %ld.%06ld secs later.\n"),
+ gdb_printf (_ ("Trace started at %ld.%06ld secs, stopped %ld.%06ld "
+ "secs later.\n"),
(long int) (ts->start_time / 1000000),
(long int) (ts->start_time % 1000000),
(long int) (run_time / 1000000),
(long int) (run_time % 1000000));
}
else
- gdb_printf (_("Trace started at %ld.%06ld secs.\n"),
+ gdb_printf (_ ("Trace started at %ld.%06ld secs.\n"),
(long int) (ts->start_time / 1000000),
(long int) (ts->start_time % 1000000));
}
else if (ts->stop_time)
- gdb_printf (_("Trace stopped at %ld.%06ld secs.\n"),
+ gdb_printf (_ ("Trace stopped at %ld.%06ld secs.\n"),
(long int) (ts->stop_time / 1000000),
(long int) (ts->stop_time % 1000000));
@@ -1967,7 +1935,7 @@ trace_status_mi (int on_stop)
stopping_tracepoint = ts->stopping_tracepoint;
break;
}
-
+
if (stop_reason)
{
uiout->field_string ("stop-reason", stop_reason);
@@ -1975,8 +1943,7 @@ trace_status_mi (int on_stop)
uiout->field_signed ("stopping-tracepoint",
stopping_tracepoint);
if (ts->stop_reason == tracepoint_error)
- uiout->field_string ("error-description",
- ts->stop_desc);
+ uiout->field_string ("error-description", ts->stop_desc);
}
}
}
@@ -1990,8 +1957,8 @@ trace_status_mi (int on_stop)
if (ts->buffer_free != -1)
uiout->field_signed ("buffer-free", ts->buffer_free);
- uiout->field_signed ("disconnected", ts->disconnected_tracing);
- uiout->field_signed ("circular", ts->circular_buffer);
+ uiout->field_signed ("disconnected", ts->disconnected_tracing);
+ uiout->field_signed ("circular", ts->circular_buffer);
uiout->field_string ("user-name", ts->user_name);
uiout->field_string ("notes", ts->notes);
@@ -2037,15 +2004,15 @@ query_if_trace_running (int from_tty)
if (current_trace_status ()->disconnected_tracing)
{
- if (!query (_("Trace is running and will "
- "continue after detach; detach anyway? ")))
- error (_("Not confirmed."));
+ if (!query (_ ("Trace is running and will "
+ "continue after detach; detach anyway? ")))
+ error (_ ("Not confirmed."));
}
else
{
- if (!query (_("Trace is running but will "
- "stop on detach; detach anyway? ")))
- error (_("Not confirmed."));
+ if (!query (_ ("Trace is running but will "
+ "stop on detach; detach anyway? ")))
+ error (_ ("Not confirmed."));
}
}
}
@@ -2066,8 +2033,7 @@ disconnect_tracing (void)
/* Worker function for the various flavors of the tfind command. */
void
-tfind_1 (enum trace_find_type type, int num,
- CORE_ADDR addr1, CORE_ADDR addr2,
+tfind_1 (enum trace_find_type type, int num, CORE_ADDR addr1, CORE_ADDR addr2,
int from_tty)
{
int target_frameno = -1, target_tracept = -1;
@@ -2085,12 +2051,10 @@ tfind_1 (enum trace_find_type type, int num,
&& (has_stack_frames () || traceframe_number >= 0))
old_frame_id = get_frame_id (get_current_frame ());
- target_frameno = target_trace_find (type, num, addr1, addr2,
- &target_tracept);
-
- if (type == tfind_number
- && num == -1
- && target_frameno == -1)
+ target_frameno
+ = target_trace_find (type, num, addr1, addr2, &target_tracept);
+
+ if (type == tfind_number && num == -1 && target_frameno == -1)
{
/* We told the target to get out of tfind mode, and it did. */
}
@@ -2116,9 +2080,9 @@ tfind_1 (enum trace_find_type type, int num,
failed WITHOUT aborting. This allows you to write
scripts that search thru the trace buffer until the end,
and then continue on to do something else. */
-
+
if (from_tty)
- error (_("Target failed to find requested trace frame."));
+ error (_ ("Target failed to find requested trace frame."));
else
{
if (info_verbose)
@@ -2130,7 +2094,7 @@ tfind_1 (enum trace_find_type type, int num,
#endif
}
}
-
+
tp = get_tracepoint_by_number_on_target (target_tracept);
reinit_frame_cache ();
@@ -2139,7 +2103,8 @@ tfind_1 (enum trace_find_type type, int num,
set_tracepoint_num (tp ? tp->number : target_tracept);
if (target_frameno != get_traceframe_number ())
- gdb::observers::traceframe_changed.notify (target_frameno, tracepoint_number);
+ gdb::observers::traceframe_changed.notify (target_frameno,
+ tracepoint_number);
set_current_traceframe (target_frameno);
@@ -2160,7 +2125,7 @@ tfind_1 (enum trace_find_type type, int num,
}
else
{
- gdb_printf (_("Found trace frame %d, tracepoint %d\n"),
+ gdb_printf (_ ("Found trace frame %d, tracepoint %d\n"),
traceframe_number, tracepoint_number);
}
}
@@ -2169,16 +2134,15 @@ tfind_1 (enum trace_find_type type, int num,
if (uiout->is_mi_like_p ())
uiout->field_string ("found", "0");
else if (type == tfind_number && num == -1)
- gdb_printf (_("No longer looking at any trace frame\n"));
+ gdb_printf (_ ("No longer looking at any trace frame\n"));
else /* This case may never occur, check. */
- gdb_printf (_("No trace frame found\n"));
+ gdb_printf (_ ("No trace frame found\n"));
}
/* If we're in nonstop mode and getting out of looking at trace
frames, there won't be any current frame to go back to and
display. */
- if (from_tty
- && (has_stack_frames () || traceframe_number >= 0))
+ if (from_tty && (has_stack_frames () || traceframe_number >= 0))
{
enum print_what print_what;
@@ -2204,7 +2168,7 @@ void
check_trace_running (struct trace_status *status)
{
if (status->running && status->filename == NULL)
- error (_("May not look at trace frames while trace is running."));
+ error (_ ("May not look at trace frames while trace is running."));
}
/* trace_find_command takes a trace frame number n,
@@ -2228,23 +2192,23 @@ tfind_command_1 (const char *args, int from_tty)
int frameno = -1;
check_trace_running (current_trace_status ());
-
+
if (args == 0 || *args == 0)
{ /* TFIND with no args means find NEXT trace frame. */
if (traceframe_number == -1)
- frameno = 0; /* "next" is first one. */
+ frameno = 0; /* "next" is first one. */
else
frameno = traceframe_number + 1;
}
else if (0 == strcmp (args, "-"))
{
if (traceframe_number == -1)
- error (_("not debugging trace buffer"));
+ error (_ ("not debugging trace buffer"));
else if (from_tty && traceframe_number == 0)
- error (_("already at start of trace buffer"));
-
+ error (_ ("already at start of trace buffer"));
+
frameno = traceframe_number - 1;
- }
+ }
/* A hack to work around eval's need for fp to have been collected. */
else if (0 == strcmp (args, "-1"))
frameno = -1;
@@ -2252,7 +2216,7 @@ tfind_command_1 (const char *args, int from_tty)
frameno = parse_and_eval_long (args);
if (frameno < -1)
- error (_("invalid input (%d is less than zero)"), frameno);
+ error (_ ("invalid input (%d is less than zero)"), frameno);
tfind_1 (tfind_number, frameno, 0, 0, from_tty);
}
@@ -2305,9 +2269,9 @@ tfind_tracepoint_command (const char *args, int from_tty)
if (args == 0 || *args == 0)
{
if (tracepoint_number == -1)
- error (_("No current tracepoint -- please supply an argument."));
+ error (_ ("No current tracepoint -- please supply an argument."));
else
- tdp = tracepoint_number; /* Default is current TDP. */
+ tdp = tracepoint_number; /* Default is current TDP. */
}
else
tdp = parse_and_eval_long (args);
@@ -2348,15 +2312,14 @@ tfind_line_command (const char *args, int from_tty)
}
if (sal.symtab == 0)
- error (_("No line number information available."));
+ error (_ ("No line number information available."));
CORE_ADDR start_pc, end_pc;
if (sal.line > 0 && find_line_pc_range (sal, &start_pc, &end_pc))
{
if (start_pc == end_pc)
{
- gdb_printf ("Line %d of \"%s\"",
- sal.line,
+ gdb_printf ("Line %d of \"%s\"", sal.line,
symtab_to_filename_for_display (sal.symtab));
gdb_stdout->wrap_here (2);
gdb_printf (" is at address ");
@@ -2364,22 +2327,20 @@ tfind_line_command (const char *args, int from_tty)
gdb_stdout->wrap_here (2);
gdb_printf (" but contains no code.\n");
sal = find_pc_line (start_pc, 0);
- if (sal.line > 0
- && find_line_pc_range (sal, &start_pc, &end_pc)
+ if (sal.line > 0 && find_line_pc_range (sal, &start_pc, &end_pc)
&& start_pc != end_pc)
- gdb_printf ("Attempting to find line %d instead.\n",
- sal.line);
+ gdb_printf ("Attempting to find line %d instead.\n", sal.line);
else
- error (_("Cannot find a good line."));
+ error (_ ("Cannot find a good line."));
}
- }
+ }
else
{
/* Is there any case in which we get here, and have an address
which the user would want to see? If we have debugging
symbols and no line numbers? */
- error (_("Line number %d is out of range for \"%s\"."),
- sal.line, symtab_to_filename_for_display (sal.symtab));
+ error (_ ("Line number %d is out of range for \"%s\"."), sal.line,
+ symtab_to_filename_for_display (sal.symtab));
}
/* Find within range of stated line. */
@@ -2413,9 +2374,9 @@ tfind_range_command (const char *args, int from_tty)
stop = parse_and_eval_address (tmp);
}
else
- { /* No explicit end address? */
+ { /* No explicit end address? */
start = parse_and_eval_address (args);
- stop = start + 1; /* ??? */
+ stop = start + 1; /* ??? */
}
tfind_1 (tfind_range, 0, start, stop, from_tty);
@@ -2430,7 +2391,7 @@ tfind_outside_command (const char *args, int from_tty)
if (current_trace_status ()->running
&& current_trace_status ()->filename == NULL)
- error (_("May not look at trace frames while trace is running."));
+ error (_ ("May not look at trace frames while trace is running."));
if (args == 0 || *args == 0)
{ /* XXX FIXME: what should default behavior be? */
@@ -2447,9 +2408,9 @@ tfind_outside_command (const char *args, int from_tty)
stop = parse_and_eval_address (tmp);
}
else
- { /* No explicit end address? */
+ { /* No explicit end address? */
start = parse_and_eval_address (args);
- stop = start + 1; /* ??? */
+ stop = start + 1; /* ??? */
}
tfind_1 (tfind_outside, 0, start, stop, from_tty);
@@ -2471,14 +2432,12 @@ info_scope_command (const char *args_in, int from_tty)
const char *args = args_in;
if (args == 0 || *args == 0)
- error (_("requires an argument (function, "
- "line or *addr) to define a scope"));
+ error (_ ("requires an argument (function, "
+ "line or *addr) to define a scope"));
- location_spec_up locspec = string_to_location_spec (&args,
- current_language);
+ location_spec_up locspec = string_to_location_spec (&args, current_language);
std::vector<symtab_and_line> sals
- = decode_line_1 (locspec.get (), DECODE_LINE_FUNFIRSTLINE,
- NULL, NULL, 0);
+ = decode_line_1 (locspec.get (), DECODE_LINE_FUNFIRSTLINE, NULL, NULL, 0);
if (sals.empty ())
{
/* Presumably decode_line_1 has already warned. */
@@ -2491,17 +2450,17 @@ info_scope_command (const char *args_in, int from_tty)
while (block != 0)
{
- QUIT; /* Allow user to bail out with ^C. */
+ QUIT; /* Allow user to bail out with ^C. */
ALL_BLOCK_SYMBOLS (block, iter, sym)
{
- QUIT; /* Allow user to bail out with ^C. */
+ QUIT; /* Allow user to bail out with ^C. */
if (count == 0)
gdb_printf ("Scope for %s:\n", save_args);
count++;
symname = sym->print_name ();
if (symname == NULL || *symname == '\0')
- continue; /* Probably botched, certainly useless. */
+ continue; /* Probably botched, certainly useless. */
gdbarch = sym->arch ();
@@ -2516,10 +2475,9 @@ info_scope_command (const char *args_in, int from_tty)
switch (sym->aclass ())
{
default:
- case LOC_UNDEF: /* Messed up symbol? */
- gdb_printf ("a bogus symbol, class %d.\n",
- sym->aclass ());
- count--; /* Don't count this one. */
+ case LOC_UNDEF: /* Messed up symbol? */
+ gdb_printf ("a bogus symbol, class %d.\n", sym->aclass ());
+ count--; /* Don't count this one. */
continue;
case LOC_CONST:
gdb_printf ("a constant with value %s (%s)",
@@ -2587,8 +2545,8 @@ info_scope_command (const char *args_in, int from_tty)
sym->value_block ()->entry_pc ()));
break;
case LOC_UNRESOLVED:
- msym = lookup_minimal_symbol (sym->linkage_name (),
- NULL, NULL);
+ msym
+ = lookup_minimal_symbol (sym->linkage_name (), NULL, NULL);
if (msym.minsym == NULL)
gdb_printf ("Unresolved Static");
else
@@ -2602,7 +2560,8 @@ info_scope_command (const char *args_in, int from_tty)
gdb_printf ("optimized out.\n");
continue;
case LOC_COMPUTED:
- gdb_assert_not_reached ("LOC_COMPUTED variable missing a method");
+ gdb_assert_not_reached (
+ "LOC_COMPUTED variable missing a method");
}
}
if (sym->type ())
@@ -2618,8 +2577,7 @@ info_scope_command (const char *args_in, int from_tty)
block = block->superblock ();
}
if (count <= 0)
- gdb_printf ("Scope for %s contains no locals or arguments.\n",
- save_args);
+ gdb_printf ("Scope for %s contains no locals or arguments.\n", save_args);
}
/* Helper for trace_dump_command. Dump the action list starting at
@@ -2629,9 +2587,8 @@ info_scope_command (const char *args_in, int from_tty)
traceframe. */
static void
-trace_dump_actions (struct command_line *action,
- int stepping_actions, int stepping_frame,
- int from_tty)
+trace_dump_actions (struct command_line *action, int stepping_actions,
+ int stepping_frame, int from_tty)
{
const char *action_exp, *next_comma;
@@ -2639,25 +2596,25 @@ trace_dump_actions (struct command_line *action,
{
struct cmd_list_element *cmd;
- QUIT; /* Allow user to bail out with ^C. */
+ QUIT; /* Allow user to bail out with ^C. */
action_exp = action->line;
action_exp = skip_spaces (action_exp);
/* The collection actions to be done while stepping are
bracketed by the commands "while-stepping" and "end". */
- if (*action_exp == '#') /* comment line */
+ if (*action_exp == '#') /* comment line */
continue;
cmd = lookup_cmd (&action_exp, cmdlist, "", NULL, -1, 1);
if (cmd == 0)
- error (_("Bad action list item: %s"), action_exp);
+ error (_ ("Bad action list item: %s"), action_exp);
if (cmd_simple_func_eq (cmd, while_stepping_pseudocommand))
{
gdb_assert (action->body_list_1 == nullptr);
- trace_dump_actions (action->body_list_0.get (),
- 1, stepping_frame, from_tty);
+ trace_dump_actions (action->body_list_0.get (), 1, stepping_frame,
+ from_tty);
}
else if (cmd_simple_func_eq (cmd, collect_pseudocommand))
{
@@ -2675,8 +2632,8 @@ trace_dump_actions (struct command_line *action,
action_exp = decode_agent_options (action_exp, &trace_string);
do
- { /* Repeat over a comma-separated list. */
- QUIT; /* Allow user to bail out with ^C. */
+ { /* Repeat over a comma-separated list. */
+ QUIT; /* Allow user to bail out with ^C. */
if (*action_exp == ',')
action_exp++;
action_exp = skip_spaces (action_exp);
@@ -2692,7 +2649,7 @@ trace_dump_actions (struct command_line *action,
else if (0 == strncasecmp (action_exp, "$arg", 4))
info_args_command (NULL, from_tty);
else
- { /* variable */
+ { /* variable */
std::string contents;
const char *exp = action_exp;
if (next_comma != NULL)
@@ -2725,12 +2682,12 @@ get_traceframe_location (int *stepping_frame_p)
struct regcache *regcache;
if (tracepoint_number == -1)
- error (_("No current trace frame."));
+ error (_ ("No current trace frame."));
t = get_tracepoint (tracepoint_number);
if (t == NULL)
- error (_("No known tracepoint matches 'current' tracepoint #%d."),
+ error (_ ("No known tracepoint matches 'current' tracepoint #%d."),
tracepoint_number);
/* The current frame is a trap frame if the frame PC is equal to the
@@ -2814,17 +2771,15 @@ tdump_command (const char *args, int from_tty)
return an offset to the next piece to encode. FIXME */
int
-encode_source_string (int tpnum, ULONGEST addr,
- const char *srctype, const char *src,
- char *buf, int buf_size)
+encode_source_string (int tpnum, ULONGEST addr, const char *srctype,
+ const char *src, char *buf, int buf_size)
{
if (80 + strlen (srctype) > buf_size)
- error (_("Buffer too small for source encoding"));
- sprintf (buf, "%x:%s:%s:%x:%x:",
- tpnum, phex_nz (addr, sizeof (addr)),
+ error (_ ("Buffer too small for source encoding"));
+ sprintf (buf, "%x:%s:%s:%x:%x:", tpnum, phex_nz (addr, sizeof (addr)),
srctype, 0, (int) strlen (src));
if (strlen (buf) + strlen (src) * 2 >= buf_size)
- error (_("Source string too long for buffer"));
+ error (_ ("Source string too long for buffer"));
bin2hex ((gdb_byte *) src, buf + strlen (buf), strlen (src));
return -1;
}
@@ -2848,33 +2803,31 @@ set_circular_trace_buffer (const char *args, int from_tty,
static void
set_trace_buffer_size (const char *args, int from_tty,
- struct cmd_list_element *c)
+ struct cmd_list_element *c)
{
target_set_trace_buffer_size (trace_buffer_size);
}
static void
-set_trace_user (const char *args, int from_tty,
- struct cmd_list_element *c)
+set_trace_user (const char *args, int from_tty, struct cmd_list_element *c)
{
int ret;
ret = target_set_trace_notes (trace_user.c_str (), NULL, NULL);
if (!ret)
- warning (_("Target does not support trace notes, user ignored"));
+ warning (_ ("Target does not support trace notes, user ignored"));
}
static void
-set_trace_notes (const char *args, int from_tty,
- struct cmd_list_element *c)
+set_trace_notes (const char *args, int from_tty, struct cmd_list_element *c)
{
int ret;
ret = target_set_trace_notes (NULL, trace_notes.c_str (), NULL);
if (!ret)
- warning (_("Target does not support trace notes, note ignored"));
+ warning (_ ("Target does not support trace notes, note ignored"));
}
static void
@@ -2886,7 +2839,7 @@ set_trace_stop_notes (const char *args, int from_tty,
ret = target_set_trace_notes (NULL, NULL, trace_stop_notes.c_str ());
if (!ret)
- warning (_("Target does not support trace notes, stop note ignored"));
+ warning (_ ("Target does not support trace notes, stop note ignored"));
}
/* Convert the memory pointed to by mem into hex, placing result in buf.
@@ -2943,7 +2896,7 @@ set_current_traceframe (int num)
newnum = target_trace_find (tfind_number, num, 0, 0, NULL);
if (newnum != num)
- warning (_("could not change traceframe"));
+ warning (_ ("could not change traceframe"));
set_traceframe_num (newnum);
@@ -2955,8 +2908,9 @@ set_current_traceframe (int num)
}
scoped_restore_current_traceframe::scoped_restore_current_traceframe ()
-: m_traceframe_number (traceframe_number)
-{}
+ : m_traceframe_number (traceframe_number)
+{
+}
/* Given a number and address, return an uploaded tracepoint with that
number, creating if necessary. */
@@ -3052,13 +3006,12 @@ find_matching_tracepoint_location (struct uploaded_tp *utp)
{
struct tracepoint *t = (struct tracepoint *) b;
- if (b->type == utp->type
- && t->step_count == utp->step
+ if (b->type == utp->type && t->step_count == utp->step
&& t->pass_count == utp->pass
&& cond_string_is_same (t->cond_string.get (),
utp->cond_string.get ())
/* FIXME also test actions. */
- )
+ )
{
/* Scan the locations for an address match. */
for (loc = b->loc; loc; loc = loc->next)
@@ -3096,8 +3049,8 @@ merge_uploaded_tracepoints (struct uploaded_tp **uploaded_tps)
/* Mark this location as already inserted. */
loc->inserted = 1;
t = (struct tracepoint *) loc->owner;
- gdb_printf (_("Assuming tracepoint %d is same "
- "as target's tracepoint %d at %s.\n"),
+ gdb_printf (_ ("Assuming tracepoint %d is same "
+ "as target's tracepoint %d at %s.\n"),
loc->owner->number, utp->number,
paddress (loc->gdbarch, utp->addr));
@@ -3119,13 +3072,13 @@ merge_uploaded_tracepoints (struct uploaded_tp **uploaded_tps)
{
t = create_tracepoint_from_upload (utp);
if (t)
- gdb_printf (_("Created tracepoint %d for "
- "target's tracepoint %d at %s.\n"),
+ gdb_printf (_ ("Created tracepoint %d for "
+ "target's tracepoint %d at %s.\n"),
t->number, utp->number,
paddress (get_current_arch (), utp->addr));
else
- gdb_printf (_("Failed to create tracepoint for target's "
- "tracepoint %d at %s, skipping it.\n"),
+ gdb_printf (_ ("Failed to create tracepoint for target's "
+ "tracepoint %d at %s, skipping it.\n"),
utp->number,
paddress (get_current_arch (), utp->addr));
}
@@ -3210,16 +3163,16 @@ merge_uploaded_trace_state_variables (struct uploaded_tsv **uploaded_tsvs)
if (tsv)
{
if (info_verbose)
- gdb_printf (_("Assuming trace state variable $%s "
- "is same as target's variable %d.\n"),
+ gdb_printf (_ ("Assuming trace state variable $%s "
+ "is same as target's variable %d.\n"),
tsv->name.c_str (), utsv->number);
}
else
{
tsv = create_tsv_from_upload (utsv);
if (info_verbose)
- gdb_printf (_("Created trace state variable "
- "$%s for target's variable %d.\n"),
+ gdb_printf (_ ("Created trace state variable "
+ "$%s for target's variable %d.\n"),
tsv->name.c_str (), utsv->number);
}
/* Give precedence to numberings that come from the target. */
@@ -3271,8 +3224,9 @@ parse_trace_status (const char *line, struct trace_status *ts)
{
p1 = strchr (p, ':');
if (p1 == NULL)
- error (_("Malformed trace status, at %s\n\
-Status line: '%s'\n"), p, line);
+ error (_ ("Malformed trace status, at %s\n\
+Status line: '%s'\n"),
+ p, line);
p3 = strchr (p, ';');
if (p3 == NULL)
p3 = p + strlen (p);
@@ -3286,8 +3240,8 @@ Status line: '%s'\n"), p, line);
p = unpack_varlen_hex (++p1, &val);
ts->stop_reason = trace_never_run;
}
- else if (strncmp (p, stop_reason_names[tracepoint_passcount],
- p1 - p) == 0)
+ else if (strncmp (p, stop_reason_names[tracepoint_passcount], p1 - p)
+ == 0)
{
p = unpack_varlen_hex (++p1, &val);
ts->stop_reason = tracepoint_passcount;
@@ -3378,7 +3332,7 @@ Status line: '%s'\n"), p, line);
{
++p1;
ts->user_name = (char *) xmalloc (strlen (p) / 2);
- end = hex2bin (p1, (gdb_byte *) ts->user_name, (p3 - p1) / 2);
+ end = hex2bin (p1, (gdb_byte *) ts->user_name, (p3 - p1) / 2);
ts->user_name[end] = '\0';
p = p3;
}
@@ -3443,23 +3397,23 @@ parse_tracepoint_definition (const char *line, struct uploaded_tp **utpp)
and address sequence. */
piece = *p++;
p = unpack_varlen_hex (p, &num);
- p++; /* skip a colon */
+ p++; /* skip a colon */
p = unpack_varlen_hex (p, &addr);
- p++; /* skip a colon */
+ p++; /* skip a colon */
if (piece == 'T')
{
gdb::unique_xmalloc_ptr<char[]> cond;
enabled = (*p++ == 'E');
- p++; /* skip a colon */
+ p++; /* skip a colon */
p = unpack_varlen_hex (p, &step);
- p++; /* skip a colon */
+ p++; /* skip a colon */
p = unpack_varlen_hex (p, &pass);
type = bp_tracepoint;
/* Thumb through optional fields. */
while (*p == ':')
{
- p++; /* skip a colon */
+ p++; /* skip a colon */
if (*p == 'F')
{
type = bp_fast_tracepoint;
@@ -3475,15 +3429,16 @@ parse_tracepoint_definition (const char *line, struct uploaded_tp **utpp)
{
p++;
p = unpack_varlen_hex (p, &xlen);
- p++; /* skip a comma */
+ p++; /* skip a comma */
cond.reset ((char *) xmalloc (2 * xlen + 1));
strncpy (&cond[0], p, 2 * xlen);
cond[2 * xlen] = '\0';
p += 2 * xlen;
}
else
- warning (_("Unrecognized char '%c' in tracepoint "
- "definition, skipping rest"), *p);
+ warning (_ ("Unrecognized char '%c' in tracepoint "
+ "definition, skipping rest"),
+ *p);
}
utp = get_uploaded_tp (num, addr, utpp);
utp->type = type;
@@ -3508,11 +3463,11 @@ parse_tracepoint_definition (const char *line, struct uploaded_tp **utpp)
utp = get_uploaded_tp (num, addr, utpp);
srctype = p;
p = strchr (p, ':');
- p++; /* skip a colon */
+ p++; /* skip a colon */
p = unpack_varlen_hex (p, &start);
- p++; /* skip a colon */
+ p++; /* skip a colon */
p = unpack_varlen_hex (p, &xlen);
- p++; /* skip a colon */
+ p++; /* skip a colon */
buf = (char *) alloca (strlen (line));
@@ -3536,7 +3491,7 @@ parse_tracepoint_definition (const char *line, struct uploaded_tp **utpp)
{
/* Don't error out, the target might be sending us optional
info that we don't care about. */
- warning (_("Unrecognized tracepoint piece '%c', ignoring"), piece);
+ warning (_ ("Unrecognized tracepoint piece '%c', ignoring"), piece);
}
}
@@ -3584,14 +3539,14 @@ parse_static_tracepoint_marker_definition (const char *line, const char **pp,
p = line;
p = unpack_varlen_hex (p, &addr);
- p++; /* skip a colon */
+ p++; /* skip a colon */
marker->gdbarch = target_gdbarch ();
marker->address = (CORE_ADDR) addr;
endp = strchr (p, ':');
if (endp == NULL)
- error (_("bad marker definition: %s"), line);
+ error (_ ("bad marker definition: %s"), line);
marker->str_id = hex2str (p, (endp - p) / 2);
@@ -3636,8 +3591,7 @@ print_one_static_tracepoint_marker (int count,
uiout->field_string ("marker-id", marker.str_id);
- uiout->field_fmt ("enabled", "%c",
- !tracepoints.empty () ? 'y' : 'n');
+ uiout->field_fmt ("enabled", "%c", !tracepoints.empty () ? 'y' : 'n');
uiout->spaces (2);
int wrap_indent = 35;
@@ -3665,8 +3619,7 @@ print_one_static_tracepoint_marker (int count,
if (sal.symtab != NULL)
{
- uiout->field_string ("file",
- symtab_to_filename_for_display (sal.symtab),
+ uiout->field_string ("file", symtab_to_filename_for_display (sal.symtab),
file_name_style.style ());
uiout->text (":");
@@ -3689,7 +3642,7 @@ print_one_static_tracepoint_marker (int count,
uiout->text ("\n");
uiout->text (extra_field_indent);
- uiout->text (_("Data: \""));
+ uiout->text (_ ("Data: \""));
uiout->field_string ("extra-data", marker.extra);
uiout->text ("\"\n");
@@ -3701,7 +3654,7 @@ print_one_static_tracepoint_marker (int count,
ui_out_emit_tuple inner_tuple_emitter (uiout, "tracepoints-at");
uiout->text (extra_field_indent);
- uiout->text (_("Probed by static tracepoints: "));
+ uiout->text (_ ("Probed by static tracepoints: "));
for (ix = 0; ix < tracepoints.size (); ix++)
{
if (ix > 0)
@@ -3768,8 +3721,7 @@ sdata_make_value (struct gdbarch *gdbarch, struct internalvar *var,
/* We need to read the whole object before we know its size. */
gdb::optional<gdb::byte_vector> buf
= target_read_alloc (current_inferior ()->top_target (),
- TARGET_OBJECT_STATIC_TRACE_DATA,
- NULL);
+ TARGET_OBJECT_STATIC_TRACE_DATA, NULL);
if (buf)
{
struct value *v;
@@ -3795,8 +3747,8 @@ parse_traceframe_info (const char *tframe_info)
if (!have_warned)
{
have_warned = 1;
- warning (_("Can not parse XML trace frame info; XML support "
- "was disabled at compile time"));
+ warning (_ ("Can not parse XML trace frame info; XML support "
+ "was disabled at compile time"));
}
return NULL;
@@ -3829,9 +3781,9 @@ traceframe_info_start_memory (struct gdb_xml_parser *parser,
static void
traceframe_info_start_tvar (struct gdb_xml_parser *parser,
- const struct gdb_xml_element *element,
- void *user_data,
- std::vector<gdb_xml_value> &attributes)
+ const struct gdb_xml_element *element,
+ void *user_data,
+ std::vector<gdb_xml_value> &attributes)
{
struct traceframe_info *info = (struct traceframe_info *) user_data;
const char *id_attrib
@@ -3843,32 +3795,28 @@ traceframe_info_start_tvar (struct gdb_xml_parser *parser,
/* The allowed elements and attributes for an XML memory map. */
-static const struct gdb_xml_attribute memory_attributes[] = {
- { "start", GDB_XML_AF_NONE, gdb_xml_parse_attr_ulongest, NULL },
- { "length", GDB_XML_AF_NONE, gdb_xml_parse_attr_ulongest, NULL },
- { NULL, GDB_XML_AF_NONE, NULL, NULL }
-};
-
-static const struct gdb_xml_attribute tvar_attributes[] = {
- { "id", GDB_XML_AF_NONE, NULL, NULL },
- { NULL, GDB_XML_AF_NONE, NULL, NULL }
-};
-
-static const struct gdb_xml_element traceframe_info_children[] = {
- { "memory", memory_attributes, NULL,
- GDB_XML_EF_REPEATABLE | GDB_XML_EF_OPTIONAL,
- traceframe_info_start_memory, NULL },
- { "tvar", tvar_attributes, NULL,
- GDB_XML_EF_REPEATABLE | GDB_XML_EF_OPTIONAL,
- traceframe_info_start_tvar, NULL },
- { NULL, NULL, NULL, GDB_XML_EF_NONE, NULL, NULL }
-};
-
-static const struct gdb_xml_element traceframe_info_elements[] = {
- { "traceframe-info", NULL, traceframe_info_children, GDB_XML_EF_NONE,
- NULL, NULL },
- { NULL, NULL, NULL, GDB_XML_EF_NONE, NULL, NULL }
-};
+static const struct gdb_xml_attribute memory_attributes[]
+ = { { "start", GDB_XML_AF_NONE, gdb_xml_parse_attr_ulongest, NULL },
+ { "length", GDB_XML_AF_NONE, gdb_xml_parse_attr_ulongest, NULL },
+ { NULL, GDB_XML_AF_NONE, NULL, NULL } };
+
+static const struct gdb_xml_attribute tvar_attributes[]
+ = { { "id", GDB_XML_AF_NONE, NULL, NULL },
+ { NULL, GDB_XML_AF_NONE, NULL, NULL } };
+
+static const struct gdb_xml_element traceframe_info_children[]
+ = { { "memory", memory_attributes, NULL,
+ GDB_XML_EF_REPEATABLE | GDB_XML_EF_OPTIONAL,
+ traceframe_info_start_memory, NULL },
+ { "tvar", tvar_attributes, NULL,
+ GDB_XML_EF_REPEATABLE | GDB_XML_EF_OPTIONAL,
+ traceframe_info_start_tvar, NULL },
+ { NULL, NULL, NULL, GDB_XML_EF_NONE, NULL, NULL } };
+
+static const struct gdb_xml_element traceframe_info_elements[]
+ = { { "traceframe-info", NULL, traceframe_info_children, GDB_XML_EF_NONE,
+ NULL, NULL },
+ { NULL, NULL, NULL, GDB_XML_EF_NONE, NULL, NULL } };
/* Parse a traceframe-info XML document. */
@@ -3877,9 +3825,10 @@ parse_traceframe_info (const char *tframe_info)
{
traceframe_info_up result (new traceframe_info);
- if (gdb_xml_parse_quick (_("trace frame info"),
- "traceframe-info.dtd", traceframe_info_elements,
- tframe_info, result.get ()) == 0)
+ if (gdb_xml_parse_quick (_ ("trace frame info"), "traceframe-info.dtd",
+ traceframe_info_elements, tframe_info,
+ result.get ())
+ == 0)
return result;
return NULL;
@@ -3907,8 +3856,8 @@ get_traceframe_info (void)
undefined. */
int
-traceframe_available_memory (std::vector<mem_range> *result,
- CORE_ADDR memaddr, ULONGEST len)
+traceframe_available_memory (std::vector<mem_range> *result, CORE_ADDR memaddr,
+ ULONGEST len)
{
struct traceframe_info *info = get_traceframe_info ();
@@ -3942,17 +3891,14 @@ traceframe_available_memory (std::vector<mem_range> *result,
/* Implementation of `sdata' variable. */
-static const struct internalvar_funcs sdata_funcs =
-{
- sdata_make_value,
- NULL
-};
+static const struct internalvar_funcs sdata_funcs = { sdata_make_value, NULL };
/* See tracepoint.h. */
cmd_list_element *while_stepping_cmd_element = nullptr;
/* module initialization */
void _initialize_tracepoint ();
+
void
_initialize_tracepoint ()
{
@@ -3968,93 +3914,95 @@ _initialize_tracepoint ()
tracepoint_number = -1;
add_info ("scope", info_scope_command,
- _("List the variables local to a scope."));
+ _ ("List the variables local to a scope."));
add_cmd ("tracepoints", class_trace,
- _("Tracing of program execution without stopping the program."),
+ _ ("Tracing of program execution without stopping the program."),
&cmdlist);
add_com ("tdump", class_trace, tdump_command,
- _("Print everything collected at the current tracepoint."));
+ _ ("Print everything collected at the current tracepoint."));
- c = add_com ("tvariable", class_trace, trace_variable_command,_("\
+ c = add_com ("tvariable", class_trace, trace_variable_command, _ ("\
Define a trace state variable.\n\
Argument is a $-prefixed name, optionally followed\n\
by '=' and an expression that sets the initial value\n\
at the start of tracing."));
set_cmd_completer (c, expression_completer);
- add_cmd ("tvariable", class_trace, delete_trace_variable_command, _("\
+ add_cmd ("tvariable", class_trace, delete_trace_variable_command, _ ("\
Delete one or more trace state variables.\n\
Arguments are the names of the variables to delete.\n\
-If no arguments are supplied, delete all variables."), &deletelist);
+If no arguments are supplied, delete all variables."),
+ &deletelist);
/* FIXME add a trace variable completer. */
- add_info ("tvariables", info_tvariables_command, _("\
+ add_info ("tvariables", info_tvariables_command, _ ("\
Status of trace state variables and their values."));
add_info ("static-tracepoint-markers",
- info_static_tracepoint_markers_command, _("\
+ info_static_tracepoint_markers_command, _ ("\
List target static tracepoints markers."));
- add_prefix_cmd ("tfind", class_trace, tfind_command, _("\
+ add_prefix_cmd ("tfind", class_trace, tfind_command, _ ("\
Select a trace frame.\n\
No argument means forward by one frame; '-' means backward by one frame."),
&tfindlist, 1, &cmdlist);
- add_cmd ("outside", class_trace, tfind_outside_command, _("\
+ add_cmd ("outside", class_trace, tfind_outside_command, _ ("\
Select a trace frame whose PC is outside the given range (exclusive).\n\
Usage: tfind outside ADDR1, ADDR2"),
&tfindlist);
- add_cmd ("range", class_trace, tfind_range_command, _("\
+ add_cmd ("range", class_trace, tfind_range_command, _ ("\
Select a trace frame whose PC is in the given range (inclusive).\n\
Usage: tfind range ADDR1, ADDR2"),
&tfindlist);
- add_cmd ("line", class_trace, tfind_line_command, _("\
+ add_cmd ("line", class_trace, tfind_line_command, _ ("\
Select a trace frame by source line.\n\
Argument can be a line number (with optional source file),\n\
a function name, or '*' followed by an address.\n\
Default argument is 'the next source line that was traced'."),
&tfindlist);
- add_cmd ("tracepoint", class_trace, tfind_tracepoint_command, _("\
+ add_cmd ("tracepoint", class_trace, tfind_tracepoint_command, _ ("\
Select a trace frame by tracepoint number.\n\
Default is the tracepoint for the current trace frame."),
&tfindlist);
- add_cmd ("pc", class_trace, tfind_pc_command, _("\
+ add_cmd ("pc", class_trace, tfind_pc_command, _ ("\
Select a trace frame by PC.\n\
Default is the current PC, or the PC of the current trace frame."),
&tfindlist);
cmd_list_element *tfind_end_cmd
- = add_cmd ("end", class_trace, tfind_end_command, _("\
-De-select any trace frame and resume 'live' debugging."), &tfindlist);
+ = add_cmd ("end", class_trace, tfind_end_command, _ ("\
+De-select any trace frame and resume 'live' debugging."),
+ &tfindlist);
add_alias_cmd ("none", tfind_end_cmd, class_trace, 0, &tfindlist);
add_cmd ("start", class_trace, tfind_start_command,
- _("Select the first trace frame in the trace buffer."),
+ _ ("Select the first trace frame in the trace buffer."),
&tfindlist);
add_com ("tstatus", class_trace, tstatus_command,
- _("Display the status of the current trace data collection."));
+ _ ("Display the status of the current trace data collection."));
- add_com ("tstop", class_trace, tstop_command, _("\
+ add_com ("tstop", class_trace, tstop_command, _ ("\
Stop trace data collection.\n\
Usage: tstop [NOTES]...\n\
Any arguments supplied are recorded with the trace as a stop reason and\n\
reported by tstatus (if the target supports trace notes)."));
- add_com ("tstart", class_trace, tstart_command, _("\
+ add_com ("tstart", class_trace, tstart_command, _ ("\
Start trace data collection.\n\
Usage: tstart [NOTES]...\n\
Any arguments supplied are recorded with the trace as a note and\n\
reported by tstatus (if the target supports trace notes)."));
- add_com ("end", class_trace, end_actions_pseudocommand, _("\
+ add_com ("end", class_trace, end_actions_pseudocommand, _ ("\
Ends a list of commands or actions.\n\
Several GDB commands allow you to enter a list of commands or actions.\n\
Entering \"end\" on a line by itself is the normal way to terminate\n\
@@ -4062,7 +4010,7 @@ such a list.\n\n\
Note: the \"end\" command cannot be used at the gdb prompt."));
while_stepping_cmd_element = add_com ("while-stepping", class_trace,
- while_stepping_pseudocommand, _("\
+ while_stepping_pseudocommand, _ ("\
Specify single-stepping behavior at a tracepoint.\n\
Argument is number of instructions to trace in single-step mode\n\
following the tracepoint. This command is normally followed by\n\
@@ -4073,7 +4021,7 @@ Note: this command can only be used in a tracepoint \"actions\" list."));
add_com_alias ("ws", while_stepping_cmd_element, class_trace, 0);
add_com_alias ("stepping", while_stepping_cmd_element, class_trace, 0);
- add_com ("collect", class_trace, collect_pseudocommand, _("\
+ add_com ("collect", class_trace, collect_pseudocommand, _ ("\
Specify one or more data items to be collected at a tracepoint.\n\
Accepts a comma-separated list of (one or more) expressions. GDB will\n\
collect all data (variables, registers) referenced by that expression.\n\
@@ -4084,77 +4032,78 @@ Also accepts the following special arguments:\n\
$_sdata -- static tracepoint data (ignored for non-static tracepoints).\n\
Note: this command can only be used in a tracepoint \"actions\" list."));
- add_com ("teval", class_trace, teval_pseudocommand, _("\
+ add_com ("teval", class_trace, teval_pseudocommand, _ ("\
Specify one or more expressions to be evaluated at a tracepoint.\n\
Accepts a comma-separated list of (one or more) expressions.\n\
The result of each evaluation will be discarded.\n\
Note: this command can only be used in a tracepoint \"actions\" list."));
- add_com ("actions", class_trace, actions_command, _("\
+ add_com ("actions", class_trace, actions_command, _ ("\
Specify the actions to be taken at a tracepoint.\n\
Tracepoint actions may include collecting of specified data,\n\
single-stepping, or enabling/disabling other tracepoints,\n\
depending on target's capabilities."));
- add_setshow_string_cmd ("default-collect", class_trace,
- &default_collect, _("\
-Set the list of expressions to collect by default."), _("\
-Show the list of expressions to collect by default."), NULL,
- NULL, NULL,
- &setlist, &showlist);
+ add_setshow_string_cmd ("default-collect", class_trace, &default_collect,
+ _ ("\
+Set the list of expressions to collect by default."),
+ _ ("\
+Show the list of expressions to collect by default."),
+ NULL, NULL, NULL, &setlist, &showlist);
add_setshow_boolean_cmd ("disconnected-tracing", no_class,
- &disconnected_tracing, _("\
-Set whether tracing continues after GDB disconnects."), _("\
-Show whether tracing continues after GDB disconnects."), _("\
+ &disconnected_tracing, _ ("\
+Set whether tracing continues after GDB disconnects."),
+ _ ("\
+Show whether tracing continues after GDB disconnects."),
+ _ ("\
Use this to continue a tracing run even if GDB disconnects\n\
or detaches from the target. You can reconnect later and look at\n\
trace data collected in the meantime."),
- set_disconnected_tracing,
- NULL,
- &setlist,
+ set_disconnected_tracing, NULL, &setlist,
&showlist);
add_setshow_boolean_cmd ("circular-trace-buffer", no_class,
- &circular_trace_buffer, _("\
-Set target's use of circular trace buffer."), _("\
-Show target's use of circular trace buffer."), _("\
+ &circular_trace_buffer, _ ("\
+Set target's use of circular trace buffer."),
+ _ ("\
+Show target's use of circular trace buffer."),
+ _ ("\
Use this to make the trace buffer into a circular buffer,\n\
which will discard traceframes (oldest first) instead of filling\n\
up and stopping the trace run."),
- set_circular_trace_buffer,
- NULL,
- &setlist,
+ set_circular_trace_buffer, NULL, &setlist,
&showlist);
add_setshow_zuinteger_unlimited_cmd ("trace-buffer-size", no_class,
- &trace_buffer_size, _("\
-Set requested size of trace buffer."), _("\
-Show requested size of trace buffer."), _("\
+ &trace_buffer_size, _ ("\
+Set requested size of trace buffer."),
+ _ ("\
+Show requested size of trace buffer."),
+ _ ("\
Use this to choose a size for the trace buffer. Some targets\n\
may have fixed or limited buffer sizes. Specifying \"unlimited\" or -1\n\
disables any attempt to set the buffer size and lets the target choose."),
- set_trace_buffer_size, NULL,
- &setlist, &showlist);
-
- add_setshow_string_cmd ("trace-user", class_trace,
- &trace_user, _("\
-Set the user name to use for current and future trace runs."), _("\
-Show the user name to use for current and future trace runs."), NULL,
- set_trace_user, NULL,
- &setlist, &showlist);
-
- add_setshow_string_cmd ("trace-notes", class_trace,
- &trace_notes, _("\
-Set notes string to use for current and future trace runs."), _("\
-Show the notes string to use for current and future trace runs."), NULL,
- set_trace_notes, NULL,
- &setlist, &showlist);
-
- add_setshow_string_cmd ("trace-stop-notes", class_trace,
- &trace_stop_notes, _("\
-Set notes string to use for future tstop commands."), _("\
-Show the notes string to use for future tstop commands."), NULL,
- set_trace_stop_notes, NULL,
- &setlist, &showlist);
+ set_trace_buffer_size, NULL, &setlist,
+ &showlist);
+
+ add_setshow_string_cmd ("trace-user", class_trace, &trace_user, _ ("\
+Set the user name to use for current and future trace runs."),
+ _ ("\
+Show the user name to use for current and future trace runs."),
+ NULL, set_trace_user, NULL, &setlist, &showlist);
+
+ add_setshow_string_cmd ("trace-notes", class_trace, &trace_notes, _ ("\
+Set notes string to use for current and future trace runs."),
+ _ ("\
+Show the notes string to use for current and future trace runs."),
+ NULL, set_trace_notes, NULL, &setlist, &showlist);
+
+ add_setshow_string_cmd ("trace-stop-notes", class_trace, &trace_stop_notes,
+ _ ("\
+Set notes string to use for future tstop commands."),
+ _ ("\
+Show the notes string to use for future tstop commands."),
+ NULL, set_trace_stop_notes, NULL, &setlist,
+ &showlist);
}
diff --git a/gdb/tracepoint.h b/gdb/tracepoint.h
index a637d6b71d3..7bcae7dd3e8 100644
--- a/gdb/tracepoint.h
+++ b/gdb/tracepoint.h
@@ -16,7 +16,7 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
-#if !defined (TRACEPOINT_H)
+#if !defined(TRACEPOINT_H)
#define TRACEPOINT_H 1
#include "breakpoint.h"
@@ -49,8 +49,10 @@ typedef std::unique_ptr<traceframe_info> traceframe_info_up;
struct trace_state_variable
{
trace_state_variable (std::string &&name_, int number_)
- : name (name_), number (number_)
- {}
+ : name (name_),
+ number (number_)
+ {
+ }
/* The variable's name. The user has to prefix with a dollar sign,
but we don't store that internally. */
@@ -73,21 +75,21 @@ struct trace_state_variable
/* This is true for variables that are predefined and built into
the target. */
int builtin = 0;
- };
+};
/* The trace status encompasses various info about the general state
of the tracing run. */
enum trace_stop_reason
- {
- trace_stop_reason_unknown,
- trace_never_run,
- trace_stop_command,
- trace_buffer_full,
- trace_disconnected,
- tracepoint_passcount,
- tracepoint_error
- };
+{
+ trace_stop_reason_unknown,
+ trace_never_run,
+ trace_stop_command,
+ trace_buffer_full,
+ trace_disconnected,
+ tracepoint_passcount,
+ tracepoint_error
+};
struct trace_status
{
@@ -237,11 +239,13 @@ struct static_tracepoint_marker
struct memrange
{
memrange (int type_, bfd_signed_vma start_, bfd_signed_vma end_)
- : type (type_), start (start_), end (end_)
- {}
+ : type (type_),
+ start (start_),
+ end (end_)
+ {
+ }
- memrange ()
- {}
+ memrange () {}
/* memrange_absolute for absolute memory range, else basereg
number. */
@@ -253,6 +257,7 @@ struct memrange
class collection_list
{
public:
+
collection_list ();
void add_wholly_collected (const char *print_name);
@@ -264,16 +269,12 @@ public:
void add_remote_register (unsigned int regno);
void add_ax_registers (struct agent_expr *aexpr);
- void add_local_register (struct gdbarch *gdbarch,
- unsigned int regno,
+ void add_local_register (struct gdbarch *gdbarch, unsigned int regno,
CORE_ADDR scope);
- void add_memrange (struct gdbarch *gdbarch,
- int type, bfd_signed_vma base,
+ void add_memrange (struct gdbarch *gdbarch, int type, bfd_signed_vma base,
unsigned long len, CORE_ADDR scope);
- void collect_symbol (struct symbol *sym,
- struct gdbarch *gdbarch,
- long frame_regno, long frame_offset,
- CORE_ADDR scope,
+ void collect_symbol (struct symbol *sym, struct gdbarch *gdbarch,
+ long frame_regno, long frame_offset, CORE_ADDR scope,
int trace_string);
void add_local_symbols (struct gdbarch *gdbarch, CORE_ADDR pc,
@@ -286,12 +287,14 @@ public:
std::vector<std::string> stringify ();
const std::vector<std::string> &wholly_collected ()
- { return m_wholly_collected; }
+ {
+ return m_wholly_collected;
+ }
- const std::vector<std::string> &computed ()
- { return m_computed; }
+ const std::vector<std::string> &computed () { return m_computed; }
private:
+
/* We need the allocator zero-initialize the mask, so we don't use
gdb::byte_vector. */
std::vector<unsigned char> m_regs_mask;
@@ -311,8 +314,8 @@ private:
};
extern void
- parse_static_tracepoint_marker_definition (const char *line, const char **pp,
- static_tracepoint_marker *marker);
+parse_static_tracepoint_marker_definition (const char *line, const char **pp,
+ static_tracepoint_marker *marker);
/* Returns the current traceframe number. */
extern int get_traceframe_number (void);
@@ -357,15 +360,16 @@ extern void encode_actions_rsp (struct bp_location *tloc,
extern void validate_actionline (const char *, struct breakpoint *);
extern void validate_trace_state_variable_name (const char *name);
-extern struct trace_state_variable *find_trace_state_variable (const char *name);
extern struct trace_state_variable *
- find_trace_state_variable_by_number (int number);
+find_trace_state_variable (const char *name);
+extern struct trace_state_variable *
+find_trace_state_variable_by_number (int number);
-extern struct trace_state_variable *create_trace_state_variable (const char *name);
+extern struct trace_state_variable *
+create_trace_state_variable (const char *name);
-extern int encode_source_string (int num, ULONGEST addr,
- const char *srctype, const char *src,
- char *buf, int buf_size);
+extern int encode_source_string (int num, ULONGEST addr, const char *srctype,
+ const char *src, char *buf, int buf_size);
extern void parse_trace_status (const char *line, struct trace_status *ts);
@@ -374,7 +378,8 @@ extern void parse_tracepoint_status (const char *p, struct breakpoint *tp,
extern void parse_tracepoint_definition (const char *line,
struct uploaded_tp **utpp);
-extern void parse_tsv_definition (const char *line, struct uploaded_tsv **utsvp);
+extern void parse_tsv_definition (const char *line,
+ struct uploaded_tsv **utsvp);
extern struct uploaded_tp *get_uploaded_tp (int num, ULONGEST addr,
struct uploaded_tp **utpp);
@@ -383,7 +388,8 @@ extern void free_uploaded_tps (struct uploaded_tp **utpp);
extern struct uploaded_tsv *get_uploaded_tsv (int num,
struct uploaded_tsv **utsvp);
extern void free_uploaded_tsvs (struct uploaded_tsv **utsvp);
-extern struct tracepoint *create_tracepoint_from_upload (struct uploaded_tp *utp);
+extern struct tracepoint *
+create_tracepoint_from_upload (struct uploaded_tp *utp);
extern void merge_uploaded_tracepoints (struct uploaded_tp **utpp);
extern void merge_uploaded_trace_state_variables (struct uploaded_tsv **utsvp);
@@ -413,14 +419,11 @@ enum trace_find_type
tfind_outside,
};
-extern void tfind_1 (enum trace_find_type type, int num,
- CORE_ADDR addr1, CORE_ADDR addr2,
- int from_tty);
+extern void tfind_1 (enum trace_find_type type, int num, CORE_ADDR addr1,
+ CORE_ADDR addr2, int from_tty);
-extern void trace_save_tfile (const char *filename,
- int target_does_save);
-extern void trace_save_ctf (const char *dirname,
- int target_does_save);
+extern void trace_save_tfile (const char *filename, int target_does_save);
+extern void trace_save_ctf (const char *dirname, int target_does_save);
extern traceframe_info_up parse_traceframe_info (const char *tframe_info);
@@ -434,4 +437,4 @@ extern struct bp_location *get_traceframe_location (int *stepping_frame_p);
/* Command element for the 'while-stepping' command. */
extern cmd_list_element *while_stepping_cmd_element;
-#endif /* TRACEPOINT_H */
+#endif /* TRACEPOINT_H */
diff --git a/gdb/trad-frame.c b/gdb/trad-frame.c
index 6dc7e9aec66..7512f2e80cb 100644
--- a/gdb/trad-frame.c
+++ b/gdb/trad-frame.c
@@ -62,7 +62,8 @@ trad_frame_saved_reg *
trad_frame_alloc_saved_regs (struct gdbarch *gdbarch)
{
#ifdef HAVE_IS_TRIVIALLY_CONSTRUCTIBLE
- gdb_static_assert (std::is_trivially_constructible<trad_frame_saved_reg>::value);
+ gdb_static_assert (
+ std::is_trivially_constructible<trad_frame_saved_reg>::value);
#endif
int numregs = gdbarch_num_cooked_regs (gdbarch);
@@ -91,8 +92,8 @@ trad_frame_alloc_saved_regs (frame_info_ptr this_frame)
}
void
-trad_frame_set_reg_value (struct trad_frame_cache *this_trad_cache,
- int regnum, LONGEST val)
+trad_frame_set_reg_value (struct trad_frame_cache *this_trad_cache, int regnum,
+ LONGEST val)
{
/* External interface for users of trad_frame_cache
(who cannot access the prev_regs object directly). */
@@ -107,8 +108,8 @@ trad_frame_set_reg_realreg (struct trad_frame_cache *this_trad_cache,
}
void
-trad_frame_set_reg_addr (struct trad_frame_cache *this_trad_cache,
- int regnum, CORE_ADDR addr)
+trad_frame_set_reg_addr (struct trad_frame_cache *this_trad_cache, int regnum,
+ CORE_ADDR addr)
{
this_trad_cache->prev_regs[regnum].set_addr (addr);
}
@@ -181,8 +182,6 @@ trad_frame_set_reg_value_bytes (struct trad_frame_cache *this_trad_cache,
this_trad_cache->prev_regs[regnum].set_value_bytes (bytes);
}
-
-
struct value *
trad_frame_get_prev_register (frame_info_ptr this_frame,
trad_frame_saved_reg this_saved_regs[],
@@ -209,8 +208,7 @@ trad_frame_get_prev_register (frame_info_ptr this_frame,
struct value *
trad_frame_get_register (struct trad_frame_cache *this_trad_cache,
- frame_info_ptr this_frame,
- int regnum)
+ frame_info_ptr this_frame, int regnum)
{
return trad_frame_get_prev_register (this_frame, this_trad_cache->prev_regs,
regnum);
diff --git a/gdb/trad-frame.h b/gdb/trad-frame.h
index d6f6e4dcf73..22be8626110 100644
--- a/gdb/trad-frame.h
+++ b/gdb/trad-frame.h
@@ -20,7 +20,7 @@
#ifndef TRAD_FRAME_H
#define TRAD_FRAME_H
-#include "frame.h" /* For "struct frame_id". */
+#include "frame.h" /* For "struct frame_id". */
class frame_info_ptr;
struct regcache_map_entry;
@@ -49,8 +49,8 @@ void trad_frame_set_reg_addr (struct trad_frame_cache *this_trad_cache,
void trad_frame_set_reg_regmap (struct trad_frame_cache *this_trad_cache,
const struct regcache_map_entry *regmap,
CORE_ADDR addr, size_t size);
-void trad_frame_set_reg_value (struct trad_frame_cache *this_cache,
- int regnum, LONGEST val);
+void trad_frame_set_reg_value (struct trad_frame_cache *this_cache, int regnum,
+ LONGEST val);
/* Given the cache in THIS_TRAD_CACHE, set the value of REGNUM to the bytes
contained in BYTES with size SIZE. */
@@ -58,9 +58,9 @@ void trad_frame_set_reg_value_bytes (struct trad_frame_cache *this_trad_cache,
int regnum,
gdb::array_view<const gdb_byte> bytes);
-struct value *trad_frame_get_register (struct trad_frame_cache *this_trad_cache,
- frame_info_ptr this_frame,
- int regnum);
+struct value *
+trad_frame_get_register (struct trad_frame_cache *this_trad_cache,
+ frame_info_ptr this_frame, int regnum);
/* Describes the kind of encoding a stored register has. */
enum class trad_frame_saved_reg_kind
@@ -106,10 +106,7 @@ struct trad_frame_saved_reg
}
/* Encode that the saved register's value is unknown. */
- void set_unknown ()
- {
- m_kind = trad_frame_saved_reg_kind::UNKNOWN;
- }
+ void set_unknown () { m_kind = trad_frame_saved_reg_kind::UNKNOWN; }
/* Encode that the saved register's value is stored as a sequence of bytes.
This is useful when the value is larger than what primitive types
@@ -152,20 +149,14 @@ struct trad_frame_saved_reg
/* Convenience functions, return true if the register has been
encoded as specified. Return false otherwise. */
- bool is_value () const
- {
- return m_kind == trad_frame_saved_reg_kind::VALUE;
- }
+ bool is_value () const { return m_kind == trad_frame_saved_reg_kind::VALUE; }
bool is_realreg () const
{
return m_kind == trad_frame_saved_reg_kind::REALREG;
}
- bool is_addr () const
- {
- return m_kind == trad_frame_saved_reg_kind::ADDR;
- }
+ bool is_addr () const { return m_kind == trad_frame_saved_reg_kind::ADDR; }
bool is_unknown () const
{
@@ -181,7 +172,8 @@ private:
trad_frame_saved_reg_kind m_kind;
- union {
+ union
+ {
LONGEST value;
int realreg;
LONGEST addr;
@@ -199,8 +191,9 @@ trad_frame_saved_reg *trad_frame_alloc_saved_regs (struct gdbarch *);
/* Given the trad_frame info, return the location of the specified
register. */
-struct value *trad_frame_get_prev_register (frame_info_ptr this_frame,
- trad_frame_saved_reg this_saved_regs[],
- int regnum);
+struct value *
+trad_frame_get_prev_register (frame_info_ptr this_frame,
+ trad_frame_saved_reg this_saved_regs[],
+ int regnum);
#endif
diff --git a/gdb/tramp-frame.c b/gdb/tramp-frame.c
index c69ee6efc2c..2a92c79d157 100644
--- a/gdb/tramp-frame.c
+++ b/gdb/tramp-frame.c
@@ -40,8 +40,7 @@ struct tramp_frame_cache
};
static struct trad_frame_cache *
-tramp_frame_cache (frame_info_ptr this_frame,
- void **this_cache)
+tramp_frame_cache (frame_info_ptr this_frame, void **this_cache)
{
struct tramp_frame_cache *tramp_cache
= (struct tramp_frame_cache *) *this_cache;
@@ -49,8 +48,7 @@ tramp_frame_cache (frame_info_ptr this_frame,
if (tramp_cache->trad_cache == NULL)
{
tramp_cache->trad_cache = trad_frame_cache_zalloc (this_frame);
- tramp_cache->tramp_frame->init (tramp_cache->tramp_frame,
- this_frame,
+ tramp_cache->tramp_frame->init (tramp_cache->tramp_frame, this_frame,
tramp_cache->trad_cache,
tramp_cache->func);
}
@@ -58,8 +56,7 @@ tramp_frame_cache (frame_info_ptr this_frame,
}
static void
-tramp_frame_this_id (frame_info_ptr this_frame,
- void **this_cache,
+tramp_frame_this_id (frame_info_ptr this_frame, void **this_cache,
struct frame_id *this_id)
{
struct trad_frame_cache *trad_cache
@@ -69,8 +66,7 @@ tramp_frame_this_id (frame_info_ptr this_frame,
}
static struct value *
-tramp_frame_prev_register (frame_info_ptr this_frame,
- void **this_cache,
+tramp_frame_prev_register (frame_info_ptr this_frame, void **this_cache,
int prev_regnum)
{
struct trad_frame_cache *trad_cache
@@ -80,8 +76,8 @@ tramp_frame_prev_register (frame_info_ptr this_frame,
}
static CORE_ADDR
-tramp_frame_start (const struct tramp_frame *tramp,
- frame_info_ptr this_frame, CORE_ADDR pc)
+tramp_frame_start (const struct tramp_frame *tramp, frame_info_ptr this_frame,
+ CORE_ADDR pc)
{
struct gdbarch *gdbarch = get_frame_arch (this_frame);
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
@@ -106,9 +102,8 @@ tramp_frame_start (const struct tramp_frame *tramp,
if (tramp->insn[i].bytes == TRAMP_SENTINEL_INSN)
return func;
- if (!safe_frame_unwind_memory (this_frame,
- func + i * insn_size,
- {buf, insn_size}))
+ if (!safe_frame_unwind_memory (this_frame, func + i * insn_size,
+ { buf, insn_size }))
break;
insn = extract_unsigned_integer (buf, insn_size, byte_order);
if (tramp->insn[i].bytes != (insn & tramp->insn[i].mask))
@@ -121,8 +116,7 @@ tramp_frame_start (const struct tramp_frame *tramp,
static int
tramp_frame_sniffer (const struct frame_unwind *self,
- frame_info_ptr this_frame,
- void **this_cache)
+ frame_info_ptr this_frame, void **this_cache)
{
const struct tramp_frame *tramp = self->unwind_data->tramp_frame;
CORE_ADDR pc = get_frame_pc (this_frame);
diff --git a/gdb/tramp-frame.h b/gdb/tramp-frame.h
index fa0241acb2d..976aa1adebb 100644
--- a/gdb/tramp-frame.h
+++ b/gdb/tramp-frame.h
@@ -20,7 +20,7 @@
#ifndef TRAMP_FRAME_H
#define TRAMP_FRAME_H
-#include "frame.h" /* For "enum frame_type". */
+#include "frame.h" /* For "enum frame_type". */
class frame_info_ptr;
struct trad_frame_cache;
@@ -57,23 +57,22 @@ struct tramp_frame
The instruction sequence is terminated by
TRAMP_SENTINEL_INSN. */
int insn_size;
+
struct
{
ULONGEST bytes;
ULONGEST mask;
} insn[48];
+
/* Initialize a trad-frame cache corresponding to the tramp-frame.
FUNC is the address of the instruction TRAMP[0] in memory. */
- void (*init) (const struct tramp_frame *self,
- frame_info_ptr this_frame,
- struct trad_frame_cache *this_cache,
- CORE_ADDR func);
+ void (*init) (const struct tramp_frame *self, frame_info_ptr this_frame,
+ struct trad_frame_cache *this_cache, CORE_ADDR func);
/* Return non-zero if the tramp-frame is valid for the PC requested.
Adjust the PC to point to the address to check the instruction
sequence against if required. If this is NULL, then the tramp-frame
is valid for any PC. */
- int (*validate) (const struct tramp_frame *self,
- frame_info_ptr this_frame,
+ int (*validate) (const struct tramp_frame *self, frame_info_ptr this_frame,
CORE_ADDR *pc);
};
diff --git a/gdb/tui/tui-command.h b/gdb/tui/tui-command.h
index f6842880bb2..d6ef32cc07c 100644
--- a/gdb/tui/tui-command.h
+++ b/gdb/tui/tui-command.h
@@ -31,24 +31,13 @@ struct tui_cmd_window : public tui_win_info
DISABLE_COPY_AND_ASSIGN (tui_cmd_window);
- void refresh_window () override
- {
- }
+ void refresh_window () override {}
- const char *name () const override
- {
- return CMD_NAME;
- }
+ const char *name () const override { return CMD_NAME; }
- bool can_scroll () const override
- {
- return false;
- }
+ bool can_scroll () const override { return false; }
- bool can_box () const override
- {
- return false;
- }
+ bool can_box () const override { return false; }
void resize (int height, int width, int origin_x, int origin_y) override;
@@ -61,13 +50,9 @@ struct tui_cmd_window : public tui_win_info
protected:
- void do_scroll_vertical (int num_to_scroll) override
- {
- }
+ void do_scroll_vertical (int num_to_scroll) override {}
- void do_scroll_horizontal (int num_to_scroll) override
- {
- }
+ void do_scroll_horizontal (int num_to_scroll) override {}
};
/* Refresh the command window. */
diff --git a/gdb/tui/tui-data.c b/gdb/tui/tui-data.c
index 0daed32b6e6..0d2a78ba35f 100644
--- a/gdb/tui/tui-data.c
+++ b/gdb/tui/tui-data.c
@@ -43,7 +43,6 @@ tui_win_resized ()
return win_resized;
}
-
/* Set a whether the terminal window has been resized or not. */
void
tui_set_win_resized_to (bool resized)
@@ -51,7 +50,6 @@ tui_set_win_resized_to (bool resized)
win_resized = resized;
}
-
/* Answer the window with the logical focus. */
struct tui_win_info *
tui_win_with_focus (void)
@@ -59,7 +57,6 @@ tui_win_with_focus (void)
return win_with_focus;
}
-
/* Set the logical focus to win_info. */
void
tui_set_win_focus_to (struct tui_win_info *win_info)
@@ -72,7 +69,6 @@ tui_set_win_focus_to (struct tui_win_info *win_info)
}
}
-
/* Accessor for the term_height. */
int
tui_term_height (void)
@@ -80,7 +76,6 @@ tui_term_height (void)
return term_height;
}
-
/* Mutator for the term height. */
void
tui_set_term_height_to (int h)
@@ -88,7 +83,6 @@ tui_set_term_height_to (int h)
term_height = h;
}
-
/* Accessor for the term_width. */
int
tui_term_width (void)
@@ -96,7 +90,6 @@ tui_term_width (void)
return term_width;
}
-
/* Mutator for the term_width. */
void
tui_set_term_width_to (int w)
@@ -104,7 +97,6 @@ tui_set_term_width_to (int w)
term_width = w;
}
-
/* Answer the next window in the list, cycling back to the top if
necessary. */
struct tui_win_info *
@@ -128,7 +120,6 @@ tui_next_win (struct tui_win_info *cur_win)
return *iter;
}
-
/* Answer the prev window in the list, cycling back to the bottom if
necessary. */
struct tui_win_info *
@@ -152,7 +143,6 @@ tui_prev_win (struct tui_win_info *cur_win)
return *iter;
}
-
void
tui_win_info::rerender ()
{
diff --git a/gdb/tui/tui-data.h b/gdb/tui/tui-data.h
index c92e85c9da1..5eb6d177627 100644
--- a/gdb/tui/tui-data.h
+++ b/gdb/tui/tui-data.h
@@ -23,19 +23,16 @@
#define TUI_TUI_DATA_H
#include "tui/tui.h"
-#include "gdb_curses.h" /* For WINDOW. */
+#include "gdb_curses.h" /* For WINDOW. */
#include "observable.h"
/* A deleter that calls delwin. */
struct curses_deleter
{
- void operator() (WINDOW *win) const
- {
- delwin (win);
- }
+ void operator() (WINDOW *win) const { delwin (win); }
};
-#define MIN_WIN_HEIGHT 3
+#define MIN_WIN_HEIGHT 3
/* Generic window information. */
struct tui_win_info
@@ -52,6 +49,7 @@ protected:
virtual void make_window ();
public:
+
tui_win_info (tui_win_info &&) = default;
virtual ~tui_win_info () = default;
@@ -68,42 +66,26 @@ public:
virtual int max_height () const;
/* Compute the minimum height of this window. */
- virtual int min_height () const
- {
- return MIN_WIN_HEIGHT;
- }
+ virtual int min_height () const { return MIN_WIN_HEIGHT; }
/* Compute the maximum width of this window. */
int max_width () const;
/* Compute the minimum width of this window. */
- int min_width () const
- {
- return 3;
- }
+ int min_width () const { return 3; }
/* Return true if this window can be boxed. */
- virtual bool can_box () const
- {
- return true;
- }
+ virtual bool can_box () const { return true; }
/* Resize this window. The parameters are used to set the window's
size and position. */
- virtual void resize (int height, int width,
- int origin_x, int origin_y);
+ virtual void resize (int height, int width, int origin_x, int origin_y);
/* Return true if this window is visible. */
- bool is_visible () const
- {
- return handle != nullptr && tui_active;
- }
+ bool is_visible () const { return handle != nullptr && tui_active; }
/* Return true if this window can accept the focus. */
- virtual bool can_focus () const
- {
- return true;
- }
+ virtual bool can_focus () const { return true; }
/* Disable output until the next call to doupdate. */
void no_refresh ()
@@ -113,15 +95,10 @@ public:
}
/* Called after the tab width has been changed. */
- virtual void update_tab_width ()
- {
- }
+ virtual void update_tab_width () {}
/* Set whether this window is highlighted. */
- void set_highlight (bool highlight)
- {
- is_highlighted = highlight;
- }
+ void set_highlight (bool highlight) { is_highlighted = highlight; }
/* Methods to scroll the contents of this window. Note that they
are named with "_scroll" coming at the end because the more
@@ -132,17 +109,12 @@ public:
void right_scroll (int num_to_scroll);
/* Return true if this window can be scrolled, false otherwise. */
- virtual bool can_scroll () const
- {
- return true;
- }
+ virtual bool can_scroll () const { return true; }
/* Called for each mouse click inside this window. Coordinates MOUSE_X
and MOUSE_Y are 0-based relative to the window, and MOUSE_BUTTON can
be 1 (left), 2 (middle), or 3 (right). */
- virtual void click (int mouse_x, int mouse_y, int mouse_button)
- {
- }
+ virtual void click (int mouse_x, int mouse_y, int mouse_button) {}
void check_and_display_highlight_if_needed ();
@@ -174,20 +146,20 @@ protected:
};
/* Constant definitions. */
-#define SRC_NAME "src"
-#define CMD_NAME "cmd"
-#define DATA_NAME "regs"
-#define DISASSEM_NAME "asm"
-#define STATUS_NAME "status"
+#define SRC_NAME "src"
+#define CMD_NAME "cmd"
+#define DATA_NAME "regs"
+#define DISASSEM_NAME "asm"
+#define STATUS_NAME "status"
/* Global Data. */
extern struct tui_win_info *tui_win_list[MAX_MAJOR_WINDOWS];
-#define TUI_SRC_WIN ((tui_source_window *) tui_win_list[SRC_WIN])
-#define TUI_DISASM_WIN ((tui_disasm_window *) tui_win_list[DISASSEM_WIN])
-#define TUI_DATA_WIN ((tui_data_window *) tui_win_list[DATA_WIN])
-#define TUI_CMD_WIN ((tui_cmd_window *) tui_win_list[CMD_WIN])
-#define TUI_STATUS_WIN ((tui_locator_window *) tui_win_list[STATUS_WIN])
+#define TUI_SRC_WIN ((tui_source_window *) tui_win_list[SRC_WIN])
+#define TUI_DISASM_WIN ((tui_disasm_window *) tui_win_list[DISASSEM_WIN])
+#define TUI_DATA_WIN ((tui_data_window *) tui_win_list[DATA_WIN])
+#define TUI_CMD_WIN ((tui_cmd_window *) tui_win_list[CMD_WIN])
+#define TUI_STATUS_WIN ((tui_locator_window *) tui_win_list[STATUS_WIN])
/* All the windows that are currently instantiated, in layout
order. */
diff --git a/gdb/tui/tui-disasm.c b/gdb/tui/tui-disasm.c
index f0b55769d71..6c23ae7d9e7 100644
--- a/gdb/tui/tui-disasm.c
+++ b/gdb/tui/tui-disasm.c
@@ -98,10 +98,8 @@ len_without_escapes (const std::string &str)
reason, for example, we hit invalid memory, then ASM_LINES can have
fewer entries than requested. */
static CORE_ADDR
-tui_disassemble (struct gdbarch *gdbarch,
- std::vector<tui_asm_line> &asm_lines,
- CORE_ADDR pc, int count,
- size_t *addr_size = nullptr)
+tui_disassemble (struct gdbarch *gdbarch, std::vector<tui_asm_line> &asm_lines,
+ CORE_ADDR pc, int count, size_t *addr_size = nullptr)
{
bool term_out = source_styling && gdb_stdout->can_emit_style_escape ();
string_file gdb_dis_out (term_out);
@@ -190,7 +188,7 @@ tui_find_disassembly_address (struct gdbarch *gdbarch, CORE_ADDR pc, int from)
CORE_ADDR new_low;
int max_lines;
- max_lines = (from > 0) ? from : - from;
+ max_lines = (from > 0) ? from : -from;
if (max_lines == 0)
return pc;
@@ -293,17 +291,18 @@ tui_find_disassembly_address (struct gdbarch *gdbarch, CORE_ADDR pc, int from)
CORE_ADDR old_next_addr = next_addr;
std::vector<tui_asm_line> single_asm_line;
- next_addr = tui_disassemble (gdbarch, single_asm_line,
- next_addr, 1);
+ next_addr
+ = tui_disassemble (gdbarch, single_asm_line, next_addr, 1);
/* If there are some problems while disassembling exit. */
if (next_addr <= old_next_addr)
return pc;
gdb_assert (single_asm_line.size () == 1);
asm_lines[pos] = single_asm_line[0];
- } while (next_addr <= pc);
+ }
+ while (next_addr <= pc);
pos++;
if (pos >= max_lines)
- pos = 0;
+ pos = 0;
new_low = asm_lines[pos].addr;
/* When scrolling backward the addresses should move backward, or at
@@ -357,10 +356,9 @@ tui_disasm_window::set_contents (struct gdbarch *arch,
if (i < asm_lines.size ())
{
- line
- = (asm_lines[i].addr_string
- + n_spaces (insn_pos - asm_lines[i].addr_size)
- + asm_lines[i].insn);
+ line = (asm_lines[i].addr_string
+ + n_spaces (insn_pos - asm_lines[i].addr_size)
+ + asm_lines[i].insn);
addr = asm_lines[i].addr;
}
else
@@ -381,7 +379,6 @@ tui_disasm_window::set_contents (struct gdbarch *arch,
return true;
}
-
void
tui_get_begin_asm_address (struct gdbarch **gdbarch_p, CORE_ADDR *addr_p)
{
@@ -407,7 +404,7 @@ tui_get_begin_asm_address (struct gdbarch **gdbarch_p, CORE_ADDR *addr_p)
addr = main_symbol.value_address ();
}
}
- else /* The target is executing. */
+ else /* The target is executing. */
{
gdbarch = tui_location.gdbarch ();
addr = tui_location.addr ();
@@ -421,8 +418,8 @@ tui_get_begin_asm_address (struct gdbarch **gdbarch_p, CORE_ADDR *addr_p)
disassembly window. This may or may not be the same as the low
address input. */
CORE_ADDR
-tui_get_low_disassembly_address (struct gdbarch *gdbarch,
- CORE_ADDR low, CORE_ADDR pc)
+tui_get_low_disassembly_address (struct gdbarch *gdbarch, CORE_ADDR low,
+ CORE_ADDR pc)
{
int pos;
diff --git a/gdb/tui/tui-disasm.h b/gdb/tui/tui-disasm.h
index a2e321a7efa..7fe20d4b041 100644
--- a/gdb/tui/tui-disasm.h
+++ b/gdb/tui/tui-disasm.h
@@ -34,10 +34,7 @@ struct tui_disasm_window : public tui_source_window_base
DISABLE_COPY_AND_ASSIGN (tui_disasm_window);
- const char *name () const override
- {
- return DISASSEM_NAME;
- }
+ const char *name () const override { return DISASSEM_NAME; }
bool location_matches_p (struct bp_location *loc, int line_no) override;
@@ -45,7 +42,7 @@ struct tui_disasm_window : public tui_source_window_base
void erase_source_content () override
{
- do_erase_source_content (_("[ No Assembly Available ]"));
+ do_erase_source_content (_ ("[ No Assembly Available ]"));
}
void display_start_addr (struct gdbarch **gdbarch_p,
@@ -59,6 +56,7 @@ protected:
const struct symtab_and_line &sal) override;
private:
+
/* Answer whether a particular line number or address is displayed
in the current source window. */
bool addr_is_displayed (CORE_ADDR addr) const;
diff --git a/gdb/tui/tui-file.h b/gdb/tui/tui-file.h
index 4a6d507c942..320ce3c6619 100644
--- a/gdb/tui/tui-file.h
+++ b/gdb/tui/tui-file.h
@@ -26,10 +26,12 @@
class tui_file : public stdio_file
{
public:
+
tui_file (FILE *stream, bool buffered)
: stdio_file (stream),
m_buffered (buffered)
- {}
+ {
+ }
void write (const char *buf, long length_buf) override;
void puts (const char *) override;
diff --git a/gdb/tui/tui-hooks.c b/gdb/tui/tui-hooks.c
index d67c3d7f353..f66f81d07e2 100644
--- a/gdb/tui/tui-hooks.c
+++ b/gdb/tui/tui-hooks.c
@@ -50,7 +50,7 @@
#include "gdb_curses.h"
static void
-tui_new_objfile_hook (struct objfile* objfile)
+tui_new_objfile_hook (struct objfile *objfile)
{
if (tui_active)
tui_display_main ();
@@ -158,10 +158,8 @@ tui_refresh_frame_and_register_information ()
from print_frame_info. */
static void
-tui_dummy_print_frame_info_listing_hook (struct symtab *s,
- int line,
- int stopline,
- int noerror)
+tui_dummy_print_frame_info_listing_hook (struct symtab *s, int line,
+ int stopline, int noerror)
{
}
@@ -238,14 +236,11 @@ tui_attach_detach_observers (bool attach)
tui_event_delete_breakpoint, attach);
attach_or_detach (gdb::observers::breakpoint_modified,
tui_event_modify_breakpoint, attach);
- attach_or_detach (gdb::observers::inferior_exit,
- tui_inferior_exit, attach);
- attach_or_detach (gdb::observers::before_prompt,
- tui_before_prompt, attach);
- attach_or_detach (gdb::observers::normal_stop,
- tui_normal_stop, attach);
- attach_or_detach (gdb::observers::register_changed,
- tui_register_changed, attach);
+ attach_or_detach (gdb::observers::inferior_exit, tui_inferior_exit, attach);
+ attach_or_detach (gdb::observers::before_prompt, tui_before_prompt, attach);
+ attach_or_detach (gdb::observers::normal_stop, tui_normal_stop, attach);
+ attach_or_detach (gdb::observers::register_changed, tui_register_changed,
+ attach);
attach_or_detach (gdb::observers::user_selected_context_changed,
tui_context_changed, attach);
attach_or_detach (gdb::observers::current_source_symtab_and_line_changed,
@@ -278,6 +273,7 @@ tui_remove_hooks (void)
}
void _initialize_tui_hooks ();
+
void
_initialize_tui_hooks ()
{
diff --git a/gdb/tui/tui-interp.c b/gdb/tui/tui-interp.c
index 812c62c6422..4feb216e7bb 100644
--- a/gdb/tui/tui-interp.c
+++ b/gdb/tui/tui-interp.c
@@ -42,9 +42,11 @@ static bool tui_start_enabled = false;
class tui_interp final : public cli_interp_base
{
public:
+
explicit tui_interp (const char *name)
: cli_interp_base (name)
- {}
+ {
+ }
void init (bool top_level) override;
void resume () override;
@@ -152,10 +154,9 @@ tui_interp::interp_ui_out ()
void
tui_interp::exec (const char *command_str)
{
- internal_error (_("tui_exec called"));
+ internal_error (_ ("tui_exec called"));
}
-
/* Factory for TUI interpreters. */
static struct interp *
@@ -165,6 +166,7 @@ tui_interp_factory (const char *name)
}
void _initialize_tui_interp ();
+
void
_initialize_tui_interp ()
{
diff --git a/gdb/tui/tui-io.c b/gdb/tui/tui-io.c
index a17cf38a1f2..8ba5f815fb1 100644
--- a/gdb/tui/tui-io.c
+++ b/gdb/tui/tui-io.c
@@ -66,8 +66,7 @@ key_is_start_sequence (int ch)
/* Use definition from readline 4.3. */
#undef CTRL_CHAR
-#define CTRL_CHAR(c) \
- ((c) < control_character_threshold && (((c) & 0x80) == 0))
+#define CTRL_CHAR(c) ((c) < control_character_threshold && (((c) &0x80) == 0))
/* This file controls the IO interactions between gdb and curses.
When the TUI is enabled, gdb has two modes a curses and a standard
@@ -191,7 +190,7 @@ struct color_pair
int fg;
int bg;
- bool operator< (const color_pair &o) const
+ bool operator<(const color_pair &o) const
{
return fg < o.fg || (fg == o.fg && bg < o.bg);
}
@@ -205,16 +204,9 @@ static std::map<color_pair, int> color_pair_map;
/* This is indexed by ANSI color offset from the base color, and holds
the corresponding curses color constant. */
-static const int curses_colors[] = {
- COLOR_BLACK,
- COLOR_RED,
- COLOR_GREEN,
- COLOR_YELLOW,
- COLOR_BLUE,
- COLOR_MAGENTA,
- COLOR_CYAN,
- COLOR_WHITE
-};
+static const int curses_colors[]
+ = { COLOR_BLACK, COLOR_RED, COLOR_GREEN, COLOR_YELLOW,
+ COLOR_BLUE, COLOR_MAGENTA, COLOR_CYAN, COLOR_WHITE };
/* Given a color, find its index. */
@@ -238,7 +230,8 @@ get_color (const ui_file_style::color &color, int *result)
color.get_rgb (rgb);
/* We store RGB as 0..255, but curses wants 0..1000. */
if (init_color (next, rgb[0] * 1000 / 255, rgb[1] * 1000 / 255,
- rgb[2] * 1000 / 255) == ERR)
+ rgb[2] * 1000 / 255)
+ == ERR)
return false;
color_map[color] = next;
*result = next;
@@ -587,7 +580,7 @@ tui_redisplay_readline (void)
prompt = "";
else
prompt = rl_display_prompt;
-
+
c_pos = -1;
c_line = -1;
w = TUI_CMD_WIN->handle.get ();
@@ -602,7 +595,7 @@ tui_redisplay_readline (void)
for (in = 0; in <= rl_end; in++)
{
unsigned char c;
-
+
if (in == rl_point)
{
getyx (w, c_line, c_pos);
@@ -625,7 +618,8 @@ tui_redisplay_readline (void)
{
waddch (w, ' ');
col++;
- } while ((col % 8) != 0);
+ }
+ while ((col % 8) != 0);
}
else
{
@@ -645,7 +639,7 @@ tui_redisplay_readline (void)
TUI_CMD_WIN->start_line -= height - 1;
wrefresh (w);
- fflush(stdout);
+ fflush (stdout);
}
/* Readline callback to prepare the terminal. It is called once each
@@ -924,11 +918,11 @@ tui_initialize_io (void)
readline output in a pipe, read that pipe and output the content
in the curses command window. */
if (gdb_pipe_cloexec (tui_readline_pipe) != 0)
- error (_("Cannot create pipe for readline"));
+ error (_ ("Cannot create pipe for readline"));
tui_rl_outstream = fdopen (tui_readline_pipe[1], "w");
if (tui_rl_outstream == 0)
- error (_("Cannot redirect readline output"));
+ error (_ ("Cannot redirect readline output"));
setvbuf (tui_rl_outstream, NULL, _IOLBF, 0);
@@ -947,12 +941,11 @@ tui_initialize_io (void)
#ifdef __MINGW32__
/* MS-Windows port of ncurses doesn't support default foreground and
background colors, so we must record the default colors at startup. */
- HANDLE hstdout = (HANDLE)_get_osfhandle (fileno (stdout));
+ HANDLE hstdout = (HANDLE) _get_osfhandle (fileno (stdout));
DWORD cmode;
CONSOLE_SCREEN_BUFFER_INFO csbi;
- if (hstdout != INVALID_HANDLE_VALUE
- && GetConsoleMode (hstdout, &cmode) != 0
+ if (hstdout != INVALID_HANDLE_VALUE && GetConsoleMode (hstdout, &cmode) != 0
&& GetConsoleScreenBufferInfo (hstdout, &csbi))
ncurses_norm_attr = csbi.wAttributes;
#endif
@@ -970,16 +963,16 @@ tui_dispatch_mouse_event ()
return;
for (tui_win_info *wi : all_tui_windows ())
- if (mev.x > wi->x && mev.x < wi->x + wi->width - 1
- && mev.y > wi->y && mev.y < wi->y + wi->height - 1)
+ if (mev.x > wi->x && mev.x < wi->x + wi->width - 1 && mev.y > wi->y
+ && mev.y < wi->y + wi->height - 1)
{
if ((mev.bstate & BUTTON1_CLICKED) != 0
|| (mev.bstate & BUTTON2_CLICKED) != 0
|| (mev.bstate & BUTTON3_CLICKED) != 0)
{
- int button = (mev.bstate & BUTTON1_CLICKED) != 0 ? 1
- : ((mev.bstate & BUTTON2_CLICKED) != 0 ? 2
- : 3);
+ int button = (mev.bstate & BUTTON1_CLICKED) != 0
+ ? 1
+ : ((mev.bstate & BUTTON2_CLICKED) != 0 ? 2 : 3);
wi->click (mev.x - wi->x - 1, mev.y - wi->y - 1, button);
}
#ifdef BUTTON5_PRESSED
@@ -1172,7 +1165,7 @@ tui_getc_1 (FILE *fp)
case KEY_END:
return start_sequence ("\033[F");
- /* del and ins are unfortunately not hardcoded in readline for
+ /* del and ins are unfortunately not hardcoded in readline for
all systems. */
case KEY_DC: /* del */
diff --git a/gdb/tui/tui-layout.c b/gdb/tui/tui-layout.c
index ecdcd4884a7..22ba2c69b13 100644
--- a/gdb/tui/tui-layout.c
+++ b/gdb/tui/tui-layout.c
@@ -238,7 +238,6 @@ tui_prev_layout_command (const char *arg, int from_tty)
tui_set_layout (layouts[index].get ());
}
-
/* See tui-layout.h. */
void
@@ -248,9 +247,8 @@ tui_regs_layout ()
if (TUI_DATA_WIN != nullptr)
return;
- tui_set_layout (TUI_DISASM_WIN != nullptr
- ? asm_regs_layout
- : src_regs_layout);
+ tui_set_layout (TUI_DISASM_WIN != nullptr ? asm_regs_layout
+ : src_regs_layout);
}
/* Implement the "layout regs" command. */
@@ -299,11 +297,9 @@ extract_display_start_addr (struct gdbarch **gdbarch_p, CORE_ADDR *addr_p)
}
void
-tui_win_info::resize (int height_, int width_,
- int origin_x_, int origin_y_)
+tui_win_info::resize (int height_, int width_, int origin_x_, int origin_y_)
{
- if (width == width_ && height == height_
- && x == origin_x_ && y == origin_y_
+ if (width == width_ && height == height_ && x == origin_x_ && y == origin_y_
&& handle != nullptr)
return;
@@ -329,8 +325,6 @@ tui_win_info::resize (int height_, int width_,
rerender ();
}
-
-
/* Helper function to create one of the built-in (non-locator)
windows. */
@@ -373,11 +367,11 @@ tui_get_window_by_name (const std::string &name)
auto iter = known_window_types->find (name);
if (iter == known_window_types->end ())
- error (_("Unknown window type \"%s\""), name.c_str ());
+ error (_ ("Unknown window type \"%s\""), name.c_str ());
tui_win_info *result = iter->second (name.c_str ());
if (result == nullptr)
- error (_("Could not create window \"%s\""), name.c_str ());
+ error (_ ("Could not create window \"%s\""), name.c_str ());
return result;
}
@@ -388,20 +382,16 @@ initialize_known_windows ()
{
known_window_types = new window_types_map;
- known_window_types->emplace (SRC_NAME,
- make_standard_window<SRC_WIN,
- tui_source_window>);
+ known_window_types->emplace (
+ SRC_NAME, make_standard_window<SRC_WIN, tui_source_window>);
known_window_types->emplace (CMD_NAME,
make_standard_window<CMD_WIN, tui_cmd_window>);
- known_window_types->emplace (DATA_NAME,
- make_standard_window<DATA_WIN,
- tui_data_window>);
- known_window_types->emplace (DISASSEM_NAME,
- make_standard_window<DISASSEM_WIN,
- tui_disasm_window>);
- known_window_types->emplace (STATUS_NAME,
- make_standard_window<STATUS_WIN,
- tui_locator_window>);
+ known_window_types->emplace (
+ DATA_NAME, make_standard_window<DATA_WIN, tui_data_window>);
+ known_window_types->emplace (
+ DISASSEM_NAME, make_standard_window<DISASSEM_WIN, tui_disasm_window>);
+ known_window_types->emplace (
+ STATUS_NAME, make_standard_window<STATUS_WIN, tui_locator_window>);
}
/* See tui-layout.h. */
@@ -413,22 +403,21 @@ tui_register_window (const char *name, window_factory &&factory)
if (name_copy == SRC_NAME || name_copy == CMD_NAME || name_copy == DATA_NAME
|| name_copy == DISASSEM_NAME || name_copy == STATUS_NAME)
- error (_("Window type \"%s\" is built-in"), name);
+ error (_ ("Window type \"%s\" is built-in"), name);
for (const char &c : name_copy)
{
if (ISSPACE (c))
- error (_("invalid whitespace character in window name"));
+ error (_ ("invalid whitespace character in window name"));
if (!ISALNUM (c) && strchr ("-_.", c) == nullptr)
- error (_("invalid character '%c' in window name"), c);
+ error (_ ("invalid character '%c' in window name"), c);
}
if (!ISALPHA (name_copy[0]))
- error (_("window name must start with a letter, not '%c'"), name_copy[0]);
+ error (_ ("window name must start with a letter, not '%c'"), name_copy[0]);
- known_window_types->emplace (std::move (name_copy),
- std::move (factory));
+ known_window_types->emplace (std::move (name_copy), std::move (factory));
}
/* See tui-layout.h. */
@@ -464,8 +453,8 @@ tui_layout_window::get_sizes (bool height, int *min_value, int *max_value)
if (m_window == nullptr)
m_window = tui_get_window_by_name (m_contents);
- tui_debug_printf ("window = %s, getting %s",
- m_window->name (), (height ? "height" : "width"));
+ tui_debug_printf ("window = %s, getting %s", m_window->name (),
+ (height ? "height" : "width"));
if (height)
{
@@ -540,7 +529,7 @@ void
tui_layout_split::add_split (std::unique_ptr<tui_layout_split> &&layout,
int weight)
{
- split s = {weight, std::move (layout)};
+ split s = { weight, std::move (layout) };
m_splits.push_back (std::move (s));
}
@@ -550,7 +539,7 @@ void
tui_layout_split::add_window (const char *name, int weight)
{
tui_layout_window *result = new tui_layout_window (name);
- split s = {weight, std::unique_ptr<tui_layout_base> (result)};
+ split s = { weight, std::unique_ptr<tui_layout_base> (result) };
m_splits.push_back (std::move (s));
}
@@ -563,7 +552,7 @@ tui_layout_split::clone () const
for (const split &item : m_splits)
{
std::unique_ptr<tui_layout_base> next = item.layout->clone ();
- split s = {item.weight, std::move (next)};
+ split s = { item.weight, std::move (next) };
result->m_splits.push_back (std::move (s));
}
return std::unique_ptr<tui_layout_base> (result);
@@ -642,7 +631,7 @@ tui_layout_split::tui_debug_weights_to_string () const
for (int i = 0; i < m_splits.size (); ++i)
{
if (i > 0)
- str += ", ";
+ str += ", ";
str += string_printf ("[%d] %d", i, m_splits[i].weight);
}
@@ -652,16 +641,16 @@ tui_layout_split::tui_debug_weights_to_string () const
/* See tui-layout.h. */
void
-tui_layout_split::tui_debug_print_size_info
- (const std::vector<tui_layout_split::size_info> &info)
+tui_layout_split::tui_debug_print_size_info (
+ const std::vector<tui_layout_split::size_info> &info)
{
gdb_assert (debug_tui);
tui_debug_printf ("current size info data:");
for (int i = 0; i < info.size (); ++i)
- tui_debug_printf (" [%d] { size = %d, min = %d, max = %d, share_box = %d }",
- i, info[i].size, info[i].min_size,
- info[i].max_size, info[i].share_box);
+ tui_debug_printf (
+ " [%d] { size = %d, min = %d, max = %d, share_box = %d }", i,
+ info[i].size, info[i].min_size, info[i].max_size, info[i].share_box);
}
/* See tui-layout.h. */
@@ -671,8 +660,8 @@ tui_layout_split::set_size (const char *name, int new_size, bool set_width_p)
{
TUI_SCOPED_DEBUG_ENTER_EXIT;
- tui_debug_printf ("this = %p, name = %s, new_size = %d",
- this, name, new_size);
+ tui_debug_printf ("this = %p, name = %s, new_size = %d", this, name,
+ new_size);
/* Look through the children. If one is a layout holding the named
window, we're done; or if one actually is the named window,
@@ -698,9 +687,8 @@ tui_layout_split::set_size (const char *name, int new_size, bool set_width_p)
if (found_index == -1)
return NOT_FOUND;
- int curr_size = (set_width_p
- ? m_splits[found_index].layout->width
- : m_splits[found_index].layout->height);
+ int curr_size = (set_width_p ? m_splits[found_index].layout->width
+ : m_splits[found_index].layout->height);
if (curr_size == new_size)
return HANDLED;
@@ -710,8 +698,8 @@ tui_layout_split::set_size (const char *name, int new_size, bool set_width_p)
int delta = m_splits[found_index].weight - new_size;
m_splits[found_index].weight = new_size;
- tui_debug_printf ("before delta (%d) distribution, weights: %s",
- delta, tui_debug_weights_to_string ().c_str ());
+ tui_debug_printf ("before delta (%d) distribution, weights: %s", delta,
+ tui_debug_weights_to_string ().c_str ());
/* Distribute the "delta" over all other windows, while respecting their
min/max sizes. We grow each window by 1 line at a time continually
@@ -755,19 +743,19 @@ tui_layout_split::set_size (const char *name, int new_size, bool set_width_p)
}
}
- tui_debug_printf ("index = %d, weight now: %d",
- index, m_splits[index].weight);
+ tui_debug_printf ("index = %d, weight now: %d", index,
+ m_splits[index].weight);
}
- tui_debug_printf ("after delta (%d) distribution, weights: %s",
- delta, tui_debug_weights_to_string ().c_str ());
+ tui_debug_printf ("after delta (%d) distribution, weights: %s", delta,
+ tui_debug_weights_to_string ().c_str ());
if (delta != 0)
{
if (set_width_p)
- warning (_("Invalid window width specified"));
+ warning (_ ("Invalid window width specified"));
else
- warning (_("Invalid window height specified"));
+ warning (_ ("Invalid window height specified"));
/* Effectively undo any modifications made here. */
set_weights_from_sizes ();
}
@@ -807,7 +795,8 @@ tui_layout_split::apply (int x_, int y_, int width_, int height_,
: index (index_),
min_size (min_size_),
max_size (max_size_)
- { /* Nothing. */ }
+ { /* Nothing. */
+ }
/* The index in m_splits where the cmd window was found. */
int index;
@@ -842,14 +831,13 @@ tui_layout_split::apply (int x_, int y_, int width_, int height_,
m_splits[i].layout->get_sizes (m_vertical, &info[i].min_size,
&info[i].max_size);
- if (preserve_cmd_win_size_p
- && cmd_win_already_exists
+ if (preserve_cmd_win_size_p && cmd_win_already_exists
&& m_splits[i].layout->get_name () != nullptr
&& strcmp (m_splits[i].layout->get_name (), "cmd") == 0)
{
/* Save the old cmd window information, in case we need to
restore it later. */
- old_cmd_info.emplace (i, info[i].min_size, info[i].max_size);
+ old_cmd_info.emplace (i, info[i].min_size, info[i].max_size);
/* If this layout has never been applied, then it means the
user just changed the layout. In this situation, it's
@@ -857,9 +845,8 @@ tui_layout_split::apply (int x_, int y_, int width_, int height_,
same. Setting the min and max sizes this way ensures
that the resizing step, below, does the right thing with
this window. */
- info[i].min_size = (m_vertical
- ? TUI_CMD_WIN->height
- : TUI_CMD_WIN->width);
+ info[i].min_size
+ = (m_vertical ? TUI_CMD_WIN->height : TUI_CMD_WIN->width);
info[i].max_size = info[i].min_size;
}
@@ -873,8 +860,7 @@ tui_layout_split::apply (int x_, int y_, int width_, int height_,
/* Two adjacent boxed windows will share a border, making a bit
more size available. */
- if (i > 0
- && m_splits[i - 1].layout->last_edge_has_border_p ()
+ if (i > 0 && m_splits[i - 1].layout->last_edge_has_border_p ()
&& m_splits[i].layout->first_edge_has_border_p ())
info[i].share_box = true;
}
@@ -915,10 +901,10 @@ tui_layout_split::apply (int x_, int y_, int width_, int height_,
if (debug_tui)
{
tui_debug_printf ("after initial size calculation");
- tui_debug_printf ("available_size = %d, used_size = %d",
- available_size, used_size);
- tui_debug_printf ("total_weight = %d, last_index = %d",
- total_weight, last_index);
+ tui_debug_printf ("available_size = %d, used_size = %d", available_size,
+ used_size);
+ tui_debug_printf ("total_weight = %d, last_index = %d", total_weight,
+ last_index);
tui_debug_print_size_info (info);
}
@@ -939,8 +925,7 @@ tui_layout_split::apply (int x_, int y_, int width_, int height_,
the amount of available space. There's an escape hatch within
the loop in case we can't find any sub-layouts to resize. */
bool found_window_that_can_grow_p = true;
- for (int idx = last_index;
- available_size != used_size;
+ for (int idx = last_index; available_size != used_size;
idx = (idx + 1) % m_splits.size ())
{
/* Every time we get back to last_index, which is where the loop
@@ -975,10 +960,10 @@ tui_layout_split::apply (int x_, int y_, int width_, int height_,
{
info[old_cmd_info->index].min_size = old_cmd_info->min_size;
info[old_cmd_info->index].max_size = old_cmd_info->max_size;
- tui_debug_printf
- ("restoring index %d (cmd) size limits, min = %d, max = %d",
- old_cmd_info->index, old_cmd_info->min_size,
- old_cmd_info->max_size);
+ tui_debug_printf (
+ "restoring index %d (cmd) size limits, min = %d, max = %d",
+ old_cmd_info->index, old_cmd_info->min_size,
+ old_cmd_info->max_size);
old_cmd_info.reset ();
}
else if (!found_window_that_can_grow_p)
@@ -1007,8 +992,8 @@ tui_layout_split::apply (int x_, int y_, int width_, int height_,
tui_debug_printf ("after final size calculation");
tui_debug_printf ("available_size = %d, used_size = %d",
available_size, used_size);
- tui_debug_printf ("total_weight = %d, last_index = %d",
- total_weight, last_index);
+ tui_debug_printf ("total_weight = %d, last_index = %d", total_weight,
+ last_index);
tui_debug_print_size_info (info);
}
}
@@ -1140,7 +1125,7 @@ add_layout_command (const char *name, tui_layout_split *layout)
layout->specification (&spec, 0);
gdb::unique_xmalloc_ptr<char> doc
- = xstrprintf (_("Apply the \"%s\" layout.\n\
+ = xstrprintf (_ ("Apply the \"%s\" layout.\n\
This layout was created using:\n\
tui new-layout %s %s"),
name, name, spec.c_str ());
@@ -1200,8 +1185,6 @@ initialize_layouts ()
asm_regs_layout = layout;
}
-
-
/* A helper function that returns true if NAME is the name of an
available window. */
@@ -1219,9 +1202,9 @@ tui_new_layout_command (const char *spec, int from_tty)
{
std::string new_name = extract_arg (&spec);
if (new_name.empty ())
- error (_("No layout name specified"));
+ error (_ ("No layout name specified"));
if (new_name[0] == '-')
- error (_("Layout name cannot start with '-'"));
+ error (_ ("Layout name cannot start with '-'"));
bool is_vertical = true;
spec = skip_spaces (spec);
@@ -1254,7 +1237,7 @@ tui_new_layout_command (const char *spec, int from_tty)
is_close = true;
++spec;
if (splits.size () == 1)
- error (_("Extra '}' in layout specification"));
+ error (_ ("Extra '}' in layout specification"));
}
else
{
@@ -1262,14 +1245,14 @@ tui_new_layout_command (const char *spec, int from_tty)
if (name.empty ())
break;
if (!validate_window_name (name))
- error (_("Unknown window \"%s\""), name.c_str ());
+ error (_ ("Unknown window \"%s\""), name.c_str ());
if (seen_windows.find (name) != seen_windows.end ())
- error (_("Window \"%s\" seen twice in layout"), name.c_str ());
+ error (_ ("Window \"%s\" seen twice in layout"), name.c_str ());
}
ULONGEST weight = get_ulongest (&spec, '}');
if ((int) weight != weight)
- error (_("Weight out of range: %s"), pulongest (weight));
+ error (_ ("Weight out of range: %s"), pulongest (weight));
if (is_close)
{
std::unique_ptr<tui_layout_split> last_split
@@ -1284,11 +1267,11 @@ tui_new_layout_command (const char *spec, int from_tty)
}
}
if (splits.size () > 1)
- error (_("Missing '}' in layout specification"));
+ error (_ ("Missing '}' in layout specification"));
if (seen_windows.empty ())
- error (_("New layout does not contain any windows"));
+ error (_ ("New layout does not contain any windows"));
if (seen_windows.find (CMD_NAME) == seen_windows.end ())
- error (_("New layout does not contain the \"" CMD_NAME "\" window"));
+ error (_ ("New layout does not contain the \"" CMD_NAME "\" window"));
gdb::unique_xmalloc_ptr<char> cmd_name
= make_unique_xstrdup (new_name.c_str ());
@@ -1304,28 +1287,26 @@ tui_new_layout_command (const char *spec, int from_tty)
manipulation. */
void _initialize_tui_layout ();
+
void
_initialize_tui_layout ()
{
struct cmd_list_element *layout_cmd
- = add_prefix_cmd ("layout", class_tui, tui_layout_command, _("\
+ = add_prefix_cmd ("layout", class_tui, tui_layout_command, _ ("\
Change the layout of windows.\n\
Usage: tui layout prev | next | LAYOUT-NAME"),
&layout_list, 0, tui_get_cmd_list ());
add_com_alias ("layout", layout_cmd, class_tui, 0);
add_cmd ("next", class_tui, tui_next_layout_command,
- _("Apply the next TUI layout."),
- &layout_list);
+ _ ("Apply the next TUI layout."), &layout_list);
add_cmd ("prev", class_tui, tui_prev_layout_command,
- _("Apply the previous TUI layout."),
- &layout_list);
+ _ ("Apply the previous TUI layout."), &layout_list);
add_cmd ("regs", class_tui, tui_regs_layout_command,
- _("Apply the TUI register layout."),
- &layout_list);
+ _ ("Apply the TUI register layout."), &layout_list);
add_cmd ("new-layout", class_tui, tui_new_layout_command,
- _("Create a new TUI layout.\n\
+ _ ("Create a new TUI layout.\n\
Usage: tui new-layout [-horizontal] NAME WINDOW WEIGHT [WINDOW WEIGHT]...\n\
Create a new TUI layout. The new layout will be named NAME,\n\
and can be accessed using \"layout NAME\".\n\
diff --git a/gdb/tui/tui-layout.h b/gdb/tui/tui-layout.h
index ff354fb7c2f..983ef3c672a 100644
--- a/gdb/tui/tui-layout.h
+++ b/gdb/tui/tui-layout.h
@@ -63,7 +63,8 @@ public:
is preserved, otherwise, the TUI_CMD_WIN will resize just like any
other window. */
virtual void apply (int x, int y, int width, int height,
- bool preserve_cmd_win_size_p) = 0;
+ bool preserve_cmd_win_size_p)
+ = 0;
/* Return the minimum and maximum height or width of this layout.
HEIGHT is true to fetch height, false to fetch width. */
@@ -79,10 +80,7 @@ public:
/* Return the name of this layout's window, or nullptr if this
layout does not represent a single window. */
- virtual const char *get_name () const
- {
- return nullptr;
- }
+ virtual const char *get_name () const { return nullptr; }
/* Set the height of the window named NAME to NEW_HEIGHT, updating
the sizes of the other windows around it. */
@@ -156,10 +154,7 @@ public:
void apply (int x, int y, int width, int height,
bool preserve_cmd_win_size_p) override;
- const char *get_name () const override
- {
- return m_contents.c_str ();
- }
+ const char *get_name () const override { return m_contents.c_str (); }
tui_adjust_result set_height (const char *name, int new_height) override
{
@@ -175,9 +170,7 @@ public:
bool last_edge_has_border_p () const override;
- void remove_windows (const char *name) override
- {
- }
+ void remove_windows (const char *name) override {}
void replace_window (const char *name, const char *new_window) override;
@@ -354,12 +347,11 @@ extern void tui_adjust_window_height (struct tui_win_info *win,
int new_height);
/* Adjust the window width of WIN to NEW_WIDTH. */
-extern void tui_adjust_window_width (struct tui_win_info *win,
- int new_width);
+extern void tui_adjust_window_width (struct tui_win_info *win, int new_width);
/* The type of a function that is used to create a TUI window. */
-typedef std::function<tui_win_info * (const char *name)> window_factory;
+typedef std::function<tui_win_info *(const char *name)> window_factory;
/* The type for a data structure that maps a window name to that window's
factory function. */
@@ -382,7 +374,8 @@ struct known_window_names_iterator
known_window_names_iterator (known_window_types_iterator &&iter)
: m_iter (std::move (iter))
- { /* Nothing. */ }
+ { /* Nothing. */
+ }
known_window_names_iterator &operator++ ()
{
@@ -390,11 +383,12 @@ struct known_window_names_iterator
return *this;
}
- const std::string &operator* () const
- { return (*m_iter).first; }
+ const std::string &operator* () const { return (*m_iter).first; }
bool operator!= (const known_window_names_iterator &other) const
- { return m_iter != other.m_iter; }
+ {
+ return m_iter != other.m_iter;
+ }
private:
@@ -405,8 +399,7 @@ private:
/* A range adapter that makes it possible to iterate over the names of all
known tui windows. */
-using known_window_names_range
- = iterator_range<known_window_names_iterator>;
+using known_window_names_range = iterator_range<known_window_names_iterator>;
/* Return a range that can be used to walk over the name of all known tui
windows in a range-for loop. */
diff --git a/gdb/tui/tui-location.c b/gdb/tui/tui-location.c
index 9d6d29bcf01..8ab06e18b3b 100644
--- a/gdb/tui/tui-location.c
+++ b/gdb/tui/tui-location.c
@@ -71,9 +71,8 @@ tui_location_tracker::set_location (struct symtab *symtab)
bool
tui_location_tracker::set_fullname (struct symtab *symtab)
{
- const char *fullname = (symtab == nullptr
- ? "??"
- : symtab_to_fullname (symtab));
+ const char *fullname
+ = (symtab == nullptr ? "??" : symtab_to_fullname (symtab));
bool location_changed_p = fullname != m_full_name;
m_full_name = std::string (fullname);
diff --git a/gdb/tui/tui-location.h b/gdb/tui/tui-location.h
index 8e1d5da1191..e77eb0991d2 100644
--- a/gdb/tui/tui-location.h
+++ b/gdb/tui/tui-location.h
@@ -20,7 +20,7 @@
#include "tui/tui.h"
#include "tui/tui.h"
-#include "gdb_curses.h" /* For WINDOW. */
+#include "gdb_curses.h" /* For WINDOW. */
#include "observable.h"
/* Class used to track the current location that the TUI is displaying. An
@@ -36,32 +36,26 @@ struct tui_location_tracker
if any of the locator's fields were actually changed, and false
otherwise. */
bool set_location (struct gdbarch *gdbarch,
- const struct symtab_and_line &sal,
- const char *procname);
+ const struct symtab_and_line &sal, const char *procname);
/* Update the current location with the with the provided argument.
Return true if any of the fields actually changed, otherwise false. */
bool set_location (struct symtab *symtab);
/* Return the address of the current location. */
- CORE_ADDR addr () const
- { return m_addr; }
+ CORE_ADDR addr () const { return m_addr; }
/* Return the architecture for the current location. */
- struct gdbarch *gdbarch () const
- { return m_gdbarch; }
+ struct gdbarch *gdbarch () const { return m_gdbarch; }
/* Return the full name of the file containing the current location. */
- const std::string &full_name () const
- { return m_full_name; }
+ const std::string &full_name () const { return m_full_name; }
/* Return the name of the function containing the current location. */
- const std::string &proc_name () const
- { return m_proc_name; }
+ const std::string &proc_name () const { return m_proc_name; }
/* Return the line number for the current location. */
- int line_no () const
- { return m_line_no; }
+ int line_no () const { return m_line_no; }
private:
diff --git a/gdb/tui/tui-out.h b/gdb/tui/tui-out.h
index ec7e02bb900..4b582fe5274 100644
--- a/gdb/tui/tui-out.h
+++ b/gdb/tui/tui-out.h
@@ -32,14 +32,14 @@ public:
protected:
- void do_field_signed (int fldno, int width, ui_align align, const char *fldname,
- LONGEST value) override;
- void do_field_string (int fldno, int width, ui_align align, const char *fldname,
- const char *string, const ui_file_style &style) override;
+ void do_field_signed (int fldno, int width, ui_align align,
+ const char *fldname, LONGEST value) override;
+ void do_field_string (int fldno, int width, ui_align align,
+ const char *fldname, const char *string,
+ const ui_file_style &style) override;
void do_field_fmt (int fldno, int width, ui_align align, const char *fldname,
- const ui_file_style &style,
- const char *format, va_list args) override
- ATTRIBUTE_PRINTF (7, 0);
+ const ui_file_style &style, const char *format,
+ va_list args) override ATTRIBUTE_PRINTF (7, 0);
void do_text (const char *string) override;
private:
diff --git a/gdb/tui/tui-regs.c b/gdb/tui/tui-regs.c
index 3e794aed224..542c4e0bcad 100644
--- a/gdb/tui/tui-regs.c
+++ b/gdb/tui/tui-regs.c
@@ -94,8 +94,7 @@ tui_register_format (frame_info_ptr frame, int regnum)
scoped_restore save_pagination
= make_scoped_restore (&pagination_enabled, false);
- scoped_restore save_stdout
- = make_scoped_restore (&gdb_stdout, &stream);
+ scoped_restore save_stdout = make_scoped_restore (&gdb_stdout, &stream);
gdbarch_print_registers_info (gdbarch, &stream, frame, regnum, 1);
@@ -111,8 +110,7 @@ tui_register_format (frame_info_ptr frame, int regnum)
display. When changep is set, check if the new register value has
changed with respect to the previous call. */
static void
-tui_get_register (frame_info_ptr frame,
- struct tui_data_item_window *data,
+tui_get_register (frame_info_ptr frame, struct tui_data_item_window *data,
int regnum, bool *changedp)
{
if (changedp)
@@ -201,14 +199,13 @@ tui_data_window::show_registers (const reggroup *group)
rerender ();
}
-
/* Set the data window to display the registers of the register group
using the given frame. Values are refreshed only when
refresh_values_only is true. */
void
tui_data_window::show_register_group (const reggroup *group,
- frame_info_ptr frame,
+ frame_info_ptr frame,
bool refresh_values_only)
{
struct gdbarch *gdbarch = get_frame_arch (frame);
@@ -297,8 +294,7 @@ tui_data_window::display_registers_from (int start_element_no)
int cur_y = 1;
while (i < m_regs_content.size () && cur_y <= height - 2)
{
- for (int j = 0;
- j < m_regs_column_count && i < m_regs_content.size ();
+ for (int j = 0; j < m_regs_column_count && i < m_regs_content.size ();
j++)
{
/* Create the window if necessary. */
@@ -306,9 +302,9 @@ tui_data_window::display_registers_from (int start_element_no)
m_regs_content[i].y = cur_y;
m_regs_content[i].visible = true;
m_regs_content[i].rerender (handle.get (), m_item_width);
- i++; /* Next register. */
+ i++; /* Next register. */
}
- cur_y++; /* Next row. */
+ cur_y++; /* Next row. */
}
/* Mark register windows below the visible area. */
@@ -374,7 +370,6 @@ tui_data_window::display_registers_from_line (int line_no)
return line_no;
}
-
/* Answer the index first element displayed. If none are displayed,
then return (-1). */
int
@@ -398,7 +393,6 @@ tui_data_window::delete_data_content_windows ()
win.visible = false;
}
-
void
tui_data_window::erase_data_content (const char *prompt)
{
@@ -424,7 +418,7 @@ void
tui_data_window::rerender ()
{
if (m_regs_content.empty ())
- erase_data_content (_("[ Register Values Unavailable ]"));
+ erase_data_content (_ ("[ Register Values Unavailable ]"));
else
{
erase_data_content (NULL);
@@ -433,7 +427,6 @@ tui_data_window::rerender ()
}
}
-
/* Scroll the data window vertically forward or backward. */
void
tui_data_window::do_scroll_vertical (int num_to_scroll)
@@ -474,8 +467,7 @@ tui_data_window::check_register_values (frame_info_ptr frame)
was_hilighted = data_item_win.highlight;
- tui_get_register (frame, &data_item_win,
- data_item_win.regno,
+ tui_get_register (frame, &data_item_win, data_item_win.regno,
&data_item_win.highlight);
/* Register windows whose y == 0 are outside the visible area. */
@@ -500,7 +492,7 @@ tui_data_item_window::rerender (WINDOW *handle, int field_width)
to code that causes the compiler to generate an unused-value
warning. */
(void) wstandout (handle);
-
+
mvwaddnstr (handle, y, x, content.c_str (), field_width - 1);
if (content.size () < field_width)
waddstr (handle, n_spaces (field_width - content.size ()));
@@ -598,22 +590,22 @@ tui_reg_command (const char *args, int from_tty)
if (strncmp (group->name (), args, len) == 0)
{
if (match != NULL)
- error (_("ambiguous register group name '%s'"), args);
+ error (_ ("ambiguous register group name '%s'"), args);
match = group;
}
}
}
if (match == NULL)
- error (_("unknown register group '%s'"), args);
+ error (_ ("unknown register group '%s'"), args);
TUI_DATA_WIN->show_registers (match);
}
else
{
- gdb_printf (_("\"tui reg\" must be followed by the name of "
- "either a register group,\nor one of 'next' "
- "or 'prev'. Known register groups are:\n"));
+ gdb_printf (_ ("\"tui reg\" must be followed by the name of "
+ "either a register group,\nor one of 'next' "
+ "or 'prev'. Known register groups are:\n"));
bool first = true;
for (const struct reggroup *group : gdbarch_reggroups (gdbarch))
@@ -633,10 +625,10 @@ tui_reg_command (const char *args, int from_tty)
static void
tui_reggroup_completer (struct cmd_list_element *ignore,
- completion_tracker &tracker,
- const char *text, const char *word)
+ completion_tracker &tracker, const char *text,
+ const char *word)
{
- static const char * const extra[] = { "next", "prev", NULL };
+ static const char *const extra[] = { "next", "prev", NULL };
reggroup_completer (ignore, tracker, text, word);
@@ -644,6 +636,7 @@ tui_reggroup_completer (struct cmd_list_element *ignore,
}
void _initialize_tui_regs ();
+
void
_initialize_tui_regs ()
{
@@ -651,9 +644,10 @@ _initialize_tui_regs ()
tuicmd = tui_get_cmd_list ();
- cmd = add_cmd ("reg", class_tui, tui_reg_command, _("\
+ cmd = add_cmd ("reg", class_tui, tui_reg_command, _ ("\
TUI command to control the register window.\n\
Usage: tui reg NAME\n\
-NAME is the name of the register group to display"), tuicmd);
+NAME is the name of the register group to display"),
+ tuicmd);
set_cmd_completer (cmd, tui_reggroup_completer);
}
diff --git a/gdb/tui/tui-regs.h b/gdb/tui/tui-regs.h
index 5adff6300aa..34afa846ee3 100644
--- a/gdb/tui/tui-regs.h
+++ b/gdb/tui/tui-regs.h
@@ -54,26 +54,19 @@ struct tui_data_window : public tui_win_info
DISABLE_COPY_AND_ASSIGN (tui_data_window);
- const char *name () const override
- {
- return DATA_NAME;
- }
+ const char *name () const override { return DATA_NAME; }
void check_register_values (frame_info_ptr frame);
void show_registers (const reggroup *group);
- const reggroup *get_current_group () const
- {
- return m_current_group;
- }
+ const reggroup *get_current_group () const { return m_current_group; }
protected:
void do_scroll_vertical (int num_to_scroll) override;
- void do_scroll_horizontal (int num_to_scroll) override
- {
- }
+
+ void do_scroll_horizontal (int num_to_scroll) override {}
void rerender () override;
@@ -100,8 +93,7 @@ private:
display off the end of the register display. */
void display_reg_element_at_line (int start_element_no, int start_line_no);
- void show_register_group (const reggroup *group,
- frame_info_ptr frame,
+ void show_register_group (const reggroup *group, frame_info_ptr frame,
bool refresh_values_only);
/* Answer the number of the last line in the regs display. If there
diff --git a/gdb/tui/tui-source.c b/gdb/tui/tui-source.c
index 73d44417533..2833b5ea259 100644
--- a/gdb/tui/tui-source.c
+++ b/gdb/tui/tui-source.c
@@ -104,7 +104,8 @@ tui_source_window::set_contents (struct gdbarch *arch,
element->line_or_addr.u.line_no = cur_line_no;
element->is_exec_point
= (filename_cmp (tui_location.full_name ().c_str (),
- symtab_to_fullname (s)) == 0
+ symtab_to_fullname (s))
+ == 0
&& cur_line_no == tui_location.line_no ());
m_content[cur_line].line = std::move (text);
@@ -116,18 +117,16 @@ tui_source_window::set_contents (struct gdbarch *arch,
return true;
}
-
/* Answer whether the source is currently displayed in the source
window. */
bool
tui_source_window::showing_source_p (const char *fullname) const
{
return (!m_content.empty ()
- && (filename_cmp (tui_location.full_name ().c_str (),
- fullname) == 0));
+ && (filename_cmp (tui_location.full_name ().c_str (), fullname)
+ == 0));
}
-
/* Scroll the source forward or backward vertically. */
void
tui_source_window::do_scroll_vertical (int num_to_scroll)
@@ -168,8 +167,8 @@ tui_source_window::location_matches_p (struct bp_location *loc, int line_no)
return (m_content[line_no].line_or_addr.loa == LOA_LINE
&& m_content[line_no].line_or_addr.u.line_no == loc->line_number
&& loc->symtab != NULL
- && filename_cmp (m_fullname.get (),
- symtab_to_fullname (loc->symtab)) == 0);
+ && filename_cmp (m_fullname.get (), symtab_to_fullname (loc->symtab))
+ == 0);
}
/* See tui-source.h. */
@@ -197,8 +196,8 @@ tui_source_window::maybe_update (frame_info_ptr fi, symtab_and_line sal)
if (start_line <= 0)
start_line = 1;
- bool source_already_displayed = (sal.symtab != 0
- && showing_source_p (m_fullname.get ()));
+ bool source_already_displayed
+ = (sal.symtab != 0 && showing_source_p (m_fullname.get ()));
if (!(source_already_displayed && line_is_displayed (sal.line)))
{
diff --git a/gdb/tui/tui-source.h b/gdb/tui/tui-source.h
index 413cfa3deaa..dcbad43b9ce 100644
--- a/gdb/tui/tui-source.h
+++ b/gdb/tui/tui-source.h
@@ -35,10 +35,7 @@ struct tui_source_window : public tui_source_window_base
DISABLE_COPY_AND_ASSIGN (tui_source_window);
- const char *name () const override
- {
- return SRC_NAME;
- }
+ const char *name () const override { return SRC_NAME; }
/* Return true if the location LOC corresponds to the line number
LINE_NO in this source window; false otherwise. */
@@ -50,7 +47,7 @@ struct tui_source_window : public tui_source_window_base
void erase_source_content () override
{
- do_erase_source_content (_("[ No Source Available ]"));
+ do_erase_source_content (_ ("[ No Source Available ]"));
}
void display_start_addr (struct gdbarch **gdbarch_p,
@@ -63,10 +60,7 @@ protected:
bool set_contents (struct gdbarch *gdbarch,
const struct symtab_and_line &sal) override;
- int extra_margin () const override
- {
- return m_digits;
- }
+ int extra_margin () const override { return m_digits; }
void show_line_number (int lineno) const override;
diff --git a/gdb/tui/tui-stack.c b/gdb/tui/tui-stack.c
index 0a750187c26..bba7776752d 100644
--- a/gdb/tui/tui-stack.c
+++ b/gdb/tui/tui-stack.c
@@ -40,22 +40,21 @@
#include "gdb_curses.h"
-#define PROC_PREFIX "In: "
-#define LINE_PREFIX "L"
-#define PC_PREFIX "PC: "
+#define PROC_PREFIX "In: "
+#define LINE_PREFIX "L"
+#define PC_PREFIX "PC: "
/* Strings to display in the TUI status line. */
-#define SINGLE_KEY "(SingleKey)"
+#define SINGLE_KEY "(SingleKey)"
/* Minimum/Maximum length of some fields displayed in the TUI status
line. */
-#define MIN_LINE_WIDTH 4 /* Use at least 4 digits for line
+#define MIN_LINE_WIDTH \
+ 4 /* Use at least 4 digits for line
numbers. */
-#define MIN_PROC_WIDTH 12
-#define MAX_TARGET_WIDTH 10
-#define MAX_PID_WIDTH 19
-
-
+#define MIN_PROC_WIDTH 12
+#define MAX_TARGET_WIDTH 10
+#define MAX_PID_WIDTH 19
std::string
tui_locator_window::make_status_line () const
@@ -100,24 +99,20 @@ tui_locator_window::make_status_line () const
/* Translate PC address. */
struct gdbarch *gdbarch = tui_location.gdbarch ();
CORE_ADDR addr = tui_location.addr ();
- std::string pc_out (gdbarch
- ? paddress (gdbarch, addr)
- : "??");
+ std::string pc_out (gdbarch ? paddress (gdbarch, addr) : "??");
const char *pc_buf = pc_out.c_str ();
int pc_width = pc_out.size ();
/* First determine the amount of proc name width we have available.
The +1 are for a space separator between fields.
The -1 are to take into account the \0 counted by sizeof. */
- proc_width = (status_size
- - (target_width + 1)
- - (pid_width + 1)
+ proc_width = (status_size - (target_width + 1) - (pid_width + 1)
- (sizeof (PROC_PREFIX) - 1 + 1)
- (sizeof (LINE_PREFIX) - 1 + line_width + 1)
- (sizeof (PC_PREFIX) - 1 + pc_width + 1)
- (tui_current_key_mode == TUI_SINGLE_KEY_MODE
- ? (sizeof (SINGLE_KEY) - 1 + 1)
- : 0));
+ ? (sizeof (SINGLE_KEY) - 1 + 1)
+ : 0));
/* If there is no room to print the function name, try by removing
some fields. */
@@ -165,16 +160,15 @@ tui_locator_window::make_status_line () const
{
const std::string &proc_name = tui_location.proc_name ();
if (proc_name.size () > proc_width)
- string.printf ("%s%*.*s* ", PROC_PREFIX,
- 1 - proc_width, proc_width - 1, proc_name.c_str ());
+ string.printf ("%s%*.*s* ", PROC_PREFIX, 1 - proc_width,
+ proc_width - 1, proc_name.c_str ());
else
- string.printf ("%s%*.*s ", PROC_PREFIX,
- -proc_width, proc_width, proc_name.c_str ());
+ string.printf ("%s%*.*s ", PROC_PREFIX, -proc_width, proc_width,
+ proc_name.c_str ());
}
if (line_width > 0)
- string.printf ("%s%*.*s ", LINE_PREFIX,
- -line_width, line_width, line_buf);
+ string.printf ("%s%*.*s ", LINE_PREFIX, -line_width, line_width, line_buf);
if (pc_width > 0)
{
string.puts (PC_PREFIX);
@@ -194,14 +188,14 @@ tui_locator_window::make_status_line () const
/* Get a printable name for the function at the address. The symbol
name is demangled if demangling is turned on. Returns a pointer to
a static area holding the result. */
-static char*
+static char *
tui_get_function_from_frame (frame_info_ptr fi)
{
static char name[256];
string_file stream;
- print_address_symbolic (get_frame_arch (fi), get_frame_pc (fi),
- &stream, demangle, "");
+ print_address_symbolic (get_frame_arch (fi), get_frame_pc (fi), &stream,
+ demangle, "");
/* Use simple heuristics to isolate the function name. The symbol
can be demangled and we can have function parameters. Remove
@@ -265,7 +259,7 @@ tui_show_frame_info (frame_info_ptr fi)
if (get_frame_pc_if_available (fi, &sal.pc))
func_name = tui_get_function_from_frame (fi);
else
- func_name = _("<unavailable>");
+ func_name = _ ("<unavailable>");
locator_changed_p
= tui_location.set_location (get_frame_arch (fi), sal, func_name);
@@ -316,11 +310,12 @@ tui_update_command (const char *arg, int from_tty)
manipulation. */
void _initialize_tui_stack ();
+
void
_initialize_tui_stack ()
{
add_com ("update", class_tui, tui_update_command,
- _("Update the source window and locator to "
- "display the current execution point.\n\
+ _ ("Update the source window and locator to "
+ "display the current execution point.\n\
Usage: update"));
}
diff --git a/gdb/tui/tui-stack.h b/gdb/tui/tui-stack.h
index d542f215771..c22fdfd3fc9 100644
--- a/gdb/tui/tui-stack.h
+++ b/gdb/tui/tui-stack.h
@@ -32,42 +32,23 @@ struct tui_locator_window : public tui_win_info
{
tui_locator_window () = default;
- const char *name () const override
- {
- return STATUS_NAME;
- }
-
- int max_height () const override
- {
- return 1;
- }
-
- int min_height () const override
- {
- return 1;
- }
-
- bool can_box () const override
- {
- return false;
- }
-
- bool can_focus () const override
- {
- return false;
- }
+ const char *name () const override { return STATUS_NAME; }
+
+ int max_height () const override { return 1; }
+
+ int min_height () const override { return 1; }
+
+ bool can_box () const override { return false; }
+
+ bool can_focus () const override { return false; }
void rerender () override;
protected:
- void do_scroll_vertical (int n) override
- {
- }
+ void do_scroll_vertical (int n) override {}
- void do_scroll_horizontal (int n) override
- {
- }
+ void do_scroll_horizontal (int n) override {}
private:
diff --git a/gdb/tui/tui-win.c b/gdb/tui/tui-win.c
index 008189eb99b..846b61766ed 100644
--- a/gdb/tui/tui-win.c
+++ b/gdb/tui/tui-win.c
@@ -64,49 +64,35 @@ static void tui_scroll_forward_command (const char *, int);
static void tui_scroll_backward_command (const char *, int);
static void tui_scroll_left_command (const char *, int);
static void tui_scroll_right_command (const char *, int);
-static void parse_scrolling_args (const char *,
- struct tui_win_info **,
- int *);
-
+static void parse_scrolling_args (const char *, struct tui_win_info **, int *);
#ifndef ACS_LRCORNER
-# define ACS_LRCORNER '+'
+#define ACS_LRCORNER '+'
#endif
#ifndef ACS_LLCORNER
-# define ACS_LLCORNER '+'
+#define ACS_LLCORNER '+'
#endif
#ifndef ACS_ULCORNER
-# define ACS_ULCORNER '+'
+#define ACS_ULCORNER '+'
#endif
#ifndef ACS_URCORNER
-# define ACS_URCORNER '+'
+#define ACS_URCORNER '+'
#endif
#ifndef ACS_HLINE
-# define ACS_HLINE '-'
+#define ACS_HLINE '-'
#endif
#ifndef ACS_VLINE
-# define ACS_VLINE '|'
+#define ACS_VLINE '|'
#endif
/* Possible values for tui-border-kind variable. */
-static const char *const tui_border_kind_enums[] = {
- "space",
- "ascii",
- "acs",
- NULL
-};
+static const char *const tui_border_kind_enums[]
+ = { "space", "ascii", "acs", NULL };
/* Possible values for tui-border-mode and tui-active-border-mode. */
-static const char *const tui_border_mode_enums[] = {
- "normal",
- "standout",
- "reverse",
- "half",
- "half-standout",
- "bold",
- "bold-standout",
- NULL
-};
+static const char *const tui_border_mode_enums[]
+ = { "normal", "standout", "reverse", "half",
+ "half-standout", "bold", "bold-standout", NULL };
struct tui_translate
{
@@ -117,104 +103,93 @@ struct tui_translate
/* Translation table for border-mode variables.
The list of values must be terminated by a NULL.
After the NULL value, an entry defines the default. */
-static struct tui_translate tui_border_mode_translate[] = {
- { "normal", A_NORMAL },
- { "standout", A_STANDOUT },
- { "reverse", A_REVERSE },
- { "half", A_DIM },
- { "half-standout", A_DIM | A_STANDOUT },
- { "bold", A_BOLD },
- { "bold-standout", A_BOLD | A_STANDOUT },
- { 0, 0 },
- { "normal", A_NORMAL }
-};
+static struct tui_translate tui_border_mode_translate[]
+ = { { "normal", A_NORMAL },
+ { "standout", A_STANDOUT },
+ { "reverse", A_REVERSE },
+ { "half", A_DIM },
+ { "half-standout", A_DIM | A_STANDOUT },
+ { "bold", A_BOLD },
+ { "bold-standout", A_BOLD | A_STANDOUT },
+ { 0, 0 },
+ { "normal", A_NORMAL } };
/* Translation tables for border-kind, one for each border
character (see wborder, border curses operations).
-1 is used to indicate the ACS because ACS characters
are determined at run time by curses (depends on terminal). */
-static struct tui_translate tui_border_kind_translate_vline[] = {
- { "space", ' ' },
- { "ascii", '|' },
- { "acs", -1 },
- { 0, 0 },
- { "ascii", '|' }
-};
-
-static struct tui_translate tui_border_kind_translate_hline[] = {
- { "space", ' ' },
- { "ascii", '-' },
- { "acs", -1 },
- { 0, 0 },
- { "ascii", '-' }
-};
-
-static struct tui_translate tui_border_kind_translate_ulcorner[] = {
- { "space", ' ' },
- { "ascii", '+' },
- { "acs", -1 },
- { 0, 0 },
- { "ascii", '+' }
-};
-
-static struct tui_translate tui_border_kind_translate_urcorner[] = {
- { "space", ' ' },
- { "ascii", '+' },
- { "acs", -1 },
- { 0, 0 },
- { "ascii", '+' }
-};
-
-static struct tui_translate tui_border_kind_translate_llcorner[] = {
- { "space", ' ' },
- { "ascii", '+' },
- { "acs", -1 },
- { 0, 0 },
- { "ascii", '+' }
-};
-
-static struct tui_translate tui_border_kind_translate_lrcorner[] = {
- { "space", ' ' },
- { "ascii", '+' },
- { "acs", -1 },
- { 0, 0 },
- { "ascii", '+' }
-};
-
+static struct tui_translate tui_border_kind_translate_vline[]
+ = { { "space", ' ' },
+ { "ascii", '|' },
+ { "acs", -1 },
+ { 0, 0 },
+ { "ascii", '|' } };
+
+static struct tui_translate tui_border_kind_translate_hline[]
+ = { { "space", ' ' },
+ { "ascii", '-' },
+ { "acs", -1 },
+ { 0, 0 },
+ { "ascii", '-' } };
+
+static struct tui_translate tui_border_kind_translate_ulcorner[]
+ = { { "space", ' ' },
+ { "ascii", '+' },
+ { "acs", -1 },
+ { 0, 0 },
+ { "ascii", '+' } };
+
+static struct tui_translate tui_border_kind_translate_urcorner[]
+ = { { "space", ' ' },
+ { "ascii", '+' },
+ { "acs", -1 },
+ { 0, 0 },
+ { "ascii", '+' } };
+
+static struct tui_translate tui_border_kind_translate_llcorner[]
+ = { { "space", ' ' },
+ { "ascii", '+' },
+ { "acs", -1 },
+ { 0, 0 },
+ { "ascii", '+' } };
+
+static struct tui_translate tui_border_kind_translate_lrcorner[]
+ = { { "space", ' ' },
+ { "ascii", '+' },
+ { "acs", -1 },
+ { 0, 0 },
+ { "ascii", '+' } };
/* Tui configuration variables controlled with set/show command. */
static const char *tui_active_border_mode = "bold-standout";
+
static void
-show_tui_active_border_mode (struct ui_file *file,
- int from_tty,
- struct cmd_list_element *c,
- const char *value)
+show_tui_active_border_mode (struct ui_file *file, int from_tty,
+ struct cmd_list_element *c, const char *value)
{
- gdb_printf (file, _("\
+ gdb_printf (file, _ ("\
The attribute mode to use for the active TUI window border is \"%s\".\n"),
value);
}
static const char *tui_border_mode = "normal";
+
static void
-show_tui_border_mode (struct ui_file *file,
- int from_tty,
- struct cmd_list_element *c,
- const char *value)
+show_tui_border_mode (struct ui_file *file, int from_tty,
+ struct cmd_list_element *c, const char *value)
{
- gdb_printf (file, _("\
+ gdb_printf (file, _ ("\
The attribute mode to use for the TUI window borders is \"%s\".\n"),
value);
}
static const char *tui_border_kind = "acs";
+
static void
-show_tui_border_kind (struct ui_file *file,
- int from_tty,
- struct cmd_list_element *c,
- const char *value)
+show_tui_border_kind (struct ui_file *file, int from_tty,
+ struct cmd_list_element *c, const char *value)
{
- gdb_printf (file, _("The kind of border for TUI windows is \"%s\".\n"),
+ gdb_printf (file, _ ("The kind of border for TUI windows is \"%s\".\n"),
value);
}
@@ -223,14 +198,12 @@ show_tui_border_kind (struct ui_file *file,
bool style_tui_current_position = false;
static void
-show_style_tui_current_position (ui_file *file,
- int from_tty,
- cmd_list_element *c,
- const char *value)
+show_style_tui_current_position (ui_file *file, int from_tty,
+ cmd_list_element *c, const char *value)
{
- gdb_printf (file, _("\
+ gdb_printf (file, _ ("\
Styling the text highlighted by the TUI's current position indicator is %s.\n"),
- value);
+ value);
}
static void
@@ -329,8 +302,8 @@ tui_get_cmd_list (void)
{
if (tuilist == 0)
add_basic_prefix_cmd ("tui", class_tui,
- _("Text User Interface commands."),
- &tuilist, 0, &cmdlist);
+ _ ("Text User Interface commands."), &tuilist, 0,
+ &cmdlist);
return &tuilist;
}
@@ -338,15 +311,13 @@ tui_get_cmd_list (void)
borders on the TUI display. */
static void
-tui_set_var_cmd (const char *null_args,
- int from_tty, struct cmd_list_element *c)
+tui_set_var_cmd (const char *null_args, int from_tty,
+ struct cmd_list_element *c)
{
if (tui_update_variables () && tui_active)
tui_rehighlight_all ();
}
-
-
/* True if TUI resizes should print a message. This is used by the
test suite. */
@@ -356,11 +327,9 @@ static void
show_tui_resize_message (struct ui_file *file, int from_tty,
struct cmd_list_element *c, const char *value)
{
- gdb_printf (file, _("TUI resize messaging is %s.\n"), value);
+ gdb_printf (file, _ ("TUI resize messaging is %s.\n"), value);
}
-
-
/* Generic window name completion function. Complete window name pointed
to by TEXT and WORD.
@@ -372,10 +341,9 @@ show_tui_resize_message (struct ui_file *file, int from_tty,
name. This is independent of EXCLUDE_CANNOT_FOCUS_P. */
static void
-window_name_completer (completion_tracker &tracker,
- bool include_next_prev_p,
- bool exclude_cannot_focus_p,
- const char *text, const char *word)
+window_name_completer (completion_tracker &tracker, bool include_next_prev_p,
+ bool exclude_cannot_focus_p, const char *text,
+ const char *word)
{
std::vector<const char *> completion_name_vec;
@@ -412,7 +380,6 @@ window_name_completer (completion_tracker &tracker,
completion_name_vec.push_back ("prev");
}
-
completion_name_vec.push_back (NULL);
complete_on_enum (tracker, completion_name_vec.data (), text, word);
}
@@ -421,8 +388,7 @@ window_name_completer (completion_tracker &tracker,
entered so far, WORD is the word currently being completed. */
static void
-focus_completer (struct cmd_list_element *ignore,
- completion_tracker &tracker,
+focus_completer (struct cmd_list_element *ignore, completion_tracker &tracker,
const char *text, const char *word)
{
window_name_completer (tracker, true, true, text, word);
@@ -434,8 +400,8 @@ focus_completer (struct cmd_list_element *ignore,
static void
winheight_completer (struct cmd_list_element *ignore,
- completion_tracker &tracker,
- const char *text, const char *word)
+ completion_tracker &tracker, const char *text,
+ const char *word)
{
/* The first word is the window name. That we can complete. Subsequent
words can't be completed. */
@@ -465,7 +431,6 @@ tui_update_gdb_sizes (void)
set_screen_width_and_height (width, height);
}
-
void
tui_win_info::forward_scroll (int num_to_scroll)
{
@@ -484,7 +449,6 @@ tui_win_info::backward_scroll (int num_to_scroll)
do_scroll_vertical (-num_to_scroll);
}
-
void
tui_win_info::left_scroll (int num_to_scroll)
{
@@ -494,7 +458,6 @@ tui_win_info::left_scroll (int num_to_scroll)
do_scroll_horizontal (num_to_scroll);
}
-
void
tui_win_info::right_scroll (int num_to_scroll)
{
@@ -504,7 +467,6 @@ tui_win_info::right_scroll (int num_to_scroll)
do_scroll_horizontal (-num_to_scroll);
}
-
void
tui_refresh_all_win (void)
{
@@ -534,7 +496,7 @@ tui_resize_all (void)
{
#ifdef HAVE_RESIZE_TERM
resize_term (screenheight, screenwidth);
-#endif
+#endif
/* Turn keypad off while we resize. */
keypad (TUI_CMD_WIN->handle.get (), FALSE);
tui_update_gdb_sizes ();
@@ -606,9 +568,8 @@ void
tui_initialize_win (void)
{
#ifdef SIGWINCH
- tui_sigwinch_token
- = create_async_signal_handler (tui_async_resize_screen, NULL,
- "tui-sigwinch");
+ tui_sigwinch_token = create_async_signal_handler (tui_async_resize_screen,
+ NULL, "tui-sigwinch");
{
#ifdef HAVE_SIGACTION
@@ -627,7 +588,6 @@ tui_initialize_win (void)
#endif
}
-
static void
tui_scroll_forward_command (const char *arg, int from_tty)
{
@@ -643,7 +603,6 @@ tui_scroll_forward_command (const char *arg, int from_tty)
win_to_scroll->forward_scroll (num_to_scroll);
}
-
static void
tui_scroll_backward_command (const char *arg, int from_tty)
{
@@ -659,7 +618,6 @@ tui_scroll_backward_command (const char *arg, int from_tty)
win_to_scroll->backward_scroll (num_to_scroll);
}
-
static void
tui_scroll_left_command (const char *arg, int from_tty)
{
@@ -672,7 +630,6 @@ tui_scroll_left_command (const char *arg, int from_tty)
win_to_scroll->left_scroll (num_to_scroll);
}
-
static void
tui_scroll_right_command (const char *arg, int from_tty)
{
@@ -685,7 +642,6 @@ tui_scroll_right_command (const char *arg, int from_tty)
win_to_scroll->right_scroll (num_to_scroll);
}
-
/* Answer the window represented by name. */
static struct tui_win_info *
tui_partial_win_by_name (gdb::string_view name)
@@ -701,8 +657,8 @@ tui_partial_win_by_name (gdb::string_view name)
if (startswith (cur_name, name))
{
if (best != nullptr)
- error (_("Window name \"%*s\" is ambiguous"),
- (int) name.size (), name.data ());
+ error (_ ("Window name \"%*s\" is ambiguous"), (int) name.size (),
+ name.data ());
best = item;
}
}
@@ -717,7 +673,7 @@ tui_set_focus_command (const char *arg, int from_tty)
tui_enable ();
if (arg == NULL)
- error_no_arg (_("name of window to focus"));
+ error_no_arg (_ ("name of window to focus"));
struct tui_win_info *win_info = NULL;
@@ -757,14 +713,14 @@ tui_set_focus_command (const char *arg, int from_tty)
if (!matching_window_name.empty ())
{
if (is_ambiguous)
- error (_("No windows matching \"%s\" in the current layout"),
+ error (_ ("No windows matching \"%s\" in the current layout"),
arg);
else
- error (_("Window \"%s\" is not in the current layout"),
+ error (_ ("Window \"%s\" is not in the current layout"),
matching_window_name.c_str ());
}
else
- error (_("Unrecognized window name \"%s\""), arg);
+ error (_ ("Unrecognized window name \"%s\""), arg);
}
/* If a window is part of the current layout then it will have a
@@ -773,11 +729,10 @@ tui_set_focus_command (const char *arg, int from_tty)
gdb_assert (win_info->is_visible ());
if (!win_info->can_focus ())
- error (_("Window \"%s\" cannot be focused"), arg);
+ error (_ ("Window \"%s\" cannot be focused"), arg);
tui_set_win_focus_to (win_info);
- gdb_printf (_("Focus set to %s window.\n"),
- tui_win_with_focus ()->name ());
+ gdb_printf (_ ("Focus set to %s window.\n"), tui_win_with_focus ()->name ());
}
static void
@@ -785,7 +740,7 @@ tui_all_windows_info (const char *arg, int from_tty)
{
if (!tui_active)
{
- gdb_printf (_("The TUI is not active.\n"));
+ gdb_printf (_ ("The TUI is not active.\n"));
return;
}
@@ -808,14 +763,13 @@ tui_all_windows_info (const char *arg, int from_tty)
uiout->field_signed ("lines", win_info->height);
uiout->field_signed ("columns", win_info->width);
if (win_with_focus == win_info)
- uiout->field_string ("focus", _("(has focus)"));
+ uiout->field_string ("focus", _ ("(has focus)"));
else
uiout->field_skip ("focus");
uiout->text ("\n");
}
}
-
static void
tui_refresh_all_command (const char *arg, int from_tty)
{
@@ -825,7 +779,7 @@ tui_refresh_all_command (const char *arg, int from_tty)
tui_refresh_all_win ();
}
-#define DEFAULT_TAB_LEN 8
+#define DEFAULT_TAB_LEN 8
/* The tab width that should be used by the TUI. */
@@ -851,13 +805,13 @@ update_tab_width ()
/* Callback for "set tui tab-width". */
static void
-tui_set_tab_width (const char *ignore,
- int from_tty, struct cmd_list_element *c)
+tui_set_tab_width (const char *ignore, int from_tty,
+ struct cmd_list_element *c)
{
if (internal_tab_width == 0)
{
internal_tab_width = tui_tab_width;
- error (_("Tab width must not be 0"));
+ error (_ ("Tab width must not be 0"));
}
tui_tab_width = internal_tab_width;
@@ -870,8 +824,7 @@ static void
tui_show_tab_width (struct ui_file *file, int from_tty,
struct cmd_list_element *c, const char *value)
{
- gdb_printf (file, _("TUI tab width is %s spaces.\n"), value);
-
+ gdb_printf (file, _ ("TUI tab width is %s spaces.\n"), value);
}
/* See tui-win.h. */
@@ -894,7 +847,7 @@ static void
tui_show_compact_source (struct ui_file *file, int from_tty,
struct cmd_list_element *c, const char *value)
{
- gdb_printf (file, _("TUI source window compactness is %s.\n"), value);
+ gdb_printf (file, _ ("TUI source window compactness is %s.\n"), value);
}
/* Set the tab width of the specified window. */
@@ -909,7 +862,7 @@ tui_set_tab_width_command (const char *arg, int from_tty)
ts = atoi (arg);
if (ts <= 0)
- warning (_("Tab widths greater than 0 must be specified."));
+ warning (_ ("Tab widths greater than 0 must be specified."));
else
{
internal_tab_width = ts;
@@ -939,7 +892,7 @@ tui_set_win_size (const char *arg, bool set_width_p)
/* Make sure the curses mode is enabled. */
tui_enable ();
if (arg == NULL)
- error_no_arg (_("name of window"));
+ error_no_arg (_ ("name of window"));
const char *buf = arg;
const char *buf_ptr = buf;
@@ -953,9 +906,9 @@ tui_set_win_size (const char *arg, bool set_width_p)
win_info = tui_partial_win_by_name (wname);
if (win_info == NULL)
- error (_("Unrecognized window name \"%s\""), arg);
+ error (_ ("Unrecognized window name \"%s\""), arg);
if (!win_info->is_visible ())
- error (_("Window \"%s\" is not visible"), arg);
+ error (_ ("Window \"%s\" is not visible"), arg);
/* Process the size. */
buf_ptr = skip_spaces (buf_ptr);
@@ -964,7 +917,8 @@ tui_set_win_size (const char *arg, bool set_width_p)
{
bool negate = false;
bool fixed_size = true;
- int input_no;;
+ int input_no;
+ ;
if (*buf_ptr == '+' || *buf_ptr == '-')
{
@@ -1001,9 +955,9 @@ tui_set_win_size (const char *arg, bool set_width_p)
else
{
if (set_width_p)
- error (_("Invalid window width specified"));
+ error (_ ("Invalid window width specified"));
else
- error (_("Invalid window height specified"));
+ error (_ ("Invalid window height specified"));
}
}
}
@@ -1043,8 +997,7 @@ tui_win_info::max_width () const
}
static void
-parse_scrolling_args (const char *arg,
- struct tui_win_info **win_to_scroll,
+parse_scrolling_args (const char *arg, struct tui_win_info **win_to_scroll,
int *num_to_scroll)
{
if (num_to_scroll)
@@ -1089,9 +1042,9 @@ parse_scrolling_args (const char *arg,
*win_to_scroll = tui_partial_win_by_name (wname);
if (*win_to_scroll == NULL)
- error (_("Unrecognized window `%s'"), wname);
+ error (_ ("Unrecognized window `%s'"), wname);
if (!(*win_to_scroll)->is_visible ())
- error (_("Window is not visible"));
+ error (_ ("Window is not visible"));
else if (*win_to_scroll == TUI_CMD_WIN)
*win_to_scroll = *(tui_source_windows ().begin ());
}
@@ -1115,6 +1068,7 @@ tui_window_command (const char *args, int from_tty)
manipulation. */
void _initialize_tui_win ();
+
void
_initialize_tui_win ()
{
@@ -1123,31 +1077,28 @@ _initialize_tui_win ()
/* Define the classes of commands.
They will appear in the help list in the reverse of this order. */
- add_setshow_prefix_cmd ("tui", class_tui,
- _("TUI configuration variables."),
- _("TUI configuration variables."),
- &tui_setlist, &tui_showlist,
- &setlist, &showlist);
+ add_setshow_prefix_cmd ("tui", class_tui, _ ("TUI configuration variables."),
+ _ ("TUI configuration variables."), &tui_setlist,
+ &tui_showlist, &setlist, &showlist);
cmd_list_element *refresh_cmd
= add_cmd ("refresh", class_tui, tui_refresh_all_command,
- _("Refresh the terminal display."),
- tui_get_cmd_list ());
+ _ ("Refresh the terminal display."), tui_get_cmd_list ());
add_com_alias ("refresh", refresh_cmd, class_tui, 0);
cmd_list_element *tabset_cmd
- = add_com ("tabset", class_tui, tui_set_tab_width_command, _("\
+ = add_com ("tabset", class_tui, tui_set_tab_width_command, _ ("\
Set the width (in characters) of tab stops.\n\
Usage: tabset N"));
deprecate_cmd (tabset_cmd, "set tui tab-width");
/* Setup the 'tui window' list of command. */
add_prefix_cmd ("window", class_tui, tui_window_command,
- _("Text User Interface window commands."),
- &tui_window_cmds, 1, tui_get_cmd_list ());
+ _ ("Text User Interface window commands."), &tui_window_cmds,
+ 1, tui_get_cmd_list ());
cmd_list_element *winheight_cmd
- = add_cmd ("height", class_tui, tui_set_win_height_command, _("\
+ = add_cmd ("height", class_tui, tui_set_win_height_command, _ ("\
Set or modify the height of a specified window.\n\
Usage: tui window height WINDOW-NAME [+ | -] NUM-LINES\n\
Use \"info win\" to see the names of the windows currently being displayed."),
@@ -1157,7 +1108,7 @@ Use \"info win\" to see the names of the windows currently being displayed."),
set_cmd_completer (winheight_cmd, winheight_completer);
cmd_list_element *winwidth_cmd
- = add_cmd ("width", class_tui, tui_set_win_width_command, _("\
+ = add_cmd ("width", class_tui, tui_set_win_width_command, _ ("\
Set or modify the width of a specified window.\n\
Usage: tui window width WINDOW-NAME [+ | -] NUM-LINES\n\
Use \"info win\" to see the names of the windows currently being displayed."),
@@ -1165,11 +1116,10 @@ Use \"info win\" to see the names of the windows currently being displayed."),
add_com_alias ("winwidth", winwidth_cmd, class_tui, 0);
set_cmd_completer (winwidth_cmd, winheight_completer);
- add_info ("win", tui_all_windows_info,
- _("List of all displayed windows.\n\
+ add_info ("win", tui_all_windows_info, _ ("List of all displayed windows.\n\
Usage: info win"));
cmd_list_element *focus_cmd
- = add_cmd ("focus", class_tui, tui_set_focus_command, _("\
+ = add_cmd ("focus", class_tui, tui_set_focus_command, _ ("\
Set focus to named window or next/prev window.\n\
Usage: tui focus [WINDOW-NAME | next | prev]\n\
Use \"info win\" to see the names of the windows currently being displayed."),
@@ -1177,22 +1127,22 @@ Use \"info win\" to see the names of the windows currently being displayed."),
add_com_alias ("focus", focus_cmd, class_tui, 0);
add_com_alias ("fs", focus_cmd, class_tui, 0);
set_cmd_completer (focus_cmd, focus_completer);
- add_com ("+", class_tui, tui_scroll_forward_command, _("\
+ add_com ("+", class_tui, tui_scroll_forward_command, _ ("\
Scroll window forward.\n\
Usage: + [N] [WIN]\n\
Scroll window WIN N lines forwards. Both WIN and N are optional, N\n\
defaults to 1, and WIN defaults to the currently focused window."));
- add_com ("-", class_tui, tui_scroll_backward_command, _("\
+ add_com ("-", class_tui, tui_scroll_backward_command, _ ("\
Scroll window backward.\n\
Usage: - [N] [WIN]\n\
Scroll window WIN N lines backwards. Both WIN and N are optional, N\n\
defaults to 1, and WIN defaults to the currently focused window."));
- add_com ("<", class_tui, tui_scroll_left_command, _("\
+ add_com ("<", class_tui, tui_scroll_left_command, _ ("\
Scroll window text to the left.\n\
Usage: < [N] [WIN]\n\
Scroll window WIN N characters left. Both WIN and N are optional, N\n\
defaults to 1, and WIN defaults to the currently focused window."));
- add_com (">", class_tui, tui_scroll_right_command, _("\
+ add_com (">", class_tui, tui_scroll_right_command, _ ("\
Scroll window text to the right.\n\
Usage: > [N] [WIN]\n\
Scroll window WIN N characters right. Both WIN and N are optional, N\n\
@@ -1200,21 +1150,24 @@ defaults to 1, and WIN defaults to the currently focused window."));
/* Define the tui control variables. */
add_setshow_enum_cmd ("border-kind", no_class, tui_border_kind_enums,
- &tui_border_kind, _("\
-Set the kind of border for TUI windows."), _("\
-Show the kind of border for TUI windows."), _("\
+ &tui_border_kind, _ ("\
+Set the kind of border for TUI windows."),
+ _ ("\
+Show the kind of border for TUI windows."),
+ _ ("\
This variable controls the border of TUI windows:\n\
space use a white space\n\
ascii use ascii characters + - | for the border\n\
acs use the Alternate Character Set"),
- tui_set_var_cmd,
- show_tui_border_kind,
- &tui_setlist, &tui_showlist);
+ tui_set_var_cmd, show_tui_border_kind, &tui_setlist,
+ &tui_showlist);
add_setshow_enum_cmd ("border-mode", no_class, tui_border_mode_enums,
- &tui_border_mode, _("\
-Set the attribute mode to use for the TUI window borders."), _("\
-Show the attribute mode to use for the TUI window borders."), _("\
+ &tui_border_mode, _ ("\
+Set the attribute mode to use for the TUI window borders."),
+ _ ("\
+Show the attribute mode to use for the TUI window borders."),
+ _ ("\
This variable controls the attributes to use for the window borders:\n\
normal normal display\n\
standout use highlight mode of terminal\n\
@@ -1223,14 +1176,15 @@ This variable controls the attributes to use for the window borders:\n\
half-standout use half bright and standout mode\n\
bold use extra bright or bold\n\
bold-standout use extra bright or bold with standout mode"),
- tui_set_var_cmd,
- show_tui_border_mode,
- &tui_setlist, &tui_showlist);
+ tui_set_var_cmd, show_tui_border_mode, &tui_setlist,
+ &tui_showlist);
add_setshow_enum_cmd ("active-border-mode", no_class, tui_border_mode_enums,
- &tui_active_border_mode, _("\
-Set the attribute mode to use for the active TUI window border."), _("\
-Show the attribute mode to use for the active TUI window border."), _("\
+ &tui_active_border_mode, _ ("\
+Set the attribute mode to use for the active TUI window border."),
+ _ ("\
+Show the attribute mode to use for the active TUI window border."),
+ _ ("\
This variable controls the attributes to use for the active window border:\n\
normal normal display\n\
standout use highlight mode of terminal\n\
@@ -1239,32 +1193,34 @@ This variable controls the attributes to use for the active window border:\n\
half-standout use half bright and standout mode\n\
bold use extra bright or bold\n\
bold-standout use extra bright or bold with standout mode"),
- tui_set_var_cmd,
- show_tui_active_border_mode,
+ tui_set_var_cmd, show_tui_active_border_mode,
&tui_setlist, &tui_showlist);
- add_setshow_zuinteger_cmd ("tab-width", no_class,
- &internal_tab_width, _("\
-Set the tab width, in characters, for the TUI."), _("\
-Show the tab witdh, in characters, for the TUI."), _("\
+ add_setshow_zuinteger_cmd ("tab-width", no_class, &internal_tab_width, _ ("\
+Set the tab width, in characters, for the TUI."),
+ _ ("\
+Show the tab witdh, in characters, for the TUI."),
+ _ ("\
This variable controls how many spaces are used to display a tab character."),
tui_set_tab_width, tui_show_tab_width,
&tui_setlist, &tui_showlist);
add_setshow_boolean_cmd ("tui-resize-message", class_maintenance,
- &resize_message, _("\
-Set TUI resize messaging."), _("\
-Show TUI resize messaging."), _("\
+ &resize_message, _ ("\
+Set TUI resize messaging."),
+ _ ("\
+Show TUI resize messaging."),
+ _ ("\
When enabled GDB will print a message when the terminal is resized."),
- nullptr,
- show_tui_resize_message,
+ nullptr, show_tui_resize_message,
&maintenance_set_cmdlist,
&maintenance_show_cmdlist);
- add_setshow_boolean_cmd ("compact-source", class_tui,
- &compact_source, _("\
-Set whether the TUI source window is compact."), _("\
-Show whether the TUI source window is compact."), _("\
+ add_setshow_boolean_cmd ("compact-source", class_tui, &compact_source, _ ("\
+Set whether the TUI source window is compact."),
+ _ ("\
+Show whether the TUI source window is compact."),
+ _ ("\
This variable controls whether the TUI source window is shown\n\
in a compact form. The compact form puts the source closer to\n\
the line numbers and uses less horizontal space."),
@@ -1272,16 +1228,15 @@ the line numbers and uses less horizontal space."),
&tui_setlist, &tui_showlist);
add_setshow_boolean_cmd ("tui-current-position", class_maintenance,
- &style_tui_current_position, _("\
+ &style_tui_current_position, _ ("\
Set whether to style text highlighted by the TUI's current position indicator."),
- _("\
+ _ ("\
Show whether to style text highlighted by the TUI's current position indicator."),
- _("\
+ _ ("\
When enabled, the source and assembly code highlighted by the TUI's current\n\
position indicator is styled."),
set_style_tui_current_position,
- show_style_tui_current_position,
- &style_set_list,
+ show_style_tui_current_position, &style_set_list,
&style_show_list);
tui_border_style.changed.attach (tui_rehighlight_all, "tui-win");
diff --git a/gdb/tui/tui-wingeneral.c b/gdb/tui/tui-wingeneral.c
index 82a023d09fe..30ef02dfd9c 100644
--- a/gdb/tui/tui-wingeneral.c
+++ b/gdb/tui/tui-wingeneral.c
@@ -79,8 +79,7 @@ tui_win_info::refresh_window ()
/* Draw a border arround the window. */
static void
-box_win (struct tui_win_info *win_info,
- bool highlight_flag)
+box_win (struct tui_win_info *win_info, bool highlight_flag)
{
WINDOW *win;
int attrs;
@@ -94,14 +93,12 @@ box_win (struct tui_win_info *win_info,
/* tui_apply_style resets the style entirely, so be sure to call it
before applying ATTRS. */
if (cli_styling)
- tui_apply_style (win, (highlight_flag
- ? tui_active_border_style.style ()
- : tui_border_style.style ()));
+ tui_apply_style (win, (highlight_flag ? tui_active_border_style.style ()
+ : tui_border_style.style ()));
wattron (win, attrs);
#ifdef HAVE_WBORDER
- wborder (win, tui_border_vline, tui_border_vline,
- tui_border_hline, tui_border_hline,
- tui_border_ulcorner, tui_border_urcorner,
+ wborder (win, tui_border_vline, tui_border_vline, tui_border_hline,
+ tui_border_hline, tui_border_ulcorner, tui_border_urcorner,
tui_border_llcorner, tui_border_lrcorner);
#else
box (win, tui_border_vline, tui_border_hline);
@@ -117,8 +114,8 @@ box_win (struct tui_win_info *win_info,
else
{
std::string truncated
- = "..." + win_info->title.substr (win_info->title.size ()
- - max_len + 3);
+ = "..."
+ + win_info->title.substr (win_info->title.size () - max_len + 3);
mvwaddstr (win, 0, 2, truncated.c_str ());
}
}
@@ -126,13 +123,10 @@ box_win (struct tui_win_info *win_info,
tui_apply_style (win, ui_file_style ());
}
-
void
tui_unhighlight_win (struct tui_win_info *win_info)
{
- if (win_info != NULL
- && win_info->can_box ()
- && win_info->handle != NULL)
+ if (win_info != NULL && win_info->can_box () && win_info->handle != NULL)
{
box_win (win_info, false);
win_info->refresh_window ();
@@ -140,13 +134,10 @@ tui_unhighlight_win (struct tui_win_info *win_info)
}
}
-
void
tui_highlight_win (struct tui_win_info *win_info)
{
- if (win_info != NULL
- && win_info->can_box ()
- && win_info->handle != NULL)
+ if (win_info != NULL && win_info->can_box () && win_info->handle != NULL)
{
box_win (win_info, true);
win_info->refresh_window ();
diff --git a/gdb/tui/tui-winsource.c b/gdb/tui/tui-winsource.c
index 52a0f7af00f..cac1fa27323 100644
--- a/gdb/tui/tui-winsource.c
+++ b/gdb/tui/tui-winsource.c
@@ -94,16 +94,13 @@ tui_copy_source_line (const char **ptr, int *length)
++lineptr;
++column;
- auto process_tab = [&] ()
- {
- int max_tab_len = tui_tab_width;
+ auto process_tab = [&] () {
+ int max_tab_len = tui_tab_width;
- --column;
- for (int j = column % max_tab_len;
- j < max_tab_len;
- column++, j++)
- result.push_back (' ');
- };
+ --column;
+ for (int j = column % max_tab_len; j < max_tab_len; column++, j++)
+ result.push_back (' ');
+ };
if (c == '\n' || c == '\r' || c == '\0')
{
@@ -148,21 +145,18 @@ tui_source_window_base::style_changed ()
/* Function to display source in the source window. This function
initializes the horizontal scroll to 0. */
void
-tui_source_window_base::update_source_window
- (struct gdbarch *gdbarch,
- const struct symtab_and_line &sal)
+tui_source_window_base::update_source_window (
+ struct gdbarch *gdbarch, const struct symtab_and_line &sal)
{
m_horizontal_offset = 0;
update_source_window_as_is (gdbarch, sal);
}
-
/* Function to display source in the source/asm window. This function
shows the source as specified by the horizontal offset. */
void
-tui_source_window_base::update_source_window_as_is
- (struct gdbarch *gdbarch,
- const struct symtab_and_line &sal)
+tui_source_window_base::update_source_window_as_is (
+ struct gdbarch *gdbarch, const struct symtab_and_line &sal)
{
bool ret = set_contents (gdbarch, sal);
@@ -177,13 +171,15 @@ tui_source_window_base::update_source_window_as_is
}
}
-
/* Function to ensure that the source and/or disassemly windows
reflect the input address. */
void
tui_update_source_windows_with_addr (struct gdbarch *gdbarch, CORE_ADDR addr)
{
- struct symtab_and_line sal {};
+ struct symtab_and_line sal
+ {
+ };
+
if (addr != 0)
sal = find_pc_line (addr, 0);
@@ -223,10 +219,7 @@ tui_source_window_base::do_erase_source_content (const char *str)
x_pos = 1;
else
x_pos = half_width - strlen (str);
- mvwaddstr (handle.get (),
- (height / 2),
- x_pos,
- (char *) str);
+ mvwaddstr (handle.get (), (height / 2), x_pos, (char *) str);
refresh_window ();
}
@@ -392,7 +385,7 @@ tui_source_window_base::show_source_content ()
{
int reduced_width = std::max (pad_width / 2, width);
if (reduced_width == pad_width)
- error (_("failed to setup source window"));
+ error (_ ("failed to setup source window"));
pad_width = reduced_width;
}
}
@@ -421,9 +414,9 @@ tui_source_window_base::tui_source_window_base ()
m_start_line_or_addr.loa = LOA_ADDRESS;
m_start_line_or_addr.u.addr = 0;
- gdb::observers::styling_changed.attach
- (std::bind (&tui_source_window::style_changed, this),
- m_observable, "tui-winsource");
+ gdb::observers::styling_changed.attach (
+ std::bind (&tui_source_window::style_changed, this), m_observable,
+ "tui-winsource");
}
tui_source_window_base::~tui_source_window_base ()
@@ -447,8 +440,7 @@ tui_source_window_base::rerender ()
if (!m_content.empty ())
{
- struct symtab_and_line cursal
- = get_current_source_symtab_and_line ();
+ struct symtab_and_line cursal = get_current_source_symtab_and_line ();
if (m_start_line_or_addr.loa == LOA_LINE)
cursal.line = m_start_line_or_addr.u.line_no;
@@ -458,8 +450,7 @@ tui_source_window_base::rerender ()
}
else if (deprecated_safe_get_selected_frame () != NULL)
{
- struct symtab_and_line cursal
- = get_current_source_symtab_and_line ();
+ struct symtab_and_line cursal = get_current_source_symtab_and_line ();
frame_info_ptr frame = deprecated_safe_get_selected_frame ();
struct gdbarch *gdbarch = get_frame_arch (frame);
@@ -553,7 +544,6 @@ tui_source_window_base::do_scroll_horizontal (int num_to_scroll)
}
}
-
/* Set or clear the is_exec_point flag in the line whose line is
line_no. */
@@ -567,8 +557,7 @@ tui_source_window_base::set_is_exec_point_at (struct tui_line_or_address l)
while (i < m_content.size ())
{
bool new_state;
- struct tui_line_or_address content_loa =
- m_content[i].line_or_addr;
+ struct tui_line_or_address content_loa = m_content[i].line_or_addr;
if (content_loa.loa == l.loa
&& ((l.loa == LOA_LINE && content_loa.u.line_no == l.u.line_no)
@@ -599,7 +588,6 @@ tui_update_all_breakpoint_info (struct breakpoint *being_deleted)
}
}
-
/* Scan the source window and the breakpoints to update the break_mode
information for each line.
@@ -607,8 +595,8 @@ tui_update_all_breakpoint_info (struct breakpoint *being_deleted)
refreshed. */
bool
-tui_source_window_base::update_breakpoint_info
- (struct breakpoint *being_deleted, bool current_only)
+tui_source_window_base::update_breakpoint_info (
+ struct breakpoint *being_deleted, bool current_only)
{
int i;
bool need_refresh = false;
@@ -619,7 +607,7 @@ tui_source_window_base::update_breakpoint_info
line = &m_content[i];
if (current_only && !line->is_exec_point)
- continue;
+ continue;
/* Scan each breakpoint to see if the current line has something to
do with it. Identify enable/disabled breakpoints as well as
diff --git a/gdb/tui/tui-winsource.h b/gdb/tui/tui-winsource.h
index 7370ae95d8b..ab61482a5fa 100644
--- a/gdb/tui/tui-winsource.h
+++ b/gdb/tui/tui-winsource.h
@@ -35,11 +35,12 @@ enum tui_line_or_address_kind
struct tui_line_or_address
{
enum tui_line_or_address_kind loa;
+
union
- {
- int line_no;
- CORE_ADDR addr;
- } u;
+ {
+ int line_no;
+ CORE_ADDR addr;
+ } u;
};
/* Flags to tell what kind of breakpoint is at current line. */
@@ -55,10 +56,10 @@ enum tui_bp_flag
DEF_ENUM_FLAGS_TYPE (enum tui_bp_flag, tui_bp_flags);
/* Position of breakpoint markers in the exec info string. */
-#define TUI_BP_HIT_POS 0
-#define TUI_BP_BREAK_POS 1
-#define TUI_EXEC_POS 2
-#define TUI_EXECINFO_SIZE 4
+#define TUI_BP_HIT_POS 0
+#define TUI_BP_BREAK_POS 1
+#define TUI_EXEC_POS 2
+#define TUI_EXECINFO_SIZE 4
/* Elements in the Source/Disassembly Window. */
struct tui_source_element
@@ -85,13 +86,13 @@ struct tui_source_element
tui_bp_flags break_mode = 0;
};
-
/* The base class for all source-like windows, namely the source and
disassembly windows. */
struct tui_source_window_base : public tui_win_info
{
protected:
+
tui_source_window_base ();
~tui_source_window_base ();
@@ -105,21 +106,17 @@ protected:
void rerender () override;
virtual bool set_contents (struct gdbarch *gdbarch,
- const struct symtab_and_line &sal) = 0;
+ const struct symtab_and_line &sal)
+ = 0;
/* Return the number of extra margin characters needed by this
instance. */
- virtual int extra_margin () const
- {
- return 0;
- }
+ virtual int extra_margin () const { return 0; }
/* Display the line number in the window margin. OFFSET indicates
which line to display; it is 0-based, with 0 meaning the line at
the top of the window. */
- virtual void show_line_number (int offset) const
- {
- }
+ virtual void show_line_number (int offset) const {}
/* Redraw the complete line of a source or disassembly window. */
void show_source_line (int lineno);
@@ -161,8 +158,8 @@ public:
the location is already displayed. */
virtual void maybe_update (frame_info_ptr fi, symtab_and_line sal) = 0;
- void update_source_window_as_is (struct gdbarch *gdbarch,
- const struct symtab_and_line &sal);
+ void update_source_window_as_is (struct gdbarch *gdbarch,
+ const struct symtab_and_line &sal);
void update_source_window (struct gdbarch *gdbarch,
const struct symtab_and_line &sal);
@@ -181,7 +178,8 @@ public:
/* Return the start address and gdbarch. */
virtual void display_start_addr (struct gdbarch **gdbarch_p,
- CORE_ADDR *addr_p) = 0;
+ CORE_ADDR *addr_p)
+ = 0;
private:
@@ -205,14 +203,12 @@ private:
/* Return the size of the left margin space, this is the space used to
display things like breakpoint markers. */
- int left_margin () const
- { return 1 + TUI_EXECINFO_SIZE + extra_margin (); }
+ int left_margin () const { return 1 + TUI_EXECINFO_SIZE + extra_margin (); }
/* Return the width of the area that is available for window content.
This is the window width minus the borders and the left margin, which
is used for displaying things like breakpoint markers. */
- int view_width () const
- { return width - left_margin () - 1; }
+ int view_width () const { return width - left_margin () - 1; }
void show_source_content ();
@@ -252,7 +248,6 @@ private:
int m_pad_offset = 0;
};
-
/* A wrapper for a TUI window iterator that only iterates over source
windows. */
@@ -358,6 +353,6 @@ extern std::string tui_copy_source_line (const char **ptr,
int *length = nullptr);
/* Constant definitions. */
-#define SCROLL_THRESHOLD 2 /* Threshold for lazy scroll. */
+#define SCROLL_THRESHOLD 2 /* Threshold for lazy scroll. */
#endif /* TUI_TUI_WINSOURCE_H */
diff --git a/gdb/tui/tui.c b/gdb/tui/tui.c
index cdae9ffe02b..0ac3cafa36d 100644
--- a/gdb/tui/tui.c
+++ b/gdb/tui/tui.c
@@ -57,10 +57,10 @@ bool debug_tui = false;
/* Implement 'show debug tui'. */
static void
-show_tui_debug (struct ui_file *file, int from_tty,
- struct cmd_list_element *c, const char *value)
+show_tui_debug (struct ui_file *file, int from_tty, struct cmd_list_element *c,
+ const char *value)
{
- gdb_printf (file, _("TUI debugging is \"%s\".\n"), value);
+ gdb_printf (file, _ ("TUI debugging is \"%s\".\n"), value);
}
/* This redefines CTRL if it is not already defined, so it must come
@@ -83,18 +83,10 @@ struct tui_char_command
/* Key mapping to gdb commands when the TUI is using the single key
mode. */
static const struct tui_char_command tui_commands[] = {
- { 'c', "continue" },
- { 'd', "down" },
- { 'f', "finish" },
- { 'n', "next" },
- { 'o', "nexti" },
- { 'r', "run" },
- { 's', "step" },
- { 'i', "stepi" },
- { 'u', "up" },
- { 'v', "info locals" },
- { 'w', "where" },
- { 0, 0 },
+ { 'c', "continue" }, { 'd', "down" }, { 'f', "finish" },
+ { 'n', "next" }, { 'o', "nexti" }, { 'r', "run" },
+ { 's', "step" }, { 'i', "stepi" }, { 'u', "up" },
+ { 'v', "info locals" }, { 'w', "where" }, { 0, 0 },
};
static Keymap tui_keymap;
@@ -105,7 +97,6 @@ static Keymap tui_readline_standard_keymap;
static int
tui_rl_switch_mode (int notused1, int notused2)
{
-
/* Don't let exceptions escape. We're in the middle of a readline
callback that isn't prepared for that. */
try
@@ -245,7 +236,8 @@ tui_rl_next_keymap (int notused1, int notused2)
tui_rl_switch_mode (0 /* notused */, 0 /* notused */);
tui_set_key_mode (tui_current_key_mode == TUI_COMMAND_MODE
- ? TUI_SINGLE_KEY_MODE : TUI_COMMAND_MODE);
+ ? TUI_SINGLE_KEY_MODE
+ : TUI_COMMAND_MODE);
return 0;
}
@@ -270,8 +262,8 @@ void
tui_set_key_mode (enum tui_key_mode mode)
{
tui_current_key_mode = mode;
- rl_set_keymap (mode == TUI_SINGLE_KEY_MODE
- ? tui_keymap : tui_readline_standard_keymap);
+ rl_set_keymap (mode == TUI_SINGLE_KEY_MODE ? tui_keymap
+ : tui_readline_standard_keymap);
tui_show_locator_content ();
}
@@ -308,7 +300,7 @@ tui_ensure_readline_initialized ()
for (i = 0; tui_commands[i].cmd; i++)
rl_bind_key_in_map (tui_commands[i].key, tui_rl_command_key, tui_keymap);
- rl_generic_bind (ISKMAP, "\\C-x", (char*) tui_ctlx_keymap, tui_keymap);
+ rl_generic_bind (ISKMAP, "\\C-x", (char *) tui_ctlx_keymap, tui_keymap);
/* Bind all other keys to tui_rl_command_mode so that we switch
temporarily from SingleKey mode and can enter a gdb command. */
@@ -380,7 +372,7 @@ tui_enable (void)
WINDOW *w;
SCREEN *s;
#ifndef __MINGW32__
- const char *cap;
+ const char *cap;
#endif
const char *interp;
@@ -388,12 +380,13 @@ tui_enable (void)
MI), enabling curses will certainly lose. */
interp = top_level_interpreter ()->name ();
if (strcmp (interp, INTERP_TUI) != 0)
- error (_("Cannot enable the TUI when the interpreter is '%s'"), interp);
+ error (_ ("Cannot enable the TUI when the interpreter is '%s'"),
+ interp);
/* Don't try to setup curses (and print funny control
characters) if we're not outputting to a terminal. */
if (!gdb_stderr->isatty ())
- error (_("Cannot enable the TUI when output is not a terminal"));
+ error (_ ("Cannot enable the TUI when output is not a terminal"));
s = newterm (NULL, stdout, stdin);
#ifdef __MINGW32__
@@ -404,7 +397,7 @@ tui_enable (void)
#endif
if (s == NULL)
{
- error (_("Cannot enable the TUI: error opening terminal [TERM=%s]"),
+ error (_ ("Cannot enable the TUI: error opening terminal [TERM=%s]"),
gdb_getenv_term ());
}
w = stdscr;
@@ -418,7 +411,7 @@ tui_enable (void)
start_color ();
}
- /* Check required terminal capabilities. The MinGW port of
+ /* Check required terminal capabilities. The MinGW port of
ncurses does have them, but doesn't expose them through "cup". */
#ifndef __MINGW32__
cap = tigetstr ((char *) "cup");
@@ -426,8 +419,8 @@ tui_enable (void)
{
endwin ();
delscreen (s);
- error (_("Cannot enable the TUI: "
- "terminal doesn't support cursor addressing [TERM=%s]"),
+ error (_ ("Cannot enable the TUI: "
+ "terminal doesn't support cursor addressing [TERM=%s]"),
gdb_getenv_term ());
}
#endif
@@ -441,8 +434,8 @@ tui_enable (void)
cbreak ();
noecho ();
/* timeout (1); */
- nodelay(w, FALSE);
- nl();
+ nodelay (w, FALSE);
+ nl ();
keypad (w, TRUE);
tui_set_term_height_to (LINES);
tui_set_term_width_to (COLS);
@@ -577,18 +570,18 @@ tui_is_window_visible (enum tui_win_type type)
}
bool
-tui_get_command_dimension (unsigned int *width,
- unsigned int *height)
+tui_get_command_dimension (unsigned int *width, unsigned int *height)
{
if (!tui_active || (TUI_CMD_WIN == NULL))
return false;
-
+
*width = TUI_CMD_WIN->width;
*height = TUI_CMD_WIN->height;
return true;
}
void _initialize_tui ();
+
void
_initialize_tui ()
{
@@ -597,20 +590,21 @@ _initialize_tui ()
tuicmd = tui_get_cmd_list ();
add_cmd ("enable", class_tui, tui_enable_command,
- _("Enable TUI display mode.\n\
+ _ ("Enable TUI display mode.\n\
Usage: tui enable"),
tuicmd);
add_cmd ("disable", class_tui, tui_disable_command,
- _("Disable TUI display mode.\n\
+ _ ("Disable TUI display mode.\n\
Usage: tui disable"),
tuicmd);
/* Debug this tui internals. */
- add_setshow_boolean_cmd ("tui", class_maintenance, &debug_tui, _("\
-Set tui debugging."), _("\
-Show tui debugging."), _("\
+ add_setshow_boolean_cmd ("tui", class_maintenance, &debug_tui, _ ("\
+Set tui debugging."),
+ _ ("\
+Show tui debugging."),
+ _ ("\
When true, tui specific internal debugging is enabled."),
- NULL,
- show_tui_debug,
- &setdebuglist, &showdebuglist);
+ NULL, show_tui_debug, &setdebuglist,
+ &showdebuglist);
}
diff --git a/gdb/tui/tui.h b/gdb/tui/tui.h
index ca30e7cc65e..e935042746c 100644
--- a/gdb/tui/tui.h
+++ b/gdb/tui/tui.h
@@ -33,8 +33,7 @@ extern bool debug_tui;
/* Print "tui" enter/exit debug statements. */
-#define TUI_SCOPED_DEBUG_ENTER_EXIT \
- scoped_debug_enter_exit (debug_tui, "tui")
+#define TUI_SCOPED_DEBUG_ENTER_EXIT scoped_debug_enter_exit (debug_tui, "tui")
#define TUI_SCOPED_DEBUG_START_END(fmt, ...) \
scoped_debug_start_end (debug_tui, "tui", fmt, ##__VA_ARGS__)
@@ -60,8 +59,8 @@ enum tui_win_type
MAX_MAJOR_WINDOWS,
};
-extern CORE_ADDR tui_get_low_disassembly_address (struct gdbarch *,
- CORE_ADDR, CORE_ADDR);
+extern CORE_ADDR tui_get_low_disassembly_address (struct gdbarch *, CORE_ADDR,
+ CORE_ADDR);
extern void tui_show_assembly (struct gdbarch *gdbarch, CORE_ADDR addr);
extern bool tui_is_window_visible (enum tui_win_type type);
extern bool tui_get_command_dimension (unsigned int *width,
diff --git a/gdb/type-stack.c b/gdb/type-stack.c
index 2b6b3031fcd..709f3ccdfc5 100644
--- a/gdb/type-stack.c
+++ b/gdb/type-stack.c
@@ -33,14 +33,13 @@ type_stack::insert (enum type_pieces tp)
gdb_assert (tp == tp_pointer || tp == tp_reference
|| tp == tp_rvalue_reference || tp == tp_const
- || tp == tp_volatile || tp == tp_restrict
- || tp == tp_atomic);
+ || tp == tp_volatile || tp == tp_restrict || tp == tp_atomic);
/* If there is anything on the stack (we know it will be a
tp_pointer), insert the qualifier above it. Otherwise, simply
push this on the top of the stack. */
- if (!m_elements.empty () && (tp == tp_const || tp == tp_volatile
- || tp == tp_restrict))
+ if (!m_elements.empty ()
+ && (tp == tp_const || tp == tp_volatile || tp == tp_restrict))
slot = 1;
else
slot = 0;
@@ -68,8 +67,7 @@ type_stack::insert (struct expr_builder *pstate, const char *string)
element.piece = tp_space_identifier;
insert_into (slot, element);
element.int_val
- = address_space_name_to_type_instance_flags (pstate->gdbarch (),
- string);
+ = address_space_name_to_type_instance_flags (pstate->gdbarch (), string);
insert_into (slot, element);
}
@@ -147,16 +145,14 @@ type_stack::follow_types (struct type *follow_type)
follow_type = lookup_rvalue_reference_type (follow_type);
process_qualifiers:
if (make_const)
- follow_type = make_cv_type (make_const,
- TYPE_VOLATILE (follow_type),
+ follow_type = make_cv_type (make_const, TYPE_VOLATILE (follow_type),
follow_type, 0);
if (make_volatile)
- follow_type = make_cv_type (TYPE_CONST (follow_type),
- make_volatile,
+ follow_type = make_cv_type (TYPE_CONST (follow_type), make_volatile,
follow_type, 0);
if (make_addr_space)
- follow_type = make_type_with_address_space (follow_type,
- make_addr_space);
+ follow_type
+ = make_type_with_address_space (follow_type, make_addr_space);
if (make_restrict)
follow_type = make_restrict_type (follow_type);
if (make_atomic)
@@ -169,9 +165,9 @@ type_stack::follow_types (struct type *follow_type)
array_size = pop_int ();
/* FIXME-type-allocation: need a way to free this type when we are
done with it. */
- follow_type =
- lookup_array_range_type (follow_type,
- 0, array_size >= 0 ? array_size - 1 : 0);
+ follow_type
+ = lookup_array_range_type (follow_type, 0,
+ array_size >= 0 ? array_size - 1 : 0);
if (array_size < 0)
follow_type->bounds ()->high.set_undefined ();
break;
@@ -186,8 +182,7 @@ type_stack::follow_types (struct type *follow_type)
std::vector<struct type *> *args = pop_typelist ();
follow_type
- = lookup_function_type_with_arguments (follow_type,
- args->size (),
+ = lookup_function_type_with_arguments (follow_type, args->size (),
args->data ());
}
break;
diff --git a/gdb/type-stack.h b/gdb/type-stack.h
index 1451d66a23f..acc558b7e0c 100644
--- a/gdb/type-stack.h
+++ b/gdb/type-stack.h
@@ -29,31 +29,31 @@ struct expr_builder;
/* For parsing of complicated types.
An array should be preceded in the list by the size of the array. */
enum type_pieces
- {
- tp_end = -1,
- tp_pointer,
- tp_reference,
- tp_rvalue_reference,
- tp_array,
- tp_function,
- tp_function_with_arguments,
- tp_const,
- tp_volatile,
- tp_space_identifier,
- tp_atomic,
- tp_restrict,
- tp_type_stack,
- tp_kind
- };
+{
+ tp_end = -1,
+ tp_pointer,
+ tp_reference,
+ tp_rvalue_reference,
+ tp_array,
+ tp_function,
+ tp_function_with_arguments,
+ tp_const,
+ tp_volatile,
+ tp_space_identifier,
+ tp_atomic,
+ tp_restrict,
+ tp_type_stack,
+ tp_kind
+};
/* The stack can contain either an enum type_pieces or an int. */
union type_stack_elt
- {
- enum type_pieces piece;
- int int_val;
- struct type_stack *stack_val;
- std::vector<struct type *> *typelist_val;
- };
+{
+ enum type_pieces piece;
+ int int_val;
+ struct type_stack *stack_val;
+ std::vector<struct type *> *typelist_val;
+};
/* The type stack is an instance of this structure. */
@@ -198,7 +198,6 @@ private:
m_elements.insert (m_elements.begin () + slot, element);
}
-
/* Elements on the stack. */
std::vector<union type_stack_elt> m_elements;
};
diff --git a/gdb/typeprint.c b/gdb/typeprint.c
index 41b57353ce1..01d12fb9797 100644
--- a/gdb/typeprint.c
+++ b/gdb/typeprint.c
@@ -19,7 +19,7 @@
#include "defs.h"
#include "gdbsupport/gdb_obstack.h"
-#include "bfd.h" /* Binary File Description */
+#include "bfd.h" /* Binary File Description */
#include "symtab.h"
#include "gdbtypes.h"
#include "expression.h"
@@ -38,36 +38,32 @@
#include "completer.h"
#include "cli/cli-style.h"
-const struct type_print_options type_print_raw_options =
-{
- 1, /* raw */
- 1, /* print_methods */
- 1, /* print_typedefs */
- 0, /* print_offsets */
- 0, /* print_in_hex */
- 0, /* print_nested_type_limit */
- NULL, /* local_typedefs */
- NULL, /* global_table */
- NULL /* global_printers */
+const struct type_print_options type_print_raw_options = {
+ 1, /* raw */
+ 1, /* print_methods */
+ 1, /* print_typedefs */
+ 0, /* print_offsets */
+ 0, /* print_in_hex */
+ 0, /* print_nested_type_limit */
+ NULL, /* local_typedefs */
+ NULL, /* global_table */
+ NULL /* global_printers */
};
/* The default flags for 'ptype' and 'whatis'. */
-static struct type_print_options default_ptype_flags =
-{
- 0, /* raw */
- 1, /* print_methods */
- 1, /* print_typedefs */
- 0, /* print_offsets */
- 0, /* print_in_hex */
- 0, /* print_nested_type_limit */
- NULL, /* local_typedefs */
- NULL, /* global_table */
- NULL /* global_printers */
+static struct type_print_options default_ptype_flags = {
+ 0, /* raw */
+ 1, /* print_methods */
+ 1, /* print_typedefs */
+ 0, /* print_offsets */
+ 0, /* print_in_hex */
+ 0, /* print_nested_type_limit */
+ NULL, /* local_typedefs */
+ NULL, /* global_table */
+ NULL /* global_printers */
};
-
-
/* See typeprint.h. */
const int print_offset_data::indentation = 27;
@@ -84,8 +80,7 @@ print_offset_data::print_offset_data (const struct type_print_options *flags)
void
print_offset_data::maybe_print_hole (struct ui_file *stream,
- unsigned int bitpos,
- const char *for_what)
+ unsigned int bitpos, const char *for_what)
{
/* We check for END_BITPOS > 0 because there is a specific
scenario when END_BITPOS can be zero and BITPOS can be >
@@ -137,9 +132,8 @@ print_offset_data::update (struct type *type, unsigned int field_idx,
/* Since union fields don't have the concept of offsets, we just
print their sizes. */
gdb_printf (stream, "/* %6s */",
- (print_in_hex ?
- hex_string_custom (ftype->length (), 4) :
- pulongest (ftype->length ())));
+ (print_in_hex ? hex_string_custom (ftype->length (), 4)
+ : pulongest (ftype->length ())));
return;
}
@@ -157,8 +151,7 @@ print_offset_data::update (struct type *type, unsigned int field_idx,
unsigned real_bitpos = bitpos + offset_bitpos;
- gdb_printf (stream,
- (print_in_hex ? "/* 0x%04x: 0x%x" : "/* %6u:%2u "),
+ gdb_printf (stream, (print_in_hex ? "/* 0x%04x: 0x%x" : "/* %6u:%2u "),
real_bitpos / TARGET_CHAR_BIT,
real_bitpos % TARGET_CHAR_BIT);
}
@@ -166,7 +159,7 @@ print_offset_data::update (struct type *type, unsigned int field_idx,
{
/* The position of the field, relative to the beginning of the
struct. */
- gdb_printf (stream, (print_in_hex ? "/* 0x%04x" : "/* %6u"),
+ gdb_printf (stream, (print_in_hex ? "/* 0x%04x" : "/* %6u"),
(bitpos + offset_bitpos) / TARGET_CHAR_BIT);
gdb_printf (stream, " ");
@@ -193,8 +186,6 @@ print_offset_data::finish (struct type *type, int level,
pulongest (type->length ()));
}
-
-
/* A hash function for a typedef_field. */
static hashval_t
@@ -270,8 +261,8 @@ typedef_hash_table::add_template_parameters (struct type *t)
/* See typeprint.h. */
typedef_hash_table::typedef_hash_table ()
- : m_table (htab_create_alloc (10, hash_typedef_field, eq_typedef_field,
- NULL, xcalloc, xfree))
+ : m_table (htab_create_alloc (10, hash_typedef_field, eq_typedef_field, NULL,
+ xcalloc, xfree))
{
}
@@ -306,8 +297,8 @@ typedef_hash_table::typedef_hash_table (const typedef_hash_table &table)
result. A NULL return means that the name was not found. */
const char *
-typedef_hash_table::find_global_typedef (const struct type_print_options *flags,
- struct type *t)
+typedef_hash_table::find_global_typedef (
+ const struct type_print_options *flags, struct type *t)
{
char *applied;
void **slot;
@@ -338,8 +329,8 @@ typedef_hash_table::find_global_typedef (const struct type_print_options *flags,
if (applied != NULL)
{
- new_tf->name = obstack_strdup (&flags->global_typedefs->m_storage,
- applied);
+ new_tf->name
+ = obstack_strdup (&flags->global_typedefs->m_storage, applied);
xfree (applied);
}
@@ -368,14 +359,13 @@ typedef_hash_table::find_typedef (const struct type_print_options *flags,
return find_global_typedef (flags, t);
}
-
-
/* Print a description of a type in the format of a
typedef for the current language.
NEW is the new name for a type TYPE. */
void
-typedef_print (struct type *type, struct symbol *newobj, struct ui_file *stream)
+typedef_print (struct type *type, struct symbol *newobj,
+ struct ui_file *stream)
{
current_language->print_typedef (type, newobj, stream);
}
@@ -421,7 +411,7 @@ void
type_print_unknown_return_type (struct ui_file *stream)
{
fprintf_styled (stream, metadata_style.style (),
- _("<unknown return type>"));
+ _ ("<unknown return type>"));
}
/* See typeprint.h. */
@@ -429,7 +419,7 @@ type_print_unknown_return_type (struct ui_file *stream)
void
error_unknown_type (const char *sym_print_name)
{
- error (_("'%s' has unknown type; cast it to its declared type"),
+ error (_ ("'%s' has unknown type; cast it to its declared type"),
sym_print_name);
}
@@ -493,15 +483,15 @@ whatis_exp (const char *exp, int show)
flags.print_in_hex = 0;
break;
default:
- error (_("unrecognized flag '%c'"), *exp);
+ error (_ ("unrecognized flag '%c'"), *exp);
}
seen_one = 1;
}
if (!*exp && !seen_one)
- error (_("flag expected"));
+ error (_ ("flag expected"));
if (!isspace (*exp))
- error (_("expected space after format"));
+ error (_ ("expected space after format"));
exp = skip_spaces (exp);
}
@@ -541,7 +531,7 @@ whatis_exp (const char *exp, int show)
if (flags.print_offsets && is_dynamic_type (type))
{
- warning (_("ptype/o does not work with dynamic types; disabling '/o'"));
+ warning (_ ("ptype/o does not work with dynamic types; disabling '/o'"));
flags.print_offsets = 0;
}
@@ -577,9 +567,9 @@ whatis_exp (const char *exp, int show)
{
gdb_printf ("/* real type = ");
type_print (real_type, "", gdb_stdout, -1);
- if (! full)
+ if (!full)
gdb_printf (" (incomplete object)");
- gdb_printf (" */\n");
+ gdb_printf (" */\n");
}
current_language->print_type (type, "", gdb_stdout, show, 0, &flags);
@@ -625,7 +615,6 @@ print_type_scalar (struct type *type, LONGEST val, struct ui_file *stream)
switch (type->code ())
{
-
case TYPE_CODE_ENUM:
len = type->num_fields ();
for (i = 0; i < len; i++)
@@ -682,11 +671,11 @@ print_type_scalar (struct type *type, LONGEST val, struct ui_file *stream)
case TYPE_CODE_REF:
case TYPE_CODE_RVALUE_REF:
case TYPE_CODE_NAMESPACE:
- error (_("internal error: unhandled type in print_type_scalar"));
+ error (_ ("internal error: unhandled type in print_type_scalar"));
break;
default:
- error (_("Invalid type code in symbol table."));
+ error (_ ("Invalid type code in symbol table."));
}
}
@@ -718,7 +707,6 @@ maintenance_print_type (const char *type_name, int from_tty)
recursive_dump_type (type, 0);
}
}
-
struct cmd_list_element *setprinttypelist;
@@ -727,8 +715,8 @@ struct cmd_list_element *showprinttypelist;
static bool print_methods = true;
static void
-set_print_type_methods (const char *args,
- int from_tty, struct cmd_list_element *c)
+set_print_type_methods (const char *args, int from_tty,
+ struct cmd_list_element *c)
{
default_ptype_flags.print_methods = print_methods;
}
@@ -737,24 +725,24 @@ static void
show_print_type_methods (struct ui_file *file, int from_tty,
struct cmd_list_element *c, const char *value)
{
- gdb_printf (file, _("Printing of methods defined in a class in %s\n"),
+ gdb_printf (file, _ ("Printing of methods defined in a class in %s\n"),
value);
}
static bool print_typedefs = true;
static void
-set_print_type_typedefs (const char *args,
- int from_tty, struct cmd_list_element *c)
+set_print_type_typedefs (const char *args, int from_tty,
+ struct cmd_list_element *c)
{
default_ptype_flags.print_typedefs = print_typedefs;
}
static void
show_print_type_typedefs (struct ui_file *file, int from_tty,
- struct cmd_list_element *c, const char *value)
+ struct cmd_list_element *c, const char *value)
{
- gdb_printf (file, _("Printing of typedefs defined in a class in %s\n"),
+ gdb_printf (file, _ ("Printing of typedefs defined in a class in %s\n"),
value);
}
@@ -777,18 +765,17 @@ set_print_type_nested_types (const char *args, int from_tty,
/* Show how many nested type definitions the type printer will print. */
static void
-show_print_type_nested_types (struct ui_file *file, int from_tty,
- struct cmd_list_element *c, const char *value)
+show_print_type_nested_types (struct ui_file *file, int from_tty,
+ struct cmd_list_element *c, const char *value)
{
if (*value == '0')
{
gdb_printf (file,
- _("Will not print nested types defined in a class\n"));
+ _ ("Will not print nested types defined in a class\n"));
}
else
{
- gdb_printf (file,
- _("Will print %s nested types defined in a class\n"),
+ gdb_printf (file, _ ("Will print %s nested types defined in a class\n"),
value);
}
}
@@ -803,8 +790,8 @@ static bool print_offsets_and_sizes_in_hex = false;
displayed in hexadecimal or decimal notation. */
static void
-set_print_offsets_and_sizes_in_hex (const char *args,
- int from_tty, struct cmd_list_element *c)
+set_print_offsets_and_sizes_in_hex (const char *args, int from_tty,
+ struct cmd_list_element *c)
{
default_ptype_flags.print_in_hex = print_offsets_and_sizes_in_hex;
}
@@ -817,18 +804,19 @@ show_print_offsets_and_sizes_in_hex (struct ui_file *file, int from_tty,
struct cmd_list_element *c,
const char *value)
{
- gdb_printf (file, _("\
+ gdb_printf (file, _ ("\
Display of struct members offsets and sizes in hexadecimal is %s\n"),
value);
}
void _initialize_typeprint ();
+
void
_initialize_typeprint ()
{
struct cmd_list_element *c;
- c = add_com ("ptype", class_vars, ptype_command, _("\
+ c = add_com ("ptype", class_vars, ptype_command, _ ("\
Print definition of type TYPE.\n\
Usage: ptype[/FLAGS] TYPE | EXPRESSION\n\
Argument may be any type (for example a type name defined by typedef,\n\
@@ -851,46 +839,48 @@ Available FLAGS are:\n\
set_cmd_completer (c, expression_completer);
c = add_com ("whatis", class_vars, whatis_command,
- _("Print data type of expression EXP.\n\
+ _ ("Print data type of expression EXP.\n\
Only one level of typedefs is unrolled. See also \"ptype\"."));
set_cmd_completer (c, expression_completer);
- add_setshow_prefix_cmd ("type", no_class,
- _("Generic command for showing type-printing settings."),
- _("Generic command for setting how types print."),
- &setprinttypelist, &showprinttypelist,
- &setprintlist, &showprintlist);
-
- add_setshow_boolean_cmd ("methods", no_class, &print_methods,
- _("\
-Set printing of methods defined in classes."), _("\
-Show printing of methods defined in classes."), NULL,
- set_print_type_methods,
- show_print_type_methods,
- &setprinttypelist, &showprinttypelist);
- add_setshow_boolean_cmd ("typedefs", no_class, &print_typedefs,
- _("\
-Set printing of typedefs defined in classes."), _("\
-Show printing of typedefs defined in classes."), NULL,
- set_print_type_typedefs,
- show_print_type_typedefs,
- &setprinttypelist, &showprinttypelist);
+ add_setshow_prefix_cmd (
+ "type", no_class,
+ _ ("Generic command for showing type-printing settings."),
+ _ ("Generic command for setting how types print."), &setprinttypelist,
+ &showprinttypelist, &setprintlist, &showprintlist);
+
+ add_setshow_boolean_cmd ("methods", no_class, &print_methods, _ ("\
+Set printing of methods defined in classes."),
+ _ ("\
+Show printing of methods defined in classes."),
+ NULL, set_print_type_methods,
+ show_print_type_methods, &setprinttypelist,
+ &showprinttypelist);
+ add_setshow_boolean_cmd ("typedefs", no_class, &print_typedefs, _ ("\
+Set printing of typedefs defined in classes."),
+ _ ("\
+Show printing of typedefs defined in classes."),
+ NULL, set_print_type_typedefs,
+ show_print_type_typedefs, &setprinttypelist,
+ &showprinttypelist);
add_setshow_zuinteger_unlimited_cmd ("nested-type-limit", no_class,
- &print_nested_type_limit,
- _("\
+ &print_nested_type_limit, _ ("\
Set the number of recursive nested type definitions to print \
-(\"unlimited\" or -1 to show all)."), _("\
-Show the number of recursive nested type definitions to print."), NULL,
- set_print_type_nested_types,
+(\"unlimited\" or -1 to show all)."),
+ _ ("\
+Show the number of recursive nested type definitions to print."),
+ NULL, set_print_type_nested_types,
show_print_type_nested_types,
&setprinttypelist, &showprinttypelist);
add_setshow_boolean_cmd ("hex", no_class, &print_offsets_and_sizes_in_hex,
- _("\
-Set printing of struct members sizes and offsets using hex notation."), _("\
+ _ ("\
+Set printing of struct members sizes and offsets using hex notation."),
+ _ ("\
Show whether sizes and offsets of struct members are printed using hex \
-notation."), nullptr, set_print_offsets_and_sizes_in_hex,
+notation."),
+ nullptr, set_print_offsets_and_sizes_in_hex,
show_print_offsets_and_sizes_in_hex,
&setprinttypelist, &showprinttypelist);
}
@@ -900,7 +890,7 @@ notation."), nullptr, set_print_offsets_and_sizes_in_hex,
void
val_print_not_allocated (struct ui_file *stream)
{
- fprintf_styled (stream, metadata_style.style (), _("<not allocated>"));
+ fprintf_styled (stream, metadata_style.style (), _ ("<not allocated>"));
}
/* Print <not associated> status to stream STREAM. */
@@ -908,5 +898,5 @@ val_print_not_allocated (struct ui_file *stream)
void
val_print_not_associated (struct ui_file *stream)
{
- fprintf_styled (stream, metadata_style.style (), _("<not associated>"));
+ fprintf_styled (stream, metadata_style.style (), _ ("<not associated>"));
}
diff --git a/gdb/typeprint.h b/gdb/typeprint.h
index aa1a5872ca3..babccd56530 100644
--- a/gdb/typeprint.h
+++ b/gdb/typeprint.h
@@ -63,7 +63,7 @@ struct print_offset_data
{
/* Indicate if the offset an d size fields should be printed in decimal
(default) or hexadecimal. */
- bool print_in_hex = false;
+ bool print_in_hex = false;
/* The offset to be applied to bitpos when PRINT_OFFSETS is true.
This is needed for when we are printing nested structs and want
@@ -146,9 +146,8 @@ public:
private:
- static const char *find_global_typedef (const struct type_print_options *flags,
- struct type *t);
-
+ static const char *
+ find_global_typedef (const struct type_print_options *flags, struct type *t);
/* The actual hash table. */
htab_up m_table;
@@ -157,8 +156,7 @@ private:
auto_obstack m_storage;
};
-
-void print_type_scalar (struct type * type, LONGEST, struct ui_file *);
+void print_type_scalar (struct type *type, LONGEST, struct ui_file *);
/* Assuming the TYPE is a fixed point type, print its type description
on STREAM. */
diff --git a/gdb/ui-file.c b/gdb/ui-file.c
index e0814fe2b2d..20596840108 100644
--- a/gdb/ui-file.c
+++ b/gdb/ui-file.c
@@ -30,11 +30,9 @@
null_file null_stream;
-ui_file::ui_file ()
-{}
+ui_file::ui_file () {}
-ui_file::~ui_file ()
-{}
+ui_file::~ui_file () {}
void
ui_file::printf (const char *format, ...)
@@ -106,12 +104,12 @@ ui_file::printchar (int c, int quoter, bool async_safe)
char buf[4];
int out = 0;
- c &= 0xFF; /* Avoid sign bit follies */
+ c &= 0xFF; /* Avoid sign bit follies */
if (c < 0x20 /* Low control chars */
|| (c >= 0x7F && c < 0xA0) /* DEL, High controls */
|| (sevenbit_strings && c >= 0x80))
- { /* high order bit set */
+ { /* high order bit set */
buf[out++] = '\\';
switch (c)
@@ -159,8 +157,6 @@ ui_file::printchar (int c, int quoter, bool async_safe)
this->write (buf, out);
}
-
-
void
null_file::write (const char *buf, long sizeof_buf)
{
@@ -179,8 +175,6 @@ null_file::write_async_safe (const char *buf, long sizeof_buf)
/* Discard the request. */
}
-
-
/* true if the gdb terminal supports styling, and styling is enabled. */
static bool
@@ -205,10 +199,7 @@ term_cli_styling ()
return true;
}
-
-
-string_file::~string_file ()
-{}
+string_file::~string_file () {}
void
string_file::write (const char *buf, long length_buf)
@@ -232,8 +223,6 @@ string_file::can_emit_style_escape ()
return m_term_out && term_cli_styling ();
}
-
-
stdio_file::stdio_file (FILE *file, bool close_p)
{
set_stream (file);
@@ -244,7 +233,8 @@ stdio_file::stdio_file ()
: m_file (NULL),
m_fd (-1),
m_close_p (false)
-{}
+{
+}
stdio_file::~stdio_file ()
{
@@ -352,12 +342,9 @@ stdio_file::isatty ()
bool
stdio_file::can_emit_style_escape ()
{
- return (this->isatty ()
- && term_cli_styling ());
+ return (this->isatty () && term_cli_styling ());
}
-
-
/* This is the implementation of ui_file method 'write' for stderr.
gdb_stdout is flushed before writing to gdb_stderr. */
@@ -380,19 +367,17 @@ stderr_file::puts (const char *linebuffer)
stderr_file::stderr_file (FILE *stream)
: stdio_file (stream)
-{}
-
-
+{
+}
tee_file::tee_file (ui_file *one, ui_file *two)
: m_one (one),
m_two (two)
-{}
-
-tee_file::~tee_file ()
{
}
+tee_file::~tee_file () {}
+
void
tee_file::flush ()
{
@@ -440,8 +425,7 @@ tee_file::term_out ()
bool
tee_file::can_emit_style_escape ()
{
- return (m_one->term_out ()
- && term_cli_styling ());
+ return (m_one->term_out () && term_cli_styling ());
}
/* See ui-file.h. */
@@ -488,10 +472,11 @@ timestamped_file::write (const char *buf, long len)
steady_clock::time_point now = steady_clock::now ();
seconds s = duration_cast<seconds> (now.time_since_epoch ());
- microseconds us = duration_cast<microseconds> (now.time_since_epoch () - s);
- std::string timestamp = string_printf ("%ld.%06ld ",
- (long) s.count (),
- (long) us.count ());
+ microseconds us
+ = duration_cast<microseconds> (now.time_since_epoch () - s);
+ std::string timestamp
+ = string_printf ("%ld.%06ld ", (long) s.count (),
+ (long) us.count ());
m_stream->puts (timestamp.c_str ());
}
diff --git a/gdb/ui-file.h b/gdb/ui-file.h
index de24620e247..6db6e04b2ae 100644
--- a/gdb/ui-file.h
+++ b/gdb/ui-file.h
@@ -27,6 +27,7 @@
class ui_file
{
public:
+
ui_file ();
virtual ~ui_file () = 0;
@@ -67,37 +68,35 @@ public:
are rarely used, no point in having both for a rarely used
interface. */
virtual void write_async_safe (const char *buf, long length_buf)
- { gdb_assert_not_reached ("write_async_safe"); }
+ {
+ gdb_assert_not_reached ("write_async_safe");
+ }
/* Some ui_files override this to provide a efficient implementation
that avoids a strlen. */
- virtual void puts (const char *str)
- { this->write (str, strlen (str)); }
+ virtual void puts (const char *str) { this->write (str, strlen (str)); }
virtual long read (char *buf, long length_buf)
- { gdb_assert_not_reached ("can't read from this file type"); }
+ {
+ gdb_assert_not_reached ("can't read from this file type");
+ }
- virtual bool isatty ()
- { return false; }
+ virtual bool isatty () { return false; }
/* true indicates terminal output behaviour such as cli_styling.
This default implementation indicates to do terminal output
behaviour if the UI_FILE is a tty. A derived class can override
TERM_OUT to have cli_styling behaviour without being a tty. */
- virtual bool term_out ()
- { return isatty (); }
+ virtual bool term_out () { return isatty (); }
/* true if ANSI escapes can be used on STREAM. */
- virtual bool can_emit_style_escape ()
- { return false; }
+ virtual bool can_emit_style_escape () { return false; }
- virtual void flush ()
- {}
+ virtual void flush () {}
/* If this object has an underlying file descriptor, then return it.
Otherwise, return -1. */
- virtual int fd () const
- { return -1; }
+ virtual int fd () const { return -1; }
/* Indicate that if the next sequence of characters overflows the
line, a newline should be inserted here rather than when it hits
@@ -114,9 +113,7 @@ public:
This routine is guaranteed to force out any output which has been
squirreled away in the wrap_buffer, so wrap_here (0) can be
used to force out output from the wrap_buffer. */
- virtual void wrap_here (int indent)
- {
- }
+ virtual void wrap_here (int indent) {}
/* Emit an ANSI style escape for STYLE. */
virtual void emit_style_escape (const ui_file_style &style);
@@ -127,10 +124,7 @@ public:
/* Print STR, bypassing any paging that might be done by this
ui_file. Note that nearly no code should call this -- it's
intended for use by gdb_printf, but nothing else. */
- virtual void puts_unfiltered (const char *str)
- {
- this->puts (str);
- }
+ virtual void puts_unfiltered (const char *str) { this->puts (str); }
protected:
@@ -152,6 +146,7 @@ typedef std::unique_ptr<ui_file> ui_file_up;
class null_file : public ui_file
{
public:
+
void write (const char *buf, long length_buf) override;
void write_async_safe (const char *buf, long sizeof_buf) override;
void puts (const char *str) override;
@@ -168,13 +163,16 @@ extern int gdb_console_fputs (const char *, FILE *);
class string_file : public ui_file
{
public:
+
/* Construct a string_file to collect 'raw' output, i.e. without
'terminal' behaviour such as cli_styling. */
- string_file () : m_term_out (false) {};
+ string_file ()
+ : m_term_out (false) {};
/* If TERM_OUT, construct a string_file with terminal output behaviour
such as cli_styling)
else collect 'raw' output like the previous constructor. */
- explicit string_file (bool term_out) : m_term_out (term_out) {};
+ explicit string_file (bool term_out)
+ : m_term_out (term_out) {};
~string_file () override;
/* Override ui_file methods. */
@@ -182,7 +180,9 @@ public:
void write (const char *buf, long length_buf) override;
long read (char *buf, long length_buf) override
- { gdb_assert_not_reached ("a string_file is not readable"); }
+ {
+ gdb_assert_not_reached ("a string_file is not readable");
+ }
bool term_out () override;
bool can_emit_style_escape () override;
@@ -215,12 +215,17 @@ public:
/* Provide a few convenience methods with the same API as the
underlying std::string. */
const char *data () const { return m_string.data (); }
+
const char *c_str () const { return m_string.c_str (); }
+
size_t size () const { return m_string.size (); }
+
bool empty () const { return m_string.empty (); }
+
void clear () { return m_string.clear (); }
private:
+
/* The internal buffer. */
std::string m_string;
@@ -235,6 +240,7 @@ private:
class stdio_file : public ui_file
{
public:
+
/* Create a ui_file from a previously opened FILE. CLOSE_P
indicates whether the underlying file should be closed when the
stdio_file is destroyed. */
@@ -266,10 +272,10 @@ public:
bool can_emit_style_escape () override;
/* Return the underlying file descriptor. */
- int fd () const override
- { return m_fd; }
+ int fd () const override { return m_fd; }
private:
+
/* Sets the internal stream to FILE, and saves the FILE's file
descriptor in M_FD. */
void set_stream (FILE *file);
@@ -316,6 +322,7 @@ typedef std::unique_ptr<stdio_file> stdio_file_up;
class stderr_file : public stdio_file
{
public:
+
explicit stderr_file (FILE *stream);
/* Override the output routines to flush gdb_stdout before deferring
@@ -329,6 +336,7 @@ public:
class tee_file : public ui_file
{
public:
+
/* Create a file which writes to both ONE and TWO. Ownership of
both files is up to the user. */
tee_file (ui_file *one, ui_file *two);
@@ -362,6 +370,7 @@ public:
}
private:
+
/* The two underlying ui_files. */
ui_file *m_one;
ui_file *m_two;
@@ -373,22 +382,17 @@ private:
class no_terminal_escape_file : public stdio_file
{
public:
- no_terminal_escape_file ()
- {
- }
+
+ no_terminal_escape_file () {}
/* Like the stdio_file methods, but these filter out terminal escape
sequences. */
void write (const char *buf, long length_buf) override;
void puts (const char *linebuffer) override;
- void emit_style_escape (const ui_file_style &style) override
- {
- }
+ void emit_style_escape (const ui_file_style &style) override {}
- void reset_style () override
- {
- }
+ void reset_style () override {}
};
/* A base class for ui_file types that wrap another ui_file. */
@@ -397,36 +401,38 @@ class wrapped_file : public ui_file
{
public:
- bool isatty () override
- { return m_stream->isatty (); }
+ bool isatty () override { return m_stream->isatty (); }
- bool term_out () override
- { return m_stream->term_out (); }
+ bool term_out () override { return m_stream->term_out (); }
bool can_emit_style_escape () override
- { return m_stream->can_emit_style_escape (); }
+ {
+ return m_stream->can_emit_style_escape ();
+ }
- void flush () override
- { m_stream->flush (); }
+ void flush () override { m_stream->flush (); }
- void wrap_here (int indent) override
- { m_stream->wrap_here (indent); }
+ void wrap_here (int indent) override { m_stream->wrap_here (indent); }
void emit_style_escape (const ui_file_style &style) override
- { m_stream->emit_style_escape (style); }
+ {
+ m_stream->emit_style_escape (style);
+ }
/* Rest the current output style to the empty style. */
- void reset_style () override
- { m_stream->reset_style (); }
+ void reset_style () override { m_stream->reset_style (); }
- int fd () const override
- { return m_stream->fd (); }
+ int fd () const override { return m_stream->fd (); }
void puts_unfiltered (const char *str) override
- { m_stream->puts_unfiltered (str); }
+ {
+ m_stream->puts_unfiltered (str);
+ }
void write_async_safe (const char *buf, long length_buf) override
- { return m_stream->write_async_safe (buf, length_buf); }
+ {
+ return m_stream->write_async_safe (buf, length_buf);
+ }
protected:
@@ -448,6 +454,7 @@ protected:
class timestamped_file : public wrapped_file
{
public:
+
explicit timestamped_file (ui_file *stream)
: wrapped_file (stream)
{
diff --git a/gdb/ui-out.c b/gdb/ui-out.c
index 9380630c320..9ae5caada6b 100644
--- a/gdb/ui-out.c
+++ b/gdb/ui-out.c
@@ -21,7 +21,7 @@
along with this program. If not, see <http://www.gnu.org/licenses/>. */
#include "defs.h"
-#include "expression.h" /* For language.h */
+#include "expression.h" /* For language.h */
#include "language.h"
#include "ui-out.h"
#include "gdbsupport/format.h"
@@ -32,50 +32,36 @@
#include <memory>
#include <string>
-namespace {
+namespace
+{
/* A header of a ui_out_table. */
class ui_out_hdr
{
- public:
+public:
explicit ui_out_hdr (int number, int min_width, ui_align alignment,
const std::string &name, const std::string &header)
- : m_number (number),
- m_min_width (min_width),
- m_alignment (alignment),
- m_name (name),
- m_header (header)
+ : m_number (number),
+ m_min_width (min_width),
+ m_alignment (alignment),
+ m_name (name),
+ m_header (header)
{
}
- int number () const
- {
- return m_number;
- }
+ int number () const { return m_number; }
- int min_width () const
- {
- return m_min_width;
- }
+ int min_width () const { return m_min_width; }
- ui_align alignment () const
- {
- return m_alignment;
- }
+ ui_align alignment () const { return m_alignment; }
- const std::string &header () const
- {
- return m_header;
- }
+ const std::string &header () const { return m_header; }
- const std::string &name () const
- {
- return m_name;
- }
+ const std::string &name () const { return m_name; }
- private:
+private:
/* The number of the table column this header represents, 1-based. */
int m_number;
@@ -101,30 +87,21 @@ class ui_out_hdr
class ui_out_level
{
- public:
+public:
explicit ui_out_level (ui_out_type type)
- : m_type (type),
- m_field_count (0)
+ : m_type (type),
+ m_field_count (0)
{
}
- ui_out_type type () const
- {
- return m_type;
- }
+ ui_out_type type () const { return m_type; }
- int field_count () const
- {
- return m_field_count;
- }
+ int field_count () const { return m_field_count; }
- void inc_field_count ()
- {
- m_field_count++;
- }
+ void inc_field_count () { m_field_count++; }
- private:
+private:
/* The type of this level. */
ui_out_type m_type;
@@ -139,7 +116,7 @@ class ui_out_level
class ui_out_table
{
- public:
+public:
/* States (steps) of a table generation. */
@@ -153,10 +130,10 @@ class ui_out_table
};
explicit ui_out_table (int entry_level, int nr_cols, const std::string &id)
- : m_state (state::HEADERS),
- m_entry_level (entry_level),
- m_nr_cols (nr_cols),
- m_id (id)
+ : m_state (state::HEADERS),
+ m_entry_level (entry_level),
+ m_nr_cols (nr_cols),
+ m_id (id)
{
}
@@ -175,7 +152,7 @@ class ui_out_table
the header iterator. Return false if there was no next header. */
bool get_next_header (int *colno, int *width, ui_align *alignment,
- const char **col_hdr);
+ const char **col_hdr);
bool query_field (int colno, int *width, int *alignment,
const char **col_name) const;
@@ -184,7 +161,7 @@ class ui_out_table
int entry_level () const;
- private:
+private:
state m_state;
@@ -209,18 +186,19 @@ class ui_out_table
/* See ui-out.h. */
-void ui_out_table::start_body ()
+void
+ui_out_table::start_body ()
{
if (m_state != state::HEADERS)
- internal_error (_("extra table_body call not allowed; there must be only "
- "one table_body after a table_begin and before a "
- "table_end."));
+ internal_error (_ ("extra table_body call not allowed; there must be only "
+ "one table_body after a table_begin and before a "
+ "table_end."));
/* Check if the number of defined headers matches the number of expected
columns. */
if (m_headers.size () != m_nr_cols)
- internal_error (_("number of headers differ from number of table "
- "columns."));
+ internal_error (_ ("number of headers differ from number of table "
+ "columns."));
m_state = state::BODY;
m_headers_iterator = m_headers.begin ();
@@ -228,32 +206,35 @@ void ui_out_table::start_body ()
/* See ui-out.h. */
-void ui_out_table::append_header (int width, ui_align alignment,
- const std::string &col_name,
- const std::string &col_hdr)
+void
+ui_out_table::append_header (int width, ui_align alignment,
+ const std::string &col_name,
+ const std::string &col_hdr)
{
if (m_state != state::HEADERS)
- internal_error (_("table header must be specified after table_begin and "
- "before table_body."));
+ internal_error (_ ("table header must be specified after table_begin and "
+ "before table_body."));
std::unique_ptr<ui_out_hdr> header (new ui_out_hdr (m_headers.size () + 1,
- width, alignment,
- col_name, col_hdr));
+ width, alignment,
+ col_name, col_hdr));
m_headers.push_back (std::move (header));
}
/* See ui-out.h. */
-void ui_out_table::start_row ()
+void
+ui_out_table::start_row ()
{
m_headers_iterator = m_headers.begin ();
}
/* See ui-out.h. */
-bool ui_out_table::get_next_header (int *colno, int *width, ui_align *alignment,
- const char **col_hdr)
+bool
+ui_out_table::get_next_header (int *colno, int *width, ui_align *alignment,
+ const char **col_hdr)
{
/* There may be no headers at all or we may have used all columns. */
if (m_headers_iterator == m_headers.end ())
@@ -274,8 +255,9 @@ bool ui_out_table::get_next_header (int *colno, int *width, ui_align *alignment,
/* See ui-out.h. */
-bool ui_out_table::query_field (int colno, int *width, int *alignment,
- const char **col_name) const
+bool
+ui_out_table::query_field (int colno, int *width, int *alignment,
+ const char **col_name) const
{
/* Column numbers are 1-based, so convert to 0-based index. */
int index = colno - 1;
@@ -298,14 +280,16 @@ bool ui_out_table::query_field (int colno, int *width, int *alignment,
/* See ui-out.h. */
-ui_out_table::state ui_out_table::current_state () const
+ui_out_table::state
+ui_out_table::current_state () const
{
return m_state;
}
/* See ui-out.h. */
-int ui_out_table::entry_level () const
+int
+ui_out_table::entry_level () const
{
return m_entry_level;
}
@@ -351,7 +335,7 @@ void
ui_out::table_begin (int nr_cols, int nr_rows, const std::string &tblid)
{
if (m_table_up != nullptr)
- internal_error (_("tables cannot be nested; table_begin found before \
+ internal_error (_ ("tables cannot be nested; table_begin found before \
previous table_end."));
m_table_up.reset (new ui_out_table (level () + 1, nr_cols, tblid));
@@ -364,7 +348,7 @@ ui_out::table_header (int width, ui_align alignment,
const std::string &col_name, const std::string &col_hdr)
{
if (m_table_up == nullptr)
- internal_error (_("table_header outside a table is not valid; it must be \
+ internal_error (_ ("table_header outside a table is not valid; it must be \
after a table_begin and before a table_body."));
m_table_up->append_header (width, alignment, col_name, col_hdr);
@@ -376,8 +360,8 @@ void
ui_out::table_body ()
{
if (m_table_up == nullptr)
- internal_error (_("table_body outside a table is not valid; it must be "
- "after a table_begin and before a table_end."));
+ internal_error (_ ("table_body outside a table is not valid; it must be "
+ "after a table_begin and before a table_end."));
m_table_up->start_body ();
@@ -388,7 +372,7 @@ void
ui_out::table_end ()
{
if (m_table_up == nullptr)
- internal_error (_("misplaced table_end or missing table_begin."));
+ internal_error (_ ("misplaced table_end or missing table_begin."));
do_table_end ();
@@ -569,8 +553,7 @@ ui_out::text (const char *string)
}
void
-ui_out::call_do_message (const ui_file_style &style, const char *format,
- ...)
+ui_out::call_do_message (const ui_file_style &style, const char *format, ...)
{
va_list args;
@@ -605,10 +588,8 @@ ui_out::vmessage (const ui_file_style &in_style, const char *format,
intvals[i] = va_arg (args, int);
/* The only ones we support for now. */
- gdb_assert (piece.n_int_args == 0
- || piece.argclass == string_arg
- || piece.argclass == int_arg
- || piece.argclass == long_arg);
+ gdb_assert (piece.n_int_args == 0 || piece.argclass == string_arg
+ || piece.argclass == int_arg || piece.argclass == long_arg);
switch (piece.argclass)
{
@@ -624,8 +605,8 @@ ui_out::vmessage (const ui_file_style &in_style, const char *format,
call_do_message (style, current_substring, intvals[0], str);
break;
case 2:
- call_do_message (style, current_substring,
- intvals[0], intvals[1], str);
+ call_do_message (style, current_substring, intvals[0],
+ intvals[1], str);
break;
}
}
@@ -651,8 +632,8 @@ ui_out::vmessage (const ui_file_style &in_style, const char *format,
call_do_message (style, current_substring, intvals[0], val);
break;
case 2:
- call_do_message (style, current_substring,
- intvals[0], intvals[1], val);
+ call_do_message (style, current_substring, intvals[0],
+ intvals[1], val);
break;
}
}
@@ -669,8 +650,8 @@ ui_out::vmessage (const ui_file_style &in_style, const char *format,
call_do_message (style, current_substring, intvals[0], val);
break;
case 2:
- call_do_message (style, current_substring,
- intvals[0], intvals[1], val);
+ call_do_message (style, current_substring, intvals[0],
+ intvals[1], val);
break;
}
}
@@ -687,8 +668,8 @@ ui_out::vmessage (const ui_file_style &in_style, const char *format,
call_do_message (style, current_substring, intvals[0], val);
break;
case 2:
- call_do_message (style, current_substring,
- intvals[0], intvals[1], val);
+ call_do_message (style, current_substring, intvals[0],
+ intvals[1], val);
break;
}
}
@@ -750,7 +731,8 @@ ui_out::vmessage (const ui_file_style &in_style, const char *format,
}
break;
default:
- call_do_message (style, current_substring, va_arg (args, void *));
+ call_do_message (style, current_substring,
+ va_arg (args, void *));
break;
}
break;
@@ -765,7 +747,7 @@ ui_out::vmessage (const ui_file_style &in_style, const char *format,
call_do_message (style, current_substring, 0);
break;
default:
- internal_error (_("failed internal consistency check"));
+ internal_error (_ ("failed internal consistency check"));
}
}
}
@@ -825,7 +807,7 @@ ui_out::verify_field (int *fldno, int *width, ui_align *align)
if (m_table_up != nullptr
&& m_table_up->current_state () != ui_out_table::state::BODY)
{
- internal_error (_("table_body missing; table fields must be \
+ internal_error (_ ("table_body missing; table fields must be \
specified after table_body and inside a list."));
}
@@ -837,7 +819,7 @@ specified after table_body and inside a list."));
&& m_table_up->get_next_header (fldno, width, align, &text))
{
if (*fldno != current->field_count ())
- internal_error (_("ui-out internal error in handling headers."));
+ internal_error (_ ("ui-out internal error in handling headers."));
}
else
{
@@ -862,12 +844,10 @@ ui_out::query_table_field (int colno, int *width, int *alignment,
/* The constructor. */
ui_out::ui_out (ui_out_flags flags)
-: m_flags (flags)
+ : m_flags (flags)
{
/* Create the ui-out level #1, the default level. */
push_level (ui_out_type_tuple);
}
-ui_out::~ui_out ()
-{
-}
+ui_out::~ui_out () {}
diff --git a/gdb/ui-out.h b/gdb/ui-out.h
index c7ae6698bbf..bcd60d1ddc4 100644
--- a/gdb/ui-out.h
+++ b/gdb/ui-out.h
@@ -41,12 +41,12 @@ extern struct ui_out **current_ui_current_uiout_ptr (void);
/* alignment enum */
enum ui_align
- {
- ui_left = -1,
- ui_center,
- ui_right,
- ui_noalign
- };
+{
+ ui_left = -1,
+ ui_center,
+ ui_right,
+ ui_noalign
+};
/* flags enum */
enum ui_out_flag
@@ -67,20 +67,20 @@ DEF_ENUM_FLAGS_TYPE (ui_out_flag, ui_out_flags);
tuples. */
enum ui_out_type
- {
- ui_out_type_tuple,
- ui_out_type_list
- };
+{
+ ui_out_type_tuple,
+ ui_out_type_list
+};
/* The possible kinds of fields. */
enum class field_kind
- {
- /* "FIELD_STRING" needs a funny name to avoid clashes with tokens
+{
+ /* "FIELD_STRING" needs a funny name to avoid clashes with tokens
named "STRING". See PR build/25250. FIELD_SIGNED is given a
similar name for consistency. */
- FIELD_SIGNED,
- FIELD_STRING,
- };
+ FIELD_SIGNED,
+ FIELD_STRING,
+};
/* The base type of all fields that can be emitted using %pF. */
@@ -102,8 +102,7 @@ struct signed_field_s : base_field_s
it's not possible to pass a reference via va_args. */
static inline signed_field_s *
-signed_field (const char *name, LONGEST val,
- signed_field_s &&tmp = {})
+signed_field (const char *name, LONGEST val, signed_field_s &&tmp = {})
{
tmp.name = name;
tmp.kind = field_kind::FIELD_SIGNED;
@@ -123,8 +122,7 @@ struct string_field_s : base_field_s
it's not possible to pass a reference via va_args. */
static inline string_field_s *
-string_field (const char *name, const char *str,
- string_field_s &&tmp = {})
+string_field (const char *name, const char *str, string_field_s &&tmp = {})
{
tmp.name = name;
tmp.kind = field_kind::FIELD_STRING;
@@ -158,7 +156,7 @@ styled_string (const ui_file_style &style, const char *str,
class ui_out
{
- public:
+public:
explicit ui_out (ui_out_flags flags = 0);
virtual ~ui_out ();
@@ -189,22 +187,24 @@ class ui_out
CORE_ADDR address);
void field_string (const char *fldname, const char *string,
const ui_file_style &style = ui_file_style ());
+
void field_string (const char *fldname, const std::string &string,
const ui_file_style &style = ui_file_style ())
{
field_string (fldname, string.c_str (), style);
}
+
void field_stream (const char *fldname, string_file &stream,
const ui_file_style &style = ui_file_style ());
void field_skip (const char *fldname);
void field_fmt (const char *fldname, const char *format, ...)
ATTRIBUTE_PRINTF (3, 4);
void field_fmt (const char *fldname, const ui_file_style &style,
- const char *format, ...)
- ATTRIBUTE_PRINTF (4, 5);
+ const char *format, ...) ATTRIBUTE_PRINTF (4, 5);
void spaces (int numspaces);
void text (const char *string);
+
void text (const std::string &string) { text (string.c_str ()); }
/* Output a printf-style formatted string. In addition to the usual
@@ -252,8 +252,8 @@ class ui_out
because code in GDB that wants to print a host address should use
host_address_to_string instead of %p. */
void message (const char *format, ...) ATTRIBUTE_PRINTF (2, 3);
- void vmessage (const ui_file_style &in_style,
- const char *format, va_list args) ATTRIBUTE_PRINTF (3, 0);
+ void vmessage (const ui_file_style &in_style, const char *format,
+ va_list args) ATTRIBUTE_PRINTF (3, 0);
void wrap_hint (int indent);
@@ -282,6 +282,7 @@ class ui_out
class progress_update
{
public:
+
/* Represents the printing state of a progress update. */
enum state
{
@@ -300,27 +301,25 @@ class ui_out
m_uiout->do_progress_start ();
}
- ~progress_update ()
- {
-
- }
+ ~progress_update () {}
progress_update (const progress_update &) = delete;
progress_update &operator= (const progress_update &) = delete;
/* Emit some progress for this progress meter. Includes current
amount of progress made and total amount in the display. */
- void update_progress (const std::string& msg, const char *unit,
- double cur, double total)
+ void update_progress (const std::string &msg, const char *unit, double cur,
+ double total)
{
m_uiout->do_progress_notify (msg, unit, cur, total);
}
/* Emit some progress for this progress meter. */
- void update_progress (const std::string& msg)
+ void update_progress (const std::string &msg)
{
m_uiout->do_progress_notify (msg, "", -1, -1);
}
+
private:
struct ui_out *m_uiout;
@@ -328,7 +327,7 @@ class ui_out
virtual void do_progress_end () = 0;
- protected:
+protected:
virtual void do_table_begin (int nbrofcols, int nr_rows, const char *tblid)
= 0;
@@ -336,45 +335,51 @@ class ui_out
virtual void do_table_end () = 0;
virtual void do_table_header (int width, ui_align align,
const std::string &col_name,
- const std::string &col_hdr) = 0;
+ const std::string &col_hdr)
+ = 0;
virtual void do_begin (ui_out_type type, const char *id) = 0;
virtual void do_end (ui_out_type type) = 0;
virtual void do_field_signed (int fldno, int width, ui_align align,
- const char *fldname, LONGEST value) = 0;
+ const char *fldname, LONGEST value)
+ = 0;
virtual void do_field_unsigned (int fldno, int width, ui_align align,
- const char *fldname, ULONGEST value) = 0;
+ const char *fldname, ULONGEST value)
+ = 0;
virtual void do_field_skip (int fldno, int width, ui_align align,
- const char *fldname) = 0;
+ const char *fldname)
+ = 0;
virtual void do_field_string (int fldno, int width, ui_align align,
const char *fldname, const char *string,
- const ui_file_style &style) = 0;
+ const ui_file_style &style)
+ = 0;
virtual void do_field_fmt (int fldno, int width, ui_align align,
const char *fldname, const ui_file_style &style,
const char *format, va_list args)
- ATTRIBUTE_PRINTF (7, 0) = 0;
+ ATTRIBUTE_PRINTF (7, 0)
+ = 0;
virtual void do_spaces (int numspaces) = 0;
virtual void do_text (const char *string) = 0;
- virtual void do_message (const ui_file_style &style,
- const char *format, va_list args)
- ATTRIBUTE_PRINTF (3,0) = 0;
+ virtual void do_message (const ui_file_style &style, const char *format,
+ va_list args) ATTRIBUTE_PRINTF (3, 0)
+ = 0;
virtual void do_wrap_hint (int indent) = 0;
virtual void do_flush () = 0;
virtual void do_redirect (struct ui_file *outstream) = 0;
virtual void do_progress_start () = 0;
- virtual void do_progress_notify (const std::string &, const char *,
- double, double) = 0;
+ virtual void do_progress_notify (const std::string &, const char *, double,
+ double)
+ = 0;
/* Set as not MI-like by default. It is overridden in subclasses if
necessary. */
- virtual bool do_is_mi_like_p () const
- { return false; }
+ virtual bool do_is_mi_like_p () const { return false; }
- private:
- void call_do_message (const ui_file_style &style, const char *format,
- ...);
+private:
+
+ void call_do_message (const ui_file_style &style, const char *format, ...);
ui_out_flags m_flags;
@@ -404,10 +409,7 @@ public:
uiout->begin (Type, id);
}
- ~ui_out_emit_type ()
- {
- m_uiout->end (Type);
- }
+ ~ui_out_emit_type () { m_uiout->end (Type); }
DISABLE_COPY_AND_ASSIGN (ui_out_emit_type<Type>);
@@ -432,10 +434,7 @@ public:
m_uiout->table_begin (nr_cols, nr_rows, tblid);
}
- ~ui_out_emit_table ()
- {
- m_uiout->table_end ();
- }
+ ~ui_out_emit_table () { m_uiout->table_end (); }
ui_out_emit_table (const ui_out_emit_table &) = delete;
ui_out_emit_table &operator= (const ui_out_emit_table &) = delete;
@@ -458,15 +457,13 @@ public:
m_uiout->redirect (stream);
}
- ~ui_out_redirect_pop ()
- {
- m_uiout->redirect (NULL);
- }
+ ~ui_out_redirect_pop () { m_uiout->redirect (NULL); }
ui_out_redirect_pop (const ui_out_redirect_pop &) = delete;
ui_out_redirect_pop &operator= (const ui_out_redirect_pop &) = delete;
private:
+
struct ui_out *m_uiout;
};
diff --git a/gdb/ui-style.c b/gdb/ui-style.c
index 1ea224c1ad0..9c9316dd4c5 100644
--- a/gdb/ui-style.c
+++ b/gdb/ui-style.c
@@ -35,7 +35,7 @@ static const char ansi_regex_text[] =
"[\x20-\x2f]*"
/* End the first capture. */
")"
- /* The final byte. */
+/* The final byte. */
#define FINAL_SUBEXP 2
"([\x40-\x7e])";
@@ -52,14 +52,14 @@ static regex_t ansi_regex;
xterm. */
static const uint8_t bright_colors[][3] = {
- { 127, 127, 127 }, /* Black. */
- { 255, 0, 0 }, /* Red. */
- { 0, 255, 0 }, /* Green. */
- { 255, 255, 0 }, /* Yellow. */
- { 92, 92, 255 }, /* Blue. */
- { 255, 0, 255 }, /* Magenta. */
- { 0, 255, 255 }, /* Cyan. */
- { 255, 255, 255 } /* White. */
+ { 127, 127, 127 }, /* Black. */
+ { 255, 0, 0 }, /* Red. */
+ { 0, 255, 0 }, /* Green. */
+ { 255, 255, 0 }, /* Yellow. */
+ { 92, 92, 255 }, /* Blue. */
+ { 255, 0, 255 }, /* Magenta. */
+ { 0, 255, 255 }, /* Cyan. */
+ { 255, 255, 255 } /* White. */
};
/* See ui-style.h. */
@@ -84,8 +84,7 @@ ui_file_style::color::append_ansi (bool is_fg, std::string *str) const
else
{
str->append (is_fg ? "38;2;" : "48;2;");
- str->append (std::to_string (m_red)
- + ";" + std::to_string (m_green)
+ str->append (std::to_string (m_red) + ";" + std::to_string (m_green)
+ ";" + std::to_string (m_blue));
}
return true;
@@ -208,12 +207,9 @@ extended_color (const char *str, regoff_t *idx, ui_file_style::color *color)
{
/* 24-bit color. */
long r, g, b;
- if (!read_semi_number (str, idx, &r)
- || r > 255
- || !read_semi_number (str, idx, &g)
- || g > 255
- || !read_semi_number (str, idx, &b)
- || b > 255)
+ if (!read_semi_number (str, idx, &r) || r > 255
+ || !read_semi_number (str, idx, &g) || g > 255
+ || !read_semi_number (str, idx, &b) || b > 255)
return false;
*color = ui_file_style::color (r, g, b);
}
@@ -264,8 +260,7 @@ ui_file_style::parse (const char *buf, size_t *n_read)
if (subexps[DATA_SUBEXP].rm_so == subexps[DATA_SUBEXP].rm_eo)
*this = ui_file_style ();
- for (regoff_t i = subexps[DATA_SUBEXP].rm_so;
- i < subexps[DATA_SUBEXP].rm_eo;
+ for (regoff_t i = subexps[DATA_SUBEXP].rm_so; i < subexps[DATA_SUBEXP].rm_eo;
++i)
{
if (buf[i] == ';')
@@ -405,6 +400,7 @@ skip_ansi_escape (const char *buf, int *n_read)
}
void _initialize_ui_style ();
+
void
_initialize_ui_style ()
{
diff --git a/gdb/ui-style.h b/gdb/ui-style.h
index 5d19fabd996..a5bdafd0b3f 100644
--- a/gdb/ui-style.h
+++ b/gdb/ui-style.h
@@ -73,7 +73,7 @@ struct ui_file_style
&& m_blue == other.m_blue);
}
- bool operator< (const color &other) const
+ bool operator<(const color &other) const
{
if (m_simple != other.m_simple)
return m_simple < other.m_simple;
@@ -92,10 +92,7 @@ struct ui_file_style
}
/* Return true if this is the "NONE" color, false otherwise. */
- bool is_none () const
- {
- return m_simple && m_value == NONE;
- }
+ bool is_none () const { return m_simple && m_value == NONE; }
/* Return true if this is one of the basic colors, false
otherwise. */
@@ -126,9 +123,11 @@ struct ui_file_style
private:
bool m_simple;
+
union
{
int m_value;
+
struct
{
uint8_t m_red, m_green, m_blue;
@@ -173,54 +172,31 @@ struct ui_file_style
otherwise. */
bool is_default () const
{
- return (m_foreground == NONE
- && m_background == NONE
- && m_intensity == NORMAL
- && !m_reverse);
+ return (m_foreground == NONE && m_background == NONE
+ && m_intensity == NORMAL && !m_reverse);
}
/* Return true if this style specified reverse display; false
otherwise. */
- bool is_reverse () const
- {
- return m_reverse;
- }
+ bool is_reverse () const { return m_reverse; }
/* Set/clear the reverse display flag. */
- void set_reverse (bool reverse)
- {
- m_reverse = reverse;
- }
+ void set_reverse (bool reverse) { m_reverse = reverse; }
/* Return the foreground color of this style. */
- const color &get_foreground () const
- {
- return m_foreground;
- }
+ const color &get_foreground () const { return m_foreground; }
/* Set the foreground color of this style. */
- void set_fg (color c)
- {
- m_foreground = c;
- }
+ void set_fg (color c) { m_foreground = c; }
/* Return the background color of this style. */
- const color &get_background () const
- {
- return m_background;
- }
+ const color &get_background () const { return m_background; }
/* Set the background color of this style. */
- void set_bg (color c)
- {
- m_background = c;
- }
+ void set_bg (color c) { m_background = c; }
/* Return the intensity of this style. */
- intensity get_intensity () const
- {
- return m_intensity;
- }
+ intensity get_intensity () const { return m_intensity; }
/* Parse an ANSI escape sequence in BUF, modifying this style. BUF
must begin with an ESC character. Return true if an escape
@@ -230,10 +206,7 @@ struct ui_file_style
bool parse (const char *buf, size_t *n_read);
/* We need this because we can't pass a reference via va_args. */
- const ui_file_style *ptr () const
- {
- return this;
- }
+ const ui_file_style *ptr () const { return this; }
private:
diff --git a/gdb/unittests/array-view-selftests.c b/gdb/unittests/array-view-selftests.c
index b47cf7fad8f..82e8c3adb70 100644
--- a/gdb/unittests/array-view-selftests.c
+++ b/gdb/unittests/array-view-selftests.c
@@ -23,11 +23,13 @@
#include <array>
#include <vector>
-namespace selftests {
-namespace array_view_tests {
+namespace selftests
+{
+namespace array_view_tests
+{
/* Triviality checks. */
-#define CHECK_TRAIT(TRAIT) \
+#define CHECK_TRAIT(TRAIT) \
static_assert (std::TRAIT<gdb::array_view<gdb_byte>>::value, "")
#if HAVE_IS_TRIVIALLY_COPYABLE
@@ -61,31 +63,42 @@ check_convertible ()
return (true
/* immutable array_view */
- && is_convertible<const T (&) [1], array_view<const T>> ()
- && is_convertible<T (&) [1], array_view<const T>> ()
- && is_convertible<const T, array_view<const T>> ()
- && is_convertible<T, array_view<const T>> ()
+ && is_convertible<const T (&)[1], array_view<const T>> ()
+ && is_convertible<T (&)[1], array_view<const T>> ()
+ && is_convertible<const T, array_view<const T>> ()
+ && is_convertible<T, array_view<const T>> ()
/* mutable array_view */
- && is_convertible<T (&) [1], array_view<T>> ()
- && !is_convertible<const T (&) [1], array_view<T>> ()
- && is_convertible<T, array_view<T>> ()
- && !is_convertible<const T, array_view<T>> ()
+ && is_convertible<T (&)[1], array_view<T>> ()
+ && !is_convertible<const T (&)[1], array_view<T>> ()
+ && is_convertible<T, array_view<T>> ()
+ && !is_convertible<const T, array_view<T>> ()
/* While float is implicitly convertible to gdb_byte, we
don't want implicit float->array_view<gdb_byte>
conversion. */
- && !is_convertible<float, array_view<const T>> ()
- && !is_convertible<float, array_view<T>> ());
+ && !is_convertible<float, array_view<const T>> ()
+ && !is_convertible<float, array_view<T>> ());
}
static_assert (check_convertible (), "");
namespace no_slicing
{
-struct A { int i; };
-struct B : A { int j; };
-struct C : A { int l; };
+struct A
+{
+ int i;
+};
+
+struct B : A
+{
+ int j;
+};
+
+struct C : A
+{
+ int l;
+};
/* Check that there's no array->view conversion for arrays of derived types or
subclasses. */
@@ -98,48 +111,49 @@ check ()
/* array->view */
- && is_convertible <A (&)[1], array_view<A>> ()
- && !is_convertible <B (&)[1], array_view<A>> ()
- && !is_convertible <C (&)[1], array_view<A>> ()
+ && is_convertible<A (&)[1], array_view<A>> ()
+ && !is_convertible<B (&)[1], array_view<A>> ()
+ && !is_convertible<C (&)[1], array_view<A>> ()
- && !is_convertible <A (&)[1], array_view<B>> ()
- && is_convertible <B (&)[1], array_view<B>> ()
- && !is_convertible <C (&)[1], array_view<B>> ()
+ && !is_convertible<A (&)[1], array_view<B>> ()
+ && is_convertible<B (&)[1], array_view<B>> ()
+ && !is_convertible<C (&)[1], array_view<B>> ()
/* elem->view */
- && is_convertible <A, array_view<A>> ()
- && !is_convertible <B, array_view<A>> ()
- && !is_convertible <C, array_view<A>> ()
+ && is_convertible<A, array_view<A>> ()
+ && !is_convertible<B, array_view<A>> ()
+ && !is_convertible<C, array_view<A>> ()
- && !is_convertible <A, array_view<B>> ()
- && is_convertible <B, array_view<B>> ()
- && !is_convertible <C, array_view<B>> ());
+ && !is_convertible<A, array_view<B>> ()
+ && is_convertible<B, array_view<B>> ()
+ && !is_convertible<C, array_view<B>> ());
}
/* Check that there's no container->view conversion for containers of derived
types or subclasses. */
-template<template<typename ...> class Container>
+template<template<typename...> class Container>
static constexpr bool
check_ctor_from_container ()
{
using gdb::array_view;
- return ( is_convertible <Container<A>, array_view<A>> ()
- && !is_convertible <Container<B>, array_view<A>> ()
- && !is_convertible <Container<C>, array_view<A>> ()
+ return (is_convertible<Container<A>, array_view<A>> ()
+ && !is_convertible<Container<B>, array_view<A>> ()
+ && !is_convertible<Container<C>, array_view<A>> ()
- && !is_convertible <Container<A>, array_view<B>> ()
- && is_convertible <Container<B>, array_view<B>> ()
- && !is_convertible <Container<C>, array_view<B>> ());
+ && !is_convertible<Container<A>, array_view<B>> ()
+ && is_convertible<Container<B>, array_view<B>> ()
+ && !is_convertible<Container<C>, array_view<B>> ());
}
} /* namespace no_slicing */
/* std::array with only one template argument, so we can pass it to
check_ctor_from_container. */
-template<typename T> using StdArray1 = std::array<T, 1>;
+template<typename T>
+using StdArray1 = std::array<T, 1>;
static_assert (no_slicing::check (), "");
static_assert (no_slicing::check_ctor_from_container<std::vector> (), "");
@@ -156,9 +170,8 @@ check_convertible_from_std_vector ()
/* Note there's no such thing as std::vector<const T>. */
- return (true
- && is_convertible <std::vector<T>, array_view<T>> ()
- && is_convertible <std::vector<T>, array_view<const T>> ());
+ return (true && is_convertible<std::vector<T>, array_view<T>> ()
+ && is_convertible<std::vector<T>, array_view<const T>> ());
}
static_assert (check_convertible_from_std_vector (), "");
@@ -173,11 +186,10 @@ check_convertible_from_std_array ()
/* Note: a non-const T view can't refer to a const T array. */
- return (true
- && is_convertible <std::array<T, 1>, array_view<T>> ()
- && is_convertible <std::array<T, 1>, array_view<const T>> ()
- && !is_convertible <std::array<const T, 1>, array_view<T>> ()
- && is_convertible <std::array<const T, 1>, array_view<const T>> ());
+ return (true && is_convertible<std::array<T, 1>, array_view<T>> ()
+ && is_convertible<std::array<T, 1>, array_view<const T>> ()
+ && !is_convertible<std::array<const T, 1>, array_view<T>> ()
+ && is_convertible<std::array<const T, 1>, array_view<const T>> ());
}
static_assert (check_convertible_from_std_array (), "");
@@ -253,7 +265,7 @@ template<typename T>
static void
check_ptr_size_ctor ()
{
- T data[] = {0x11, 0x22, 0x33, 0x44};
+ T data[] = { 0x11, 0x22, 0x33, 0x44 };
gdb::array_view<T> view (data + 1, 2);
@@ -288,18 +300,22 @@ require_not_constructible ()
static void
check_ptr_size_ctor2 ()
{
- struct A {};
+ struct A
+ {
+ };
+
A an_a;
A *array[] = { &an_a };
- const A * const carray[] = { &an_a };
+ const A *const carray[] = { &an_a };
- gdb::array_view<A *> v1 = {array, ARRAY_SIZE (array)};
- gdb::array_view<A *> v2 = {array, (char) ARRAY_SIZE (array)};
- gdb::array_view<A * const> v3 = {array, ARRAY_SIZE (array)};
- gdb::array_view<const A * const> cv1 = {carray, ARRAY_SIZE (carray)};
+ gdb::array_view<A *> v1 = { array, ARRAY_SIZE (array) };
+ gdb::array_view<A *> v2 = { array, (char) ARRAY_SIZE (array) };
+ gdb::array_view<A *const> v3 = { array, ARRAY_SIZE (array) };
+ gdb::array_view<const A *const> cv1 = { carray, ARRAY_SIZE (carray) };
- require_not_constructible<gdb::array_view<A *>, decltype (carray), size_t> ();
+ require_not_constructible<gdb::array_view<A *>, decltype (carray),
+ size_t> ();
SELF_CHECK (v1[0] == array[0]);
SELF_CHECK (v2[0] == array[0]);
@@ -323,7 +339,7 @@ template<typename T>
static void
check_ptr_ptr_ctor ()
{
- T data[] = {0x11, 0x22, 0x33, 0x44};
+ T data[] = { 0x11, 0x22, 0x33, 0x44 };
gdb::array_view<T> view (data + 1, data + 3);
@@ -333,7 +349,7 @@ check_ptr_ptr_ctor ()
SELF_CHECK (view[0] == data[1]);
SELF_CHECK (view[1] == data[2]);
- gdb_byte array[] = {0x11, 0x22, 0x33, 0x44};
+ gdb_byte array[] = { 0x11, 0x22, 0x33, 0x44 };
const gdb_byte *p1 = array;
gdb_byte *p2 = array + ARRAY_SIZE (array);
gdb::array_view<const gdb_byte> view2 (p1, p2);
@@ -344,7 +360,7 @@ check_ptr_ptr_ctor ()
static void
check_ptr_ptr_mixed_cv ()
{
- gdb_byte array[] = {0x11, 0x22, 0x33, 0x44};
+ gdb_byte array[] = { 0x11, 0x22, 0x33, 0x44 };
const gdb_byte *cp = array;
gdb_byte *p = array;
gdb::array_view<const gdb_byte> view1 (cp, p);
@@ -360,7 +376,7 @@ template<typename T>
static void
check_range_for ()
{
- T data[] = {1, 2, 3, 4};
+ T data[] = { 1, 2, 3, 4 };
gdb::array_view<T> view (data);
typename std::decay<T>::type sum = 0;
@@ -387,8 +403,8 @@ run_tests ()
static_assert (view2.data () == nullptr, "");
}
- std::vector<gdb_byte> vec = {0x11, 0x22, 0x33, 0x44 };
- std::array<gdb_byte, 4> array = {{0x11, 0x22, 0x33, 0x44}};
+ std::vector<gdb_byte> vec = { 0x11, 0x22, 0x33, 0x44 };
+ std::array<gdb_byte, 4> array = { { 0x11, 0x22, 0x33, 0x44 } };
/* Various tests of views over std::vector. */
{
@@ -429,7 +445,7 @@ run_tests ()
/* Test copy/move ctor and mutable->immutable conversion. */
{
- gdb_byte data[] = {0x11, 0x22, 0x33, 0x44};
+ gdb_byte data[] = { 0x11, 0x22, 0x33, 0x44 };
gdb::array_view<gdb_byte> view1 = data;
gdb::array_view<gdb_byte> view2 = view1;
gdb::array_view<gdb_byte> view3 = std::move (view1);
@@ -446,7 +462,7 @@ run_tests ()
/* Same, but op=(view). */
{
- gdb_byte data[] = {0x55, 0x66, 0x77, 0x88};
+ gdb_byte data[] = { 0x55, 0x66, 0x77, 0x88 };
gdb::array_view<gdb_byte> view1;
gdb::array_view<gdb_byte> view2;
gdb::array_view<gdb_byte> view3;
@@ -470,7 +486,7 @@ run_tests ()
/* op[] */
{
- std::vector<gdb_byte> vec2 = {0x11, 0x22};
+ std::vector<gdb_byte> vec2 = { 0x11, 0x22 };
gdb::array_view<gdb_byte> view = vec2;
gdb::array_view<const gdb_byte> cview = vec2;
@@ -512,7 +528,7 @@ run_tests ()
/* gdb::make_array_view, int length. */
{
- gdb_byte data[] = {0x55, 0x66, 0x77, 0x88};
+ gdb_byte data[] = { 0x55, 0x66, 0x77, 0x88 };
int len = sizeof (data) / sizeof (data[0]);
auto view = gdb::make_array_view (data, len);
@@ -525,7 +541,7 @@ run_tests ()
/* Test slicing. */
{
- gdb_byte data[] = {0x55, 0x66, 0x77, 0x88, 0x99};
+ gdb_byte data[] = { 0x55, 0x66, 0x77, 0x88, 0x99 };
gdb::array_view<gdb_byte> view = data;
{
@@ -546,13 +562,13 @@ run_tests ()
}
}
-template <typename T>
+template<typename T>
void
run_copy_test ()
{
/* Test non-overlapping copy. */
{
- const std::vector<T> src_v = {1, 2, 3, 4};
+ const std::vector<T> src_v = { 1, 2, 3, 4 };
std::vector<T> dest_v (4, -1);
SELF_CHECK (dest_v != src_v);
@@ -562,37 +578,34 @@ run_copy_test ()
/* Test overlapping copy, where the source is before the destination. */
{
- std::vector<T> vec = {1, 2, 3, 4, 5, 6, 7, 8};
+ std::vector<T> vec = { 1, 2, 3, 4, 5, 6, 7, 8 };
gdb::array_view<T> v = vec;
- copy (v.slice (1, 4),
- v.slice (2, 4));
+ copy (v.slice (1, 4), v.slice (2, 4));
- std::vector<T> expected = {1, 2, 2, 3, 4, 5, 7, 8};
+ std::vector<T> expected = { 1, 2, 2, 3, 4, 5, 7, 8 };
SELF_CHECK (vec == expected);
}
/* Test overlapping copy, where the source is after the destination. */
{
- std::vector<T> vec = {1, 2, 3, 4, 5, 6, 7, 8};
+ std::vector<T> vec = { 1, 2, 3, 4, 5, 6, 7, 8 };
gdb::array_view<T> v = vec;
- copy (v.slice (2, 4),
- v.slice (1, 4));
+ copy (v.slice (2, 4), v.slice (1, 4));
- std::vector<T> expected = {1, 3, 4, 5, 6, 6, 7, 8};
+ std::vector<T> expected = { 1, 3, 4, 5, 6, 6, 7, 8 };
SELF_CHECK (vec == expected);
}
/* Test overlapping copy, where the source is the same as the destination. */
{
- std::vector<T> vec = {1, 2, 3, 4, 5, 6, 7, 8};
+ std::vector<T> vec = { 1, 2, 3, 4, 5, 6, 7, 8 };
gdb::array_view<T> v = vec;
- copy (v.slice (2, 4),
- v.slice (2, 4));
+ copy (v.slice (2, 4), v.slice (2, 4));
- std::vector<T> expected = {1, 2, 3, 4, 5, 6, 7, 8};
+ std::vector<T> expected = { 1, 2, 3, 4, 5, 6, 7, 8 };
SELF_CHECK (vec == expected);
}
}
@@ -606,7 +619,8 @@ struct foo
array_view<foo>. */
foo (int n)
: n (n)
- {}
+ {
+ }
/* Needed to avoid -Wdeprecated-copy-with-user-provided-copy error with
Clang. */
@@ -618,10 +632,7 @@ struct foo
this->n_assign_op_called++;
}
- bool operator==(const foo &other) const
- {
- return this->n == other.n;
- }
+ bool operator== (const foo &other) const { return this->n == other.n; }
int n;
@@ -652,6 +663,7 @@ run_copy_tests ()
} /* namespace selftests */
void _initialize_array_view_selftests ();
+
void
_initialize_array_view_selftests ()
{
diff --git a/gdb/unittests/child-path-selftests.c b/gdb/unittests/child-path-selftests.c
index 773fc2f0b13..f4ce7658aec 100644
--- a/gdb/unittests/child-path-selftests.c
+++ b/gdb/unittests/child-path-selftests.c
@@ -21,8 +21,10 @@
#include "gdbsupport/pathstuff.h"
#include "gdbsupport/selftest.h"
-namespace selftests {
-namespace child_path {
+namespace selftests
+{
+namespace child_path
+{
/* Verify the result of a single child_path test. */
@@ -56,14 +58,13 @@ test ()
SELF_CHECK (child_path_check ("/one", "/onetwo/three", NULL));
}
-}
-}
+} // namespace child_path
+} // namespace selftests
void _initialize_child_path_selftests ();
+
void
_initialize_child_path_selftests ()
{
- selftests::register_test ("child_path",
- selftests::child_path::test);
+ selftests::register_test ("child_path", selftests::child_path::test);
}
-
diff --git a/gdb/unittests/cli-utils-selftests.c b/gdb/unittests/cli-utils-selftests.c
index ecac71a5685..d9695b26b54 100644
--- a/gdb/unittests/cli-utils-selftests.c
+++ b/gdb/unittests/cli-utils-selftests.c
@@ -21,8 +21,10 @@
#include "cli/cli-utils.h"
#include "gdbsupport/selftest.h"
-namespace selftests {
-namespace cli_utils {
+namespace selftests
+{
+namespace cli_utils
+{
static void
test_number_or_range_parser ()
@@ -107,13 +109,13 @@ test_cli_utils ()
selftests::cli_utils::test_number_or_range_parser ();
}
-}
-}
+} // namespace cli_utils
+} // namespace selftests
void _initialize_cli_utils_selftests ();
+
void
_initialize_cli_utils_selftests ()
{
- selftests::register_test ("cli_utils",
- selftests::cli_utils::test_cli_utils);
+ selftests::register_test ("cli_utils", selftests::cli_utils::test_cli_utils);
}
diff --git a/gdb/unittests/command-def-selftests.c b/gdb/unittests/command-def-selftests.c
index 84137c9a71a..7ddb691d1f4 100644
--- a/gdb/unittests/command-def-selftests.c
+++ b/gdb/unittests/command-def-selftests.c
@@ -24,11 +24,13 @@
#include <map>
-namespace selftests {
+namespace selftests
+{
/* Verify some invariants of GDB commands documentation. */
-namespace help_doc_tests {
+namespace help_doc_tests
+{
static unsigned int nr_failed_invariants;
@@ -65,19 +67,18 @@ check_doc (struct cmd_list_element *commandlist, const char *prefix)
while (*p && *p != '\n')
p++;
if (p == c->doc)
- broken_doc_invariant
- (prefix, c->name,
- "is missing the first line terminated with a '.' character");
- else if (*(p-1) != '.')
- broken_doc_invariant
- (prefix, c->name,
- "first line is not terminated with a '.' character");
+ broken_doc_invariant (
+ prefix, c->name,
+ "is missing the first line terminated with a '.' character");
+ else if (*(p - 1) != '.')
+ broken_doc_invariant (
+ prefix, c->name,
+ "first line is not terminated with a '.' character");
/* Checks the doc is not terminated with a new line. */
if (c->doc[strlen (c->doc) - 1] == '\n')
- broken_doc_invariant
- (prefix, c->name,
- "has a superfluous trailing end of line");
+ broken_doc_invariant (prefix, c->name,
+ "has a superfluous trailing end of line");
/* Check if this command has subcommands and is not an
abbreviation. We skip checking subcommands of abbreviations
@@ -103,7 +104,8 @@ help_doc_invariants_tests ()
/* Verify some invariants of GDB command structure. */
-namespace command_structure_tests {
+namespace command_structure_tests
+{
/* Nr of commands in which a duplicated list is found. */
static unsigned int nr_duplicates = 0;
@@ -121,8 +123,7 @@ static std::map<cmd_list_element **, const char *> lists;
command. */
static void
-traverse_command_structure (struct cmd_list_element **list,
- const char *prefix)
+traverse_command_structure (struct cmd_list_element **list, const char *prefix)
{
struct cmd_list_element *c, *prefixcmd;
@@ -132,14 +133,12 @@ traverse_command_structure (struct cmd_list_element **list,
gdb_printf ("list %p duplicated,"
" reachable via prefix '%s' and '%s'."
" Duplicated list first command is '%s'\n",
- list,
- prefix, dupl->second,
- (*list)->name);
+ list, prefix, dupl->second, (*list)->name);
nr_duplicates++;
return;
}
- lists.insert ({list, prefix});
+ lists.insert ({ list, prefix });
/* All commands of *list must have a prefix command equal to PREFIXCMD,
the prefix command of the first command. */
@@ -157,21 +156,19 @@ traverse_command_structure (struct cmd_list_element **list,
{
/* Recursively call ourselves on the subcommand list,
passing the right prefix in. */
- traverse_command_structure (c->subcommands, c->prefixname ().c_str ());
+ traverse_command_structure (c->subcommands,
+ c->prefixname ().c_str ());
}
- if (prefixcmd != c->prefix
- || (prefixcmd == nullptr && *list != cmdlist))
+ if (prefixcmd != c->prefix || (prefixcmd == nullptr && *list != cmdlist))
{
if (c->prefix == nullptr)
gdb_printf ("list %p reachable via prefix '%s'."
" command '%s' has null prefixcmd\n",
- list,
- prefix, c->name);
+ list, prefix, c->name);
else
gdb_printf ("list %p reachable via prefix '%s'."
" command '%s' has a different prefixcmd\n",
- list,
- prefix, c->name);
+ list, prefix, c->name);
nr_invalid_prefixcmd++;
}
}
@@ -194,19 +191,20 @@ command_structure_invariants_tests ()
SELF_CHECK (nr_invalid_prefixcmd == 0);
}
-}
+} // namespace command_structure_tests
} /* namespace selftests */
void _initialize_command_def_selftests ();
+
void
_initialize_command_def_selftests ()
{
- selftests::register_test
- ("help_doc_invariants",
- selftests::help_doc_tests::help_doc_invariants_tests);
+ selftests::register_test (
+ "help_doc_invariants",
+ selftests::help_doc_tests::help_doc_invariants_tests);
- selftests::register_test
- ("command_structure_invariants",
- selftests::command_structure_tests::command_structure_invariants_tests);
+ selftests::register_test (
+ "command_structure_invariants",
+ selftests::command_structure_tests::command_structure_invariants_tests);
}
diff --git a/gdb/unittests/common-utils-selftests.c b/gdb/unittests/common-utils-selftests.c
index 4d66fafb7a9..dbef2b88b53 100644
--- a/gdb/unittests/common-utils-selftests.c
+++ b/gdb/unittests/common-utils-selftests.c
@@ -20,7 +20,8 @@
#include "gdbsupport/common-defs.h"
#include "gdbsupport/selftest.h"
-namespace selftests {
+namespace selftests
+{
/* Type of both 'string_printf' and the 'format' function below. Used
to run the same tests against both string_printf and
@@ -46,7 +47,8 @@ test_format_func (format_func *func)
#define X100 X10 X10 X10 X10 X10 X10 X10 X10 X10 X10
#define X1000 X100 X100 X100 X100 X100 X100 X100 X100 X100 X100
#define X10000 X1000 X1000 X1000 X1000 X1000 X1000 X1000 X1000 X1000 X1000
-#define X100000 X10000 X10000 X10000 X10000 X10000 X10000 X10000 X10000 X10000 X10000
+#define X100000 \
+ X10000 X10000 X10000 X10000 X10000 X10000 X10000 X10000 X10000 X10000
SELF_CHECK (func ("%s", X10) == X10);
SELF_CHECK (func ("%s", X100) == X100);
SELF_CHECK (func ("%s", X1000) == X1000);
@@ -60,8 +62,7 @@ string_printf_tests ()
test_format_func (string_printf);
}
-static std::string ATTRIBUTE_PRINTF (1, 2)
-format (const char *fmt, ...)
+static std::string ATTRIBUTE_PRINTF (1, 2) format (const char *fmt, ...)
{
va_list vp;
@@ -81,8 +82,7 @@ string_vprintf_tests ()
function below. Used to run the same tests against both
string_appendf and string_vappendf. */
typedef std::string &(string_appendf_func) (std::string &str, const char *fmt,
- ...)
- ATTRIBUTE_PRINTF (2, 3);
+ ...) ATTRIBUTE_PRINTF (2, 3);
static void
test_appendf_func (string_appendf_func *func)
@@ -102,8 +102,8 @@ test_appendf_func (string_appendf_func *func)
SELF_CHECK (str == "test23foo 45 bar");
}
-static std::string & ATTRIBUTE_PRINTF (2, 3)
-string_vappendf_wrapper (std::string &str, const char *fmt, ...)
+static std::string &ATTRIBUTE_PRINTF (2, 3)
+ string_vappendf_wrapper (std::string &str, const char *fmt, ...)
{
va_list vp;
@@ -129,6 +129,7 @@ string_vappendf_tests ()
} /* namespace selftests */
void _initialize_common_utils_selftests ();
+
void
_initialize_common_utils_selftests ()
{
diff --git a/gdb/unittests/copy_bitwise-selftests.c b/gdb/unittests/copy_bitwise-selftests.c
index c4ec768e882..ca926eb43e4 100644
--- a/gdb/unittests/copy_bitwise-selftests.c
+++ b/gdb/unittests/copy_bitwise-selftests.c
@@ -21,7 +21,8 @@
#include "gdbsupport/selftest.h"
#include "utils.h"
-namespace selftests {
+namespace selftests
+{
/* Helper function for the unit test of copy_bitwise. Convert NBITS bits
out of BITS, starting at OFFS, to the respective '0'/'1'-string. MSB0
@@ -29,8 +30,8 @@ namespace selftests {
resulting (not null-terminated) string at STR. */
static void
-bits_to_str (char *str, const gdb_byte *bits, ULONGEST offs,
- ULONGEST nbits, int msb0)
+bits_to_str (char *str, const gdb_byte *bits, ULONGEST offs, ULONGEST nbits,
+ int msb0)
{
unsigned int j;
size_t i;
@@ -84,8 +85,8 @@ check_copy_bitwise (const gdb_byte *dest, unsigned int dest_offset,
/* Compare the resulting strings. */
expected[len] = actual[len] = '\0';
if (strcmp (expected, actual) != 0)
- error (_("copy_bitwise %s != %s (%u+%u -> %u)"),
- expected, actual, source_offset, nbits, dest_offset);
+ error (_ ("copy_bitwise %s != %s (%u+%u -> %u)"), expected, actual,
+ source_offset, nbits, dest_offset);
}
/* Unit test for copy_bitwise. */
@@ -102,12 +103,8 @@ copy_bitwise_tests (void)
- 0/1- and 1/0 transitions on all bit positions within a byte;
- several sufficiently asymmetric bytes.
*/
- static const gdb_byte data_lsb0[] = {
- 0x00, 0xf8, 0xff, 0x12, 0xa5, 0x4f
- };
- static const gdb_byte data_msb0[] = {
- 0x00, 0x1f, 0xff, 0x48, 0xa5, 0xf2
- };
+ static const gdb_byte data_lsb0[] = { 0x00, 0xf8, 0xff, 0x12, 0xa5, 0x4f };
+ static const gdb_byte data_msb0[] = { 0x00, 0x1f, 0xff, 0x48, 0xa5, 0xf2 };
constexpr size_t data_nbits = 8 * sizeof (data_lsb0);
constexpr unsigned max_nbits = 24;
@@ -126,19 +123,15 @@ copy_bitwise_tests (void)
{
const unsigned int max_offset = data_nbits - nbits;
- for (unsigned source_offset = 0;
- source_offset <= max_offset;
+ for (unsigned source_offset = 0; source_offset <= max_offset;
source_offset++)
{
- for (unsigned dest_offset = 0;
- dest_offset <= max_offset;
+ for (unsigned dest_offset = 0; dest_offset <= max_offset;
dest_offset++)
{
- check_copy_bitwise (data + dest_offset / 8,
- dest_offset % 8,
+ check_copy_bitwise (data + dest_offset / 8, dest_offset % 8,
data + source_offset / 8,
- source_offset % 8,
- nbits, msb0);
+ source_offset % 8, nbits, msb0);
}
}
}
@@ -153,6 +146,7 @@ copy_bitwise_tests (void)
} /* namespace selftests */
void _initialize_copy_bitwise_utils_selftests ();
+
void
_initialize_copy_bitwise_utils_selftests ()
{
diff --git a/gdb/unittests/enum-flags-selftests.c b/gdb/unittests/enum-flags-selftests.c
index 2d3c555d254..087bbd1c750 100644
--- a/gdb/unittests/enum-flags-selftests.c
+++ b/gdb/unittests/enum-flags-selftests.c
@@ -22,8 +22,10 @@
#include "gdbsupport/valid-expr.h"
#include "gdbsupport/selftest.h"
-namespace selftests {
-namespace enum_flags_tests {
+namespace selftests
+{
+namespace enum_flags_tests
+{
/* The (real) enum types used in CHECK_VALID. Their names match the
template parameter names of the templates defined by CHECK_VALID to
@@ -31,32 +33,32 @@ namespace enum_flags_tests {
/* A "real enum". */
enum RE
- {
- RE_FLAG1 = 1 << 1,
- RE_FLAG2 = 1 << 2,
- };
+{
+ RE_FLAG1 = 1 << 1,
+ RE_FLAG2 = 1 << 2,
+};
/* Another "real enum". */
enum RE2
- {
- RE2_FLAG1 = 1 << 1,
- RE2_FLAG2 = 1 << 2,
- };
+{
+ RE2_FLAG1 = 1 << 1,
+ RE2_FLAG2 = 1 << 2,
+};
/* An unsigned "real enum". */
enum URE : unsigned
- {
- URE_FLAG1 = 1 << 1,
- URE_FLAG2 = 1 << 2,
- URE_FLAG3 = 0xffffffff,
- };
+{
+ URE_FLAG1 = 1 << 1,
+ URE_FLAG2 = 1 << 2,
+ URE_FLAG3 = 0xffffffff,
+};
/* A non-flags enum. */
enum NF
- {
- NF_FLAG1 = 1 << 1,
- NF_FLAG2 = 1 << 2,
- };
+{
+ NF_FLAG1 = 1 << 1,
+ NF_FLAG2 = 1 << 2,
+};
/* The corresponding "enum flags" types. */
DEF_ENUM_FLAGS_TYPE (RE, EF);
@@ -87,7 +89,7 @@ static EF ef ATTRIBUTE_UNUSED;
types do compile and that they return the correct type.
*/
-#define CHECK_VALID(VALID, EXPR_TYPE, EXPR) \
+#define CHECK_VALID(VALID, EXPR_TYPE, EXPR) \
CHECK_VALID_EXPR_6 (EF, RE, EF2, RE2, UEF, URE, VALID, EXPR_TYPE, EXPR)
typedef std::underlying_type<RE>::type und;
@@ -95,21 +97,21 @@ typedef std::underlying_type<RE>::type und;
/* Test construction / conversion from/to different types. */
/* RE/EF -> underlying (explicit) */
-CHECK_VALID (true, und, und (RE ()))
-CHECK_VALID (true, und, und (EF ()))
+CHECK_VALID (true, und, und (RE ()))
+CHECK_VALID (true, und, und (EF ()))
/* RE/EF -> int (explicit) */
-CHECK_VALID (true, int, int (RE ()))
-CHECK_VALID (true, int, int (EF ()))
+CHECK_VALID (true, int, int (RE ()))
+CHECK_VALID (true, int, int (EF ()))
/* other -> RE */
/* You can construct a raw enum value from an int explicitly to punch
a hole in the type system if need to. */
-CHECK_VALID (true, RE, RE (1))
-CHECK_VALID (true, RE, RE (RE2 ()))
+CHECK_VALID (true, RE, RE (1))
+CHECK_VALID (true, RE, RE (RE2 ()))
CHECK_VALID (false, void, RE (EF2 ()))
-CHECK_VALID (true, RE, RE (RE ()))
+CHECK_VALID (true, RE, RE (RE ()))
CHECK_VALID (false, void, RE (EF ()))
/* other -> EF. */
@@ -122,8 +124,8 @@ CHECK_VALID (false, void, EF (1))
CHECK_VALID (false, void, EF (1u))
CHECK_VALID (false, void, EF (RE2 ()))
CHECK_VALID (false, void, EF (EF2 ()))
-CHECK_VALID (true, EF, EF (RE ()))
-CHECK_VALID (true, EF, EF (EF ()))
+CHECK_VALID (true, EF, EF (RE ()))
+CHECK_VALID (true, EF, EF (EF ()))
/* Test operators. */
@@ -156,18 +158,18 @@ CHECK_VALID (false, void, 1 ^ EF ())
CHECK_VALID (false, void, RE () | RE2 ())
CHECK_VALID (false, void, RE () & RE2 ())
CHECK_VALID (false, void, RE () ^ RE2 ())
-CHECK_VALID (true, RE, RE () | RE ())
-CHECK_VALID (true, RE, RE () & RE ())
-CHECK_VALID (true, RE, RE () ^ RE ())
+CHECK_VALID (true, RE, RE () | RE ())
+CHECK_VALID (true, RE, RE () & RE ())
+CHECK_VALID (true, RE, RE () ^ RE ())
/* operator OP (enum_flags, raw_enum) */
CHECK_VALID (false, void, EF () | RE2 ())
CHECK_VALID (false, void, EF () & RE2 ())
CHECK_VALID (false, void, EF () ^ RE2 ())
-CHECK_VALID (true, EF, EF () | RE ())
-CHECK_VALID (true, EF, EF () & RE ())
-CHECK_VALID (true, EF, EF () ^ RE ())
+CHECK_VALID (true, EF, EF () | RE ())
+CHECK_VALID (true, EF, EF () & RE ())
+CHECK_VALID (true, EF, EF () ^ RE ())
/* operator OP= (raw_enum, raw_enum), rvalue ref on the lhs. */
@@ -183,9 +185,9 @@ CHECK_VALID (false, void, RE () ^= RE ())
CHECK_VALID (false, void, re |= RE2 ())
CHECK_VALID (false, void, re &= RE2 ())
CHECK_VALID (false, void, re ^= RE2 ())
-CHECK_VALID (true, RE&, re |= RE ())
-CHECK_VALID (true, RE&, re &= RE ())
-CHECK_VALID (true, RE&, re ^= RE ())
+CHECK_VALID (true, RE &, re |= RE ())
+CHECK_VALID (true, RE &, re &= RE ())
+CHECK_VALID (true, RE &, re ^= RE ())
/* operator OP= (enum_flags, raw_enum), rvalue ref on the lhs. */
@@ -201,9 +203,9 @@ CHECK_VALID (false, void, EF () ^= RE ())
CHECK_VALID (false, void, ef |= RE2 ())
CHECK_VALID (false, void, ef &= RE2 ())
CHECK_VALID (false, void, ef ^= RE2 ())
-CHECK_VALID (true, EF&, ef |= EF ())
-CHECK_VALID (true, EF&, ef &= EF ())
-CHECK_VALID (true, EF&, ef ^= EF ())
+CHECK_VALID (true, EF &, ef |= EF ())
+CHECK_VALID (true, EF &, ef &= EF ())
+CHECK_VALID (true, EF &, ef ^= EF ())
/* operator OP= (enum_flags, enum_flags), rvalue ref on the lhs. */
@@ -219,24 +221,24 @@ CHECK_VALID (false, void, EF () ^= EF ())
CHECK_VALID (false, void, ef |= EF2 ())
CHECK_VALID (false, void, ef &= EF2 ())
CHECK_VALID (false, void, ef ^= EF2 ())
-CHECK_VALID (true, EF&, ef |= EF ())
-CHECK_VALID (true, EF&, ef &= EF ())
-CHECK_VALID (true, EF&, ef ^= EF ())
+CHECK_VALID (true, EF &, ef |= EF ())
+CHECK_VALID (true, EF &, ef &= EF ())
+CHECK_VALID (true, EF &, ef ^= EF ())
/* operator~ (raw_enum) */
-CHECK_VALID (false, void, ~RE ())
-CHECK_VALID (true, URE, ~URE ())
+CHECK_VALID (false, void, ~RE ())
+CHECK_VALID (true, URE, ~URE ())
/* operator~ (enum_flags) */
-CHECK_VALID (false, void, ~EF ())
-CHECK_VALID (true, UEF, ~UEF ())
+CHECK_VALID (false, void, ~EF ())
+CHECK_VALID (true, UEF, ~UEF ())
/* Check ternary operator. This exercises implicit conversions. */
-CHECK_VALID (true, EF, true ? EF () : RE ())
-CHECK_VALID (true, EF, true ? RE () : EF ())
+CHECK_VALID (true, EF, true ? EF () : RE ())
+CHECK_VALID (true, EF, true ? RE () : EF ())
/* These are valid, but it's not a big deal since you won't be able to
assign the resulting integer to an enum or an enum_flags without a
@@ -251,22 +253,22 @@ CHECK_VALID (true, EF, true ? RE () : EF ())
They've been confirmed to compile/pass with gcc 5.3, gcc 7.1 and
clang 3.7. */
-CHECK_VALID (true, int, true ? EF () : EF2 ())
-CHECK_VALID (true, int, true ? EF2 () : EF ())
+CHECK_VALID (true, int, true ? EF () : EF2 ())
+CHECK_VALID (true, int, true ? EF2 () : EF ())
#if GCC_VERSION >= 5003 || defined __clang__
-CHECK_VALID (true, int, true ? EF () : RE2 ())
-CHECK_VALID (true, int, true ? RE2 () : EF ())
+CHECK_VALID (true, int, true ? EF () : RE2 ())
+CHECK_VALID (true, int, true ? RE2 () : EF ())
#endif
/* Same, but with an unsigned enum. */
typedef unsigned int uns;
-CHECK_VALID (true, uns, true ? EF () : UEF ())
-CHECK_VALID (true, uns, true ? UEF () : EF ())
+CHECK_VALID (true, uns, true ? EF () : UEF ())
+CHECK_VALID (true, uns, true ? UEF () : EF ())
#if GCC_VERSION >= 5003 || defined __clang__
-CHECK_VALID (true, uns, true ? EF () : URE ())
-CHECK_VALID (true, uns, true ? URE () : EF ())
+CHECK_VALID (true, uns, true ? EF () : URE ())
+CHECK_VALID (true, uns, true ? URE () : EF ())
#endif
/* Unfortunately this can't work due to the way C++ computes the
@@ -307,9 +309,9 @@ CHECK_VALID (false, void, EF () == EF2 ())
CHECK_VALID (false, void, EF () == RE2 ())
CHECK_VALID (false, void, RE () == EF2 ())
-CHECK_VALID (true, bool, EF (RE (1)) == EF (RE (1)))
-CHECK_VALID (true, bool, EF (RE (1)) == RE (1))
-CHECK_VALID (true, bool, RE (1) == EF (RE (1)))
+CHECK_VALID (true, bool, EF (RE (1)) == EF (RE (1)))
+CHECK_VALID (true, bool, EF (RE (1)) == RE (1))
+CHECK_VALID (true, bool, RE (1) == EF (RE (1)))
CHECK_VALID (false, void, EF () != EF2 ())
CHECK_VALID (false, void, EF () != RE2 ())
@@ -331,26 +333,26 @@ CHECK_VALID (false, void, RE () != EF2 ())
Not a big deal since misuses like these in GDB will be caught by
-Werror anyway. This check is here mainly for completeness. */
#if defined __GNUC__
-# pragma GCC diagnostic push
-# pragma GCC diagnostic ignored "-Wenum-compare"
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wenum-compare"
#endif
-CHECK_VALID (true, bool, RE () == RE2 ())
-CHECK_VALID (true, bool, RE () != RE2 ())
+CHECK_VALID (true, bool, RE () == RE2 ())
+CHECK_VALID (true, bool, RE () != RE2 ())
#if defined __GNUC__
-# pragma GCC diagnostic pop
+#pragma GCC diagnostic pop
#endif
-CHECK_VALID (true, bool, EF (RE (1)) != EF (RE (2)))
-CHECK_VALID (true, bool, EF (RE (1)) != RE (2))
-CHECK_VALID (true, bool, RE (1) != EF (RE (2)))
+CHECK_VALID (true, bool, EF (RE (1)) != EF (RE (2)))
+CHECK_VALID (true, bool, EF (RE (1)) != RE (2))
+CHECK_VALID (true, bool, RE (1) != EF (RE (2)))
-CHECK_VALID (true, bool, EF () == 0)
+CHECK_VALID (true, bool, EF () == 0)
/* Check we didn't disable/delete comparison between non-flags enums
and unrelated types by mistake. */
-CHECK_VALID (true, bool, NF (1) == NF (1))
-CHECK_VALID (true, bool, NF (1) == int (1))
-CHECK_VALID (true, bool, NF (1) == char (1))
+CHECK_VALID (true, bool, NF (1) == NF (1))
+CHECK_VALID (true, bool, NF (1) == int (1))
+CHECK_VALID (true, bool, NF (1) == char (1))
/* -------------------------------------------------------------------- */
@@ -358,20 +360,20 @@ CHECK_VALID (true, bool, NF (1) == char (1))
when possible, others are run time. */
enum test_flag
- {
- FLAG1 = 1 << 0,
- FLAG2 = 1 << 1,
- FLAG3 = 1 << 2,
- FLAG4 = 1 << 3,
- };
+{
+ FLAG1 = 1 << 0,
+ FLAG2 = 1 << 1,
+ FLAG3 = 1 << 2,
+ FLAG4 = 1 << 3,
+};
enum test_uflag : unsigned
- {
- UFLAG1 = 1 << 0,
- UFLAG2 = 1 << 1,
- UFLAG3 = 1 << 2,
- UFLAG4 = 1 << 3,
- };
+{
+ UFLAG1 = 1 << 0,
+ UFLAG2 = 1 << 1,
+ UFLAG3 = 1 << 2,
+ UFLAG4 = 1 << 3,
+};
DEF_ENUM_FLAGS_TYPE (test_flag, test_flags);
DEF_ENUM_FLAGS_TYPE (test_uflag, test_uflags);
@@ -425,8 +427,8 @@ self_test ()
{
constexpr test_flags zero1 = 0;
constexpr test_flags zero2 (0);
- constexpr test_flags zero3 {0};
- constexpr test_flags zero4 = {0};
+ constexpr test_flags zero3 { 0 };
+ constexpr test_flags zero4 = { 0 };
gdb_static_assert (zero1 == 0);
gdb_static_assert (zero2 == 0);
@@ -446,8 +448,8 @@ self_test ()
constexpr test_flags f1 = src;
constexpr test_flags f2 (src);
- constexpr test_flags f3 {src};
- constexpr test_flags f4 = {src};
+ constexpr test_flags f3 { src };
+ constexpr test_flags f4 = { src };
gdb_static_assert (f1 == FLAG1);
gdb_static_assert (f2 == FLAG1);
@@ -610,31 +612,23 @@ self_test ()
/* Check string conversion. */
{
- SELF_CHECK (to_string_uflags (0)
- == "0x0 []");
- SELF_CHECK (to_string_uflags (UFLAG1)
- == "0x1 [UFLAG1]");
- SELF_CHECK (to_string_uflags (UFLAG1 | UFLAG3)
- == "0x5 [UFLAG1 UFLAG3]");
+ SELF_CHECK (to_string_uflags (0) == "0x0 []");
+ SELF_CHECK (to_string_uflags (UFLAG1) == "0x1 [UFLAG1]");
+ SELF_CHECK (to_string_uflags (UFLAG1 | UFLAG3) == "0x5 [UFLAG1 UFLAG3]");
SELF_CHECK (to_string_uflags (UFLAG1 | UFLAG2 | UFLAG3)
== "0x7 [UFLAG1 UFLAG3 0x2]");
- SELF_CHECK (to_string_uflags (UFLAG2)
- == "0x2 [0x2]");
+ SELF_CHECK (to_string_uflags (UFLAG2) == "0x2 [0x2]");
/* Check that even with multiple unmapped flags, we only print one
unmapped hex number (0xa, in this case). */
SELF_CHECK (to_string_uflags (UFLAG1 | UFLAG2 | UFLAG3 | UFLAG4)
== "0xf [UFLAG1 UFLAG3 0xa]");
- SELF_CHECK (to_string_flags (0)
- == "0x0 []");
- SELF_CHECK (to_string_flags (FLAG1)
- == "0x1 [FLAG1]");
- SELF_CHECK (to_string_flags (FLAG1 | FLAG3)
- == "0x5 [FLAG1 FLAG3]");
+ SELF_CHECK (to_string_flags (0) == "0x0 []");
+ SELF_CHECK (to_string_flags (FLAG1) == "0x1 [FLAG1]");
+ SELF_CHECK (to_string_flags (FLAG1 | FLAG3) == "0x5 [FLAG1 FLAG3]");
SELF_CHECK (to_string_flags (FLAG1 | FLAG2 | FLAG3)
== "0x7 [FLAG1 FLAG3 0x2]");
- SELF_CHECK (to_string_flags (FLAG2)
- == "0x2 [0x2]");
+ SELF_CHECK (to_string_flags (FLAG2) == "0x2 [0x2]");
SELF_CHECK (to_string_flags (FLAG1 | FLAG2 | FLAG3 | FLAG4)
== "0xf [FLAG1 FLAG3 0xa]");
}
diff --git a/gdb/unittests/environ-selftests.c b/gdb/unittests/environ-selftests.c
index 5edbc4e6a48..c1e353dc45c 100644
--- a/gdb/unittests/environ-selftests.c
+++ b/gdb/unittests/environ-selftests.c
@@ -30,8 +30,10 @@ set_contains (const std::set<std::string> &set, std::string key)
return set.find (key) != set.end ();
}
-namespace selftests {
-namespace gdb_environ_tests {
+namespace selftests
+{
+namespace gdb_environ_tests
+{
/* Test if the vector is initialized in a correct way. */
@@ -270,7 +272,7 @@ run_tests ()
{
/* Set a test environment variable. */
if (setenv ("GDB_SELFTEST_ENVIRON", "1", 1) != 0)
- error (_("Could not set environment variable for testing."));
+ error (_ ("Could not set environment variable for testing."));
test_vector_initialization ();
@@ -295,10 +297,11 @@ run_tests ()
test_self_move ();
}
-} /* namespace gdb_environ */
+} // namespace gdb_environ_tests
} /* namespace selftests */
void _initialize_environ_selftests ();
+
void
_initialize_environ_selftests ()
{
diff --git a/gdb/unittests/filtered_iterator-selftests.c b/gdb/unittests/filtered_iterator-selftests.c
index 6e93a09627a..8a16e700377 100644
--- a/gdb/unittests/filtered_iterator-selftests.c
+++ b/gdb/unittests/filtered_iterator-selftests.c
@@ -23,7 +23,8 @@
#include <iterator>
-namespace selftests {
+namespace selftests
+{
/* An iterator class that iterates on integer arrays. */
@@ -38,13 +39,17 @@ struct int_array_iterator
/* Create an iterator that points at the first element of an integer
array at ARRAY of size SIZE. */
int_array_iterator (int *array, size_t size)
- : m_array (array), m_size (size)
- {}
+ : m_array (array),
+ m_size (size)
+ {
+ }
/* Create a past-the-end iterator. */
int_array_iterator ()
- : m_array (nullptr), m_size (0)
- {}
+ : m_array (nullptr),
+ m_size (0)
+ {
+ }
bool operator== (const int_array_iterator &other) const
{
@@ -91,6 +96,7 @@ struct int_array_iterator
}
private:
+
/* A nullptr value in M_ARRAY indicates a past-the-end iterator. */
int *m_array;
size_t m_size;
@@ -101,10 +107,7 @@ private:
struct even_numbers_only
{
- bool operator() (int n)
- {
- return n % 2 == 0;
- }
+ bool operator() (int n) { return n % 2 == 0; }
};
/* Test typical usage. */
@@ -116,8 +119,8 @@ test_filtered_iterator ()
std::vector<int> even_ints;
const std::vector<int> expected_even_ints { 4, 4, 6, 8 };
- filtered_iterator<int_array_iterator, even_numbers_only>
- iter (array, ARRAY_SIZE (array));
+ filtered_iterator<int_array_iterator, even_numbers_only> iter (
+ array, ARRAY_SIZE (array));
filtered_iterator<int_array_iterator, even_numbers_only> end;
for (; iter != end; ++iter)
@@ -133,10 +136,10 @@ test_filtered_iterator_eq ()
{
int array[] = { 4, 4, 5, 6, 7, 8, 9 };
- filtered_iterator<int_array_iterator, even_numbers_only>
- iter1(array, ARRAY_SIZE (array));
- filtered_iterator<int_array_iterator, even_numbers_only>
- iter2(array, ARRAY_SIZE (array));
+ filtered_iterator<int_array_iterator, even_numbers_only> iter1 (
+ array, ARRAY_SIZE (array));
+ filtered_iterator<int_array_iterator, even_numbers_only> iter2 (
+ array, ARRAY_SIZE (array));
/* They start equal. */
gdb_assert (iter1 == iter2);
@@ -156,6 +159,7 @@ test_filtered_iterator_eq ()
} /* namespace selftests */
void _initialize_filtered_iterator_selftests ();
+
void
_initialize_filtered_iterator_selftests ()
{
diff --git a/gdb/unittests/format_pieces-selftests.c b/gdb/unittests/format_pieces-selftests.c
index dd10b0bb1b2..46446e095c9 100644
--- a/gdb/unittests/format_pieces-selftests.c
+++ b/gdb/unittests/format_pieces-selftests.c
@@ -27,8 +27,10 @@
#define LL "ll"
#endif
-namespace selftests {
-namespace format_pieces {
+namespace selftests
+{
+namespace format_pieces
+{
/* Verify that parsing STR gives pieces equal to EXPECTED_PIECES. */
@@ -47,9 +49,9 @@ static void
test_escape_sequences ()
{
check ("This is an escape sequence: \\e",
- {
- format_piece ("This is an escape sequence: \e", literal_piece, 0),
- });
+ {
+ format_piece ("This is an escape sequence: \e", literal_piece, 0),
+ });
}
static void
@@ -58,28 +60,29 @@ test_format_specifier ()
/* The format string here ends with a % sequence, to ensure we don't
see a trailing empty literal piece. */
check ("Hello\\t %d%llx%%d%d", /* ARI: %ll */
- {
- format_piece ("Hello\t ", literal_piece, 0),
- format_piece ("%d", int_arg, 0),
- format_piece ("%" LL "x", long_long_arg, 0),
- format_piece ("%%d", literal_piece, 0),
- format_piece ("%d", int_arg, 0),
- });
+ {
+ format_piece ("Hello\t ", literal_piece, 0),
+ format_piece ("%d", int_arg, 0),
+ format_piece ("%" LL "x", long_long_arg, 0),
+ format_piece ("%%d", literal_piece, 0),
+ format_piece ("%d", int_arg, 0),
+ });
}
static void
test_gdb_formats ()
{
check ("Hello\\t \"%p[%pF%ps%*.*d%p]\"",
- {
- format_piece ("Hello\\t \"", literal_piece, 0),
- format_piece ("%p[", ptr_arg, 0),
- format_piece ("%pF", ptr_arg, 0),
- format_piece ("%ps", ptr_arg, 0),
- format_piece ("%*.*d", int_arg, 2),
- format_piece ("%p]", ptr_arg, 0),
- format_piece ("\"", literal_piece, 0),
- }, true);
+ {
+ format_piece ("Hello\\t \"", literal_piece, 0),
+ format_piece ("%p[", ptr_arg, 0),
+ format_piece ("%pF", ptr_arg, 0),
+ format_piece ("%ps", ptr_arg, 0),
+ format_piece ("%*.*d", int_arg, 2),
+ format_piece ("%p]", ptr_arg, 0),
+ format_piece ("\"", literal_piece, 0),
+ },
+ true);
}
/* Test the different size modifiers that can be applied to an integer
@@ -89,50 +92,37 @@ static void
test_format_int_sizes ()
{
check ("Hello\\t %hu%lu%llu%zu", /* ARI: %ll */
- {
- format_piece ("Hello\t ", literal_piece, 0),
- format_piece ("%hu", int_arg, 0),
- format_piece ("%lu", long_arg, 0),
- format_piece ("%" LL "u", long_long_arg, 0),
- format_piece ("%zu", size_t_arg, 0)
- });
+ { format_piece ("Hello\t ", literal_piece, 0),
+ format_piece ("%hu", int_arg, 0), format_piece ("%lu", long_arg, 0),
+ format_piece ("%" LL "u", long_long_arg, 0),
+ format_piece ("%zu", size_t_arg, 0) });
check ("Hello\\t %hx%lx%llx%zx", /* ARI: %ll */
- {
- format_piece ("Hello\t ", literal_piece, 0),
- format_piece ("%hx", int_arg, 0),
- format_piece ("%lx", long_arg, 0),
- format_piece ("%" LL "x", long_long_arg, 0),
- format_piece ("%zx", size_t_arg, 0)
- });
+ { format_piece ("Hello\t ", literal_piece, 0),
+ format_piece ("%hx", int_arg, 0), format_piece ("%lx", long_arg, 0),
+ format_piece ("%" LL "x", long_long_arg, 0),
+ format_piece ("%zx", size_t_arg, 0) });
check ("Hello\\t %ho%lo%llo%zo", /* ARI: %ll */
- {
- format_piece ("Hello\t ", literal_piece, 0),
- format_piece ("%ho", int_arg, 0),
- format_piece ("%lo", long_arg, 0),
- format_piece ("%" LL "o", long_long_arg, 0),
- format_piece ("%zo", size_t_arg, 0)
- });
+ { format_piece ("Hello\t ", literal_piece, 0),
+ format_piece ("%ho", int_arg, 0), format_piece ("%lo", long_arg, 0),
+ format_piece ("%" LL "o", long_long_arg, 0),
+ format_piece ("%zo", size_t_arg, 0) });
check ("Hello\\t %hd%ld%lld%zd", /* ARI: %ll */
- {
- format_piece ("Hello\t ", literal_piece, 0),
- format_piece ("%hd", int_arg, 0),
- format_piece ("%ld", long_arg, 0),
- format_piece ("%" LL "d", long_long_arg, 0),
- format_piece ("%zd", size_t_arg, 0)
- });
+ { format_piece ("Hello\t ", literal_piece, 0),
+ format_piece ("%hd", int_arg, 0), format_piece ("%ld", long_arg, 0),
+ format_piece ("%" LL "d", long_long_arg, 0),
+ format_piece ("%zd", size_t_arg, 0) });
}
static void
test_windows_formats ()
{
- check ("rc%I64d",
- {
- format_piece ("rc", literal_piece, 0),
- format_piece ("%I64d", long_long_arg, 0),
- });
+ check ("rc%I64d", {
+ format_piece ("rc", literal_piece, 0),
+ format_piece ("%I64d", long_long_arg, 0),
+ });
}
static void
@@ -149,6 +139,7 @@ run_tests ()
} /* namespace selftests */
void _initialize_format_pieces_selftests ();
+
void
_initialize_format_pieces_selftests ()
{
diff --git a/gdb/unittests/frame_info_ptr-selftests.c b/gdb/unittests/frame_info_ptr-selftests.c
index fe1e7be35da..a970428a48c 100644
--- a/gdb/unittests/frame_info_ptr-selftests.c
+++ b/gdb/unittests/frame_info_ptr-selftests.c
@@ -24,7 +24,8 @@
#include "scoped-mock-context.h"
#include "test-target.h"
-namespace selftests {
+namespace selftests
+{
static void
validate_user_created_frame (frame_id id)
@@ -50,8 +51,8 @@ user_created_frame_callee (frame_info_ptr frame)
static void
test_user_created_frame ()
{
- scoped_mock_context<test_target_ops> mock_context
- (current_inferior ()->gdbarch);
+ scoped_mock_context<test_target_ops> mock_context (
+ current_inferior ()->gdbarch);
frame_info_ptr frame = create_new_frame (0x1234, 0x5678);
validate_user_created_frame (get_frame_id (frame));
@@ -68,6 +69,7 @@ test_user_created_frame ()
} /* namespace selftests */
void _initialize_frame_info_ptr_selftests ();
+
void
_initialize_frame_info_ptr_selftests ()
{
diff --git a/gdb/unittests/function-view-selftests.c b/gdb/unittests/function-view-selftests.c
index ab9375c10ab..faa10edd09b 100644
--- a/gdb/unittests/function-view-selftests.c
+++ b/gdb/unittests/function-view-selftests.c
@@ -21,8 +21,10 @@
#include "gdbsupport/selftest.h"
#include "gdbsupport/function-view.h"
-namespace selftests {
-namespace function_view {
+namespace selftests
+{
+namespace function_view
+{
static int
plus_one_fn_int (int val)
@@ -37,20 +39,20 @@ plus_one_fn_short (short val)
}
static int
-call_callback_int (int val, gdb::function_view <int (int)> callback)
+call_callback_int (int val, gdb::function_view<int (int)> callback)
{
return callback (val);
}
static void
-call_callback_void (int val, gdb::function_view <void (int)> callback)
+call_callback_void (int val, gdb::function_view<void (int)> callback)
{
callback (val);
}
struct plus_one_int_func_obj
{
- int operator () (int val)
+ int operator() (int val)
{
++call_count;
return ++val;
@@ -80,10 +82,7 @@ test_function_view ()
/* Check calling a function that takes a function_view as argument,
by value. Pass a lambda, making sure a function_view is properly
constructed implicitly. */
- SELF_CHECK (call_callback_int (1, [] (int val)
- {
- return val + 2;
- }) == 3);
+ SELF_CHECK (call_callback_int (1, [] (int val) { return val + 2; }) == 3);
/* Same, passing a named/lvalue lambda. */
SELF_CHECK (call_callback_int (1, plus_one_lambda) == 2);
@@ -104,10 +103,9 @@ test_function_view ()
/* Check calling a function with a
compatible-but-not-exactly-the-same prototype. */
- SELF_CHECK (call_callback_int (1, [] (short val) -> short
- {
- return val + 2;
- }) == 3);
+ SELF_CHECK (call_callback_int (1,
+ [] (short val) -> short { return val + 2; })
+ == 3);
/* Same, but passing a function pointer. */
SELF_CHECK (call_callback_int (1, plus_one_fn_short) == 2);
@@ -115,10 +113,7 @@ test_function_view ()
can reference callables with non-void return type. The result is
simply discarded. Check a lambda, function object and a function
pointer. */
- call_callback_void (1, [] (int val) -> int
- {
- return val + 2;
- });
+ call_callback_void (1, [] (int val) -> int { return val + 2; });
call_callback_void (1, func_obj);
call_callback_void (1, plus_one_fn_int);
@@ -126,9 +121,11 @@ test_function_view ()
auto plus_one_func_view2 (plus_one_func_view);
auto plus_one_func_view3 (plus_one_func_view2);
static_assert (std::is_same<decltype (plus_one_func_view),
- decltype (plus_one_func_view2)>::value, "");
+ decltype (plus_one_func_view2)>::value,
+ "");
static_assert (std::is_same<decltype (plus_one_func_view),
- decltype (plus_one_func_view3)>::value, "");
+ decltype (plus_one_func_view3)>::value,
+ "");
SELF_CHECK (plus_one_func_view3 (1) == 2);
@@ -188,20 +185,14 @@ make_fv_test_func (int val)
struct func_obj_const_op
{
- int operator() (int val) const
- {
- return val + 1;
- }
+ int operator() (int val) const { return val + 1; }
};
/* A function object with non-const operator(). */
struct func_obj_non_const_op
{
- int operator() (int val)
- {
- return val + 1;
- }
+ int operator() (int val) { return val + 1; }
};
static void
@@ -211,7 +202,8 @@ test_make_function_view ()
SELF_CHECK (3 == tmpl_func (1, gdb::make_function_view (make_fv_test_func)));
/* Function pointer. */
- SELF_CHECK (3 == tmpl_func (1, gdb::make_function_view (&make_fv_test_func)));
+ SELF_CHECK (3
+ == tmpl_func (1, gdb::make_function_view (&make_fv_test_func)));
/* Reference to const and non-const function pointers. */
typedef int (*func_ptr) (int);
@@ -252,6 +244,7 @@ run_tests ()
} /* namespace selftests */
void _initialize_function_view_selftests ();
+
void
_initialize_function_view_selftests ()
{
diff --git a/gdb/unittests/gdb_tilde_expand-selftests.c b/gdb/unittests/gdb_tilde_expand-selftests.c
index 3de67c3978f..1bba9a7aedb 100644
--- a/gdb/unittests/gdb_tilde_expand-selftests.c
+++ b/gdb/unittests/gdb_tilde_expand-selftests.c
@@ -23,8 +23,10 @@
#include "gdbsupport/gdb_tilde_expand.h"
-namespace selftests {
-namespace gdb_tilde_expand_tests {
+namespace selftests
+{
+namespace gdb_tilde_expand_tests
+{
static void
do_test ()
@@ -45,7 +47,7 @@ do_test ()
does not exist, gdb_tilde expand must still be able to do the tilde
expansion. */
SELF_CHECK (gdb_tilde_expand ("~/non/existent/directory")
- == home + "/non/existent/directory");
+ == home + "/non/existent/directory");
/* gdb_tilde_expand only expands tilde and does not try to do any other
substitution. */
@@ -63,7 +65,7 @@ do_test ()
const std::string user (c_user);
SELF_CHECK (gdb_tilde_expand (("~" + user).c_str ()) == home);
SELF_CHECK (gdb_tilde_expand (("~" + user + "/a/b").c_str ())
- == home + "/a/b");
+ == home + "/a/b");
}
/* Check that an error is thrown when trying to expand home of a unknown
@@ -76,9 +78,9 @@ do_test ()
catch (const gdb_exception_error &e)
{
SELF_CHECK (e.error == GENERIC_ERROR);
- SELF_CHECK
- (*e.message
- == "Could not find a match for '~no_one_should_have_that_login'.");
+ SELF_CHECK (
+ *e.message
+ == "Could not find a match for '~no_one_should_have_that_login'.");
}
}
@@ -86,9 +88,10 @@ do_test ()
} /* namespace selftests */
void _initialize_gdb_tilde_expand_selftests ();
+
void
_initialize_gdb_tilde_expand_selftests ()
{
- selftests::register_test
- ("gdb_tilde_expand", selftests::gdb_tilde_expand_tests::do_test);
+ selftests::register_test ("gdb_tilde_expand",
+ selftests::gdb_tilde_expand_tests::do_test);
}
diff --git a/gdb/unittests/gmp-utils-selftests.c b/gdb/unittests/gmp-utils-selftests.c
index cc525a13fc0..ca63f0fb76b 100644
--- a/gdb/unittests/gmp-utils-selftests.c
+++ b/gdb/unittests/gmp-utils-selftests.c
@@ -22,7 +22,8 @@
#include <math.h>
-namespace selftests {
+namespace selftests
+{
/* Perform a series of general tests of gdb_mpz's as_integer method.
@@ -172,7 +173,7 @@ store_and_read_back (T val, size_t buf_len, enum bfd_endian byte_order,
mpz_set (actual.val, expected.val);
mpz_sub_ui (actual.val, actual.val, 500);
- actual.read ({buf, buf_len}, byte_order, !std::is_signed<T>::value);
+ actual.read ({ buf, buf_len }, byte_order, !std::is_signed<T>::value);
}
/* Test the gdb_mpz::read method over a reasonable range of values.
@@ -229,48 +230,48 @@ gdb_mpz_read_min_max ()
LONGEST l_min = (LONGEST) 1 << (sizeof (LONGEST) * 8 - 1);
- store_and_read_back (l_min, sizeof (LONGEST), BFD_ENDIAN_BIG,
- expected, actual);
+ store_and_read_back (l_min, sizeof (LONGEST), BFD_ENDIAN_BIG, expected,
+ actual);
SELF_CHECK (mpz_cmp (actual.val, expected.val) == 0);
- store_and_read_back (l_min, sizeof (LONGEST), BFD_ENDIAN_LITTLE,
- expected, actual);
+ store_and_read_back (l_min, sizeof (LONGEST), BFD_ENDIAN_LITTLE, expected,
+ actual);
SELF_CHECK (mpz_cmp (actual.val, expected.val) == 0);
/* Same with LONGEST_MAX. */
LONGEST l_max = LONGEST_MAX;
- store_and_read_back (l_max, sizeof (LONGEST), BFD_ENDIAN_BIG,
- expected, actual);
+ store_and_read_back (l_max, sizeof (LONGEST), BFD_ENDIAN_BIG, expected,
+ actual);
SELF_CHECK (mpz_cmp (actual.val, expected.val) == 0);
- store_and_read_back (l_max, sizeof (LONGEST), BFD_ENDIAN_LITTLE,
- expected, actual);
+ store_and_read_back (l_max, sizeof (LONGEST), BFD_ENDIAN_LITTLE, expected,
+ actual);
SELF_CHECK (mpz_cmp (actual.val, expected.val) == 0);
/* Same with the smallest ULONGEST. */
ULONGEST ul_min = 0;
- store_and_read_back (ul_min, sizeof (ULONGEST), BFD_ENDIAN_BIG,
- expected, actual);
+ store_and_read_back (ul_min, sizeof (ULONGEST), BFD_ENDIAN_BIG, expected,
+ actual);
SELF_CHECK (mpz_cmp (actual.val, expected.val) == 0);
- store_and_read_back (ul_min, sizeof (ULONGEST), BFD_ENDIAN_LITTLE,
- expected, actual);
+ store_and_read_back (ul_min, sizeof (ULONGEST), BFD_ENDIAN_LITTLE, expected,
+ actual);
SELF_CHECK (mpz_cmp (actual.val, expected.val) == 0);
/* Same with ULONGEST_MAX. */
ULONGEST ul_max = ULONGEST_MAX;
- store_and_read_back (ul_max, sizeof (ULONGEST), BFD_ENDIAN_BIG,
- expected, actual);
+ store_and_read_back (ul_max, sizeof (ULONGEST), BFD_ENDIAN_BIG, expected,
+ actual);
SELF_CHECK (mpz_cmp (actual.val, expected.val) == 0);
- store_and_read_back (ul_max, sizeof (ULONGEST), BFD_ENDIAN_LITTLE,
- expected, actual);
+ store_and_read_back (ul_max, sizeof (ULONGEST), BFD_ENDIAN_LITTLE, expected,
+ actual);
SELF_CHECK (mpz_cmp (actual.val, expected.val) == 0);
}
@@ -297,9 +298,9 @@ write_and_extract (T val, size_t buf_len, enum bfd_endian byte_order)
SELF_CHECK (v.as_integer<T> () == val);
gdb_byte *buf = (gdb_byte *) alloca (buf_len);
- v.write ({buf, buf_len}, byte_order, !std::is_signed<T>::value);
+ v.write ({ buf, buf_len }, byte_order, !std::is_signed<T>::value);
- return extract_integer<T> ({buf, buf_len}, byte_order);
+ return extract_integer<T> ({ buf, buf_len }, byte_order);
}
/* Test the gdb_mpz::write method over a reasonable range of values.
@@ -320,7 +321,7 @@ gdb_mpz_write_all_from_small ()
SELF_CHECK (write_and_extract (l, buf_len, BFD_ENDIAN_LITTLE) == l);
}
- /* Do the same as above, but with an unsigned type. */
+ /* Do the same as above, but with an unsigned type. */
ULONGEST ul_min = 0;
ULONGEST ul_max = pow (2.0, buf_len * 8) - 1;
@@ -387,8 +388,7 @@ gdb_mpz_write_min_max ()
static void
read_fp_test (int unscaled, const gdb_mpq &scaling_factor,
- enum bfd_endian byte_order,
- gdb_mpq &expected, gdb_mpq &actual)
+ enum bfd_endian byte_order, gdb_mpq &expected, gdb_mpq &actual)
{
/* For this kind of testing, we'll use a buffer the same size as
our unscaled parameter. */
@@ -396,7 +396,7 @@ read_fp_test (int unscaled, const gdb_mpq &scaling_factor,
gdb_byte buf[len];
store_signed_integer (buf, len, byte_order, unscaled);
- actual.read_fixed_point ({buf, len}, byte_order, 0, scaling_factor);
+ actual.read_fixed_point ({ buf, len }, byte_order, 0, scaling_factor);
mpq_set_si (expected.val, unscaled, 1);
mpq_mul (expected.val, expected.val, scaling_factor.val);
@@ -451,8 +451,7 @@ gdb_mpq_read_fixed_point ()
static LONGEST
write_fp_test (int numerator, unsigned int denominator,
- const gdb_mpq &scaling_factor,
- enum bfd_endian byte_order)
+ const gdb_mpq &scaling_factor, enum bfd_endian byte_order)
{
/* For this testing, we'll use a buffer the size of LONGEST.
This is really an arbitrary decision, as long as the buffer
@@ -465,7 +464,7 @@ write_fp_test (int numerator, unsigned int denominator,
gdb_mpq v;
mpq_set_si (v.val, numerator, denominator);
mpq_canonicalize (v.val);
- v.write_fixed_point ({buf, len}, byte_order, 0, scaling_factor);
+ v.write_fixed_point ({ buf, len }, byte_order, 0, scaling_factor);
return extract_unsigned_integer (buf, len, byte_order);
}
@@ -499,7 +498,7 @@ gdb_mpq_write_fixed_point ()
SELF_CHECK (write_fp_test (5, 3, scaling_factor, BFD_ENDIAN_LITTLE) == 5);
}
-}
+} // namespace selftests
void _initialize_gmp_utils_selftests ();
diff --git a/gdb/unittests/intrusive_list-selftests.c b/gdb/unittests/intrusive_list-selftests.c
index fe47177d51f..9c640b760e3 100644
--- a/gdb/unittests/intrusive_list-selftests.c
+++ b/gdb/unittests/intrusive_list-selftests.c
@@ -36,7 +36,8 @@ struct item_with_base : public other_base,
{
explicit item_with_base (const char *name)
: name (name)
- {}
+ {
+ }
const char *const name;
};
@@ -51,7 +52,8 @@ struct item_with_member
{
explicit item_with_member (const char *name)
: name (name)
- {}
+ {
+ }
const char *const name;
intrusive_list_node<item_with_member> node;
@@ -66,7 +68,7 @@ using item_with_member_list
declared in this templated class, which is instantiated once for each
list type. */
-template <typename ListType>
+template<typename ListType>
struct intrusive_list_test
{
using item_type = typename ListType::value_type;
@@ -75,14 +77,13 @@ struct intrusive_list_test
Traverse the list forward and backwards to exercise all links. */
- static void
- verify_items (const ListType &list,
- gdb::array_view<const typename ListType::value_type *> expected)
+ static void verify_items (
+ const ListType &list,
+ gdb::array_view<const typename ListType::value_type *> expected)
{
int i = 0;
- for (typename ListType::iterator it = list.begin ();
- it != list.end ();
+ for (typename ListType::iterator it = list.begin (); it != list.end ();
++it)
{
const item_type &item = *it;
@@ -96,8 +97,7 @@ struct intrusive_list_test
gdb_assert (i == expected.size ());
for (typename ListType::reverse_iterator it = list.rbegin ();
- it != list.rend ();
- ++it)
+ it != list.rend (); ++it)
{
const item_type &item = *it;
@@ -110,8 +110,7 @@ struct intrusive_list_test
gdb_assert (i == 0);
}
- static void
- test_move_constructor ()
+ static void test_move_constructor ()
{
{
/* Other list is not empty. */
@@ -128,7 +127,7 @@ struct intrusive_list_test
expected = {};
verify_items (list1, expected);
- expected = {&a, &b, &c};
+ expected = { &a, &b, &c };
verify_items (list2, expected);
}
@@ -145,7 +144,7 @@ struct intrusive_list_test
expected = {};
verify_items (list1, expected);
- expected = {&a};
+ expected = { &a };
verify_items (list2, expected);
}
@@ -164,8 +163,7 @@ struct intrusive_list_test
}
}
- static void
- test_move_assignment ()
+ static void test_move_assignment ()
{
{
/* Both lists are not empty. */
@@ -186,7 +184,7 @@ struct intrusive_list_test
expected = {};
verify_items (list1, expected);
- expected = {&a, &b, &c};
+ expected = { &a, &b, &c };
verify_items (list2, expected);
}
@@ -226,7 +224,7 @@ struct intrusive_list_test
expected = {};
verify_items (list1, expected);
- expected = {&a, &b, &c};
+ expected = { &a, &b, &c };
verify_items (list2, expected);
}
@@ -245,7 +243,7 @@ struct intrusive_list_test
expected = {};
verify_items (list1, expected);
- expected = {&a};
+ expected = { &a };
verify_items (list2, expected);
}
@@ -265,8 +263,7 @@ struct intrusive_list_test
}
}
- static void
- test_swap ()
+ static void test_swap ()
{
{
/* Two non-empty lists. */
@@ -284,10 +281,10 @@ struct intrusive_list_test
std::swap (list1, list2);
- expected = {&d, &e};
+ expected = { &d, &e };
verify_items (list1, expected);
- expected = {&a, &b, &c};
+ expected = { &a, &b, &c };
verify_items (list2, expected);
}
@@ -307,7 +304,7 @@ struct intrusive_list_test
expected = {};
verify_items (list1, expected);
- expected = {&a, &b, &c};
+ expected = { &a, &b, &c };
verify_items (list2, expected);
}
@@ -324,7 +321,7 @@ struct intrusive_list_test
std::swap (list1, list2);
- expected = {&a, &b, &c};
+ expected = { &a, &b, &c };
verify_items (list1, expected);
expected = {};
@@ -360,12 +357,12 @@ struct intrusive_list_test
expected = {};
verify_items (list1, expected);
- expected = {&a};
+ expected = { &a };
verify_items (list2, expected);
std::swap (list1, list2);
- expected = {&a};
+ expected = { &a };
verify_items (list1, expected);
expected = {};
@@ -373,8 +370,7 @@ struct intrusive_list_test
}
}
- static void
- test_front_back ()
+ static void test_front_back ()
{
item_type a ("a"), b ("b"), c ("c");
ListType list;
@@ -390,8 +386,7 @@ struct intrusive_list_test
gdb_assert (&clist.back () == &c);
}
- static void
- test_push_front ()
+ static void test_push_front ()
{
item_type a ("a"), b ("b"), c ("c");
ListType list;
@@ -401,20 +396,19 @@ struct intrusive_list_test
verify_items (list, expected);
list.push_front (a);
- expected = {&a};
+ expected = { &a };
verify_items (list, expected);
list.push_front (b);
- expected = {&b, &a};
+ expected = { &b, &a };
verify_items (list, expected);
list.push_front (c);
- expected = {&c, &b, &a};
+ expected = { &c, &b, &a };
verify_items (list, expected);
}
- static void
- test_push_back ()
+ static void test_push_back ()
{
item_type a ("a"), b ("b"), c ("c");
ListType list;
@@ -424,20 +418,19 @@ struct intrusive_list_test
verify_items (list, expected);
list.push_back (a);
- expected = {&a};
+ expected = { &a };
verify_items (list, expected);
list.push_back (b);
- expected = {&a, &b};
+ expected = { &a, &b };
verify_items (list, expected);
list.push_back (c);
- expected = {&a, &b, &c};
+ expected = { &a, &b, &c };
verify_items (list, expected);
}
- static void
- test_insert ()
+ static void test_insert ()
{
std::vector<const item_type *> expected;
@@ -446,17 +439,16 @@ struct intrusive_list_test
item_type a ("a"), b ("b"), c ("c");
ListType list;
-
list.insert (list.begin (), a);
- expected = {&a};
+ expected = { &a };
verify_items (list, expected);
list.insert (list.begin (), b);
- expected = {&b, &a};
+ expected = { &b, &a };
verify_items (list, expected);
list.insert (list.begin (), c);
- expected = {&c, &b, &a};
+ expected = { &c, &b, &a };
verify_items (list, expected);
}
@@ -465,17 +457,16 @@ struct intrusive_list_test
item_type a ("a"), b ("b"), c ("c");
ListType list;
-
list.insert (list.end (), a);
- expected = {&a};
+ expected = { &a };
verify_items (list, expected);
list.insert (list.end (), b);
- expected = {&a, &b};
+ expected = { &a, &b };
verify_items (list, expected);
list.insert (list.end (), c);
- expected = {&a, &b, &c};
+ expected = { &a, &b, &c };
verify_items (list, expected);
}
@@ -488,7 +479,7 @@ struct intrusive_list_test
list.push_back (b);
list.insert (list.iterator_to (b), c);
- expected = {&a, &c, &b};
+ expected = { &a, &c, &b };
verify_items (list, expected);
}
@@ -498,13 +489,12 @@ struct intrusive_list_test
ListType list;
list.insert (list.end (), a);
- expected = {&a};
+ expected = { &a };
verify_items (list, expected);
}
}
- static void
- test_splice ()
+ static void test_splice ()
{
{
/* Two non-empty lists. */
@@ -522,7 +512,7 @@ struct intrusive_list_test
list1.splice (std::move (list2));
- expected = {&a, &b, &c, &d, &e};
+ expected = { &a, &b, &c, &d, &e };
verify_items (list1, expected);
expected = {};
@@ -542,7 +532,7 @@ struct intrusive_list_test
list1.splice (std::move (list2));
- expected = {&a, &b, &c};
+ expected = { &a, &b, &c };
verify_items (list1, expected);
expected = {};
@@ -562,7 +552,7 @@ struct intrusive_list_test
list1.splice (std::move (list2));
- expected = {&a, &b, &c};
+ expected = { &a, &b, &c };
verify_items (list1, expected);
expected = {};
@@ -586,8 +576,7 @@ struct intrusive_list_test
}
}
- static void
- test_pop_front ()
+ static void test_pop_front ()
{
item_type a ("a"), b ("b"), c ("c");
ListType list;
@@ -598,11 +587,11 @@ struct intrusive_list_test
list.push_back (c);
list.pop_front ();
- expected = {&b, &c};
+ expected = { &b, &c };
verify_items (list, expected);
list.pop_front ();
- expected = {&c};
+ expected = { &c };
verify_items (list, expected);
list.pop_front ();
@@ -610,8 +599,7 @@ struct intrusive_list_test
verify_items (list, expected);
}
- static void
- test_pop_back ()
+ static void test_pop_back ()
{
item_type a ("a"), b ("b"), c ("c");
ListType list;
@@ -621,12 +609,12 @@ struct intrusive_list_test
list.push_back (b);
list.push_back (c);
- list.pop_back();
- expected = {&a, &b};
+ list.pop_back ();
+ expected = { &a, &b };
verify_items (list, expected);
list.pop_back ();
- expected = {&a};
+ expected = { &a };
verify_items (list, expected);
list.pop_back ();
@@ -634,8 +622,7 @@ struct intrusive_list_test
verify_items (list, expected);
}
- static void
- test_erase ()
+ static void test_erase ()
{
item_type a ("a"), b ("b"), c ("c");
ListType list;
@@ -646,11 +633,11 @@ struct intrusive_list_test
list.push_back (c);
list.erase (list.iterator_to (b));
- expected = {&a, &c};
+ expected = { &a, &c };
verify_items (list, expected);
list.erase (list.iterator_to (c));
- expected = {&a};
+ expected = { &a };
verify_items (list, expected);
list.erase (list.iterator_to (a));
@@ -658,8 +645,7 @@ struct intrusive_list_test
verify_items (list, expected);
}
- static void
- test_clear ()
+ static void test_clear ()
{
item_type a ("a"), b ("b"), c ("c");
ListType list;
@@ -679,8 +665,7 @@ struct intrusive_list_test
verify_items (list, expected);
}
- static void
- test_clear_and_dispose ()
+ static void test_clear_and_dispose ()
{
item_type a ("a"), b ("b"), c ("c");
ListType list;
@@ -692,11 +677,10 @@ struct intrusive_list_test
list.push_back (b);
list.push_back (c);
- auto disposer = [&] (const item_type *item)
- {
- disposer_seen.insert (item);
- disposer_calls++;
- };
+ auto disposer = [&] (const item_type *item) {
+ disposer_seen.insert (item);
+ disposer_calls++;
+ };
list.clear_and_dispose (disposer);
expected = {};
@@ -711,8 +695,7 @@ struct intrusive_list_test
gdb_assert (disposer_calls == 3);
}
- static void
- test_empty ()
+ static void test_empty ()
{
item_type a ("a");
ListType list;
@@ -724,8 +707,7 @@ struct intrusive_list_test
gdb_assert (list.empty ());
}
- static void
- test_begin_end ()
+ static void test_begin_end ()
{
item_type a ("a"), b ("b"), c ("c");
ListType list;
@@ -752,7 +734,7 @@ struct intrusive_list_test
}
};
-template <typename ListType>
+template<typename ListType>
static void
test_intrusive_list_1 ()
{
@@ -810,9 +792,9 @@ test_intrusive_list ()
}
void _initialize_intrusive_list_selftests ();
+
void
_initialize_intrusive_list_selftests ()
{
- selftests::register_test
- ("intrusive_list", test_intrusive_list);
+ selftests::register_test ("intrusive_list", test_intrusive_list);
}
diff --git a/gdb/unittests/lookup_name_info-selftests.c b/gdb/unittests/lookup_name_info-selftests.c
index b69f79b36d0..65688e404fc 100644
--- a/gdb/unittests/lookup_name_info-selftests.c
+++ b/gdb/unittests/lookup_name_info-selftests.c
@@ -21,8 +21,10 @@
#include "gdbsupport/selftest.h"
#include "symtab.h"
-namespace selftests {
-namespace lookup_name {
+namespace selftests
+{
+namespace lookup_name
+{
/* Check that removing parameter info out of NAME produces EXPECTED.
COMPLETION_MODE indicates whether we're testing normal and
@@ -30,8 +32,7 @@ namespace lookup_name {
location information in case the check fails. */
static void
-check_make_paramless (const char *file, int line,
- enum language lang,
+check_make_paramless (const char *file, int line, enum language lang,
const char *name, const char *expected,
bool completion_mode)
{
@@ -41,10 +42,10 @@ check_make_paramless (const char *file, int line,
if (strcmp (result, expected) != 0)
{
- error (_("%s:%d: make-paramless self-test failed: (completion=%d, lang=%d) "
- "\"%s\" -> \"%s\", expected \"%s\""),
- file, line, completion_mode, lang, name,
- result, expected);
+ error (
+ _ ("%s:%d: make-paramless self-test failed: (completion=%d, lang=%d) "
+ "\"%s\" -> \"%s\", expected \"%s\""),
+ file, line, completion_mode, lang, name, result, expected);
}
}
@@ -52,26 +53,23 @@ static void
run_tests ()
{
/* Helper for CHECK and CHECK_INCOMPL. */
-#define CHECK_1(INCOMPLETE, LANG, NAME, EXPECTED) \
- do \
- { \
- check_make_paramless (__FILE__, __LINE__, \
- LANG, NAME, \
- (INCOMPLETE) ? "" : (EXPECTED), false); \
- check_make_paramless (__FILE__, __LINE__, \
- LANG, NAME, EXPECTED, true); \
- } \
+#define CHECK_1(INCOMPLETE, LANG, NAME, EXPECTED) \
+ do \
+ { \
+ check_make_paramless (__FILE__, __LINE__, LANG, NAME, \
+ (INCOMPLETE) ? "" : (EXPECTED), false); \
+ check_make_paramless (__FILE__, __LINE__, LANG, NAME, EXPECTED, true); \
+ } \
while (0)
/* Check that removing parameter info out of NAME produces EXPECTED.
Checks both normal and completion modes. */
-#define CHECK(LANG, NAME, EXPECTED) \
- CHECK_1(false, LANG, NAME, EXPECTED)
+#define CHECK(LANG, NAME, EXPECTED) CHECK_1 (false, LANG, NAME, EXPECTED)
/* Similar, but used when NAME is incomplete -- i.e., NAME has
unbalanced parentheses. In this case, looking for the exact name
should fail / return empty. */
-#define CHECK_INCOMPL(LANG, NAME, EXPECTED) \
+#define CHECK_INCOMPL(LANG, NAME, EXPECTED) \
CHECK_1 (true, LANG, NAME, EXPECTED)
/* None of these languages support function overloading like C++
@@ -101,9 +99,11 @@ run_tests ()
#undef CHECK_INCOMPL
}
-}} // namespace selftests::lookup_name
+} // namespace lookup_name
+} // namespace selftests
void _initialize_lookup_name_info_selftests ();
+
void
_initialize_lookup_name_info_selftests ()
{
diff --git a/gdb/unittests/main-thread-selftests.c b/gdb/unittests/main-thread-selftests.c
index bdc1628fd3f..ee10247435e 100644
--- a/gdb/unittests/main-thread-selftests.c
+++ b/gdb/unittests/main-thread-selftests.c
@@ -27,8 +27,10 @@
#include <thread>
#endif
-namespace selftests {
-namespace main_thread_tests {
+namespace selftests
+{
+namespace main_thread_tests
+{
#if CXX_STD_THREAD
@@ -37,10 +39,7 @@ static bool done;
static void
set_done ()
{
- run_on_main_thread ([] ()
- {
- done = true;
- });
+ run_on_main_thread ([] () { done = true; });
}
static void
@@ -54,10 +53,10 @@ run_tests ()
gdb::block_signals blocker;
SCOPE_EXIT
- {
- if (thread.joinable ())
- thread.join ();
- };
+ {
+ if (thread.joinable ())
+ thread.join ();
+ };
thread = std::thread (set_done);
}
@@ -71,10 +70,11 @@ run_tests ()
#endif
-}
-}
+} // namespace main_thread_tests
+} // namespace selftests
void _initialize_main_thread_selftests ();
+
void
_initialize_main_thread_selftests ()
{
diff --git a/gdb/unittests/memory-map-selftests.c b/gdb/unittests/memory-map-selftests.c
index 2d5f2d69007..4a318ad1368 100644
--- a/gdb/unittests/memory-map-selftests.c
+++ b/gdb/unittests/memory-map-selftests.c
@@ -23,8 +23,10 @@
#if defined(HAVE_LIBEXPAT)
-namespace selftests {
-namespace memory_map_tests {
+namespace selftests
+{
+namespace memory_map_tests
+{
/* A simple valid test input for parse_memory_map. */
@@ -54,7 +56,6 @@ check_mem_region (const mem_region &r, CORE_ADDR lo, CORE_ADDR hi,
SELF_CHECK (r.attrib.mode == mode);
SELF_CHECK (r.attrib.blocksize == blocksize);
-
}
/* Test the parse_memory_map function. */
@@ -77,12 +78,12 @@ parse_memory_map_tests ()
#endif /* HAVE_LIBEXPAT */
void _initialize_memory_map_selftests ();
+
void
_initialize_memory_map_selftests ()
{
#if defined(HAVE_LIBEXPAT)
- selftests::register_test
- ("parse_memory_map",
- selftests::memory_map_tests::parse_memory_map_tests);
+ selftests::register_test (
+ "parse_memory_map", selftests::memory_map_tests::parse_memory_map_tests);
#endif
}
diff --git a/gdb/unittests/memrange-selftests.c b/gdb/unittests/memrange-selftests.c
index a48944eff7b..e4139a6e107 100644
--- a/gdb/unittests/memrange-selftests.c
+++ b/gdb/unittests/memrange-selftests.c
@@ -21,8 +21,10 @@
#include "gdbsupport/selftest.h"
#include "memrange.h"
-namespace selftests {
-namespace memrange_tests {
+namespace selftests
+{
+namespace memrange_tests
+{
static void
normalize_mem_ranges_tests ()
@@ -107,10 +109,11 @@ normalize_mem_ranges_tests ()
} /* namespace selftests */
void _initialize_memrange_selftests ();
+
void
_initialize_memrange_selftests ()
{
- selftests::register_test
- ("normalize_mem_ranges",
- selftests::memrange_tests::normalize_mem_ranges_tests);
+ selftests::register_test (
+ "normalize_mem_ranges",
+ selftests::memrange_tests::normalize_mem_ranges_tests);
}
diff --git a/gdb/unittests/mkdir-recursive-selftests.c b/gdb/unittests/mkdir-recursive-selftests.c
index 87b290e1192..8dc0e81b6f4 100644
--- a/gdb/unittests/mkdir-recursive-selftests.c
+++ b/gdb/unittests/mkdir-recursive-selftests.c
@@ -24,8 +24,10 @@
#include "gdbsupport/byte-vector.h"
#include "gdbsupport/pathstuff.h"
-namespace selftests {
-namespace mkdir_recursive {
+namespace selftests
+{
+namespace mkdir_recursive
+{
/* Try to create DIR using mkdir_recursive and make sure it exists. */
@@ -53,12 +55,15 @@ test ()
perror_with_name (("mkdtemp"));
/* Try not to leave leftover directories. */
- struct cleanup_dirs {
+ struct cleanup_dirs
+ {
cleanup_dirs (const char *base)
: m_base (base)
- {}
+ {
+ }
- ~cleanup_dirs () {
+ ~cleanup_dirs ()
+ {
rmdir (string_printf ("%s/a/b/c/d/e", m_base).c_str ());
rmdir (string_printf ("%s/a/b/c/d", m_base).c_str ());
rmdir (string_printf ("%s/a/b/c", m_base).c_str ());
@@ -68,6 +73,7 @@ test ()
}
private:
+
const char *m_base;
} cleanup_dirs (base.data ());
@@ -78,14 +84,14 @@ test ()
SELF_CHECK (create_dir_and_check (dir.c_str ()));
}
-}
-}
+} // namespace mkdir_recursive
+} // namespace selftests
void _initialize_mkdir_recursive_selftests ();
+
void
_initialize_mkdir_recursive_selftests ()
{
selftests::register_test ("mkdir_recursive",
selftests::mkdir_recursive::test);
}
-
diff --git a/gdb/unittests/observable-selftests.c b/gdb/unittests/observable-selftests.c
index 680b09e7111..8b8f482e03c 100644
--- a/gdb/unittests/observable-selftests.c
+++ b/gdb/unittests/observable-selftests.c
@@ -21,8 +21,10 @@
#include "gdbsupport/selftest.h"
#include "gdbsupport/observable.h"
-namespace selftests {
-namespace observers {
+namespace selftests
+{
+namespace observers
+{
static gdb::observers::observable<int> test_notification ("test_notification");
@@ -66,22 +68,46 @@ static void observer_dependency_test_callback (size_t index);
/* Data for observers to use for dependency tests, using some sample
dependencies between the observers. */
static std::vector<dependency_observer_data> test_observers = {
- {&observer_token0, "test0", {}, {},
- [] (int) { observer_dependency_test_callback (0); }},
- {&observer_token1, "test1", {0}, {0},
- [] (int) { observer_dependency_test_callback (1); }},
- {&observer_token2, "test2", {1}, {0, 1},
- [] (int) { observer_dependency_test_callback (2); }},
- {&observer_token3, "test3", {1}, {0, 1},
- [] (int) { observer_dependency_test_callback (3); }},
- {&observer_token4, "test4", {2, 3, 5}, {0, 1, 2, 3, 5},
- [] (int) { observer_dependency_test_callback (4); }},
- {&observer_token5, "test5", {0}, {0},
- [] (int) { observer_dependency_test_callback (5); }},
- {nullptr, "test6", {4}, {0, 1, 2, 3, 4, 5},
- [] (int) { observer_dependency_test_callback (6); }},
- {nullptr, "test7", {0}, {0},
- [] (int) { observer_dependency_test_callback (7); }},
+ { &observer_token0,
+ "test0",
+ {},
+ {},
+ [] (int) { observer_dependency_test_callback (0); } },
+ { &observer_token1,
+ "test1",
+ { 0 },
+ { 0 },
+ [] (int) { observer_dependency_test_callback (1); } },
+ { &observer_token2,
+ "test2",
+ { 1 },
+ { 0, 1 },
+ [] (int) { observer_dependency_test_callback (2); } },
+ { &observer_token3,
+ "test3",
+ { 1 },
+ { 0, 1 },
+ [] (int) { observer_dependency_test_callback (3); } },
+ { &observer_token4,
+ "test4",
+ { 2, 3, 5 },
+ { 0, 1, 2, 3, 5 },
+ [] (int) { observer_dependency_test_callback (4); } },
+ { &observer_token5,
+ "test5",
+ { 0 },
+ { 0 },
+ [] (int) { observer_dependency_test_callback (5); } },
+ { nullptr,
+ "test6",
+ { 4 },
+ { 0, 1, 2, 3, 4, 5 },
+ [] (int) { observer_dependency_test_callback (6); } },
+ { nullptr,
+ "test7",
+ { 0 },
+ { 0 },
+ [] (int) { observer_dependency_test_callback (7); } },
};
static void
@@ -137,8 +163,8 @@ observer_dependency_test_callback (size_t index)
static void
run_dependency_test (std::vector<int> insertion_order)
{
- gdb::observers::observable<int> dependency_test_notification
- ("dependency_test_notification");
+ gdb::observers::observable<int> dependency_test_notification (
+ "dependency_test_notification");
/* Reset counters. */
dependency_test_counters = std::vector<int> (test_observers.size (), 0);
@@ -154,8 +180,8 @@ run_dependency_test (std::vector<int> insertion_order)
dependency_tokens.emplace_back (test_observers[index].token);
if (o.token != nullptr)
- dependency_test_notification.attach
- (o.callback, *o.token, o.name, dependency_tokens);
+ dependency_test_notification.attach (o.callback, *o.token, o.name,
+ dependency_tokens);
else
dependency_test_notification.attach (o.callback, o.name,
dependency_tokens);
@@ -169,9 +195,9 @@ static void
test_dependency ()
{
/* Run dependency tests with different insertion orders. */
- run_dependency_test ({0, 1, 2, 3, 4, 5, 6, 7});
- run_dependency_test ({7, 6, 5, 4, 3, 2, 1, 0});
- run_dependency_test ({0, 3, 2, 1, 7, 6, 4, 5});
+ run_dependency_test ({ 0, 1, 2, 3, 4, 5, 6, 7 });
+ run_dependency_test ({ 7, 6, 5, 4, 3, 2, 1, 0 });
+ run_dependency_test ({ 0, 3, 2, 1, 7, 6, 4, 5 });
}
static void
@@ -181,10 +207,11 @@ run_tests ()
attached. */
notify_check_counters (0, 0, 0);
- const gdb::observers::token token1 {}, token2 {} , token3 {};
+ const gdb::observers::token token1 {}, token2 {}, token3 {};
/* Now, attach one observer, and send a notification. */
- test_notification.attach (&test_second_notification_function, token2, "test");
+ test_notification.attach (&test_second_notification_function, token2,
+ "test");
notify_check_counters (0, 1, 0);
/* Remove the observer, and send a notification. */
@@ -196,7 +223,8 @@ run_tests ()
notify_check_counters (1, 0, 0);
/* With 2 observers. */
- test_notification.attach (&test_second_notification_function, token2, "test");
+ test_notification.attach (&test_second_notification_function, token2,
+ "test");
notify_check_counters (1, 1, 0);
/* With 3 observers. */
@@ -218,7 +246,8 @@ run_tests ()
/* Go back to 3 observers, and remove them in a different
order... */
test_notification.attach (&test_first_notification_function, token1, "test");
- test_notification.attach (&test_second_notification_function, token2, "test");
+ test_notification.attach (&test_second_notification_function, token2,
+ "test");
test_notification.attach (&test_third_notification_function, token3, "test");
notify_check_counters (1, 1, 1);
@@ -239,11 +268,11 @@ run_tests ()
} /* namespace selftests */
void _initialize_observer_selftest ();
+
void
_initialize_observer_selftest ()
{
- selftests::register_test ("gdb::observers",
- selftests::observers::run_tests);
+ selftests::register_test ("gdb::observers", selftests::observers::run_tests);
selftests::register_test ("gdb::observers dependency",
selftests::observers::test_dependency);
}
diff --git a/gdb/unittests/offset-type-selftests.c b/gdb/unittests/offset-type-selftests.c
index dc63ef41831..932a89b7d2a 100644
--- a/gdb/unittests/offset-type-selftests.c
+++ b/gdb/unittests/offset-type-selftests.c
@@ -23,8 +23,10 @@
#include "gdbsupport/underlying.h"
#include "gdbsupport/valid-expr.h"
-namespace selftests {
-namespace offset_type {
+namespace selftests
+{
+namespace offset_type
+{
DEFINE_OFFSET_TYPE (off_A, unsigned int);
DEFINE_OFFSET_TYPE (off_B, unsigned int);
@@ -38,7 +40,7 @@ DEFINE_OFFSET_TYPE (off_B, unsigned int);
do compile and that they return the correct type.
*/
-#define CHECK_VALID(VALID, EXPR_TYPE, EXPR) \
+#define CHECK_VALID(VALID, EXPR_TYPE, EXPR) \
CHECK_VALID_EXPR_2 (off_A, off_B, VALID, EXPR_TYPE, EXPR)
off_A lval_a {};
@@ -48,58 +50,58 @@ using undrl = std::underlying_type<off_A>::type;
/* Offset +/- underlying. */
-CHECK_VALID (true, off_A, off_A {} + undrl {});
-CHECK_VALID (true, off_A, off_A {} - undrl {});
-CHECK_VALID (true, off_A, undrl {} + off_A {});
-CHECK_VALID (true, off_A, undrl {} - off_A {});
+CHECK_VALID (true, off_A, off_A {} + undrl {});
+CHECK_VALID (true, off_A, off_A {} - undrl {});
+CHECK_VALID (true, off_A, undrl {} + off_A {});
+CHECK_VALID (true, off_A, undrl {} - off_A {});
/* Add offset types. Both same and different. */
-CHECK_VALID (false, void, off_A {} + off_A {});
-CHECK_VALID (false, void, off_A {} + off_B {});
+CHECK_VALID (false, void, off_A {} + off_A {});
+CHECK_VALID (false, void, off_A {} + off_B {});
/* Subtract offset types. Both same and different. */
-CHECK_VALID (false, void, off_B {} - off_A {});
-CHECK_VALID (true, undrl, off_A {} - off_A {});
+CHECK_VALID (false, void, off_B {} - off_A {});
+CHECK_VALID (true, undrl, off_A {} - off_A {});
/* Add/assign offset types. Both same and different. */
-CHECK_VALID (false, void, lval_a += off_A {});
-CHECK_VALID (false, void, lval_a += off_B {});
-CHECK_VALID (false, void, lval_a -= off_A {});
-CHECK_VALID (false, void, lval_a -= off_B {});
+CHECK_VALID (false, void, lval_a += off_A {});
+CHECK_VALID (false, void, lval_a += off_B {});
+CHECK_VALID (false, void, lval_a -= off_A {});
+CHECK_VALID (false, void, lval_a -= off_B {});
/* operator OP+= (offset, underlying), lvalue ref on the lhs. */
-CHECK_VALID (true, off_A&, lval_a += undrl {});
-CHECK_VALID (true, off_A&, lval_a -= undrl {});
+CHECK_VALID (true, off_A &, lval_a += undrl {});
+CHECK_VALID (true, off_A &, lval_a -= undrl {});
/* operator OP+= (offset, underlying), rvalue ref on the lhs. */
-CHECK_VALID (false, void, off_A {} += undrl {});
-CHECK_VALID (false, void, off_A {} -= undrl {});
+CHECK_VALID (false, void, off_A {} += undrl {});
+CHECK_VALID (false, void, off_A {} -= undrl {});
/* Rel ops, with same type. */
-CHECK_VALID (true, bool, off_A {} < off_A {});
-CHECK_VALID (true, bool, off_A {} > off_A {});
-CHECK_VALID (true, bool, off_A {} <= off_A {});
-CHECK_VALID (true, bool, off_A {} >= off_A {});
+CHECK_VALID (true, bool, off_A {} < off_A {});
+CHECK_VALID (true, bool, off_A {} > off_A {});
+CHECK_VALID (true, bool, off_A {} <= off_A {});
+CHECK_VALID (true, bool, off_A {} >= off_A {});
/* Rel ops, with unrelated offset types. */
-CHECK_VALID (false, void, off_A {} < off_B {});
-CHECK_VALID (false, void, off_A {} > off_B {});
-CHECK_VALID (false, void, off_A {} <= off_B {});
-CHECK_VALID (false, void, off_A {} >= off_B {});
+CHECK_VALID (false, void, off_A {} < off_B {});
+CHECK_VALID (false, void, off_A {} > off_B {});
+CHECK_VALID (false, void, off_A {} <= off_B {});
+CHECK_VALID (false, void, off_A {} >= off_B {});
/* Rel ops, with unrelated types. */
-CHECK_VALID (false, void, off_A {} < undrl {});
-CHECK_VALID (false, void, off_A {} > undrl {});
-CHECK_VALID (false, void, off_A {} <= undrl {});
-CHECK_VALID (false, void, off_A {} >= undrl {});
+CHECK_VALID (false, void, off_A {} < undrl {});
+CHECK_VALID (false, void, off_A {} > undrl {});
+CHECK_VALID (false, void, off_A {} <= undrl {});
+CHECK_VALID (false, void, off_A {} >= undrl {});
static void
run_tests ()
@@ -172,6 +174,7 @@ run_tests ()
} /* namespace selftests */
void _initialize_offset_type_selftests ();
+
void
_initialize_offset_type_selftests ()
{
diff --git a/gdb/unittests/optional-selftests.c b/gdb/unittests/optional-selftests.c
index 8a727c02159..b191e78aa03 100644
--- a/gdb/unittests/optional-selftests.c
+++ b/gdb/unittests/optional-selftests.c
@@ -34,8 +34,10 @@
gdb::optional. */
#define GDB_OPTIONAL
-namespace selftests {
-namespace optional {
+namespace selftests
+{
+namespace optional
+{
/* The actual tests live in separate files, which were originally
copied over from libstdc++'s testsuite. To preserve the structure
@@ -88,6 +90,7 @@ run_tests ()
} /* namespace selftests */
void _initialize_optional_selftests ();
+
void
_initialize_optional_selftests ()
{
diff --git a/gdb/unittests/packed-selftests.c b/gdb/unittests/packed-selftests.c
index c5dd843b435..470d4656d29 100644
--- a/gdb/unittests/packed-selftests.c
+++ b/gdb/unittests/packed-selftests.c
@@ -21,8 +21,10 @@
#include "gdbsupport/selftest.h"
#include "gdbsupport/packed.h"
-namespace selftests {
-namespace packed_tests {
+namespace selftests
+{
+namespace packed_tests
+{
enum test_enum
{
@@ -43,7 +45,7 @@ gdb_static_assert (alignof (packed<test_enum, 3>) == 1);
gdb_static_assert (alignof (packed<test_enum, 4>) == 1);
/* Triviality checks. */
-#define CHECK_TRAIT(TRAIT) \
+#define CHECK_TRAIT(TRAIT) \
static_assert (std::TRAIT<packed<test_enum, 1>>::value, "")
#if HAVE_IS_TRIVIALLY_COPYABLE
@@ -125,6 +127,7 @@ run_tests ()
} /* namespace selftests */
void _initialize_packed_selftests ();
+
void
_initialize_packed_selftests ()
{
diff --git a/gdb/unittests/parallel-for-selftests.c b/gdb/unittests/parallel-for-selftests.c
index 15a095ae62b..e91a6b7e0ac 100644
--- a/gdb/unittests/parallel-for-selftests.c
+++ b/gdb/unittests/parallel-for-selftests.c
@@ -32,8 +32,10 @@
#include "gdbsupport/thread-pool.h"
-namespace selftests {
-namespace parallel_for {
+namespace selftests
+{
+namespace parallel_for
+{
struct save_restore_n_threads
{
@@ -79,12 +81,13 @@ test_n_threads ()
test (3);
}
-}
-}
+} // namespace parallel_for
+} // namespace selftests
#endif /* CXX_STD_THREAD */
void _initialize_parallel_for_selftests ();
+
void
_initialize_parallel_for_selftests ()
{
@@ -106,46 +109,29 @@ TEST (int n_threads)
std::atomic<int> counter (0);
FOR_EACH (1, 0, NUMBER,
- [&] (int start, int end)
- {
- counter += end - start;
- });
+ [&] (int start, int end) { counter += end - start; });
SELF_CHECK (counter == NUMBER);
counter = 0;
- FOR_EACH (1, 0, 0,
- [&] (int start, int end)
- {
- counter += end - start;
- });
+ FOR_EACH (1, 0, 0, [&] (int start, int end) { counter += end - start; });
SELF_CHECK (counter == 0);
- auto task_size_max_ = [] (int iter)
- {
- return (size_t)SIZE_MAX;
- };
+ auto task_size_max_ = [] (int iter) { return (size_t) SIZE_MAX; };
auto task_size_max = gdb::make_function_view (task_size_max_);
counter = 0;
- FOR_EACH (1, 0, NUMBER,
- [&] (int start, int end)
- {
- counter += end - start;
- }, task_size_max);
+ FOR_EACH (
+ 1, 0, NUMBER, [&] (int start, int end) { counter += end - start; },
+ task_size_max);
SELF_CHECK (counter == NUMBER);
- auto task_size_one_ = [] (int iter)
- {
- return (size_t)1;
- };
+ auto task_size_one_ = [] (int iter) { return (size_t) 1; };
auto task_size_one = gdb::make_function_view (task_size_one_);
counter = 0;
- FOR_EACH (1, 0, NUMBER,
- [&] (int start, int end)
- {
- counter += end - start;
- }, task_size_one);
+ FOR_EACH (
+ 1, 0, NUMBER, [&] (int start, int end) { counter += end - start; },
+ task_size_one);
SELF_CHECK (counter == NUMBER);
#undef NUMBER
@@ -155,39 +141,33 @@ TEST (int n_threads)
std::vector<std::unique_ptr<int>> intresults;
std::atomic<bool> any_empty_tasks (false);
- FOR_EACH (1, 0, 1,
- [&] (int start, int end)
- {
- if (start == end)
- any_empty_tasks = true;
- return std::unique_ptr<int> (new int (end - start));
- });
+ FOR_EACH (1, 0, 1, [&] (int start, int end) {
+ if (start == end)
+ any_empty_tasks = true;
+ return std::unique_ptr<int> (new int (end - start));
+ });
SELF_CHECK (!any_empty_tasks);
- SELF_CHECK (std::all_of (intresults.begin (),
- intresults.end (),
- [] (const std::unique_ptr<int> &entry)
- {
- return entry != nullptr;
- }));
+ SELF_CHECK (std::all_of (intresults.begin (), intresults.end (),
+ [] (const std::unique_ptr<int> &entry) {
+ return entry != nullptr;
+ }));
/* The same but using the task size parameter. */
intresults.clear ();
any_empty_tasks = false;
- FOR_EACH (1, 0, 1,
- [&] (int start, int end)
- {
- if (start == end)
- any_empty_tasks = true;
- return std::unique_ptr<int> (new int (end - start));
- },
- task_size_one);
+ FOR_EACH (
+ 1, 0, 1,
+ [&] (int start, int end) {
+ if (start == end)
+ any_empty_tasks = true;
+ return std::unique_ptr<int> (new int (end - start));
+ },
+ task_size_one);
SELF_CHECK (!any_empty_tasks);
- SELF_CHECK (std::all_of (intresults.begin (),
- intresults.end (),
- [] (const std::unique_ptr<int> &entry)
- {
- return entry != nullptr;
- }));
+ SELF_CHECK (std::all_of (intresults.begin (), intresults.end (),
+ [] (const std::unique_ptr<int> &entry) {
+ return entry != nullptr;
+ }));
}
#endif /* FOR_EACH */
diff --git a/gdb/unittests/parse-connection-spec-selftests.c b/gdb/unittests/parse-connection-spec-selftests.c
index aa773f56672..8c43d70bdeb 100644
--- a/gdb/unittests/parse-connection-spec-selftests.c
+++ b/gdb/unittests/parse-connection-spec-selftests.c
@@ -31,8 +31,10 @@
#include <netinet/tcp.h>
#endif
-namespace selftests {
-namespace parse_connection_spec_tests {
+namespace selftests
+{
+namespace parse_connection_spec_tests
+{
/* Auxiliary struct that holds info about a specific test for a
connection spec. */
@@ -66,9 +68,11 @@ struct parse_conn_test
/* Initialize a full entry. */
#define INIT_ENTRY(ADDR, EXP_HOST, EXP_PORT, SHOULD_FAIL, EXP_AI_FAMILY, \
- EXP_AI_SOCKTYPE, EXP_AI_PROTOCOL) \
- { ADDR, { EXP_HOST, EXP_PORT }, SHOULD_FAIL, EXP_AI_FAMILY, \
- EXP_AI_SOCKTYPE, EXP_AI_PROTOCOL }
+ EXP_AI_SOCKTYPE, EXP_AI_PROTOCOL) \
+ { \
+ ADDR, { EXP_HOST, EXP_PORT }, SHOULD_FAIL, EXP_AI_FAMILY, \
+ EXP_AI_SOCKTYPE, EXP_AI_PROTOCOL \
+ }
/* Initialize an unprefixed entry. In this case, we don't expect
anything on the 'struct addrinfo' HINT. */
@@ -82,121 +86,117 @@ struct parse_conn_test
/* Initialize a prefixed entry. */
#define INIT_PREFIXED_ENTRY(ADDR, EXP_HOST, EXP_PORT, EXP_AI_FAMILY, \
- EXP_AI_SOCKTYPE, EXP_AI_PROTOCOL) \
- INIT_ENTRY (ADDR, EXP_HOST, EXP_PORT, false, EXP_AI_FAMILY, \
+ EXP_AI_SOCKTYPE, EXP_AI_PROTOCOL) \
+ INIT_ENTRY (ADDR, EXP_HOST, EXP_PORT, false, EXP_AI_FAMILY, \
EXP_AI_SOCKTYPE, EXP_AI_PROTOCOL)
/* Initialize an entry prefixed with "tcp4:". */
-#define INIT_PREFIXED_IPV4_TCP(ADDR, EXP_HOST, EXP_PORT) \
+#define INIT_PREFIXED_IPV4_TCP(ADDR, EXP_HOST, EXP_PORT) \
INIT_PREFIXED_ENTRY (ADDR, EXP_HOST, EXP_PORT, AF_INET, SOCK_STREAM, \
IPPROTO_TCP)
/* Initialize an entry prefixed with "tcp6:". */
-#define INIT_PREFIXED_IPV6_TCP(ADDR, EXP_HOST, EXP_PORT) \
+#define INIT_PREFIXED_IPV6_TCP(ADDR, EXP_HOST, EXP_PORT) \
INIT_PREFIXED_ENTRY (ADDR, EXP_HOST, EXP_PORT, AF_INET6, SOCK_STREAM, \
IPPROTO_TCP)
/* Initialize an entry prefixed with "udp4:". */
-#define INIT_PREFIXED_IPV4_UDP(ADDR, EXP_HOST, EXP_PORT) \
+#define INIT_PREFIXED_IPV4_UDP(ADDR, EXP_HOST, EXP_PORT) \
INIT_PREFIXED_ENTRY (ADDR, EXP_HOST, EXP_PORT, AF_INET, SOCK_DGRAM, \
IPPROTO_UDP)
/* Initialize an entry prefixed with "udp6:". */
-#define INIT_PREFIXED_IPV6_UDP(ADDR, EXP_HOST, EXP_PORT) \
+#define INIT_PREFIXED_IPV6_UDP(ADDR, EXP_HOST, EXP_PORT) \
INIT_PREFIXED_ENTRY (ADDR, EXP_HOST, EXP_PORT, AF_INET6, SOCK_DGRAM, \
IPPROTO_UDP)
/* Initialize a bogus entry, i.e., a connection spec that should
fail. */
-#define INIT_BOGUS_ENTRY(ADDR) \
- INIT_ENTRY (ADDR, "", "", true, 0, 0, 0)
+#define INIT_BOGUS_ENTRY(ADDR) INIT_ENTRY (ADDR, "", "", true, 0, 0, 0)
/* The variable which holds all of our tests. */
-static const parse_conn_test conn_test[] =
- {
- /* Unprefixed addresses. */
-
- /* IPv4, host and port present. */
- INIT_UNPREFIXED_ENTRY ("127.0.0.1:1234", "127.0.0.1", "1234"),
- /* IPv4, only host. */
- INIT_UNPREFIXED_ENTRY ("127.0.0.1", "127.0.0.1", ""),
- /* IPv4, missing port. */
- INIT_UNPREFIXED_ENTRY ("127.0.0.1:", "127.0.0.1", ""),
-
- /* IPv6, host and port present, no brackets. */
- INIT_UNPREFIXED_ENTRY ("::1:1234", "::1", "1234"),
- /* IPv6, missing port, no brackets. */
- INIT_UNPREFIXED_ENTRY ("::1:", "::1", ""),
- /* IPv6, host and port present, with brackets. */
- INIT_UNPREFIXED_IPV6_ENTRY ("[::1]:1234", "::1", "1234"),
- /* IPv6, only host, with brackets. */
- INIT_UNPREFIXED_IPV6_ENTRY ("[::1]", "::1", ""),
- /* IPv6, missing port, with brackets. */
- INIT_UNPREFIXED_IPV6_ENTRY ("[::1]:", "::1", ""),
-
- /* Unspecified, only port. */
- INIT_UNPREFIXED_ENTRY (":1234", "localhost", "1234"),
-
- /* Prefixed addresses. */
-
- /* Prefixed "tcp4:" IPv4, host and port presents. */
- INIT_PREFIXED_IPV4_TCP ("tcp4:127.0.0.1:1234", "127.0.0.1", "1234"),
- /* Prefixed "tcp4:" IPv4, only port. */
- INIT_PREFIXED_IPV4_TCP ("tcp4::1234", "localhost", "1234"),
- /* Prefixed "tcp4:" IPv4, only host. */
- INIT_PREFIXED_IPV4_TCP ("tcp4:127.0.0.1", "127.0.0.1", ""),
- /* Prefixed "tcp4:" IPv4, missing port. */
- INIT_PREFIXED_IPV4_TCP ("tcp4:127.0.0.1:", "127.0.0.1", ""),
-
- /* Prefixed "udp4:" IPv4, host and port present. */
- INIT_PREFIXED_IPV4_UDP ("udp4:127.0.0.1:1234", "127.0.0.1", "1234"),
- /* Prefixed "udp4:" IPv4, only port. */
- INIT_PREFIXED_IPV4_UDP ("udp4::1234", "localhost", "1234"),
- /* Prefixed "udp4:" IPv4, only host. */
- INIT_PREFIXED_IPV4_UDP ("udp4:127.0.0.1", "127.0.0.1", ""),
- /* Prefixed "udp4:" IPv4, missing port. */
- INIT_PREFIXED_IPV4_UDP ("udp4:127.0.0.1:", "127.0.0.1", ""),
-
-
- /* Prefixed "tcp6:" IPv6, host and port present. */
- INIT_PREFIXED_IPV6_TCP ("tcp6:::1:1234", "::1", "1234"),
- /* Prefixed "tcp6:" IPv6, only port. */
- INIT_PREFIXED_IPV6_TCP ("tcp6::1234", "localhost", "1234"),
- /* Prefixed "tcp6:" IPv6, only host. */
- //INIT_PREFIXED_IPV6_TCP ("tcp6:::1", "::1", ""),
- /* Prefixed "tcp6:" IPv6, missing port. */
- INIT_PREFIXED_IPV6_TCP ("tcp6:::1:", "::1", ""),
-
- /* Prefixed "udp6:" IPv6, host and port present. */
- INIT_PREFIXED_IPV6_UDP ("udp6:::1:1234", "::1", "1234"),
- /* Prefixed "udp6:" IPv6, only port. */
- INIT_PREFIXED_IPV6_UDP ("udp6::1234", "localhost", "1234"),
- /* Prefixed "udp6:" IPv6, only host. */
- //INIT_PREFIXED_IPV6_UDP ("udp6:::1", "::1", ""),
- /* Prefixed "udp6:" IPv6, missing port. */
- INIT_PREFIXED_IPV6_UDP ("udp6:::1:", "::1", ""),
-
- /* Prefixed "tcp6:" IPv6 with brackets, host and port present. */
- INIT_PREFIXED_IPV6_TCP ("tcp6:[::1]:1234", "::1", "1234"),
- /* Prefixed "tcp6:" IPv6 with brackets, only host. */
- INIT_PREFIXED_IPV6_TCP ("tcp6:[::1]", "::1", ""),
- /* Prefixed "tcp6:" IPv6 with brackets, missing port. */
- INIT_PREFIXED_IPV6_TCP ("tcp6:[::1]:", "::1", ""),
-
- /* Prefixed "udp6:" IPv6 with brackets, host and port present. */
- INIT_PREFIXED_IPV6_UDP ("udp6:[::1]:1234", "::1", "1234"),
- /* Prefixed "udp6:" IPv6 with brackets, only host. */
- INIT_PREFIXED_IPV6_UDP ("udp6:[::1]", "::1", ""),
- /* Prefixed "udp6:" IPv6 with brackets, missing port. */
- INIT_PREFIXED_IPV6_UDP ("udp6:[::1]:", "::1", ""),
-
-
- /* Bogus addresses. */
- INIT_BOGUS_ENTRY ("tcp6:[::1]123:44"),
- INIT_BOGUS_ENTRY ("[::1"),
- INIT_BOGUS_ENTRY ("tcp6:::1]:"),
- };
+static const parse_conn_test conn_test[] = {
+ /* Unprefixed addresses. */
+
+ /* IPv4, host and port present. */
+ INIT_UNPREFIXED_ENTRY ("127.0.0.1:1234", "127.0.0.1", "1234"),
+ /* IPv4, only host. */
+ INIT_UNPREFIXED_ENTRY ("127.0.0.1", "127.0.0.1", ""),
+ /* IPv4, missing port. */
+ INIT_UNPREFIXED_ENTRY ("127.0.0.1:", "127.0.0.1", ""),
+
+ /* IPv6, host and port present, no brackets. */
+ INIT_UNPREFIXED_ENTRY ("::1:1234", "::1", "1234"),
+ /* IPv6, missing port, no brackets. */
+ INIT_UNPREFIXED_ENTRY ("::1:", "::1", ""),
+ /* IPv6, host and port present, with brackets. */
+ INIT_UNPREFIXED_IPV6_ENTRY ("[::1]:1234", "::1", "1234"),
+ /* IPv6, only host, with brackets. */
+ INIT_UNPREFIXED_IPV6_ENTRY ("[::1]", "::1", ""),
+ /* IPv6, missing port, with brackets. */
+ INIT_UNPREFIXED_IPV6_ENTRY ("[::1]:", "::1", ""),
+
+ /* Unspecified, only port. */
+ INIT_UNPREFIXED_ENTRY (":1234", "localhost", "1234"),
+
+ /* Prefixed addresses. */
+
+ /* Prefixed "tcp4:" IPv4, host and port presents. */
+ INIT_PREFIXED_IPV4_TCP ("tcp4:127.0.0.1:1234", "127.0.0.1", "1234"),
+ /* Prefixed "tcp4:" IPv4, only port. */
+ INIT_PREFIXED_IPV4_TCP ("tcp4::1234", "localhost", "1234"),
+ /* Prefixed "tcp4:" IPv4, only host. */
+ INIT_PREFIXED_IPV4_TCP ("tcp4:127.0.0.1", "127.0.0.1", ""),
+ /* Prefixed "tcp4:" IPv4, missing port. */
+ INIT_PREFIXED_IPV4_TCP ("tcp4:127.0.0.1:", "127.0.0.1", ""),
+
+ /* Prefixed "udp4:" IPv4, host and port present. */
+ INIT_PREFIXED_IPV4_UDP ("udp4:127.0.0.1:1234", "127.0.0.1", "1234"),
+ /* Prefixed "udp4:" IPv4, only port. */
+ INIT_PREFIXED_IPV4_UDP ("udp4::1234", "localhost", "1234"),
+ /* Prefixed "udp4:" IPv4, only host. */
+ INIT_PREFIXED_IPV4_UDP ("udp4:127.0.0.1", "127.0.0.1", ""),
+ /* Prefixed "udp4:" IPv4, missing port. */
+ INIT_PREFIXED_IPV4_UDP ("udp4:127.0.0.1:", "127.0.0.1", ""),
+
+ /* Prefixed "tcp6:" IPv6, host and port present. */
+ INIT_PREFIXED_IPV6_TCP ("tcp6:::1:1234", "::1", "1234"),
+ /* Prefixed "tcp6:" IPv6, only port. */
+ INIT_PREFIXED_IPV6_TCP ("tcp6::1234", "localhost", "1234"),
+ /* Prefixed "tcp6:" IPv6, only host. */
+ //INIT_PREFIXED_IPV6_TCP ("tcp6:::1", "::1", ""),
+ /* Prefixed "tcp6:" IPv6, missing port. */
+ INIT_PREFIXED_IPV6_TCP ("tcp6:::1:", "::1", ""),
+
+ /* Prefixed "udp6:" IPv6, host and port present. */
+ INIT_PREFIXED_IPV6_UDP ("udp6:::1:1234", "::1", "1234"),
+ /* Prefixed "udp6:" IPv6, only port. */
+ INIT_PREFIXED_IPV6_UDP ("udp6::1234", "localhost", "1234"),
+ /* Prefixed "udp6:" IPv6, only host. */
+ //INIT_PREFIXED_IPV6_UDP ("udp6:::1", "::1", ""),
+ /* Prefixed "udp6:" IPv6, missing port. */
+ INIT_PREFIXED_IPV6_UDP ("udp6:::1:", "::1", ""),
+
+ /* Prefixed "tcp6:" IPv6 with brackets, host and port present. */
+ INIT_PREFIXED_IPV6_TCP ("tcp6:[::1]:1234", "::1", "1234"),
+ /* Prefixed "tcp6:" IPv6 with brackets, only host. */
+ INIT_PREFIXED_IPV6_TCP ("tcp6:[::1]", "::1", ""),
+ /* Prefixed "tcp6:" IPv6 with brackets, missing port. */
+ INIT_PREFIXED_IPV6_TCP ("tcp6:[::1]:", "::1", ""),
+
+ /* Prefixed "udp6:" IPv6 with brackets, host and port present. */
+ INIT_PREFIXED_IPV6_UDP ("udp6:[::1]:1234", "::1", "1234"),
+ /* Prefixed "udp6:" IPv6 with brackets, only host. */
+ INIT_PREFIXED_IPV6_UDP ("udp6:[::1]", "::1", ""),
+ /* Prefixed "udp6:" IPv6 with brackets, missing port. */
+ INIT_PREFIXED_IPV6_UDP ("udp6:[::1]:", "::1", ""),
+
+ /* Bogus addresses. */
+ INIT_BOGUS_ENTRY ("tcp6:[::1]123:44"),
+ INIT_BOGUS_ENTRY ("[::1"),
+ INIT_BOGUS_ENTRY ("tcp6:::1]:"),
+};
/* Test a connection spec C. */
@@ -240,6 +240,7 @@ run_tests ()
} /* namespace selftests */
void _initialize_parse_connection_spec_selftests ();
+
void
_initialize_parse_connection_spec_selftests ()
{
diff --git a/gdb/unittests/path-join-selftests.c b/gdb/unittests/path-join-selftests.c
index c41396f0fe7..26355b6bc6d 100644
--- a/gdb/unittests/path-join-selftests.c
+++ b/gdb/unittests/path-join-selftests.c
@@ -21,10 +21,12 @@
#include "gdbsupport/pathstuff.h"
#include "gdbsupport/selftest.h"
-namespace selftests {
-namespace path_join {
+namespace selftests
+{
+namespace path_join
+{
-template <typename ...Args>
+template<typename... Args>
static void
test_one (const char *expected, Args... paths)
{
@@ -61,13 +63,13 @@ test ()
#endif /* _WIN32 */
}
-}
-}
+} // namespace path_join
+} // namespace selftests
void _initialize_path_join_selftests ();
+
void
_initialize_path_join_selftests ()
{
- selftests::register_test ("path_join",
- selftests::path_join::test);
+ selftests::register_test ("path_join", selftests::path_join::test);
}
diff --git a/gdb/unittests/ptid-selftests.c b/gdb/unittests/ptid-selftests.c
index 5af73b0da53..c634a261afc 100644
--- a/gdb/unittests/ptid-selftests.c
+++ b/gdb/unittests/ptid-selftests.c
@@ -21,8 +21,10 @@
#include "gdbsupport/ptid.h"
#include <type_traits>
-namespace selftests {
-namespace ptid {
+namespace selftests
+{
+namespace ptid
+{
/* Check that the ptid_t class is POD.
@@ -125,7 +127,8 @@ static_assert (both.matches (pid), "both matches pid");
static_assert (!ptid_t (2, 0, 0).matches (pid), "other pid doesn't match pid");
static_assert (!ptid_t (2, 2, 0).matches (pid), "other lwp doesn't match pid");
static_assert (!ptid_t (2, 0, 2).matches (pid), "other tid doesn't match pid");
-static_assert (!ptid_t (2, 2, 2).matches (pid), "other both doesn't match pid");
+static_assert (!ptid_t (2, 2, 2).matches (pid),
+ "other both doesn't match pid");
/* Verify matches against exact matches. */
@@ -148,6 +151,5 @@ static_assert (both.matches (both), "both matches both");
static_assert (!ptid_t (2, 2, 2).matches (both),
"other both doesn't match both");
-
} /* namespace ptid */
} /* namespace selftests */
diff --git a/gdb/unittests/rsp-low-selftests.c b/gdb/unittests/rsp-low-selftests.c
index 6e0c90e63de..5a985253cfa 100644
--- a/gdb/unittests/rsp-low-selftests.c
+++ b/gdb/unittests/rsp-low-selftests.c
@@ -21,12 +21,15 @@
#include "gdbsupport/selftest.h"
#include "gdbsupport/rsp-low.h"
-namespace selftests {
-namespace rsp_low {
+namespace selftests
+{
+namespace rsp_low
+{
/* Test the variant of hex2bin that returns a byte_vector. */
-static void test_hex2bin_byte_vector ()
+static void
+test_hex2bin_byte_vector ()
{
gdb::byte_vector bv;
@@ -48,7 +51,8 @@ static void test_hex2bin_byte_vector ()
SELF_CHECK (bv[1] == 0x23);
}
-static void test_hex2str ()
+static void
+test_hex2str ()
{
SELF_CHECK (hex2str ("666f6f") == "foo");
SELF_CHECK (hex2str ("666f6fa") == "foo");
@@ -62,11 +66,11 @@ static void test_hex2str ()
} /* namespace selftests */
void _initialize_rsp_low_selftests ();
+
void
_initialize_rsp_low_selftests ()
{
selftests::register_test ("hex2bin_byte_vector",
selftests::rsp_low::test_hex2bin_byte_vector);
- selftests::register_test ("hex2str",
- selftests::rsp_low::test_hex2str);
+ selftests::register_test ("hex2str", selftests::rsp_low::test_hex2str);
}
diff --git a/gdb/unittests/scoped_fd-selftests.c b/gdb/unittests/scoped_fd-selftests.c
index 409f2be1368..cfc54da26f8 100644
--- a/gdb/unittests/scoped_fd-selftests.c
+++ b/gdb/unittests/scoped_fd-selftests.c
@@ -24,8 +24,10 @@
#include "config.h"
#include "gdbsupport/selftest.h"
-namespace selftests {
-namespace scoped_fd {
+namespace selftests
+{
+namespace scoped_fd
+{
/* Test that the file descriptor is closed. */
static void
@@ -75,7 +77,7 @@ test_to_file ()
SELF_CHECK (sfd.get () >= 0);
unlink (filename);
-
+
gdb_file_up file = sfd.to_file ("rw");
SELF_CHECK (file != nullptr);
SELF_CHECK (sfd.get () == -1);
@@ -94,9 +96,9 @@ run_tests ()
} /* namespace selftests */
void _initialize_scoped_fd_selftests ();
+
void
_initialize_scoped_fd_selftests ()
{
- selftests::register_test ("scoped_fd",
- selftests::scoped_fd::run_tests);
+ selftests::register_test ("scoped_fd", selftests::scoped_fd::run_tests);
}
diff --git a/gdb/unittests/scoped_ignore_signal-selftests.c b/gdb/unittests/scoped_ignore_signal-selftests.c
index c8bb1ec3784..421eda7d1ec 100644
--- a/gdb/unittests/scoped_ignore_signal-selftests.c
+++ b/gdb/unittests/scoped_ignore_signal-selftests.c
@@ -24,8 +24,10 @@
#include <unistd.h>
#include <signal.h>
-namespace selftests {
-namespace scoped_ignore_sig {
+namespace selftests
+{
+namespace scoped_ignore_sig
+{
#ifdef SIGPIPE
@@ -46,7 +48,10 @@ static void
test_sigpipe ()
{
auto *osig = signal (SIGPIPE, handle_sigpipe);
- SCOPE_EXIT { signal (SIGPIPE, osig); };
+ SCOPE_EXIT
+ {
+ signal (SIGPIPE, osig);
+ };
#ifdef HAVE_SIGPROCMASK
/* Make sure SIGPIPE isn't blocked. */
@@ -54,7 +59,10 @@ test_sigpipe ()
sigemptyset (&set);
sigaddset (&set, SIGPIPE);
sigprocmask (SIG_UNBLOCK, &set, &old_state);
- SCOPE_EXIT { sigprocmask (SIG_SETMASK, &old_state, nullptr); };
+ SCOPE_EXIT
+ {
+ sigprocmask (SIG_SETMASK, &old_state, nullptr);
+ };
#endif
/* Create pipe, and close read end so that writes to the pipe fail
@@ -68,18 +76,19 @@ test_sigpipe ()
SELF_CHECK (r == 0);
close (fd[0]);
- SCOPE_EXIT { close (fd[1]); };
+ SCOPE_EXIT
+ {
+ close (fd[1]);
+ };
/* Check that writing to the pipe results in EPIPE. EXPECT_SIG
indicates whether a SIGPIPE signal is expected. */
- auto check_pipe_write = [&] (bool expect_sig)
- {
+ auto check_pipe_write = [&] (bool expect_sig) {
got_sigpipe = 0;
errno = 0;
r = write (fd[1], &c, 1);
- SELF_CHECK (r == -1 && errno == EPIPE
- && got_sigpipe == expect_sig);
+ SELF_CHECK (r == -1 && errno == EPIPE && got_sigpipe == expect_sig);
};
/* Check that without a scoped_ignore_sigpipe in scope we indeed get
@@ -116,6 +125,7 @@ test_sigpipe ()
} /* namespace selftests */
void _initialize_scoped_ignore_signal_selftests ();
+
void
_initialize_scoped_ignore_signal_selftests ()
{
diff --git a/gdb/unittests/scoped_mmap-selftests.c b/gdb/unittests/scoped_mmap-selftests.c
index a8f507cb523..d897f14b410 100644
--- a/gdb/unittests/scoped_mmap-selftests.c
+++ b/gdb/unittests/scoped_mmap-selftests.c
@@ -30,8 +30,10 @@
#include <unistd.h>
-namespace selftests {
-namespace scoped_mmap {
+namespace selftests
+{
+namespace scoped_mmap
+{
/* Test that the file is unmapped. */
static void
@@ -113,16 +115,18 @@ test_invalid_filename ()
{
bool threw = false;
- try {
+ try
+ {
::scoped_mmap m = ::mmap_file ("/this/file/should/not/exist");
- } catch (gdb_exception &e) {
+ }
+ catch (gdb_exception &e)
+ {
threw = true;
- }
+ }
SELF_CHECK (threw);
}
-
/* Run selftests. */
static void
run_tests ()
@@ -137,13 +141,12 @@ run_tests ()
#endif /* !defined(HAVE_SYS_MMAN_H) */
void _initialize_scoped_mmap_selftests ();
+
void
_initialize_scoped_mmap_selftests ()
{
#if defined(HAVE_SYS_MMAN_H)
- selftests::register_test ("scoped_mmap",
- selftests::scoped_mmap::run_tests);
- selftests::register_test ("mmap_file",
- selftests::mmap_file::run_tests);
+ selftests::register_test ("scoped_mmap", selftests::scoped_mmap::run_tests);
+ selftests::register_test ("mmap_file", selftests::mmap_file::run_tests);
#endif
}
diff --git a/gdb/unittests/scoped_restore-selftests.c b/gdb/unittests/scoped_restore-selftests.c
index a21fba54f26..0bfdca55f62 100644
--- a/gdb/unittests/scoped_restore-selftests.c
+++ b/gdb/unittests/scoped_restore-selftests.c
@@ -21,11 +21,18 @@
#include "gdbsupport/selftest.h"
#include "gdbsupport/scoped_restore.h"
-namespace selftests {
-namespace scoped_restore_tests {
+namespace selftests
+{
+namespace scoped_restore_tests
+{
+
+struct Base
+{
+};
-struct Base {};
-struct Derived : Base {};
+struct Derived : Base
+{
+};
static int global;
@@ -104,6 +111,7 @@ run_tests ()
} /* namespace selftests */
void _initialize_scoped_restore_selftests ();
+
void
_initialize_scoped_restore_selftests ()
{
diff --git a/gdb/unittests/search-memory-selftests.c b/gdb/unittests/search-memory-selftests.c
index 954b2e349e0..4addb7823ce 100644
--- a/gdb/unittests/search-memory-selftests.c
+++ b/gdb/unittests/search-memory-selftests.c
@@ -21,8 +21,10 @@
#include "gdbsupport/selftest.h"
#include "gdbsupport/search.h"
-namespace selftests {
-namespace search_memory_tests {
+namespace selftests
+{
+namespace search_memory_tests
+{
static void
run_tests ()
@@ -34,22 +36,21 @@ run_tests ()
bool read_fully = false;
bool read_off_end = false;
- auto read_memory = [&] (CORE_ADDR from, gdb_byte *out, size_t len)
- {
- if (from + len > data.size ())
- read_off_end = true;
- else
- memcpy (out, &data[from], len);
- if (from + len == data.size ())
- read_fully = true;
- return true;
- };
+ auto read_memory = [&] (CORE_ADDR from, gdb_byte *out, size_t len) {
+ if (from + len > data.size ())
+ read_off_end = true;
+ else
+ memcpy (out, &data[from], len);
+ if (from + len == data.size ())
+ read_fully = true;
+ return true;
+ };
gdb_byte pattern = 'x';
CORE_ADDR addr = 0;
- int result = simple_search_memory (read_memory, 0, data.size (),
- &pattern, 1, &addr);
+ int result
+ = simple_search_memory (read_memory, 0, data.size (), &pattern, 1, &addr);
/* In this case we don't care if read_fully was set or not. */
SELF_CHECK (result == 1);
SELF_CHECK (!read_off_end);
@@ -59,8 +60,8 @@ run_tests ()
read_fully = false;
read_off_end = false;
pattern = 'q';
- result = simple_search_memory (read_memory, 0, data.size (),
- &pattern, 1, &addr);
+ result
+ = simple_search_memory (read_memory, 0, data.size (), &pattern, 1, &addr);
SELF_CHECK (result == 0);
SELF_CHECK (!read_off_end);
SELF_CHECK (read_fully);
@@ -74,11 +75,10 @@ run_tests ()
const CORE_ADDR found_addr = 0x837bac8;
memcpy (&data[found_addr - base_addr], wpattern, sizeof (wpattern));
- auto read_memory_2 = [&] (CORE_ADDR from, gdb_byte *out, size_t len)
- {
- memcpy (out, &data[from - base_addr], len);
- return true;
- };
+ auto read_memory_2 = [&] (CORE_ADDR from, gdb_byte *out, size_t len) {
+ memcpy (out, &data[from - base_addr], len);
+ return true;
+ };
result = simple_search_memory (read_memory_2, base_addr, data.size (),
wpattern, sizeof (wpattern), &addr);
@@ -89,8 +89,8 @@ run_tests ()
} /* namespace search_memory_tests */
} /* namespace selftests */
-
void _initialize_search_memory_selftests ();
+
void
_initialize_search_memory_selftests ()
{
diff --git a/gdb/unittests/string_view-selftests.c b/gdb/unittests/string_view-selftests.c
index cf43d29502c..f9d3c3ce77f 100644
--- a/gdb/unittests/string_view-selftests.c
+++ b/gdb/unittests/string_view-selftests.c
@@ -52,8 +52,10 @@ DIAGNOSTIC_POP
gdb::string_view. */
#define GDB_STRING_VIEW
-namespace selftests {
-namespace string_view {
+namespace selftests
+{
+namespace string_view
+{
/* The actual tests live in separate files, which were originally
copied over from libstdc++'s testsuite. To preserve the structure
@@ -184,6 +186,7 @@ run_tests ()
#endif /* __cplusplus < 201703L */
void _initialize_string_view_selftests ();
+
void
_initialize_string_view_selftests ()
{
diff --git a/gdb/unittests/style-selftests.c b/gdb/unittests/style-selftests.c
index 9a467da131c..56f8ac2c487 100644
--- a/gdb/unittests/style-selftests.c
+++ b/gdb/unittests/style-selftests.c
@@ -21,8 +21,10 @@
#include "gdbsupport/selftest.h"
#include "ui-style.h"
-namespace selftests {
-namespace style {
+namespace selftests
+{
+namespace style
+{
#define CHECK_RGB(R, G, B) \
SELF_CHECK (rgb[0] == (R) && rgb[1] == (G) && rgb[2] == (B))
@@ -102,9 +104,9 @@ run_tests ()
} /* namespace selftests */
void _initialize_style_selftest ();
+
void
_initialize_style_selftest ()
{
- selftests::register_test ("style",
- selftests::style::run_tests);
+ selftests::register_test ("style", selftests::style::run_tests);
}
diff --git a/gdb/unittests/tracepoint-selftests.c b/gdb/unittests/tracepoint-selftests.c
index 7ae5250eb7b..dea4ebaad21 100644
--- a/gdb/unittests/tracepoint-selftests.c
+++ b/gdb/unittests/tracepoint-selftests.c
@@ -21,8 +21,10 @@
#include "gdbsupport/selftest.h"
#include "tracepoint.h"
-namespace selftests {
-namespace tracepoint_tests {
+namespace selftests
+{
+namespace tracepoint_tests
+{
static void
test_parse_static_tracepoint_marker_definition ()
@@ -62,10 +64,11 @@ test_parse_static_tracepoint_marker_definition ()
} /* namespace selftests */
void _initialize_tracepoint_selftests ();
+
void
_initialize_tracepoint_selftests ()
{
- selftests::register_test
- ("parse_static_tracepoint_marker_definition",
- selftests::tracepoint_tests::test_parse_static_tracepoint_marker_definition);
+ selftests::register_test ("parse_static_tracepoint_marker_definition",
+ selftests::tracepoint_tests::
+ test_parse_static_tracepoint_marker_definition);
}
diff --git a/gdb/unittests/tui-selftests.c b/gdb/unittests/tui-selftests.c
index e017b717e07..a73a4440595 100644
--- a/gdb/unittests/tui-selftests.c
+++ b/gdb/unittests/tui-selftests.c
@@ -24,8 +24,10 @@
#include "tui/tui-winsource.h"
-namespace selftests {
-namespace tui {
+namespace selftests
+{
+namespace tui
+{
static void
run_tests ()
@@ -47,6 +49,7 @@ run_tests ()
#endif /* TUI */
void _initialize_tui_selftest ();
+
void
_initialize_tui_selftest ()
{
diff --git a/gdb/unittests/ui-file-selftests.c b/gdb/unittests/ui-file-selftests.c
index 4e5a4713a9c..9078cd8f56e 100644
--- a/gdb/unittests/ui-file-selftests.c
+++ b/gdb/unittests/ui-file-selftests.c
@@ -21,8 +21,10 @@
#include "gdbsupport/selftest.h"
#include "ui-file.h"
-namespace selftests {
-namespace file {
+namespace selftests
+{
+namespace file
+{
static void
check_one (const char *str, int quoter, const char *result)
@@ -35,28 +37,24 @@ check_one (const char *str, int quoter, const char *result)
static void
run_tests ()
{
- check_one ("basic stuff: \\", '\\',
- "basic stuff: \\\\");
- check_one ("more basic stuff: \\Q", 'Q',
- "more basic stuff: \\\\\\Q");
- check_one ("more basic stuff: \\Q", '\0',
- "more basic stuff: \\Q");
+ check_one ("basic stuff: \\", '\\', "basic stuff: \\\\");
+ check_one ("more basic stuff: \\Q", 'Q', "more basic stuff: \\\\\\Q");
+ check_one ("more basic stuff: \\Q", '\0', "more basic stuff: \\Q");
check_one ("weird stuff: \x1f\x90\n\b\t\f\r\033\007", '\\',
"weird stuff: \\037\\220\\n\\b\\t\\f\\r\\e\\a");
scoped_restore save_7 = make_scoped_restore (&sevenbit_strings, true);
- check_one ("more weird stuff: \xa5", '\\',
- "more weird stuff: \\245");
+ check_one ("more weird stuff: \xa5", '\\', "more weird stuff: \\245");
}
} /* namespace file*/
} /* namespace selftests */
void _initialize_ui_file_selftest ();
+
void
_initialize_ui_file_selftest ()
{
- selftests::register_test ("ui-file",
- selftests::file::run_tests);
+ selftests::register_test ("ui-file", selftests::file::run_tests);
}
diff --git a/gdb/unittests/unique_xmalloc_ptr_char.c b/gdb/unittests/unique_xmalloc_ptr_char.c
index aa8a0dea39f..dccf14c0923 100644
--- a/gdb/unittests/unique_xmalloc_ptr_char.c
+++ b/gdb/unittests/unique_xmalloc_ptr_char.c
@@ -22,8 +22,10 @@
#include "selftest-arch.h"
#include "gdbsupport/gdb_unique_ptr.h"
-namespace selftests {
-namespace unpack {
+namespace selftests
+{
+namespace unpack
+{
static void
unique_xmalloc_ptr_char ()
@@ -45,10 +47,11 @@ unique_xmalloc_ptr_char ()
SELF_CHECK (str == "xxxabcdef");
}
-}
-}
+} // namespace unpack
+} // namespace selftests
void _initialize_unique_xmalloc_ptr_char ();
+
void
_initialize_unique_xmalloc_ptr_char ()
{
diff --git a/gdb/unittests/unpack-selftests.c b/gdb/unittests/unpack-selftests.c
index 51e8c3942b4..301b90cd728 100644
--- a/gdb/unittests/unpack-selftests.c
+++ b/gdb/unittests/unpack-selftests.c
@@ -24,16 +24,18 @@
#include "gdbtypes.h"
#include "arch-utils.h"
-namespace selftests {
-namespace unpack {
+namespace selftests
+{
+namespace unpack
+{
static void
unpack_field_as_long_tests (struct gdbarch *arch)
{
gdb_byte buffer[8];
const struct builtin_type *bt = builtin_type (arch);
- struct type *struct_type = arch_composite_type (arch, "<<selftest>>",
- TYPE_CODE_STRUCT);
+ struct type *struct_type
+ = arch_composite_type (arch, "<<selftest>>", TYPE_CODE_STRUCT);
append_composite_type_field (struct_type, "field0", bt->builtin_int8);
append_composite_type_field_aligned (struct_type, "field1",
@@ -50,13 +52,14 @@ unpack_field_as_long_tests (struct gdbarch *arch)
SELF_CHECK (unpack_field_as_long (struct_type, buffer, 1) == 23);
}
-}
-}
+} // namespace unpack
+} // namespace selftests
void _initialize_unpack_selftests ();
+
void
_initialize_unpack_selftests ()
{
- selftests::register_test_foreach_arch
- ("unpack_field_as_long", selftests::unpack::unpack_field_as_long_tests);
+ selftests::register_test_foreach_arch (
+ "unpack_field_as_long", selftests::unpack::unpack_field_as_long_tests);
}
diff --git a/gdb/unittests/utils-selftests.c b/gdb/unittests/utils-selftests.c
index 70609aa4294..a01bbc7a56a 100644
--- a/gdb/unittests/utils-selftests.c
+++ b/gdb/unittests/utils-selftests.c
@@ -21,20 +21,21 @@
#include "utils.h"
#include "gdbsupport/selftest.h"
-namespace selftests {
-namespace utils {
+namespace selftests
+{
+namespace utils
+{
static void
test_substitute_path_component ()
{
auto test = [] (std::string s, const char *from, const char *to,
- const char *expected)
- {
- char *temp = xstrdup (s.c_str ());
- substitute_path_component (&temp, from, to);
- SELF_CHECK (strcmp (temp, expected) == 0);
- xfree (temp);
- };
+ const char *expected) {
+ char *temp = xstrdup (s.c_str ());
+ substitute_path_component (&temp, from, to);
+ SELF_CHECK (strcmp (temp, expected) == 0);
+ xfree (temp);
+ };
test ("/abc/$def/g", "abc", "xyz", "/xyz/$def/g");
test ("abc/$def/g", "abc", "xyz", "xyz/$def/g");
@@ -48,10 +49,11 @@ test_substitute_path_component ()
test ("/abc/$def/abc", "abc", "xyz", "/xyz/$def/xyz");
}
-}
-}
+} // namespace utils
+} // namespace selftests
void _initialize_utils_selftests ();
+
void
_initialize_utils_selftests ()
{
diff --git a/gdb/unittests/vec-utils-selftests.c b/gdb/unittests/vec-utils-selftests.c
index 246631f9530..061d60ad9c1 100644
--- a/gdb/unittests/vec-utils-selftests.c
+++ b/gdb/unittests/vec-utils-selftests.c
@@ -22,8 +22,10 @@
#include "gdbsupport/gdb_vecs.h"
-namespace selftests {
-namespace vector_utils_tests {
+namespace selftests
+{
+namespace vector_utils_tests
+{
static void
unordered_remove_tests ()
@@ -38,19 +40,16 @@ unordered_remove_tests ()
{
std::vector<void *> var;
- obj() = default;
+ obj () = default;
/* gcc complains if we provide an assignment operator but no copy
constructor, so provide one even if don't really care for this test. */
- obj(const obj &other)
- {
- this->var = other.var;
- }
+ obj (const obj &other) { this->var = other.var; }
obj &operator= (const obj &other)
{
if (this == &other)
- error (_("detected self move assign"));
+ error (_ ("detected self move assign"));
this->var = other.var;
return *this;
}
@@ -64,13 +63,13 @@ unordered_remove_tests ()
}
} /* namespace vector_utils_tests */
-} /* amespace selftests */
+} // namespace selftests
void _initialize_vec_utils_selftests ();
+
void
_initialize_vec_utils_selftests ()
{
- selftests::register_test
- ("unordered_remove",
- selftests::vector_utils_tests::unordered_remove_tests);
+ selftests::register_test (
+ "unordered_remove", selftests::vector_utils_tests::unordered_remove_tests);
}
diff --git a/gdb/unittests/xml-utils-selftests.c b/gdb/unittests/xml-utils-selftests.c
index eefe2c64ed7..c1c054d2bf6 100644
--- a/gdb/unittests/xml-utils-selftests.c
+++ b/gdb/unittests/xml-utils-selftests.c
@@ -21,19 +21,24 @@
#include "gdbsupport/xml-utils.h"
#include "gdbsupport/selftest.h"
-namespace selftests {
-namespace xml_utils {
+namespace selftests
+{
+namespace xml_utils
+{
-static void test_xml_escape_text ()
+static void
+test_xml_escape_text ()
{
const char *input = "<this isn't=\"xml\"> &";
- const char *expected_output = "&lt;this isn&apos;t=&quot;xml&quot;&gt; &amp;";
+ const char *expected_output
+ = "&lt;this isn&apos;t=&quot;xml&quot;&gt; &amp;";
std::string actual_output = xml_escape_text (input);
SELF_CHECK (actual_output == expected_output);
}
-static void test_xml_escape_text_append ()
+static void
+test_xml_escape_text_append ()
{
/* Make sure that we do indeed append. */
std::string actual_output = "foo<xml>";
@@ -45,10 +50,11 @@ static void test_xml_escape_text_append ()
SELF_CHECK (actual_output == expected_output);
}
-}
-}
+} // namespace xml_utils
+} // namespace selftests
void _initialize_xml_utils ();
+
void
_initialize_xml_utils ()
{
diff --git a/gdb/user-regs.c b/gdb/user-regs.c
index 25c57d4886c..eaa8b9945e9 100644
--- a/gdb/user-regs.c
+++ b/gdb/user-regs.c
@@ -107,8 +107,7 @@ get_user_regs (struct gdbarch *gdbarch)
struct obstack *obstack = gdbarch_obstack (gdbarch);
regs->last = &regs->first;
- for (user_reg *reg = builtin_user_regs.first;
- reg != NULL;
+ for (user_reg *reg = builtin_user_regs.first; reg != NULL;
reg = reg->next)
append_user_reg (regs, reg->name, reg->xread, reg->baton,
OBSTACK_ZALLOC (obstack, struct user_reg));
@@ -229,11 +228,12 @@ maintenance_print_user_registers (const char *args, int from_tty)
}
void _initialize_user_regs ();
+
void
_initialize_user_regs ()
{
add_cmd ("user-registers", class_maintenance,
maintenance_print_user_registers,
- _("List the names of the current user registers."),
+ _ ("List the names of the current user registers."),
&maintenanceprintlist);
}
diff --git a/gdb/user-regs.h b/gdb/user-regs.h
index 3e936fc829c..fa248dbe016 100644
--- a/gdb/user-regs.h
+++ b/gdb/user-regs.h
@@ -61,12 +61,11 @@ typedef struct value *(user_reg_read_ftype) (frame_info_ptr frame,
extern struct value *value_of_user_reg (int regnum, frame_info_ptr frame);
/* Add a builtin register (present in all architectures). */
-extern void user_reg_add_builtin (const char *name,
- user_reg_read_ftype *read,
+extern void user_reg_add_builtin (const char *name, user_reg_read_ftype *read,
const void *baton);
/* Add a per-architecture frame register. */
-extern void user_reg_add (struct gdbarch *gdbarch, const char *name,
+extern void user_reg_add (struct gdbarch *gdbarch, const char *name,
user_reg_read_ftype *read, const void *baton);
#endif
diff --git a/gdb/utils.c b/gdb/utils.c
index 95adbe58e4a..1904a98a15c 100644
--- a/gdb/utils.c
+++ b/gdb/utils.c
@@ -55,7 +55,7 @@
#include "main.h"
#include "solist.h"
-#include "inferior.h" /* for signed_pointer_to_address */
+#include "inferior.h" /* for signed_pointer_to_address */
#include "gdb_curses.h"
@@ -105,12 +105,14 @@ bool debug_timestamp = false;
international character, and the terminal or window can cope.) */
bool sevenbit_strings = false;
+
static void
show_sevenbit_strings (struct ui_file *file, int from_tty,
struct cmd_list_element *c, const char *value)
{
- gdb_printf (file, _("Printing of 8-bit characters "
- "in strings as \\nnn is %s.\n"),
+ gdb_printf (file,
+ _ ("Printing of 8-bit characters "
+ "in strings as \\nnn is %s.\n"),
value);
}
@@ -119,16 +121,14 @@ show_sevenbit_strings (struct ui_file *file, int from_tty,
const char *warning_pre_print = "\nwarning: ";
bool pagination_enabled = true;
+
static void
show_pagination_enabled (struct ui_file *file, int from_tty,
struct cmd_list_element *c, const char *value)
{
- gdb_printf (file, _("State of pagination is %s.\n"), value);
+ gdb_printf (file, _ ("State of pagination is %s.\n"), value);
}
-
-
-
/* Print a warning message. The first argument STRING is the warning
message, used as an fprintf format string, the second is the
va_list of arguments for that string. A warning is unfiltered (not
@@ -181,7 +181,7 @@ abort_with_message (const char *msg)
else
gdb_puts (msg, gdb_stderr);
- abort (); /* ARI: abort */
+ abort (); /* ARI: abort */
}
/* Dump core trying to increase the core soft limit to hard limit first. */
@@ -200,7 +200,7 @@ dump_core (void)
a backtrace to the console here. */
signal (SIGABRT, SIG_DFL);
- abort (); /* ARI: abort */
+ abort (); /* ARI: abort */
}
/* Check whether GDB will be able to dump core using the dump_core
@@ -240,8 +240,8 @@ void
warn_cant_dump_core (const char *reason)
{
gdb_printf (gdb_stderr,
- _("%s\nUnable to dump core, use `ulimit -c"
- " unlimited' before executing GDB next time.\n"),
+ _ ("%s\nUnable to dump core, use `ulimit -c"
+ " unlimited' before executing GDB next time.\n"),
reason);
}
@@ -249,8 +249,7 @@ warn_cant_dump_core (const char *reason)
function, and print a warning if we cannot. */
static int
-can_dump_core_warn (enum resource_limit_kind limit_kind,
- const char *reason)
+can_dump_core_warn (enum resource_limit_kind limit_kind, const char *reason)
{
int core_dump_allowed = can_dump_core (limit_kind);
@@ -266,13 +265,8 @@ can_dump_core_warn (enum resource_limit_kind limit_kind,
const char internal_problem_ask[] = "ask";
const char internal_problem_yes[] = "yes";
const char internal_problem_no[] = "no";
-static const char *const internal_problem_modes[] =
-{
- internal_problem_ask,
- internal_problem_yes,
- internal_problem_no,
- NULL
-};
+static const char *const internal_problem_modes[]
+ = { internal_problem_ask, internal_problem_yes, internal_problem_no, NULL };
/* Data structure used to control how the internal_vproblem function
should behave. An instance of this structure is created for each
@@ -322,8 +316,8 @@ readline_initialized (struct ui *ui)
either allow execution to resume or throw an error. */
static void ATTRIBUTE_PRINTF (4, 0)
-internal_vproblem (struct internal_problem *problem,
- const char *file, int line, const char *fmt, va_list ap)
+ internal_vproblem (struct internal_problem *problem, const char *file,
+ int line, const char *fmt, va_list ap)
{
static int dejavu;
int quit_p;
@@ -390,11 +384,9 @@ internal_vproblem (struct internal_problem *problem,
begin_line ();
/* Emit the message unless query will emit it below. */
- if (problem->should_quit != internal_problem_ask
- || !confirm
+ if (problem->should_quit != internal_problem_ask || !confirm
|| !filtered_printing_initialized ()
- || !readline_initialized (current_ui)
- || problem->should_print_backtrace)
+ || !readline_initialized (current_ui) || problem->should_print_backtrace)
gdb_printf (gdb_stderr, "%s\n", reason.c_str ());
if (problem->should_print_backtrace)
@@ -409,21 +401,20 @@ internal_vproblem (struct internal_problem *problem,
|| !readline_initialized (current_ui))
quit_p = 1;
else
- quit_p = query (_("%s\nQuit this debugging session? "),
- reason.c_str ());
+ quit_p
+ = query (_ ("%s\nQuit this debugging session? "), reason.c_str ());
}
else if (problem->should_quit == internal_problem_yes)
quit_p = 1;
else if (problem->should_quit == internal_problem_no)
quit_p = 0;
else
- internal_error (_("bad switch"));
+ internal_error (_ ("bad switch"));
- gdb_puts (_("\nThis is a bug, please report it."), gdb_stderr);
+ gdb_puts (_ ("\nThis is a bug, please report it."), gdb_stderr);
if (REPORT_BUGS_TO[0])
- gdb_printf (gdb_stderr, _(" For instructions, see:\n%ps."),
- styled_string (file_name_style.style (),
- REPORT_BUGS_TO));
+ gdb_printf (gdb_stderr, _ (" For instructions, see:\n%ps."),
+ styled_string (file_name_style.style (), REPORT_BUGS_TO));
gdb_puts ("\n\n", gdb_stderr);
if (problem->should_dump_core == internal_problem_ask)
@@ -438,8 +429,8 @@ internal_vproblem (struct internal_problem *problem,
/* Default (yes/batch case) is to dump core. This leaves a GDB
`dropping' so that it is easier to see that something went
wrong in GDB. */
- dump_core_p = query (_("%s\nCreate a core file of GDB? "),
- reason.c_str ());
+ dump_core_p
+ = query (_ ("%s\nCreate a core file of GDB? "), reason.c_str ());
}
}
else if (problem->should_dump_core == internal_problem_yes)
@@ -447,7 +438,7 @@ internal_vproblem (struct internal_problem *problem,
else if (problem->should_dump_core == internal_problem_no)
dump_core_p = 0;
else
- internal_error (_("bad switch"));
+ internal_error (_ ("bad switch"));
if (quit_p)
{
@@ -470,22 +461,30 @@ internal_vproblem (struct internal_problem *problem,
dejavu = 0;
}
-static struct internal_problem internal_error_problem = {
- "internal-error", true, internal_problem_ask, true, internal_problem_ask,
- true, GDB_PRINT_INTERNAL_BACKTRACE_INIT_ON
-};
+static struct internal_problem internal_error_problem
+ = { "internal-error",
+ true,
+ internal_problem_ask,
+ true,
+ internal_problem_ask,
+ true,
+ GDB_PRINT_INTERNAL_BACKTRACE_INIT_ON };
void
internal_verror (const char *file, int line, const char *fmt, va_list ap)
{
internal_vproblem (&internal_error_problem, file, line, fmt, ap);
- throw_quit (_("Command aborted."));
+ throw_quit (_ ("Command aborted."));
}
-static struct internal_problem internal_warning_problem = {
- "internal-warning", true, internal_problem_ask, true, internal_problem_ask,
- true, false
-};
+static struct internal_problem internal_warning_problem
+ = { "internal-warning",
+ true,
+ internal_problem_ask,
+ true,
+ internal_problem_ask,
+ true,
+ false };
void
internal_vwarning (const char *file, int line, const char *fmt, va_list ap)
@@ -493,10 +492,14 @@ internal_vwarning (const char *file, int line, const char *fmt, va_list ap)
internal_vproblem (&internal_warning_problem, file, line, fmt, ap);
}
-static struct internal_problem demangler_warning_problem = {
- "demangler-warning", true, internal_problem_ask, false, internal_problem_no,
- false, false
-};
+static struct internal_problem demangler_warning_problem
+ = { "demangler-warning",
+ true,
+ internal_problem_ask,
+ false,
+ internal_problem_no,
+ false,
+ false };
void
demangler_vwarning (const char *file, int line, const char *fmt, va_list ap)
@@ -544,73 +547,71 @@ add_internal_problem_command (struct internal_problem *problem)
ownership of the string passed in, which is why we don't need to free
set_doc and show_doc in this function. */
const char *set_doc
- = xstrprintf (_("Configure what GDB does when %s is detected."),
- problem->name).release ();
+ = xstrprintf (_ ("Configure what GDB does when %s is detected."),
+ problem->name)
+ .release ();
const char *show_doc
- = xstrprintf (_("Show what GDB does when %s is detected."),
- problem->name).release ();
+ = xstrprintf (_ ("Show what GDB does when %s is detected."), problem->name)
+ .release ();
- add_setshow_prefix_cmd (problem->name, class_maintenance,
- set_doc, show_doc, set_cmd_list, show_cmd_list,
+ add_setshow_prefix_cmd (problem->name, class_maintenance, set_doc, show_doc,
+ set_cmd_list, show_cmd_list,
&maintenance_set_cmdlist, &maintenance_show_cmdlist);
if (problem->user_settable_should_quit)
{
std::string set_quit_doc
- = string_printf (_("Set whether GDB should quit when an %s is "
- "detected."), problem->name);
+ = string_printf (_ ("Set whether GDB should quit when an %s is "
+ "detected."),
+ problem->name);
std::string show_quit_doc
- = string_printf (_("Show whether GDB will quit when an %s is "
- "detected."), problem->name);
- add_setshow_enum_cmd ("quit", class_maintenance,
- internal_problem_modes,
- &problem->should_quit,
- set_quit_doc.c_str (),
- show_quit_doc.c_str (),
- NULL, /* help_doc */
- NULL, /* setfunc */
- NULL, /* showfunc */
- set_cmd_list,
- show_cmd_list);
+ = string_printf (_ ("Show whether GDB will quit when an %s is "
+ "detected."),
+ problem->name);
+ add_setshow_enum_cmd ("quit", class_maintenance, internal_problem_modes,
+ &problem->should_quit, set_quit_doc.c_str (),
+ show_quit_doc.c_str (), NULL, /* help_doc */
+ NULL, /* setfunc */
+ NULL, /* showfunc */
+ set_cmd_list, show_cmd_list);
}
if (problem->user_settable_should_dump_core)
{
std::string set_core_doc
- = string_printf (_("Set whether GDB should create a core file of "
- "GDB when %s is detected."), problem->name);
+ = string_printf (_ ("Set whether GDB should create a core file of "
+ "GDB when %s is detected."),
+ problem->name);
std::string show_core_doc
- = string_printf (_("Show whether GDB will create a core file of "
- "GDB when %s is detected."), problem->name);
+ = string_printf (_ ("Show whether GDB will create a core file of "
+ "GDB when %s is detected."),
+ problem->name);
add_setshow_enum_cmd ("corefile", class_maintenance,
- internal_problem_modes,
- &problem->should_dump_core,
- set_core_doc.c_str (),
- show_core_doc.c_str (),
+ internal_problem_modes, &problem->should_dump_core,
+ set_core_doc.c_str (), show_core_doc.c_str (),
NULL, /* help_doc */
NULL, /* setfunc */
NULL, /* showfunc */
- set_cmd_list,
- show_cmd_list);
+ set_cmd_list, show_cmd_list);
}
if (problem->user_settable_should_print_backtrace)
{
std::string set_bt_doc
- = string_printf (_("Set whether GDB should print a backtrace of "
- "GDB when %s is detected."), problem->name);
+ = string_printf (_ ("Set whether GDB should print a backtrace of "
+ "GDB when %s is detected."),
+ problem->name);
std::string show_bt_doc
- = string_printf (_("Show whether GDB will print a backtrace of "
- "GDB when %s is detected."), problem->name);
+ = string_printf (_ ("Show whether GDB will print a backtrace of "
+ "GDB when %s is detected."),
+ problem->name);
add_setshow_boolean_cmd ("backtrace", class_maintenance,
&problem->should_print_backtrace,
- set_bt_doc.c_str (),
- show_bt_doc.c_str (),
+ set_bt_doc.c_str (), show_bt_doc.c_str (),
NULL, /* help_doc */
gdb_internal_backtrace_set_cmd,
NULL, /* showfunc */
- set_cmd_list,
- show_cmd_list);
+ set_cmd_list, show_cmd_list);
}
}
@@ -639,7 +640,7 @@ throw_perror_with_name (enum errors errcode, const char *string)
bfd_set_error (bfd_error_no_error);
errno = 0;
- throw_error (errcode, _("%s."), combined.c_str ());
+ throw_error (errcode, _ ("%s."), combined.c_str ());
}
/* See throw_perror_with_name, ERRCODE defaults here to GENERIC_ERROR. */
@@ -657,7 +658,7 @@ void
perror_warning_with_name (const char *string)
{
std::string combined = perror_string (string);
- warning (_("%s"), combined.c_str ());
+ warning (_ ("%s"), combined.c_str ());
}
/* Print the system error message for ERRCODE, and also mention STRING
@@ -710,7 +711,6 @@ maybe_quit (void)
quit_handler ();
}
-
/* Called when a memory allocation fails, with the number of bytes of
memory requested in SIZE. */
@@ -719,12 +719,12 @@ malloc_failure (long size)
{
if (size > 0)
{
- internal_error (_("virtual memory exhausted: can't allocate %ld bytes."),
- size);
+ internal_error (
+ _ ("virtual memory exhausted: can't allocate %ld bytes."), size);
}
else
{
- internal_error (_("virtual memory exhausted."));
+ internal_error (_ ("virtual memory exhausted."));
}
}
@@ -767,7 +767,7 @@ uinteger_pow (ULONGEST v1, LONGEST v2)
if (v2 < 0)
{
if (v1 == 0)
- error (_("Attempt to raise 0 to negative power."));
+ error (_ ("Attempt to raise 0 to negative power."));
else
return 0;
}
@@ -789,8 +789,6 @@ uinteger_pow (ULONGEST v1, LONGEST v2)
}
}
-
-
/* An RAII class that sets up to handle input and then tears down
during destruction. */
@@ -828,8 +826,6 @@ private:
struct ui *m_ui;
};
-
-
/* This function supports the query, nquery, and yquery functions.
Ask user a y-or-n question and return 0 if answer is no, 1 if
answer is yes, or default the answer to the specified default
@@ -841,7 +837,7 @@ private:
printf. */
static int ATTRIBUTE_PRINTF (1, 0)
-defaulted_query (const char *ctlstr, const char defchar, va_list args)
+ defaulted_query (const char *ctlstr, const char defchar, va_list args)
{
int retval;
int def_value;
@@ -893,8 +889,8 @@ defaulted_query (const char *ctlstr, const char defchar, va_list args)
gdb_stdout->wrap_here (0);
gdb_vprintf (gdb_stdout, ctlstr, args);
- gdb_printf (_("(%s or %s) [answered %c; "
- "input not from terminal]\n"),
+ gdb_printf (_ ("(%s or %s) [answered %c; "
+ "input not from terminal]\n"),
y_string, n_string, def_answer);
return def_value;
@@ -909,7 +905,7 @@ defaulted_query (const char *ctlstr, const char defchar, va_list args)
/* Format the question outside of the loop, to avoid reusing args. */
std::string question = string_vprintf (ctlstr, args);
std::string prompt
- = string_printf (_("%s%s(%s or %s) %s"),
+ = string_printf (_ ("%s%s(%s or %s) %s"),
annotation_level > 1 ? "\n\032\032pre-query\n" : "",
question.c_str (), y_string, n_string,
annotation_level > 1 ? "\n\032\032query\n" : "");
@@ -928,7 +924,7 @@ defaulted_query (const char *ctlstr, const char defchar, va_list args)
gdb_flush (gdb_stdout);
response = gdb_readline_wrapper (prompt.c_str ());
- if (response == NULL) /* C-d */
+ if (response == NULL) /* C-d */
{
gdb_printf ("EOF [assumed %c]\n", def_answer);
retval = def_value;
@@ -950,15 +946,13 @@ defaulted_query (const char *ctlstr, const char defchar, va_list args)
/* Otherwise, if a default was specified, the user may either
specify the required input or have it default by entering
nothing. */
- if (answer == def_answer
- || (defchar != '\0' && answer == '\0'))
+ if (answer == def_answer || (defchar != '\0' && answer == '\0'))
{
retval = def_value;
break;
}
/* Invalid entries are not defaulted and require another selection. */
- gdb_printf (_("Please answer %s or %s.\n"),
- y_string, n_string);
+ gdb_printf (_ ("Please answer %s or %s.\n"), y_string, n_string);
}
/* Add time spend in this routine to prompt_for_continue_wait_time. */
@@ -968,7 +962,6 @@ defaulted_query (const char *ctlstr, const char defchar, va_list args)
gdb_printf (("\n\032\032post-query\n"));
return retval;
}
-
/* Ask user a y-or-n question and return 0 if answer is no, 1 if
answer is yes, or 0 if answer is defaulted.
@@ -1037,8 +1030,8 @@ host_char_to_target (struct gdbarch *gdbarch, int c, int *target_c)
auto_obstack host_data;
convert_between_encodings (target_charset (gdbarch), host_charset (),
- (gdb_byte *) &the_char, 1, 1,
- &host_data, translit_none);
+ (gdb_byte *) &the_char, 1, 1, &host_data,
+ translit_none);
if (obstack_object_size (&host_data) == 1)
{
@@ -1067,44 +1060,44 @@ host_char_to_target (struct gdbarch *gdbarch, int c, int *target_c)
int
parse_escape (struct gdbarch *gdbarch, const char **string_ptr)
{
- int target_char = -2; /* Initialize to avoid GCC warnings. */
+ int target_char = -2; /* Initialize to avoid GCC warnings. */
int c = *(*string_ptr)++;
switch (c)
{
- case '\n':
- return -2;
- case 0:
- (*string_ptr)--;
- return 0;
-
- case '0':
- case '1':
- case '2':
- case '3':
- case '4':
- case '5':
- case '6':
- case '7':
- {
- int i = fromhex (c);
- int count = 0;
- while (++count < 3)
- {
- c = (**string_ptr);
- if (ISDIGIT (c) && c != '8' && c != '9')
- {
- (*string_ptr)++;
- i *= 8;
- i += fromhex (c);
- }
- else
- {
- break;
- }
- }
- return i;
- }
+ case '\n':
+ return -2;
+ case 0:
+ (*string_ptr)--;
+ return 0;
+
+ case '0':
+ case '1':
+ case '2':
+ case '3':
+ case '4':
+ case '5':
+ case '6':
+ case '7':
+ {
+ int i = fromhex (c);
+ int count = 0;
+ while (++count < 3)
+ {
+ c = (**string_ptr);
+ if (ISDIGIT (c) && c != '8' && c != '9')
+ {
+ (*string_ptr)++;
+ i *= 8;
+ i += fromhex (c);
+ }
+ else
+ {
+ break;
+ }
+ }
+ return i;
+ }
case 'a':
c = '\a';
@@ -1133,33 +1126,33 @@ parse_escape (struct gdbarch *gdbarch, const char **string_ptr)
}
if (!host_char_to_target (gdbarch, c, &target_char))
- error (_("The escape sequence `\\%c' is equivalent to plain `%c',"
- " which has no equivalent\nin the `%s' character set."),
+ error (_ ("The escape sequence `\\%c' is equivalent to plain `%c',"
+ " which has no equivalent\nin the `%s' character set."),
c, c, target_charset (gdbarch));
return target_char;
}
-
/* Number of lines per page or UINT_MAX if paging is disabled. */
static unsigned int lines_per_page;
+
static void
show_lines_per_page (struct ui_file *file, int from_tty,
struct cmd_list_element *c, const char *value)
{
- gdb_printf (file,
- _("Number of lines gdb thinks are in a page is %s.\n"),
+ gdb_printf (file, _ ("Number of lines gdb thinks are in a page is %s.\n"),
value);
}
/* Number of chars per line or UINT_MAX if line folding is disabled. */
static unsigned int chars_per_line;
+
static void
show_chars_per_line (struct ui_file *file, int from_tty,
struct cmd_list_element *c, const char *value)
{
gdb_printf (file,
- _("Number of characters gdb thinks "
- "are in a line is %s.\n"),
+ _ ("Number of characters gdb thinks "
+ "are in a line is %s.\n"),
value);
}
@@ -1180,8 +1173,6 @@ static bool pagination_disabled_for_command;
static bool filter_initialized = false;
-
-
/* Initialize the number of lines per page and chars per line. */
void
@@ -1194,7 +1185,7 @@ init_page_info (void)
}
else
#if defined(TUI)
- if (!tui_get_command_dimension (&chars_per_line, &lines_per_page))
+ if (!tui_get_command_dimension (&chars_per_line, &lines_per_page))
#endif
{
int rows, cols;
@@ -1217,7 +1208,7 @@ init_page_info (void)
Only try to use tgetnum function if rl_get_screen_size
did not return a useful value. */
if (((rows <= 0) && (tgetnum ((char *) "li") < 0))
- /* Also disable paging if inside Emacs. $EMACS was used
+ /* Also disable paging if inside Emacs. $EMACS was used
before Emacs v25.1, $INSIDE_EMACS is used since then. */
|| getenv ("EMACS") || getenv ("INSIDE_EMACS"))
{
@@ -1387,9 +1378,8 @@ pager_file::prompt_for_continue ()
if (annotation_level > 1)
m_stream->puts (("\n\032\032pre-prompt-for-continue\n"));
- strcpy (cont_prompt,
- "--Type <RET> for more, q to quit, "
- "c to continue without paging--");
+ strcpy (cont_prompt, "--Type <RET> for more, q to quit, "
+ "c to continue without paging--");
if (annotation_level > 1)
strcat (cont_prompt, "\n\032\032prompt-for-continue\n");
@@ -1428,7 +1418,7 @@ pager_file::prompt_for_continue ()
reinitialize_more_filter ();
pagination_disabled_for_command = disable_pagination;
- dont_repeat (); /* Forget prev cmd -- CR won't repeat it. */
+ dont_repeat (); /* Forget prev cmd -- CR won't repeat it. */
}
/* Initialize timer to keep track of how long we waited for the user. */
@@ -1501,7 +1491,7 @@ pager_file::wrap_here (int indent)
gdb_assert (filter_initialized);
flush_wrap_buffer ();
- if (chars_per_line == UINT_MAX) /* No line overflow checking. */
+ if (chars_per_line == UINT_MAX) /* No line overflow checking. */
{
m_wrap_column = 0;
}
@@ -1563,7 +1553,6 @@ puts_tabular (char *string, int width, int right)
gdb_puts (string);
}
-
/* Ensure that whatever gets printed next, using the filtered output
commands, starts at the beginning of the line. I.e. if there is
any pending output for the current line, flush it and start a new
@@ -1587,8 +1576,7 @@ pager_file::puts (const char *linebuffer)
return;
/* Don't do any filtering or wrapping if both are disabled. */
- if (batch_flag
- || (lines_per_page == UINT_MAX && chars_per_line == UINT_MAX)
+ if (batch_flag || (lines_per_page == UINT_MAX && chars_per_line == UINT_MAX)
|| top_level_interpreter () == NULL
|| top_level_interpreter ()->interp_ui_out ()->is_mi_like_p ())
{
@@ -1597,19 +1585,16 @@ pager_file::puts (const char *linebuffer)
return;
}
- auto buffer_clearer
- = make_scope_exit ([&] ()
- {
- m_wrap_buffer.clear ();
- m_wrap_column = 0;
- m_wrap_indent = 0;
- });
+ auto buffer_clearer = make_scope_exit ([&] () {
+ m_wrap_buffer.clear ();
+ m_wrap_column = 0;
+ m_wrap_indent = 0;
+ });
/* If the user does "set height 1" then the pager will exhibit weird
behavior. This is pathological, though, so don't allow it. */
- const unsigned int lines_allowed = (lines_per_page > 1
- ? lines_per_page - 1
- : 1);
+ const unsigned int lines_allowed
+ = (lines_per_page > 1 ? lines_per_page - 1 : 1);
/* Go through and output each character. Show line extension
when this is necessary; prompt user for new page when this is
@@ -1621,8 +1606,7 @@ pager_file::puts (const char *linebuffer)
/* Possible new page. Note that PAGINATION_DISABLED_FOR_COMMAND
might be set during this loop, so we must continue to check
it here. */
- if (pagination_enabled
- && !pagination_disabled_for_command
+ if (pagination_enabled && !pagination_disabled_for_command
&& lines_printed >= lines_allowed)
prompt_for_continue ();
@@ -1698,8 +1682,7 @@ pager_file::puts (const char *linebuffer)
/* Possible new page. Note that
PAGINATION_DISABLED_FOR_COMMAND might be set during
this loop, so we must continue to check it here. */
- if (pagination_enabled
- && !pagination_disabled_for_command
+ if (pagination_enabled && !pagination_disabled_for_command
&& lines_printed >= lines_allowed)
{
prompt_for_continue ();
@@ -1725,7 +1708,7 @@ pager_file::puts (const char *linebuffer)
/* Note that this can set chars_printed > chars_per_line
if we are printing a long string. */
chars_printed = m_wrap_indent + (save_chars - m_wrap_column);
- m_wrap_column = 0; /* And disable fancy wrap */
+ m_wrap_column = 0; /* And disable fancy wrap */
}
else if (did_paginate)
m_stream->emit_style_escape (save_style);
@@ -1770,15 +1753,11 @@ test_pager ()
= make_scoped_restore (&pagination_enabled, false);
scoped_restore save_disabled
= make_scoped_restore (&pagination_disabled_for_command, false);
- scoped_restore save_batch
- = make_scoped_restore (&batch_flag, false);
- scoped_restore save_lines
- = make_scoped_restore (&lines_per_page, 50);
+ scoped_restore save_batch = make_scoped_restore (&batch_flag, false);
+ scoped_restore save_lines = make_scoped_restore (&lines_per_page, 50);
/* Make it easy to word wrap. */
- scoped_restore save_chars
- = make_scoped_restore (&chars_per_line, 15);
- scoped_restore save_printed
- = make_scoped_restore (&chars_printed, 0);
+ scoped_restore save_chars = make_scoped_restore (&chars_per_line, 15);
+ scoped_restore save_printed = make_scoped_restore (&chars_printed, 0);
pager.puts ("aaaaaaaaaaaa");
pager.wrap_here (2);
@@ -1901,7 +1880,6 @@ gdb_printf (const char *format, ...)
va_end (args);
}
-
void
printf_unfiltered (const char *format, ...)
{
@@ -1953,7 +1931,7 @@ print_spaces (int n, struct ui_file *stream)
{
gdb_puts (n_spaces (n), stream);
}
-
+
/* C++/ObjC demangler stuff. */
/* fprintf_symbol attempts to demangle NAME, a symbol in language
@@ -1962,8 +1940,8 @@ print_spaces (int n, struct ui_file *stream)
demangling is off, the name is printed in its "raw" form. */
void
-fprintf_symbol (struct ui_file *stream, const char *name,
- enum language lang, int arg_mode)
+fprintf_symbol (struct ui_file *stream, const char *name, enum language lang,
+ int arg_mode)
{
if (name != NULL)
{
@@ -2010,25 +1988,12 @@ cp_skip_operator_token (const char *token, const char *end)
/* Note, ordered such that among ops that share a prefix,
longer comes first. This is so that the loop below can
bail on first match. */
- static const char *ops[] =
- {
- "[",
- "]",
- "~",
- ",",
- "-=", "--", "->", "-",
- "+=", "++", "+",
- "*=", "*",
- "/=", "/",
- "%=", "%",
- "|=", "||", "|",
- "&=", "&&", "&",
- "^=", "^",
- "!=", "!",
- "<<=", "<=", "<<", "<",
- ">>=", ">=", ">>", ">",
- "==", "=",
- };
+ static const char *ops[] = {
+ "[", "]", "~", ",", "-=", "--", "->", "-", "+=", "++",
+ "+", "*=", "*", "/=", "/", "%=", "%", "|=", "||", "|",
+ "&=", "&&", "&", "^=", "^", "!=", "!", "<<=", "<=", "<<",
+ "<", ">>=", ">=", ">>", ">", "==", "=",
+ };
for (const char *op : ops)
{
@@ -2064,8 +2029,7 @@ skip_ws (const char *&string1, const char *&string2, const char *end_str2)
static bool
cp_is_operator (const char *string, const char *start)
{
- return ((string == start
- || !valid_identifier_name_char (string[-1]))
+ return ((string == start || !valid_identifier_name_char (string[-1]))
&& strncmp (string, CP_OPERATOR_STR, CP_OPERATOR_LEN) == 0
&& !valid_identifier_name_char (string[CP_OPERATOR_LEN]));
}
@@ -2140,15 +2104,15 @@ strncmp_iw_with_mode (const char *string1, const char *string2,
const char *string1_start = string1;
const char *end_str2 = string2 + string2_len;
bool skip_spaces = true;
- bool have_colon_op = (language == language_cplus
- || language == language_rust
+ bool have_colon_op = (language == language_cplus || language == language_rust
|| language == language_fortran);
while (1)
{
if (skip_spaces
|| ((ISSPACE (*string1) && !valid_identifier_name_char (*string2))
- || (ISSPACE (*string2) && !valid_identifier_name_char (*string1))))
+ || (ISSPACE (*string2)
+ && !valid_identifier_name_char (*string1))))
{
skip_ws (string1, string2, end_str2);
skip_spaces = false;
@@ -2221,8 +2185,8 @@ strncmp_iw_with_mode (const char *string1, const char *string2,
{
/* Don't mark the parameter list ignored if the user didn't
try to ignore it. [Case #5 above] */
- if (*string2 != '\0'
- && match_for_lcd != NULL && template_start != string1)
+ if (*string2 != '\0' && match_for_lcd != NULL
+ && template_start != string1)
match_for_lcd->mark_ignored_range (template_start, string1);
}
}
@@ -2256,8 +2220,7 @@ strncmp_iw_with_mode (const char *string1, const char *string2,
}
/* Handle C++ user-defined operators. */
- else if (language == language_cplus
- && *string1 == 'o')
+ else if (language == language_cplus && *string1 == 'o')
{
if (cp_is_operator (string1, string1_start))
{
@@ -2412,26 +2375,26 @@ strncmp_iw_with_mode (const char *string1, const char *string2,
/* Unit tests for strncmp_iw_with_mode. */
-#define CHECK_MATCH_LM(S1, S2, MODE, LANG, LCD) \
- SELF_CHECK (strncmp_iw_with_mode ((S1), (S2), strlen ((S2)), \
- strncmp_iw_mode::MODE, \
- (LANG), (LCD)) == 0)
+#define CHECK_MATCH_LM(S1, S2, MODE, LANG, LCD) \
+ SELF_CHECK (strncmp_iw_with_mode ((S1), (S2), strlen ((S2)), \
+ strncmp_iw_mode::MODE, (LANG), (LCD)) \
+ == 0)
-#define CHECK_MATCH_LANG(S1, S2, MODE, LANG) \
+#define CHECK_MATCH_LANG(S1, S2, MODE, LANG) \
CHECK_MATCH_LM ((S1), (S2), MODE, (LANG), nullptr)
-#define CHECK_MATCH(S1, S2, MODE) \
+#define CHECK_MATCH(S1, S2, MODE) \
CHECK_MATCH_LANG ((S1), (S2), MODE, language_minimal)
-#define CHECK_NO_MATCH_LM(S1, S2, MODE, LANG, LCD) \
- SELF_CHECK (strncmp_iw_with_mode ((S1), (S2), strlen ((S2)), \
- strncmp_iw_mode::MODE, \
- (LANG)) != 0)
+#define CHECK_NO_MATCH_LM(S1, S2, MODE, LANG, LCD) \
+ SELF_CHECK (strncmp_iw_with_mode ((S1), (S2), strlen ((S2)), \
+ strncmp_iw_mode::MODE, (LANG)) \
+ != 0)
-#define CHECK_NO_MATCH_LANG(S1, S2, MODE, LANG) \
+#define CHECK_NO_MATCH_LANG(S1, S2, MODE, LANG) \
CHECK_NO_MATCH_LM ((S1), (S2), MODE, (LANG), nullptr)
-#define CHECK_NO_MATCH(S1, S2, MODE) \
+#define CHECK_NO_MATCH(S1, S2, MODE) \
CHECK_NO_MATCH_LANG ((S1), (S2), MODE, language_minimal)
static void
@@ -2483,11 +2446,11 @@ check_scope_operator (enum language lang)
CHECK_MATCH_LANG (" \ta:: \tb:: \tc", "a::b::c", NORMAL, lang);
CHECK_MATCH_LANG ("\t a::\t b::\t c", "a::b::c", NORMAL, lang);
CHECK_MATCH_LANG ("a :: b:: c\t", "\ta :: b\t:: c\t\t", NORMAL, lang);
- CHECK_MATCH_LANG (" a::\t \t b:: c\t", "\ta ::b:: c\t\t",
- NORMAL, lang);
- CHECK_MATCH_LANG ("a :: b :: \t\t\tc\t",
- "\t\t\t\ta :: \t\t\t b \t\t::c",
- NORMAL, lang);
+ CHECK_MATCH_LANG (" a::\t \t b:: c\t", "\ta ::b:: c\t\t", NORMAL,
+ lang);
+ CHECK_MATCH_LANG (
+ "a :: b :: \t\t\tc\t",
+ "\t\t\t\ta :: \t\t\t b \t\t::c", NORMAL, lang);
CHECK_MATCH_LANG ("a::b()", "a", NORMAL, lang);
CHECK_MATCH_LANG ("a::b()", "a::", NORMAL, lang);
CHECK_MATCH_LANG ("a::b()", "a::b", NORMAL, lang);
@@ -2700,10 +2663,10 @@ strncmp_iw_with_mode_tests ()
CHECK_MATCH_LANG ("a::operator foo(int&)", "a::operator foo(int &)", NORMAL,
language_cplus);
- CHECK_MATCH_LANG ("a :: operator foo(int &)", "a::operator foo(int &)", NORMAL,
- language_cplus);
- CHECK_MATCH_LANG ("a \t:: \toperator foo(int\t&)", "a::operator foo(int\t&)", NORMAL,
- language_cplus);
+ CHECK_MATCH_LANG ("a :: operator foo(int &)", "a::operator foo(int &)",
+ NORMAL, language_cplus);
+ CHECK_MATCH_LANG ("a \t:: \toperator foo(int\t&)", "a::operator foo(int\t&)",
+ NORMAL, language_cplus);
CHECK_MATCH_LANG ("a::operator foo (int)", "a::operator foo(int)", NORMAL,
language_cplus);
CHECK_MATCH_LANG ("a::operator foo\t(int)", "a::operator foo(int)", NORMAL,
@@ -2712,10 +2675,10 @@ strncmp_iw_with_mode_tests ()
language_cplus);
CHECK_MATCH_LANG ("a::operator foo (int)", "a::operator foo \t(int)", NORMAL,
language_cplus);
- CHECK_MATCH_LANG ("a::operator foo\t(int)", "a::operator foo \t(int)", NORMAL,
- language_cplus);
- CHECK_MATCH_LANG ("a::operator foo \t(int)", "a::operator foo \t(int)", NORMAL,
- language_cplus);
+ CHECK_MATCH_LANG ("a::operator foo\t(int)", "a::operator foo \t(int)",
+ NORMAL, language_cplus);
+ CHECK_MATCH_LANG ("a::operator foo \t(int)", "a::operator foo \t(int)",
+ NORMAL, language_cplus);
CHECK_NO_MATCH_LANG ("operator foo(int)", "operator foo(char)", NORMAL,
language_cplus);
@@ -2723,19 +2686,19 @@ strncmp_iw_with_mode_tests ()
language_cplus);
CHECK_NO_MATCH_LANG ("operator foo(int)", "operator foo(int &)", NORMAL,
language_cplus);
- CHECK_NO_MATCH_LANG ("operator foo(int)", "operator foo(int, char *)", NORMAL,
- language_cplus);
+ CHECK_NO_MATCH_LANG ("operator foo(int)", "operator foo(int, char *)",
+ NORMAL, language_cplus);
CHECK_NO_MATCH_LANG ("operator foo(int)", "operator bar(int)", NORMAL,
language_cplus);
- CHECK_NO_MATCH_LANG ("a::operator b::foo(int)", "a::operator a::foo(char)", NORMAL,
- language_cplus);
- CHECK_NO_MATCH_LANG ("a::operator foo(int)", "a::operator foo(int *)", NORMAL,
- language_cplus);
- CHECK_NO_MATCH_LANG ("a::operator foo(int)", "a::operator foo(int &)", NORMAL,
- language_cplus);
- CHECK_NO_MATCH_LANG ("a::operator foo(int)", "a::operator foo(int, char *)", NORMAL,
- language_cplus);
+ CHECK_NO_MATCH_LANG ("a::operator b::foo(int)", "a::operator a::foo(char)",
+ NORMAL, language_cplus);
+ CHECK_NO_MATCH_LANG ("a::operator foo(int)", "a::operator foo(int *)",
+ NORMAL, language_cplus);
+ CHECK_NO_MATCH_LANG ("a::operator foo(int)", "a::operator foo(int &)",
+ NORMAL, language_cplus);
+ CHECK_NO_MATCH_LANG ("a::operator foo(int)", "a::operator foo(int, char *)",
+ NORMAL, language_cplus);
CHECK_NO_MATCH_LANG ("a::operator foo(int)", "a::operator bar(int)", NORMAL,
language_cplus);
@@ -2777,50 +2740,56 @@ strncmp_iw_with_mode_tests ()
CHECK_MATCH ("foo[abi : : : ]", "foo[abi:::]", NORMAL);
CHECK_MATCH ("foo[abi:::]", "foo[abi : : : ]", NORMAL);
CHECK_MATCH ("foo[ \t abi \t:\t: : \t]",
- "foo[ abi : \t ::]",
- NORMAL);
+ "foo[ abi : \t ::]", NORMAL);
CHECK_MATCH ("foo< bar< baz< quxi > > >(int)", "foo<bar<baz<quxi>>>(int)",
NORMAL);
CHECK_MATCH ("\tfoo<\tbar<\tbaz\t<\tquxi\t>\t>\t>(int)",
"foo<bar<baz<quxi>>>(int)", NORMAL);
- CHECK_MATCH (" \tfoo \t< \tbar \t< \tbaz \t< \tquxi \t> \t> \t> \t( \tint \t)",
- "foo<bar<baz<quxi>>>(int)", NORMAL);
+ CHECK_MATCH (
+ " \tfoo \t< \tbar \t< \tbaz \t< \tquxi \t> \t> \t> \t( \tint \t)",
+ "foo<bar<baz<quxi>>>(int)", NORMAL);
CHECK_MATCH ("foo<bar<baz<quxi>>>(int)",
"foo < bar < baz < quxi > > > (int)", NORMAL);
CHECK_MATCH ("foo<bar<baz<quxi>>>(int)",
"\tfoo\t<\tbar\t<\tbaz\t<\tquxi\t>\t>\t>\t(int)", NORMAL);
- CHECK_MATCH ("foo<bar<baz<quxi>>>(int)",
- " \tfoo \t< \tbar \t< \tbaz \t< \tquxi \t> \t> \t> \t( \tint \t)", NORMAL);
+ CHECK_MATCH (
+ "foo<bar<baz<quxi>>>(int)",
+ " \tfoo \t< \tbar \t< \tbaz \t< \tquxi \t> \t> \t> \t( \tint \t)", NORMAL);
CHECK_MATCH ("foo<bar<baz>>::foo(quxi &)", "fo", NORMAL);
CHECK_MATCH ("foo<bar<baz>>::foo(quxi &)", "foo", NORMAL);
CHECK_MATCH ("foo<bar<baz>>::foo(quxi &)", "foo<bar<baz>>::", NORMAL);
CHECK_MATCH ("foo<bar<baz>>::foo(quxi &)", "foo<bar<baz> >::foo", NORMAL);
- CHECK_MATCH ("foo[abi:a][abi:b](bar[abi:c][abi:d])", "foo[abi:a][abi:b](bar[abi:c][abi:d])",
- NORMAL);
+ CHECK_MATCH ("foo[abi:a][abi:b](bar[abi:c][abi:d])",
+ "foo[abi:a][abi:b](bar[abi:c][abi:d])", NORMAL);
CHECK_MATCH ("foo[abi:a][abi:b](bar[abi:c][abi:d])", "foo", NORMAL);
CHECK_MATCH ("foo[abi:a][abi:b](bar[abi:c][abi:d])", "foo(bar)", NORMAL);
- CHECK_MATCH ("foo[abi:a][abi:b](bar[abi:c][abi:d])", "foo[abi:a](bar)", NORMAL);
- CHECK_MATCH ("foo[abi:a][abi:b](bar[abi:c][abi:d])", "foo(bar[abi:c])", NORMAL);
- CHECK_MATCH ("foo[abi:a][abi:b](bar[abi:c][abi:d])", "foo[abi:a](bar[abi:c])", NORMAL);
- CHECK_MATCH ("foo[abi:a][abi:b](bar[abi:c][abi:d])", "foo[abi:a][abi:b](bar)", NORMAL);
- CHECK_MATCH ("foo[abi:a][abi:b](bar[abi:c][abi:d])", "foo[abi:a][abi:b](bar[abi:c])",
+ CHECK_MATCH ("foo[abi:a][abi:b](bar[abi:c][abi:d])", "foo[abi:a](bar)",
NORMAL);
- CHECK_MATCH("foo<bar[abi:a]>(char *, baz[abi:b])", "foo", NORMAL);
- CHECK_NO_MATCH("foo<bar[abi:a]>(char *, baz[abi:b])", "foo()", NORMAL);
- CHECK_MATCH("foo<bar[abi:a]>(char *, baz[abi:b])", "foo<bar>", NORMAL);
- CHECK_MATCH("foo<bar[abi:a]>(char *, baz[abi:b])", "foo<bar>(char*, baz)", NORMAL);
- CHECK_MATCH("foo<bar[abi:a]>(char *, baz[abi:b])", "foo<bar>(char*, baz[abi:b])",
- NORMAL);
- CHECK_NO_MATCH("foo<bar[abi:a]>(char *, baz[abi:b])", "foo<bar>(char*, baz[abi:A])",
- NORMAL);
- CHECK_MATCH("foo<bar[abi:a]>(char *, baz[abi:b])", "foo<bar[abi:a]>(char*, baz)",
- NORMAL);
- CHECK_NO_MATCH("foo<bar[abi:a]>(char *, baz[abi:b])", "foo<bar[abi:A]>(char*, baz)",
- NORMAL);
- CHECK_MATCH("foo<bar[abi:a]>(char *, baz[abi:b])", "foo<bar[abi:a]>(char*, baz[abi:b])",
- NORMAL);
- CHECK_NO_MATCH("foo<bar[abi:a]>(char *, baz[abi:b])",
- "foo<bar[abi:a]>(char*, baz[abi:B])", NORMAL);
+ CHECK_MATCH ("foo[abi:a][abi:b](bar[abi:c][abi:d])", "foo(bar[abi:c])",
+ NORMAL);
+ CHECK_MATCH ("foo[abi:a][abi:b](bar[abi:c][abi:d])",
+ "foo[abi:a](bar[abi:c])", NORMAL);
+ CHECK_MATCH ("foo[abi:a][abi:b](bar[abi:c][abi:d])",
+ "foo[abi:a][abi:b](bar)", NORMAL);
+ CHECK_MATCH ("foo[abi:a][abi:b](bar[abi:c][abi:d])",
+ "foo[abi:a][abi:b](bar[abi:c])", NORMAL);
+ CHECK_MATCH ("foo<bar[abi:a]>(char *, baz[abi:b])", "foo", NORMAL);
+ CHECK_NO_MATCH ("foo<bar[abi:a]>(char *, baz[abi:b])", "foo()", NORMAL);
+ CHECK_MATCH ("foo<bar[abi:a]>(char *, baz[abi:b])", "foo<bar>", NORMAL);
+ CHECK_MATCH ("foo<bar[abi:a]>(char *, baz[abi:b])", "foo<bar>(char*, baz)",
+ NORMAL);
+ CHECK_MATCH ("foo<bar[abi:a]>(char *, baz[abi:b])",
+ "foo<bar>(char*, baz[abi:b])", NORMAL);
+ CHECK_NO_MATCH ("foo<bar[abi:a]>(char *, baz[abi:b])",
+ "foo<bar>(char*, baz[abi:A])", NORMAL);
+ CHECK_MATCH ("foo<bar[abi:a]>(char *, baz[abi:b])",
+ "foo<bar[abi:a]>(char*, baz)", NORMAL);
+ CHECK_NO_MATCH ("foo<bar[abi:a]>(char *, baz[abi:b])",
+ "foo<bar[abi:A]>(char*, baz)", NORMAL);
+ CHECK_MATCH ("foo<bar[abi:a]>(char *, baz[abi:b])",
+ "foo<bar[abi:a]>(char*, baz[abi:b])", NORMAL);
+ CHECK_NO_MATCH ("foo<bar[abi:a]>(char *, baz[abi:b])",
+ "foo<bar[abi:a]>(char*, baz[abi:B])", NORMAL);
CHECK_NO_MATCH ("foo", "foo[", NORMAL);
CHECK_NO_MATCH ("foo", "foo[]", NORMAL);
@@ -2888,8 +2857,8 @@ strncmp_iw_with_mode_tests ()
CHECK_NO_MATCH ("foo[abi::a]", "foo[abi:a]", NORMAL);
CHECK_NO_MATCH ("foo[abi:,([a]", "foo[abi:a]", NORMAL);
- CHECK_MATCH ("foo <a, b [, c (", "foo", NORMAL);
- CHECK_MATCH ("foo >a, b ], c )", "foo", NORMAL);
+ CHECK_MATCH ("foo <a, b [, c (", "foo", NORMAL);
+ CHECK_MATCH ("foo >a, b ], c )", "foo", NORMAL);
CHECK_MATCH ("@!%&\\*", "@!%&\\*", NORMAL);
CHECK_MATCH ("()", "()", NORMAL);
CHECK_MATCH ("*(*)*", "*(*)*", NORMAL);
@@ -2931,8 +2900,8 @@ strncmp_iw_with_mode_tests ()
CHECK_NO_MATCH ("foo2(args\t)", "foo", MATCH_PARAMS);
CHECK_NO_MATCH ("foo2 (args \t)", "foo", MATCH_PARAMS);
CHECK_NO_MATCH ("foo2 (args\t )", "foo", MATCH_PARAMS);
- CHECK_MATCH ("foo[abi:a][abi:b](bar[abi:c][abi:d])", "foo[abi:a][abi:b](bar[abi:c][abi:d])",
- MATCH_PARAMS);
+ CHECK_MATCH ("foo[abi:a][abi:b](bar[abi:c][abi:d])",
+ "foo[abi:a][abi:b](bar[abi:c][abi:d])", MATCH_PARAMS);
CHECK_MATCH ("foo[abi:a][abi:b](bar[abi:c][abi:d])", "foo", MATCH_PARAMS);
/* strncmp_iw_with_mode also supports case insensitivity. */
@@ -2960,8 +2929,7 @@ strncmp_iw_with_mode_tests ()
CHECK_MATCH ("foo[abi:abc][abi:def](xyz)", "FoO[AbI:abC](XyZ)", NORMAL);
CHECK_MATCH ("foo[abi:abc][abi:def](xyz)", "FoO[AbI:abC](XyZ)",
MATCH_PARAMS);
- CHECK_MATCH ("foo<bar<baz>>(bar<baz>)", "FoO<bAr<BaZ>>(bAr<BaZ>)",
- NORMAL);
+ CHECK_MATCH ("foo<bar<baz>>(bar<baz>)", "FoO<bAr<BaZ>>(bAr<BaZ>)", NORMAL);
CHECK_MATCH ("foo<bar<baz>>(bar<baz>)", "FoO<bAr<BaZ>>(bAr<BaZ>)",
MATCH_PARAMS);
}
@@ -2986,7 +2954,8 @@ int
strcmp_iw (const char *string1, const char *string2)
{
return strncmp_iw_with_mode (string1, string2, strlen (string2),
- strncmp_iw_mode::MATCH_PARAMS, language_minimal);
+ strncmp_iw_mode::MATCH_PARAMS,
+ language_minimal);
}
/* This is like strcmp except that it ignores whitespace and treats
@@ -3047,7 +3016,7 @@ strcmp_iw_ordered (const char *string1, const char *string2)
string2++;
switch (case_pass)
- {
+ {
case case_sensitive_off:
c1 = TOLOWER ((unsigned char) *string1);
c2 = TOLOWER ((unsigned char) *string2);
@@ -3056,7 +3025,7 @@ strcmp_iw_ordered (const char *string1, const char *string2)
c1 = *string1;
c2 = *string2;
break;
- }
+ }
if (c1 != c2)
break;
@@ -3094,7 +3063,7 @@ strcmp_iw_ordered (const char *string1, const char *string2)
if (case_pass == case_sensitive_on)
return 0;
-
+
/* Otherwise the strings were equal in case insensitive way, make
a more fine grained comparison in a case sensitive way. */
@@ -3104,16 +3073,12 @@ strcmp_iw_ordered (const char *string1, const char *string2)
}
}
-
-
static void
show_debug_timestamp (struct ui_file *file, int from_tty,
struct cmd_list_element *c, const char *value)
{
- gdb_printf (file, _("Timestamping debugging messages is %s.\n"),
- value);
+ gdb_printf (file, _ ("Timestamping debugging messages is %s.\n"), value);
}
-
const char *
paddress (struct gdbarch *gdbarch, CORE_ADDR addr)
@@ -3171,7 +3136,7 @@ string_to_core_addr (const char *my_string)
else if (ISXDIGIT (my_string[i]))
addr = (TOLOWER (my_string[i]) - 'a' + 0xa) + (addr * 16);
else
- error (_("invalid hex \"%s\""), my_string);
+ error (_ ("invalid hex \"%s\""), my_string);
}
}
else
@@ -3184,7 +3149,7 @@ string_to_core_addr (const char *my_string)
if (ISDIGIT (my_string[i]))
addr = (my_string[i] - '0') + (addr * 10);
else
- error (_("invalid decimal \"%s\""), my_string);
+ error (_ ("invalid decimal \"%s\""), my_string);
}
}
@@ -3287,13 +3252,13 @@ parse_pid_to_attach (const char *args)
char *dummy;
if (!args)
- error_no_arg (_("process-id to attach"));
+ error_no_arg (_ ("process-id to attach"));
dummy = (char *) args;
pid = strtoul (args, &dummy, 0);
/* Some targets don't set errno on errors, grrr! */
if ((pid == 0 && dummy == args) || dummy != &args[strlen (args)])
- error (_("Illegal process-id: %s."), args);
+ error (_ ("Illegal process-id: %s."), args);
return pid;
}
@@ -3377,7 +3342,7 @@ wait_to_die_with_timeout (pid_t pid, int *status, int timeout)
if (timeout > 0)
{
#ifdef SIGALRM
-#if defined (HAVE_SIGACTION) && defined (SA_RESTART)
+#if defined(HAVE_SIGACTION) && defined(SA_RESTART)
struct sigaction sa, old_sa;
sa.sa_handler = sigalrm_handler;
@@ -3397,7 +3362,7 @@ wait_to_die_with_timeout (pid_t pid, int *status, int timeout)
#ifdef SIGALRM
alarm (0);
-#if defined (HAVE_SIGACTION) && defined (SA_RESTART)
+#if defined(HAVE_SIGACTION) && defined(SA_RESTART)
sigaction (SIGALRM, &old_sa, NULL);
#else
signal (SIGALRM, ofunc);
@@ -3538,9 +3503,8 @@ strip_leading_path_elements (const char *path, int n)
/* See utils.h. */
void
-copy_bitwise (gdb_byte *dest, ULONGEST dest_offset,
- const gdb_byte *source, ULONGEST source_offset,
- ULONGEST nbits, int bits_big_endian)
+copy_bitwise (gdb_byte *dest, ULONGEST dest_offset, const gdb_byte *source,
+ ULONGEST source_offset, ULONGEST nbits, int bits_big_endian)
{
unsigned int buf, avail;
@@ -3629,55 +3593,59 @@ copy_bitwise (gdb_byte *dest, ULONGEST dest_offset,
}
void _initialize_utils ();
+
void
_initialize_utils ()
{
- add_setshow_uinteger_cmd ("width", class_support, &chars_per_line, _("\
-Set number of characters where GDB should wrap lines of its output."), _("\
-Show number of characters where GDB should wrap lines of its output."), _("\
+ add_setshow_uinteger_cmd ("width", class_support, &chars_per_line, _ ("\
+Set number of characters where GDB should wrap lines of its output."),
+ _ ("\
+Show number of characters where GDB should wrap lines of its output."),
+ _ ("\
This affects where GDB wraps its output to fit the screen width.\n\
Setting this to \"unlimited\" or zero prevents GDB from wrapping its output."),
- set_width_command,
- show_chars_per_line,
- &setlist, &showlist);
-
- add_setshow_uinteger_cmd ("height", class_support, &lines_per_page, _("\
-Set number of lines in a page for GDB output pagination."), _("\
-Show number of lines in a page for GDB output pagination."), _("\
+ set_width_command, show_chars_per_line, &setlist,
+ &showlist);
+
+ add_setshow_uinteger_cmd ("height", class_support, &lines_per_page, _ ("\
+Set number of lines in a page for GDB output pagination."),
+ _ ("\
+Show number of lines in a page for GDB output pagination."),
+ _ ("\
This affects the number of lines after which GDB will pause\n\
its output and ask you whether to continue.\n\
Setting this to \"unlimited\" or zero causes GDB never pause during output."),
- set_height_command,
- show_lines_per_page,
- &setlist, &showlist);
-
- add_setshow_boolean_cmd ("pagination", class_support,
- &pagination_enabled, _("\
-Set state of GDB output pagination."), _("\
-Show state of GDB output pagination."), _("\
+ set_height_command, show_lines_per_page, &setlist,
+ &showlist);
+
+ add_setshow_boolean_cmd ("pagination", class_support, &pagination_enabled,
+ _ ("\
+Set state of GDB output pagination."),
+ _ ("\
+Show state of GDB output pagination."),
+ _ ("\
When pagination is ON, GDB pauses at end of each screenful of\n\
its output and asks you whether to continue.\n\
Turning pagination off is an alternative to \"set height unlimited\"."),
- NULL,
- show_pagination_enabled,
- &setlist, &showlist);
+ NULL, show_pagination_enabled, &setlist, &showlist);
add_setshow_boolean_cmd ("sevenbit-strings", class_support,
- &sevenbit_strings, _("\
-Set printing of 8-bit characters in strings as \\nnn."), _("\
-Show printing of 8-bit characters in strings as \\nnn."), NULL,
- NULL,
- show_sevenbit_strings,
- &setprintlist, &showprintlist);
-
- add_setshow_boolean_cmd ("timestamp", class_maintenance,
- &debug_timestamp, _("\
-Set timestamping of debugging messages."), _("\
-Show timestamping of debugging messages."), _("\
+ &sevenbit_strings, _ ("\
+Set printing of 8-bit characters in strings as \\nnn."),
+ _ ("\
+Show printing of 8-bit characters in strings as \\nnn."),
+ NULL, NULL, show_sevenbit_strings, &setprintlist,
+ &showprintlist);
+
+ add_setshow_boolean_cmd ("timestamp", class_maintenance, &debug_timestamp,
+ _ ("\
+Set timestamping of debugging messages."),
+ _ ("\
+Show timestamping of debugging messages."),
+ _ ("\
When set, debugging messages will be marked with seconds and microseconds."),
- NULL,
- show_debug_timestamp,
- &setdebuglist, &showdebuglist);
+ NULL, show_debug_timestamp, &setdebuglist,
+ &showdebuglist);
add_internal_problem_command (&internal_error_problem);
add_internal_problem_command (&internal_warning_problem);
@@ -3685,7 +3653,8 @@ When set, debugging messages will be marked with seconds and microseconds."),
#if GDB_SELF_TEST
selftests::register_test ("gdb_realpath", gdb_realpath_tests);
- selftests::register_test ("gdb_argv_array_view", gdb_argv_as_array_view_test);
+ selftests::register_test ("gdb_argv_array_view",
+ gdb_argv_as_array_view_test);
selftests::register_test ("strncmp_iw_with_mode",
strncmp_iw_with_mode_tests);
selftests::register_test ("pager", test_pager);
diff --git a/gdb/utils.h b/gdb/utils.h
index 7865812998e..46df1de6fe9 100644
--- a/gdb/utils.h
+++ b/gdb/utils.h
@@ -37,7 +37,7 @@ extern bool sevenbit_strings;
enum class strncmp_iw_mode
{
-/* Do a strcmp() type operation on STRING1 and STRING2, ignoring any
+ /* Do a strcmp() type operation on STRING1 and STRING2, ignoring any
differences in whitespace. Returns 0 if they match, non-zero if
they don't (slightly different than strcmp()'s range of return
values). */
@@ -62,11 +62,12 @@ enum class strncmp_iw_mode
to handle abi tags). If IGNORE_TEMPLATE_PARAMS is true, all template
parameter lists will be ignored when language is C++. */
-extern int strncmp_iw_with_mode
- (const char *string1, const char *string2, size_t string2_len,
- strncmp_iw_mode mode, enum language language,
- completion_match_for_lcd *match_for_lcd = NULL,
- bool ignore_template_params = false);
+extern int strncmp_iw_with_mode (const char *string1, const char *string2,
+ size_t string2_len, strncmp_iw_mode mode,
+ enum language language,
+ completion_match_for_lcd *match_for_lcd
+ = NULL,
+ bool ignore_template_params = false);
/* Do a strncmp() type operation on STRING1 and STRING2, ignoring any
differences in whitespace. STRING2_LEN is STRING2's length.
@@ -98,14 +99,13 @@ extern int strcmp_iw_ordered (const char *, const char *);
void reset_prompt_for_continue_wait_time (void);
/* Return the time spent in prompt_for_continue. */
std::chrono::steady_clock::duration get_prompt_for_continue_wait_time ();
-
+
/* Parsing utilities. */
extern int parse_pid_to_attach (const char *args);
extern int parse_escape (struct gdbarch *, const char **);
-
/* Cleanup utilities. */
extern void init_page_info (void);
@@ -132,7 +132,6 @@ private:
int m_save_batch_flag;
};
-
/* Path utilities. */
extern int gdb_filename_fnmatch (const char *pattern, const char *string,
@@ -146,7 +145,7 @@ std::string ldirname (const char *filename);
extern int count_path_elements (const char *path);
extern const char *strip_leading_path_elements (const char *path, int n);
-
+
/* GDB output, ui_file utilities. */
struct ui_file;
@@ -241,23 +240,20 @@ extern int filtered_printing_initialized (void);
/* Like gdb_printf, but styles the output according to STYLE,
when appropriate. */
-extern void fprintf_styled (struct ui_file *stream,
- const ui_file_style &style,
- const char *fmt,
- ...)
- ATTRIBUTE_PRINTF (3, 4);
+extern void fprintf_styled (struct ui_file *stream, const ui_file_style &style,
+ const char *fmt, ...) ATTRIBUTE_PRINTF (3, 4);
/* Like gdb_puts, but styles the output according to STYLE, when
appropriate. */
-extern void fputs_styled (const char *linebuffer,
- const ui_file_style &style,
+extern void fputs_styled (const char *linebuffer, const ui_file_style &style,
struct ui_file *stream);
/* Like fputs_styled, but uses highlight_style to highlight the
parts of STR that match HIGHLIGHT. */
-extern void fputs_highlighted (const char *str, const compiled_regex &highlight,
+extern void fputs_highlighted (const char *str,
+ const compiled_regex &highlight,
struct ui_file *stream);
/* Convert CORE_ADDR to string in platform-specific manner.
@@ -272,13 +268,13 @@ extern const char *print_core_address (struct gdbarch *gdbarch,
extern CORE_ADDR string_to_core_addr (const char *my_string);
-extern void fprintf_symbol (struct ui_file *, const char *,
- enum language, int);
+extern void fprintf_symbol (struct ui_file *, const char *, enum language,
+ int);
extern void perror_warning_with_name (const char *string);
extern void print_sys_errmsg (const char *, int);
-
+
/* Warnings and error messages. */
extern void (*deprecated_error_begin_hook) (void);
@@ -289,14 +285,12 @@ extern const char *warning_pre_print;
extern void error_stream (const string_file &) ATTRIBUTE_NORETURN;
-extern void demangler_vwarning (const char *file, int line,
- const char *, va_list ap)
- ATTRIBUTE_PRINTF (3, 0);
+extern void demangler_vwarning (const char *file, int line, const char *,
+ va_list ap) ATTRIBUTE_PRINTF (3, 0);
-extern void demangler_warning (const char *file, int line,
- const char *, ...) ATTRIBUTE_PRINTF (3, 4);
+extern void demangler_warning (const char *file, int line, const char *, ...)
+ ATTRIBUTE_PRINTF (3, 4);
-
/* Misc. utilities. */
#ifdef HAVE_WAITPID
@@ -315,10 +309,10 @@ extern ULONGEST uinteger_pow (ULONGEST v1, LONGEST v2);
/* Resource limits used by getrlimit and setrlimit. */
enum resource_limit_kind
- {
- LIMIT_CUR,
- LIMIT_MAX
- };
+{
+ LIMIT_CUR,
+ LIMIT_MAX
+};
/* Check whether GDB will be able to dump core using the dump_core
function. Returns zero if GDB cannot or should not dump core.
diff --git a/gdb/v850-tdep.c b/gdb/v850-tdep.c
index cc7da907a5e..104b601b199 100644
--- a/gdb/v850-tdep.c
+++ b/gdb/v850-tdep.c
@@ -35,203 +35,220 @@
#include "gdbarch.h"
enum
- {
- /* General purpose registers. */
- E_R0_REGNUM,
- E_R1_REGNUM,
- E_R2_REGNUM,
- E_R3_REGNUM, E_SP_REGNUM = E_R3_REGNUM,
- E_R4_REGNUM,
- E_R5_REGNUM,
- E_R6_REGNUM, E_ARG0_REGNUM = E_R6_REGNUM,
- E_R7_REGNUM,
- E_R8_REGNUM,
- E_R9_REGNUM, E_ARGLAST_REGNUM = E_R9_REGNUM,
- E_R10_REGNUM, E_V0_REGNUM = E_R10_REGNUM,
- E_R11_REGNUM, E_V1_REGNUM = E_R11_REGNUM,
- E_R12_REGNUM,
- E_R13_REGNUM,
- E_R14_REGNUM,
- E_R15_REGNUM,
- E_R16_REGNUM,
- E_R17_REGNUM,
- E_R18_REGNUM,
- E_R19_REGNUM,
- E_R20_REGNUM,
- E_R21_REGNUM,
- E_R22_REGNUM,
- E_R23_REGNUM,
- E_R24_REGNUM,
- E_R25_REGNUM,
- E_R26_REGNUM,
- E_R27_REGNUM,
- E_R28_REGNUM,
- E_R29_REGNUM, E_FP_REGNUM = E_R29_REGNUM,
- E_R30_REGNUM, E_EP_REGNUM = E_R30_REGNUM,
- E_R31_REGNUM, E_LP_REGNUM = E_R31_REGNUM,
-
- /* System registers - main banks. */
- E_R32_REGNUM, E_SR0_REGNUM = E_R32_REGNUM,
- E_R33_REGNUM,
- E_R34_REGNUM,
- E_R35_REGNUM,
- E_R36_REGNUM,
- E_R37_REGNUM, E_PS_REGNUM = E_R37_REGNUM,
- E_R38_REGNUM,
- E_R39_REGNUM,
- E_R40_REGNUM,
- E_R41_REGNUM,
- E_R42_REGNUM,
- E_R43_REGNUM,
- E_R44_REGNUM,
- E_R45_REGNUM,
- E_R46_REGNUM,
- E_R47_REGNUM,
- E_R48_REGNUM,
- E_R49_REGNUM,
- E_R50_REGNUM,
- E_R51_REGNUM,
- E_R52_REGNUM, E_CTBP_REGNUM = E_R52_REGNUM,
- E_R53_REGNUM,
- E_R54_REGNUM,
- E_R55_REGNUM,
- E_R56_REGNUM,
- E_R57_REGNUM,
- E_R58_REGNUM,
- E_R59_REGNUM,
- E_R60_REGNUM,
- E_R61_REGNUM,
- E_R62_REGNUM,
- E_R63_REGNUM,
-
- /* PC. */
- E_R64_REGNUM, E_PC_REGNUM = E_R64_REGNUM,
- E_R65_REGNUM,
- E_NUM_OF_V850_REGS,
- E_NUM_OF_V850E_REGS = E_NUM_OF_V850_REGS,
-
- /* System registers - MPV (PROT00) bank. */
- E_R66_REGNUM = E_NUM_OF_V850_REGS,
- E_R67_REGNUM,
- E_R68_REGNUM,
- E_R69_REGNUM,
- E_R70_REGNUM,
- E_R71_REGNUM,
- E_R72_REGNUM,
- E_R73_REGNUM,
- E_R74_REGNUM,
- E_R75_REGNUM,
- E_R76_REGNUM,
- E_R77_REGNUM,
- E_R78_REGNUM,
- E_R79_REGNUM,
- E_R80_REGNUM,
- E_R81_REGNUM,
- E_R82_REGNUM,
- E_R83_REGNUM,
- E_R84_REGNUM,
- E_R85_REGNUM,
- E_R86_REGNUM,
- E_R87_REGNUM,
- E_R88_REGNUM,
- E_R89_REGNUM,
- E_R90_REGNUM,
- E_R91_REGNUM,
- E_R92_REGNUM,
- E_R93_REGNUM,
-
- /* System registers - MPU (PROT01) bank. */
- E_R94_REGNUM,
- E_R95_REGNUM,
- E_R96_REGNUM,
- E_R97_REGNUM,
- E_R98_REGNUM,
- E_R99_REGNUM,
- E_R100_REGNUM,
- E_R101_REGNUM,
- E_R102_REGNUM,
- E_R103_REGNUM,
- E_R104_REGNUM,
- E_R105_REGNUM,
- E_R106_REGNUM,
- E_R107_REGNUM,
- E_R108_REGNUM,
- E_R109_REGNUM,
- E_R110_REGNUM,
- E_R111_REGNUM,
- E_R112_REGNUM,
- E_R113_REGNUM,
- E_R114_REGNUM,
- E_R115_REGNUM,
- E_R116_REGNUM,
- E_R117_REGNUM,
- E_R118_REGNUM,
- E_R119_REGNUM,
- E_R120_REGNUM,
- E_R121_REGNUM,
-
- /* FPU system registers. */
- E_R122_REGNUM,
- E_R123_REGNUM,
- E_R124_REGNUM,
- E_R125_REGNUM,
- E_R126_REGNUM,
- E_R127_REGNUM,
- E_R128_REGNUM, E_FPSR_REGNUM = E_R128_REGNUM,
- E_R129_REGNUM, E_FPEPC_REGNUM = E_R129_REGNUM,
- E_R130_REGNUM, E_FPST_REGNUM = E_R130_REGNUM,
- E_R131_REGNUM, E_FPCC_REGNUM = E_R131_REGNUM,
- E_R132_REGNUM, E_FPCFG_REGNUM = E_R132_REGNUM,
- E_R133_REGNUM,
- E_R134_REGNUM,
- E_R135_REGNUM,
- E_R136_REGNUM,
- E_R137_REGNUM,
- E_R138_REGNUM,
- E_R139_REGNUM,
- E_R140_REGNUM,
- E_R141_REGNUM,
- E_R142_REGNUM,
- E_R143_REGNUM,
- E_R144_REGNUM,
- E_R145_REGNUM,
- E_R146_REGNUM,
- E_R147_REGNUM,
- E_R148_REGNUM,
- E_R149_REGNUM,
- E_NUM_OF_V850E2_REGS,
-
- /* v850e3v5 system registers, selID 1 thru 7. */
- E_SELID_1_R0_REGNUM = E_NUM_OF_V850E2_REGS,
- E_SELID_1_R31_REGNUM = E_SELID_1_R0_REGNUM + 31,
-
- E_SELID_2_R0_REGNUM,
- E_SELID_2_R31_REGNUM = E_SELID_2_R0_REGNUM + 31,
-
- E_SELID_3_R0_REGNUM,
- E_SELID_3_R31_REGNUM = E_SELID_3_R0_REGNUM + 31,
-
- E_SELID_4_R0_REGNUM,
- E_SELID_4_R31_REGNUM = E_SELID_4_R0_REGNUM + 31,
-
- E_SELID_5_R0_REGNUM,
- E_SELID_5_R31_REGNUM = E_SELID_5_R0_REGNUM + 31,
-
- E_SELID_6_R0_REGNUM,
- E_SELID_6_R31_REGNUM = E_SELID_6_R0_REGNUM + 31,
-
- E_SELID_7_R0_REGNUM,
- E_SELID_7_R31_REGNUM = E_SELID_7_R0_REGNUM + 31,
-
- /* v850e3v5 vector registers. */
- E_VR0_REGNUM,
- E_VR31_REGNUM = E_VR0_REGNUM + 31,
-
- E_NUM_OF_V850E3V5_REGS,
-
- /* Total number of possible registers. */
- E_NUM_REGS = E_NUM_OF_V850E3V5_REGS
- };
+{
+ /* General purpose registers. */
+ E_R0_REGNUM,
+ E_R1_REGNUM,
+ E_R2_REGNUM,
+ E_R3_REGNUM,
+ E_SP_REGNUM = E_R3_REGNUM,
+ E_R4_REGNUM,
+ E_R5_REGNUM,
+ E_R6_REGNUM,
+ E_ARG0_REGNUM = E_R6_REGNUM,
+ E_R7_REGNUM,
+ E_R8_REGNUM,
+ E_R9_REGNUM,
+ E_ARGLAST_REGNUM = E_R9_REGNUM,
+ E_R10_REGNUM,
+ E_V0_REGNUM = E_R10_REGNUM,
+ E_R11_REGNUM,
+ E_V1_REGNUM = E_R11_REGNUM,
+ E_R12_REGNUM,
+ E_R13_REGNUM,
+ E_R14_REGNUM,
+ E_R15_REGNUM,
+ E_R16_REGNUM,
+ E_R17_REGNUM,
+ E_R18_REGNUM,
+ E_R19_REGNUM,
+ E_R20_REGNUM,
+ E_R21_REGNUM,
+ E_R22_REGNUM,
+ E_R23_REGNUM,
+ E_R24_REGNUM,
+ E_R25_REGNUM,
+ E_R26_REGNUM,
+ E_R27_REGNUM,
+ E_R28_REGNUM,
+ E_R29_REGNUM,
+ E_FP_REGNUM = E_R29_REGNUM,
+ E_R30_REGNUM,
+ E_EP_REGNUM = E_R30_REGNUM,
+ E_R31_REGNUM,
+ E_LP_REGNUM = E_R31_REGNUM,
+
+ /* System registers - main banks. */
+ E_R32_REGNUM,
+ E_SR0_REGNUM = E_R32_REGNUM,
+ E_R33_REGNUM,
+ E_R34_REGNUM,
+ E_R35_REGNUM,
+ E_R36_REGNUM,
+ E_R37_REGNUM,
+ E_PS_REGNUM = E_R37_REGNUM,
+ E_R38_REGNUM,
+ E_R39_REGNUM,
+ E_R40_REGNUM,
+ E_R41_REGNUM,
+ E_R42_REGNUM,
+ E_R43_REGNUM,
+ E_R44_REGNUM,
+ E_R45_REGNUM,
+ E_R46_REGNUM,
+ E_R47_REGNUM,
+ E_R48_REGNUM,
+ E_R49_REGNUM,
+ E_R50_REGNUM,
+ E_R51_REGNUM,
+ E_R52_REGNUM,
+ E_CTBP_REGNUM = E_R52_REGNUM,
+ E_R53_REGNUM,
+ E_R54_REGNUM,
+ E_R55_REGNUM,
+ E_R56_REGNUM,
+ E_R57_REGNUM,
+ E_R58_REGNUM,
+ E_R59_REGNUM,
+ E_R60_REGNUM,
+ E_R61_REGNUM,
+ E_R62_REGNUM,
+ E_R63_REGNUM,
+
+ /* PC. */
+ E_R64_REGNUM,
+ E_PC_REGNUM = E_R64_REGNUM,
+ E_R65_REGNUM,
+ E_NUM_OF_V850_REGS,
+ E_NUM_OF_V850E_REGS = E_NUM_OF_V850_REGS,
+
+ /* System registers - MPV (PROT00) bank. */
+ E_R66_REGNUM = E_NUM_OF_V850_REGS,
+ E_R67_REGNUM,
+ E_R68_REGNUM,
+ E_R69_REGNUM,
+ E_R70_REGNUM,
+ E_R71_REGNUM,
+ E_R72_REGNUM,
+ E_R73_REGNUM,
+ E_R74_REGNUM,
+ E_R75_REGNUM,
+ E_R76_REGNUM,
+ E_R77_REGNUM,
+ E_R78_REGNUM,
+ E_R79_REGNUM,
+ E_R80_REGNUM,
+ E_R81_REGNUM,
+ E_R82_REGNUM,
+ E_R83_REGNUM,
+ E_R84_REGNUM,
+ E_R85_REGNUM,
+ E_R86_REGNUM,
+ E_R87_REGNUM,
+ E_R88_REGNUM,
+ E_R89_REGNUM,
+ E_R90_REGNUM,
+ E_R91_REGNUM,
+ E_R92_REGNUM,
+ E_R93_REGNUM,
+
+ /* System registers - MPU (PROT01) bank. */
+ E_R94_REGNUM,
+ E_R95_REGNUM,
+ E_R96_REGNUM,
+ E_R97_REGNUM,
+ E_R98_REGNUM,
+ E_R99_REGNUM,
+ E_R100_REGNUM,
+ E_R101_REGNUM,
+ E_R102_REGNUM,
+ E_R103_REGNUM,
+ E_R104_REGNUM,
+ E_R105_REGNUM,
+ E_R106_REGNUM,
+ E_R107_REGNUM,
+ E_R108_REGNUM,
+ E_R109_REGNUM,
+ E_R110_REGNUM,
+ E_R111_REGNUM,
+ E_R112_REGNUM,
+ E_R113_REGNUM,
+ E_R114_REGNUM,
+ E_R115_REGNUM,
+ E_R116_REGNUM,
+ E_R117_REGNUM,
+ E_R118_REGNUM,
+ E_R119_REGNUM,
+ E_R120_REGNUM,
+ E_R121_REGNUM,
+
+ /* FPU system registers. */
+ E_R122_REGNUM,
+ E_R123_REGNUM,
+ E_R124_REGNUM,
+ E_R125_REGNUM,
+ E_R126_REGNUM,
+ E_R127_REGNUM,
+ E_R128_REGNUM,
+ E_FPSR_REGNUM = E_R128_REGNUM,
+ E_R129_REGNUM,
+ E_FPEPC_REGNUM = E_R129_REGNUM,
+ E_R130_REGNUM,
+ E_FPST_REGNUM = E_R130_REGNUM,
+ E_R131_REGNUM,
+ E_FPCC_REGNUM = E_R131_REGNUM,
+ E_R132_REGNUM,
+ E_FPCFG_REGNUM = E_R132_REGNUM,
+ E_R133_REGNUM,
+ E_R134_REGNUM,
+ E_R135_REGNUM,
+ E_R136_REGNUM,
+ E_R137_REGNUM,
+ E_R138_REGNUM,
+ E_R139_REGNUM,
+ E_R140_REGNUM,
+ E_R141_REGNUM,
+ E_R142_REGNUM,
+ E_R143_REGNUM,
+ E_R144_REGNUM,
+ E_R145_REGNUM,
+ E_R146_REGNUM,
+ E_R147_REGNUM,
+ E_R148_REGNUM,
+ E_R149_REGNUM,
+ E_NUM_OF_V850E2_REGS,
+
+ /* v850e3v5 system registers, selID 1 thru 7. */
+ E_SELID_1_R0_REGNUM = E_NUM_OF_V850E2_REGS,
+ E_SELID_1_R31_REGNUM = E_SELID_1_R0_REGNUM + 31,
+
+ E_SELID_2_R0_REGNUM,
+ E_SELID_2_R31_REGNUM = E_SELID_2_R0_REGNUM + 31,
+
+ E_SELID_3_R0_REGNUM,
+ E_SELID_3_R31_REGNUM = E_SELID_3_R0_REGNUM + 31,
+
+ E_SELID_4_R0_REGNUM,
+ E_SELID_4_R31_REGNUM = E_SELID_4_R0_REGNUM + 31,
+
+ E_SELID_5_R0_REGNUM,
+ E_SELID_5_R31_REGNUM = E_SELID_5_R0_REGNUM + 31,
+
+ E_SELID_6_R0_REGNUM,
+ E_SELID_6_R31_REGNUM = E_SELID_6_R0_REGNUM + 31,
+
+ E_SELID_7_R0_REGNUM,
+ E_SELID_7_R31_REGNUM = E_SELID_7_R0_REGNUM + 31,
+
+ /* v850e3v5 vector registers. */
+ E_VR0_REGNUM,
+ E_VR31_REGNUM = E_VR0_REGNUM + 31,
+
+ E_NUM_OF_V850E3V5_REGS,
+
+ /* Total number of possible registers. */
+ E_NUM_REGS = E_NUM_OF_V850E3V5_REGS
+};
enum
{
@@ -272,46 +289,48 @@ struct v850_gdbarch_tdep : gdbarch_tdep_base
int e_machine = 0;
/* Which ABI are we using? */
- enum v850_abi abi {};
+ enum v850_abi abi
+ {
+ };
+
int eight_byte_align = 0;
};
struct v850_frame_cache
-{
+{
/* Base address. */
CORE_ADDR base;
LONGEST sp_offset;
CORE_ADDR pc;
-
+
/* Flag showing that a frame has been created in the prologue code. */
int uses_fp;
-
+
/* Saved registers. */
trad_frame_saved_reg *saved_regs;
};
/* Info gleaned from scanning a function's prologue. */
-struct pifsr /* Info about one saved register. */
+struct pifsr /* Info about one saved register. */
{
- int offset; /* Offset from sp or fp. */
- int cur_frameoffset; /* Current frameoffset. */
- int reg; /* Saved register number. */
+ int offset; /* Offset from sp or fp. */
+ int cur_frameoffset; /* Current frameoffset. */
+ int reg; /* Saved register number. */
};
static const char *
v850_register_name (struct gdbarch *gdbarch, int regnum)
{
- static const char *v850_reg_names[] =
- { "r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7",
- "r8", "r9", "r10", "r11", "r12", "r13", "r14", "r15",
- "r16", "r17", "r18", "r19", "r20", "r21", "r22", "r23",
- "r24", "r25", "r26", "r27", "r28", "r29", "r30", "r31",
- "eipc", "eipsw", "fepc", "fepsw", "ecr", "psw", "sr6", "sr7",
- "sr8", "sr9", "sr10", "sr11", "sr12", "sr13", "sr14", "sr15",
- "sr16", "sr17", "sr18", "sr19", "sr20", "sr21", "sr22", "sr23",
- "sr24", "sr25", "sr26", "sr27", "sr28", "sr29", "sr30", "sr31",
- "pc", "fp"
- };
+ static const char *v850_reg_names[]
+ = { "r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7",
+ "r8", "r9", "r10", "r11", "r12", "r13", "r14", "r15",
+ "r16", "r17", "r18", "r19", "r20", "r21", "r22", "r23",
+ "r24", "r25", "r26", "r27", "r28", "r29", "r30", "r31",
+ "eipc", "eipsw", "fepc", "fepsw", "ecr", "psw", "sr6", "sr7",
+ "sr8", "sr9", "sr10", "sr11", "sr12", "sr13", "sr14", "sr15",
+ "sr16", "sr17", "sr18", "sr19", "sr20", "sr21", "sr22", "sr23",
+ "sr24", "sr25", "sr26", "sr27", "sr28", "sr29", "sr30", "sr31",
+ "pc", "fp" };
gdb_static_assert (E_NUM_OF_V850_REGS == ARRAY_SIZE (v850_reg_names));
return v850_reg_names[regnum];
}
@@ -319,18 +338,16 @@ v850_register_name (struct gdbarch *gdbarch, int regnum)
static const char *
v850e_register_name (struct gdbarch *gdbarch, int regnum)
{
- static const char *v850e_reg_names[] =
- {
- "r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7",
- "r8", "r9", "r10", "r11", "r12", "r13", "r14", "r15",
- "r16", "r17", "r18", "r19", "r20", "r21", "r22", "r23",
- "r24", "r25", "r26", "r27", "r28", "r29", "r30", "r31",
- "eipc", "eipsw", "fepc", "fepsw", "ecr", "psw", "sr6", "sr7",
- "sr8", "sr9", "sr10", "sr11", "sr12", "sr13", "sr14", "sr15",
- "ctpc", "ctpsw", "dbpc", "dbpsw", "ctbp", "sr21", "sr22", "sr23",
- "sr24", "sr25", "sr26", "sr27", "sr28", "sr29", "sr30", "sr31",
- "pc", "fp"
- };
+ static const char *v850e_reg_names[]
+ = { "r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7",
+ "r8", "r9", "r10", "r11", "r12", "r13", "r14", "r15",
+ "r16", "r17", "r18", "r19", "r20", "r21", "r22", "r23",
+ "r24", "r25", "r26", "r27", "r28", "r29", "r30", "r31",
+ "eipc", "eipsw", "fepc", "fepsw", "ecr", "psw", "sr6", "sr7",
+ "sr8", "sr9", "sr10", "sr11", "sr12", "sr13", "sr14", "sr15",
+ "ctpc", "ctpsw", "dbpc", "dbpsw", "ctbp", "sr21", "sr22", "sr23",
+ "sr24", "sr25", "sr26", "sr27", "sr28", "sr29", "sr30", "sr31",
+ "pc", "fp" };
gdb_static_assert (E_NUM_OF_V850E_REGS == ARRAY_SIZE (v850e_reg_names));
return v850e_reg_names[regnum];
}
@@ -338,41 +355,34 @@ v850e_register_name (struct gdbarch *gdbarch, int regnum)
static const char *
v850e2_register_name (struct gdbarch *gdbarch, int regnum)
{
- static const char *v850e2_reg_names[] =
- {
+ static const char *v850e2_reg_names[] = {
/* General purpose registers. */
- "r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7",
- "r8", "r9", "r10", "r11", "r12", "r13", "r14", "r15",
- "r16", "r17", "r18", "r19", "r20", "r21", "r22", "r23",
- "r24", "r25", "r26", "r27", "r28", "r29", "r30", "r31",
+ "r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7", "r8", "r9", "r10", "r11",
+ "r12", "r13", "r14", "r15", "r16", "r17", "r18", "r19", "r20", "r21",
+ "r22", "r23", "r24", "r25", "r26", "r27", "r28", "r29", "r30", "r31",
/* System registers - main banks. */
- "eipc", "eipsw", "fepc", "fepsw", "ecr", "psw", "pid", "cfg",
- "", "", "", "sccfg", "scbp", "eiic", "feic", "dbic",
- "ctpc", "ctpsw", "dbpc", "dbpsw", "ctbp", "dir", "", "",
- "", "", "", "", "eiwr", "fewr", "dbwr", "bsel",
-
+ "eipc", "eipsw", "fepc", "fepsw", "ecr", "psw", "pid", "cfg", "", "", "",
+ "sccfg", "scbp", "eiic", "feic", "dbic", "ctpc", "ctpsw", "dbpc", "dbpsw",
+ "ctbp", "dir", "", "", "", "", "", "", "eiwr", "fewr", "dbwr", "bsel",
/* PC. */
"pc", "",
/* System registers - MPV (PROT00) bank. */
- "vsecr", "vstid", "vsadr", "", "vmecr", "vmtid", "vmadr", "",
- "vpecr", "vptid", "vpadr", "", "", "", "", "",
- "", "", "", "", "", "", "", "",
+ "vsecr", "vstid", "vsadr", "", "vmecr", "vmtid", "vmadr", "", "vpecr",
+ "vptid", "vpadr", "", "", "", "", "", "", "", "", "", "", "", "", "",
"mca", "mcs", "mcc", "mcr",
/* System registers - MPU (PROT01) bank. */
- "mpm", "mpc", "tid", "", "", "", "ipa0l", "ipa0u",
- "ipa1l", "ipa1u", "ipa2l", "ipa2u", "ipa3l", "ipa3u", "ipa4l", "ipa4u",
- "dpa0l", "dpa0u", "dpa1l", "dpa1u", "dpa2l", "dpa2u", "dpa3l", "dpa3u",
- "dpa4l", "dpa4u", "dpa5l", "dpa5u",
+ "mpm", "mpc", "tid", "", "", "", "ipa0l", "ipa0u", "ipa1l", "ipa1u",
+ "ipa2l", "ipa2u", "ipa3l", "ipa3u", "ipa4l", "ipa4u", "dpa0l", "dpa0u",
+ "dpa1l", "dpa1u", "dpa2l", "dpa2u", "dpa3l", "dpa3u", "dpa4l", "dpa4u",
+ "dpa5l", "dpa5u",
/* FPU system registers. */
- "", "", "", "", "", "", "fpsr", "fpepc",
- "fpst", "fpcc", "fpcfg", "fpec", "", "", "", "",
- "", "", "", "", "", "", "", "",
- "", "", "", "fpspc"
+ "", "", "", "", "", "", "fpsr", "fpepc", "fpst", "fpcc", "fpcfg", "fpec",
+ "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "fpspc"
};
if (regnum >= E_NUM_OF_V850E2_REGS)
return "";
@@ -384,97 +394,444 @@ v850e2_register_name (struct gdbarch *gdbarch, int regnum)
static const char *
v850e3v5_register_name (struct gdbarch *gdbarch, int regnum)
{
- static const char *v850e3v5_reg_names[] =
- {
+ static const char *v850e3v5_reg_names[] = {
/* General purpose registers. */
- "r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7",
- "r8", "r9", "r10", "r11", "r12", "r13", "r14", "r15",
- "r16", "r17", "r18", "r19", "r20", "r21", "r22", "r23",
- "r24", "r25", "r26", "r27", "r28", "r29", "r30", "r31",
+ "r0",
+ "r1",
+ "r2",
+ "r3",
+ "r4",
+ "r5",
+ "r6",
+ "r7",
+ "r8",
+ "r9",
+ "r10",
+ "r11",
+ "r12",
+ "r13",
+ "r14",
+ "r15",
+ "r16",
+ "r17",
+ "r18",
+ "r19",
+ "r20",
+ "r21",
+ "r22",
+ "r23",
+ "r24",
+ "r25",
+ "r26",
+ "r27",
+ "r28",
+ "r29",
+ "r30",
+ "r31",
/* selID 0, not including FPU registers. The FPU registers are
listed later on. */
- "eipc", "eipsw", "fepc", "fepsw",
- "", "psw", "" /* fpsr */, "" /* fpepc */,
- "" /* fpst */, "" /* fpcc */, "" /* fpcfg */, "" /* fpec */,
- "sesr", "eiic", "feic", "",
- "ctpc", "ctpsw", "", "", "ctbp", "", "", "",
- "", "", "", "", "eiwr", "fewr", "", "bsel",
-
+ "eipc",
+ "eipsw",
+ "fepc",
+ "fepsw",
+ "",
+ "psw",
+ "" /* fpsr */,
+ "" /* fpepc */,
+ "" /* fpst */,
+ "" /* fpcc */,
+ "" /* fpcfg */,
+ "" /* fpec */,
+ "sesr",
+ "eiic",
+ "feic",
+ "",
+ "ctpc",
+ "ctpsw",
+ "",
+ "",
+ "ctbp",
+ "",
+ "",
+ "",
+ "",
+ "",
+ "",
+ "",
+ "eiwr",
+ "fewr",
+ "",
+ "bsel",
/* PC. */
- "pc", "",
+ "pc",
+ "",
/* v850e2 MPV bank. */
- "", "", "", "", "", "", "", "",
- "", "", "", "", "", "", "", "",
- "", "", "", "", "", "", "", "",
- "", "", "", "",
+ "",
+ "",
+ "",
+ "",
+ "",
+ "",
+ "",
+ "",
+ "",
+ "",
+ "",
+ "",
+ "",
+ "",
+ "",
+ "",
+ "",
+ "",
+ "",
+ "",
+ "",
+ "",
+ "",
+ "",
+ "",
+ "",
+ "",
+ "",
/* Skip v850e2 MPU bank. It's tempting to reuse these, but we need
32 entries for this bank. */
- "", "", "", "", "", "", "", "",
- "", "", "", "", "", "", "", "",
- "", "", "", "", "", "", "", "",
- "", "", "", "",
+ "",
+ "",
+ "",
+ "",
+ "",
+ "",
+ "",
+ "",
+ "",
+ "",
+ "",
+ "",
+ "",
+ "",
+ "",
+ "",
+ "",
+ "",
+ "",
+ "",
+ "",
+ "",
+ "",
+ "",
+ "",
+ "",
+ "",
+ "",
/* FPU system registers. These are actually in selID 0, but
are placed here to preserve register numbering compatibility
with previous architectures. */
- "", "", "", "", "", "", "fpsr", "fpepc",
- "fpst", "fpcc", "fpcfg", "fpec", "", "", "", "",
- "", "", "", "", "", "", "", "",
- "", "", "", "",
+ "",
+ "",
+ "",
+ "",
+ "",
+ "",
+ "fpsr",
+ "fpepc",
+ "fpst",
+ "fpcc",
+ "fpcfg",
+ "fpec",
+ "",
+ "",
+ "",
+ "",
+ "",
+ "",
+ "",
+ "",
+ "",
+ "",
+ "",
+ "",
+ "",
+ "",
+ "",
+ "",
/* selID 1. */
- "mcfg0", "mcfg1", "rbase", "ebase", "intbp", "mctl", "pid", "fpipr",
- "", "", "tcsel", "sccfg", "scbp", "hvccfg", "hvcbp", "vsel",
- "vmprt0", "vmprt1", "vmprt2", "", "", "", "", "vmscctl",
- "vmsctbl0", "vmsctbl1", "vmsctbl2", "vmsctbl3", "", "", "", "",
+ "mcfg0",
+ "mcfg1",
+ "rbase",
+ "ebase",
+ "intbp",
+ "mctl",
+ "pid",
+ "fpipr",
+ "",
+ "",
+ "tcsel",
+ "sccfg",
+ "scbp",
+ "hvccfg",
+ "hvcbp",
+ "vsel",
+ "vmprt0",
+ "vmprt1",
+ "vmprt2",
+ "",
+ "",
+ "",
+ "",
+ "vmscctl",
+ "vmsctbl0",
+ "vmsctbl1",
+ "vmsctbl2",
+ "vmsctbl3",
+ "",
+ "",
+ "",
+ "",
/* selID 2. */
- "htcfg0", "", "", "", "", "htctl", "mea", "asid",
- "mei", "ispr", "pmr", "icsr", "intcfg", "", "", "",
- "tlbsch", "", "", "", "", "", "", "htscctl",
- "htsctbl0", "htsctbl1", "htsctbl2", "htsctbl3",
- "htsctbl4", "htsctbl5", "htsctbl6", "htsctbl7",
+ "htcfg0",
+ "",
+ "",
+ "",
+ "",
+ "htctl",
+ "mea",
+ "asid",
+ "mei",
+ "ispr",
+ "pmr",
+ "icsr",
+ "intcfg",
+ "",
+ "",
+ "",
+ "tlbsch",
+ "",
+ "",
+ "",
+ "",
+ "",
+ "",
+ "htscctl",
+ "htsctbl0",
+ "htsctbl1",
+ "htsctbl2",
+ "htsctbl3",
+ "htsctbl4",
+ "htsctbl5",
+ "htsctbl6",
+ "htsctbl7",
/* selID 3. */
- "", "", "", "", "", "", "", "",
- "", "", "", "", "", "", "", "",
- "", "", "", "", "", "", "", "",
- "", "", "", "", "", "", "", "",
+ "",
+ "",
+ "",
+ "",
+ "",
+ "",
+ "",
+ "",
+ "",
+ "",
+ "",
+ "",
+ "",
+ "",
+ "",
+ "",
+ "",
+ "",
+ "",
+ "",
+ "",
+ "",
+ "",
+ "",
+ "",
+ "",
+ "",
+ "",
+ "",
+ "",
+ "",
+ "",
/* selID 4. */
- "tlbidx", "", "", "", "telo0", "telo1", "tehi0", "tehi1",
- "", "", "tlbcfg", "", "bwerrl", "bwerrh", "brerrl", "brerrh",
- "ictagl", "ictagh", "icdatl", "icdath",
- "dctagl", "dctagh", "dcdatl", "dcdath",
- "icctrl", "dcctrl", "iccfg", "dccfg", "icerr", "dcerr", "", "",
+ "tlbidx",
+ "",
+ "",
+ "",
+ "telo0",
+ "telo1",
+ "tehi0",
+ "tehi1",
+ "",
+ "",
+ "tlbcfg",
+ "",
+ "bwerrl",
+ "bwerrh",
+ "brerrl",
+ "brerrh",
+ "ictagl",
+ "ictagh",
+ "icdatl",
+ "icdath",
+ "dctagl",
+ "dctagh",
+ "dcdatl",
+ "dcdath",
+ "icctrl",
+ "dcctrl",
+ "iccfg",
+ "dccfg",
+ "icerr",
+ "dcerr",
+ "",
+ "",
/* selID 5. */
- "mpm", "mprc", "", "", "mpbrgn", "mptrgn", "", "",
- "mca", "mcs", "mcc", "mcr", "", "", "", "",
- "", "", "", "", "mpprt0", "mpprt1", "mpprt2", "",
- "", "", "", "", "", "", "", "",
+ "mpm",
+ "mprc",
+ "",
+ "",
+ "mpbrgn",
+ "mptrgn",
+ "",
+ "",
+ "mca",
+ "mcs",
+ "mcc",
+ "mcr",
+ "",
+ "",
+ "",
+ "",
+ "",
+ "",
+ "",
+ "",
+ "mpprt0",
+ "mpprt1",
+ "mpprt2",
+ "",
+ "",
+ "",
+ "",
+ "",
+ "",
+ "",
+ "",
+ "",
/* selID 6. */
- "mpla0", "mpua0", "mpat0", "", "mpla1", "mpua1", "mpat1", "",
- "mpla2", "mpua2", "mpat2", "", "mpla3", "mpua3", "mpat3", "",
- "mpla4", "mpua4", "mpat4", "", "mpla5", "mpua5", "mpat5", "",
- "mpla6", "mpua6", "mpat6", "", "mpla7", "mpua7", "mpat7", "",
+ "mpla0",
+ "mpua0",
+ "mpat0",
+ "",
+ "mpla1",
+ "mpua1",
+ "mpat1",
+ "",
+ "mpla2",
+ "mpua2",
+ "mpat2",
+ "",
+ "mpla3",
+ "mpua3",
+ "mpat3",
+ "",
+ "mpla4",
+ "mpua4",
+ "mpat4",
+ "",
+ "mpla5",
+ "mpua5",
+ "mpat5",
+ "",
+ "mpla6",
+ "mpua6",
+ "mpat6",
+ "",
+ "mpla7",
+ "mpua7",
+ "mpat7",
+ "",
/* selID 7. */
- "mpla8", "mpua8", "mpat8", "", "mpla9", "mpua9", "mpat9", "",
- "mpla10", "mpua10", "mpat10", "", "mpla11", "mpua11", "mpat11", "",
- "mpla12", "mpua12", "mpat12", "", "mpla13", "mpua13", "mpat13", "",
- "mpla14", "mpua14", "mpat14", "", "mpla15", "mpua15", "mpat15", "",
+ "mpla8",
+ "mpua8",
+ "mpat8",
+ "",
+ "mpla9",
+ "mpua9",
+ "mpat9",
+ "",
+ "mpla10",
+ "mpua10",
+ "mpat10",
+ "",
+ "mpla11",
+ "mpua11",
+ "mpat11",
+ "",
+ "mpla12",
+ "mpua12",
+ "mpat12",
+ "",
+ "mpla13",
+ "mpua13",
+ "mpat13",
+ "",
+ "mpla14",
+ "mpua14",
+ "mpat14",
+ "",
+ "mpla15",
+ "mpua15",
+ "mpat15",
+ "",
/* Vector Registers */
- "vr0", "vr1", "vr2", "vr3", "vr4", "vr5", "vr6", "vr7",
- "vr8", "vr9", "vr10", "vr11", "vr12", "vr13", "vr14", "vr15",
- "vr16", "vr17", "vr18", "vr19", "vr20", "vr21", "vr22", "vr23",
- "vr24", "vr25", "vr26", "vr27", "vr28", "vr29", "vr30", "vr31",
+ "vr0",
+ "vr1",
+ "vr2",
+ "vr3",
+ "vr4",
+ "vr5",
+ "vr6",
+ "vr7",
+ "vr8",
+ "vr9",
+ "vr10",
+ "vr11",
+ "vr12",
+ "vr13",
+ "vr14",
+ "vr15",
+ "vr16",
+ "vr17",
+ "vr18",
+ "vr19",
+ "vr20",
+ "vr21",
+ "vr22",
+ "vr23",
+ "vr24",
+ "vr25",
+ "vr26",
+ "vr27",
+ "vr28",
+ "vr29",
+ "vr30",
+ "vr31",
};
gdb_static_assert (E_NUM_OF_V850E3V5_REGS
@@ -497,8 +854,7 @@ v850_register_type (struct gdbarch *gdbarch, int regnum)
static int
v850_type_is_scalar (struct type *t)
{
- return (t->code () != TYPE_CODE_STRUCT
- && t->code () != TYPE_CODE_UNION
+ return (t->code () != TYPE_CODE_STRUCT && t->code () != TYPE_CODE_UNION
&& t->code () != TYPE_CODE_ARRAY);
}
@@ -530,9 +886,8 @@ v850_use_struct_convention (struct gdbarch *gdbarch, struct type *type)
/* The value is a structure or union with a single element and that
element is either a single basic type or an array of a single basic
type whose size is greater than or equal to 4 -> returned in register. */
- if ((type->code () == TYPE_CODE_STRUCT
- || type->code () == TYPE_CODE_UNION)
- && type->num_fields () == 1)
+ if ((type->code () == TYPE_CODE_STRUCT || type->code () == TYPE_CODE_UNION)
+ && type->num_fields () == 1)
{
fld_type = type->field (0).type ();
if (v850_type_is_scalar (fld_type) && fld_type->length () >= 4)
@@ -566,7 +921,7 @@ v850_use_struct_convention (struct gdbarch *gdbarch, struct type *type)
}
return 0;
}
-
+
/* The value is a union which contains at least one field which
would be returned in registers according to these rules ->
returned in register. */
@@ -594,7 +949,7 @@ struct reg_list
/* Helper function for v850_scan_prologue to handle prepare instruction. */
static void
-v850_handle_prepare (int insn, int insn2, CORE_ADDR * current_pc_ptr,
+v850_handle_prepare (int insn, int insn2, CORE_ADDR *current_pc_ptr,
struct v850_frame_cache *pi, struct pifsr **pifsr_ptr)
{
CORE_ADDR current_pc = *current_pc_ptr;
@@ -602,29 +957,28 @@ v850_handle_prepare (int insn, int insn2, CORE_ADDR * current_pc_ptr,
long next = insn2 & 0xffff;
long list12 = ((insn & 1) << 16) + (next & 0xffe0);
long offset = (insn & 0x3e) << 1;
- static struct reg_list reg_table[] =
- {
- {0x00800, 20}, /* r20 */
- {0x00400, 21}, /* r21 */
- {0x00200, 22}, /* r22 */
- {0x00100, 23}, /* r23 */
- {0x08000, 24}, /* r24 */
- {0x04000, 25}, /* r25 */
- {0x02000, 26}, /* r26 */
- {0x01000, 27}, /* r27 */
- {0x00080, 28}, /* r28 */
- {0x00040, 29}, /* r29 */
- {0x10000, 30}, /* ep */
- {0x00020, 31}, /* lp */
- {0, 0} /* end of table */
+ static struct reg_list reg_table[] = {
+ { 0x00800, 20 }, /* r20 */
+ { 0x00400, 21 }, /* r21 */
+ { 0x00200, 22 }, /* r22 */
+ { 0x00100, 23 }, /* r23 */
+ { 0x08000, 24 }, /* r24 */
+ { 0x04000, 25 }, /* r25 */
+ { 0x02000, 26 }, /* r26 */
+ { 0x01000, 27 }, /* r27 */
+ { 0x00080, 28 }, /* r28 */
+ { 0x00040, 29 }, /* r29 */
+ { 0x10000, 30 }, /* ep */
+ { 0x00020, 31 }, /* lp */
+ { 0, 0 } /* end of table */
};
int i;
- if ((next & 0x1f) == 0x0b) /* skip imm16 argument */
+ if ((next & 0x1f) == 0x0b) /* skip imm16 argument */
current_pc += 2;
- else if ((next & 0x1f) == 0x13) /* skip imm16 argument */
+ else if ((next & 0x1f) == 0x13) /* skip imm16 argument */
current_pc += 2;
- else if ((next & 0x1f) == 0x1b) /* skip imm32 argument */
+ else if ((next & 0x1f) == 0x1b) /* skip imm32 argument */
current_pc += 4;
/* Calculate the total size of the saved registers, and add it to the
@@ -658,7 +1012,6 @@ v850_handle_prepare (int insn, int insn2, CORE_ADDR * current_pc_ptr,
*pifsr_ptr = pifsr;
}
-
/* Helper function for v850_scan_prologue to handle pushm/pushl instructions.
The SR bit of the register list is not supported. gcc does not generate
this bit. */
@@ -670,45 +1023,43 @@ v850_handle_pushm (int insn, int insn2, struct v850_frame_cache *pi,
struct pifsr *pifsr = *pifsr_ptr;
long list12 = ((insn & 0x0f) << 16) + (insn2 & 0xfff0);
long offset = 0;
- static struct reg_list pushml_reg_table[] =
- {
- {0x80000, E_PS_REGNUM}, /* PSW */
- {0x40000, 1}, /* r1 */
- {0x20000, 2}, /* r2 */
- {0x10000, 3}, /* r3 */
- {0x00800, 4}, /* r4 */
- {0x00400, 5}, /* r5 */
- {0x00200, 6}, /* r6 */
- {0x00100, 7}, /* r7 */
- {0x08000, 8}, /* r8 */
- {0x04000, 9}, /* r9 */
- {0x02000, 10}, /* r10 */
- {0x01000, 11}, /* r11 */
- {0x00080, 12}, /* r12 */
- {0x00040, 13}, /* r13 */
- {0x00020, 14}, /* r14 */
- {0x00010, 15}, /* r15 */
- {0, 0} /* end of table */
+ static struct reg_list pushml_reg_table[] = {
+ { 0x80000, E_PS_REGNUM }, /* PSW */
+ { 0x40000, 1 }, /* r1 */
+ { 0x20000, 2 }, /* r2 */
+ { 0x10000, 3 }, /* r3 */
+ { 0x00800, 4 }, /* r4 */
+ { 0x00400, 5 }, /* r5 */
+ { 0x00200, 6 }, /* r6 */
+ { 0x00100, 7 }, /* r7 */
+ { 0x08000, 8 }, /* r8 */
+ { 0x04000, 9 }, /* r9 */
+ { 0x02000, 10 }, /* r10 */
+ { 0x01000, 11 }, /* r11 */
+ { 0x00080, 12 }, /* r12 */
+ { 0x00040, 13 }, /* r13 */
+ { 0x00020, 14 }, /* r14 */
+ { 0x00010, 15 }, /* r15 */
+ { 0, 0 } /* end of table */
};
- static struct reg_list pushmh_reg_table[] =
- {
- {0x80000, 16}, /* r16 */
- {0x40000, 17}, /* r17 */
- {0x20000, 18}, /* r18 */
- {0x10000, 19}, /* r19 */
- {0x00800, 20}, /* r20 */
- {0x00400, 21}, /* r21 */
- {0x00200, 22}, /* r22 */
- {0x00100, 23}, /* r23 */
- {0x08000, 24}, /* r24 */
- {0x04000, 25}, /* r25 */
- {0x02000, 26}, /* r26 */
- {0x01000, 27}, /* r27 */
- {0x00080, 28}, /* r28 */
- {0x00040, 29}, /* r29 */
- {0x00010, 30}, /* r30 */
- {0x00020, 31}, /* r31 */
- {0, 0} /* end of table */
+ static struct reg_list pushmh_reg_table[] = {
+ { 0x80000, 16 }, /* r16 */
+ { 0x40000, 17 }, /* r17 */
+ { 0x20000, 18 }, /* r18 */
+ { 0x10000, 19 }, /* r19 */
+ { 0x00800, 20 }, /* r20 */
+ { 0x00400, 21 }, /* r21 */
+ { 0x00200, 22 }, /* r22 */
+ { 0x00100, 23 }, /* r23 */
+ { 0x08000, 24 }, /* r24 */
+ { 0x04000, 25 }, /* r25 */
+ { 0x02000, 26 }, /* r26 */
+ { 0x01000, 27 }, /* r27 */
+ { 0x00080, 28 }, /* r28 */
+ { 0x00040, 29 }, /* r29 */
+ { 0x00010, 30 }, /* r30 */
+ { 0x00020, 31 }, /* r31 */
+ { 0, 0 } /* end of table */
};
struct reg_list *reg_table;
int i;
@@ -755,12 +1106,11 @@ v850_handle_pushm (int insn, int insn2, struct v850_frame_cache *pi,
static int
v850_is_save_register (int reg)
{
- /* The caller-save registers are R2, R20 - R29 and R31. All other
+ /* The caller-save registers are R2, R20 - R29 and R31. All other
registers are either special purpose (PC, SP), argument registers,
or just considered free for use in the caller. */
- return reg == E_R2_REGNUM
- || (reg >= E_R20_REGNUM && reg <= E_R29_REGNUM)
- || reg == E_R31_REGNUM;
+ return reg == E_R2_REGNUM || (reg >= E_R20_REGNUM && reg <= E_R29_REGNUM)
+ || reg == E_R31_REGNUM;
}
/* Scan the prologue of the function that contains PC, and record what
@@ -772,9 +1122,9 @@ v850_is_save_register (int reg)
prologue. */
static CORE_ADDR
-v850_analyze_prologue (struct gdbarch *gdbarch,
- CORE_ADDR func_addr, CORE_ADDR pc,
- struct v850_frame_cache *pi, ULONGEST ctbp)
+v850_analyze_prologue (struct gdbarch *gdbarch, CORE_ADDR func_addr,
+ CORE_ADDR pc, struct v850_frame_cache *pi,
+ ULONGEST ctbp)
{
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
CORE_ADDR prologue_end, current_pc;
@@ -810,73 +1160,73 @@ v850_analyze_prologue (struct gdbarch *gdbarch,
insn = read_memory_integer (current_pc, 2, byte_order);
current_pc += 2;
- if ((insn & 0x0780) >= 0x0600) /* Four byte instruction? */
+ if ((insn & 0x0780) >= 0x0600) /* Four byte instruction? */
{
insn2 = read_memory_integer (current_pc, 2, byte_order);
current_pc += 2;
}
if ((insn & 0xffc0) == ((10 << 11) | 0x0780) && !regsave_func_p)
- { /* jarl <func>,10 */
+ { /* jarl <func>,10 */
long low_disp = insn2 & ~(long) 1;
- long disp = (((((insn & 0x3f) << 16) + low_disp)
- & ~(long) 1) ^ 0x00200000) - 0x00200000;
+ long disp
+ = (((((insn & 0x3f) << 16) + low_disp) & ~(long) 1) ^ 0x00200000)
+ - 0x00200000;
save_pc = current_pc;
save_end = prologue_end;
regsave_func_p = 1;
current_pc += disp - 4;
- prologue_end = (current_pc
- + (2 * 3) /* moves to/from ep */
- + 4 /* addi <const>,sp,sp */
- + 2 /* jmp [r10] */
- + (2 * 12) /* sst.w to save r2, r20-r29, r31 */
- + 20); /* slop area */
+ prologue_end = (current_pc + (2 * 3) /* moves to/from ep */
+ + 4 /* addi <const>,sp,sp */
+ + 2 /* jmp [r10] */
+ + (2 * 12) /* sst.w to save r2, r20-r29, r31 */
+ + 20); /* slop area */
}
else if ((insn & 0xffc0) == 0x0200 && !regsave_func_p)
- { /* callt <imm6> */
+ { /* callt <imm6> */
long adr = ctbp + ((insn & 0x3f) << 1);
save_pc = current_pc;
save_end = prologue_end;
regsave_func_p = 1;
- current_pc = ctbp + (read_memory_unsigned_integer (adr, 2, byte_order)
- & 0xffff);
- prologue_end = (current_pc
- + (2 * 3) /* prepare list2,imm5,sp/imm */
- + 4 /* ctret */
- + 20); /* slop area */
+ current_pc
+ = ctbp
+ + (read_memory_unsigned_integer (adr, 2, byte_order) & 0xffff);
+ prologue_end = (current_pc + (2 * 3) /* prepare list2,imm5,sp/imm */
+ + 4 /* ctret */
+ + 20); /* slop area */
continue;
}
- else if ((insn & 0xffc0) == 0x0780) /* prepare list2,imm5 */
+ else if ((insn & 0xffc0) == 0x0780) /* prepare list2,imm5 */
{
v850_handle_prepare (insn, insn2, &current_pc, pi, &pifsr);
continue;
}
else if (insn == 0x07e0 && regsave_func_p && insn2 == 0x0144)
- { /* ctret after processing register save. */
+ { /* ctret after processing register save. */
current_pc = save_pc;
prologue_end = save_end;
regsave_func_p = 0;
continue;
}
else if ((insn & 0xfff0) == 0x07e0 && (insn2 & 5) == 1)
- { /* pushml, pushmh */
+ { /* pushml, pushmh */
v850_handle_pushm (insn, insn2, pi, &pifsr);
continue;
}
else if ((insn & 0xffe0) == 0x0060 && regsave_func_p)
- { /* jmp after processing register save. */
+ { /* jmp after processing register save. */
current_pc = save_pc;
prologue_end = save_end;
regsave_func_p = 0;
continue;
}
- else if ((insn & 0x07c0) == 0x0780 /* jarl or jr */
- || (insn & 0xffe0) == 0x0060 /* jmp */
- || (insn & 0x0780) == 0x0580) /* branch */
+ else if ((insn & 0x07c0) == 0x0780 /* jarl or jr */
+ || (insn & 0xffe0) == 0x0060 /* jmp */
+ || (insn & 0x0780) == 0x0580) /* branch */
{
- break; /* Ran into end of prologue. */
+ break; /* Ran into end of prologue. */
}
else if ((insn & 0xffe0) == ((E_SP_REGNUM << 11) | 0x0240))
@@ -894,7 +1244,8 @@ v850_analyze_prologue (struct gdbarch *gdbarch,
else if (insn == ((E_R12_REGNUM << 11) | 0x0620 | E_R12_REGNUM))
/* movea lo(const),r12,r12 */
r12_tmp += insn2;
- else if (insn == ((E_SP_REGNUM << 11) | 0x01c0 | E_R12_REGNUM) && r12_tmp)
+ else if (insn == ((E_SP_REGNUM << 11) | 0x01c0 | E_R12_REGNUM)
+ && r12_tmp)
/* add r12,sp */
pi->sp_offset += r12_tmp;
else if (insn == ((E_EP_REGNUM << 11) | 0x0000 | E_SP_REGNUM))
@@ -903,11 +1254,9 @@ v850_analyze_prologue (struct gdbarch *gdbarch,
else if (insn == ((E_EP_REGNUM << 11) | 0x0000 | E_R1_REGNUM))
/* mov r1,ep */
ep_used = 0;
- else if (((insn & 0x07ff) == (0x0760 | E_SP_REGNUM)
- || (pi->uses_fp
- && (insn & 0x07ff) == (0x0760 | E_FP_REGNUM)))
- && pifsr
- && v850_is_save_register (reg = (insn >> 11) & 0x1f))
+ else if (((insn & 0x07ff) == (0x0760 | E_SP_REGNUM)
+ || (pi->uses_fp && (insn & 0x07ff) == (0x0760 | E_FP_REGNUM)))
+ && pifsr && v850_is_save_register (reg = (insn >> 11) & 0x1f))
{
/* st.w <reg>,<offset>[sp] or st.w <reg>,<offset>[fp] */
pifsr->reg = reg;
@@ -915,9 +1264,7 @@ v850_analyze_prologue (struct gdbarch *gdbarch,
pifsr->cur_frameoffset = pi->sp_offset;
pifsr++;
}
- else if (ep_used
- && ((insn & 0x0781) == 0x0501)
- && pifsr
+ else if (ep_used && ((insn & 0x0781) == 0x0501) && pifsr
&& v850_is_save_register (reg = (insn >> 11) & 0x1f))
{
/* sst.w <reg>,<offset>[ep] */
@@ -1006,13 +1353,9 @@ v850_frame_align (struct gdbarch *ignore, CORE_ADDR sp)
Stack space for the args has NOT been allocated: that job is up to us. */
static CORE_ADDR
-v850_push_dummy_call (struct gdbarch *gdbarch,
- struct value *function,
- struct regcache *regcache,
- CORE_ADDR bp_addr,
- int nargs,
- struct value **args,
- CORE_ADDR sp,
+v850_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
+ struct regcache *regcache, CORE_ADDR bp_addr, int nargs,
+ struct value **args, CORE_ADDR sp,
function_call_return_method return_method,
CORE_ADDR struct_addr)
{
@@ -1146,9 +1489,9 @@ v850_store_return_value (struct type *type, struct regcache *regcache,
int len = type->length ();
if (len <= v850_reg_size)
- regcache_cooked_write_unsigned
- (regcache, E_V0_REGNUM,
- extract_unsigned_integer (valbuf, len, byte_order));
+ regcache_cooked_write_unsigned (regcache, E_V0_REGNUM,
+ extract_unsigned_integer (valbuf, len,
+ byte_order));
else if (len <= 2 * v850_reg_size)
{
int i, regnum = E_V0_REGNUM;
@@ -1186,7 +1529,7 @@ v850_sw_breakpoint_from_kind (struct gdbarch *gdbarch, int kind, int *size)
{
*size = kind;
- switch (gdbarch_bfd_arch_info (gdbarch)->mach)
+ switch (gdbarch_bfd_arch_info (gdbarch)->mach)
{
case bfd_mach_v850e2:
case bfd_mach_v850e2v3:
@@ -1295,10 +1638,9 @@ v850_frame_cache (frame_info_ptr this_frame, void **this_cache)
return cache;
}
-
static struct value *
-v850_frame_prev_register (frame_info_ptr this_frame,
- void **this_cache, int regnum)
+v850_frame_prev_register (frame_info_ptr this_frame, void **this_cache,
+ int regnum)
{
struct v850_frame_cache *cache = v850_frame_cache (this_frame, this_cache);
@@ -1317,18 +1659,18 @@ v850_frame_this_id (frame_info_ptr this_frame, void **this_cache,
if (cache->base == 0)
return;
- *this_id = frame_id_build (cache->saved_regs[E_SP_REGNUM].addr (), cache->pc);
+ *this_id
+ = frame_id_build (cache->saved_regs[E_SP_REGNUM].addr (), cache->pc);
}
-static const struct frame_unwind v850_frame_unwind = {
- "v850 prologue",
- NORMAL_FRAME,
- default_frame_unwind_stop_reason,
- v850_frame_this_id,
- v850_frame_prev_register,
- NULL,
- default_frame_sniffer
-};
+static const struct frame_unwind v850_frame_unwind
+ = { "v850 prologue",
+ NORMAL_FRAME,
+ default_frame_unwind_stop_reason,
+ v850_frame_this_id,
+ v850_frame_prev_register,
+ NULL,
+ default_frame_sniffer };
static CORE_ADDR
v850_frame_base_address (frame_info_ptr this_frame, void **this_cache)
@@ -1338,12 +1680,9 @@ v850_frame_base_address (frame_info_ptr this_frame, void **this_cache)
return cache->base;
}
-static const struct frame_base v850_frame_base = {
- &v850_frame_unwind,
- v850_frame_base_address,
- v850_frame_base_address,
- v850_frame_base_address
-};
+static const struct frame_base v850_frame_base
+ = { &v850_frame_unwind, v850_frame_base_address, v850_frame_base_address,
+ v850_frame_base_address };
static struct gdbarch *
v850_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
@@ -1363,11 +1702,9 @@ v850_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
e_machine = 0;
}
-
/* Try to find the architecture in the list of already defined
architectures. */
- for (arches = gdbarch_list_lookup_by_info (arches, &info);
- arches != NULL;
+ for (arches = gdbarch_list_lookup_by_info (arches, &info); arches != NULL;
arches = gdbarch_list_lookup_by_info (arches->next, &info))
{
v850_gdbarch_tdep *tdep
@@ -1461,6 +1798,7 @@ v850_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
}
void _initialize_v850_tdep ();
+
void
_initialize_v850_tdep ()
{
diff --git a/gdb/valarith.c b/gdb/valarith.c
index 1dce9d0f613..ed6814db3c6 100644
--- a/gdb/valarith.c
+++ b/gdb/valarith.c
@@ -64,14 +64,15 @@ find_size_for_pointer_math (struct type *ptr_type)
else
{
const char *name;
-
+
name = ptr_target->name ();
if (name == NULL)
- error (_("Cannot perform pointer math on incomplete types, "
- "try casting to a known type, or void *."));
+ error (_ ("Cannot perform pointer math on incomplete types, "
+ "try casting to a known type, or void *."));
else
- error (_("Cannot perform pointer math on incomplete type \"%s\", "
- "try casting to a known type, or void *."), name);
+ error (_ ("Cannot perform pointer math on incomplete type \"%s\", "
+ "try casting to a known type, or void *."),
+ name);
}
}
return sz;
@@ -91,8 +92,8 @@ value_ptradd (struct value *arg1, LONGEST arg2)
valptrtype = check_typedef (value_type (arg1));
sz = find_size_for_pointer_math (valptrtype);
- result = value_from_pointer (valptrtype,
- value_as_address (arg1) + sz * arg2);
+ result
+ = value_from_pointer (valptrtype, value_as_address (arg1) + sz * arg2);
if (VALUE_LVAL (result) != lval_internalvar)
set_value_component_location (result, arg1);
return result;
@@ -117,15 +118,15 @@ value_ptrdiff (struct value *arg1, struct value *arg2)
if (check_typedef (type1->target_type ())->length ()
!= check_typedef (type2->target_type ())->length ())
- error (_("First argument of `-' is a pointer and "
- "second argument is neither\n"
- "an integer nor a pointer of the same type."));
+ error (_ ("First argument of `-' is a pointer and "
+ "second argument is neither\n"
+ "an integer nor a pointer of the same type."));
sz = type_length_units (check_typedef (type1->target_type ()));
- if (sz == 0)
+ if (sz == 0)
{
- warning (_("Type size unknown, assuming 1. "
- "Try casting to a known type, or void *."));
+ warning (_ ("Type size unknown, assuming 1. "
+ "Try casting to a known type, or void *."));
sz = 1;
}
@@ -162,8 +163,7 @@ value_subscript (struct value *array, LONGEST index)
if (VALUE_LVAL (array) != lval_memory)
return value_subscripted_rvalue (array, index, *lowerbound);
- gdb::optional<LONGEST> upperbound
- = get_discrete_high_bound (range_type);
+ gdb::optional<LONGEST> upperbound = get_discrete_high_bound (range_type);
if (!upperbound.has_value ())
upperbound = -1;
@@ -176,7 +176,7 @@ value_subscript (struct value *array, LONGEST index)
/* Emit warning unless we have an array of unknown size.
An array of unknown size has lowerbound 0 and upperbound -1. */
if (*upperbound > -1)
- warning (_("array or string index out of range"));
+ warning (_ ("array or string index out of range"));
/* fall doing C stuff */
c_style = true;
}
@@ -188,7 +188,7 @@ value_subscript (struct value *array, LONGEST index)
if (c_style)
return value_ind (value_ptradd (array, index));
else
- error (_("not an array or string"));
+ error (_ ("not an array or string"));
}
/* Return the value of EXPR[IDX], expr an aggregate rvalue
@@ -223,11 +223,11 @@ value_subscripted_rvalue (struct value *array, LONGEST index,
|| (VALUE_LVAL (array) != lval_memory && array_upper_bound_undefined))
{
if (type_not_associated (array_type))
- error (_("no such vector element (vector not associated)"));
+ error (_ ("no such vector element (vector not associated)"));
else if (type_not_allocated (array_type))
- error (_("no such vector element (vector not allocated)"));
+ error (_ ("no such vector element (vector not allocated)"));
else
- error (_("no such vector element"));
+ error (_ ("no such vector element"));
}
if (is_dynamic_type (elt_type))
@@ -241,7 +241,6 @@ value_subscripted_rvalue (struct value *array, LONGEST index,
return value_from_component (array, elt_type, elt_offs);
}
-
/* Check to see if either argument is a structure, or a reference to
one. This is called so we know whether to go ahead with the normal
binop or look for a user defined function instead.
@@ -249,8 +248,8 @@ value_subscripted_rvalue (struct value *array, LONGEST index,
For now, we do not overload the `=' operator. */
int
-binop_types_user_defined_p (enum exp_opcode op,
- struct type *type1, struct type *type2)
+binop_types_user_defined_p (enum exp_opcode op, struct type *type1,
+ struct type *type2)
{
if (op == BINOP_ASSIGN)
return 0;
@@ -274,8 +273,8 @@ binop_types_user_defined_p (enum exp_opcode op,
For now, we do not overload the `=' operator. */
int
-binop_user_defined_p (enum exp_opcode op,
- struct value *arg1, struct value *arg2)
+binop_user_defined_p (enum exp_opcode op, struct value *arg1,
+ struct value *arg2)
{
return binop_types_user_defined_p (op, value_type (arg1), value_type (arg2));
}
@@ -311,7 +310,6 @@ static struct value *
value_user_defined_cpp_op (gdb::array_view<value *> args, char *oper,
int *static_memfuncp, enum noside noside)
{
-
struct symbol *symp = NULL;
struct value *valp = NULL;
@@ -332,7 +330,7 @@ value_user_defined_cpp_op (gdb::array_view<value *> args, char *oper,
return value_of_variable (symp, 0);
}
- error (_("Could not find %s."), oper);
+ error (_ ("Could not find %s."), oper);
}
/* Lookup user defined operator NAME. Return a value representing the
@@ -346,12 +344,10 @@ value_user_defined_op (struct value **argp, gdb::array_view<value *> args,
if (current_language->la_language == language_cplus)
{
- result = value_user_defined_cpp_op (args, name, static_memfuncp,
- noside);
+ result = value_user_defined_cpp_op (args, name, static_memfuncp, noside);
}
else
- result = value_struct_elt (argp, args, name, static_memfuncp,
- "structure");
+ result = value_struct_elt (argp, args, name, static_memfuncp, "structure");
return result;
}
@@ -380,7 +376,7 @@ value_x_binop (struct value *arg1, struct value *arg2, enum exp_opcode op,
arg vector and find the right function to call it with. */
if (check_typedef (value_type (arg1))->code () != TYPE_CODE_STRUCT)
- error (_("Can't do that binary op on that type")); /* FIXME be explicit */
+ error (_ ("Can't do that binary op on that type")); /* FIXME be explicit */
value *argvec_storage[3];
gdb::array_view<value *> argvec = argvec_storage;
@@ -465,9 +461,9 @@ value_x_binop (struct value *arg1, struct value *arg2, enum exp_opcode op,
case BINOP_BITWISE_XOR:
strcpy (ptr, "^=");
break;
- case BINOP_MOD: /* invalid */
+ case BINOP_MOD: /* invalid */
default:
- error (_("Invalid binary operation specified."));
+ error (_ ("Invalid binary operation specified."));
}
break;
case BINOP_SUBSCRIPT:
@@ -491,9 +487,9 @@ value_x_binop (struct value *arg1, struct value *arg2, enum exp_opcode op,
case BINOP_LEQ:
strcpy (ptr, "<=");
break;
- case BINOP_MOD: /* invalid */
+ case BINOP_MOD: /* invalid */
default:
- error (_("Invalid binary operation specified."));
+ error (_ ("Invalid binary operation specified."));
}
argvec[0] = value_user_defined_op (&arg1, argvec.slice (1), tstr,
@@ -516,7 +512,7 @@ value_x_binop (struct value *arg1, struct value *arg2, enum exp_opcode op,
= result_type_of_xmethod (argvec[0], argvec.slice (1));
if (return_type == NULL)
- error (_("Xmethod is missing return type."));
+ error (_ ("Xmethod is missing return type."));
return value_zero (return_type, VALUE_LVAL (arg1));
}
return call_xmethod (argvec[0], argvec.slice (1));
@@ -531,8 +527,7 @@ value_x_binop (struct value *arg1, struct value *arg2, enum exp_opcode op,
return call_function_by_hand (argvec[0], NULL,
argvec.slice (1, 2 - static_memfuncp));
}
- throw_error (NOT_FOUND_ERROR,
- _("member function %s not found"), tstr);
+ throw_error (NOT_FOUND_ERROR, _ ("member function %s not found"), tstr);
}
/* We know that arg1 is a structure, so try to find a unary user
@@ -555,7 +550,7 @@ value_x_unop (struct value *arg1, enum exp_opcode op, enum noside noside)
arg vector and find the right function to call it with. */
if (check_typedef (value_type (arg1))->code () != TYPE_CODE_STRUCT)
- error (_("Can't do that unary op on that type")); /* FIXME be explicit */
+ error (_ ("Can't do that unary op on that type")); /* FIXME be explicit */
value *argvec_storage[3];
gdb::array_view<value *> argvec = argvec_storage;
@@ -580,12 +575,12 @@ value_x_unop (struct value *arg1, enum exp_opcode op, enum noside noside)
case UNOP_POSTINCREMENT:
strcpy (ptr, "++");
argvec[2] = value_from_longest (builtin_type (gdbarch)->builtin_int, 0);
- nargs ++;
+ nargs++;
break;
case UNOP_POSTDECREMENT:
strcpy (ptr, "--");
argvec[2] = value_from_longest (builtin_type (gdbarch)->builtin_int, 0);
- nargs ++;
+ nargs++;
break;
case UNOP_LOGICAL_NOT:
strcpy (ptr, "!");
@@ -606,7 +601,7 @@ value_x_unop (struct value *arg1, enum exp_opcode op, enum noside noside)
strcpy (ptr, "->");
break;
default:
- error (_("Invalid unary operation specified."));
+ error (_ ("Invalid unary operation specified."));
}
argvec[0] = value_user_defined_op (&arg1, argvec.slice (1, nargs), tstr,
@@ -629,7 +624,7 @@ value_x_unop (struct value *arg1, enum exp_opcode op, enum noside noside)
= result_type_of_xmethod (argvec[0], argvec[1]);
if (return_type == NULL)
- error (_("Xmethod is missing return type."));
+ error (_ ("Xmethod is missing return type."));
return value_zero (return_type, VALUE_LVAL (arg1));
}
return call_xmethod (argvec[0], argvec[1]);
@@ -641,13 +636,10 @@ value_x_unop (struct value *arg1, enum exp_opcode op, enum noside noside)
return_type = check_typedef (value_type (argvec[0]))->target_type ();
return value_zero (return_type, VALUE_LVAL (arg1));
}
- return call_function_by_hand (argvec[0], NULL,
- argvec.slice (1, nargs));
+ return call_function_by_hand (argvec[0], NULL, argvec.slice (1, nargs));
}
- throw_error (NOT_FOUND_ERROR,
- _("member function %s not found"), tstr);
+ throw_error (NOT_FOUND_ERROR, _ ("member function %s not found"), tstr);
}
-
/* Concatenate two values. One value must be an array; and the other
value must either be an array with the same element type, or be of
@@ -668,8 +660,8 @@ value_concat (struct value *arg1, struct value *arg2)
{
elttype1 = elttype1->target_type ();
if (!get_array_bounds (type1, &low1, &high1))
- error (_("could not determine array bounds on left-hand-side of "
- "array concatenation"));
+ error (_ ("could not determine array bounds on left-hand-side of "
+ "array concatenation"));
}
else
{
@@ -683,8 +675,8 @@ value_concat (struct value *arg1, struct value *arg2)
{
elttype2 = elttype2->target_type ();
if (!get_array_bounds (type2, &low2, &high2))
- error (_("could not determine array bounds on right-hand-side of "
- "array concatenation"));
+ error (_ ("could not determine array bounds on right-hand-side of "
+ "array concatenation"));
}
else
{
@@ -693,13 +685,12 @@ value_concat (struct value *arg1, struct value *arg2)
}
if (!types_equal (elttype1, elttype2))
- error (_("concatenation with different element types"));
+ error (_ ("concatenation with different element types"));
LONGEST lowbound = current_language->c_style_arrays_p () ? 0 : 1;
LONGEST n_elts = (high1 - low1 + 1) + (high2 - low2 + 1);
- struct type *atype = lookup_array_range_type (elttype1,
- lowbound,
- lowbound + n_elts - 1);
+ struct type *atype
+ = lookup_array_range_type (elttype1, lowbound, lowbound + n_elts - 1);
struct value *result = allocate_value (atype);
gdb::array_view<gdb_byte> contents = value_contents_raw (result);
@@ -710,7 +701,7 @@ value_concat (struct value *arg1, struct value *arg2)
return result;
}
-
+
/* Integer exponentiation: V1**V2, where both arguments are
integers. Requires V1 != 0 if V2 < 0. Returns 1 for 0 ** 0. */
@@ -720,19 +711,19 @@ integer_pow (LONGEST v1, LONGEST v2)
if (v2 < 0)
{
if (v1 == 0)
- error (_("Attempt to raise 0 to negative power."));
+ error (_ ("Attempt to raise 0 to negative power."));
else
return 0;
}
- else
+ else
{
/* The Russian Peasant's Algorithm. */
LONGEST v;
-
+
v = 1;
for (;;)
{
- if (v2 & 1L)
+ if (v2 & 1L)
v *= v1;
v2 >>= 1;
if (v2 == 0)
@@ -746,8 +737,8 @@ integer_pow (LONGEST v1, LONGEST v2)
other types if one of them is not floating point. */
static void
value_args_as_target_float (struct value *arg1, struct value *arg2,
- gdb_byte *x, struct type **eff_type_x,
- gdb_byte *y, struct type **eff_type_y)
+ gdb_byte *x, struct type **eff_type_x, gdb_byte *y,
+ struct type **eff_type_y)
{
struct type *type1, *type2;
@@ -762,8 +753,8 @@ value_args_as_target_float (struct value *arg1, struct value *arg2,
/* The DFP extension to the C language does not allow mixing of
* decimal float types with other float types in expressions
* (see WDTR 24732, page 12). */
- error (_("Mixing decimal floating types with "
- "other floating types is not allowed."));
+ error (_ ("Mixing decimal floating types with "
+ "other floating types is not allowed."));
/* Obtain value of arg1, converting from other types if necessary. */
@@ -781,8 +772,8 @@ value_args_as_target_float (struct value *arg1, struct value *arg2,
target_float_from_longest (x, *eff_type_x, value_as_long (arg1));
}
else
- error (_("Don't know how to convert from %s to %s."), type1->name (),
- type2->name ());
+ error (_ ("Don't know how to convert from %s to %s."), type1->name (),
+ type2->name ());
/* Obtain value of arg2, converting from other types if necessary. */
@@ -800,8 +791,8 @@ value_args_as_target_float (struct value *arg1, struct value *arg2,
target_float_from_longest (y, *eff_type_y, value_as_long (arg2));
}
else
- error (_("Don't know how to convert from %s to %s."), type1->name (),
- type2->name ());
+ error (_ ("Don't know how to convert from %s to %s."), type1->name (),
+ type2->name ());
}
/* Assuming at last one of ARG1 or ARG2 is a fixed point value,
@@ -844,26 +835,23 @@ fixed_point_binop (struct value *arg1, struct value *arg2, enum exp_opcode op)
type2 = type1;
}
- v1.read_fixed_point (value_contents (arg1),
- type_byte_order (type1), type1->is_unsigned (),
+ v1.read_fixed_point (value_contents (arg1), type_byte_order (type1),
+ type1->is_unsigned (),
type1->fixed_point_scaling_factor ());
- v2.read_fixed_point (value_contents (arg2),
- type_byte_order (type2), type2->is_unsigned (),
+ v2.read_fixed_point (value_contents (arg2), type_byte_order (type2),
+ type2->is_unsigned (),
type2->fixed_point_scaling_factor ());
}
- auto fixed_point_to_value = [type1] (const gdb_mpq &fp)
- {
- value *fp_val = allocate_value (type1);
+ auto fixed_point_to_value = [type1] (const gdb_mpq &fp) {
+ value *fp_val = allocate_value (type1);
- fp.write_fixed_point
- (value_contents_raw (fp_val),
- type_byte_order (type1),
- type1->is_unsigned (),
- type1->fixed_point_scaling_factor ());
+ fp.write_fixed_point (value_contents_raw (fp_val), type_byte_order (type1),
+ type1->is_unsigned (),
+ type1->fixed_point_scaling_factor ());
- return fp_val;
- };
+ return fp_val;
+ };
switch (op)
{
@@ -892,7 +880,7 @@ fixed_point_binop (struct value *arg1, struct value *arg2, enum exp_opcode op)
case BINOP_DIV:
if (mpq_sgn (v2.val) == 0)
- error (_("Division by zero"));
+ error (_ ("Division by zero"));
mpq_div (res.val, v1.val, v2.val);
val = fixed_point_to_value (res);
break;
@@ -908,7 +896,7 @@ fixed_point_binop (struct value *arg1, struct value *arg2, enum exp_opcode op)
break;
default:
- error (_("Integer-only operation on fixed point number."));
+ error (_ ("Integer-only operation on fixed point number."));
}
return val;
@@ -986,10 +974,10 @@ complex_binop (struct value *arg1, struct value *arg2, enum exp_opcode op)
arg2_imag = value_zero (arg2_type, not_lval);
}
- struct type *comp_type = promotion_type (value_type (arg1_real),
- value_type (arg2_real));
+ struct type *comp_type
+ = promotion_type (value_type (arg1_real), value_type (arg2_real));
if (!can_create_complex_type (comp_type))
- error (_("Argument to complex arithmetic operation not supported."));
+ error (_ ("Argument to complex arithmetic operation not supported."));
arg1_real = value_cast (comp_type, arg1_real);
arg1_imag = value_cast (comp_type, arg1_imag);
@@ -1028,8 +1016,8 @@ complex_binop (struct value *arg1, struct value *arg2, enum exp_opcode op)
promoted. */
arg1 = value_literal_complex (arg1_real, arg1_imag, result_type);
- struct value *numerator = scalar_binop (arg1, conjugate,
- BINOP_MUL);
+ struct value *numerator
+ = scalar_binop (arg1, conjugate, BINOP_MUL);
arg1_real = value_real_part (numerator);
arg1_imag = value_imaginary_part (numerator);
@@ -1062,7 +1050,7 @@ complex_binop (struct value *arg1, struct value *arg2, enum exp_opcode op)
break;
default:
- error (_("Invalid binary operation on numbers."));
+ error (_ ("Invalid binary operation on numbers."));
}
return value_literal_complex (result_real, result_imag, result_type);
@@ -1087,13 +1075,12 @@ type_length_bits (type *type)
false, or errors out. Returns true if valid. */
static bool
-check_valid_shift_count (int op, type *result_type,
- type *shift_count_type, ULONGEST shift_count)
+check_valid_shift_count (int op, type *result_type, type *shift_count_type,
+ ULONGEST shift_count)
{
if (!shift_count_type->is_unsigned () && (LONGEST) shift_count < 0)
{
- auto error_or_warning = [] (const char *msg)
- {
+ auto error_or_warning = [] (const char *msg) {
/* Shifts by a negative amount are always an error in Go. Other
languages are more permissive and their compilers just warn or
have modes to disable the errors. */
@@ -1104,9 +1091,9 @@ check_valid_shift_count (int op, type *result_type,
};
if (op == BINOP_RSH)
- error_or_warning (_("right shift count is negative"));
+ error_or_warning (_ ("right shift count is negative"));
else
- error_or_warning (_("left shift count is negative"));
+ error_or_warning (_ ("left shift count is negative"));
return false;
}
@@ -1118,9 +1105,9 @@ check_valid_shift_count (int op, type *result_type,
if (current_language->la_language != language_go)
{
if (op == BINOP_RSH)
- warning (_("right shift count >= width of type"));
+ warning (_ ("right shift count >= width of type"));
else
- warning (_("left shift count >= width of type"));
+ warning (_ ("left shift count >= width of type"));
}
return false;
}
@@ -1150,13 +1137,11 @@ scalar_binop (struct value *arg1, struct value *arg2, enum exp_opcode op)
|| type2->code () == TYPE_CODE_COMPLEX)
return complex_binop (arg1, arg2, op);
- if ((!is_floating_value (arg1)
- && !is_integral_type (type1)
+ if ((!is_floating_value (arg1) && !is_integral_type (type1)
&& !is_fixed_point_type (type1))
- || (!is_floating_value (arg2)
- && !is_integral_type (type2)
+ || (!is_floating_value (arg2) && !is_integral_type (type2)
&& !is_fixed_point_type (type2)))
- error (_("Argument to arithmetic operation not a number or boolean."));
+ error (_ ("Argument to arithmetic operation not a number or boolean."));
if (is_fixed_point_type (type1) || is_fixed_point_type (type2))
return fixed_point_binop (arg1, arg2, op);
@@ -1171,12 +1156,10 @@ scalar_binop (struct value *arg1, struct value *arg2, enum exp_opcode op)
v1.resize (result_type->length ());
v2.resize (result_type->length ());
- value_args_as_target_float (arg1, arg2,
- v1.data (), &eff_type_v1,
+ value_args_as_target_float (arg1, arg2, v1.data (), &eff_type_v1,
v2.data (), &eff_type_v2);
- target_float_binop (op, v1.data (), eff_type_v1,
- v2.data (), eff_type_v2,
- value_contents_raw (val).data (), result_type);
+ target_float_binop (op, v1.data (), eff_type_v1, v2.data (), eff_type_v2,
+ value_contents_raw (val).data (), result_type);
}
else if (type1->code () == TYPE_CODE_BOOL
|| type2->code () == TYPE_CODE_BOOL)
@@ -1199,17 +1182,17 @@ scalar_binop (struct value *arg1, struct value *arg2, enum exp_opcode op)
case BINOP_BITWISE_XOR:
v = v1 ^ v2;
break;
-
+
case BINOP_EQUAL:
v = v1 == v2;
break;
-
+
case BINOP_NOTEQUAL:
v = v1 != v2;
break;
default:
- error (_("Invalid operation on booleans."));
+ error (_ ("Invalid operation on booleans."));
}
result_type = type1;
@@ -1217,8 +1200,7 @@ scalar_binop (struct value *arg1, struct value *arg2, enum exp_opcode op)
val = allocate_value (result_type);
store_signed_integer (value_contents_raw (val).data (),
result_type->length (),
- type_byte_order (result_type),
- v);
+ type_byte_order (result_type), v);
}
else
/* Integral operations here. */
@@ -1261,7 +1243,7 @@ scalar_binop (struct value *arg1, struct value *arg2, enum exp_opcode op)
if (v2 != 0)
v = v1 / v2;
else
- error (_("Division by zero"));
+ error (_ ("Division by zero"));
break;
case BINOP_EXP:
@@ -1272,7 +1254,7 @@ scalar_binop (struct value *arg1, struct value *arg2, enum exp_opcode op)
if (v2 != 0)
v = v1 % v2;
else
- error (_("Division by zero"));
+ error (_ ("Division by zero"));
break;
case BINOP_MOD:
@@ -1357,14 +1339,13 @@ scalar_binop (struct value *arg1, struct value *arg2, enum exp_opcode op)
break;
default:
- error (_("Invalid binary operation on numbers."));
+ error (_ ("Invalid binary operation on numbers."));
}
val = allocate_value (result_type);
store_unsigned_integer (value_contents_raw (val).data (),
value_type (val)->length (),
- type_byte_order (result_type),
- v);
+ type_byte_order (result_type), v);
}
else
{
@@ -1383,7 +1364,7 @@ scalar_binop (struct value *arg1, struct value *arg2, enum exp_opcode op)
/* Avoid runtime error: signed integer overflow: \
0 - -9223372036854775808 cannot be represented in type
'long int'. */
- v = (ULONGEST)v1 - (ULONGEST)v2;
+ v = (ULONGEST) v1 - (ULONGEST) v2;
break;
case BINOP_MUL:
@@ -1395,7 +1376,7 @@ scalar_binop (struct value *arg1, struct value *arg2, enum exp_opcode op)
if (v2 != 0)
v = v1 / v2;
else
- error (_("Division by zero"));
+ error (_ ("Division by zero"));
break;
case BINOP_EXP:
@@ -1406,7 +1387,7 @@ scalar_binop (struct value *arg1, struct value *arg2, enum exp_opcode op)
if (v2 != 0)
v = v1 % v2;
else
- error (_("Division by zero"));
+ error (_ ("Division by zero"));
break;
case BINOP_MOD:
@@ -1518,14 +1499,13 @@ scalar_binop (struct value *arg1, struct value *arg2, enum exp_opcode op)
break;
default:
- error (_("Invalid binary operation on numbers."));
+ error (_ ("Invalid binary operation on numbers."));
}
val = allocate_value (result_type);
store_signed_integer (value_contents_raw (val).data (),
value_type (val)->length (),
- type_byte_order (result_type),
- v);
+ type_byte_order (result_type), v);
}
}
@@ -1553,7 +1533,7 @@ value_vector_widen (struct value *scalar_value, struct type *vector_type)
&& vector_type->is_vector ());
if (!get_array_bounds (vector_type, &low_bound, &high_bound))
- error (_("Could not determine the vector bounds"));
+ error (_ ("Could not determine the vector bounds"));
eltype = check_typedef (vector_type->target_type ());
elval = value_cast (eltype, scalar_value);
@@ -1564,7 +1544,7 @@ value_vector_widen (struct value *scalar_value, struct type *vector_type)
important bits. */
if (eltype->length () < scalar_type->length ()
&& !value_equal (elval, scalar_value))
- error (_("conversion of scalar to vector involves truncation"));
+ error (_ ("conversion of scalar to vector involves truncation"));
value *val = allocate_value (vector_type);
gdb::array_view<gdb_byte> val_contents = value_contents_writeable (val);
@@ -1591,27 +1571,26 @@ vector_binop (struct value *val1, struct value *val2, enum exp_opcode op)
type1 = check_typedef (value_type (val1));
type2 = check_typedef (value_type (val2));
- t1_is_vec = (type1->code () == TYPE_CODE_ARRAY
- && type1->is_vector ()) ? 1 : 0;
- t2_is_vec = (type2->code () == TYPE_CODE_ARRAY
- && type2->is_vector ()) ? 1 : 0;
+ t1_is_vec
+ = (type1->code () == TYPE_CODE_ARRAY && type1->is_vector ()) ? 1 : 0;
+ t2_is_vec
+ = (type2->code () == TYPE_CODE_ARRAY && type2->is_vector ()) ? 1 : 0;
if (!t1_is_vec || !t2_is_vec)
- error (_("Vector operations are only supported among vectors"));
+ error (_ ("Vector operations are only supported among vectors"));
if (!get_array_bounds (type1, &low_bound1, &high_bound1)
|| !get_array_bounds (type2, &low_bound2, &high_bound2))
- error (_("Could not determine the vector bounds"));
+ error (_ ("Could not determine the vector bounds"));
eltype1 = check_typedef (type1->target_type ());
eltype2 = check_typedef (type2->target_type ());
elsize = eltype1->length ();
- if (eltype1->code () != eltype2->code ()
- || elsize != eltype2->length ()
+ if (eltype1->code () != eltype2->code () || elsize != eltype2->length ()
|| eltype1->is_unsigned () != eltype2->is_unsigned ()
|| low_bound1 != low_bound2 || high_bound1 != high_bound2)
- error (_("Cannot perform operation on vectors with different types"));
+ error (_ ("Cannot perform operation on vectors with different types"));
value *val = allocate_value (type1);
gdb::array_view<gdb_byte> val_contents = value_contents_writeable (val);
@@ -1620,9 +1599,8 @@ vector_binop (struct value *val1, struct value *val2, enum exp_opcode op)
{
value *tmp = value_binop (value_subscript (val1, i),
value_subscript (val2, i), op);
- copy (value_contents_all (tmp),
- val_contents.slice (i * elsize, elsize));
- }
+ copy (value_contents_all (tmp), val_contents.slice (i * elsize, elsize));
+ }
return val;
}
@@ -1635,10 +1613,8 @@ value_binop (struct value *arg1, struct value *arg2, enum exp_opcode op)
struct value *val;
struct type *type1 = check_typedef (value_type (arg1));
struct type *type2 = check_typedef (value_type (arg2));
- int t1_is_vec = (type1->code () == TYPE_CODE_ARRAY
- && type1->is_vector ());
- int t2_is_vec = (type2->code () == TYPE_CODE_ARRAY
- && type2->is_vector ());
+ int t1_is_vec = (type1->code () == TYPE_CODE_ARRAY && type1->is_vector ());
+ int t2_is_vec = (type2->code () == TYPE_CODE_ARRAY && type2->is_vector ());
if (!t1_is_vec && !t2_is_vec)
val = scalar_binop (arg1, arg2, op);
@@ -1649,11 +1625,10 @@ value_binop (struct value *arg1, struct value *arg2, enum exp_opcode op)
/* Widen the scalar operand to a vector. */
struct value **v = t1_is_vec ? &arg2 : &arg1;
struct type *t = t1_is_vec ? type2 : type1;
-
- if (t->code () != TYPE_CODE_FLT
- && t->code () != TYPE_CODE_DECFLOAT
+
+ if (t->code () != TYPE_CODE_FLT && t->code () != TYPE_CODE_DECFLOAT
&& !is_integral_type (t))
- error (_("Argument to operation not a number or boolean."));
+ error (_ ("Argument to operation not a number or boolean."));
/* Replicate the scalar value to make a vector value. */
*v = value_vector_widen (*v, t1_is_vec ? type1 : type2);
@@ -1663,7 +1638,7 @@ value_binop (struct value *arg1, struct value *arg2, enum exp_opcode op)
return val;
}
-
+
/* See value.h. */
bool
@@ -1756,12 +1731,12 @@ value_equal (struct value *arg1, struct value *arg2)
v1.resize (std::max (type1->length (), type2->length ()));
v2.resize (std::max (type1->length (), type2->length ()));
- value_args_as_target_float (arg1, arg2,
- v1.data (), &eff_type_v1,
+ value_args_as_target_float (arg1, arg2, v1.data (), &eff_type_v1,
v2.data (), &eff_type_v2);
- return target_float_compare (v1.data (), eff_type_v1,
- v2.data (), eff_type_v2) == 0;
+ return target_float_compare (v1.data (), eff_type_v1, v2.data (),
+ eff_type_v2)
+ == 0;
}
/* FIXME: Need to promote to either CORE_ADDR or LONGEST, whichever
@@ -1772,8 +1747,7 @@ value_equal (struct value *arg1, struct value *arg2)
return (CORE_ADDR) value_as_long (arg1) == value_as_address (arg2);
else if (code1 == code2
- && ((len = (int) type1->length ())
- == (int) type2->length ()))
+ && ((len = (int) type1->length ()) == (int) type2->length ()))
{
p1 = value_contents (arg1).data ();
p2 = value_contents (arg2).data ();
@@ -1789,7 +1763,7 @@ value_equal (struct value *arg1, struct value *arg2)
return value_strcmp (arg1, arg2) == 0;
}
else
- error (_("Invalid type combination in equality test."));
+ error (_ ("Invalid type combination in equality test."));
}
/* Compare values based on their raw contents. Useful for arrays since
@@ -1807,8 +1781,8 @@ value_equal_contents (struct value *arg1, struct value *arg2)
return (type1->code () == type2->code ()
&& type1->length () == type2->length ()
&& memcmp (value_contents (arg1).data (),
- value_contents (arg2).data (),
- type1->length ()) == 0);
+ value_contents (arg2).data (), type1->length ())
+ == 0);
}
/* Simulate the C operator < by returning 1
@@ -1844,12 +1818,12 @@ value_less (struct value *arg1, struct value *arg2)
v1.resize (std::max (type1->length (), type2->length ()));
v2.resize (std::max (type1->length (), type2->length ()));
- value_args_as_target_float (arg1, arg2,
- v1.data (), &eff_type_v1,
+ value_args_as_target_float (arg1, arg2, v1.data (), &eff_type_v1,
v2.data (), &eff_type_v2);
- return target_float_compare (v1.data (), eff_type_v1,
- v2.data (), eff_type_v2) == -1;
+ return target_float_compare (v1.data (), eff_type_v1, v2.data (),
+ eff_type_v2)
+ == -1;
}
else if (code1 == TYPE_CODE_PTR && code2 == TYPE_CODE_PTR)
return value_as_address (arg1) < value_as_address (arg2);
@@ -1864,11 +1838,11 @@ value_less (struct value *arg1, struct value *arg2)
return value_strcmp (arg1, arg2) < 0;
else
{
- error (_("Invalid type combination in ordering comparison."));
+ error (_ ("Invalid type combination in ordering comparison."));
return 0;
}
}
-
+
/* The unary operators +, - and ~. They free the argument ARG1. */
struct value *
@@ -1884,7 +1858,7 @@ value_pos (struct value *arg1)
|| type->code () == TYPE_CODE_COMPLEX)
return value_from_contents (type, value_contents (arg1).data ());
else
- error (_("Argument to positive operation not a number."));
+ error (_ ("Argument to positive operation not a number."));
}
struct value *
@@ -1907,7 +1881,7 @@ value_neg (struct value *arg1)
LONGEST low_bound, high_bound;
if (!get_array_bounds (type, &low_bound, &high_bound))
- error (_("Could not determine the vector bounds"));
+ error (_ ("Could not determine the vector bounds"));
gdb::array_view<gdb_byte> val_contents = value_contents_writeable (val);
int elt_len = eltype->length ();
@@ -1930,7 +1904,7 @@ value_neg (struct value *arg1)
return value_literal_complex (real, imag, type);
}
else
- error (_("Argument to negate operation not a number."));
+ error (_ ("Argument to negate operation not a number."));
}
struct value *
@@ -1951,7 +1925,7 @@ value_complement (struct value *arg1)
LONGEST low_bound, high_bound;
if (!get_array_bounds (type, &low_bound, &high_bound))
- error (_("Could not determine the vector bounds"));
+ error (_ ("Could not determine the vector bounds"));
val = allocate_value (type);
gdb::array_view<gdb_byte> val_contents = value_contents_writeable (val);
@@ -1975,11 +1949,11 @@ value_complement (struct value *arg1)
return value_literal_complex (real, imag, type);
}
else
- error (_("Argument to complement operation not an integer, boolean."));
+ error (_ ("Argument to complement operation not an integer, boolean."));
return val;
}
-
+
/* The INDEX'th bit of SET value whose value_type is TYPE,
and whose value_contents is valaddr.
Return -1 if out of range, -2 other error. */
@@ -2016,15 +1990,14 @@ value_in (struct value *element, struct value *set)
if (eltype->code () == TYPE_CODE_RANGE)
eltype = eltype->target_type ();
if (settype->code () != TYPE_CODE_SET)
- error (_("Second argument of 'IN' has wrong type"));
- if (eltype->code () != TYPE_CODE_INT
- && eltype->code () != TYPE_CODE_CHAR
+ error (_ ("Second argument of 'IN' has wrong type"));
+ if (eltype->code () != TYPE_CODE_INT && eltype->code () != TYPE_CODE_CHAR
&& eltype->code () != TYPE_CODE_ENUM
&& eltype->code () != TYPE_CODE_BOOL)
- error (_("First argument of 'IN' has wrong type"));
+ error (_ ("First argument of 'IN' has wrong type"));
member = value_bit_index (settype, value_contents (set).data (),
value_as_long (element));
if (member < 0)
- error (_("First argument of 'IN' not in range"));
+ error (_ ("First argument of 'IN' not in range"));
return member;
}
diff --git a/gdb/valops.c b/gdb/valops.c
index c5b16f8d400..9b008755c52 100644
--- a/gdb/valops.c
+++ b/gdb/valops.c
@@ -45,50 +45,51 @@
/* Local functions. */
-static int typecmp (bool staticp, bool varargs, int nargs,
- struct field t1[], const gdb::array_view<value *> t2);
+static int typecmp (bool staticp, bool varargs, int nargs, struct field t1[],
+ const gdb::array_view<value *> t2);
-static struct value *search_struct_field (const char *, struct value *,
+static struct value *search_struct_field (const char *, struct value *,
struct type *, int);
-static struct value *search_struct_method (const char *, struct value **,
- gdb::optional<gdb::array_view<value *>>,
- LONGEST, int *, struct type *);
+static struct value *
+search_struct_method (const char *, struct value **,
+ gdb::optional<gdb::array_view<value *>>, LONGEST, int *,
+ struct type *);
static int find_oload_champ_namespace (gdb::array_view<value *> args,
const char *, const char *,
std::vector<symbol *> *oload_syms,
- badness_vector *,
- const int no_adl);
+ badness_vector *, const int no_adl);
static int find_oload_champ_namespace_loop (gdb::array_view<value *> args,
- const char *, const char *,
- int, std::vector<symbol *> *oload_syms,
+ const char *, const char *, int,
+ std::vector<symbol *> *oload_syms,
badness_vector *, int *,
const int no_adl);
-static int find_oload_champ (gdb::array_view<value *> args,
- size_t num_fns,
- fn_field *methods,
- xmethod_worker_up *xmethods,
+static int find_oload_champ (gdb::array_view<value *> args, size_t num_fns,
+ fn_field *methods, xmethod_worker_up *xmethods,
symbol **functions,
badness_vector *oload_champ_bv);
static int oload_method_static_p (struct fn_field *, int);
-enum oload_classification { STANDARD, NON_STANDARD, INCOMPATIBLE };
+enum oload_classification
+{
+ STANDARD,
+ NON_STANDARD,
+ INCOMPATIBLE
+};
-static enum oload_classification classify_oload_match
- (const badness_vector &, int, int);
+static enum oload_classification classify_oload_match (const badness_vector &,
+ int, int);
-static struct value *value_struct_elt_for_reference (struct type *,
- int, struct type *,
- const char *,
- struct type *,
- int, enum noside);
+static struct value *
+value_struct_elt_for_reference (struct type *, int, struct type *,
+ const char *, struct type *, int, enum noside);
-static struct value *value_namespace_elt (const struct type *,
- const char *, int , enum noside);
+static struct value *value_namespace_elt (const struct type *, const char *,
+ int, enum noside);
static struct value *value_maybe_namespace_elt (const struct type *,
const char *, int,
@@ -99,13 +100,14 @@ static CORE_ADDR allocate_space_in_inferior (int);
static struct value *cast_into_complex (struct type *, struct value *);
bool overload_resolution = false;
+
static void
show_overload_resolution (struct ui_file *file, int from_tty,
- struct cmd_list_element *c,
- const char *value)
+ struct cmd_list_element *c, const char *value)
{
- gdb_printf (file, _("Overload resolution in evaluating "
- "C++ functions is %s.\n"),
+ gdb_printf (file,
+ _ ("Overload resolution in evaluating "
+ "C++ functions is %s.\n"),
value);
}
@@ -123,7 +125,7 @@ find_function_in_inferior (const char *name, struct objfile **objf_p)
{
if (sym.symbol->aclass () != LOC_BLOCK)
{
- error (_("\"%s\" exists in this program but is not a function."),
+ error (_ ("\"%s\" exists in this program but is not a function."),
name);
}
@@ -134,8 +136,7 @@ find_function_in_inferior (const char *name, struct objfile **objf_p)
}
else
{
- struct bound_minimal_symbol msymbol =
- lookup_bound_minimal_symbol (name);
+ struct bound_minimal_symbol msymbol = lookup_bound_minimal_symbol (name);
if (msymbol.minsym != NULL)
{
@@ -157,11 +158,11 @@ find_function_in_inferior (const char *name, struct objfile **objf_p)
else
{
if (!target_has_execution ())
- error (_("evaluation of this expression "
- "requires the target program to be active"));
+ error (_ ("evaluation of this expression "
+ "requires the target program to be active"));
else
- error (_("evaluation of this expression requires the "
- "program to have a function \"%s\"."),
+ error (_ ("evaluation of this expression requires the "
+ "program to have a function \"%s\"."),
name);
}
}
@@ -184,10 +185,10 @@ value_allocate_space_in_inferior (int len)
if (value_logical_not (val))
{
if (!target_has_execution ())
- error (_("No memory available to program now: "
- "you need to start the target first"));
+ error (_ ("No memory available to program now: "
+ "you need to start the target first"));
else
- error (_("No memory available to program: call to malloc failed"));
+ error (_ ("No memory available to program: call to malloc failed"));
}
return val;
}
@@ -223,8 +224,7 @@ value_cast_structs (struct type *type, struct value *v2)
|| t2->code () == TYPE_CODE_UNION)
&& !!"Precondition is that value is of STRUCT or UNION kind");
- if (t1->name () != NULL
- && t2->name () != NULL
+ if (t1->name () != NULL && t2->name () != NULL
&& !strcmp (t1->name (), t2->name ()))
return NULL;
@@ -233,8 +233,7 @@ value_cast_structs (struct type *type, struct value *v2)
offset the pointer rather than just change its type. */
if (t1->name () != NULL)
{
- v = search_struct_field (t1->name (),
- v2, t2, 1);
+ v = search_struct_field (t1->name (), v2, t2, 1);
if (v)
return v;
}
@@ -270,8 +269,7 @@ value_cast_structs (struct type *type, struct value *v2)
/* Try downcasting using information from the destination type
T2. This wouldn't work properly for classes with virtual
bases, but those were handled above. */
- v = search_struct_field (t2->name (),
- value_zero (t1, not_lval), t1, 1);
+ v = search_struct_field (t2->name (), value_zero (t1, not_lval), t1, 1);
if (v)
{
/* Downcasting is possible (t1 is superclass of v2). */
@@ -293,16 +291,14 @@ value_cast_structs (struct type *type, struct value *v2)
ARG2 is itself non-zero. Returns the new pointer or reference. */
struct value *
-value_cast_pointers (struct type *type, struct value *arg2,
- int subclass_check)
+value_cast_pointers (struct type *type, struct value *arg2, int subclass_check)
{
struct type *type1 = check_typedef (type);
struct type *type2 = check_typedef (value_type (arg2));
struct type *t1 = check_typedef (type1->target_type ());
struct type *t2 = check_typedef (type2->target_type ());
- if (t1->code () == TYPE_CODE_STRUCT
- && t2->code () == TYPE_CODE_STRUCT
+ if (t1->code () == TYPE_CODE_STRUCT && t2->code () == TYPE_CODE_STRUCT
&& (subclass_check || !value_logical_not (arg2)))
{
struct value *v2;
@@ -311,8 +307,8 @@ value_cast_pointers (struct type *type, struct value *arg2,
v2 = coerce_ref (arg2);
else
v2 = value_ind (arg2);
- gdb_assert (check_typedef (value_type (v2))->code ()
- == TYPE_CODE_STRUCT && !!"Why did coercion fail?");
+ gdb_assert (check_typedef (value_type (v2))->code () == TYPE_CODE_STRUCT
+ && !!"Why did coercion fail?");
v2 = value_cast_structs (t1, v2);
/* At this point we have what we can have, un-dereference if needed. */
if (v2)
@@ -328,7 +324,7 @@ value_cast_pointers (struct type *type, struct value *arg2,
arg2 = value_copy (arg2);
deprecated_set_value_type (arg2, type);
set_value_enclosing_type (arg2, type);
- set_value_pointed_to_offset (arg2, 0); /* pai: chk_val */
+ set_value_pointed_to_offset (arg2, 0); /* pai: chk_val */
return arg2;
}
@@ -342,14 +338,13 @@ value_to_gdb_mpq (struct value *value)
gdb_mpq result;
if (is_floating_type (type))
{
- double d = target_float_to_host_double (value_contents (value).data (),
- type);
+ double d
+ = target_float_to_host_double (value_contents (value).data (), type);
mpq_set_d (result.val, d);
}
else
{
- gdb_assert (is_integral_type (type)
- || is_fixed_point_type (type));
+ gdb_assert (is_integral_type (type) || is_fixed_point_type (type));
gdb_mpz vz;
vz.read (value_contents (value), type_byte_order (type),
@@ -375,10 +370,9 @@ value_cast_to_fixed_point (struct type *to_type, struct value *from_val)
if (from_type == to_type)
return from_val;
- if (!is_floating_type (from_type)
- && !is_integral_type (from_type)
+ if (!is_floating_type (from_type) && !is_integral_type (from_type)
&& !is_fixed_point_type (from_type))
- error (_("Invalid conversion from type %s to fixed point type %s"),
+ error (_ ("Invalid conversion from type %s to fixed point type %s"),
from_type->name (), to_type->name ());
gdb_mpq vq = value_to_gdb_mpq (from_val);
@@ -392,8 +386,7 @@ value_cast_to_fixed_point (struct type *to_type, struct value *from_val)
/* Finally, create the result value, and pack the unscaled value
in it. */
struct value *result = allocate_value (to_type);
- unscaled.write (value_contents_raw (result),
- type_byte_order (to_type),
+ unscaled.write (value_contents_raw (result), type_byte_order (to_type),
to_type->is_unsigned ());
return result;
@@ -452,7 +445,7 @@ value_cast (struct type *type, struct value *arg2)
if (TYPE_IS_REFERENCE (check_typedef (value_type (arg2))))
/* We deref the value and then do the cast. */
- return value_cast (type, coerce_ref (arg2));
+ return value_cast (type, coerce_ref (arg2));
/* Strip typedefs / resolve stubs in order to get at the type's
code/length, but remember the original type, to use as the
@@ -476,7 +469,8 @@ value_cast (struct type *type, struct value *arg2)
struct type *element_type = type->target_type ();
unsigned element_length = check_typedef (element_type)->length ();
- if (element_length > 0 && type->bounds ()->high.kind () == PROP_UNDEFINED)
+ if (element_length > 0
+ && type->bounds ()->high.kind () == PROP_UNDEFINED)
{
struct type *range_type = type->index_type ();
int val_length = type2->length ();
@@ -486,25 +480,22 @@ value_cast (struct type *type, struct value *arg2)
low_bound = 0, high_bound = 0;
new_length = val_length / element_length;
if (val_length % element_length != 0)
- warning (_("array element type size does not "
- "divide object size in cast"));
+ warning (_ ("array element type size does not "
+ "divide object size in cast"));
/* FIXME-type-allocation: need a way to free this type when
we are done with it. */
- range_type = create_static_range_type (NULL,
- range_type->target_type (),
- low_bound,
- new_length + low_bound - 1);
- deprecated_set_value_type (arg2,
- create_array_type (NULL,
- element_type,
+ range_type
+ = create_static_range_type (NULL, range_type->target_type (),
+ low_bound, new_length + low_bound - 1);
+ deprecated_set_value_type (arg2,
+ create_array_type (NULL, element_type,
range_type));
return arg2;
}
}
if (current_language->c_style_arrays_p ()
- && type2->code () == TYPE_CODE_ARRAY
- && !type2->is_vector ())
+ && type2->code () == TYPE_CODE_ARRAY && !type2->is_vector ())
arg2 = value_coerce_array (arg2);
if (type2->code () == TYPE_CODE_FUNC)
@@ -527,8 +518,7 @@ value_cast (struct type *type, struct value *arg2)
scalar = (code2 == TYPE_CODE_INT || code2 == TYPE_CODE_FLT
|| code2 == TYPE_CODE_DECFLOAT || code2 == TYPE_CODE_ENUM
- || code2 == TYPE_CODE_RANGE
- || is_fixed_point_type (type2));
+ || code2 == TYPE_CODE_RANGE || is_fixed_point_type (type2));
if ((code1 == TYPE_CODE_STRUCT || code1 == TYPE_CODE_UNION)
&& (code2 == TYPE_CODE_STRUCT || code2 == TYPE_CODE_UNION)
@@ -584,16 +574,17 @@ value_cast (struct type *type, struct value *arg2)
sees a cast as a simple reinterpretation of the pointer's
bits. */
if (code2 == TYPE_CODE_PTR)
- longest = extract_unsigned_integer
- (value_contents (arg2), type_byte_order (type2));
+ longest = extract_unsigned_integer (value_contents (arg2),
+ type_byte_order (type2));
else
longest = value_as_long (arg2);
- return value_from_longest (to_type, convert_to_boolean ?
- (LONGEST) (longest ? 1 : 0) : longest);
+ return value_from_longest (to_type, convert_to_boolean
+ ? (LONGEST) (longest ? 1 : 0)
+ : longest);
}
- else if (code1 == TYPE_CODE_PTR && (code2 == TYPE_CODE_INT
- || code2 == TYPE_CODE_ENUM
- || code2 == TYPE_CODE_RANGE))
+ else if (code1 == TYPE_CODE_PTR
+ && (code2 == TYPE_CODE_INT || code2 == TYPE_CODE_ENUM
+ || code2 == TYPE_CODE_RANGE))
{
/* type->length () is the length of a pointer, but we really
want the length of an address! -- we are really dealing with
@@ -612,7 +603,7 @@ value_cast (struct type *type, struct value *arg2)
{
if (longest >= ((LONGEST) 1 << addr_bit)
|| longest <= -((LONGEST) 1 << addr_bit))
- warning (_("value truncated"));
+ warning (_ ("value truncated"));
}
return value_from_longest (to_type, longest);
}
@@ -635,10 +626,10 @@ value_cast (struct type *type, struct value *arg2)
else if (code1 == TYPE_CODE_ARRAY && type->is_vector ()
&& code2 == TYPE_CODE_ARRAY && type2->is_vector ()
&& type->length () != type2->length ())
- error (_("Cannot convert between vector values of different sizes"));
+ error (_ ("Cannot convert between vector values of different sizes"));
else if (code1 == TYPE_CODE_ARRAY && type->is_vector () && scalar
&& type->length () != type2->length ())
- error (_("can only cast scalar to vector of same size"));
+ error (_ ("can only cast scalar to vector of same size"));
else if (code1 == TYPE_CODE_VOID)
{
return value_zero (to_type, not_lval);
@@ -651,7 +642,7 @@ value_cast (struct type *type, struct value *arg2)
arg2 = value_copy (arg2);
deprecated_set_value_type (arg2, to_type);
set_value_enclosing_type (arg2, to_type);
- set_value_pointed_to_offset (arg2, 0); /* pai: chk_val */
+ set_value_pointed_to_offset (arg2, 0); /* pai: chk_val */
return arg2;
}
else if (VALUE_LVAL (arg2) == lval_memory)
@@ -659,8 +650,8 @@ value_cast (struct type *type, struct value *arg2)
else
{
if (current_language->la_language == language_ada)
- error (_("Invalid type conversion."));
- error (_("Invalid cast."));
+ error (_ ("Invalid type conversion."));
+ error (_ ("Invalid cast."));
}
}
@@ -705,16 +696,14 @@ value_reinterpret_cast (struct type *type, struct value *arg)
|| (dest_code == TYPE_CODE_MEMBERPTR && arg_code == TYPE_CODE_INT)
|| (dest_code == TYPE_CODE_INT && arg_code == TYPE_CODE_MEMBERPTR)
|| (dest_code == arg_code
- && (dest_code == TYPE_CODE_PTR
- || dest_code == TYPE_CODE_METHODPTR
+ && (dest_code == TYPE_CODE_PTR || dest_code == TYPE_CODE_METHODPTR
|| dest_code == TYPE_CODE_MEMBERPTR)))
result = value_cast (dest_type, arg);
else
- error (_("Invalid reinterpret_cast"));
+ error (_ ("Invalid reinterpret_cast"));
if (is_ref)
- result = value_cast (type, value_ref (value_ind (result),
- type->code ()));
+ result = value_cast (type, value_ref (value_ind (result), type->code ()));
return result;
}
@@ -725,14 +714,10 @@ value_reinterpret_cast (struct type *type, struct value *arg)
holds the value, then it is the answer. */
static int
-dynamic_cast_check_1 (struct type *desired_type,
- const gdb_byte *valaddr,
- LONGEST embedded_offset,
- CORE_ADDR address,
- struct value *val,
- struct type *search_type,
- CORE_ADDR arg_addr,
- struct type *arg_type,
+dynamic_cast_check_1 (struct type *desired_type, const gdb_byte *valaddr,
+ LONGEST embedded_offset, CORE_ADDR address,
+ struct value *val, struct type *search_type,
+ CORE_ADDR arg_addr, struct type *arg_type,
struct value **result)
{
int i, result_count = 0;
@@ -740,13 +725,13 @@ dynamic_cast_check_1 (struct type *desired_type,
for (i = 0; i < TYPE_N_BASECLASSES (search_type) && result_count < 2; ++i)
{
LONGEST offset = baseclass_offset (search_type, i, valaddr,
- embedded_offset,
- address, val);
+ embedded_offset, address, val);
if (class_types_same_p (desired_type, TYPE_BASECLASS (search_type, i)))
{
if (address + embedded_offset + offset >= arg_addr
- && address + embedded_offset + offset < arg_addr + arg_type->length ())
+ && address + embedded_offset + offset
+ < arg_addr + arg_type->length ())
{
++result_count;
if (!*result)
@@ -755,14 +740,11 @@ dynamic_cast_check_1 (struct type *desired_type,
}
}
else
- result_count += dynamic_cast_check_1 (desired_type,
- valaddr,
- embedded_offset + offset,
- address, val,
- TYPE_BASECLASS (search_type, i),
- arg_addr,
- arg_type,
- result);
+ result_count
+ += dynamic_cast_check_1 (desired_type, valaddr,
+ embedded_offset + offset, address, val,
+ TYPE_BASECLASS (search_type, i), arg_addr,
+ arg_type, result);
}
return result_count;
@@ -773,12 +755,9 @@ dynamic_cast_check_1 (struct type *desired_type,
argument's declared class. */
static int
-dynamic_cast_check_2 (struct type *desired_type,
- const gdb_byte *valaddr,
- LONGEST embedded_offset,
- CORE_ADDR address,
- struct value *val,
- struct type *search_type,
+dynamic_cast_check_2 (struct type *desired_type, const gdb_byte *valaddr,
+ LONGEST embedded_offset, CORE_ADDR address,
+ struct value *val, struct type *search_type,
struct value **result)
{
int i, result_count = 0;
@@ -787,7 +766,7 @@ dynamic_cast_check_2 (struct type *desired_type,
{
LONGEST offset;
- if (! BASETYPE_VIA_PUBLIC (search_type, i))
+ if (!BASETYPE_VIA_PUBLIC (search_type, i))
continue;
offset = baseclass_offset (search_type, i, valaddr, embedded_offset,
@@ -800,12 +779,10 @@ dynamic_cast_check_2 (struct type *desired_type,
address + embedded_offset + offset);
}
else
- result_count += dynamic_cast_check_2 (desired_type,
- valaddr,
- embedded_offset + offset,
- address, val,
- TYPE_BASECLASS (search_type, i),
- result);
+ result_count
+ += dynamic_cast_check_2 (desired_type, valaddr,
+ embedded_offset + offset, address, val,
+ TYPE_BASECLASS (search_type, i), result);
}
return result_count;
@@ -827,24 +804,24 @@ value_dynamic_cast (struct type *type, struct value *arg)
if (resolved_type->code () != TYPE_CODE_PTR
&& !TYPE_IS_REFERENCE (resolved_type))
- error (_("Argument to dynamic_cast must be a pointer or reference type"));
+ error (_ ("Argument to dynamic_cast must be a pointer or reference type"));
if (resolved_type->target_type ()->code () != TYPE_CODE_VOID
&& resolved_type->target_type ()->code () != TYPE_CODE_STRUCT)
- error (_("Argument to dynamic_cast must be pointer to class or `void *'"));
+ error (
+ _ ("Argument to dynamic_cast must be pointer to class or `void *'"));
class_type = check_typedef (resolved_type->target_type ());
if (resolved_type->code () == TYPE_CODE_PTR)
{
if (arg_type->code () != TYPE_CODE_PTR
- && ! (arg_type->code () == TYPE_CODE_INT
- && value_as_long (arg) == 0))
- error (_("Argument to dynamic_cast does not have pointer type"));
+ && !(arg_type->code () == TYPE_CODE_INT && value_as_long (arg) == 0))
+ error (_ ("Argument to dynamic_cast does not have pointer type"));
if (arg_type->code () == TYPE_CODE_PTR)
{
arg_type = check_typedef (arg_type->target_type ());
if (arg_type->code () != TYPE_CODE_STRUCT)
- error (_("Argument to dynamic_cast does "
- "not have pointer to class type"));
+ error (_ ("Argument to dynamic_cast does "
+ "not have pointer to class type"));
}
/* Handle NULL pointers. */
@@ -856,7 +833,7 @@ value_dynamic_cast (struct type *type, struct value *arg)
else
{
if (arg_type->code () != TYPE_CODE_STRUCT)
- error (_("Argument to dynamic_cast does not have class type"));
+ error (_ ("Argument to dynamic_cast does not have class type"));
}
/* If the classes are the same, just return the argument. */
@@ -869,12 +846,13 @@ value_dynamic_cast (struct type *type, struct value *arg)
{
if (is_unique_ancestor (class_type, arg))
return value_cast (type, original_arg);
- error (_("Ambiguous dynamic_cast"));
+ error (_ ("Ambiguous dynamic_cast"));
}
rtti_type = value_rtti_type (arg, &full, &top, &using_enc);
- if (! rtti_type)
- error (_("Couldn't determine value's most derived type for dynamic_cast"));
+ if (!rtti_type)
+ error (
+ _ ("Couldn't determine value's most derived type for dynamic_cast"));
/* Compute the most derived object's address. */
addr = value_address (arg);
@@ -905,14 +883,12 @@ value_dynamic_cast (struct type *type, struct value *arg)
if (dynamic_cast_check_1 (resolved_type->target_type (),
value_contents_for_printing (tem).data (),
value_embedded_offset (tem),
- value_address (tem), tem,
- rtti_type, addr,
- arg_type,
- &result) == 1)
- return value_cast (type,
- is_ref
- ? value_ref (result, resolved_type->code ())
- : value_addr (result));
+ value_address (tem), tem, rtti_type, addr,
+ arg_type, &result)
+ == 1)
+ return value_cast (type, is_ref
+ ? value_ref (result, resolved_type->code ())
+ : value_addr (result));
}
/* The second dynamic check specified in 5.2.7. */
@@ -921,17 +897,16 @@ value_dynamic_cast (struct type *type, struct value *arg)
&& dynamic_cast_check_2 (resolved_type->target_type (),
value_contents_for_printing (tem).data (),
value_embedded_offset (tem),
- value_address (tem), tem,
- rtti_type, &result) == 1)
- return value_cast (type,
- is_ref
- ? value_ref (result, resolved_type->code ())
- : value_addr (result));
+ value_address (tem), tem, rtti_type, &result)
+ == 1)
+ return value_cast (type, is_ref
+ ? value_ref (result, resolved_type->code ())
+ : value_addr (result));
if (resolved_type->code () == TYPE_CODE_PTR)
return value_zero (type, not_lval);
- error (_("dynamic_cast failed"));
+ error (_ ("dynamic_cast failed"));
}
/* Create a not_lval value of numeric type TYPE that is one, and return it. */
@@ -953,7 +928,7 @@ value_one (struct type *type)
LONGEST low_bound, high_bound;
if (!get_array_bounds (type1, &low_bound, &high_bound))
- error (_("Could not determine the vector bounds"));
+ error (_ ("Could not determine the vector bounds"));
val = allocate_value (type);
gdb::array_view<gdb_byte> val_contents = value_contents_writeable (val);
@@ -968,7 +943,7 @@ value_one (struct type *type)
}
else
{
- error (_("Not a numeric type."));
+ error (_ ("Not a numeric type."));
}
/* value_one result is never used for assignments to. */
@@ -988,7 +963,7 @@ get_value_at (struct type *type, CORE_ADDR addr, int lazy)
struct value *val;
if (check_typedef (type)->code () == TYPE_CODE_VOID)
- error (_("Attempt to dereference a generic pointer."));
+ error (_ ("Attempt to dereference a generic pointer."));
val = value_from_contents_and_address (type, NULL, addr);
@@ -1041,9 +1016,8 @@ value_at_lazy (struct type *type, CORE_ADDR addr)
}
void
-read_value_memory (struct value *val, LONGEST bit_offset,
- int stack, CORE_ADDR memaddr,
- gdb_byte *buffer, size_t length)
+read_value_memory (struct value *val, LONGEST bit_offset, int stack,
+ CORE_ADDR memaddr, gdb_byte *buffer, size_t length)
{
ULONGEST xfered_total = 0;
struct gdbarch *arch = get_value_arch (val);
@@ -1057,18 +1031,17 @@ read_value_memory (struct value *val, LONGEST bit_offset,
enum target_xfer_status status;
ULONGEST xfered_partial;
- status = target_xfer_partial (current_inferior ()->top_target (),
- object, NULL,
- buffer + xfered_total * unit_size, NULL,
- memaddr + xfered_total,
- length - xfered_total,
- &xfered_partial);
+ status = target_xfer_partial (current_inferior ()->top_target (), object,
+ NULL, buffer + xfered_total * unit_size,
+ NULL, memaddr + xfered_total,
+ length - xfered_total, &xfered_partial);
if (status == TARGET_XFER_OK)
/* nothing */;
else if (status == TARGET_XFER_UNAVAILABLE)
- mark_value_bits_unavailable (val, (xfered_total * HOST_CHAR_BIT
- + bit_offset),
+ mark_value_bits_unavailable (val,
+ (xfered_total * HOST_CHAR_BIT
+ + bit_offset),
xfered_partial * HOST_CHAR_BIT);
else if (status == TARGET_XFER_EOF)
memory_error (TARGET_XFER_E_IO, memaddr + xfered_total);
@@ -1091,7 +1064,7 @@ value_assign (struct value *toval, struct value *fromval)
struct frame_id old_frame;
if (!deprecated_value_modifiable (toval))
- error (_("Left operand of assignment is not a modifiable lvalue."));
+ error (_ ("Left operand of assignment is not a modifiable lvalue."));
toval = coerce_ref (toval);
@@ -1117,8 +1090,7 @@ value_assign (struct value *toval, struct value *fromval)
{
case lval_internalvar:
set_internalvar (VALUE_INTERNALVAR (toval), fromval);
- return value_of_internalvar (type->arch (),
- VALUE_INTERNALVAR (toval));
+ return value_of_internalvar (type->arch (), VALUE_INTERNALVAR (toval));
case lval_internalvar_component:
{
@@ -1136,10 +1108,8 @@ value_assign (struct value *toval, struct value *fromval)
offset += value_offset (value_parent (toval));
}
- set_internalvar_component (VALUE_INTERNALVAR (toval),
- offset,
- value_bitpos (toval),
- value_bitsize (toval),
+ set_internalvar_component (VALUE_INTERNALVAR (toval), offset,
+ value_bitpos (toval), value_bitsize (toval),
fromval);
}
break;
@@ -1156,10 +1126,9 @@ value_assign (struct value *toval, struct value *fromval)
struct value *parent = value_parent (toval);
changed_addr = value_address (parent) + value_offset (toval);
- changed_len = (value_bitpos (toval)
- + value_bitsize (toval)
+ changed_len = (value_bitpos (toval) + value_bitsize (toval)
+ HOST_CHAR_BIT - 1)
- / HOST_CHAR_BIT;
+ / HOST_CHAR_BIT;
/* If we can read-modify-write exactly the size of the
containing type (e.g. short or int) then do so. This
@@ -1171,8 +1140,8 @@ value_assign (struct value *toval, struct value *fromval)
changed_len = type->length ();
if (changed_len > (int) sizeof (LONGEST))
- error (_("Can't handle bitfields which "
- "don't fit in a %d bit word."),
+ error (_ ("Can't handle bitfields which "
+ "don't fit in a %d bit word."),
(int) sizeof (LONGEST) * HOST_CHAR_BIT);
read_memory (changed_addr, buffer, changed_len);
@@ -1187,7 +1156,8 @@ value_assign (struct value *toval, struct value *fromval)
dest_buffer = value_contents (fromval).data ();
}
- write_memory_with_notification (changed_addr, dest_buffer, changed_len);
+ write_memory_with_notification (changed_addr, dest_buffer,
+ changed_len);
}
break;
@@ -1210,7 +1180,7 @@ value_assign (struct value *toval, struct value *fromval)
value_reg = VALUE_REGNUM (toval);
if (!frame)
- error (_("Value being assigned to is no longer active."));
+ error (_ ("Value being assigned to is no longer active."));
gdbarch = get_frame_arch (frame);
@@ -1222,33 +1192,32 @@ value_assign (struct value *toval, struct value *fromval)
gdb_byte buffer[sizeof (LONGEST)];
int optim, unavail;
- changed_len = (value_bitpos (toval)
- + value_bitsize (toval)
+ changed_len = (value_bitpos (toval) + value_bitsize (toval)
+ HOST_CHAR_BIT - 1)
/ HOST_CHAR_BIT;
if (changed_len > sizeof (LONGEST))
- error (_("Can't handle bitfields which "
- "don't fit in a %d bit word."),
+ error (_ ("Can't handle bitfields which "
+ "don't fit in a %d bit word."),
(int) sizeof (LONGEST) * HOST_CHAR_BIT);
if (!get_frame_register_bytes (frame, value_reg, offset,
- {buffer, changed_len},
- &optim, &unavail))
+ { buffer, changed_len }, &optim,
+ &unavail))
{
if (optim)
throw_error (OPTIMIZED_OUT_ERROR,
- _("value has been optimized out"));
+ _ ("value has been optimized out"));
if (unavail)
throw_error (NOT_AVAILABLE_ERROR,
- _("value is not available"));
+ _ ("value is not available"));
}
modify_field (type, buffer, value_as_long (fromval),
value_bitpos (toval), value_bitsize (toval));
put_frame_register_bytes (frame, value_reg, offset,
- {buffer, changed_len});
+ { buffer, changed_len });
}
else
{
@@ -1263,8 +1232,7 @@ value_assign (struct value *toval, struct value *fromval)
value_contents (fromval).data ());
}
else
- put_frame_register_bytes (frame, value_reg,
- value_offset (toval),
+ put_frame_register_bytes (frame, value_reg, value_offset (toval),
value_contents (fromval));
}
@@ -1285,7 +1253,7 @@ value_assign (struct value *toval, struct value *fromval)
/* Fall through. */
default:
- error (_("Left operand of assignment is not an lvalue."));
+ error (_ ("Left operand of assignment is not an lvalue."));
}
/* Assigning to the stack pointer, frame pointer, and other
@@ -1299,8 +1267,8 @@ value_assign (struct value *toval, struct value *fromval)
case lval_register:
case lval_computed:
- gdb::observers::target_changed.notify
- (current_inferior ()->top_target ());
+ gdb::observers::target_changed.notify (
+ current_inferior ()->top_target ());
/* Having destroyed the frame cache, restore the selected
frame. */
@@ -1322,7 +1290,7 @@ value_assign (struct value *toval, struct value *fromval)
default:
break;
}
-
+
/* If the field does not entirely fill a LONGEST, then zero the sign
bits. If the field is signed, and is negative, then sign
extend. */
@@ -1333,8 +1301,7 @@ value_assign (struct value *toval, struct value *fromval)
LONGEST valmask = (((ULONGEST) 1) << value_bitsize (toval)) - 1;
fieldval &= valmask;
- if (!type->is_unsigned ()
- && (fieldval & (valmask ^ (valmask >> 1))))
+ if (!type->is_unsigned () && (fieldval & (valmask ^ (valmask >> 1))))
fieldval |= ~valmask;
fromval = value_from_longest (type, fieldval);
@@ -1368,9 +1335,9 @@ value_repeat (struct value *arg1, int count)
struct value *val;
if (VALUE_LVAL (arg1) != lval_memory)
- error (_("Only values in memory can be extended with '@'."));
+ error (_ ("Only values in memory can be extended with '@'."));
if (count < 1)
- error (_("Invalid number %d of repetitions."), count);
+ error (_ ("Invalid number %d of repetitions."), count);
val = allocate_repeat_value (value_enclosing_type (arg1), count);
@@ -1390,7 +1357,7 @@ value_of_variable (struct symbol *var, const struct block *b)
frame_info_ptr frame = NULL;
if (symbol_read_needs_frame (var))
- frame = get_selected_frame (_("No frame selected."));
+ frame = get_selected_frame (_ ("No frame selected."));
return read_var_value (var, b, frame);
}
@@ -1426,18 +1393,18 @@ address_of_variable (struct symbol *var, const struct block *b)
frame = frame_find_by_id (VALUE_NEXT_FRAME_ID (val));
gdb_assert (frame);
- regname = gdbarch_register_name (get_frame_arch (frame),
- VALUE_REGNUM (val));
+ regname
+ = gdbarch_register_name (get_frame_arch (frame), VALUE_REGNUM (val));
gdb_assert (regname != nullptr && *regname != '\0');
- error (_("Address requested for identifier "
- "\"%s\" which is in register $%s"),
+ error (_ ("Address requested for identifier "
+ "\"%s\" which is in register $%s"),
var->print_name (), regname);
break;
}
default:
- error (_("Can't take address of \"%s\" which isn't an lvalue."),
+ error (_ ("Can't take address of \"%s\" which isn't an lvalue."),
var->print_name ());
break;
}
@@ -1453,8 +1420,7 @@ value_must_coerce_to_target (struct value *val)
struct type *valtype;
/* The only lval kinds which do not live in target memory. */
- if (VALUE_LVAL (val) != not_lval
- && VALUE_LVAL (val) != lval_internalvar
+ if (VALUE_LVAL (val) != not_lval && VALUE_LVAL (val) != lval_internalvar
&& VALUE_LVAL (val) != lval_xcallable)
return false;
@@ -1524,7 +1490,7 @@ value_coerce_array (struct value *arg1)
arg1 = value_coerce_to_target (arg1);
if (VALUE_LVAL (arg1) != lval_memory)
- error (_("Attempt to take address of value not located in memory."));
+ error (_ ("Attempt to take address of value not located in memory."));
return value_from_pointer (lookup_pointer_type (type->target_type ()),
value_address (arg1));
@@ -1539,7 +1505,7 @@ value_coerce_function (struct value *arg1)
struct value *retval;
if (VALUE_LVAL (arg1) != lval_memory)
- error (_("Attempt to take address of value not located in memory."));
+ error (_ ("Attempt to take address of value not located in memory."));
retval = value_from_pointer (lookup_pointer_type (value_type (arg1)),
value_address (arg1));
@@ -1558,7 +1524,7 @@ value_addr (struct value *arg1)
if (TYPE_IS_REFERENCE (type))
{
if (value_bits_synthetic_pointer (arg1, value_embedded_offset (arg1),
- TARGET_CHAR_BIT * type->length ()))
+ TARGET_CHAR_BIT * type->length ()))
arg1 = coerce_ref (arg1);
else
{
@@ -1566,8 +1532,7 @@ value_addr (struct value *arg1)
keep the same location information, which is efficient, and
allows &(&X) to get the location containing the reference.
Do the same to its enclosing type for consistency. */
- struct type *type_ptr
- = lookup_pointer_type (type->target_type ());
+ struct type *type_ptr = lookup_pointer_type (type->target_type ());
struct type *enclosing_type
= check_typedef (value_enclosing_type (arg1));
struct type *enclosing_type_ptr
@@ -1588,7 +1553,7 @@ value_addr (struct value *arg1)
arg1 = value_coerce_to_target (arg1);
if (VALUE_LVAL (arg1) != lval_memory)
- error (_("Attempt to take address of value not located in memory."));
+ error (_ ("Attempt to take address of value not located in memory."));
/* Get target memory address. */
arg2 = value_from_pointer (lookup_pointer_type (value_type (arg1)),
@@ -1616,8 +1581,7 @@ value_ref (struct value *arg1, enum type_code refcode)
gdb_assert (refcode == TYPE_CODE_REF || refcode == TYPE_CODE_RVALUE_REF);
- if ((type->code () == TYPE_CODE_REF
- || type->code () == TYPE_CODE_RVALUE_REF)
+ if ((type->code () == TYPE_CODE_REF || type->code () == TYPE_CODE_RVALUE_REF)
&& type->code () == refcode)
return arg1;
@@ -1672,18 +1636,18 @@ value_ind (struct value *arg1)
else
{
/* Retrieve the enclosing object pointed to. */
- base_addr = (value_as_address (arg1)
- - value_pointed_to_offset (arg1));
+ base_addr
+ = (value_as_address (arg1) - value_pointed_to_offset (arg1));
}
arg2 = value_at_lazy (enc_type, base_addr);
enc_type = value_type (arg2);
- return readjust_indirect_value_type (arg2, enc_type, base_type,
- arg1, base_addr);
+ return readjust_indirect_value_type (arg2, enc_type, base_type, arg1,
+ base_addr);
}
- error (_("Attempt to take contents of a non-pointer value."));
+ error (_ ("Attempt to take contents of a non-pointer value."));
}
-
+
/* Create a value for an array by allocating space in GDB, copying the
data into that space, and then setting up an array value.
@@ -1709,7 +1673,7 @@ value_array (int lowbound, int highbound, struct value **elemvec)
nelem = highbound - lowbound + 1;
if (nelem <= 0)
{
- error (_("bad array bounds (%d, %d)"), lowbound, highbound);
+ error (_ ("bad array bounds (%d, %d)"), lowbound, highbound);
}
typelength = type_length_units (value_enclosing_type (elemvec[0]));
for (idx = 1; idx < nelem; idx++)
@@ -1717,7 +1681,7 @@ value_array (int lowbound, int highbound, struct value **elemvec)
if (type_length_units (value_enclosing_type (elemvec[idx]))
!= typelength)
{
- error (_("array elements must all be the same size"));
+ error (_ ("array elements must all be the same size"));
}
}
@@ -1779,7 +1743,6 @@ value_string (const char *ptr, ssize_t len, struct type *char_type)
return val;
}
-
/* See if we can pass arguments in T2 to a function which takes arguments
of types T1. T1 is a list of NARGS arguments, and T2 is an array_view
of the values we're trying to pass. If some arguments need coercion of
@@ -1798,8 +1761,8 @@ value_string (const char *ptr, ssize_t len, struct type *char_type)
requested operation is type secure, shouldn't we? FIXME. */
static int
-typecmp (bool staticp, bool varargs, int nargs,
- struct field t1[], gdb::array_view<value *> t2)
+typecmp (bool staticp, bool varargs, int nargs, struct field t1[],
+ gdb::array_view<value *> t2)
{
int i;
@@ -1808,9 +1771,7 @@ typecmp (bool staticp, bool varargs, int nargs,
if (staticp)
t2 = t2.slice (1);
- for (i = 0;
- (i < nargs) && t1[i].type ()->code () != TYPE_CODE_VOID;
- i++)
+ for (i = 0; (i < nargs) && t1[i].type ()->code () != TYPE_CODE_VOID; i++)
{
struct type *tt1, *tt2;
@@ -1822,8 +1783,7 @@ typecmp (bool staticp, bool varargs, int nargs,
if (TYPE_IS_REFERENCE (tt1)
/* We should be doing hairy argument matching, as below. */
- && (check_typedef (tt1->target_type ())->code ()
- == tt2->code ()))
+ && (check_typedef (tt1->target_type ())->code () == tt2->code ()))
{
if (tt2->code () == TYPE_CODE_ARRAY)
t2[i] = value_coerce_array (t2[i]);
@@ -1840,10 +1800,9 @@ typecmp (bool staticp, bool varargs, int nargs,
and the argument will be a pointer to a char. */
while (TYPE_IS_REFERENCE (tt1) || tt1->code () == TYPE_CODE_PTR)
{
- tt1 = check_typedef ( tt1->target_type () );
+ tt1 = check_typedef (tt1->target_type ());
}
- while (tt2->code () == TYPE_CODE_ARRAY
- || tt2->code () == TYPE_CODE_PTR
+ while (tt2->code () == TYPE_CODE_ARRAY || tt2->code () == TYPE_CODE_PTR
|| TYPE_IS_REFERENCE (tt2))
{
tt2 = check_typedef (tt2->target_type ());
@@ -1882,8 +1841,7 @@ struct struct_field_searcher
};
/* See corresponding fields for description of parameters. */
- struct_field_searcher (const char *name,
- struct type *outermost_type,
+ struct_field_searcher (const char *name, struct type *outermost_type,
bool looking_for_baseclass)
: m_name (name),
m_looking_for_baseclass (looking_for_baseclass),
@@ -1900,17 +1858,12 @@ struct struct_field_searcher
can include a list of all the found candidates. */
void search (struct value *arg, LONGEST offset, struct type *type);
- const std::vector<found_field> &fields ()
- {
- return m_fields;
- }
+ const std::vector<found_field> &fields () { return m_fields; }
- struct value *baseclass ()
- {
- return m_baseclass;
- }
+ struct value *baseclass () { return m_baseclass; }
private:
+
/* Update results to include V, a found field/baseclass. */
void update_result (struct value *v, LONGEST boffset);
@@ -1938,7 +1891,7 @@ private:
/* The full path to the struct being inspected. E.g. for field 'x'
defined in class B inherited by class A, we have A and B pushed
on the path. */
- std::vector <struct type *> m_struct_path;
+ std::vector<struct type *> m_struct_path;
};
void
@@ -1952,8 +1905,8 @@ struct_field_searcher::update_result (struct value *v, LONGEST boffset)
/* The result is not ambiguous if all the classes that are
found occupy the same space. */
&& m_last_boffset != boffset)
- error (_("base class '%s' is ambiguous in type '%s'"),
- m_name, TYPE_SAFE_NAME (m_outermost_type));
+ error (_ ("base class '%s' is ambiguous in type '%s'"), m_name,
+ TYPE_SAFE_NAME (m_outermost_type));
m_baseclass = v;
m_last_boffset = boffset;
@@ -1963,34 +1916,34 @@ struct_field_searcher::update_result (struct value *v, LONGEST boffset)
/* The field is not ambiguous if it occupies the same
space. */
if (m_fields.empty () || m_last_boffset != boffset)
- m_fields.push_back ({m_struct_path, v});
+ m_fields.push_back ({ m_struct_path, v });
else
{
- /*Fields can occupy the same space and have the same name (be
+ /*Fields can occupy the same space and have the same name (be
ambiguous). This can happen when fields in two different base
classes are marked [[no_unique_address]] and have the same name.
The C++ standard says that such fields can only occupy the same
space if they are of different type, but we don't rely on that in
the following code. */
bool ambiguous = false, insert = true;
- for (const found_field &field: m_fields)
+ for (const found_field &field : m_fields)
{
- if(field.path.back () != m_struct_path.back ())
+ if (field.path.back () != m_struct_path.back ())
{
- /* Same boffset points to members of different classes.
+ /* Same boffset points to members of different classes.
We have found an ambiguity and should record it. */
ambiguous = true;
}
else
{
- /* We don't need to insert this value again, because a
+ /* We don't need to insert this value again, because a
non-ambiguous path already leads to it. */
insert = false;
break;
}
}
if (ambiguous && insert)
- m_fields.push_back ({m_struct_path, v});
+ m_fields.push_back ({ m_struct_path, v });
}
}
}
@@ -2007,7 +1960,10 @@ struct_field_searcher::search (struct value *arg1, LONGEST offset,
int nbases;
m_struct_path.push_back (type);
- SCOPE_EXIT { m_struct_path.pop_back (); };
+ SCOPE_EXIT
+ {
+ m_struct_path.pop_back ();
+ };
type = check_typedef (type);
nbases = TYPE_N_BASECLASSES (type);
@@ -2030,8 +1986,7 @@ struct_field_searcher::search (struct value *arg1, LONGEST offset,
return;
}
- if (t_field_name
- && t_field_name[0] == '\0')
+ if (t_field_name && t_field_name[0] == '\0')
{
struct type *field_type = type->field (i).type ();
@@ -2075,37 +2030,37 @@ struct_field_searcher::search (struct value *arg1, LONGEST offset,
/* If we are looking for baseclasses, this is what we get when
we hit them. But it could happen that the base part's member
name is not yet filled in. */
- int found_baseclass = (m_looking_for_baseclass
- && TYPE_BASECLASS_NAME (type, i) != NULL
- && (strcmp_iw (m_name, basetype->name ()) == 0));
+ int found_baseclass
+ = (m_looking_for_baseclass && TYPE_BASECLASS_NAME (type, i) != NULL
+ && (strcmp_iw (m_name, basetype->name ()) == 0));
LONGEST boffset = value_embedded_offset (arg1) + offset;
if (BASETYPE_VIA_VIRTUAL (type, i))
{
struct value *v2;
- boffset = baseclass_offset (type, i,
- value_contents_for_printing (arg1).data (),
- value_embedded_offset (arg1) + offset,
- value_address (arg1),
- arg1);
+ boffset
+ = baseclass_offset (type, i,
+ value_contents_for_printing (arg1).data (),
+ value_embedded_offset (arg1) + offset,
+ value_address (arg1), arg1);
/* The virtual base class pointer might have been clobbered
by the user program. Make sure that it still points to a
valid memory location. */
boffset += value_embedded_offset (arg1) + offset;
- if (boffset < 0
- || boffset >= value_enclosing_type (arg1)->length ())
+ if (boffset < 0 || boffset >= value_enclosing_type (arg1)->length ())
{
CORE_ADDR base_addr;
base_addr = value_address (arg1) + boffset;
v2 = value_at_lazy (basetype, base_addr);
- if (target_read_memory (base_addr,
+ if (target_read_memory (base_addr,
value_contents_raw (v2).data (),
- value_type (v2)->length ()) != 0)
- error (_("virtual baseclass botch"));
+ value_type (v2)->length ())
+ != 0)
+ error (_ ("virtual baseclass botch"));
}
else
{
@@ -2139,8 +2094,8 @@ struct_field_searcher::search (struct value *arg1, LONGEST offset,
fields, look for a baseclass named NAME. */
static struct value *
-search_struct_field (const char *name, struct value *arg1,
- struct type *type, int looking_for_baseclass)
+search_struct_field (const char *name, struct value *arg1, struct type *type,
+ int looking_for_baseclass)
{
struct_field_searcher searcher (name, type, looking_for_baseclass);
@@ -2178,15 +2133,13 @@ search_struct_field (const char *name, struct value *arg1,
candidates += string_printf ("\n '%s %s::%s' (%s)",
TYPE_SAFE_NAME (field_type),
- TYPE_SAFE_NAME (struct_type),
- name,
+ TYPE_SAFE_NAME (struct_type), name,
path.c_str ());
}
- error (_("Request for member '%s' is ambiguous in type '%s'."
- " Candidates are:%s"),
- name, TYPE_SAFE_NAME (type),
- candidates.c_str ());
+ error (_ ("Request for member '%s' is ambiguous in type '%s'."
+ " Candidates are:%s"),
+ name, TYPE_SAFE_NAME (type), candidates.c_str ());
}
}
else
@@ -2208,8 +2161,7 @@ search_struct_field (const char *name, struct value *arg1,
static struct value *
search_struct_method (const char *name, struct value **arg1p,
gdb::optional<gdb::array_view<value *>> args,
- LONGEST offset, int *static_memfuncp,
- struct type *type)
+ LONGEST offset, int *static_memfuncp, struct type *type)
{
int i;
struct value *v;
@@ -2228,8 +2180,9 @@ search_struct_method (const char *name, struct value **arg1p,
name_matched = 1;
check_stub_method_group (type, i);
if (j > 0 && !args.has_value ())
- error (_("cannot resolve overloaded method "
- "`%s': no arguments supplied"), name);
+ error (_ ("cannot resolve overloaded method "
+ "`%s': no arguments supplied"),
+ name);
else if (j == 0 && !args.has_value ())
{
v = value_fn_field (arg1p, f, j, type, offset);
@@ -2246,14 +2199,13 @@ search_struct_method (const char *name, struct value **arg1p,
TYPE_FN_FIELD_ARGS (f, j), *args))
{
if (TYPE_FN_FIELD_VIRTUAL_P (f, j))
- return value_virtual_fn_field (arg1p, f, j,
- type, offset);
- if (TYPE_FN_FIELD_STATIC_P (f, j)
- && static_memfuncp)
+ return value_virtual_fn_field (arg1p, f, j, type,
+ offset);
+ if (TYPE_FN_FIELD_STATIC_P (f, j) && static_memfuncp)
*static_memfuncp = 1;
v = value_fn_field (arg1p, f, j, type, offset);
if (v != NULL)
- return v;
+ return v;
}
j--;
}
@@ -2282,13 +2234,14 @@ search_struct_method (const char *name, struct value **arg1p,
gdb::byte_vector tmp (baseclass->length ());
address = value_address (*arg1p);
- if (target_read_memory (address + offset,
- tmp.data (), baseclass->length ()) != 0)
- error (_("virtual baseclass botch"));
+ if (target_read_memory (address + offset, tmp.data (),
+ baseclass->length ())
+ != 0)
+ error (_ ("virtual baseclass botch"));
- base_val = value_from_contents_and_address (baseclass,
- tmp.data (),
- address + offset);
+ base_val
+ = value_from_contents_and_address (baseclass, tmp.data (),
+ address + offset);
base_valaddr = value_contents_for_printing (base_val).data ();
this_offset = 0;
}
@@ -2299,9 +2252,8 @@ search_struct_method (const char *name, struct value **arg1p,
this_offset = offset;
}
- base_offset = baseclass_offset (type, i, base_valaddr,
- this_offset, value_address (base_val),
- base_val);
+ base_offset = baseclass_offset (type, i, base_valaddr, this_offset,
+ value_address (base_val), base_val);
}
else
{
@@ -2309,7 +2261,7 @@ search_struct_method (const char *name, struct value **arg1p,
}
v = search_struct_method (name, arg1p, args, base_offset + offset,
static_memfuncp, TYPE_BASECLASS (type, i));
- if (v == (struct value *) - 1)
+ if (v == (struct value *) -1)
{
name_matched = 1;
}
@@ -2321,7 +2273,7 @@ search_struct_method (const char *name, struct value **arg1p,
}
}
if (name_matched)
- return (struct value *) - 1;
+ return (struct value *) -1;
else
return NULL;
}
@@ -2364,9 +2316,8 @@ value_struct_elt (struct value **argp,
t = check_typedef (value_type (*argp));
}
- if (t->code () != TYPE_CODE_STRUCT
- && t->code () != TYPE_CODE_UNION)
- error (_("Attempt to extract a component of a value that is not a %s."),
+ if (t->code () != TYPE_CODE_STRUCT && t->code () != TYPE_CODE_UNION)
+ error (_ ("Attempt to extract a component of a value that is not a %s."),
err);
/* Assume it's not, unless we see that it is. */
@@ -2394,28 +2345,27 @@ value_struct_elt (struct value **argp,
/* C++: If it was not found as a data field, then try to
return it as a pointer to a method. */
- v = search_struct_method (name, argp, args, 0,
- static_memfuncp, t);
+ v = search_struct_method (name, argp, args, 0, static_memfuncp, t);
- if (v == (struct value *) - 1)
- error (_("Cannot take address of method %s."), name);
+ if (v == (struct value *) -1)
+ error (_ ("Cannot take address of method %s."), name);
else if (v == 0)
{
if (TYPE_NFN_FIELDS (t))
- error (_("There is no member or method named %s."), name);
+ error (_ ("There is no member or method named %s."), name);
else
- error (_("There is no member named %s."), name);
+ error (_ ("There is no member named %s."), name);
}
return v;
}
- v = search_struct_method (name, argp, args, 0,
- static_memfuncp, t);
+ v = search_struct_method (name, argp, args, 0, static_memfuncp, t);
- if (v == (struct value *) - 1)
+ if (v == (struct value *) -1)
{
- error (_("One of the arguments you tried to pass to %s could not "
- "be converted to what the function wants."), name);
+ error (_ ("One of the arguments you tried to pass to %s could not "
+ "be converted to what the function wants."),
+ name);
}
else if (v == 0)
{
@@ -2430,8 +2380,8 @@ value_struct_elt (struct value **argp,
}
if (!v)
- throw_error (NOT_FOUND_ERROR,
- _("Structure has no component named %s."), name);
+ throw_error (NOT_FOUND_ERROR, _ ("Structure has no component named %s."),
+ name);
return v;
}
@@ -2459,9 +2409,8 @@ value_struct_elt_bitpos (struct value **argp, int bitpos, struct type *ftype,
t = check_typedef (value_type (*argp));
}
- if (t->code () != TYPE_CODE_STRUCT
- && t->code () != TYPE_CODE_UNION)
- error (_("Attempt to extract a component of a value that is not a %s."),
+ if (t->code () != TYPE_CODE_STRUCT && t->code () != TYPE_CODE_UNION)
+ error (_ ("Attempt to extract a component of a value that is not a %s."),
err);
for (i = TYPE_N_BASECLASSES (t); i < t->num_fields (); i++)
@@ -2472,7 +2421,7 @@ value_struct_elt_bitpos (struct value **argp, int bitpos, struct type *ftype,
return value_primitive_field (*argp, 0, i, t);
}
- error (_("No field with matching bitpos and type."));
+ error (_ ("No field with matching bitpos and type."));
/* Never hit. */
return NULL;
@@ -2501,9 +2450,8 @@ value_struct_elt_bitpos (struct value **argp, int bitpos, struct type *ftype,
BOFFSET is the offset of the base subobject where the method is found. */
static void
-find_method_list (struct value **argp, const char *method,
- LONGEST offset, struct type *type,
- gdb::array_view<fn_field> *methods,
+find_method_list (struct value **argp, const char *method, LONGEST offset,
+ struct type *type, gdb::array_view<fn_field> *methods,
std::vector<xmethod_worker_up> *xmethods,
struct type **basetype, LONGEST *boffset)
{
@@ -2559,10 +2507,11 @@ find_method_list (struct value **argp, const char *method,
if (BASETYPE_VIA_VIRTUAL (type, i))
{
- base_offset = baseclass_offset (type, i,
- value_contents_for_printing (*argp).data (),
- value_offset (*argp) + offset,
- value_address (*argp), *argp);
+ base_offset
+ = baseclass_offset (type, i,
+ value_contents_for_printing (*argp).data (),
+ value_offset (*argp) + offset,
+ value_address (*argp), *argp);
}
else /* Non-virtual base, simply use bit position from debug
info. */
@@ -2571,8 +2520,8 @@ find_method_list (struct value **argp, const char *method,
}
find_method_list (argp, method, base_offset + offset,
- TYPE_BASECLASS (type, i), methods,
- xmethods, basetype, boffset);
+ TYPE_BASECLASS (type, i), methods, xmethods, basetype,
+ boffset);
}
}
@@ -2613,10 +2562,9 @@ value_find_oload_method_list (struct value **argp, const char *method,
t = check_typedef (value_type (*argp));
}
- if (t->code () != TYPE_CODE_STRUCT
- && t->code () != TYPE_CODE_UNION)
- error (_("Attempt to extract a component of a "
- "value that is not a struct or union"));
+ if (t->code () != TYPE_CODE_STRUCT && t->code () != TYPE_CODE_UNION)
+ error (_ ("Attempt to extract a component of a "
+ "value that is not a struct or union"));
gdb_assert (methods != NULL && xmethods != NULL);
@@ -2624,8 +2572,7 @@ value_find_oload_method_list (struct value **argp, const char *method,
*methods = {};
xmethods->clear ();
- find_method_list (argp, method, 0, t, methods, xmethods,
- basetype, boffset);
+ find_method_list (argp, method, 0, t, methods, xmethods, basetype, boffset);
}
/* Helper function for find_overload_match. If no matches were
@@ -2650,8 +2597,8 @@ incomplete_type_hint (gdb::array_view<value *> args)
if (incomplete_types > 0)
incomplete_arg_names += ", ";
- current_language->print_type (value_type (arg), "", &buffer,
- -1, 0, &type_print_raw_options);
+ current_language->print_type (value_type (arg), "", &buffer, -1, 0,
+ &type_print_raw_options);
incomplete_types++;
incomplete_arg_names += buffer.string ();
@@ -2659,15 +2606,15 @@ incomplete_type_hint (gdb::array_view<value *> args)
}
std::string hint;
if (incomplete_types > 1)
- hint = string_printf (_("\nThe types: '%s' aren't fully known to GDB."
- " Please cast them directly to the desired"
- " typed in the function call."),
- incomplete_arg_names.c_str ());
+ hint = string_printf (_ ("\nThe types: '%s' aren't fully known to GDB."
+ " Please cast them directly to the desired"
+ " typed in the function call."),
+ incomplete_arg_names.c_str ());
else if (incomplete_types == 1)
- hint = string_printf (_("\nThe type: '%s' isn't fully known to GDB."
- " Please cast it directly to the desired"
- " typed in the function call."),
- incomplete_arg_names.c_str ());
+ hint = string_printf (_ ("\nThe type: '%s' isn't fully known to GDB."
+ " Please cast it directly to the desired"
+ " typed in the function call."),
+ incomplete_arg_names.c_str ());
return hint;
}
@@ -2718,11 +2665,10 @@ incomplete_type_hint (gdb::array_view<value *> args)
resolution is permitted. */
int
-find_overload_match (gdb::array_view<value *> args,
- const char *name, enum oload_search_type method,
- struct value **objp, struct symbol *fsym,
- struct value **valp, struct symbol **symp,
- int *staticp, const int no_adl,
+find_overload_match (gdb::array_view<value *> args, const char *name,
+ enum oload_search_type method, struct value **objp,
+ struct symbol *fsym, struct value **valp,
+ struct symbol **symp, int *staticp, const int no_adl,
const enum noside noside)
{
struct value *obj = (objp ? *objp : NULL);
@@ -2783,15 +2729,13 @@ find_overload_match (gdb::array_view<value *> args,
}
/* Retrieve the list of methods with the name NAME. */
- value_find_oload_method_list (&temp, name, 0, &methods,
- &xmethods, &basetype, &boffset);
+ value_find_oload_method_list (&temp, name, 0, &methods, &xmethods,
+ &basetype, &boffset);
/* If this is a method only search, and no methods were found
the search has failed. */
if (method == METHOD && methods.empty () && xmethods.empty ())
- error (_("Couldn't find method %s%s%s"),
- obj_type_name,
- (obj_type_name && *obj_type_name) ? "::" : "",
- name);
+ error (_ ("Couldn't find method %s%s%s"), obj_type_name,
+ (obj_type_name && *obj_type_name) ? "::" : "", name);
/* If we are dealing with stub method types, they should have
been resolved by find_method_list via
value_find_oload_method_list above. */
@@ -2800,66 +2744,62 @@ find_overload_match (gdb::array_view<value *> args,
gdb_assert (TYPE_SELF_TYPE (methods[0].type) != NULL);
src_method_oload_champ
- = find_oload_champ (args,
- methods.size (),
- methods.data (), NULL, NULL,
- &src_method_badness);
-
- src_method_match_quality = classify_oload_match
- (src_method_badness, args.size (),
- oload_method_static_p (methods.data (), src_method_oload_champ));
+ = find_oload_champ (args, methods.size (), methods.data (), NULL,
+ NULL, &src_method_badness);
+
+ src_method_match_quality = classify_oload_match (
+ src_method_badness, args.size (),
+ oload_method_static_p (methods.data (), src_method_oload_champ));
}
if (!xmethods.empty ())
{
ext_method_oload_champ
- = find_oload_champ (args,
- xmethods.size (),
- NULL, xmethods.data (), NULL,
- &ext_method_badness);
- ext_method_match_quality = classify_oload_match (ext_method_badness,
- args.size (), 0);
+ = find_oload_champ (args, xmethods.size (), NULL, xmethods.data (),
+ NULL, &ext_method_badness);
+ ext_method_match_quality
+ = classify_oload_match (ext_method_badness, args.size (), 0);
}
if (src_method_oload_champ >= 0 && ext_method_oload_champ >= 0)
{
switch (compare_badness (ext_method_badness, src_method_badness))
{
- case 0: /* Src method and xmethod are equally good. */
- /* If src method and xmethod are equally good, then
+ case 0: /* Src method and xmethod are equally good. */
+ /* If src method and xmethod are equally good, then
xmethod should be the winner. Hence, fall through to the
case where a xmethod is better than the source
method, except when the xmethod match quality is
non-standard. */
- /* FALLTHROUGH */
- case 1: /* Src method and ext method are incompatible. */
- /* If ext method match is not standard, then let source method
+ /* FALLTHROUGH */
+ case 1: /* Src method and ext method are incompatible. */
+ /* If ext method match is not standard, then let source method
win. Otherwise, fallthrough to let xmethod win. */
- if (ext_method_match_quality != STANDARD)
- {
- method_oload_champ = src_method_oload_champ;
- method_badness = src_method_badness;
- ext_method_oload_champ = -1;
- method_match_quality = src_method_match_quality;
- break;
- }
- /* FALLTHROUGH */
- case 2: /* Ext method is champion. */
- method_oload_champ = ext_method_oload_champ;
- method_badness = ext_method_badness;
- src_method_oload_champ = -1;
- method_match_quality = ext_method_match_quality;
- break;
- case 3: /* Src method is champion. */
- method_oload_champ = src_method_oload_champ;
- method_badness = src_method_badness;
- ext_method_oload_champ = -1;
- method_match_quality = src_method_match_quality;
- break;
- default:
- gdb_assert_not_reached ("Unexpected overload comparison "
- "result");
- break;
+ if (ext_method_match_quality != STANDARD)
+ {
+ method_oload_champ = src_method_oload_champ;
+ method_badness = src_method_badness;
+ ext_method_oload_champ = -1;
+ method_match_quality = src_method_match_quality;
+ break;
+ }
+ /* FALLTHROUGH */
+ case 2: /* Ext method is champion. */
+ method_oload_champ = ext_method_oload_champ;
+ method_badness = ext_method_badness;
+ src_method_oload_champ = -1;
+ method_match_quality = ext_method_match_quality;
+ break;
+ case 3: /* Src method is champion. */
+ method_oload_champ = src_method_oload_champ;
+ method_badness = src_method_badness;
+ ext_method_oload_champ = -1;
+ method_match_quality = src_method_match_quality;
+ break;
+ default:
+ gdb_assert_not_reached ("Unexpected overload comparison "
+ "result");
+ break;
}
}
else if (src_method_oload_champ >= 0)
@@ -2894,8 +2834,7 @@ find_overload_match (gdb::array_view<value *> args,
the function part. Do not try this for non-functions (e.g.
function pointers). */
if (qualified_name
- && (check_typedef (fsym->type ())->code ()
- == TYPE_CODE_FUNC))
+ && (check_typedef (fsym->type ())->code () == TYPE_CODE_FUNC))
{
temp_func = cp_func_name (qualified_name);
@@ -2926,22 +2865,18 @@ find_overload_match (gdb::array_view<value *> args,
return 0;
}
- func_oload_champ = find_oload_champ_namespace (args,
- func_name,
- qualified_name,
- &functions,
- &func_badness,
- no_adl);
+ func_oload_champ
+ = find_oload_champ_namespace (args, func_name, qualified_name,
+ &functions, &func_badness, no_adl);
if (func_oload_champ >= 0)
- func_match_quality = classify_oload_match (func_badness,
- args.size (), 0);
+ func_match_quality
+ = classify_oload_match (func_badness, args.size (), 0);
}
/* Did we find a match ? */
if (method_oload_champ == -1 && func_oload_champ == -1)
- throw_error (NOT_FOUND_ERROR,
- _("No symbol \"%s\" in current context."),
+ throw_error (NOT_FOUND_ERROR, _ ("No symbol \"%s\" in current context."),
name);
/* If we have found both a method match and a function
@@ -2951,29 +2886,29 @@ find_overload_match (gdb::array_view<value *> args,
{
switch (compare_badness (func_badness, method_badness))
{
- case 0: /* Top two contenders are equally good. */
- /* FIXME: GDB does not support the general ambiguous case.
+ case 0: /* Top two contenders are equally good. */
+ /* FIXME: GDB does not support the general ambiguous case.
All candidates should be collected and presented the
user. */
- error (_("Ambiguous overload resolution"));
- break;
- case 1: /* Incomparable top contenders. */
- /* This is an error incompatible candidates
+ error (_ ("Ambiguous overload resolution"));
+ break;
+ case 1: /* Incomparable top contenders. */
+ /* This is an error incompatible candidates
should not have been proposed. */
- error (_("Internal error: incompatible "
- "overload candidates proposed"));
- break;
- case 2: /* Function champion. */
- method_oload_champ = -1;
- match_quality = func_match_quality;
- break;
- case 3: /* Method champion. */
- func_oload_champ = -1;
- match_quality = method_match_quality;
- break;
- default:
- error (_("Internal error: unexpected overload comparison result"));
- break;
+ error (_ ("Internal error: incompatible "
+ "overload candidates proposed"));
+ break;
+ case 2: /* Function champion. */
+ method_oload_champ = -1;
+ match_quality = func_match_quality;
+ break;
+ case 3: /* Method champion. */
+ func_oload_champ = -1;
+ match_quality = method_match_quality;
+ break;
+ default:
+ error (_ ("Internal error: unexpected overload comparison result"));
+ break;
}
}
else
@@ -2989,25 +2924,23 @@ find_overload_match (gdb::array_view<value *> args,
{
std::string hint = incomplete_type_hint (args);
if (method == METHOD)
- error (_("Cannot resolve method %s%s%s to any overloaded instance%s"),
- obj_type_name,
- (obj_type_name && *obj_type_name) ? "::" : "",
+ error (_ ("Cannot resolve method %s%s%s to any overloaded instance%s"),
+ obj_type_name, (obj_type_name && *obj_type_name) ? "::" : "",
name, hint.c_str ());
else
- error (_("Cannot resolve function %s to any overloaded instance%s"),
+ error (_ ("Cannot resolve function %s to any overloaded instance%s"),
func_name, hint.c_str ());
}
else if (match_quality == NON_STANDARD)
{
if (method == METHOD)
- warning (_("Using non-standard conversion to match "
- "method %s%s%s to supplied arguments"),
- obj_type_name,
- (obj_type_name && *obj_type_name) ? "::" : "",
+ warning (_ ("Using non-standard conversion to match "
+ "method %s%s%s to supplied arguments"),
+ obj_type_name, (obj_type_name && *obj_type_name) ? "::" : "",
name);
else
- warning (_("Using non-standard conversion to match "
- "function %s to supplied arguments"),
+ warning (_ ("Using non-standard conversion to match "
+ "function %s to supplied arguments"),
func_name);
}
@@ -3026,12 +2959,12 @@ find_overload_match (gdb::array_view<value *> args,
boffset);
}
else
- *valp = value_fn_field (&temp, methods.data (),
- method_oload_champ, basetype, boffset);
+ *valp = value_fn_field (&temp, methods.data (), method_oload_champ,
+ basetype, boffset);
}
else
- *valp = value_from_xmethod
- (std::move (xmethods[ext_method_oload_champ]));
+ *valp
+ = value_from_xmethod (std::move (xmethods[ext_method_oload_champ]));
}
else
*symp = functions[func_oload_champ];
@@ -3055,7 +2988,7 @@ find_overload_match (gdb::array_view<value *> args,
return 100;
case NON_STANDARD:
return 10;
- default: /* STANDARD */
+ default: /* STANDARD */
return 0;
}
}
@@ -3068,19 +3001,14 @@ find_overload_match (gdb::array_view<value *> args,
static int
find_oload_champ_namespace (gdb::array_view<value *> args,
- const char *func_name,
- const char *qualified_name,
+ const char *func_name, const char *qualified_name,
std::vector<symbol *> *oload_syms,
- badness_vector *oload_champ_bv,
- const int no_adl)
+ badness_vector *oload_champ_bv, const int no_adl)
{
int oload_champ;
- find_oload_champ_namespace_loop (args,
- func_name,
- qualified_name, 0,
- oload_syms, oload_champ_bv,
- &oload_champ,
+ find_oload_champ_namespace_loop (args, func_name, qualified_name, 0,
+ oload_syms, oload_champ_bv, &oload_champ,
no_adl);
return oload_champ;
@@ -3095,12 +3023,10 @@ find_oload_champ_namespace (gdb::array_view<value *> args,
static int
find_oload_champ_namespace_loop (gdb::array_view<value *> args,
const char *func_name,
- const char *qualified_name,
- int namespace_len,
+ const char *qualified_name, int namespace_len,
std::vector<symbol *> *oload_syms,
badness_vector *oload_champ_bv,
- int *oload_champ,
- const int no_adl)
+ int *oload_champ, const int no_adl)
{
int next_namespace_len = namespace_len;
int searched_deeper = 0;
@@ -3110,10 +3036,10 @@ find_oload_champ_namespace_loop (gdb::array_view<value *> args,
if (next_namespace_len != 0)
{
gdb_assert (qualified_name[next_namespace_len] == ':');
- next_namespace_len += 2;
+ next_namespace_len += 2;
}
- next_namespace_len +=
- cp_find_first_component (qualified_name + next_namespace_len);
+ next_namespace_len
+ += cp_find_first_component (qualified_name + next_namespace_len);
/* First, see if we have a deeper namespace we can search in.
If we get a good match there, use it. */
@@ -3122,11 +3048,10 @@ find_oload_champ_namespace_loop (gdb::array_view<value *> args,
{
searched_deeper = 1;
- if (find_oload_champ_namespace_loop (args,
- func_name, qualified_name,
- next_namespace_len,
- oload_syms, oload_champ_bv,
- oload_champ, no_adl))
+ if (find_oload_champ_namespace_loop (args, func_name, qualified_name,
+ next_namespace_len, oload_syms,
+ oload_champ_bv, oload_champ,
+ no_adl))
{
return 1;
}
@@ -3155,19 +3080,18 @@ find_oload_champ_namespace_loop (gdb::array_view<value *> args,
struct type **arg_types;
/* Prepare list of argument types for overload resolution. */
- arg_types = (struct type **)
- alloca (args.size () * (sizeof (struct type *)));
+ arg_types
+ = (struct type **) alloca (args.size () * (sizeof (struct type *)));
for (ix = 0; ix < args.size (); ix++)
arg_types[ix] = value_type (args[ix]);
- add_symbol_overload_list_adl ({arg_types, args.size ()}, func_name,
+ add_symbol_overload_list_adl ({ arg_types, args.size () }, func_name,
&new_oload_syms);
}
badness_vector new_oload_champ_bv;
- new_oload_champ = find_oload_champ (args,
- new_oload_syms.size (),
- NULL, NULL, new_oload_syms.data (),
- &new_oload_champ_bv);
+ new_oload_champ
+ = find_oload_champ (args, new_oload_syms.size (), NULL, NULL,
+ new_oload_syms.data (), &new_oload_champ_bv);
/* Case 1: We found a good match. Free earlier matches (if any),
and return it. Case 2: We didn't find a good match, but we're
@@ -3177,7 +3101,8 @@ find_oload_champ_namespace_loop (gdb::array_view<value *> args,
it's a bad match. */
if (new_oload_champ != -1
- && classify_oload_match (new_oload_champ_bv, args.size (), 0) == STANDARD)
+ && classify_oload_match (new_oload_champ_bv, args.size (), 0)
+ == STANDARD)
{
*oload_syms = std::move (new_oload_syms);
*oload_champ = new_oload_champ;
@@ -3209,12 +3134,9 @@ find_oload_champ_namespace_loop (gdb::array_view<value *> args,
quality of the match in OLOAD_CHAMP_BV. */
static int
-find_oload_champ (gdb::array_view<value *> args,
- size_t num_fns,
- fn_field *methods,
- xmethod_worker_up *xmethods,
- symbol **functions,
- badness_vector *oload_champ_bv)
+find_oload_champ (gdb::array_view<value *> args, size_t num_fns,
+ fn_field *methods, xmethod_worker_up *xmethods,
+ symbol **functions, badness_vector *oload_champ_bv)
{
/* A measure of how good an overloaded instance is. */
badness_vector bv;
@@ -3255,16 +3177,15 @@ find_oload_champ (gdb::array_view<value *> args,
for (jj = 0; jj < nparms; jj++)
{
type *t = (methods != NULL
- ? (TYPE_FN_FIELD_ARGS (methods, ix)[jj].type ())
- : functions[ix]->type ()->field (jj).type ());
+ ? (TYPE_FN_FIELD_ARGS (methods, ix)[jj].type ())
+ : functions[ix]->type ()->field (jj).type ());
parm_types.push_back (t);
}
}
/* Compare parameter types to supplied argument types. Skip
THIS for static methods. */
- bv = rank_function (parm_types,
- args.slice (static_offset));
+ bv = rank_function (parm_types, args.slice (static_offset));
if (overload_debug)
{
@@ -3273,8 +3194,7 @@ find_oload_champ (gdb::array_view<value *> args,
"Overloaded method instance %s, # of parms %d\n",
methods[ix].physname, (int) parm_types.size ());
else if (xmethods != NULL)
- gdb_printf (gdb_stderr,
- "Xmethod worker, # of parms %d\n",
+ gdb_printf (gdb_stderr, "Xmethod worker, # of parms %d\n",
(int) parm_types.size ());
else
gdb_printf (gdb_stderr,
@@ -3283,14 +3203,12 @@ find_oload_champ (gdb::array_view<value *> args,
functions[ix]->demangled_name (),
(int) parm_types.size ());
- gdb_printf (gdb_stderr,
- "...Badness of length : {%d, %d}\n",
+ gdb_printf (gdb_stderr, "...Badness of length : {%d, %d}\n",
bv[0].rank, bv[0].subrank);
for (jj = 1; jj < bv.size (); jj++)
- gdb_printf (gdb_stderr,
- "...Badness of arg %d : {%d, %d}\n",
- jj, bv[jj].rank, bv[jj].subrank);
+ gdb_printf (gdb_stderr, "...Badness of arg %d : {%d, %d}\n", jj,
+ bv[jj].rank, bv[jj].subrank);
}
if (oload_champ_bv->empty ())
@@ -3302,13 +3220,13 @@ find_oload_champ (gdb::array_view<value *> args,
previous best. */
switch (compare_badness (bv, *oload_champ_bv))
{
- case 0: /* Top two contenders are equally good. */
+ case 0: /* Top two contenders are equally good. */
oload_ambiguous = 1;
break;
- case 1: /* Incomparable top contenders. */
+ case 1: /* Incomparable top contenders. */
oload_ambiguous = 2;
break;
- case 2: /* New champion, record details. */
+ case 2: /* New champion, record details. */
*oload_champ_bv = std::move (bv);
oload_ambiguous = 0;
oload_champ = ix;
@@ -3318,7 +3236,8 @@ find_oload_champ (gdb::array_view<value *> args,
break;
}
if (overload_debug)
- gdb_printf (gdb_stderr, "Overload resolution "
+ gdb_printf (gdb_stderr,
+ "Overload resolution "
"champion is %d, ambiguous? %d\n",
oload_champ, oload_ambiguous);
}
@@ -3341,8 +3260,7 @@ oload_method_static_p (struct fn_field *fns_ptr, int index)
/* Check how good an overload match OLOAD_CHAMP_BV represents. */
static enum oload_classification
-classify_oload_match (const badness_vector &oload_champ_bv,
- int nargs,
+classify_oload_match (const badness_vector &oload_champ_bv, int nargs,
int static_offset)
{
int ix;
@@ -3352,14 +3270,14 @@ classify_oload_match (const badness_vector &oload_champ_bv,
{
/* If this conversion is as bad as INCOMPATIBLE_TYPE_BADNESS
or worse return INCOMPATIBLE. */
- if (compare_ranks (oload_champ_bv[ix],
- INCOMPATIBLE_TYPE_BADNESS) <= 0)
- return INCOMPATIBLE; /* Truly mismatched types. */
+ if (compare_ranks (oload_champ_bv[ix], INCOMPATIBLE_TYPE_BADNESS) <= 0)
+ return INCOMPATIBLE; /* Truly mismatched types. */
/* Otherwise If this conversion is as bad as
NS_POINTER_CONVERSION_BADNESS or worse return NON_STANDARD. */
else if (compare_ranks (oload_champ_bv[ix],
- NS_POINTER_CONVERSION_BADNESS) <= 0)
- worst = NON_STANDARD; /* Non-standard type conversions
+ NS_POINTER_CONVERSION_BADNESS)
+ <= 0)
+ worst = NON_STANDARD; /* Non-standard type conversions
needed. */
}
@@ -3388,7 +3306,7 @@ destructor_name_p (const char *name, struct type *type)
else
len = cp - dname;
if (strlen (name + 1) != len || strncmp (dname, name + 1, len) != 0)
- error (_("name of destructor must equal name of class"));
+ error (_ ("name of destructor must equal name of class"));
else
return 1;
}
@@ -3405,8 +3323,7 @@ enum_constant_from_type (struct type *type, const char *name)
int i;
int name_len = strlen (name);
- gdb_assert (type->code () == TYPE_CODE_ENUM
- && type->is_declared_class ());
+ gdb_assert (type->code () == TYPE_CODE_ENUM && type->is_declared_class ());
for (i = TYPE_N_BASECLASSES (type); i < type->num_fields (); ++i)
{
@@ -3420,15 +3337,13 @@ enum_constant_from_type (struct type *type, const char *name)
/* Look for the trailing "::NAME", since enum class constant
names are qualified here. */
len = strlen (fname);
- if (len + 2 >= name_len
- && fname[len - name_len - 2] == ':'
+ if (len + 2 >= name_len && fname[len - name_len - 2] == ':'
&& fname[len - name_len - 1] == ':'
&& strcmp (&fname[len - name_len], name) == 0)
return value_from_longest (type, type->field (i).loc_enumval ());
}
- error (_("no constant named \"%s\" in enum \"%s\""),
- name, type->name ());
+ error (_ ("no constant named \"%s\" in enum \"%s\""), name, type->name ());
}
/* C++: Given an aggregate type CURTYPE, and a member name NAME,
@@ -3446,18 +3361,17 @@ value_aggregate_elt (struct type *curtype, const char *name,
{
case TYPE_CODE_STRUCT:
case TYPE_CODE_UNION:
- return value_struct_elt_for_reference (curtype, 0, curtype,
- name, expect_type,
- want_address, noside);
+ return value_struct_elt_for_reference (curtype, 0, curtype, name,
+ expect_type, want_address,
+ noside);
case TYPE_CODE_NAMESPACE:
- return value_namespace_elt (curtype, name,
- want_address, noside);
+ return value_namespace_elt (curtype, name, want_address, noside);
case TYPE_CODE_ENUM:
return enum_constant_from_type (curtype, name);
default:
- internal_error (_("non-aggregate type in value_aggregate_elt"));
+ internal_error (_ ("non-aggregate type in value_aggregate_elt"));
}
}
@@ -3482,8 +3396,7 @@ compare_parameters (struct type *t1, struct type *t2, int skip_artificial)
in T1. */
if (skip_artificial)
{
- while (start < t1->num_fields ()
- && TYPE_FIELD_ARTIFICIAL (t1, start))
+ while (start < t1->num_fields () && TYPE_FIELD_ARTIFICIAL (t1, start))
++start;
}
@@ -3503,7 +3416,8 @@ compare_parameters (struct type *t1, struct type *t2, int skip_artificial)
{
if (compare_ranks (rank_one_type (t1->field (start + i).type (),
t2->field (i).type (), NULL),
- EXACT_MATCH_BADNESS) != 0)
+ EXACT_MATCH_BADNESS)
+ != 0)
return 0;
}
@@ -3521,8 +3435,8 @@ compare_parameters (struct type *t1, struct type *t2, int skip_artificial)
is virtual, and return true. If not found, return false. */
static bool
-get_baseclass_offset (struct type *vt, struct type *cls,
- struct value *v, int *boffs, bool *isvirt)
+get_baseclass_offset (struct type *vt, struct type *cls, struct value *v,
+ int *boffs, bool *isvirt)
{
for (int i = 0; i < TYPE_N_BASECLASSES (vt); i++)
{
@@ -3543,7 +3457,7 @@ get_baseclass_offset (struct type *vt, struct type *cls,
if (get_baseclass_offset (check_typedef (t), cls, v, boffs, isvirt))
{
- if (*isvirt == false) /* Add non-virtual base offset. */
+ if (*isvirt == false) /* Add non-virtual base offset. */
{
const gdb_byte *adr = value_contents_for_printing (v).data ();
*boffs += baseclass_offset (vt, i, adr, value_offset (v),
@@ -3566,18 +3480,16 @@ get_baseclass_offset (struct type *vt, struct type *cls,
static struct value *
value_struct_elt_for_reference (struct type *domain, int offset,
struct type *curtype, const char *name,
- struct type *intype,
- int want_address,
+ struct type *intype, int want_address,
enum noside noside)
{
struct type *t = check_typedef (curtype);
int i;
struct value *result;
- if (t->code () != TYPE_CODE_STRUCT
- && t->code () != TYPE_CODE_UNION)
- error (_("Internal error: non-aggregate type "
- "to value_struct_elt_for_reference"));
+ if (t->code () != TYPE_CODE_STRUCT && t->code () != TYPE_CODE_UNION)
+ error (_ ("Internal error: non-aggregate type "
+ "to value_struct_elt_for_reference"));
for (i = t->num_fields () - 1; i >= TYPE_N_BASECLASSES (t); i--)
{
@@ -3593,12 +3505,12 @@ value_struct_elt_for_reference (struct type *domain, int offset,
return v;
}
if (TYPE_FIELD_PACKED (t, i))
- error (_("pointers to bitfield members not allowed"));
+ error (_ ("pointers to bitfield members not allowed"));
if (want_address)
- return value_from_longest
- (lookup_memberptr_type (t->field (i).type (), domain),
- offset + (LONGEST) (t->field (i).loc_bitpos () >> 3));
+ return value_from_longest (
+ lookup_memberptr_type (t->field (i).type (), domain),
+ offset + (LONGEST) (t->field (i).loc_bitpos () >> 3));
else if (noside != EVAL_NORMAL)
return allocate_value (t->field (i).type ());
else
@@ -3633,18 +3545,18 @@ value_struct_elt_for_reference (struct type *domain, int offset,
{
struct type *p = check_typedef (value_type (this_v));
p = check_typedef (p->target_type ());
- if (get_baseclass_offset (p, curtype, this_v,
- &boff, &isvirt))
+ if (get_baseclass_offset (p, curtype, this_v, &boff,
+ &isvirt))
mem_offset += boff;
}
}
tmp = lookup_pointer_type (type->target_type ());
- result = value_from_pointer (tmp,
- value_as_long (v) + mem_offset);
+ result
+ = value_from_pointer (tmp, value_as_long (v) + mem_offset);
return value_ind (result);
}
- error (_("Cannot reference non-static field \"%s\""), name);
+ error (_ ("Cannot reference non-static field \"%s\""), name);
}
}
}
@@ -3678,14 +3590,14 @@ value_struct_elt_for_reference (struct type *domain, int offset,
continue;
if (compare_parameters (TYPE_FN_FIELD_TYPE (f, j), intype, 0)
- || compare_parameters (TYPE_FN_FIELD_TYPE (f, j),
- intype, 1))
+ || compare_parameters (TYPE_FN_FIELD_TYPE (f, j), intype,
+ 1))
break;
}
if (j == len)
- error (_("no member function matches "
- "that type instantiation"));
+ error (_ ("no member function matches "
+ "that type instantiation"));
}
else
{
@@ -3710,21 +3622,22 @@ value_struct_elt_for_reference (struct type *domain, int offset,
/* Desired method is ambiguous if more than one
method is defined. */
if (j != -1 && !TYPE_FN_FIELD_ARTIFICIAL (f, j))
- error (_("non-unique member `%s' requires "
- "type instantiation"), name);
+ error (_ ("non-unique member `%s' requires "
+ "type instantiation"),
+ name);
j = ii;
}
if (j == -1)
- error (_("no matching member function"));
+ error (_ ("no matching member function"));
}
if (TYPE_FN_FIELD_STATIC_P (f, j))
{
- struct symbol *s =
- lookup_symbol (TYPE_FN_FIELD_PHYSNAME (f, j),
- 0, VAR_DOMAIN, 0).symbol;
+ struct symbol *s = lookup_symbol (TYPE_FN_FIELD_PHYSNAME (f, j),
+ 0, VAR_DOMAIN, 0)
+ .symbol;
if (s == NULL)
return NULL;
@@ -3739,23 +3652,24 @@ value_struct_elt_for_reference (struct type *domain, int offset,
{
if (want_address)
{
- result = allocate_value
- (lookup_methodptr_type (TYPE_FN_FIELD_TYPE (f, j)));
- cplus_make_method_ptr (value_type (result),
- value_contents_writeable (result).data (),
- TYPE_FN_FIELD_VOFFSET (f, j), 1);
+ result = allocate_value (
+ lookup_methodptr_type (TYPE_FN_FIELD_TYPE (f, j)));
+ cplus_make_method_ptr (
+ value_type (result),
+ value_contents_writeable (result).data (),
+ TYPE_FN_FIELD_VOFFSET (f, j), 1);
}
else if (noside == EVAL_AVOID_SIDE_EFFECTS)
return allocate_value (TYPE_FN_FIELD_TYPE (f, j));
else
- error (_("Cannot reference virtual member function \"%s\""),
+ error (_ ("Cannot reference virtual member function \"%s\""),
name);
}
else
{
- struct symbol *s =
- lookup_symbol (TYPE_FN_FIELD_PHYSNAME (f, j),
- 0, VAR_DOMAIN, 0).symbol;
+ struct symbol *s = lookup_symbol (TYPE_FN_FIELD_PHYSNAME (f, j),
+ 0, VAR_DOMAIN, 0)
+ .symbol;
if (s == NULL)
return NULL;
@@ -3765,10 +3679,12 @@ value_struct_elt_for_reference (struct type *domain, int offset,
result = v;
else
{
- result = allocate_value (lookup_methodptr_type (TYPE_FN_FIELD_TYPE (f, j)));
- cplus_make_method_ptr (value_type (result),
- value_contents_writeable (result).data (),
- value_address (v), 0);
+ result = allocate_value (
+ lookup_methodptr_type (TYPE_FN_FIELD_TYPE (f, j)));
+ cplus_make_method_ptr (
+ value_type (result),
+ value_contents_writeable (result).data (),
+ value_address (v), 0);
}
}
return result;
@@ -3783,10 +3699,8 @@ value_struct_elt_for_reference (struct type *domain, int offset,
base_offset = 0;
else
base_offset = TYPE_BASECLASS_BITPOS (t, i) / 8;
- v = value_struct_elt_for_reference (domain,
- offset + base_offset,
- TYPE_BASECLASS (t, i),
- name, intype,
+ v = value_struct_elt_for_reference (domain, offset + base_offset,
+ TYPE_BASECLASS (t, i), name, intype,
want_address, noside);
if (v)
return v;
@@ -3796,25 +3710,22 @@ value_struct_elt_for_reference (struct type *domain, int offset,
it up that way; this (frequently) works for types nested inside
classes. */
- return value_maybe_namespace_elt (curtype, name,
- want_address, noside);
+ return value_maybe_namespace_elt (curtype, name, want_address, noside);
}
/* C++: Return the member NAME of the namespace given by the type
CURTYPE. */
static struct value *
-value_namespace_elt (const struct type *curtype,
- const char *name, int want_address,
- enum noside noside)
+value_namespace_elt (const struct type *curtype, const char *name,
+ int want_address, enum noside noside)
{
- struct value *retval = value_maybe_namespace_elt (curtype, name,
- want_address,
- noside);
+ struct value *retval
+ = value_maybe_namespace_elt (curtype, name, want_address, noside);
if (retval == NULL)
- error (_("No symbol \"%s\" in namespace \"%s\"."),
- name, curtype->name ());
+ error (_ ("No symbol \"%s\" in namespace \"%s\"."), name,
+ curtype->name ());
return retval;
}
@@ -3826,9 +3737,8 @@ value_namespace_elt (const struct type *curtype,
to, say, some base class of CURTYPE). */
static struct value *
-value_maybe_namespace_elt (const struct type *curtype,
- const char *name, int want_address,
- enum noside noside)
+value_maybe_namespace_elt (const struct type *curtype, const char *name,
+ int want_address, enum noside noside)
{
const char *namespace_name = curtype->name ();
struct block_symbol sym;
@@ -3857,8 +3767,8 @@ value_maybe_namespace_elt (const struct type *curtype,
and refer to the values computed for the object pointed to. */
struct type *
-value_rtti_indirect_type (struct value *v, int *full,
- LONGEST *top, int *using_enc)
+value_rtti_indirect_type (struct value *v, int *full, LONGEST *top,
+ int *using_enc)
{
struct value *target = NULL;
struct type *type, *real_type, *target_type;
@@ -3869,7 +3779,6 @@ value_rtti_indirect_type (struct value *v, int *full,
target = coerce_ref (v);
else if (type->code () == TYPE_CODE_PTR)
{
-
try
{
target = value_ind (v);
@@ -3902,7 +3811,7 @@ value_rtti_indirect_type (struct value *v, int *full,
else if (type->code () == TYPE_CODE_PTR)
real_type = lookup_pointer_type (real_type);
else
- internal_error (_("Unexpected value type."));
+ internal_error (_ ("Unexpected value type."));
/* Copy qualifiers to the pointer/reference. */
real_type = make_cv_type (TYPE_CONST (type), TYPE_VOLATILE (type),
@@ -3923,9 +3832,7 @@ value_rtti_indirect_type (struct value *v, int *full,
NULL if they're not available. */
struct value *
-value_full_object (struct value *argp,
- struct type *rtype,
- int xfull, int xtop,
+value_full_object (struct value *argp, struct type *rtype, int xfull, int xtop,
int xusing_enc)
{
struct type *real_type;
@@ -3951,8 +3858,7 @@ value_full_object (struct value *argp,
/* In a destructor we might see a real type that is a superclass of
the object's type. In this case it is better to leave the object
as-is. */
- if (full
- && real_type->length () < value_enclosing_type (argp)->length ())
+ if (full && real_type->length () < value_enclosing_type (argp)->length ())
return argp;
/* If we have the full object, but for some reason the enclosing
@@ -3968,8 +3874,8 @@ value_full_object (struct value *argp,
/* Check if object is in memory. */
if (VALUE_LVAL (argp) != lval_memory)
{
- warning (_("Couldn't retrieve complete object of RTTI "
- "type %s; object may be in register(s)."),
+ warning (_ ("Couldn't retrieve complete object of RTTI "
+ "type %s; object may be in register(s)."),
real_type->name ());
return argp;
@@ -3979,16 +3885,16 @@ value_full_object (struct value *argp,
/* Go back by the computed top_offset from the beginning of the
object, adjusting for the embedded offset of argp if that's what
value_rtti_type used for its computation. */
- new_val = value_at_lazy (real_type, value_address (argp) - top +
- (using_enc ? 0 : value_embedded_offset (argp)));
+ new_val = value_at_lazy (real_type,
+ value_address (argp) - top
+ + (using_enc ? 0 : value_embedded_offset (argp)));
deprecated_set_value_type (new_val, value_type (argp));
- set_value_embedded_offset (new_val, (using_enc
- ? top + value_embedded_offset (argp)
- : top));
+ set_value_embedded_offset (new_val,
+ (using_enc ? top + value_embedded_offset (argp)
+ : top));
return new_val;
}
-
/* Return the value of the local variable, if one exists. Throw error
otherwise, such as if the request is made in an inappropriate context. */
@@ -4000,15 +3906,15 @@ value_of_this (const struct language_defn *lang)
frame_info_ptr frame;
if (lang->name_of_this () == NULL)
- error (_("no `this' in current language"));
+ error (_ ("no `this' in current language"));
- frame = get_selected_frame (_("no frame selected"));
+ frame = get_selected_frame (_ ("no frame selected"));
b = get_frame_block (frame, NULL);
sym = lookup_language_this (lang, b);
if (sym.symbol == NULL)
- error (_("current stack frame does not contain a variable named `%s'"),
+ error (_ ("current stack frame does not contain a variable named `%s'"),
lang->name_of_this ());
return read_var_value (sym.symbol, sym.block, frame);
@@ -4048,36 +3954,33 @@ value_slice (struct value *array, int lowbound, int length)
array_type = check_typedef (value_type (array));
if (array_type->code () != TYPE_CODE_ARRAY
&& array_type->code () != TYPE_CODE_STRING)
- error (_("cannot take slice of non-array"));
+ error (_ ("cannot take slice of non-array"));
if (type_not_allocated (array_type))
- error (_("array not allocated"));
+ error (_ ("array not allocated"));
if (type_not_associated (array_type))
- error (_("array not associated"));
+ error (_ ("array not associated"));
range_type = array_type->index_type ();
if (!get_discrete_bounds (range_type, &lowerbound, &upperbound))
- error (_("slice from bad array or bitstring"));
+ error (_ ("slice from bad array or bitstring"));
if (lowbound < lowerbound || length < 0
|| lowbound + length - 1 > upperbound)
- error (_("slice out of range"));
+ error (_ ("slice out of range"));
/* FIXME-type-allocation: need a way to free this type when we are
done with it. */
- slice_range_type = create_static_range_type (NULL,
- range_type->target_type (),
- lowbound,
- lowbound + length - 1);
+ slice_range_type
+ = create_static_range_type (NULL, range_type->target_type (), lowbound,
+ lowbound + length - 1);
{
struct type *element_type = array_type->target_type ();
LONGEST offset
= (lowbound - lowerbound) * check_typedef (element_type)->length ();
- slice_type = create_array_type (NULL,
- element_type,
- slice_range_type);
+ slice_type = create_array_type (NULL, element_type, slice_range_type);
slice_type->set_code (array_type->code ());
if (VALUE_LVAL (array) == lval_memory && value_lazy (array))
@@ -4099,8 +4002,7 @@ value_slice (struct value *array, int lowbound, int length)
/* See value.h. */
struct value *
-value_literal_complex (struct value *arg1,
- struct value *arg2,
+value_literal_complex (struct value *arg1, struct value *arg2,
struct type *type)
{
struct value *val;
@@ -4112,10 +4014,8 @@ value_literal_complex (struct value *arg1,
int len = real_type->length ();
- copy (value_contents (arg1),
- value_contents_raw (val).slice (0, len));
- copy (value_contents (arg2),
- value_contents_raw (val).slice (len, len));
+ copy (value_contents (arg1), value_contents_raw (val).slice (0, len));
+ copy (value_contents (arg2), value_contents_raw (val).slice (len, len));
return val;
}
@@ -4141,8 +4041,7 @@ value_imaginary_part (struct value *value)
struct type *ttype = type->target_type ();
gdb_assert (type->code () == TYPE_CODE_COMPLEX);
- return value_from_component (value, ttype,
- check_typedef (ttype)->length ());
+ return value_from_component (value, ttype, check_typedef (ttype)->length ());
}
/* Cast a value into the appropriate complex data type. */
@@ -4159,8 +4058,7 @@ cast_into_complex (struct type *type, struct value *val)
struct value *im_val = allocate_value (val_real_type);
int len = val_real_type->length ();
- copy (value_contents (val).slice (0, len),
- value_contents_raw (re_val));
+ copy (value_contents (val).slice (0, len), value_contents_raw (re_val));
copy (value_contents (val).slice (len, len),
value_contents_raw (im_val));
@@ -4168,23 +4066,22 @@ cast_into_complex (struct type *type, struct value *val)
}
else if (value_type (val)->code () == TYPE_CODE_FLT
|| value_type (val)->code () == TYPE_CODE_INT)
- return value_literal_complex (val,
- value_zero (real_type, not_lval),
- type);
+ return value_literal_complex (val, value_zero (real_type, not_lval), type);
else
- error (_("cannot cast non-number to complex"));
+ error (_ ("cannot cast non-number to complex"));
}
void _initialize_valops ();
+
void
_initialize_valops ()
{
add_setshow_boolean_cmd ("overload-resolution", class_support,
- &overload_resolution, _("\
-Set overload resolution in evaluating C++ functions."), _("\
-Show overload resolution in evaluating C++ functions."),
- NULL, NULL,
- show_overload_resolution,
- &setlist, &showlist);
+ &overload_resolution, _ ("\
+Set overload resolution in evaluating C++ functions."),
+ _ ("\
+Show overload resolution in evaluating C++ functions."),
+ NULL, NULL, show_overload_resolution, &setlist,
+ &showlist);
overload_resolution = 1;
}
diff --git a/gdb/valprint.c b/gdb/valprint.c
index 04f83f5194a..16cec0d79f7 100644
--- a/gdb/valprint.c
+++ b/gdb/valprint.c
@@ -103,31 +103,30 @@ static void val_print_type_code_flags (struct type *type,
/* Start print_max_depth at this value. */
#define PRINT_MAX_DEPTH_DEFAULT 20
-struct value_print_options user_print_options =
-{
- Val_prettyformat_default, /* prettyformat */
- false, /* prettyformat_arrays */
- false, /* prettyformat_structs */
- false, /* vtblprint */
- true, /* unionprint */
- true, /* addressprint */
- false, /* nibblesprint */
- false, /* objectprint */
- PRINT_MAX_DEFAULT, /* print_max */
- PRINT_MAX_CHARS_DEFAULT, /* print_max_chars */
- 10, /* repeat_count_threshold */
- 0, /* output_format */
- 0, /* format */
- true, /* memory_tag_violations */
- false, /* stop_print_at_null */
- false, /* print_array_indexes */
- false, /* deref_ref */
- true, /* static_field_print */
- true, /* pascal_static_field_print */
- false, /* raw */
- false, /* summary */
- true, /* symbol_print */
- PRINT_MAX_DEPTH_DEFAULT, /* max_depth */
+struct value_print_options user_print_options = {
+ Val_prettyformat_default, /* prettyformat */
+ false, /* prettyformat_arrays */
+ false, /* prettyformat_structs */
+ false, /* vtblprint */
+ true, /* unionprint */
+ true, /* addressprint */
+ false, /* nibblesprint */
+ false, /* objectprint */
+ PRINT_MAX_DEFAULT, /* print_max */
+ PRINT_MAX_CHARS_DEFAULT, /* print_max_chars */
+ 10, /* repeat_count_threshold */
+ 0, /* output_format */
+ 0, /* format */
+ true, /* memory_tag_violations */
+ false, /* stop_print_at_null */
+ false, /* print_array_indexes */
+ false, /* deref_ref */
+ true, /* static_field_print */
+ true, /* pascal_static_field_print */
+ false, /* raw */
+ false, /* summary */
+ true, /* symbol_print */
+ PRINT_MAX_DEPTH_DEFAULT, /* max_depth */
};
/* Initialize *OPTS to be a copy of the user print options. */
@@ -141,7 +140,7 @@ get_user_print_options (struct value_print_options *opts)
pretty-formatting disabled. */
void
get_no_prettyformat_print_options (struct value_print_options *opts)
-{
+{
*opts = user_print_options;
opts->prettyformat = Val_no_prettyformat;
}
@@ -149,8 +148,7 @@ get_no_prettyformat_print_options (struct value_print_options *opts)
/* Initialize *OPTS to be a copy of the user print options, but using
FORMAT as the formatting option. */
void
-get_formatted_print_options (struct value_print_options *opts,
- char format)
+get_formatted_print_options (struct value_print_options *opts, char format)
{
*opts = user_print_options;
opts->format = format;
@@ -159,15 +157,15 @@ get_formatted_print_options (struct value_print_options *opts,
/* Implement 'show print elements'. */
static void
-show_print_max (struct ui_file *file, int from_tty,
- struct cmd_list_element *c, const char *value)
+show_print_max (struct ui_file *file, int from_tty, struct cmd_list_element *c,
+ const char *value)
{
- gdb_printf
- (file,
- (user_print_options.print_max_chars != PRINT_MAX_CHARS_ELEMENTS
- ? _("Limit on array elements to print is %s.\n")
- : _("Limit on string chars or array elements to print is %s.\n")),
- value);
+ gdb_printf (
+ file,
+ (user_print_options.print_max_chars != PRINT_MAX_CHARS_ELEMENTS
+ ? _ ("Limit on array elements to print is %s.\n")
+ : _ ("Limit on string chars or array elements to print is %s.\n")),
+ value);
}
/* Implement 'show print characters'. */
@@ -176,30 +174,28 @@ static void
show_print_max_chars (struct ui_file *file, int from_tty,
struct cmd_list_element *c, const char *value)
{
- gdb_printf (file,
- _("Limit on string characters to print is %s.\n"),
- value);
+ gdb_printf (file, _ ("Limit on string characters to print is %s.\n"), value);
}
/* Default input and output radixes, and output format letter. */
unsigned input_radix = 10;
+
static void
show_input_radix (struct ui_file *file, int from_tty,
struct cmd_list_element *c, const char *value)
{
- gdb_printf (file,
- _("Default input radix for entering numbers is %s.\n"),
+ gdb_printf (file, _ ("Default input radix for entering numbers is %s.\n"),
value);
}
unsigned output_radix = 10;
+
static void
show_output_radix (struct ui_file *file, int from_tty,
struct cmd_list_element *c, const char *value)
{
- gdb_printf (file,
- _("Default output radix for printing of values is %s.\n"),
+ gdb_printf (file, _ ("Default output radix for printing of values is %s.\n"),
value);
}
@@ -210,7 +206,7 @@ static void
show_print_array_indexes (struct ui_file *file, int from_tty,
struct cmd_list_element *c, const char *value)
{
- gdb_printf (file, _("Printing of array indexes is %s.\n"), value);
+ gdb_printf (file, _ ("Printing of array indexes is %s.\n"), value);
}
/* Print repeat counts if there are more than this many repetitions of an
@@ -221,7 +217,7 @@ static void
show_repeat_count_threshold (struct ui_file *file, int from_tty,
struct cmd_list_element *c, const char *value)
{
- gdb_printf (file, _("Threshold for repeated print elements is %s.\n"),
+ gdb_printf (file, _ ("Threshold for repeated print elements is %s.\n"),
value);
}
@@ -231,9 +227,7 @@ static void
show_memory_tag_violations (struct ui_file *file, int from_tty,
struct cmd_list_element *c, const char *value)
{
- gdb_printf (file,
- _("Printing of memory tag violations is %s.\n"),
- value);
+ gdb_printf (file, _ ("Printing of memory tag violations is %s.\n"), value);
}
/* If nonzero, stops printing of char arrays at first null. */
@@ -243,8 +237,8 @@ show_stop_print_at_null (struct ui_file *file, int from_tty,
struct cmd_list_element *c, const char *value)
{
gdb_printf (file,
- _("Printing of char arrays to stop "
- "at first null char is %s.\n"),
+ _ ("Printing of char arrays to stop "
+ "at first null char is %s.\n"),
value);
}
@@ -252,18 +246,18 @@ show_stop_print_at_null (struct ui_file *file, int from_tty,
static void
show_prettyformat_structs (struct ui_file *file, int from_tty,
- struct cmd_list_element *c, const char *value)
+ struct cmd_list_element *c, const char *value)
{
- gdb_printf (file, _("Pretty formatting of structures is %s.\n"), value);
+ gdb_printf (file, _ ("Pretty formatting of structures is %s.\n"), value);
}
/* Controls pretty printing of arrays. */
static void
show_prettyformat_arrays (struct ui_file *file, int from_tty,
- struct cmd_list_element *c, const char *value)
+ struct cmd_list_element *c, const char *value)
{
- gdb_printf (file, _("Pretty formatting of arrays is %s.\n"), value);
+ gdb_printf (file, _ ("Pretty formatting of arrays is %s.\n"), value);
}
/* If nonzero, causes unions inside structures or other unions to be
@@ -273,20 +267,17 @@ static void
show_unionprint (struct ui_file *file, int from_tty,
struct cmd_list_element *c, const char *value)
{
- gdb_printf (file,
- _("Printing of unions interior to structures is %s.\n"),
+ gdb_printf (file, _ ("Printing of unions interior to structures is %s.\n"),
value);
}
/* Controls the format of printing binary values. */
static void
-show_nibbles (struct ui_file *file, int from_tty,
- struct cmd_list_element *c, const char *value)
+show_nibbles (struct ui_file *file, int from_tty, struct cmd_list_element *c,
+ const char *value)
{
- gdb_printf (file,
- _("Printing binary values in groups is %s.\n"),
- value);
+ gdb_printf (file, _ ("Printing binary values in groups is %s.\n"), value);
}
/* If nonzero, causes machine addresses to be printed in certain contexts. */
@@ -295,20 +286,17 @@ static void
show_addressprint (struct ui_file *file, int from_tty,
struct cmd_list_element *c, const char *value)
{
- gdb_printf (file, _("Printing of addresses is %s.\n"), value);
+ gdb_printf (file, _ ("Printing of addresses is %s.\n"), value);
}
static void
show_symbol_print (struct ui_file *file, int from_tty,
struct cmd_list_element *c, const char *value)
{
- gdb_printf (file,
- _("Printing of symbols when printing pointers is %s.\n"),
+ gdb_printf (file, _ ("Printing of symbols when printing pointers is %s.\n"),
value);
}
-
-
/* A helper function for val_print. When printing in "summary" mode,
we want to print scalar arguments, but not aggregate arguments.
This function distinguishes between the two. */
@@ -343,17 +331,14 @@ static bool
val_print_scalar_or_string_type_p (struct type *type,
const struct language_defn *language)
{
- return (val_print_scalar_type_p (type)
- || language->is_string_type_p (type));
+ return (val_print_scalar_type_p (type) || language->is_string_type_p (type));
}
/* See valprint.h. */
int
-valprint_check_validity (struct ui_file *stream,
- struct type *type,
- LONGEST embedded_offset,
- const struct value *val)
+valprint_check_validity (struct ui_file *stream, struct type *type,
+ LONGEST embedded_offset, const struct value *val)
{
type = check_typedef (type);
@@ -369,12 +354,10 @@ valprint_check_validity (struct ui_file *stream,
return 0;
}
- if (type->code () != TYPE_CODE_UNION
- && type->code () != TYPE_CODE_STRUCT
+ if (type->code () != TYPE_CODE_UNION && type->code () != TYPE_CODE_STRUCT
&& type->code () != TYPE_CODE_ARRAY)
{
- if (value_bits_any_optimized_out (val,
- TARGET_CHAR_BIT * embedded_offset,
+ if (value_bits_any_optimized_out (val, TARGET_CHAR_BIT * embedded_offset,
TARGET_CHAR_BIT * type->length ()))
{
val_print_optimized_out (val, stream);
@@ -392,11 +375,12 @@ valprint_check_validity (struct ui_file *stream,
const struct value *deref_val = coerce_ref_if_computed (val);
if (deref_val != NULL)
- ref_is_addressable = value_lval_const (deref_val) == lval_memory;
+ ref_is_addressable
+ = value_lval_const (deref_val) == lval_memory;
}
if (!is_ref || !ref_is_addressable)
- fputs_styled (_("<synthetic pointer>"), metadata_style.style (),
+ fputs_styled (_ ("<synthetic pointer>"), metadata_style.style (),
stream);
/* C++ references should be valid even if they're synthetic. */
@@ -419,25 +403,25 @@ val_print_optimized_out (const struct value *val, struct ui_file *stream)
if (val != NULL && value_lval_const (val) == lval_register)
val_print_not_saved (stream);
else
- fprintf_styled (stream, metadata_style.style (), _("<optimized out>"));
+ fprintf_styled (stream, metadata_style.style (), _ ("<optimized out>"));
}
void
val_print_not_saved (struct ui_file *stream)
{
- fprintf_styled (stream, metadata_style.style (), _("<not saved>"));
+ fprintf_styled (stream, metadata_style.style (), _ ("<not saved>"));
}
void
val_print_unavailable (struct ui_file *stream)
{
- fprintf_styled (stream, metadata_style.style (), _("<unavailable>"));
+ fprintf_styled (stream, metadata_style.style (), _ ("<unavailable>"));
}
void
val_print_invalid_address (struct ui_file *stream)
{
- fprintf_styled (stream, metadata_style.style (), _("<invalid address>"));
+ fprintf_styled (stream, metadata_style.style (), _ ("<invalid address>"));
}
/* Print a pointer based on the type of its target.
@@ -470,11 +454,10 @@ print_unpacked_pointer (struct type *type, struct type *elttype,
/* generic_val_print helper for TYPE_CODE_ARRAY. */
static void
-generic_val_print_array (struct value *val,
- struct ui_file *stream, int recurse,
- const struct value_print_options *options,
- const struct
- generic_val_print_decorations *decorations)
+generic_val_print_array (
+ struct value *val, struct ui_file *stream, int recurse,
+ const struct value_print_options *options,
+ const struct generic_val_print_decorations *decorations)
{
struct type *type = check_typedef (value_type (val));
struct type *unresolved_elttype = type->target_type ();
@@ -485,7 +468,7 @@ generic_val_print_array (struct value *val,
LONGEST low_bound, high_bound;
if (!get_array_bounds (type, &low_bound, &high_bound))
- error (_("Could not determine the array high bound"));
+ error (_ ("Could not determine the array high bound"));
gdb_puts (decorations->array_start, stream);
value_print_array_elements (val, stream, recurse, options, 0);
@@ -494,10 +477,9 @@ generic_val_print_array (struct value *val,
else
{
/* Array of unspecified length: treat like pointer to first elt. */
- print_unpacked_pointer (type, elttype, value_address (val),
- stream, options);
+ print_unpacked_pointer (type, elttype, value_address (val), stream,
+ options);
}
-
}
/* generic_value_print helper for TYPE_CODE_PTR. */
@@ -506,7 +488,6 @@ static void
generic_value_print_ptr (struct value *val, struct ui_file *stream,
const struct value_print_options *options)
{
-
if (options->format && options->format != 's')
value_print_scalar_formatted (val, options, 0, stream);
else
@@ -520,12 +501,11 @@ generic_value_print_ptr (struct value *val, struct ui_file *stream,
}
}
-
/* Print '@' followed by the address contained in ADDRESS_BUFFER. */
static void
print_ref_address (struct type *type, const gdb_byte *address_buffer,
- int embedded_offset, struct ui_file *stream)
+ int embedded_offset, struct ui_file *stream)
{
struct gdbarch *gdbarch = type->arch ();
@@ -560,8 +540,8 @@ get_value_addr_contents (struct value *deref_val)
/* generic_val_print helper for TYPE_CODE_{RVALUE_,}REF. */
static void
-generic_val_print_ref (struct type *type,
- int embedded_offset, struct ui_file *stream, int recurse,
+generic_val_print_ref (struct type *type, int embedded_offset,
+ struct ui_file *stream, int recurse,
struct value *original_value,
const struct value_print_options *options)
{
@@ -571,10 +551,11 @@ generic_val_print_ref (struct type *type,
= value_bits_synthetic_pointer (original_value,
TARGET_CHAR_BIT * embedded_offset,
TARGET_CHAR_BIT * type->length ());
- const int must_coerce_ref = ((options->addressprint && value_is_synthetic)
- || options->deref_ref);
+ const int must_coerce_ref
+ = ((options->addressprint && value_is_synthetic) || options->deref_ref);
const int type_is_defined = elttype->code () != TYPE_CODE_UNDEF;
- const gdb_byte *valaddr = value_contents_for_printing (original_value).data ();
+ const gdb_byte *valaddr
+ = value_contents_for_printing (original_value).data ();
if (must_coerce_ref && type_is_defined)
{
@@ -586,8 +567,9 @@ generic_val_print_ref (struct type *type,
gdb_assert (embedded_offset == 0);
}
else
- deref_val = value_at (type->target_type (),
- unpack_pointer (type, valaddr + embedded_offset));
+ deref_val
+ = value_at (type->target_type (),
+ unpack_pointer (type, valaddr + embedded_offset));
}
/* Else, original_value isn't a synthetic reference or we don't have to print
the reference's contents.
@@ -604,8 +586,8 @@ generic_val_print_ref (struct type *type,
if (options->addressprint)
{
const gdb_byte *address = (value_is_synthetic && type_is_defined
- ? get_value_addr_contents (deref_val)
- : valaddr);
+ ? get_value_addr_contents (deref_val)
+ : valaddr);
print_ref_address (type, address, embedded_offset, stream);
@@ -711,9 +693,8 @@ generic_val_print_enum_1 (struct type *type, LONGEST val,
/* generic_val_print helper for TYPE_CODE_ENUM. */
static void
-generic_val_print_enum (struct type *type,
- int embedded_offset, struct ui_file *stream,
- struct value *original_value,
+generic_val_print_enum (struct type *type, int embedded_offset,
+ struct ui_file *stream, struct value *original_value,
const struct value_print_options *options)
{
LONGEST val;
@@ -722,7 +703,8 @@ generic_val_print_enum (struct type *type,
gdb_assert (!options->format);
- const gdb_byte *valaddr = value_contents_for_printing (original_value).data ();
+ const gdb_byte *valaddr
+ = value_contents_for_printing (original_value).data ();
val = unpack_long (type, valaddr + embedded_offset * unit_size);
@@ -732,9 +714,8 @@ generic_val_print_enum (struct type *type,
/* generic_val_print helper for TYPE_CODE_FUNC and TYPE_CODE_METHOD. */
static void
-generic_val_print_func (struct type *type,
- int embedded_offset, CORE_ADDR address,
- struct ui_file *stream,
+generic_val_print_func (struct type *type, int embedded_offset,
+ CORE_ADDR address, struct ui_file *stream,
struct value *original_value,
const struct value_print_options *options)
{
@@ -755,16 +736,16 @@ generic_val_print_func (struct type *type,
/* generic_value_print helper for TYPE_CODE_BOOL. */
static void
-generic_value_print_bool
- (struct value *value, struct ui_file *stream,
- const struct value_print_options *options,
- const struct generic_val_print_decorations *decorations)
+generic_value_print_bool (
+ struct value *value, struct ui_file *stream,
+ const struct value_print_options *options,
+ const struct generic_val_print_decorations *decorations)
{
if (options->format || options->output_format)
{
struct value_print_options opts = *options;
- opts.format = (options->format ? options->format
- : options->output_format);
+ opts.format
+ = (options->format ? options->format : options->output_format);
value_print_scalar_formatted (value, &opts, 0, stream);
}
else
@@ -789,8 +770,7 @@ generic_value_print_int (struct value *val, struct ui_file *stream,
{
struct value_print_options opts = *options;
- opts.format = (options->format ? options->format
- : options->output_format);
+ opts.format = (options->format ? options->format : options->output_format);
value_print_scalar_formatted (val, &opts, 0, stream);
}
@@ -804,8 +784,8 @@ generic_value_print_char (struct value *value, struct ui_file *stream,
{
struct value_print_options opts = *options;
- opts.format = (options->format ? options->format
- : options->output_format);
+ opts.format
+ = (options->format ? options->format : options->output_format);
value_print_scalar_formatted (value, &opts, 0, stream);
}
else
@@ -833,7 +813,8 @@ generic_val_print_float (struct type *type, struct ui_file *stream,
{
gdb_assert (!options->format);
- const gdb_byte *valaddr = value_contents_for_printing (original_value).data ();
+ const gdb_byte *valaddr
+ = value_contents_for_printing (original_value).data ();
print_floating (valaddr, type, stream);
}
@@ -866,10 +847,10 @@ generic_val_print_fixed_point (struct value *val, struct ui_file *stream,
/* generic_value_print helper for TYPE_CODE_COMPLEX. */
static void
-generic_value_print_complex (struct value *val, struct ui_file *stream,
- const struct value_print_options *options,
- const struct generic_val_print_decorations
- *decorations)
+generic_value_print_complex (
+ struct value *val, struct ui_file *stream,
+ const struct value_print_options *options,
+ const struct generic_val_print_decorations *decorations)
{
gdb_printf (stream, "%s", decorations->complex_prefix);
@@ -885,11 +866,10 @@ generic_value_print_complex (struct value *val, struct ui_file *stream,
/* generic_value_print helper for TYPE_CODE_MEMBERPTR. */
static void
-generic_value_print_memberptr
- (struct value *val, struct ui_file *stream,
- int recurse,
- const struct value_print_options *options,
- const struct generic_val_print_decorations *decorations)
+generic_value_print_memberptr (
+ struct value *val, struct ui_file *stream, int recurse,
+ const struct value_print_options *options,
+ const struct generic_val_print_decorations *decorations)
{
if (!options->format)
{
@@ -942,8 +922,7 @@ generic_value_print (struct value *val, struct ui_file *stream, int recurse,
case TYPE_CODE_REF:
case TYPE_CODE_RVALUE_REF:
- generic_val_print_ref (type, 0, stream, recurse,
- val, options);
+ generic_val_print_ref (type, 0, stream, recurse, val, options);
break;
case TYPE_CODE_ENUM:
@@ -965,8 +944,8 @@ generic_value_print (struct value *val, struct ui_file *stream, int recurse,
if (options->format)
value_print_scalar_formatted (val, options, 0, stream);
else
- generic_val_print_func (type, 0, value_address (val), stream,
- val, options);
+ generic_val_print_func (type, 0, value_address (val), stream, val,
+ options);
break;
case TYPE_CODE_BOOL:
@@ -1005,7 +984,8 @@ generic_value_print (struct value *val, struct ui_file *stream, int recurse,
/* This happens (without TYPE_STUB set) on systems which don't use
dbx xrefs (NO_DBX_XREFS in gcc) if a file has a "struct foo *bar"
and no complete type for struct foo in that file. */
- fprintf_styled (stream, metadata_style.style (), _("<incomplete type>"));
+ fprintf_styled (stream, metadata_style.style (),
+ _ ("<incomplete type>"));
break;
case TYPE_CODE_COMPLEX:
@@ -1020,8 +1000,7 @@ generic_value_print (struct value *val, struct ui_file *stream, int recurse,
case TYPE_CODE_UNION:
case TYPE_CODE_STRUCT:
default:
- error (_("Unhandled type code %d in symbol table."),
- type->code ());
+ error (_ ("Unhandled type code %d in symbol table."), type->code ());
}
}
@@ -1051,8 +1030,9 @@ common_val_print (struct value *value, struct ui_file *stream, int recurse,
struct type *real_type = check_typedef (type);
if (local_opts.prettyformat == Val_prettyformat_default)
- local_opts.prettyformat = (local_opts.prettyformat_structs
- ? Val_prettyformat : Val_no_prettyformat);
+ local_opts.prettyformat
+ = (local_opts.prettyformat_structs ? Val_prettyformat
+ : Val_no_prettyformat);
QUIT;
@@ -1062,7 +1042,8 @@ common_val_print (struct value *value, struct ui_file *stream, int recurse,
if (real_type->is_stub ())
{
- fprintf_styled (stream, metadata_style.style (), _("<incomplete type>"));
+ fprintf_styled (stream, metadata_style.style (),
+ _ ("<incomplete type>"));
return;
}
@@ -1096,7 +1077,7 @@ common_val_print (struct value *value, struct ui_file *stream, int recurse,
catch (const gdb_exception_error &except)
{
fprintf_styled (stream, metadata_style.style (),
- _("<error reading variable: %s>"), except.what ());
+ _ ("<error reading variable: %s>"), except.what ());
}
}
@@ -1128,7 +1109,7 @@ value_check_printable (struct value *val, struct ui_file *stream,
if (val == 0)
{
fprintf_styled (stream, metadata_style.style (),
- _("<address of value unknown>"));
+ _ ("<address of value unknown>"));
return 0;
}
@@ -1153,7 +1134,7 @@ value_check_printable (struct value *val, struct ui_file *stream,
if (value_type (val)->code () == TYPE_CODE_INTERNAL_FUNCTION)
{
fprintf_styled (stream, metadata_style.style (),
- _("<internal function %s>"),
+ _ ("<internal function %s>"),
value_internal_function_name (val));
return 0;
}
@@ -1200,9 +1181,8 @@ value_print (struct value *val, struct ui_file *stream,
if (!options->raw)
{
- int r
- = apply_ext_lang_val_pretty_printer (val, stream, 0, options,
- current_language);
+ int r = apply_ext_lang_val_pretty_printer (val, stream, 0, options,
+ current_language);
if (r)
return;
@@ -1227,8 +1207,8 @@ static void
val_print_type_code_flags (struct type *type, struct value *original_value,
int embedded_offset, struct ui_file *stream)
{
- const gdb_byte *valaddr = (value_contents_for_printing (original_value).data ()
- + embedded_offset);
+ const gdb_byte *valaddr
+ = (value_contents_for_printing (original_value).data () + embedded_offset);
ULONGEST val = unpack_long (type, valaddr);
int field, nfields = type->num_fields ();
struct gdbarch *gdbarch = type->arch ();
@@ -1248,11 +1228,10 @@ val_print_type_code_flags (struct type *type, struct value *original_value,
int. */
&& TYPE_FIELD_BITSIZE (type, field) == 1)
{
- if (val & ((ULONGEST)1 << type->field (field).loc_bitpos ()))
- gdb_printf
- (stream, " %ps",
- styled_string (variable_name_style.style (),
- type->field (field).name ()));
+ if (val & ((ULONGEST) 1 << type->field (field).loc_bitpos ()))
+ gdb_printf (stream, " %ps",
+ styled_string (variable_name_style.style (),
+ type->field (field).name ()));
}
else
{
@@ -1279,8 +1258,7 @@ val_print_type_code_flags (struct type *type, struct value *original_value,
void
value_print_scalar_formatted (struct value *val,
const struct value_print_options *options,
- int size,
- struct ui_file *stream)
+ int size, struct ui_file *stream)
{
struct type *type = check_typedef (value_type (val));
@@ -1305,8 +1283,7 @@ value_print_scalar_formatted (struct value *val,
/* A scalar object that does not have all bits available can't be
printed, because all bits contribute to its representation. */
- if (value_bits_any_optimized_out (val, 0,
- TARGET_CHAR_BIT * type->length ()))
+ if (value_bits_any_optimized_out (val, 0, TARGET_CHAR_BIT * type->length ()))
val_print_optimized_out (val, stream);
else if (!value_bytes_available (val, 0, type->length ()))
val_print_unavailable (stream);
@@ -1342,25 +1319,33 @@ print_longest (struct ui_file *stream, int format, int use_c_format,
switch (format)
{
case 'd':
- val = int_string (val_long, 10, 1, 0, 1); break;
+ val = int_string (val_long, 10, 1, 0, 1);
+ break;
case 'u':
- val = int_string (val_long, 10, 0, 0, 1); break;
+ val = int_string (val_long, 10, 0, 0, 1);
+ break;
case 'x':
- val = int_string (val_long, 16, 0, 0, use_c_format); break;
+ val = int_string (val_long, 16, 0, 0, use_c_format);
+ break;
case 'b':
- val = int_string (val_long, 16, 0, 2, 1); break;
+ val = int_string (val_long, 16, 0, 2, 1);
+ break;
case 'h':
- val = int_string (val_long, 16, 0, 4, 1); break;
+ val = int_string (val_long, 16, 0, 4, 1);
+ break;
case 'w':
- val = int_string (val_long, 16, 0, 8, 1); break;
+ val = int_string (val_long, 16, 0, 8, 1);
+ break;
case 'g':
- val = int_string (val_long, 16, 0, 16, 1); break;
+ val = int_string (val_long, 16, 0, 16, 1);
+ break;
break;
case 'o':
- val = int_string (val_long, 8, 0, 0, use_c_format); break;
+ val = int_string (val_long, 8, 0, 0, use_c_format);
+ break;
default:
- internal_error (_("failed internal consistency check"));
- }
+ internal_error (_ ("failed internal consistency check"));
+ }
gdb_puts (val, stream);
}
@@ -1381,7 +1366,7 @@ longest_to_int (LONGEST arg)
{
if (rtnval != arg)
{
- error (_("Value out of range."));
+ error (_ ("Value out of range."));
}
}
return (rtnval);
@@ -1415,13 +1400,11 @@ print_binary_chars (struct ui_file *stream, const gdb_byte *valaddr,
const int mask = 0x080;
if (options->nibblesprint)
- digit_separator = current_language->get_digit_separator();
+ digit_separator = current_language->get_digit_separator ();
if (byte_order == BFD_ENDIAN_BIG)
{
- for (p = valaddr;
- p < valaddr + len;
- p++)
+ for (p = valaddr; p < valaddr + len; p++)
{
/* Every byte has 8 binary characters; peel off
and print from the MSB end. */
@@ -1452,9 +1435,7 @@ print_binary_chars (struct ui_file *stream, const gdb_byte *valaddr,
}
else
{
- for (p = valaddr + len - 1;
- p >= valaddr;
- p--)
+ for (p = valaddr + len - 1; p >= valaddr; p--)
{
for (i = 0; i < (HOST_CHAR_BIT * sizeof (*p)); i++)
{
@@ -1526,20 +1507,20 @@ print_octal_chars (struct ui_file *stream, const gdb_byte *valaddr,
* left over bits at the end.
*/
#define BITS_IN_OCTAL 3
-#define HIGH_ZERO 0340
-#define LOW_ZERO 0034
-#define CARRY_ZERO 0003
+#define HIGH_ZERO 0340
+#define LOW_ZERO 0034
+#define CARRY_ZERO 0003
static_assert (HIGH_ZERO + LOW_ZERO + CARRY_ZERO == 0xff,
"cycle zero constants are wrong");
-#define HIGH_ONE 0200
-#define MID_ONE 0160
-#define LOW_ONE 0016
-#define CARRY_ONE 0001
+#define HIGH_ONE 0200
+#define MID_ONE 0160
+#define LOW_ONE 0016
+#define CARRY_ONE 0001
static_assert (HIGH_ONE + MID_ONE + LOW_ONE + CARRY_ONE == 0xff,
"cycle one constants are wrong");
-#define HIGH_TWO 0300
-#define MID_TWO 0070
-#define LOW_TWO 0007
+#define HIGH_TWO 0300
+#define MID_TWO 0070
+#define LOW_TWO 0007
static_assert (HIGH_TWO + MID_TWO + LOW_TWO == 0xff,
"cycle two constants are wrong");
@@ -1553,9 +1534,7 @@ print_octal_chars (struct ui_file *stream, const gdb_byte *valaddr,
bool seen_a_one = false;
if (byte_order == BFD_ENDIAN_BIG)
{
- for (p = valaddr;
- p < valaddr + len;
- p++)
+ for (p = valaddr; p < valaddr + len; p++)
{
switch (cycle)
{
@@ -1594,7 +1573,7 @@ print_octal_chars (struct ui_file *stream, const gdb_byte *valaddr,
break;
default:
- error (_("Internal error in octal conversion;"));
+ error (_ ("Internal error in octal conversion;"));
}
cycle++;
@@ -1603,9 +1582,7 @@ print_octal_chars (struct ui_file *stream, const gdb_byte *valaddr,
}
else
{
- for (p = valaddr + len - 1;
- p >= valaddr;
- p--)
+ for (p = valaddr + len - 1; p >= valaddr; p--)
{
switch (cycle)
{
@@ -1644,14 +1621,13 @@ print_octal_chars (struct ui_file *stream, const gdb_byte *valaddr,
break;
default:
- error (_("Internal error in octal conversion;"));
+ error (_ ("Internal error in octal conversion;"));
}
cycle++;
cycle = cycle % BITS_IN_OCTAL;
}
}
-
}
/* Possibly negate the integer represented by BYTES. It contains LEN
@@ -1661,8 +1637,7 @@ print_octal_chars (struct ui_file *stream, const gdb_byte *valaddr,
static bool
maybe_negate_by_bytes (const gdb_byte *bytes, unsigned len,
- enum bfd_endian byte_order,
- gdb::byte_vector *out_vec)
+ enum bfd_endian byte_order, gdb::byte_vector *out_vec)
{
gdb_byte sign_byte;
gdb_assert (len > 0);
@@ -1705,15 +1680,14 @@ maybe_negate_by_bytes (const gdb_byte *bytes, unsigned len,
void
print_decimal_chars (struct ui_file *stream, const gdb_byte *valaddr,
- unsigned len, bool is_signed,
- enum bfd_endian byte_order)
+ unsigned len, bool is_signed, enum bfd_endian byte_order)
{
-#define TEN 10
-#define CARRY_OUT( x ) ((x) / TEN) /* extend char to int */
-#define CARRY_LEFT( x ) ((x) % TEN)
-#define SHIFT( x ) ((x) << 4)
-#define LOW_NIBBLE( x ) ( (x) & 0x00F)
-#define HIGH_NIBBLE( x ) (((x) & 0x0F0) >> 4)
+#define TEN 10
+#define CARRY_OUT(x) ((x) / TEN) /* extend char to int */
+#define CARRY_LEFT(x) ((x) % TEN)
+#define SHIFT(x) ((x) << 4)
+#define LOW_NIBBLE(x) ((x) &0x00F)
+#define HIGH_NIBBLE(x) (((x) &0x0F0) >> 4)
const gdb_byte *p;
int carry;
@@ -1749,7 +1723,7 @@ print_decimal_chars (struct ui_file *stream, const gdb_byte *valaddr,
* Outer loop is per nibble (hex digit) of input, from MSD end to
* LSD end.
*/
- decimal_digits = 0; /* Number of decimal digits so far */
+ decimal_digits = 0; /* Number of decimal digits so far */
p = (byte_order == BFD_ENDIAN_BIG) ? valaddr : valaddr + len - 1;
flip = 0;
while ((byte_order == BFD_ENDIAN_BIG) ? (p < valaddr + len) : (p >= valaddr))
@@ -1840,9 +1814,8 @@ print_decimal_chars (struct ui_file *stream, const gdb_byte *valaddr,
/* VALADDR points to an integer of LEN bytes. Print it in hex on stream. */
void
-print_hex_chars (struct ui_file *stream, const gdb_byte *valaddr,
- unsigned len, enum bfd_endian byte_order,
- bool zero_pad)
+print_hex_chars (struct ui_file *stream, const gdb_byte *valaddr, unsigned len,
+ enum bfd_endian byte_order, bool zero_pad)
{
const gdb_byte *p;
@@ -1860,9 +1833,7 @@ print_hex_chars (struct ui_file *stream, const gdb_byte *valaddr,
}
const gdb_byte *first = p;
- for (;
- p < valaddr + len;
- p++)
+ for (; p < valaddr + len; p++)
{
/* When not zero-padding, use a different format for the
very first byte printed. */
@@ -1885,9 +1856,7 @@ print_hex_chars (struct ui_file *stream, const gdb_byte *valaddr,
}
const gdb_byte *first = p;
- for (;
- p >= valaddr;
- p--)
+ for (; p >= valaddr; p--)
{
/* When not zero-padding, use a different format for the
very first byte printed. */
@@ -1904,12 +1873,12 @@ print_hex_chars (struct ui_file *stream, const gdb_byte *valaddr,
void
print_function_pointer_address (const struct value_print_options *options,
- struct gdbarch *gdbarch,
- CORE_ADDR address,
+ struct gdbarch *gdbarch, CORE_ADDR address,
struct ui_file *stream)
{
- CORE_ADDR func_addr = gdbarch_convert_from_func_ptr_addr
- (gdbarch, address, current_inferior ()->top_target ());
+ CORE_ADDR func_addr
+ = gdbarch_convert_from_func_ptr_addr (gdbarch, address,
+ current_inferior ()->top_target ());
/* If the function pointer is represented by a description, print
the address of the description. */
@@ -1922,17 +1891,16 @@ print_function_pointer_address (const struct value_print_options *options,
print_address_demangle (options, gdbarch, func_addr, stream, demangle);
}
-
/* Print on STREAM using the given OPTIONS the index for the element
at INDEX of an array whose index type is INDEX_TYPE. */
-
-void
+
+void
maybe_print_array_index (struct type *index_type, LONGEST index,
struct ui_file *stream,
const struct value_print_options *options)
{
if (!options->print_array_indexes)
- return;
+ return;
current_language->print_array_index (index_type, index, stream, options);
}
@@ -1979,7 +1947,7 @@ value_print_array_elements (struct value *val, struct ui_file *stream,
}
else
{
- warning (_("unable to get bounds of array, assuming null array"));
+ warning (_ ("unable to get bounds of array, assuming null array"));
low_bound = 0;
len = 0;
}
@@ -2006,12 +1974,11 @@ value_print_array_elements (struct value *val, struct ui_file *stream,
print_spaces (2 + 2 * recurse, stream);
}
stream->wrap_here (2 + 2 * recurse);
- maybe_print_array_index (index_type, i + low_bound,
- stream, options);
+ maybe_print_array_index (index_type, i + low_bound, stream, options);
- struct value *element = value_from_component_bitsize (val, elttype,
- bit_stride * i,
- bit_stride);
+ struct value *element
+ = value_from_component_bitsize (val, elttype, bit_stride * i,
+ bit_stride);
rep1 = i + 1;
reps = 1;
/* Only check for reps if repeat_count_threshold is not set to
@@ -2022,8 +1989,7 @@ value_print_array_elements (struct value *val, struct ui_file *stream,
{
struct value *rep_elt
= value_from_component_bitsize (val, elttype,
- rep1 * bit_stride,
- bit_stride);
+ rep1 * bit_stride, bit_stride);
if (!value_contents_eq (element, rep_elt))
break;
++reps;
@@ -2066,19 +2032,16 @@ value_print_array_elements (struct value *val, struct ui_file *stream,
static int
wchar_printable (gdb_wchar_t w)
{
- return (gdb_iswprint (w)
- || w == LCST ('\a') || w == LCST ('\b')
- || w == LCST ('\f') || w == LCST ('\n')
- || w == LCST ('\r') || w == LCST ('\t')
- || w == LCST ('\v'));
+ return (gdb_iswprint (w) || w == LCST ('\a') || w == LCST ('\b')
+ || w == LCST ('\f') || w == LCST ('\n') || w == LCST ('\r')
+ || w == LCST ('\t') || w == LCST ('\v'));
}
/* A helper function that converts the contents of STRING to wide
characters and then appends them to OUTPUT. */
static void
-append_string_as_wide (const char *string,
- struct obstack *output)
+append_string_as_wide (const char *string, struct obstack *output)
{
for (; *string; ++string)
{
@@ -2097,11 +2060,9 @@ append_string_as_wide (const char *string,
escapes across calls. */
static void
-print_wchar (gdb_wint_t w, const gdb_byte *orig,
- int orig_len, int width,
- enum bfd_endian byte_order,
- struct obstack *output,
- int quoter, bool *need_escapep)
+print_wchar (gdb_wint_t w, const gdb_byte *orig, int orig_len, int width,
+ enum bfd_endian byte_order, struct obstack *output, int quoter,
+ bool *need_escapep)
{
bool need_escape = *need_escapep;
@@ -2111,79 +2072,78 @@ print_wchar (gdb_wint_t w, const gdb_byte *orig,
function wchar_printable will likely need updating too. */
switch (w)
{
- case LCST ('\a'):
- obstack_grow_wstr (output, LCST ("\\a"));
- break;
- case LCST ('\b'):
- obstack_grow_wstr (output, LCST ("\\b"));
- break;
- case LCST ('\f'):
- obstack_grow_wstr (output, LCST ("\\f"));
- break;
- case LCST ('\n'):
- obstack_grow_wstr (output, LCST ("\\n"));
- break;
- case LCST ('\r'):
- obstack_grow_wstr (output, LCST ("\\r"));
- break;
- case LCST ('\t'):
- obstack_grow_wstr (output, LCST ("\\t"));
- break;
- case LCST ('\v'):
- obstack_grow_wstr (output, LCST ("\\v"));
- break;
- default:
- {
- if (gdb_iswprint (w) && !(need_escape && gdb_iswxdigit (w)))
- {
- gdb_wchar_t wchar = w;
+ case LCST ('\a'):
+ obstack_grow_wstr (output, LCST ("\\a"));
+ break;
+ case LCST ('\b'):
+ obstack_grow_wstr (output, LCST ("\\b"));
+ break;
+ case LCST ('\f'):
+ obstack_grow_wstr (output, LCST ("\\f"));
+ break;
+ case LCST ('\n'):
+ obstack_grow_wstr (output, LCST ("\\n"));
+ break;
+ case LCST ('\r'):
+ obstack_grow_wstr (output, LCST ("\\r"));
+ break;
+ case LCST ('\t'):
+ obstack_grow_wstr (output, LCST ("\\t"));
+ break;
+ case LCST ('\v'):
+ obstack_grow_wstr (output, LCST ("\\v"));
+ break;
+ default:
+ {
+ if (gdb_iswprint (w) && !(need_escape && gdb_iswxdigit (w)))
+ {
+ gdb_wchar_t wchar = w;
- if (w == gdb_btowc (quoter) || w == LCST ('\\'))
- obstack_grow_wstr (output, LCST ("\\"));
- obstack_grow (output, &wchar, sizeof (gdb_wchar_t));
- }
- else
- {
- int i;
+ if (w == gdb_btowc (quoter) || w == LCST ('\\'))
+ obstack_grow_wstr (output, LCST ("\\"));
+ obstack_grow (output, &wchar, sizeof (gdb_wchar_t));
+ }
+ else
+ {
+ int i;
- for (i = 0; i + width <= orig_len; i += width)
- {
- char octal[30];
- ULONGEST value;
+ for (i = 0; i + width <= orig_len; i += width)
+ {
+ char octal[30];
+ ULONGEST value;
- value = extract_unsigned_integer (&orig[i], width,
- byte_order);
- /* If the value fits in 3 octal digits, print it that
+ value = extract_unsigned_integer (&orig[i], width, byte_order);
+ /* If the value fits in 3 octal digits, print it that
way. Otherwise, print it as a hex escape. */
- if (value <= 0777)
- {
- xsnprintf (octal, sizeof (octal), "\\%.3o",
- (int) (value & 0777));
- *need_escapep = false;
- }
- else
- {
- xsnprintf (octal, sizeof (octal), "\\x%lx", (long) value);
- /* A hex escape might require the next character
+ if (value <= 0777)
+ {
+ xsnprintf (octal, sizeof (octal), "\\%.3o",
+ (int) (value & 0777));
+ *need_escapep = false;
+ }
+ else
+ {
+ xsnprintf (octal, sizeof (octal), "\\x%lx", (long) value);
+ /* A hex escape might require the next character
to be escaped, because, unlike with octal,
hex escapes have no length limit. */
- *need_escapep = true;
- }
- append_string_as_wide (octal, output);
- }
- /* If we somehow have extra bytes, print them now. */
- while (i < orig_len)
- {
- char octal[5];
+ *need_escapep = true;
+ }
+ append_string_as_wide (octal, output);
+ }
+ /* If we somehow have extra bytes, print them now. */
+ while (i < orig_len)
+ {
+ char octal[5];
- xsnprintf (octal, sizeof (octal), "\\%.3o", orig[i] & 0xff);
- *need_escapep = false;
- append_string_as_wide (octal, output);
- ++i;
- }
- }
- break;
- }
+ xsnprintf (octal, sizeof (octal), "\\%.3o", orig[i] & 0xff);
+ *need_escapep = false;
+ append_string_as_wide (octal, output);
+ ++i;
+ }
+ }
+ break;
+ }
}
}
@@ -2195,8 +2155,7 @@ void
generic_emit_char (int c, struct type *type, struct ui_file *stream,
int quoter, const char *encoding)
{
- enum bfd_endian byte_order
- = type_byte_order (type);
+ enum bfd_endian byte_order = type_byte_order (type);
gdb_byte *c_buf;
bool need_escape = false;
@@ -2240,16 +2199,15 @@ generic_emit_char (int c, struct type *type, struct ui_file *stream,
if (!print_escape)
{
for (i = 0; i < num_chars; ++i)
- print_wchar (chars[i], buf, buflen,
- type->length (), byte_order,
- &wchar_buf, quoter, &need_escape);
+ print_wchar (chars[i], buf, buflen, type->length (),
+ byte_order, &wchar_buf, quoter, &need_escape);
}
}
/* This handles the NUM_CHARS == 0 case as well. */
if (print_escape)
- print_wchar (gdb_WEOF, buf, buflen, type->length (),
- byte_order, &wchar_buf, quoter, &need_escape);
+ print_wchar (gdb_WEOF, buf, buflen, type->length (), byte_order,
+ &wchar_buf, quoter, &need_escape);
}
/* The output in the host encoding. */
@@ -2328,9 +2286,9 @@ count_next_character (wchar_iterator *iter,
2) Equality of non-converted character (num_chars == 0) */
if ((current->num_chars > 0
&& memcmp (current->chars, d.chars,
- WCHAR_BUFLEN (current->num_chars)) == 0)
- || (current->num_chars == 0
- && current->buflen == d.buflen
+ WCHAR_BUFLEN (current->num_chars))
+ == 0)
+ || (current->num_chars == 0 && current->buflen == d.buflen
&& memcmp (current->buf, d.buf, current->buflen) == 0))
++current->repeat_count;
else
@@ -2353,15 +2311,24 @@ count_next_character (wchar_iterator *iter,
is the user's print options. */
static void
-print_converted_chars_to_obstack (struct obstack *obstack,
- const std::vector<converted_character> &chars,
- int quote_char, int width,
- enum bfd_endian byte_order,
- const struct value_print_options *options)
+print_converted_chars_to_obstack (
+ struct obstack *obstack, const std::vector<converted_character> &chars,
+ int quote_char, int width, enum bfd_endian byte_order,
+ const struct value_print_options *options)
{
unsigned int idx;
const converted_character *elem;
- enum {START, SINGLE, REPEAT, INCOMPLETE, FINISH} state, last;
+
+ enum
+ {
+ START,
+ SINGLE,
+ REPEAT,
+ INCOMPLETE,
+ FINISH
+ } state,
+ last;
+
gdb_wchar_t wide_quote_char = gdb_btowc (quote_char);
bool need_escape = false;
@@ -2431,8 +2398,8 @@ print_converted_chars_to_obstack (struct obstack *obstack,
print_wchar (gdb_WEOF, elem->buf, elem->buflen, width,
byte_order, obstack, quote_char, &need_escape);
obstack_grow_wstr (obstack, LCST ("'"));
- std::string s = string_printf (_(" <repeats %u times>"),
- elem->repeat_count);
+ std::string s
+ = string_printf (_ (" <repeats %u times>"), elem->repeat_count);
for (j = 0; s[j]; ++j)
{
gdb_wchar_t w = gdb_btowc (s[j]);
@@ -2510,10 +2477,10 @@ print_converted_chars_to_obstack (struct obstack *obstack,
omitted. */
void
-generic_printstr (struct ui_file *stream, struct type *type,
- const gdb_byte *string, unsigned int length,
- const char *encoding, int force_ellipses,
- int quote_char, int c_style_terminator,
+generic_printstr (struct ui_file *stream, struct type *type,
+ const gdb_byte *string, unsigned int length,
+ const char *encoding, int force_ellipses, int quote_char,
+ int c_style_terminator,
const struct value_print_options *options)
{
enum bfd_endian byte_order = type_byte_order (type);
@@ -2529,8 +2496,8 @@ generic_printstr (struct ui_file *stream, struct type *type,
for (i = 0; current_char; ++i)
{
QUIT;
- current_char = extract_unsigned_integer (string + i * width,
- width, byte_order);
+ current_char
+ = extract_unsigned_integer (string + i * width, width, byte_order);
}
length = i;
}
@@ -2538,11 +2505,10 @@ generic_printstr (struct ui_file *stream, struct type *type,
/* If the string was not truncated due to `set print elements', and
the last byte of it is a null, we don't print that, in
traditional C style. */
- if (c_style_terminator
- && !force_ellipses
- && length > 0
- && (extract_unsigned_integer (string + (length - 1) * width,
- width, byte_order) == 0))
+ if (c_style_terminator && !force_ellipses && length > 0
+ && (extract_unsigned_integer (string + (length - 1) * width, width,
+ byte_order)
+ == 0))
length--;
if (length == 0)
@@ -2617,17 +2583,17 @@ generic_printstr (struct ui_file *stream, struct type *type,
assumed. */
int
-val_print_string (struct type *elttype, const char *encoding,
- CORE_ADDR addr, int len,
- struct ui_file *stream,
+val_print_string (struct type *elttype, const char *encoding, CORE_ADDR addr,
+ int len, struct ui_file *stream,
const struct value_print_options *options)
{
- int force_ellipsis = 0; /* Force ellipsis to be printed if nonzero. */
- int err; /* Non-zero if we got a bad read. */
- int found_nul; /* Non-zero if we found the nul char. */
- unsigned int fetchlimit; /* Maximum number of chars to print. */
+ int force_ellipsis = 0; /* Force ellipsis to be printed if nonzero. */
+ int err; /* Non-zero if we got a bad read. */
+ int found_nul; /* Non-zero if we found the nul char. */
+ unsigned int fetchlimit; /* Maximum number of chars to print. */
int bytes_read;
- gdb::unique_xmalloc_ptr<gdb_byte> buffer; /* Dynamically growable fetch buffer. */
+ gdb::unique_xmalloc_ptr<gdb_byte>
+ buffer; /* Dynamically growable fetch buffer. */
struct gdbarch *gdbarch = elttype->arch ();
enum bfd_endian byte_order = type_byte_order (elttype);
int width = elttype->length ();
@@ -2641,12 +2607,11 @@ val_print_string (struct type *elttype, const char *encoding,
actually limits the fetch. */
unsigned int print_max_chars = get_print_max_chars (options);
- fetchlimit = (len == -1
- ? print_max_chars
- : std::min ((unsigned) len, print_max_chars));
+ fetchlimit = (len == -1 ? print_max_chars
+ : std::min ((unsigned) len, print_max_chars));
- err = target_read_string (addr, len, width, fetchlimit,
- &buffer, &bytes_read);
+ err
+ = target_read_string (addr, len, width, fetchlimit, &buffer, &bytes_read);
addr += bytes_read;
@@ -2658,7 +2623,8 @@ val_print_string (struct type *elttype, const char *encoding,
found_nul = 0;
if (bytes_read >= width)
found_nul = extract_unsigned_integer (buffer.get () + bytes_read - width,
- width, byte_order) == 0;
+ width, byte_order)
+ == 0;
if (len == -1 && !found_nul)
{
gdb_byte *peekbuf;
@@ -2686,16 +2652,15 @@ val_print_string (struct type *elttype, const char *encoding,
and then the error message. */
if (err == 0 || bytes_read > 0)
current_language->printstr (stream, elttype, buffer.get (),
- bytes_read / width,
- encoding, force_ellipsis, options);
+ bytes_read / width, encoding, force_ellipsis,
+ options);
if (err != 0)
{
std::string str = memory_error_message (TARGET_XFER_E_IO, gdbarch, addr);
- gdb_printf (stream, _("<error: %ps>"),
- styled_string (metadata_style.style (),
- str.c_str ()));
+ gdb_printf (stream, _ ("<error: %ps>"),
+ styled_string (metadata_style.style (), str.c_str ()));
}
return (bytes_read / width);
@@ -2707,9 +2672,8 @@ static void
show_print_max_depth (struct ui_file *file, int from_tty,
struct cmd_list_element *c, const char *value)
{
- gdb_printf (file, _("Maximum print depth is %s.\n"), value);
+ gdb_printf (file, _ ("Maximum print depth is %s.\n"), value);
}
-
/* The 'set input-radix' command writes to this auxiliary variable.
If the requested radix is valid, INPUT_RADIX is updated; otherwise,
@@ -2740,14 +2704,14 @@ set_input_radix_1 (int from_tty, unsigned radix)
if (radix < 2)
{
input_radix_1 = input_radix;
- error (_("Nonsense input radix ``decimal %u''; input radix unchanged."),
+ error (_ ("Nonsense input radix ``decimal %u''; input radix unchanged."),
radix);
}
input_radix_1 = input_radix = radix;
if (from_tty)
{
- gdb_printf (_("Input radix now set to "
- "decimal %u, hex %x, octal %o.\n"),
+ gdb_printf (_ ("Input radix now set to "
+ "decimal %u, hex %x, octal %o.\n"),
radix, radix, radix);
}
}
@@ -2772,25 +2736,25 @@ set_output_radix_1 (int from_tty, unsigned radix)
switch (radix)
{
case 16:
- user_print_options.output_format = 'x'; /* hex */
+ user_print_options.output_format = 'x'; /* hex */
break;
case 10:
- user_print_options.output_format = 0; /* decimal */
+ user_print_options.output_format = 0; /* decimal */
break;
case 8:
- user_print_options.output_format = 'o'; /* octal */
+ user_print_options.output_format = 'o'; /* octal */
break;
default:
output_radix_1 = output_radix;
- error (_("Unsupported output radix ``decimal %u''; "
- "output radix unchanged."),
+ error (_ ("Unsupported output radix ``decimal %u''; "
+ "output radix unchanged."),
radix);
}
output_radix_1 = output_radix = radix;
if (from_tty)
{
- gdb_printf (_("Output radix now set to "
- "decimal %u, hex %x, octal %o.\n"),
+ gdb_printf (_ ("Output radix now set to "
+ "decimal %u, hex %x, octal %o.\n"),
radix, radix, radix);
}
}
@@ -2813,8 +2777,8 @@ set_radix (const char *arg, int from_tty)
set_input_radix_1 (0, radix);
if (from_tty)
{
- gdb_printf (_("Input and output radices now set to "
- "decimal %u, hex %x, octal %o.\n"),
+ gdb_printf (_ ("Input and output radices now set to "
+ "decimal %u, hex %x, octal %o.\n"),
radix, radix, radix);
}
}
@@ -2828,29 +2792,28 @@ show_radix (const char *arg, int from_tty)
{
if (input_radix == output_radix)
{
- gdb_printf (_("Input and output radices set to "
- "decimal %u, hex %x, octal %o.\n"),
+ gdb_printf (_ ("Input and output radices set to "
+ "decimal %u, hex %x, octal %o.\n"),
input_radix, input_radix, input_radix);
}
else
{
- gdb_printf (_("Input radix set to decimal "
- "%u, hex %x, octal %o.\n"),
+ gdb_printf (_ ("Input radix set to decimal "
+ "%u, hex %x, octal %o.\n"),
input_radix, input_radix, input_radix);
- gdb_printf (_("Output radix set to decimal "
- "%u, hex %x, octal %o.\n"),
+ gdb_printf (_ ("Output radix set to decimal "
+ "%u, hex %x, octal %o.\n"),
output_radix, output_radix, output_radix);
}
}
}
-
/* Controls printing of vtbl's. */
static void
-show_vtblprint (struct ui_file *file, int from_tty,
- struct cmd_list_element *c, const char *value)
+show_vtblprint (struct ui_file *file, int from_tty, struct cmd_list_element *c,
+ const char *value)
{
- gdb_printf (file, _("\
+ gdb_printf (file, _ ("\
Printing of C++ virtual function tables is %s.\n"),
value);
}
@@ -2859,26 +2822,20 @@ Printing of C++ virtual function tables is %s.\n"),
its vtables. */
static void
show_objectprint (struct ui_file *file, int from_tty,
- struct cmd_list_element *c,
- const char *value)
+ struct cmd_list_element *c, const char *value)
{
- gdb_printf (file, _("\
+ gdb_printf (file, _ ("\
Printing of object's derived type based on vtable info is %s.\n"),
value);
}
static void
show_static_field_print (struct ui_file *file, int from_tty,
- struct cmd_list_element *c,
- const char *value)
+ struct cmd_list_element *c, const char *value)
{
- gdb_printf (file,
- _("Printing of C++ static members is %s.\n"),
- value);
+ gdb_printf (file, _ ("Printing of C++ static members is %s.\n"), value);
}
-
-
/* A couple typedefs to make writing the options a bit more
convenient. */
using boolean_option_def
@@ -2890,23 +2847,19 @@ using pinteger_option_def
/* Extra literals supported with the `set print characters' and
`print -characters' commands. */
-static const literal_def print_characters_literals[] =
- {
- { "elements", PRINT_MAX_CHARS_ELEMENTS },
- { "unlimited", PRINT_MAX_CHARS_UNLIMITED, 0 },
- { nullptr }
- };
+static const literal_def print_characters_literals[]
+ = { { "elements", PRINT_MAX_CHARS_ELEMENTS },
+ { "unlimited", PRINT_MAX_CHARS_UNLIMITED, 0 },
+ { nullptr } };
/* Definitions of options for the "print" and "compile print"
commands. */
static const gdb::option::option_def value_print_option_defs[] = {
boolean_option_def {
- "address",
- [] (value_print_options *opt) { return &opt->addressprint; },
+ "address", [] (value_print_options *opt) { return &opt->addressprint; },
show_addressprint, /* show_cmd_cb */
- N_("Set printing of addresses."),
- N_("Show printing of addresses."),
+ N_ ("Set printing of addresses."), N_ ("Show printing of addresses."),
NULL, /* help_doc */
},
@@ -2914,26 +2867,23 @@ static const gdb::option::option_def value_print_option_defs[] = {
"array",
[] (value_print_options *opt) { return &opt->prettyformat_arrays; },
show_prettyformat_arrays, /* show_cmd_cb */
- N_("Set pretty formatting of arrays."),
- N_("Show pretty formatting of arrays."),
- NULL, /* help_doc */
+ N_ ("Set pretty formatting of arrays."),
+ N_ ("Show pretty formatting of arrays."), NULL, /* help_doc */
},
boolean_option_def {
"array-indexes",
[] (value_print_options *opt) { return &opt->print_array_indexes; },
show_print_array_indexes, /* show_cmd_cb */
- N_("Set printing of array indexes."),
- N_("Show printing of array indexes."),
- NULL, /* help_doc */
+ N_ ("Set printing of array indexes."),
+ N_ ("Show printing of array indexes."), NULL, /* help_doc */
},
boolean_option_def {
- "nibbles",
- [] (value_print_options *opt) { return &opt->nibblesprint; },
+ "nibbles", [] (value_print_options *opt) { return &opt->nibblesprint; },
show_nibbles, /* show_cmd_cb */
- N_("Set whether to print binary values in groups of four bits."),
- N_("Show whether to print binary values in groups of four bits."),
+ N_ ("Set whether to print binary values in groups of four bits."),
+ N_ ("Show whether to print binary values in groups of four bits."),
NULL, /* help_doc */
},
@@ -2942,10 +2892,10 @@ static const gdb::option::option_def value_print_option_defs[] = {
[] (value_print_options *opt) { return &opt->print_max_chars; },
print_characters_literals,
show_print_max_chars, /* show_cmd_cb */
- N_("Set limit on string chars to print."),
- N_("Show limit on string chars to print."),
- N_("\"elements\" causes the array element limit to be used.\n"
- "\"unlimited\" causes there to be no limit."),
+ N_ ("Set limit on string chars to print."),
+ N_ ("Show limit on string chars to print."),
+ N_ ("\"elements\" causes the array element limit to be used.\n"
+ "\"unlimited\" causes there to be no limit."),
},
uinteger_option_def {
@@ -2953,32 +2903,30 @@ static const gdb::option::option_def value_print_option_defs[] = {
[] (value_print_options *opt) { return &opt->print_max; },
uinteger_unlimited_literals,
show_print_max, /* show_cmd_cb */
- N_("Set limit on array elements to print."),
- N_("Show limit on array elements to print."),
- N_("\"unlimited\" causes there to be no limit.\n"
- "This setting also applies to string chars when \"print characters\"\n"
- "is set to \"elements\"."),
+ N_ ("Set limit on array elements to print."),
+ N_ ("Show limit on array elements to print."),
+ N_ ("\"unlimited\" causes there to be no limit.\n"
+ "This setting also applies to string chars when \"print characters\"\n"
+ "is set to \"elements\"."),
},
pinteger_option_def {
- "max-depth",
- [] (value_print_options *opt) { return &opt->max_depth; },
- pinteger_unlimited_literals,
- show_print_max_depth, /* show_cmd_cb */
- N_("Set maximum print depth for nested structures, unions and arrays."),
- N_("Show maximum print depth for nested structures, unions, and arrays."),
- N_("When structures, unions, or arrays are nested beyond this depth then they\n\
+ "max-depth", [] (value_print_options *opt) { return &opt->max_depth; },
+ pinteger_unlimited_literals, show_print_max_depth, /* show_cmd_cb */
+ N_ ("Set maximum print depth for nested structures, unions and arrays."),
+ N_ ("Show maximum print depth for nested structures, unions, and arrays."),
+ N_ (
+ "When structures, unions, or arrays are nested beyond this depth then they\n\
will be replaced with either '{...}' or '(...)' depending on the language.\n\
-Use \"unlimited\" to print the complete structure.")
- },
+Use \"unlimited\" to print the complete structure.") },
boolean_option_def {
"memory-tag-violations",
[] (value_print_options *opt) { return &opt->memory_tag_violations; },
show_memory_tag_violations, /* show_cmd_cb */
- N_("Set printing of memory tag violations for pointers."),
- N_("Show printing of memory tag violations for pointers."),
- N_("Issue a warning when the printed value is a pointer\n\
+ N_ ("Set printing of memory tag violations for pointers."),
+ N_ ("Show printing of memory tag violations for pointers."),
+ N_ ("Issue a warning when the printed value is a pointer\n\
whose logical tag doesn't match the allocation tag of the memory\n\
location it points to."),
},
@@ -2987,83 +2935,73 @@ location it points to."),
"null-stop",
[] (value_print_options *opt) { return &opt->stop_print_at_null; },
show_stop_print_at_null, /* show_cmd_cb */
- N_("Set printing of char arrays to stop at first null char."),
- N_("Show printing of char arrays to stop at first null char."),
+ N_ ("Set printing of char arrays to stop at first null char."),
+ N_ ("Show printing of char arrays to stop at first null char."),
NULL, /* help_doc */
},
boolean_option_def {
- "object",
- [] (value_print_options *opt) { return &opt->objectprint; },
+ "object", [] (value_print_options *opt) { return &opt->objectprint; },
show_objectprint, /* show_cmd_cb */
- _("Set printing of C++ virtual function tables."),
- _("Show printing of C++ virtual function tables."),
- NULL, /* help_doc */
+ _ ("Set printing of C++ virtual function tables."),
+ _ ("Show printing of C++ virtual function tables."), NULL, /* help_doc */
},
boolean_option_def {
"pretty",
[] (value_print_options *opt) { return &opt->prettyformat_structs; },
show_prettyformat_structs, /* show_cmd_cb */
- N_("Set pretty formatting of structures."),
- N_("Show pretty formatting of structures."),
- NULL, /* help_doc */
+ N_ ("Set pretty formatting of structures."),
+ N_ ("Show pretty formatting of structures."), NULL, /* help_doc */
},
boolean_option_def {
- "raw-values",
- [] (value_print_options *opt) { return &opt->raw; },
+ "raw-values", [] (value_print_options *opt) { return &opt->raw; },
NULL, /* show_cmd_cb */
- N_("Set whether to print values in raw form."),
- N_("Show whether to print values in raw form."),
- N_("If set, values are printed in raw form, bypassing any\n\
-pretty-printers for that value.")
- },
+ N_ ("Set whether to print values in raw form."),
+ N_ ("Show whether to print values in raw form."),
+ N_ ("If set, values are printed in raw form, bypassing any\n\
+pretty-printers for that value.") },
uinteger_option_def {
"repeats",
[] (value_print_options *opt) { return &opt->repeat_count_threshold; },
uinteger_unlimited_literals,
show_repeat_count_threshold, /* show_cmd_cb */
- N_("Set threshold for repeated print elements."),
- N_("Show threshold for repeated print elements."),
- N_("\"unlimited\" causes all elements to be individually printed."),
+ N_ ("Set threshold for repeated print elements."),
+ N_ ("Show threshold for repeated print elements."),
+ N_ ("\"unlimited\" causes all elements to be individually printed."),
},
boolean_option_def {
"static-members",
[] (value_print_options *opt) { return &opt->static_field_print; },
show_static_field_print, /* show_cmd_cb */
- N_("Set printing of C++ static members."),
- N_("Show printing of C++ static members."),
- NULL, /* help_doc */
+ N_ ("Set printing of C++ static members."),
+ N_ ("Show printing of C++ static members."), NULL, /* help_doc */
},
boolean_option_def {
- "symbol",
- [] (value_print_options *opt) { return &opt->symbol_print; },
+ "symbol", [] (value_print_options *opt) { return &opt->symbol_print; },
show_symbol_print, /* show_cmd_cb */
- N_("Set printing of symbol names when printing pointers."),
- N_("Show printing of symbol names when printing pointers."),
+ N_ ("Set printing of symbol names when printing pointers."),
+ N_ ("Show printing of symbol names when printing pointers."),
NULL, /* help_doc */
},
boolean_option_def {
- "union",
- [] (value_print_options *opt) { return &opt->unionprint; },
+ "union", [] (value_print_options *opt) { return &opt->unionprint; },
show_unionprint, /* show_cmd_cb */
- N_("Set printing of unions interior to structures."),
- N_("Show printing of unions interior to structures."),
+ N_ ("Set printing of unions interior to structures."),
+ N_ ("Show printing of unions interior to structures."),
NULL, /* help_doc */
},
boolean_option_def {
- "vtbl",
- [] (value_print_options *opt) { return &opt->vtblprint; },
+ "vtbl", [] (value_print_options *opt) { return &opt->vtblprint; },
show_vtblprint, /* show_cmd_cb */
- N_("Set printing of C++ virtual function tables."),
- N_("Show printing of C++ virtual function tables."),
- NULL, /* help_doc */
+ N_ ("Set printing of C++ virtual function tables."),
+ N_ ("Show printing of C++ virtual function tables."), NULL, /* help_doc */
},
};
@@ -3072,7 +3010,7 @@ pretty-printers for that value.")
gdb::option::option_def_group
make_value_print_options_def_group (value_print_options *opts)
{
- return {{value_print_option_defs}, opts};
+ return { { value_print_option_defs }, opts };
}
#if GDB_SELF_TEST
@@ -3103,6 +3041,7 @@ test_print_flags (gdbarch *arch)
#endif
void _initialize_valprint ();
+
void
_initialize_valprint ()
{
@@ -3110,45 +3049,43 @@ _initialize_valprint ()
selftests::register_test_foreach_arch ("print-flags", test_print_flags);
#endif
- set_show_commands setshow_print_cmds
- = add_setshow_prefix_cmd ("print", no_class,
- _("Generic command for setting how things print."),
- _("Generic command for showing print settings."),
- &setprintlist, &showprintlist,
- &setlist, &showlist);
+ set_show_commands setshow_print_cmds = add_setshow_prefix_cmd (
+ "print", no_class, _ ("Generic command for setting how things print."),
+ _ ("Generic command for showing print settings."), &setprintlist,
+ &showprintlist, &setlist, &showlist);
add_alias_cmd ("p", setshow_print_cmds.set, no_class, 1, &setlist);
/* Prefer set print to set prompt. */
add_alias_cmd ("pr", setshow_print_cmds.set, no_class, 1, &setlist);
add_alias_cmd ("p", setshow_print_cmds.show, no_class, 1, &showlist);
add_alias_cmd ("pr", setshow_print_cmds.show, no_class, 1, &showlist);
- set_show_commands setshow_print_raw_cmds
- = add_setshow_prefix_cmd
- ("raw", no_class,
- _("Generic command for setting what things to print in \"raw\" mode."),
- _("Generic command for showing \"print raw\" settings."),
- &setprintrawlist, &showprintrawlist, &setprintlist, &showprintlist);
+ set_show_commands setshow_print_raw_cmds = add_setshow_prefix_cmd (
+ "raw", no_class,
+ _ ("Generic command for setting what things to print in \"raw\" mode."),
+ _ ("Generic command for showing \"print raw\" settings."),
+ &setprintrawlist, &showprintrawlist, &setprintlist, &showprintlist);
deprecate_cmd (setshow_print_raw_cmds.set, nullptr);
deprecate_cmd (setshow_print_raw_cmds.show, nullptr);
- gdb::option::add_setshow_cmds_for_options
- (class_support, &user_print_options, value_print_option_defs,
- &setprintlist, &showprintlist);
+ gdb::option::add_setshow_cmds_for_options (class_support,
+ &user_print_options,
+ value_print_option_defs,
+ &setprintlist, &showprintlist);
add_setshow_zuinteger_cmd ("input-radix", class_support, &input_radix_1,
- _("\
-Set default input radix for entering numbers."), _("\
-Show default input radix for entering numbers."), NULL,
- set_input_radix,
- show_input_radix,
- &setlist, &showlist);
+ _ ("\
+Set default input radix for entering numbers."),
+ _ ("\
+Show default input radix for entering numbers."),
+ NULL, set_input_radix, show_input_radix, &setlist,
+ &showlist);
add_setshow_zuinteger_cmd ("output-radix", class_support, &output_radix_1,
- _("\
-Set default output radix for printing of values."), _("\
-Show default output radix for printing of values."), NULL,
- set_output_radix,
- show_output_radix,
+ _ ("\
+Set default output radix for printing of values."),
+ _ ("\
+Show default output radix for printing of values."),
+ NULL, set_output_radix, show_output_radix,
&setlist, &showlist);
/* The "set radix" and "show radix" commands are special in that
@@ -3158,12 +3095,12 @@ Show default output radix for printing of values."), NULL,
add_show_from_set() commands aren't really appropriate. */
/* FIXME: i18n: With the new add_setshow_integer command, that is no
longer true - show can display anything. */
- add_cmd ("radix", class_support, set_radix, _("\
+ add_cmd ("radix", class_support, set_radix, _ ("\
Set default input and output number radices.\n\
Use 'set input-radix' or 'set output-radix' to independently set each.\n\
Without an argument, sets both radices back to the default value of 10."),
&setlist);
- add_cmd ("radix", class_support, show_radix, _("\
+ add_cmd ("radix", class_support, show_radix, _ ("\
Show the default input and output number radices.\n\
Use 'show input-radix' or 'show output-radix' to independently show each."),
&showlist);
diff --git a/gdb/valprint.h b/gdb/valprint.h
index cf5e2f210e4..88e05309a20 100644
--- a/gdb/valprint.h
+++ b/gdb/valprint.h
@@ -120,13 +120,14 @@ static inline unsigned int
get_print_max_chars (const struct value_print_options *options)
{
return (options->print_max_chars != PRINT_MAX_CHARS_ELEMENTS
- ? options->print_max_chars : options->print_max);
+ ? options->print_max_chars
+ : options->print_max);
}
/* Create an option_def_group for the value_print options, with OPTS
as context. */
-extern gdb::option::option_def_group make_value_print_options_def_group
- (value_print_options *opts);
+extern gdb::option::option_def_group
+make_value_print_options_def_group (value_print_options *opts);
/* The global print options set by the user. In general this should
not be directly accessed, except by set/show commands. Ordinary
@@ -149,7 +150,6 @@ extern void maybe_print_array_index (struct type *index_type, LONGEST index,
struct ui_file *stream,
const struct value_print_options *);
-
/* Print elements of an array. */
extern void value_print_array_elements (struct value *, struct ui_file *, int,
@@ -162,9 +162,10 @@ extern void value_print_array_elements (struct value *, struct ui_file *, int,
This is how the elements of an array or structure are printed
with a format. */
-extern void value_print_scalar_formatted
- (struct value *val, const struct value_print_options *options,
- int size, struct ui_file *stream);
+extern void
+value_print_scalar_formatted (struct value *val,
+ const struct value_print_options *options,
+ int size, struct ui_file *stream);
extern void print_binary_chars (struct ui_file *, const gdb_byte *,
unsigned int, enum bfd_endian, bool,
@@ -176,13 +177,13 @@ extern void print_octal_chars (struct ui_file *, const gdb_byte *,
extern void print_decimal_chars (struct ui_file *, const gdb_byte *,
unsigned int, bool, enum bfd_endian);
-extern void print_hex_chars (struct ui_file *, const gdb_byte *,
- unsigned int, enum bfd_endian, bool);
+extern void print_hex_chars (struct ui_file *, const gdb_byte *, unsigned int,
+ enum bfd_endian, bool);
-extern void print_function_pointer_address (const struct value_print_options *options,
- struct gdbarch *gdbarch,
- CORE_ADDR address,
- struct ui_file *stream);
+extern void
+print_function_pointer_address (const struct value_print_options *options,
+ struct gdbarch *gdbarch, CORE_ADDR address,
+ struct ui_file *stream);
/* Helper function to check the validity of some bits of a value.
@@ -234,23 +235,23 @@ struct generic_val_print_decorations
const char *array_end;
};
-
/* Print a value in a generic way. VAL is the value, STREAM is where
to print it, RECURSE is the recursion depth, OPTIONS describe how
the printing should be done, and D is the language-specific
decorations object. Note that structs and unions cannot be printed
by this function. */
-extern void generic_value_print (struct value *val, struct ui_file *stream,
- int recurse,
- const struct value_print_options *options,
- const struct generic_val_print_decorations *d);
+extern void
+generic_value_print (struct value *val, struct ui_file *stream, int recurse,
+ const struct value_print_options *options,
+ const struct generic_val_print_decorations *d);
-extern void generic_emit_char (int c, struct type *type, struct ui_file *stream,
- int quoter, const char *encoding);
+extern void generic_emit_char (int c, struct type *type,
+ struct ui_file *stream, int quoter,
+ const char *encoding);
-extern void generic_printstr (struct ui_file *stream, struct type *type,
- const gdb_byte *string, unsigned int length,
+extern void generic_printstr (struct ui_file *stream, struct type *type,
+ const gdb_byte *string, unsigned int length,
const char *encoding, int force_ellipses,
int quote_char, int c_style_terminator,
const struct value_print_options *options);
@@ -264,16 +265,16 @@ extern void output_command (const char *args, int from_tty);
extern int val_print_scalar_type_p (struct type *type);
struct format_data
- {
- int count;
- char format;
- char size;
- bool print_tags;
+{
+ int count;
+ char format;
+ char size;
+ bool print_tags;
- /* True if the value should be printed raw -- that is, bypassing
+ /* True if the value should be printed raw -- that is, bypassing
python-based formatters. */
- unsigned char raw;
- };
+ unsigned char raw;
+};
extern void print_command_parse_format (const char **expp, const char *cmdname,
value_print_options *opts);
@@ -299,14 +300,11 @@ extern void print_command_completer (struct cmd_list_element *ignore,
0 in case of success, when all the info in the OUT parameters is
valid. Return 1 otherwise. */
-extern int build_address_symbolic (struct gdbarch *,
- CORE_ADDR addr,
+extern int build_address_symbolic (struct gdbarch *, CORE_ADDR addr,
bool do_demangle,
bool prefer_sym_over_minsym,
- std::string *name,
- int *offset,
- std::string *filename,
- int *line,
+ std::string *name, int *offset,
+ std::string *filename, int *line,
int *unmapped);
/* Check to see if RECURSE is greater than or equal to the allowed
@@ -320,10 +318,10 @@ extern bool val_print_check_max_depth (struct ui_file *stream, int recurse,
/* Like common_val_print, but call value_check_printable first. */
-extern void common_val_print_checked
- (struct value *val,
- struct ui_file *stream, int recurse,
- const struct value_print_options *options,
- const struct language_defn *language);
+extern void
+common_val_print_checked (struct value *val, struct ui_file *stream,
+ int recurse,
+ const struct value_print_options *options,
+ const struct language_defn *language);
#endif
diff --git a/gdb/value.c b/gdb/value.c
index e3f60e7e989..42fe431ab84 100644
--- a/gdb/value.c
+++ b/gdb/value.c
@@ -81,10 +81,7 @@ struct range
overlapping and contiguous ranges, so this just compares the
starting offset. */
- bool operator< (const range &other) const
- {
- return offset < other.offset;
- }
+ bool operator<(const range &other) const { return offset < other.offset; }
/* Returns true if THIS is equal to OTHER. */
bool operator== (const range &other) const
@@ -97,8 +94,7 @@ struct range
[offset2, offset2+len2) overlap. */
static int
-ranges_overlap (LONGEST offset1, LONGEST len1,
- LONGEST offset2, LONGEST len2)
+ranges_overlap (LONGEST offset1, LONGEST len1, LONGEST offset2, LONGEST len2)
{
ULONGEST h, l;
@@ -150,7 +146,6 @@ ranges_contain (const std::vector<range> &ranges, LONGEST offset,
I=1
*/
-
auto i = std::lower_bound (ranges.begin (), ranges.end (), what);
if (i > ranges.begin ())
@@ -380,7 +375,8 @@ get_value_arch (const struct value *value)
}
int
-value_bits_available (const struct value *value, LONGEST offset, LONGEST length)
+value_bits_available (const struct value *value, LONGEST offset,
+ LONGEST length)
{
gdb_assert (!value->lazy);
@@ -388,16 +384,16 @@ value_bits_available (const struct value *value, LONGEST offset, LONGEST length)
}
int
-value_bytes_available (const struct value *value,
- LONGEST offset, LONGEST length)
+value_bytes_available (const struct value *value, LONGEST offset,
+ LONGEST length)
{
- return value_bits_available (value,
- offset * TARGET_CHAR_BIT,
+ return value_bits_available (value, offset * TARGET_CHAR_BIT,
length * TARGET_CHAR_BIT);
}
int
-value_bits_any_optimized_out (const struct value *value, int bit_offset, int bit_length)
+value_bits_any_optimized_out (const struct value *value, int bit_offset,
+ int bit_length)
{
gdb_assert (!value->lazy);
@@ -435,8 +431,8 @@ value_entirely_covered_by_range_vector (struct value *value,
const struct range &t = ranges[0];
if (t.offset == 0
- && t.length == (TARGET_CHAR_BIT
- * value_enclosing_type (value)->length ()))
+ && t.length
+ == (TARGET_CHAR_BIT * value_enclosing_type (value)->length ()))
return 1;
}
@@ -459,8 +455,8 @@ value_entirely_optimized_out (struct value *value)
OFFSET bits, and extending for the next LENGTH bits. */
static void
-insert_into_bit_range_vector (std::vector<range> *vectorp,
- LONGEST offset, LONGEST length)
+insert_into_bit_range_vector (std::vector<range> *vectorp, LONGEST offset,
+ LONGEST length)
{
range newr;
@@ -625,18 +621,17 @@ insert_into_bit_range_vector (std::vector<range> *vectorp,
}
void
-mark_value_bits_unavailable (struct value *value,
- LONGEST offset, LONGEST length)
+mark_value_bits_unavailable (struct value *value, LONGEST offset,
+ LONGEST length)
{
insert_into_bit_range_vector (&value->unavailable, offset, length);
}
void
-mark_value_bytes_unavailable (struct value *value,
- LONGEST offset, LONGEST length)
+mark_value_bytes_unavailable (struct value *value, LONGEST offset,
+ LONGEST length)
{
- mark_value_bits_unavailable (value,
- offset * TARGET_CHAR_BIT,
+ mark_value_bits_unavailable (value, offset * TARGET_CHAR_BIT,
length * TARGET_CHAR_BIT);
}
@@ -788,10 +783,8 @@ find_first_range_overlap_and_match (struct ranges_and_idx *rp1,
LONGEST offset1, LONGEST offset2,
LONGEST length, ULONGEST *l, ULONGEST *h)
{
- rp1->idx = find_first_range_overlap (rp1->ranges, rp1->idx,
- offset1, length);
- rp2->idx = find_first_range_overlap (rp2->ranges, rp2->idx,
- offset2, length);
+ rp1->idx = find_first_range_overlap (rp1->ranges, rp1->idx, offset1, length);
+ rp2->idx = find_first_range_overlap (rp2->ranges, rp2->idx, offset2, length);
if (rp1->idx == -1 && rp2->idx == -1)
{
@@ -846,8 +839,7 @@ find_first_range_overlap_and_match (struct ranges_and_idx *rp1,
static bool
value_contents_bits_eq (const struct value *val1, int offset1,
- const struct value *val2, int offset2,
- int length)
+ const struct value *val2, int offset2, int length)
{
/* Each array element corresponds to a ranges source (unavailable,
optimized out). '1' is for VAL1, '2' for VAL2. */
@@ -880,9 +872,9 @@ value_contents_bits_eq (const struct value *val1, int offset1,
/* The contents only match equal if the invalid/unavailable
contents ranges match as well. */
- if (!find_first_range_overlap_and_match (&rp1[i], &rp2[i],
- offset1, offset2, length,
- &l_tmp, &h_tmp))
+ if (!find_first_range_overlap_and_match (&rp1[i], &rp2[i], offset1,
+ offset2, length, &l_tmp,
+ &h_tmp))
return false;
/* We're interested in the lowest/first range found. */
@@ -895,7 +887,8 @@ value_contents_bits_eq (const struct value *val1, int offset1,
/* Compare the available/valid contents. */
if (memcmp_with_bit_offsets (val1->contents.get (), offset1,
- val2->contents.get (), offset2, l) != 0)
+ val2->contents.get (), offset2, l)
+ != 0)
return false;
length -= h;
@@ -908,11 +901,10 @@ value_contents_bits_eq (const struct value *val1, int offset1,
bool
value_contents_eq (const struct value *val1, LONGEST offset1,
- const struct value *val2, LONGEST offset2,
- LONGEST length)
+ const struct value *val2, LONGEST offset2, LONGEST length)
{
- return value_contents_bits_eq (val1, offset1 * TARGET_CHAR_BIT,
- val2, offset2 * TARGET_CHAR_BIT,
+ return value_contents_bits_eq (val1, offset1 * TARGET_CHAR_BIT, val2,
+ offset2 * TARGET_CHAR_BIT,
length * TARGET_CHAR_BIT);
}
@@ -933,7 +925,6 @@ value_contents_eq (const struct value *val1, const struct value *val2)
static std::vector<value_ref_ptr> value_history;
-
/* List of all value objects currently allocated
(except for those released by calls to release_value)
This is so they can be freed after each command. */
@@ -986,15 +977,14 @@ gdb_static_assert (sizeof (LONGEST) <= MIN_VALUE_FOR_MAX_VALUE_SIZE);
/* Implement the "set max-value-size" command. */
static void
-set_max_value_size (const char *args, int from_tty,
- struct cmd_list_element *c)
+set_max_value_size (const char *args, int from_tty, struct cmd_list_element *c)
{
gdb_assert (max_value_size == -1 || max_value_size >= 0);
if (max_value_size > -1 && max_value_size < MIN_VALUE_FOR_MAX_VALUE_SIZE)
{
max_value_size = MIN_VALUE_FOR_MAX_VALUE_SIZE;
- error (_("max-value-size set too low, increasing to %d bytes"),
+ error (_ ("max-value-size set too low, increasing to %d bytes"),
max_value_size);
}
}
@@ -1006,10 +996,9 @@ show_max_value_size (struct ui_file *file, int from_tty,
struct cmd_list_element *c, const char *value)
{
if (max_value_size == -1)
- gdb_printf (file, _("Maximum value size is unlimited.\n"));
+ gdb_printf (file, _ ("Maximum value size is unlimited.\n"));
else
- gdb_printf (file, _("Maximum value size is %d bytes.\n"),
- max_value_size);
+ gdb_printf (file, _ ("Maximum value size is %d bytes.\n"), max_value_size);
}
/* Called before we attempt to allocate or reallocate a buffer for the
@@ -1026,11 +1015,13 @@ check_type_length_before_alloc (const struct type *type)
if (max_value_size > -1 && length > max_value_size)
{
if (type->name () != NULL)
- error (_("value of type `%s' requires %s bytes, which is more "
- "than max-value-size"), type->name (), pulongest (length));
+ error (_ ("value of type `%s' requires %s bytes, which is more "
+ "than max-value-size"),
+ type->name (), pulongest (length));
else
- error (_("value requires %s bytes, which is more than "
- "max-value-size"), pulongest (length));
+ error (_ ("value requires %s bytes, which is more than "
+ "max-value-size"),
+ pulongest (length));
}
}
@@ -1042,8 +1033,8 @@ allocate_value_contents (struct value *val)
if (!val->contents)
{
check_type_length_before_alloc (val->enclosing_type);
- val->contents.reset
- ((gdb_byte *) xzalloc (val->enclosing_type->length ()));
+ val->contents.reset ((gdb_byte *)
+ xzalloc (val->enclosing_type->length ()));
}
}
@@ -1078,8 +1069,7 @@ allocate_repeat_value (struct type *type, int count)
}
struct value *
-allocate_computed_value (struct type *type,
- const struct lval_funcs *funcs,
+allocate_computed_value (struct type *type, const struct lval_funcs *funcs,
void *closure)
{
struct value *v = allocate_value_lazy (type);
@@ -1110,6 +1100,7 @@ value_type (const struct value *value)
{
return value->type;
}
+
void
deprecated_set_value_type (struct value *value, struct type *type)
{
@@ -1121,6 +1112,7 @@ value_offset (const struct value *value)
{
return value->offset;
}
+
void
set_value_offset (struct value *value, LONGEST offset)
{
@@ -1132,6 +1124,7 @@ value_bitpos (const struct value *value)
{
return value->bitpos;
}
+
void
set_value_bitpos (struct value *value, LONGEST bit)
{
@@ -1143,6 +1136,7 @@ value_bitsize (const struct value *value)
{
return value->bitsize;
}
+
void
set_value_bitsize (struct value *value, LONGEST bit)
{
@@ -1172,8 +1166,9 @@ value_contents_raw (struct value *value)
allocate_value_contents (value);
ULONGEST length = value_type (value)->length ();
- return gdb::make_array_view
- (value->contents.get () + value->embedded_offset * unit_size, length);
+ return gdb::make_array_view (value->contents.get ()
+ + value->embedded_offset * unit_size,
+ length);
}
gdb::array_view<gdb_byte>
@@ -1238,7 +1233,7 @@ value_actual_type (struct value *value, int resolve_simple_types,
void
error_value_optimized_out (void)
{
- throw_error (OPTIMIZED_OUT_ERROR, _("value has been optimized out"));
+ throw_error (OPTIMIZED_OUT_ERROR, _ ("value has been optimized out"));
}
static void
@@ -1248,7 +1243,7 @@ require_not_optimized_out (const struct value *value)
{
if (value->lval == lval_register)
throw_error (OPTIMIZED_OUT_ERROR,
- _("register has not been saved in frame"));
+ _ ("register has not been saved in frame"));
else
error_value_optimized_out ();
}
@@ -1258,7 +1253,7 @@ static void
require_available (const struct value *value)
{
if (!value->unavailable.empty ())
- throw_error (NOT_AVAILABLE_ERROR, _("value is not available"));
+ throw_error (NOT_AVAILABLE_ERROR, _ ("value is not available"));
}
gdb::array_view<const gdb_byte>
@@ -1320,12 +1315,10 @@ value_ranges_copy_adjusted (struct value *dst, int dst_bit_offset,
const struct value *src, int src_bit_offset,
int bit_length)
{
- ranges_copy_adjusted (&dst->unavailable, dst_bit_offset,
- src->unavailable, src_bit_offset,
- bit_length);
+ ranges_copy_adjusted (&dst->unavailable, dst_bit_offset, src->unavailable,
+ src_bit_offset, bit_length);
ranges_copy_adjusted (&dst->optimized_out, dst_bit_offset,
- src->optimized_out, src_bit_offset,
- bit_length);
+ src->optimized_out, src_bit_offset, bit_length);
}
/* Copy LENGTH target addressable memory units of SRC value's (all) contents
@@ -1356,8 +1349,7 @@ value_contents_copy_raw (struct value *dst, LONGEST dst_offset,
replaced. Make sure to remember to implement replacing if it
turns out actually necessary. */
gdb_assert (value_bytes_available (dst, dst_offset, length));
- gdb_assert (!value_bits_any_optimized_out (dst,
- TARGET_CHAR_BIT * dst_offset,
+ gdb_assert (!value_bits_any_optimized_out (dst, TARGET_CHAR_BIT * dst_offset,
TARGET_CHAR_BIT * length));
/* Copy the data. */
@@ -1374,8 +1366,7 @@ value_contents_copy_raw (struct value *dst, LONGEST dst_offset,
dst_bit_offset = dst_offset * unit_size * HOST_CHAR_BIT;
bit_length = length * unit_size * HOST_CHAR_BIT;
- value_ranges_copy_adjusted (dst, dst_bit_offset,
- src, src_bit_offset,
+ value_ranges_copy_adjusted (dst, dst_bit_offset, src, src_bit_offset,
bit_length);
}
@@ -1399,20 +1390,17 @@ value_contents_copy_raw_bitwise (struct value *dst, LONGEST dst_bit_offset,
LONGEST dst_offset = dst_bit_offset / TARGET_CHAR_BIT;
LONGEST length = bit_length / TARGET_CHAR_BIT;
gdb_assert (value_bytes_available (dst, dst_offset, length));
- gdb_assert (!value_bits_any_optimized_out (dst, dst_bit_offset,
- bit_length));
+ gdb_assert (!value_bits_any_optimized_out (dst, dst_bit_offset, bit_length));
/* Copy the data. */
gdb::array_view<gdb_byte> dst_contents = value_contents_all_raw (dst);
gdb::array_view<const gdb_byte> src_contents = value_contents_all_raw (src);
- copy_bitwise (dst_contents.data (), dst_bit_offset,
- src_contents.data (), src_bit_offset,
- bit_length,
+ copy_bitwise (dst_contents.data (), dst_bit_offset, src_contents.data (),
+ src_bit_offset, bit_length,
type_byte_order (value_type (src)) == BFD_ENDIAN_BIG);
/* Copy the meta-data. */
- value_ranges_copy_adjusted (dst, dst_bit_offset,
- src, src_bit_offset,
+ value_ranges_copy_adjusted (dst, dst_bit_offset, src, src_bit_offset,
bit_length);
}
@@ -1427,8 +1415,8 @@ value_contents_copy_raw_bitwise (struct value *dst, LONGEST dst_bit_offset,
DST_OFFSET+LENGTH) range are wholly available. */
void
-value_contents_copy (struct value *dst, LONGEST dst_offset,
- struct value *src, LONGEST src_offset, LONGEST length)
+value_contents_copy (struct value *dst, LONGEST dst_offset, struct value *src,
+ LONGEST src_offset, LONGEST length)
{
if (src->lazy)
value_fetch_lazy (src);
@@ -1525,23 +1513,22 @@ value_optimized_out (struct value *value)
void
mark_value_bytes_optimized_out (struct value *value, int offset, int length)
{
- mark_value_bits_optimized_out (value,
- offset * TARGET_CHAR_BIT,
+ mark_value_bits_optimized_out (value, offset * TARGET_CHAR_BIT,
length * TARGET_CHAR_BIT);
}
/* See value.h. */
void
-mark_value_bits_optimized_out (struct value *value,
- LONGEST offset, LONGEST length)
+mark_value_bits_optimized_out (struct value *value, LONGEST offset,
+ LONGEST length)
{
insert_into_bit_range_vector (&value->optimized_out, offset, length);
}
int
-value_bits_synthetic_pointer (const struct value *value,
- LONGEST offset, LONGEST length)
+value_bits_synthetic_pointer (const struct value *value, LONGEST offset,
+ LONGEST length)
{
if (value->lval != lval_computed
|| !value->location.computed.funcs->check_synthetic_pointer)
@@ -1659,7 +1646,7 @@ deprecated_value_modifiable (const struct value *value)
{
return value->modifiable;
}
-
+
/* Return a mark in the value chain. All values allocated after the
mark is obtained (except for those released) are subject to being freed
if a subsequent value_free_to_mark is passed the mark. */
@@ -1839,7 +1826,7 @@ value_non_lval (struct value *arg)
set_value_pointed_to_offset (val, value_pointed_to_offset (arg));
return val;
}
- return arg;
+ return arg;
}
/* Write contents of V at ADDR and set its lval type to be LVAL_MEMORY. */
@@ -1849,7 +1836,8 @@ value_force_lval (struct value *v, CORE_ADDR addr)
{
gdb_assert (VALUE_LVAL (v) == not_lval);
- write_memory (addr, value_contents_raw (v).data (), value_type (v)->length ());
+ write_memory (addr, value_contents_raw (v).data (),
+ value_type (v)->length ());
v->lval = lval_memory;
v->location.address = addr;
}
@@ -1954,14 +1942,14 @@ access_value_history (int num)
if (absnum <= 0)
{
if (num == 0)
- error (_("The history is empty."));
+ error (_ ("The history is empty."));
else if (num == 1)
- error (_("There is only one value in the history."));
+ error (_ ("There is only one value in the history."));
else
- error (_("History does not go back to $$%d."), -num);
+ error (_ ("History does not go back to $$%d."), -num);
}
if (absnum > value_history.size ())
- error (_("History has not yet reached $%d."), absnum);
+ error (_ ("History has not yet reached $%d."), absnum);
absnum--;
@@ -2019,7 +2007,7 @@ show_values (const char *num_exp, int from_tty)
if (from_tty && num_exp)
set_repeat_arguments ("+");
}
-
+
enum internalvar_kind
{
/* The internal variable is empty. */
@@ -2104,7 +2092,7 @@ static struct internalvar *internalvars;
/* If the variable does not already exist create it and give it the
value given. If no value is given then the default is zero. */
static void
-init_if_undefined_command (const char* args, int from_tty)
+init_if_undefined_command (const char *args, int from_tty)
{
struct internalvar *intvar = nullptr;
@@ -2115,7 +2103,7 @@ init_if_undefined_command (const char* args, int from_tty)
Was the expression an assignment?
Or even an expression at all? */
if (expr->first_opcode () != BINOP_ASSIGN)
- error (_("Init-if-undefined requires an assignment expression."));
+ error (_ ("Init-if-undefined requires an assignment expression."));
/* Extract the variable from the parsed expression. */
expr::assign_operation *assign
@@ -2130,8 +2118,8 @@ init_if_undefined_command (const char* args, int from_tty)
}
if (intvar == nullptr)
- error (_("The first parameter to init-if-undefined "
- "should be a GDB variable."));
+ error (_ ("The first parameter to init-if-undefined "
+ "should be a GDB variable."));
/* Only evaluate the expression if the lvalue is void.
This may still fail if the expression is invalid. */
@@ -2139,7 +2127,6 @@ init_if_undefined_command (const char* args, int from_tty)
evaluate_expression (expr.get ());
}
-
/* Look up an internal variable with name NAME. NAME should not
normally include a dollar sign.
@@ -2212,8 +2199,7 @@ create_internalvar_type_lazy (const char *name,
/* See documentation in value.h. */
int
-compile_internalvar_to_ax (struct internalvar *var,
- struct agent_expr *expr,
+compile_internalvar_to_ax (struct internalvar *var, struct agent_expr *expr,
struct axs_value *value)
{
if (var->kind != INTERNALVAR_MAKE_VALUE
@@ -2257,8 +2243,8 @@ value_of_internalvar (struct gdbarch *gdbarch, struct internalvar *var)
tsv = find_trace_state_variable (var->name);
if (tsv)
{
- tsv->value_known = target_get_trace_state_variable_value (tsv->number,
- &(tsv->value));
+ tsv->value_known
+ = target_get_trace_state_variable_value (tsv->number, &(tsv->value));
if (tsv->value_known)
val = value_from_longest (builtin_type (gdbarch)->builtin_int64,
tsv->value);
@@ -2297,12 +2283,13 @@ value_of_internalvar (struct gdbarch *gdbarch, struct internalvar *var)
break;
case INTERNALVAR_MAKE_VALUE:
- val = (*var->u.make_value.functions->make_value) (gdbarch, var,
- var->u.make_value.data);
+ val
+ = (*var->u.make_value.functions->make_value) (gdbarch, var,
+ var->u.make_value.data);
break;
default:
- internal_error (_("bad kind"));
+ internal_error (_ ("bad kind"));
}
/* Change the VALUE_LVAL to lval_internalvar so that future operations
@@ -2322,8 +2309,7 @@ value_of_internalvar (struct gdbarch *gdbarch, struct internalvar *var)
altogether. At the moment, this seems like the behavior we
want. */
- if (var->kind != INTERNALVAR_MAKE_VALUE
- && val->lval != lval_computed)
+ if (var->kind != INTERNALVAR_MAKE_VALUE && val->lval != lval_computed)
{
VALUE_LVAL (val) = lval_internalvar;
VALUE_INTERNALVAR (val) = var;
@@ -2371,9 +2357,9 @@ get_internalvar_function (struct internalvar *var,
}
void
-set_internalvar_component (struct internalvar *var,
- LONGEST offset, LONGEST bitpos,
- LONGEST bitsize, struct value *newval)
+set_internalvar_component (struct internalvar *var, LONGEST offset,
+ LONGEST bitpos, LONGEST bitsize,
+ struct value *newval)
{
gdb_byte *addr;
struct gdbarch *arch;
@@ -2396,7 +2382,7 @@ set_internalvar_component (struct internalvar *var,
default:
/* We can never get a component of any other kind. */
- internal_error (_("set_internalvar_component"));
+ internal_error (_ ("set_internalvar_component"));
}
}
@@ -2407,7 +2393,7 @@ set_internalvar (struct internalvar *var, struct value *val)
union internalvar_data new_data = { 0 };
if (var->kind == INTERNALVAR_FUNCTION && var->u.fn.canonical)
- error (_("Cannot overwrite convenience function %s"), var->name);
+ error (_ ("Cannot overwrite convenience function %s"), var->name);
/* Prepare new contents. */
switch (check_typedef (value_type (val))->code ())
@@ -2523,8 +2509,8 @@ internalvar_name (const struct internalvar *var)
}
static struct internal_function *
-create_internal_function (const char *name,
- internal_function_fn handler, void *cookie)
+create_internal_function (const char *name, internal_function_fn handler,
+ void *cookie)
{
struct internal_function *ifn = XNEW (struct internal_function);
@@ -2622,8 +2608,8 @@ preserve_one_value (struct value *value, struct objfile *objfile,
value->type = copy_type_recursive (value->type, copied_types);
if (value->enclosing_type->objfile_owner () == objfile)
- value->enclosing_type = copy_type_recursive (value->enclosing_type,
- copied_types);
+ value->enclosing_type
+ = copy_type_recursive (value->enclosing_type, copied_types);
}
/* Likewise for internal variable VAR. */
@@ -2658,8 +2644,7 @@ preserve_one_varobj (struct varobj *varobj, struct objfile *objfile,
if (varobj->type->is_objfile_owned ()
&& varobj->type->objfile_owner () == objfile)
{
- varobj->type
- = copy_type_recursive (varobj->type, copied_types);
+ varobj->type = copy_type_recursive (varobj->type, copied_types);
}
if (varobj->value != nullptr)
@@ -2688,11 +2673,9 @@ preserve_values (struct objfile *objfile)
preserve_one_internalvar (var, objfile, copied_types.get ());
/* For the remaining varobj, check that none has type owned by OBJFILE. */
- all_root_varobjs ([&copied_types, objfile] (struct varobj *varobj)
- {
- preserve_one_varobj (varobj, objfile,
- copied_types.get ());
- });
+ all_root_varobjs ([&copied_types, objfile] (struct varobj *varobj) {
+ preserve_one_varobj (varobj, objfile, copied_types.get ());
+ });
preserve_ext_lang_values (objfile, copied_types.get ());
}
@@ -2708,7 +2691,6 @@ show_convenience (const char *ignore, int from_tty)
get_user_print_options (&opts);
for (var = internalvars; var; var = var->next)
{
-
if (!varseen)
{
varseen = 1;
@@ -2725,7 +2707,7 @@ show_convenience (const char *ignore, int from_tty)
catch (const gdb_exception_error &ex)
{
fprintf_styled (gdb_stdout, metadata_style.style (),
- _("<error: %s>"), ex.what ());
+ _ ("<error: %s>"), ex.what ());
}
gdb_printf (("\n"));
@@ -2736,14 +2718,13 @@ show_convenience (const char *ignore, int from_tty)
The user can't create them except via Python, and if Python support
is installed this message will never be printed ($_streq will
exist). */
- gdb_printf (_("No debugger convenience variables now defined.\n"
- "Convenience variables have "
- "names starting with \"$\";\n"
- "use \"set\" as in \"set "
- "$foo = 5\" to define them.\n"));
+ gdb_printf (_ ("No debugger convenience variables now defined.\n"
+ "Convenience variables have "
+ "names starting with \"$\";\n"
+ "use \"set\" as in \"set "
+ "$foo = 5\" to define them.\n"));
}
}
-
/* See value.h. */
@@ -2781,7 +2762,7 @@ call_xmethod (struct value *method, gdb::array_view<value *> argv)
return method->location.xm_worker->invoke (argv[0], argv.slice (1));
}
-
+
/* Extract a value as a C number (either long or double).
Knows how to convert fixed values to double, or
floating values to long.
@@ -2902,7 +2883,7 @@ value_as_address (struct value *val)
return unpack_long (value_type (val), value_contents (val).data ());
#endif
}
-
+
/* Unpack raw data (copied from debugee, target byte order) at VALADDR
as a long, or as a double, assuming the raw data is described
by type TYPE. Knows how to convert different sizes of values
@@ -2974,9 +2955,8 @@ unpack_long (struct type *type, const gdb_byte *valaddr)
case TYPE_CODE_FIXED_POINT:
{
gdb_mpq vq;
- vq.read_fixed_point (gdb::make_array_view (valaddr, len),
- byte_order, nosign,
- type->fixed_point_scaling_factor ());
+ vq.read_fixed_point (gdb::make_array_view (valaddr, len), byte_order,
+ nosign, type->fixed_point_scaling_factor ());
gdb_mpz vz;
mpz_tdiv_q (vz.val, mpq_numref (vq.val), mpq_denref (vq.val));
@@ -2991,7 +2971,7 @@ unpack_long (struct type *type, const gdb_byte *valaddr)
return extract_typed_address (valaddr, type);
default:
- error (_("Value can't be converted to integer."));
+ error (_ ("Value can't be converted to integer."));
}
}
@@ -3024,14 +3004,13 @@ is_floating_value (struct value *val)
if (is_floating_type (type))
{
if (!target_float_is_valid (value_contents (val).data (), type))
- error (_("Invalid floating value found in program."));
+ error (_ ("Invalid floating value found in program."));
return true;
}
return false;
}
-
/* Get the value of the FIELDNO'th field (which must be static) of
TYPE. */
@@ -3047,28 +3026,28 @@ value_static_field (struct type *type, int fieldno)
type->field (fieldno).loc_physaddr ());
break;
case FIELD_LOC_KIND_PHYSNAME:
- {
- const char *phys_name = type->field (fieldno).loc_physname ();
- /* type->field (fieldno).name (); */
- struct block_symbol sym = lookup_symbol (phys_name, 0, VAR_DOMAIN, 0);
+ {
+ const char *phys_name = type->field (fieldno).loc_physname ();
+ /* type->field (fieldno).name (); */
+ struct block_symbol sym = lookup_symbol (phys_name, 0, VAR_DOMAIN, 0);
- if (sym.symbol == NULL)
- {
- /* With some compilers, e.g. HP aCC, static data members are
+ if (sym.symbol == NULL)
+ {
+ /* With some compilers, e.g. HP aCC, static data members are
reported as non-debuggable symbols. */
- struct bound_minimal_symbol msym
- = lookup_minimal_symbol (phys_name, NULL, NULL);
- struct type *field_type = type->field (fieldno).type ();
+ struct bound_minimal_symbol msym
+ = lookup_minimal_symbol (phys_name, NULL, NULL);
+ struct type *field_type = type->field (fieldno).type ();
- if (!msym.minsym)
- retval = allocate_optimized_out_value (field_type);
- else
- retval = value_at_lazy (field_type, msym.value_address ());
- }
- else
- retval = value_of_variable (sym.symbol, sym.block);
- break;
- }
+ if (!msym.minsym)
+ retval = allocate_optimized_out_value (field_type);
+ else
+ retval = value_at_lazy (field_type, msym.value_address ());
+ }
+ else
+ retval = value_of_variable (sym.symbol, sym.block);
+ break;
+ }
default:
gdb_assert_not_reached ("unexpected field location kind");
}
@@ -3088,9 +3067,8 @@ set_value_enclosing_type (struct value *val, struct type *new_encl_type)
if (new_encl_type->length () > value_enclosing_type (val)->length ())
{
check_type_length_before_alloc (new_encl_type);
- val->contents
- .reset ((gdb_byte *) xrealloc (val->contents.release (),
- new_encl_type->length ()));
+ val->contents.reset ((gdb_byte *) xrealloc (val->contents.release (),
+ new_encl_type->length ()));
}
val->enclosing_type = new_encl_type;
@@ -3102,8 +3080,8 @@ set_value_enclosing_type (struct value *val, struct type *new_encl_type)
FIELDNO says which field. */
struct value *
-value_primitive_field (struct value *arg1, LONGEST offset,
- int fieldno, struct type *arg_type)
+value_primitive_field (struct value *arg1, LONGEST offset, int fieldno,
+ struct type *arg_type)
{
struct value *v;
struct type *type;
@@ -3142,9 +3120,8 @@ value_primitive_field (struct value *arg1, LONGEST offset,
v->bitpos = bitpos % container_bitsize;
else
v->bitpos = bitpos % 8;
- v->offset = (value_embedded_offset (arg1)
- + offset
- + (bitpos - v->bitpos) / 8);
+ v->offset
+ = (value_embedded_offset (arg1) + offset + (bitpos - v->bitpos) / 8);
set_value_parent (v, arg1);
if (!value_lazy (arg1))
value_fetch_lazy (v);
@@ -3164,11 +3141,10 @@ value_primitive_field (struct value *arg1, LONGEST offset,
requires access to the contents, which we would rather avoid
for references to ordinary fields of unavailable values. */
if (BASETYPE_VIA_VIRTUAL (arg_type, fieldno))
- boffset = baseclass_offset (arg_type, fieldno,
- value_contents (arg1).data (),
- value_embedded_offset (arg1),
- value_address (arg1),
- arg1);
+ boffset
+ = baseclass_offset (arg_type, fieldno, value_contents (arg1).data (),
+ value_embedded_offset (arg1),
+ value_address (arg1), arg1);
else
boffset = arg_type->field (fieldno).loc_bitpos () / 8;
@@ -3210,12 +3186,12 @@ value_primitive_field (struct value *arg1, LONGEST offset,
else
{
v = allocate_value (type);
- value_contents_copy_raw (v, value_embedded_offset (v),
- arg1, value_embedded_offset (arg1) + offset,
+ value_contents_copy_raw (v, value_embedded_offset (v), arg1,
+ value_embedded_offset (arg1) + offset,
type_length_units (type));
}
- v->offset = (value_offset (arg1) + offset
- + value_embedded_offset (arg1));
+ v->offset
+ = (value_offset (arg1) + offset + value_embedded_offset (arg1));
}
set_value_component_location (v, arg1);
return v;
@@ -3239,9 +3215,8 @@ value_field (struct value *arg1, int fieldno)
full symbol or a minimal symbol. */
struct value *
-value_fn_field (struct value **arg1p, struct fn_field *f,
- int j, struct type *type,
- LONGEST offset)
+value_fn_field (struct value **arg1p, struct fn_field *f, int j,
+ struct type *type, LONGEST offset)
{
struct value *v;
struct type *ftype = TYPE_FN_FIELD_TYPE (f, j);
@@ -3270,10 +3245,9 @@ value_fn_field (struct value **arg1p, struct fn_field *f,
struct objfile *objfile = msym.objfile;
struct gdbarch *gdbarch = objfile->arch ();
- set_value_address (v,
- gdbarch_convert_from_func_ptr_addr
- (gdbarch, msym.value_address (),
- current_inferior ()->top_target ()));
+ set_value_address (v, gdbarch_convert_from_func_ptr_addr (
+ gdbarch, msym.value_address (),
+ current_inferior ()->top_target ()));
}
if (arg1p)
@@ -3289,8 +3263,6 @@ value_fn_field (struct value **arg1p, struct fn_field *f,
return v;
}
-
-
/* See value.h. */
LONGEST
@@ -3317,8 +3289,8 @@ unpack_bits_as_long (struct type *field_type, const gdb_byte *valaddr,
read_offset = bitpos / 8;
- val = extract_unsigned_integer (valaddr + read_offset,
- bytes_read, byte_order);
+ val
+ = extract_unsigned_integer (valaddr + read_offset, bytes_read, byte_order);
/* Extract bits. See comment above. */
@@ -3369,8 +3341,8 @@ unpack_value_field_as_long (struct type *type, const gdb_byte *valaddr,
|| !value_bits_available (val, bit_offset, bitsize))
return 0;
- *result = unpack_bits_as_long (field_type, valaddr + embedded_offset,
- bitpos, bitsize);
+ *result = unpack_bits_as_long (field_type, valaddr + embedded_offset, bitpos,
+ bitsize);
return 1;
}
@@ -3396,8 +3368,7 @@ unpack_field_as_long (struct type *type, const gdb_byte *valaddr, int fieldno)
marked unavailable/optimized out. */
void
-unpack_value_bitfield (struct value *dest_val,
- LONGEST bitpos, LONGEST bitsize,
+unpack_value_bitfield (struct value *dest_val, LONGEST bitpos, LONGEST bitsize,
const gdb_byte *valaddr, LONGEST embedded_offset,
const struct value *val)
{
@@ -3417,8 +3388,8 @@ unpack_value_bitfield (struct value *dest_val,
{
LONGEST num;
- num = unpack_bits_as_long (field_type, valaddr + embedded_offset,
- bitpos, bitsize);
+ num = unpack_bits_as_long (field_type, valaddr + embedded_offset, bitpos,
+ bitsize);
store_signed_integer (value_contents_raw (dest_val).data (),
field_type->length (), byte_order, num);
}
@@ -3430,8 +3401,8 @@ unpack_value_bitfield (struct value *dest_val,
dst_bit_offset = field_type->length () * TARGET_CHAR_BIT - bitsize;
else
dst_bit_offset = 0;
- value_ranges_copy_adjusted (dest_val, dst_bit_offset,
- val, src_bit_offset, bitsize);
+ value_ranges_copy_adjusted (dest_val, dst_bit_offset, val, src_bit_offset,
+ bitsize);
}
/* Return a new value with type TYPE, which is FIELDNO field of the
@@ -3441,16 +3412,15 @@ unpack_value_bitfield (struct value *dest_val,
correspondingly marked unavailable/optimized out. */
struct value *
-value_field_bitfield (struct type *type, int fieldno,
- const gdb_byte *valaddr,
+value_field_bitfield (struct type *type, int fieldno, const gdb_byte *valaddr,
LONGEST embedded_offset, const struct value *val)
{
int bitpos = type->field (fieldno).loc_bitpos ();
int bitsize = TYPE_FIELD_BITSIZE (type, fieldno);
struct value *res_val = allocate_value (type->field (fieldno).type ());
- unpack_value_bitfield (res_val, bitpos, bitsize,
- valaddr, embedded_offset, val);
+ unpack_value_bitfield (res_val, bitpos, bitsize, valaddr, embedded_offset,
+ val);
return res_val;
}
@@ -3463,8 +3433,8 @@ value_field_bitfield (struct type *type, int fieldno,
0 <= BITPOS, where lbits is the size of a LONGEST in bits. */
void
-modify_field (struct type *type, gdb_byte *addr,
- LONGEST fieldval, LONGEST bitpos, LONGEST bitsize)
+modify_field (struct type *type, gdb_byte *addr, LONGEST fieldval,
+ LONGEST bitpos, LONGEST bitsize)
{
enum bfd_endian byte_order = type_byte_order (type);
ULONGEST oword;
@@ -3485,7 +3455,7 @@ modify_field (struct type *type, gdb_byte *addr,
{
/* FIXME: would like to include fieldval in the message, but
we don't have a sprintf_longest. */
- warning (_("Value does not fit in %s bits."), plongest (bitsize));
+ warning (_ ("Value does not fit in %s bits."), plongest (bitsize));
/* Truncate it, otherwise adjoining fields may be corrupted. */
fieldval &= mask;
@@ -3506,7 +3476,7 @@ modify_field (struct type *type, gdb_byte *addr,
store_unsigned_integer (addr, bytesize, byte_order, oword);
}
-
+
/* Pack NUM into BUF using a target format of TYPE. */
void
@@ -3551,12 +3521,11 @@ pack_long (gdb_byte *buf, struct type *type, LONGEST num)
break;
default:
- error (_("Unexpected type (%d) encountered for integer constant."),
+ error (_ ("Unexpected type (%d) encountered for integer constant."),
type->code ());
}
}
-
/* Pack NUM into BUF using a target format of TYPE. */
static void
@@ -3600,13 +3569,12 @@ pack_unsigned_long (gdb_byte *buf, struct type *type, ULONGEST num)
break;
default:
- error (_("Unexpected type (%d) encountered "
- "for unsigned integer constant."),
+ error (_ ("Unexpected type (%d) encountered "
+ "for unsigned integer constant."),
type->code ());
}
}
-
/* Create a value of type TYPE that is zero, and return it. */
struct value *
@@ -3630,7 +3598,6 @@ value_from_longest (struct type *type, LONGEST num)
return val;
}
-
/* Convert C unsigned numbers into newly allocated values. */
struct value *
@@ -3643,7 +3610,6 @@ value_from_ulongest (struct type *type, ULONGEST num)
return val;
}
-
/* Create a value representing a pointer of type TYPE to the address
ADDR. */
@@ -3652,8 +3618,8 @@ value_from_pointer (struct type *type, CORE_ADDR addr)
{
struct value *val = allocate_value (type);
- store_typed_address (value_contents_raw (val).data (),
- check_typedef (type), addr);
+ store_typed_address (value_contents_raw (val).data (), check_typedef (type),
+ addr);
return val;
}
@@ -3700,8 +3666,7 @@ value_from_contents_and_address_unresolved (struct type *type,
type TYPE. Make sure to retrieve values new type after this call. */
struct value *
-value_from_contents_and_address (struct type *type,
- const gdb_byte *valaddr,
+value_from_contents_and_address (struct type *type, const gdb_byte *valaddr,
CORE_ADDR address)
{
gdb::array_view<const gdb_byte> view;
@@ -3812,8 +3777,8 @@ value_from_component (struct value *whole, struct type *type, LONGEST offset)
else
{
v = allocate_value (type);
- value_contents_copy (v, value_embedded_offset (v),
- whole, value_embedded_offset (whole) + offset,
+ value_contents_copy (v, value_embedded_offset (v), whole,
+ value_embedded_offset (whole) + offset,
type_length_units (type));
}
v->offset = value_offset (whole) + offset + value_embedded_offset (whole);
@@ -3844,12 +3809,9 @@ value_from_component_bitsize (struct value *whole, struct type *type,
if (is_scalar_type (type) && type_byte_order (type) == BFD_ENDIAN_BIG)
dst_offset += TARGET_CHAR_BIT * type->length () - bit_length;
- value_contents_copy_raw_bitwise (v, dst_offset,
- whole,
- TARGET_CHAR_BIT
- * value_embedded_offset (whole)
- + bit_offset,
- bit_length);
+ value_contents_copy_raw_bitwise (
+ v, dst_offset, whole,
+ TARGET_CHAR_BIT * value_embedded_offset (whole) + bit_offset, bit_length);
return v;
}
@@ -3915,7 +3877,8 @@ coerce_ref (struct value *arg)
enc_type = check_typedef (value_enclosing_type (arg));
enc_type = enc_type->target_type ();
- CORE_ADDR addr = unpack_pointer (value_type (arg), value_contents (arg).data ());
+ CORE_ADDR addr
+ = unpack_pointer (value_type (arg), value_contents (arg).data ());
retval = value_at_lazy (enc_type, addr);
enc_type = value_type (retval);
return readjust_indirect_value_type (retval, enc_type, value_type_arg_tmp,
@@ -3942,23 +3905,22 @@ coerce_array (struct value *arg)
}
return arg;
}
-
/* Return the return value convention that will be used for the
specified type. */
enum return_value_convention
-struct_return_convention (struct gdbarch *gdbarch,
- struct value *function, struct type *value_type)
+struct_return_convention (struct gdbarch *gdbarch, struct value *function,
+ struct type *value_type)
{
enum type_code code = value_type->code ();
if (code == TYPE_CODE_ERROR)
- error (_("Function return type unknown."));
+ error (_ ("Function return type unknown."));
/* Probe the architecture for the return-value convention. */
- return gdbarch_return_value_as_value (gdbarch, function, value_type,
- NULL, NULL, NULL);
+ return gdbarch_return_value_as_value (gdbarch, function, value_type, NULL,
+ NULL, NULL);
}
/* Return true if the function returning the specified type is using
@@ -3966,8 +3928,8 @@ struct_return_convention (struct gdbarch *gdbarch,
address as a hidden first parameter). */
int
-using_struct_return (struct gdbarch *gdbarch,
- struct value *function, struct type *value_type)
+using_struct_return (struct gdbarch *gdbarch, struct value *function,
+ struct type *value_type)
{
if (value_type->code () == TYPE_CODE_VOID)
/* A void return value is never in memory. See also corresponding
@@ -4027,9 +3989,9 @@ value_fetch_lazy_memory (struct value *val)
struct type *type = check_typedef (value_enclosing_type (val));
if (type->length ())
- read_value_memory (val, 0, value_stack (val),
- addr, value_contents_all_raw (val).data (),
- type_length_units (type));
+ read_value_memory (val, 0, value_stack (val), addr,
+ value_contents_all_raw (val).data (),
+ type_length_units (type));
}
/* Helper for value_fetch_lazy when the value is in a register. */
@@ -4081,10 +4043,9 @@ value_fetch_lazy_register (struct value *val)
sniffer trying to unwind), bypassing its validations. In
any case, it should always be an internal error to end up
in this situation. */
- if (VALUE_LVAL (new_val) == lval_register
- && value_lazy (new_val)
+ if (VALUE_LVAL (new_val) == lval_register && value_lazy (new_val)
&& VALUE_NEXT_FRAME_ID (new_val) == next_frame_id)
- internal_error (_("infinite loop while fetching a register"));
+ internal_error (_ ("infinite loop while fetching a register"));
}
/* If it's still lazy (for instance, a saved register on the
@@ -4095,8 +4056,8 @@ value_fetch_lazy_register (struct value *val)
/* Copy the contents and the unavailability/optimized-out
meta-data from NEW_VAL to VAL. */
set_value_lazy (val, 0);
- value_contents_copy (val, value_embedded_offset (val),
- new_val, value_embedded_offset (new_val),
+ value_contents_copy (val, value_embedded_offset (val), new_val,
+ value_embedded_offset (new_val),
type_length_units (type));
if (frame_debug)
@@ -4109,8 +4070,7 @@ value_fetch_lazy_register (struct value *val)
gdbarch = get_frame_arch (frame);
string_file debug_file;
- gdb_printf (&debug_file,
- "(frame=%d, regnum=%d(%s), ...) ",
+ gdb_printf (&debug_file, "(frame=%d, regnum=%d(%s), ...) ",
frame_relative_level (frame), regnum,
user_reg_map_regnum_to_name (gdbarch, regnum));
@@ -4126,12 +4086,10 @@ value_fetch_lazy_register (struct value *val)
gdb::array_view<const gdb_byte> buf = value_contents (new_val);
if (VALUE_LVAL (new_val) == lval_register)
- gdb_printf (&debug_file, " register=%d",
- VALUE_REGNUM (new_val));
+ gdb_printf (&debug_file, " register=%d", VALUE_REGNUM (new_val));
else if (VALUE_LVAL (new_val) == lval_memory)
gdb_printf (&debug_file, " address=%s",
- paddress (gdbarch,
- value_address (new_val)));
+ paddress (gdbarch, value_address (new_val)));
else
gdb_printf (&debug_file, " computed");
@@ -4182,7 +4140,7 @@ value_fetch_lazy (struct value *val)
&& value_computed_funcs (val)->read != NULL)
value_computed_funcs (val)->read (val);
else
- internal_error (_("Unexpected lazy value type."));
+ internal_error (_ ("Unexpected lazy value type."));
set_value_lazy (val, 0);
}
@@ -4191,13 +4149,13 @@ value_fetch_lazy (struct value *val)
static struct value *
isvoid_internal_fn (struct gdbarch *gdbarch,
- const struct language_defn *language,
- void *cookie, int argc, struct value **argv)
+ const struct language_defn *language, void *cookie,
+ int argc, struct value **argv)
{
int ret;
if (argc != 1)
- error (_("You must provide one argument for $_isvoid."));
+ error (_ ("You must provide one argument for $_isvoid."));
ret = value_type (argv[0])->code () == TYPE_CODE_VOID;
@@ -4209,16 +4167,16 @@ isvoid_internal_fn (struct gdbarch *gdbarch,
static struct value *
creal_internal_fn (struct gdbarch *gdbarch,
- const struct language_defn *language,
- void *cookie, int argc, struct value **argv)
+ const struct language_defn *language, void *cookie,
+ int argc, struct value **argv)
{
if (argc != 1)
- error (_("You must provide one argument for $_creal."));
+ error (_ ("You must provide one argument for $_creal."));
value *cval = argv[0];
type *ctype = check_typedef (value_type (cval));
if (ctype->code () != TYPE_CODE_COMPLEX)
- error (_("expected a complex number"));
+ error (_ ("expected a complex number"));
return value_real_part (cval);
}
@@ -4227,17 +4185,16 @@ creal_internal_fn (struct gdbarch *gdbarch,
static struct value *
cimag_internal_fn (struct gdbarch *gdbarch,
- const struct language_defn *language,
- void *cookie, int argc,
- struct value **argv)
+ const struct language_defn *language, void *cookie,
+ int argc, struct value **argv)
{
if (argc != 1)
- error (_("You must provide one argument for $_cimag."));
+ error (_ ("You must provide one argument for $_cimag."));
value *cval = argv[0];
type *ctype = check_typedef (value_type (cval));
if (ctype->code () != TYPE_CODE_COMPLEX)
- error (_("expected a complex number"));
+ error (_ ("expected a complex number"));
return value_imaginary_part (cval);
}
@@ -4308,16 +4265,14 @@ test_insert_into_bit_range_vector ()
/* [10, 14] */
{
insert_into_bit_range_vector (&ranges, 10, 5);
- static const range expected[] = {
- {10, 5}
- };
+ static const range expected[] = { { 10, 5 } };
SELF_CHECK (check_ranges_vector (ranges, expected));
}
/* [10, 14] */
{
insert_into_bit_range_vector (&ranges, 11, 4);
- static const range expected = {10, 5};
+ static const range expected = { 10, 5 };
SELF_CHECK (check_ranges_vector (ranges, expected));
}
@@ -4325,8 +4280,8 @@ test_insert_into_bit_range_vector ()
{
insert_into_bit_range_vector (&ranges, 20, 5);
static const range expected[] = {
- {10, 5},
- {20, 5},
+ { 10, 5 },
+ { 20, 5 },
};
SELF_CHECK (check_ranges_vector (ranges, expected));
}
@@ -4335,8 +4290,8 @@ test_insert_into_bit_range_vector ()
{
insert_into_bit_range_vector (&ranges, 17, 5);
static const range expected[] = {
- {10, 5},
- {17, 8},
+ { 10, 5 },
+ { 17, 8 },
};
SELF_CHECK (check_ranges_vector (ranges, expected));
}
@@ -4345,9 +4300,9 @@ test_insert_into_bit_range_vector ()
{
insert_into_bit_range_vector (&ranges, 2, 7);
static const range expected[] = {
- {2, 7},
- {10, 5},
- {17, 8},
+ { 2, 7 },
+ { 10, 5 },
+ { 17, 8 },
};
SELF_CHECK (check_ranges_vector (ranges, expected));
}
@@ -4356,8 +4311,8 @@ test_insert_into_bit_range_vector ()
{
insert_into_bit_range_vector (&ranges, 9, 1);
static const range expected[] = {
- {2, 13},
- {17, 8},
+ { 2, 13 },
+ { 17, 8 },
};
SELF_CHECK (check_ranges_vector (ranges, expected));
}
@@ -4366,8 +4321,8 @@ test_insert_into_bit_range_vector ()
{
insert_into_bit_range_vector (&ranges, 9, 1);
static const range expected[] = {
- {2, 13},
- {17, 8},
+ { 2, 13 },
+ { 17, 8 },
};
SELF_CHECK (check_ranges_vector (ranges, expected));
}
@@ -4375,7 +4330,7 @@ test_insert_into_bit_range_vector ()
/* [2, 33] */
{
insert_into_bit_range_vector (&ranges, 4, 30);
- static const range expected = {2, 32};
+ static const range expected = { 2, 32 };
SELF_CHECK (check_ranges_vector (ranges, expected));
}
}
@@ -4398,11 +4353,13 @@ test_value_copy ()
#endif /* GDB_SELF_TEST */
void _initialize_values ();
+
void
_initialize_values ()
{
cmd_list_element *show_convenience_cmd
- = add_cmd ("convenience", no_class, show_convenience, _("\
+ = add_cmd ("convenience", no_class, show_convenience,
+ _ ("\
Debugger convenience (\"$foo\") variables and functions.\n\
Convenience variables are created when you assign them values;\n\
thus, \"set $foo=1\" gives \"$foo\" the value 1. Values may be any type.\n\
@@ -4411,64 +4368,68 @@ A few convenience variables are given values automatically:\n\
\"$_\"holds the last address examined with \"x\" or \"info lines\",\n\
\"$__\" holds the contents of the last address examined with \"x\"."
#ifdef HAVE_PYTHON
-"\n\n\
+ "\n\n\
Convenience functions are defined via the Python API."
#endif
- ), &showlist);
+ ),
+ &showlist);
add_alias_cmd ("conv", show_convenience_cmd, no_class, 1, &showlist);
- add_cmd ("values", no_set_class, show_values, _("\
+ add_cmd ("values", no_set_class, show_values, _ ("\
Elements of value history around item number IDX (or last ten)."),
&showlist);
- add_com ("init-if-undefined", class_vars, init_if_undefined_command, _("\
+ add_com ("init-if-undefined", class_vars, init_if_undefined_command, _ ("\
Initialize a convenience variable if necessary.\n\
init-if-undefined VARIABLE = EXPRESSION\n\
Set an internal VARIABLE to the result of the EXPRESSION if it does not\n\
exist or does not contain a value. The EXPRESSION is not evaluated if the\n\
VARIABLE is already initialized."));
- add_prefix_cmd ("function", no_class, function_command, _("\
+ add_prefix_cmd ("function", no_class, function_command, _ ("\
Placeholder command for showing help on convenience functions."),
&functionlist, 0, &cmdlist);
- add_internal_function ("_isvoid", _("\
+ add_internal_function ("_isvoid", _ ("\
Check whether an expression is void.\n\
Usage: $_isvoid (expression)\n\
Return 1 if the expression is void, zero otherwise."),
isvoid_internal_fn, NULL);
- add_internal_function ("_creal", _("\
+ add_internal_function ("_creal", _ ("\
Extract the real part of a complex number.\n\
Usage: $_creal (expression)\n\
Return the real part of a complex number, the type depends on the\n\
type of a complex number."),
creal_internal_fn, NULL);
- add_internal_function ("_cimag", _("\
+ add_internal_function ("_cimag", _ ("\
Extract the imaginary part of a complex number.\n\
Usage: $_cimag (expression)\n\
Return the imaginary part of a complex number, the type depends on the\n\
type of a complex number."),
cimag_internal_fn, NULL);
- add_setshow_zuinteger_unlimited_cmd ("max-value-size",
- class_support, &max_value_size, _("\
-Set maximum sized value gdb will load from the inferior."), _("\
-Show maximum sized value gdb will load from the inferior."), _("\
+ add_setshow_zuinteger_unlimited_cmd ("max-value-size", class_support,
+ &max_value_size, _ ("\
+Set maximum sized value gdb will load from the inferior."),
+ _ ("\
+Show maximum sized value gdb will load from the inferior."),
+ _ ("\
Use this to control the maximum size, in bytes, of a value that gdb\n\
will load from the inferior. Setting this value to 'unlimited'\n\
disables checking.\n\
Setting this does not invalidate already allocated values, it only\n\
prevents future values, larger than this size, from being allocated."),
- set_max_value_size,
- show_max_value_size,
- &setlist, &showlist);
+ set_max_value_size, show_max_value_size,
+ &setlist, &showlist);
set_show_commands vsize_limit
= add_setshow_zuinteger_unlimited_cmd ("varsize-limit", class_support,
- &max_value_size, _("\
-Set the maximum number of bytes allowed in a variable-size object."), _("\
-Show the maximum number of bytes allowed in a variable-size object."), _("\
+ &max_value_size, _ ("\
+Set the maximum number of bytes allowed in a variable-size object."),
+ _ ("\
+Show the maximum number of bytes allowed in a variable-size object."),
+ _ ("\
Attempts to access an object whose size is not a compile-time constant\n\
and exceeds this limit will cause an error."),
NULL, NULL, &setlist, &showlist);
diff --git a/gdb/value.h b/gdb/value.h
index f022510ded1..9160213d9c0 100644
--- a/gdb/value.h
+++ b/gdb/value.h
@@ -17,10 +17,10 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
-#if !defined (VALUE_H)
+#if !defined(VALUE_H)
#define VALUE_H 1
-#include "frame.h" /* For struct frame_id. */
+#include "frame.h" /* For struct frame_id. */
#include "extension.h"
#include "gdbsupport/gdb_ref_ptr.h"
#include "gmp-utils.h"
@@ -104,15 +104,9 @@ extern void value_decref (struct value *val);
struct value_ref_policy
{
- static void incref (struct value *ptr)
- {
- value_incref (ptr);
- }
+ static void incref (struct value *ptr) { value_incref (ptr); }
- static void decref (struct value *ptr)
- {
- value_decref (ptr);
- }
+ static void decref (struct value *ptr) { value_decref (ptr); }
};
/* A gdb:;ref_ptr pointer to a struct value. */
@@ -131,8 +125,7 @@ extern struct gdbarch *get_value_arch (const struct value *value);
code should instead be creating a new value with the changed type
(but possibly shared content). */
-extern void deprecated_set_value_type (struct value *value,
- struct type *type);
+extern void deprecated_set_value_type (struct value *value, struct type *type);
/* Only used for bitfields; number of bits contained in them. */
@@ -275,8 +268,8 @@ struct lval_funcs
/* If non-NULL, this is used to determine whether the indicated bits
of VALUE are a synthetic pointer. */
- int (*check_synthetic_pointer) (const struct value *value,
- LONGEST offset, int length);
+ int (*check_synthetic_pointer) (const struct value *value, LONGEST offset,
+ int length);
/* Return a duplicate of VALUE's closure, for use in a new value.
This may simply return the same closure, if VALUE's is
@@ -373,13 +366,14 @@ extern gdb::array_view<const gdb_byte> value_contents_all (struct value *);
/* Like value_contents_all, but does not require that the returned
bits be valid. This should only be used in situations where you
plan to check the validity manually. */
-extern gdb::array_view<const gdb_byte> value_contents_for_printing (struct value *value);
+extern gdb::array_view<const gdb_byte>
+value_contents_for_printing (struct value *value);
/* Like value_contents_for_printing, but accepts a constant value
pointer. Unlike value_contents_for_printing however, the pointed
value must _not_ be lazy. */
extern gdb::array_view<const gdb_byte>
- value_contents_for_printing_const (const struct value *value);
+value_contents_for_printing_const (const struct value *value);
extern void value_fetch_lazy (struct value *val);
@@ -402,14 +396,14 @@ extern int value_entirely_optimized_out (struct value *value);
/* Mark VALUE's content bytes starting at OFFSET and extending for
LENGTH bytes as optimized out. */
-extern void mark_value_bytes_optimized_out (struct value *value,
- int offset, int length);
+extern void mark_value_bytes_optimized_out (struct value *value, int offset,
+ int length);
/* Mark VALUE's content bits starting at OFFSET and extending for
LENGTH bits as optimized out. */
-extern void mark_value_bits_optimized_out (struct value *value,
- LONGEST offset, LONGEST length);
+extern void mark_value_bits_optimized_out (struct value *value, LONGEST offset,
+ LONGEST length);
/* Set or return field indicating whether a variable is initialized or
not, based on debugging information supplied by the compiler.
@@ -476,11 +470,9 @@ extern struct value *coerce_ref_if_computed (const struct value *arg);
It is a common implementation for coerce_ref and value_ind. */
-extern struct value * readjust_indirect_value_type (struct value *value,
- struct type *enc_type,
- const struct type *original_type,
- struct value *original_val,
- CORE_ADDR original_value_address);
+extern struct value *readjust_indirect_value_type (
+ struct value *value, struct type *enc_type, const struct type *original_type,
+ struct value *original_val, CORE_ADDR original_value_address);
/* Convert a REF to the object referenced. */
@@ -504,16 +496,16 @@ extern int value_bits_synthetic_pointer (const struct value *value,
nonzero if all bytes in the given range are available, zero if any
byte is unavailable. */
-extern int value_bytes_available (const struct value *value,
- LONGEST offset, LONGEST length);
+extern int value_bytes_available (const struct value *value, LONGEST offset,
+ LONGEST length);
/* Given a value, determine whether the contents bits starting at
OFFSET and extending for LENGTH bits are available. This returns
nonzero if all bits in the given range are available, zero if any
bit is unavailable. */
-extern int value_bits_available (const struct value *value,
- LONGEST offset, LONGEST length);
+extern int value_bits_available (const struct value *value, LONGEST offset,
+ LONGEST length);
/* Like value_bytes_available, but return false if any byte in the
whole object is unavailable. */
@@ -526,14 +518,14 @@ extern int value_entirely_unavailable (struct value *value);
/* Mark VALUE's content bytes starting at OFFSET and extending for
LENGTH bytes as unavailable. */
-extern void mark_value_bytes_unavailable (struct value *value,
- LONGEST offset, LONGEST length);
+extern void mark_value_bytes_unavailable (struct value *value, LONGEST offset,
+ LONGEST length);
/* Mark VALUE's content bits starting at OFFSET and extending for
LENGTH bits as unavailable. */
-extern void mark_value_bits_unavailable (struct value *value,
- LONGEST offset, LONGEST length);
+extern void mark_value_bits_unavailable (struct value *value, LONGEST offset,
+ LONGEST length);
/* Compare LENGTH bytes of VAL1's contents starting at OFFSET1 with
LENGTH bytes of VAL2's contents starting at OFFSET2.
@@ -605,8 +597,8 @@ extern bool value_contents_eq (const struct value *val1,
whether the memory is known to be stack memory. */
extern void read_value_memory (struct value *val, LONGEST bit_offset,
- int stack, CORE_ADDR memaddr,
- gdb_byte *buffer, size_t length);
+ int stack, CORE_ADDR memaddr, gdb_byte *buffer,
+ size_t length);
/* Cast SCALAR_VALUE to the element type of VECTOR_TYPE, then replicate
into each element of a new vector value with VECTOR_TYPE. */
@@ -614,8 +606,6 @@ extern void read_value_memory (struct value *val, LONGEST bit_offset,
struct value *value_vector_widen (struct value *scalar_value,
struct type *vector_type);
-
-
#include "symtab.h"
#include "gdbtypes.h"
#include "expression.h"
@@ -638,8 +628,7 @@ extern LONGEST unpack_long (struct type *type, const gdb_byte *valaddr);
extern CORE_ADDR unpack_pointer (struct type *type, const gdb_byte *valaddr);
extern LONGEST unpack_field_as_long (struct type *type,
- const gdb_byte *valaddr,
- int fieldno);
+ const gdb_byte *valaddr, int fieldno);
/* Unpack a bitfield of the specified FIELD_TYPE, from the object at
VALADDR, and store the result in *RESULT.
@@ -658,16 +647,17 @@ extern LONGEST unpack_field_as_long (struct type *type,
If the field is signed, we also do sign extension. */
extern LONGEST unpack_bits_as_long (struct type *field_type,
- const gdb_byte *valaddr,
- LONGEST bitpos, LONGEST bitsize);
+ const gdb_byte *valaddr, LONGEST bitpos,
+ LONGEST bitsize);
-extern int unpack_value_field_as_long (struct type *type, const gdb_byte *valaddr,
- LONGEST embedded_offset, int fieldno,
- const struct value *val, LONGEST *result);
+extern int unpack_value_field_as_long (struct type *type,
+ const gdb_byte *valaddr,
+ LONGEST embedded_offset, int fieldno,
+ const struct value *val,
+ LONGEST *result);
-extern void unpack_value_bitfield (struct value *dest_val,
- LONGEST bitpos, LONGEST bitsize,
- const gdb_byte *valaddr,
+extern void unpack_value_bitfield (struct value *dest_val, LONGEST bitpos,
+ LONGEST bitsize, const gdb_byte *valaddr,
LONGEST embedded_offset,
const struct value *val);
@@ -686,7 +676,6 @@ extern struct value *value_from_history_ref (const char *, const char **);
extern struct value *value_from_component (struct value *, struct type *,
LONGEST);
-
/* Create a new value by extracting it from WHOLE. TYPE is the type
of the new value. BIT_OFFSET and BIT_LENGTH describe the offset
and field width of the value to extract from WHOLE -- BIT_LENGTH
@@ -708,11 +697,11 @@ extern struct value *value_at_lazy (struct type *type, CORE_ADDR addr);
This can be important if the memory is "volatile". */
extern struct value *value_at_non_lval (struct type *type, CORE_ADDR addr);
-extern struct value *value_from_contents_and_address_unresolved
- (struct type *, const gdb_byte *, CORE_ADDR);
-extern struct value *value_from_contents_and_address (struct type *,
- const gdb_byte *,
- CORE_ADDR);
+extern struct value *
+value_from_contents_and_address_unresolved (struct type *, const gdb_byte *,
+ CORE_ADDR);
+extern struct value *
+value_from_contents_and_address (struct type *, const gdb_byte *, CORE_ADDR);
extern struct value *value_from_contents (struct type *, const gdb_byte *);
extern struct value *default_value_from_register (struct gdbarch *gdbarch,
@@ -726,8 +715,7 @@ extern void read_frame_register_value (struct value *value,
extern struct value *value_from_register (struct type *type, int regnum,
frame_info_ptr frame);
-extern CORE_ADDR address_from_register (int regnum,
- frame_info_ptr frame);
+extern CORE_ADDR address_from_register (int regnum, frame_info_ptr frame);
extern struct value *value_of_variable (struct symbol *var,
const struct block *b);
@@ -769,17 +757,14 @@ extern void value_free_to_mark (const struct value *mark);
temporary values created during the lifetime of this object. */
class scoped_value_mark
{
- public:
+public:
scoped_value_mark ()
: m_value (value_mark ())
{
}
- ~scoped_value_mark ()
- {
- free_to_mark ();
- }
+ ~scoped_value_mark () { free_to_mark (); }
scoped_value_mark (scoped_value_mark &&other) = default;
@@ -795,7 +780,7 @@ class scoped_value_mark
}
}
- private:
+private:
const struct value *m_value;
};
@@ -834,8 +819,7 @@ extern struct value *value_addr (struct value *arg1);
extern struct value *value_ref (struct value *arg1, enum type_code refcode);
-extern struct value *value_assign (struct value *toval,
- struct value *fromval);
+extern struct value *value_assign (struct value *toval, struct value *fromval);
extern struct value *value_pos (struct value *arg1);
@@ -843,13 +827,12 @@ extern struct value *value_neg (struct value *arg1);
extern struct value *value_complement (struct value *arg1);
-extern struct value *value_struct_elt (struct value **argp,
- gdb::optional<gdb::array_view <value *>> args,
- const char *name, int *static_memfuncp,
- const char *err);
+extern struct value *
+value_struct_elt (struct value **argp,
+ gdb::optional<gdb::array_view<value *>> args,
+ const char *name, int *static_memfuncp, const char *err);
-extern struct value *value_struct_elt_bitpos (struct value **argp,
- int bitpos,
+extern struct value *value_struct_elt_bitpos (struct value **argp, int bitpos,
struct type *field_type,
const char *err);
@@ -861,7 +844,12 @@ extern struct value *value_aggregate_elt (struct type *curtype,
extern struct value *value_static_field (struct type *type, int fieldno);
-enum oload_search_type { NON_METHOD, METHOD, BOTH };
+enum oload_search_type
+{
+ NON_METHOD,
+ METHOD,
+ BOTH
+};
extern int find_overload_match (gdb::array_view<value *> args,
const char *name,
@@ -877,7 +865,6 @@ extern struct value *value_primitive_field (struct value *arg1, LONGEST offset,
int fieldno,
struct type *arg_type);
-
extern struct type *value_rtti_indirect_type (struct value *, int *, LONGEST *,
int *);
@@ -939,9 +926,12 @@ extern value *evaluate_var_msym_value (enum noside noside,
struct objfile *objfile,
minimal_symbol *msymbol);
-namespace expr { class operation; };
-extern void fetch_subexp_value (struct expression *exp,
- expr::operation *op,
+namespace expr
+{
+class operation;
+};
+
+extern void fetch_subexp_value (struct expression *exp, expr::operation *op,
struct value **valp, struct value **resultp,
std::vector<value_ref_ptr> *val_chain,
bool preserve_errors);
@@ -957,12 +947,11 @@ extern CORE_ADDR parse_and_eval_address (const char *exp);
extern LONGEST parse_and_eval_long (const char *exp);
extern void unop_promote (const struct language_defn *language,
- struct gdbarch *gdbarch,
- struct value **arg1);
+ struct gdbarch *gdbarch, struct value **arg1);
extern void binop_promote (const struct language_defn *language,
- struct gdbarch *gdbarch,
- struct value **arg1, struct value **arg2);
+ struct gdbarch *gdbarch, struct value **arg1,
+ struct value **arg2);
extern struct value *access_value_history (int num);
@@ -984,8 +973,7 @@ extern void set_internalvar_string (struct internalvar *var,
extern void clear_internalvar (struct internalvar *var);
-extern void set_internalvar_component (struct internalvar *var,
- LONGEST offset,
+extern void set_internalvar_component (struct internalvar *var, LONGEST offset,
LONGEST bitpos, LONGEST bitsize,
struct value *newvalue);
@@ -1005,8 +993,7 @@ struct internalvar_funcs
the function is the same argument that was passed to
`create_internalvar_type_lazy'. */
- struct value *(*make_value) (struct gdbarch *arch,
- struct internalvar *var,
+ struct value *(*make_value) (struct gdbarch *arch, struct internalvar *var,
void *data);
/* Update the agent expression EXPR with bytecode to compute the
@@ -1016,15 +1003,12 @@ struct internalvar_funcs
NULL, then the internalvar cannot be compiled to an agent
expression. */
- void (*compile_to_ax) (struct internalvar *var,
- struct agent_expr *expr,
- struct axs_value *value,
- void *data);
+ void (*compile_to_ax) (struct internalvar *var, struct agent_expr *expr,
+ struct axs_value *value, void *data);
};
-extern struct internalvar *create_internalvar_type_lazy (const char *name,
- const struct internalvar_funcs *funcs,
- void *data);
+extern struct internalvar *create_internalvar_type_lazy (
+ const char *name, const struct internalvar_funcs *funcs, void *data);
/* Compile an internal variable to an agent expression. VAR is the
variable to compile; EXPR and VALUE are the agent expression we are
@@ -1071,8 +1055,7 @@ extern struct value *value_x_unop (struct value *arg1, enum exp_opcode op,
extern struct value *value_fn_field (struct value **arg1p, struct fn_field *f,
int j, struct type *type, LONGEST offset);
-extern int binop_types_user_defined_p (enum exp_opcode op,
- struct type *type1,
+extern int binop_types_user_defined_p (enum exp_opcode op, struct type *type1,
struct type *type2);
extern int binop_user_defined_p (enum exp_opcode op, struct value *arg1,
@@ -1086,8 +1069,8 @@ extern value_ref_ptr release_value (struct value *val);
extern int record_latest_value (struct value *val);
-extern void modify_field (struct type *type, gdb_byte *addr,
- LONGEST fieldval, LONGEST bitpos, LONGEST bitsize);
+extern void modify_field (struct type *type, gdb_byte *addr, LONGEST fieldval,
+ LONGEST bitpos, LONGEST bitsize);
extern void type_print (struct type *type, const char *varstring,
struct ui_file *stream, int show);
@@ -1095,11 +1078,11 @@ extern void type_print (struct type *type, const char *varstring,
extern std::string type_to_string (struct type *type);
extern gdb_byte *baseclass_addr (struct type *type, int index,
- gdb_byte *valaddr,
- struct value **valuep, int *errp);
+ gdb_byte *valaddr, struct value **valuep,
+ int *errp);
-extern void print_longest (struct ui_file *stream, int format,
- int use_local, LONGEST val);
+extern void print_longest (struct ui_file *stream, int format, int use_local,
+ LONGEST val);
extern void print_floating (const gdb_byte *valaddr, struct type *type,
struct ui_file *stream);
@@ -1113,24 +1096,21 @@ extern void value_print (struct value *val, struct ui_file *stream,
are returned in reverse order of creation; that is, newest
first. */
-extern std::vector<value_ref_ptr> value_release_to_mark
- (const struct value *mark);
+extern std::vector<value_ref_ptr>
+value_release_to_mark (const struct value *mark);
-extern void common_val_print (struct value *val,
- struct ui_file *stream, int recurse,
+extern void common_val_print (struct value *val, struct ui_file *stream,
+ int recurse,
const struct value_print_options *options,
const struct language_defn *language);
extern int val_print_string (struct type *elttype, const char *encoding,
- CORE_ADDR addr, int len,
- struct ui_file *stream,
+ CORE_ADDR addr, int len, struct ui_file *stream,
const struct value_print_options *options);
-extern void print_variable_and_value (const char *name,
- struct symbol *var,
+extern void print_variable_and_value (const char *name, struct symbol *var,
frame_info_ptr frame,
- struct ui_file *stream,
- int indent);
+ struct ui_file *stream, int indent);
extern void typedef_print (struct type *type, struct symbol *news,
struct ui_file *stream);
@@ -1179,11 +1159,9 @@ extern struct value *value_allocate_space_in_inferior (int);
/* User function handler. */
-typedef struct value *(*internal_function_fn) (struct gdbarch *gdbarch,
- const struct language_defn *language,
- void *cookie,
- int argc,
- struct value **argv);
+typedef struct value *(*internal_function_fn) (
+ struct gdbarch *gdbarch, const struct language_defn *language, void *cookie,
+ int argc, struct value **argv);
/* Add a new internal function. NAME is the name of the function; DOC
is a documentation string describing the function. HANDLER is
@@ -1192,20 +1170,18 @@ typedef struct value *(*internal_function_fn) (struct gdbarch *gdbarch,
data". */
extern void add_internal_function (const char *name, const char *doc,
- internal_function_fn handler,
- void *cookie);
+ internal_function_fn handler, void *cookie);
/* This overload takes an allocated documentation string. */
extern void add_internal_function (gdb::unique_xmalloc_ptr<char> &&name,
gdb::unique_xmalloc_ptr<char> &&doc,
- internal_function_fn handler,
- void *cookie);
+ internal_function_fn handler, void *cookie);
struct value *call_internal_function (struct gdbarch *gdbarch,
const struct language_defn *language,
- struct value *function,
- int argc, struct value **argv);
+ struct value *function, int argc,
+ struct value **argv);
const char *value_internal_function_name (struct value *);
diff --git a/gdb/varobj.c b/gdb/varobj.c
index eb47ecada3e..6f0f880bd56 100644
--- a/gdb/varobj.c
+++ b/gdb/varobj.c
@@ -44,16 +44,18 @@ typedef int PyObject;
/* See varobj.h. */
unsigned int varobjdebug = 0;
+
static void
show_varobjdebug (struct ui_file *file, int from_tty,
struct cmd_list_element *c, const char *value)
{
- gdb_printf (file, _("Varobj debugging is %s.\n"), value);
+ gdb_printf (file, _ ("Varobj debugging is %s.\n"), value);
}
/* String representations of gdb's format codes. */
-const char *varobj_format_string[] =
- { "natural", "binary", "decimal", "hexadecimal", "octal", "zero-hexadecimal" };
+const char *varobj_format_string[]
+ = { "natural", "binary", "decimal",
+ "hexadecimal", "octal", "zero-hexadecimal" };
/* True if we want to allow Python-based pretty-printing. */
static bool pretty_printing = false;
@@ -158,9 +160,9 @@ static void uninstall_variable (struct varobj *);
static struct varobj *create_child (struct varobj *, int, std::string &);
-static struct varobj *
-create_child_with_value (struct varobj *parent, int index,
- struct varobj_item *item);
+static struct varobj *create_child_with_value (struct varobj *parent,
+ int index,
+ struct varobj_item *item);
/* Utility routines */
@@ -203,8 +205,6 @@ static std::list<struct varobj_root *> rootlist;
/* Pointer to the varobj hash table (built at run time). */
static htab_t varobj_table;
-
-
/* API Implementation */
static bool
is_root_p (const struct varobj *var)
@@ -216,7 +216,7 @@ is_root_p (const struct varobj *var)
/* See python-internal.h. */
gdbpy_enter_varobj::gdbpy_enter_varobj (const struct varobj *var)
-: gdbpy_enter (var->root->gdbarch, var->root->language_defn)
+ : gdbpy_enter (var->root->gdbarch, var->root->language_defn)
{
}
@@ -233,8 +233,7 @@ find_frame_addr_in_frame_chain (CORE_ADDR frame_addr)
if (frame_addr == (CORE_ADDR) 0)
return NULL;
- for (frame = get_current_frame ();
- frame != NULL;
+ for (frame = get_current_frame (); frame != NULL;
frame = get_prev_frame (frame))
{
/* The CORE_ADDR we get as argument was parsed from a string GDB
@@ -257,8 +256,8 @@ find_frame_addr_in_frame_chain (CORE_ADDR frame_addr)
/* Creates a varobj (not its children). */
struct varobj *
-varobj_create (const char *objname,
- const char *expression, CORE_ADDR frame, enum varobj_type type)
+varobj_create (const char *objname, const char *expression, CORE_ADDR frame,
+ enum varobj_type type)
{
/* Fill out a varobj structure for the (root) variable being constructed. */
std::unique_ptr<varobj> var (new varobj (new varobj_root));
@@ -327,18 +326,15 @@ varobj_create (const char *objname,
/* Don't allow variables to be created for types. */
enum exp_opcode opcode = var->root->exp->first_opcode ();
- if (opcode == OP_TYPE
- || opcode == OP_TYPEOF
- || opcode == OP_DECLTYPE)
+ if (opcode == OP_TYPE || opcode == OP_TYPEOF || opcode == OP_DECLTYPE)
{
gdb_printf (gdb_stderr, "Attempt to use a type name"
- " as an expression.\n");
+ " as an expression.\n");
return NULL;
}
var->format = variable_default_display (var.get ());
- var->root->valid_block =
- var->root->floating ? NULL : tracker.block ();
+ var->root->valid_block = var->root->floating ? NULL : tracker.block ();
var->root->global
= var->root->floating ? false : var->root->valid_block == nullptr;
var->name = expression;
@@ -356,12 +352,12 @@ varobj_create (const char *objname,
it correctly next time. With VALID_BLOCK set we must also set
FRAME and THREAD_ID. */
if (fi == NULL)
- error (_("Failed to find the specified frame"));
+ error (_ ("Failed to find the specified frame"));
var->root->frame = get_frame_id (fi);
var->root->thread_id = inferior_thread ()->global_num;
old_id = get_frame_id (get_selected_frame (NULL));
- select_frame (fi);
+ select_frame (fi);
}
/* We definitely need to catch errors here.
@@ -375,7 +371,8 @@ varobj_create (const char *objname,
{
/* Error getting the value. Try to at least get the
right type. */
- struct value *type_only_value = evaluate_type (var->root->exp.get ());
+ struct value *type_only_value
+ = evaluate_type (var->root->exp.get ());
var->type = value_type (type_only_value);
}
@@ -436,7 +433,7 @@ varobj_get_handle (const char *objname)
htab_hash_string (objname));
if (var == NULL)
- error (_("Variable object not found"));
+ error (_ ("Variable object not found"));
return var;
}
@@ -503,11 +500,11 @@ varobj_set_display_format (struct varobj *var,
var->format = variable_default_display (var);
}
- if (varobj_value_is_changeable_p (var)
- && var->value != nullptr && !value_lazy (var->value.get ()))
+ if (varobj_value_is_changeable_p (var) && var->value != nullptr
+ && !value_lazy (var->value.get ()))
{
- var->print_value = varobj_value_get_print_value (var->value.get (),
- var->format, var);
+ var->print_value
+ = varobj_value_get_print_value (var->value.get (), var->format, var);
}
return var->format;
@@ -586,8 +583,8 @@ varobj_get_frozen (const struct varobj *var)
negative the entire range is used. */
void
-varobj_restrict_range (const std::vector<varobj *> &children,
- int *from, int *to)
+varobj_restrict_range (const std::vector<varobj *> &children, int *from,
+ int *to)
{
int len = children.size ();
@@ -611,14 +608,11 @@ varobj_restrict_range (const std::vector<varobj *> &children,
child when needed. */
static void
-install_dynamic_child (struct varobj *var,
- std::vector<varobj *> *changed,
+install_dynamic_child (struct varobj *var, std::vector<varobj *> *changed,
std::vector<varobj *> *type_changed,
std::vector<varobj *> *newobj,
- std::vector<varobj *> *unchanged,
- bool *cchanged,
- int index,
- struct varobj_item *item)
+ std::vector<varobj *> *unchanged, bool *cchanged,
+ int index, struct varobj_item *item)
{
if (var->children.size () < index + 1)
{
@@ -634,8 +628,8 @@ install_dynamic_child (struct varobj *var,
else
{
varobj *existing = var->children[index];
- bool type_updated = update_type_if_necessary (existing,
- item->value.get ());
+ bool type_updated
+ = update_type_if_necessary (existing, item->value.get ());
if (type_updated)
{
@@ -691,9 +685,7 @@ update_dynamic_varobj_children (struct varobj *var,
std::vector<varobj *> *type_changed,
std::vector<varobj *> *newobj,
std::vector<varobj *> *unchanged,
- bool *cchanged,
- bool update_children,
- int from,
+ bool *cchanged, bool update_children, int from,
int to)
{
int i;
@@ -909,7 +901,7 @@ varobj_get_path_expr_parent (const struct varobj *var)
/* Computation of full rooted expression for children of dynamic
varobjs is not supported. */
if (varobj_is_dynamic_p (parent))
- error (_("Invalid variable object (child of a dynamic varobj)"));
+ error (_ ("Invalid variable object (child of a dynamic varobj)"));
return parent;
}
@@ -928,7 +920,8 @@ varobj_get_path_expr (const struct varobj *var)
struct varobj *mutable_var = (struct varobj *) var;
gdb_assert (!is_root_p (var));
- mutable_var->path_expr = (*var->root->lang_ops->path_expr_of_child) (var);
+ mutable_var->path_expr
+ = (*var->root->lang_ops->path_expr_of_child) (var);
}
return var->path_expr.c_str ();
@@ -947,7 +940,7 @@ varobj_get_attributes (const struct varobj *var)
if (varobj_editable_p (var))
/* FIXME: define masks for attributes. */
- attributes |= 0x00000001; /* Editable */
+ attributes |= 0x00000001; /* Editable */
return attributes;
}
@@ -990,7 +983,7 @@ varobj_set_value (struct varobj *var, const char *expression)
gdb_assert (varobj_editable_p (var));
- input_radix = 10; /* ALWAYS reset to decimal temporarily. */
+ input_radix = 10; /* ALWAYS reset to decimal temporarily. */
expression_up exp = parse_exp_1 (&s, 0, 0, 0);
try
{
@@ -1078,13 +1071,13 @@ install_default_visualizer (struct varobj *var)
if (pretty_printer == nullptr)
{
gdbpy_print_stack ();
- error (_("Cannot instantiate printer for default visualizer"));
+ error (_ ("Cannot instantiate printer for default visualizer"));
}
}
if (pretty_printer == Py_None)
pretty_printer.reset (nullptr);
-
+
install_visualizer (var->dynamic, NULL, pretty_printer.release ());
}
}
@@ -1106,9 +1099,9 @@ construct_visualizer (struct varobj *var, PyObject *constructor)
pretty_printer = NULL;
else
{
- pretty_printer = instantiate_pretty_printer (constructor,
- var->value.get ());
- if (! pretty_printer)
+ pretty_printer
+ = instantiate_pretty_printer (constructor, var->value.get ());
+ if (!pretty_printer)
{
gdbpy_print_stack ();
Py_DECREF (constructor);
@@ -1205,7 +1198,7 @@ update_type_if_necessary (struct varobj *var, struct value *new_value)
take care of releasing it when needed. */
static bool
install_new_value (struct varobj *var, struct value *value, bool initial)
-{
+{
bool changeable;
bool need_to_fetch;
bool changed = false;
@@ -1265,7 +1258,6 @@ install_new_value (struct varobj *var, struct value *value, bool initial)
}
else
{
-
try
{
value_fetch_lazy (value);
@@ -1321,7 +1313,7 @@ install_new_value (struct varobj *var, struct value *value, bool initial)
value. */
changed = true;
}
- else if (var->value == NULL && value == NULL)
+ else if (var->value == NULL && value == NULL)
/* Equal. */
;
else if (var->value == NULL || value == NULL)
@@ -1363,8 +1355,8 @@ install_new_value (struct varobj *var, struct value *value, bool initial)
to see if the variable changed. */
if (var->dynamic->pretty_printer != NULL)
{
- print_value = varobj_value_get_print_value (var->value.get (),
- var->format, var);
+ print_value
+ = varobj_value_get_print_value (var->value.get (), var->format, var);
if (var->print_value != print_value)
changed = true;
}
@@ -1396,7 +1388,7 @@ varobj_set_child_range (struct varobj *var, int from, int to)
var->to = to;
}
-void
+void
varobj_set_visualizer (struct varobj *var, const char *visualizer)
{
#if HAVE_PYTHON
@@ -1416,7 +1408,7 @@ varobj_set_visualizer (struct varobj *var, const char *visualizer)
if (constructor == NULL)
{
gdbpy_print_stack ();
- error (_("Could not evaluate visualizer expression: %s"), visualizer);
+ error (_ ("Could not evaluate visualizer expression: %s"), visualizer);
}
construct_visualizer (var, constructor.get ());
@@ -1425,7 +1417,7 @@ varobj_set_visualizer (struct varobj *var, const char *visualizer)
varobj_delete (var, 1 /* children only */);
var->num_children = -1;
#else
- error (_("Python support required"));
+ error (_ ("Python support required"));
#endif
}
@@ -1510,12 +1502,12 @@ varobj_update (struct varobj **varp, bool is_explicit)
has changed. */
newobj = value_of_root (varp, &type_changed);
if (update_type_if_necessary (*varp, newobj))
- type_changed = true;
+ type_changed = true;
r.varobj = *varp;
r.type_changed = type_changed;
if (install_new_value ((*varp), newobj, type_changed))
r.changed = true;
-
+
if (newobj == NULL)
r.status = VAROBJ_NOT_IN_SCOPE;
r.value_installed = true;
@@ -1577,7 +1569,8 @@ varobj_update (struct varobj **varp, bool is_explicit)
for which -var-list-children was never invoked. */
if (varobj_is_dynamic_p (v))
{
- std::vector<varobj *> changed, type_changed_vec, unchanged, newobj_vec;
+ std::vector<varobj *> changed, type_changed_vec, unchanged,
+ newobj_vec;
bool children_changed = false;
if (v->frozen)
@@ -1610,9 +1603,9 @@ varobj_update (struct varobj **varp, bool is_explicit)
/* If update_dynamic_varobj_children returns false, then we have
a non-conforming pretty-printer, so we skip it. */
if (update_dynamic_varobj_children (v, &changed, &type_changed_vec,
- &newobj_vec,
- &unchanged, &children_changed,
- true, v->from, v->to))
+ &newobj_vec, &unchanged,
+ &children_changed, true, v->from,
+ v->to))
{
if (children_changed || !newobj_vec.empty ())
{
@@ -1693,7 +1686,7 @@ delete_variable (struct varobj *var, bool only_children_p)
int delcount = 0;
delete_variable_1 (&delcount, var, only_children_p,
- true /* remove_from_parent_p */ );
+ true /* remove_from_parent_p */);
return delcount;
}
@@ -1708,7 +1701,7 @@ delete_variable_1 (int *delcountp, struct varobj *var, bool only_children_p,
{
/* Delete any children of this variable, too. */
for (varobj *child : var->children)
- {
+ {
if (!child)
continue;
@@ -1751,11 +1744,10 @@ static void
install_variable (struct varobj *var)
{
hashval_t hash = htab_hash_string (var->obj_name.c_str ());
- void **slot = htab_find_slot_with_hash (varobj_table,
- var->obj_name.c_str (),
+ void **slot = htab_find_slot_with_hash (varobj_table, var->obj_name.c_str (),
hash, INSERT);
if (*slot != nullptr)
- error (_("Duplicate variable object name"));
+ error (_ ("Duplicate variable object name"));
/* Add varobj to hash table. */
*slot = var;
@@ -1810,11 +1802,10 @@ create_child_with_value (struct varobj *parent, int index,
child->parent = parent;
if (varobj_is_anonymous_child (child))
- child->obj_name = string_printf ("%s.%d_anonymous",
- parent->obj_name.c_str (), index);
+ child->obj_name
+ = string_printf ("%s.%d_anonymous", parent->obj_name.c_str (), index);
else
- child->obj_name = string_printf ("%s.%s",
- parent->obj_name.c_str (),
+ child->obj_name = string_printf ("%s.%s", parent->obj_name.c_str (),
child->name.c_str ());
install_variable (child);
@@ -1827,13 +1818,12 @@ create_child_with_value (struct varobj *parent, int index,
child->type = value_actual_type (item->value.get (), 0, NULL);
else
/* Otherwise, we must compute the type. */
- child->type = (*child->root->lang_ops->type_of_child) (child->parent,
- child->index);
+ child->type
+ = (*child->root->lang_ops->type_of_child) (child->parent, child->index);
install_new_value (child, item->value.get (), 1);
return child;
}
-
/*
* Miscellaneous utility functions.
@@ -1841,7 +1831,8 @@ create_child_with_value (struct varobj *parent, int index,
/* Allocate memory and initialize a new variable. */
varobj::varobj (varobj_root *root_)
-: root (root_), dynamic (new varobj_dynamic)
+ : root (root_),
+ dynamic (new varobj_dynamic)
{
}
@@ -1957,8 +1948,8 @@ check_scope (const struct varobj *var)
{
CORE_ADDR pc = get_frame_pc (fi);
- if (pc < var->root->valid_block->start () ||
- pc >= var->root->valid_block->end ())
+ if (pc < var->root->valid_block->start ()
+ || pc >= var->root->valid_block->end ())
scope = false;
else
select_frame (fi);
@@ -1974,7 +1965,7 @@ value_of_root_1 (struct varobj **var_handle)
struct value *new_val = NULL;
struct varobj *var = *var_handle;
bool within_scope = false;
-
+
/* Only root variables can be updated... */
if (!is_root_p (var))
/* Not a root var. */
@@ -1991,7 +1982,7 @@ value_of_root_1 (struct varobj **var_handle)
created. Technically, it's possible that the program became
multi-threaded since then, but we don't support such
scenario yet. */
- within_scope = check_scope (var);
+ within_scope = check_scope (var);
}
else
{
@@ -2006,7 +1997,6 @@ value_of_root_1 (struct varobj **var_handle)
if (within_scope)
{
-
/* We need to catch errors here, because if evaluate
expression fails we want to just return NULL. */
try
@@ -2172,7 +2162,7 @@ varobj_value_get_print_value (struct value *value,
#if HAVE_PYTHON
if (gdb_python_initialized)
{
- PyObject *value_formatter = var->dynamic->pretty_printer;
+ PyObject *value_formatter = var->dynamic->pretty_printer;
gdbpy_enter_varobj enter_py (var);
@@ -2187,10 +2177,9 @@ varobj_value_get_print_value (struct value *value,
{
struct value *replacement;
- gdbpy_ref<> output = apply_varobj_pretty_printer (value_formatter,
- &replacement,
- &stb,
- &opts);
+ gdbpy_ref<> output
+ = apply_varobj_pretty_printer (value_formatter, &replacement,
+ &stb, &opts);
/* If we have string like output ... */
if (output != NULL)
@@ -2379,7 +2368,7 @@ varobj_re_set_iter (struct varobj *var)
/* See varobj.h. */
-void
+void
varobj_re_set (void)
{
all_root_varobjs (varobj_re_set_iter);
@@ -2393,44 +2382,43 @@ varobj_invalidate_if_uses_objfile (struct objfile *objfile)
if (objfile->separate_debug_objfile_backlink != nullptr)
objfile = objfile->separate_debug_objfile_backlink;
- all_root_varobjs ([objfile] (struct varobj *var)
- {
- if (var->root->valid_block != nullptr)
- {
- struct objfile *bl_objfile = block_objfile (var->root->valid_block);
- if (bl_objfile->separate_debug_objfile_backlink != nullptr)
- bl_objfile = bl_objfile->separate_debug_objfile_backlink;
+ all_root_varobjs ([objfile] (struct varobj *var) {
+ if (var->root->valid_block != nullptr)
+ {
+ struct objfile *bl_objfile = block_objfile (var->root->valid_block);
+ if (bl_objfile->separate_debug_objfile_backlink != nullptr)
+ bl_objfile = bl_objfile->separate_debug_objfile_backlink;
- if (bl_objfile == objfile)
- {
- /* The varobj is tied to a block which is going away. There is
+ if (bl_objfile == objfile)
+ {
+ /* The varobj is tied to a block which is going away. There is
no way to reconstruct something later, so invalidate the
varobj completly and drop the reference to the block which is
being freed. */
- var->root->is_valid = false;
- var->root->valid_block = nullptr;
- }
- }
+ var->root->is_valid = false;
+ var->root->valid_block = nullptr;
+ }
+ }
- if (var->root->exp != nullptr && var->root->exp->uses_objfile (objfile))
- {
- /* The varobj's current expression references the objfile. For
+ if (var->root->exp != nullptr && var->root->exp->uses_objfile (objfile))
+ {
+ /* The varobj's current expression references the objfile. For
globals and floating, it is possible that when we try to
re-evaluate the expression later it is still valid with
whatever is in scope at that moment. Just invalidate the
expression for now. */
- var->root->exp.reset ();
+ var->root->exp.reset ();
- /* It only makes sense to keep a floating varobj around. */
- if (!var->root->floating)
- var->root->is_valid = false;
- }
+ /* It only makes sense to keep a floating varobj around. */
+ if (!var->root->floating)
+ var->root->is_valid = false;
+ }
- /* var->value->type and var->type might also reference the objfile.
+ /* var->value->type and var->type might also reference the objfile.
This is taken care of in value.c:preserve_values which deals with
making sure that objfile-owend types are replaced with
gdbarch-owned equivalents. */
- });
+ });
}
/* A hash function for a varobj. */
@@ -2454,19 +2442,19 @@ eq_varobj_and_string (const void *a, const void *b)
}
void _initialize_varobj ();
+
void
_initialize_varobj ()
{
varobj_table = htab_create_alloc (5, hash_varobj, eq_varobj_and_string,
nullptr, xcalloc, xfree);
- add_setshow_zuinteger_cmd ("varobj", class_maintenance,
- &varobjdebug,
- _("Set varobj debugging."),
- _("Show varobj debugging."),
- _("When non-zero, varobj debugging is enabled."),
- NULL, show_varobjdebug,
- &setdebuglist, &showdebuglist);
+ add_setshow_zuinteger_cmd ("varobj", class_maintenance, &varobjdebug,
+ _ ("Set varobj debugging."),
+ _ ("Show varobj debugging."),
+ _ ("When non-zero, varobj debugging is enabled."),
+ NULL, show_varobjdebug, &setdebuglist,
+ &showdebuglist);
gdb::observers::free_objfile.attach (varobj_invalidate_if_uses_objfile,
"varobj");
diff --git a/gdb/varobj.h b/gdb/varobj.h
index ea335abba08..4a56dafb6ce 100644
--- a/gdb/varobj.h
+++ b/gdb/varobj.h
@@ -23,32 +23,32 @@
/* Enumeration for the format types */
enum varobj_display_formats
- {
- FORMAT_NATURAL, /* What gdb actually calls 'natural' */
- FORMAT_BINARY, /* Binary display */
- FORMAT_DECIMAL, /* Decimal display */
- FORMAT_HEXADECIMAL, /* Hex display */
- FORMAT_OCTAL, /* Octal display */
- FORMAT_ZHEXADECIMAL /* Zero padded hexadecimal */
- };
+{
+ FORMAT_NATURAL, /* What gdb actually calls 'natural' */
+ FORMAT_BINARY, /* Binary display */
+ FORMAT_DECIMAL, /* Decimal display */
+ FORMAT_HEXADECIMAL, /* Hex display */
+ FORMAT_OCTAL, /* Octal display */
+ FORMAT_ZHEXADECIMAL /* Zero padded hexadecimal */
+};
enum varobj_type
- {
- USE_SPECIFIED_FRAME, /* Use the frame passed to varobj_create. */
- USE_CURRENT_FRAME, /* Use the current frame. */
- USE_SELECTED_FRAME /* Always reevaluate in selected frame. */
- };
+{
+ USE_SPECIFIED_FRAME, /* Use the frame passed to varobj_create. */
+ USE_CURRENT_FRAME, /* Use the current frame. */
+ USE_SELECTED_FRAME /* Always reevaluate in selected frame. */
+};
/* Enumerator describing if a variable object is in scope. */
enum varobj_scope_status
- {
- VAROBJ_IN_SCOPE = 0, /* Varobj is scope, value available. */
- VAROBJ_NOT_IN_SCOPE = 1, /* Varobj is not in scope, value not
+{
+ VAROBJ_IN_SCOPE = 0, /* Varobj is scope, value available. */
+ VAROBJ_NOT_IN_SCOPE = 1, /* Varobj is not in scope, value not
available, but varobj can become in
scope later. */
- VAROBJ_INVALID = 2, /* Varobj no longer has any value, and never
+ VAROBJ_INVALID = 2, /* Varobj no longer has any value, and never
will. */
- };
+};
/* String representations of gdb's format codes (defined in varobj.c). */
extern const char *varobj_format_string[];
@@ -61,8 +61,10 @@ struct varobj_update_result
{
varobj_update_result (struct varobj *varobj_,
varobj_scope_status status_ = VAROBJ_IN_SCOPE)
- : varobj (varobj_), status (status_)
- {}
+ : varobj (varobj_),
+ status (status_)
+ {
+ }
varobj_update_result (varobj_update_result &&other) = default;
@@ -168,7 +170,7 @@ struct varobj
/* Is the variable X one of our "fake" children? */
#define CPLUS_FAKE_CHILD(x) \
-((x) != NULL && (x)->type == NULL && (x)->value == NULL)
+ ((x) != NULL && (x)->type == NULL && (x)->value == NULL)
/* The language specific vector */
@@ -256,12 +258,12 @@ extern std::string varobj_get_expression (const struct varobj *var);
extern int varobj_delete (struct varobj *var, bool only_children);
-extern enum varobj_display_formats varobj_set_display_format (
- struct varobj *var,
- enum varobj_display_formats format);
+extern enum varobj_display_formats
+varobj_set_display_format (struct varobj *var,
+ enum varobj_display_formats format);
-extern enum varobj_display_formats varobj_get_display_format (
- const struct varobj *var);
+extern enum varobj_display_formats
+varobj_get_display_format (const struct varobj *var);
extern int varobj_get_thread_id (const struct varobj *var);
@@ -275,7 +277,7 @@ extern void varobj_get_child_range (const struct varobj *var, int *from,
extern void varobj_set_child_range (struct varobj *var, int from, int to);
extern gdb::unique_xmalloc_ptr<char>
- varobj_get_display_hint (const struct varobj *var);
+varobj_get_display_hint (const struct varobj *var);
extern int varobj_get_num_children (struct varobj *var);
@@ -287,8 +289,8 @@ extern int varobj_get_num_children (struct varobj *var);
that was returned. The resulting vector will contain at least the
children from *FROM to just before *TO; it might contain more
children, depending on whether any more were available. */
-extern const std::vector<varobj *> &
- varobj_list_children (struct varobj *var, int *from, int *to);
+extern const std::vector<varobj *> &varobj_list_children (struct varobj *var,
+ int *from, int *to);
extern std::string varobj_get_type (struct varobj *var);
@@ -297,13 +299,13 @@ extern struct type *varobj_get_gdb_type (const struct varobj *var);
extern const char *varobj_get_path_expr (const struct varobj *var);
extern const struct language_defn *
- varobj_get_language (const struct varobj *var);
+varobj_get_language (const struct varobj *var);
extern int varobj_get_attributes (const struct varobj *var);
extern std::string
- varobj_get_formatted_value (struct varobj *var,
- enum varobj_display_formats format);
+varobj_get_formatted_value (struct varobj *var,
+ enum varobj_display_formats format);
extern std::string varobj_get_value (struct varobj *var);
@@ -311,8 +313,8 @@ extern bool varobj_set_value (struct varobj *var, const char *expression);
extern void all_root_varobjs (gdb::function_view<void (struct varobj *var)>);
-extern std::vector<varobj_update_result>
- varobj_update (struct varobj **varp, bool is_explicit);
+extern std::vector<varobj_update_result> varobj_update (struct varobj **varp,
+ bool is_explicit);
/* Try to recreate any global or floating varobj. This is called after
changing symbol files. */
@@ -323,8 +325,7 @@ extern bool varobj_editable_p (const struct varobj *var);
extern bool varobj_floating_p (const struct varobj *var);
-extern void varobj_set_visualizer (struct varobj *var,
- const char *visualizer);
+extern void varobj_set_visualizer (struct varobj *var, const char *visualizer);
extern void varobj_enable_pretty_printing (void);
@@ -340,15 +341,16 @@ extern struct type *varobj_get_value_type (const struct varobj *var);
extern bool varobj_is_anonymous_child (const struct varobj *child);
extern const struct varobj *
- varobj_get_path_expr_parent (const struct varobj *var);
+varobj_get_path_expr_parent (const struct varobj *var);
extern std::string
- varobj_value_get_print_value (struct value *value,
- enum varobj_display_formats format,
- const struct varobj *var);
+varobj_value_get_print_value (struct value *value,
+ enum varobj_display_formats format,
+ const struct varobj *var);
-extern void varobj_formatted_print_options (struct value_print_options *opts,
- enum varobj_display_formats format);
+extern void
+varobj_formatted_print_options (struct value_print_options *opts,
+ enum varobj_display_formats format);
extern void varobj_restrict_range (const std::vector<varobj *> &children,
int *from, int *to);
diff --git a/gdb/vax-bsd-nat.c b/gdb/vax-bsd-nat.c
index b6c4e5abeb5..ad156eca495 100644
--- a/gdb/vax-bsd-nat.c
+++ b/gdb/vax-bsd-nat.c
@@ -45,7 +45,7 @@ static vax_bsd_nat_target the_vax_bsd_nat_target;
static void
vaxbsd_supply_gregset (struct regcache *regcache, const void *gregs)
{
- const gdb_byte *regs = (const gdb_byte *)gregs;
+ const gdb_byte *regs = (const gdb_byte *) gregs;
int regnum;
for (regnum = 0; regnum < VAX_NUM_REGS; regnum++)
@@ -56,10 +56,10 @@ vaxbsd_supply_gregset (struct regcache *regcache, const void *gregs)
in GREGS. */
static void
-vaxbsd_collect_gregset (const struct regcache *regcache,
- void *gregs, int regnum)
+vaxbsd_collect_gregset (const struct regcache *regcache, void *gregs,
+ int regnum)
{
- gdb_byte *regs = (void *)gregs;
+ gdb_byte *regs = (void *) gregs;
int i;
for (i = 0; i <= VAX_NUM_REGS; i++)
@@ -68,7 +68,6 @@ vaxbsd_collect_gregset (const struct regcache *regcache,
regcache->raw_collect (i, regs + i * 4);
}
}
-
/* Fetch register REGNUM from the inferior. If REGNUM is -1, do this
for all registers. */
@@ -81,7 +80,7 @@ vax_bsd_nat_target::fetch_registers (struct regcache *regcache, int regnum)
int lwp = regcache->ptid ().lwp ();
if (ptrace (PT_GETREGS, pid, (PTRACE_TYPE_ARG3) &regs, lwp) == -1)
- perror_with_name (_("Couldn't get registers"));
+ perror_with_name (_ ("Couldn't get registers"));
vaxbsd_supply_gregset (regcache, &regs);
}
@@ -97,14 +96,13 @@ vax_bsd_nat_target::store_registers (struct regcache *regcache, int regnum)
int lwp = regcache->ptid ().lwp ();
if (ptrace (PT_GETREGS, pid, (PTRACE_TYPE_ARG3) &regs, lwp) == -1)
- perror_with_name (_("Couldn't get registers"));
+ perror_with_name (_ ("Couldn't get registers"));
vaxbsd_collect_gregset (regcache, &regs, regnum);
if (ptrace (PT_SETREGS, pid, (PTRACE_TYPE_ARG3) &regs, lwp) == -1)
- perror_with_name (_("Couldn't write registers"));
+ perror_with_name (_ ("Couldn't write registers"));
}
-
/* Support for debugging kernel virtual memory images. */
@@ -138,6 +136,7 @@ vaxbsd_supply_pcb (struct regcache *regcache, struct pcb *pcb)
}
void _initialize_vaxbsd_nat ();
+
void
_initialize_vaxbsd_nat ()
{
diff --git a/gdb/vax-netbsd-tdep.c b/gdb/vax-netbsd-tdep.c
index ff0399f4f6a..ea2d109de71 100644
--- a/gdb/vax-netbsd-tdep.c
+++ b/gdb/vax-netbsd-tdep.c
@@ -33,11 +33,12 @@ vaxnbsd_elf_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
nbsd_init_abi (info, gdbarch);
/* NetBSD ELF uses SVR4-style shared libraries. */
- set_solib_svr4_fetch_link_map_offsets
- (gdbarch, svr4_ilp32_fetch_link_map_offsets);
+ set_solib_svr4_fetch_link_map_offsets (gdbarch,
+ svr4_ilp32_fetch_link_map_offsets);
}
void _initialize_vaxnbsd_tdep ();
+
void
_initialize_vaxnbsd_tdep ()
{
diff --git a/gdb/vax-tdep.c b/gdb/vax-tdep.c
index c229e660423..9818f6f7d7d 100644
--- a/gdb/vax-tdep.c
+++ b/gdb/vax-tdep.c
@@ -38,11 +38,9 @@
static const char *
vax_register_name (struct gdbarch *gdbarch, int regnum)
{
- static const char *register_names[] =
- {
- "r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7",
- "r8", "r9", "r10", "r11", "ap", "fp", "sp", "pc",
- "ps",
+ static const char *register_names[] = {
+ "r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7", "r8",
+ "r9", "r10", "r11", "ap", "fp", "sp", "pc", "ps",
};
gdb_static_assert (VAX_NUM_REGS == ARRAY_SIZE (register_names));
@@ -57,7 +55,7 @@ vax_register_type (struct gdbarch *gdbarch, int regnum)
{
return builtin_type (gdbarch)->builtin_int;
}
-
+
/* Core file support. */
/* Supply register REGNUM from the buffer specified by GREGS and LEN
@@ -80,11 +78,7 @@ vax_supply_gregset (const struct regset *regset, struct regcache *regcache,
/* VAX register set. */
-static const struct regset vax_gregset =
-{
- NULL,
- vax_supply_gregset
-};
+static const struct regset vax_gregset = { NULL, vax_supply_gregset };
/* Iterate over core file register note sections. */
@@ -96,14 +90,14 @@ vax_iterate_over_regset_sections (struct gdbarch *gdbarch,
{
cb (".reg", VAX_NUM_REGS * 4, VAX_NUM_REGS * 4, &vax_gregset, NULL, cb_data);
}
-
+
/* The VAX UNIX calling convention uses R1 to pass a structure return
value address instead of passing it as a first (hidden) argument as
the VMS calling convention suggests. */
static CORE_ADDR
-vax_store_arguments (struct regcache *regcache, int nargs,
- struct value **args, CORE_ADDR sp)
+vax_store_arguments (struct regcache *regcache, int nargs, struct value **args,
+ CORE_ADDR sp)
{
struct gdbarch *gdbarch = regcache->arch ();
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
@@ -194,7 +188,6 @@ vax_dummy_id (struct gdbarch *gdbarch, frame_info_ptr this_frame)
fp = get_frame_register_unsigned (this_frame, VAX_FP_REGNUM);
return frame_id_build (fp, get_frame_pc (this_frame));
}
-
static enum return_value_convention
vax_return_value (struct gdbarch *gdbarch, struct value *function,
@@ -204,8 +197,7 @@ vax_return_value (struct gdbarch *gdbarch, struct value *function,
int len = type->length ();
gdb_byte buf[8];
- if (type->code () == TYPE_CODE_STRUCT
- || type->code () == TYPE_CODE_UNION
+ if (type->code () == TYPE_CODE_STRUCT || type->code () == TYPE_CODE_UNION
|| type->code () == TYPE_CODE_ARRAY)
{
/* The default on VAX is to return structures in static memory.
@@ -242,7 +234,6 @@ vax_return_value (struct gdbarch *gdbarch, struct value *function,
return RETURN_VALUE_REGISTER_CONVENTION;
}
-
/* Use the program counter to determine the contents and size of a
breakpoint instruction. Return a pointer to a string of bytes that
@@ -253,7 +244,7 @@ vax_return_value (struct gdbarch *gdbarch, struct value *function,
constexpr gdb_byte vax_break_insn[] = { 3 };
typedef BP_MANIPULATION (vax_break_insn) vax_breakpoint;
-
+
/* Advance PC across any function entry prologue instructions
to reach some "real" code. */
@@ -264,28 +255,27 @@ vax_skip_prologue (struct gdbarch *gdbarch, CORE_ADDR pc)
gdb_byte op = read_memory_unsigned_integer (pc, 1, byte_order);
if (op == 0x11)
- pc += 2; /* skip brb */
+ pc += 2; /* skip brb */
if (op == 0x31)
- pc += 3; /* skip brw */
+ pc += 3; /* skip brw */
if (op == 0xC2
&& read_memory_unsigned_integer (pc + 2, 1, byte_order) == 0x5E)
- pc += 3; /* skip subl2 */
+ pc += 3; /* skip subl2 */
if (op == 0x9E
&& read_memory_unsigned_integer (pc + 1, 1, byte_order) == 0xAE
&& read_memory_unsigned_integer (pc + 3, 1, byte_order) == 0x5E)
- pc += 4; /* skip movab */
+ pc += 4; /* skip movab */
if (op == 0x9E
&& read_memory_unsigned_integer (pc + 1, 1, byte_order) == 0xCE
&& read_memory_unsigned_integer (pc + 4, 1, byte_order) == 0x5E)
- pc += 5; /* skip movab */
+ pc += 5; /* skip movab */
if (op == 0x9E
&& read_memory_unsigned_integer (pc + 1, 1, byte_order) == 0xEE
&& read_memory_unsigned_integer (pc + 6, 1, byte_order) == 0x5E)
- pc += 7; /* skip movab */
+ pc += 7; /* skip movab */
return pc;
}
-
/* Unwinding the stack is relatively easy since the VAX has a
dedicated frame pointer, and frames are set up automatically as the
@@ -378,25 +368,22 @@ vax_frame_this_id (frame_info_ptr this_frame, void **this_cache,
}
static struct value *
-vax_frame_prev_register (frame_info_ptr this_frame,
- void **this_cache, int regnum)
+vax_frame_prev_register (frame_info_ptr this_frame, void **this_cache,
+ int regnum)
{
struct vax_frame_cache *cache = vax_frame_cache (this_frame, this_cache);
return trad_frame_get_prev_register (this_frame, cache->saved_regs, regnum);
}
-static const struct frame_unwind vax_frame_unwind =
-{
- "vax prologue",
- NORMAL_FRAME,
- default_frame_unwind_stop_reason,
- vax_frame_this_id,
- vax_frame_prev_register,
- NULL,
- default_frame_sniffer
-};
-
+static const struct frame_unwind vax_frame_unwind
+ = { "vax prologue",
+ NORMAL_FRAME,
+ default_frame_unwind_stop_reason,
+ vax_frame_this_id,
+ vax_frame_prev_register,
+ NULL,
+ default_frame_sniffer };
static CORE_ADDR
vax_frame_base_address (frame_info_ptr this_frame, void **this_cache)
@@ -412,13 +399,9 @@ vax_frame_args_address (frame_info_ptr this_frame, void **this_cache)
return get_frame_register_unsigned (this_frame, VAX_AP_REGNUM);
}
-static const struct frame_base vax_frame_base =
-{
- &vax_frame_unwind,
- vax_frame_base_address,
- vax_frame_base_address,
- vax_frame_args_address
-};
+static const struct frame_base vax_frame_base
+ = { &vax_frame_unwind, vax_frame_base_address, vax_frame_base_address,
+ vax_frame_args_address };
/* Return number of arguments for FRAME. */
@@ -436,8 +419,6 @@ vax_frame_num_args (frame_info_ptr frame)
return get_frame_memory_unsigned (frame, args, 1);
}
-
-
/* Initialize the current architecture based on INFO. If possible, re-use an
architecture from ARCHES, which is a list of architectures already created
during this debugging session.
@@ -470,8 +451,8 @@ vax_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
set_gdbarch_pc_regnum (gdbarch, VAX_PC_REGNUM);
set_gdbarch_ps_regnum (gdbarch, VAX_PS_REGNUM);
- set_gdbarch_iterate_over_regset_sections
- (gdbarch, vax_iterate_over_regset_sections);
+ set_gdbarch_iterate_over_regset_sections (gdbarch,
+ vax_iterate_over_regset_sections);
/* Frame and stack info */
set_gdbarch_skip_prologue (gdbarch, vax_skip_prologue);
@@ -507,6 +488,7 @@ vax_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
}
void _initialize_vax_tdep ();
+
void
_initialize_vax_tdep ()
{
diff --git a/gdb/vax-tdep.h b/gdb/vax-tdep.h
index 0f28838465c..66ba767f8f3 100644
--- a/gdb/vax-tdep.h
+++ b/gdb/vax-tdep.h
@@ -26,11 +26,11 @@ enum vax_regnum
{
VAX_R0_REGNUM,
VAX_R1_REGNUM,
- VAX_AP_REGNUM = 12, /* Argument pointer on user stack. */
- VAX_FP_REGNUM, /* Address of executing stack frame. */
- VAX_SP_REGNUM, /* Address of top of stack. */
- VAX_PC_REGNUM, /* Program counter. */
- VAX_PS_REGNUM /* Processor status. */
+ VAX_AP_REGNUM = 12, /* Argument pointer on user stack. */
+ VAX_FP_REGNUM, /* Address of executing stack frame. */
+ VAX_SP_REGNUM, /* Address of top of stack. */
+ VAX_PC_REGNUM, /* Program counter. */
+ VAX_PS_REGNUM /* Processor status. */
};
/* Number of machine registers. */
diff --git a/gdb/windows-nat.c b/gdb/windows-nat.c
index a8ce05393b9..31b737b56a9 100644
--- a/gdb/windows-nat.c
+++ b/gdb/windows-nat.c
@@ -22,7 +22,7 @@
/* Originally by Steve Chamberlain, sac@cygnus.com */
#include "defs.h"
-#include "frame.h" /* required by inferior.h */
+#include "frame.h" /* required by inferior.h */
#include "inferior.h"
#include "infrun.h"
#include "target.h"
@@ -91,15 +91,15 @@ struct windows_solib
struct windows_per_inferior : public windows_process_info
{
- windows_thread_info *thread_rec (ptid_t ptid,
- thread_disposition_type disposition) override;
- int handle_output_debug_string (struct target_waitstatus *ourstatus) override;
+ windows_thread_info *
+ thread_rec (ptid_t ptid, thread_disposition_type disposition) override;
+ int
+ handle_output_debug_string (struct target_waitstatus *ourstatus) override;
void handle_load_dll (const char *dll_name, LPVOID base) override;
void handle_unload_dll () override;
bool handle_access_violation (const EXCEPTION_RECORD *rec) override;
-
- int have_saved_context = 0; /* True if we've saved context from a
+ int have_saved_context = 0; /* True if we've saved context from a
cygwin signal. */
uintptr_t dr[8] {};
@@ -140,7 +140,7 @@ struct windows_per_inferior : public windows_process_info
std::vector<windows_solib> solibs;
#ifdef __CYGWIN__
- CONTEXT saved_context {}; /* Contains the saved context from a
+ CONTEXT saved_context {}; /* Contains the saved context from a
cygwin signal. */
/* The starting and ending address of the cygwin1.dll text segment. */
@@ -155,11 +155,11 @@ static windows_per_inferior windows_process;
#undef STARTUPINFO
#ifndef __CYGWIN__
-# define __PMAX (MAX_PATH + 1)
-# define STARTUPINFO STARTUPINFOA
+#define __PMAX (MAX_PATH + 1)
+#define STARTUPINFO STARTUPINFOA
#else
-# define __PMAX PATH_MAX
-# define STARTUPINFO STARTUPINFOW
+#define __PMAX PATH_MAX
+#define STARTUPINFO STARTUPINFOW
#endif
/* If we're not using the old Cygwin header file set, define the
@@ -167,9 +167,9 @@ static windows_per_inferior windows_process;
headers in the first place since they were our own invention... */
#ifndef _GNU_H_WINDOWS_H
enum
- {
- FLAG_TRACE_BIT = 0x100,
- };
+{
+ FLAG_TRACE_BIT = 0x100,
+};
#endif
#ifndef CONTEXT_EXTENDED_REGISTERS
@@ -178,9 +178,9 @@ enum
#define CONTEXT_EXTENDED_REGISTERS 0
#endif
-#define CONTEXT_DEBUGGER_DR CONTEXT_FULL | CONTEXT_FLOATING_POINT \
- | CONTEXT_SEGMENTS | CONTEXT_DEBUG_REGISTERS \
- | CONTEXT_EXTENDED_REGISTERS
+#define CONTEXT_DEBUGGER_DR \
+ CONTEXT_FULL | CONTEXT_FLOATING_POINT | CONTEXT_SEGMENTS \
+ | CONTEXT_DEBUG_REGISTERS | CONTEXT_EXTENDED_REGISTERS
#define DR6_CLEAR_VALUE 0xffff0ff0
@@ -190,18 +190,17 @@ enum
#define _CYGWIN_SIGNAL_STRING "cYgSiGw00f"
#endif
-#define CHECK(x) check (x, __FILE__,__LINE__)
+#define CHECK(x) check (x, __FILE__, __LINE__)
#define DEBUG_EXEC(fmt, ...) \
- debug_prefixed_printf_cond (debug_exec, "windows exec", fmt, ## __VA_ARGS__)
-#define DEBUG_EVENTS(fmt, ...) \
+ debug_prefixed_printf_cond (debug_exec, "windows exec", fmt, ##__VA_ARGS__)
+#define DEBUG_EVENTS(fmt, ...) \
debug_prefixed_printf_cond (debug_events, "windows events", fmt, \
- ## __VA_ARGS__)
+ ##__VA_ARGS__)
#define DEBUG_MEM(fmt, ...) \
- debug_prefixed_printf_cond (debug_memory, "windows mem", fmt, \
- ## __VA_ARGS__)
-#define DEBUG_EXCEPT(fmt, ...) \
+ debug_prefixed_printf_cond (debug_memory, "windows mem", fmt, ##__VA_ARGS__)
+#define DEBUG_EXCEPT(fmt, ...) \
debug_prefixed_printf_cond (debug_exceptions, "windows except", fmt, \
- ## __VA_ARGS__)
+ ##__VA_ARGS__)
static void cygwin_set_dr (int i, CORE_ADDR addr);
static void cygwin_set_dr7 (unsigned long val);
@@ -215,11 +214,11 @@ static bool new_console = false;
static bool cygwin_exceptions = false;
#endif
static bool new_group = true;
-static bool debug_exec = false; /* show execution */
-static bool debug_events = false; /* show events from kernel */
-static bool debug_memory = false; /* show target memory accesses */
-static bool debug_exceptions = false; /* show target exceptions */
-static bool useshell = false; /* use shell for subprocesses */
+static bool debug_exec = false; /* show execution */
+static bool debug_events = false; /* show events from kernel */
+static bool debug_memory = false; /* show target memory accesses */
+static bool debug_exceptions = false; /* show target exceptions */
+static bool useshell = false; /* use shell for subprocesses */
/* See windows_nat_target::resume to understand why this is commented
out. */
@@ -253,12 +252,11 @@ struct windows_nat_target final : public x86_nat_target<inf_child_target>
void attach (const char *, int) override;
- bool attach_no_wait () override
- { return true; }
+ bool attach_no_wait () override { return true; }
void detach (inferior *, int) override;
- void resume (ptid_t, int , enum gdb_signal) override;
+ void resume (ptid_t, int, enum gdb_signal) override;
ptid_t wait (ptid_t, struct target_waitstatus *, target_wait_flags) override;
@@ -272,14 +270,10 @@ struct windows_nat_target final : public x86_nat_target<inf_child_target>
return th->stopped_at_software_breakpoint;
}
- bool supports_stopped_by_sw_breakpoint () override
- {
- return true;
- }
+ bool supports_stopped_by_sw_breakpoint () override { return true; }
enum target_xfer_status xfer_partial (enum target_object object,
- const char *annex,
- gdb_byte *readbuf,
+ const char *annex, gdb_byte *readbuf,
const gdb_byte *writebuf,
ULONGEST offset, ULONGEST len,
ULONGEST *xfered_len) override;
@@ -288,8 +282,8 @@ struct windows_nat_target final : public x86_nat_target<inf_child_target>
void kill () override;
- void create_inferior (const char *, const std::string &,
- char **, int) override;
+ void create_inferior (const char *, const std::string &, char **,
+ int) override;
void mourn_inferior () override;
@@ -318,22 +312,13 @@ struct windows_nat_target final : public x86_nat_target<inf_child_target>
return disable_randomization_available ();
}
- bool can_async_p () override
- {
- return true;
- }
+ bool can_async_p () override { return true; }
- bool is_async_p () override
- {
- return m_is_async;
- }
+ bool is_async_p () override { return m_is_async; }
void async (bool enable) override;
- int async_wait_fd () override
- {
- return serial_event_fd (m_wait_event);
- }
+ int async_wait_fd () override { return serial_event_fd (m_wait_event); }
private:
@@ -394,8 +379,8 @@ check (BOOL ok, const char *file, int line)
if (!ok)
{
unsigned err = (unsigned) GetLastError ();
- gdb_printf ("error return %s:%d was %u: %s\n", file, line,
- err, strwinerror (err));
+ gdb_printf ("error return %s:%d was %u: %s\n", file, line, err,
+ strwinerror (err));
}
}
@@ -404,8 +389,8 @@ windows_nat_target::windows_nat_target ()
m_response_event (CreateEvent (nullptr, false, false, nullptr)),
m_wait_event (make_serial_event ())
{
- HANDLE bg_thread = CreateThread (nullptr, 64 * 1024,
- process_thread_starter, this, 0, nullptr);
+ HANDLE bg_thread = CreateThread (nullptr, 64 * 1024, process_thread_starter,
+ this, 0, nullptr);
CloseHandle (bg_thread);
}
@@ -416,12 +401,10 @@ windows_nat_target::async (bool enable)
return;
if (enable)
- add_file_handler (async_wait_fd (),
- [] (int, gdb_client_data)
- {
- inferior_event_handler (INF_REG_EVENT);
- },
- nullptr, "windows_nat_target");
+ add_file_handler (
+ async_wait_fd (),
+ [] (int, gdb_client_data) { inferior_event_handler (INF_REG_EVENT); },
+ nullptr, "windows_nat_target");
else
delete_file_handler (async_wait_fd ());
@@ -441,8 +424,8 @@ wait_for_single (HANDLE handle, DWORD howlong)
if (r == WAIT_FAILED)
{
unsigned err = (unsigned) GetLastError ();
- warning ("WaitForSingleObject failed (code %u): %s",
- err, strwinerror (err));
+ warning ("WaitForSingleObject failed (code %u): %s", err,
+ strwinerror (err));
}
else
warning ("unexpected result from WaitForSingleObject: %u",
@@ -479,7 +462,7 @@ windows_nat_target::process_thread ()
}
serial_event_set (m_wait_event);
}
- }
+ }
}
void
@@ -493,25 +476,24 @@ windows_nat_target::do_synchronously (gdb::function_view<bool ()> func)
void
windows_nat_target::wait_for_debug_event_main_thread (DEBUG_EVENT *event)
{
- do_synchronously ([&] ()
- {
- if (m_debug_event_pending)
- {
- *event = m_last_debug_event;
- m_debug_event_pending = false;
- serial_event_clear (m_wait_event);
- }
- else
- wait_for_debug_event (event, INFINITE);
- return false;
- });
+ do_synchronously ([&] () {
+ if (m_debug_event_pending)
+ {
+ *event = m_last_debug_event;
+ m_debug_event_pending = false;
+ serial_event_clear (m_wait_event);
+ }
+ else
+ wait_for_debug_event (event, INFINITE);
+ return false;
+ });
}
/* See nat/windows-nat.h. */
windows_thread_info *
-windows_per_inferior::thread_rec
- (ptid_t ptid, thread_disposition_type disposition)
+windows_per_inferior::thread_rec (ptid_t ptid,
+ thread_disposition_type disposition)
{
for (auto &th : thread_list)
if (th->tid == ptid.lwp ())
@@ -622,18 +604,16 @@ windows_nat_target::delete_thread (ptid_t ptid, DWORD exit_code,
if (info_verbose)
gdb_printf ("[Deleting %s]\n", target_pid_to_str (ptid).c_str ());
else if (print_thread_events && !main_thread_p)
- gdb_printf (_("[%s exited with code %u]\n"),
- target_pid_to_str (ptid).c_str (),
- (unsigned) exit_code);
+ gdb_printf (_ ("[%s exited with code %u]\n"),
+ target_pid_to_str (ptid).c_str (), (unsigned) exit_code);
::delete_thread (find_thread_ptid (this, ptid));
auto iter = std::find_if (windows_process.thread_list.begin (),
windows_process.thread_list.end (),
- [=] (std::unique_ptr<windows_thread_info> &th)
- {
- return th->tid == id;
- });
+ [=] (std::unique_ptr<windows_thread_info> &th) {
+ return th->tid == id;
+ });
if (iter != windows_process.thread_list.end ())
windows_process.thread_list.erase (iter);
@@ -650,8 +630,8 @@ windows_nat_target::delete_thread (ptid_t ptid, DWORD exit_code,
assertion is raised if that assumption is violated. */
static void
-windows_fetch_one_register (struct regcache *regcache,
- windows_thread_info *th, int r)
+windows_fetch_one_register (struct regcache *regcache, windows_thread_info *th,
+ int r)
{
gdb_assert (r >= 0);
gdb_assert (!th->reload_context);
@@ -690,8 +670,7 @@ windows_fetch_one_register (struct regcache *regcache,
}
else
{
- if (th->stopped_at_software_breakpoint
- && !th->pc_adjusted
+ if (th->stopped_at_software_breakpoint && !th->pc_adjusted
&& r == gdbarch_pc_regnum (gdbarch))
{
int size = register_size (gdbarch, r);
@@ -744,7 +723,7 @@ windows_nat_target::fetch_registers (struct regcache *regcache, int r)
else
#endif
#ifdef __x86_64__
- if (windows_process.wow64_process)
+ if (windows_process.wow64_process)
{
th->wow64_context.ContextFlags = CONTEXT_DEBUGGER_DR;
CHECK (Wow64GetThreadContext (th->h, &th->wow64_context));
@@ -783,7 +762,7 @@ windows_nat_target::fetch_registers (struct regcache *regcache, int r)
}
if (r < 0)
- for (r = 0; r < gdbarch_num_regs (regcache->arch()); r++)
+ for (r = 0; r < gdbarch_num_regs (regcache->arch ()); r++)
windows_fetch_one_register (regcache, th, r);
else
windows_fetch_one_register (regcache, th, r);
@@ -841,7 +820,7 @@ windows_make_so (const char *name, LPVOID load_addr)
char buf[__PMAX];
char cwd[__PMAX];
WIN32_FIND_DATA w32_fd;
- HANDLE h = FindFirstFile(name, &w32_fd);
+ HANDLE h = FindFirstFile (name, &w32_fd);
if (h == INVALID_HANDLE_VALUE)
strcpy (buf, name);
@@ -887,8 +866,7 @@ windows_make_so (const char *name, LPVOID load_addr)
if (buf[0])
{
char cname[SO_NAME_MAX_PATH_SIZE];
- cygwin_conv_path (CCP_WIN_W_TO_POSIX, buf, cname,
- SO_NAME_MAX_PATH_SIZE);
+ cygwin_conv_path (CCP_WIN_W_TO_POSIX, buf, cname, SO_NAME_MAX_PATH_SIZE);
so->name = cname;
}
else
@@ -901,7 +879,7 @@ windows_make_so (const char *name, LPVOID load_addr)
}
else
{
- warning (_("dll path for \"%s\" too long or inaccessible"), name);
+ warning (_ ("dll path for \"%s\" too long or inaccessible"), name);
so->name = so->original_name;
}
}
@@ -909,11 +887,12 @@ windows_make_so (const char *name, LPVOID load_addr)
size_t len = sizeof ("/cygwin1.dll") - 1;
if (so->name.size () >= len
&& strcasecmp (so->name.c_str () + so->name.size () - len,
- "/cygwin1.dll") == 0)
+ "/cygwin1.dll")
+ == 0)
{
asection *text = NULL;
- gdb_bfd_ref_ptr abfd (gdb_bfd_open (so->name.c_str(), "pei-i386"));
+ gdb_bfd_ref_ptr abfd (gdb_bfd_open (so->name.c_str (), "pei-i386"));
if (abfd == NULL)
return so;
@@ -927,10 +906,10 @@ windows_make_so (const char *name, LPVOID load_addr)
/* The symbols in a dll are offset by 0x1000, which is the
offset from 0 of the first byte in an image - because of the
file header and the section alignment. */
- windows_process.cygwin_load_start = (CORE_ADDR) (uintptr_t) ((char *)
- load_addr + 0x1000);
- windows_process.cygwin_load_end = windows_process.cygwin_load_start +
- bfd_section_size (text);
+ windows_process.cygwin_load_start
+ = (CORE_ADDR) (uintptr_t) ((char *) load_addr + 0x1000);
+ windows_process.cygwin_load_end
+ = windows_process.cygwin_load_start + bfd_section_size (text);
}
#endif
@@ -956,15 +935,14 @@ windows_per_inferior::handle_unload_dll ()
auto iter = std::remove_if (windows_process.solibs.begin (),
windows_process.solibs.end (),
- [&] (windows_solib &lib)
- {
- if (lib.load_addr == lpBaseOfDll)
- {
- DEBUG_EVENTS ("Unloading dll \"%s\".", lib.name.c_str ());
- return true;
- }
- return false;
- });
+ [&] (windows_solib &lib) {
+ if (lib.load_addr == lpBaseOfDll)
+ {
+ DEBUG_EVENTS ("Unloading dll \"%s\".", lib.name.c_str ());
+ return true;
+ }
+ return false;
+ });
if (iter != windows_process.solibs.end ())
{
@@ -979,7 +957,7 @@ windows_per_inferior::handle_unload_dll ()
4 mysterious UNLOAD_DLL_DEBUG_EVENTs during the startup phase (these
events are apparently caused by the WOW layer, the interface between
32bit and 64bit worlds). */
- complaint (_("dll starting at %s not found."),
+ complaint (_ ("dll starting at %s not found."),
host_address_to_string (lpBaseOfDll));
}
@@ -997,13 +975,13 @@ signal_event_command (const char *args, int from_tty)
char *endargs = NULL;
if (args == NULL)
- error (_("signal-event requires an argument (integer event id)"));
+ error (_ ("signal-event requires an argument (integer event id)"));
event_id = strtoumax (args, &endargs, 10);
- if ((errno == ERANGE) || (event_id == 0) || (event_id > UINTPTR_MAX) ||
- ((HANDLE) event_id == INVALID_HANDLE_VALUE))
- error (_("Failed to convert `%s' to event id"), args);
+ if ((errno == ERANGE) || (event_id == 0) || (event_id > UINTPTR_MAX)
+ || ((HANDLE) event_id == INVALID_HANDLE_VALUE))
+ error (_ ("Failed to convert `%s' to event id"), args);
SetEvent ((HANDLE) event_id);
CloseHandle ((HANDLE) event_id);
@@ -1012,15 +990,14 @@ signal_event_command (const char *args, int from_tty)
/* See nat/windows-nat.h. */
int
-windows_per_inferior::handle_output_debug_string
- (struct target_waitstatus *ourstatus)
+windows_per_inferior::handle_output_debug_string (
+ struct target_waitstatus *ourstatus)
{
int retval = 0;
- gdb::unique_xmalloc_ptr<char> s
- = (target_read_string
- ((CORE_ADDR) (uintptr_t) current_event.u.DebugString.lpDebugStringData,
- 1024));
+ gdb::unique_xmalloc_ptr<char> s = (target_read_string (
+ (CORE_ADDR) (uintptr_t) current_event.u.DebugString.lpDebugStringData,
+ 1024));
if (s == nullptr || !*(s.get ()))
/* nothing to do */;
else if (!startswith (s.get (), _CYGWIN_SIGNAL_STRING))
@@ -1060,8 +1037,7 @@ windows_per_inferior::handle_output_debug_string
if (!retval)
retval = current_event.dwThreadId;
else if ((x = (LPCVOID) (uintptr_t) strtoull (p, NULL, 0))
- && ReadProcessMemory (handle, x,
- &saved_context,
+ && ReadProcessMemory (handle, x, &saved_context,
__COPY_CONTEXT_SIZE, &n)
&& n == __COPY_CONTEXT_SIZE)
have_saved_context = 1;
@@ -1092,17 +1068,16 @@ display_selector (HANDLE thread, DWORD sel)
gdb_puts ("Segment not present\n");
return 0;
}
- base = (info.HighWord.Bits.BaseHi << 24) +
- (info.HighWord.Bits.BaseMid << 16)
- + info.BaseLow;
+ base = (info.HighWord.Bits.BaseHi << 24)
+ + (info.HighWord.Bits.BaseMid << 16) + info.BaseLow;
limit = (info.HighWord.Bits.LimitHi << 16) + info.LimitLow;
if (info.HighWord.Bits.Granularity)
limit = (limit << 12) | 0xfff;
gdb_printf ("base=0x%08x limit=0x%08x", base, limit);
if (info.HighWord.Bits.Default_Big)
- gdb_puts(" 32-bit ");
+ gdb_puts (" 32-bit ");
else
- gdb_puts(" 16-bit ");
+ gdb_puts (" 16-bit ");
switch ((info.HighWord.Bits.Type & 0xf) >> 1)
{
case 0:
@@ -1134,10 +1109,10 @@ display_selector (HANDLE thread, DWORD sel)
(unsigned long) info.HighWord.Bits.Type);
}
if ((info.HighWord.Bits.Type & 0x1) == 0)
- gdb_puts(", N.Acc");
+ gdb_puts (", N.Acc");
gdb_puts (")\n");
if ((info.HighWord.Bits.Type & 0x10) == 0)
- gdb_puts("System selector ");
+ gdb_puts ("System selector ");
gdb_printf ("Privilege level = %ld. ",
(unsigned long) info.HighWord.Bits.Dpl);
if (info.HighWord.Bits.Granularity)
@@ -1158,7 +1133,7 @@ display_selector (HANDLE thread, DWORD sel)
}
static void
-display_selectors (const char * args, int from_tty)
+display_selectors (const char *args, int from_tty)
{
if (inferior_ptid == null_ptid)
{
@@ -1220,7 +1195,7 @@ display_selectors (const char * args, int from_tty)
{
int sel;
sel = parse_and_eval_long (args);
- gdb_printf ("Selector \"%s\"\n",args);
+ gdb_printf ("Selector \"%s\"\n", args);
display_selector (current_windows_thread->h, sel);
}
}
@@ -1228,8 +1203,7 @@ display_selectors (const char * args, int from_tty)
/* See nat/windows-nat.h. */
bool
-windows_per_inferior::handle_access_violation
- (const EXCEPTION_RECORD *rec)
+windows_per_inferior::handle_access_violation (const EXCEPTION_RECORD *rec)
{
#ifdef __CYGWIN__
/* See if the access violation happened within the cygwin DLL
@@ -1242,8 +1216,8 @@ windows_per_inferior::handle_access_violation
const char *fn;
CORE_ADDR addr = (CORE_ADDR) (uintptr_t) rec->ExceptionAddress;
- if ((!cygwin_exceptions && (addr >= cygwin_load_start
- && addr < cygwin_load_end))
+ if ((!cygwin_exceptions
+ && (addr >= cygwin_load_start && addr < cygwin_load_end))
|| (find_pc_partial_function (addr, &fn, NULL, NULL)
&& startswith (fn, "KERNEL32!IsBad")))
return true;
@@ -1293,11 +1267,10 @@ windows_nat_target::windows_continue (DWORD continue_status, int id,
{
DWORD ec = 0;
- if (GetExitCodeThread (th->h, &ec)
- && ec == STILL_ACTIVE)
+ if (GetExitCodeThread (th->h, &ec) && ec == STILL_ACTIVE)
{
- BOOL status = Wow64SetThreadContext (th->h,
- &th->wow64_context);
+ BOOL status
+ = Wow64SetThreadContext (th->h, &th->wow64_context);
if (!killed)
CHECK (status);
@@ -1323,8 +1296,7 @@ windows_nat_target::windows_continue (DWORD continue_status, int id,
{
DWORD ec = 0;
- if (GetExitCodeThread (th->h, &ec)
- && ec == STILL_ACTIVE)
+ if (GetExitCodeThread (th->h, &ec) && ec == STILL_ACTIVE)
{
BOOL status = SetThreadContext (th->h, &th->context);
@@ -1344,18 +1316,17 @@ windows_nat_target::windows_continue (DWORD continue_status, int id,
}
gdb::optional<unsigned> err;
- do_synchronously ([&] ()
- {
- if (!continue_last_debug_event (continue_status, debug_events))
- err = (unsigned) GetLastError ();
- /* On the last call, do not block waiting for an event that will
+ do_synchronously ([&] () {
+ if (!continue_last_debug_event (continue_status, debug_events))
+ err = (unsigned) GetLastError ();
+ /* On the last call, do not block waiting for an event that will
never come. */
- return !last_call;
- });
+ return !last_call;
+ });
if (err.has_value ())
- error (_("Failed to resume program execution"
- " (ContinueDebugEvent failed, error %u: %s)"),
+ error (_ ("Failed to resume program execution"
+ " (ContinueDebugEvent failed, error %u: %s)"),
*err, strwinerror (*err));
return TRUE;
@@ -1374,15 +1345,15 @@ windows_nat_target::fake_create_process ()
else
{
unsigned err = (unsigned) GetLastError ();
- error (_("OpenProcess call failed, GetLastError = %u: %s"),
- err, strwinerror (err));
+ error (_ ("OpenProcess call failed, GetLastError = %u: %s"), err,
+ strwinerror (err));
/* We can not debug anything in that case. */
}
add_thread (ptid_t (windows_process.current_event.dwProcessId, 0,
- windows_process.current_event.dwThreadId),
- windows_process.current_event.u.CreateThread.hThread,
- windows_process.current_event.u.CreateThread.lpThreadLocalBase,
- true /* main_thread_p */);
+ windows_process.current_event.dwThreadId),
+ windows_process.current_event.u.CreateThread.hThread,
+ windows_process.current_event.u.CreateThread.lpThreadLocalBase,
+ true /* main_thread_p */);
return windows_process.current_event.dwThreadId;
}
@@ -1430,14 +1401,14 @@ windows_nat_target::resume (ptid_t ptid, int step, enum gdb_signal sig)
}
}
#endif
- DEBUG_EXCEPT ("Can only continue with received signal %d.",
- windows_process.last_sig);
+ DEBUG_EXCEPT ("Can only continue with received signal %d.",
+ windows_process.last_sig);
}
windows_process.last_sig = GDB_SIGNAL_0;
- DEBUG_EXEC ("pid=%d, tid=0x%x, step=%d, sig=%d",
- ptid.pid (), (unsigned) ptid.lwp (), step, sig);
+ DEBUG_EXEC ("pid=%d, tid=0x%x, step=%d, sig=%d", ptid.pid (),
+ (unsigned) ptid.lwp (), step, sig);
/* Get context for currently selected thread. */
th = windows_process.thread_rec (inferior_ptid, DONT_INVALIDATE_CONTEXT);
@@ -1525,17 +1496,17 @@ windows_nat_target::interrupt ()
if (windows_process.wow64_dbgbreak == nullptr)
{
CORE_ADDR addr;
- if (!find_minimal_symbol_address ("ntdll!DbgUiRemoteBreakin",
- &addr, 0))
+ if (!find_minimal_symbol_address ("ntdll!DbgUiRemoteBreakin", &addr,
+ 0))
windows_process.wow64_dbgbreak = (void *) addr;
}
if (windows_process.wow64_dbgbreak != nullptr)
{
- HANDLE thread = CreateRemoteThread (windows_process.handle, NULL,
- 0, (LPTHREAD_START_ROUTINE)
- windows_process.wow64_dbgbreak,
- NULL, 0, NULL);
+ HANDLE thread = CreateRemoteThread (
+ windows_process.handle, NULL, 0,
+ (LPTHREAD_START_ROUTINE) windows_process.wow64_dbgbreak, NULL, 0,
+ NULL);
if (thread)
{
CloseHandle (thread);
@@ -1546,9 +1517,9 @@ windows_nat_target::interrupt ()
else
#endif
if (DebugBreakProcess (windows_process.handle))
- return;
- warning (_("Could not interrupt program. "
- "Press Ctrl-c in the program console."));
+ return;
+ warning (_ ("Could not interrupt program. "
+ "Press Ctrl-c in the program console."));
}
void
@@ -1560,8 +1531,8 @@ windows_nat_target::pass_ctrlc ()
/* Get the next event from the child. Returns the thread ptid. */
ptid_t
-windows_nat_target::get_windows_debug_event
- (int pid, struct target_waitstatus *ourstatus, target_wait_flags options)
+windows_nat_target::get_windows_debug_event (
+ int pid, struct target_waitstatus *ourstatus, target_wait_flags options)
{
DWORD continue_status, event_code;
DWORD thread_id = 0;
@@ -1624,11 +1595,11 @@ windows_nat_target::get_windows_debug_event
}
/* Record the existence of this thread. */
thread_id = current_event->dwThreadId;
- add_thread
- (ptid_t (current_event->dwProcessId, current_event->dwThreadId, 0),
- current_event->u.CreateThread.hThread,
- current_event->u.CreateThread.lpThreadLocalBase,
- false /* main_thread_p */);
+ add_thread (ptid_t (current_event->dwProcessId,
+ current_event->dwThreadId, 0),
+ current_event->u.CreateThread.hThread,
+ current_event->u.CreateThread.lpThreadLocalBase,
+ false /* main_thread_p */);
break;
@@ -1654,12 +1625,11 @@ windows_nat_target::get_windows_debug_event
windows_process.handle = current_event->u.CreateProcessInfo.hProcess;
/* Add the main thread. */
- add_thread
- (ptid_t (current_event->dwProcessId,
- current_event->dwThreadId, 0),
- current_event->u.CreateProcessInfo.hThread,
- current_event->u.CreateProcessInfo.lpThreadLocalBase,
- true /* main_thread_p */);
+ add_thread (ptid_t (current_event->dwProcessId,
+ current_event->dwThreadId, 0),
+ current_event->u.CreateProcessInfo.hThread,
+ current_event->u.CreateProcessInfo.lpThreadLocalBase,
+ true /* main_thread_p */);
thread_id = current_event->dwThreadId;
break;
@@ -1672,7 +1642,7 @@ windows_nat_target::get_windows_debug_event
{
target_terminal::ours ();
target_mourn_inferior (inferior_ptid);
- error (_("During startup program exited with code 0x%x."),
+ error (_ ("During startup program exited with code 0x%x."),
(unsigned int) current_event->u.ExitProcess.dwExitCode);
}
else if (windows_process.saw_create == 1)
@@ -1703,7 +1673,7 @@ windows_nat_target::get_windows_debug_event
"LOAD_DLL_DEBUG_EVENT");
CloseHandle (current_event->u.LoadDll.hFile);
if (windows_process.saw_create != 1
- || ! windows_process.windows_initialization_done)
+ || !windows_process.windows_initialization_done)
break;
try
{
@@ -1723,7 +1693,7 @@ windows_nat_target::get_windows_debug_event
(unsigned) current_event->dwThreadId,
"UNLOAD_DLL_DEBUG_EVENT");
if (windows_process.saw_create != 1
- || ! windows_process.windows_initialization_done)
+ || !windows_process.windows_initialization_done)
break;
try
{
@@ -1759,7 +1729,7 @@ windows_nat_target::get_windows_debug_event
}
break;
- case OUTPUT_DEBUG_STRING_EVENT: /* Message from the kernel. */
+ case OUTPUT_DEBUG_STRING_EVENT: /* Message from the kernel. */
DEBUG_EVENTS ("kernel event for pid=%u tid=0x%x code=%s",
(unsigned) current_event->dwProcessId,
(unsigned) current_event->dwThreadId,
@@ -1807,8 +1777,8 @@ windows_nat_target::get_windows_debug_event
th->stopped_at_software_breakpoint = true;
th->pc_adjusted = false;
}
- windows_process.pending_stops.push_back
- ({thread_id, *ourstatus, windows_process.current_event});
+ windows_process.pending_stops.push_back (
+ { thread_id, *ourstatus, windows_process.current_event });
thread_id = 0;
CHECK (windows_continue (continue_status,
windows_process.desired_stop_thread_id, 0));
@@ -1839,7 +1809,7 @@ windows_nat_target::wait (ptid_t ptid, struct target_waitstatus *ourstatus,
if (result != null_ptid)
{
if (ourstatus->kind () != TARGET_WAITKIND_EXITED
- && ourstatus->kind () != TARGET_WAITKIND_SIGNALLED)
+ && ourstatus->kind () != TARGET_WAITKIND_SIGNALLED)
{
windows_thread_info *th
= windows_process.thread_rec (result, INVALIDATE_CONTEXT);
@@ -1848,10 +1818,12 @@ windows_nat_target::wait (ptid_t ptid, struct target_waitstatus *ourstatus,
{
th->stopped_at_software_breakpoint = false;
if (windows_process.current_event.dwDebugEventCode
- == EXCEPTION_DEBUG_EVENT
- && ((windows_process.current_event.u.Exception.ExceptionRecord.ExceptionCode
+ == EXCEPTION_DEBUG_EVENT
+ && ((windows_process.current_event.u.Exception
+ .ExceptionRecord.ExceptionCode
== EXCEPTION_BREAKPOINT)
- || (windows_process.current_event.u.Exception.ExceptionRecord.ExceptionCode
+ || (windows_process.current_event.u.Exception
+ .ExceptionRecord.ExceptionCode
== STATUS_WX86_BREAKPOINT))
&& windows_process.windows_initialization_done)
{
@@ -1884,8 +1856,7 @@ windows_nat_target::do_initial_windows_stuff (DWORD pid, bool attaching)
windows_process.last_sig = GDB_SIGNAL_0;
windows_process.open_process_used = 0;
- for (i = 0;
- i < sizeof (windows_process.dr) / sizeof (windows_process.dr[0]);
+ for (i = 0; i < sizeof (windows_process.dr) / sizeof (windows_process.dr[0]);
i++)
windows_process.dr[i] = 0;
#ifdef __CYGWIN__
@@ -1909,13 +1880,13 @@ windows_nat_target::do_initial_windows_stuff (DWORD pid, bool attaching)
if (!windows_process.wow64_process)
{
- windows_process.mappings = amd64_mappings;
+ windows_process.mappings = amd64_mappings;
windows_process.segment_register_p = amd64_windows_segment_register_p;
}
else
#endif
{
- windows_process.mappings = i386_mappings;
+ windows_process.mappings = i386_mappings;
windows_process.segment_register_p = i386_windows_segment_register_p;
}
@@ -1983,8 +1954,7 @@ set_process_privilege (const char *privilege, BOOL enable)
DWORD size;
if (!OpenProcessToken (GetCurrentProcess (),
- TOKEN_QUERY | TOKEN_ADJUST_PRIVILEGES,
- &token_hdl))
+ TOKEN_QUERY | TOKEN_ADJUST_PRIVILEGES, &token_hdl))
goto out;
if (!LookupPrivilegeValueA (NULL, privilege, &restore_priv))
@@ -1994,8 +1964,8 @@ set_process_privilege (const char *privilege, BOOL enable)
new_priv.Privileges[0].Luid = restore_priv;
new_priv.Privileges[0].Attributes = enable ? SE_PRIVILEGE_ENABLED : 0;
- if (!AdjustTokenPrivileges (token_hdl, FALSE, &new_priv,
- sizeof orig_priv, &orig_priv, &size))
+ if (!AdjustTokenPrivileges (token_hdl, FALSE, &new_priv, sizeof orig_priv,
+ &orig_priv, &size))
goto out;
#if 0
/* Disabled, otherwise every `attach' in an unprivileged user session
@@ -2033,30 +2003,29 @@ windows_nat_target::attach (const char *args, int from_tty)
windows_process.saw_create = 0;
gdb::optional<unsigned> err;
- do_synchronously ([&] ()
- {
- BOOL ok = DebugActiveProcess (pid);
+ do_synchronously ([&] () {
+ BOOL ok = DebugActiveProcess (pid);
#ifdef __CYGWIN__
- if (!ok)
- {
- /* Try fall back to Cygwin pid. */
- pid = cygwin_internal (CW_CYGWIN_PID_TO_WINPID, pid);
+ if (!ok)
+ {
+ /* Try fall back to Cygwin pid. */
+ pid = cygwin_internal (CW_CYGWIN_PID_TO_WINPID, pid);
- if (pid > 0)
- ok = DebugActiveProcess (pid);
- }
+ if (pid > 0)
+ ok = DebugActiveProcess (pid);
+ }
#endif
- if (!ok)
- err = (unsigned) GetLastError ();
+ if (!ok)
+ err = (unsigned) GetLastError ();
- return true;
- });
+ return true;
+ });
if (err.has_value ())
- error (_("Can't attach to process %u (error %u: %s)"),
- (unsigned) pid, *err, strwinerror (*err));
+ error (_ ("Can't attach to process %u (error %u: %s)"), (unsigned) pid,
+ *err, strwinerror (*err));
DebugSetProcessKillOnExit (FALSE);
@@ -2083,19 +2052,18 @@ windows_nat_target::detach (inferior *inf, int from_tty)
windows_continue (DBG_CONTINUE, -1, 0, true);
gdb::optional<unsigned> err;
- do_synchronously ([&] ()
- {
- if (!DebugActiveProcessStop (windows_process.current_event.dwProcessId))
- err = (unsigned) GetLastError ();
- else
- DebugSetProcessKillOnExit (FALSE);
- return false;
- });
+ do_synchronously ([&] () {
+ if (!DebugActiveProcessStop (windows_process.current_event.dwProcessId))
+ err = (unsigned) GetLastError ();
+ else
+ DebugSetProcessKillOnExit (FALSE);
+ return false;
+ });
if (err.has_value ())
- error (_("Can't detach process %u (error %u: %s)"),
- (unsigned) windows_process.current_event.dwProcessId,
- *err, strwinerror (*err));
+ error (_ ("Can't detach process %u (error %u: %s)"),
+ (unsigned) windows_process.current_event.dwProcessId, *err,
+ strwinerror (*err));
target_announce_detach (from_tty);
@@ -2153,7 +2121,7 @@ windows_set_console_info (STARTUPINFO *si, DWORD *flags)
GetCurrentConsoleFont (hconsole, FALSE, &cfi);
font_size = GetConsoleFontSize (hconsole, cfi.nFont);
- GetConsoleScreenBufferInfo(hconsole, &sbinfo);
+ GetConsoleScreenBufferInfo (hconsole, &sbinfo);
si->dwXSize = sbinfo.srWindow.Right - sbinfo.srWindow.Left + 1;
si->dwYSize = sbinfo.srWindow.Bottom - sbinfo.srWindow.Top + 1;
if (font_size.X)
@@ -2299,7 +2267,8 @@ redir_open (const char *redir_string, int *inp, int *out, int *err)
fd = inp;
mode = O_RDONLY;
break;
- case '1': case '2':
+ case '1':
+ case '2':
fname++;
/* FALLTHROUGH */
case '>':
@@ -2345,7 +2314,7 @@ redir_open (const char *redir_string, int *inp, int *out, int *err)
}
}
else
- fname++; /* skip the separator space */
+ fname++; /* skip the separator space */
/* If the descriptor is already open, close it. This allows
multiple specs of redirections for the same stream, which is
somewhat nonsensical, but still valid and supported by cmd.exe.
@@ -2360,7 +2329,7 @@ redir_open (const char *redir_string, int *inp, int *out, int *err)
return -1;
}
else if (ref_fd == -1)
- *fd = -1; /* reset to default destination */
+ *fd = -1; /* reset to default destination */
else
{
*fd = _dup (ref_fd);
@@ -2384,9 +2353,8 @@ redir_set_redirection (const char *s, int *inp, int *out, int *err)
const char *start = s;
int quote = 0;
- *d++ = *s++; /* copy the 1st character, < or > or a digit */
- if ((*start == '>' || *start == '1' || *start == '2')
- && *s == '>')
+ *d++ = *s++; /* copy the 1st character, < or > or a digit */
+ if ((*start == '>' || *start == '1' || *start == '2') && *s == '>')
{
*d++ = *s++;
if (*s == '>' && *start != '>')
@@ -2397,16 +2365,16 @@ redir_set_redirection (const char *s, int *inp, int *out, int *err)
/* cmd.exe recognizes "&N" only immediately after the redirection symbol. */
if (*s != '&')
{
- while (isspace (*s)) /* skip whitespace before file name */
+ while (isspace (*s)) /* skip whitespace before file name */
s++;
- *d++ = ' '; /* separate file name with a single space */
+ *d++ = ' '; /* separate file name with a single space */
}
/* Copy the file name. */
while (*s)
{
/* Remove quoting characters from the file name in buf[]. */
- if (*s == '"') /* could support '..' quoting here */
+ if (*s == '"') /* could support '..' quoting here */
{
if (!quote)
quote = *s++;
@@ -2420,7 +2388,7 @@ redir_set_redirection (const char *s, int *inp, int *out, int *err)
}
else if (*s == '\\')
{
- if (s[1] == '"') /* could support '..' here */
+ if (s[1] == '"') /* could support '..' here */
s++;
*d++ = *s++;
}
@@ -2452,8 +2420,8 @@ redir_set_redirection (const char *s, int *inp, int *out, int *err)
/* Parse the command line for redirection specs and prepare the file
descriptors for the 3 standard streams accordingly. */
static bool
-redirect_inferior_handles (const char *cmd_orig, char *cmd,
- int *inp, int *out, int *err)
+redirect_inferior_handles (const char *cmd_orig, char *cmd, int *inp, int *out,
+ int *err)
{
const char *s = cmd_orig;
char *d = cmd;
@@ -2465,7 +2433,7 @@ redirect_inferior_handles (const char *cmd_orig, char *cmd,
while (*s)
{
- if (*s == '"') /* could also support '..' quoting here */
+ if (*s == '"') /* could also support '..' quoting here */
{
if (!quote)
quote = *s;
@@ -2474,7 +2442,7 @@ redirect_inferior_handles (const char *cmd_orig, char *cmd,
}
else if (*s == '\\')
{
- if (s[1] == '"') /* escaped quote char */
+ if (s[1] == '"') /* escaped quote char */
s++;
}
else if (!quote)
@@ -2498,7 +2466,7 @@ redirect_inferior_handles (const char *cmd_orig, char *cmd,
*d = '\0';
return retval;
}
-#endif /* !__CYGWIN__ */
+#endif /* !__CYGWIN__ */
/* Start an inferior windows child process and sets inferior_ptid to its pid.
EXEC_FILE is the file to run.
@@ -2538,7 +2506,7 @@ windows_nat_target::create_inferior (const char *exec_file,
int i;
size_t envsize;
char **env;
-#endif /* !__CYGWIN__ */
+#endif /* !__CYGWIN__ */
const char *allargs = origallargs.c_str ();
PROCESS_INFORMATION pi;
gdb::optional<unsigned> ret;
@@ -2546,7 +2514,7 @@ windows_nat_target::create_inferior (const char *exec_file,
const std::string &inferior_tty = current_inferior ()->tty ();
if (!exec_file)
- error (_("No executable specified, use `target exec'."));
+ error (_ ("No executable specified, use `target exec'."));
const char *inferior_cwd = current_inferior ()->cwd ().c_str ();
std::string expanded_infcwd;
@@ -2556,8 +2524,8 @@ windows_nat_target::create_inferior (const char *exec_file,
{
expanded_infcwd = gdb_tilde_expand (inferior_cwd);
/* Mirror slashes on inferior's cwd. */
- std::replace (expanded_infcwd.begin (), expanded_infcwd.end (),
- '/', '\\');
+ std::replace (expanded_infcwd.begin (), expanded_infcwd.end (), '/',
+ '\\');
inferior_cwd = expanded_infcwd.c_str ();
}
@@ -2575,12 +2543,13 @@ windows_nat_target::create_inferior (const char *exec_file,
{
flags |= DEBUG_ONLY_THIS_PROCESS;
if (cygwin_conv_path (CCP_POSIX_TO_WIN_W, exec_file, real_path,
- __PMAX * sizeof (wchar_t)) < 0)
- error (_("Error starting executable: %d"), errno);
+ __PMAX * sizeof (wchar_t))
+ < 0)
+ error (_ ("Error starting executable: %d"), errno);
toexec = real_path;
len = mbstowcs (NULL, allargs, 0) + 1;
if (len == (size_t) -1)
- error (_("Error starting executable: %d"), errno);
+ error (_ ("Error starting executable: %d"), errno);
cygallargs = (wchar_t *) alloca (len * sizeof (wchar_t));
mbstowcs (cygallargs, allargs, len);
}
@@ -2588,7 +2557,7 @@ windows_nat_target::create_inferior (const char *exec_file,
{
sh = get_shell ();
if (cygwin_conv_path (CCP_POSIX_TO_WIN_W, sh, shell, __PMAX) < 0)
- error (_("Error starting executable via shell: %d"), errno);
+ error (_ ("Error starting executable via shell: %d"), errno);
len = sizeof (L" -c 'exec '") + mbstowcs (NULL, exec_file, 0)
+ mbstowcs (NULL, allargs, 0) + 2;
cygallargs = (wchar_t *) alloca (len * sizeof (wchar_t));
@@ -2598,9 +2567,10 @@ windows_nat_target::create_inferior (const char *exec_file,
}
if (inferior_cwd != NULL
- && cygwin_conv_path (CCP_POSIX_TO_WIN_W, inferior_cwd,
- infcwd, strlen (inferior_cwd)) < 0)
- error (_("Error converting inferior cwd: %d"), errno);
+ && cygwin_conv_path (CCP_POSIX_TO_WIN_W, inferior_cwd, infcwd,
+ strlen (inferior_cwd))
+ < 0)
+ error (_ ("Error converting inferior cwd: %d"), errno);
args = (wchar_t *) alloca ((wcslen (toexec) + wcslen (cygallargs) + 2)
* sizeof (wchar_t));
@@ -2614,8 +2584,8 @@ windows_nat_target::create_inferior (const char *exec_file,
if (w32_env != (PWCHAR) -1)
flags |= CREATE_UNICODE_ENVIRONMENT;
else
- /* If that fails, fall back to old method tweaking GDB's environment. */
-#endif /* CW_CVT_ENV_TO_WINENV */
+ /* If that fails, fall back to old method tweaking GDB's environment. */
+#endif /* CW_CVT_ENV_TO_WINENV */
{
/* Reset all Win32 environment variables to avoid leftover on next run. */
clear_win32_environment (environ);
@@ -2648,15 +2618,13 @@ windows_nat_target::create_inferior (const char *exec_file,
}
windows_init_thread_list ();
- do_synchronously ([&] ()
- {
- if (!create_process (nullptr, args, flags, w32_env,
- inferior_cwd != nullptr ? infcwd : nullptr,
- disable_randomization,
- &si, &pi))
- ret = (unsigned) GetLastError ();
- return true;
- });
+ do_synchronously ([&] () {
+ if (!create_process (nullptr, args, flags, w32_env,
+ inferior_cwd != nullptr ? infcwd : nullptr,
+ disable_randomization, &si, &pi))
+ ret = (unsigned) GetLastError ();
+ return true;
+ });
if (w32_env)
/* Just free the Win32 environment, if it could be created. */
@@ -2687,22 +2655,20 @@ windows_nat_target::create_inferior (const char *exec_file,
{
int e = errno;
errno = 0;
- redirected =
- redirect_inferior_handles (allargs, allargs_copy,
- &fd_inp, &fd_out, &fd_err);
+ redirected = redirect_inferior_handles (allargs, allargs_copy, &fd_inp,
+ &fd_out, &fd_err);
if (errno)
- warning (_("Error in redirection: %s."), safe_strerror (errno));
+ warning (_ ("Error in redirection: %s."), safe_strerror (errno));
else
errno = e;
allargs_len = strlen (allargs_copy);
}
/* If not all the standard streams are redirected by the command
line, use INFERIOR_TTY for those which aren't. */
- if (!inferior_tty.empty ()
- && !(fd_inp >= 0 && fd_out >= 0 && fd_err >= 0))
+ if (!inferior_tty.empty () && !(fd_inp >= 0 && fd_out >= 0 && fd_err >= 0))
{
SECURITY_ATTRIBUTES sa;
- sa.nLength = sizeof(sa);
+ sa.nLength = sizeof (sa);
sa.lpSecurityDescriptor = 0;
sa.bInheritHandle = TRUE;
tty = CreateFileA (inferior_tty.c_str (), GENERIC_READ | GENERIC_WRITE,
@@ -2710,7 +2676,7 @@ windows_nat_target::create_inferior (const char *exec_file,
if (tty == INVALID_HANDLE_VALUE)
{
unsigned err = (unsigned) GetLastError ();
- warning (_("Warning: Failed to open TTY %s, error %#x: %s"),
+ warning (_ ("Warning: Failed to open TTY %s, error %#x: %s"),
inferior_tty.c_str (), err, strwinerror (err));
}
}
@@ -2774,19 +2740,16 @@ windows_nat_target::create_inferior (const char *exec_file,
*temp = 0;
windows_init_thread_list ();
- do_synchronously ([&] ()
- {
- if (!create_process (nullptr, /* image */
- args, /* command line */
- flags, /* start flags */
- w32env, /* environment */
- inferior_cwd, /* current directory */
- disable_randomization,
- &si,
- &pi))
- ret = (unsigned) GetLastError ();
- return true;
- });
+ do_synchronously ([&] () {
+ if (!create_process (nullptr, /* image */
+ args, /* command line */
+ flags, /* start flags */
+ w32env, /* environment */
+ inferior_cwd, /* current directory */
+ disable_randomization, &si, &pi))
+ ret = (unsigned) GetLastError ();
+ return true;
+ });
if (tty != INVALID_HANDLE_VALUE)
CloseHandle (tty);
if (fd_inp >= 0)
@@ -2795,11 +2758,11 @@ windows_nat_target::create_inferior (const char *exec_file,
_close (fd_out);
if (fd_err >= 0)
_close (fd_err);
-#endif /* !__CYGWIN__ */
+#endif /* !__CYGWIN__ */
if (ret.has_value ())
- error (_("Error creating process %s, (error %u: %s)"),
- exec_file, *ret, strwinerror (*ret));
+ error (_ ("Error creating process %s, (error %u: %s)"), exec_file, *ret,
+ strwinerror (*ret));
#ifdef __x86_64__
BOOL wow64;
@@ -2824,7 +2787,7 @@ void
windows_nat_target::mourn_inferior ()
{
(void) windows_continue (DBG_CONTINUE, -1, 0, true);
- x86_cleanup_dregs();
+ x86_cleanup_dregs ();
if (windows_process.open_process_used)
{
CHECK (CloseHandle (windows_process.handle));
@@ -2847,8 +2810,8 @@ windows_xfer_memory (gdb_byte *readbuf, const gdb_byte *writebuf,
if (writebuf != NULL)
{
- DEBUG_MEM ("write target memory, %s bytes at %s",
- pulongest (len), core_addr_to_string (memaddr));
+ DEBUG_MEM ("write target memory, %s bytes at %s", pulongest (len),
+ core_addr_to_string (memaddr));
success = WriteProcessMemory (windows_process.handle,
(LPVOID) (uintptr_t) memaddr, writebuf,
len, &done);
@@ -2859,11 +2822,11 @@ windows_xfer_memory (gdb_byte *readbuf, const gdb_byte *writebuf,
}
else
{
- DEBUG_MEM ("read target memory, %s bytes at %s",
- pulongest (len), core_addr_to_string (memaddr));
+ DEBUG_MEM ("read target memory, %s bytes at %s", pulongest (len),
+ core_addr_to_string (memaddr));
success = ReadProcessMemory (windows_process.handle,
- (LPCVOID) (uintptr_t) memaddr, readbuf,
- len, &done);
+ (LPCVOID) (uintptr_t) memaddr, readbuf, len,
+ &done);
if (!success)
lasterror = GetLastError ();
}
@@ -2889,7 +2852,7 @@ windows_nat_target::kill ()
break;
}
- target_mourn_inferior (inferior_ptid); /* Or just windows_mourn_inferior? */
+ target_mourn_inferior (inferior_ptid); /* Or just windows_mourn_inferior? */
}
void
@@ -2927,14 +2890,13 @@ windows_xfer_shared_libraries (struct target_ops *ops,
for (windows_solib &so : windows_process.solibs)
windows_xfer_shared_library (so.name.c_str (),
(CORE_ADDR) (uintptr_t) so.load_addr,
- &so.text_offset,
- target_gdbarch (), &obstack);
+ &so.text_offset, target_gdbarch (), &obstack);
obstack_grow_str0 (&obstack, "</library-list>\n");
buf = (const char *) obstack_finish (&obstack);
len_avail = strlen (buf);
if (offset >= len_avail)
- len= 0;
+ len = 0;
else
{
if (len > len_avail - offset)
@@ -2995,10 +2957,10 @@ windows_xfer_siginfo (gdb_byte *readbuf, ULONGEST offset, ULONGEST len,
}
enum target_xfer_status
-windows_nat_target::xfer_partial (enum target_object object,
- const char *annex, gdb_byte *readbuf,
- const gdb_byte *writebuf, ULONGEST offset,
- ULONGEST len, ULONGEST *xfered_len)
+windows_nat_target::xfer_partial (enum target_object object, const char *annex,
+ gdb_byte *readbuf, const gdb_byte *writebuf,
+ ULONGEST offset, ULONGEST len,
+ ULONGEST *xfered_len)
{
switch (object)
{
@@ -3020,9 +2982,8 @@ windows_nat_target::xfer_partial (enum target_object object,
with the current_target having no target beneath). */
return TARGET_XFER_E_IO;
}
- return beneath ()->xfer_partial (object, annex,
- readbuf, writebuf, offset, len,
- xfered_len);
+ return beneath ()->xfer_partial (object, annex, readbuf, writebuf,
+ offset, len, xfered_len);
}
}
@@ -3056,13 +3017,12 @@ const char *
windows_nat_target::thread_name (struct thread_info *thr)
{
windows_thread_info *th
- = windows_process.thread_rec (thr->ptid,
- DONT_INVALIDATE_CONTEXT);
+ = windows_process.thread_rec (thr->ptid, DONT_INVALIDATE_CONTEXT);
return th->thread_name ();
}
-
void _initialize_windows_nat ();
+
void
_initialize_windows_nat ()
{
@@ -3084,7 +3044,7 @@ _initialize_windows_nat ()
cygwin_internal (CW_SET_DOS_FILE_WARNING, 0);
#endif
- add_com ("signal-event", class_run, signal_event_command, _("\
+ add_com ("signal-event", class_run, signal_event_command, _ ("\
Signal a crashed process with event ID, to allow its debugging.\n\
This command is needed in support of setting up GDB as JIT debugger on \
MS-Windows. The command should be invoked from the GDB command line using \
@@ -3092,76 +3052,75 @@ the '-ex' command-line option. The ID of the event that blocks the \
crashed process will be supplied by the Windows JIT debugging mechanism."));
#ifdef __CYGWIN__
- add_setshow_boolean_cmd ("shell", class_support, &useshell, _("\
-Set use of shell to start subprocess."), _("\
-Show use of shell to start subprocess."), NULL,
- NULL,
- NULL, /* FIXME: i18n: */
+ add_setshow_boolean_cmd ("shell", class_support, &useshell, _ ("\
+Set use of shell to start subprocess."),
+ _ ("\
+Show use of shell to start subprocess."),
+ NULL, NULL, NULL, /* FIXME: i18n: */
&setlist, &showlist);
add_setshow_boolean_cmd ("cygwin-exceptions", class_support,
- &cygwin_exceptions, _("\
-Break when an exception is detected in the Cygwin DLL itself."), _("\
-Show whether gdb breaks on exceptions in the Cygwin DLL itself."), NULL,
- NULL,
- NULL, /* FIXME: i18n: */
+ &cygwin_exceptions, _ ("\
+Break when an exception is detected in the Cygwin DLL itself."),
+ _ ("\
+Show whether gdb breaks on exceptions in the Cygwin DLL itself."),
+ NULL, NULL, NULL, /* FIXME: i18n: */
&setlist, &showlist);
#endif
- add_setshow_boolean_cmd ("new-console", class_support, &new_console, _("\
-Set creation of new console when creating child process."), _("\
-Show creation of new console when creating child process."), NULL,
- NULL,
- NULL, /* FIXME: i18n: */
+ add_setshow_boolean_cmd ("new-console", class_support, &new_console, _ ("\
+Set creation of new console when creating child process."),
+ _ ("\
+Show creation of new console when creating child process."),
+ NULL, NULL, NULL, /* FIXME: i18n: */
&setlist, &showlist);
- add_setshow_boolean_cmd ("new-group", class_support, &new_group, _("\
-Set creation of new group when creating child process."), _("\
-Show creation of new group when creating child process."), NULL,
- NULL,
- NULL, /* FIXME: i18n: */
+ add_setshow_boolean_cmd ("new-group", class_support, &new_group, _ ("\
+Set creation of new group when creating child process."),
+ _ ("\
+Show creation of new group when creating child process."),
+ NULL, NULL, NULL, /* FIXME: i18n: */
&setlist, &showlist);
- add_setshow_boolean_cmd ("debugexec", class_support, &debug_exec, _("\
-Set whether to display execution in child process."), _("\
-Show whether to display execution in child process."), NULL,
- NULL,
- NULL, /* FIXME: i18n: */
+ add_setshow_boolean_cmd ("debugexec", class_support, &debug_exec, _ ("\
+Set whether to display execution in child process."),
+ _ ("\
+Show whether to display execution in child process."),
+ NULL, NULL, NULL, /* FIXME: i18n: */
&setlist, &showlist);
- add_setshow_boolean_cmd ("debugevents", class_support, &debug_events, _("\
-Set whether to display kernel events in child process."), _("\
-Show whether to display kernel events in child process."), NULL,
- NULL,
- NULL, /* FIXME: i18n: */
+ add_setshow_boolean_cmd ("debugevents", class_support, &debug_events, _ ("\
+Set whether to display kernel events in child process."),
+ _ ("\
+Show whether to display kernel events in child process."),
+ NULL, NULL, NULL, /* FIXME: i18n: */
&setlist, &showlist);
- add_setshow_boolean_cmd ("debugmemory", class_support, &debug_memory, _("\
-Set whether to display memory accesses in child process."), _("\
-Show whether to display memory accesses in child process."), NULL,
- NULL,
- NULL, /* FIXME: i18n: */
+ add_setshow_boolean_cmd ("debugmemory", class_support, &debug_memory, _ ("\
+Set whether to display memory accesses in child process."),
+ _ ("\
+Show whether to display memory accesses in child process."),
+ NULL, NULL, NULL, /* FIXME: i18n: */
&setlist, &showlist);
- add_setshow_boolean_cmd ("debugexceptions", class_support,
- &debug_exceptions, _("\
-Set whether to display kernel exceptions in child process."), _("\
-Show whether to display kernel exceptions in child process."), NULL,
- NULL,
- NULL, /* FIXME: i18n: */
+ add_setshow_boolean_cmd ("debugexceptions", class_support, &debug_exceptions,
+ _ ("\
+Set whether to display kernel exceptions in child process."),
+ _ ("\
+Show whether to display kernel exceptions in child process."),
+ NULL, NULL, NULL, /* FIXME: i18n: */
&setlist, &showlist);
init_w32_command_list ();
add_cmd ("selector", class_info, display_selectors,
- _("Display selectors infos."),
- &info_w32_cmdlist);
+ _ ("Display selectors infos."), &info_w32_cmdlist);
if (!initialize_loadable ())
{
/* This will probably fail on Windows 9x/Me. Let the user know
that we're missing some functionality. */
- warning(_("\
+ warning (_ ("\
cannot automatically find executable file or library to read symbols.\n\
Use \"file\" or \"dll\" command to load executable/libraries directly."));
}
@@ -3176,7 +3135,7 @@ static void
cygwin_set_dr (int i, CORE_ADDR addr)
{
if (i < 0 || i > 3)
- internal_error (_("Invalid register %d in cygwin_set_dr.\n"), i);
+ internal_error (_ ("Invalid register %d in cygwin_set_dr.\n"), i);
windows_process.dr[i] = addr;
for (auto &th : windows_process.thread_list)
@@ -3237,6 +3196,7 @@ windows_nat_target::thread_alive (ptid_t ptid)
}
void _initialize_check_for_gdb_ini ();
+
void
_initialize_check_for_gdb_ini ()
{
@@ -3248,8 +3208,8 @@ _initialize_check_for_gdb_ini ()
if (homedir)
{
char *p;
- char *oldini = (char *) alloca (strlen (homedir) +
- sizeof ("gdb.ini") + 1);
+ char *oldini
+ = (char *) alloca (strlen (homedir) + sizeof ("gdb.ini") + 1);
strcpy (oldini, homedir);
p = strchr (oldini, '\0');
if (p > oldini && !IS_DIR_SEPARATOR (p[-1]))
@@ -3262,7 +3222,7 @@ _initialize_check_for_gdb_ini ()
xsnprintf (newini, len + 2, "%.*s.gdbinit",
(int) (len - (sizeof ("gdb.ini") - 1)), oldini);
- warning (_("obsolete '%s' found. Rename to '%s'."), oldini, newini);
+ warning (_ ("obsolete '%s' found. Rename to '%s'."), oldini, newini);
}
}
}
diff --git a/gdb/windows-nat.h b/gdb/windows-nat.h
index 651c4aff55a..0b23cbfe33b 100644
--- a/gdb/windows-nat.h
+++ b/gdb/windows-nat.h
@@ -37,4 +37,3 @@ extern const int amd64_mappings[];
#endif
#endif
-
diff --git a/gdb/windows-tdep.c b/gdb/windows-tdep.c
index 00c700422a1..6326698aa08 100644
--- a/gdb/windows-tdep.c
+++ b/gdb/windows-tdep.c
@@ -48,20 +48,20 @@
enum
{
- WINDOWS_SIGHUP = 1, /* MinGW-w64 */
+ WINDOWS_SIGHUP = 1, /* MinGW-w64 */
WINDOWS_SIGINT = 2,
- WINDOWS_SIGQUIT = 3, /* MinGW-w64 */
+ WINDOWS_SIGQUIT = 3, /* MinGW-w64 */
WINDOWS_SIGILL = 4,
- WINDOWS_SIGTRAP = 5, /* MinGW-w64 */
- WINDOWS_SIGIOT = 6, /* MinGW-w64 */
- WINDOWS_SIGEMT = 7, /* MinGW-w64 */
+ WINDOWS_SIGTRAP = 5, /* MinGW-w64 */
+ WINDOWS_SIGIOT = 6, /* MinGW-w64 */
+ WINDOWS_SIGEMT = 7, /* MinGW-w64 */
WINDOWS_SIGFPE = 8,
- WINDOWS_SIGKILL = 9, /* MinGW-w64 */
- WINDOWS_SIGBUS = 10, /* MinGW-w64 */
+ WINDOWS_SIGKILL = 9, /* MinGW-w64 */
+ WINDOWS_SIGBUS = 10, /* MinGW-w64 */
WINDOWS_SIGSEGV = 11,
WINDOWS_SIGSYS = 12, /* MinGW-w64 */
- WINDOWS_SIGPIPE = 13, /* MinGW-w64 */
- WINDOWS_SIGALRM = 14, /* MinGW-w64 */
+ WINDOWS_SIGPIPE = 13, /* MinGW-w64 */
+ WINDOWS_SIGALRM = 14, /* MinGW-w64 */
WINDOWS_SIGTERM = 15,
WINDOWS_SIGBREAK = 21,
WINDOWS_SIGABRT = 22,
@@ -111,66 +111,62 @@ static constexpr unsigned int NOTE_INFO_MODULE64 = 4;
struct cmd_list_element *info_w32_cmdlist;
typedef struct thread_information_block_32
- {
- uint32_t current_seh; /* %fs:0x0000 */
- uint32_t current_top_of_stack; /* %fs:0x0004 */
- uint32_t current_bottom_of_stack; /* %fs:0x0008 */
- uint32_t sub_system_tib; /* %fs:0x000c */
- uint32_t fiber_data; /* %fs:0x0010 */
- uint32_t arbitrary_data_slot; /* %fs:0x0014 */
- uint32_t linear_address_tib; /* %fs:0x0018 */
- uint32_t environment_pointer; /* %fs:0x001c */
- uint32_t process_id; /* %fs:0x0020 */
- uint32_t current_thread_id; /* %fs:0x0024 */
- uint32_t active_rpc_handle; /* %fs:0x0028 */
- uint32_t thread_local_storage; /* %fs:0x002c */
- uint32_t process_environment_block; /* %fs:0x0030 */
- uint32_t last_error_number; /* %fs:0x0034 */
- }
-thread_information_32;
+{
+ uint32_t current_seh; /* %fs:0x0000 */
+ uint32_t current_top_of_stack; /* %fs:0x0004 */
+ uint32_t current_bottom_of_stack; /* %fs:0x0008 */
+ uint32_t sub_system_tib; /* %fs:0x000c */
+ uint32_t fiber_data; /* %fs:0x0010 */
+ uint32_t arbitrary_data_slot; /* %fs:0x0014 */
+ uint32_t linear_address_tib; /* %fs:0x0018 */
+ uint32_t environment_pointer; /* %fs:0x001c */
+ uint32_t process_id; /* %fs:0x0020 */
+ uint32_t current_thread_id; /* %fs:0x0024 */
+ uint32_t active_rpc_handle; /* %fs:0x0028 */
+ uint32_t thread_local_storage; /* %fs:0x002c */
+ uint32_t process_environment_block; /* %fs:0x0030 */
+ uint32_t last_error_number; /* %fs:0x0034 */
+} thread_information_32;
typedef struct thread_information_block_64
- {
- uint64_t current_seh; /* %gs:0x0000 */
- uint64_t current_top_of_stack; /* %gs:0x0008 */
- uint64_t current_bottom_of_stack; /* %gs:0x0010 */
- uint64_t sub_system_tib; /* %gs:0x0018 */
- uint64_t fiber_data; /* %gs:0x0020 */
- uint64_t arbitrary_data_slot; /* %gs:0x0028 */
- uint64_t linear_address_tib; /* %gs:0x0030 */
- uint64_t environment_pointer; /* %gs:0x0038 */
- uint64_t process_id; /* %gs:0x0040 */
- uint64_t current_thread_id; /* %gs:0x0048 */
- uint64_t active_rpc_handle; /* %gs:0x0050 */
- uint64_t thread_local_storage; /* %gs:0x0058 */
- uint64_t process_environment_block; /* %gs:0x0060 */
- uint64_t last_error_number; /* %gs:0x0068 */
- }
-thread_information_64;
-
-
-static const char* TIB_NAME[] =
- {
- " current_seh ", /* %fs:0x0000 */
- " current_top_of_stack ", /* %fs:0x0004 */
- " current_bottom_of_stack ", /* %fs:0x0008 */
- " sub_system_tib ", /* %fs:0x000c */
- " fiber_data ", /* %fs:0x0010 */
- " arbitrary_data_slot ", /* %fs:0x0014 */
- " linear_address_tib ", /* %fs:0x0018 */
- " environment_pointer ", /* %fs:0x001c */
- " process_id ", /* %fs:0x0020 */
- " current_thread_id ", /* %fs:0x0024 */
- " active_rpc_handle ", /* %fs:0x0028 */
- " thread_local_storage ", /* %fs:0x002c */
- " process_environment_block ", /* %fs:0x0030 */
- " last_error_number " /* %fs:0x0034 */
- };
-
-static const int MAX_TIB32 =
- sizeof (thread_information_32) / sizeof (uint32_t);
-static const int MAX_TIB64 =
- sizeof (thread_information_64) / sizeof (uint64_t);
+{
+ uint64_t current_seh; /* %gs:0x0000 */
+ uint64_t current_top_of_stack; /* %gs:0x0008 */
+ uint64_t current_bottom_of_stack; /* %gs:0x0010 */
+ uint64_t sub_system_tib; /* %gs:0x0018 */
+ uint64_t fiber_data; /* %gs:0x0020 */
+ uint64_t arbitrary_data_slot; /* %gs:0x0028 */
+ uint64_t linear_address_tib; /* %gs:0x0030 */
+ uint64_t environment_pointer; /* %gs:0x0038 */
+ uint64_t process_id; /* %gs:0x0040 */
+ uint64_t current_thread_id; /* %gs:0x0048 */
+ uint64_t active_rpc_handle; /* %gs:0x0050 */
+ uint64_t thread_local_storage; /* %gs:0x0058 */
+ uint64_t process_environment_block; /* %gs:0x0060 */
+ uint64_t last_error_number; /* %gs:0x0068 */
+} thread_information_64;
+
+static const char *TIB_NAME[] = {
+ " current_seh ", /* %fs:0x0000 */
+ " current_top_of_stack ", /* %fs:0x0004 */
+ " current_bottom_of_stack ", /* %fs:0x0008 */
+ " sub_system_tib ", /* %fs:0x000c */
+ " fiber_data ", /* %fs:0x0010 */
+ " arbitrary_data_slot ", /* %fs:0x0014 */
+ " linear_address_tib ", /* %fs:0x0018 */
+ " environment_pointer ", /* %fs:0x001c */
+ " process_id ", /* %fs:0x0020 */
+ " current_thread_id ", /* %fs:0x0024 */
+ " active_rpc_handle ", /* %fs:0x0028 */
+ " thread_local_storage ", /* %fs:0x002c */
+ " process_environment_block ", /* %fs:0x0030 */
+ " last_error_number " /* %fs:0x0034 */
+};
+
+static const int MAX_TIB32
+ = sizeof (thread_information_32) / sizeof (uint32_t);
+static const int MAX_TIB64
+ = sizeof (thread_information_64) / sizeof (uint64_t);
static const int FULL_TIB_SIZE = 0x1000;
static bool maint_display_all_tib = false;
@@ -183,7 +179,7 @@ struct windows_gdbarch_data
};
static const registry<gdbarch>::key<windows_gdbarch_data>
- windows_gdbarch_data_handle;
+ windows_gdbarch_data_handle;
/* Get windows_gdbarch_data of an arch. */
@@ -214,17 +210,14 @@ windows_get_tlb_type (struct gdbarch *gdbarch)
if (windows_gdbarch_data->tib_ptr_type != nullptr)
return windows_gdbarch_data->tib_ptr_type;
- dword_ptr_type = arch_integer_type (gdbarch, gdbarch_ptr_bit (gdbarch),
- 1, "DWORD_PTR");
- dword32_type = arch_integer_type (gdbarch, 32,
- 1, "DWORD32");
- word_type = arch_integer_type (gdbarch, 16,
- 1, "WORD");
- wchar_type = arch_integer_type (gdbarch, 16,
- 1, "wchar_t");
+ dword_ptr_type
+ = arch_integer_type (gdbarch, gdbarch_ptr_bit (gdbarch), 1, "DWORD_PTR");
+ dword32_type = arch_integer_type (gdbarch, 32, 1, "DWORD32");
+ word_type = arch_integer_type (gdbarch, 16, 1, "WORD");
+ wchar_type = arch_integer_type (gdbarch, 16, 1, "wchar_t");
void_ptr_type = lookup_pointer_type (builtin_type (gdbarch)->builtin_void);
- wchar_ptr_type = arch_pointer_type (gdbarch, gdbarch_ptr_bit (gdbarch),
- NULL, wchar_type);
+ wchar_ptr_type
+ = arch_pointer_type (gdbarch, gdbarch_ptr_bit (gdbarch), NULL, wchar_type);
/* list entry */
@@ -244,8 +237,7 @@ windows_get_tlb_type (struct gdbarch *gdbarch)
seh_type->set_name (xstrdup ("seh"));
seh_ptr_type = arch_type (gdbarch, TYPE_CODE_PTR,
- void_ptr_type->length () * TARGET_CHAR_BIT,
- NULL);
+ void_ptr_type->length () * TARGET_CHAR_BIT, NULL);
seh_ptr_type->set_target_type (seh_type);
append_composite_type_field (seh_type, "next_seh", seh_ptr_type);
@@ -264,19 +256,18 @@ windows_get_tlb_type (struct gdbarch *gdbarch)
append_composite_type_field (peb_ldr_type, "in_init_order", list_type);
append_composite_type_field (peb_ldr_type, "entry_in_progress",
void_ptr_type);
- peb_ldr_ptr_type = arch_type (gdbarch, TYPE_CODE_PTR,
- void_ptr_type->length () * TARGET_CHAR_BIT,
- NULL);
+ peb_ldr_ptr_type
+ = arch_type (gdbarch, TYPE_CODE_PTR,
+ void_ptr_type->length () * TARGET_CHAR_BIT, NULL);
peb_ldr_ptr_type->set_target_type (peb_ldr_type);
/* struct UNICODE_STRING */
- uni_str_type = arch_composite_type (gdbarch, "unicode_string",
- TYPE_CODE_STRUCT);
+ uni_str_type
+ = arch_composite_type (gdbarch, "unicode_string", TYPE_CODE_STRUCT);
append_composite_type_field (uni_str_type, "length", word_type);
append_composite_type_field (uni_str_type, "maximum_length", word_type);
- append_composite_type_field_aligned (uni_str_type, "buffer",
- wchar_ptr_type,
+ append_composite_type_field_aligned (uni_str_type, "buffer", wchar_ptr_type,
wchar_ptr_type->length ());
/* struct _RTL_USER_PROCESS_PARAMETERS */
@@ -310,16 +301,14 @@ windows_get_tlb_type (struct gdbarch *gdbarch)
append_composite_type_field (rupp_type, "fill_attribute", dword32_type);
append_composite_type_field (rupp_type, "window_flags", dword32_type);
append_composite_type_field (rupp_type, "show_window_flags", dword32_type);
- append_composite_type_field_aligned (rupp_type, "window_title",
- uni_str_type,
+ append_composite_type_field_aligned (rupp_type, "window_title", uni_str_type,
void_ptr_type->length ());
append_composite_type_field (rupp_type, "desktop_info", uni_str_type);
append_composite_type_field (rupp_type, "shell_info", uni_str_type);
append_composite_type_field (rupp_type, "runtime_data", uni_str_type);
- rupp_ptr_type = arch_pointer_type (gdbarch, gdbarch_ptr_bit (gdbarch),
- NULL, rupp_type);
-
+ rupp_ptr_type
+ = arch_pointer_type (gdbarch, gdbarch_ptr_bit (gdbarch), NULL, rupp_type);
/* struct process environment block */
peb_type = arch_composite_type (gdbarch, NULL, TYPE_CODE_STRUCT);
@@ -335,11 +324,9 @@ windows_get_tlb_type (struct gdbarch *gdbarch)
append_composite_type_field (peb_type, "process_heap", void_ptr_type);
append_composite_type_field (peb_type, "fast_peb_lock", void_ptr_type);
peb_ptr_type = arch_type (gdbarch, TYPE_CODE_PTR,
- void_ptr_type->length () * TARGET_CHAR_BIT,
- NULL);
+ void_ptr_type->length () * TARGET_CHAR_BIT, NULL);
peb_ptr_type->set_target_type (peb_type);
-
/* struct thread information block */
tib_type = arch_composite_type (gdbarch, NULL, TYPE_CODE_STRUCT);
tib_type->set_name (xstrdup ("tib"));
@@ -379,8 +366,7 @@ windows_get_tlb_type (struct gdbarch *gdbarch)
append_composite_type_field (tib_type, "last_error_number", dword_ptr_type);
tib_ptr_type = arch_type (gdbarch, TYPE_CODE_PTR,
- void_ptr_type->length () * TARGET_CHAR_BIT,
- NULL);
+ void_ptr_type->length () * TARGET_CHAR_BIT, NULL);
tib_ptr_type->set_target_type (tib_type);
windows_gdbarch_data->tib_ptr_type = tib_ptr_type;
@@ -403,7 +389,7 @@ tlb_value_read (struct value *val)
struct type *type = check_typedef (value_type (val));
if (!target_get_tib_address (inferior_ptid, &tlb))
- error (_("Unable to read tlb"));
+ error (_ ("Unable to read tlb"));
store_typed_address (value_contents_raw (val).data (), type, tlb);
}
@@ -413,15 +399,11 @@ tlb_value_read (struct value *val)
static void
tlb_value_write (struct value *v, struct value *fromval)
{
- error (_("Impossible to change the Thread Local Base"));
+ error (_ ("Impossible to change the Thread Local Base"));
}
-static const struct lval_funcs tlb_value_funcs =
- {
- tlb_value_read,
- tlb_value_write
- };
-
+static const struct lval_funcs tlb_value_funcs
+ = { tlb_value_read, tlb_value_write };
/* Return a new value with the correct type for the tlb object of
the current thread using architecture GDBARCH. Return a void value
@@ -439,7 +421,6 @@ tlb_make_value (struct gdbarch *gdbarch, struct internalvar *var, void *ignore)
return allocate_value (builtin_type (gdbarch)->builtin_void);
}
-
/* Display thread information block of a given thread. */
static int
@@ -472,27 +453,28 @@ display_one_tib (ptid_t ptid)
tib_size = FULL_TIB_SIZE;
max = tib_size / size;
}
-
+
tib = (gdb_byte *) alloca (tib_size);
if (target_get_tib_address (ptid, &thread_local_base) == 0)
{
- gdb_printf (_("Unable to get thread local base for %s\n"),
+ gdb_printf (_ ("Unable to get thread local base for %s\n"),
target_pid_to_str (ptid).c_str ());
return -1;
}
if (target_read (current_inferior ()->top_target (), TARGET_OBJECT_MEMORY,
- NULL, tib, thread_local_base, tib_size) != tib_size)
+ NULL, tib, thread_local_base, tib_size)
+ != tib_size)
{
- gdb_printf (_("Unable to read thread information "
- "block for %s at address %s\n"),
- target_pid_to_str (ptid).c_str (),
+ gdb_printf (_ ("Unable to read thread information "
+ "block for %s at address %s\n"),
+ target_pid_to_str (ptid).c_str (),
paddress (target_gdbarch (), thread_local_base));
return -1;
}
- gdb_printf (_("Thread Information Block %s at %s\n"),
+ gdb_printf (_ ("Thread Information Block %s at %s\n"),
target_pid_to_str (ptid).c_str (),
paddress (target_gdbarch (), thread_local_base));
@@ -504,26 +486,26 @@ display_one_tib (ptid_t ptid)
{
val = extract_unsigned_integer (index, size, byte_order);
if (i < max_name)
- gdb_printf (_("%s is 0x%s\n"), TIB_NAME[i], phex (val, size));
+ gdb_printf (_ ("%s is 0x%s\n"), TIB_NAME[i], phex (val, size));
else if (val != 0)
- gdb_printf (_("TIB[0x%s] is 0x%s\n"), phex (i * size, 2),
+ gdb_printf (_ ("TIB[0x%s] is 0x%s\n"), phex (i * size, 2),
phex (val, size));
index += size;
- }
- return 1;
+ }
+ return 1;
}
/* Display thread information block of the current thread. */
static void
-display_tib (const char * args, int from_tty)
+display_tib (const char *args, int from_tty)
{
if (inferior_ptid != null_ptid)
display_one_tib (inferior_ptid);
}
void
-windows_xfer_shared_library (const char* so_name, CORE_ADDR load_addr,
+windows_xfer_shared_library (const char *so_name, CORE_ADDR load_addr,
CORE_ADDR *text_offset_cached,
struct gdbarch *gdbarch, struct obstack *obstack)
{
@@ -568,9 +550,9 @@ windows_xfer_shared_library (const char* so_name, CORE_ADDR load_addr,
name, but in a different DLL. */
static void
-windows_iterate_over_objfiles_in_search_order
- (gdbarch *gdbarch, iterate_over_objfiles_in_search_order_cb_ftype cb,
- objfile *current_objfile)
+windows_iterate_over_objfiles_in_search_order (
+ gdbarch *gdbarch, iterate_over_objfiles_in_search_order_cb_ftype cb,
+ objfile *current_objfile)
{
if (current_objfile)
{
@@ -588,23 +570,25 @@ windows_iterate_over_objfiles_in_search_order
static void
show_maint_show_all_tib (struct ui_file *file, int from_tty,
- struct cmd_list_element *c, const char *value)
+ struct cmd_list_element *c, const char *value)
{
- gdb_printf (file, _("Show all non-zero elements of "
- "Thread Information Block is %s.\n"), value);
+ gdb_printf (file,
+ _ ("Show all non-zero elements of "
+ "Thread Information Block is %s.\n"),
+ value);
}
-
static int w32_prefix_command_valid = 0;
+
void
init_w32_command_list (void)
{
if (!w32_prefix_command_valid)
{
- add_basic_prefix_cmd
- ("w32", class_info,
- _("Print information specific to Win32 debugging."),
- &info_w32_cmdlist, 0, &infolist);
+ add_basic_prefix_cmd (
+ "w32", class_info,
+ _ ("Print information specific to Win32 debugging."),
+ &info_w32_cmdlist, 0, &infolist);
w32_prefix_command_valid = 1;
}
}
@@ -744,8 +728,8 @@ create_enum (struct gdbarch *gdbarch, int bit, const char *name,
type = arch_type (gdbarch, TYPE_CODE_ENUM, bit, name);
type->set_num_fields (count);
- type->set_fields
- ((struct field *) TYPE_ZALLOC (type, sizeof (struct field) * count));
+ type->set_fields ((struct field *) TYPE_ZALLOC (type, sizeof (struct field)
+ * count));
type->set_is_unsigned (true);
for (i = 0; i < count; i++)
@@ -757,8 +741,7 @@ create_enum (struct gdbarch *gdbarch, int bit, const char *name,
return type;
}
-static const struct enum_value_name exception_values[] =
-{
+static const struct enum_value_name exception_values[] = {
{ 0x40000015, "FATAL_APP_EXIT" },
{ 0x4000001E, "WX86_SINGLE_STEP" },
{ 0x4000001F, "WX86_BREAKPOINT" },
@@ -787,8 +770,7 @@ static const struct enum_value_name exception_values[] =
{ 0xC0000409, "FAST_FAIL" },
};
-static const struct enum_value_name violation_values[] =
-{
+static const struct enum_value_name violation_values[] = {
{ 0, "READ_ACCESS_VIOLATION" },
{ 1, "WRITE_ACCESS_VIOLATION" },
{ 8, "DATA_EXECUTION_PREVENTION_VIOLATION" },
@@ -808,22 +790,21 @@ windows_get_siginfo_type (struct gdbarch *gdbarch)
if (windows_gdbarch_data->siginfo_type != NULL)
return windows_gdbarch_data->siginfo_type;
- dword_type = arch_integer_type (gdbarch, gdbarch_int_bit (gdbarch),
- 1, "DWORD");
+ dword_type
+ = arch_integer_type (gdbarch, gdbarch_int_bit (gdbarch), 1, "DWORD");
pvoid_type = arch_pointer_type (gdbarch, gdbarch_ptr_bit (gdbarch), "PVOID",
builtin_type (gdbarch)->builtin_void);
- ulongptr_type = arch_integer_type (gdbarch, gdbarch_ptr_bit (gdbarch),
- 1, "ULONG_PTR");
+ ulongptr_type
+ = arch_integer_type (gdbarch, gdbarch_ptr_bit (gdbarch), 1, "ULONG_PTR");
/* ExceptionCode value names */
- code_enum = create_enum (gdbarch, gdbarch_int_bit (gdbarch),
- "ExceptionCode", exception_values,
- ARRAY_SIZE (exception_values));
+ code_enum = create_enum (gdbarch, gdbarch_int_bit (gdbarch), "ExceptionCode",
+ exception_values, ARRAY_SIZE (exception_values));
/* ACCESS_VIOLATION type names */
- violation_enum = create_enum (gdbarch, gdbarch_ptr_bit (gdbarch),
- "ViolationType", violation_values,
- ARRAY_SIZE (violation_values));
+ violation_enum
+ = create_enum (gdbarch, gdbarch_ptr_bit (gdbarch), "ViolationType",
+ violation_values, ARRAY_SIZE (violation_values));
/* ACCESS_VIOLATION information */
violation_type = arch_composite_type (gdbarch, NULL, TYPE_CODE_STRUCT);
@@ -839,8 +820,8 @@ windows_get_siginfo_type (struct gdbarch *gdbarch)
append_composite_type_field (para_type, "AccessViolationInformation",
violation_type);
- siginfo_type = arch_composite_type (gdbarch, "EXCEPTION_RECORD",
- TYPE_CODE_STRUCT);
+ siginfo_type
+ = arch_composite_type (gdbarch, "EXCEPTION_RECORD", TYPE_CODE_STRUCT);
siginfo_ptr_type = arch_pointer_type (gdbarch, gdbarch_ptr_bit (gdbarch),
NULL, siginfo_type);
@@ -850,12 +831,11 @@ windows_get_siginfo_type (struct gdbarch *gdbarch)
append_composite_type_field (siginfo_type, "ExceptionFlags", dword_type);
append_composite_type_field (siginfo_type, "ExceptionRecord",
siginfo_ptr_type);
- append_composite_type_field (siginfo_type, "ExceptionAddress",
- pvoid_type);
+ append_composite_type_field (siginfo_type, "ExceptionAddress", pvoid_type);
append_composite_type_field (siginfo_type, "NumberParameters", dword_type);
/* The 64-bit variant needs some padding. */
- append_composite_type_field_aligned (siginfo_type, "",
- para_type, ulongptr_type->length ());
+ append_composite_type_field_aligned (siginfo_type, "", para_type,
+ ulongptr_type->length ());
windows_gdbarch_data->siginfo_type = siginfo_type;
@@ -890,8 +870,7 @@ windows_solib_create_inferior_hook (int from_tty)
}
CORE_ADDR tlb;
gdb_byte buf[8];
- if (target_has_execution ()
- && target_get_tib_address (inferior_ptid, &tlb)
+ if (target_has_execution () && target_get_tib_address (inferior_ptid, &tlb)
&& !target_read_memory (tlb + peb_offset, buf, ptr_bytes))
{
CORE_ADDR peb = extract_unsigned_integer (buf, ptr_bytes, byte_order);
@@ -925,8 +904,8 @@ windows_init_abi_common (struct gdbarch_info info, struct gdbarch *gdbarch)
`c:\Program Files\Foo App\mydll.dll', for example. */
set_gdbarch_has_dos_based_file_system (gdbarch, 1);
- set_gdbarch_iterate_over_objfiles_in_search_order
- (gdbarch, windows_iterate_over_objfiles_in_search_order);
+ set_gdbarch_iterate_over_objfiles_in_search_order (
+ gdbarch, windows_iterate_over_objfiles_in_search_order);
windows_so_ops = solib_target_so_ops;
windows_so_ops.solib_create_inferior_hook
@@ -955,8 +934,7 @@ cygwin_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
/* Implementation of `tlb' variable. */
-static const struct internalvar_funcs tlb_funcs =
-{
+static const struct internalvar_funcs tlb_funcs = {
tlb_make_value,
NULL,
};
@@ -992,7 +970,8 @@ is_linked_with_cygwin_dll (bfd *abfd)
bfd_size_type idata_section_size = bfd_section_size (idata_section);
internal_extra_pe_aouthdr *pe_extra = &pe_data (abfd)->pe_opthdr;
- bfd_vma import_table_va = pe_extra->DataDirectory[PE_IMPORT_TABLE].VirtualAddress;
+ bfd_vma import_table_va
+ = pe_extra->DataDirectory[PE_IMPORT_TABLE].VirtualAddress;
bfd_vma idata_section_va = bfd_section_vma (idata_section);
/* The section's virtual address as reported by BFD has the image base applied,
@@ -1006,7 +985,7 @@ is_linked_with_cygwin_dll (bfd *abfd)
if (import_table_va < idata_section_va
|| import_table_va >= idata_section_end_va)
{
- warning (_("\
+ warning (_ ("\
%s: import table's virtual address (%s) is outside .idata \
section's range [%s, %s]."),
bfd_get_filename (abfd), hex_string (import_table_va),
@@ -1020,9 +999,10 @@ section's range [%s, %s]."),
/* Get the section's data. */
gdb::byte_vector idata_contents;
- if (!gdb_bfd_get_full_section_contents (abfd, idata_section, &idata_contents))
+ if (!gdb_bfd_get_full_section_contents (abfd, idata_section,
+ &idata_contents))
{
- warning (_("%s: failed to get contents of .idata section."),
+ warning (_ ("%s: failed to get contents of .idata section."),
bfd_get_filename (abfd));
return false;
}
@@ -1039,16 +1019,18 @@ section's range [%s, %s]."),
/* Is there enough space left in the section for another entry? */
if (iter + sizeof (pe_import_directory_entry) > end)
{
- warning (_("%s: unexpected end of .idata section."),
+ warning (_ ("%s: unexpected end of .idata section."),
bfd_get_filename (abfd));
break;
}
- pe_import_directory_entry *dir_entry = (pe_import_directory_entry *) iter;
+ pe_import_directory_entry *dir_entry
+ = (pe_import_directory_entry *) iter;
/* Is it the end of list marker? */
if (memcmp (dir_entry, &null_dir_entry,
- sizeof (pe_import_directory_entry)) == 0)
+ sizeof (pe_import_directory_entry))
+ == 0)
break;
bfd_vma name_va = dir_entry->name_rva;
@@ -1057,7 +1039,7 @@ section's range [%s, %s]."),
address, there's a problem. */
if (name_va < idata_section_va || name_va >= idata_section_end_va)
{
- warning (_("\
+ warning (_ ("\
%s: name's virtual address (%s) is outside .idata section's \
range [%s, %s]."),
bfd_get_filename (abfd), hex_string (name_va),
@@ -1106,8 +1088,8 @@ core_process_module_section (bfd *abfd, asection *sect, void *obj)
return;
gdb::byte_vector buf (bfd_section_size (sect) + 1);
- if (!bfd_get_section_contents (abfd, sect,
- buf.data (), 0, bfd_section_size (sect)))
+ if (!bfd_get_section_contents (abfd, sect, buf.data (), 0,
+ bfd_section_size (sect)))
return;
/* We're going to treat part of the buffer as a string, so make sure
it is NUL-terminated. */
@@ -1143,15 +1125,14 @@ core_process_module_section (bfd *abfd, asection *sect, void *obj)
/* The first module is the .exe itself. */
if (data->module_count != 0)
- windows_xfer_shared_library (module_name, base_addr,
- NULL, data->gdbarch, data->obstack);
+ windows_xfer_shared_library (module_name, base_addr, NULL, data->gdbarch,
+ data->obstack);
data->module_count++;
}
ULONGEST
-windows_core_xfer_shared_libraries (struct gdbarch *gdbarch,
- gdb_byte *readbuf,
- ULONGEST offset, ULONGEST len)
+windows_core_xfer_shared_libraries (struct gdbarch *gdbarch, gdb_byte *readbuf,
+ ULONGEST offset, ULONGEST len)
{
struct obstack obstack;
const char *buf;
@@ -1160,9 +1141,7 @@ windows_core_xfer_shared_libraries (struct gdbarch *gdbarch,
obstack_init (&obstack);
obstack_grow_str (&obstack, "<library-list>\n");
- bfd_map_over_sections (core_bfd,
- core_process_module_section,
- &data);
+ bfd_map_over_sections (core_bfd, core_process_module_section, &data);
obstack_grow_str0 (&obstack, "</library-list>\n");
buf = (const char *) obstack_finish (&obstack);
@@ -1190,26 +1169,27 @@ windows_core_pid_to_str (struct gdbarch *gdbarch, ptid_t ptid)
}
void _initialize_windows_tdep ();
+
void
_initialize_windows_tdep ()
{
init_w32_command_list ();
cmd_list_element *info_w32_thread_information_block_cmd
= add_cmd ("thread-information-block", class_info, display_tib,
- _("Display thread information block."),
- &info_w32_cmdlist);
+ _ ("Display thread information block."), &info_w32_cmdlist);
add_alias_cmd ("tib", info_w32_thread_information_block_cmd, class_info, 1,
&info_w32_cmdlist);
add_setshow_boolean_cmd ("show-all-tib", class_maintenance,
- &maint_display_all_tib, _("\
-Set whether to display all non-zero fields of thread information block."), _("\
-Show whether to display all non-zero fields of thread information block."), _("\
+ &maint_display_all_tib, _ ("\
+Set whether to display all non-zero fields of thread information block."),
+ _ ("\
+Show whether to display all non-zero fields of thread information block."),
+ _ ("\
Use \"on\" to enable, \"off\" to disable.\n\
If enabled, all non-zero fields of thread information block are displayed,\n\
even if their meaning is unknown."),
- NULL,
- show_maint_show_all_tib,
+ NULL, show_maint_show_all_tib,
&maintenance_set_cmdlist,
&maintenance_show_cmdlist);
diff --git a/gdb/windows-tdep.h b/gdb/windows-tdep.h
index be4a363f8cc..023034839e9 100644
--- a/gdb/windows-tdep.h
+++ b/gdb/windows-tdep.h
@@ -25,7 +25,7 @@ extern struct cmd_list_element *info_w32_cmdlist;
extern void init_w32_command_list (void);
-extern void windows_xfer_shared_library (const char* so_name,
+extern void windows_xfer_shared_library (const char *so_name,
CORE_ADDR load_addr,
CORE_ADDR *text_offset_cached,
struct gdbarch *gdbarch,
diff --git a/gdb/x86-bsd-nat.c b/gdb/x86-bsd-nat.c
index c55ab5ba89c..b468f30d92c 100644
--- a/gdb/x86-bsd-nat.c
+++ b/gdb/x86-bsd-nat.c
@@ -31,7 +31,6 @@
#include "x86-nat.h"
#include "x86-bsd-nat.h"
#include "inf-ptrace.h"
-
/* Support for debug registers. */
@@ -67,7 +66,7 @@ x86bsd_dr_get (ptid_t ptid, int regnum)
struct dbreg dbregs;
if (gdb_ptrace (PT_GETDBREGS, ptid, (PTRACE_TYPE_ARG3) &dbregs) == -1)
- perror_with_name (_("Couldn't read debug registers"));
+ perror_with_name (_ ("Couldn't read debug registers"));
return DBREG_DRX ((&dbregs), regnum);
}
@@ -78,7 +77,7 @@ x86bsd_dr_set (ptid_t ptid, int regnum, unsigned long value)
struct dbreg dbregs;
if (gdb_ptrace (PT_GETDBREGS, ptid, (PTRACE_TYPE_ARG3) &dbregs) == -1)
- perror_with_name (_("Couldn't get debug registers"));
+ perror_with_name (_ ("Couldn't get debug registers"));
/* For some mysterious reason, some of the reserved bits in the
debug control register get set. Mask these off, otherwise the
@@ -89,9 +88,9 @@ x86bsd_dr_set (ptid_t ptid, int regnum, unsigned long value)
for (thread_info *thread : current_inferior ()->non_exited_threads ())
{
- if (gdb_ptrace (PT_SETDBREGS, thread->ptid,
- (PTRACE_TYPE_ARG3) &dbregs) == -1)
- perror_with_name (_("Couldn't write debug registers"));
+ if (gdb_ptrace (PT_SETDBREGS, thread->ptid, (PTRACE_TYPE_ARG3) &dbregs)
+ == -1)
+ perror_with_name (_ ("Couldn't write debug registers"));
}
}
@@ -130,6 +129,7 @@ x86bsd_dr_get_control (void)
#endif /* PT_GETDBREGS */
void _initialize_x86_bsd_nat ();
+
void
_initialize_x86_bsd_nat ()
{
diff --git a/gdb/x86-bsd-nat.h b/gdb/x86-bsd-nat.h
index 5dcbf0122a8..1a1692abf64 100644
--- a/gdb/x86-bsd-nat.h
+++ b/gdb/x86-bsd-nat.h
@@ -29,14 +29,16 @@ template<typename BaseTarget>
class x86bsd_nat_target : public x86_nat_target<BaseTarget>
{
using base_class = x86_nat_target<BaseTarget>;
+
public:
+
void mourn_inferior () override
{
x86_cleanup_dregs ();
base_class::mourn_inferior ();
}
};
-#else /* !HAVE_PT_GETDBREGS */
+#else /* !HAVE_PT_GETDBREGS */
template<typename BaseTarget>
class x86bsd_nat_target : public BaseTarget
{
diff --git a/gdb/x86-fbsd-nat.h b/gdb/x86-fbsd-nat.h
index 0a1308f3584..2187aef42f6 100644
--- a/gdb/x86-fbsd-nat.h
+++ b/gdb/x86-fbsd-nat.h
@@ -27,8 +27,7 @@
class x86_fbsd_nat_target : public x86bsd_nat_target<fbsd_nat_target>
{
- bool supports_stopped_by_hw_breakpoint () override
- { return true; }
+ bool supports_stopped_by_hw_breakpoint () override { return true; }
void low_new_fork (ptid_t parent, pid_t child) override;
};
diff --git a/gdb/x86-linux-nat.c b/gdb/x86-linux-nat.c
index fd2145244cc..9702eeb5cbb 100644
--- a/gdb/x86-linux-nat.c
+++ b/gdb/x86-linux-nat.c
@@ -75,11 +75,8 @@ x86_linux_nat_target::low_new_fork (struct lwp_info *parent, pid_t child_pid)
child_state = x86_debug_reg_state (child_pid);
*child_state = *parent_state;
}
-
-x86_linux_nat_target::~x86_linux_nat_target ()
-{
-}
+x86_linux_nat_target::~x86_linux_nat_target () {}
/* Implement the virtual inf_ptrace_target::post_startup_inferior method. */
@@ -124,24 +121,24 @@ x86_linux_nat_target::read_description ()
/* Get CS register. */
errno = 0;
- cs = ptrace (PTRACE_PEEKUSER, tid,
- offsetof (struct user_regs_struct, cs), 0);
+ cs = ptrace (PTRACE_PEEKUSER, tid, offsetof (struct user_regs_struct, cs),
+ 0);
if (errno != 0)
- perror_with_name (_("Couldn't get CS register"));
+ perror_with_name (_ ("Couldn't get CS register"));
is_64bit = cs == AMD64_LINUX_USER64_CS;
/* Get DS register. */
errno = 0;
- ds = ptrace (PTRACE_PEEKUSER, tid,
- offsetof (struct user_regs_struct, ds), 0);
+ ds = ptrace (PTRACE_PEEKUSER, tid, offsetof (struct user_regs_struct, ds),
+ 0);
if (errno != 0)
- perror_with_name (_("Couldn't get DS register"));
+ perror_with_name (_ ("Couldn't get DS register"));
is_x32 = ds == AMD64_LINUX_X32_DS;
if (sizeof (void *) == 4 && is_64bit && !is_x32)
- error (_("Can't debug 64-bit process with 32-bit GDB"));
+ error (_ ("Can't debug 64-bit process with 32-bit GDB"));
}
#elif HAVE_PTRACE_GETFPXREGS
if (have_ptrace_getfpxregs == -1)
@@ -166,16 +163,16 @@ x86_linux_nat_target::read_description ()
iov.iov_len = sizeof (xstateregs);
/* Check if PTRACE_GETREGSET works. */
- if (ptrace (PTRACE_GETREGSET, tid,
- (unsigned int) NT_X86_XSTATE, &iov) < 0)
+ if (ptrace (PTRACE_GETREGSET, tid, (unsigned int) NT_X86_XSTATE, &iov)
+ < 0)
have_ptrace_getregset = TRIBOOL_FALSE;
else
{
have_ptrace_getregset = TRIBOOL_TRUE;
/* Get XCR0 from XSAVE extended state. */
- xcr0 = xstateregs[(I386_LINUX_XSAVE_XCR0_OFFSET
- / sizeof (uint64_t))];
+ xcr0
+ = xstateregs[(I386_LINUX_XSAVE_XCR0_OFFSET / sizeof (uint64_t))];
}
}
@@ -196,7 +193,7 @@ x86_linux_nat_target::read_description ()
}
else
{
- const struct target_desc * tdesc
+ const struct target_desc *tdesc
= i386_linux_read_description (xcr0_features_bits);
if (tdesc == NULL)
@@ -207,7 +204,6 @@ x86_linux_nat_target::read_description ()
gdb_assert_not_reached ("failed to return tdesc");
}
-
/* Enable branch tracing. */
@@ -223,7 +219,7 @@ x86_linux_nat_target::enable_btrace (thread_info *tp,
}
catch (const gdb_exception_error &exception)
{
- error (_("Could not enable branch tracing for %s: %s"),
+ error (_ ("Could not enable branch tracing for %s: %s"),
target_pid_to_str (ptid).c_str (), exception.what ());
}
@@ -238,7 +234,7 @@ x86_linux_nat_target::disable_btrace (struct btrace_target_info *tinfo)
enum btrace_error errcode = linux_disable_btrace (tinfo);
if (errcode != BTRACE_ERR_NONE)
- error (_("Could not disable branch tracing."));
+ error (_ ("Could not disable branch tracing."));
}
/* Teardown branch tracing. */
@@ -266,8 +262,6 @@ x86_linux_nat_target::btrace_conf (const struct btrace_target_info *btinfo)
return linux_btrace_conf (btinfo);
}
-
-
/* Helper for ps_get_thread_area. Sets BASE_ADDR to a pointer to
the thread local storage (or its descriptor) and returns PS_OK
on success. Returns PS_ERR on failure. */
@@ -308,9 +302,9 @@ x86_linux_get_thread_area (pid_t pid, void *addr, unsigned int *base_addr)
*base_addr = desc[1];
return PS_OK;
}
-
void _initialize_x86_linux_nat ();
+
void
_initialize_x86_linux_nat ()
{
diff --git a/gdb/x86-linux-nat.h b/gdb/x86-linux-nat.h
index fcb5f08d251..6d84b9ec750 100644
--- a/gdb/x86-linux-nat.h
+++ b/gdb/x86-linux-nat.h
@@ -20,7 +20,7 @@
#ifndef X86_LINUX_NAT_H
#define X86_LINUX_NAT_H 1
-#include "gdb_proc_service.h" /* For ps_err_e. */
+#include "gdb_proc_service.h" /* For ps_err_e. */
#include "linux-nat.h"
#include "x86-nat.h"
#include "nat/x86-linux.h"
@@ -32,52 +32,65 @@ struct x86_linux_nat_target : public x86_nat_target<linux_nat_target>
/* Add the description reader. */
const struct target_desc *read_description () override;
- struct btrace_target_info *enable_btrace (thread_info *tp,
- const struct btrace_config *conf) override;
+ struct btrace_target_info *
+ enable_btrace (thread_info *tp, const struct btrace_config *conf) override;
void disable_btrace (struct btrace_target_info *tinfo) override;
void teardown_btrace (struct btrace_target_info *tinfo) override;
enum btrace_error read_btrace (struct btrace_data *data,
struct btrace_target_info *btinfo,
enum btrace_read_type type) override;
- const struct btrace_config *btrace_conf (const struct btrace_target_info *) override;
+ const struct btrace_config *
+ btrace_conf (const struct btrace_target_info *) override;
/* These two are rewired to low_ versions. linux-nat.c queries
stopped-by-watchpoint info as soon as an lwp stops (via the low_
methods) and caches the result, to be returned via the normal
non-low methods. */
bool stopped_by_watchpoint () override
- { return linux_nat_target::stopped_by_watchpoint (); }
+ {
+ return linux_nat_target::stopped_by_watchpoint ();
+ }
bool stopped_data_address (CORE_ADDR *addr_p) override
- { return linux_nat_target::stopped_data_address (addr_p); }
+ {
+ return linux_nat_target::stopped_data_address (addr_p);
+ }
bool low_stopped_by_watchpoint () override
- { return x86_nat_target::stopped_by_watchpoint (); }
+ {
+ return x86_nat_target::stopped_by_watchpoint ();
+ }
bool low_stopped_data_address (CORE_ADDR *addr_p) override
- { return x86_nat_target::stopped_data_address (addr_p); }
+ {
+ return x86_nat_target::stopped_data_address (addr_p);
+ }
void low_new_fork (struct lwp_info *parent, pid_t child_pid) override;
- void low_forget_process (pid_t pid) override
- { x86_forget_process (pid); }
+ void low_forget_process (pid_t pid) override { x86_forget_process (pid); }
void low_prepare_to_resume (struct lwp_info *lwp) override
- { x86_linux_prepare_to_resume (lwp); }
+ {
+ x86_linux_prepare_to_resume (lwp);
+ }
void low_new_thread (struct lwp_info *lwp) override
- { x86_linux_new_thread (lwp); }
+ {
+ x86_linux_new_thread (lwp);
+ }
void low_delete_thread (struct arch_lwp_info *lwp) override
- { x86_linux_delete_thread (lwp); }
+ {
+ x86_linux_delete_thread (lwp);
+ }
protected:
+
/* Override the GNU/Linux inferior startup hook. */
void post_startup_inferior (ptid_t) override;
};
-
-
/* Helper for ps_get_thread_area. Sets BASE_ADDR to a pointer to
the thread local storage (or its descriptor) and returns PS_OK
on success. Returns PS_ERR on failure. */
diff --git a/gdb/x86-nat.c b/gdb/x86-nat.c
index 515af27cb27..2fd4ddf68dc 100644
--- a/gdb/x86-nat.c
+++ b/gdb/x86-nat.c
@@ -43,8 +43,8 @@ struct x86_dr_low_type x86_dr_low;
need to keep track of processes that aren't bound to any inferior
(e.g., fork children, checkpoints). */
-static std::unordered_map<pid_t,
- struct x86_debug_reg_state> x86_debug_process_state;
+static std::unordered_map<pid_t, struct x86_debug_reg_state>
+ x86_debug_process_state;
/* See x86-nat.h. */
@@ -89,8 +89,8 @@ x86_cleanup_dregs (void)
of the type TYPE. Return 0 on success, -1 on failure. */
int
-x86_insert_watchpoint (CORE_ADDR addr, int len,
- enum target_hw_bp_type type, struct expression *cond)
+x86_insert_watchpoint (CORE_ADDR addr, int len, enum target_hw_bp_type type,
+ struct expression *cond)
{
struct x86_debug_reg_state *state
= x86_debug_reg_state (inferior_ptid.pid ());
@@ -102,8 +102,8 @@ x86_insert_watchpoint (CORE_ADDR addr, int len,
address ADDR, whose length is LEN bytes, and for accesses of the
type TYPE. Return 0 on success, -1 on failure. */
int
-x86_remove_watchpoint (CORE_ADDR addr, int len,
- enum target_hw_bp_type type, struct expression *cond)
+x86_remove_watchpoint (CORE_ADDR addr, int len, enum target_hw_bp_type type,
+ struct expression *cond)
{
struct x86_debug_reg_state *state
= x86_debug_reg_state (inferior_ptid.pid ());
@@ -152,14 +152,17 @@ x86_stopped_by_watchpoint ()
Return 0 on success, EBUSY on failure. */
int
-x86_insert_hw_breakpoint (struct gdbarch *gdbarch, struct bp_target_info *bp_tgt)
+x86_insert_hw_breakpoint (struct gdbarch *gdbarch,
+ struct bp_target_info *bp_tgt)
{
struct x86_debug_reg_state *state
= x86_debug_reg_state (inferior_ptid.pid ());
bp_tgt->placed_address = bp_tgt->reqstd_address;
- return x86_dr_insert_watchpoint (state, hw_execute,
- bp_tgt->placed_address, 1) ? EBUSY : 0;
+ return x86_dr_insert_watchpoint (state, hw_execute, bp_tgt->placed_address,
+ 1)
+ ? EBUSY
+ : 0;
}
/* Remove a hardware-assisted breakpoint at BP_TGT->placed_address.
@@ -172,8 +175,8 @@ x86_remove_hw_breakpoint (struct gdbarch *gdbarch,
struct x86_debug_reg_state *state
= x86_debug_reg_state (inferior_ptid.pid ());
- return x86_dr_remove_watchpoint (state, hw_execute,
- bp_tgt->placed_address, 1);
+ return x86_dr_remove_watchpoint (state, hw_execute, bp_tgt->placed_address,
+ 1);
}
/* Returns the number of hardware watchpoints of type TYPE that we can
@@ -217,16 +220,16 @@ add_show_debug_regs_command (void)
/* A maintenance command to enable printing the internal DRi mirror
variables. */
add_setshow_boolean_cmd ("show-debug-regs", class_maintenance,
- &show_debug_regs, _("\
-Set whether to show variables that mirror the x86 debug registers."), _("\
-Show whether to show variables that mirror the x86 debug registers."), _("\
+ &show_debug_regs, _ ("\
+Set whether to show variables that mirror the x86 debug registers."),
+ _ ("\
+Show whether to show variables that mirror the x86 debug registers."),
+ _ ("\
Use \"on\" to enable, \"off\" to disable.\n\
If enabled, the debug registers values are shown when GDB inserts\n\
or removes a hardware breakpoint or watchpoint, and when the inferior\n\
triggers a breakpoint or watchpoint."),
- NULL,
- NULL,
- &maintenance_set_cmdlist,
+ NULL, NULL, &maintenance_set_cmdlist,
&maintenance_show_cmdlist);
}
diff --git a/gdb/x86-nat.h b/gdb/x86-nat.h
index 5428ccdfce9..d3d2de6b053 100644
--- a/gdb/x86-nat.h
+++ b/gdb/x86-nat.h
@@ -53,18 +53,19 @@ extern void x86_forget_process (pid_t pid);
/* Helper functions used by x86_nat_target below. See their
definitions. */
-extern int x86_can_use_hw_breakpoint (enum bptype type, int cnt, int othertype);
+extern int x86_can_use_hw_breakpoint (enum bptype type, int cnt,
+ int othertype);
extern int x86_region_ok_for_hw_watchpoint (CORE_ADDR addr, int len);
extern int x86_stopped_by_watchpoint ();
extern int x86_stopped_data_address (CORE_ADDR *addr_p);
extern int x86_insert_watchpoint (CORE_ADDR addr, int len,
- enum target_hw_bp_type type,
- struct expression *cond);
+ enum target_hw_bp_type type,
+ struct expression *cond);
extern int x86_remove_watchpoint (CORE_ADDR addr, int len,
- enum target_hw_bp_type type,
- struct expression *cond);
+ enum target_hw_bp_type type,
+ struct expression *cond);
extern int x86_insert_hw_breakpoint (struct gdbarch *gdbarch,
- struct bp_target_info *bp_tgt);
+ struct bp_target_info *bp_tgt);
extern int x86_remove_hw_breakpoint (struct gdbarch *gdbarch,
struct bp_target_info *bp_tgt);
extern int x86_stopped_by_hw_breakpoint ();
@@ -72,46 +73,62 @@ extern int x86_stopped_by_hw_breakpoint ();
/* Convenience template mixin used to add x86 watchpoints support to a
target. */
-template <typename BaseTarget>
+template<typename BaseTarget>
struct x86_nat_target : public BaseTarget
{
/* Hook in the x86 hardware watchpoints/breakpoints support. */
int can_use_hw_breakpoint (enum bptype type, int cnt, int othertype) override
- { return x86_can_use_hw_breakpoint (type, cnt, othertype); }
+ {
+ return x86_can_use_hw_breakpoint (type, cnt, othertype);
+ }
int region_ok_for_hw_watchpoint (CORE_ADDR addr, int len) override
- { return x86_region_ok_for_hw_watchpoint (addr, len); }
+ {
+ return x86_region_ok_for_hw_watchpoint (addr, len);
+ }
- int insert_watchpoint (CORE_ADDR addr, int len,
- enum target_hw_bp_type type,
+ int insert_watchpoint (CORE_ADDR addr, int len, enum target_hw_bp_type type,
struct expression *cond) override
- { return x86_insert_watchpoint (addr, len, type, cond); }
+ {
+ return x86_insert_watchpoint (addr, len, type, cond);
+ }
- int remove_watchpoint (CORE_ADDR addr, int len,
- enum target_hw_bp_type type,
+ int remove_watchpoint (CORE_ADDR addr, int len, enum target_hw_bp_type type,
struct expression *cond) override
- { return x86_remove_watchpoint (addr, len, type, cond); }
+ {
+ return x86_remove_watchpoint (addr, len, type, cond);
+ }
int insert_hw_breakpoint (struct gdbarch *gdbarch,
struct bp_target_info *bp_tgt) override
- { return x86_insert_hw_breakpoint (gdbarch, bp_tgt); }
+ {
+ return x86_insert_hw_breakpoint (gdbarch, bp_tgt);
+ }
int remove_hw_breakpoint (struct gdbarch *gdbarch,
struct bp_target_info *bp_tgt) override
- { return x86_remove_hw_breakpoint (gdbarch, bp_tgt); }
+ {
+ return x86_remove_hw_breakpoint (gdbarch, bp_tgt);
+ }
bool stopped_by_watchpoint () override
- { return x86_stopped_by_watchpoint (); }
+ {
+ return x86_stopped_by_watchpoint ();
+ }
bool stopped_data_address (CORE_ADDR *addr_p) override
- { return x86_stopped_data_address (addr_p); }
+ {
+ return x86_stopped_data_address (addr_p);
+ }
/* A target must provide an implementation of the
"supports_stopped_by_hw_breakpoint" target method before this
callback will be used. */
bool stopped_by_hw_breakpoint () override
- { return x86_stopped_by_hw_breakpoint (); }
+ {
+ return x86_stopped_by_hw_breakpoint ();
+ }
};
#endif /* X86_NAT_H */
diff --git a/gdb/x86-tdep.c b/gdb/x86-tdep.c
index 6a73f2177c9..176d038da70 100644
--- a/gdb/x86-tdep.c
+++ b/gdb/x86-tdep.c
@@ -21,13 +21,12 @@
#include "x86-tdep.h"
#include "symtab.h"
-
/* Check whether NAME is included in NAMES[LO] (inclusive) to NAMES[HI]
(exclusive). */
static bool
-x86_is_thunk_register_name (const char *name, const char * const *names,
- int lo, int hi)
+x86_is_thunk_register_name (const char *name, const char *const *names, int lo,
+ int hi)
{
int reg;
for (reg = lo; reg < hi; ++reg)
@@ -40,7 +39,7 @@ x86_is_thunk_register_name (const char *name, const char * const *names,
/* See x86-tdep.h. */
bool
-x86_in_indirect_branch_thunk (CORE_ADDR pc, const char * const *register_names,
+x86_in_indirect_branch_thunk (CORE_ADDR pc, const char *const *register_names,
int lo, int hi)
{
struct bound_minimal_symbol bmfun = lookup_minimal_symbol_by_pc (pc);
diff --git a/gdb/x86-tdep.h b/gdb/x86-tdep.h
index 7840ceda57d..cf630f85533 100644
--- a/gdb/x86-tdep.h
+++ b/gdb/x86-tdep.h
@@ -24,7 +24,7 @@
REGISTER_NAMES[LO] (inclusive) to REGISTER_NAMES[HI] (exclusive). */
extern bool x86_in_indirect_branch_thunk (CORE_ADDR pc,
- const char * const *register_names,
+ const char *const *register_names,
int lo, int hi);
#endif /* x86-tdep.h */
diff --git a/gdb/xcoffread.c b/gdb/xcoffread.c
index bd6f6521c4c..70446a6e192 100644
--- a/gdb/xcoffread.c
+++ b/gdb/xcoffread.c
@@ -31,7 +31,7 @@
#include <algorithm>
#include "coff/internal.h"
-#include "libcoff.h" /* FIXME, internal data from BFD */
+#include "libcoff.h" /* FIXME, internal data from BFD */
#include "coff/xcoff.h"
#include "libxcoff.h"
#include "coff/rs6000.h"
@@ -55,47 +55,44 @@
/* For interface with stabsread.c. */
#include "aout/stab_gnu.h"
-
/* We put a pointer to this structure in the read_symtab_private field
of the psymtab. */
struct xcoff_symloc
- {
-
- /* First symbol number for this file. */
+{
+ /* First symbol number for this file. */
- int first_symnum;
+ int first_symnum;
- /* Number of symbols in the section of the symbol table devoted to
+ /* Number of symbols in the section of the symbol table devoted to
this file's symbols (actually, the section bracketed may contain
more than just this file's symbols). If numsyms is 0, the only
reason for this thing's existence is the dependency list. Nothing
else will happen when it is read in. */
- int numsyms;
+ int numsyms;
- /* Position of the start of the line number information for this
+ /* Position of the start of the line number information for this
psymtab. */
- unsigned int lineno_off;
- };
+ unsigned int lineno_off;
+};
/* Remember what we deduced to be the source language of this psymtab. */
static enum language psymtab_language = language_unknown;
-
/* Simplified internal version of coff symbol table information. */
struct xcoff_symbol
- {
- char *c_name;
- int c_symnum; /* Symbol number of this entry. */
- int c_naux; /* 0 if syment only, 1 if syment + auxent. */
- CORE_ADDR c_value;
- unsigned char c_sclass;
- int c_secnum;
- unsigned int c_type;
- };
+{
+ char *c_name;
+ int c_symnum; /* Symbol number of this entry. */
+ int c_naux; /* 0 if syment only, 1 if syment + auxent. */
+ CORE_ADDR c_value;
+ unsigned char c_sclass;
+ int c_secnum;
+ unsigned int c_type;
+};
/* Last function's saved coff symbol `cs'. */
@@ -107,7 +104,6 @@ static bfd *symfile_bfd;
This is calculated from the first function seen after a C_FILE
symbol. */
-
static CORE_ADDR cur_src_end_addr;
/* Core address of the end of the first object file. */
@@ -116,7 +112,7 @@ static CORE_ADDR first_object_file_end;
/* Initial symbol-table-debug-string vector length. */
-#define INITIAL_STABVECTOR_LENGTH 40
+#define INITIAL_STABVECTOR_LENGTH 40
/* Size of a COFF symbol. I think it is always 18, so I'm not sure
there is any reason not to just use a #define, but might as well
@@ -125,25 +121,25 @@ static CORE_ADDR first_object_file_end;
static unsigned local_symesz;
struct xcoff_symfile_info
- {
- file_ptr min_lineno_offset {}; /* Where in file lowest line#s are. */
- file_ptr max_lineno_offset {}; /* 1+last byte of line#s in file. */
+{
+ file_ptr min_lineno_offset {}; /* Where in file lowest line#s are. */
+ file_ptr max_lineno_offset {}; /* 1+last byte of line#s in file. */
- /* Pointer to the string table. */
- char *strtbl = nullptr;
+ /* Pointer to the string table. */
+ char *strtbl = nullptr;
- /* Pointer to debug section. */
- char *debugsec = nullptr;
+ /* Pointer to debug section. */
+ char *debugsec = nullptr;
- /* Pointer to the a.out symbol table. */
- char *symtbl = nullptr;
+ /* Pointer to the a.out symbol table. */
+ char *symtbl = nullptr;
- /* Number of symbols in symtbl. */
- int symtbl_num_syms = 0;
+ /* Number of symbols in symtbl. */
+ int symtbl_num_syms = 0;
- /* Offset in data section to TOC anchor. */
- CORE_ADDR toc_offset = 0;
- };
+ /* Offset in data section to TOC anchor. */
+ CORE_ADDR toc_offset = 0;
+};
/* Key for XCOFF-associated data. */
@@ -151,8 +147,7 @@ static const registry<objfile>::key<xcoff_symfile_info> xcoff_objfile_data_key;
/* Convenience macro to access the per-objfile XCOFF data. */
-#define XCOFF_DATA(objfile) \
- xcoff_objfile_data_key.get (objfile)
+#define XCOFF_DATA(objfile) xcoff_objfile_data_key.get (objfile)
/* XCOFF names for dwarf sections. There is no compressed sections. */
@@ -185,19 +180,19 @@ static const struct dwarf2_debug_sections dwarf2_xcoff_names = {
static void
bf_notfound_complaint (void)
{
- complaint (_("line numbers off, `.bf' symbol not found"));
+ complaint (_ ("line numbers off, `.bf' symbol not found"));
}
static void
ef_complaint (int arg1)
{
- complaint (_("Mismatched .ef symbol ignored starting at symnum %d"), arg1);
+ complaint (_ ("Mismatched .ef symbol ignored starting at symnum %d"), arg1);
}
static void
eb_complaint (int arg1)
{
- complaint (_("Mismatched .eb symbol ignored starting at symnum %d"), arg1);
+ complaint (_ ("Mismatched .eb symbol ignored starting at symnum %d"), arg1);
}
static void xcoff_initial_scan (struct objfile *, symfile_add_flags);
@@ -210,9 +205,8 @@ static const char *xcoff_next_symbol_text (struct objfile *);
static void record_include_begin (struct xcoff_symbol *);
-static void
-enter_line_range (struct subfile *, unsigned, unsigned,
- CORE_ADDR, CORE_ADDR, unsigned *);
+static void enter_line_range (struct subfile *, unsigned, unsigned, CORE_ADDR,
+ CORE_ADDR, unsigned *);
static void init_stringtab (bfd *, file_ptr, struct objfile *);
@@ -242,7 +236,6 @@ static void add_stab_to_list (char *, struct pending_stabs **);
static void record_include_end (struct xcoff_symbol *);
static void process_linenos (CORE_ADDR, CORE_ADDR);
-
/* Translate from a COFF section number (target_index) to a SECT_OFF_*
code. */
@@ -250,12 +243,12 @@ static int secnum_to_section (int, struct objfile *);
static asection *secnum_to_bfd_section (int, struct objfile *);
struct xcoff_find_targ_sec_arg
- {
- int targ_index;
- int *resultp;
- asection **bfd_sect;
- struct objfile *objfile;
- };
+{
+ int targ_index;
+ int *resultp;
+ asection **bfd_sect;
+ struct objfile *objfile;
+};
static void find_targ_sec (bfd *, asection *, void *);
@@ -327,7 +320,7 @@ secnum_to_bfd_section (int n_scnum, struct objfile *objfile)
xcoff_secnum_to_sections (n_scnum, objfile, &bfd_sect, &ignored);
return bfd_sect;
}
-
+
/* add a given stab string into given stab vector. */
#if 0
@@ -354,7 +347,7 @@ add_stab_to_list (char *stabname, struct pending_stabs **stabvector)
}
#endif
- /* *INDENT-OFF* */
+/* *INDENT-OFF* */
/* Linenos are processed on a file-by-file basis.
Two reasons:
@@ -408,7 +401,6 @@ add_stab_to_list (char *stabname, struct pending_stabs **stabvector)
that. */
/* *INDENT-ON* */
-
/* Given a line table with function entries are marked, arrange its
functions in ascending order and strip off function entry markers
and return it in a newly created table. */
@@ -441,8 +433,9 @@ arrange_linetable (std::vector<linetable_entry> &old_linetable)
return;
std::sort (fentries.begin (), fentries.end (),
- [] (const linetable_entry &lte1, const linetable_entry& lte2)
- { return lte1.pc < lte2.pc; });
+ [] (const linetable_entry &lte1, const linetable_entry &lte2) {
+ return lte1.pc < lte2.pc;
+ });
/* Allocate a new line table. */
std::vector<linetable_entry> new_linetable;
@@ -467,8 +460,7 @@ arrange_linetable (std::vector<linetable_entry> &old_linetable)
}
for (jj = entry.line + 1;
- jj < old_linetable.size () && old_linetable[jj].line != 0;
- ++jj)
+ jj < old_linetable.size () && old_linetable[jj].line != 0; ++jj)
new_linetable.push_back (old_linetable[jj]);
}
@@ -481,25 +473,23 @@ arrange_linetable (std::vector<linetable_entry> &old_linetable)
we will determine if we should create additional symtab's to
represent if (the include files. */
-
typedef struct _inclTable
{
- char *name; /* include filename */
+ char *name; /* include filename */
/* Offsets to the line table. end points to the last entry which is
part of this include file. */
int begin, end;
struct subfile *subfile;
- unsigned funStartLine; /* Start line # of its function. */
-}
-InclTable;
+ unsigned funStartLine; /* Start line # of its function. */
+} InclTable;
-#define INITIAL_INCLUDE_TABLE_LENGTH 20
-static InclTable *inclTable; /* global include table */
-static int inclIndx; /* last entry to table */
-static int inclLength; /* table length */
-static int inclDepth; /* nested include depth */
+#define INITIAL_INCLUDE_TABLE_LENGTH 20
+static InclTable *inclTable; /* global include table */
+static int inclIndx; /* last entry to table */
+static int inclLength; /* table length */
+static int inclDepth; /* nested include depth */
static void allocate_include_entry (void);
@@ -514,7 +504,7 @@ record_include_begin (struct xcoff_symbol *cs)
/* This can happen with old versions of GCC.
GCC 2.3.3-930426 does not exhibit this on a test case which
a user said produced the message for him. */
- complaint (_("Nested C_BINCL symbols"));
+ complaint (_ ("Nested C_BINCL symbols"));
}
++inclDepth;
@@ -531,7 +521,7 @@ record_include_end (struct xcoff_symbol *cs)
if (inclDepth == 0)
{
- complaint (_("Mismatched C_BINCL/C_EINCL pair"));
+ complaint (_ ("Mismatched C_BINCL/C_EINCL pair"));
}
allocate_include_entry ();
@@ -556,8 +546,8 @@ allocate_include_entry (void)
{
inclLength += INITIAL_INCLUDE_TABLE_LENGTH;
inclTable = XRESIZEVEC (InclTable, inclTable, inclLength);
- memset (inclTable + inclLength - INITIAL_INCLUDE_TABLE_LENGTH,
- '\0', sizeof (InclTable) * INITIAL_INCLUDE_TABLE_LENGTH);
+ memset (inclTable + inclLength - INITIAL_INCLUDE_TABLE_LENGTH, '\0',
+ sizeof (InclTable) * INITIAL_INCLUDE_TABLE_LENGTH);
}
}
@@ -575,8 +565,7 @@ static void
process_linenos (CORE_ADDR start, CORE_ADDR end)
{
int offset;
- file_ptr max_offset
- = XCOFF_DATA (this_symtab_objfile)->max_lineno_offset;
+ file_ptr max_offset = XCOFF_DATA (this_symtab_objfile)->max_lineno_offset;
/* subfile structure for the main compilation unit. */
struct subfile main_subfile;
@@ -590,8 +579,8 @@ process_linenos (CORE_ADDR start, CORE_ADDR end)
unsigned *firstLine;
- offset =
- ((struct xcoff_symloc *) this_symtab_psymtab->read_symtab_private)->lineno_off;
+ offset = ((struct xcoff_symloc *) this_symtab_psymtab->read_symtab_private)
+ ->lineno_off;
if (offset == 0)
goto return_after_cleanup;
@@ -606,8 +595,7 @@ process_linenos (CORE_ADDR start, CORE_ADDR end)
{
/* There was source with line numbers in include files. */
- int linesz =
- coff_data (this_symtab_objfile->obfd)->local_linesz;
+ int linesz = coff_data (this_symtab_objfile->obfd)->local_linesz;
main_source_baseline = 0;
for (int ii = 0; ii < inclIndx; ++ii)
@@ -615,9 +603,9 @@ process_linenos (CORE_ADDR start, CORE_ADDR end)
/* If there is main file source before include file, enter it. */
if (offset < inclTable[ii].begin)
{
- enter_line_range
- (&main_subfile, offset, inclTable[ii].begin - linesz,
- start, 0, &main_source_baseline);
+ enter_line_range (&main_subfile, offset,
+ inclTable[ii].begin - linesz, start, 0,
+ &main_source_baseline);
}
if (strcmp (inclTable[ii].name, get_last_source_file ()) == 0)
@@ -626,9 +614,9 @@ process_linenos (CORE_ADDR start, CORE_ADDR end)
file. Add the lines to the main subfile. */
main_source_baseline = inclTable[ii].funStartLine;
- enter_line_range
- (&main_subfile, inclTable[ii].begin, inclTable[ii].end,
- start, 0, &main_source_baseline);
+ enter_line_range (&main_subfile, inclTable[ii].begin,
+ inclTable[ii].end, start, 0,
+ &main_source_baseline);
inclTable[ii].subfile = &main_subfile;
}
else
@@ -730,7 +718,6 @@ aix_process_linenos (struct objfile *objfile)
process_linenos (get_last_source_start_addr (), cur_src_end_addr);
}
-
/* Enter a given range of lines into the line vector.
can be called in the following two ways:
enter_line_range (subfile, beginoffset, endoffset,
@@ -743,8 +730,8 @@ aix_process_linenos (struct objfile *objfile)
static void
enter_line_range (struct subfile *subfile, unsigned beginoffset,
- unsigned endoffset, /* offsets to line table */
- CORE_ADDR startaddr, /* offsets to line table */
+ unsigned endoffset, /* offsets to line table */
+ CORE_ADDR startaddr, /* offsets to line table */
CORE_ADDR endaddr, unsigned *firstLine)
{
struct objfile *objfile = this_symtab_objfile;
@@ -766,7 +753,7 @@ enter_line_range (struct subfile *subfile, unsigned beginoffset,
{
if (endoffset >= limit_offset)
{
- complaint (_("Bad line table offset in C_EINCL directive"));
+ complaint (_ ("Bad line table offset in C_EINCL directive"));
return;
}
limit_offset = endoffset;
@@ -785,9 +772,8 @@ enter_line_range (struct subfile *subfile, unsigned beginoffset,
bfd_coff_swap_lineno_in (abfd, ext_lnno, &int_lnno);
/* Find the address this line represents. */
- addr = (int_lnno.l_lnno
- ? int_lnno.l_addr.l_paddr
- : read_symbol_nvalue (int_lnno.l_addr.l_symndx));
+ addr = (int_lnno.l_lnno ? int_lnno.l_addr.l_paddr
+ : read_symbol_nvalue (int_lnno.l_addr.l_symndx));
addr += objfile->text_section_offset ();
if (addr < startaddr || (endaddr && addr >= endaddr))
@@ -806,16 +792,15 @@ enter_line_range (struct subfile *subfile, unsigned beginoffset,
}
}
-
/* Save the vital information for use when closing off the current file.
NAME is the file name the symbols came from, START_ADDR is the first
text address for the file, and SIZE is the number of bytes of text. */
-#define complete_symtab(name, start_addr) { \
- set_last_source_file (name); \
- set_last_source_start_addr (start_addr); \
-}
-
+#define complete_symtab(name, start_addr) \
+ { \
+ set_last_source_file (name); \
+ set_last_source_start_addr (start_addr); \
+ }
/* Refill the symbol table input buffer
and set the variables that control fetching entries from it.
@@ -840,11 +825,9 @@ enter_line_range (struct subfile *subfile, unsigned beginoffset,
OBJFILE - the objfile associated with the minimal symbol. */
static void
-record_minimal_symbol (minimal_symbol_reader &reader,
- const char *name, CORE_ADDR address,
- enum minimal_symbol_type ms_type,
- int n_scnum,
- struct objfile *objfile)
+record_minimal_symbol (minimal_symbol_reader &reader, const char *name,
+ CORE_ADDR address, enum minimal_symbol_type ms_type,
+ int n_scnum, struct objfile *objfile)
{
if (name[0] == '.')
++name;
@@ -887,7 +870,7 @@ xcoff_next_symbol_text (struct objfile *objfile)
bfd_coff_swap_sym_in (objfile->obfd.get (), raw_symbol, &symbol);
if (symbol.n_zeroes)
{
- complaint (_("Unexpected symbol continuation"));
+ complaint (_ ("Unexpected symbol continuation"));
/* Return something which points to '\0' and hope the symbol reading
code does something reasonable. */
@@ -901,7 +884,7 @@ xcoff_next_symbol_text (struct objfile *objfile)
}
else
{
- complaint (_("Unexpected symbol continuation"));
+ complaint (_ ("Unexpected symbol continuation"));
/* Return something which points to '\0' and hope the symbol reading
code does something reasonable. */
@@ -916,7 +899,7 @@ static void
read_xcoff_symtab (struct objfile *objfile, legacy_psymtab *pst)
{
bfd *abfd = objfile->obfd.get ();
- char *raw_auxptr; /* Pointer to first raw aux entry for sym. */
+ char *raw_auxptr; /* Pointer to first raw aux entry for sym. */
struct xcoff_symfile_info *xcoff = XCOFF_DATA (objfile);
char *strtbl = xcoff->strtbl;
char *debugsec = xcoff->debugsec;
@@ -938,12 +921,14 @@ read_xcoff_symtab (struct objfile *objfile, legacy_psymtab *pst)
struct xcoff_symbol fcn_stab_saved = { 0 };
/* fcn_cs_saved is global because process_xcoff_symbol needs it. */
- union internal_auxent fcn_aux_saved {};
+ union internal_auxent fcn_aux_saved
+ {
+ };
struct context_stack *newobj;
- const char *filestring = pst->filename; /* Name of the current file. */
+ const char *filestring = pst->filename; /* Name of the current file. */
- const char *last_csect_name; /* Last seen csect's name. */
+ const char *last_csect_name; /* Last seen csect's name. */
this_symtab_psymtab = pst;
this_symtab_objfile = objfile;
@@ -961,15 +946,15 @@ read_xcoff_symtab (struct objfile *objfile, legacy_psymtab *pst)
pst_symtab_language);
record_debugformat (debugfmt);
symnum = ((struct xcoff_symloc *) pst->read_symtab_private)->first_symnum;
- max_symnum =
- symnum + ((struct xcoff_symloc *) pst->read_symtab_private)->numsyms;
+ max_symnum
+ = symnum + ((struct xcoff_symloc *) pst->read_symtab_private)->numsyms;
first_object_file_end = 0;
raw_symbol = xcoff->symtbl + symnum * local_symesz;
while (symnum < max_symnum)
{
- QUIT; /* make this command interruptable. */
+ QUIT; /* make this command interruptable. */
/* READ_ONE_SYMBOL (symbol, cs, symname_alloced); */
/* read one symbol into `cs' structure. After processing the
@@ -1050,23 +1035,23 @@ read_xcoff_symtab (struct objfile *objfile, legacy_psymtab *pst)
}
start_stabs ();
- start_compunit_symtab (objfile, "_globals_", NULL,
- 0, pst_symtab_language);
+ start_compunit_symtab (objfile, "_globals_", NULL, 0,
+ pst_symtab_language);
record_debugformat (debugfmt);
cur_src_end_addr = first_object_file_end;
/* Done with all files, everything from here on is globals. */
}
- if (cs->c_sclass == C_EXT || cs->c_sclass == C_HIDEXT ||
- cs->c_sclass == C_WEAKEXT)
+ if (cs->c_sclass == C_EXT || cs->c_sclass == C_HIDEXT
+ || cs->c_sclass == C_WEAKEXT)
{
/* Dealing with a symbol with a csect entry. */
-#define CSECT(PP) ((PP)->x_csect)
-#define CSECT_LEN(PP) (CSECT(PP).x_scnlen.l)
-#define CSECT_ALIGN(PP) (SMTYP_ALIGN(CSECT(PP).x_smtyp))
-#define CSECT_SMTYP(PP) (SMTYP_SMTYP(CSECT(PP).x_smtyp))
-#define CSECT_SCLAS(PP) (CSECT(PP).x_smclas)
+#define CSECT(PP) ((PP)->x_csect)
+#define CSECT_LEN(PP) (CSECT (PP).x_scnlen.l)
+#define CSECT_ALIGN(PP) (SMTYP_ALIGN (CSECT (PP).x_smtyp))
+#define CSECT_SMTYP(PP) (SMTYP_SMTYP (CSECT (PP).x_smtyp))
+#define CSECT_SCLAS(PP) (CSECT (PP).x_smclas)
/* Convert the auxent to something we can access.
XCOFF can have more than one auxiliary entries.
@@ -1096,17 +1081,13 @@ read_xcoff_symtab (struct objfile *objfile, legacy_psymtab *pst)
}
/* Read the csect auxiliary header, which is always the last by
convention. */
- bfd_coff_swap_aux_in (abfd,
- raw_auxptr
- + ((coff_data (abfd)->local_symesz)
- * (cs->c_naux - 1)),
- cs->c_type, cs->c_sclass,
- cs->c_naux - 1, cs->c_naux,
- &main_aux);
+ bfd_coff_swap_aux_in (
+ abfd,
+ raw_auxptr + ((coff_data (abfd)->local_symesz) * (cs->c_naux - 1)),
+ cs->c_type, cs->c_sclass, cs->c_naux - 1, cs->c_naux, &main_aux);
switch (CSECT_SMTYP (&main_aux))
{
-
case XTY_ER:
/* Ignore all external references. */
continue;
@@ -1116,10 +1097,8 @@ read_xcoff_symtab (struct objfile *objfile, legacy_psymtab *pst)
{
switch (CSECT_SCLAS (&main_aux))
{
-
case XMC_PR:
{
-
/* A program csect is seen. We have to allocate one
symbol table for each program csect. Normally gdb
prefers one symtab for each source file. In case
@@ -1140,8 +1119,8 @@ read_xcoff_symtab (struct objfile *objfile, legacy_psymtab *pst)
start_stabs ();
/* Give all csects for this source file the same
name. */
- start_compunit_symtab (objfile, filestring, NULL,
- 0, pst_symtab_language);
+ start_compunit_symtab (objfile, filestring, NULL, 0,
+ pst_symtab_language);
record_debugformat (debugfmt);
}
@@ -1154,11 +1133,12 @@ read_xcoff_symtab (struct objfile *objfile, legacy_psymtab *pst)
just_started = 0;
}
- file_start_addr =
- cs->c_value + objfile->text_section_offset ();
+ file_start_addr
+ = cs->c_value + objfile->text_section_offset ();
file_end_addr = file_start_addr + CSECT_LEN (&main_aux);
- if (cs->c_name && (cs->c_name[0] == '.' || cs->c_name[0] == '@'))
+ if (cs->c_name
+ && (cs->c_name[0] == '.' || cs->c_name[0] == '@'))
last_csect_name = cs->c_name;
}
continue;
@@ -1287,9 +1267,9 @@ read_xcoff_symtab (struct objfile *objfile, legacy_psymtab *pst)
newobj = push_context (0, fcn_start_addr + off);
- newobj->name = define_symbol
- (fcn_cs_saved.c_value + off,
- fcn_stab_saved.c_name, 0, 0, objfile);
+ newobj->name
+ = define_symbol (fcn_cs_saved.c_value + off,
+ fcn_stab_saved.c_name, 0, 0, objfile);
if (newobj->name != NULL)
newobj->name->set_section_index (SECT_OFF_TEXT (objfile));
}
@@ -1304,7 +1284,7 @@ read_xcoff_symtab (struct objfile *objfile, legacy_psymtab *pst)
contains number of lines to '}' */
if (outermost_context_p ())
- { /* We attempted to pop an empty context stack. */
+ { /* We attempted to pop an empty context stack. */
ef_complaint (cs->c_symnum);
within_function = 0;
break;
@@ -1318,8 +1298,7 @@ read_xcoff_symtab (struct objfile *objfile, legacy_psymtab *pst)
break;
}
- finish_block (cstk.name, cstk.old_blocks,
- NULL, cstk.start_addr,
+ finish_block (cstk.name, cstk.old_blocks, NULL, cstk.start_addr,
(fcn_cs_saved.c_value
+ fcn_aux_saved.x_sym.x_misc.x_fsize
+ objfile->text_section_offset ()));
@@ -1334,8 +1313,8 @@ read_xcoff_symtab (struct objfile *objfile, legacy_psymtab *pst)
read_symbol (&static_symbol, cs->c_value);
static_block_base = static_symbol.n_value;
- static_block_section =
- secnum_to_section (static_symbol.n_scnum, objfile);
+ static_block_section
+ = secnum_to_section (static_symbol.n_scnum, objfile);
}
break;
@@ -1353,8 +1332,7 @@ read_xcoff_symtab (struct objfile *objfile, legacy_psymtab *pst)
case C_UNTAG:
case C_ENTAG:
{
- complaint (_("Unrecognized storage class %d."),
- cs->c_sclass);
+ complaint (_ ("Unrecognized storage class %d."), cs->c_sclass);
}
break;
@@ -1387,14 +1365,14 @@ read_xcoff_symtab (struct objfile *objfile, legacy_psymtab *pst)
if (strcmp (cs->c_name, ".bb") == 0)
{
depth++;
- newobj = push_context (depth,
- (cs->c_value
- + objfile->text_section_offset ()));
+ newobj
+ = push_context (depth, (cs->c_value
+ + objfile->text_section_offset ()));
}
else if (strcmp (cs->c_name, ".eb") == 0)
{
if (outermost_context_p ())
- { /* We attempted to pop an empty context stack. */
+ { /* We attempted to pop an empty context stack. */
eb_complaint (cs->c_symnum);
break;
}
@@ -1407,8 +1385,7 @@ read_xcoff_symtab (struct objfile *objfile, legacy_psymtab *pst)
if (*get_local_symbols () && !outermost_context_p ())
{
/* Make a block for the local symbols within. */
- finish_block (cstk.name,
- cstk.old_blocks, NULL,
+ finish_block (cstk.name, cstk.old_blocks, NULL,
cstk.start_addr,
(cs->c_value
+ objfile->text_section_offset ()));
@@ -1440,10 +1417,8 @@ read_xcoff_symtab (struct objfile *objfile, legacy_psymtab *pst)
}
}
-#define SYMNAME_ALLOC(NAME, ALLOCED) \
- ((ALLOCED) ? (NAME) : obstack_strdup (&objfile->objfile_obstack, \
- (NAME)))
-
+#define SYMNAME_ALLOC(NAME, ALLOCED) \
+ ((ALLOCED) ? (NAME) : obstack_strdup (&objfile->objfile_obstack, (NAME)))
/* process one xcoff symbol. */
@@ -1528,8 +1503,7 @@ process_xcoff_symbol (struct xcoff_symbol *cs, struct objfile *objfile)
break;
default:
- complaint (_("Unexpected storage class: %d"),
- cs->c_sclass);
+ complaint (_ ("Unexpected storage class: %d"), cs->c_sclass);
/* FALLTHROUGH */
case C_DECL:
@@ -1568,17 +1542,16 @@ process_xcoff_symbol (struct xcoff_symbol *cs, struct objfile *objfile)
++pp;
if (*pp == 'V' && !within_function)
*pp = 'S';
- sym = define_symbol ((cs->c_value
- + objfile->section_offsets[static_block_section]),
- cs->c_name, 0, 0, objfile);
+ sym = define_symbol (
+ (cs->c_value + objfile->section_offsets[static_block_section]),
+ cs->c_name, 0, 0, objfile);
if (sym != NULL)
{
- sym->set_value_address
- (sym->value_address () + static_block_base);
+ sym->set_value_address (sym->value_address ()
+ + static_block_base);
sym->set_section_index (static_block_section);
}
return sym;
-
}
}
return sym2;
@@ -1613,14 +1586,13 @@ read_symbol (struct internal_syment *symbol, int symno)
if (symno < 0 || symno >= nsyms)
{
- complaint (_("Invalid symbol offset"));
+ complaint (_ ("Invalid symbol offset"));
symbol->n_value = 0;
symbol->n_scnum = -1;
return;
}
bfd_coff_swap_sym_in (this_symtab_objfile->obfd.get (),
- stbl + (symno * local_symesz),
- symbol);
+ stbl + (symno * local_symesz), symbol);
}
/* Get value corresponding to symbol number symno in symtbl. */
@@ -1634,7 +1606,6 @@ read_symbol_nvalue (int symno)
return symbol->n_value;
}
-
/* Find the address of the function corresponding to symno, where
symno is the symbol pointed to by the linetable. */
@@ -1676,8 +1647,8 @@ read_symbol_lineno (int symno)
the duration of a single psymtab to symtab conversion. */
while (symno < nsyms)
{
- bfd_coff_swap_sym_in (symfile_bfd,
- stbl + (symno * local_symesz), symbol);
+ bfd_coff_swap_sym_in (symfile_bfd, stbl + (symno * local_symesz),
+ symbol);
if (symbol->n_sclass == C_FCN)
{
char *name = xcoff64 ? strtbl + symbol->n_offset : symbol->n_name;
@@ -1695,8 +1666,8 @@ gotit:
/* Take aux entry and return its lineno. */
symno++;
bfd_coff_swap_aux_in (objfile->obfd.get (), stbl + symno * local_symesz,
- symbol->n_type, symbol->n_sclass,
- 0, symbol->n_numaux, main_aux);
+ symbol->n_type, symbol->n_sclass, 0, symbol->n_numaux,
+ main_aux);
return main_aux->x_sym.x_misc.x_lnsz.x_lnno;
}
@@ -1730,7 +1701,7 @@ find_linenos (struct bfd *abfd, struct bfd_section *asect, void *vpinfo)
if (maxoff > info->max_lineno_offset)
info->max_lineno_offset = maxoff;
}
-
+
static void
xcoff_expand_psymtab (legacy_psymtab *pst, struct objfile *objfile)
{
@@ -1771,7 +1742,7 @@ xcoff_read_symtab (legacy_psymtab *self, struct objfile *objfile)
scan_file_globals (objfile);
}
}
-
+
static void
xcoff_new_init (struct objfile *objfile)
{
@@ -1813,7 +1784,6 @@ xcoff_symfile_finish (struct objfile *objfile)
inclIndx = inclLength = inclDepth = 0;
}
-
static void
init_stringtab (bfd *abfd, file_ptr offset, struct objfile *objfile)
{
@@ -1826,7 +1796,7 @@ init_stringtab (bfd *abfd, file_ptr offset, struct objfile *objfile)
xcoff->strtbl = NULL;
if (bfd_seek (abfd, offset, SEEK_SET) < 0)
- error (_("cannot seek to string table in %s: %s"),
+ error (_ ("cannot seek to string table in %s: %s"),
bfd_get_filename (abfd), bfd_errmsg (bfd_get_error ()));
val = bfd_bread ((char *) lengthbuf, sizeof lengthbuf, abfd);
@@ -1853,15 +1823,15 @@ init_stringtab (bfd *abfd, file_ptr offset, struct objfile *objfile)
val = bfd_bread (strtbl + sizeof lengthbuf, length - sizeof lengthbuf, abfd);
if (val != length - sizeof lengthbuf)
- error (_("cannot read string table from %s: %s"),
- bfd_get_filename (abfd), bfd_errmsg (bfd_get_error ()));
+ error (_ ("cannot read string table from %s: %s"), bfd_get_filename (abfd),
+ bfd_errmsg (bfd_get_error ()));
if (strtbl[length - 1] != '\0')
- error (_("bad symbol file: string table "
- "does not end with null character"));
+ error (_ ("bad symbol file: string table "
+ "does not end with null character"));
return;
}
-
+
/* If we have not yet seen a function for this psymtab, this is 0. If we
have seen one, it is the offset in the line numbers of the line numbers
for the psymtab. */
@@ -1875,17 +1845,17 @@ static unsigned int first_fun_line_offset;
(normal). */
static legacy_psymtab *
-xcoff_start_psymtab (psymtab_storage *partial_symtabs,
- struct objfile *objfile,
+xcoff_start_psymtab (psymtab_storage *partial_symtabs, struct objfile *objfile,
const char *filename, int first_symnum)
{
/* We fill in textlow later. */
- legacy_psymtab *result = new legacy_psymtab (filename, partial_symtabs,
- objfile->per_bfd, 0);
+ legacy_psymtab *result
+ = new legacy_psymtab (filename, partial_symtabs, objfile->per_bfd, 0);
- result->read_symtab_private =
- XOBNEW (&objfile->objfile_obstack, struct xcoff_symloc);
- ((struct xcoff_symloc *) result->read_symtab_private)->first_symnum = first_symnum;
+ result->read_symtab_private
+ = XOBNEW (&objfile->objfile_obstack, struct xcoff_symloc);
+ ((struct xcoff_symloc *) result->read_symtab_private)->first_symnum
+ = first_symnum;
result->legacy_read_symtab = xcoff_read_symtab;
result->legacy_expand_psymtab = xcoff_expand_psymtab;
@@ -1905,20 +1875,19 @@ xcoff_start_psymtab (psymtab_storage *partial_symtabs,
static legacy_psymtab *
xcoff_end_psymtab (struct objfile *objfile, psymtab_storage *partial_symtabs,
- legacy_psymtab *pst,
- const char **include_list, int num_includes,
- int capping_symbol_number,
- legacy_psymtab **dependency_list,
- int number_dependencies, int textlow_not_set)
+ legacy_psymtab *pst, const char **include_list,
+ int num_includes, int capping_symbol_number,
+ legacy_psymtab **dependency_list, int number_dependencies,
+ int textlow_not_set)
{
int i;
if (capping_symbol_number != -1)
- ((struct xcoff_symloc *) pst->read_symtab_private)->numsyms =
- capping_symbol_number
- - ((struct xcoff_symloc *) pst->read_symtab_private)->first_symnum;
- ((struct xcoff_symloc *) pst->read_symtab_private)->lineno_off =
- first_fun_line_offset;
+ ((struct xcoff_symloc *) pst->read_symtab_private)->numsyms
+ = capping_symbol_number
+ - ((struct xcoff_symloc *) pst->read_symtab_private)->first_symnum;
+ ((struct xcoff_symloc *) pst->read_symtab_private)->lineno_off
+ = first_fun_line_offset;
first_fun_line_offset = 0;
pst->end ();
@@ -1936,17 +1905,18 @@ xcoff_end_psymtab (struct objfile *objfile, psymtab_storage *partial_symtabs,
for (i = 0; i < num_includes; i++)
{
- legacy_psymtab *subpst =
- new legacy_psymtab (include_list[i], partial_symtabs, objfile->per_bfd);
+ legacy_psymtab *subpst
+ = new legacy_psymtab (include_list[i], partial_symtabs,
+ objfile->per_bfd);
- subpst->read_symtab_private = XOBNEW (&objfile->objfile_obstack, xcoff_symloc);
+ subpst->read_symtab_private
+ = XOBNEW (&objfile->objfile_obstack, xcoff_symloc);
((struct xcoff_symloc *) subpst->read_symtab_private)->first_symnum = 0;
((struct xcoff_symloc *) subpst->read_symtab_private)->numsyms = 0;
/* We could save slight bits of space by only making one of these,
shared by the entire set of include files. FIXME-someday. */
- subpst->dependencies =
- partial_symtabs->allocate_dependencies (1);
+ subpst->dependencies = partial_symtabs->allocate_dependencies (1);
subpst->dependencies[0] = pst;
subpst->number_of_dependencies = 1;
@@ -1954,9 +1924,7 @@ xcoff_end_psymtab (struct objfile *objfile, psymtab_storage *partial_symtabs,
subpst->legacy_expand_psymtab = pst->legacy_expand_psymtab;
}
- if (num_includes == 0
- && number_dependencies == 0
- && pst->empty ())
+ if (num_includes == 0 && number_dependencies == 0 && pst->empty ())
{
/* Throw away this psymtab, it's empty. */
/* Empty psymtabs happen as a result of header files which don't have
@@ -2024,17 +1992,16 @@ swap_sym (struct internal_syment *symbol, union internal_auxent *aux,
static void
function_outside_compilation_unit_complaint (const char *arg1)
{
- complaint (_("function `%s' appears to be defined "
- "outside of all compilation units"),
+ complaint (_ ("function `%s' appears to be defined "
+ "outside of all compilation units"),
arg1);
}
static void
scan_xcoff_symtab (minimal_symbol_reader &reader,
- psymtab_storage *partial_symtabs,
- struct objfile *objfile)
+ psymtab_storage *partial_symtabs, struct objfile *objfile)
{
- CORE_ADDR toc_offset = 0; /* toc offset value in data section. */
+ CORE_ADDR toc_offset = 0; /* toc offset value in data section. */
const char *filestring = NULL;
const char *namestring;
@@ -2062,21 +2029,20 @@ scan_xcoff_symtab (minimal_symbol_reader &reader,
const char *last_csect_name = NULL; /* Last seen csect's name and value. */
CORE_ADDR last_csect_val = 0;
int last_csect_sec = 0;
- int misc_func_recorded = 0; /* true if any misc. function. */
+ int misc_func_recorded = 0; /* true if any misc. function. */
int textlow_not_set = 1;
pst = (legacy_psymtab *) 0;
includes_allocated = 30;
includes_used = 0;
- psymtab_include_list = (const char **) alloca (includes_allocated *
- sizeof (const char *));
+ psymtab_include_list
+ = (const char **) alloca (includes_allocated * sizeof (const char *));
dependencies_allocated = 30;
dependencies_used = 0;
- dependency_list =
- (legacy_psymtab **) alloca (dependencies_allocated *
- sizeof (legacy_psymtab *));
+ dependency_list = (legacy_psymtab **) alloca (dependencies_allocated
+ * sizeof (legacy_psymtab *));
set_last_source_file (NULL);
@@ -2109,14 +2075,12 @@ scan_xcoff_symtab (minimal_symbol_reader &reader,
&ssymnum, objfile);
if (symbol.n_numaux > 1)
{
- bfd_coff_swap_aux_in
- (objfile->obfd.get (),
- sraw_symbol - coff_data (abfd)->local_symesz,
- symbol.n_type,
- symbol.n_sclass,
- symbol.n_numaux - 1,
- symbol.n_numaux,
- &csect_aux);
+ bfd_coff_swap_aux_in (objfile->obfd.get (),
+ sraw_symbol
+ - coff_data (abfd)->local_symesz,
+ symbol.n_type, symbol.n_sclass,
+ symbol.n_numaux - 1, symbol.n_numaux,
+ &csect_aux);
}
else
csect_aux = main_aux[0];
@@ -2141,9 +2105,9 @@ scan_xcoff_symtab (minimal_symbol_reader &reader,
if (!misc_func_recorded)
{
- record_minimal_symbol
- (reader, last_csect_name, last_csect_val,
- mst_text, last_csect_sec, objfile);
+ record_minimal_symbol (reader, last_csect_name,
+ last_csect_val, mst_text,
+ last_csect_sec, objfile);
misc_func_recorded = 1;
}
@@ -2152,25 +2116,26 @@ scan_xcoff_symtab (minimal_symbol_reader &reader,
/* We have to allocate one psymtab for
each program csect, because their text
sections need not be adjacent. */
- xcoff_end_psymtab
- (objfile, partial_symtabs, pst, psymtab_include_list,
- includes_used, symnum_before, dependency_list,
- dependencies_used, textlow_not_set);
+ xcoff_end_psymtab (objfile, partial_symtabs, pst,
+ psymtab_include_list,
+ includes_used, symnum_before,
+ dependency_list,
+ dependencies_used,
+ textlow_not_set);
includes_used = 0;
dependencies_used = 0;
/* Give all psymtabs for this source file the same
name. */
- pst = xcoff_start_psymtab
- (partial_symtabs, objfile,
- filestring,
- symnum_before);
+ pst = xcoff_start_psymtab (partial_symtabs,
+ objfile, filestring,
+ symnum_before);
}
}
/* Activate the misc_func_recorded mechanism for
compiler- and linker-generated CSECTs like ".strcmp"
- and "@FIX1". */
- if (namestring && (namestring[0] == '.'
- || namestring[0] == '@'))
+ and "@FIX1". */
+ if (namestring
+ && (namestring[0] == '.' || namestring[0] == '@'))
{
last_csect_name = namestring;
last_csect_val = symbol.n_value;
@@ -2178,8 +2143,8 @@ scan_xcoff_symtab (minimal_symbol_reader &reader,
}
if (pst != NULL)
{
- CORE_ADDR highval =
- symbol.n_value + csect_aux.x_csect.x_scnlen.l;
+ CORE_ADDR highval
+ = symbol.n_value + csect_aux.x_csect.x_scnlen.l;
if (highval > pst->raw_text_high ())
pst->set_text_high (highval);
@@ -2195,15 +2160,16 @@ scan_xcoff_symtab (minimal_symbol_reader &reader,
/* Data variables are recorded in the minimal symbol
table, except for section symbols. */
if (*namestring != '.')
- record_minimal_symbol
- (reader, namestring, symbol.n_value,
- sclass == C_HIDEXT ? mst_file_data : mst_data,
- symbol.n_scnum, objfile);
+ record_minimal_symbol (reader, namestring,
+ symbol.n_value,
+ sclass == C_HIDEXT ? mst_file_data
+ : mst_data,
+ symbol.n_scnum, objfile);
break;
case XMC_TC0:
if (toc_offset)
- warning (_("More than one XMC_TC0 symbol found."));
+ warning (_ ("More than one XMC_TC0 symbol found."));
toc_offset = symbol.n_value;
/* Make TOC offset relative to start address of
@@ -2230,13 +2196,13 @@ scan_xcoff_symtab (minimal_symbol_reader &reader,
/* A function entry point. */
if (first_fun_line_offset == 0 && symbol.n_numaux > 1)
- first_fun_line_offset =
- main_aux[0].x_sym.x_fcnary.x_fcn.x_lnnoptr;
+ first_fun_line_offset
+ = main_aux[0].x_sym.x_fcnary.x_fcn.x_lnnoptr;
- record_minimal_symbol
- (reader, namestring, symbol.n_value,
- sclass == C_HIDEXT ? mst_file_text : mst_text,
- symbol.n_scnum, objfile);
+ record_minimal_symbol (reader, namestring, symbol.n_value,
+ sclass == C_HIDEXT ? mst_file_text
+ : mst_text,
+ symbol.n_scnum, objfile);
misc_func_recorded = 1;
break;
@@ -2248,9 +2214,9 @@ scan_xcoff_symtab (minimal_symbol_reader &reader,
mst_solib_trampoline symbol. When we lookup mst
symbols, we will choose mst_text over
mst_solib_trampoline. */
- record_minimal_symbol
- (reader, namestring, symbol.n_value,
- mst_solib_trampoline, symbol.n_scnum, objfile);
+ record_minimal_symbol (reader, namestring, symbol.n_value,
+ mst_solib_trampoline,
+ symbol.n_scnum, objfile);
misc_func_recorded = 1;
break;
@@ -2270,10 +2236,11 @@ scan_xcoff_symtab (minimal_symbol_reader &reader,
typically be XMC_RW; I suspect XMC_RO and
XMC_BS might be possible too. */
if (*namestring != '.')
- record_minimal_symbol
- (reader, namestring, symbol.n_value,
- sclass == C_HIDEXT ? mst_file_data : mst_data,
- symbol.n_scnum, objfile);
+ record_minimal_symbol (reader, namestring,
+ symbol.n_value,
+ sclass == C_HIDEXT ? mst_file_data
+ : mst_data,
+ symbol.n_scnum, objfile);
break;
}
break;
@@ -2286,10 +2253,11 @@ scan_xcoff_symtab (minimal_symbol_reader &reader,
/* Common variables are recorded in the minimal symbol
table, except for section symbols. */
if (*namestring != '.')
- record_minimal_symbol
- (reader, namestring, symbol.n_value,
- sclass == C_HIDEXT ? mst_file_bss : mst_bss,
- symbol.n_scnum, objfile);
+ record_minimal_symbol (reader, namestring,
+ symbol.n_value,
+ sclass == C_HIDEXT ? mst_file_bss
+ : mst_bss,
+ symbol.n_scnum, objfile);
break;
}
break;
@@ -2322,11 +2290,10 @@ scan_xcoff_symtab (minimal_symbol_reader &reader,
if (pst)
{
- xcoff_end_psymtab (objfile, partial_symtabs,
- pst, psymtab_include_list,
- includes_used, symnum_before,
- dependency_list, dependencies_used,
- textlow_not_set);
+ xcoff_end_psymtab (objfile, partial_symtabs, pst,
+ psymtab_include_list, includes_used,
+ symnum_before, dependency_list,
+ dependencies_used, textlow_not_set);
includes_used = 0;
dependencies_used = 0;
}
@@ -2344,8 +2311,7 @@ scan_xcoff_symtab (minimal_symbol_reader &reader,
else
filestring = namestring;
- pst = xcoff_start_psymtab (partial_symtabs, objfile,
- filestring,
+ pst = xcoff_start_psymtab (partial_symtabs, objfile, filestring,
symnum_before);
last_csect_name = NULL;
}
@@ -2353,7 +2319,7 @@ scan_xcoff_symtab (minimal_symbol_reader &reader,
default:
{
- complaint (_("Storage class %d not recognized during scan"),
+ complaint (_ ("Storage class %d not recognized during scan"),
sclass);
}
/* FALLTHROUGH */
@@ -2459,9 +2425,9 @@ scan_xcoff_symtab (minimal_symbol_reader &reader,
{
const char **orig = psymtab_include_list;
- psymtab_include_list = (const char **)
- alloca ((includes_allocated *= 2) *
- sizeof (const char *));
+ psymtab_include_list
+ = (const char **) alloca ((includes_allocated *= 2)
+ * sizeof (const char *));
memcpy (psymtab_include_list, orig,
includes_used * sizeof (const char *));
}
@@ -2485,7 +2451,7 @@ scan_xcoff_symtab (minimal_symbol_reader &reader,
p = strchr (namestring, ':');
if (!p)
- continue; /* Not a debugging symbol. */
+ continue; /* Not a debugging symbol. */
/* Main processing section for debugging symbols which
the initial read through the symbol tables needs to worry
@@ -2501,10 +2467,8 @@ scan_xcoff_symtab (minimal_symbol_reader &reader,
p - namestring),
true, VAR_DOMAIN, LOC_STATIC,
SECT_OFF_DATA (objfile),
- psymbol_placement::STATIC,
- symbol.n_value,
- psymtab_language,
- partial_symtabs, objfile);
+ psymbol_placement::STATIC, symbol.n_value,
+ psymtab_language, partial_symtabs, objfile);
continue;
case 'G':
@@ -2514,10 +2478,8 @@ scan_xcoff_symtab (minimal_symbol_reader &reader,
p - namestring),
true, VAR_DOMAIN, LOC_STATIC,
SECT_OFF_DATA (objfile),
- psymbol_placement::GLOBAL,
- symbol.n_value,
- psymtab_language,
- partial_symtabs, objfile);
+ psymbol_placement::GLOBAL, symbol.n_value,
+ psymtab_language, partial_symtabs, objfile);
continue;
case 'T':
@@ -2528,38 +2490,35 @@ scan_xcoff_symtab (minimal_symbol_reader &reader,
table. We do pick up the elements of such enums at
'check_enum:', below. */
if (p >= namestring + 2
- || (p == namestring + 1
- && namestring[0] != ' '))
+ || (p == namestring + 1 && namestring[0] != ' '))
{
pst->add_psymbol (gdb::string_view (namestring,
p - namestring),
true, STRUCT_DOMAIN, LOC_TYPEDEF, -1,
- psymbol_placement::STATIC,
- 0, psymtab_language,
- partial_symtabs, objfile);
+ psymbol_placement::STATIC, 0,
+ psymtab_language, partial_symtabs,
+ objfile);
if (p[2] == 't')
{
/* Also a typedef with the same name. */
pst->add_psymbol (gdb::string_view (namestring,
p - namestring),
true, VAR_DOMAIN, LOC_TYPEDEF, -1,
- psymbol_placement::STATIC,
- 0, psymtab_language,
- partial_symtabs, objfile);
+ psymbol_placement::STATIC, 0,
+ psymtab_language, partial_symtabs,
+ objfile);
p += 1;
}
}
goto check_enum;
case 't':
- if (p != namestring) /* a name is there, not just :T... */
+ if (p != namestring) /* a name is there, not just :T... */
{
- pst->add_psymbol (gdb::string_view (namestring,
- p - namestring),
- true, VAR_DOMAIN, LOC_TYPEDEF, -1,
- psymbol_placement::STATIC,
- 0, psymtab_language,
- partial_symtabs, objfile);
+ pst->add_psymbol (
+ gdb::string_view (namestring, p - namestring), true,
+ VAR_DOMAIN, LOC_TYPEDEF, -1, psymbol_placement::STATIC,
+ 0, psymtab_language, partial_symtabs, objfile);
}
check_enum:
/* If this is an enumerated type, we need to
@@ -2579,9 +2538,8 @@ scan_xcoff_symtab (minimal_symbol_reader &reader,
p += 2;
/* This type may be given a number. Also, numbers can come
in pairs like (0,26). Skip over it. */
- while ((*p >= '0' && *p <= '9')
- || *p == '(' || *p == ',' || *p == ')'
- || *p == '=')
+ while ((*p >= '0' && *p <= '9') || *p == '(' || *p == ','
+ || *p == ')' || *p == '=')
p++;
if (*p++ == 'e')
@@ -2620,9 +2578,9 @@ scan_xcoff_symtab (minimal_symbol_reader &reader,
enum constants in psymtabs, just in symtabs. */
pst->add_psymbol (gdb::string_view (p, q - p), true,
VAR_DOMAIN, LOC_CONST, -1,
- psymbol_placement::STATIC,
- 0, psymtab_language,
- partial_symtabs, objfile);
+ psymbol_placement::STATIC, 0,
+ psymtab_language, partial_symtabs,
+ objfile);
/* Point past the name. */
p = q;
/* Skip over the value. */
@@ -2640,35 +2598,34 @@ scan_xcoff_symtab (minimal_symbol_reader &reader,
pst->add_psymbol (gdb::string_view (namestring,
p - namestring),
true, VAR_DOMAIN, LOC_CONST, -1,
- psymbol_placement::STATIC,
- 0, psymtab_language,
- partial_symtabs, objfile);
+ psymbol_placement::STATIC, 0,
+ psymtab_language, partial_symtabs, objfile);
continue;
case 'f':
- if (! pst)
+ if (!pst)
{
std::string name (namestring, (p - namestring));
- function_outside_compilation_unit_complaint (name.c_str ());
+ function_outside_compilation_unit_complaint (
+ name.c_str ());
}
pst->add_psymbol (gdb::string_view (namestring,
p - namestring),
true, VAR_DOMAIN, LOC_BLOCK,
SECT_OFF_TEXT (objfile),
- psymbol_placement::STATIC,
- symbol.n_value,
- psymtab_language,
- partial_symtabs, objfile);
+ psymbol_placement::STATIC, symbol.n_value,
+ psymtab_language, partial_symtabs, objfile);
continue;
/* Global functions were ignored here, but now they
are put into the global psymtab like one would expect.
They're also in the minimal symbol table. */
case 'F':
- if (! pst)
+ if (!pst)
{
std::string name (namestring, (p - namestring));
- function_outside_compilation_unit_complaint (name.c_str ());
+ function_outside_compilation_unit_complaint (
+ name.c_str ());
}
/* We need only the minimal symbols for these
@@ -2682,10 +2639,8 @@ scan_xcoff_symtab (minimal_symbol_reader &reader,
p - namestring),
true, VAR_DOMAIN, LOC_BLOCK,
SECT_OFF_TEXT (objfile),
- psymbol_placement::GLOBAL,
- symbol.n_value,
- psymtab_language,
- partial_symtabs, objfile);
+ psymbol_placement::GLOBAL, symbol.n_value,
+ psymtab_language, partial_symtabs, objfile);
continue;
/* Two things show up here (hopefully); static symbols of
@@ -2704,7 +2659,7 @@ scan_xcoff_symtab (minimal_symbol_reader &reader,
case '8':
case '9':
case '-':
- case '#': /* For symbol identification (used in
+ case '#': /* For symbol identification (used in
live ranges). */
continue;
@@ -2727,7 +2682,7 @@ scan_xcoff_symtab (minimal_symbol_reader &reader,
the end of every string looking for a
backslash. */
- complaint (_("unknown symbol descriptor `%c'"), p[1]);
+ complaint (_ ("unknown symbol descriptor `%c'"), p[1]);
/* Ignore it; perhaps it is an extension that we don't
know about. */
@@ -2739,9 +2694,8 @@ scan_xcoff_symtab (minimal_symbol_reader &reader,
if (pst)
{
- xcoff_end_psymtab (objfile, partial_symtabs,
- pst, psymtab_include_list, includes_used,
- ssymnum, dependency_list,
+ xcoff_end_psymtab (objfile, partial_symtabs, pst, psymtab_include_list,
+ includes_used, ssymnum, dependency_list,
dependencies_used, textlow_not_set);
}
@@ -2777,9 +2731,9 @@ xcoff_initial_scan (struct objfile *objfile, symfile_add_flags symfile_flags)
{
bfd *abfd;
int val;
- int num_symbols; /* # of symbols */
- file_ptr symtab_offset; /* symbol table and */
- file_ptr stringtab_offset; /* string table file offsets */
+ int num_symbols; /* # of symbols */
+ file_ptr symtab_offset; /* symbol table and */
+ file_ptr stringtab_offset; /* string table file offsets */
struct xcoff_symfile_info *info;
const char *name;
unsigned int size;
@@ -2788,10 +2742,10 @@ xcoff_initial_scan (struct objfile *objfile, symfile_add_flags symfile_flags)
symfile_bfd = abfd = objfile->obfd.get ();
name = objfile_name (objfile);
- num_symbols = bfd_get_symcount (abfd); /* # of symbols */
- symtab_offset = obj_sym_filepos (abfd); /* symbol table file offset */
- stringtab_offset = symtab_offset +
- num_symbols * coff_data (abfd)->local_symesz;
+ num_symbols = bfd_get_symcount (abfd); /* # of symbols */
+ symtab_offset = obj_sym_filepos (abfd); /* symbol table file offset */
+ stringtab_offset
+ = symtab_offset + num_symbols * coff_data (abfd)->local_symesz;
info->min_lineno_offset = 0;
info->max_lineno_offset = 0;
@@ -2822,7 +2776,7 @@ xcoff_initial_scan (struct objfile *objfile, symfile_add_flags symfile_flags)
if (!bfd_get_full_section_contents (abfd, secp, &debugsec))
{
- error (_("Error reading .debug section of `%s': %s"),
+ error (_ ("Error reading .debug section of `%s': %s"),
name, bfd_errmsg (bfd_get_error ()));
}
}
@@ -2835,15 +2789,15 @@ xcoff_initial_scan (struct objfile *objfile, symfile_add_flags symfile_flags)
access them randomly in read_symbol*. */
val = bfd_seek (abfd, symtab_offset, SEEK_SET);
if (val < 0)
- error (_("Error reading symbols from %s: %s"),
- name, bfd_errmsg (bfd_get_error ()));
+ error (_ ("Error reading symbols from %s: %s"), name,
+ bfd_errmsg (bfd_get_error ()));
size = coff_data (abfd)->local_symesz * num_symbols;
info->symtbl = (char *) obstack_alloc (&objfile->objfile_obstack, size);
info->symtbl_num_syms = num_symbols;
val = bfd_bread (info->symtbl, size, abfd);
if (val != size)
- perror_with_name (_("reading symbol table"));
+ perror_with_name (_ ("reading symbol table"));
scoped_free_pendings free_pending;
minimal_symbol_reader reader (objfile);
@@ -2866,10 +2820,9 @@ xcoff_initial_scan (struct objfile *objfile, symfile_add_flags symfile_flags)
if (dwarf2_has_info (objfile, &dwarf2_xcoff_names))
dwarf2_initialize_objfile (objfile);
}
-
+
static void
-xcoff_symfile_offsets (struct objfile *objfile,
- const section_addr_info &addrs)
+xcoff_symfile_offsets (struct objfile *objfile, const section_addr_info &addrs)
{
const char *first_section_name;
@@ -2895,8 +2848,7 @@ xcoff_symfile_offsets (struct objfile *objfile,
&& strcmp (first_section_name, ".data") != 0)
objfile->sect_index_data = -1;
- if (objfile->sect_index_bss == 0
- && strcmp (first_section_name, ".bss") != 0)
+ if (objfile->sect_index_bss == 0 && strcmp (first_section_name, ".bss") != 0)
objfile->sect_index_bss = -1;
if (objfile->sect_index_rodata == 0
@@ -2906,8 +2858,7 @@ xcoff_symfile_offsets (struct objfile *objfile,
/* Register our ability to parse symbols for xcoff BFD files. */
-static const struct sym_fns xcoff_sym_fns =
-{
+static const struct sym_fns xcoff_sym_fns = {
/* It is possible that coff and xcoff should be merged as
they do have fundamental similarities (for example, the extra storage
@@ -2918,15 +2869,15 @@ static const struct sym_fns xcoff_sym_fns =
xcoffread.c reads all the symbols and does in fact randomly access them
(in C_BSTAT and line number processing). */
- xcoff_new_init, /* init anything gbl to entire symtab */
- xcoff_symfile_init, /* read initial info, setup for sym_read() */
- xcoff_initial_scan, /* read a symbol file into symtab */
- xcoff_symfile_finish, /* finished with file, cleanup */
- xcoff_symfile_offsets, /* xlate offsets ext->int form */
- default_symfile_segments, /* Get segment information from a file. */
+ xcoff_new_init, /* init anything gbl to entire symtab */
+ xcoff_symfile_init, /* read initial info, setup for sym_read() */
+ xcoff_initial_scan, /* read a symbol file into symtab */
+ xcoff_symfile_finish, /* finished with file, cleanup */
+ xcoff_symfile_offsets, /* xlate offsets ext->int form */
+ default_symfile_segments, /* Get segment information from a file. */
aix_process_linenos,
- default_symfile_relocate, /* Relocate a debug section. */
- NULL, /* sym_probe_fns */
+ default_symfile_relocate, /* Relocate a debug section. */
+ NULL, /* sym_probe_fns */
};
/* Same as xcoff_get_n_import_files, but for core files. */
@@ -2940,7 +2891,7 @@ xcoff_get_core_n_import_files (bfd *abfd)
int n_entries = 0;
if (sect == NULL)
- return -1; /* Not a core file. */
+ return -1; /* Not a core file. */
for (offset = 0; offset < bfd_section_size (sect);)
{
@@ -2952,7 +2903,7 @@ xcoff_get_core_n_import_files (bfd *abfd)
return -1;
next = bfd_get_32 (abfd, buf);
if (next == 0)
- break; /* This is the last entry. */
+ break; /* This is the last entry. */
offset += next;
}
@@ -2991,6 +2942,7 @@ xcoff_get_n_import_files (bfd *abfd)
}
void _initialize_xcoffread ();
+
void
_initialize_xcoffread ()
{
diff --git a/gdb/xml-support.c b/gdb/xml-support.c
index 255c10864c5..56344fa3d68 100644
--- a/gdb/xml-support.c
+++ b/gdb/xml-support.c
@@ -49,7 +49,8 @@ struct scope_level
: elements (elements_),
element (NULL),
seen (0)
- {}
+ {
+ }
/* Elements we allow at this level. */
const struct gdb_xml_element *elements;
@@ -68,18 +69,16 @@ struct scope_level
/* The parser itself, and our additional state. */
struct gdb_xml_parser
{
- gdb_xml_parser (const char *name,
- const gdb_xml_element *elements,
+ gdb_xml_parser (const char *name, const gdb_xml_element *elements,
void *user_data);
- ~gdb_xml_parser();
+ ~gdb_xml_parser ();
/* Associate DTD_NAME, which must be the name of a compiled-in DTD,
with the parser. */
void use_dtd (const char *dtd_name);
/* Return the name of the expected / default DTD, if specified. */
- const char *dtd_name ()
- { return m_dtd_name; }
+ const char *dtd_name () { return m_dtd_name; }
/* Invoke the parser on BUFFER. BUFFER is the data to parse, which
should be NUL-terminated.
@@ -90,28 +89,24 @@ struct gdb_xml_parser
int parse (const char *buffer);
/* Issue a debugging message. */
- void vdebug (const char *format, va_list ap)
- ATTRIBUTE_PRINTF (2, 0);
+ void vdebug (const char *format, va_list ap) ATTRIBUTE_PRINTF (2, 0);
/* Issue an error message, and stop parsing. */
- void verror (const char *format, va_list ap)
- ATTRIBUTE_NORETURN ATTRIBUTE_PRINTF (2, 0);
+ void verror (const char *format, va_list ap) ATTRIBUTE_NORETURN
+ ATTRIBUTE_PRINTF (2, 0);
void body_text (const XML_Char *text, int length);
void start_element (const XML_Char *name, const XML_Char **attrs);
void end_element (const XML_Char *name);
/* Return the name of this parser. */
- const char *name ()
- { return m_name; }
+ const char *name () { return m_name; }
/* Return the user's callback data, for handlers. */
- void *user_data ()
- { return m_user_data; };
+ void *user_data () { return m_user_data; };
/* Are we the special <xi:include> parser? */
- void set_is_xinclude (bool is_xinclude)
- { m_is_xinclude = is_xinclude; }
+ void set_is_xinclude (bool is_xinclude) { m_is_xinclude = is_xinclude; }
/* A thrown error, if any. */
void set_error (gdb_exception &&error)
@@ -123,10 +118,10 @@ struct gdb_xml_parser
}
/* Return the underlying expat parser. */
- XML_Parser expat_parser ()
- { return m_expat_parser; }
+ XML_Parser expat_parser () { return m_expat_parser; }
private:
+
/* The underlying expat parser. */
XML_Parser m_expat_parser;
@@ -139,7 +134,7 @@ private:
/* Scoping stack. */
std::vector<scope_level> m_scopes;
-/* A thrown error, if any. */
+ /* A thrown error, if any. */
struct gdb_exception m_error;
/* The line of the thrown error, or 0. */
@@ -183,11 +178,10 @@ gdb_xml_parser::vdebug (const char *format, va_list ap)
std::string message = string_vprintf (format, ap);
if (line)
- gdb_printf (gdb_stderr, "%s (line %d): %s\n",
- m_name, line, message.c_str ());
+ gdb_printf (gdb_stderr, "%s (line %d): %s\n", m_name, line,
+ message.c_str ());
else
- gdb_printf (gdb_stderr, "%s: %s\n",
- m_name, message.c_str ());
+ gdb_printf (gdb_stderr, "%s: %s\n", m_name, message.c_str ());
}
void
@@ -227,8 +221,7 @@ gdb_xml_error (struct gdb_xml_parser *parser, const char *format, ...)
ATTRIBUTES. Returns NULL if not found. */
struct gdb_xml_value *
-xml_find_attribute (std::vector<gdb_xml_value> &attributes,
- const char *name)
+xml_find_attribute (std::vector<gdb_xml_value> &attributes, const char *name)
{
for (gdb_xml_value &value : attributes)
if (strcmp (value.name, name) == 0)
@@ -241,8 +234,7 @@ xml_find_attribute (std::vector<gdb_xml_value> &attributes,
the names and values of this element's attributes. */
void
-gdb_xml_parser::start_element (const XML_Char *name,
- const XML_Char **attrs)
+gdb_xml_parser::start_element (const XML_Char *name, const XML_Char **attrs)
{
if (m_error.reason < 0)
return;
@@ -264,7 +256,7 @@ gdb_xml_parser::start_element (const XML_Char *name,
/* Get a reference to the current scope. */
scope_level &scope = m_scopes[m_scopes.size () - 2];
- gdb_xml_debug (this, _("Entering element <%s>"), name);
+ gdb_xml_debug (this, _ ("Entering element <%s>"), name);
/* Find this element in the list of the current scope's allowed
children. Record that we've seen it. */
@@ -289,20 +281,19 @@ gdb_xml_parser::start_element (const XML_Char *name,
return;
}
- gdb_xml_debug (this, _("Element <%s> unknown"), name);
+ gdb_xml_debug (this, _ ("Element <%s> unknown"), name);
return;
}
if (!(element->flags & GDB_XML_EF_REPEATABLE) && (seen & scope.seen))
- gdb_xml_error (this, _("Element <%s> only expected once"), name);
+ gdb_xml_error (this, _ ("Element <%s> only expected once"), name);
scope.seen |= seen;
std::vector<gdb_xml_value> attributes;
for (attribute = element->attributes;
- attribute != NULL && attribute->name != NULL;
- attribute++)
+ attribute != NULL && attribute->name != NULL; attribute++)
{
const char *val = NULL;
const XML_Char **p;
@@ -317,15 +308,16 @@ gdb_xml_parser::start_element (const XML_Char *name,
if (*p != NULL && val == NULL)
{
- gdb_xml_debug (this, _("Attribute \"%s\" missing a value"),
+ gdb_xml_debug (this, _ ("Attribute \"%s\" missing a value"),
attribute->name);
continue;
}
if (*p == NULL && !(attribute->flags & GDB_XML_AF_OPTIONAL))
{
- gdb_xml_error (this, _("Required attribute \"%s\" of "
- "<%s> not specified"),
+ gdb_xml_error (this,
+ _ ("Required attribute \"%s\" of "
+ "<%s> not specified"),
attribute->name, element->name);
continue;
}
@@ -333,8 +325,8 @@ gdb_xml_parser::start_element (const XML_Char *name,
if (*p == NULL)
continue;
- gdb_xml_debug (this, _("Parsing attribute %s=\"%s\""),
- attribute->name, val);
+ gdb_xml_debug (this, _ ("Parsing attribute %s=\"%s\""), attribute->name,
+ val);
if (attribute->handler)
parsed_value = attribute->handler (this, attribute, val);
@@ -352,13 +344,12 @@ gdb_xml_parser::start_element (const XML_Char *name,
for (p = attrs; *p != NULL; p += 2)
{
for (attribute = element->attributes;
- attribute != NULL && attribute->name != NULL;
- attribute++)
+ attribute != NULL && attribute->name != NULL; attribute++)
if (strcmp (attribute->name, *p) == 0)
break;
if (attribute == NULL || attribute->name == NULL)
- gdb_xml_debug (this, _("Ignoring unknown attribute %s"), *p);
+ gdb_xml_debug (this, _ ("Ignoring unknown attribute %s"), *p);
}
}
@@ -406,14 +397,13 @@ gdb_xml_parser::end_element (const XML_Char *name)
const struct gdb_xml_element *element;
unsigned int seen;
- gdb_xml_debug (this, _("Leaving element <%s>"), name);
+ gdb_xml_debug (this, _ ("Leaving element <%s>"), name);
for (element = scope->elements, seen = 1;
- element != NULL && element->name != NULL;
- element++, seen <<= 1)
+ element != NULL && element->name != NULL; element++, seen <<= 1)
if ((scope->seen & seen) == 0
&& (element->flags & GDB_XML_EF_OPTIONAL) == 0)
- gdb_xml_error (this, _("Required element <%s> is missing"),
+ gdb_xml_error (this, _ ("Required element <%s> is missing"),
element->name);
/* Call the element processor. */
@@ -438,8 +428,7 @@ gdb_xml_parser::end_element (const XML_Char *name)
body++;
}
- scope->element->end_handler (this, scope->element,
- m_user_data, body);
+ scope->element->end_handler (this, scope->element, m_user_data, body);
}
else if (scope->element == NULL)
XML_DefaultCurrent (m_expat_parser);
@@ -505,8 +494,7 @@ gdb_xml_parser::gdb_xml_parser (const char *name,
static int XMLCALL
gdb_xml_fetch_external_entity (XML_Parser expat_parser,
- const XML_Char *context,
- const XML_Char *base,
+ const XML_Char *context, const XML_Char *base,
const XML_Char *systemId,
const XML_Char *publicId)
{
@@ -521,7 +509,7 @@ gdb_xml_fetch_external_entity (XML_Parser expat_parser,
text = fetch_xml_builtin (parser->dtd_name ());
if (text == NULL)
- internal_error (_("could not locate built-in DTD %s"),
+ internal_error (_ ("could not locate built-in DTD %s"),
parser->dtd_name ());
}
else
@@ -531,8 +519,7 @@ gdb_xml_fetch_external_entity (XML_Parser expat_parser,
return XML_STATUS_ERROR;
}
- entity_parser = XML_ExternalEntityParserCreate (expat_parser,
- context, NULL);
+ entity_parser = XML_ExternalEntityParserCreate (expat_parser, context, NULL);
/* Don't use our handlers for the contents of the DTD. Just let expat
process it. */
@@ -563,8 +550,7 @@ gdb_xml_parser::use_dtd (const char *dtd_name)
/* Even if no DTD is provided, use the built-in DTD anyway. */
err = XML_UseForeignDTD (m_expat_parser, XML_TRUE);
if (err != XML_ERROR_NONE)
- internal_error (_("XML_UseForeignDTD failed: %s"),
- XML_ErrorString (err));
+ internal_error (_ ("XML_UseForeignDTD failed: %s"), XML_ErrorString (err));
}
/* Invoke PARSER on BUFFER. BUFFER is the data to parse, which
@@ -580,15 +566,14 @@ gdb_xml_parser::parse (const char *buffer)
enum XML_Status status;
const char *error_string;
- gdb_xml_debug (this, _("Starting:\n%s"), buffer);
+ gdb_xml_debug (this, _ ("Starting:\n%s"), buffer);
status = XML_Parse (m_expat_parser, buffer, strlen (buffer), 1);
if (status == XML_STATUS_OK && m_error.reason == 0)
return 0;
- if (m_error.reason == RETURN_ERROR
- && m_error.error == XML_PARSE_ERROR)
+ if (m_error.reason == RETURN_ERROR && m_error.error == XML_PARSE_ERROR)
{
gdb_assert (m_error.message != NULL);
error_string = m_error.what ();
@@ -606,10 +591,10 @@ gdb_xml_parser::parse (const char *buffer)
}
if (m_last_line != 0)
- warning (_("while parsing %s (at line %d): %s"), m_name,
- m_last_line, error_string);
+ warning (_ ("while parsing %s (at line %d): %s"), m_name, m_last_line,
+ error_string);
else
- warning (_("while parsing %s: %s"), m_name, error_string);
+ warning (_ ("while parsing %s: %s"), m_name, error_string);
return -1;
}
@@ -657,7 +642,7 @@ gdb_xml_parse_ulongest (struct gdb_xml_parser *parser, const char *value)
ULONGEST result;
if (xml_parse_unsigned_integer (value, &result) != 0)
- gdb_xml_error (parser, _("Can't convert \"%s\" to an integer"), value);
+ gdb_xml_error (parser, _ ("Can't convert \"%s\" to an integer"), value);
return result;
}
@@ -673,7 +658,7 @@ gdb_xml_parse_attr_ulongest (struct gdb_xml_parser *parser,
void *ret;
if (xml_parse_unsigned_integer (value, &result) != 0)
- gdb_xml_error (parser, _("Can't convert %s=\"%s\" to an integer"),
+ gdb_xml_error (parser, _ ("Can't convert %s=\"%s\" to an integer"),
attribute->name, value);
ret = XNEW (ULONGEST);
@@ -683,11 +668,8 @@ gdb_xml_parse_attr_ulongest (struct gdb_xml_parser *parser,
/* A handler_data for yes/no boolean values. */
-const struct gdb_xml_enum gdb_xml_enums_boolean[] = {
- { "yes", 1 },
- { "no", 0 },
- { NULL, 0 }
-};
+const struct gdb_xml_enum gdb_xml_enums_boolean[]
+ = { { "yes", 1 }, { "no", 0 }, { NULL, 0 } };
/* Map NAME to VALUE. A struct gdb_xml_enum * should be saved as the
value of handler_data when using gdb_xml_parse_attr_enum to parse a
@@ -709,14 +691,13 @@ gdb_xml_parse_attr_enum (struct gdb_xml_parser *parser,
break;
if (enums->name == NULL)
- gdb_xml_error (parser, _("Unknown attribute value %s=\"%s\""),
- attribute->name, value);
+ gdb_xml_error (parser, _ ("Unknown attribute value %s=\"%s\""),
+ attribute->name, value);
ret = xmalloc (sizeof (enums->value));
memcpy (ret, &enums->value, sizeof (enums->value));
return ret;
}
-
/* XInclude processing. This is done as a separate step from actually
parsing the document, so that we can produce a single combined XML
@@ -742,14 +723,14 @@ gdb_xml_parse_attr_enum (struct gdb_xml_parser *parser,
struct xinclude_parsing_data
{
- xinclude_parsing_data (std::string &output_,
- xml_fetch_another fetcher_,
+ xinclude_parsing_data (std::string &output_, xml_fetch_another fetcher_,
int include_depth_)
: output (output_),
skip_depth (0),
include_depth (include_depth_),
fetcher (fetcher_)
- {}
+ {
+ }
/* Where the output goes. */
std::string &output;
@@ -771,36 +752,34 @@ struct xinclude_parsing_data
static void
xinclude_start_include (struct gdb_xml_parser *parser,
- const struct gdb_xml_element *element,
- void *user_data,
+ const struct gdb_xml_element *element, void *user_data,
std::vector<gdb_xml_value> &attributes)
{
struct xinclude_parsing_data *data
= (struct xinclude_parsing_data *) user_data;
char *href = (char *) xml_find_attribute (attributes, "href")->value.get ();
- gdb_xml_debug (parser, _("Processing XInclude of \"%s\""), href);
+ gdb_xml_debug (parser, _ ("Processing XInclude of \"%s\""), href);
if (data->include_depth > MAX_XINCLUDE_DEPTH)
- gdb_xml_error (parser, _("Maximum XInclude depth (%d) exceeded"),
+ gdb_xml_error (parser, _ ("Maximum XInclude depth (%d) exceeded"),
MAX_XINCLUDE_DEPTH);
gdb::optional<gdb::char_vector> text = data->fetcher (href);
if (!text)
- gdb_xml_error (parser, _("Could not load XML document \"%s\""), href);
+ gdb_xml_error (parser, _ ("Could not load XML document \"%s\""), href);
- if (!xml_process_xincludes (data->output, parser->name (),
- text->data (), data->fetcher,
- data->include_depth + 1))
- gdb_xml_error (parser, _("Parsing \"%s\" failed"), href);
+ if (!xml_process_xincludes (data->output, parser->name (), text->data (),
+ data->fetcher, data->include_depth + 1))
+ gdb_xml_error (parser, _ ("Parsing \"%s\" failed"), href);
data->skip_depth++;
}
static void
xinclude_end_include (struct gdb_xml_parser *parser,
- const struct gdb_xml_element *element,
- void *user_data, const char *body_text)
+ const struct gdb_xml_element *element, void *user_data,
+ const char *body_text)
{
struct xinclude_parsing_data *data
= (struct xinclude_parsing_data *) user_data;
@@ -855,23 +834,20 @@ xml_xinclude_xml_decl (void *data_, const XML_Char *version,
output. */
}
-const struct gdb_xml_attribute xinclude_attributes[] = {
- { "href", GDB_XML_AF_NONE, NULL, NULL },
- { NULL, GDB_XML_AF_NONE, NULL, NULL }
-};
+const struct gdb_xml_attribute xinclude_attributes[]
+ = { { "href", GDB_XML_AF_NONE, NULL, NULL },
+ { NULL, GDB_XML_AF_NONE, NULL, NULL } };
-const struct gdb_xml_element xinclude_elements[] = {
- { "http://www.w3.org/2001/XInclude!include", xinclude_attributes, NULL,
- GDB_XML_EF_OPTIONAL | GDB_XML_EF_REPEATABLE,
- xinclude_start_include, xinclude_end_include },
- { NULL, NULL, NULL, GDB_XML_EF_NONE, NULL, NULL }
-};
+const struct gdb_xml_element xinclude_elements[]
+ = { { "http://www.w3.org/2001/XInclude!include", xinclude_attributes, NULL,
+ GDB_XML_EF_OPTIONAL | GDB_XML_EF_REPEATABLE, xinclude_start_include,
+ xinclude_end_include },
+ { NULL, NULL, NULL, GDB_XML_EF_NONE, NULL, NULL } };
/* The main entry point for <xi:include> processing. */
bool
-xml_process_xincludes (std::string &result,
- const char *name, const char *text,
+xml_process_xincludes (std::string &result, const char *name, const char *text,
xml_fetch_another fetcher, int depth)
{
xinclude_parsing_data data (result, fetcher, depth);
@@ -898,14 +874,13 @@ xml_process_xincludes (std::string &result,
if (parser.parse (text) == 0)
{
if (depth == 0)
- gdb_xml_debug (&parser, _("XInclude processing succeeded."));
+ gdb_xml_debug (&parser, _ ("XInclude processing succeeded."));
return true;
}
return false;
}
#endif /* HAVE_LIBEXPAT */
-
/* Return an XML document which was compiled into GDB, from
the given FILENAME, or NULL if the file was not compiled in. */
@@ -928,9 +903,9 @@ fetch_xml_builtin (const char *filename)
appropriate filename. */
LONGEST
-xml_builtin_xfer_partial (const char *filename,
- gdb_byte *readbuf, const gdb_byte *writebuf,
- ULONGEST offset, LONGEST len)
+xml_builtin_xfer_partial (const char *filename, gdb_byte *readbuf,
+ const gdb_byte *writebuf, ULONGEST offset,
+ LONGEST len)
{
const char *buf;
LONGEST len_avail;
@@ -951,13 +926,12 @@ xml_builtin_xfer_partial (const char *filename,
memcpy (readbuf, buf + offset, len);
return len;
}
-
static void
-show_debug_xml (struct ui_file *file, int from_tty,
- struct cmd_list_element *c, const char *value)
+show_debug_xml (struct ui_file *file, int from_tty, struct cmd_list_element *c,
+ const char *value)
{
- gdb_printf (file, _("XML debugging is %s.\n"), value);
+ gdb_printf (file, _ ("XML debugging is %s.\n"), value);
}
gdb::optional<gdb::char_vector>
@@ -967,8 +941,8 @@ xml_fetch_content_from_file (const char *filename, const char *dirname)
if (dirname != nullptr && *dirname != '\0')
{
- gdb::unique_xmalloc_ptr<char> fullname
- (concat (dirname, "/", filename, (char *) NULL));
+ gdb::unique_xmalloc_ptr<char> fullname (concat (dirname, "/", filename,
+ (char *) NULL));
file = gdb_fopen_cloexec (fullname.get (), FOPEN_RB);
}
@@ -983,16 +957,15 @@ xml_fetch_content_from_file (const char *filename, const char *dirname)
size_t len;
if (fseek (file.get (), 0, SEEK_END) == -1)
- perror_with_name (_("seek to end of file"));
+ perror_with_name (_ ("seek to end of file"));
len = ftell (file.get ());
rewind (file.get ());
gdb::char_vector text (len + 1);
- if (fread (text.data (), 1, len, file.get ()) != len
- || ferror (file.get ()))
+ if (fread (text.data (), 1, len, file.get ()) != len || ferror (file.get ()))
{
- warning (_("Read error from \"%s\""), filename);
+ warning (_ ("Read error from \"%s\""), filename);
return {};
}
@@ -1002,14 +975,15 @@ xml_fetch_content_from_file (const char *filename, const char *dirname)
void _initialize_xml_support ();
void _initialize_xml_support ();
+
void
_initialize_xml_support ()
{
add_setshow_boolean_cmd ("xml", class_maintenance, &debug_xml,
- _("Set XML parser debugging."),
- _("Show XML parser debugging."),
- _("When set, debugging messages for XML parsers "
- "are displayed."),
- NULL, show_debug_xml,
- &setdebuglist, &showdebuglist);
+ _ ("Set XML parser debugging."),
+ _ ("Show XML parser debugging."),
+ _ ("When set, debugging messages for XML parsers "
+ "are displayed."),
+ NULL, show_debug_xml, &setdebuglist,
+ &showdebuglist);
}
diff --git a/gdb/xml-support.h b/gdb/xml-support.h
index 1f9ac68b745..afd2f46dfdd 100644
--- a/gdb/xml-support.h
+++ b/gdb/xml-support.h
@@ -17,7 +17,6 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
-
#ifndef XML_SUPPORT_H
#define XML_SUPPORT_H
@@ -41,16 +40,16 @@ const char *fetch_xml_builtin (const char *filename);
to_xfer_partial handler, after converting object and annex to the
appropriate filename. */
-LONGEST xml_builtin_xfer_partial (const char *filename,
- gdb_byte *readbuf, const gdb_byte *writebuf,
- ULONGEST offset, LONGEST len);
+LONGEST xml_builtin_xfer_partial (const char *filename, gdb_byte *readbuf,
+ const gdb_byte *writebuf, ULONGEST offset,
+ LONGEST len);
/* Support for XInclude. */
/* Callback to fetch a new XML file, based on the provided HREF. */
-using xml_fetch_another = gdb::function_view<gdb::optional<gdb::char_vector>
- (const char * /* href */)>;
+using xml_fetch_another = gdb::function_view<
+ gdb::optional<gdb::char_vector> (const char * /* href */)>;
/* Append the expansion of TEXT after processing <xi:include> tags in
RESULT. FETCHER will be called to retrieve any new files. DEPTH
@@ -60,9 +59,9 @@ using xml_fetch_another = gdb::function_view<gdb::optional<gdb::char_vector>
It may throw an exception, but does not for XML parsing
problems. */
-bool xml_process_xincludes (std::string &result,
- const char *name, const char *text,
- xml_fetch_another fetcher, int depth);
+bool xml_process_xincludes (std::string &result, const char *name,
+ const char *text, xml_fetch_another fetcher,
+ int depth);
/* Simplified XML parser infrastructure. */
@@ -71,8 +70,10 @@ bool xml_process_xincludes (std::string &result,
struct gdb_xml_value
{
gdb_xml_value (const char *name_, void *value_)
- : name (name_), value (value_)
- {}
+ : name (name_),
+ value (value_)
+ {
+ }
const char *name;
gdb::unique_xmalloc_ptr<void> value;
@@ -102,7 +103,7 @@ typedef void *(gdb_xml_attribute_handler) (struct gdb_xml_parser *parser,
enum gdb_xml_attribute_flag
{
GDB_XML_AF_NONE,
- GDB_XML_AF_OPTIONAL = 1 << 0, /* The attribute is optional. */
+ GDB_XML_AF_OPTIONAL = 1 << 0, /* The attribute is optional. */
};
/* An expected attribute and the handler to call when it is
@@ -123,8 +124,8 @@ struct gdb_xml_attribute
enum gdb_xml_element_flag
{
GDB_XML_EF_NONE,
- GDB_XML_EF_OPTIONAL = 1 << 0, /* The element is optional. */
- GDB_XML_EF_REPEATABLE = 1 << 1, /* The element is repeatable. */
+ GDB_XML_EF_OPTIONAL = 1 << 0, /* The element is optional. */
+ GDB_XML_EF_REPEATABLE = 1 << 1, /* The element is repeatable. */
};
/* A handler called at the beginning of an element.
@@ -142,9 +143,9 @@ enum gdb_xml_element_flag
fixed offsets can be used to find any non-optional attributes as
long as no optional attributes precede them. */
-typedef void (gdb_xml_element_start_handler)
- (struct gdb_xml_parser *parser, const struct gdb_xml_element *element,
- void *user_data, std::vector<gdb_xml_value> &attributes);
+typedef void (gdb_xml_element_start_handler) (
+ struct gdb_xml_parser *parser, const struct gdb_xml_element *element,
+ void *user_data, std::vector<gdb_xml_value> &attributes);
/* A handler called at the end of an element.
@@ -152,9 +153,10 @@ typedef void (gdb_xml_element_start_handler)
is any accumulated body text inside the element, with leading and
trailing whitespace removed. It will never be NULL. */
-typedef void (gdb_xml_element_end_handler)
- (struct gdb_xml_parser *, const struct gdb_xml_element *,
- void *user_data, const char *body_text);
+typedef void (gdb_xml_element_end_handler) (struct gdb_xml_parser *,
+ const struct gdb_xml_element *,
+ void *user_data,
+ const char *body_text);
/* An expected element and the handlers to call when it is
encountered. Arrays of struct gdb_xml_element are terminated
@@ -191,14 +193,14 @@ void gdb_xml_debug (struct gdb_xml_parser *parser, const char *format, ...)
/* Issue an error message from one of PARSER's handlers, and stop
parsing. */
-void gdb_xml_error (struct gdb_xml_parser *parser, const char *format, ...)
- ATTRIBUTE_NORETURN ATTRIBUTE_PRINTF (2, 3);
+void gdb_xml_error (struct gdb_xml_parser *parser, const char *format,
+ ...) ATTRIBUTE_NORETURN ATTRIBUTE_PRINTF (2, 3);
/* Find the attribute named NAME in the set of parsed attributes
ATTRIBUTES. Returns NULL if not found. */
-struct gdb_xml_value *xml_find_attribute
- (std::vector<gdb_xml_value> &attributes, const char *name);
+struct gdb_xml_value *
+xml_find_attribute (std::vector<gdb_xml_value> &attributes, const char *name);
/* Parse an integer attribute into a ULONGEST. */
@@ -230,7 +232,7 @@ ULONGEST gdb_xml_parse_ulongest (struct gdb_xml_parser *parser,
the text. If something goes wrong, return an uninstantiated optional
and warn. */
-extern gdb::optional<gdb::char_vector> xml_fetch_content_from_file
- (const char *filename, const char *dirname);
+extern gdb::optional<gdb::char_vector>
+xml_fetch_content_from_file (const char *filename, const char *dirname);
#endif
diff --git a/gdb/xml-syscall.c b/gdb/xml-syscall.c
index da1211ef8e9..04a50780164 100644
--- a/gdb/xml-syscall.c
+++ b/gdb/xml-syscall.c
@@ -41,8 +41,8 @@ syscall_warn_user (void)
if (!have_warned)
{
have_warned = 1;
- warning (_("Can not parse XML syscalls information; XML support was "
- "disabled at compile time."));
+ warning (_ ("Can not parse XML syscalls information; XML support was "
+ "disabled at compile time."));
}
}
@@ -53,8 +53,8 @@ set_xml_syscall_file_name (struct gdbarch *gdbarch, const char *name)
}
void
-get_syscall_by_number (struct gdbarch *gdbarch,
- int syscall_number, struct syscall *s)
+get_syscall_by_number (struct gdbarch *gdbarch, int syscall_number,
+ struct syscall *s)
{
syscall_warn_user ();
s->number = syscall_number;
@@ -97,8 +97,11 @@ get_syscall_group_names (struct gdbarch *gdbarch)
struct syscall_desc
{
syscall_desc (int number_, std::string name_, std::string alias_)
- : number (number_), name (name_), alias (alias_)
- {}
+ : number (number_),
+ name (name_),
+ alias (alias_)
+ {
+ }
/* The syscall number. */
@@ -119,8 +122,9 @@ typedef std::unique_ptr<syscall_desc> syscall_desc_up;
struct syscall_group_desc
{
syscall_group_desc (const std::string &name_)
- : name (name_)
- {}
+ : name (name_)
+ {
+ }
/* The group name. */
@@ -180,8 +184,7 @@ syscall_group_create_syscall_group_desc (struct syscalls_info *syscalls_info,
static void
syscall_group_add_syscall (struct syscalls_info *syscalls_info,
- struct syscall_desc *syscall,
- const char *group)
+ struct syscall_desc *syscall, const char *group)
{
/* Search for an existing group. */
std::vector<syscall_group_desc_up>::iterator it
@@ -201,8 +204,8 @@ syscall_group_add_syscall (struct syscalls_info *syscalls_info,
{
/* No group was found with this name. We must create a new
one. */
- groupdesc = syscall_group_create_syscall_group_desc (syscalls_info,
- group);
+ groupdesc
+ = syscall_group_create_syscall_group_desc (syscalls_info, group);
}
groupdesc->syscalls.push_back (syscall);
@@ -213,8 +216,8 @@ syscall_create_syscall_desc (struct syscalls_info *syscalls_info,
const char *name, int number, const char *alias,
char *groups)
{
- syscall_desc *sysdesc = new syscall_desc (number, name,
- alias != NULL ? alias : "");
+ syscall_desc *sysdesc
+ = new syscall_desc (number, name, alias != NULL ? alias : "");
syscalls_info->syscalls.emplace_back (sysdesc);
@@ -222,8 +225,7 @@ syscall_create_syscall_desc (struct syscalls_info *syscalls_info,
if (groups != NULL)
{
char *saveptr;
- for (char *group = strtok_r (groups, ",", &saveptr);
- group != NULL;
+ for (char *group = strtok_r (groups, ",", &saveptr); group != NULL;
group = strtok_r (NULL, ",", &saveptr))
syscall_group_add_syscall (syscalls_info, sysdesc, group);
}
@@ -232,11 +234,11 @@ syscall_create_syscall_desc (struct syscalls_info *syscalls_info,
/* Handle the start of a <syscall> element. */
static void
syscall_start_syscall (struct gdb_xml_parser *parser,
- const struct gdb_xml_element *element,
- void *user_data,
+ const struct gdb_xml_element *element, void *user_data,
std::vector<gdb_xml_value> &attributes)
{
- struct syscall_parsing_data *data = (struct syscall_parsing_data *) user_data;
+ struct syscall_parsing_data *data
+ = (struct syscall_parsing_data *) user_data;
/* syscall info. */
char *name = NULL;
int number = 0;
@@ -248,13 +250,13 @@ syscall_start_syscall (struct gdb_xml_parser *parser,
if (strcmp (attr.name, "name") == 0)
name = (char *) attr.value.get ();
else if (strcmp (attr.name, "number") == 0)
- number = * (ULONGEST *) attr.value.get ();
+ number = *(ULONGEST *) attr.value.get ();
else if (strcmp (attr.name, "alias") == 0)
alias = (char *) attr.value.get ();
else if (strcmp (attr.name, "groups") == 0)
groups = (char *) attr.value.get ();
else
- internal_error (_("Unknown attribute name '%s'."), attr.name);
+ internal_error (_ ("Unknown attribute name '%s'."), attr.name);
}
gdb_assert (name);
@@ -262,28 +264,24 @@ syscall_start_syscall (struct gdb_xml_parser *parser,
groups);
}
-
/* The elements and attributes of an XML syscall document. */
-static const struct gdb_xml_attribute syscall_attr[] = {
- { "number", GDB_XML_AF_NONE, gdb_xml_parse_attr_ulongest, NULL },
- { "name", GDB_XML_AF_NONE, NULL, NULL },
- { "alias", GDB_XML_AF_OPTIONAL, NULL, NULL },
- { "groups", GDB_XML_AF_OPTIONAL, NULL, NULL },
- { NULL, GDB_XML_AF_NONE, NULL, NULL }
-};
-
-static const struct gdb_xml_element syscalls_info_children[] = {
- { "syscall", syscall_attr, NULL,
- GDB_XML_EF_OPTIONAL | GDB_XML_EF_REPEATABLE,
- syscall_start_syscall, NULL },
- { NULL, NULL, NULL, GDB_XML_EF_NONE, NULL, NULL }
-};
-
-static const struct gdb_xml_element syselements[] = {
- { "syscalls_info", NULL, syscalls_info_children,
- GDB_XML_EF_NONE, NULL, NULL },
- { NULL, NULL, NULL, GDB_XML_EF_NONE, NULL, NULL }
-};
+static const struct gdb_xml_attribute syscall_attr[]
+ = { { "number", GDB_XML_AF_NONE, gdb_xml_parse_attr_ulongest, NULL },
+ { "name", GDB_XML_AF_NONE, NULL, NULL },
+ { "alias", GDB_XML_AF_OPTIONAL, NULL, NULL },
+ { "groups", GDB_XML_AF_OPTIONAL, NULL, NULL },
+ { NULL, GDB_XML_AF_NONE, NULL, NULL } };
+
+static const struct gdb_xml_element syscalls_info_children[]
+ = { { "syscall", syscall_attr, NULL,
+ GDB_XML_EF_OPTIONAL | GDB_XML_EF_REPEATABLE, syscall_start_syscall,
+ NULL },
+ { NULL, NULL, NULL, GDB_XML_EF_NONE, NULL, NULL } };
+
+static const struct gdb_xml_element syselements[]
+ = { { "syscalls_info", NULL, syscalls_info_children, GDB_XML_EF_NONE, NULL,
+ NULL },
+ { NULL, NULL, NULL, GDB_XML_EF_NONE, NULL, NULL } };
static struct syscalls_info *
syscall_parse_xml (const char *document, xml_fetch_another fetcher)
@@ -293,15 +291,16 @@ syscall_parse_xml (const char *document, xml_fetch_another fetcher)
data.syscalls_info = sysinfo.get ();
- if (gdb_xml_parse_quick (_("syscalls info"), NULL,
- syselements, document, &data) == 0)
+ if (gdb_xml_parse_quick (_ ("syscalls info"), NULL, syselements, document,
+ &data)
+ == 0)
{
/* Parsed successfully. */
return sysinfo.release ();
}
else
{
- warning (_("Could not load XML syscalls info; ignoring"));
+ warning (_ ("Could not load XML syscalls info; ignoring"));
return NULL;
}
}
@@ -316,15 +315,14 @@ xml_init_syscalls_info (const char *filename)
{
gdb::optional<gdb::char_vector> full_file
= xml_fetch_content_from_file (filename,
- const_cast<char *>(gdb_datadir.c_str ()));
+ const_cast<char *> (gdb_datadir.c_str ()));
if (!full_file)
return NULL;
const std::string dirname = ldirname (filename);
- auto fetch_another = [&dirname] (const char *name)
- {
- return xml_fetch_content_from_file (name, dirname.c_str ());
- };
+ auto fetch_another = [&dirname] (const char *name) {
+ return xml_fetch_content_from_file (name, dirname.c_str ());
+ };
return syscall_parse_xml (full_file->data (), fetch_another);
}
@@ -340,7 +338,8 @@ init_syscalls_info (struct gdbarch *gdbarch)
/* Should we re-read the XML info for this target? */
if (syscalls_info != NULL && !syscalls_info->my_gdb_datadir.empty ()
&& filename_cmp (syscalls_info->my_gdb_datadir.c_str (),
- gdb_datadir.c_str ()) != 0)
+ gdb_datadir.c_str ())
+ != 0)
{
/* The data-directory changed from the last time we used it.
It means that we have to re-read the XML info. */
@@ -364,14 +363,14 @@ init_syscalls_info (struct gdbarch *gdbarch)
if (syscalls_info->syscalls.empty ())
{
if (xml_syscall_file != NULL)
- warning (_("Could not load the syscall XML file `%s/%s'."),
+ warning (_ ("Could not load the syscall XML file `%s/%s'."),
gdb_datadir.c_str (), xml_syscall_file);
else
- warning (_("There is no XML file to open."));
+ warning (_ ("There is no XML file to open."));
- warning (_("GDB will not be able to display "
- "syscall names nor to verify if\n"
- "any provided syscall numbers are valid."));
+ warning (_ ("GDB will not be able to display "
+ "syscall names nor to verify if\n"
+ "any provided syscall numbers are valid."));
}
/* Saving the data-directory used to read this XML info. */
@@ -422,13 +421,11 @@ xml_get_syscalls_by_name (struct gdbarch *gdbarch, const char *syscall_name,
}
static const char *
-xml_get_syscall_name (struct gdbarch *gdbarch,
- int syscall_number)
+xml_get_syscall_name (struct gdbarch *gdbarch, int syscall_number)
{
struct syscalls_info *syscalls_info = gdbarch_syscalls_info (gdbarch);
- if (syscalls_info == NULL
- || syscall_number < 0)
+ if (syscalls_info == NULL || syscall_number < 0)
return NULL;
for (const syscall_desc_up &sysdesc : syscalls_info->syscalls)
@@ -498,7 +495,7 @@ xml_list_of_groups (struct gdbarch *gdbarch)
return NULL;
ngroups = syscalls_info->groups.size ();
- names = (const char**) xmalloc ((ngroups + 1) * sizeof (char *));
+ names = (const char **) xmalloc ((ngroups + 1) * sizeof (char *));
for (i = 0; i < syscalls_info->groups.size (); i++)
names[i] = syscalls_info->groups[i]->name.c_str ();
@@ -515,8 +512,8 @@ set_xml_syscall_file_name (struct gdbarch *gdbarch, const char *name)
}
void
-get_syscall_by_number (struct gdbarch *gdbarch,
- int syscall_number, struct syscall *s)
+get_syscall_by_number (struct gdbarch *gdbarch, int syscall_number,
+ struct syscall *s)
{
init_syscalls_info (gdbarch);
diff --git a/gdb/xml-syscall.h b/gdb/xml-syscall.h
index 55edd8fe1ff..8031ef7a4b2 100644
--- a/gdb/xml-syscall.h
+++ b/gdb/xml-syscall.h
@@ -29,14 +29,13 @@
GDB won't be able to find the correct XML file to open and get
the syscalls definitions. */
-void set_xml_syscall_file_name (struct gdbarch *gdbarch,
- const char *name);
+void set_xml_syscall_file_name (struct gdbarch *gdbarch, const char *name);
/* Function that retrieves the syscall name corresponding to the given
number. It puts the requested information inside 'struct syscall'. */
-void get_syscall_by_number (struct gdbarch *gdbarch,
- int syscall_number, struct syscall *s);
+void get_syscall_by_number (struct gdbarch *gdbarch, int syscall_number,
+ struct syscall *s);
/* Function that retrieves the syscall numbers corresponding to the
given name. The numbers of all syscalls with either a name or
diff --git a/gdb/xml-tdesc.c b/gdb/xml-tdesc.c
index a8b0b0566c7..c4801ea412d 100644
--- a/gdb/xml-tdesc.c
+++ b/gdb/xml-tdesc.c
@@ -48,14 +48,14 @@ tdesc_parse_xml (const char *document, xml_fetch_another fetcher)
if (!have_warned)
{
have_warned = 1;
- warning (_("Can not parse XML target description; XML support was "
- "disabled at compile time"));
+ warning (_ ("Can not parse XML target description; XML support was "
+ "disabled at compile time"));
}
return NULL;
}
-#else /* HAVE_LIBEXPAT */
+#else /* HAVE_LIBEXPAT */
/* A record of every XML description we have parsed. We never discard
old descriptions, because we never discard gdbarches. As long as we
@@ -93,16 +93,18 @@ struct tdesc_parsing_data
static void
tdesc_end_arch (struct gdb_xml_parser *parser,
- const struct gdb_xml_element *element,
- void *user_data, const char *body_text)
+ const struct gdb_xml_element *element, void *user_data,
+ const char *body_text)
{
struct tdesc_parsing_data *data = (struct tdesc_parsing_data *) user_data;
const struct bfd_arch_info *arch;
arch = bfd_scan_arch (body_text);
if (arch == NULL)
- gdb_xml_error (parser, _("Target description specified unknown "
- "architecture \"%s\""), body_text);
+ gdb_xml_error (parser,
+ _ ("Target description specified unknown "
+ "architecture \"%s\""),
+ body_text);
set_tdesc_architecture (data->tdesc, arch);
}
@@ -110,15 +112,15 @@ tdesc_end_arch (struct gdb_xml_parser *parser,
static void
tdesc_end_osabi (struct gdb_xml_parser *parser,
- const struct gdb_xml_element *element,
- void *user_data, const char *body_text)
+ const struct gdb_xml_element *element, void *user_data,
+ const char *body_text)
{
struct tdesc_parsing_data *data = (struct tdesc_parsing_data *) user_data;
enum gdb_osabi osabi;
osabi = osabi_from_tdesc_string (body_text);
if (osabi == GDB_OSABI_UNKNOWN)
- warning (_("Target description specified unknown osabi \"%s\""),
+ warning (_ ("Target description specified unknown osabi \"%s\""),
body_text);
else
set_tdesc_osabi (data->tdesc, osabi);
@@ -128,8 +130,8 @@ tdesc_end_osabi (struct gdb_xml_parser *parser,
static void
tdesc_end_compatible (struct gdb_xml_parser *parser,
- const struct gdb_xml_element *element,
- void *user_data, const char *body_text)
+ const struct gdb_xml_element *element, void *user_data,
+ const char *body_text)
{
struct tdesc_parsing_data *data = (struct tdesc_parsing_data *) user_data;
const struct bfd_arch_info *arch;
@@ -142,15 +144,15 @@ tdesc_end_compatible (struct gdb_xml_parser *parser,
static void
tdesc_start_target (struct gdb_xml_parser *parser,
- const struct gdb_xml_element *element,
- void *user_data, std::vector<gdb_xml_value> &attributes)
+ const struct gdb_xml_element *element, void *user_data,
+ std::vector<gdb_xml_value> &attributes)
{
char *version
= (char *) xml_find_attribute (attributes, "version")->value.get ();
if (strcmp (version, "1.0") != 0)
gdb_xml_error (parser,
- _("Target description has unsupported version \"%s\""),
+ _ ("Target description has unsupported version \"%s\""),
version);
}
@@ -158,8 +160,8 @@ tdesc_start_target (struct gdb_xml_parser *parser,
static void
tdesc_start_feature (struct gdb_xml_parser *parser,
- const struct gdb_xml_element *element,
- void *user_data, std::vector<gdb_xml_value> &attributes)
+ const struct gdb_xml_element *element, void *user_data,
+ std::vector<gdb_xml_value> &attributes)
{
struct tdesc_parsing_data *data = (struct tdesc_parsing_data *) user_data;
char *name = (char *) xml_find_attribute (attributes, "name")->value.get ();
@@ -172,8 +174,8 @@ tdesc_start_feature (struct gdb_xml_parser *parser,
static void
tdesc_start_reg (struct gdb_xml_parser *parser,
- const struct gdb_xml_element *element,
- void *user_data, std::vector<gdb_xml_value> &attributes)
+ const struct gdb_xml_element *element, void *user_data,
+ std::vector<gdb_xml_value> &attributes)
{
struct tdesc_parsing_data *data = (struct tdesc_parsing_data *) user_data;
int ix = 0;
@@ -184,10 +186,10 @@ tdesc_start_reg (struct gdb_xml_parser *parser,
int length = attributes.size ();
name = (char *) attributes[ix++].value.get ();
- bitsize = * (ULONGEST *) attributes[ix++].value.get ();
+ bitsize = *(ULONGEST *) attributes[ix++].value.get ();
if (ix < length && strcmp (attributes[ix].name, "regnum") == 0)
- regnum = * (ULONGEST *) attributes[ix++].value.get ();
+ regnum = *(ULONGEST *) attributes[ix++].value.get ();
else
regnum = data->next_regnum;
@@ -202,15 +204,14 @@ tdesc_start_reg (struct gdb_xml_parser *parser,
group = NULL;
if (ix < length && strcmp (attributes[ix].name, "save-restore") == 0)
- save_restore = * (ULONGEST *) attributes[ix++].value.get ();
+ save_restore = *(ULONGEST *) attributes[ix++].value.get ();
else
save_restore = 1;
- if (strcmp (type, "int") != 0
- && strcmp (type, "float") != 0
+ if (strcmp (type, "int") != 0 && strcmp (type, "float") != 0
&& tdesc_named_type (data->current_feature, type) == NULL)
- gdb_xml_error (parser, _("Register \"%s\" has unknown type \"%s\""),
- name, type);
+ gdb_xml_error (parser, _ ("Register \"%s\" has unknown type \"%s\""), name,
+ type);
tdesc_create_reg (data->current_feature, name, regnum, save_restore, group,
bitsize, type);
@@ -223,8 +224,8 @@ tdesc_start_reg (struct gdb_xml_parser *parser,
static void
tdesc_start_union (struct gdb_xml_parser *parser,
- const struct gdb_xml_element *element,
- void *user_data, std::vector<gdb_xml_value> &attributes)
+ const struct gdb_xml_element *element, void *user_data,
+ std::vector<gdb_xml_value> &attributes)
{
struct tdesc_parsing_data *data = (struct tdesc_parsing_data *) user_data;
char *id = (char *) xml_find_attribute (attributes, "id")->value.get ();
@@ -238,8 +239,8 @@ tdesc_start_union (struct gdb_xml_parser *parser,
static void
tdesc_start_struct (struct gdb_xml_parser *parser,
- const struct gdb_xml_element *element,
- void *user_data, std::vector<gdb_xml_value> &attributes)
+ const struct gdb_xml_element *element, void *user_data,
+ std::vector<gdb_xml_value> &attributes)
{
struct tdesc_parsing_data *data = (struct tdesc_parsing_data *) user_data;
char *id = (char *) xml_find_attribute (attributes, "id")->value.get ();
@@ -253,12 +254,12 @@ tdesc_start_struct (struct gdb_xml_parser *parser,
attr = xml_find_attribute (attributes, "size");
if (attr != NULL)
{
- ULONGEST size = * (ULONGEST *) attr->value.get ();
+ ULONGEST size = *(ULONGEST *) attr->value.get ();
if (size > MAX_FIELD_SIZE)
{
gdb_xml_error (parser,
- _("Struct size %s is larger than maximum (%d)"),
+ _ ("Struct size %s is larger than maximum (%d)"),
pulongest (size), MAX_FIELD_SIZE);
}
tdesc_set_struct_size (type_with_fields, size);
@@ -268,18 +269,17 @@ tdesc_start_struct (struct gdb_xml_parser *parser,
static void
tdesc_start_flags (struct gdb_xml_parser *parser,
- const struct gdb_xml_element *element,
- void *user_data, std::vector<gdb_xml_value> &attributes)
+ const struct gdb_xml_element *element, void *user_data,
+ std::vector<gdb_xml_value> &attributes)
{
struct tdesc_parsing_data *data = (struct tdesc_parsing_data *) user_data;
char *id = (char *) xml_find_attribute (attributes, "id")->value.get ();
- ULONGEST size = * (ULONGEST *)
- xml_find_attribute (attributes, "size")->value.get ();
+ ULONGEST size
+ = *(ULONGEST *) xml_find_attribute (attributes, "size")->value.get ();
if (size > MAX_FIELD_SIZE)
{
- gdb_xml_error (parser,
- _("Flags size %s is larger than maximum (%d)"),
+ gdb_xml_error (parser, _ ("Flags size %s is larger than maximum (%d)"),
pulongest (size), MAX_FIELD_SIZE);
}
@@ -289,18 +289,17 @@ tdesc_start_flags (struct gdb_xml_parser *parser,
static void
tdesc_start_enum (struct gdb_xml_parser *parser,
- const struct gdb_xml_element *element,
- void *user_data, std::vector<gdb_xml_value> &attributes)
+ const struct gdb_xml_element *element, void *user_data,
+ std::vector<gdb_xml_value> &attributes)
{
struct tdesc_parsing_data *data = (struct tdesc_parsing_data *) user_data;
char *id = (char *) xml_find_attribute (attributes, "id")->value.get ();
- int size = * (ULONGEST *)
- xml_find_attribute (attributes, "size")->value.get ();
+ int size
+ = *(ULONGEST *) xml_find_attribute (attributes, "size")->value.get ();
if (size > MAX_FIELD_SIZE)
{
- gdb_xml_error (parser,
- _("Enum size %s is larger than maximum (%d)"),
+ gdb_xml_error (parser, _ ("Enum size %s is larger than maximum (%d)"),
pulongest (size), MAX_FIELD_SIZE);
}
@@ -313,8 +312,8 @@ tdesc_start_enum (struct gdb_xml_parser *parser,
static void
tdesc_start_field (struct gdb_xml_parser *parser,
- const struct gdb_xml_element *element,
- void *user_data, std::vector<gdb_xml_value> &attributes)
+ const struct gdb_xml_element *element, void *user_data,
+ std::vector<gdb_xml_value> &attributes)
{
struct tdesc_parsing_data *data = (struct tdesc_parsing_data *) user_data;
struct gdb_xml_value *attr;
@@ -339,12 +338,12 @@ tdesc_start_field (struct gdb_xml_parser *parser,
attr = xml_find_attribute (attributes, "start");
if (attr != NULL)
{
- ULONGEST ul_start = * (ULONGEST *) attr->value.get ();
+ ULONGEST ul_start = *(ULONGEST *) attr->value.get ();
if (ul_start > MAX_FIELD_BITSIZE)
{
gdb_xml_error (parser,
- _("Field start %s is larger than maximum (%d)"),
+ _ ("Field start %s is larger than maximum (%d)"),
pulongest (ul_start), MAX_FIELD_BITSIZE);
}
start = ul_start;
@@ -355,12 +354,12 @@ tdesc_start_field (struct gdb_xml_parser *parser,
attr = xml_find_attribute (attributes, "end");
if (attr != NULL)
{
- ULONGEST ul_end = * (ULONGEST *) attr->value.get ();
+ ULONGEST ul_end = *(ULONGEST *) attr->value.get ();
if (ul_end > MAX_FIELD_BITSIZE)
{
gdb_xml_error (parser,
- _("Field end %s is larger than maximum (%d)"),
+ _ ("Field end %s is larger than maximum (%d)"),
pulongest (ul_end), MAX_FIELD_BITSIZE);
}
end = ul_end;
@@ -376,34 +375,32 @@ tdesc_start_field (struct gdb_xml_parser *parser,
Stick with that for now, to help ensure backward compatibility.
E.g., If a newer gdbserver is talking to an older gdb. */
if (end == -1)
- gdb_xml_error (parser, _("Missing end value"));
+ gdb_xml_error (parser, _ ("Missing end value"));
if (data->current_type_size == 0)
gdb_xml_error (parser,
- _("Bitfields must live in explicitly sized types"));
+ _ ("Bitfields must live in explicitly sized types"));
- if (field_type_id != NULL
- && strcmp (field_type_id, "bool") == 0
+ if (field_type_id != NULL && strcmp (field_type_id, "bool") == 0
&& start != end)
{
- gdb_xml_error (parser,
- _("Boolean fields must be one bit in size"));
+ gdb_xml_error (parser, _ ("Boolean fields must be one bit in size"));
}
if (end >= 64)
gdb_xml_error (parser,
- _("Bitfield \"%s\" goes past "
- "64 bits (unsupported)"),
+ _ ("Bitfield \"%s\" goes past "
+ "64 bits (unsupported)"),
field_name);
/* Assume that the bit numbering in XML is "lsb-zero". Most
architectures other than PowerPC use this ordering. In the
future, we can add an XML tag to indicate "msb-zero" numbering. */
if (start > end)
- gdb_xml_error (parser, _("Bitfield \"%s\" has start after end"),
+ gdb_xml_error (parser, _ ("Bitfield \"%s\" has start after end"),
field_name);
if (end >= data->current_type_size * TARGET_CHAR_BIT)
- gdb_xml_error (parser, _("Bitfield \"%s\" does not fit in struct"),
+ gdb_xml_error (parser, _ ("Bitfield \"%s\" does not fit in struct"),
field_name);
if (field_type != NULL)
@@ -414,26 +411,28 @@ tdesc_start_field (struct gdb_xml_parser *parser,
tdesc_add_bitfield (t, field_name, start, end);
}
else if (start == -1 && end != -1)
- gdb_xml_error (parser, _("End specified but not start"));
+ gdb_xml_error (parser, _ ("End specified but not start"));
else if (field_type_id != NULL)
{
/* TDESC_TYPE_FLAGS values are explicitly sized, so the following test
catches adding non-bitfield types to flags as well. */
if (data->current_type_size != 0)
gdb_xml_error (parser,
- _("Explicitly sized type cannot "
- "contain non-bitfield \"%s\""),
+ _ ("Explicitly sized type cannot "
+ "contain non-bitfield \"%s\""),
field_name);
if (field_type == NULL)
- gdb_xml_error (parser, _("Field \"%s\" references undefined "
- "type \"%s\""),
+ gdb_xml_error (parser,
+ _ ("Field \"%s\" references undefined "
+ "type \"%s\""),
field_name, field_type_id);
tdesc_add_field (data->current_type, field_name, field_type);
}
else
- gdb_xml_error (parser, _("Field \"%s\" has neither type nor bit position"),
+ gdb_xml_error (parser,
+ _ ("Field \"%s\" has neither type nor bit position"),
field_name);
}
@@ -442,8 +441,8 @@ tdesc_start_field (struct gdb_xml_parser *parser,
static void
tdesc_start_enum_value (struct gdb_xml_parser *parser,
- const struct gdb_xml_element *element,
- void *user_data, std::vector<gdb_xml_value> &attributes)
+ const struct gdb_xml_element *element, void *user_data,
+ std::vector<gdb_xml_value> &attributes)
{
struct tdesc_parsing_data *data = (struct tdesc_parsing_data *) user_data;
struct gdb_xml_value *attr;
@@ -454,11 +453,10 @@ tdesc_start_enum_value (struct gdb_xml_parser *parser,
field_name = (char *) xml_find_attribute (attributes, "name")->value.get ();
attr = xml_find_attribute (attributes, "value");
- ul_value = * (ULONGEST *) attr->value.get ();
+ ul_value = *(ULONGEST *) attr->value.get ();
if (ul_value > INT_MAX)
{
- gdb_xml_error (parser,
- _("Enum value %s is larger than maximum (%d)"),
+ gdb_xml_error (parser, _ ("Enum value %s is larger than maximum (%d)"),
pulongest (ul_value), INT_MAX);
}
value = ul_value;
@@ -471,8 +469,8 @@ tdesc_start_enum_value (struct gdb_xml_parser *parser,
static void
tdesc_start_vector (struct gdb_xml_parser *parser,
- const struct gdb_xml_element *element,
- void *user_data, std::vector<gdb_xml_value> &attributes)
+ const struct gdb_xml_element *element, void *user_data,
+ std::vector<gdb_xml_value> &attributes)
{
struct tdesc_parsing_data *data = (struct tdesc_parsing_data *) user_data;
struct tdesc_type *field_type;
@@ -481,137 +479,116 @@ tdesc_start_vector (struct gdb_xml_parser *parser,
id = (char *) attributes[0].value.get ();
field_type_id = (char *) attributes[1].value.get ();
- count = * (ULONGEST *) attributes[2].value.get ();
+ count = *(ULONGEST *) attributes[2].value.get ();
if (count > MAX_VECTOR_SIZE)
{
- gdb_xml_error (parser,
- _("Vector size %s is larger than maximum (%d)"),
+ gdb_xml_error (parser, _ ("Vector size %s is larger than maximum (%d)"),
pulongest (count), MAX_VECTOR_SIZE);
}
field_type = tdesc_named_type (data->current_feature, field_type_id);
if (field_type == NULL)
- gdb_xml_error (parser, _("Vector \"%s\" references undefined type \"%s\""),
- id, field_type_id);
+ gdb_xml_error (parser,
+ _ ("Vector \"%s\" references undefined type \"%s\""), id,
+ field_type_id);
tdesc_create_vector (data->current_feature, id, field_type, count);
}
/* The elements and attributes of an XML target description. */
-static const struct gdb_xml_attribute field_attributes[] = {
- { "name", GDB_XML_AF_NONE, NULL, NULL },
- { "type", GDB_XML_AF_OPTIONAL, NULL, NULL },
- { "start", GDB_XML_AF_OPTIONAL, gdb_xml_parse_attr_ulongest, NULL },
- { "end", GDB_XML_AF_OPTIONAL, gdb_xml_parse_attr_ulongest, NULL },
- { NULL, GDB_XML_AF_NONE, NULL, NULL }
-};
-
-static const struct gdb_xml_attribute enum_value_attributes[] = {
- { "name", GDB_XML_AF_NONE, NULL, NULL },
- { "value", GDB_XML_AF_OPTIONAL, gdb_xml_parse_attr_ulongest, NULL },
- { NULL, GDB_XML_AF_NONE, NULL, NULL }
-};
-
-static const struct gdb_xml_element struct_union_children[] = {
- { "field", field_attributes, NULL, GDB_XML_EF_REPEATABLE,
- tdesc_start_field, NULL },
- { NULL, NULL, NULL, GDB_XML_EF_NONE, NULL, NULL }
-};
-
-static const struct gdb_xml_element enum_children[] = {
- { "evalue", enum_value_attributes, NULL, GDB_XML_EF_REPEATABLE,
- tdesc_start_enum_value, NULL },
- { NULL, NULL, NULL, GDB_XML_EF_NONE, NULL, NULL }
-};
-
-static const struct gdb_xml_attribute reg_attributes[] = {
- { "name", GDB_XML_AF_NONE, NULL, NULL },
- { "bitsize", GDB_XML_AF_NONE, gdb_xml_parse_attr_ulongest, NULL },
- { "regnum", GDB_XML_AF_OPTIONAL, gdb_xml_parse_attr_ulongest, NULL },
- { "type", GDB_XML_AF_OPTIONAL, NULL, NULL },
- { "group", GDB_XML_AF_OPTIONAL, NULL, NULL },
- { "save-restore", GDB_XML_AF_OPTIONAL,
- gdb_xml_parse_attr_enum, gdb_xml_enums_boolean },
- { NULL, GDB_XML_AF_NONE, NULL, NULL }
-};
-
-static const struct gdb_xml_attribute struct_union_attributes[] = {
- { "id", GDB_XML_AF_NONE, NULL, NULL },
- { "size", GDB_XML_AF_OPTIONAL, gdb_xml_parse_attr_ulongest, NULL},
- { NULL, GDB_XML_AF_NONE, NULL, NULL }
-};
-
-static const struct gdb_xml_attribute flags_attributes[] = {
- { "id", GDB_XML_AF_NONE, NULL, NULL },
- { "size", GDB_XML_AF_NONE, gdb_xml_parse_attr_ulongest, NULL},
- { NULL, GDB_XML_AF_NONE, NULL, NULL }
-};
-
-static const struct gdb_xml_attribute enum_attributes[] = {
- { "id", GDB_XML_AF_NONE, NULL, NULL },
- { "size", GDB_XML_AF_NONE, gdb_xml_parse_attr_ulongest, NULL},
- { NULL, GDB_XML_AF_NONE, NULL, NULL }
-};
-
-static const struct gdb_xml_attribute vector_attributes[] = {
- { "id", GDB_XML_AF_NONE, NULL, NULL },
- { "type", GDB_XML_AF_NONE, NULL, NULL },
- { "count", GDB_XML_AF_NONE, gdb_xml_parse_attr_ulongest, NULL },
- { NULL, GDB_XML_AF_NONE, NULL, NULL }
-};
-
-static const struct gdb_xml_attribute feature_attributes[] = {
- { "name", GDB_XML_AF_NONE, NULL, NULL },
- { NULL, GDB_XML_AF_NONE, NULL, NULL }
-};
+static const struct gdb_xml_attribute field_attributes[]
+ = { { "name", GDB_XML_AF_NONE, NULL, NULL },
+ { "type", GDB_XML_AF_OPTIONAL, NULL, NULL },
+ { "start", GDB_XML_AF_OPTIONAL, gdb_xml_parse_attr_ulongest, NULL },
+ { "end", GDB_XML_AF_OPTIONAL, gdb_xml_parse_attr_ulongest, NULL },
+ { NULL, GDB_XML_AF_NONE, NULL, NULL } };
+
+static const struct gdb_xml_attribute enum_value_attributes[]
+ = { { "name", GDB_XML_AF_NONE, NULL, NULL },
+ { "value", GDB_XML_AF_OPTIONAL, gdb_xml_parse_attr_ulongest, NULL },
+ { NULL, GDB_XML_AF_NONE, NULL, NULL } };
+
+static const struct gdb_xml_element struct_union_children[]
+ = { { "field", field_attributes, NULL, GDB_XML_EF_REPEATABLE,
+ tdesc_start_field, NULL },
+ { NULL, NULL, NULL, GDB_XML_EF_NONE, NULL, NULL } };
+
+static const struct gdb_xml_element enum_children[]
+ = { { "evalue", enum_value_attributes, NULL, GDB_XML_EF_REPEATABLE,
+ tdesc_start_enum_value, NULL },
+ { NULL, NULL, NULL, GDB_XML_EF_NONE, NULL, NULL } };
+
+static const struct gdb_xml_attribute reg_attributes[]
+ = { { "name", GDB_XML_AF_NONE, NULL, NULL },
+ { "bitsize", GDB_XML_AF_NONE, gdb_xml_parse_attr_ulongest, NULL },
+ { "regnum", GDB_XML_AF_OPTIONAL, gdb_xml_parse_attr_ulongest, NULL },
+ { "type", GDB_XML_AF_OPTIONAL, NULL, NULL },
+ { "group", GDB_XML_AF_OPTIONAL, NULL, NULL },
+ { "save-restore", GDB_XML_AF_OPTIONAL, gdb_xml_parse_attr_enum,
+ gdb_xml_enums_boolean },
+ { NULL, GDB_XML_AF_NONE, NULL, NULL } };
+
+static const struct gdb_xml_attribute struct_union_attributes[]
+ = { { "id", GDB_XML_AF_NONE, NULL, NULL },
+ { "size", GDB_XML_AF_OPTIONAL, gdb_xml_parse_attr_ulongest, NULL },
+ { NULL, GDB_XML_AF_NONE, NULL, NULL } };
+
+static const struct gdb_xml_attribute flags_attributes[]
+ = { { "id", GDB_XML_AF_NONE, NULL, NULL },
+ { "size", GDB_XML_AF_NONE, gdb_xml_parse_attr_ulongest, NULL },
+ { NULL, GDB_XML_AF_NONE, NULL, NULL } };
+
+static const struct gdb_xml_attribute enum_attributes[]
+ = { { "id", GDB_XML_AF_NONE, NULL, NULL },
+ { "size", GDB_XML_AF_NONE, gdb_xml_parse_attr_ulongest, NULL },
+ { NULL, GDB_XML_AF_NONE, NULL, NULL } };
+
+static const struct gdb_xml_attribute vector_attributes[]
+ = { { "id", GDB_XML_AF_NONE, NULL, NULL },
+ { "type", GDB_XML_AF_NONE, NULL, NULL },
+ { "count", GDB_XML_AF_NONE, gdb_xml_parse_attr_ulongest, NULL },
+ { NULL, GDB_XML_AF_NONE, NULL, NULL } };
+
+static const struct gdb_xml_attribute feature_attributes[]
+ = { { "name", GDB_XML_AF_NONE, NULL, NULL },
+ { NULL, GDB_XML_AF_NONE, NULL, NULL } };
static const struct gdb_xml_element feature_children[] = {
- { "reg", reg_attributes, NULL,
- GDB_XML_EF_OPTIONAL | GDB_XML_EF_REPEATABLE,
+ { "reg", reg_attributes, NULL, GDB_XML_EF_OPTIONAL | GDB_XML_EF_REPEATABLE,
tdesc_start_reg, NULL },
{ "struct", struct_union_attributes, struct_union_children,
- GDB_XML_EF_OPTIONAL | GDB_XML_EF_REPEATABLE,
- tdesc_start_struct, NULL },
+ GDB_XML_EF_OPTIONAL | GDB_XML_EF_REPEATABLE, tdesc_start_struct, NULL },
{ "union", struct_union_attributes, struct_union_children,
- GDB_XML_EF_OPTIONAL | GDB_XML_EF_REPEATABLE,
- tdesc_start_union, NULL },
+ GDB_XML_EF_OPTIONAL | GDB_XML_EF_REPEATABLE, tdesc_start_union, NULL },
{ "flags", flags_attributes, struct_union_children,
- GDB_XML_EF_OPTIONAL | GDB_XML_EF_REPEATABLE,
- tdesc_start_flags, NULL },
+ GDB_XML_EF_OPTIONAL | GDB_XML_EF_REPEATABLE, tdesc_start_flags, NULL },
{ "enum", enum_attributes, enum_children,
- GDB_XML_EF_OPTIONAL | GDB_XML_EF_REPEATABLE,
- tdesc_start_enum, NULL },
+ GDB_XML_EF_OPTIONAL | GDB_XML_EF_REPEATABLE, tdesc_start_enum, NULL },
{ "vector", vector_attributes, NULL,
- GDB_XML_EF_OPTIONAL | GDB_XML_EF_REPEATABLE,
- tdesc_start_vector, NULL },
+ GDB_XML_EF_OPTIONAL | GDB_XML_EF_REPEATABLE, tdesc_start_vector, NULL },
{ NULL, NULL, NULL, GDB_XML_EF_NONE, NULL, NULL }
};
-static const struct gdb_xml_attribute target_attributes[] = {
- { "version", GDB_XML_AF_NONE, NULL, NULL },
- { NULL, GDB_XML_AF_NONE, NULL, NULL }
-};
+static const struct gdb_xml_attribute target_attributes[]
+ = { { "version", GDB_XML_AF_NONE, NULL, NULL },
+ { NULL, GDB_XML_AF_NONE, NULL, NULL } };
static const struct gdb_xml_element target_children[] = {
- { "architecture", NULL, NULL, GDB_XML_EF_OPTIONAL,
- NULL, tdesc_end_arch },
- { "osabi", NULL, NULL, GDB_XML_EF_OPTIONAL,
- NULL, tdesc_end_osabi },
+ { "architecture", NULL, NULL, GDB_XML_EF_OPTIONAL, NULL, tdesc_end_arch },
+ { "osabi", NULL, NULL, GDB_XML_EF_OPTIONAL, NULL, tdesc_end_osabi },
{ "compatible", NULL, NULL, GDB_XML_EF_OPTIONAL | GDB_XML_EF_REPEATABLE,
NULL, tdesc_end_compatible },
{ "feature", feature_attributes, feature_children,
- GDB_XML_EF_OPTIONAL | GDB_XML_EF_REPEATABLE,
- tdesc_start_feature, NULL },
+ GDB_XML_EF_OPTIONAL | GDB_XML_EF_REPEATABLE, tdesc_start_feature, NULL },
{ NULL, NULL, NULL, GDB_XML_EF_NONE, NULL, NULL }
};
-static const struct gdb_xml_element tdesc_elements[] = {
- { "target", target_attributes, target_children, GDB_XML_EF_NONE,
- tdesc_start_target, NULL },
- { NULL, NULL, NULL, GDB_XML_EF_NONE, NULL, NULL }
-};
+static const struct gdb_xml_element tdesc_elements[]
+ = { { "target", target_attributes, target_children, GDB_XML_EF_NONE,
+ tdesc_start_target, NULL },
+ { NULL, NULL, NULL, GDB_XML_EF_NONE, NULL, NULL } };
/* Parse DOCUMENT into a target description and return it. */
@@ -623,11 +600,10 @@ tdesc_parse_xml (const char *document, xml_fetch_another fetcher)
/* Expand all XInclude directives. */
std::string expanded_text;
- if (!xml_process_xincludes (expanded_text,
- _("target description"),
+ if (!xml_process_xincludes (expanded_text, _ ("target description"),
document, fetcher, 0))
{
- warning (_("Could not load XML target description; ignoring"));
+ warning (_ ("Could not load XML target description; ignoring"));
return NULL;
}
@@ -641,8 +617,9 @@ tdesc_parse_xml (const char *document, xml_fetch_another fetcher)
target_desc_up description = allocate_target_description ();
data.tdesc = description.get ();
- if (gdb_xml_parse_quick (_("target description"), "gdb-target.dtd",
- tdesc_elements, expanded_text.c_str (), &data) == 0)
+ if (gdb_xml_parse_quick (_ ("target description"), "gdb-target.dtd",
+ tdesc_elements, expanded_text.c_str (), &data)
+ == 0)
{
/* Parsed successfully. */
xml_cache.emplace (std::move (expanded_text), std::move (description));
@@ -650,12 +627,11 @@ tdesc_parse_xml (const char *document, xml_fetch_another fetcher)
}
else
{
- warning (_("Could not load XML target description; ignoring"));
+ warning (_ ("Could not load XML target description; ignoring"));
return NULL;
}
}
#endif /* HAVE_LIBEXPAT */
-
/* Read an XML target description from FILENAME. Parse it, and return
the parsed description. */
@@ -667,15 +643,14 @@ file_read_description_xml (const char *filename)
= xml_fetch_content_from_file (filename, NULL);
if (!tdesc_str)
{
- warning (_("Could not open \"%s\""), filename);
+ warning (_ ("Could not open \"%s\""), filename);
return NULL;
}
const std::string dirname = ldirname (filename);
- auto fetch_another = [&dirname] (const char *name)
- {
- return xml_fetch_content_from_file (name, dirname.c_str ());
- };
+ auto fetch_another = [&dirname] (const char *name) {
+ return xml_fetch_content_from_file (name, dirname.c_str ());
+ };
return tdesc_parse_xml (tdesc_str->data (), fetch_another);
}
@@ -692,11 +667,8 @@ fetch_available_features_from_target (const char *name, target_ops *ops)
{
/* Read this object as a string. This ensures that a NUL
terminator is added. */
- return target_read_stralloc (ops,
- TARGET_OBJECT_AVAILABLE_FEATURES,
- name);
+ return target_read_stralloc (ops, TARGET_OBJECT_AVAILABLE_FEATURES, name);
}
-
/* Read an XML target description using OPS. Parse it, and return the
parsed description. */
@@ -709,10 +681,9 @@ target_read_description_xml (struct target_ops *ops)
if (!tdesc_str)
return NULL;
- auto fetch_another = [ops] (const char *name)
- {
- return fetch_available_features_from_target (name, ops);
- };
+ auto fetch_another = [ops] (const char *name) {
+ return fetch_available_features_from_target (name, ops);
+ };
return tdesc_parse_xml (tdesc_str->data (), fetch_another);
}
@@ -730,27 +701,25 @@ target_fetch_description_xml (struct target_ops *ops)
if (!have_warned)
{
have_warned = 1;
- warning (_("Can not fetch XML target description; XML support was "
- "disabled at compile time"));
+ warning (_ ("Can not fetch XML target description; XML support was "
+ "disabled at compile time"));
}
return {};
#else
- gdb::optional<gdb::char_vector>
- tdesc_str = fetch_available_features_from_target ("target.xml", ops);
+ gdb::optional<gdb::char_vector> tdesc_str
+ = fetch_available_features_from_target ("target.xml", ops);
if (!tdesc_str)
return {};
- auto fetch_another = [ops] (const char *name)
- {
- return fetch_available_features_from_target (name, ops);
- };
+ auto fetch_another = [ops] (const char *name) {
+ return fetch_available_features_from_target (name, ops);
+ };
std::string output;
- if (!xml_process_xincludes (output,
- _("target description"),
+ if (!xml_process_xincludes (output, _ ("target description"),
tdesc_str->data (), fetch_another, 0))
{
- warning (_("Could not load XML target description; ignoring"));
+ warning (_ ("Could not load XML target description; ignoring"));
return {};
}
return output;
@@ -762,9 +731,8 @@ target_fetch_description_xml (struct target_ops *ops)
const struct target_desc *
string_read_description_xml (const char *xml)
{
- return tdesc_parse_xml (xml, [] (const char *href)
- {
- error (_("xincludes are unsupported with this method"));
- return gdb::optional<gdb::char_vector> ();
- });
+ return tdesc_parse_xml (xml, [] (const char *href) {
+ error (_ ("xincludes are unsupported with this method"));
+ return gdb::optional<gdb::char_vector> ();
+ });
}
diff --git a/gdb/xml-tdesc.h b/gdb/xml-tdesc.h
index 0fbfc7e043e..c862478295a 100644
--- a/gdb/xml-tdesc.h
+++ b/gdb/xml-tdesc.h
@@ -50,4 +50,3 @@ gdb::optional<std::string> target_fetch_description_xml (target_ops *ops);
const struct target_desc *string_read_description_xml (const char *xml);
#endif /* XML_TDESC_H */
-
diff --git a/gdb/xstormy16-tdep.c b/gdb/xstormy16-tdep.c
index 0c33b9a7554..1970e1256c5 100644
--- a/gdb/xstormy16-tdep.c
+++ b/gdb/xstormy16-tdep.c
@@ -46,26 +46,35 @@ enum gdb_regnum
R15 is used implicitly as stack pointer. */
E_R0_REGNUM,
E_R1_REGNUM,
- E_R2_REGNUM, E_1ST_ARG_REGNUM = E_R2_REGNUM, E_PTR_RET_REGNUM = E_R2_REGNUM,
+ E_R2_REGNUM,
+ E_1ST_ARG_REGNUM = E_R2_REGNUM,
+ E_PTR_RET_REGNUM = E_R2_REGNUM,
E_R3_REGNUM,
E_R4_REGNUM,
E_R5_REGNUM,
E_R6_REGNUM,
- E_R7_REGNUM, E_LST_ARG_REGNUM = E_R7_REGNUM,
+ E_R7_REGNUM,
+ E_LST_ARG_REGNUM = E_R7_REGNUM,
E_R8_REGNUM,
E_R9_REGNUM,
E_R10_REGNUM,
E_R11_REGNUM,
E_R12_REGNUM,
- E_R13_REGNUM, E_FP_REGNUM = E_R13_REGNUM,
- E_R14_REGNUM, E_PSW_REGNUM = E_R14_REGNUM,
- E_R15_REGNUM, E_SP_REGNUM = E_R15_REGNUM,
+ E_R13_REGNUM,
+ E_FP_REGNUM = E_R13_REGNUM,
+ E_R14_REGNUM,
+ E_PSW_REGNUM = E_R14_REGNUM,
+ E_R15_REGNUM,
+ E_SP_REGNUM = E_R15_REGNUM,
E_PC_REGNUM,
E_NUM_REGS
};
/* Use an invalid address value as 'not available' marker. */
-enum { REG_UNAVAIL = (CORE_ADDR) -1 };
+enum
+{
+ REG_UNAVAIL = (CORE_ADDR) -1
+};
struct xstormy16_frame_cache
{
@@ -87,8 +96,8 @@ enum
};
/* Size of return datatype which fits into the remaining return registers. */
-#define E_MAX_RETTYPE_SIZE(regnum) ((E_LST_ARG_REGNUM - (regnum) + 1) \
- * xstormy16_reg_size)
+#define E_MAX_RETTYPE_SIZE(regnum) \
+ ((E_LST_ARG_REGNUM - (regnum) + 1) * xstormy16_reg_size)
/* Size of return datatype which fits into all return registers. */
enum
@@ -102,11 +111,9 @@ enum
static const char *
xstormy16_register_name (struct gdbarch *gdbarch, int regnum)
{
- static const char *register_names[] = {
- "r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7",
- "r8", "r9", "r10", "r11", "r12", "r13",
- "psw", "sp", "pc"
- };
+ static const char *register_names[]
+ = { "r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7", "r8",
+ "r9", "r10", "r11", "r12", "r13", "psw", "sp", "pc" };
gdb_static_assert (ARRAY_SIZE (register_names) == E_NUM_REGS);
return register_names[regnum];
@@ -128,8 +135,7 @@ xstormy16_register_type (struct gdbarch *gdbarch, int regnum)
static int
xstormy16_type_is_scalar (struct type *t)
{
- return (t->code () != TYPE_CODE_STRUCT
- && t->code () != TYPE_CODE_UNION
+ return (t->code () != TYPE_CODE_STRUCT && t->code () != TYPE_CODE_UNION
&& t->code () != TYPE_CODE_ARRAY);
}
@@ -137,14 +143,14 @@ xstormy16_type_is_scalar (struct type *t)
Returns non-zero if the given struct type will be returned using
a special convention, rather than the normal function return method.
7sed in the contexts of the "return" command, and of
- target function calls from the debugger. */
+ target function calls from the debugger. */
static int
xstormy16_use_struct_convention (struct type *type)
{
return !xstormy16_type_is_scalar (type)
|| type->length () > E_MAX_RETTYPE_SIZE_IN_REGS;
-}
+}
/* Function: xstormy16_extract_return_value
Find a function's return value in the appropriate registers (in
@@ -166,12 +172,12 @@ xstormy16_extract_return_value (struct type *type, struct regcache *regcache,
proper location for a function return.
Called only in the context of the "return" command. */
-static void
+static void
xstormy16_store_return_value (struct type *type, struct regcache *regcache,
const gdb_byte *valbuf)
{
if (type->length () == 1)
- {
+ {
/* Add leading zeros to the value. */
gdb_byte buf[xstormy16_reg_size];
memset (buf, 0, xstormy16_reg_size);
@@ -216,12 +222,9 @@ xstormy16_frame_align (struct gdbarch *gdbarch, CORE_ADDR addr)
Returns the value of the SP register after the args are pushed. */
static CORE_ADDR
-xstormy16_push_dummy_call (struct gdbarch *gdbarch,
- struct value *function,
- struct regcache *regcache,
- CORE_ADDR bp_addr, int nargs,
- struct value **args,
- CORE_ADDR sp,
+xstormy16_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
+ struct regcache *regcache, CORE_ADDR bp_addr,
+ int nargs, struct value **args, CORE_ADDR sp,
function_call_return_method return_method,
CORE_ADDR struct_addr)
{
@@ -303,8 +306,8 @@ xstormy16_push_dummy_call (struct gdbarch *gdbarch,
Returns the address of the first instruction after the prologue. */
static CORE_ADDR
-xstormy16_analyze_prologue (struct gdbarch *gdbarch,
- CORE_ADDR start_addr, CORE_ADDR end_addr,
+xstormy16_analyze_prologue (struct gdbarch *gdbarch, CORE_ADDR start_addr,
+ CORE_ADDR end_addr,
struct xstormy16_frame_cache *cache,
frame_info_ptr this_frame)
{
@@ -321,15 +324,15 @@ xstormy16_analyze_prologue (struct gdbarch *gdbarch,
if (start_addr >= end_addr)
return end_addr;
- for (next_addr = start_addr;
- next_addr < end_addr; next_addr += xstormy16_inst_size)
+ for (next_addr = start_addr; next_addr < end_addr;
+ next_addr += xstormy16_inst_size)
{
- inst = read_memory_unsigned_integer (next_addr,
- xstormy16_inst_size, byte_order);
+ inst = read_memory_unsigned_integer (next_addr, xstormy16_inst_size,
+ byte_order);
inst2 = read_memory_unsigned_integer (next_addr + xstormy16_inst_size,
xstormy16_inst_size, byte_order);
- if (inst >= 0x0082 && inst <= 0x008d) /* push r2 .. push r13 */
+ if (inst >= 0x0082 && inst <= 0x008d) /* push r2 .. push r13 */
{
regnum = inst & 0x000f;
cache->saved_regs[regnum] = cache->framesize;
@@ -337,13 +340,13 @@ xstormy16_analyze_prologue (struct gdbarch *gdbarch,
}
/* Optional stack allocation for args and local vars <= 4 byte. */
- else if (inst == 0x301f || inst == 0x303f) /* inc r15, #0x1/#0x3 */
+ else if (inst == 0x301f || inst == 0x303f) /* inc r15, #0x1/#0x3 */
{
cache->framesize += ((inst & 0x0030) >> 4) + 1;
}
/* optional stack allocation for args and local vars > 4 && < 16 byte */
- else if ((inst & 0xff0f) == 0x510f) /* 51Hf add r15, #0xH */
+ else if ((inst & 0xff0f) == 0x510f) /* 51Hf add r15, #0xH */
{
cache->framesize += (inst & 0x00f0) >> 4;
}
@@ -355,14 +358,14 @@ xstormy16_analyze_prologue (struct gdbarch *gdbarch,
next_addr += xstormy16_inst_size;
}
- else if (inst == 0x46fd) /* mov r13, r15 */
+ else if (inst == 0x46fd) /* mov r13, r15 */
{
cache->uses_fp = 1;
}
/* optional copying of args in r2-r7 to r10-r13. */
/* Probably only in optimized case but legal action for prologue. */
- else if ((inst & 0xff00) == 0x4600 /* 46SD mov rD, rS */
+ else if ((inst & 0xff00) == 0x4600 /* 46SD mov rD, rS */
&& (inst & 0x00f0) >= 0x0020 && (inst & 0x00f0) <= 0x0070
&& (inst & 0x000f) >= 0x000a && (inst & 0x000f) <= 0x000d)
;
@@ -384,7 +387,7 @@ xstormy16_analyze_prologue (struct gdbarch *gdbarch,
next_addr += xstormy16_inst_size;
}
- else /* Not a prologue instruction. */
+ else /* Not a prologue instruction. */
break;
}
@@ -466,24 +469,23 @@ xstormy16_stack_frame_destroyed_p (struct gdbarch *gdbarch, CORE_ADDR pc)
/* Check if we're on a `ret' instruction. Otherwise it's
too dangerous to proceed. */
- inst = read_memory_unsigned_integer (addr,
- xstormy16_inst_size, byte_order);
+ inst
+ = read_memory_unsigned_integer (addr, xstormy16_inst_size, byte_order);
if (inst != 0x0003)
return 0;
while ((addr -= xstormy16_inst_size) >= func_addr)
{
- inst = read_memory_unsigned_integer (addr,
- xstormy16_inst_size,
+ inst = read_memory_unsigned_integer (addr, xstormy16_inst_size,
byte_order);
- if (inst >= 0x009a && inst <= 0x009d) /* pop r10...r13 */
+ if (inst >= 0x009a && inst <= 0x009d) /* pop r10...r13 */
continue;
- if (inst == 0x305f || inst == 0x307f) /* dec r15, #0x1/#0x3 */
+ if (inst == 0x305f || inst == 0x307f) /* dec r15, #0x1/#0x3 */
break;
- inst2 = read_memory_unsigned_integer (addr - xstormy16_inst_size,
- xstormy16_inst_size,
- byte_order);
- if (inst2 == 0x314f && inst >= 0x8000) /* add r15, neg. value */
+ inst2
+ = read_memory_unsigned_integer (addr - xstormy16_inst_size,
+ xstormy16_inst_size, byte_order);
+ if (inst2 == 0x314f && inst >= 0x8000) /* add r15, neg. value */
{
addr -= xstormy16_inst_size;
break;
@@ -519,8 +521,8 @@ xstormy16_resolve_jmp_table_entry (struct gdbarch *gdbarch, CORE_ADDR faddr)
if (!target_read_memory (faddr, buf, sizeof buf))
{
- inst = extract_unsigned_integer (buf,
- xstormy16_inst_size, byte_order);
+ inst
+ = extract_unsigned_integer (buf, xstormy16_inst_size, byte_order);
inst2 = extract_unsigned_integer (buf + xstormy16_inst_size,
xstormy16_inst_size, byte_order);
addr = inst2 << 8 | (inst & 0xff);
@@ -548,10 +550,10 @@ xstormy16_find_jmp_table_entry (struct gdbarch *gdbarch, CORE_ADDR faddr)
return faddr;
ALL_OBJFILE_OSECTIONS (faddr_sect->objfile, osect)
- {
- if (!strcmp (osect->the_bfd_section->name, ".plt"))
- break;
- }
+ {
+ if (!strcmp (osect->the_bfd_section->name, ".plt"))
+ break;
+ }
if (osect < faddr_sect->objfile->sections_end)
{
@@ -567,12 +569,11 @@ xstormy16_find_jmp_table_entry (struct gdbarch *gdbarch, CORE_ADDR faddr)
if (target_read_memory (addr, buf, sizeof buf))
return 0;
- inst = extract_unsigned_integer (buf,
- xstormy16_inst_size,
+ inst = extract_unsigned_integer (buf, xstormy16_inst_size,
byte_order);
- inst2 = extract_unsigned_integer (buf + xstormy16_inst_size,
- xstormy16_inst_size,
- byte_order);
+ inst2
+ = extract_unsigned_integer (buf + xstormy16_inst_size,
+ xstormy16_inst_size, byte_order);
faddr2 = inst2 << 8 | (inst & 0xff);
if (faddr == faddr2)
return addr;
@@ -601,13 +602,12 @@ xstormy16_skip_trampoline_code (frame_info_ptr frame, CORE_ADDR pc)
and vice versa. */
static CORE_ADDR
-xstormy16_pointer_to_address (struct gdbarch *gdbarch,
- struct type *type, const gdb_byte *buf)
+xstormy16_pointer_to_address (struct gdbarch *gdbarch, struct type *type,
+ const gdb_byte *buf)
{
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
enum type_code target = type->target_type ()->code ();
- CORE_ADDR addr
- = extract_unsigned_integer (buf, type->length (), byte_order);
+ CORE_ADDR addr = extract_unsigned_integer (buf, type->length (), byte_order);
if (target == TYPE_CODE_FUNC || target == TYPE_CODE_METHOD)
{
@@ -620,8 +620,8 @@ xstormy16_pointer_to_address (struct gdbarch *gdbarch,
}
static void
-xstormy16_address_to_pointer (struct gdbarch *gdbarch,
- struct type *type, gdb_byte *buf, CORE_ADDR addr)
+xstormy16_address_to_pointer (struct gdbarch *gdbarch, struct type *type,
+ gdb_byte *buf, CORE_ADDR addr)
{
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
enum type_code target = type->target_type ()->code ();
@@ -675,8 +675,8 @@ xstormy16_frame_cache (frame_info_ptr this_frame, void **this_cache)
cache->pc = get_frame_func (this_frame);
current_pc = get_frame_pc (this_frame);
if (cache->pc)
- xstormy16_analyze_prologue (gdbarch, cache->pc, current_pc,
- cache, this_frame);
+ xstormy16_analyze_prologue (gdbarch, cache->pc, current_pc, cache,
+ this_frame);
if (!cache->uses_fp)
cache->base = get_frame_register_unsigned (this_frame, E_SP_REGNUM);
@@ -691,11 +691,11 @@ xstormy16_frame_cache (frame_info_ptr this_frame, void **this_cache)
}
static struct value *
-xstormy16_frame_prev_register (frame_info_ptr this_frame,
- void **this_cache, int regnum)
+xstormy16_frame_prev_register (frame_info_ptr this_frame, void **this_cache,
+ int regnum)
{
- struct xstormy16_frame_cache *cache = xstormy16_frame_cache (this_frame,
- this_cache);
+ struct xstormy16_frame_cache *cache
+ = xstormy16_frame_cache (this_frame, this_cache);
gdb_assert (regnum >= 0);
if (regnum == E_SP_REGNUM && cache->saved_sp)
@@ -712,8 +712,8 @@ static void
xstormy16_frame_this_id (frame_info_ptr this_frame, void **this_cache,
struct frame_id *this_id)
{
- struct xstormy16_frame_cache *cache = xstormy16_frame_cache (this_frame,
- this_cache);
+ struct xstormy16_frame_cache *cache
+ = xstormy16_frame_cache (this_frame, this_cache);
/* This marks the outermost frame. */
if (cache->base == 0)
@@ -725,27 +725,23 @@ xstormy16_frame_this_id (frame_info_ptr this_frame, void **this_cache,
static CORE_ADDR
xstormy16_frame_base_address (frame_info_ptr this_frame, void **this_cache)
{
- struct xstormy16_frame_cache *cache = xstormy16_frame_cache (this_frame,
- this_cache);
+ struct xstormy16_frame_cache *cache
+ = xstormy16_frame_cache (this_frame, this_cache);
return cache->base;
}
-static const struct frame_unwind xstormy16_frame_unwind = {
- "xstormy16 prologue",
- NORMAL_FRAME,
- default_frame_unwind_stop_reason,
- xstormy16_frame_this_id,
- xstormy16_frame_prev_register,
- NULL,
- default_frame_sniffer
-};
+static const struct frame_unwind xstormy16_frame_unwind
+ = { "xstormy16 prologue",
+ NORMAL_FRAME,
+ default_frame_unwind_stop_reason,
+ xstormy16_frame_this_id,
+ xstormy16_frame_prev_register,
+ NULL,
+ default_frame_sniffer };
-static const struct frame_base xstormy16_frame_base = {
- &xstormy16_frame_unwind,
- xstormy16_frame_base_address,
- xstormy16_frame_base_address,
- xstormy16_frame_base_address
-};
+static const struct frame_base xstormy16_frame_base
+ = { &xstormy16_frame_unwind, xstormy16_frame_base_address,
+ xstormy16_frame_base_address, xstormy16_frame_base_address };
/* Function: xstormy16_gdbarch_init
Initializer function for the xstormy16 gdbarch vector.
@@ -830,6 +826,7 @@ xstormy16_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
Called by gdb at start-up. */
void _initialize_xstormy16_tdep ();
+
void
_initialize_xstormy16_tdep ()
{
diff --git a/gdb/xtensa-config.c b/gdb/xtensa-config.c
index a40ce9380dc..50ecb5de413 100644
--- a/gdb/xtensa-config.c
+++ b/gdb/xtensa-config.c
@@ -24,8 +24,6 @@
#include "xtensa-config.h"
#include "xtensa-tdep.h"
-
-
/* Masked registers. */
xtensa_reg_mask_t xtensa_submask0[] = { { 42, 0, 4 } };
const xtensa_mask_t xtensa_mask0 = { 1, xtensa_submask0 };
@@ -60,155 +58,721 @@ const xtensa_mask_t xtensa_mask14 = { 1, xtensa_submask14 };
xtensa_reg_mask_t xtensa_submask15[] = { { 45, 22, 10 } };
const xtensa_mask_t xtensa_mask15 = { 1, xtensa_submask15 };
-
/* Register map. */
-xtensa_register_t xtensa_rmap[] =
-{
+xtensa_register_t xtensa_rmap[] = {
/* idx ofs bi sz al targno flags cp typ group name */
- XTREG( 0, 0,32, 4, 4,0x0020,0x0006,-2, 9,0x0100,pc, 0,0,0,0,0,0)
- XTREG( 1, 4,32, 4, 4,0x0100,0x0006,-2, 1,0x0002,ar0, 0,0,0,0,0,0)
- XTREG( 2, 8,32, 4, 4,0x0101,0x0006,-2, 1,0x0002,ar1, 0,0,0,0,0,0)
- XTREG( 3, 12,32, 4, 4,0x0102,0x0006,-2, 1,0x0002,ar2, 0,0,0,0,0,0)
- XTREG( 4, 16,32, 4, 4,0x0103,0x0006,-2, 1,0x0002,ar3, 0,0,0,0,0,0)
- XTREG( 5, 20,32, 4, 4,0x0104,0x0006,-2, 1,0x0002,ar4, 0,0,0,0,0,0)
- XTREG( 6, 24,32, 4, 4,0x0105,0x0006,-2, 1,0x0002,ar5, 0,0,0,0,0,0)
- XTREG( 7, 28,32, 4, 4,0x0106,0x0006,-2, 1,0x0002,ar6, 0,0,0,0,0,0)
- XTREG( 8, 32,32, 4, 4,0x0107,0x0006,-2, 1,0x0002,ar7, 0,0,0,0,0,0)
- XTREG( 9, 36,32, 4, 4,0x0108,0x0006,-2, 1,0x0002,ar8, 0,0,0,0,0,0)
- XTREG( 10, 40,32, 4, 4,0x0109,0x0006,-2, 1,0x0002,ar9, 0,0,0,0,0,0)
- XTREG( 11, 44,32, 4, 4,0x010a,0x0006,-2, 1,0x0002,ar10, 0,0,0,0,0,0)
- XTREG( 12, 48,32, 4, 4,0x010b,0x0006,-2, 1,0x0002,ar11, 0,0,0,0,0,0)
- XTREG( 13, 52,32, 4, 4,0x010c,0x0006,-2, 1,0x0002,ar12, 0,0,0,0,0,0)
- XTREG( 14, 56,32, 4, 4,0x010d,0x0006,-2, 1,0x0002,ar13, 0,0,0,0,0,0)
- XTREG( 15, 60,32, 4, 4,0x010e,0x0006,-2, 1,0x0002,ar14, 0,0,0,0,0,0)
- XTREG( 16, 64,32, 4, 4,0x010f,0x0006,-2, 1,0x0002,ar15, 0,0,0,0,0,0)
- XTREG( 17, 68,32, 4, 4,0x0110,0x0006,-2, 1,0x0002,ar16, 0,0,0,0,0,0)
- XTREG( 18, 72,32, 4, 4,0x0111,0x0006,-2, 1,0x0002,ar17, 0,0,0,0,0,0)
- XTREG( 19, 76,32, 4, 4,0x0112,0x0006,-2, 1,0x0002,ar18, 0,0,0,0,0,0)
- XTREG( 20, 80,32, 4, 4,0x0113,0x0006,-2, 1,0x0002,ar19, 0,0,0,0,0,0)
- XTREG( 21, 84,32, 4, 4,0x0114,0x0006,-2, 1,0x0002,ar20, 0,0,0,0,0,0)
- XTREG( 22, 88,32, 4, 4,0x0115,0x0006,-2, 1,0x0002,ar21, 0,0,0,0,0,0)
- XTREG( 23, 92,32, 4, 4,0x0116,0x0006,-2, 1,0x0002,ar22, 0,0,0,0,0,0)
- XTREG( 24, 96,32, 4, 4,0x0117,0x0006,-2, 1,0x0002,ar23, 0,0,0,0,0,0)
- XTREG( 25,100,32, 4, 4,0x0118,0x0006,-2, 1,0x0002,ar24, 0,0,0,0,0,0)
- XTREG( 26,104,32, 4, 4,0x0119,0x0006,-2, 1,0x0002,ar25, 0,0,0,0,0,0)
- XTREG( 27,108,32, 4, 4,0x011a,0x0006,-2, 1,0x0002,ar26, 0,0,0,0,0,0)
- XTREG( 28,112,32, 4, 4,0x011b,0x0006,-2, 1,0x0002,ar27, 0,0,0,0,0,0)
- XTREG( 29,116,32, 4, 4,0x011c,0x0006,-2, 1,0x0002,ar28, 0,0,0,0,0,0)
- XTREG( 30,120,32, 4, 4,0x011d,0x0006,-2, 1,0x0002,ar29, 0,0,0,0,0,0)
- XTREG( 31,124,32, 4, 4,0x011e,0x0006,-2, 1,0x0002,ar30, 0,0,0,0,0,0)
- XTREG( 32,128,32, 4, 4,0x011f,0x0006,-2, 1,0x0002,ar31, 0,0,0,0,0,0)
- XTREG( 33,132,32, 4, 4,0x0200,0x0006,-2, 2,0x1100,lbeg, 0,0,0,0,0,0)
- XTREG( 34,136,32, 4, 4,0x0201,0x0006,-2, 2,0x1100,lend, 0,0,0,0,0,0)
- XTREG( 35,140,32, 4, 4,0x0202,0x0006,-2, 2,0x1100,lcount, 0,0,0,0,0,0)
- XTREG( 36,144, 6, 4, 4,0x0203,0x0006,-2, 2,0x1100,sar, 0,0,0,0,0,0)
- XTREG( 37,148,32, 4, 4,0x0205,0x0006,-2, 2,0x1100,litbase, 0,0,0,0,0,0)
- XTREG( 38,152, 3, 4, 4,0x0248,0x0006,-2, 2,0x1002,windowbase, 0,0,0,0,0,0)
- XTREG( 39,156, 8, 4, 4,0x0249,0x0006,-2, 2,0x1002,windowstart, 0,0,0,0,0,0)
- XTREG( 40,160,32, 4, 4,0x02b0,0x0002,-2, 2,0x1000,sr176, 0,0,0,0,0,0)
- XTREG( 41,164,32, 4, 4,0x02d0,0x0002,-2, 2,0x1000,sr208, 0,0,0,0,0,0)
- XTREG( 42,168,19, 4, 4,0x02e6,0x0006,-2, 2,0x1100,ps, 0,0,0,0,0,0)
- XTREG( 43,172,32, 4, 4,0x03e7,0x0006,-2, 3,0x0110,threadptr, 0,0,0,0,0,0)
- XTREG( 44,176,32, 4, 4,0x020c,0x0006,-1, 2,0x1100,scompare1, 0,0,0,0,0,0)
- XTREG( 45,180,32, 4, 4,0x0253,0x0007,-2, 2,0x1000,ptevaddr, 0,0,0,0,0,0)
- XTREG( 46,184,32, 4, 4,0x0259,0x000d,-2, 2,0x1000,mmid, 0,0,0,0,0,0)
- XTREG( 47,188,32, 4, 4,0x025a,0x0007,-2, 2,0x1000,rasid, 0,0,0,0,0,0)
- XTREG( 48,192,18, 4, 4,0x025b,0x0007,-2, 2,0x1000,itlbcfg, 0,0,0,0,0,0)
- XTREG( 49,196,18, 4, 4,0x025c,0x0007,-2, 2,0x1000,dtlbcfg, 0,0,0,0,0,0)
- XTREG( 50,200, 2, 4, 4,0x0260,0x0007,-2, 2,0x1000,ibreakenable,0,0,0,0,0,0)
- XTREG( 51,204,32, 4, 4,0x0268,0x0007,-2, 2,0x1000,ddr, 0,0,0,0,0,0)
- XTREG( 52,208,32, 4, 4,0x0280,0x0007,-2, 2,0x1000,ibreaka0, 0,0,0,0,0,0)
- XTREG( 53,212,32, 4, 4,0x0281,0x0007,-2, 2,0x1000,ibreaka1, 0,0,0,0,0,0)
- XTREG( 54,216,32, 4, 4,0x0290,0x0007,-2, 2,0x1000,dbreaka0, 0,0,0,0,0,0)
- XTREG( 55,220,32, 4, 4,0x0291,0x0007,-2, 2,0x1000,dbreaka1, 0,0,0,0,0,0)
- XTREG( 56,224,32, 4, 4,0x02a0,0x0007,-2, 2,0x1000,dbreakc0, 0,0,0,0,0,0)
- XTREG( 57,228,32, 4, 4,0x02a1,0x0007,-2, 2,0x1000,dbreakc1, 0,0,0,0,0,0)
- XTREG( 58,232,32, 4, 4,0x02b1,0x0007,-2, 2,0x1000,epc1, 0,0,0,0,0,0)
- XTREG( 59,236,32, 4, 4,0x02b2,0x0007,-2, 2,0x1000,epc2, 0,0,0,0,0,0)
- XTREG( 60,240,32, 4, 4,0x02b3,0x0007,-2, 2,0x1000,epc3, 0,0,0,0,0,0)
- XTREG( 61,244,32, 4, 4,0x02b4,0x0007,-2, 2,0x1000,epc4, 0,0,0,0,0,0)
- XTREG( 62,248,32, 4, 4,0x02b5,0x0007,-2, 2,0x1000,epc5, 0,0,0,0,0,0)
- XTREG( 63,252,32, 4, 4,0x02b6,0x0007,-2, 2,0x1000,epc6, 0,0,0,0,0,0)
- XTREG( 64,256,32, 4, 4,0x02b7,0x0007,-2, 2,0x1000,epc7, 0,0,0,0,0,0)
- XTREG( 65,260,32, 4, 4,0x02c0,0x0007,-2, 2,0x1000,depc, 0,0,0,0,0,0)
- XTREG( 66,264,19, 4, 4,0x02c2,0x0007,-2, 2,0x1000,eps2, 0,0,0,0,0,0)
- XTREG( 67,268,19, 4, 4,0x02c3,0x0007,-2, 2,0x1000,eps3, 0,0,0,0,0,0)
- XTREG( 68,272,19, 4, 4,0x02c4,0x0007,-2, 2,0x1000,eps4, 0,0,0,0,0,0)
- XTREG( 69,276,19, 4, 4,0x02c5,0x0007,-2, 2,0x1000,eps5, 0,0,0,0,0,0)
- XTREG( 70,280,19, 4, 4,0x02c6,0x0007,-2, 2,0x1000,eps6, 0,0,0,0,0,0)
- XTREG( 71,284,19, 4, 4,0x02c7,0x0007,-2, 2,0x1000,eps7, 0,0,0,0,0,0)
- XTREG( 72,288,32, 4, 4,0x02d1,0x0007,-2, 2,0x1000,excsave1, 0,0,0,0,0,0)
- XTREG( 73,292,32, 4, 4,0x02d2,0x0007,-2, 2,0x1000,excsave2, 0,0,0,0,0,0)
- XTREG( 74,296,32, 4, 4,0x02d3,0x0007,-2, 2,0x1000,excsave3, 0,0,0,0,0,0)
- XTREG( 75,300,32, 4, 4,0x02d4,0x0007,-2, 2,0x1000,excsave4, 0,0,0,0,0,0)
- XTREG( 76,304,32, 4, 4,0x02d5,0x0007,-2, 2,0x1000,excsave5, 0,0,0,0,0,0)
- XTREG( 77,308,32, 4, 4,0x02d6,0x0007,-2, 2,0x1000,excsave6, 0,0,0,0,0,0)
- XTREG( 78,312,32, 4, 4,0x02d7,0x0007,-2, 2,0x1000,excsave7, 0,0,0,0,0,0)
- XTREG( 79,316, 8, 4, 4,0x02e0,0x0007,-2, 2,0x1000,cpenable, 0,0,0,0,0,0)
- XTREG( 80,320,22, 4, 4,0x02e2,0x000b,-2, 2,0x1000,interrupt, 0,0,0,0,0,0)
- XTREG( 81,324,22, 4, 4,0x02e2,0x000d,-2, 2,0x1000,intset, 0,0,0,0,0,0)
- XTREG( 82,328,22, 4, 4,0x02e3,0x000d,-2, 2,0x1000,intclear, 0,0,0,0,0,0)
- XTREG( 83,332,22, 4, 4,0x02e4,0x0007,-2, 2,0x1000,intenable, 0,0,0,0,0,0)
- XTREG( 84,336,32, 4, 4,0x02e7,0x0007,-2, 2,0x1000,vecbase, 0,0,0,0,0,0)
- XTREG( 85,340, 6, 4, 4,0x02e8,0x0007,-2, 2,0x1000,exccause, 0,0,0,0,0,0)
- XTREG( 86,344,12, 4, 4,0x02e9,0x0003,-2, 2,0x1000,debugcause, 0,0,0,0,0,0)
- XTREG( 87,348,32, 4, 4,0x02ea,0x000f,-2, 2,0x1000,ccount, 0,0,0,0,0,0)
- XTREG( 88,352,32, 4, 4,0x02eb,0x0003,-2, 2,0x1000,prid, 0,0,0,0,0,0)
- XTREG( 89,356,32, 4, 4,0x02ec,0x000f,-2, 2,0x1000,icount, 0,0,0,0,0,0)
- XTREG( 90,360, 4, 4, 4,0x02ed,0x0007,-2, 2,0x1000,icountlevel, 0,0,0,0,0,0)
- XTREG( 91,364,32, 4, 4,0x02ee,0x0007,-2, 2,0x1000,excvaddr, 0,0,0,0,0,0)
- XTREG( 92,368,32, 4, 4,0x02f0,0x000f,-2, 2,0x1000,ccompare0, 0,0,0,0,0,0)
- XTREG( 93,372,32, 4, 4,0x02f1,0x000f,-2, 2,0x1000,ccompare1, 0,0,0,0,0,0)
- XTREG( 94,376,32, 4, 4,0x02f2,0x000f,-2, 2,0x1000,ccompare2, 0,0,0,0,0,0)
- XTREG( 95,380,32, 4, 4,0x02f4,0x0007,-2, 2,0x1000,misc0, 0,0,0,0,0,0)
- XTREG( 96,384,32, 4, 4,0x02f5,0x0007,-2, 2,0x1000,misc1, 0,0,0,0,0,0)
- XTREG( 97,388,32, 4, 4,0x0000,0x0006,-2, 8,0x0100,a0, 0,0,0,0,0,0)
- XTREG( 98,392,32, 4, 4,0x0001,0x0006,-2, 8,0x0100,a1, 0,0,0,0,0,0)
- XTREG( 99,396,32, 4, 4,0x0002,0x0006,-2, 8,0x0100,a2, 0,0,0,0,0,0)
- XTREG(100,400,32, 4, 4,0x0003,0x0006,-2, 8,0x0100,a3, 0,0,0,0,0,0)
- XTREG(101,404,32, 4, 4,0x0004,0x0006,-2, 8,0x0100,a4, 0,0,0,0,0,0)
- XTREG(102,408,32, 4, 4,0x0005,0x0006,-2, 8,0x0100,a5, 0,0,0,0,0,0)
- XTREG(103,412,32, 4, 4,0x0006,0x0006,-2, 8,0x0100,a6, 0,0,0,0,0,0)
- XTREG(104,416,32, 4, 4,0x0007,0x0006,-2, 8,0x0100,a7, 0,0,0,0,0,0)
- XTREG(105,420,32, 4, 4,0x0008,0x0006,-2, 8,0x0100,a8, 0,0,0,0,0,0)
- XTREG(106,424,32, 4, 4,0x0009,0x0006,-2, 8,0x0100,a9, 0,0,0,0,0,0)
- XTREG(107,428,32, 4, 4,0x000a,0x0006,-2, 8,0x0100,a10, 0,0,0,0,0,0)
- XTREG(108,432,32, 4, 4,0x000b,0x0006,-2, 8,0x0100,a11, 0,0,0,0,0,0)
- XTREG(109,436,32, 4, 4,0x000c,0x0006,-2, 8,0x0100,a12, 0,0,0,0,0,0)
- XTREG(110,440,32, 4, 4,0x000d,0x0006,-2, 8,0x0100,a13, 0,0,0,0,0,0)
- XTREG(111,444,32, 4, 4,0x000e,0x0006,-2, 8,0x0100,a14, 0,0,0,0,0,0)
- XTREG(112,448,32, 4, 4,0x000f,0x0006,-2, 8,0x0100,a15, 0,0,0,0,0,0)
- XTREG(113,452, 4, 4, 4,0x2008,0x0006,-2, 6,0x1010,psintlevel,
- 0,0,&xtensa_mask0,0,0,0)
- XTREG(114,456, 1, 4, 4,0x2009,0x0006,-2, 6,0x1010,psum,
- 0,0,&xtensa_mask1,0,0,0)
- XTREG(115,460, 1, 4, 4,0x200a,0x0006,-2, 6,0x1010,pswoe,
- 0,0,&xtensa_mask2,0,0,0)
- XTREG(116,464, 2, 4, 4,0x200b,0x0006,-2, 6,0x1010,psring,
- 0,0,&xtensa_mask3,0,0,0)
- XTREG(117,468, 1, 4, 4,0x200c,0x0006,-2, 6,0x1010,psexcm,
- 0,0,&xtensa_mask4,0,0,0)
- XTREG(118,472, 2, 4, 4,0x200d,0x0006,-2, 6,0x1010,pscallinc,
- 0,0,&xtensa_mask5,0,0,0)
- XTREG(119,476, 4, 4, 4,0x200e,0x0006,-2, 6,0x1010,psowb,
- 0,0,&xtensa_mask6,0,0,0)
- XTREG(120,480,20, 4, 4,0x200f,0x0006,-2, 6,0x1010,litbaddr,
- 0,0,&xtensa_mask7,0,0,0)
- XTREG(121,484, 1, 4, 4,0x2010,0x0006,-2, 6,0x1010,litben,
- 0,0,&xtensa_mask8,0,0,0)
- XTREG(122,488, 4, 4, 4,0x2015,0x0006,-2, 6,0x1010,dbnum,
- 0,0,&xtensa_mask9,0,0,0)
- XTREG(123,492, 8, 4, 4,0x2016,0x0006,-2, 6,0x1010,asid3,
- 0,0,&xtensa_mask10,0,0,0)
- XTREG(124,496, 8, 4, 4,0x2017,0x0006,-2, 6,0x1010,asid2,
- 0,0,&xtensa_mask11,0,0,0)
- XTREG(125,500, 8, 4, 4,0x2018,0x0006,-2, 6,0x1010,asid1,
- 0,0,&xtensa_mask12,0,0,0)
- XTREG(126,504, 2, 4, 4,0x2019,0x0006,-2, 6,0x1010,instpgszid4,
- 0,0,&xtensa_mask13,0,0,0)
- XTREG(127,508, 2, 4, 4,0x201a,0x0006,-2, 6,0x1010,datapgszid4,
- 0,0,&xtensa_mask14,0,0,0)
- XTREG(128,512,10, 4, 4,0x201b,0x0006,-2, 6,0x1010,ptbase,
- 0,0,&xtensa_mask15,0,0,0)
- XTREG_END
+ XTREG (0, 0, 32, 4, 4, 0x0020, 0x0006, -2, 9, 0x0100, pc, 0, 0, 0, 0, 0,
+ 0) XTREG (1, 4, 32, 4, 4, 0x0100, 0x0006, -2, 1, 0x0002, ar0, 0, 0, 0,
+ 0, 0, 0) XTREG (2, 8, 32, 4, 4, 0x0101, 0x0006, -2, 1,
+ 0x0002, ar1, 0, 0, 0, 0, 0, 0)
+ XTREG (3, 12, 32, 4, 4, 0x0102, 0x0006, -2, 1, 0x0002, ar2, 0, 0, 0, 0, 0,
+ 0) XTREG (4, 16, 32, 4, 4, 0x0103, 0x0006, -2, 1, 0x0002, ar3, 0, 0,
+ 0, 0, 0, 0) XTREG (5, 20, 32, 4, 4, 0x0104, 0x0006, -2, 1,
+ 0x0002, ar4, 0, 0, 0, 0, 0, 0)
+ XTREG (6, 24, 32, 4, 4, 0x0105, 0x0006, -2, 1, 0x0002, ar5, 0, 0, 0, 0,
+ 0, 0) XTREG (7, 28, 32, 4, 4, 0x0106, 0x0006, -2, 1, 0x0002, ar6,
+ 0, 0, 0, 0, 0, 0)
+ XTREG (8, 32, 32, 4, 4, 0x0107, 0x0006, -2, 1, 0x0002, ar7, 0, 0, 0, 0,
+ 0, 0) XTREG (9, 36, 32, 4, 4, 0x0108, 0x0006, -2, 1, 0x0002,
+ ar8, 0, 0, 0, 0, 0, 0)
+ XTREG (10, 40, 32, 4, 4, 0x0109, 0x0006, -2, 1, 0x0002, ar9, 0, 0, 0,
+ 0, 0, 0) XTREG (11, 44, 32, 4, 4, 0x010a, 0x0006, -2, 1,
+ 0x0002, ar10, 0, 0, 0, 0, 0, 0)
+ XTREG (12, 48, 32, 4, 4, 0x010b, 0x0006, -2, 1, 0x0002, ar11, 0, 0,
+ 0, 0, 0, 0) XTREG (13, 52, 32, 4, 4, 0x010c, 0x0006, -2, 1,
+ 0x0002, ar12, 0, 0, 0, 0, 0, 0)
+ XTREG (14, 56, 32, 4, 4, 0x010d, 0x0006, -2, 1, 0x0002, ar13, 0,
+ 0, 0, 0, 0, 0) XTREG (15, 60, 32, 4, 4, 0x010e, 0x0006,
+ -2, 1, 0x0002, ar14, 0, 0, 0, 0, 0,
+ 0)
+ XTREG (16, 64, 32, 4, 4, 0x010f, 0x0006, -2, 1, 0x0002, ar15,
+ 0, 0, 0, 0, 0,
+ 0) XTREG (17, 68, 32, 4, 4, 0x0110, 0x0006, -2, 1,
+ 0x0002, ar16, 0, 0, 0, 0, 0, 0)
+ XTREG (18, 72, 32, 4, 4, 0x0111, 0x0006, -2, 1, 0x0002, ar17,
+ 0, 0, 0, 0,
+ 0, 0) XTREG (19, 76, 32, 4, 4, 0x0112, 0x0006, -2,
+ 1, 0x0002, ar18, 0, 0, 0, 0, 0, 0)
+ XTREG (20, 80, 32, 4, 4, 0x0113, 0x0006, -2, 1, 0x0002,
+ ar19, 0, 0, 0, 0,
+ 0, 0) XTREG (21, 84, 32, 4, 4, 0x0114, 0x0006, -2,
+ 1, 0x0002, ar20, 0, 0, 0, 0, 0, 0)
+ XTREG (22, 88, 32, 4, 4, 0x0115, 0x0006, -2,
+ 1, 0x0002, ar21, 0, 0, 0, 0,
+ 0, 0) XTREG (23, 92, 32, 4, 4, 0x0116, 0x0006, -2,
+ 1, 0x0002, ar22, 0, 0, 0, 0, 0, 0)
+ XTREG (24, 96, 32, 4, 4, 0x0117, 0x0006, -2,
+ 1, 0x0002, ar23, 0, 0, 0, 0, 0, 0)
+ XTREG (25, 100, 32, 4, 4, 0x0118, 0x0006, -2,
+ 1, 0x0002, ar24, 0, 0, 0, 0, 0, 0)
+ XTREG (26, 104, 32, 4, 4, 0x0119, 0x0006, -2,
+ 1, 0x0002, ar25, 0, 0, 0, 0, 0, 0)
+ XTREG (27, 108, 32, 4, 4, 0x011a, 0x0006, -2, 1,
+ 0x0002, ar26, 0, 0, 0, 0, 0, 0)
+ XTREG (28, 112, 32, 4, 4, 0x011b, 0x0006, -2,
+ 1, 0x0002, ar27, 0, 0, 0, 0, 0, 0)
+ XTREG (29, 116, 32, 4, 4, 0x011c, 0x0006, -2,
+ 1, 0x0002, ar28, 0, 0, 0, 0, 0, 0)
+ XTREG (30, 120, 32, 4, 4, 0x011d, 0x0006,
+ -2, 1, 0x0002, ar29, 0, 0, 0, 0, 0,
+ 0) XTREG (31, 124, 32, 4, 4, 0x011e,
+ 0x0006, -2, 1, 0x0002,
+ ar30, 0, 0, 0, 0, 0, 0)
+ XTREG (32, 128, 32, 4, 4, 0x011f, 0x0006,
+ -2, 1, 0x0002, ar31, 0, 0, 0, 0,
+ 0, 0) XTREG (33, 132, 32, 4, 4,
+ 0x0200, 0x0006, -2,
+ 2, 0x1100, lbeg, 0,
+ 0, 0, 0, 0, 0)
+ XTREG (34, 136, 32, 4, 4, 0x0201,
+ 0x0006, -2, 2, 0x1100, lend, 0,
+ 0, 0, 0,
+ 0, 0) XTREG (35, 140, 32, 4, 4,
+ 0x0202, 0x0006, -2,
+ 2, 0x1100, lcount,
+ 0, 0, 0, 0, 0, 0)
+ XTREG (36, 144, 6, 4, 4, 0x0203,
+ 0x0006, -2, 2, 0x1100, sar, 0,
+ 0, 0, 0, 0, 0)
+ XTREG (37, 148, 32, 4, 4, 0x0205,
+ 0x0006, -2, 2, 0x1100,
+ litbase, 0, 0, 0, 0, 0, 0)
+ XTREG (38, 152, 3, 4, 4, 0x0248,
+ 0x0006, -2, 2, 0x1002,
+ windowbase, 0, 0, 0, 0, 0,
+ 0)
+ XTREG (39, 156, 8, 4, 4,
+ 0x0249, 0x0006, -2, 2,
+ 0x1002, windowstart, 0,
+ 0, 0, 0, 0, 0)
+ XTREG (40, 160, 32, 4, 4,
+ 0x02b0, 0x0002, -2, 2,
+ 0x1000, sr176, 0, 0,
+ 0, 0, 0, 0)
+ XTREG (41, 164, 32, 4, 4,
+ 0x02d0, 0x0002, -2,
+ 2, 0x1000, sr208, 0,
+ 0, 0, 0, 0, 0)
+ XTREG (42, 168, 19, 4, 4,
+ 0x02e6, 0x0006,
+ -2, 2, 0x1100, ps,
+ 0, 0, 0, 0, 0, 0)
+ XTREG (43, 172, 32, 4,
+ 4, 0x03e7,
+ 0x0006, -2, 3,
+ 0x0110,
+ threadptr, 0, 0,
+ 0, 0, 0, 0)
+ XTREG (44, 176, 32,
+ 4, 4, 0x020c,
+ 0x0006, -1, 2,
+ 0x1100,
+ scompare1, 0,
+ 0, 0, 0, 0, 0)
+ XTREG (
+ 45, 180, 32, 4,
+ 4, 0x0253,
+ 0x0007, -2, 2,
+ 0x1000, ptevaddr,
+ 0, 0, 0, 0, 0, 0)
+ XTREG (
+ 46, 184, 32, 4,
+ 4, 0x0259,
+ 0x000d, -2, 2,
+ 0x1000, mmid,
+ 0, 0, 0, 0, 0,
+ 0)
+ XTREG (
+ 47, 188, 32,
+ 4, 4, 0x025a,
+ 0x0007, -2,
+ 2, 0x1000,
+ rasid, 0, 0,
+ 0, 0, 0, 0)
+ XTREG (
+ 48, 192,
+ 18, 4, 4,
+ 0x025b,
+ 0x0007, -2,
+ 2, 0x1000,
+ itlbcfg, 0,
+ 0, 0, 0, 0,
+ 0) XTREG (49,
+ 196,
+ 18, 4, 4, 0x025c, 0x0007, -2, 2, 0x1000, dtlbcfg, 0, 0, 0, 0, 0, 0) XTREG (50, 200, 2, 4, 4, 0x0260, 0x0007, -2, 2, 0x1000, ibreakenable, 0, 0, 0, 0, 0, 0) XTREG (51,
+ 204,
+ 32, 4, 4, 0x0268, 0x0007, -2, 2, 0x1000, ddr, 0, 0, 0, 0, 0, 0) XTREG (52, 208, 32, 4, 4, 0x0280, 0x0007, -2,
+ 2,
+ 0x1000,
+ ibreaka0,
+ 0,
+ 0, 0, 0, 0, 0) XTREG (53, 212, 32, 4, 4, 0x0281, 0x0007, -2, 2, 0x1000, ibreaka1, 0, 0, 0,
+ 0,
+ 0,
+ 0) XTREG (54,
+ 216,
+ 32,
+ 4, 4, 0x0290, 0x0007, -2, 2, 0x1000, dbreaka0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0) XTREG (55,
+ 220,
+ 32,
+ 4, 4, 0x0291, 0x0007, -2,
+ 2,
+ 0x1000,
+ dbreaka1, 0, 0, 0, 0,
+ 0,
+ 0) XTREG (56,
+ 224,
+ 32, 4,
+ 4, 0x02a0, 0x0007, -2, 2, 0x1000, dbreakc0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0, 0) XTREG (57,
+ 228,
+ 32,
+ 4, 4, 0x02a1,
+ 0x0007,
+ -2,
+ 2, 0x1000,
+ dbreakc1, 0, 0, 0,
+ 0, 0, 0) XTREG (58,
+ 232,
+ 32,
+ 4, 4, 0x02b1, 0x0007, -2, 2, 0x1000, epc1, 0, 0, 0, 0,
+ 0, 0) XTREG (59,
+ 236,
+ 32, 4,
+ 4, 0x02b2,
+ 0x0007,
+ -2,
+ 2,
+ 0x1000,
+ epc2,
+ 0, 0, 0, 0, 0, 0) XTREG (60,
+ 240,
+ 32, 4,
+ 4,
+ 0x02b3,
+ 0x0007, -2, 2,
+ 0x1000,
+ epc3, 0, 0, 0, 0,
+ 0,
+ 0) XTREG (61,
+ 244, 32, 4, 4, 0x02b4, 0x0007, -2,
+ 2,
+ 0x1000,
+ epc4,
+ 0,
+ 0, 0, 0, 0, 0) XTREG (62,
+ 248,
+ 32,
+ 4,
+ 4,
+ 0x02b5,
+ 0x0007, -2,
+ 2,
+ 0x1000,
+ epc5, 0, 0,
+ 0,
+ 0, 0, 0) XTREG (63,
+ 252,
+ 32,
+ 4,
+ 4,
+ 0x02b6, 0x0007, -2, 2, 0x1000,
+ epc6,
+ 0,
+ 0,
+ 0,
+ 0, 0, 0) XTREG (64,
+ 256,
+ 32, 4, 4, 0x02b7, 0x0007, -2,
+ 2, 0x1000, epc7, 0, 0, 0, 0, 0, 0) XTREG (65,
+ 260, 32, 4, 4, 0x02c0, 0x0007, -2,
+ 2, 0x1000, depc, 0, 0, 0, 0, 0,
+ 0) XTREG (66, 264, 19, 4, 4, 0x02c2, 0x0007,
+ -2,
+ 2,
+ 0x1000,
+ eps2,
+ 0,
+ 0,
+ 0, 0, 0,
+ 0) XTREG (67,
+ 268,
+ 19,
+ 4,
+ 4,
+ 0x02c3,
+ 0x0007,
+ -2,
+ 2,
+ 0x1000,
+ eps3,
+ 0,
+ 0,
+ 0,
+ 0, 0, 0) XTREG (68,
+ 272, 19, 4, 4, 0x02c4,
+ 0x0007,
+ -2,
+ 2, 0x1000, eps4, 0, 0, 0,
+ 0, 0, 0) XTREG (69,
+ 276, 19, 4, 4, 0x02c5, 0x0007, -2, 2, 0x1000, eps5, 0,
+ 0, 0, 0, 0, 0) XTREG (70,
+ 280,
+ 19,
+ 4,
+ 4,
+ 0x02c6,
+ 0x0007,
+ -2,
+ 2, 0x1000,
+ eps6, 0, 0,
+ 0,
+ 0,
+ 0, 0) XTREG (71,
+ 284,
+ 19, 4, 4, 0x02c7, 0x0007, -2, 2, 0x1000,
+ eps7,
+ 0,
+ 0, 0, 0, 0, 0) XTREG (72,
+ 288, 32, 4,
+ 4,
+ 0x02d1,
+ 0x0007, -2, 2, 0x1000, excsave1, 0, 0, 0, 0, 0, 0) XTREG (73,
+ 292,
+ 32, 4, 4, 0x02d2, 0x0007, -2, 2, 0x1000,
+ excsave2, 0, 0, 0, 0, 0, 0) XTREG (74,
+ 296,
+ 32,
+ 4,
+ 4,
+ 0x02d3, 0x0007, -2, 2, 0x1000, excsave3,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0) XTREG (75,
+ 300,
+ 32,
+ 4,
+ 4,
+ 0x02d4, 0x0007, -2,
+ 2,
+ 0x1000,
+ excsave4, 0, 0, 0, 0, 0, 0) XTREG (76,
+ 304,
+ 32,
+ 4,
+ 4, 0x02d5,
+ 0x0007,
+ -2,
+ 2,
+ 0x1000, excsave5, 0, 0, 0,
+ 0,
+ 0,
+ 0) XTREG (77,
+ 308,
+ 32,
+ 4,
+ 4,
+ 0x02d6,
+ 0x0007,
+ -2,
+ 2,
+ 0x1000,
+ excsave6,
+ 0, 0, 0, 0, 0, 0) XTREG (78,
+ 312, 32, 4, 4, 0x02d7, 0x0007, -2, 2, 0x1000, excsave7, 0,
+ 0, 0, 0, 0, 0) XTREG (79, 316, 8, 4, 4, 0x02e0, 0x0007, -2, 2, 0x1000, cpenable, 0, 0, 0, 0,
+ 0,
+ 0) XTREG (80,
+ 320,
+ 22, 4, 4,
+ 0x02e2,
+ 0x000b,
+ -2, 2,
+ 0x1000,
+ interrupt,
+ 0,
+ 0,
+ 0,
+ 0, 0, 0) XTREG (81,
+ 324, 22, 4, 4, 0x02e2, 0x000d, -2,
+ 2, 0x1000, intset, 0, 0, 0, 0, 0,
+ 0) XTREG (82,
+ 328,
+ 22,
+ 4, 4, 0x02e3, 0x000d,
+ -2,
+ 2, 0x1000, intclear,
+ 0, 0, 0, 0, 0, 0) XTREG (83,
+ 332, 22, 4, 4, 0x02e4, 0x0007, -2, 2, 0x1000, intenable, 0, 0, 0, 0, 0,
+ 0) XTREG (84,
+ 336,
+ 32,
+ 4,
+ 4,
+ 0x02e7, 0x0007, -2, 2, 0x1000, vecbase, 0, 0, 0, 0,
+ 0,
+ 0) XTREG (85,
+ 340,
+ 6, 4, 4, 0x02e8, 0x0007, -2, 2,
+ 0x1000,
+ exccause, 0, 0, 0, 0, 0,
+ 0) XTREG (86,
+ 344, 12, 4,
+ 4, 0x02e9, 0x0003, -2, 2, 0x1000, debugcause, 0, 0, 0, 0, 0, 0) XTREG (87,
+ 348,
+ 32,
+ 4,
+ 4, 0x02ea, 0x000f, -2, 2, 0x1000, ccount, 0, 0, 0, 0, 0,
+ 0) XTREG (88,
+ 352,
+ 32,
+ 4,
+ 4, 0x02eb, 0x0003, -2, 2, 0x1000, prid, 0, 0, 0,
+ 0, 0, 0) XTREG (89,
+ 356,
+ 32,
+ 4, 4, 0x02ec,
+ 0x000f,
+ -2,
+ 2, 0x1000,
+ icount, 0, 0, 0, 0, 0, 0) XTREG (90, 360, 4, 4, 4, 0x02ed, 0x0007, -2, 2, 0x1000,
+ icountlevel,
+ 0,
+ 0, 0, 0, 0, 0) XTREG (91, 364, 32, 4, 4,
+ 0x02ee,
+ 0x0007,
+ -2, 2, 0x1000, excvaddr, 0, 0, 0, 0, 0, 0) XTREG (92, 368, 32, 4, 4, 0x02f0, 0x000f, -2, 2,
+ 0x1000,
+ ccompare0,
+ 0,
+ 0,
+ 0,
+ 0, 0, 0) XTREG (93,
+ 372, 32,
+ 4,
+ 4,
+ 0x02f1,
+ 0x000f,
+ -2,
+ 2,
+ 0x1000,
+ ccompare1,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0) XTREG (94,
+ 376, 32,
+ 4,
+ 4,
+ 0x02f2,
+ 0x000f,
+ -2,
+ 2, 0x1000, ccompare2, 0, 0, 0, 0, 0, 0) XTREG (95,
+ 380, 32, 4, 4, 0x02f4, 0x0007, -2,
+ 2,
+ 0x1000, misc0, 0, 0, 0, 0, 0,
+ 0) XTREG (96, 384, 32, 4, 4, 0x02f5, 0x0007, -2, 2, 0x1000,
+ misc1,
+ 0,
+ 0, 0, 0, 0, 0) XTREG (97,
+ 388,
+ 32, 4, 4, 0x0000,
+ 0x0006, -2, 8, 0x0100,
+ a0, 0, 0, 0, 0, 0,
+ 0) XTREG (98,
+ 392, 32, 4,
+ 4,
+ 0x0001,
+ 0x0006,
+ -2, 8, 0x0100, a1, 0, 0, 0, 0, 0, 0) XTREG (99,
+ 396, 32, 4, 4, 0x0002,
+ 0x0006, -2, 8, 0x0100, a2, 0, 0,
+ 0,
+ 0,
+ 0,
+ 0) XTREG (100,
+ 400,
+ 32,
+ 4,
+ 4,
+ 0x0003,
+ 0x0006,
+ -2,
+ 8,
+ 0x0100,
+ a3, 0, 0, 0, 0, 0, 0) XTREG (101, 404, 32, 4, 4, 0x0004, 0x0006, -2, 8, 0x0100, a4, 0, 0, 0, 0,
+ 0,
+ 0) XTREG (102, 408, 32, 4, 4, 0x0005, 0x0006, -2, 8, 0x0100, a5, 0,
+ 0,
+ 0, 0, 0, 0) XTREG (103,
+ 412,
+ 32, 4,
+ 4, 0x0006,
+ 0x0006,
+ -2, 8, 0x0100,
+ a6, 0, 0,
+ 0, 0, 0, 0) XTREG (104, 416, 32, 4, 4, 0x0007, 0x0006, -2, 8, 0x0100, a7, 0, 0, 0,
+ 0,
+ 0, 0) XTREG (105, 420, 32,
+ 4,
+ 4,
+ 0x0008,
+ 0x0006, -2, 8,
+ 0x0100,
+ a8, 0, 0, 0, 0, 0, 0) XTREG (106,
+ 424,
+ 32,
+ 4,
+ 4,
+ 0x0009,
+ 0x0006, -2,
+ 8, 0x0100, a9, 0, 0, 0, 0,
+ 0, 0) XTREG (107, 428, 32, 4, 4, 0x000a, 0x0006,
+ -2, 8, 0x0100, a10, 0, 0, 0, 0, 0, 0) XTREG (108,
+ 432, 32, 4, 4, 0x000b, 0x0006, -2, 8, 0x0100, a11, 0, 0, 0,
+ 0, 0, 0) XTREG (109, 436, 32, 4, 4, 0x000c, 0x0006, -2, 8, 0x0100,
+ a12,
+ 0,
+ 0, 0,
+ 0, 0, 0) XTREG (110,
+ 440,
+ 32,
+ 4,
+ 4,
+ 0x000d,
+ 0x0006,
+ -2,
+ 8,
+ 0x0100,
+ a13,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0) XTREG (111, 444, 32, 4, 4, 0x000e, 0x0006, -2, 8, 0x0100, a14, 0, 0, 0, 0, 0, 0) XTREG (112,
+ 448,
+ 32,
+ 4,
+ 4,
+ 0x000f,
+ 0x0006, -2, 8, 0x0100,
+ a15, 0, 0, 0, 0, 0, 0) XTREG (113, 452, 4, 4,
+ 4,
+ 0x2008,
+ 0x0006, -2, 6,
+ 0x1010,
+ psintlevel,
+ 0,
+ 0,
+ &xtensa_mask0,
+ 0,
+ 0, 0) XTREG (114,
+ 456,
+ 1,
+ 4, 4, 0x2009, 0x0006, -2, 6, 0x1010,
+ psum,
+ 0,
+ 0,
+ &xtensa_mask1, 0, 0, 0) XTREG (115, 460, 1, 4, 4,
+ 0x200a, 0x0006, -2, 6,
+ 0x1010,
+ pswoe,
+ 0, 0,
+ &xtensa_mask2, 0, 0,
+ 0) XTREG (116, 464, 2,
+ 4,
+ 4,
+ 0x200b,
+ 0x0006,
+ -2,
+ 6,
+ 0x1010,
+ psring,
+ 0,
+ 0,
+ &xtensa_mask3,
+ 0,
+ 0,
+ 0) XTREG (117,
+ 468, 1, 4, 4, 0x200c, 0x0006, -2, 6,
+ 0x1010,
+ psexcm,
+ 0,
+ 0, &xtensa_mask4, 0, 0, 0) XTREG (118,
+ 472,
+ 2, 4, 4, 0x200d, 0x0006, -2, 6, 0x1010,
+ pscallinc, 0, 0, &xtensa_mask5, 0, 0, 0) XTREG (119,
+ 476,
+ 4,
+ 4,
+ 4,
+ 0x200e, 0x0006, -2, 6, 0x1010, psowb, 0,
+ 0, &xtensa_mask6,
+ 0, 0, 0) XTREG (120, 480,
+ 20,
+ 4,
+ 4,
+ 0x200f,
+ 0x0006,
+ -2,
+ 6,
+ 0x1010,
+ litbaddr,
+ 0,
+ 0,
+ &xtensa_mask7,
+ 0,
+ 0,
+ 0)
+ XTREG (
+ 121,
+ 484,
+ 1, 4,
+ 4,
+ 0x2010,
+ 0x0006,
+ -2,
+ 6,
+ 0x1010,
+ litben,
+ 0, 0,
+ &xtensa_mask8,
+ 0, 0,
+ 0)
+ XTREG (
+ 122,
+ 488, 4,
+ 4, 4,
+ 0x2015,
+ 0x0006,
+ -2,
+ 6,
+ 0x1010,
+ dbnum,
+ 0, 0,
+ &xtensa_mask9,
+ 0, 0,
+ 0)
+ XTREG (
+ 123,
+ 492,
+ 8, 4,
+ 4,
+ 0x2016,
+ 0x0006,
+ -2,
+ 6,
+ 0x1010,
+ asid3,
+ 0, 0,
+ &xtensa_mask10,
+ 0, 0,
+ 0)
+ XTREG (
+ 124,
+ 496,
+ 8,
+ 4,
+ 4,
+ 0x2017,
+ 0x0006,
+ -2,
+ 6,
+ 0x1010,
+ asid2,
+ 0,
+ 0,
+ &xtensa_mask11,
+ 0,
+ 0,
+ 0)
+ XTREG (
+ 125,
+ 500,
+ 8,
+ 4,
+ 4,
+ 0x2018,
+ 0x0006,
+ -2,
+ 6,
+ 0x1010,
+ asid1,
+ 0,
+ 0,
+ &xtensa_mask12,
+ 0,
+ 0,
+ 0)
+ XTREG (
+ 126,
+ 504,
+ 2,
+ 4,
+ 4,
+ 0x2019,
+ 0x0006,
+ -2,
+ 6,
+ 0x1010,
+ instpgszid4,
+ 0,
+ 0,
+ &xtensa_mask13,
+ 0,
+ 0,
+ 0)
+ XTREG (
+ 127,
+ 508,
+ 2,
+ 4,
+ 4,
+ 0x201a,
+ 0x0006,
+ -2,
+ 6,
+ 0x1010,
+ datapgszid4,
+ 0,
+ 0,
+ &xtensa_mask14,
+ 0,
+ 0,
+ 0)
+ XTREG (
+ 128,
+ 512,
+ 10,
+ 4,
+ 4,
+ 0x201b,
+ 0x0006,
+ -2,
+ 6,
+ 0x1010,
+ ptbase,
+ 0,
+ 0,
+ &xtensa_mask15,
+ 0,
+ 0,
+ 0)
+ XTREG_END
};
diff --git a/gdb/xtensa-linux-nat.c b/gdb/xtensa-linux-nat.c
index e3da3c6a7a5..8af09dfd569 100644
--- a/gdb/xtensa-linux-nat.c
+++ b/gdb/xtensa-linux-nat.c
@@ -48,6 +48,7 @@
class xtensa_linux_nat_target final : public linux_nat_target
{
public:
+
/* Add our register access methods. */
void fetch_registers (struct regcache *, int) override;
void store_registers (struct regcache *, int) override;
@@ -56,8 +57,8 @@ public:
static xtensa_linux_nat_target the_xtensa_linux_nat_target;
void
-fill_gregset (const struct regcache *regcache,
- gdb_gregset_t *gregsetp, int regnum)
+fill_gregset (const struct regcache *regcache, gdb_gregset_t *gregsetp,
+ int regnum)
{
int i;
xtensa_elf_gregset_t *regs = (xtensa_elf_gregset_t *) gregsetp;
@@ -70,55 +71,42 @@ fill_gregset (const struct regcache *regcache,
regcache->raw_collect (gdbarch_ps_regnum (gdbarch), &regs->ps);
if (regnum == tdep->wb_regnum || regnum == -1)
- regcache->raw_collect (tdep->wb_regnum,
- &regs->windowbase);
+ regcache->raw_collect (tdep->wb_regnum, &regs->windowbase);
if (regnum == tdep->ws_regnum || regnum == -1)
- regcache->raw_collect (tdep->ws_regnum,
- &regs->windowstart);
+ regcache->raw_collect (tdep->ws_regnum, &regs->windowstart);
if (regnum == tdep->lbeg_regnum || regnum == -1)
- regcache->raw_collect (tdep->lbeg_regnum,
- &regs->lbeg);
+ regcache->raw_collect (tdep->lbeg_regnum, &regs->lbeg);
if (regnum == tdep->lend_regnum || regnum == -1)
- regcache->raw_collect (tdep->lend_regnum,
- &regs->lend);
+ regcache->raw_collect (tdep->lend_regnum, &regs->lend);
if (regnum == tdep->lcount_regnum || regnum == -1)
- regcache->raw_collect (tdep->lcount_regnum,
- &regs->lcount);
+ regcache->raw_collect (tdep->lcount_regnum, &regs->lcount);
if (regnum == tdep->sar_regnum || regnum == -1)
- regcache->raw_collect (tdep->sar_regnum,
- &regs->sar);
+ regcache->raw_collect (tdep->sar_regnum, &regs->sar);
if (regnum == tdep->threadptr_regnum || regnum == -1)
- regcache->raw_collect (tdep->threadptr_regnum,
- &regs->threadptr);
- if (regnum >=tdep->ar_base
- && regnum < tdep->ar_base
- + tdep->num_aregs)
- regcache->raw_collect (regnum,
- &regs->ar[regnum - tdep->ar_base]);
+ regcache->raw_collect (tdep->threadptr_regnum, &regs->threadptr);
+ if (regnum >= tdep->ar_base && regnum < tdep->ar_base + tdep->num_aregs)
+ regcache->raw_collect (regnum, &regs->ar[regnum - tdep->ar_base]);
else if (regnum == -1)
{
for (i = 0; i < tdep->num_aregs; ++i)
- regcache->raw_collect (tdep->ar_base + i,
- &regs->ar[i]);
+ regcache->raw_collect (tdep->ar_base + i, &regs->ar[i]);
}
- if (regnum >= tdep->a0_base
- && regnum < tdep->a0_base + C0_NREGS)
- regcache->raw_collect (regnum,
- &regs->ar[(4 * regs->windowbase + regnum
- - tdep->a0_base)
- % tdep->num_aregs]);
+ if (regnum >= tdep->a0_base && regnum < tdep->a0_base + C0_NREGS)
+ regcache->raw_collect (
+ regnum, &regs->ar[(4 * regs->windowbase + regnum - tdep->a0_base)
+ % tdep->num_aregs]);
else if (regnum == -1)
{
for (i = 0; i < C0_NREGS; ++i)
- regcache->raw_collect (tdep->a0_base + i,
- (&regs->ar[(4 * regs->windowbase + i)
- % tdep->num_aregs]));
+ regcache->raw_collect (
+ tdep->a0_base + i,
+ (&regs->ar[(4 * regs->windowbase + i) % tdep->num_aregs]));
}
}
static void
-supply_gregset_reg (struct regcache *regcache,
- const gdb_gregset_t *gregsetp, int regnum)
+supply_gregset_reg (struct regcache *regcache, const gdb_gregset_t *gregsetp,
+ int regnum)
{
int i;
xtensa_elf_gregset_t *regs = (xtensa_elf_gregset_t *) gregsetp;
@@ -132,49 +120,36 @@ supply_gregset_reg (struct regcache *regcache,
regcache->raw_supply (gdbarch_ps_regnum (gdbarch), &regs->ps);
if (regnum == tdep->wb_regnum || regnum == -1)
- regcache->raw_supply (tdep->wb_regnum,
- &regs->windowbase);
+ regcache->raw_supply (tdep->wb_regnum, &regs->windowbase);
if (regnum == tdep->ws_regnum || regnum == -1)
- regcache->raw_supply (tdep->ws_regnum,
- &regs->windowstart);
+ regcache->raw_supply (tdep->ws_regnum, &regs->windowstart);
if (regnum == tdep->lbeg_regnum || regnum == -1)
- regcache->raw_supply (tdep->lbeg_regnum,
- &regs->lbeg);
+ regcache->raw_supply (tdep->lbeg_regnum, &regs->lbeg);
if (regnum == tdep->lend_regnum || regnum == -1)
- regcache->raw_supply (tdep->lend_regnum,
- &regs->lend);
+ regcache->raw_supply (tdep->lend_regnum, &regs->lend);
if (regnum == tdep->lcount_regnum || regnum == -1)
- regcache->raw_supply (tdep->lcount_regnum,
- &regs->lcount);
+ regcache->raw_supply (tdep->lcount_regnum, &regs->lcount);
if (regnum == tdep->sar_regnum || regnum == -1)
- regcache->raw_supply (tdep->sar_regnum,
- &regs->sar);
+ regcache->raw_supply (tdep->sar_regnum, &regs->sar);
if (regnum == tdep->threadptr_regnum || regnum == -1)
- regcache->raw_supply (tdep->threadptr_regnum,
- &regs->threadptr);
- if (regnum >=tdep->ar_base
- && regnum < tdep->ar_base
- + tdep->num_aregs)
- regcache->raw_supply (regnum,
- &regs->ar[regnum - tdep->ar_base]);
+ regcache->raw_supply (tdep->threadptr_regnum, &regs->threadptr);
+ if (regnum >= tdep->ar_base && regnum < tdep->ar_base + tdep->num_aregs)
+ regcache->raw_supply (regnum, &regs->ar[regnum - tdep->ar_base]);
else if (regnum == -1)
{
for (i = 0; i < tdep->num_aregs; ++i)
- regcache->raw_supply (tdep->ar_base + i,
- &regs->ar[i]);
+ regcache->raw_supply (tdep->ar_base + i, &regs->ar[i]);
}
- if (regnum >= tdep->a0_base
- && regnum < tdep->a0_base + C0_NREGS)
- regcache->raw_supply (regnum,
- &regs->ar[(4 * regs->windowbase + regnum
- - tdep->a0_base)
- % tdep->num_aregs]);
+ if (regnum >= tdep->a0_base && regnum < tdep->a0_base + C0_NREGS)
+ regcache->raw_supply (
+ regnum, &regs->ar[(4 * regs->windowbase + regnum - tdep->a0_base)
+ % tdep->num_aregs]);
else if (regnum == -1)
{
for (i = 0; i < C0_NREGS; ++i)
- regcache->raw_supply (tdep->a0_base + i,
- &regs->ar[(4 * regs->windowbase + i)
- % tdep->num_aregs]);
+ regcache->raw_supply (
+ tdep->a0_base + i,
+ &regs->ar[(4 * regs->windowbase + i) % tdep->num_aregs]);
}
}
@@ -185,15 +160,14 @@ supply_gregset (struct regcache *regcache, const gdb_gregset_t *gregsetp)
}
void
-fill_fpregset (const struct regcache *regcache,
- gdb_fpregset_t *fpregsetp, int regnum)
+fill_fpregset (const struct regcache *regcache, gdb_fpregset_t *fpregsetp,
+ int regnum)
{
return;
}
-void
-supply_fpregset (struct regcache *regcache,
- const gdb_fpregset_t *fpregsetp)
+void
+supply_fpregset (struct regcache *regcache, const gdb_fpregset_t *fpregsetp)
{
return;
}
@@ -206,13 +180,13 @@ fetch_gregs (struct regcache *regcache, int regnum)
{
int tid = regcache->ptid ().lwp ();
gdb_gregset_t regs;
-
+
if (ptrace (PTRACE_GETREGS, tid, 0, (long) &regs) < 0)
{
- perror_with_name (_("Couldn't get registers"));
+ perror_with_name (_ ("Couldn't get registers"));
return;
}
-
+
supply_gregset_reg (regcache, &regs, regnum);
}
@@ -227,7 +201,7 @@ store_gregs (struct regcache *regcache, int regnum)
if (ptrace (PTRACE_GETREGS, tid, 0, (long) &regs) < 0)
{
- perror_with_name (_("Couldn't get registers"));
+ perror_with_name (_ ("Couldn't get registers"));
return;
}
@@ -235,7 +209,7 @@ store_gregs (struct regcache *regcache, int regnum)
if (ptrace (PTRACE_SETREGS, tid, 0, (long) &regs) < 0)
{
- perror_with_name (_("Couldn't write registers"));
+ perror_with_name (_ ("Couldn't write registers"));
return;
}
}
@@ -251,10 +225,10 @@ fetch_xtregs (struct regcache *regcache, int regnum)
{
int tid = regcache->ptid ().lwp ();
const xtensa_regtable_t *ptr;
- char xtregs [XTENSA_ELF_XTREG_SIZE];
+ char xtregs[XTENSA_ELF_XTREG_SIZE];
- if (ptrace (PTRACE_GETXTREGS, tid, 0, (long)&xtregs) < 0)
- perror_with_name (_("Couldn't get extended registers"));
+ if (ptrace (PTRACE_GETXTREGS, tid, 0, (long) &xtregs) < 0)
+ perror_with_name (_ ("Couldn't get extended registers"));
for (ptr = xtensa_regmap_table; ptr->name; ptr++)
if (regnum == ptr->gdb_regnum || regnum == -1)
@@ -266,17 +240,17 @@ store_xtregs (struct regcache *regcache, int regnum)
{
int tid = regcache->ptid ().lwp ();
const xtensa_regtable_t *ptr;
- char xtregs [XTENSA_ELF_XTREG_SIZE];
+ char xtregs[XTENSA_ELF_XTREG_SIZE];
- if (ptrace (PTRACE_GETXTREGS, tid, 0, (long)&xtregs) < 0)
- perror_with_name (_("Couldn't get extended registers"));
+ if (ptrace (PTRACE_GETXTREGS, tid, 0, (long) &xtregs) < 0)
+ perror_with_name (_ ("Couldn't get extended registers"));
for (ptr = xtensa_regmap_table; ptr->name; ptr++)
if (regnum == ptr->gdb_regnum || regnum == -1)
regcache->raw_collect (ptr->gdb_regnum, xtregs + ptr->ptrace_offset);
- if (ptrace (PTRACE_SETXTREGS, tid, 0, (long)&xtregs) < 0)
- perror_with_name (_("Couldn't write extended registers"));
+ if (ptrace (PTRACE_SETXTREGS, tid, 0, (long) &xtregs) < 0)
+ perror_with_name (_ ("Couldn't write extended registers"));
}
void
@@ -312,8 +286,8 @@ xtensa_linux_nat_target::store_registers (struct regcache *regcache,
/* Called by libthread_db. */
ps_err_e
-ps_get_thread_area (struct ps_prochandle *ph,
- lwpid_t lwpid, int idx, void **base)
+ps_get_thread_area (struct ps_prochandle *ph, lwpid_t lwpid, int idx,
+ void **base)
{
xtensa_elf_gregset_t regs;
@@ -329,6 +303,7 @@ ps_get_thread_area (struct ps_prochandle *ph,
}
void _initialize_xtensa_linux_nat ();
+
void
_initialize_xtensa_linux_nat ()
{
diff --git a/gdb/xtensa-linux-tdep.c b/gdb/xtensa-linux-tdep.c
index 96e6b9aedf5..32e1aa4c4e4 100644
--- a/gdb/xtensa-linux-tdep.c
+++ b/gdb/xtensa-linux-tdep.c
@@ -33,17 +33,16 @@
from the Linux kernel tree. */
enum
- {
- XTENSA_LINUX_SIGRTMIN = 32,
- XTENSA_LINUX_SIGRTMAX = 63,
- };
+{
+ XTENSA_LINUX_SIGRTMIN = 32,
+ XTENSA_LINUX_SIGRTMAX = 63,
+};
/* Implementation of `gdbarch_gdb_signal_from_target', as defined in
gdbarch.h. */
static enum gdb_signal
-xtensa_linux_gdb_signal_from_target (struct gdbarch *gdbarch,
- int signal)
+xtensa_linux_gdb_signal_from_target (struct gdbarch *gdbarch, int signal)
{
if (signal >= XTENSA_LINUX_SIGRTMIN && signal <= XTENSA_LINUX_SIGRTMAX)
{
@@ -52,8 +51,7 @@ xtensa_linux_gdb_signal_from_target (struct gdbarch *gdbarch,
if (offset == 0)
return GDB_SIGNAL_REALTIME_32;
else
- return (enum gdb_signal) (offset - 1
- + (int) GDB_SIGNAL_REALTIME_33);
+ return (enum gdb_signal) (offset - 1 + (int) GDB_SIGNAL_REALTIME_33);
}
else if (signal > XTENSA_LINUX_SIGRTMAX)
return GDB_SIGNAL_UNKNOWN;
@@ -83,8 +81,7 @@ xtensa_linux_gdb_signal_to_target (struct gdbarch *gdbarch,
/* GDB_SIGNAL_REALTIME_33 to _63 are continuous.
Xtensa does not have _64. */
- if (signal >= GDB_SIGNAL_REALTIME_33
- && signal <= GDB_SIGNAL_REALTIME_63)
+ if (signal >= GDB_SIGNAL_REALTIME_33 && signal <= GDB_SIGNAL_REALTIME_63)
{
int offset = signal - GDB_SIGNAL_REALTIME_33;
@@ -112,8 +109,8 @@ xtensa_linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
linux_init_abi (info, gdbarch, 0);
- set_solib_svr4_fetch_link_map_offsets
- (gdbarch, linux_ilp32_fetch_link_map_offsets);
+ set_solib_svr4_fetch_link_map_offsets (gdbarch,
+ linux_ilp32_fetch_link_map_offsets);
set_gdbarch_gdb_signal_from_target (gdbarch,
xtensa_linux_gdb_signal_from_target);
@@ -126,6 +123,7 @@ xtensa_linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
}
void _initialize_xtensa_linux_tdep ();
+
void
_initialize_xtensa_linux_tdep ()
{
diff --git a/gdb/xtensa-tdep.c b/gdb/xtensa-tdep.c
index 8476fecf3a7..af2b2caef83 100644
--- a/gdb/xtensa-tdep.c
+++ b/gdb/xtensa-tdep.c
@@ -44,74 +44,68 @@
#include "xtensa-config.h"
#include <algorithm>
-
static unsigned int xtensa_debug_level = 0;
-#define DEBUGWARN(args...) \
+#define DEBUGWARN(args...) \
if (xtensa_debug_level > 0) \
- gdb_printf (gdb_stdlog, "(warn ) " args)
+ gdb_printf (gdb_stdlog, "(warn ) " args)
-#define DEBUGINFO(args...) \
+#define DEBUGINFO(args...) \
if (xtensa_debug_level > 1) \
- gdb_printf (gdb_stdlog, "(info ) " args)
+ gdb_printf (gdb_stdlog, "(info ) " args)
-#define DEBUGTRACE(args...) \
+#define DEBUGTRACE(args...) \
if (xtensa_debug_level > 2) \
- gdb_printf (gdb_stdlog, "(trace) " args)
+ gdb_printf (gdb_stdlog, "(trace) " args)
-#define DEBUGVERB(args...) \
+#define DEBUGVERB(args...) \
if (xtensa_debug_level > 3) \
- gdb_printf (gdb_stdlog, "(verb ) " args)
-
+ gdb_printf (gdb_stdlog, "(verb ) " args)
/* According to the ABI, the SP must be aligned to 16-byte boundaries. */
#define SP_ALIGNMENT 16
-
/* On Windowed ABI, we use a6 through a11 for passing arguments
to a function called by GDB because CALL4 is used. */
-#define ARGS_NUM_REGS 6
-#define REGISTER_SIZE 4
-
+#define ARGS_NUM_REGS 6
+#define REGISTER_SIZE 4
/* Extract the call size from the return address or PS register. */
-#define PS_CALLINC_SHIFT 16
-#define PS_CALLINC_MASK 0x00030000
-#define CALLINC(ps) (((ps) & PS_CALLINC_MASK) >> PS_CALLINC_SHIFT)
-#define WINSIZE(ra) (4 * (( (ra) >> 30) & 0x3))
+#define PS_CALLINC_SHIFT 16
+#define PS_CALLINC_MASK 0x00030000
+#define CALLINC(ps) (((ps) &PS_CALLINC_MASK) >> PS_CALLINC_SHIFT)
+#define WINSIZE(ra) (4 * (((ra) >> 30) & 0x3))
/* On TX, hardware can be configured without Exception Option.
There is no PS register in this case. Inside XT-GDB, let us treat
it as a virtual read-only register always holding the same value. */
-#define TX_PS 0x20
+#define TX_PS 0x20
/* ABI-independent macros. */
#define ARG_NOF(tdep) \
- (tdep->call_abi \
- == CallAbiCall0Only ? C0_NARGS : (ARGS_NUM_REGS))
-#define ARG_1ST(tdep) \
- (tdep->call_abi == CallAbiCall0Only \
- ? (tdep->a0_base + C0_ARGS) \
- : (tdep->a0_base + 6))
+ (tdep->call_abi == CallAbiCall0Only ? C0_NARGS : (ARGS_NUM_REGS))
+#define ARG_1ST(tdep) \
+ (tdep->call_abi == CallAbiCall0Only ? (tdep->a0_base + C0_ARGS) \
+ : (tdep->a0_base + 6))
/* XTENSA_IS_ENTRY tests whether the first byte of an instruction
indicates that the instruction is an ENTRY instruction. */
-#define XTENSA_IS_ENTRY(gdbarch, op1) \
- ((gdbarch_byte_order (gdbarch) == BFD_ENDIAN_BIG) \
- ? ((op1) == 0x6c) : ((op1) == 0x36))
+#define XTENSA_IS_ENTRY(gdbarch, op1) \
+ ((gdbarch_byte_order (gdbarch) == BFD_ENDIAN_BIG) ? ((op1) == 0x6c) \
+ : ((op1) == 0x36))
-#define XTENSA_ENTRY_LENGTH 3
+#define XTENSA_ENTRY_LENGTH 3
/* windowing_enabled() returns true, if windowing is enabled.
WOE must be set to 1; EXCM to 0.
Note: We assume that EXCM is always 0 for XEA1. */
-#define PS_WOE (1<<18)
-#define PS_EXC (1<<4)
+#define PS_WOE (1 << 18)
+#define PS_EXC (1 << 4)
/* Big enough to hold the size of the largest register in bytes. */
-#define XTENSA_MAX_REGISTER_SIZE 64
+#define XTENSA_MAX_REGISTER_SIZE 64
static int
windowing_enabled (struct gdbarch *gdbarch, unsigned int ps)
@@ -155,7 +149,7 @@ areg_number (struct gdbarch *gdbarch, int ar_regnum, unsigned int wb)
return (areg > 15) ? -1 : areg;
}
-/* Read Xtensa register directly from the hardware. */
+/* Read Xtensa register directly from the hardware. */
static unsigned long
xtensa_read_register (int regnum)
{
@@ -165,7 +159,7 @@ xtensa_read_register (int regnum)
return (unsigned long) value;
}
-/* Write Xtensa register directly to the hardware. */
+/* Write Xtensa register directly to the hardware. */
static void
xtensa_write_register (int regnum, ULONGEST value)
{
@@ -194,7 +188,7 @@ extract_call_winsize (struct gdbarch *gdbarch, CORE_ADDR pc)
DEBUGTRACE ("extract_call_winsize (pc = 0x%08x)\n", (int) pc);
/* Read the previous instruction (should be a call[x]{4|8|12}. */
- read_memory (pc-3, buf, 3);
+ read_memory (pc - 3, buf, 3);
insn = extract_unsigned_integer (buf, 3, byte_order);
/* Decode call instruction:
@@ -208,17 +202,16 @@ extract_call_winsize (struct gdbarch *gdbarch, CORE_ADDR pc)
if (byte_order == BFD_ENDIAN_LITTLE)
{
if (((insn & 0xf) == 0x5) || ((insn & 0xcf) == 0xc0))
- winsize = (insn & 0x30) >> 2; /* 0, 4, 8, 12. */
+ winsize = (insn & 0x30) >> 2; /* 0, 4, 8, 12. */
}
else
{
if (((insn >> 20) == 0x5) || (((insn >> 16) & 0xf3) == 0x03))
- winsize = (insn >> 16) & 0xc; /* 0, 4, 8, 12. */
+ winsize = (insn >> 16) & 0xc; /* 0, 4, 8, 12. */
}
return winsize;
}
-
/* REGISTER INFORMATION */
/* Find register by name. */
@@ -253,20 +246,17 @@ xtensa_register_type (struct gdbarch *gdbarch, int regnum)
xtensa_gdbarch_tdep *tdep = gdbarch_tdep<xtensa_gdbarch_tdep> (gdbarch);
/* Return signed integer for ARx and Ax registers. */
- if ((regnum >= tdep->ar_base
- && regnum < tdep->ar_base + tdep->num_aregs)
- || (regnum >= tdep->a0_base
- && regnum < tdep->a0_base + 16))
+ if ((regnum >= tdep->ar_base && regnum < tdep->ar_base + tdep->num_aregs)
+ || (regnum >= tdep->a0_base && regnum < tdep->a0_base + 16))
return builtin_type (gdbarch)->builtin_int;
- if (regnum == gdbarch_pc_regnum (gdbarch)
- || regnum == tdep->a0_base + 1)
+ if (regnum == gdbarch_pc_regnum (gdbarch) || regnum == tdep->a0_base + 1)
return builtin_type (gdbarch)->builtin_data_ptr;
/* Return the stored type for all other registers. */
else if (regnum >= 0 && regnum < gdbarch_num_cooked_regs (gdbarch))
{
- xtensa_register_t* reg = &tdep->regmap[regnum];
+ xtensa_register_t *reg = &tdep->regmap[regnum];
/* Set ctype for this register (only the first time). */
@@ -322,11 +312,10 @@ xtensa_register_type (struct gdbarch *gdbarch, int regnum)
return reg->ctype;
}
- internal_error (_("invalid register number %d"), regnum);
+ internal_error (_ ("invalid register number %d"), regnum);
return 0;
}
-
/* Return the 'local' register number for stubs, dwarf2, etc.
The debugging information enumerates registers starting from 0 for A0
to n for An. So, we only have to add the base number for A0. */
@@ -347,7 +336,6 @@ xtensa_reg_to_regnum (struct gdbarch *gdbarch, int regnum)
return -1;
}
-
/* Write the bits of a masked register to the various registers.
Only the masked areas of these registers are modified; the other
fields are untouched. The size of masked registers is always less
@@ -360,8 +348,8 @@ xtensa_register_write_masked (struct regcache *regcache,
unsigned int value[(XTENSA_MAX_REGISTER_SIZE + 3) / 4];
const xtensa_mask_t *mask = reg->mask;
- int shift = 0; /* Shift for next mask (mod 32). */
- int start, size; /* Start bit and size of current mask. */
+ int shift = 0; /* Shift for next mask (mod 32). */
+ int start, size; /* Start bit and size of current mask. */
unsigned int *ptr = value;
unsigned int regval, m, mem = 0;
@@ -406,7 +394,7 @@ xtensa_register_write_masked (struct regcache *regcache,
regval = mem >> shift;
if ((shift += size) > bitsize)
- error (_("size of all masks is larger than the register"));
+ error (_ ("size of all masks is larger than the register"));
if (shift >= 32)
{
@@ -433,7 +421,6 @@ xtensa_register_write_masked (struct regcache *regcache,
}
}
-
/* Read a tie state or mapped registers. Read the masked areas
of the registers and assemble them into a single value. */
@@ -485,7 +472,7 @@ xtensa_register_read_masked (readable_regcache *regcache,
mem |= regval << shift;
if ((shift += size) > bitsize)
- error (_("size of all masks is larger than the register"));
+ error (_ ("size of all masks is larger than the register"));
if (shift >= 32)
{
@@ -527,13 +514,11 @@ xtensa_register_read_masked (readable_regcache *regcache,
return REG_VALID;
}
-
/* Read pseudo registers. */
static enum register_status
xtensa_pseudo_register_read (struct gdbarch *gdbarch,
- readable_regcache *regcache,
- int regnum,
+ readable_regcache *regcache, int regnum,
gdb_byte *buffer)
{
DEBUGTRACE ("xtensa_pseudo_register_read (... regnum = %d (%s) ...)\n",
@@ -541,15 +526,13 @@ xtensa_pseudo_register_read (struct gdbarch *gdbarch,
xtensa_gdbarch_tdep *tdep = gdbarch_tdep<xtensa_gdbarch_tdep> (gdbarch);
/* Read aliases a0..a15, if this is a Windowed ABI. */
- if (tdep->isa_use_windowed_registers
- && (regnum >= tdep->a0_base)
+ if (tdep->isa_use_windowed_registers && (regnum >= tdep->a0_base)
&& (regnum <= tdep->a0_base + 15))
{
ULONGEST value;
enum register_status status;
- status = regcache->raw_read (tdep->wb_regnum,
- &value);
+ status = regcache->raw_read (tdep->wb_regnum, &value);
if (status != REG_VALID)
return status;
regnum = arreg_number (gdbarch, regnum, value);
@@ -561,14 +544,13 @@ xtensa_pseudo_register_read (struct gdbarch *gdbarch,
/* We have to find out how to deal with priveleged registers.
Let's treat them as pseudo-registers, but we cannot read/write them. */
-
- else if (tdep->call_abi == CallAbiCall0Only
- || regnum < tdep->a0_base)
+
+ else if (tdep->call_abi == CallAbiCall0Only || regnum < tdep->a0_base)
{
- buffer[0] = (gdb_byte)0;
- buffer[1] = (gdb_byte)0;
- buffer[2] = (gdb_byte)0;
- buffer[3] = (gdb_byte)0;
+ buffer[0] = (gdb_byte) 0;
+ buffer[1] = (gdb_byte) 0;
+ buffer[2] = (gdb_byte) 0;
+ buffer[3] = (gdb_byte) 0;
return REG_VALID;
}
/* Pseudo registers. */
@@ -583,7 +565,7 @@ xtensa_pseudo_register_read (struct gdbarch *gdbarch,
{
if ((flags & xtTargetFlagsNonVisibleRegs) == 0)
{
- warning (_("cannot read register %s"),
+ warning (_ ("cannot read register %s"),
xtensa_register_name (gdbarch, regnum));
return REG_VALID;
}
@@ -595,14 +577,14 @@ xtensa_pseudo_register_read (struct gdbarch *gdbarch,
/* Use 'fetch' to get register? */
if (flags & xtTargetFlagsUseFetchStore)
{
- warning (_("cannot read register"));
+ warning (_ ("cannot read register"));
return REG_VALID;
}
/* On some targets (esp. simulators), we can always read the reg. */
else if ((flags & xtTargetFlagsNonVisibleRegs) == 0)
{
- warning (_("cannot read register"));
+ warning (_ ("cannot read register"));
return REG_VALID;
}
}
@@ -615,16 +597,14 @@ xtensa_pseudo_register_read (struct gdbarch *gdbarch,
return regcache->raw_read (regnum, buffer);
}
else
- internal_error (_("invalid register number %d"), regnum);
+ internal_error (_ ("invalid register number %d"), regnum);
}
-
/* Write pseudo registers. */
static void
xtensa_pseudo_register_write (struct gdbarch *gdbarch,
- struct regcache *regcache,
- int regnum,
+ struct regcache *regcache, int regnum,
const gdb_byte *buffer)
{
DEBUGTRACE ("xtensa_pseudo_register_write (... regnum = %d (%s) ...)\n",
@@ -632,13 +612,11 @@ xtensa_pseudo_register_write (struct gdbarch *gdbarch,
xtensa_gdbarch_tdep *tdep = gdbarch_tdep<xtensa_gdbarch_tdep> (gdbarch);
/* Renumber register, if aliases a0..a15 on Windowed ABI. */
- if (tdep->isa_use_windowed_registers
- && (regnum >= tdep->a0_base)
+ if (tdep->isa_use_windowed_registers && (regnum >= tdep->a0_base)
&& (regnum <= tdep->a0_base + 15))
{
ULONGEST value;
- regcache_raw_read_unsigned (regcache,
- tdep->wb_regnum, &value);
+ regcache_raw_read_unsigned (regcache, tdep->wb_regnum, &value);
regnum = arreg_number (gdbarch, regnum, value);
}
@@ -667,7 +645,7 @@ xtensa_pseudo_register_write (struct gdbarch *gdbarch,
{
if ((flags & xtTargetFlagsNonVisibleRegs) == 0)
{
- warning (_("cannot write register %s"),
+ warning (_ ("cannot write register %s"),
xtensa_register_name (gdbarch, regnum));
return;
}
@@ -679,7 +657,7 @@ xtensa_pseudo_register_write (struct gdbarch *gdbarch,
/* Use 'store' to get register? */
if (flags & xtTargetFlagsUseFetchStore)
{
- warning (_("cannot write register"));
+ warning (_ ("cannot write register"));
return;
}
@@ -687,7 +665,7 @@ xtensa_pseudo_register_write (struct gdbarch *gdbarch,
the register. */
else if ((flags & xtTargetFlagsNonVisibleRegs) == 0)
{
- warning (_("cannot write register"));
+ warning (_ ("cannot write register"));
return;
}
}
@@ -703,7 +681,7 @@ xtensa_pseudo_register_write (struct gdbarch *gdbarch,
regcache->raw_write (regnum, buffer);
}
else
- internal_error (_("invalid register number %d"), regnum);
+ internal_error (_ ("invalid register number %d"), regnum);
}
static const reggroup *xtensa_ar_reggroup;
@@ -721,8 +699,8 @@ xtensa_init_reggroups (void)
xtensa_vectra_reggroup = reggroup_new ("vectra", USER_REGGROUP);
for (i = 0; i < XTENSA_MAX_COPROCESSOR; i++)
- xtensa_cp[i] = reggroup_new (xstrprintf ("cp%d", i).release (),
- USER_REGGROUP);
+ xtensa_cp[i]
+ = reggroup_new (xstrprintf ("cp%d", i).release (), USER_REGGROUP);
}
static void
@@ -737,7 +715,7 @@ xtensa_add_reggroups (struct gdbarch *gdbarch)
reggroup_add (gdbarch, xtensa_cp[i]);
}
-static int
+static int
xtensa_coprocessor_register_group (const struct reggroup *group)
{
int i;
@@ -749,20 +727,19 @@ xtensa_coprocessor_register_group (const struct reggroup *group)
return -1;
}
-#define SAVE_REST_FLAGS (XTENSA_REGISTER_FLAGS_READABLE \
- | XTENSA_REGISTER_FLAGS_WRITABLE \
- | XTENSA_REGISTER_FLAGS_VOLATILE)
+#define SAVE_REST_FLAGS \
+ (XTENSA_REGISTER_FLAGS_READABLE | XTENSA_REGISTER_FLAGS_WRITABLE \
+ | XTENSA_REGISTER_FLAGS_VOLATILE)
-#define SAVE_REST_VALID (XTENSA_REGISTER_FLAGS_READABLE \
- | XTENSA_REGISTER_FLAGS_WRITABLE)
+#define SAVE_REST_VALID \
+ (XTENSA_REGISTER_FLAGS_READABLE | XTENSA_REGISTER_FLAGS_WRITABLE)
static int
-xtensa_register_reggroup_p (struct gdbarch *gdbarch,
- int regnum,
+xtensa_register_reggroup_p (struct gdbarch *gdbarch, int regnum,
const struct reggroup *group)
{
xtensa_gdbarch_tdep *tdep = gdbarch_tdep<xtensa_gdbarch_tdep> (gdbarch);
- xtensa_register_t* reg = &tdep->regmap[regnum];
+ xtensa_register_t *reg = &tdep->regmap[regnum];
xtensa_register_type_t type = reg->type;
xtensa_register_group_t rg = reg->group;
int cp_number;
@@ -801,17 +778,13 @@ xtensa_register_reggroup_p (struct gdbarch *gdbarch,
return 1;
}
-
/* Supply register REGNUM from the buffer specified by GREGS and LEN
in the general-purpose register set REGSET to register cache
REGCACHE. If REGNUM is -1 do this for all registers in REGSET. */
static void
-xtensa_supply_gregset (const struct regset *regset,
- struct regcache *rc,
- int regnum,
- const void *gregs,
- size_t len)
+xtensa_supply_gregset (const struct regset *regset, struct regcache *rc,
+ int regnum, const void *gregs, size_t len)
{
const xtensa_elf_gregset_t *regs = (const xtensa_elf_gregset_t *) gregs;
struct gdbarch *gdbarch = rc->arch ();
@@ -825,46 +798,29 @@ xtensa_supply_gregset (const struct regset *regset,
if (regnum == gdbarch_ps_regnum (gdbarch) || regnum == -1)
rc->raw_supply (gdbarch_ps_regnum (gdbarch), (char *) &regs->ps);
if (regnum == tdep->wb_regnum || regnum == -1)
- rc->raw_supply (tdep->wb_regnum,
- (char *) &regs->windowbase);
+ rc->raw_supply (tdep->wb_regnum, (char *) &regs->windowbase);
if (regnum == tdep->ws_regnum || regnum == -1)
- rc->raw_supply (tdep->ws_regnum,
- (char *) &regs->windowstart);
+ rc->raw_supply (tdep->ws_regnum, (char *) &regs->windowstart);
if (regnum == tdep->lbeg_regnum || regnum == -1)
- rc->raw_supply (tdep->lbeg_regnum,
- (char *) &regs->lbeg);
+ rc->raw_supply (tdep->lbeg_regnum, (char *) &regs->lbeg);
if (regnum == tdep->lend_regnum || regnum == -1)
- rc->raw_supply (tdep->lend_regnum,
- (char *) &regs->lend);
+ rc->raw_supply (tdep->lend_regnum, (char *) &regs->lend);
if (regnum == tdep->lcount_regnum || regnum == -1)
- rc->raw_supply (tdep->lcount_regnum,
- (char *) &regs->lcount);
+ rc->raw_supply (tdep->lcount_regnum, (char *) &regs->lcount);
if (regnum == tdep->sar_regnum || regnum == -1)
- rc->raw_supply (tdep->sar_regnum,
- (char *) &regs->sar);
- if (regnum >=tdep->ar_base
- && regnum < tdep->ar_base
- + tdep->num_aregs)
- rc->raw_supply
- (regnum, (char *) &regs->ar[regnum - tdep->ar_base]);
+ rc->raw_supply (tdep->sar_regnum, (char *) &regs->sar);
+ if (regnum >= tdep->ar_base && regnum < tdep->ar_base + tdep->num_aregs)
+ rc->raw_supply (regnum, (char *) &regs->ar[regnum - tdep->ar_base]);
else if (regnum == -1)
{
for (i = 0; i < tdep->num_aregs; ++i)
- rc->raw_supply (tdep->ar_base + i,
- (char *) &regs->ar[i]);
+ rc->raw_supply (tdep->ar_base + i, (char *) &regs->ar[i]);
}
}
-
/* Xtensa register set. */
-static struct regset
-xtensa_gregset =
-{
- NULL,
- xtensa_supply_gregset
-};
-
+static struct regset xtensa_gregset = { NULL, xtensa_supply_gregset };
/* Iterate over supported core file register note sections. */
@@ -880,37 +836,37 @@ xtensa_iterate_over_regset_sections (struct gdbarch *gdbarch,
&xtensa_gregset, NULL, cb_data);
}
-
/* Handling frames. */
/* Number of registers to save in case of Windowed ABI. */
-#define XTENSA_NUM_SAVED_AREGS 12
+#define XTENSA_NUM_SAVED_AREGS 12
/* Frame cache part for Windowed ABI. */
typedef struct xtensa_windowed_frame_cache
{
- int wb; /* WINDOWBASE of the previous frame. */
- int callsize; /* Call size of this frame. */
- int ws; /* WINDOWSTART of the previous frame. It keeps track of
+ int wb; /* WINDOWBASE of the previous frame. */
+ int callsize; /* Call size of this frame. */
+ int ws; /* WINDOWSTART of the previous frame. It keeps track of
life windows only. If there is no bit set for the
window, that means it had been already spilled
because of window overflow. */
- /* Addresses of spilled A-registers.
+ /* Addresses of spilled A-registers.
AREGS[i] == -1, if corresponding AR is alive. */
CORE_ADDR aregs[XTENSA_NUM_SAVED_AREGS];
} xtensa_windowed_frame_cache_t;
/* Call0 ABI Definitions. */
-#define C0_MAXOPDS 3 /* Maximum number of operands for prologue
+#define C0_MAXOPDS \
+ 3 /* Maximum number of operands for prologue
analysis. */
-#define C0_CLESV 12 /* Callee-saved registers are here and up. */
-#define C0_SP 1 /* Register used as SP. */
-#define C0_FP 15 /* Register used as FP. */
-#define C0_RA 0 /* Register used as return address. */
-#define C0_ARGS 2 /* Register used as first arg/retval. */
-#define C0_NARGS 6 /* Number of A-regs for args/retvals. */
+#define C0_CLESV 12 /* Callee-saved registers are here and up. */
+#define C0_SP 1 /* Register used as SP. */
+#define C0_FP 15 /* Register used as FP. */
+#define C0_RA 0 /* Register used as return address. */
+#define C0_ARGS 2 /* Register used as first arg/retval. */
+#define C0_NARGS 6 /* Number of A-regs for args/retvals. */
/* Each element of xtensa_call0_frame_cache.c0_rt[] describes for each
A-register where the current content of the reg came from (in terms
@@ -919,56 +875,56 @@ typedef struct xtensa_windowed_frame_cache
c0_rt[n].fr.ofs is NOT the offset from the frame base because we don't
know where SP will end up until the entire prologue has been analyzed. */
-#define C0_CONST -1 /* fr_reg value if register contains a constant. */
-#define C0_INEXP -2 /* fr_reg value if inexpressible as reg + offset. */
-#define C0_NOSTK -1 /* to_stk value if register has not been stored. */
+#define C0_CONST -1 /* fr_reg value if register contains a constant. */
+#define C0_INEXP -2 /* fr_reg value if inexpressible as reg + offset. */
+#define C0_NOSTK -1 /* to_stk value if register has not been stored. */
extern xtensa_isa xtensa_default_isa;
typedef struct xtensa_c0reg
{
- int fr_reg; /* original register from which register content
+ int fr_reg; /* original register from which register content
is derived, or C0_CONST, or C0_INEXP. */
- int fr_ofs; /* constant offset from reg, or immediate value. */
- int to_stk; /* offset from original SP to register (4-byte aligned),
+ int fr_ofs; /* constant offset from reg, or immediate value. */
+ int to_stk; /* offset from original SP to register (4-byte aligned),
or C0_NOSTK if register has not been saved. */
} xtensa_c0reg_t;
/* Frame cache part for Call0 ABI. */
typedef struct xtensa_call0_frame_cache
{
- int c0_frmsz; /* Stack frame size. */
- int c0_hasfp; /* Current frame uses frame pointer. */
- int fp_regnum; /* A-register used as FP. */
- int c0_fp; /* Actual value of frame pointer. */
- int c0_fpalign; /* Dynamic adjustment for the stack
+ int c0_frmsz; /* Stack frame size. */
+ int c0_hasfp; /* Current frame uses frame pointer. */
+ int fp_regnum; /* A-register used as FP. */
+ int c0_fp; /* Actual value of frame pointer. */
+ int c0_fpalign; /* Dynamic adjustment for the stack
pointer. It's an AND mask. Zero,
if alignment was not adjusted. */
- int c0_old_sp; /* In case of dynamic adjustment, it is
+ int c0_old_sp; /* In case of dynamic adjustment, it is
a register holding unaligned sp.
C0_INEXP, when undefined. */
- int c0_sp_ofs; /* If "c0_old_sp" was spilled it's a
+ int c0_sp_ofs; /* If "c0_old_sp" was spilled it's a
stack offset. C0_NOSTK otherwise. */
-
- xtensa_c0reg_t c0_rt[C0_NREGS]; /* Register tracking information. */
+
+ xtensa_c0reg_t c0_rt[C0_NREGS]; /* Register tracking information. */
} xtensa_call0_frame_cache_t;
typedef struct xtensa_frame_cache
{
- CORE_ADDR base; /* Stack pointer of this frame. */
- CORE_ADDR pc; /* PC of this frame at the function entry point. */
- CORE_ADDR ra; /* The raw return address of this frame. */
- CORE_ADDR ps; /* The PS register of the previous (older) frame. */
- CORE_ADDR prev_sp; /* Stack Pointer of the previous (older) frame. */
- int call0; /* It's a call0 framework (else windowed). */
+ CORE_ADDR base; /* Stack pointer of this frame. */
+ CORE_ADDR pc; /* PC of this frame at the function entry point. */
+ CORE_ADDR ra; /* The raw return address of this frame. */
+ CORE_ADDR ps; /* The PS register of the previous (older) frame. */
+ CORE_ADDR prev_sp; /* Stack Pointer of the previous (older) frame. */
+ int call0; /* It's a call0 framework (else windowed). */
+
union
- {
- xtensa_windowed_frame_cache_t wd; /* call0 == false. */
- xtensa_call0_frame_cache_t c0; /* call0 == true. */
- };
+ {
+ xtensa_windowed_frame_cache_t wd; /* call0 == false. */
+ xtensa_call0_frame_cache_t c0; /* call0 == true. */
+ };
} xtensa_frame_cache_t;
-
static struct xtensa_frame_cache *
xtensa_alloc_frame_cache (int windowed)
{
@@ -987,13 +943,13 @@ xtensa_alloc_frame_cache (int windowed)
cache->call0 = !windowed;
if (cache->call0)
{
- cache->c0.c0_frmsz = -1;
- cache->c0.c0_hasfp = 0;
+ cache->c0.c0_frmsz = -1;
+ cache->c0.c0_hasfp = 0;
cache->c0.fp_regnum = -1;
- cache->c0.c0_fp = -1;
- cache->c0.c0_fpalign = 0;
- cache->c0.c0_old_sp = C0_INEXP;
- cache->c0.c0_sp_ofs = C0_NOSTK;
+ cache->c0.c0_fp = -1;
+ cache->c0.c0_fpalign = 0;
+ cache->c0.c0_old_sp = C0_INEXP;
+ cache->c0.c0_sp_ofs = C0_NOSTK;
for (i = 0; i < C0_NREGS; i++)
{
@@ -1014,22 +970,20 @@ xtensa_alloc_frame_cache (int windowed)
return cache;
}
-
static CORE_ADDR
xtensa_frame_align (struct gdbarch *gdbarch, CORE_ADDR address)
{
return address & ~15;
}
-
static CORE_ADDR
xtensa_unwind_pc (struct gdbarch *gdbarch, frame_info_ptr next_frame)
{
gdb_byte buf[8];
CORE_ADDR pc;
- DEBUGTRACE ("xtensa_unwind_pc (next_frame = %s)\n",
- host_address_to_string (next_frame.get ()));
+ DEBUGTRACE ("xtensa_unwind_pc (next_frame = %s)\n",
+ host_address_to_string (next_frame.get ()));
frame_unwind_register (next_frame, gdbarch_pc_regnum (gdbarch), buf);
pc = extract_typed_address (buf, builtin_type (gdbarch)->builtin_func_ptr);
@@ -1039,7 +993,6 @@ xtensa_unwind_pc (struct gdbarch *gdbarch, frame_info_ptr next_frame)
return pc;
}
-
static struct frame_id
xtensa_dummy_id (struct gdbarch *gdbarch, frame_info_ptr this_frame)
{
@@ -1049,8 +1002,7 @@ xtensa_dummy_id (struct gdbarch *gdbarch, frame_info_ptr this_frame)
/* THIS-FRAME is a dummy frame. Return a frame ID of that frame. */
pc = get_frame_pc (this_frame);
- fp = get_frame_register_unsigned
- (this_frame, tdep->a0_base + 1);
+ fp = get_frame_register_unsigned (this_frame, tdep->a0_base + 1);
/* Make dummy frame ID unique by adding a constant. */
return frame_id_build (fp + SP_ALIGNMENT, pc);
@@ -1091,8 +1043,8 @@ xtensa_window_interrupt_insn (struct gdbarch *gdbarch, CORE_ADDR pc)
/* Returns the best guess about which register is a frame pointer
for the function containing CURRENT_PC. */
-#define XTENSA_ISA_BSZ 32 /* Instruction buffer size. */
-#define XTENSA_ISA_BADPC ((CORE_ADDR)0) /* Bad PC value. */
+#define XTENSA_ISA_BSZ 32 /* Instruction buffer size. */
+#define XTENSA_ISA_BADPC ((CORE_ADDR) 0) /* Bad PC value. */
static unsigned int
xtensa_scan_prologue (struct gdbarch *gdbarch, CORE_ADDR current_pc)
@@ -1121,18 +1073,18 @@ xtensa_scan_prologue (struct gdbarch *gdbarch, CORE_ADDR current_pc)
slot = xtensa_insnbuf_alloc (isa);
ba = 0;
- for (ia = start_addr, bt = ia; ia < current_pc ; ia += ilen)
+ for (ia = start_addr, bt = ia; ia < current_pc; ia += ilen)
{
if (ia + xtensa_isa_maxlength (isa) > bt)
{
ba = ia;
- bt = (ba + XTENSA_ISA_BSZ) < current_pc
- ? ba + XTENSA_ISA_BSZ : current_pc;
+ bt = (ba + XTENSA_ISA_BSZ) < current_pc ? ba + XTENSA_ISA_BSZ
+ : current_pc;
if (target_read_memory (ba, ibuf, bt - ba) != 0)
RETURN_FP;
}
- xtensa_insnbuf_from_chars (isa, ins, &ibuf[ia-ba], 0);
+ xtensa_insnbuf_from_chars (isa, ins, &ibuf[ia - ba], 0);
ifmt = xtensa_format_decode (isa, ins);
if (ifmt == XTENSA_UNDEFINED)
RETURN_FP;
@@ -1142,16 +1094,16 @@ xtensa_scan_prologue (struct gdbarch *gdbarch, CORE_ADDR current_pc)
islots = xtensa_format_num_slots (isa, ifmt);
if (islots == XTENSA_UNDEFINED)
RETURN_FP;
-
+
for (is = 0; is < islots; ++is)
{
if (xtensa_format_get_slot (isa, ifmt, is, ins, slot))
RETURN_FP;
-
+
opc = xtensa_opcode_decode (isa, ifmt, is, slot);
- if (opc == XTENSA_UNDEFINED)
+ if (opc == XTENSA_UNDEFINED)
RETURN_FP;
-
+
opcname = xtensa_opcode_name (isa, opc);
if (strcasecmp (opcname, "mov.n") == 0
@@ -1162,48 +1114,48 @@ xtensa_scan_prologue (struct gdbarch *gdbarch, CORE_ADDR current_pc)
/* Possible candidate for setting frame pointer
from A1. This is what we are looking for. */
- if (xtensa_operand_get_field (isa, opc, 1, ifmt,
- is, slot, &register_operand) != 0)
+ if (xtensa_operand_get_field (isa, opc, 1, ifmt, is, slot,
+ &register_operand)
+ != 0)
RETURN_FP;
if (xtensa_operand_decode (isa, opc, 1, &register_operand) != 0)
RETURN_FP;
- if (register_operand == 1) /* Mov{.n} FP A1. */
+ if (register_operand == 1) /* Mov{.n} FP A1. */
{
- if (xtensa_operand_get_field (isa, opc, 0, ifmt, is, slot,
- &register_operand) != 0)
+ if (xtensa_operand_get_field (isa, opc, 0, ifmt, is, slot,
+ &register_operand)
+ != 0)
RETURN_FP;
- if (xtensa_operand_decode (isa, opc, 0,
- &register_operand) != 0)
+ if (xtensa_operand_decode (isa, opc, 0, &register_operand)
+ != 0)
RETURN_FP;
- fp_regnum
- = tdep->a0_base + register_operand;
+ fp_regnum = tdep->a0_base + register_operand;
RETURN_FP;
}
}
if (
- /* We have problems decoding the memory. */
- opcname == NULL
- || strcasecmp (opcname, "ill") == 0
- || strcasecmp (opcname, "ill.n") == 0
- /* Hit planted breakpoint. */
- || strcasecmp (opcname, "break") == 0
- || strcasecmp (opcname, "break.n") == 0
- /* Flow control instructions finish prologue. */
- || xtensa_opcode_is_branch (isa, opc) > 0
- || xtensa_opcode_is_jump (isa, opc) > 0
- || xtensa_opcode_is_loop (isa, opc) > 0
- || xtensa_opcode_is_call (isa, opc) > 0
- || strcasecmp (opcname, "simcall") == 0
- || strcasecmp (opcname, "syscall") == 0)
+ /* We have problems decoding the memory. */
+ opcname == NULL || strcasecmp (opcname, "ill") == 0
+ || strcasecmp (opcname, "ill.n") == 0
+ /* Hit planted breakpoint. */
+ || strcasecmp (opcname, "break") == 0
+ || strcasecmp (opcname, "break.n") == 0
+ /* Flow control instructions finish prologue. */
+ || xtensa_opcode_is_branch (isa, opc) > 0
+ || xtensa_opcode_is_jump (isa, opc) > 0
+ || xtensa_opcode_is_loop (isa, opc) > 0
+ || xtensa_opcode_is_call (isa, opc) > 0
+ || strcasecmp (opcname, "simcall") == 0
+ || strcasecmp (opcname, "syscall") == 0)
/* Can not continue analysis. */
RETURN_FP;
}
}
done:
- xtensa_insnbuf_free(isa, slot);
- xtensa_insnbuf_free(isa, ins);
+ xtensa_insnbuf_free (isa, slot);
+ xtensa_insnbuf_free (isa, ins);
return fp_regnum;
}
@@ -1213,14 +1165,12 @@ done:
cache->pc = entry-PC (entry point of the frame function);
cache->prev_sp = SP of the previous frame. */
-static void
-call0_frame_cache (frame_info_ptr this_frame,
- xtensa_frame_cache_t *cache, CORE_ADDR pc);
+static void call0_frame_cache (frame_info_ptr this_frame,
+ xtensa_frame_cache_t *cache, CORE_ADDR pc);
-static void
-xtensa_window_interrupt_frame_cache (frame_info_ptr this_frame,
- xtensa_frame_cache_t *cache,
- CORE_ADDR pc);
+static void xtensa_window_interrupt_frame_cache (frame_info_ptr this_frame,
+ xtensa_frame_cache_t *cache,
+ CORE_ADDR pc);
static struct xtensa_frame_cache *
xtensa_frame_cache (frame_info_ptr this_frame, void **this_cache)
@@ -1230,15 +1180,15 @@ xtensa_frame_cache (frame_info_ptr this_frame, void **this_cache)
struct gdbarch *gdbarch = get_frame_arch (this_frame);
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
unsigned int fp_regnum;
- int windowed, ps_regnum;
+ int windowed, ps_regnum;
if (*this_cache)
return (struct xtensa_frame_cache *) *this_cache;
pc = get_frame_register_unsigned (this_frame, gdbarch_pc_regnum (gdbarch));
ps_regnum = gdbarch_ps_regnum (gdbarch);
- ps = (ps_regnum >= 0
- ? get_frame_register_unsigned (this_frame, ps_regnum) : TX_PS);
+ ps = (ps_regnum >= 0 ? get_frame_register_unsigned (this_frame, ps_regnum)
+ : TX_PS);
windowed = windowing_enabled (gdbarch, ps);
@@ -1252,24 +1202,22 @@ xtensa_frame_cache (frame_info_ptr this_frame, void **this_cache)
xtensa_gdbarch_tdep *tdep = gdbarch_tdep<xtensa_gdbarch_tdep> (gdbarch);
/* Get WINDOWBASE, WINDOWSTART, and PS registers. */
- wb = get_frame_register_unsigned (this_frame,
- tdep->wb_regnum);
- ws = get_frame_register_unsigned (this_frame,
- tdep->ws_regnum);
+ wb = get_frame_register_unsigned (this_frame, tdep->wb_regnum);
+ ws = get_frame_register_unsigned (this_frame, tdep->ws_regnum);
if (safe_read_memory_integer (pc, 1, byte_order, &op1)
&& XTENSA_IS_ENTRY (gdbarch, op1))
{
int callinc = CALLINC (ps);
- ra = get_frame_register_unsigned
- (this_frame, tdep->a0_base + callinc * 4);
-
+ ra = get_frame_register_unsigned (this_frame,
+ tdep->a0_base + callinc * 4);
+
/* ENTRY hasn't been executed yet, therefore callsize is still 0. */
cache->wd.callsize = 0;
cache->wd.wb = wb;
cache->wd.ws = ws;
- cache->prev_sp = get_frame_register_unsigned
- (this_frame, tdep->a0_base + 1);
+ cache->prev_sp
+ = get_frame_register_unsigned (this_frame, tdep->a0_base + 1);
/* This only can be the outermost frame since we are
just about to execute ENTRY. SP hasn't been set yet.
@@ -1280,24 +1228,23 @@ xtensa_frame_cache (frame_info_ptr this_frame, void **this_cache)
cache->pc = pc;
cache->ra = (cache->pc & 0xc0000000) | (ra & 0x3fffffff);
cache->ps = (ps & ~PS_CALLINC_MASK)
- | ((WINSIZE(ra)/4) << PS_CALLINC_SHIFT);
+ | ((WINSIZE (ra) / 4) << PS_CALLINC_SHIFT);
return cache;
}
else
{
fp_regnum = xtensa_scan_prologue (gdbarch, pc);
- ra = get_frame_register_unsigned (this_frame,
- tdep->a0_base);
+ ra = get_frame_register_unsigned (this_frame, tdep->a0_base);
cache->wd.callsize = WINSIZE (ra);
- cache->wd.wb = (wb - cache->wd.callsize / 4)
- & (tdep->num_aregs / 4 - 1);
+ cache->wd.wb
+ = (wb - cache->wd.callsize / 4) & (tdep->num_aregs / 4 - 1);
cache->wd.ws = ws & ~(1 << wb);
cache->pc = get_frame_func (this_frame);
cache->ra = (pc & 0xc0000000) | (ra & 0x3fffffff);
cache->ps = (ps & ~PS_CALLINC_MASK)
- | ((WINSIZE(ra)/4) << PS_CALLINC_SHIFT);
+ | ((WINSIZE (ra) / 4) << PS_CALLINC_SHIFT);
}
if (cache->wd.ws == 0)
@@ -1305,9 +1252,9 @@ xtensa_frame_cache (frame_info_ptr this_frame, void **this_cache)
int i;
/* Set A0...A3. */
- sp = get_frame_register_unsigned
- (this_frame, tdep->a0_base + 1) - 16;
-
+ sp
+ = get_frame_register_unsigned (this_frame, tdep->a0_base + 1) - 16;
+
for (i = 0; i < 4; i++, sp += 4)
{
cache->wd.aregs[i] = sp;
@@ -1322,14 +1269,14 @@ xtensa_frame_cache (frame_info_ptr this_frame, void **this_cache)
sp = (CORE_ADDR) read_memory_integer (sp - 12, 4, byte_order);
sp -= cache->wd.callsize * 4;
- for ( i = 4; i < cache->wd.callsize; i++, sp += 4)
+ for (i = 4; i < cache->wd.callsize; i++, sp += 4)
{
cache->wd.aregs[i] = sp;
}
}
}
- if ((cache->prev_sp == 0) && ( ra != 0 ))
+ if ((cache->prev_sp == 0) && (ra != 0))
/* If RA is equal to 0 this frame is an outermost frame. Leave
cache->prev_sp unchanged marking the boundary of the frame stack. */
{
@@ -1337,16 +1284,14 @@ xtensa_frame_cache (frame_info_ptr this_frame, void **this_cache)
{
/* Register window overflow already happened.
We can read caller's SP from the proper spill location. */
- sp = get_frame_register_unsigned
- (this_frame, tdep->a0_base + 1);
+ sp = get_frame_register_unsigned (this_frame, tdep->a0_base + 1);
cache->prev_sp = read_memory_integer (sp - 12, 4, byte_order);
}
else
{
/* Read caller's frame SP directly from the previous window. */
- int regnum = arreg_number
- (gdbarch, tdep->a0_base + 1,
- cache->wd.wb);
+ int regnum
+ = arreg_number (gdbarch, tdep->a0_base + 1, cache->wd.wb);
cache->prev_sp = xtensa_read_register (regnum);
}
@@ -1360,9 +1305,9 @@ xtensa_frame_cache (frame_info_ptr this_frame, void **this_cache)
/* Everything was set already, including cache->base. */
return cache;
}
- else /* Call0 framework. */
+ else /* Call0 framework. */
{
- call0_frame_cache (this_frame, cache, pc);
+ call0_frame_cache (this_frame, cache, pc);
fp_regnum = cache->c0.fp_regnum;
}
@@ -1380,21 +1325,19 @@ static void
warning_once (void)
{
if (xtensa_session_once_reported == 0)
- warning (_("\
+ warning (_ ("\
\nUnrecognised function prologue. Stack trace cannot be resolved. \
This message will not be repeated in this session.\n"));
xtensa_session_once_reported = 1;
}
-
static void
-xtensa_frame_this_id (frame_info_ptr this_frame,
- void **this_cache,
+xtensa_frame_this_id (frame_info_ptr this_frame, void **this_cache,
struct frame_id *this_id)
{
- struct xtensa_frame_cache *cache =
- xtensa_frame_cache (this_frame, this_cache);
+ struct xtensa_frame_cache *cache
+ = xtensa_frame_cache (this_frame, this_cache);
if (cache->prev_sp == 0)
return;
@@ -1403,8 +1346,7 @@ xtensa_frame_this_id (frame_info_ptr this_frame,
}
static struct value *
-xtensa_frame_prev_register (frame_info_ptr this_frame,
- void **this_cache,
+xtensa_frame_prev_register (frame_info_ptr this_frame, void **this_cache,
int regnum)
{
struct gdbarch *gdbarch = get_frame_arch (this_frame);
@@ -1417,7 +1359,7 @@ xtensa_frame_prev_register (frame_info_ptr this_frame,
*this_cache = xtensa_frame_cache (this_frame, this_cache);
cache = (struct xtensa_frame_cache *) *this_cache;
- if (regnum ==gdbarch_pc_regnum (gdbarch))
+ if (regnum == gdbarch_pc_regnum (gdbarch))
saved_reg = cache->ra;
else if (regnum == tdep->a0_base + 1)
saved_reg = cache->prev_sp;
@@ -1442,19 +1384,16 @@ xtensa_frame_prev_register (frame_info_ptr this_frame,
{
/* Convert A-register numbers to AR-register numbers,
if we deal with A-register. */
- if (regnum >= tdep->a0_base
- && regnum <= tdep->a0_base + 15)
+ if (regnum >= tdep->a0_base && regnum <= tdep->a0_base + 15)
regnum = arreg_number (gdbarch, regnum, cache->wd.wb);
/* Check, if we deal with AR-register saved on stack. */
if (regnum >= tdep->ar_base
- && regnum <= (tdep->ar_base
- + tdep->num_aregs))
+ && regnum <= (tdep->ar_base + tdep->num_aregs))
{
int areg = areg_number (gdbarch, regnum, cache->wd.wb);
- if (areg >= 0
- && areg < XTENSA_NUM_SAVED_AREGS
+ if (areg >= 0 && areg < XTENSA_NUM_SAVED_AREGS
&& cache->wd.aregs[areg] != -1)
return frame_unwind_got_memory (this_frame, regnum,
cache->wd.aregs[areg]);
@@ -1462,10 +1401,10 @@ xtensa_frame_prev_register (frame_info_ptr this_frame,
}
else /* Call0 ABI. */
{
- int reg = (regnum >= tdep->ar_base
- && regnum <= (tdep->ar_base
- + C0_NREGS))
- ? regnum - tdep->ar_base : regnum;
+ int reg
+ = (regnum >= tdep->ar_base && regnum <= (tdep->ar_base + C0_NREGS))
+ ? regnum - tdep->ar_base
+ : regnum;
if (reg < C0_NREGS)
{
@@ -1478,7 +1417,7 @@ xtensa_frame_prev_register (frame_info_ptr this_frame,
{
/* Determine SP on entry based on FP. */
spe = cache->c0.c0_fp
- - cache->c0.c0_rt[cache->c0.fp_regnum].fr_ofs;
+ - cache->c0.c0_rt[cache->c0.fp_regnum].fr_ofs;
return frame_unwind_got_memory (this_frame, regnum,
spe + stkofs);
@@ -1492,41 +1431,30 @@ xtensa_frame_prev_register (frame_info_ptr this_frame,
return frame_unwind_got_register (this_frame, regnum, regnum);
}
-
-static const struct frame_unwind
-xtensa_unwind =
-{
- "xtensa prologue",
- NORMAL_FRAME,
- default_frame_unwind_stop_reason,
- xtensa_frame_this_id,
- xtensa_frame_prev_register,
- NULL,
- default_frame_sniffer
-};
+static const struct frame_unwind xtensa_unwind
+ = { "xtensa prologue",
+ NORMAL_FRAME,
+ default_frame_unwind_stop_reason,
+ xtensa_frame_this_id,
+ xtensa_frame_prev_register,
+ NULL,
+ default_frame_sniffer };
static CORE_ADDR
xtensa_frame_base_address (frame_info_ptr this_frame, void **this_cache)
{
- struct xtensa_frame_cache *cache =
- xtensa_frame_cache (this_frame, this_cache);
+ struct xtensa_frame_cache *cache
+ = xtensa_frame_cache (this_frame, this_cache);
return cache->base;
}
-static const struct frame_base
-xtensa_frame_base =
-{
- &xtensa_unwind,
- xtensa_frame_base_address,
- xtensa_frame_base_address,
- xtensa_frame_base_address
-};
-
+static const struct frame_base xtensa_frame_base
+ = { &xtensa_unwind, xtensa_frame_base_address, xtensa_frame_base_address,
+ xtensa_frame_base_address };
static void
-xtensa_extract_return_value (struct type *type,
- struct regcache *regcache,
+xtensa_extract_return_value (struct type *type, struct regcache *regcache,
void *dst)
{
struct gdbarch *gdbarch = regcache->arch ();
@@ -1538,7 +1466,7 @@ xtensa_extract_return_value (struct type *type,
DEBUGTRACE ("xtensa_extract_return_value (...)\n");
- gdb_assert(len > 0);
+ gdb_assert (len > 0);
xtensa_gdbarch_tdep *tdep = gdbarch_tdep<xtensa_gdbarch_tdep> (gdbarch);
if (tdep->call_abi != CallAbiCall0Only)
@@ -1549,15 +1477,13 @@ xtensa_extract_return_value (struct type *type,
/* On Xtensa, we can return up to 4 words (or 2 for call12). */
if (len > (callsize > 8 ? 8 : 16))
- internal_error (_("cannot extract return value of %d bytes long"),
+ internal_error (_ ("cannot extract return value of %d bytes long"),
len);
/* Get the register offset of the return
register (A2) in the caller window. */
- regcache_raw_read_unsigned
- (regcache, tdep->wb_regnum, &wb);
- areg = arreg_number (gdbarch,
- tdep->a0_base + 2 + callsize, wb);
+ regcache_raw_read_unsigned (regcache, tdep->wb_regnum, &wb);
+ areg = arreg_number (gdbarch, tdep->a0_base + 2 + callsize, wb);
}
else
{
@@ -1579,10 +1505,8 @@ xtensa_extract_return_value (struct type *type,
}
}
-
static void
-xtensa_store_return_value (struct type *type,
- struct regcache *regcache,
+xtensa_store_return_value (struct type *type, struct regcache *regcache,
const void *dst)
{
struct gdbarch *gdbarch = regcache->arch ();
@@ -1598,19 +1522,17 @@ xtensa_store_return_value (struct type *type,
xtensa_gdbarch_tdep *tdep = gdbarch_tdep<xtensa_gdbarch_tdep> (gdbarch);
if (tdep->call_abi != CallAbiCall0Only)
{
- regcache_raw_read_unsigned
- (regcache, tdep->wb_regnum, &wb);
+ regcache_raw_read_unsigned (regcache, tdep->wb_regnum, &wb);
regcache_raw_read_unsigned (regcache, gdbarch_pc_regnum (gdbarch), &pc);
callsize = extract_call_winsize (gdbarch, pc);
if (len > (callsize > 8 ? 8 : 16))
- internal_error (_("unimplemented for this length: %s"),
+ internal_error (_ ("unimplemented for this length: %s"),
pulongest (type->length ()));
- areg = arreg_number (gdbarch,
- tdep->a0_base + 2 + callsize, wb);
+ areg = arreg_number (gdbarch, tdep->a0_base + 2 + callsize, wb);
- DEBUGTRACE ("[xtensa_store_return_value] callsize %d wb %d\n",
- callsize, (int) wb);
+ DEBUGTRACE ("[xtensa_store_return_value] callsize %d wb %d\n", callsize,
+ (int) wb);
}
else
{
@@ -1629,14 +1551,10 @@ xtensa_store_return_value (struct type *type,
}
}
-
static enum return_value_convention
-xtensa_return_value (struct gdbarch *gdbarch,
- struct value *function,
- struct type *valtype,
- struct regcache *regcache,
- gdb_byte *readbuf,
- const gdb_byte *writebuf)
+xtensa_return_value (struct gdbarch *gdbarch, struct value *function,
+ struct type *valtype, struct regcache *regcache,
+ gdb_byte *readbuf, const gdb_byte *writebuf)
{
/* Structures up to 16 bytes are returned in registers. */
@@ -1663,17 +1581,12 @@ xtensa_return_value (struct gdbarch *gdbarch,
return RETURN_VALUE_REGISTER_CONVENTION;
}
-
/* DUMMY FRAME */
static CORE_ADDR
-xtensa_push_dummy_call (struct gdbarch *gdbarch,
- struct value *function,
- struct regcache *regcache,
- CORE_ADDR bp_addr,
- int nargs,
- struct value **args,
- CORE_ADDR sp,
+xtensa_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
+ struct regcache *regcache, CORE_ADDR bp_addr,
+ int nargs, struct value **args, CORE_ADDR sp,
function_call_return_method return_method,
CORE_ADDR struct_addr)
{
@@ -1682,21 +1595,23 @@ xtensa_push_dummy_call (struct gdbarch *gdbarch,
int size, onstack_size;
gdb_byte *buf = (gdb_byte *) alloca (16);
CORE_ADDR ra, ps;
+
struct argument_info
{
const bfd_byte *contents;
int length;
- int onstack; /* onstack == 0 => in reg */
- int align; /* alignment */
+ int onstack; /* onstack == 0 => in reg */
+ int align; /* alignment */
+
union
{
- int offset; /* stack offset if on stack. */
- int regno; /* regno if in register. */
+ int offset; /* stack offset if on stack. */
+ int regno; /* regno if in register. */
} u;
};
- struct argument_info *arg_info =
- (struct argument_info *) alloca (nargs * sizeof (struct argument_info));
+ struct argument_info *arg_info
+ = (struct argument_info *) alloca (nargs * sizeof (struct argument_info));
CORE_ADDR osp = sp;
@@ -1809,8 +1724,7 @@ xtensa_push_dummy_call (struct gdbarch *gdbarch,
sp = align_down (sp - onstack_size, SP_ALIGNMENT);
/* Simulate MOVSP, if Windowed ABI. */
- if ((tdep->call_abi != CallAbiCall0Only)
- && (sp != osp))
+ if ((tdep->call_abi != CallAbiCall0Only) && (sp != osp))
{
read_memory (osp - 16, buf, 16);
write_memory (sp - 16, buf, 16);
@@ -1842,7 +1756,6 @@ xtensa_push_dummy_call (struct gdbarch *gdbarch,
offset += (REGISTER_SIZE - n);
write_memory (offset, info->contents, info->length);
-
}
else
{
@@ -1892,10 +1805,8 @@ xtensa_push_dummy_call (struct gdbarch *gdbarch,
ra = (bp_addr & 0x3fffffff) | 0x40000000;
regcache_raw_read_unsigned (regcache, gdbarch_ps_regnum (gdbarch), &val);
ps = (unsigned long) val & ~0x00030000;
- regcache_cooked_write_unsigned
- (regcache, tdep->a0_base + 4, ra);
- regcache_cooked_write_unsigned (regcache,
- gdbarch_ps_regnum (gdbarch),
+ regcache_cooked_write_unsigned (regcache, tdep->a0_base + 4, ra);
+ regcache_cooked_write_unsigned (regcache, gdbarch_ps_regnum (gdbarch),
ps | 0x00010000);
/* All the registers have been saved. After executing
@@ -1904,20 +1815,18 @@ xtensa_push_dummy_call (struct gdbarch *gdbarch,
is only one register window corresponding to WINDOWEBASE. */
regcache->raw_read (tdep->wb_regnum, buf);
- regcache_cooked_write_unsigned
- (regcache, tdep->ws_regnum,
- 1 << extract_unsigned_integer (buf, 4, byte_order));
+ regcache_cooked_write_unsigned (
+ regcache, tdep->ws_regnum,
+ 1 << extract_unsigned_integer (buf, 4, byte_order));
}
else
{
/* Simulate CALL0: write RA into A0 register. */
- regcache_cooked_write_unsigned
- (regcache, tdep->a0_base, bp_addr);
+ regcache_cooked_write_unsigned (regcache, tdep->a0_base, bp_addr);
}
/* Set new stack pointer and return it. */
- regcache_cooked_write_unsigned (regcache,
- tdep->a0_base + 1, sp);
+ regcache_cooked_write_unsigned (regcache, tdep->a0_base + 1, sp);
/* Make dummy frame ID unique by adding a constant. */
return sp + SP_ALIGNMENT;
}
@@ -1939,10 +1848,22 @@ xtensa_breakpoint_kind_from_pc (struct gdbarch *gdbarch, CORE_ADDR *pcptr)
the density version if we have density instructions (regardless of the
current instruction at PC), and use regular instructions otherwise. */
-#define BIG_BREAKPOINT { 0x00, 0x04, 0x00 }
-#define LITTLE_BREAKPOINT { 0x00, 0x40, 0x00 }
-#define DENSITY_BIG_BREAKPOINT { 0xd2, 0x0f }
-#define DENSITY_LITTLE_BREAKPOINT { 0x2d, 0xf0 }
+#define BIG_BREAKPOINT \
+ { \
+ 0x00, 0x04, 0x00 \
+ }
+#define LITTLE_BREAKPOINT \
+ { \
+ 0x00, 0x40, 0x00 \
+ }
+#define DENSITY_BIG_BREAKPOINT \
+ { \
+ 0xd2, 0x0f \
+ }
+#define DENSITY_LITTLE_BREAKPOINT \
+ { \
+ 0x2d, 0xf0 \
+ }
/* Implement the sw_breakpoint_from_kind gdbarch method. */
@@ -1976,7 +1897,7 @@ xtensa_sw_breakpoint_from_kind (struct gdbarch *gdbarch, int kind, int *size)
/* Call0 ABI support routines. */
-/* Return true, if PC points to "ret" or "ret.n". */
+/* Return true, if PC points to "ret" or "ret.n". */
static int
call0_ret (CORE_ADDR start_pc, CORE_ADDR finish_pc)
@@ -1998,18 +1919,18 @@ call0_ret (CORE_ADDR start_pc, CORE_ADDR finish_pc)
slot = xtensa_insnbuf_alloc (isa);
ba = 0;
- for (ia = start_pc, bt = ia; ia < finish_pc ; ia += ilen)
+ for (ia = start_pc, bt = ia; ia < finish_pc; ia += ilen)
{
if (ia + xtensa_isa_maxlength (isa) > bt)
{
ba = ia;
- bt = (ba + XTENSA_ISA_BSZ) < finish_pc
- ? ba + XTENSA_ISA_BSZ : finish_pc;
- if (target_read_memory (ba, ibuf, bt - ba) != 0 )
+ bt = (ba + XTENSA_ISA_BSZ) < finish_pc ? ba + XTENSA_ISA_BSZ
+ : finish_pc;
+ if (target_read_memory (ba, ibuf, bt - ba) != 0)
RETURN_RET;
}
- xtensa_insnbuf_from_chars (isa, ins, &ibuf[ia-ba], 0);
+ xtensa_insnbuf_from_chars (isa, ins, &ibuf[ia - ba], 0);
ifmt = xtensa_format_decode (isa, ins);
if (ifmt == XTENSA_UNDEFINED)
RETURN_RET;
@@ -2019,18 +1940,18 @@ call0_ret (CORE_ADDR start_pc, CORE_ADDR finish_pc)
islots = xtensa_format_num_slots (isa, ifmt);
if (islots == XTENSA_UNDEFINED)
RETURN_RET;
-
+
for (is = 0; is < islots; ++is)
{
if (xtensa_format_get_slot (isa, ifmt, is, ins, slot))
RETURN_RET;
-
+
opc = xtensa_opcode_decode (isa, ifmt, is, slot);
- if (opc == XTENSA_UNDEFINED)
+ if (opc == XTENSA_UNDEFINED)
RETURN_RET;
-
+
opcname = xtensa_opcode_name (isa, opc);
-
+
if ((strcasecmp (opcname, "ret.n") == 0)
|| (strcasecmp (opcname, "ret") == 0))
{
@@ -2039,9 +1960,9 @@ call0_ret (CORE_ADDR start_pc, CORE_ADDR finish_pc)
}
}
}
- done:
- xtensa_insnbuf_free(isa, slot);
- xtensa_insnbuf_free(isa, ins);
+done:
+ xtensa_insnbuf_free (isa, slot);
+ xtensa_insnbuf_free (isa, ins);
return found_ret;
}
@@ -2064,13 +1985,13 @@ enum xtensa_insn_kind
c0opc_mov, /* Moving a register to a register. */
c0opc_movi, /* Moving an immediate to a register. */
c0opc_l32r, /* Loading a literal. */
- c0opc_s32i, /* Storing word at fixed offset from a base register. */
- c0opc_rwxsr, /* RSR, WRS, or XSR instructions. */
- c0opc_l32e, /* L32E instruction. */
- c0opc_s32e, /* S32E instruction. */
- c0opc_rfwo, /* RFWO instruction. */
- c0opc_rfwu, /* RFWU instruction. */
- c0opc_NrOf /* Number of opcode classifications. */
+ c0opc_s32i, /* Storing word at fixed offset from a base register. */
+ c0opc_rwxsr, /* RSR, WRS, or XSR instructions. */
+ c0opc_l32e, /* L32E instruction. */
+ c0opc_s32e, /* S32E instruction. */
+ c0opc_rfwo, /* RFWO instruction. */
+ c0opc_rfwu, /* RFWU instruction. */
+ c0opc_NrOf /* Number of opcode classifications. */
};
/* Return true, if OPCNAME is RSR, WRS, or XSR instruction. */
@@ -2079,7 +2000,7 @@ static int
rwx_special_register (const char *opcname)
{
char ch = *opcname++;
-
+
if ((ch != 'r') && (ch != 'w') && (ch != 'x'))
return 0;
if (*opcname++ != 's')
@@ -2106,13 +2027,12 @@ call0_classify_opcode (xtensa_isa isa, xtensa_opcode opc)
opcname = xtensa_opcode_name (isa, opc);
- if (opcname == NULL
- || strcasecmp (opcname, "ill") == 0
+ if (opcname == NULL || strcasecmp (opcname, "ill") == 0
|| strcasecmp (opcname, "ill.n") == 0)
opclass = c0opc_illegal;
else if (strcasecmp (opcname, "break") == 0
|| strcasecmp (opcname, "break.n") == 0)
- opclass = c0opc_break;
+ opclass = c0opc_break;
else if (strcasecmp (opcname, "entry") == 0)
opclass = c0opc_entry;
else if (strcasecmp (opcname, "rfwo") == 0)
@@ -2120,20 +2040,20 @@ call0_classify_opcode (xtensa_isa isa, xtensa_opcode opc)
else if (strcasecmp (opcname, "rfwu") == 0)
opclass = c0opc_rfwu;
else if (xtensa_opcode_is_branch (isa, opc) > 0
- || xtensa_opcode_is_jump (isa, opc) > 0
- || xtensa_opcode_is_loop (isa, opc) > 0
- || xtensa_opcode_is_call (isa, opc) > 0
+ || xtensa_opcode_is_jump (isa, opc) > 0
+ || xtensa_opcode_is_loop (isa, opc) > 0
+ || xtensa_opcode_is_call (isa, opc) > 0
|| strcasecmp (opcname, "simcall") == 0
|| strcasecmp (opcname, "syscall") == 0)
opclass = c0opc_flow;
/* Also, classify specific opcodes that need to be tracked. */
- else if (strcasecmp (opcname, "add") == 0
+ else if (strcasecmp (opcname, "add") == 0
|| strcasecmp (opcname, "add.n") == 0)
opclass = c0opc_add;
else if (strcasecmp (opcname, "and") == 0)
opclass = c0opc_and;
- else if (strcasecmp (opcname, "addi") == 0
+ else if (strcasecmp (opcname, "addi") == 0
|| strcasecmp (opcname, "addi.n") == 0
|| strcasecmp (opcname, "addmi") == 0)
opclass = c0opc_addi;
@@ -2142,12 +2062,12 @@ call0_classify_opcode (xtensa_isa isa, xtensa_opcode opc)
else if (strcasecmp (opcname, "mov.n") == 0
|| strcasecmp (opcname, "or") == 0) /* Could be 'mov' asm macro. */
opclass = c0opc_mov;
- else if (strcasecmp (opcname, "movi") == 0
+ else if (strcasecmp (opcname, "movi") == 0
|| strcasecmp (opcname, "movi.n") == 0)
opclass = c0opc_movi;
else if (strcasecmp (opcname, "l32r") == 0)
opclass = c0opc_l32r;
- else if (strcasecmp (opcname, "s32i") == 0
+ else if (strcasecmp (opcname, "s32i") == 0
|| strcasecmp (opcname, "s32i.n") == 0)
opclass = c0opc_s32i;
else if (strcasecmp (opcname, "l32e") == 0)
@@ -2168,9 +2088,10 @@ call0_classify_opcode (xtensa_isa isa, xtensa_opcode opc)
otherwise. */
static int
-call0_track_op (struct gdbarch *gdbarch, xtensa_c0reg_t dst[], xtensa_c0reg_t src[],
- xtensa_insn_kind opclass, int nods, unsigned odv[],
- CORE_ADDR pc, int spreg, xtensa_frame_cache_t *cache)
+call0_track_op (struct gdbarch *gdbarch, xtensa_c0reg_t dst[],
+ xtensa_c0reg_t src[], xtensa_insn_kind opclass, int nods,
+ unsigned odv[], CORE_ADDR pc, int spreg,
+ xtensa_frame_cache_t *cache)
{
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
unsigned litbase, litaddr, litval;
@@ -2186,8 +2107,8 @@ call0_track_op (struct gdbarch *gdbarch, xtensa_c0reg_t dst[], xtensa_c0reg_t sr
break;
case c0opc_add:
/* 3 operands: dst, src1, src2. */
- gdb_assert (nods == 3);
- if (src[odv[1]].fr_reg == C0_CONST)
+ gdb_assert (nods == 3);
+ if (src[odv[1]].fr_reg == C0_CONST)
{
dst[odv[0]].fr_reg = src[odv[2]].fr_reg;
dst[odv[0]].fr_ofs = src[odv[2]].fr_ofs + src[odv[1]].fr_ofs;
@@ -2197,7 +2118,8 @@ call0_track_op (struct gdbarch *gdbarch, xtensa_c0reg_t dst[], xtensa_c0reg_t sr
dst[odv[0]].fr_reg = src[odv[1]].fr_reg;
dst[odv[0]].fr_ofs = src[odv[1]].fr_ofs + src[odv[2]].fr_ofs;
}
- else dst[odv[0]].fr_reg = C0_INEXP;
+ else
+ dst[odv[0]].fr_reg = C0_INEXP;
break;
case c0opc_and:
/* 3 operands: dst, src1, src2. */
@@ -2220,7 +2142,7 @@ call0_track_op (struct gdbarch *gdbarch, xtensa_c0reg_t dst[], xtensa_c0reg_t sr
}
/* else fall through. */
}
- if (src[odv[1]].fr_reg == C0_CONST)
+ if (src[odv[1]].fr_reg == C0_CONST)
{
dst[odv[0]].fr_reg = src[odv[2]].fr_reg;
dst[odv[0]].fr_ofs = src[odv[2]].fr_ofs & src[odv[1]].fr_ofs;
@@ -2230,17 +2152,19 @@ call0_track_op (struct gdbarch *gdbarch, xtensa_c0reg_t dst[], xtensa_c0reg_t sr
dst[odv[0]].fr_reg = src[odv[1]].fr_reg;
dst[odv[0]].fr_ofs = src[odv[1]].fr_ofs & src[odv[2]].fr_ofs;
}
- else dst[odv[0]].fr_reg = C0_INEXP;
+ else
+ dst[odv[0]].fr_reg = C0_INEXP;
break;
case c0opc_sub:
/* 3 operands: dst, src1, src2. */
gdb_assert (nods == 3);
- if (src[odv[2]].fr_reg == C0_CONST)
+ if (src[odv[2]].fr_reg == C0_CONST)
{
dst[odv[0]].fr_reg = src[odv[1]].fr_reg;
dst[odv[0]].fr_ofs = src[odv[1]].fr_ofs - src[odv[2]].fr_ofs;
}
- else dst[odv[0]].fr_reg = C0_INEXP;
+ else
+ dst[odv[0]].fr_reg = C0_INEXP;
break;
case c0opc_mov:
/* 2 operands: dst, src [, src]. */
@@ -2266,11 +2190,10 @@ call0_track_op (struct gdbarch *gdbarch, xtensa_c0reg_t dst[], xtensa_c0reg_t sr
gdb_assert (nods == 2);
/* litbase = xtensa_get_litbase (pc); can be also used. */
litbase = (tdep->litbase_regnum == -1)
- ? 0 : xtensa_read_register
- (tdep->litbase_regnum);
- litaddr = litbase & 1
- ? (litbase & ~1) + (signed)odv[1]
- : (pc + 3 + (signed)odv[1]) & ~3;
+ ? 0
+ : xtensa_read_register (tdep->litbase_regnum);
+ litaddr = litbase & 1 ? (litbase & ~1) + (signed) odv[1]
+ : (pc + 3 + (signed) odv[1]) & ~3;
litval = read_memory_integer (litaddr, 4, byte_order);
dst[odv[0]].fr_reg = C0_CONST;
dst[odv[0]].fr_ofs = litval;
@@ -2280,16 +2203,16 @@ call0_track_op (struct gdbarch *gdbarch, xtensa_c0reg_t dst[], xtensa_c0reg_t sr
gdb_assert (nods == 3 && spreg >= 0 && spreg < C0_NREGS);
/* First, check if it's a spill for saved unaligned SP,
when dynamic stack adjustment was applied to this frame. */
- if ((cache->c0.c0_fpalign != 0) /* Dynamic stack adjustment. */
- && (odv[1] == spreg) /* SP usage indicates spill. */
- && (odv[0] == cache->c0.c0_old_sp)) /* Old SP register spilled. */
+ if ((cache->c0.c0_fpalign != 0) /* Dynamic stack adjustment. */
+ && (odv[1] == spreg) /* SP usage indicates spill. */
+ && (odv[0] == cache->c0.c0_old_sp)) /* Old SP register spilled. */
cache->c0.c0_sp_ofs = odv[2];
- if (src[odv[1]].fr_reg == spreg /* Store to stack frame. */
- && (src[odv[1]].fr_ofs & 3) == 0 /* Alignment preserved. */
- && src[odv[0]].fr_reg >= 0 /* Value is from a register. */
- && src[odv[0]].fr_ofs == 0 /* Value hasn't been modified. */
- && src[src[odv[0]].fr_reg].to_stk == C0_NOSTK) /* First time. */
+ if (src[odv[1]].fr_reg == spreg /* Store to stack frame. */
+ && (src[odv[1]].fr_ofs & 3) == 0 /* Alignment preserved. */
+ && src[odv[0]].fr_reg >= 0 /* Value is from a register. */
+ && src[odv[0]].fr_ofs == 0 /* Value hasn't been modified. */
+ && src[src[odv[0]].fr_reg].to_stk == C0_NOSTK) /* First time. */
{
/* ISA encoding guarantees alignment. But, check it anyway. */
gdb_assert ((odv[2] & 3) == 0);
@@ -2336,14 +2259,14 @@ call0_track_op (struct gdbarch *gdbarch, xtensa_c0reg_t dst[], xtensa_c0reg_t sr
because they begin with default assumptions that analysis may change. */
static CORE_ADDR
-call0_analyze_prologue (struct gdbarch *gdbarch,
- CORE_ADDR start, CORE_ADDR pc,
+call0_analyze_prologue (struct gdbarch *gdbarch, CORE_ADDR start, CORE_ADDR pc,
int nregs, xtensa_frame_cache_t *cache)
{
- CORE_ADDR ia; /* Current insn address in prologue. */
- CORE_ADDR ba = 0; /* Current address at base of insn buffer. */
- CORE_ADDR bt; /* Current address at top+1 of insn buffer. */
- gdb_byte ibuf[XTENSA_ISA_BSZ];/* Instruction buffer for decoding prologue. */
+ CORE_ADDR ia; /* Current insn address in prologue. */
+ CORE_ADDR ba = 0; /* Current address at base of insn buffer. */
+ CORE_ADDR bt; /* Current address at top+1 of insn buffer. */
+ gdb_byte
+ ibuf[XTENSA_ISA_BSZ]; /* Instruction buffer for decoding prologue. */
xtensa_isa isa; /* libisa ISA handle. */
xtensa_insnbuf ins, slot; /* libisa handle to decoded insn, slot. */
xtensa_format ifmt; /* libisa instruction format. */
@@ -2360,8 +2283,8 @@ call0_analyze_prologue (struct gdbarch *gdbarch,
struct symtab_and_line prologue_sal;
- DEBUGTRACE ("call0_analyze_prologue (start = 0x%08x, pc = 0x%08x, ...)\n",
- (int)start, (int)pc);
+ DEBUGTRACE ("call0_analyze_prologue (start = 0x%08x, pc = 0x%08x, ...)\n",
+ (int) start, (int) pc);
/* Try to limit the scan to the end of the function if a non-zero pc
arg was not supplied to avoid probing beyond the end of valid memory.
@@ -2391,14 +2314,14 @@ call0_analyze_prologue (struct gdbarch *gdbarch,
body_pc = std::min (pc, body_pc);
cache->call0 = 1;
- rtmp = (xtensa_c0reg_t*) alloca(nregs * sizeof(xtensa_c0reg_t));
+ rtmp = (xtensa_c0reg_t *) alloca (nregs * sizeof (xtensa_c0reg_t));
isa = xtensa_default_isa;
gdb_assert (XTENSA_ISA_BSZ >= xtensa_isa_maxlength (isa));
ins = xtensa_insnbuf_alloc (isa);
slot = xtensa_insnbuf_alloc (isa);
- for (ia = start, bt = ia; ia < body_pc ; ia += ilen)
+ for (ia = start, bt = ia; ia < body_pc; ia += ilen)
{
/* (Re)fill instruction buffer from memory if necessary, but do not
read memory beyond PC to be sure we stay within text section
@@ -2408,13 +2331,13 @@ call0_analyze_prologue (struct gdbarch *gdbarch,
{
ba = ia;
bt = (ba + XTENSA_ISA_BSZ) < body_pc ? ba + XTENSA_ISA_BSZ : body_pc;
- if (target_read_memory (ba, ibuf, bt - ba) != 0 )
- error (_("Unable to read target memory ..."));
+ if (target_read_memory (ba, ibuf, bt - ba) != 0)
+ error (_ ("Unable to read target memory ..."));
}
/* Decode format information. */
- xtensa_insnbuf_from_chars (isa, ins, &ibuf[ia-ba], 0);
+ xtensa_insnbuf_from_chars (isa, ins, &ibuf[ia - ba], 0);
ifmt = xtensa_format_decode (isa, ins);
if (ifmt == XTENSA_UNDEFINED)
{
@@ -2450,9 +2373,10 @@ call0_analyze_prologue (struct gdbarch *gdbarch,
goto done;
opc = xtensa_opcode_decode (isa, ifmt, is, slot);
- DEBUGVERB ("[call0_analyze_prologue] instr addr = 0x%08x, opc = %d\n",
- (unsigned)ia, opc);
- if (opc == XTENSA_UNDEFINED)
+ DEBUGVERB (
+ "[call0_analyze_prologue] instr addr = 0x%08x, opc = %d\n",
+ (unsigned) ia, opc);
+ if (opc == XTENSA_UNDEFINED)
opclass = c0opc_illegal;
else
opclass = call0_classify_opcode (isa, opc);
@@ -2475,7 +2399,7 @@ call0_analyze_prologue (struct gdbarch *gdbarch,
case c0opc_entry:
cache->call0 = 0;
- ia += ilen; /* Skip over 'entry' insn. */
+ ia += ilen; /* Skip over 'entry' insn. */
goto done;
default:
@@ -2494,8 +2418,8 @@ call0_analyze_prologue (struct gdbarch *gdbarch,
for (j = 0; j < nods && j < C0_MAXOPDS; ++j)
{
- fail = xtensa_operand_get_field (isa, opc, j, ifmt,
- is, slot, &odv[j]);
+ fail = xtensa_operand_get_field (isa, opc, j, ifmt, is, slot,
+ &odv[j]);
if (fail)
goto done;
@@ -2523,36 +2447,35 @@ call0_analyze_prologue (struct gdbarch *gdbarch,
}
/* Track register movement and modification for this operation. */
- fail = call0_track_op (gdbarch, cache->c0.c0_rt, rtmp,
- opclass, nods, odv, ia, 1, cache);
+ fail = call0_track_op (gdbarch, cache->c0.c0_rt, rtmp, opclass, nods,
+ odv, ia, 1, cache);
if (fail)
goto done;
}
}
done:
DEBUGVERB ("[call0_analyze_prologue] stopped at instr addr 0x%08x, %s\n",
- (unsigned)ia, fail ? "failed" : "succeeded");
- xtensa_insnbuf_free(isa, slot);
- xtensa_insnbuf_free(isa, ins);
+ (unsigned) ia, fail ? "failed" : "succeeded");
+ xtensa_insnbuf_free (isa, slot);
+ xtensa_insnbuf_free (isa, ins);
return fail ? XTENSA_ISA_BADPC : ia;
}
/* Initialize frame cache for the current frame in CALL0 ABI. */
static void
-call0_frame_cache (frame_info_ptr this_frame,
- xtensa_frame_cache_t *cache, CORE_ADDR pc)
+call0_frame_cache (frame_info_ptr this_frame, xtensa_frame_cache_t *cache,
+ CORE_ADDR pc)
{
struct gdbarch *gdbarch = get_frame_arch (this_frame);
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
CORE_ADDR start_pc; /* The beginning of the function. */
- CORE_ADDR body_pc=UINT_MAX; /* PC, where prologue analysis stopped. */
+ CORE_ADDR body_pc = UINT_MAX; /* PC, where prologue analysis stopped. */
CORE_ADDR sp, fp, ra;
int fp_regnum = C0_SP, c0_hasfp = 0, c0_frmsz = 0, prev_sp = 0, to_stk;
xtensa_gdbarch_tdep *tdep = gdbarch_tdep<xtensa_gdbarch_tdep> (gdbarch);
-
- sp = get_frame_register_unsigned
- (this_frame, tdep->a0_base + 1);
+
+ sp = get_frame_register_unsigned (this_frame, tdep->a0_base + 1);
fp = sp; /* Assume FP == SP until proven otherwise. */
/* Find the beginning of the prologue of the function containing the PC
@@ -2560,7 +2483,8 @@ call0_frame_cache (frame_info_ptr this_frame,
if (find_pc_partial_function (pc, NULL, &start_pc, NULL))
{
- body_pc = call0_analyze_prologue (gdbarch, start_pc, pc, C0_NREGS, cache);
+ body_pc
+ = call0_analyze_prologue (gdbarch, start_pc, pc, C0_NREGS, cache);
if (body_pc == XTENSA_ISA_BADPC)
{
@@ -2569,7 +2493,7 @@ call0_frame_cache (frame_info_ptr this_frame,
goto finish_frame_analysis;
}
}
-
+
/* Get the frame information and FP (if used) at the current PC.
If PC is in the prologue, the prologue analysis is more reliable
than DWARF info. We don't not know for sure, if PC is in the prologue,
@@ -2585,16 +2509,16 @@ call0_frame_cache (frame_info_ptr this_frame,
we analyzed the prologue and found that cache->c0.c0_rt[C0_FP]
was derived from SP. Otherwise, it would be C0_FP. */
fp_regnum = c0_hasfp ? C0_FP : C0_SP;
- c0_frmsz = - cache->c0.c0_rt[fp_regnum].fr_ofs;
+ c0_frmsz = -cache->c0.c0_rt[fp_regnum].fr_ofs;
fp_regnum += tdep->a0_base;
}
- else /* No data from the prologue analysis. */
+ else /* No data from the prologue analysis. */
{
c0_hasfp = 0;
fp_regnum = tdep->a0_base + C0_SP;
c0_frmsz = 0;
start_pc = pc;
- }
+ }
if (cache->c0.c0_fpalign)
{
@@ -2614,12 +2538,14 @@ call0_frame_cache (frame_info_ptr this_frame,
if (cache->c0.c0_sp_ofs == C0_NOSTK)
/* Saved unaligned value of SP is kept in a register. */
- unaligned_sp = get_frame_register_unsigned
- (this_frame, tdep->a0_base + cache->c0.c0_old_sp);
+ unaligned_sp
+ = get_frame_register_unsigned (this_frame,
+ tdep->a0_base + cache->c0.c0_old_sp);
else
/* Get the value from stack. */
- unaligned_sp = (CORE_ADDR)
- read_memory_integer (fp + cache->c0.c0_sp_ofs, 4, byte_order);
+ unaligned_sp
+ = (CORE_ADDR) read_memory_integer (fp + cache->c0.c0_sp_ofs, 4,
+ byte_order);
prev_sp = unaligned_sp + c0_frmsz;
}
@@ -2641,9 +2567,9 @@ call0_frame_cache (frame_info_ptr this_frame,
to_stk = cache->c0.c0_rt[C0_RA].to_stk;
if (to_stk != C0_NOSTK)
- ra = (CORE_ADDR)
- read_memory_integer (sp + c0_frmsz + cache->c0.c0_rt[C0_RA].to_stk,
- 4, byte_order);
+ ra = (CORE_ADDR) read_memory_integer (sp + c0_frmsz
+ + cache->c0.c0_rt[C0_RA].to_stk,
+ 4, byte_order);
else if (cache->c0.c0_rt[C0_RA].fr_reg == C0_CONST
&& cache->c0.c0_rt[C0_RA].fr_ofs == 0)
@@ -2665,26 +2591,27 @@ call0_frame_cache (frame_info_ptr this_frame,
too bad. */
int i;
- for (i = 0;
- (i < C0_NREGS)
- && (i == C0_RA || cache->c0.c0_rt[i].fr_reg != C0_RA);
- ++i);
+ for (i = 0; (i < C0_NREGS)
+ && (i == C0_RA || cache->c0.c0_rt[i].fr_reg != C0_RA);
+ ++i)
+ ;
if (i >= C0_NREGS && cache->c0.c0_rt[C0_RA].fr_reg == C0_RA)
i = C0_RA;
if (i < C0_NREGS)
{
- ra = get_frame_register_unsigned
- (this_frame,
- tdep->a0_base + cache->c0.c0_rt[i].fr_reg);
+ ra = get_frame_register_unsigned (this_frame,
+ tdep->a0_base
+ + cache->c0.c0_rt[i].fr_reg);
}
- else ra = 0;
+ else
+ ra = 0;
}
-
- finish_frame_analysis:
+
+finish_frame_analysis:
cache->pc = start_pc;
cache->ra = ra;
/* RA == 0 marks the outermost frame. Do not go past it. */
- cache->prev_sp = (ra != 0) ? prev_sp : 0;
+ cache->prev_sp = (ra != 0) ? prev_sp : 0;
cache->c0.fp_regnum = fp_regnum;
cache->c0.c0_frmsz = c0_frmsz;
cache->c0.c0_hasfp = c0_hasfp;
@@ -2700,7 +2627,8 @@ static int a11_was_saved;
/* Simulate L32E instruction: AT <-- ref (AS + offset). */
static void
-execute_l32e (struct gdbarch *gdbarch, int at, int as, int offset, CORE_ADDR wb)
+execute_l32e (struct gdbarch *gdbarch, int at, int as, int offset,
+ CORE_ADDR wb)
{
xtensa_gdbarch_tdep *tdep = gdbarch_tdep<xtensa_gdbarch_tdep> (gdbarch);
int atreg = arreg_number (gdbarch, tdep->a0_base + at, wb);
@@ -2730,7 +2658,8 @@ execute_l32e (struct gdbarch *gdbarch, int at, int as, int offset, CORE_ADDR wb)
/* Simulate S32E instruction: AT --> ref (AS + offset). */
static void
-execute_s32e (struct gdbarch *gdbarch, int at, int as, int offset, CORE_ADDR wb)
+execute_s32e (struct gdbarch *gdbarch, int at, int as, int offset,
+ CORE_ADDR wb)
{
xtensa_gdbarch_tdep *tdep = gdbarch_tdep<xtensa_gdbarch_tdep> (gdbarch);
int atreg = arreg_number (gdbarch, tdep->a0_base + at, wb);
@@ -2738,12 +2667,11 @@ execute_s32e (struct gdbarch *gdbarch, int at, int as, int offset, CORE_ADDR wb)
CORE_ADDR addr = xtensa_read_register (asreg) + offset;
ULONGEST spilled_value = xtensa_read_register (atreg);
- write_memory_unsigned_integer (addr, 4,
- gdbarch_byte_order (gdbarch),
+ write_memory_unsigned_integer (addr, 4, gdbarch_byte_order (gdbarch),
spilled_value);
}
-#define XTENSA_MAX_WINDOW_INTERRUPT_HANDLER_LEN 200
+#define XTENSA_MAX_WINDOW_INTERRUPT_HANDLER_LEN 200
enum xtensa_exception_handler_t
{
@@ -2770,8 +2698,8 @@ execute_code (struct gdbarch *gdbarch, CORE_ADDR current_pc, CORE_ADDR wb)
uint32_t at, as, offset;
- /* WindowUnderflow12 = true, when inside _WindowUnderflow12. */
- int WindowUnderflow12 = (current_pc & 0x1ff) >= 0x140;
+ /* WindowUnderflow12 = true, when inside _WindowUnderflow12. */
+ int WindowUnderflow12 = (current_pc & 0x1ff) >= 0x140;
isa = xtensa_default_isa;
gdb_assert (XTENSA_ISA_BSZ >= xtensa_isa_maxlength (isa));
@@ -2794,7 +2722,7 @@ execute_code (struct gdbarch *gdbarch, CORE_ADDR current_pc, CORE_ADDR wb)
if (target_read_memory (ba, ibuf, bt - ba) != 0)
return xtNoExceptionHandler;
}
- xtensa_insnbuf_from_chars (isa, ins, &ibuf[ia-ba], 0);
+ xtensa_insnbuf_from_chars (isa, ins, &ibuf[ia - ba], 0);
ifmt = xtensa_format_decode (isa, ins);
if (ifmt == XTENSA_UNDEFINED)
return xtNoExceptionHandler;
@@ -2809,7 +2737,7 @@ execute_code (struct gdbarch *gdbarch, CORE_ADDR current_pc, CORE_ADDR wb)
if (xtensa_format_get_slot (isa, ifmt, is, ins, slot))
return xtNoExceptionHandler;
opc = xtensa_opcode_decode (isa, ifmt, is, slot);
- if (opc == XTENSA_UNDEFINED)
+ if (opc == XTENSA_UNDEFINED)
return xtNoExceptionHandler;
switch (call0_classify_opcode (isa, opc))
{
@@ -2831,9 +2759,7 @@ execute_code (struct gdbarch *gdbarch, CORE_ADDR current_pc, CORE_ADDR wb)
A0 was saved, we have to restore it now. */
if (a0_was_saved)
{
- int arreg = arreg_number (gdbarch,
- tdep->a0_base,
- wb);
+ int arreg = arreg_number (gdbarch, tdep->a0_base, wb);
xtensa_write_register (arreg, a0_saved);
}
return xtWindowOverflow;
@@ -2844,17 +2770,14 @@ execute_code (struct gdbarch *gdbarch, CORE_ADDR current_pc, CORE_ADDR wb)
{
if (a11_was_saved)
{
- int arreg = arreg_number (gdbarch,
- tdep->a0_base + 11,
- wb);
+ int arreg
+ = arreg_number (gdbarch, tdep->a0_base + 11, wb);
xtensa_write_register (arreg, a11_saved);
}
}
else if (a7_was_saved)
{
- int arreg = arreg_number (gdbarch,
- tdep->a0_base + 7,
- wb);
+ int arreg = arreg_number (gdbarch, tdep->a0_base + 7, wb);
xtensa_write_register (arreg, a7_saved);
}
return xtWindowUnderflow;
@@ -2863,7 +2786,7 @@ execute_code (struct gdbarch *gdbarch, CORE_ADDR current_pc, CORE_ADDR wb)
}
/* Decode arguments for L32E / S32E and simulate their execution. */
- if ( xtensa_opcode_num_operands (isa, opc) != 3 )
+ if (xtensa_opcode_num_operands (isa, opc) != 3)
return xtNoExceptionHandler;
if (xtensa_operand_get_field (isa, opc, 0, ifmt, is, slot, &at))
return xtNoExceptionHandler;
@@ -2890,8 +2813,7 @@ execute_code (struct gdbarch *gdbarch, CORE_ADDR current_pc, CORE_ADDR wb)
static void
xtensa_window_interrupt_frame_cache (frame_info_ptr this_frame,
- xtensa_frame_cache_t *cache,
- CORE_ADDR pc)
+ xtensa_frame_cache_t *cache, CORE_ADDR pc)
{
struct gdbarch *gdbarch = get_frame_arch (this_frame);
CORE_ADDR ps, wb, ws, ra;
@@ -2910,11 +2832,11 @@ xtensa_window_interrupt_frame_cache (frame_info_ptr this_frame,
type of Xtensa Window Interrupt Handler, or report an error. */
eh_type = execute_code (gdbarch, pc, wb);
if (eh_type == xtNoExceptionHandler)
- error (_("\
+ error (_ ("\
Unable to decode Xtensa Window Interrupt Handler's code."));
- cache->ps = ps ^ PS_EXC; /* Clear the exception bit in PS. */
- cache->call0 = 0; /* It's Windowed ABI. */
+ cache->ps = ps ^ PS_EXC; /* Clear the exception bit in PS. */
+ cache->call0 = 0; /* It's Windowed ABI. */
/* All registers for the cached frame will be alive. */
for (i = 0; i < XTENSA_NUM_SAVED_AREGS; i++)
@@ -2926,27 +2848,23 @@ Unable to decode Xtensa Window Interrupt Handler's code."));
cache->wd.ws = ws | (1 << wb);
cache->wd.wb = (ps & 0xf00) >> 8; /* Set WB to OWB. */
- regnum = arreg_number (gdbarch, tdep->a0_base,
- cache->wd.wb);
+ regnum = arreg_number (gdbarch, tdep->a0_base, cache->wd.wb);
ra = xtensa_read_register (regnum);
cache->wd.callsize = WINSIZE (ra);
cache->prev_sp = xtensa_read_register (regnum + 1);
/* Set regnum to a frame pointer of the frame being cached. */
regnum = xtensa_scan_prologue (gdbarch, pc);
- regnum = arreg_number (gdbarch,
- tdep->a0_base + regnum,
- cache->wd.wb);
+ regnum = arreg_number (gdbarch, tdep->a0_base + regnum, cache->wd.wb);
cache->base = get_frame_register_unsigned (this_frame, regnum);
/* Read PC of interrupted function from EPC1 register. */
- epc1_regnum = xtensa_find_register_by_name (gdbarch,"epc1");
+ epc1_regnum = xtensa_find_register_by_name (gdbarch, "epc1");
if (epc1_regnum < 0)
- error(_("Unable to read Xtensa register EPC1"));
+ error (_ ("Unable to read Xtensa register EPC1"));
cache->ra = xtensa_read_register (epc1_regnum);
cache->pc = get_frame_func (this_frame);
}
-
/* Skip function prologue.
Return the pc of the first instruction after prologue. GDB calls this to
@@ -2996,7 +2914,7 @@ xtensa_skip_prologue (struct gdbarch *gdbarch, CORE_ADDR start_pc)
return start_pc;
#endif
- /* Try to find first body line from debug info. */
+ /* Try to find first body line from debug info. */
prologue_sal = find_pc_line (start_pc, 0);
if (prologue_sal.line != 0) /* Found debug info. */
@@ -3038,50 +2956,49 @@ xtensa_verify_config (struct gdbarch *gdbarch)
/* Verify that we got a reasonable number of AREGS. */
if ((tdep->num_aregs & -tdep->num_aregs) != tdep->num_aregs)
- log.printf (_("\
+ log.printf (_ ("\
\n\tnum_aregs: Number of AR registers (%d) is not a power of two!"),
tdep->num_aregs);
/* Verify that certain registers exist. */
if (tdep->pc_regnum == -1)
- log.printf (_("\n\tpc_regnum: No PC register"));
+ log.printf (_ ("\n\tpc_regnum: No PC register"));
if (tdep->isa_use_exceptions && tdep->ps_regnum == -1)
- log.printf (_("\n\tps_regnum: No PS register"));
+ log.printf (_ ("\n\tps_regnum: No PS register"));
if (tdep->isa_use_windowed_registers)
{
if (tdep->wb_regnum == -1)
- log.printf (_("\n\twb_regnum: No WB register"));
+ log.printf (_ ("\n\twb_regnum: No WB register"));
if (tdep->ws_regnum == -1)
- log.printf (_("\n\tws_regnum: No WS register"));
+ log.printf (_ ("\n\tws_regnum: No WS register"));
if (tdep->ar_base == -1)
- log.printf (_("\n\tar_base: No AR registers"));
+ log.printf (_ ("\n\tar_base: No AR registers"));
}
if (tdep->a0_base == -1)
- log.printf (_("\n\ta0_base: No Ax registers"));
+ log.printf (_ ("\n\ta0_base: No Ax registers"));
if (!log.empty ())
- internal_error (_("the following are invalid: %s"), log.c_str ());
+ internal_error (_ ("the following are invalid: %s"), log.c_str ());
}
-
/* Derive specific register numbers from the array of registers. */
static void
xtensa_derive_tdep (xtensa_gdbarch_tdep *tdep)
{
- xtensa_register_t* rmap;
+ xtensa_register_t *rmap;
int n, max_size = 4;
tdep->num_regs = 0;
tdep->num_nopriv_regs = 0;
/* Special registers 0..255 (core). */
-#define XTENSA_DBREGN_SREG(n) (0x0200+(n))
+#define XTENSA_DBREGN_SREG(n) (0x0200 + (n))
/* User registers 0..255. */
-#define XTENSA_DBREGN_UREG(n) (0x0300+(n))
+#define XTENSA_DBREGN_UREG(n) (0x0300 + (n))
for (rmap = tdep->regmap, n = 0; rmap->target_number != -1; n++, rmap++)
{
@@ -3091,29 +3008,29 @@ xtensa_derive_tdep (xtensa_gdbarch_tdep *tdep)
tdep->ar_base = n;
else if (rmap->target_number == 0x0000)
tdep->a0_base = n;
- else if (rmap->target_number == XTENSA_DBREGN_SREG(72))
+ else if (rmap->target_number == XTENSA_DBREGN_SREG (72))
tdep->wb_regnum = n;
- else if (rmap->target_number == XTENSA_DBREGN_SREG(73))
+ else if (rmap->target_number == XTENSA_DBREGN_SREG (73))
tdep->ws_regnum = n;
- else if (rmap->target_number == XTENSA_DBREGN_SREG(233))
+ else if (rmap->target_number == XTENSA_DBREGN_SREG (233))
tdep->debugcause_regnum = n;
- else if (rmap->target_number == XTENSA_DBREGN_SREG(232))
+ else if (rmap->target_number == XTENSA_DBREGN_SREG (232))
tdep->exccause_regnum = n;
- else if (rmap->target_number == XTENSA_DBREGN_SREG(238))
+ else if (rmap->target_number == XTENSA_DBREGN_SREG (238))
tdep->excvaddr_regnum = n;
- else if (rmap->target_number == XTENSA_DBREGN_SREG(0))
+ else if (rmap->target_number == XTENSA_DBREGN_SREG (0))
tdep->lbeg_regnum = n;
- else if (rmap->target_number == XTENSA_DBREGN_SREG(1))
+ else if (rmap->target_number == XTENSA_DBREGN_SREG (1))
tdep->lend_regnum = n;
- else if (rmap->target_number == XTENSA_DBREGN_SREG(2))
+ else if (rmap->target_number == XTENSA_DBREGN_SREG (2))
tdep->lcount_regnum = n;
- else if (rmap->target_number == XTENSA_DBREGN_SREG(3))
+ else if (rmap->target_number == XTENSA_DBREGN_SREG (3))
tdep->sar_regnum = n;
- else if (rmap->target_number == XTENSA_DBREGN_SREG(5))
+ else if (rmap->target_number == XTENSA_DBREGN_SREG (5))
tdep->litbase_regnum = n;
- else if (rmap->target_number == XTENSA_DBREGN_SREG(230))
+ else if (rmap->target_number == XTENSA_DBREGN_SREG (230))
tdep->ps_regnum = n;
- else if (rmap->target_number == XTENSA_DBREGN_UREG(231))
+ else if (rmap->target_number == XTENSA_DBREGN_UREG (231))
tdep->threadptr_regnum = n;
#if 0
else if (rmap->target_number == XTENSA_DBREGN_SREG(226))
@@ -3232,11 +3149,11 @@ xtensa_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
xtensa_add_reggroups (gdbarch);
set_gdbarch_register_reggroup_p (gdbarch, xtensa_register_reggroup_p);
- set_gdbarch_iterate_over_regset_sections
- (gdbarch, xtensa_iterate_over_regset_sections);
+ set_gdbarch_iterate_over_regset_sections (
+ gdbarch, xtensa_iterate_over_regset_sections);
- set_solib_svr4_fetch_link_map_offsets
- (gdbarch, svr4_ilp32_fetch_link_map_offsets);
+ set_solib_svr4_fetch_link_map_offsets (gdbarch,
+ svr4_ilp32_fetch_link_map_offsets);
/* Hook in the ABI-specific overrides, if they have been registered. */
gdbarch_init_osabi (info, gdbarch);
@@ -3247,24 +3164,21 @@ xtensa_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
static void
xtensa_dump_tdep (struct gdbarch *gdbarch, struct ui_file *file)
{
- error (_("xtensa_dump_tdep(): not implemented"));
+ error (_ ("xtensa_dump_tdep(): not implemented"));
}
void _initialize_xtensa_tdep ();
+
void
_initialize_xtensa_tdep ()
{
gdbarch_register (bfd_arch_xtensa, xtensa_gdbarch_init, xtensa_dump_tdep);
xtensa_init_reggroups ();
- add_setshow_zuinteger_cmd ("xtensa",
- class_maintenance,
- &xtensa_debug_level,
- _("Set Xtensa debugging."),
- _("Show Xtensa debugging."), _("\
+ add_setshow_zuinteger_cmd ("xtensa", class_maintenance, &xtensa_debug_level,
+ _ ("Set Xtensa debugging."),
+ _ ("Show Xtensa debugging."), _ ("\
When non-zero, Xtensa-specific debugging is enabled. \
Can be 1, 2, 3, or 4 indicating the level of debugging."),
- NULL,
- NULL,
- &setdebuglist, &showdebuglist);
+ NULL, NULL, &setdebuglist, &showdebuglist);
}
diff --git a/gdb/xtensa-tdep.h b/gdb/xtensa-tdep.h
index ba1101b7b5b..6d3136f0113 100644
--- a/gdb/xtensa-tdep.h
+++ b/gdb/xtensa-tdep.h
@@ -33,123 +33,142 @@
enum xtensa_register_type_t
{
- xtRegisterTypeArRegfile = 1, /* Register File ar0..arXX. */
- xtRegisterTypeSpecialReg, /* CPU states, such as PS, Booleans, (rsr). */
- xtRegisterTypeUserReg, /* User defined registers (rur). */
- xtRegisterTypeTieRegfile, /* User define register files. */
- xtRegisterTypeTieState, /* TIE States (mapped on user regs). */
- xtRegisterTypeMapped, /* Mapped on Special Registers. */
- xtRegisterTypeUnmapped, /* Special case of masked registers. */
- xtRegisterTypeWindow, /* Live window registers (a0..a15). */
- xtRegisterTypeVirtual, /* PC, FP. */
+ xtRegisterTypeArRegfile = 1, /* Register File ar0..arXX. */
+ xtRegisterTypeSpecialReg, /* CPU states, such as PS, Booleans, (rsr). */
+ xtRegisterTypeUserReg, /* User defined registers (rur). */
+ xtRegisterTypeTieRegfile, /* User define register files. */
+ xtRegisterTypeTieState, /* TIE States (mapped on user regs). */
+ xtRegisterTypeMapped, /* Mapped on Special Registers. */
+ xtRegisterTypeUnmapped, /* Special case of masked registers. */
+ xtRegisterTypeWindow, /* Live window registers (a0..a15). */
+ xtRegisterTypeVirtual, /* PC, FP. */
xtRegisterTypeUnknown
};
-
/* Xtensa register group. */
-#define XTENSA_MAX_COPROCESSOR 0x10 /* Number of Xtensa coprocessors. */
+#define XTENSA_MAX_COPROCESSOR 0x10 /* Number of Xtensa coprocessors. */
enum xtensa_register_group_t
{
xtRegisterGroupUnknown = 0,
- xtRegisterGroupRegFile = 0x0001, /* Register files without ARx. */
- xtRegisterGroupAddrReg = 0x0002, /* ARx. */
- xtRegisterGroupSpecialReg = 0x0004, /* SRxx. */
- xtRegisterGroupUserReg = 0x0008, /* URxx. */
- xtRegisterGroupState = 0x0010, /* States. */
-
- xtRegisterGroupGeneral = 0x0100, /* General registers, Ax, SR. */
- xtRegisterGroupUser = 0x0200, /* User registers. */
- xtRegisterGroupFloat = 0x0400, /* Floating Point. */
- xtRegisterGroupVectra = 0x0800, /* Vectra. */
- xtRegisterGroupSystem = 0x1000, /* System. */
-
- xtRegisterGroupNCP = 0x00800000, /* Non-CP non-base opt/custom. */
- xtRegisterGroupCP0 = 0x01000000, /* CP0. */
- xtRegisterGroupCP1 = 0x02000000, /* CP1. */
- xtRegisterGroupCP2 = 0x04000000, /* CP2. */
- xtRegisterGroupCP3 = 0x08000000, /* CP3. */
- xtRegisterGroupCP4 = 0x10000000, /* CP4. */
- xtRegisterGroupCP5 = 0x20000000, /* CP5. */
- xtRegisterGroupCP6 = 0x40000000, /* CP6. */
- xtRegisterGroupCP7 = 0x80000000, /* CP7. */
+ xtRegisterGroupRegFile = 0x0001, /* Register files without ARx. */
+ xtRegisterGroupAddrReg = 0x0002, /* ARx. */
+ xtRegisterGroupSpecialReg = 0x0004, /* SRxx. */
+ xtRegisterGroupUserReg = 0x0008, /* URxx. */
+ xtRegisterGroupState = 0x0010, /* States. */
+
+ xtRegisterGroupGeneral = 0x0100, /* General registers, Ax, SR. */
+ xtRegisterGroupUser = 0x0200, /* User registers. */
+ xtRegisterGroupFloat = 0x0400, /* Floating Point. */
+ xtRegisterGroupVectra = 0x0800, /* Vectra. */
+ xtRegisterGroupSystem = 0x1000, /* System. */
+
+ xtRegisterGroupNCP = 0x00800000, /* Non-CP non-base opt/custom. */
+ xtRegisterGroupCP0 = 0x01000000, /* CP0. */
+ xtRegisterGroupCP1 = 0x02000000, /* CP1. */
+ xtRegisterGroupCP2 = 0x04000000, /* CP2. */
+ xtRegisterGroupCP3 = 0x08000000, /* CP3. */
+ xtRegisterGroupCP4 = 0x10000000, /* CP4. */
+ xtRegisterGroupCP5 = 0x20000000, /* CP5. */
+ xtRegisterGroupCP6 = 0x40000000, /* CP6. */
+ xtRegisterGroupCP7 = 0x80000000, /* CP7. */
};
-
/* Xtensa target flags. */
enum xtensa_target_flags_t
{
- xtTargetFlagsNonVisibleRegs = 0x0001,
- xtTargetFlagsUseFetchStore = 0x0002,
+ xtTargetFlagsNonVisibleRegs = 0x0001,
+ xtTargetFlagsUseFetchStore = 0x0002,
};
-
/* Mask. */
-typedef struct
+typedef struct
{
int reg_num;
int bit_start;
int bit_size;
} xtensa_reg_mask_t;
-typedef struct
+typedef struct
{
int count;
xtensa_reg_mask_t *mask;
} xtensa_mask_t;
-
/* Xtensa register representation. */
-typedef struct
+typedef struct
{
- const char *name; /* Register name. */
- int offset; /* Offset. */
- xtensa_register_type_t type; /* Register type. */
- xtensa_register_group_t group;/* Register group. */
- struct type* ctype; /* C-type. */
- int bit_size; /* The actual bit size in the target. */
- int byte_size; /* Actual space allocated in registers[]. */
- int align; /* Alignment for this register. */
-
- unsigned int target_number; /* Register target number. */
-
- int flags; /* Flags. */
- int coprocessor; /* Coprocessor num, -1 for non-CP, else -2. */
-
- const xtensa_mask_t *mask; /* Register is a compilation of other regs. */
- const char *fetch; /* Instruction sequence to fetch register. */
- const char *store; /* Instruction sequence to store register. */
+ const char *name; /* Register name. */
+ int offset; /* Offset. */
+ xtensa_register_type_t type; /* Register type. */
+ xtensa_register_group_t group; /* Register group. */
+ struct type *ctype; /* C-type. */
+ int bit_size; /* The actual bit size in the target. */
+ int byte_size; /* Actual space allocated in registers[]. */
+ int align; /* Alignment for this register. */
+
+ unsigned int target_number; /* Register target number. */
+
+ int flags; /* Flags. */
+ int coprocessor; /* Coprocessor num, -1 for non-CP, else -2. */
+
+ const xtensa_mask_t *mask; /* Register is a compilation of other regs. */
+ const char *fetch; /* Instruction sequence to fetch register. */
+ const char *store; /* Instruction sequence to store register. */
} xtensa_register_t;
/* For xtensa-config.c to expand to the structure above. */
-#define XTREG(index,ofs,bsz,sz,al,tnum,flg,cp,ty,gr,name,fet,sto,mas,ct,x,y) \
- {#name, ofs, (xtensa_register_type_t) (ty), \
- ((xtensa_register_group_t) \
- ((gr) | ((xtRegisterGroupNCP >> 2) << (cp + 2)))), \
- ct, bsz, sz, al, tnum, flg, cp, mas, fet, sto},
-#define XTREG_END \
- {0, 0, (xtensa_register_type_t) 0, (xtensa_register_group_t) 0, \
- 0, 0, 0, 0, (unsigned) -1, 0, 0, 0, 0, 0},
-
-#define XTENSA_REGISTER_FLAGS_PRIVILEGED 0x0001
-#define XTENSA_REGISTER_FLAGS_READABLE 0x0002
-#define XTENSA_REGISTER_FLAGS_WRITABLE 0x0004
-#define XTENSA_REGISTER_FLAGS_VOLATILE 0x0008
+#define XTREG(index, ofs, bsz, sz, al, tnum, flg, cp, ty, gr, name, fet, sto, \
+ mas, ct, x, y) \
+ { #name, \
+ ofs, \
+ (xtensa_register_type_t) (ty), \
+ ((xtensa_register_group_t) ((gr) \
+ | ((xtRegisterGroupNCP >> 2) << (cp + 2)))), \
+ ct, \
+ bsz, \
+ sz, \
+ al, \
+ tnum, \
+ flg, \
+ cp, \
+ mas, \
+ fet, \
+ sto },
+#define XTREG_END \
+ { 0, \
+ 0, \
+ (xtensa_register_type_t) 0, \
+ (xtensa_register_group_t) 0, \
+ 0, \
+ 0, \
+ 0, \
+ 0, \
+ (unsigned) -1, \
+ 0, \
+ 0, \
+ 0, \
+ 0, \
+ 0 },
+
+#define XTENSA_REGISTER_FLAGS_PRIVILEGED 0x0001
+#define XTENSA_REGISTER_FLAGS_READABLE 0x0002
+#define XTENSA_REGISTER_FLAGS_WRITABLE 0x0004
+#define XTENSA_REGISTER_FLAGS_VOLATILE 0x0008
/* Call-ABI for stack frame. */
enum call_abi_t
{
- CallAbiDefault = 0, /* Any 'callX' instructions; default stack. */
- CallAbiCall0Only, /* Only 'call0' instructions; flat stack. */
+ CallAbiDefault = 0, /* Any 'callX' instructions; default stack. */
+ CallAbiCall0Only, /* Only 'call0' instructions; flat stack. */
};
-
struct ctype_cache
{
struct ctype_cache *next;
@@ -158,11 +177,11 @@ struct ctype_cache
};
#ifndef XCHAL_NUM_CONTEXTS
-# define XCHAL_NUM_CONTEXTS 0
+#define XCHAL_NUM_CONTEXTS 0
#endif
#ifndef XCHAL_HAVE_EXCEPTIONS
-# define XCHAL_HAVE_EXCEPTIONS 1
+#define XCHAL_HAVE_EXCEPTIONS 1
#endif
/* Xtensa-specific target dependencies. */
@@ -171,7 +190,8 @@ struct xtensa_gdbarch_tdep : gdbarch_tdep_base
{
xtensa_gdbarch_tdep (xtensa_register_t *regmap)
: regmap (regmap)
- {}
+ {
+ }
unsigned int target_flags = 0;
@@ -180,11 +200,11 @@ struct xtensa_gdbarch_tdep : gdbarch_tdep_base
unsigned int spill_location = (unsigned int) -1;
unsigned int spill_size = 0;
- char *unused = nullptr; /* Placeholder for compatibility. */
+ char *unused = nullptr; /* Placeholder for compatibility. */
/* Calling convention. */
- call_abi_t call_abi = (XSHAL_ABI == XTHAL_ABI_CALL0
- ? CallAbiCall0Only : CallAbiDefault);
+ call_abi_t call_abi
+ = (XSHAL_ABI == XTHAL_ABI_CALL0 ? CallAbiCall0Only : CallAbiDefault);
/* CPU configuration. */
@@ -198,51 +218,54 @@ struct xtensa_gdbarch_tdep : gdbarch_tdep_base
unsigned int isa_use_density_instructions = XCHAL_HAVE_DENSITY;
unsigned int isa_use_exceptions = XCHAL_HAVE_EXCEPTIONS;
unsigned int isa_use_ext_l32r = XSHAL_USE_ABSOLUTE_LITERALS;
- unsigned int isa_max_insn_size = XCHAL_MAX_INSTRUCTION_SIZE; /* Maximum instruction length. */
- unsigned int debug_num_ibreaks = XCHAL_NUM_IBREAK; /* Number of IBREAKs. */
+ unsigned int isa_max_insn_size
+ = XCHAL_MAX_INSTRUCTION_SIZE; /* Maximum instruction length. */
+ unsigned int debug_num_ibreaks = XCHAL_NUM_IBREAK; /* Number of IBREAKs. */
unsigned int debug_num_dbreaks = XCHAL_NUM_DBREAK;
/* Register map. */
xtensa_register_t *regmap;
- unsigned int num_regs = 0; /* Number of registers in register map. */
- unsigned int num_nopriv_regs = 0; /* Number of non-privileged registers. */
- unsigned int num_pseudo_regs = 0; /* Number of pseudo registers. */
- unsigned int num_aregs = XCHAL_NUM_AREGS; /* Size of register file. */
+ unsigned int num_regs = 0; /* Number of registers in register map. */
+ unsigned int num_nopriv_regs = 0; /* Number of non-privileged registers. */
+ unsigned int num_pseudo_regs = 0; /* Number of pseudo registers. */
+ unsigned int num_aregs = XCHAL_NUM_AREGS; /* Size of register file. */
unsigned int num_contexts = XCHAL_NUM_CONTEXTS;
- int ar_base = -1; /* Register number for AR0. */
- int a0_base = -1; /* Register number for A0 (pseudo). */
- int wb_regnum = -1; /* Register number for WB. */
- int ws_regnum = -1; /* Register number for WS. */
- int pc_regnum = -1; /* Register number for PC. */
- int ps_regnum = -1; /* Register number for PS. */
- int lbeg_regnum = -1; /* Register numbers for count regs. */
+ int ar_base = -1; /* Register number for AR0. */
+ int a0_base = -1; /* Register number for A0 (pseudo). */
+ int wb_regnum = -1; /* Register number for WB. */
+ int ws_regnum = -1; /* Register number for WS. */
+ int pc_regnum = -1; /* Register number for PC. */
+ int ps_regnum = -1; /* Register number for PS. */
+ int lbeg_regnum = -1; /* Register numbers for count regs. */
int lend_regnum = -1;
int lcount_regnum = -1;
- int sar_regnum = -1; /* Register number of SAR. */
- int litbase_regnum = -1; /* Register number of LITBASE. */
- int threadptr_regnum = -1; /* Register number of THREADPTR. */
+ int sar_regnum = -1; /* Register number of SAR. */
+ int litbase_regnum = -1; /* Register number of LITBASE. */
+ int threadptr_regnum = -1; /* Register number of THREADPTR. */
- int interrupt_regnum = -1; /* Register number for interrupt. */
- int interrupt2_regnum = -1; /* Register number for interrupt2. */
- int cpenable_regnum = -1; /* Register number for cpenable. */
- int debugcause_regnum = -1; /* Register number for debugcause. */
- int exccause_regnum = -1; /* Register number for exccause. */
- int excvaddr_regnum = -1; /* Register number for excvaddr. */
+ int interrupt_regnum = -1; /* Register number for interrupt. */
+ int interrupt2_regnum = -1; /* Register number for interrupt2. */
+ int cpenable_regnum = -1; /* Register number for cpenable. */
+ int debugcause_regnum = -1; /* Register number for debugcause. */
+ int exccause_regnum = -1; /* Register number for exccause. */
+ int excvaddr_regnum = -1; /* Register number for excvaddr. */
int max_register_raw_size = 0;
int max_register_virtual_size = 0;
- unsigned long *fp_layout = nullptr; /* Layout of custom/TIE regs in 'FP' area. */
- unsigned int fp_layout_bytes = 0; /* Size of layout information (in bytes). */
+ unsigned long *fp_layout
+ = nullptr; /* Layout of custom/TIE regs in 'FP' area. */
+ unsigned int fp_layout_bytes
+ = 0; /* Size of layout information (in bytes). */
unsigned long *gregmap = nullptr;
/* Cached register types. */
struct ctype_cache *type_entries = nullptr;
};
-#define WB_SHIFT 2
+#define WB_SHIFT 2
/* We assign fixed numbers to the registers of the "current" window
(i.e., relative to WB). The registers get remapped via the reg_map
diff --git a/gdb/xtensa-xtregs.c b/gdb/xtensa-xtregs.c
index f97d055b848..8fda7245ff8 100644
--- a/gdb/xtensa-xtregs.c
+++ b/gdb/xtensa-xtregs.c
@@ -16,7 +16,6 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
-
typedef struct
{
int gdb_regnum;
@@ -31,9 +30,8 @@ typedef struct
#define XTENSA_ELF_XTREG_SIZE 4
-const xtensa_regtable_t xtensa_regmap_table[] =
-{
+const xtensa_regtable_t xtensa_regmap_table[] = {
/* gnum,gofs,cpofs,ofs,siz,cp, dbnum, name */
- { 44, 176, 0, 0, 4, -1, 0x020c, "scompare1" },
+ { 44, 176, 0, 0, 4, -1, 0x020c, "scompare1" },
{ 0 }
};
diff --git a/gdb/yy-remap.h b/gdb/yy-remap.h
index 33bee0fabdb..8f6f773a17e 100644
--- a/gdb/yy-remap.h
+++ b/gdb/yy-remap.h
@@ -32,68 +32,68 @@
/* Define GDB_YY_REMAP_PREFIX to the desired remapping prefix before
including this file. */
#ifndef GDB_YY_REMAP_PREFIX
-# error "GDB_YY_REMAP_PREFIX not defined"
+#error "GDB_YY_REMAP_PREFIX not defined"
#endif
-#define GDB_YY_REMAP_2(PREFIX, YYSYM) PREFIX ## YYSYM
+#define GDB_YY_REMAP_2(PREFIX, YYSYM) PREFIX##YYSYM
#define GDB_YY_REMAP_1(PREFIX, YYSYM) GDB_YY_REMAP_2 (PREFIX, YYSYM)
#define GDB_YY_REMAP(YYSYM) GDB_YY_REMAP_1 (GDB_YY_REMAP_PREFIX, YYSYM)
-#define yymaxdepth GDB_YY_REMAP (yymaxdepth)
-#define yyparse GDB_YY_REMAP (yyparse)
-#define yylex GDB_YY_REMAP (yylex)
-#define yyerror GDB_YY_REMAP (yyerror)
-#define yylval GDB_YY_REMAP (yylval)
-#define yychar GDB_YY_REMAP (yychar)
-#define yydebug GDB_YY_REMAP (yydebug)
-#define yypact GDB_YY_REMAP (yypact)
-#define yyr1 GDB_YY_REMAP (yyr1)
-#define yyr2 GDB_YY_REMAP (yyr2)
-#define yydef GDB_YY_REMAP (yydef)
-#define yychk GDB_YY_REMAP (yychk)
-#define yypgo GDB_YY_REMAP (yypgo)
-#define yyact GDB_YY_REMAP (yyact)
-#define yyexca GDB_YY_REMAP (yyexca)
-#define yyerrflag GDB_YY_REMAP (yyerrflag)
-#define yynerrs GDB_YY_REMAP (yynerrs)
-#define yyps GDB_YY_REMAP (yyps)
-#define yypv GDB_YY_REMAP (yypv)
-#define yys GDB_YY_REMAP (yys)
-#define yy_yys GDB_YY_REMAP (yy_yys)
-#define yystate GDB_YY_REMAP (yystate)
-#define yytmp GDB_YY_REMAP (yytmp)
-#define yyv GDB_YY_REMAP (yyv)
-#define yy_yyv GDB_YY_REMAP (yy_yyv)
-#define yyval GDB_YY_REMAP (yyval)
-#define yylloc GDB_YY_REMAP (yylloc)
-#define yyreds GDB_YY_REMAP (yyreds) /* With YYDEBUG defined */
-#define yytoks GDB_YY_REMAP (yytoks) /* With YYDEBUG defined */
-#define yyname GDB_YY_REMAP (yyname) /* With YYDEBUG defined */
-#define yyrule GDB_YY_REMAP (yyrule) /* With YYDEBUG defined */
-#define yylhs GDB_YY_REMAP (yylhs)
-#define yylen GDB_YY_REMAP (yylen)
-#define yydefred GDB_YY_REMAP (yydefred)
-#define yydgoto GDB_YY_REMAP (yydgoto)
-#define yysindex GDB_YY_REMAP (yysindex)
-#define yyrindex GDB_YY_REMAP (yyrindex)
-#define yygindex GDB_YY_REMAP (yygindex)
-#define yytable GDB_YY_REMAP (yytable)
-#define yycheck GDB_YY_REMAP (yycheck)
-#define yyss GDB_YY_REMAP (yyss)
-#define yysslim GDB_YY_REMAP (yysslim)
-#define yyssp GDB_YY_REMAP (yyssp)
-#define yystacksize GDB_YY_REMAP (yystacksize)
-#define yyvs GDB_YY_REMAP (yyvs)
-#define yyvsp GDB_YY_REMAP (yyvsp)
+#define yymaxdepth GDB_YY_REMAP (yymaxdepth)
+#define yyparse GDB_YY_REMAP (yyparse)
+#define yylex GDB_YY_REMAP (yylex)
+#define yyerror GDB_YY_REMAP (yyerror)
+#define yylval GDB_YY_REMAP (yylval)
+#define yychar GDB_YY_REMAP (yychar)
+#define yydebug GDB_YY_REMAP (yydebug)
+#define yypact GDB_YY_REMAP (yypact)
+#define yyr1 GDB_YY_REMAP (yyr1)
+#define yyr2 GDB_YY_REMAP (yyr2)
+#define yydef GDB_YY_REMAP (yydef)
+#define yychk GDB_YY_REMAP (yychk)
+#define yypgo GDB_YY_REMAP (yypgo)
+#define yyact GDB_YY_REMAP (yyact)
+#define yyexca GDB_YY_REMAP (yyexca)
+#define yyerrflag GDB_YY_REMAP (yyerrflag)
+#define yynerrs GDB_YY_REMAP (yynerrs)
+#define yyps GDB_YY_REMAP (yyps)
+#define yypv GDB_YY_REMAP (yypv)
+#define yys GDB_YY_REMAP (yys)
+#define yy_yys GDB_YY_REMAP (yy_yys)
+#define yystate GDB_YY_REMAP (yystate)
+#define yytmp GDB_YY_REMAP (yytmp)
+#define yyv GDB_YY_REMAP (yyv)
+#define yy_yyv GDB_YY_REMAP (yy_yyv)
+#define yyval GDB_YY_REMAP (yyval)
+#define yylloc GDB_YY_REMAP (yylloc)
+#define yyreds GDB_YY_REMAP (yyreds) /* With YYDEBUG defined */
+#define yytoks GDB_YY_REMAP (yytoks) /* With YYDEBUG defined */
+#define yyname GDB_YY_REMAP (yyname) /* With YYDEBUG defined */
+#define yyrule GDB_YY_REMAP (yyrule) /* With YYDEBUG defined */
+#define yylhs GDB_YY_REMAP (yylhs)
+#define yylen GDB_YY_REMAP (yylen)
+#define yydefred GDB_YY_REMAP (yydefred)
+#define yydgoto GDB_YY_REMAP (yydgoto)
+#define yysindex GDB_YY_REMAP (yysindex)
+#define yyrindex GDB_YY_REMAP (yyrindex)
+#define yygindex GDB_YY_REMAP (yygindex)
+#define yytable GDB_YY_REMAP (yytable)
+#define yycheck GDB_YY_REMAP (yycheck)
+#define yyss GDB_YY_REMAP (yyss)
+#define yysslim GDB_YY_REMAP (yysslim)
+#define yyssp GDB_YY_REMAP (yyssp)
+#define yystacksize GDB_YY_REMAP (yystacksize)
+#define yyvs GDB_YY_REMAP (yyvs)
+#define yyvsp GDB_YY_REMAP (yyvsp)
/* The following are common to all parsers. */
#ifndef YYDEBUG
-# define YYDEBUG 1 /* Default to yydebug support */
+#define YYDEBUG 1 /* Default to yydebug support */
#endif
#ifndef TEST_CPNAMES
-# define YYFPRINTF parser_fprintf
+#define YYFPRINTF parser_fprintf
#endif
#endif /* YY_REMAP_H */
diff --git a/gdb/z80-tdep.c b/gdb/z80-tdep.c
index 9dc24df5ed1..806ef4fa81c 100644
--- a/gdb/z80-tdep.c
+++ b/gdb/z80-tdep.c
@@ -98,11 +98,11 @@ struct z80_unwind_cache
struct
{
- int called:1; /* there is return address on stack */
- int load_args:1; /* prologues loads args using POPs */
- int fp_sdcc:1; /* prologue saves and adjusts frame pointer IX */
- int interrupt:1; /* __interrupt handler */
- int critical:1; /* __critical function */
+ int called : 1; /* there is return address on stack */
+ int load_args : 1; /* prologues loads args using POPs */
+ int fp_sdcc : 1; /* prologue saves and adjusts frame pointer IX */
+ int interrupt : 1; /* __interrupt handler */
+ int critical : 1; /* __critical function */
} prologue_type;
/* Table indicating the location of each and every register. */
@@ -152,12 +152,9 @@ struct z80_insn_info
static const struct z80_insn_info *
z80_get_insn_info (struct gdbarch *gdbarch, const gdb_byte *buf, int *size);
-static const char *z80_reg_names[] =
-{
+static const char *z80_reg_names[] = {
/* 24 bit on eZ80, else 16 bit */
- "af", "bc", "de", "hl",
- "sp", "pc", "ix", "iy",
- "af'", "bc'", "de'", "hl'",
+ "af", "bc", "de", "hl", "sp", "pc", "ix", "iy", "af'", "bc'", "de'", "hl'",
"ir",
/* eZ80 only */
"sps"
@@ -310,30 +307,33 @@ z80_scan_prologue (struct gdbarch *gdbarch, CORE_ADDR pc_beg, CORE_ADDR pc_end,
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
z80_gdbarch_tdep *tdep = gdbarch_tdep<z80_gdbarch_tdep> (gdbarch);
int addr_len = tdep->addr_length;
- gdb_byte prologue[32]; /* max prologue is 24 bytes: __interrupt with local array */
+ gdb_byte
+ prologue[32]; /* max prologue is 24 bytes: __interrupt with local array */
int pos = 0;
int len;
int reg;
CORE_ADDR value;
len = pc_end - pc_beg;
- if (len > (int)sizeof (prologue))
+ if (len > (int) sizeof (prologue))
len = sizeof (prologue);
read_memory (pc_beg, prologue, len);
/* stage0: check for series of POPs and then PUSHs */
- if ((reg = z80_is_pop_rr(prologue, &pos)))
+ if ((reg = z80_is_pop_rr (prologue, &pos)))
{
int i;
int size = pos;
gdb_byte regs[8]; /* Z80 have only 6 register pairs */
regs[0] = reg & 0xff;
for (i = 1; i < 8 && (regs[i] = z80_is_pop_rr (&prologue[pos], &size));
- ++i, pos += size);
+ ++i, pos += size)
+ ;
/* now we expect series of PUSHs in reverse order */
for (--i; i >= 0 && regs[i] == z80_is_push_rr (&prologue[pos], &size);
- --i, pos += size);
+ --i, pos += size)
+ ;
if (i == -1 && pos > 0)
info->prologue_type.load_args = 1;
else
@@ -361,15 +361,17 @@ z80_scan_prologue (struct gdbarch *gdbarch, CORE_ADDR pc_beg, CORE_ADDR pc_end,
if (msymbol.minsym)
{
value = msymbol.value_address ();
- if (value == extract_unsigned_integer (&prologue[pos+1], addr_len, byte_order))
+ if (value
+ == extract_unsigned_integer (&prologue[pos + 1], addr_len,
+ byte_order))
{
pos += 1 + addr_len;
info->prologue_type.fp_sdcc = 1;
}
}
}
- else if (!memcmp (&prologue[pos], "\335\345\335\041\000\000", 4+addr_len) &&
- !memcmp (&prologue[pos+4+addr_len], "\335\071\335\371", 4))
+ else if (!memcmp (&prologue[pos], "\335\345\335\041\000\000", 4 + addr_len)
+ && !memcmp (&prologue[pos + 4 + addr_len], "\335\071\335\371", 4))
{ /* push ix; ld ix, #0; add ix, sp; ld sp, ix */
pos += 4 + addr_len + 4;
info->prologue_type.fp_sdcc = 1;
@@ -383,63 +385,67 @@ z80_scan_prologue (struct gdbarch *gdbarch, CORE_ADDR pc_beg, CORE_ADDR pc_end,
/* stage3: check for local variables allocation */
switch (prologue[pos])
{
- case 0xf5: /* push af */
- info->size = 0;
- while (prologue[pos] == 0xf5)
- {
- info->size += addr_len;
- pos++;
- }
- if (prologue[pos] == 0x3b) /* dec sp */
- {
- info->size++;
- pos++;
- }
- break;
- case 0x3b: /* dec sp */
- info->size = 0;
- while (prologue[pos] == 0x3b)
- {
- info->size++;
- pos++;
- }
- break;
- case 0x21: /*ld hl, -nn */
- if (prologue[pos+addr_len] == 0x39 && prologue[pos+addr_len] >= 0x80 &&
- prologue[pos+addr_len+1] == 0xf9)
- { /* add hl, sp; ld sp, hl */
- info->size = -extract_signed_integer(&prologue[pos+1], addr_len, byte_order);
- pos += 1 + addr_len + 2;
- }
- break;
- case 0xfd: /* ld iy, -nn */
- if (prologue[pos+1] == 0x21 && prologue[pos+1+addr_len] >= 0x80 &&
- !memcmp (&prologue[pos+2+addr_len], "\375\071\375\371", 4))
- {
- info->size = -extract_signed_integer(&prologue[pos+2], addr_len, byte_order);
- pos += 2 + addr_len + 4;
- }
- break;
- case 0xed: /* check for lea xx, ix - n */
- switch (prologue[pos+1])
- {
- case 0x22: /* lea hl, ix - n */
- if (prologue[pos+2] >= 0x80 && prologue[pos+3] == 0xf9)
- { /* ld sp, hl */
- info->size = -extract_signed_integer(&prologue[pos+2], 1, byte_order);
- pos += 4;
- }
- break;
- case 0x55: /* lea iy, ix - n */
- if (prologue[pos+2] >= 0x80 && prologue[pos+3] == 0xfd &&
- prologue[pos+4] == 0xf9)
- { /* ld sp, iy */
- info->size = -extract_signed_integer(&prologue[pos+2], 1, byte_order);
- pos += 5;
- }
- break;
- }
+ case 0xf5: /* push af */
+ info->size = 0;
+ while (prologue[pos] == 0xf5)
+ {
+ info->size += addr_len;
+ pos++;
+ }
+ if (prologue[pos] == 0x3b) /* dec sp */
+ {
+ info->size++;
+ pos++;
+ }
+ break;
+ case 0x3b: /* dec sp */
+ info->size = 0;
+ while (prologue[pos] == 0x3b)
+ {
+ info->size++;
+ pos++;
+ }
+ break;
+ case 0x21: /*ld hl, -nn */
+ if (prologue[pos + addr_len] == 0x39 && prologue[pos + addr_len] >= 0x80
+ && prologue[pos + addr_len + 1] == 0xf9)
+ { /* add hl, sp; ld sp, hl */
+ info->size = -extract_signed_integer (&prologue[pos + 1], addr_len,
+ byte_order);
+ pos += 1 + addr_len + 2;
+ }
+ break;
+ case 0xfd: /* ld iy, -nn */
+ if (prologue[pos + 1] == 0x21 && prologue[pos + 1 + addr_len] >= 0x80
+ && !memcmp (&prologue[pos + 2 + addr_len], "\375\071\375\371", 4))
+ {
+ info->size = -extract_signed_integer (&prologue[pos + 2], addr_len,
+ byte_order);
+ pos += 2 + addr_len + 4;
+ }
+ break;
+ case 0xed: /* check for lea xx, ix - n */
+ switch (prologue[pos + 1])
+ {
+ case 0x22: /* lea hl, ix - n */
+ if (prologue[pos + 2] >= 0x80 && prologue[pos + 3] == 0xf9)
+ { /* ld sp, hl */
+ info->size
+ = -extract_signed_integer (&prologue[pos + 2], 1, byte_order);
+ pos += 4;
+ }
break;
+ case 0x55: /* lea iy, ix - n */
+ if (prologue[pos + 2] >= 0x80 && prologue[pos + 3] == 0xfd
+ && prologue[pos + 4] == 0xf9)
+ { /* ld sp, iy */
+ info->size
+ = -extract_signed_integer (&prologue[pos + 2], 1, byte_order);
+ pos += 5;
+ }
+ break;
+ }
+ break;
}
len = 0;
@@ -477,7 +483,7 @@ z80_skip_prologue (struct gdbarch *gdbarch, CORE_ADDR pc)
return std::max (pc, prologue_end);
{
- struct z80_unwind_cache info = {0};
+ struct z80_unwind_cache info = { 0 };
struct trad_frame_saved_reg saved_regs[Z80_NUM_REGS];
info.saved_regs = saved_regs;
@@ -487,8 +493,8 @@ z80_skip_prologue (struct gdbarch *gdbarch, CORE_ADDR pc)
prologue_end = z80_scan_prologue (gdbarch, func_addr, func_end, &info);
- if (info.prologue_type.fp_sdcc || info.prologue_type.interrupt ||
- info.prologue_type.critical)
+ if (info.prologue_type.fp_sdcc || info.prologue_type.interrupt
+ || info.prologue_type.critical)
return std::max (pc, prologue_end);
}
@@ -498,8 +504,8 @@ z80_skip_prologue (struct gdbarch *gdbarch, CORE_ADDR pc)
struct compunit_symtab *compunit = prologue_sal.symtab->compunit ();
const char *debug_format = compunit->debugformat ();
- if (debug_format != NULL &&
- !strncasecmp ("dwarf", debug_format, strlen("dwarf")))
+ if (debug_format != NULL
+ && !strncasecmp ("dwarf", debug_format, strlen ("dwarf")))
return std::max (pc, prologue_end);
}
@@ -534,7 +540,8 @@ z80_return_value (struct gdbarch *gdbarch, struct value *function,
{
if (len > 2)
{
- regcache->cooked_write_part (Z80_DE_REGNUM, 0, len - 2, writebuf+2);
+ regcache->cooked_write_part (Z80_DE_REGNUM, 0, len - 2,
+ writebuf + 2);
len = 2;
}
regcache->cooked_write_part (Z80_HL_REGNUM, 0, len, writebuf);
@@ -544,7 +551,7 @@ z80_return_value (struct gdbarch *gdbarch, struct value *function,
{
if (len > 2)
{
- regcache->cooked_read_part (Z80_DE_REGNUM, 0, len - 2, readbuf+2);
+ regcache->cooked_read_part (Z80_DE_REGNUM, 0, len - 2, readbuf + 2);
len = 2;
}
regcache->cooked_read_part (Z80_HL_REGNUM, 0, len, readbuf);
@@ -555,13 +562,12 @@ z80_return_value (struct gdbarch *gdbarch, struct value *function,
/* function unwinds current stack frame and returns next one */
static struct z80_unwind_cache *
-z80_frame_unwind_cache (frame_info_ptr this_frame,
- void **this_prologue_cache)
+z80_frame_unwind_cache (frame_info_ptr this_frame, void **this_prologue_cache)
{
CORE_ADDR start_pc, current_pc;
ULONGEST this_base;
int i;
- gdb_byte buf[sizeof(void*)];
+ gdb_byte buf[sizeof (void *)];
struct z80_unwind_cache *info;
struct gdbarch *gdbarch = get_frame_arch (this_frame);
z80_gdbarch_tdep *tdep = gdbarch_tdep<z80_gdbarch_tdep> (gdbarch);
@@ -578,8 +584,8 @@ z80_frame_unwind_cache (frame_info_ptr this_frame,
start_pc = get_frame_func (this_frame);
current_pc = get_frame_pc (this_frame);
if ((start_pc > 0) && (start_pc <= current_pc))
- z80_scan_prologue (get_frame_arch (this_frame),
- start_pc, current_pc, info);
+ z80_scan_prologue (get_frame_arch (this_frame), start_pc, current_pc,
+ info);
if (info->prologue_type.fp_sdcc)
{
@@ -592,7 +598,7 @@ z80_frame_unwind_cache (frame_info_ptr this_frame,
{
CORE_ADDR addr;
CORE_ADDR sp;
- CORE_ADDR sp_mask = (1 << gdbarch_ptr_bit(gdbarch)) - 1;
+ CORE_ADDR sp_mask = (1 << gdbarch_ptr_bit (gdbarch)) - 1;
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
/* Assume that the FP is this frame's SP but with that pushed
stack space added back. */
@@ -608,18 +614,16 @@ z80_frame_unwind_cache (frame_info_ptr this_frame,
}
/* find return address */
read_memory (sp, buf, addr_len);
- addr = extract_unsigned_integer(buf, addr_len, byte_order);
- read_memory (addr-addr_len-1, buf, addr_len+1);
+ addr = extract_unsigned_integer (buf, addr_len, byte_order);
+ read_memory (addr - addr_len - 1, buf, addr_len + 1);
if (buf[0] == 0xcd || (buf[0] & 0307) == 0304) /* Is it CALL */
{ /* CALL nn or CALL cc,nn */
- static const char *names[] =
- {
- "__sdcc_call_ix", "__sdcc_call_iy", "__sdcc_call_hl"
- };
- addr = extract_unsigned_integer(buf+1, addr_len, byte_order);
+ static const char *names[]
+ = { "__sdcc_call_ix", "__sdcc_call_iy", "__sdcc_call_hl" };
+ addr = extract_unsigned_integer (buf + 1, addr_len, byte_order);
if (addr == start_pc)
break; /* found */
- for (i = sizeof(names)/sizeof(*names)-1; i >= 0; --i)
+ for (i = sizeof (names) / sizeof (*names) - 1; i >= 0; --i)
{
struct bound_minimal_symbol msymbol;
msymbol = lookup_minimal_symbol (names[i], NULL, NULL);
@@ -642,8 +646,8 @@ z80_frame_unwind_cache (frame_info_ptr this_frame,
offsets. */
for (i = 0; i < gdbarch_num_regs (gdbarch) - 1; i++)
if (info->saved_regs[i].addr () > 0)
- info->saved_regs[i].set_addr
- (info->prev_sp - info->saved_regs[i].addr () * addr_len);
+ info->saved_regs[i].set_addr (info->prev_sp
+ - info->saved_regs[i].addr () * addr_len);
/* Except for the startup code, the return PC is always saved on
the stack and is at the base of the frame. */
@@ -682,8 +686,8 @@ z80_frame_this_id (frame_info_ptr this_frame, void **this_cache,
}
static struct value *
-z80_frame_prev_register (frame_info_ptr this_frame,
- void **this_prologue_cache, int regnum)
+z80_frame_prev_register (frame_info_ptr this_frame, void **this_prologue_cache,
+ int regnum)
{
struct z80_unwind_cache *info
= z80_frame_unwind_cache (this_frame, this_prologue_cache);
@@ -700,8 +704,8 @@ z80_frame_prev_register (frame_info_ptr this_frame,
z80_gdbarch_tdep *tdep = gdbarch_tdep<z80_gdbarch_tdep> (gdbarch);
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
- read_memory (info->saved_regs[Z80_PC_REGNUM].addr (),
- buf, tdep->addr_length);
+ read_memory (info->saved_regs[Z80_PC_REGNUM].addr (), buf,
+ tdep->addr_length);
pc = extract_unsigned_integer (buf, tdep->addr_length, byte_order);
return frame_unwind_got_constant (this_frame, regnum, pc);
}
@@ -725,9 +729,10 @@ z80_breakpoint_kind_from_pc (struct gdbarch *gdbarch, CORE_ADDR *pcptr)
addr = bh.value_address ();
else
{
- warning(_("Unable to determine inferior's software breakpoint type: "
- "couldn't find `_break_handler' function in inferior. Will "
- "be used default software breakpoint instruction RST 0x08."));
+ warning (
+ _ ("Unable to determine inferior's software breakpoint type: "
+ "couldn't find `_break_handler' function in inferior. Will "
+ "be used default software breakpoint instruction RST 0x08."));
addr = 0x0008;
}
}
@@ -770,7 +775,7 @@ z80_sw_breakpoint_from_kind (struct gdbarch *gdbarch, int kind, int *size)
static std::vector<CORE_ADDR>
z80_software_single_step (struct regcache *regcache)
{
- static const int flag_mask[] = {1 << 6, 1 << 0, 1 << 2, 1 << 7};
+ static const int flag_mask[] = { 1 << 6, 1 << 0, 1 << 2, 1 << 7 };
gdb_byte buf[8];
ULONGEST t;
ULONGEST addr;
@@ -781,11 +786,11 @@ z80_software_single_step (struct regcache *regcache)
struct gdbarch *gdbarch = target_gdbarch ();
regcache->cooked_read (Z80_PC_REGNUM, &addr);
- read_memory (addr, buf, sizeof(buf));
+ read_memory (addr, buf, sizeof (buf));
info = z80_get_insn_info (gdbarch, buf, &size);
ret[0] = addr + size;
if (info == NULL) /* possible in case of double prefix */
- { /* forced NOP, TODO: replace by NOP */
+ { /* forced NOP, TODO: replace by NOP */
return ret;
}
opcode = buf[size - info->size]; /* take opcode instead of prefix */
@@ -823,22 +828,22 @@ z80_software_single_step (struct regcache *regcache)
case insn_jr_d:
case insn_jr_cc_d:
addr += size;
- addr += (signed char)buf[size-1];
+ addr += (signed char) buf[size - 1];
break;
case insn_jp_rr:
if (size == 1)
opcode = Z80_HL_REGNUM;
else
- opcode = (buf[size-2] & 0x20) ? Z80_IY_REGNUM : Z80_IX_REGNUM;
+ opcode = (buf[size - 2] & 0x20) ? Z80_IY_REGNUM : Z80_IX_REGNUM;
regcache->cooked_read (opcode, &addr);
break;
case insn_jp_nn:
case insn_jp_cc_nn:
case insn_call_nn:
case insn_call_cc_nn:
- addr = buf[size-1] * 0x100 + buf[size-2];
+ addr = buf[size - 1] * 0x100 + buf[size - 2];
if (info->size > 3) /* long instruction mode */
- addr = addr * 0x100 + buf[size-3];
+ addr = addr * 0x100 + buf[size - 3];
break;
case insn_rst_n:
addr = opcode & 070;
@@ -860,10 +865,13 @@ z80_software_single_step (struct regcache *regcache)
static unsigned (*cache_ovly_region_table)[3] = 0;
static unsigned cache_novly_regions;
static CORE_ADDR cache_ovly_region_table_base = 0;
+
enum z80_ovly_index
- {
- Z80_VMA, Z80_OSIZE, Z80_MAPPED_TO_LMA
- };
+{
+ Z80_VMA,
+ Z80_OSIZE,
+ Z80_MAPPED_TO_LMA
+};
static void
z80_free_overlay_region_table (void)
@@ -879,8 +887,8 @@ z80_free_overlay_region_table (void)
Convert to host order. LEN is number of ints. */
static void
-read_target_long_array (CORE_ADDR memaddr, unsigned int *myaddr,
- int len, int size, enum bfd_endian byte_order)
+read_target_long_array (CORE_ADDR memaddr, unsigned int *myaddr, int len,
+ int size, enum bfd_endian byte_order)
{
/* alloca is safe here, because regions array is very small. */
gdb_byte *buf = (gdb_byte *) alloca (len * size);
@@ -902,20 +910,20 @@ z80_read_overlay_region_table ()
z80_free_overlay_region_table ();
novly_regions_msym = lookup_minimal_symbol ("_novly_regions", NULL, NULL);
- if (! novly_regions_msym.minsym)
+ if (!novly_regions_msym.minsym)
{
- error (_("Error reading inferior's overlay table: "
- "couldn't find `_novly_regions'\n"
- "variable in inferior. Use `overlay manual' mode."));
+ error (_ ("Error reading inferior's overlay table: "
+ "couldn't find `_novly_regions'\n"
+ "variable in inferior. Use `overlay manual' mode."));
return 0;
}
ovly_region_table_msym = lookup_bound_minimal_symbol ("_ovly_region_table");
- if (! ovly_region_table_msym.minsym)
+ if (!ovly_region_table_msym.minsym)
{
- error (_("Error reading inferior's overlay table: couldn't find "
- "`_ovly_region_table'\n"
- "array in inferior. Use `overlay manual' mode."));
+ error (_ ("Error reading inferior's overlay table: couldn't find "
+ "`_ovly_region_table'\n"
+ "array in inferior. Use `overlay manual' mode."));
return 0;
}
@@ -927,19 +935,18 @@ z80_read_overlay_region_table ()
word_size = gdbarch_long_bit (gdbarch) / TARGET_CHAR_BIT;
byte_order = gdbarch_byte_order (gdbarch);
- cache_novly_regions = read_memory_integer (novly_regions_msym.value_address (),
- 4, byte_order);
+ cache_novly_regions
+ = read_memory_integer (novly_regions_msym.value_address (), 4, byte_order);
cache_ovly_region_table
- = (unsigned int (*)[3]) xmalloc (cache_novly_regions *
- sizeof (*cache_ovly_region_table));
- cache_ovly_region_table_base
- = ovly_region_table_msym.value_address ();
+ = (unsigned int (*)[3]) xmalloc (cache_novly_regions
+ * sizeof (*cache_ovly_region_table));
+ cache_ovly_region_table_base = ovly_region_table_msym.value_address ();
read_target_long_array (cache_ovly_region_table_base,
(unsigned int *) cache_ovly_region_table,
cache_novly_regions * 3, word_size, byte_order);
overlay_debugging = save_ovly_dbg;
- return 1; /* SUCCESS */
+ return 1; /* SUCCESS */
}
static int
@@ -953,7 +960,7 @@ z80_overlay_update_1 (struct obj_section *osect)
/* find region corresponding to the section VMA */
for (i = 0; i < cache_novly_regions; i++)
if (cache_ovly_region_table[i][Z80_VMA] == vma)
- break;
+ break;
if (i == cache_novly_regions)
return 0; /* no such region */
@@ -965,8 +972,10 @@ z80_overlay_update_1 (struct obj_section *osect)
ALL_OBJFILE_OSECTIONS (objfile, osect)
if (section_is_overlay (osect))
{
- osect->ovly_mapped = (lma == bfd_section_lma (osect->the_bfd_section));
- i |= osect->ovly_mapped; /* true, if at least one section is mapped */
+ osect->ovly_mapped
+ = (lma == bfd_section_lma (osect->the_bfd_section));
+ i |= osect
+ ->ovly_mapped; /* true, if at least one section is mapped */
}
return i;
}
@@ -996,8 +1005,8 @@ z80_overlay_update (struct obj_section *osect)
for (int i = 0; i < cache_novly_regions; ++i)
if (cache_ovly_region_table[i][Z80_VMA] == vma)
- osect->ovly_mapped =
- (cache_ovly_region_table[i][Z80_MAPPED_TO_LMA] == lma);
+ osect->ovly_mapped
+ = (cache_ovly_region_table[i][Z80_MAPPED_TO_LMA] == lma);
}
}
@@ -1008,7 +1017,7 @@ z80_insn_is_call (struct gdbarch *gdbarch, CORE_ADDR addr)
gdb_byte buf[8];
int size;
const struct z80_insn_info *info;
- read_memory (addr, buf, sizeof(buf));
+ read_memory (addr, buf, sizeof (buf));
info = z80_get_insn_info (gdbarch, buf, &size);
if (info)
switch (info->type)
@@ -1028,7 +1037,7 @@ z80_insn_is_ret (struct gdbarch *gdbarch, CORE_ADDR addr)
gdb_byte buf[8];
int size;
const struct z80_insn_info *info;
- read_memory (addr, buf, sizeof(buf));
+ read_memory (addr, buf, sizeof (buf));
info = z80_get_insn_info (gdbarch, buf, &size);
if (info)
switch (info->type)
@@ -1047,7 +1056,7 @@ z80_insn_is_jump (struct gdbarch *gdbarch, CORE_ADDR addr)
gdb_byte buf[8];
int size;
const struct z80_insn_info *info;
- read_memory (addr, buf, sizeof(buf));
+ read_memory (addr, buf, sizeof (buf));
info = z80_get_insn_info (gdbarch, buf, &size);
if (info)
switch (info->type)
@@ -1063,9 +1072,7 @@ z80_insn_is_jump (struct gdbarch *gdbarch, CORE_ADDR addr)
return 0;
}
-static const struct frame_unwind
-z80_frame_unwind =
-{
+static const struct frame_unwind z80_frame_unwind = {
"z80",
NORMAL_FRAME,
default_frame_unwind_stop_reason,
@@ -1139,12 +1146,12 @@ z80_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
/* Create a type for PC. We can't use builtin types here, as they may not
be defined. */
- tdep->void_type = arch_type (gdbarch, TYPE_CODE_VOID, TARGET_CHAR_BIT,
- "void");
+ tdep->void_type
+ = arch_type (gdbarch, TYPE_CODE_VOID, TARGET_CHAR_BIT, "void");
tdep->func_void_type = make_function_type (tdep->void_type, NULL);
- tdep->pc_type = arch_pointer_type (gdbarch,
- tdep->addr_length * TARGET_CHAR_BIT,
- NULL, tdep->func_void_type);
+ tdep->pc_type
+ = arch_pointer_type (gdbarch, tdep->addr_length * TARGET_CHAR_BIT, NULL,
+ tdep->func_void_type);
set_gdbarch_short_bit (gdbarch, TARGET_CHAR_BIT);
set_gdbarch_int_bit (gdbarch, 2 * TARGET_CHAR_BIT);
@@ -1190,198 +1197,187 @@ z80_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
}
/* Table to disassemble machine codes without prefix. */
-static const struct z80_insn_info
-ez80_main_insn_table[] =
-{ /* table with double prefix check */
- { 0100, 0377, 0, insn_force_nop}, //double prefix
- { 0111, 0377, 0, insn_force_nop}, //double prefix
- { 0122, 0377, 0, insn_force_nop}, //double prefix
- { 0133, 0377, 0, insn_force_nop}, //double prefix
+static const struct z80_insn_info ez80_main_insn_table[] = {
+ /* table with double prefix check */
+ { 0100, 0377, 0, insn_force_nop }, //double prefix
+ { 0111, 0377, 0, insn_force_nop }, //double prefix
+ { 0122, 0377, 0, insn_force_nop }, //double prefix
+ { 0133, 0377, 0, insn_force_nop }, //double prefix
/* initial table for eZ80_z80 */
- { 0100, 0377, 1, insn_z80 }, //eZ80 mode prefix
- { 0111, 0377, 1, insn_z80 }, //eZ80 mode prefix
- { 0122, 0377, 1, insn_adl }, //eZ80 mode prefix
- { 0133, 0377, 1, insn_adl }, //eZ80 mode prefix
+ { 0100, 0377, 1, insn_z80 }, //eZ80 mode prefix
+ { 0111, 0377, 1, insn_z80 }, //eZ80 mode prefix
+ { 0122, 0377, 1, insn_adl }, //eZ80 mode prefix
+ { 0133, 0377, 1, insn_adl }, //eZ80 mode prefix
/* here common Z80/Z180/eZ80 opcodes */
- { 0000, 0367, 1, insn_default }, //"nop", "ex af,af'"
- { 0061, 0377, 3, insn_ld_sp_nn }, //"ld sp,nn"
- { 0001, 0317, 3, insn_default }, //"ld rr,nn"
- { 0002, 0347, 1, insn_default }, //"ld (rr),a", "ld a,(rr)"
- { 0042, 0347, 3, insn_default }, //"ld (nn),hl/a", "ld hl/a,(nn)"
- { 0063, 0377, 1, insn_inc_sp }, //"inc sp"
- { 0073, 0377, 1, insn_dec_sp }, //"dec sp"
- { 0003, 0303, 1, insn_default }, //"inc rr", "dec rr", ...
- { 0004, 0307, 1, insn_default }, //"inc/dec r/(hl)"
- { 0006, 0307, 2, insn_default }, //"ld r,n", "ld (hl),n"
- { 0020, 0377, 2, insn_djnz_d }, //"djnz dis"
- { 0030, 0377, 2, insn_jr_d }, //"jr dis"
- { 0040, 0347, 2, insn_jr_cc_d }, //"jr cc,dis"
- { 0100, 0300, 1, insn_default }, //"ld r,r", "halt"
- { 0200, 0300, 1, insn_default }, //"alu_op a,r"
- { 0300, 0307, 1, insn_ret_cc }, //"ret cc"
- { 0301, 0317, 1, insn_pop_rr }, //"pop rr"
- { 0302, 0307, 3, insn_jp_cc_nn }, //"jp cc,nn"
- { 0303, 0377, 3, insn_jp_nn }, //"jp nn"
- { 0304, 0307, 3, insn_call_cc_nn}, //"call cc,nn"
- { 0305, 0317, 1, insn_push_rr }, //"push rr"
- { 0306, 0307, 2, insn_default }, //"alu_op a,n"
- { 0307, 0307, 1, insn_rst_n }, //"rst n"
- { 0311, 0377, 1, insn_ret }, //"ret"
- { 0313, 0377, 2, insn_default }, //CB prefix
- { 0315, 0377, 3, insn_call_nn }, //"call nn"
- { 0323, 0367, 2, insn_default }, //"out (n),a", "in a,(n)"
- { 0335, 0337, 1, insn_z80_ddfd }, //DD/FD prefix
- { 0351, 0377, 1, insn_jp_rr }, //"jp (hl)"
- { 0355, 0377, 1, insn_z80_ed }, //ED prefix
- { 0371, 0377, 1, insn_ld_sp_rr }, //"ld sp,hl"
- { 0000, 0000, 1, insn_default } //others
-} ;
-
-static const struct z80_insn_info
-ez80_adl_main_insn_table[] =
-{ /* table with double prefix check */
- { 0100, 0377, 0, insn_force_nop}, //double prefix
- { 0111, 0377, 0, insn_force_nop}, //double prefix
- { 0122, 0377, 0, insn_force_nop}, //double prefix
- { 0133, 0377, 0, insn_force_nop}, //double prefix
+ { 0000, 0367, 1, insn_default }, //"nop", "ex af,af'"
+ { 0061, 0377, 3, insn_ld_sp_nn }, //"ld sp,nn"
+ { 0001, 0317, 3, insn_default }, //"ld rr,nn"
+ { 0002, 0347, 1, insn_default }, //"ld (rr),a", "ld a,(rr)"
+ { 0042, 0347, 3, insn_default }, //"ld (nn),hl/a", "ld hl/a,(nn)"
+ { 0063, 0377, 1, insn_inc_sp }, //"inc sp"
+ { 0073, 0377, 1, insn_dec_sp }, //"dec sp"
+ { 0003, 0303, 1, insn_default }, //"inc rr", "dec rr", ...
+ { 0004, 0307, 1, insn_default }, //"inc/dec r/(hl)"
+ { 0006, 0307, 2, insn_default }, //"ld r,n", "ld (hl),n"
+ { 0020, 0377, 2, insn_djnz_d }, //"djnz dis"
+ { 0030, 0377, 2, insn_jr_d }, //"jr dis"
+ { 0040, 0347, 2, insn_jr_cc_d }, //"jr cc,dis"
+ { 0100, 0300, 1, insn_default }, //"ld r,r", "halt"
+ { 0200, 0300, 1, insn_default }, //"alu_op a,r"
+ { 0300, 0307, 1, insn_ret_cc }, //"ret cc"
+ { 0301, 0317, 1, insn_pop_rr }, //"pop rr"
+ { 0302, 0307, 3, insn_jp_cc_nn }, //"jp cc,nn"
+ { 0303, 0377, 3, insn_jp_nn }, //"jp nn"
+ { 0304, 0307, 3, insn_call_cc_nn }, //"call cc,nn"
+ { 0305, 0317, 1, insn_push_rr }, //"push rr"
+ { 0306, 0307, 2, insn_default }, //"alu_op a,n"
+ { 0307, 0307, 1, insn_rst_n }, //"rst n"
+ { 0311, 0377, 1, insn_ret }, //"ret"
+ { 0313, 0377, 2, insn_default }, //CB prefix
+ { 0315, 0377, 3, insn_call_nn }, //"call nn"
+ { 0323, 0367, 2, insn_default }, //"out (n),a", "in a,(n)"
+ { 0335, 0337, 1, insn_z80_ddfd }, //DD/FD prefix
+ { 0351, 0377, 1, insn_jp_rr }, //"jp (hl)"
+ { 0355, 0377, 1, insn_z80_ed }, //ED prefix
+ { 0371, 0377, 1, insn_ld_sp_rr }, //"ld sp,hl"
+ { 0000, 0000, 1, insn_default } //others
+};
+
+static const struct z80_insn_info ez80_adl_main_insn_table[] = {
+ /* table with double prefix check */
+ { 0100, 0377, 0, insn_force_nop }, //double prefix
+ { 0111, 0377, 0, insn_force_nop }, //double prefix
+ { 0122, 0377, 0, insn_force_nop }, //double prefix
+ { 0133, 0377, 0, insn_force_nop }, //double prefix
/* initial table for eZ80_adl */
- { 0000, 0367, 1, insn_default }, //"nop", "ex af,af'"
- { 0061, 0377, 4, insn_ld_sp_nn }, //"ld sp,Mmn"
- { 0001, 0317, 4, insn_default }, //"ld rr,Mmn"
- { 0002, 0347, 1, insn_default }, //"ld (rr),a", "ld a,(rr)"
- { 0042, 0347, 4, insn_default }, //"ld (Mmn),hl/a", "ld hl/a,(Mmn)"
- { 0063, 0377, 1, insn_inc_sp }, //"inc sp"
- { 0073, 0377, 1, insn_dec_sp }, //"dec sp"
- { 0003, 0303, 1, insn_default }, //"inc rr", "dec rr", ...
- { 0004, 0307, 1, insn_default }, //"inc/dec r/(hl)"
- { 0006, 0307, 2, insn_default }, //"ld r,n", "ld (hl),n"
- { 0020, 0377, 2, insn_djnz_d }, //"djnz dis"
- { 0030, 0377, 2, insn_jr_d }, //"jr dis"
- { 0040, 0347, 2, insn_jr_cc_d }, //"jr cc,dis"
- { 0100, 0377, 1, insn_z80 }, //eZ80 mode prefix (short instruction)
- { 0111, 0377, 1, insn_z80 }, //eZ80 mode prefix (short instruction)
- { 0122, 0377, 1, insn_adl }, //eZ80 mode prefix (long instruction)
- { 0133, 0377, 1, insn_adl }, //eZ80 mode prefix (long instruction)
- { 0100, 0300, 1, insn_default }, //"ld r,r", "halt"
- { 0200, 0300, 1, insn_default }, //"alu_op a,r"
- { 0300, 0307, 1, insn_ret_cc }, //"ret cc"
- { 0301, 0317, 1, insn_pop_rr }, //"pop rr"
- { 0302, 0307, 4, insn_jp_cc_nn }, //"jp cc,nn"
- { 0303, 0377, 4, insn_jp_nn }, //"jp nn"
- { 0304, 0307, 4, insn_call_cc_nn}, //"call cc,Mmn"
- { 0305, 0317, 1, insn_push_rr }, //"push rr"
- { 0306, 0307, 2, insn_default }, //"alu_op a,n"
- { 0307, 0307, 1, insn_rst_n }, //"rst n"
- { 0311, 0377, 1, insn_ret }, //"ret"
- { 0313, 0377, 2, insn_default }, //CB prefix
- { 0315, 0377, 4, insn_call_nn }, //"call Mmn"
- { 0323, 0367, 2, insn_default }, //"out (n),a", "in a,(n)"
- { 0335, 0337, 1, insn_adl_ddfd }, //DD/FD prefix
- { 0351, 0377, 1, insn_jp_rr }, //"jp (hl)"
- { 0355, 0377, 1, insn_adl_ed }, //ED prefix
- { 0371, 0377, 1, insn_ld_sp_rr }, //"ld sp,hl"
- { 0000, 0000, 1, insn_default } //others
+ { 0000, 0367, 1, insn_default }, //"nop", "ex af,af'"
+ { 0061, 0377, 4, insn_ld_sp_nn }, //"ld sp,Mmn"
+ { 0001, 0317, 4, insn_default }, //"ld rr,Mmn"
+ { 0002, 0347, 1, insn_default }, //"ld (rr),a", "ld a,(rr)"
+ { 0042, 0347, 4, insn_default }, //"ld (Mmn),hl/a", "ld hl/a,(Mmn)"
+ { 0063, 0377, 1, insn_inc_sp }, //"inc sp"
+ { 0073, 0377, 1, insn_dec_sp }, //"dec sp"
+ { 0003, 0303, 1, insn_default }, //"inc rr", "dec rr", ...
+ { 0004, 0307, 1, insn_default }, //"inc/dec r/(hl)"
+ { 0006, 0307, 2, insn_default }, //"ld r,n", "ld (hl),n"
+ { 0020, 0377, 2, insn_djnz_d }, //"djnz dis"
+ { 0030, 0377, 2, insn_jr_d }, //"jr dis"
+ { 0040, 0347, 2, insn_jr_cc_d }, //"jr cc,dis"
+ { 0100, 0377, 1, insn_z80 }, //eZ80 mode prefix (short instruction)
+ { 0111, 0377, 1, insn_z80 }, //eZ80 mode prefix (short instruction)
+ { 0122, 0377, 1, insn_adl }, //eZ80 mode prefix (long instruction)
+ { 0133, 0377, 1, insn_adl }, //eZ80 mode prefix (long instruction)
+ { 0100, 0300, 1, insn_default }, //"ld r,r", "halt"
+ { 0200, 0300, 1, insn_default }, //"alu_op a,r"
+ { 0300, 0307, 1, insn_ret_cc }, //"ret cc"
+ { 0301, 0317, 1, insn_pop_rr }, //"pop rr"
+ { 0302, 0307, 4, insn_jp_cc_nn }, //"jp cc,nn"
+ { 0303, 0377, 4, insn_jp_nn }, //"jp nn"
+ { 0304, 0307, 4, insn_call_cc_nn }, //"call cc,Mmn"
+ { 0305, 0317, 1, insn_push_rr }, //"push rr"
+ { 0306, 0307, 2, insn_default }, //"alu_op a,n"
+ { 0307, 0307, 1, insn_rst_n }, //"rst n"
+ { 0311, 0377, 1, insn_ret }, //"ret"
+ { 0313, 0377, 2, insn_default }, //CB prefix
+ { 0315, 0377, 4, insn_call_nn }, //"call Mmn"
+ { 0323, 0367, 2, insn_default }, //"out (n),a", "in a,(n)"
+ { 0335, 0337, 1, insn_adl_ddfd }, //DD/FD prefix
+ { 0351, 0377, 1, insn_jp_rr }, //"jp (hl)"
+ { 0355, 0377, 1, insn_adl_ed }, //ED prefix
+ { 0371, 0377, 1, insn_ld_sp_rr }, //"ld sp,hl"
+ { 0000, 0000, 1, insn_default } //others
};
/* ED prefix opcodes table.
Note the instruction length does include the ED prefix (+ 1 byte)
*/
-static const struct z80_insn_info
-ez80_ed_insn_table[] =
-{
+static const struct z80_insn_info ez80_ed_insn_table[] = {
/* eZ80 only instructions */
- { 0002, 0366, 2, insn_default }, //"lea rr,ii+d"
- { 0124, 0376, 2, insn_default }, //"lea ix,iy+d", "lea iy,ix+d"
- { 0145, 0377, 2, insn_default }, //"pea ix+d"
- { 0146, 0377, 2, insn_default }, //"pea iy+d"
- { 0164, 0377, 2, insn_default }, //"tstio n"
- /* Z180/eZ80 only instructions */
- { 0060, 0376, 1, insn_default }, //not an instruction
- { 0000, 0306, 2, insn_default }, //"in0 r,(n)", "out0 (n),r"
- { 0144, 0377, 2, insn_default }, //"tst a, n"
- /* common instructions */
- { 0173, 0377, 3, insn_ld_sp_6nn9 }, //"ld sp,(nn)"
- { 0103, 0307, 3, insn_default }, //"ld (nn),rr", "ld rr,(nn)"
- { 0105, 0317, 1, insn_ret }, //"retn", "reti"
- { 0000, 0000, 1, insn_default }
-};
-
-static const struct z80_insn_info
-ez80_adl_ed_insn_table[] =
-{
{ 0002, 0366, 2, insn_default }, //"lea rr,ii+d"
{ 0124, 0376, 2, insn_default }, //"lea ix,iy+d", "lea iy,ix+d"
{ 0145, 0377, 2, insn_default }, //"pea ix+d"
{ 0146, 0377, 2, insn_default }, //"pea iy+d"
{ 0164, 0377, 2, insn_default }, //"tstio n"
+ /* Z180/eZ80 only instructions */
{ 0060, 0376, 1, insn_default }, //not an instruction
{ 0000, 0306, 2, insn_default }, //"in0 r,(n)", "out0 (n),r"
{ 0144, 0377, 2, insn_default }, //"tst a, n"
- { 0173, 0377, 4, insn_ld_sp_6nn9 }, //"ld sp,(nn)"
- { 0103, 0307, 4, insn_default }, //"ld (nn),rr", "ld rr,(nn)"
- { 0105, 0317, 1, insn_ret }, //"retn", "reti"
+ /* common instructions */
+ { 0173, 0377, 3, insn_ld_sp_6nn9 }, //"ld sp,(nn)"
+ { 0103, 0307, 3, insn_default }, //"ld (nn),rr", "ld rr,(nn)"
+ { 0105, 0317, 1, insn_ret }, //"retn", "reti"
{ 0000, 0000, 1, insn_default }
};
+static const struct z80_insn_info ez80_adl_ed_insn_table[]
+ = { { 0002, 0366, 2, insn_default }, //"lea rr,ii+d"
+ { 0124, 0376, 2, insn_default }, //"lea ix,iy+d", "lea iy,ix+d"
+ { 0145, 0377, 2, insn_default }, //"pea ix+d"
+ { 0146, 0377, 2, insn_default }, //"pea iy+d"
+ { 0164, 0377, 2, insn_default }, //"tstio n"
+ { 0060, 0376, 1, insn_default }, //not an instruction
+ { 0000, 0306, 2, insn_default }, //"in0 r,(n)", "out0 (n),r"
+ { 0144, 0377, 2, insn_default }, //"tst a, n"
+ { 0173, 0377, 4, insn_ld_sp_6nn9 }, //"ld sp,(nn)"
+ { 0103, 0307, 4, insn_default }, //"ld (nn),rr", "ld rr,(nn)"
+ { 0105, 0317, 1, insn_ret }, //"retn", "reti"
+ { 0000, 0000, 1, insn_default } };
+
/* table for FD and DD prefixed instructions */
-static const struct z80_insn_info
-ez80_ddfd_insn_table[] =
-{
+static const struct z80_insn_info ez80_ddfd_insn_table[] = {
/* ez80 only instructions */
{ 0007, 0307, 2, insn_default }, //"ld rr,(ii+d)"
{ 0061, 0377, 2, insn_default }, //"ld ii,(ii+d)"
/* common instructions */
- { 0011, 0367, 2, insn_default }, //"add ii,rr"
- { 0041, 0377, 3, insn_default }, //"ld ii,nn"
- { 0042, 0367, 3, insn_default }, //"ld (nn),ii", "ld ii,(nn)"
- { 0043, 0367, 1, insn_default }, //"inc ii", "dec ii"
- { 0044, 0366, 1, insn_default }, //"inc/dec iih/iil"
- { 0046, 0367, 2, insn_default }, //"ld iih,n", "ld iil,n"
- { 0064, 0376, 2, insn_default }, //"inc (ii+d)", "dec (ii+d)"
- { 0066, 0377, 2, insn_default }, //"ld (ii+d),n"
- { 0166, 0377, 0, insn_default }, //not an instruction
- { 0160, 0370, 2, insn_default }, //"ld (ii+d),r"
- { 0104, 0306, 1, insn_default }, //"ld r,iih", "ld r,iil"
- { 0106, 0307, 2, insn_default }, //"ld r,(ii+d)"
- { 0140, 0360, 1, insn_default }, //"ld iih,r", "ld iil,r"
- { 0204, 0306, 1, insn_default }, //"alu_op a,iih", "alu_op a,iil"
- { 0206, 0307, 2, insn_default }, //"alu_op a,(ii+d)"
- { 0313, 0377, 3, insn_default }, //DD/FD CB dd oo instructions
- { 0335, 0337, 0, insn_force_nop}, //double DD/FD prefix, exec DD/FD as NOP
- { 0341, 0373, 1, insn_default }, //"pop ii", "push ii"
- { 0343, 0377, 1, insn_default }, //"ex (sp),ii"
- { 0351, 0377, 1, insn_jp_rr }, //"jp (ii)"
- { 0371, 0377, 1, insn_ld_sp_rr}, //"ld sp,ii"
- { 0000, 0000, 0, insn_default } //not an instruction, exec DD/FD as NOP
+ { 0011, 0367, 2, insn_default }, //"add ii,rr"
+ { 0041, 0377, 3, insn_default }, //"ld ii,nn"
+ { 0042, 0367, 3, insn_default }, //"ld (nn),ii", "ld ii,(nn)"
+ { 0043, 0367, 1, insn_default }, //"inc ii", "dec ii"
+ { 0044, 0366, 1, insn_default }, //"inc/dec iih/iil"
+ { 0046, 0367, 2, insn_default }, //"ld iih,n", "ld iil,n"
+ { 0064, 0376, 2, insn_default }, //"inc (ii+d)", "dec (ii+d)"
+ { 0066, 0377, 2, insn_default }, //"ld (ii+d),n"
+ { 0166, 0377, 0, insn_default }, //not an instruction
+ { 0160, 0370, 2, insn_default }, //"ld (ii+d),r"
+ { 0104, 0306, 1, insn_default }, //"ld r,iih", "ld r,iil"
+ { 0106, 0307, 2, insn_default }, //"ld r,(ii+d)"
+ { 0140, 0360, 1, insn_default }, //"ld iih,r", "ld iil,r"
+ { 0204, 0306, 1, insn_default }, //"alu_op a,iih", "alu_op a,iil"
+ { 0206, 0307, 2, insn_default }, //"alu_op a,(ii+d)"
+ { 0313, 0377, 3, insn_default }, //DD/FD CB dd oo instructions
+ { 0335, 0337, 0, insn_force_nop }, //double DD/FD prefix, exec DD/FD as NOP
+ { 0341, 0373, 1, insn_default }, //"pop ii", "push ii"
+ { 0343, 0377, 1, insn_default }, //"ex (sp),ii"
+ { 0351, 0377, 1, insn_jp_rr }, //"jp (ii)"
+ { 0371, 0377, 1, insn_ld_sp_rr }, //"ld sp,ii"
+ { 0000, 0000, 0, insn_default } //not an instruction, exec DD/FD as NOP
};
-static const struct z80_insn_info
-ez80_adl_ddfd_insn_table[] =
-{
- { 0007, 0307, 2, insn_default }, //"ld rr,(ii+d)"
- { 0061, 0377, 2, insn_default }, //"ld ii,(ii+d)"
- { 0011, 0367, 1, insn_default }, //"add ii,rr"
- { 0041, 0377, 4, insn_default }, //"ld ii,nn"
- { 0042, 0367, 4, insn_default }, //"ld (nn),ii", "ld ii,(nn)"
- { 0043, 0367, 1, insn_default }, //"inc ii", "dec ii"
- { 0044, 0366, 1, insn_default }, //"inc/dec iih/iil"
- { 0046, 0367, 2, insn_default }, //"ld iih,n", "ld iil,n"
- { 0064, 0376, 2, insn_default }, //"inc (ii+d)", "dec (ii+d)"
- { 0066, 0377, 3, insn_default }, //"ld (ii+d),n"
- { 0166, 0377, 0, insn_default }, //not an instruction
- { 0160, 0370, 2, insn_default }, //"ld (ii+d),r"
- { 0104, 0306, 1, insn_default }, //"ld r,iih", "ld r,iil"
- { 0106, 0307, 2, insn_default }, //"ld r,(ii+d)"
- { 0140, 0360, 1, insn_default }, //"ld iih,r", "ld iil,r"
- { 0204, 0306, 1, insn_default }, //"alu_op a,iih", "alu_op a,iil"
- { 0206, 0307, 2, insn_default }, //"alu_op a,(ii+d)"
- { 0313, 0377, 3, insn_default }, //DD/FD CB dd oo instructions
- { 0335, 0337, 0, insn_force_nop}, //double DD/FD prefix, exec DD/FD as NOP
- { 0341, 0373, 1, insn_default }, //"pop ii", "push ii"
- { 0343, 0377, 1, insn_default }, //"ex (sp),ii"
- { 0351, 0377, 1, insn_jp_rr }, //"jp (ii)"
- { 0371, 0377, 1, insn_ld_sp_rr}, //"ld sp,ii"
- { 0000, 0000, 0, insn_default } //not an instruction, exec DD/FD as NOP
+static const struct z80_insn_info ez80_adl_ddfd_insn_table[] = {
+ { 0007, 0307, 2, insn_default }, //"ld rr,(ii+d)"
+ { 0061, 0377, 2, insn_default }, //"ld ii,(ii+d)"
+ { 0011, 0367, 1, insn_default }, //"add ii,rr"
+ { 0041, 0377, 4, insn_default }, //"ld ii,nn"
+ { 0042, 0367, 4, insn_default }, //"ld (nn),ii", "ld ii,(nn)"
+ { 0043, 0367, 1, insn_default }, //"inc ii", "dec ii"
+ { 0044, 0366, 1, insn_default }, //"inc/dec iih/iil"
+ { 0046, 0367, 2, insn_default }, //"ld iih,n", "ld iil,n"
+ { 0064, 0376, 2, insn_default }, //"inc (ii+d)", "dec (ii+d)"
+ { 0066, 0377, 3, insn_default }, //"ld (ii+d),n"
+ { 0166, 0377, 0, insn_default }, //not an instruction
+ { 0160, 0370, 2, insn_default }, //"ld (ii+d),r"
+ { 0104, 0306, 1, insn_default }, //"ld r,iih", "ld r,iil"
+ { 0106, 0307, 2, insn_default }, //"ld r,(ii+d)"
+ { 0140, 0360, 1, insn_default }, //"ld iih,r", "ld iil,r"
+ { 0204, 0306, 1, insn_default }, //"alu_op a,iih", "alu_op a,iil"
+ { 0206, 0307, 2, insn_default }, //"alu_op a,(ii+d)"
+ { 0313, 0377, 3, insn_default }, //DD/FD CB dd oo instructions
+ { 0335, 0337, 0, insn_force_nop }, //double DD/FD prefix, exec DD/FD as NOP
+ { 0341, 0373, 1, insn_default }, //"pop ii", "push ii"
+ { 0343, 0377, 1, insn_default }, //"ex (sp),ii"
+ { 0351, 0377, 1, insn_jp_rr }, //"jp (ii)"
+ { 0371, 0377, 1, insn_ld_sp_rr }, //"ld sp,ii"
+ { 0000, 0000, 0, insn_default } //not an instruction, exec DD/FD as NOP
};
/* Return pointer to instruction information structure corresponded to opcode
diff --git a/gdb/z80-tdep.h b/gdb/z80-tdep.h
index e3fbe77a98a..427a0506f01 100644
--- a/gdb/z80-tdep.h
+++ b/gdb/z80-tdep.h
@@ -30,7 +30,7 @@ enum z80_regnum
Z80_BC_REGNUM,
Z80_DE_REGNUM,
Z80_HL_REGNUM,
- Z80_SP_REGNUM, /* SPL on eZ80 CPU */
+ Z80_SP_REGNUM, /* SPL on eZ80 CPU */
Z80_PC_REGNUM,
Z80_IX_REGNUM,
Z80_IY_REGNUM,
@@ -39,14 +39,14 @@ enum z80_regnum
Z80_DEA_REGNUM,
Z80_HLA_REGNUM,
Z80_IR_REGNUM,
-/* eZ80 only registers */
- Z80_SPS_REGNUM /* SPS register of eZ80 CPU */
+ /* eZ80 only registers */
+ Z80_SPS_REGNUM /* SPS register of eZ80 CPU */
};
-#define Z80_NUM_REGS 13
-#define Z80_REG_BYTES (Z80_NUM_REGS*2)
+#define Z80_NUM_REGS 13
+#define Z80_REG_BYTES (Z80_NUM_REGS * 2)
-#define EZ80_NUM_REGS (Z80_NUM_REGS + 1)
-#define EZ80_REG_BYTES (EZ80_NUM_REGS*3)
+#define EZ80_NUM_REGS (Z80_NUM_REGS + 1)
+#define EZ80_REG_BYTES (EZ80_NUM_REGS * 3)
#endif /* z80-tdep.h */
diff --git a/gdbserver/ax.cc b/gdbserver/ax.cc
index 38ebfbbd750..76f2fa1c8a0 100644
--- a/gdbserver/ax.cc
+++ b/gdbserver/ax.cc
@@ -44,40 +44,38 @@ ax_vdebug (const char *fmt, ...)
va_end (ap);
}
-#define ax_debug(fmt, args...) \
- do { \
- if (debug_threads) \
- ax_vdebug ((fmt), ##args); \
- } while (0)
+#define ax_debug(fmt, args...) \
+ do \
+ { \
+ if (debug_threads) \
+ ax_vdebug ((fmt), ##args); \
+ } \
+ while (0)
/* This enum must exactly match what is documented in
gdb/doc/agentexpr.texi, including all the numerical values. */
enum gdb_agent_op
- {
-#define DEFOP(NAME, SIZE, DATA_SIZE, CONSUMED, PRODUCED, VALUE) \
- gdb_agent_op_ ## NAME = VALUE,
+{
+#define DEFOP(NAME, SIZE, DATA_SIZE, CONSUMED, PRODUCED, VALUE) \
+ gdb_agent_op_##NAME = VALUE,
#include "gdbsupport/ax.def"
#undef DEFOP
- gdb_agent_op_last
- };
+ gdb_agent_op_last
+};
-static const char * const gdb_agent_op_names [gdb_agent_op_last] =
- {
- "?undef?"
-#define DEFOP(NAME, SIZE, DATA_SIZE, CONSUMED, PRODUCED, VALUE) , # NAME
+static const char *const gdb_agent_op_names[gdb_agent_op_last] = { "?undef?"
+#define DEFOP(NAME, SIZE, DATA_SIZE, CONSUMED, PRODUCED, VALUE) , #NAME
#include "gdbsupport/ax.def"
#undef DEFOP
- };
+};
#ifndef IN_PROCESS_AGENT
-static const unsigned char gdb_agent_op_sizes [gdb_agent_op_last] =
- {
- 0
-#define DEFOP(NAME, SIZE, DATA_SIZE, CONSUMED, PRODUCED, VALUE) , SIZE
+static const unsigned char gdb_agent_op_sizes[gdb_agent_op_last] = { 0
+#define DEFOP(NAME, SIZE, DATA_SIZE, CONSUMED, PRODUCED, VALUE) , SIZE
#include "gdbsupport/ax.def"
#undef DEFOP
- };
+};
#endif
/* A wrapper for gdb_agent_op_names that does some bounds-checking. */
@@ -102,9 +100,9 @@ gdb_parse_agent_expr (const char **actparm)
ULONGEST xlen;
struct agent_expr *aexpr;
- ++act; /* skip the X */
+ ++act; /* skip the X */
act = unpack_varlen_hex (act, &xlen);
- ++act; /* skip a comma */
+ ++act; /* skip a comma */
aexpr = XNEW (struct agent_expr);
aexpr->length = xlen;
aexpr->bytes = (unsigned char *) xmalloc (xlen);
@@ -387,11 +385,11 @@ is_goto_target (struct agent_expr *aexpr, int pc)
op = aexpr->bytes[i];
if (op == gdb_agent_op_goto || op == gdb_agent_op_if_goto)
- {
- int target = (aexpr->bytes[i + 1] << 8) + aexpr->bytes[i + 2];
- if (target == pc)
- return 1;
- }
+ {
+ int target = (aexpr->bytes[i + 1] << 8) + aexpr->bytes[i + 2];
+ if (target == pc)
+ return 1;
+ }
}
return 0;
@@ -410,12 +408,13 @@ compile_bytecodes (struct agent_expr *aexpr)
ULONGEST top;
struct bytecode_address *aentry, *aentry2;
-#define UNHANDLED \
- do \
- { \
- ax_debug ("Cannot compile op 0x%x\n", op); \
- return expr_eval_unhandled_opcode; \
- } while (0)
+#define UNHANDLED \
+ do \
+ { \
+ ax_debug ("Cannot compile op 0x%x\n", op); \
+ return expr_eval_unhandled_opcode; \
+ } \
+ while (0)
if (aexpr->length == 0)
{
@@ -446,322 +445,318 @@ compile_bytecodes (struct agent_expr *aexpr)
emit_error = 0;
switch (op)
- {
- case gdb_agent_op_add:
- emit_add ();
- break;
-
- case gdb_agent_op_sub:
- emit_sub ();
- break;
-
- case gdb_agent_op_mul:
- emit_mul ();
- break;
-
- case gdb_agent_op_div_signed:
- UNHANDLED;
- break;
-
- case gdb_agent_op_div_unsigned:
- UNHANDLED;
- break;
-
- case gdb_agent_op_rem_signed:
- UNHANDLED;
- break;
-
- case gdb_agent_op_rem_unsigned:
- UNHANDLED;
- break;
-
- case gdb_agent_op_lsh:
- emit_lsh ();
- break;
-
- case gdb_agent_op_rsh_signed:
- emit_rsh_signed ();
- break;
-
- case gdb_agent_op_rsh_unsigned:
- emit_rsh_unsigned ();
- break;
-
- case gdb_agent_op_trace:
- UNHANDLED;
- break;
-
- case gdb_agent_op_trace_quick:
- UNHANDLED;
- break;
-
- case gdb_agent_op_log_not:
- emit_log_not ();
- break;
-
- case gdb_agent_op_bit_and:
- emit_bit_and ();
- break;
-
- case gdb_agent_op_bit_or:
- emit_bit_or ();
- break;
-
- case gdb_agent_op_bit_xor:
- emit_bit_xor ();
- break;
-
- case gdb_agent_op_bit_not:
- emit_bit_not ();
- break;
-
- case gdb_agent_op_equal:
- next_op = aexpr->bytes[pc];
- if (next_op == gdb_agent_op_if_goto
- && !is_goto_target (aexpr, pc)
- && target_emit_ops ()->emit_eq_goto)
- {
- ax_debug ("Combining equal & if_goto");
- pc += 1;
- aentry->pc = pc;
- arg = aexpr->bytes[pc++];
- arg = (arg << 8) + aexpr->bytes[pc++];
- aentry->goto_pc = arg;
- emit_eq_goto (&(aentry->from_offset), &(aentry->from_size));
- }
- else if (next_op == gdb_agent_op_log_not
- && (aexpr->bytes[pc + 1] == gdb_agent_op_if_goto)
- && !is_goto_target (aexpr, pc + 1)
- && target_emit_ops ()->emit_ne_goto)
- {
- ax_debug ("Combining equal & log_not & if_goto");
- pc += 2;
- aentry->pc = pc;
- arg = aexpr->bytes[pc++];
- arg = (arg << 8) + aexpr->bytes[pc++];
- aentry->goto_pc = arg;
- emit_ne_goto (&(aentry->from_offset), &(aentry->from_size));
- }
- else
- emit_equal ();
- break;
-
- case gdb_agent_op_less_signed:
- next_op = aexpr->bytes[pc];
- if (next_op == gdb_agent_op_if_goto
- && !is_goto_target (aexpr, pc))
- {
- ax_debug ("Combining less_signed & if_goto");
- pc += 1;
- aentry->pc = pc;
- arg = aexpr->bytes[pc++];
- arg = (arg << 8) + aexpr->bytes[pc++];
- aentry->goto_pc = arg;
- emit_lt_goto (&(aentry->from_offset), &(aentry->from_size));
- }
- else if (next_op == gdb_agent_op_log_not
- && !is_goto_target (aexpr, pc)
- && (aexpr->bytes[pc + 1] == gdb_agent_op_if_goto)
- && !is_goto_target (aexpr, pc + 1))
- {
- ax_debug ("Combining less_signed & log_not & if_goto");
- pc += 2;
- aentry->pc = pc;
- arg = aexpr->bytes[pc++];
- arg = (arg << 8) + aexpr->bytes[pc++];
- aentry->goto_pc = arg;
- emit_ge_goto (&(aentry->from_offset), &(aentry->from_size));
- }
- else
- emit_less_signed ();
- break;
-
- case gdb_agent_op_less_unsigned:
- emit_less_unsigned ();
- break;
-
- case gdb_agent_op_ext:
- arg = aexpr->bytes[pc++];
- if (arg < (sizeof (LONGEST) * 8))
- emit_ext (arg);
- break;
-
- case gdb_agent_op_ref8:
- emit_ref (1);
- break;
-
- case gdb_agent_op_ref16:
- emit_ref (2);
- break;
-
- case gdb_agent_op_ref32:
- emit_ref (4);
- break;
-
- case gdb_agent_op_ref64:
- emit_ref (8);
- break;
-
- case gdb_agent_op_if_goto:
- arg = aexpr->bytes[pc++];
- arg = (arg << 8) + aexpr->bytes[pc++];
- aentry->goto_pc = arg;
- emit_if_goto (&(aentry->from_offset), &(aentry->from_size));
- break;
-
- case gdb_agent_op_goto:
- arg = aexpr->bytes[pc++];
- arg = (arg << 8) + aexpr->bytes[pc++];
- aentry->goto_pc = arg;
- emit_goto (&(aentry->from_offset), &(aentry->from_size));
- break;
-
- case gdb_agent_op_const8:
- emit_stack_flush ();
- top = aexpr->bytes[pc++];
- emit_const (top);
- break;
-
- case gdb_agent_op_const16:
- emit_stack_flush ();
- top = aexpr->bytes[pc++];
- top = (top << 8) + aexpr->bytes[pc++];
- emit_const (top);
- break;
-
- case gdb_agent_op_const32:
- emit_stack_flush ();
- top = aexpr->bytes[pc++];
- top = (top << 8) + aexpr->bytes[pc++];
- top = (top << 8) + aexpr->bytes[pc++];
- top = (top << 8) + aexpr->bytes[pc++];
- emit_const (top);
- break;
-
- case gdb_agent_op_const64:
- emit_stack_flush ();
- top = aexpr->bytes[pc++];
- top = (top << 8) + aexpr->bytes[pc++];
- top = (top << 8) + aexpr->bytes[pc++];
- top = (top << 8) + aexpr->bytes[pc++];
- top = (top << 8) + aexpr->bytes[pc++];
- top = (top << 8) + aexpr->bytes[pc++];
- top = (top << 8) + aexpr->bytes[pc++];
- top = (top << 8) + aexpr->bytes[pc++];
- emit_const (top);
- break;
-
- case gdb_agent_op_reg:
- emit_stack_flush ();
- arg = aexpr->bytes[pc++];
- arg = (arg << 8) + aexpr->bytes[pc++];
- emit_reg (arg);
- break;
-
- case gdb_agent_op_end:
- ax_debug ("At end of expression\n");
-
- /* Assume there is one stack element left, and that it is
+ {
+ case gdb_agent_op_add:
+ emit_add ();
+ break;
+
+ case gdb_agent_op_sub:
+ emit_sub ();
+ break;
+
+ case gdb_agent_op_mul:
+ emit_mul ();
+ break;
+
+ case gdb_agent_op_div_signed:
+ UNHANDLED;
+ break;
+
+ case gdb_agent_op_div_unsigned:
+ UNHANDLED;
+ break;
+
+ case gdb_agent_op_rem_signed:
+ UNHANDLED;
+ break;
+
+ case gdb_agent_op_rem_unsigned:
+ UNHANDLED;
+ break;
+
+ case gdb_agent_op_lsh:
+ emit_lsh ();
+ break;
+
+ case gdb_agent_op_rsh_signed:
+ emit_rsh_signed ();
+ break;
+
+ case gdb_agent_op_rsh_unsigned:
+ emit_rsh_unsigned ();
+ break;
+
+ case gdb_agent_op_trace:
+ UNHANDLED;
+ break;
+
+ case gdb_agent_op_trace_quick:
+ UNHANDLED;
+ break;
+
+ case gdb_agent_op_log_not:
+ emit_log_not ();
+ break;
+
+ case gdb_agent_op_bit_and:
+ emit_bit_and ();
+ break;
+
+ case gdb_agent_op_bit_or:
+ emit_bit_or ();
+ break;
+
+ case gdb_agent_op_bit_xor:
+ emit_bit_xor ();
+ break;
+
+ case gdb_agent_op_bit_not:
+ emit_bit_not ();
+ break;
+
+ case gdb_agent_op_equal:
+ next_op = aexpr->bytes[pc];
+ if (next_op == gdb_agent_op_if_goto && !is_goto_target (aexpr, pc)
+ && target_emit_ops ()->emit_eq_goto)
+ {
+ ax_debug ("Combining equal & if_goto");
+ pc += 1;
+ aentry->pc = pc;
+ arg = aexpr->bytes[pc++];
+ arg = (arg << 8) + aexpr->bytes[pc++];
+ aentry->goto_pc = arg;
+ emit_eq_goto (&(aentry->from_offset), &(aentry->from_size));
+ }
+ else if (next_op == gdb_agent_op_log_not
+ && (aexpr->bytes[pc + 1] == gdb_agent_op_if_goto)
+ && !is_goto_target (aexpr, pc + 1)
+ && target_emit_ops ()->emit_ne_goto)
+ {
+ ax_debug ("Combining equal & log_not & if_goto");
+ pc += 2;
+ aentry->pc = pc;
+ arg = aexpr->bytes[pc++];
+ arg = (arg << 8) + aexpr->bytes[pc++];
+ aentry->goto_pc = arg;
+ emit_ne_goto (&(aentry->from_offset), &(aentry->from_size));
+ }
+ else
+ emit_equal ();
+ break;
+
+ case gdb_agent_op_less_signed:
+ next_op = aexpr->bytes[pc];
+ if (next_op == gdb_agent_op_if_goto && !is_goto_target (aexpr, pc))
+ {
+ ax_debug ("Combining less_signed & if_goto");
+ pc += 1;
+ aentry->pc = pc;
+ arg = aexpr->bytes[pc++];
+ arg = (arg << 8) + aexpr->bytes[pc++];
+ aentry->goto_pc = arg;
+ emit_lt_goto (&(aentry->from_offset), &(aentry->from_size));
+ }
+ else if (next_op == gdb_agent_op_log_not
+ && !is_goto_target (aexpr, pc)
+ && (aexpr->bytes[pc + 1] == gdb_agent_op_if_goto)
+ && !is_goto_target (aexpr, pc + 1))
+ {
+ ax_debug ("Combining less_signed & log_not & if_goto");
+ pc += 2;
+ aentry->pc = pc;
+ arg = aexpr->bytes[pc++];
+ arg = (arg << 8) + aexpr->bytes[pc++];
+ aentry->goto_pc = arg;
+ emit_ge_goto (&(aentry->from_offset), &(aentry->from_size));
+ }
+ else
+ emit_less_signed ();
+ break;
+
+ case gdb_agent_op_less_unsigned:
+ emit_less_unsigned ();
+ break;
+
+ case gdb_agent_op_ext:
+ arg = aexpr->bytes[pc++];
+ if (arg < (sizeof (LONGEST) * 8))
+ emit_ext (arg);
+ break;
+
+ case gdb_agent_op_ref8:
+ emit_ref (1);
+ break;
+
+ case gdb_agent_op_ref16:
+ emit_ref (2);
+ break;
+
+ case gdb_agent_op_ref32:
+ emit_ref (4);
+ break;
+
+ case gdb_agent_op_ref64:
+ emit_ref (8);
+ break;
+
+ case gdb_agent_op_if_goto:
+ arg = aexpr->bytes[pc++];
+ arg = (arg << 8) + aexpr->bytes[pc++];
+ aentry->goto_pc = arg;
+ emit_if_goto (&(aentry->from_offset), &(aentry->from_size));
+ break;
+
+ case gdb_agent_op_goto:
+ arg = aexpr->bytes[pc++];
+ arg = (arg << 8) + aexpr->bytes[pc++];
+ aentry->goto_pc = arg;
+ emit_goto (&(aentry->from_offset), &(aentry->from_size));
+ break;
+
+ case gdb_agent_op_const8:
+ emit_stack_flush ();
+ top = aexpr->bytes[pc++];
+ emit_const (top);
+ break;
+
+ case gdb_agent_op_const16:
+ emit_stack_flush ();
+ top = aexpr->bytes[pc++];
+ top = (top << 8) + aexpr->bytes[pc++];
+ emit_const (top);
+ break;
+
+ case gdb_agent_op_const32:
+ emit_stack_flush ();
+ top = aexpr->bytes[pc++];
+ top = (top << 8) + aexpr->bytes[pc++];
+ top = (top << 8) + aexpr->bytes[pc++];
+ top = (top << 8) + aexpr->bytes[pc++];
+ emit_const (top);
+ break;
+
+ case gdb_agent_op_const64:
+ emit_stack_flush ();
+ top = aexpr->bytes[pc++];
+ top = (top << 8) + aexpr->bytes[pc++];
+ top = (top << 8) + aexpr->bytes[pc++];
+ top = (top << 8) + aexpr->bytes[pc++];
+ top = (top << 8) + aexpr->bytes[pc++];
+ top = (top << 8) + aexpr->bytes[pc++];
+ top = (top << 8) + aexpr->bytes[pc++];
+ top = (top << 8) + aexpr->bytes[pc++];
+ emit_const (top);
+ break;
+
+ case gdb_agent_op_reg:
+ emit_stack_flush ();
+ arg = aexpr->bytes[pc++];
+ arg = (arg << 8) + aexpr->bytes[pc++];
+ emit_reg (arg);
+ break;
+
+ case gdb_agent_op_end:
+ ax_debug ("At end of expression\n");
+
+ /* Assume there is one stack element left, and that it is
cached in "top" where emit_epilogue can get to it. */
- emit_stack_adjust (1);
-
- done = 1;
- break;
-
- case gdb_agent_op_dup:
- /* In our design, dup is equivalent to stack flushing. */
- emit_stack_flush ();
- break;
-
- case gdb_agent_op_pop:
- emit_pop ();
- break;
-
- case gdb_agent_op_zero_ext:
- arg = aexpr->bytes[pc++];
- if (arg < (sizeof (LONGEST) * 8))
- emit_zero_ext (arg);
- break;
-
- case gdb_agent_op_swap:
- next_op = aexpr->bytes[pc];
- /* Detect greater-than comparison sequences. */
- if (next_op == gdb_agent_op_less_signed
- && !is_goto_target (aexpr, pc)
- && (aexpr->bytes[pc + 1] == gdb_agent_op_if_goto)
- && !is_goto_target (aexpr, pc + 1))
- {
- ax_debug ("Combining swap & less_signed & if_goto");
- pc += 2;
- aentry->pc = pc;
- arg = aexpr->bytes[pc++];
- arg = (arg << 8) + aexpr->bytes[pc++];
- aentry->goto_pc = arg;
- emit_gt_goto (&(aentry->from_offset), &(aentry->from_size));
- }
- else if (next_op == gdb_agent_op_less_signed
- && !is_goto_target (aexpr, pc)
- && (aexpr->bytes[pc + 1] == gdb_agent_op_log_not)
- && !is_goto_target (aexpr, pc + 1)
- && (aexpr->bytes[pc + 2] == gdb_agent_op_if_goto)
- && !is_goto_target (aexpr, pc + 2))
- {
- ax_debug ("Combining swap & less_signed & log_not & if_goto");
- pc += 3;
- aentry->pc = pc;
- arg = aexpr->bytes[pc++];
- arg = (arg << 8) + aexpr->bytes[pc++];
- aentry->goto_pc = arg;
- emit_le_goto (&(aentry->from_offset), &(aentry->from_size));
- }
- else
- emit_swap ();
- break;
-
- case gdb_agent_op_getv:
- emit_stack_flush ();
- arg = aexpr->bytes[pc++];
- arg = (arg << 8) + aexpr->bytes[pc++];
- emit_int_call_1 (get_get_tsv_func_addr (),
- arg);
- break;
-
- case gdb_agent_op_setv:
- arg = aexpr->bytes[pc++];
- arg = (arg << 8) + aexpr->bytes[pc++];
- emit_void_call_2 (get_set_tsv_func_addr (),
- arg);
- break;
-
- case gdb_agent_op_tracev:
- UNHANDLED;
- break;
-
- /* GDB never (currently) generates any of these ops. */
- case gdb_agent_op_float:
- case gdb_agent_op_ref_float:
- case gdb_agent_op_ref_double:
- case gdb_agent_op_ref_long_double:
- case gdb_agent_op_l_to_d:
- case gdb_agent_op_d_to_l:
- case gdb_agent_op_trace16:
- UNHANDLED;
- break;
-
- default:
- ax_debug ("Agent expression op 0x%x not recognized\n", op);
- /* Don't struggle on, things will just get worse. */
- return expr_eval_unrecognized_opcode;
- }
+ emit_stack_adjust (1);
+
+ done = 1;
+ break;
+
+ case gdb_agent_op_dup:
+ /* In our design, dup is equivalent to stack flushing. */
+ emit_stack_flush ();
+ break;
+
+ case gdb_agent_op_pop:
+ emit_pop ();
+ break;
+
+ case gdb_agent_op_zero_ext:
+ arg = aexpr->bytes[pc++];
+ if (arg < (sizeof (LONGEST) * 8))
+ emit_zero_ext (arg);
+ break;
+
+ case gdb_agent_op_swap:
+ next_op = aexpr->bytes[pc];
+ /* Detect greater-than comparison sequences. */
+ if (next_op == gdb_agent_op_less_signed
+ && !is_goto_target (aexpr, pc)
+ && (aexpr->bytes[pc + 1] == gdb_agent_op_if_goto)
+ && !is_goto_target (aexpr, pc + 1))
+ {
+ ax_debug ("Combining swap & less_signed & if_goto");
+ pc += 2;
+ aentry->pc = pc;
+ arg = aexpr->bytes[pc++];
+ arg = (arg << 8) + aexpr->bytes[pc++];
+ aentry->goto_pc = arg;
+ emit_gt_goto (&(aentry->from_offset), &(aentry->from_size));
+ }
+ else if (next_op == gdb_agent_op_less_signed
+ && !is_goto_target (aexpr, pc)
+ && (aexpr->bytes[pc + 1] == gdb_agent_op_log_not)
+ && !is_goto_target (aexpr, pc + 1)
+ && (aexpr->bytes[pc + 2] == gdb_agent_op_if_goto)
+ && !is_goto_target (aexpr, pc + 2))
+ {
+ ax_debug ("Combining swap & less_signed & log_not & if_goto");
+ pc += 3;
+ aentry->pc = pc;
+ arg = aexpr->bytes[pc++];
+ arg = (arg << 8) + aexpr->bytes[pc++];
+ aentry->goto_pc = arg;
+ emit_le_goto (&(aentry->from_offset), &(aentry->from_size));
+ }
+ else
+ emit_swap ();
+ break;
+
+ case gdb_agent_op_getv:
+ emit_stack_flush ();
+ arg = aexpr->bytes[pc++];
+ arg = (arg << 8) + aexpr->bytes[pc++];
+ emit_int_call_1 (get_get_tsv_func_addr (), arg);
+ break;
+
+ case gdb_agent_op_setv:
+ arg = aexpr->bytes[pc++];
+ arg = (arg << 8) + aexpr->bytes[pc++];
+ emit_void_call_2 (get_set_tsv_func_addr (), arg);
+ break;
+
+ case gdb_agent_op_tracev:
+ UNHANDLED;
+ break;
+
+ /* GDB never (currently) generates any of these ops. */
+ case gdb_agent_op_float:
+ case gdb_agent_op_ref_float:
+ case gdb_agent_op_ref_double:
+ case gdb_agent_op_ref_long_double:
+ case gdb_agent_op_l_to_d:
+ case gdb_agent_op_d_to_l:
+ case gdb_agent_op_trace16:
+ UNHANDLED;
+ break;
+
+ default:
+ ax_debug ("Agent expression op 0x%x not recognized\n", op);
+ /* Don't struggle on, things will just get worse. */
+ return expr_eval_unrecognized_opcode;
+ }
/* This catches errors that occur in target-specific code
emission. */
if (emit_error)
- {
- ax_debug ("Error %d while emitting code for %s\n",
- emit_error, gdb_agent_op_name (op));
- return expr_eval_unhandled_opcode;
- }
+ {
+ ax_debug ("Error %d while emitting code for %s\n", emit_error,
+ gdb_agent_op_name (op));
+ return expr_eval_unhandled_opcode;
+ }
ax_debug ("Op %s compiled\n", gdb_agent_op_name (op));
}
@@ -772,32 +767,31 @@ compile_bytecodes (struct agent_expr *aexpr)
int written = 0;
if (aentry->goto_pc < 0)
- continue;
+ continue;
/* Find the location that we are going to, and call back into
target-specific code to write the actual address or
displacement. */
for (aentry2 = bytecode_address_table; aentry2; aentry2 = aentry2->next)
- {
- if (aentry2->pc == aentry->goto_pc)
- {
- ax_debug ("Want to jump from %s to %s\n",
- paddress (aentry->address),
- paddress (aentry2->address));
- write_goto_address (aentry->address + aentry->from_offset,
- aentry2->address, aentry->from_size);
- written = 1;
- break;
- }
- }
+ {
+ if (aentry2->pc == aentry->goto_pc)
+ {
+ ax_debug ("Want to jump from %s to %s\n",
+ paddress (aentry->address),
+ paddress (aentry2->address));
+ write_goto_address (aentry->address + aentry->from_offset,
+ aentry2->address, aentry->from_size);
+ written = 1;
+ break;
+ }
+ }
/* Error out if we didn't find a destination. */
if (!written)
- {
- ax_debug ("Destination of goto %d not found\n",
- aentry->goto_pc);
- return expr_eval_invalid_goto;
- }
+ {
+ ax_debug ("Destination of goto %d not found\n", aentry->goto_pc);
+ return expr_eval_invalid_goto;
+ }
}
return expr_eval_no_error;
@@ -813,8 +807,8 @@ compile_bytecodes (struct agent_expr *aexpr)
in. */
static void
-ax_printf (CORE_ADDR fn, CORE_ADDR chan, const char *format,
- int nargs, ULONGEST *args)
+ax_printf (CORE_ADDR fn, CORE_ADDR chan, const char *format, int nargs,
+ ULONGEST *args)
{
const char *f = format;
int i;
@@ -831,86 +825,86 @@ ax_printf (CORE_ADDR fn, CORE_ADDR chan, const char *format,
++nargs_wanted;
if (nargs != nargs_wanted)
- error (_("Wrong number of arguments for specified format-string"));
+ error (_ ("Wrong number of arguments for specified format-string"));
i = 0;
for (auto &&piece : fpieces)
{
current_substring = piece.string;
- ax_debug ("current substring is '%s', class is %d",
- current_substring, piece.argclass);
+ ax_debug ("current substring is '%s', class is %d", current_substring,
+ piece.argclass);
switch (piece.argclass)
- {
- case string_arg:
- {
- gdb_byte *str;
- CORE_ADDR tem;
- int j;
-
- tem = args[i];
- if (tem == 0)
- {
- printf (current_substring, "(null)");
- break;
- }
-
- /* This is a %s argument. Find the length of the string. */
- for (j = 0;; j++)
- {
- gdb_byte c;
-
- read_inferior_memory (tem + j, &c, 1);
- if (c == 0)
- break;
- }
-
- /* Copy the string contents into a string inside GDB. */
- str = (gdb_byte *) alloca (j + 1);
- if (j != 0)
- read_inferior_memory (tem, str, j);
- str[j] = 0;
-
- printf (current_substring, (char *) str);
- }
- break;
-
- case long_long_arg:
-#if defined (PRINTF_HAS_LONG_LONG)
- {
- long long val = args[i];
-
- printf (current_substring, val);
- break;
- }
+ {
+ case string_arg:
+ {
+ gdb_byte *str;
+ CORE_ADDR tem;
+ int j;
+
+ tem = args[i];
+ if (tem == 0)
+ {
+ printf (current_substring, "(null)");
+ break;
+ }
+
+ /* This is a %s argument. Find the length of the string. */
+ for (j = 0;; j++)
+ {
+ gdb_byte c;
+
+ read_inferior_memory (tem + j, &c, 1);
+ if (c == 0)
+ break;
+ }
+
+ /* Copy the string contents into a string inside GDB. */
+ str = (gdb_byte *) alloca (j + 1);
+ if (j != 0)
+ read_inferior_memory (tem, str, j);
+ str[j] = 0;
+
+ printf (current_substring, (char *) str);
+ }
+ break;
+
+ case long_long_arg:
+#if defined(PRINTF_HAS_LONG_LONG)
+ {
+ long long val = args[i];
+
+ printf (current_substring, val);
+ break;
+ }
#else
- error (_("long long not supported in agent printf"));
+ error (_ ("long long not supported in agent printf"));
#endif
- case int_arg:
- {
- int val = args[i];
+ case int_arg:
+ {
+ int val = args[i];
- printf (current_substring, val);
- break;
- }
+ printf (current_substring, val);
+ break;
+ }
- case long_arg:
- {
- long val = args[i];
+ case long_arg:
+ {
+ long val = args[i];
- printf (current_substring, val);
- break;
- }
+ printf (current_substring, val);
+ break;
+ }
- case size_t_arg:
- {
- size_t val = args[i];
+ case size_t_arg:
+ {
+ size_t val = args[i];
- printf (current_substring, val);
- break;
- }
+ printf (current_substring, val);
+ break;
+ }
- case literal_piece:
- /* Print a portion of the format string that has no
+ case literal_piece:
+ /* Print a portion of the format string that has no
directives. Note that this will not include any
ordinary %-specs, but it might include "%%". That is
why we use printf_filtered and not puts_filtered here.
@@ -918,17 +912,17 @@ ax_printf (CORE_ADDR fn, CORE_ADDR chan, const char *format,
have modified GCC to include -Wformat-security by
default, which will warn here if there is no
argument. */
- printf (current_substring, 0);
- break;
+ printf (current_substring, 0);
+ break;
- default:
- error (_("Format directive in '%s' not supported in agent printf"),
- current_substring);
- }
+ default:
+ error (_ ("Format directive in '%s' not supported in agent printf"),
+ current_substring);
+ }
/* Maybe advance to the next argument. */
if (piece.argclass != literal_piece)
- ++i;
+ ++i;
}
fflush (stdout);
@@ -940,8 +934,7 @@ ax_printf (CORE_ADDR fn, CORE_ADDR chan, const char *format,
enum eval_result_type
gdb_eval_agent_expr (struct eval_agent_expr_context *ctx,
- struct agent_expr *aexpr,
- ULONGEST *rslt)
+ struct agent_expr *aexpr, ULONGEST *rslt)
{
int pc = 0;
#define STACK_MAX 100
@@ -996,377 +989,375 @@ gdb_eval_agent_expr (struct eval_agent_expr_context *ctx,
ax_debug ("About to interpret byte 0x%x", op);
switch (op)
- {
- case gdb_agent_op_add:
- top += stack[--sp];
- break;
-
- case gdb_agent_op_sub:
- top = stack[--sp] - top;
- break;
-
- case gdb_agent_op_mul:
- top *= stack[--sp];
- break;
-
- case gdb_agent_op_div_signed:
- if (top == 0)
- {
- ax_debug ("Attempted to divide by zero");
- return expr_eval_divide_by_zero;
- }
- top = ((LONGEST) stack[--sp]) / ((LONGEST) top);
- break;
-
- case gdb_agent_op_div_unsigned:
- if (top == 0)
- {
- ax_debug ("Attempted to divide by zero");
- return expr_eval_divide_by_zero;
- }
- top = stack[--sp] / top;
- break;
-
- case gdb_agent_op_rem_signed:
- if (top == 0)
- {
- ax_debug ("Attempted to divide by zero");
- return expr_eval_divide_by_zero;
- }
- top = ((LONGEST) stack[--sp]) % ((LONGEST) top);
- break;
-
- case gdb_agent_op_rem_unsigned:
- if (top == 0)
- {
- ax_debug ("Attempted to divide by zero");
- return expr_eval_divide_by_zero;
- }
- top = stack[--sp] % top;
- break;
-
- case gdb_agent_op_lsh:
- top = stack[--sp] << top;
- break;
-
- case gdb_agent_op_rsh_signed:
- top = ((LONGEST) stack[--sp]) >> top;
- break;
-
- case gdb_agent_op_rsh_unsigned:
- top = stack[--sp] >> top;
- break;
-
- case gdb_agent_op_trace:
- agent_mem_read (ctx, NULL, (CORE_ADDR) stack[--sp],
- (ULONGEST) top);
- if (--sp >= 0)
- top = stack[sp];
- break;
-
- case gdb_agent_op_trace_quick:
- arg = aexpr->bytes[pc++];
- agent_mem_read (ctx, NULL, (CORE_ADDR) top, (ULONGEST) arg);
- break;
-
- case gdb_agent_op_log_not:
- top = !top;
- break;
-
- case gdb_agent_op_bit_and:
- top &= stack[--sp];
- break;
-
- case gdb_agent_op_bit_or:
- top |= stack[--sp];
- break;
-
- case gdb_agent_op_bit_xor:
- top ^= stack[--sp];
- break;
-
- case gdb_agent_op_bit_not:
- top = ~top;
- break;
-
- case gdb_agent_op_equal:
- top = (stack[--sp] == top);
- break;
-
- case gdb_agent_op_less_signed:
- top = (((LONGEST) stack[--sp]) < ((LONGEST) top));
- break;
-
- case gdb_agent_op_less_unsigned:
- top = (stack[--sp] < top);
- break;
-
- case gdb_agent_op_ext:
- arg = aexpr->bytes[pc++];
- if (arg < (sizeof (LONGEST) * 8))
- {
- LONGEST mask = 1 << (arg - 1);
- top &= ((LONGEST) 1 << arg) - 1;
- top = (top ^ mask) - mask;
- }
- break;
-
- case gdb_agent_op_ref8:
- agent_mem_read (ctx, cnv.u8.bytes, (CORE_ADDR) top, 1);
- top = cnv.u8.val;
- break;
-
- case gdb_agent_op_ref16:
- agent_mem_read (ctx, cnv.u16.bytes, (CORE_ADDR) top, 2);
- top = cnv.u16.val;
- break;
-
- case gdb_agent_op_ref32:
- agent_mem_read (ctx, cnv.u32.bytes, (CORE_ADDR) top, 4);
- top = cnv.u32.val;
- break;
-
- case gdb_agent_op_ref64:
- agent_mem_read (ctx, cnv.u64.bytes, (CORE_ADDR) top, 8);
- top = cnv.u64.val;
- break;
-
- case gdb_agent_op_if_goto:
- if (top)
- pc = (aexpr->bytes[pc] << 8) + (aexpr->bytes[pc + 1]);
- else
- pc += 2;
- if (--sp >= 0)
- top = stack[sp];
- break;
-
- case gdb_agent_op_goto:
- pc = (aexpr->bytes[pc] << 8) + (aexpr->bytes[pc + 1]);
- break;
-
- case gdb_agent_op_const8:
- /* Flush the cached stack top. */
- stack[sp++] = top;
- top = aexpr->bytes[pc++];
- break;
-
- case gdb_agent_op_const16:
- /* Flush the cached stack top. */
- stack[sp++] = top;
- top = aexpr->bytes[pc++];
- top = (top << 8) + aexpr->bytes[pc++];
- break;
-
- case gdb_agent_op_const32:
- /* Flush the cached stack top. */
- stack[sp++] = top;
- top = aexpr->bytes[pc++];
- top = (top << 8) + aexpr->bytes[pc++];
- top = (top << 8) + aexpr->bytes[pc++];
- top = (top << 8) + aexpr->bytes[pc++];
- break;
-
- case gdb_agent_op_const64:
- /* Flush the cached stack top. */
- stack[sp++] = top;
- top = aexpr->bytes[pc++];
- top = (top << 8) + aexpr->bytes[pc++];
- top = (top << 8) + aexpr->bytes[pc++];
- top = (top << 8) + aexpr->bytes[pc++];
- top = (top << 8) + aexpr->bytes[pc++];
- top = (top << 8) + aexpr->bytes[pc++];
- top = (top << 8) + aexpr->bytes[pc++];
- top = (top << 8) + aexpr->bytes[pc++];
- break;
-
- case gdb_agent_op_reg:
- /* Flush the cached stack top. */
- stack[sp++] = top;
- arg = aexpr->bytes[pc++];
- arg = (arg << 8) + aexpr->bytes[pc++];
- {
- int regnum = arg;
- struct regcache *regcache = ctx->regcache;
-
- switch (register_size (regcache->tdesc, regnum))
- {
- case 8:
- collect_register (regcache, regnum, cnv.u64.bytes);
- top = cnv.u64.val;
- break;
- case 4:
- collect_register (regcache, regnum, cnv.u32.bytes);
- top = cnv.u32.val;
- break;
- case 2:
- collect_register (regcache, regnum, cnv.u16.bytes);
- top = cnv.u16.val;
- break;
- case 1:
- collect_register (regcache, regnum, cnv.u8.bytes);
- top = cnv.u8.val;
- break;
- default:
- internal_error ("unhandled register size");
- }
- }
- break;
-
- case gdb_agent_op_end:
- ax_debug ("At end of expression, sp=%d, stack top cache=0x%s",
- sp, pulongest (top));
- if (rslt)
- {
- if (sp <= 0)
- {
- /* This should be an error */
- ax_debug ("Stack is empty, nothing to return");
- return expr_eval_empty_stack;
- }
- *rslt = top;
- }
- return expr_eval_no_error;
-
- case gdb_agent_op_dup:
- stack[sp++] = top;
- break;
-
- case gdb_agent_op_pop:
- if (--sp >= 0)
- top = stack[sp];
- break;
-
- case gdb_agent_op_pick:
- arg = aexpr->bytes[pc++];
- stack[sp] = top;
- top = stack[sp - arg];
- ++sp;
- break;
-
- case gdb_agent_op_rot:
- {
- ULONGEST tem = stack[sp - 1];
-
- stack[sp - 1] = stack[sp - 2];
- stack[sp - 2] = top;
- top = tem;
- }
- break;
-
- case gdb_agent_op_zero_ext:
- arg = aexpr->bytes[pc++];
- if (arg < (sizeof (LONGEST) * 8))
- top &= ((LONGEST) 1 << arg) - 1;
- break;
-
- case gdb_agent_op_swap:
- /* Interchange top two stack elements, making sure top gets
+ {
+ case gdb_agent_op_add:
+ top += stack[--sp];
+ break;
+
+ case gdb_agent_op_sub:
+ top = stack[--sp] - top;
+ break;
+
+ case gdb_agent_op_mul:
+ top *= stack[--sp];
+ break;
+
+ case gdb_agent_op_div_signed:
+ if (top == 0)
+ {
+ ax_debug ("Attempted to divide by zero");
+ return expr_eval_divide_by_zero;
+ }
+ top = ((LONGEST) stack[--sp]) / ((LONGEST) top);
+ break;
+
+ case gdb_agent_op_div_unsigned:
+ if (top == 0)
+ {
+ ax_debug ("Attempted to divide by zero");
+ return expr_eval_divide_by_zero;
+ }
+ top = stack[--sp] / top;
+ break;
+
+ case gdb_agent_op_rem_signed:
+ if (top == 0)
+ {
+ ax_debug ("Attempted to divide by zero");
+ return expr_eval_divide_by_zero;
+ }
+ top = ((LONGEST) stack[--sp]) % ((LONGEST) top);
+ break;
+
+ case gdb_agent_op_rem_unsigned:
+ if (top == 0)
+ {
+ ax_debug ("Attempted to divide by zero");
+ return expr_eval_divide_by_zero;
+ }
+ top = stack[--sp] % top;
+ break;
+
+ case gdb_agent_op_lsh:
+ top = stack[--sp] << top;
+ break;
+
+ case gdb_agent_op_rsh_signed:
+ top = ((LONGEST) stack[--sp]) >> top;
+ break;
+
+ case gdb_agent_op_rsh_unsigned:
+ top = stack[--sp] >> top;
+ break;
+
+ case gdb_agent_op_trace:
+ agent_mem_read (ctx, NULL, (CORE_ADDR) stack[--sp], (ULONGEST) top);
+ if (--sp >= 0)
+ top = stack[sp];
+ break;
+
+ case gdb_agent_op_trace_quick:
+ arg = aexpr->bytes[pc++];
+ agent_mem_read (ctx, NULL, (CORE_ADDR) top, (ULONGEST) arg);
+ break;
+
+ case gdb_agent_op_log_not:
+ top = !top;
+ break;
+
+ case gdb_agent_op_bit_and:
+ top &= stack[--sp];
+ break;
+
+ case gdb_agent_op_bit_or:
+ top |= stack[--sp];
+ break;
+
+ case gdb_agent_op_bit_xor:
+ top ^= stack[--sp];
+ break;
+
+ case gdb_agent_op_bit_not:
+ top = ~top;
+ break;
+
+ case gdb_agent_op_equal:
+ top = (stack[--sp] == top);
+ break;
+
+ case gdb_agent_op_less_signed:
+ top = (((LONGEST) stack[--sp]) < ((LONGEST) top));
+ break;
+
+ case gdb_agent_op_less_unsigned:
+ top = (stack[--sp] < top);
+ break;
+
+ case gdb_agent_op_ext:
+ arg = aexpr->bytes[pc++];
+ if (arg < (sizeof (LONGEST) * 8))
+ {
+ LONGEST mask = 1 << (arg - 1);
+ top &= ((LONGEST) 1 << arg) - 1;
+ top = (top ^ mask) - mask;
+ }
+ break;
+
+ case gdb_agent_op_ref8:
+ agent_mem_read (ctx, cnv.u8.bytes, (CORE_ADDR) top, 1);
+ top = cnv.u8.val;
+ break;
+
+ case gdb_agent_op_ref16:
+ agent_mem_read (ctx, cnv.u16.bytes, (CORE_ADDR) top, 2);
+ top = cnv.u16.val;
+ break;
+
+ case gdb_agent_op_ref32:
+ agent_mem_read (ctx, cnv.u32.bytes, (CORE_ADDR) top, 4);
+ top = cnv.u32.val;
+ break;
+
+ case gdb_agent_op_ref64:
+ agent_mem_read (ctx, cnv.u64.bytes, (CORE_ADDR) top, 8);
+ top = cnv.u64.val;
+ break;
+
+ case gdb_agent_op_if_goto:
+ if (top)
+ pc = (aexpr->bytes[pc] << 8) + (aexpr->bytes[pc + 1]);
+ else
+ pc += 2;
+ if (--sp >= 0)
+ top = stack[sp];
+ break;
+
+ case gdb_agent_op_goto:
+ pc = (aexpr->bytes[pc] << 8) + (aexpr->bytes[pc + 1]);
+ break;
+
+ case gdb_agent_op_const8:
+ /* Flush the cached stack top. */
+ stack[sp++] = top;
+ top = aexpr->bytes[pc++];
+ break;
+
+ case gdb_agent_op_const16:
+ /* Flush the cached stack top. */
+ stack[sp++] = top;
+ top = aexpr->bytes[pc++];
+ top = (top << 8) + aexpr->bytes[pc++];
+ break;
+
+ case gdb_agent_op_const32:
+ /* Flush the cached stack top. */
+ stack[sp++] = top;
+ top = aexpr->bytes[pc++];
+ top = (top << 8) + aexpr->bytes[pc++];
+ top = (top << 8) + aexpr->bytes[pc++];
+ top = (top << 8) + aexpr->bytes[pc++];
+ break;
+
+ case gdb_agent_op_const64:
+ /* Flush the cached stack top. */
+ stack[sp++] = top;
+ top = aexpr->bytes[pc++];
+ top = (top << 8) + aexpr->bytes[pc++];
+ top = (top << 8) + aexpr->bytes[pc++];
+ top = (top << 8) + aexpr->bytes[pc++];
+ top = (top << 8) + aexpr->bytes[pc++];
+ top = (top << 8) + aexpr->bytes[pc++];
+ top = (top << 8) + aexpr->bytes[pc++];
+ top = (top << 8) + aexpr->bytes[pc++];
+ break;
+
+ case gdb_agent_op_reg:
+ /* Flush the cached stack top. */
+ stack[sp++] = top;
+ arg = aexpr->bytes[pc++];
+ arg = (arg << 8) + aexpr->bytes[pc++];
+ {
+ int regnum = arg;
+ struct regcache *regcache = ctx->regcache;
+
+ switch (register_size (regcache->tdesc, regnum))
+ {
+ case 8:
+ collect_register (regcache, regnum, cnv.u64.bytes);
+ top = cnv.u64.val;
+ break;
+ case 4:
+ collect_register (regcache, regnum, cnv.u32.bytes);
+ top = cnv.u32.val;
+ break;
+ case 2:
+ collect_register (regcache, regnum, cnv.u16.bytes);
+ top = cnv.u16.val;
+ break;
+ case 1:
+ collect_register (regcache, regnum, cnv.u8.bytes);
+ top = cnv.u8.val;
+ break;
+ default:
+ internal_error ("unhandled register size");
+ }
+ }
+ break;
+
+ case gdb_agent_op_end:
+ ax_debug ("At end of expression, sp=%d, stack top cache=0x%s", sp,
+ pulongest (top));
+ if (rslt)
+ {
+ if (sp <= 0)
+ {
+ /* This should be an error */
+ ax_debug ("Stack is empty, nothing to return");
+ return expr_eval_empty_stack;
+ }
+ *rslt = top;
+ }
+ return expr_eval_no_error;
+
+ case gdb_agent_op_dup:
+ stack[sp++] = top;
+ break;
+
+ case gdb_agent_op_pop:
+ if (--sp >= 0)
+ top = stack[sp];
+ break;
+
+ case gdb_agent_op_pick:
+ arg = aexpr->bytes[pc++];
+ stack[sp] = top;
+ top = stack[sp - arg];
+ ++sp;
+ break;
+
+ case gdb_agent_op_rot:
+ {
+ ULONGEST tem = stack[sp - 1];
+
+ stack[sp - 1] = stack[sp - 2];
+ stack[sp - 2] = top;
+ top = tem;
+ }
+ break;
+
+ case gdb_agent_op_zero_ext:
+ arg = aexpr->bytes[pc++];
+ if (arg < (sizeof (LONGEST) * 8))
+ top &= ((LONGEST) 1 << arg) - 1;
+ break;
+
+ case gdb_agent_op_swap:
+ /* Interchange top two stack elements, making sure top gets
copied back onto stack. */
- stack[sp] = top;
- top = stack[sp - 1];
- stack[sp - 1] = stack[sp];
- break;
-
- case gdb_agent_op_getv:
- /* Flush the cached stack top. */
- stack[sp++] = top;
- arg = aexpr->bytes[pc++];
- arg = (arg << 8) + aexpr->bytes[pc++];
- top = agent_get_trace_state_variable_value (arg);
- break;
-
- case gdb_agent_op_setv:
- arg = aexpr->bytes[pc++];
- arg = (arg << 8) + aexpr->bytes[pc++];
- agent_set_trace_state_variable_value (arg, top);
- /* Note that we leave the value on the stack, for the
+ stack[sp] = top;
+ top = stack[sp - 1];
+ stack[sp - 1] = stack[sp];
+ break;
+
+ case gdb_agent_op_getv:
+ /* Flush the cached stack top. */
+ stack[sp++] = top;
+ arg = aexpr->bytes[pc++];
+ arg = (arg << 8) + aexpr->bytes[pc++];
+ top = agent_get_trace_state_variable_value (arg);
+ break;
+
+ case gdb_agent_op_setv:
+ arg = aexpr->bytes[pc++];
+ arg = (arg << 8) + aexpr->bytes[pc++];
+ agent_set_trace_state_variable_value (arg, top);
+ /* Note that we leave the value on the stack, for the
benefit of later/enclosing expressions. */
- break;
-
- case gdb_agent_op_tracev:
- arg = aexpr->bytes[pc++];
- arg = (arg << 8) + aexpr->bytes[pc++];
- agent_tsv_read (ctx, arg);
- break;
-
- case gdb_agent_op_tracenz:
- agent_mem_read_string (ctx, NULL, (CORE_ADDR) stack[--sp],
- (ULONGEST) top);
- if (--sp >= 0)
- top = stack[sp];
- break;
-
- case gdb_agent_op_printf:
- {
- int nargs, slen, i;
- CORE_ADDR fn = 0, chan = 0;
- /* Can't have more args than the entire size of the stack. */
- ULONGEST args[STACK_MAX];
- char *format;
-
- nargs = aexpr->bytes[pc++];
- slen = aexpr->bytes[pc++];
- slen = (slen << 8) + aexpr->bytes[pc++];
- format = (char *) &(aexpr->bytes[pc]);
- pc += slen;
- /* Pop function and channel. */
- fn = top;
- if (--sp >= 0)
- top = stack[sp];
- chan = top;
- if (--sp >= 0)
- top = stack[sp];
- /* Pop arguments into a dedicated array. */
- for (i = 0; i < nargs; ++i)
- {
- args[i] = top;
- if (--sp >= 0)
- top = stack[sp];
- }
-
- /* A bad format string means something is very wrong; give
+ break;
+
+ case gdb_agent_op_tracev:
+ arg = aexpr->bytes[pc++];
+ arg = (arg << 8) + aexpr->bytes[pc++];
+ agent_tsv_read (ctx, arg);
+ break;
+
+ case gdb_agent_op_tracenz:
+ agent_mem_read_string (ctx, NULL, (CORE_ADDR) stack[--sp],
+ (ULONGEST) top);
+ if (--sp >= 0)
+ top = stack[sp];
+ break;
+
+ case gdb_agent_op_printf:
+ {
+ int nargs, slen, i;
+ CORE_ADDR fn = 0, chan = 0;
+ /* Can't have more args than the entire size of the stack. */
+ ULONGEST args[STACK_MAX];
+ char *format;
+
+ nargs = aexpr->bytes[pc++];
+ slen = aexpr->bytes[pc++];
+ slen = (slen << 8) + aexpr->bytes[pc++];
+ format = (char *) &(aexpr->bytes[pc]);
+ pc += slen;
+ /* Pop function and channel. */
+ fn = top;
+ if (--sp >= 0)
+ top = stack[sp];
+ chan = top;
+ if (--sp >= 0)
+ top = stack[sp];
+ /* Pop arguments into a dedicated array. */
+ for (i = 0; i < nargs; ++i)
+ {
+ args[i] = top;
+ if (--sp >= 0)
+ top = stack[sp];
+ }
+
+ /* A bad format string means something is very wrong; give
up immediately. */
- if (format[slen - 1] != '\0')
- error (_("Unterminated format string in printf bytecode"));
-
- ax_printf (fn, chan, format, nargs, args);
- }
- break;
-
- /* GDB never (currently) generates any of these ops. */
- case gdb_agent_op_float:
- case gdb_agent_op_ref_float:
- case gdb_agent_op_ref_double:
- case gdb_agent_op_ref_long_double:
- case gdb_agent_op_l_to_d:
- case gdb_agent_op_d_to_l:
- case gdb_agent_op_trace16:
- ax_debug ("Agent expression op 0x%x valid, but not handled",
- op);
- /* If ever GDB generates any of these, we don't have the
+ if (format[slen - 1] != '\0')
+ error (_ ("Unterminated format string in printf bytecode"));
+
+ ax_printf (fn, chan, format, nargs, args);
+ }
+ break;
+
+ /* GDB never (currently) generates any of these ops. */
+ case gdb_agent_op_float:
+ case gdb_agent_op_ref_float:
+ case gdb_agent_op_ref_double:
+ case gdb_agent_op_ref_long_double:
+ case gdb_agent_op_l_to_d:
+ case gdb_agent_op_d_to_l:
+ case gdb_agent_op_trace16:
+ ax_debug ("Agent expression op 0x%x valid, but not handled", op);
+ /* If ever GDB generates any of these, we don't have the
option of ignoring. */
- return expr_eval_unhandled_opcode;
+ return expr_eval_unhandled_opcode;
- default:
- ax_debug ("Agent expression op 0x%x not recognized", op);
- /* Don't struggle on, things will just get worse. */
- return expr_eval_unrecognized_opcode;
- }
+ default:
+ ax_debug ("Agent expression op 0x%x not recognized", op);
+ /* Don't struggle on, things will just get worse. */
+ return expr_eval_unrecognized_opcode;
+ }
/* Check for stack badness. */
if (sp >= (STACK_MAX - 1))
- {
- ax_debug ("Expression stack overflow");
- return expr_eval_stack_overflow;
- }
+ {
+ ax_debug ("Expression stack overflow");
+ return expr_eval_stack_overflow;
+ }
if (sp < 0)
- {
- ax_debug ("Expression stack underflow");
- return expr_eval_stack_underflow;
- }
+ {
+ ax_debug ("Expression stack underflow");
+ return expr_eval_stack_underflow;
+ }
- ax_debug ("Op %s -> sp=%d, top=0x%s",
- gdb_agent_op_name (op), sp, phex_nz (top, 0));
+ ax_debug ("Op %s -> sp=%d, top=0x%s", gdb_agent_op_name (op), sp,
+ phex_nz (top, 0));
}
}
diff --git a/gdbserver/ax.h b/gdbserver/ax.h
index 8e64a7a593e..0fb09b24b38 100644
--- a/gdbserver/ax.h
+++ b/gdbserver/ax.h
@@ -32,17 +32,17 @@ struct traceframe;
agent expression evaluation. */
enum eval_result_type
- {
- expr_eval_no_error,
- expr_eval_empty_expression,
- expr_eval_empty_stack,
- expr_eval_stack_overflow,
- expr_eval_stack_underflow,
- expr_eval_unhandled_opcode,
- expr_eval_unrecognized_opcode,
- expr_eval_divide_by_zero,
- expr_eval_invalid_goto
- };
+{
+ expr_eval_no_error,
+ expr_eval_empty_expression,
+ expr_eval_empty_stack,
+ expr_eval_stack_overflow,
+ expr_eval_stack_underflow,
+ expr_eval_unhandled_opcode,
+ expr_eval_unrecognized_opcode,
+ expr_eval_divide_by_zero,
+ expr_eval_invalid_goto
+};
struct agent_expr
{
@@ -81,10 +81,9 @@ struct eval_agent_expr_context
struct tracepoint *tpoint;
};
-enum eval_result_type
- gdb_eval_agent_expr (struct eval_agent_expr_context *ctx,
- struct agent_expr *aexpr,
- ULONGEST *rslt);
+enum eval_result_type gdb_eval_agent_expr (struct eval_agent_expr_context *ctx,
+ struct agent_expr *aexpr,
+ ULONGEST *rslt);
/* Bytecode compilation function vector. */
diff --git a/gdbserver/debug.cc b/gdbserver/debug.cc
index 2426c91f80f..28cdb7843ca 100644
--- a/gdbserver/debug.cc
+++ b/gdbserver/debug.cc
@@ -19,7 +19,7 @@
#include "server.h"
#include <chrono>
-#if !defined (IN_PROCESS_AGENT)
+#if !defined(IN_PROCESS_AGENT)
bool remote_debug = false;
#endif
@@ -32,7 +32,7 @@ bool debug_threads;
/* Include timestamps in debugging output. */
int debug_timestamp;
-#if !defined (IN_PROCESS_AGENT)
+#if !defined(IN_PROCESS_AGENT)
/* See debug.h. */
@@ -55,7 +55,7 @@ debug_set_output (const char *new_debug_file)
if (fptr == nullptr)
{
debug_printf ("Cannot open %s for writing. %s. Switching to stderr.\n",
- new_debug_file, safe_strerror (errno));
+ new_debug_file, safe_strerror (errno));
return;
}
@@ -76,7 +76,7 @@ int debug_print_depth = 0;
void
debug_vprintf (const char *format, va_list ap)
{
-#if !defined (IN_PROCESS_AGENT)
+#if !defined(IN_PROCESS_AGENT)
/* N.B. Not thread safe, and can't be used, as is, with IPA. */
static int new_line = 1;
@@ -86,15 +86,17 @@ debug_vprintf (const char *format, va_list ap)
steady_clock::time_point now = steady_clock::now ();
seconds s = duration_cast<seconds> (now.time_since_epoch ());
- microseconds us = duration_cast<microseconds> (now.time_since_epoch ()) - s;
+ microseconds us
+ = duration_cast<microseconds> (now.time_since_epoch ()) - s;
- fprintf (debug_file, "%ld.%06ld ", (long) s.count (), (long) us.count ());
+ fprintf (debug_file, "%ld.%06ld ", (long) s.count (),
+ (long) us.count ());
}
#endif
vfprintf (debug_file, format, ap);
-#if !defined (IN_PROCESS_AGENT)
+#if !defined(IN_PROCESS_AGENT)
if (*format)
new_line = format[strlen (format) - 1] == '\n';
#endif
diff --git a/gdbserver/debug.h b/gdbserver/debug.h
index 6b733ef341f..89250520d01 100644
--- a/gdbserver/debug.h
+++ b/gdbserver/debug.h
@@ -19,14 +19,13 @@
#ifndef GDBSERVER_DEBUG_H
#define GDBSERVER_DEBUG_H
-#if !defined (IN_PROCESS_AGENT)
+#if !defined(IN_PROCESS_AGENT)
extern bool remote_debug;
/* Print a "remote" debug statement. */
#define remote_debug_printf(fmt, ...) \
- debug_prefixed_printf_cond (remote_debug, \
- "remote", fmt, ##__VA_ARGS__)
+ debug_prefixed_printf_cond (remote_debug, "remote", fmt, ##__VA_ARGS__)
/* Switch all debug output to DEBUG_FILE. If DEBUG_FILE is nullptr or an
empty string, or if the file cannot be opened, then debug output is sent to
@@ -44,8 +43,7 @@ extern bool debug_threads;
/* Print a "threads" debug statement. */
#define threads_debug_printf(fmt, ...) \
- debug_prefixed_printf_cond (debug_threads, \
- "threads", fmt, ##__VA_ARGS__)
+ debug_prefixed_printf_cond (debug_threads, "threads", fmt, ##__VA_ARGS__)
/* Print "threads" enter/exit debug statements. */
diff --git a/gdbserver/dll.cc b/gdbserver/dll.cc
index 15d0c5d5d05..205baca1b8f 100644
--- a/gdbserver/dll.cc
+++ b/gdbserver/dll.cc
@@ -57,20 +57,18 @@ void
unloaded_dll (process_info *proc, const char *name, CORE_ADDR base_addr)
{
gdb_assert (proc != nullptr);
- auto pred = [&] (const dll_info &dll)
- {
- if (base_addr != UNSPECIFIED_CORE_ADDR
- && base_addr == dll.base_addr)
- return true;
+ auto pred = [&] (const dll_info &dll) {
+ if (base_addr != UNSPECIFIED_CORE_ADDR && base_addr == dll.base_addr)
+ return true;
- if (name != NULL && dll.name == name)
- return true;
+ if (name != NULL && dll.name == name)
+ return true;
- return false;
- };
+ return false;
+ };
- auto iter = std::find_if (proc->all_dlls.begin (), proc->all_dlls.end (),
- pred);
+ auto iter
+ = std::find_if (proc->all_dlls.begin (), proc->all_dlls.end (), pred);
if (iter == proc->all_dlls.end ())
/* For some inferiors we might get unloaded_dll events without having
@@ -94,8 +92,5 @@ unloaded_dll (process_info *proc, const char *name, CORE_ADDR base_addr)
void
clear_dlls (void)
{
- for_each_process ([] (process_info *proc)
- {
- proc->all_dlls.clear ();
- });
+ for_each_process ([] (process_info *proc) { proc->all_dlls.clear (); });
}
diff --git a/gdbserver/dll.h b/gdbserver/dll.h
index a5bb2a07125..df9610f6247 100644
--- a/gdbserver/dll.h
+++ b/gdbserver/dll.h
@@ -25,8 +25,10 @@ struct process_info;
struct dll_info
{
dll_info (const std::string &name_, CORE_ADDR base_addr_)
- : name (name_), base_addr (base_addr_)
- {}
+ : name (name_),
+ base_addr (base_addr_)
+ {
+ }
std::string name;
CORE_ADDR base_addr;
@@ -35,9 +37,9 @@ struct dll_info
extern void clear_dlls (void);
extern void loaded_dll (const char *name, CORE_ADDR base_addr);
extern void loaded_dll (process_info *proc, const char *name,
- CORE_ADDR base_addr);
+ CORE_ADDR base_addr);
extern void unloaded_dll (const char *name, CORE_ADDR base_addr);
extern void unloaded_dll (process_info *proc, const char *name,
- CORE_ADDR base_addr);
+ CORE_ADDR base_addr);
#endif /* GDBSERVER_DLL_H */
diff --git a/gdbserver/fork-child.cc b/gdbserver/fork-child.cc
index e791a8d22f7..ef4c16d793e 100644
--- a/gdbserver/fork-child.cc
+++ b/gdbserver/fork-child.cc
@@ -77,7 +77,7 @@ postfork_child_hook ()
debug_setpgrp = gdb_setpgid ();
if (debug_setpgrp == -1)
- perror (_("setpgrp failed in child"));
+ perror (_ ("setpgrp failed in child"));
}
/* See nat/fork-inferior.h. */
@@ -113,9 +113,8 @@ post_fork_inferior (int pid, const char *program)
scoped_restore. */
proc->starting_up = true;
- startup_inferior (the_target, pid,
- START_INFERIOR_TRAPS_EXPECTED,
- &cs.last_status, &cs.last_ptid);
+ startup_inferior (the_target, pid, START_INFERIOR_TRAPS_EXPECTED,
+ &cs.last_status, &cs.last_ptid);
/* If we get here, the process was successfully started. */
proc->starting_up = false;
diff --git a/gdbserver/gdbreplay.cc b/gdbserver/gdbreplay.cc
index 42a512a8581..cf6af57a0ce 100644
--- a/gdbserver/gdbreplay.cc
+++ b/gdbserver/gdbreplay.cc
@@ -74,7 +74,7 @@ sync_error (FILE *fp, const char *desc, int expect, int got)
{
fprintf (stderr, "\n%s\n", desc);
fprintf (stderr, "At logfile offset %ld, expected '0x%x' got '0x%x'\n",
- ftell (fp), expect, got);
+ ftell (fp), expect, got);
fflush (stderr);
exit (1);
}
@@ -142,7 +142,7 @@ remote_open (const char *name)
parsed_connection_spec parsed = parse_connection_spec (name, &hint);
if (parsed.port_str.empty ())
- error (_("Missing port on hostname '%s'"), name);
+ error (_ ("Missing port on hostname '%s'"), name);
#ifdef USE_WIN32API
if (!winsock_initialized)
@@ -155,13 +155,13 @@ remote_open (const char *name)
#endif
int r = getaddrinfo (parsed.host_str.c_str (), parsed.port_str.c_str (),
- &hint, &ainfo);
+ &hint, &ainfo);
if (r != 0)
{
fprintf (stderr, "%s:%s: cannot resolve name: %s\n",
- parsed.host_str.c_str (), parsed.port_str.c_str (),
- gai_strerror (r));
+ parsed.host_str.c_str (), parsed.port_str.c_str (),
+ gai_strerror (r));
fflush (stderr);
exit (1);
}
@@ -175,7 +175,7 @@ remote_open (const char *name)
tmp_desc = socket (p->ai_family, p->ai_socktype, p->ai_protocol);
if (tmp_desc >= 0)
- break;
+ break;
}
if (p == NULL)
@@ -183,8 +183,7 @@ remote_open (const char *name)
/* Allow rapid reuse of this port. */
tmp = 1;
- setsockopt (tmp_desc, SOL_SOCKET, SO_REUSEADDR, (char *) &tmp,
- sizeof (tmp));
+ setsockopt (tmp_desc, SOL_SOCKET, SO_REUSEADDR, (char *) &tmp, sizeof (tmp));
switch (p->ai_family)
{
@@ -211,47 +210,47 @@ remote_open (const char *name)
char orig_host[GDB_NI_MAX_ADDR], orig_port[GDB_NI_MAX_PORT];
if (listen (tmp_desc, 1) != 0)
- perror_with_name ("Can't listen on socket");
+ perror_with_name ("Can't listen on socket");
- remote_desc_in = accept (tmp_desc, (struct sockaddr *) &sockaddr,
- &sockaddrsize);
+ remote_desc_in
+ = accept (tmp_desc, (struct sockaddr *) &sockaddr, &sockaddrsize);
if (remote_desc_in == -1)
- perror_with_name ("Accept failed");
+ perror_with_name ("Accept failed");
/* Enable TCP keep alive process. */
tmp = 1;
- setsockopt (tmp_desc, SOL_SOCKET, SO_KEEPALIVE,
- (char *) &tmp, sizeof (tmp));
+ setsockopt (tmp_desc, SOL_SOCKET, SO_KEEPALIVE, (char *) &tmp,
+ sizeof (tmp));
/* Tell TCP not to delay small packets. This greatly speeds up
interactive response. */
tmp = 1;
- setsockopt (remote_desc_in, IPPROTO_TCP, TCP_NODELAY,
- (char *) &tmp, sizeof (tmp));
-
- if (getnameinfo ((struct sockaddr *) &sockaddr, sockaddrsize,
- orig_host, sizeof (orig_host),
- orig_port, sizeof (orig_port),
- NI_NUMERICHOST | NI_NUMERICSERV) == 0)
- {
- fprintf (stderr, "Remote debugging from host %s, port %s\n",
- orig_host, orig_port);
- fflush (stderr);
- }
+ setsockopt (remote_desc_in, IPPROTO_TCP, TCP_NODELAY, (char *) &tmp,
+ sizeof (tmp));
+
+ if (getnameinfo ((struct sockaddr *) &sockaddr, sockaddrsize, orig_host,
+ sizeof (orig_host), orig_port, sizeof (orig_port),
+ NI_NUMERICHOST | NI_NUMERICSERV)
+ == 0)
+ {
+ fprintf (stderr, "Remote debugging from host %s, port %s\n",
+ orig_host, orig_port);
+ fflush (stderr);
+ }
#ifndef USE_WIN32API
- close (tmp_desc); /* No longer need this */
+ close (tmp_desc); /* No longer need this */
- signal (SIGPIPE, SIG_IGN); /* If we don't do this, then
+ signal (SIGPIPE, SIG_IGN); /* If we don't do this, then
gdbreplay simply exits when
the remote side dies. */
#else
- closesocket (tmp_desc); /* No longer need this */
+ closesocket (tmp_desc); /* No longer need this */
#endif
}
-#if defined(F_SETFL) && defined (FASYNC)
+#if defined(F_SETFL) && defined(FASYNC)
fcntl (remote_desc_in, F_SETFL, FASYNC);
#endif
remote_desc_out = remote_desc_in;
@@ -278,12 +277,12 @@ logchar (FILE *fp)
case '\r':
ch = fgetc (fp);
if (ch == '\n')
- ch = EOL;
+ ch = EOL;
else
- {
- ungetc (ch, fp);
- ch = '\r';
- }
+ {
+ ungetc (ch, fp);
+ ch = '\r';
+ }
fputc (ch == EOL ? '\n' : '\r', stderr);
fflush (stderr);
break;
@@ -295,41 +294,41 @@ logchar (FILE *fp)
fputc (ch, stderr);
fflush (stderr);
switch (ch)
- {
- case '\\':
- break;
- case 'b':
- ch = '\b';
- break;
- case 'f':
- ch = '\f';
- break;
- case 'n':
- ch = '\n';
- break;
- case 'r':
- ch = '\r';
- break;
- case 't':
- ch = '\t';
- break;
- case 'v':
- ch = '\v';
- break;
- case 'x':
- ch2 = fgetc (fp);
- fputc (ch2, stderr);
- fflush (stderr);
- ch = fromhex (ch2) << 4;
- ch2 = fgetc (fp);
- fputc (ch2, stderr);
- fflush (stderr);
- ch |= fromhex (ch2);
- break;
- default:
- /* Treat any other char as just itself */
- break;
- }
+ {
+ case '\\':
+ break;
+ case 'b':
+ ch = '\b';
+ break;
+ case 'f':
+ ch = '\f';
+ break;
+ case 'n':
+ ch = '\n';
+ break;
+ case 'r':
+ ch = '\r';
+ break;
+ case 't':
+ ch = '\t';
+ break;
+ case 'v':
+ ch = '\v';
+ break;
+ case 'x':
+ ch2 = fgetc (fp);
+ fputc (ch2, stderr);
+ fflush (stderr);
+ ch = fromhex (ch2) << 4;
+ ch2 = fgetc (fp);
+ fputc (ch2, stderr);
+ fflush (stderr);
+ ch |= fromhex (ch2);
+ break;
+ default:
+ /* Treat any other char as just itself */
+ break;
+ }
default:
break;
}
@@ -359,23 +358,23 @@ expect (FILE *fp)
if ((fromlog = logchar (fp)) != ' ')
{
sync_error (fp, "Sync error during gdb read of leading blank", ' ',
- fromlog);
+ fromlog);
}
do
{
fromlog = logchar (fp);
if (fromlog == EOL)
- break;
+ break;
fromgdb = gdbchar (remote_desc_in);
if (fromgdb < 0)
- remote_error ("Error during read from gdb");
+ remote_error ("Error during read from gdb");
}
while (fromlog == fromgdb);
if (fromlog != EOL)
{
sync_error (fp, "Sync error during read of gdb packet from log", fromlog,
- fromgdb);
+ fromgdb);
}
}
@@ -391,13 +390,13 @@ play (FILE *fp)
if ((fromlog = logchar (fp)) != ' ')
{
sync_error (fp, "Sync error skipping blank during write to gdb", ' ',
- fromlog);
+ fromlog);
}
while ((fromlog = logchar (fp)) != EOL)
{
ch = fromlog;
if (write (remote_desc_out, &ch, 1) != 1)
- remote_error ("Error during write to gdb");
+ remote_error ("Error during write to gdb");
}
}
@@ -405,11 +404,11 @@ static void
gdbreplay_version (void)
{
printf ("GNU gdbreplay %s%s\n"
- "Copyright (C) 2023 Free Software Foundation, Inc.\n"
- "gdbreplay is free software, covered by "
- "the GNU General Public License.\n"
- "This gdbreplay was configured as \"%s\"\n",
- PKGVERSION, version, host_name);
+ "Copyright (C) 2023 Free Software Foundation, Inc.\n"
+ "gdbreplay is free software, covered by "
+ "the GNU General Public License.\n"
+ "This gdbreplay was configured as \"%s\"\n",
+ PKGVERSION, version, host_name);
}
static void
@@ -454,20 +453,21 @@ captured_main (int argc, char *argv[])
while ((ch = logchar (fp)) != EOF)
{
switch (ch)
- {
- case 'w':
- /* data sent from gdb to gdbreplay, accept and match it */
- expect (fp);
- break;
- case 'r':
- /* data sent from gdbreplay to gdb, play it */
- play (fp);
- break;
- case 'c':
- /* Command executed by gdb */
- while ((ch = logchar (fp)) != EOL);
- break;
- }
+ {
+ case 'w':
+ /* data sent from gdb to gdbreplay, accept and match it */
+ expect (fp);
+ break;
+ case 'r':
+ /* data sent from gdbreplay to gdb, play it */
+ play (fp);
+ break;
+ case 'c':
+ /* Command executed by gdb */
+ while ((ch = logchar (fp)) != EOL)
+ ;
+ break;
+ }
}
remote_close ();
exit (0);
@@ -483,10 +483,10 @@ main (int argc, char *argv[])
catch (const gdb_exception &exception)
{
if (exception.reason == RETURN_ERROR)
- {
- fflush (stdout);
- fprintf (stderr, "%s\n", exception.what ());
- }
+ {
+ fflush (stdout);
+ fprintf (stderr, "%s\n", exception.what ());
+ }
exit (1);
}
diff --git a/gdbserver/gdbthread.h b/gdbserver/gdbthread.h
index 493e1dbf6cb..4d8b200217c 100644
--- a/gdbserver/gdbthread.h
+++ b/gdbserver/gdbthread.h
@@ -30,14 +30,13 @@ struct regcache;
struct thread_info
{
thread_info (ptid_t id, void *target_data)
- : id (id), target_data (target_data)
- {}
-
- ~thread_info ()
+ : id (id),
+ target_data (target_data)
{
- free_register_cache (this->regcache_data);
}
+ ~thread_info () { free_register_cache (this->regcache_data); }
+
/* The id of this thread. */
ptid_t id;
@@ -100,7 +99,7 @@ struct thread_info *find_any_thread_of_pid (int pid);
/* Find the first thread for which FUNC returns true. Return NULL if no thread
satisfying FUNC is found. */
-template <typename Func>
+template<typename Func>
static thread_info *
find_thread (Func func)
{
@@ -112,7 +111,7 @@ find_thread (Func func)
next++;
if (func (*cur))
- return *cur;
+ return *cur;
cur = next;
}
@@ -122,20 +121,19 @@ find_thread (Func func)
/* Like the above, but only consider threads with pid PID. */
-template <typename Func>
+template<typename Func>
static thread_info *
find_thread (int pid, Func func)
{
- return find_thread ([&] (thread_info *thread)
- {
- return thread->id.pid () == pid && func (thread);
- });
+ return find_thread ([&] (thread_info *thread) {
+ return thread->id.pid () == pid && func (thread);
+ });
}
/* Find the first thread that matches FILTER for which FUNC returns true.
Return NULL if no thread satisfying these conditions is found. */
-template <typename Func>
+template<typename Func>
static thread_info *
find_thread (ptid_t filter, Func func)
{
@@ -146,7 +144,7 @@ find_thread (ptid_t filter, Func func)
/* Invoke FUNC for each thread. */
-template <typename Func>
+template<typename Func>
static void
for_each_thread (Func func)
{
@@ -163,21 +161,20 @@ for_each_thread (Func func)
/* Like the above, but only consider threads with pid PID. */
-template <typename Func>
+template<typename Func>
static void
for_each_thread (int pid, Func func)
{
- for_each_thread ([&] (thread_info *thread)
- {
- if (pid == thread->id.pid ())
- func (thread);
- });
+ for_each_thread ([&] (thread_info *thread) {
+ if (pid == thread->id.pid ())
+ func (thread);
+ });
}
/* Find the a random thread for which FUNC (THREAD) returns true. If
no entry is found then return NULL. */
-template <typename Func>
+template<typename Func>
static thread_info *
find_thread_in_random (Func func)
{
@@ -194,8 +191,7 @@ find_thread_in_random (Func func)
return NULL;
/* Now randomly pick an entry out of those. */
- random_selector = (int)
- ((count * (double) rand ()) / (RAND_MAX + 1.0));
+ random_selector = (int) ((count * (double) rand ()) / (RAND_MAX + 1.0));
thread_info *thread = find_thread ([&] (thread_info *thr_arg) {
return func (thr_arg) && (random_selector-- == 0);
diff --git a/gdbserver/hostio.cc b/gdbserver/hostio.cc
index ea70c26da0f..50aa185d877 100644
--- a/gdbserver/hostio.cc
+++ b/gdbserver/hostio.cc
@@ -54,10 +54,10 @@ safe_fromhex (char a, int *nibble)
/* Filenames are hex encoded, so the maximum we can handle is half the
packet buffer size. Cap to PATH_MAX, if it is shorter. */
-#if !defined (PATH_MAX) || (PATH_MAX > (PBUFSIZ / 2 + 1))
-# define HOSTIO_PATH_MAX (PBUFSIZ / 2 + 1)
+#if !defined(PATH_MAX) || (PATH_MAX > (PBUFSIZ / 2 + 1))
+#define HOSTIO_PATH_MAX (PBUFSIZ / 2 + 1)
#else
-# define HOSTIO_PATH_MAX PATH_MAX
+#define HOSTIO_PATH_MAX PATH_MAX
#endif
static int
@@ -75,11 +75,10 @@ require_filename (char **pp, char *filename)
/* Don't allow overflow. */
if (count >= HOSTIO_PATH_MAX - 1)
- return -1;
+ return -1;
- if (safe_fromhex (p[0], &nib1)
- || safe_fromhex (p[1], &nib2))
- return -1;
+ if (safe_fromhex (p[0], &nib1) || safe_fromhex (p[1], &nib2))
+ return -1;
filename[count++] = nib1 * 16 + nib2;
p += 2;
@@ -106,14 +105,14 @@ require_int (char **pp, int *value)
int nib;
if (safe_fromhex (p[0], &nib))
- return -1;
+ return -1;
if (firstdigit == -1)
- firstdigit = nib;
+ firstdigit = nib;
/* Don't allow overflow. */
if (count >= 8 || (count == 7 && firstdigit >= 0x8))
- return -1;
+ return -1;
*value = *value * 16 + nib;
p++;
@@ -138,14 +137,14 @@ require_data (char *p, int p_len, char **data, int *data_len)
char b = p[input_index];
if (escaped)
- {
- (*data)[output_index++] = b ^ 0x20;
- escaped = 0;
- }
+ {
+ (*data)[output_index++] = b ^ 0x20;
+ escaped = 0;
+ }
else if (b == '}')
- escaped = 1;
+ escaped = 1;
else
- (*data)[output_index++] = b;
+ (*data)[output_index++] = b;
}
if (escaped)
@@ -215,7 +214,7 @@ hostio_reply (char *own_buf, int result)
static int
hostio_reply_with_data (char *own_buf, char *buffer, int len,
- int *new_packet_len)
+ int *new_packet_len)
{
int input_index, output_index, out_maxlen;
@@ -229,19 +228,19 @@ hostio_reply_with_data (char *own_buf, char *buffer, int len,
char b = buffer[input_index];
if (b == '$' || b == '#' || b == '}' || b == '*')
- {
- /* These must be escaped. */
- if (output_index + 2 > out_maxlen)
- break;
- own_buf[output_index++] = '}';
- own_buf[output_index++] = b ^ 0x20;
- }
+ {
+ /* These must be escaped. */
+ if (output_index + 2 > out_maxlen)
+ break;
+ own_buf[output_index++] = '}';
+ own_buf[output_index++] = b ^ 0x20;
+ }
else
- {
- if (output_index + 1 > out_maxlen)
- break;
- own_buf[output_index++] = b;
- }
+ {
+ if (output_index + 1 > out_maxlen)
+ break;
+ own_buf[output_index++] = b;
+ }
}
*new_packet_len = output_index;
@@ -282,9 +281,7 @@ handle_setfs (char *own_buf)
p = own_buf + strlen ("vFile:setfs:");
- if (require_int (&p, &pid)
- || pid < 0
- || require_end (p))
+ if (require_int (&p, &pid) || pid < 0 || require_end (p))
{
hostio_packet_error (own_buf);
return;
@@ -306,12 +303,9 @@ handle_open (char *own_buf)
p = own_buf + strlen ("vFile:open:");
- if (require_filename (&p, filename)
- || require_comma (&p)
- || require_int (&p, &fileio_flags)
- || require_comma (&p)
- || require_int (&p, &fileio_mode)
- || require_end (p)
+ if (require_filename (&p, filename) || require_comma (&p)
+ || require_int (&p, &fileio_flags) || require_comma (&p)
+ || require_int (&p, &fileio_mode) || require_end (p)
|| fileio_to_host_openflags (fileio_flags, &flags)
|| fileio_to_host_mode (fileio_mode, &mode))
{
@@ -350,13 +344,9 @@ handle_pread (char *own_buf, int *new_packet_len)
p = own_buf + strlen ("vFile:pread:");
- if (require_int (&p, &fd)
- || require_comma (&p)
- || require_valid_fd (fd)
- || require_int (&p, &len)
- || require_comma (&p)
- || require_int (&p, &offset)
- || require_end (p))
+ if (require_int (&p, &fd) || require_comma (&p) || require_valid_fd (fd)
+ || require_int (&p, &len) || require_comma (&p)
+ || require_int (&p, &offset) || require_end (p))
{
hostio_packet_error (own_buf);
return;
@@ -384,7 +374,7 @@ handle_pread (char *own_buf, int *new_packet_len)
{
ret = lseek (fd, offset, SEEK_SET);
if (ret != -1)
- ret = read (fd, data, len);
+ ret = read (fd, data, len);
}
if (ret == -1)
@@ -402,8 +392,8 @@ handle_pread (char *own_buf, int *new_packet_len)
packet might be wrong, so we must fix it. This time it will
definitely fit. */
if (bytes_sent < ret)
- bytes_sent = hostio_reply_with_data (own_buf, data, bytes_sent,
- new_packet_len);
+ bytes_sent
+ = hostio_reply_with_data (own_buf, data, bytes_sent, new_packet_len);
free (data);
}
@@ -416,11 +406,8 @@ handle_pwrite (char *own_buf, int packet_len)
p = own_buf + strlen ("vFile:pwrite:");
- if (require_int (&p, &fd)
- || require_comma (&p)
- || require_valid_fd (fd)
- || require_int (&p, &offset)
- || require_comma (&p)
+ if (require_int (&p, &fd) || require_comma (&p) || require_valid_fd (fd)
+ || require_int (&p, &offset) || require_comma (&p)
|| require_data (p, packet_len - (p - own_buf), &data, &len))
{
hostio_packet_error (own_buf);
@@ -437,7 +424,7 @@ handle_pwrite (char *own_buf, int packet_len)
{
ret = lseek (fd, offset, SEEK_SET);
if (ret != -1)
- ret = write (fd, data, len);
+ ret = write (fd, data, len);
}
if (ret == -1)
@@ -461,9 +448,7 @@ handle_fstat (char *own_buf, int *new_packet_len)
p = own_buf + strlen ("vFile:fstat:");
- if (require_int (&p, &fd)
- || require_valid_fd (fd)
- || require_end (p))
+ if (require_int (&p, &fd) || require_valid_fd (fd) || require_end (p))
{
hostio_packet_error (own_buf);
return;
@@ -477,9 +462,8 @@ handle_fstat (char *own_buf, int *new_packet_len)
host_to_fileio_stat (&st, &fst);
- bytes_sent = hostio_reply_with_data (own_buf,
- (char *) &fst, sizeof (fst),
- new_packet_len);
+ bytes_sent = hostio_reply_with_data (own_buf, (char *) &fst, sizeof (fst),
+ new_packet_len);
/* If the response does not fit into a single packet, do not attempt
to return a partial response, but simply fail. */
@@ -496,9 +480,7 @@ handle_close (char *own_buf)
p = own_buf + strlen ("vFile:close:");
- if (require_int (&p, &fd)
- || require_valid_fd (fd)
- || require_end (p))
+ if (require_int (&p, &fd) || require_valid_fd (fd) || require_end (p))
{
hostio_packet_error (own_buf);
return;
@@ -533,8 +515,7 @@ handle_unlink (char *own_buf)
p = own_buf + strlen ("vFile:unlink:");
- if (require_filename (&p, filename)
- || require_end (p))
+ if (require_filename (&p, filename) || require_end (p))
{
hostio_packet_error (own_buf);
return;
@@ -563,17 +544,15 @@ handle_readlink (char *own_buf, int *new_packet_len)
p = own_buf + strlen ("vFile:readlink:");
- if (require_filename (&p, filename)
- || require_end (p))
+ if (require_filename (&p, filename) || require_end (p))
{
hostio_packet_error (own_buf);
return;
}
if (hostio_fs_pid != 0)
- ret = the_target->multifs_readlink (hostio_fs_pid, filename,
- linkname,
- sizeof (linkname) - 1);
+ ret = the_target->multifs_readlink (hostio_fs_pid, filename, linkname,
+ sizeof (linkname) - 1);
else
ret = readlink (filename, linkname, sizeof (linkname) - 1);
diff --git a/gdbserver/i387-fp.cc b/gdbserver/i387-fp.cc
index 12cb614e5d8..c578f324c4e 100644
--- a/gdbserver/i387-fp.cc
+++ b/gdbserver/i387-fp.cc
@@ -31,7 +31,8 @@ static const int num_pkeys_registers = 1;
/* These structs should have the proper sizes and alignment on both
i386 and x86-64 machines. */
-struct i387_fsave {
+struct i387_fsave
+{
/* All these are only sixteen bits, plus padding, except for fop (which
is only eleven bits), and fooff / fioff (which are 32 bits each). */
unsigned short fctrl;
@@ -51,7 +52,8 @@ struct i387_fsave {
unsigned char st_space[80];
};
-struct i387_fxsave {
+struct i387_fxsave
+{
/* All these are only sixteen bits, plus padding, except for fop (which
is only eleven bits), and fooff / fioff (which are 32 bits each). */
unsigned short fctrl;
@@ -75,7 +77,8 @@ struct i387_fxsave {
unsigned char xmm_space[256];
};
-struct i387_xsave {
+struct i387_xsave
+{
/* All these are only sixteen bits, plus padding, except for fop (which
is only eleven bits), and fooff / fioff (which are 32 bits each). */
unsigned short fctrl;
@@ -149,7 +152,7 @@ i387_cache_to_fsave (struct regcache *regcache, void *buf)
for (i = 0; i < 8; i++)
collect_register (regcache, i + st0_regnum,
- ((char *) &fp->st_space[0]) + i * 10);
+ ((char *) &fp->st_space[0]) + i * 10);
fp->fioff = regcache_raw_get_unsigned_by_name (regcache, "fioff");
fp->fooff = regcache_raw_get_unsigned_by_name (regcache, "fooff");
@@ -176,7 +179,7 @@ i387_fsave_to_cache (struct regcache *regcache, const void *buf)
for (i = 0; i < 8; i++)
supply_register (regcache, i + st0_regnum,
- ((char *) &fp->st_space[0]) + i * 10);
+ ((char *) &fp->st_space[0]) + i * 10);
supply_register_by_name (regcache, "fioff", &fp->fioff);
supply_register_by_name (regcache, "fooff", &fp->fooff);
@@ -215,10 +218,10 @@ i387_cache_to_fxsave (struct regcache *regcache, void *buf)
for (i = 0; i < 8; i++)
collect_register (regcache, i + st0_regnum,
- ((char *) &fp->st_space[0]) + i * 16);
+ ((char *) &fp->st_space[0]) + i * 16);
for (i = 0; i < num_xmm_registers; i++)
collect_register (regcache, i + xmm0_regnum,
- ((char *) &fp->xmm_space[0]) + i * 16);
+ ((char *) &fp->xmm_space[0]) + i * 16);
fp->fioff = regcache_raw_get_unsigned_by_name (regcache, "fioff");
fp->fooff = regcache_raw_get_unsigned_by_name (regcache, "fooff");
@@ -240,7 +243,7 @@ i387_cache_to_fxsave (struct regcache *regcache, void *buf)
int tag = (val >> (i * 2)) & 3;
if (tag != 3)
- val2 |= (1 << i);
+ val2 |= (1 << i);
}
fp->ftag = val2;
@@ -278,60 +281,60 @@ i387_cache_to_xsave (struct regcache *regcache, void *buf)
if (clear_bv)
{
if ((clear_bv & X86_XSTATE_X87))
- {
- for (i = 0; i < 8; i++)
- memset (((char *) &fp->st_space[0]) + i * 16, 0, 10);
-
- fp->fioff = 0;
- fp->fooff = 0;
- fp->fctrl = I387_FCTRL_INIT_VAL;
- fp->fstat = 0;
- fp->ftag = 0;
- fp->fiseg = 0;
- fp->foseg = 0;
- fp->fop = 0;
- }
+ {
+ for (i = 0; i < 8; i++)
+ memset (((char *) &fp->st_space[0]) + i * 16, 0, 10);
+
+ fp->fioff = 0;
+ fp->fooff = 0;
+ fp->fctrl = I387_FCTRL_INIT_VAL;
+ fp->fstat = 0;
+ fp->ftag = 0;
+ fp->fiseg = 0;
+ fp->foseg = 0;
+ fp->fop = 0;
+ }
if ((clear_bv & X86_XSTATE_SSE))
- for (i = 0; i < num_xmm_registers; i++)
- memset (((char *) &fp->xmm_space[0]) + i * 16, 0, 16);
+ for (i = 0; i < num_xmm_registers; i++)
+ memset (((char *) &fp->xmm_space[0]) + i * 16, 0, 16);
if ((clear_bv & X86_XSTATE_AVX))
- for (i = 0; i < num_xmm_registers; i++)
- memset (((char *) &fp->ymmh_space[0]) + i * 16, 0, 16);
+ for (i = 0; i < num_xmm_registers; i++)
+ memset (((char *) &fp->ymmh_space[0]) + i * 16, 0, 16);
if ((clear_bv & X86_XSTATE_SSE) && (clear_bv & X86_XSTATE_AVX))
- memset (((char *) &fp->mxcsr), 0, 4);
+ memset (((char *) &fp->mxcsr), 0, 4);
if ((clear_bv & X86_XSTATE_BNDREGS))
- for (i = 0; i < num_mpx_bnd_registers; i++)
- memset (((char *) &fp->mpx_bnd_space[0]) + i * 16, 0, 16);
+ for (i = 0; i < num_mpx_bnd_registers; i++)
+ memset (((char *) &fp->mpx_bnd_space[0]) + i * 16, 0, 16);
if ((clear_bv & X86_XSTATE_BNDCFG))
- for (i = 0; i < num_mpx_cfg_registers; i++)
- memset (((char *) &fp->mpx_cfg_space[0]) + i * 8, 0, 8);
+ for (i = 0; i < num_mpx_cfg_registers; i++)
+ memset (((char *) &fp->mpx_cfg_space[0]) + i * 8, 0, 8);
if ((clear_bv & X86_XSTATE_K))
- for (i = 0; i < num_avx512_k_registers; i++)
- memset (((char *) &fp->k_space[0]) + i * 8, 0, 8);
+ for (i = 0; i < num_avx512_k_registers; i++)
+ memset (((char *) &fp->k_space[0]) + i * 8, 0, 8);
if ((clear_bv & X86_XSTATE_ZMM_H))
- for (i = 0; i < num_avx512_zmmh_low_registers; i++)
- memset (((char *) &fp->zmmh_low_space[0]) + i * 32, 0, 32);
+ for (i = 0; i < num_avx512_zmmh_low_registers; i++)
+ memset (((char *) &fp->zmmh_low_space[0]) + i * 32, 0, 32);
if ((clear_bv & X86_XSTATE_ZMM))
- {
- for (i = 0; i < num_avx512_zmmh_high_registers; i++)
- memset (((char *) &fp->zmmh_low_space[0]) + 32 + i * 64, 0, 32);
- for (i = 0; i < num_avx512_xmm_registers; i++)
- memset (((char *) &fp->zmmh_high_space[0]) + i * 64, 0, 16);
- for (i = 0; i < num_avx512_ymmh_registers; i++)
- memset (((char *) &fp->zmmh_high_space[0]) + 16 + i * 64, 0, 16);
- }
+ {
+ for (i = 0; i < num_avx512_zmmh_high_registers; i++)
+ memset (((char *) &fp->zmmh_low_space[0]) + 32 + i * 64, 0, 32);
+ for (i = 0; i < num_avx512_xmm_registers; i++)
+ memset (((char *) &fp->zmmh_high_space[0]) + i * 64, 0, 16);
+ for (i = 0; i < num_avx512_ymmh_registers; i++)
+ memset (((char *) &fp->zmmh_high_space[0]) + 16 + i * 64, 0, 16);
+ }
if ((clear_bv & X86_XSTATE_PKRU))
- for (i = 0; i < num_pkeys_registers; i++)
- memset (((char *) &fp->pkru_space[0]) + i * 4, 0, 4);
+ for (i = 0; i < num_pkeys_registers; i++)
+ memset (((char *) &fp->pkru_space[0]) + i * 4, 0, 4);
}
/* Check if any x87 registers are changed. */
@@ -340,15 +343,15 @@ i387_cache_to_xsave (struct regcache *regcache, void *buf)
int st0_regnum = find_regno (regcache->tdesc, "st0");
for (i = 0; i < 8; i++)
- {
- collect_register (regcache, i + st0_regnum, raw);
- p = ((char *) &fp->st_space[0]) + i * 16;
- if (memcmp (raw, p, 10))
- {
- xstate_bv |= X86_XSTATE_X87;
- memcpy (p, raw, 10);
- }
- }
+ {
+ collect_register (regcache, i + st0_regnum, raw);
+ p = ((char *) &fp->st_space[0]) + i * 16;
+ if (memcmp (raw, p, 10))
+ {
+ xstate_bv |= X86_XSTATE_X87;
+ memcpy (p, raw, 10);
+ }
+ }
}
/* Check if any SSE registers are changed. */
@@ -356,16 +359,16 @@ i387_cache_to_xsave (struct regcache *regcache, void *buf)
{
int xmm0_regnum = find_regno (regcache->tdesc, "xmm0");
- for (i = 0; i < num_xmm_registers; i++)
- {
- collect_register (regcache, i + xmm0_regnum, raw);
- p = ((char *) &fp->xmm_space[0]) + i * 16;
- if (memcmp (raw, p, 16))
- {
- xstate_bv |= X86_XSTATE_SSE;
- memcpy (p, raw, 16);
- }
- }
+ for (i = 0; i < num_xmm_registers; i++)
+ {
+ collect_register (regcache, i + xmm0_regnum, raw);
+ p = ((char *) &fp->xmm_space[0]) + i * 16;
+ if (memcmp (raw, p, 16))
+ {
+ xstate_bv |= X86_XSTATE_SSE;
+ memcpy (p, raw, 16);
+ }
+ }
}
/* Check if any AVX registers are changed. */
@@ -373,33 +376,33 @@ i387_cache_to_xsave (struct regcache *regcache, void *buf)
{
int ymm0h_regnum = find_regno (regcache->tdesc, "ymm0h");
- for (i = 0; i < num_xmm_registers; i++)
- {
- collect_register (regcache, i + ymm0h_regnum, raw);
- p = ((char *) &fp->ymmh_space[0]) + i * 16;
- if (memcmp (raw, p, 16))
- {
- xstate_bv |= X86_XSTATE_AVX;
- memcpy (p, raw, 16);
- }
- }
+ for (i = 0; i < num_xmm_registers; i++)
+ {
+ collect_register (regcache, i + ymm0h_regnum, raw);
+ p = ((char *) &fp->ymmh_space[0]) + i * 16;
+ if (memcmp (raw, p, 16))
+ {
+ xstate_bv |= X86_XSTATE_AVX;
+ memcpy (p, raw, 16);
+ }
+ }
}
/* Check if any bound register has changed. */
if ((x86_xcr0 & X86_XSTATE_BNDREGS))
{
- int bnd0r_regnum = find_regno (regcache->tdesc, "bnd0raw");
+ int bnd0r_regnum = find_regno (regcache->tdesc, "bnd0raw");
for (i = 0; i < num_mpx_bnd_registers; i++)
- {
- collect_register (regcache, i + bnd0r_regnum, raw);
- p = ((char *) &fp->mpx_bnd_space[0]) + i * 16;
- if (memcmp (raw, p, 16))
- {
- xstate_bv |= X86_XSTATE_BNDREGS;
- memcpy (p, raw, 16);
- }
- }
+ {
+ collect_register (regcache, i + bnd0r_regnum, raw);
+ p = ((char *) &fp->mpx_bnd_space[0]) + i * 16;
+ if (memcmp (raw, p, 16))
+ {
+ xstate_bv |= X86_XSTATE_BNDREGS;
+ memcpy (p, raw, 16);
+ }
+ }
}
/* Check if any status register has changed. */
@@ -408,15 +411,15 @@ i387_cache_to_xsave (struct regcache *regcache, void *buf)
int bndcfg_regnum = find_regno (regcache->tdesc, "bndcfgu");
for (i = 0; i < num_mpx_cfg_registers; i++)
- {
- collect_register (regcache, i + bndcfg_regnum, raw);
- p = ((char *) &fp->mpx_cfg_space[0]) + i * 8;
- if (memcmp (raw, p, 8))
- {
- xstate_bv |= X86_XSTATE_BNDCFG;
- memcpy (p, raw, 8);
- }
- }
+ {
+ collect_register (regcache, i + bndcfg_regnum, raw);
+ p = ((char *) &fp->mpx_cfg_space[0]) + i * 8;
+ if (memcmp (raw, p, 8))
+ {
+ xstate_bv |= X86_XSTATE_BNDCFG;
+ memcpy (p, raw, 8);
+ }
+ }
}
/* Check if any K registers are changed. */
@@ -425,15 +428,15 @@ i387_cache_to_xsave (struct regcache *regcache, void *buf)
int k0_regnum = find_regno (regcache->tdesc, "k0");
for (i = 0; i < num_avx512_k_registers; i++)
- {
- collect_register (regcache, i + k0_regnum, raw);
- p = ((char *) &fp->k_space[0]) + i * 8;
- if (memcmp (raw, p, 8) != 0)
- {
- xstate_bv |= X86_XSTATE_K;
- memcpy (p, raw, 8);
- }
- }
+ {
+ collect_register (regcache, i + k0_regnum, raw);
+ p = ((char *) &fp->k_space[0]) + i * 8;
+ if (memcmp (raw, p, 8) != 0)
+ {
+ xstate_bv |= X86_XSTATE_K;
+ memcpy (p, raw, 8);
+ }
+ }
}
/* Check if any of ZMM0H-ZMM15H registers are changed. */
@@ -442,72 +445,72 @@ i387_cache_to_xsave (struct regcache *regcache, void *buf)
int zmm0h_regnum = find_regno (regcache->tdesc, "zmm0h");
for (i = 0; i < num_avx512_zmmh_low_registers; i++)
- {
- collect_register (regcache, i + zmm0h_regnum, raw);
- p = ((char *) &fp->zmmh_low_space[0]) + i * 32;
- if (memcmp (raw, p, 32) != 0)
- {
- xstate_bv |= X86_XSTATE_ZMM_H;
- memcpy (p, raw, 32);
- }
- }
+ {
+ collect_register (regcache, i + zmm0h_regnum, raw);
+ p = ((char *) &fp->zmmh_low_space[0]) + i * 32;
+ if (memcmp (raw, p, 32) != 0)
+ {
+ xstate_bv |= X86_XSTATE_ZMM_H;
+ memcpy (p, raw, 32);
+ }
+ }
}
/* Check if any of ZMM16H-ZMM31H registers are changed. */
if ((x86_xcr0 & X86_XSTATE_ZMM))
{
int zmm16h_regnum = (num_avx512_zmmh_high_registers == 0
- ? -1
- : find_regno (regcache->tdesc, "zmm16h"));
+ ? -1
+ : find_regno (regcache->tdesc, "zmm16h"));
for (i = 0; i < num_avx512_zmmh_high_registers; i++)
- {
- collect_register (regcache, i + zmm16h_regnum, raw);
- p = ((char *) &fp->zmmh_high_space[0]) + 32 + i * 64;
- if (memcmp (raw, p, 32) != 0)
- {
- xstate_bv |= X86_XSTATE_ZMM;
- memcpy (p, raw, 32);
- }
- }
+ {
+ collect_register (regcache, i + zmm16h_regnum, raw);
+ p = ((char *) &fp->zmmh_high_space[0]) + 32 + i * 64;
+ if (memcmp (raw, p, 32) != 0)
+ {
+ xstate_bv |= X86_XSTATE_ZMM;
+ memcpy (p, raw, 32);
+ }
+ }
}
/* Check if any XMM_AVX512 registers are changed. */
if ((x86_xcr0 & X86_XSTATE_ZMM))
{
int xmm_avx512_regnum = (num_avx512_xmm_registers == 0
- ? -1
- : find_regno (regcache->tdesc, "xmm16"));
+ ? -1
+ : find_regno (regcache->tdesc, "xmm16"));
for (i = 0; i < num_avx512_xmm_registers; i++)
- {
- collect_register (regcache, i + xmm_avx512_regnum, raw);
- p = ((char *) &fp->zmmh_high_space[0]) + i * 64;
- if (memcmp (raw, p, 16) != 0)
- {
- xstate_bv |= X86_XSTATE_ZMM;
- memcpy (p, raw, 16);
- }
- }
+ {
+ collect_register (regcache, i + xmm_avx512_regnum, raw);
+ p = ((char *) &fp->zmmh_high_space[0]) + i * 64;
+ if (memcmp (raw, p, 16) != 0)
+ {
+ xstate_bv |= X86_XSTATE_ZMM;
+ memcpy (p, raw, 16);
+ }
+ }
}
/* Check if any YMMH_AVX512 registers are changed. */
if ((x86_xcr0 & X86_XSTATE_ZMM))
{
int ymmh_avx512_regnum = (num_avx512_ymmh_registers == 0
- ? -1
- : find_regno (regcache->tdesc, "ymm16h"));
+ ? -1
+ : find_regno (regcache->tdesc, "ymm16h"));
for (i = 0; i < num_avx512_ymmh_registers; i++)
- {
- collect_register (regcache, i + ymmh_avx512_regnum, raw);
- p = ((char *) &fp->zmmh_high_space[0]) + 16 + i * 64;
- if (memcmp (raw, p, 16) != 0)
- {
- xstate_bv |= X86_XSTATE_ZMM;
- memcpy (p, raw, 16);
- }
- }
+ {
+ collect_register (regcache, i + ymmh_avx512_regnum, raw);
+ p = ((char *) &fp->zmmh_high_space[0]) + 16 + i * 64;
+ if (memcmp (raw, p, 16) != 0)
+ {
+ xstate_bv |= X86_XSTATE_ZMM;
+ memcpy (p, raw, 16);
+ }
+ }
}
/* Check if any PKEYS registers are changed. */
@@ -516,98 +519,98 @@ i387_cache_to_xsave (struct regcache *regcache, void *buf)
int pkru_regnum = find_regno (regcache->tdesc, "pkru");
for (i = 0; i < num_pkeys_registers; i++)
- {
- collect_register (regcache, i + pkru_regnum, raw);
- p = ((char *) &fp->pkru_space[0]) + i * 4;
- if (memcmp (raw, p, 4) != 0)
- {
- xstate_bv |= X86_XSTATE_PKRU;
- memcpy (p, raw, 4);
- }
- }
+ {
+ collect_register (regcache, i + pkru_regnum, raw);
+ p = ((char *) &fp->pkru_space[0]) + i * 4;
+ if (memcmp (raw, p, 4) != 0)
+ {
+ xstate_bv |= X86_XSTATE_PKRU;
+ memcpy (p, raw, 4);
+ }
+ }
}
if ((x86_xcr0 & X86_XSTATE_SSE) || (x86_xcr0 & X86_XSTATE_AVX))
{
collect_register_by_name (regcache, "mxcsr", raw);
if (memcmp (raw, &fp->mxcsr, 4) != 0)
- {
- if (((fp->xstate_bv | xstate_bv)
- & (X86_XSTATE_SSE | X86_XSTATE_AVX)) == 0)
- xstate_bv |= X86_XSTATE_SSE;
- memcpy (&fp->mxcsr, raw, 4);
- }
+ {
+ if (((fp->xstate_bv | xstate_bv) & (X86_XSTATE_SSE | X86_XSTATE_AVX))
+ == 0)
+ xstate_bv |= X86_XSTATE_SSE;
+ memcpy (&fp->mxcsr, raw, 4);
+ }
}
if (x86_xcr0 & X86_XSTATE_X87)
{
collect_register_by_name (regcache, "fioff", raw);
if (memcmp (raw, &fp->fioff, 4) != 0)
- {
- xstate_bv |= X86_XSTATE_X87;
- memcpy (&fp->fioff, raw, 4);
- }
+ {
+ xstate_bv |= X86_XSTATE_X87;
+ memcpy (&fp->fioff, raw, 4);
+ }
collect_register_by_name (regcache, "fooff", raw);
if (memcmp (raw, &fp->fooff, 4) != 0)
- {
- xstate_bv |= X86_XSTATE_X87;
- memcpy (&fp->fooff, raw, 4);
- }
+ {
+ xstate_bv |= X86_XSTATE_X87;
+ memcpy (&fp->fooff, raw, 4);
+ }
/* This one's 11 bits... */
val2 = regcache_raw_get_unsigned_by_name (regcache, "fop");
val2 = (val2 & 0x7FF) | (fp->fop & 0xF800);
if (fp->fop != val2)
- {
- xstate_bv |= X86_XSTATE_X87;
- fp->fop = val2;
- }
+ {
+ xstate_bv |= X86_XSTATE_X87;
+ fp->fop = val2;
+ }
/* Some registers are 16-bit. */
val = regcache_raw_get_unsigned_by_name (regcache, "fctrl");
if (fp->fctrl != val)
- {
- xstate_bv |= X86_XSTATE_X87;
- fp->fctrl = val;
- }
+ {
+ xstate_bv |= X86_XSTATE_X87;
+ fp->fctrl = val;
+ }
val = regcache_raw_get_unsigned_by_name (regcache, "fstat");
if (fp->fstat != val)
- {
- xstate_bv |= X86_XSTATE_X87;
- fp->fstat = val;
- }
+ {
+ xstate_bv |= X86_XSTATE_X87;
+ fp->fstat = val;
+ }
/* Convert to the simplifed tag form stored in fxsave data. */
val = regcache_raw_get_unsigned_by_name (regcache, "ftag");
val2 = 0;
for (i = 7; i >= 0; i--)
- {
- int tag = (val >> (i * 2)) & 3;
+ {
+ int tag = (val >> (i * 2)) & 3;
- if (tag != 3)
- val2 |= (1 << i);
- }
+ if (tag != 3)
+ val2 |= (1 << i);
+ }
if (fp->ftag != val2)
- {
- xstate_bv |= X86_XSTATE_X87;
- fp->ftag = val2;
- }
+ {
+ xstate_bv |= X86_XSTATE_X87;
+ fp->ftag = val2;
+ }
val = regcache_raw_get_unsigned_by_name (regcache, "fiseg");
if (fp->fiseg != val)
- {
- xstate_bv |= X86_XSTATE_X87;
- fp->fiseg = val;
- }
+ {
+ xstate_bv |= X86_XSTATE_X87;
+ fp->fiseg = val;
+ }
val = regcache_raw_get_unsigned_by_name (regcache, "foseg");
if (fp->foseg != val)
- {
- xstate_bv |= X86_XSTATE_X87;
- fp->foseg = val;
- }
+ {
+ xstate_bv |= X86_XSTATE_X87;
+ fp->foseg = val;
+ }
}
/* Update the corresponding bits in xstate_bv if any SSE/AVX
@@ -626,8 +629,8 @@ i387_ftag (struct i387_fxsave *fp, int regno)
integer = raw[7] & 0x80;
exponent = (((raw[9] & 0x7f) << 8) | raw[8]);
fraction[0] = ((raw[3] << 24) | (raw[2] << 16) | (raw[1] << 8) | raw[0]);
- fraction[1] = (((raw[7] & 0x7f) << 24) | (raw[6] << 16)
- | (raw[5] << 8) | raw[4]);
+ fraction[1]
+ = (((raw[7] & 0x7f) << 24) | (raw[6] << 16) | (raw[5] << 8) | raw[4]);
if (exponent == 0x7fff)
{
@@ -637,28 +640,28 @@ i387_ftag (struct i387_fxsave *fp, int regno)
else if (exponent == 0x0000)
{
if (fraction[0] == 0x0000 && fraction[1] == 0x0000 && !integer)
- {
- /* Zero. */
- return (1);
- }
+ {
+ /* Zero. */
+ return (1);
+ }
else
- {
- /* Special. */
- return (2);
- }
+ {
+ /* Special. */
+ return (2);
+ }
}
else
{
if (integer)
- {
- /* Valid. */
- return (0);
- }
+ {
+ /* Valid. */
+ return (0);
+ }
else
- {
- /* Special. */
- return (2);
- }
+ {
+ /* Special. */
+ return (2);
+ }
}
}
@@ -675,10 +678,10 @@ i387_fxsave_to_cache (struct regcache *regcache, const void *buf)
for (i = 0; i < 8; i++)
supply_register (regcache, i + st0_regnum,
- ((char *) &fp->st_space[0]) + i * 16);
+ ((char *) &fp->st_space[0]) + i * 16);
for (i = 0; i < num_xmm_registers; i++)
supply_register (regcache, i + xmm0_regnum,
- ((char *) &fp->xmm_space[0]) + i * 16);
+ ((char *) &fp->xmm_space[0]) + i * 16);
supply_register_by_name (regcache, "fioff", &fp->fioff);
supply_register_by_name (regcache, "fooff", &fp->fooff);
@@ -698,9 +701,9 @@ i387_fxsave_to_cache (struct regcache *regcache, const void *buf)
{
int tag;
if (fp->ftag & (1 << i))
- tag = i387_ftag (fp, (i + 8 - top) % 8);
+ tag = i387_ftag (fp, (i + 8 - top) % 8);
else
- tag = 3;
+ tag = 3;
val |= tag << (2 * i);
}
supply_register_by_name (regcache, "ftag", &val);
@@ -726,7 +729,7 @@ i387_xsave_to_cache (struct regcache *regcache, const void *buf)
unsigned long long clear_bv;
gdb_byte *p;
- /* Amd64 has 16 xmm regs; I386 has 8 xmm regs. */
+ /* Amd64 has 16 xmm regs; I386 has 8 xmm regs. */
int num_xmm_registers = amd64 ? 16 : 8;
/* AVX512 extends the existing xmm/ymm registers to a wider mode: zmm. */
int num_avx512_zmmh_low_registers = num_xmm_registers;
@@ -745,16 +748,16 @@ i387_xsave_to_cache (struct regcache *regcache, const void *buf)
int st0_regnum = find_regno (regcache->tdesc, "st0");
if ((clear_bv & X86_XSTATE_X87) != 0)
- {
- for (i = 0; i < 8; i++)
- supply_register_zeroed (regcache, i + st0_regnum);
- }
+ {
+ for (i = 0; i < 8; i++)
+ supply_register_zeroed (regcache, i + st0_regnum);
+ }
else
- {
- p = (gdb_byte *) &fp->st_space[0];
- for (i = 0; i < 8; i++)
- supply_register (regcache, i + st0_regnum, p + i * 16);
- }
+ {
+ p = (gdb_byte *) &fp->st_space[0];
+ for (i = 0; i < 8; i++)
+ supply_register (regcache, i + st0_regnum, p + i * 16);
+ }
}
if ((x86_xcr0 & X86_XSTATE_SSE) != 0)
@@ -762,16 +765,16 @@ i387_xsave_to_cache (struct regcache *regcache, const void *buf)
int xmm0_regnum = find_regno (regcache->tdesc, "xmm0");
if ((clear_bv & X86_XSTATE_SSE))
- {
- for (i = 0; i < num_xmm_registers; i++)
- supply_register_zeroed (regcache, i + xmm0_regnum);
- }
+ {
+ for (i = 0; i < num_xmm_registers; i++)
+ supply_register_zeroed (regcache, i + xmm0_regnum);
+ }
else
- {
- p = (gdb_byte *) &fp->xmm_space[0];
- for (i = 0; i < num_xmm_registers; i++)
- supply_register (regcache, i + xmm0_regnum, p + i * 16);
- }
+ {
+ p = (gdb_byte *) &fp->xmm_space[0];
+ for (i = 0; i < num_xmm_registers; i++)
+ supply_register (regcache, i + xmm0_regnum, p + i * 16);
+ }
}
if ((x86_xcr0 & X86_XSTATE_AVX) != 0)
@@ -779,35 +782,33 @@ i387_xsave_to_cache (struct regcache *regcache, const void *buf)
int ymm0h_regnum = find_regno (regcache->tdesc, "ymm0h");
if ((clear_bv & X86_XSTATE_AVX) != 0)
- {
- for (i = 0; i < num_xmm_registers; i++)
- supply_register_zeroed (regcache, i + ymm0h_regnum);
- }
+ {
+ for (i = 0; i < num_xmm_registers; i++)
+ supply_register_zeroed (regcache, i + ymm0h_regnum);
+ }
else
- {
- p = (gdb_byte *) &fp->ymmh_space[0];
- for (i = 0; i < num_xmm_registers; i++)
- supply_register (regcache, i + ymm0h_regnum, p + i * 16);
- }
+ {
+ p = (gdb_byte *) &fp->ymmh_space[0];
+ for (i = 0; i < num_xmm_registers; i++)
+ supply_register (regcache, i + ymm0h_regnum, p + i * 16);
+ }
}
if ((x86_xcr0 & X86_XSTATE_BNDREGS))
{
int bnd0r_regnum = find_regno (regcache->tdesc, "bnd0raw");
-
if ((clear_bv & X86_XSTATE_BNDREGS) != 0)
- {
- for (i = 0; i < num_mpx_bnd_registers; i++)
- supply_register_zeroed (regcache, i + bnd0r_regnum);
- }
+ {
+ for (i = 0; i < num_mpx_bnd_registers; i++)
+ supply_register_zeroed (regcache, i + bnd0r_regnum);
+ }
else
- {
- p = (gdb_byte *) &fp->mpx_bnd_space[0];
- for (i = 0; i < num_mpx_bnd_registers; i++)
- supply_register (regcache, i + bnd0r_regnum, p + i * 16);
- }
-
+ {
+ p = (gdb_byte *) &fp->mpx_bnd_space[0];
+ for (i = 0; i < num_mpx_bnd_registers; i++)
+ supply_register (regcache, i + bnd0r_regnum, p + i * 16);
+ }
}
if ((x86_xcr0 & X86_XSTATE_BNDCFG))
@@ -815,16 +816,16 @@ i387_xsave_to_cache (struct regcache *regcache, const void *buf)
int bndcfg_regnum = find_regno (regcache->tdesc, "bndcfgu");
if ((clear_bv & X86_XSTATE_BNDCFG) != 0)
- {
- for (i = 0; i < num_mpx_cfg_registers; i++)
- supply_register_zeroed (regcache, i + bndcfg_regnum);
- }
+ {
+ for (i = 0; i < num_mpx_cfg_registers; i++)
+ supply_register_zeroed (regcache, i + bndcfg_regnum);
+ }
else
- {
- p = (gdb_byte *) &fp->mpx_cfg_space[0];
- for (i = 0; i < num_mpx_cfg_registers; i++)
- supply_register (regcache, i + bndcfg_regnum, p + i * 8);
- }
+ {
+ p = (gdb_byte *) &fp->mpx_cfg_space[0];
+ for (i = 0; i < num_mpx_cfg_registers; i++)
+ supply_register (regcache, i + bndcfg_regnum, p + i * 8);
+ }
}
if ((x86_xcr0 & X86_XSTATE_K) != 0)
@@ -832,16 +833,16 @@ i387_xsave_to_cache (struct regcache *regcache, const void *buf)
int k0_regnum = find_regno (regcache->tdesc, "k0");
if ((clear_bv & X86_XSTATE_K) != 0)
- {
- for (i = 0; i < num_avx512_k_registers; i++)
- supply_register_zeroed (regcache, i + k0_regnum);
- }
+ {
+ for (i = 0; i < num_avx512_k_registers; i++)
+ supply_register_zeroed (regcache, i + k0_regnum);
+ }
else
- {
- p = (gdb_byte *) &fp->k_space[0];
- for (i = 0; i < num_avx512_k_registers; i++)
- supply_register (regcache, i + k0_regnum, p + i * 8);
- }
+ {
+ p = (gdb_byte *) &fp->k_space[0];
+ for (i = 0; i < num_avx512_k_registers; i++)
+ supply_register (regcache, i + k0_regnum, p + i * 8);
+ }
}
if ((x86_xcr0 & X86_XSTATE_ZMM_H) != 0)
@@ -849,49 +850,49 @@ i387_xsave_to_cache (struct regcache *regcache, const void *buf)
int zmm0h_regnum = find_regno (regcache->tdesc, "zmm0h");
if ((clear_bv & X86_XSTATE_ZMM_H) != 0)
- {
- for (i = 0; i < num_avx512_zmmh_low_registers; i++)
- supply_register_zeroed (regcache, i + zmm0h_regnum);
- }
+ {
+ for (i = 0; i < num_avx512_zmmh_low_registers; i++)
+ supply_register_zeroed (regcache, i + zmm0h_regnum);
+ }
else
- {
- p = (gdb_byte *) &fp->zmmh_low_space[0];
- for (i = 0; i < num_avx512_zmmh_low_registers; i++)
- supply_register (regcache, i + zmm0h_regnum, p + i * 32);
- }
+ {
+ p = (gdb_byte *) &fp->zmmh_low_space[0];
+ for (i = 0; i < num_avx512_zmmh_low_registers; i++)
+ supply_register (regcache, i + zmm0h_regnum, p + i * 32);
+ }
}
if ((x86_xcr0 & X86_XSTATE_ZMM) != 0)
{
int zmm16h_regnum = (num_avx512_zmmh_high_registers == 0
- ? -1
- : find_regno (regcache->tdesc, "zmm16h"));
+ ? -1
+ : find_regno (regcache->tdesc, "zmm16h"));
int ymm16h_regnum = (num_avx512_ymmh_registers == 0
- ? -1
- : find_regno (regcache->tdesc, "ymm16h"));
+ ? -1
+ : find_regno (regcache->tdesc, "ymm16h"));
int xmm16_regnum = (num_avx512_xmm_registers == 0
- ? -1
- : find_regno (regcache->tdesc, "xmm16"));
+ ? -1
+ : find_regno (regcache->tdesc, "xmm16"));
if ((clear_bv & X86_XSTATE_ZMM) != 0)
- {
- for (i = 0; i < num_avx512_zmmh_high_registers; i++)
- supply_register_zeroed (regcache, i + zmm16h_regnum);
- for (i = 0; i < num_avx512_ymmh_registers; i++)
- supply_register_zeroed (regcache, i + ymm16h_regnum);
- for (i = 0; i < num_avx512_xmm_registers; i++)
- supply_register_zeroed (regcache, i + xmm16_regnum);
- }
+ {
+ for (i = 0; i < num_avx512_zmmh_high_registers; i++)
+ supply_register_zeroed (regcache, i + zmm16h_regnum);
+ for (i = 0; i < num_avx512_ymmh_registers; i++)
+ supply_register_zeroed (regcache, i + ymm16h_regnum);
+ for (i = 0; i < num_avx512_xmm_registers; i++)
+ supply_register_zeroed (regcache, i + xmm16_regnum);
+ }
else
- {
- p = (gdb_byte *) &fp->zmmh_high_space[0];
- for (i = 0; i < num_avx512_zmmh_high_registers; i++)
- supply_register (regcache, i + zmm16h_regnum, p + 32 + i * 64);
- for (i = 0; i < num_avx512_ymmh_registers; i++)
- supply_register (regcache, i + ymm16h_regnum, p + 16 + i * 64);
- for (i = 0; i < num_avx512_xmm_registers; i++)
- supply_register (regcache, i + xmm16_regnum, p + i * 64);
- }
+ {
+ p = (gdb_byte *) &fp->zmmh_high_space[0];
+ for (i = 0; i < num_avx512_zmmh_high_registers; i++)
+ supply_register (regcache, i + zmm16h_regnum, p + 32 + i * 64);
+ for (i = 0; i < num_avx512_ymmh_registers; i++)
+ supply_register (regcache, i + ymm16h_regnum, p + 16 + i * 64);
+ for (i = 0; i < num_avx512_xmm_registers; i++)
+ supply_register (regcache, i + xmm16_regnum, p + i * 64);
+ }
}
if ((x86_xcr0 & X86_XSTATE_PKRU) != 0)
@@ -899,16 +900,16 @@ i387_xsave_to_cache (struct regcache *regcache, const void *buf)
int pkru_regnum = find_regno (regcache->tdesc, "pkru");
if ((clear_bv & X86_XSTATE_PKRU) != 0)
- {
- for (i = 0; i < num_pkeys_registers; i++)
- supply_register_zeroed (regcache, i + pkru_regnum);
- }
+ {
+ for (i = 0; i < num_pkeys_registers; i++)
+ supply_register_zeroed (regcache, i + pkru_regnum);
+ }
else
- {
- p = (gdb_byte *) &fp->pkru_space[0];
- for (i = 0; i < num_pkeys_registers; i++)
- supply_register (regcache, i + pkru_regnum, p + i * 4);
- }
+ {
+ p = (gdb_byte *) &fp->pkru_space[0];
+ for (i = 0; i < num_pkeys_registers; i++)
+ supply_register (regcache, i + pkru_regnum, p + i * 4);
+ }
}
if ((clear_bv & (X86_XSTATE_SSE | X86_XSTATE_AVX))
@@ -953,14 +954,14 @@ i387_xsave_to_cache (struct regcache *regcache, const void *buf)
top = (fp->fstat >> 11) & 0x7;
val = 0;
for (i = 7; i >= 0; i--)
- {
- int tag;
- if (fp->ftag & (1 << i))
- tag = i387_ftag (fxp, (i + 8 - top) % 8);
- else
- tag = 3;
- val |= tag << (2 * i);
- }
+ {
+ int tag;
+ if (fp->ftag & (1 << i))
+ tag = i387_ftag (fxp, (i + 8 - top) % 8);
+ else
+ tag = 3;
+ val |= tag << (2 * i);
+ }
supply_register_by_name (regcache, "ftag", &val);
val = fp->fiseg & 0xFFFF;
diff --git a/gdbserver/inferiors.cc b/gdbserver/inferiors.cc
index cbf46779088..a35165d887e 100644
--- a/gdbserver/inferiors.cc
+++ b/gdbserver/inferiors.cc
@@ -65,9 +65,8 @@ get_first_thread (void)
struct thread_info *
find_thread_ptid (ptid_t ptid)
{
- return find_thread ([&] (thread_info *thread) {
- return thread->id == ptid;
- });
+ return find_thread (
+ [&] (thread_info *thread) { return thread->id == ptid; });
}
/* Find a thread associated with the given PROCESS, or NULL if no
@@ -84,9 +83,7 @@ find_thread_process (const struct process_info *const process)
struct thread_info *
find_any_thread_of_pid (int pid)
{
- return find_thread (pid, [] (thread_info *thread) {
- return true;
- });
+ return find_thread (pid, [] (thread_info *thread) { return true; });
}
static void
@@ -167,9 +164,8 @@ remove_process (struct process_info *process)
process_info *
find_process_pid (int pid)
{
- return find_process ([&] (process_info *process) {
- return process->pid == pid;
- });
+ return find_process (
+ [&] (process_info *process) { return process->pid == pid; });
}
/* Get the first process in the process list, or NULL if the list is empty. */
@@ -189,9 +185,9 @@ get_first_process (void)
int
have_started_inferiors_p (void)
{
- return find_process ([] (process_info *process) {
- return !process->attached;
- }) != NULL;
+ return find_process (
+ [] (process_info *process) { return !process->attached; })
+ != NULL;
}
/* Return non-zero if there are any inferiors that we have attached to. */
@@ -199,9 +195,9 @@ have_started_inferiors_p (void)
int
have_attached_inferiors_p (void)
{
- return find_process ([] (process_info *process) {
- return process->attached;
- }) != NULL;
+ return find_process (
+ [] (process_info *process) { return process->attached; })
+ != NULL;
}
struct process_info *
diff --git a/gdbserver/inferiors.h b/gdbserver/inferiors.h
index a0ba9906097..a7b9c829266 100644
--- a/gdbserver/inferiors.h
+++ b/gdbserver/inferiors.h
@@ -34,9 +34,7 @@ struct process_info_private;
struct process_info
{
- process_info (int pid_, int attached_)
- : pid (pid_), attached (attached_)
- {}
+ process_info (int pid_, int attached_) : pid (pid_), attached (attached_) {}
/* This process' pid. */
int pid;
@@ -103,7 +101,7 @@ extern std::list<process_info *> all_processes;
/* Invoke FUNC for each process. */
-template <typename Func>
+template<typename Func>
static void
for_each_process (Func func)
{
@@ -121,7 +119,7 @@ for_each_process (Func func)
/* Find the first process for which FUNC returns true. Return NULL if no
process satisfying FUNC is found. */
-template <typename Func>
+template<typename Func>
static process_info *
find_process (Func func)
{
@@ -133,7 +131,7 @@ find_process (Func func)
next++;
if (func (*cur))
- return *cur;
+ return *cur;
cur = next;
}
diff --git a/gdbserver/linux-aarch32-low.cc b/gdbserver/linux-aarch32-low.cc
index 990a352af74..f079e525d4b 100644
--- a/gdbserver/linux-aarch32-low.cc
+++ b/gdbserver/linux-aarch32-low.cc
@@ -69,8 +69,8 @@ arm_fill_gregset (struct regcache *regcache, void *buf)
collect_register (regcache, ARM_PS_REGNUM, &regs[ARM_CPSR_GREGNUM]);
/* Keep reserved bits bit 20 to bit 23. */
- regs[ARM_CPSR_GREGNUM] = ((regs[ARM_CPSR_GREGNUM] & 0xff0fffff)
- | (cpsr & 0x00f00000));
+ regs[ARM_CPSR_GREGNUM]
+ = ((regs[ARM_CPSR_GREGNUM] & 0xff0fffff) | (cpsr & 0x00f00000));
}
/* Supply GP registers contents, stored in BUF, to REGCACHE. */
@@ -142,29 +142,23 @@ arm_store_vfpregset (struct regcache *regcache, const void *buf)
/* Register sets with using PTRACE_GETREGSET. */
-static struct regset_info aarch32_regsets[] = {
- { PTRACE_GETREGSET, PTRACE_SETREGSET, NT_PRSTATUS,
- ARM_CORE_REGS_SIZE + ARM_INT_REGISTER_SIZE, GENERAL_REGS,
- arm_fill_gregset, arm_store_gregset },
- { PTRACE_GETREGSET, PTRACE_SETREGSET, NT_ARM_VFP, ARM_VFP3_REGS_SIZE,
- EXTENDED_REGS,
- arm_fill_vfpregset, arm_store_vfpregset },
- NULL_REGSET
+static struct regset_info aarch32_regsets[]
+ = { { PTRACE_GETREGSET, PTRACE_SETREGSET, NT_PRSTATUS,
+ ARM_CORE_REGS_SIZE + ARM_INT_REGISTER_SIZE, GENERAL_REGS,
+ arm_fill_gregset, arm_store_gregset },
+ { PTRACE_GETREGSET, PTRACE_SETREGSET, NT_ARM_VFP, ARM_VFP3_REGS_SIZE,
+ EXTENDED_REGS, arm_fill_vfpregset, arm_store_vfpregset },
+ NULL_REGSET };
+
+static struct regsets_info aarch32_regsets_info = {
+ aarch32_regsets, /* regsets */
+ 0, /* num_regsets */
+ NULL, /* disabled_regsets */
};
-static struct regsets_info aarch32_regsets_info =
- {
- aarch32_regsets, /* regsets */
- 0, /* num_regsets */
- NULL, /* disabled_regsets */
- };
-
-struct regs_info regs_info_aarch32 =
- {
- NULL, /* regset_bitmap */
- NULL, /* usrregs */
- &aarch32_regsets_info
- };
+struct regs_info regs_info_aarch32 = { NULL, /* regset_bitmap */
+ NULL, /* usrregs */
+ &aarch32_regsets_info };
/* Returns 1 if the current instruction set is thumb, 0 otherwise. */
@@ -194,14 +188,14 @@ arm_breakpoint_at (CORE_ADDR where)
the_target->read_memory (where, (unsigned char *) &insn, 2);
if (insn == thumb_breakpoint)
- return 1;
+ return 1;
if (insn == thumb2_breakpoint[0])
- {
- the_target->read_memory (where + 2, (unsigned char *) &insn, 2);
- if (insn == thumb2_breakpoint[1])
- return 1;
- }
+ {
+ the_target->read_memory (where + 2, (unsigned char *) &insn, 2);
+ if (insn == thumb2_breakpoint[1])
+ return 1;
+ }
}
else
{
@@ -210,10 +204,10 @@ arm_breakpoint_at (CORE_ADDR where)
the_target->read_memory (where, (unsigned char *) &insn, 4);
if (insn == arm_abi_breakpoint)
- return 1;
+ return 1;
if (insn == arm_eabi_breakpoint)
- return 1;
+ return 1;
}
return 0;
@@ -238,13 +232,13 @@ arm_breakpoint_kind_from_pc (CORE_ADDR *pcptr)
/* Check whether we are replacing a thumb2 32-bit instruction. */
if (target_read_memory (*pcptr, buf, 2) == 0)
- {
- unsigned short inst1 = 0;
+ {
+ unsigned short inst1 = 0;
- target_read_memory (*pcptr, (gdb_byte *) &inst1, 2);
- if (thumb_insn_size (inst1) == 4)
- return ARM_BP_KIND_THUMB2;
- }
+ target_read_memory (*pcptr, (gdb_byte *) &inst1, 2);
+ if (thumb_insn_size (inst1) == 4)
+ return ARM_BP_KIND_THUMB2;
+ }
return ARM_BP_KIND_THUMB;
}
else
@@ -254,7 +248,7 @@ arm_breakpoint_kind_from_pc (CORE_ADDR *pcptr)
/* Implementation of the linux_target_ops method "sw_breakpoint_from_kind". */
const gdb_byte *
-arm_sw_breakpoint_from_kind (int kind , int *size)
+arm_sw_breakpoint_from_kind (int kind, int *size)
{
*size = arm_breakpoint_len;
/* Define an ARM-mode breakpoint; we only set breakpoints in the C
@@ -264,17 +258,17 @@ arm_sw_breakpoint_from_kind (int kind , int *size)
application. */
switch (kind)
{
- case ARM_BP_KIND_THUMB:
- *size = thumb_breakpoint_len;
- return (gdb_byte *) &thumb_breakpoint;
- case ARM_BP_KIND_THUMB2:
- *size = thumb2_breakpoint_len;
- return (gdb_byte *) &thumb2_breakpoint;
- case ARM_BP_KIND_ARM:
- *size = arm_breakpoint_len;
- return (const gdb_byte *) &arm_breakpoint;
- default:
- return NULL;
+ case ARM_BP_KIND_THUMB:
+ *size = thumb_breakpoint_len;
+ return (gdb_byte *) &thumb_breakpoint;
+ case ARM_BP_KIND_THUMB2:
+ *size = thumb2_breakpoint_len;
+ return (gdb_byte *) &thumb2_breakpoint;
+ case ARM_BP_KIND_ARM:
+ *size = arm_breakpoint_len;
+ return (const gdb_byte *) &arm_breakpoint;
+ default:
+ return NULL;
}
return NULL;
}
diff --git a/gdbserver/linux-aarch32-low.h b/gdbserver/linux-aarch32-low.h
index 18edcbd0b6c..48cc263483b 100644
--- a/gdbserver/linux-aarch32-low.h
+++ b/gdbserver/linux-aarch32-low.h
@@ -24,10 +24,10 @@ void arm_fill_gregset (struct regcache *regcache, void *buf);
void arm_store_gregset (struct regcache *regcache, const void *buf);
void arm_fill_vfpregset_num (struct regcache *regcache, void *buf, int num);
void arm_store_vfpregset_num (struct regcache *regcache, const void *buf,
- int num);
+ int num);
int arm_breakpoint_kind_from_pc (CORE_ADDR *pcptr);
-const gdb_byte *arm_sw_breakpoint_from_kind (int kind , int *size);
+const gdb_byte *arm_sw_breakpoint_from_kind (int kind, int *size);
int arm_breakpoint_kind_from_current_state (CORE_ADDR *pcptr);
int arm_breakpoint_at (CORE_ADDR where);
diff --git a/gdbserver/linux-aarch32-tdesc.h b/gdbserver/linux-aarch32-tdesc.h
index 0f23ccc13bd..ed14012f5db 100644
--- a/gdbserver/linux-aarch32-tdesc.h
+++ b/gdbserver/linux-aarch32-tdesc.h
@@ -20,7 +20,7 @@
/* Return the AArch32 target description. */
-const target_desc * aarch32_linux_read_description ();
+const target_desc *aarch32_linux_read_description ();
/* Return true if TDESC is the AArch32 target description. */
diff --git a/gdbserver/linux-aarch64-ipa.cc b/gdbserver/linux-aarch64-ipa.cc
index e37bed0ccf2..074474b2b3c 100644
--- a/gdbserver/linux-aarch64-ipa.cc
+++ b/gdbserver/linux-aarch64-ipa.cc
@@ -30,14 +30,14 @@
/* Each register saved by the jump pad is in a 16 byte cell. */
#define FT_CR_SIZE 16
-#define FT_CR_FPCR 0
-#define FT_CR_FPSR 1
-#define FT_CR_CPSR 2
-#define FT_CR_PC 3
-#define FT_CR_SP 4
-#define FT_CR_X0 5
-#define FT_CR_GPR(n) (FT_CR_X0 + (n))
-#define FT_CR_FPR(n) (FT_CR_GPR (31) + (n))
+#define FT_CR_FPCR 0
+#define FT_CR_FPSR 1
+#define FT_CR_CPSR 2
+#define FT_CR_PC 3
+#define FT_CR_SP 4
+#define FT_CR_X0 5
+#define FT_CR_GPR(n) (FT_CR_X0 + (n))
+#define FT_CR_FPR(n) (FT_CR_GPR (31) + (n))
/* Mapping between registers collected by the jump pad and GDB's register
array layout used by regcache.
@@ -45,94 +45,43 @@
See linux-aarch64-low.c (aarch64_install_fast_tracepoint_jump_pad) for
more details. */
-static const int aarch64_ft_collect_regmap[] = {
- FT_CR_GPR (0),
- FT_CR_GPR (1),
- FT_CR_GPR (2),
- FT_CR_GPR (3),
- FT_CR_GPR (4),
- FT_CR_GPR (5),
- FT_CR_GPR (6),
- FT_CR_GPR (7),
- FT_CR_GPR (8),
- FT_CR_GPR (9),
- FT_CR_GPR (10),
- FT_CR_GPR (11),
- FT_CR_GPR (12),
- FT_CR_GPR (13),
- FT_CR_GPR (14),
- FT_CR_GPR (15),
- FT_CR_GPR (16),
- FT_CR_GPR (17),
- FT_CR_GPR (18),
- FT_CR_GPR (19),
- FT_CR_GPR (20),
- FT_CR_GPR (21),
- FT_CR_GPR (22),
- FT_CR_GPR (23),
- FT_CR_GPR (24),
- FT_CR_GPR (25),
- FT_CR_GPR (26),
- FT_CR_GPR (27),
- FT_CR_GPR (28),
- /* FP */
- FT_CR_GPR (29),
- /* LR */
- FT_CR_GPR (30),
- FT_CR_SP,
- FT_CR_PC,
- FT_CR_CPSR,
- FT_CR_FPR (0),
- FT_CR_FPR (1),
- FT_CR_FPR (2),
- FT_CR_FPR (3),
- FT_CR_FPR (4),
- FT_CR_FPR (5),
- FT_CR_FPR (6),
- FT_CR_FPR (7),
- FT_CR_FPR (8),
- FT_CR_FPR (9),
- FT_CR_FPR (10),
- FT_CR_FPR (11),
- FT_CR_FPR (12),
- FT_CR_FPR (13),
- FT_CR_FPR (14),
- FT_CR_FPR (15),
- FT_CR_FPR (16),
- FT_CR_FPR (17),
- FT_CR_FPR (18),
- FT_CR_FPR (19),
- FT_CR_FPR (20),
- FT_CR_FPR (21),
- FT_CR_FPR (22),
- FT_CR_FPR (23),
- FT_CR_FPR (24),
- FT_CR_FPR (25),
- FT_CR_FPR (26),
- FT_CR_FPR (27),
- FT_CR_FPR (28),
- FT_CR_FPR (29),
- FT_CR_FPR (30),
- FT_CR_FPR (31),
- FT_CR_FPSR,
- FT_CR_FPCR
-};
+static const int aarch64_ft_collect_regmap[]
+ = { FT_CR_GPR (0), FT_CR_GPR (1), FT_CR_GPR (2), FT_CR_GPR (3),
+ FT_CR_GPR (4), FT_CR_GPR (5), FT_CR_GPR (6), FT_CR_GPR (7),
+ FT_CR_GPR (8), FT_CR_GPR (9), FT_CR_GPR (10), FT_CR_GPR (11),
+ FT_CR_GPR (12), FT_CR_GPR (13), FT_CR_GPR (14), FT_CR_GPR (15),
+ FT_CR_GPR (16), FT_CR_GPR (17), FT_CR_GPR (18), FT_CR_GPR (19),
+ FT_CR_GPR (20), FT_CR_GPR (21), FT_CR_GPR (22), FT_CR_GPR (23),
+ FT_CR_GPR (24), FT_CR_GPR (25), FT_CR_GPR (26), FT_CR_GPR (27),
+ FT_CR_GPR (28),
+ /* FP */
+ FT_CR_GPR (29),
+ /* LR */
+ FT_CR_GPR (30), FT_CR_SP, FT_CR_PC, FT_CR_CPSR, FT_CR_FPR (0),
+ FT_CR_FPR (1), FT_CR_FPR (2), FT_CR_FPR (3), FT_CR_FPR (4),
+ FT_CR_FPR (5), FT_CR_FPR (6), FT_CR_FPR (7), FT_CR_FPR (8),
+ FT_CR_FPR (9), FT_CR_FPR (10), FT_CR_FPR (11), FT_CR_FPR (12),
+ FT_CR_FPR (13), FT_CR_FPR (14), FT_CR_FPR (15), FT_CR_FPR (16),
+ FT_CR_FPR (17), FT_CR_FPR (18), FT_CR_FPR (19), FT_CR_FPR (20),
+ FT_CR_FPR (21), FT_CR_FPR (22), FT_CR_FPR (23), FT_CR_FPR (24),
+ FT_CR_FPR (25), FT_CR_FPR (26), FT_CR_FPR (27), FT_CR_FPR (28),
+ FT_CR_FPR (29), FT_CR_FPR (30), FT_CR_FPR (31), FT_CR_FPSR, FT_CR_FPCR };
#define AARCH64_NUM_FT_COLLECT_GREGS \
- (sizeof (aarch64_ft_collect_regmap) / sizeof(aarch64_ft_collect_regmap[0]))
+ (sizeof (aarch64_ft_collect_regmap) / sizeof (aarch64_ft_collect_regmap[0]))
/* Fill in REGCACHE with registers saved by the jump pad in BUF. */
void
supply_fast_tracepoint_registers (struct regcache *regcache,
- const unsigned char *buf)
+ const unsigned char *buf)
{
int i;
for (i = 0; i < AARCH64_NUM_FT_COLLECT_GREGS; i++)
supply_register (regcache, i,
- ((char *) buf)
- + (aarch64_ft_collect_regmap[i] * FT_CR_SIZE));
+ ((char *) buf)
+ + (aarch64_ft_collect_regmap[i] * FT_CR_SIZE));
}
ULONGEST
@@ -142,7 +91,7 @@ get_raw_reg (const unsigned char *raw_regs, int regnum)
return 0;
return *(ULONGEST *) (raw_regs
- + aarch64_ft_collect_regmap[regnum] * FT_CR_SIZE);
+ + aarch64_ft_collect_regmap[regnum] * FT_CR_SIZE);
}
/* Return target_desc to use for IPA, given the tdesc index passed by
@@ -185,17 +134,16 @@ alloc_jump_pad_buffer (size_t size)
for (; addr; addr -= pagesize)
{
/* No MAP_FIXED - we don't want to zap someone's mapping. */
- res = mmap ((void *) addr, size,
- PROT_READ | PROT_WRITE | PROT_EXEC,
- MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
+ res = mmap ((void *) addr, size, PROT_READ | PROT_WRITE | PROT_EXEC,
+ MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
/* If we got what we wanted, return. */
if ((uintptr_t) res == addr)
- return res;
+ return res;
/* If we got a mapping, but at a wrong address, undo it. */
if (res != MAP_FAILED)
- munmap (res, size);
+ munmap (res, size);
}
return NULL;
diff --git a/gdbserver/linux-aarch64-low.cc b/gdbserver/linux-aarch64-low.cc
index 2ed6e95562c..c2481478e31 100644
--- a/gdbserver/linux-aarch64-low.cc
+++ b/gdbserver/linux-aarch64-low.cc
@@ -60,7 +60,6 @@
class aarch64_target : public linux_process_target
{
public:
-
const regs_info *get_regs_info () override;
int breakpoint_kind_from_pc (CORE_ADDR *pcptr) override;
@@ -75,13 +74,13 @@ public:
bool supports_fast_tracepoints () override;
- int install_fast_tracepoint_jump_pad
- (CORE_ADDR tpoint, CORE_ADDR tpaddr, CORE_ADDR collector,
- CORE_ADDR lockaddr, ULONGEST orig_size, CORE_ADDR *jump_entry,
- CORE_ADDR *trampoline, ULONGEST *trampoline_size,
- unsigned char *jjump_pad_insn, ULONGEST *jjump_pad_insn_size,
- CORE_ADDR *adjusted_insn_addr, CORE_ADDR *adjusted_insn_addr_end,
- char *err) override;
+ int install_fast_tracepoint_jump_pad (
+ CORE_ADDR tpoint, CORE_ADDR tpaddr, CORE_ADDR collector,
+ CORE_ADDR lockaddr, ULONGEST orig_size, CORE_ADDR *jump_entry,
+ CORE_ADDR *trampoline, ULONGEST *trampoline_size,
+ unsigned char *jjump_pad_insn, ULONGEST *jjump_pad_insn_size,
+ CORE_ADDR *adjusted_insn_addr, CORE_ADDR *adjusted_insn_addr_end,
+ char *err) override;
int get_min_fast_tracepoint_insn_len () override;
@@ -89,14 +88,13 @@ public:
bool supports_memory_tagging () override;
- bool fetch_memtags (CORE_ADDR address, size_t len,
- gdb::byte_vector &tags, int type) override;
+ bool fetch_memtags (CORE_ADDR address, size_t len, gdb::byte_vector &tags,
+ int type) override;
bool store_memtags (CORE_ADDR address, size_t len,
- const gdb::byte_vector &tags, int type) override;
+ const gdb::byte_vector &tags, int type) override;
protected:
-
void low_arch_setup () override;
bool low_cannot_fetch_register (int regno) override;
@@ -111,18 +109,18 @@ protected:
bool low_breakpoint_at (CORE_ADDR pc) override;
- int low_insert_point (raw_bkpt_type type, CORE_ADDR addr,
- int size, raw_breakpoint *bp) override;
+ int low_insert_point (raw_bkpt_type type, CORE_ADDR addr, int size,
+ raw_breakpoint *bp) override;
- int low_remove_point (raw_bkpt_type type, CORE_ADDR addr,
- int size, raw_breakpoint *bp) override;
+ int low_remove_point (raw_bkpt_type type, CORE_ADDR addr, int size,
+ raw_breakpoint *bp) override;
bool low_stopped_by_watchpoint () override;
CORE_ADDR low_stopped_data_address () override;
bool low_siginfo_fixup (siginfo_t *native, gdb_byte *inf,
- int direction) override;
+ int direction) override;
arch_process_info *low_new_process () override;
@@ -153,14 +151,14 @@ bool
aarch64_target::low_cannot_fetch_register (int regno)
{
gdb_assert_not_reached ("linux target op low_cannot_fetch_register "
- "is not implemented by the target");
+ "is not implemented by the target");
}
bool
aarch64_target::low_cannot_store_register (int regno)
{
gdb_assert_not_reached ("linux target op low_cannot_store_register "
- "is not implemented by the target");
+ "is not implemented by the target");
}
void
@@ -259,9 +257,9 @@ aarch64_store_pauthregset (struct regcache *regcache, const void *buf)
return;
supply_register (regcache, AARCH64_PAUTH_DMASK_REGNUM (pauth_base),
- &pauth_regset[0]);
+ &pauth_regset[0]);
supply_register (regcache, AARCH64_PAUTH_CMASK_REGNUM (pauth_base),
- &pauth_regset[1]);
+ &pauth_regset[1]);
}
/* Fill BUF with the MTE registers from the regcache. */
@@ -293,7 +291,7 @@ static void
aarch64_fill_tlsregset (struct regcache *regcache, void *buf)
{
gdb_byte *tls_buf = (gdb_byte *) buf;
- int tls_regnum = find_regno (regcache->tdesc, "tpidr");
+ int tls_regnum = find_regno (regcache->tdesc, "tpidr");
collect_register (regcache, tls_regnum, tls_buf);
@@ -310,7 +308,7 @@ static void
aarch64_store_tlsregset (struct regcache *regcache, const void *buf)
{
gdb_byte *tls_buf = (gdb_byte *) buf;
- int tls_regnum = find_regno (regcache->tdesc, "tpidr");
+ int tls_regnum = find_regno (regcache->tdesc, "tpidr");
supply_register (regcache, tls_regnum, tls_buf);
@@ -354,7 +352,7 @@ aarch64_target::low_set_pc (regcache *regcache, CORE_ADDR pc)
/* AArch64 BRK software debug mode instruction.
This instruction needs to match gdb/aarch64-tdep.c
(aarch64_default_breakpoint). */
-static const gdb_byte aarch64_breakpoint[] = {0x00, 0x00, 0x20, 0xd4};
+static const gdb_byte aarch64_breakpoint[] = { 0x00, 0x00, 0x20, 0xd4 };
/* Implementation of linux target ops method "low_breakpoint_at". */
@@ -367,7 +365,7 @@ aarch64_target::low_breakpoint_at (CORE_ADDR where)
read_memory (where, (unsigned char *) &insn, aarch64_breakpoint_len);
if (memcmp (insn, aarch64_breakpoint, aarch64_breakpoint_len) == 0)
- return true;
+ return true;
return false;
}
@@ -430,8 +428,8 @@ aarch64_target::supports_z_point_type (char z_type)
the actual insertion will happen when threads are resumed. */
int
-aarch64_target::low_insert_point (raw_bkpt_type type, CORE_ADDR addr,
- int len, raw_breakpoint *bp)
+aarch64_target::low_insert_point (raw_bkpt_type type, CORE_ADDR addr, int len,
+ raw_breakpoint *bp)
{
int ret;
enum target_hw_bp_type targ_type;
@@ -440,7 +438,7 @@ aarch64_target::low_insert_point (raw_bkpt_type type, CORE_ADDR addr,
if (show_debug_regs)
fprintf (stderr, "insert_point on entry (addr=0x%08lx, len=%d)\n",
- (unsigned long) addr, len);
+ (unsigned long) addr, len);
/* Determine the type from the raw breakpoint type. */
targ_type = raw_bkpt_type_to_target_hw_bp_type (type);
@@ -448,29 +446,27 @@ aarch64_target::low_insert_point (raw_bkpt_type type, CORE_ADDR addr,
if (targ_type != hw_execute)
{
if (aarch64_region_ok_for_watchpoint (addr, len))
- ret = aarch64_handle_watchpoint (targ_type, addr, len,
- 1 /* is_insert */,
- current_lwp_ptid (), state);
+ ret
+ = aarch64_handle_watchpoint (targ_type, addr, len, 1 /* is_insert */,
+ current_lwp_ptid (), state);
else
- ret = -1;
+ ret = -1;
}
else
{
if (len == 3)
- {
- /* LEN is 3 means the breakpoint is set on a 32-bit thumb
+ {
+ /* LEN is 3 means the breakpoint is set on a 32-bit thumb
instruction. Set it to 2 to correctly encode length bit
mask in hardware/watchpoint control register. */
- len = 2;
- }
- ret = aarch64_handle_breakpoint (targ_type, addr, len,
- 1 /* is_insert */, current_lwp_ptid (),
- state);
+ len = 2;
+ }
+ ret = aarch64_handle_breakpoint (targ_type, addr, len, 1 /* is_insert */,
+ current_lwp_ptid (), state);
}
if (show_debug_regs)
- aarch64_show_debug_reg_state (state, "insert_point", addr, len,
- targ_type);
+ aarch64_show_debug_reg_state (state, "insert_point", addr, len, targ_type);
return ret;
}
@@ -481,8 +477,8 @@ aarch64_target::low_insert_point (raw_bkpt_type type, CORE_ADDR addr,
the actual removal will be done when threads are resumed. */
int
-aarch64_target::low_remove_point (raw_bkpt_type type, CORE_ADDR addr,
- int len, raw_breakpoint *bp)
+aarch64_target::low_remove_point (raw_bkpt_type type, CORE_ADDR addr, int len,
+ raw_breakpoint *bp)
{
int ret;
enum target_hw_bp_type targ_type;
@@ -491,33 +487,30 @@ aarch64_target::low_remove_point (raw_bkpt_type type, CORE_ADDR addr,
if (show_debug_regs)
fprintf (stderr, "remove_point on entry (addr=0x%08lx, len=%d)\n",
- (unsigned long) addr, len);
+ (unsigned long) addr, len);
/* Determine the type from the raw breakpoint type. */
targ_type = raw_bkpt_type_to_target_hw_bp_type (type);
/* Set up state pointers. */
if (targ_type != hw_execute)
- ret =
- aarch64_handle_watchpoint (targ_type, addr, len, 0 /* is_insert */,
- current_lwp_ptid (), state);
+ ret = aarch64_handle_watchpoint (targ_type, addr, len, 0 /* is_insert */,
+ current_lwp_ptid (), state);
else
{
if (len == 3)
- {
- /* LEN is 3 means the breakpoint is set on a 32-bit thumb
+ {
+ /* LEN is 3 means the breakpoint is set on a 32-bit thumb
instruction. Set it to 2 to correctly encode length bit
mask in hardware/watchpoint control register. */
- len = 2;
- }
- ret = aarch64_handle_breakpoint (targ_type, addr, len,
- 0 /* is_insert */, current_lwp_ptid (),
- state);
+ len = 2;
+ }
+ ret = aarch64_handle_breakpoint (targ_type, addr, len, 0 /* is_insert */,
+ current_lwp_ptid (), state);
}
if (show_debug_regs)
- aarch64_show_debug_reg_state (state, "remove_point", addr, len,
- targ_type);
+ aarch64_show_debug_reg_state (state, "remove_point", addr, len, targ_type);
return ret;
}
@@ -531,7 +524,7 @@ aarch64_remove_non_address_bits (CORE_ADDR pointer)
/* Check if PAC is available for this target. */
if (tdesc_contains_feature (current_process ()->tdesc,
- "org.gnu.gdb.aarch64.pauth"))
+ "org.gnu.gdb.aarch64.pauth"))
{
/* Fetch the PAC masks. These masks are per-process, so we can just
fetch data from whatever thread we have at the moment.
@@ -540,8 +533,10 @@ aarch64_remove_non_address_bits (CORE_ADDR pointer)
same, but this may change in the future. */
struct regcache *regs = get_thread_regcache (current_thread, 1);
- CORE_ADDR dmask = regcache_raw_get_unsigned_by_name (regs, "pauth_dmask");
- CORE_ADDR cmask = regcache_raw_get_unsigned_by_name (regs, "pauth_cmask");
+ CORE_ADDR dmask
+ = regcache_raw_get_unsigned_by_name (regs, "pauth_dmask");
+ CORE_ADDR cmask
+ = regcache_raw_get_unsigned_by_name (regs, "pauth_cmask");
mask |= aarch64_mask_from_pac_registers (cmask, dmask);
}
@@ -579,18 +574,19 @@ aarch64_target::low_stopped_data_address ()
for (i = aarch64_num_wp_regs - 1; i >= 0; --i)
{
const unsigned int offset
- = aarch64_watchpoint_offset (state->dr_ctrl_wp[i]);
- const unsigned int len = aarch64_watchpoint_length (state->dr_ctrl_wp[i]);
+ = aarch64_watchpoint_offset (state->dr_ctrl_wp[i]);
+ const unsigned int len
+ = aarch64_watchpoint_length (state->dr_ctrl_wp[i]);
const CORE_ADDR addr_watch = state->dr_addr_wp[i] + offset;
- const CORE_ADDR addr_watch_aligned = align_down (state->dr_addr_wp[i], 8);
+ const CORE_ADDR addr_watch_aligned
+ = align_down (state->dr_addr_wp[i], 8);
const CORE_ADDR addr_orig = state->dr_addr_orig_wp[i];
if (state->dr_ref_count_wp[i]
- && DR_CONTROL_ENABLED (state->dr_ctrl_wp[i])
- && addr_trap >= addr_watch_aligned
- && addr_trap < addr_watch + len)
- {
- /* ADDR_TRAP reports the first address of the memory range
+ && DR_CONTROL_ENABLED (state->dr_ctrl_wp[i])
+ && addr_trap >= addr_watch_aligned && addr_trap < addr_watch + len)
+ {
+ /* ADDR_TRAP reports the first address of the memory range
accessed by the CPU, regardless of what was the memory
range watched. Thus, a large CPU access that straddles
the ADDR_WATCH..ADDR_WATCH+LEN range may result in an
@@ -608,8 +604,8 @@ aarch64_target::low_stopped_data_address ()
range. ADDR_WATCH <= ADDR_TRAP < ADDR_ORIG is a false
positive on kernels older than 4.10. See PR
external/20207. */
- return addr_orig;
- }
+ return addr_orig;
+ }
}
return (CORE_ADDR) 0;
@@ -626,28 +622,27 @@ aarch64_target::low_stopped_by_watchpoint ()
/* Fetch the thread-local storage pointer for libthread_db. */
ps_err_e
-ps_get_thread_area (struct ps_prochandle *ph,
- lwpid_t lwpid, int idx, void **base)
+ps_get_thread_area (struct ps_prochandle *ph, lwpid_t lwpid, int idx,
+ void **base)
{
- return aarch64_ps_get_thread_area (ph, lwpid, idx, base,
- is_64bit_tdesc ());
+ return aarch64_ps_get_thread_area (ph, lwpid, idx, base, is_64bit_tdesc ());
}
/* Implementation of linux target ops method "low_siginfo_fixup". */
bool
aarch64_target::low_siginfo_fixup (siginfo_t *native, gdb_byte *inf,
- int direction)
+ int direction)
{
/* Is the inferior 32-bit? If so, then fixup the siginfo object. */
if (!is_64bit_tdesc ())
{
if (direction == 0)
- aarch64_compat_siginfo_from_siginfo ((struct compat_siginfo *) inf,
- native);
+ aarch64_compat_siginfo_from_siginfo ((struct compat_siginfo *) inf,
+ native);
else
- aarch64_siginfo_from_compat_siginfo (native,
- (struct compat_siginfo *) inf);
+ aarch64_siginfo_from_compat_siginfo (native,
+ (struct compat_siginfo *) inf);
return true;
}
@@ -690,14 +685,11 @@ aarch64_target::low_delete_thread (arch_lwp_info *arch_lwp)
/* Implementation of linux target ops method "low_new_fork". */
void
-aarch64_target::low_new_fork (process_info *parent,
- process_info *child)
+aarch64_target::low_new_fork (process_info *parent, process_info *child)
{
/* These are allocated by linux_add_process. */
- gdb_assert (parent->priv != NULL
- && parent->priv->arch_private != NULL);
- gdb_assert (child->priv != NULL
- && child->priv->arch_private != NULL);
+ gdb_assert (parent->priv != NULL && parent->priv->arch_private != NULL);
+ gdb_assert (child->priv != NULL && child->priv->arch_private != NULL);
/* Linux kernel before 2.6.33 commit
72f674d203cd230426437cdcf7dd6f681dad8b0d
@@ -738,50 +730,39 @@ aarch64_sve_regs_copy_from_regcache (struct regcache *regcache, void *buf)
Their sizes are set to 0 here, but they will be adjusted later depending
on whether each register set is available or not. */
-static struct regset_info aarch64_regsets[] =
-{
+static struct regset_info aarch64_regsets[] = {
/* GPR registers. */
- { PTRACE_GETREGSET, PTRACE_SETREGSET, NT_PRSTATUS,
- 0, GENERAL_REGS,
+ { PTRACE_GETREGSET, PTRACE_SETREGSET, NT_PRSTATUS, 0, GENERAL_REGS,
aarch64_fill_gregset, aarch64_store_gregset },
/* Floating Point (FPU) registers. */
- { PTRACE_GETREGSET, PTRACE_SETREGSET, NT_FPREGSET,
- 0, FP_REGS,
- aarch64_fill_fpregset, aarch64_store_fpregset
- },
+ { PTRACE_GETREGSET, PTRACE_SETREGSET, NT_FPREGSET, 0, FP_REGS,
+ aarch64_fill_fpregset, aarch64_store_fpregset },
/* Scalable Vector Extension (SVE) registers. */
- { PTRACE_GETREGSET, PTRACE_SETREGSET, NT_ARM_SVE,
- 0, EXTENDED_REGS,
- aarch64_sve_regs_copy_from_regcache, aarch64_sve_regs_copy_to_regcache
- },
+ { PTRACE_GETREGSET, PTRACE_SETREGSET, NT_ARM_SVE, 0, EXTENDED_REGS,
+ aarch64_sve_regs_copy_from_regcache, aarch64_sve_regs_copy_to_regcache },
/* PAC registers. */
- { PTRACE_GETREGSET, PTRACE_SETREGSET, NT_ARM_PAC_MASK,
- 0, OPTIONAL_REGS,
+ { PTRACE_GETREGSET, PTRACE_SETREGSET, NT_ARM_PAC_MASK, 0, OPTIONAL_REGS,
nullptr, aarch64_store_pauthregset },
/* Tagged address control / MTE registers. */
- { PTRACE_GETREGSET, PTRACE_SETREGSET, NT_ARM_TAGGED_ADDR_CTRL,
- 0, OPTIONAL_REGS,
- aarch64_fill_mteregset, aarch64_store_mteregset },
+ { PTRACE_GETREGSET, PTRACE_SETREGSET, NT_ARM_TAGGED_ADDR_CTRL, 0,
+ OPTIONAL_REGS, aarch64_fill_mteregset, aarch64_store_mteregset },
/* TLS register. */
- { PTRACE_GETREGSET, PTRACE_SETREGSET, NT_ARM_TLS,
- 0, OPTIONAL_REGS,
+ { PTRACE_GETREGSET, PTRACE_SETREGSET, NT_ARM_TLS, 0, OPTIONAL_REGS,
aarch64_fill_tlsregset, aarch64_store_tlsregset },
NULL_REGSET
};
-static struct regsets_info aarch64_regsets_info =
- {
- aarch64_regsets, /* regsets */
- 0, /* num_regsets */
- nullptr, /* disabled_regsets */
- };
+static struct regsets_info aarch64_regsets_info = {
+ aarch64_regsets, /* regsets */
+ 0, /* num_regsets */
+ nullptr, /* disabled_regsets */
+};
-static struct regs_info regs_info_aarch64 =
- {
- nullptr, /* regset_bitmap */
- nullptr, /* usrregs */
- &aarch64_regsets_info,
- };
+static struct regs_info regs_info_aarch64 = {
+ nullptr, /* regset_bitmap */
+ nullptr, /* usrregs */
+ &aarch64_regsets_info,
+};
/* Given FEATURES, adjust the available register sets by setting their
sizes. A size of 0 means the register set is disabled and won't be
@@ -795,35 +776,35 @@ aarch64_adjust_register_sets (const struct aarch64_features &features)
for (regset = aarch64_regsets; regset->size >= 0; regset++)
{
switch (regset->nt_type)
- {
- case NT_PRSTATUS:
- /* General purpose registers are always present. */
- regset->size = sizeof (struct user_pt_regs);
- break;
- case NT_FPREGSET:
- /* This is unavailable when SVE is present. */
- if (features.vq == 0)
- regset->size = sizeof (struct user_fpsimd_state);
- break;
- case NT_ARM_SVE:
- if (features.vq > 0)
- regset->size = SVE_PT_SIZE (AARCH64_MAX_SVE_VQ, SVE_PT_REGS_SVE);
- break;
- case NT_ARM_PAC_MASK:
- if (features.pauth)
- regset->size = AARCH64_PAUTH_REGS_SIZE;
- break;
- case NT_ARM_TAGGED_ADDR_CTRL:
- if (features.mte)
- regset->size = AARCH64_LINUX_SIZEOF_MTE;
- break;
- case NT_ARM_TLS:
- if (features.tls > 0)
- regset->size = AARCH64_TLS_REGISTER_SIZE * features.tls;
- break;
- default:
- gdb_assert_not_reached ("Unknown register set found.");
- }
+ {
+ case NT_PRSTATUS:
+ /* General purpose registers are always present. */
+ regset->size = sizeof (struct user_pt_regs);
+ break;
+ case NT_FPREGSET:
+ /* This is unavailable when SVE is present. */
+ if (features.vq == 0)
+ regset->size = sizeof (struct user_fpsimd_state);
+ break;
+ case NT_ARM_SVE:
+ if (features.vq > 0)
+ regset->size = SVE_PT_SIZE (AARCH64_MAX_SVE_VQ, SVE_PT_REGS_SVE);
+ break;
+ case NT_ARM_PAC_MASK:
+ if (features.pauth)
+ regset->size = AARCH64_PAUTH_REGS_SIZE;
+ break;
+ case NT_ARM_TAGGED_ADDR_CTRL:
+ if (features.mte)
+ regset->size = AARCH64_LINUX_SIZEOF_MTE;
+ break;
+ case NT_ARM_TLS:
+ if (features.tls > 0)
+ regset->size = AARCH64_TLS_REGISTER_SIZE * features.tls;
+ break;
+ default:
+ gdb_assert_not_reached ("Unknown register set found.");
+ }
}
}
@@ -965,10 +946,10 @@ struct aarch64_operand
/* Value of the operand according to the type. */
union
- {
- uint32_t imm;
- struct aarch64_register reg;
- };
+ {
+ uint32_t imm;
+ struct aarch64_register reg;
+ };
};
/* List of registers that we are currently using, we can add more here as
@@ -1083,9 +1064,9 @@ postindex_memory_operand (int32_t index)
enum aarch64_system_control_registers
{
/* op0 op1 crn crm op2 */
- NZCV = (0x1 << 14) | (0x3 << 11) | (0x4 << 7) | (0x2 << 3) | 0x0,
- FPSR = (0x1 << 14) | (0x3 << 11) | (0x4 << 7) | (0x4 << 3) | 0x1,
- FPCR = (0x1 << 14) | (0x3 << 11) | (0x4 << 7) | (0x4 << 3) | 0x0,
+ NZCV = (0x1 << 14) | (0x3 << 11) | (0x4 << 7) | (0x2 << 3) | 0x0,
+ FPSR = (0x1 << 14) | (0x3 << 11) | (0x4 << 7) | (0x4 << 3) | 0x1,
+ FPCR = (0x1 << 14) | (0x3 << 11) | (0x4 << 7) | (0x4 << 3) | 0x0,
TPIDR_EL0 = (0x1 << 14) | (0x3 << 11) | (0xd << 7) | (0x0 << 3) | 0x2
};
@@ -1115,10 +1096,9 @@ emit_ret (uint32_t *buf, struct aarch64_register rn)
static int
emit_load_store_pair (uint32_t *buf, enum aarch64_opcodes opcode,
- struct aarch64_register rt,
- struct aarch64_register rt2,
- struct aarch64_register rn,
- struct aarch64_memory_operand operand)
+ struct aarch64_register rt, struct aarch64_register rt2,
+ struct aarch64_register rn,
+ struct aarch64_memory_operand operand)
{
uint32_t opc;
uint32_t pre_index;
@@ -1133,30 +1113,31 @@ emit_load_store_pair (uint32_t *buf, enum aarch64_opcodes opcode,
{
case MEMORY_OPERAND_OFFSET:
{
- pre_index = ENCODE (1, 1, 24);
- write_back = ENCODE (0, 1, 23);
- break;
+ pre_index = ENCODE (1, 1, 24);
+ write_back = ENCODE (0, 1, 23);
+ break;
}
case MEMORY_OPERAND_POSTINDEX:
{
- pre_index = ENCODE (0, 1, 24);
- write_back = ENCODE (1, 1, 23);
- break;
+ pre_index = ENCODE (0, 1, 24);
+ write_back = ENCODE (1, 1, 23);
+ break;
}
case MEMORY_OPERAND_PREINDEX:
{
- pre_index = ENCODE (1, 1, 24);
- write_back = ENCODE (1, 1, 23);
- break;
+ pre_index = ENCODE (1, 1, 24);
+ write_back = ENCODE (1, 1, 23);
+ break;
}
default:
return 0;
}
return aarch64_emit_insn (buf, opcode | opc | pre_index | write_back
- | ENCODE (operand.index >> 3, 7, 15)
- | ENCODE (rt2.num, 5, 10)
- | ENCODE (rn.num, 5, 5) | ENCODE (rt.num, 5, 0));
+ | ENCODE (operand.index >> 3, 7, 15)
+ | ENCODE (rt2.num, 5, 10)
+ | ENCODE (rn.num, 5, 5)
+ | ENCODE (rt.num, 5, 0));
}
/* Write a STP instruction into *BUF.
@@ -1172,8 +1153,8 @@ emit_load_store_pair (uint32_t *buf, enum aarch64_opcodes opcode,
static int
emit_stp (uint32_t *buf, struct aarch64_register rt,
- struct aarch64_register rt2, struct aarch64_register rn,
- struct aarch64_memory_operand operand)
+ struct aarch64_register rt2, struct aarch64_register rn,
+ struct aarch64_memory_operand operand)
{
return emit_load_store_pair (buf, STP, rt, rt2, rn, operand);
}
@@ -1191,8 +1172,8 @@ emit_stp (uint32_t *buf, struct aarch64_register rt,
static int
emit_ldp (uint32_t *buf, struct aarch64_register rt,
- struct aarch64_register rt2, struct aarch64_register rn,
- struct aarch64_memory_operand operand)
+ struct aarch64_register rt2, struct aarch64_register rn,
+ struct aarch64_memory_operand operand)
{
return emit_load_store_pair (buf, LDP, rt, rt2, rn, operand);
}
@@ -1208,15 +1189,16 @@ emit_ldp (uint32_t *buf, struct aarch64_register rt,
static int
emit_ldp_q_offset (uint32_t *buf, unsigned rt, unsigned rt2,
- struct aarch64_register rn, int32_t offset)
+ struct aarch64_register rn, int32_t offset)
{
uint32_t opc = ENCODE (2, 2, 30);
uint32_t pre_index = ENCODE (1, 1, 24);
return aarch64_emit_insn (buf, LDP_SIMD_VFP | opc | pre_index
- | ENCODE (offset >> 4, 7, 15)
- | ENCODE (rt2, 5, 10)
- | ENCODE (rn.num, 5, 5) | ENCODE (rt, 5, 0));
+ | ENCODE (offset >> 4, 7, 15)
+ | ENCODE (rt2, 5, 10)
+ | ENCODE (rn.num, 5, 5)
+ | ENCODE (rt, 5, 0));
}
/* Write a STP (SIMD&VFP) instruction using Q registers into *BUF.
@@ -1230,15 +1212,16 @@ emit_ldp_q_offset (uint32_t *buf, unsigned rt, unsigned rt2,
static int
emit_stp_q_offset (uint32_t *buf, unsigned rt, unsigned rt2,
- struct aarch64_register rn, int32_t offset)
+ struct aarch64_register rn, int32_t offset)
{
uint32_t opc = ENCODE (2, 2, 30);
uint32_t pre_index = ENCODE (1, 1, 24);
return aarch64_emit_insn (buf, STP_SIMD_VFP | opc | pre_index
- | ENCODE (offset >> 4, 7, 15)
- | ENCODE (rt2, 5, 10)
- | ENCODE (rn.num, 5, 5) | ENCODE (rt, 5, 0));
+ | ENCODE (offset >> 4, 7, 15)
+ | ENCODE (rt2, 5, 10)
+ | ENCODE (rn.num, 5, 5)
+ | ENCODE (rt, 5, 0));
}
/* Write a LDRH instruction into *BUF.
@@ -1254,8 +1237,7 @@ emit_stp_q_offset (uint32_t *buf, unsigned rt, unsigned rt2,
static int
emit_ldrh (uint32_t *buf, struct aarch64_register rt,
- struct aarch64_register rn,
- struct aarch64_memory_operand operand)
+ struct aarch64_register rn, struct aarch64_memory_operand operand)
{
return aarch64_emit_load_store (buf, 1, LDR, rt, rn, operand);
}
@@ -1273,14 +1255,11 @@ emit_ldrh (uint32_t *buf, struct aarch64_register rt,
static int
emit_ldrb (uint32_t *buf, struct aarch64_register rt,
- struct aarch64_register rn,
- struct aarch64_memory_operand operand)
+ struct aarch64_register rn, struct aarch64_memory_operand operand)
{
return aarch64_emit_load_store (buf, 0, LDR, rt, rn, operand);
}
-
-
/* Write a STR instruction into *BUF.
STR rt, [rn, #offset]
@@ -1294,8 +1273,7 @@ emit_ldrb (uint32_t *buf, struct aarch64_register rt,
static int
emit_str (uint32_t *buf, struct aarch64_register rt,
- struct aarch64_register rn,
- struct aarch64_memory_operand operand)
+ struct aarch64_register rn, struct aarch64_memory_operand operand)
{
return aarch64_emit_load_store (buf, rt.is64 ? 3 : 2, STR, rt, rn, operand);
}
@@ -1304,15 +1282,17 @@ emit_str (uint32_t *buf, struct aarch64_register rt,
static int
emit_load_store_exclusive (uint32_t *buf, uint32_t size,
- enum aarch64_opcodes opcode,
- struct aarch64_register rs,
- struct aarch64_register rt,
- struct aarch64_register rt2,
- struct aarch64_register rn)
+ enum aarch64_opcodes opcode,
+ struct aarch64_register rs,
+ struct aarch64_register rt,
+ struct aarch64_register rt2,
+ struct aarch64_register rn)
{
return aarch64_emit_insn (buf, opcode | ENCODE (size, 2, 30)
- | ENCODE (rs.num, 5, 16) | ENCODE (rt2.num, 5, 10)
- | ENCODE (rn.num, 5, 5) | ENCODE (rt.num, 5, 0));
+ | ENCODE (rs.num, 5, 16)
+ | ENCODE (rt2.num, 5, 10)
+ | ENCODE (rn.num, 5, 5)
+ | ENCODE (rt.num, 5, 0));
}
/* Write a LAXR instruction into *BUF.
@@ -1324,10 +1304,10 @@ emit_load_store_exclusive (uint32_t *buf, uint32_t size,
static int
emit_ldaxr (uint32_t *buf, struct aarch64_register rt,
- struct aarch64_register rn)
+ struct aarch64_register rn)
{
- return emit_load_store_exclusive (buf, rt.is64 ? 3 : 2, LDAXR, xzr, rt,
- xzr, rn);
+ return emit_load_store_exclusive (buf, rt.is64 ? 3 : 2, LDAXR, xzr, rt, xzr,
+ rn);
}
/* Write a STXR instruction into *BUF.
@@ -1340,10 +1320,10 @@ emit_ldaxr (uint32_t *buf, struct aarch64_register rt,
static int
emit_stxr (uint32_t *buf, struct aarch64_register rs,
- struct aarch64_register rt, struct aarch64_register rn)
+ struct aarch64_register rt, struct aarch64_register rn)
{
- return emit_load_store_exclusive (buf, rt.is64 ? 3 : 2, STXR, rs, rt,
- xzr, rn);
+ return emit_load_store_exclusive (buf, rt.is64 ? 3 : 2, STXR, rs, rt, xzr,
+ rn);
}
/* Write a STLR instruction into *BUF.
@@ -1355,24 +1335,25 @@ emit_stxr (uint32_t *buf, struct aarch64_register rs,
static int
emit_stlr (uint32_t *buf, struct aarch64_register rt,
- struct aarch64_register rn)
+ struct aarch64_register rn)
{
- return emit_load_store_exclusive (buf, rt.is64 ? 3 : 2, STLR, xzr, rt,
- xzr, rn);
+ return emit_load_store_exclusive (buf, rt.is64 ? 3 : 2, STLR, xzr, rt, xzr,
+ rn);
}
/* Helper function for data processing instructions with register sources. */
static int
emit_data_processing_reg (uint32_t *buf, uint32_t opcode,
- struct aarch64_register rd,
- struct aarch64_register rn,
- struct aarch64_register rm)
+ struct aarch64_register rd,
+ struct aarch64_register rn,
+ struct aarch64_register rm)
{
uint32_t size = ENCODE (rd.is64, 1, 31);
return aarch64_emit_insn (buf, opcode | size | ENCODE (rm.num, 5, 16)
- | ENCODE (rn.num, 5, 5) | ENCODE (rd.num, 5, 0));
+ | ENCODE (rn.num, 5, 5)
+ | ENCODE (rd.num, 5, 0));
}
/* Helper function for data processing instructions taking either a register
@@ -1380,9 +1361,8 @@ emit_data_processing_reg (uint32_t *buf, uint32_t opcode,
static int
emit_data_processing (uint32_t *buf, enum aarch64_opcodes opcode,
- struct aarch64_register rd,
- struct aarch64_register rn,
- struct aarch64_operand operand)
+ struct aarch64_register rd, struct aarch64_register rn,
+ struct aarch64_operand operand)
{
uint32_t size = ENCODE (rd.is64, 1, 31);
/* The opcode is different for register and immediate source operands. */
@@ -1394,17 +1374,17 @@ emit_data_processing (uint32_t *buf, enum aarch64_opcodes opcode,
operand_opcode = ENCODE (8, 4, 25);
return aarch64_emit_insn (buf, opcode | operand_opcode | size
- | ENCODE (operand.imm, 12, 10)
- | ENCODE (rn.num, 5, 5)
- | ENCODE (rd.num, 5, 0));
+ | ENCODE (operand.imm, 12, 10)
+ | ENCODE (rn.num, 5, 5)
+ | ENCODE (rd.num, 5, 0));
}
else
{
/* xxx0 101x xxxx xxxx xxxx xxxx xxxx xxxx */
operand_opcode = ENCODE (5, 4, 25);
- return emit_data_processing_reg (buf, opcode | operand_opcode, rd,
- rn, operand.reg);
+ return emit_data_processing_reg (buf, opcode | operand_opcode, rd, rn,
+ operand.reg);
}
}
@@ -1422,7 +1402,7 @@ emit_data_processing (uint32_t *buf, enum aarch64_opcodes opcode,
static int
emit_add (uint32_t *buf, struct aarch64_register rd,
- struct aarch64_register rn, struct aarch64_operand operand)
+ struct aarch64_register rn, struct aarch64_operand operand)
{
return emit_data_processing (buf, ADD, rd, rn, operand);
}
@@ -1440,7 +1420,7 @@ emit_add (uint32_t *buf, struct aarch64_register rd,
static int
emit_sub (uint32_t *buf, struct aarch64_register rd,
- struct aarch64_register rn, struct aarch64_operand operand)
+ struct aarch64_register rn, struct aarch64_operand operand)
{
return emit_data_processing (buf, SUB, rd, rn, operand);
}
@@ -1461,7 +1441,7 @@ emit_sub (uint32_t *buf, struct aarch64_register rd,
static int
emit_mov (uint32_t *buf, struct aarch64_register rd,
- struct aarch64_operand operand)
+ struct aarch64_operand operand)
{
if (operand.type == OPERAND_IMMEDIATE)
{
@@ -1470,8 +1450,8 @@ emit_mov (uint32_t *buf, struct aarch64_register rd,
uint32_t shift = ENCODE (0, 2, 21);
return aarch64_emit_insn (buf, MOV | size | shift
- | ENCODE (operand.imm, 16, 5)
- | ENCODE (rd.num, 5, 0));
+ | ENCODE (operand.imm, 16, 5)
+ | ENCODE (rd.num, 5, 0));
}
else
return emit_add (buf, rd, operand.reg, immediate_operand (0));
@@ -1487,12 +1467,13 @@ emit_mov (uint32_t *buf, struct aarch64_register rd,
static int
emit_movk (uint32_t *buf, struct aarch64_register rd, uint32_t imm,
- unsigned shift)
+ unsigned shift)
{
uint32_t size = ENCODE (rd.is64, 1, 31);
- return aarch64_emit_insn (buf, MOVK | size | ENCODE (shift, 2, 21) |
- ENCODE (imm, 16, 5) | ENCODE (rd.num, 5, 0));
+ return aarch64_emit_insn (buf, MOVK | size | ENCODE (shift, 2, 21)
+ | ENCODE (imm, 16, 5)
+ | ENCODE (rd.num, 5, 0));
}
/* Write instructions into *BUF in order to move ADDR into a register.
@@ -1541,7 +1522,7 @@ emit_mov_addr (uint32_t *buf, struct aarch64_register rd, CORE_ADDR addr)
static int
emit_subs (uint32_t *buf, struct aarch64_register rd,
- struct aarch64_register rn, struct aarch64_operand operand)
+ struct aarch64_register rn, struct aarch64_operand operand)
{
return emit_data_processing (buf, SUBS, rd, rn, operand);
}
@@ -1556,7 +1537,7 @@ emit_subs (uint32_t *buf, struct aarch64_register rd,
static int
emit_cmp (uint32_t *buf, struct aarch64_register rn,
- struct aarch64_operand operand)
+ struct aarch64_operand operand)
{
return emit_subs (buf, xzr, rn, operand);
}
@@ -1570,7 +1551,7 @@ emit_cmp (uint32_t *buf, struct aarch64_register rn,
static int
emit_and (uint32_t *buf, struct aarch64_register rd,
- struct aarch64_register rn, struct aarch64_register rm)
+ struct aarch64_register rn, struct aarch64_register rm)
{
return emit_data_processing_reg (buf, AND, rd, rn, rm);
}
@@ -1584,7 +1565,7 @@ emit_and (uint32_t *buf, struct aarch64_register rd,
static int
emit_orr (uint32_t *buf, struct aarch64_register rd,
- struct aarch64_register rn, struct aarch64_register rm)
+ struct aarch64_register rn, struct aarch64_register rm)
{
return emit_data_processing_reg (buf, ORR, rd, rn, rm);
}
@@ -1598,7 +1579,7 @@ emit_orr (uint32_t *buf, struct aarch64_register rd,
static int
emit_orn (uint32_t *buf, struct aarch64_register rd,
- struct aarch64_register rn, struct aarch64_register rm)
+ struct aarch64_register rn, struct aarch64_register rm)
{
return emit_data_processing_reg (buf, ORN, rd, rn, rm);
}
@@ -1612,7 +1593,7 @@ emit_orn (uint32_t *buf, struct aarch64_register rd,
static int
emit_eor (uint32_t *buf, struct aarch64_register rd,
- struct aarch64_register rn, struct aarch64_register rm)
+ struct aarch64_register rn, struct aarch64_register rm)
{
return emit_data_processing_reg (buf, EOR, rd, rn, rm);
}
@@ -1628,7 +1609,7 @@ emit_eor (uint32_t *buf, struct aarch64_register rd,
static int
emit_mvn (uint32_t *buf, struct aarch64_register rd,
- struct aarch64_register rm)
+ struct aarch64_register rm)
{
return emit_orn (buf, rd, xzr, rm);
}
@@ -1642,7 +1623,7 @@ emit_mvn (uint32_t *buf, struct aarch64_register rd,
static int
emit_lslv (uint32_t *buf, struct aarch64_register rd,
- struct aarch64_register rn, struct aarch64_register rm)
+ struct aarch64_register rn, struct aarch64_register rm)
{
return emit_data_processing_reg (buf, LSLV, rd, rn, rm);
}
@@ -1656,7 +1637,7 @@ emit_lslv (uint32_t *buf, struct aarch64_register rd,
static int
emit_lsrv (uint32_t *buf, struct aarch64_register rd,
- struct aarch64_register rn, struct aarch64_register rm)
+ struct aarch64_register rn, struct aarch64_register rm)
{
return emit_data_processing_reg (buf, LSRV, rd, rn, rm);
}
@@ -1670,7 +1651,7 @@ emit_lsrv (uint32_t *buf, struct aarch64_register rd,
static int
emit_asrv (uint32_t *buf, struct aarch64_register rd,
- struct aarch64_register rn, struct aarch64_register rm)
+ struct aarch64_register rn, struct aarch64_register rm)
{
return emit_data_processing_reg (buf, ASRV, rd, rn, rm);
}
@@ -1684,7 +1665,7 @@ emit_asrv (uint32_t *buf, struct aarch64_register rd,
static int
emit_mul (uint32_t *buf, struct aarch64_register rd,
- struct aarch64_register rn, struct aarch64_register rm)
+ struct aarch64_register rn, struct aarch64_register rm)
{
return emit_data_processing_reg (buf, MUL, rd, rn, rm);
}
@@ -1698,10 +1679,10 @@ emit_mul (uint32_t *buf, struct aarch64_register rd,
static int
emit_mrs (uint32_t *buf, struct aarch64_register rt,
- enum aarch64_system_control_registers system_reg)
+ enum aarch64_system_control_registers system_reg)
{
return aarch64_emit_insn (buf, MRS | ENCODE (system_reg, 15, 5)
- | ENCODE (rt.num, 5, 0));
+ | ENCODE (rt.num, 5, 0));
}
/* Write a MSR instruction into *BUF. The register size is 64-bit.
@@ -1713,10 +1694,10 @@ emit_mrs (uint32_t *buf, struct aarch64_register rt,
static int
emit_msr (uint32_t *buf, enum aarch64_system_control_registers system_reg,
- struct aarch64_register rt)
+ struct aarch64_register rt)
{
return aarch64_emit_insn (buf, MSR | ENCODE (system_reg, 15, 5)
- | ENCODE (rt.num, 5, 0));
+ | ENCODE (rt.num, 5, 0));
}
/* Write a SEVL instruction into *BUF.
@@ -1753,14 +1734,15 @@ emit_wfe (uint32_t *buf)
static int
emit_sbfm (uint32_t *buf, struct aarch64_register rd,
- struct aarch64_register rn, uint32_t immr, uint32_t imms)
+ struct aarch64_register rn, uint32_t immr, uint32_t imms)
{
uint32_t size = ENCODE (rd.is64, 1, 31);
uint32_t n = ENCODE (rd.is64, 1, 22);
return aarch64_emit_insn (buf, SBFM | size | n | ENCODE (immr, 6, 16)
- | ENCODE (imms, 6, 10) | ENCODE (rn.num, 5, 5)
- | ENCODE (rd.num, 5, 0));
+ | ENCODE (imms, 6, 10)
+ | ENCODE (rn.num, 5, 5)
+ | ENCODE (rd.num, 5, 0));
}
/* Write a SBFX instruction into *BUF.
@@ -1779,7 +1761,7 @@ emit_sbfm (uint32_t *buf, struct aarch64_register rd,
static int
emit_sbfx (uint32_t *buf, struct aarch64_register rd,
- struct aarch64_register rn, uint32_t lsb, uint32_t width)
+ struct aarch64_register rn, uint32_t lsb, uint32_t width)
{
return emit_sbfm (buf, rd, rn, lsb, lsb + width - 1);
}
@@ -1798,14 +1780,15 @@ emit_sbfx (uint32_t *buf, struct aarch64_register rd,
static int
emit_ubfm (uint32_t *buf, struct aarch64_register rd,
- struct aarch64_register rn, uint32_t immr, uint32_t imms)
+ struct aarch64_register rn, uint32_t immr, uint32_t imms)
{
uint32_t size = ENCODE (rd.is64, 1, 31);
uint32_t n = ENCODE (rd.is64, 1, 22);
return aarch64_emit_insn (buf, UBFM | size | n | ENCODE (immr, 6, 16)
- | ENCODE (imms, 6, 10) | ENCODE (rn.num, 5, 5)
- | ENCODE (rd.num, 5, 0));
+ | ENCODE (imms, 6, 10)
+ | ENCODE (rn.num, 5, 5)
+ | ENCODE (rd.num, 5, 0));
}
/* Write a UBFX instruction into *BUF.
@@ -1824,7 +1807,7 @@ emit_ubfm (uint32_t *buf, struct aarch64_register rd,
static int
emit_ubfx (uint32_t *buf, struct aarch64_register rd,
- struct aarch64_register rn, uint32_t lsb, uint32_t width)
+ struct aarch64_register rn, uint32_t lsb, uint32_t width)
{
return emit_ubfm (buf, rd, rn, lsb, lsb + width - 1);
}
@@ -1842,14 +1825,15 @@ emit_ubfx (uint32_t *buf, struct aarch64_register rd,
static int
emit_csinc (uint32_t *buf, struct aarch64_register rd,
- struct aarch64_register rn, struct aarch64_register rm,
- unsigned cond)
+ struct aarch64_register rn, struct aarch64_register rm,
+ unsigned cond)
{
uint32_t size = ENCODE (rd.is64, 1, 31);
return aarch64_emit_insn (buf, CSINC | size | ENCODE (rm.num, 5, 16)
- | ENCODE (cond, 4, 12) | ENCODE (rn.num, 5, 5)
- | ENCODE (rd.num, 5, 0));
+ | ENCODE (cond, 4, 12)
+ | ENCODE (rn.num, 5, 5)
+ | ENCODE (rd.num, 5, 0));
}
/* Write a CSET instruction into *BUF.
@@ -1919,7 +1903,7 @@ struct aarch64_insn_relocation_data
static void
aarch64_ftrace_insn_reloc_b (const int is_bl, const int32_t offset,
- struct aarch64_insn_data *data)
+ struct aarch64_insn_data *data)
{
struct aarch64_insn_relocation_data *insn_reloc
= (struct aarch64_insn_relocation_data *) data;
@@ -1934,7 +1918,7 @@ aarch64_ftrace_insn_reloc_b (const int is_bl, const int32_t offset,
static void
aarch64_ftrace_insn_reloc_b_cond (const unsigned cond, const int32_t offset,
- struct aarch64_insn_data *data)
+ struct aarch64_insn_data *data)
{
struct aarch64_insn_relocation_data *insn_reloc
= (struct aarch64_insn_relocation_data *) data;
@@ -1943,8 +1927,8 @@ aarch64_ftrace_insn_reloc_b_cond (const unsigned cond, const int32_t offset,
if (can_encode_int32 (new_offset, 21))
{
- insn_reloc->insn_ptr += emit_bcond (insn_reloc->insn_ptr, cond,
- new_offset);
+ insn_reloc->insn_ptr
+ += emit_bcond (insn_reloc->insn_ptr, cond, new_offset);
}
else if (can_encode_int32 (new_offset, 28))
{
@@ -1970,8 +1954,8 @@ aarch64_ftrace_insn_reloc_b_cond (const unsigned cond, const int32_t offset,
static void
aarch64_ftrace_insn_reloc_cb (const int32_t offset, const int is_cbnz,
- const unsigned rn, int is64,
- struct aarch64_insn_data *data)
+ const unsigned rn, int is64,
+ struct aarch64_insn_data *data)
{
struct aarch64_insn_relocation_data *insn_reloc
= (struct aarch64_insn_relocation_data *) data;
@@ -1980,8 +1964,9 @@ aarch64_ftrace_insn_reloc_cb (const int32_t offset, const int is_cbnz,
if (can_encode_int32 (new_offset, 21))
{
- insn_reloc->insn_ptr += emit_cb (insn_reloc->insn_ptr, is_cbnz,
- aarch64_register (rn, is64), new_offset);
+ insn_reloc->insn_ptr
+ += emit_cb (insn_reloc->insn_ptr, is_cbnz, aarch64_register (rn, is64),
+ new_offset);
}
else if (can_encode_int32 (new_offset, 28))
{
@@ -1997,7 +1982,7 @@ aarch64_ftrace_insn_reloc_cb (const int32_t offset, const int is_cbnz,
*/
insn_reloc->insn_ptr += emit_cb (insn_reloc->insn_ptr, is_cbnz,
- aarch64_register (rn, is64), 8);
+ aarch64_register (rn, is64), 8);
insn_reloc->insn_ptr += emit_b (insn_reloc->insn_ptr, 0, 8);
insn_reloc->insn_ptr += emit_b (insn_reloc->insn_ptr, 0, new_offset - 8);
}
@@ -2007,8 +1992,8 @@ aarch64_ftrace_insn_reloc_cb (const int32_t offset, const int is_cbnz,
static void
aarch64_ftrace_insn_reloc_tb (const int32_t offset, int is_tbnz,
- const unsigned rt, unsigned bit,
- struct aarch64_insn_data *data)
+ const unsigned rt, unsigned bit,
+ struct aarch64_insn_data *data)
{
struct aarch64_insn_relocation_data *insn_reloc
= (struct aarch64_insn_relocation_data *) data;
@@ -2018,7 +2003,7 @@ aarch64_ftrace_insn_reloc_tb (const int32_t offset, int is_tbnz,
if (can_encode_int32 (new_offset, 16))
{
insn_reloc->insn_ptr += emit_tb (insn_reloc->insn_ptr, is_tbnz, bit,
- aarch64_register (rt, 1), new_offset);
+ aarch64_register (rt, 1), new_offset);
}
else if (can_encode_int32 (new_offset, 28))
{
@@ -2034,10 +2019,9 @@ aarch64_ftrace_insn_reloc_tb (const int32_t offset, int is_tbnz,
*/
insn_reloc->insn_ptr += emit_tb (insn_reloc->insn_ptr, is_tbnz, bit,
- aarch64_register (rt, 1), 8);
+ aarch64_register (rt, 1), 8);
insn_reloc->insn_ptr += emit_b (insn_reloc->insn_ptr, 0, 8);
- insn_reloc->insn_ptr += emit_b (insn_reloc->insn_ptr, 0,
- new_offset - 8);
+ insn_reloc->insn_ptr += emit_b (insn_reloc->insn_ptr, 0, new_offset - 8);
}
}
@@ -2045,8 +2029,8 @@ aarch64_ftrace_insn_reloc_tb (const int32_t offset, int is_tbnz,
static void
aarch64_ftrace_insn_reloc_adr (const int32_t offset, const unsigned rd,
- const int is_adrp,
- struct aarch64_insn_data *data)
+ const int is_adrp,
+ struct aarch64_insn_data *data)
{
struct aarch64_insn_relocation_data *insn_reloc
= (struct aarch64_insn_relocation_data *) data;
@@ -2057,28 +2041,28 @@ aarch64_ftrace_insn_reloc_adr (const int32_t offset, const unsigned rd,
if (is_adrp)
{
/* Clear the lower 12 bits of the offset to get the 4K page. */
- insn_reloc->insn_ptr += emit_mov_addr (insn_reloc->insn_ptr,
- aarch64_register (rd, 1),
- address & ~0xfff);
+ insn_reloc->insn_ptr
+ += emit_mov_addr (insn_reloc->insn_ptr, aarch64_register (rd, 1),
+ address & ~0xfff);
}
else
insn_reloc->insn_ptr += emit_mov_addr (insn_reloc->insn_ptr,
- aarch64_register (rd, 1), address);
+ aarch64_register (rd, 1), address);
}
/* Implementation of aarch64_insn_visitor method "ldr_literal". */
static void
aarch64_ftrace_insn_reloc_ldr_literal (const int32_t offset, const int is_sw,
- const unsigned rt, const int is64,
- struct aarch64_insn_data *data)
+ const unsigned rt, const int is64,
+ struct aarch64_insn_data *data)
{
struct aarch64_insn_relocation_data *insn_reloc
= (struct aarch64_insn_relocation_data *) data;
CORE_ADDR address = data->insn_addr + offset;
- insn_reloc->insn_ptr += emit_mov_addr (insn_reloc->insn_ptr,
- aarch64_register (rt, 1), address);
+ insn_reloc->insn_ptr
+ += emit_mov_addr (insn_reloc->insn_ptr, aarch64_register (rt, 1), address);
/* We know exactly what address to load from, and what register we
can use:
@@ -2092,22 +2076,20 @@ aarch64_ftrace_insn_reloc_ldr_literal (const int32_t offset, const int is_sw,
*/
if (is_sw)
- insn_reloc->insn_ptr += emit_ldrsw (insn_reloc->insn_ptr,
- aarch64_register (rt, 1),
- aarch64_register (rt, 1),
- offset_memory_operand (0));
+ insn_reloc->insn_ptr
+ += emit_ldrsw (insn_reloc->insn_ptr, aarch64_register (rt, 1),
+ aarch64_register (rt, 1), offset_memory_operand (0));
else
- insn_reloc->insn_ptr += emit_ldr (insn_reloc->insn_ptr,
- aarch64_register (rt, is64),
- aarch64_register (rt, 1),
- offset_memory_operand (0));
+ insn_reloc->insn_ptr
+ += emit_ldr (insn_reloc->insn_ptr, aarch64_register (rt, is64),
+ aarch64_register (rt, 1), offset_memory_operand (0));
}
/* Implementation of aarch64_insn_visitor method "others". */
static void
aarch64_ftrace_insn_reloc_others (const uint32_t insn,
- struct aarch64_insn_data *data)
+ struct aarch64_insn_data *data)
{
struct aarch64_insn_relocation_data *insn_reloc
= (struct aarch64_insn_relocation_data *) data;
@@ -2117,14 +2099,10 @@ aarch64_ftrace_insn_reloc_others (const uint32_t insn,
insn_reloc->insn_ptr += aarch64_emit_insn (insn_reloc->insn_ptr, insn);
}
-static const struct aarch64_insn_visitor visitor =
-{
- aarch64_ftrace_insn_reloc_b,
- aarch64_ftrace_insn_reloc_b_cond,
- aarch64_ftrace_insn_reloc_cb,
- aarch64_ftrace_insn_reloc_tb,
- aarch64_ftrace_insn_reloc_adr,
- aarch64_ftrace_insn_reloc_ldr_literal,
+static const struct aarch64_insn_visitor visitor = {
+ aarch64_ftrace_insn_reloc_b, aarch64_ftrace_insn_reloc_b_cond,
+ aarch64_ftrace_insn_reloc_cb, aarch64_ftrace_insn_reloc_tb,
+ aarch64_ftrace_insn_reloc_adr, aarch64_ftrace_insn_reloc_ldr_literal,
aarch64_ftrace_insn_reloc_others,
};
@@ -2138,13 +2116,12 @@ aarch64_target::supports_fast_tracepoints ()
"install_fast_tracepoint_jump_pad". */
int
-aarch64_target::install_fast_tracepoint_jump_pad
- (CORE_ADDR tpoint, CORE_ADDR tpaddr, CORE_ADDR collector,
- CORE_ADDR lockaddr, ULONGEST orig_size, CORE_ADDR *jump_entry,
- CORE_ADDR *trampoline, ULONGEST *trampoline_size,
- unsigned char *jjump_pad_insn, ULONGEST *jjump_pad_insn_size,
- CORE_ADDR *adjusted_insn_addr, CORE_ADDR *adjusted_insn_addr_end,
- char *err)
+aarch64_target::install_fast_tracepoint_jump_pad (
+ CORE_ADDR tpoint, CORE_ADDR tpaddr, CORE_ADDR collector, CORE_ADDR lockaddr,
+ ULONGEST orig_size, CORE_ADDR *jump_entry, CORE_ADDR *trampoline,
+ ULONGEST *trampoline_size, unsigned char *jjump_pad_insn,
+ ULONGEST *jjump_pad_insn_size, CORE_ADDR *adjusted_insn_addr,
+ CORE_ADDR *adjusted_insn_addr_end, char *err)
{
uint32_t buf[256];
uint32_t *p = buf;
@@ -2229,7 +2206,7 @@ aarch64_target::install_fast_tracepoint_jump_pad
p += emit_sub (p, sp, sp, immediate_operand (31 * 16));
for (i = 30; i >= 0; i -= 1)
p += emit_str (p, aarch64_register (i, 1), sp,
- offset_memory_operand (i * 16));
+ offset_memory_operand (i * 16));
/* Make space for 5 more cells.
@@ -2238,7 +2215,6 @@ aarch64_target::install_fast_tracepoint_jump_pad
*/
p += emit_sub (p, sp, sp, immediate_operand (5 * 16));
-
/* Save SP:
ADD x4, sp, #((32 + 31 + 5) * 16)
@@ -2433,7 +2409,7 @@ aarch64_target::install_fast_tracepoint_jump_pad
*/
for (i = 0; i <= 30; i += 1)
p += emit_ldr (p, aarch64_register (i, 1), sp,
- offset_memory_operand (i * 16));
+ offset_memory_operand (i * 16));
p += emit_add (p, sp, sp, immediate_operand (31 * 16));
/* Pop SIMD&FP registers:
@@ -2461,15 +2437,14 @@ aarch64_target::install_fast_tracepoint_jump_pad
insn_data.insn_ptr = buf;
aarch64_relocate_instruction (insn, &visitor,
- (struct aarch64_insn_data *) &insn_data);
+ (struct aarch64_insn_data *) &insn_data);
/* We may not have been able to relocate the instruction. */
if (insn_data.insn_ptr == buf)
{
- sprintf (err,
- "E.Could not relocate instruction from %s to %s.",
- core_addr_to_string_nz (tpaddr),
- core_addr_to_string_nz (buildaddr));
+ sprintf (err, "E.Could not relocate instruction from %s to %s.",
+ core_addr_to_string_nz (tpaddr),
+ core_addr_to_string_nz (buildaddr));
return 1;
}
else
@@ -2484,9 +2459,9 @@ aarch64_target::install_fast_tracepoint_jump_pad
if (!can_encode_int32 (offset, 28))
{
sprintf (err,
- "E.Jump back from jump pad too far from tracepoint "
- "(offset 0x%" PRIx64 " cannot be encoded in 28 bits).",
- offset);
+ "E.Jump back from jump pad too far from tracepoint "
+ "(offset 0x%" PRIx64 " cannot be encoded in 28 bits).",
+ offset);
return 1;
}
@@ -2498,9 +2473,9 @@ aarch64_target::install_fast_tracepoint_jump_pad
if (!can_encode_int32 (offset, 28))
{
sprintf (err,
- "E.Jump pad too far from tracepoint "
- "(offset 0x%" PRIx64 " cannot be encoded in 28 bits).",
- offset);
+ "E.Jump pad too far from tracepoint "
+ "(offset 0x%" PRIx64 " cannot be encoded in 28 bits).",
+ offset);
return 1;
}
@@ -2521,8 +2496,8 @@ emit_ops_insns (const uint32_t *start, int len)
{
CORE_ADDR buildaddr = current_insn_ptr;
- threads_debug_printf ("Adding %d instrucions at %s",
- len, paddress (buildaddr));
+ threads_debug_printf ("Adding %d instrucions at %s", len,
+ paddress (buildaddr));
append_insns (&buildaddr, len, start);
current_insn_ptr = buildaddr;
@@ -2586,7 +2561,6 @@ aarch64_emit_prologue (void)
p += emit_add (p, fp, sp, immediate_operand (2 * 8));
-
emit_ops_insns (buf, p - buf);
}
@@ -3203,44 +3177,25 @@ aarch64_emit_ge_got (int *offset_p, int *size_p)
emit_ops_insns (buf, p - buf);
}
-static struct emit_ops aarch64_emit_ops_impl =
-{
- aarch64_emit_prologue,
- aarch64_emit_epilogue,
- aarch64_emit_add,
- aarch64_emit_sub,
- aarch64_emit_mul,
- aarch64_emit_lsh,
- aarch64_emit_rsh_signed,
- aarch64_emit_rsh_unsigned,
- aarch64_emit_ext,
- aarch64_emit_log_not,
- aarch64_emit_bit_and,
- aarch64_emit_bit_or,
- aarch64_emit_bit_xor,
- aarch64_emit_bit_not,
- aarch64_emit_equal,
- aarch64_emit_less_signed,
- aarch64_emit_less_unsigned,
- aarch64_emit_ref,
- aarch64_emit_if_goto,
- aarch64_emit_goto,
- aarch64_write_goto_address,
- aarch64_emit_const,
- aarch64_emit_call,
- aarch64_emit_reg,
- aarch64_emit_pop,
- aarch64_emit_stack_flush,
- aarch64_emit_zero_ext,
- aarch64_emit_swap,
- aarch64_emit_stack_adjust,
- aarch64_emit_int_call_1,
- aarch64_emit_void_call_2,
- aarch64_emit_eq_goto,
- aarch64_emit_ne_goto,
- aarch64_emit_lt_goto,
- aarch64_emit_le_goto,
- aarch64_emit_gt_goto,
+static struct emit_ops aarch64_emit_ops_impl = {
+ aarch64_emit_prologue, aarch64_emit_epilogue,
+ aarch64_emit_add, aarch64_emit_sub,
+ aarch64_emit_mul, aarch64_emit_lsh,
+ aarch64_emit_rsh_signed, aarch64_emit_rsh_unsigned,
+ aarch64_emit_ext, aarch64_emit_log_not,
+ aarch64_emit_bit_and, aarch64_emit_bit_or,
+ aarch64_emit_bit_xor, aarch64_emit_bit_not,
+ aarch64_emit_equal, aarch64_emit_less_signed,
+ aarch64_emit_less_unsigned, aarch64_emit_ref,
+ aarch64_emit_if_goto, aarch64_emit_goto,
+ aarch64_write_goto_address, aarch64_emit_const,
+ aarch64_emit_call, aarch64_emit_reg,
+ aarch64_emit_pop, aarch64_emit_stack_flush,
+ aarch64_emit_zero_ext, aarch64_emit_swap,
+ aarch64_emit_stack_adjust, aarch64_emit_int_call_1,
+ aarch64_emit_void_call_2, aarch64_emit_eq_goto,
+ aarch64_emit_ne_goto, aarch64_emit_lt_goto,
+ aarch64_emit_le_goto, aarch64_emit_gt_goto,
aarch64_emit_ge_got,
};
@@ -3328,13 +3283,13 @@ aarch64_target::supports_memory_tagging ()
bool
aarch64_target::fetch_memtags (CORE_ADDR address, size_t len,
- gdb::byte_vector &tags, int type)
+ gdb::byte_vector &tags, int type)
{
/* Allocation tags are per-process, so any tid is fine. */
int tid = lwpid_of (current_thread);
/* Allocation tag? */
- if (type == static_cast <int> (aarch64_memtag_type::mte_allocation))
+ if (type == static_cast<int> (aarch64_memtag_type::mte_allocation))
return aarch64_mte_fetch_memtags (tid, address, len, tags);
return false;
@@ -3342,13 +3297,13 @@ aarch64_target::fetch_memtags (CORE_ADDR address, size_t len,
bool
aarch64_target::store_memtags (CORE_ADDR address, size_t len,
- const gdb::byte_vector &tags, int type)
+ const gdb::byte_vector &tags, int type)
{
/* Allocation tags are per-process, so any tid is fine. */
int tid = lwpid_of (current_thread);
/* Allocation tag? */
- if (type == static_cast <int> (aarch64_memtag_type::mte_allocation))
+ if (type == static_cast<int> (aarch64_memtag_type::mte_allocation))
return aarch64_mte_store_memtags (tid, address, len, tags);
return false;
diff --git a/gdbserver/linux-aarch64-tdesc.cc b/gdbserver/linux-aarch64-tdesc.cc
index 633134955e5..8e926e8006c 100644
--- a/gdbserver/linux-aarch64-tdesc.cc
+++ b/gdbserver/linux-aarch64-tdesc.cc
@@ -36,8 +36,8 @@ const target_desc *
aarch64_linux_read_description (const aarch64_features &features)
{
if (features.vq > AARCH64_MAX_SVE_VQ)
- error (_("VQ is %" PRIu64 ", maximum supported value is %d"), features.vq,
- AARCH64_MAX_SVE_VQ);
+ error (_ ("VQ is %" PRIu64 ", maximum supported value is %d"), features.vq,
+ AARCH64_MAX_SVE_VQ);
struct target_desc *tdesc = tdesc_aarch64_map[features];
@@ -46,13 +46,13 @@ aarch64_linux_read_description (const aarch64_features &features)
tdesc = aarch64_create_target_description (features);
static const char *expedite_regs_aarch64[] = { "x29", "sp", "pc", NULL };
- static const char *expedite_regs_aarch64_sve[] = { "x29", "sp", "pc",
- "vg", NULL };
+ static const char *expedite_regs_aarch64_sve[]
+ = { "x29", "sp", "pc", "vg", NULL };
if (features.vq == 0)
- init_target_desc (tdesc, expedite_regs_aarch64);
+ init_target_desc (tdesc, expedite_regs_aarch64);
else
- init_target_desc (tdesc, expedite_regs_aarch64_sve);
+ init_target_desc (tdesc, expedite_regs_aarch64_sve);
tdesc_aarch64_map[features] = tdesc;
}
diff --git a/gdbserver/linux-aarch64-tdesc.h b/gdbserver/linux-aarch64-tdesc.h
index 9650479e22a..005890d99f5 100644
--- a/gdbserver/linux-aarch64-tdesc.h
+++ b/gdbserver/linux-aarch64-tdesc.h
@@ -23,6 +23,6 @@
#include "arch/aarch64.h"
const target_desc *
- aarch64_linux_read_description (const aarch64_features &features);
+aarch64_linux_read_description (const aarch64_features &features);
#endif /* GDBSERVER_LINUX_AARCH64_TDESC_H */
diff --git a/gdbserver/linux-amd64-ipa.cc b/gdbserver/linux-amd64-ipa.cc
index ae2bd155f8a..2e8cd120b92 100644
--- a/gdbserver/linux-amd64-ipa.cc
+++ b/gdbserver/linux-amd64-ipa.cc
@@ -49,26 +49,25 @@ extern const struct target_desc *tdesc_amd64_linux;
#define FT_CR_RBP 16
#define FT_CR_RSP 17
-static const int x86_64_ft_collect_regmap[] = {
- FT_CR_RAX * 8, FT_CR_RBX * 8, FT_CR_RCX * 8, FT_CR_RDX * 8,
- FT_CR_RSI * 8, FT_CR_RDI * 8, FT_CR_RBP * 8, FT_CR_RSP * 8,
- FT_CR_R8 * 8, FT_CR_R9 * 8, FT_CR_R10 * 8, FT_CR_R11 * 8,
- FT_CR_R12 * 8, FT_CR_R13 * 8, FT_CR_R14 * 8, FT_CR_R15 * 8,
- FT_CR_RIP * 8, FT_CR_EFLAGS * 8
-};
+static const int x86_64_ft_collect_regmap[]
+ = { FT_CR_RAX * 8, FT_CR_RBX * 8, FT_CR_RCX * 8, FT_CR_RDX * 8,
+ FT_CR_RSI * 8, FT_CR_RDI * 8, FT_CR_RBP * 8, FT_CR_RSP * 8,
+ FT_CR_R8 * 8, FT_CR_R9 * 8, FT_CR_R10 * 8, FT_CR_R11 * 8,
+ FT_CR_R12 * 8, FT_CR_R13 * 8, FT_CR_R14 * 8, FT_CR_R15 * 8,
+ FT_CR_RIP * 8, FT_CR_EFLAGS * 8 };
#define X86_64_NUM_FT_COLLECT_GREGS \
- (sizeof (x86_64_ft_collect_regmap) / sizeof(x86_64_ft_collect_regmap[0]))
+ (sizeof (x86_64_ft_collect_regmap) / sizeof (x86_64_ft_collect_regmap[0]))
void
supply_fast_tracepoint_registers (struct regcache *regcache,
- const unsigned char *buf)
+ const unsigned char *buf)
{
int i;
for (i = 0; i < X86_64_NUM_FT_COLLECT_GREGS; i++)
supply_register (regcache, i,
- ((char *) buf) + x86_64_ft_collect_regmap[i]);
+ ((char *) buf) + x86_64_ft_collect_regmap[i]);
}
ULONGEST
@@ -89,39 +88,25 @@ get_raw_reg (const unsigned char *raw_regs, int regnum)
contain RIP, but we know what it must have been (the marker
address). */
-#define ST_REGENTRY(REG) \
- { \
- offsetof (struct registers, REG), \
- sizeof (((struct registers *) NULL)->REG) \
+#define ST_REGENTRY(REG) \
+ { \
+ offsetof (struct registers, REG), \
+ sizeof (((struct registers *) NULL)->REG) \
}
static struct
{
int offset;
int size;
-} x86_64_st_collect_regmap[] =
- {
- ST_REGENTRY(rax),
- ST_REGENTRY(rbx),
- ST_REGENTRY(rcx),
- ST_REGENTRY(rdx),
- ST_REGENTRY(rsi),
- ST_REGENTRY(rdi),
- ST_REGENTRY(rbp),
- ST_REGENTRY(rsp),
- ST_REGENTRY(r8),
- ST_REGENTRY(r9),
- ST_REGENTRY(r10),
- ST_REGENTRY(r11),
- ST_REGENTRY(r12),
- ST_REGENTRY(r13),
- ST_REGENTRY(r14),
- ST_REGENTRY(r15),
- { -1, 0 },
- ST_REGENTRY(rflags),
- ST_REGENTRY(cs),
- ST_REGENTRY(ss),
- };
+} x86_64_st_collect_regmap[] = {
+ ST_REGENTRY (rax), ST_REGENTRY (rbx), ST_REGENTRY (rcx),
+ ST_REGENTRY (rdx), ST_REGENTRY (rsi), ST_REGENTRY (rdi),
+ ST_REGENTRY (rbp), ST_REGENTRY (rsp), ST_REGENTRY (r8),
+ ST_REGENTRY (r9), ST_REGENTRY (r10), ST_REGENTRY (r11),
+ ST_REGENTRY (r12), ST_REGENTRY (r13), ST_REGENTRY (r14),
+ ST_REGENTRY (r15), { -1, 0 }, ST_REGENTRY (rflags),
+ ST_REGENTRY (cs), ST_REGENTRY (ss),
+};
#define X86_64_NUM_ST_COLLECT_GREGS \
(sizeof (x86_64_st_collect_regmap) / sizeof (x86_64_st_collect_regmap[0]))
@@ -131,8 +116,7 @@ static struct
void
supply_static_tracepoint_registers (struct regcache *regcache,
- const unsigned char *buf,
- CORE_ADDR pc)
+ const unsigned char *buf, CORE_ADDR pc)
{
int i;
unsigned long newpc = pc;
@@ -142,27 +126,26 @@ supply_static_tracepoint_registers (struct regcache *regcache,
for (i = 0; i < X86_64_NUM_ST_COLLECT_GREGS; i++)
if (x86_64_st_collect_regmap[i].offset != -1)
{
- switch (x86_64_st_collect_regmap[i].size)
- {
- case 8:
- supply_register (regcache, i,
- ((char *) buf)
- + x86_64_st_collect_regmap[i].offset);
- break;
- case 2:
- {
- unsigned long reg
- = * (short *) (((char *) buf)
- + x86_64_st_collect_regmap[i].offset);
- reg &= 0xffff;
- supply_register (regcache, i, &reg);
- }
- break;
- default:
- internal_error ("unhandled register size: %d",
- x86_64_st_collect_regmap[i].size);
- break;
- }
+ switch (x86_64_st_collect_regmap[i].size)
+ {
+ case 8:
+ supply_register (regcache, i,
+ ((char *) buf)
+ + x86_64_st_collect_regmap[i].offset);
+ break;
+ case 2:
+ {
+ unsigned long reg = *(
+ short *) (((char *) buf) + x86_64_st_collect_regmap[i].offset);
+ reg &= 0xffff;
+ supply_register (regcache, i, &reg);
+ }
+ break;
+ default:
+ internal_error ("unhandled register size: %d",
+ x86_64_st_collect_regmap[i].size);
+ break;
+ }
}
}
@@ -247,23 +230,22 @@ alloc_jump_pad_buffer (size_t size)
void *res;
/* No MAP_FIXED - we don't want to zap someone's mapping. */
- res = mmap ((void *) addr, size,
- PROT_READ | PROT_WRITE | PROT_EXEC,
- MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
+ res = mmap ((void *) addr, size, PROT_READ | PROT_WRITE | PROT_EXEC,
+ MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
/* If we got what we wanted, return. */
if ((uintptr_t) res == addr)
- return res;
+ return res;
/* If we got a mapping, but at a wrong address, undo it. */
if (res != MAP_FAILED)
- munmap (res, size);
+ munmap (res, size);
}
return NULL;
#else
void *res = mmap (NULL, size, PROT_READ | PROT_WRITE | PROT_EXEC,
- MAP_PRIVATE | MAP_ANONYMOUS | MAP_32BIT, -1, 0);
+ MAP_PRIVATE | MAP_ANONYMOUS | MAP_32BIT, -1, 0);
if (res == MAP_FAILED)
return NULL;
diff --git a/gdbserver/linux-arc-low.cc b/gdbserver/linux-arc-low.cc
index f02884753e2..bd4f884b30e 100644
--- a/gdbserver/linux-arc-low.cc
+++ b/gdbserver/linux-arc-low.cc
@@ -33,8 +33,8 @@
#endif
/* The encoding of the instruction "TRAP_S 1" (endianness agnostic). */
-#define TRAP_S_1_OPCODE 0x783e
-#define TRAP_S_1_SIZE 2
+#define TRAP_S_1_OPCODE 0x783e
+#define TRAP_S_1_SIZE 2
/* Using a mere "uint16_t arc_linux_traps_s = TRAP_S_1_OPCODE" would
work as well, because the endianness will end up correctly when
@@ -45,11 +45,11 @@
#if defined(__BIG_ENDIAN__)
/* 0x78, 0x3e. */
static gdb_byte arc_linux_trap_s[TRAP_S_1_SIZE]
- = {TRAP_S_1_OPCODE >> 8, TRAP_S_1_OPCODE & 0xFF};
+ = { TRAP_S_1_OPCODE >> 8, TRAP_S_1_OPCODE & 0xFF };
#else
/* 0x3e, 0x78. */
static gdb_byte arc_linux_trap_s[TRAP_S_1_SIZE]
- = {TRAP_S_1_OPCODE && 0xFF, TRAP_S_1_OPCODE >> 8};
+ = { TRAP_S_1_OPCODE && 0xFF, TRAP_S_1_OPCODE >> 8 };
#endif
/* Linux target op definitions for the ARC architecture.
@@ -60,13 +60,11 @@ static gdb_byte arc_linux_trap_s[TRAP_S_1_SIZE]
class arc_target : public linux_process_target
{
public:
-
const regs_info *get_regs_info () override;
const gdb_byte *sw_breakpoint_from_kind (int kind, int *size) override;
protected:
-
void low_arch_setup () override;
bool low_cannot_fetch_register (int regno) override;
@@ -233,7 +231,8 @@ arc_fill_gregset (struct regcache *regcache, void *buf)
static void
arc_store_gregset (struct regcache *regcache, const void *buf)
{
- const struct user_regs_struct *regbuf = (const struct user_regs_struct *) buf;
+ const struct user_regs_struct *regbuf
+ = (const struct user_regs_struct *) buf;
/* Core registers. */
supply_register_by_name (regcache, "r0", &(regbuf->scratch.r0));
@@ -296,8 +295,7 @@ arc_store_gregset (struct regcache *regcache, const void *buf)
If found, return true; false, otherwise. */
static bool
-is_reg_name_available_p (const struct target_desc *tdesc,
- const char *name)
+is_reg_name_available_p (const struct target_desc *tdesc, const char *name)
{
for (const gdb::reg &reg : tdesc->reg_defs)
if (strcmp (name, reg.name) == 0)
@@ -348,8 +346,8 @@ arc_store_v2_regset (struct regcache *regcache, const void *buf)
linux-arm-low.c. */
ps_err_e
-ps_get_thread_area (struct ps_prochandle *ph, lwpid_t lwpid,
- int idx, void **base)
+ps_get_thread_area (struct ps_prochandle *ph, lwpid_t lwpid, int idx,
+ void **base)
{
if (ptrace (PTRACE_GET_THREAD_AREA, lwpid, nullptr, base) != 0)
return PS_ERR;
@@ -362,34 +360,26 @@ ps_get_thread_area (struct ps_prochandle *ph, lwpid_t lwpid,
return PS_OK;
}
-static struct regset_info arc_regsets[] =
-{
- { PTRACE_GETREGSET, PTRACE_SETREGSET, NT_PRSTATUS,
- sizeof (struct user_regs_struct), GENERAL_REGS,
- arc_fill_gregset, arc_store_gregset
- },
+static struct regset_info arc_regsets[]
+ = { { PTRACE_GETREGSET, PTRACE_SETREGSET, NT_PRSTATUS,
+ sizeof (struct user_regs_struct), GENERAL_REGS, arc_fill_gregset,
+ arc_store_gregset },
#ifdef ARC_HAS_V2_REGSET
- { PTRACE_GETREGSET, PTRACE_SETREGSET, NT_ARC_V2,
- sizeof (struct user_regs_arcv2), GENERAL_REGS,
- arc_fill_v2_regset, arc_store_v2_regset
- },
+ { PTRACE_GETREGSET, PTRACE_SETREGSET, NT_ARC_V2,
+ sizeof (struct user_regs_arcv2), GENERAL_REGS, arc_fill_v2_regset,
+ arc_store_v2_regset },
#endif
- NULL_REGSET
-};
+ NULL_REGSET };
-static struct regsets_info arc_regsets_info =
-{
- arc_regsets, /* regsets */
- 0, /* num_regsets */
- nullptr, /* disabled regsets */
+static struct regsets_info arc_regsets_info = {
+ arc_regsets, /* regsets */
+ 0, /* num_regsets */
+ nullptr, /* disabled regsets */
};
-static struct regs_info arc_regs_info =
-{
- nullptr, /* regset_bitmap */
- nullptr, /* usrregs */
- &arc_regsets_info
-};
+static struct regs_info arc_regs_info = { nullptr, /* regset_bitmap */
+ nullptr, /* usrregs */
+ &arc_regsets_info };
const regs_info *
arc_target::get_regs_info ()
diff --git a/gdbserver/linux-arm-low.cc b/gdbserver/linux-arm-low.cc
index 5975b44af0a..92538d53895 100644
--- a/gdbserver/linux-arm-low.cc
+++ b/gdbserver/linux-arm-low.cc
@@ -40,13 +40,13 @@
#endif
#ifndef PTRACE_GETWMMXREGS
-# define PTRACE_GETWMMXREGS 18
-# define PTRACE_SETWMMXREGS 19
+#define PTRACE_GETWMMXREGS 18
+#define PTRACE_SETWMMXREGS 19
#endif
#ifndef PTRACE_GETVFPREGS
-# define PTRACE_GETVFPREGS 27
-# define PTRACE_SETVFPREGS 28
+#define PTRACE_GETVFPREGS 27
+#define PTRACE_SETVFPREGS 28
#endif
#ifndef PTRACE_GETHBPREGS
@@ -59,7 +59,6 @@
class arm_target : public linux_process_target
{
public:
-
const regs_info *get_regs_info () override;
int breakpoint_kind_from_pc (CORE_ADDR *pcptr) override;
@@ -75,7 +74,6 @@ public:
bool supports_hardware_single_step () override;
protected:
-
void low_arch_setup () override;
bool low_cannot_fetch_register (int regno) override;
@@ -92,11 +90,11 @@ protected:
bool low_breakpoint_at (CORE_ADDR pc) override;
- int low_insert_point (raw_bkpt_type type, CORE_ADDR addr,
- int size, raw_breakpoint *bp) override;
+ int low_insert_point (raw_bkpt_type type, CORE_ADDR addr, int size,
+ raw_breakpoint *bp) override;
- int low_remove_point (raw_bkpt_type type, CORE_ADDR addr,
- int size, raw_breakpoint *bp) override;
+ int low_remove_point (raw_bkpt_type type, CORE_ADDR addr, int size,
+ raw_breakpoint *bp) override;
bool low_stopped_by_watchpoint () override;
@@ -220,11 +218,11 @@ struct arch_lwp_info
};
/* These are in <asm/elf.h> in current kernels. */
-#define HWCAP_VFP 64
-#define HWCAP_IWMMXT 512
-#define HWCAP_NEON 4096
-#define HWCAP_VFPv3 8192
-#define HWCAP_VFPv3D16 16384
+#define HWCAP_VFP 64
+#define HWCAP_IWMMXT 512
+#define HWCAP_NEON 4096
+#define HWCAP_VFPv3 8192
+#define HWCAP_VFPv3D16 16384
#ifdef HAVE_SYS_REG_H
#include <sys/reg.h>
@@ -232,20 +230,17 @@ struct arch_lwp_info
#define arm_num_regs 26
-static int arm_regmap[] = {
- 0, 4, 8, 12, 16, 20, 24, 28,
- 32, 36, 40, 44, 48, 52, 56, 60,
- -1, -1, -1, -1, -1, -1, -1, -1, -1,
- 64
-};
+static int arm_regmap[]
+ = { 0, 4, 8, 12, 16, 20, 24, 28, 32, 36, 40, 44, 48,
+ 52, 56, 60, -1, -1, -1, -1, -1, -1, -1, -1, -1, 64 };
/* Forward declarations needed for get_next_pcs ops. */
static ULONGEST get_next_pcs_read_memory_unsigned_integer (CORE_ADDR memaddr,
- int len,
- int byte_order);
+ int len,
+ int byte_order);
static CORE_ADDR get_next_pcs_addr_bits_remove (struct arm_get_next_pcs *self,
- CORE_ADDR val);
+ CORE_ADDR val);
static CORE_ADDR get_next_pcs_syscall_next_pc (struct arm_get_next_pcs *self);
@@ -284,7 +279,7 @@ arm_fill_wmmxregset (struct regcache *regcache, void *buf)
/* We only have access to wcssf, wcasf, and wcgr0-wcgr3. */
for (int i = 0; i < 6; i++)
collect_register (regcache, arm_num_regs + i + 16,
- (char *) buf + 16 * 8 + i * 4);
+ (char *) buf + 16 * 8 + i * 4);
}
static void
@@ -299,7 +294,7 @@ arm_store_wmmxregset (struct regcache *regcache, const void *buf)
/* We only have access to wcssf, wcasf, and wcgr0-wcgr3. */
for (int i = 0; i < 6; i++)
supply_register (regcache, arm_num_regs + i + 16,
- (char *) buf + 16 * 8 + i * 4);
+ (char *) buf + 16 * 8 + i * 4);
}
static void
@@ -314,11 +309,11 @@ arm_fill_vfpregset (struct regcache *regcache, void *buf)
arm_fp_type fp_type = arm_linux_get_tdesc_fp_type (regcache->tdesc);
if (fp_type == ARM_FP_TYPE_VFPV3)
- num = 32;
+ num = 32;
else if (fp_type == ARM_FP_TYPE_VFPV2)
- num = 16;
+ num = 16;
else
- return;
+ return;
}
arm_fill_vfpregset_num (regcache, buf, num);
@@ -343,11 +338,11 @@ arm_store_vfpregset (struct regcache *regcache, const void *buf)
arm_fp_type fp_type = arm_linux_get_tdesc_fp_type (regcache->tdesc);
if (fp_type == ARM_FP_TYPE_VFPV3)
- num = 32;
+ num = 32;
else if (fp_type == ARM_FP_TYPE_VFPV2)
- num = 16;
+ num = 16;
else
- return;
+ return;
}
arm_store_vfpregset_num (regcache, buf, num);
@@ -364,9 +359,8 @@ get_next_pcs_is_thumb (struct arm_get_next_pcs *self)
BYTE_ORDER is ignored and there to keep compatiblity with GDB's
read_memory_unsigned_integer. */
static ULONGEST
-get_next_pcs_read_memory_unsigned_integer (CORE_ADDR memaddr,
- int len,
- int byte_order)
+get_next_pcs_read_memory_unsigned_integer (CORE_ADDR memaddr, int len,
+ int byte_order)
{
ULONGEST res;
@@ -379,8 +373,8 @@ get_next_pcs_read_memory_unsigned_integer (CORE_ADDR memaddr,
/* Fetch the thread-local storage pointer for libthread_db. */
ps_err_e
-ps_get_thread_area (struct ps_prochandle *ph,
- lwpid_t lwpid, int idx, void **base)
+ps_get_thread_area (struct ps_prochandle *ph, lwpid_t lwpid, int idx,
+ void **base)
{
if (ptrace (PTRACE_GET_THREAD_AREA, lwpid, NULL, base) != 0)
return PS_ERR;
@@ -388,12 +382,11 @@ ps_get_thread_area (struct ps_prochandle *ph,
/* IDX is the bias from the thread pointer to the beginning of the
thread descriptor. It has to be subtracted due to implementation
quirks in libthread_db. */
- *base = (void *) ((char *)*base - idx);
+ *base = (void *) ((char *) *base - idx);
return PS_OK;
}
-
/* Query Hardware Breakpoint information for the target we are attached to
(using PID as ptrace argument) and set up arm_linux_hwbp_cap. */
static void
@@ -404,13 +397,13 @@ arm_linux_init_hwbp_cap (int pid)
if (ptrace (PTRACE_GETHBPREGS, pid, 0, &val) < 0)
return;
- arm_linux_hwbp_cap.arch = (unsigned char)((val >> 24) & 0xff);
+ arm_linux_hwbp_cap.arch = (unsigned char) ((val >> 24) & 0xff);
if (arm_linux_hwbp_cap.arch == 0)
return;
- arm_linux_hwbp_cap.max_wp_length = (unsigned char)((val >> 16) & 0xff);
- arm_linux_hwbp_cap.wp_count = (unsigned char)((val >> 8) & 0xff);
- arm_linux_hwbp_cap.bp_count = (unsigned char)(val & 0xff);
+ arm_linux_hwbp_cap.max_wp_length = (unsigned char) ((val >> 16) & 0xff);
+ arm_linux_hwbp_cap.wp_count = (unsigned char) ((val >> 8) & 0xff);
+ arm_linux_hwbp_cap.bp_count = (unsigned char) (val & 0xff);
if (arm_linux_hwbp_cap.wp_count > MAX_WPTS)
internal_error ("Unsupported number of watchpoints");
@@ -445,12 +438,11 @@ arm_linux_get_hw_watchpoint_max_length (void)
*/
static arm_hwbp_control_t
arm_hwbp_control_initialize (unsigned byte_address_select,
- arm_hwbp_type hwbp_type,
- int enable)
+ arm_hwbp_type hwbp_type, int enable)
{
gdb_assert ((byte_address_select & ~0xffU) == 0);
gdb_assert (hwbp_type != arm_hwbp_break
- || ((byte_address_select & 0xfU) != 0));
+ || ((byte_address_select & 0xfU) != 0));
return (byte_address_select << 5) | (hwbp_type << 3) | (3 << 1) | enable;
}
@@ -479,7 +471,7 @@ arm_hwbp_control_disable (arm_hwbp_control_t control)
/* Are two break-/watch-points equal? */
static int
arm_linux_hw_breakpoint_equal (const struct arm_linux_hw_breakpoint *p1,
- const struct arm_linux_hw_breakpoint *p2)
+ const struct arm_linux_hw_breakpoint *p2)
{
return p1->address == p2->address && p1->control == p2->control;
}
@@ -511,7 +503,7 @@ raw_bkpt_type_to_arm_hwbp_type (enum raw_bkpt_type raw_type)
represents a breakpoint and 1 if type represents a watchpoint. */
static int
arm_linux_hw_point_initialize (enum raw_bkpt_type raw_type, CORE_ADDR addr,
- int len, struct arm_linux_hw_breakpoint *p)
+ int len, struct arm_linux_hw_breakpoint *p)
{
arm_hwbp_type hwbp_type;
unsigned mask;
@@ -522,20 +514,20 @@ arm_linux_hw_point_initialize (enum raw_bkpt_type raw_type, CORE_ADDR addr,
{
/* For breakpoints, the length field encodes the mode. */
switch (len)
- {
- case 2: /* 16-bit Thumb mode breakpoint */
- case 3: /* 32-bit Thumb mode breakpoint */
- mask = 0x3;
- addr &= ~1;
- break;
- case 4: /* 32-bit ARM mode breakpoint */
- mask = 0xf;
- addr &= ~3;
- break;
- default:
- /* Unsupported. */
- return -2;
- }
+ {
+ case 2: /* 16-bit Thumb mode breakpoint */
+ case 3: /* 32-bit Thumb mode breakpoint */
+ mask = 0x3;
+ addr &= ~1;
+ break;
+ case 4: /* 32-bit ARM mode breakpoint */
+ mask = 0xf;
+ addr &= ~3;
+ break;
+ default:
+ /* Unsupported. */
+ return -2;
+ }
}
else
{
@@ -544,17 +536,17 @@ arm_linux_hw_point_initialize (enum raw_bkpt_type raw_type, CORE_ADDR addr,
/* Can not set watchpoints for zero or negative lengths. */
if (len <= 0)
- return -2;
+ return -2;
/* The current ptrace interface can only handle watchpoints that are a
power of 2. */
if ((len & (len - 1)) != 0)
- return -2;
+ return -2;
/* Test that the range [ADDR, ADDR + LEN) fits into the largest address
range covered by a watchpoint. */
aligned_addr = addr & ~(max_wp_length - 1);
if (aligned_addr + max_wp_length < addr + len)
- return -2;
+ return -2;
mask = (1 << len) - 1;
}
@@ -605,8 +597,8 @@ arm_target::supports_z_point_type (char z_type)
/* Insert hardware break-/watchpoint. */
int
-arm_target::low_insert_point (raw_bkpt_type type, CORE_ADDR addr,
- int len, raw_breakpoint *bp)
+arm_target::low_insert_point (raw_bkpt_type type, CORE_ADDR addr, int len,
+ raw_breakpoint *bp)
{
struct process_info *proc = current_process ();
struct arm_linux_hw_breakpoint p, *pts;
@@ -633,15 +625,14 @@ arm_target::low_insert_point (raw_bkpt_type type, CORE_ADDR addr,
for (i = 0; i < count; i++)
if (!arm_hwbp_control_is_enabled (pts[i].control))
{
- pts[i] = p;
+ pts[i] = p;
- /* Only update the threads of the current process. */
- for_each_thread (current_thread->id.pid (), [&] (thread_info *thread)
- {
- update_registers_callback (thread, watch, i);
- });
+ /* Only update the threads of the current process. */
+ for_each_thread (current_thread->id.pid (), [&] (thread_info *thread) {
+ update_registers_callback (thread, watch, i);
+ });
- return 0;
+ return 0;
}
/* We're out of watchpoints. */
@@ -650,8 +641,8 @@ arm_target::low_insert_point (raw_bkpt_type type, CORE_ADDR addr,
/* Remove hardware break-/watchpoint. */
int
-arm_target::low_remove_point (raw_bkpt_type type, CORE_ADDR addr,
- int len, raw_breakpoint *bp)
+arm_target::low_remove_point (raw_bkpt_type type, CORE_ADDR addr, int len,
+ raw_breakpoint *bp)
{
struct process_info *proc = current_process ();
struct arm_linux_hw_breakpoint p, *pts;
@@ -678,15 +669,14 @@ arm_target::low_remove_point (raw_bkpt_type type, CORE_ADDR addr,
for (i = 0; i < count; i++)
if (arm_linux_hw_breakpoint_equal (&p, pts + i))
{
- pts[i].control = arm_hwbp_control_disable (pts[i].control);
+ pts[i].control = arm_hwbp_control_disable (pts[i].control);
- /* Only update the threads of the current process. */
- for_each_thread (current_thread->id.pid (), [&] (thread_info *thread)
- {
- update_registers_callback (thread, watch, i);
- });
+ /* Only update the threads of the current process. */
+ for_each_thread (current_thread->id.pid (), [&] (thread_info *thread) {
+ update_registers_callback (thread, watch, i);
+ });
- return 0;
+ return 0;
}
/* No watchpoint matched. */
@@ -785,10 +775,8 @@ arm_target::low_new_fork (process_info *parent, process_info *child)
int i;
/* These are allocated by linux_add_process. */
- gdb_assert (parent->priv != NULL
- && parent->priv->arch_private != NULL);
- gdb_assert (child->priv != NULL
- && child->priv->arch_private != NULL);
+ gdb_assert (parent->priv != NULL && parent->priv->arch_private != NULL);
+ gdb_assert (child->priv != NULL && child->priv->arch_private != NULL);
parent_proc_info = parent->priv->arch_private;
child_proc_info = child->priv->arch_private;
@@ -834,41 +822,45 @@ arm_target::low_prepare_to_resume (lwp_info *lwp)
for (i = 0; i < arm_linux_get_hw_breakpoint_count (); i++)
if (lwp_info->bpts_changed[i])
{
- errno = 0;
-
- if (arm_hwbp_control_is_enabled (proc_info->bpts[i].control))
- if (ptrace (PTRACE_SETHBPREGS, pid,
- (PTRACE_TYPE_ARG3) ((i << 1) + 1),
- &proc_info->bpts[i].address) < 0)
- perror_with_name ("Unexpected error setting breakpoint address");
-
- if (arm_hwbp_control_is_initialized (proc_info->bpts[i].control))
- if (ptrace (PTRACE_SETHBPREGS, pid,
- (PTRACE_TYPE_ARG3) ((i << 1) + 2),
- &proc_info->bpts[i].control) < 0)
- perror_with_name ("Unexpected error setting breakpoint");
-
- lwp_info->bpts_changed[i] = 0;
+ errno = 0;
+
+ if (arm_hwbp_control_is_enabled (proc_info->bpts[i].control))
+ if (ptrace (PTRACE_SETHBPREGS, pid,
+ (PTRACE_TYPE_ARG3) ((i << 1) + 1),
+ &proc_info->bpts[i].address)
+ < 0)
+ perror_with_name ("Unexpected error setting breakpoint address");
+
+ if (arm_hwbp_control_is_initialized (proc_info->bpts[i].control))
+ if (ptrace (PTRACE_SETHBPREGS, pid,
+ (PTRACE_TYPE_ARG3) ((i << 1) + 2),
+ &proc_info->bpts[i].control)
+ < 0)
+ perror_with_name ("Unexpected error setting breakpoint");
+
+ lwp_info->bpts_changed[i] = 0;
}
for (i = 0; i < arm_linux_get_hw_watchpoint_count (); i++)
if (lwp_info->wpts_changed[i])
{
- errno = 0;
-
- if (arm_hwbp_control_is_enabled (proc_info->wpts[i].control))
- if (ptrace (PTRACE_SETHBPREGS, pid,
- (PTRACE_TYPE_ARG3) -((i << 1) + 1),
- &proc_info->wpts[i].address) < 0)
- perror_with_name ("Unexpected error setting watchpoint address");
-
- if (arm_hwbp_control_is_initialized (proc_info->wpts[i].control))
- if (ptrace (PTRACE_SETHBPREGS, pid,
- (PTRACE_TYPE_ARG3) -((i << 1) + 2),
- &proc_info->wpts[i].control) < 0)
- perror_with_name ("Unexpected error setting watchpoint");
-
- lwp_info->wpts_changed[i] = 0;
+ errno = 0;
+
+ if (arm_hwbp_control_is_enabled (proc_info->wpts[i].control))
+ if (ptrace (PTRACE_SETHBPREGS, pid,
+ (PTRACE_TYPE_ARG3) - ((i << 1) + 1),
+ &proc_info->wpts[i].address)
+ < 0)
+ perror_with_name ("Unexpected error setting watchpoint address");
+
+ if (arm_hwbp_control_is_initialized (proc_info->wpts[i].control))
+ if (ptrace (PTRACE_SETHBPREGS, pid,
+ (PTRACE_TYPE_ARG3) - ((i << 1) + 2),
+ &proc_info->wpts[i].control)
+ < 0)
+ perror_with_name ("Unexpected error setting watchpoint");
+
+ lwp_info->wpts_changed[i] = 0;
}
}
@@ -878,7 +870,7 @@ arm_target::low_prepare_to_resume (lwp_info *lwp)
See arm-linux.h for stack layout details. */
static CORE_ADDR
arm_sigreturn_next_pc (struct regcache *regcache, int svc_number,
- int *is_thumb)
+ int *is_thumb)
{
unsigned long sp;
unsigned long sp_data;
@@ -892,8 +884,10 @@ arm_sigreturn_next_pc (struct regcache *regcache, int svc_number,
collect_register_by_name (regcache, "sp", &sp);
the_target->read_memory (sp, (unsigned char *) &sp_data, 4);
- pc_offset = arm_linux_sigreturn_next_pc_offset
- (sp, sp_data, svc_number, __NR_sigreturn == svc_number ? 1 : 0);
+ pc_offset
+ = arm_linux_sigreturn_next_pc_offset (sp, sp_data, svc_number,
+ __NR_sigreturn == svc_number ? 1
+ : 0);
the_target->read_memory (sp + pc_offset, (unsigned char *) &next_pc, 4);
@@ -928,14 +922,14 @@ get_next_pcs_syscall_next_pc (struct arm_get_next_pcs *self)
target_read_memory (pc, (unsigned char *) &this_instr, 4);
svc_operand = (0x00ffffff & this_instr);
- if (svc_operand) /* OABI. */
- {
- svc_number = svc_operand - 0x900000;
- }
+ if (svc_operand) /* OABI. */
+ {
+ svc_number = svc_operand - 0x900000;
+ }
else /* EABI. */
- {
- collect_register (regcache, 7, &svc_number);
- }
+ {
+ collect_register (regcache, 7, &svc_number);
+ }
next_pc = pc + 4;
}
@@ -971,16 +965,16 @@ arm_read_description (void)
errno = 0;
char *buf = (char *) alloca (ARM_VFP3_REGS_SIZE);
if (ptrace (PTRACE_GETVFPREGS, pid, 0, buf) < 0 && errno == EIO)
- return arm_linux_read_description (ARM_FP_TYPE_NONE);
+ return arm_linux_read_description (ARM_FP_TYPE_NONE);
/* NEON implies either no VFP, or VFPv3-D32. We only support
it with VFP. */
if (arm_hwcap & HWCAP_NEON)
- return aarch32_linux_read_description ();
+ return aarch32_linux_read_description ();
else if ((arm_hwcap & (HWCAP_VFPv3 | HWCAP_VFPv3D16)) == HWCAP_VFPv3)
- return arm_linux_read_description (ARM_FP_TYPE_VFPV3);
+ return arm_linux_read_description (ARM_FP_TYPE_VFPV3);
else
- return arm_linux_read_description (ARM_FP_TYPE_VFPV2);
+ return arm_linux_read_description (ARM_FP_TYPE_VFPV2);
}
/* The default configuration uses legacy FPA registers, probably
@@ -1023,13 +1017,9 @@ arm_target::low_get_next_pcs (regcache *regcache)
{
struct arm_get_next_pcs next_pcs_ctx;
- arm_get_next_pcs_ctor (&next_pcs_ctx,
- &get_next_pcs_ops,
- /* Byte order is ignored assumed as host. */
- 0,
- 0,
- 1,
- regcache);
+ arm_get_next_pcs_ctor (&next_pcs_ctx, &get_next_pcs_ops,
+ /* Byte order is ignored assumed as host. */
+ 0, 0, 1, regcache);
return arm_get_next_pcs (&next_pcs_ctx);
}
@@ -1063,57 +1053,51 @@ arm_target::low_get_syscall_trapinfo (regcache *regcache, int *sysno)
collect_register_by_name (regcache, "pc", &pc);
if (read_memory (pc - 4, (unsigned char *) &insn, 4))
- *sysno = UNKNOWN_SYSCALL;
+ *sysno = UNKNOWN_SYSCALL;
else
- {
- unsigned long svc_operand = (0x00ffffff & insn);
-
- if (svc_operand)
- {
- /* OABI */
- *sysno = svc_operand - 0x900000;
- }
- else
- {
- /* EABI */
- collect_register_by_name (regcache, "r7", sysno);
- }
- }
+ {
+ unsigned long svc_operand = (0x00ffffff & insn);
+
+ if (svc_operand)
+ {
+ /* OABI */
+ *sysno = svc_operand - 0x900000;
+ }
+ else
+ {
+ /* EABI */
+ collect_register_by_name (regcache, "r7", sysno);
+ }
+ }
}
}
/* Register sets without using PTRACE_GETREGSET. */
-static struct regset_info arm_regsets[] = {
- { PTRACE_GETREGS, PTRACE_SETREGS, 0,
- ARM_CORE_REGS_SIZE + ARM_INT_REGISTER_SIZE, GENERAL_REGS,
- arm_fill_gregset, arm_store_gregset },
- { PTRACE_GETWMMXREGS, PTRACE_SETWMMXREGS, 0, IWMMXT_REGS_SIZE, EXTENDED_REGS,
- arm_fill_wmmxregset, arm_store_wmmxregset },
- { PTRACE_GETVFPREGS, PTRACE_SETVFPREGS, 0, ARM_VFP3_REGS_SIZE, EXTENDED_REGS,
- arm_fill_vfpregset, arm_store_vfpregset },
- NULL_REGSET
+static struct regset_info arm_regsets[]
+ = { { PTRACE_GETREGS, PTRACE_SETREGS, 0,
+ ARM_CORE_REGS_SIZE + ARM_INT_REGISTER_SIZE, GENERAL_REGS,
+ arm_fill_gregset, arm_store_gregset },
+ { PTRACE_GETWMMXREGS, PTRACE_SETWMMXREGS, 0, IWMMXT_REGS_SIZE,
+ EXTENDED_REGS, arm_fill_wmmxregset, arm_store_wmmxregset },
+ { PTRACE_GETVFPREGS, PTRACE_SETVFPREGS, 0, ARM_VFP3_REGS_SIZE,
+ EXTENDED_REGS, arm_fill_vfpregset, arm_store_vfpregset },
+ NULL_REGSET };
+
+static struct regsets_info arm_regsets_info = {
+ arm_regsets, /* regsets */
+ 0, /* num_regsets */
+ NULL, /* disabled_regsets */
+};
+
+static struct usrregs_info arm_usrregs_info = {
+ arm_num_regs,
+ arm_regmap,
};
-static struct regsets_info arm_regsets_info =
- {
- arm_regsets, /* regsets */
- 0, /* num_regsets */
- NULL, /* disabled_regsets */
- };
-
-static struct usrregs_info arm_usrregs_info =
- {
- arm_num_regs,
- arm_regmap,
- };
-
-static struct regs_info regs_info_arm =
- {
- NULL, /* regset_bitmap */
- &arm_usrregs_info,
- &arm_regsets_info
- };
+static struct regs_info regs_info_arm
+ = { NULL, /* regset_bitmap */
+ &arm_usrregs_info, &arm_regsets_info };
const regs_info *
arm_target::get_regs_info ()
@@ -1122,7 +1106,7 @@ arm_target::get_regs_info ()
if (have_ptrace_getregset == 1
&& (is_aarch32_linux_description (tdesc)
- || arm_linux_get_tdesc_fp_type (tdesc) == ARM_FP_TYPE_VFPV3))
+ || arm_linux_get_tdesc_fp_type (tdesc) == ARM_FP_TYPE_VFPV3))
return &regs_info_aarch32;
return &regs_info_arm;
diff --git a/gdbserver/linux-arm-tdesc.cc b/gdbserver/linux-arm-tdesc.cc
index 5f84ccba337..33e7d460004 100644
--- a/gdbserver/linux-arm-tdesc.cc
+++ b/gdbserver/linux-arm-tdesc.cc
@@ -58,7 +58,7 @@ arm_linux_get_tdesc_fp_type (const target_desc *tdesc)
for (int i = ARM_FP_TYPE_NONE; i < ARM_FP_TYPE_INVALID; i++)
{
if (tdesc == tdesc_arm_list[i])
- return (arm_fp_type) i;
+ return (arm_fp_type) i;
}
return ARM_FP_TYPE_INVALID;
diff --git a/gdbserver/linux-arm-tdesc.h b/gdbserver/linux-arm-tdesc.h
index 857eb810886..76a7b09c7cb 100644
--- a/gdbserver/linux-arm-tdesc.h
+++ b/gdbserver/linux-arm-tdesc.h
@@ -22,7 +22,7 @@
/* Return the Arm target description with fp registers FP_TYPE. */
-const target_desc * arm_linux_read_description (arm_fp_type fp_type);
+const target_desc *arm_linux_read_description (arm_fp_type fp_type);
/* For a target description TDESC, return its fp type. */
diff --git a/gdbserver/linux-csky-low.cc b/gdbserver/linux-csky-low.cc
index 809a4ed867c..b48e425fdeb 100644
--- a/gdbserver/linux-csky-low.cc
+++ b/gdbserver/linux-csky-low.cc
@@ -30,7 +30,6 @@
class csky_target : public linux_process_target
{
public:
-
const regs_info *get_regs_info () override;
const gdb_byte *sw_breakpoint_from_kind (int kind, int *size) override;
@@ -40,7 +39,6 @@ public:
bool supports_hardware_single_step () override;
protected:
-
void low_arch_setup () override;
bool low_cannot_fetch_register (int regno) override;
@@ -60,23 +58,27 @@ static csky_target the_csky_target;
/* Return the ptrace "address" of register REGNO. */
static int csky_regmap[] = {
- 0*4, 1*4, 2*4, 3*4, 4*4, 5*4, 6*4, 7*4,
- 8*4, 9*4, 10*4, 11*4, 12*4, 13*4, 14*4, 15*4,
- 16*4, 17*4, 18*4, 19*4, 20*4, 21*4, 22*4, 23*4,
- 24*4, 25*4, 26*4, 27*4, 28*4, 29*4, 30*4, 31*4,
- -1, -1, -1, -1, 34*4, 35*4, -1, -1,
- 40*4, 42*4, 44*4, 46*4, 48*4, 50*4, 52*4, 54*4, /* fr0 ~ fr15, 64bit */
- 56*4, 58*4, 60*4, 62*4, 64*4, 66*4, 68*4, 70*4,
- 72*4, 76*4, 80*4, 84*4, 88*4, 92*4, 96*4,100*4, /* vr0 ~ vr15, 128bit */
- 104*4,108*4,112*4,116*4,120*4,124*4,128*4,132*4,
- 33*4, /* pc */
- -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1,
- 32*4, -1, -1, -1, -1, -1, -1, -1, /* psr */
- -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1,
- 73*4, 72*4, 74*4, -1, -1, -1, 14*4, /* fcr, fid, fesr, usp */
+ 0 * 4, 1 * 4, 2 * 4, 3 * 4, 4 * 4, 5 * 4, 6 * 4,
+ 7 * 4, 8 * 4, 9 * 4, 10 * 4, 11 * 4, 12 * 4, 13 * 4,
+ 14 * 4, 15 * 4, 16 * 4, 17 * 4, 18 * 4, 19 * 4, 20 * 4,
+ 21 * 4, 22 * 4, 23 * 4, 24 * 4, 25 * 4, 26 * 4, 27 * 4,
+ 28 * 4, 29 * 4, 30 * 4, 31 * 4, -1, -1, -1,
+ -1, 34 * 4, 35 * 4, -1, -1, 40 * 4, 42 * 4,
+ 44 * 4, 46 * 4, 48 * 4, 50 * 4, 52 * 4, 54 * 4, /* fr0 ~ fr15, 64bit */
+ 56 * 4, 58 * 4, 60 * 4, 62 * 4, 64 * 4, 66 * 4, 68 * 4,
+ 70 * 4, 72 * 4, 76 * 4, 80 * 4, 84 * 4, 88 * 4, 92 * 4,
+ 96 * 4, 100 * 4, /* vr0 ~ vr15, 128bit */
+ 104 * 4, 108 * 4, 112 * 4, 116 * 4, 120 * 4, 124 * 4, 128 * 4,
+ 132 * 4, 33 * 4, /* pc */
+ -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, 32 * 4, -1, -1, -1, -1,
+ -1, -1, -1, /* psr */
+ -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, 73 * 4, 72 * 4, 74 * 4, -1,
+ -1, -1, 14 * 4, /* fcr, fid, fesr, usp */
};
/* CSKY software breakpoint instruction code. */
@@ -125,7 +127,6 @@ csky_target::low_set_pc (struct regcache *regcache, CORE_ADDR pc)
supply_register_by_name (regcache, "pc", &new_pc);
}
-
void
csky_target::low_arch_setup ()
{
@@ -143,12 +144,13 @@ csky_target::low_arch_setup ()
/* Fetch the thread-local storage pointer for libthread_db. */
ps_err_e
-ps_get_thread_area (struct ps_prochandle *ph,
- lwpid_t lwpid, int idx, void **base)
+ps_get_thread_area (struct ps_prochandle *ph, lwpid_t lwpid, int idx,
+ void **base)
{
struct pt_regs regset;
- if (ptrace (PTRACE_GETREGSET, lwpid,
- (PTRACE_TYPE_ARG3) (long) NT_PRSTATUS, &regset) != 0)
+ if (ptrace (PTRACE_GETREGSET, lwpid, (PTRACE_TYPE_ARG3) (long) NT_PRSTATUS,
+ &regset)
+ != 0)
return PS_ERR;
*base = (void *) regset.tls;
@@ -156,7 +158,7 @@ ps_get_thread_area (struct ps_prochandle *ph,
/* IDX is the bias from the thread pointer to the beginning of the
thread descriptor. It has to be subtracted due to implementation
quirks in libthread_db. */
- *base = (void *) ((char *)*base - idx);
+ *base = (void *) ((char *) *base - idx);
return PS_OK;
}
@@ -167,9 +169,9 @@ static void
csky_fill_pt_gregset (struct regcache *regcache, void *buf)
{
int i, base;
- struct pt_regs *regset = (struct pt_regs *)buf;
+ struct pt_regs *regset = (struct pt_regs *) buf;
- collect_register_by_name (regcache, "r15", &regset->lr);
+ collect_register_by_name (regcache, "r15", &regset->lr);
collect_register_by_name (regcache, "pc", &regset->pc);
collect_register_by_name (regcache, "psr", &regset->sr);
collect_register_by_name (regcache, "r14", &regset->usp);
@@ -182,11 +184,11 @@ csky_fill_pt_gregset (struct regcache *regcache, void *buf)
base = find_regno (regcache->tdesc, "r4");
for (i = 0; i < 10; i++)
- collect_register (regcache, base + i, &regset->regs[i]);
+ collect_register (regcache, base + i, &regset->regs[i]);
base = find_regno (regcache->tdesc, "r16");
for (i = 0; i < 16; i++)
- collect_register (regcache, base + i, &regset->exregs[i]);
+ collect_register (regcache, base + i, &regset->exregs[i]);
collect_register_by_name (regcache, "hi", &regset->rhi);
collect_register_by_name (regcache, "lo", &regset->rlo);
@@ -198,7 +200,7 @@ csky_store_pt_gregset (struct regcache *regcache, const void *buf)
int i, base;
const struct pt_regs *regset = (const struct pt_regs *) buf;
- supply_register_by_name (regcache, "r15", &regset->lr);
+ supply_register_by_name (regcache, "r15", &regset->lr);
supply_register_by_name (regcache, "pc", &regset->pc);
supply_register_by_name (regcache, "psr", &regset->sr);
supply_register_by_name (regcache, "r14", &regset->usp);
@@ -211,11 +213,11 @@ csky_store_pt_gregset (struct regcache *regcache, const void *buf)
base = find_regno (regcache->tdesc, "r4");
for (i = 0; i < 10; i++)
- supply_register (regcache, base + i, &regset->regs[i]);
+ supply_register (regcache, base + i, &regset->regs[i]);
base = find_regno (regcache->tdesc, "r16");
for (i = 0; i < 16; i++)
- supply_register (regcache, base + i, &regset->exregs[i]);
+ supply_register (regcache, base + i, &regset->exregs[i]);
supply_register_by_name (regcache, "hi", &regset->rhi);
supply_register_by_name (regcache, "lo", &regset->rlo);
@@ -225,7 +227,7 @@ static void
csky_fill_pt_vrregset (struct regcache *regcache, void *buf)
{
int i, base;
- struct user_fp *regset = (struct user_fp *)buf;
+ struct user_fp *regset = (struct user_fp *) buf;
base = find_regno (regcache->tdesc, "vr0");
@@ -236,12 +238,11 @@ csky_fill_pt_vrregset (struct regcache *regcache, void *buf)
collect_register_by_name (regcache, "fid", &regset->fid);
}
-
static void
csky_store_pt_vrregset (struct regcache *regcache, const void *buf)
{
int i, base;
- const struct user_fp *regset = (const struct user_fp *)buf;
+ const struct user_fp *regset = (const struct user_fp *) buf;
base = find_regno (regcache->tdesc, "vr0");
@@ -258,30 +259,24 @@ csky_store_pt_vrregset (struct regcache *regcache, const void *buf)
}
struct regset_info csky_regsets[] = {
- { PTRACE_GETREGSET, PTRACE_SETREGSET, NT_PRSTATUS, sizeof(struct pt_regs),
- GENERAL_REGS, csky_fill_pt_gregset, csky_store_pt_gregset},
+ { PTRACE_GETREGSET, PTRACE_SETREGSET, NT_PRSTATUS, sizeof (struct pt_regs),
+ GENERAL_REGS, csky_fill_pt_gregset, csky_store_pt_gregset },
- { PTRACE_GETREGSET, PTRACE_SETREGSET, NT_FPREGSET, sizeof(struct user_fp),
- FP_REGS, csky_fill_pt_vrregset, csky_store_pt_vrregset},
+ { PTRACE_GETREGSET, PTRACE_SETREGSET, NT_FPREGSET, sizeof (struct user_fp),
+ FP_REGS, csky_fill_pt_vrregset, csky_store_pt_vrregset },
NULL_REGSET
};
-
-static struct regsets_info csky_regsets_info =
-{
+static struct regsets_info csky_regsets_info = {
csky_regsets, /* Regsets */
0, /* Num_regsets */
NULL, /* Disabled_regsets */
};
-
-static struct regs_info csky_regs_info =
-{
- NULL, /* FIXME: what's this */
- NULL, /* PEEKUSER/PORKUSR isn't supported by kernel > 4.x */
- &csky_regsets_info
-};
-
+static struct regs_info csky_regs_info
+ = { NULL, /* FIXME: what's this */
+ NULL, /* PEEKUSER/PORKUSR isn't supported by kernel > 4.x */
+ &csky_regsets_info };
const regs_info *
csky_target::get_regs_info ()
diff --git a/gdbserver/linux-i386-ipa.cc b/gdbserver/linux-i386-ipa.cc
index 21e690e6adf..b441dff70de 100644
--- a/gdbserver/linux-i386-ipa.cc
+++ b/gdbserver/linux-i386-ipa.cc
@@ -28,23 +28,23 @@
enum i386_gdb_regnum
{
- I386_EAX_REGNUM, /* %eax */
- I386_ECX_REGNUM, /* %ecx */
- I386_EDX_REGNUM, /* %edx */
- I386_EBX_REGNUM, /* %ebx */
- I386_ESP_REGNUM, /* %esp */
- I386_EBP_REGNUM, /* %ebp */
- I386_ESI_REGNUM, /* %esi */
- I386_EDI_REGNUM, /* %edi */
- I386_EIP_REGNUM, /* %eip */
- I386_EFLAGS_REGNUM, /* %eflags */
- I386_CS_REGNUM, /* %cs */
- I386_SS_REGNUM, /* %ss */
- I386_DS_REGNUM, /* %ds */
- I386_ES_REGNUM, /* %es */
- I386_FS_REGNUM, /* %fs */
- I386_GS_REGNUM, /* %gs */
- I386_ST0_REGNUM /* %st(0) */
+ I386_EAX_REGNUM, /* %eax */
+ I386_ECX_REGNUM, /* %ecx */
+ I386_EDX_REGNUM, /* %edx */
+ I386_EBX_REGNUM, /* %ebx */
+ I386_ESP_REGNUM, /* %esp */
+ I386_EBP_REGNUM, /* %ebp */
+ I386_ESI_REGNUM, /* %esi */
+ I386_EDI_REGNUM, /* %edi */
+ I386_EIP_REGNUM, /* %eip */
+ I386_EFLAGS_REGNUM, /* %eflags */
+ I386_CS_REGNUM, /* %cs */
+ I386_SS_REGNUM, /* %ss */
+ I386_DS_REGNUM, /* %ds */
+ I386_ES_REGNUM, /* %es */
+ I386_FS_REGNUM, /* %fs */
+ I386_GS_REGNUM, /* %gs */
+ I386_ST0_REGNUM /* %st(0) */
};
#define i386_num_regs 16
@@ -69,17 +69,15 @@ enum i386_gdb_regnum
/* Mapping between the general-purpose registers in jump tracepoint
format and GDB's register array layout. */
-static const int i386_ft_collect_regmap[] =
-{
- FT_CR_EAX * 4, FT_CR_ECX * 4, FT_CR_EDX * 4, FT_CR_EBX * 4,
- FT_CR_UESP * 4, FT_CR_EBP * 4, FT_CR_ESI * 4, FT_CR_EDI * 4,
- FT_CR_EIP * 4, FT_CR_EFL * 4, FT_CR_CS * 4, FT_CR_SS * 4,
- FT_CR_DS * 4, FT_CR_ES * 4, FT_CR_FS * 4, FT_CR_GS * 4
-};
+static const int i386_ft_collect_regmap[]
+ = { FT_CR_EAX * 4, FT_CR_ECX * 4, FT_CR_EDX * 4, FT_CR_EBX * 4,
+ FT_CR_UESP * 4, FT_CR_EBP * 4, FT_CR_ESI * 4, FT_CR_EDI * 4,
+ FT_CR_EIP * 4, FT_CR_EFL * 4, FT_CR_CS * 4, FT_CR_SS * 4,
+ FT_CR_DS * 4, FT_CR_ES * 4, FT_CR_FS * 4, FT_CR_GS * 4 };
void
supply_fast_tracepoint_registers (struct regcache *regcache,
- const unsigned char *buf)
+ const unsigned char *buf)
{
int i;
@@ -88,9 +86,9 @@ supply_fast_tracepoint_registers (struct regcache *regcache,
int regval;
if (i >= I386_CS_REGNUM && i <= I386_GS_REGNUM)
- regval = *(short *) (((char *) buf) + i386_ft_collect_regmap[i]);
+ regval = *(short *) (((char *) buf) + i386_ft_collect_regmap[i]);
else
- regval = *(int *) (((char *) buf) + i386_ft_collect_regmap[i]);
+ regval = *(int *) (((char *) buf) + i386_ft_collect_regmap[i]);
supply_register (regcache, i, &regval);
}
@@ -120,39 +118,29 @@ get_raw_reg (const unsigned char *raw_regs, int regnum)
contain EIP, but we know what it must have been (the marker
address). */
-#define ST_REGENTRY(REG) \
- { \
- offsetof (struct registers, REG), \
- sizeof (((struct registers *) NULL)->REG) \
+#define ST_REGENTRY(REG) \
+ { \
+ offsetof (struct registers, REG), \
+ sizeof (((struct registers *) NULL)->REG) \
}
static struct
{
int offset;
int size;
-} i386_st_collect_regmap[] =
- {
- ST_REGENTRY(eax),
- ST_REGENTRY(ecx),
- ST_REGENTRY(edx),
- ST_REGENTRY(ebx),
- ST_REGENTRY(esp),
- ST_REGENTRY(ebp),
- ST_REGENTRY(esi),
- ST_REGENTRY(edi),
- { -1, 0 }, /* eip */
- ST_REGENTRY(eflags),
- ST_REGENTRY(cs),
- ST_REGENTRY(ss),
- };
+} i386_st_collect_regmap[] = {
+ ST_REGENTRY (eax), ST_REGENTRY (ecx), ST_REGENTRY (edx),
+ ST_REGENTRY (ebx), ST_REGENTRY (esp), ST_REGENTRY (ebp),
+ ST_REGENTRY (esi), ST_REGENTRY (edi), { -1, 0 }, /* eip */
+ ST_REGENTRY (eflags), ST_REGENTRY (cs), ST_REGENTRY (ss),
+};
#define i386_NUM_ST_COLLECT_GREGS \
(sizeof (i386_st_collect_regmap) / sizeof (i386_st_collect_regmap[0]))
void
supply_static_tracepoint_registers (struct regcache *regcache,
- const unsigned char *buf,
- CORE_ADDR pc)
+ const unsigned char *buf, CORE_ADDR pc)
{
int i;
unsigned int newpc = pc;
@@ -162,32 +150,30 @@ supply_static_tracepoint_registers (struct regcache *regcache,
for (i = 0; i < i386_NUM_ST_COLLECT_GREGS; i++)
if (i386_st_collect_regmap[i].offset != -1)
{
- switch (i386_st_collect_regmap[i].size)
- {
- case 4:
- supply_register (regcache, i,
- ((char *) buf)
- + i386_st_collect_regmap[i].offset);
- break;
- case 2:
- {
- unsigned long reg
- = * (short *) (((char *) buf)
- + i386_st_collect_regmap[i].offset);
- reg &= 0xffff;
- supply_register (regcache, i, &reg);
- }
- break;
- default:
- internal_error ("unhandled register size: %d",
- i386_st_collect_regmap[i].size);
- }
+ switch (i386_st_collect_regmap[i].size)
+ {
+ case 4:
+ supply_register (regcache, i,
+ ((char *) buf)
+ + i386_st_collect_regmap[i].offset);
+ break;
+ case 2:
+ {
+ unsigned long reg = *(
+ short *) (((char *) buf) + i386_st_collect_regmap[i].offset);
+ reg &= 0xffff;
+ supply_register (regcache, i, &reg);
+ }
+ break;
+ default:
+ internal_error ("unhandled register size: %d",
+ i386_st_collect_regmap[i].size);
+ }
}
}
#endif /* HAVE_UST */
-
/* This is only needed because reg-i386-linux-lib.o references it. We
may use it proper at some point. */
const char *gdbserver_xmltarget;
@@ -208,39 +194,38 @@ initialize_fast_tracepoint_trampoline_buffer (void)
FILE *f = fopen ("/proc/sys/vm/mmap_min_addr", "r");
if (!f)
- {
+ {
snprintf (buf, sizeof (buf), "mmap_min_addr open failed: %s",
- safe_strerror (errno));
+ safe_strerror (errno));
set_trampoline_buffer_space (0, 0, buf);
return;
}
if (fgets (buf, IPA_BUFSIZ, f))
sscanf (buf, "%llu", &mmap_min_addr);
-
+
fclose (f);
-
+
buffer_size = buffer_end - mmap_min_addr;
if (buffer_size >= min_buffer_size)
{
if (mmap ((void *) (uintptr_t) mmap_min_addr, buffer_size,
- PROT_READ | PROT_EXEC | PROT_WRITE,
- MAP_FIXED | MAP_PRIVATE | MAP_ANONYMOUS,
- -1, 0)
- != MAP_FAILED)
- set_trampoline_buffer_space (mmap_min_addr, buffer_end, NULL);
+ PROT_READ | PROT_EXEC | PROT_WRITE,
+ MAP_FIXED | MAP_PRIVATE | MAP_ANONYMOUS, -1, 0)
+ != MAP_FAILED)
+ set_trampoline_buffer_space (mmap_min_addr, buffer_end, NULL);
else
- {
- snprintf (buf, IPA_BUFSIZ, "low-64K-buffer mmap() failed: %s",
- safe_strerror (errno));
- set_trampoline_buffer_space (0, 0, buf);
- }
+ {
+ snprintf (buf, IPA_BUFSIZ, "low-64K-buffer mmap() failed: %s",
+ safe_strerror (errno));
+ set_trampoline_buffer_space (0, 0, buf);
+ }
}
else
{
snprintf (buf, IPA_BUFSIZ, "mmap_min_addr is %d, must be %d or less",
- (int) mmap_min_addr, (int) buffer_end - min_buffer_size);
+ (int) mmap_min_addr, (int) buffer_end - min_buffer_size);
set_trampoline_buffer_space (0, 0, buf);
}
}
@@ -276,7 +261,7 @@ void *
alloc_jump_pad_buffer (size_t size)
{
void *res = mmap (NULL, size, PROT_READ | PROT_WRITE | PROT_EXEC,
- MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
+ MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
if (res == MAP_FAILED)
return NULL;
diff --git a/gdbserver/linux-ia64-low.cc b/gdbserver/linux-ia64-low.cc
index 2586e576b8e..e9a8e6c40fd 100644
--- a/gdbserver/linux-ia64-low.cc
+++ b/gdbserver/linux-ia64-low.cc
@@ -28,13 +28,11 @@
class ia64_target : public linux_process_target
{
public:
-
const regs_info *get_regs_info () override;
const gdb_byte *sw_breakpoint_from_kind (int kind, int *size) override;
protected:
-
void low_arch_setup () override;
bool low_cannot_fetch_register (int regno) override;
@@ -54,14 +52,14 @@ const gdb_byte *
ia64_target::sw_breakpoint_from_kind (int kind, int *size)
{
gdb_assert_not_reached ("target op sw_breakpoint_from_kind is not "
- "implemented by this target");
+ "implemented by this target");
}
bool
ia64_target::low_breakpoint_at (CORE_ADDR pc)
{
gdb_assert_not_reached ("linux target op low_breakpoint_at is not "
- "implemented by this target");
+ "implemented by this target");
}
/* Defined in auto-generated file reg-ia64.c. */
@@ -72,240 +70,479 @@ extern const struct target_desc *tdesc_ia64;
#include <asm/ptrace_offsets.h>
-static int ia64_regmap[] =
- {
- /* general registers */
- -1, /* gr0 not available; i.e, it's always zero */
- PT_R1,
- PT_R2,
- PT_R3,
- PT_R4,
- PT_R5,
- PT_R6,
- PT_R7,
- PT_R8,
- PT_R9,
- PT_R10,
- PT_R11,
- PT_R12,
- PT_R13,
- PT_R14,
- PT_R15,
- PT_R16,
- PT_R17,
- PT_R18,
- PT_R19,
- PT_R20,
- PT_R21,
- PT_R22,
- PT_R23,
- PT_R24,
- PT_R25,
- PT_R26,
- PT_R27,
- PT_R28,
- PT_R29,
- PT_R30,
- PT_R31,
- /* gr32 through gr127 not directly available via the ptrace interface */
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- /* Floating point registers */
- -1, -1, /* f0 and f1 not available (f0 is +0.0 and f1 is +1.0) */
- PT_F2,
- PT_F3,
- PT_F4,
- PT_F5,
- PT_F6,
- PT_F7,
- PT_F8,
- PT_F9,
- PT_F10,
- PT_F11,
- PT_F12,
- PT_F13,
- PT_F14,
- PT_F15,
- PT_F16,
- PT_F17,
- PT_F18,
- PT_F19,
- PT_F20,
- PT_F21,
- PT_F22,
- PT_F23,
- PT_F24,
- PT_F25,
- PT_F26,
- PT_F27,
- PT_F28,
- PT_F29,
- PT_F30,
- PT_F31,
- PT_F32,
- PT_F33,
- PT_F34,
- PT_F35,
- PT_F36,
- PT_F37,
- PT_F38,
- PT_F39,
- PT_F40,
- PT_F41,
- PT_F42,
- PT_F43,
- PT_F44,
- PT_F45,
- PT_F46,
- PT_F47,
- PT_F48,
- PT_F49,
- PT_F50,
- PT_F51,
- PT_F52,
- PT_F53,
- PT_F54,
- PT_F55,
- PT_F56,
- PT_F57,
- PT_F58,
- PT_F59,
- PT_F60,
- PT_F61,
- PT_F62,
- PT_F63,
- PT_F64,
- PT_F65,
- PT_F66,
- PT_F67,
- PT_F68,
- PT_F69,
- PT_F70,
- PT_F71,
- PT_F72,
- PT_F73,
- PT_F74,
- PT_F75,
- PT_F76,
- PT_F77,
- PT_F78,
- PT_F79,
- PT_F80,
- PT_F81,
- PT_F82,
- PT_F83,
- PT_F84,
- PT_F85,
- PT_F86,
- PT_F87,
- PT_F88,
- PT_F89,
- PT_F90,
- PT_F91,
- PT_F92,
- PT_F93,
- PT_F94,
- PT_F95,
- PT_F96,
- PT_F97,
- PT_F98,
- PT_F99,
- PT_F100,
- PT_F101,
- PT_F102,
- PT_F103,
- PT_F104,
- PT_F105,
- PT_F106,
- PT_F107,
- PT_F108,
- PT_F109,
- PT_F110,
- PT_F111,
- PT_F112,
- PT_F113,
- PT_F114,
- PT_F115,
- PT_F116,
- PT_F117,
- PT_F118,
- PT_F119,
- PT_F120,
- PT_F121,
- PT_F122,
- PT_F123,
- PT_F124,
- PT_F125,
- PT_F126,
- PT_F127,
- /* predicate registers - we don't fetch these individually */
- -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1,
- /* branch registers */
- PT_B0,
- PT_B1,
- PT_B2,
- PT_B3,
- PT_B4,
- PT_B5,
- PT_B6,
- PT_B7,
- /* virtual frame pointer and virtual return address pointer */
- -1, -1,
- /* other registers */
- PT_PR,
- PT_CR_IIP, /* ip */
- PT_CR_IPSR, /* psr */
- PT_CFM, /* cfm */
- /* kernel registers not visible via ptrace interface (?) */
- -1, -1, -1, -1, -1, -1, -1, -1,
- /* hole */
- -1, -1, -1, -1, -1, -1, -1, -1,
- PT_AR_RSC,
- PT_AR_BSP,
- PT_AR_BSPSTORE,
- PT_AR_RNAT,
- -1,
- -1, /* Not available: FCR, IA32 floating control register */
- -1, -1,
- -1, /* Not available: EFLAG */
- -1, /* Not available: CSD */
- -1, /* Not available: SSD */
- -1, /* Not available: CFLG */
- -1, /* Not available: FSR */
- -1, /* Not available: FIR */
- -1, /* Not available: FDR */
- -1,
- PT_AR_CCV,
- -1, -1, -1,
- PT_AR_UNAT,
- -1, -1, -1,
- PT_AR_FPSR,
- -1, -1, -1,
- -1, /* Not available: ITC */
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1,
- PT_AR_PFS,
- PT_AR_LC,
- PT_AR_EC,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1,
- };
+static int ia64_regmap[] = {
+ /* general registers */
+ -1, /* gr0 not available; i.e, it's always zero */
+ PT_R1,
+ PT_R2,
+ PT_R3,
+ PT_R4,
+ PT_R5,
+ PT_R6,
+ PT_R7,
+ PT_R8,
+ PT_R9,
+ PT_R10,
+ PT_R11,
+ PT_R12,
+ PT_R13,
+ PT_R14,
+ PT_R15,
+ PT_R16,
+ PT_R17,
+ PT_R18,
+ PT_R19,
+ PT_R20,
+ PT_R21,
+ PT_R22,
+ PT_R23,
+ PT_R24,
+ PT_R25,
+ PT_R26,
+ PT_R27,
+ PT_R28,
+ PT_R29,
+ PT_R30,
+ PT_R31,
+ /* gr32 through gr127 not directly available via the ptrace interface */
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ /* Floating point registers */
+ -1,
+ -1, /* f0 and f1 not available (f0 is +0.0 and f1 is +1.0) */
+ PT_F2,
+ PT_F3,
+ PT_F4,
+ PT_F5,
+ PT_F6,
+ PT_F7,
+ PT_F8,
+ PT_F9,
+ PT_F10,
+ PT_F11,
+ PT_F12,
+ PT_F13,
+ PT_F14,
+ PT_F15,
+ PT_F16,
+ PT_F17,
+ PT_F18,
+ PT_F19,
+ PT_F20,
+ PT_F21,
+ PT_F22,
+ PT_F23,
+ PT_F24,
+ PT_F25,
+ PT_F26,
+ PT_F27,
+ PT_F28,
+ PT_F29,
+ PT_F30,
+ PT_F31,
+ PT_F32,
+ PT_F33,
+ PT_F34,
+ PT_F35,
+ PT_F36,
+ PT_F37,
+ PT_F38,
+ PT_F39,
+ PT_F40,
+ PT_F41,
+ PT_F42,
+ PT_F43,
+ PT_F44,
+ PT_F45,
+ PT_F46,
+ PT_F47,
+ PT_F48,
+ PT_F49,
+ PT_F50,
+ PT_F51,
+ PT_F52,
+ PT_F53,
+ PT_F54,
+ PT_F55,
+ PT_F56,
+ PT_F57,
+ PT_F58,
+ PT_F59,
+ PT_F60,
+ PT_F61,
+ PT_F62,
+ PT_F63,
+ PT_F64,
+ PT_F65,
+ PT_F66,
+ PT_F67,
+ PT_F68,
+ PT_F69,
+ PT_F70,
+ PT_F71,
+ PT_F72,
+ PT_F73,
+ PT_F74,
+ PT_F75,
+ PT_F76,
+ PT_F77,
+ PT_F78,
+ PT_F79,
+ PT_F80,
+ PT_F81,
+ PT_F82,
+ PT_F83,
+ PT_F84,
+ PT_F85,
+ PT_F86,
+ PT_F87,
+ PT_F88,
+ PT_F89,
+ PT_F90,
+ PT_F91,
+ PT_F92,
+ PT_F93,
+ PT_F94,
+ PT_F95,
+ PT_F96,
+ PT_F97,
+ PT_F98,
+ PT_F99,
+ PT_F100,
+ PT_F101,
+ PT_F102,
+ PT_F103,
+ PT_F104,
+ PT_F105,
+ PT_F106,
+ PT_F107,
+ PT_F108,
+ PT_F109,
+ PT_F110,
+ PT_F111,
+ PT_F112,
+ PT_F113,
+ PT_F114,
+ PT_F115,
+ PT_F116,
+ PT_F117,
+ PT_F118,
+ PT_F119,
+ PT_F120,
+ PT_F121,
+ PT_F122,
+ PT_F123,
+ PT_F124,
+ PT_F125,
+ PT_F126,
+ PT_F127,
+ /* predicate registers - we don't fetch these individually */
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ /* branch registers */
+ PT_B0,
+ PT_B1,
+ PT_B2,
+ PT_B3,
+ PT_B4,
+ PT_B5,
+ PT_B6,
+ PT_B7,
+ /* virtual frame pointer and virtual return address pointer */
+ -1,
+ -1,
+ /* other registers */
+ PT_PR,
+ PT_CR_IIP, /* ip */
+ PT_CR_IPSR, /* psr */
+ PT_CFM, /* cfm */
+ /* kernel registers not visible via ptrace interface (?) */
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ /* hole */
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ PT_AR_RSC,
+ PT_AR_BSP,
+ PT_AR_BSPSTORE,
+ PT_AR_RNAT,
+ -1,
+ -1, /* Not available: FCR, IA32 floating control register */
+ -1,
+ -1,
+ -1, /* Not available: EFLAG */
+ -1, /* Not available: CSD */
+ -1, /* Not available: SSD */
+ -1, /* Not available: CFLG */
+ -1, /* Not available: FSR */
+ -1, /* Not available: FIR */
+ -1, /* Not available: FDR */
+ -1,
+ PT_AR_CCV,
+ -1,
+ -1,
+ -1,
+ PT_AR_UNAT,
+ -1,
+ -1,
+ -1,
+ PT_AR_FPSR,
+ -1,
+ -1,
+ -1,
+ -1, /* Not available: ITC */
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ PT_AR_PFS,
+ PT_AR_LC,
+ PT_AR_EC,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+};
bool
ia64_target::low_cannot_store_register (int regno)
@@ -320,9 +557,9 @@ ia64_target::low_cannot_fetch_register (int regno)
}
/* GDB register numbers. */
-#define IA64_GR0_REGNUM 0
-#define IA64_FR0_REGNUM 128
-#define IA64_FR1_REGNUM 129
+#define IA64_GR0_REGNUM 0
+#define IA64_FR0_REGNUM 128
+#define IA64_FR1_REGNUM 129
bool
ia64_target::low_fetch_register (regcache *regcache, int regnum)
@@ -350,8 +587,8 @@ ia64_target::low_fetch_register (regcache *regcache, int regnum)
/* fr1 cannot be fetched but is always one (1.0). */
if (regnum == IA64_FR1_REGNUM)
{
- const gdb_byte f_one[16] =
- { 0, 0, 0, 0, 0, 0, 0, 0x80, 0xff, 0xff, 0, 0, 0, 0, 0, 0 };
+ const gdb_byte f_one[16]
+ = { 0, 0, 0, 0, 0, 0, 0, 0x80, 0xff, 0xff, 0, 0, 0, 0, 0, 0 };
gdb_assert (sizeof (f_one) == register_size (regcache->tdesc, regnum));
supply_register (regcache, regnum, f_one);
@@ -361,17 +598,13 @@ ia64_target::low_fetch_register (regcache *regcache, int regnum)
return false;
}
-static struct usrregs_info ia64_usrregs_info =
- {
- ia64_num_regs,
- ia64_regmap,
- };
-
-static struct regs_info myregs_info =
- {
- NULL, /* regset_bitmap */
- &ia64_usrregs_info
- };
+static struct usrregs_info ia64_usrregs_info = {
+ ia64_num_regs,
+ ia64_regmap,
+};
+
+static struct regs_info myregs_info = { NULL, /* regset_bitmap */
+ &ia64_usrregs_info };
const regs_info *
ia64_target::get_regs_info ()
diff --git a/gdbserver/linux-loongarch-low.cc b/gdbserver/linux-loongarch-low.cc
index ead2e76d25d..c2c59bc0584 100644
--- a/gdbserver/linux-loongarch-low.cc
+++ b/gdbserver/linux-loongarch-low.cc
@@ -28,7 +28,6 @@
class loongarch_target : public linux_process_target
{
public:
-
const regs_info *get_regs_info () override;
int breakpoint_kind_from_pc (CORE_ADDR *pcptr) override;
@@ -36,7 +35,6 @@ public:
const gdb_byte *sw_breakpoint_from_kind (int kind, int *size) override;
protected:
-
void low_arch_setup () override;
bool low_cannot_fetch_register (int regno) override;
@@ -62,14 +60,14 @@ bool
loongarch_target::low_cannot_fetch_register (int regno)
{
gdb_assert_not_reached ("linux target op low_cannot_fetch_register "
- "is not implemented by the target");
+ "is not implemented by the target");
}
bool
loongarch_target::low_cannot_store_register (int regno)
{
gdb_assert_not_reached ("linux target op low_cannot_store_register "
- "is not implemented by the target");
+ "is not implemented by the target");
}
/* Implementation of linux target ops method "low_arch_setup". */
@@ -99,9 +97,12 @@ loongarch_fill_gregset (struct regcache *regcache, void *buf)
for (i = 1; i < 32; i++)
collect_register (regcache, i, *regset + i);
- collect_register (regcache, LOONGARCH_ORIG_A0_REGNUM, *regset + LOONGARCH_ORIG_A0_REGNUM);
- collect_register (regcache, LOONGARCH_PC_REGNUM, *regset + LOONGARCH_PC_REGNUM);
- collect_register (regcache, LOONGARCH_BADV_REGNUM, *regset + LOONGARCH_BADV_REGNUM);
+ collect_register (regcache, LOONGARCH_ORIG_A0_REGNUM,
+ *regset + LOONGARCH_ORIG_A0_REGNUM);
+ collect_register (regcache, LOONGARCH_PC_REGNUM,
+ *regset + LOONGARCH_PC_REGNUM);
+ collect_register (regcache, LOONGARCH_BADV_REGNUM,
+ *regset + LOONGARCH_BADV_REGNUM);
}
/* Supply GPRs from BUF into REGCACHE. */
@@ -115,9 +116,12 @@ loongarch_store_gregset (struct regcache *regcache, const void *buf)
supply_register_zeroed (regcache, 0);
for (i = 1; i < 32; i++)
supply_register (regcache, i, *regset + i);
- supply_register (regcache, LOONGARCH_ORIG_A0_REGNUM, *regset + LOONGARCH_ORIG_A0_REGNUM);
- supply_register (regcache, LOONGARCH_PC_REGNUM, *regset + LOONGARCH_PC_REGNUM);
- supply_register (regcache, LOONGARCH_BADV_REGNUM, *regset + LOONGARCH_BADV_REGNUM);
+ supply_register (regcache, LOONGARCH_ORIG_A0_REGNUM,
+ *regset + LOONGARCH_ORIG_A0_REGNUM);
+ supply_register (regcache, LOONGARCH_PC_REGNUM,
+ *regset + LOONGARCH_PC_REGNUM);
+ supply_register (regcache, LOONGARCH_BADV_REGNUM,
+ *regset + LOONGARCH_BADV_REGNUM);
}
/* Collect FPRs from REGCACHE into BUF. */
@@ -131,19 +135,19 @@ loongarch_fill_fpregset (struct regcache *regcache, void *buf)
for (int i = 0; i < LOONGARCH_LINUX_NUM_FPREGSET; i++)
{
- regbuf = (gdb_byte *)buf + fprsize * i;
+ regbuf = (gdb_byte *) buf + fprsize * i;
collect_register (regcache, LOONGARCH_FIRST_FP_REGNUM + i, regbuf);
}
for (int i = 0; i < LOONGARCH_LINUX_NUM_FCC; i++)
{
- regbuf = (gdb_byte *)buf + fprsize * LOONGARCH_LINUX_NUM_FPREGSET +
- fccsize * i;
+ regbuf = (gdb_byte *) buf + fprsize * LOONGARCH_LINUX_NUM_FPREGSET
+ + fccsize * i;
collect_register (regcache, LOONGARCH_FIRST_FCC_REGNUM + i, regbuf);
}
- regbuf = (gdb_byte *)buf + fprsize * LOONGARCH_LINUX_NUM_FPREGSET +
- fccsize * LOONGARCH_LINUX_NUM_FCC;
+ regbuf = (gdb_byte *) buf + fprsize * LOONGARCH_LINUX_NUM_FPREGSET
+ + fccsize * LOONGARCH_LINUX_NUM_FCC;
collect_register (regcache, LOONGARCH_FCSR_REGNUM, regbuf);
}
@@ -158,19 +162,19 @@ loongarch_store_fpregset (struct regcache *regcache, const void *buf)
for (int i = 0; i < LOONGARCH_LINUX_NUM_FPREGSET; i++)
{
- regbuf = (const gdb_byte *)buf + fprsize * i;
+ regbuf = (const gdb_byte *) buf + fprsize * i;
supply_register (regcache, LOONGARCH_FIRST_FP_REGNUM + i, regbuf);
}
for (int i = 0; i < LOONGARCH_LINUX_NUM_FCC; i++)
{
- regbuf = (const gdb_byte *)buf + fprsize * LOONGARCH_LINUX_NUM_FPREGSET +
- fccsize * i;
+ regbuf = (const gdb_byte *) buf + fprsize * LOONGARCH_LINUX_NUM_FPREGSET
+ + fccsize * i;
supply_register (regcache, LOONGARCH_FIRST_FCC_REGNUM + i, regbuf);
}
- regbuf = (const gdb_byte *)buf + fprsize * LOONGARCH_LINUX_NUM_FPREGSET +
- fccsize * LOONGARCH_LINUX_NUM_FCC;
+ regbuf = (const gdb_byte *) buf + fprsize * LOONGARCH_LINUX_NUM_FPREGSET
+ + fccsize * LOONGARCH_LINUX_NUM_FCC;
supply_register (regcache, LOONGARCH_FCSR_REGNUM, regbuf);
}
@@ -184,20 +188,18 @@ static struct regset_info loongarch_regsets[] = {
};
/* LoongArch/Linux regset information. */
-static struct regsets_info loongarch_regsets_info =
- {
- loongarch_regsets, /* regsets */
- 0, /* num_regsets */
- NULL, /* disabled_regsets */
- };
+static struct regsets_info loongarch_regsets_info = {
+ loongarch_regsets, /* regsets */
+ 0, /* num_regsets */
+ NULL, /* disabled_regsets */
+};
/* Definition of linux_target_ops data member "regs_info". */
-static struct regs_info loongarch_regs =
- {
- NULL, /* regset_bitmap */
- NULL, /* usrregs */
- &loongarch_regsets_info,
- };
+static struct regs_info loongarch_regs = {
+ NULL, /* regset_bitmap */
+ NULL, /* usrregs */
+ &loongarch_regsets_info,
+};
/* Implementation of linux target ops method "get_regs_info". */
@@ -251,7 +253,7 @@ loongarch_target::low_set_pc (regcache *regcache, CORE_ADDR newpc)
/* LoongArch BRK software debug mode instruction.
This instruction needs to match gdb/loongarch-tdep.c
(loongarch_default_breakpoint). */
-static const gdb_byte loongarch_breakpoint[] = {0x05, 0x00, 0x2a, 0x00};
+static const gdb_byte loongarch_breakpoint[] = { 0x05, 0x00, 0x2a, 0x00 };
/* Implementation of target ops method "breakpoint_kind_from_pc". */
diff --git a/gdbserver/linux-low.cc b/gdbserver/linux-low.cc
index 5cd22824e47..55788bb946c 100644
--- a/gdbserver/linux-low.cc
+++ b/gdbserver/linux-low.cc
@@ -73,47 +73,43 @@
/* Some targets did not define these ptrace constants from the start,
so gdbserver defines them locally here. In the future, these may
be removed after they are added to asm/ptrace.h. */
-#if !(defined(PT_TEXT_ADDR) \
- || defined(PT_DATA_ADDR) \
+#if !(defined(PT_TEXT_ADDR) || defined(PT_DATA_ADDR) \
|| defined(PT_TEXT_END_ADDR))
#if defined(__mcoldfire__)
/* These are still undefined in 3.10 kernels. */
-#define PT_TEXT_ADDR 49*4
-#define PT_DATA_ADDR 50*4
-#define PT_TEXT_END_ADDR 51*4
+#define PT_TEXT_ADDR 49 * 4
+#define PT_DATA_ADDR 50 * 4
+#define PT_TEXT_END_ADDR 51 * 4
/* These are still undefined in 3.10 kernels. */
#elif defined(__TMS320C6X__)
-#define PT_TEXT_ADDR (0x10000*4)
-#define PT_DATA_ADDR (0x10004*4)
-#define PT_TEXT_END_ADDR (0x10008*4)
+#define PT_TEXT_ADDR (0x10000 * 4)
+#define PT_DATA_ADDR (0x10004 * 4)
+#define PT_TEXT_END_ADDR (0x10008 * 4)
#endif
#endif
-#if (defined(__UCLIBC__) \
- && defined(HAS_NOMMU) \
- && defined(PT_TEXT_ADDR) \
- && defined(PT_DATA_ADDR) \
- && defined(PT_TEXT_END_ADDR))
+#if (defined(__UCLIBC__) && defined(HAS_NOMMU) && defined(PT_TEXT_ADDR) \
+ && defined(PT_DATA_ADDR) && defined(PT_TEXT_END_ADDR))
#define SUPPORTS_READ_OFFSETS
#endif
#ifdef HAVE_LINUX_BTRACE
-# include "nat/linux-btrace.h"
-# include "gdbsupport/btrace-common.h"
+#include "nat/linux-btrace.h"
+#include "gdbsupport/btrace-common.h"
#endif
#ifndef HAVE_ELF32_AUXV_T
/* Copied from glibc's elf.h. */
typedef struct
{
- uint32_t a_type; /* Entry type */
+ uint32_t a_type; /* Entry type */
union
- {
- uint32_t a_val; /* Integer value */
- /* We use to have pointer elements added here. We cannot do that,
+ {
+ uint32_t a_val; /* Integer value */
+ /* We use to have pointer elements added here. We cannot do that,
though, since it does not work when using 32-bit definitions
on 64-bit platforms and vice versa. */
- } a_un;
+ } a_un;
} Elf32_auxv_t;
#endif
@@ -121,14 +117,14 @@ typedef struct
/* Copied from glibc's elf.h. */
typedef struct
{
- uint64_t a_type; /* Entry type */
+ uint64_t a_type; /* Entry type */
union
- {
- uint64_t a_val; /* Integer value */
- /* We use to have pointer elements added here. We cannot do that,
+ {
+ uint64_t a_val; /* Integer value */
+ /* We use to have pointer elements added here. We cannot do that,
though, since it does not work when using 32-bit definitions
on 64-bit platforms and vice versa. */
- } a_un;
+ } a_un;
} Elf64_auxv_t;
#endif
@@ -157,8 +153,7 @@ ptid_of_lwp (struct lwp_info *lwp)
/* See nat/linux-nat.h. */
void
-lwp_set_arch_private_info (struct lwp_info *lwp,
- struct arch_lwp_info *info)
+lwp_set_arch_private_info (struct lwp_info *lwp, struct arch_lwp_info *info)
{
lwp->arch_private = info;
}
@@ -234,27 +229,27 @@ pull_pid_from_list (struct simple_pid_list **listp, int pid, int *statusp)
for (p = listp; *p != NULL; p = &(*p)->next)
if ((*p)->pid == pid)
{
- struct simple_pid_list *next = (*p)->next;
+ struct simple_pid_list *next = (*p)->next;
- *statusp = (*p)->status;
- xfree (*p);
- *p = next;
- return 1;
+ *statusp = (*p)->status;
+ xfree (*p);
+ *p = next;
+ return 1;
}
return 0;
}
enum stopping_threads_kind
- {
- /* Not stopping threads presently. */
- NOT_STOPPING_THREADS,
+{
+ /* Not stopping threads presently. */
+ NOT_STOPPING_THREADS,
- /* Stopping threads. */
- STOPPING_THREADS,
+ /* Stopping threads. */
+ STOPPING_THREADS,
- /* Stopping and suspending threads. */
- STOPPING_AND_SUSPENDING_THREADS
- };
+ /* Stopping and suspending threads. */
+ STOPPING_AND_SUSPENDING_THREADS
+};
/* This is set while stop_all_lwps is in effect. */
static stopping_threads_kind stopping_threads = NOT_STOPPING_THREADS;
@@ -270,7 +265,8 @@ static void unsuspend_all_lwps (struct lwp_info *except);
static void mark_lwp_dead (struct lwp_info *lwp, int wstat);
static int lwp_is_marked_dead (struct lwp_info *lwp);
static int kill_lwp (unsigned long lwpid, int signo);
-static void enqueue_pending_signal (struct lwp_info *lwp, int signal, siginfo_t *info);
+static void enqueue_pending_signal (struct lwp_info *lwp, int signal,
+ siginfo_t *info);
static int linux_low_ptrace_options (int attached);
static int check_ptrace_stopped_lwp_gone (struct lwp_info *lp);
@@ -300,7 +296,7 @@ std::vector<CORE_ADDR>
linux_process_target::low_get_next_pcs (regcache *regcache)
{
gdb_assert_not_reached ("linux target op low_get_next_pcs is not "
- "implemented");
+ "implemented");
}
int
@@ -339,7 +335,6 @@ elf_64_header_p (const Elf64_Ehdr *header, unsigned int *machine)
{
*machine = header->e_machine;
return header->e_ident[EI_CLASS] == ELFCLASS64;
-
}
*machine = EM_NONE;
return -1;
@@ -431,7 +426,6 @@ linux_process_target::add_linux_process_no_mem_file (int pid, int attached)
return proc;
}
-
process_info *
linux_process_target::add_linux_process (int pid, int attached)
{
@@ -485,7 +479,7 @@ linux_process_target::arch_setup_thread (thread_info *thread)
int
linux_process_target::handle_extended_wait (lwp_info **orig_event_lwp,
- int wstat)
+ int wstat)
{
client_state &cs = get_client_state ();
struct lwp_info *event_lwp = *orig_event_lwp;
@@ -509,129 +503,126 @@ linux_process_target::handle_extended_wait (lwp_info **orig_event_lwp,
/* Get the pid of the new lwp. */
ptrace (PTRACE_GETEVENTMSG, lwpid_of (event_thr), (PTRACE_TYPE_ARG3) 0,
- &new_pid);
+ &new_pid);
/* If we haven't already seen the new PID stop, wait for it now. */
if (!pull_pid_from_list (&stopped_pids, new_pid, &status))
- {
- /* The new child has a pending SIGSTOP. We can't affect it until it
+ {
+ /* The new child has a pending SIGSTOP. We can't affect it until it
hits the SIGSTOP, but we're already attached. */
- ret = my_waitpid (new_pid, &status, __WALL);
+ ret = my_waitpid (new_pid, &status, __WALL);
- if (ret == -1)
- perror_with_name ("waiting for new child");
- else if (ret != new_pid)
- warning ("wait returned unexpected PID %d", ret);
- else if (!WIFSTOPPED (status))
- warning ("wait returned unexpected status 0x%x", status);
- }
+ if (ret == -1)
+ perror_with_name ("waiting for new child");
+ else if (ret != new_pid)
+ warning ("wait returned unexpected PID %d", ret);
+ else if (!WIFSTOPPED (status))
+ warning ("wait returned unexpected status 0x%x", status);
+ }
if (event == PTRACE_EVENT_FORK || event == PTRACE_EVENT_VFORK)
- {
- struct process_info *parent_proc;
- struct process_info *child_proc;
- struct lwp_info *child_lwp;
- struct thread_info *child_thr;
+ {
+ struct process_info *parent_proc;
+ struct process_info *child_proc;
+ struct lwp_info *child_lwp;
+ struct thread_info *child_thr;
- ptid = ptid_t (new_pid, new_pid);
+ ptid = ptid_t (new_pid, new_pid);
- threads_debug_printf ("Got fork event from LWP %ld, "
- "new child is %d",
- ptid_of (event_thr).lwp (),
- ptid.pid ());
+ threads_debug_printf ("Got fork event from LWP %ld, "
+ "new child is %d",
+ ptid_of (event_thr).lwp (), ptid.pid ());
- /* Add the new process to the tables and clone the breakpoint
+ /* Add the new process to the tables and clone the breakpoint
lists of the parent. We need to do this even if the new process
will be detached, since we will need the process object and the
breakpoints to remove any breakpoints from memory when we
detach, and the client side will access registers. */
- child_proc = add_linux_process (new_pid, 0);
- gdb_assert (child_proc != NULL);
- child_lwp = add_lwp (ptid);
- gdb_assert (child_lwp != NULL);
- child_lwp->stopped = 1;
- child_lwp->must_set_ptrace_flags = 1;
- child_lwp->status_pending_p = 0;
- child_thr = get_lwp_thread (child_lwp);
- child_thr->last_resume_kind = resume_stop;
- child_thr->last_status.set_stopped (GDB_SIGNAL_0);
-
- /* If we're suspending all threads, leave this one suspended
+ child_proc = add_linux_process (new_pid, 0);
+ gdb_assert (child_proc != NULL);
+ child_lwp = add_lwp (ptid);
+ gdb_assert (child_lwp != NULL);
+ child_lwp->stopped = 1;
+ child_lwp->must_set_ptrace_flags = 1;
+ child_lwp->status_pending_p = 0;
+ child_thr = get_lwp_thread (child_lwp);
+ child_thr->last_resume_kind = resume_stop;
+ child_thr->last_status.set_stopped (GDB_SIGNAL_0);
+
+ /* If we're suspending all threads, leave this one suspended
too. If the fork/clone parent is stepping over a breakpoint,
all other threads have been suspended already. Leave the
child suspended too. */
- if (stopping_threads == STOPPING_AND_SUSPENDING_THREADS
- || event_lwp->bp_reinsert != 0)
- {
- threads_debug_printf ("leaving child suspended");
- child_lwp->suspended = 1;
- }
-
- parent_proc = get_thread_process (event_thr);
- child_proc->attached = parent_proc->attached;
-
- if (event_lwp->bp_reinsert != 0
- && supports_software_single_step ()
- && event == PTRACE_EVENT_VFORK)
- {
- /* If we leave single-step breakpoints there, child will
+ if (stopping_threads == STOPPING_AND_SUSPENDING_THREADS
+ || event_lwp->bp_reinsert != 0)
+ {
+ threads_debug_printf ("leaving child suspended");
+ child_lwp->suspended = 1;
+ }
+
+ parent_proc = get_thread_process (event_thr);
+ child_proc->attached = parent_proc->attached;
+
+ if (event_lwp->bp_reinsert != 0 && supports_software_single_step ()
+ && event == PTRACE_EVENT_VFORK)
+ {
+ /* If we leave single-step breakpoints there, child will
hit it, so uninsert single-step breakpoints from parent
(and child). Once vfork child is done, reinsert
them back to parent. */
- uninsert_single_step_breakpoints (event_thr);
- }
+ uninsert_single_step_breakpoints (event_thr);
+ }
- clone_all_breakpoints (child_thr, event_thr);
+ clone_all_breakpoints (child_thr, event_thr);
- target_desc_up tdesc = allocate_target_description ();
- copy_target_description (tdesc.get (), parent_proc->tdesc);
- child_proc->tdesc = tdesc.release ();
+ target_desc_up tdesc = allocate_target_description ();
+ copy_target_description (tdesc.get (), parent_proc->tdesc);
+ child_proc->tdesc = tdesc.release ();
- /* Clone arch-specific process data. */
- low_new_fork (parent_proc, child_proc);
+ /* Clone arch-specific process data. */
+ low_new_fork (parent_proc, child_proc);
- /* Save fork info in the parent thread. */
- if (event == PTRACE_EVENT_FORK)
- event_lwp->waitstatus.set_forked (ptid);
- else if (event == PTRACE_EVENT_VFORK)
- event_lwp->waitstatus.set_vforked (ptid);
+ /* Save fork info in the parent thread. */
+ if (event == PTRACE_EVENT_FORK)
+ event_lwp->waitstatus.set_forked (ptid);
+ else if (event == PTRACE_EVENT_VFORK)
+ event_lwp->waitstatus.set_vforked (ptid);
- /* The status_pending field contains bits denoting the
+ /* The status_pending field contains bits denoting the
extended event, so when the pending event is handled,
the handler will look at lwp->waitstatus. */
- event_lwp->status_pending_p = 1;
- event_lwp->status_pending = wstat;
+ event_lwp->status_pending_p = 1;
+ event_lwp->status_pending = wstat;
- /* Link the threads until the parent event is passed on to
+ /* Link the threads until the parent event is passed on to
higher layers. */
- event_lwp->fork_relative = child_lwp;
- child_lwp->fork_relative = event_lwp;
+ event_lwp->fork_relative = child_lwp;
+ child_lwp->fork_relative = event_lwp;
- /* If the parent thread is doing step-over with single-step
+ /* If the parent thread is doing step-over with single-step
breakpoints, the list of single-step breakpoints are cloned
from the parent's. Remove them from the child process.
In case of vfork, we'll reinsert them back once vforked
child is done. */
- if (event_lwp->bp_reinsert != 0
- && supports_software_single_step ())
- {
- /* The child process is forked and stopped, so it is safe
+ if (event_lwp->bp_reinsert != 0 && supports_software_single_step ())
+ {
+ /* The child process is forked and stopped, so it is safe
to access its memory without stopping all other threads
from other processes. */
- delete_single_step_breakpoints (child_thr);
+ delete_single_step_breakpoints (child_thr);
- gdb_assert (has_single_step_breakpoints (event_thr));
- gdb_assert (!has_single_step_breakpoints (child_thr));
- }
+ gdb_assert (has_single_step_breakpoints (event_thr));
+ gdb_assert (!has_single_step_breakpoints (child_thr));
+ }
- /* Report the event. */
- return 0;
- }
+ /* Report the event. */
+ return 0;
+ }
- threads_debug_printf
- ("Got clone event from LWP %ld, new child is LWP %ld",
- lwpid_of (event_thr), new_pid);
+ threads_debug_printf (
+ "Got clone event from LWP %ld, new child is LWP %ld",
+ lwpid_of (event_thr), new_pid);
ptid = ptid_t (pid_of (event_thr), new_pid);
new_lwp = add_lwp (ptid);
@@ -647,24 +638,24 @@ linux_process_target::handle_extended_wait (lwp_info **orig_event_lwp,
all other threads have been suspended already. Leave the
child suspended too. */
if (stopping_threads == STOPPING_AND_SUSPENDING_THREADS
- || event_lwp->bp_reinsert != 0)
- new_lwp->suspended = 1;
+ || event_lwp->bp_reinsert != 0)
+ new_lwp->suspended = 1;
/* Normally we will get the pending SIGSTOP. But in some cases
we might get another signal delivered to the group first.
If we do get another signal, be sure not to lose it. */
if (WSTOPSIG (status) != SIGSTOP)
- {
- new_lwp->stop_expected = 1;
- new_lwp->status_pending_p = 1;
- new_lwp->status_pending = status;
- }
+ {
+ new_lwp->stop_expected = 1;
+ new_lwp->status_pending_p = 1;
+ new_lwp->status_pending = status;
+ }
else if (cs.report_thread_events)
- {
- new_lwp->waitstatus.set_thread_created ();
- new_lwp->status_pending_p = 1;
- new_lwp->status_pending = status;
- }
+ {
+ new_lwp->waitstatus.set_thread_created ();
+ new_lwp->status_pending_p = 1;
+ new_lwp->status_pending = status;
+ }
#ifdef USE_THREAD_DB
thread_db_notice_clone (event_thr, ptid);
@@ -678,11 +669,11 @@ linux_process_target::handle_extended_wait (lwp_info **orig_event_lwp,
event_lwp->waitstatus.set_vfork_done ();
if (event_lwp->bp_reinsert != 0 && supports_software_single_step ())
- {
- reinsert_single_step_breakpoints (event_thr);
+ {
+ reinsert_single_step_breakpoints (event_thr);
- gdb_assert (has_single_step_breakpoints (event_thr));
- }
+ gdb_assert (has_single_step_breakpoints (event_thr));
+ }
/* Report the event. */
return 0;
@@ -695,7 +686,7 @@ linux_process_target::handle_extended_wait (lwp_info **orig_event_lwp,
pid_t event_pid;
threads_debug_printf ("Got exec event from LWP %ld",
- lwpid_of (event_thr));
+ lwpid_of (event_thr));
/* Get the event ptid. */
event_ptid = ptid_of (event_thr);
@@ -717,9 +708,8 @@ linux_process_target::handle_extended_wait (lwp_info **orig_event_lwp,
arch_setup_thread (event_thr);
/* Set the event status. */
- event_lwp->waitstatus.set_execd
- (make_unique_xstrdup
- (linux_proc_pid_to_exec_file (lwpid_of (event_thr))));
+ event_lwp->waitstatus.set_execd (make_unique_xstrdup (
+ linux_proc_pid_to_exec_file (lwpid_of (event_thr))));
/* Mark the exec status as pending. */
event_lwp->stopped = 1;
@@ -741,7 +731,7 @@ linux_process_target::handle_extended_wait (lwp_info **orig_event_lwp,
return 0;
}
- internal_error (_("unknown ptrace event %d"), event);
+ internal_error (_ ("unknown ptrace event %d"), event);
}
CORE_ADDR
@@ -814,45 +804,46 @@ linux_process_target::save_stop_reason (lwp_info *lwp)
#if USE_SIGTRAP_SIGINFO
if (ptrace (PTRACE_GETSIGINFO, lwpid_of (current_thread),
- (PTRACE_TYPE_ARG3) 0, &siginfo) == 0)
+ (PTRACE_TYPE_ARG3) 0, &siginfo)
+ == 0)
{
if (siginfo.si_signo == SIGTRAP)
- {
- if (GDB_ARCH_IS_TRAP_BRKPT (siginfo.si_code)
- && GDB_ARCH_IS_TRAP_HWBKPT (siginfo.si_code))
- {
- /* The si_code is ambiguous on this arch -- check debug
+ {
+ if (GDB_ARCH_IS_TRAP_BRKPT (siginfo.si_code)
+ && GDB_ARCH_IS_TRAP_HWBKPT (siginfo.si_code))
+ {
+ /* The si_code is ambiguous on this arch -- check debug
registers. */
- if (!check_stopped_by_watchpoint (lwp))
- lwp->stop_reason = TARGET_STOPPED_BY_SW_BREAKPOINT;
- }
- else if (GDB_ARCH_IS_TRAP_BRKPT (siginfo.si_code))
- {
- /* If we determine the LWP stopped for a SW breakpoint,
+ if (!check_stopped_by_watchpoint (lwp))
+ lwp->stop_reason = TARGET_STOPPED_BY_SW_BREAKPOINT;
+ }
+ else if (GDB_ARCH_IS_TRAP_BRKPT (siginfo.si_code))
+ {
+ /* If we determine the LWP stopped for a SW breakpoint,
trust it. Particularly don't check watchpoint
registers, because at least on s390, we'd find
stopped-by-watchpoint as long as there's a watchpoint
set. */
- lwp->stop_reason = TARGET_STOPPED_BY_SW_BREAKPOINT;
- }
- else if (GDB_ARCH_IS_TRAP_HWBKPT (siginfo.si_code))
- {
- /* This can indicate either a hardware breakpoint or
+ lwp->stop_reason = TARGET_STOPPED_BY_SW_BREAKPOINT;
+ }
+ else if (GDB_ARCH_IS_TRAP_HWBKPT (siginfo.si_code))
+ {
+ /* This can indicate either a hardware breakpoint or
hardware watchpoint. Check debug registers. */
- if (!check_stopped_by_watchpoint (lwp))
- lwp->stop_reason = TARGET_STOPPED_BY_HW_BREAKPOINT;
- }
- else if (siginfo.si_code == TRAP_TRACE)
- {
- /* We may have single stepped an instruction that
+ if (!check_stopped_by_watchpoint (lwp))
+ lwp->stop_reason = TARGET_STOPPED_BY_HW_BREAKPOINT;
+ }
+ else if (siginfo.si_code == TRAP_TRACE)
+ {
+ /* We may have single stepped an instruction that
triggered a watchpoint. In that case, on some
architectures (such as x86), instead of TRAP_HWBKPT,
si_code indicates TRAP_TRACE, and we need to check
the debug registers separately. */
- if (!check_stopped_by_watchpoint (lwp))
- lwp->stop_reason = TARGET_STOPPED_BY_SINGLE_STEP;
- }
- }
+ if (!check_stopped_by_watchpoint (lwp))
+ lwp->stop_reason = TARGET_STOPPED_BY_SINGLE_STEP;
+ }
+ }
}
#else
/* We may have just stepped a breakpoint instruction. E.g., in
@@ -872,33 +863,32 @@ linux_process_target::save_stop_reason (lwp_info *lwp)
if (lwp->stop_reason == TARGET_STOPPED_BY_SW_BREAKPOINT)
{
- threads_debug_printf
- ("%s stopped by software breakpoint",
- target_pid_to_str (ptid_of (get_lwp_thread (lwp))).c_str ());
+ threads_debug_printf ("%s stopped by software breakpoint",
+ target_pid_to_str (ptid_of (get_lwp_thread (lwp)))
+ .c_str ());
/* Back up the PC if necessary. */
if (pc != sw_breakpoint_pc)
- {
- struct regcache *regcache
- = get_thread_regcache (current_thread, 1);
- low_set_pc (regcache, sw_breakpoint_pc);
- }
+ {
+ struct regcache *regcache = get_thread_regcache (current_thread, 1);
+ low_set_pc (regcache, sw_breakpoint_pc);
+ }
/* Update this so we record the correct stop PC below. */
pc = sw_breakpoint_pc;
}
else if (lwp->stop_reason == TARGET_STOPPED_BY_HW_BREAKPOINT)
- threads_debug_printf
- ("%s stopped by hardware breakpoint",
- target_pid_to_str (ptid_of (get_lwp_thread (lwp))).c_str ());
+ threads_debug_printf ("%s stopped by hardware breakpoint",
+ target_pid_to_str (ptid_of (get_lwp_thread (lwp)))
+ .c_str ());
else if (lwp->stop_reason == TARGET_STOPPED_BY_WATCHPOINT)
- threads_debug_printf
- ("%s stopped by hardware watchpoint",
- target_pid_to_str (ptid_of (get_lwp_thread (lwp))).c_str ());
+ threads_debug_printf ("%s stopped by hardware watchpoint",
+ target_pid_to_str (ptid_of (get_lwp_thread (lwp)))
+ .c_str ());
else if (lwp->stop_reason == TARGET_STOPPED_BY_SINGLE_STEP)
- threads_debug_printf
- ("%s stopped by trace",
- target_pid_to_str (ptid_of (get_lwp_thread (lwp))).c_str ());
+ threads_debug_printf ("%s stopped by trace",
+ target_pid_to_str (ptid_of (get_lwp_thread (lwp)))
+ .c_str ());
lwp->stop_pc = pc;
return true;
@@ -928,8 +918,8 @@ linux_process_target::low_new_thread (lwp_info *info)
static void
linux_ptrace_fun ()
{
- if (ptrace (PTRACE_TRACEME, 0, (PTRACE_TYPE_ARG3) 0,
- (PTRACE_TYPE_ARG4) 0) < 0)
+ if (ptrace (PTRACE_TRACEME, 0, (PTRACE_TYPE_ARG3) 0, (PTRACE_TYPE_ARG4) 0)
+ < 0)
trace_start_error_with_name ("ptrace");
if (setpgid (0, 0) < 0)
@@ -941,16 +931,17 @@ linux_ptrace_fun ()
if (remote_connection_is_stdio ())
{
if (close (0) < 0)
- trace_start_error_with_name ("close");
+ trace_start_error_with_name ("close");
if (open ("/dev/null", O_RDONLY) < 0)
- trace_start_error_with_name ("open");
+ trace_start_error_with_name ("open");
if (dup2 (2, 1) < 0)
- trace_start_error_with_name ("dup2");
+ trace_start_error_with_name ("dup2");
if (write (2, "stdin/stdout redirected\n",
- sizeof ("stdin/stdout redirected\n") - 1) < 0)
- {
- /* Errors ignored. */;
- }
+ sizeof ("stdin/stdout redirected\n") - 1)
+ < 0)
+ {
+ /* Errors ignored. */;
+ }
}
}
@@ -960,7 +951,7 @@ linux_ptrace_fun ()
int
linux_process_target::create_inferior (const char *program,
- const std::vector<char *> &program_args)
+ const std::vector<char *> &program_args)
{
client_state &cs = get_client_state ();
struct lwp_info *new_lwp;
@@ -968,14 +959,13 @@ linux_process_target::create_inferior (const char *program,
ptid_t ptid;
{
- maybe_disable_address_space_randomization restore_personality
- (cs.disable_randomization);
+ maybe_disable_address_space_randomization restore_personality (
+ cs.disable_randomization);
std::string str_program_args = construct_inferior_arguments (program_args);
- pid = fork_inferior (program,
- str_program_args.c_str (),
- get_environ ()->envp (), linux_ptrace_fun,
- NULL, NULL, NULL, NULL);
+ pid = fork_inferior (program, str_program_args.c_str (),
+ get_environ ()->envp (), linux_ptrace_fun, NULL, NULL,
+ NULL, NULL);
}
/* When spawning a new process, we can't open the mem file yet. We
@@ -1118,18 +1108,17 @@ attach_proc_task_lwp_callback (ptid_t ptid)
is returned if the thread's task still exists, and is marked
as exited or zombie, as well as other conditions, so in that
case, confirm the status in /proc/PID/status. */
- if (err == ESRCH
- || (err == EPERM && linux_proc_pid_is_gone (lwpid)))
- threads_debug_printf
- ("Cannot attach to lwp %d: thread is gone (%d: %s)",
- lwpid, err, safe_strerror (err));
+ if (err == ESRCH || (err == EPERM && linux_proc_pid_is_gone (lwpid)))
+ threads_debug_printf (
+ "Cannot attach to lwp %d: thread is gone (%d: %s)", lwpid, err,
+ safe_strerror (err));
else if (err != 0)
- {
- std::string reason
- = linux_ptrace_attach_fail_reason_string (ptid, err);
+ {
+ std::string reason
+ = linux_ptrace_attach_fail_reason_string (ptid, err);
- warning (_("Cannot attach to lwp %d: %s"), lwpid, reason.c_str ());
- }
+ warning (_ ("Cannot attach to lwp %d: %s"), lwpid, reason.c_str ());
+ }
return 1;
}
@@ -1200,10 +1189,10 @@ linux_process_target::attach (unsigned long pid)
lwp = find_lwp_pid (ptid_t (lwpid));
if (!WIFSTOPPED (wstat) || WSTOPSIG (wstat) != SIGSTOP)
- {
- lwp->status_pending_p = 1;
- lwp->status_pending = wstat;
- }
+ {
+ lwp->status_pending_p = 1;
+ lwp->status_pending = wstat;
+ }
initial_thread->last_resume_kind = resume_continue;
@@ -1220,20 +1209,19 @@ last_thread_of_process_p (int pid)
{
bool seen_one = false;
- thread_info *thread = find_thread (pid, [&] (thread_info *thr_arg)
- {
- if (!seen_one)
- {
- /* This is the first thread of this process we see. */
- seen_one = true;
- return false;
- }
- else
- {
- /* This is the second thread of this process we see. */
- return true;
- }
- });
+ thread_info *thread = find_thread (pid, [&] (thread_info *thr_arg) {
+ if (!seen_one)
+ {
+ /* This is the first thread of this process we see. */
+ seen_one = true;
+ return false;
+ }
+ else
+ {
+ /* This is the second thread of this process we see. */
+ return true;
+ }
+ });
return thread == NULL;
}
@@ -1266,8 +1254,8 @@ linux_kill_one_lwp (struct lwp_info *lwp)
int save_errno = errno;
threads_debug_printf ("kill_lwp (SIGKILL) %s, 0, 0 (%s)",
- target_pid_to_str (ptid_of (thr)).c_str (),
- save_errno ? safe_strerror (save_errno) : "OK");
+ target_pid_to_str (ptid_of (thr)).c_str (),
+ save_errno ? safe_strerror (save_errno) : "OK");
}
errno = 0;
@@ -1277,8 +1265,8 @@ linux_kill_one_lwp (struct lwp_info *lwp)
int save_errno = errno;
threads_debug_printf ("PTRACE_KILL %s, 0, 0 (%s)",
- target_pid_to_str (ptid_of (thr)).c_str (),
- save_errno ? safe_strerror (save_errno) : "OK");
+ target_pid_to_str (ptid_of (thr)).c_str (),
+ save_errno ? safe_strerror (save_errno) : "OK");
}
}
@@ -1315,8 +1303,9 @@ kill_wait_lwp (struct lwp_info *lwp)
*/
res = my_waitpid (lwpid, &wstat, 0);
if (res == -1 && errno == ECHILD)
- res = my_waitpid (lwpid, &wstat, __WCLONE);
- } while (res > 0 && WIFSTOPPED (wstat));
+ res = my_waitpid (lwpid, &wstat, __WCLONE);
+ }
+ while (res > 0 && WIFSTOPPED (wstat));
/* Even if it was stopped, the child may have already disappeared.
E.g., if it was killed by SIGKILL. */
@@ -1340,7 +1329,7 @@ kill_one_lwp_callback (thread_info *thread, int pid)
if (lwpid_of (thread) == pid)
{
threads_debug_printf ("is last of process %s",
- target_pid_to_str (thread->id).c_str ());
+ target_pid_to_str (thread->id).c_str ());
return;
}
@@ -1356,10 +1345,9 @@ linux_process_target::kill (process_info *process)
first, as PTRACE_KILL will not work otherwise. */
stop_all_lwps (0, NULL);
- for_each_thread (pid, [&] (thread_info *thread)
- {
- kill_one_lwp_callback (thread, pid);
- });
+ for_each_thread (pid, [&] (thread_info *thread) {
+ kill_one_lwp_callback (thread, pid);
+ });
/* See the comment in linux_kill_one_lwp. We did not kill the first
thread in the list, so do so now. */
@@ -1398,8 +1386,8 @@ get_detach_signal (struct thread_info *thread)
cleanly, then it'll have stopped with SIGSTOP. But we don't
want to deliver that SIGSTOP. */
if (thread->last_status.kind () != TARGET_WAITKIND_STOPPED
- || thread->last_status.sig () == GDB_SIGNAL_0)
- return 0;
+ || thread->last_status.sig () == GDB_SIGNAL_0)
+ return 0;
/* Otherwise, we may need to deliver the signal we
intercepted. */
@@ -1409,7 +1397,7 @@ get_detach_signal (struct thread_info *thread)
if (!WIFSTOPPED (status))
{
threads_debug_printf ("lwp %s hasn't stopped: no pending signal",
- target_pid_to_str (ptid_of (thread)).c_str ());
+ target_pid_to_str (ptid_of (thread)).c_str ());
return 0;
}
@@ -1417,8 +1405,8 @@ get_detach_signal (struct thread_info *thread)
if (WSTOPSIG (status) == SIGTRAP && linux_is_extended_waitstatus (status))
{
threads_debug_printf ("lwp %s had stopped with extended "
- "status: no pending signal",
- target_pid_to_str (ptid_of (thread)).c_str ());
+ "status: no pending signal",
+ target_pid_to_str (ptid_of (thread)).c_str ());
return 0;
}
@@ -1427,28 +1415,28 @@ get_detach_signal (struct thread_info *thread)
if (cs.program_signals_p && !cs.program_signals[signo])
{
threads_debug_printf ("lwp %s had signal %s, but it is in nopass state",
- target_pid_to_str (ptid_of (thread)).c_str (),
- gdb_signal_to_string (signo));
+ target_pid_to_str (ptid_of (thread)).c_str (),
+ gdb_signal_to_string (signo));
return 0;
}
else if (!cs.program_signals_p
- /* If we have no way to know which signals GDB does not
+ /* If we have no way to know which signals GDB does not
want to have passed to the program, assume
SIGTRAP/SIGINT, which is GDB's default. */
- && (signo == GDB_SIGNAL_TRAP || signo == GDB_SIGNAL_INT))
+ && (signo == GDB_SIGNAL_TRAP || signo == GDB_SIGNAL_INT))
{
threads_debug_printf ("lwp %s had signal %s, "
- "but we don't know if we should pass it. "
- "Default to not.",
- target_pid_to_str (ptid_of (thread)).c_str (),
- gdb_signal_to_string (signo));
+ "but we don't know if we should pass it. "
+ "Default to not.",
+ target_pid_to_str (ptid_of (thread)).c_str (),
+ gdb_signal_to_string (signo));
return 0;
}
else
{
threads_debug_printf ("lwp %s has pending signal %s: delivering it",
- target_pid_to_str (ptid_of (thread)).c_str (),
- gdb_signal_to_string (signo));
+ target_pid_to_str (ptid_of (thread)).c_str (),
+ gdb_signal_to_string (signo));
return WSTOPSIG (status);
}
@@ -1465,7 +1453,7 @@ linux_process_target::detach_one_lwp (lwp_info *lwp)
if (lwp->stop_expected)
{
threads_debug_printf ("Sending SIGCONT to %s",
- target_pid_to_str (ptid_of (thread)).c_str ());
+ target_pid_to_str (ptid_of (thread)).c_str ());
kill_lwp (lwpid_of (thread), SIGCONT);
lwp->stop_expected = 0;
@@ -1488,12 +1476,13 @@ linux_process_target::detach_one_lwp (lwp_info *lwp)
catch (const gdb_exception_error &ex)
{
if (!check_ptrace_stopped_lwp_gone (lwp))
- throw;
+ throw;
}
lwpid = lwpid_of (thread);
if (ptrace (PTRACE_DETACH, lwpid, (PTRACE_TYPE_ARG3) 0,
- (PTRACE_TYPE_ARG4) (long) sig) < 0)
+ (PTRACE_TYPE_ARG4) (long) sig)
+ < 0)
{
int save_errno = errno;
@@ -1502,33 +1491,33 @@ linux_process_target::detach_one_lwp (lwp_info *lwp)
threads exits the whole thread group. In that case we're
still attached, and must reap the lwp. */
if (save_errno == ESRCH)
- {
- int ret, status;
-
- ret = my_waitpid (lwpid, &status, __WALL);
- if (ret == -1)
- {
- warning (_("Couldn't reap LWP %d while detaching: %s"),
- lwpid, safe_strerror (errno));
- }
- else if (!WIFEXITED (status) && !WIFSIGNALED (status))
- {
- warning (_("Reaping LWP %d while detaching "
- "returned unexpected status 0x%x"),
- lwpid, status);
- }
- }
+ {
+ int ret, status;
+
+ ret = my_waitpid (lwpid, &status, __WALL);
+ if (ret == -1)
+ {
+ warning (_ ("Couldn't reap LWP %d while detaching: %s"), lwpid,
+ safe_strerror (errno));
+ }
+ else if (!WIFEXITED (status) && !WIFSIGNALED (status))
+ {
+ warning (_ ("Reaping LWP %d while detaching "
+ "returned unexpected status 0x%x"),
+ lwpid, status);
+ }
+ }
else
- {
- error (_("Can't detach %s: %s"),
- target_pid_to_str (ptid_of (thread)).c_str (),
- safe_strerror (save_errno));
- }
+ {
+ error (_ ("Can't detach %s: %s"),
+ target_pid_to_str (ptid_of (thread)).c_str (),
+ safe_strerror (save_errno));
+ }
}
else
threads_debug_printf ("PTRACE_DETACH (%s, %s, 0) (OK)",
- target_pid_to_str (ptid_of (thread)).c_str (),
- strsignal (sig));
+ target_pid_to_str (ptid_of (thread)).c_str (),
+ strsignal (sig));
delete_lwp (lwp);
}
@@ -1559,17 +1548,16 @@ linux_process_target::detach (process_info *process)
/* Detach from the clone lwps first. If the thread group exits just
while we're detaching, we must reap the clone lwps before we're
able to reap the leader. */
- for_each_thread (process->pid, [this] (thread_info *thread)
- {
- /* We don't actually detach from the thread group leader just yet.
+ for_each_thread (process->pid, [this] (thread_info *thread) {
+ /* We don't actually detach from the thread group leader just yet.
If the thread group exits, we must reap the zombie clone lwps
before we're able to reap the leader. */
- if (thread->id.pid () == thread->id.lwp ())
- return;
+ if (thread->id.pid () == thread->id.lwp ())
+ return;
- lwp_info *lwp = get_thread_lwp (thread);
- detach_one_lwp (lwp);
- });
+ lwp_info *lwp = get_thread_lwp (thread);
+ detach_one_lwp (lwp);
+ });
main_lwp = find_lwp_pid (ptid_t (process->pid));
detach_one_lwp (main_lwp);
@@ -1591,10 +1579,9 @@ linux_process_target::mourn (process_info *process)
thread_db_mourn (process);
#endif
- for_each_thread (process->pid, [this] (thread_info *thread)
- {
- delete_lwp (get_thread_lwp (thread));
- });
+ for_each_thread (process->pid, [this] (thread_info *thread) {
+ delete_lwp (get_thread_lwp (thread));
+ });
this->remove_linux_process (process);
}
@@ -1604,11 +1591,13 @@ linux_process_target::join (int pid)
{
int status, ret;
- do {
- ret = my_waitpid (pid, &status, 0);
- if (WIFEXITED (status) || WIFSIGNALED (status))
- break;
- } while (ret != -1 || errno != ECHILD);
+ do
+ {
+ ret = my_waitpid (pid, &status, 0);
+ if (WIFEXITED (status) || WIFSIGNALED (status))
+ break;
+ }
+ while (ret != -1 || errno != ECHILD);
}
/* Return true if the given thread is still alive. */
@@ -1637,7 +1626,7 @@ linux_process_target::thread_still_has_status_pending (thread_info *thread)
if (thread->last_resume_kind != resume_stop
&& (lp->stop_reason == TARGET_STOPPED_BY_SW_BREAKPOINT
- || lp->stop_reason == TARGET_STOPPED_BY_HW_BREAKPOINT))
+ || lp->stop_reason == TARGET_STOPPED_BY_HW_BREAKPOINT))
{
CORE_ADDR pc;
int discard = 0;
@@ -1650,35 +1639,34 @@ linux_process_target::thread_still_has_status_pending (thread_info *thread)
switch_to_thread (thread);
if (pc != lp->stop_pc)
- {
- threads_debug_printf ("PC of %ld changed",
- lwpid_of (thread));
- discard = 1;
- }
+ {
+ threads_debug_printf ("PC of %ld changed", lwpid_of (thread));
+ discard = 1;
+ }
#if !USE_SIGTRAP_SIGINFO
else if (lp->stop_reason == TARGET_STOPPED_BY_SW_BREAKPOINT
- && !low_breakpoint_at (pc))
- {
- threads_debug_printf ("previous SW breakpoint of %ld gone",
- lwpid_of (thread));
- discard = 1;
- }
+ && !low_breakpoint_at (pc))
+ {
+ threads_debug_printf ("previous SW breakpoint of %ld gone",
+ lwpid_of (thread));
+ discard = 1;
+ }
else if (lp->stop_reason == TARGET_STOPPED_BY_HW_BREAKPOINT
- && !hardware_breakpoint_inserted_here (pc))
- {
- threads_debug_printf ("previous HW breakpoint of %ld gone",
- lwpid_of (thread));
- discard = 1;
- }
+ && !hardware_breakpoint_inserted_here (pc))
+ {
+ threads_debug_printf ("previous HW breakpoint of %ld gone",
+ lwpid_of (thread));
+ discard = 1;
+ }
#endif
if (discard)
- {
- threads_debug_printf ("discarding pending breakpoint status");
- lp->status_pending_p = 0;
- return 0;
- }
+ {
+ threads_debug_printf ("discarding pending breakpoint status");
+ lp->status_pending_p = 0;
+ return 0;
+ }
}
return 1;
@@ -1706,7 +1694,7 @@ lwp_resumed (struct lwp_info *lwp)
bool
linux_process_target::status_pending_p_callback (thread_info *thread,
- ptid_t ptid)
+ ptid_t ptid)
{
struct lwp_info *lp = get_thread_lwp (thread);
@@ -1718,8 +1706,7 @@ linux_process_target::status_pending_p_callback (thread_info *thread,
if (!lwp_resumed (lp))
return 0;
- if (lp->status_pending_p
- && !thread_still_has_status_pending (thread))
+ if (lp->status_pending_p && !thread_still_has_status_pending (thread))
{
resume_one_lwp (lp, lp->stepping, GDB_SIGNAL_0, NULL);
return 0;
@@ -1732,10 +1719,8 @@ struct lwp_info *
find_lwp_pid (ptid_t ptid)
{
long lwp = ptid.lwp () != 0 ? ptid.lwp () : ptid.pid ();
- thread_info *thread = find_thread ([lwp] (thread_info *thr_arg)
- {
- return thr_arg->id.lwp () == lwp;
- });
+ thread_info *thread = find_thread (
+ [lwp] (thread_info *thr_arg) { return thr_arg->id.lwp () == lwp; });
if (thread == NULL)
return NULL;
@@ -1750,10 +1735,7 @@ num_lwps (int pid)
{
int count = 0;
- for_each_thread (pid, [&] (thread_info *thread)
- {
- count++;
- });
+ for_each_thread (pid, [&] (thread_info *thread) { count++; });
return count;
}
@@ -1762,14 +1744,13 @@ num_lwps (int pid)
struct lwp_info *
iterate_over_lwps (ptid_t filter,
- gdb::function_view<iterate_over_lwps_ftype> callback)
+ gdb::function_view<iterate_over_lwps_ftype> callback)
{
- thread_info *thread = find_thread (filter, [&] (thread_info *thr_arg)
- {
- lwp_info *lwp = get_thread_lwp (thr_arg);
+ thread_info *thread = find_thread (filter, [&] (thread_info *thr_arg) {
+ lwp_info *lwp = get_thread_lwp (thr_arg);
- return callback (lwp);
- });
+ return callback (lwp);
+ });
if (thread == NULL)
return NULL;
@@ -1780,27 +1761,27 @@ iterate_over_lwps (ptid_t filter,
void
linux_process_target::check_zombie_leaders ()
{
- for_each_process ([this] (process_info *proc)
- {
- pid_t leader_pid = pid_of (proc);
- lwp_info *leader_lp = find_lwp_pid (ptid_t (leader_pid));
+ for_each_process ([this] (process_info *proc) {
+ pid_t leader_pid = pid_of (proc);
+ lwp_info *leader_lp = find_lwp_pid (ptid_t (leader_pid));
- threads_debug_printf ("leader_pid=%d, leader_lp!=NULL=%d, "
- "num_lwps=%d, zombie=%d",
- leader_pid, leader_lp!= NULL, num_lwps (leader_pid),
- linux_proc_pid_is_zombie (leader_pid));
+ threads_debug_printf ("leader_pid=%d, leader_lp!=NULL=%d, "
+ "num_lwps=%d, zombie=%d",
+ leader_pid, leader_lp != NULL, num_lwps (leader_pid),
+ linux_proc_pid_is_zombie (leader_pid));
- if (leader_lp != NULL && !leader_lp->stopped
- /* Check if there are other threads in the group, as we may
+ if (leader_lp != NULL
+ && !leader_lp->stopped
+ /* Check if there are other threads in the group, as we may
have raced with the inferior simply exiting. Note this
isn't a watertight check. If the inferior is
multi-threaded and is exiting, it may be we see the
leader as zombie before we reap all the non-leader
threads. See comments below. */
- && !last_thread_of_process_p (leader_pid)
- && linux_proc_pid_is_zombie (leader_pid))
- {
- /* A zombie leader in a multi-threaded program can mean one
+ && !last_thread_of_process_p (leader_pid)
+ && linux_proc_pid_is_zombie (leader_pid))
+ {
+ /* A zombie leader in a multi-threaded program can mean one
of three things:
#1 - Only the leader exited, not the whole program, e.g.,
@@ -1845,13 +1826,13 @@ linux_process_target::check_zombie_leaders ()
exit when we see the leader exiting, as opposed to when
the last LWP in the LWP list exits, which can be a
non-leader if we deleted the leader here. */
- threads_debug_printf ("Thread group leader %d zombie "
- "(it exited, or another thread execd), "
- "deleting it.",
- leader_pid);
- delete_lwp (leader_lp);
- }
- });
+ threads_debug_printf ("Thread group leader %d zombie "
+ "(it exited, or another thread execd), "
+ "deleting it.",
+ leader_pid);
+ delete_lwp (leader_lp);
+ }
+ });
}
/* Callback for `find_thread'. Returns the first LWP that is not
@@ -1876,9 +1857,9 @@ lwp_suspended_inc (struct lwp_info *lwp)
lwp->suspended++;
if (lwp->suspended > 4)
- threads_debug_printf
- ("LWP %ld has a suspiciously high suspend count, suspended=%d",
- lwpid_of (get_lwp_thread (lwp)), lwp->suspended);
+ threads_debug_printf (
+ "LWP %ld has a suspiciously high suspend count, suspended=%d",
+ lwpid_of (get_lwp_thread (lwp)), lwp->suspended);
}
/* Decrement LWP's suspend count. */
@@ -1893,7 +1874,7 @@ lwp_suspended_decr (struct lwp_info *lwp)
struct thread_info *thread = get_lwp_thread (lwp);
internal_error ("unsuspend LWP %ld, suspended=%d\n", lwpid_of (thread),
- lwp->suspended);
+ lwp->suspended);
}
}
@@ -1934,8 +1915,8 @@ handle_tracepoints (struct lwp_info *lwp)
gdb_assert (lwp->suspended == 0);
gdb_assert (!stabilizing_threads
- || (lwp->collecting_fast_tracepoint
- != fast_tpoint_collect_result::not_collecting));
+ || (lwp->collecting_fast_tracepoint
+ != fast_tpoint_collect_result::not_collecting));
if (tpoint_related_event)
{
@@ -1947,8 +1928,8 @@ handle_tracepoints (struct lwp_info *lwp)
}
fast_tpoint_collect_result
-linux_process_target::linux_fast_tracepoint_collecting
- (lwp_info *lwp, fast_tpoint_collect_status *status)
+linux_process_target::linux_fast_tracepoint_collecting (
+ lwp_info *lwp, fast_tpoint_collect_status *status)
{
CORE_ADDR thread_area;
struct thread_info *thread = get_lwp_thread (lwp);
@@ -1975,113 +1956,110 @@ linux_process_target::maybe_move_out_of_jump_pad (lwp_info *lwp, int *wstat)
scoped_restore_current_thread restore_thread;
switch_to_thread (get_lwp_thread (lwp));
- if ((wstat == NULL
- || (WIFSTOPPED (*wstat) && WSTOPSIG (*wstat) != SIGTRAP))
- && supports_fast_tracepoints ()
- && agent_loaded_p ())
+ if ((wstat == NULL || (WIFSTOPPED (*wstat) && WSTOPSIG (*wstat) != SIGTRAP))
+ && supports_fast_tracepoints () && agent_loaded_p ())
{
struct fast_tpoint_collect_status status;
- threads_debug_printf
- ("Checking whether LWP %ld needs to move out of the jump pad.",
- lwpid_of (current_thread));
+ threads_debug_printf (
+ "Checking whether LWP %ld needs to move out of the jump pad.",
+ lwpid_of (current_thread));
fast_tpoint_collect_result r
- = linux_fast_tracepoint_collecting (lwp, &status);
+ = linux_fast_tracepoint_collecting (lwp, &status);
if (wstat == NULL
- || (WSTOPSIG (*wstat) != SIGILL
- && WSTOPSIG (*wstat) != SIGFPE
- && WSTOPSIG (*wstat) != SIGSEGV
- && WSTOPSIG (*wstat) != SIGBUS))
- {
- lwp->collecting_fast_tracepoint = r;
-
- if (r != fast_tpoint_collect_result::not_collecting)
- {
- if (r == fast_tpoint_collect_result::before_insn
- && lwp->exit_jump_pad_bkpt == NULL)
- {
- /* Haven't executed the original instruction yet.
+ || (WSTOPSIG (*wstat) != SIGILL && WSTOPSIG (*wstat) != SIGFPE
+ && WSTOPSIG (*wstat) != SIGSEGV && WSTOPSIG (*wstat) != SIGBUS))
+ {
+ lwp->collecting_fast_tracepoint = r;
+
+ if (r != fast_tpoint_collect_result::not_collecting)
+ {
+ if (r == fast_tpoint_collect_result::before_insn
+ && lwp->exit_jump_pad_bkpt == NULL)
+ {
+ /* Haven't executed the original instruction yet.
Set breakpoint there, and wait till it's hit,
then single-step until exiting the jump pad. */
- lwp->exit_jump_pad_bkpt
- = set_breakpoint_at (status.adjusted_insn_addr, NULL);
- }
-
- threads_debug_printf
- ("Checking whether LWP %ld needs to move out of the jump pad..."
- " it does", lwpid_of (current_thread));
-
- return true;
- }
- }
+ lwp->exit_jump_pad_bkpt
+ = set_breakpoint_at (status.adjusted_insn_addr, NULL);
+ }
+
+ threads_debug_printf (
+ "Checking whether LWP %ld needs to move out of the jump pad..."
+ " it does",
+ lwpid_of (current_thread));
+
+ return true;
+ }
+ }
else
- {
- /* If we get a synchronous signal while collecting, *and*
+ {
+ /* If we get a synchronous signal while collecting, *and*
while executing the (relocated) original instruction,
reset the PC to point at the tpoint address, before
reporting to GDB. Otherwise, it's an IPA lib bug: just
report the signal to GDB, and pray for the best. */
- lwp->collecting_fast_tracepoint
- = fast_tpoint_collect_result::not_collecting;
+ lwp->collecting_fast_tracepoint
+ = fast_tpoint_collect_result::not_collecting;
- if (r != fast_tpoint_collect_result::not_collecting
- && (status.adjusted_insn_addr <= lwp->stop_pc
- && lwp->stop_pc < status.adjusted_insn_addr_end))
- {
- siginfo_t info;
- struct regcache *regcache;
+ if (r != fast_tpoint_collect_result::not_collecting
+ && (status.adjusted_insn_addr <= lwp->stop_pc
+ && lwp->stop_pc < status.adjusted_insn_addr_end))
+ {
+ siginfo_t info;
+ struct regcache *regcache;
- /* The si_addr on a few signals references the address
+ /* The si_addr on a few signals references the address
of the faulting instruction. Adjust that as
well. */
- if ((WSTOPSIG (*wstat) == SIGILL
- || WSTOPSIG (*wstat) == SIGFPE
- || WSTOPSIG (*wstat) == SIGBUS
- || WSTOPSIG (*wstat) == SIGSEGV)
- && ptrace (PTRACE_GETSIGINFO, lwpid_of (current_thread),
- (PTRACE_TYPE_ARG3) 0, &info) == 0
- /* Final check just to make sure we don't clobber
+ if ((WSTOPSIG (*wstat) == SIGILL || WSTOPSIG (*wstat) == SIGFPE
+ || WSTOPSIG (*wstat) == SIGBUS
+ || WSTOPSIG (*wstat) == SIGSEGV)
+ && ptrace (PTRACE_GETSIGINFO, lwpid_of (current_thread),
+ (PTRACE_TYPE_ARG3) 0, &info)
+ == 0
+ /* Final check just to make sure we don't clobber
the siginfo of non-kernel-sent signals. */
- && (uintptr_t) info.si_addr == lwp->stop_pc)
- {
- info.si_addr = (void *) (uintptr_t) status.tpoint_addr;
- ptrace (PTRACE_SETSIGINFO, lwpid_of (current_thread),
- (PTRACE_TYPE_ARG3) 0, &info);
- }
-
- regcache = get_thread_regcache (current_thread, 1);
- low_set_pc (regcache, status.tpoint_addr);
- lwp->stop_pc = status.tpoint_addr;
-
- /* Cancel any fast tracepoint lock this thread was
+ && (uintptr_t) info.si_addr == lwp->stop_pc)
+ {
+ info.si_addr = (void *) (uintptr_t) status.tpoint_addr;
+ ptrace (PTRACE_SETSIGINFO, lwpid_of (current_thread),
+ (PTRACE_TYPE_ARG3) 0, &info);
+ }
+
+ regcache = get_thread_regcache (current_thread, 1);
+ low_set_pc (regcache, status.tpoint_addr);
+ lwp->stop_pc = status.tpoint_addr;
+
+ /* Cancel any fast tracepoint lock this thread was
holding. */
- force_unlock_trace_buffer ();
- }
+ force_unlock_trace_buffer ();
+ }
- if (lwp->exit_jump_pad_bkpt != NULL)
- {
- threads_debug_printf
- ("Cancelling fast exit-jump-pad: removing bkpt."
- "stopping all threads momentarily.");
+ if (lwp->exit_jump_pad_bkpt != NULL)
+ {
+ threads_debug_printf (
+ "Cancelling fast exit-jump-pad: removing bkpt."
+ "stopping all threads momentarily.");
- stop_all_lwps (1, lwp);
+ stop_all_lwps (1, lwp);
- delete_breakpoint (lwp->exit_jump_pad_bkpt);
- lwp->exit_jump_pad_bkpt = NULL;
+ delete_breakpoint (lwp->exit_jump_pad_bkpt);
+ lwp->exit_jump_pad_bkpt = NULL;
- unstop_all_lwps (1, lwp);
+ unstop_all_lwps (1, lwp);
- gdb_assert (lwp->suspended >= 0);
- }
- }
+ gdb_assert (lwp->suspended >= 0);
+ }
+ }
}
- threads_debug_printf
- ("Checking whether LWP %ld needs to move out of the jump pad... no",
- lwpid_of (current_thread));
+ threads_debug_printf (
+ "Checking whether LWP %ld needs to move out of the jump pad... no",
+ lwpid_of (current_thread));
return false;
}
@@ -2094,13 +2072,13 @@ enqueue_one_deferred_signal (struct lwp_info *lwp, int *wstat)
{
struct thread_info *thread = get_lwp_thread (lwp);
- threads_debug_printf ("Deferring signal %d for LWP %ld.",
- WSTOPSIG (*wstat), lwpid_of (thread));
+ threads_debug_printf ("Deferring signal %d for LWP %ld.", WSTOPSIG (*wstat),
+ lwpid_of (thread));
if (debug_threads)
{
for (const auto &sig : lwp->pending_signals_to_report)
- threads_debug_printf (" Already queued %d", sig.signal);
+ threads_debug_printf (" Already queued %d", sig.signal);
threads_debug_printf (" (no more currently queued signals)");
}
@@ -2111,21 +2089,21 @@ enqueue_one_deferred_signal (struct lwp_info *lwp, int *wstat)
if (WSTOPSIG (*wstat) < __SIGRTMIN)
{
for (const auto &sig : lwp->pending_signals_to_report)
- {
- if (sig.signal == WSTOPSIG (*wstat))
- {
- threads_debug_printf
- ("Not requeuing already queued non-RT signal %d for LWP %ld",
- sig.signal, lwpid_of (thread));
- return;
- }
- }
+ {
+ if (sig.signal == WSTOPSIG (*wstat))
+ {
+ threads_debug_printf (
+ "Not requeuing already queued non-RT signal %d for LWP %ld",
+ sig.signal, lwpid_of (thread));
+ return;
+ }
+ }
}
lwp->pending_signals_to_report.emplace_back (WSTOPSIG (*wstat));
ptrace (PTRACE_GETSIGINFO, lwpid_of (thread), (PTRACE_TYPE_ARG3) 0,
- &lwp->pending_signals_to_report.back ().info);
+ &lwp->pending_signals_to_report.back ().info);
}
/* Dequeue one signal from the "signals to report later when out of
@@ -2142,21 +2120,21 @@ dequeue_one_deferred_signal (struct lwp_info *lwp, int *wstat)
*wstat = W_STOPCODE (p_sig.signal);
if (p_sig.info.si_signo != 0)
- ptrace (PTRACE_SETSIGINFO, lwpid_of (thread), (PTRACE_TYPE_ARG3) 0,
- &p_sig.info);
+ ptrace (PTRACE_SETSIGINFO, lwpid_of (thread), (PTRACE_TYPE_ARG3) 0,
+ &p_sig.info);
lwp->pending_signals_to_report.pop_front ();
threads_debug_printf ("Reporting deferred signal %d for LWP %ld.",
- WSTOPSIG (*wstat), lwpid_of (thread));
+ WSTOPSIG (*wstat), lwpid_of (thread));
if (debug_threads)
- {
- for (const auto &sig : lwp->pending_signals_to_report)
- threads_debug_printf (" Still queued %d", sig.signal);
+ {
+ for (const auto &sig : lwp->pending_signals_to_report)
+ threads_debug_printf (" Still queued %d", sig.signal);
- threads_debug_printf (" (no more queued signals)");
- }
+ threads_debug_printf (" (no more queued signals)");
+ }
return 1;
}
@@ -2230,60 +2208,57 @@ linux_process_target::filter_event (int lwpid, int wstat)
if (child == nullptr)
{
if (WIFSTOPPED (wstat))
- {
- if (WSTOPSIG (wstat) == SIGTRAP
- && linux_ptrace_get_extended_event (wstat) == PTRACE_EVENT_EXEC)
- {
- /* A non-leader thread exec'ed after we've seen the
+ {
+ if (WSTOPSIG (wstat) == SIGTRAP
+ && linux_ptrace_get_extended_event (wstat) == PTRACE_EVENT_EXEC)
+ {
+ /* A non-leader thread exec'ed after we've seen the
leader zombie, and removed it from our lists (in
check_zombie_leaders). The non-leader thread changes
its tid to the tgid. */
- threads_debug_printf
- ("Re-adding thread group leader LWP %d after exec.",
- lwpid);
-
- child = add_lwp (ptid_t (lwpid, lwpid));
- child->stopped = 1;
- switch_to_thread (child->thread);
- }
- else
- {
- /* A process we are controlling has forked and the new
+ threads_debug_printf (
+ "Re-adding thread group leader LWP %d after exec.", lwpid);
+
+ child = add_lwp (ptid_t (lwpid, lwpid));
+ child->stopped = 1;
+ switch_to_thread (child->thread);
+ }
+ else
+ {
+ /* A process we are controlling has forked and the new
child's stop was reported to us by the kernel. Save
its PID and go back to waiting for the fork event to
be reported - the stopped process might be returned
from waitpid before or after the fork event is. */
- threads_debug_printf
- ("Saving LWP %d status %s in stopped_pids list",
- lwpid, status_to_str (wstat).c_str ());
- add_to_pid_list (&stopped_pids, lwpid, wstat);
- }
- }
+ threads_debug_printf (
+ "Saving LWP %d status %s in stopped_pids list", lwpid,
+ status_to_str (wstat).c_str ());
+ add_to_pid_list (&stopped_pids, lwpid, wstat);
+ }
+ }
else
- {
- /* Don't report an event for the exit of an LWP not in our
+ {
+ /* Don't report an event for the exit of an LWP not in our
list, i.e. not part of any inferior we're debugging.
This can happen if we detach from a program we originally
forked and then it exits. However, note that we may have
earlier deleted a leader of an inferior we're debugging,
in check_zombie_leaders. Re-add it back here if so. */
- find_process ([&] (process_info *proc)
- {
- if (proc->pid == lwpid)
- {
- threads_debug_printf
- ("Re-adding thread group leader LWP %d after exit.",
- lwpid);
-
- child = add_lwp (ptid_t (lwpid, lwpid));
- return true;
- }
- return false;
- });
- }
+ find_process ([&] (process_info *proc) {
+ if (proc->pid == lwpid)
+ {
+ threads_debug_printf (
+ "Re-adding thread group leader LWP %d after exit.", lwpid);
+
+ child = add_lwp (ptid_t (lwpid, lwpid));
+ return true;
+ }
+ return false;
+ });
+ }
if (child == nullptr)
- return;
+ return;
}
thread = get_lwp_thread (child);
@@ -2298,27 +2273,27 @@ linux_process_target::filter_event (int lwpid, int wstat)
threads_debug_printf ("%d exited", lwpid);
if (finish_step_over (child))
- {
- /* Unsuspend all other LWPs, and set them back running again. */
- unsuspend_all_lwps (child);
- }
+ {
+ /* Unsuspend all other LWPs, and set them back running again. */
+ unsuspend_all_lwps (child);
+ }
/* If this is not the leader LWP, then the exit signal was not
the end of the debugged application and should be ignored,
unless GDB wants to hear about thread exits. */
if (cs.report_thread_events || is_leader (thread))
- {
- /* Since events are serialized to GDB core, and we can't
+ {
+ /* Since events are serialized to GDB core, and we can't
report this one right now. Leave the status pending for
the next time we're able to report it. */
- mark_lwp_dead (child, wstat);
- return;
- }
+ mark_lwp_dead (child, wstat);
+ return;
+ }
else
- {
- delete_lwp (child);
- return;
- }
+ {
+ delete_lwp (child);
+ return;
+ }
}
gdb_assert (WIFSTOPPED (wstat));
@@ -2330,24 +2305,24 @@ linux_process_target::filter_event (int lwpid, int wstat)
/* Architecture-specific setup after inferior is running. */
proc = find_process_pid (pid_of (thread));
if (proc->tdesc == NULL)
- {
- if (proc->attached)
- {
- /* This needs to happen after we have attached to the
+ {
+ if (proc->attached)
+ {
+ /* This needs to happen after we have attached to the
inferior and it is stopped for the first time, but
before we access any inferior registers. */
- arch_setup_thread (thread);
- }
- else
- {
- /* The process is started, but GDBserver will do
+ arch_setup_thread (thread);
+ }
+ else
+ {
+ /* The process is started, but GDBserver will do
architecture-specific setup after the program stops at
the first instruction. */
- child->status_pending_p = 1;
- child->status_pending = wstat;
- return;
- }
- }
+ child->status_pending_p = 1;
+ child->status_pending = wstat;
+ return;
+ }
+ }
}
if (WIFSTOPPED (wstat) && child->must_set_ptrace_flags)
@@ -2363,9 +2338,9 @@ linux_process_target::filter_event (int lwpid, int wstat)
if (WIFSTOPPED (wstat) && WSTOPSIG (wstat) == SYSCALL_SIGTRAP)
{
child->syscall_state
- = (child->syscall_state == TARGET_WAITKIND_SYSCALL_ENTRY
- ? TARGET_WAITKIND_SYSCALL_RETURN
- : TARGET_WAITKIND_SYSCALL_ENTRY);
+ = (child->syscall_state == TARGET_WAITKIND_SYSCALL_ENTRY
+ ? TARGET_WAITKIND_SYSCALL_RETURN
+ : TARGET_WAITKIND_SYSCALL_ENTRY);
}
else
{
@@ -2381,17 +2356,17 @@ linux_process_target::filter_event (int lwpid, int wstat)
{
child->stop_pc = get_pc (child);
if (handle_extended_wait (&child, wstat))
- {
- /* The event has been handled, so just return without
+ {
+ /* The event has been handled, so just return without
reporting it. */
- return;
- }
+ return;
+ }
}
if (linux_wstatus_maybe_breakpoint (wstat))
{
if (save_stop_reason (child))
- have_stop_pc = 1;
+ have_stop_pc = 1;
}
if (!have_stop_pc)
@@ -2405,30 +2380,31 @@ linux_process_target::filter_event (int lwpid, int wstat)
child->stop_expected = 0;
if (thread->last_resume_kind == resume_stop)
- {
- /* We want to report the stop to the core. Treat the
+ {
+ /* We want to report the stop to the core. Treat the
SIGSTOP as a normal event. */
- threads_debug_printf ("resume_stop SIGSTOP caught for %s.",
- target_pid_to_str (ptid_of (thread)).c_str ());
- }
+ threads_debug_printf ("resume_stop SIGSTOP caught for %s.",
+ target_pid_to_str (ptid_of (thread)).c_str ());
+ }
else if (stopping_threads != NOT_STOPPING_THREADS)
- {
- /* Stopping threads. We don't want this SIGSTOP to end up
+ {
+ /* Stopping threads. We don't want this SIGSTOP to end up
pending. */
- threads_debug_printf ("SIGSTOP caught for %s while stopping threads.",
- target_pid_to_str (ptid_of (thread)).c_str ());
- return;
- }
+ threads_debug_printf (
+ "SIGSTOP caught for %s while stopping threads.",
+ target_pid_to_str (ptid_of (thread)).c_str ());
+ return;
+ }
else
- {
- /* This is a delayed SIGSTOP. Filter out the event. */
- threads_debug_printf ("%s %s, 0, 0 (discard delayed SIGSTOP)",
- child->stepping ? "step" : "continue",
- target_pid_to_str (ptid_of (thread)).c_str ());
+ {
+ /* This is a delayed SIGSTOP. Filter out the event. */
+ threads_debug_printf ("%s %s, 0, 0 (discard delayed SIGSTOP)",
+ child->stepping ? "step" : "continue",
+ target_pid_to_str (ptid_of (thread)).c_str ());
- resume_one_lwp (child, child->stepping, 0, NULL);
- return;
- }
+ resume_one_lwp (child, child->stepping, 0, NULL);
+ return;
+ }
}
child->status_pending_p = 1;
@@ -2455,19 +2431,17 @@ linux_process_target::resume_stopped_resumed_lwps (thread_info *thread)
{
struct lwp_info *lp = get_thread_lwp (thread);
- if (lp->stopped
- && !lp->suspended
- && !lp->status_pending_p
+ if (lp->stopped && !lp->suspended && !lp->status_pending_p
&& thread->last_status.kind () == TARGET_WAITKIND_IGNORE)
{
int step = 0;
if (thread->last_resume_kind == resume_step)
- step = maybe_hw_step (thread);
+ step = maybe_hw_step (thread);
threads_debug_printf ("resuming stopped-resumed LWP %s at %s: step=%d",
- target_pid_to_str (ptid_of (thread)).c_str (),
- paddress (lp->stop_pc), step);
+ target_pid_to_str (ptid_of (thread)).c_str (),
+ paddress (lp->stop_pc), step);
resume_one_lwp (lp, step, GDB_SIGNAL_0, NULL);
}
@@ -2475,14 +2449,14 @@ linux_process_target::resume_stopped_resumed_lwps (thread_info *thread)
int
linux_process_target::wait_for_event_filtered (ptid_t wait_ptid,
- ptid_t filter_ptid,
- int *wstatp, int options)
+ ptid_t filter_ptid, int *wstatp,
+ int options)
{
struct thread_info *event_thread;
struct lwp_info *event_child, *requested_child;
sigset_t block_mask, prev_mask;
- retry:
+retry:
/* N.B. event_thread points to the thread_info struct that contains
event_child. Keep them in sync. */
event_thread = NULL;
@@ -2493,52 +2467,51 @@ linux_process_target::wait_for_event_filtered (ptid_t wait_ptid,
if (filter_ptid == minus_one_ptid || filter_ptid.is_pid ())
{
- event_thread = find_thread_in_random ([&] (thread_info *thread)
- {
- return status_pending_p_callback (thread, filter_ptid);
- });
+ event_thread = find_thread_in_random ([&] (thread_info *thread) {
+ return status_pending_p_callback (thread, filter_ptid);
+ });
if (event_thread != NULL)
- {
- event_child = get_thread_lwp (event_thread);
- threads_debug_printf ("Got a pending child %ld", lwpid_of (event_thread));
- }
+ {
+ event_child = get_thread_lwp (event_thread);
+ threads_debug_printf ("Got a pending child %ld",
+ lwpid_of (event_thread));
+ }
}
else if (filter_ptid != null_ptid)
{
requested_child = find_lwp_pid (filter_ptid);
if (stopping_threads == NOT_STOPPING_THREADS
- && requested_child->status_pending_p
- && (requested_child->collecting_fast_tracepoint
- != fast_tpoint_collect_result::not_collecting))
- {
- enqueue_one_deferred_signal (requested_child,
- &requested_child->status_pending);
- requested_child->status_pending_p = 0;
- requested_child->status_pending = 0;
- resume_one_lwp (requested_child, 0, 0, NULL);
- }
-
- if (requested_child->suspended
- && requested_child->status_pending_p)
- {
- internal_error ("requesting an event out of a"
- " suspended child?");
- }
+ && requested_child->status_pending_p
+ && (requested_child->collecting_fast_tracepoint
+ != fast_tpoint_collect_result::not_collecting))
+ {
+ enqueue_one_deferred_signal (requested_child,
+ &requested_child->status_pending);
+ requested_child->status_pending_p = 0;
+ requested_child->status_pending = 0;
+ resume_one_lwp (requested_child, 0, 0, NULL);
+ }
+
+ if (requested_child->suspended && requested_child->status_pending_p)
+ {
+ internal_error ("requesting an event out of a"
+ " suspended child?");
+ }
if (requested_child->status_pending_p)
- {
- event_child = requested_child;
- event_thread = get_lwp_thread (event_child);
- }
+ {
+ event_child = requested_child;
+ event_thread = get_lwp_thread (event_child);
+ }
}
if (event_child != NULL)
{
threads_debug_printf ("Got an event from pending child %ld (%04x)",
- lwpid_of (event_thread),
- event_child->status_pending);
+ lwpid_of (event_thread),
+ event_child->status_pending);
*wstatp = event_child->status_pending;
event_child->status_pending_p = 0;
@@ -2581,55 +2554,52 @@ linux_process_target::wait_for_event_filtered (ptid_t wait_ptid,
errno = 0;
ret = my_waitpid (-1, wstatp, options | WNOHANG);
- threads_debug_printf ("waitpid(-1, ...) returned %d, %s",
- ret, errno ? safe_strerror (errno) : "ERRNO-OK");
+ threads_debug_printf ("waitpid(-1, ...) returned %d, %s", ret,
+ errno ? safe_strerror (errno) : "ERRNO-OK");
if (ret > 0)
- {
- threads_debug_printf ("waitpid %ld received %s",
- (long) ret, status_to_str (*wstatp).c_str ());
+ {
+ threads_debug_printf ("waitpid %ld received %s", (long) ret,
+ status_to_str (*wstatp).c_str ());
- /* Filter all events. IOW, leave all events pending. We'll
+ /* Filter all events. IOW, leave all events pending. We'll
randomly select an event LWP out of all that have events
below. */
- filter_event (ret, *wstatp);
- /* Retry until nothing comes out of waitpid. A single
+ filter_event (ret, *wstatp);
+ /* Retry until nothing comes out of waitpid. A single
SIGCHLD can indicate more than one child stopped. */
- continue;
- }
+ continue;
+ }
/* Now that we've pulled all events out of the kernel, resume
LWPs that don't have an interesting event to report. */
if (stopping_threads == NOT_STOPPING_THREADS)
- for_each_thread ([this] (thread_info *thread)
- {
- resume_stopped_resumed_lwps (thread);
- });
+ for_each_thread ([this] (thread_info *thread) {
+ resume_stopped_resumed_lwps (thread);
+ });
/* ... and find an LWP with a status to report to the core, if
any. */
- event_thread = find_thread_in_random ([&] (thread_info *thread)
- {
- return status_pending_p_callback (thread, filter_ptid);
- });
+ event_thread = find_thread_in_random ([&] (thread_info *thread) {
+ return status_pending_p_callback (thread, filter_ptid);
+ });
if (event_thread != NULL)
- {
- event_child = get_thread_lwp (event_thread);
- *wstatp = event_child->status_pending;
- event_child->status_pending_p = 0;
- event_child->status_pending = 0;
- break;
- }
+ {
+ event_child = get_thread_lwp (event_thread);
+ *wstatp = event_child->status_pending;
+ event_child->status_pending_p = 0;
+ event_child->status_pending = 0;
+ break;
+ }
/* Check for zombie thread group leaders. Those can't be reaped
until all other threads in the thread group are. */
check_zombie_leaders ();
- auto not_stopped = [&] (thread_info *thread)
- {
- return not_stopped_callback (thread, wait_ptid);
- };
+ auto not_stopped = [&] (thread_info *thread) {
+ return not_stopped_callback (thread, wait_ptid);
+ };
/* If there are no resumed children left in the set of LWPs we
want to wait for, bail. We can't just block in
@@ -2639,21 +2609,21 @@ linux_process_target::wait_for_event_filtered (ptid_t wait_ptid,
them). Even if WNOHANG is set, this return code is preferred
over 0 (below), as it is more detailed. */
if (find_thread (not_stopped) == NULL)
- {
- threads_debug_printf ("exit (no unwaited-for LWP)");
+ {
+ threads_debug_printf ("exit (no unwaited-for LWP)");
- gdb_sigmask (SIG_SETMASK, &prev_mask, NULL);
- return -1;
- }
+ gdb_sigmask (SIG_SETMASK, &prev_mask, NULL);
+ return -1;
+ }
/* No interesting event to report to the caller. */
if ((options & WNOHANG))
- {
- threads_debug_printf ("WNOHANG set, no event found");
+ {
+ threads_debug_printf ("WNOHANG set, no event found");
- gdb_sigmask (SIG_SETMASK, &prev_mask, NULL);
- return 0;
- }
+ gdb_sigmask (SIG_SETMASK, &prev_mask, NULL);
+ return 0;
+ }
/* Block until we get an event reported with SIGCHLD. */
threads_debug_printf ("sigsuspend'ing");
@@ -2693,33 +2663,31 @@ select_event_lwp (struct lwp_info **orig_lp)
would report it to the user as a random signal. */
if (!non_stop)
{
- event_thread = find_thread ([] (thread_info *thread)
- {
- lwp_info *lp = get_thread_lwp (thread);
+ event_thread = find_thread ([] (thread_info *thread) {
+ lwp_info *lp = get_thread_lwp (thread);
- return (thread->last_status.kind () == TARGET_WAITKIND_IGNORE
- && thread->last_resume_kind == resume_step
- && lp->status_pending_p);
- });
+ return (thread->last_status.kind () == TARGET_WAITKIND_IGNORE
+ && thread->last_resume_kind == resume_step
+ && lp->status_pending_p);
+ });
if (event_thread != NULL)
- threads_debug_printf
- ("Select single-step %s",
- target_pid_to_str (ptid_of (event_thread)).c_str ());
+ threads_debug_printf ("Select single-step %s",
+ target_pid_to_str (ptid_of (event_thread))
+ .c_str ());
}
if (event_thread == NULL)
{
/* No single-stepping LWP. Select one at random, out of those
which have had events. */
- event_thread = find_thread_in_random ([&] (thread_info *thread)
- {
- lwp_info *lp = get_thread_lwp (thread);
+ event_thread = find_thread_in_random ([&] (thread_info *thread) {
+ lwp_info *lp = get_thread_lwp (thread);
- /* Only resumed LWPs that have an event pending. */
- return (thread->last_status.kind () == TARGET_WAITKIND_IGNORE
- && lp->status_pending_p);
- });
+ /* Only resumed LWPs that have an event pending. */
+ return (thread->last_status.kind () == TARGET_WAITKIND_IGNORE
+ && lp->status_pending_p);
+ });
}
if (event_thread != NULL)
@@ -2737,13 +2705,12 @@ select_event_lwp (struct lwp_info **orig_lp)
static void
unsuspend_all_lwps (struct lwp_info *except)
{
- for_each_thread ([&] (thread_info *thread)
- {
- lwp_info *lwp = get_thread_lwp (thread);
+ for_each_thread ([&] (thread_info *thread) {
+ lwp_info *lwp = get_thread_lwp (thread);
- if (lwp != except)
- lwp_suspended_decr (lwp);
- });
+ if (lwp != except)
+ lwp_suspended_decr (lwp);
+ });
}
static bool lwp_running (thread_info *thread);
@@ -2781,15 +2748,13 @@ static bool lwp_running (thread_info *thread);
void
linux_process_target::stabilize_threads ()
{
- thread_info *thread_stuck = find_thread ([this] (thread_info *thread)
- {
- return stuck_in_jump_pad (thread);
- });
+ thread_info *thread_stuck = find_thread (
+ [this] (thread_info *thread) { return stuck_in_jump_pad (thread); });
if (thread_stuck != NULL)
{
threads_debug_printf ("can't stabilize, LWP %ld is stuck in jump pad",
- lwpid_of (thread_stuck));
+ lwpid_of (thread_stuck));
return;
}
@@ -2798,10 +2763,8 @@ linux_process_target::stabilize_threads ()
stabilizing_threads = 1;
/* Kick 'em all. */
- for_each_thread ([this] (thread_info *thread)
- {
- move_out_of_jump_pad (thread);
- });
+ for_each_thread (
+ [this] (thread_info *thread) { move_out_of_jump_pad (thread); });
/* Loop until all are stopped out of the jump pads. */
while (find_thread (lwp_running) != NULL)
@@ -2816,19 +2779,19 @@ linux_process_target::stabilize_threads ()
wait_1 (minus_one_ptid, &ourstatus, 0);
if (ourstatus.kind () == TARGET_WAITKIND_STOPPED)
- {
- lwp = get_thread_lwp (current_thread);
+ {
+ lwp = get_thread_lwp (current_thread);
- /* Lock it. */
- lwp_suspended_inc (lwp);
+ /* Lock it. */
+ lwp_suspended_inc (lwp);
- if (ourstatus.sig () != GDB_SIGNAL_0
- || current_thread->last_resume_kind == resume_stop)
- {
- wstat = W_STOPCODE (gdb_signal_to_host (ourstatus.sig ()));
- enqueue_one_deferred_signal (lwp, &wstat);
- }
- }
+ if (ourstatus.sig () != GDB_SIGNAL_0
+ || current_thread->last_resume_kind == resume_stop)
+ {
+ wstat = W_STOPCODE (gdb_signal_to_host (ourstatus.sig ()));
+ enqueue_one_deferred_signal (lwp, &wstat);
+ }
+ }
}
unsuspend_all_lwps (NULL);
@@ -2837,15 +2800,13 @@ linux_process_target::stabilize_threads ()
if (debug_threads)
{
- thread_stuck = find_thread ([this] (thread_info *thread)
- {
- return stuck_in_jump_pad (thread);
- });
+ thread_stuck = find_thread (
+ [this] (thread_info *thread) { return stuck_in_jump_pad (thread); });
if (thread_stuck != NULL)
- threads_debug_printf
- ("couldn't stabilize, LWP %ld got stuck in jump pad",
- lwpid_of (thread_stuck));
+ threads_debug_printf (
+ "couldn't stabilize, LWP %ld got stuck in jump pad",
+ lwpid_of (thread_stuck));
}
}
@@ -2866,7 +2827,7 @@ ignore_event (struct target_waitstatus *ourstatus)
ptid_t
linux_process_target::filter_exit_event (lwp_info *event_child,
- target_waitstatus *ourstatus)
+ target_waitstatus *ourstatus)
{
client_state &cs = get_client_state ();
struct thread_info *thread = get_lwp_thread (event_child);
@@ -2875,9 +2836,9 @@ linux_process_target::filter_exit_event (lwp_info *event_child,
if (!is_leader (thread))
{
if (cs.report_thread_events)
- ourstatus->set_thread_exited (0);
+ ourstatus->set_thread_exited (0);
else
- ourstatus->set_ignore ();
+ ourstatus->set_ignore ();
delete_lwp (event_child);
}
@@ -2919,7 +2880,7 @@ linux_process_target::gdb_catch_this_syscall (lwp_info *event_child)
ptid_t
linux_process_target::wait_1 (ptid_t ptid, target_waitstatus *ourstatus,
- target_wait_flags target_options)
+ target_wait_flags target_options)
{
THREADS_SCOPED_DEBUG_ENTER_EXIT;
@@ -2948,15 +2909,13 @@ linux_process_target::wait_1 (ptid_t ptid, target_waitstatus *ourstatus,
in_step_range = 0;
ourstatus->set_ignore ();
- auto status_pending_p_any = [&] (thread_info *thread)
- {
- return status_pending_p_callback (thread, minus_one_ptid);
- };
+ auto status_pending_p_any = [&] (thread_info *thread) {
+ return status_pending_p_callback (thread, minus_one_ptid);
+ };
- auto not_stopped = [&] (thread_info *thread)
- {
- return not_stopped_callback (thread, minus_one_ptid);
- };
+ auto not_stopped = [&] (thread_info *thread) {
+ return not_stopped_callback (thread, minus_one_ptid);
+ };
/* Find a resumed LWP, if any. */
if (find_thread (status_pending_p_any) != NULL)
@@ -2971,7 +2930,7 @@ linux_process_target::wait_1 (ptid_t ptid, target_waitstatus *ourstatus,
else
{
threads_debug_printf ("step_over_bkpt set [%s], doing a blocking wait",
- target_pid_to_str (step_over_bkpt).c_str ());
+ target_pid_to_str (step_over_bkpt).c_str ());
pid = wait_for_event (step_over_bkpt, &w, options & ~WNOHANG);
}
@@ -2999,26 +2958,26 @@ linux_process_target::wait_1 (ptid_t ptid, target_waitstatus *ourstatus,
if (WIFEXITED (w) || WIFSIGNALED (w))
{
if (WIFEXITED (w))
- {
- ourstatus->set_exited (WEXITSTATUS (w));
-
- threads_debug_printf
- ("ret = %s, exited with retcode %d",
- target_pid_to_str (ptid_of (current_thread)).c_str (),
- WEXITSTATUS (w));
- }
+ {
+ ourstatus->set_exited (WEXITSTATUS (w));
+
+ threads_debug_printf ("ret = %s, exited with retcode %d",
+ target_pid_to_str (ptid_of (current_thread))
+ .c_str (),
+ WEXITSTATUS (w));
+ }
else
- {
- ourstatus->set_signalled (gdb_signal_from_host (WTERMSIG (w)));
+ {
+ ourstatus->set_signalled (gdb_signal_from_host (WTERMSIG (w)));
- threads_debug_printf
- ("ret = %s, terminated with signal %d",
- target_pid_to_str (ptid_of (current_thread)).c_str (),
- WTERMSIG (w));
- }
+ threads_debug_printf ("ret = %s, terminated with signal %d",
+ target_pid_to_str (ptid_of (current_thread))
+ .c_str (),
+ WTERMSIG (w));
+ }
if (ourstatus->kind () == TARGET_WAITKIND_EXITED)
- return filter_exit_event (event_child, ourstatus);
+ return filter_exit_event (event_child, ourstatus);
return ptid_of (current_thread);
}
@@ -3037,7 +2996,7 @@ linux_process_target::wait_1 (ptid_t ptid, target_waitstatus *ourstatus,
if (step_over_bkpt != null_ptid
&& event_child->stop_reason == TARGET_STOPPED_BY_SW_BREAKPOINT
&& (event_child->stepping
- || !single_step_breakpoint_inserted_here (event_child->stop_pc)))
+ || !single_step_breakpoint_inserted_here (event_child->stop_pc)))
{
int increment_pc = 0;
int breakpoint_kind = 0;
@@ -3046,21 +3005,20 @@ linux_process_target::wait_1 (ptid_t ptid, target_waitstatus *ourstatus,
breakpoint_kind = breakpoint_kind_from_current_state (&stop_pc);
sw_breakpoint_from_kind (breakpoint_kind, &increment_pc);
- threads_debug_printf
- ("step-over for %s executed software breakpoint",
- target_pid_to_str (ptid_of (current_thread)).c_str ());
+ threads_debug_printf ("step-over for %s executed software breakpoint",
+ target_pid_to_str (ptid_of (current_thread))
+ .c_str ());
if (increment_pc != 0)
- {
- struct regcache *regcache
- = get_thread_regcache (current_thread, 1);
+ {
+ struct regcache *regcache = get_thread_regcache (current_thread, 1);
- event_child->stop_pc += increment_pc;
- low_set_pc (regcache, event_child->stop_pc);
+ event_child->stop_pc += increment_pc;
+ low_set_pc (regcache, event_child->stop_pc);
- if (!low_breakpoint_at (event_child->stop_pc))
- event_child->stop_reason = TARGET_STOPPED_BY_NO_REASON;
- }
+ if (!low_breakpoint_at (event_child->stop_pc))
+ event_child->stop_reason = TARGET_STOPPED_BY_NO_REASON;
+ }
}
/* If this event was not handled before, and is not a SIGTRAP, we
@@ -3071,9 +3029,8 @@ linux_process_target::wait_1 (ptid_t ptid, target_waitstatus *ourstatus,
maybe_internal_trap
= (low_supports_breakpoints ()
&& (WSTOPSIG (w) == SIGTRAP
- || ((WSTOPSIG (w) == SIGILL
- || WSTOPSIG (w) == SIGSEGV)
- && low_breakpoint_at (event_child->stop_pc))));
+ || ((WSTOPSIG (w) == SIGILL || WSTOPSIG (w) == SIGSEGV)
+ && low_breakpoint_at (event_child->stop_pc))));
if (maybe_internal_trap)
{
@@ -3101,7 +3058,7 @@ linux_process_target::wait_1 (ptid_t ptid, target_waitstatus *ourstatus,
trace_event = handle_tracepoints (event_child);
if (bp_explains_trap)
- threads_debug_printf ("Hit a gdbserver breakpoint.");
+ threads_debug_printf ("Hit a gdbserver breakpoint.");
}
else
{
@@ -3117,108 +3074,105 @@ linux_process_target::wait_1 (ptid_t ptid, target_waitstatus *ourstatus,
move out of the jump pad before delivering a signal. See
linux_stabilize_threads. */
- if (WIFSTOPPED (w)
- && WSTOPSIG (w) != SIGTRAP
- && supports_fast_tracepoints ()
+ if (WIFSTOPPED (w) && WSTOPSIG (w) != SIGTRAP && supports_fast_tracepoints ()
&& agent_loaded_p ())
{
threads_debug_printf ("Got signal %d for LWP %ld. Check if we need "
- "to defer or adjust it.",
- WSTOPSIG (w), lwpid_of (current_thread));
+ "to defer or adjust it.",
+ WSTOPSIG (w), lwpid_of (current_thread));
/* Allow debugging the jump pad itself. */
if (current_thread->last_resume_kind != resume_step
- && maybe_move_out_of_jump_pad (event_child, &w))
- {
- enqueue_one_deferred_signal (event_child, &w);
+ && maybe_move_out_of_jump_pad (event_child, &w))
+ {
+ enqueue_one_deferred_signal (event_child, &w);
- threads_debug_printf ("Signal %d for LWP %ld deferred (in jump pad)",
- WSTOPSIG (w), lwpid_of (current_thread));
+ threads_debug_printf ("Signal %d for LWP %ld deferred (in jump pad)",
+ WSTOPSIG (w), lwpid_of (current_thread));
- resume_one_lwp (event_child, 0, 0, NULL);
+ resume_one_lwp (event_child, 0, 0, NULL);
- return ignore_event (ourstatus);
- }
+ return ignore_event (ourstatus);
+ }
}
if (event_child->collecting_fast_tracepoint
!= fast_tpoint_collect_result::not_collecting)
{
- threads_debug_printf
- ("LWP %ld was trying to move out of the jump pad (%d). "
- "Check if we're already there.",
- lwpid_of (current_thread),
- (int) event_child->collecting_fast_tracepoint);
+ threads_debug_printf (
+ "LWP %ld was trying to move out of the jump pad (%d). "
+ "Check if we're already there.",
+ lwpid_of (current_thread),
+ (int) event_child->collecting_fast_tracepoint);
trace_event = 1;
event_child->collecting_fast_tracepoint
- = linux_fast_tracepoint_collecting (event_child, NULL);
+ = linux_fast_tracepoint_collecting (event_child, NULL);
if (event_child->collecting_fast_tracepoint
- != fast_tpoint_collect_result::before_insn)
- {
- /* No longer need this breakpoint. */
- if (event_child->exit_jump_pad_bkpt != NULL)
- {
- threads_debug_printf
- ("No longer need exit-jump-pad bkpt; removing it."
- "stopping all threads momentarily.");
-
- /* Other running threads could hit this breakpoint.
+ != fast_tpoint_collect_result::before_insn)
+ {
+ /* No longer need this breakpoint. */
+ if (event_child->exit_jump_pad_bkpt != NULL)
+ {
+ threads_debug_printf (
+ "No longer need exit-jump-pad bkpt; removing it."
+ "stopping all threads momentarily.");
+
+ /* Other running threads could hit this breakpoint.
We don't handle moribund locations like GDB does,
instead we always pause all threads when removing
breakpoints, so that any step-over or
decr_pc_after_break adjustment is always taken
care of while the breakpoint is still
inserted. */
- stop_all_lwps (1, event_child);
+ stop_all_lwps (1, event_child);
- delete_breakpoint (event_child->exit_jump_pad_bkpt);
- event_child->exit_jump_pad_bkpt = NULL;
+ delete_breakpoint (event_child->exit_jump_pad_bkpt);
+ event_child->exit_jump_pad_bkpt = NULL;
- unstop_all_lwps (1, event_child);
+ unstop_all_lwps (1, event_child);
- gdb_assert (event_child->suspended >= 0);
- }
- }
+ gdb_assert (event_child->suspended >= 0);
+ }
+ }
if (event_child->collecting_fast_tracepoint
- == fast_tpoint_collect_result::not_collecting)
- {
- threads_debug_printf
- ("fast tracepoint finished collecting successfully.");
+ == fast_tpoint_collect_result::not_collecting)
+ {
+ threads_debug_printf (
+ "fast tracepoint finished collecting successfully.");
- /* We may have a deferred signal to report. */
- if (dequeue_one_deferred_signal (event_child, &w))
- threads_debug_printf ("dequeued one signal.");
- else
- {
- threads_debug_printf ("no deferred signals.");
+ /* We may have a deferred signal to report. */
+ if (dequeue_one_deferred_signal (event_child, &w))
+ threads_debug_printf ("dequeued one signal.");
+ else
+ {
+ threads_debug_printf ("no deferred signals.");
- if (stabilizing_threads)
- {
- ourstatus->set_stopped (GDB_SIGNAL_0);
+ if (stabilizing_threads)
+ {
+ ourstatus->set_stopped (GDB_SIGNAL_0);
- threads_debug_printf
- ("ret = %s, stopped while stabilizing threads",
- target_pid_to_str (ptid_of (current_thread)).c_str ());
+ threads_debug_printf (
+ "ret = %s, stopped while stabilizing threads",
+ target_pid_to_str (ptid_of (current_thread)).c_str ());
- return ptid_of (current_thread);
- }
- }
- }
+ return ptid_of (current_thread);
+ }
+ }
+ }
}
/* Check whether GDB would be interested in this event. */
/* Check if GDB is interested in this syscall. */
- if (WIFSTOPPED (w)
- && WSTOPSIG (w) == SYSCALL_SIGTRAP
+ if (WIFSTOPPED (w) && WSTOPSIG (w) == SYSCALL_SIGTRAP
&& !gdb_catch_this_syscall (event_child))
{
threads_debug_printf ("Ignored syscall for LWP %ld.",
- lwpid_of (current_thread));
+ lwpid_of (current_thread));
resume_one_lwp (event_child, event_child->stepping, 0, NULL);
@@ -3233,49 +3187,48 @@ linux_process_target::wait_1 (ptid_t ptid, target_waitstatus *ourstatus,
stepping - they may require special handling to skip the signal
handler. Also never ignore signals that could be caused by a
breakpoint. */
- if (WIFSTOPPED (w)
- && current_thread->last_resume_kind != resume_step
+ if (WIFSTOPPED (w) && current_thread->last_resume_kind != resume_step
&& (
-#if defined (USE_THREAD_DB) && !defined (__ANDROID__)
- (current_process ()->priv->thread_db != NULL
- && (WSTOPSIG (w) == __SIGRTMIN
- || WSTOPSIG (w) == __SIGRTMIN + 1))
- ||
+#if defined(USE_THREAD_DB) && !defined(__ANDROID__)
+ (current_process ()->priv->thread_db != NULL
+ && (WSTOPSIG (w) == __SIGRTMIN || WSTOPSIG (w) == __SIGRTMIN + 1))
+ ||
#endif
- (cs.pass_signals[gdb_signal_from_host (WSTOPSIG (w))]
- && !(WSTOPSIG (w) == SIGSTOP
- && current_thread->last_resume_kind == resume_stop)
- && !linux_wstatus_maybe_breakpoint (w))))
+ (cs.pass_signals[gdb_signal_from_host (WSTOPSIG (w))]
+ && !(WSTOPSIG (w) == SIGSTOP
+ && current_thread->last_resume_kind == resume_stop)
+ && !linux_wstatus_maybe_breakpoint (w))))
{
siginfo_t info, *info_p;
- threads_debug_printf ("Ignored signal %d for LWP %ld.",
- WSTOPSIG (w), lwpid_of (current_thread));
+ threads_debug_printf ("Ignored signal %d for LWP %ld.", WSTOPSIG (w),
+ lwpid_of (current_thread));
if (ptrace (PTRACE_GETSIGINFO, lwpid_of (current_thread),
- (PTRACE_TYPE_ARG3) 0, &info) == 0)
- info_p = &info;
+ (PTRACE_TYPE_ARG3) 0, &info)
+ == 0)
+ info_p = &info;
else
- info_p = NULL;
+ info_p = NULL;
if (step_over_finished)
- {
- /* We cancelled this thread's step-over above. We still
+ {
+ /* We cancelled this thread's step-over above. We still
need to unsuspend all other LWPs, and set them back
running again while the signal handler runs. */
- unsuspend_all_lwps (event_child);
+ unsuspend_all_lwps (event_child);
- /* Enqueue the pending signal info so that proceed_all_lwps
+ /* Enqueue the pending signal info so that proceed_all_lwps
doesn't lose it. */
- enqueue_pending_signal (event_child, WSTOPSIG (w), info_p);
+ enqueue_pending_signal (event_child, WSTOPSIG (w), info_p);
- proceed_all_lwps ();
- }
+ proceed_all_lwps ();
+ }
else
- {
- resume_one_lwp (event_child, event_child->stepping,
- WSTOPSIG (w), info_p);
- }
+ {
+ resume_one_lwp (event_child, event_child->stepping, WSTOPSIG (w),
+ info_p);
+ }
return ignore_event (ourstatus);
}
@@ -3297,20 +3250,18 @@ linux_process_target::wait_1 (ptid_t ptid, target_waitstatus *ourstatus,
That indicates that we had previously finished a single-step but
left the single-step pending -- see
complete_ongoing_step_over. */
- report_to_gdb = (!maybe_internal_trap
- || (current_thread->last_resume_kind == resume_step
- && !in_step_range)
- || event_child->stop_reason == TARGET_STOPPED_BY_WATCHPOINT
- || (!in_step_range
- && !bp_explains_trap
- && !trace_event
- && !step_over_finished
- && !(current_thread->last_resume_kind == resume_continue
- && event_child->stop_reason == TARGET_STOPPED_BY_SINGLE_STEP))
- || (gdb_breakpoint_here (event_child->stop_pc)
- && gdb_condition_true_at_breakpoint (event_child->stop_pc)
- && gdb_no_commands_at_breakpoint (event_child->stop_pc))
- || event_child->waitstatus.kind () != TARGET_WAITKIND_IGNORE);
+ report_to_gdb
+ = (!maybe_internal_trap
+ || (current_thread->last_resume_kind == resume_step && !in_step_range)
+ || event_child->stop_reason == TARGET_STOPPED_BY_WATCHPOINT
+ || (!in_step_range && !bp_explains_trap && !trace_event
+ && !step_over_finished
+ && !(current_thread->last_resume_kind == resume_continue
+ && event_child->stop_reason == TARGET_STOPPED_BY_SINGLE_STEP))
+ || (gdb_breakpoint_here (event_child->stop_pc)
+ && gdb_condition_true_at_breakpoint (event_child->stop_pc)
+ && gdb_no_commands_at_breakpoint (event_child->stop_pc))
+ || event_child->waitstatus.kind () != TARGET_WAITKIND_IGNORE);
run_breakpoint_commands (event_child->stop_pc);
@@ -3320,53 +3271,52 @@ linux_process_target::wait_1 (ptid_t ptid, target_waitstatus *ourstatus,
if (!report_to_gdb)
{
if (bp_explains_trap)
- threads_debug_printf ("Hit a gdbserver breakpoint.");
+ threads_debug_printf ("Hit a gdbserver breakpoint.");
if (step_over_finished)
- threads_debug_printf ("Step-over finished.");
+ threads_debug_printf ("Step-over finished.");
if (trace_event)
- threads_debug_printf ("Tracepoint event.");
+ threads_debug_printf ("Tracepoint event.");
if (lwp_in_step_range (event_child))
- threads_debug_printf ("Range stepping pc 0x%s [0x%s, 0x%s).",
- paddress (event_child->stop_pc),
- paddress (event_child->step_range_start),
- paddress (event_child->step_range_end));
+ threads_debug_printf ("Range stepping pc 0x%s [0x%s, 0x%s).",
+ paddress (event_child->stop_pc),
+ paddress (event_child->step_range_start),
+ paddress (event_child->step_range_end));
/* We're not reporting this breakpoint to GDB, so apply the
decr_pc_after_break adjustment to the inferior's regcache
ourselves. */
if (low_supports_breakpoints ())
- {
- struct regcache *regcache
- = get_thread_regcache (current_thread, 1);
- low_set_pc (regcache, event_child->stop_pc);
- }
+ {
+ struct regcache *regcache = get_thread_regcache (current_thread, 1);
+ low_set_pc (regcache, event_child->stop_pc);
+ }
if (step_over_finished)
- {
- /* If we have finished stepping over a breakpoint, we've
+ {
+ /* If we have finished stepping over a breakpoint, we've
stopped and suspended all LWPs momentarily except the
stepping one. This is where we resume them all again.
We're going to keep waiting, so use proceed, which
handles stepping over the next breakpoint. */
- unsuspend_all_lwps (event_child);
- }
+ unsuspend_all_lwps (event_child);
+ }
else
- {
- /* Remove the single-step breakpoints if any. Note that
+ {
+ /* Remove the single-step breakpoints if any. Note that
there isn't single-step breakpoint if we finished stepping
over. */
- if (supports_software_single_step ()
- && has_single_step_breakpoints (current_thread))
- {
- stop_all_lwps (0, event_child);
- delete_single_step_breakpoints (current_thread);
- unstop_all_lwps (0, event_child);
- }
- }
+ if (supports_software_single_step ()
+ && has_single_step_breakpoints (current_thread))
+ {
+ stop_all_lwps (0, event_child);
+ delete_single_step_breakpoints (current_thread);
+ unstop_all_lwps (0, event_child);
+ }
+ }
threads_debug_printf ("proceeding all threads.");
@@ -3375,29 +3325,29 @@ linux_process_target::wait_1 (ptid_t ptid, target_waitstatus *ourstatus,
return ignore_event (ourstatus);
}
- if (debug_threads)
- {
- if (event_child->waitstatus.kind () != TARGET_WAITKIND_IGNORE)
- threads_debug_printf ("LWP %ld: extended event with waitstatus %s",
- lwpid_of (get_lwp_thread (event_child)),
- event_child->waitstatus.to_string ().c_str ());
-
- if (current_thread->last_resume_kind == resume_step)
- {
- if (event_child->step_range_start == event_child->step_range_end)
- threads_debug_printf
- ("GDB wanted to single-step, reporting event.");
- else if (!lwp_in_step_range (event_child))
- threads_debug_printf ("Out of step range, reporting event.");
- }
-
- if (event_child->stop_reason == TARGET_STOPPED_BY_WATCHPOINT)
- threads_debug_printf ("Stopped by watchpoint.");
- else if (gdb_breakpoint_here (event_child->stop_pc))
- threads_debug_printf ("Stopped by GDB breakpoint.");
- }
+ if (debug_threads)
+ {
+ if (event_child->waitstatus.kind () != TARGET_WAITKIND_IGNORE)
+ threads_debug_printf ("LWP %ld: extended event with waitstatus %s",
+ lwpid_of (get_lwp_thread (event_child)),
+ event_child->waitstatus.to_string ().c_str ());
+
+ if (current_thread->last_resume_kind == resume_step)
+ {
+ if (event_child->step_range_start == event_child->step_range_end)
+ threads_debug_printf (
+ "GDB wanted to single-step, reporting event.");
+ else if (!lwp_in_step_range (event_child))
+ threads_debug_printf ("Out of step range, reporting event.");
+ }
+
+ if (event_child->stop_reason == TARGET_STOPPED_BY_WATCHPOINT)
+ threads_debug_printf ("Stopped by watchpoint.");
+ else if (gdb_breakpoint_here (event_child->stop_pc))
+ threads_debug_printf ("Stopped by GDB breakpoint.");
+ }
- threads_debug_printf ("Hit a non-gdbserver trap event.");
+ threads_debug_printf ("Hit a non-gdbserver trap event.");
/* Alright, we're going to report a stop. */
@@ -3410,102 +3360,101 @@ linux_process_target::wait_1 (ptid_t ptid, target_waitstatus *ourstatus,
int remove_single_step_breakpoints_p = 0;
if (non_stop)
- {
- remove_single_step_breakpoints_p
- = has_single_step_breakpoints (current_thread);
- }
+ {
+ remove_single_step_breakpoints_p
+ = has_single_step_breakpoints (current_thread);
+ }
else
- {
- /* In all-stop, a stop reply cancels all previous resume
+ {
+ /* In all-stop, a stop reply cancels all previous resume
requests. Delete all single-step breakpoints. */
- find_thread ([&] (thread_info *thread) {
- if (has_single_step_breakpoints (thread))
- {
- remove_single_step_breakpoints_p = 1;
- return true;
- }
+ find_thread ([&] (thread_info *thread) {
+ if (has_single_step_breakpoints (thread))
+ {
+ remove_single_step_breakpoints_p = 1;
+ return true;
+ }
- return false;
- });
- }
+ return false;
+ });
+ }
if (remove_single_step_breakpoints_p)
- {
- /* If we remove single-step breakpoints from memory, stop all lwps,
+ {
+ /* If we remove single-step breakpoints from memory, stop all lwps,
so that other threads won't hit the breakpoint in the staled
memory. */
- stop_all_lwps (0, event_child);
+ stop_all_lwps (0, event_child);
- if (non_stop)
- {
- gdb_assert (has_single_step_breakpoints (current_thread));
- delete_single_step_breakpoints (current_thread);
- }
- else
- {
- for_each_thread ([] (thread_info *thread){
- if (has_single_step_breakpoints (thread))
- delete_single_step_breakpoints (thread);
- });
- }
+ if (non_stop)
+ {
+ gdb_assert (has_single_step_breakpoints (current_thread));
+ delete_single_step_breakpoints (current_thread);
+ }
+ else
+ {
+ for_each_thread ([] (thread_info *thread) {
+ if (has_single_step_breakpoints (thread))
+ delete_single_step_breakpoints (thread);
+ });
+ }
- unstop_all_lwps (0, event_child);
- }
+ unstop_all_lwps (0, event_child);
+ }
}
if (!stabilizing_threads)
{
/* In all-stop, stop all threads. */
if (!non_stop)
- stop_all_lwps (0, NULL);
+ stop_all_lwps (0, NULL);
if (step_over_finished)
- {
- if (!non_stop)
- {
- /* If we were doing a step-over, all other threads but
+ {
+ if (!non_stop)
+ {
+ /* If we were doing a step-over, all other threads but
the stepping one had been paused in start_step_over,
with their suspend counts incremented. We don't want
to do a full unstop/unpause, because we're in
all-stop mode (so we want threads stopped), but we
still need to unsuspend the other threads, to
decrement their `suspended' count back. */
- unsuspend_all_lwps (event_child);
- }
- else
- {
- /* If we just finished a step-over, then all threads had
+ unsuspend_all_lwps (event_child);
+ }
+ else
+ {
+ /* If we just finished a step-over, then all threads had
been momentarily paused. In all-stop, that's fine,
we want threads stopped by now anyway. In non-stop,
we need to re-resume threads that GDB wanted to be
running. */
- unstop_all_lwps (1, event_child);
- }
- }
+ unstop_all_lwps (1, event_child);
+ }
+ }
/* If we're not waiting for a specific LWP, choose an event LWP
from among those that have had events. Giving equal priority
to all LWPs that have had events helps prevent
starvation. */
if (ptid == minus_one_ptid)
- {
- event_child->status_pending_p = 1;
- event_child->status_pending = w;
+ {
+ event_child->status_pending_p = 1;
+ event_child->status_pending = w;
- select_event_lwp (&event_child);
+ select_event_lwp (&event_child);
- /* current_thread and event_child must stay in sync. */
- switch_to_thread (get_lwp_thread (event_child));
-
- event_child->status_pending_p = 0;
- w = event_child->status_pending;
- }
+ /* current_thread and event_child must stay in sync. */
+ switch_to_thread (get_lwp_thread (event_child));
+ event_child->status_pending_p = 0;
+ w = event_child->status_pending;
+ }
/* Stabilize threads (move out of jump pads). */
if (!non_stop)
- target_stabilize_threads ();
+ target_stabilize_threads ();
}
else
{
@@ -3514,7 +3463,7 @@ linux_process_target::wait_1 (ptid_t ptid, target_waitstatus *ourstatus,
threads stopped by now anyway. In non-stop, we need to
re-resume threads that GDB wanted to be running. */
if (step_over_finished)
- unstop_all_lwps (1, event_child);
+ unstop_all_lwps (1, event_child);
}
/* At this point, we haven't set OURSTATUS. This is where we do it. */
@@ -3527,11 +3476,11 @@ linux_process_target::wait_1 (ptid_t ptid, target_waitstatus *ourstatus,
/* Break the unreported fork relationship chain. */
if (event_child->waitstatus.kind () == TARGET_WAITKIND_FORKED
- || event_child->waitstatus.kind () == TARGET_WAITKIND_VFORKED)
- {
- event_child->fork_relative->fork_relative = NULL;
- event_child->fork_relative = NULL;
- }
+ || event_child->waitstatus.kind () == TARGET_WAITKIND_VFORKED)
+ {
+ event_child->fork_relative->fork_relative = NULL;
+ event_child->fork_relative = NULL;
+ }
*ourstatus = event_child->waitstatus;
/* Clear the event lwp's waitstatus since we handled it already. */
@@ -3543,27 +3492,28 @@ linux_process_target::wait_1 (ptid_t ptid, target_waitstatus *ourstatus,
event_chid->waitstatus wasn't filled in with the details, so look at
the wait status W. */
if (WSTOPSIG (w) == SYSCALL_SIGTRAP)
- {
- int syscall_number;
-
- get_syscall_trapinfo (event_child, &syscall_number);
- if (event_child->syscall_state == TARGET_WAITKIND_SYSCALL_ENTRY)
- ourstatus->set_syscall_entry (syscall_number);
- else if (event_child->syscall_state == TARGET_WAITKIND_SYSCALL_RETURN)
- ourstatus->set_syscall_return (syscall_number);
- else
- gdb_assert_not_reached ("unexpected syscall state");
- }
+ {
+ int syscall_number;
+
+ get_syscall_trapinfo (event_child, &syscall_number);
+ if (event_child->syscall_state == TARGET_WAITKIND_SYSCALL_ENTRY)
+ ourstatus->set_syscall_entry (syscall_number);
+ else if (event_child->syscall_state
+ == TARGET_WAITKIND_SYSCALL_RETURN)
+ ourstatus->set_syscall_return (syscall_number);
+ else
+ gdb_assert_not_reached ("unexpected syscall state");
+ }
else if (current_thread->last_resume_kind == resume_stop
- && WSTOPSIG (w) == SIGSTOP)
- {
- /* A thread that has been requested to stop by GDB with vCont;t,
+ && WSTOPSIG (w) == SIGSTOP)
+ {
+ /* A thread that has been requested to stop by GDB with vCont;t,
and it stopped cleanly, so report as SIG0. The use of
SIGSTOP is an implementation detail. */
- ourstatus->set_stopped (GDB_SIGNAL_0);
- }
+ ourstatus->set_stopped (GDB_SIGNAL_0);
+ }
else
- ourstatus->set_stopped (gdb_signal_from_host (WSTOPSIG (w)));
+ ourstatus->set_stopped (gdb_signal_from_host (WSTOPSIG (w)));
}
/* Now that we've selected our final event LWP, un-adjust its PC if
@@ -3575,18 +3525,17 @@ linux_process_target::wait_1 (ptid_t ptid, target_waitstatus *ourstatus,
int decr_pc = low_decr_pc_after_break ();
if (decr_pc != 0)
- {
- struct regcache *regcache
- = get_thread_regcache (current_thread, 1);
- low_set_pc (regcache, event_child->stop_pc + decr_pc);
- }
+ {
+ struct regcache *regcache = get_thread_regcache (current_thread, 1);
+ low_set_pc (regcache, event_child->stop_pc + decr_pc);
+ }
}
gdb_assert (step_over_bkpt == null_ptid);
threads_debug_printf ("ret = %s, %s",
- target_pid_to_str (ptid_of (current_thread)).c_str (),
- ourstatus->to_string ().c_str ());
+ target_pid_to_str (ptid_of (current_thread)).c_str (),
+ ourstatus->to_string ().c_str ());
if (ourstatus->kind () == TARGET_WAITKIND_EXITED)
return filter_exit_event (event_child, ourstatus);
@@ -3609,9 +3558,8 @@ async_file_mark (void)
}
ptid_t
-linux_process_target::wait (ptid_t ptid,
- target_waitstatus *ourstatus,
- target_wait_flags target_options)
+linux_process_target::wait (ptid_t ptid, target_waitstatus *ourstatus,
+ target_wait_flags target_options)
{
ptid_t event_ptid;
@@ -3623,14 +3571,12 @@ linux_process_target::wait (ptid_t ptid,
{
event_ptid = wait_1 (ptid, ourstatus, target_options);
}
- while ((target_options & TARGET_WNOHANG) == 0
- && event_ptid == null_ptid
- && ourstatus->kind () == TARGET_WAITKIND_IGNORE);
+ while ((target_options & TARGET_WNOHANG) == 0 && event_ptid == null_ptid
+ && ourstatus->kind () == TARGET_WAITKIND_IGNORE);
/* If at least one stop was reported, there may be more. A single
SIGCHLD can signal more than one child stop. */
- if (target_is_async_p ()
- && (target_options & TARGET_WNOHANG) != 0
+ if (target_is_async_p () && (target_options & TARGET_WNOHANG) != 0
&& event_ptid != null_ptid)
async_file_mark ();
@@ -3741,9 +3687,9 @@ mark_lwp_dead (struct lwp_info *lwp, int wstat)
static int
lwp_is_marked_dead (struct lwp_info *lwp)
{
- return (lwp->status_pending_p
- && (WIFEXITED (lwp->status_pending)
- || WIFSIGNALED (lwp->status_pending)));
+ return (
+ lwp->status_pending_p
+ && (WIFEXITED (lwp->status_pending) || WIFSIGNALED (lwp->status_pending)));
}
void
@@ -3792,18 +3738,17 @@ linux_process_target::stuck_in_jump_pad (thread_info *thread)
if (lwp->suspended != 0)
{
internal_error ("LWP %ld is suspended, suspended=%d\n",
- lwpid_of (thread), lwp->suspended);
+ lwpid_of (thread), lwp->suspended);
}
gdb_assert (lwp->stopped);
/* Allow debugging the jump pad, gdb_collect, etc.. */
- return (supports_fast_tracepoints ()
- && agent_loaded_p ()
- && (gdb_breakpoint_here (lwp->stop_pc)
- || lwp->stop_reason == TARGET_STOPPED_BY_WATCHPOINT
- || thread->last_resume_kind == resume_step)
- && (linux_fast_tracepoint_collecting (lwp, NULL)
- != fast_tpoint_collect_result::not_collecting));
+ return (supports_fast_tracepoints () && agent_loaded_p ()
+ && (gdb_breakpoint_here (lwp->stop_pc)
+ || lwp->stop_reason == TARGET_STOPPED_BY_WATCHPOINT
+ || thread->last_resume_kind == resume_step)
+ && (linux_fast_tracepoint_collecting (lwp, NULL)
+ != fast_tpoint_collect_result::not_collecting));
}
void
@@ -3815,7 +3760,7 @@ linux_process_target::move_out_of_jump_pad (thread_info *thread)
if (lwp->suspended != 0)
{
internal_error ("LWP %ld is suspended, suspended=%d\n",
- lwpid_of (thread), lwp->suspended);
+ lwpid_of (thread), lwp->suspended);
}
gdb_assert (lwp->stopped);
@@ -3832,16 +3777,16 @@ linux_process_target::move_out_of_jump_pad (thread_info *thread)
&& maybe_move_out_of_jump_pad (lwp, wstat))
{
threads_debug_printf ("LWP %ld needs stabilizing (in jump pad)",
- lwpid_of (thread));
+ lwpid_of (thread));
if (wstat)
- {
- lwp->status_pending_p = 0;
- enqueue_one_deferred_signal (lwp, wstat);
+ {
+ lwp->status_pending_p = 0;
+ enqueue_one_deferred_signal (lwp, wstat);
- threads_debug_printf ("Signal %d for LWP %ld deferred (in jump pad",
- WSTOPSIG (*wstat), lwpid_of (thread));
- }
+ threads_debug_printf ("Signal %d for LWP %ld deferred (in jump pad",
+ WSTOPSIG (*wstat), lwpid_of (thread));
+ }
resume_one_lwp (lwp, 0, 0, NULL);
}
@@ -3868,26 +3813,22 @@ linux_process_target::stop_all_lwps (int suspend, lwp_info *except)
THREADS_SCOPED_DEBUG_ENTER_EXIT;
- threads_debug_printf
- ("%s, except=%s", suspend ? "stop-and-suspend" : "stop",
- (except != NULL
- ? target_pid_to_str (ptid_of (get_lwp_thread (except))).c_str ()
- : "none"));
+ threads_debug_printf (
+ "%s, except=%s", suspend ? "stop-and-suspend" : "stop",
+ (except != NULL
+ ? target_pid_to_str (ptid_of (get_lwp_thread (except))).c_str ()
+ : "none"));
- stopping_threads = (suspend
- ? STOPPING_AND_SUSPENDING_THREADS
- : STOPPING_THREADS);
+ stopping_threads
+ = (suspend ? STOPPING_AND_SUSPENDING_THREADS : STOPPING_THREADS);
if (suspend)
- for_each_thread ([&] (thread_info *thread)
- {
- suspend_and_send_sigstop (thread, except);
- });
+ for_each_thread ([&] (thread_info *thread) {
+ suspend_and_send_sigstop (thread, except);
+ });
else
- for_each_thread ([&] (thread_info *thread)
- {
- send_sigstop (thread, except);
- });
+ for_each_thread (
+ [&] (thread_info *thread) { send_sigstop (thread, except); });
wait_for_sigstop ();
stopping_threads = NOT_STOPPING_THREADS;
@@ -3924,7 +3865,7 @@ linux_process_target::install_software_single_step_breakpoints (lwp_info *lwp)
}
int
-linux_process_target::single_step (lwp_info* lwp)
+linux_process_target::single_step (lwp_info *lwp)
{
int step = 0;
@@ -3953,12 +3894,12 @@ static int
lwp_signal_can_be_delivered (struct lwp_info *lwp)
{
return (lwp->collecting_fast_tracepoint
- == fast_tpoint_collect_result::not_collecting);
+ == fast_tpoint_collect_result::not_collecting);
}
void
linux_process_target::resume_one_lwp_throw (lwp_info *lwp, int step,
- int signal, siginfo_t *info)
+ int signal, siginfo_t *info)
{
struct thread_info *thread = get_lwp_thread (lwp);
int ptrace_request;
@@ -3979,9 +3920,9 @@ linux_process_target::resume_one_lwp_throw (lwp_info *lwp, int step,
fast_tpoint_collect_result fast_tp_collecting
= lwp->collecting_fast_tracepoint;
- gdb_assert (!stabilizing_threads
- || (fast_tp_collecting
- != fast_tpoint_collect_result::not_collecting));
+ gdb_assert (
+ !stabilizing_threads
+ || (fast_tp_collecting != fast_tpoint_collect_result::not_collecting));
/* Cancel actions that rely on GDB not changing the PC (e.g., the
user used the "jump" command, or "set $pc = foo"). */
@@ -3996,9 +3937,8 @@ linux_process_target::resume_one_lwp_throw (lwp_info *lwp, int step,
signal. Also enqueue the signal if it can't be delivered to the
inferior right now. */
if (signal != 0
- && (lwp->status_pending_p
- || !lwp->pending_signals.empty ()
- || !lwp_signal_can_be_delivered (lwp)))
+ && (lwp->status_pending_p || !lwp->pending_signals.empty ()
+ || !lwp_signal_can_be_delivered (lwp)))
{
enqueue_pending_signal (lwp, signal, info);
@@ -4008,10 +3948,10 @@ linux_process_target::resume_one_lwp_throw (lwp_info *lwp, int step,
if (lwp->status_pending_p)
{
- threads_debug_printf
- ("Not resuming lwp %ld (%s, stop %s); has pending status",
- lwpid_of (thread), step ? "step" : "continue",
- lwp->stop_expected ? "expected" : "not expected");
+ threads_debug_printf (
+ "Not resuming lwp %ld (%s, stop %s); has pending status",
+ lwpid_of (thread), step ? "step" : "continue",
+ lwp->stop_expected ? "expected" : "not expected");
return;
}
@@ -4031,41 +3971,42 @@ linux_process_target::resume_one_lwp_throw (lwp_info *lwp, int step,
if (lwp->bp_reinsert != 0)
{
threads_debug_printf (" pending reinsert at 0x%s",
- paddress (lwp->bp_reinsert));
+ paddress (lwp->bp_reinsert));
if (supports_hardware_single_step ())
- {
- if (fast_tp_collecting == fast_tpoint_collect_result::not_collecting)
- {
- if (step == 0)
- warning ("BAD - reinserting but not stepping.");
- if (lwp->suspended)
- warning ("BAD - reinserting and suspended(%d).",
- lwp->suspended);
- }
- }
+ {
+ if (fast_tp_collecting == fast_tpoint_collect_result::not_collecting)
+ {
+ if (step == 0)
+ warning ("BAD - reinserting but not stepping.");
+ if (lwp->suspended)
+ warning ("BAD - reinserting and suspended(%d).",
+ lwp->suspended);
+ }
+ }
step = maybe_hw_step (thread);
}
if (fast_tp_collecting == fast_tpoint_collect_result::before_insn)
- threads_debug_printf
- ("lwp %ld wants to get out of fast tracepoint jump pad "
- "(exit-jump-pad-bkpt)", lwpid_of (thread));
+ threads_debug_printf (
+ "lwp %ld wants to get out of fast tracepoint jump pad "
+ "(exit-jump-pad-bkpt)",
+ lwpid_of (thread));
else if (fast_tp_collecting == fast_tpoint_collect_result::at_insn)
{
- threads_debug_printf
- ("lwp %ld wants to get out of fast tracepoint jump pad single-stepping",
- lwpid_of (thread));
+ threads_debug_printf (
+ "lwp %ld wants to get out of fast tracepoint jump pad single-stepping",
+ lwpid_of (thread));
if (supports_hardware_single_step ())
- step = 1;
+ step = 1;
else
- {
- internal_error ("moving out of jump pad single-stepping"
- " not implemented on this target");
- }
+ {
+ internal_error ("moving out of jump pad single-stepping"
+ " not implemented on this target");
+ }
}
/* If we have while-stepping actions in this thread set it stepping.
@@ -4078,9 +4019,9 @@ linux_process_target::resume_one_lwp_throw (lwp_info *lwp, int step,
enhancement. */
if (thread->while_stepping != NULL)
{
- threads_debug_printf
- ("lwp %ld has a while-stepping action -> forcing step.",
- lwpid_of (thread));
+ threads_debug_printf (
+ "lwp %ld has a while-stepping action -> forcing step.",
+ lwpid_of (thread));
step = single_step (lwp);
}
@@ -4092,7 +4033,7 @@ linux_process_target::resume_one_lwp_throw (lwp_info *lwp, int step,
lwp->stop_pc = low_get_pc (regcache);
threads_debug_printf (" %s from pc 0x%lx", step ? "step" : "continue",
- (long) lwp->stop_pc);
+ (long) lwp->stop_pc);
}
/* If we have pending signals, consume one if it can be delivered to
@@ -4103,15 +4044,15 @@ linux_process_target::resume_one_lwp_throw (lwp_info *lwp, int step,
signal = p_sig.signal;
if (p_sig.info.si_signo != 0)
- ptrace (PTRACE_SETSIGINFO, lwpid_of (thread), (PTRACE_TYPE_ARG3) 0,
- &p_sig.info);
+ ptrace (PTRACE_SETSIGINFO, lwpid_of (thread), (PTRACE_TYPE_ARG3) 0,
+ &p_sig.info);
lwp->pending_signals.pop_front ();
}
threads_debug_printf ("Resuming lwp %ld (%s, signal %d, stop %s)",
- lwpid_of (thread), step ? "step" : "continue", signal,
- lwp->stop_expected ? "expected" : "not expected");
+ lwpid_of (thread), step ? "step" : "continue", signal,
+ lwp->stop_expected ? "expected" : "not expected");
low_prepare_to_resume (lwp);
@@ -4124,19 +4065,17 @@ linux_process_target::resume_one_lwp_throw (lwp_info *lwp, int step,
ptrace_request = PTRACE_SYSCALL;
else
ptrace_request = PTRACE_CONT;
- ptrace (ptrace_request,
- lwpid_of (thread),
- (PTRACE_TYPE_ARG3) 0,
- /* Coerce to a uintptr_t first to avoid potential gcc warning
+ ptrace (ptrace_request, lwpid_of (thread), (PTRACE_TYPE_ARG3) 0,
+ /* Coerce to a uintptr_t first to avoid potential gcc warning
of coercing an 8 byte integer to a 4 byte pointer. */
- (PTRACE_TYPE_ARG4) (uintptr_t) signal);
+ (PTRACE_TYPE_ARG4) (uintptr_t) signal);
if (errno)
{
int saved_errno = errno;
- threads_debug_printf ("ptrace errno = %d (%s)",
- saved_errno, strerror (saved_errno));
+ threads_debug_printf ("ptrace errno = %d (%s)", saved_errno,
+ strerror (saved_errno));
errno = saved_errno;
perror_with_name ("resuming thread");
@@ -4193,7 +4132,7 @@ check_ptrace_stopped_lwp_gone (struct lwp_info *lp)
void
linux_process_target::resume_one_lwp (lwp_info *lwp, int step, int signal,
- siginfo_t *info)
+ siginfo_t *info)
{
try
{
@@ -4202,15 +4141,15 @@ linux_process_target::resume_one_lwp (lwp_info *lwp, int step, int signal,
catch (const gdb_exception_error &ex)
{
if (check_ptrace_stopped_lwp_gone (lwp))
- {
- /* This could because we tried to resume an LWP after its leader
+ {
+ /* This could because we tried to resume an LWP after its leader
exited. Mark it as resumed, so we can collect an exit event
from it. */
- lwp->stopped = 0;
- lwp->stop_reason = TARGET_STOPPED_BY_NO_REASON;
- }
+ lwp->stopped = 0;
+ lwp->stop_reason = TARGET_STOPPED_BY_NO_REASON;
+ }
else
- throw;
+ throw;
}
}
@@ -4231,91 +4170,89 @@ linux_set_resume_request (thread_info *thread, thread_resume *resume, size_t n)
{
ptid_t ptid = resume[ndx].thread;
if (ptid == minus_one_ptid
- || ptid == thread->id
- /* Handle both 'pPID' and 'pPID.-1' as meaning 'all threads
+ || ptid == thread->id
+ /* Handle both 'pPID' and 'pPID.-1' as meaning 'all threads
of PID'. */
- || (ptid.pid () == pid_of (thread)
- && (ptid.is_pid ()
- || ptid.lwp () == -1)))
- {
- if (resume[ndx].kind == resume_stop
- && thread->last_resume_kind == resume_stop)
- {
- threads_debug_printf
- ("already %s LWP %ld at GDB's request",
- (thread->last_status.kind () == TARGET_WAITKIND_STOPPED
- ? "stopped" : "stopping"),
- lwpid_of (thread));
-
- continue;
- }
-
- /* Ignore (wildcard) resume requests for already-resumed
+ || (ptid.pid () == pid_of (thread)
+ && (ptid.is_pid () || ptid.lwp () == -1)))
+ {
+ if (resume[ndx].kind == resume_stop
+ && thread->last_resume_kind == resume_stop)
+ {
+ threads_debug_printf ("already %s LWP %ld at GDB's request",
+ (thread->last_status.kind ()
+ == TARGET_WAITKIND_STOPPED
+ ? "stopped"
+ : "stopping"),
+ lwpid_of (thread));
+
+ continue;
+ }
+
+ /* Ignore (wildcard) resume requests for already-resumed
threads. */
- if (resume[ndx].kind != resume_stop
- && thread->last_resume_kind != resume_stop)
- {
- threads_debug_printf
- ("already %s LWP %ld at GDB's request",
- (thread->last_resume_kind == resume_step
- ? "stepping" : "continuing"),
- lwpid_of (thread));
- continue;
- }
-
- /* Don't let wildcard resumes resume fork children that GDB
+ if (resume[ndx].kind != resume_stop
+ && thread->last_resume_kind != resume_stop)
+ {
+ threads_debug_printf ("already %s LWP %ld at GDB's request",
+ (thread->last_resume_kind == resume_step
+ ? "stepping"
+ : "continuing"),
+ lwpid_of (thread));
+ continue;
+ }
+
+ /* Don't let wildcard resumes resume fork children that GDB
does not yet know are new fork children. */
- if (lwp->fork_relative != NULL)
- {
- struct lwp_info *rel = lwp->fork_relative;
-
- if (rel->status_pending_p
- && (rel->waitstatus.kind () == TARGET_WAITKIND_FORKED
- || rel->waitstatus.kind () == TARGET_WAITKIND_VFORKED))
- {
- threads_debug_printf
- ("not resuming LWP %ld: has queued stop reply",
- lwpid_of (thread));
- continue;
- }
- }
-
- /* If the thread has a pending event that has already been
+ if (lwp->fork_relative != NULL)
+ {
+ struct lwp_info *rel = lwp->fork_relative;
+
+ if (rel->status_pending_p
+ && (rel->waitstatus.kind () == TARGET_WAITKIND_FORKED
+ || rel->waitstatus.kind () == TARGET_WAITKIND_VFORKED))
+ {
+ threads_debug_printf (
+ "not resuming LWP %ld: has queued stop reply",
+ lwpid_of (thread));
+ continue;
+ }
+ }
+
+ /* If the thread has a pending event that has already been
reported to GDBserver core, but GDB has not pulled the
event out of the vStopped queue yet, likewise, ignore the
(wildcard) resume request. */
- if (in_queued_stop_replies (thread->id))
- {
- threads_debug_printf
- ("not resuming LWP %ld: has queued stop reply",
- lwpid_of (thread));
- continue;
- }
+ if (in_queued_stop_replies (thread->id))
+ {
+ threads_debug_printf (
+ "not resuming LWP %ld: has queued stop reply",
+ lwpid_of (thread));
+ continue;
+ }
- lwp->resume = &resume[ndx];
- thread->last_resume_kind = lwp->resume->kind;
+ lwp->resume = &resume[ndx];
+ thread->last_resume_kind = lwp->resume->kind;
- lwp->step_range_start = lwp->resume->step_range_start;
- lwp->step_range_end = lwp->resume->step_range_end;
+ lwp->step_range_start = lwp->resume->step_range_start;
+ lwp->step_range_end = lwp->resume->step_range_end;
- /* If we had a deferred signal to report, dequeue one now.
+ /* If we had a deferred signal to report, dequeue one now.
This can happen if LWP gets more than one signal while
trying to get out of a jump pad. */
- if (lwp->stopped
- && !lwp->status_pending_p
- && dequeue_one_deferred_signal (lwp, &lwp->status_pending))
- {
- lwp->status_pending_p = 1;
+ if (lwp->stopped && !lwp->status_pending_p
+ && dequeue_one_deferred_signal (lwp, &lwp->status_pending))
+ {
+ lwp->status_pending_p = 1;
- threads_debug_printf
- ("Dequeueing deferred signal %d for LWP %ld, "
- "leaving status pending.",
- WSTOPSIG (lwp->status_pending),
- lwpid_of (thread));
- }
+ threads_debug_printf (
+ "Dequeueing deferred signal %d for LWP %ld, "
+ "leaving status pending.",
+ WSTOPSIG (lwp->status_pending), lwpid_of (thread));
+ }
- return;
- }
+ return;
+ }
}
/* No resume action for this thread. */
@@ -4353,15 +4290,15 @@ linux_process_target::thread_needs_step_over (thread_info *thread)
if (!lwp->stopped)
{
threads_debug_printf ("Need step over [LWP %ld]? Ignoring, not stopped",
- lwpid_of (thread));
+ lwpid_of (thread));
return false;
}
if (thread->last_resume_kind == resume_stop)
{
- threads_debug_printf
- ("Need step over [LWP %ld]? Ignoring, should remain stopped",
- lwpid_of (thread));
+ threads_debug_printf (
+ "Need step over [LWP %ld]? Ignoring, should remain stopped",
+ lwpid_of (thread));
return false;
}
@@ -4370,15 +4307,15 @@ linux_process_target::thread_needs_step_over (thread_info *thread)
if (lwp->suspended)
{
threads_debug_printf ("Need step over [LWP %ld]? Ignoring, suspended",
- lwpid_of (thread));
+ lwpid_of (thread));
return false;
}
if (lwp->status_pending_p)
{
- threads_debug_printf
- ("Need step over [LWP %ld]? Ignoring, has pending status.",
- lwpid_of (thread));
+ threads_debug_printf (
+ "Need step over [LWP %ld]? Ignoring, has pending status.",
+ lwpid_of (thread));
return false;
}
@@ -4393,22 +4330,21 @@ linux_process_target::thread_needs_step_over (thread_info *thread)
command, or poked thread's registers herself. */
if (pc != lwp->stop_pc)
{
- threads_debug_printf
- ("Need step over [LWP %ld]? Cancelling, PC was changed. "
- "Old stop_pc was 0x%s, PC is now 0x%s", lwpid_of (thread),
- paddress (lwp->stop_pc), paddress (pc));
+ threads_debug_printf (
+ "Need step over [LWP %ld]? Cancelling, PC was changed. "
+ "Old stop_pc was 0x%s, PC is now 0x%s",
+ lwpid_of (thread), paddress (lwp->stop_pc), paddress (pc));
return false;
}
/* On software single step target, resume the inferior with signal
rather than stepping over. */
- if (supports_software_single_step ()
- && !lwp->pending_signals.empty ()
+ if (supports_software_single_step () && !lwp->pending_signals.empty ()
&& lwp_signal_can_be_delivered (lwp))
{
- threads_debug_printf
- ("Need step over [LWP %ld]? Ignoring, has pending signals.",
- lwpid_of (thread));
+ threads_debug_printf (
+ "Need step over [LWP %ld]? Ignoring, has pending signals.",
+ lwpid_of (thread));
return false;
}
@@ -4422,31 +4358,30 @@ linux_process_target::thread_needs_step_over (thread_info *thread)
/* Don't step over a breakpoint that GDB expects to hit
though. If the condition is being evaluated on the target's side
and it evaluate to false, step over this breakpoint as well. */
- if (gdb_breakpoint_here (pc)
- && gdb_condition_true_at_breakpoint (pc)
- && gdb_no_commands_at_breakpoint (pc))
- {
- threads_debug_printf ("Need step over [LWP %ld]? yes, but found"
- " GDB breakpoint at 0x%s; skipping step over",
- lwpid_of (thread), paddress (pc));
-
- return false;
- }
+ if (gdb_breakpoint_here (pc) && gdb_condition_true_at_breakpoint (pc)
+ && gdb_no_commands_at_breakpoint (pc))
+ {
+ threads_debug_printf ("Need step over [LWP %ld]? yes, but found"
+ " GDB breakpoint at 0x%s; skipping step over",
+ lwpid_of (thread), paddress (pc));
+
+ return false;
+ }
else
- {
- threads_debug_printf ("Need step over [LWP %ld]? yes, "
- "found breakpoint at 0x%s",
- lwpid_of (thread), paddress (pc));
+ {
+ threads_debug_printf ("Need step over [LWP %ld]? yes, "
+ "found breakpoint at 0x%s",
+ lwpid_of (thread), paddress (pc));
- /* We've found an lwp that needs stepping over --- return 1 so
+ /* We've found an lwp that needs stepping over --- return 1 so
that find_thread stops looking. */
- return true;
- }
+ return true;
+ }
}
- threads_debug_printf
- ("Need step over [LWP %ld]? No, no breakpoint found at 0x%s",
- lwpid_of (thread), paddress (pc));
+ threads_debug_printf (
+ "Need step over [LWP %ld]? No, no breakpoint found at 0x%s",
+ lwpid_of (thread), paddress (pc));
return false;
}
@@ -4458,14 +4393,14 @@ linux_process_target::start_step_over (lwp_info *lwp)
CORE_ADDR pc;
threads_debug_printf ("Starting step-over on LWP %ld. Stopping all threads",
- lwpid_of (thread));
+ lwpid_of (thread));
stop_all_lwps (1, lwp);
if (lwp->suspended != 0)
{
internal_error ("LWP %ld suspended=%d\n", lwpid_of (thread),
- lwp->suspended);
+ lwp->suspended);
}
threads_debug_printf ("Done stopping all threads for step-over.");
@@ -4518,10 +4453,10 @@ linux_process_target::finish_step_over (lwp_info *lwp)
stepping over a breakpoint, and we hold all threads but
LWP stopped while doing that. */
if (!supports_hardware_single_step ())
- {
- gdb_assert (has_single_step_breakpoints (current_thread));
- delete_single_step_breakpoints (current_thread);
- }
+ {
+ gdb_assert (has_single_step_breakpoints (current_thread));
+ delete_single_step_breakpoints (current_thread);
+ }
step_over_bkpt = null_ptid;
return true;
@@ -4544,36 +4479,36 @@ linux_process_target::complete_ongoing_step_over ()
/* Passing NULL_PTID as filter indicates we want all events to
be left pending. Eventually this returns when there are no
unwaited-for children left. */
- ret = wait_for_event_filtered (minus_one_ptid, null_ptid, &wstat,
- __WALL);
+ ret
+ = wait_for_event_filtered (minus_one_ptid, null_ptid, &wstat, __WALL);
gdb_assert (ret == -1);
lwp = find_lwp_pid (step_over_bkpt);
if (lwp != NULL)
- {
- finish_step_over (lwp);
+ {
+ finish_step_over (lwp);
- /* If we got our step SIGTRAP, don't leave it pending,
+ /* If we got our step SIGTRAP, don't leave it pending,
otherwise we would report it to GDB as a spurious
SIGTRAP. */
- gdb_assert (lwp->status_pending_p);
- if (WIFSTOPPED (lwp->status_pending)
- && WSTOPSIG (lwp->status_pending) == SIGTRAP)
- {
- thread_info *thread = get_lwp_thread (lwp);
- if (thread->last_resume_kind != resume_step)
- {
- threads_debug_printf ("detach: discard step-over SIGTRAP");
-
- lwp->status_pending_p = 0;
- lwp->status_pending = 0;
- resume_one_lwp (lwp, lwp->stepping, 0, NULL);
- }
- else
- threads_debug_printf
- ("detach: resume_step, not discarding step-over SIGTRAP");
- }
- }
+ gdb_assert (lwp->status_pending_p);
+ if (WIFSTOPPED (lwp->status_pending)
+ && WSTOPSIG (lwp->status_pending) == SIGTRAP)
+ {
+ thread_info *thread = get_lwp_thread (lwp);
+ if (thread->last_resume_kind != resume_step)
+ {
+ threads_debug_printf ("detach: discard step-over SIGTRAP");
+
+ lwp->status_pending_p = 0;
+ lwp->status_pending = 0;
+ resume_one_lwp (lwp, lwp->stepping, 0, NULL);
+ }
+ else
+ threads_debug_printf (
+ "detach: resume_step, not discarding step-over SIGTRAP");
+ }
+ }
step_over_bkpt = null_ptid;
unsuspend_all_lwps (lwp);
}
@@ -4581,7 +4516,7 @@ linux_process_target::complete_ongoing_step_over ()
void
linux_process_target::resume_one_thread (thread_info *thread,
- bool leave_all_stopped)
+ bool leave_all_stopped)
{
struct lwp_info *lwp = get_thread_lwp (thread);
int leave_pending;
@@ -4592,26 +4527,26 @@ linux_process_target::resume_one_thread (thread_info *thread,
if (lwp->resume->kind == resume_stop)
{
threads_debug_printf ("resume_stop request for LWP %ld",
- lwpid_of (thread));
+ lwpid_of (thread));
if (!lwp->stopped)
- {
- threads_debug_printf ("stopping LWP %ld", lwpid_of (thread));
+ {
+ threads_debug_printf ("stopping LWP %ld", lwpid_of (thread));
- /* Stop the thread, and wait for the event asynchronously,
+ /* Stop the thread, and wait for the event asynchronously,
through the event loop. */
- send_sigstop (lwp);
- }
+ send_sigstop (lwp);
+ }
else
- {
- threads_debug_printf ("already stopped LWP %ld", lwpid_of (thread));
+ {
+ threads_debug_printf ("already stopped LWP %ld", lwpid_of (thread));
- /* The LWP may have been stopped in an internal event that
+ /* The LWP may have been stopped in an internal event that
was not meant to be notified back to GDB (e.g., gdbserver
breakpoint), so we should be reporting a stop event in
this case too. */
- /* If the thread already has a pending SIGSTOP, this is a
+ /* If the thread already has a pending SIGSTOP, this is a
no-op. Otherwise, something later will presumably resume
the thread and this will cause it to cancel any pending
operation, due to last_resume_kind == resume_stop. If
@@ -4619,14 +4554,14 @@ linux_process_target::resume_one_thread (thread_info *thread,
will still report it the next time we wait - see
status_pending_p_callback. */
- /* If we already have a pending signal to report, then
+ /* If we already have a pending signal to report, then
there's no need to queue a SIGSTOP, as this means we're
midway through moving the LWP out of the jumppad, and we
will report the pending signal as soon as that is
finished. */
- if (lwp->pending_signals_to_report.empty ())
- send_sigstop (lwp);
- }
+ if (lwp->pending_signals_to_report.empty ())
+ send_sigstop (lwp);
+ }
/* For stop requests, we're done. */
lwp->resume = NULL;
@@ -4642,9 +4577,8 @@ linux_process_target::resume_one_thread (thread_info *thread,
based on if *any* thread has a pending status. If there's a
thread that needs the step-over-breakpoint dance, then don't
resume any other thread but that particular one. */
- leave_pending = (lwp->suspended
- || lwp->status_pending_p
- || leave_all_stopped);
+ leave_pending
+ = (lwp->suspended || lwp->status_pending_p || leave_all_stopped);
/* If we have a new signal, enqueue the signal. */
if (lwp->resume->sig != 0)
@@ -4654,12 +4588,13 @@ linux_process_target::resume_one_thread (thread_info *thread,
/* If this is the same signal we were previously stopped by,
make sure to queue its siginfo. */
if (WIFSTOPPED (lwp->last_status)
- && WSTOPSIG (lwp->last_status) == lwp->resume->sig
- && ptrace (PTRACE_GETSIGINFO, lwpid_of (thread),
- (PTRACE_TYPE_ARG3) 0, &info) == 0)
- info_p = &info;
+ && WSTOPSIG (lwp->last_status) == lwp->resume->sig
+ && ptrace (PTRACE_GETSIGINFO, lwpid_of (thread),
+ (PTRACE_TYPE_ARG3) 0, &info)
+ == 0)
+ info_p = &info;
else
- info_p = NULL;
+ info_p = NULL;
enqueue_pending_signal (lwp, lwp->resume->sig, info_p);
}
@@ -4682,12 +4617,11 @@ linux_process_target::resume (thread_resume *resume_info, size_t n)
{
struct thread_info *need_step_over = NULL;
- THREADS_SCOPED_DEBUG_ENTER_EXIT;
+ THREADS_SCOPED_DEBUG_ENTER_EXIT;
- for_each_thread ([&] (thread_info *thread)
- {
- linux_set_resume_request (thread, resume_info, n);
- });
+ for_each_thread ([&] (thread_info *thread) {
+ linux_set_resume_request (thread, resume_info, n);
+ });
/* If there is a thread which would otherwise be resumed, which has
a pending status, then don't resume any threads - we can just
@@ -4697,10 +4631,10 @@ linux_process_target::resume (thread_resume *resume_info, size_t n)
before considering to start a step-over (in all-stop). */
bool any_pending = false;
if (!non_stop)
- any_pending = find_thread ([this] (thread_info *thread)
- {
- return resume_status_pending (thread);
- }) != nullptr;
+ any_pending = find_thread ([this] (thread_info *thread) {
+ return resume_status_pending (thread);
+ })
+ != nullptr;
/* If there is a thread which would otherwise be resumed, which is
stopped at a breakpoint that needs stepping over, then don't
@@ -4709,10 +4643,9 @@ linux_process_target::resume (thread_resume *resume_info, size_t n)
to queue any signals that would otherwise be delivered or
queued. */
if (!any_pending && low_supports_breakpoints ())
- need_step_over = find_thread ([this] (thread_info *thread)
- {
- return thread_needs_step_over (thread);
- });
+ need_step_over = find_thread ([this] (thread_info *thread) {
+ return thread_needs_step_over (thread);
+ });
bool leave_all_stopped = (need_step_over != NULL || any_pending);
@@ -4720,16 +4653,15 @@ linux_process_target::resume (thread_resume *resume_info, size_t n)
threads_debug_printf ("Not resuming all, need step over");
else if (any_pending)
threads_debug_printf ("Not resuming, all-stop and found "
- "an LWP with pending status");
+ "an LWP with pending status");
else
threads_debug_printf ("Resuming, no pending status or step over needed");
/* Even if we're leaving threads stopped, queue all signals we'd
otherwise deliver. */
- for_each_thread ([&] (thread_info *thread)
- {
- resume_one_thread (thread, leave_all_stopped);
- });
+ for_each_thread ([&] (thread_info *thread) {
+ resume_one_thread (thread, leave_all_stopped);
+ });
if (need_step_over)
start_step_over (get_thread_lwp (need_step_over));
@@ -4761,14 +4693,14 @@ linux_process_target::proceed_one_lwp (thread_info *thread, lwp_info *except)
&& thread->last_status.kind () != TARGET_WAITKIND_IGNORE)
{
threads_debug_printf (" client wants LWP to remain %ld stopped",
- lwpid_of (thread));
+ lwpid_of (thread));
return;
}
if (lwp->status_pending_p)
{
threads_debug_printf (" LWP %ld has pending status, leaving stopped",
- lwpid_of (thread));
+ lwpid_of (thread));
return;
}
@@ -4783,7 +4715,7 @@ linux_process_target::proceed_one_lwp (thread_info *thread, lwp_info *except)
if (thread->last_resume_kind == resume_stop
&& lwp->pending_signals_to_report.empty ()
&& (lwp->collecting_fast_tracepoint
- == fast_tpoint_collect_result::not_collecting))
+ == fast_tpoint_collect_result::not_collecting))
{
/* We haven't reported this LWP as stopped yet (otherwise, the
last_status.kind check above would catch it, and we wouldn't
@@ -4795,9 +4727,9 @@ linux_process_target::proceed_one_lwp (thread_info *thread, lwp_info *except)
another one here. Note that if the LWP already has a SIGSTOP
pending, this is a no-op. */
- threads_debug_printf
- ("Client wants LWP %ld to stop. Making sure it has a SIGSTOP pending",
- lwpid_of (thread));
+ threads_debug_printf (
+ "Client wants LWP %ld to stop. Making sure it has a SIGSTOP pending",
+ lwpid_of (thread));
send_sigstop (lwp);
}
@@ -4805,21 +4737,21 @@ linux_process_target::proceed_one_lwp (thread_info *thread, lwp_info *except)
if (thread->last_resume_kind == resume_step)
{
threads_debug_printf (" stepping LWP %ld, client wants it stepping",
- lwpid_of (thread));
+ lwpid_of (thread));
/* If resume_step is requested by GDB, install single-step
breakpoints when the thread is about to be actually resumed if
the single-step breakpoints weren't removed. */
if (supports_software_single_step ()
- && !has_single_step_breakpoints (thread))
- install_software_single_step_breakpoints (lwp);
+ && !has_single_step_breakpoints (thread))
+ install_software_single_step_breakpoints (lwp);
step = maybe_hw_step (thread);
}
else if (lwp->bp_reinsert != 0)
{
threads_debug_printf (" stepping LWP %ld, reinsert set",
- lwpid_of (thread));
+ lwpid_of (thread));
step = maybe_hw_step (thread);
}
@@ -4831,7 +4763,7 @@ linux_process_target::proceed_one_lwp (thread_info *thread, lwp_info *except)
void
linux_process_target::unsuspend_and_proceed_one_lwp (thread_info *thread,
- lwp_info *except)
+ lwp_info *except)
{
struct lwp_info *lwp = get_thread_lwp (thread);
@@ -4855,27 +4787,24 @@ linux_process_target::proceed_all_lwps ()
if (low_supports_breakpoints ())
{
- need_step_over = find_thread ([this] (thread_info *thread)
- {
- return thread_needs_step_over (thread);
- });
+ need_step_over = find_thread ([this] (thread_info *thread) {
+ return thread_needs_step_over (thread);
+ });
if (need_step_over != NULL)
- {
- threads_debug_printf ("found thread %ld needing a step-over",
- lwpid_of (need_step_over));
+ {
+ threads_debug_printf ("found thread %ld needing a step-over",
+ lwpid_of (need_step_over));
- start_step_over (get_thread_lwp (need_step_over));
- return;
- }
+ start_step_over (get_thread_lwp (need_step_over));
+ return;
+ }
}
threads_debug_printf ("Proceeding, no step-over needed");
- for_each_thread ([this] (thread_info *thread)
- {
- proceed_one_lwp (thread, NULL);
- });
+ for_each_thread (
+ [this] (thread_info *thread) { proceed_one_lwp (thread, NULL); });
}
void
@@ -4885,23 +4814,19 @@ linux_process_target::unstop_all_lwps (int unsuspend, lwp_info *except)
if (except)
threads_debug_printf ("except=(LWP %ld)",
- lwpid_of (get_lwp_thread (except)));
+ lwpid_of (get_lwp_thread (except)));
else
threads_debug_printf ("except=nullptr");
if (unsuspend)
- for_each_thread ([&] (thread_info *thread)
- {
- unsuspend_and_proceed_one_lwp (thread, except);
- });
+ for_each_thread ([&] (thread_info *thread) {
+ unsuspend_and_proceed_one_lwp (thread, except);
+ });
else
- for_each_thread ([&] (thread_info *thread)
- {
- proceed_one_lwp (thread, except);
- });
+ for_each_thread (
+ [&] (thread_info *thread) { proceed_one_lwp (thread, except); });
}
-
#ifdef HAVE_LINUX_REGSETS
#define use_linux_regsets 1
@@ -4912,7 +4837,7 @@ static int
regset_disabled (struct regsets_info *info, struct regset_info *regset)
{
return (info->disabled_regsets != NULL
- && info->disabled_regsets[regset - info->regsets]);
+ && info->disabled_regsets[regset - info->regsets]);
}
/* Disable REGSET. */
@@ -4930,7 +4855,7 @@ disable_regset (struct regsets_info *info, struct regset_info *regset)
static int
regsets_fetch_inferior_registers (struct regsets_info *regsets_info,
- struct regcache *regcache)
+ struct regcache *regcache)
{
struct regset_info *regset;
int saw_general_regs = 0;
@@ -4944,61 +4869,61 @@ regsets_fetch_inferior_registers (struct regsets_info *regsets_info,
int nt_type, res;
if (regset->size == 0 || regset_disabled (regsets_info, regset))
- continue;
+ continue;
buf = xmalloc (regset->size);
nt_type = regset->nt_type;
if (nt_type)
- {
- iov.iov_base = buf;
- iov.iov_len = regset->size;
- data = (void *) &iov;
- }
+ {
+ iov.iov_base = buf;
+ iov.iov_len = regset->size;
+ data = (void *) &iov;
+ }
else
- data = buf;
+ data = buf;
#ifndef __sparc__
res = ptrace (regset->get_request, pid,
- (PTRACE_TYPE_ARG3) (long) nt_type, data);
+ (PTRACE_TYPE_ARG3) (long) nt_type, data);
#else
res = ptrace (regset->get_request, pid, data, nt_type);
#endif
if (res < 0)
- {
- if (errno == EIO
- || (errno == EINVAL && regset->type == OPTIONAL_REGS))
- {
- /* If we get EIO on a regset, or an EINVAL and the regset is
+ {
+ if (errno == EIO
+ || (errno == EINVAL && regset->type == OPTIONAL_REGS))
+ {
+ /* If we get EIO on a regset, or an EINVAL and the regset is
optional, do not try it again for this process mode. */
- disable_regset (regsets_info, regset);
- }
- else if (errno == ENODATA)
- {
- /* ENODATA may be returned if the regset is currently
+ disable_regset (regsets_info, regset);
+ }
+ else if (errno == ENODATA)
+ {
+ /* ENODATA may be returned if the regset is currently
not "active". This can happen in normal operation,
so suppress the warning in this case. */
- }
- else if (errno == ESRCH)
- {
- /* At this point, ESRCH should mean the process is
+ }
+ else if (errno == ESRCH)
+ {
+ /* At this point, ESRCH should mean the process is
already gone, in which case we simply ignore attempts
to read its registers. */
- }
- else
- {
- char s[256];
- sprintf (s, "ptrace(regsets_fetch_inferior_registers) PID=%d",
- pid);
- perror (s);
- }
- }
+ }
+ else
+ {
+ char s[256];
+ sprintf (s, "ptrace(regsets_fetch_inferior_registers) PID=%d",
+ pid);
+ perror (s);
+ }
+ }
else
- {
- if (regset->type == GENERAL_REGS)
- saw_general_regs = 1;
- regset->store_function (regcache, buf);
- }
+ {
+ if (regset->type == GENERAL_REGS)
+ saw_general_regs = 1;
+ regset->store_function (regcache, buf);
+ }
free (buf);
}
if (saw_general_regs)
@@ -5009,7 +4934,7 @@ regsets_fetch_inferior_registers (struct regsets_info *regsets_info,
static int
regsets_store_inferior_registers (struct regsets_info *regsets_info,
- struct regcache *regcache)
+ struct regcache *regcache)
{
struct regset_info *regset;
int saw_general_regs = 0;
@@ -5023,8 +4948,8 @@ regsets_store_inferior_registers (struct regsets_info *regsets_info,
int nt_type, res;
if (regset->size == 0 || regset_disabled (regsets_info, regset)
- || regset->fill_function == NULL)
- continue;
+ || regset->fill_function == NULL)
+ continue;
buf = xmalloc (regset->size);
@@ -5034,60 +4959,60 @@ regsets_store_inferior_registers (struct regsets_info *regsets_info,
nt_type = regset->nt_type;
if (nt_type)
- {
- iov.iov_base = buf;
- iov.iov_len = regset->size;
- data = (void *) &iov;
- }
+ {
+ iov.iov_base = buf;
+ iov.iov_len = regset->size;
+ data = (void *) &iov;
+ }
else
- data = buf;
+ data = buf;
#ifndef __sparc__
res = ptrace (regset->get_request, pid,
- (PTRACE_TYPE_ARG3) (long) nt_type, data);
+ (PTRACE_TYPE_ARG3) (long) nt_type, data);
#else
res = ptrace (regset->get_request, pid, data, nt_type);
#endif
if (res == 0)
- {
- /* Then overlay our cached registers on that. */
- regset->fill_function (regcache, buf);
+ {
+ /* Then overlay our cached registers on that. */
+ regset->fill_function (regcache, buf);
- /* Only now do we write the register set. */
+ /* Only now do we write the register set. */
#ifndef __sparc__
- res = ptrace (regset->set_request, pid,
- (PTRACE_TYPE_ARG3) (long) nt_type, data);
+ res = ptrace (regset->set_request, pid,
+ (PTRACE_TYPE_ARG3) (long) nt_type, data);
#else
- res = ptrace (regset->set_request, pid, data, nt_type);
+ res = ptrace (regset->set_request, pid, data, nt_type);
#endif
- }
+ }
if (res < 0)
- {
- if (errno == EIO
- || (errno == EINVAL && regset->type == OPTIONAL_REGS))
- {
- /* If we get EIO on a regset, or an EINVAL and the regset is
+ {
+ if (errno == EIO
+ || (errno == EINVAL && regset->type == OPTIONAL_REGS))
+ {
+ /* If we get EIO on a regset, or an EINVAL and the regset is
optional, do not try it again for this process mode. */
- disable_regset (regsets_info, regset);
- }
- else if (errno == ESRCH)
- {
- /* At this point, ESRCH should mean the process is
+ disable_regset (regsets_info, regset);
+ }
+ else if (errno == ESRCH)
+ {
+ /* At this point, ESRCH should mean the process is
already gone, in which case we simply ignore attempts
to change its registers. See also the related
comment in resume_one_lwp. */
- free (buf);
- return 0;
- }
- else
- {
- perror ("Warning: ptrace(regsets_store_inferior_registers)");
- }
- }
+ free (buf);
+ return 0;
+ }
+ else
+ {
+ perror ("Warning: ptrace(regsets_store_inferior_registers)");
+ }
+ }
else if (regset->type == GENERAL_REGS)
- saw_general_regs = 1;
+ saw_general_regs = 1;
free (buf);
}
if (saw_general_regs)
@@ -5114,8 +5039,8 @@ linux_register_in_regsets (const struct regs_info *regs_info, int regno)
size_t index = regno / 8;
return (use_linux_regsets
- && (regs_info->regset_bitmap == NULL
- || (regs_info->regset_bitmap[index] & mask) != 0));
+ && (regs_info->regset_bitmap == NULL
+ || (regs_info->regset_bitmap[index] & mask) != 0));
}
#ifdef HAVE_LINUX_USRREGS
@@ -5133,10 +5058,9 @@ register_addr (const struct usrregs_info *usrregs, int regnum)
return addr;
}
-
void
linux_process_target::fetch_register (const usrregs_info *usrregs,
- regcache *regcache, int regno)
+ regcache *regcache, int regno)
{
CORE_ADDR regaddr;
int i, size;
@@ -5152,27 +5076,28 @@ linux_process_target::fetch_register (const usrregs_info *usrregs,
if (regaddr == -1)
return;
- size = ((register_size (regcache->tdesc, regno)
- + sizeof (PTRACE_XFER_TYPE) - 1)
- & -sizeof (PTRACE_XFER_TYPE));
+ size
+ = ((register_size (regcache->tdesc, regno) + sizeof (PTRACE_XFER_TYPE) - 1)
+ & -sizeof (PTRACE_XFER_TYPE));
buf = (char *) alloca (size);
pid = lwpid_of (current_thread);
for (i = 0; i < size; i += sizeof (PTRACE_XFER_TYPE))
{
errno = 0;
- *(PTRACE_XFER_TYPE *) (buf + i) =
- ptrace (PTRACE_PEEKUSER, pid,
- /* Coerce to a uintptr_t first to avoid potential gcc warning
+ *(PTRACE_XFER_TYPE *) (buf + i)
+ = ptrace (PTRACE_PEEKUSER, pid,
+ /* Coerce to a uintptr_t first to avoid potential gcc warning
of coercing an 8 byte integer to a 4 byte pointer. */
- (PTRACE_TYPE_ARG3) (uintptr_t) regaddr, (PTRACE_TYPE_ARG4) 0);
+ (PTRACE_TYPE_ARG3) (uintptr_t) regaddr,
+ (PTRACE_TYPE_ARG4) 0);
regaddr += sizeof (PTRACE_XFER_TYPE);
if (errno != 0)
- {
- /* Mark register REGNO unavailable. */
- supply_register (regcache, regno, NULL);
- return;
- }
+ {
+ /* Mark register REGNO unavailable. */
+ supply_register (regcache, regno, NULL);
+ return;
+ }
}
low_supply_ptrace_register (regcache, regno, buf);
@@ -5180,7 +5105,7 @@ linux_process_target::fetch_register (const usrregs_info *usrregs,
void
linux_process_target::store_register (const usrregs_info *usrregs,
- regcache *regcache, int regno)
+ regcache *regcache, int regno)
{
CORE_ADDR regaddr;
int i, size;
@@ -5196,9 +5121,9 @@ linux_process_target::store_register (const usrregs_info *usrregs,
if (regaddr == -1)
return;
- size = ((register_size (regcache->tdesc, regno)
- + sizeof (PTRACE_XFER_TYPE) - 1)
- & -sizeof (PTRACE_XFER_TYPE));
+ size
+ = ((register_size (regcache->tdesc, regno) + sizeof (PTRACE_XFER_TYPE) - 1)
+ & -sizeof (PTRACE_XFER_TYPE));
buf = (char *) alloca (size);
memset (buf, 0, size);
@@ -5209,23 +5134,22 @@ linux_process_target::store_register (const usrregs_info *usrregs,
{
errno = 0;
ptrace (PTRACE_POKEUSER, pid,
- /* Coerce to a uintptr_t first to avoid potential gcc warning
+ /* Coerce to a uintptr_t first to avoid potential gcc warning
about coercing an 8 byte integer to a 4 byte pointer. */
- (PTRACE_TYPE_ARG3) (uintptr_t) regaddr,
- (PTRACE_TYPE_ARG4) *(PTRACE_XFER_TYPE *) (buf + i));
+ (PTRACE_TYPE_ARG3) (uintptr_t) regaddr,
+ (PTRACE_TYPE_ARG4) * (PTRACE_XFER_TYPE *) (buf + i));
if (errno != 0)
- {
- /* At this point, ESRCH should mean the process is
+ {
+ /* At this point, ESRCH should mean the process is
already gone, in which case we simply ignore attempts
to change its registers. See also the related
comment in resume_one_lwp. */
- if (errno == ESRCH)
- return;
-
+ if (errno == ESRCH)
+ return;
- if (!low_cannot_store_register (regno))
- error ("writing register %d: %s", regno, safe_strerror (errno));
- }
+ if (!low_cannot_store_register (regno))
+ error ("writing register %d: %s", regno, safe_strerror (errno));
+ }
regaddr += sizeof (PTRACE_XFER_TYPE);
}
}
@@ -5233,22 +5157,22 @@ linux_process_target::store_register (const usrregs_info *usrregs,
void
linux_process_target::low_collect_ptrace_register (regcache *regcache,
- int regno, char *buf)
+ int regno, char *buf)
{
collect_register (regcache, regno, buf);
}
void
linux_process_target::low_supply_ptrace_register (regcache *regcache,
- int regno, const char *buf)
+ int regno, const char *buf)
{
supply_register (regcache, regno, buf);
}
void
linux_process_target::usr_fetch_inferior_registers (const regs_info *regs_info,
- regcache *regcache,
- int regno, int all)
+ regcache *regcache,
+ int regno, int all)
{
#ifdef HAVE_LINUX_USRREGS
struct usrregs_info *usr = regs_info->usrregs;
@@ -5256,8 +5180,8 @@ linux_process_target::usr_fetch_inferior_registers (const regs_info *regs_info,
if (regno == -1)
{
for (regno = 0; regno < usr->num_regs; regno++)
- if (all || !linux_register_in_regsets (regs_info, regno))
- fetch_register (usr, regcache, regno);
+ if (all || !linux_register_in_regsets (regs_info, regno))
+ fetch_register (usr, regcache, regno);
}
else
fetch_register (usr, regcache, regno);
@@ -5266,8 +5190,8 @@ linux_process_target::usr_fetch_inferior_registers (const regs_info *regs_info,
void
linux_process_target::usr_store_inferior_registers (const regs_info *regs_info,
- regcache *regcache,
- int regno, int all)
+ regcache *regcache,
+ int regno, int all)
{
#ifdef HAVE_LINUX_USRREGS
struct usrregs_info *usr = regs_info->usrregs;
@@ -5275,8 +5199,8 @@ linux_process_target::usr_store_inferior_registers (const regs_info *regs_info,
if (regno == -1)
{
for (regno = 0; regno < usr->num_regs; regno++)
- if (all || !linux_register_in_regsets (regs_info, regno))
- store_register (usr, regcache, regno);
+ if (all || !linux_register_in_regsets (regs_info, regno))
+ store_register (usr, regcache, regno);
}
else
store_register (usr, regcache, regno);
@@ -5293,24 +5217,25 @@ linux_process_target::fetch_registers (regcache *regcache, int regno)
if (regno == -1)
{
if (regs_info->usrregs != NULL)
- for (regno = 0; regno < regs_info->usrregs->num_regs; regno++)
- low_fetch_register (regcache, regno);
+ for (regno = 0; regno < regs_info->usrregs->num_regs; regno++)
+ low_fetch_register (regcache, regno);
- all = regsets_fetch_inferior_registers (regs_info->regsets_info, regcache);
+ all
+ = regsets_fetch_inferior_registers (regs_info->regsets_info, regcache);
if (regs_info->usrregs != NULL)
- usr_fetch_inferior_registers (regs_info, regcache, -1, all);
+ usr_fetch_inferior_registers (regs_info, regcache, -1, all);
}
else
{
if (low_fetch_register (regcache, regno))
- return;
+ return;
use_regsets = linux_register_in_regsets (regs_info, regno);
if (use_regsets)
- all = regsets_fetch_inferior_registers (regs_info->regsets_info,
- regcache);
+ all = regsets_fetch_inferior_registers (regs_info->regsets_info,
+ regcache);
if ((!use_regsets || all) && regs_info->usrregs != NULL)
- usr_fetch_inferior_registers (regs_info, regcache, regno, 1);
+ usr_fetch_inferior_registers (regs_info, regcache, regno, 1);
}
}
@@ -5323,19 +5248,19 @@ linux_process_target::store_registers (regcache *regcache, int regno)
if (regno == -1)
{
- all = regsets_store_inferior_registers (regs_info->regsets_info,
- regcache);
+ all
+ = regsets_store_inferior_registers (regs_info->regsets_info, regcache);
if (regs_info->usrregs != NULL)
- usr_store_inferior_registers (regs_info, regcache, regno, all);
+ usr_store_inferior_registers (regs_info, regcache, regno, all);
}
else
{
use_regsets = linux_register_in_regsets (regs_info, regno);
if (use_regsets)
- all = regsets_store_inferior_registers (regs_info->regsets_info,
- regcache);
+ all = regsets_store_inferior_registers (regs_info->regsets_info,
+ regcache);
if ((!use_regsets || all) && regs_info->usrregs != NULL)
- usr_store_inferior_registers (regs_info, regcache, regno, 1);
+ usr_store_inferior_registers (regs_info, regcache, regno, 1);
}
}
@@ -5353,7 +5278,6 @@ linux_read_memory (CORE_ADDR memaddr, unsigned char *myaddr, int len)
return the_target->read_memory (memaddr, myaddr, len);
}
-
/* Helper for read_memory/write_memory using /proc/PID/mem. Because
we can use a single read/write call, this can be much more
efficient than banging away at PTRACE_PEEKTEXT. Also, unlike
@@ -5363,7 +5287,7 @@ linux_read_memory (CORE_ADDR memaddr, unsigned char *myaddr, int len)
static int
proc_xfer_memory (CORE_ADDR memaddr, unsigned char *readbuf,
- const gdb_byte *writebuf, int len)
+ const gdb_byte *writebuf, int len)
{
gdb_assert ((readbuf == nullptr) != (writebuf == nullptr));
@@ -5382,31 +5306,30 @@ proc_xfer_memory (CORE_ADDR memaddr, unsigned char *readbuf,
32-bit platforms (for instance, SPARC debugging a SPARC64
application). */
#ifdef HAVE_PREAD64
- bytes = (readbuf != nullptr
- ? pread64 (fd, readbuf, len, memaddr)
- : pwrite64 (fd, writebuf, len, memaddr));
+ bytes = (readbuf != nullptr ? pread64 (fd, readbuf, len, memaddr)
+ : pwrite64 (fd, writebuf, len, memaddr));
#else
bytes = -1;
if (lseek (fd, memaddr, SEEK_SET) != -1)
- bytes = (readbuf != nullptr
+ bytes = (readbuf != nullptr
? read (fd, readbuf, len)
? write (fd, writebuf, len));
#endif
if (bytes < 0)
- return errno;
+ return errno;
else if (bytes == 0)
- {
- /* EOF means the address space is gone, the whole process
+ {
+ /* EOF means the address space is gone, the whole process
exited or execed. */
- return EIO;
- }
+ return EIO;
+ }
memaddr += bytes;
if (readbuf != nullptr)
- readbuf += bytes;
+ readbuf += bytes;
else
- writebuf += bytes;
+ writebuf += bytes;
len -= bytes;
}
@@ -5414,8 +5337,8 @@ proc_xfer_memory (CORE_ADDR memaddr, unsigned char *readbuf,
}
int
-linux_process_target::read_memory (CORE_ADDR memaddr,
- unsigned char *myaddr, int len)
+linux_process_target::read_memory (CORE_ADDR memaddr, unsigned char *myaddr,
+ int len)
{
return proc_xfer_memory (memaddr, myaddr, nullptr, len);
}
@@ -5426,7 +5349,7 @@ linux_process_target::read_memory (CORE_ADDR memaddr,
int
linux_process_target::write_memory (CORE_ADDR memaddr,
- const unsigned char *myaddr, int len)
+ const unsigned char *myaddr, int len)
{
if (debug_threads)
{
@@ -5436,14 +5359,14 @@ linux_process_target::write_memory (CORE_ADDR memaddr,
int dump = len < 4 ? len : 4;
for (int i = 0; i < dump; i++)
- {
- sprintf (p, "%02x", myaddr[i]);
- p += 2;
- }
+ {
+ sprintf (p, "%02x", myaddr[i]);
+ p += 2;
+ }
*p = '\0';
- threads_debug_printf ("Writing %s to 0x%08lx in process %d",
- str, (long) memaddr, current_process ()->pid);
+ threads_debug_printf ("Writing %s to 0x%08lx in process %d", str,
+ (long) memaddr, current_process ()->pid);
}
return proc_xfer_memory (memaddr, nullptr, myaddr, len);
@@ -5469,8 +5392,8 @@ linux_process_target::request_interrupt ()
typed a ^C on the controlling terminal. */
int res = ::kill (-signal_pid, SIGINT);
if (res == -1)
- warning (_("Sending SIGINT to process group of pid %ld failed: %s"),
- signal_pid, safe_strerror (errno));
+ warning (_ ("Sending SIGINT to process group of pid %ld failed: %s"),
+ signal_pid, safe_strerror (errno));
}
bool
@@ -5484,7 +5407,7 @@ linux_process_target::supports_read_auxv ()
int
linux_process_target::read_auxv (int pid, CORE_ADDR offset,
- unsigned char *myaddr, unsigned int len)
+ unsigned char *myaddr, unsigned int len)
{
char filename[PATH_MAX];
int fd, n;
@@ -5508,7 +5431,7 @@ linux_process_target::read_auxv (int pid, CORE_ADDR offset,
int
linux_process_target::insert_point (enum raw_bkpt_type type, CORE_ADDR addr,
- int size, raw_breakpoint *bp)
+ int size, raw_breakpoint *bp)
{
if (type == raw_bkpt_type_sw)
return insert_memory_breakpoint (bp);
@@ -5518,7 +5441,7 @@ linux_process_target::insert_point (enum raw_bkpt_type type, CORE_ADDR addr,
int
linux_process_target::low_insert_point (raw_bkpt_type type, CORE_ADDR addr,
- int size, raw_breakpoint *bp)
+ int size, raw_breakpoint *bp)
{
/* Unsupported (see target.h). */
return 1;
@@ -5526,7 +5449,7 @@ linux_process_target::low_insert_point (raw_bkpt_type type, CORE_ADDR addr,
int
linux_process_target::remove_point (enum raw_bkpt_type type, CORE_ADDR addr,
- int size, raw_breakpoint *bp)
+ int size, raw_breakpoint *bp)
{
if (type == raw_bkpt_type_sw)
return remove_memory_breakpoint (bp);
@@ -5536,7 +5459,7 @@ linux_process_target::remove_point (enum raw_bkpt_type type, CORE_ADDR addr,
int
linux_process_target::low_remove_point (raw_bkpt_type type, CORE_ADDR addr,
- int size, raw_breakpoint *bp)
+ int size, raw_breakpoint *bp)
{
/* Unsupported (see target.h). */
return 1;
@@ -5634,11 +5557,11 @@ linux_process_target::read_offsets (CORE_ADDR *text_p, CORE_ADDR *data_p)
errno = 0;
text = ptrace (PTRACE_PEEKUSER, pid, (PTRACE_TYPE_ARG3) PT_TEXT_ADDR,
- (PTRACE_TYPE_ARG4) 0);
+ (PTRACE_TYPE_ARG4) 0);
text_end = ptrace (PTRACE_PEEKUSER, pid, (PTRACE_TYPE_ARG3) PT_TEXT_END_ADDR,
- (PTRACE_TYPE_ARG4) 0);
+ (PTRACE_TYPE_ARG4) 0);
data = ptrace (PTRACE_PEEKUSER, pid, (PTRACE_TYPE_ARG3) PT_DATA_ADDR,
- (PTRACE_TYPE_ARG4) 0);
+ (PTRACE_TYPE_ARG4) 0);
if (errno == 0)
{
@@ -5673,10 +5596,9 @@ linux_process_target::supports_get_tls_address ()
}
int
-linux_process_target::get_tls_address (thread_info *thread,
- CORE_ADDR offset,
- CORE_ADDR load_module,
- CORE_ADDR *address)
+linux_process_target::get_tls_address (thread_info *thread, CORE_ADDR offset,
+ CORE_ADDR load_module,
+ CORE_ADDR *address)
{
#ifdef USE_THREAD_DB
return thread_db_get_tls_address (thread, offset, load_module, address);
@@ -5692,17 +5614,16 @@ linux_process_target::supports_qxfer_osdata ()
}
int
-linux_process_target::qxfer_osdata (const char *annex,
- unsigned char *readbuf,
- unsigned const char *writebuf,
- CORE_ADDR offset, int len)
+linux_process_target::qxfer_osdata (const char *annex, unsigned char *readbuf,
+ unsigned const char *writebuf,
+ CORE_ADDR offset, int len)
{
return linux_common_xfer_osdata (annex, readbuf, offset, len);
}
void
-linux_process_target::siginfo_fixup (siginfo_t *siginfo,
- gdb_byte *inf_siginfo, int direction)
+linux_process_target::siginfo_fixup (siginfo_t *siginfo, gdb_byte *inf_siginfo,
+ int direction)
{
bool done = low_siginfo_fixup (siginfo, inf_siginfo, direction);
@@ -5711,15 +5632,15 @@ linux_process_target::siginfo_fixup (siginfo_t *siginfo,
if (!done)
{
if (direction == 1)
- memcpy (siginfo, inf_siginfo, sizeof (siginfo_t));
+ memcpy (siginfo, inf_siginfo, sizeof (siginfo_t));
else
- memcpy (inf_siginfo, siginfo, sizeof (siginfo_t));
+ memcpy (inf_siginfo, siginfo, sizeof (siginfo_t));
}
}
bool
linux_process_target::low_siginfo_fixup (siginfo_t *native, gdb_byte *inf,
- int direction)
+ int direction)
{
return false;
}
@@ -5731,10 +5652,9 @@ linux_process_target::supports_qxfer_siginfo ()
}
int
-linux_process_target::qxfer_siginfo (const char *annex,
- unsigned char *readbuf,
- unsigned const char *writebuf,
- CORE_ADDR offset, int len)
+linux_process_target::qxfer_siginfo (const char *annex, unsigned char *readbuf,
+ unsigned const char *writebuf,
+ CORE_ADDR offset, int len)
{
int pid;
siginfo_t siginfo;
@@ -5746,8 +5666,7 @@ linux_process_target::qxfer_siginfo (const char *annex,
pid = lwpid_of (current_thread);
threads_debug_printf ("%s siginfo for lwp %d.",
- readbuf != NULL ? "Reading" : "Writing",
- pid);
+ readbuf != NULL ? "Reading" : "Writing", pid);
if (offset >= sizeof (siginfo))
return -1;
@@ -5774,7 +5693,7 @@ linux_process_target::qxfer_siginfo (const char *annex,
siginfo_fixup (&siginfo, inf_siginfo, 1);
if (ptrace (PTRACE_SETSIGINFO, pid, (PTRACE_TYPE_ARG3) 0, &siginfo) != 0)
- return -1;
+ return -1;
}
return len;
@@ -5792,12 +5711,14 @@ sigchld_handler (int signo)
if (debug_threads)
{
do
- {
- /* Use the async signal safe debug function. */
- if (debug_write ("sigchld_handler\n",
- sizeof ("sigchld_handler\n") - 1) < 0)
- break; /* just ignore */
- } while (0);
+ {
+ /* Use the async signal safe debug function. */
+ if (debug_write ("sigchld_handler\n",
+ sizeof ("sigchld_handler\n") - 1)
+ < 0)
+ break; /* just ignore */
+ }
+ while (0);
}
if (target_is_async_p ())
@@ -5817,8 +5738,7 @@ linux_process_target::async (bool enable)
{
bool previous = target_is_async_p ();
- threads_debug_printf ("async (%d), previous=%d",
- enable, previous);
+ threads_debug_printf ("async (%d), previous=%d", enable, previous);
if (previous != enable)
{
@@ -5829,29 +5749,28 @@ linux_process_target::async (bool enable)
gdb_sigmask (SIG_BLOCK, &mask, NULL);
if (enable)
- {
- if (!linux_event_pipe.open_pipe ())
- {
- gdb_sigmask (SIG_UNBLOCK, &mask, NULL);
-
- warning ("creating event pipe failed.");
- return previous;
- }
-
- /* Register the event loop handler. */
- add_file_handler (linux_event_pipe.event_fd (),
- handle_target_event, NULL,
- "linux-low");
-
- /* Always trigger a linux_wait. */
- async_file_mark ();
- }
+ {
+ if (!linux_event_pipe.open_pipe ())
+ {
+ gdb_sigmask (SIG_UNBLOCK, &mask, NULL);
+
+ warning ("creating event pipe failed.");
+ return previous;
+ }
+
+ /* Register the event loop handler. */
+ add_file_handler (linux_event_pipe.event_fd (), handle_target_event,
+ NULL, "linux-low");
+
+ /* Always trigger a linux_wait. */
+ async_file_mark ();
+ }
else
- {
- delete_file_handler (linux_event_pipe.event_fd ());
+ {
+ delete_file_handler (linux_event_pipe.event_fd ());
- linux_event_pipe.close_pipe ();
- }
+ linux_event_pipe.close_pipe ();
+ }
gdb_sigmask (SIG_UNBLOCK, &mask, NULL);
}
@@ -5909,26 +5828,25 @@ void
linux_process_target::handle_new_gdb_connection ()
{
/* Request that all the lwps reset their ptrace options. */
- for_each_thread ([] (thread_info *thread)
- {
- struct lwp_info *lwp = get_thread_lwp (thread);
+ for_each_thread ([] (thread_info *thread) {
+ struct lwp_info *lwp = get_thread_lwp (thread);
- if (!lwp->stopped)
- {
- /* Stop the lwp so we can modify its ptrace options. */
- lwp->must_set_ptrace_flags = 1;
- linux_stop_lwp (lwp);
- }
- else
- {
- /* Already stopped; go ahead and set the ptrace options. */
- struct process_info *proc = find_process_pid (pid_of (thread));
- int options = linux_low_ptrace_options (proc->attached);
-
- linux_enable_event_reporting (lwpid_of (thread), options);
- lwp->must_set_ptrace_flags = 0;
- }
- });
+ if (!lwp->stopped)
+ {
+ /* Stop the lwp so we can modify its ptrace options. */
+ lwp->must_set_ptrace_flags = 1;
+ linux_stop_lwp (lwp);
+ }
+ else
+ {
+ /* Already stopped; go ahead and set the ptrace options. */
+ struct process_info *proc = find_process_pid (pid_of (thread));
+ int options = linux_low_ptrace_options (proc->attached);
+
+ linux_enable_event_reporting (lwpid_of (thread), options);
+ lwp->must_set_ptrace_flags = 0;
+ }
+ });
}
int
@@ -5993,8 +5911,8 @@ linux_process_target::supports_multifs ()
}
int
-linux_process_target::multifs_open (int pid, const char *filename,
- int flags, mode_t mode)
+linux_process_target::multifs_open (int pid, const char *filename, int flags,
+ mode_t mode)
{
return linux_mntns_open_cloexec (pid, filename, flags, mode);
}
@@ -6007,7 +5925,7 @@ linux_process_target::multifs_unlink (int pid, const char *filename)
ssize_t
linux_process_target::multifs_readlink (int pid, const char *filename,
- char *buf, size_t bufsiz)
+ char *buf, size_t bufsiz)
{
return linux_mntns_readlink (pid, filename, buf, bufsiz);
}
@@ -6023,7 +5941,7 @@ struct target_loadseg
Elf32_Word p_memsz;
};
-# if defined PT_GETDSBT
+#if defined PT_GETDSBT
struct target_loadmap
{
/* Protocol version number, must be zero. */
@@ -6036,10 +5954,10 @@ struct target_loadmap
/* The actual memory map. */
struct target_loadseg segs[/*nsegs*/];
};
-# define LINUX_LOADMAP PT_GETDSBT
-# define LINUX_LOADMAP_EXEC PTRACE_GETDSBT_EXEC
-# define LINUX_LOADMAP_INTERP PTRACE_GETDSBT_INTERP
-# else
+#define LINUX_LOADMAP PT_GETDSBT
+#define LINUX_LOADMAP_EXEC PTRACE_GETDSBT_EXEC
+#define LINUX_LOADMAP_INTERP PTRACE_GETDSBT_INTERP
+#else
struct target_loadmap
{
/* Protocol version number, must be zero. */
@@ -6049,10 +5967,10 @@ struct target_loadmap
/* The actual memory map. */
struct target_loadseg segs[/*nsegs*/];
};
-# define LINUX_LOADMAP PTRACE_GETFDPIC
-# define LINUX_LOADMAP_EXEC PTRACE_GETFDPIC_EXEC
-# define LINUX_LOADMAP_INTERP PTRACE_GETFDPIC_INTERP
-# endif
+#define LINUX_LOADMAP PTRACE_GETFDPIC
+#define LINUX_LOADMAP_EXEC PTRACE_GETFDPIC_EXEC
+#define LINUX_LOADMAP_INTERP PTRACE_GETFDPIC_INTERP
+#endif
bool
linux_process_target::supports_read_loadmap ()
@@ -6062,7 +5980,7 @@ linux_process_target::supports_read_loadmap ()
int
linux_process_target::read_loadmap (const char *annex, CORE_ADDR offset,
- unsigned char *myaddr, unsigned int len)
+ unsigned char *myaddr, unsigned int len)
{
int pid = lwpid_of (current_thread);
int addr = -1;
@@ -6083,7 +6001,7 @@ linux_process_target::read_loadmap (const char *annex, CORE_ADDR offset,
return -1;
actual_length = sizeof (struct target_loadmap)
- + sizeof (struct target_loadseg) * data->nsegs;
+ + sizeof (struct target_loadseg) * data->nsegs;
if (offset < 0 || offset > actual_length)
return -1;
@@ -6156,13 +6074,13 @@ linux_process_target::unpause_all (bool unfreeze)
static int
get_phdr_phnum_from_proc_auxv (const int pid, const int is_elf64,
- CORE_ADDR *phdr_memaddr, int *num_phdr)
+ CORE_ADDR *phdr_memaddr, int *num_phdr)
{
char filename[PATH_MAX];
int fd;
- const int auxv_size = is_elf64
- ? sizeof (Elf64_auxv_t) : sizeof (Elf32_auxv_t);
- char buf[sizeof (Elf64_auxv_t)]; /* The larger of the two. */
+ const int auxv_size
+ = is_elf64 ? sizeof (Elf64_auxv_t) : sizeof (Elf32_auxv_t);
+ char buf[sizeof (Elf64_auxv_t)]; /* The larger of the two. */
xsnprintf (filename, sizeof filename, "/proc/%d/auxv", pid);
@@ -6173,36 +6091,36 @@ get_phdr_phnum_from_proc_auxv (const int pid, const int is_elf64,
*phdr_memaddr = 0;
*num_phdr = 0;
while (read (fd, buf, auxv_size) == auxv_size
- && (*phdr_memaddr == 0 || *num_phdr == 0))
+ && (*phdr_memaddr == 0 || *num_phdr == 0))
{
if (is_elf64)
- {
- Elf64_auxv_t *const aux = (Elf64_auxv_t *) buf;
-
- switch (aux->a_type)
- {
- case AT_PHDR:
- *phdr_memaddr = aux->a_un.a_val;
- break;
- case AT_PHNUM:
- *num_phdr = aux->a_un.a_val;
- break;
- }
- }
+ {
+ Elf64_auxv_t *const aux = (Elf64_auxv_t *) buf;
+
+ switch (aux->a_type)
+ {
+ case AT_PHDR:
+ *phdr_memaddr = aux->a_un.a_val;
+ break;
+ case AT_PHNUM:
+ *num_phdr = aux->a_un.a_val;
+ break;
+ }
+ }
else
- {
- Elf32_auxv_t *const aux = (Elf32_auxv_t *) buf;
+ {
+ Elf32_auxv_t *const aux = (Elf32_auxv_t *) buf;
- switch (aux->a_type)
- {
- case AT_PHDR:
- *phdr_memaddr = aux->a_un.a_val;
- break;
- case AT_PHNUM:
- *num_phdr = aux->a_un.a_val;
- break;
- }
- }
+ switch (aux->a_type)
+ {
+ case AT_PHDR:
+ *phdr_memaddr = aux->a_un.a_val;
+ break;
+ case AT_PHNUM:
+ *num_phdr = aux->a_un.a_val;
+ break;
+ }
+ }
}
close (fd);
@@ -6210,8 +6128,8 @@ get_phdr_phnum_from_proc_auxv (const int pid, const int is_elf64,
if (*phdr_memaddr == 0 || *num_phdr == 0)
{
warning ("Unexpected missing AT_PHDR and/or AT_PHNUM: "
- "phdr_memaddr = %ld, phdr_num = %d",
- (long) *phdr_memaddr, *num_phdr);
+ "phdr_memaddr = %ld, phdr_num = %d",
+ (long) *phdr_memaddr, *num_phdr);
return 2;
}
@@ -6231,7 +6149,7 @@ get_dynamic (const int pid, const int is_elf64)
if (get_phdr_phnum_from_proc_auxv (pid, is_elf64, &phdr_memaddr, &num_phdr))
return 0;
- gdb_assert (num_phdr < 100); /* Basic sanity check. */
+ gdb_assert (num_phdr < 100); /* Basic sanity check. */
phdr_buf = (unsigned char *) alloca (num_phdr * phdr_size);
if (linux_read_memory (phdr_memaddr, phdr_buf, num_phdr * phdr_size))
@@ -6243,17 +6161,17 @@ get_dynamic (const int pid, const int is_elf64)
for (i = 0; relocation == -1 && i < num_phdr; i++)
if (is_elf64)
{
- Elf64_Phdr *const p = (Elf64_Phdr *) (phdr_buf + i * phdr_size);
+ Elf64_Phdr *const p = (Elf64_Phdr *) (phdr_buf + i * phdr_size);
- if (p->p_type == PT_PHDR)
- relocation = phdr_memaddr - p->p_vaddr;
+ if (p->p_type == PT_PHDR)
+ relocation = phdr_memaddr - p->p_vaddr;
}
else
{
- Elf32_Phdr *const p = (Elf32_Phdr *) (phdr_buf + i * phdr_size);
+ Elf32_Phdr *const p = (Elf32_Phdr *) (phdr_buf + i * phdr_size);
- if (p->p_type == PT_PHDR)
- relocation = phdr_memaddr - p->p_vaddr;
+ if (p->p_type == PT_PHDR)
+ relocation = phdr_memaddr - p->p_vaddr;
}
if (relocation == -1)
@@ -6274,19 +6192,19 @@ get_dynamic (const int pid, const int is_elf64)
for (i = 0; i < num_phdr; i++)
{
if (is_elf64)
- {
- Elf64_Phdr *const p = (Elf64_Phdr *) (phdr_buf + i * phdr_size);
+ {
+ Elf64_Phdr *const p = (Elf64_Phdr *) (phdr_buf + i * phdr_size);
- if (p->p_type == PT_DYNAMIC)
- return p->p_vaddr + relocation;
- }
+ if (p->p_type == PT_DYNAMIC)
+ return p->p_vaddr + relocation;
+ }
else
- {
- Elf32_Phdr *const p = (Elf32_Phdr *) (phdr_buf + i * phdr_size);
+ {
+ Elf32_Phdr *const p = (Elf32_Phdr *) (phdr_buf + i * phdr_size);
- if (p->p_type == PT_DYNAMIC)
- return p->p_vaddr + relocation;
- }
+ if (p->p_type == PT_DYNAMIC)
+ return p->p_vaddr + relocation;
+ }
}
return 0;
@@ -6302,7 +6220,7 @@ get_r_debug (const int pid, const int is_elf64)
{
CORE_ADDR dynamic_memaddr;
const int dyn_size = is_elf64 ? sizeof (Elf64_Dyn) : sizeof (Elf32_Dyn);
- unsigned char buf[sizeof (Elf64_Dyn)]; /* The larger of the two. */
+ unsigned char buf[sizeof (Elf64_Dyn)]; /* The larger of the two. */
CORE_ADDR map = -1;
dynamic_memaddr = get_dynamic (pid, is_elf64);
@@ -6312,81 +6230,83 @@ get_r_debug (const int pid, const int is_elf64)
while (linux_read_memory (dynamic_memaddr, buf, dyn_size) == 0)
{
if (is_elf64)
- {
- Elf64_Dyn *const dyn = (Elf64_Dyn *) buf;
+ {
+ Elf64_Dyn *const dyn = (Elf64_Dyn *) buf;
#if defined DT_MIPS_RLD_MAP || defined DT_MIPS_RLD_MAP_REL
- union
- {
- Elf64_Xword map;
- unsigned char buf[sizeof (Elf64_Xword)];
- }
- rld_map;
+ union
+ {
+ Elf64_Xword map;
+ unsigned char buf[sizeof (Elf64_Xword)];
+ } rld_map;
#endif
#ifdef DT_MIPS_RLD_MAP
- if (dyn->d_tag == DT_MIPS_RLD_MAP)
- {
- if (linux_read_memory (dyn->d_un.d_val,
- rld_map.buf, sizeof (rld_map.buf)) == 0)
- return rld_map.map;
- else
- break;
- }
-#endif /* DT_MIPS_RLD_MAP */
+ if (dyn->d_tag == DT_MIPS_RLD_MAP)
+ {
+ if (linux_read_memory (dyn->d_un.d_val, rld_map.buf,
+ sizeof (rld_map.buf))
+ == 0)
+ return rld_map.map;
+ else
+ break;
+ }
+#endif /* DT_MIPS_RLD_MAP */
#ifdef DT_MIPS_RLD_MAP_REL
- if (dyn->d_tag == DT_MIPS_RLD_MAP_REL)
- {
- if (linux_read_memory (dyn->d_un.d_val + dynamic_memaddr,
- rld_map.buf, sizeof (rld_map.buf)) == 0)
- return rld_map.map;
- else
- break;
- }
-#endif /* DT_MIPS_RLD_MAP_REL */
-
- if (dyn->d_tag == DT_DEBUG && map == -1)
- map = dyn->d_un.d_val;
-
- if (dyn->d_tag == DT_NULL)
- break;
- }
+ if (dyn->d_tag == DT_MIPS_RLD_MAP_REL)
+ {
+ if (linux_read_memory (dyn->d_un.d_val + dynamic_memaddr,
+ rld_map.buf, sizeof (rld_map.buf))
+ == 0)
+ return rld_map.map;
+ else
+ break;
+ }
+#endif /* DT_MIPS_RLD_MAP_REL */
+
+ if (dyn->d_tag == DT_DEBUG && map == -1)
+ map = dyn->d_un.d_val;
+
+ if (dyn->d_tag == DT_NULL)
+ break;
+ }
else
- {
- Elf32_Dyn *const dyn = (Elf32_Dyn *) buf;
+ {
+ Elf32_Dyn *const dyn = (Elf32_Dyn *) buf;
#if defined DT_MIPS_RLD_MAP || defined DT_MIPS_RLD_MAP_REL
- union
- {
- Elf32_Word map;
- unsigned char buf[sizeof (Elf32_Word)];
- }
- rld_map;
+ union
+ {
+ Elf32_Word map;
+ unsigned char buf[sizeof (Elf32_Word)];
+ } rld_map;
#endif
#ifdef DT_MIPS_RLD_MAP
- if (dyn->d_tag == DT_MIPS_RLD_MAP)
- {
- if (linux_read_memory (dyn->d_un.d_val,
- rld_map.buf, sizeof (rld_map.buf)) == 0)
- return rld_map.map;
- else
- break;
- }
-#endif /* DT_MIPS_RLD_MAP */
+ if (dyn->d_tag == DT_MIPS_RLD_MAP)
+ {
+ if (linux_read_memory (dyn->d_un.d_val, rld_map.buf,
+ sizeof (rld_map.buf))
+ == 0)
+ return rld_map.map;
+ else
+ break;
+ }
+#endif /* DT_MIPS_RLD_MAP */
#ifdef DT_MIPS_RLD_MAP_REL
- if (dyn->d_tag == DT_MIPS_RLD_MAP_REL)
- {
- if (linux_read_memory (dyn->d_un.d_val + dynamic_memaddr,
- rld_map.buf, sizeof (rld_map.buf)) == 0)
- return rld_map.map;
- else
- break;
- }
-#endif /* DT_MIPS_RLD_MAP_REL */
-
- if (dyn->d_tag == DT_DEBUG && map == -1)
- map = dyn->d_un.d_val;
-
- if (dyn->d_tag == DT_NULL)
- break;
- }
+ if (dyn->d_tag == DT_MIPS_RLD_MAP_REL)
+ {
+ if (linux_read_memory (dyn->d_un.d_val + dynamic_memaddr,
+ rld_map.buf, sizeof (rld_map.buf))
+ == 0)
+ return rld_map.map;
+ else
+ break;
+ }
+#endif /* DT_MIPS_RLD_MAP_REL */
+
+ if (dyn->d_tag == DT_DEBUG && map == -1)
+ map = dyn->d_un.d_val;
+
+ if (dyn->d_tag == DT_NULL)
+ break;
+ }
dynamic_memaddr += dyn_size;
}
@@ -6416,11 +6336,11 @@ read_one_ptr (CORE_ADDR memaddr, CORE_ADDR *ptr, int ptr_size)
if (ret == 0)
{
if (ptr_size == sizeof (CORE_ADDR))
- *ptr = addr.core_addr;
+ *ptr = addr.core_addr;
else if (ptr_size == sizeof (unsigned int))
- *ptr = addr.ui;
+ *ptr = addr.ui;
else
- gdb_assert_not_reached ("unhandled pointer size");
+ gdb_assert_not_reached ("unhandled pointer size");
}
return ret;
}
@@ -6432,84 +6352,78 @@ linux_process_target::supports_qxfer_libraries_svr4 ()
}
struct link_map_offsets
- {
- /* Offset and size of r_debug.r_version. */
- int r_version_offset;
+{
+ /* Offset and size of r_debug.r_version. */
+ int r_version_offset;
- /* Offset and size of r_debug.r_map. */
- int r_map_offset;
+ /* Offset and size of r_debug.r_map. */
+ int r_map_offset;
- /* Offset of r_debug_extended.r_next. */
- int r_next_offset;
+ /* Offset of r_debug_extended.r_next. */
+ int r_next_offset;
- /* Offset to l_addr field in struct link_map. */
- int l_addr_offset;
+ /* Offset to l_addr field in struct link_map. */
+ int l_addr_offset;
- /* Offset to l_name field in struct link_map. */
- int l_name_offset;
+ /* Offset to l_name field in struct link_map. */
+ int l_name_offset;
- /* Offset to l_ld field in struct link_map. */
- int l_ld_offset;
+ /* Offset to l_ld field in struct link_map. */
+ int l_ld_offset;
- /* Offset to l_next field in struct link_map. */
- int l_next_offset;
+ /* Offset to l_next field in struct link_map. */
+ int l_next_offset;
- /* Offset to l_prev field in struct link_map. */
- int l_prev_offset;
- };
+ /* Offset to l_prev field in struct link_map. */
+ int l_prev_offset;
+};
-static const link_map_offsets lmo_32bit_offsets =
- {
- 0, /* r_version offset. */
- 4, /* r_debug.r_map offset. */
- 20, /* r_debug_extended.r_next. */
- 0, /* l_addr offset in link_map. */
- 4, /* l_name offset in link_map. */
- 8, /* l_ld offset in link_map. */
- 12, /* l_next offset in link_map. */
- 16 /* l_prev offset in link_map. */
- };
+static const link_map_offsets lmo_32bit_offsets = {
+ 0, /* r_version offset. */
+ 4, /* r_debug.r_map offset. */
+ 20, /* r_debug_extended.r_next. */
+ 0, /* l_addr offset in link_map. */
+ 4, /* l_name offset in link_map. */
+ 8, /* l_ld offset in link_map. */
+ 12, /* l_next offset in link_map. */
+ 16 /* l_prev offset in link_map. */
+};
-static const link_map_offsets lmo_64bit_offsets =
- {
- 0, /* r_version offset. */
- 8, /* r_debug.r_map offset. */
- 40, /* r_debug_extended.r_next. */
- 0, /* l_addr offset in link_map. */
- 8, /* l_name offset in link_map. */
- 16, /* l_ld offset in link_map. */
- 24, /* l_next offset in link_map. */
- 32 /* l_prev offset in link_map. */
- };
+static const link_map_offsets lmo_64bit_offsets = {
+ 0, /* r_version offset. */
+ 8, /* r_debug.r_map offset. */
+ 40, /* r_debug_extended.r_next. */
+ 0, /* l_addr offset in link_map. */
+ 8, /* l_name offset in link_map. */
+ 16, /* l_ld offset in link_map. */
+ 24, /* l_next offset in link_map. */
+ 32 /* l_prev offset in link_map. */
+};
/* Get the loaded shared libraries from one namespace. */
static void
read_link_map (std::string &document, CORE_ADDR lmid, CORE_ADDR lm_addr,
- CORE_ADDR lm_prev, int ptr_size, const link_map_offsets *lmo)
+ CORE_ADDR lm_prev, int ptr_size, const link_map_offsets *lmo)
{
CORE_ADDR l_name, l_addr, l_ld, l_next, l_prev;
while (lm_addr
- && read_one_ptr (lm_addr + lmo->l_name_offset,
- &l_name, ptr_size) == 0
- && read_one_ptr (lm_addr + lmo->l_addr_offset,
- &l_addr, ptr_size) == 0
- && read_one_ptr (lm_addr + lmo->l_ld_offset,
- &l_ld, ptr_size) == 0
- && read_one_ptr (lm_addr + lmo->l_prev_offset,
- &l_prev, ptr_size) == 0
- && read_one_ptr (lm_addr + lmo->l_next_offset,
- &l_next, ptr_size) == 0)
+ && read_one_ptr (lm_addr + lmo->l_name_offset, &l_name, ptr_size) == 0
+ && read_one_ptr (lm_addr + lmo->l_addr_offset, &l_addr, ptr_size) == 0
+ && read_one_ptr (lm_addr + lmo->l_ld_offset, &l_ld, ptr_size) == 0
+ && read_one_ptr (lm_addr + lmo->l_prev_offset, &l_prev, ptr_size) == 0
+ && read_one_ptr (lm_addr + lmo->l_next_offset, &l_next, ptr_size)
+ == 0)
{
unsigned char libname[PATH_MAX];
if (lm_prev != l_prev)
- {
- warning ("Corrupted shared library list: 0x%s != 0x%s",
- paddress (lm_prev), paddress (l_prev));
- break;
- }
+ {
+ warning ("Corrupted shared library list: 0x%s != 0x%s",
+ paddress (lm_prev), paddress (l_prev));
+ break;
+ }
/* Not checking for error because reading may stop before we've got
PATH_MAX worth of characters. */
@@ -6517,14 +6431,15 @@ read_link_map (std::string &document, CORE_ADDR lmid, CORE_ADDR lm_addr,
linux_read_memory (l_name, libname, sizeof (libname) - 1);
libname[sizeof (libname) - 1] = '\0';
if (libname[0] != '\0')
- {
- string_appendf (document, "<library name=\"");
- xml_escape_text_append (document, (char *) libname);
- string_appendf (document, "\" lm=\"0x%s\" l_addr=\"0x%s\" "
- "l_ld=\"0x%s\" lmid=\"0x%s\"/>",
- paddress (lm_addr), paddress (l_addr),
- paddress (l_ld), paddress (lmid));
- }
+ {
+ string_appendf (document, "<library name=\"");
+ xml_escape_text_append (document, (char *) libname);
+ string_appendf (document,
+ "\" lm=\"0x%s\" l_addr=\"0x%s\" "
+ "l_ld=\"0x%s\" lmid=\"0x%s\"/>",
+ paddress (lm_addr), paddress (l_addr),
+ paddress (l_ld), paddress (lmid));
+ }
lm_prev = lm_addr;
lm_addr = l_next;
@@ -6535,9 +6450,9 @@ read_link_map (std::string &document, CORE_ADDR lmid, CORE_ADDR lm_addr,
int
linux_process_target::qxfer_libraries_svr4 (const char *annex,
- unsigned char *readbuf,
- unsigned const char *writebuf,
- CORE_ADDR offset, int len)
+ unsigned char *readbuf,
+ unsigned const char *writebuf,
+ CORE_ADDR offset, int len)
{
struct process_info_private *const priv = current_process ()->priv;
char filename[PATH_MAX];
@@ -6574,23 +6489,23 @@ linux_process_target::qxfer_libraries_svr4 (const char *annex,
sep = strchr (annex, '=');
if (sep == NULL)
- break;
+ break;
name_len = sep - annex;
if (name_len == 4 && startswith (annex, "lmid"))
- addrp = &lmid;
+ addrp = &lmid;
else if (name_len == 5 && startswith (annex, "start"))
- addrp = &lm_addr;
+ addrp = &lm_addr;
else if (name_len == 4 && startswith (annex, "prev"))
- addrp = &lm_prev;
+ addrp = &lm_prev;
else
- {
- annex = strchr (sep, ';');
- if (annex == NULL)
- break;
- annex++;
- continue;
- }
+ {
+ annex = strchr (sep, ';');
+ if (annex == NULL)
+ break;
+ annex++;
+ continue;
+ }
annex = decode_address_to_semicolon (addrp, sep + 1);
}
@@ -6609,92 +6524,94 @@ linux_process_target::qxfer_libraries_svr4 (const char *annex,
else
{
if (lm_prev != 0)
- warning ("ignoring prev=0x%s without start", paddress (lm_prev));
+ warning ("ignoring prev=0x%s without start", paddress (lm_prev));
/* We could interpret LMID as 'provide only the libraries for this
namespace' but GDB is currently only providing lmid, start, and
prev, or nothing. */
if (lmid != 0)
- warning ("ignoring lmid=0x%s without start", paddress (lmid));
+ warning ("ignoring lmid=0x%s without start", paddress (lmid));
CORE_ADDR r_debug = priv->r_debug;
if (r_debug == 0)
- r_debug = priv->r_debug = get_r_debug (pid, is_elf64);
+ r_debug = priv->r_debug = get_r_debug (pid, is_elf64);
/* We failed to find DT_DEBUG. Such situation will not change
for this inferior - do not retry it. Report it to GDB as
E01, see for the reasons at the GDB solib-svr4.c side. */
if (r_debug == (CORE_ADDR) -1)
- return -1;
+ return -1;
/* Terminate the header if we end up with an empty list. */
if (r_debug == 0)
- document += ">";
+ document += ">";
while (r_debug != 0)
- {
- int r_version = 0;
- if (linux_read_memory (r_debug + lmo->r_version_offset,
- (unsigned char *) &r_version,
- sizeof (r_version)) != 0)
- {
- warning ("unable to read r_version from 0x%s",
- paddress (r_debug + lmo->r_version_offset));
- break;
- }
-
- if (r_version < 1)
- {
- warning ("unexpected r_debug version %d", r_version);
- break;
- }
-
- if (read_one_ptr (r_debug + lmo->r_map_offset, &lm_addr,
- ptr_size) != 0)
- {
- warning ("unable to read r_map from 0x%s",
- paddress (r_debug + lmo->r_map_offset));
- break;
- }
-
- /* We read the entire namespace. */
- lm_prev = 0;
-
- /* The first entry corresponds to the main executable unless the
+ {
+ int r_version = 0;
+ if (linux_read_memory (r_debug + lmo->r_version_offset,
+ (unsigned char *) &r_version,
+ sizeof (r_version))
+ != 0)
+ {
+ warning ("unable to read r_version from 0x%s",
+ paddress (r_debug + lmo->r_version_offset));
+ break;
+ }
+
+ if (r_version < 1)
+ {
+ warning ("unexpected r_debug version %d", r_version);
+ break;
+ }
+
+ if (read_one_ptr (r_debug + lmo->r_map_offset, &lm_addr, ptr_size)
+ != 0)
+ {
+ warning ("unable to read r_map from 0x%s",
+ paddress (r_debug + lmo->r_map_offset));
+ break;
+ }
+
+ /* We read the entire namespace. */
+ lm_prev = 0;
+
+ /* The first entry corresponds to the main executable unless the
dynamic loader was loaded late by a static executable. But
in such case the main executable does not have PT_DYNAMIC
present and we would not have gotten here. */
- if (r_debug == priv->r_debug)
- {
- if (lm_addr != 0)
- string_appendf (document, " main-lm=\"0x%s\">",
- paddress (lm_addr));
- else
- document += ">";
-
- lm_prev = lm_addr;
- if (read_one_ptr (lm_addr + lmo->l_next_offset,
- &lm_addr, ptr_size) != 0)
- {
- warning ("unable to read l_next from 0x%s",
- paddress (lm_addr + lmo->l_next_offset));
- break;
- }
- }
-
- read_link_map (document, r_debug, lm_addr, lm_prev, ptr_size, lmo);
-
- if (r_version < 2)
- break;
-
- if (read_one_ptr (r_debug + lmo->r_next_offset, &r_debug,
- ptr_size) != 0)
- {
- warning ("unable to read r_next from 0x%s",
- paddress (r_debug + lmo->r_next_offset));
- break;
- }
- }
+ if (r_debug == priv->r_debug)
+ {
+ if (lm_addr != 0)
+ string_appendf (document, " main-lm=\"0x%s\">",
+ paddress (lm_addr));
+ else
+ document += ">";
+
+ lm_prev = lm_addr;
+ if (read_one_ptr (lm_addr + lmo->l_next_offset, &lm_addr,
+ ptr_size)
+ != 0)
+ {
+ warning ("unable to read l_next from 0x%s",
+ paddress (lm_addr + lmo->l_next_offset));
+ break;
+ }
+ }
+
+ read_link_map (document, r_debug, lm_addr, lm_prev, ptr_size, lmo);
+
+ if (r_version < 2)
+ break;
+
+ if (read_one_ptr (r_debug + lmo->r_next_offset, &r_debug, ptr_size)
+ != 0)
+ {
+ warning ("unable to read r_next from 0x%s",
+ paddress (r_debug + lmo->r_next_offset));
+ break;
+ }
+ }
}
document += "</library-list-svr4>";
@@ -6722,7 +6639,7 @@ linux_process_target::supports_btrace ()
btrace_target_info *
linux_process_target::enable_btrace (thread_info *tp,
- const btrace_config *conf)
+ const btrace_config *conf)
{
return linux_enable_btrace (tp->id, conf);
}
@@ -6742,17 +6659,18 @@ linux_process_target::disable_btrace (btrace_target_info *tinfo)
static void
linux_low_encode_pt_config (struct buffer *buffer,
- const struct btrace_data_pt_config *config)
+ const struct btrace_data_pt_config *config)
{
buffer_grow_str (buffer, "<pt-config>\n");
switch (config->cpu.vendor)
{
case CV_INTEL:
- buffer_xml_printf (buffer, "<cpu vendor=\"GenuineIntel\" family=\"%u\" "
- "model=\"%u\" stepping=\"%u\"/>\n",
- config->cpu.family, config->cpu.model,
- config->cpu.stepping);
+ buffer_xml_printf (buffer,
+ "<cpu vendor=\"GenuineIntel\" family=\"%u\" "
+ "model=\"%u\" stepping=\"%u\"/>\n",
+ config->cpu.family, config->cpu.model,
+ config->cpu.stepping);
break;
default:
@@ -6766,7 +6684,7 @@ linux_low_encode_pt_config (struct buffer *buffer,
static void
linux_low_encode_raw (struct buffer *buffer, const gdb_byte *data,
- unsigned int size)
+ unsigned int size)
{
if (size == 0)
return;
@@ -6790,9 +6708,8 @@ linux_low_encode_raw (struct buffer *buffer, const gdb_byte *data,
/* See to_read_btrace target method. */
int
-linux_process_target::read_btrace (btrace_target_info *tinfo,
- buffer *buffer,
- enum btrace_read_type type)
+linux_process_target::read_btrace (btrace_target_info *tinfo, buffer *buffer,
+ enum btrace_read_type type)
{
struct btrace_data btrace;
enum btrace_error err;
@@ -6801,9 +6718,9 @@ linux_process_target::read_btrace (btrace_target_info *tinfo,
if (err != BTRACE_ERR_NONE)
{
if (err == BTRACE_ERR_OVERFLOW)
- buffer_grow_str0 (buffer, "E.Overflow.");
+ buffer_grow_str0 (buffer, "E.Overflow.");
else
- buffer_grow_str0 (buffer, "E.Generic Error.");
+ buffer_grow_str0 (buffer, "E.Generic Error.");
return -1;
}
@@ -6819,8 +6736,8 @@ linux_process_target::read_btrace (btrace_target_info *tinfo,
buffer_grow_str (buffer, "<btrace version=\"1.0\">\n");
for (const btrace_block &block : *btrace.variant.bts.blocks)
- buffer_xml_printf (buffer, "<block begin=\"0x%s\" end=\"0x%s\"/>\n",
- paddress (block.begin), paddress (block.end));
+ buffer_xml_printf (buffer, "<block begin=\"0x%s\" end=\"0x%s\"/>\n",
+ paddress (block.begin), paddress (block.end));
buffer_grow_str0 (buffer, "</btrace>\n");
break;
@@ -6833,7 +6750,7 @@ linux_process_target::read_btrace (btrace_target_info *tinfo,
linux_low_encode_pt_config (buffer, &btrace.variant.pt.config);
linux_low_encode_raw (buffer, btrace.variant.pt.data,
- btrace.variant.pt.size);
+ btrace.variant.pt.size);
buffer_grow_str (buffer, "</pt>\n");
buffer_grow_str0 (buffer, "</btrace>\n");
@@ -6851,33 +6768,34 @@ linux_process_target::read_btrace (btrace_target_info *tinfo,
int
linux_process_target::read_btrace_conf (const btrace_target_info *tinfo,
- buffer *buffer)
+ buffer *buffer)
{
const struct btrace_config *conf;
- buffer_grow_str (buffer, "<!DOCTYPE btrace-conf SYSTEM \"btrace-conf.dtd\">\n");
+ buffer_grow_str (buffer,
+ "<!DOCTYPE btrace-conf SYSTEM \"btrace-conf.dtd\">\n");
buffer_grow_str (buffer, "<btrace-conf version=\"1.0\">\n");
conf = linux_btrace_conf (tinfo);
if (conf != NULL)
{
switch (conf->format)
- {
- case BTRACE_FORMAT_NONE:
- break;
+ {
+ case BTRACE_FORMAT_NONE:
+ break;
- case BTRACE_FORMAT_BTS:
- buffer_xml_printf (buffer, "<bts");
- buffer_xml_printf (buffer, " size=\"0x%x\"", conf->bts.size);
- buffer_xml_printf (buffer, " />\n");
- break;
+ case BTRACE_FORMAT_BTS:
+ buffer_xml_printf (buffer, "<bts");
+ buffer_xml_printf (buffer, " size=\"0x%x\"", conf->bts.size);
+ buffer_xml_printf (buffer, " />\n");
+ break;
- case BTRACE_FORMAT_PT:
- buffer_xml_printf (buffer, "<pt");
- buffer_xml_printf (buffer, " size=\"0x%x\"", conf->pt.size);
- buffer_xml_printf (buffer, "/>\n");
- break;
- }
+ case BTRACE_FORMAT_PT:
+ buffer_xml_printf (buffer, "<pt");
+ buffer_xml_printf (buffer, " size=\"0x%x\"", conf->pt.size);
+ buffer_xml_printf (buffer, "/>\n");
+ break;
+ }
}
buffer_grow_str0 (buffer, "</btrace-conf>\n");
@@ -6902,7 +6820,7 @@ linux_process_target::thread_name (ptid_t thread)
#if USE_THREAD_DB
bool
linux_process_target::thread_handle (ptid_t ptid, gdb_byte **handle,
- int *handle_len)
+ int *handle_len)
{
return thread_db_thread_handle (ptid, handle, handle_len);
}
@@ -6989,26 +6907,26 @@ linux_get_auxv (int pid, int wordsize, CORE_ADDR match, CORE_ADDR *valp)
gdb_assert (wordsize == 4 || wordsize == 8);
while (the_target->read_auxv (pid, offset, data, 2 * wordsize)
- == 2 * wordsize)
+ == 2 * wordsize)
{
if (wordsize == 4)
- {
- uint32_t *data_p = (uint32_t *) data;
- if (data_p[0] == match)
- {
- *valp = data_p[1];
- return 1;
- }
- }
+ {
+ uint32_t *data_p = (uint32_t *) data;
+ if (data_p[0] == match)
+ {
+ *valp = data_p[1];
+ return 1;
+ }
+ }
else
- {
- uint64_t *data_p = (uint64_t *) data;
- if (data_p[0] == match)
- {
- *valp = data_p[1];
- return 1;
- }
- }
+ {
+ uint64_t *data_p = (uint64_t *) data;
+ if (data_p[0] == match)
+ {
+ *valp = data_p[1];
+ return 1;
+ }
+ }
offset += 2 * wordsize;
}
@@ -7040,8 +6958,7 @@ linux_get_hwcap2 (int pid, int wordsize)
void
initialize_regsets_info (struct regsets_info *info)
{
- for (info->num_regsets = 0;
- info->regsets[info->num_regsets].size >= 0;
+ for (info->num_regsets = 0; info->regsets[info->num_regsets].size >= 0;
info->num_regsets++)
;
}
diff --git a/gdbserver/linux-low.h b/gdbserver/linux-low.h
index e672855a7f2..a23f1864800 100644
--- a/gdbserver/linux-low.h
+++ b/gdbserver/linux-low.h
@@ -38,7 +38,8 @@
#ifdef HAVE_LINUX_REGSETS
typedef void (*regset_fill_func) (struct regcache *, void *);
typedef void (*regset_store_func) (struct regcache *, const void *);
-enum regset_type {
+enum regset_type
+{
GENERAL_REGS,
FP_REGS,
EXTENDED_REGS,
@@ -47,8 +48,10 @@ enum regset_type {
/* The arch's regsets array initializer must be terminated with a NULL
regset. */
-#define NULL_REGSET \
- { 0, 0, 0, -1, (enum regset_type) -1, NULL, NULL }
+#define NULL_REGSET \
+ { \
+ 0, 0, 0, -1, (enum regset_type) - 1, NULL, NULL \
+ }
struct regset_info
{
@@ -139,9 +142,8 @@ struct lwp_info;
class linux_process_target : public process_stratum_target
{
public:
-
int create_inferior (const char *program,
- const std::vector<char *> &program_args) override;
+ const std::vector<char *> &program_args) override;
void post_create_inferior () override;
@@ -160,17 +162,16 @@ public:
void resume (thread_resume *resume_info, size_t n) override;
ptid_t wait (ptid_t ptid, target_waitstatus *status,
- target_wait_flags options) override;
+ target_wait_flags options) override;
void fetch_registers (regcache *regcache, int regno) override;
void store_registers (regcache *regcache, int regno) override;
- int read_memory (CORE_ADDR memaddr, unsigned char *myaddr,
- int len) override;
+ int read_memory (CORE_ADDR memaddr, unsigned char *myaddr, int len) override;
int write_memory (CORE_ADDR memaddr, const unsigned char *myaddr,
- int len) override;
+ int len) override;
void look_up_symbols () override;
@@ -179,13 +180,13 @@ public:
bool supports_read_auxv () override;
int read_auxv (int pid, CORE_ADDR offset, unsigned char *myaddr,
- unsigned int len) override;
+ unsigned int len) override;
- int insert_point (enum raw_bkpt_type type, CORE_ADDR addr,
- int size, raw_breakpoint *bp) override;
+ int insert_point (enum raw_bkpt_type type, CORE_ADDR addr, int size,
+ raw_breakpoint *bp) override;
- int remove_point (enum raw_bkpt_type type, CORE_ADDR addr,
- int size, raw_breakpoint *bp) override;
+ int remove_point (enum raw_bkpt_type type, CORE_ADDR addr, int size,
+ raw_breakpoint *bp) override;
bool stopped_by_sw_breakpoint () override;
@@ -208,19 +209,19 @@ public:
bool supports_get_tls_address () override;
int get_tls_address (thread_info *thread, CORE_ADDR offset,
- CORE_ADDR load_module, CORE_ADDR *address) override;
+ CORE_ADDR load_module, CORE_ADDR *address) override;
bool supports_qxfer_osdata () override;
int qxfer_osdata (const char *annex, unsigned char *readbuf,
- unsigned const char *writebuf,
- CORE_ADDR offset, int len) override;
+ unsigned const char *writebuf, CORE_ADDR offset,
+ int len) override;
bool supports_qxfer_siginfo () override;
int qxfer_siginfo (const char *annex, unsigned char *readbuf,
- unsigned const char *writebuf,
- CORE_ADDR offset, int len) override;
+ unsigned const char *writebuf, CORE_ADDR offset,
+ int len) override;
bool supports_non_stop () override;
@@ -245,8 +246,8 @@ public:
#if defined PT_GETDSBT || defined PTRACE_GETFDPIC
bool supports_read_loadmap () override;
- int read_loadmap (const char *annex, CORE_ADDR offset,
- unsigned char *myaddr, unsigned int len) override;
+ int read_loadmap (const char *annex, CORE_ADDR offset, unsigned char *myaddr,
+ unsigned int len) override;
#endif
CORE_ADDR read_pc (regcache *regcache) override;
@@ -267,10 +268,9 @@ public:
bool supports_qxfer_libraries_svr4 () override;
- int qxfer_libraries_svr4 (const char *annex,
- unsigned char *readbuf,
- unsigned const char *writebuf,
- CORE_ADDR offset, int len) override;
+ int qxfer_libraries_svr4 (const char *annex, unsigned char *readbuf,
+ unsigned const char *writebuf, CORE_ADDR offset,
+ int len) override;
bool supports_agent () override;
@@ -278,15 +278,14 @@ public:
bool supports_btrace () override;
btrace_target_info *enable_btrace (thread_info *tp,
- const btrace_config *conf) override;
+ const btrace_config *conf) override;
int disable_btrace (btrace_target_info *tinfo) override;
int read_btrace (btrace_target_info *tinfo, buffer *buf,
- enum btrace_read_type type) override;
+ enum btrace_read_type type) override;
- int read_btrace_conf (const btrace_target_info *tinfo,
- buffer *buf) override;
+ int read_btrace_conf (const btrace_target_info *tinfo, buffer *buf) override;
#endif
bool supports_range_stepping () override;
@@ -298,18 +297,18 @@ public:
bool supports_multifs () override;
int multifs_open (int pid, const char *filename, int flags,
- mode_t mode) override;
+ mode_t mode) override;
int multifs_unlink (int pid, const char *filename) override;
ssize_t multifs_readlink (int pid, const char *filename, char *buf,
- size_t bufsiz) override;
+ size_t bufsiz) override;
const char *thread_name (ptid_t thread) override;
#if USE_THREAD_DB
bool thread_handle (ptid_t ptid, gdb_byte **handle,
- int *handle_len) override;
+ int *handle_len) override;
#endif
thread_info *thread_pending_parent (thread_info *thread) override;
@@ -322,7 +321,6 @@ public:
virtual const regs_info *get_regs_info () = 0;
private:
-
/* Handle a GNU/Linux extended wait response. If we see a clone,
fork, or vfork event, we need to add the new LWP to our list
(and return 0 so as not to report the trap to higher layers).
@@ -344,7 +342,7 @@ private:
OPTIONS contains WNOHANG. Return -1 if no unwaited-for children
was found. Return the PID of the stopped child otherwise. */
int wait_for_event_filtered (ptid_t wait_ptid, ptid_t filter_ptid,
- int *wstatp, int options);
+ int *wstatp, int options);
/* Wait for an event from child(ren) PTID. PTIDs can be:
minus_one_ptid, to specify any child; a pid PTID, specifying all
@@ -360,7 +358,7 @@ private:
/* Wait for process, returns status. */
ptid_t wait_1 (ptid_t ptid, target_waitstatus *ourstatus,
- target_wait_flags target_options);
+ target_wait_flags target_options);
/* Stop all lwps that aren't stopped yet, except EXCEPT, if not NULL.
If SUSPEND, then also increase the suspend count of every LWP,
@@ -416,11 +414,11 @@ private:
#ifdef HAVE_LINUX_USRREGS
/* Fetch one register. */
void fetch_register (const usrregs_info *usrregs, regcache *regcache,
- int regno);
+ int regno);
/* Store one register. */
void store_register (const usrregs_info *usrregs, regcache *regcache,
- int regno);
+ int regno);
#endif
/* Fetch all registers, or just one, from the child process.
@@ -429,7 +427,7 @@ private:
unless ALL is non-zero.
Otherwise, REGNO specifies which register (so we can save time). */
void usr_fetch_inferior_registers (const regs_info *regs_info,
- regcache *regcache, int regno, int all);
+ regcache *regcache, int regno, int all);
/* Store our register values back into the inferior.
If REGNO is -1, do this for all registers, skipping any that are
@@ -437,7 +435,7 @@ private:
unless ALL is non-zero.
Otherwise, REGNO specifies which register (so we can save time). */
void usr_store_inferior_registers (const regs_info *regs_info,
- regcache *regcache, int regno, int all);
+ regcache *regcache, int regno, int all);
/* Return the PC as read from the regcache of LWP, without any
adjustment. */
@@ -453,7 +451,7 @@ private:
/* Resume execution of LWP. If STEP is nonzero, single-step it. If
SIGNAL is nonzero, give it that signal. */
void resume_one_lwp_throw (lwp_info *lwp, int step, int signal,
- siginfo_t *info);
+ siginfo_t *info);
/* Like resume_one_lwp_throw, but no error is thrown if the LWP
disappears while we try to resume it. */
@@ -512,7 +510,7 @@ private:
/* Single step via hardware or software single step.
Return 1 if hardware single stepping, 0 if software single stepping
or can't single step. */
- int single_step (lwp_info* lwp);
+ int single_step (lwp_info *lwp);
/* Return true if THREAD is doing hardware single step. */
bool maybe_hw_step (thread_info *thread);
@@ -539,7 +537,7 @@ private:
/* Convert a native/host siginfo object, into/from the siginfo in the
layout of the inferiors' architecture. */
void siginfo_fixup (siginfo_t *siginfo, gdb_byte *inf_siginfo,
- int direction);
+ int direction);
/* Add a process to the common process list, and set its private
data. */
@@ -550,7 +548,7 @@ private:
process_info *add_linux_process_no_mem_file (int pid, int attached);
/* Free resources associated to PROC and remove it. */
- void remove_linux_process (process_info *proc);
+ void remove_linux_process (process_info *proc);
/* Add a new thread. */
lwp_info *add_lwp (ptid_t ptid);
@@ -577,7 +575,7 @@ private: /* Back to private. */
process exit event, a thread exit event, or to suppress the
event. */
ptid_t filter_exit_event (lwp_info *event_child,
- target_waitstatus *ourstatus);
+ target_waitstatus *ourstatus);
/* Returns true if THREAD is stopped in a jump pad, and we can't
move it out, because we need to report the stop event to GDB. For
@@ -587,8 +585,9 @@ private: /* Back to private. */
/* Convenience wrapper. Returns information about LWP's fast tracepoint
collection status. */
- fast_tpoint_collect_result linux_fast_tracepoint_collecting
- (lwp_info *lwp, fast_tpoint_collect_status *status);
+ fast_tpoint_collect_result
+ linux_fast_tracepoint_collecting (lwp_info *lwp,
+ fast_tpoint_collect_status *status);
/* This function should only be called if LWP got a SYSCALL_SIGTRAP.
Fill *SYSNO with the syscall nr trapped. */
@@ -635,11 +634,11 @@ protected:
/* Breakpoint and watchpoint related functions. See target.h for
comments. */
- virtual int low_insert_point (raw_bkpt_type type, CORE_ADDR addr,
- int size, raw_breakpoint *bp);
+ virtual int low_insert_point (raw_bkpt_type type, CORE_ADDR addr, int size,
+ raw_breakpoint *bp);
- virtual int low_remove_point (raw_bkpt_type type, CORE_ADDR addr,
- int size, raw_breakpoint *bp);
+ virtual int low_remove_point (raw_bkpt_type type, CORE_ADDR addr, int size,
+ raw_breakpoint *bp);
virtual bool low_stopped_by_watchpoint ();
@@ -648,17 +647,17 @@ protected:
/* Hooks to reformat register data for PEEKUSR/POKEUSR (in particular
for registers smaller than an xfer unit). */
virtual void low_collect_ptrace_register (regcache *regcache, int regno,
- char *buf);
+ char *buf);
virtual void low_supply_ptrace_register (regcache *regcache, int regno,
- const char *buf);
+ const char *buf);
/* Hook to convert from target format to ptrace format and back.
Returns true if any conversion was done; false otherwise.
If DIRECTION is 1, then copy from INF to NATIVE.
If DIRECTION is 0, copy from NATIVE to INF. */
virtual bool low_siginfo_fixup (siginfo_t *native, gdb_byte *inf,
- int direction);
+ int direction);
/* Hook to call when a new process is created or attached to.
If extra per-process architecture-specific data is needed,
@@ -712,9 +711,7 @@ extern linux_process_target *the_linux_target;
struct pending_signal
{
- pending_signal (int signal)
- : signal {signal}
- {};
+ pending_signal (int signal) : signal { signal } {};
int signal;
siginfo_t info;
@@ -746,15 +743,14 @@ struct lwp_info
at most. So we can recognize who is the parent based on which one has
a pending status. */
gdb_assert (!!this->status_pending_p
- != !!this->fork_relative->status_pending_p);
+ != !!this->fork_relative->status_pending_p);
if (!this->fork_relative->status_pending_p)
return nullptr;
- const target_waitstatus &ws
- = this->fork_relative->waitstatus;
+ const target_waitstatus &ws = this->fork_relative->waitstatus;
gdb_assert (ws.kind () == TARGET_WAITKIND_FORKED
- || ws.kind () == TARGET_WAITKIND_VFORKED);
+ || ws.kind () == TARGET_WAITKIND_VFORKED);
return this->fork_relative;
}
@@ -773,14 +769,14 @@ struct lwp_info
at most. So we can recognize who is the parent based on which one has
a pending status. */
gdb_assert (!!this->status_pending_p
- != !!this->fork_relative->status_pending_p);
+ != !!this->fork_relative->status_pending_p);
if (!this->status_pending_p)
return nullptr;
const target_waitstatus &ws = this->waitstatus;
gdb_assert (ws.kind () == TARGET_WAITKIND_FORKED
- || ws.kind () == TARGET_WAITKIND_VFORKED);
+ || ws.kind () == TARGET_WAITKIND_VFORKED);
return this->fork_relative;
}
@@ -858,7 +854,7 @@ struct lwp_info
passed along the last resume request. See 'struct
thread_resume'. */
CORE_ADDR step_range_start = 0; /* Inclusive */
- CORE_ADDR step_range_end = 0; /* Exclusive */
+ CORE_ADDR step_range_end = 0; /* Exclusive */
/* If this flag is set, we need to set the event request flags the
next time we see this LWP stop. */
@@ -928,14 +924,15 @@ void thread_db_detach (struct process_info *);
void thread_db_mourn (struct process_info *);
int thread_db_handle_monitor_command (char *);
int thread_db_get_tls_address (struct thread_info *thread, CORE_ADDR offset,
- CORE_ADDR load_module, CORE_ADDR *address);
+ CORE_ADDR load_module, CORE_ADDR *address);
int thread_db_look_up_one_symbol (const char *name, CORE_ADDR *addrp);
/* Called from linux-low.c when a clone event is detected. Upon entry,
both the clone and the parent should be stopped. This function does
whatever is required have the clone under thread_db's control. */
-void thread_db_notice_clone (struct thread_info *parent_thr, ptid_t child_ptid);
+void thread_db_notice_clone (struct thread_info *parent_thr,
+ ptid_t child_ptid);
bool thread_db_thread_handle (ptid_t ptid, gdb_byte **handle, int *handle_len);
diff --git a/gdbserver/linux-m68k-low.cc b/gdbserver/linux-m68k-low.cc
index 6094fd914f5..e336e1da8f9 100644
--- a/gdbserver/linux-m68k-low.cc
+++ b/gdbserver/linux-m68k-low.cc
@@ -24,13 +24,11 @@
class m68k_target : public linux_process_target
{
public:
-
const regs_info *get_regs_info () override;
const gdb_byte *sw_breakpoint_from_kind (int kind, int *size) override;
protected:
-
void low_arch_setup () override;
bool low_cannot_fetch_register (int regno) override;
@@ -88,26 +86,21 @@ extern const struct target_desc *tdesc_m68k;
#define m68k_num_gregs 18
/* This table must line up with REGISTER_NAMES in tm-m68k.h */
-static int m68k_regmap[] =
-{
+static int m68k_regmap[] = {
#ifdef PT_D0
- PT_D0 * 4, PT_D1 * 4, PT_D2 * 4, PT_D3 * 4,
- PT_D4 * 4, PT_D5 * 4, PT_D6 * 4, PT_D7 * 4,
- PT_A0 * 4, PT_A1 * 4, PT_A2 * 4, PT_A3 * 4,
- PT_A4 * 4, PT_A5 * 4, PT_A6 * 4, PT_USP * 4,
- PT_SR * 4, PT_PC * 4,
+ PT_D0 * 4, PT_D1 * 4, PT_D2 * 4, PT_D3 * 4, PT_D4 * 4, PT_D5 * 4,
+ PT_D6 * 4, PT_D7 * 4, PT_A0 * 4, PT_A1 * 4, PT_A2 * 4, PT_A3 * 4,
+ PT_A4 * 4, PT_A5 * 4, PT_A6 * 4, PT_USP * 4, PT_SR * 4, PT_PC * 4,
#else
- 14 * 4, 0 * 4, 1 * 4, 2 * 4, 3 * 4, 4 * 4, 5 * 4, 6 * 4,
- 7 * 4, 8 * 4, 9 * 4, 10 * 4, 11 * 4, 12 * 4, 13 * 4, 15 * 4,
- 17 * 4, 18 * 4,
+ 14 * 4, 0 * 4, 1 * 4, 2 * 4, 3 * 4, 4 * 4, 5 * 4, 6 * 4, 7 * 4,
+ 8 * 4, 9 * 4, 10 * 4, 11 * 4, 12 * 4, 13 * 4, 15 * 4, 17 * 4, 18 * 4,
#endif
#ifdef PT_FP0
- PT_FP0 * 4, PT_FP1 * 4, PT_FP2 * 4, PT_FP3 * 4,
- PT_FP4 * 4, PT_FP5 * 4, PT_FP6 * 4, PT_FP7 * 4,
- PT_FPCR * 4, PT_FPSR * 4, PT_FPIAR * 4
+ PT_FP0 * 4, PT_FP1 * 4, PT_FP2 * 4, PT_FP3 * 4, PT_FP4 * 4, PT_FP5 * 4,
+ PT_FP6 * 4, PT_FP7 * 4, PT_FPCR * 4, PT_FPSR * 4, PT_FPIAR * 4
#else
- 21 * 4, 24 * 4, 27 * 4, 30 * 4, 33 * 4, 36 * 4,
- 39 * 4, 42 * 4, 45 * 4, 46 * 4, 47 * 4
+ 21 * 4, 24 * 4, 27 * 4, 30 * 4, 33 * 4, 36 * 4, 39 * 4, 42 * 4, 45 * 4,
+ 46 * 4, 47 * 4
#endif
};
@@ -151,8 +144,9 @@ m68k_fill_fpregset (struct regcache *regcache, void *buf)
int i;
for (i = m68k_num_gregs; i < m68k_num_regs; i++)
- collect_register (regcache, i, ((char *) buf
- + (m68k_regmap[i] - m68k_regmap[m68k_num_gregs])));
+ collect_register (regcache, i,
+ ((char *) buf
+ + (m68k_regmap[i] - m68k_regmap[m68k_num_gregs])));
}
static void
@@ -161,19 +155,18 @@ m68k_store_fpregset (struct regcache *regcache, const void *buf)
int i;
for (i = m68k_num_gregs; i < m68k_num_regs; i++)
- supply_register (regcache, i, ((const char *) buf
- + (m68k_regmap[i] - m68k_regmap[m68k_num_gregs])));
+ supply_register (regcache, i,
+ ((const char *) buf
+ + (m68k_regmap[i] - m68k_regmap[m68k_num_gregs])));
}
#endif /* HAVE_PTRACE_GETREGS */
static struct regset_info m68k_regsets[] = {
#ifdef HAVE_PTRACE_GETREGS
- { PTRACE_GETREGS, PTRACE_SETREGS, 0, sizeof (elf_gregset_t),
- GENERAL_REGS,
+ { PTRACE_GETREGS, PTRACE_SETREGS, 0, sizeof (elf_gregset_t), GENERAL_REGS,
m68k_fill_gregset, m68k_store_gregset },
- { PTRACE_GETFPREGS, PTRACE_SETFPREGS, 0, sizeof (elf_fpregset_t),
- FP_REGS,
+ { PTRACE_GETFPREGS, PTRACE_SETFPREGS, 0, sizeof (elf_fpregset_t), FP_REGS,
m68k_fill_fpregset, m68k_store_fpregset },
#endif /* HAVE_PTRACE_GETREGS */
NULL_REGSET
@@ -209,8 +202,8 @@ m68k_target::low_breakpoint_at (CORE_ADDR pc)
/* Fetch the thread-local storage pointer for libthread_db. */
ps_err_e
-ps_get_thread_area (struct ps_prochandle *ph,
- lwpid_t lwpid, int idx, void **base)
+ps_get_thread_area (struct ps_prochandle *ph, lwpid_t lwpid, int idx,
+ void **base)
{
if (ptrace (PTRACE_GET_THREAD_AREA, lwpid, NULL, base) != 0)
return PS_ERR;
@@ -218,31 +211,26 @@ ps_get_thread_area (struct ps_prochandle *ph,
/* IDX is the bias from the thread pointer to the beginning of the
thread descriptor. It has to be subtracted due to implementation
quirks in libthread_db. */
- *base = (void *) ((char *)*base - idx);
+ *base = (void *) ((char *) *base - idx);
return PS_OK;
}
#endif /* PTRACE_GET_THREAD_AREA */
-static struct regsets_info m68k_regsets_info =
- {
- m68k_regsets, /* regsets */
- 0, /* num_regsets */
- NULL, /* disabled_regsets */
- };
-
-static struct usrregs_info m68k_usrregs_info =
- {
- m68k_num_regs,
- m68k_regmap,
- };
-
-static struct regs_info myregs_info =
- {
- NULL, /* regset_bitmap */
- &m68k_usrregs_info,
- &m68k_regsets_info
- };
+static struct regsets_info m68k_regsets_info = {
+ m68k_regsets, /* regsets */
+ 0, /* num_regsets */
+ NULL, /* disabled_regsets */
+};
+
+static struct usrregs_info m68k_usrregs_info = {
+ m68k_num_regs,
+ m68k_regmap,
+};
+
+static struct regs_info myregs_info
+ = { NULL, /* regset_bitmap */
+ &m68k_usrregs_info, &m68k_regsets_info };
const regs_info *
m68k_target::get_regs_info ()
diff --git a/gdbserver/linux-mips-low.cc b/gdbserver/linux-mips-low.cc
index 2cbe52214d3..35a83b71ab1 100644
--- a/gdbserver/linux-mips-low.cc
+++ b/gdbserver/linux-mips-low.cc
@@ -30,7 +30,6 @@
class mips_target : public linux_process_target
{
public:
-
const regs_info *get_regs_info () override;
const gdb_byte *sw_breakpoint_from_kind (int kind, int *size) override;
@@ -38,7 +37,6 @@ public:
bool supports_z_point_type (char z_type) override;
protected:
-
void low_arch_setup () override;
bool low_cannot_fetch_register (int regno) override;
@@ -55,21 +53,21 @@ protected:
bool low_breakpoint_at (CORE_ADDR pc) override;
- int low_insert_point (raw_bkpt_type type, CORE_ADDR addr,
- int size, raw_breakpoint *bp) override;
+ int low_insert_point (raw_bkpt_type type, CORE_ADDR addr, int size,
+ raw_breakpoint *bp) override;
- int low_remove_point (raw_bkpt_type type, CORE_ADDR addr,
- int size, raw_breakpoint *bp) override;
+ int low_remove_point (raw_bkpt_type type, CORE_ADDR addr, int size,
+ raw_breakpoint *bp) override;
bool low_stopped_by_watchpoint () override;
CORE_ADDR low_stopped_data_address () override;
void low_collect_ptrace_register (regcache *regcache, int regno,
- char *buf) override;
+ char *buf) override;
void low_supply_ptrace_register (regcache *regcache, int regno,
- const char *buf) override;
+ const char *buf) override;
arch_process_info *low_new_process () override;
@@ -138,46 +136,35 @@ union mips_register
/* Return the ptrace ``address'' of register REGNO. */
-#define mips_base_regs \
- -1, 1, 2, 3, 4, 5, 6, 7, \
- 8, 9, 10, 11, 12, 13, 14, 15, \
- 16, 17, 18, 19, 20, 21, 22, 23, \
- 24, 25, 26, 27, 28, 29, 30, 31, \
- \
- -1, MMLO, MMHI, BADVADDR, CAUSE, PC, \
- \
- FPR_BASE, FPR_BASE + 1, FPR_BASE + 2, FPR_BASE + 3, \
- FPR_BASE + 4, FPR_BASE + 5, FPR_BASE + 6, FPR_BASE + 7, \
- FPR_BASE + 8, FPR_BASE + 9, FPR_BASE + 10, FPR_BASE + 11, \
- FPR_BASE + 12, FPR_BASE + 13, FPR_BASE + 14, FPR_BASE + 15, \
- FPR_BASE + 16, FPR_BASE + 17, FPR_BASE + 18, FPR_BASE + 19, \
- FPR_BASE + 20, FPR_BASE + 21, FPR_BASE + 22, FPR_BASE + 23, \
- FPR_BASE + 24, FPR_BASE + 25, FPR_BASE + 26, FPR_BASE + 27, \
- FPR_BASE + 28, FPR_BASE + 29, FPR_BASE + 30, FPR_BASE + 31, \
- FPC_CSR, FPC_EIR
-
-#define mips_dsp_regs \
- DSP_BASE, DSP_BASE + 1, DSP_BASE + 2, DSP_BASE + 3, \
- DSP_BASE + 4, DSP_BASE + 5, \
- DSP_CONTROL
-
-static int mips_regmap[mips_num_regs] = {
- mips_base_regs,
- 0
-};
-
-static int mips_dsp_regmap[mips_dsp_num_regs] = {
- mips_base_regs,
- mips_dsp_regs,
- 0
-};
+#define mips_base_regs \
+ -1, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, \
+ 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, \
+ \
+ -1, MMLO, MMHI, BADVADDR, CAUSE, PC, \
+ \
+ FPR_BASE, FPR_BASE + 1, FPR_BASE + 2, FPR_BASE + 3, FPR_BASE + 4, \
+ FPR_BASE + 5, FPR_BASE + 6, FPR_BASE + 7, FPR_BASE + 8, FPR_BASE + 9, \
+ FPR_BASE + 10, FPR_BASE + 11, FPR_BASE + 12, FPR_BASE + 13, \
+ FPR_BASE + 14, FPR_BASE + 15, FPR_BASE + 16, FPR_BASE + 17, \
+ FPR_BASE + 18, FPR_BASE + 19, FPR_BASE + 20, FPR_BASE + 21, \
+ FPR_BASE + 22, FPR_BASE + 23, FPR_BASE + 24, FPR_BASE + 25, \
+ FPR_BASE + 26, FPR_BASE + 27, FPR_BASE + 28, FPR_BASE + 29, \
+ FPR_BASE + 30, FPR_BASE + 31, FPC_CSR, FPC_EIR
+
+#define mips_dsp_regs \
+ DSP_BASE, DSP_BASE + 1, DSP_BASE + 2, DSP_BASE + 3, DSP_BASE + 4, \
+ DSP_BASE + 5, DSP_CONTROL
+
+static int mips_regmap[mips_num_regs] = { mips_base_regs, 0 };
+
+static int mips_dsp_regmap[mips_dsp_num_regs]
+ = { mips_base_regs, mips_dsp_regs, 0 };
/* DSP registers are not in any regset and can only be accessed
individually. */
-static unsigned char mips_dsp_regset_bitmap[(mips_dsp_num_regs + 7) / 8] = {
- 0xfe, 0xff, 0xff, 0xff, 0xfe, 0xff, 0xff, 0xff, 0xff, 0x80
-};
+static unsigned char mips_dsp_regset_bitmap[(mips_dsp_num_regs + 7) / 8]
+ = { 0xfe, 0xff, 0xff, 0xff, 0xfe, 0xff, 0xff, 0xff, 0xff, 0x80 };
static int have_dsp = -1;
@@ -194,17 +181,17 @@ mips_read_description (void)
errno = 0;
ptrace (PTRACE_PEEKUSER, pid, DSP_CONTROL, 0);
switch (errno)
- {
- case 0:
- have_dsp = 1;
- break;
- case EIO:
- have_dsp = 0;
- break;
- default:
- perror_with_name ("ptrace");
- break;
- }
+ {
+ case 0:
+ have_dsp = 1;
+ break;
+ case EIO:
+ have_dsp = 0;
+ break;
+ default:
+ perror_with_name ("ptrace");
+ break;
+ }
}
return have_dsp ? tdesc_mips_dsp_linux : tdesc_mips_linux;
@@ -435,7 +422,7 @@ mips_target::low_delete_thread (arch_lwp_info *arch_lwp)
static void
mips_add_watchpoint (struct arch_process_info *priv, CORE_ADDR addr, int len,
- enum target_hw_bp_type watch_type)
+ enum target_hw_bp_type watch_type)
{
struct mips_watchpoint *new_watch;
struct mips_watchpoint **pw;
@@ -455,18 +442,15 @@ mips_add_watchpoint (struct arch_process_info *priv, CORE_ADDR addr, int len,
/* Hook to call when a new fork is attached. */
void
-mips_target::low_new_fork (process_info *parent,
- process_info *child)
+mips_target::low_new_fork (process_info *parent, process_info *child)
{
struct arch_process_info *parent_private;
struct arch_process_info *child_private;
struct mips_watchpoint *wp;
/* These are allocated by linux_add_process. */
- gdb_assert (parent->priv != NULL
- && parent->priv->arch_private != NULL);
- gdb_assert (child->priv != NULL
- && child->priv->arch_private != NULL);
+ gdb_assert (parent->priv != NULL && parent->priv->arch_private != NULL);
+ gdb_assert (child->priv != NULL && child->priv->arch_private != NULL);
/* Linux kernel before 2.6.33 commit
72f674d203cd230426437cdcf7dd6f681dad8b0d
@@ -509,14 +493,15 @@ mips_target::low_prepare_to_resume (lwp_info *lwp)
/* Only update the watch registers if we have set or unset a
watchpoint already. */
if (mips_linux_watch_get_num_valid (&priv->watch_mirror) > 0)
- {
- /* Write the mirrored watch register values. */
- int tid = ptid.lwp ();
+ {
+ /* Write the mirrored watch register values. */
+ int tid = ptid.lwp ();
- if (-1 == ptrace (PTRACE_SET_WATCH_REGS, tid,
- &priv->watch_mirror, NULL))
- perror_with_name ("Couldn't write watch register");
- }
+ if (-1
+ == ptrace (PTRACE_SET_WATCH_REGS, tid, &priv->watch_mirror,
+ NULL))
+ perror_with_name ("Couldn't write watch register");
+ }
lwp->arch_private->watch_registers_changed = 0;
}
@@ -540,8 +525,8 @@ mips_target::supports_z_point_type (char z_type)
low_insert_point. */
int
-mips_target::low_insert_point (raw_bkpt_type type, CORE_ADDR addr,
- int len, raw_breakpoint *bp)
+mips_target::low_insert_point (raw_bkpt_type type, CORE_ADDR addr, int len,
+ raw_breakpoint *bp)
{
struct process_info *proc = current_process ();
struct arch_process_info *priv = proc->priv->arch_private;
@@ -551,10 +536,8 @@ mips_target::low_insert_point (raw_bkpt_type type, CORE_ADDR addr,
uint32_t irw;
lwpid = lwpid_of (current_thread);
- if (!mips_linux_read_watch_registers (lwpid,
- &priv->watch_readback,
- &priv->watch_readback_valid,
- 0))
+ if (!mips_linux_read_watch_registers (lwpid, &priv->watch_readback,
+ &priv->watch_readback_valid, 0))
return -1;
if (len <= 0)
@@ -585,8 +568,8 @@ mips_target::low_insert_point (raw_bkpt_type type, CORE_ADDR addr,
low_remove_point. */
int
-mips_target::low_remove_point (raw_bkpt_type type, CORE_ADDR addr,
- int len, raw_breakpoint *bp)
+mips_target::low_remove_point (raw_bkpt_type type, CORE_ADDR addr, int len,
+ raw_breakpoint *bp)
{
struct process_info *proc = current_process ();
struct arch_process_info *priv = proc->priv->arch_private;
@@ -604,25 +587,24 @@ mips_target::low_remove_point (raw_bkpt_type type, CORE_ADDR addr,
while ((w = *pw))
{
if (w->addr == addr && w->len == len && w->type == watch_type)
- {
- *pw = w->next;
- free (w);
- deleted_one = 1;
- break;
- }
+ {
+ *pw = w->next;
+ free (w);
+ deleted_one = 1;
+ break;
+ }
pw = &(w->next);
}
if (!deleted_one)
- return -1; /* We don't know about it, fail doing nothing. */
+ return -1; /* We don't know about it, fail doing nothing. */
/* At this point watch_readback is known to be valid because we
could not have added the watch without reading it. */
gdb_assert (priv->watch_readback_valid == 1);
priv->watch_mirror = priv->watch_readback;
- mips_linux_watch_populate_regs (priv->current_watches,
- &priv->watch_mirror);
+ mips_linux_watch_populate_regs (priv->current_watches, &priv->watch_mirror);
/* Only update the threads of this process. */
for_each_thread (proc->pid, update_watch_registers_callback);
@@ -643,17 +625,15 @@ mips_target::low_stopped_by_watchpoint ()
int num_valid;
long lwpid = lwpid_of (current_thread);
- if (!mips_linux_read_watch_registers (lwpid,
- &priv->watch_readback,
- &priv->watch_readback_valid,
- 1))
+ if (!mips_linux_read_watch_registers (lwpid, &priv->watch_readback,
+ &priv->watch_readback_valid, 1))
return 0;
num_valid = mips_linux_watch_get_num_valid (&priv->watch_readback);
for (n = 0; n < MAX_DEBUG_REGISTER && n < num_valid; n++)
if (mips_linux_watch_get_watchhi (&priv->watch_readback, n)
- & (R_MASK | W_MASK))
+ & (R_MASK | W_MASK))
return true;
return false;
@@ -677,44 +657,40 @@ mips_target::low_stopped_data_address ()
address of a watchpoint request which overlaps the one that
triggered. */
- if (!mips_linux_read_watch_registers (lwpid,
- &priv->watch_readback,
- &priv->watch_readback_valid,
- 0))
+ if (!mips_linux_read_watch_registers (lwpid, &priv->watch_readback,
+ &priv->watch_readback_valid, 0))
return 0;
num_valid = mips_linux_watch_get_num_valid (&priv->watch_readback);
for (n = 0; n < MAX_DEBUG_REGISTER && n < num_valid; n++)
if (mips_linux_watch_get_watchhi (&priv->watch_readback, n)
- & (R_MASK | W_MASK))
+ & (R_MASK | W_MASK))
{
- CORE_ADDR t_low, t_hi;
- int t_irw;
- struct mips_watchpoint *watch;
-
- t_low = mips_linux_watch_get_watchlo (&priv->watch_readback, n);
- t_irw = t_low & IRW_MASK;
- t_hi = (mips_linux_watch_get_watchhi (&priv->watch_readback, n)
- | IRW_MASK);
- t_low &= ~(CORE_ADDR)t_hi;
-
- for (watch = priv->current_watches;
- watch != NULL;
- watch = watch->next)
- {
- CORE_ADDR addr = watch->addr;
- CORE_ADDR last_byte = addr + watch->len - 1;
-
- if ((t_irw & mips_linux_watch_type_to_irw (watch->type)) == 0)
- {
- /* Different type. */
- continue;
- }
- /* Check for overlap of even a single byte. */
- if (last_byte >= t_low && addr <= t_low + t_hi)
- return addr;
- }
+ CORE_ADDR t_low, t_hi;
+ int t_irw;
+ struct mips_watchpoint *watch;
+
+ t_low = mips_linux_watch_get_watchlo (&priv->watch_readback, n);
+ t_irw = t_low & IRW_MASK;
+ t_hi = (mips_linux_watch_get_watchhi (&priv->watch_readback, n)
+ | IRW_MASK);
+ t_low &= ~(CORE_ADDR) t_hi;
+
+ for (watch = priv->current_watches; watch != NULL; watch = watch->next)
+ {
+ CORE_ADDR addr = watch->addr;
+ CORE_ADDR last_byte = addr + watch->len - 1;
+
+ if ((t_irw & mips_linux_watch_type_to_irw (watch->type)) == 0)
+ {
+ /* Different type. */
+ continue;
+ }
+ /* Check for overlap of even a single byte. */
+ if (last_byte >= t_low && addr <= t_low + t_hi)
+ return addr;
+ }
}
/* Shouldn't happen. */
@@ -724,8 +700,8 @@ mips_target::low_stopped_data_address ()
/* Fetch the thread-local storage pointer for libthread_db. */
ps_err_e
-ps_get_thread_area (struct ps_prochandle *ph,
- lwpid_t lwpid, int idx, void **base)
+ps_get_thread_area (struct ps_prochandle *ph, lwpid_t lwpid, int idx,
+ void **base)
{
if (ptrace (PTRACE_GET_THREAD_AREA, lwpid, NULL, base) != 0)
return PS_ERR;
@@ -733,14 +709,14 @@ ps_get_thread_area (struct ps_prochandle *ph,
/* IDX is the bias from the thread pointer to the beginning of the
thread descriptor. It has to be subtracted due to implementation
quirks in libthread_db. */
- *base = (void *) ((char *)*base - idx);
+ *base = (void *) ((char *) *base - idx);
return PS_OK;
}
static void
-mips_collect_register (struct regcache *regcache,
- int use_64bit, int regno, union mips_register *reg)
+mips_collect_register (struct regcache *regcache, int use_64bit, int regno,
+ union mips_register *reg)
{
union mips_register tmp_reg;
@@ -757,8 +733,8 @@ mips_collect_register (struct regcache *regcache,
}
static void
-mips_supply_register (struct regcache *regcache,
- int use_64bit, int regno, const union mips_register *reg)
+mips_supply_register (struct regcache *regcache, int use_64bit, int regno,
+ const union mips_register *reg)
{
int offset = 0;
@@ -773,8 +749,8 @@ mips_supply_register (struct regcache *regcache,
#ifdef HAVE_PTRACE_GETREGS
static void
-mips_collect_register_32bit (struct regcache *regcache,
- int use_64bit, int regno, unsigned char *buf)
+mips_collect_register_32bit (struct regcache *regcache, int use_64bit,
+ int regno, unsigned char *buf)
{
union mips_register tmp_reg;
int reg32;
@@ -785,8 +761,8 @@ mips_collect_register_32bit (struct regcache *regcache,
}
static void
-mips_supply_register_32bit (struct regcache *regcache,
- int use_64bit, int regno, const unsigned char *buf)
+mips_supply_register_32bit (struct regcache *regcache, int use_64bit,
+ int regno, const unsigned char *buf)
{
union mips_register tmp_reg;
int reg32;
@@ -808,21 +784,21 @@ mips_fill_gregset (struct regcache *regcache, void *buf)
for (i = 1; i < 32; i++)
mips_collect_register (regcache, use_64bit, i, regset + i);
- mips_collect_register (regcache, use_64bit,
- find_regno (tdesc, "lo"), regset + 32);
- mips_collect_register (regcache, use_64bit,
- find_regno (tdesc, "hi"), regset + 33);
- mips_collect_register (regcache, use_64bit,
- find_regno (tdesc, "pc"), regset + 34);
- mips_collect_register (regcache, use_64bit,
- find_regno (tdesc, "badvaddr"), regset + 35);
- mips_collect_register (regcache, use_64bit,
- find_regno (tdesc, "status"), regset + 36);
- mips_collect_register (regcache, use_64bit,
- find_regno (tdesc, "cause"), regset + 37);
+ mips_collect_register (regcache, use_64bit, find_regno (tdesc, "lo"),
+ regset + 32);
+ mips_collect_register (regcache, use_64bit, find_regno (tdesc, "hi"),
+ regset + 33);
+ mips_collect_register (regcache, use_64bit, find_regno (tdesc, "pc"),
+ regset + 34);
+ mips_collect_register (regcache, use_64bit, find_regno (tdesc, "badvaddr"),
+ regset + 35);
+ mips_collect_register (regcache, use_64bit, find_regno (tdesc, "status"),
+ regset + 36);
+ mips_collect_register (regcache, use_64bit, find_regno (tdesc, "cause"),
+ regset + 37);
- mips_collect_register (regcache, use_64bit,
- find_regno (tdesc, "restart"), regset + 0);
+ mips_collect_register (regcache, use_64bit, find_regno (tdesc, "restart"),
+ regset + 0);
}
static void
@@ -839,20 +815,20 @@ mips_store_gregset (struct regcache *regcache, const void *buf)
mips_supply_register (regcache, use_64bit, i, regset + i);
mips_supply_register (regcache, use_64bit,
- find_regno (regcache->tdesc, "lo"), regset + 32);
+ find_regno (regcache->tdesc, "lo"), regset + 32);
mips_supply_register (regcache, use_64bit,
- find_regno (regcache->tdesc, "hi"), regset + 33);
+ find_regno (regcache->tdesc, "hi"), regset + 33);
mips_supply_register (regcache, use_64bit,
- find_regno (regcache->tdesc, "pc"), regset + 34);
+ find_regno (regcache->tdesc, "pc"), regset + 34);
mips_supply_register (regcache, use_64bit,
- find_regno (regcache->tdesc, "badvaddr"), regset + 35);
+ find_regno (regcache->tdesc, "badvaddr"), regset + 35);
mips_supply_register (regcache, use_64bit,
- find_regno (regcache->tdesc, "status"), regset + 36);
+ find_regno (regcache->tdesc, "status"), regset + 36);
mips_supply_register (regcache, use_64bit,
- find_regno (regcache->tdesc, "cause"), regset + 37);
+ find_regno (regcache->tdesc, "cause"), regset + 37);
mips_supply_register (regcache, use_64bit,
- find_regno (regcache->tdesc, "restart"), regset + 0);
+ find_regno (regcache->tdesc, "restart"), regset + 0);
}
static void
@@ -871,13 +847,14 @@ mips_fill_fpregset (struct regcache *regcache, void *buf)
collect_register (regcache, first_fp + i, regset[i].buf);
else
collect_register (regcache, first_fp + i,
- regset[i & ~1].buf + 4 * (big_endian != (i & 1)));
+ regset[i & ~1].buf + 4 * (big_endian != (i & 1)));
mips_collect_register_32bit (regcache, use_64bit,
- find_regno (regcache->tdesc, "fcsr"), regset[32].buf);
+ find_regno (regcache->tdesc, "fcsr"),
+ regset[32].buf);
mips_collect_register_32bit (regcache, use_64bit,
- find_regno (regcache->tdesc, "fir"),
- regset[32].buf + 4);
+ find_regno (regcache->tdesc, "fir"),
+ regset[32].buf + 4);
}
static void
@@ -896,14 +873,14 @@ mips_store_fpregset (struct regcache *regcache, const void *buf)
supply_register (regcache, first_fp + i, regset[i].buf);
else
supply_register (regcache, first_fp + i,
- regset[i & ~1].buf + 4 * (big_endian != (i & 1)));
+ regset[i & ~1].buf + 4 * (big_endian != (i & 1)));
mips_supply_register_32bit (regcache, use_64bit,
- find_regno (regcache->tdesc, "fcsr"),
- regset[32].buf);
+ find_regno (regcache->tdesc, "fcsr"),
+ regset[32].buf);
mips_supply_register_32bit (regcache, use_64bit,
- find_regno (regcache->tdesc, "fir"),
- regset[32].buf + 4);
+ find_regno (regcache->tdesc, "fir"),
+ regset[32].buf + 4);
}
#endif /* HAVE_PTRACE_GETREGS */
@@ -911,7 +888,7 @@ mips_store_fpregset (struct regcache *regcache, const void *buf)
void
mips_target::low_collect_ptrace_register (regcache *regcache, int regno,
- char *buf)
+ char *buf)
{
int use_64bit = sizeof (PTRACE_XFER_TYPE) == 8;
@@ -930,7 +907,7 @@ mips_target::low_collect_ptrace_register (regcache *regcache, int regno,
void
mips_target::low_supply_ptrace_register (regcache *regcache, int regno,
- const char *buf)
+ const char *buf)
{
int use_64bit = sizeof (PTRACE_XFER_TYPE) == 8;
@@ -947,46 +924,36 @@ mips_target::low_supply_ptrace_register (regcache *regcache, int regno,
static struct regset_info mips_regsets[] = {
#ifdef HAVE_PTRACE_GETREGS
- { PTRACE_GETREGS, PTRACE_SETREGS, 0, 38 * 8, GENERAL_REGS,
- mips_fill_gregset, mips_store_gregset },
- { PTRACE_GETFPREGS, PTRACE_SETFPREGS, 0, 33 * 8, FP_REGS,
- mips_fill_fpregset, mips_store_fpregset },
+ { PTRACE_GETREGS, PTRACE_SETREGS, 0, 38 * 8, GENERAL_REGS, mips_fill_gregset,
+ mips_store_gregset },
+ { PTRACE_GETFPREGS, PTRACE_SETFPREGS, 0, 33 * 8, FP_REGS, mips_fill_fpregset,
+ mips_store_fpregset },
#endif /* HAVE_PTRACE_GETREGS */
NULL_REGSET
};
-static struct regsets_info mips_regsets_info =
- {
- mips_regsets, /* regsets */
- 0, /* num_regsets */
- NULL, /* disabled_regsets */
- };
-
-static struct usrregs_info mips_dsp_usrregs_info =
- {
- mips_dsp_num_regs,
- mips_dsp_regmap,
- };
-
-static struct usrregs_info mips_usrregs_info =
- {
- mips_num_regs,
- mips_regmap,
- };
-
-static struct regs_info dsp_regs_info =
- {
- mips_dsp_regset_bitmap,
- &mips_dsp_usrregs_info,
- &mips_regsets_info
- };
-
-static struct regs_info myregs_info =
- {
- NULL, /* regset_bitmap */
- &mips_usrregs_info,
- &mips_regsets_info
- };
+static struct regsets_info mips_regsets_info = {
+ mips_regsets, /* regsets */
+ 0, /* num_regsets */
+ NULL, /* disabled_regsets */
+};
+
+static struct usrregs_info mips_dsp_usrregs_info = {
+ mips_dsp_num_regs,
+ mips_dsp_regmap,
+};
+
+static struct usrregs_info mips_usrregs_info = {
+ mips_num_regs,
+ mips_regmap,
+};
+
+static struct regs_info dsp_regs_info
+ = { mips_dsp_regset_bitmap, &mips_dsp_usrregs_info, &mips_regsets_info };
+
+static struct regs_info myregs_info
+ = { NULL, /* regset_bitmap */
+ &mips_usrregs_info, &mips_regsets_info };
const regs_info *
mips_target::get_regs_info ()
diff --git a/gdbserver/linux-nios2-low.cc b/gdbserver/linux-nios2-low.cc
index 448a2ef5025..4ebe4473753 100644
--- a/gdbserver/linux-nios2-low.cc
+++ b/gdbserver/linux-nios2-low.cc
@@ -36,13 +36,11 @@
class nios2_target : public linux_process_target
{
public:
-
const regs_info *get_regs_info () override;
const gdb_byte *sw_breakpoint_from_kind (int kind, int *size) override;
protected:
-
void low_arch_setup () override;
bool low_cannot_fetch_register (int regno) override;
@@ -103,16 +101,10 @@ union nios2_register
/* Return the ptrace ``address'' of register REGNO. */
-static int nios2_regmap[] = {
- -1, 1, 2, 3, 4, 5, 6, 7,
- 8, 9, 10, 11, 12, 13, 14, 15,
- 16, 17, 18, 19, 20, 21, 22, 23,
- 24, 25, 26, 27, 28, 29, 30, 31,
- 32, 33, 34, 35, 36, 37, 38, 39,
- 40, 41, 42, 43, 44, 45, 46, 47,
- 48,
- 0
-};
+static int nios2_regmap[]
+ = { -1, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16,
+ 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33,
+ 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 0 };
/* Implement the low_arch_setup linux target ops method. */
@@ -188,8 +180,8 @@ nios2_target::low_breakpoint_at (CORE_ADDR where)
/* Fetch the thread-local storage pointer for libthread_db. */
ps_err_e
-ps_get_thread_area (struct ps_prochandle *ph,
- lwpid_t lwpid, int idx, void **base)
+ps_get_thread_area (struct ps_prochandle *ph, lwpid_t lwpid, int idx,
+ void **base)
{
if (ptrace (PTRACE_GET_THREAD_AREA, lwpid, NULL, base) != 0)
return PS_ERR;
@@ -206,7 +198,7 @@ ps_get_thread_area (struct ps_prochandle *ph,
static void
nios2_collect_register (struct regcache *regcache, int regno,
- union nios2_register *reg)
+ union nios2_register *reg)
{
union nios2_register tmp_reg;
@@ -216,7 +208,7 @@ nios2_collect_register (struct regcache *regcache, int regno,
static void
nios2_supply_register (struct regcache *regcache, int regno,
- const union nios2_register *reg)
+ const union nios2_register *reg)
{
supply_register (regcache, regno, reg->buf);
}
@@ -243,33 +235,25 @@ nios2_store_gregset (struct regcache *regcache, const void *buf)
nios2_supply_register (regcache, i, regset + i);
}
-static struct regset_info nios2_regsets[] =
-{
- { PTRACE_GETREGSET, PTRACE_SETREGSET, NT_PRSTATUS,
- nios2_num_regs * 4, GENERAL_REGS,
- nios2_fill_gregset, nios2_store_gregset },
- NULL_REGSET
+static struct regset_info nios2_regsets[]
+ = { { PTRACE_GETREGSET, PTRACE_SETREGSET, NT_PRSTATUS, nios2_num_regs * 4,
+ GENERAL_REGS, nios2_fill_gregset, nios2_store_gregset },
+ NULL_REGSET };
+
+static struct regsets_info nios2_regsets_info = {
+ nios2_regsets, /* regsets */
+ 0, /* num_regsets */
+ NULL, /* disabled_regsets */
+};
+
+static struct usrregs_info nios2_usrregs_info = {
+ nios2_num_regs,
+ nios2_regmap,
};
-static struct regsets_info nios2_regsets_info =
- {
- nios2_regsets, /* regsets */
- 0, /* num_regsets */
- NULL, /* disabled_regsets */
- };
-
-static struct usrregs_info nios2_usrregs_info =
- {
- nios2_num_regs,
- nios2_regmap,
- };
-
-static struct regs_info myregs_info =
- {
- NULL, /* regset_bitmap */
- &nios2_usrregs_info,
- &nios2_regsets_info
- };
+static struct regs_info myregs_info
+ = { NULL, /* regset_bitmap */
+ &nios2_usrregs_info, &nios2_regsets_info };
const regs_info *
nios2_target::get_regs_info ()
diff --git a/gdbserver/linux-or1k-low.cc b/gdbserver/linux-or1k-low.cc
index 498955a9629..2916f117419 100644
--- a/gdbserver/linux-or1k-low.cc
+++ b/gdbserver/linux-or1k-low.cc
@@ -33,13 +33,11 @@
class or1k_target : public linux_process_target
{
public:
-
const regs_info *get_regs_info () override;
const gdb_byte *sw_breakpoint_from_kind (int kind, int *size) override;
protected:
-
void low_arch_setup () override;
bool low_cannot_fetch_register (int regno) override;
@@ -101,11 +99,8 @@ union or1k_register
/* Return the ptrace ``address'' of register REGNO. */
static int or1k_regmap[] = {
- -1, 1, 2, 3, 4, 5, 6, 7,
- 8, 9, 10, 11, 12, 13, 14, 15,
- 16, 17, 18, 19, 20, 21, 22, 23,
- 24, 25, 26, 27, 28, 29, 30, 31,
- -1, /* PC */
+ -1, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16,
+ 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, -1, /* PC */
-1, /* ORIGINAL R11 */
-1 /* SYSCALL NO */
};
@@ -164,8 +159,8 @@ or1k_target::low_breakpoint_at (CORE_ADDR where)
/* Fetch the thread-local storage pointer for libthread_db. */
ps_err_e
-ps_get_thread_area (struct ps_prochandle *ph,
- lwpid_t lwpid, int idx, void **base)
+ps_get_thread_area (struct ps_prochandle *ph, lwpid_t lwpid, int idx,
+ void **base)
{
if (ptrace (PTRACE_GET_THREAD_AREA, lwpid, NULL, base) != 0)
return PS_ERR;
@@ -182,7 +177,7 @@ ps_get_thread_area (struct ps_prochandle *ph,
static void
or1k_collect_register (struct regcache *regcache, int regno,
- union or1k_register *reg)
+ union or1k_register *reg)
{
union or1k_register tmp_reg;
@@ -192,7 +187,7 @@ or1k_collect_register (struct regcache *regcache, int regno,
static void
or1k_supply_register (struct regcache *regcache, int regno,
- const union or1k_register *reg)
+ const union or1k_register *reg)
{
supply_register (regcache, regno, reg->buf);
}
@@ -219,33 +214,24 @@ or1k_store_gregset (struct regcache *regcache, const void *buf)
or1k_supply_register (regcache, i, regset + i);
}
-static struct regset_info or1k_regsets[] =
-{
- { PTRACE_GETREGSET, PTRACE_SETREGSET, NT_PRSTATUS,
- or1k_num_regs * 4, GENERAL_REGS,
- or1k_fill_gregset, or1k_store_gregset },
- NULL_REGSET
+static struct regset_info or1k_regsets[]
+ = { { PTRACE_GETREGSET, PTRACE_SETREGSET, NT_PRSTATUS, or1k_num_regs * 4,
+ GENERAL_REGS, or1k_fill_gregset, or1k_store_gregset },
+ NULL_REGSET };
+
+static struct regsets_info or1k_regsets_info = {
+ or1k_regsets, /* regsets */
+ 0, /* num_regsets */
+ NULL, /* disabled_regsets */
+};
+
+static struct usrregs_info or1k_usrregs_info = {
+ or1k_num_regs,
+ or1k_regmap,
};
-static struct regsets_info or1k_regsets_info =
- {
- or1k_regsets, /* regsets */
- 0, /* num_regsets */
- NULL, /* disabled_regsets */
- };
-
-static struct usrregs_info or1k_usrregs_info =
- {
- or1k_num_regs,
- or1k_regmap,
- };
-
-static struct regs_info or1k_regs =
- {
- NULL, /* regset_bitmap */
- &or1k_usrregs_info,
- &or1k_regsets_info
- };
+static struct regs_info or1k_regs = { NULL, /* regset_bitmap */
+ &or1k_usrregs_info, &or1k_regsets_info };
const regs_info *
or1k_target::get_regs_info ()
diff --git a/gdbserver/linux-ppc-ipa.cc b/gdbserver/linux-ppc-ipa.cc
index ab89e44a3a0..f079c122039 100644
--- a/gdbserver/linux-ppc-ipa.cc
+++ b/gdbserver/linux-ppc-ipa.cc
@@ -30,60 +30,54 @@
/* These macros define the position of registers in the buffer collected
by the fast tracepoint jump pad. */
-#define FT_CR_R0 0
-#define FT_CR_CR 32
-#define FT_CR_XER 33
-#define FT_CR_LR 34
-#define FT_CR_CTR 35
-#define FT_CR_PC 36
-#define FT_CR_GPR(n) (FT_CR_R0 + (n))
+#define FT_CR_R0 0
+#define FT_CR_CR 32
+#define FT_CR_XER 33
+#define FT_CR_LR 34
+#define FT_CR_CTR 35
+#define FT_CR_PC 36
+#define FT_CR_GPR(n) (FT_CR_R0 + (n))
static const int ppc_ft_collect_regmap[] = {
/* GPRs */
- FT_CR_GPR (0), FT_CR_GPR (1), FT_CR_GPR (2),
- FT_CR_GPR (3), FT_CR_GPR (4), FT_CR_GPR (5),
- FT_CR_GPR (6), FT_CR_GPR (7), FT_CR_GPR (8),
- FT_CR_GPR (9), FT_CR_GPR (10), FT_CR_GPR (11),
- FT_CR_GPR (12), FT_CR_GPR (13), FT_CR_GPR (14),
- FT_CR_GPR (15), FT_CR_GPR (16), FT_CR_GPR (17),
- FT_CR_GPR (18), FT_CR_GPR (19), FT_CR_GPR (20),
- FT_CR_GPR (21), FT_CR_GPR (22), FT_CR_GPR (23),
- FT_CR_GPR (24), FT_CR_GPR (25), FT_CR_GPR (26),
- FT_CR_GPR (27), FT_CR_GPR (28), FT_CR_GPR (29),
+ FT_CR_GPR (0), FT_CR_GPR (1), FT_CR_GPR (2), FT_CR_GPR (3), FT_CR_GPR (4),
+ FT_CR_GPR (5), FT_CR_GPR (6), FT_CR_GPR (7), FT_CR_GPR (8), FT_CR_GPR (9),
+ FT_CR_GPR (10), FT_CR_GPR (11), FT_CR_GPR (12), FT_CR_GPR (13),
+ FT_CR_GPR (14), FT_CR_GPR (15), FT_CR_GPR (16), FT_CR_GPR (17),
+ FT_CR_GPR (18), FT_CR_GPR (19), FT_CR_GPR (20), FT_CR_GPR (21),
+ FT_CR_GPR (22), FT_CR_GPR (23), FT_CR_GPR (24), FT_CR_GPR (25),
+ FT_CR_GPR (26), FT_CR_GPR (27), FT_CR_GPR (28), FT_CR_GPR (29),
FT_CR_GPR (30), FT_CR_GPR (31),
/* FPRs - not collected. */
- -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1,
- FT_CR_PC, /* PC */
- -1, /* MSR */
- FT_CR_CR, /* CR */
- FT_CR_LR, /* LR */
- FT_CR_CTR, /* CTR */
- FT_CR_XER, /* XER */
- -1, /* FPSCR */
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, FT_CR_PC, /* PC */
+ -1, /* MSR */
+ FT_CR_CR, /* CR */
+ FT_CR_LR, /* LR */
+ FT_CR_CTR, /* CTR */
+ FT_CR_XER, /* XER */
+ -1, /* FPSCR */
};
#define PPC_NUM_FT_COLLECT_GREGS \
- (sizeof (ppc_ft_collect_regmap) / sizeof(ppc_ft_collect_regmap[0]))
+ (sizeof (ppc_ft_collect_regmap) / sizeof (ppc_ft_collect_regmap[0]))
/* Supply registers collected by the fast tracepoint jump pad.
BUF is the second argument we pass to gdb_collect in jump pad. */
void
supply_fast_tracepoint_registers (struct regcache *regcache,
- const unsigned char *buf)
+ const unsigned char *buf)
{
int i;
for (i = 0; i < PPC_NUM_FT_COLLECT_GREGS; i++)
{
if (ppc_ft_collect_regmap[i] == -1)
- continue;
+ continue;
supply_register (regcache, i,
- ((char *) buf)
- + ppc_ft_collect_regmap[i] * sizeof (long));
+ ((char *) buf)
+ + ppc_ft_collect_regmap[i] * sizeof (long));
}
}
@@ -99,7 +93,7 @@ get_raw_reg (const unsigned char *raw_regs, int regnum)
return 0;
return *(unsigned long *) (raw_regs
- + ppc_ft_collect_regmap[regnum] * sizeof (long));
+ + ppc_ft_collect_regmap[regnum] * sizeof (long));
}
/* Allocate buffer for the jump pads. The branch instruction has a reach
@@ -139,24 +133,23 @@ alloc_jump_pad_buffer (size_t size)
for (; addr; addr -= pagesize)
{
/* No MAP_FIXED - we don't want to zap someone's mapping. */
- res = mmap ((void *) addr, size,
- PROT_READ | PROT_WRITE | PROT_EXEC,
- MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
+ res = mmap ((void *) addr, size, PROT_READ | PROT_WRITE | PROT_EXEC,
+ MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
/* If we got what we wanted, return. */
if ((uintptr_t) res == addr)
- return res;
+ return res;
/* If we got a mapping, but at a wrong address, undo it. */
if (res != MAP_FAILED)
- munmap (res, size);
+ munmap (res, size);
}
return NULL;
#else
void *target = sbrk (0);
void *res = mmap (target, size, PROT_READ | PROT_WRITE | PROT_EXEC,
- MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
+ MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
if (res == target)
return res;
@@ -227,7 +220,6 @@ get_ipa_tdesc (int idx)
}
}
-
/* Initialize ipa_tdesc and others. */
void
diff --git a/gdbserver/linux-ppc-low.cc b/gdbserver/linux-ppc-low.cc
index f8dd770b8eb..148f49e6a9c 100644
--- a/gdbserver/linux-ppc-low.cc
+++ b/gdbserver/linux-ppc-low.cc
@@ -34,46 +34,44 @@
#include "tracepoint.h"
#define PPC_FIELD(value, from, len) \
- (((value) >> (32 - (from) - (len))) & ((1 << (len)) - 1))
-#define PPC_SEXT(v, bs) \
- ((((CORE_ADDR) (v) & (((CORE_ADDR) 1 << (bs)) - 1)) \
- ^ ((CORE_ADDR) 1 << ((bs) - 1))) \
- - ((CORE_ADDR) 1 << ((bs) - 1)))
-#define PPC_OP6(insn) PPC_FIELD (insn, 0, 6)
-#define PPC_BO(insn) PPC_FIELD (insn, 6, 5)
-#define PPC_LI(insn) (PPC_SEXT (PPC_FIELD (insn, 6, 24), 24) << 2)
-#define PPC_BD(insn) (PPC_SEXT (PPC_FIELD (insn, 16, 14), 14) << 2)
+ (((value) >> (32 - (from) - (len))) & ((1 << (len)) - 1))
+#define PPC_SEXT(v, bs) \
+ ((((CORE_ADDR) (v) & (((CORE_ADDR) 1 << (bs)) - 1)) \
+ ^ ((CORE_ADDR) 1 << ((bs) -1))) \
+ - ((CORE_ADDR) 1 << ((bs) -1)))
+#define PPC_OP6(insn) PPC_FIELD (insn, 0, 6)
+#define PPC_BO(insn) PPC_FIELD (insn, 6, 5)
+#define PPC_LI(insn) (PPC_SEXT (PPC_FIELD (insn, 6, 24), 24) << 2)
+#define PPC_BD(insn) (PPC_SEXT (PPC_FIELD (insn, 16, 14), 14) << 2)
/* Linux target op definitions for the PowerPC architecture. */
class ppc_target : public linux_process_target
{
public:
-
const regs_info *get_regs_info () override;
const gdb_byte *sw_breakpoint_from_kind (int kind, int *size) override;
bool supports_z_point_type (char z_type) override;
-
void low_collect_ptrace_register (regcache *regcache, int regno,
- char *buf) override;
+ char *buf) override;
void low_supply_ptrace_register (regcache *regcache, int regno,
- const char *buf) override;
+ const char *buf) override;
bool supports_tracepoints () override;
bool supports_fast_tracepoints () override;
- int install_fast_tracepoint_jump_pad
- (CORE_ADDR tpoint, CORE_ADDR tpaddr, CORE_ADDR collector,
- CORE_ADDR lockaddr, ULONGEST orig_size, CORE_ADDR *jump_entry,
- CORE_ADDR *trampoline, ULONGEST *trampoline_size,
- unsigned char *jjump_pad_insn, ULONGEST *jjump_pad_insn_size,
- CORE_ADDR *adjusted_insn_addr, CORE_ADDR *adjusted_insn_addr_end,
- char *err) override;
+ int install_fast_tracepoint_jump_pad (
+ CORE_ADDR tpoint, CORE_ADDR tpaddr, CORE_ADDR collector,
+ CORE_ADDR lockaddr, ULONGEST orig_size, CORE_ADDR *jump_entry,
+ CORE_ADDR *trampoline, ULONGEST *trampoline_size,
+ unsigned char *jjump_pad_insn, ULONGEST *jjump_pad_insn_size,
+ CORE_ADDR *adjusted_insn_addr, CORE_ADDR *adjusted_insn_addr_end,
+ char *err) override;
int get_min_fast_tracepoint_insn_len () override;
@@ -82,7 +80,6 @@ public:
int get_ipa_tdesc_idx () override;
protected:
-
void low_arch_setup () override;
bool low_cannot_fetch_register (int regno) override;
@@ -97,11 +94,11 @@ protected:
bool low_breakpoint_at (CORE_ADDR pc) override;
- int low_insert_point (raw_bkpt_type type, CORE_ADDR addr,
- int size, raw_breakpoint *bp) override;
+ int low_insert_point (raw_bkpt_type type, CORE_ADDR addr, int size,
+ raw_breakpoint *bp) override;
- int low_remove_point (raw_bkpt_type type, CORE_ADDR addr,
- int size, raw_breakpoint *bp) override;
+ int low_remove_point (raw_bkpt_type type, CORE_ADDR addr, int size,
+ raw_breakpoint *bp) override;
int low_get_thread_area (int lwpid, CORE_ADDR *addrp) override;
};
@@ -118,77 +115,71 @@ static unsigned long ppc_hwcap;
static unsigned long ppc_hwcap2;
-
#define ppc_num_regs 73
#ifdef __powerpc64__
/* We use a constant for FPSCR instead of PT_FPSCR, because
many shipped PPC64 kernels had the wrong value in ptrace.h. */
-static int ppc_regmap[] =
- {PT_R0 * 8, PT_R1 * 8, PT_R2 * 8, PT_R3 * 8,
- PT_R4 * 8, PT_R5 * 8, PT_R6 * 8, PT_R7 * 8,
- PT_R8 * 8, PT_R9 * 8, PT_R10 * 8, PT_R11 * 8,
- PT_R12 * 8, PT_R13 * 8, PT_R14 * 8, PT_R15 * 8,
- PT_R16 * 8, PT_R17 * 8, PT_R18 * 8, PT_R19 * 8,
- PT_R20 * 8, PT_R21 * 8, PT_R22 * 8, PT_R23 * 8,
- PT_R24 * 8, PT_R25 * 8, PT_R26 * 8, PT_R27 * 8,
- PT_R28 * 8, PT_R29 * 8, PT_R30 * 8, PT_R31 * 8,
- PT_FPR0*8, PT_FPR0*8 + 8, PT_FPR0*8+16, PT_FPR0*8+24,
- PT_FPR0*8+32, PT_FPR0*8+40, PT_FPR0*8+48, PT_FPR0*8+56,
- PT_FPR0*8+64, PT_FPR0*8+72, PT_FPR0*8+80, PT_FPR0*8+88,
- PT_FPR0*8+96, PT_FPR0*8+104, PT_FPR0*8+112, PT_FPR0*8+120,
- PT_FPR0*8+128, PT_FPR0*8+136, PT_FPR0*8+144, PT_FPR0*8+152,
- PT_FPR0*8+160, PT_FPR0*8+168, PT_FPR0*8+176, PT_FPR0*8+184,
- PT_FPR0*8+192, PT_FPR0*8+200, PT_FPR0*8+208, PT_FPR0*8+216,
- PT_FPR0*8+224, PT_FPR0*8+232, PT_FPR0*8+240, PT_FPR0*8+248,
- PT_NIP * 8, PT_MSR * 8, PT_CCR * 8, PT_LNK * 8,
- PT_CTR * 8, PT_XER * 8, PT_FPR0*8 + 256,
- PT_ORIG_R3 * 8, PT_TRAP * 8 };
+static int ppc_regmap[] = {
+ PT_R0 * 8, PT_R1 * 8, PT_R2 * 8, PT_R3 * 8,
+ PT_R4 * 8, PT_R5 * 8, PT_R6 * 8, PT_R7 * 8,
+ PT_R8 * 8, PT_R9 * 8, PT_R10 * 8, PT_R11 * 8,
+ PT_R12 * 8, PT_R13 * 8, PT_R14 * 8, PT_R15 * 8,
+ PT_R16 * 8, PT_R17 * 8, PT_R18 * 8, PT_R19 * 8,
+ PT_R20 * 8, PT_R21 * 8, PT_R22 * 8, PT_R23 * 8,
+ PT_R24 * 8, PT_R25 * 8, PT_R26 * 8, PT_R27 * 8,
+ PT_R28 * 8, PT_R29 * 8, PT_R30 * 8, PT_R31 * 8,
+ PT_FPR0 * 8, PT_FPR0 * 8 + 8, PT_FPR0 * 8 + 16, PT_FPR0 * 8 + 24,
+ PT_FPR0 * 8 + 32, PT_FPR0 * 8 + 40, PT_FPR0 * 8 + 48, PT_FPR0 * 8 + 56,
+ PT_FPR0 * 8 + 64, PT_FPR0 * 8 + 72, PT_FPR0 * 8 + 80, PT_FPR0 * 8 + 88,
+ PT_FPR0 * 8 + 96, PT_FPR0 * 8 + 104, PT_FPR0 * 8 + 112, PT_FPR0 * 8 + 120,
+ PT_FPR0 * 8 + 128, PT_FPR0 * 8 + 136, PT_FPR0 * 8 + 144, PT_FPR0 * 8 + 152,
+ PT_FPR0 * 8 + 160, PT_FPR0 * 8 + 168, PT_FPR0 * 8 + 176, PT_FPR0 * 8 + 184,
+ PT_FPR0 * 8 + 192, PT_FPR0 * 8 + 200, PT_FPR0 * 8 + 208, PT_FPR0 * 8 + 216,
+ PT_FPR0 * 8 + 224, PT_FPR0 * 8 + 232, PT_FPR0 * 8 + 240, PT_FPR0 * 8 + 248,
+ PT_NIP * 8, PT_MSR * 8, PT_CCR * 8, PT_LNK * 8,
+ PT_CTR * 8, PT_XER * 8, PT_FPR0 * 8 + 256, PT_ORIG_R3 * 8,
+ PT_TRAP * 8
+};
#else
/* Currently, don't check/send MQ. */
-static int ppc_regmap[] =
- {PT_R0 * 4, PT_R1 * 4, PT_R2 * 4, PT_R3 * 4,
- PT_R4 * 4, PT_R5 * 4, PT_R6 * 4, PT_R7 * 4,
- PT_R8 * 4, PT_R9 * 4, PT_R10 * 4, PT_R11 * 4,
- PT_R12 * 4, PT_R13 * 4, PT_R14 * 4, PT_R15 * 4,
- PT_R16 * 4, PT_R17 * 4, PT_R18 * 4, PT_R19 * 4,
- PT_R20 * 4, PT_R21 * 4, PT_R22 * 4, PT_R23 * 4,
- PT_R24 * 4, PT_R25 * 4, PT_R26 * 4, PT_R27 * 4,
- PT_R28 * 4, PT_R29 * 4, PT_R30 * 4, PT_R31 * 4,
- PT_FPR0*4, PT_FPR0*4 + 8, PT_FPR0*4+16, PT_FPR0*4+24,
- PT_FPR0*4+32, PT_FPR0*4+40, PT_FPR0*4+48, PT_FPR0*4+56,
- PT_FPR0*4+64, PT_FPR0*4+72, PT_FPR0*4+80, PT_FPR0*4+88,
- PT_FPR0*4+96, PT_FPR0*4+104, PT_FPR0*4+112, PT_FPR0*4+120,
- PT_FPR0*4+128, PT_FPR0*4+136, PT_FPR0*4+144, PT_FPR0*4+152,
- PT_FPR0*4+160, PT_FPR0*4+168, PT_FPR0*4+176, PT_FPR0*4+184,
- PT_FPR0*4+192, PT_FPR0*4+200, PT_FPR0*4+208, PT_FPR0*4+216,
- PT_FPR0*4+224, PT_FPR0*4+232, PT_FPR0*4+240, PT_FPR0*4+248,
- PT_NIP * 4, PT_MSR * 4, PT_CCR * 4, PT_LNK * 4,
- PT_CTR * 4, PT_XER * 4, PT_FPSCR * 4,
- PT_ORIG_R3 * 4, PT_TRAP * 4
- };
-
-static int ppc_regmap_e500[] =
- {PT_R0 * 4, PT_R1 * 4, PT_R2 * 4, PT_R3 * 4,
- PT_R4 * 4, PT_R5 * 4, PT_R6 * 4, PT_R7 * 4,
- PT_R8 * 4, PT_R9 * 4, PT_R10 * 4, PT_R11 * 4,
- PT_R12 * 4, PT_R13 * 4, PT_R14 * 4, PT_R15 * 4,
- PT_R16 * 4, PT_R17 * 4, PT_R18 * 4, PT_R19 * 4,
- PT_R20 * 4, PT_R21 * 4, PT_R22 * 4, PT_R23 * 4,
- PT_R24 * 4, PT_R25 * 4, PT_R26 * 4, PT_R27 * 4,
- PT_R28 * 4, PT_R29 * 4, PT_R30 * 4, PT_R31 * 4,
- -1, -1, -1, -1,
- -1, -1, -1, -1,
- -1, -1, -1, -1,
- -1, -1, -1, -1,
- -1, -1, -1, -1,
- -1, -1, -1, -1,
- -1, -1, -1, -1,
- -1, -1, -1, -1,
- PT_NIP * 4, PT_MSR * 4, PT_CCR * 4, PT_LNK * 4,
- PT_CTR * 4, PT_XER * 4, -1,
- PT_ORIG_R3 * 4, PT_TRAP * 4
- };
+static int ppc_regmap[] = {
+ PT_R0 * 4, PT_R1 * 4, PT_R2 * 4, PT_R3 * 4,
+ PT_R4 * 4, PT_R5 * 4, PT_R6 * 4, PT_R7 * 4,
+ PT_R8 * 4, PT_R9 * 4, PT_R10 * 4, PT_R11 * 4,
+ PT_R12 * 4, PT_R13 * 4, PT_R14 * 4, PT_R15 * 4,
+ PT_R16 * 4, PT_R17 * 4, PT_R18 * 4, PT_R19 * 4,
+ PT_R20 * 4, PT_R21 * 4, PT_R22 * 4, PT_R23 * 4,
+ PT_R24 * 4, PT_R25 * 4, PT_R26 * 4, PT_R27 * 4,
+ PT_R28 * 4, PT_R29 * 4, PT_R30 * 4, PT_R31 * 4,
+ PT_FPR0 * 4, PT_FPR0 * 4 + 8, PT_FPR0 * 4 + 16, PT_FPR0 * 4 + 24,
+ PT_FPR0 * 4 + 32, PT_FPR0 * 4 + 40, PT_FPR0 * 4 + 48, PT_FPR0 * 4 + 56,
+ PT_FPR0 * 4 + 64, PT_FPR0 * 4 + 72, PT_FPR0 * 4 + 80, PT_FPR0 * 4 + 88,
+ PT_FPR0 * 4 + 96, PT_FPR0 * 4 + 104, PT_FPR0 * 4 + 112, PT_FPR0 * 4 + 120,
+ PT_FPR0 * 4 + 128, PT_FPR0 * 4 + 136, PT_FPR0 * 4 + 144, PT_FPR0 * 4 + 152,
+ PT_FPR0 * 4 + 160, PT_FPR0 * 4 + 168, PT_FPR0 * 4 + 176, PT_FPR0 * 4 + 184,
+ PT_FPR0 * 4 + 192, PT_FPR0 * 4 + 200, PT_FPR0 * 4 + 208, PT_FPR0 * 4 + 216,
+ PT_FPR0 * 4 + 224, PT_FPR0 * 4 + 232, PT_FPR0 * 4 + 240, PT_FPR0 * 4 + 248,
+ PT_NIP * 4, PT_MSR * 4, PT_CCR * 4, PT_LNK * 4,
+ PT_CTR * 4, PT_XER * 4, PT_FPSCR * 4, PT_ORIG_R3 * 4,
+ PT_TRAP * 4
+};
+
+static int ppc_regmap_e500[] = {
+ PT_R0 * 4, PT_R1 * 4, PT_R2 * 4, PT_R3 * 4, PT_R4 * 4, PT_R5 * 4,
+ PT_R6 * 4, PT_R7 * 4, PT_R8 * 4, PT_R9 * 4, PT_R10 * 4, PT_R11 * 4,
+ PT_R12 * 4, PT_R13 * 4, PT_R14 * 4, PT_R15 * 4, PT_R16 * 4, PT_R17 * 4,
+ PT_R18 * 4, PT_R19 * 4, PT_R20 * 4, PT_R21 * 4, PT_R22 * 4, PT_R23 * 4,
+ PT_R24 * 4, PT_R25 * 4, PT_R26 * 4, PT_R27 * 4, PT_R28 * 4, PT_R29 * 4,
+ PT_R30 * 4, PT_R31 * 4, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, PT_NIP * 4, PT_MSR * 4,
+ PT_CCR * 4, PT_LNK * 4, PT_CTR * 4, PT_XER * 4, -1, PT_ORIG_R3 * 4,
+ PT_TRAP * 4
+};
#endif
/* Check whether the kernel provides a register set with number
@@ -203,8 +194,7 @@ ppc_check_regset (int tid, int regset_id, int regsetsize)
iov.iov_base = buf;
iov.iov_len = regsetsize;
- if (ptrace (PTRACE_GETREGSET, tid, regset_id, &iov) >= 0
- || errno == ENODATA)
+ if (ptrace (PTRACE_GETREGSET, tid, regset_id, &iov) >= 0 || errno == ENODATA)
return 1;
return 0;
}
@@ -237,7 +227,7 @@ ppc_target::low_cannot_fetch_register (int regno)
void
ppc_target::low_collect_ptrace_register (regcache *regcache, int regno,
- char *buf)
+ char *buf)
{
memset (buf, 0, sizeof (long));
@@ -254,9 +244,9 @@ ppc_target::low_collect_ptrace_register (regcache *regcache, int regno,
int size = register_size (regcache->tdesc, regno);
if (size < sizeof (long))
- collect_register (regcache, regno, buf + sizeof (long) - size);
+ collect_register (regcache, regno, buf + sizeof (long) - size);
else
- collect_register (regcache, regno, buf);
+ collect_register (regcache, regno, buf);
}
else
perror_with_name ("Unexpected byte order");
@@ -264,7 +254,7 @@ ppc_target::low_collect_ptrace_register (regcache *regcache, int regno,
void
ppc_target::low_supply_ptrace_register (regcache *regcache, int regno,
- const char *buf)
+ const char *buf)
{
if (__BYTE_ORDER == __LITTLE_ENDIAN)
{
@@ -279,9 +269,9 @@ ppc_target::low_supply_ptrace_register (regcache *regcache, int regno,
int size = register_size (regcache->tdesc, regno);
if (size < sizeof (long))
- supply_register (regcache, regno, buf + sizeof (long) - size);
+ supply_register (regcache, regno, buf + sizeof (long) - size);
else
- supply_register (regcache, regno, buf);
+ supply_register (regcache, regno, buf);
}
else
perror_with_name ("Unexpected byte order");
@@ -329,7 +319,6 @@ ppc_target::low_set_pc (regcache *regcache, CORE_ADDR pc)
static int ppc_regmap_adjusted;
#endif
-
/* Correct in either endianness.
This instruction is "twge r2, r2", which GDB uses as a software
breakpoint. */
@@ -384,8 +373,8 @@ ppc_target::supports_z_point_type (char z_type)
Returns 0 on success, -1 on failure and 1 on unsupported. */
int
-ppc_target::low_insert_point (raw_bkpt_type type, CORE_ADDR addr,
- int size, raw_breakpoint *bp)
+ppc_target::low_insert_point (raw_bkpt_type type, CORE_ADDR addr, int size,
+ raw_breakpoint *bp)
{
switch (type)
{
@@ -405,8 +394,8 @@ ppc_target::low_insert_point (raw_bkpt_type type, CORE_ADDR addr,
Returns 0 on success, -1 on failure and 1 on unsupported. */
int
-ppc_target::low_remove_point (raw_bkpt_type type, CORE_ADDR addr,
- int size, raw_breakpoint *bp)
+ppc_target::low_remove_point (raw_bkpt_type type, CORE_ADDR addr, int size,
+ raw_breakpoint *bp)
{
switch (type)
{
@@ -425,7 +414,8 @@ ppc_target::low_remove_point (raw_bkpt_type type, CORE_ADDR addr,
/* Provide only a fill function for the general register set. ps_lgetregs
will use this for NPTL support. */
-static void ppc_fill_gregset (struct regcache *regcache, void *buf)
+static void
+ppc_fill_gregset (struct regcache *regcache, void *buf)
{
int i;
@@ -433,15 +423,15 @@ static void ppc_fill_gregset (struct regcache *regcache, void *buf)
for (i = 0; i < 32; i++)
my_ppc_target->low_collect_ptrace_register (regcache, i,
- (char *) buf + ppc_regmap[i]);
+ (char *) buf + ppc_regmap[i]);
for (i = 64; i < 70; i++)
my_ppc_target->low_collect_ptrace_register (regcache, i,
- (char *) buf + ppc_regmap[i]);
+ (char *) buf + ppc_regmap[i]);
for (i = 71; i < 73; i++)
my_ppc_target->low_collect_ptrace_register (regcache, i,
- (char *) buf + ppc_regmap[i]);
+ (char *) buf + ppc_regmap[i]);
}
/* Program Priority Register regset fill function. */
@@ -614,10 +604,10 @@ ppc_store_tm_cgprregset (struct regcache *regcache, const void *buf)
endian_offset = 4;
supply_register_by_name (regcache, "ccr",
- &regset[PT_CCR * size + endian_offset]);
+ &regset[PT_CCR * size + endian_offset]);
supply_register_by_name (regcache, "cxer",
- &regset[PT_XER * size + endian_offset]);
+ &regset[PT_XER * size + endian_offset]);
supply_register_by_name (regcache, "clr", &regset[PT_LNK * size]);
supply_register_by_name (regcache, "cctr", &regset[PT_CTR * size]);
@@ -658,8 +648,7 @@ ppc_store_tm_cvrregset (struct regcache *regcache, const void *buf)
if (__BYTE_ORDER == __BIG_ENDIAN)
vscr_offset = 12;
- supply_register_by_name (regcache, "cvscr",
- &regset[32 * 16 + vscr_offset]);
+ supply_register_by_name (regcache, "cvscr", &regset[32 * 16 + vscr_offset]);
supply_register_by_name (regcache, "cvrsave", &regset[33 * 16]);
}
@@ -747,8 +736,7 @@ ppc_fill_vrregset (struct regcache *regcache, void *buf)
if (__BYTE_ORDER == __BIG_ENDIAN)
vscr_offset = 12;
- collect_register_by_name (regcache, "vscr",
- &regset[32 * 16 + vscr_offset]);
+ collect_register_by_name (regcache, "vscr", &regset[32 * 16 + vscr_offset]);
collect_register_by_name (regcache, "vrsave", &regset[33 * 16]);
}
@@ -767,8 +755,7 @@ ppc_store_vrregset (struct regcache *regcache, const void *buf)
if (__BYTE_ORDER == __BIG_ENDIAN)
vscr_offset = 12;
- supply_register_by_name (regcache, "vscr",
- &regset[32 * 16 + vscr_offset]);
+ supply_register_by_name (regcache, "vscr", &regset[32 * 16 + vscr_offset]);
supply_register_by_name (regcache, "vrsave", &regset[33 * 16]);
}
@@ -812,24 +799,24 @@ static struct regset_info ppc_regsets[] = {
fetch them every time, but still fall back to PTRACE_PEEKUSER for the
general registers. Some kernels support these, but not the newer
PPC_PTRACE_GETREGS. */
- { PTRACE_GETREGSET, PTRACE_SETREGSET, NT_PPC_TM_CTAR, 0, EXTENDED_REGS,
- NULL, ppc_store_tm_ctarregset },
+ { PTRACE_GETREGSET, PTRACE_SETREGSET, NT_PPC_TM_CTAR, 0, EXTENDED_REGS, NULL,
+ ppc_store_tm_ctarregset },
{ PTRACE_GETREGSET, PTRACE_SETREGSET, NT_PPC_TM_CDSCR, 0, EXTENDED_REGS,
NULL, ppc_store_tm_cdscrregset },
- { PTRACE_GETREGSET, PTRACE_SETREGSET, NT_PPC_TM_CPPR, 0, EXTENDED_REGS,
- NULL, ppc_store_tm_cpprregset },
- { PTRACE_GETREGSET, PTRACE_SETREGSET, NT_PPC_TM_CVSX, 0, EXTENDED_REGS,
- NULL, ppc_store_tm_cvsxregset },
- { PTRACE_GETREGSET, PTRACE_SETREGSET, NT_PPC_TM_CVMX, 0, EXTENDED_REGS,
- NULL, ppc_store_tm_cvrregset },
- { PTRACE_GETREGSET, PTRACE_SETREGSET, NT_PPC_TM_CFPR, 0, EXTENDED_REGS,
- NULL, ppc_store_tm_cfprregset },
- { PTRACE_GETREGSET, PTRACE_SETREGSET, NT_PPC_TM_CGPR, 0, EXTENDED_REGS,
- NULL, ppc_store_tm_cgprregset },
+ { PTRACE_GETREGSET, PTRACE_SETREGSET, NT_PPC_TM_CPPR, 0, EXTENDED_REGS, NULL,
+ ppc_store_tm_cpprregset },
+ { PTRACE_GETREGSET, PTRACE_SETREGSET, NT_PPC_TM_CVSX, 0, EXTENDED_REGS, NULL,
+ ppc_store_tm_cvsxregset },
+ { PTRACE_GETREGSET, PTRACE_SETREGSET, NT_PPC_TM_CVMX, 0, EXTENDED_REGS, NULL,
+ ppc_store_tm_cvrregset },
+ { PTRACE_GETREGSET, PTRACE_SETREGSET, NT_PPC_TM_CFPR, 0, EXTENDED_REGS, NULL,
+ ppc_store_tm_cfprregset },
+ { PTRACE_GETREGSET, PTRACE_SETREGSET, NT_PPC_TM_CGPR, 0, EXTENDED_REGS, NULL,
+ ppc_store_tm_cgprregset },
{ PTRACE_GETREGSET, PTRACE_SETREGSET, NT_PPC_TM_SPR, 0, EXTENDED_REGS,
ppc_fill_tm_sprregset, ppc_store_tm_sprregset },
- { PTRACE_GETREGSET, PTRACE_SETREGSET, NT_PPC_EBB, 0, EXTENDED_REGS,
- NULL, ppc_store_ebbregset },
+ { PTRACE_GETREGSET, PTRACE_SETREGSET, NT_PPC_EBB, 0, EXTENDED_REGS, NULL,
+ ppc_store_ebbregset },
{ PTRACE_GETREGSET, PTRACE_SETREGSET, NT_PPC_PMU, 0, EXTENDED_REGS,
ppc_fill_pmuregset, ppc_store_pmuregset },
{ PTRACE_GETREGSET, PTRACE_SETREGSET, NT_PPC_TAR, 0, EXTENDED_REGS,
@@ -839,34 +826,28 @@ static struct regset_info ppc_regsets[] = {
{ PTRACE_GETREGSET, PTRACE_SETREGSET, NT_PPC_DSCR, 0, EXTENDED_REGS,
ppc_fill_dscrregset, ppc_store_dscrregset },
{ PTRACE_GETVSXREGS, PTRACE_SETVSXREGS, 0, 0, EXTENDED_REGS,
- ppc_fill_vsxregset, ppc_store_vsxregset },
- { PTRACE_GETVRREGS, PTRACE_SETVRREGS, 0, 0, EXTENDED_REGS,
- ppc_fill_vrregset, ppc_store_vrregset },
+ ppc_fill_vsxregset, ppc_store_vsxregset },
+ { PTRACE_GETVRREGS, PTRACE_SETVRREGS, 0, 0, EXTENDED_REGS, ppc_fill_vrregset,
+ ppc_store_vrregset },
{ PTRACE_GETEVRREGS, PTRACE_SETEVRREGS, 0, 0, EXTENDED_REGS,
ppc_fill_evrregset, ppc_store_evrregset },
{ 0, 0, 0, 0, GENERAL_REGS, ppc_fill_gregset, NULL },
NULL_REGSET
};
-static struct usrregs_info ppc_usrregs_info =
- {
- ppc_num_regs,
- ppc_regmap,
- };
-
-static struct regsets_info ppc_regsets_info =
- {
- ppc_regsets, /* regsets */
- 0, /* num_regsets */
- NULL, /* disabled_regsets */
- };
-
-static struct regs_info myregs_info =
- {
- NULL, /* regset_bitmap */
- &ppc_usrregs_info,
- &ppc_regsets_info
- };
+static struct usrregs_info ppc_usrregs_info = {
+ ppc_num_regs,
+ ppc_regmap,
+};
+
+static struct regsets_info ppc_regsets_info = {
+ ppc_regsets, /* regsets */
+ 0, /* num_regsets */
+ NULL, /* disabled_regsets */
+};
+
+static struct regs_info myregs_info = { NULL, /* regset_bitmap */
+ &ppc_usrregs_info, &ppc_regsets_info };
const regs_info *
ppc_target::get_regs_info ()
@@ -886,9 +867,9 @@ ppc_target::low_arch_setup ()
features.wordsize = ppc_linux_target_wordsize (tid);
if (features.wordsize == 4)
- tdesc = tdesc_powerpc_32l;
+ tdesc = tdesc_powerpc_32l;
else
- tdesc = tdesc_powerpc_64l;
+ tdesc = tdesc_powerpc_64l;
current_process ()->tdesc = tdesc;
@@ -911,21 +892,17 @@ ppc_target::low_arch_setup ()
{
features.ppr_dscr = true;
if ((ppc_hwcap2 & PPC_FEATURE2_ARCH_2_07)
- && (ppc_hwcap2 & PPC_FEATURE2_TAR)
- && (ppc_hwcap2 & PPC_FEATURE2_EBB)
- && ppc_check_regset (tid, NT_PPC_TAR,
- PPC_LINUX_SIZEOF_TARREGSET)
- && ppc_check_regset (tid, NT_PPC_EBB,
- PPC_LINUX_SIZEOF_EBBREGSET)
- && ppc_check_regset (tid, NT_PPC_PMU,
- PPC_LINUX_SIZEOF_PMUREGSET))
- {
- features.isa207 = true;
- if ((ppc_hwcap2 & PPC_FEATURE2_HTM)
- && ppc_check_regset (tid, NT_PPC_TM_SPR,
- PPC_LINUX_SIZEOF_TM_SPRREGSET))
- features.htm = true;
- }
+ && (ppc_hwcap2 & PPC_FEATURE2_TAR) && (ppc_hwcap2 & PPC_FEATURE2_EBB)
+ && ppc_check_regset (tid, NT_PPC_TAR, PPC_LINUX_SIZEOF_TARREGSET)
+ && ppc_check_regset (tid, NT_PPC_EBB, PPC_LINUX_SIZEOF_EBBREGSET)
+ && ppc_check_regset (tid, NT_PPC_PMU, PPC_LINUX_SIZEOF_PMUREGSET))
+ {
+ features.isa207 = true;
+ if ((ppc_hwcap2 & PPC_FEATURE2_HTM)
+ && ppc_check_regset (tid, NT_PPC_TM_SPR,
+ PPC_LINUX_SIZEOF_TM_SPRREGSET))
+ features.htm = true;
+ }
}
tdesc = ppc_linux_match_description (features);
@@ -939,17 +916,17 @@ ppc_target::low_arch_setup ()
if (!ppc_regmap_adjusted)
{
if (ppc_hwcap & PPC_FEATURE_HAS_SPE)
- ppc_usrregs_info.regmap = ppc_regmap_e500;
+ ppc_usrregs_info.regmap = ppc_regmap_e500;
/* If the FPSCR is 64-bit wide, we need to fetch the whole
64-bit slot and not just its second word. The PT_FPSCR
supplied in a 32-bit GDB compilation doesn't reflect
this. */
if (register_size (tdesc, 70) == 8)
- ppc_regmap[70] = (48 + 2*32) * sizeof (long);
+ ppc_regmap[70] = (48 + 2 * 32) * sizeof (long);
ppc_regmap_adjusted = 1;
- }
+ }
#endif
current_process ()->tdesc = tdesc;
@@ -958,82 +935,72 @@ ppc_target::low_arch_setup ()
switch (regset->get_request)
{
case PTRACE_GETVRREGS:
- regset->size = features.altivec ? PPC_LINUX_SIZEOF_VRREGSET : 0;
- break;
+ regset->size = features.altivec ? PPC_LINUX_SIZEOF_VRREGSET : 0;
+ break;
case PTRACE_GETVSXREGS:
- regset->size = features.vsx ? PPC_LINUX_SIZEOF_VSXREGSET : 0;
- break;
+ regset->size = features.vsx ? PPC_LINUX_SIZEOF_VSXREGSET : 0;
+ break;
case PTRACE_GETEVRREGS:
- if (ppc_hwcap & PPC_FEATURE_HAS_SPE)
- regset->size = 32 * 4 + 8 + 4;
- else
- regset->size = 0;
- break;
+ if (ppc_hwcap & PPC_FEATURE_HAS_SPE)
+ regset->size = 32 * 4 + 8 + 4;
+ else
+ regset->size = 0;
+ break;
case PTRACE_GETREGSET:
- switch (regset->nt_type)
- {
- case NT_PPC_PPR:
- regset->size = (features.ppr_dscr ?
- PPC_LINUX_SIZEOF_PPRREGSET : 0);
- break;
- case NT_PPC_DSCR:
- regset->size = (features.ppr_dscr ?
- PPC_LINUX_SIZEOF_DSCRREGSET : 0);
- break;
- case NT_PPC_TAR:
- regset->size = (features.isa207 ?
- PPC_LINUX_SIZEOF_TARREGSET : 0);
- break;
- case NT_PPC_EBB:
- regset->size = (features.isa207 ?
- PPC_LINUX_SIZEOF_EBBREGSET : 0);
- break;
- case NT_PPC_PMU:
- regset->size = (features.isa207 ?
- PPC_LINUX_SIZEOF_PMUREGSET : 0);
- break;
- case NT_PPC_TM_SPR:
- regset->size = (features.htm ?
- PPC_LINUX_SIZEOF_TM_SPRREGSET : 0);
- break;
- case NT_PPC_TM_CGPR:
- if (features.wordsize == 4)
- regset->size = (features.htm ?
- PPC32_LINUX_SIZEOF_CGPRREGSET : 0);
- else
- regset->size = (features.htm ?
- PPC64_LINUX_SIZEOF_CGPRREGSET : 0);
- break;
- case NT_PPC_TM_CFPR:
- regset->size = (features.htm ?
- PPC_LINUX_SIZEOF_CFPRREGSET : 0);
- break;
- case NT_PPC_TM_CVMX:
- regset->size = (features.htm ?
- PPC_LINUX_SIZEOF_CVMXREGSET : 0);
- break;
- case NT_PPC_TM_CVSX:
- regset->size = (features.htm ?
- PPC_LINUX_SIZEOF_CVSXREGSET : 0);
- break;
- case NT_PPC_TM_CPPR:
- regset->size = (features.htm ?
- PPC_LINUX_SIZEOF_CPPRREGSET : 0);
- break;
- case NT_PPC_TM_CDSCR:
- regset->size = (features.htm ?
- PPC_LINUX_SIZEOF_CDSCRREGSET : 0);
- break;
- case NT_PPC_TM_CTAR:
- regset->size = (features.htm ?
- PPC_LINUX_SIZEOF_CTARREGSET : 0);
- break;
- default:
- break;
- }
- break;
+ switch (regset->nt_type)
+ {
+ case NT_PPC_PPR:
+ regset->size
+ = (features.ppr_dscr ? PPC_LINUX_SIZEOF_PPRREGSET : 0);
+ break;
+ case NT_PPC_DSCR:
+ regset->size
+ = (features.ppr_dscr ? PPC_LINUX_SIZEOF_DSCRREGSET : 0);
+ break;
+ case NT_PPC_TAR:
+ regset->size = (features.isa207 ? PPC_LINUX_SIZEOF_TARREGSET : 0);
+ break;
+ case NT_PPC_EBB:
+ regset->size = (features.isa207 ? PPC_LINUX_SIZEOF_EBBREGSET : 0);
+ break;
+ case NT_PPC_PMU:
+ regset->size = (features.isa207 ? PPC_LINUX_SIZEOF_PMUREGSET : 0);
+ break;
+ case NT_PPC_TM_SPR:
+ regset->size = (features.htm ? PPC_LINUX_SIZEOF_TM_SPRREGSET : 0);
+ break;
+ case NT_PPC_TM_CGPR:
+ if (features.wordsize == 4)
+ regset->size
+ = (features.htm ? PPC32_LINUX_SIZEOF_CGPRREGSET : 0);
+ else
+ regset->size
+ = (features.htm ? PPC64_LINUX_SIZEOF_CGPRREGSET : 0);
+ break;
+ case NT_PPC_TM_CFPR:
+ regset->size = (features.htm ? PPC_LINUX_SIZEOF_CFPRREGSET : 0);
+ break;
+ case NT_PPC_TM_CVMX:
+ regset->size = (features.htm ? PPC_LINUX_SIZEOF_CVMXREGSET : 0);
+ break;
+ case NT_PPC_TM_CVSX:
+ regset->size = (features.htm ? PPC_LINUX_SIZEOF_CVSXREGSET : 0);
+ break;
+ case NT_PPC_TM_CPPR:
+ regset->size = (features.htm ? PPC_LINUX_SIZEOF_CPPRREGSET : 0);
+ break;
+ case NT_PPC_TM_CDSCR:
+ regset->size = (features.htm ? PPC_LINUX_SIZEOF_CDSCRREGSET : 0);
+ break;
+ case NT_PPC_TM_CTAR:
+ regset->size = (features.htm ? PPC_LINUX_SIZEOF_CTARREGSET : 0);
+ break;
+ default:
+ break;
+ }
+ break;
default:
- break;
+ break;
}
}
@@ -1104,7 +1071,7 @@ is_elfv2_inferior (void)
are located. If it doesn't look like one, bail. */
read_inferior_memory (phdr & ~0xfff, (unsigned char *) &ehdr, sizeof ehdr);
- if (memcmp(ehdr.e_ident, ELFMAG, SELFMAG))
+ if (memcmp (ehdr.e_ident, ELFMAG, SELFMAG))
return def_res;
return (ehdr.e_flags & EF_PPC64_ABI) == 2;
@@ -1117,7 +1084,7 @@ is_elfv2_inferior (void)
0 6 11 16 30 32
| OPCD | RST | RA | DS |XO| */
-__attribute__((unused)) /* Maybe unused due to conditional compilation. */
+__attribute__ ((unused)) /* Maybe unused due to conditional compilation. */
static int
gen_ds_form (uint32_t *buf, int opcd, int rst, int ra, int ds, int xo)
{
@@ -1135,10 +1102,10 @@ gen_ds_form (uint32_t *buf, int opcd, int rst, int ra, int ds, int xo)
/* Followings are frequently used ds-form instructions. */
-#define GEN_STD(buf, rs, ra, offset) gen_ds_form (buf, 62, rs, ra, offset, 0)
-#define GEN_STDU(buf, rs, ra, offset) gen_ds_form (buf, 62, rs, ra, offset, 1)
-#define GEN_LD(buf, rt, ra, offset) gen_ds_form (buf, 58, rt, ra, offset, 0)
-#define GEN_LDU(buf, rt, ra, offset) gen_ds_form (buf, 58, rt, ra, offset, 1)
+#define GEN_STD(buf, rs, ra, offset) gen_ds_form (buf, 62, rs, ra, offset, 0)
+#define GEN_STDU(buf, rs, ra, offset) gen_ds_form (buf, 62, rs, ra, offset, 1)
+#define GEN_LD(buf, rt, ra, offset) gen_ds_form (buf, 58, rt, ra, offset, 0)
+#define GEN_LDU(buf, rt, ra, offset) gen_ds_form (buf, 58, rt, ra, offset, 1)
/* Generate a d-form instruction in BUF.
@@ -1161,15 +1128,15 @@ gen_d_form (uint32_t *buf, int opcd, int rst, int ra, int si)
/* Followings are frequently used d-form instructions. */
-#define GEN_ADDI(buf, rt, ra, si) gen_d_form (buf, 14, rt, ra, si)
-#define GEN_ADDIS(buf, rt, ra, si) gen_d_form (buf, 15, rt, ra, si)
-#define GEN_LI(buf, rt, si) GEN_ADDI (buf, rt, 0, si)
-#define GEN_LIS(buf, rt, si) GEN_ADDIS (buf, rt, 0, si)
-#define GEN_ORI(buf, rt, ra, si) gen_d_form (buf, 24, rt, ra, si)
-#define GEN_ORIS(buf, rt, ra, si) gen_d_form (buf, 25, rt, ra, si)
-#define GEN_LWZ(buf, rt, ra, si) gen_d_form (buf, 32, rt, ra, si)
-#define GEN_STW(buf, rt, ra, si) gen_d_form (buf, 36, rt, ra, si)
-#define GEN_STWU(buf, rt, ra, si) gen_d_form (buf, 37, rt, ra, si)
+#define GEN_ADDI(buf, rt, ra, si) gen_d_form (buf, 14, rt, ra, si)
+#define GEN_ADDIS(buf, rt, ra, si) gen_d_form (buf, 15, rt, ra, si)
+#define GEN_LI(buf, rt, si) GEN_ADDI (buf, rt, 0, si)
+#define GEN_LIS(buf, rt, si) GEN_ADDIS (buf, rt, 0, si)
+#define GEN_ORI(buf, rt, ra, si) gen_d_form (buf, 24, rt, ra, si)
+#define GEN_ORIS(buf, rt, ra, si) gen_d_form (buf, 25, rt, ra, si)
+#define GEN_LWZ(buf, rt, ra, si) gen_d_form (buf, 32, rt, ra, si)
+#define GEN_STW(buf, rt, ra, si) gen_d_form (buf, 36, rt, ra, si)
+#define GEN_STWU(buf, rt, ra, si) gen_d_form (buf, 37, rt, ra, si)
/* Generate a xfx-form instruction in BUF and return the number of bytes
written.
@@ -1194,14 +1161,12 @@ gen_xfx_form (uint32_t *buf, int opcd, int rst, int ri, int xo)
/* Followings are frequently used xfx-form instructions. */
-#define GEN_MFSPR(buf, rt, spr) gen_xfx_form (buf, 31, rt, spr, 339)
-#define GEN_MTSPR(buf, rt, spr) gen_xfx_form (buf, 31, rt, spr, 467)
-#define GEN_MFCR(buf, rt) gen_xfx_form (buf, 31, rt, 0, 19)
-#define GEN_MTCR(buf, rt) gen_xfx_form (buf, 31, rt, 0x3cf, 144)
-#define GEN_SYNC(buf, L, E) gen_xfx_form (buf, 31, L & 0x3, \
- E & 0xf, 598)
-#define GEN_LWSYNC(buf) GEN_SYNC (buf, 1, 0)
-
+#define GEN_MFSPR(buf, rt, spr) gen_xfx_form (buf, 31, rt, spr, 339)
+#define GEN_MTSPR(buf, rt, spr) gen_xfx_form (buf, 31, rt, spr, 467)
+#define GEN_MFCR(buf, rt) gen_xfx_form (buf, 31, rt, 0, 19)
+#define GEN_MTCR(buf, rt) gen_xfx_form (buf, 31, rt, 0x3cf, 144)
+#define GEN_SYNC(buf, L, E) gen_xfx_form (buf, 31, L & 0x3, E & 0xf, 598)
+#define GEN_LWSYNC(buf) GEN_SYNC (buf, 1, 0)
/* Generate a x-form instruction in BUF and return the number of bytes written.
@@ -1227,13 +1192,12 @@ gen_x_form (uint32_t *buf, int opcd, int rst, int ra, int rb, int xo, int rc)
/* Followings are frequently used x-form instructions. */
-#define GEN_OR(buf, ra, rs, rb) gen_x_form (buf, 31, rs, ra, rb, 444, 0)
-#define GEN_MR(buf, ra, rs) GEN_OR (buf, ra, rs, rs)
-#define GEN_LWARX(buf, rt, ra, rb) gen_x_form (buf, 31, rt, ra, rb, 20, 0)
-#define GEN_STWCX(buf, rs, ra, rb) gen_x_form (buf, 31, rs, ra, rb, 150, 1)
+#define GEN_OR(buf, ra, rs, rb) gen_x_form (buf, 31, rs, ra, rb, 444, 0)
+#define GEN_MR(buf, ra, rs) GEN_OR (buf, ra, rs, rs)
+#define GEN_LWARX(buf, rt, ra, rb) gen_x_form (buf, 31, rt, ra, rb, 20, 0)
+#define GEN_STWCX(buf, rs, ra, rb) gen_x_form (buf, 31, rs, ra, rb, 150, 1)
/* Assume bf = cr7. */
-#define GEN_CMPW(buf, ra, rb) gen_x_form (buf, 31, 28, ra, rb, 0, 0)
-
+#define GEN_CMPW(buf, ra, rb) gen_x_form (buf, 31, 28, ra, rb, 0, 0)
/* Generate a md-form instruction in BUF and return the number of bytes written.
@@ -1241,8 +1205,8 @@ gen_x_form (uint32_t *buf, int opcd, int rst, int ra, int rb, int xo, int rc)
| OPCD | RS | RA | sh | mb | XO |sh|Rc| */
static int
-gen_md_form (uint32_t *buf, int opcd, int rs, int ra, int sh, int mb,
- int xo, int rc)
+gen_md_form (uint32_t *buf, int opcd, int rs, int ra, int sh, int mb, int xo,
+ int rc)
{
uint32_t insn;
unsigned int n = ((mb & 0x1f) << 1) | ((mb >> 5) & 0x1);
@@ -1257,18 +1221,18 @@ gen_md_form (uint32_t *buf, int opcd, int rs, int ra, int sh, int mb,
gdb_assert ((xo & ~0x7) == 0);
gdb_assert ((rc & ~0x1) == 0);
- insn = (rs << 21) | (ra << 16) | (sh0_4 << 11) | (n << 5)
- | (sh5 << 1) | (xo << 2) | (rc & 1);
+ insn = (rs << 21) | (ra << 16) | (sh0_4 << 11) | (n << 5) | (sh5 << 1)
+ | (xo << 2) | (rc & 1);
*buf = (opcd << 26) | insn;
return 1;
}
/* The following are frequently used md-form instructions. */
-#define GEN_RLDICL(buf, ra, rs ,sh, mb) \
- gen_md_form (buf, 30, rs, ra, sh, mb, 0, 0)
-#define GEN_RLDICR(buf, ra, rs ,sh, mb) \
- gen_md_form (buf, 30, rs, ra, sh, mb, 1, 0)
+#define GEN_RLDICL(buf, ra, rs, sh, mb) \
+ gen_md_form (buf, 30, rs, ra, sh, mb, 0, 0)
+#define GEN_RLDICR(buf, ra, rs, sh, mb) \
+ gen_md_form (buf, 30, rs, ra, sh, mb, 1, 0)
/* Generate a i-form instruction in BUF and return the number of bytes written.
@@ -1289,8 +1253,8 @@ gen_i_form (uint32_t *buf, int opcd, int li, int aa, int lk)
/* The following are frequently used i-form instructions. */
-#define GEN_B(buf, li) gen_i_form (buf, 18, li, 0, 0)
-#define GEN_BL(buf, li) gen_i_form (buf, 18, li, 0, 1)
+#define GEN_B(buf, li) gen_i_form (buf, 18, li, 0, 0)
+#define GEN_BL(buf, li) gen_i_form (buf, 18, li, 0, 1)
/* Generate a b-form instruction in BUF and return the number of bytes written.
@@ -1298,8 +1262,7 @@ gen_i_form (uint32_t *buf, int opcd, int li, int aa, int lk)
| OPCD | BO | BI | BD |AA|LK| */
static int
-gen_b_form (uint32_t *buf, int opcd, int bo, int bi, int bd,
- int aa, int lk)
+gen_b_form (uint32_t *buf, int opcd, int bo, int bi, int bd, int aa, int lk)
{
uint32_t insn;
@@ -1314,22 +1277,20 @@ gen_b_form (uint32_t *buf, int opcd, int bo, int bi, int bd,
/* The following are frequently used b-form instructions. */
/* Assume bi = cr7. */
-#define GEN_BNE(buf, bd) gen_b_form (buf, 16, 0x4, (7 << 2) | 2, bd, 0 ,0)
+#define GEN_BNE(buf, bd) gen_b_form (buf, 16, 0x4, (7 << 2) | 2, bd, 0, 0)
/* GEN_LOAD and GEN_STORE generate 64- or 32-bit load/store for ppc64 or ppc32
respectively. They are primary used for save/restore GPRs in jump-pad,
not used for bytecode compiling. */
#ifdef __powerpc64__
-#define GEN_LOAD(buf, rt, ra, si, is_64) (is_64 ? \
- GEN_LD (buf, rt, ra, si) : \
- GEN_LWZ (buf, rt, ra, si))
-#define GEN_STORE(buf, rt, ra, si, is_64) (is_64 ? \
- GEN_STD (buf, rt, ra, si) : \
- GEN_STW (buf, rt, ra, si))
+#define GEN_LOAD(buf, rt, ra, si, is_64) \
+ (is_64 ? GEN_LD (buf, rt, ra, si) : GEN_LWZ (buf, rt, ra, si))
+#define GEN_STORE(buf, rt, ra, si, is_64) \
+ (is_64 ? GEN_STD (buf, rt, ra, si) : GEN_STW (buf, rt, ra, si))
#else
-#define GEN_LOAD(buf, rt, ra, si, is_64) GEN_LWZ (buf, rt, ra, si)
-#define GEN_STORE(buf, rt, ra, si, is_64) GEN_STW (buf, rt, ra, si)
+#define GEN_LOAD(buf, rt, ra, si, is_64) GEN_LWZ (buf, rt, ra, si)
+#define GEN_STORE(buf, rt, ra, si, is_64) GEN_STW (buf, rt, ra, si)
#endif
/* Generate a sequence of instructions to load IMM in the register REG.
@@ -1352,10 +1313,10 @@ gen_limm (uint32_t *buf, int reg, uint64_t imm, int is_64)
rldicl reg, reg, 0, 32 */
p += GEN_LIS (p, reg, (imm >> 16) & 0xffff);
if ((imm & 0xffff) != 0)
- p += GEN_ORI (p, reg, reg, imm & 0xffff);
+ p += GEN_ORI (p, reg, reg, imm & 0xffff);
/* Clear upper 32-bit if sign-bit is set. */
if (imm & (1u << 31) && is_64)
- p += GEN_RLDICL (p, reg, reg, 0, 32);
+ p += GEN_RLDICL (p, reg, reg, 0, 32);
}
else
{
@@ -1367,12 +1328,12 @@ gen_limm (uint32_t *buf, int reg, uint64_t imm, int is_64)
ori reg, reg, <imm[15:0]> */
p += GEN_LIS (p, reg, ((imm >> 48) & 0xffff));
if (((imm >> 32) & 0xffff) != 0)
- p += GEN_ORI (p, reg, reg, ((imm >> 32) & 0xffff));
+ p += GEN_ORI (p, reg, reg, ((imm >> 32) & 0xffff));
p += GEN_RLDICR (p, reg, reg, 32, 31);
if (((imm >> 16) & 0xffff) != 0)
- p += GEN_ORIS (p, reg, reg, ((imm >> 16) & 0xffff));
+ p += GEN_ORIS (p, reg, reg, ((imm >> 16) & 0xffff));
if ((imm & 0xffff) != 0)
- p += GEN_ORI (p, reg, reg, (imm & 0xffff));
+ p += GEN_ORI (p, reg, reg, (imm & 0xffff));
}
return p - buf;
@@ -1385,7 +1346,7 @@ gen_limm (uint32_t *buf, int reg, uint64_t imm, int is_64)
static int
gen_atomic_xchg (uint32_t *buf, CORE_ADDR lock, int old_value, int r_new,
- int is_64)
+ int is_64)
{
const int r_lock = 6;
const int r_old = 7;
@@ -1427,8 +1388,8 @@ gen_call (uint32_t *buf, CORE_ADDR fn, int is_64, int is_opd)
p += GEN_LOAD (p, 2, 12, 8, is_64);
p += GEN_LOAD (p, 12, 12, 0, is_64);
}
- p += GEN_MTSPR (p, 12, 9); /* mtctr r12 */
- *p++ = 0x4e800421; /* bctrl */
+ p += GEN_MTSPR (p, 12, 9); /* mtctr r12 */
+ *p++ = 0x4e800421; /* bctrl */
return p - buf;
}
@@ -1454,7 +1415,7 @@ ppc_relocate_instruction (CORE_ADDR *to, CORE_ADDR oldloc)
/* Out of range. Cannot relocate instruction. */
if (newrel >= (1 << 25) || newrel < -(1 << 25))
- return;
+ return;
insn = (insn & ~0x3fffffc) | (newrel & 0x3fffffc);
}
@@ -1503,75 +1464,75 @@ ppc_relocate_instruction (CORE_ADDR *to, CORE_ADDR oldloc)
newrel = (oldloc - *to) + rel;
if (newrel < (1 << 15) && newrel >= -(1 << 15))
- insn = (insn & ~0xfffc) | (newrel & 0xfffc);
+ insn = (insn & ~0xfffc) | (newrel & 0xfffc);
else if ((PPC_BO (insn) & 0x14) == 0x4 || (PPC_BO (insn) & 0x14) == 0x10)
- {
- newrel -= 4;
-
- /* Out of range. Cannot relocate instruction. */
- if (newrel >= (1 << 25) || newrel < -(1 << 25))
- return;
-
- if ((PPC_BO (insn) & 0x14) == 0x4)
- insn ^= (1 << 24);
- else if ((PPC_BO (insn) & 0x14) == 0x10)
- insn ^= (1 << 22);
-
- /* Jump over the unconditional branch. */
- insn = (insn & ~0xfffc) | 0x8;
- target_write_memory (*to, (unsigned char *) &insn, 4);
- *to += 4;
-
- /* Build a unconditional branch and copy LK bit. */
- insn = (18 << 26) | (0x3fffffc & newrel) | (insn & 0x3);
- target_write_memory (*to, (unsigned char *) &insn, 4);
- *to += 4;
-
- return;
- }
+ {
+ newrel -= 4;
+
+ /* Out of range. Cannot relocate instruction. */
+ if (newrel >= (1 << 25) || newrel < -(1 << 25))
+ return;
+
+ if ((PPC_BO (insn) & 0x14) == 0x4)
+ insn ^= (1 << 24);
+ else if ((PPC_BO (insn) & 0x14) == 0x10)
+ insn ^= (1 << 22);
+
+ /* Jump over the unconditional branch. */
+ insn = (insn & ~0xfffc) | 0x8;
+ target_write_memory (*to, (unsigned char *) &insn, 4);
+ *to += 4;
+
+ /* Build a unconditional branch and copy LK bit. */
+ insn = (18 << 26) | (0x3fffffc & newrel) | (insn & 0x3);
+ target_write_memory (*to, (unsigned char *) &insn, 4);
+ *to += 4;
+
+ return;
+ }
else if ((PPC_BO (insn) & 0x14) == 0)
- {
- uint32_t bdnz_insn = (16 << 26) | (0x10 << 21) | 12;
- uint32_t bf_insn = (16 << 26) | (0x4 << 21) | 8;
+ {
+ uint32_t bdnz_insn = (16 << 26) | (0x10 << 21) | 12;
+ uint32_t bf_insn = (16 << 26) | (0x4 << 21) | 8;
- newrel -= 8;
+ newrel -= 8;
- /* Out of range. Cannot relocate instruction. */
- if (newrel >= (1 << 25) || newrel < -(1 << 25))
- return;
+ /* Out of range. Cannot relocate instruction. */
+ if (newrel >= (1 << 25) || newrel < -(1 << 25))
+ return;
- /* Copy BI field. */
- bf_insn |= (insn & 0x1f0000);
+ /* Copy BI field. */
+ bf_insn |= (insn & 0x1f0000);
- /* Invert condition. */
- bdnz_insn |= (insn ^ (1 << 22)) & (1 << 22);
- bf_insn |= (insn ^ (1 << 24)) & (1 << 24);
+ /* Invert condition. */
+ bdnz_insn |= (insn ^ (1 << 22)) & (1 << 22);
+ bf_insn |= (insn ^ (1 << 24)) & (1 << 24);
- target_write_memory (*to, (unsigned char *) &bdnz_insn, 4);
- *to += 4;
- target_write_memory (*to, (unsigned char *) &bf_insn, 4);
- *to += 4;
+ target_write_memory (*to, (unsigned char *) &bdnz_insn, 4);
+ *to += 4;
+ target_write_memory (*to, (unsigned char *) &bf_insn, 4);
+ *to += 4;
- /* Build a unconditional branch and copy LK bit. */
- insn = (18 << 26) | (0x3fffffc & newrel) | (insn & 0x3);
- target_write_memory (*to, (unsigned char *) &insn, 4);
- *to += 4;
+ /* Build a unconditional branch and copy LK bit. */
+ insn = (18 << 26) | (0x3fffffc & newrel) | (insn & 0x3);
+ target_write_memory (*to, (unsigned char *) &insn, 4);
+ *to += 4;
- return;
- }
+ return;
+ }
else /* (BO & 0x14) == 0x14, branch always. */
- {
- /* Out of range. Cannot relocate instruction. */
- if (newrel >= (1 << 25) || newrel < -(1 << 25))
- return;
-
- /* Build a unconditional branch and copy LK bit. */
- insn = (18 << 26) | (0x3fffffc & newrel) | (insn & 0x3);
- target_write_memory (*to, (unsigned char *) &insn, 4);
- *to += 4;
-
- return;
- }
+ {
+ /* Out of range. Cannot relocate instruction. */
+ if (newrel >= (1 << 25) || newrel < -(1 << 25))
+ return;
+
+ /* Build a unconditional branch and copy LK bit. */
+ insn = (18 << 26) | (0x3fffffc & newrel) | (insn & 0x3);
+ target_write_memory (*to, (unsigned char *) &insn, 4);
+ *to += 4;
+
+ return;
+ }
}
target_write_memory (*to, (unsigned char *) &insn, 4);
@@ -1588,19 +1549,12 @@ ppc_target::supports_fast_tracepoints ()
See target.h for details. */
int
-ppc_target::install_fast_tracepoint_jump_pad (CORE_ADDR tpoint,
- CORE_ADDR tpaddr,
- CORE_ADDR collector,
- CORE_ADDR lockaddr,
- ULONGEST orig_size,
- CORE_ADDR *jump_entry,
- CORE_ADDR *trampoline,
- ULONGEST *trampoline_size,
- unsigned char *jjump_pad_insn,
- ULONGEST *jjump_pad_insn_size,
- CORE_ADDR *adjusted_insn_addr,
- CORE_ADDR *adjusted_insn_addr_end,
- char *err)
+ppc_target::install_fast_tracepoint_jump_pad (
+ CORE_ADDR tpoint, CORE_ADDR tpaddr, CORE_ADDR collector, CORE_ADDR lockaddr,
+ ULONGEST orig_size, CORE_ADDR *jump_entry, CORE_ADDR *trampoline,
+ ULONGEST *trampoline_size, unsigned char *jjump_pad_insn,
+ ULONGEST *jjump_pad_insn_size, CORE_ADDR *adjusted_insn_addr,
+ CORE_ADDR *adjusted_insn_addr_end, char *err)
{
uint32_t buf[256];
uint32_t *p = buf;
@@ -1669,9 +1623,9 @@ ppc_target::install_fast_tracepoint_jump_pad (CORE_ADDR tpoint,
/* Adjust stack pointer. */
if (is_64)
- p += GEN_STDU (p, 1, 1, -frame_size); /* stdu r1,-frame_size(r1) */
+ p += GEN_STDU (p, 1, 1, -frame_size); /* stdu r1,-frame_size(r1) */
else
- p += GEN_STWU (p, 1, 1, -frame_size); /* stwu r1,-frame_size(r1) */
+ p += GEN_STWU (p, 1, 1, -frame_size); /* stwu r1,-frame_size(r1) */
/* Store GPRs. Save R1 later, because it had just been modified, but
we want the original value. */
@@ -1684,20 +1638,23 @@ ppc_target::install_fast_tracepoint_jump_pad (CORE_ADDR tpoint,
p += GEN_STORE (p, 0, 1, min_frame + 1 * rsz, is_64);
/* Save CR, XER, LR, and CTR. */
- p += GEN_MFCR (p, 3); /* mfcr r3 */
- p += GEN_MFSPR (p, 4, 1); /* mfxer r4 */
- p += GEN_MFSPR (p, 5, 8); /* mflr r5 */
- p += GEN_MFSPR (p, 6, 9); /* mfctr r6 */
- p += GEN_STORE (p, 3, 1, min_frame + 32 * rsz, is_64);/* std r3, 32(r1) */
- p += GEN_STORE (p, 4, 1, min_frame + 33 * rsz, is_64);/* std r4, 33(r1) */
- p += GEN_STORE (p, 5, 1, min_frame + 34 * rsz, is_64);/* std r5, 34(r1) */
- p += GEN_STORE (p, 6, 1, min_frame + 35 * rsz, is_64);/* std r6, 35(r1) */
+ p += GEN_MFCR (p, 3); /* mfcr r3 */
+ p += GEN_MFSPR (p, 4, 1); /* mfxer r4 */
+ p += GEN_MFSPR (p, 5, 8); /* mflr r5 */
+ p += GEN_MFSPR (p, 6, 9); /* mfctr r6 */
+ p += GEN_STORE (p, 3, 1, min_frame + 32 * rsz,
+ is_64); /* std r3, 32(r1) */
+ p += GEN_STORE (p, 4, 1, min_frame + 33 * rsz,
+ is_64); /* std r4, 33(r1) */
+ p += GEN_STORE (p, 5, 1, min_frame + 34 * rsz,
+ is_64); /* std r5, 34(r1) */
+ p += GEN_STORE (p, 6, 1, min_frame + 35 * rsz,
+ is_64); /* std r6, 35(r1) */
/* Save PC<tpaddr> */
p += gen_limm (p, 3, tpaddr, is_64);
p += GEN_STORE (p, 3, 1, min_frame + 36 * rsz, is_64);
-
/* Setup arguments to collector. */
/* Set r4 to collected registers. */
p += GEN_ADDI (p, 4, 1, min_frame);
@@ -1724,14 +1681,14 @@ ppc_target::install_fast_tracepoint_jump_pad (CORE_ADDR tpoint,
p += GEN_STORE (p, 4, 3, 0, is_64);
/* Restore stack and registers. */
- p += GEN_LOAD (p, 3, 1, min_frame + 32 * rsz, is_64); /* ld r3, 32(r1) */
- p += GEN_LOAD (p, 4, 1, min_frame + 33 * rsz, is_64); /* ld r4, 33(r1) */
- p += GEN_LOAD (p, 5, 1, min_frame + 34 * rsz, is_64); /* ld r5, 34(r1) */
- p += GEN_LOAD (p, 6, 1, min_frame + 35 * rsz, is_64); /* ld r6, 35(r1) */
- p += GEN_MTCR (p, 3); /* mtcr r3 */
- p += GEN_MTSPR (p, 4, 1); /* mtxer r4 */
- p += GEN_MTSPR (p, 5, 8); /* mtlr r5 */
- p += GEN_MTSPR (p, 6, 9); /* mtctr r6 */
+ p += GEN_LOAD (p, 3, 1, min_frame + 32 * rsz, is_64); /* ld r3, 32(r1) */
+ p += GEN_LOAD (p, 4, 1, min_frame + 33 * rsz, is_64); /* ld r4, 33(r1) */
+ p += GEN_LOAD (p, 5, 1, min_frame + 34 * rsz, is_64); /* ld r5, 34(r1) */
+ p += GEN_LOAD (p, 6, 1, min_frame + 35 * rsz, is_64); /* ld r6, 35(r1) */
+ p += GEN_MTCR (p, 3); /* mtcr r3 */
+ p += GEN_MTSPR (p, 4, 1); /* mtxer r4 */
+ p += GEN_MTSPR (p, 5, 8); /* mtlr r5 */
+ p += GEN_MTSPR (p, 6, 9); /* mtctr r6 */
/* Restore GPRs. */
for (j = 2; j < 32; j++)
@@ -1753,9 +1710,10 @@ ppc_target::install_fast_tracepoint_jump_pad (CORE_ADDR tpoint,
if ((*adjusted_insn_addr_end - *adjusted_insn_addr == 0)
|| (*adjusted_insn_addr_end - *adjusted_insn_addr > 12))
{
- sprintf (err, "E.Unexpected instruction length = %d"
- "when relocate instruction.",
- (int) (*adjusted_insn_addr_end - *adjusted_insn_addr));
+ sprintf (err,
+ "E.Unexpected instruction length = %d"
+ "when relocate instruction.",
+ (int) (*adjusted_insn_addr_end - *adjusted_insn_addr));
return 1;
}
@@ -1765,8 +1723,10 @@ ppc_target::install_fast_tracepoint_jump_pad (CORE_ADDR tpoint,
offset = (tpaddr + 4) - buildaddr;
if (offset >= (1 << 25) || offset < -(1 << 25))
{
- sprintf (err, "E.Jump back from jump pad too far from tracepoint "
- "(offset 0x%x > 26-bit).", offset);
+ sprintf (err,
+ "E.Jump back from jump pad too far from tracepoint "
+ "(offset 0x%x > 26-bit).",
+ offset);
return 1;
}
/* b <tpaddr+4> */
@@ -1781,8 +1741,10 @@ ppc_target::install_fast_tracepoint_jump_pad (CORE_ADDR tpoint,
offset = entryaddr - tpaddr;
if (offset >= (1 << 25) || offset < -(1 << 25))
{
- sprintf (err, "E.Jump back from jump pad too far from tracepoint "
- "(offset 0x%x > 26-bit).", offset);
+ sprintf (err,
+ "E.Jump back from jump pad too far from tracepoint "
+ "(offset 0x%x > 26-bit).",
+ offset);
return 1;
}
/* b <jentry> */
@@ -1811,22 +1773,21 @@ emit_insns (uint32_t *buf, int n)
current_insn_ptr += n;
}
-#define __EMIT_ASM(NAME, INSNS) \
- do \
- { \
- extern uint32_t start_bcax_ ## NAME []; \
- extern uint32_t end_bcax_ ## NAME []; \
- emit_insns (start_bcax_ ## NAME, \
- end_bcax_ ## NAME - start_bcax_ ## NAME); \
- __asm__ (".section .text.__ppcbcax\n\t" \
- "start_bcax_" #NAME ":\n\t" \
- INSNS "\n\t" \
- "end_bcax_" #NAME ":\n\t" \
- ".previous\n\t"); \
- } while (0)
+#define __EMIT_ASM(NAME, INSNS) \
+ do \
+ { \
+ extern uint32_t start_bcax_##NAME[]; \
+ extern uint32_t end_bcax_##NAME[]; \
+ emit_insns (start_bcax_##NAME, end_bcax_##NAME - start_bcax_##NAME); \
+ __asm__ (".section .text.__ppcbcax\n\t" \
+ "start_bcax_" #NAME ":\n\t" INSNS "\n\t" \
+ "end_bcax_" #NAME ":\n\t" \
+ ".previous\n\t"); \
+ } \
+ while (0)
-#define _EMIT_ASM(NAME, INSNS) __EMIT_ASM (NAME, INSNS)
-#define EMIT_ASM(INSNS) _EMIT_ASM (__LINE__, INSNS)
+#define _EMIT_ASM(NAME, INSNS) __EMIT_ASM (NAME, INSNS)
+#define EMIT_ASM(INSNS) _EMIT_ASM (__LINE__, INSNS)
/*
@@ -1875,15 +1836,15 @@ emit_insns (uint32_t *buf, int n)
Likewise, to simplify code, have a similiar define for 5:6. */
#if __BYTE_ORDER == __LITTLE_ENDIAN
-#define TOP_FIRST "4"
-#define TOP_SECOND "3"
-#define TMP_FIRST "6"
-#define TMP_SECOND "5"
+#define TOP_FIRST "4"
+#define TOP_SECOND "3"
+#define TMP_FIRST "6"
+#define TMP_SECOND "5"
#else
-#define TOP_FIRST "3"
-#define TOP_SECOND "4"
-#define TMP_FIRST "5"
-#define TMP_SECOND "6"
+#define TOP_FIRST "3"
+#define TOP_SECOND "4"
+#define TMP_FIRST "5"
+#define TMP_SECOND "6"
#endif
/* Emit prologue in inferior memory. See above comments. */
@@ -1892,22 +1853,22 @@ static void
ppc_emit_prologue (void)
{
EMIT_ASM (/* Save return address. */
- "mflr 0 \n"
- "stw 0, 4(1) \n"
- /* Adjust SP. 96 is the initial frame size. */
- "stwu 1, -96(1) \n"
- /* Save r30 and incoming arguments. */
- "stw 31, 96-4(1) \n"
- "stw 30, 96-8(1) \n"
- "stw 4, 96-12(1) \n"
- "stw 3, 96-16(1) \n"
- /* Point r31 to original r1 for access arguments. */
- "addi 31, 1, 96 \n"
- /* Set r30 to pointing stack-top. */
- "addi 30, 1, 64 \n"
- /* Initial r3/TOP to 0. */
- "li 3, 0 \n"
- "li 4, 0 \n");
+ "mflr 0 \n"
+ "stw 0, 4(1) \n"
+ /* Adjust SP. 96 is the initial frame size. */
+ "stwu 1, -96(1) \n"
+ /* Save r30 and incoming arguments. */
+ "stw 31, 96-4(1) \n"
+ "stw 30, 96-8(1) \n"
+ "stw 4, 96-12(1) \n"
+ "stw 3, 96-16(1) \n"
+ /* Point r31 to original r1 for access arguments. */
+ "addi 31, 1, 96 \n"
+ /* Set r30 to pointing stack-top. */
+ "addi 30, 1, 64 \n"
+ /* Initial r3/TOP to 0. */
+ "li 3, 0 \n"
+ "li 4, 0 \n");
}
/* Emit epilogue in inferior memory. See above comments. */
@@ -1916,20 +1877,20 @@ static void
ppc_emit_epilogue (void)
{
EMIT_ASM (/* *result = TOP */
- "lwz 5, -12(31) \n"
- "stw " TOP_FIRST ", 0(5) \n"
- "stw " TOP_SECOND ", 4(5) \n"
- /* Restore registers. */
- "lwz 31, -4(31) \n"
- "lwz 30, -8(31) \n"
- /* Restore SP. */
- "lwz 1, 0(1) \n"
- /* Restore LR. */
- "lwz 0, 4(1) \n"
- /* Return 0 for no-error. */
- "li 3, 0 \n"
- "mtlr 0 \n"
- "blr \n");
+ "lwz 5, -12(31) \n"
+ "stw " TOP_FIRST ", 0(5) \n"
+ "stw " TOP_SECOND ", 4(5) \n"
+ /* Restore registers. */
+ "lwz 31, -4(31) \n"
+ "lwz 30, -8(31) \n"
+ /* Restore SP. */
+ "lwz 1, 0(1) \n"
+ /* Restore LR. */
+ "lwz 0, 4(1) \n"
+ /* Return 0 for no-error. */
+ "li 3, 0 \n"
+ "mtlr 0 \n"
+ "blr \n");
}
/* TOP = stack[--sp] + TOP */
@@ -1938,9 +1899,9 @@ static void
ppc_emit_add (void)
{
EMIT_ASM ("lwzu " TMP_FIRST ", 8(30) \n"
- "lwz " TMP_SECOND ", 4(30)\n"
- "addc 4, 6, 4 \n"
- "adde 3, 5, 3 \n");
+ "lwz " TMP_SECOND ", 4(30)\n"
+ "addc 4, 6, 4 \n"
+ "adde 3, 5, 3 \n");
}
/* TOP = stack[--sp] - TOP */
@@ -1949,9 +1910,9 @@ static void
ppc_emit_sub (void)
{
EMIT_ASM ("lwzu " TMP_FIRST ", 8(30) \n"
- "lwz " TMP_SECOND ", 4(30) \n"
- "subfc 4, 4, 6 \n"
- "subfe 3, 3, 5 \n");
+ "lwz " TMP_SECOND ", 4(30) \n"
+ "subfc 4, 4, 6 \n"
+ "subfe 3, 3, 5 \n");
}
/* TOP = stack[--sp] * TOP */
@@ -1960,13 +1921,13 @@ static void
ppc_emit_mul (void)
{
EMIT_ASM ("lwzu " TMP_FIRST ", 8(30) \n"
- "lwz " TMP_SECOND ", 4(30) \n"
- "mulhwu 7, 6, 4 \n"
- "mullw 3, 6, 3 \n"
- "mullw 5, 4, 5 \n"
- "mullw 4, 6, 4 \n"
- "add 3, 5, 3 \n"
- "add 3, 7, 3 \n");
+ "lwz " TMP_SECOND ", 4(30) \n"
+ "mulhwu 7, 6, 4 \n"
+ "mullw 3, 6, 3 \n"
+ "mullw 5, 4, 5 \n"
+ "mullw 4, 6, 4 \n"
+ "add 3, 5, 3 \n"
+ "add 3, 7, 3 \n");
}
/* TOP = stack[--sp] << TOP */
@@ -1975,15 +1936,15 @@ static void
ppc_emit_lsh (void)
{
EMIT_ASM ("lwzu " TMP_FIRST ", 8(30) \n"
- "lwz " TMP_SECOND ", 4(30) \n"
- "subfic 3, 4, 32\n" /* r3 = 32 - TOP */
- "addi 7, 4, -32\n" /* r7 = TOP - 32 */
- "slw 5, 5, 4\n" /* Shift high part left */
- "slw 4, 6, 4\n" /* Shift low part left */
- "srw 3, 6, 3\n" /* Shift low to high if shift < 32 */
- "slw 7, 6, 7\n" /* Shift low to high if shift >= 32 */
- "or 3, 5, 3\n"
- "or 3, 7, 3\n"); /* Assemble high part */
+ "lwz " TMP_SECOND ", 4(30) \n"
+ "subfic 3, 4, 32\n" /* r3 = 32 - TOP */
+ "addi 7, 4, -32\n" /* r7 = TOP - 32 */
+ "slw 5, 5, 4\n" /* Shift high part left */
+ "slw 4, 6, 4\n" /* Shift low part left */
+ "srw 3, 6, 3\n" /* Shift low to high if shift < 32 */
+ "slw 7, 6, 7\n" /* Shift low to high if shift >= 32 */
+ "or 3, 5, 3\n"
+ "or 3, 7, 3\n"); /* Assemble high part */
}
/* Top = stack[--sp] >> TOP
@@ -1993,19 +1954,19 @@ static void
ppc_emit_rsh_signed (void)
{
EMIT_ASM ("lwzu " TMP_FIRST ", 8(30) \n"
- "lwz " TMP_SECOND ", 4(30) \n"
- "addi 7, 4, -32\n" /* r7 = TOP - 32 */
- "sraw 3, 5, 4\n" /* Shift high part right */
- "cmpwi 7, 1\n"
- "blt 0, 1f\n" /* If shift <= 32, goto 1: */
- "sraw 4, 5, 7\n" /* Shift high to low */
- "b 2f\n"
- "1:\n"
- "subfic 7, 4, 32\n" /* r7 = 32 - TOP */
- "srw 4, 6, 4\n" /* Shift low part right */
- "slw 5, 5, 7\n" /* Shift high to low */
- "or 4, 4, 5\n" /* Assemble low part */
- "2:\n");
+ "lwz " TMP_SECOND ", 4(30) \n"
+ "addi 7, 4, -32\n" /* r7 = TOP - 32 */
+ "sraw 3, 5, 4\n" /* Shift high part right */
+ "cmpwi 7, 1\n"
+ "blt 0, 1f\n" /* If shift <= 32, goto 1: */
+ "sraw 4, 5, 7\n" /* Shift high to low */
+ "b 2f\n"
+ "1:\n"
+ "subfic 7, 4, 32\n" /* r7 = 32 - TOP */
+ "srw 4, 6, 4\n" /* Shift low part right */
+ "slw 5, 5, 7\n" /* Shift high to low */
+ "or 4, 4, 5\n" /* Assemble low part */
+ "2:\n");
}
/* Top = stack[--sp] >> TOP
@@ -2015,15 +1976,15 @@ static void
ppc_emit_rsh_unsigned (void)
{
EMIT_ASM ("lwzu " TMP_FIRST ", 8(30) \n"
- "lwz " TMP_SECOND ", 4(30) \n"
- "subfic 3, 4, 32\n" /* r3 = 32 - TOP */
- "addi 7, 4, -32\n" /* r7 = TOP - 32 */
- "srw 6, 6, 4\n" /* Shift low part right */
- "slw 3, 5, 3\n" /* Shift high to low if shift < 32 */
- "srw 7, 5, 7\n" /* Shift high to low if shift >= 32 */
- "or 6, 6, 3\n"
- "srw 3, 5, 4\n" /* Shift high part right */
- "or 4, 6, 7\n"); /* Assemble low part */
+ "lwz " TMP_SECOND ", 4(30) \n"
+ "subfic 3, 4, 32\n" /* r3 = 32 - TOP */
+ "addi 7, 4, -32\n" /* r7 = TOP - 32 */
+ "srw 6, 6, 4\n" /* Shift low part right */
+ "slw 3, 5, 3\n" /* Shift high to low if shift < 32 */
+ "srw 7, 5, 7\n" /* Shift high to low if shift >= 32 */
+ "or 6, 6, 3\n"
+ "srw 3, 5, 4\n" /* Shift high part right */
+ "or 4, 6, 7\n"); /* Assemble low part */
}
/* Emit code for signed-extension specified by ARG. */
@@ -2035,11 +1996,11 @@ ppc_emit_ext (int arg)
{
case 8:
EMIT_ASM ("extsb 4, 4\n"
- "srawi 3, 4, 31");
+ "srawi 3, 4, 31");
break;
case 16:
EMIT_ASM ("extsh 4, 4\n"
- "srawi 3, 4, 31");
+ "srawi 3, 4, 31");
break;
case 32:
EMIT_ASM ("srawi 3, 4, 31");
@@ -2058,11 +2019,11 @@ ppc_emit_zero_ext (int arg)
{
case 8:
EMIT_ASM ("clrlwi 4,4,24\n"
- "li 3, 0\n");
+ "li 3, 0\n");
break;
case 16:
EMIT_ASM ("clrlwi 4,4,16\n"
- "li 3, 0\n");
+ "li 3, 0\n");
break;
case 32:
EMIT_ASM ("li 3, 0");
@@ -2079,9 +2040,9 @@ static void
ppc_emit_log_not (void)
{
EMIT_ASM ("or 4, 3, 4 \n"
- "cntlzw 4, 4 \n"
- "srwi 4, 4, 5 \n"
- "li 3, 0 \n");
+ "cntlzw 4, 4 \n"
+ "srwi 4, 4, 5 \n"
+ "li 3, 0 \n");
}
/* TOP = stack[--sp] & TOP */
@@ -2090,9 +2051,9 @@ static void
ppc_emit_bit_and (void)
{
EMIT_ASM ("lwzu " TMP_FIRST ", 8(30) \n"
- "lwz " TMP_SECOND ", 4(30) \n"
- "and 4, 6, 4 \n"
- "and 3, 5, 3 \n");
+ "lwz " TMP_SECOND ", 4(30) \n"
+ "and 4, 6, 4 \n"
+ "and 3, 5, 3 \n");
}
/* TOP = stack[--sp] | TOP */
@@ -2101,9 +2062,9 @@ static void
ppc_emit_bit_or (void)
{
EMIT_ASM ("lwzu " TMP_FIRST ", 8(30) \n"
- "lwz " TMP_SECOND ", 4(30) \n"
- "or 4, 6, 4 \n"
- "or 3, 5, 3 \n");
+ "lwz " TMP_SECOND ", 4(30) \n"
+ "or 4, 6, 4 \n"
+ "or 3, 5, 3 \n");
}
/* TOP = stack[--sp] ^ TOP */
@@ -2112,9 +2073,9 @@ static void
ppc_emit_bit_xor (void)
{
EMIT_ASM ("lwzu " TMP_FIRST ", 8(30) \n"
- "lwz " TMP_SECOND ", 4(30) \n"
- "xor 4, 6, 4 \n"
- "xor 3, 5, 3 \n");
+ "lwz " TMP_SECOND ", 4(30) \n"
+ "xor 4, 6, 4 \n"
+ "xor 3, 5, 3 \n");
}
/* TOP = ~TOP
@@ -2124,7 +2085,7 @@ static void
ppc_emit_bit_not (void)
{
EMIT_ASM ("nor 3, 3, 3 \n"
- "nor 4, 4, 4 \n");
+ "nor 4, 4, 4 \n");
}
/* TOP = stack[--sp] == TOP */
@@ -2133,13 +2094,13 @@ static void
ppc_emit_equal (void)
{
EMIT_ASM ("lwzu " TMP_FIRST ", 8(30) \n"
- "lwz " TMP_SECOND ", 4(30) \n"
- "xor 4, 6, 4 \n"
- "xor 3, 5, 3 \n"
- "or 4, 3, 4 \n"
- "cntlzw 4, 4 \n"
- "srwi 4, 4, 5 \n"
- "li 3, 0 \n");
+ "lwz " TMP_SECOND ", 4(30) \n"
+ "xor 4, 6, 4 \n"
+ "xor 3, 5, 3 \n"
+ "or 4, 3, 4 \n"
+ "cntlzw 4, 4 \n"
+ "srwi 4, 4, 5 \n"
+ "li 3, 0 \n");
}
/* TOP = stack[--sp] < TOP
@@ -2149,16 +2110,16 @@ static void
ppc_emit_less_signed (void)
{
EMIT_ASM ("lwzu " TMP_FIRST ", 8(30) \n"
- "lwz " TMP_SECOND ", 4(30) \n"
- "cmplw 6, 6, 4 \n"
- "cmpw 7, 5, 3 \n"
- /* CR6 bit 0 = low less and high equal */
- "crand 6*4+0, 6*4+0, 7*4+2\n"
- /* CR7 bit 0 = (low less and high equal) or high less */
- "cror 7*4+0, 7*4+0, 6*4+0\n"
- "mfcr 4 \n"
- "rlwinm 4, 4, 29, 31, 31 \n"
- "li 3, 0 \n");
+ "lwz " TMP_SECOND ", 4(30) \n"
+ "cmplw 6, 6, 4 \n"
+ "cmpw 7, 5, 3 \n"
+ /* CR6 bit 0 = low less and high equal */
+ "crand 6*4+0, 6*4+0, 7*4+2\n"
+ /* CR7 bit 0 = (low less and high equal) or high less */
+ "cror 7*4+0, 7*4+0, 6*4+0\n"
+ "mfcr 4 \n"
+ "rlwinm 4, 4, 29, 31, 31 \n"
+ "li 3, 0 \n");
}
/* TOP = stack[--sp] < TOP
@@ -2168,16 +2129,16 @@ static void
ppc_emit_less_unsigned (void)
{
EMIT_ASM ("lwzu " TMP_FIRST ", 8(30) \n"
- "lwz " TMP_SECOND ", 4(30) \n"
- "cmplw 6, 6, 4 \n"
- "cmplw 7, 5, 3 \n"
- /* CR6 bit 0 = low less and high equal */
- "crand 6*4+0, 6*4+0, 7*4+2\n"
- /* CR7 bit 0 = (low less and high equal) or high less */
- "cror 7*4+0, 7*4+0, 6*4+0\n"
- "mfcr 4 \n"
- "rlwinm 4, 4, 29, 31, 31 \n"
- "li 3, 0 \n");
+ "lwz " TMP_SECOND ", 4(30) \n"
+ "cmplw 6, 6, 4 \n"
+ "cmplw 7, 5, 3 \n"
+ /* CR6 bit 0 = low less and high equal */
+ "crand 6*4+0, 6*4+0, 7*4+2\n"
+ /* CR7 bit 0 = (low less and high equal) or high less */
+ "cror 7*4+0, 7*4+0, 6*4+0\n"
+ "mfcr 4 \n"
+ "rlwinm 4, 4, 29, 31, 31 \n"
+ "li 3, 0 \n");
}
/* Access the memory address in TOP in size of SIZE.
@@ -2190,23 +2151,23 @@ ppc_emit_ref (int size)
{
case 1:
EMIT_ASM ("lbz 4, 0(4)\n"
- "li 3, 0");
+ "li 3, 0");
break;
case 2:
EMIT_ASM ("lhz 4, 0(4)\n"
- "li 3, 0");
+ "li 3, 0");
break;
case 4:
EMIT_ASM ("lwz 4, 0(4)\n"
- "li 3, 0");
+ "li 3, 0");
break;
case 8:
if (__BYTE_ORDER == __LITTLE_ENDIAN)
- EMIT_ASM ("lwz 3, 4(4)\n"
- "lwz 4, 0(4)");
+ EMIT_ASM ("lwz 3, 4(4)\n"
+ "lwz 4, 0(4)");
else
- EMIT_ASM ("lwz 3, 0(4)\n"
- "lwz 4, 4(4)");
+ EMIT_ASM ("lwz 3, 0(4)\n"
+ "lwz 4, 4(4)");
break;
}
}
@@ -2237,7 +2198,7 @@ ppc_emit_reg (int reg)
/* fctx->regs is passed in r3 and then saved in -16(31). */
p += GEN_LWZ (p, 3, 31, -16);
- p += GEN_LI (p, 4, reg); /* li r4, reg */
+ p += GEN_LI (p, 4, reg); /* li r4, reg */
p += gen_call (p, get_raw_reg_func_addr (), 0, 0);
emit_insns (buf, p - buf);
@@ -2246,8 +2207,8 @@ ppc_emit_reg (int reg)
if (__BYTE_ORDER == __LITTLE_ENDIAN)
{
EMIT_ASM ("mr 5, 4\n"
- "mr 4, 3\n"
- "mr 3, 5\n");
+ "mr 4, 3\n"
+ "mr 3, 5\n");
}
}
@@ -2257,7 +2218,7 @@ static void
ppc_emit_pop (void)
{
EMIT_ASM ("lwzu " TOP_FIRST ", 8(30) \n"
- "lwz " TOP_SECOND ", 4(30) \n");
+ "lwz " TOP_SECOND ", 4(30) \n");
}
/* stack[sp++] = TOP
@@ -2272,12 +2233,12 @@ ppc_emit_stack_flush (void)
Otherwise, expand 64-byte more. */
EMIT_ASM (" stw " TOP_FIRST ", 0(30) \n"
- " stw " TOP_SECOND ", 4(30)\n"
- " addi 5, 30, -(8 + 8) \n"
- " cmpw 7, 5, 1 \n"
- " bgt 7, 1f \n"
- " stwu 31, -64(1) \n"
- "1:addi 30, 30, -8 \n");
+ " stw " TOP_SECOND ", 4(30)\n"
+ " addi 5, 30, -(8 + 8) \n"
+ " cmpw 7, 5, 1 \n"
+ " bgt 7, 1f \n"
+ " stwu 31, -64(1) \n"
+ "1:addi 30, 30, -8 \n");
}
/* Swap TOP and stack[sp-1] */
@@ -2286,11 +2247,11 @@ static void
ppc_emit_swap (void)
{
EMIT_ASM ("lwz " TMP_FIRST ", 8(30) \n"
- "lwz " TMP_SECOND ", 12(30) \n"
- "stw " TOP_FIRST ", 8(30) \n"
- "stw " TOP_SECOND ", 12(30) \n"
- "mr 3, 5 \n"
- "mr 4, 6 \n");
+ "lwz " TMP_SECOND ", 12(30) \n"
+ "stw " TOP_FIRST ", 8(30) \n"
+ "stw " TOP_SECOND ", 12(30) \n"
+ "mr 3, 5 \n"
+ "mr 4, 6 \n");
}
/* Discard N elements in the stack. Also used for ppc64. */
@@ -2348,8 +2309,8 @@ ppc_emit_int_call_1 (CORE_ADDR fn, int arg1)
if (__BYTE_ORDER == __LITTLE_ENDIAN)
{
EMIT_ASM ("mr 5, 4\n"
- "mr 4, 3\n"
- "mr 3, 5\n");
+ "mr 4, 3\n"
+ "mr 3, 5\n");
}
}
@@ -2371,13 +2332,13 @@ ppc_emit_void_call_2 (CORE_ADDR fn, int arg1)
/* Setup argument. arg1 is a 16-bit value. */
if (__BYTE_ORDER == __LITTLE_ENDIAN)
{
- p += GEN_MR (p, 5, 4);
- p += GEN_MR (p, 6, 3);
+ p += GEN_MR (p, 5, 4);
+ p += GEN_MR (p, 6, 3);
}
else
{
- p += GEN_MR (p, 5, 3);
- p += GEN_MR (p, 6, 4);
+ p += GEN_MR (p, 5, 3);
+ p += GEN_MR (p, 6, 4);
}
p += gen_limm (p, 3, (uint32_t) arg1, 0);
p += gen_call (p, fn, 0, 0);
@@ -2405,9 +2366,9 @@ static void
ppc_emit_if_goto (int *offset_p, int *size_p)
{
EMIT_ASM ("or. 3, 3, 4 \n"
- "lwzu " TOP_FIRST ", 8(30) \n"
- "lwz " TOP_SECOND ", 4(30) \n"
- "1:bne 0, 1b \n");
+ "lwzu " TOP_FIRST ", 8(30) \n"
+ "lwz " TOP_SECOND ", 4(30) \n"
+ "1:bne 0, 1b \n");
if (offset_p)
*offset_p = 12;
@@ -2434,13 +2395,13 @@ static void
ppc_emit_eq_goto (int *offset_p, int *size_p)
{
EMIT_ASM ("lwzu " TMP_FIRST ", 8(30) \n"
- "lwz " TMP_SECOND ", 4(30) \n"
- "xor 4, 6, 4 \n"
- "xor 3, 5, 3 \n"
- "or. 3, 3, 4 \n"
- "lwzu " TOP_FIRST ", 8(30) \n"
- "lwz " TOP_SECOND ", 4(30) \n"
- "1:beq 0, 1b \n");
+ "lwz " TMP_SECOND ", 4(30) \n"
+ "xor 4, 6, 4 \n"
+ "xor 3, 5, 3 \n"
+ "or. 3, 3, 4 \n"
+ "lwzu " TOP_FIRST ", 8(30) \n"
+ "lwz " TOP_SECOND ", 4(30) \n"
+ "1:beq 0, 1b \n");
if (offset_p)
*offset_p = 28;
@@ -2454,13 +2415,13 @@ static void
ppc_emit_ne_goto (int *offset_p, int *size_p)
{
EMIT_ASM ("lwzu " TMP_FIRST ", 8(30) \n"
- "lwz " TMP_SECOND ", 4(30) \n"
- "xor 4, 6, 4 \n"
- "xor 3, 5, 3 \n"
- "or. 3, 3, 4 \n"
- "lwzu " TOP_FIRST ", 8(30) \n"
- "lwz " TOP_SECOND ", 4(30) \n"
- "1:bne 0, 1b \n");
+ "lwz " TMP_SECOND ", 4(30) \n"
+ "xor 4, 6, 4 \n"
+ "xor 3, 5, 3 \n"
+ "or. 3, 3, 4 \n"
+ "lwzu " TOP_FIRST ", 8(30) \n"
+ "lwz " TOP_SECOND ", 4(30) \n"
+ "1:bne 0, 1b \n");
if (offset_p)
*offset_p = 28;
@@ -2474,16 +2435,16 @@ static void
ppc_emit_lt_goto (int *offset_p, int *size_p)
{
EMIT_ASM ("lwzu " TMP_FIRST ", 8(30) \n"
- "lwz " TMP_SECOND ", 4(30) \n"
- "cmplw 6, 6, 4 \n"
- "cmpw 7, 5, 3 \n"
- /* CR6 bit 0 = low less and high equal */
- "crand 6*4+0, 6*4+0, 7*4+2\n"
- /* CR7 bit 0 = (low less and high equal) or high less */
- "cror 7*4+0, 7*4+0, 6*4+0\n"
- "lwzu " TOP_FIRST ", 8(30) \n"
- "lwz " TOP_SECOND ", 4(30)\n"
- "1:blt 7, 1b \n");
+ "lwz " TMP_SECOND ", 4(30) \n"
+ "cmplw 6, 6, 4 \n"
+ "cmpw 7, 5, 3 \n"
+ /* CR6 bit 0 = low less and high equal */
+ "crand 6*4+0, 6*4+0, 7*4+2\n"
+ /* CR7 bit 0 = (low less and high equal) or high less */
+ "cror 7*4+0, 7*4+0, 6*4+0\n"
+ "lwzu " TOP_FIRST ", 8(30) \n"
+ "lwz " TOP_SECOND ", 4(30)\n"
+ "1:blt 7, 1b \n");
if (offset_p)
*offset_p = 32;
@@ -2497,16 +2458,16 @@ static void
ppc_emit_le_goto (int *offset_p, int *size_p)
{
EMIT_ASM ("lwzu " TMP_FIRST ", 8(30) \n"
- "lwz " TMP_SECOND ", 4(30) \n"
- "cmplw 6, 6, 4 \n"
- "cmpw 7, 5, 3 \n"
- /* CR6 bit 0 = low less/equal and high equal */
- "crandc 6*4+0, 7*4+2, 6*4+1\n"
- /* CR7 bit 0 = (low less/eq and high equal) or high less */
- "cror 7*4+0, 7*4+0, 6*4+0\n"
- "lwzu " TOP_FIRST ", 8(30) \n"
- "lwz " TOP_SECOND ", 4(30)\n"
- "1:blt 7, 1b \n");
+ "lwz " TMP_SECOND ", 4(30) \n"
+ "cmplw 6, 6, 4 \n"
+ "cmpw 7, 5, 3 \n"
+ /* CR6 bit 0 = low less/equal and high equal */
+ "crandc 6*4+0, 7*4+2, 6*4+1\n"
+ /* CR7 bit 0 = (low less/eq and high equal) or high less */
+ "cror 7*4+0, 7*4+0, 6*4+0\n"
+ "lwzu " TOP_FIRST ", 8(30) \n"
+ "lwz " TOP_SECOND ", 4(30)\n"
+ "1:blt 7, 1b \n");
if (offset_p)
*offset_p = 32;
@@ -2520,16 +2481,16 @@ static void
ppc_emit_gt_goto (int *offset_p, int *size_p)
{
EMIT_ASM ("lwzu " TMP_FIRST ", 8(30) \n"
- "lwz " TMP_SECOND ", 4(30) \n"
- "cmplw 6, 6, 4 \n"
- "cmpw 7, 5, 3 \n"
- /* CR6 bit 0 = low greater and high equal */
- "crand 6*4+0, 6*4+1, 7*4+2\n"
- /* CR7 bit 0 = (low greater and high equal) or high greater */
- "cror 7*4+0, 7*4+1, 6*4+0\n"
- "lwzu " TOP_FIRST ", 8(30) \n"
- "lwz " TOP_SECOND ", 4(30)\n"
- "1:blt 7, 1b \n");
+ "lwz " TMP_SECOND ", 4(30) \n"
+ "cmplw 6, 6, 4 \n"
+ "cmpw 7, 5, 3 \n"
+ /* CR6 bit 0 = low greater and high equal */
+ "crand 6*4+0, 6*4+1, 7*4+2\n"
+ /* CR7 bit 0 = (low greater and high equal) or high greater */
+ "cror 7*4+0, 7*4+1, 6*4+0\n"
+ "lwzu " TOP_FIRST ", 8(30) \n"
+ "lwz " TOP_SECOND ", 4(30)\n"
+ "1:blt 7, 1b \n");
if (offset_p)
*offset_p = 32;
@@ -2543,16 +2504,16 @@ static void
ppc_emit_ge_goto (int *offset_p, int *size_p)
{
EMIT_ASM ("lwzu " TMP_FIRST ", 8(30) \n"
- "lwz " TMP_SECOND ", 4(30) \n"
- "cmplw 6, 6, 4 \n"
- "cmpw 7, 5, 3 \n"
- /* CR6 bit 0 = low ge and high equal */
- "crandc 6*4+0, 7*4+2, 6*4+0\n"
- /* CR7 bit 0 = (low ge and high equal) or high greater */
- "cror 7*4+0, 7*4+1, 6*4+0\n"
- "lwzu " TOP_FIRST ", 8(30)\n"
- "lwz " TOP_SECOND ", 4(30)\n"
- "1:blt 7, 1b \n");
+ "lwz " TMP_SECOND ", 4(30) \n"
+ "cmplw 6, 6, 4 \n"
+ "cmpw 7, 5, 3 \n"
+ /* CR6 bit 0 = low ge and high equal */
+ "crandc 6*4+0, 7*4+2, 6*4+0\n"
+ /* CR7 bit 0 = (low ge and high equal) or high greater */
+ "cror 7*4+0, 7*4+1, 6*4+0\n"
+ "lwzu " TOP_FIRST ", 8(30)\n"
+ "lwz " TOP_SECOND ", 4(30)\n"
+ "1:blt 7, 1b \n");
if (offset_p)
*offset_p = 32;
@@ -2579,15 +2540,13 @@ ppc_write_goto_address (CORE_ADDR from, CORE_ADDR to, int size)
switch (size)
{
case 14:
- if (opcd != 16
- || (rel >= (1 << 15) || rel < -(1 << 15)))
- emit_error = 1;
+ if (opcd != 16 || (rel >= (1 << 15) || rel < -(1 << 15)))
+ emit_error = 1;
insn = (insn & ~0xfffc) | (rel & 0xfffc);
break;
case 24:
- if (opcd != 18
- || (rel >= (1 << 25) || rel < -(1 << 25)))
- emit_error = 1;
+ if (opcd != 18 || (rel >= (1 << 25) || rel < -(1 << 25)))
+ emit_error = 1;
insn = (insn & ~0x3fffffc) | (rel & 0x3fffffc);
break;
default:
@@ -2600,46 +2559,20 @@ ppc_write_goto_address (CORE_ADDR from, CORE_ADDR to, int size)
/* Table of emit ops for 32-bit. */
-static struct emit_ops ppc_emit_ops_impl =
-{
- ppc_emit_prologue,
- ppc_emit_epilogue,
- ppc_emit_add,
- ppc_emit_sub,
- ppc_emit_mul,
- ppc_emit_lsh,
- ppc_emit_rsh_signed,
- ppc_emit_rsh_unsigned,
- ppc_emit_ext,
- ppc_emit_log_not,
- ppc_emit_bit_and,
- ppc_emit_bit_or,
- ppc_emit_bit_xor,
- ppc_emit_bit_not,
- ppc_emit_equal,
- ppc_emit_less_signed,
- ppc_emit_less_unsigned,
- ppc_emit_ref,
- ppc_emit_if_goto,
- ppc_emit_goto,
- ppc_write_goto_address,
- ppc_emit_const,
- ppc_emit_call,
- ppc_emit_reg,
- ppc_emit_pop,
- ppc_emit_stack_flush,
- ppc_emit_zero_ext,
- ppc_emit_swap,
- ppc_emit_stack_adjust,
- ppc_emit_int_call_1,
- ppc_emit_void_call_2,
- ppc_emit_eq_goto,
- ppc_emit_ne_goto,
- ppc_emit_lt_goto,
- ppc_emit_le_goto,
- ppc_emit_gt_goto,
- ppc_emit_ge_goto
-};
+static struct emit_ops ppc_emit_ops_impl
+ = { ppc_emit_prologue, ppc_emit_epilogue, ppc_emit_add,
+ ppc_emit_sub, ppc_emit_mul, ppc_emit_lsh,
+ ppc_emit_rsh_signed, ppc_emit_rsh_unsigned, ppc_emit_ext,
+ ppc_emit_log_not, ppc_emit_bit_and, ppc_emit_bit_or,
+ ppc_emit_bit_xor, ppc_emit_bit_not, ppc_emit_equal,
+ ppc_emit_less_signed, ppc_emit_less_unsigned, ppc_emit_ref,
+ ppc_emit_if_goto, ppc_emit_goto, ppc_write_goto_address,
+ ppc_emit_const, ppc_emit_call, ppc_emit_reg,
+ ppc_emit_pop, ppc_emit_stack_flush, ppc_emit_zero_ext,
+ ppc_emit_swap, ppc_emit_stack_adjust, ppc_emit_int_call_1,
+ ppc_emit_void_call_2, ppc_emit_eq_goto, ppc_emit_ne_goto,
+ ppc_emit_lt_goto, ppc_emit_le_goto, ppc_emit_gt_goto,
+ ppc_emit_ge_goto };
#ifdef __powerpc64__
@@ -2698,23 +2631,23 @@ ppc64v1_emit_prologue (void)
/* Mind the strict aliasing rules. */
memcpy (buf, &opd, sizeof buf);
- emit_insns(buf, 2);
+ emit_insns (buf, 2);
EMIT_ASM (/* Save return address. */
- "mflr 0 \n"
- "std 0, 16(1) \n"
- /* Save r30 and incoming arguments. */
- "std 31, -8(1) \n"
- "std 30, -16(1) \n"
- "std 4, -24(1) \n"
- "std 3, -32(1) \n"
- /* Point r31 to current r1 for access arguments. */
- "mr 31, 1 \n"
- /* Adjust SP. 208 is the initial frame size. */
- "stdu 1, -208(1) \n"
- /* Set r30 to pointing stack-top. */
- "addi 30, 1, 168 \n"
- /* Initial r3/TOP to 0. */
- "li 3, 0 \n");
+ "mflr 0 \n"
+ "std 0, 16(1) \n"
+ /* Save r30 and incoming arguments. */
+ "std 31, -8(1) \n"
+ "std 30, -16(1) \n"
+ "std 4, -24(1) \n"
+ "std 3, -32(1) \n"
+ /* Point r31 to current r1 for access arguments. */
+ "mr 31, 1 \n"
+ /* Adjust SP. 208 is the initial frame size. */
+ "stdu 1, -208(1) \n"
+ /* Set r30 to pointing stack-top. */
+ "addi 30, 1, 168 \n"
+ /* Initial r3/TOP to 0. */
+ "li 3, 0 \n");
}
/* Emit prologue in inferior memory. See above comments. */
@@ -2723,21 +2656,21 @@ static void
ppc64v2_emit_prologue (void)
{
EMIT_ASM (/* Save return address. */
- "mflr 0 \n"
- "std 0, 16(1) \n"
- /* Save r30 and incoming arguments. */
- "std 31, -8(1) \n"
- "std 30, -16(1) \n"
- "std 4, -24(1) \n"
- "std 3, -32(1) \n"
- /* Point r31 to current r1 for access arguments. */
- "mr 31, 1 \n"
- /* Adjust SP. 208 is the initial frame size. */
- "stdu 1, -208(1) \n"
- /* Set r30 to pointing stack-top. */
- "addi 30, 1, 168 \n"
- /* Initial r3/TOP to 0. */
- "li 3, 0 \n");
+ "mflr 0 \n"
+ "std 0, 16(1) \n"
+ /* Save r30 and incoming arguments. */
+ "std 31, -8(1) \n"
+ "std 30, -16(1) \n"
+ "std 4, -24(1) \n"
+ "std 3, -32(1) \n"
+ /* Point r31 to current r1 for access arguments. */
+ "mr 31, 1 \n"
+ /* Adjust SP. 208 is the initial frame size. */
+ "stdu 1, -208(1) \n"
+ /* Set r30 to pointing stack-top. */
+ "addi 30, 1, 168 \n"
+ /* Initial r3/TOP to 0. */
+ "li 3, 0 \n");
}
/* Emit epilogue in inferior memory. See above comments. */
@@ -2746,19 +2679,19 @@ static void
ppc64_emit_epilogue (void)
{
EMIT_ASM (/* Restore SP. */
- "ld 1, 0(1) \n"
- /* *result = TOP */
- "ld 4, -24(1) \n"
- "std 3, 0(4) \n"
- /* Restore registers. */
- "ld 31, -8(1) \n"
- "ld 30, -16(1) \n"
- /* Restore LR. */
- "ld 0, 16(1) \n"
- /* Return 0 for no-error. */
- "li 3, 0 \n"
- "mtlr 0 \n"
- "blr \n");
+ "ld 1, 0(1) \n"
+ /* *result = TOP */
+ "ld 4, -24(1) \n"
+ "std 3, 0(4) \n"
+ /* Restore registers. */
+ "ld 31, -8(1) \n"
+ "ld 30, -16(1) \n"
+ /* Restore LR. */
+ "ld 0, 16(1) \n"
+ /* Return 0 for no-error. */
+ "li 3, 0 \n"
+ "mtlr 0 \n"
+ "blr \n");
}
/* TOP = stack[--sp] + TOP */
@@ -2767,7 +2700,7 @@ static void
ppc64_emit_add (void)
{
EMIT_ASM ("ldu 4, 8(30) \n"
- "add 3, 4, 3 \n");
+ "add 3, 4, 3 \n");
}
/* TOP = stack[--sp] - TOP */
@@ -2776,7 +2709,7 @@ static void
ppc64_emit_sub (void)
{
EMIT_ASM ("ldu 4, 8(30) \n"
- "sub 3, 4, 3 \n");
+ "sub 3, 4, 3 \n");
}
/* TOP = stack[--sp] * TOP */
@@ -2785,7 +2718,7 @@ static void
ppc64_emit_mul (void)
{
EMIT_ASM ("ldu 4, 8(30) \n"
- "mulld 3, 4, 3 \n");
+ "mulld 3, 4, 3 \n");
}
/* TOP = stack[--sp] << TOP */
@@ -2794,7 +2727,7 @@ static void
ppc64_emit_lsh (void)
{
EMIT_ASM ("ldu 4, 8(30) \n"
- "sld 3, 4, 3 \n");
+ "sld 3, 4, 3 \n");
}
/* Top = stack[--sp] >> TOP
@@ -2804,7 +2737,7 @@ static void
ppc64_emit_rsh_signed (void)
{
EMIT_ASM ("ldu 4, 8(30) \n"
- "srad 3, 4, 3 \n");
+ "srad 3, 4, 3 \n");
}
/* Top = stack[--sp] >> TOP
@@ -2814,7 +2747,7 @@ static void
ppc64_emit_rsh_unsigned (void)
{
EMIT_ASM ("ldu 4, 8(30) \n"
- "srd 3, 4, 3 \n");
+ "srd 3, 4, 3 \n");
}
/* Emit code for signed-extension specified by ARG. */
@@ -2866,7 +2799,7 @@ static void
ppc64_emit_log_not (void)
{
EMIT_ASM ("cntlzd 3, 3 \n"
- "srdi 3, 3, 6 \n");
+ "srdi 3, 3, 6 \n");
}
/* TOP = stack[--sp] & TOP */
@@ -2875,7 +2808,7 @@ static void
ppc64_emit_bit_and (void)
{
EMIT_ASM ("ldu 4, 8(30) \n"
- "and 3, 4, 3 \n");
+ "and 3, 4, 3 \n");
}
/* TOP = stack[--sp] | TOP */
@@ -2884,7 +2817,7 @@ static void
ppc64_emit_bit_or (void)
{
EMIT_ASM ("ldu 4, 8(30) \n"
- "or 3, 4, 3 \n");
+ "or 3, 4, 3 \n");
}
/* TOP = stack[--sp] ^ TOP */
@@ -2893,7 +2826,7 @@ static void
ppc64_emit_bit_xor (void)
{
EMIT_ASM ("ldu 4, 8(30) \n"
- "xor 3, 4, 3 \n");
+ "xor 3, 4, 3 \n");
}
/* TOP = ~TOP
@@ -2911,9 +2844,9 @@ static void
ppc64_emit_equal (void)
{
EMIT_ASM ("ldu 4, 8(30) \n"
- "xor 3, 3, 4 \n"
- "cntlzd 3, 3 \n"
- "srdi 3, 3, 6 \n");
+ "xor 3, 3, 4 \n"
+ "cntlzd 3, 3 \n"
+ "srdi 3, 3, 6 \n");
}
/* TOP = stack[--sp] < TOP
@@ -2923,9 +2856,9 @@ static void
ppc64_emit_less_signed (void)
{
EMIT_ASM ("ldu 4, 8(30) \n"
- "cmpd 7, 4, 3 \n"
- "mfcr 3 \n"
- "rlwinm 3, 3, 29, 31, 31 \n");
+ "cmpd 7, 4, 3 \n"
+ "mfcr 3 \n"
+ "rlwinm 3, 3, 29, 31, 31 \n");
}
/* TOP = stack[--sp] < TOP
@@ -2935,9 +2868,9 @@ static void
ppc64_emit_less_unsigned (void)
{
EMIT_ASM ("ldu 4, 8(30) \n"
- "cmpld 7, 4, 3 \n"
- "mfcr 3 \n"
- "rlwinm 3, 3, 29, 31, 31 \n");
+ "cmpld 7, 4, 3 \n"
+ "mfcr 3 \n"
+ "rlwinm 3, 3, 29, 31, 31 \n");
}
/* Access the memory address in TOP in size of SIZE.
@@ -2989,9 +2922,9 @@ ppc64v1_emit_reg (int reg)
/* fctx->regs is passed in r3 and then saved in 176(1). */
p += GEN_LD (p, 3, 31, -32);
p += GEN_LI (p, 4, reg);
- p += GEN_STD (p, 2, 1, 40); /* Save TOC. */
+ p += GEN_STD (p, 2, 1, 40); /* Save TOC. */
p += gen_call (p, get_raw_reg_func_addr (), 1, 1);
- p += GEN_LD (p, 2, 1, 40); /* Restore TOC. */
+ p += GEN_LD (p, 2, 1, 40); /* Restore TOC. */
emit_insns (buf, p - buf);
gdb_assert ((p - buf) <= (sizeof (buf) / sizeof (*buf)));
@@ -3008,9 +2941,9 @@ ppc64v2_emit_reg (int reg)
/* fctx->regs is passed in r3 and then saved in 176(1). */
p += GEN_LD (p, 3, 31, -32);
p += GEN_LI (p, 4, reg);
- p += GEN_STD (p, 2, 1, 24); /* Save TOC. */
+ p += GEN_STD (p, 2, 1, 24); /* Save TOC. */
p += gen_call (p, get_raw_reg_func_addr (), 1, 0);
- p += GEN_LD (p, 2, 1, 24); /* Restore TOC. */
+ p += GEN_LD (p, 2, 1, 24); /* Restore TOC. */
emit_insns (buf, p - buf);
gdb_assert ((p - buf) <= (sizeof (buf) / sizeof (*buf)));
@@ -3036,11 +2969,11 @@ ppc64_emit_stack_flush (void)
Otherwise, expand 64-byte more. */
EMIT_ASM (" std 3, 0(30) \n"
- " addi 4, 30, -(112 + 8) \n"
- " cmpd 7, 4, 1 \n"
- " bgt 7, 1f \n"
- " stdu 31, -64(1) \n"
- "1:addi 30, 30, -8 \n");
+ " addi 4, 30, -(112 + 8) \n"
+ " cmpd 7, 4, 1 \n"
+ " bgt 7, 1f \n"
+ " stdu 31, -64(1) \n"
+ "1:addi 30, 30, -8 \n");
}
/* Swap TOP and stack[sp-1] */
@@ -3049,8 +2982,8 @@ static void
ppc64_emit_swap (void)
{
EMIT_ASM ("ld 4, 8(30) \n"
- "std 3, 8(30) \n"
- "mr 3, 4 \n");
+ "std 3, 8(30) \n"
+ "mr 3, 4 \n");
}
/* Call function FN - ELFv1. */
@@ -3061,9 +2994,9 @@ ppc64v1_emit_call (CORE_ADDR fn)
uint32_t buf[13];
uint32_t *p = buf;
- p += GEN_STD (p, 2, 1, 40); /* Save TOC. */
+ p += GEN_STD (p, 2, 1, 40); /* Save TOC. */
p += gen_call (p, fn, 1, 1);
- p += GEN_LD (p, 2, 1, 40); /* Restore TOC. */
+ p += GEN_LD (p, 2, 1, 40); /* Restore TOC. */
emit_insns (buf, p - buf);
gdb_assert ((p - buf) <= (sizeof (buf) / sizeof (*buf)));
@@ -3077,9 +3010,9 @@ ppc64v2_emit_call (CORE_ADDR fn)
uint32_t buf[10];
uint32_t *p = buf;
- p += GEN_STD (p, 2, 1, 24); /* Save TOC. */
+ p += GEN_STD (p, 2, 1, 24); /* Save TOC. */
p += gen_call (p, fn, 1, 0);
- p += GEN_LD (p, 2, 1, 24); /* Restore TOC. */
+ p += GEN_LD (p, 2, 1, 24); /* Restore TOC. */
emit_insns (buf, p - buf);
gdb_assert ((p - buf) <= (sizeof (buf) / sizeof (*buf)));
@@ -3097,9 +3030,9 @@ ppc64v1_emit_int_call_1 (CORE_ADDR fn, int arg1)
/* Setup argument. arg1 is a 16-bit value. */
p += gen_limm (p, 3, arg1, 1);
- p += GEN_STD (p, 2, 1, 40); /* Save TOC. */
+ p += GEN_STD (p, 2, 1, 40); /* Save TOC. */
p += gen_call (p, fn, 1, 1);
- p += GEN_LD (p, 2, 1, 40); /* Restore TOC. */
+ p += GEN_LD (p, 2, 1, 40); /* Restore TOC. */
emit_insns (buf, p - buf);
gdb_assert ((p - buf) <= (sizeof (buf) / sizeof (*buf)));
@@ -3115,9 +3048,9 @@ ppc64v2_emit_int_call_1 (CORE_ADDR fn, int arg1)
/* Setup argument. arg1 is a 16-bit value. */
p += gen_limm (p, 3, arg1, 1);
- p += GEN_STD (p, 2, 1, 24); /* Save TOC. */
+ p += GEN_STD (p, 2, 1, 24); /* Save TOC. */
p += gen_call (p, fn, 1, 0);
- p += GEN_LD (p, 2, 1, 24); /* Restore TOC. */
+ p += GEN_LD (p, 2, 1, 24); /* Restore TOC. */
emit_insns (buf, p - buf);
gdb_assert ((p - buf) <= (sizeof (buf) / sizeof (*buf)));
@@ -3138,11 +3071,11 @@ ppc64v1_emit_void_call_2 (CORE_ADDR fn, int arg1)
p += GEN_STD (p, 3, 30, 0);
/* Setup argument. arg1 is a 16-bit value. */
- p += GEN_MR (p, 4, 3); /* mr r4, r3 */
+ p += GEN_MR (p, 4, 3); /* mr r4, r3 */
p += gen_limm (p, 3, arg1, 1);
- p += GEN_STD (p, 2, 1, 40); /* Save TOC. */
+ p += GEN_STD (p, 2, 1, 40); /* Save TOC. */
p += gen_call (p, fn, 1, 1);
- p += GEN_LD (p, 2, 1, 40); /* Restore TOC. */
+ p += GEN_LD (p, 2, 1, 40); /* Restore TOC. */
/* Restore TOP */
p += GEN_LD (p, 3, 30, 0);
@@ -3163,11 +3096,11 @@ ppc64v2_emit_void_call_2 (CORE_ADDR fn, int arg1)
p += GEN_STD (p, 3, 30, 0);
/* Setup argument. arg1 is a 16-bit value. */
- p += GEN_MR (p, 4, 3); /* mr r4, r3 */
+ p += GEN_MR (p, 4, 3); /* mr r4, r3 */
p += gen_limm (p, 3, arg1, 1);
- p += GEN_STD (p, 2, 1, 24); /* Save TOC. */
+ p += GEN_STD (p, 2, 1, 24); /* Save TOC. */
p += gen_call (p, fn, 1, 0);
- p += GEN_LD (p, 2, 1, 24); /* Restore TOC. */
+ p += GEN_LD (p, 2, 1, 24); /* Restore TOC. */
/* Restore TOP */
p += GEN_LD (p, 3, 30, 0);
@@ -3182,8 +3115,8 @@ static void
ppc64_emit_if_goto (int *offset_p, int *size_p)
{
EMIT_ASM ("cmpdi 7, 3, 0 \n"
- "ldu 3, 8(30) \n"
- "1:bne 7, 1b \n");
+ "ldu 3, 8(30) \n"
+ "1:bne 7, 1b \n");
if (offset_p)
*offset_p = 8;
@@ -3197,9 +3130,9 @@ static void
ppc64_emit_eq_goto (int *offset_p, int *size_p)
{
EMIT_ASM ("ldu 4, 8(30) \n"
- "cmpd 7, 4, 3 \n"
- "ldu 3, 8(30) \n"
- "1:beq 7, 1b \n");
+ "cmpd 7, 4, 3 \n"
+ "ldu 3, 8(30) \n"
+ "1:beq 7, 1b \n");
if (offset_p)
*offset_p = 12;
@@ -3213,9 +3146,9 @@ static void
ppc64_emit_ne_goto (int *offset_p, int *size_p)
{
EMIT_ASM ("ldu 4, 8(30) \n"
- "cmpd 7, 4, 3 \n"
- "ldu 3, 8(30) \n"
- "1:bne 7, 1b \n");
+ "cmpd 7, 4, 3 \n"
+ "ldu 3, 8(30) \n"
+ "1:bne 7, 1b \n");
if (offset_p)
*offset_p = 12;
@@ -3229,9 +3162,9 @@ static void
ppc64_emit_lt_goto (int *offset_p, int *size_p)
{
EMIT_ASM ("ldu 4, 8(30) \n"
- "cmpd 7, 4, 3 \n"
- "ldu 3, 8(30) \n"
- "1:blt 7, 1b \n");
+ "cmpd 7, 4, 3 \n"
+ "ldu 3, 8(30) \n"
+ "1:blt 7, 1b \n");
if (offset_p)
*offset_p = 12;
@@ -3245,9 +3178,9 @@ static void
ppc64_emit_le_goto (int *offset_p, int *size_p)
{
EMIT_ASM ("ldu 4, 8(30) \n"
- "cmpd 7, 4, 3 \n"
- "ldu 3, 8(30) \n"
- "1:ble 7, 1b \n");
+ "cmpd 7, 4, 3 \n"
+ "ldu 3, 8(30) \n"
+ "1:ble 7, 1b \n");
if (offset_p)
*offset_p = 12;
@@ -3261,9 +3194,9 @@ static void
ppc64_emit_gt_goto (int *offset_p, int *size_p)
{
EMIT_ASM ("ldu 4, 8(30) \n"
- "cmpd 7, 4, 3 \n"
- "ldu 3, 8(30) \n"
- "1:bgt 7, 1b \n");
+ "cmpd 7, 4, 3 \n"
+ "ldu 3, 8(30) \n"
+ "1:bgt 7, 1b \n");
if (offset_p)
*offset_p = 12;
@@ -3277,9 +3210,9 @@ static void
ppc64_emit_ge_goto (int *offset_p, int *size_p)
{
EMIT_ASM ("ldu 4, 8(30) \n"
- "cmpd 7, 4, 3 \n"
- "ldu 3, 8(30) \n"
- "1:bge 7, 1b \n");
+ "cmpd 7, 4, 3 \n"
+ "ldu 3, 8(30) \n"
+ "1:bge 7, 1b \n");
if (offset_p)
*offset_p = 12;
@@ -3289,89 +3222,49 @@ ppc64_emit_ge_goto (int *offset_p, int *size_p)
/* Table of emit ops for 64-bit ELFv1. */
-static struct emit_ops ppc64v1_emit_ops_impl =
-{
- ppc64v1_emit_prologue,
- ppc64_emit_epilogue,
- ppc64_emit_add,
- ppc64_emit_sub,
- ppc64_emit_mul,
- ppc64_emit_lsh,
- ppc64_emit_rsh_signed,
- ppc64_emit_rsh_unsigned,
- ppc64_emit_ext,
- ppc64_emit_log_not,
- ppc64_emit_bit_and,
- ppc64_emit_bit_or,
- ppc64_emit_bit_xor,
- ppc64_emit_bit_not,
- ppc64_emit_equal,
- ppc64_emit_less_signed,
- ppc64_emit_less_unsigned,
- ppc64_emit_ref,
- ppc64_emit_if_goto,
- ppc_emit_goto,
- ppc_write_goto_address,
- ppc64_emit_const,
- ppc64v1_emit_call,
- ppc64v1_emit_reg,
- ppc64_emit_pop,
- ppc64_emit_stack_flush,
- ppc64_emit_zero_ext,
- ppc64_emit_swap,
- ppc_emit_stack_adjust,
- ppc64v1_emit_int_call_1,
- ppc64v1_emit_void_call_2,
- ppc64_emit_eq_goto,
- ppc64_emit_ne_goto,
- ppc64_emit_lt_goto,
- ppc64_emit_le_goto,
- ppc64_emit_gt_goto,
- ppc64_emit_ge_goto
-};
+static struct emit_ops ppc64v1_emit_ops_impl
+ = { ppc64v1_emit_prologue, ppc64_emit_epilogue,
+ ppc64_emit_add, ppc64_emit_sub,
+ ppc64_emit_mul, ppc64_emit_lsh,
+ ppc64_emit_rsh_signed, ppc64_emit_rsh_unsigned,
+ ppc64_emit_ext, ppc64_emit_log_not,
+ ppc64_emit_bit_and, ppc64_emit_bit_or,
+ ppc64_emit_bit_xor, ppc64_emit_bit_not,
+ ppc64_emit_equal, ppc64_emit_less_signed,
+ ppc64_emit_less_unsigned, ppc64_emit_ref,
+ ppc64_emit_if_goto, ppc_emit_goto,
+ ppc_write_goto_address, ppc64_emit_const,
+ ppc64v1_emit_call, ppc64v1_emit_reg,
+ ppc64_emit_pop, ppc64_emit_stack_flush,
+ ppc64_emit_zero_ext, ppc64_emit_swap,
+ ppc_emit_stack_adjust, ppc64v1_emit_int_call_1,
+ ppc64v1_emit_void_call_2, ppc64_emit_eq_goto,
+ ppc64_emit_ne_goto, ppc64_emit_lt_goto,
+ ppc64_emit_le_goto, ppc64_emit_gt_goto,
+ ppc64_emit_ge_goto };
/* Table of emit ops for 64-bit ELFv2. */
-static struct emit_ops ppc64v2_emit_ops_impl =
-{
- ppc64v2_emit_prologue,
- ppc64_emit_epilogue,
- ppc64_emit_add,
- ppc64_emit_sub,
- ppc64_emit_mul,
- ppc64_emit_lsh,
- ppc64_emit_rsh_signed,
- ppc64_emit_rsh_unsigned,
- ppc64_emit_ext,
- ppc64_emit_log_not,
- ppc64_emit_bit_and,
- ppc64_emit_bit_or,
- ppc64_emit_bit_xor,
- ppc64_emit_bit_not,
- ppc64_emit_equal,
- ppc64_emit_less_signed,
- ppc64_emit_less_unsigned,
- ppc64_emit_ref,
- ppc64_emit_if_goto,
- ppc_emit_goto,
- ppc_write_goto_address,
- ppc64_emit_const,
- ppc64v2_emit_call,
- ppc64v2_emit_reg,
- ppc64_emit_pop,
- ppc64_emit_stack_flush,
- ppc64_emit_zero_ext,
- ppc64_emit_swap,
- ppc_emit_stack_adjust,
- ppc64v2_emit_int_call_1,
- ppc64v2_emit_void_call_2,
- ppc64_emit_eq_goto,
- ppc64_emit_ne_goto,
- ppc64_emit_lt_goto,
- ppc64_emit_le_goto,
- ppc64_emit_gt_goto,
- ppc64_emit_ge_goto
-};
+static struct emit_ops ppc64v2_emit_ops_impl
+ = { ppc64v2_emit_prologue, ppc64_emit_epilogue,
+ ppc64_emit_add, ppc64_emit_sub,
+ ppc64_emit_mul, ppc64_emit_lsh,
+ ppc64_emit_rsh_signed, ppc64_emit_rsh_unsigned,
+ ppc64_emit_ext, ppc64_emit_log_not,
+ ppc64_emit_bit_and, ppc64_emit_bit_or,
+ ppc64_emit_bit_xor, ppc64_emit_bit_not,
+ ppc64_emit_equal, ppc64_emit_less_signed,
+ ppc64_emit_less_unsigned, ppc64_emit_ref,
+ ppc64_emit_if_goto, ppc_emit_goto,
+ ppc_write_goto_address, ppc64_emit_const,
+ ppc64v2_emit_call, ppc64v2_emit_reg,
+ ppc64_emit_pop, ppc64_emit_stack_flush,
+ ppc64_emit_zero_ext, ppc64_emit_swap,
+ ppc_emit_stack_adjust, ppc64v2_emit_int_call_1,
+ ppc64v2_emit_void_call_2, ppc64_emit_eq_goto,
+ ppc64_emit_ne_goto, ppc64_emit_lt_goto,
+ ppc64_emit_le_goto, ppc64_emit_gt_goto,
+ ppc64_emit_ge_goto };
#endif
@@ -3386,9 +3279,9 @@ ppc_target::emit_ops ()
if (register_size (regcache->tdesc, 0) == 8)
{
if (is_elfv2_inferior ())
- return &ppc64v2_emit_ops_impl;
+ return &ppc64v2_emit_ops_impl;
else
- return &ppc64v1_emit_ops_impl;
+ return &ppc64v1_emit_ops_impl;
}
#endif
return &ppc_emit_ops_impl;
diff --git a/gdbserver/linux-ppc-tdesc-init.h b/gdbserver/linux-ppc-tdesc-init.h
index b9cc1b18ce9..e824b07837a 100644
--- a/gdbserver/linux-ppc-tdesc-init.h
+++ b/gdbserver/linux-ppc-tdesc-init.h
@@ -24,10 +24,11 @@
it's sufficient to pass only the register set here. This, together with
the ABI known at IPA compile time, maps to a tdesc. */
-enum ppc_linux_tdesc {
+enum ppc_linux_tdesc
+{
PPC_TDESC_BASE,
PPC_TDESC_ALTIVEC,
- PPC_TDESC_CELL, /* No longer used, but kept to avoid ABI changes. */
+ PPC_TDESC_CELL, /* No longer used, but kept to avoid ABI changes. */
PPC_TDESC_VSX,
PPC_TDESC_ISA205,
PPC_TDESC_ISA205_ALTIVEC,
diff --git a/gdbserver/linux-riscv-low.cc b/gdbserver/linux-riscv-low.cc
index 129bc3b138b..aa4f42c72c5 100644
--- a/gdbserver/linux-riscv-low.cc
+++ b/gdbserver/linux-riscv-low.cc
@@ -27,7 +27,7 @@
/* Work around glibc header breakage causing ELF_NFPREG not to be usable. */
#ifndef NFPREG
-# define NFPREG 33
+#define NFPREG 33
#endif
/* Linux target op definitions for the RISC-V architecture. */
@@ -35,7 +35,6 @@
class riscv_target : public linux_process_target
{
public:
-
const regs_info *get_regs_info () override;
int breakpoint_kind_from_pc (CORE_ADDR *pcptr) override;
@@ -43,7 +42,6 @@ public:
const gdb_byte *sw_breakpoint_from_kind (int kind, int *size) override;
protected:
-
void low_arch_setup () override;
bool low_cannot_fetch_register (int regno) override;
@@ -69,14 +67,14 @@ bool
riscv_target::low_cannot_fetch_register (int regno)
{
gdb_assert_not_reached ("linux target op low_cannot_fetch_register "
- "is not implemented by the target");
+ "is not implemented by the target");
}
bool
riscv_target::low_cannot_store_register (int regno)
{
gdb_assert_not_reached ("linux target op low_cannot_store_register "
- "is not implemented by the target");
+ "is not implemented by the target");
}
/* Implementation of linux target ops method "low_arch_setup". */
@@ -162,37 +160,34 @@ riscv_store_fpregset (struct regcache *regcache, const void *buf)
so define multiple regsets for them marking them all as OPTIONAL_REGS
rather than FP_REGS, so that "regsets_fetch_inferior_registers" picks
the right one according to size. */
-static struct regset_info riscv_regsets[] = {
- { PTRACE_GETREGSET, PTRACE_SETREGSET, NT_PRSTATUS,
- sizeof (elf_gregset_t), GENERAL_REGS,
- riscv_fill_gregset, riscv_store_gregset },
- { PTRACE_GETREGSET, PTRACE_SETREGSET, NT_FPREGSET,
- sizeof (struct __riscv_mc_q_ext_state), OPTIONAL_REGS,
- riscv_fill_fpregset, riscv_store_fpregset },
- { PTRACE_GETREGSET, PTRACE_SETREGSET, NT_FPREGSET,
- sizeof (struct __riscv_mc_d_ext_state), OPTIONAL_REGS,
- riscv_fill_fpregset, riscv_store_fpregset },
- { PTRACE_GETREGSET, PTRACE_SETREGSET, NT_FPREGSET,
- sizeof (struct __riscv_mc_f_ext_state), OPTIONAL_REGS,
- riscv_fill_fpregset, riscv_store_fpregset },
- NULL_REGSET
-};
+static struct regset_info riscv_regsets[]
+ = { { PTRACE_GETREGSET, PTRACE_SETREGSET, NT_PRSTATUS,
+ sizeof (elf_gregset_t), GENERAL_REGS, riscv_fill_gregset,
+ riscv_store_gregset },
+ { PTRACE_GETREGSET, PTRACE_SETREGSET, NT_FPREGSET,
+ sizeof (struct __riscv_mc_q_ext_state), OPTIONAL_REGS,
+ riscv_fill_fpregset, riscv_store_fpregset },
+ { PTRACE_GETREGSET, PTRACE_SETREGSET, NT_FPREGSET,
+ sizeof (struct __riscv_mc_d_ext_state), OPTIONAL_REGS,
+ riscv_fill_fpregset, riscv_store_fpregset },
+ { PTRACE_GETREGSET, PTRACE_SETREGSET, NT_FPREGSET,
+ sizeof (struct __riscv_mc_f_ext_state), OPTIONAL_REGS,
+ riscv_fill_fpregset, riscv_store_fpregset },
+ NULL_REGSET };
/* RISC-V/Linux regset information. */
-static struct regsets_info riscv_regsets_info =
- {
- riscv_regsets, /* regsets */
- 0, /* num_regsets */
- NULL, /* disabled_regsets */
- };
+static struct regsets_info riscv_regsets_info = {
+ riscv_regsets, /* regsets */
+ 0, /* num_regsets */
+ NULL, /* disabled_regsets */
+};
/* Definition of linux_target_ops data member "regs_info". */
-static struct regs_info riscv_regs =
- {
- NULL, /* regset_bitmap */
- NULL, /* usrregs */
- &riscv_regsets_info,
- };
+static struct regs_info riscv_regs = {
+ NULL, /* regset_bitmap */
+ NULL, /* usrregs */
+ &riscv_regsets_info,
+};
/* Implementation of linux target ops method "get_regs_info". */
@@ -257,11 +252,10 @@ int
riscv_target::breakpoint_kind_from_pc (CORE_ADDR *pcptr)
{
union
- {
- gdb_byte bytes[2];
- uint16_t insn;
- }
- buf;
+ {
+ gdb_byte bytes[2];
+ uint16_t insn;
+ } buf;
if (target_read_memory (*pcptr, buf.bytes, sizeof (buf.insn)) == 0
&& riscv_insn_length (buf.insn == sizeof (riscv_ibreakpoint)))
@@ -278,10 +272,10 @@ riscv_target::sw_breakpoint_from_kind (int kind, int *size)
*size = kind;
switch (kind)
{
- case sizeof (riscv_ibreakpoint):
- return (const gdb_byte *) &riscv_ibreakpoint;
- default:
- return (const gdb_byte *) &riscv_cbreakpoint;
+ case sizeof (riscv_ibreakpoint):
+ return (const gdb_byte *) &riscv_ibreakpoint;
+ default:
+ return (const gdb_byte *) &riscv_cbreakpoint;
}
}
@@ -291,18 +285,18 @@ bool
riscv_target::low_breakpoint_at (CORE_ADDR pc)
{
union
- {
- gdb_byte bytes[2];
- uint16_t insn;
- }
- buf;
+ {
+ gdb_byte bytes[2];
+ uint16_t insn;
+ } buf;
if (target_read_memory (pc, buf.bytes, sizeof (buf.insn)) == 0
&& (buf.insn == riscv_cbreakpoint
- || (buf.insn == riscv_ibreakpoint[0]
- && target_read_memory (pc + sizeof (buf.insn), buf.bytes,
- sizeof (buf.insn)) == 0
- && buf.insn == riscv_ibreakpoint[1])))
+ || (buf.insn == riscv_ibreakpoint[0]
+ && target_read_memory (pc + sizeof (buf.insn), buf.bytes,
+ sizeof (buf.insn))
+ == 0
+ && buf.insn == riscv_ibreakpoint[1])))
return true;
else
return false;
diff --git a/gdbserver/linux-s390-ipa.cc b/gdbserver/linux-s390-ipa.cc
index b8e1af9c2d5..0078822b31f 100644
--- a/gdbserver/linux-s390-ipa.cc
+++ b/gdbserver/linux-s390-ipa.cc
@@ -27,14 +27,14 @@
#include <sys/auxv.h>
#endif
-#define FT_FPR(x) (0x000 + (x) * 0x10)
-#define FT_VR(x) (0x000 + (x) * 0x10)
-#define FT_VR_L(x) (0x008 + (x) * 0x10)
-#define FT_GPR(x) (0x200 + (x) * 8)
-#define FT_GPR_U(x) (0x200 + (x) * 8)
-#define FT_GPR_L(x) (0x204 + (x) * 8)
-#define FT_GPR(x) (0x200 + (x) * 8)
-#define FT_ACR(x) (0x280 + (x) * 4)
+#define FT_FPR(x) (0x000 + (x) *0x10)
+#define FT_VR(x) (0x000 + (x) *0x10)
+#define FT_VR_L(x) (0x008 + (x) *0x10)
+#define FT_GPR(x) (0x200 + (x) *8)
+#define FT_GPR_U(x) (0x200 + (x) *8)
+#define FT_GPR_L(x) (0x204 + (x) *8)
+#define FT_GPR(x) (0x200 + (x) *8)
+#define FT_ACR(x) (0x280 + (x) *4)
#define FT_PSWM 0x2c0
#define FT_PSWM_U 0x2c0
#define FT_PSWA 0x2c8
@@ -53,122 +53,310 @@
static const int s390_linux32_ft_collect_regmap[] = {
/* 32-bit PSWA and PSWM. */
- FT_PSWM_U, FT_PSWA_L,
+ FT_PSWM_U,
+ FT_PSWA_L,
/* 32-bit GPRs (mapped to lower halves of 64-bit slots). */
- FT_GPR_L (0), FT_GPR_L (1), FT_GPR_L (2), FT_GPR_L (3),
- FT_GPR_L (4), FT_GPR_L (5), FT_GPR_L (6), FT_GPR_L (7),
- FT_GPR_L (8), FT_GPR_L (9), FT_GPR_L (10), FT_GPR_L (11),
- FT_GPR_L (12), FT_GPR_L (13), FT_GPR_L (14), FT_GPR_L (15),
+ FT_GPR_L (0),
+ FT_GPR_L (1),
+ FT_GPR_L (2),
+ FT_GPR_L (3),
+ FT_GPR_L (4),
+ FT_GPR_L (5),
+ FT_GPR_L (6),
+ FT_GPR_L (7),
+ FT_GPR_L (8),
+ FT_GPR_L (9),
+ FT_GPR_L (10),
+ FT_GPR_L (11),
+ FT_GPR_L (12),
+ FT_GPR_L (13),
+ FT_GPR_L (14),
+ FT_GPR_L (15),
/* ACRs */
- FT_ACR (0), FT_ACR (1), FT_ACR (2), FT_ACR (3),
- FT_ACR (4), FT_ACR (5), FT_ACR (6), FT_ACR (7),
- FT_ACR (8), FT_ACR (9), FT_ACR (10), FT_ACR (11),
- FT_ACR (12), FT_ACR (13), FT_ACR (14), FT_ACR (15),
+ FT_ACR (0),
+ FT_ACR (1),
+ FT_ACR (2),
+ FT_ACR (3),
+ FT_ACR (4),
+ FT_ACR (5),
+ FT_ACR (6),
+ FT_ACR (7),
+ FT_ACR (8),
+ FT_ACR (9),
+ FT_ACR (10),
+ FT_ACR (11),
+ FT_ACR (12),
+ FT_ACR (13),
+ FT_ACR (14),
+ FT_ACR (15),
/* FPRs (mapped to upper halves of 128-bit VR slots). */
- FT_FPR (0), FT_FPR (1), FT_FPR (2), FT_FPR (3),
- FT_FPR (4), FT_FPR (5), FT_FPR (6), FT_FPR (7),
- FT_FPR (8), FT_FPR (9), FT_FPR (10), FT_FPR (11),
- FT_FPR (12), FT_FPR (13), FT_FPR (14), FT_FPR (15),
+ FT_FPR (0),
+ FT_FPR (1),
+ FT_FPR (2),
+ FT_FPR (3),
+ FT_FPR (4),
+ FT_FPR (5),
+ FT_FPR (6),
+ FT_FPR (7),
+ FT_FPR (8),
+ FT_FPR (9),
+ FT_FPR (10),
+ FT_FPR (11),
+ FT_FPR (12),
+ FT_FPR (13),
+ FT_FPR (14),
+ FT_FPR (15),
/* orig_r2, last_break, system_call */
- -1, -1, -1,
+ -1,
+ -1,
+ -1,
};
/* Used for s390-linux64, s390-linux64v1, s390-linux64v2, s390-vx-linux64. */
static const int s390_linux64_ft_collect_regmap[] = {
/* 32-bit PSWA and PSWM. */
- FT_PSWM_U, FT_PSWA_L,
+ FT_PSWM_U,
+ FT_PSWA_L,
/* 32-bit halves of 64-bit GPRs. */
- FT_GPR_U (0), FT_GPR_L (0),
- FT_GPR_U (1), FT_GPR_L (1),
- FT_GPR_U (2), FT_GPR_L (2),
- FT_GPR_U (3), FT_GPR_L (3),
- FT_GPR_U (4), FT_GPR_L (4),
- FT_GPR_U (5), FT_GPR_L (5),
- FT_GPR_U (6), FT_GPR_L (6),
- FT_GPR_U (7), FT_GPR_L (7),
- FT_GPR_U (8), FT_GPR_L (8),
- FT_GPR_U (9), FT_GPR_L (9),
- FT_GPR_U (10), FT_GPR_L (10),
- FT_GPR_U (11), FT_GPR_L (11),
- FT_GPR_U (12), FT_GPR_L (12),
- FT_GPR_U (13), FT_GPR_L (13),
- FT_GPR_U (14), FT_GPR_L (14),
- FT_GPR_U (15), FT_GPR_L (15),
+ FT_GPR_U (0),
+ FT_GPR_L (0),
+ FT_GPR_U (1),
+ FT_GPR_L (1),
+ FT_GPR_U (2),
+ FT_GPR_L (2),
+ FT_GPR_U (3),
+ FT_GPR_L (3),
+ FT_GPR_U (4),
+ FT_GPR_L (4),
+ FT_GPR_U (5),
+ FT_GPR_L (5),
+ FT_GPR_U (6),
+ FT_GPR_L (6),
+ FT_GPR_U (7),
+ FT_GPR_L (7),
+ FT_GPR_U (8),
+ FT_GPR_L (8),
+ FT_GPR_U (9),
+ FT_GPR_L (9),
+ FT_GPR_U (10),
+ FT_GPR_L (10),
+ FT_GPR_U (11),
+ FT_GPR_L (11),
+ FT_GPR_U (12),
+ FT_GPR_L (12),
+ FT_GPR_U (13),
+ FT_GPR_L (13),
+ FT_GPR_U (14),
+ FT_GPR_L (14),
+ FT_GPR_U (15),
+ FT_GPR_L (15),
/* ACRs */
- FT_ACR (0), FT_ACR (1), FT_ACR (2), FT_ACR (3),
- FT_ACR (4), FT_ACR (5), FT_ACR (6), FT_ACR (7),
- FT_ACR (8), FT_ACR (9), FT_ACR (10), FT_ACR (11),
- FT_ACR (12), FT_ACR (13), FT_ACR (14), FT_ACR (15),
+ FT_ACR (0),
+ FT_ACR (1),
+ FT_ACR (2),
+ FT_ACR (3),
+ FT_ACR (4),
+ FT_ACR (5),
+ FT_ACR (6),
+ FT_ACR (7),
+ FT_ACR (8),
+ FT_ACR (9),
+ FT_ACR (10),
+ FT_ACR (11),
+ FT_ACR (12),
+ FT_ACR (13),
+ FT_ACR (14),
+ FT_ACR (15),
/* FPRs (mapped to upper halves of 128-bit VR slots). */
- FT_FPR (0), FT_FPR (1), FT_FPR (2), FT_FPR (3),
- FT_FPR (4), FT_FPR (5), FT_FPR (6), FT_FPR (7),
- FT_FPR (8), FT_FPR (9), FT_FPR (10), FT_FPR (11),
- FT_FPR (12), FT_FPR (13), FT_FPR (14), FT_FPR (15),
+ FT_FPR (0),
+ FT_FPR (1),
+ FT_FPR (2),
+ FT_FPR (3),
+ FT_FPR (4),
+ FT_FPR (5),
+ FT_FPR (6),
+ FT_FPR (7),
+ FT_FPR (8),
+ FT_FPR (9),
+ FT_FPR (10),
+ FT_FPR (11),
+ FT_FPR (12),
+ FT_FPR (13),
+ FT_FPR (14),
+ FT_FPR (15),
/* orig_r2, last_break, system_call */
- -1, -1, -1,
+ -1,
+ -1,
+ -1,
/* Lower halves of 128-bit VRs. */
- FT_VR_L (0), FT_VR_L (1), FT_VR_L (2), FT_VR_L (3),
- FT_VR_L (4), FT_VR_L (5), FT_VR_L (6), FT_VR_L (7),
- FT_VR_L (8), FT_VR_L (9), FT_VR_L (10), FT_VR_L (11),
- FT_VR_L (12), FT_VR_L (13), FT_VR_L (14), FT_VR_L (15),
+ FT_VR_L (0),
+ FT_VR_L (1),
+ FT_VR_L (2),
+ FT_VR_L (3),
+ FT_VR_L (4),
+ FT_VR_L (5),
+ FT_VR_L (6),
+ FT_VR_L (7),
+ FT_VR_L (8),
+ FT_VR_L (9),
+ FT_VR_L (10),
+ FT_VR_L (11),
+ FT_VR_L (12),
+ FT_VR_L (13),
+ FT_VR_L (14),
+ FT_VR_L (15),
/* And the next 16 VRs. */
- FT_VR (16), FT_VR (17), FT_VR (18), FT_VR (19),
- FT_VR (20), FT_VR (21), FT_VR (22), FT_VR (23),
- FT_VR (24), FT_VR (25), FT_VR (26), FT_VR (27),
- FT_VR (28), FT_VR (29), FT_VR (30), FT_VR (31),
+ FT_VR (16),
+ FT_VR (17),
+ FT_VR (18),
+ FT_VR (19),
+ FT_VR (20),
+ FT_VR (21),
+ FT_VR (22),
+ FT_VR (23),
+ FT_VR (24),
+ FT_VR (25),
+ FT_VR (26),
+ FT_VR (27),
+ FT_VR (28),
+ FT_VR (29),
+ FT_VR (30),
+ FT_VR (31),
};
/* Used for s390-te-linux64, s390-tevx-linux64, and s390-gs-linux64. */
static const int s390_te_linux64_ft_collect_regmap[] = {
/* 32-bit PSWA and PSWM. */
- FT_PSWM_U, FT_PSWA_L,
+ FT_PSWM_U,
+ FT_PSWA_L,
/* 32-bit halves of 64-bit GPRs. */
- FT_GPR_U (0), FT_GPR_L (0),
- FT_GPR_U (1), FT_GPR_L (1),
- FT_GPR_U (2), FT_GPR_L (2),
- FT_GPR_U (3), FT_GPR_L (3),
- FT_GPR_U (4), FT_GPR_L (4),
- FT_GPR_U (5), FT_GPR_L (5),
- FT_GPR_U (6), FT_GPR_L (6),
- FT_GPR_U (7), FT_GPR_L (7),
- FT_GPR_U (8), FT_GPR_L (8),
- FT_GPR_U (9), FT_GPR_L (9),
- FT_GPR_U (10), FT_GPR_L (10),
- FT_GPR_U (11), FT_GPR_L (11),
- FT_GPR_U (12), FT_GPR_L (12),
- FT_GPR_U (13), FT_GPR_L (13),
- FT_GPR_U (14), FT_GPR_L (14),
- FT_GPR_U (15), FT_GPR_L (15),
+ FT_GPR_U (0),
+ FT_GPR_L (0),
+ FT_GPR_U (1),
+ FT_GPR_L (1),
+ FT_GPR_U (2),
+ FT_GPR_L (2),
+ FT_GPR_U (3),
+ FT_GPR_L (3),
+ FT_GPR_U (4),
+ FT_GPR_L (4),
+ FT_GPR_U (5),
+ FT_GPR_L (5),
+ FT_GPR_U (6),
+ FT_GPR_L (6),
+ FT_GPR_U (7),
+ FT_GPR_L (7),
+ FT_GPR_U (8),
+ FT_GPR_L (8),
+ FT_GPR_U (9),
+ FT_GPR_L (9),
+ FT_GPR_U (10),
+ FT_GPR_L (10),
+ FT_GPR_U (11),
+ FT_GPR_L (11),
+ FT_GPR_U (12),
+ FT_GPR_L (12),
+ FT_GPR_U (13),
+ FT_GPR_L (13),
+ FT_GPR_U (14),
+ FT_GPR_L (14),
+ FT_GPR_U (15),
+ FT_GPR_L (15),
/* ACRs */
- FT_ACR (0), FT_ACR (1), FT_ACR (2), FT_ACR (3),
- FT_ACR (4), FT_ACR (5), FT_ACR (6), FT_ACR (7),
- FT_ACR (8), FT_ACR (9), FT_ACR (10), FT_ACR (11),
- FT_ACR (12), FT_ACR (13), FT_ACR (14), FT_ACR (15),
+ FT_ACR (0),
+ FT_ACR (1),
+ FT_ACR (2),
+ FT_ACR (3),
+ FT_ACR (4),
+ FT_ACR (5),
+ FT_ACR (6),
+ FT_ACR (7),
+ FT_ACR (8),
+ FT_ACR (9),
+ FT_ACR (10),
+ FT_ACR (11),
+ FT_ACR (12),
+ FT_ACR (13),
+ FT_ACR (14),
+ FT_ACR (15),
/* FPRs (mapped to upper halves of 128-bit VR slots). */
- FT_FPR (0), FT_FPR (1), FT_FPR (2), FT_FPR (3),
- FT_FPR (4), FT_FPR (5), FT_FPR (6), FT_FPR (7),
- FT_FPR (8), FT_FPR (9), FT_FPR (10), FT_FPR (11),
- FT_FPR (12), FT_FPR (13), FT_FPR (14), FT_FPR (15),
+ FT_FPR (0),
+ FT_FPR (1),
+ FT_FPR (2),
+ FT_FPR (3),
+ FT_FPR (4),
+ FT_FPR (5),
+ FT_FPR (6),
+ FT_FPR (7),
+ FT_FPR (8),
+ FT_FPR (9),
+ FT_FPR (10),
+ FT_FPR (11),
+ FT_FPR (12),
+ FT_FPR (13),
+ FT_FPR (14),
+ FT_FPR (15),
/* orig_r2, last_break, system_call */
- -1, -1, -1,
+ -1,
+ -1,
+ -1,
/* TDB */
- -1, -1, -1, -1,
- -1, -1, -1, -1,
- -1, -1, -1, -1,
- -1, -1, -1, -1,
- -1, -1, -1, -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
/* Lower halves of 128-bit VRs. */
- FT_VR_L (0), FT_VR_L (1), FT_VR_L (2), FT_VR_L (3),
- FT_VR_L (4), FT_VR_L (5), FT_VR_L (6), FT_VR_L (7),
- FT_VR_L (8), FT_VR_L (9), FT_VR_L (10), FT_VR_L (11),
- FT_VR_L (12), FT_VR_L (13), FT_VR_L (14), FT_VR_L (15),
+ FT_VR_L (0),
+ FT_VR_L (1),
+ FT_VR_L (2),
+ FT_VR_L (3),
+ FT_VR_L (4),
+ FT_VR_L (5),
+ FT_VR_L (6),
+ FT_VR_L (7),
+ FT_VR_L (8),
+ FT_VR_L (9),
+ FT_VR_L (10),
+ FT_VR_L (11),
+ FT_VR_L (12),
+ FT_VR_L (13),
+ FT_VR_L (14),
+ FT_VR_L (15),
/* And the next 16 VRs. */
- FT_VR (16), FT_VR (17), FT_VR (18), FT_VR (19),
- FT_VR (20), FT_VR (21), FT_VR (22), FT_VR (23),
- FT_VR (24), FT_VR (25), FT_VR (26), FT_VR (27),
- FT_VR (28), FT_VR (29), FT_VR (30), FT_VR (31),
+ FT_VR (16),
+ FT_VR (17),
+ FT_VR (18),
+ FT_VR (19),
+ FT_VR (20),
+ FT_VR (21),
+ FT_VR (22),
+ FT_VR (23),
+ FT_VR (24),
+ FT_VR (25),
+ FT_VR (26),
+ FT_VR (27),
+ FT_VR (28),
+ FT_VR (29),
+ FT_VR (30),
+ FT_VR (31),
};
#else /* __s390x__ */
@@ -177,34 +365,97 @@ static const int s390_te_linux64_ft_collect_regmap[] = {
static const int s390x_ft_collect_regmap[] = {
/* 64-bit PSWA and PSWM. */
- FT_PSWM, FT_PSWA,
+ FT_PSWM,
+ FT_PSWA,
/* 64-bit GPRs. */
- FT_GPR (0), FT_GPR (1), FT_GPR (2), FT_GPR (3),
- FT_GPR (4), FT_GPR (5), FT_GPR (6), FT_GPR (7),
- FT_GPR (8), FT_GPR (9), FT_GPR (10), FT_GPR (11),
- FT_GPR (12), FT_GPR (13), FT_GPR (14), FT_GPR (15),
+ FT_GPR (0),
+ FT_GPR (1),
+ FT_GPR (2),
+ FT_GPR (3),
+ FT_GPR (4),
+ FT_GPR (5),
+ FT_GPR (6),
+ FT_GPR (7),
+ FT_GPR (8),
+ FT_GPR (9),
+ FT_GPR (10),
+ FT_GPR (11),
+ FT_GPR (12),
+ FT_GPR (13),
+ FT_GPR (14),
+ FT_GPR (15),
/* ACRs */
- FT_ACR (0), FT_ACR (1), FT_ACR (2), FT_ACR (3),
- FT_ACR (4), FT_ACR (5), FT_ACR (6), FT_ACR (7),
- FT_ACR (8), FT_ACR (9), FT_ACR (10), FT_ACR (11),
- FT_ACR (12), FT_ACR (13), FT_ACR (14), FT_ACR (15),
+ FT_ACR (0),
+ FT_ACR (1),
+ FT_ACR (2),
+ FT_ACR (3),
+ FT_ACR (4),
+ FT_ACR (5),
+ FT_ACR (6),
+ FT_ACR (7),
+ FT_ACR (8),
+ FT_ACR (9),
+ FT_ACR (10),
+ FT_ACR (11),
+ FT_ACR (12),
+ FT_ACR (13),
+ FT_ACR (14),
+ FT_ACR (15),
/* FPRs (mapped to upper halves of 128-bit VR slots). */
- FT_FPR (0), FT_FPR (1), FT_FPR (2), FT_FPR (3),
- FT_FPR (4), FT_FPR (5), FT_FPR (6), FT_FPR (7),
- FT_FPR (8), FT_FPR (9), FT_FPR (10), FT_FPR (11),
- FT_FPR (12), FT_FPR (13), FT_FPR (14), FT_FPR (15),
+ FT_FPR (0),
+ FT_FPR (1),
+ FT_FPR (2),
+ FT_FPR (3),
+ FT_FPR (4),
+ FT_FPR (5),
+ FT_FPR (6),
+ FT_FPR (7),
+ FT_FPR (8),
+ FT_FPR (9),
+ FT_FPR (10),
+ FT_FPR (11),
+ FT_FPR (12),
+ FT_FPR (13),
+ FT_FPR (14),
+ FT_FPR (15),
/* orig_r2, last_break, system_call */
- -1, -1, -1,
+ -1,
+ -1,
+ -1,
/* Lower halves of 128-bit VRs. */
- FT_VR_L (0), FT_VR_L (1), FT_VR_L (2), FT_VR_L (3),
- FT_VR_L (4), FT_VR_L (5), FT_VR_L (6), FT_VR_L (7),
- FT_VR_L (8), FT_VR_L (9), FT_VR_L (10), FT_VR_L (11),
- FT_VR_L (12), FT_VR_L (13), FT_VR_L (14), FT_VR_L (15),
+ FT_VR_L (0),
+ FT_VR_L (1),
+ FT_VR_L (2),
+ FT_VR_L (3),
+ FT_VR_L (4),
+ FT_VR_L (5),
+ FT_VR_L (6),
+ FT_VR_L (7),
+ FT_VR_L (8),
+ FT_VR_L (9),
+ FT_VR_L (10),
+ FT_VR_L (11),
+ FT_VR_L (12),
+ FT_VR_L (13),
+ FT_VR_L (14),
+ FT_VR_L (15),
/* And the next 16 VRs. */
- FT_VR (16), FT_VR (17), FT_VR (18), FT_VR (19),
- FT_VR (20), FT_VR (21), FT_VR (22), FT_VR (23),
- FT_VR (24), FT_VR (25), FT_VR (26), FT_VR (27),
- FT_VR (28), FT_VR (29), FT_VR (30), FT_VR (31),
+ FT_VR (16),
+ FT_VR (17),
+ FT_VR (18),
+ FT_VR (19),
+ FT_VR (20),
+ FT_VR (21),
+ FT_VR (22),
+ FT_VR (23),
+ FT_VR (24),
+ FT_VR (25),
+ FT_VR (26),
+ FT_VR (27),
+ FT_VR (28),
+ FT_VR (29),
+ FT_VR (30),
+ FT_VR (31),
};
/* Used for s390x-te-linux64, s390x-tevx-linux64, and
@@ -212,40 +463,118 @@ static const int s390x_ft_collect_regmap[] = {
static const int s390x_te_ft_collect_regmap[] = {
/* 64-bit PSWA and PSWM. */
- FT_PSWM, FT_PSWA,
+ FT_PSWM,
+ FT_PSWA,
/* 64-bit GPRs. */
- FT_GPR (0), FT_GPR (1), FT_GPR (2), FT_GPR (3),
- FT_GPR (4), FT_GPR (5), FT_GPR (6), FT_GPR (7),
- FT_GPR (8), FT_GPR (9), FT_GPR (10), FT_GPR (11),
- FT_GPR (12), FT_GPR (13), FT_GPR (14), FT_GPR (15),
+ FT_GPR (0),
+ FT_GPR (1),
+ FT_GPR (2),
+ FT_GPR (3),
+ FT_GPR (4),
+ FT_GPR (5),
+ FT_GPR (6),
+ FT_GPR (7),
+ FT_GPR (8),
+ FT_GPR (9),
+ FT_GPR (10),
+ FT_GPR (11),
+ FT_GPR (12),
+ FT_GPR (13),
+ FT_GPR (14),
+ FT_GPR (15),
/* ACRs */
- FT_ACR (0), FT_ACR (1), FT_ACR (2), FT_ACR (3),
- FT_ACR (4), FT_ACR (5), FT_ACR (6), FT_ACR (7),
- FT_ACR (8), FT_ACR (9), FT_ACR (10), FT_ACR (11),
- FT_ACR (12), FT_ACR (13), FT_ACR (14), FT_ACR (15),
+ FT_ACR (0),
+ FT_ACR (1),
+ FT_ACR (2),
+ FT_ACR (3),
+ FT_ACR (4),
+ FT_ACR (5),
+ FT_ACR (6),
+ FT_ACR (7),
+ FT_ACR (8),
+ FT_ACR (9),
+ FT_ACR (10),
+ FT_ACR (11),
+ FT_ACR (12),
+ FT_ACR (13),
+ FT_ACR (14),
+ FT_ACR (15),
/* FPRs (mapped to upper halves of 128-bit VR slots). */
- FT_FPR (0), FT_FPR (1), FT_FPR (2), FT_FPR (3),
- FT_FPR (4), FT_FPR (5), FT_FPR (6), FT_FPR (7),
- FT_FPR (8), FT_FPR (9), FT_FPR (10), FT_FPR (11),
- FT_FPR (12), FT_FPR (13), FT_FPR (14), FT_FPR (15),
+ FT_FPR (0),
+ FT_FPR (1),
+ FT_FPR (2),
+ FT_FPR (3),
+ FT_FPR (4),
+ FT_FPR (5),
+ FT_FPR (6),
+ FT_FPR (7),
+ FT_FPR (8),
+ FT_FPR (9),
+ FT_FPR (10),
+ FT_FPR (11),
+ FT_FPR (12),
+ FT_FPR (13),
+ FT_FPR (14),
+ FT_FPR (15),
/* orig_r2, last_break, system_call */
- -1, -1, -1,
+ -1,
+ -1,
+ -1,
/* TDB */
- -1, -1, -1, -1,
- -1, -1, -1, -1,
- -1, -1, -1, -1,
- -1, -1, -1, -1,
- -1, -1, -1, -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
/* Lower halves of 128-bit VRs. */
- FT_VR_L (0), FT_VR_L (1), FT_VR_L (2), FT_VR_L (3),
- FT_VR_L (4), FT_VR_L (5), FT_VR_L (6), FT_VR_L (7),
- FT_VR_L (8), FT_VR_L (9), FT_VR_L (10), FT_VR_L (11),
- FT_VR_L (12), FT_VR_L (13), FT_VR_L (14), FT_VR_L (15),
+ FT_VR_L (0),
+ FT_VR_L (1),
+ FT_VR_L (2),
+ FT_VR_L (3),
+ FT_VR_L (4),
+ FT_VR_L (5),
+ FT_VR_L (6),
+ FT_VR_L (7),
+ FT_VR_L (8),
+ FT_VR_L (9),
+ FT_VR_L (10),
+ FT_VR_L (11),
+ FT_VR_L (12),
+ FT_VR_L (13),
+ FT_VR_L (14),
+ FT_VR_L (15),
/* And the next 16 VRs. */
- FT_VR (16), FT_VR (17), FT_VR (18), FT_VR (19),
- FT_VR (20), FT_VR (21), FT_VR (22), FT_VR (23),
- FT_VR (24), FT_VR (25), FT_VR (26), FT_VR (27),
- FT_VR (28), FT_VR (29), FT_VR (30), FT_VR (31),
+ FT_VR (16),
+ FT_VR (17),
+ FT_VR (18),
+ FT_VR (19),
+ FT_VR (20),
+ FT_VR (21),
+ FT_VR (22),
+ FT_VR (23),
+ FT_VR (24),
+ FT_VR (25),
+ FT_VR (26),
+ FT_VR (27),
+ FT_VR (28),
+ FT_VR (29),
+ FT_VR (30),
+ FT_VR (31),
};
#endif
@@ -259,7 +588,7 @@ static int s390_regnum;
void
supply_fast_tracepoint_registers (struct regcache *regcache,
- const unsigned char *buf)
+ const unsigned char *buf)
{
int i;
for (i = 0; i < s390_regnum; i++)
@@ -280,23 +609,20 @@ get_raw_reg (const unsigned char *raw_regs, int regnum)
/* The regnums are variable, better to figure out size by FT offset. */
/* 64-bit ones. */
- if (offset < FT_VR(16)
+ if (offset < FT_VR (16)
#ifdef __s390x__
- || (offset >= FT_GPR(0) && offset < FT_ACR(0))
- || offset == FT_PSWM
+ || (offset >= FT_GPR (0) && offset < FT_ACR (0)) || offset == FT_PSWM
|| offset == FT_PSWA
#endif
- )
+ )
return *(uint64_t *) (raw_regs + offset);
- if (offset >= FT_ACR(0 && offset < FT_PSWM)
- || offset == FT_FPC
+ if (offset >= FT_ACR (0 && offset < FT_PSWM) || offset == FT_FPC
#ifndef __s390x__
- || (offset >= FT_GPR(0) && offset < FT_ACR(0))
- || offset == FT_PSWM_U
+ || (offset >= FT_GPR (0) && offset < FT_ACR (0)) || offset == FT_PSWM_U
|| offset == FT_PSWA_L
#endif
- )
+ )
return *(uint32_t *) (raw_regs + offset);
/* This leaves 128-bit VX. No way to return them. */
@@ -309,66 +635,68 @@ get_raw_reg (const unsigned char *raw_regs, int regnum)
const struct target_desc *
get_ipa_tdesc (int idx)
{
-#define SET_REGMAP(regmap, skip_last) \
- do { \
- s390_regmap = regmap; \
- s390_regnum = (sizeof regmap / sizeof regmap[0]) - skip_last; \
- } while(0)
+#define SET_REGMAP(regmap, skip_last) \
+ do \
+ { \
+ s390_regmap = regmap; \
+ s390_regnum = (sizeof regmap / sizeof regmap[0]) - skip_last; \
+ } \
+ while (0)
switch (idx)
{
#ifdef __s390x__
case S390_TDESC_64:
/* Subtract number of VX regs. */
- SET_REGMAP(s390x_ft_collect_regmap, 32);
+ SET_REGMAP (s390x_ft_collect_regmap, 32);
return tdesc_s390x_linux64;
case S390_TDESC_64V1:
- SET_REGMAP(s390x_ft_collect_regmap, 32);
+ SET_REGMAP (s390x_ft_collect_regmap, 32);
return tdesc_s390x_linux64v1;
case S390_TDESC_64V2:
- SET_REGMAP(s390x_ft_collect_regmap, 32);
+ SET_REGMAP (s390x_ft_collect_regmap, 32);
return tdesc_s390x_linux64v2;
case S390_TDESC_TE:
- SET_REGMAP(s390x_te_ft_collect_regmap, 32);
+ SET_REGMAP (s390x_te_ft_collect_regmap, 32);
return tdesc_s390x_te_linux64;
case S390_TDESC_VX:
- SET_REGMAP(s390x_ft_collect_regmap, 0);
+ SET_REGMAP (s390x_ft_collect_regmap, 0);
return tdesc_s390x_vx_linux64;
case S390_TDESC_TEVX:
- SET_REGMAP(s390x_te_ft_collect_regmap, 0);
+ SET_REGMAP (s390x_te_ft_collect_regmap, 0);
return tdesc_s390x_tevx_linux64;
case S390_TDESC_GS:
- SET_REGMAP(s390x_te_ft_collect_regmap, 0);
+ SET_REGMAP (s390x_te_ft_collect_regmap, 0);
return tdesc_s390x_gs_linux64;
#else
case S390_TDESC_32:
- SET_REGMAP(s390_linux32_ft_collect_regmap, 0);
+ SET_REGMAP (s390_linux32_ft_collect_regmap, 0);
return tdesc_s390_linux32;
case S390_TDESC_32V1:
- SET_REGMAP(s390_linux32_ft_collect_regmap, 0);
+ SET_REGMAP (s390_linux32_ft_collect_regmap, 0);
return tdesc_s390_linux32v1;
case S390_TDESC_32V2:
- SET_REGMAP(s390_linux32_ft_collect_regmap, 0);
+ SET_REGMAP (s390_linux32_ft_collect_regmap, 0);
return tdesc_s390_linux32v2;
case S390_TDESC_64:
- SET_REGMAP(s390_linux64_ft_collect_regmap, 32);
+ SET_REGMAP (s390_linux64_ft_collect_regmap, 32);
return tdesc_s390_linux64;
case S390_TDESC_64V1:
- SET_REGMAP(s390_linux64_ft_collect_regmap, 32);
+ SET_REGMAP (s390_linux64_ft_collect_regmap, 32);
return tdesc_s390_linux64v1;
case S390_TDESC_64V2:
- SET_REGMAP(s390_linux64_ft_collect_regmap, 32);
+ SET_REGMAP (s390_linux64_ft_collect_regmap, 32);
return tdesc_s390_linux64v2;
case S390_TDESC_TE:
- SET_REGMAP(s390_te_linux64_ft_collect_regmap, 32);
+ SET_REGMAP (s390_te_linux64_ft_collect_regmap, 32);
return tdesc_s390_te_linux64;
case S390_TDESC_VX:
- SET_REGMAP(s390_linux64_ft_collect_regmap, 0);
+ SET_REGMAP (s390_linux64_ft_collect_regmap, 0);
return tdesc_s390_vx_linux64;
case S390_TDESC_TEVX:
- SET_REGMAP(s390_te_linux64_ft_collect_regmap, 0);
+ SET_REGMAP (s390_te_linux64_ft_collect_regmap, 0);
return tdesc_s390_tevx_linux64;
case S390_TDESC_GS:
- SET_REGMAP(s390_te_linux64_ft_collect_regmap, 0);
+ SET_REGMAP (s390_te_linux64_ft_collect_regmap, 0);
return tdesc_s390_gs_linux64;
#endif
default:
@@ -411,23 +739,22 @@ alloc_jump_pad_buffer (size_t size)
for (; addr; addr -= pagesize)
{
/* No MAP_FIXED - we don't want to zap someone's mapping. */
- res = mmap ((void *) addr, size,
- PROT_READ | PROT_WRITE | PROT_EXEC,
- MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
+ res = mmap ((void *) addr, size, PROT_READ | PROT_WRITE | PROT_EXEC,
+ MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
/* If we got what we wanted, return. */
if ((uintptr_t) res == addr)
- return res;
+ return res;
/* If we got a mapping, but at a wrong address, undo it. */
if (res != MAP_FAILED)
- munmap (res, size);
+ munmap (res, size);
}
return NULL;
#else
void *res = mmap (NULL, size, PROT_READ | PROT_WRITE | PROT_EXEC,
- MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
+ MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
if (res == MAP_FAILED)
return NULL;
diff --git a/gdbserver/linux-s390-low.cc b/gdbserver/linux-s390-low.cc
index 48f64ef7bb3..afa45d5c327 100644
--- a/gdbserver/linux-s390-low.cc
+++ b/gdbserver/linux-s390-low.cc
@@ -56,7 +56,6 @@
class s390_target : public linux_process_target
{
public:
-
const regs_info *get_regs_info () override;
const gdb_byte *sw_breakpoint_from_kind (int kind, int *size) override;
@@ -67,28 +66,27 @@ public:
bool supports_fast_tracepoints () override;
- int install_fast_tracepoint_jump_pad
- (CORE_ADDR tpoint, CORE_ADDR tpaddr, CORE_ADDR collector,
- CORE_ADDR lockaddr, ULONGEST orig_size, CORE_ADDR *jump_entry,
- CORE_ADDR *trampoline, ULONGEST *trampoline_size,
- unsigned char *jjump_pad_insn, ULONGEST *jjump_pad_insn_size,
- CORE_ADDR *adjusted_insn_addr, CORE_ADDR *adjusted_insn_addr_end,
- char *err) override;
+ int install_fast_tracepoint_jump_pad (
+ CORE_ADDR tpoint, CORE_ADDR tpaddr, CORE_ADDR collector,
+ CORE_ADDR lockaddr, ULONGEST orig_size, CORE_ADDR *jump_entry,
+ CORE_ADDR *trampoline, ULONGEST *trampoline_size,
+ unsigned char *jjump_pad_insn, ULONGEST *jjump_pad_insn_size,
+ CORE_ADDR *adjusted_insn_addr, CORE_ADDR *adjusted_insn_addr_end,
+ char *err) override;
int get_min_fast_tracepoint_insn_len () override;
void low_collect_ptrace_register (regcache *regcache, int regno,
- char *buf) override;
+ char *buf) override;
void low_supply_ptrace_register (regcache *regcache, int regno,
- const char *buf) override;
+ const char *buf) override;
struct emit_ops *emit_ops () override;
int get_ipa_tdesc_idx () override;
protected:
-
void low_arch_setup () override;
bool low_cannot_fetch_register (int regno) override;
@@ -113,30 +111,26 @@ protected:
static s390_target the_s390_target;
static int s390_regmap[] = {
- PT_PSWMASK, PT_PSWADDR,
+ PT_PSWMASK, PT_PSWADDR,
- PT_GPR0, PT_GPR1, PT_GPR2, PT_GPR3,
- PT_GPR4, PT_GPR5, PT_GPR6, PT_GPR7,
- PT_GPR8, PT_GPR9, PT_GPR10, PT_GPR11,
- PT_GPR12, PT_GPR13, PT_GPR14, PT_GPR15,
+ PT_GPR0, PT_GPR1, PT_GPR2, PT_GPR3, PT_GPR4, PT_GPR5,
+ PT_GPR6, PT_GPR7, PT_GPR8, PT_GPR9, PT_GPR10, PT_GPR11,
+ PT_GPR12, PT_GPR13, PT_GPR14, PT_GPR15,
- PT_ACR0, PT_ACR1, PT_ACR2, PT_ACR3,
- PT_ACR4, PT_ACR5, PT_ACR6, PT_ACR7,
- PT_ACR8, PT_ACR9, PT_ACR10, PT_ACR11,
- PT_ACR12, PT_ACR13, PT_ACR14, PT_ACR15,
+ PT_ACR0, PT_ACR1, PT_ACR2, PT_ACR3, PT_ACR4, PT_ACR5,
+ PT_ACR6, PT_ACR7, PT_ACR8, PT_ACR9, PT_ACR10, PT_ACR11,
+ PT_ACR12, PT_ACR13, PT_ACR14, PT_ACR15,
PT_FPC,
#ifndef __s390x__
- PT_FPR0_HI, PT_FPR1_HI, PT_FPR2_HI, PT_FPR3_HI,
- PT_FPR4_HI, PT_FPR5_HI, PT_FPR6_HI, PT_FPR7_HI,
- PT_FPR8_HI, PT_FPR9_HI, PT_FPR10_HI, PT_FPR11_HI,
+ PT_FPR0_HI, PT_FPR1_HI, PT_FPR2_HI, PT_FPR3_HI, PT_FPR4_HI, PT_FPR5_HI,
+ PT_FPR6_HI, PT_FPR7_HI, PT_FPR8_HI, PT_FPR9_HI, PT_FPR10_HI, PT_FPR11_HI,
PT_FPR12_HI, PT_FPR13_HI, PT_FPR14_HI, PT_FPR15_HI,
#else
- PT_FPR0, PT_FPR1, PT_FPR2, PT_FPR3,
- PT_FPR4, PT_FPR5, PT_FPR6, PT_FPR7,
- PT_FPR8, PT_FPR9, PT_FPR10, PT_FPR11,
- PT_FPR12, PT_FPR13, PT_FPR14, PT_FPR15,
+ PT_FPR0, PT_FPR1, PT_FPR2, PT_FPR3, PT_FPR4, PT_FPR5,
+ PT_FPR6, PT_FPR7, PT_FPR8, PT_FPR9, PT_FPR10, PT_FPR11,
+ PT_FPR12, PT_FPR13, PT_FPR14, PT_FPR15,
#endif
PT_ORIGGPR2,
@@ -146,61 +140,51 @@ static int s390_regmap[] = {
#ifdef __s390x__
static int s390_regmap_3264[] = {
- PT_PSWMASK, PT_PSWADDR,
-
- PT_GPR0, PT_GPR0, PT_GPR1, PT_GPR1,
- PT_GPR2, PT_GPR2, PT_GPR3, PT_GPR3,
- PT_GPR4, PT_GPR4, PT_GPR5, PT_GPR5,
- PT_GPR6, PT_GPR6, PT_GPR7, PT_GPR7,
- PT_GPR8, PT_GPR8, PT_GPR9, PT_GPR9,
- PT_GPR10, PT_GPR10, PT_GPR11, PT_GPR11,
- PT_GPR12, PT_GPR12, PT_GPR13, PT_GPR13,
- PT_GPR14, PT_GPR14, PT_GPR15, PT_GPR15,
-
- PT_ACR0, PT_ACR1, PT_ACR2, PT_ACR3,
- PT_ACR4, PT_ACR5, PT_ACR6, PT_ACR7,
- PT_ACR8, PT_ACR9, PT_ACR10, PT_ACR11,
- PT_ACR12, PT_ACR13, PT_ACR14, PT_ACR15,
+ PT_PSWMASK, PT_PSWADDR,
+
+ PT_GPR0, PT_GPR0, PT_GPR1, PT_GPR1, PT_GPR2, PT_GPR2, PT_GPR3,
+ PT_GPR3, PT_GPR4, PT_GPR4, PT_GPR5, PT_GPR5, PT_GPR6, PT_GPR6,
+ PT_GPR7, PT_GPR7, PT_GPR8, PT_GPR8, PT_GPR9, PT_GPR9, PT_GPR10,
+ PT_GPR10, PT_GPR11, PT_GPR11, PT_GPR12, PT_GPR12, PT_GPR13, PT_GPR13,
+ PT_GPR14, PT_GPR14, PT_GPR15, PT_GPR15,
+
+ PT_ACR0, PT_ACR1, PT_ACR2, PT_ACR3, PT_ACR4, PT_ACR5, PT_ACR6,
+ PT_ACR7, PT_ACR8, PT_ACR9, PT_ACR10, PT_ACR11, PT_ACR12, PT_ACR13,
+ PT_ACR14, PT_ACR15,
PT_FPC,
- PT_FPR0, PT_FPR1, PT_FPR2, PT_FPR3,
- PT_FPR4, PT_FPR5, PT_FPR6, PT_FPR7,
- PT_FPR8, PT_FPR9, PT_FPR10, PT_FPR11,
- PT_FPR12, PT_FPR13, PT_FPR14, PT_FPR15,
+ PT_FPR0, PT_FPR1, PT_FPR2, PT_FPR3, PT_FPR4, PT_FPR5, PT_FPR6,
+ PT_FPR7, PT_FPR8, PT_FPR9, PT_FPR10, PT_FPR11, PT_FPR12, PT_FPR13,
+ PT_FPR14, PT_FPR15,
PT_ORIGGPR2,
};
#else
static int s390_regmap_3264[] = {
- PT_PSWMASK, PT_PSWADDR,
-
- -1, PT_GPR0, -1, PT_GPR1,
- -1, PT_GPR2, -1, PT_GPR3,
- -1, PT_GPR4, -1, PT_GPR5,
- -1, PT_GPR6, -1, PT_GPR7,
- -1, PT_GPR8, -1, PT_GPR9,
- -1, PT_GPR10, -1, PT_GPR11,
- -1, PT_GPR12, -1, PT_GPR13,
- -1, PT_GPR14, -1, PT_GPR15,
-
- PT_ACR0, PT_ACR1, PT_ACR2, PT_ACR3,
- PT_ACR4, PT_ACR5, PT_ACR6, PT_ACR7,
- PT_ACR8, PT_ACR9, PT_ACR10, PT_ACR11,
- PT_ACR12, PT_ACR13, PT_ACR14, PT_ACR15,
+ PT_PSWMASK, PT_PSWADDR,
+
+ -1, PT_GPR0, -1, PT_GPR1, -1, PT_GPR2,
+ -1, PT_GPR3, -1, PT_GPR4, -1, PT_GPR5,
+ -1, PT_GPR6, -1, PT_GPR7, -1, PT_GPR8,
+ -1, PT_GPR9, -1, PT_GPR10, -1, PT_GPR11,
+ -1, PT_GPR12, -1, PT_GPR13, -1, PT_GPR14,
+ -1, PT_GPR15,
+
+ PT_ACR0, PT_ACR1, PT_ACR2, PT_ACR3, PT_ACR4, PT_ACR5,
+ PT_ACR6, PT_ACR7, PT_ACR8, PT_ACR9, PT_ACR10, PT_ACR11,
+ PT_ACR12, PT_ACR13, PT_ACR14, PT_ACR15,
PT_FPC,
- PT_FPR0_HI, PT_FPR1_HI, PT_FPR2_HI, PT_FPR3_HI,
- PT_FPR4_HI, PT_FPR5_HI, PT_FPR6_HI, PT_FPR7_HI,
- PT_FPR8_HI, PT_FPR9_HI, PT_FPR10_HI, PT_FPR11_HI,
+ PT_FPR0_HI, PT_FPR1_HI, PT_FPR2_HI, PT_FPR3_HI, PT_FPR4_HI, PT_FPR5_HI,
+ PT_FPR6_HI, PT_FPR7_HI, PT_FPR8_HI, PT_FPR9_HI, PT_FPR10_HI, PT_FPR11_HI,
PT_FPR12_HI, PT_FPR13_HI, PT_FPR14_HI, PT_FPR15_HI,
PT_ORIGGPR2,
};
#endif
-
bool
s390_target::low_cannot_fetch_register (int regno)
{
@@ -215,7 +199,7 @@ s390_target::low_cannot_store_register (int regno)
void
s390_target::low_collect_ptrace_register (regcache *regcache, int regno,
- char *buf)
+ char *buf)
{
int size = register_size (regcache->tdesc, regno);
const struct regs_info *regs_info = get_regs_info ();
@@ -226,35 +210,35 @@ s390_target::low_collect_ptrace_register (regcache *regcache, int regno,
{
memset (buf, 0, sizeof (long));
- if ((regno ^ 1) < usr->num_regs
- && usr->regmap[regno ^ 1] == regaddr)
- {
- collect_register (regcache, regno & ~1, buf);
- collect_register (regcache, (regno & ~1) + 1,
- buf + sizeof (long) - size);
- }
+ if ((regno ^ 1) < usr->num_regs && usr->regmap[regno ^ 1] == regaddr)
+ {
+ collect_register (regcache, regno & ~1, buf);
+ collect_register (regcache, (regno & ~1) + 1,
+ buf + sizeof (long) - size);
+ }
else if (regaddr == PT_PSWMASK)
- {
- /* Convert 4-byte PSW mask to 8 bytes by clearing bit 12 and copying
+ {
+ /* Convert 4-byte PSW mask to 8 bytes by clearing bit 12 and copying
the basic addressing mode bit from the PSW address. */
- gdb_byte *addr = (gdb_byte *) alloca (register_size (regcache->tdesc, regno ^ 1));
- collect_register (regcache, regno, buf);
- collect_register (regcache, regno ^ 1, addr);
- buf[1] &= ~0x8;
- buf[size] |= (addr[0] & 0x80);
- }
+ gdb_byte *addr
+ = (gdb_byte *) alloca (register_size (regcache->tdesc, regno ^ 1));
+ collect_register (regcache, regno, buf);
+ collect_register (regcache, regno ^ 1, addr);
+ buf[1] &= ~0x8;
+ buf[size] |= (addr[0] & 0x80);
+ }
else if (regaddr == PT_PSWADDR)
- {
- /* Convert 4-byte PSW address to 8 bytes by clearing the addressing
+ {
+ /* Convert 4-byte PSW address to 8 bytes by clearing the addressing
mode bit (which gets copied to the PSW mask instead). */
- collect_register (regcache, regno, buf + sizeof (long) - size);
- buf[sizeof (long) - size] &= ~0x80;
- }
+ collect_register (regcache, regno, buf + sizeof (long) - size);
+ buf[sizeof (long) - size] &= ~0x80;
+ }
else if ((regaddr >= PT_GPR0 && regaddr <= PT_GPR15)
- || regaddr == PT_ORIGGPR2)
- collect_register (regcache, regno, buf + sizeof (long) - size);
+ || regaddr == PT_ORIGGPR2)
+ collect_register (regcache, regno, buf + sizeof (long) - size);
else
- collect_register (regcache, regno, buf);
+ collect_register (regcache, regno, buf);
}
else if (regaddr != -1)
collect_register (regcache, regno, buf);
@@ -262,7 +246,7 @@ s390_target::low_collect_ptrace_register (regcache *regcache, int regno,
void
s390_target::low_supply_ptrace_register (regcache *regcache, int regno,
- const char *buf)
+ const char *buf)
{
int size = register_size (regcache->tdesc, regno);
const struct regs_info *regs_info = get_regs_info ();
@@ -271,46 +255,46 @@ s390_target::low_supply_ptrace_register (regcache *regcache, int regno,
if (size < sizeof (long))
{
- if ((regno ^ 1) < usr->num_regs
- && usr->regmap[regno ^ 1] == regaddr)
- {
- supply_register (regcache, regno & ~1, buf);
- supply_register (regcache, (regno & ~1) + 1,
- buf + sizeof (long) - size);
- }
+ if ((regno ^ 1) < usr->num_regs && usr->regmap[regno ^ 1] == regaddr)
+ {
+ supply_register (regcache, regno & ~1, buf);
+ supply_register (regcache, (regno & ~1) + 1,
+ buf + sizeof (long) - size);
+ }
else if (regaddr == PT_PSWMASK)
- {
- /* Convert 8-byte PSW mask to 4 bytes by setting bit 12 and copying
+ {
+ /* Convert 8-byte PSW mask to 4 bytes by setting bit 12 and copying
the basic addressing mode into the PSW address. */
- gdb_byte *mask = (gdb_byte *) alloca (size);
- gdb_byte *addr = (gdb_byte *) alloca (register_size (regcache->tdesc, regno ^ 1));
- memcpy (mask, buf, size);
- mask[1] |= 0x8;
- supply_register (regcache, regno, mask);
-
- collect_register (regcache, regno ^ 1, addr);
- addr[0] &= ~0x80;
- addr[0] |= (buf[size] & 0x80);
- supply_register (regcache, regno ^ 1, addr);
- }
+ gdb_byte *mask = (gdb_byte *) alloca (size);
+ gdb_byte *addr
+ = (gdb_byte *) alloca (register_size (regcache->tdesc, regno ^ 1));
+ memcpy (mask, buf, size);
+ mask[1] |= 0x8;
+ supply_register (regcache, regno, mask);
+
+ collect_register (regcache, regno ^ 1, addr);
+ addr[0] &= ~0x80;
+ addr[0] |= (buf[size] & 0x80);
+ supply_register (regcache, regno ^ 1, addr);
+ }
else if (regaddr == PT_PSWADDR)
- {
- /* Convert 8-byte PSW address to 4 bytes by truncating, but
+ {
+ /* Convert 8-byte PSW address to 4 bytes by truncating, but
keeping the addressing mode bit (which was set from the mask). */
- gdb_byte *addr = (gdb_byte *) alloca (size);
- char amode;
- collect_register (regcache, regno, addr);
- amode = addr[0] & 0x80;
- memcpy (addr, buf + sizeof (long) - size, size);
- addr[0] &= ~0x80;
- addr[0] |= amode;
- supply_register (regcache, regno, addr);
- }
+ gdb_byte *addr = (gdb_byte *) alloca (size);
+ char amode;
+ collect_register (regcache, regno, addr);
+ amode = addr[0] & 0x80;
+ memcpy (addr, buf + sizeof (long) - size, size);
+ addr[0] &= ~0x80;
+ addr[0] |= amode;
+ supply_register (regcache, regno, addr);
+ }
else if ((regaddr >= PT_GPR0 && regaddr <= PT_GPR15)
- || regaddr == PT_ORIGGPR2)
- supply_register (regcache, regno, buf + sizeof (long) - size);
+ || regaddr == PT_ORIGGPR2)
+ supply_register (regcache, regno, buf + sizeof (long) - size);
else
- supply_register (regcache, regno, buf);
+ supply_register (regcache, regno, buf);
}
else if (regaddr != -1)
supply_register (regcache, regno, buf);
@@ -328,12 +312,12 @@ s390_fill_gregset (struct regcache *regcache, void *buf)
for (i = 0; i < usr->num_regs; i++)
{
- if (usr->regmap[i] < PT_PSWMASK
- || usr->regmap[i] > PT_ACR15)
- continue;
+ if (usr->regmap[i] < PT_PSWMASK || usr->regmap[i] > PT_ACR15)
+ continue;
- ((s390_target *) the_linux_target)->low_collect_ptrace_register
- (regcache, i, (char *) buf + usr->regmap[i]);
+ ((s390_target *) the_linux_target)
+ ->low_collect_ptrace_register (regcache, i,
+ (char *) buf + usr->regmap[i]);
}
}
@@ -456,32 +440,30 @@ s390_store_gsbc (struct regcache *regcache, const void *buf)
supply_register (regcache, bc_gsd + i, (const char *) buf + 8 * (i + 1));
}
-static struct regset_info s390_regsets[] = {
- { 0, 0, 0, 0, GENERAL_REGS, s390_fill_gregset, NULL },
+static struct regset_info s390_regsets[]
+ = { { 0, 0, 0, 0, GENERAL_REGS, s390_fill_gregset, NULL },
#ifndef __s390x__
- { PTRACE_GETREGSET, PTRACE_SETREGSET, NT_S390_HIGH_GPRS, 0,
- EXTENDED_REGS, s390_fill_gprs_high, s390_store_gprs_high },
+ { PTRACE_GETREGSET, PTRACE_SETREGSET, NT_S390_HIGH_GPRS, 0,
+ EXTENDED_REGS, s390_fill_gprs_high, s390_store_gprs_high },
#endif
- /* Last break address is read-only; no fill function. */
- { PTRACE_GETREGSET, -1, NT_S390_LAST_BREAK, 0, EXTENDED_REGS,
- NULL, s390_store_last_break },
- { PTRACE_GETREGSET, PTRACE_SETREGSET, NT_S390_SYSTEM_CALL, 0,
- EXTENDED_REGS, s390_fill_system_call, s390_store_system_call },
- /* TDB is read-only. */
- { PTRACE_GETREGSET, -1, NT_S390_TDB, 0, EXTENDED_REGS,
- NULL, s390_store_tdb },
- { PTRACE_GETREGSET, PTRACE_SETREGSET, NT_S390_VXRS_LOW, 0,
- EXTENDED_REGS, s390_fill_vxrs_low, s390_store_vxrs_low },
- { PTRACE_GETREGSET, PTRACE_SETREGSET, NT_S390_VXRS_HIGH, 0,
- EXTENDED_REGS, s390_fill_vxrs_high, s390_store_vxrs_high },
- /* Guarded storage registers are read-only. */
- { PTRACE_GETREGSET, -1, NT_S390_GS_CB, 0, EXTENDED_REGS,
- NULL, s390_store_gs },
- { PTRACE_GETREGSET, -1, NT_S390_GS_BC, 0, EXTENDED_REGS,
- NULL, s390_store_gsbc },
- NULL_REGSET
-};
-
+ /* Last break address is read-only; no fill function. */
+ { PTRACE_GETREGSET, -1, NT_S390_LAST_BREAK, 0, EXTENDED_REGS, NULL,
+ s390_store_last_break },
+ { PTRACE_GETREGSET, PTRACE_SETREGSET, NT_S390_SYSTEM_CALL, 0,
+ EXTENDED_REGS, s390_fill_system_call, s390_store_system_call },
+ /* TDB is read-only. */
+ { PTRACE_GETREGSET, -1, NT_S390_TDB, 0, EXTENDED_REGS, NULL,
+ s390_store_tdb },
+ { PTRACE_GETREGSET, PTRACE_SETREGSET, NT_S390_VXRS_LOW, 0, EXTENDED_REGS,
+ s390_fill_vxrs_low, s390_store_vxrs_low },
+ { PTRACE_GETREGSET, PTRACE_SETREGSET, NT_S390_VXRS_HIGH, 0,
+ EXTENDED_REGS, s390_fill_vxrs_high, s390_store_vxrs_high },
+ /* Guarded storage registers are read-only. */
+ { PTRACE_GETREGSET, -1, NT_S390_GS_CB, 0, EXTENDED_REGS, NULL,
+ s390_store_gs },
+ { PTRACE_GETREGSET, -1, NT_S390_GS_BC, 0, EXTENDED_REGS, NULL,
+ s390_store_gsbc },
+ NULL_REGSET };
static const gdb_byte s390_breakpoint[] = { 0, 1 };
#define s390_breakpoint_len 2
@@ -548,12 +530,11 @@ static int
s390_get_wordsize (int pid)
{
errno = 0;
- PTRACE_XFER_TYPE pswm = ptrace (PTRACE_PEEKUSER, pid,
- (PTRACE_TYPE_ARG3) 0,
- (PTRACE_TYPE_ARG4) 0);
+ PTRACE_XFER_TYPE pswm = ptrace (PTRACE_PEEKUSER, pid, (PTRACE_TYPE_ARG3) 0,
+ (PTRACE_TYPE_ARG4) 0);
if (errno != 0)
{
- warning (_("Couldn't determine word size, assuming 64-bit."));
+ warning (_ ("Couldn't determine word size, assuming 64-bit."));
return 8;
}
/* Derive word size from extended addressing mode (PSW bit 31). */
@@ -595,71 +576,67 @@ s390_target::low_arch_setup ()
unsigned long hwcap = linux_get_hwcap (pid, wordsize);
/* Check whether the kernel supports extra register sets. */
- int have_regset_last_break
- = s390_check_regset (pid, NT_S390_LAST_BREAK, 8);
+ int have_regset_last_break = s390_check_regset (pid, NT_S390_LAST_BREAK, 8);
int have_regset_system_call
= s390_check_regset (pid, NT_S390_SYSTEM_CALL, 4);
- int have_regset_tdb
- = (s390_check_regset (pid, NT_S390_TDB, 256)
- && (hwcap & HWCAP_S390_TE) != 0);
- int have_regset_vxrs
- = (s390_check_regset (pid, NT_S390_VXRS_LOW, 128)
- && s390_check_regset (pid, NT_S390_VXRS_HIGH, 256)
- && (hwcap & HWCAP_S390_VX) != 0);
- int have_regset_gs
- = (s390_check_regset (pid, NT_S390_GS_CB, 32)
- && s390_check_regset (pid, NT_S390_GS_BC, 32)
- && (hwcap & HWCAP_S390_GS) != 0);
+ int have_regset_tdb = (s390_check_regset (pid, NT_S390_TDB, 256)
+ && (hwcap & HWCAP_S390_TE) != 0);
+ int have_regset_vxrs = (s390_check_regset (pid, NT_S390_VXRS_LOW, 128)
+ && s390_check_regset (pid, NT_S390_VXRS_HIGH, 256)
+ && (hwcap & HWCAP_S390_VX) != 0);
+ int have_regset_gs = (s390_check_regset (pid, NT_S390_GS_CB, 32)
+ && s390_check_regset (pid, NT_S390_GS_BC, 32)
+ && (hwcap & HWCAP_S390_GS) != 0);
{
#ifdef __s390x__
if (wordsize == 8)
{
- if (have_regset_gs)
- tdesc = tdesc_s390x_gs_linux64;
- else if (have_regset_vxrs)
- tdesc = (have_regset_tdb ? tdesc_s390x_tevx_linux64 :
- tdesc_s390x_vx_linux64);
- else if (have_regset_tdb)
- tdesc = tdesc_s390x_te_linux64;
- else if (have_regset_system_call)
- tdesc = tdesc_s390x_linux64v2;
- else if (have_regset_last_break)
- tdesc = tdesc_s390x_linux64v1;
- else
- tdesc = tdesc_s390x_linux64;
+ if (have_regset_gs)
+ tdesc = tdesc_s390x_gs_linux64;
+ else if (have_regset_vxrs)
+ tdesc = (have_regset_tdb ? tdesc_s390x_tevx_linux64
+ : tdesc_s390x_vx_linux64);
+ else if (have_regset_tdb)
+ tdesc = tdesc_s390x_te_linux64;
+ else if (have_regset_system_call)
+ tdesc = tdesc_s390x_linux64v2;
+ else if (have_regset_last_break)
+ tdesc = tdesc_s390x_linux64v1;
+ else
+ tdesc = tdesc_s390x_linux64;
}
/* For a 31-bit inferior, check whether the kernel supports
using the full 64-bit GPRs. */
else
#endif
- if (hwcap & HWCAP_S390_HIGH_GPRS)
+ if (hwcap & HWCAP_S390_HIGH_GPRS)
{
- have_hwcap_s390_high_gprs = 1;
- if (have_regset_gs)
- tdesc = tdesc_s390_gs_linux64;
- else if (have_regset_vxrs)
- tdesc = (have_regset_tdb ? tdesc_s390_tevx_linux64 :
- tdesc_s390_vx_linux64);
- else if (have_regset_tdb)
- tdesc = tdesc_s390_te_linux64;
- else if (have_regset_system_call)
- tdesc = tdesc_s390_linux64v2;
- else if (have_regset_last_break)
- tdesc = tdesc_s390_linux64v1;
- else
- tdesc = tdesc_s390_linux64;
+ have_hwcap_s390_high_gprs = 1;
+ if (have_regset_gs)
+ tdesc = tdesc_s390_gs_linux64;
+ else if (have_regset_vxrs)
+ tdesc = (have_regset_tdb ? tdesc_s390_tevx_linux64
+ : tdesc_s390_vx_linux64);
+ else if (have_regset_tdb)
+ tdesc = tdesc_s390_te_linux64;
+ else if (have_regset_system_call)
+ tdesc = tdesc_s390_linux64v2;
+ else if (have_regset_last_break)
+ tdesc = tdesc_s390_linux64v1;
+ else
+ tdesc = tdesc_s390_linux64;
}
else
{
- /* Assume 31-bit inferior process. */
- if (have_regset_system_call)
- tdesc = tdesc_s390_linux32v2;
- else if (have_regset_last_break)
- tdesc = tdesc_s390_linux32v1;
- else
- tdesc = tdesc_s390_linux32;
+ /* Assume 31-bit inferior process. */
+ if (have_regset_system_call)
+ tdesc = tdesc_s390_linux32v2;
+ else if (have_regset_last_break)
+ tdesc = tdesc_s390_linux32v1;
+ else
+ tdesc = tdesc_s390_linux32;
}
have_hwcap_s390_vx = have_regset_vxrs;
@@ -669,38 +646,37 @@ s390_target::low_arch_setup ()
for (regset = s390_regsets; regset->size >= 0; regset++)
if (regset->get_request == PTRACE_GETREGSET)
switch (regset->nt_type)
- {
+ {
#ifndef __s390x__
- case NT_S390_HIGH_GPRS:
- regset->size = have_hwcap_s390_high_gprs ? 64 : 0;
- break;
+ case NT_S390_HIGH_GPRS:
+ regset->size = have_hwcap_s390_high_gprs ? 64 : 0;
+ break;
#endif
- case NT_S390_LAST_BREAK:
- regset->size = have_regset_last_break ? 8 : 0;
- break;
- case NT_S390_SYSTEM_CALL:
- regset->size = have_regset_system_call ? 4 : 0;
- break;
- case NT_S390_TDB:
- regset->size = have_regset_tdb ? 256 : 0;
- break;
- case NT_S390_VXRS_LOW:
- regset->size = have_regset_vxrs ? 128 : 0;
- break;
- case NT_S390_VXRS_HIGH:
- regset->size = have_regset_vxrs ? 256 : 0;
- break;
- case NT_S390_GS_CB:
- case NT_S390_GS_BC:
- regset->size = have_regset_gs ? 32 : 0;
- default:
- break;
- }
+ case NT_S390_LAST_BREAK:
+ regset->size = have_regset_last_break ? 8 : 0;
+ break;
+ case NT_S390_SYSTEM_CALL:
+ regset->size = have_regset_system_call ? 4 : 0;
+ break;
+ case NT_S390_TDB:
+ regset->size = have_regset_tdb ? 256 : 0;
+ break;
+ case NT_S390_VXRS_LOW:
+ regset->size = have_regset_vxrs ? 128 : 0;
+ break;
+ case NT_S390_VXRS_HIGH:
+ regset->size = have_regset_vxrs ? 256 : 0;
+ break;
+ case NT_S390_GS_CB:
+ case NT_S390_GS_BC:
+ regset->size = have_regset_gs ? 32 : 0;
+ default:
+ break;
+ }
current_process ()->tdesc = tdesc;
}
-
bool
s390_target::low_breakpoint_at (CORE_ADDR pc)
{
@@ -725,45 +701,33 @@ s390_target::supports_z_point_type (char z_type)
}
}
-static struct usrregs_info s390_usrregs_info =
- {
- s390_num_regs,
- s390_regmap,
- };
+static struct usrregs_info s390_usrregs_info = {
+ s390_num_regs,
+ s390_regmap,
+};
-static struct regsets_info s390_regsets_info =
- {
- s390_regsets, /* regsets */
- 0, /* num_regsets */
- NULL, /* disabled_regsets */
- };
+static struct regsets_info s390_regsets_info = {
+ s390_regsets, /* regsets */
+ 0, /* num_regsets */
+ NULL, /* disabled_regsets */
+};
-static struct regs_info myregs_info =
- {
- NULL, /* regset_bitmap */
- &s390_usrregs_info,
- &s390_regsets_info
- };
+static struct regs_info myregs_info
+ = { NULL, /* regset_bitmap */
+ &s390_usrregs_info, &s390_regsets_info };
-static struct usrregs_info s390_usrregs_info_3264 =
- {
- s390_num_regs_3264,
- s390_regmap_3264
- };
+static struct usrregs_info s390_usrregs_info_3264
+ = { s390_num_regs_3264, s390_regmap_3264 };
-static struct regsets_info s390_regsets_info_3264 =
- {
- s390_regsets, /* regsets */
- 0, /* num_regsets */
- NULL, /* disabled_regsets */
- };
+static struct regsets_info s390_regsets_info_3264 = {
+ s390_regsets, /* regsets */
+ 0, /* num_regsets */
+ NULL, /* disabled_regsets */
+};
-static struct regs_info regs_info_3264 =
- {
- NULL, /* regset_bitmap */
- &s390_usrregs_info_3264,
- &s390_regsets_info_3264
- };
+static struct regs_info regs_info_3264
+ = { NULL, /* regset_bitmap */
+ &s390_usrregs_info_3264, &s390_regsets_info_3264 };
const regs_info *
s390_target::get_regs_info ()
@@ -774,7 +738,7 @@ s390_target::get_regs_info ()
const struct target_desc *tdesc = current_process ()->tdesc;
if (register_size (tdesc, 0) == 4)
- return &regs_info_3264;
+ return &regs_info_3264;
#else
return &regs_info_3264;
#endif
@@ -806,7 +770,6 @@ s390_target::low_get_thread_area (int lwpid, CORE_ADDR *addrp)
return 0;
}
-
/* Fast tracepoint support.
The register save area on stack is identical for all targets:
@@ -832,51 +795,51 @@ s390_target::low_get_thread_area (int lwpid, CORE_ADDR *addrp)
then branch to common path. */
static const unsigned char s390_ft_entry_gpr_esa[] = {
- 0xa7, 0x14, 0x00, 0x1e, /* jo .Lcc3 */
- 0xa7, 0x24, 0x00, 0x14, /* jh .Lcc2 */
- 0xa7, 0x44, 0x00, 0x0a, /* jl .Lcc1 */
+ 0xa7, 0x14, 0x00, 0x1e, /* jo .Lcc3 */
+ 0xa7, 0x24, 0x00, 0x14, /* jh .Lcc2 */
+ 0xa7, 0x44, 0x00, 0x0a, /* jl .Lcc1 */
/* CC = 0 */
- 0xa7, 0xfa, 0xfd, 0x00, /* ahi %r15, -0x300 */
- 0x50, 0x00, 0xf2, 0x04, /* st %r0, 0x204(%r15) */
- 0xa7, 0x08, 0x00, 0x00, /* lhi %r0, 0 */
- 0xa7, 0xf4, 0x00, 0x18, /* j .Lccdone */
+ 0xa7, 0xfa, 0xfd, 0x00, /* ahi %r15, -0x300 */
+ 0x50, 0x00, 0xf2, 0x04, /* st %r0, 0x204(%r15) */
+ 0xa7, 0x08, 0x00, 0x00, /* lhi %r0, 0 */
+ 0xa7, 0xf4, 0x00, 0x18, /* j .Lccdone */
/* .Lcc1: */
- 0xa7, 0xfa, 0xfd, 0x00, /* ahi %r15, -0x300 */
- 0x50, 0x00, 0xf2, 0x04, /* st %r0, 0x204(%r15) */
- 0xa7, 0x08, 0x10, 0x00, /* lhi %r0, 0x1000 */
- 0xa7, 0xf4, 0x00, 0x10, /* j .Lccdone */
+ 0xa7, 0xfa, 0xfd, 0x00, /* ahi %r15, -0x300 */
+ 0x50, 0x00, 0xf2, 0x04, /* st %r0, 0x204(%r15) */
+ 0xa7, 0x08, 0x10, 0x00, /* lhi %r0, 0x1000 */
+ 0xa7, 0xf4, 0x00, 0x10, /* j .Lccdone */
/* .Lcc2: */
- 0xa7, 0xfa, 0xfd, 0x00, /* ahi %r15, -0x300 */
- 0x50, 0x00, 0xf2, 0x04, /* st %r0, 0x204(%r15) */
- 0xa7, 0x08, 0x20, 0x00, /* lhi %r0, 0x2000 */
- 0xa7, 0xf4, 0x00, 0x08, /* j .Lccdone */
+ 0xa7, 0xfa, 0xfd, 0x00, /* ahi %r15, -0x300 */
+ 0x50, 0x00, 0xf2, 0x04, /* st %r0, 0x204(%r15) */
+ 0xa7, 0x08, 0x20, 0x00, /* lhi %r0, 0x2000 */
+ 0xa7, 0xf4, 0x00, 0x08, /* j .Lccdone */
/* .Lcc3: */
- 0xa7, 0xfa, 0xfd, 0x00, /* ahi %r15, -0x300 */
- 0x50, 0x00, 0xf2, 0x04, /* st %r0, 0x204(%r15) */
- 0xa7, 0x08, 0x30, 0x00, /* lhi %r0, 0x3000 */
+ 0xa7, 0xfa, 0xfd, 0x00, /* ahi %r15, -0x300 */
+ 0x50, 0x00, 0xf2, 0x04, /* st %r0, 0x204(%r15) */
+ 0xa7, 0x08, 0x30, 0x00, /* lhi %r0, 0x3000 */
/* .Lccdone: */
- 0x50, 0x10, 0xf2, 0x0c, /* st %r1, 0x20c(%r15) */
- 0x50, 0x20, 0xf2, 0x14, /* st %r2, 0x214(%r15) */
- 0x50, 0x30, 0xf2, 0x1c, /* st %r3, 0x21c(%r15) */
- 0x50, 0x40, 0xf2, 0x24, /* st %r4, 0x224(%r15) */
- 0x50, 0x50, 0xf2, 0x2c, /* st %r5, 0x22c(%r15) */
- 0x50, 0x60, 0xf2, 0x34, /* st %r6, 0x234(%r15) */
- 0x50, 0x70, 0xf2, 0x3c, /* st %r7, 0x23c(%r15) */
- 0x50, 0x80, 0xf2, 0x44, /* st %r8, 0x244(%r15) */
- 0x50, 0x90, 0xf2, 0x4c, /* st %r9, 0x24c(%r15) */
- 0x50, 0xa0, 0xf2, 0x54, /* st %r10, 0x254(%r15) */
- 0x50, 0xb0, 0xf2, 0x5c, /* st %r11, 0x25c(%r15) */
- 0x50, 0xc0, 0xf2, 0x64, /* st %r12, 0x264(%r15) */
- 0x50, 0xd0, 0xf2, 0x6c, /* st %r13, 0x26c(%r15) */
- 0x50, 0xe0, 0xf2, 0x74, /* st %r14, 0x274(%r15) */
+ 0x50, 0x10, 0xf2, 0x0c, /* st %r1, 0x20c(%r15) */
+ 0x50, 0x20, 0xf2, 0x14, /* st %r2, 0x214(%r15) */
+ 0x50, 0x30, 0xf2, 0x1c, /* st %r3, 0x21c(%r15) */
+ 0x50, 0x40, 0xf2, 0x24, /* st %r4, 0x224(%r15) */
+ 0x50, 0x50, 0xf2, 0x2c, /* st %r5, 0x22c(%r15) */
+ 0x50, 0x60, 0xf2, 0x34, /* st %r6, 0x234(%r15) */
+ 0x50, 0x70, 0xf2, 0x3c, /* st %r7, 0x23c(%r15) */
+ 0x50, 0x80, 0xf2, 0x44, /* st %r8, 0x244(%r15) */
+ 0x50, 0x90, 0xf2, 0x4c, /* st %r9, 0x24c(%r15) */
+ 0x50, 0xa0, 0xf2, 0x54, /* st %r10, 0x254(%r15) */
+ 0x50, 0xb0, 0xf2, 0x5c, /* st %r11, 0x25c(%r15) */
+ 0x50, 0xc0, 0xf2, 0x64, /* st %r12, 0x264(%r15) */
+ 0x50, 0xd0, 0xf2, 0x6c, /* st %r13, 0x26c(%r15) */
+ 0x50, 0xe0, 0xf2, 0x74, /* st %r14, 0x274(%r15) */
/* Compute original value of %r15 and store it. We use ahi instead
of la to preserve the whole value, and not just the low 31 bits.
This is not particularly important here, but essential in the
zarch case where someone might be using the high word of %r15
as an extra register. */
- 0x18, 0x1f, /* lr %r1, %r15 */
- 0xa7, 0x1a, 0x03, 0x00, /* ahi %r1, 0x300 */
- 0x50, 0x10, 0xf2, 0x7c, /* st %r1, 0x27c(%r15) */
+ 0x18, 0x1f, /* lr %r1, %r15 */
+ 0xa7, 0x1a, 0x03, 0x00, /* ahi %r1, 0x300 */
+ 0x50, 0x10, 0xf2, 0x7c, /* st %r1, 0x27c(%r15) */
};
/* Code sequence saving GPRs for 31-bit target with high GPRs and for 64-bit
@@ -884,74 +847,74 @@ static const unsigned char s390_ft_entry_gpr_esa[] = {
since the 64-bit regs are tightly packed. */
static const unsigned char s390_ft_entry_gpr_zarch[] = {
- 0xa7, 0x14, 0x00, 0x21, /* jo .Lcc3 */
- 0xa7, 0x24, 0x00, 0x16, /* jh .Lcc2 */
- 0xa7, 0x44, 0x00, 0x0b, /* jl .Lcc1 */
+ 0xa7, 0x14, 0x00, 0x21, /* jo .Lcc3 */
+ 0xa7, 0x24, 0x00, 0x16, /* jh .Lcc2 */
+ 0xa7, 0x44, 0x00, 0x0b, /* jl .Lcc1 */
/* CC = 0 */
- 0xa7, 0xfb, 0xfd, 0x00, /* aghi %r15, -0x300 */
- 0xeb, 0x0e, 0xf2, 0x00, 0x00, 0x24, /* stmg %r0, %r14, 0x200(%r15) */
- 0xa7, 0x08, 0x00, 0x00, /* lhi %r0, 0 */
- 0xa7, 0xf4, 0x00, 0x1b, /* j .Lccdone */
+ 0xa7, 0xfb, 0xfd, 0x00, /* aghi %r15, -0x300 */
+ 0xeb, 0x0e, 0xf2, 0x00, 0x00, 0x24, /* stmg %r0, %r14, 0x200(%r15) */
+ 0xa7, 0x08, 0x00, 0x00, /* lhi %r0, 0 */
+ 0xa7, 0xf4, 0x00, 0x1b, /* j .Lccdone */
/* .Lcc1: */
- 0xa7, 0xfb, 0xfd, 0x00, /* aghi %r15, -0x300 */
- 0xeb, 0x0e, 0xf2, 0x00, 0x00, 0x24, /* stmg %r0, %r14, 0x200(%r15) */
- 0xa7, 0x08, 0x10, 0x00, /* lhi %r0, 0x1000 */
- 0xa7, 0xf4, 0x00, 0x12, /* j .Lccdone */
+ 0xa7, 0xfb, 0xfd, 0x00, /* aghi %r15, -0x300 */
+ 0xeb, 0x0e, 0xf2, 0x00, 0x00, 0x24, /* stmg %r0, %r14, 0x200(%r15) */
+ 0xa7, 0x08, 0x10, 0x00, /* lhi %r0, 0x1000 */
+ 0xa7, 0xf4, 0x00, 0x12, /* j .Lccdone */
/* .Lcc2: */
- 0xa7, 0xfb, 0xfd, 0x00, /* aghi %r15, -0x300 */
- 0xeb, 0x0e, 0xf2, 0x00, 0x00, 0x24, /* stmg %r0, %r14, 0x200(%r15) */
- 0xa7, 0x08, 0x20, 0x00, /* lhi %r0, 0x2000 */
- 0xa7, 0xf4, 0x00, 0x09, /* j .Lccdone */
+ 0xa7, 0xfb, 0xfd, 0x00, /* aghi %r15, -0x300 */
+ 0xeb, 0x0e, 0xf2, 0x00, 0x00, 0x24, /* stmg %r0, %r14, 0x200(%r15) */
+ 0xa7, 0x08, 0x20, 0x00, /* lhi %r0, 0x2000 */
+ 0xa7, 0xf4, 0x00, 0x09, /* j .Lccdone */
/* .Lcc3: */
- 0xa7, 0xfb, 0xfd, 0x00, /* aghi %r15, -0x300 */
- 0xeb, 0x0e, 0xf2, 0x00, 0x00, 0x24, /* stmg %r0, %r14, 0x200(%r15) */
- 0xa7, 0x08, 0x30, 0x00, /* lhi %r0, 0x3000 */
+ 0xa7, 0xfb, 0xfd, 0x00, /* aghi %r15, -0x300 */
+ 0xeb, 0x0e, 0xf2, 0x00, 0x00, 0x24, /* stmg %r0, %r14, 0x200(%r15) */
+ 0xa7, 0x08, 0x30, 0x00, /* lhi %r0, 0x3000 */
/* .Lccdone: */
- 0xb9, 0x04, 0x00, 0x1f, /* lgr %r1, %r15 */
- 0xa7, 0x1b, 0x03, 0x00, /* aghi %r1, 0x300 */
- 0xe3, 0x10, 0xf2, 0x78, 0x00, 0x24, /* stg %r1, 0x278(%r15) */
+ 0xb9, 0x04, 0x00, 0x1f, /* lgr %r1, %r15 */
+ 0xa7, 0x1b, 0x03, 0x00, /* aghi %r1, 0x300 */
+ 0xe3, 0x10, 0xf2, 0x78, 0x00, 0x24, /* stg %r1, 0x278(%r15) */
};
/* Code sequence saving ARs, PSWM and FPC. PSWM has to be assembled from
current PSWM (read by epsw) and CC from entry (in %r0). */
static const unsigned char s390_ft_entry_misc[] = {
- 0x9b, 0x0f, 0xf2, 0x80, /* stam %a0, %a15, 0x20(%%r15) */
- 0xb9, 0x8d, 0x00, 0x23, /* epsw %r2, %r3 */
- 0xa7, 0x18, 0xcf, 0xff, /* lhi %r1, ~0x3000 */
- 0x14, 0x21, /* nr %r2, %r1 */
- 0x16, 0x20, /* or %r2, %r0 */
- 0x50, 0x20, 0xf2, 0xc0, /* st %r2, 0x2c0(%r15) */
- 0x50, 0x30, 0xf2, 0xc4, /* st %r3, 0x2c4(%r15) */
- 0xb2, 0x9c, 0xf2, 0xd0, /* stfpc 0x2d0(%r15) */
+ 0x9b, 0x0f, 0xf2, 0x80, /* stam %a0, %a15, 0x20(%%r15) */
+ 0xb9, 0x8d, 0x00, 0x23, /* epsw %r2, %r3 */
+ 0xa7, 0x18, 0xcf, 0xff, /* lhi %r1, ~0x3000 */
+ 0x14, 0x21, /* nr %r2, %r1 */
+ 0x16, 0x20, /* or %r2, %r0 */
+ 0x50, 0x20, 0xf2, 0xc0, /* st %r2, 0x2c0(%r15) */
+ 0x50, 0x30, 0xf2, 0xc4, /* st %r3, 0x2c4(%r15) */
+ 0xb2, 0x9c, 0xf2, 0xd0, /* stfpc 0x2d0(%r15) */
};
/* Code sequence saving FRs, used if VX not supported. */
static const unsigned char s390_ft_entry_fr[] = {
- 0x60, 0x00, 0xf0, 0x00, /* std %f0, 0x000(%r15) */
- 0x60, 0x10, 0xf0, 0x10, /* std %f1, 0x010(%r15) */
- 0x60, 0x20, 0xf0, 0x20, /* std %f2, 0x020(%r15) */
- 0x60, 0x30, 0xf0, 0x30, /* std %f3, 0x030(%r15) */
- 0x60, 0x40, 0xf0, 0x40, /* std %f4, 0x040(%r15) */
- 0x60, 0x50, 0xf0, 0x50, /* std %f5, 0x050(%r15) */
- 0x60, 0x60, 0xf0, 0x60, /* std %f6, 0x060(%r15) */
- 0x60, 0x70, 0xf0, 0x70, /* std %f7, 0x070(%r15) */
- 0x60, 0x80, 0xf0, 0x80, /* std %f8, 0x080(%r15) */
- 0x60, 0x90, 0xf0, 0x90, /* std %f9, 0x090(%r15) */
- 0x60, 0xa0, 0xf0, 0xa0, /* std %f10, 0x0a0(%r15) */
- 0x60, 0xb0, 0xf0, 0xb0, /* std %f11, 0x0b0(%r15) */
- 0x60, 0xc0, 0xf0, 0xc0, /* std %f12, 0x0c0(%r15) */
- 0x60, 0xd0, 0xf0, 0xd0, /* std %f13, 0x0d0(%r15) */
- 0x60, 0xe0, 0xf0, 0xe0, /* std %f14, 0x0e0(%r15) */
- 0x60, 0xf0, 0xf0, 0xf0, /* std %f15, 0x0f0(%r15) */
+ 0x60, 0x00, 0xf0, 0x00, /* std %f0, 0x000(%r15) */
+ 0x60, 0x10, 0xf0, 0x10, /* std %f1, 0x010(%r15) */
+ 0x60, 0x20, 0xf0, 0x20, /* std %f2, 0x020(%r15) */
+ 0x60, 0x30, 0xf0, 0x30, /* std %f3, 0x030(%r15) */
+ 0x60, 0x40, 0xf0, 0x40, /* std %f4, 0x040(%r15) */
+ 0x60, 0x50, 0xf0, 0x50, /* std %f5, 0x050(%r15) */
+ 0x60, 0x60, 0xf0, 0x60, /* std %f6, 0x060(%r15) */
+ 0x60, 0x70, 0xf0, 0x70, /* std %f7, 0x070(%r15) */
+ 0x60, 0x80, 0xf0, 0x80, /* std %f8, 0x080(%r15) */
+ 0x60, 0x90, 0xf0, 0x90, /* std %f9, 0x090(%r15) */
+ 0x60, 0xa0, 0xf0, 0xa0, /* std %f10, 0x0a0(%r15) */
+ 0x60, 0xb0, 0xf0, 0xb0, /* std %f11, 0x0b0(%r15) */
+ 0x60, 0xc0, 0xf0, 0xc0, /* std %f12, 0x0c0(%r15) */
+ 0x60, 0xd0, 0xf0, 0xd0, /* std %f13, 0x0d0(%r15) */
+ 0x60, 0xe0, 0xf0, 0xe0, /* std %f14, 0x0e0(%r15) */
+ 0x60, 0xf0, 0xf0, 0xf0, /* std %f15, 0x0f0(%r15) */
};
/* Code sequence saving VRs, used if VX not supported. */
static const unsigned char s390_ft_entry_vr[] = {
- 0xe7, 0x0f, 0xf0, 0x00, 0x00, 0x3e, /* vstm %v0, %v15, 0x000(%r15) */
- 0xe7, 0x0f, 0xf1, 0x00, 0x0c, 0x3e, /* vstm %v16, %v31, 0x100(%r15) */
+ 0xe7, 0x0f, 0xf0, 0x00, 0x00, 0x3e, /* vstm %v0, %v15, 0x000(%r15) */
+ 0xe7, 0x0f, 0xf1, 0x00, 0x0c, 0x3e, /* vstm %v16, %v31, 0x100(%r15) */
};
/* Code sequence doing the collection call for 31-bit target. %r1 contains
@@ -959,34 +922,34 @@ static const unsigned char s390_ft_entry_vr[] = {
static const unsigned char s390_ft_main_31[] = {
/* Load the literals into registers. */
- 0x58, 0x50, 0x10, 0x00, /* l %r5, 0x0(%r1) */
- 0x58, 0x20, 0x10, 0x04, /* l %r2, 0x4(%r1) */
- 0x58, 0x40, 0x10, 0x08, /* l %r4, 0x8(%r1) */
- 0x58, 0x60, 0x10, 0x0c, /* l %r6, 0xc(%r1) */
+ 0x58, 0x50, 0x10, 0x00, /* l %r5, 0x0(%r1) */
+ 0x58, 0x20, 0x10, 0x04, /* l %r2, 0x4(%r1) */
+ 0x58, 0x40, 0x10, 0x08, /* l %r4, 0x8(%r1) */
+ 0x58, 0x60, 0x10, 0x0c, /* l %r6, 0xc(%r1) */
/* Save original PSWA (tracepoint address | 0x80000000). */
- 0x50, 0x50, 0xf2, 0xcc, /* st %r5, 0x2cc(%r15) */
+ 0x50, 0x50, 0xf2, 0xcc, /* st %r5, 0x2cc(%r15) */
/* Construct a collecting_t object at %r15+0x2e0. */
- 0x50, 0x20, 0xf2, 0xe0, /* st %r2, 0x2e0(%r15) */
- 0x9b, 0x00, 0xf2, 0xe4, /* stam %a0, %a0, 0x2e4(%r15) */
+ 0x50, 0x20, 0xf2, 0xe0, /* st %r2, 0x2e0(%r15) */
+ 0x9b, 0x00, 0xf2, 0xe4, /* stam %a0, %a0, 0x2e4(%r15) */
/* Move its address to %r0. */
- 0x41, 0x00, 0xf2, 0xe0, /* la %r0, 0x2e0(%r15) */
+ 0x41, 0x00, 0xf2, 0xe0, /* la %r0, 0x2e0(%r15) */
/* Take the lock. */
/* .Lloop: */
- 0xa7, 0x18, 0x00, 0x00, /* lhi %r1, 0 */
- 0xba, 0x10, 0x60, 0x00, /* cs %r1, %r0, 0(%r6) */
- 0xa7, 0x74, 0xff, 0xfc, /* jne .Lloop */
+ 0xa7, 0x18, 0x00, 0x00, /* lhi %r1, 0 */
+ 0xba, 0x10, 0x60, 0x00, /* cs %r1, %r0, 0(%r6) */
+ 0xa7, 0x74, 0xff, 0xfc, /* jne .Lloop */
/* Address of the register save block to %r3. */
- 0x18, 0x3f, /* lr %r3, %r15 */
+ 0x18, 0x3f, /* lr %r3, %r15 */
/* Make a stack frame, so that we can call the collector. */
- 0xa7, 0xfa, 0xff, 0xa0, /* ahi %r15, -0x60 */
+ 0xa7, 0xfa, 0xff, 0xa0, /* ahi %r15, -0x60 */
/* Call it. */
- 0x0d, 0xe4, /* basr %r14, %r4 */
+ 0x0d, 0xe4, /* basr %r14, %r4 */
/* And get rid of the stack frame again. */
- 0x41, 0xf0, 0xf0, 0x60, /* la %r15, 0x60(%r15) */
+ 0x41, 0xf0, 0xf0, 0x60, /* la %r15, 0x60(%r15) */
/* Leave the lock. */
- 0x07, 0xf0, /* br %r0 */
- 0xa7, 0x18, 0x00, 0x00, /* lhi %r1, 0 */
- 0x50, 0x10, 0x60, 0x00, /* st %t1, 0(%r6) */
+ 0x07, 0xf0, /* br %r0 */
+ 0xa7, 0x18, 0x00, 0x00, /* lhi %r1, 0 */
+ 0x50, 0x10, 0x60, 0x00, /* st %t1, 0(%r6) */
};
/* Code sequence doing the collection call for 64-bit target. %r1 contains
@@ -994,62 +957,62 @@ static const unsigned char s390_ft_main_31[] = {
static const unsigned char s390_ft_main_64[] = {
/* Load the literals into registers. */
- 0xe3, 0x50, 0x10, 0x00, 0x00, 0x04, /* lg %r5, 0x00(%r1) */
- 0xe3, 0x20, 0x10, 0x08, 0x00, 0x04, /* lg %r2, 0x08(%r1) */
- 0xe3, 0x40, 0x10, 0x10, 0x00, 0x04, /* lg %r4, 0x10(%r1) */
- 0xe3, 0x60, 0x10, 0x18, 0x00, 0x04, /* lg %r6, 0x18(%r1) */
+ 0xe3, 0x50, 0x10, 0x00, 0x00, 0x04, /* lg %r5, 0x00(%r1) */
+ 0xe3, 0x20, 0x10, 0x08, 0x00, 0x04, /* lg %r2, 0x08(%r1) */
+ 0xe3, 0x40, 0x10, 0x10, 0x00, 0x04, /* lg %r4, 0x10(%r1) */
+ 0xe3, 0x60, 0x10, 0x18, 0x00, 0x04, /* lg %r6, 0x18(%r1) */
/* Save original PSWA (tracepoint address). */
- 0xe3, 0x50, 0xf2, 0xc8, 0x00, 0x24, /* stg %r5, 0x2c8(%r15) */
+ 0xe3, 0x50, 0xf2, 0xc8, 0x00, 0x24, /* stg %r5, 0x2c8(%r15) */
/* Construct a collecting_t object at %r15+0x2e0. */
- 0xe3, 0x20, 0xf2, 0xe0, 0x00, 0x24, /* stg %r2, 0x2e0(%r15) */
- 0x9b, 0x01, 0xf2, 0xe8, /* stam %a0, %a1, 0x2e8(%r15) */
+ 0xe3, 0x20, 0xf2, 0xe0, 0x00, 0x24, /* stg %r2, 0x2e0(%r15) */
+ 0x9b, 0x01, 0xf2, 0xe8, /* stam %a0, %a1, 0x2e8(%r15) */
/* Move its address to %r0. */
- 0x41, 0x00, 0xf2, 0xe0, /* la %r0, 0x2e0(%r15) */
+ 0x41, 0x00, 0xf2, 0xe0, /* la %r0, 0x2e0(%r15) */
/* Take the lock. */
/* .Lloop: */
- 0xa7, 0x19, 0x00, 0x00, /* lghi %r1, 0 */
- 0xeb, 0x10, 0x60, 0x00, 0x00, 0x30, /* csg %r1, %r0, 0(%r6) */
- 0xa7, 0x74, 0xff, 0xfb, /* jne .Lloop */
+ 0xa7, 0x19, 0x00, 0x00, /* lghi %r1, 0 */
+ 0xeb, 0x10, 0x60, 0x00, 0x00, 0x30, /* csg %r1, %r0, 0(%r6) */
+ 0xa7, 0x74, 0xff, 0xfb, /* jne .Lloop */
/* Address of the register save block to %r3. */
- 0xb9, 0x04, 0x00, 0x3f, /* lgr %r3, %r15 */
+ 0xb9, 0x04, 0x00, 0x3f, /* lgr %r3, %r15 */
/* Make a stack frame, so that we can call the collector. */
- 0xa7, 0xfb, 0xff, 0x60, /* aghi %r15, -0xa0 */
+ 0xa7, 0xfb, 0xff, 0x60, /* aghi %r15, -0xa0 */
/* Call it. */
- 0x0d, 0xe4, /* basr %r14, %r4 */
+ 0x0d, 0xe4, /* basr %r14, %r4 */
/* And get rid of the stack frame again. */
- 0x41, 0xf0, 0xf0, 0xa0, /* la %r15, 0xa0(%r15) */
+ 0x41, 0xf0, 0xf0, 0xa0, /* la %r15, 0xa0(%r15) */
/* Leave the lock. */
- 0x07, 0xf0, /* br %r0 */
- 0xa7, 0x19, 0x00, 0x00, /* lghi %r1, 0 */
- 0xe3, 0x10, 0x60, 0x00, 0x00, 0x24, /* stg %t1, 0(%r6) */
+ 0x07, 0xf0, /* br %r0 */
+ 0xa7, 0x19, 0x00, 0x00, /* lghi %r1, 0 */
+ 0xe3, 0x10, 0x60, 0x00, 0x00, 0x24, /* stg %t1, 0(%r6) */
};
/* Code sequence restoring FRs, for targets with no VX support. */
static const unsigned char s390_ft_exit_fr[] = {
- 0x68, 0x00, 0xf0, 0x00, /* ld %f0, 0x000(%r15) */
- 0x68, 0x10, 0xf0, 0x10, /* ld %f1, 0x010(%r15) */
- 0x68, 0x20, 0xf0, 0x20, /* ld %f2, 0x020(%r15) */
- 0x68, 0x30, 0xf0, 0x30, /* ld %f3, 0x030(%r15) */
- 0x68, 0x40, 0xf0, 0x40, /* ld %f4, 0x040(%r15) */
- 0x68, 0x50, 0xf0, 0x50, /* ld %f5, 0x050(%r15) */
- 0x68, 0x60, 0xf0, 0x60, /* ld %f6, 0x060(%r15) */
- 0x68, 0x70, 0xf0, 0x70, /* ld %f7, 0x070(%r15) */
- 0x68, 0x80, 0xf0, 0x80, /* ld %f8, 0x080(%r15) */
- 0x68, 0x90, 0xf0, 0x90, /* ld %f9, 0x090(%r15) */
- 0x68, 0xa0, 0xf0, 0xa0, /* ld %f10, 0x0a0(%r15) */
- 0x68, 0xb0, 0xf0, 0xb0, /* ld %f11, 0x0b0(%r15) */
- 0x68, 0xc0, 0xf0, 0xc0, /* ld %f12, 0x0c0(%r15) */
- 0x68, 0xd0, 0xf0, 0xd0, /* ld %f13, 0x0d0(%r15) */
- 0x68, 0xe0, 0xf0, 0xe0, /* ld %f14, 0x0e0(%r15) */
- 0x68, 0xf0, 0xf0, 0xf0, /* ld %f15, 0x0f0(%r15) */
+ 0x68, 0x00, 0xf0, 0x00, /* ld %f0, 0x000(%r15) */
+ 0x68, 0x10, 0xf0, 0x10, /* ld %f1, 0x010(%r15) */
+ 0x68, 0x20, 0xf0, 0x20, /* ld %f2, 0x020(%r15) */
+ 0x68, 0x30, 0xf0, 0x30, /* ld %f3, 0x030(%r15) */
+ 0x68, 0x40, 0xf0, 0x40, /* ld %f4, 0x040(%r15) */
+ 0x68, 0x50, 0xf0, 0x50, /* ld %f5, 0x050(%r15) */
+ 0x68, 0x60, 0xf0, 0x60, /* ld %f6, 0x060(%r15) */
+ 0x68, 0x70, 0xf0, 0x70, /* ld %f7, 0x070(%r15) */
+ 0x68, 0x80, 0xf0, 0x80, /* ld %f8, 0x080(%r15) */
+ 0x68, 0x90, 0xf0, 0x90, /* ld %f9, 0x090(%r15) */
+ 0x68, 0xa0, 0xf0, 0xa0, /* ld %f10, 0x0a0(%r15) */
+ 0x68, 0xb0, 0xf0, 0xb0, /* ld %f11, 0x0b0(%r15) */
+ 0x68, 0xc0, 0xf0, 0xc0, /* ld %f12, 0x0c0(%r15) */
+ 0x68, 0xd0, 0xf0, 0xd0, /* ld %f13, 0x0d0(%r15) */
+ 0x68, 0xe0, 0xf0, 0xe0, /* ld %f14, 0x0e0(%r15) */
+ 0x68, 0xf0, 0xf0, 0xf0, /* ld %f15, 0x0f0(%r15) */
};
/* Code sequence restoring VRs. */
static const unsigned char s390_ft_exit_vr[] = {
- 0xe7, 0x0f, 0xf0, 0x00, 0x00, 0x36, /* vlm %v0, %v15, 0x000(%r15) */
- 0xe7, 0x0f, 0xf1, 0x00, 0x0c, 0x36, /* vlm %v16, %v31, 0x100(%r15) */
+ 0xe7, 0x0f, 0xf0, 0x00, 0x00, 0x36, /* vlm %v0, %v15, 0x000(%r15) */
+ 0xe7, 0x0f, 0xf1, 0x00, 0x0c, 0x36, /* vlm %v16, %v31, 0x100(%r15) */
};
/* Code sequence restoring misc registers. As for PSWM, only CC should be
@@ -1057,44 +1020,44 @@ static const unsigned char s390_ft_exit_vr[] = {
manufacturing an operand that'll result in the original flags. */
static const unsigned char s390_ft_exit_misc[] = {
- 0xb2, 0x9d, 0xf2, 0xd0, /* lfpc 0x2d0(%r15) */
- 0x58, 0x00, 0xf2, 0xc0, /* l %r0, 0x2c0(%r15) */
+ 0xb2, 0x9d, 0xf2, 0xd0, /* lfpc 0x2d0(%r15) */
+ 0x58, 0x00, 0xf2, 0xc0, /* l %r0, 0x2c0(%r15) */
/* Extract CC to high 2 bits of %r0. */
- 0x88, 0x00, 0x00, 0x0c, /* srl %r0, 12 */
- 0x89, 0x00, 0x00, 0x1e, /* sll %r0, 30 */
+ 0x88, 0x00, 0x00, 0x0c, /* srl %r0, 12 */
+ 0x89, 0x00, 0x00, 0x1e, /* sll %r0, 30 */
/* Add %r0 to itself. Result will be nonzero iff CC bit 0 is set, and
will have carry iff CC bit 1 is set - resulting in the same flags
as the original. */
- 0x1e, 0x00, /* alr %r0, %r0 */
- 0x9a, 0x0f, 0xf2, 0x80, /* lam %a0, %a15, 0x280(%r15) */
+ 0x1e, 0x00, /* alr %r0, %r0 */
+ 0x9a, 0x0f, 0xf2, 0x80, /* lam %a0, %a15, 0x280(%r15) */
};
/* Code sequence restoring GPRs, for 31-bit targets with no high GPRs. */
static const unsigned char s390_ft_exit_gpr_esa[] = {
- 0x58, 0x00, 0xf2, 0x04, /* l %r0, 0x204(%r15) */
- 0x58, 0x10, 0xf2, 0x0c, /* l %r1, 0x20c(%r15) */
- 0x58, 0x20, 0xf2, 0x14, /* l %r2, 0x214(%r15) */
- 0x58, 0x30, 0xf2, 0x1c, /* l %r3, 0x21c(%r15) */
- 0x58, 0x40, 0xf2, 0x24, /* l %r4, 0x224(%r15) */
- 0x58, 0x50, 0xf2, 0x2c, /* l %r5, 0x22c(%r15) */
- 0x58, 0x60, 0xf2, 0x34, /* l %r6, 0x234(%r15) */
- 0x58, 0x70, 0xf2, 0x3c, /* l %r7, 0x23c(%r15) */
- 0x58, 0x80, 0xf2, 0x44, /* l %r8, 0x244(%r15) */
- 0x58, 0x90, 0xf2, 0x4c, /* l %r9, 0x24c(%r15) */
- 0x58, 0xa0, 0xf2, 0x54, /* l %r10, 0x254(%r15) */
- 0x58, 0xb0, 0xf2, 0x5c, /* l %r11, 0x25c(%r15) */
- 0x58, 0xc0, 0xf2, 0x64, /* l %r12, 0x264(%r15) */
- 0x58, 0xd0, 0xf2, 0x6c, /* l %r13, 0x26c(%r15) */
- 0x58, 0xe0, 0xf2, 0x74, /* l %r14, 0x274(%r15) */
- 0x58, 0xf0, 0xf2, 0x7c, /* l %r15, 0x27c(%r15) */
+ 0x58, 0x00, 0xf2, 0x04, /* l %r0, 0x204(%r15) */
+ 0x58, 0x10, 0xf2, 0x0c, /* l %r1, 0x20c(%r15) */
+ 0x58, 0x20, 0xf2, 0x14, /* l %r2, 0x214(%r15) */
+ 0x58, 0x30, 0xf2, 0x1c, /* l %r3, 0x21c(%r15) */
+ 0x58, 0x40, 0xf2, 0x24, /* l %r4, 0x224(%r15) */
+ 0x58, 0x50, 0xf2, 0x2c, /* l %r5, 0x22c(%r15) */
+ 0x58, 0x60, 0xf2, 0x34, /* l %r6, 0x234(%r15) */
+ 0x58, 0x70, 0xf2, 0x3c, /* l %r7, 0x23c(%r15) */
+ 0x58, 0x80, 0xf2, 0x44, /* l %r8, 0x244(%r15) */
+ 0x58, 0x90, 0xf2, 0x4c, /* l %r9, 0x24c(%r15) */
+ 0x58, 0xa0, 0xf2, 0x54, /* l %r10, 0x254(%r15) */
+ 0x58, 0xb0, 0xf2, 0x5c, /* l %r11, 0x25c(%r15) */
+ 0x58, 0xc0, 0xf2, 0x64, /* l %r12, 0x264(%r15) */
+ 0x58, 0xd0, 0xf2, 0x6c, /* l %r13, 0x26c(%r15) */
+ 0x58, 0xe0, 0xf2, 0x74, /* l %r14, 0x274(%r15) */
+ 0x58, 0xf0, 0xf2, 0x7c, /* l %r15, 0x27c(%r15) */
};
/* Code sequence restoring GPRs, for 64-bit targets and 31-bit targets
with high GPRs. */
static const unsigned char s390_ft_exit_gpr_zarch[] = {
- 0xeb, 0x0f, 0xf2, 0x00, 0x00, 0x04, /* lmg %r0, %r15, 0x200(%r15) */
+ 0xeb, 0x0f, 0xf2, 0x00, 0x00, 0x04, /* lmg %r0, %r15, 0x200(%r15) */
};
/* Writes instructions to target, updating the to pointer. */
@@ -1142,19 +1105,19 @@ s390_relocate_instruction (CORE_ADDR *to, CORE_ADDR oldloc, int is_64)
op2 = buf[1] & 0xf;
/* BRC, BRAS, BRCT, BRCTG */
if (op2 >= 4 && op2 <= 7)
- mode = 1;
+ mode = 1;
/* BRAS */
if (op2 == 5)
- is_bras = 1;
+ is_bras = 1;
break;
case 0xc0:
op2 = buf[1] & 0xf;
/* LARL, BRCL, BRASL */
if (op2 == 0 || op2 == 4 || op2 == 5)
- mode = 2;
+ mode = 2;
/* BRASL */
if (op2 == 5)
- is_bras = 1;
+ is_bras = 1;
break;
case 0xc4:
case 0xc6:
@@ -1169,21 +1132,21 @@ s390_relocate_instruction (CORE_ADDR *to, CORE_ADDR oldloc, int is_64)
op2 = buf[1] & 0xf;
/* BRCTH */
if (op2 == 6)
- mode = 2;
+ mode = 2;
break;
case 0xec:
op2 = buf[5];
switch (op2)
- {
- case 0x44: /* BRXHG */
- case 0x45: /* BRXLG */
- case 0x64: /* CGRJ */
- case 0x65: /* CLGRJ */
- case 0x76: /* CRJ */
- case 0x77: /* CLRJ */
- mode = 1;
- break;
- }
+ {
+ case 0x44: /* BRXHG */
+ case 0x45: /* BRXLG */
+ case 0x64: /* CGRJ */
+ case 0x65: /* CLGRJ */
+ case 0x76: /* CRJ */
+ case 0x77: /* CLRJ */
+ mode = 1;
+ break;
+ }
break;
}
@@ -1194,70 +1157,70 @@ s390_relocate_instruction (CORE_ADDR *to, CORE_ADDR oldloc, int is_64)
int64_t loffset = 0;
CORE_ADDR target;
if (mode == 1)
- {
- int16_t soffset = 0;
- memcpy (&soffset, buf + 2, 2);
- loffset = soffset;
- }
+ {
+ int16_t soffset = 0;
+ memcpy (&soffset, buf + 2, 2);
+ loffset = soffset;
+ }
else if (mode == 2)
- {
- int32_t soffset = 0;
- memcpy (&soffset, buf + 2, 4);
- loffset = soffset;
- }
+ {
+ int32_t soffset = 0;
+ memcpy (&soffset, buf + 2, 4);
+ loffset = soffset;
+ }
target = oldloc + loffset * 2;
if (!is_64)
- target &= 0x7fffffff;
+ target &= 0x7fffffff;
if (is_bras)
- {
- /* BRAS or BRASL was used. We cannot just relocate those, since
+ {
+ /* BRAS or BRASL was used. We cannot just relocate those, since
they save the return address in a register. We can, however,
replace them with a LARL+JG sequence. */
- /* Make the LARL. */
- int32_t soffset;
- buf[0] = 0xc0;
- buf[1] &= 0xf0;
- loffset = oldloc + ilen - *to;
- loffset >>= 1;
- soffset = loffset;
- if (soffset != loffset && is_64)
- return 1;
- memcpy (buf + 2, &soffset, 4);
- append_insns (to, 6, buf);
-
- /* Note: this is not fully correct. In 31-bit mode, LARL will write
+ /* Make the LARL. */
+ int32_t soffset;
+ buf[0] = 0xc0;
+ buf[1] &= 0xf0;
+ loffset = oldloc + ilen - *to;
+ loffset >>= 1;
+ soffset = loffset;
+ if (soffset != loffset && is_64)
+ return 1;
+ memcpy (buf + 2, &soffset, 4);
+ append_insns (to, 6, buf);
+
+ /* Note: this is not fully correct. In 31-bit mode, LARL will write
an address with the top bit 0, while BRAS/BRASL will write it
with top bit 1. It should not matter much, since linux compilers
use BR and not BSM to return from functions, but it could confuse
some poor stack unwinder. */
- /* We'll now be writing a JG. */
- mode = 2;
- buf[0] = 0xc0;
- buf[1] = 0xf4;
- ilen = 6;
- }
+ /* We'll now be writing a JG. */
+ mode = 2;
+ buf[0] = 0xc0;
+ buf[1] = 0xf4;
+ ilen = 6;
+ }
/* Compute the new offset and write it to the buffer. */
loffset = target - *to;
loffset >>= 1;
if (mode == 1)
- {
- int16_t soffset = loffset;
- if (soffset != loffset)
- return 1;
- memcpy (buf + 2, &soffset, 2);
- }
+ {
+ int16_t soffset = loffset;
+ if (soffset != loffset)
+ return 1;
+ memcpy (buf + 2, &soffset, 2);
+ }
else if (mode == 2)
- {
- int32_t soffset = loffset;
- if (soffset != loffset && is_64)
- return 1;
- memcpy (buf + 2, &soffset, 4);
- }
+ {
+ int32_t soffset = loffset;
+ if (soffset != loffset && is_64)
+ return 1;
+ memcpy (buf + 2, &soffset, 4);
+ }
}
append_insns (to, ilen, buf);
return 0;
@@ -1273,18 +1236,17 @@ s390_target::supports_fast_tracepoints ()
"install_fast_tracepoint_jump_pad". */
int
-s390_target::install_fast_tracepoint_jump_pad
- (CORE_ADDR tpoint, CORE_ADDR tpaddr, CORE_ADDR collector,
- CORE_ADDR lockaddr, ULONGEST orig_size, CORE_ADDR *jump_entry,
- CORE_ADDR *trampoline, ULONGEST *trampoline_size,
- unsigned char *jjump_pad_insn, ULONGEST *jjump_pad_insn_size,
- CORE_ADDR *adjusted_insn_addr, CORE_ADDR *adjusted_insn_addr_end,
- char *err)
+s390_target::install_fast_tracepoint_jump_pad (
+ CORE_ADDR tpoint, CORE_ADDR tpaddr, CORE_ADDR collector, CORE_ADDR lockaddr,
+ ULONGEST orig_size, CORE_ADDR *jump_entry, CORE_ADDR *trampoline,
+ ULONGEST *trampoline_size, unsigned char *jjump_pad_insn,
+ ULONGEST *jjump_pad_insn_size, CORE_ADDR *adjusted_insn_addr,
+ CORE_ADDR *adjusted_insn_addr_end, char *err)
{
int i;
int64_t loffset;
int32_t offset;
- unsigned char jbuf[6] = { 0xc0, 0xf4, 0, 0, 0, 0 }; /* jg ... */
+ unsigned char jbuf[6] = { 0xc0, 0xf4, 0, 0, 0, 0 }; /* jg ... */
CORE_ADDR buildaddr = *jump_entry;
#ifdef __s390x__
struct regcache *regcache = get_thread_regcache (current_thread, 0);
@@ -1304,10 +1266,10 @@ s390_target::install_fast_tracepoint_jump_pad
/* First, store the GPRs. */
if (is_zarch)
append_insns (&buildaddr, sizeof s390_ft_entry_gpr_zarch,
- s390_ft_entry_gpr_zarch);
+ s390_ft_entry_gpr_zarch);
else
append_insns (&buildaddr, sizeof s390_ft_entry_gpr_esa,
- s390_ft_entry_gpr_esa);
+ s390_ft_entry_gpr_esa);
/* Second, misc registers (ARs, PSWM, FPC). PSWA will be stored below. */
append_insns (&buildaddr, sizeof s390_ft_entry_misc, s390_ft_entry_misc);
@@ -1320,52 +1282,57 @@ s390_target::install_fast_tracepoint_jump_pad
/* Now, the main part of code - store PSWA, take lock, call collector,
leave lock. First, we'll need to fetch 4 literals. */
- if (is_64) {
- unsigned char buf[] = {
- 0x07, 0x07, /* nopr %r7 */
- 0x07, 0x07, /* nopr %r7 */
- 0x07, 0x07, /* nopr %r7 */
- 0xa7, 0x15, 0x00, 0x12, /* bras %r1, .Lend */
- 0, 0, 0, 0, 0, 0, 0, 0, /* tpaddr */
- 0, 0, 0, 0, 0, 0, 0, 0, /* tpoint */
- 0, 0, 0, 0, 0, 0, 0, 0, /* collector */
- 0, 0, 0, 0, 0, 0, 0, 0, /* lockaddr */
- /* .Lend: */
- };
- /* Find the proper start place in buf, so that literals will be
+ if (is_64)
+ {
+ unsigned char buf[] = {
+ 0x07, 0x07, /* nopr %r7 */
+ 0x07, 0x07, /* nopr %r7 */
+ 0x07, 0x07, /* nopr %r7 */
+ 0xa7, 0x15, 0x00, 0x12, /* bras %r1, .Lend */
+ 0, 0, 0, 0, 0, 0, 0, 0, /* tpaddr */
+ 0, 0, 0, 0, 0, 0, 0, 0, /* tpoint */
+ 0, 0, 0, 0, 0, 0, 0, 0, /* collector */
+ 0, 0, 0, 0, 0, 0, 0, 0, /* lockaddr */
+ /* .Lend: */
+ };
+ /* Find the proper start place in buf, so that literals will be
aligned. */
- int bufpos = (buildaddr + 2) & 7;
- /* Stuff the literals into the buffer. */
- for (i = 0; i < 4; i++) {
- uint64_t lit = literals[i];
- memcpy (&buf[sizeof buf - 32 + i * 8], &lit, 8);
+ int bufpos = (buildaddr + 2) & 7;
+ /* Stuff the literals into the buffer. */
+ for (i = 0; i < 4; i++)
+ {
+ uint64_t lit = literals[i];
+ memcpy (&buf[sizeof buf - 32 + i * 8], &lit, 8);
+ }
+ append_insns (&buildaddr, sizeof buf - bufpos, buf + bufpos);
+ append_insns (&buildaddr, sizeof s390_ft_main_64, s390_ft_main_64);
}
- append_insns (&buildaddr, sizeof buf - bufpos, buf + bufpos);
- append_insns (&buildaddr, sizeof s390_ft_main_64, s390_ft_main_64);
- } else {
- unsigned char buf[] = {
- 0x07, 0x07, /* nopr %r7 */
- 0xa7, 0x15, 0x00, 0x0a, /* bras %r1, .Lend */
- 0, 0, 0, 0, /* tpaddr */
- 0, 0, 0, 0, /* tpoint */
- 0, 0, 0, 0, /* collector */
- 0, 0, 0, 0, /* lockaddr */
- /* .Lend: */
- };
- /* Find the proper start place in buf, so that literals will be
+ else
+ {
+ unsigned char buf[] = {
+ 0x07, 0x07, /* nopr %r7 */
+ 0xa7, 0x15, 0x00, 0x0a, /* bras %r1, .Lend */
+ 0, 0, 0, 0, /* tpaddr */
+ 0, 0, 0, 0, /* tpoint */
+ 0, 0, 0, 0, /* collector */
+ 0, 0, 0, 0, /* lockaddr */
+ /* .Lend: */
+ };
+ /* Find the proper start place in buf, so that literals will be
aligned. */
- int bufpos = (buildaddr + 2) & 3;
- /* First literal will be saved as the PSWA, make sure it has the high bit
+ int bufpos = (buildaddr + 2) & 3;
+ /* First literal will be saved as the PSWA, make sure it has the high bit
set. */
- literals[0] |= 0x80000000;
- /* Stuff the literals into the buffer. */
- for (i = 0; i < 4; i++) {
- uint32_t lit = literals[i];
- memcpy (&buf[sizeof buf - 16 + i * 4], &lit, 4);
+ literals[0] |= 0x80000000;
+ /* Stuff the literals into the buffer. */
+ for (i = 0; i < 4; i++)
+ {
+ uint32_t lit = literals[i];
+ memcpy (&buf[sizeof buf - 16 + i * 4], &lit, 4);
+ }
+ append_insns (&buildaddr, sizeof buf - bufpos, buf + bufpos);
+ append_insns (&buildaddr, sizeof s390_ft_main_31, s390_ft_main_31);
}
- append_insns (&buildaddr, sizeof buf - bufpos, buf + bufpos);
- append_insns (&buildaddr, sizeof s390_ft_main_31, s390_ft_main_31);
- }
/* Restore FRs or VRs. */
if (has_vx)
@@ -1379,10 +1346,10 @@ s390_target::install_fast_tracepoint_jump_pad
/* Restore the GPRs. */
if (is_zarch)
append_insns (&buildaddr, sizeof s390_ft_exit_gpr_zarch,
- s390_ft_exit_gpr_zarch);
+ s390_ft_exit_gpr_zarch);
else
append_insns (&buildaddr, sizeof s390_ft_exit_gpr_esa,
- s390_ft_exit_gpr_esa);
+ s390_ft_exit_gpr_esa);
/* Now, adjust the original instruction to execute in the jump
pad. */
@@ -1402,8 +1369,9 @@ s390_target::install_fast_tracepoint_jump_pad
if (is_64 && offset != loffset)
{
sprintf (err,
- "E.Jump back from jump pad too far from tracepoint "
- "(offset 0x%" PRIx64 " > int33).", loffset);
+ "E.Jump back from jump pad too far from tracepoint "
+ "(offset 0x%" PRIx64 " > int33).",
+ loffset);
return 1;
}
memcpy (jbuf + 2, &offset, 4);
@@ -1419,8 +1387,9 @@ s390_target::install_fast_tracepoint_jump_pad
if (is_64 && offset != loffset)
{
sprintf (err,
- "E.Jump back from jump pad too far from tracepoint "
- "(offset 0x%" PRIx64 " > int33).", loffset);
+ "E.Jump back from jump pad too far from tracepoint "
+ "(offset 0x%" PRIx64 " > int33).",
+ loffset);
return 1;
}
memcpy (jbuf + 2, &offset, 4);
@@ -1503,8 +1472,8 @@ add_insns (const unsigned char *start, int len)
{
CORE_ADDR buildaddr = current_insn_ptr;
- threads_debug_printf ("Adding %d bytes of insn at %s",
- len, paddress (buildaddr));
+ threads_debug_printf ("Adding %d bytes of insn at %s", len,
+ paddress (buildaddr));
append_insns (&buildaddr, len, start);
current_insn_ptr = buildaddr;
@@ -1533,10 +1502,10 @@ static void
s390_emit_prologue (void)
{
static const unsigned char buf[] = {
- 0x90, 0x9f, 0xf0, 0x24, /* stm %r9, %r15, 0x24(%r15) */
- 0x18, 0x92, /* lr %r9, %r2 */
- 0x18, 0xa3, /* lr %r10, %r3 */
- 0x18, 0xbf, /* lr %r11, %r15 */
+ 0x90, 0x9f, 0xf0, 0x24, /* stm %r9, %r15, 0x24(%r15) */
+ 0x18, 0x92, /* lr %r9, %r2 */
+ 0x18, 0xa3, /* lr %r10, %r3 */
+ 0x18, 0xbf, /* lr %r11, %r15 */
};
add_insns (buf, sizeof buf);
}
@@ -1547,10 +1516,10 @@ static void
s390_emit_epilogue (void)
{
static const unsigned char buf[] = {
- 0x90, 0x23, 0xa0, 0x00, /* stm %r2, %r3, 0(%r10) */
- 0xa7, 0x28, 0x00, 0x00, /* lhi %r2, 0 */
- 0x98, 0x9f, 0xb0, 0x24, /* lm %r9, %r15, 0x24(%r11) */
- 0x07, 0xfe, /* br %r14 */
+ 0x90, 0x23, 0xa0, 0x00, /* stm %r2, %r3, 0(%r10) */
+ 0xa7, 0x28, 0x00, 0x00, /* lhi %r2, 0 */
+ 0x98, 0x9f, 0xb0, 0x24, /* lm %r9, %r15, 0x24(%r11) */
+ 0x07, 0xfe, /* br %r14 */
};
add_insns (buf, sizeof buf);
}
@@ -1561,9 +1530,9 @@ static void
s390_emit_add (void)
{
static const unsigned char buf[] = {
- 0x5e, 0x30, 0xf0, 0x04, /* al %r3, 4(%r15) */
- 0xe3, 0x20, 0xf0, 0x00, 0x00, 0x98, /* al %r2, 0(%r15) */
- 0x41, 0xf0, 0xf0, 0x08, /* la %r15, 8(%r15) */
+ 0x5e, 0x30, 0xf0, 0x04, /* al %r3, 4(%r15) */
+ 0xe3, 0x20, 0xf0, 0x00, 0x00, 0x98, /* al %r2, 0(%r15) */
+ 0x41, 0xf0, 0xf0, 0x08, /* la %r15, 8(%r15) */
};
add_insns (buf, sizeof buf);
}
@@ -1574,12 +1543,12 @@ static void
s390_emit_sub (void)
{
static const unsigned char buf[] = {
- 0x98, 0x45, 0xf0, 0x00, /* lm %r4, %r5, 0(%r15) */
- 0x1f, 0x53, /* slr %r5, %r3 */
- 0xb9, 0x99, 0x00, 0x42, /* slbr %r4, %r2 */
- 0x41, 0xf0, 0xf0, 0x08, /* la %r15, 8(%r15) */
- 0x18, 0x35, /* lr %r3, %r5 */
- 0x18, 0x24, /* lr %r2, %r4 */
+ 0x98, 0x45, 0xf0, 0x00, /* lm %r4, %r5, 0(%r15) */
+ 0x1f, 0x53, /* slr %r5, %r3 */
+ 0xb9, 0x99, 0x00, 0x42, /* slbr %r4, %r2 */
+ 0x41, 0xf0, 0xf0, 0x08, /* la %r15, 8(%r15) */
+ 0x18, 0x35, /* lr %r3, %r5 */
+ 0x18, 0x24, /* lr %r2, %r4 */
};
add_insns (buf, sizeof buf);
}
@@ -1598,10 +1567,10 @@ static void
s390_emit_lsh (void)
{
static const unsigned char buf[] = {
- 0x18, 0x43, /* lr %r4, %r3 */
- 0x98, 0x23, 0xf0, 0x00, /* lm %r2, %r3, 0(%r15) */
- 0x8d, 0x20, 0x40, 0x00, /* sldl %r2, 0(%r4) */
- 0x41, 0xf0, 0xf0, 0x08, /* la %r15, 8(%r15) */
+ 0x18, 0x43, /* lr %r4, %r3 */
+ 0x98, 0x23, 0xf0, 0x00, /* lm %r2, %r3, 0(%r15) */
+ 0x8d, 0x20, 0x40, 0x00, /* sldl %r2, 0(%r4) */
+ 0x41, 0xf0, 0xf0, 0x08, /* la %r15, 8(%r15) */
};
add_insns (buf, sizeof buf);
}
@@ -1612,10 +1581,10 @@ static void
s390_emit_rsh_signed (void)
{
static const unsigned char buf[] = {
- 0x18, 0x43, /* lr %r4, %r3 */
- 0x98, 0x23, 0xf0, 0x00, /* lm %r2, %r3, 0(%r15) */
- 0x8e, 0x20, 0x40, 0x00, /* srda %r2, 0(%r4) */
- 0x41, 0xf0, 0xf0, 0x08, /* la %r15, 8(%r15) */
+ 0x18, 0x43, /* lr %r4, %r3 */
+ 0x98, 0x23, 0xf0, 0x00, /* lm %r2, %r3, 0(%r15) */
+ 0x8e, 0x20, 0x40, 0x00, /* srda %r2, 0(%r4) */
+ 0x41, 0xf0, 0xf0, 0x08, /* la %r15, 8(%r15) */
};
add_insns (buf, sizeof buf);
}
@@ -1626,10 +1595,10 @@ static void
s390_emit_rsh_unsigned (void)
{
static const unsigned char buf[] = {
- 0x18, 0x43, /* lr %r4, %r3 */
- 0x98, 0x23, 0xf0, 0x00, /* lm %r2, %r3, 0(%r15) */
- 0x8c, 0x20, 0x40, 0x00, /* srdl %r2, 0(%r4) */
- 0x41, 0xf0, 0xf0, 0x08, /* la %r15, 8(%r15) */
+ 0x18, 0x43, /* lr %r4, %r3 */
+ 0x98, 0x23, 0xf0, 0x00, /* lm %r2, %r3, 0(%r15) */
+ 0x8c, 0x20, 0x40, 0x00, /* srdl %r2, 0(%r4) */
+ 0x41, 0xf0, 0xf0, 0x08, /* la %r15, 8(%r15) */
};
add_insns (buf, sizeof buf);
}
@@ -1652,11 +1621,11 @@ static void
s390_emit_log_not (void)
{
static const unsigned char buf[] = {
- 0x16, 0x23, /* or %r2, %r3 */
- 0xa7, 0x28, 0x00, 0x00, /* lhi %r2, 0 */
- 0xa7, 0x38, 0x00, 0x00, /* lhi %r3, 0 */
- 0xa7, 0x74, 0x00, 0x04, /* jne .Lskip */
- 0xa7, 0x38, 0x00, 0x01, /* lhi %r3, 1 */
+ 0x16, 0x23, /* or %r2, %r3 */
+ 0xa7, 0x28, 0x00, 0x00, /* lhi %r2, 0 */
+ 0xa7, 0x38, 0x00, 0x00, /* lhi %r3, 0 */
+ 0xa7, 0x74, 0x00, 0x04, /* jne .Lskip */
+ 0xa7, 0x38, 0x00, 0x01, /* lhi %r3, 1 */
/* .Lskip: */
};
add_insns (buf, sizeof buf);
@@ -1668,9 +1637,9 @@ static void
s390_emit_bit_and (void)
{
static const unsigned char buf[] = {
- 0x54, 0x20, 0xf0, 0x00, /* n %r2, 0(%r15) */
- 0x54, 0x30, 0xf0, 0x04, /* n %r3, 4(%r15) */
- 0x41, 0xf0, 0xf0, 0x08, /* la %r15, 8(%r15) */
+ 0x54, 0x20, 0xf0, 0x00, /* n %r2, 0(%r15) */
+ 0x54, 0x30, 0xf0, 0x04, /* n %r3, 4(%r15) */
+ 0x41, 0xf0, 0xf0, 0x08, /* la %r15, 8(%r15) */
};
add_insns (buf, sizeof buf);
}
@@ -1681,9 +1650,9 @@ static void
s390_emit_bit_or (void)
{
static const unsigned char buf[] = {
- 0x56, 0x20, 0xf0, 0x00, /* o %r2, 0(%r15) */
- 0x56, 0x30, 0xf0, 0x04, /* o %r3, 4(%r15) */
- 0x41, 0xf0, 0xf0, 0x08, /* la %r15, 8(%r15) */
+ 0x56, 0x20, 0xf0, 0x00, /* o %r2, 0(%r15) */
+ 0x56, 0x30, 0xf0, 0x04, /* o %r3, 4(%r15) */
+ 0x41, 0xf0, 0xf0, 0x08, /* la %r15, 8(%r15) */
};
add_insns (buf, sizeof buf);
}
@@ -1694,9 +1663,9 @@ static void
s390_emit_bit_xor (void)
{
static const unsigned char buf[] = {
- 0x57, 0x20, 0xf0, 0x00, /* x %r2, 0(%r15) */
- 0x57, 0x30, 0xf0, 0x04, /* x %r3, 4(%r15) */
- 0x41, 0xf0, 0xf0, 0x08, /* la %r15, 8(%r15) */
+ 0x57, 0x20, 0xf0, 0x00, /* x %r2, 0(%r15) */
+ 0x57, 0x30, 0xf0, 0x04, /* x %r3, 4(%r15) */
+ 0x41, 0xf0, 0xf0, 0x08, /* la %r15, 8(%r15) */
};
add_insns (buf, sizeof buf);
}
@@ -1707,9 +1676,9 @@ static void
s390_emit_bit_not (void)
{
static const unsigned char buf[] = {
- 0xa7, 0x48, 0xff, 0xff, /* lhi %r4, -1 */
- 0x17, 0x24, /* xr %r2, %r4 */
- 0x17, 0x34, /* xr %r3, %r4 */
+ 0xa7, 0x48, 0xff, 0xff, /* lhi %r4, -1 */
+ 0x17, 0x24, /* xr %r2, %r4 */
+ 0x17, 0x34, /* xr %r3, %r4 */
};
add_insns (buf, sizeof buf);
}
@@ -1729,19 +1698,19 @@ static void
s390_emit_less_signed (void)
{
static const unsigned char buf[] = {
- 0x59, 0x20, 0xf0, 0x00, /* c %r2, 0(%r15) */
- 0xa7, 0x24, 0x00, 0x0c, /* jh .Lless */
- 0xa7, 0x44, 0x00, 0x06, /* jl .Lhigh */
- 0x55, 0x30, 0xf0, 0x04, /* cl %r3, 4(%r15) */
- 0xa7, 0x24, 0x00, 0x06, /* jh .Lless */
+ 0x59, 0x20, 0xf0, 0x00, /* c %r2, 0(%r15) */
+ 0xa7, 0x24, 0x00, 0x0c, /* jh .Lless */
+ 0xa7, 0x44, 0x00, 0x06, /* jl .Lhigh */
+ 0x55, 0x30, 0xf0, 0x04, /* cl %r3, 4(%r15) */
+ 0xa7, 0x24, 0x00, 0x06, /* jh .Lless */
/* .Lhigh: */
- 0xa7, 0x38, 0x00, 0x00, /* lhi %r3, 0 */
- 0xa7, 0xf4, 0x00, 0x04, /* j .Lend */
+ 0xa7, 0x38, 0x00, 0x00, /* lhi %r3, 0 */
+ 0xa7, 0xf4, 0x00, 0x04, /* j .Lend */
/* .Lless: */
- 0xa7, 0x38, 0x00, 0x01, /* lhi %r3, 1 */
+ 0xa7, 0x38, 0x00, 0x01, /* lhi %r3, 1 */
/* .Lend: */
- 0xa7, 0x28, 0x00, 0x00, /* lhi %r2, 0 */
- 0x41, 0xf0, 0xf0, 0x08, /* la %r15, 8(%r15) */
+ 0xa7, 0x28, 0x00, 0x00, /* lhi %r2, 0 */
+ 0x41, 0xf0, 0xf0, 0x08, /* la %r15, 8(%r15) */
};
add_insns (buf, sizeof buf);
}
@@ -1752,19 +1721,19 @@ static void
s390_emit_less_unsigned (void)
{
static const unsigned char buf[] = {
- 0x55, 0x20, 0xf0, 0x00, /* cl %r2, 0(%r15) */
- 0xa7, 0x24, 0x00, 0x0c, /* jh .Lless */
- 0xa7, 0x44, 0x00, 0x06, /* jl .Lhigh */
- 0x55, 0x30, 0xf0, 0x04, /* cl %r3, 4(%r15) */
- 0xa7, 0x24, 0x00, 0x06, /* jh .Lless */
+ 0x55, 0x20, 0xf0, 0x00, /* cl %r2, 0(%r15) */
+ 0xa7, 0x24, 0x00, 0x0c, /* jh .Lless */
+ 0xa7, 0x44, 0x00, 0x06, /* jl .Lhigh */
+ 0x55, 0x30, 0xf0, 0x04, /* cl %r3, 4(%r15) */
+ 0xa7, 0x24, 0x00, 0x06, /* jh .Lless */
/* .Lhigh: */
- 0xa7, 0x38, 0x00, 0x00, /* lhi %r3, 0 */
- 0xa7, 0xf4, 0x00, 0x04, /* j .Lend */
+ 0xa7, 0x38, 0x00, 0x00, /* lhi %r3, 0 */
+ 0xa7, 0xf4, 0x00, 0x04, /* j .Lend */
/* .Lless: */
- 0xa7, 0x38, 0x00, 0x01, /* lhi %r3, 1 */
+ 0xa7, 0x38, 0x00, 0x01, /* lhi %r3, 1 */
/* .Lend: */
- 0xa7, 0x28, 0x00, 0x00, /* lhi %r2, 0 */
- 0x41, 0xf0, 0xf0, 0x08, /* la %r15, 8(%r15) */
+ 0xa7, 0x28, 0x00, 0x00, /* lhi %r2, 0 */
+ 0x41, 0xf0, 0xf0, 0x08, /* la %r15, 8(%r15) */
};
add_insns (buf, sizeof buf);
}
@@ -1775,19 +1744,19 @@ static void
s390_emit_ref (int size)
{
static const unsigned char buf1[] = {
- 0xa7, 0x28, 0x00, 0x00, /* lhi %r2, 0 */
- 0x43, 0x30, 0x30, 0x00, /* ic %r3, 0(%r3) */
+ 0xa7, 0x28, 0x00, 0x00, /* lhi %r2, 0 */
+ 0x43, 0x30, 0x30, 0x00, /* ic %r3, 0(%r3) */
};
static const unsigned char buf2[] = {
- 0xa7, 0x28, 0x00, 0x00, /* lhi %r2, 0 */
- 0x48, 0x30, 0x30, 0x00, /* lh %r3, 0(%r3) */
+ 0xa7, 0x28, 0x00, 0x00, /* lhi %r2, 0 */
+ 0x48, 0x30, 0x30, 0x00, /* lh %r3, 0(%r3) */
};
static const unsigned char buf4[] = {
- 0xa7, 0x28, 0x00, 0x00, /* lhi %r2, 0 */
- 0x58, 0x30, 0x30, 0x00, /* l %r3, 0(%r3) */
+ 0xa7, 0x28, 0x00, 0x00, /* lhi %r2, 0 */
+ 0x58, 0x30, 0x30, 0x00, /* l %r3, 0(%r3) */
};
static const unsigned char buf8[] = {
- 0x98, 0x23, 0x30, 0x00, /* lm %r2, %r3, 0(%r3) */
+ 0x98, 0x23, 0x30, 0x00, /* lm %r2, %r3, 0(%r3) */
};
switch (size)
{
@@ -1814,10 +1783,10 @@ static void
s390_emit_if_goto (int *offset_p, int *size_p)
{
static const unsigned char buf[] = {
- 0x16, 0x23, /* or %r2, %r3 */
- 0x98, 0x23, 0xf0, 0x00, /* lm %r2, %r3, 0(%r15) */
- 0x41, 0xf0, 0xf0, 0x08, /* la %r15, 8(%r15) */
- 0xc0, 0x74, 0x00, 0x00, 0x00, 0x00 /* jgne <fillme> */
+ 0x16, 0x23, /* or %r2, %r3 */
+ 0x98, 0x23, 0xf0, 0x00, /* lm %r2, %r3, 0(%r15) */
+ 0x41, 0xf0, 0xf0, 0x08, /* la %r15, 8(%r15) */
+ 0xc0, 0x74, 0x00, 0x00, 0x00, 0x00 /* jgne <fillme> */
};
add_insns (buf, sizeof buf);
if (offset_p)
@@ -1832,7 +1801,7 @@ static void
s390_emit_goto (int *offset_p, int *size_p)
{
static const unsigned char buf[] = {
- 0xc0, 0xf4, 0x00, 0x00, 0x00, 0x00, /* jg <fillme> */
+ 0xc0, 0xf4, 0x00, 0x00, 0x00, 0x00, /* jg <fillme> */
};
add_insns (buf, sizeof buf);
if (offset_p)
@@ -1869,23 +1838,24 @@ static void
s390_emit_litpool (int size)
{
static const unsigned char nop[] = {
- 0x07, 0x07,
+ 0x07,
+ 0x07,
};
unsigned char buf[] = {
0xa7, 0x15, 0x00,
- (unsigned char) ((size + 4) / 2), /* bras %r1, .Lend+size */
+ (unsigned char) ((size + 4) / 2), /* bras %r1, .Lend+size */
/* .Lend: */
};
if (size == 4)
{
/* buf needs to start at even halfword for litpool to be aligned */
if (current_insn_ptr & 2)
- add_insns (nop, sizeof nop);
+ add_insns (nop, sizeof nop);
}
else
{
while ((current_insn_ptr & 6) != 4)
- add_insns (nop, sizeof nop);
+ add_insns (nop, sizeof nop);
}
add_insns (buf, sizeof buf);
}
@@ -1898,13 +1868,16 @@ s390_emit_const (LONGEST num)
unsigned long long n = num;
unsigned char buf_s[] = {
/* lhi %r3, <num> */
- 0xa7, 0x38,
- (unsigned char) (num >> 8), (unsigned char) num,
+ 0xa7,
+ 0x38,
+ (unsigned char) (num >> 8),
+ (unsigned char) num,
/* xr %r2, %r2 */
- 0x17, 0x22,
+ 0x17,
+ 0x22,
};
static const unsigned char buf_l[] = {
- 0x98, 0x23, 0x10, 0x00, /* lm %r2, %r3, 0(%r1) */
+ 0x98, 0x23, 0x10, 0x00, /* lm %r2, %r3, 0(%r1) */
};
if (num < 0x8000 && num >= 0)
add_insns (buf_s, sizeof buf_s);
@@ -1923,10 +1896,10 @@ s390_emit_call (CORE_ADDR fn)
{
unsigned int n = fn;
static const unsigned char buf[] = {
- 0x58, 0x10, 0x10, 0x00, /* l %r1, 0(%r1) */
- 0xa7, 0xfa, 0xff, 0xa0, /* ahi %r15, -0x60 */
- 0x0d, 0xe1, /* basr %r14, %r1 */
- 0xa7, 0xfa, 0x00, 0x60, /* ahi %r15, 0x60 */
+ 0x58, 0x10, 0x10, 0x00, /* l %r1, 0(%r1) */
+ 0xa7, 0xfa, 0xff, 0xa0, /* ahi %r15, -0x60 */
+ 0x0d, 0xe1, /* basr %r14, %r1 */
+ 0xa7, 0xfa, 0x00, 0x60, /* ahi %r15, 0x60 */
};
s390_emit_litpool (4);
add_insns ((unsigned char *) &n, sizeof n);
@@ -1940,9 +1913,13 @@ s390_emit_reg (int reg)
{
unsigned char bufpre[] = {
/* lr %r2, %r9 */
- 0x18, 0x29,
+ 0x18,
+ 0x29,
/* lhi %r3, <reg> */
- 0xa7, 0x38, (unsigned char) (reg >> 8), (unsigned char) reg,
+ 0xa7,
+ 0x38,
+ (unsigned char) (reg >> 8),
+ (unsigned char) reg,
};
add_insns (bufpre, sizeof bufpre);
s390_emit_call (get_raw_reg_func_addr ());
@@ -1954,8 +1931,8 @@ static void
s390_emit_pop (void)
{
static const unsigned char buf[] = {
- 0x98, 0x23, 0xf0, 0x00, /* lm %r2, %r3, 0(%r15) */
- 0x41, 0xf0, 0xf0, 0x08, /* la %r15, 8(%r15) */
+ 0x98, 0x23, 0xf0, 0x00, /* lm %r2, %r3, 0(%r15) */
+ 0x41, 0xf0, 0xf0, 0x08, /* la %r15, 8(%r15) */
};
add_insns (buf, sizeof buf);
}
@@ -1966,8 +1943,8 @@ static void
s390_emit_stack_flush (void)
{
static const unsigned char buf[] = {
- 0xa7, 0xfa, 0xff, 0xf8, /* ahi %r15, -8 */
- 0x90, 0x23, 0xf0, 0x00, /* stm %r2, %r3, 0(%r15) */
+ 0xa7, 0xfa, 0xff, 0xf8, /* ahi %r15, -8 */
+ 0x90, 0x23, 0xf0, 0x00, /* stm %r2, %r3, 0(%r15) */
};
add_insns (buf, sizeof buf);
}
@@ -1990,10 +1967,10 @@ static void
s390_emit_swap (void)
{
static const unsigned char buf[] = {
- 0x98, 0x45, 0xf0, 0x00, /* lm %r4, %r5, 0(%r15) */
- 0x90, 0x23, 0xf0, 0x00, /* stm %r2, %r3, 0(%r15) */
- 0x18, 0x24, /* lr %r2, %r4 */
- 0x18, 0x35, /* lr %r3, %r5 */
+ 0x98, 0x45, 0xf0, 0x00, /* lm %r4, %r5, 0(%r15) */
+ 0x90, 0x23, 0xf0, 0x00, /* stm %r2, %r3, 0(%r15) */
+ 0x18, 0x24, /* lr %r2, %r4 */
+ 0x18, 0x35, /* lr %r3, %r5 */
};
add_insns (buf, sizeof buf);
}
@@ -2005,8 +1982,10 @@ s390_emit_stack_adjust (int n)
{
unsigned char buf[] = {
/* ahi %r15, 8*n */
- 0xa7, 0xfa,
- (unsigned char ) (n * 8 >> 8), (unsigned char) (n * 8),
+ 0xa7,
+ 0xfa,
+ (unsigned char) (n * 8 >> 8),
+ (unsigned char) (n * 8),
};
add_insns (buf, sizeof buf);
}
@@ -2018,10 +1997,13 @@ s390_emit_set_r2 (int arg1)
{
unsigned char buf_s[] = {
/* lhi %r2, <arg1> */
- 0xa7, 0x28, (unsigned char) (arg1 >> 8), (unsigned char) arg1,
+ 0xa7,
+ 0x28,
+ (unsigned char) (arg1 >> 8),
+ (unsigned char) arg1,
};
static const unsigned char buf_l[] = {
- 0x58, 0x20, 0x10, 0x00, /* l %r2, 0(%r1) */
+ 0x58, 0x20, 0x10, 0x00, /* l %r2, 0(%r1) */
};
if (arg1 < 0x8000 && arg1 >= -0x8000)
add_insns (buf_s, sizeof buf_s);
@@ -2050,14 +2032,14 @@ s390_emit_void_call_2 (CORE_ADDR fn, int arg1)
{
/* FN's prototype is `void(*fn)(int,LONGEST)'. */
static const unsigned char buf[] = {
- 0x18, 0xc2, /* lr %r12, %r2 */
- 0x18, 0xd3, /* lr %r13, %r3 */
- 0x18, 0x43, /* lr %r4, %r3 */
- 0x18, 0x32, /* lr %r3, %r2 */
+ 0x18, 0xc2, /* lr %r12, %r2 */
+ 0x18, 0xd3, /* lr %r13, %r3 */
+ 0x18, 0x43, /* lr %r4, %r3 */
+ 0x18, 0x32, /* lr %r3, %r2 */
};
static const unsigned char buf2[] = {
- 0x18, 0x2c, /* lr %r2, %r12 */
- 0x18, 0x3d, /* lr %r3, %r13 */
+ 0x18, 0x2c, /* lr %r2, %r12 */
+ 0x18, 0x3d, /* lr %r3, %r13 */
};
add_insns (buf, sizeof buf);
s390_emit_set_r2 (arg1);
@@ -2071,12 +2053,12 @@ static void
s390_emit_eq_goto (int *offset_p, int *size_p)
{
static const unsigned char buf[] = {
- 0x57, 0x20, 0xf0, 0x00, /* x %r2, 0(%r15) */
- 0x57, 0x30, 0xf0, 0x04, /* x %r3, 4(%r15) */
- 0x16, 0x23, /* or %r2, %r3 */
- 0x98, 0x23, 0xf0, 0x08, /* lm %r2, %r3, 8(%r15) */
- 0x41, 0xf0, 0xf0, 0x10, /* la %r15, 16(%r15) */
- 0xc0, 0x84, 0x00, 0x00, 0x00, 0x00, /* jge <fillme> */
+ 0x57, 0x20, 0xf0, 0x00, /* x %r2, 0(%r15) */
+ 0x57, 0x30, 0xf0, 0x04, /* x %r3, 4(%r15) */
+ 0x16, 0x23, /* or %r2, %r3 */
+ 0x98, 0x23, 0xf0, 0x08, /* lm %r2, %r3, 8(%r15) */
+ 0x41, 0xf0, 0xf0, 0x10, /* la %r15, 16(%r15) */
+ 0xc0, 0x84, 0x00, 0x00, 0x00, 0x00, /* jge <fillme> */
};
add_insns (buf, sizeof buf);
if (offset_p)
@@ -2091,12 +2073,12 @@ static void
s390_emit_ne_goto (int *offset_p, int *size_p)
{
static const unsigned char buf[] = {
- 0x57, 0x20, 0xf0, 0x00, /* x %r2, 0(%r15) */
- 0x57, 0x30, 0xf0, 0x04, /* x %r3, 4(%r15) */
- 0x16, 0x23, /* or %r2, %r3 */
- 0x98, 0x23, 0xf0, 0x08, /* lm %r2, %r3, 8(%r15) */
- 0x41, 0xf0, 0xf0, 0x10, /* la %r15, 16(%r15) */
- 0xc0, 0x74, 0x00, 0x00, 0x00, 0x00, /* jgne <fillme> */
+ 0x57, 0x20, 0xf0, 0x00, /* x %r2, 0(%r15) */
+ 0x57, 0x30, 0xf0, 0x04, /* x %r3, 4(%r15) */
+ 0x16, 0x23, /* or %r2, %r3 */
+ 0x98, 0x23, 0xf0, 0x08, /* lm %r2, %r3, 8(%r15) */
+ 0x41, 0xf0, 0xf0, 0x10, /* la %r15, 16(%r15) */
+ 0xc0, 0x74, 0x00, 0x00, 0x00, 0x00, /* jgne <fillme> */
};
add_insns (buf, sizeof buf);
if (offset_p)
@@ -2111,19 +2093,19 @@ static void
s390_emit_lt_goto (int *offset_p, int *size_p)
{
static const unsigned char buf[] = {
- 0x59, 0x20, 0xf0, 0x00, /* c %r2, 0(%r15) */
- 0xa7, 0x24, 0x00, 0x0e, /* jh .Ltrue */
- 0xa7, 0x44, 0x00, 0x06, /* jl .Lfalse */
- 0x55, 0x30, 0xf0, 0x04, /* cl %r3, 4(%r15) */
- 0xa7, 0x24, 0x00, 0x08, /* jh .Ltrue */
+ 0x59, 0x20, 0xf0, 0x00, /* c %r2, 0(%r15) */
+ 0xa7, 0x24, 0x00, 0x0e, /* jh .Ltrue */
+ 0xa7, 0x44, 0x00, 0x06, /* jl .Lfalse */
+ 0x55, 0x30, 0xf0, 0x04, /* cl %r3, 4(%r15) */
+ 0xa7, 0x24, 0x00, 0x08, /* jh .Ltrue */
/* .Lfalse: */
- 0x98, 0x23, 0xf0, 0x08, /* lm %r2, %r3, 8(%r15) */
- 0x41, 0xf0, 0xf0, 0x10, /* la %r15, 16(%r15) */
- 0xa7, 0xf4, 0x00, 0x09, /* j .Lend */
+ 0x98, 0x23, 0xf0, 0x08, /* lm %r2, %r3, 8(%r15) */
+ 0x41, 0xf0, 0xf0, 0x10, /* la %r15, 16(%r15) */
+ 0xa7, 0xf4, 0x00, 0x09, /* j .Lend */
/* .Ltrue: */
- 0x98, 0x23, 0xf0, 0x08, /* lm %r2, %r3, 8(%r15) */
- 0x41, 0xf0, 0xf0, 0x10, /* la %r15, 16(%r15) */
- 0xc0, 0xf4, 0x00, 0x00, 0x00, 0x00, /* jg <fillme> */
+ 0x98, 0x23, 0xf0, 0x08, /* lm %r2, %r3, 8(%r15) */
+ 0x41, 0xf0, 0xf0, 0x10, /* la %r15, 16(%r15) */
+ 0xc0, 0xf4, 0x00, 0x00, 0x00, 0x00, /* jg <fillme> */
/* .Lend: */
};
add_insns (buf, sizeof buf);
@@ -2139,19 +2121,19 @@ static void
s390_emit_le_goto (int *offset_p, int *size_p)
{
static const unsigned char buf[] = {
- 0x59, 0x20, 0xf0, 0x00, /* c %r2, 0(%r15) */
- 0xa7, 0x24, 0x00, 0x0e, /* jh .Ltrue */
- 0xa7, 0x44, 0x00, 0x06, /* jl .Lfalse */
- 0x55, 0x30, 0xf0, 0x04, /* cl %r3, 4(%r15) */
- 0xa7, 0xa4, 0x00, 0x08, /* jhe .Ltrue */
+ 0x59, 0x20, 0xf0, 0x00, /* c %r2, 0(%r15) */
+ 0xa7, 0x24, 0x00, 0x0e, /* jh .Ltrue */
+ 0xa7, 0x44, 0x00, 0x06, /* jl .Lfalse */
+ 0x55, 0x30, 0xf0, 0x04, /* cl %r3, 4(%r15) */
+ 0xa7, 0xa4, 0x00, 0x08, /* jhe .Ltrue */
/* .Lfalse: */
- 0x98, 0x23, 0xf0, 0x08, /* lm %r2, %r3, 8(%r15) */
- 0x41, 0xf0, 0xf0, 0x10, /* la %r15, 16(%r15) */
- 0xa7, 0xf4, 0x00, 0x09, /* j .Lend */
+ 0x98, 0x23, 0xf0, 0x08, /* lm %r2, %r3, 8(%r15) */
+ 0x41, 0xf0, 0xf0, 0x10, /* la %r15, 16(%r15) */
+ 0xa7, 0xf4, 0x00, 0x09, /* j .Lend */
/* .Ltrue: */
- 0x98, 0x23, 0xf0, 0x08, /* lm %r2, %r3, 8(%r15) */
- 0x41, 0xf0, 0xf0, 0x10, /* la %r15, 16(%r15) */
- 0xc0, 0xf4, 0x00, 0x00, 0x00, 0x00, /* jg <fillme> */
+ 0x98, 0x23, 0xf0, 0x08, /* lm %r2, %r3, 8(%r15) */
+ 0x41, 0xf0, 0xf0, 0x10, /* la %r15, 16(%r15) */
+ 0xc0, 0xf4, 0x00, 0x00, 0x00, 0x00, /* jg <fillme> */
/* .Lend: */
};
add_insns (buf, sizeof buf);
@@ -2167,19 +2149,19 @@ static void
s390_emit_gt_goto (int *offset_p, int *size_p)
{
static const unsigned char buf[] = {
- 0x59, 0x20, 0xf0, 0x00, /* c %r2, 0(%r15) */
- 0xa7, 0x44, 0x00, 0x0e, /* jl .Ltrue */
- 0xa7, 0x24, 0x00, 0x06, /* jh .Lfalse */
- 0x55, 0x30, 0xf0, 0x04, /* cl %r3, 4(%r15) */
- 0xa7, 0x44, 0x00, 0x08, /* jl .Ltrue */
+ 0x59, 0x20, 0xf0, 0x00, /* c %r2, 0(%r15) */
+ 0xa7, 0x44, 0x00, 0x0e, /* jl .Ltrue */
+ 0xa7, 0x24, 0x00, 0x06, /* jh .Lfalse */
+ 0x55, 0x30, 0xf0, 0x04, /* cl %r3, 4(%r15) */
+ 0xa7, 0x44, 0x00, 0x08, /* jl .Ltrue */
/* .Lfalse: */
- 0x98, 0x23, 0xf0, 0x08, /* lm %r2, %r3, 8(%r15) */
- 0x41, 0xf0, 0xf0, 0x10, /* la %r15, 16(%r15) */
- 0xa7, 0xf4, 0x00, 0x09, /* j .Lend */
+ 0x98, 0x23, 0xf0, 0x08, /* lm %r2, %r3, 8(%r15) */
+ 0x41, 0xf0, 0xf0, 0x10, /* la %r15, 16(%r15) */
+ 0xa7, 0xf4, 0x00, 0x09, /* j .Lend */
/* .Ltrue: */
- 0x98, 0x23, 0xf0, 0x08, /* lm %r2, %r3, 8(%r15) */
- 0x41, 0xf0, 0xf0, 0x10, /* la %r15, 16(%r15) */
- 0xc0, 0xf4, 0x00, 0x00, 0x00, 0x00, /* jg <fillme> */
+ 0x98, 0x23, 0xf0, 0x08, /* lm %r2, %r3, 8(%r15) */
+ 0x41, 0xf0, 0xf0, 0x10, /* la %r15, 16(%r15) */
+ 0xc0, 0xf4, 0x00, 0x00, 0x00, 0x00, /* jg <fillme> */
/* .Lend: */
};
add_insns (buf, sizeof buf);
@@ -2195,19 +2177,19 @@ static void
s390_emit_ge_goto (int *offset_p, int *size_p)
{
static const unsigned char buf[] = {
- 0x59, 0x20, 0xf0, 0x00, /* c %r2, 0(%r15) */
- 0xa7, 0x44, 0x00, 0x0e, /* jl .Ltrue */
- 0xa7, 0x24, 0x00, 0x06, /* jh .Lfalse */
- 0x55, 0x30, 0xf0, 0x04, /* cl %r3, 4(%r15) */
- 0xa7, 0xc4, 0x00, 0x08, /* jle .Ltrue */
+ 0x59, 0x20, 0xf0, 0x00, /* c %r2, 0(%r15) */
+ 0xa7, 0x44, 0x00, 0x0e, /* jl .Ltrue */
+ 0xa7, 0x24, 0x00, 0x06, /* jh .Lfalse */
+ 0x55, 0x30, 0xf0, 0x04, /* cl %r3, 4(%r15) */
+ 0xa7, 0xc4, 0x00, 0x08, /* jle .Ltrue */
/* .Lfalse: */
- 0x98, 0x23, 0xf0, 0x08, /* lm %r2, %r3, 8(%r15) */
- 0x41, 0xf0, 0xf0, 0x10, /* la %r15, 16(%r15) */
- 0xa7, 0xf4, 0x00, 0x09, /* j .Lend */
+ 0x98, 0x23, 0xf0, 0x08, /* lm %r2, %r3, 8(%r15) */
+ 0x41, 0xf0, 0xf0, 0x10, /* la %r15, 16(%r15) */
+ 0xa7, 0xf4, 0x00, 0x09, /* j .Lend */
/* .Ltrue: */
- 0x98, 0x23, 0xf0, 0x08, /* lm %r2, %r3, 8(%r15) */
- 0x41, 0xf0, 0xf0, 0x10, /* la %r15, 16(%r15) */
- 0xc0, 0xf4, 0x00, 0x00, 0x00, 0x00, /* jg <fillme> */
+ 0x98, 0x23, 0xf0, 0x08, /* lm %r2, %r3, 8(%r15) */
+ 0x41, 0xf0, 0xf0, 0x10, /* la %r15, 16(%r15) */
+ 0xc0, 0xf4, 0x00, 0x00, 0x00, 0x00, /* jg <fillme> */
/* .Lend: */
};
add_insns (buf, sizeof buf);
@@ -2220,46 +2202,20 @@ s390_emit_ge_goto (int *offset_p, int *size_p)
/* The "emit_ops" structure for s390. Named _impl to avoid name
collision with s390_emit_ops function. */
-static struct emit_ops s390_emit_ops_impl =
- {
- s390_emit_prologue,
- s390_emit_epilogue,
- s390_emit_add,
- s390_emit_sub,
- s390_emit_mul,
- s390_emit_lsh,
- s390_emit_rsh_signed,
- s390_emit_rsh_unsigned,
- s390_emit_ext,
- s390_emit_log_not,
- s390_emit_bit_and,
- s390_emit_bit_or,
- s390_emit_bit_xor,
- s390_emit_bit_not,
- s390_emit_equal,
- s390_emit_less_signed,
- s390_emit_less_unsigned,
- s390_emit_ref,
- s390_emit_if_goto,
- s390_emit_goto,
- s390_write_goto_address,
- s390_emit_const,
- s390_emit_call,
- s390_emit_reg,
- s390_emit_pop,
- s390_emit_stack_flush,
- s390_emit_zero_ext,
- s390_emit_swap,
- s390_emit_stack_adjust,
- s390_emit_int_call_1,
- s390_emit_void_call_2,
- s390_emit_eq_goto,
- s390_emit_ne_goto,
- s390_emit_lt_goto,
- s390_emit_le_goto,
- s390_emit_gt_goto,
- s390_emit_ge_goto
- };
+static struct emit_ops s390_emit_ops_impl
+ = { s390_emit_prologue, s390_emit_epilogue, s390_emit_add,
+ s390_emit_sub, s390_emit_mul, s390_emit_lsh,
+ s390_emit_rsh_signed, s390_emit_rsh_unsigned, s390_emit_ext,
+ s390_emit_log_not, s390_emit_bit_and, s390_emit_bit_or,
+ s390_emit_bit_xor, s390_emit_bit_not, s390_emit_equal,
+ s390_emit_less_signed, s390_emit_less_unsigned, s390_emit_ref,
+ s390_emit_if_goto, s390_emit_goto, s390_write_goto_address,
+ s390_emit_const, s390_emit_call, s390_emit_reg,
+ s390_emit_pop, s390_emit_stack_flush, s390_emit_zero_ext,
+ s390_emit_swap, s390_emit_stack_adjust, s390_emit_int_call_1,
+ s390_emit_void_call_2, s390_emit_eq_goto, s390_emit_ne_goto,
+ s390_emit_lt_goto, s390_emit_le_goto, s390_emit_gt_goto,
+ s390_emit_ge_goto };
#ifdef __s390x__
@@ -2269,10 +2225,10 @@ static void
s390x_emit_prologue (void)
{
static const unsigned char buf[] = {
- 0xeb, 0x9f, 0xf0, 0x48, 0x00, 0x24, /* stmg %r9, %r15, 0x48(%r15) */
- 0xb9, 0x04, 0x00, 0x92, /* lgr %r9, %r2 */
- 0xb9, 0x04, 0x00, 0xa3, /* lgr %r10, %r3 */
- 0xb9, 0x04, 0x00, 0xbf, /* lgr %r11, %r15 */
+ 0xeb, 0x9f, 0xf0, 0x48, 0x00, 0x24, /* stmg %r9, %r15, 0x48(%r15) */
+ 0xb9, 0x04, 0x00, 0x92, /* lgr %r9, %r2 */
+ 0xb9, 0x04, 0x00, 0xa3, /* lgr %r10, %r3 */
+ 0xb9, 0x04, 0x00, 0xbf, /* lgr %r11, %r15 */
};
add_insns (buf, sizeof buf);
}
@@ -2283,10 +2239,10 @@ static void
s390x_emit_epilogue (void)
{
static const unsigned char buf[] = {
- 0xe3, 0x20, 0xa0, 0x00, 0x00, 0x24, /* stg %r2, 0(%r10) */
- 0xa7, 0x29, 0x00, 0x00, /* lghi %r2, 0 */
- 0xeb, 0x9f, 0xf0, 0x48, 0x00, 0x04, /* lmg %r9, %r15, 0x48(%r15) */
- 0x07, 0xfe, /* br %r14 */
+ 0xe3, 0x20, 0xa0, 0x00, 0x00, 0x24, /* stg %r2, 0(%r10) */
+ 0xa7, 0x29, 0x00, 0x00, /* lghi %r2, 0 */
+ 0xeb, 0x9f, 0xf0, 0x48, 0x00, 0x04, /* lmg %r9, %r15, 0x48(%r15) */
+ 0x07, 0xfe, /* br %r14 */
};
add_insns (buf, sizeof buf);
}
@@ -2297,8 +2253,8 @@ static void
s390x_emit_add (void)
{
static const unsigned char buf[] = {
- 0xe3, 0x20, 0xf0, 0x00, 0x00, 0x0a, /* alg %r2, 0(%r15) */
- 0x41, 0xf0, 0xf0, 0x08, /* la %r15, 8(%r15) */
+ 0xe3, 0x20, 0xf0, 0x00, 0x00, 0x0a, /* alg %r2, 0(%r15) */
+ 0x41, 0xf0, 0xf0, 0x08, /* la %r15, 8(%r15) */
};
add_insns (buf, sizeof buf);
}
@@ -2309,10 +2265,10 @@ static void
s390x_emit_sub (void)
{
static const unsigned char buf[] = {
- 0xe3, 0x30, 0xf0, 0x00, 0x00, 0x04, /* lg %r3, 0(%r15) */
- 0xb9, 0x0b, 0x00, 0x32, /* slgr %r3, %r2 */
- 0xb9, 0x04, 0x00, 0x23, /* lgr %r2, %r3 */
- 0x41, 0xf0, 0xf0, 0x08, /* la %r15, 8(%r15) */
+ 0xe3, 0x30, 0xf0, 0x00, 0x00, 0x04, /* lg %r3, 0(%r15) */
+ 0xb9, 0x0b, 0x00, 0x32, /* slgr %r3, %r2 */
+ 0xb9, 0x04, 0x00, 0x23, /* lgr %r2, %r3 */
+ 0x41, 0xf0, 0xf0, 0x08, /* la %r15, 8(%r15) */
};
add_insns (buf, sizeof buf);
}
@@ -2331,9 +2287,9 @@ static void
s390x_emit_lsh (void)
{
static const unsigned char buf[] = {
- 0xe3, 0x30, 0xf0, 0x00, 0x00, 0x04, /* lg %r3, 0(%r15) */
- 0xeb, 0x23, 0x20, 0x00, 0x00, 0x0d, /* sllg %r2, %r3, 0(%r2) */
- 0x41, 0xf0, 0xf0, 0x08, /* la %r15, 8(%r15) */
+ 0xe3, 0x30, 0xf0, 0x00, 0x00, 0x04, /* lg %r3, 0(%r15) */
+ 0xeb, 0x23, 0x20, 0x00, 0x00, 0x0d, /* sllg %r2, %r3, 0(%r2) */
+ 0x41, 0xf0, 0xf0, 0x08, /* la %r15, 8(%r15) */
};
add_insns (buf, sizeof buf);
}
@@ -2344,9 +2300,9 @@ static void
s390x_emit_rsh_signed (void)
{
static const unsigned char buf[] = {
- 0xe3, 0x30, 0xf0, 0x00, 0x00, 0x04, /* lg %r3, 0(%r15) */
- 0xeb, 0x23, 0x20, 0x00, 0x00, 0x0a, /* srag %r2, %r3, 0(%r2) */
- 0x41, 0xf0, 0xf0, 0x08, /* la %r15, 8(%r15) */
+ 0xe3, 0x30, 0xf0, 0x00, 0x00, 0x04, /* lg %r3, 0(%r15) */
+ 0xeb, 0x23, 0x20, 0x00, 0x00, 0x0a, /* srag %r2, %r3, 0(%r2) */
+ 0x41, 0xf0, 0xf0, 0x08, /* la %r15, 8(%r15) */
};
add_insns (buf, sizeof buf);
}
@@ -2357,9 +2313,9 @@ static void
s390x_emit_rsh_unsigned (void)
{
static const unsigned char buf[] = {
- 0xe3, 0x30, 0xf0, 0x00, 0x00, 0x04, /* lg %r3, 0(%r15) */
- 0xeb, 0x23, 0x20, 0x00, 0x00, 0x0c, /* srlg %r2, %r3, 0(%r2) */
- 0x41, 0xf0, 0xf0, 0x08, /* la %r15, 8(%r15) */
+ 0xe3, 0x30, 0xf0, 0x00, 0x00, 0x04, /* lg %r3, 0(%r15) */
+ 0xeb, 0x23, 0x20, 0x00, 0x00, 0x0c, /* srlg %r2, %r3, 0(%r2) */
+ 0x41, 0xf0, 0xf0, 0x08, /* la %r15, 8(%r15) */
};
add_insns (buf, sizeof buf);
}
@@ -2371,9 +2327,19 @@ s390x_emit_ext (int arg)
{
unsigned char buf[] = {
/* sllg %r2, %r2, <64-arg> */
- 0xeb, 0x22, 0x00, (unsigned char) (64 - arg), 0x00, 0x0d,
+ 0xeb,
+ 0x22,
+ 0x00,
+ (unsigned char) (64 - arg),
+ 0x00,
+ 0x0d,
/* srag %r2, %r2, <64-arg> */
- 0xeb, 0x22, 0x00, (unsigned char) (64 - arg), 0x00, 0x0a,
+ 0xeb,
+ 0x22,
+ 0x00,
+ (unsigned char) (64 - arg),
+ 0x00,
+ 0x0a,
};
add_insns (buf, sizeof buf);
}
@@ -2384,9 +2350,9 @@ static void
s390x_emit_log_not (void)
{
static const unsigned char buf[] = {
- 0xb9, 0x00, 0x00, 0x22, /* lpgr %r2, %r2 */
- 0xa7, 0x2b, 0xff, 0xff, /* aghi %r2, -1 */
- 0xeb, 0x22, 0x00, 0x3f, 0x00, 0x0c, /* srlg %r2, %r2, 63 */
+ 0xb9, 0x00, 0x00, 0x22, /* lpgr %r2, %r2 */
+ 0xa7, 0x2b, 0xff, 0xff, /* aghi %r2, -1 */
+ 0xeb, 0x22, 0x00, 0x3f, 0x00, 0x0c, /* srlg %r2, %r2, 63 */
};
add_insns (buf, sizeof buf);
}
@@ -2397,8 +2363,8 @@ static void
s390x_emit_bit_and (void)
{
static const unsigned char buf[] = {
- 0xe3, 0x20, 0xf0, 0x00, 0x00, 0x80, /* ng %r2, 0(%r15) */
- 0x41, 0xf0, 0xf0, 0x08, /* la %r15, 8(%r15) */
+ 0xe3, 0x20, 0xf0, 0x00, 0x00, 0x80, /* ng %r2, 0(%r15) */
+ 0x41, 0xf0, 0xf0, 0x08, /* la %r15, 8(%r15) */
};
add_insns (buf, sizeof buf);
}
@@ -2409,8 +2375,8 @@ static void
s390x_emit_bit_or (void)
{
static const unsigned char buf[] = {
- 0xe3, 0x20, 0xf0, 0x00, 0x00, 0x81, /* og %r2, 0(%r15) */
- 0x41, 0xf0, 0xf0, 0x08, /* la %r15, 8(%r15) */
+ 0xe3, 0x20, 0xf0, 0x00, 0x00, 0x81, /* og %r2, 0(%r15) */
+ 0x41, 0xf0, 0xf0, 0x08, /* la %r15, 8(%r15) */
};
add_insns (buf, sizeof buf);
}
@@ -2421,8 +2387,8 @@ static void
s390x_emit_bit_xor (void)
{
static const unsigned char buf[] = {
- 0xe3, 0x20, 0xf0, 0x00, 0x00, 0x82, /* xg %r2, 0(%r15) */
- 0x41, 0xf0, 0xf0, 0x08, /* la %r15, 8(%r15) */
+ 0xe3, 0x20, 0xf0, 0x00, 0x00, 0x82, /* xg %r2, 0(%r15) */
+ 0x41, 0xf0, 0xf0, 0x08, /* la %r15, 8(%r15) */
};
add_insns (buf, sizeof buf);
}
@@ -2433,8 +2399,8 @@ static void
s390x_emit_bit_not (void)
{
static const unsigned char buf[] = {
- 0xa7, 0x39, 0xff, 0xff, /* lghi %r3, -1 */
- 0xb9, 0x82, 0x00, 0x23, /* xgr %r2, %r3 */
+ 0xa7, 0x39, 0xff, 0xff, /* lghi %r3, -1 */
+ 0xb9, 0x82, 0x00, 0x23, /* xgr %r2, %r3 */
};
add_insns (buf, sizeof buf);
}
@@ -2454,12 +2420,12 @@ static void
s390x_emit_less_signed (void)
{
static const unsigned char buf[] = {
- 0xe3, 0x20, 0xf0, 0x00, 0x00, 0x20, /* cg %r2, 0(%r15) */
- 0xa7, 0x29, 0x00, 0x01, /* lghi %r2, 1 */
- 0xa7, 0x24, 0x00, 0x04, /* jh .Lend */
- 0xa7, 0x29, 0x00, 0x00, /* lghi %r2, 0 */
+ 0xe3, 0x20, 0xf0, 0x00, 0x00, 0x20, /* cg %r2, 0(%r15) */
+ 0xa7, 0x29, 0x00, 0x01, /* lghi %r2, 1 */
+ 0xa7, 0x24, 0x00, 0x04, /* jh .Lend */
+ 0xa7, 0x29, 0x00, 0x00, /* lghi %r2, 0 */
/* .Lend: */
- 0x41, 0xf0, 0xf0, 0x08, /* la %r15, 8(%r15) */
+ 0x41, 0xf0, 0xf0, 0x08, /* la %r15, 8(%r15) */
};
add_insns (buf, sizeof buf);
}
@@ -2470,12 +2436,12 @@ static void
s390x_emit_less_unsigned (void)
{
static const unsigned char buf[] = {
- 0xe3, 0x20, 0xf0, 0x00, 0x00, 0x21, /* clg %r2, 0(%r15) */
- 0xa7, 0x29, 0x00, 0x01, /* lghi %r2, 1 */
- 0xa7, 0x24, 0x00, 0x04, /* jh .Lend */
- 0xa7, 0x29, 0x00, 0x00, /* lghi %r2, 0 */
+ 0xe3, 0x20, 0xf0, 0x00, 0x00, 0x21, /* clg %r2, 0(%r15) */
+ 0xa7, 0x29, 0x00, 0x01, /* lghi %r2, 1 */
+ 0xa7, 0x24, 0x00, 0x04, /* jh .Lend */
+ 0xa7, 0x29, 0x00, 0x00, /* lghi %r2, 0 */
/* .Lend: */
- 0x41, 0xf0, 0xf0, 0x08, /* la %r15, 8(%r15) */
+ 0x41, 0xf0, 0xf0, 0x08, /* la %r15, 8(%r15) */
};
add_insns (buf, sizeof buf);
}
@@ -2486,16 +2452,16 @@ static void
s390x_emit_ref (int size)
{
static const unsigned char buf1[] = {
- 0xe3, 0x20, 0x20, 0x00, 0x00, 0x90, /* llgc %r2, 0(%r2) */
+ 0xe3, 0x20, 0x20, 0x00, 0x00, 0x90, /* llgc %r2, 0(%r2) */
};
static const unsigned char buf2[] = {
- 0xe3, 0x20, 0x20, 0x00, 0x00, 0x91 /* llgh %r2, 0(%r2) */
+ 0xe3, 0x20, 0x20, 0x00, 0x00, 0x91 /* llgh %r2, 0(%r2) */
};
static const unsigned char buf4[] = {
- 0xe3, 0x20, 0x20, 0x00, 0x00, 0x16, /* llgf %r2, 0(%r2) */
+ 0xe3, 0x20, 0x20, 0x00, 0x00, 0x16, /* llgf %r2, 0(%r2) */
};
static const unsigned char buf8[] = {
- 0xe3, 0x20, 0x20, 0x00, 0x00, 0x04, /* lg %r2, 0(%r2) */
+ 0xe3, 0x20, 0x20, 0x00, 0x00, 0x04, /* lg %r2, 0(%r2) */
};
switch (size)
{
@@ -2522,10 +2488,10 @@ static void
s390x_emit_if_goto (int *offset_p, int *size_p)
{
static const unsigned char buf[] = {
- 0xb9, 0x02, 0x00, 0x22, /* ltgr %r2, %r2 */
- 0xe3, 0x20, 0xf0, 0x00, 0x00, 0x04, /* lg %r2, 0(%r15) */
- 0x41, 0xf0, 0xf0, 0x08, /* la %r15, 8(%r15) */
- 0xc0, 0x74, 0x00, 0x00, 0x00, 0x00, /* jgne <fillme> */
+ 0xb9, 0x02, 0x00, 0x22, /* ltgr %r2, %r2 */
+ 0xe3, 0x20, 0xf0, 0x00, 0x00, 0x04, /* lg %r2, 0(%r15) */
+ 0x41, 0xf0, 0xf0, 0x08, /* la %r15, 8(%r15) */
+ 0xc0, 0x74, 0x00, 0x00, 0x00, 0x00, /* jgne <fillme> */
};
add_insns (buf, sizeof buf);
if (offset_p)
@@ -2542,10 +2508,13 @@ s390x_emit_const (LONGEST num)
unsigned long long n = num;
unsigned char buf_s[] = {
/* lghi %r2, <num> */
- 0xa7, 0x29, (unsigned char) (num >> 8), (unsigned char) num,
+ 0xa7,
+ 0x29,
+ (unsigned char) (num >> 8),
+ (unsigned char) num,
};
static const unsigned char buf_l[] = {
- 0xe3, 0x20, 0x10, 0x00, 0x00, 0x04, /* lg %r2, 0(%r1) */
+ 0xe3, 0x20, 0x10, 0x00, 0x00, 0x04, /* lg %r2, 0(%r1) */
};
if (num < 0x8000 && num >= -0x8000)
add_insns (buf_s, sizeof buf_s);
@@ -2564,10 +2533,10 @@ s390x_emit_call (CORE_ADDR fn)
{
unsigned long n = fn;
static const unsigned char buf[] = {
- 0xe3, 0x10, 0x10, 0x00, 0x00, 0x04, /* lg %r1, 0(%r1) */
- 0xa7, 0xfb, 0xff, 0x60, /* aghi %r15, -0xa0 */
- 0x0d, 0xe1, /* basr %r14, %r1 */
- 0xa7, 0xfb, 0x00, 0xa0, /* aghi %r15, 0xa0 */
+ 0xe3, 0x10, 0x10, 0x00, 0x00, 0x04, /* lg %r1, 0(%r1) */
+ 0xa7, 0xfb, 0xff, 0x60, /* aghi %r15, -0xa0 */
+ 0x0d, 0xe1, /* basr %r14, %r1 */
+ 0xa7, 0xfb, 0x00, 0xa0, /* aghi %r15, 0xa0 */
};
s390_emit_litpool (8);
add_insns ((unsigned char *) &n, sizeof n);
@@ -2581,9 +2550,15 @@ s390x_emit_reg (int reg)
{
unsigned char buf[] = {
/* lgr %r2, %r9 */
- 0xb9, 0x04, 0x00, 0x29,
+ 0xb9,
+ 0x04,
+ 0x00,
+ 0x29,
/* lghi %r3, <reg> */
- 0xa7, 0x39, (unsigned char) (reg >> 8), (unsigned char) reg,
+ 0xa7,
+ 0x39,
+ (unsigned char) (reg >> 8),
+ (unsigned char) reg,
};
add_insns (buf, sizeof buf);
s390x_emit_call (get_raw_reg_func_addr ());
@@ -2595,8 +2570,8 @@ static void
s390x_emit_pop (void)
{
static const unsigned char buf[] = {
- 0xe3, 0x20, 0xf0, 0x00, 0x00, 0x04, /* lg %r2, 0(%r15) */
- 0x41, 0xf0, 0xf0, 0x08, /* la %r15, 8(%r15) */
+ 0xe3, 0x20, 0xf0, 0x00, 0x00, 0x04, /* lg %r2, 0(%r15) */
+ 0x41, 0xf0, 0xf0, 0x08, /* la %r15, 8(%r15) */
};
add_insns (buf, sizeof buf);
}
@@ -2607,8 +2582,8 @@ static void
s390x_emit_stack_flush (void)
{
static const unsigned char buf[] = {
- 0xa7, 0xfb, 0xff, 0xf8, /* aghi %r15, -8 */
- 0xe3, 0x20, 0xf0, 0x00, 0x00, 0x24, /* stg %r2, 0(%r15) */
+ 0xa7, 0xfb, 0xff, 0xf8, /* aghi %r15, -8 */
+ 0xe3, 0x20, 0xf0, 0x00, 0x00, 0x24, /* stg %r2, 0(%r15) */
};
add_insns (buf, sizeof buf);
}
@@ -2620,9 +2595,19 @@ s390x_emit_zero_ext (int arg)
{
unsigned char buf[] = {
/* sllg %r2, %r2, <64-arg> */
- 0xeb, 0x22, 0x00, (unsigned char) (64 - arg), 0x00, 0x0d,
+ 0xeb,
+ 0x22,
+ 0x00,
+ (unsigned char) (64 - arg),
+ 0x00,
+ 0x0d,
/* srlg %r2, %r2, <64-arg> */
- 0xeb, 0x22, 0x00, (unsigned char) (64 - arg), 0x00, 0x0c,
+ 0xeb,
+ 0x22,
+ 0x00,
+ (unsigned char) (64 - arg),
+ 0x00,
+ 0x0c,
};
add_insns (buf, sizeof buf);
}
@@ -2633,9 +2618,9 @@ static void
s390x_emit_swap (void)
{
static const unsigned char buf[] = {
- 0xe3, 0x30, 0xf0, 0x00, 0x00, 0x04, /* lg %r3, 0(%r15) */
- 0xe3, 0x20, 0xf0, 0x00, 0x00, 0x24, /* stg %r2, 0(%r15) */
- 0xb9, 0x04, 0x00, 0x23, /* lgr %r2, %r3 */
+ 0xe3, 0x30, 0xf0, 0x00, 0x00, 0x04, /* lg %r3, 0(%r15) */
+ 0xe3, 0x20, 0xf0, 0x00, 0x00, 0x24, /* stg %r2, 0(%r15) */
+ 0xb9, 0x04, 0x00, 0x23, /* lgr %r2, %r3 */
};
add_insns (buf, sizeof buf);
}
@@ -2647,8 +2632,10 @@ s390x_emit_stack_adjust (int n)
{
unsigned char buf[] = {
/* aghi %r15, 8*n */
- 0xa7, 0xfb,
- (unsigned char) (n * 8 >> 8), (unsigned char) (n * 8),
+ 0xa7,
+ 0xfb,
+ (unsigned char) (n * 8 >> 8),
+ (unsigned char) (n * 8),
};
add_insns (buf, sizeof buf);
}
@@ -2670,11 +2657,11 @@ s390x_emit_void_call_2 (CORE_ADDR fn, int arg1)
{
/* FN's prototype is `void(*fn)(int,LONGEST)'. */
static const unsigned char buf[] = {
- 0xb9, 0x04, 0x00, 0x32, /* lgr %r3, %r2 */
- 0xb9, 0x04, 0x00, 0xc2, /* lgr %r12, %r2 */
+ 0xb9, 0x04, 0x00, 0x32, /* lgr %r3, %r2 */
+ 0xb9, 0x04, 0x00, 0xc2, /* lgr %r12, %r2 */
};
static const unsigned char buf2[] = {
- 0xb9, 0x04, 0x00, 0x2c, /* lgr %r2, %r12 */
+ 0xb9, 0x04, 0x00, 0x2c, /* lgr %r2, %r12 */
};
add_insns (buf, sizeof buf);
s390x_emit_const (arg1);
@@ -2688,10 +2675,10 @@ static void
s390x_emit_eq_goto (int *offset_p, int *size_p)
{
static const unsigned char buf[] = {
- 0xe3, 0x20, 0xf0, 0x00, 0x00, 0x20, /* cg %r2, 0(%r15) */
+ 0xe3, 0x20, 0xf0, 0x00, 0x00, 0x20, /* cg %r2, 0(%r15) */
0xe3, 0x20, 0xf0, 0x08, 0x00, 0x04, /* lg %r2, 8(%r15) */
- 0x41, 0xf0, 0xf0, 0x10, /* la %r15, 16(%r15) */
- 0xc0, 0x84, 0x00, 0x00, 0x00, 0x00, /* jge <fillme> */
+ 0x41, 0xf0, 0xf0, 0x10, /* la %r15, 16(%r15) */
+ 0xc0, 0x84, 0x00, 0x00, 0x00, 0x00, /* jge <fillme> */
};
add_insns (buf, sizeof buf);
if (offset_p)
@@ -2706,10 +2693,10 @@ static void
s390x_emit_ne_goto (int *offset_p, int *size_p)
{
static const unsigned char buf[] = {
- 0xe3, 0x20, 0xf0, 0x00, 0x00, 0x20, /* cg %r2, 0(%r15) */
+ 0xe3, 0x20, 0xf0, 0x00, 0x00, 0x20, /* cg %r2, 0(%r15) */
0xe3, 0x20, 0xf0, 0x08, 0x00, 0x04, /* lg %r2, 8(%r15) */
- 0x41, 0xf0, 0xf0, 0x10, /* la %r15, 16(%r15) */
- 0xc0, 0x74, 0x00, 0x00, 0x00, 0x00, /* jgne <fillme> */
+ 0x41, 0xf0, 0xf0, 0x10, /* la %r15, 16(%r15) */
+ 0xc0, 0x74, 0x00, 0x00, 0x00, 0x00, /* jgne <fillme> */
};
add_insns (buf, sizeof buf);
if (offset_p)
@@ -2724,10 +2711,10 @@ static void
s390x_emit_lt_goto (int *offset_p, int *size_p)
{
static const unsigned char buf[] = {
- 0xe3, 0x20, 0xf0, 0x00, 0x00, 0x20, /* cg %r2, 0(%r15) */
+ 0xe3, 0x20, 0xf0, 0x00, 0x00, 0x20, /* cg %r2, 0(%r15) */
0xe3, 0x20, 0xf0, 0x08, 0x00, 0x04, /* lg %r2, 8(%r15) */
- 0x41, 0xf0, 0xf0, 0x10, /* la %r15, 16(%r15) */
- 0xc0, 0x24, 0x00, 0x00, 0x00, 0x00, /* jgh <fillme> */
+ 0x41, 0xf0, 0xf0, 0x10, /* la %r15, 16(%r15) */
+ 0xc0, 0x24, 0x00, 0x00, 0x00, 0x00, /* jgh <fillme> */
};
add_insns (buf, sizeof buf);
if (offset_p)
@@ -2742,10 +2729,10 @@ static void
s390x_emit_le_goto (int *offset_p, int *size_p)
{
static const unsigned char buf[] = {
- 0xe3, 0x20, 0xf0, 0x00, 0x00, 0x20, /* cg %r2, 0(%r15) */
+ 0xe3, 0x20, 0xf0, 0x00, 0x00, 0x20, /* cg %r2, 0(%r15) */
0xe3, 0x20, 0xf0, 0x08, 0x00, 0x04, /* lg %r2, 8(%r15) */
- 0x41, 0xf0, 0xf0, 0x10, /* la %r15, 16(%r15) */
- 0xc0, 0xa4, 0x00, 0x00, 0x00, 0x00, /* jghe <fillme> */
+ 0x41, 0xf0, 0xf0, 0x10, /* la %r15, 16(%r15) */
+ 0xc0, 0xa4, 0x00, 0x00, 0x00, 0x00, /* jghe <fillme> */
};
add_insns (buf, sizeof buf);
if (offset_p)
@@ -2760,10 +2747,10 @@ static void
s390x_emit_gt_goto (int *offset_p, int *size_p)
{
static const unsigned char buf[] = {
- 0xe3, 0x20, 0xf0, 0x00, 0x00, 0x20, /* cg %r2, 0(%r15) */
+ 0xe3, 0x20, 0xf0, 0x00, 0x00, 0x20, /* cg %r2, 0(%r15) */
0xe3, 0x20, 0xf0, 0x08, 0x00, 0x04, /* lg %r2, 8(%r15) */
- 0x41, 0xf0, 0xf0, 0x10, /* la %r15, 16(%r15) */
- 0xc0, 0x44, 0x00, 0x00, 0x00, 0x00, /* jgl <fillme> */
+ 0x41, 0xf0, 0xf0, 0x10, /* la %r15, 16(%r15) */
+ 0xc0, 0x44, 0x00, 0x00, 0x00, 0x00, /* jgl <fillme> */
};
add_insns (buf, sizeof buf);
if (offset_p)
@@ -2778,10 +2765,10 @@ static void
s390x_emit_ge_goto (int *offset_p, int *size_p)
{
static const unsigned char buf[] = {
- 0xe3, 0x20, 0xf0, 0x00, 0x00, 0x20, /* cg %r2, 0(%r15) */
+ 0xe3, 0x20, 0xf0, 0x00, 0x00, 0x20, /* cg %r2, 0(%r15) */
0xe3, 0x20, 0xf0, 0x08, 0x00, 0x04, /* lg %r2, 8(%r15) */
- 0x41, 0xf0, 0xf0, 0x10, /* la %r15, 16(%r15) */
- 0xc0, 0xc4, 0x00, 0x00, 0x00, 0x00, /* jgle <fillme> */
+ 0x41, 0xf0, 0xf0, 0x10, /* la %r15, 16(%r15) */
+ 0xc0, 0xc4, 0x00, 0x00, 0x00, 0x00, /* jgle <fillme> */
};
add_insns (buf, sizeof buf);
if (offset_p)
@@ -2792,46 +2779,21 @@ s390x_emit_ge_goto (int *offset_p, int *size_p)
/* The "emit_ops" structure for s390x. */
-static struct emit_ops s390x_emit_ops =
- {
- s390x_emit_prologue,
- s390x_emit_epilogue,
- s390x_emit_add,
- s390x_emit_sub,
- s390x_emit_mul,
- s390x_emit_lsh,
- s390x_emit_rsh_signed,
- s390x_emit_rsh_unsigned,
- s390x_emit_ext,
- s390x_emit_log_not,
- s390x_emit_bit_and,
- s390x_emit_bit_or,
- s390x_emit_bit_xor,
- s390x_emit_bit_not,
- s390x_emit_equal,
- s390x_emit_less_signed,
- s390x_emit_less_unsigned,
- s390x_emit_ref,
- s390x_emit_if_goto,
- s390_emit_goto,
- s390_write_goto_address,
- s390x_emit_const,
- s390x_emit_call,
- s390x_emit_reg,
- s390x_emit_pop,
- s390x_emit_stack_flush,
- s390x_emit_zero_ext,
- s390x_emit_swap,
- s390x_emit_stack_adjust,
- s390x_emit_int_call_1,
- s390x_emit_void_call_2,
- s390x_emit_eq_goto,
- s390x_emit_ne_goto,
- s390x_emit_lt_goto,
- s390x_emit_le_goto,
- s390x_emit_gt_goto,
- s390x_emit_ge_goto
- };
+static struct emit_ops s390x_emit_ops = {
+ s390x_emit_prologue, s390x_emit_epilogue, s390x_emit_add,
+ s390x_emit_sub, s390x_emit_mul, s390x_emit_lsh,
+ s390x_emit_rsh_signed, s390x_emit_rsh_unsigned, s390x_emit_ext,
+ s390x_emit_log_not, s390x_emit_bit_and, s390x_emit_bit_or,
+ s390x_emit_bit_xor, s390x_emit_bit_not, s390x_emit_equal,
+ s390x_emit_less_signed, s390x_emit_less_unsigned, s390x_emit_ref,
+ s390x_emit_if_goto, s390_emit_goto, s390_write_goto_address,
+ s390x_emit_const, s390x_emit_call, s390x_emit_reg,
+ s390x_emit_pop, s390x_emit_stack_flush, s390x_emit_zero_ext,
+ s390x_emit_swap, s390x_emit_stack_adjust, s390x_emit_int_call_1,
+ s390x_emit_void_call_2, s390x_emit_eq_goto, s390x_emit_ne_goto,
+ s390x_emit_lt_goto, s390x_emit_le_goto, s390x_emit_gt_goto,
+ s390x_emit_ge_goto
+};
#endif
/* The "emit_ops" target ops method. */
diff --git a/gdbserver/linux-s390-tdesc.h b/gdbserver/linux-s390-tdesc.h
index 71ed366f4b1..3d4497bf237 100644
--- a/gdbserver/linux-s390-tdesc.h
+++ b/gdbserver/linux-s390-tdesc.h
@@ -24,7 +24,8 @@
it's sufficient to pass only the register set here. This, together with
the ABI known at IPA compile time, maps to a tdesc. */
-enum s390_linux_tdesc {
+enum s390_linux_tdesc
+{
S390_TDESC_32,
S390_TDESC_32V1,
S390_TDESC_32V2,
diff --git a/gdbserver/linux-sh-low.cc b/gdbserver/linux-sh-low.cc
index 782b8292010..dba9d5b0fb7 100644
--- a/gdbserver/linux-sh-low.cc
+++ b/gdbserver/linux-sh-low.cc
@@ -24,13 +24,11 @@
class sh_target : public linux_process_target
{
public:
-
const regs_info *get_regs_info () override;
const gdb_byte *sw_breakpoint_from_kind (int kind, int *size) override;
protected:
-
void low_arch_setup () override;
bool low_cannot_fetch_register (int regno) override;
@@ -82,17 +80,49 @@ extern const struct target_desc *tdesc_sh;
/* Currently, don't check/send MQ. */
static int sh_regmap[] = {
- 0, 4, 8, 12, 16, 20, 24, 28,
- 32, 36, 40, 44, 48, 52, 56, 60,
-
- REG_PC*4, REG_PR*4, REG_GBR*4, -1,
- REG_MACH*4, REG_MACL*4, REG_SR*4,
- REG_FPUL*4, REG_FPSCR*4,
-
- REG_FPREG0*4+0, REG_FPREG0*4+4, REG_FPREG0*4+8, REG_FPREG0*4+12,
- REG_FPREG0*4+16, REG_FPREG0*4+20, REG_FPREG0*4+24, REG_FPREG0*4+28,
- REG_FPREG0*4+32, REG_FPREG0*4+36, REG_FPREG0*4+40, REG_FPREG0*4+44,
- REG_FPREG0*4+48, REG_FPREG0*4+52, REG_FPREG0*4+56, REG_FPREG0*4+60,
+ 0,
+ 4,
+ 8,
+ 12,
+ 16,
+ 20,
+ 24,
+ 28,
+ 32,
+ 36,
+ 40,
+ 44,
+ 48,
+ 52,
+ 56,
+ 60,
+
+ REG_PC * 4,
+ REG_PR * 4,
+ REG_GBR * 4,
+ -1,
+ REG_MACH * 4,
+ REG_MACL * 4,
+ REG_SR * 4,
+ REG_FPUL * 4,
+ REG_FPSCR * 4,
+
+ REG_FPREG0 * 4 + 0,
+ REG_FPREG0 * 4 + 4,
+ REG_FPREG0 * 4 + 8,
+ REG_FPREG0 * 4 + 12,
+ REG_FPREG0 * 4 + 16,
+ REG_FPREG0 * 4 + 20,
+ REG_FPREG0 * 4 + 24,
+ REG_FPREG0 * 4 + 28,
+ REG_FPREG0 * 4 + 32,
+ REG_FPREG0 * 4 + 36,
+ REG_FPREG0 * 4 + 40,
+ REG_FPREG0 * 4 + 44,
+ REG_FPREG0 * 4 + 48,
+ REG_FPREG0 * 4 + 52,
+ REG_FPREG0 * 4 + 56,
+ REG_FPREG0 * 4 + 60,
};
bool
@@ -137,7 +167,8 @@ sh_target::low_breakpoint_at (CORE_ADDR where)
/* Provide only a fill function for the general register set. ps_lgetregs
will use this for NPTL support. */
-static void sh_fill_gregset (struct regcache *regcache, void *buf)
+static void
+sh_fill_gregset (struct regcache *regcache, void *buf)
{
int i;
@@ -146,30 +177,22 @@ static void sh_fill_gregset (struct regcache *regcache, void *buf)
collect_register (regcache, i, (char *) buf + sh_regmap[i]);
}
-static struct regset_info sh_regsets[] = {
- { 0, 0, 0, 0, GENERAL_REGS, sh_fill_gregset, NULL },
- NULL_REGSET
+static struct regset_info sh_regsets[]
+ = { { 0, 0, 0, 0, GENERAL_REGS, sh_fill_gregset, NULL }, NULL_REGSET };
+
+static struct regsets_info sh_regsets_info = {
+ sh_regsets, /* regsets */
+ 0, /* num_regsets */
+ NULL, /* disabled_regsets */
+};
+
+static struct usrregs_info sh_usrregs_info = {
+ sh_num_regs,
+ sh_regmap,
};
-static struct regsets_info sh_regsets_info =
- {
- sh_regsets, /* regsets */
- 0, /* num_regsets */
- NULL, /* disabled_regsets */
- };
-
-static struct usrregs_info sh_usrregs_info =
- {
- sh_num_regs,
- sh_regmap,
- };
-
-static struct regs_info myregs_info =
- {
- NULL, /* regset_bitmap */
- &sh_usrregs_info,
- &sh_regsets_info
- };
+static struct regs_info myregs_info = { NULL, /* regset_bitmap */
+ &sh_usrregs_info, &sh_regsets_info };
const regs_info *
sh_target::get_regs_info ()
diff --git a/gdbserver/linux-sparc-low.cc b/gdbserver/linux-sparc-low.cc
index 660e8329f57..7991d791491 100644
--- a/gdbserver/linux-sparc-low.cc
+++ b/gdbserver/linux-sparc-low.cc
@@ -47,13 +47,11 @@
class sparc_target : public linux_process_target
{
public:
-
const regs_info *get_regs_info () override;
const gdb_byte *sw_breakpoint_from_kind (int kind, int *size) override;
protected:
-
void low_arch_setup () override;
bool low_cannot_fetch_register (int regno) override;
@@ -92,34 +90,39 @@ sparc_target::low_get_pc (regcache *regcache)
static int sparc_regmap[] = {
/* These offsets correspond to GET/SETREGSET. */
- -1, 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, /* g0 .. g7 */
- 7*8, 8*8, 9*8, 10*8, 11*8, 12*8, 13*8, 14*8, /* o0 .. o5, sp, o7 */
- -1, -1, -1, -1, -1, -1, -1, -1, /* l0 .. l7 */
- -1, -1, -1, -1, -1, -1, -1, -1, /* i0 .. i5, fp, i7 */
+ -1, 0 * 8, 1 * 8, 2 * 8, 3 * 8, 4 * 8, 5 * 8, 6 * 8, /* g0 .. g7 */
+ 7 * 8, 8 * 8, 9 * 8, 10 * 8, 11 * 8, 12 * 8, 13 * 8,
+ 14 * 8, /* o0 .. o5, sp, o7 */
+ -1, -1, -1, -1, -1, -1, -1, -1, /* l0 .. l7 */
+ -1, -1, -1, -1, -1, -1, -1, -1, /* i0 .. i5, fp, i7 */
/* Floating point registers offsets correspond to GET/SETFPREGSET. */
- 0*4, 1*4, 2*4, 3*4, 4*4, 5*4, 6*4, 7*4, /* f0 .. f7 */
- 8*4, 9*4, 10*4, 11*4, 12*4, 13*4, 14*4, 15*4, /* f8 .. f15 */
- 16*4, 17*4, 18*4, 19*4, 20*4, 21*4, 22*4, 23*4, /* f16 .. f23 */
- 24*4, 25*4, 26*4, 27*4, 28*4, 29*4, 30*4, 31*4, /* f24 .. f31 */
+ 0 * 4, 1 * 4, 2 * 4, 3 * 4, 4 * 4, 5 * 4, 6 * 4, 7 * 4, /* f0 .. f7 */
+ 8 * 4, 9 * 4, 10 * 4, 11 * 4, 12 * 4, 13 * 4, 14 * 4,
+ 15 * 4, /* f8 .. f15 */
+ 16 * 4, 17 * 4, 18 * 4, 19 * 4, 20 * 4, 21 * 4, 22 * 4,
+ 23 * 4, /* f16 .. f23 */
+ 24 * 4, 25 * 4, 26 * 4, 27 * 4, 28 * 4, 29 * 4, 30 * 4,
+ 31 * 4, /* f24 .. f31 */
/* F32 offset starts next to f31: 31*4+4 = 16 * 8. */
- 16*8, 17*8, 18*8, 19*8, 20*8, 21*8, 22*8, 23*8, /* f32 .. f46 */
- 24*8, 25*8, 26*8, 27*8, 28*8, 29*8, 30*8, 31*8, /* f48 .. f62 */
-
- 17 *8, /* pc */
- 18 *8, /* npc */
- 16 *8, /* state */
- /* FSR offset also corresponds to GET/SETFPREGSET, ans is placed
+ 16 * 8, 17 * 8, 18 * 8, 19 * 8, 20 * 8, 21 * 8, 22 * 8,
+ 23 * 8, /* f32 .. f46 */
+ 24 * 8, 25 * 8, 26 * 8, 27 * 8, 28 * 8, 29 * 8, 30 * 8,
+ 31 * 8, /* f48 .. f62 */
+
+ 17 * 8, /* pc */
+ 18 * 8, /* npc */
+ 16 * 8, /* state */
+ /* FSR offset also corresponds to GET/SETFPREGSET, ans is placed
next to f62. */
- 32 *8, /* fsr */
- -1, /* fprs */
- /* Y register is 32-bits length, but gdb takes care of that. */
- 19 *8, /* y */
+ 32 * 8, /* fsr */
+ -1, /* fprs */
+ /* Y register is 32-bits length, but gdb takes care of that. */
+ 19 * 8, /* y */
};
-
struct regs_range_t
{
int regno_start;
@@ -127,16 +130,16 @@ struct regs_range_t
};
static const struct regs_range_t gregs_ranges[] = {
- { 0, 31 }, /* g0 .. i7 */
- { 80, 82 }, /* pc .. state */
- { 84, 85 } /* fprs .. y */
+ { 0, 31 }, /* g0 .. i7 */
+ { 80, 82 }, /* pc .. state */
+ { 84, 85 } /* fprs .. y */
};
#define N_GREGS_RANGES (sizeof (gregs_ranges) / sizeof (struct regs_range_t))
static const struct regs_range_t fpregs_ranges[] = {
- { 32, 79 }, /* f0 .. f62 */
- { 83, 83 } /* fsr */
+ { 32, 79 }, /* f0 .. f62 */
+ { 83, 83 } /* fsr */
};
#define N_FPREGS_RANGES (sizeof (fpregs_ranges) / sizeof (struct regs_range_t))
@@ -168,8 +171,8 @@ sparc_fill_gregset_to_stack (struct regcache *regcache, const void *buf)
/* These registers have to be stored in the stack. */
memcpy (&addr,
- ((char *) buf) + sparc_regmap[find_regno (regcache->tdesc, "sp")],
- sizeof (addr));
+ ((char *) buf) + sparc_regmap[find_regno (regcache->tdesc, "sp")],
+ sizeof (addr));
addr += BIAS;
@@ -189,9 +192,9 @@ sparc_fill_gregset (struct regcache *regcache, void *buf)
for (range = 0; range < N_GREGS_RANGES; range++)
for (i = gregs_ranges[range].regno_start;
- i <= gregs_ranges[range].regno_end; i++)
+ i <= gregs_ranges[range].regno_end; i++)
if (sparc_regmap[i] != -1)
- collect_register (regcache, i, ((char *) buf) + sparc_regmap[i]);
+ collect_register (regcache, i, ((char *) buf) + sparc_regmap[i]);
sparc_fill_gregset_to_stack (regcache, buf);
}
@@ -204,9 +207,8 @@ sparc_fill_fpregset (struct regcache *regcache, void *buf)
for (range = 0; range < N_FPREGS_RANGES; range++)
for (i = fpregs_ranges[range].regno_start;
- i <= fpregs_ranges[range].regno_end; i++)
+ i <= fpregs_ranges[range].regno_end; i++)
collect_register (regcache, i, ((char *) buf) + sparc_regmap[i]);
-
}
static void
@@ -220,8 +222,8 @@ sparc_store_gregset_from_stack (struct regcache *regcache, const void *buf)
/* These registers have to be obtained from the stack. */
memcpy (&addr,
- ((char *) buf) + sparc_regmap[find_regno (regcache->tdesc, "sp")],
- sizeof (addr));
+ ((char *) buf) + sparc_regmap[find_regno (regcache->tdesc, "sp")],
+ sizeof (addr));
addr += BIAS;
@@ -244,11 +246,11 @@ sparc_store_gregset (struct regcache *regcache, const void *buf)
for (range = 0; range < N_GREGS_RANGES; range++)
for (i = gregs_ranges[range].regno_start;
- i <= gregs_ranges[range].regno_end; i++)
+ i <= gregs_ranges[range].regno_end; i++)
if (sparc_regmap[i] != -1)
- supply_register (regcache, i, ((char *) buf) + sparc_regmap[i]);
+ supply_register (regcache, i, ((char *) buf) + sparc_regmap[i]);
else
- supply_register (regcache, i, zerobuf);
+ supply_register (regcache, i, zerobuf);
sparc_store_gregset_from_stack (regcache, buf);
}
@@ -261,14 +263,11 @@ sparc_store_fpregset (struct regcache *regcache, const void *buf)
for (range = 0; range < N_FPREGS_RANGES; range++)
for (i = fpregs_ranges[range].regno_start;
- i <= fpregs_ranges[range].regno_end;
- i++)
+ i <= fpregs_ranges[range].regno_end; i++)
supply_register (regcache, i, ((char *) buf) + sparc_regmap[i]);
}
-static const gdb_byte sparc_breakpoint[INSN_SIZE] = {
- 0x91, 0xd0, 0x20, 0x01
-};
+static const gdb_byte sparc_breakpoint[INSN_SIZE] = { 0x91, 0xd0, 0x20, 0x01 };
#define sparc_breakpoint_len INSN_SIZE
/* Implementation of target ops method "sw_breakpoint_from_kind". */
@@ -302,37 +301,28 @@ sparc_target::low_arch_setup ()
current_process ()->tdesc = tdesc_sparc64;
}
-static struct regset_info sparc_regsets[] = {
- { PTRACE_GETREGS, PTRACE_SETREGS, 0, sizeof (elf_gregset_t),
- GENERAL_REGS,
- sparc_fill_gregset, sparc_store_gregset },
- { PTRACE_GETFPREGS, PTRACE_SETFPREGS, 0, sizeof (fpregset_t),
- FP_REGS,
- sparc_fill_fpregset, sparc_store_fpregset },
- NULL_REGSET
+static struct regset_info sparc_regsets[]
+ = { { PTRACE_GETREGS, PTRACE_SETREGS, 0, sizeof (elf_gregset_t),
+ GENERAL_REGS, sparc_fill_gregset, sparc_store_gregset },
+ { PTRACE_GETFPREGS, PTRACE_SETFPREGS, 0, sizeof (fpregset_t), FP_REGS,
+ sparc_fill_fpregset, sparc_store_fpregset },
+ NULL_REGSET };
+
+static struct regsets_info sparc_regsets_info = {
+ sparc_regsets, /* regsets */
+ 0, /* num_regsets */
+ NULL, /* disabled_regsets */
};
-static struct regsets_info sparc_regsets_info =
- {
- sparc_regsets, /* regsets */
- 0, /* num_regsets */
- NULL, /* disabled_regsets */
- };
-
-static struct usrregs_info sparc_usrregs_info =
- {
- sparc_num_regs,
- /* No regmap needs to be provided since this impl. doesn't use
+static struct usrregs_info sparc_usrregs_info
+ = { sparc_num_regs,
+ /* No regmap needs to be provided since this impl. doesn't use
USRREGS. */
- NULL
- };
-
-static struct regs_info myregs_info =
- {
- NULL, /* regset_bitmap */
- &sparc_usrregs_info,
- &sparc_regsets_info
- };
+ NULL };
+
+static struct regs_info myregs_info
+ = { NULL, /* regset_bitmap */
+ &sparc_usrregs_info, &sparc_regsets_info };
const regs_info *
sparc_target::get_regs_info ()
diff --git a/gdbserver/linux-tic6x-low.cc b/gdbserver/linux-tic6x-low.cc
index 9f4682df33a..8a1ff3c4669 100644
--- a/gdbserver/linux-tic6x-low.cc
+++ b/gdbserver/linux-tic6x-low.cc
@@ -43,13 +43,11 @@
class tic6x_target : public linux_process_target
{
public:
-
const regs_info *get_regs_info () override;
const gdb_byte *sw_breakpoint_from_kind (int kind, int *size) override;
protected:
-
void low_arch_setup () override;
bool low_cannot_fetch_register (int regno) override;
@@ -93,109 +91,79 @@ union tic6x_register
#if __BYTE_ORDER == __BIG_ENDIAN
static int tic6x_regmap_c64xp[] = {
/* A0 - A15 */
- 53, 52, 55, 54, 57, 56, 59, 58,
- 61, 60, 63, 62, 65, 64, 67, 66,
+ 53, 52, 55, 54, 57, 56, 59, 58, 61, 60, 63, 62, 65, 64, 67, 66,
/* B0 - B15 */
- 23, 22, 25, 24, 27, 26, 29, 28,
- 31, 30, 33, 32, 35, 34, 69, 68,
+ 23, 22, 25, 24, 27, 26, 29, 28, 31, 30, 33, 32, 35, 34, 69, 68,
/* CSR PC */
5, 4,
/* A16 - A31 */
- 37, 36, 39, 38, 41, 40, 43, 42,
- 45, 44, 47, 46, 49, 48, 51, 50,
+ 37, 36, 39, 38, 41, 40, 43, 42, 45, 44, 47, 46, 49, 48, 51, 50,
/* B16 - B31 */
- 7, 6, 9, 8, 11, 10, 13, 12,
- 15, 14, 17, 16, 19, 18, 21, 20,
+ 7, 6, 9, 8, 11, 10, 13, 12, 15, 14, 17, 16, 19, 18, 21, 20,
/* TSR, ILC, RILC */
- 1, 2, 3
+ 1, 2, 3
};
static int tic6x_regmap_c64x[] = {
/* A0 - A15 */
- 51, 50, 53, 52, 55, 54, 57, 56,
- 59, 58, 61, 60, 63, 62, 65, 64,
+ 51, 50, 53, 52, 55, 54, 57, 56, 59, 58, 61, 60, 63, 62, 65, 64,
/* B0 - B15 */
- 21, 20, 23, 22, 25, 24, 27, 26,
- 29, 28, 31, 30, 33, 32, 67, 66,
+ 21, 20, 23, 22, 25, 24, 27, 26, 29, 28, 31, 30, 33, 32, 67, 66,
/* CSR PC */
- 3, 2,
+ 3, 2,
/* A16 - A31 */
- 35, 34, 37, 36, 39, 38, 41, 40,
- 43, 42, 45, 44, 47, 46, 49, 48,
+ 35, 34, 37, 36, 39, 38, 41, 40, 43, 42, 45, 44, 47, 46, 49, 48,
/* B16 - B31 */
- 5, 4, 7, 6, 9, 8, 11, 10,
- 13, 12, 15, 14, 17, 16, 19, 18,
- -1, -1, -1
+ 5, 4, 7, 6, 9, 8, 11, 10, 13, 12, 15, 14, 17, 16, 19, 18, -1, -1, -1
};
static int tic6x_regmap_c62x[] = {
/* A0 - A15 */
- 19, 18, 21, 20, 23, 22, 25, 24,
- 27, 26, 29, 28, 31, 30, 33, 32,
+ 19, 18, 21, 20, 23, 22, 25, 24, 27, 26, 29, 28, 31, 30, 33, 32,
/* B0 - B15 */
- 5, 4, 7, 6, 9, 8, 11, 10,
- 13, 12, 15, 14, 17, 16, 35, 34,
+ 5, 4, 7, 6, 9, 8, 11, 10, 13, 12, 15, 14, 17, 16, 35, 34,
/* CSR, PC */
- 3, 2,
- -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1
+ 3, 2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1
};
#else
static int tic6x_regmap_c64xp[] = {
/* A0 - A15 */
- 52, 53, 54, 55, 56, 57, 58, 59,
- 60, 61, 62, 63, 64, 65, 66, 67,
+ 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67,
/* B0 - B15 */
- 22, 23, 24, 25, 26, 27, 28, 29,
- 30, 31, 32, 33, 34, 35, 68, 69,
+ 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 68, 69,
/* CSR PC */
- 4, 5,
+ 4, 5,
/* A16 - A31 */
- 36, 37, 38, 39, 40, 41, 42, 43,
- 44, 45, 46, 47, 48, 49, 50, 51,
+ 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51,
/* B16 -B31 */
- 6, 7, 8, 9, 10, 11, 12, 13,
- 14, 15, 16, 17, 18, 19, 20, 31,
+ 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 31,
/* TSR, ILC, RILC */
- 0, 3, 2
+ 0, 3, 2
};
static int tic6x_regmap_c64x[] = {
/* A0 - A15 */
- 50, 51, 52, 53, 54, 55, 56, 57,
- 58, 59, 60, 61, 62, 63, 64, 65,
+ 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65,
/* B0 - B15 */
- 20, 21, 22, 23, 24, 25, 26, 27,
- 28, 29, 30, 31, 32, 33, 66, 67,
+ 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 66, 67,
/* CSR PC */
- 2, 3,
+ 2, 3,
/* A16 - A31 */
- 34, 35, 36, 37, 38, 39, 40, 41,
- 42, 43, 44, 45, 46, 47, 48, 49,
+ 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49,
/* B16 - B31 */
- 4, 5, 6, 7, 8, 9, 10, 11,
- 12, 13, 14, 15, 16, 17, 18, 19,
- -1, -1, -1
+ 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, -1, -1, -1
};
static int tic6x_regmap_c62x[] = {
/* A0 - A15 */
- 18, 19, 20, 21, 22, 23, 24, 25,
- 26, 27, 28, 29, 30, 31, 32, 33,
+ 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33,
/* B0 - B15 */
- 4, 5, 6, 7, 8, 9, 10, 11,
- 12, 13, 14, 15, 16, 17, 34, 35,
+ 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 34, 35,
/* CSR PC */
- 2, 3,
- -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1
+ 2, 3, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1
};
#endif
@@ -213,16 +181,14 @@ tic6x_target::sw_breakpoint_from_kind (int kind, int *size)
return (const gdb_byte *) &tic6x_breakpoint;
}
-static struct usrregs_info tic6x_usrregs_info =
- {
- TIC6X_NUM_REGS,
- NULL, /* Set in tic6x_read_description. */
- };
+static struct usrregs_info tic6x_usrregs_info = {
+ TIC6X_NUM_REGS, NULL, /* Set in tic6x_read_description. */
+};
static const struct target_desc *
tic6x_read_description (enum c6x_feature feature)
{
- static target_desc *tdescs[C6X_LAST] = { };
+ static target_desc *tdescs[C6X_LAST] = {};
struct target_desc **tdesc = &tdescs[feature];
if (*tdesc == NULL)
@@ -288,8 +254,8 @@ tic6x_target::low_breakpoint_at (CORE_ADDR where)
/* Fetch the thread-local storage pointer for libthread_db. */
ps_err_e
-ps_get_thread_area (struct ps_prochandle *ph,
- lwpid_t lwpid, int idx, void **base)
+ps_get_thread_area (struct ps_prochandle *ph, lwpid_t lwpid, int idx,
+ void **base)
{
if (ptrace (PTRACE_GET_THREAD_AREA, lwpid, NULL, base) != 0)
return PS_ERR;
@@ -304,7 +270,7 @@ ps_get_thread_area (struct ps_prochandle *ph,
static void
tic6x_collect_register (struct regcache *regcache, int regno,
- union tic6x_register *reg)
+ union tic6x_register *reg)
{
union tic6x_register tmp_reg;
@@ -314,7 +280,7 @@ tic6x_collect_register (struct regcache *regcache, int regno,
static void
tic6x_supply_register (struct regcache *regcache, int regno,
- const union tic6x_register *reg)
+ const union tic6x_register *reg)
{
int offset = 0;
@@ -343,11 +309,10 @@ tic6x_store_gregset (struct regcache *regcache, const void *buf)
tic6x_supply_register (regcache, i, regset + tic6x_regmap[i]);
}
-static struct regset_info tic6x_regsets[] = {
- { PTRACE_GETREGS, PTRACE_SETREGS, 0, TIC6X_NUM_REGS * 4, GENERAL_REGS,
- tic6x_fill_gregset, tic6x_store_gregset },
- NULL_REGSET
-};
+static struct regset_info tic6x_regsets[]
+ = { { PTRACE_GETREGS, PTRACE_SETREGS, 0, TIC6X_NUM_REGS * 4, GENERAL_REGS,
+ tic6x_fill_gregset, tic6x_store_gregset },
+ NULL_REGSET };
void
tic6x_target::low_arch_setup ()
@@ -357,31 +322,31 @@ tic6x_target::low_arch_setup ()
enum c6x_feature feature = C6X_CORE;
/* Determine the CPU we're running on to find the register order. */
- __asm__ ("MVC .S2 CSR,%0" : "=r" (csr) :);
+ __asm__ ("MVC .S2 CSR,%0" : "=r"(csr) :);
cpuid = csr >> 24;
switch (cpuid)
{
case 0x00: /* C62x */
case 0x02: /* C67x */
tic6x_regmap = tic6x_regmap_c62x;
- tic6x_breakpoint = 0x0000a122; /* BNOP .S2 0,5 */
+ tic6x_breakpoint = 0x0000a122; /* BNOP .S2 0,5 */
feature = C6X_CORE;
break;
case 0x03: /* C67x+ */
tic6x_regmap = tic6x_regmap_c64x;
- tic6x_breakpoint = 0x0000a122; /* BNOP .S2 0,5 */
+ tic6x_breakpoint = 0x0000a122; /* BNOP .S2 0,5 */
feature = C6X_GP;
break;
case 0x0c: /* C64x */
tic6x_regmap = tic6x_regmap_c64x;
- tic6x_breakpoint = 0x0000a122; /* BNOP .S2 0,5 */
+ tic6x_breakpoint = 0x0000a122; /* BNOP .S2 0,5 */
feature = C6X_GP;
break;
case 0x10: /* C64x+ */
case 0x14: /* C674x */
case 0x15: /* C66x */
tic6x_regmap = tic6x_regmap_c64xp;
- tic6x_breakpoint = 0x56454314; /* illegal opcode */
+ tic6x_breakpoint = 0x56454314; /* illegal opcode */
feature = C6X_C6XP;
break;
default:
@@ -392,19 +357,15 @@ tic6x_target::low_arch_setup ()
current_process ()->tdesc = tic6x_read_description (feature);
}
-static struct regsets_info tic6x_regsets_info =
- {
- tic6x_regsets, /* regsets */
- 0, /* num_regsets */
- NULL, /* disabled_regsets */
- };
+static struct regsets_info tic6x_regsets_info = {
+ tic6x_regsets, /* regsets */
+ 0, /* num_regsets */
+ NULL, /* disabled_regsets */
+};
-static struct regs_info myregs_info =
- {
- NULL, /* regset_bitmap */
- &tic6x_usrregs_info,
- &tic6x_regsets_info
- };
+static struct regs_info myregs_info
+ = { NULL, /* regset_bitmap */
+ &tic6x_usrregs_info, &tic6x_regsets_info };
const regs_info *
tic6x_target::get_regs_info ()
@@ -415,8 +376,10 @@ tic6x_target::get_regs_info ()
#if GDB_SELF_TEST
#include "gdbsupport/selftest.h"
-namespace selftests {
-namespace tdesc {
+namespace selftests
+{
+namespace tdesc
+{
static void
tic6x_tdesc_test ()
{
@@ -424,8 +387,8 @@ tic6x_tdesc_test ()
SELF_CHECK (*tdesc_tic6x_c64x_linux == *tic6x_read_description (C6X_GP));
SELF_CHECK (*tdesc_tic6x_c64xp_linux == *tic6x_read_description (C6X_C6XP));
}
-}
-}
+} // namespace tdesc
+} // namespace selftests
#endif
/* The linux target ops object. */
diff --git a/gdbserver/linux-x86-low.cc b/gdbserver/linux-x86-low.cc
index 4a538b107be..0732f9dd58d 100644
--- a/gdbserver/linux-x86-low.cc
+++ b/gdbserver/linux-x86-low.cc
@@ -52,7 +52,6 @@ static target_desc_up tdesc_amd64_linux_no_xml;
#endif
static target_desc_up tdesc_i386_linux_no_xml;
-
static unsigned char jump_insn[] = { 0xe9, 0, 0, 0, 0 };
static unsigned char small_jump_insn[] = { 0x66, 0xe9, 0, 0 };
@@ -80,7 +79,7 @@ static const char xmltarget_amd64_linux_no_xml[] = "@<target>\
/* This definition comes from prctl.h, but some kernels may not have it. */
#ifndef PTRACE_ARCH_PRCTL
-#define PTRACE_ARCH_PRCTL 30
+#define PTRACE_ARCH_PRCTL 30
#endif
/* The following definitions come from prctl.h, but may be absent
@@ -99,26 +98,26 @@ static const char xmltarget_amd64_linux_no_xml[] = "@<target>\
class x86_target : public linux_process_target
{
public:
-
const regs_info *get_regs_info () override;
const gdb_byte *sw_breakpoint_from_kind (int kind, int *size) override;
bool supports_z_point_type (char z_type) override;
- void process_qsupported (gdb::array_view<const char * const> features) override;
+ void
+ process_qsupported (gdb::array_view<const char *const> features) override;
bool supports_tracepoints () override;
bool supports_fast_tracepoints () override;
- int install_fast_tracepoint_jump_pad
- (CORE_ADDR tpoint, CORE_ADDR tpaddr, CORE_ADDR collector,
- CORE_ADDR lockaddr, ULONGEST orig_size, CORE_ADDR *jump_entry,
- CORE_ADDR *trampoline, ULONGEST *trampoline_size,
- unsigned char *jjump_pad_insn, ULONGEST *jjump_pad_insn_size,
- CORE_ADDR *adjusted_insn_addr, CORE_ADDR *adjusted_insn_addr_end,
- char *err) override;
+ int install_fast_tracepoint_jump_pad (
+ CORE_ADDR tpoint, CORE_ADDR tpaddr, CORE_ADDR collector,
+ CORE_ADDR lockaddr, ULONGEST orig_size, CORE_ADDR *jump_entry,
+ CORE_ADDR *trampoline, ULONGEST *trampoline_size,
+ unsigned char *jjump_pad_insn, ULONGEST *jjump_pad_insn_size,
+ CORE_ADDR *adjusted_insn_addr, CORE_ADDR *adjusted_insn_addr_end,
+ char *err) override;
int get_min_fast_tracepoint_insn_len () override;
@@ -127,7 +126,6 @@ public:
int get_ipa_tdesc_idx () override;
protected:
-
void low_arch_setup () override;
bool low_cannot_fetch_register (int regno) override;
@@ -144,11 +142,11 @@ protected:
bool low_breakpoint_at (CORE_ADDR pc) override;
- int low_insert_point (raw_bkpt_type type, CORE_ADDR addr,
- int size, raw_breakpoint *bp) override;
+ int low_insert_point (raw_bkpt_type type, CORE_ADDR addr, int size,
+ raw_breakpoint *bp) override;
- int low_remove_point (raw_bkpt_type type, CORE_ADDR addr,
- int size, raw_breakpoint *bp) override;
+ int low_remove_point (raw_bkpt_type type, CORE_ADDR addr, int size,
+ raw_breakpoint *bp) override;
bool low_stopped_by_watchpoint () override;
@@ -160,7 +158,7 @@ protected:
/* Need to fix up i386 siginfo if host is amd64. */
bool low_siginfo_fixup (siginfo_t *native, gdb_byte *inf,
- int direction) override;
+ int direction) override;
arch_process_info *low_new_process () override;
@@ -183,7 +181,6 @@ protected:
void low_get_syscall_trapinfo (regcache *regcache, int *sysno) override;
private:
-
/* Update all the target description of all processes; a new GDB
connected, and it may or not support xml target descriptions. */
void update_xmltarget ();
@@ -205,13 +202,10 @@ struct arch_process_info
/* Mapping between the general-purpose registers in `struct user'
format and GDB's register array layout.
Note that the transfer layout uses 64-bit regs. */
-static /*const*/ int i386_regmap[] =
-{
- RAX * 8, RCX * 8, RDX * 8, RBX * 8,
- RSP * 8, RBP * 8, RSI * 8, RDI * 8,
- RIP * 8, EFLAGS * 8, CS * 8, SS * 8,
- DS * 8, ES * 8, FS * 8, GS * 8
-};
+static /*const*/ int i386_regmap[]
+ = { RAX * 8, RCX * 8, RDX * 8, RBX * 8, RSP * 8, RBP * 8,
+ RSI * 8, RDI * 8, RIP * 8, EFLAGS * 8, CS * 8, SS * 8,
+ DS * 8, ES * 8, FS * 8, GS * 8 };
#define I386_NUM_REGS (sizeof (i386_regmap) / sizeof (i386_regmap[0]))
@@ -219,33 +213,32 @@ static /*const*/ int i386_regmap[] =
#define ORIG_EAX ORIG_RAX
#define REGSIZE 8
-static const int x86_64_regmap[] =
-{
- RAX * 8, RBX * 8, RCX * 8, RDX * 8,
- RSI * 8, RDI * 8, RBP * 8, RSP * 8,
- R8 * 8, R9 * 8, R10 * 8, R11 * 8,
- R12 * 8, R13 * 8, R14 * 8, R15 * 8,
- RIP * 8, EFLAGS * 8, CS * 8, SS * 8,
- DS * 8, ES * 8, FS * 8, GS * 8,
- -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1,
- -1,
- -1, -1, -1, -1, -1, -1, -1, -1,
- ORIG_RAX * 8,
- 21 * 8, 22 * 8,
- -1, -1, -1, -1, /* MPX registers BND0 ... BND3. */
- -1, -1, /* MPX registers BNDCFGU, BNDSTATUS. */
- -1, -1, -1, -1, -1, -1, -1, -1, /* xmm16 ... xmm31 (AVX512) */
- -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, /* ymm16 ... ymm31 (AVX512) */
- -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, /* k0 ... k7 (AVX512) */
- -1, -1, -1, -1, -1, -1, -1, -1, /* zmm0 ... zmm31 (AVX512) */
- -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1,
- -1 /* pkru */
+static const int x86_64_regmap[] = {
+ RAX * 8, RBX * 8, RCX * 8, RDX * 8, RSI * 8, RDI * 8, RBP * 8,
+ RSP * 8, R8 * 8, R9 * 8, R10 * 8, R11 * 8, R12 * 8, R13 * 8,
+ R14 * 8, R15 * 8, RIP * 8, EFLAGS * 8, CS * 8, SS * 8, DS * 8,
+ ES * 8, FS * 8, GS * 8, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1,
+ -1, ORIG_RAX * 8, 21 * 8, 22 * 8, -1, -1, -1,
+ -1, /* MPX registers BND0 ... BND3. */
+ -1, -1, /* MPX registers BNDCFGU, BNDSTATUS. */
+ -1, -1, -1, -1, -1, -1, -1,
+ -1, /* xmm16 ... xmm31 (AVX512) */
+ -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, /* ymm16 ... ymm31 (AVX512) */
+ -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, /* k0 ... k7 (AVX512) */
+ -1, -1, -1, -1, -1, -1, -1,
+ -1, /* zmm0 ... zmm31 (AVX512) */
+ -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1 /* pkru */
};
#define X86_64_NUM_REGS (sizeof (x86_64_regmap) / sizeof (x86_64_regmap[0]))
@@ -255,13 +248,9 @@ static const int x86_64_regmap[] =
/* Mapping between the general-purpose registers in `struct user'
format and GDB's register array layout. */
-static /*const*/ int i386_regmap[] =
-{
- EAX * 4, ECX * 4, EDX * 4, EBX * 4,
- UESP * 4, EBP * 4, ESI * 4, EDI * 4,
- EIP * 4, EFL * 4, CS * 4, SS * 4,
- DS * 4, ES * 4, FS * 4, GS * 4
-};
+static /*const*/ int i386_regmap[]
+ = { EAX * 4, ECX * 4, EDX * 4, EBX * 4, UESP * 4, EBP * 4, ESI * 4, EDI * 4,
+ EIP * 4, EFL * 4, CS * 4, SS * 4, DS * 4, ES * 4, FS * 4, GS * 4 };
#define I386_NUM_REGS (sizeof (i386_regmap) / sizeof (i386_regmap[0]))
@@ -283,12 +272,11 @@ is_64bit_tdesc (thread_info *thread)
#endif
-
/* Called by libthread_db. */
ps_err_e
-ps_get_thread_area (struct ps_prochandle *ph,
- lwpid_t lwpid, int idx, void **base)
+ps_get_thread_area (struct ps_prochandle *ph, lwpid_t lwpid, int idx,
+ void **base)
{
#ifdef __x86_64__
lwp_info *lwp = find_lwp_pid (ptid_t (lwpid));
@@ -298,18 +286,18 @@ ps_get_thread_area (struct ps_prochandle *ph,
if (use_64bit)
{
switch (idx)
- {
- case FS:
- if (ptrace (PTRACE_ARCH_PRCTL, lwpid, base, ARCH_GET_FS) == 0)
- return PS_OK;
- break;
- case GS:
- if (ptrace (PTRACE_ARCH_PRCTL, lwpid, base, ARCH_GET_GS) == 0)
- return PS_OK;
- break;
- default:
- return PS_BADADDR;
- }
+ {
+ case FS:
+ if (ptrace (PTRACE_ARCH_PRCTL, lwpid, base, ARCH_GET_FS) == 0)
+ return PS_OK;
+ break;
+ case GS:
+ if (ptrace (PTRACE_ARCH_PRCTL, lwpid, base, ARCH_GET_GS) == 0)
+ return PS_OK;
+ break;
+ default:
+ return PS_BADADDR;
+ }
return PS_ERR;
}
#endif
@@ -317,8 +305,9 @@ ps_get_thread_area (struct ps_prochandle *ph,
{
unsigned int desc[4];
- if (ptrace (PTRACE_GET_THREAD_AREA, lwpid,
- (void *) (intptr_t) idx, (unsigned long) &desc) < 0)
+ if (ptrace (PTRACE_GET_THREAD_AREA, lwpid, (void *) (intptr_t) idx,
+ (unsigned long) &desc)
+ < 0)
return PS_ERR;
/* Ensure we properly extend the value to 64-bits for x86_64. */
@@ -344,10 +333,10 @@ x86_target::low_get_thread_area (int lwpid, CORE_ADDR *addr)
{
void *base;
if (ptrace (PTRACE_ARCH_PRCTL, lwpid, &base, ARCH_GET_FS) == 0)
- {
- *addr = (CORE_ADDR) (uintptr_t) base;
- return 0;
- }
+ {
+ *addr = (CORE_ADDR) (uintptr_t) base;
+ return 0;
+ }
return -1;
}
@@ -365,9 +354,9 @@ x86_target::low_get_thread_area (int lwpid, CORE_ADDR *addr)
idx = gs >> reg_thread_area;
- if (ptrace (PTRACE_GET_THREAD_AREA,
- lwpid_of (thr),
- (void *) (long) idx, (unsigned long) &desc) < 0)
+ if (ptrace (PTRACE_GET_THREAD_AREA, lwpid_of (thr), (void *) (long) idx,
+ (unsigned long) &desc)
+ < 0)
return -1;
*addr = desc[1];
@@ -375,8 +364,6 @@ x86_target::low_get_thread_area (int lwpid, CORE_ADDR *addr)
}
}
-
-
bool
x86_target::low_cannot_store_register (int regno)
{
@@ -437,8 +424,8 @@ x86_fill_gregset (struct regcache *regcache, void *buf)
if (register_size (regcache->tdesc, 0) == 8)
{
for (i = 0; i < X86_64_NUM_REGS; i++)
- if (x86_64_regmap[i] != -1)
- collect_register (regcache, i, ((char *) buf) + x86_64_regmap[i]);
+ if (x86_64_regmap[i] != -1)
+ collect_register (regcache, i, ((char *) buf) + x86_64_regmap[i]);
return;
}
@@ -449,7 +436,7 @@ x86_fill_gregset (struct regcache *regcache, void *buf)
/* Handle ORIG_EAX, which is not in i386_regmap. */
collect_register_i386 (regcache, find_regno (regcache->tdesc, "orig_eax"),
- ((char *) buf) + ORIG_EAX * REGSIZE);
+ ((char *) buf) + ORIG_EAX * REGSIZE);
}
static void
@@ -461,8 +448,8 @@ x86_store_gregset (struct regcache *regcache, const void *buf)
if (register_size (regcache->tdesc, 0) == 8)
{
for (i = 0; i < X86_64_NUM_REGS; i++)
- if (x86_64_regmap[i] != -1)
- supply_register (regcache, i, ((char *) buf) + x86_64_regmap[i]);
+ if (x86_64_regmap[i] != -1)
+ supply_register (regcache, i, ((char *) buf) + x86_64_regmap[i]);
return;
}
@@ -472,7 +459,7 @@ x86_store_gregset (struct regcache *regcache, const void *buf)
supply_register (regcache, i, ((char *) buf) + i386_regmap[i]);
supply_register_by_name (regcache, "orig_eax",
- ((char *) buf) + ORIG_EAX * REGSIZE);
+ ((char *) buf) + ORIG_EAX * REGSIZE);
}
static void
@@ -530,23 +517,19 @@ x86_store_xstateregset (struct regcache *regcache, const void *buf)
does work. Maybe the arch_setup routine could check whether it works
and update the supported regsets accordingly. */
-static struct regset_info x86_regsets[] =
-{
+static struct regset_info x86_regsets[] = {
#ifdef HAVE_PTRACE_GETREGS
- { PTRACE_GETREGS, PTRACE_SETREGS, 0, sizeof (elf_gregset_t),
- GENERAL_REGS,
+ { PTRACE_GETREGS, PTRACE_SETREGS, 0, sizeof (elf_gregset_t), GENERAL_REGS,
x86_fill_gregset, x86_store_gregset },
- { PTRACE_GETREGSET, PTRACE_SETREGSET, NT_X86_XSTATE, 0,
- EXTENDED_REGS, x86_fill_xstateregset, x86_store_xstateregset },
-# ifndef __x86_64__
-# ifdef HAVE_PTRACE_GETFPXREGS
+ { PTRACE_GETREGSET, PTRACE_SETREGSET, NT_X86_XSTATE, 0, EXTENDED_REGS,
+ x86_fill_xstateregset, x86_store_xstateregset },
+#ifndef __x86_64__
+#ifdef HAVE_PTRACE_GETFPXREGS
{ PTRACE_GETFPXREGS, PTRACE_SETFPXREGS, 0, sizeof (elf_fpxregset_t),
- EXTENDED_REGS,
- x86_fill_fpxregset, x86_store_fpxregset },
-# endif
-# endif
- { PTRACE_GETFPREGS, PTRACE_SETFPREGS, 0, sizeof (elf_fpregset_t),
- FP_REGS,
+ EXTENDED_REGS, x86_fill_fpxregset, x86_store_fpxregset },
+#endif
+#endif
+ { PTRACE_GETFPREGS, PTRACE_SETFPREGS, 0, sizeof (elf_fpregset_t), FP_REGS,
x86_fill_fpregset, x86_store_fpregset },
#endif /* HAVE_PTRACE_GETREGS */
NULL_REGSET
@@ -604,7 +587,6 @@ x86_target::low_decr_pc_after_break ()
return 1;
}
-
static const gdb_byte x86_breakpoint[] = { 0xCC };
#define x86_breakpoint_len 1
@@ -619,18 +601,13 @@ x86_target::low_breakpoint_at (CORE_ADDR pc)
return false;
}
-
+
/* Low-level function vector. */
-struct x86_dr_low_type x86_dr_low =
- {
- x86_linux_dr_set_control,
- x86_linux_dr_set_addr,
- x86_linux_dr_get_addr,
- x86_linux_dr_get_status,
- x86_linux_dr_get_control,
- sizeof (void *),
- };
-
+struct x86_dr_low_type x86_dr_low = {
+ x86_linux_dr_set_control, x86_linux_dr_set_addr, x86_linux_dr_get_addr,
+ x86_linux_dr_get_status, x86_linux_dr_get_control, sizeof (void *),
+};
+
/* Breakpoint/Watchpoint support. */
bool
@@ -649,8 +626,8 @@ x86_target::supports_z_point_type (char z_type)
}
int
-x86_target::low_insert_point (raw_bkpt_type type, CORE_ADDR addr,
- int size, raw_breakpoint *bp)
+x86_target::low_insert_point (raw_bkpt_type type, CORE_ADDR addr, int size,
+ raw_breakpoint *bp)
{
struct process_info *proc = current_process ();
@@ -660,12 +637,12 @@ x86_target::low_insert_point (raw_bkpt_type type, CORE_ADDR addr,
case raw_bkpt_type_write_wp:
case raw_bkpt_type_access_wp:
{
- enum target_hw_bp_type hw_type
- = raw_bkpt_type_to_target_hw_bp_type (type);
- struct x86_debug_reg_state *state
- = &proc->priv->arch_private->debug_reg_state;
+ enum target_hw_bp_type hw_type
+ = raw_bkpt_type_to_target_hw_bp_type (type);
+ struct x86_debug_reg_state *state
+ = &proc->priv->arch_private->debug_reg_state;
- return x86_dr_insert_watchpoint (state, hw_type, addr, size);
+ return x86_dr_insert_watchpoint (state, hw_type, addr, size);
}
default:
@@ -675,8 +652,8 @@ x86_target::low_insert_point (raw_bkpt_type type, CORE_ADDR addr,
}
int
-x86_target::low_remove_point (raw_bkpt_type type, CORE_ADDR addr,
- int size, raw_breakpoint *bp)
+x86_target::low_remove_point (raw_bkpt_type type, CORE_ADDR addr, int size,
+ raw_breakpoint *bp)
{
struct process_info *proc = current_process ();
@@ -686,12 +663,12 @@ x86_target::low_remove_point (raw_bkpt_type type, CORE_ADDR addr,
case raw_bkpt_type_write_wp:
case raw_bkpt_type_access_wp:
{
- enum target_hw_bp_type hw_type
- = raw_bkpt_type_to_target_hw_bp_type (type);
- struct x86_debug_reg_state *state
- = &proc->priv->arch_private->debug_reg_state;
+ enum target_hw_bp_type hw_type
+ = raw_bkpt_type_to_target_hw_bp_type (type);
+ struct x86_debug_reg_state *state
+ = &proc->priv->arch_private->debug_reg_state;
- return x86_dr_remove_watchpoint (state, hw_type, addr, size);
+ return x86_dr_remove_watchpoint (state, hw_type, addr, size);
}
default:
/* Unsupported. */
@@ -703,7 +680,8 @@ bool
x86_target::low_stopped_by_watchpoint ()
{
struct process_info *proc = current_process ();
- return x86_dr_stopped_by_watchpoint (&proc->priv->arch_private->debug_reg_state);
+ return x86_dr_stopped_by_watchpoint (
+ &proc->priv->arch_private->debug_reg_state);
}
CORE_ADDR
@@ -712,11 +690,11 @@ x86_target::low_stopped_data_address ()
struct process_info *proc = current_process ();
CORE_ADDR addr;
if (x86_dr_stopped_data_address (&proc->priv->arch_private->debug_reg_state,
- &addr))
+ &addr))
return addr;
return 0;
}
-
+
/* Called when a new process is created. */
arch_process_info *
@@ -757,10 +735,8 @@ void
x86_target::low_new_fork (process_info *parent, process_info *child)
{
/* These are allocated by linux_add_process. */
- gdb_assert (parent->priv != NULL
- && parent->priv->arch_private != NULL);
- gdb_assert (child->priv != NULL
- && child->priv->arch_private != NULL);
+ gdb_assert (parent->priv != NULL && parent->priv->arch_private != NULL);
+ gdb_assert (child->priv != NULL && child->priv->arch_private != NULL);
/* Linux kernel before 2.6.33 commit
72f674d203cd230426437cdcf7dd6f681dad8b0d
@@ -795,7 +771,7 @@ x86_debug_reg_state (pid_t pid)
return &proc->priv->arch_private->debug_reg_state;
}
-
+
/* When GDBSERVER is built as a 64-bit application on linux, the
PTRACE_GETSIGINFO data is always presented in 64-bit layout. Since
debugging a 32-bit inferior with a 64-bit GDBSERVER should look the same
@@ -818,17 +794,16 @@ x86_target::low_siginfo_fixup (siginfo_t *ptrace, gdb_byte *inf, int direction)
/* Is the inferior 32-bit? If so, then fixup the siginfo object. */
if (!is_64bit_tdesc (current_thread))
- return amd64_linux_siginfo_fixup_common (ptrace, inf, direction,
- FIXUP_32);
+ return amd64_linux_siginfo_fixup_common (ptrace, inf, direction, FIXUP_32);
/* No fixup for native x32 GDB. */
else if (!is_elf64 && sizeof (void *) == 8)
return amd64_linux_siginfo_fixup_common (ptrace, inf, direction,
- FIXUP_X32);
+ FIXUP_X32);
#endif
return false;
}
-
+
static int use_xml;
/* Format of XSAVE extended state is:
@@ -861,7 +836,7 @@ int have_ptrace_getfpxregs =
#else
0
#endif
-;
+ ;
/* Get Linux/x86 target description from running target. */
@@ -882,10 +857,10 @@ x86_linux_read_description (void)
if (sizeof (void *) == 4)
{
if (is_elf64 > 0)
- error (_("Can't debug 64-bit process with 32-bit GDBserver"));
+ error (_ ("Can't debug 64-bit process with 32-bit GDBserver"));
#ifndef __x86_64__
else if (machine == EM_X86_64)
- error (_("Can't debug x86-64 process with 32-bit GDBserver"));
+ error (_ ("Can't debug x86-64 process with 32-bit GDBserver"));
#endif
}
@@ -895,13 +870,13 @@ x86_linux_read_description (void)
elf_fpxregset_t fpxregs;
if (ptrace (PTRACE_GETFPXREGS, tid, 0, (long) &fpxregs) < 0)
- {
- have_ptrace_getfpxregs = 0;
- have_ptrace_getregset = 0;
- return i386_linux_read_description (X86_XSTATE_X87);
- }
+ {
+ have_ptrace_getfpxregs = 0;
+ have_ptrace_getregset = 0;
+ return i386_linux_read_description (X86_XSTATE_X87);
+ }
else
- have_ptrace_getfpxregs = 1;
+ have_ptrace_getfpxregs = 1;
}
#endif
@@ -912,10 +887,10 @@ x86_linux_read_description (void)
/* Don't use XML. */
#ifdef __x86_64__
if (machine == EM_X86_64)
- return tdesc_amd64_linux_no_xml.get ();
+ return tdesc_amd64_linux_no_xml.get ();
else
#endif
- return tdesc_i386_linux_no_xml.get ();
+ return tdesc_i386_linux_no_xml.get ();
}
if (have_ptrace_getregset == -1)
@@ -927,30 +902,29 @@ x86_linux_read_description (void)
iov.iov_len = sizeof (xstateregs);
/* Check if PTRACE_GETREGSET works. */
- if (ptrace (PTRACE_GETREGSET, tid,
- (unsigned int) NT_X86_XSTATE, (long) &iov) < 0)
- have_ptrace_getregset = 0;
+ if (ptrace (PTRACE_GETREGSET, tid, (unsigned int) NT_X86_XSTATE,
+ (long) &iov)
+ < 0)
+ have_ptrace_getregset = 0;
else
- {
- have_ptrace_getregset = 1;
-
- /* Get XCR0 from XSAVE extended state. */
- xcr0 = xstateregs[(I386_LINUX_XSAVE_XCR0_OFFSET
- / sizeof (uint64_t))];
-
- /* Use PTRACE_GETREGSET if it is available. */
- for (regset = x86_regsets;
- regset->fill_function != NULL; regset++)
- if (regset->get_request == PTRACE_GETREGSET)
- regset->size = X86_XSTATE_SIZE (xcr0);
- else if (regset->type != GENERAL_REGS)
- regset->size = 0;
- }
+ {
+ have_ptrace_getregset = 1;
+
+ /* Get XCR0 from XSAVE extended state. */
+ xcr0
+ = xstateregs[(I386_LINUX_XSAVE_XCR0_OFFSET / sizeof (uint64_t))];
+
+ /* Use PTRACE_GETREGSET if it is available. */
+ for (regset = x86_regsets; regset->fill_function != NULL; regset++)
+ if (regset->get_request == PTRACE_GETREGSET)
+ regset->size = X86_XSTATE_SIZE (xcr0);
+ else if (regset->type != GENERAL_REGS)
+ regset->size = 0;
+ }
}
/* Check the native XCR0 only if PTRACE_GETREGSET is available. */
- xcr0_features = (have_ptrace_getregset
- && (xcr0 & X86_XSTATE_ALL_MASK));
+ xcr0_features = (have_ptrace_getregset && (xcr0 & X86_XSTATE_ALL_MASK));
if (xcr0_features)
x86_xcr0 = xcr0;
@@ -961,13 +935,13 @@ x86_linux_read_description (void)
const target_desc *tdesc = NULL;
if (xcr0_features)
- {
- tdesc = amd64_linux_read_description (xcr0 & X86_XSTATE_ALL_MASK,
- !is_elf64);
- }
+ {
+ tdesc = amd64_linux_read_description (xcr0 & X86_XSTATE_ALL_MASK,
+ !is_elf64);
+ }
if (tdesc == NULL)
- tdesc = amd64_linux_read_description (X86_XSTATE_SSE_MASK, !is_elf64);
+ tdesc = amd64_linux_read_description (X86_XSTATE_SSE_MASK, !is_elf64);
return tdesc;
#endif
}
@@ -976,10 +950,10 @@ x86_linux_read_description (void)
const target_desc *tdesc = NULL;
if (xcr0_features)
- tdesc = i386_linux_read_description (xcr0 & X86_XSTATE_ALL_MASK);
+ tdesc = i386_linux_read_description (xcr0 & X86_XSTATE_ALL_MASK);
if (tdesc == NULL)
- tdesc = i386_linux_read_description (X86_XSTATE_SSE);
+ tdesc = i386_linux_read_description (X86_XSTATE_SSE);
return tdesc;
}
@@ -1014,7 +988,7 @@ x86_target::update_xmltarget ()
PTRACE_GETREGSET. */
void
-x86_target::process_qsupported (gdb::array_view<const char * const> features)
+x86_target::process_qsupported (gdb::array_view<const char *const> features)
{
/* Return if gdb doesn't support XML. If gdb sends "xmlRegisters="
with "i386" in qSupported query, it supports x86 XML target
@@ -1024,23 +998,22 @@ x86_target::process_qsupported (gdb::array_view<const char * const> features)
for (const char *feature : features)
{
if (startswith (feature, "xmlRegisters="))
- {
- char *copy = xstrdup (feature + 13);
-
- char *saveptr;
- for (char *p = strtok_r (copy, ",", &saveptr);
- p != NULL;
- p = strtok_r (NULL, ",", &saveptr))
- {
- if (strcmp (p, "i386") == 0)
- {
- use_xml = 1;
- break;
- }
- }
-
- free (copy);
- }
+ {
+ char *copy = xstrdup (feature + 13);
+
+ char *saveptr;
+ for (char *p = strtok_r (copy, ",", &saveptr); p != NULL;
+ p = strtok_r (NULL, ",", &saveptr))
+ {
+ if (strcmp (p, "i386") == 0)
+ {
+ use_xml = 1;
+ break;
+ }
+ }
+
+ free (copy);
+ }
}
update_xmltarget ();
@@ -1048,33 +1021,25 @@ x86_target::process_qsupported (gdb::array_view<const char * const> features)
/* Common for x86/x86-64. */
-static struct regsets_info x86_regsets_info =
- {
- x86_regsets, /* regsets */
- 0, /* num_regsets */
- NULL, /* disabled_regsets */
- };
+static struct regsets_info x86_regsets_info = {
+ x86_regsets, /* regsets */
+ 0, /* num_regsets */
+ NULL, /* disabled_regsets */
+};
#ifdef __x86_64__
-static struct regs_info amd64_linux_regs_info =
- {
- NULL, /* regset_bitmap */
- NULL, /* usrregs_info */
- &x86_regsets_info
- };
+static struct regs_info amd64_linux_regs_info = { NULL, /* regset_bitmap */
+ NULL, /* usrregs_info */
+ &x86_regsets_info };
#endif
-static struct usrregs_info i386_linux_usrregs_info =
- {
- I386_NUM_REGS,
- i386_regmap,
- };
+static struct usrregs_info i386_linux_usrregs_info = {
+ I386_NUM_REGS,
+ i386_regmap,
+};
-static struct regs_info i386_linux_regs_info =
- {
- NULL, /* regset_bitmap */
- &i386_linux_usrregs_info,
- &x86_regsets_info
- };
+static struct regs_info i386_linux_regs_info
+ = { NULL, /* regset_bitmap */
+ &i386_linux_usrregs_info, &x86_regsets_info };
const regs_info *
x86_target::get_regs_info ()
@@ -1145,7 +1110,7 @@ push_opcode (unsigned char *buf, const char *op)
unsigned long ul = strtoul (op, &endptr, 16);
if (endptr == op)
- break;
+ break;
*buf++ = ul;
op = endptr;
@@ -1162,18 +1127,12 @@ push_opcode (unsigned char *buf, const char *op)
tracepoint address. */
static int
-amd64_install_fast_tracepoint_jump_pad (CORE_ADDR tpoint, CORE_ADDR tpaddr,
- CORE_ADDR collector,
- CORE_ADDR lockaddr,
- ULONGEST orig_size,
- CORE_ADDR *jump_entry,
- CORE_ADDR *trampoline,
- ULONGEST *trampoline_size,
- unsigned char *jjump_pad_insn,
- ULONGEST *jjump_pad_insn_size,
- CORE_ADDR *adjusted_insn_addr,
- CORE_ADDR *adjusted_insn_addr_end,
- char *err)
+amd64_install_fast_tracepoint_jump_pad (
+ CORE_ADDR tpoint, CORE_ADDR tpaddr, CORE_ADDR collector, CORE_ADDR lockaddr,
+ ULONGEST orig_size, CORE_ADDR *jump_entry, CORE_ADDR *trampoline,
+ ULONGEST *trampoline_size, unsigned char *jjump_pad_insn,
+ ULONGEST *jjump_pad_insn_size, CORE_ADDR *adjusted_insn_addr,
+ CORE_ADDR *adjusted_insn_addr_end, char *err)
{
unsigned char buf[40];
int i, offset;
@@ -1194,14 +1153,22 @@ amd64_install_fast_tracepoint_jump_pad (CORE_ADDR tpoint, CORE_ADDR tpaddr,
buf[i++] = 0x51; /* push %rcx */
buf[i++] = 0x53; /* push %rbx */
buf[i++] = 0x50; /* push %rax */
- buf[i++] = 0x41; buf[i++] = 0x57; /* push %r15 */
- buf[i++] = 0x41; buf[i++] = 0x56; /* push %r14 */
- buf[i++] = 0x41; buf[i++] = 0x55; /* push %r13 */
- buf[i++] = 0x41; buf[i++] = 0x54; /* push %r12 */
- buf[i++] = 0x41; buf[i++] = 0x53; /* push %r11 */
- buf[i++] = 0x41; buf[i++] = 0x52; /* push %r10 */
- buf[i++] = 0x41; buf[i++] = 0x51; /* push %r9 */
- buf[i++] = 0x41; buf[i++] = 0x50; /* push %r8 */
+ buf[i++] = 0x41;
+ buf[i++] = 0x57; /* push %r15 */
+ buf[i++] = 0x41;
+ buf[i++] = 0x56; /* push %r14 */
+ buf[i++] = 0x41;
+ buf[i++] = 0x55; /* push %r13 */
+ buf[i++] = 0x41;
+ buf[i++] = 0x54; /* push %r12 */
+ buf[i++] = 0x41;
+ buf[i++] = 0x53; /* push %r11 */
+ buf[i++] = 0x41;
+ buf[i++] = 0x52; /* push %r10 */
+ buf[i++] = 0x41;
+ buf[i++] = 0x51; /* push %r9 */
+ buf[i++] = 0x41;
+ buf[i++] = 0x50; /* push %r8 */
buf[i++] = 0x9c; /* pushfq */
buf[i++] = 0x48; /* movabs <addr>,%rdi */
buf[i++] = 0xbf;
@@ -1212,26 +1179,26 @@ amd64_install_fast_tracepoint_jump_pad (CORE_ADDR tpoint, CORE_ADDR tpaddr,
/* Stack space for the collecting_t object. */
i = 0;
- i += push_opcode (&buf[i], "48 83 ec 18"); /* sub $0x18,%rsp */
- i += push_opcode (&buf[i], "48 b8"); /* mov <tpoint>,%rax */
+ i += push_opcode (&buf[i], "48 83 ec 18"); /* sub $0x18,%rsp */
+ i += push_opcode (&buf[i], "48 b8"); /* mov <tpoint>,%rax */
memcpy (buf + i, &tpoint, 8);
i += 8;
- i += push_opcode (&buf[i], "48 89 04 24"); /* mov %rax,(%rsp) */
+ i += push_opcode (&buf[i], "48 89 04 24"); /* mov %rax,(%rsp) */
i += push_opcode (&buf[i],
- "64 48 8b 04 25 00 00 00 00"); /* mov %fs:0x0,%rax */
- i += push_opcode (&buf[i], "48 89 44 24 08"); /* mov %rax,0x8(%rsp) */
+ "64 48 8b 04 25 00 00 00 00"); /* mov %fs:0x0,%rax */
+ i += push_opcode (&buf[i], "48 89 44 24 08"); /* mov %rax,0x8(%rsp) */
append_insns (&buildaddr, i, buf);
/* spin-lock. */
i = 0;
- i += push_opcode (&buf[i], "48 be"); /* movl <lockaddr>,%rsi */
+ i += push_opcode (&buf[i], "48 be"); /* movl <lockaddr>,%rsi */
memcpy (&buf[i], (void *) &lockaddr, 8);
i += 8;
i += push_opcode (&buf[i], "48 89 e1"); /* mov %rsp,%rcx */
- i += push_opcode (&buf[i], "31 c0"); /* xor %eax,%eax */
+ i += push_opcode (&buf[i], "31 c0"); /* xor %eax,%eax */
i += push_opcode (&buf[i], "f0 48 0f b1 0e"); /* lock cmpxchg %rcx,(%rsi) */
- i += push_opcode (&buf[i], "48 85 c0"); /* test %rax,%rax */
- i += push_opcode (&buf[i], "75 f4"); /* jne <again> */
+ i += push_opcode (&buf[i], "48 85 c0"); /* test %rax,%rax */
+ i += push_opcode (&buf[i], "75 f4"); /* jne <again> */
append_insns (&buildaddr, i, buf);
/* Set up the gdb_collect call. */
@@ -1239,11 +1206,11 @@ amd64_install_fast_tracepoint_jump_pad (CORE_ADDR tpoint, CORE_ADDR tpaddr,
register block. */
i = 0;
- i += push_opcode (&buf[i], "48 89 e6"); /* mov %rsp,%rsi */
- i += push_opcode (&buf[i], "48 83 c6 18"); /* add $0x18,%rsi */
+ i += push_opcode (&buf[i], "48 89 e6"); /* mov %rsp,%rsi */
+ i += push_opcode (&buf[i], "48 83 c6 18"); /* add $0x18,%rsi */
/* tpoint address may be 64-bit wide. */
- i += push_opcode (&buf[i], "48 bf"); /* movl <addr>,%rdi */
+ i += push_opcode (&buf[i], "48 bf"); /* movl <addr>,%rdi */
memcpy (buf + i, &tpoint, 8);
i += 8;
append_insns (&buildaddr, i, buf);
@@ -1251,23 +1218,23 @@ amd64_install_fast_tracepoint_jump_pad (CORE_ADDR tpoint, CORE_ADDR tpaddr,
/* The collector function being in the shared library, may be
>31-bits away off the jump pad. */
i = 0;
- i += push_opcode (&buf[i], "48 b8"); /* mov $collector,%rax */
+ i += push_opcode (&buf[i], "48 b8"); /* mov $collector,%rax */
memcpy (buf + i, &collector, 8);
i += 8;
- i += push_opcode (&buf[i], "ff d0"); /* callq *%rax */
+ i += push_opcode (&buf[i], "ff d0"); /* callq *%rax */
append_insns (&buildaddr, i, buf);
/* Clear the spin-lock. */
i = 0;
- i += push_opcode (&buf[i], "31 c0"); /* xor %eax,%eax */
- i += push_opcode (&buf[i], "48 a3"); /* mov %rax, lockaddr */
+ i += push_opcode (&buf[i], "31 c0"); /* xor %eax,%eax */
+ i += push_opcode (&buf[i], "48 a3"); /* mov %rax, lockaddr */
memcpy (buf + i, &lockaddr, 8);
i += 8;
append_insns (&buildaddr, i, buf);
/* Remove stack that had been used for the collect_t object. */
i = 0;
- i += push_opcode (&buf[i], "48 83 c4 18"); /* add $0x18,%rsp */
+ i += push_opcode (&buf[i], "48 83 c4 18"); /* add $0x18,%rsp */
append_insns (&buildaddr, i, buf);
/* Restore register state. */
@@ -1277,14 +1244,22 @@ amd64_install_fast_tracepoint_jump_pad (CORE_ADDR tpoint, CORE_ADDR tpaddr,
buf[i++] = 0xc4;
buf[i++] = 0x08;
buf[i++] = 0x9d; /* popfq */
- buf[i++] = 0x41; buf[i++] = 0x58; /* pop %r8 */
- buf[i++] = 0x41; buf[i++] = 0x59; /* pop %r9 */
- buf[i++] = 0x41; buf[i++] = 0x5a; /* pop %r10 */
- buf[i++] = 0x41; buf[i++] = 0x5b; /* pop %r11 */
- buf[i++] = 0x41; buf[i++] = 0x5c; /* pop %r12 */
- buf[i++] = 0x41; buf[i++] = 0x5d; /* pop %r13 */
- buf[i++] = 0x41; buf[i++] = 0x5e; /* pop %r14 */
- buf[i++] = 0x41; buf[i++] = 0x5f; /* pop %r15 */
+ buf[i++] = 0x41;
+ buf[i++] = 0x58; /* pop %r8 */
+ buf[i++] = 0x41;
+ buf[i++] = 0x59; /* pop %r9 */
+ buf[i++] = 0x41;
+ buf[i++] = 0x5a; /* pop %r10 */
+ buf[i++] = 0x41;
+ buf[i++] = 0x5b; /* pop %r11 */
+ buf[i++] = 0x41;
+ buf[i++] = 0x5c; /* pop %r12 */
+ buf[i++] = 0x41;
+ buf[i++] = 0x5d; /* pop %r13 */
+ buf[i++] = 0x41;
+ buf[i++] = 0x5e; /* pop %r14 */
+ buf[i++] = 0x41;
+ buf[i++] = 0x5f; /* pop %r15 */
buf[i++] = 0x58; /* pop %rax */
buf[i++] = 0x5b; /* pop %rbx */
buf[i++] = 0x59; /* pop %rcx */
@@ -1307,8 +1282,9 @@ amd64_install_fast_tracepoint_jump_pad (CORE_ADDR tpoint, CORE_ADDR tpaddr,
if (loffset > INT_MAX || loffset < INT_MIN)
{
sprintf (err,
- "E.Jump back from jump pad too far from tracepoint "
- "(offset 0x%" PRIx64 " > int32).", loffset);
+ "E.Jump back from jump pad too far from tracepoint "
+ "(offset 0x%" PRIx64 " > int32).",
+ loffset);
return 1;
}
@@ -1325,8 +1301,9 @@ amd64_install_fast_tracepoint_jump_pad (CORE_ADDR tpoint, CORE_ADDR tpaddr,
if (loffset > INT_MAX || loffset < INT_MIN)
{
sprintf (err,
- "E.Jump pad too far from tracepoint "
- "(offset 0x%" PRIx64 " > int32).", loffset);
+ "E.Jump pad too far from tracepoint "
+ "(offset 0x%" PRIx64 " > int32).",
+ loffset);
return 1;
}
@@ -1351,18 +1328,12 @@ amd64_install_fast_tracepoint_jump_pad (CORE_ADDR tpoint, CORE_ADDR tpaddr,
tracepoint address. */
static int
-i386_install_fast_tracepoint_jump_pad (CORE_ADDR tpoint, CORE_ADDR tpaddr,
- CORE_ADDR collector,
- CORE_ADDR lockaddr,
- ULONGEST orig_size,
- CORE_ADDR *jump_entry,
- CORE_ADDR *trampoline,
- ULONGEST *trampoline_size,
- unsigned char *jjump_pad_insn,
- ULONGEST *jjump_pad_insn_size,
- CORE_ADDR *adjusted_insn_addr,
- CORE_ADDR *adjusted_insn_addr_end,
- char *err)
+i386_install_fast_tracepoint_jump_pad (
+ CORE_ADDR tpoint, CORE_ADDR tpaddr, CORE_ADDR collector, CORE_ADDR lockaddr,
+ ULONGEST orig_size, CORE_ADDR *jump_entry, CORE_ADDR *trampoline,
+ ULONGEST *trampoline_size, unsigned char *jjump_pad_insn,
+ ULONGEST *jjump_pad_insn_size, CORE_ADDR *adjusted_insn_addr,
+ CORE_ADDR *adjusted_insn_addr_end, char *err)
{
unsigned char buf[0x100];
int i, offset;
@@ -1374,7 +1345,7 @@ i386_install_fast_tracepoint_jump_pad (CORE_ADDR tpoint, CORE_ADDR tpaddr,
i = 0;
buf[i++] = 0x60; /* pushad */
buf[i++] = 0x68; /* push tpaddr aka $pc */
- *((int *)(buf + i)) = (int) tpaddr;
+ *((int *) (buf + i)) = (int) tpaddr;
i += 4;
buf[i++] = 0x9c; /* pushf */
buf[i++] = 0x1e; /* push %ds */
@@ -1389,45 +1360,44 @@ i386_install_fast_tracepoint_jump_pad (CORE_ADDR tpoint, CORE_ADDR tpaddr,
/* Stack space for the collecting_t object. */
i = 0;
- i += push_opcode (&buf[i], "83 ec 08"); /* sub $0x8,%esp */
+ i += push_opcode (&buf[i], "83 ec 08"); /* sub $0x8,%esp */
/* Build the object. */
- i += push_opcode (&buf[i], "b8"); /* mov <tpoint>,%eax */
+ i += push_opcode (&buf[i], "b8"); /* mov <tpoint>,%eax */
memcpy (buf + i, &tpoint, 4);
i += 4;
- i += push_opcode (&buf[i], "89 04 24"); /* mov %eax,(%esp) */
+ i += push_opcode (&buf[i], "89 04 24"); /* mov %eax,(%esp) */
i += push_opcode (&buf[i], "65 a1 00 00 00 00"); /* mov %gs:0x0,%eax */
- i += push_opcode (&buf[i], "89 44 24 04"); /* mov %eax,0x4(%esp) */
+ i += push_opcode (&buf[i], "89 44 24 04"); /* mov %eax,0x4(%esp) */
append_insns (&buildaddr, i, buf);
/* spin-lock. Note this is using cmpxchg, which leaves i386 behind.
If we cared for it, this could be using xchg alternatively. */
i = 0;
- i += push_opcode (&buf[i], "31 c0"); /* xor %eax,%eax */
- i += push_opcode (&buf[i], "f0 0f b1 25"); /* lock cmpxchg
+ i += push_opcode (&buf[i], "31 c0"); /* xor %eax,%eax */
+ i += push_opcode (&buf[i], "f0 0f b1 25"); /* lock cmpxchg
%esp,<lockaddr> */
memcpy (&buf[i], (void *) &lockaddr, 4);
i += 4;
- i += push_opcode (&buf[i], "85 c0"); /* test %eax,%eax */
- i += push_opcode (&buf[i], "75 f2"); /* jne <again> */
+ i += push_opcode (&buf[i], "85 c0"); /* test %eax,%eax */
+ i += push_opcode (&buf[i], "75 f2"); /* jne <again> */
append_insns (&buildaddr, i, buf);
-
/* Set up arguments to the gdb_collect call. */
i = 0;
- i += push_opcode (&buf[i], "89 e0"); /* mov %esp,%eax */
- i += push_opcode (&buf[i], "83 c0 08"); /* add $0x08,%eax */
- i += push_opcode (&buf[i], "89 44 24 fc"); /* mov %eax,-0x4(%esp) */
+ i += push_opcode (&buf[i], "89 e0"); /* mov %esp,%eax */
+ i += push_opcode (&buf[i], "83 c0 08"); /* add $0x08,%eax */
+ i += push_opcode (&buf[i], "89 44 24 fc"); /* mov %eax,-0x4(%esp) */
append_insns (&buildaddr, i, buf);
i = 0;
- i += push_opcode (&buf[i], "83 ec 08"); /* sub $0x8,%esp */
+ i += push_opcode (&buf[i], "83 ec 08"); /* sub $0x8,%esp */
append_insns (&buildaddr, i, buf);
i = 0;
- i += push_opcode (&buf[i], "c7 04 24"); /* movl <addr>,(%esp) */
+ i += push_opcode (&buf[i], "c7 04 24"); /* movl <addr>,(%esp) */
memcpy (&buf[i], (void *) &tpoint, 4);
i += 4;
append_insns (&buildaddr, i, buf);
@@ -1442,20 +1412,18 @@ i386_install_fast_tracepoint_jump_pad (CORE_ADDR tpoint, CORE_ADDR tpaddr,
buf[2] = 0x08;
append_insns (&buildaddr, 3, buf);
-
/* Clear the spin-lock. This would need the LOCK prefix on older
broken archs. */
i = 0;
- i += push_opcode (&buf[i], "31 c0"); /* xor %eax,%eax */
- i += push_opcode (&buf[i], "a3"); /* mov %eax, lockaddr */
+ i += push_opcode (&buf[i], "31 c0"); /* xor %eax,%eax */
+ i += push_opcode (&buf[i], "a3"); /* mov %eax, lockaddr */
memcpy (buf + i, &lockaddr, 4);
i += 4;
append_insns (&buildaddr, i, buf);
-
/* Remove stack that had been used for the collect_t object. */
i = 0;
- i += push_opcode (&buf[i], "83 c4 08"); /* add $0x08,%esp */
+ i += push_opcode (&buf[i], "83 c4 08"); /* add $0x08,%esp */
append_insns (&buildaddr, i, buf);
i = 0;
@@ -1497,13 +1465,12 @@ i386_install_fast_tracepoint_jump_pad (CORE_ADDR tpoint, CORE_ADDR tpaddr,
/* Create a trampoline. */
*trampoline_size = sizeof (jump_insn);
if (!claim_trampoline_space (*trampoline_size, trampoline))
- {
- /* No trampoline space available. */
- strcpy (err,
- "E.Cannot allocate trampoline space needed for fast "
- "tracepoints on 4-byte instructions.");
- return 1;
- }
+ {
+ /* No trampoline space available. */
+ strcpy (err, "E.Cannot allocate trampoline space needed for fast "
+ "tracepoints on 4-byte instructions.");
+ return 1;
+ }
offset = *jump_entry - (*trampoline + sizeof (jump_insn));
memcpy (buf, jump_insn, sizeof (jump_insn));
@@ -1540,42 +1507,34 @@ x86_target::supports_fast_tracepoints ()
}
int
-x86_target::install_fast_tracepoint_jump_pad (CORE_ADDR tpoint,
- CORE_ADDR tpaddr,
- CORE_ADDR collector,
- CORE_ADDR lockaddr,
- ULONGEST orig_size,
- CORE_ADDR *jump_entry,
- CORE_ADDR *trampoline,
- ULONGEST *trampoline_size,
- unsigned char *jjump_pad_insn,
- ULONGEST *jjump_pad_insn_size,
- CORE_ADDR *adjusted_insn_addr,
- CORE_ADDR *adjusted_insn_addr_end,
- char *err)
+x86_target::install_fast_tracepoint_jump_pad (
+ CORE_ADDR tpoint, CORE_ADDR tpaddr, CORE_ADDR collector, CORE_ADDR lockaddr,
+ ULONGEST orig_size, CORE_ADDR *jump_entry, CORE_ADDR *trampoline,
+ ULONGEST *trampoline_size, unsigned char *jjump_pad_insn,
+ ULONGEST *jjump_pad_insn_size, CORE_ADDR *adjusted_insn_addr,
+ CORE_ADDR *adjusted_insn_addr_end, char *err)
{
#ifdef __x86_64__
if (is_64bit_tdesc (current_thread))
- return amd64_install_fast_tracepoint_jump_pad (tpoint, tpaddr,
- collector, lockaddr,
- orig_size, jump_entry,
- trampoline, trampoline_size,
- jjump_pad_insn,
- jjump_pad_insn_size,
- adjusted_insn_addr,
- adjusted_insn_addr_end,
- err);
+ return amd64_install_fast_tracepoint_jump_pad (tpoint, tpaddr, collector,
+ lockaddr, orig_size,
+ jump_entry, trampoline,
+ trampoline_size,
+ jjump_pad_insn,
+ jjump_pad_insn_size,
+ adjusted_insn_addr,
+ adjusted_insn_addr_end,
+ err);
#endif
- return i386_install_fast_tracepoint_jump_pad (tpoint, tpaddr,
- collector, lockaddr,
- orig_size, jump_entry,
- trampoline, trampoline_size,
- jjump_pad_insn,
- jjump_pad_insn_size,
- adjusted_insn_addr,
- adjusted_insn_addr_end,
- err);
+ return i386_install_fast_tracepoint_jump_pad (tpoint, tpaddr, collector,
+ lockaddr, orig_size,
+ jump_entry, trampoline,
+ trampoline_size,
+ jjump_pad_insn,
+ jjump_pad_insn_size,
+ adjusted_insn_addr,
+ adjusted_insn_addr_end, err);
}
/* Return the minimum instruction length for fast tracepoints on x86/x86-64
@@ -1603,19 +1562,19 @@ x86_target::get_min_fast_tracepoint_insn_len ()
with a 2-byte offset may be used, otherwise 5-byte jump instructions
with a 4-byte offset are used instead. */
if (have_fast_tracepoint_trampoline_buffer (errbuf))
- return 4;
+ return 4;
else
- {
- /* GDB has no channel to explain to user why a shorter fast
+ {
+ /* GDB has no channel to explain to user why a shorter fast
tracepoint is not possible, but at least make GDBserver
mention that something has gone awry. */
- if (!warned_about_fast_tracepoints)
- {
- warning ("4-byte fast tracepoints not available; %s", errbuf);
- warned_about_fast_tracepoints = 1;
- }
- return 5;
- }
+ if (!warned_about_fast_tracepoints)
+ {
+ warning ("4-byte fast tracepoints not available; %s", errbuf);
+ warned_about_fast_tracepoints = 1;
+ }
+ return 5;
+ }
}
else
{
@@ -1630,8 +1589,8 @@ add_insns (unsigned char *start, int len)
{
CORE_ADDR buildaddr = current_insn_ptr;
- threads_debug_printf ("Adding %d bytes of insn at %s",
- len, paddress (buildaddr));
+ threads_debug_printf ("Adding %d bytes of insn at %s", len,
+ paddress (buildaddr));
append_insns (&buildaddr, len, start);
current_insn_ptr = buildaddr;
@@ -1643,35 +1602,42 @@ add_insns (unsigned char *start, int len)
we need to keep the compiler from discarding what looks like dead
code, plus suppress various warnings. */
-#define EMIT_ASM(NAME, INSNS) \
- do \
- { \
- extern unsigned char start_ ## NAME, end_ ## NAME; \
- add_insns (&start_ ## NAME, &end_ ## NAME - &start_ ## NAME); \
- __asm__ ("jmp end_" #NAME "\n" \
- "\t" "start_" #NAME ":" \
- "\t" INSNS "\n" \
- "\t" "end_" #NAME ":"); \
- } while (0)
+#define EMIT_ASM(NAME, INSNS) \
+ do \
+ { \
+ extern unsigned char start_##NAME, end_##NAME; \
+ add_insns (&start_##NAME, &end_##NAME - &start_##NAME); \
+ __asm__ ("jmp end_" #NAME "\n" \
+ "\t" \
+ "start_" #NAME ":" \
+ "\t" INSNS "\n" \
+ "\t" \
+ "end_" #NAME ":"); \
+ } \
+ while (0)
#ifdef __x86_64__
-#define EMIT_ASM32(NAME,INSNS) \
- do \
- { \
- extern unsigned char start_ ## NAME, end_ ## NAME; \
- add_insns (&start_ ## NAME, &end_ ## NAME - &start_ ## NAME); \
- __asm__ (".code32\n" \
- "\t" "jmp end_" #NAME "\n" \
- "\t" "start_" #NAME ":\n" \
- "\t" INSNS "\n" \
- "\t" "end_" #NAME ":\n" \
- ".code64\n"); \
- } while (0)
+#define EMIT_ASM32(NAME, INSNS) \
+ do \
+ { \
+ extern unsigned char start_##NAME, end_##NAME; \
+ add_insns (&start_##NAME, &end_##NAME - &start_##NAME); \
+ __asm__ (".code32\n" \
+ "\t" \
+ "jmp end_" #NAME "\n" \
+ "\t" \
+ "start_" #NAME ":\n" \
+ "\t" INSNS "\n" \
+ "\t" \
+ "end_" #NAME ":\n" \
+ ".code64\n"); \
+ } \
+ while (0)
#else
-#define EMIT_ASM32(NAME,INSNS) EMIT_ASM(NAME,INSNS)
+#define EMIT_ASM32(NAME, INSNS) EMIT_ASM (NAME, INSNS)
#endif
@@ -1680,40 +1646,35 @@ add_insns (unsigned char *start, int len)
static void
amd64_emit_prologue (void)
{
- EMIT_ASM (amd64_prologue,
- "pushq %rbp\n\t"
- "movq %rsp,%rbp\n\t"
- "sub $0x20,%rsp\n\t"
- "movq %rdi,-8(%rbp)\n\t"
- "movq %rsi,-16(%rbp)");
+ EMIT_ASM (amd64_prologue, "pushq %rbp\n\t"
+ "movq %rsp,%rbp\n\t"
+ "sub $0x20,%rsp\n\t"
+ "movq %rdi,-8(%rbp)\n\t"
+ "movq %rsi,-16(%rbp)");
}
-
static void
amd64_emit_epilogue (void)
{
- EMIT_ASM (amd64_epilogue,
- "movq -16(%rbp),%rdi\n\t"
- "movq %rax,(%rdi)\n\t"
- "xor %rax,%rax\n\t"
- "leave\n\t"
- "ret");
+ EMIT_ASM (amd64_epilogue, "movq -16(%rbp),%rdi\n\t"
+ "movq %rax,(%rdi)\n\t"
+ "xor %rax,%rax\n\t"
+ "leave\n\t"
+ "ret");
}
static void
amd64_emit_add (void)
{
- EMIT_ASM (amd64_add,
- "add (%rsp),%rax\n\t"
- "lea 0x8(%rsp),%rsp");
+ EMIT_ASM (amd64_add, "add (%rsp),%rax\n\t"
+ "lea 0x8(%rsp),%rsp");
}
static void
amd64_emit_sub (void)
{
- EMIT_ASM (amd64_sub,
- "sub %rax,(%rsp)\n\t"
- "pop %rax");
+ EMIT_ASM (amd64_sub, "sub %rax,(%rsp)\n\t"
+ "pop %rax");
}
static void
@@ -1746,19 +1707,16 @@ amd64_emit_ext (int arg)
switch (arg)
{
case 8:
- EMIT_ASM (amd64_ext_8,
- "cbtw\n\t"
- "cwtl\n\t"
- "cltq");
+ EMIT_ASM (amd64_ext_8, "cbtw\n\t"
+ "cwtl\n\t"
+ "cltq");
break;
case 16:
- EMIT_ASM (amd64_ext_16,
- "cwtl\n\t"
- "cltq");
+ EMIT_ASM (amd64_ext_16, "cwtl\n\t"
+ "cltq");
break;
case 32:
- EMIT_ASM (amd64_ext_32,
- "cltq");
+ EMIT_ASM (amd64_ext_32, "cltq");
break;
default:
emit_error = 1;
@@ -1768,83 +1726,75 @@ amd64_emit_ext (int arg)
static void
amd64_emit_log_not (void)
{
- EMIT_ASM (amd64_log_not,
- "test %rax,%rax\n\t"
- "sete %cl\n\t"
- "movzbq %cl,%rax");
+ EMIT_ASM (amd64_log_not, "test %rax,%rax\n\t"
+ "sete %cl\n\t"
+ "movzbq %cl,%rax");
}
static void
amd64_emit_bit_and (void)
{
- EMIT_ASM (amd64_and,
- "and (%rsp),%rax\n\t"
- "lea 0x8(%rsp),%rsp");
+ EMIT_ASM (amd64_and, "and (%rsp),%rax\n\t"
+ "lea 0x8(%rsp),%rsp");
}
static void
amd64_emit_bit_or (void)
{
- EMIT_ASM (amd64_or,
- "or (%rsp),%rax\n\t"
- "lea 0x8(%rsp),%rsp");
+ EMIT_ASM (amd64_or, "or (%rsp),%rax\n\t"
+ "lea 0x8(%rsp),%rsp");
}
static void
amd64_emit_bit_xor (void)
{
- EMIT_ASM (amd64_xor,
- "xor (%rsp),%rax\n\t"
- "lea 0x8(%rsp),%rsp");
+ EMIT_ASM (amd64_xor, "xor (%rsp),%rax\n\t"
+ "lea 0x8(%rsp),%rsp");
}
static void
amd64_emit_bit_not (void)
{
- EMIT_ASM (amd64_bit_not,
- "xorq $0xffffffffffffffff,%rax");
+ EMIT_ASM (amd64_bit_not, "xorq $0xffffffffffffffff,%rax");
}
static void
amd64_emit_equal (void)
{
- EMIT_ASM (amd64_equal,
- "cmp %rax,(%rsp)\n\t"
- "je .Lamd64_equal_true\n\t"
- "xor %rax,%rax\n\t"
- "jmp .Lamd64_equal_end\n\t"
- ".Lamd64_equal_true:\n\t"
- "mov $0x1,%rax\n\t"
- ".Lamd64_equal_end:\n\t"
- "lea 0x8(%rsp),%rsp");
+ EMIT_ASM (amd64_equal, "cmp %rax,(%rsp)\n\t"
+ "je .Lamd64_equal_true\n\t"
+ "xor %rax,%rax\n\t"
+ "jmp .Lamd64_equal_end\n\t"
+ ".Lamd64_equal_true:\n\t"
+ "mov $0x1,%rax\n\t"
+ ".Lamd64_equal_end:\n\t"
+ "lea 0x8(%rsp),%rsp");
}
static void
amd64_emit_less_signed (void)
{
- EMIT_ASM (amd64_less_signed,
- "cmp %rax,(%rsp)\n\t"
- "jl .Lamd64_less_signed_true\n\t"
- "xor %rax,%rax\n\t"
- "jmp .Lamd64_less_signed_end\n\t"
- ".Lamd64_less_signed_true:\n\t"
- "mov $1,%rax\n\t"
- ".Lamd64_less_signed_end:\n\t"
- "lea 0x8(%rsp),%rsp");
+ EMIT_ASM (amd64_less_signed, "cmp %rax,(%rsp)\n\t"
+ "jl .Lamd64_less_signed_true\n\t"
+ "xor %rax,%rax\n\t"
+ "jmp .Lamd64_less_signed_end\n\t"
+ ".Lamd64_less_signed_true:\n\t"
+ "mov $1,%rax\n\t"
+ ".Lamd64_less_signed_end:\n\t"
+ "lea 0x8(%rsp),%rsp");
}
static void
amd64_emit_less_unsigned (void)
{
- EMIT_ASM (amd64_less_unsigned,
- "cmp %rax,(%rsp)\n\t"
- "jb .Lamd64_less_unsigned_true\n\t"
- "xor %rax,%rax\n\t"
- "jmp .Lamd64_less_unsigned_end\n\t"
- ".Lamd64_less_unsigned_true:\n\t"
- "mov $1,%rax\n\t"
- ".Lamd64_less_unsigned_end:\n\t"
- "lea 0x8(%rsp),%rsp");
+ EMIT_ASM (amd64_less_unsigned, "cmp %rax,(%rsp)\n\t"
+ "jb .Lamd64_less_unsigned_true\n\t"
+ "xor %rax,%rax\n\t"
+ "jmp .Lamd64_less_unsigned_end\n\t"
+ ".Lamd64_less_unsigned_true:\n\t"
+ "mov $1,%rax\n\t"
+ ".Lamd64_less_unsigned_end:\n\t"
+ "lea 0x8(%rsp),%rsp");
}
static void
@@ -1853,20 +1803,16 @@ amd64_emit_ref (int size)
switch (size)
{
case 1:
- EMIT_ASM (amd64_ref1,
- "movb (%rax),%al");
+ EMIT_ASM (amd64_ref1, "movb (%rax),%al");
break;
case 2:
- EMIT_ASM (amd64_ref2,
- "movw (%rax),%ax");
+ EMIT_ASM (amd64_ref2, "movw (%rax),%ax");
break;
case 4:
- EMIT_ASM (amd64_ref4,
- "movl (%rax),%eax");
+ EMIT_ASM (amd64_ref4, "movl (%rax),%eax");
break;
case 8:
- EMIT_ASM (amd64_ref8,
- "movq (%rax),%rax");
+ EMIT_ASM (amd64_ref8, "movq (%rax),%rax");
break;
}
}
@@ -1874,11 +1820,10 @@ amd64_emit_ref (int size)
static void
amd64_emit_if_goto (int *offset_p, int *size_p)
{
- EMIT_ASM (amd64_if_goto,
- "mov %rax,%rcx\n\t"
- "pop %rax\n\t"
- "cmp $0,%rcx\n\t"
- ".byte 0x0f, 0x85, 0x0, 0x0, 0x0, 0x0");
+ EMIT_ASM (amd64_if_goto, "mov %rax,%rcx\n\t"
+ "pop %rax\n\t"
+ "cmp $0,%rcx\n\t"
+ ".byte 0x0f, 0x85, 0x0, 0x0, 0x0, 0x0");
if (offset_p)
*offset_p = 10;
if (size_p)
@@ -1888,8 +1833,7 @@ amd64_emit_if_goto (int *offset_p, int *size_p)
static void
amd64_emit_goto (int *offset_p, int *size_p)
{
- EMIT_ASM (amd64_goto,
- ".byte 0xe9, 0x0, 0x0, 0x0, 0x0");
+ EMIT_ASM (amd64_goto, ".byte 0xe9, 0x0, 0x0, 0x0, 0x0");
if (offset_p)
*offset_p = 1;
if (size_p)
@@ -1920,7 +1864,8 @@ amd64_emit_const (LONGEST num)
CORE_ADDR buildaddr = current_insn_ptr;
i = 0;
- buf[i++] = 0x48; buf[i++] = 0xb8; /* mov $<n>,%rax */
+ buf[i++] = 0x48;
+ buf[i++] = 0xb8; /* mov $<n>,%rax */
memcpy (&buf[i], &num, sizeof (num));
i += 8;
append_insns (&buildaddr, i, buf);
@@ -1990,15 +1935,13 @@ amd64_emit_reg (int reg)
static void
amd64_emit_pop (void)
{
- EMIT_ASM (amd64_pop,
- "pop %rax");
+ EMIT_ASM (amd64_pop, "pop %rax");
}
static void
amd64_emit_stack_flush (void)
{
- EMIT_ASM (amd64_stack_flush,
- "push %rax");
+ EMIT_ASM (amd64_stack_flush, "push %rax");
}
static void
@@ -2007,17 +1950,14 @@ amd64_emit_zero_ext (int arg)
switch (arg)
{
case 8:
- EMIT_ASM (amd64_zero_ext_8,
- "and $0xff,%rax");
+ EMIT_ASM (amd64_zero_ext_8, "and $0xff,%rax");
break;
case 16:
- EMIT_ASM (amd64_zero_ext_16,
- "and $0xffff,%rax");
+ EMIT_ASM (amd64_zero_ext_16, "and $0xffff,%rax");
break;
case 32:
- EMIT_ASM (amd64_zero_ext_32,
- "mov $0xffffffff,%rcx\n\t"
- "and %rcx,%rax");
+ EMIT_ASM (amd64_zero_ext_32, "mov $0xffffffff,%rcx\n\t"
+ "and %rcx,%rax");
break;
default:
emit_error = 1;
@@ -2027,10 +1967,9 @@ amd64_emit_zero_ext (int arg)
static void
amd64_emit_swap (void)
{
- EMIT_ASM (amd64_swap,
- "mov %rax,%rcx\n\t"
- "pop %rax\n\t"
- "push %rcx");
+ EMIT_ASM (amd64_swap, "mov %rax,%rcx\n\t"
+ "pop %rax\n\t"
+ "push %rcx");
}
static void
@@ -2087,29 +2026,29 @@ amd64_emit_void_call_2 (CORE_ADDR fn, int arg1)
append_insns (&buildaddr, i, buf);
current_insn_ptr = buildaddr;
EMIT_ASM (amd64_void_call_2_a,
- /* Save away a copy of the stack top. */
- "push %rax\n\t"
- /* Also pass top as the second argument. */
- "mov %rax,%rsi");
+ /* Save away a copy of the stack top. */
+ "push %rax\n\t"
+ /* Also pass top as the second argument. */
+ "mov %rax,%rsi");
amd64_emit_call (fn);
EMIT_ASM (amd64_void_call_2_b,
- /* Restore the stack top, %rax may have been trashed. */
- "pop %rax");
+ /* Restore the stack top, %rax may have been trashed. */
+ "pop %rax");
}
static void
amd64_emit_eq_goto (int *offset_p, int *size_p)
{
EMIT_ASM (amd64_eq,
- "cmp %rax,(%rsp)\n\t"
- "jne .Lamd64_eq_fallthru\n\t"
- "lea 0x8(%rsp),%rsp\n\t"
- "pop %rax\n\t"
- /* jmp, but don't trust the assembler to choose the right jump */
- ".byte 0xe9, 0x0, 0x0, 0x0, 0x0\n\t"
- ".Lamd64_eq_fallthru:\n\t"
- "lea 0x8(%rsp),%rsp\n\t"
- "pop %rax");
+ "cmp %rax,(%rsp)\n\t"
+ "jne .Lamd64_eq_fallthru\n\t"
+ "lea 0x8(%rsp),%rsp\n\t"
+ "pop %rax\n\t"
+ /* jmp, but don't trust the assembler to choose the right jump */
+ ".byte 0xe9, 0x0, 0x0, 0x0, 0x0\n\t"
+ ".Lamd64_eq_fallthru:\n\t"
+ "lea 0x8(%rsp),%rsp\n\t"
+ "pop %rax");
if (offset_p)
*offset_p = 13;
@@ -2121,15 +2060,15 @@ static void
amd64_emit_ne_goto (int *offset_p, int *size_p)
{
EMIT_ASM (amd64_ne,
- "cmp %rax,(%rsp)\n\t"
- "je .Lamd64_ne_fallthru\n\t"
- "lea 0x8(%rsp),%rsp\n\t"
- "pop %rax\n\t"
- /* jmp, but don't trust the assembler to choose the right jump */
- ".byte 0xe9, 0x0, 0x0, 0x0, 0x0\n\t"
- ".Lamd64_ne_fallthru:\n\t"
- "lea 0x8(%rsp),%rsp\n\t"
- "pop %rax");
+ "cmp %rax,(%rsp)\n\t"
+ "je .Lamd64_ne_fallthru\n\t"
+ "lea 0x8(%rsp),%rsp\n\t"
+ "pop %rax\n\t"
+ /* jmp, but don't trust the assembler to choose the right jump */
+ ".byte 0xe9, 0x0, 0x0, 0x0, 0x0\n\t"
+ ".Lamd64_ne_fallthru:\n\t"
+ "lea 0x8(%rsp),%rsp\n\t"
+ "pop %rax");
if (offset_p)
*offset_p = 13;
@@ -2141,15 +2080,15 @@ static void
amd64_emit_lt_goto (int *offset_p, int *size_p)
{
EMIT_ASM (amd64_lt,
- "cmp %rax,(%rsp)\n\t"
- "jnl .Lamd64_lt_fallthru\n\t"
- "lea 0x8(%rsp),%rsp\n\t"
- "pop %rax\n\t"
- /* jmp, but don't trust the assembler to choose the right jump */
- ".byte 0xe9, 0x0, 0x0, 0x0, 0x0\n\t"
- ".Lamd64_lt_fallthru:\n\t"
- "lea 0x8(%rsp),%rsp\n\t"
- "pop %rax");
+ "cmp %rax,(%rsp)\n\t"
+ "jnl .Lamd64_lt_fallthru\n\t"
+ "lea 0x8(%rsp),%rsp\n\t"
+ "pop %rax\n\t"
+ /* jmp, but don't trust the assembler to choose the right jump */
+ ".byte 0xe9, 0x0, 0x0, 0x0, 0x0\n\t"
+ ".Lamd64_lt_fallthru:\n\t"
+ "lea 0x8(%rsp),%rsp\n\t"
+ "pop %rax");
if (offset_p)
*offset_p = 13;
@@ -2161,15 +2100,15 @@ static void
amd64_emit_le_goto (int *offset_p, int *size_p)
{
EMIT_ASM (amd64_le,
- "cmp %rax,(%rsp)\n\t"
- "jnle .Lamd64_le_fallthru\n\t"
- "lea 0x8(%rsp),%rsp\n\t"
- "pop %rax\n\t"
- /* jmp, but don't trust the assembler to choose the right jump */
- ".byte 0xe9, 0x0, 0x0, 0x0, 0x0\n\t"
- ".Lamd64_le_fallthru:\n\t"
- "lea 0x8(%rsp),%rsp\n\t"
- "pop %rax");
+ "cmp %rax,(%rsp)\n\t"
+ "jnle .Lamd64_le_fallthru\n\t"
+ "lea 0x8(%rsp),%rsp\n\t"
+ "pop %rax\n\t"
+ /* jmp, but don't trust the assembler to choose the right jump */
+ ".byte 0xe9, 0x0, 0x0, 0x0, 0x0\n\t"
+ ".Lamd64_le_fallthru:\n\t"
+ "lea 0x8(%rsp),%rsp\n\t"
+ "pop %rax");
if (offset_p)
*offset_p = 13;
@@ -2181,15 +2120,15 @@ static void
amd64_emit_gt_goto (int *offset_p, int *size_p)
{
EMIT_ASM (amd64_gt,
- "cmp %rax,(%rsp)\n\t"
- "jng .Lamd64_gt_fallthru\n\t"
- "lea 0x8(%rsp),%rsp\n\t"
- "pop %rax\n\t"
- /* jmp, but don't trust the assembler to choose the right jump */
- ".byte 0xe9, 0x0, 0x0, 0x0, 0x0\n\t"
- ".Lamd64_gt_fallthru:\n\t"
- "lea 0x8(%rsp),%rsp\n\t"
- "pop %rax");
+ "cmp %rax,(%rsp)\n\t"
+ "jng .Lamd64_gt_fallthru\n\t"
+ "lea 0x8(%rsp),%rsp\n\t"
+ "pop %rax\n\t"
+ /* jmp, but don't trust the assembler to choose the right jump */
+ ".byte 0xe9, 0x0, 0x0, 0x0, 0x0\n\t"
+ ".Lamd64_gt_fallthru:\n\t"
+ "lea 0x8(%rsp),%rsp\n\t"
+ "pop %rax");
if (offset_p)
*offset_p = 13;
@@ -2201,16 +2140,16 @@ static void
amd64_emit_ge_goto (int *offset_p, int *size_p)
{
EMIT_ASM (amd64_ge,
- "cmp %rax,(%rsp)\n\t"
- "jnge .Lamd64_ge_fallthru\n\t"
- ".Lamd64_ge_jump:\n\t"
- "lea 0x8(%rsp),%rsp\n\t"
- "pop %rax\n\t"
- /* jmp, but don't trust the assembler to choose the right jump */
- ".byte 0xe9, 0x0, 0x0, 0x0, 0x0\n\t"
- ".Lamd64_ge_fallthru:\n\t"
- "lea 0x8(%rsp),%rsp\n\t"
- "pop %rax");
+ "cmp %rax,(%rsp)\n\t"
+ "jnge .Lamd64_ge_fallthru\n\t"
+ ".Lamd64_ge_jump:\n\t"
+ "lea 0x8(%rsp),%rsp\n\t"
+ "pop %rax\n\t"
+ /* jmp, but don't trust the assembler to choose the right jump */
+ ".byte 0xe9, 0x0, 0x0, 0x0, 0x0\n\t"
+ ".Lamd64_ge_fallthru:\n\t"
+ "lea 0x8(%rsp),%rsp\n\t"
+ "pop %rax");
if (offset_p)
*offset_p = 13;
@@ -2218,56 +2157,30 @@ amd64_emit_ge_goto (int *offset_p, int *size_p)
*size_p = 4;
}
-static emit_ops amd64_emit_ops =
- {
- amd64_emit_prologue,
- amd64_emit_epilogue,
- amd64_emit_add,
- amd64_emit_sub,
- amd64_emit_mul,
- amd64_emit_lsh,
- amd64_emit_rsh_signed,
- amd64_emit_rsh_unsigned,
- amd64_emit_ext,
- amd64_emit_log_not,
- amd64_emit_bit_and,
- amd64_emit_bit_or,
- amd64_emit_bit_xor,
- amd64_emit_bit_not,
- amd64_emit_equal,
- amd64_emit_less_signed,
- amd64_emit_less_unsigned,
- amd64_emit_ref,
- amd64_emit_if_goto,
- amd64_emit_goto,
- amd64_write_goto_address,
- amd64_emit_const,
- amd64_emit_call,
- amd64_emit_reg,
- amd64_emit_pop,
- amd64_emit_stack_flush,
- amd64_emit_zero_ext,
- amd64_emit_swap,
- amd64_emit_stack_adjust,
- amd64_emit_int_call_1,
- amd64_emit_void_call_2,
- amd64_emit_eq_goto,
- amd64_emit_ne_goto,
- amd64_emit_lt_goto,
- amd64_emit_le_goto,
- amd64_emit_gt_goto,
- amd64_emit_ge_goto
- };
+static emit_ops amd64_emit_ops = {
+ amd64_emit_prologue, amd64_emit_epilogue, amd64_emit_add,
+ amd64_emit_sub, amd64_emit_mul, amd64_emit_lsh,
+ amd64_emit_rsh_signed, amd64_emit_rsh_unsigned, amd64_emit_ext,
+ amd64_emit_log_not, amd64_emit_bit_and, amd64_emit_bit_or,
+ amd64_emit_bit_xor, amd64_emit_bit_not, amd64_emit_equal,
+ amd64_emit_less_signed, amd64_emit_less_unsigned, amd64_emit_ref,
+ amd64_emit_if_goto, amd64_emit_goto, amd64_write_goto_address,
+ amd64_emit_const, amd64_emit_call, amd64_emit_reg,
+ amd64_emit_pop, amd64_emit_stack_flush, amd64_emit_zero_ext,
+ amd64_emit_swap, amd64_emit_stack_adjust, amd64_emit_int_call_1,
+ amd64_emit_void_call_2, amd64_emit_eq_goto, amd64_emit_ne_goto,
+ amd64_emit_lt_goto, amd64_emit_le_goto, amd64_emit_gt_goto,
+ amd64_emit_ge_goto
+};
#endif /* __x86_64__ */
static void
i386_emit_prologue (void)
{
- EMIT_ASM32 (i386_prologue,
- "push %ebp\n\t"
- "mov %esp,%ebp\n\t"
- "push %ebx");
+ EMIT_ASM32 (i386_prologue, "push %ebp\n\t"
+ "mov %esp,%ebp\n\t"
+ "push %ebx");
/* At this point, the raw regs base address is at 8(%ebp), and the
value pointer is at 12(%ebp). */
}
@@ -2275,33 +2188,30 @@ i386_emit_prologue (void)
static void
i386_emit_epilogue (void)
{
- EMIT_ASM32 (i386_epilogue,
- "mov 12(%ebp),%ecx\n\t"
- "mov %eax,(%ecx)\n\t"
- "mov %ebx,0x4(%ecx)\n\t"
- "xor %eax,%eax\n\t"
- "pop %ebx\n\t"
- "pop %ebp\n\t"
- "ret");
+ EMIT_ASM32 (i386_epilogue, "mov 12(%ebp),%ecx\n\t"
+ "mov %eax,(%ecx)\n\t"
+ "mov %ebx,0x4(%ecx)\n\t"
+ "xor %eax,%eax\n\t"
+ "pop %ebx\n\t"
+ "pop %ebp\n\t"
+ "ret");
}
static void
i386_emit_add (void)
{
- EMIT_ASM32 (i386_add,
- "add (%esp),%eax\n\t"
- "adc 0x4(%esp),%ebx\n\t"
- "lea 0x8(%esp),%esp");
+ EMIT_ASM32 (i386_add, "add (%esp),%eax\n\t"
+ "adc 0x4(%esp),%ebx\n\t"
+ "lea 0x8(%esp),%esp");
}
static void
i386_emit_sub (void)
{
- EMIT_ASM32 (i386_sub,
- "subl %eax,(%esp)\n\t"
- "sbbl %ebx,4(%esp)\n\t"
- "pop %eax\n\t"
- "pop %ebx\n\t");
+ EMIT_ASM32 (i386_sub, "subl %eax,(%esp)\n\t"
+ "sbbl %ebx,4(%esp)\n\t"
+ "pop %eax\n\t"
+ "pop %ebx\n\t");
}
static void
@@ -2334,22 +2244,19 @@ i386_emit_ext (int arg)
switch (arg)
{
case 8:
- EMIT_ASM32 (i386_ext_8,
- "cbtw\n\t"
- "cwtl\n\t"
- "movl %eax,%ebx\n\t"
- "sarl $31,%ebx");
+ EMIT_ASM32 (i386_ext_8, "cbtw\n\t"
+ "cwtl\n\t"
+ "movl %eax,%ebx\n\t"
+ "sarl $31,%ebx");
break;
case 16:
- EMIT_ASM32 (i386_ext_16,
- "cwtl\n\t"
- "movl %eax,%ebx\n\t"
- "sarl $31,%ebx");
+ EMIT_ASM32 (i386_ext_16, "cwtl\n\t"
+ "movl %eax,%ebx\n\t"
+ "sarl $31,%ebx");
break;
case 32:
- EMIT_ASM32 (i386_ext_32,
- "movl %eax,%ebx\n\t"
- "sarl $31,%ebx");
+ EMIT_ASM32 (i386_ext_32, "movl %eax,%ebx\n\t"
+ "sarl $31,%ebx");
break;
default:
emit_error = 1;
@@ -2359,103 +2266,95 @@ i386_emit_ext (int arg)
static void
i386_emit_log_not (void)
{
- EMIT_ASM32 (i386_log_not,
- "or %ebx,%eax\n\t"
- "test %eax,%eax\n\t"
- "sete %cl\n\t"
- "xor %ebx,%ebx\n\t"
- "movzbl %cl,%eax");
+ EMIT_ASM32 (i386_log_not, "or %ebx,%eax\n\t"
+ "test %eax,%eax\n\t"
+ "sete %cl\n\t"
+ "xor %ebx,%ebx\n\t"
+ "movzbl %cl,%eax");
}
static void
i386_emit_bit_and (void)
{
- EMIT_ASM32 (i386_and,
- "and (%esp),%eax\n\t"
- "and 0x4(%esp),%ebx\n\t"
- "lea 0x8(%esp),%esp");
+ EMIT_ASM32 (i386_and, "and (%esp),%eax\n\t"
+ "and 0x4(%esp),%ebx\n\t"
+ "lea 0x8(%esp),%esp");
}
static void
i386_emit_bit_or (void)
{
- EMIT_ASM32 (i386_or,
- "or (%esp),%eax\n\t"
- "or 0x4(%esp),%ebx\n\t"
- "lea 0x8(%esp),%esp");
+ EMIT_ASM32 (i386_or, "or (%esp),%eax\n\t"
+ "or 0x4(%esp),%ebx\n\t"
+ "lea 0x8(%esp),%esp");
}
static void
i386_emit_bit_xor (void)
{
- EMIT_ASM32 (i386_xor,
- "xor (%esp),%eax\n\t"
- "xor 0x4(%esp),%ebx\n\t"
- "lea 0x8(%esp),%esp");
+ EMIT_ASM32 (i386_xor, "xor (%esp),%eax\n\t"
+ "xor 0x4(%esp),%ebx\n\t"
+ "lea 0x8(%esp),%esp");
}
static void
i386_emit_bit_not (void)
{
- EMIT_ASM32 (i386_bit_not,
- "xor $0xffffffff,%eax\n\t"
- "xor $0xffffffff,%ebx\n\t");
+ EMIT_ASM32 (i386_bit_not, "xor $0xffffffff,%eax\n\t"
+ "xor $0xffffffff,%ebx\n\t");
}
static void
i386_emit_equal (void)
{
- EMIT_ASM32 (i386_equal,
- "cmpl %ebx,4(%esp)\n\t"
- "jne .Li386_equal_false\n\t"
- "cmpl %eax,(%esp)\n\t"
- "je .Li386_equal_true\n\t"
- ".Li386_equal_false:\n\t"
- "xor %eax,%eax\n\t"
- "jmp .Li386_equal_end\n\t"
- ".Li386_equal_true:\n\t"
- "mov $1,%eax\n\t"
- ".Li386_equal_end:\n\t"
- "xor %ebx,%ebx\n\t"
- "lea 0x8(%esp),%esp");
+ EMIT_ASM32 (i386_equal, "cmpl %ebx,4(%esp)\n\t"
+ "jne .Li386_equal_false\n\t"
+ "cmpl %eax,(%esp)\n\t"
+ "je .Li386_equal_true\n\t"
+ ".Li386_equal_false:\n\t"
+ "xor %eax,%eax\n\t"
+ "jmp .Li386_equal_end\n\t"
+ ".Li386_equal_true:\n\t"
+ "mov $1,%eax\n\t"
+ ".Li386_equal_end:\n\t"
+ "xor %ebx,%ebx\n\t"
+ "lea 0x8(%esp),%esp");
}
static void
i386_emit_less_signed (void)
{
- EMIT_ASM32 (i386_less_signed,
- "cmpl %ebx,4(%esp)\n\t"
- "jl .Li386_less_signed_true\n\t"
- "jne .Li386_less_signed_false\n\t"
- "cmpl %eax,(%esp)\n\t"
- "jl .Li386_less_signed_true\n\t"
- ".Li386_less_signed_false:\n\t"
- "xor %eax,%eax\n\t"
- "jmp .Li386_less_signed_end\n\t"
- ".Li386_less_signed_true:\n\t"
- "mov $1,%eax\n\t"
- ".Li386_less_signed_end:\n\t"
- "xor %ebx,%ebx\n\t"
- "lea 0x8(%esp),%esp");
+ EMIT_ASM32 (i386_less_signed, "cmpl %ebx,4(%esp)\n\t"
+ "jl .Li386_less_signed_true\n\t"
+ "jne .Li386_less_signed_false\n\t"
+ "cmpl %eax,(%esp)\n\t"
+ "jl .Li386_less_signed_true\n\t"
+ ".Li386_less_signed_false:\n\t"
+ "xor %eax,%eax\n\t"
+ "jmp .Li386_less_signed_end\n\t"
+ ".Li386_less_signed_true:\n\t"
+ "mov $1,%eax\n\t"
+ ".Li386_less_signed_end:\n\t"
+ "xor %ebx,%ebx\n\t"
+ "lea 0x8(%esp),%esp");
}
static void
i386_emit_less_unsigned (void)
{
- EMIT_ASM32 (i386_less_unsigned,
- "cmpl %ebx,4(%esp)\n\t"
- "jb .Li386_less_unsigned_true\n\t"
- "jne .Li386_less_unsigned_false\n\t"
- "cmpl %eax,(%esp)\n\t"
- "jb .Li386_less_unsigned_true\n\t"
- ".Li386_less_unsigned_false:\n\t"
- "xor %eax,%eax\n\t"
- "jmp .Li386_less_unsigned_end\n\t"
- ".Li386_less_unsigned_true:\n\t"
- "mov $1,%eax\n\t"
- ".Li386_less_unsigned_end:\n\t"
- "xor %ebx,%ebx\n\t"
- "lea 0x8(%esp),%esp");
+ EMIT_ASM32 (i386_less_unsigned, "cmpl %ebx,4(%esp)\n\t"
+ "jb .Li386_less_unsigned_true\n\t"
+ "jne .Li386_less_unsigned_false\n\t"
+ "cmpl %eax,(%esp)\n\t"
+ "jb .Li386_less_unsigned_true\n\t"
+ ".Li386_less_unsigned_false:\n\t"
+ "xor %eax,%eax\n\t"
+ "jmp .Li386_less_unsigned_end\n\t"
+ ".Li386_less_unsigned_true:\n\t"
+ "mov $1,%eax\n\t"
+ ".Li386_less_unsigned_end:\n\t"
+ "xor %ebx,%ebx\n\t"
+ "lea 0x8(%esp),%esp");
}
static void
@@ -2464,21 +2363,17 @@ i386_emit_ref (int size)
switch (size)
{
case 1:
- EMIT_ASM32 (i386_ref1,
- "movb (%eax),%al");
+ EMIT_ASM32 (i386_ref1, "movb (%eax),%al");
break;
case 2:
- EMIT_ASM32 (i386_ref2,
- "movw (%eax),%ax");
+ EMIT_ASM32 (i386_ref2, "movw (%eax),%ax");
break;
case 4:
- EMIT_ASM32 (i386_ref4,
- "movl (%eax),%eax");
+ EMIT_ASM32 (i386_ref4, "movl (%eax),%eax");
break;
case 8:
- EMIT_ASM32 (i386_ref8,
- "movl 4(%eax),%ebx\n\t"
- "movl (%eax),%eax");
+ EMIT_ASM32 (i386_ref8, "movl 4(%eax),%ebx\n\t"
+ "movl (%eax),%eax");
break;
}
}
@@ -2487,13 +2382,13 @@ static void
i386_emit_if_goto (int *offset_p, int *size_p)
{
EMIT_ASM32 (i386_if_goto,
- "mov %eax,%ecx\n\t"
- "or %ebx,%ecx\n\t"
- "pop %eax\n\t"
- "pop %ebx\n\t"
- "cmpl $0,%ecx\n\t"
- /* Don't trust the assembler to choose the right jump */
- ".byte 0x0f, 0x85, 0x0, 0x0, 0x0, 0x0");
+ "mov %eax,%ecx\n\t"
+ "or %ebx,%ecx\n\t"
+ "pop %eax\n\t"
+ "pop %ebx\n\t"
+ "cmpl $0,%ecx\n\t"
+ /* Don't trust the assembler to choose the right jump */
+ ".byte 0x0f, 0x85, 0x0, 0x0, 0x0, 0x0");
if (offset_p)
*offset_p = 11; /* be sure that this matches the sequence above */
@@ -2505,8 +2400,8 @@ static void
i386_emit_goto (int *offset_p, int *size_p)
{
EMIT_ASM32 (i386_goto,
- /* Don't trust the assembler to choose the right jump */
- ".byte 0xe9, 0x0, 0x0, 0x0, 0x0");
+ /* Don't trust the assembler to choose the right jump */
+ ".byte 0xe9, 0x0, 0x0, 0x0, 0x0");
if (offset_p)
*offset_p = 1;
if (size_p)
@@ -2551,7 +2446,8 @@ i386_emit_const (LONGEST num)
}
else
{
- buf[i++] = 0x31; buf[i++] = 0xdb; /* xor %ebx,%ebx */
+ buf[i++] = 0x31;
+ buf[i++] = 0xdb; /* xor %ebx,%ebx */
}
append_insns (&buildaddr, i, buf);
current_insn_ptr = buildaddr;
@@ -2580,8 +2476,7 @@ i386_emit_reg (int reg)
int i;
CORE_ADDR buildaddr;
- EMIT_ASM32 (i386_reg_a,
- "sub $0x8,%esp");
+ EMIT_ASM32 (i386_reg_a, "sub $0x8,%esp");
buildaddr = current_insn_ptr;
i = 0;
buf[i++] = 0xb8; /* mov $<n>,%eax */
@@ -2589,30 +2484,26 @@ i386_emit_reg (int reg)
i += 4;
append_insns (&buildaddr, i, buf);
current_insn_ptr = buildaddr;
- EMIT_ASM32 (i386_reg_b,
- "mov %eax,4(%esp)\n\t"
- "mov 8(%ebp),%eax\n\t"
- "mov %eax,(%esp)");
+ EMIT_ASM32 (i386_reg_b, "mov %eax,4(%esp)\n\t"
+ "mov 8(%ebp),%eax\n\t"
+ "mov %eax,(%esp)");
i386_emit_call (get_raw_reg_func_addr ());
- EMIT_ASM32 (i386_reg_c,
- "xor %ebx,%ebx\n\t"
- "lea 0x8(%esp),%esp");
+ EMIT_ASM32 (i386_reg_c, "xor %ebx,%ebx\n\t"
+ "lea 0x8(%esp),%esp");
}
static void
i386_emit_pop (void)
{
- EMIT_ASM32 (i386_pop,
- "pop %eax\n\t"
- "pop %ebx");
+ EMIT_ASM32 (i386_pop, "pop %eax\n\t"
+ "pop %ebx");
}
static void
i386_emit_stack_flush (void)
{
- EMIT_ASM32 (i386_stack_flush,
- "push %ebx\n\t"
- "push %eax");
+ EMIT_ASM32 (i386_stack_flush, "push %ebx\n\t"
+ "push %eax");
}
static void
@@ -2621,18 +2512,15 @@ i386_emit_zero_ext (int arg)
switch (arg)
{
case 8:
- EMIT_ASM32 (i386_zero_ext_8,
- "and $0xff,%eax\n\t"
- "xor %ebx,%ebx");
+ EMIT_ASM32 (i386_zero_ext_8, "and $0xff,%eax\n\t"
+ "xor %ebx,%ebx");
break;
case 16:
- EMIT_ASM32 (i386_zero_ext_16,
- "and $0xffff,%eax\n\t"
- "xor %ebx,%ebx");
+ EMIT_ASM32 (i386_zero_ext_16, "and $0xffff,%eax\n\t"
+ "xor %ebx,%ebx");
break;
case 32:
- EMIT_ASM32 (i386_zero_ext_32,
- "xor %ebx,%ebx");
+ EMIT_ASM32 (i386_zero_ext_32, "xor %ebx,%ebx");
break;
default:
emit_error = 1;
@@ -2642,13 +2530,12 @@ i386_emit_zero_ext (int arg)
static void
i386_emit_swap (void)
{
- EMIT_ASM32 (i386_swap,
- "mov %eax,%ecx\n\t"
- "mov %ebx,%edx\n\t"
- "pop %eax\n\t"
- "pop %ebx\n\t"
- "push %edx\n\t"
- "push %ecx");
+ EMIT_ASM32 (i386_swap, "mov %eax,%ecx\n\t"
+ "mov %ebx,%edx\n\t"
+ "pop %eax\n\t"
+ "pop %ebx\n\t"
+ "push %edx\n\t"
+ "push %ecx");
}
static void
@@ -2677,12 +2564,12 @@ i386_emit_int_call_1 (CORE_ADDR fn, int arg1)
CORE_ADDR buildaddr;
EMIT_ASM32 (i386_int_call_1_a,
- /* Reserve a bit of stack space. */
- "sub $0x8,%esp");
+ /* Reserve a bit of stack space. */
+ "sub $0x8,%esp");
/* Put the one argument on the stack. */
buildaddr = current_insn_ptr;
i = 0;
- buf[i++] = 0xc7; /* movl $<arg1>,(%esp) */
+ buf[i++] = 0xc7; /* movl $<arg1>,(%esp) */
buf[i++] = 0x04;
buf[i++] = 0x24;
memcpy (&buf[i], &arg1, sizeof (arg1));
@@ -2690,9 +2577,8 @@ i386_emit_int_call_1 (CORE_ADDR fn, int arg1)
append_insns (&buildaddr, i, buf);
current_insn_ptr = buildaddr;
i386_emit_call (fn);
- EMIT_ASM32 (i386_int_call_1_c,
- "mov %edx,%ebx\n\t"
- "lea 0x8(%esp),%esp");
+ EMIT_ASM32 (i386_int_call_1_c, "mov %edx,%ebx\n\t"
+ "lea 0x8(%esp),%esp");
}
/* FN's prototype is `void(*fn)(int,LONGEST)'. */
@@ -2705,19 +2591,19 @@ i386_emit_void_call_2 (CORE_ADDR fn, int arg1)
CORE_ADDR buildaddr;
EMIT_ASM32 (i386_void_call_2_a,
- /* Preserve %eax only; we don't have to worry about %ebx. */
- "push %eax\n\t"
- /* Reserve a bit of stack space for arguments. */
- "sub $0x10,%esp\n\t"
- /* Copy "top" to the second argument position. (Note that
+ /* Preserve %eax only; we don't have to worry about %ebx. */
+ "push %eax\n\t"
+ /* Reserve a bit of stack space for arguments. */
+ "sub $0x10,%esp\n\t"
+ /* Copy "top" to the second argument position. (Note that
we can't assume function won't scribble on its
arguments, so don't try to restore from this.) */
- "mov %eax,4(%esp)\n\t"
- "mov %ebx,8(%esp)");
+ "mov %eax,4(%esp)\n\t"
+ "mov %ebx,8(%esp)");
/* Put the first argument on the stack. */
buildaddr = current_insn_ptr;
i = 0;
- buf[i++] = 0xc7; /* movl $<arg1>,(%esp) */
+ buf[i++] = 0xc7; /* movl $<arg1>,(%esp) */
buf[i++] = 0x04;
buf[i++] = 0x24;
memcpy (&buf[i], &arg1, sizeof (arg1));
@@ -2725,31 +2611,29 @@ i386_emit_void_call_2 (CORE_ADDR fn, int arg1)
append_insns (&buildaddr, i, buf);
current_insn_ptr = buildaddr;
i386_emit_call (fn);
- EMIT_ASM32 (i386_void_call_2_b,
- "lea 0x10(%esp),%esp\n\t"
- /* Restore original stack top. */
- "pop %eax");
+ EMIT_ASM32 (i386_void_call_2_b, "lea 0x10(%esp),%esp\n\t"
+ /* Restore original stack top. */
+ "pop %eax");
}
-
static void
i386_emit_eq_goto (int *offset_p, int *size_p)
{
EMIT_ASM32 (eq,
- /* Check low half first, more likely to be decider */
- "cmpl %eax,(%esp)\n\t"
- "jne .Leq_fallthru\n\t"
- "cmpl %ebx,4(%esp)\n\t"
- "jne .Leq_fallthru\n\t"
- "lea 0x8(%esp),%esp\n\t"
- "pop %eax\n\t"
- "pop %ebx\n\t"
- /* jmp, but don't trust the assembler to choose the right jump */
- ".byte 0xe9, 0x0, 0x0, 0x0, 0x0\n\t"
- ".Leq_fallthru:\n\t"
- "lea 0x8(%esp),%esp\n\t"
- "pop %eax\n\t"
- "pop %ebx");
+ /* Check low half first, more likely to be decider */
+ "cmpl %eax,(%esp)\n\t"
+ "jne .Leq_fallthru\n\t"
+ "cmpl %ebx,4(%esp)\n\t"
+ "jne .Leq_fallthru\n\t"
+ "lea 0x8(%esp),%esp\n\t"
+ "pop %eax\n\t"
+ "pop %ebx\n\t"
+ /* jmp, but don't trust the assembler to choose the right jump */
+ ".byte 0xe9, 0x0, 0x0, 0x0, 0x0\n\t"
+ ".Leq_fallthru:\n\t"
+ "lea 0x8(%esp),%esp\n\t"
+ "pop %eax\n\t"
+ "pop %ebx");
if (offset_p)
*offset_p = 18;
@@ -2761,21 +2645,21 @@ static void
i386_emit_ne_goto (int *offset_p, int *size_p)
{
EMIT_ASM32 (ne,
- /* Check low half first, more likely to be decider */
- "cmpl %eax,(%esp)\n\t"
- "jne .Lne_jump\n\t"
- "cmpl %ebx,4(%esp)\n\t"
- "je .Lne_fallthru\n\t"
- ".Lne_jump:\n\t"
- "lea 0x8(%esp),%esp\n\t"
- "pop %eax\n\t"
- "pop %ebx\n\t"
- /* jmp, but don't trust the assembler to choose the right jump */
- ".byte 0xe9, 0x0, 0x0, 0x0, 0x0\n\t"
- ".Lne_fallthru:\n\t"
- "lea 0x8(%esp),%esp\n\t"
- "pop %eax\n\t"
- "pop %ebx");
+ /* Check low half first, more likely to be decider */
+ "cmpl %eax,(%esp)\n\t"
+ "jne .Lne_jump\n\t"
+ "cmpl %ebx,4(%esp)\n\t"
+ "je .Lne_fallthru\n\t"
+ ".Lne_jump:\n\t"
+ "lea 0x8(%esp),%esp\n\t"
+ "pop %eax\n\t"
+ "pop %ebx\n\t"
+ /* jmp, but don't trust the assembler to choose the right jump */
+ ".byte 0xe9, 0x0, 0x0, 0x0, 0x0\n\t"
+ ".Lne_fallthru:\n\t"
+ "lea 0x8(%esp),%esp\n\t"
+ "pop %eax\n\t"
+ "pop %ebx");
if (offset_p)
*offset_p = 18;
@@ -2787,21 +2671,21 @@ static void
i386_emit_lt_goto (int *offset_p, int *size_p)
{
EMIT_ASM32 (lt,
- "cmpl %ebx,4(%esp)\n\t"
- "jl .Llt_jump\n\t"
- "jne .Llt_fallthru\n\t"
- "cmpl %eax,(%esp)\n\t"
- "jnl .Llt_fallthru\n\t"
- ".Llt_jump:\n\t"
- "lea 0x8(%esp),%esp\n\t"
- "pop %eax\n\t"
- "pop %ebx\n\t"
- /* jmp, but don't trust the assembler to choose the right jump */
- ".byte 0xe9, 0x0, 0x0, 0x0, 0x0\n\t"
- ".Llt_fallthru:\n\t"
- "lea 0x8(%esp),%esp\n\t"
- "pop %eax\n\t"
- "pop %ebx");
+ "cmpl %ebx,4(%esp)\n\t"
+ "jl .Llt_jump\n\t"
+ "jne .Llt_fallthru\n\t"
+ "cmpl %eax,(%esp)\n\t"
+ "jnl .Llt_fallthru\n\t"
+ ".Llt_jump:\n\t"
+ "lea 0x8(%esp),%esp\n\t"
+ "pop %eax\n\t"
+ "pop %ebx\n\t"
+ /* jmp, but don't trust the assembler to choose the right jump */
+ ".byte 0xe9, 0x0, 0x0, 0x0, 0x0\n\t"
+ ".Llt_fallthru:\n\t"
+ "lea 0x8(%esp),%esp\n\t"
+ "pop %eax\n\t"
+ "pop %ebx");
if (offset_p)
*offset_p = 20;
@@ -2813,21 +2697,21 @@ static void
i386_emit_le_goto (int *offset_p, int *size_p)
{
EMIT_ASM32 (le,
- "cmpl %ebx,4(%esp)\n\t"
- "jle .Lle_jump\n\t"
- "jne .Lle_fallthru\n\t"
- "cmpl %eax,(%esp)\n\t"
- "jnle .Lle_fallthru\n\t"
- ".Lle_jump:\n\t"
- "lea 0x8(%esp),%esp\n\t"
- "pop %eax\n\t"
- "pop %ebx\n\t"
- /* jmp, but don't trust the assembler to choose the right jump */
- ".byte 0xe9, 0x0, 0x0, 0x0, 0x0\n\t"
- ".Lle_fallthru:\n\t"
- "lea 0x8(%esp),%esp\n\t"
- "pop %eax\n\t"
- "pop %ebx");
+ "cmpl %ebx,4(%esp)\n\t"
+ "jle .Lle_jump\n\t"
+ "jne .Lle_fallthru\n\t"
+ "cmpl %eax,(%esp)\n\t"
+ "jnle .Lle_fallthru\n\t"
+ ".Lle_jump:\n\t"
+ "lea 0x8(%esp),%esp\n\t"
+ "pop %eax\n\t"
+ "pop %ebx\n\t"
+ /* jmp, but don't trust the assembler to choose the right jump */
+ ".byte 0xe9, 0x0, 0x0, 0x0, 0x0\n\t"
+ ".Lle_fallthru:\n\t"
+ "lea 0x8(%esp),%esp\n\t"
+ "pop %eax\n\t"
+ "pop %ebx");
if (offset_p)
*offset_p = 20;
@@ -2839,21 +2723,21 @@ static void
i386_emit_gt_goto (int *offset_p, int *size_p)
{
EMIT_ASM32 (gt,
- "cmpl %ebx,4(%esp)\n\t"
- "jg .Lgt_jump\n\t"
- "jne .Lgt_fallthru\n\t"
- "cmpl %eax,(%esp)\n\t"
- "jng .Lgt_fallthru\n\t"
- ".Lgt_jump:\n\t"
- "lea 0x8(%esp),%esp\n\t"
- "pop %eax\n\t"
- "pop %ebx\n\t"
- /* jmp, but don't trust the assembler to choose the right jump */
- ".byte 0xe9, 0x0, 0x0, 0x0, 0x0\n\t"
- ".Lgt_fallthru:\n\t"
- "lea 0x8(%esp),%esp\n\t"
- "pop %eax\n\t"
- "pop %ebx");
+ "cmpl %ebx,4(%esp)\n\t"
+ "jg .Lgt_jump\n\t"
+ "jne .Lgt_fallthru\n\t"
+ "cmpl %eax,(%esp)\n\t"
+ "jng .Lgt_fallthru\n\t"
+ ".Lgt_jump:\n\t"
+ "lea 0x8(%esp),%esp\n\t"
+ "pop %eax\n\t"
+ "pop %ebx\n\t"
+ /* jmp, but don't trust the assembler to choose the right jump */
+ ".byte 0xe9, 0x0, 0x0, 0x0, 0x0\n\t"
+ ".Lgt_fallthru:\n\t"
+ "lea 0x8(%esp),%esp\n\t"
+ "pop %eax\n\t"
+ "pop %ebx");
if (offset_p)
*offset_p = 20;
@@ -2865,21 +2749,21 @@ static void
i386_emit_ge_goto (int *offset_p, int *size_p)
{
EMIT_ASM32 (ge,
- "cmpl %ebx,4(%esp)\n\t"
- "jge .Lge_jump\n\t"
- "jne .Lge_fallthru\n\t"
- "cmpl %eax,(%esp)\n\t"
- "jnge .Lge_fallthru\n\t"
- ".Lge_jump:\n\t"
- "lea 0x8(%esp),%esp\n\t"
- "pop %eax\n\t"
- "pop %ebx\n\t"
- /* jmp, but don't trust the assembler to choose the right jump */
- ".byte 0xe9, 0x0, 0x0, 0x0, 0x0\n\t"
- ".Lge_fallthru:\n\t"
- "lea 0x8(%esp),%esp\n\t"
- "pop %eax\n\t"
- "pop %ebx");
+ "cmpl %ebx,4(%esp)\n\t"
+ "jge .Lge_jump\n\t"
+ "jne .Lge_fallthru\n\t"
+ "cmpl %eax,(%esp)\n\t"
+ "jnge .Lge_fallthru\n\t"
+ ".Lge_jump:\n\t"
+ "lea 0x8(%esp),%esp\n\t"
+ "pop %eax\n\t"
+ "pop %ebx\n\t"
+ /* jmp, but don't trust the assembler to choose the right jump */
+ ".byte 0xe9, 0x0, 0x0, 0x0, 0x0\n\t"
+ ".Lge_fallthru:\n\t"
+ "lea 0x8(%esp),%esp\n\t"
+ "pop %eax\n\t"
+ "pop %ebx");
if (offset_p)
*offset_p = 20;
@@ -2887,47 +2771,20 @@ i386_emit_ge_goto (int *offset_p, int *size_p)
*size_p = 4;
}
-static emit_ops i386_emit_ops =
- {
- i386_emit_prologue,
- i386_emit_epilogue,
- i386_emit_add,
- i386_emit_sub,
- i386_emit_mul,
- i386_emit_lsh,
- i386_emit_rsh_signed,
- i386_emit_rsh_unsigned,
- i386_emit_ext,
- i386_emit_log_not,
- i386_emit_bit_and,
- i386_emit_bit_or,
- i386_emit_bit_xor,
- i386_emit_bit_not,
- i386_emit_equal,
- i386_emit_less_signed,
- i386_emit_less_unsigned,
- i386_emit_ref,
- i386_emit_if_goto,
- i386_emit_goto,
- i386_write_goto_address,
- i386_emit_const,
- i386_emit_call,
- i386_emit_reg,
- i386_emit_pop,
- i386_emit_stack_flush,
- i386_emit_zero_ext,
- i386_emit_swap,
- i386_emit_stack_adjust,
- i386_emit_int_call_1,
- i386_emit_void_call_2,
- i386_emit_eq_goto,
- i386_emit_ne_goto,
- i386_emit_lt_goto,
- i386_emit_le_goto,
- i386_emit_gt_goto,
- i386_emit_ge_goto
- };
-
+static emit_ops i386_emit_ops
+ = { i386_emit_prologue, i386_emit_epilogue, i386_emit_add,
+ i386_emit_sub, i386_emit_mul, i386_emit_lsh,
+ i386_emit_rsh_signed, i386_emit_rsh_unsigned, i386_emit_ext,
+ i386_emit_log_not, i386_emit_bit_and, i386_emit_bit_or,
+ i386_emit_bit_xor, i386_emit_bit_not, i386_emit_equal,
+ i386_emit_less_signed, i386_emit_less_unsigned, i386_emit_ref,
+ i386_emit_if_goto, i386_emit_goto, i386_write_goto_address,
+ i386_emit_const, i386_emit_call, i386_emit_reg,
+ i386_emit_pop, i386_emit_stack_flush, i386_emit_zero_ext,
+ i386_emit_swap, i386_emit_stack_adjust, i386_emit_int_call_1,
+ i386_emit_void_call_2, i386_emit_eq_goto, i386_emit_ne_goto,
+ i386_emit_lt_goto, i386_emit_le_goto, i386_emit_gt_goto,
+ i386_emit_ge_goto };
emit_ops *
x86_target::emit_ops ()
@@ -2982,14 +2839,14 @@ initialize_low_arch (void)
#ifdef __x86_64__
tdesc_amd64_linux_no_xml = allocate_target_description ();
copy_target_description (tdesc_amd64_linux_no_xml.get (),
- amd64_linux_read_description (X86_XSTATE_SSE_MASK,
- false));
+ amd64_linux_read_description (X86_XSTATE_SSE_MASK,
+ false));
tdesc_amd64_linux_no_xml->xmltarget = xmltarget_amd64_linux_no_xml;
#endif
tdesc_i386_linux_no_xml = allocate_target_description ();
copy_target_description (tdesc_i386_linux_no_xml.get (),
- i386_linux_read_description (X86_XSTATE_SSE_MASK));
+ i386_linux_read_description (X86_XSTATE_SSE_MASK));
tdesc_i386_linux_no_xml->xmltarget = xmltarget_i386_linux_no_xml;
initialize_regsets_info (&x86_regsets_info);
diff --git a/gdbserver/linux-x86-tdesc.cc b/gdbserver/linux-x86-tdesc.cc
index ba81daa8089..026b56b824d 100644
--- a/gdbserver/linux-x86-tdesc.cc
+++ b/gdbserver/linux-x86-tdesc.cc
@@ -36,28 +36,28 @@ xcr0_to_tdesc_idx (uint64_t xcr0, bool is_x32)
if (xcr0 & X86_XSTATE_PKRU)
{
if (is_x32)
- {
- /* No x32 MPX and PKU, fall back to avx_avx512. */
- return X86_TDESC_AVX_AVX512;
- }
+ {
+ /* No x32 MPX and PKU, fall back to avx_avx512. */
+ return X86_TDESC_AVX_AVX512;
+ }
else
- return X86_TDESC_AVX_MPX_AVX512_PKU;
+ return X86_TDESC_AVX_MPX_AVX512_PKU;
}
else if (xcr0 & X86_XSTATE_AVX512)
return X86_TDESC_AVX_AVX512;
else if ((xcr0 & X86_XSTATE_AVX_MPX_MASK) == X86_XSTATE_AVX_MPX_MASK)
{
if (is_x32) /* No MPX on x32. */
- return X86_TDESC_AVX;
+ return X86_TDESC_AVX;
else
- return X86_TDESC_AVX_MPX;
+ return X86_TDESC_AVX_MPX;
}
else if (xcr0 & X86_XSTATE_MPX)
{
if (is_x32) /* No MPX on x32. */
- return X86_TDESC_AVX;
+ return X86_TDESC_AVX;
else
- return X86_TDESC_MPX;
+ return X86_TDESC_MPX;
}
else if (xcr0 & X86_XSTATE_AVX)
return X86_TDESC_AVX;
@@ -71,7 +71,7 @@ xcr0_to_tdesc_idx (uint64_t xcr0, bool is_x32)
#if defined __i386__ || !defined IN_PROCESS_AGENT
-static struct target_desc *i386_tdescs[X86_TDESC_LAST] = { };
+static struct target_desc *i386_tdescs[X86_TDESC_LAST] = {};
/* Return the target description according to XCR0. */
@@ -92,14 +92,15 @@ i386_linux_read_description (uint64_t xcr0)
init_target_desc (*tdesc, i386_expedite_regs);
}
- return *tdesc;;
+ return *tdesc;
+ ;
}
#endif
#ifdef __x86_64__
-static target_desc *amd64_tdescs[X86_TDESC_LAST] = { };
-static target_desc *x32_tdescs[X86_TDESC_LAST] = { };
+static target_desc *amd64_tdescs[X86_TDESC_LAST] = {};
+static target_desc *x32_tdescs[X86_TDESC_LAST] = {};
const struct target_desc *
amd64_linux_read_description (uint64_t xcr0, bool is_x32)
@@ -135,7 +136,7 @@ i386_get_ipa_tdesc_idx (const struct target_desc *tdesc)
for (int i = 0; i < X86_TDESC_LAST; i++)
{
if (tdesc == i386_tdescs[i])
- return i;
+ return i;
}
/* If none tdesc is found, return the one with minimum features. */
@@ -149,12 +150,12 @@ amd64_get_ipa_tdesc_idx (const struct target_desc *tdesc)
for (int i = 0; i < X86_TDESC_LAST; i++)
{
if (tdesc == amd64_tdescs[i])
- return i;
+ return i;
}
for (int i = 0; i < X86_TDESC_LAST; i++)
{
if (tdesc == x32_tdescs[i])
- return i;
+ return i;
}
return X86_TDESC_SSE;
diff --git a/gdbserver/linux-x86-tdesc.h b/gdbserver/linux-x86-tdesc.h
index a12d28d9cd9..fb89053659a 100644
--- a/gdbserver/linux-x86-tdesc.h
+++ b/gdbserver/linux-x86-tdesc.h
@@ -25,7 +25,8 @@
vs x32), it's sufficient to pass only the register set here. This,
together with the ABI known at IPA compile time, maps to a tdesc. */
-enum x86_linux_tdesc {
+enum x86_linux_tdesc
+{
X86_TDESC_MMX = 0,
X86_TDESC_SSE = 1,
X86_TDESC_AVX = 2,
@@ -48,7 +49,7 @@ const struct target_desc *i386_get_ipa_tdesc (int idx);
#ifdef __x86_64__
const struct target_desc *amd64_linux_read_description (uint64_t xcr0,
- bool is_x32);
+ bool is_x32);
#endif
const struct target_desc *i386_linux_read_description (uint64_t xcr0);
diff --git a/gdbserver/linux-xtensa-low.cc b/gdbserver/linux-xtensa-low.cc
index 9d213db1120..9ef4911c1ca 100644
--- a/gdbserver/linux-xtensa-low.cc
+++ b/gdbserver/linux-xtensa-low.cc
@@ -16,7 +16,6 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
-
#include "server.h"
#include "linux-low.h"
@@ -25,13 +24,11 @@
class xtensa_target : public linux_process_target
{
public:
-
const regs_info *get_regs_info () override;
const gdb_byte *sw_breakpoint_from_kind (int kind, int *size) override;
protected:
-
void low_arch_setup () override;
bool low_cannot_fetch_register (int regno) override;
@@ -55,14 +52,14 @@ bool
xtensa_target::low_cannot_fetch_register (int regno)
{
gdb_assert_not_reached ("linux target op low_cannot_fetch_register "
- "is not implemented by the target");
+ "is not implemented by the target");
}
bool
xtensa_target::low_cannot_store_register (int regno)
{
gdb_assert_not_reached ("linux target op low_cannot_store_register "
- "is not implemented by the target");
+ "is not implemented by the target");
}
bool
@@ -94,19 +91,24 @@ extern const struct target_desc *tdesc_xtensa;
#include "xtensa-xtregs.c"
-enum regnum {
- R_PC=0, R_PS,
- R_LBEG, R_LEND, R_LCOUNT,
- R_SAR,
- R_WS, R_WB,
- R_THREADPTR,
- R_A0 = 64
+enum regnum
+{
+ R_PC = 0,
+ R_PS,
+ R_LBEG,
+ R_LEND,
+ R_LCOUNT,
+ R_SAR,
+ R_WS,
+ R_WB,
+ R_THREADPTR,
+ R_A0 = 64
};
static void
xtensa_fill_gregset (struct regcache *regcache, void *buf)
{
- elf_greg_t* rset = (elf_greg_t*)buf;
+ elf_greg_t *rset = (elf_greg_t *) buf;
const struct target_desc *tdesc = regcache->tdesc;
int ar0_regnum;
char *ptr;
@@ -115,7 +117,7 @@ xtensa_fill_gregset (struct regcache *regcache, void *buf)
/* Take care of AR registers. */
ar0_regnum = find_regno (tdesc, "ar0");
- ptr = (char*)&rset[R_A0];
+ ptr = (char *) &rset[R_A0];
for (i = ar0_regnum; i < ar0_regnum + XCHAL_NUM_AREGS; i++)
{
@@ -129,38 +131,38 @@ xtensa_fill_gregset (struct regcache *regcache, void *buf)
ptr = (char *) &rset[R_A0 + 4 * rset[R_WB]];
for (i = a0_regnum; i < a0_regnum + C0_NREGS; i++)
- {
- if ((4 * rset[R_WB] + i - a0_regnum) == XCHAL_NUM_AREGS)
- ptr = (char *) &rset[R_A0];
- collect_register (regcache, i, ptr);
- ptr += register_size (tdesc, i);
- }
+ {
+ if ((4 * rset[R_WB] + i - a0_regnum) == XCHAL_NUM_AREGS)
+ ptr = (char *) &rset[R_A0];
+ collect_register (regcache, i, ptr);
+ ptr += register_size (tdesc, i);
+ }
}
- /* Loop registers, if hardware has it. */
+ /* Loop registers, if hardware has it. */
#if XCHAL_HAVE_LOOPS
- collect_register_by_name (regcache, "lbeg", (char*)&rset[R_LBEG]);
- collect_register_by_name (regcache, "lend", (char*)&rset[R_LEND]);
- collect_register_by_name (regcache, "lcount", (char*)&rset[R_LCOUNT]);
+ collect_register_by_name (regcache, "lbeg", (char *) &rset[R_LBEG]);
+ collect_register_by_name (regcache, "lend", (char *) &rset[R_LEND]);
+ collect_register_by_name (regcache, "lcount", (char *) &rset[R_LCOUNT]);
#endif
- collect_register_by_name (regcache, "sar", (char*)&rset[R_SAR]);
- collect_register_by_name (regcache, "pc", (char*)&rset[R_PC]);
- collect_register_by_name (regcache, "ps", (char*)&rset[R_PS]);
- collect_register_by_name (regcache, "windowbase", (char*)&rset[R_WB]);
- collect_register_by_name (regcache, "windowstart", (char*)&rset[R_WS]);
+ collect_register_by_name (regcache, "sar", (char *) &rset[R_SAR]);
+ collect_register_by_name (regcache, "pc", (char *) &rset[R_PC]);
+ collect_register_by_name (regcache, "ps", (char *) &rset[R_PS]);
+ collect_register_by_name (regcache, "windowbase", (char *) &rset[R_WB]);
+ collect_register_by_name (regcache, "windowstart", (char *) &rset[R_WS]);
#if XCHAL_HAVE_THREADPTR
collect_register_by_name (regcache, "threadptr",
- (char *) &rset[R_THREADPTR]);
+ (char *) &rset[R_THREADPTR]);
#endif
}
static void
xtensa_store_gregset (struct regcache *regcache, const void *buf)
{
- const elf_greg_t* rset = (const elf_greg_t*)buf;
+ const elf_greg_t *rset = (const elf_greg_t *) buf;
const struct target_desc *tdesc = regcache->tdesc;
int ar0_regnum;
char *ptr;
@@ -169,7 +171,7 @@ xtensa_store_gregset (struct regcache *regcache, const void *buf)
/* Take care of AR registers. */
ar0_regnum = find_regno (tdesc, "ar0");
- ptr = (char *)&rset[R_A0];
+ ptr = (char *) &rset[R_A0];
for (i = ar0_regnum; i < ar0_regnum + XCHAL_NUM_AREGS; i++)
{
@@ -183,31 +185,30 @@ xtensa_store_gregset (struct regcache *regcache, const void *buf)
ptr = (char *) &rset[R_A0 + (4 * rset[R_WB]) % XCHAL_NUM_AREGS];
for (i = a0_regnum; i < a0_regnum + C0_NREGS; i++)
- {
- if ((4 * rset[R_WB] + i - a0_regnum) == XCHAL_NUM_AREGS)
- ptr = (char *) &rset[R_A0];
- supply_register (regcache, i, ptr);
- ptr += register_size (tdesc, i);
- }
+ {
+ if ((4 * rset[R_WB] + i - a0_regnum) == XCHAL_NUM_AREGS)
+ ptr = (char *) &rset[R_A0];
+ supply_register (regcache, i, ptr);
+ ptr += register_size (tdesc, i);
+ }
}
- /* Loop registers, if hardware has it. */
+ /* Loop registers, if hardware has it. */
#if XCHAL_HAVE_LOOPS
- supply_register_by_name (regcache, "lbeg", (char*)&rset[R_LBEG]);
- supply_register_by_name (regcache, "lend", (char*)&rset[R_LEND]);
- supply_register_by_name (regcache, "lcount", (char*)&rset[R_LCOUNT]);
+ supply_register_by_name (regcache, "lbeg", (char *) &rset[R_LBEG]);
+ supply_register_by_name (regcache, "lend", (char *) &rset[R_LEND]);
+ supply_register_by_name (regcache, "lcount", (char *) &rset[R_LCOUNT]);
#endif
- supply_register_by_name (regcache, "sar", (char*)&rset[R_SAR]);
- supply_register_by_name (regcache, "pc", (char*)&rset[R_PC]);
- supply_register_by_name (regcache, "ps", (char*)&rset[R_PS]);
- supply_register_by_name (regcache, "windowbase", (char*)&rset[R_WB]);
- supply_register_by_name (regcache, "windowstart", (char*)&rset[R_WS]);
+ supply_register_by_name (regcache, "sar", (char *) &rset[R_SAR]);
+ supply_register_by_name (regcache, "pc", (char *) &rset[R_PC]);
+ supply_register_by_name (regcache, "ps", (char *) &rset[R_PS]);
+ supply_register_by_name (regcache, "windowbase", (char *) &rset[R_WB]);
+ supply_register_by_name (regcache, "windowstart", (char *) &rset[R_WS]);
#if XCHAL_HAVE_THREADPTR
- supply_register_by_name (regcache, "threadptr",
- (char *) &rset[R_THREADPTR]);
+ supply_register_by_name (regcache, "threadptr", (char *) &rset[R_THREADPTR]);
#endif
}
@@ -221,7 +222,7 @@ xtensa_fill_xtregset (struct regcache *regcache, void *buf)
for (ptr = xtensa_regmap_table; ptr->name; ptr++)
{
collect_register_by_name (regcache, ptr->name,
- (char*)buf + ptr->ptrace_offset);
+ (char *) buf + ptr->ptrace_offset);
}
}
@@ -233,24 +234,27 @@ xtensa_store_xtregset (struct regcache *regcache, const void *buf)
for (ptr = xtensa_regmap_table; ptr->name; ptr++)
{
supply_register_by_name (regcache, ptr->name,
- (char*)buf + ptr->ptrace_offset);
+ (char *) buf + ptr->ptrace_offset);
}
}
-static struct regset_info xtensa_regsets[] = {
- { PTRACE_GETREGS, PTRACE_SETREGS, 0, sizeof (elf_gregset_t),
- GENERAL_REGS,
- xtensa_fill_gregset, xtensa_store_gregset },
- { PTRACE_GETXTREGS, PTRACE_SETXTREGS, 0, XTENSA_ELF_XTREG_SIZE,
- EXTENDED_REGS,
- xtensa_fill_xtregset, xtensa_store_xtregset },
- NULL_REGSET
-};
+static struct regset_info xtensa_regsets[]
+ = { { PTRACE_GETREGS, PTRACE_SETREGS, 0, sizeof (elf_gregset_t),
+ GENERAL_REGS, xtensa_fill_gregset, xtensa_store_gregset },
+ { PTRACE_GETXTREGS, PTRACE_SETXTREGS, 0, XTENSA_ELF_XTREG_SIZE,
+ EXTENDED_REGS, xtensa_fill_xtregset, xtensa_store_xtregset },
+ NULL_REGSET };
#if XCHAL_HAVE_BE
-#define XTENSA_BREAKPOINT {0xd2,0x0f}
+#define XTENSA_BREAKPOINT \
+ { \
+ 0xd2, 0x0f \
+ }
#else
-#define XTENSA_BREAKPOINT {0x2d,0xf0}
+#define XTENSA_BREAKPOINT \
+ { \
+ 0x2d, 0xf0 \
+ }
#endif
static const gdb_byte xtensa_breakpoint[] = XTENSA_BREAKPOINT;
@@ -268,18 +272,18 @@ xtensa_target::sw_breakpoint_from_kind (int kind, int *size)
bool
xtensa_target::low_breakpoint_at (CORE_ADDR where)
{
- unsigned long insn;
+ unsigned long insn;
- read_memory (where, (unsigned char *) &insn, xtensa_breakpoint_len);
- return memcmp((char *) &insn,
- xtensa_breakpoint, xtensa_breakpoint_len) == 0;
+ read_memory (where, (unsigned char *) &insn, xtensa_breakpoint_len);
+ return memcmp ((char *) &insn, xtensa_breakpoint, xtensa_breakpoint_len)
+ == 0;
}
/* Called by libthread_db. */
ps_err_e
-ps_get_thread_area (struct ps_prochandle *ph,
- lwpid_t lwpid, int idx, void **base)
+ps_get_thread_area (struct ps_prochandle *ph, lwpid_t lwpid, int idx,
+ void **base)
{
xtensa_elf_gregset_t regs;
@@ -294,19 +298,15 @@ ps_get_thread_area (struct ps_prochandle *ph,
return PS_OK;
}
-static struct regsets_info xtensa_regsets_info =
- {
- xtensa_regsets, /* regsets */
- 0, /* num_regsets */
- NULL, /* disabled_regsets */
- };
-
-static struct regs_info myregs_info =
- {
- NULL, /* regset_bitmap */
- NULL, /* usrregs */
- &xtensa_regsets_info
- };
+static struct regsets_info xtensa_regsets_info = {
+ xtensa_regsets, /* regsets */
+ 0, /* num_regsets */
+ NULL, /* disabled_regsets */
+};
+
+static struct regs_info myregs_info = { NULL, /* regset_bitmap */
+ NULL, /* usrregs */
+ &xtensa_regsets_info };
void
xtensa_target::low_arch_setup ()
diff --git a/gdbserver/mem-break.cc b/gdbserver/mem-break.cc
index c669842228d..6e583b9c8bd 100644
--- a/gdbserver/mem-break.cc
+++ b/gdbserver/mem-break.cc
@@ -32,15 +32,15 @@
NULL. */
#define APPEND_TO_LIST(listpp, itemp, tailp) \
- do \
- { \
- if ((tailp) == NULL) \
- *(listpp) = (itemp); \
- else \
- (tailp)->next = (itemp); \
- (tailp) = (itemp); \
- } \
- while (0)
+ do \
+ { \
+ if ((tailp) == NULL) \
+ *(listpp) = (itemp); \
+ else \
+ (tailp)->next = (itemp); \
+ (tailp) = (itemp); \
+ } \
+ while (0)
/* GDB will never try to install multiple breakpoints at the same
address. However, we can see GDB requesting to insert a breakpoint
@@ -117,29 +117,29 @@ struct raw_breakpoint
/* The type of a breakpoint. */
enum bkpt_type
- {
- /* A GDB breakpoint, requested with a Z0 packet. */
- gdb_breakpoint_Z0,
+{
+ /* A GDB breakpoint, requested with a Z0 packet. */
+ gdb_breakpoint_Z0,
- /* A GDB hardware breakpoint, requested with a Z1 packet. */
- gdb_breakpoint_Z1,
+ /* A GDB hardware breakpoint, requested with a Z1 packet. */
+ gdb_breakpoint_Z1,
- /* A GDB write watchpoint, requested with a Z2 packet. */
- gdb_breakpoint_Z2,
+ /* A GDB write watchpoint, requested with a Z2 packet. */
+ gdb_breakpoint_Z2,
- /* A GDB read watchpoint, requested with a Z3 packet. */
- gdb_breakpoint_Z3,
+ /* A GDB read watchpoint, requested with a Z3 packet. */
+ gdb_breakpoint_Z3,
- /* A GDB access watchpoint, requested with a Z4 packet. */
- gdb_breakpoint_Z4,
+ /* A GDB access watchpoint, requested with a Z4 packet. */
+ gdb_breakpoint_Z4,
- /* A software single-step breakpoint. */
- single_step_breakpoint,
+ /* A software single-step breakpoint. */
+ single_step_breakpoint,
- /* Any other breakpoint type that doesn't require specific
+ /* Any other breakpoint type that doesn't require specific
treatment goes here. E.g., an event breakpoint. */
- other_breakpoint,
- };
+ other_breakpoint,
+};
struct point_cond_list
{
@@ -294,11 +294,9 @@ Z_packet_to_raw_bkpt_type (char z_type)
static int
is_gdb_breakpoint (enum bkpt_type type)
{
- return (type == gdb_breakpoint_Z0
- || type == gdb_breakpoint_Z1
- || type == gdb_breakpoint_Z2
- || type == gdb_breakpoint_Z3
- || type == gdb_breakpoint_Z4);
+ return (type == gdb_breakpoint_Z0 || type == gdb_breakpoint_Z1
+ || type == gdb_breakpoint_Z2 || type == gdb_breakpoint_Z3
+ || type == gdb_breakpoint_Z4);
}
bool
@@ -310,13 +308,13 @@ any_persistent_commands (process_info *proc)
for (bp = proc->breakpoints; bp != NULL; bp = bp->next)
{
if (is_gdb_breakpoint (bp->type))
- {
- struct gdb_breakpoint *gdb_bp = (struct gdb_breakpoint *) bp;
+ {
+ struct gdb_breakpoint *gdb_bp = (struct gdb_breakpoint *) bp;
- for (cl = gdb_bp->command_list; cl != NULL; cl = cl->next)
- if (cl->persistence)
- return true;
- }
+ for (cl = gdb_bp->command_list; cl != NULL; cl = cl->next)
+ if (cl->persistence)
+ return true;
+ }
}
return false;
@@ -332,9 +330,7 @@ find_enabled_raw_code_breakpoint_at (CORE_ADDR addr, enum raw_bkpt_type type)
struct raw_breakpoint *bp;
for (bp = proc->raw_breakpoints; bp != NULL; bp = bp->next)
- if (bp->pc == addr
- && bp->raw_type == type
- && bp->inserted >= 0)
+ if (bp->pc == addr && bp->raw_type == type && bp->inserted >= 0)
return bp;
return NULL;
@@ -371,18 +367,17 @@ insert_memory_breakpoint (struct raw_breakpoint *bp)
if (err != 0)
{
threads_debug_printf ("Failed to read shadow memory of"
- " breakpoint at 0x%s (%s).",
- paddress (bp->pc), safe_strerror (err));
+ " breakpoint at 0x%s (%s).",
+ paddress (bp->pc), safe_strerror (err));
}
else
{
memcpy (bp->old_data, buf, bp_size (bp));
- err = the_target->write_memory (bp->pc, bp_opcode (bp),
- bp_size (bp));
+ err = the_target->write_memory (bp->pc, bp_opcode (bp), bp_size (bp));
if (err != 0)
- threads_debug_printf ("Failed to insert breakpoint at 0x%s (%s).",
- paddress (bp->pc), safe_strerror (err));
+ threads_debug_printf ("Failed to insert breakpoint at 0x%s (%s).",
+ paddress (bp->pc), safe_strerror (err));
}
return err != 0 ? -1 : 0;
}
@@ -406,9 +401,9 @@ remove_memory_breakpoint (struct raw_breakpoint *bp)
memcpy (buf, bp->old_data, bp_size (bp));
err = target_write_memory (bp->pc, buf, bp_size (bp));
if (err != 0)
- threads_debug_printf ("Failed to uninsert raw breakpoint "
- "at 0x%s (%s) while deleting it.",
- paddress (bp->pc), safe_strerror (err));
+ threads_debug_printf ("Failed to uninsert raw breakpoint "
+ "at 0x%s (%s) while deleting it.",
+ paddress (bp->pc), safe_strerror (err));
return err != 0 ? -1 : 0;
}
@@ -419,7 +414,7 @@ remove_memory_breakpoint (struct raw_breakpoint *bp)
static struct raw_breakpoint *
set_raw_breakpoint_at (enum raw_bkpt_type type, CORE_ADDR where, int kind,
- int *err)
+ int *err)
{
struct process_info *proc = current_process ();
struct raw_breakpoint *bp;
@@ -428,15 +423,14 @@ set_raw_breakpoint_at (enum raw_bkpt_type type, CORE_ADDR where, int kind,
{
bp = find_enabled_raw_code_breakpoint_at (where, type);
if (bp != NULL && bp->kind != kind)
- {
- /* A different kind than previously seen. The previous
+ {
+ /* A different kind than previously seen. The previous
breakpoint must be gone then. */
- threads_debug_printf
- ("Inconsistent breakpoint kind? Was %d, now %d.",
- bp->kind, kind);
- bp->inserted = -1;
- bp = NULL;
- }
+ threads_debug_printf (
+ "Inconsistent breakpoint kind? Was %d, now %d.", bp->kind, kind);
+ bp->inserted = -1;
+ bp = NULL;
+ }
}
else
bp = find_raw_breakpoint_at (where, type, kind);
@@ -455,12 +449,12 @@ set_raw_breakpoint_at (enum raw_bkpt_type type, CORE_ADDR where, int kind,
{
*err = the_target->insert_point (bp->raw_type, bp->pc, bp->kind, bp);
if (*err != 0)
- {
- threads_debug_printf ("Failed to insert breakpoint at 0x%s (%d).",
- paddress (where), *err);
+ {
+ threads_debug_printf ("Failed to insert breakpoint at 0x%s (%d).",
+ paddress (where), *err);
- return NULL;
- }
+ return NULL;
+ }
bp->inserted = 1;
}
@@ -485,7 +479,6 @@ set_raw_breakpoint_at (enum raw_bkpt_type type, CORE_ADDR where, int kind,
"priority". In turn, this allows having fast and slow tracepoints
(and breakpoints) at the same address behave correctly. */
-
/* A fast tracepoint jump. */
struct fast_tracepoint_jump
@@ -516,13 +509,10 @@ struct fast_tracepoint_jump
};
/* Fast tracepoint FP's jump instruction to insert. */
-#define fast_tracepoint_jump_insn(fp) \
- ((fp)->insn_and_shadow + 0)
+#define fast_tracepoint_jump_insn(fp) ((fp)->insn_and_shadow + 0)
/* The shadow memory of fast tracepoint jump FP. */
-#define fast_tracepoint_jump_shadow(fp) \
- ((fp)->insn_and_shadow + (fp)->length)
-
+#define fast_tracepoint_jump_shadow(fp) ((fp)->insn_and_shadow + (fp)->length)
/* Return the fast tracepoint jump set at WHERE. */
@@ -560,16 +550,16 @@ delete_fast_tracepoint_jump (struct fast_tracepoint_jump *todel)
while (bp)
{
if (bp == todel)
- {
- if (--bp->refcount == 0)
- {
- struct fast_tracepoint_jump *prev_bp_link = *bp_link;
- unsigned char *buf;
+ {
+ if (--bp->refcount == 0)
+ {
+ struct fast_tracepoint_jump *prev_bp_link = *bp_link;
+ unsigned char *buf;
- /* Unlink it. */
- *bp_link = bp->next;
+ /* Unlink it. */
+ *bp_link = bp->next;
- /* Since there can be breakpoints inserted in the same
+ /* Since there can be breakpoints inserted in the same
address range, we use `target_write_memory', which
takes care of layering breakpoints on top of fast
tracepoints, and on top of the buffer we pass it.
@@ -578,31 +568,31 @@ delete_fast_tracepoint_jump (struct fast_tracepoint_jump *todel)
pass the current shadow contents, because
target_write_memory updates any shadow memory with
what we pass here, and we want that to be a nop. */
- buf = (unsigned char *) alloca (bp->length);
- memcpy (buf, fast_tracepoint_jump_shadow (bp), bp->length);
- ret = target_write_memory (bp->pc, buf, bp->length);
- if (ret != 0)
- {
- /* Something went wrong, relink the jump. */
- *bp_link = prev_bp_link;
-
- threads_debug_printf
- ("Failed to uninsert fast tracepoint jump "
- "at 0x%s (%s) while deleting it.",
- paddress (bp->pc), safe_strerror (ret));
- return ret;
- }
-
- free (bp);
- }
-
- return 0;
- }
+ buf = (unsigned char *) alloca (bp->length);
+ memcpy (buf, fast_tracepoint_jump_shadow (bp), bp->length);
+ ret = target_write_memory (bp->pc, buf, bp->length);
+ if (ret != 0)
+ {
+ /* Something went wrong, relink the jump. */
+ *bp_link = prev_bp_link;
+
+ threads_debug_printf (
+ "Failed to uninsert fast tracepoint jump "
+ "at 0x%s (%s) while deleting it.",
+ paddress (bp->pc), safe_strerror (ret));
+ return ret;
+ }
+
+ free (bp);
+ }
+
+ return 0;
+ }
else
- {
- bp_link = &bp->next;
- bp = *bp_link;
- }
+ {
+ bp_link = &bp->next;
+ bp = *bp_link;
+ }
}
warning ("Could not find fast tracepoint jump in list.");
@@ -616,8 +606,8 @@ inc_ref_fast_tracepoint_jump (struct fast_tracepoint_jump *jp)
}
struct fast_tracepoint_jump *
-set_fast_tracepoint_jump (CORE_ADDR where,
- unsigned char *insn, ULONGEST length)
+set_fast_tracepoint_jump (CORE_ADDR where, unsigned char *insn,
+ ULONGEST length)
{
struct process_info *proc = current_process ();
struct fast_tracepoint_jump *jp;
@@ -636,7 +626,8 @@ set_fast_tracepoint_jump (CORE_ADDR where,
/* We don't, so create a new object. Double the length, because the
flexible array member holds both the jump insn, and the
shadow. */
- jp = (struct fast_tracepoint_jump *) xcalloc (1, sizeof (*jp) + (length * 2));
+ jp
+ = (struct fast_tracepoint_jump *) xcalloc (1, sizeof (*jp) + (length * 2));
jp->pc = where;
jp->length = length;
memcpy (fast_tracepoint_jump_insn (jp), insn, length);
@@ -650,8 +641,8 @@ set_fast_tracepoint_jump (CORE_ADDR where,
if (err != 0)
{
threads_debug_printf ("Failed to read shadow memory of"
- " fast tracepoint at 0x%s (%s).",
- paddress (where), safe_strerror (err));
+ " fast tracepoint at 0x%s (%s).",
+ paddress (where), safe_strerror (err));
free (jp);
return NULL;
}
@@ -673,9 +664,9 @@ set_fast_tracepoint_jump (CORE_ADDR where,
err = target_write_memory (where, buf, length);
if (err != 0)
{
- threads_debug_printf
- ("Failed to insert fast tracepoint jump at 0x%s (%s).",
- paddress (where), safe_strerror (err));
+ threads_debug_printf (
+ "Failed to insert fast tracepoint jump at 0x%s (%s).",
+ paddress (where), safe_strerror (err));
/* Unlink it. */
proc->fast_tracepoint_jumps = jp->next;
@@ -699,8 +690,8 @@ uninsert_fast_tracepoint_jumps_at (CORE_ADDR pc)
/* This can happen when we remove all breakpoints while handling
a step-over. */
threads_debug_printf ("Could not find fast tracepoint jump at 0x%s "
- "in list (uninserting).",
- paddress (pc));
+ "in list (uninserting).",
+ paddress (pc));
return;
}
@@ -723,13 +714,13 @@ uninsert_fast_tracepoint_jumps_at (CORE_ADDR pc)
memcpy (buf, fast_tracepoint_jump_shadow (jp), jp->length);
err = target_write_memory (jp->pc, buf, jp->length);
if (err != 0)
- {
- jp->inserted = 1;
+ {
+ jp->inserted = 1;
- threads_debug_printf ("Failed to uninsert fast tracepoint jump at"
- " 0x%s (%s).",
- paddress (pc), safe_strerror (err));
- }
+ threads_debug_printf ("Failed to uninsert fast tracepoint jump at"
+ " 0x%s (%s).",
+ paddress (pc), safe_strerror (err));
+ }
}
}
@@ -746,8 +737,8 @@ reinsert_fast_tracepoint_jumps_at (CORE_ADDR where)
/* This can happen when we remove breakpoints when a tracepoint
hit causes a tracing stop, while handling a step-over. */
threads_debug_printf ("Could not find fast tracepoint jump at 0x%s "
- "in list (reinserting).",
- paddress (where));
+ "in list (reinserting).",
+ paddress (where));
return;
}
@@ -772,8 +763,8 @@ reinsert_fast_tracepoint_jumps_at (CORE_ADDR where)
jp->inserted = 0;
threads_debug_printf ("Failed to reinsert fast tracepoint jump at"
- " 0x%s (%s).",
- paddress (where), safe_strerror (err));
+ " 0x%s (%s).",
+ paddress (where), safe_strerror (err));
}
}
@@ -786,8 +777,8 @@ reinsert_fast_tracepoint_jumps_at (CORE_ADDR where)
static struct breakpoint *
set_breakpoint (enum bkpt_type type, enum raw_bkpt_type raw_type,
- CORE_ADDR where, int kind,
- int (*handler) (CORE_ADDR), int *err)
+ CORE_ADDR where, int kind, int (*handler) (CORE_ADDR),
+ int *err)
{
struct process_info *proc = current_process ();
struct breakpoint *bp;
@@ -818,7 +809,7 @@ set_breakpoint (enum bkpt_type type, enum raw_bkpt_type raw_type,
else if (type == single_step_breakpoint)
{
struct single_step_breakpoint *ss_bp
- = XCNEW (struct single_step_breakpoint);
+ = XCNEW (struct single_step_breakpoint);
bp = (struct breakpoint *) ss_bp;
}
@@ -838,15 +829,14 @@ set_breakpoint (enum bkpt_type type, enum raw_bkpt_type raw_type,
static struct breakpoint *
set_breakpoint_type_at (enum bkpt_type type, CORE_ADDR where,
- int (*handler) (CORE_ADDR))
+ int (*handler) (CORE_ADDR))
{
int err_ignored;
CORE_ADDR placed_address = where;
int breakpoint_kind = target_breakpoint_kind_from_pc (&placed_address);
- return set_breakpoint (type, raw_bkpt_type_sw,
- placed_address, breakpoint_kind, handler,
- &err_ignored);
+ return set_breakpoint (type, raw_bkpt_type_sw, placed_address,
+ breakpoint_kind, handler, &err_ignored);
}
/* See mem-break.h */
@@ -857,7 +847,6 @@ set_breakpoint_at (CORE_ADDR where, int (*handler) (CORE_ADDR))
return set_breakpoint_type_at (other_breakpoint, where, handler);
}
-
static int
delete_raw_breakpoint (struct process_info *proc, struct raw_breakpoint *todel)
{
@@ -870,37 +859,37 @@ delete_raw_breakpoint (struct process_info *proc, struct raw_breakpoint *todel)
while (bp)
{
if (bp == todel)
- {
- if (bp->inserted > 0)
- {
- struct raw_breakpoint *prev_bp_link = *bp_link;
-
- *bp_link = bp->next;
-
- ret = the_target->remove_point (bp->raw_type, bp->pc,
- bp->kind, bp);
- if (ret != 0)
- {
- /* Something went wrong, relink the breakpoint. */
- *bp_link = prev_bp_link;
-
- threads_debug_printf ("Failed to uninsert raw breakpoint "
- "at 0x%s while deleting it.",
- paddress (bp->pc));
- return ret;
- }
- }
- else
- *bp_link = bp->next;
-
- free (bp);
- return 0;
- }
+ {
+ if (bp->inserted > 0)
+ {
+ struct raw_breakpoint *prev_bp_link = *bp_link;
+
+ *bp_link = bp->next;
+
+ ret = the_target->remove_point (bp->raw_type, bp->pc, bp->kind,
+ bp);
+ if (ret != 0)
+ {
+ /* Something went wrong, relink the breakpoint. */
+ *bp_link = prev_bp_link;
+
+ threads_debug_printf ("Failed to uninsert raw breakpoint "
+ "at 0x%s while deleting it.",
+ paddress (bp->pc));
+ return ret;
+ }
+ }
+ else
+ *bp_link = bp->next;
+
+ free (bp);
+ return 0;
+ }
else
- {
- bp_link = &bp->next;
- bp = *bp_link;
- }
+ {
+ bp_link = &bp->next;
+ bp = *bp_link;
+ }
}
warning ("Could not find raw breakpoint in list.");
@@ -918,7 +907,7 @@ release_breakpoint (struct process_info *proc, struct breakpoint *bp)
{
ret = delete_raw_breakpoint (proc, bp->raw);
if (ret != 0)
- return ret;
+ return ret;
}
else
bp->raw->refcount = newrefcount;
@@ -940,21 +929,21 @@ delete_breakpoint_1 (struct process_info *proc, struct breakpoint *todel)
while (bp)
{
if (bp == todel)
- {
- *bp_link = bp->next;
+ {
+ *bp_link = bp->next;
- err = release_breakpoint (proc, bp);
- if (err != 0)
- return err;
+ err = release_breakpoint (proc, bp);
+ if (err != 0)
+ return err;
- bp = *bp_link;
- return 0;
- }
+ bp = *bp_link;
+ return 0;
+ }
else
- {
- bp_link = &bp->next;
- bp = *bp_link;
- }
+ {
+ bp_link = &bp->next;
+ bp = *bp_link;
+ }
}
warning ("Could not find breakpoint in list.");
@@ -981,7 +970,7 @@ find_gdb_breakpoint (char z_type, CORE_ADDR addr, int kind)
for (bp = proc->breakpoints; bp != NULL; bp = bp->next)
if (bp->type == type && bp->raw->pc == addr
- && (kind == -1 || bp->raw->kind == kind))
+ && (kind == -1 || bp->raw->kind == kind))
return (struct gdb_breakpoint *) bp;
return NULL;
@@ -991,7 +980,7 @@ static int
z_type_supported (char z_type)
{
return (z_type >= '0' && z_type <= '4'
- && the_target->supports_z_point_type (z_type));
+ && the_target->supports_z_point_type (z_type));
}
/* Create a new GDB breakpoint of type Z_TYPE at ADDR with kind KIND.
@@ -1027,33 +1016,32 @@ set_gdb_breakpoint (char z_type, CORE_ADDR addr, int kind, int *err)
Note this must be careful to not create a window where
breakpoints are removed from the target, for non-stop, in case
the target can poke at memory while the program is running. */
- if (z_type == Z_PACKET_SW_BP
- || z_type == Z_PACKET_HW_BP)
+ if (z_type == Z_PACKET_SW_BP || z_type == Z_PACKET_HW_BP)
{
bp = find_gdb_breakpoint (z_type, addr, -1);
if (bp != NULL)
- {
- if (bp->base.raw->kind != kind)
- {
- /* A different kind than previously seen. The previous
+ {
+ if (bp->base.raw->kind != kind)
+ {
+ /* A different kind than previously seen. The previous
breakpoint must be gone then. */
- bp->base.raw->inserted = -1;
- delete_breakpoint ((struct breakpoint *) bp);
- bp = NULL;
- }
- else if (z_type == Z_PACKET_SW_BP)
- {
- /* Check if the breakpoint is actually gone from the
+ bp->base.raw->inserted = -1;
+ delete_breakpoint ((struct breakpoint *) bp);
+ bp = NULL;
+ }
+ else if (z_type == Z_PACKET_SW_BP)
+ {
+ /* Check if the breakpoint is actually gone from the
target, due to an solib unload, for example. Might
as well validate _all_ breakpoints. */
- validate_breakpoints ();
+ validate_breakpoints ();
- /* Breakpoints that don't pass validation are
+ /* Breakpoints that don't pass validation are
deleted. */
- bp = find_gdb_breakpoint (z_type, addr, -1);
- }
- }
+ bp = find_gdb_breakpoint (z_type, addr, -1);
+ }
+ }
}
else
{
@@ -1075,8 +1063,8 @@ set_gdb_breakpoint (char z_type, CORE_ADDR addr, int kind, int *err)
raw_type = Z_packet_to_raw_bkpt_type (z_type);
type = Z_packet_to_bkpt_type (z_type);
- return (struct gdb_breakpoint *) set_breakpoint (type, raw_type, addr,
- kind, NULL, err);
+ return (struct gdb_breakpoint *) set_breakpoint (type, raw_type, addr, kind,
+ NULL, err);
}
/* Delete a GDB breakpoint of type Z_TYPE and kind KIND previously
@@ -1165,7 +1153,7 @@ clear_breakpoint_conditions_and_commands (struct gdb_breakpoint *bp)
static void
add_condition_to_breakpoint (struct gdb_breakpoint *bp,
- struct agent_expr *condition)
+ struct agent_expr *condition)
{
struct point_cond_list *new_cond;
@@ -1237,8 +1225,7 @@ gdb_condition_true_at_breakpoint_z_type (char z_type, CORE_ADDR addr)
If we failed to evaluate the expression, TRUE is returned. This
forces GDB to reevaluate the conditions. */
- for (cl = bp->cond_list;
- cl && !value && !err; cl = cl->next)
+ for (cl = bp->cond_list; cl && !value && !err; cl = cl->next)
{
/* Evaluate the condition. */
err = gdb_eval_agent_expr (&ctx, cl->cond, &value);
@@ -1255,14 +1242,14 @@ gdb_condition_true_at_breakpoint (CORE_ADDR where)
{
/* Only check code (software or hardware) breakpoints. */
return (gdb_condition_true_at_breakpoint_z_type (Z_PACKET_SW_BP, where)
- || gdb_condition_true_at_breakpoint_z_type (Z_PACKET_HW_BP, where));
+ || gdb_condition_true_at_breakpoint_z_type (Z_PACKET_HW_BP, where));
}
/* Add commands COMMANDS to GDBserver's breakpoint BP. */
static void
add_commands_to_breakpoint (struct gdb_breakpoint *bp,
- struct agent_expr *commands, int persist)
+ struct agent_expr *commands, int persist)
{
struct point_command_list *new_cmd;
@@ -1280,7 +1267,7 @@ add_commands_to_breakpoint (struct gdb_breakpoint *bp,
int
add_breakpoint_commands (struct gdb_breakpoint *bp, const char **command,
- int persist)
+ int persist)
{
const char *actparm = *command;
struct agent_expr *cmd;
@@ -1318,8 +1305,8 @@ gdb_no_commands_at_breakpoint_z_type (char z_type, CORE_ADDR addr)
return 1;
threads_debug_printf ("at 0x%s, type Z%c, bp command_list is 0x%s",
- paddress (addr), z_type,
- phex_nz ((uintptr_t) bp->command_list, 0));
+ paddress (addr), z_type,
+ phex_nz ((uintptr_t) bp->command_list, 0));
return (bp->command_list == NULL);
}
@@ -1331,7 +1318,7 @@ gdb_no_commands_at_breakpoint (CORE_ADDR where)
{
/* Only check code (software or hardware) breakpoints. */
return (gdb_no_commands_at_breakpoint_z_type (Z_PACKET_SW_BP, where)
- && gdb_no_commands_at_breakpoint_z_type (Z_PACKET_HW_BP, where));
+ && gdb_no_commands_at_breakpoint_z_type (Z_PACKET_HW_BP, where));
}
/* Run a breakpoint's commands. Returns 0 if there was a problem
@@ -1354,15 +1341,14 @@ run_breakpoint_commands_z_type (char z_type, CORE_ADDR addr)
ctx.tframe = NULL;
ctx.tpoint = NULL;
- for (cl = bp->command_list;
- cl && !value && !err; cl = cl->next)
+ for (cl = bp->command_list; cl && !value && !err; cl = cl->next)
{
/* Run the command. */
err = gdb_eval_agent_expr (&ctx, cl->cmd, &value);
/* If one command has a problem, stop digging the hole deeper. */
if (err)
- return 0;
+ return 0;
}
return 1;
@@ -1384,7 +1370,7 @@ gdb_breakpoint_here (CORE_ADDR where)
{
/* Only check code (software or hardware) breakpoints. */
return (find_gdb_breakpoint (Z_PACKET_SW_BP, where, -1) != NULL
- || find_gdb_breakpoint (Z_PACKET_HW_BP, where, -1) != NULL);
+ || find_gdb_breakpoint (Z_PACKET_HW_BP, where, -1) != NULL);
}
void
@@ -1394,8 +1380,8 @@ set_single_step_breakpoint (CORE_ADDR stop_at, ptid_t ptid)
gdb_assert (current_ptid.pid () == ptid.pid ());
- bp = (struct single_step_breakpoint *) set_breakpoint_type_at (single_step_breakpoint,
- stop_at, NULL);
+ bp = (struct single_step_breakpoint *)
+ set_breakpoint_type_at (single_step_breakpoint, stop_at, NULL);
bp->ptid = ptid;
}
@@ -1411,20 +1397,20 @@ delete_single_step_breakpoints (struct thread_info *thread)
while (bp)
{
if (bp->type == single_step_breakpoint
- && ((struct single_step_breakpoint *) bp)->ptid == ptid_of (thread))
- {
- scoped_restore_current_thread restore_thread;
-
- switch_to_thread (thread);
- *bp_link = bp->next;
- release_breakpoint (proc, bp);
- bp = *bp_link;
- }
+ && ((struct single_step_breakpoint *) bp)->ptid == ptid_of (thread))
+ {
+ scoped_restore_current_thread restore_thread;
+
+ switch_to_thread (thread);
+ *bp_link = bp->next;
+ release_breakpoint (proc, bp);
+ bp = *bp_link;
+ }
else
- {
- bp_link = &bp->next;
- bp = *bp_link;
- }
+ {
+ bp_link = &bp->next;
+ bp = *bp_link;
+ }
}
}
@@ -1434,7 +1420,7 @@ uninsert_raw_breakpoint (struct raw_breakpoint *bp)
if (bp->inserted < 0)
{
threads_debug_printf ("Breakpoint at %s is marked insert-disabled.",
- paddress (bp->pc));
+ paddress (bp->pc));
}
else if (bp->inserted > 0)
{
@@ -1444,12 +1430,12 @@ uninsert_raw_breakpoint (struct raw_breakpoint *bp)
err = the_target->remove_point (bp->raw_type, bp->pc, bp->kind, bp);
if (err != 0)
- {
- bp->inserted = 1;
+ {
+ bp->inserted = 1;
- threads_debug_printf ("Failed to uninsert raw breakpoint at 0x%s.",
- paddress (bp->pc));
- }
+ threads_debug_printf ("Failed to uninsert raw breakpoint at 0x%s.",
+ paddress (bp->pc));
+ }
}
}
@@ -1461,14 +1447,13 @@ uninsert_breakpoints_at (CORE_ADDR pc)
int found = 0;
for (bp = proc->raw_breakpoints; bp != NULL; bp = bp->next)
- if ((bp->raw_type == raw_bkpt_type_sw
- || bp->raw_type == raw_bkpt_type_hw)
- && bp->pc == pc)
+ if ((bp->raw_type == raw_bkpt_type_sw || bp->raw_type == raw_bkpt_type_hw)
+ && bp->pc == pc)
{
- found = 1;
+ found = 1;
- if (bp->inserted)
- uninsert_raw_breakpoint (bp);
+ if (bp->inserted)
+ uninsert_raw_breakpoint (bp);
}
if (!found)
@@ -1476,8 +1461,8 @@ uninsert_breakpoints_at (CORE_ADDR pc)
/* This can happen when we remove all breakpoints while handling
a step-over. */
threads_debug_printf ("Could not find breakpoint at 0x%s "
- "in list (uninserting).",
- paddress (pc));
+ "in list (uninserting).",
+ paddress (pc));
}
}
@@ -1488,9 +1473,8 @@ uninsert_all_breakpoints (void)
struct raw_breakpoint *bp;
for (bp = proc->raw_breakpoints; bp != NULL; bp = bp->next)
- if ((bp->raw_type == raw_bkpt_type_sw
- || bp->raw_type == raw_bkpt_type_hw)
- && bp->inserted)
+ if ((bp->raw_type == raw_bkpt_type_sw || bp->raw_type == raw_bkpt_type_hw)
+ && bp->inserted)
uninsert_raw_breakpoint (bp);
}
@@ -1502,21 +1486,21 @@ uninsert_single_step_breakpoints (struct thread_info *thread)
for (bp = proc->breakpoints; bp != NULL; bp = bp->next)
{
- if (bp->type == single_step_breakpoint
- && ((struct single_step_breakpoint *) bp)->ptid == ptid_of (thread))
- {
- gdb_assert (bp->raw->inserted > 0);
+ if (bp->type == single_step_breakpoint
+ && ((struct single_step_breakpoint *) bp)->ptid == ptid_of (thread))
+ {
+ gdb_assert (bp->raw->inserted > 0);
- /* Only uninsert the raw breakpoint if it only belongs to a
+ /* Only uninsert the raw breakpoint if it only belongs to a
reinsert breakpoint. */
- if (bp->raw->refcount == 1)
- {
- scoped_restore_current_thread restore_thread;
-
- switch_to_thread (thread);
- uninsert_raw_breakpoint (bp->raw);
- }
- }
+ if (bp->raw->refcount == 1)
+ {
+ scoped_restore_current_thread restore_thread;
+
+ switch_to_thread (thread);
+ uninsert_raw_breakpoint (bp->raw);
+ }
+ }
}
}
@@ -1533,7 +1517,7 @@ reinsert_raw_breakpoint (struct raw_breakpoint *bp)
bp->inserted = 1;
else
threads_debug_printf ("Failed to reinsert breakpoint at 0x%s (%d).",
- paddress (bp->pc), err);
+ paddress (bp->pc), err);
}
void
@@ -1544,13 +1528,12 @@ reinsert_breakpoints_at (CORE_ADDR pc)
int found = 0;
for (bp = proc->raw_breakpoints; bp != NULL; bp = bp->next)
- if ((bp->raw_type == raw_bkpt_type_sw
- || bp->raw_type == raw_bkpt_type_hw)
- && bp->pc == pc)
+ if ((bp->raw_type == raw_bkpt_type_sw || bp->raw_type == raw_bkpt_type_hw)
+ && bp->pc == pc)
{
- found = 1;
+ found = 1;
- reinsert_raw_breakpoint (bp);
+ reinsert_raw_breakpoint (bp);
}
if (!found)
@@ -1558,8 +1541,8 @@ reinsert_breakpoints_at (CORE_ADDR pc)
/* This can happen when we remove all breakpoints while handling
a step-over. */
threads_debug_printf ("Could not find raw breakpoint at 0x%s "
- "in list (reinserting).",
- paddress (pc));
+ "in list (reinserting).",
+ paddress (pc));
}
}
@@ -1575,13 +1558,13 @@ has_single_step_breakpoints (struct thread_info *thread)
while (bp)
{
if (bp->type == single_step_breakpoint
- && ((struct single_step_breakpoint *) bp)->ptid == ptid_of (thread))
- return 1;
+ && ((struct single_step_breakpoint *) bp)->ptid == ptid_of (thread))
+ return 1;
else
- {
- bp_link = &bp->next;
- bp = *bp_link;
- }
+ {
+ bp_link = &bp->next;
+ bp = *bp_link;
+ }
}
return 0;
@@ -1594,9 +1577,8 @@ reinsert_all_breakpoints (void)
struct raw_breakpoint *bp;
for (bp = proc->raw_breakpoints; bp != NULL; bp = bp->next)
- if ((bp->raw_type == raw_bkpt_type_sw
- || bp->raw_type == raw_bkpt_type_hw)
- && !bp->inserted)
+ if ((bp->raw_type == raw_bkpt_type_sw || bp->raw_type == raw_bkpt_type_hw)
+ && !bp->inserted)
reinsert_raw_breakpoint (bp);
}
@@ -1609,18 +1591,18 @@ reinsert_single_step_breakpoints (struct thread_info *thread)
for (bp = proc->breakpoints; bp != NULL; bp = bp->next)
{
if (bp->type == single_step_breakpoint
- && ((struct single_step_breakpoint *) bp)->ptid == ptid_of (thread))
- {
- gdb_assert (bp->raw->inserted > 0);
-
- if (bp->raw->refcount == 1)
- {
- scoped_restore_current_thread restore_thread;
-
- switch_to_thread (thread);
- reinsert_raw_breakpoint (bp->raw);
- }
- }
+ && ((struct single_step_breakpoint *) bp)->ptid == ptid_of (thread))
+ {
+ gdb_assert (bp->raw->inserted > 0);
+
+ if (bp->raw->refcount == 1)
+ {
+ scoped_restore_current_thread restore_thread;
+
+ switch_to_thread (thread);
+ reinsert_raw_breakpoint (bp->raw);
+ }
+ }
}
}
@@ -1638,31 +1620,31 @@ check_breakpoints (CORE_ADDR stop_pc)
struct raw_breakpoint *raw = bp->raw;
if ((raw->raw_type == raw_bkpt_type_sw
- || raw->raw_type == raw_bkpt_type_hw)
- && raw->pc == stop_pc)
- {
- if (!raw->inserted)
- {
- warning ("Hit a removed breakpoint?");
- return;
- }
-
- if (bp->type == other_breakpoint)
- {
- struct other_breakpoint *other_bp
- = (struct other_breakpoint *) bp;
-
- if (other_bp->handler != NULL && (*other_bp->handler) (stop_pc))
- {
- *bp_link = bp->next;
-
- release_breakpoint (proc, bp);
-
- bp = *bp_link;
- continue;
- }
- }
- }
+ || raw->raw_type == raw_bkpt_type_hw)
+ && raw->pc == stop_pc)
+ {
+ if (!raw->inserted)
+ {
+ warning ("Hit a removed breakpoint?");
+ return;
+ }
+
+ if (bp->type == other_breakpoint)
+ {
+ struct other_breakpoint *other_bp
+ = (struct other_breakpoint *) bp;
+
+ if (other_bp->handler != NULL && (*other_bp->handler) (stop_pc))
+ {
+ *bp_link = bp->next;
+
+ release_breakpoint (proc, bp);
+
+ bp = *bp_link;
+ continue;
+ }
+ }
+ }
bp_link = &bp->next;
bp = *bp_link;
@@ -1676,9 +1658,8 @@ breakpoint_here (CORE_ADDR addr)
struct raw_breakpoint *bp;
for (bp = proc->raw_breakpoints; bp != NULL; bp = bp->next)
- if ((bp->raw_type == raw_bkpt_type_sw
- || bp->raw_type == raw_bkpt_type_hw)
- && bp->pc == addr)
+ if ((bp->raw_type == raw_bkpt_type_sw || bp->raw_type == raw_bkpt_type_hw)
+ && bp->pc == addr)
return 1;
return 0;
@@ -1691,10 +1672,8 @@ breakpoint_inserted_here (CORE_ADDR addr)
struct raw_breakpoint *bp;
for (bp = proc->raw_breakpoints; bp != NULL; bp = bp->next)
- if ((bp->raw_type == raw_bkpt_type_sw
- || bp->raw_type == raw_bkpt_type_hw)
- && bp->pc == addr
- && bp->inserted)
+ if ((bp->raw_type == raw_bkpt_type_sw || bp->raw_type == raw_bkpt_type_hw)
+ && bp->pc == addr && bp->inserted)
return 1;
return 0;
@@ -1709,9 +1688,7 @@ software_breakpoint_inserted_here (CORE_ADDR addr)
struct raw_breakpoint *bp;
for (bp = proc->raw_breakpoints; bp != NULL; bp = bp->next)
- if (bp->raw_type == raw_bkpt_type_sw
- && bp->pc == addr
- && bp->inserted)
+ if (bp->raw_type == raw_bkpt_type_sw && bp->pc == addr && bp->inserted)
return 1;
return 0;
@@ -1726,9 +1703,7 @@ hardware_breakpoint_inserted_here (CORE_ADDR addr)
struct raw_breakpoint *bp;
for (bp = proc->raw_breakpoints; bp != NULL; bp = bp->next)
- if (bp->raw_type == raw_bkpt_type_hw
- && bp->pc == addr
- && bp->inserted)
+ if (bp->raw_type == raw_bkpt_type_hw && bp->pc == addr && bp->inserted)
return 1;
return 0;
@@ -1743,9 +1718,8 @@ single_step_breakpoint_inserted_here (CORE_ADDR addr)
struct breakpoint *bp;
for (bp = proc->breakpoints; bp != NULL; bp = bp->next)
- if (bp->type == single_step_breakpoint
- && bp->raw->pc == addr
- && bp->raw->inserted)
+ if (bp->type == single_step_breakpoint && bp->raw->pc == addr
+ && bp->raw->inserted)
return 1;
return 0;
@@ -1782,12 +1756,12 @@ delete_disabled_breakpoints (void)
{
next = bp->next;
if (bp->raw->inserted < 0)
- {
- /* If single_step_breakpoints become disabled, that means the
+ {
+ /* If single_step_breakpoints become disabled, that means the
manipulations (insertion and removal) of them are wrong. */
- gdb_assert (bp->type != single_step_breakpoint);
- delete_breakpoint_1 (proc, bp);
- }
+ gdb_assert (bp->type != single_step_breakpoint);
+ delete_breakpoint_1 (proc, bp);
+ }
}
}
@@ -1809,7 +1783,7 @@ validate_breakpoints (void)
struct raw_breakpoint *raw = bp->raw;
if (raw->raw_type == raw_bkpt_type_sw && raw->inserted > 0)
- validate_inserted_breakpoint (raw);
+ validate_inserted_breakpoint (raw);
}
delete_disabled_breakpoints ();
@@ -1831,29 +1805,28 @@ check_mem_read (CORE_ADDR mem_addr, unsigned char *buf, int mem_len)
int copy_offset, copy_len, buf_offset;
gdb_assert (fast_tracepoint_jump_shadow (jp) >= buf + mem_len
- || buf >= fast_tracepoint_jump_shadow (jp) + (jp)->length);
+ || buf >= fast_tracepoint_jump_shadow (jp) + (jp)->length);
if (mem_addr >= bp_end)
- continue;
+ continue;
if (jp->pc >= mem_end)
- continue;
+ continue;
start = jp->pc;
if (mem_addr > start)
- start = mem_addr;
+ start = mem_addr;
end = bp_end;
if (end > mem_end)
- end = mem_end;
+ end = mem_end;
copy_len = end - start;
copy_offset = start - jp->pc;
buf_offset = start - mem_addr;
if (jp->inserted)
- memcpy (buf + buf_offset,
- fast_tracepoint_jump_shadow (jp) + copy_offset,
- copy_len);
+ memcpy (buf + buf_offset,
+ fast_tracepoint_jump_shadow (jp) + copy_offset, copy_len);
}
for (; bp != NULL; bp = bp->next)
@@ -1863,35 +1836,35 @@ check_mem_read (CORE_ADDR mem_addr, unsigned char *buf, int mem_len)
int copy_offset, copy_len, buf_offset;
if (bp->raw_type != raw_bkpt_type_sw)
- continue;
+ continue;
gdb_assert (bp->old_data >= buf + mem_len
- || buf >= &bp->old_data[sizeof (bp->old_data)]);
+ || buf >= &bp->old_data[sizeof (bp->old_data)]);
if (mem_addr >= bp_end)
- continue;
+ continue;
if (bp->pc >= mem_end)
- continue;
+ continue;
start = bp->pc;
if (mem_addr > start)
- start = mem_addr;
+ start = mem_addr;
end = bp_end;
if (end > mem_end)
- end = mem_end;
+ end = mem_end;
copy_len = end - start;
copy_offset = start - bp->pc;
buf_offset = start - mem_addr;
if (bp->inserted > 0)
- {
- if (validate_inserted_breakpoint (bp))
- memcpy (buf + buf_offset, bp->old_data + copy_offset, copy_len);
- else
- disabled_one = 1;
- }
+ {
+ if (validate_inserted_breakpoint (bp))
+ memcpy (buf + buf_offset, bp->old_data + copy_offset, copy_len);
+ else
+ disabled_one = 1;
+ }
}
if (disabled_one)
@@ -1900,7 +1873,7 @@ check_mem_read (CORE_ADDR mem_addr, unsigned char *buf, int mem_len)
void
check_mem_write (CORE_ADDR mem_addr, unsigned char *buf,
- const unsigned char *myaddr, int mem_len)
+ const unsigned char *myaddr, int mem_len)
{
struct process_info *proc = current_process ();
struct raw_breakpoint *bp = proc->raw_breakpoints;
@@ -1917,32 +1890,33 @@ check_mem_write (CORE_ADDR mem_addr, unsigned char *buf,
int copy_offset, copy_len, buf_offset;
gdb_assert (fast_tracepoint_jump_shadow (jp) >= myaddr + mem_len
- || myaddr >= fast_tracepoint_jump_shadow (jp) + (jp)->length);
+ || myaddr
+ >= fast_tracepoint_jump_shadow (jp) + (jp)->length);
gdb_assert (fast_tracepoint_jump_insn (jp) >= buf + mem_len
- || buf >= fast_tracepoint_jump_insn (jp) + (jp)->length);
+ || buf >= fast_tracepoint_jump_insn (jp) + (jp)->length);
if (mem_addr >= jp_end)
- continue;
+ continue;
if (jp->pc >= mem_end)
- continue;
+ continue;
start = jp->pc;
if (mem_addr > start)
- start = mem_addr;
+ start = mem_addr;
end = jp_end;
if (end > mem_end)
- end = mem_end;
+ end = mem_end;
copy_len = end - start;
copy_offset = start - jp->pc;
buf_offset = start - mem_addr;
memcpy (fast_tracepoint_jump_shadow (jp) + copy_offset,
- myaddr + buf_offset, copy_len);
+ myaddr + buf_offset, copy_len);
if (jp->inserted)
- memcpy (buf + buf_offset,
- fast_tracepoint_jump_insn (jp) + copy_offset, copy_len);
+ memcpy (buf + buf_offset, fast_tracepoint_jump_insn (jp) + copy_offset,
+ copy_len);
}
for (; bp != NULL; bp = bp->next)
@@ -1952,23 +1926,23 @@ check_mem_write (CORE_ADDR mem_addr, unsigned char *buf,
int copy_offset, copy_len, buf_offset;
if (bp->raw_type != raw_bkpt_type_sw)
- continue;
+ continue;
gdb_assert (bp->old_data >= myaddr + mem_len
- || myaddr >= &bp->old_data[sizeof (bp->old_data)]);
+ || myaddr >= &bp->old_data[sizeof (bp->old_data)]);
if (mem_addr >= bp_end)
- continue;
+ continue;
if (bp->pc >= mem_end)
- continue;
+ continue;
start = bp->pc;
if (mem_addr > start)
- start = mem_addr;
+ start = mem_addr;
end = bp_end;
if (end > mem_end)
- end = mem_end;
+ end = mem_end;
copy_len = end - start;
copy_offset = start - bp->pc;
@@ -1976,12 +1950,12 @@ check_mem_write (CORE_ADDR mem_addr, unsigned char *buf,
memcpy (bp->old_data + copy_offset, myaddr + buf_offset, copy_len);
if (bp->inserted > 0)
- {
- if (validate_inserted_breakpoint (bp))
- memcpy (buf + buf_offset, bp_opcode (bp) + copy_offset, copy_len);
- else
- disabled_one = 1;
- }
+ {
+ if (validate_inserted_breakpoint (bp))
+ memcpy (buf + buf_offset, bp_opcode (bp) + copy_offset, copy_len);
+ else
+ disabled_one = 1;
+ }
}
if (disabled_one)
@@ -2070,24 +2044,22 @@ clone_one_breakpoint (const struct breakpoint *src, ptid_t ptid)
/* Clone the condition list. */
for (current_cond = ((struct gdb_breakpoint *) src)->cond_list;
- current_cond != NULL;
- current_cond = current_cond->next)
- {
- new_cond = XCNEW (struct point_cond_list);
- new_cond->cond = clone_agent_expr (current_cond->cond);
- APPEND_TO_LIST (&gdb_dest->cond_list, new_cond, cond_tail);
- }
+ current_cond != NULL; current_cond = current_cond->next)
+ {
+ new_cond = XCNEW (struct point_cond_list);
+ new_cond->cond = clone_agent_expr (current_cond->cond);
+ APPEND_TO_LIST (&gdb_dest->cond_list, new_cond, cond_tail);
+ }
/* Clone the command list. */
for (current_cmd = ((struct gdb_breakpoint *) src)->command_list;
- current_cmd != NULL;
- current_cmd = current_cmd->next)
- {
- new_cmd = XCNEW (struct point_command_list);
- new_cmd->cmd = clone_agent_expr (current_cmd->cmd);
- new_cmd->persistence = current_cmd->persistence;
- APPEND_TO_LIST (&gdb_dest->command_list, new_cmd, cmd_tail);
- }
+ current_cmd != NULL; current_cmd = current_cmd->next)
+ {
+ new_cmd = XCNEW (struct point_command_list);
+ new_cmd->cmd = clone_agent_expr (current_cmd->cmd);
+ new_cmd->persistence = current_cmd->persistence;
+ APPEND_TO_LIST (&gdb_dest->command_list, new_cmd, cmd_tail);
+ }
dest = (struct breakpoint *) gdb_dest;
}
@@ -2101,7 +2073,7 @@ clone_one_breakpoint (const struct breakpoint *src, ptid_t ptid)
else if (src->type == single_step_breakpoint)
{
struct single_step_breakpoint *ss_dest
- = XCNEW (struct single_step_breakpoint);
+ = XCNEW (struct single_step_breakpoint);
dest = (struct breakpoint *) ss_dest;
/* Since single-step breakpoint is thread specific, don't copy
@@ -2121,7 +2093,7 @@ clone_one_breakpoint (const struct breakpoint *src, ptid_t ptid)
void
clone_all_breakpoints (struct thread_info *child_thread,
- const struct thread_info *parent_thread)
+ const struct thread_info *parent_thread)
{
const struct breakpoint *bp;
struct breakpoint *new_bkpt;
diff --git a/gdbserver/mem-break.h b/gdbserver/mem-break.h
index 9bf7aa84932..bfba2cf4840 100644
--- a/gdbserver/mem-break.h
+++ b/gdbserver/mem-break.h
@@ -39,22 +39,22 @@ struct process_info;
/* The low level breakpoint types. */
enum raw_bkpt_type
- {
- /* Software/memory breakpoint. */
- raw_bkpt_type_sw,
+{
+ /* Software/memory breakpoint. */
+ raw_bkpt_type_sw,
- /* Hardware-assisted breakpoint. */
- raw_bkpt_type_hw,
+ /* Hardware-assisted breakpoint. */
+ raw_bkpt_type_hw,
- /* Hardware-assisted write watchpoint. */
- raw_bkpt_type_write_wp,
+ /* Hardware-assisted write watchpoint. */
+ raw_bkpt_type_write_wp,
- /* Hardware-assisted read watchpoint. */
- raw_bkpt_type_read_wp,
+ /* Hardware-assisted read watchpoint. */
+ raw_bkpt_type_read_wp,
- /* Hardware-assisted access watchpoint. */
- raw_bkpt_type_access_wp
- };
+ /* Hardware-assisted access watchpoint. */
+ raw_bkpt_type_access_wp
+};
/* Map the protocol breakpoint/watchpoint type Z_TYPE to the internal
raw breakpoint type. */
@@ -63,8 +63,8 @@ enum raw_bkpt_type Z_packet_to_raw_bkpt_type (char z_type);
/* Map a raw breakpoint type to an enum target_hw_bp_type. */
-enum target_hw_bp_type raw_bkpt_type_to_target_hw_bp_type
- (enum raw_bkpt_type raw_type);
+enum target_hw_bp_type
+raw_bkpt_type_to_target_hw_bp_type (enum raw_bkpt_type raw_type);
/* Create a new GDB breakpoint of type Z_TYPE at ADDR with kind KIND.
Returns a pointer to the newly created breakpoint on success. On
@@ -72,7 +72,7 @@ enum target_hw_bp_type raw_bkpt_type_to_target_hw_bp_type
Z_TYPE breakpoints are not supported on this target. */
struct gdb_breakpoint *set_gdb_breakpoint (char z_type, CORE_ADDR addr,
- int kind, int *err);
+ int kind, int *err);
/* Delete a GDB breakpoint of type Z_TYPE and kind KIND previously
inserted at ADDR with set_gdb_breakpoint_at. Returns 0 on success,
@@ -115,7 +115,7 @@ void clear_breakpoint_conditions_and_commands (struct gdb_breakpoint *bp);
past the condition and returns true. */
int add_breakpoint_condition (struct gdb_breakpoint *bp,
- const char **condition);
+ const char **condition);
/* Set target-side commands COMMANDS to the breakpoint at ADDR.
Returns false on failure. On success, advances COMMANDS past the
@@ -123,7 +123,7 @@ int add_breakpoint_condition (struct gdb_breakpoint *bp,
even while GDB is disconnected. */
int add_breakpoint_commands (struct gdb_breakpoint *bp, const char **commands,
- int persist);
+ int persist);
/* Return true if PROC has any persistent command. */
bool any_persistent_commands (process_info *proc);
@@ -148,7 +148,7 @@ int gdb_breakpoint_here (CORE_ADDR where);
breakpoint is other_breakpoint. */
struct breakpoint *set_breakpoint_at (CORE_ADDR where,
- int (*handler) (CORE_ADDR));
+ int (*handler) (CORE_ADDR));
/* Delete a breakpoint. */
@@ -213,8 +213,8 @@ void check_mem_read (CORE_ADDR mem_addr, unsigned char *buf, int mem_len);
(in BUF, a copy of MYADDR on entry) if necessary, as well as the
original data for any breakpoints. */
-void check_mem_write (CORE_ADDR mem_addr,
- unsigned char *buf, const unsigned char *myaddr, int mem_len);
+void check_mem_write (CORE_ADDR mem_addr, unsigned char *buf,
+ const unsigned char *myaddr, int mem_len);
/* Delete all breakpoints. */
@@ -237,8 +237,8 @@ void validate_breakpoints (void);
LENGTH bytes. */
struct fast_tracepoint_jump *set_fast_tracepoint_jump (CORE_ADDR where,
- unsigned char *insn,
- ULONGEST length);
+ unsigned char *insn,
+ ULONGEST length);
/* Increment reference counter of JP. */
void inc_ref_fast_tracepoint_jump (struct fast_tracepoint_jump *jp);
@@ -274,6 +274,6 @@ int remove_memory_breakpoint (struct raw_breakpoint *bp);
copy of breakpoint list in PARENT_THREAD's process. */
void clone_all_breakpoints (struct thread_info *child_thread,
- const struct thread_info *parent_thread);
+ const struct thread_info *parent_thread);
#endif /* GDBSERVER_MEM_BREAK_H */
diff --git a/gdbserver/netbsd-aarch64-low.cc b/gdbserver/netbsd-aarch64-low.cc
index da572b2be27..dccd16451be 100644
--- a/gdbserver/netbsd-aarch64-low.cc
+++ b/gdbserver/netbsd-aarch64-low.cc
@@ -32,9 +32,12 @@ netbsd_aarch64_fill_gregset (struct regcache *regcache, char *buf)
{
struct reg *r = (struct reg *) buf;
-#define netbsd_aarch64_collect_gp(regnum, fld) do { \
- collect_register (regcache, regnum, &r->fld); \
- } while (0)
+#define netbsd_aarch64_collect_gp(regnum, fld) \
+ do \
+ { \
+ collect_register (regcache, regnum, &r->fld); \
+ } \
+ while (0)
for (size_t i = 0; i < ARRAY_SIZE (r->r_reg); i++)
netbsd_aarch64_collect_gp (AARCH64_X0_REGNUM + i, r_reg[i]);
@@ -50,9 +53,12 @@ netbsd_aarch64_store_gregset (struct regcache *regcache, const char *buf)
{
struct reg *r = (struct reg *) buf;
-#define netbsd_aarch64_supply_gp(regnum, fld) do { \
- supply_register (regcache, regnum, &r->fld); \
- } while(0)
+#define netbsd_aarch64_supply_gp(regnum, fld) \
+ do \
+ { \
+ supply_register (regcache, regnum, &r->fld); \
+ } \
+ while (0)
for (size_t i = 0; i < ARRAY_SIZE (r->r_reg); i++)
netbsd_aarch64_supply_gp (AARCH64_X0_REGNUM + i, r_reg[i]);
@@ -63,13 +69,12 @@ netbsd_aarch64_store_gregset (struct regcache *regcache, const char *buf)
/* Description of all the aarch64-netbsd register sets. */
-static const struct netbsd_regset_info netbsd_target_regsets[] =
-{
+static const struct netbsd_regset_info netbsd_target_regsets[] = {
/* General Purpose Registers. */
- {PT_GETREGS, PT_SETREGS, sizeof (struct reg),
- netbsd_aarch64_fill_gregset, netbsd_aarch64_store_gregset},
+ { PT_GETREGS, PT_SETREGS, sizeof (struct reg), netbsd_aarch64_fill_gregset,
+ netbsd_aarch64_store_gregset },
/* End of list marker. */
- {0, 0, -1, NULL, NULL }
+ { 0, 0, -1, NULL, NULL }
};
/* NetBSD target op definitions for the aarch64 architecture. */
@@ -95,8 +100,7 @@ netbsd_aarch64_target::get_regs_info ()
void
netbsd_aarch64_target::low_arch_setup ()
{
- target_desc *tdesc
- = aarch64_create_target_description ({});
+ target_desc *tdesc = aarch64_create_target_description ({});
static const char *expedite_regs_aarch64[] = { "x29", "sp", "pc", NULL };
init_target_desc (tdesc, expedite_regs_aarch64);
diff --git a/gdbserver/netbsd-amd64-low.cc b/gdbserver/netbsd-amd64-low.cc
index 490a090ffd3..63d57eaa72f 100644
--- a/gdbserver/netbsd-amd64-low.cc
+++ b/gdbserver/netbsd-amd64-low.cc
@@ -30,39 +30,39 @@
enum netbsd_x86_64_gdb_regnum
{
- AMD64_RAX_REGNUM, /* %rax */
- AMD64_RBX_REGNUM, /* %rbx */
- AMD64_RCX_REGNUM, /* %rcx */
- AMD64_RDX_REGNUM, /* %rdx */
- AMD64_RSI_REGNUM, /* %rsi */
- AMD64_RDI_REGNUM, /* %rdi */
- AMD64_RBP_REGNUM, /* %rbp */
- AMD64_RSP_REGNUM, /* %rsp */
- AMD64_R8_REGNUM, /* %r8 */
- AMD64_R9_REGNUM, /* %r9 */
- AMD64_R10_REGNUM, /* %r10 */
- AMD64_R11_REGNUM, /* %r11 */
- AMD64_R12_REGNUM, /* %r12 */
- AMD64_R13_REGNUM, /* %r13 */
- AMD64_R14_REGNUM, /* %r14 */
- AMD64_R15_REGNUM, /* %r15 */
- AMD64_RIP_REGNUM, /* %rip */
- AMD64_EFLAGS_REGNUM, /* %eflags */
- AMD64_CS_REGNUM, /* %cs */
- AMD64_SS_REGNUM, /* %ss */
- AMD64_DS_REGNUM, /* %ds */
- AMD64_ES_REGNUM, /* %es */
- AMD64_FS_REGNUM, /* %fs */
- AMD64_GS_REGNUM, /* %gs */
- AMD64_ST0_REGNUM = 24, /* %st0 */
- AMD64_ST1_REGNUM, /* %st1 */
+ AMD64_RAX_REGNUM, /* %rax */
+ AMD64_RBX_REGNUM, /* %rbx */
+ AMD64_RCX_REGNUM, /* %rcx */
+ AMD64_RDX_REGNUM, /* %rdx */
+ AMD64_RSI_REGNUM, /* %rsi */
+ AMD64_RDI_REGNUM, /* %rdi */
+ AMD64_RBP_REGNUM, /* %rbp */
+ AMD64_RSP_REGNUM, /* %rsp */
+ AMD64_R8_REGNUM, /* %r8 */
+ AMD64_R9_REGNUM, /* %r9 */
+ AMD64_R10_REGNUM, /* %r10 */
+ AMD64_R11_REGNUM, /* %r11 */
+ AMD64_R12_REGNUM, /* %r12 */
+ AMD64_R13_REGNUM, /* %r13 */
+ AMD64_R14_REGNUM, /* %r14 */
+ AMD64_R15_REGNUM, /* %r15 */
+ AMD64_RIP_REGNUM, /* %rip */
+ AMD64_EFLAGS_REGNUM, /* %eflags */
+ AMD64_CS_REGNUM, /* %cs */
+ AMD64_SS_REGNUM, /* %ss */
+ AMD64_DS_REGNUM, /* %ds */
+ AMD64_ES_REGNUM, /* %es */
+ AMD64_FS_REGNUM, /* %fs */
+ AMD64_GS_REGNUM, /* %gs */
+ AMD64_ST0_REGNUM = 24, /* %st0 */
+ AMD64_ST1_REGNUM, /* %st1 */
AMD64_FCTRL_REGNUM = AMD64_ST0_REGNUM + 8,
AMD64_FSTAT_REGNUM = AMD64_ST0_REGNUM + 9,
AMD64_FTAG_REGNUM = AMD64_ST0_REGNUM + 10,
- AMD64_XMM0_REGNUM = 40, /* %xmm0 */
- AMD64_XMM1_REGNUM, /* %xmm1 */
+ AMD64_XMM0_REGNUM = 40, /* %xmm0 */
+ AMD64_XMM1_REGNUM, /* %xmm1 */
AMD64_MXCSR_REGNUM = AMD64_XMM0_REGNUM + 16,
- AMD64_YMM0H_REGNUM, /* %ymm0h */
+ AMD64_YMM0H_REGNUM, /* %ymm0h */
AMD64_YMM15H_REGNUM = AMD64_YMM0H_REGNUM + 15,
AMD64_BND0R_REGNUM = AMD64_YMM15H_REGNUM + 1,
AMD64_BND3R_REGNUM = AMD64_BND0R_REGNUM + 3,
@@ -88,9 +88,12 @@ netbsd_x86_64_fill_gregset (struct regcache *regcache, char *buf)
{
struct reg *r = (struct reg *) buf;
-#define netbsd_x86_64_collect_gp(regnum, fld) do { \
- collect_register (regcache, regnum, &r->regs[_REG_##fld]); \
- } while (0)
+#define netbsd_x86_64_collect_gp(regnum, fld) \
+ do \
+ { \
+ collect_register (regcache, regnum, &r->regs[_REG_##fld]); \
+ } \
+ while (0)
netbsd_x86_64_collect_gp (AMD64_RAX_REGNUM, RAX);
netbsd_x86_64_collect_gp (AMD64_RBX_REGNUM, RBX);
@@ -125,9 +128,12 @@ netbsd_x86_64_store_gregset (struct regcache *regcache, const char *buf)
{
struct reg *r = (struct reg *) buf;
-#define netbsd_x86_64_supply_gp(regnum, fld) do { \
- supply_register (regcache, regnum, &r->regs[_REG_##fld]); \
- } while(0)
+#define netbsd_x86_64_supply_gp(regnum, fld) \
+ do \
+ { \
+ supply_register (regcache, regnum, &r->regs[_REG_##fld]); \
+ } \
+ while (0)
netbsd_x86_64_supply_gp (AMD64_RAX_REGNUM, RAX);
netbsd_x86_64_supply_gp (AMD64_RBX_REGNUM, RBX);
@@ -157,13 +163,12 @@ netbsd_x86_64_store_gregset (struct regcache *regcache, const char *buf)
/* Description of all the x86-netbsd register sets. */
-static const struct netbsd_regset_info netbsd_target_regsets[] =
-{
+static const struct netbsd_regset_info netbsd_target_regsets[] = {
/* General Purpose Registers. */
- {PT_GETREGS, PT_SETREGS, sizeof (struct reg),
- netbsd_x86_64_fill_gregset, netbsd_x86_64_store_gregset},
+ { PT_GETREGS, PT_SETREGS, sizeof (struct reg), netbsd_x86_64_fill_gregset,
+ netbsd_x86_64_store_gregset },
/* End of list marker. */
- {0, 0, -1, NULL, NULL }
+ { 0, 0, -1, NULL, NULL }
};
/* NetBSD target op definitions for the amd64 architecture. */
@@ -189,8 +194,8 @@ netbsd_amd64_target::get_regs_info ()
void
netbsd_amd64_target::low_arch_setup ()
{
- target_desc *tdesc
- = amd64_create_target_description (X86_XSTATE_SSE_MASK, false, false, false);
+ target_desc *tdesc = amd64_create_target_description (X86_XSTATE_SSE_MASK,
+ false, false, false);
init_target_desc (tdesc, amd64_expedite_regs);
diff --git a/gdbserver/netbsd-i386-low.cc b/gdbserver/netbsd-i386-low.cc
index a482a341ece..9bf040a39a9 100644
--- a/gdbserver/netbsd-i386-low.cc
+++ b/gdbserver/netbsd-i386-low.cc
@@ -30,23 +30,23 @@
enum netbsd_i386_gdb_regnum
{
- I386_EAX_REGNUM, /* %eax */
- I386_ECX_REGNUM, /* %ecx */
- I386_EDX_REGNUM, /* %edx */
- I386_EBX_REGNUM, /* %ebx */
- I386_ESP_REGNUM, /* %esp */
- I386_EBP_REGNUM, /* %ebp */
- I386_ESI_REGNUM, /* %esi */
- I386_EDI_REGNUM, /* %edi */
- I386_EIP_REGNUM, /* %eip */
- I386_EFLAGS_REGNUM, /* %eflags */
- I386_CS_REGNUM, /* %cs */
- I386_SS_REGNUM, /* %ss */
- I386_DS_REGNUM, /* %ds */
- I386_ES_REGNUM, /* %es */
- I386_FS_REGNUM, /* %fs */
- I386_GS_REGNUM, /* %gs */
- I386_ST0_REGNUM /* %st(0) */
+ I386_EAX_REGNUM, /* %eax */
+ I386_ECX_REGNUM, /* %ecx */
+ I386_EDX_REGNUM, /* %edx */
+ I386_EBX_REGNUM, /* %ebx */
+ I386_ESP_REGNUM, /* %esp */
+ I386_EBP_REGNUM, /* %ebp */
+ I386_ESI_REGNUM, /* %esi */
+ I386_EDI_REGNUM, /* %edi */
+ I386_EIP_REGNUM, /* %eip */
+ I386_EFLAGS_REGNUM, /* %eflags */
+ I386_CS_REGNUM, /* %cs */
+ I386_SS_REGNUM, /* %ss */
+ I386_DS_REGNUM, /* %ds */
+ I386_ES_REGNUM, /* %es */
+ I386_FS_REGNUM, /* %fs */
+ I386_GS_REGNUM, /* %gs */
+ I386_ST0_REGNUM /* %st(0) */
};
/* The fill_function for the general-purpose register set. */
@@ -56,9 +56,12 @@ netbsd_i386_fill_gregset (struct regcache *regcache, char *buf)
{
struct reg *r = (struct reg *) buf;
-#define netbsd_i386_collect_gp(regnum, fld) do { \
- collect_register (regcache, regnum, &r->r_##fld); \
- } while (0)
+#define netbsd_i386_collect_gp(regnum, fld) \
+ do \
+ { \
+ collect_register (regcache, regnum, &r->r_##fld); \
+ } \
+ while (0)
netbsd_i386_collect_gp (I386_EAX_REGNUM, eax);
netbsd_i386_collect_gp (I386_EBX_REGNUM, ebx);
@@ -85,9 +88,12 @@ netbsd_i386_store_gregset (struct regcache *regcache, const char *buf)
{
struct reg *r = (struct reg *) buf;
-#define netbsd_i386_supply_gp(regnum, fld) do { \
- supply_register (regcache, regnum, &r->r_##fld); \
- } while(0)
+#define netbsd_i386_supply_gp(regnum, fld) \
+ do \
+ { \
+ supply_register (regcache, regnum, &r->r_##fld); \
+ } \
+ while (0)
netbsd_i386_supply_gp (I386_EAX_REGNUM, eax);
netbsd_i386_supply_gp (I386_EBX_REGNUM, ebx);
@@ -109,13 +115,12 @@ netbsd_i386_store_gregset (struct regcache *regcache, const char *buf)
/* Description of all the x86-netbsd register sets. */
-static const struct netbsd_regset_info netbsd_target_regsets[] =
-{
+static const struct netbsd_regset_info netbsd_target_regsets[] = {
/* General Purpose Registers. */
- {PT_GETREGS, PT_SETREGS, sizeof (struct reg),
- netbsd_i386_fill_gregset, netbsd_i386_store_gregset},
+ { PT_GETREGS, PT_SETREGS, sizeof (struct reg), netbsd_i386_fill_gregset,
+ netbsd_i386_store_gregset },
/* End of list marker. */
- {0, 0, -1, NULL, NULL }
+ { 0, 0, -1, NULL, NULL }
};
/* NetBSD target op definitions for the amd64 architecture. */
diff --git a/gdbserver/netbsd-low.cc b/gdbserver/netbsd-low.cc
index 4defd79eee4..4e10e4dc2b7 100644
--- a/gdbserver/netbsd-low.cc
+++ b/gdbserver/netbsd-low.cc
@@ -62,30 +62,31 @@ netbsd_ptrace_fun ()
if (remote_connection_is_stdio ())
{
if (close (0) < 0)
- trace_start_error_with_name (("close"));
+ trace_start_error_with_name (("close"));
if (open ("/dev/null", O_RDONLY) < 0)
- trace_start_error_with_name (("open"));
+ trace_start_error_with_name (("open"));
if (dup2 (2, 1) < 0)
- trace_start_error_with_name (("dup2"));
+ trace_start_error_with_name (("dup2"));
if (write (2, "stdin/stdout redirected\n",
- sizeof ("stdin/stdout redirected\n") - 1) < 0)
- {
- /* Errors ignored. */
- }
+ sizeof ("stdin/stdout redirected\n") - 1)
+ < 0)
+ {
+ /* Errors ignored. */
+ }
}
}
/* Implement the create_inferior method of the target_ops vector. */
int
-netbsd_process_target::create_inferior (const char *program,
- const std::vector<char *> &program_args)
+netbsd_process_target::create_inferior (
+ const char *program, const std::vector<char *> &program_args)
{
std::string str_program_args = construct_inferior_arguments (program_args);
pid_t pid = fork_inferior (program, str_program_args.c_str (),
- get_environ ()->envp (), netbsd_ptrace_fun,
- nullptr, nullptr, nullptr, nullptr);
+ get_environ ()->envp (), netbsd_ptrace_fun,
+ nullptr, nullptr, nullptr, nullptr);
add_process (pid, 0);
@@ -139,41 +140,39 @@ netbsd_process_target::resume (struct thread_resume *resume_info, size_t n)
const lwpid_t lwp = resume_ptid.lwp ();
regcache_invalidate_pid (pid);
- auto fn
- = [&] (ptid_t ptid)
+ auto fn = [&] (ptid_t ptid) {
+ if (step)
{
- if (step)
- {
- if (ptid.lwp () == lwp || n != 1)
- {
- if (ptrace (PT_SETSTEP, pid, NULL, ptid.lwp ()) == -1)
- perror_with_name (("ptrace"));
- if (ptrace (PT_RESUME, pid, NULL, ptid.lwp ()) == -1)
- perror_with_name (("ptrace"));
- }
- else
- {
- if (ptrace (PT_CLEARSTEP, pid, NULL, ptid.lwp ()) == -1)
- perror_with_name (("ptrace"));
- if (ptrace (PT_SUSPEND, pid, NULL, ptid.lwp ()) == -1)
- perror_with_name (("ptrace"));
- }
- }
- else
- {
- if (ptrace (PT_CLEARSTEP, pid, NULL, ptid.lwp ()) == -1)
- perror_with_name (("ptrace"));
- if (ptrace (PT_RESUME, pid, NULL, ptid.lwp ()) == -1)
- perror_with_name (("ptrace"));
- }
- };
+ if (ptid.lwp () == lwp || n != 1)
+ {
+ if (ptrace (PT_SETSTEP, pid, NULL, ptid.lwp ()) == -1)
+ perror_with_name (("ptrace"));
+ if (ptrace (PT_RESUME, pid, NULL, ptid.lwp ()) == -1)
+ perror_with_name (("ptrace"));
+ }
+ else
+ {
+ if (ptrace (PT_CLEARSTEP, pid, NULL, ptid.lwp ()) == -1)
+ perror_with_name (("ptrace"));
+ if (ptrace (PT_SUSPEND, pid, NULL, ptid.lwp ()) == -1)
+ perror_with_name (("ptrace"));
+ }
+ }
+ else
+ {
+ if (ptrace (PT_CLEARSTEP, pid, NULL, ptid.lwp ()) == -1)
+ perror_with_name (("ptrace"));
+ if (ptrace (PT_RESUME, pid, NULL, ptid.lwp ()) == -1)
+ perror_with_name (("ptrace"));
+ }
+ };
netbsd_nat::for_each_thread (pid, fn);
int request = gdb_catching_syscalls_p (pid) ? PT_CONTINUE : PT_SYSCALL;
errno = 0;
- ptrace (request, pid, (void *)1, signal);
+ ptrace (request, pid, (void *) 1, signal);
if (errno)
perror_with_name (("ptrace"));
}
@@ -217,22 +216,20 @@ netbsd_store_waitstatus (struct target_waitstatus *ourstatus, int hoststatus)
static pid_t
netbsd_waitpid (ptid_t ptid, struct target_waitstatus *ourstatus,
- target_wait_flags target_options)
+ target_wait_flags target_options)
{
int status;
int options = (target_options & TARGET_WNOHANG) ? WNOHANG : 0;
- pid_t pid
- = gdb::handle_eintr (-1, ::waitpid, ptid.pid (), &status, options);
+ pid_t pid = gdb::handle_eintr (-1, ::waitpid, ptid.pid (), &status, options);
if (pid == -1)
- perror_with_name (_("Child process unexpectedly missing"));
+ perror_with_name (_ ("Child process unexpectedly missing"));
netbsd_store_waitstatus (ourstatus, status);
return pid;
}
-
/* Implement the wait target_ops method.
Wait for the child specified by PTID to do something. Return the
@@ -241,7 +238,7 @@ netbsd_waitpid (ptid_t ptid, struct target_waitstatus *ourstatus,
static ptid_t
netbsd_wait (ptid_t ptid, struct target_waitstatus *ourstatus,
- target_wait_flags target_options)
+ target_wait_flags target_options)
{
pid_t pid = netbsd_waitpid (ptid, ourstatus, target_options);
ptid_t wptid = ptid_t (pid);
@@ -298,14 +295,14 @@ netbsd_wait (ptid_t ptid, struct target_waitstatus *ourstatus,
Ignore exited events for an unknown LWP. */
thread_info *thr = find_thread_ptid (wptid);
if (thr == nullptr)
- ourstatus->set_spurious ();
+ ourstatus->set_spurious ();
else
- {
- /* NetBSD does not store an LWP exit status. */
- ourstatus->set_thread_exited (0);
+ {
+ /* NetBSD does not store an LWP exit status. */
+ ourstatus->set_thread_exited (0);
- remove_thread (thr);
- }
+ remove_thread (thr);
+ }
return wptid;
}
@@ -319,40 +316,40 @@ netbsd_wait (ptid_t ptid, struct target_waitstatus *ourstatus,
not yet reported their PTRACE_LWP_CREATE event. Ignore
born events for an already-known LWP. */
if (find_thread_ptid (wptid))
- ourstatus->set_spurious ();
+ ourstatus->set_spurious ();
else
- {
- add_thread (wptid, NULL);
- ourstatus->set_thread_created ();
- }
+ {
+ add_thread (wptid, NULL);
+ ourstatus->set_thread_created ();
+ }
return wptid;
}
if (code == TRAP_EXEC)
{
- ourstatus->set_execd
- (make_unique_xstrdup (netbsd_nat::pid_to_exec_file (pid)));
+ ourstatus->set_execd (
+ make_unique_xstrdup (netbsd_nat::pid_to_exec_file (pid)));
return wptid;
}
if (code == TRAP_TRACE)
- return wptid;
+ return wptid;
if (code == TRAP_SCE || code == TRAP_SCX)
{
int sysnum = si->si_sysnum;
- if (!netbsd_catch_this_syscall(sysnum))
- {
- /* If the core isn't interested in this event, ignore it. */
- ourstatus->set_spurious ();
- return wptid;
- }
+ if (!netbsd_catch_this_syscall (sysnum))
+ {
+ /* If the core isn't interested in this event, ignore it. */
+ ourstatus->set_spurious ();
+ return wptid;
+ }
if (code == TRAP_SCE)
- ourstatus->set_syscall_entry (sysnum);
+ ourstatus->set_syscall_entry (sysnum);
else
- ourstatus->set_syscall_return (sysnum);
+ ourstatus->set_syscall_return (sysnum);
return wptid;
}
@@ -379,7 +376,7 @@ netbsd_wait (ptid_t ptid, struct target_waitstatus *ourstatus,
ptid_t
netbsd_process_target::wait (ptid_t ptid, struct target_waitstatus *ourstatus,
- target_wait_flags target_options)
+ target_wait_flags target_options)
{
while (true)
{
@@ -391,35 +388,35 @@ netbsd_process_target::wait (ptid_t ptid, struct target_waitstatus *ourstatus,
This may also happen on attach, when an event is registered on a thread
that was not fully initialized during the attach stage. */
if (wptid.lwp () != 0 && !find_thread_ptid (wptid)
- && ourstatus->kind () != TARGET_WAITKIND_THREAD_EXITED)
- add_thread (wptid, nullptr);
+ && ourstatus->kind () != TARGET_WAITKIND_THREAD_EXITED)
+ add_thread (wptid, nullptr);
switch (ourstatus->kind ())
- {
- case TARGET_WAITKIND_EXITED:
- case TARGET_WAITKIND_STOPPED:
- case TARGET_WAITKIND_SIGNALLED:
- case TARGET_WAITKIND_FORKED:
- case TARGET_WAITKIND_VFORKED:
- case TARGET_WAITKIND_EXECD:
- case TARGET_WAITKIND_VFORK_DONE:
- case TARGET_WAITKIND_SYSCALL_ENTRY:
- case TARGET_WAITKIND_SYSCALL_RETURN:
- /* Pass the result to the generic code. */
- return wptid;
- case TARGET_WAITKIND_THREAD_CREATED:
- case TARGET_WAITKIND_THREAD_EXITED:
- /* The core needlessly stops on these events. */
- /* FALLTHROUGH */
- case TARGET_WAITKIND_SPURIOUS:
- /* Spurious events are unhandled by the gdbserver core. */
- if (ptrace (PT_CONTINUE, current_process ()->pid, (void *) 1, 0)
- == -1)
- perror_with_name (("ptrace"));
- break;
- default:
- error (("Unknown stopped status"));
- }
+ {
+ case TARGET_WAITKIND_EXITED:
+ case TARGET_WAITKIND_STOPPED:
+ case TARGET_WAITKIND_SIGNALLED:
+ case TARGET_WAITKIND_FORKED:
+ case TARGET_WAITKIND_VFORKED:
+ case TARGET_WAITKIND_EXECD:
+ case TARGET_WAITKIND_VFORK_DONE:
+ case TARGET_WAITKIND_SYSCALL_ENTRY:
+ case TARGET_WAITKIND_SYSCALL_RETURN:
+ /* Pass the result to the generic code. */
+ return wptid;
+ case TARGET_WAITKIND_THREAD_CREATED:
+ case TARGET_WAITKIND_THREAD_EXITED:
+ /* The core needlessly stops on these events. */
+ /* FALLTHROUGH */
+ case TARGET_WAITKIND_SPURIOUS:
+ /* Spurious events are unhandled by the gdbserver core. */
+ if (ptrace (PT_CONTINUE, current_process ()->pid, (void *) 1, 0)
+ == -1)
+ perror_with_name (("ptrace"));
+ break;
+ default:
+ error (("Unknown stopped status"));
+ }
}
}
@@ -491,9 +488,9 @@ netbsd_process_target::fetch_registers (struct regcache *regcache, int regno)
std::vector<char> buf;
buf.resize (regset->size);
int res = ptrace (regset->get_request, inferior_ptid.pid (), buf.data (),
- inferior_ptid.lwp ());
+ inferior_ptid.lwp ());
if (res == -1)
- perror_with_name (("ptrace"));
+ perror_with_name (("ptrace"));
regset->store_function (regcache, buf.data ());
regset++;
}
@@ -512,17 +509,17 @@ netbsd_process_target::store_registers (struct regcache *regcache, int regno)
std::vector<char> buf;
buf.resize (regset->size);
int res = ptrace (regset->get_request, inferior_ptid.pid (), buf.data (),
- inferior_ptid.lwp ());
+ inferior_ptid.lwp ());
if (res == -1)
- perror_with_name (("ptrace"));
+ perror_with_name (("ptrace"));
/* Then overlay our cached registers on that. */
regset->fill_function (regcache, buf.data ());
/* Only now do we write the register set. */
- res = ptrace (regset->set_request, inferior_ptid.pid (), buf. data (),
- inferior_ptid.lwp ());
+ res = ptrace (regset->set_request, inferior_ptid.pid (), buf.data (),
+ inferior_ptid.lwp ());
if (res == -1)
- perror_with_name (("ptrace"));
+ perror_with_name (("ptrace"));
regset++;
}
}
@@ -531,7 +528,7 @@ netbsd_process_target::store_registers (struct regcache *regcache, int regno)
int
netbsd_process_target::read_memory (CORE_ADDR memaddr, unsigned char *myaddr,
- int size)
+ int size)
{
pid_t pid = current_process ()->pid;
return netbsd_nat::read_memory (pid, myaddr, memaddr, size, nullptr);
@@ -541,7 +538,7 @@ netbsd_process_target::read_memory (CORE_ADDR memaddr, unsigned char *myaddr,
int
netbsd_process_target::write_memory (CORE_ADDR memaddr,
- const unsigned char *myaddr, int size)
+ const unsigned char *myaddr, int size)
{
pid_t pid = current_process ()->pid;
return netbsd_nat::write_memory (pid, myaddr, memaddr, size, nullptr);
@@ -562,7 +559,7 @@ netbsd_process_target::request_interrupt ()
and output arguments. */
static size_t
-netbsd_read_auxv(pid_t pid, void *offs, void *addr, size_t len)
+netbsd_read_auxv (pid_t pid, void *offs, void *addr, size_t len)
{
struct ptrace_io_desc pio;
@@ -582,7 +579,7 @@ netbsd_read_auxv(pid_t pid, void *offs, void *addr, size_t len)
int
netbsd_process_target::read_auxv (int pid, CORE_ADDR offset,
- unsigned char *myaddr, unsigned int len)
+ unsigned char *myaddr, unsigned int len)
{
return netbsd_read_auxv (pid, (void *) (intptr_t) offset, myaddr, len);
}
@@ -607,7 +604,7 @@ netbsd_process_target::supports_z_point_type (char z_type)
int
netbsd_process_target::insert_point (enum raw_bkpt_type type, CORE_ADDR addr,
- int size, struct raw_breakpoint *bp)
+ int size, struct raw_breakpoint *bp)
{
switch (type)
{
@@ -626,7 +623,7 @@ netbsd_process_target::insert_point (enum raw_bkpt_type type, CORE_ADDR addr,
int
netbsd_process_target::remove_point (enum raw_bkpt_type type, CORE_ADDR addr,
- int size, struct raw_breakpoint *bp)
+ int size, struct raw_breakpoint *bp)
{
switch (type)
{
@@ -652,8 +649,8 @@ netbsd_process_target::stopped_by_sw_breakpoint ()
if (ptrace (PT_GET_SIGINFO, pid, &psi, sizeof (psi)) == -1)
perror_with_name (("ptrace"));
- return psi.psi_siginfo.si_signo == SIGTRAP &&
- psi.psi_siginfo.si_code == TRAP_BRKPT;
+ return psi.psi_siginfo.si_signo == SIGTRAP
+ && psi.psi_siginfo.si_code == TRAP_BRKPT;
}
/* Implement the supports_stopped_by_sw_breakpoint target_ops method. */
@@ -675,16 +672,18 @@ netbsd_process_target::supports_qxfer_siginfo ()
/* Implement the qxfer_siginfo target_ops method. */
int
-netbsd_process_target::qxfer_siginfo (const char *annex, unsigned char *readbuf,
- unsigned const char *writebuf,
- CORE_ADDR offset, int len)
+netbsd_process_target::qxfer_siginfo (const char *annex,
+ unsigned char *readbuf,
+ unsigned const char *writebuf,
+ CORE_ADDR offset, int len)
{
if (current_thread == nullptr)
return -1;
pid_t pid = current_process ()->pid;
- return netbsd_nat::qxfer_siginfo(pid, annex, readbuf, writebuf, offset, len);
+ return netbsd_nat::qxfer_siginfo (pid, annex, readbuf, writebuf, offset,
+ len);
}
/* Implement the supports_non_stop target_ops method. */
@@ -737,12 +736,13 @@ netbsd_process_target::supports_disable_randomization ()
/* Extract &phdr and num_phdr in the inferior. Return 0 on success. */
-template <typename T>
-int get_phdr_phnum_from_proc_auxv (const pid_t pid,
- CORE_ADDR *phdr_memaddr, int *num_phdr)
+template<typename T>
+int
+get_phdr_phnum_from_proc_auxv (const pid_t pid, CORE_ADDR *phdr_memaddr,
+ int *num_phdr)
{
- typedef typename std::conditional<sizeof(T) == sizeof(int64_t),
- Aux64Info, Aux32Info>::type auxv_type;
+ typedef typename std::conditional<sizeof (T) == sizeof (int64_t), Aux64Info,
+ Aux32Info>::type auxv_type;
const size_t auxv_size = sizeof (auxv_type);
const size_t auxv_buf_size = 128 * sizeof (auxv_type);
@@ -754,31 +754,30 @@ int get_phdr_phnum_from_proc_auxv (const pid_t pid,
*phdr_memaddr = 0;
*num_phdr = 0;
- for (char *buf = auxv_buf.data ();
- buf < (auxv_buf.data () + auxv_buf_size);
+ for (char *buf = auxv_buf.data (); buf < (auxv_buf.data () + auxv_buf_size);
buf += auxv_size)
{
auxv_type *const aux = (auxv_type *) buf;
switch (aux->a_type)
- {
- case AT_PHDR:
- *phdr_memaddr = aux->a_v;
- break;
- case AT_PHNUM:
- *num_phdr = aux->a_v;
- break;
- }
+ {
+ case AT_PHDR:
+ *phdr_memaddr = aux->a_v;
+ break;
+ case AT_PHNUM:
+ *num_phdr = aux->a_v;
+ break;
+ }
if (*phdr_memaddr != 0 && *num_phdr != 0)
- break;
+ break;
}
if (*phdr_memaddr == 0 || *num_phdr == 0)
{
warning ("Unexpected missing AT_PHDR and/or AT_PHNUM: "
- "phdr_memaddr = %s, phdr_num = %d",
- core_addr_to_string (*phdr_memaddr), *num_phdr);
+ "phdr_memaddr = %s, phdr_num = %d",
+ core_addr_to_string (*phdr_memaddr), *num_phdr);
return 2;
}
@@ -787,12 +786,12 @@ int get_phdr_phnum_from_proc_auxv (const pid_t pid,
/* Return &_DYNAMIC (via PT_DYNAMIC) in the inferior, or 0 if not present. */
-template <typename T>
+template<typename T>
static CORE_ADDR
get_dynamic (const pid_t pid)
{
- typedef typename std::conditional<sizeof(T) == sizeof(int64_t),
- Elf64_Phdr, Elf32_Phdr>::type phdr_type;
+ typedef typename std::conditional<sizeof (T) == sizeof (int64_t), Elf64_Phdr,
+ Elf32_Phdr>::type phdr_type;
const int phdr_size = sizeof (phdr_type);
CORE_ADDR phdr_memaddr;
@@ -804,7 +803,7 @@ get_dynamic (const pid_t pid)
phdr_buf.resize (num_phdr * phdr_size);
if (netbsd_nat::read_memory (pid, phdr_buf.data (), phdr_memaddr,
- phdr_buf.size (), nullptr))
+ phdr_buf.size (), nullptr))
return 0;
/* Compute relocation: it is expected to be 0 for "regular" executables,
@@ -815,7 +814,7 @@ get_dynamic (const pid_t pid)
phdr_type *const p = (phdr_type *) (phdr_buf.data () + i * phdr_size);
if (p->p_type == PT_PHDR)
- relocation = phdr_memaddr - p->p_vaddr;
+ relocation = phdr_memaddr - p->p_vaddr;
}
if (relocation == -1)
@@ -838,7 +837,7 @@ get_dynamic (const pid_t pid)
phdr_type *const p = (phdr_type *) (phdr_buf.data () + i * phdr_size);
if (p->p_type == PT_DYNAMIC)
- return p->p_vaddr + relocation;
+ return p->p_vaddr + relocation;
}
return 0;
@@ -849,14 +848,14 @@ get_dynamic (const pid_t pid)
We look for DT_MIPS_RLD_MAP first. MIPS executables use this instead of
DT_DEBUG, although they sometimes contain an unused DT_DEBUG entry too. */
-template <typename T>
+template<typename T>
static CORE_ADDR
get_r_debug (const pid_t pid)
{
- typedef typename std::conditional<sizeof(T) == sizeof(int64_t),
- Elf64_Dyn, Elf32_Dyn>::type dyn_type;
+ typedef typename std::conditional<sizeof (T) == sizeof (int64_t), Elf64_Dyn,
+ Elf32_Dyn>::type dyn_type;
const int dyn_size = sizeof (dyn_type);
- unsigned char buf[sizeof (dyn_type)]; /* The larger of the two. */
+ unsigned char buf[sizeof (dyn_type)]; /* The larger of the two. */
CORE_ADDR map = -1;
CORE_ADDR dynamic_memaddr = get_dynamic<T> (pid);
@@ -864,32 +863,32 @@ get_r_debug (const pid_t pid)
return map;
while (netbsd_nat::read_memory (pid, buf, dynamic_memaddr, dyn_size, nullptr)
- == 0)
+ == 0)
{
dyn_type *const dyn = (dyn_type *) buf;
#if defined DT_MIPS_RLD_MAP
union
{
- T map;
- unsigned char buf[sizeof (T)];
- }
- rld_map;
+ T map;
+ unsigned char buf[sizeof (T)];
+ } rld_map;
if (dyn->d_tag == DT_MIPS_RLD_MAP)
- {
- if (netbsd_nat::read_memory (pid, rld_map.buf, dyn->d_un.d_val,
- sizeof (rld_map.buf), nullptr) == 0)
- return rld_map.map;
- else
- break;
- }
-#endif /* DT_MIPS_RLD_MAP */
+ {
+ if (netbsd_nat::read_memory (pid, rld_map.buf, dyn->d_un.d_val,
+ sizeof (rld_map.buf), nullptr)
+ == 0)
+ return rld_map.map;
+ else
+ break;
+ }
+#endif /* DT_MIPS_RLD_MAP */
if (dyn->d_tag == DT_DEBUG && map == -1)
- map = dyn->d_un.d_val;
+ map = dyn->d_un.d_val;
if (dyn->d_tag == DT_NULL)
- break;
+ break;
dynamic_memaddr += dyn_size;
}
@@ -914,27 +913,28 @@ read_one_ptr (const pid_t pid, CORE_ADDR memaddr, CORE_ADDR *ptr, int ptr_size)
unsigned char uc;
} addr;
- int ret = netbsd_nat::read_memory (pid, &addr.uc, memaddr, ptr_size, nullptr);
+ int ret
+ = netbsd_nat::read_memory (pid, &addr.uc, memaddr, ptr_size, nullptr);
if (ret == 0)
{
if (ptr_size == sizeof (CORE_ADDR))
- *ptr = addr.core_addr;
+ *ptr = addr.core_addr;
else if (ptr_size == sizeof (unsigned int))
- *ptr = addr.ui;
+ *ptr = addr.ui;
else
- gdb_assert_not_reached ("unhandled pointer size");
+ gdb_assert_not_reached ("unhandled pointer size");
}
return ret;
}
/* Construct qXfer:libraries-svr4:read reply. */
-template <typename T>
+template<typename T>
int
netbsd_qxfer_libraries_svr4 (const pid_t pid, const char *annex,
- unsigned char *readbuf,
- unsigned const char *writebuf,
- CORE_ADDR offset, int len)
+ unsigned char *readbuf,
+ unsigned const char *writebuf, CORE_ADDR offset,
+ int len)
{
struct link_map_offsets
{
@@ -960,57 +960,55 @@ netbsd_qxfer_libraries_svr4 (const pid_t pid, const char *annex,
int l_prev_offset;
};
- static const struct link_map_offsets lmo_32bit_offsets =
- {
- 0, /* r_version offset. */
- 4, /* r_debug.r_map offset. */
- 0, /* l_addr offset in link_map. */
- 4, /* l_name offset in link_map. */
- 8, /* l_ld offset in link_map. */
- 12, /* l_next offset in link_map. */
- 16 /* l_prev offset in link_map. */
- };
-
- static const struct link_map_offsets lmo_64bit_offsets =
- {
- 0, /* r_version offset. */
- 8, /* r_debug.r_map offset. */
- 0, /* l_addr offset in link_map. */
- 8, /* l_name offset in link_map. */
- 16, /* l_ld offset in link_map. */
- 24, /* l_next offset in link_map. */
- 32 /* l_prev offset in link_map. */
- };
+ static const struct link_map_offsets lmo_32bit_offsets = {
+ 0, /* r_version offset. */
+ 4, /* r_debug.r_map offset. */
+ 0, /* l_addr offset in link_map. */
+ 4, /* l_name offset in link_map. */
+ 8, /* l_ld offset in link_map. */
+ 12, /* l_next offset in link_map. */
+ 16 /* l_prev offset in link_map. */
+ };
+
+ static const struct link_map_offsets lmo_64bit_offsets = {
+ 0, /* r_version offset. */
+ 8, /* r_debug.r_map offset. */
+ 0, /* l_addr offset in link_map. */
+ 8, /* l_name offset in link_map. */
+ 16, /* l_ld offset in link_map. */
+ 24, /* l_next offset in link_map. */
+ 32 /* l_prev offset in link_map. */
+ };
CORE_ADDR lm_addr = 0, lm_prev = 0;
CORE_ADDR l_name, l_addr, l_ld, l_next, l_prev;
int header_done = 0;
const struct link_map_offsets *lmo
- = ((sizeof (T) == sizeof (int64_t))
- ? &lmo_64bit_offsets : &lmo_32bit_offsets);
+ = ((sizeof (T) == sizeof (int64_t)) ? &lmo_64bit_offsets
+ : &lmo_32bit_offsets);
int ptr_size = sizeof (T);
while (annex[0] != '\0')
{
const char *sep = strchr (annex, '=');
if (sep == nullptr)
- break;
+ break;
int name_len = sep - annex;
CORE_ADDR *addrp;
if (name_len == 5 && startswith (annex, "start"))
- addrp = &lm_addr;
+ addrp = &lm_addr;
else if (name_len == 4 && startswith (annex, "prev"))
- addrp = &lm_prev;
+ addrp = &lm_prev;
else
- {
- annex = strchr (sep, ';');
- if (annex == nullptr)
- break;
- annex++;
- continue;
- }
+ {
+ annex = strchr (sep, ';');
+ if (annex == nullptr)
+ break;
+ annex++;
+ continue;
+ }
annex = decode_address_to_semicolon (addrp, sep + 1);
}
@@ -1023,37 +1021,34 @@ netbsd_qxfer_libraries_svr4 (const pid_t pid, const char *annex,
for this inferior - do not retry it. Report it to GDB as
E01, see for the reasons at the GDB solib-svr4.c side. */
if (r_debug == (CORE_ADDR) -1)
- return -1;
+ return -1;
if (r_debug != 0)
- {
- CORE_ADDR map_offset = r_debug + lmo->r_map_offset;
- if (read_one_ptr (pid, map_offset, &lm_addr, ptr_size) != 0)
- warning ("unable to read r_map from %s",
- core_addr_to_string (map_offset));
- }
+ {
+ CORE_ADDR map_offset = r_debug + lmo->r_map_offset;
+ if (read_one_ptr (pid, map_offset, &lm_addr, ptr_size) != 0)
+ warning ("unable to read r_map from %s",
+ core_addr_to_string (map_offset));
+ }
}
std::string document = "<library-list-svr4 version=\"1.0\"";
- while (lm_addr
- && read_one_ptr (pid, lm_addr + lmo->l_name_offset,
- &l_name, ptr_size) == 0
- && read_one_ptr (pid, lm_addr + lmo->l_addr_offset,
- &l_addr, ptr_size) == 0
- && read_one_ptr (pid, lm_addr + lmo->l_ld_offset,
- &l_ld, ptr_size) == 0
- && read_one_ptr (pid, lm_addr + lmo->l_prev_offset,
- &l_prev, ptr_size) == 0
- && read_one_ptr (pid, lm_addr + lmo->l_next_offset,
- &l_next, ptr_size) == 0)
+ while (
+ lm_addr
+ && read_one_ptr (pid, lm_addr + lmo->l_name_offset, &l_name, ptr_size) == 0
+ && read_one_ptr (pid, lm_addr + lmo->l_addr_offset, &l_addr, ptr_size) == 0
+ && read_one_ptr (pid, lm_addr + lmo->l_ld_offset, &l_ld, ptr_size) == 0
+ && read_one_ptr (pid, lm_addr + lmo->l_prev_offset, &l_prev, ptr_size) == 0
+ && read_one_ptr (pid, lm_addr + lmo->l_next_offset, &l_next, ptr_size)
+ == 0)
{
if (lm_prev != l_prev)
- {
- warning ("Corrupted shared library list: 0x%lx != 0x%lx",
- (long) lm_prev, (long) l_prev);
- break;
- }
+ {
+ warning ("Corrupted shared library list: 0x%lx != 0x%lx",
+ (long) lm_prev, (long) l_prev);
+ break;
+ }
/* Ignore the first entry even if it has valid name as the first entry
corresponds to the main executable. The first entry should not be
@@ -1062,35 +1057,36 @@ netbsd_qxfer_libraries_svr4 (const pid_t pid, const char *annex,
executable does not have PT_DYNAMIC present and this function already
exited above due to failed get_r_debug. */
if (lm_prev == 0)
- string_appendf (document, " main-lm=\"0x%lx\"",
- (unsigned long) lm_addr);
+ string_appendf (document, " main-lm=\"0x%lx\"",
+ (unsigned long) lm_addr);
else
- {
- unsigned char libname[PATH_MAX];
+ {
+ unsigned char libname[PATH_MAX];
- /* Not checking for error because reading may stop before
+ /* Not checking for error because reading may stop before
we've got PATH_MAX worth of characters. */
- libname[0] = '\0';
- netbsd_nat::read_memory (pid, libname, l_name, sizeof (libname) - 1,
- nullptr);
- libname[sizeof (libname) - 1] = '\0';
- if (libname[0] != '\0')
- {
- if (!header_done)
- {
- /* Terminate `<library-list-svr4'. */
- document += '>';
- header_done = 1;
- }
-
- string_appendf (document, "<library name=\"");
- xml_escape_text_append (document, (char *) libname);
- string_appendf (document, "\" lm=\"0x%lx\" "
- "l_addr=\"0x%lx\" l_ld=\"0x%lx\"/>",
- (unsigned long) lm_addr, (unsigned long) l_addr,
- (unsigned long) l_ld);
- }
- }
+ libname[0] = '\0';
+ netbsd_nat::read_memory (pid, libname, l_name, sizeof (libname) - 1,
+ nullptr);
+ libname[sizeof (libname) - 1] = '\0';
+ if (libname[0] != '\0')
+ {
+ if (!header_done)
+ {
+ /* Terminate `<library-list-svr4'. */
+ document += '>';
+ header_done = 1;
+ }
+
+ string_appendf (document, "<library name=\"");
+ xml_escape_text_append (document, (char *) libname);
+ string_appendf (document,
+ "\" lm=\"0x%lx\" "
+ "l_addr=\"0x%lx\" l_ld=\"0x%lx\"/>",
+ (unsigned long) lm_addr, (unsigned long) l_addr,
+ (unsigned long) l_ld);
+ }
+ }
lm_prev = lm_addr;
lm_addr = l_next;
@@ -1136,8 +1132,7 @@ elf_64_file_p (const char *file)
if (ret != sizeof (header))
error ("Cannot read ELF file header: %s", file);
- if (header.e_ident[EI_MAG0] != ELFMAG0
- || header.e_ident[EI_MAG1] != ELFMAG1
+ if (header.e_ident[EI_MAG0] != ELFMAG0 || header.e_ident[EI_MAG1] != ELFMAG1
|| header.e_ident[EI_MAG2] != ELFMAG2
|| header.e_ident[EI_MAG3] != ELFMAG3)
error ("Unrecognized ELF file header: %s", file);
@@ -1149,9 +1144,9 @@ elf_64_file_p (const char *file)
int
netbsd_process_target::qxfer_libraries_svr4 (const char *annex,
- unsigned char *readbuf,
- unsigned const char *writebuf,
- CORE_ADDR offset, int len)
+ unsigned char *readbuf,
+ unsigned const char *writebuf,
+ CORE_ADDR offset, int len)
{
if (writebuf != nullptr)
return -2;
@@ -1163,11 +1158,11 @@ netbsd_process_target::qxfer_libraries_svr4 (const char *annex,
bool is_elf64 = elf_64_file_p (netbsd_nat::pid_to_exec_file (pid));
if (is_elf64)
- return netbsd_qxfer_libraries_svr4<int64_t> (pid, annex, readbuf,
- writebuf, offset, len);
+ return netbsd_qxfer_libraries_svr4<int64_t> (pid, annex, readbuf, writebuf,
+ offset, len);
else
- return netbsd_qxfer_libraries_svr4<int32_t> (pid, annex, readbuf,
- writebuf, offset, len);
+ return netbsd_qxfer_libraries_svr4<int32_t> (pid, annex, readbuf, writebuf,
+ offset, len);
}
/* Implement the supports_qxfer_libraries_svr4 target_ops method. */
@@ -1207,7 +1202,7 @@ netbsd_process_target::supports_hardware_single_step ()
const gdb_byte *
netbsd_process_target::sw_breakpoint_from_kind (int kind, int *size)
{
- static gdb_byte brkpt[PTRACE_BREAKPOINT_SIZE] = {*PTRACE_BREAKPOINT};
+ static gdb_byte brkpt[PTRACE_BREAKPOINT_SIZE] = { *PTRACE_BREAKPOINT };
*size = PTRACE_BREAKPOINT_SIZE;
diff --git a/gdbserver/netbsd-low.h b/gdbserver/netbsd-low.h
index 050b43fc54f..93038412f82 100644
--- a/gdbserver/netbsd-low.h
+++ b/gdbserver/netbsd-low.h
@@ -40,9 +40,8 @@ struct netbsd_regset_info
class netbsd_process_target : public process_stratum_target
{
public:
-
int create_inferior (const char *program,
- const std::vector<char *> &program_args) override;
+ const std::vector<char *> &program_args) override;
void post_create_inferior () override;
@@ -61,24 +60,23 @@ public:
void resume (thread_resume *resume_info, size_t n) override;
ptid_t wait (ptid_t ptid, target_waitstatus *status,
- target_wait_flags options) override;
+ target_wait_flags options) override;
void fetch_registers (regcache *regcache, int regno) override;
void store_registers (regcache *regcache, int regno) override;
- int read_memory (CORE_ADDR memaddr, unsigned char *myaddr,
- int len) override;
+ int read_memory (CORE_ADDR memaddr, unsigned char *myaddr, int len) override;
int write_memory (CORE_ADDR memaddr, const unsigned char *myaddr,
- int len) override;
+ int len) override;
void request_interrupt () override;
bool supports_read_auxv () override;
int read_auxv (int pid, CORE_ADDR offset, unsigned char *myaddr,
- unsigned int len) override;
+ unsigned int len) override;
bool supports_hardware_single_step () override;
@@ -86,19 +84,19 @@ public:
bool supports_z_point_type (char z_type) override;
- int insert_point (enum raw_bkpt_type type, CORE_ADDR addr,
- int size, struct raw_breakpoint *bp) override;
+ int insert_point (enum raw_bkpt_type type, CORE_ADDR addr, int size,
+ struct raw_breakpoint *bp) override;
- int remove_point (enum raw_bkpt_type type, CORE_ADDR addr,
- int size, struct raw_breakpoint *bp) override;
+ int remove_point (enum raw_bkpt_type type, CORE_ADDR addr, int size,
+ struct raw_breakpoint *bp) override;
bool stopped_by_sw_breakpoint () override;
bool supports_qxfer_siginfo () override;
int qxfer_siginfo (const char *annex, unsigned char *readbuf,
- unsigned const char *writebuf, CORE_ADDR offset,
- int len) override;
+ unsigned const char *writebuf, CORE_ADDR offset,
+ int len) override;
bool supports_stopped_by_sw_breakpoint () override;
@@ -116,8 +114,8 @@ public:
bool supports_qxfer_libraries_svr4 () override;
- int qxfer_libraries_svr4 (const char*, unsigned char*, const unsigned char*,
- CORE_ADDR, int) override;
+ int qxfer_libraries_svr4 (const char *, unsigned char *,
+ const unsigned char *, CORE_ADDR, int) override;
bool supports_pid_to_exec_file () override;
diff --git a/gdbserver/notif.cc b/gdbserver/notif.cc
index 9b323b4a869..5618f570d27 100644
--- a/gdbserver/notif.cc
+++ b/gdbserver/notif.cc
@@ -50,8 +50,7 @@
#include "server.h"
#include "notif.h"
-static struct notif_server *notifs[] =
-{
+static struct notif_server *notifs[] = {
&notif_stop,
};
@@ -85,9 +84,8 @@ handle_notif_ack (char *own_buf, int packet_len)
{
const char *ack_name = notifs[i]->ack_name;
- if (startswith (own_buf, ack_name)
- && packet_len == strlen (ack_name))
- break;
+ if (startswith (own_buf, ack_name) && packet_len == strlen (ack_name))
+ break;
}
if (i == ARRAY_SIZE (notifs))
@@ -103,7 +101,7 @@ handle_notif_ack (char *own_buf, int packet_len)
np->queue.pop_front ();
remote_debug_printf ("%s: acking %d", np->ack_name,
- (int) np->queue.size ());
+ (int) np->queue.size ());
delete head;
}
@@ -116,14 +114,12 @@ handle_notif_ack (char *own_buf, int packet_len)
/* Put EVENT to the queue of NOTIF. */
void
-notif_event_enque (struct notif_server *notif,
- struct notif_event *event)
+notif_event_enque (struct notif_server *notif, struct notif_event *event)
{
notif->queue.push_back (event);
remote_debug_printf ("pending events: %s %d", notif->notif_name,
- (int) notif->queue.size ());
-
+ (int) notif->queue.size ());
}
/* Push one event NEW_EVENT of notification NP into NP->queue. */
diff --git a/gdbserver/notif.h b/gdbserver/notif.h
index bb93619e0a9..044a12569d8 100644
--- a/gdbserver/notif.h
+++ b/gdbserver/notif.h
@@ -28,9 +28,7 @@
struct notif_event
{
- virtual ~notif_event ()
- {
- }
+ virtual ~notif_event () {}
/* No payload needed. */
};
@@ -62,7 +60,6 @@ int handle_notif_ack (char *own_buf, int packet_len);
void notif_write_event (struct notif_server *notif, char *own_buf);
void notif_push (struct notif_server *np, struct notif_event *event);
-void notif_event_enque (struct notif_server *notif,
- struct notif_event *event);
+void notif_event_enque (struct notif_server *notif, struct notif_event *event);
#endif /* GDBSERVER_NOTIF_H */
diff --git a/gdbserver/proc-service.cc b/gdbserver/proc-service.cc
index 2d516a0cad7..4750e52729d 100644
--- a/gdbserver/proc-service.cc
+++ b/gdbserver/proc-service.cc
@@ -48,7 +48,7 @@ gregset_info (void)
while (regsets_info->regsets[i].size != -1)
{
if (regsets_info->regsets[i].type == GENERAL_REGS)
- break;
+ break;
i++;
}
@@ -61,8 +61,8 @@ gregset_info (void)
symbol is stored in SYM_ADDR. */
ps_err_e
-ps_pglobal_lookup (gdb_ps_prochandle_t ph, const char *obj,
- const char *name, psaddr_t *sym_addr)
+ps_pglobal_lookup (gdb_ps_prochandle_t ph, const char *obj, const char *name,
+ psaddr_t *sym_addr)
{
CORE_ADDR addr;
@@ -77,8 +77,8 @@ ps_pglobal_lookup (gdb_ps_prochandle_t ph, const char *obj,
them into BUF. */
ps_err_e
-ps_pdread (gdb_ps_prochandle_t ph, psaddr_t addr,
- gdb_ps_read_buf_t buf, gdb_ps_size_t size)
+ps_pdread (gdb_ps_prochandle_t ph, psaddr_t addr, gdb_ps_read_buf_t buf,
+ gdb_ps_size_t size)
{
if (read_inferior_memory ((uintptr_t) addr, (gdb_byte *) buf, size) != 0)
return PS_ERR;
@@ -88,8 +88,8 @@ ps_pdread (gdb_ps_prochandle_t ph, psaddr_t addr,
/* Write SIZE bytes from BUF into the target process PH at address ADDR. */
ps_err_e
-ps_pdwrite (gdb_ps_prochandle_t ph, psaddr_t addr,
- gdb_ps_write_buf_t buf, gdb_ps_size_t size)
+ps_pdwrite (gdb_ps_prochandle_t ph, psaddr_t addr, gdb_ps_write_buf_t buf,
+ gdb_ps_size_t size)
{
if (target_write_memory ((uintptr_t) addr, (const gdb_byte *) buf, size)
!= 0)
@@ -146,7 +146,8 @@ ps_lgetfpregs (gdb_ps_prochandle_t ph, lwpid_t lwpid, prfpregset_t *fpregset)
process PH from FPREGSET. */
ps_err_e
-ps_lsetfpregs (gdb_ps_prochandle_t ph, lwpid_t lwpid, const prfpregset_t *fpregset)
+ps_lsetfpregs (gdb_ps_prochandle_t ph, lwpid_t lwpid,
+ const prfpregset_t *fpregset)
{
/* Unneeded. */
return PS_ERR;
diff --git a/gdbserver/regcache.cc b/gdbserver/regcache.cc
index 0b1141662ac..c0df07f638c 100644
--- a/gdbserver/regcache.cc
+++ b/gdbserver/regcache.cc
@@ -54,7 +54,7 @@ get_thread_regcache (struct thread_info *thread, int fetch)
switch_to_thread (thread);
/* Invalidate all registers, to prevent stale left-overs. */
memset (regcache->register_status, REG_UNAVAILABLE,
- regcache->tdesc->reg_defs.size ());
+ regcache->tdesc->reg_defs.size ());
fetch_inferior_registers (regcache, -1);
regcache->registers_valid = 1;
}
@@ -115,8 +115,7 @@ regcache_invalidate (void)
struct regcache *
init_register_cache (struct regcache *regcache,
- const struct target_desc *tdesc,
- unsigned char *regbuf)
+ const struct target_desc *tdesc, unsigned char *regbuf)
{
if (regbuf == NULL)
{
@@ -127,12 +126,12 @@ init_register_cache (struct regcache *regcache,
garbage. */
regcache->tdesc = tdesc;
regcache->registers
- = (unsigned char *) xcalloc (1, tdesc->registers_size);
+ = (unsigned char *) xcalloc (1, tdesc->registers_size);
regcache->registers_owned = 1;
regcache->register_status
- = (unsigned char *) xmalloc (tdesc->reg_defs.size ());
+ = (unsigned char *) xmalloc (tdesc->reg_defs.size ());
memset ((void *) regcache->register_status, REG_UNAVAILABLE,
- tdesc->reg_defs.size ());
+ tdesc->reg_defs.size ());
#else
gdb_assert_not_reached ("can't allocate memory from the heap");
#endif
@@ -170,7 +169,7 @@ free_register_cache (struct regcache *regcache)
if (regcache)
{
if (regcache->registers_owned)
- free (regcache->registers);
+ free (regcache->registers);
free (regcache->register_status);
delete regcache;
}
@@ -189,7 +188,7 @@ regcache_cpy (struct regcache *dst, struct regcache *src)
#ifndef IN_PROCESS_AGENT
if (dst->register_status != NULL && src->register_status != NULL)
memcpy (dst->register_status, src->register_status,
- src->tdesc->reg_defs.size ());
+ src->tdesc->reg_defs.size ());
#endif
dst->registers_valid = src->registers_valid;
}
@@ -216,15 +215,15 @@ registers_to_string (struct regcache *regcache, char *buf)
for (int i = 0; i < tdesc->reg_defs.size (); ++i)
{
if (regcache->register_status[i] == REG_VALID)
- {
- bin2hex (registers, buf, register_size (tdesc, i));
- buf += register_size (tdesc, i) * 2;
- }
+ {
+ bin2hex (registers, buf, register_size (tdesc, i));
+ buf += register_size (tdesc, i) * 2;
+ }
else
- {
- memset (buf, 'x', register_size (tdesc, i) * 2);
- buf += register_size (tdesc, i) * 2;
- }
+ {
+ memset (buf, 'x', register_size (tdesc, i) * 2);
+ buf += register_size (tdesc, i) * 2;
+ }
registers += register_size (tdesc, i);
}
*buf = '\0';
@@ -240,9 +239,9 @@ registers_from_string (struct regcache *regcache, char *buf)
if (len != tdesc->registers_size * 2)
{
warning ("Wrong sized register packet (expected %d bytes, got %d)",
- 2 * tdesc->registers_size, len);
+ 2 * tdesc->registers_size, len);
if (len > tdesc->registers_size * 2)
- len = tdesc->registers_size * 2;
+ len = tdesc->registers_size * 2;
}
hex2bin (buf, registers, len / 2);
}
@@ -255,7 +254,7 @@ find_regno_no_throw (const struct target_desc *tdesc, const char *name)
for (int i = 0; i < tdesc->reg_defs.size (); ++i)
{
if (strcmp (name, find_register_by_number (tdesc, i).name) == 0)
- return i;
+ return i;
}
return {};
}
@@ -316,7 +315,7 @@ static unsigned char *
register_data (const struct regcache *regcache, int n)
{
return (regcache->registers
- + find_register_by_number (regcache->tdesc, n).offset / 8);
+ + find_register_by_number (regcache->tdesc, n).offset / 8);
}
void
@@ -335,7 +334,7 @@ regcache::raw_supply (int n, const void *buf)
memcpy (register_data (this, n), buf, register_size (tdesc, n));
#ifndef IN_PROCESS_AGENT
if (register_status != NULL)
- register_status[n] = REG_VALID;
+ register_status[n] = REG_VALID;
#endif
}
else
@@ -343,7 +342,7 @@ regcache::raw_supply (int n, const void *buf)
memset (register_data (this, n), 0, register_size (tdesc, n));
#ifndef IN_PROCESS_AGENT
if (register_status != NULL)
- register_status[n] = REG_UNAVAILABLE;
+ register_status[n] = REG_UNAVAILABLE;
#endif
}
}
@@ -353,8 +352,7 @@ regcache::raw_supply (int n, const void *buf)
void
supply_register_zeroed (struct regcache *regcache, int n)
{
- memset (register_data (regcache, n), 0,
- register_size (regcache->tdesc, n));
+ memset (register_data (regcache, n), 0, register_size (regcache->tdesc, n));
#ifndef IN_PROCESS_AGENT
if (regcache->register_status != NULL)
regcache->register_status[n] = REG_VALID;
@@ -366,8 +364,7 @@ supply_register_zeroed (struct regcache *regcache, int n)
/* Supply register called NAME with value zero to REGCACHE. */
void
-supply_register_by_name_zeroed (struct regcache *regcache,
- const char *name)
+supply_register_by_name_zeroed (struct regcache *regcache, const char *name)
{
supply_register_zeroed (regcache, find_regno (regcache->tdesc, name));
}
@@ -388,10 +385,10 @@ supply_regblock (struct regcache *regcache, const void *buf)
memcpy (regcache->registers, buf, tdesc->registers_size);
#ifndef IN_PROCESS_AGENT
{
- int i;
+ int i;
- for (i = 0; i < tdesc->reg_defs.size (); i++)
- regcache->register_status[i] = REG_VALID;
+ for (i = 0; i < tdesc->reg_defs.size (); i++)
+ regcache->register_status[i] = REG_VALID;
}
#endif
}
@@ -402,10 +399,10 @@ supply_regblock (struct regcache *regcache, const void *buf)
memset (regcache->registers, 0, tdesc->registers_size);
#ifndef IN_PROCESS_AGENT
{
- int i;
+ int i;
- for (i = 0; i < tdesc->reg_defs.size (); i++)
- regcache->register_status[i] = REG_UNAVAILABLE;
+ for (i = 0; i < tdesc->reg_defs.size (); i++)
+ regcache->register_status[i] = REG_UNAVAILABLE;
}
#endif
}
@@ -414,8 +411,8 @@ supply_regblock (struct regcache *regcache, const void *buf)
#ifndef IN_PROCESS_AGENT
void
-supply_register_by_name (struct regcache *regcache,
- const char *name, const void *buf)
+supply_register_by_name (struct regcache *regcache, const char *name,
+ const void *buf)
{
supply_register (regcache, find_regno (regcache->tdesc, name), buf);
}
@@ -438,7 +435,7 @@ regcache::raw_collect (int n, void *buf) const
enum register_status
regcache_raw_read_unsigned (struct regcache *regcache, int regnum,
- ULONGEST *val)
+ ULONGEST *val)
{
int size;
@@ -447,9 +444,9 @@ regcache_raw_read_unsigned (struct regcache *regcache, int regnum,
size = register_size (regcache->tdesc, regnum);
if (size > (int) sizeof (ULONGEST))
- error (_("That operation is not available on integers of more than"
- "%d bytes."),
- (int) sizeof (ULONGEST));
+ error (_ ("That operation is not available on integers of more than"
+ "%d bytes."),
+ (int) sizeof (ULONGEST));
*val = 0;
collect_register (regcache, regnum, val);
@@ -462,23 +459,22 @@ regcache_raw_read_unsigned (struct regcache *regcache, int regnum,
/* See regcache.h. */
ULONGEST
-regcache_raw_get_unsigned_by_name (struct regcache *regcache,
- const char *name)
+regcache_raw_get_unsigned_by_name (struct regcache *regcache, const char *name)
{
return regcache_raw_get_unsigned (regcache,
- find_regno (regcache->tdesc, name));
+ find_regno (regcache->tdesc, name));
}
void
collect_register_as_string (struct regcache *regcache, int n, char *buf)
{
bin2hex (register_data (regcache, n), buf,
- register_size (regcache->tdesc, n));
+ register_size (regcache->tdesc, n));
}
void
-collect_register_by_name (struct regcache *regcache,
- const char *name, void *buf)
+collect_register_by_name (struct regcache *regcache, const char *name,
+ void *buf)
{
collect_register (regcache, find_regno (regcache->tdesc, name), buf);
}
diff --git a/gdbserver/regcache.h b/gdbserver/regcache.h
index 7248bcf5808..2ffb912e948 100644
--- a/gdbserver/regcache.h
+++ b/gdbserver/regcache.h
@@ -60,8 +60,8 @@ struct regcache : public reg_buffer_common
};
struct regcache *init_register_cache (struct regcache *regcache,
- const struct target_desc *tdesc,
- unsigned char *regbuf);
+ const struct target_desc *tdesc,
+ unsigned char *regbuf);
void regcache_cpy (struct regcache *dst, struct regcache *src);
@@ -113,7 +113,7 @@ int register_size (const struct target_desc *tdesc, int n);
/* No throw version of find_regno. If NAME is not a known register, return
an empty value. */
gdb::optional<int> find_regno_no_throw (const struct target_desc *tdesc,
- const char *name);
+ const char *name);
int find_regno (const struct target_desc *tdesc, const char *name);
@@ -121,11 +121,11 @@ void supply_register (struct regcache *regcache, int n, const void *buf);
void supply_register_zeroed (struct regcache *regcache, int n);
-void supply_register_by_name (struct regcache *regcache,
- const char *name, const void *buf);
+void supply_register_by_name (struct regcache *regcache, const char *name,
+ const void *buf);
void supply_register_by_name_zeroed (struct regcache *regcache,
- const char *name);
+ const char *name);
void supply_regblock (struct regcache *regcache, const void *buf);
@@ -133,14 +133,14 @@ void collect_register (struct regcache *regcache, int n, void *buf);
void collect_register_as_string (struct regcache *regcache, int n, char *buf);
-void collect_register_by_name (struct regcache *regcache,
- const char *name, void *buf);
+void collect_register_by_name (struct regcache *regcache, const char *name,
+ void *buf);
/* Read a raw register as an unsigned integer. Convenience wrapper
around regcache_raw_get_unsigned that takes a register name instead
of a register number. */
ULONGEST regcache_raw_get_unsigned_by_name (struct regcache *regcache,
- const char *name);
+ const char *name);
#endif /* GDBSERVER_REGCACHE_H */
diff --git a/gdbserver/remote-utils.cc b/gdbserver/remote-utils.cc
index 80310bc2c70..107a5b8d0d6 100644
--- a/gdbserver/remote-utils.cc
+++ b/gdbserver/remote-utils.cc
@@ -75,7 +75,8 @@ typedef int socklen_t;
#ifndef IN_PROCESS_AGENT
/* Extra value for readchar_callback. */
-enum {
+enum
+{
/* The callback is currently not scheduled. */
NOT_SCHEDULED = -1
};
@@ -103,11 +104,11 @@ static int listen_desc = -1;
#ifdef USE_WIN32API
/* gnulib wraps these as macros, undo them. */
-# undef read
-# undef write
+#undef read
+#undef write
-# define read(fd, buf, len) recv (fd, (char *) buf, len, 0)
-# define write(fd, buf, len) send (fd, (char *) buf, len, 0)
+#define read(fd, buf, len) recv (fd, (char *) buf, len, 0)
+#define write(fd, buf, len) send (fd, (char *) buf, len, 0)
#endif
int
@@ -127,12 +128,12 @@ remote_connection_is_stdio (void)
static void
enable_async_notification (int fd)
{
-#if defined(F_SETFL) && defined (FASYNC)
+#if defined(F_SETFL) && defined(FASYNC)
int save_fcntl_flags;
save_fcntl_flags = fcntl (fd, F_GETFL, 0);
fcntl (fd, F_SETFL, save_fcntl_flags | FASYNC);
-#if defined (F_SETOWN)
+#if defined(F_SETOWN)
fcntl (fd, F_SETOWN, getpid ());
#endif
#endif
@@ -152,26 +153,26 @@ handle_accept_event (int err, gdb_client_data client_data)
/* Enable TCP keep alive process. */
socklen_t tmp = 1;
- setsockopt (remote_desc, SOL_SOCKET, SO_KEEPALIVE,
- (char *) &tmp, sizeof (tmp));
+ setsockopt (remote_desc, SOL_SOCKET, SO_KEEPALIVE, (char *) &tmp,
+ sizeof (tmp));
/* Tell TCP not to delay small packets. This greatly speeds up
interactive response. */
tmp = 1;
- setsockopt (remote_desc, IPPROTO_TCP, TCP_NODELAY,
- (char *) &tmp, sizeof (tmp));
+ setsockopt (remote_desc, IPPROTO_TCP, TCP_NODELAY, (char *) &tmp,
+ sizeof (tmp));
#ifndef USE_WIN32API
- signal (SIGPIPE, SIG_IGN); /* If we don't do this, then gdbserver simply
+ signal (SIGPIPE, SIG_IGN); /* If we don't do this, then gdbserver simply
exits when the remote side dies. */
#endif
if (run_once)
{
#ifndef USE_WIN32API
- close (listen_desc); /* No longer need this */
+ close (listen_desc); /* No longer need this */
#else
- closesocket (listen_desc); /* No longer need this */
+ closesocket (listen_desc); /* No longer need this */
#endif
}
@@ -182,17 +183,16 @@ handle_accept_event (int err, gdb_client_data client_data)
/* Convert IP address to string. */
char orig_host[GDB_NI_MAX_ADDR], orig_port[GDB_NI_MAX_PORT];
- int r = getnameinfo ((struct sockaddr *) &sockaddr, len,
- orig_host, sizeof (orig_host),
- orig_port, sizeof (orig_port),
- NI_NUMERICHOST | NI_NUMERICSERV);
+ int r = getnameinfo ((struct sockaddr *) &sockaddr, len, orig_host,
+ sizeof (orig_host), orig_port, sizeof (orig_port),
+ NI_NUMERICHOST | NI_NUMERICSERV);
if (r != 0)
- fprintf (stderr, _("Could not obtain remote address: %s\n"),
- gai_strerror (r));
+ fprintf (stderr, _ ("Could not obtain remote address: %s\n"),
+ gai_strerror (r));
else
- fprintf (stderr, _("Remote debugging from host %s, port %s\n"),
- orig_host, orig_port);
+ fprintf (stderr, _ ("Remote debugging from host %s, port %s\n"), orig_host,
+ orig_port);
enable_async_notification (remote_desc);
@@ -261,10 +261,10 @@ remote_prepare (const char *name)
#endif
int r = getaddrinfo (parsed.host_str.c_str (), parsed.port_str.c_str (),
- &hint, &ainfo);
+ &hint, &ainfo);
if (r != 0)
- error (_("%s: cannot resolve name: %s"), name, gai_strerror (r));
+ error (_ ("%s: cannot resolve name: %s"), name, gai_strerror (r));
scoped_free_addrinfo freeaddrinfo (ainfo);
@@ -273,10 +273,10 @@ remote_prepare (const char *name)
for (iter = ainfo; iter != NULL; iter = iter->ai_next)
{
listen_desc = gdb_socket_cloexec (iter->ai_family, iter->ai_socktype,
- iter->ai_protocol);
+ iter->ai_protocol);
if (listen_desc >= 0)
- break;
+ break;
}
if (iter == NULL)
@@ -285,7 +285,7 @@ remote_prepare (const char *name)
/* Allow rapid reuse of this port. */
tmp = 1;
setsockopt (listen_desc, SOL_SOCKET, SO_REUSEADDR, (char *) &tmp,
- sizeof (tmp));
+ sizeof (tmp));
switch (iter->ai_family)
{
@@ -296,7 +296,7 @@ remote_prepare (const char *name)
((struct sockaddr_in6 *) iter->ai_addr)->sin6_addr = in6addr_any;
break;
default:
- internal_error (_("Invalid 'ai_family' %d\n"), iter->ai_family);
+ internal_error (_ ("Invalid 'ai_family' %d\n"), iter->ai_family);
}
if (bind (listen_desc, iter->ai_addr, iter->ai_addrlen) != 0)
@@ -333,7 +333,8 @@ remote_open (const char *name)
enable_async_notification (remote_desc);
/* Register the event loop handler. */
- add_file_handler (remote_desc, handle_serial_event, NULL, "remote-stdio");
+ add_file_handler (remote_desc, handle_serial_event, NULL,
+ "remote-stdio");
}
#ifndef USE_WIN32API
else if (port_str == NULL)
@@ -341,31 +342,31 @@ remote_open (const char *name)
struct stat statbuf;
if (stat (name, &statbuf) == 0
- && (S_ISCHR (statbuf.st_mode) || S_ISFIFO (statbuf.st_mode)))
- remote_desc = open (name, O_RDWR);
+ && (S_ISCHR (statbuf.st_mode) || S_ISFIFO (statbuf.st_mode)))
+ remote_desc = open (name, O_RDWR);
else
- {
- errno = EINVAL;
- remote_desc = -1;
- }
+ {
+ errno = EINVAL;
+ remote_desc = -1;
+ }
if (remote_desc < 0)
- perror_with_name ("Could not open remote device");
+ perror_with_name ("Could not open remote device");
#if HAVE_TERMIOS_H
{
- struct termios termios;
- tcgetattr (remote_desc, &termios);
-
- termios.c_iflag = 0;
- termios.c_oflag = 0;
- termios.c_lflag = 0;
- termios.c_cflag &= ~(CSIZE | PARENB);
- termios.c_cflag |= CLOCAL | CS8;
- termios.c_cc[VMIN] = 1;
- termios.c_cc[VTIME] = 0;
-
- tcsetattr (remote_desc, TCSANOW, &termios);
+ struct termios termios;
+ tcgetattr (remote_desc, &termios);
+
+ termios.c_iflag = 0;
+ termios.c_oflag = 0;
+ termios.c_lflag = 0;
+ termios.c_cflag &= ~(CSIZE | PARENB);
+ termios.c_cflag |= CLOCAL | CS8;
+ termios.c_cc[VMIN] = 1;
+ termios.c_cc[VTIME] = 0;
+
+ tcsetattr (remote_desc, TCSANOW, &termios);
}
#endif
@@ -375,7 +376,7 @@ remote_open (const char *name)
/* Register the event loop handler. */
add_file_handler (remote_desc, handle_serial_event, NULL,
- "remote-device");
+ "remote-device");
}
#endif /* USE_WIN32API */
else
@@ -385,24 +386,22 @@ remote_open (const char *name)
socklen_t len = sizeof (sockaddr);
if (getsockname (listen_desc, (struct sockaddr *) &sockaddr, &len) < 0)
- perror_with_name ("Can't determine port");
+ perror_with_name ("Can't determine port");
- int r = getnameinfo ((struct sockaddr *) &sockaddr, len,
- NULL, 0,
- listen_port, sizeof (listen_port),
- NI_NUMERICSERV);
+ int r = getnameinfo ((struct sockaddr *) &sockaddr, len, NULL, 0,
+ listen_port, sizeof (listen_port), NI_NUMERICSERV);
if (r != 0)
- fprintf (stderr, _("Can't obtain port where we are listening: %s"),
- gai_strerror (r));
+ fprintf (stderr, _ ("Can't obtain port where we are listening: %s"),
+ gai_strerror (r));
else
- fprintf (stderr, _("Listening on port %s\n"), listen_port);
+ fprintf (stderr, _ ("Listening on port %s\n"), listen_port);
fflush (stderr);
/* Register the event loop handler. */
add_file_handler (listen_desc, handle_accept_event, NULL,
- "remote-listen");
+ "remote-listen");
}
}
@@ -416,7 +415,7 @@ remote_close (void)
#ifdef USE_WIN32API
closesocket (remote_desc);
#else
- if (! remote_connection_is_stdio ())
+ if (!remote_connection_is_stdio ())
close (remote_desc);
#endif
remote_desc = -1;
@@ -525,9 +524,9 @@ write_ptid (char *buf, ptid_t ptid)
{
pid = ptid.pid ();
if (pid < 0)
- buf += sprintf (buf, "p-%x.", -pid);
+ buf += sprintf (buf, "p-%x.", -pid);
else
- buf += sprintf (buf, "p%x.", pid);
+ buf += sprintf (buf, "p%x.", pid);
}
tid = ptid.lwp ();
if (tid < 0)
@@ -571,14 +570,14 @@ read_ptid (const char *buf, const char **obuf)
/* Multi-process ptid. */
pp = unpack_varlen_hex (p + 1, &pid);
if (*pp != '.')
- error ("invalid remote ptid: %s\n", p);
+ error ("invalid remote ptid: %s\n", p);
p = pp + 1;
tid = hex_or_minus_one (p, &pp);
if (obuf)
- *obuf = pp;
+ *obuf = pp;
return ptid_t (pid, tid);
}
@@ -660,43 +659,43 @@ putpkt_binary_1 (char *buf, int cnt, int is_notif)
do
{
if (write_prim (buf2, p - buf2) != p - buf2)
- {
- perror ("putpkt(write)");
- free (buf2);
- return -1;
- }
+ {
+ perror ("putpkt(write)");
+ free (buf2);
+ return -1;
+ }
if (cs.noack_mode || is_notif)
- {
- /* Don't expect an ack then. */
- if (is_notif)
- remote_debug_printf ("putpkt (\"%s\"); [notif]", buf2);
- else
- remote_debug_printf ("putpkt (\"%s\"); [noack mode]", buf2);
+ {
+ /* Don't expect an ack then. */
+ if (is_notif)
+ remote_debug_printf ("putpkt (\"%s\"); [notif]", buf2);
+ else
+ remote_debug_printf ("putpkt (\"%s\"); [noack mode]", buf2);
- break;
- }
+ break;
+ }
remote_debug_printf ("putpkt (\"%s\"); [looking for ack]", buf2);
cc = readchar ();
if (cc < 0)
- {
- free (buf2);
- return -1;
- }
+ {
+ free (buf2);
+ return -1;
+ }
remote_debug_printf ("[received '%c' (0x%x)]", cc, cc);
/* Check for an input interrupt while we're here. */
if (cc == '\003' && current_thread != NULL)
- the_target->request_interrupt ();
+ the_target->request_interrupt ();
}
while (cc != '+');
free (buf2);
- return 1; /* Success! */
+ return 1; /* Success! */
}
int
@@ -746,19 +745,19 @@ input_interrupt (int unused)
cc = read_prim (&c, 1);
if (cc == 0)
- {
- fprintf (stderr, "client connection closed\n");
- return;
- }
+ {
+ fprintf (stderr, "client connection closed\n");
+ return;
+ }
else if (cc != 1 || c != '\003')
- {
- fprintf (stderr, "input_interrupt, count = %d c = %d ", cc, c);
- if (isprint (c))
- fprintf (stderr, "('%c')\n", c);
- else
- fprintf (stderr, "('\\x%02x')\n", c & 0xff);
- return;
- }
+ {
+ fprintf (stderr, "input_interrupt, count = %d c = %d ", cc, c);
+ if (isprint (c))
+ fprintf (stderr, "('%c')\n", c);
+ else
+ fprintf (stderr, "('\\x%02x')\n", c & 0xff);
+ return;
+ }
the_target->request_interrupt ();
}
@@ -853,16 +852,16 @@ readchar (void)
readchar_bufcnt = read_prim (readchar_buf, sizeof (readchar_buf));
if (readchar_bufcnt <= 0)
- {
- if (readchar_bufcnt == 0)
- {
- remote_debug_printf ("readchar: Got EOF");
- }
- else
- perror ("readchar");
+ {
+ if (readchar_bufcnt == 0)
+ {
+ remote_debug_printf ("readchar: Got EOF");
+ }
+ else
+ perror ("readchar");
- return -1;
- }
+ return -1;
+ }
readchar_bufp = readchar_buf;
}
@@ -924,59 +923,59 @@ getpkt (char *buf)
csum = 0;
while (1)
- {
- c = readchar ();
+ {
+ c = readchar ();
- /* The '\003' may appear before or after each packet, so
+ /* The '\003' may appear before or after each packet, so
check for an input interrupt. */
- if (c == '\003')
- {
- the_target->request_interrupt ();
- continue;
- }
+ if (c == '\003')
+ {
+ the_target->request_interrupt ();
+ continue;
+ }
- if (c == '$')
- break;
+ if (c == '$')
+ break;
- remote_debug_printf ("[getpkt: discarding char '%c']", c);
+ remote_debug_printf ("[getpkt: discarding char '%c']", c);
- if (c < 0)
- return -1;
- }
+ if (c < 0)
+ return -1;
+ }
bp = buf;
while (1)
- {
- c = readchar ();
- if (c < 0)
- return -1;
- if (c == '#')
- break;
- *bp++ = c;
- csum += c;
- }
+ {
+ c = readchar ();
+ if (c < 0)
+ return -1;
+ if (c == '#')
+ break;
+ *bp++ = c;
+ csum += c;
+ }
*bp = 0;
c1 = fromhex (readchar ());
c2 = fromhex (readchar ());
if (csum == (c1 << 4) + c2)
- break;
+ break;
if (cs.noack_mode)
- {
- fprintf (stderr,
- "Bad checksum, sentsum=0x%x, csum=0x%x, "
- "buf=%s [no-ack-mode, Bad medium?]\n",
- (c1 << 4) + c2, csum, buf);
- /* Not much we can do, GDB wasn't expecting an ack/nac. */
- break;
- }
+ {
+ fprintf (stderr,
+ "Bad checksum, sentsum=0x%x, csum=0x%x, "
+ "buf=%s [no-ack-mode, Bad medium?]\n",
+ (c1 << 4) + c2, csum, buf);
+ /* Not much we can do, GDB wasn't expecting an ack/nac. */
+ break;
+ }
fprintf (stderr, "Bad checksum, sentsum=0x%x, csum=0x%x, buf=%s\n",
- (c1 << 4) + c2, csum, buf);
+ (c1 << 4) + c2, csum, buf);
if (write_prim ("-", 1) != 1)
- return -1;
+ return -1;
}
if (!cs.noack_mode)
@@ -984,7 +983,7 @@ getpkt (char *buf)
remote_debug_printf ("getpkt (\"%s\"); [sending ack]", buf);
if (write_prim ("+", 1) != 1)
- return -1;
+ return -1;
remote_debug_printf ("[sent ack]");
}
@@ -1054,7 +1053,7 @@ prepare_resume_reply (char *buf, ptid_t ptid, const target_waitstatus &status)
{
client_state &cs = get_client_state ();
threads_debug_printf ("Writing resume reply for %s:%d",
- target_pid_to_str (ptid).c_str (), status.kind ());
+ target_pid_to_str (ptid).c_str (), status.kind ());
switch (status.kind ())
{
@@ -1067,70 +1066,72 @@ prepare_resume_reply (char *buf, ptid_t ptid, const target_waitstatus &status)
case TARGET_WAITKIND_SYSCALL_ENTRY:
case TARGET_WAITKIND_SYSCALL_RETURN:
{
- const char **regp;
- struct regcache *regcache;
- char *buf_start = buf;
-
- if ((status.kind () == TARGET_WAITKIND_FORKED && cs.report_fork_events)
- || (status.kind () == TARGET_WAITKIND_VFORKED
- && cs.report_vfork_events))
- {
- enum gdb_signal signal = GDB_SIGNAL_TRAP;
- const char *event = (status.kind () == TARGET_WAITKIND_FORKED
- ? "fork" : "vfork");
-
- sprintf (buf, "T%02x%s:", signal, event);
- buf += strlen (buf);
- buf = write_ptid (buf, status.child_ptid ());
- strcat (buf, ";");
- }
- else if (status.kind () == TARGET_WAITKIND_VFORK_DONE
- && cs.report_vfork_events)
- {
- enum gdb_signal signal = GDB_SIGNAL_TRAP;
-
- sprintf (buf, "T%02xvforkdone:;", signal);
- }
- else if (status.kind () == TARGET_WAITKIND_EXECD && cs.report_exec_events)
- {
- enum gdb_signal signal = GDB_SIGNAL_TRAP;
- const char *event = "exec";
- char hexified_pathname[PATH_MAX * 2];
-
- sprintf (buf, "T%02x%s:", signal, event);
- buf += strlen (buf);
-
- /* Encode pathname to hexified format. */
- bin2hex ((const gdb_byte *) status.execd_pathname (),
- hexified_pathname,
- strlen (status.execd_pathname ()));
-
- sprintf (buf, "%s;", hexified_pathname);
- buf += strlen (buf);
- }
- else if (status.kind () == TARGET_WAITKIND_THREAD_CREATED
- && cs.report_thread_events)
- {
- enum gdb_signal signal = GDB_SIGNAL_TRAP;
-
- sprintf (buf, "T%02xcreate:;", signal);
- }
- else if (status.kind () == TARGET_WAITKIND_SYSCALL_ENTRY
- || status.kind () == TARGET_WAITKIND_SYSCALL_RETURN)
- {
- enum gdb_signal signal = GDB_SIGNAL_TRAP;
- const char *event = (status.kind () == TARGET_WAITKIND_SYSCALL_ENTRY
- ? "syscall_entry" : "syscall_return");
-
- sprintf (buf, "T%02x%s:%x;", signal, event,
- status.syscall_number ());
- }
- else
- sprintf (buf, "T%02x", status.sig ());
-
- if (disable_packet_T)
- {
- /* This is a bit (OK, a lot) of a kludge, however, this isn't
+ const char **regp;
+ struct regcache *regcache;
+ char *buf_start = buf;
+
+ if ((status.kind () == TARGET_WAITKIND_FORKED && cs.report_fork_events)
+ || (status.kind () == TARGET_WAITKIND_VFORKED
+ && cs.report_vfork_events))
+ {
+ enum gdb_signal signal = GDB_SIGNAL_TRAP;
+ const char *event
+ = (status.kind () == TARGET_WAITKIND_FORKED ? "fork" : "vfork");
+
+ sprintf (buf, "T%02x%s:", signal, event);
+ buf += strlen (buf);
+ buf = write_ptid (buf, status.child_ptid ());
+ strcat (buf, ";");
+ }
+ else if (status.kind () == TARGET_WAITKIND_VFORK_DONE
+ && cs.report_vfork_events)
+ {
+ enum gdb_signal signal = GDB_SIGNAL_TRAP;
+
+ sprintf (buf, "T%02xvforkdone:;", signal);
+ }
+ else if (status.kind () == TARGET_WAITKIND_EXECD
+ && cs.report_exec_events)
+ {
+ enum gdb_signal signal = GDB_SIGNAL_TRAP;
+ const char *event = "exec";
+ char hexified_pathname[PATH_MAX * 2];
+
+ sprintf (buf, "T%02x%s:", signal, event);
+ buf += strlen (buf);
+
+ /* Encode pathname to hexified format. */
+ bin2hex ((const gdb_byte *) status.execd_pathname (),
+ hexified_pathname, strlen (status.execd_pathname ()));
+
+ sprintf (buf, "%s;", hexified_pathname);
+ buf += strlen (buf);
+ }
+ else if (status.kind () == TARGET_WAITKIND_THREAD_CREATED
+ && cs.report_thread_events)
+ {
+ enum gdb_signal signal = GDB_SIGNAL_TRAP;
+
+ sprintf (buf, "T%02xcreate:;", signal);
+ }
+ else if (status.kind () == TARGET_WAITKIND_SYSCALL_ENTRY
+ || status.kind () == TARGET_WAITKIND_SYSCALL_RETURN)
+ {
+ enum gdb_signal signal = GDB_SIGNAL_TRAP;
+ const char *event
+ = (status.kind () == TARGET_WAITKIND_SYSCALL_ENTRY
+ ? "syscall_entry"
+ : "syscall_return");
+
+ sprintf (buf, "T%02x%s:%x;", signal, event,
+ status.syscall_number ());
+ }
+ else
+ sprintf (buf, "T%02x", status.sig ());
+
+ if (disable_packet_T)
+ {
+ /* This is a bit (OK, a lot) of a kludge, however, this isn't
really a user feature, but exists only so GDB can use the
gdbserver to test handling of the 'S' stop reply packet, so
we would rather this code be as simple as possible.
@@ -1140,61 +1141,61 @@ prepare_resume_reply (char *buf, ptid_t ptid, const target_waitstatus &status)
An 'S' stop packet always looks like 'Sxx', so all we do
here is convert the buffer from a T packet to an S packet
and the avoid adding any extra content by breaking out. */
- gdb_assert (buf_start[0] == 'T');
- gdb_assert (isxdigit (buf_start[1]));
- gdb_assert (isxdigit (buf_start[2]));
- buf_start[0] = 'S';
- buf_start[3] = '\0';
- break;
- }
+ gdb_assert (buf_start[0] == 'T');
+ gdb_assert (isxdigit (buf_start[1]));
+ gdb_assert (isxdigit (buf_start[2]));
+ buf_start[0] = 'S';
+ buf_start[3] = '\0';
+ break;
+ }
- buf += strlen (buf);
+ buf += strlen (buf);
- scoped_restore_current_thread restore_thread;
+ scoped_restore_current_thread restore_thread;
- switch_to_thread (the_target, ptid);
+ switch_to_thread (the_target, ptid);
- regp = current_target_desc ()->expedite_regs;
+ regp = current_target_desc ()->expedite_regs;
- regcache = get_thread_regcache (current_thread, 1);
+ regcache = get_thread_regcache (current_thread, 1);
- if (the_target->stopped_by_watchpoint ())
- {
- CORE_ADDR addr;
- int i;
+ if (the_target->stopped_by_watchpoint ())
+ {
+ CORE_ADDR addr;
+ int i;
- memcpy (buf, "watch:", 6);
- buf += 6;
+ memcpy (buf, "watch:", 6);
+ buf += 6;
- addr = the_target->stopped_data_address ();
+ addr = the_target->stopped_data_address ();
- /* Convert each byte of the address into two hexadecimal
+ /* Convert each byte of the address into two hexadecimal
chars. Note that we take sizeof (void *) instead of
sizeof (addr); this is to avoid sending a 64-bit
address to a 32-bit GDB. */
- for (i = sizeof (void *) * 2; i > 0; i--)
- *buf++ = tohex ((addr >> (i - 1) * 4) & 0xf);
- *buf++ = ';';
- }
- else if (cs.swbreak_feature && target_stopped_by_sw_breakpoint ())
- {
- sprintf (buf, "swbreak:;");
- buf += strlen (buf);
- }
- else if (cs.hwbreak_feature && target_stopped_by_hw_breakpoint ())
- {
- sprintf (buf, "hwbreak:;");
- buf += strlen (buf);
- }
-
- while (*regp)
- {
- buf = outreg (regcache, find_regno (regcache->tdesc, *regp), buf);
- regp ++;
- }
- *buf = '\0';
-
- /* Formerly, if the debugger had not used any thread features
+ for (i = sizeof (void *) * 2; i > 0; i--)
+ *buf++ = tohex ((addr >> (i - 1) * 4) & 0xf);
+ *buf++ = ';';
+ }
+ else if (cs.swbreak_feature && target_stopped_by_sw_breakpoint ())
+ {
+ sprintf (buf, "swbreak:;");
+ buf += strlen (buf);
+ }
+ else if (cs.hwbreak_feature && target_stopped_by_hw_breakpoint ())
+ {
+ sprintf (buf, "hwbreak:;");
+ buf += strlen (buf);
+ }
+
+ while (*regp)
+ {
+ buf = outreg (regcache, find_regno (regcache->tdesc, *regp), buf);
+ regp++;
+ }
+ *buf = '\0';
+
+ /* Formerly, if the debugger had not used any thread features
we would not burden it with a thread status response. This
was for the benefit of GDB 4.13 and older. However, in
recent GDB versions the check (``if (cont_thread != 0)'')
@@ -1203,59 +1204,57 @@ prepare_resume_reply (char *buf, ptid_t ptid, const target_waitstatus &status)
thread. Since thread support relies on qSymbol support
anyway, assume GDB can handle threads. */
- if (using_threads && !disable_packet_Tthread)
- {
- /* This if (1) ought to be unnecessary. But remote_wait
+ if (using_threads && !disable_packet_Tthread)
+ {
+ /* This if (1) ought to be unnecessary. But remote_wait
in GDB will claim this event belongs to inferior_ptid
if we do not specify a thread, and there's no way for
gdbserver to know what inferior_ptid is. */
- if (1 || cs.general_thread != ptid)
- {
- int core = -1;
- /* In non-stop, don't change the general thread behind
+ if (1 || cs.general_thread != ptid)
+ {
+ int core = -1;
+ /* In non-stop, don't change the general thread behind
GDB's back. */
- if (!non_stop)
- cs.general_thread = ptid;
- sprintf (buf, "thread:");
- buf += strlen (buf);
- buf = write_ptid (buf, ptid);
- strcat (buf, ";");
- buf += strlen (buf);
-
- core = target_core_of_thread (ptid);
-
- if (core != -1)
- {
- sprintf (buf, "core:");
- buf += strlen (buf);
- sprintf (buf, "%x", core);
- strcat (buf, ";");
- buf += strlen (buf);
- }
- }
- }
-
- if (current_process ()->dlls_changed)
- {
- strcpy (buf, "library:;");
- buf += strlen (buf);
- current_process ()->dlls_changed = false;
- }
+ if (!non_stop)
+ cs.general_thread = ptid;
+ sprintf (buf, "thread:");
+ buf += strlen (buf);
+ buf = write_ptid (buf, ptid);
+ strcat (buf, ";");
+ buf += strlen (buf);
+
+ core = target_core_of_thread (ptid);
+
+ if (core != -1)
+ {
+ sprintf (buf, "core:");
+ buf += strlen (buf);
+ sprintf (buf, "%x", core);
+ strcat (buf, ";");
+ buf += strlen (buf);
+ }
+ }
+ }
+
+ if (current_process ()->dlls_changed)
+ {
+ strcpy (buf, "library:;");
+ buf += strlen (buf);
+ current_process ()->dlls_changed = false;
+ }
}
break;
case TARGET_WAITKIND_EXITED:
if (cs.multi_process)
- sprintf (buf, "W%x;process:%x",
- status.exit_status (), ptid.pid ());
+ sprintf (buf, "W%x;process:%x", status.exit_status (), ptid.pid ());
else
- sprintf (buf, "W%02x", status.exit_status ());
+ sprintf (buf, "W%02x", status.exit_status ());
break;
case TARGET_WAITKIND_SIGNALLED:
if (cs.multi_process)
- sprintf (buf, "X%x;process:%x",
- status.sig (), ptid.pid ());
+ sprintf (buf, "X%x;process:%x", status.sig (), ptid.pid ());
else
- sprintf (buf, "X%02x", status.sig ());
+ sprintf (buf, "X%02x", status.sig ());
break;
case TARGET_WAITKIND_THREAD_EXITED:
sprintf (buf, "w%x;", status.exit_status ());
@@ -1275,7 +1274,7 @@ prepare_resume_reply (char *buf, ptid_t ptid, const target_waitstatus &status)
const char *
decode_m_packet_params (const char *from, CORE_ADDR *mem_addr_ptr,
- unsigned int *len_ptr, const char end_marker)
+ unsigned int *len_ptr, const char end_marker)
{
int i = 0;
char ch;
@@ -1298,14 +1297,14 @@ decode_m_packet_params (const char *from, CORE_ADDR *mem_addr_ptr,
void
decode_m_packet (const char *from, CORE_ADDR *mem_addr_ptr,
- unsigned int *len_ptr)
+ unsigned int *len_ptr)
{
decode_m_packet_params (from, mem_addr_ptr, len_ptr, '\0');
}
void
decode_M_packet (const char *from, CORE_ADDR *mem_addr_ptr,
- unsigned int *len_ptr, unsigned char **to_p)
+ unsigned int *len_ptr, unsigned char **to_p)
{
from = decode_m_packet_params (from, mem_addr_ptr, len_ptr, ':');
@@ -1317,7 +1316,7 @@ decode_M_packet (const char *from, CORE_ADDR *mem_addr_ptr,
int
decode_X_packet (char *from, int packet_len, CORE_ADDR *mem_addr_ptr,
- unsigned int *len_ptr, unsigned char **to_p)
+ unsigned int *len_ptr, unsigned char **to_p)
{
int i = 0;
char ch;
@@ -1339,7 +1338,8 @@ decode_X_packet (char *from, int packet_len, CORE_ADDR *mem_addr_ptr,
*to_p = (unsigned char *) xmalloc (*len_ptr);
if (remote_unescape_input ((const gdb_byte *) &from[i], packet_len - i,
- *to_p, *len_ptr) != *len_ptr)
+ *to_p, *len_ptr)
+ != *len_ptr)
return -1;
return 0;
@@ -1349,7 +1349,7 @@ decode_X_packet (char *from, int packet_len, CORE_ADDR *mem_addr_ptr,
int
decode_xfer_write (char *buf, int packet_len, CORE_ADDR *offset,
- unsigned int *len, unsigned char *data)
+ unsigned int *len, unsigned char *data)
{
char ch;
char *b = buf;
@@ -1364,8 +1364,8 @@ decode_xfer_write (char *buf, int packet_len, CORE_ADDR *offset,
/* Get encoded data. */
packet_len -= buf - b;
- *len = remote_unescape_input ((const gdb_byte *) buf, packet_len,
- data, packet_len);
+ *len = remote_unescape_input ((const gdb_byte *) buf, packet_len, data,
+ packet_len);
return 0;
}
@@ -1373,9 +1373,9 @@ decode_xfer_write (char *buf, int packet_len, CORE_ADDR *offset,
int
decode_search_memory_packet (const char *buf, int packet_len,
- CORE_ADDR *start_addrp,
- CORE_ADDR *search_space_lenp,
- gdb_byte *pattern, unsigned int *pattern_lenp)
+ CORE_ADDR *start_addrp,
+ CORE_ADDR *search_space_lenp, gdb_byte *pattern,
+ unsigned int *pattern_lenp)
{
const char *p = buf;
@@ -1383,7 +1383,7 @@ decode_search_memory_packet (const char *buf, int packet_len,
p = decode_address_to_semicolon (search_space_lenp, p);
packet_len -= p - buf;
*pattern_lenp = remote_unescape_input ((const gdb_byte *) p, packet_len,
- pattern, packet_len);
+ pattern, packet_len);
return 0;
}
@@ -1431,8 +1431,8 @@ look_up_one_symbol (const char *name, CORE_ADDR *addrp, int may_ask_gdb)
for (sym = proc->symbol_cache; sym; sym = sym->next)
if (strcmp (name, sym->name) == 0)
{
- *addrp = sym->addr;
- return 1;
+ *addrp = sym->addr;
+ return 1;
}
/* It might not be an appropriate time to look up a symbol,
@@ -1443,7 +1443,7 @@ look_up_one_symbol (const char *name, CORE_ADDR *addrp, int may_ask_gdb)
/* Send the request. */
strcpy (cs.own_buf, "qSymbol:");
bin2hex ((const gdb_byte *) name, cs.own_buf + strlen ("qSymbol:"),
- strlen (name));
+ strlen (name));
if (putpkt (cs.own_buf) < 0)
return -1;
@@ -1460,35 +1460,35 @@ look_up_one_symbol (const char *name, CORE_ADDR *addrp, int may_ask_gdb)
while (1)
{
if (cs.own_buf[0] == 'm')
- {
- CORE_ADDR mem_addr;
- unsigned char *mem_buf;
- unsigned int mem_len;
-
- decode_m_packet (&cs.own_buf[1], &mem_addr, &mem_len);
- mem_buf = (unsigned char *) xmalloc (mem_len);
- if (read_inferior_memory (mem_addr, mem_buf, mem_len) == 0)
- bin2hex (mem_buf, cs.own_buf, mem_len);
- else
- write_enn (cs.own_buf);
- free (mem_buf);
- if (putpkt (cs.own_buf) < 0)
- return -1;
- }
+ {
+ CORE_ADDR mem_addr;
+ unsigned char *mem_buf;
+ unsigned int mem_len;
+
+ decode_m_packet (&cs.own_buf[1], &mem_addr, &mem_len);
+ mem_buf = (unsigned char *) xmalloc (mem_len);
+ if (read_inferior_memory (mem_addr, mem_buf, mem_len) == 0)
+ bin2hex (mem_buf, cs.own_buf, mem_len);
+ else
+ write_enn (cs.own_buf);
+ free (mem_buf);
+ if (putpkt (cs.own_buf) < 0)
+ return -1;
+ }
else if (cs.own_buf[0] == 'v')
- {
- int new_len = -1;
- handle_v_requests (cs.own_buf, len, &new_len);
- if (new_len != -1)
- putpkt_binary (cs.own_buf, new_len);
- else
- putpkt (cs.own_buf);
- }
+ {
+ int new_len = -1;
+ handle_v_requests (cs.own_buf, len, &new_len);
+ if (new_len != -1)
+ putpkt_binary (cs.own_buf, new_len);
+ else
+ putpkt (cs.own_buf);
+ }
else
- break;
+ break;
len = getpkt (cs.own_buf);
if (len < 0)
- return -1;
+ return -1;
}
if (!startswith (cs.own_buf, "qSymbol:"))
@@ -1538,8 +1538,7 @@ relocate_instruction (CORE_ADDR *to, CORE_ADDR oldloc)
ULONGEST written = 0;
/* Send the request. */
- sprintf (cs.own_buf, "qRelocInsn:%s;%s", paddress (oldloc),
- paddress (*to));
+ sprintf (cs.own_buf, "qRelocInsn:%s;%s", paddress (oldloc), paddress (*to));
if (putpkt (cs.own_buf) < 0)
return -1;
@@ -1559,50 +1558,50 @@ relocate_instruction (CORE_ADDR *to, CORE_ADDR oldloc)
unsigned int mem_len;
if (cs.own_buf[0] == 'm')
- {
- decode_m_packet (&cs.own_buf[1], &mem_addr, &mem_len);
- mem_buf = (unsigned char *) xmalloc (mem_len);
- if (read_inferior_memory (mem_addr, mem_buf, mem_len) == 0)
- bin2hex (mem_buf, cs.own_buf, mem_len);
- else
- write_enn (cs.own_buf);
- }
+ {
+ decode_m_packet (&cs.own_buf[1], &mem_addr, &mem_len);
+ mem_buf = (unsigned char *) xmalloc (mem_len);
+ if (read_inferior_memory (mem_addr, mem_buf, mem_len) == 0)
+ bin2hex (mem_buf, cs.own_buf, mem_len);
+ else
+ write_enn (cs.own_buf);
+ }
else if (cs.own_buf[0] == 'X')
- {
- if (decode_X_packet (&cs.own_buf[1], len - 1, &mem_addr,
- &mem_len, &mem_buf) < 0
- || target_write_memory (mem_addr, mem_buf, mem_len) != 0)
- write_enn (cs.own_buf);
- else
- write_ok (cs.own_buf);
- }
+ {
+ if (decode_X_packet (&cs.own_buf[1], len - 1, &mem_addr, &mem_len,
+ &mem_buf)
+ < 0
+ || target_write_memory (mem_addr, mem_buf, mem_len) != 0)
+ write_enn (cs.own_buf);
+ else
+ write_ok (cs.own_buf);
+ }
else
- {
- decode_M_packet (&cs.own_buf[1], &mem_addr, &mem_len, &mem_buf);
- if (target_write_memory (mem_addr, mem_buf, mem_len) == 0)
- write_ok (cs.own_buf);
- else
- write_enn (cs.own_buf);
- }
+ {
+ decode_M_packet (&cs.own_buf[1], &mem_addr, &mem_len, &mem_buf);
+ if (target_write_memory (mem_addr, mem_buf, mem_len) == 0)
+ write_ok (cs.own_buf);
+ else
+ write_enn (cs.own_buf);
+ }
free (mem_buf);
if (putpkt (cs.own_buf) < 0)
- return -1;
+ return -1;
len = getpkt (cs.own_buf);
if (len < 0)
- return -1;
+ return -1;
}
if (cs.own_buf[0] == 'E')
{
warning ("An error occurred while relocating an instruction: %s",
- cs.own_buf);
+ cs.own_buf);
return -1;
}
if (!startswith (cs.own_buf, "qRelocInsn:"))
{
- warning ("Malformed response to qRelocInsn, ignoring: %s",
- cs.own_buf);
+ warning ("Malformed response to qRelocInsn, ignoring: %s", cs.own_buf);
return -1;
}
diff --git a/gdbserver/remote-utils.h b/gdbserver/remote-utils.h
index cb2d6c346c9..7a115fe94b9 100644
--- a/gdbserver/remote-utils.h
+++ b/gdbserver/remote-utils.h
@@ -41,7 +41,7 @@ void enable_async_io (void);
void disable_async_io (void);
void check_remote_input_interrupt_request (void);
void prepare_resume_reply (char *buf, ptid_t ptid,
- const target_waitstatus &status);
+ const target_waitstatus &status);
const char *decode_address_to_semicolon (CORE_ADDR *addrp, const char *start);
void decode_address (CORE_ADDR *addrp, const char *start, int len);
@@ -51,22 +51,21 @@ void decode_address (CORE_ADDR *addrp, const char *start, int len);
"<MEM_ADDR_PTR>,<LEN_PTR><END_MARKER>", with END_MARKER being an end marker
character. */
const char *decode_m_packet_params (const char *from, CORE_ADDR *mem_addr_ptr,
- unsigned int *len_ptr,
- const char end_marker);
-void decode_m_packet (const char *from, CORE_ADDR * mem_addr_ptr,
- unsigned int *len_ptr);
-void decode_M_packet (const char *from, CORE_ADDR * mem_addr_ptr,
- unsigned int *len_ptr, unsigned char **to_p);
-int decode_X_packet (char *from, int packet_len, CORE_ADDR * mem_addr_ptr,
- unsigned int *len_ptr, unsigned char **to_p);
-int decode_xfer_write (char *buf, int packet_len,
- CORE_ADDR *offset, unsigned int *len,
- unsigned char *data);
+ unsigned int *len_ptr,
+ const char end_marker);
+void decode_m_packet (const char *from, CORE_ADDR *mem_addr_ptr,
+ unsigned int *len_ptr);
+void decode_M_packet (const char *from, CORE_ADDR *mem_addr_ptr,
+ unsigned int *len_ptr, unsigned char **to_p);
+int decode_X_packet (char *from, int packet_len, CORE_ADDR *mem_addr_ptr,
+ unsigned int *len_ptr, unsigned char **to_p);
+int decode_xfer_write (char *buf, int packet_len, CORE_ADDR *offset,
+ unsigned int *len, unsigned char *data);
int decode_search_memory_packet (const char *buf, int packet_len,
- CORE_ADDR *start_addrp,
- CORE_ADDR *search_space_lenp,
- gdb_byte *pattern,
- unsigned int *pattern_lenp);
+ CORE_ADDR *start_addrp,
+ CORE_ADDR *search_space_lenp,
+ gdb_byte *pattern,
+ unsigned int *pattern_lenp);
void clear_symbol_cache (struct sym_cache **symcache_p);
int look_up_one_symbol (const char *name, CORE_ADDR *addrp, int may_ask_gdb);
diff --git a/gdbserver/server.cc b/gdbserver/server.cc
index 21fb51a45d1..f9327abc40d 100644
--- a/gdbserver/server.cc
+++ b/gdbserver/server.cc
@@ -51,18 +51,18 @@
#include "gdbsupport/scoped_restore.h"
#include "gdbsupport/search.h"
-#define require_running_or_return(BUF) \
- if (!target_running ()) \
- { \
- write_enn (BUF); \
- return; \
+#define require_running_or_return(BUF) \
+ if (!target_running ()) \
+ { \
+ write_enn (BUF); \
+ return; \
}
-#define require_running_or_break(BUF) \
- if (!target_running ()) \
- { \
- write_enn (BUF); \
- break; \
+#define require_running_or_break(BUF) \
+ if (!target_running ()) \
+ { \
+ write_enn (BUF); \
+ break; \
}
/* The environment to pass to the inferior when creating it. */
@@ -87,7 +87,8 @@ static bool keep_processing_events = true;
bool non_stop;
-static struct {
+static struct
+{
/* Set the PROGRAM_PATH. Here we adjust the path of the provided
binary if needed. */
void set (const char *path)
@@ -98,19 +99,18 @@ static struct {
creating it. */
if (!contains_dir_separator (m_path.c_str ()))
{
- int reg_file_errno;
+ int reg_file_errno;
- /* Check if the file is in our CWD. If it is, then we prefix
+ /* Check if the file is in our CWD. If it is, then we prefix
its name with CURRENT_DIRECTORY. Otherwise, we leave the
name as-is because we'll try searching for it in $PATH. */
- if (is_regular_file (m_path.c_str (), &reg_file_errno))
- m_path = gdb_abspath (m_path.c_str ());
+ if (is_regular_file (m_path.c_str (), &reg_file_errno))
+ m_path = gdb_abspath (m_path.c_str ());
}
}
/* Return the PROGRAM_PATH. */
- const char *get ()
- { return m_path.empty () ? nullptr : m_path.c_str (); }
+ const char *get () { return m_path.empty () ? nullptr : m_path.c_str (); }
private:
/* The program name, adjusted if needed. */
@@ -165,7 +165,6 @@ get_client_state ()
return cs;
}
-
/* Put a stop reply to the stop reply queue. */
static void
@@ -200,19 +199,19 @@ discard_queued_stop_replies (ptid_t ptid)
++next;
if (iter == notif_stop.queue.begin ())
- {
- /* The head of the list contains the notification that was
+ {
+ /* The head of the list contains the notification that was
already sent to GDB. So we can't remove it, otherwise
when GDB sends the vStopped, it would ack the _next_
notification, which hadn't been sent yet! */
- continue;
- }
+ continue;
+ }
if (remove_all_on_match_ptid (*iter, ptid))
- {
- delete *iter;
- notif_stop.queue.erase (iter);
- }
+ {
+ delete *iter;
+ notif_stop.queue.erase (iter);
+ }
}
}
@@ -251,15 +250,17 @@ in_queued_stop_replies (ptid_t ptid)
for (notif_event *event : notif_stop.queue)
{
if (in_queued_stop_replies_ptid (event, ptid))
- return true;
+ return true;
}
return false;
}
-struct notif_server notif_stop =
-{
- "vStopped", "Stop", {}, vstop_notif_reply,
+struct notif_server notif_stop = {
+ "vStopped",
+ "Stop",
+ {},
+ vstop_notif_reply,
};
static int
@@ -282,7 +283,7 @@ const char *
get_exec_file (int err)
{
if (err && program_path.get () == NULL)
- error (_("No executable file specified."));
+ error (_ ("No executable file specified."));
return program_path.get ();
}
@@ -324,8 +325,8 @@ attach_inferior (int pid)
process using the "attach" command, but this is different; it's
just using "target remote". Pretend it's just starting up. */
if (cs.last_status.kind () == TARGET_WAITKIND_STOPPED
- && cs.last_status.sig () == GDB_SIGNAL_STOP)
- cs.last_status.set_stopped (GDB_SIGNAL_TRAP);
+ && cs.last_status.sig () == GDB_SIGNAL_STOP)
+ cs.last_status.set_stopped (GDB_SIGNAL_TRAP);
current_thread->last_resume_kind = resume_stop;
current_thread->last_status = cs.last_status;
@@ -393,7 +394,8 @@ write_qxfer_response (char *buf, const gdb_byte *data, int len, int is_more)
buf[0] = 'l';
return remote_escape_output (data, len, 1, (unsigned char *) buf + 1,
- &out_len, PBUFSIZ - 2) + 1;
+ &out_len, PBUFSIZ - 2)
+ + 1;
}
/* Handle btrace enabling in BTS format. */
@@ -402,7 +404,7 @@ static void
handle_btrace_enable_bts (struct thread_info *thread)
{
if (thread->btrace != NULL)
- error (_("Btrace already enabled."));
+ error (_ ("Btrace already enabled."));
current_btrace_conf.format = BTRACE_FORMAT_BTS;
thread->btrace = target_enable_btrace (thread, &current_btrace_conf);
@@ -414,7 +416,7 @@ static void
handle_btrace_enable_pt (struct thread_info *thread)
{
if (thread->btrace != NULL)
- error (_("Btrace already enabled."));
+ error (_ ("Btrace already enabled."));
current_btrace_conf.format = BTRACE_FORMAT_PT;
thread->btrace = target_enable_btrace (thread, &current_btrace_conf);
@@ -425,12 +427,11 @@ handle_btrace_enable_pt (struct thread_info *thread)
static void
handle_btrace_disable (struct thread_info *thread)
{
-
if (thread->btrace == NULL)
- error (_("Branch tracing not enabled."));
+ error (_ ("Branch tracing not enabled."));
if (target_disable_btrace (thread->btrace) != 0)
- error (_("Could not disable branch tracing."));
+ error (_ ("Could not disable branch tracing."));
thread->btrace = NULL;
}
@@ -449,8 +450,7 @@ handle_btrace_general_set (char *own_buf)
op = own_buf + strlen ("Qbtrace:");
- if (cs.general_thread == null_ptid
- || cs.general_thread == minus_one_ptid)
+ if (cs.general_thread == null_ptid || cs.general_thread == minus_one_ptid)
{
strcpy (own_buf, "E.Must select a single thread.");
return -1;
@@ -466,13 +466,13 @@ handle_btrace_general_set (char *own_buf)
try
{
if (strcmp (op, "bts") == 0)
- handle_btrace_enable_bts (thread);
+ handle_btrace_enable_bts (thread);
else if (strcmp (op, "pt") == 0)
- handle_btrace_enable_pt (thread);
+ handle_btrace_enable_pt (thread);
else if (strcmp (op, "off") == 0)
- handle_btrace_disable (thread);
+ handle_btrace_disable (thread);
else
- error (_("Bad Qbtrace operation. Use bts, pt, or off."));
+ error (_ ("Bad Qbtrace operation. Use bts, pt, or off."));
write_ok (own_buf);
}
@@ -498,8 +498,7 @@ handle_btrace_conf_general_set (char *own_buf)
op = own_buf + strlen ("Qbtrace-conf:");
- if (cs.general_thread == null_ptid
- || cs.general_thread == minus_one_ptid)
+ if (cs.general_thread == null_ptid || cs.general_thread == minus_one_ptid)
{
strcpy (own_buf, "E.Must select a single thread.");
return -1;
@@ -520,10 +519,10 @@ handle_btrace_conf_general_set (char *own_buf)
errno = 0;
size = strtoul (op + strlen ("bts:size="), &endp, 16);
if (endp == NULL || *endp != 0 || errno != 0 || size > UINT_MAX)
- {
- strcpy (own_buf, "E.Bad size value.");
- return -1;
- }
+ {
+ strcpy (own_buf, "E.Bad size value.");
+ return -1;
+ }
current_btrace_conf.bts.size = (unsigned int) size;
}
@@ -535,10 +534,10 @@ handle_btrace_conf_general_set (char *own_buf)
errno = 0;
size = strtoul (op + strlen ("pt:size="), &endp, 16);
if (endp == NULL || *endp != 0 || errno != 0 || size > UINT_MAX)
- {
- strcpy (own_buf, "E.Bad size value.");
- return -1;
- }
+ {
+ strcpy (own_buf, "E.Bad size value.");
+ return -1;
+ }
current_btrace_conf.pt.size = (unsigned int) size;
}
@@ -581,7 +580,7 @@ create_fetch_memtags_reply (char *reply, const gdb::byte_vector &tags)
static bool
parse_store_memtags_request (char *request, CORE_ADDR *addr, size_t *len,
- gdb::byte_vector &tags, int *type)
+ gdb::byte_vector &tags, int *type)
{
gdb_assert (startswith (request, "QMemTags:"));
@@ -624,19 +623,19 @@ handle_general_set (char *own_buf)
p = decode_address_to_semicolon (&cursig, p);
for (i = 0; i < numsigs; i++)
- {
- if (i == cursig)
- {
- cs.pass_signals[i] = 1;
- if (*p == '\0')
- /* Keep looping, to clear the remaining signals. */
- cursig = -1;
- else
- p = decode_address_to_semicolon (&cursig, p);
- }
- else
- cs.pass_signals[i] = 0;
- }
+ {
+ if (i == cursig)
+ {
+ cs.pass_signals[i] = 1;
+ if (*p == '\0')
+ /* Keep looping, to clear the remaining signals. */
+ cursig = -1;
+ else
+ p = decode_address_to_semicolon (&cursig, p);
+ }
+ else
+ cs.pass_signals[i] = 0;
+ }
strcpy (own_buf, "OK");
return;
}
@@ -651,19 +650,19 @@ handle_general_set (char *own_buf)
p = decode_address_to_semicolon (&cursig, p);
for (i = 0; i < numsigs; i++)
- {
- if (i == cursig)
- {
- cs.program_signals[i] = 1;
- if (*p == '\0')
- /* Keep looping, to clear the remaining signals. */
- cursig = -1;
- else
- p = decode_address_to_semicolon (&cursig, p);
- }
- else
- cs.program_signals[i] = 0;
- }
+ {
+ if (i == cursig)
+ {
+ cs.program_signals[i] = 1;
+ if (*p == '\0')
+ /* Keep looping, to clear the remaining signals. */
+ cursig = -1;
+ else
+ p = decode_address_to_semicolon (&cursig, p);
+ }
+ else
+ cs.program_signals[i] = 0;
+ }
strcpy (own_buf, "OK");
return;
}
@@ -676,41 +675,41 @@ handle_general_set (char *own_buf)
struct process_info *process;
if (!target_running () || !target_supports_catch_syscall ())
- {
- write_enn (own_buf);
- return;
- }
+ {
+ write_enn (own_buf);
+ return;
+ }
if (strcmp (p, "0") == 0)
- enabled = 0;
+ enabled = 0;
else if (p[0] == '1' && (p[1] == ';' || p[1] == '\0'))
- enabled = 1;
+ enabled = 1;
else
- {
- fprintf (stderr, "Unknown catch-syscalls mode requested: %s\n",
- own_buf);
- write_enn (own_buf);
- return;
- }
+ {
+ fprintf (stderr, "Unknown catch-syscalls mode requested: %s\n",
+ own_buf);
+ write_enn (own_buf);
+ return;
+ }
process = current_process ();
process->syscalls_to_catch.clear ();
if (enabled)
- {
- p += 1;
- if (*p == ';')
- {
- p += 1;
- while (*p != '\0')
- {
- p = decode_address_to_semicolon (&sysno, p);
- process->syscalls_to_catch.push_back (sysno);
- }
- }
- else
- process->syscalls_to_catch.push_back (ANY_SYSCALL);
- }
+ {
+ p += 1;
+ if (*p == ';')
+ {
+ p += 1;
+ while (*p != '\0')
+ {
+ p = decode_address_to_semicolon (&sysno, p);
+ process->syscalls_to_catch.push_back (sysno);
+ }
+ }
+ else
+ process->syscalls_to_catch.push_back (ANY_SYSCALL);
+ }
write_ok (own_buf);
return;
@@ -734,16 +733,16 @@ handle_general_set (char *own_buf)
remote_debug_printf ("[QEnvironmentHexEncoded received '%s']", p);
remote_debug_printf ("[Environment variable to be set: '%s']",
- final_var.c_str ());
+ final_var.c_str ());
size_t pos = final_var.find ('=');
if (pos == std::string::npos)
- {
- warning (_("Unexpected format for environment variable: '%s'"),
- final_var.c_str ());
- write_enn (own_buf);
- return;
- }
+ {
+ warning (_ ("Unexpected format for environment variable: '%s'"),
+ final_var.c_str ());
+ write_enn (own_buf);
+ return;
+ }
var_name = final_var.substr (0, pos);
var_value = final_var.substr (pos + 1, std::string::npos);
@@ -761,7 +760,7 @@ handle_general_set (char *own_buf)
remote_debug_printf ("[QEnvironmentUnset received '%s']", p);
remote_debug_printf ("[Environment variable to be unset: '%s']",
- varname.c_str ());
+ varname.c_str ());
our_environ.unset (varname.c_str ());
@@ -785,26 +784,25 @@ handle_general_set (char *own_buf)
const char *req_str;
if (strcmp (mode, "0") == 0)
- req = 0;
+ req = 0;
else if (strcmp (mode, "1") == 0)
- req = 1;
+ req = 1;
else
- {
- /* We don't know what this mode is, so complain to
+ {
+ /* We don't know what this mode is, so complain to
GDB. */
- fprintf (stderr, "Unknown non-stop mode requested: %s\n",
- own_buf);
- write_enn (own_buf);
- return;
- }
+ fprintf (stderr, "Unknown non-stop mode requested: %s\n", own_buf);
+ write_enn (own_buf);
+ return;
+ }
req_str = req ? "non-stop" : "all-stop";
if (the_target->start_non_stop (req == 1) != 0)
- {
- fprintf (stderr, "Setting %s mode failed\n", req_str);
- write_enn (own_buf);
- return;
- }
+ {
+ fprintf (stderr, "Setting %s mode failed\n", req_str);
+ write_enn (own_buf);
+ return;
+ }
non_stop = (req != 0);
@@ -823,8 +821,8 @@ handle_general_set (char *own_buf)
cs.disable_randomization = setting;
remote_debug_printf (cs.disable_randomization
- ? "[address space randomization disabled]"
- : "[address space randomization enabled]");
+ ? "[address space randomization disabled]"
+ : "[address space randomization enabled]");
write_ok (own_buf);
return;
@@ -840,15 +838,15 @@ handle_general_set (char *own_buf)
int req = 0;
if (strcmp (mode, "0") == 0)
- req = 0;
+ req = 0;
else if (strcmp (mode, "1") == 0)
- req = 1;
+ req = 1;
else
- {
- /* We don't know what this value is, so complain to GDB. */
- sprintf (own_buf, "E.Unknown QAgent value");
- return;
- }
+ {
+ /* We don't know what this value is, so complain to GDB. */
+ sprintf (own_buf, "E.Unknown QAgent value");
+ return;
+ }
/* Update the flag. */
use_agent = req;
@@ -869,23 +867,23 @@ handle_general_set (char *own_buf)
enum tribool req = TRIBOOL_UNKNOWN;
if (strcmp (mode, "0") == 0)
- req = TRIBOOL_FALSE;
+ req = TRIBOOL_FALSE;
else if (strcmp (mode, "1") == 0)
- req = TRIBOOL_TRUE;
+ req = TRIBOOL_TRUE;
else
- {
- /* We don't know what this mode is, so complain to GDB. */
- std::string err
- = string_printf ("E.Unknown thread-events mode requested: %s\n",
- mode);
- strcpy (own_buf, err.c_str ());
- return;
- }
+ {
+ /* We don't know what this mode is, so complain to GDB. */
+ std::string err
+ = string_printf ("E.Unknown thread-events mode requested: %s\n",
+ mode);
+ strcpy (own_buf, err.c_str ());
+ return;
+ }
cs.report_thread_events = (req == TRIBOOL_TRUE);
remote_debug_printf ("[thread events are now %s]\n",
- cs.report_thread_events ? "enabled" : "disabled");
+ cs.report_thread_events ? "enabled" : "disabled");
write_ok (own_buf);
return;
@@ -896,20 +894,20 @@ handle_general_set (char *own_buf)
const char *value = own_buf + strlen ("QStartupWithShell:");
if (strcmp (value, "1") == 0)
- startup_with_shell = true;
+ startup_with_shell = true;
else if (strcmp (value, "0") == 0)
- startup_with_shell = false;
+ startup_with_shell = false;
else
- {
- /* Unknown value. */
- fprintf (stderr, "Unknown value to startup-with-shell: %s\n",
- own_buf);
- write_enn (own_buf);
- return;
- }
+ {
+ /* Unknown value. */
+ fprintf (stderr, "Unknown value to startup-with-shell: %s\n",
+ own_buf);
+ write_enn (own_buf);
+ return;
+ }
remote_debug_printf ("[Inferior will %s started with shell]",
- startup_with_shell ? "be" : "not be");
+ startup_with_shell ? "be" : "not be");
write_ok (own_buf);
return;
@@ -920,32 +918,30 @@ handle_general_set (char *own_buf)
const char *p = own_buf + strlen ("QSetWorkingDir:");
if (*p != '\0')
- {
- std::string path = hex2str (p);
+ {
+ std::string path = hex2str (p);
- remote_debug_printf ("[Set the inferior's current directory to %s]",
- path.c_str ());
+ remote_debug_printf ("[Set the inferior's current directory to %s]",
+ path.c_str ());
- set_inferior_cwd (std::move (path));
- }
+ set_inferior_cwd (std::move (path));
+ }
else
- {
- /* An empty argument means that we should clear out any
+ {
+ /* An empty argument means that we should clear out any
previously set cwd for the inferior. */
- set_inferior_cwd ("");
+ set_inferior_cwd ("");
- remote_debug_printf ("[Unset the inferior's current directory; will "
- "use gdbserver's cwd]");
- }
+ remote_debug_printf ("[Unset the inferior's current directory; will "
+ "use gdbserver's cwd]");
+ }
write_ok (own_buf);
return;
}
-
/* Handle store memory tags packets. */
- if (startswith (own_buf, "QMemTags:")
- && target_supports_memory_tagging ())
+ if (startswith (own_buf, "QMemTags:") && target_supports_memory_tagging ())
{
gdb::byte_vector tags;
CORE_ADDR addr = 0;
@@ -954,16 +950,16 @@ handle_general_set (char *own_buf)
require_running_or_return (own_buf);
- bool ret = parse_store_memtags_request (own_buf, &addr, &len, tags,
- &type);
+ bool ret
+ = parse_store_memtags_request (own_buf, &addr, &len, tags, &type);
if (ret)
- ret = the_target->store_memtags (addr, len, tags, type);
+ ret = the_target->store_memtags (addr, len, tags, type);
if (!ret)
- write_enn (own_buf);
+ write_enn (own_buf);
else
- write_ok (own_buf);
+ write_ok (own_buf);
return;
}
@@ -991,9 +987,9 @@ get_features_xml (const char *annex)
const char *ret = tdesc_get_features_xml (desc);
if (*ret == '@')
- return ret + 1;
+ return ret + 1;
else
- annex = ret;
+ annex = ret;
}
#ifdef USE_XML
@@ -1003,7 +999,7 @@ get_features_xml (const char *annex)
/* Look for the annex. */
for (i = 0; xml_builtin[i][0] != NULL; i++)
if (strcmp (annex, xml_builtin[i][0]) == 0)
- break;
+ break;
if (xml_builtin[i][0] != NULL)
return xml_builtin[i][1];
@@ -1055,14 +1051,14 @@ gdb_read_memory (CORE_ADDR memaddr, unsigned char *myaddr, int len)
ULONGEST nbytes;
ULONGEST length = len;
- if (traceframe_read_mem (cs.current_traceframe,
- memaddr, myaddr, len, &nbytes))
- return -1;
+ if (traceframe_read_mem (cs.current_traceframe, memaddr, myaddr, len,
+ &nbytes))
+ return -1;
/* Data read from trace buffer, we're done. */
if (nbytes > 0)
- return nbytes;
+ return nbytes;
if (!in_readonly_region (memaddr, length))
- return -1;
+ return -1;
/* Otherwise we have a valid readonly case, fall through. */
/* (assume no half-trace half-real blocks for now) */
}
@@ -1089,9 +1085,9 @@ gdb_write_memory (CORE_ADDR memaddr, const unsigned char *myaddr, int len)
int ret;
if (set_desired_process ())
- ret = target_write_memory (memaddr, myaddr, len);
+ ret = target_write_memory (memaddr, myaddr, len);
else
- ret = EIO;
+ ret = EIO;
return ret;
}
}
@@ -1114,21 +1110,20 @@ handle_search_memory (char *own_buf, int packet_len)
error ("Unable to allocate memory to perform the search");
if (decode_search_memory_packet (own_buf + cmd_name_len,
- packet_len - cmd_name_len,
- &start_addr, &search_space_len,
- pattern, &pattern_len) < 0)
+ packet_len - cmd_name_len, &start_addr,
+ &search_space_len, pattern, &pattern_len)
+ < 0)
{
free (pattern);
error ("Error in parsing qSearch:memory packet");
}
- auto read_memory = [] (CORE_ADDR addr, gdb_byte *result, size_t len)
- {
- return gdb_read_memory (addr, result, len) == len;
- };
+ auto read_memory = [] (CORE_ADDR addr, gdb_byte *result, size_t len) {
+ return gdb_read_memory (addr, result, len) == len;
+ };
found = simple_search_memory (read_memory, start_addr, search_space_len,
- pattern, pattern_len, &found_addr);
+ pattern, pattern_len, &found_addr);
if (found > 0)
sprintf (own_buf, "1,%lx", (long) found_addr);
@@ -1158,9 +1153,9 @@ handle_detach (char *own_buf)
}
else
{
- process = (current_thread != nullptr
- ? get_thread_process (current_thread)
- : nullptr);
+ process
+ = (current_thread != nullptr ? get_thread_process (current_thread)
+ : nullptr);
}
if (process == NULL)
@@ -1172,14 +1167,12 @@ handle_detach (char *own_buf)
if ((tracing && disconnected_tracing) || any_persistent_commands (process))
{
if (tracing && disconnected_tracing)
- fprintf (stderr,
- "Disconnected tracing in effect, "
- "leaving gdbserver attached to the process\n");
+ fprintf (stderr, "Disconnected tracing in effect, "
+ "leaving gdbserver attached to the process\n");
if (any_persistent_commands (process))
- fprintf (stderr,
- "Persistent commands are present, "
- "leaving gdbserver attached to the process\n");
+ fprintf (stderr, "Persistent commands are present, "
+ "leaving gdbserver attached to the process\n");
/* Make sure we're in non-stop/async mode, so we we can both
wait for an async socket accept, and handle async target
@@ -1187,12 +1180,12 @@ handle_detach (char *own_buf)
having the target stop all threads, when we're going to
pass signals down without informing GDB. */
if (!non_stop)
- {
- threads_debug_printf ("Forcing non-stop mode");
+ {
+ threads_debug_printf ("Forcing non-stop mode");
- non_stop = true;
- the_target->start_non_stop (true);
- }
+ non_stop = true;
+ the_target->start_non_stop (true);
+ }
process->gdb_detached = 1;
@@ -1220,12 +1213,12 @@ handle_detach (char *own_buf)
{
/* Only threads that are of the process we are detaching. */
if (thread->id.pid () != pid)
- continue;
+ continue;
/* Only threads that have a pending fork event. */
thread_info *child = target_thread_pending_child (thread);
if (child == nullptr)
- continue;
+ continue;
process_info *fork_child_process = get_thread_process (child);
gdb_assert (fork_child_process != nullptr);
@@ -1233,9 +1226,9 @@ handle_detach (char *own_buf)
int fork_child_pid = fork_child_process->pid;
if (detach_inferior (fork_child_process) != 0)
- warning (_("Failed to detach fork child %s, child of %s"),
- target_pid_to_str (ptid_t (fork_child_pid)).c_str (),
- target_pid_to_str (thread->id).c_str ());
+ warning (_ ("Failed to detach fork child %s, child of %s"),
+ target_pid_to_str (ptid_t (fork_child_pid)).c_str (),
+ target_pid_to_str (thread->id).c_str ());
}
if (detach_inferior (process) != 0)
@@ -1246,26 +1239,26 @@ handle_detach (char *own_buf)
write_ok (own_buf);
if (extended_protocol || target_running ())
- {
- /* There is still at least one inferior remaining or
+ {
+ /* There is still at least one inferior remaining or
we are in extended mode, so don't terminate gdbserver,
and instead treat this like a normal program exit. */
- cs.last_status.set_exited (0);
- cs.last_ptid = ptid_t (pid);
+ cs.last_status.set_exited (0);
+ cs.last_ptid = ptid_t (pid);
- switch_to_thread (nullptr);
- }
+ switch_to_thread (nullptr);
+ }
else
- {
- putpkt (own_buf);
- remote_close ();
+ {
+ putpkt (own_buf);
+ remote_close ();
- /* If we are attached, then we can exit. Otherwise, we
+ /* If we are attached, then we can exit. Otherwise, we
need to hang around doing nothing, until the child is
gone. */
- join_inferior (pid);
- exit (0);
- }
+ join_inferior (pid);
+ exit (0);
+ }
}
}
@@ -1302,31 +1295,31 @@ parse_debug_format_options (const char *arg, int is_monitor)
for (const gdb::unique_xmalloc_ptr<char> &option : options)
{
if (strcmp (option.get (), "all") == 0)
- {
- debug_timestamp = 1;
- if (is_monitor)
- monitor_output ("All extra debug format options enabled.\n");
- }
+ {
+ debug_timestamp = 1;
+ if (is_monitor)
+ monitor_output ("All extra debug format options enabled.\n");
+ }
else if (strcmp (option.get (), "none") == 0)
- {
- debug_timestamp = 0;
- if (is_monitor)
- monitor_output ("All extra debug format options disabled.\n");
- }
+ {
+ debug_timestamp = 0;
+ if (is_monitor)
+ monitor_output ("All extra debug format options disabled.\n");
+ }
else if (strcmp (option.get (), "timestamp") == 0)
- {
- debug_timestamp = 1;
- if (is_monitor)
- monitor_output ("Timestamps will be added to debug output.\n");
- }
+ {
+ debug_timestamp = 1;
+ if (is_monitor)
+ monitor_output ("Timestamps will be added to debug output.\n");
+ }
else if (*option == '\0')
- {
- /* An empty option, e.g., "--debug-format=foo,,bar", is ignored. */
- continue;
- }
+ {
+ /* An empty option, e.g., "--debug-format=foo,,bar", is ignored. */
+ continue;
+ }
else
- return string_printf ("Unknown debug-format argument: \"%s\"\n",
- option.get ());
+ return string_printf ("Unknown debug-format argument: \"%s\"\n",
+ option.get ());
}
return std::string ();
@@ -1380,15 +1373,15 @@ handle_monitor_command (char *mon, char *own_buf)
else if (startswith (mon, "set debug-format "))
{
std::string error_msg
- = parse_debug_format_options (mon + sizeof ("set debug-format ") - 1,
- 1);
+ = parse_debug_format_options (mon + sizeof ("set debug-format ") - 1,
+ 1);
if (!error_msg.empty ())
- {
- monitor_output (error_msg.c_str ());
- monitor_show_help ();
- write_enn (own_buf);
- }
+ {
+ monitor_output (error_msg.c_str ());
+ monitor_show_help ();
+ write_enn (own_buf);
+ }
}
else if (strcmp (mon, "set debug-file") == 0)
debug_set_output (nullptr);
@@ -1425,17 +1418,15 @@ struct qxfer
not indicate the end of the object, only the end of the transfer.
One, and only one, of readbuf or writebuf must be non-NULL. */
- int (*xfer) (const char *annex,
- gdb_byte *readbuf, const gdb_byte *writebuf,
- ULONGEST offset, LONGEST len);
+ int (*xfer) (const char *annex, gdb_byte *readbuf, const gdb_byte *writebuf,
+ ULONGEST offset, LONGEST len);
};
/* Handle qXfer:auxv:read. */
static int
-handle_qxfer_auxv (const char *annex,
- gdb_byte *readbuf, const gdb_byte *writebuf,
- ULONGEST offset, LONGEST len)
+handle_qxfer_auxv (const char *annex, gdb_byte *readbuf,
+ const gdb_byte *writebuf, ULONGEST offset, LONGEST len)
{
if (!the_target->supports_read_auxv () || writebuf != NULL)
return -2;
@@ -1444,15 +1435,14 @@ handle_qxfer_auxv (const char *annex,
return -1;
return the_target->read_auxv (current_thread->id.pid (), offset, readbuf,
- len);
+ len);
}
/* Handle qXfer:exec-file:read. */
static int
-handle_qxfer_exec_file (const char *annex,
- gdb_byte *readbuf, const gdb_byte *writebuf,
- ULONGEST offset, LONGEST len)
+handle_qxfer_exec_file (const char *annex, gdb_byte *readbuf,
+ const gdb_byte *writebuf, ULONGEST offset, LONGEST len)
{
ULONGEST pid;
int total_len;
@@ -1463,7 +1453,7 @@ handle_qxfer_exec_file (const char *annex,
if (annex[0] == '\0')
{
if (current_thread == NULL)
- return -1;
+ return -1;
pid = pid_of (current_thread);
}
@@ -1471,7 +1461,7 @@ handle_qxfer_exec_file (const char *annex,
{
annex = unpack_varlen_hex (annex, &pid);
if (annex[0] != '\0')
- return -1;
+ return -1;
}
if (pid <= 0)
@@ -1496,9 +1486,8 @@ handle_qxfer_exec_file (const char *annex,
/* Handle qXfer:features:read. */
static int
-handle_qxfer_features (const char *annex,
- gdb_byte *readbuf, const gdb_byte *writebuf,
- ULONGEST offset, LONGEST len)
+handle_qxfer_features (const char *annex, gdb_byte *readbuf,
+ const gdb_byte *writebuf, ULONGEST offset, LONGEST len)
{
const char *document;
size_t total_len;
@@ -1529,9 +1518,8 @@ handle_qxfer_features (const char *annex,
/* Handle qXfer:libraries:read. */
static int
-handle_qxfer_libraries (const char *annex,
- gdb_byte *readbuf, const gdb_byte *writebuf,
- ULONGEST offset, LONGEST len)
+handle_qxfer_libraries (const char *annex, gdb_byte *readbuf,
+ const gdb_byte *writebuf, ULONGEST offset, LONGEST len)
{
if (writebuf != NULL)
return -2;
@@ -1543,9 +1531,9 @@ handle_qxfer_libraries (const char *annex,
process_info *proc = current_process ();
for (const dll_info &dll : proc->all_dlls)
- document += string_printf
- (" <library name=\"%s\"><segment address=\"0x%s\"/></library>\n",
- dll.name.c_str (), paddress (dll.base_addr));
+ document += string_printf (
+ " <library name=\"%s\"><segment address=\"0x%s\"/></library>\n",
+ dll.name.c_str (), paddress (dll.base_addr));
document += "</library-list>\n";
@@ -1563,27 +1551,25 @@ handle_qxfer_libraries (const char *annex,
/* Handle qXfer:libraries-svr4:read. */
static int
-handle_qxfer_libraries_svr4 (const char *annex,
- gdb_byte *readbuf, const gdb_byte *writebuf,
- ULONGEST offset, LONGEST len)
+handle_qxfer_libraries_svr4 (const char *annex, gdb_byte *readbuf,
+ const gdb_byte *writebuf, ULONGEST offset,
+ LONGEST len)
{
if (writebuf != NULL)
return -2;
- if (current_thread == NULL
- || !the_target->supports_qxfer_libraries_svr4 ())
+ if (current_thread == NULL || !the_target->supports_qxfer_libraries_svr4 ())
return -1;
- return the_target->qxfer_libraries_svr4 (annex, readbuf, writebuf,
- offset, len);
+ return the_target->qxfer_libraries_svr4 (annex, readbuf, writebuf, offset,
+ len);
}
/* Handle qXfer:osadata:read. */
static int
-handle_qxfer_osdata (const char *annex,
- gdb_byte *readbuf, const gdb_byte *writebuf,
- ULONGEST offset, LONGEST len)
+handle_qxfer_osdata (const char *annex, gdb_byte *readbuf,
+ const gdb_byte *writebuf, ULONGEST offset, LONGEST len)
{
if (!the_target->supports_qxfer_osdata () || writebuf != NULL)
return -2;
@@ -1594,9 +1580,8 @@ handle_qxfer_osdata (const char *annex,
/* Handle qXfer:siginfo:read and qXfer:siginfo:write. */
static int
-handle_qxfer_siginfo (const char *annex,
- gdb_byte *readbuf, const gdb_byte *writebuf,
- ULONGEST offset, LONGEST len)
+handle_qxfer_siginfo (const char *annex, gdb_byte *readbuf,
+ const gdb_byte *writebuf, ULONGEST offset, LONGEST len)
{
if (!the_target->supports_qxfer_siginfo ())
return -2;
@@ -1610,9 +1595,9 @@ handle_qxfer_siginfo (const char *annex,
/* Handle qXfer:statictrace:read. */
static int
-handle_qxfer_statictrace (const char *annex,
- gdb_byte *readbuf, const gdb_byte *writebuf,
- ULONGEST offset, LONGEST len)
+handle_qxfer_statictrace (const char *annex, gdb_byte *readbuf,
+ const gdb_byte *writebuf, ULONGEST offset,
+ LONGEST len)
{
client_state &cs = get_client_state ();
ULONGEST nbytes;
@@ -1620,12 +1605,12 @@ handle_qxfer_statictrace (const char *annex,
if (writebuf != NULL)
return -2;
- if (annex[0] != '\0' || current_thread == NULL
+ if (annex[0] != '\0' || current_thread == NULL
|| cs.current_traceframe == -1)
return -1;
- if (traceframe_read_sdata (cs.current_traceframe, offset,
- readbuf, len, &nbytes))
+ if (traceframe_read_sdata (cs.current_traceframe, offset, readbuf, len,
+ &nbytes))
return -1;
return nbytes;
}
@@ -1692,10 +1677,9 @@ handle_qxfer_threads_proper (struct buffer *buffer)
if (non_stop)
target_pause_all (true);
- for_each_thread ([&] (thread_info *thread)
- {
- handle_qxfer_threads_worker (thread, buffer);
- });
+ for_each_thread ([&] (thread_info *thread) {
+ handle_qxfer_threads_worker (thread, buffer);
+ });
if (non_stop)
target_unpause_all (true);
@@ -1707,9 +1691,8 @@ handle_qxfer_threads_proper (struct buffer *buffer)
/* Handle qXfer:threads:read. */
static int
-handle_qxfer_threads (const char *annex,
- gdb_byte *readbuf, const gdb_byte *writebuf,
- ULONGEST offset, LONGEST len)
+handle_qxfer_threads (const char *annex, gdb_byte *readbuf,
+ const gdb_byte *writebuf, ULONGEST offset, LONGEST len)
{
static char *result = 0;
static unsigned int result_length = 0;
@@ -1726,7 +1709,7 @@ handle_qxfer_threads (const char *annex,
/* When asked for data at offset 0, generate everything and store into
'result'. Successive reads will be served off 'result'. */
if (result)
- free (result);
+ free (result);
buffer_init (&buffer);
@@ -1737,7 +1720,7 @@ handle_qxfer_threads (const char *annex,
buffer_free (&buffer);
if (!res)
- return -1;
+ return -1;
}
if (offset >= result_length)
@@ -1760,9 +1743,9 @@ handle_qxfer_threads (const char *annex,
/* Handle qXfer:traceframe-info:read. */
static int
-handle_qxfer_traceframe_info (const char *annex,
- gdb_byte *readbuf, const gdb_byte *writebuf,
- ULONGEST offset, LONGEST len)
+handle_qxfer_traceframe_info (const char *annex, gdb_byte *readbuf,
+ const gdb_byte *writebuf, ULONGEST offset,
+ LONGEST len)
{
client_state &cs = get_client_state ();
static char *result = 0;
@@ -1812,7 +1795,7 @@ handle_qxfer_traceframe_info (const char *annex,
static int
handle_qxfer_fdpic (const char *annex, gdb_byte *readbuf,
- const gdb_byte *writebuf, ULONGEST offset, LONGEST len)
+ const gdb_byte *writebuf, ULONGEST offset, LONGEST len)
{
if (!the_target->supports_read_loadmap ())
return -2;
@@ -1826,9 +1809,8 @@ handle_qxfer_fdpic (const char *annex, gdb_byte *readbuf,
/* Handle qXfer:btrace:read. */
static int
-handle_qxfer_btrace (const char *annex,
- gdb_byte *readbuf, const gdb_byte *writebuf,
- ULONGEST offset, LONGEST len)
+handle_qxfer_btrace (const char *annex, gdb_byte *readbuf,
+ const gdb_byte *writebuf, ULONGEST offset, LONGEST len)
{
client_state &cs = get_client_state ();
static struct buffer cache;
@@ -1839,8 +1821,7 @@ handle_qxfer_btrace (const char *annex,
if (writebuf != NULL)
return -2;
- if (cs.general_thread == null_ptid
- || cs.general_thread == minus_one_ptid)
+ if (cs.general_thread == null_ptid || cs.general_thread == minus_one_ptid)
{
strcpy (cs.own_buf, "E.Must select a single thread.");
return -3;
@@ -1876,19 +1857,19 @@ handle_qxfer_btrace (const char *annex,
buffer_free (&cache);
try
- {
- result = target_read_btrace (thread->btrace, &cache, type);
- if (result != 0)
- memcpy (cs.own_buf, cache.buffer, cache.used_size);
- }
+ {
+ result = target_read_btrace (thread->btrace, &cache, type);
+ if (result != 0)
+ memcpy (cs.own_buf, cache.buffer, cache.used_size);
+ }
catch (const gdb_exception_error &exception)
- {
- sprintf (cs.own_buf, "E.%s", exception.what ());
- result = -1;
- }
+ {
+ sprintf (cs.own_buf, "E.%s", exception.what ());
+ result = -1;
+ }
if (result != 0)
- return -3;
+ return -3;
}
else if (offset > cache.used_size)
{
@@ -1907,9 +1888,9 @@ handle_qxfer_btrace (const char *annex,
/* Handle qXfer:btrace-conf:read. */
static int
-handle_qxfer_btrace_conf (const char *annex,
- gdb_byte *readbuf, const gdb_byte *writebuf,
- ULONGEST offset, LONGEST len)
+handle_qxfer_btrace_conf (const char *annex, gdb_byte *readbuf,
+ const gdb_byte *writebuf, ULONGEST offset,
+ LONGEST len)
{
client_state &cs = get_client_state ();
static struct buffer cache;
@@ -1922,8 +1903,7 @@ handle_qxfer_btrace_conf (const char *annex,
if (annex[0] != '\0')
return -1;
- if (cs.general_thread == null_ptid
- || cs.general_thread == minus_one_ptid)
+ if (cs.general_thread == null_ptid || cs.general_thread == minus_one_ptid)
{
strcpy (cs.own_buf, "E.Must select a single thread.");
return -3;
@@ -1947,19 +1927,19 @@ handle_qxfer_btrace_conf (const char *annex,
buffer_free (&cache);
try
- {
- result = target_read_btrace_conf (thread->btrace, &cache);
- if (result != 0)
- memcpy (cs.own_buf, cache.buffer, cache.used_size);
- }
+ {
+ result = target_read_btrace_conf (thread->btrace, &cache);
+ if (result != 0)
+ memcpy (cs.own_buf, cache.buffer, cache.used_size);
+ }
catch (const gdb_exception_error &exception)
- {
- sprintf (cs.own_buf, "E.%s", exception.what ());
- result = -1;
- }
+ {
+ sprintf (cs.own_buf, "E.%s", exception.what ());
+ result = -1;
+ }
if (result != 0)
- return -3;
+ return -3;
}
else if (offset > cache.used_size)
{
@@ -1975,22 +1955,21 @@ handle_qxfer_btrace_conf (const char *annex,
return len;
}
-static const struct qxfer qxfer_packets[] =
- {
- { "auxv", handle_qxfer_auxv },
- { "btrace", handle_qxfer_btrace },
- { "btrace-conf", handle_qxfer_btrace_conf },
- { "exec-file", handle_qxfer_exec_file},
- { "fdpic", handle_qxfer_fdpic},
- { "features", handle_qxfer_features },
- { "libraries", handle_qxfer_libraries },
- { "libraries-svr4", handle_qxfer_libraries_svr4 },
- { "osdata", handle_qxfer_osdata },
- { "siginfo", handle_qxfer_siginfo },
- { "statictrace", handle_qxfer_statictrace },
- { "threads", handle_qxfer_threads },
- { "traceframe-info", handle_qxfer_traceframe_info },
- };
+static const struct qxfer qxfer_packets[] = {
+ { "auxv", handle_qxfer_auxv },
+ { "btrace", handle_qxfer_btrace },
+ { "btrace-conf", handle_qxfer_btrace_conf },
+ { "exec-file", handle_qxfer_exec_file },
+ { "fdpic", handle_qxfer_fdpic },
+ { "features", handle_qxfer_features },
+ { "libraries", handle_qxfer_libraries },
+ { "libraries-svr4", handle_qxfer_libraries_svr4 },
+ { "osdata", handle_qxfer_osdata },
+ { "siginfo", handle_qxfer_siginfo },
+ { "statictrace", handle_qxfer_statictrace },
+ { "threads", handle_qxfer_threads },
+ { "traceframe-info", handle_qxfer_traceframe_info },
+};
static int
handle_qxfer (char *own_buf, int packet_len, int *new_packet_len_p)
@@ -2011,101 +1990,102 @@ handle_qxfer (char *own_buf, int packet_len, int *new_packet_len_p)
return 1;
}
- for (i = 0;
- i < sizeof (qxfer_packets) / sizeof (qxfer_packets[0]);
- i++)
+ for (i = 0; i < sizeof (qxfer_packets) / sizeof (qxfer_packets[0]); i++)
{
const struct qxfer *q = &qxfer_packets[i];
if (strcmp (object, q->object) == 0)
- {
- if (strcmp (rw, "read") == 0)
- {
- unsigned char *data;
- int n;
- CORE_ADDR ofs;
- unsigned int len;
-
- /* Grab the offset and length. */
- if (decode_xfer_read (offset, &ofs, &len) < 0)
- {
- write_enn (own_buf);
- return 1;
- }
-
- /* Read one extra byte, as an indicator of whether there is
+ {
+ if (strcmp (rw, "read") == 0)
+ {
+ unsigned char *data;
+ int n;
+ CORE_ADDR ofs;
+ unsigned int len;
+
+ /* Grab the offset and length. */
+ if (decode_xfer_read (offset, &ofs, &len) < 0)
+ {
+ write_enn (own_buf);
+ return 1;
+ }
+
+ /* Read one extra byte, as an indicator of whether there is
more. */
- if (len > PBUFSIZ - 2)
- len = PBUFSIZ - 2;
- data = (unsigned char *) malloc (len + 1);
- if (data == NULL)
- {
- write_enn (own_buf);
- return 1;
- }
- n = (*q->xfer) (annex, data, NULL, ofs, len + 1);
- if (n == -2)
- {
- free (data);
- return 0;
- }
- else if (n == -3)
- {
- /* Preserve error message. */
- }
- else if (n < 0)
- write_enn (own_buf);
- else if (n > len)
- *new_packet_len_p = write_qxfer_response (own_buf, data, len, 1);
- else
- *new_packet_len_p = write_qxfer_response (own_buf, data, n, 0);
-
- free (data);
- return 1;
- }
- else if (strcmp (rw, "write") == 0)
- {
- int n;
- unsigned int len;
- CORE_ADDR ofs;
- unsigned char *data;
-
- strcpy (own_buf, "E00");
- data = (unsigned char *) malloc (packet_len - (offset - own_buf));
- if (data == NULL)
- {
- write_enn (own_buf);
- return 1;
- }
- if (decode_xfer_write (offset, packet_len - (offset - own_buf),
- &ofs, &len, data) < 0)
- {
- free (data);
- write_enn (own_buf);
- return 1;
- }
-
- n = (*q->xfer) (annex, NULL, data, ofs, len);
- if (n == -2)
- {
- free (data);
- return 0;
- }
- else if (n == -3)
- {
- /* Preserve error message. */
- }
- else if (n < 0)
- write_enn (own_buf);
- else
- sprintf (own_buf, "%x", n);
-
- free (data);
- return 1;
- }
-
- return 0;
- }
+ if (len > PBUFSIZ - 2)
+ len = PBUFSIZ - 2;
+ data = (unsigned char *) malloc (len + 1);
+ if (data == NULL)
+ {
+ write_enn (own_buf);
+ return 1;
+ }
+ n = (*q->xfer) (annex, data, NULL, ofs, len + 1);
+ if (n == -2)
+ {
+ free (data);
+ return 0;
+ }
+ else if (n == -3)
+ {
+ /* Preserve error message. */
+ }
+ else if (n < 0)
+ write_enn (own_buf);
+ else if (n > len)
+ *new_packet_len_p
+ = write_qxfer_response (own_buf, data, len, 1);
+ else
+ *new_packet_len_p = write_qxfer_response (own_buf, data, n, 0);
+
+ free (data);
+ return 1;
+ }
+ else if (strcmp (rw, "write") == 0)
+ {
+ int n;
+ unsigned int len;
+ CORE_ADDR ofs;
+ unsigned char *data;
+
+ strcpy (own_buf, "E00");
+ data
+ = (unsigned char *) malloc (packet_len - (offset - own_buf));
+ if (data == NULL)
+ {
+ write_enn (own_buf);
+ return 1;
+ }
+ if (decode_xfer_write (offset, packet_len - (offset - own_buf),
+ &ofs, &len, data)
+ < 0)
+ {
+ free (data);
+ write_enn (own_buf);
+ return 1;
+ }
+
+ n = (*q->xfer) (annex, NULL, data, ofs, len);
+ if (n == -2)
+ {
+ free (data);
+ return 0;
+ }
+ else if (n == -3)
+ {
+ /* Preserve error message. */
+ }
+ else if (n < 0)
+ write_enn (own_buf);
+ else
+ sprintf (own_buf, "%x", n);
+
+ free (data);
+ return 1;
+ }
+
+ return 0;
+ }
}
return 0;
@@ -2125,7 +2105,7 @@ crc32 (CORE_ADDR base, int len, unsigned int crc)
/* Return failure if memory read fails. */
if (read_inferior_memory (base, &byte, 1) != 0)
- return (unsigned long long) -1;
+ return (unsigned long long) -1;
crc = xcrc32 (&byte, 1, crc);
base++;
@@ -2137,7 +2117,7 @@ crc32 (CORE_ADDR base, int len, unsigned int crc)
static void
parse_fetch_memtags_request (char *request, CORE_ADDR *addr, size_t *len,
- int *type)
+ int *type)
{
gdb_assert (startswith (request, "qMemTags:"));
@@ -2182,13 +2162,14 @@ handle_query (char *own_buf, int packet_len, int *new_packet_len_p)
ptid_t ptid;
require_running_or_return (own_buf);
- if (cs.general_thread != null_ptid && cs.general_thread != minus_one_ptid)
- ptid = cs.general_thread;
+ if (cs.general_thread != null_ptid
+ && cs.general_thread != minus_one_ptid)
+ ptid = cs.general_thread;
else
- {
- thread_iter = all_threads.begin ();
- ptid = (*thread_iter)->id;
- }
+ {
+ thread_iter = all_threads.begin ();
+ ptid = (*thread_iter)->id;
+ }
sprintf (own_buf, "QC");
own_buf += 2;
@@ -2206,19 +2187,19 @@ handle_query (char *own_buf, int packet_len, int *new_packet_len_p)
the same process. This can happen e.g., if we followed an
exec in a non-leader thread. */
if (current_thread == NULL)
- {
- thread_info *any_thread
- = find_any_thread_of_pid (cs.general_thread.pid ());
- switch_to_thread (any_thread);
+ {
+ thread_info *any_thread
+ = find_any_thread_of_pid (cs.general_thread.pid ());
+ switch_to_thread (any_thread);
- /* Just in case, if we didn't find a thread, then bail out
+ /* Just in case, if we didn't find a thread, then bail out
instead of crashing. */
- if (current_thread == NULL)
- {
- write_enn (own_buf);
- return;
- }
- }
+ if (current_thread == NULL)
+ {
+ write_enn (own_buf);
+ return;
+ }
+ }
/* GDB is suggesting new symbols have been loaded. This may
mean a new shared library has been detected as loaded, so
@@ -2233,10 +2214,10 @@ handle_query (char *own_buf, int packet_len, int *new_packet_len_p)
validate_breakpoints ();
if (target_supports_tracepoints ())
- tracepoint_look_up_symbols ();
+ tracepoint_look_up_symbols ();
if (current_thread != NULL)
- the_target->look_up_symbols ();
+ the_target->look_up_symbols ();
strcpy (own_buf, "OK");
return;
@@ -2245,34 +2226,34 @@ handle_query (char *own_buf, int packet_len, int *new_packet_len_p)
if (!disable_packet_qfThreadInfo)
{
if (strcmp ("qfThreadInfo", own_buf) == 0)
- {
- require_running_or_return (own_buf);
- thread_iter = all_threads.begin ();
+ {
+ require_running_or_return (own_buf);
+ thread_iter = all_threads.begin ();
- *own_buf++ = 'm';
- ptid_t ptid = (*thread_iter)->id;
- write_ptid (own_buf, ptid);
- thread_iter++;
- return;
- }
+ *own_buf++ = 'm';
+ ptid_t ptid = (*thread_iter)->id;
+ write_ptid (own_buf, ptid);
+ thread_iter++;
+ return;
+ }
if (strcmp ("qsThreadInfo", own_buf) == 0)
- {
- require_running_or_return (own_buf);
- if (thread_iter != all_threads.end ())
- {
- *own_buf++ = 'm';
- ptid_t ptid = (*thread_iter)->id;
- write_ptid (own_buf, ptid);
- thread_iter++;
- return;
- }
- else
- {
- sprintf (own_buf, "l");
- return;
- }
- }
+ {
+ require_running_or_return (own_buf);
+ if (thread_iter != all_threads.end ())
+ {
+ *own_buf++ = 'm';
+ ptid_t ptid = (*thread_iter)->id;
+ write_ptid (own_buf, ptid);
+ thread_iter++;
+ return;
+ }
+ else
+ {
+ sprintf (own_buf, "l");
+ return;
+ }
+ }
}
if (the_target->supports_read_offsets ()
@@ -2282,10 +2263,10 @@ handle_query (char *own_buf, int packet_len, int *new_packet_len_p)
require_running_or_return (own_buf);
if (the_target->read_offsets (&text, &data))
- sprintf (own_buf, "Text=%lX;Data=%lX;Bss=%lX",
- (long)text, (long)data, (long)data);
+ sprintf (own_buf, "Text=%lX;Data=%lX;Bss=%lX", (long) text,
+ (long) data, (long) data);
else
- write_enn (own_buf);
+ write_enn (own_buf);
return;
}
@@ -2301,121 +2282,120 @@ handle_query (char *own_buf, int packet_len, int *new_packet_len_p)
feature will follow a ':', and latter features will follow
';'. */
if (*p == ':')
- {
- std::vector<std::string> qsupported;
- std::vector<const char *> unknowns;
+ {
+ std::vector<std::string> qsupported;
+ std::vector<const char *> unknowns;
- /* Two passes, to avoid nested strtok calls in
+ /* Two passes, to avoid nested strtok calls in
target_process_qsupported. */
- char *saveptr;
- for (p = strtok_r (p + 1, ";", &saveptr);
- p != NULL;
- p = strtok_r (NULL, ";", &saveptr))
- qsupported.emplace_back (p);
-
- for (const std::string &feature : qsupported)
- {
- if (feature == "multiprocess+")
- {
- /* GDB supports and wants multi-process support if
+ char *saveptr;
+ for (p = strtok_r (p + 1, ";", &saveptr); p != NULL;
+ p = strtok_r (NULL, ";", &saveptr))
+ qsupported.emplace_back (p);
+
+ for (const std::string &feature : qsupported)
+ {
+ if (feature == "multiprocess+")
+ {
+ /* GDB supports and wants multi-process support if
possible. */
- if (target_supports_multi_process ())
- cs.multi_process = 1;
- }
- else if (feature == "qRelocInsn+")
- {
- /* GDB supports relocate instruction requests. */
- gdb_supports_qRelocInsn = 1;
- }
- else if (feature == "swbreak+")
- {
- /* GDB wants us to report whether a trap is caused
+ if (target_supports_multi_process ())
+ cs.multi_process = 1;
+ }
+ else if (feature == "qRelocInsn+")
+ {
+ /* GDB supports relocate instruction requests. */
+ gdb_supports_qRelocInsn = 1;
+ }
+ else if (feature == "swbreak+")
+ {
+ /* GDB wants us to report whether a trap is caused
by a software breakpoint and for us to handle PC
adjustment if necessary on this target. */
- if (target_supports_stopped_by_sw_breakpoint ())
- cs.swbreak_feature = 1;
- }
- else if (feature == "hwbreak+")
- {
- /* GDB wants us to report whether a trap is caused
+ if (target_supports_stopped_by_sw_breakpoint ())
+ cs.swbreak_feature = 1;
+ }
+ else if (feature == "hwbreak+")
+ {
+ /* GDB wants us to report whether a trap is caused
by a hardware breakpoint. */
- if (target_supports_stopped_by_hw_breakpoint ())
- cs.hwbreak_feature = 1;
- }
- else if (feature == "fork-events+")
- {
- /* GDB supports and wants fork events if possible. */
- if (target_supports_fork_events ())
- cs.report_fork_events = 1;
- }
- else if (feature == "vfork-events+")
- {
- /* GDB supports and wants vfork events if possible. */
- if (target_supports_vfork_events ())
- cs.report_vfork_events = 1;
- }
- else if (feature == "exec-events+")
- {
- /* GDB supports and wants exec events if possible. */
- if (target_supports_exec_events ())
- cs.report_exec_events = 1;
- }
- else if (feature == "vContSupported+")
- cs.vCont_supported = 1;
- else if (feature == "QThreadEvents+")
- ;
- else if (feature == "no-resumed+")
- {
- /* GDB supports and wants TARGET_WAITKIND_NO_RESUMED
+ if (target_supports_stopped_by_hw_breakpoint ())
+ cs.hwbreak_feature = 1;
+ }
+ else if (feature == "fork-events+")
+ {
+ /* GDB supports and wants fork events if possible. */
+ if (target_supports_fork_events ())
+ cs.report_fork_events = 1;
+ }
+ else if (feature == "vfork-events+")
+ {
+ /* GDB supports and wants vfork events if possible. */
+ if (target_supports_vfork_events ())
+ cs.report_vfork_events = 1;
+ }
+ else if (feature == "exec-events+")
+ {
+ /* GDB supports and wants exec events if possible. */
+ if (target_supports_exec_events ())
+ cs.report_exec_events = 1;
+ }
+ else if (feature == "vContSupported+")
+ cs.vCont_supported = 1;
+ else if (feature == "QThreadEvents+")
+ ;
+ else if (feature == "no-resumed+")
+ {
+ /* GDB supports and wants TARGET_WAITKIND_NO_RESUMED
events. */
- report_no_resumed = true;
- }
- else if (feature == "memory-tagging+")
- {
- /* GDB supports memory tagging features. */
- if (target_supports_memory_tagging ())
- cs.memory_tagging_feature = true;
- }
- else
- {
- /* Move the unknown features all together. */
- unknowns.push_back (feature.c_str ());
- }
- }
-
- /* Give the target backend a chance to process the unknown
+ report_no_resumed = true;
+ }
+ else if (feature == "memory-tagging+")
+ {
+ /* GDB supports memory tagging features. */
+ if (target_supports_memory_tagging ())
+ cs.memory_tagging_feature = true;
+ }
+ else
+ {
+ /* Move the unknown features all together. */
+ unknowns.push_back (feature.c_str ());
+ }
+ }
+
+ /* Give the target backend a chance to process the unknown
features. */
- target_process_qsupported (unknowns);
- }
+ target_process_qsupported (unknowns);
+ }
sprintf (own_buf,
- "PacketSize=%x;QPassSignals+;QProgramSignals+;"
- "QStartupWithShell+;QEnvironmentHexEncoded+;"
- "QEnvironmentReset+;QEnvironmentUnset+;"
- "QSetWorkingDir+",
- PBUFSIZ - 1);
+ "PacketSize=%x;QPassSignals+;QProgramSignals+;"
+ "QStartupWithShell+;QEnvironmentHexEncoded+;"
+ "QEnvironmentReset+;QEnvironmentUnset+;"
+ "QSetWorkingDir+",
+ PBUFSIZ - 1);
if (target_supports_catch_syscall ())
- strcat (own_buf, ";QCatchSyscalls+");
+ strcat (own_buf, ";QCatchSyscalls+");
if (the_target->supports_qxfer_libraries_svr4 ())
- strcat (own_buf, ";qXfer:libraries-svr4:read+"
- ";augmented-libraries-svr4-read+");
+ strcat (own_buf, ";qXfer:libraries-svr4:read+"
+ ";augmented-libraries-svr4-read+");
else
- {
- /* We do not have any hook to indicate whether the non-SVR4 target
+ {
+ /* We do not have any hook to indicate whether the non-SVR4 target
backend supports qXfer:libraries:read, so always report it. */
- strcat (own_buf, ";qXfer:libraries:read+");
- }
+ strcat (own_buf, ";qXfer:libraries:read+");
+ }
if (the_target->supports_read_auxv ())
- strcat (own_buf, ";qXfer:auxv:read+");
+ strcat (own_buf, ";qXfer:auxv:read+");
if (the_target->supports_qxfer_siginfo ())
- strcat (own_buf, ";qXfer:siginfo:read+;qXfer:siginfo:write+");
+ strcat (own_buf, ";qXfer:siginfo:read+;qXfer:siginfo:write+");
if (the_target->supports_read_loadmap ())
- strcat (own_buf, ";qXfer:fdpic:read+");
+ strcat (own_buf, ";qXfer:fdpic:read+");
/* We always report qXfer:features:read, as targets may
install XML files on a subsequent call to arch_setup.
@@ -2424,69 +2404,69 @@ handle_query (char *own_buf, int packet_len, int *new_packet_len_p)
strcat (own_buf, ";qXfer:features:read+");
if (cs.transport_is_reliable)
- strcat (own_buf, ";QStartNoAckMode+");
+ strcat (own_buf, ";QStartNoAckMode+");
if (the_target->supports_qxfer_osdata ())
- strcat (own_buf, ";qXfer:osdata:read+");
+ strcat (own_buf, ";qXfer:osdata:read+");
if (target_supports_multi_process ())
- strcat (own_buf, ";multiprocess+");
+ strcat (own_buf, ";multiprocess+");
if (target_supports_fork_events ())
- strcat (own_buf, ";fork-events+");
+ strcat (own_buf, ";fork-events+");
if (target_supports_vfork_events ())
- strcat (own_buf, ";vfork-events+");
+ strcat (own_buf, ";vfork-events+");
if (target_supports_exec_events ())
- strcat (own_buf, ";exec-events+");
+ strcat (own_buf, ";exec-events+");
if (target_supports_non_stop ())
- strcat (own_buf, ";QNonStop+");
+ strcat (own_buf, ";QNonStop+");
if (target_supports_disable_randomization ())
- strcat (own_buf, ";QDisableRandomization+");
+ strcat (own_buf, ";QDisableRandomization+");
strcat (own_buf, ";qXfer:threads:read+");
if (target_supports_tracepoints ())
- {
- strcat (own_buf, ";ConditionalTracepoints+");
- strcat (own_buf, ";TraceStateVariables+");
- strcat (own_buf, ";TracepointSource+");
- strcat (own_buf, ";DisconnectedTracing+");
- if (gdb_supports_qRelocInsn && target_supports_fast_tracepoints ())
- strcat (own_buf, ";FastTracepoints+");
- strcat (own_buf, ";StaticTracepoints+");
- strcat (own_buf, ";InstallInTrace+");
- strcat (own_buf, ";qXfer:statictrace:read+");
- strcat (own_buf, ";qXfer:traceframe-info:read+");
- strcat (own_buf, ";EnableDisableTracepoints+");
- strcat (own_buf, ";QTBuffer:size+");
- strcat (own_buf, ";tracenz+");
- }
+ {
+ strcat (own_buf, ";ConditionalTracepoints+");
+ strcat (own_buf, ";TraceStateVariables+");
+ strcat (own_buf, ";TracepointSource+");
+ strcat (own_buf, ";DisconnectedTracing+");
+ if (gdb_supports_qRelocInsn && target_supports_fast_tracepoints ())
+ strcat (own_buf, ";FastTracepoints+");
+ strcat (own_buf, ";StaticTracepoints+");
+ strcat (own_buf, ";InstallInTrace+");
+ strcat (own_buf, ";qXfer:statictrace:read+");
+ strcat (own_buf, ";qXfer:traceframe-info:read+");
+ strcat (own_buf, ";EnableDisableTracepoints+");
+ strcat (own_buf, ";QTBuffer:size+");
+ strcat (own_buf, ";tracenz+");
+ }
if (target_supports_hardware_single_step ()
- || target_supports_software_single_step () )
- {
- strcat (own_buf, ";ConditionalBreakpoints+");
- }
+ || target_supports_software_single_step ())
+ {
+ strcat (own_buf, ";ConditionalBreakpoints+");
+ }
strcat (own_buf, ";BreakpointCommands+");
if (target_supports_agent ())
- strcat (own_buf, ";QAgent+");
+ strcat (own_buf, ";QAgent+");
if (the_target->supports_btrace ())
- supported_btrace_packets (own_buf);
+ supported_btrace_packets (own_buf);
if (target_supports_stopped_by_sw_breakpoint ())
- strcat (own_buf, ";swbreak+");
+ strcat (own_buf, ";swbreak+");
if (target_supports_stopped_by_hw_breakpoint ())
- strcat (own_buf, ";hwbreak+");
+ strcat (own_buf, ";hwbreak+");
if (the_target->supports_pid_to_exec_file ())
- strcat (own_buf, ";qXfer:exec-file:read+");
+ strcat (own_buf, ";qXfer:exec-file:read+");
strcat (own_buf, ";vContSupported+");
@@ -2495,7 +2475,7 @@ handle_query (char *own_buf, int packet_len, int *new_packet_len_p)
strcat (own_buf, ";no-resumed+");
if (target_supports_memory_tagging ())
- strcat (own_buf, ";memory-tagging+");
+ strcat (own_buf, ";memory-tagging+");
/* Reinitialize components as needed for the new connection. */
hostio_handle_new_gdb_connection ();
@@ -2516,55 +2496,55 @@ handle_query (char *own_buf, int packet_len, int *new_packet_len_p)
require_running_or_return (own_buf);
for (i = 0; i < 3; i++)
- {
- char *p2;
- int len;
-
- if (p == NULL)
- break;
-
- p2 = strchr (p, ',');
- if (p2)
- {
- len = p2 - p;
- p2++;
- }
- else
- {
- len = strlen (p);
- p2 = NULL;
- }
-
- if (i == 0)
- ptid = read_ptid (p, NULL);
- else
- decode_address (&parts[i - 1], p, len);
- p = p2;
- }
+ {
+ char *p2;
+ int len;
+
+ if (p == NULL)
+ break;
+
+ p2 = strchr (p, ',');
+ if (p2)
+ {
+ len = p2 - p;
+ p2++;
+ }
+ else
+ {
+ len = strlen (p);
+ p2 = NULL;
+ }
+
+ if (i == 0)
+ ptid = read_ptid (p, NULL);
+ else
+ decode_address (&parts[i - 1], p, len);
+ p = p2;
+ }
if (p != NULL || i < 3)
- err = 1;
+ err = 1;
else
- {
- struct thread_info *thread = find_thread_ptid (ptid);
+ {
+ struct thread_info *thread = find_thread_ptid (ptid);
- if (thread == NULL)
- err = 2;
- else
- err = the_target->get_tls_address (thread, parts[0], parts[1],
- &address);
- }
+ if (thread == NULL)
+ err = 2;
+ else
+ err = the_target->get_tls_address (thread, parts[0], parts[1],
+ &address);
+ }
if (err == 0)
- {
- strcpy (own_buf, paddress(address));
- return;
- }
+ {
+ strcpy (own_buf, paddress (address));
+ return;
+ }
else if (err > 0)
- {
- write_enn (own_buf);
- return;
- }
+ {
+ write_enn (own_buf);
+ return;
+ }
/* Otherwise, pretend we do not understand this packet. */
}
@@ -2580,15 +2560,15 @@ handle_query (char *own_buf, int packet_len, int *new_packet_len_p)
n = the_target->get_tib_address (ptid, &tlb);
if (n == 1)
- {
- strcpy (own_buf, paddress(tlb));
- return;
- }
+ {
+ strcpy (own_buf, paddress (tlb));
+ return;
+ }
else if (n == 0)
- {
- write_enn (own_buf);
- return;
- }
+ {
+ write_enn (own_buf);
+ return;
+ }
return;
}
@@ -2599,25 +2579,25 @@ handle_query (char *own_buf, int packet_len, int *new_packet_len_p)
int len = strlen (own_buf + 6);
if (mon == NULL)
- {
- write_enn (own_buf);
- return;
- }
+ {
+ write_enn (own_buf);
+ return;
+ }
if ((len % 2) != 0
- || hex2bin (own_buf + 6, (gdb_byte *) mon, len / 2) != len / 2)
- {
- write_enn (own_buf);
- free (mon);
- return;
- }
+ || hex2bin (own_buf + 6, (gdb_byte *) mon, len / 2) != len / 2)
+ {
+ write_enn (own_buf);
+ free (mon);
+ return;
+ }
mon[len / 2] = '\0';
write_ok (own_buf);
if (the_target->handle_monitor_command (mon) == 0)
- /* Default processing. */
- handle_monitor_command (mon, own_buf);
+ /* Default processing. */
+ handle_monitor_command (mon, own_buf);
free (mon);
return;
@@ -2630,27 +2610,26 @@ handle_query (char *own_buf, int packet_len, int *new_packet_len_p)
return;
}
- if (strcmp (own_buf, "qAttached") == 0
- || startswith (own_buf, "qAttached:"))
+ if (strcmp (own_buf, "qAttached") == 0 || startswith (own_buf, "qAttached:"))
{
struct process_info *process;
if (own_buf[sizeof ("qAttached") - 1])
- {
- int pid = strtoul (own_buf + sizeof ("qAttached:") - 1, NULL, 16);
- process = find_process_pid (pid);
- }
+ {
+ int pid = strtoul (own_buf + sizeof ("qAttached:") - 1, NULL, 16);
+ process = find_process_pid (pid);
+ }
else
- {
- require_running_or_return (own_buf);
- process = current_process ();
- }
+ {
+ require_running_or_return (own_buf);
+ process = current_process ();
+ }
if (process == NULL)
- {
- write_enn (own_buf);
- return;
- }
+ {
+ write_enn (own_buf);
+ return;
+ }
strcpy (own_buf, process->attached ? "1" : "0");
return;
@@ -2667,18 +2646,18 @@ handle_query (char *own_buf, int packet_len, int *new_packet_len_p)
require_running_or_return (own_buf);
comma = unpack_varlen_hex (own_buf + 5, &base);
if (*comma++ != ',')
- {
- write_enn (own_buf);
- return;
- }
+ {
+ write_enn (own_buf);
+ return;
+ }
len = strtoul (comma, NULL, 16);
crc = crc32 (base, len, 0xffffffff);
/* Check for memory failure. */
if (crc == (unsigned long long) -1)
- {
- write_enn (own_buf);
- return;
- }
+ {
+ write_enn (own_buf);
+ return;
+ }
sprintf (own_buf, "C%lx", (unsigned long) crc);
return;
}
@@ -2690,8 +2669,7 @@ handle_query (char *own_buf, int packet_len, int *new_packet_len_p)
return;
/* Handle fetch memory tags packets. */
- if (startswith (own_buf, "qMemTags:")
- && target_supports_memory_tagging ())
+ if (startswith (own_buf, "qMemTags:") && target_supports_memory_tagging ())
{
gdb::byte_vector tags;
CORE_ADDR addr = 0;
@@ -2705,10 +2683,10 @@ handle_query (char *own_buf, int packet_len, int *new_packet_len_p)
bool ret = the_target->fetch_memtags (addr, len, tags, type);
if (ret)
- ret = create_fetch_memtags_reply (own_buf, tags);
+ ret = create_fetch_memtags_reply (own_buf, tags);
if (!ret)
- write_enn (own_buf);
+ write_enn (own_buf);
*new_packet_len_p = strlen (own_buf);
return;
@@ -2723,8 +2701,8 @@ static void gdb_wants_all_threads_stopped (void);
static void resume (struct thread_resume *actions, size_t n);
/* The callback that is passed to visit_actioned_threads. */
-typedef int (visit_actioned_threads_callback_ftype)
- (const struct thread_resume *, struct thread_info *);
+typedef int (visit_actioned_threads_callback_ftype) (
+ const struct thread_resume *, struct thread_info *);
/* Call CALLBACK for any thread to which ACTIONS applies to. Returns
true if CALLBACK returns true. Returns false if no matching thread
@@ -2733,23 +2711,21 @@ typedef int (visit_actioned_threads_callback_ftype)
static bool
visit_actioned_threads (thread_info *thread,
- const struct thread_resume *actions,
- size_t num_actions,
- visit_actioned_threads_callback_ftype *callback)
+ const struct thread_resume *actions,
+ size_t num_actions,
+ visit_actioned_threads_callback_ftype *callback)
{
for (size_t i = 0; i < num_actions; i++)
{
const struct thread_resume *action = &actions[i];
- if (action->thread == minus_one_ptid
- || action->thread == thread->id
- || ((action->thread.pid ()
- == thread->id.pid ())
- && action->thread.lwp () == -1))
- {
- if ((*callback) (action, thread))
- return true;
- }
+ if (action->thread == minus_one_ptid || action->thread == thread->id
+ || ((action->thread.pid () == thread->id.pid ())
+ && action->thread.lwp () == -1))
+ {
+ if ((*callback) (action, thread))
+ return true;
+ }
}
return false;
@@ -2760,7 +2736,7 @@ visit_actioned_threads (thread_info *thread,
static int
handle_pending_status (const struct thread_resume *resumption,
- struct thread_info *thread)
+ struct thread_info *thread)
{
client_state &cs = get_client_state ();
if (thread->status_pending_p)
@@ -2782,7 +2758,10 @@ handle_v_cont (char *own_buf)
const char *p;
int n = 0, i = 0;
struct thread_resume *resume_info;
- struct thread_resume default_action { null_ptid };
+ struct thread_resume default_action
+ {
+ null_ptid
+ };
/* Count the number of semicolons in the packet. There should be one
for every action. */
@@ -2806,69 +2785,69 @@ handle_v_cont (char *own_buf)
memset (&resume_info[i], 0, sizeof resume_info[i]);
if (p[0] == 's' || p[0] == 'S')
- resume_info[i].kind = resume_step;
+ resume_info[i].kind = resume_step;
else if (p[0] == 'r')
- resume_info[i].kind = resume_step;
+ resume_info[i].kind = resume_step;
else if (p[0] == 'c' || p[0] == 'C')
- resume_info[i].kind = resume_continue;
+ resume_info[i].kind = resume_continue;
else if (p[0] == 't')
- resume_info[i].kind = resume_stop;
+ resume_info[i].kind = resume_stop;
else
- goto err;
+ goto err;
if (p[0] == 'S' || p[0] == 'C')
- {
- char *q;
- int sig = strtol (p + 1, &q, 16);
- if (p == q)
- goto err;
- p = q;
-
- if (!gdb_signal_to_host_p ((enum gdb_signal) sig))
- goto err;
- resume_info[i].sig = gdb_signal_to_host ((enum gdb_signal) sig);
- }
+ {
+ char *q;
+ int sig = strtol (p + 1, &q, 16);
+ if (p == q)
+ goto err;
+ p = q;
+
+ if (!gdb_signal_to_host_p ((enum gdb_signal) sig))
+ goto err;
+ resume_info[i].sig = gdb_signal_to_host ((enum gdb_signal) sig);
+ }
else if (p[0] == 'r')
- {
- ULONGEST addr;
+ {
+ ULONGEST addr;
- p = unpack_varlen_hex (p + 1, &addr);
- resume_info[i].step_range_start = addr;
+ p = unpack_varlen_hex (p + 1, &addr);
+ resume_info[i].step_range_start = addr;
- if (*p != ',')
- goto err;
+ if (*p != ',')
+ goto err;
- p = unpack_varlen_hex (p + 1, &addr);
- resume_info[i].step_range_end = addr;
- }
+ p = unpack_varlen_hex (p + 1, &addr);
+ resume_info[i].step_range_end = addr;
+ }
else
- {
- p = p + 1;
- }
+ {
+ p = p + 1;
+ }
if (p[0] == 0)
- {
- resume_info[i].thread = minus_one_ptid;
- default_action = resume_info[i];
+ {
+ resume_info[i].thread = minus_one_ptid;
+ default_action = resume_info[i];
- /* Note: we don't increment i here, we'll overwrite this entry
+ /* Note: we don't increment i here, we'll overwrite this entry
the next time through. */
- }
+ }
else if (p[0] == ':')
- {
- const char *q;
- ptid_t ptid = read_ptid (p + 1, &q);
+ {
+ const char *q;
+ ptid_t ptid = read_ptid (p + 1, &q);
- if (p == q)
- goto err;
- p = q;
- if (p[0] != ';' && p[0] != 0)
- goto err;
+ if (p == q)
+ goto err;
+ p = q;
+ if (p[0] != ';' && p[0] != 0)
+ goto err;
- resume_info[i].thread = ptid;
+ resume_info[i].thread = ptid;
- i++;
- }
+ i++;
+ }
}
if (i < n)
@@ -2897,14 +2876,14 @@ resume (struct thread_resume *actions, size_t num_actions)
resuming/stopping and report the pending event
immediately. */
- thread_info *thread_with_status = find_thread ([&] (thread_info *thread)
- {
- return visit_actioned_threads (thread, actions, num_actions,
- handle_pending_status);
- });
+ thread_info *thread_with_status
+ = find_thread ([&] (thread_info *thread) {
+ return visit_actioned_threads (thread, actions, num_actions,
+ handle_pending_status);
+ });
if (thread_with_status != NULL)
- return;
+ return;
enable_async_io ();
}
@@ -2918,19 +2897,19 @@ resume (struct thread_resume *actions, size_t num_actions)
cs.last_ptid = mywait (minus_one_ptid, &cs.last_status, 0, 1);
if (cs.last_status.kind () == TARGET_WAITKIND_NO_RESUMED
- && !report_no_resumed)
- {
- /* The client does not support this stop reply. At least
+ && !report_no_resumed)
+ {
+ /* The client does not support this stop reply. At least
return error. */
- sprintf (cs.own_buf, "E.No unwaited-for children left.");
- disable_async_io ();
- return;
- }
+ sprintf (cs.own_buf, "E.No unwaited-for children left.");
+ disable_async_io ();
+ return;
+ }
if (cs.last_status.kind () != TARGET_WAITKIND_EXITED
- && cs.last_status.kind () != TARGET_WAITKIND_SIGNALLED
- && cs.last_status.kind () != TARGET_WAITKIND_NO_RESUMED)
- current_thread->last_status = cs.last_status;
+ && cs.last_status.kind () != TARGET_WAITKIND_SIGNALLED
+ && cs.last_status.kind () != TARGET_WAITKIND_NO_RESUMED)
+ current_thread->last_status = cs.last_status;
/* From the client's perspective, all-stop mode always stops all
threads implicitly (and the target backend has already done
@@ -2941,8 +2920,8 @@ resume (struct thread_resume *actions, size_t num_actions)
disable_async_io ();
if (cs.last_status.kind () == TARGET_WAITKIND_EXITED
- || cs.last_status.kind () == TARGET_WAITKIND_SIGNALLED)
- target_mourn_inferior (cs.last_ptid);
+ || cs.last_status.kind () == TARGET_WAITKIND_SIGNALLED)
+ target_mourn_inferior (cs.last_ptid);
}
}
@@ -2963,14 +2942,14 @@ handle_v_attach (char *own_buf)
current_process ()->dlls_changed = false;
if (non_stop)
- {
- /* In non-stop, we don't send a resume reply. Stop events
+ {
+ /* In non-stop, we don't send a resume reply. Stop events
will follow up using the normal notification
mechanism. */
- write_ok (own_buf);
- }
+ write_ok (own_buf);
+ }
else
- prepare_resume_reply (own_buf, cs.last_ptid, cs.last_status);
+ prepare_resume_reply (own_buf, cs.last_ptid, cs.last_status);
}
else
write_enn (own_buf);
@@ -2990,73 +2969,73 @@ handle_v_run (char *own_buf)
{
next_p = strchr (p, ';');
if (next_p == NULL)
- next_p = p + strlen (p);
+ next_p = p + strlen (p);
if (i == 0 && p == next_p)
- {
- /* No program specified. */
- new_program_name = NULL;
- }
+ {
+ /* No program specified. */
+ new_program_name = NULL;
+ }
else if (p == next_p)
- {
- /* Empty argument. */
- new_argv.push_back (xstrdup (""));
- }
+ {
+ /* Empty argument. */
+ new_argv.push_back (xstrdup (""));
+ }
else
- {
- size_t len = (next_p - p) / 2;
- /* ARG is the unquoted argument received via the RSP. */
- char *arg = (char *) xmalloc (len + 1);
- /* FULL_ARGS will contain the quoted version of ARG. */
- char *full_arg = (char *) xmalloc ((len + 1) * 2);
- /* These are pointers used to navigate the strings above. */
- char *tmp_arg = arg;
- char *tmp_full_arg = full_arg;
- int need_quote = 0;
-
- hex2bin (p, (gdb_byte *) arg, len);
- arg[len] = '\0';
-
- while (*tmp_arg != '\0')
- {
- switch (*tmp_arg)
- {
- case '\n':
- /* Quote \n. */
- *tmp_full_arg = '\'';
- ++tmp_full_arg;
- need_quote = 1;
- break;
-
- case '\'':
- /* Quote single quote. */
- *tmp_full_arg = '\\';
- ++tmp_full_arg;
- break;
-
- default:
- break;
- }
-
- *tmp_full_arg = *tmp_arg;
- ++tmp_full_arg;
- ++tmp_arg;
- }
-
- if (need_quote)
- *tmp_full_arg++ = '\'';
-
- /* Finish FULL_ARG and push it into the vector containing
+ {
+ size_t len = (next_p - p) / 2;
+ /* ARG is the unquoted argument received via the RSP. */
+ char *arg = (char *) xmalloc (len + 1);
+ /* FULL_ARGS will contain the quoted version of ARG. */
+ char *full_arg = (char *) xmalloc ((len + 1) * 2);
+ /* These are pointers used to navigate the strings above. */
+ char *tmp_arg = arg;
+ char *tmp_full_arg = full_arg;
+ int need_quote = 0;
+
+ hex2bin (p, (gdb_byte *) arg, len);
+ arg[len] = '\0';
+
+ while (*tmp_arg != '\0')
+ {
+ switch (*tmp_arg)
+ {
+ case '\n':
+ /* Quote \n. */
+ *tmp_full_arg = '\'';
+ ++tmp_full_arg;
+ need_quote = 1;
+ break;
+
+ case '\'':
+ /* Quote single quote. */
+ *tmp_full_arg = '\\';
+ ++tmp_full_arg;
+ break;
+
+ default:
+ break;
+ }
+
+ *tmp_full_arg = *tmp_arg;
+ ++tmp_full_arg;
+ ++tmp_arg;
+ }
+
+ if (need_quote)
+ *tmp_full_arg++ = '\'';
+
+ /* Finish FULL_ARG and push it into the vector containing
the argv. */
- *tmp_full_arg = '\0';
- if (i == 0)
- new_program_name = full_arg;
- else
- new_argv.push_back (full_arg);
- xfree (arg);
- }
+ *tmp_full_arg = '\0';
+ if (i == 0)
+ new_program_name = full_arg;
+ else
+ new_argv.push_back (full_arg);
+ xfree (arg);
+ }
if (*next_p)
- next_p++;
+ next_p++;
}
if (new_program_name == NULL)
@@ -3064,11 +3043,11 @@ handle_v_run (char *own_buf)
/* GDB didn't specify a program to run. Use the program from the
last run with the new argument list. */
if (program_path.get () == NULL)
- {
- write_enn (own_buf);
- free_vector_argv (new_argv);
- return;
- }
+ {
+ write_enn (own_buf);
+ free_vector_argv (new_argv);
+ return;
+ }
}
else
program_path.set (new_program_name);
@@ -3087,7 +3066,7 @@ handle_v_run (char *own_buf)
thread, but GDB assumes a vRun sets it (this is so GDB can
query which is the main thread of the new inferior. */
if (non_stop)
- cs.general_thread = cs.last_ptid;
+ cs.general_thread = cs.last_ptid;
}
else
write_enn (own_buf);
@@ -3126,42 +3105,42 @@ handle_v_requests (char *own_buf, int packet_len, int *new_packet_len)
if (!disable_packet_vCont)
{
if (strcmp (own_buf, "vCtrlC") == 0)
- {
- the_target->request_interrupt ();
- write_ok (own_buf);
- return;
- }
+ {
+ the_target->request_interrupt ();
+ write_ok (own_buf);
+ return;
+ }
if (startswith (own_buf, "vCont;"))
- {
- handle_v_cont (own_buf);
- return;
- }
+ {
+ handle_v_cont (own_buf);
+ return;
+ }
if (startswith (own_buf, "vCont?"))
- {
- strcpy (own_buf, "vCont;c;C;t");
-
- if (target_supports_hardware_single_step ()
- || target_supports_software_single_step ()
- || !cs.vCont_supported)
- {
- /* If target supports single step either by hardware or by
+ {
+ strcpy (own_buf, "vCont;c;C;t");
+
+ if (target_supports_hardware_single_step ()
+ || target_supports_software_single_step ()
+ || !cs.vCont_supported)
+ {
+ /* If target supports single step either by hardware or by
software, add actions s and S to the list of supported
actions. On the other hand, if GDB doesn't request the
supported vCont actions in qSupported packet, add s and
S to the list too. */
- own_buf = own_buf + strlen (own_buf);
- strcpy (own_buf, ";s;S");
- }
+ own_buf = own_buf + strlen (own_buf);
+ strcpy (own_buf, ";s;S");
+ }
- if (target_supports_range_stepping ())
- {
- own_buf = own_buf + strlen (own_buf);
- strcpy (own_buf, ";r");
- }
- return;
- }
+ if (target_supports_range_stepping ())
+ {
+ own_buf = own_buf + strlen (own_buf);
+ strcpy (own_buf, ";r");
+ }
+ return;
+ }
}
if (startswith (own_buf, "vFile:")
@@ -3171,11 +3150,11 @@ handle_v_requests (char *own_buf, int packet_len, int *new_packet_len)
if (startswith (own_buf, "vAttach;"))
{
if ((!extended_protocol || !cs.multi_process) && target_running ())
- {
- fprintf (stderr, "Already debugging a process\n");
- write_enn (own_buf);
- return;
- }
+ {
+ fprintf (stderr, "Already debugging a process\n");
+ write_enn (own_buf);
+ return;
+ }
handle_v_attach (own_buf);
return;
}
@@ -3183,11 +3162,11 @@ handle_v_requests (char *own_buf, int packet_len, int *new_packet_len)
if (startswith (own_buf, "vRun;"))
{
if ((!extended_protocol || !cs.multi_process) && target_running ())
- {
- fprintf (stderr, "Already debugging a process\n");
- write_enn (own_buf);
- return;
- }
+ {
+ fprintf (stderr, "Already debugging a process\n");
+ write_enn (own_buf);
+ return;
+ }
handle_v_run (own_buf);
return;
}
@@ -3195,11 +3174,11 @@ handle_v_requests (char *own_buf, int packet_len, int *new_packet_len)
if (startswith (own_buf, "vKill;"))
{
if (!target_running ())
- {
- fprintf (stderr, "No process to kill\n");
- write_enn (own_buf);
- return;
- }
+ {
+ fprintf (stderr, "No process to kill\n");
+ write_enn (own_buf);
+ return;
+ }
handle_v_kill (own_buf);
return;
}
@@ -3224,16 +3203,16 @@ myresume (char *own_buf, int step, int sig)
int n = 0;
int valid_cont_thread;
- valid_cont_thread = (cs.cont_thread != null_ptid
- && cs.cont_thread != minus_one_ptid);
+ valid_cont_thread
+ = (cs.cont_thread != null_ptid && cs.cont_thread != minus_one_ptid);
if (step || sig || valid_cont_thread)
{
resume_info[0].thread = current_ptid;
if (step)
- resume_info[0].kind = resume_step;
+ resume_info[0].kind = resume_step;
else
- resume_info[0].kind = resume_continue;
+ resume_info[0].kind = resume_continue;
resume_info[0].sig = sig;
n++;
}
@@ -3270,18 +3249,18 @@ queue_stop_reply_callback (thread_info *thread)
else
{
if (target_thread_stopped (thread))
- {
- threads_debug_printf
- ("Reporting thread %s as already stopped with %s",
- target_pid_to_str (thread->id).c_str (),
- thread->last_status.to_string ().c_str ());
+ {
+ threads_debug_printf (
+ "Reporting thread %s as already stopped with %s",
+ target_pid_to_str (thread->id).c_str (),
+ thread->last_status.to_string ().c_str ());
- gdb_assert (thread->last_status.kind () != TARGET_WAITKIND_IGNORE);
+ gdb_assert (thread->last_status.kind () != TARGET_WAITKIND_IGNORE);
- /* Pass the last stop reply back to GDB, but don't notify
+ /* Pass the last stop reply back to GDB, but don't notify
yet. */
- queue_stop_reply (thread->id, thread->last_status);
- }
+ queue_stop_reply (thread->id, thread->last_status);
+ }
}
}
@@ -3318,13 +3297,13 @@ set_pending_status_callback (thread_info *thread)
{
if (thread->last_status.kind () != TARGET_WAITKIND_STOPPED
|| (thread->last_status.sig () != GDB_SIGNAL_0
- /* A breakpoint, watchpoint or finished step from a previous
+ /* A breakpoint, watchpoint or finished step from a previous
GDB run isn't considered interesting for a new GDB run.
If we left those pending, the new GDB could consider them
random SIGTRAPs. This leaves out real async traps. We'd
have to peek into the (target-specific) siginfo to
distinguish those. */
- && thread->last_status.sig () != GDB_SIGNAL_TRAP))
+ && thread->last_status.sig () != GDB_SIGNAL_TRAP))
thread->status_pending_p = 1;
}
@@ -3336,9 +3315,7 @@ handle_status (char *own_buf)
client_state &cs = get_client_state ();
/* GDB is connected, don't forward events to the target anymore. */
- for_each_process ([] (process_info *process) {
- process->gdb_detached = 0;
- });
+ for_each_process ([] (process_info *process) { process->gdb_detached = 0; });
/* In non-stop mode, we must send a stop reply for each stopped
thread. In all-stop mode, just send one for the first stopped
@@ -3372,41 +3349,39 @@ handle_status (char *own_buf)
/* Prefer the last thread that reported an event to GDB (even if
that was a GDB_SIGNAL_TRAP). */
if (cs.last_status.kind () != TARGET_WAITKIND_IGNORE
- && cs.last_status.kind () != TARGET_WAITKIND_EXITED
- && cs.last_status.kind () != TARGET_WAITKIND_SIGNALLED)
- thread = find_thread_ptid (cs.last_ptid);
+ && cs.last_status.kind () != TARGET_WAITKIND_EXITED
+ && cs.last_status.kind () != TARGET_WAITKIND_SIGNALLED)
+ thread = find_thread_ptid (cs.last_ptid);
/* If the last event thread is not found for some reason, look
for some other thread that might have an event to report. */
if (thread == NULL)
- thread = find_thread ([] (thread_info *thr_arg)
- {
- return thr_arg->status_pending_p;
- });
+ thread = find_thread (
+ [] (thread_info *thr_arg) { return thr_arg->status_pending_p; });
/* If we're still out of luck, simply pick the first thread in
the thread list. */
if (thread == NULL)
- thread = get_first_thread ();
+ thread = get_first_thread ();
if (thread != NULL)
- {
- struct thread_info *tp = (struct thread_info *) thread;
+ {
+ struct thread_info *tp = (struct thread_info *) thread;
- /* We're reporting this event, so it's no longer
+ /* We're reporting this event, so it's no longer
pending. */
- tp->status_pending_p = 0;
+ tp->status_pending_p = 0;
- /* GDB assumes the current thread is the thread we're
+ /* GDB assumes the current thread is the thread we're
reporting the status for. */
- cs.general_thread = thread->id;
- set_desired_thread ();
+ cs.general_thread = thread->id;
+ set_desired_thread ();
- gdb_assert (tp->last_status.kind () != TARGET_WAITKIND_IGNORE);
- prepare_resume_reply (own_buf, tp->id, tp->last_status);
- }
+ gdb_assert (tp->last_status.kind () != TARGET_WAITKIND_IGNORE);
+ prepare_resume_reply (own_buf, tp->id, tp->last_status);
+ }
else
- strcpy (own_buf, "W00");
+ strcpy (own_buf, "W00");
}
}
@@ -3414,70 +3389,75 @@ static void
gdbserver_version (void)
{
printf ("GNU gdbserver %s%s\n"
- "Copyright (C) 2023 Free Software Foundation, Inc.\n"
- "gdbserver is free software, covered by the "
- "GNU General Public License.\n"
- "This gdbserver was configured as \"%s\"\n",
- PKGVERSION, version, host_name);
+ "Copyright (C) 2023 Free Software Foundation, Inc.\n"
+ "gdbserver is free software, covered by the "
+ "GNU General Public License.\n"
+ "This gdbserver was configured as \"%s\"\n",
+ PKGVERSION, version, host_name);
}
static void
gdbserver_usage (FILE *stream)
{
- fprintf (stream, "Usage:\tgdbserver [OPTIONS] COMM PROG [ARGS ...]\n"
- "\tgdbserver [OPTIONS] --attach COMM PID\n"
- "\tgdbserver [OPTIONS] --multi COMM\n"
- "\n"
- "COMM may either be a tty device (for serial debugging),\n"
- "HOST:PORT to listen for a TCP connection, or '-' or 'stdio' to use \n"
- "stdin/stdout of gdbserver.\n"
- "PROG is the executable program. ARGS are arguments passed to inferior.\n"
- "PID is the process ID to attach to, when --attach is specified.\n"
- "\n"
- "Operating modes:\n"
- "\n"
- " --attach Attach to running process PID.\n"
- " --multi Start server without a specific program, and\n"
- " only quit when explicitly commanded.\n"
- " --once Exit after the first connection has closed.\n"
- " --help Print this message and then exit.\n"
- " --version Display version information and exit.\n"
- "\n"
- "Other options:\n"
- "\n"
- " --wrapper WRAPPER -- Run WRAPPER to start new programs.\n"
- " --disable-randomization\n"
- " Run PROG with address space randomization disabled.\n"
- " --no-disable-randomization\n"
- " Don't disable address space randomization when\n"
- " starting PROG.\n"
- " --startup-with-shell\n"
- " Start PROG using a shell. I.e., execs a shell that\n"
- " then execs PROG. (default)\n"
- " --no-startup-with-shell\n"
- " Exec PROG directly instead of using a shell.\n"
- " Disables argument globbing and variable substitution\n"
- " on UNIX-like systems.\n"
- "\n"
- "Debug options:\n"
- "\n"
- " --debug Enable general debugging output.\n"
- " --debug-format=OPT1[,OPT2,...]\n"
- " Specify extra content in debugging output.\n"
- " Options:\n"
- " all\n"
- " none\n"
- " timestamp\n"
- " --remote-debug Enable remote protocol debugging output.\n"
- " --event-loop-debug Enable event loop debugging output.\n"
- " --disable-packet=OPT1[,OPT2,...]\n"
- " Disable support for RSP packets or features.\n"
- " Options:\n"
- " vCont, T, Tthread, qC, qfThreadInfo and \n"
- " threads (disable all threading packets).\n"
- "\n"
- "For more information, consult the GDB manual (available as on-line \n"
- "info or a printed manual).\n");
+ fprintf (
+ stream,
+ "Usage:\tgdbserver [OPTIONS] COMM PROG [ARGS ...]\n"
+ "\tgdbserver [OPTIONS] --attach COMM PID\n"
+ "\tgdbserver [OPTIONS] --multi COMM\n"
+ "\n"
+ "COMM may either be a tty device (for serial debugging),\n"
+ "HOST:PORT to listen for a TCP connection, or '-' or 'stdio' to use \n"
+ "stdin/stdout of gdbserver.\n"
+ "PROG is the executable program. ARGS are arguments passed to inferior.\n"
+ "PID is the process ID to attach to, when --attach is specified.\n"
+ "\n"
+ "Operating modes:\n"
+ "\n"
+ " --attach Attach to running process PID.\n"
+ " --multi Start server without a specific program, and\n"
+ " only quit when explicitly commanded.\n"
+ " --once Exit after the first connection has closed.\n"
+ " --help Print this message and then exit.\n"
+ " --version Display version information and exit.\n"
+ "\n"
+ "Other options:\n"
+ "\n"
+ " --wrapper WRAPPER -- Run WRAPPER to start new programs.\n"
+ " --disable-randomization\n"
+ " Run PROG with address space randomization "
+ "disabled.\n"
+ " --no-disable-randomization\n"
+ " Don't disable address space randomization when\n"
+ " starting PROG.\n"
+ " --startup-with-shell\n"
+ " Start PROG using a shell. I.e., execs a shell "
+ "that\n"
+ " then execs PROG. (default)\n"
+ " --no-startup-with-shell\n"
+ " Exec PROG directly instead of using a shell.\n"
+ " Disables argument globbing and variable "
+ "substitution\n"
+ " on UNIX-like systems.\n"
+ "\n"
+ "Debug options:\n"
+ "\n"
+ " --debug Enable general debugging output.\n"
+ " --debug-format=OPT1[,OPT2,...]\n"
+ " Specify extra content in debugging output.\n"
+ " Options:\n"
+ " all\n"
+ " none\n"
+ " timestamp\n"
+ " --remote-debug Enable remote protocol debugging output.\n"
+ " --event-loop-debug Enable event loop debugging output.\n"
+ " --disable-packet=OPT1[,OPT2,...]\n"
+ " Disable support for RSP packets or features.\n"
+ " Options:\n"
+ " vCont, T, Tthread, qC, qfThreadInfo and \n"
+ " threads (disable all threading packets).\n"
+ "\n"
+ "For more information, consult the GDB manual (available as on-line \n"
+ "info or a printed manual).\n");
if (REPORT_BUGS_TO[0] && stream == stdout)
fprintf (stream, "Report bugs to \"%s\".\n", REPORT_BUGS_TO);
}
@@ -3486,13 +3466,13 @@ static void
gdbserver_show_disableable (FILE *stream)
{
fprintf (stream, "Disableable packets:\n"
- " vCont \tAll vCont packets\n"
- " qC \tQuerying the current thread\n"
- " qfThreadInfo\tThread listing\n"
- " Tthread \tPassing the thread specifier in the "
- "T stop reply packet\n"
- " threads \tAll of the above\n"
- " T \tAll 'T' packets\n");
+ " vCont \tAll vCont packets\n"
+ " qC \tQuerying the current thread\n"
+ " qfThreadInfo\tThread listing\n"
+ " Tthread \tPassing the thread specifier in the "
+ "T stop reply packet\n"
+ " threads \tAll of the above\n"
+ " T \tAll 'T' packets\n");
}
/* Start up the event loop. This is the entry point to the event
@@ -3514,7 +3494,7 @@ start_event_loop ()
/* Was there an error? */
if (res == -1)
- break;
+ break;
}
/* We are done with the event loop. There are no more event sources
@@ -3544,8 +3524,8 @@ detach_or_kill_for_exit (void)
fprintf (stderr, "Killing process(es):");
for_each_process ([] (process_info *process) {
- if (!process->attached)
- fprintf (stderr, " %d", process->pid);
+ if (!process->attached)
+ fprintf (stderr, " %d", process->pid);
});
fprintf (stderr, "\n");
@@ -3555,8 +3535,8 @@ detach_or_kill_for_exit (void)
fprintf (stderr, "Detaching process(es):");
for_each_process ([] (process_info *process) {
- if (process->attached)
- fprintf (stderr, " %d", process->pid);
+ if (process->attached)
+ fprintf (stderr, " %d", process->pid);
});
fprintf (stderr, "\n");
@@ -3591,15 +3571,15 @@ detach_or_kill_for_exit_cleanup ()
catch (const gdb_exception &exception)
{
fflush (stdout);
- fprintf (stderr, "Detach or kill failed: %s\n",
- exception.what ());
+ fprintf (stderr, "Detach or kill failed: %s\n", exception.what ());
exit_code = 1;
}
}
#if GDB_SELF_TEST
-namespace selftests {
+namespace selftests
+{
static void
test_memory_tagging_functions (void)
@@ -3651,8 +3631,9 @@ test_memory_tagging_functions (void)
type = 255;
tags.resize (5);
strcpy (packet.data (), "QMemTags:0,0:0:");
- SELF_CHECK (parse_store_memtags_request (packet.data (),
- &addr, &len, tags, &type) == true);
+ SELF_CHECK (
+ parse_store_memtags_request (packet.data (), &addr, &len, tags, &type)
+ == true);
SELF_CHECK (addr == 0 && len == 0 && type == 0 && tags.size () == 0);
/* Valid request and non-empty tag data: addr, len, type
@@ -3661,12 +3642,12 @@ test_memory_tagging_functions (void)
len = 0;
type = 0;
tags.resize (0);
- strcpy (packet.data (),
- "QMemTags:deadbeef,ff:5:0001020304");
- SELF_CHECK (parse_store_memtags_request (packet.data (), &addr, &len, tags,
- &type) == true);
+ strcpy (packet.data (), "QMemTags:deadbeef,ff:5:0001020304");
+ SELF_CHECK (
+ parse_store_memtags_request (packet.data (), &addr, &len, tags, &type)
+ == true);
SELF_CHECK (addr == 0xdeadbeef && len == 255 && type == 5
- && tags.size () == 5);
+ && tags.size () == 5);
}
} // namespace selftests
@@ -3691,7 +3672,7 @@ captured_main (int argc, char *argv[])
std::vector<const char *> selftest_filters;
selftests::register_test ("remote_memory_tagging",
- selftests::test_memory_tagging_functions);
+ selftests::test_memory_tagging_functions);
#endif
current_directory = getcwd (NULL, 0);
@@ -3699,154 +3680,154 @@ captured_main (int argc, char *argv[])
if (current_directory == NULL)
{
- error (_("Could not find current working directory: %s"),
- safe_strerror (errno));
+ error (_ ("Could not find current working directory: %s"),
+ safe_strerror (errno));
}
while (*next_arg != NULL && **next_arg == '-')
{
if (strcmp (*next_arg, "--version") == 0)
- {
- gdbserver_version ();
- exit (0);
- }
+ {
+ gdbserver_version ();
+ exit (0);
+ }
else if (strcmp (*next_arg, "--help") == 0)
- {
- gdbserver_usage (stdout);
- exit (0);
- }
+ {
+ gdbserver_usage (stdout);
+ exit (0);
+ }
else if (strcmp (*next_arg, "--attach") == 0)
- attach = 1;
+ attach = 1;
else if (strcmp (*next_arg, "--multi") == 0)
- multi_mode = 1;
+ multi_mode = 1;
else if (strcmp (*next_arg, "--wrapper") == 0)
- {
- char **tmp;
-
- next_arg++;
-
- tmp = next_arg;
- while (*next_arg != NULL && strcmp (*next_arg, "--") != 0)
- {
- wrapper_argv += *next_arg;
- wrapper_argv += ' ';
- next_arg++;
- }
-
- if (!wrapper_argv.empty ())
- {
- /* Erase the last whitespace. */
- wrapper_argv.erase (wrapper_argv.end () - 1);
- }
-
- if (next_arg == tmp || *next_arg == NULL)
- {
- gdbserver_usage (stderr);
- exit (1);
- }
-
- /* Consume the "--". */
- *next_arg = NULL;
- }
+ {
+ char **tmp;
+
+ next_arg++;
+
+ tmp = next_arg;
+ while (*next_arg != NULL && strcmp (*next_arg, "--") != 0)
+ {
+ wrapper_argv += *next_arg;
+ wrapper_argv += ' ';
+ next_arg++;
+ }
+
+ if (!wrapper_argv.empty ())
+ {
+ /* Erase the last whitespace. */
+ wrapper_argv.erase (wrapper_argv.end () - 1);
+ }
+
+ if (next_arg == tmp || *next_arg == NULL)
+ {
+ gdbserver_usage (stderr);
+ exit (1);
+ }
+
+ /* Consume the "--". */
+ *next_arg = NULL;
+ }
else if (strcmp (*next_arg, "--debug") == 0)
- debug_threads = true;
+ debug_threads = true;
else if (startswith (*next_arg, "--debug-format="))
- {
- std::string error_msg
- = parse_debug_format_options ((*next_arg)
- + sizeof ("--debug-format=") - 1, 0);
-
- if (!error_msg.empty ())
- {
- fprintf (stderr, "%s", error_msg.c_str ());
- exit (1);
- }
- }
+ {
+ std::string error_msg
+ = parse_debug_format_options ((*next_arg)
+ + sizeof ("--debug-format=") - 1,
+ 0);
+
+ if (!error_msg.empty ())
+ {
+ fprintf (stderr, "%s", error_msg.c_str ());
+ exit (1);
+ }
+ }
else if (strcmp (*next_arg, "--remote-debug") == 0)
- remote_debug = true;
+ remote_debug = true;
else if (strcmp (*next_arg, "--event-loop-debug") == 0)
- debug_event_loop = debug_event_loop_kind::ALL;
+ debug_event_loop = debug_event_loop_kind::ALL;
else if (startswith (*next_arg, "--debug-file="))
- debug_set_output ((*next_arg) + sizeof ("--debug-file=") -1);
+ debug_set_output ((*next_arg) + sizeof ("--debug-file=") - 1);
else if (strcmp (*next_arg, "--disable-packet") == 0)
- {
- gdbserver_show_disableable (stdout);
- exit (0);
- }
+ {
+ gdbserver_show_disableable (stdout);
+ exit (0);
+ }
else if (startswith (*next_arg, "--disable-packet="))
- {
- char *packets = *next_arg += sizeof ("--disable-packet=") - 1;
- char *saveptr;
- for (char *tok = strtok_r (packets, ",", &saveptr);
- tok != NULL;
- tok = strtok_r (NULL, ",", &saveptr))
- {
- if (strcmp ("vCont", tok) == 0)
- disable_packet_vCont = true;
- else if (strcmp ("Tthread", tok) == 0)
- disable_packet_Tthread = true;
- else if (strcmp ("qC", tok) == 0)
- disable_packet_qC = true;
- else if (strcmp ("qfThreadInfo", tok) == 0)
- disable_packet_qfThreadInfo = true;
- else if (strcmp ("T", tok) == 0)
- disable_packet_T = true;
- else if (strcmp ("threads", tok) == 0)
- {
- disable_packet_vCont = true;
- disable_packet_Tthread = true;
- disable_packet_qC = true;
- disable_packet_qfThreadInfo = true;
- }
- else
- {
- fprintf (stderr, "Don't know how to disable \"%s\".\n\n",
- tok);
- gdbserver_show_disableable (stderr);
- exit (1);
- }
- }
- }
+ {
+ char *packets = *next_arg += sizeof ("--disable-packet=") - 1;
+ char *saveptr;
+ for (char *tok = strtok_r (packets, ",", &saveptr); tok != NULL;
+ tok = strtok_r (NULL, ",", &saveptr))
+ {
+ if (strcmp ("vCont", tok) == 0)
+ disable_packet_vCont = true;
+ else if (strcmp ("Tthread", tok) == 0)
+ disable_packet_Tthread = true;
+ else if (strcmp ("qC", tok) == 0)
+ disable_packet_qC = true;
+ else if (strcmp ("qfThreadInfo", tok) == 0)
+ disable_packet_qfThreadInfo = true;
+ else if (strcmp ("T", tok) == 0)
+ disable_packet_T = true;
+ else if (strcmp ("threads", tok) == 0)
+ {
+ disable_packet_vCont = true;
+ disable_packet_Tthread = true;
+ disable_packet_qC = true;
+ disable_packet_qfThreadInfo = true;
+ }
+ else
+ {
+ fprintf (stderr, "Don't know how to disable \"%s\".\n\n",
+ tok);
+ gdbserver_show_disableable (stderr);
+ exit (1);
+ }
+ }
+ }
else if (strcmp (*next_arg, "-") == 0)
- {
- /* "-" specifies a stdio connection and is a form of port
+ {
+ /* "-" specifies a stdio connection and is a form of port
specification. */
- port = STDIO_CONNECTION_NAME;
- next_arg++;
- break;
- }
+ port = STDIO_CONNECTION_NAME;
+ next_arg++;
+ break;
+ }
else if (strcmp (*next_arg, "--disable-randomization") == 0)
- cs.disable_randomization = 1;
+ cs.disable_randomization = 1;
else if (strcmp (*next_arg, "--no-disable-randomization") == 0)
- cs.disable_randomization = 0;
+ cs.disable_randomization = 0;
else if (strcmp (*next_arg, "--startup-with-shell") == 0)
- startup_with_shell = true;
+ startup_with_shell = true;
else if (strcmp (*next_arg, "--no-startup-with-shell") == 0)
- startup_with_shell = false;
+ startup_with_shell = false;
else if (strcmp (*next_arg, "--once") == 0)
- run_once = true;
+ run_once = true;
else if (strcmp (*next_arg, "--selftest") == 0)
- selftest = true;
+ selftest = true;
else if (startswith (*next_arg, "--selftest="))
- {
- selftest = true;
+ {
+ selftest = true;
#if GDB_SELF_TEST
- const char *filter = *next_arg + strlen ("--selftest=");
- if (*filter == '\0')
- {
- fprintf (stderr, _("Error: selftest filter is empty.\n"));
- exit (1);
- }
-
- selftest_filters.push_back (filter);
+ const char *filter = *next_arg + strlen ("--selftest=");
+ if (*filter == '\0')
+ {
+ fprintf (stderr, _ ("Error: selftest filter is empty.\n"));
+ exit (1);
+ }
+
+ selftest_filters.push_back (filter);
#endif
- }
+ }
else
- {
- fprintf (stderr, "Unknown argument: %s\n", *next_arg);
- exit (1);
- }
+ {
+ fprintf (stderr, "Unknown argument: %s\n", *next_arg);
+ exit (1);
+ }
next_arg++;
continue;
@@ -3858,7 +3839,7 @@ captured_main (int argc, char *argv[])
next_arg++;
}
if ((port == NULL || (!attach && !multi_mode && *next_arg == NULL))
- && !selftest)
+ && !selftest)
{
gdbserver_usage (stderr);
exit (1);
@@ -3889,11 +3870,9 @@ captured_main (int argc, char *argv[])
}
if (attach
- && (*next_arg == NULL
- || (*next_arg)[0] == '\0'
- || (pid = strtoul (*next_arg, &arg_end, 0)) == 0
- || *arg_end != '\0'
- || next_arg[1] != NULL))
+ && (*next_arg == NULL || (*next_arg)[0] == '\0'
+ || (pid = strtoul (*next_arg, &arg_end, 0)) == 0 || *arg_end != '\0'
+ || next_arg[1] != NULL))
bad_attach = 1;
if (bad_attach)
@@ -3918,7 +3897,7 @@ captured_main (int argc, char *argv[])
#if GDB_SELF_TEST
selftests::run_tests (selftest_filters);
#else
- printf (_("Selftests have been disabled for this build.\n"));
+ printf (_ ("Selftests have been disabled for this build.\n"));
#endif
throw_quit ("Quit");
}
@@ -3930,7 +3909,7 @@ captured_main (int argc, char *argv[])
n = argc - (next_arg - argv);
program_path.set (next_arg[0]);
for (i = 1; i < n; i++)
- program_args.push_back (xstrdup (next_arg[i]));
+ program_args.push_back (xstrdup (next_arg[i]));
/* Wait till we are at first instruction in program. */
target_create_inferior (program_path.get (), program_args);
@@ -3942,7 +3921,7 @@ captured_main (int argc, char *argv[])
else if (pid != 0)
{
if (attach_inferior (pid) == -1)
- error ("Attaching not supported on this target");
+ error ("Attaching not supported on this target");
/* Otherwise succeeded. */
}
@@ -3952,7 +3931,10 @@ captured_main (int argc, char *argv[])
cs.last_ptid = minus_one_ptid;
}
- SCOPE_EXIT { detach_or_kill_for_exit_cleanup (); };
+ SCOPE_EXIT
+ {
+ detach_or_kill_for_exit_cleanup ();
+ };
/* Don't report shared library events on the initial connection,
even if some libraries are preloaded. Avoids the "stopped by
@@ -3987,17 +3969,17 @@ captured_main (int argc, char *argv[])
remote_open (port);
try
- {
- /* Wait for events. This will return when all event sources
+ {
+ /* Wait for events. This will return when all event sources
are removed from the event loop. */
- start_event_loop ();
+ start_event_loop ();
- /* If an exit was requested (using the "monitor exit"
+ /* If an exit was requested (using the "monitor exit"
command), terminate now. */
- if (exit_requested)
- throw_quit ("Quit");
+ if (exit_requested)
+ throw_quit ("Quit");
- /* The only other way to get here is for getpkt to fail:
+ /* The only other way to get here is for getpkt to fail:
- If --once was specified, we're done.
@@ -4007,64 +3989,60 @@ captured_main (int argc, char *argv[])
- Otherwise, close the connection and reopen it at the
top of the loop. */
- if (run_once || (!extended_protocol && !target_running ()))
- throw_quit ("Quit");
+ if (run_once || (!extended_protocol && !target_running ()))
+ throw_quit ("Quit");
- fprintf (stderr,
- "Remote side has terminated connection. "
- "GDBserver will reopen the connection.\n");
+ fprintf (stderr, "Remote side has terminated connection. "
+ "GDBserver will reopen the connection.\n");
- /* Get rid of any pending statuses. An eventual reconnection
+ /* Get rid of any pending statuses. An eventual reconnection
(by the same GDB instance or another) will refresh all its
state from scratch. */
- discard_queued_stop_replies (minus_one_ptid);
- for_each_thread ([] (thread_info *thread)
- {
- thread->status_pending_p = 0;
- });
-
- if (tracing)
- {
- if (disconnected_tracing)
- {
- /* Try to enable non-stop/async mode, so we we can
+ discard_queued_stop_replies (minus_one_ptid);
+ for_each_thread (
+ [] (thread_info *thread) { thread->status_pending_p = 0; });
+
+ if (tracing)
+ {
+ if (disconnected_tracing)
+ {
+ /* Try to enable non-stop/async mode, so we we can
both wait for an async socket accept, and handle
async target events simultaneously. There's also
no point either in having the target always stop
all threads, when we're going to pass signals
down without informing GDB. */
- if (!non_stop)
- {
- if (the_target->start_non_stop (true))
- non_stop = 1;
+ if (!non_stop)
+ {
+ if (the_target->start_non_stop (true))
+ non_stop = 1;
- /* Detaching implicitly resumes all threads;
+ /* Detaching implicitly resumes all threads;
simply disconnecting does not. */
- }
- }
- else
- {
- fprintf (stderr,
- "Disconnected tracing disabled; "
- "stopping trace run.\n");
- stop_tracing ();
- }
- }
- }
+ }
+ }
+ else
+ {
+ fprintf (stderr, "Disconnected tracing disabled; "
+ "stopping trace run.\n");
+ stop_tracing ();
+ }
+ }
+ }
catch (const gdb_exception_error &exception)
- {
- fflush (stdout);
- fprintf (stderr, "gdbserver: %s\n", exception.what ());
+ {
+ fflush (stdout);
+ fprintf (stderr, "gdbserver: %s\n", exception.what ());
- if (response_needed)
- {
- write_enn (cs.own_buf);
- putpkt (cs.own_buf);
- }
+ if (response_needed)
+ {
+ write_enn (cs.own_buf);
+ putpkt (cs.own_buf);
+ }
- if (run_once)
- throw_quit ("Quit");
- }
+ if (run_once)
+ throw_quit ("Quit");
+ }
}
}
@@ -4073,7 +4051,6 @@ captured_main (int argc, char *argv[])
int
main (int argc, char *argv[])
{
-
try
{
captured_main (argc, argv);
@@ -4081,12 +4058,12 @@ main (int argc, char *argv[])
catch (const gdb_exception &exception)
{
if (exception.reason == RETURN_ERROR)
- {
- fflush (stdout);
- fprintf (stderr, "%s\n", exception.what ());
- fprintf (stderr, "Exiting\n");
- exit_code = 1;
- }
+ {
+ fflush (stdout);
+ fprintf (stderr, "%s\n", exception.what ());
+ fprintf (stderr, "Exiting\n");
+ exit_code = 1;
+ }
exit (exit_code);
}
@@ -4113,31 +4090,30 @@ process_point_options (struct gdb_breakpoint *bp, const char **packet)
while (*dataptr)
{
if (*dataptr == ';')
- ++dataptr;
+ ++dataptr;
if (*dataptr == 'X')
- {
- /* Conditional expression. */
- threads_debug_printf ("Found breakpoint condition.");
- if (!add_breakpoint_condition (bp, &dataptr))
- dataptr = strchrnul (dataptr, ';');
- }
+ {
+ /* Conditional expression. */
+ threads_debug_printf ("Found breakpoint condition.");
+ if (!add_breakpoint_condition (bp, &dataptr))
+ dataptr = strchrnul (dataptr, ';');
+ }
else if (startswith (dataptr, "cmds:"))
- {
- dataptr += strlen ("cmds:");
- threads_debug_printf ("Found breakpoint commands %s.", dataptr);
- persist = (*dataptr == '1');
- dataptr += 2;
- if (add_breakpoint_commands (bp, &dataptr, persist))
- dataptr = strchrnul (dataptr, ';');
- }
+ {
+ dataptr += strlen ("cmds:");
+ threads_debug_printf ("Found breakpoint commands %s.", dataptr);
+ persist = (*dataptr == '1');
+ dataptr += 2;
+ if (add_breakpoint_commands (bp, &dataptr, persist))
+ dataptr = strchrnul (dataptr, ';');
+ }
else
- {
- fprintf (stderr, "Unknown token %c, ignoring.\n",
- *dataptr);
- /* Skip tokens until we find one that we recognize. */
- dataptr = strchrnul (dataptr, ';');
- }
+ {
+ fprintf (stderr, "Unknown token %c, ignoring.\n", *dataptr);
+ /* Skip tokens until we find one that we recognize. */
+ dataptr = strchrnul (dataptr, ';');
+ }
}
*packet = dataptr;
}
@@ -4191,154 +4167,155 @@ process_serial_event (void)
break;
case 'H':
if (cs.own_buf[1] == 'c' || cs.own_buf[1] == 'g' || cs.own_buf[1] == 's')
- {
- require_running_or_break (cs.own_buf);
-
- ptid_t thread_id = read_ptid (&cs.own_buf[2], NULL);
-
- if (thread_id == null_ptid || thread_id == minus_one_ptid)
- thread_id = null_ptid;
- else if (thread_id.is_pid ())
- {
- /* The ptid represents a pid. */
- thread_info *thread = find_any_thread_of_pid (thread_id.pid ());
-
- if (thread == NULL)
- {
- write_enn (cs.own_buf);
- break;
- }
-
- thread_id = thread->id;
- }
- else
- {
- /* The ptid represents a lwp/tid. */
- if (find_thread_ptid (thread_id) == NULL)
- {
- write_enn (cs.own_buf);
- break;
- }
- }
-
- if (cs.own_buf[1] == 'g')
- {
- if (thread_id == null_ptid)
- {
- /* GDB is telling us to choose any thread. Check if
+ {
+ require_running_or_break (cs.own_buf);
+
+ ptid_t thread_id = read_ptid (&cs.own_buf[2], NULL);
+
+ if (thread_id == null_ptid || thread_id == minus_one_ptid)
+ thread_id = null_ptid;
+ else if (thread_id.is_pid ())
+ {
+ /* The ptid represents a pid. */
+ thread_info *thread = find_any_thread_of_pid (thread_id.pid ());
+
+ if (thread == NULL)
+ {
+ write_enn (cs.own_buf);
+ break;
+ }
+
+ thread_id = thread->id;
+ }
+ else
+ {
+ /* The ptid represents a lwp/tid. */
+ if (find_thread_ptid (thread_id) == NULL)
+ {
+ write_enn (cs.own_buf);
+ break;
+ }
+ }
+
+ if (cs.own_buf[1] == 'g')
+ {
+ if (thread_id == null_ptid)
+ {
+ /* GDB is telling us to choose any thread. Check if
the currently selected thread is still valid. If
it is not, select the first available. */
- thread_info *thread = find_thread_ptid (cs.general_thread);
- if (thread == NULL)
- thread = get_first_thread ();
- thread_id = thread->id;
- }
-
- cs.general_thread = thread_id;
- set_desired_thread ();
- gdb_assert (current_thread != NULL);
- }
- else if (cs.own_buf[1] == 'c')
- cs.cont_thread = thread_id;
-
- write_ok (cs.own_buf);
- }
+ thread_info *thread = find_thread_ptid (cs.general_thread);
+ if (thread == NULL)
+ thread = get_first_thread ();
+ thread_id = thread->id;
+ }
+
+ cs.general_thread = thread_id;
+ set_desired_thread ();
+ gdb_assert (current_thread != NULL);
+ }
+ else if (cs.own_buf[1] == 'c')
+ cs.cont_thread = thread_id;
+
+ write_ok (cs.own_buf);
+ }
else
- {
- /* Silently ignore it so that gdb can extend the protocol
+ {
+ /* Silently ignore it so that gdb can extend the protocol
without compatibility headaches. */
- cs.own_buf[0] = '\0';
- }
+ cs.own_buf[0] = '\0';
+ }
break;
case 'g':
require_running_or_break (cs.own_buf);
if (cs.current_traceframe >= 0)
- {
- struct regcache *regcache
- = new_register_cache (current_target_desc ());
-
- if (fetch_traceframe_registers (cs.current_traceframe,
- regcache, -1) == 0)
- registers_to_string (regcache, cs.own_buf);
- else
- write_enn (cs.own_buf);
- free_register_cache (regcache);
- }
+ {
+ struct regcache *regcache
+ = new_register_cache (current_target_desc ());
+
+ if (fetch_traceframe_registers (cs.current_traceframe, regcache, -1)
+ == 0)
+ registers_to_string (regcache, cs.own_buf);
+ else
+ write_enn (cs.own_buf);
+ free_register_cache (regcache);
+ }
else
- {
- struct regcache *regcache;
-
- if (!set_desired_thread ())
- write_enn (cs.own_buf);
- else
- {
- regcache = get_thread_regcache (current_thread, 1);
- registers_to_string (regcache, cs.own_buf);
- }
- }
+ {
+ struct regcache *regcache;
+
+ if (!set_desired_thread ())
+ write_enn (cs.own_buf);
+ else
+ {
+ regcache = get_thread_regcache (current_thread, 1);
+ registers_to_string (regcache, cs.own_buf);
+ }
+ }
break;
case 'G':
require_running_or_break (cs.own_buf);
if (cs.current_traceframe >= 0)
- write_enn (cs.own_buf);
+ write_enn (cs.own_buf);
else
- {
- struct regcache *regcache;
-
- if (!set_desired_thread ())
- write_enn (cs.own_buf);
- else
- {
- regcache = get_thread_regcache (current_thread, 1);
- registers_from_string (regcache, &cs.own_buf[1]);
- write_ok (cs.own_buf);
- }
- }
+ {
+ struct regcache *regcache;
+
+ if (!set_desired_thread ())
+ write_enn (cs.own_buf);
+ else
+ {
+ regcache = get_thread_regcache (current_thread, 1);
+ registers_from_string (regcache, &cs.own_buf[1]);
+ write_ok (cs.own_buf);
+ }
+ }
break;
case 'm':
{
- require_running_or_break (cs.own_buf);
- decode_m_packet (&cs.own_buf[1], &mem_addr, &len);
- int res = gdb_read_memory (mem_addr, mem_buf, len);
- if (res < 0)
- write_enn (cs.own_buf);
- else
- bin2hex (mem_buf, cs.own_buf, res);
+ require_running_or_break (cs.own_buf);
+ decode_m_packet (&cs.own_buf[1], &mem_addr, &len);
+ int res = gdb_read_memory (mem_addr, mem_buf, len);
+ if (res < 0)
+ write_enn (cs.own_buf);
+ else
+ bin2hex (mem_buf, cs.own_buf, res);
}
break;
case 'M':
require_running_or_break (cs.own_buf);
decode_M_packet (&cs.own_buf[1], &mem_addr, &len, &mem_buf);
if (gdb_write_memory (mem_addr, mem_buf, len) == 0)
- write_ok (cs.own_buf);
+ write_ok (cs.own_buf);
else
- write_enn (cs.own_buf);
+ write_enn (cs.own_buf);
break;
case 'X':
require_running_or_break (cs.own_buf);
- if (decode_X_packet (&cs.own_buf[1], packet_len - 1,
- &mem_addr, &len, &mem_buf) < 0
- || gdb_write_memory (mem_addr, mem_buf, len) != 0)
- write_enn (cs.own_buf);
+ if (decode_X_packet (&cs.own_buf[1], packet_len - 1, &mem_addr, &len,
+ &mem_buf)
+ < 0
+ || gdb_write_memory (mem_addr, mem_buf, len) != 0)
+ write_enn (cs.own_buf);
else
- write_ok (cs.own_buf);
+ write_ok (cs.own_buf);
break;
case 'C':
require_running_or_break (cs.own_buf);
hex2bin (cs.own_buf + 1, &sig, 1);
if (gdb_signal_to_host_p ((enum gdb_signal) sig))
- signal = gdb_signal_to_host ((enum gdb_signal) sig);
+ signal = gdb_signal_to_host ((enum gdb_signal) sig);
else
- signal = 0;
+ signal = 0;
myresume (cs.own_buf, 0, signal);
break;
case 'S':
require_running_or_break (cs.own_buf);
hex2bin (cs.own_buf + 1, &sig, 1);
if (gdb_signal_to_host_p ((enum gdb_signal) sig))
- signal = gdb_signal_to_host ((enum gdb_signal) sig);
+ signal = gdb_signal_to_host ((enum gdb_signal) sig);
else
- signal = 0;
+ signal = 0;
myresume (cs.own_buf, 1, signal);
break;
case 'c':
@@ -4351,58 +4328,58 @@ process_serial_event (void)
signal = 0;
myresume (cs.own_buf, 1, signal);
break;
- case 'Z': /* insert_ ... */
+ case 'Z': /* insert_ ... */
/* Fallthrough. */
- case 'z': /* remove_ ... */
+ case 'z': /* remove_ ... */
{
- char *dataptr;
- ULONGEST addr;
- int kind;
- char type = cs.own_buf[1];
- int res;
- const int insert = ch == 'Z';
- const char *p = &cs.own_buf[3];
-
- p = unpack_varlen_hex (p, &addr);
- kind = strtol (p + 1, &dataptr, 16);
-
- if (insert)
- {
- struct gdb_breakpoint *bp;
-
- bp = set_gdb_breakpoint (type, addr, kind, &res);
- if (bp != NULL)
- {
- res = 0;
-
- /* GDB may have sent us a list of *point parameters to
+ char *dataptr;
+ ULONGEST addr;
+ int kind;
+ char type = cs.own_buf[1];
+ int res;
+ const int insert = ch == 'Z';
+ const char *p = &cs.own_buf[3];
+
+ p = unpack_varlen_hex (p, &addr);
+ kind = strtol (p + 1, &dataptr, 16);
+
+ if (insert)
+ {
+ struct gdb_breakpoint *bp;
+
+ bp = set_gdb_breakpoint (type, addr, kind, &res);
+ if (bp != NULL)
+ {
+ res = 0;
+
+ /* GDB may have sent us a list of *point parameters to
be evaluated on the target's side. Read such list
here. If we already have a list of parameters, GDB
is telling us to drop that list and use this one
instead. */
- clear_breakpoint_conditions_and_commands (bp);
- const char *options = dataptr;
- process_point_options (bp, &options);
- }
- }
- else
- res = delete_gdb_breakpoint (type, addr, kind);
-
- if (res == 0)
- write_ok (cs.own_buf);
- else if (res == 1)
- /* Unsupported. */
- cs.own_buf[0] = '\0';
- else
- write_enn (cs.own_buf);
- break;
+ clear_breakpoint_conditions_and_commands (bp);
+ const char *options = dataptr;
+ process_point_options (bp, &options);
+ }
+ }
+ else
+ res = delete_gdb_breakpoint (type, addr, kind);
+
+ if (res == 0)
+ write_ok (cs.own_buf);
+ else if (res == 1)
+ /* Unsupported. */
+ cs.own_buf[0] = '\0';
+ else
+ write_enn (cs.own_buf);
+ break;
}
case 'k':
response_needed = false;
if (!target_running ())
- /* The packet we received doesn't make sense - but we can't
+ /* The packet we received doesn't make sense - but we can't
reply to it, either. */
- return 0;
+ return 0;
fprintf (stderr, "Killing all inferiors\n");
@@ -4411,28 +4388,28 @@ process_serial_event (void)
/* When using the extended protocol, we wait with no program
running. The traditional protocol will exit instead. */
if (extended_protocol)
- {
- cs.last_status.set_exited (GDB_SIGNAL_KILL);
- return 0;
- }
+ {
+ cs.last_status.set_exited (GDB_SIGNAL_KILL);
+ return 0;
+ }
else
- exit (0);
+ exit (0);
case 'T':
{
- require_running_or_break (cs.own_buf);
-
- ptid_t thread_id = read_ptid (&cs.own_buf[1], NULL);
- if (find_thread_ptid (thread_id) == NULL)
- {
- write_enn (cs.own_buf);
- break;
- }
-
- if (mythread_alive (thread_id))
- write_ok (cs.own_buf);
- else
- write_enn (cs.own_buf);
+ require_running_or_break (cs.own_buf);
+
+ ptid_t thread_id = read_ptid (&cs.own_buf[1], NULL);
+ if (find_thread_ptid (thread_id) == NULL)
+ {
+ write_enn (cs.own_buf);
+ break;
+ }
+
+ if (mythread_alive (thread_id))
+ write_ok (cs.own_buf);
+ else
+ write_enn (cs.own_buf);
}
break;
case 'R':
@@ -4441,43 +4418,43 @@ process_serial_event (void)
/* Restarting the inferior is only supported in the extended
protocol. */
if (extended_protocol)
- {
- if (target_running ())
- for_each_process (kill_inferior_callback);
+ {
+ if (target_running ())
+ for_each_process (kill_inferior_callback);
- fprintf (stderr, "GDBserver restarting\n");
+ fprintf (stderr, "GDBserver restarting\n");
- /* Wait till we are at 1st instruction in prog. */
- if (program_path.get () != NULL)
- {
- target_create_inferior (program_path.get (), program_args);
+ /* Wait till we are at 1st instruction in prog. */
+ if (program_path.get () != NULL)
+ {
+ target_create_inferior (program_path.get (), program_args);
- if (cs.last_status.kind () == TARGET_WAITKIND_STOPPED)
- {
- /* Stopped at the first instruction of the target
+ if (cs.last_status.kind () == TARGET_WAITKIND_STOPPED)
+ {
+ /* Stopped at the first instruction of the target
process. */
- cs.general_thread = cs.last_ptid;
- }
- else
- {
- /* Something went wrong. */
- cs.general_thread = null_ptid;
- }
- }
- else
- {
- cs.last_status.set_exited (GDB_SIGNAL_KILL);
- }
- return 0;
- }
+ cs.general_thread = cs.last_ptid;
+ }
+ else
+ {
+ /* Something went wrong. */
+ cs.general_thread = null_ptid;
+ }
+ }
+ else
+ {
+ cs.last_status.set_exited (GDB_SIGNAL_KILL);
+ }
+ return 0;
+ }
else
- {
- /* It is a request we don't understand. Respond with an
+ {
+ /* It is a request we don't understand. Respond with an
empty packet so that gdb knows that we don't support this
request. */
- cs.own_buf[0] = '\0';
- break;
- }
+ cs.own_buf[0] = '\0';
+ break;
+ }
case 'v':
/* Extended (long) request. */
handle_v_requests (cs.own_buf, packet_len, &new_packet_len);
@@ -4544,13 +4521,12 @@ handle_target_event (int err, gdb_client_data client_data)
client_state &cs = get_client_state ();
threads_debug_printf ("handling possible target event");
- cs.last_ptid = mywait (minus_one_ptid, &cs.last_status,
- TARGET_WNOHANG, 1);
+ cs.last_ptid = mywait (minus_one_ptid, &cs.last_status, TARGET_WNOHANG, 1);
if (cs.last_status.kind () == TARGET_WAITKIND_NO_RESUMED)
{
if (gdb_connected () && report_no_resumed)
- push_stop_notification (null_ptid, cs.last_status);
+ push_stop_notification (null_ptid, cs.last_status);
}
else if (cs.last_status.kind () != TARGET_WAITKIND_IGNORE)
{
@@ -4559,55 +4535,56 @@ handle_target_event (int err, gdb_client_data client_data)
int forward_event = !gdb_connected () || process->gdb_detached;
if (cs.last_status.kind () == TARGET_WAITKIND_EXITED
- || cs.last_status.kind () == TARGET_WAITKIND_SIGNALLED)
- {
- mark_breakpoints_out (process);
- target_mourn_inferior (cs.last_ptid);
- }
+ || cs.last_status.kind () == TARGET_WAITKIND_SIGNALLED)
+ {
+ mark_breakpoints_out (process);
+ target_mourn_inferior (cs.last_ptid);
+ }
else if (cs.last_status.kind () == TARGET_WAITKIND_THREAD_EXITED)
- ;
+ ;
else
- {
- /* We're reporting this thread as stopped. Update its
+ {
+ /* We're reporting this thread as stopped. Update its
"want-stopped" state to what the client wants, until it
gets a new resume action. */
- current_thread->last_resume_kind = resume_stop;
- current_thread->last_status = cs.last_status;
- }
+ current_thread->last_resume_kind = resume_stop;
+ current_thread->last_status = cs.last_status;
+ }
if (forward_event)
- {
- if (!target_running ())
- {
- /* The last process exited. We're done. */
- exit (0);
- }
-
- if (cs.last_status.kind () == TARGET_WAITKIND_EXITED
- || cs.last_status.kind () == TARGET_WAITKIND_SIGNALLED
- || cs.last_status.kind () == TARGET_WAITKIND_THREAD_EXITED)
- ;
- else
- {
- /* A thread stopped with a signal, but gdb isn't
+ {
+ if (!target_running ())
+ {
+ /* The last process exited. We're done. */
+ exit (0);
+ }
+
+ if (cs.last_status.kind () == TARGET_WAITKIND_EXITED
+ || cs.last_status.kind () == TARGET_WAITKIND_SIGNALLED
+ || cs.last_status.kind () == TARGET_WAITKIND_THREAD_EXITED)
+ ;
+ else
+ {
+ /* A thread stopped with a signal, but gdb isn't
connected to handle it. Pass it down to the
inferior, as if it wasn't being traced. */
- enum gdb_signal signal;
-
- threads_debug_printf ("GDB not connected; forwarding event %d for"
- " [%s]",
- (int) cs.last_status.kind (),
- target_pid_to_str (cs.last_ptid).c_str ());
-
- if (cs.last_status.kind () == TARGET_WAITKIND_STOPPED)
- signal = cs.last_status.sig ();
- else
- signal = GDB_SIGNAL_0;
- target_continue (cs.last_ptid, signal);
- }
- }
+ enum gdb_signal signal;
+
+ threads_debug_printf (
+ "GDB not connected; forwarding event %d for"
+ " [%s]",
+ (int) cs.last_status.kind (),
+ target_pid_to_str (cs.last_ptid).c_str ());
+
+ if (cs.last_status.kind () == TARGET_WAITKIND_STOPPED)
+ signal = cs.last_status.sig ();
+ else
+ signal = GDB_SIGNAL_0;
+ target_continue (cs.last_ptid, signal);
+ }
+ }
else
- push_stop_notification (cs.last_ptid, cs.last_status);
+ push_stop_notification (cs.last_ptid, cs.last_status);
}
/* Be sure to not change the selected thread behind GDB's back.
@@ -4643,8 +4620,8 @@ flush_streams ()
/* See gdbsupport/gdb_select.h. */
int
-gdb_select (int n, fd_set *readfds, fd_set *writefds,
- fd_set *exceptfds, struct timeval *timeout)
+gdb_select (int n, fd_set *readfds, fd_set *writefds, fd_set *exceptfds,
+ struct timeval *timeout)
{
return select (n, readfds, writefds, exceptfds, timeout);
}
@@ -4655,7 +4632,8 @@ namespace selftests
void
reset ()
-{}
+{
+}
} // namespace selftests
#endif /* GDB_SELF_TEST */
diff --git a/gdbserver/server.h b/gdbserver/server.h
index 7997d1a32e6..6209bbe1b25 100644
--- a/gdbserver/server.h
+++ b/gdbserver/server.h
@@ -40,16 +40,16 @@ extern void perror (const char *);
#endif
#if !HAVE_DECL_VASPRINTF
-extern int vasprintf(char **strp, const char *fmt, va_list ap);
+extern int vasprintf (char **strp, const char *fmt, va_list ap);
#endif
#if !HAVE_DECL_VSNPRINTF
-int vsnprintf(char *str, size_t size, const char *format, va_list ap);
+int vsnprintf (char *str, size_t size, const char *format, va_list ap);
#endif
#ifdef IN_PROCESS_AGENT
-# define PROG "ipa"
+#define PROG "ipa"
#else
-# define PROG "gdbserver"
+#define PROG "gdbserver"
#endif
#include "gdbsupport/buffer.h"
@@ -81,7 +81,7 @@ extern bool non_stop;
/* Functions from server.c. */
extern void handle_v_requests (char *own_buf, int packet_len,
- int *new_packet_len);
+ int *new_packet_len);
extern void handle_serial_event (int err, gdb_client_data client_data);
extern void handle_target_event (int err, gdb_client_data client_data);
@@ -100,7 +100,7 @@ extern int in_queued_stop_replies (ptid_t ptid);
/* Maximum number of bytes to read/write at once. The value here
is chosen to fill up a packet (the headers account for the 32). */
-#define MAXBUFBYTES(N) (((N)-32)/2)
+#define MAXBUFBYTES(N) (((N) -32) / 2)
/* Buffer sizes for transferring memory, registers, etc. Set to a constant
value to accomodate multiple register formats. This value must be at least
@@ -124,15 +124,12 @@ extern gdb_environ *get_environ ();
extern unsigned long signal_pid;
-
/* Description of the client remote protocol state for the currently
connected client. */
struct client_state
{
- client_state ():
- own_buf ((char *) xmalloc (PBUFSIZ + 1))
- {}
+ client_state () : own_buf ((char *) xmalloc (PBUFSIZ + 1)) {}
/* The thread set with an `Hc' packet. `Hc' is deprecated in favor of
`vCont'. Note the multi-process extensions made `vCont' a
@@ -192,7 +189,6 @@ struct client_state
/* If true, memory tagging features are supported. */
bool memory_tagging_feature = false;
-
};
client_state &get_client_state ();
diff --git a/gdbserver/symbol.cc b/gdbserver/symbol.cc
index 2f57fbb89ae..cd65e0724ec 100644
--- a/gdbserver/symbol.cc
+++ b/gdbserver/symbol.cc
@@ -24,7 +24,7 @@
int
find_minimal_symbol_address (const char *name, CORE_ADDR *addr,
- struct objfile *objfile)
+ struct objfile *objfile)
{
gdb_assert (objfile == NULL);
diff --git a/gdbserver/target.cc b/gdbserver/target.cc
index 2658a359897..d900c82aa18 100644
--- a/gdbserver/target.cc
+++ b/gdbserver/target.cc
@@ -41,17 +41,17 @@ set_desired_thread ()
{
process_info *proc = find_process_pid (cs.general_thread.pid ());
if (proc == nullptr)
- {
- threads_debug_printf
- ("did not find thread nor process for general_thread %s",
- cs.general_thread.to_string ().c_str ());
- }
+ {
+ threads_debug_printf (
+ "did not find thread nor process for general_thread %s",
+ cs.general_thread.to_string ().c_str ());
+ }
else
- {
- threads_debug_printf
- ("did not find thread for general_thread %s, but found process",
- cs.general_thread.to_string ().c_str ());
- }
+ {
+ threads_debug_printf (
+ "did not find thread for general_thread %s, but found process",
+ cs.general_thread.to_string ().c_str ());
+ }
switch_to_process (proc);
}
else
@@ -70,9 +70,8 @@ set_desired_process ()
process_info *proc = find_process_pid (cs.general_thread.pid ());
if (proc == nullptr)
{
- threads_debug_printf
- ("did not find process for general_thread %s",
- cs.general_thread.to_string ().c_str ());
+ threads_debug_printf ("did not find process for general_thread %s",
+ cs.general_thread.to_string ().c_str ());
}
switch_to_process (proc);
@@ -116,7 +115,7 @@ target_read_uint32 (CORE_ADDR memaddr, uint32_t *result)
int
target_write_memory (CORE_ADDR memaddr, const unsigned char *myaddr,
- ssize_t len)
+ ssize_t len)
{
/* GDB may send X packets with LEN==0, for probing packet support.
If we let such a request go through, then buffer.data() below may
@@ -134,7 +133,7 @@ target_write_memory (CORE_ADDR memaddr, const unsigned char *myaddr,
ptid_t
mywait (ptid_t ptid, struct target_waitstatus *ourstatus,
- target_wait_flags options, int connected_wait)
+ target_wait_flags options, int connected_wait)
{
ptid_t ret;
@@ -157,12 +156,12 @@ mywait (ptid_t ptid, struct target_waitstatus *ourstatus,
if (!remote_connection_is_stdio ())
{
if (ourstatus->kind () == TARGET_WAITKIND_EXITED)
- fprintf (stderr,
- "\nChild exited with status %d\n", ourstatus->exit_status ());
+ fprintf (stderr, "\nChild exited with status %d\n",
+ ourstatus->exit_status ());
else if (ourstatus->kind () == TARGET_WAITKIND_SIGNALLED)
- fprintf (stderr, "\nChild terminated with signal = 0x%x (%s)\n",
- gdb_signal_to_host (ourstatus->sig ()),
- gdb_signal_to_name (ourstatus->sig ()));
+ fprintf (stderr, "\nChild terminated with signal = 0x%x (%s)\n",
+ gdb_signal_to_host (ourstatus->sig ()),
+ gdb_signal_to_name (ourstatus->sig ()));
}
if (connected_wait)
@@ -194,7 +193,7 @@ target_stop_and_wait (ptid_t ptid)
ptid_t
target_wait (ptid_t ptid, struct target_waitstatus *status,
- target_wait_flags options)
+ target_wait_flags options)
{
return the_target->wait (ptid, status, options);
}
@@ -253,19 +252,16 @@ std::string
target_pid_to_str (ptid_t ptid)
{
if (ptid == minus_one_ptid)
- return string_printf("<all threads>");
+ return string_printf ("<all threads>");
else if (ptid == null_ptid)
- return string_printf("<null thread>");
+ return string_printf ("<null thread>");
else if (ptid.tid () != 0)
- return string_printf("Thread %d.0x%s",
- ptid.pid (),
- phex_nz (ptid.tid (), sizeof (ULONGEST)));
+ return string_printf ("Thread %d.0x%s", ptid.pid (),
+ phex_nz (ptid.tid (), sizeof (ULONGEST)));
else if (ptid.lwp () != 0)
- return string_printf("LWP %d.%ld",
- ptid.pid (), ptid.lwp ());
+ return string_printf ("LWP %d.%ld", ptid.pid (), ptid.lwp ());
else
- return string_printf("Process %d",
- ptid.pid ());
+ return string_printf ("Process %d", ptid.pid ());
}
int
@@ -347,7 +343,7 @@ process_stratum_target::supports_read_auxv ()
int
process_stratum_target::read_auxv (int pid, CORE_ADDR offset,
- unsigned char *myaddr, unsigned int len)
+ unsigned char *myaddr, unsigned int len)
{
gdb_assert_not_reached ("target op read_auxv not supported");
}
@@ -359,17 +355,15 @@ process_stratum_target::supports_z_point_type (char z_type)
}
int
-process_stratum_target::insert_point (enum raw_bkpt_type type,
- CORE_ADDR addr,
- int size, raw_breakpoint *bp)
+process_stratum_target::insert_point (enum raw_bkpt_type type, CORE_ADDR addr,
+ int size, raw_breakpoint *bp)
{
return 1;
}
int
-process_stratum_target::remove_point (enum raw_bkpt_type type,
- CORE_ADDR addr,
- int size, raw_breakpoint *bp)
+process_stratum_target::remove_point (enum raw_bkpt_type type, CORE_ADDR addr,
+ int size, raw_breakpoint *bp)
{
return 1;
}
@@ -430,14 +424,14 @@ process_stratum_target::supports_memory_tagging ()
bool
process_stratum_target::fetch_memtags (CORE_ADDR address, size_t len,
- gdb::byte_vector &tags, int type)
+ gdb::byte_vector &tags, int type)
{
gdb_assert_not_reached ("target op fetch_memtags not supported");
}
bool
process_stratum_target::store_memtags (CORE_ADDR address, size_t len,
- const gdb::byte_vector &tags, int type)
+ const gdb::byte_vector &tags, int type)
{
gdb_assert_not_reached ("target op store_memtags not supported");
}
@@ -455,10 +449,9 @@ process_stratum_target::supports_get_tls_address ()
}
int
-process_stratum_target::get_tls_address (thread_info *thread,
- CORE_ADDR offset,
- CORE_ADDR load_module,
- CORE_ADDR *address)
+process_stratum_target::get_tls_address (thread_info *thread, CORE_ADDR offset,
+ CORE_ADDR load_module,
+ CORE_ADDR *address)
{
gdb_assert_not_reached ("target op get_tls_address not supported");
}
@@ -471,9 +464,9 @@ process_stratum_target::supports_qxfer_osdata ()
int
process_stratum_target::qxfer_osdata (const char *annex,
- unsigned char *readbuf,
- unsigned const char *writebuf,
- CORE_ADDR offset, int len)
+ unsigned char *readbuf,
+ unsigned const char *writebuf,
+ CORE_ADDR offset, int len)
{
gdb_assert_not_reached ("target op qxfer_osdata not supported");
}
@@ -486,9 +479,9 @@ process_stratum_target::supports_qxfer_siginfo ()
int
process_stratum_target::qxfer_siginfo (const char *annex,
- unsigned char *readbuf,
- unsigned const char *writebuf,
- CORE_ADDR offset, int len)
+ unsigned char *readbuf,
+ unsigned const char *writebuf,
+ CORE_ADDR offset, int len)
{
gdb_assert_not_reached ("target op qxfer_siginfo not supported");
}
@@ -563,17 +556,15 @@ process_stratum_target::supports_read_loadmap ()
}
int
-process_stratum_target::read_loadmap (const char *annex,
- CORE_ADDR offset,
- unsigned char *myaddr,
- unsigned int len)
+process_stratum_target::read_loadmap (const char *annex, CORE_ADDR offset,
+ unsigned char *myaddr, unsigned int len)
{
gdb_assert_not_reached ("target op read_loadmap not supported");
}
void
-process_stratum_target::process_qsupported
- (gdb::array_view<const char * const> features)
+process_stratum_target::process_qsupported (
+ gdb::array_view<const char *const> features)
{
/* Nop. */
}
@@ -645,16 +636,15 @@ process_stratum_target::supports_fast_tracepoints ()
}
int
-process_stratum_target::install_fast_tracepoint_jump_pad
- (CORE_ADDR tpoint, CORE_ADDR tpaddr, CORE_ADDR collector,
- CORE_ADDR lockaddr, ULONGEST orig_size, CORE_ADDR *jump_entry,
- CORE_ADDR *trampoline, ULONGEST *trampoline_size,
- unsigned char *jjump_pad_insn, ULONGEST *jjump_pad_insn_size,
- CORE_ADDR *adjusted_insn_addr, CORE_ADDR *adjusted_insn_addr_end,
- char *err)
+process_stratum_target::install_fast_tracepoint_jump_pad (
+ CORE_ADDR tpoint, CORE_ADDR tpaddr, CORE_ADDR collector, CORE_ADDR lockaddr,
+ ULONGEST orig_size, CORE_ADDR *jump_entry, CORE_ADDR *trampoline,
+ ULONGEST *trampoline_size, unsigned char *jjump_pad_insn,
+ ULONGEST *jjump_pad_insn_size, CORE_ADDR *adjusted_insn_addr,
+ CORE_ADDR *adjusted_insn_addr_end, char *err)
{
gdb_assert_not_reached ("target op install_fast_tracepoint_jump_pad "
- "not supported");
+ "not supported");
}
int
@@ -683,9 +673,9 @@ process_stratum_target::supports_qxfer_libraries_svr4 ()
int
process_stratum_target::qxfer_libraries_svr4 (const char *annex,
- unsigned char *readbuf,
- unsigned const char *writebuf,
- CORE_ADDR offset, int len)
+ unsigned char *readbuf,
+ unsigned const char *writebuf,
+ CORE_ADDR offset, int len)
{
gdb_assert_not_reached ("target op qxfer_libraries_svr4 not supported");
}
@@ -704,30 +694,29 @@ process_stratum_target::supports_btrace ()
btrace_target_info *
process_stratum_target::enable_btrace (thread_info *tp,
- const btrace_config *conf)
+ const btrace_config *conf)
{
- error (_("Target does not support branch tracing."));
+ error (_ ("Target does not support branch tracing."));
}
int
process_stratum_target::disable_btrace (btrace_target_info *tinfo)
{
- error (_("Target does not support branch tracing."));
+ error (_ ("Target does not support branch tracing."));
}
int
-process_stratum_target::read_btrace (btrace_target_info *tinfo,
- buffer *buffer,
- enum btrace_read_type type)
+process_stratum_target::read_btrace (btrace_target_info *tinfo, buffer *buffer,
+ enum btrace_read_type type)
{
- error (_("Target does not support branch tracing."));
+ error (_ ("Target does not support branch tracing."));
}
int
process_stratum_target::read_btrace_conf (const btrace_target_info *tinfo,
- buffer *buffer)
+ buffer *buffer)
{
- error (_("Target does not support branch tracing."));
+ error (_ ("Target does not support branch tracing."));
}
bool
@@ -755,8 +744,8 @@ process_stratum_target::supports_multifs ()
}
int
-process_stratum_target::multifs_open (int pid, const char *filename,
- int flags, mode_t mode)
+process_stratum_target::multifs_open (int pid, const char *filename, int flags,
+ mode_t mode)
{
return open (filename, flags, mode);
}
@@ -769,7 +758,7 @@ process_stratum_target::multifs_unlink (int pid, const char *filename)
ssize_t
process_stratum_target::multifs_readlink (int pid, const char *filename,
- char *buf, size_t bufsiz)
+ char *buf, size_t bufsiz)
{
return readlink (filename, buf, bufsiz);
}
@@ -798,7 +787,7 @@ process_stratum_target::thread_name (ptid_t thread)
bool
process_stratum_target::thread_handle (ptid_t ptid, gdb_byte **handle,
- int *handle_len)
+ int *handle_len)
{
return false;
}
diff --git a/gdbserver/target.h b/gdbserver/target.h
index 01002c2d6aa..a3ce34860b5 100644
--- a/gdbserver/target.h
+++ b/gdbserver/target.h
@@ -61,8 +61,8 @@ struct thread_resume
thread stops in this range. (If the range is empty
[STEP_RANGE_START == STEP_RANGE_END], then this is a single-step
request.) */
- CORE_ADDR step_range_start; /* Inclusive */
- CORE_ADDR step_range_end; /* Exclusive */
+ CORE_ADDR step_range_start; /* Inclusive */
+ CORE_ADDR step_range_end; /* Exclusive */
};
/* GDBserver doesn't have a concept of strata like GDB, but we call
@@ -72,7 +72,6 @@ struct thread_resume
class process_stratum_target
{
public:
-
virtual ~process_stratum_target () = default;
/* Start a new process.
@@ -84,7 +83,8 @@ public:
Returns the new PID on success, -1 on failure. Registers the new
process with the process list. */
virtual int create_inferior (const char *program,
- const std::vector<char *> &program_args) = 0;
+ const std::vector<char *> &program_args)
+ = 0;
/* Do additional setup after a new process is created, including
exec-wrapper completion. */
@@ -129,7 +129,8 @@ public:
no child stop to report, return is
null_ptid/TARGET_WAITKIND_IGNORE. */
virtual ptid_t wait (ptid_t ptid, target_waitstatus *status,
- target_wait_flags options) = 0;
+ target_wait_flags options)
+ = 0;
/* Fetch registers from the inferior process.
@@ -147,8 +148,8 @@ public:
Read LEN bytes at MEMADDR into a buffer at MYADDR.
Returns 0 on success and errno on failure. */
- virtual int read_memory (CORE_ADDR memaddr, unsigned char *myaddr,
- int len) = 0;
+ virtual int read_memory (CORE_ADDR memaddr, unsigned char *myaddr, int len)
+ = 0;
/* Write memory to the inferior process. This should generally be
called through target_write_memory, which handles breakpoint shadowing.
@@ -157,7 +158,8 @@ public:
Returns 0 on success and errno on failure. */
virtual int write_memory (CORE_ADDR memaddr, const unsigned char *myaddr,
- int len) = 0;
+ int len)
+ = 0;
/* Query GDB for the values of any symbols we're interested in.
This function is called whenever we receive a "qSymbols::"
@@ -176,7 +178,7 @@ public:
Read LEN bytes at OFFSET into a buffer at MYADDR. */
virtual int read_auxv (int pid, CORE_ADDR offset, unsigned char *myaddr,
- unsigned int len);
+ unsigned int len);
/* Returns true if GDB Z breakpoint type TYPE is supported, false
otherwise. The type is coded as follows:
@@ -190,11 +192,11 @@ public:
/* Insert and remove a break or watchpoint.
Returns 0 on success, -1 on failure and 1 on unsupported. */
- virtual int insert_point (enum raw_bkpt_type type, CORE_ADDR addr,
- int size, raw_breakpoint *bp);
+ virtual int insert_point (enum raw_bkpt_type type, CORE_ADDR addr, int size,
+ raw_breakpoint *bp);
- virtual int remove_point (enum raw_bkpt_type type, CORE_ADDR addr,
- int size, raw_breakpoint *bp);
+ virtual int remove_point (enum raw_bkpt_type type, CORE_ADDR addr, int size,
+ raw_breakpoint *bp);
/* Returns true if the target stopped because it executed a software
breakpoint instruction, false otherwise. */
@@ -239,23 +241,23 @@ public:
an error code. A return value of -1 means this system does not
support the operation. */
virtual int get_tls_address (thread_info *thread, CORE_ADDR offset,
- CORE_ADDR load_module, CORE_ADDR *address);
+ CORE_ADDR load_module, CORE_ADDR *address);
/* Return true if the qxfer_osdata target op is supported. */
virtual bool supports_qxfer_osdata ();
/* Read/Write OS data using qXfer packets. */
virtual int qxfer_osdata (const char *annex, unsigned char *readbuf,
- unsigned const char *writebuf,
- CORE_ADDR offset, int len);
+ unsigned const char *writebuf, CORE_ADDR offset,
+ int len);
/* Return true if the qxfer_siginfo target op is supported. */
virtual bool supports_qxfer_siginfo ();
/* Read/Write extra signal info. */
virtual int qxfer_siginfo (const char *annex, unsigned char *readbuf,
- unsigned const char *writebuf,
- CORE_ADDR offset, int len);
+ unsigned const char *writebuf, CORE_ADDR offset,
+ int len);
/* Return true if non-stop mode is supported. */
virtual bool supports_non_stop ();
@@ -295,12 +297,12 @@ public:
/* Read loadmaps. Read LEN bytes at OFFSET into a buffer at MYADDR. */
virtual int read_loadmap (const char *annex, CORE_ADDR offset,
- unsigned char *myaddr, unsigned int len);
+ unsigned char *myaddr, unsigned int len);
/* Target specific qSupported support. FEATURES is an array of
features unsupported by the core of GDBserver. */
- virtual void process_qsupported
- (gdb::array_view<const char * const> features);
+ virtual void
+ process_qsupported (gdb::array_view<const char *const> features);
/* Return true if the target supports tracepoints, false otherwise. */
virtual bool supports_tracepoints ();
@@ -357,13 +359,13 @@ public:
return the address range where the instruction at TPADDR was relocated
to. If an error occurs, the ERR may be used to pass on an error
message. */
- virtual int install_fast_tracepoint_jump_pad
- (CORE_ADDR tpoint, CORE_ADDR tpaddr, CORE_ADDR collector,
- CORE_ADDR lockaddr, ULONGEST orig_size, CORE_ADDR *jump_entry,
- CORE_ADDR *trampoline, ULONGEST *trampoline_size,
- unsigned char *jjump_pad_insn, ULONGEST *jjump_pad_insn_size,
- CORE_ADDR *adjusted_insn_addr, CORE_ADDR *adjusted_insn_addr_end,
- char *err);
+ virtual int install_fast_tracepoint_jump_pad (
+ CORE_ADDR tpoint, CORE_ADDR tpaddr, CORE_ADDR collector,
+ CORE_ADDR lockaddr, ULONGEST orig_size, CORE_ADDR *jump_entry,
+ CORE_ADDR *trampoline, ULONGEST *trampoline_size,
+ unsigned char *jjump_pad_insn, ULONGEST *jjump_pad_insn_size,
+ CORE_ADDR *adjusted_insn_addr, CORE_ADDR *adjusted_insn_addr_end,
+ char *err);
/* Return the minimum length of an instruction that can be safely
overwritten for use as a fast tracepoint. */
@@ -380,10 +382,9 @@ public:
virtual bool supports_qxfer_libraries_svr4 ();
/* Read solib info on SVR4 platforms. */
- virtual int qxfer_libraries_svr4 (const char *annex,
- unsigned char *readbuf,
- unsigned const char *writebuf,
- CORE_ADDR offset, int len);
+ virtual int qxfer_libraries_svr4 (const char *annex, unsigned char *readbuf,
+ unsigned const char *writebuf,
+ CORE_ADDR offset, int len);
/* Return true if target supports debugging agent. */
virtual bool supports_agent ();
@@ -394,7 +395,7 @@ public:
/* Enable branch tracing for TP based on CONF and allocate a branch trace
target information struct for reading and for disabling branch trace. */
virtual btrace_target_info *enable_btrace (thread_info *tp,
- const btrace_config *conf);
+ const btrace_config *conf);
/* Disable branch tracing.
Returns zero on success, non-zero otherwise. */
@@ -404,13 +405,12 @@ public:
Return 0 on success; print an error message into BUFFER and return -1,
otherwise. */
virtual int read_btrace (btrace_target_info *tinfo, buffer *buf,
- enum btrace_read_type type);
+ enum btrace_read_type type);
/* Read the branch trace configuration into BUFFER.
Return 0 on success; print an error message into BUFFER and return -1
otherwise. */
- virtual int read_btrace_conf (const btrace_target_info *tinfo,
- buffer *buf);
+ virtual int read_btrace_conf (const btrace_target_info *tinfo, buffer *buf);
/* Return true if target supports range stepping. */
virtual bool supports_range_stepping ();
@@ -433,8 +433,8 @@ public:
the filesystem as it appears to process PID. Systems where all
processes share a common filesystem should not override this.
The default behavior is to use open(2). */
- virtual int multifs_open (int pid, const char *filename,
- int flags, mode_t mode);
+ virtual int multifs_open (int pid, const char *filename, int flags,
+ mode_t mode);
/* Multiple-filesystem-aware unlink. Like unlink(2), but operates
in the filesystem as it appears to process PID. Systems where
@@ -446,8 +446,8 @@ public:
operating in the filesystem as it appears to process PID.
Systems where all processes share a common filesystem should
not override this. The default behavior is to use readlink(2). */
- virtual ssize_t multifs_readlink (int pid, const char *filename,
- char *buf, size_t bufsiz);
+ virtual ssize_t multifs_readlink (int pid, const char *filename, char *buf,
+ size_t bufsiz);
/* Return the breakpoint kind for this target based on PC. The
PCPTR is adjusted to the real memory location in case a flag
@@ -473,8 +473,7 @@ public:
/* Thread ID to (numeric) thread handle: Return true on success and
false for failure. Return pointer to thread handle via HANDLE
and the handle's length via HANDLE_LEN. */
- virtual bool thread_handle (ptid_t ptid, gdb_byte **handle,
- int *handle_len);
+ virtual bool thread_handle (ptid_t ptid, gdb_byte **handle, int *handle_len);
/* If THREAD is a fork child that was not reported to GDB, return its parent
else nullptr. */
@@ -501,126 +500,102 @@ public:
Returns true if successful and false otherwise. */
virtual bool fetch_memtags (CORE_ADDR address, size_t len,
- gdb::byte_vector &tags, int type);
+ gdb::byte_vector &tags, int type);
/* Write the allocation tags of type TYPE contained in TAGS to the
memory range [ADDRESS, ADDRESS + LEN).
Returns true if successful and false otherwise. */
virtual bool store_memtags (CORE_ADDR address, size_t len,
- const gdb::byte_vector &tags, int type);
+ const gdb::byte_vector &tags, int type);
};
extern process_stratum_target *the_target;
void set_target_ops (process_stratum_target *);
-#define target_create_inferior(program, program_args) \
+#define target_create_inferior(program, program_args) \
the_target->create_inferior (program, program_args)
-#define target_post_create_inferior() \
- the_target->post_create_inferior ()
+#define target_post_create_inferior() the_target->post_create_inferior ()
-#define myattach(pid) \
- the_target->attach (pid)
+#define myattach(pid) the_target->attach (pid)
int kill_inferior (process_info *proc);
-#define target_supports_fork_events() \
- the_target->supports_fork_events ()
+#define target_supports_fork_events() the_target->supports_fork_events ()
-#define target_supports_vfork_events() \
- the_target->supports_vfork_events ()
+#define target_supports_vfork_events() the_target->supports_vfork_events ()
-#define target_supports_exec_events() \
- the_target->supports_exec_events ()
+#define target_supports_exec_events() the_target->supports_exec_events ()
-#define target_supports_memory_tagging() \
- the_target->supports_memory_tagging ()
+#define target_supports_memory_tagging() the_target->supports_memory_tagging ()
-#define target_handle_new_gdb_connection() \
+#define target_handle_new_gdb_connection() \
the_target->handle_new_gdb_connection ()
-#define detach_inferior(proc) \
- the_target->detach (proc)
+#define detach_inferior(proc) the_target->detach (proc)
-#define mythread_alive(pid) \
- the_target->thread_alive (pid)
+#define mythread_alive(pid) the_target->thread_alive (pid)
-#define fetch_inferior_registers(regcache, regno) \
+#define fetch_inferior_registers(regcache, regno) \
the_target->fetch_registers (regcache, regno)
#define store_inferior_registers(regcache, regno) \
the_target->store_registers (regcache, regno)
-#define join_inferior(pid) \
- the_target->join (pid)
+#define join_inferior(pid) the_target->join (pid)
-#define target_supports_non_stop() \
- the_target->supports_non_stop ()
+#define target_supports_non_stop() the_target->supports_non_stop ()
-#define target_async(enable) \
- the_target->async (enable)
+#define target_async(enable) the_target->async (enable)
#define target_process_qsupported(features) \
the_target->process_qsupported (features)
-#define target_supports_catch_syscall() \
- the_target->supports_catch_syscall ()
+#define target_supports_catch_syscall() the_target->supports_catch_syscall ()
-#define target_get_ipa_tdesc_idx() \
- the_target->get_ipa_tdesc_idx ()
+#define target_get_ipa_tdesc_idx() the_target->get_ipa_tdesc_idx ()
-#define target_supports_tracepoints() \
- the_target->supports_tracepoints ()
+#define target_supports_tracepoints() the_target->supports_tracepoints ()
-#define target_supports_fast_tracepoints() \
+#define target_supports_fast_tracepoints() \
the_target->supports_fast_tracepoints ()
-#define target_get_min_fast_tracepoint_insn_len() \
+#define target_get_min_fast_tracepoint_insn_len() \
the_target->get_min_fast_tracepoint_insn_len ()
-#define target_thread_stopped(thread) \
- the_target->thread_stopped (thread)
-
-#define target_pause_all(freeze) \
- the_target->pause_all (freeze)
-
-#define target_unpause_all(unfreeze) \
- the_target->unpause_all (unfreeze)
-
-#define target_stabilize_threads() \
- the_target->stabilize_threads ()
-
-#define target_install_fast_tracepoint_jump_pad(tpoint, tpaddr, \
- collector, lockaddr, \
- orig_size, \
- jump_entry, \
- trampoline, trampoline_size, \
- jjump_pad_insn, \
- jjump_pad_insn_size, \
- adjusted_insn_addr, \
- adjusted_insn_addr_end, \
- err) \
- the_target->install_fast_tracepoint_jump_pad (tpoint, tpaddr, \
- collector,lockaddr, \
- orig_size, jump_entry, \
- trampoline, \
- trampoline_size, \
- jjump_pad_insn, \
- jjump_pad_insn_size, \
- adjusted_insn_addr, \
- adjusted_insn_addr_end, \
- err)
-
-#define target_emit_ops() \
- the_target->emit_ops ()
+#define target_thread_stopped(thread) the_target->thread_stopped (thread)
+
+#define target_pause_all(freeze) the_target->pause_all (freeze)
+
+#define target_unpause_all(unfreeze) the_target->unpause_all (unfreeze)
+
+#define target_stabilize_threads() the_target->stabilize_threads ()
+
+#define target_install_fast_tracepoint_jump_pad(tpoint, tpaddr, collector, \
+ lockaddr, orig_size, \
+ jump_entry, trampoline, \
+ trampoline_size, \
+ jjump_pad_insn, \
+ jjump_pad_insn_size, \
+ adjusted_insn_addr, \
+ adjusted_insn_addr_end, err) \
+ the_target->install_fast_tracepoint_jump_pad (tpoint, tpaddr, collector, \
+ lockaddr, orig_size, \
+ jump_entry, trampoline, \
+ trampoline_size, \
+ jjump_pad_insn, \
+ jjump_pad_insn_size, \
+ adjusted_insn_addr, \
+ adjusted_insn_addr_end, err)
+
+#define target_emit_ops() the_target->emit_ops ()
#define target_supports_disable_randomization() \
the_target->supports_disable_randomization ()
-#define target_supports_agent() \
- the_target->supports_agent ()
+#define target_supports_agent() the_target->supports_agent ()
static inline struct btrace_target_info *
target_enable_btrace (thread_info *tp, const struct btrace_config *conf)
@@ -635,22 +610,20 @@ target_disable_btrace (struct btrace_target_info *tinfo)
}
static inline int
-target_read_btrace (struct btrace_target_info *tinfo,
- struct buffer *buffer,
- enum btrace_read_type type)
+target_read_btrace (struct btrace_target_info *tinfo, struct buffer *buffer,
+ enum btrace_read_type type)
{
return the_target->read_btrace (tinfo, buffer, type);
}
static inline int
target_read_btrace_conf (struct btrace_target_info *tinfo,
- struct buffer *buffer)
+ struct buffer *buffer)
{
return the_target->read_btrace_conf (tinfo, buffer);
}
-#define target_supports_range_stepping() \
- the_target->supports_range_stepping ()
+#define target_supports_range_stepping() the_target->supports_range_stepping ()
#define target_supports_stopped_by_sw_breakpoint() \
the_target->supports_stopped_by_sw_breakpoint ()
@@ -677,13 +650,11 @@ target_read_btrace_conf (struct btrace_target_info *tinfo,
the_target->supports_software_single_step ()
ptid_t mywait (ptid_t ptid, struct target_waitstatus *ourstatus,
- target_wait_flags options, int connected_wait);
+ target_wait_flags options, int connected_wait);
-#define target_core_of_thread(ptid) \
- the_target->core_of_thread (ptid)
+#define target_core_of_thread(ptid) the_target->core_of_thread (ptid)
-#define target_thread_name(ptid) \
- the_target->thread_name (ptid)
+#define target_thread_name(ptid) the_target->thread_name (ptid)
#define target_thread_handle(ptid, handle, handle_len) \
the_target->thread_handle (ptid, handle, handle_len)
diff --git a/gdbserver/tdesc.cc b/gdbserver/tdesc.cc
index 2c7257c458f..3cdaa8341f8 100644
--- a/gdbserver/tdesc.cc
+++ b/gdbserver/tdesc.cc
@@ -27,7 +27,8 @@ target_desc::~target_desc ()
xfree ((char *) osabi);
}
-bool target_desc::operator== (const target_desc &other) const
+bool
+target_desc::operator== (const target_desc &other) const
{
if (reg_defs != other.reg_defs)
return false;
@@ -37,7 +38,7 @@ bool target_desc::operator== (const target_desc &other) const
for (; expedite_regs[i] != NULL; i++)
{
if (strcmp (expedite_regs[i], other.expedite_regs[i]) != 0)
- return false;
+ return false;
}
if (other.expedite_regs[i] != NULL)
return false;
@@ -47,7 +48,8 @@ bool target_desc::operator== (const target_desc &other) const
#endif
-void target_desc::accept (tdesc_element_visitor &v) const
+void
+target_desc::accept (tdesc_element_visitor &v) const
{
#ifndef IN_PROCESS_AGENT
v.visit_pre (this);
@@ -60,8 +62,7 @@ void target_desc::accept (tdesc_element_visitor &v) const
}
void
-init_target_desc (struct target_desc *tdesc,
- const char **expedite_regs)
+init_target_desc (struct target_desc *tdesc, const char **expedite_regs)
{
int offset = 0;
@@ -69,17 +70,17 @@ init_target_desc (struct target_desc *tdesc,
for (const tdesc_feature_up &feature : tdesc->features)
for (const tdesc_reg_up &treg : feature->registers)
{
- int regnum = treg->target_regnum;
+ int regnum = treg->target_regnum;
- /* Register number will increase (possibly with gaps) or be zero. */
- gdb_assert (regnum == 0 || regnum >= tdesc->reg_defs.size ());
+ /* Register number will increase (possibly with gaps) or be zero. */
+ gdb_assert (regnum == 0 || regnum >= tdesc->reg_defs.size ());
- if (regnum != 0)
- tdesc->reg_defs.resize (regnum, gdb::reg (offset));
+ if (regnum != 0)
+ tdesc->reg_defs.resize (regnum, gdb::reg (offset));
- tdesc->reg_defs.emplace_back (treg->name.c_str (), offset,
- treg->bitsize);
- offset += treg->bitsize;
+ tdesc->reg_defs.emplace_back (treg->name.c_str (), offset,
+ treg->bitsize);
+ offset += treg->bitsize;
}
tdesc->registers_size = offset / 8;
@@ -111,11 +112,13 @@ target_desc_deleter::operator() (struct target_desc *target_desc) const
#ifndef IN_PROCESS_AGENT
-static const struct target_desc default_description {};
+static const struct target_desc default_description
+{
+};
void
copy_target_description (struct target_desc *dest,
- const struct target_desc *src)
+ const struct target_desc *src)
{
dest->reg_defs = src->reg_defs;
dest->expedite_regs = src->expedite_regs;
@@ -134,7 +137,9 @@ current_target_desc (void)
/* An empty structure. */
-struct tdesc_compatible_info { };
+struct tdesc_compatible_info
+{
+};
/* See gdbsupport/tdesc.h. */
@@ -164,8 +169,7 @@ tdesc_architecture_name (const struct target_desc *target_desc)
/* See gdbsupport/tdesc.h. */
void
-set_tdesc_architecture (struct target_desc *target_desc,
- const char *name)
+set_tdesc_architecture (struct target_desc *target_desc, const char *name)
{
target_desc->arch = xstrdup (name);
}
@@ -193,8 +197,7 @@ tdesc_get_features_xml (const target_desc *tdesc)
{
/* Either .xmltarget or .features is not NULL. */
gdb_assert (tdesc->xmltarget != NULL
- || (!tdesc->features.empty ()
- && tdesc->arch != NULL));
+ || (!tdesc->features.empty () && tdesc->arch != NULL));
if (tdesc->xmltarget == NULL)
{
@@ -228,7 +231,7 @@ tdesc_contains_feature (const target_desc *tdesc, const std::string &feature)
for (const tdesc_feature_up &f : tdesc->features)
{
if (f->name == feature)
- return true;
+ return true;
}
return false;
diff --git a/gdbserver/tdesc.h b/gdbserver/tdesc.h
index 7fe7d0d8eb3..b9207753ceb 100644
--- a/gdbserver/tdesc.h
+++ b/gdbserver/tdesc.h
@@ -60,9 +60,7 @@ struct target_desc final : tdesc_element
const char *osabi = NULL;
public:
- target_desc ()
- : registers_size (0)
- {}
+ target_desc () : registers_size (0) {}
~target_desc ();
@@ -80,13 +78,12 @@ public:
/* Copy target description SRC to DEST. */
void copy_target_description (struct target_desc *dest,
- const struct target_desc *src);
+ const struct target_desc *src);
/* Initialize TDESC, and then set its expedite_regs field to
EXPEDITE_REGS. */
-void init_target_desc (struct target_desc *tdesc,
- const char **expedite_regs);
+void init_target_desc (struct target_desc *tdesc, const char **expedite_regs);
/* Return the current inferior's target description. Never returns
NULL. */
@@ -96,6 +93,6 @@ const struct target_desc *current_target_desc (void);
/* Return true if TDESC contains the feature described by string FEATURE.
Return false otherwise. */
bool tdesc_contains_feature (const target_desc *tdesc,
- const std::string &feature);
+ const std::string &feature);
#endif /* GDBSERVER_TDESC_H */
diff --git a/gdbserver/thread-db.cc b/gdbserver/thread-db.cc
index ed274055391..5cc30d1ef7c 100644
--- a/gdbserver/thread-db.cc
+++ b/gdbserver/thread-db.cc
@@ -177,25 +177,25 @@ find_one_thread (ptid_t ptid)
thread_db *thread_db = proc->priv->thread_db;
td_thrhandle_t th;
int lwpid = ptid.lwp ();
- td_err_e err = thread_db->td_ta_map_lwp2thr_p (thread_db->thread_agent, lwpid,
- &th);
+ td_err_e err
+ = thread_db->td_ta_map_lwp2thr_p (thread_db->thread_agent, lwpid, &th);
if (err != TD_OK)
- error ("Cannot get thread handle for LWP %d: %s",
- lwpid, thread_db_err_str (err));
+ error ("Cannot get thread handle for LWP %d: %s", lwpid,
+ thread_db_err_str (err));
td_thrinfo_t ti;
err = thread_db->td_thr_get_info_p (&th, &ti);
if (err != TD_OK)
- error ("Cannot get thread info for LWP %d: %s",
- lwpid, thread_db_err_str (err));
+ error ("Cannot get thread info for LWP %d: %s", lwpid,
+ thread_db_err_str (err));
- threads_debug_printf ("Found thread %ld (LWP %d)",
- (unsigned long) ti.ti_tid, ti.ti_lid);
+ threads_debug_printf ("Found thread %ld (LWP %d)", (unsigned long) ti.ti_tid,
+ ti.ti_lid);
if (lwpid != ti.ti_lid)
{
- warning ("PID mismatch! Expected %ld, got %ld",
- (long) lwpid, (long) ti.ti_lid);
+ warning ("PID mismatch! Expected %ld, got %ld", (long) lwpid,
+ (long) ti.ti_lid);
return 0;
}
@@ -223,14 +223,14 @@ attach_thread (const td_thrhandle_t *th_p, td_thrinfo_t *ti_p)
int err;
threads_debug_printf ("Attaching to thread %ld (LWP %d)",
- (unsigned long) ti_p->ti_tid, ti_p->ti_lid);
+ (unsigned long) ti_p->ti_tid, ti_p->ti_lid);
err = the_linux_target->attach_lwp (ptid);
if (err != 0)
{
std::string reason = linux_ptrace_attach_fail_reason_string (ptid, err);
warning ("Could not attach to thread %ld (LWP %d): %s",
- (unsigned long) ti_p->ti_tid, ti_p->ti_lid, reason.c_str ());
+ (unsigned long) ti_p->ti_tid, ti_p->ti_lid, reason.c_str ());
return 0;
}
@@ -250,7 +250,7 @@ attach_thread (const td_thrhandle_t *th_p, td_thrinfo_t *ti_p)
static int
maybe_attach_thread (const td_thrhandle_t *th_p, td_thrinfo_t *ti_p,
- int *counter)
+ int *counter)
{
struct lwp_info *lwp;
@@ -287,8 +287,8 @@ find_new_threads_callback (const td_thrhandle_t *th_p, void *data)
terminated and joined threads with kernel thread ID -1. See
glibc PR17707. */
threads_debug_printf ("thread_db: skipping exited and "
- "joined thread (0x%lx)",
- (unsigned long) ti.ti_tid);
+ "joined thread (0x%lx)",
+ (unsigned long) ti.ti_tid);
return 0;
}
@@ -330,19 +330,18 @@ thread_db_find_new_threads (void)
/* Iterate over all user-space threads to discover new threads. */
err = thread_db->td_ta_thr_iter_p (thread_db->thread_agent,
- find_new_threads_callback,
- &new_thread_count,
- TD_THR_ANY_STATE,
- TD_THR_LOWEST_PRIORITY,
- TD_SIGNO_MASK, TD_THR_ANY_USER_FLAGS);
+ find_new_threads_callback,
+ &new_thread_count, TD_THR_ANY_STATE,
+ TD_THR_LOWEST_PRIORITY, TD_SIGNO_MASK,
+ TD_THR_ANY_USER_FLAGS);
threads_debug_printf ("Found %d threads in iteration %d.",
- new_thread_count, iteration);
+ new_thread_count, iteration);
if (new_thread_count != 0)
- {
- /* Found new threads. Restart iteration from beginning. */
- loop = -1;
- }
+ {
+ /* Found new threads. Restart iteration from beginning. */
+ loop = -1;
+ }
}
if (err != TD_OK)
error ("Cannot find new threads: %s", thread_db_err_str (err));
@@ -384,7 +383,7 @@ thread_db_look_up_one_symbol (const char *name, CORE_ADDR *addrp)
int
thread_db_get_tls_address (struct thread_info *thread, CORE_ADDR offset,
- CORE_ADDR load_module, CORE_ADDR *address)
+ CORE_ADDR load_module, CORE_ADDR *address)
{
psaddr_t addr;
td_err_e err;
@@ -419,9 +418,10 @@ thread_db_get_tls_address (struct thread_info *thread, CORE_ADDR offset,
/* Note the cast through uintptr_t: this interface only works if
a target address fits in a psaddr_t, which is a host pointer.
So a 32-bit debugger can not access 64-bit TLS through this. */
- err = thread_db->td_thr_tls_get_addr_p (&lwp->th,
- (psaddr_t) (uintptr_t) load_module,
- offset, &addr);
+ err
+ = thread_db->td_thr_tls_get_addr_p (&lwp->th,
+ (psaddr_t) (uintptr_t) load_module,
+ offset, &addr);
}
else
{
@@ -530,24 +530,24 @@ try_thread_db_load_1 (void *handle)
/* Initialize pointers to the dynamic library functions we will use.
Essential functions first. */
-#define CHK(required, a) \
- do \
- { \
- if ((a) == NULL) \
- { \
- threads_debug_printf ("dlsym: %s", dlerror ()); \
- if (required) \
- { \
- free (tdb); \
- proc->priv->thread_db = NULL; \
- return 0; \
- } \
- } \
- } \
+#define CHK(required, a) \
+ do \
+ { \
+ if ((a) == NULL) \
+ { \
+ threads_debug_printf ("dlsym: %s", dlerror ()); \
+ if (required) \
+ { \
+ free (tdb); \
+ proc->priv->thread_db = NULL; \
+ return 0; \
+ } \
+ } \
+ } \
while (0)
#define TDB_DLSYM(tdb, func) \
- tdb->func ## _p = (func ## _ftype *) dlsym (tdb->handle, #func)
+ tdb->func##_p = (func##_ftype *) dlsym (tdb->handle, #func)
CHK (1, TDB_DLSYM (tdb, td_ta_new));
@@ -599,8 +599,7 @@ try_thread_db_load (const char *library)
{
void *handle;
- threads_debug_printf ("Trying host libthread_db library: %s.",
- library);
+ threads_debug_printf ("Trying host libthread_db library: %s.", library);
handle = dlopen (library, RTLD_NOW);
if (handle == NULL)
{
@@ -615,12 +614,13 @@ try_thread_db_load (const char *library)
td_init = dlsym (handle, "td_init");
if (td_init != NULL)
- {
- const char *const libpath = dladdr_to_soname (td_init);
+ {
+ const char *const libpath = dladdr_to_soname (td_init);
- if (libpath != NULL)
- threads_debug_printf ("Host %s resolved to: %s.", library, libpath);
- }
+ if (libpath != NULL)
+ threads_debug_printf ("Host %s resolved to: %s.", library,
+ libpath);
+ }
}
#endif
@@ -657,8 +657,9 @@ try_thread_db_load_from_dir (const char *dir, size_t dir_len)
memcpy (cp, dir, dir_len);
cp[dir_len] = '\0';
- warning (_("libthread-db-search-path component too long,"
- " ignored: %s."), cp);
+ warning (_ ("libthread-db-search-path component too long,"
+ " ignored: %s."),
+ cp);
free (cp);
return 0;
}
@@ -693,36 +694,35 @@ thread_db_load_search (void)
this_dir_len = strlen (this_dir);
if (strncmp (this_dir, "$pdir", pdir_len) == 0
- && (this_dir[pdir_len] == '\0'
- || this_dir[pdir_len] == '/'))
- {
- /* We don't maintain a list of loaded libraries so we don't know
+ && (this_dir[pdir_len] == '\0' || this_dir[pdir_len] == '/'))
+ {
+ /* We don't maintain a list of loaded libraries so we don't know
where libpthread lives. We *could* fetch the info, but we don't
do that yet. Ignore it. */
- }
+ }
else if (strcmp (this_dir, "$sdir") == 0)
- {
- if (try_thread_db_load_from_sdir ())
- {
- rc = 1;
- break;
- }
- }
+ {
+ if (try_thread_db_load_from_sdir ())
+ {
+ rc = 1;
+ break;
+ }
+ }
else
- {
- if (try_thread_db_load_from_dir (this_dir, this_dir_len))
- {
- rc = 1;
- break;
- }
- }
+ {
+ if (try_thread_db_load_from_dir (this_dir, this_dir_len))
+ {
+ rc = 1;
+ break;
+ }
+ }
}
threads_debug_printf ("thread_db_load_search returning %d", rc);
return rc;
}
-#endif /* USE_LIBTHREAD_DB_DIRECTLY */
+#endif /* USE_LIBTHREAD_DB_DIRECTLY */
int
thread_db_init (void)
@@ -752,7 +752,7 @@ thread_db_init (void)
do not walk libpthread's thread list, so should be safe, as
well as more efficient. */
if (!linux_proc_task_list_dir_exists (pid_of (proc)))
- thread_db_find_new_threads ();
+ thread_db_find_new_threads ();
thread_db_look_up_symbols ();
return 1;
}
@@ -769,28 +769,28 @@ disable_thread_event_reporting (struct process_info *proc)
if (thread_db)
{
td_err_e (*td_ta_clear_event_p) (const td_thragent_t *ta,
- td_thr_events_t *event);
+ td_thr_events_t *event);
#ifndef USE_LIBTHREAD_DB_DIRECTLY
td_ta_clear_event_p
- = (td_ta_clear_event_ftype *) dlsym (thread_db->handle,
- "td_ta_clear_event");
+ = (td_ta_clear_event_ftype *) dlsym (thread_db->handle,
+ "td_ta_clear_event");
#else
td_ta_clear_event_p = &td_ta_clear_event;
#endif
if (td_ta_clear_event_p != NULL)
- {
- scoped_restore_current_thread restore_thread;
- td_thr_events_t events;
+ {
+ scoped_restore_current_thread restore_thread;
+ td_thr_events_t events;
- switch_to_process (proc);
+ switch_to_process (proc);
- /* Set the process wide mask saying we aren't interested
+ /* Set the process wide mask saying we aren't interested
in any events anymore. */
- td_event_fillset (&events);
- (*td_ta_clear_event_p) (thread_db->thread_agent, &events);
- }
+ td_event_fillset (&events);
+ (*td_ta_clear_event_p) (thread_db->thread_agent, &events);
+ }
}
}
@@ -816,17 +816,18 @@ thread_db_mourn (struct process_info *proc)
td_ta_delete_ftype *td_ta_delete_p;
#ifndef USE_LIBTHREAD_DB_DIRECTLY
- td_ta_delete_p = (td_ta_delete_ftype *) dlsym (thread_db->handle, "td_ta_delete");
+ td_ta_delete_p
+ = (td_ta_delete_ftype *) dlsym (thread_db->handle, "td_ta_delete");
#else
td_ta_delete_p = &td_ta_delete;
#endif
if (td_ta_delete_p != NULL)
- (*td_ta_delete_p) (thread_db->thread_agent);
+ (*td_ta_delete_p) (thread_db->thread_agent);
#ifndef USE_LIBTHREAD_DB_DIRECTLY
dlclose (thread_db->handle);
-#endif /* USE_LIBTHREAD_DB_DIRECTLY */
+#endif /* USE_LIBTHREAD_DB_DIRECTLY */
free (thread_db);
proc->priv->thread_db = NULL;
@@ -843,20 +844,19 @@ thread_db_handle_monitor_command (char *mon)
size_t cmd_len = strlen (cmd);
if (strncmp (mon, cmd, cmd_len) == 0
- && (mon[cmd_len] == '\0'
- || mon[cmd_len] == ' '))
+ && (mon[cmd_len] == '\0' || mon[cmd_len] == ' '))
{
const char *cp = mon + cmd_len;
if (libthread_db_search_path != NULL)
- free (libthread_db_search_path);
+ free (libthread_db_search_path);
/* Skip leading space (if any). */
while (isspace (*cp))
- ++cp;
+ ++cp;
if (*cp == '\0')
- cp = LIBTHREAD_DB_SEARCH_PATH;
+ cp = LIBTHREAD_DB_SEARCH_PATH;
libthread_db_search_path = xstrdup (cp);
monitor_output ("libthread-db-search-path set to `");
diff --git a/gdbserver/tracepoint.cc b/gdbserver/tracepoint.cc
index 37a9a8c5b7c..45318eb7fb8 100644
--- a/gdbserver/tracepoint.cc
+++ b/gdbserver/tracepoint.cc
@@ -77,18 +77,22 @@ trace_vdebug (const char *fmt, ...)
va_end (ap);
}
-#define trace_debug(fmt, args...) \
- do { \
- if (debug_threads) \
- trace_vdebug ((fmt), ##args); \
- } while (0)
+#define trace_debug(fmt, args...) \
+ do \
+ { \
+ if (debug_threads) \
+ trace_vdebug ((fmt), ##args); \
+ } \
+ while (0)
#else
-#define trace_debug(fmt, args...) \
- do { \
- threads_debug_printf ((fmt), ##args); \
- } while (0)
+#define trace_debug(fmt, args...) \
+ do \
+ { \
+ threads_debug_printf ((fmt), ##args); \
+ } \
+ while (0)
#endif
@@ -96,40 +100,43 @@ trace_vdebug (const char *fmt, ...)
that need exporting are defined in this module. Note that all
these symbols must be tagged with IP_AGENT_EXPORT_*. */
#ifdef IN_PROCESS_AGENT
-# define gdb_tp_heap_buffer IPA_SYM_EXPORTED_NAME (gdb_tp_heap_buffer)
-# define gdb_jump_pad_buffer IPA_SYM_EXPORTED_NAME (gdb_jump_pad_buffer)
-# define gdb_jump_pad_buffer_end IPA_SYM_EXPORTED_NAME (gdb_jump_pad_buffer_end)
-# define gdb_trampoline_buffer IPA_SYM_EXPORTED_NAME (gdb_trampoline_buffer)
-# define gdb_trampoline_buffer_end IPA_SYM_EXPORTED_NAME (gdb_trampoline_buffer_end)
-# define gdb_trampoline_buffer_error IPA_SYM_EXPORTED_NAME (gdb_trampoline_buffer_error)
-# define collecting IPA_SYM_EXPORTED_NAME (collecting)
-# define gdb_collect_ptr IPA_SYM_EXPORTED_NAME (gdb_collect_ptr)
-# define stop_tracing IPA_SYM_EXPORTED_NAME (stop_tracing)
-# define flush_trace_buffer IPA_SYM_EXPORTED_NAME (flush_trace_buffer)
-# define about_to_request_buffer_space IPA_SYM_EXPORTED_NAME (about_to_request_buffer_space)
-# define trace_buffer_is_full IPA_SYM_EXPORTED_NAME (trace_buffer_is_full)
-# define stopping_tracepoint IPA_SYM_EXPORTED_NAME (stopping_tracepoint)
-# define expr_eval_result IPA_SYM_EXPORTED_NAME (expr_eval_result)
-# define error_tracepoint IPA_SYM_EXPORTED_NAME (error_tracepoint)
-# define tracepoints IPA_SYM_EXPORTED_NAME (tracepoints)
-# define tracing IPA_SYM_EXPORTED_NAME (tracing)
-# define trace_buffer_ctrl IPA_SYM_EXPORTED_NAME (trace_buffer_ctrl)
-# define trace_buffer_ctrl_curr IPA_SYM_EXPORTED_NAME (trace_buffer_ctrl_curr)
-# define trace_buffer_lo IPA_SYM_EXPORTED_NAME (trace_buffer_lo)
-# define trace_buffer_hi IPA_SYM_EXPORTED_NAME (trace_buffer_hi)
-# define traceframe_read_count IPA_SYM_EXPORTED_NAME (traceframe_read_count)
-# define traceframe_write_count IPA_SYM_EXPORTED_NAME (traceframe_write_count)
-# define traceframes_created IPA_SYM_EXPORTED_NAME (traceframes_created)
-# define trace_state_variables IPA_SYM_EXPORTED_NAME (trace_state_variables)
-# define get_raw_reg_ptr IPA_SYM_EXPORTED_NAME (get_raw_reg_ptr)
-# define get_trace_state_variable_value_ptr \
+#define gdb_tp_heap_buffer IPA_SYM_EXPORTED_NAME (gdb_tp_heap_buffer)
+#define gdb_jump_pad_buffer IPA_SYM_EXPORTED_NAME (gdb_jump_pad_buffer)
+#define gdb_jump_pad_buffer_end IPA_SYM_EXPORTED_NAME (gdb_jump_pad_buffer_end)
+#define gdb_trampoline_buffer IPA_SYM_EXPORTED_NAME (gdb_trampoline_buffer)
+#define gdb_trampoline_buffer_end \
+ IPA_SYM_EXPORTED_NAME (gdb_trampoline_buffer_end)
+#define gdb_trampoline_buffer_error \
+ IPA_SYM_EXPORTED_NAME (gdb_trampoline_buffer_error)
+#define collecting IPA_SYM_EXPORTED_NAME (collecting)
+#define gdb_collect_ptr IPA_SYM_EXPORTED_NAME (gdb_collect_ptr)
+#define stop_tracing IPA_SYM_EXPORTED_NAME (stop_tracing)
+#define flush_trace_buffer IPA_SYM_EXPORTED_NAME (flush_trace_buffer)
+#define about_to_request_buffer_space \
+ IPA_SYM_EXPORTED_NAME (about_to_request_buffer_space)
+#define trace_buffer_is_full IPA_SYM_EXPORTED_NAME (trace_buffer_is_full)
+#define stopping_tracepoint IPA_SYM_EXPORTED_NAME (stopping_tracepoint)
+#define expr_eval_result IPA_SYM_EXPORTED_NAME (expr_eval_result)
+#define error_tracepoint IPA_SYM_EXPORTED_NAME (error_tracepoint)
+#define tracepoints IPA_SYM_EXPORTED_NAME (tracepoints)
+#define tracing IPA_SYM_EXPORTED_NAME (tracing)
+#define trace_buffer_ctrl IPA_SYM_EXPORTED_NAME (trace_buffer_ctrl)
+#define trace_buffer_ctrl_curr IPA_SYM_EXPORTED_NAME (trace_buffer_ctrl_curr)
+#define trace_buffer_lo IPA_SYM_EXPORTED_NAME (trace_buffer_lo)
+#define trace_buffer_hi IPA_SYM_EXPORTED_NAME (trace_buffer_hi)
+#define traceframe_read_count IPA_SYM_EXPORTED_NAME (traceframe_read_count)
+#define traceframe_write_count IPA_SYM_EXPORTED_NAME (traceframe_write_count)
+#define traceframes_created IPA_SYM_EXPORTED_NAME (traceframes_created)
+#define trace_state_variables IPA_SYM_EXPORTED_NAME (trace_state_variables)
+#define get_raw_reg_ptr IPA_SYM_EXPORTED_NAME (get_raw_reg_ptr)
+#define get_trace_state_variable_value_ptr \
IPA_SYM_EXPORTED_NAME (get_trace_state_variable_value_ptr)
-# define set_trace_state_variable_value_ptr \
+#define set_trace_state_variable_value_ptr \
IPA_SYM_EXPORTED_NAME (set_trace_state_variable_value_ptr)
-# define ust_loaded IPA_SYM_EXPORTED_NAME (ust_loaded)
-# define helper_thread_id IPA_SYM_EXPORTED_NAME (helper_thread_id)
-# define cmd_buf IPA_SYM_EXPORTED_NAME (cmd_buf)
-# define ipa_tdesc_idx IPA_SYM_EXPORTED_NAME (ipa_tdesc_idx)
+#define ust_loaded IPA_SYM_EXPORTED_NAME (ust_loaded)
+#define helper_thread_id IPA_SYM_EXPORTED_NAME (helper_thread_id)
+#define cmd_buf IPA_SYM_EXPORTED_NAME (cmd_buf)
+#define ipa_tdesc_idx IPA_SYM_EXPORTED_NAME (ipa_tdesc_idx)
#endif
#ifndef IN_PROCESS_AGENT
@@ -175,36 +182,36 @@ static struct
const char *name;
int offset;
} symbol_list[] = {
- IPA_SYM(gdb_tp_heap_buffer),
- IPA_SYM(gdb_jump_pad_buffer),
- IPA_SYM(gdb_jump_pad_buffer_end),
- IPA_SYM(gdb_trampoline_buffer),
- IPA_SYM(gdb_trampoline_buffer_end),
- IPA_SYM(gdb_trampoline_buffer_error),
- IPA_SYM(collecting),
- IPA_SYM(gdb_collect_ptr),
- IPA_SYM(stop_tracing),
- IPA_SYM(flush_trace_buffer),
- IPA_SYM(about_to_request_buffer_space),
- IPA_SYM(trace_buffer_is_full),
- IPA_SYM(stopping_tracepoint),
- IPA_SYM(expr_eval_result),
- IPA_SYM(error_tracepoint),
- IPA_SYM(tracepoints),
- IPA_SYM(tracing),
- IPA_SYM(trace_buffer_ctrl),
- IPA_SYM(trace_buffer_ctrl_curr),
- IPA_SYM(trace_buffer_lo),
- IPA_SYM(trace_buffer_hi),
- IPA_SYM(traceframe_read_count),
- IPA_SYM(traceframe_write_count),
- IPA_SYM(traceframes_created),
- IPA_SYM(trace_state_variables),
- IPA_SYM(get_raw_reg_ptr),
- IPA_SYM(get_trace_state_variable_value_ptr),
- IPA_SYM(set_trace_state_variable_value_ptr),
- IPA_SYM(ust_loaded),
- IPA_SYM(ipa_tdesc_idx),
+ IPA_SYM (gdb_tp_heap_buffer),
+ IPA_SYM (gdb_jump_pad_buffer),
+ IPA_SYM (gdb_jump_pad_buffer_end),
+ IPA_SYM (gdb_trampoline_buffer),
+ IPA_SYM (gdb_trampoline_buffer_end),
+ IPA_SYM (gdb_trampoline_buffer_error),
+ IPA_SYM (collecting),
+ IPA_SYM (gdb_collect_ptr),
+ IPA_SYM (stop_tracing),
+ IPA_SYM (flush_trace_buffer),
+ IPA_SYM (about_to_request_buffer_space),
+ IPA_SYM (trace_buffer_is_full),
+ IPA_SYM (stopping_tracepoint),
+ IPA_SYM (expr_eval_result),
+ IPA_SYM (error_tracepoint),
+ IPA_SYM (tracepoints),
+ IPA_SYM (tracing),
+ IPA_SYM (trace_buffer_ctrl),
+ IPA_SYM (trace_buffer_ctrl_curr),
+ IPA_SYM (trace_buffer_lo),
+ IPA_SYM (trace_buffer_hi),
+ IPA_SYM (traceframe_read_count),
+ IPA_SYM (traceframe_write_count),
+ IPA_SYM (traceframes_created),
+ IPA_SYM (trace_state_variables),
+ IPA_SYM (get_raw_reg_ptr),
+ IPA_SYM (get_trace_state_variable_value_ptr),
+ IPA_SYM (set_trace_state_variable_value_ptr),
+ IPA_SYM (ust_loaded),
+ IPA_SYM (ipa_tdesc_idx),
};
static struct ipa_sym_addresses ipa_sym_addrs;
@@ -231,10 +238,10 @@ in_process_agent_supports_ust (void)
/* Agent understands static tracepoint, then check whether UST is in
fact loaded in the inferior. */
if (read_inferior_integer (ipa_sym_addrs.addr_ust_loaded, &loaded))
- {
- warning ("Error reading ust_loaded in lib");
- return 0;
- }
+ {
+ warning ("Error reading ust_loaded in lib");
+ return 0;
+ }
return loaded;
}
@@ -245,9 +252,8 @@ in_process_agent_supports_ust (void)
static void
write_e_ipa_not_loaded (char *buffer)
{
- sprintf (buffer,
- "E.In-process agent library not loaded in process. "
- "Fast and static tracepoints unavailable.");
+ sprintf (buffer, "E.In-process agent library not loaded in process. "
+ "Fast and static tracepoints unavailable.");
}
/* Write an error to BUFFER indicating that UST isn't loaded in the
@@ -257,9 +263,8 @@ static void
write_e_ust_not_loaded (char *buffer)
{
#ifdef HAVE_UST
- sprintf (buffer,
- "E.UST library not loaded in process. "
- "Static tracepoints unavailable.");
+ sprintf (buffer, "E.UST library not loaded in process. "
+ "Static tracepoints unavailable.");
#else
sprintf (buffer, "E.GDBserver was built without static tracepoints support");
#endif
@@ -315,14 +320,14 @@ tracepoint_look_up_symbols (void)
for (i = 0; i < sizeof (symbol_list) / sizeof (symbol_list[0]); i++)
{
- CORE_ADDR *addrp =
- (CORE_ADDR *) ((char *) &ipa_sym_addrs + symbol_list[i].offset);
+ CORE_ADDR *addrp
+ = (CORE_ADDR *) ((char *) &ipa_sym_addrs + symbol_list[i].offset);
if (look_up_one_symbol (symbol_list[i].name, addrp, 1) == 0)
- {
- threads_debug_printf ("symbol `%s' not found", symbol_list[i].name);
- return;
- }
+ {
+ threads_debug_printf ("symbol `%s' not found", symbol_list[i].name);
+ return;
+ }
}
agent_look_up_symbols (NULL);
@@ -359,9 +364,13 @@ read_inferior_memory (CORE_ADDR memaddr, unsigned char *myaddr, int len)
to not inline said functions. */
#if defined(__GNUC__)
-# define UNKNOWN_SIDE_EFFECTS() asm ("")
+#define UNKNOWN_SIDE_EFFECTS() asm ("")
#else
-# define UNKNOWN_SIDE_EFFECTS() do {} while (0)
+#define UNKNOWN_SIDE_EFFECTS() \
+ do \
+ { \
+ } \
+ while (0)
#endif
/* This is needed for -Wmissing-declarations. */
@@ -371,7 +380,7 @@ IP_AGENT_EXPORT_FUNC void
stop_tracing (void)
{
/* GDBserver places breakpoint here. */
- UNKNOWN_SIDE_EFFECTS();
+ UNKNOWN_SIDE_EFFECTS ();
}
/* This is needed for -Wmissing-declarations. */
@@ -381,7 +390,7 @@ IP_AGENT_EXPORT_FUNC void
flush_trace_buffer (void)
{
/* GDBserver places breakpoint here. */
- UNKNOWN_SIDE_EFFECTS();
+ UNKNOWN_SIDE_EFFECTS ();
}
#endif
@@ -391,7 +400,7 @@ static int
tracepoint_handler (CORE_ADDR address)
{
trace_debug ("tracepoint_handler: tracepoint at 0x%s hit",
- paddress (address));
+ paddress (address));
return 0;
}
@@ -411,8 +420,7 @@ static int run_inferior_command (char *cmd, int len);
static int
read_inferior_integer (CORE_ADDR symaddr, int *val)
{
- return read_inferior_memory (symaddr, (unsigned char *) val,
- sizeof (*val));
+ return read_inferior_memory (symaddr, (unsigned char *) val, sizeof (*val));
}
struct tracepoint;
@@ -421,8 +429,7 @@ static int tracepoint_send_agent (struct tracepoint *tpoint);
static int
read_inferior_uinteger (CORE_ADDR symaddr, unsigned int *val)
{
- return read_inferior_memory (symaddr, (unsigned char *) val,
- sizeof (*val));
+ return read_inferior_memory (symaddr, (unsigned char *) val, sizeof (*val));
}
static int
@@ -440,8 +447,7 @@ static int
write_inferior_data_pointer (CORE_ADDR symaddr, CORE_ADDR val)
{
void *pval = (void *) (uintptr_t) val;
- return target_write_memory (symaddr,
- (unsigned char *) &pval, sizeof (pval));
+ return target_write_memory (symaddr, (unsigned char *) &pval, sizeof (pval));
}
static int
@@ -464,11 +470,13 @@ write_inferior_uinteger (CORE_ADDR symaddr, unsigned int val)
static CORE_ADDR target_malloc (ULONGEST size);
-#define COPY_FIELD_TO_BUF(BUF, OBJ, FIELD) \
- do { \
- memcpy (BUF, &(OBJ)->FIELD, sizeof ((OBJ)->FIELD)); \
- BUF += sizeof ((OBJ)->FIELD); \
- } while (0)
+#define COPY_FIELD_TO_BUF(BUF, OBJ, FIELD) \
+ do \
+ { \
+ memcpy (BUF, &(OBJ)->FIELD, sizeof ((OBJ)->FIELD)); \
+ BUF += sizeof ((OBJ)->FIELD); \
+ } \
+ while (0)
#endif
@@ -518,7 +526,7 @@ m_tracepoint_action_download (const struct tracepoint_action *action)
CORE_ADDR ipa_action = target_malloc (sizeof (struct collect_memory_action));
target_write_memory (ipa_action, (unsigned char *) action,
- sizeof (struct collect_memory_action));
+ sizeof (struct collect_memory_action));
return ipa_action;
}
@@ -538,10 +546,11 @@ m_tracepoint_action_send (char *buffer, const struct tracepoint_action *action)
static CORE_ADDR
r_tracepoint_action_download (const struct tracepoint_action *action)
{
- CORE_ADDR ipa_action = target_malloc (sizeof (struct collect_registers_action));
+ CORE_ADDR ipa_action
+ = target_malloc (sizeof (struct collect_registers_action));
target_write_memory (ipa_action, (unsigned char *) action,
- sizeof (struct collect_registers_action));
+ sizeof (struct collect_registers_action));
return ipa_action;
}
@@ -561,11 +570,11 @@ x_tracepoint_action_download (const struct tracepoint_action *action)
CORE_ADDR expr;
target_write_memory (ipa_action, (unsigned char *) action,
- sizeof (struct eval_expr_action));
+ sizeof (struct eval_expr_action));
expr = download_agent_expr (((struct eval_expr_action *) action)->expr);
write_inferior_data_pointer (ipa_action
- + offsetof (struct eval_expr_action, expr),
- expr);
+ + offsetof (struct eval_expr_action, expr),
+ expr);
return ipa_action;
}
@@ -586,7 +595,7 @@ agent_expr_send (char *p, const struct agent_expr *aexpr)
else
{
memcpy (p, &aexpr->length, 4);
- p +=4;
+ p += 4;
memcpy (p, aexpr->bytes, aexpr->length);
p += aexpr->length;
@@ -595,7 +604,7 @@ agent_expr_send (char *p, const struct agent_expr *aexpr)
}
static char *
-x_tracepoint_action_send ( char *buffer, const struct tracepoint_action *action)
+x_tracepoint_action_send (char *buffer, const struct tracepoint_action *action)
{
struct eval_expr_action *eaction = (struct eval_expr_action *) action;
@@ -609,7 +618,7 @@ l_tracepoint_action_download (const struct tracepoint_action *action)
= target_malloc (sizeof (struct collect_static_trace_data_action));
target_write_memory (ipa_action, (unsigned char *) action,
- sizeof (struct collect_static_trace_data_action));
+ sizeof (struct collect_static_trace_data_action));
return ipa_action;
}
@@ -690,8 +699,7 @@ enum tracepoint_type
struct tracepoint_hit_ctx;
-typedef enum eval_result_type (*condfn) (unsigned char *,
- ULONGEST *);
+typedef enum eval_result_type (*condfn) (unsigned char *, ULONGEST *);
/* The definition of a tracepoint. */
@@ -797,7 +805,6 @@ struct tracepoint
NULL if we haven't inserted it yet. */
void *handle;
#endif
-
};
#ifndef IN_PROCESS_AGENT
@@ -857,17 +864,12 @@ EXTERN_C_POP
static struct tracepoint *last_tracepoint;
-static const char * const eval_result_names[] =
- {
- "terror:in the attic", /* this should never be reported */
- "terror:empty expression",
- "terror:empty stack",
- "terror:stack overflow",
- "terror:stack underflow",
- "terror:unhandled opcode",
- "terror:unrecognized opcode",
- "terror:divide by zero"
- };
+static const char *const eval_result_names[]
+ = { "terror:in the attic", /* this should never be reported */
+ "terror:empty expression", "terror:empty stack",
+ "terror:stack overflow", "terror:stack underflow",
+ "terror:unhandled opcode", "terror:unrecognized opcode",
+ "terror:divide by zero" };
#endif
@@ -939,11 +941,11 @@ IP_AGENT_EXPORT_VAR struct trace_state_variable *trace_state_variables;
free space ends up in two parts at opposite ends of the buffer. */
#ifndef ATTR_PACKED
-# if defined(__GNUC__)
-# define ATTR_PACKED __attribute__ ((packed))
-# else
-# define ATTR_PACKED /* nothing */
-# endif
+#if defined(__GNUC__)
+#define ATTR_PACKED __attribute__ ((packed))
+#else
+#define ATTR_PACKED /* nothing */
+#endif
#endif
/* The data collected at a tracepoint hit. This object should be as
@@ -1041,7 +1043,6 @@ struct ipa_trace_buffer_control
uintptr_t wrap;
};
-
/* We have possibly both GDBserver and an inferior thread accessing
the same IPA trace buffer memory. The IPA is the producer (tries
to put new frames in the buffer), while GDBserver occasionally
@@ -1139,13 +1140,13 @@ A GDBserver update of `trace_buffer_ctrl_curr' does:
for the counters described below. The cleared bits are used to
hold the index of the items of the `trace_buffer_ctrl' array that
is "current". */
-#define GDBSERVER_FLUSH_COUNT_MASK 0xfffffff0
+#define GDBSERVER_FLUSH_COUNT_MASK 0xfffffff0
/* `trace_buffer_ctrl_curr' contains two counters. The `previous'
counter, and the `current' counter. */
-#define GDBSERVER_FLUSH_COUNT_MASK_PREV 0x7ff00000
-#define GDBSERVER_FLUSH_COUNT_MASK_CURR 0x0007ff00
+#define GDBSERVER_FLUSH_COUNT_MASK_PREV 0x7ff00000
+#define GDBSERVER_FLUSH_COUNT_MASK_CURR 0x0007ff00
/* When GDBserver update the IP agent's `trace_buffer_ctrl_curr', it
always stamps this bit as set. */
@@ -1155,7 +1156,7 @@ A GDBserver update of `trace_buffer_ctrl_curr' does:
IP_AGENT_EXPORT_VAR struct trace_buffer_control trace_buffer_ctrl[3];
IP_AGENT_EXPORT_VAR unsigned int trace_buffer_ctrl_curr;
-# define TRACE_BUFFER_CTRL_CURR \
+#define TRACE_BUFFER_CTRL_CURR \
(trace_buffer_ctrl_curr & ~GDBSERVER_FLUSH_COUNT_MASK)
#else
@@ -1165,7 +1166,7 @@ IP_AGENT_EXPORT_VAR unsigned int trace_buffer_ctrl_curr;
that the rest of the code base doesn't need to care for the
difference. */
static trace_buffer_control trace_buffer_ctrl[1];
-# define TRACE_BUFFER_CTRL_CURR 0
+#define TRACE_BUFFER_CTRL_CURR 0
#endif
/* These are convenience macros used to access the current trace
@@ -1176,7 +1177,6 @@ static trace_buffer_control trace_buffer_ctrl[1];
(trace_buffer_ctrl[TRACE_BUFFER_CTRL_CURR].end_free)
#define trace_buffer_wrap (trace_buffer_ctrl[TRACE_BUFFER_CTRL_CURR].wrap)
-
/* Macro that returns a pointer to the first traceframe in the buffer. */
#define FIRST_TRACEFRAME() ((struct traceframe *) trace_buffer_start)
@@ -1188,11 +1188,11 @@ static trace_buffer_control trace_buffer_ctrl[1];
#define NEXT_TRACEFRAME_1(TF) \
(((unsigned char *) (TF)) + sizeof (struct traceframe) + (TF)->data_size)
-#define NEXT_TRACEFRAME(TF) \
- ((struct traceframe *) (NEXT_TRACEFRAME_1 (TF) \
- - ((NEXT_TRACEFRAME_1 (TF) >= trace_buffer_wrap) \
- ? (trace_buffer_wrap - trace_buffer_lo) \
- : 0)))
+#define NEXT_TRACEFRAME(TF) \
+ ((struct traceframe *) (NEXT_TRACEFRAME_1 (TF) \
+ - ((NEXT_TRACEFRAME_1 (TF) >= trace_buffer_wrap) \
+ ? (trace_buffer_wrap - trace_buffer_lo) \
+ : 0)))
/* The difference between these counters represents the total number
of complete traceframes present in the trace buffer. The IP agent
@@ -1351,7 +1351,7 @@ static int traceframe_read_tsv (int num, LONGEST *val);
#endif
static int condition_true_at_tracepoint (struct tracepoint_hit_ctx *ctx,
- struct tracepoint *tpoint);
+ struct tracepoint *tpoint);
#ifndef IN_PROCESS_AGENT
static void clear_readonly_regions (void);
@@ -1359,20 +1359,20 @@ static void clear_installed_tracepoints (void);
#endif
static void collect_data_at_tracepoint (struct tracepoint_hit_ctx *ctx,
- CORE_ADDR stop_pc,
- struct tracepoint *tpoint);
+ CORE_ADDR stop_pc,
+ struct tracepoint *tpoint);
#ifndef IN_PROCESS_AGENT
static void collect_data_at_step (struct tracepoint_hit_ctx *ctx,
- CORE_ADDR stop_pc,
- struct tracepoint *tpoint, int current_step);
+ CORE_ADDR stop_pc, struct tracepoint *tpoint,
+ int current_step);
static void compile_tracepoint_condition (struct tracepoint *tpoint,
- CORE_ADDR *jump_entry);
+ CORE_ADDR *jump_entry);
#endif
static void do_action_at_tracepoint (struct tracepoint_hit_ctx *ctx,
- CORE_ADDR stop_pc,
- struct tracepoint *tpoint,
- struct traceframe *tframe,
- struct tracepoint_action *taction);
+ CORE_ADDR stop_pc,
+ struct tracepoint *tpoint,
+ struct traceframe *tframe,
+ struct tracepoint_action *taction);
#ifndef IN_PROCESS_AGENT
static struct tracepoint *fast_tracepoint_from_ipa_tpoint_address (CORE_ADDR);
@@ -1381,15 +1381,19 @@ static void install_tracepoint (struct tracepoint *, char *own_buf);
static void download_tracepoint (struct tracepoint *);
static int install_fast_tracepoint (struct tracepoint *, char *errbuf);
static void clone_fast_tracepoint (struct tracepoint *to,
- const struct tracepoint *from);
+ const struct tracepoint *from);
#endif
static LONGEST get_timestamp (void);
#if defined(__GNUC__)
-# define memory_barrier() asm volatile ("" : : : "memory")
+#define memory_barrier() asm volatile ("" : : : "memory")
#else
-# define memory_barrier() do {} while (0)
+#define memory_barrier() \
+ do \
+ { \
+ } \
+ while (0)
#endif
/* We only build the IPA if this builtin is supported, and there are
@@ -1402,16 +1406,15 @@ static LONGEST get_timestamp (void);
static void
record_tracepoint_error (struct tracepoint *tpoint, const char *which,
- enum eval_result_type rtype)
+ enum eval_result_type rtype)
{
- trace_debug ("Tracepoint %d at %s %s eval reports error %d",
- tpoint->number, paddress (tpoint->address), which, rtype);
+ trace_debug ("Tracepoint %d at %s %s eval reports error %d", tpoint->number,
+ paddress (tpoint->address), which, rtype);
#ifdef IN_PROCESS_AGENT
/* Only record the first error we get. */
- if (cmpxchg (&expr_eval_result,
- expr_eval_no_error,
- rtype) != expr_eval_no_error)
+ if (cmpxchg (&expr_eval_result, expr_eval_no_error, rtype)
+ != expr_eval_no_error)
return;
#else
if (expr_eval_result != expr_eval_no_error)
@@ -1448,9 +1451,9 @@ clear_inferior_trace_buffer (void)
struct ipa_trace_buffer_control ipa_trace_buffer_ctrl;
read_inferior_data_pointer (ipa_sym_addrs.addr_trace_buffer_lo,
- &ipa_trace_buffer_lo);
+ &ipa_trace_buffer_lo);
read_inferior_data_pointer (ipa_sym_addrs.addr_trace_buffer_hi,
- &ipa_trace_buffer_hi);
+ &ipa_trace_buffer_hi);
ipa_trace_buffer_ctrl.start = ipa_trace_buffer_lo;
ipa_trace_buffer_ctrl.free = ipa_trace_buffer_lo;
@@ -1459,15 +1462,14 @@ clear_inferior_trace_buffer (void)
/* A traceframe with zeroed fields marks the end of trace data. */
target_write_memory (ipa_sym_addrs.addr_trace_buffer_ctrl,
- (unsigned char *) &ipa_trace_buffer_ctrl,
- sizeof (ipa_trace_buffer_ctrl));
+ (unsigned char *) &ipa_trace_buffer_ctrl,
+ sizeof (ipa_trace_buffer_ctrl));
write_inferior_uinteger (ipa_sym_addrs.addr_trace_buffer_ctrl_curr, 0);
/* A traceframe with zeroed fields marks the end of trace data. */
- target_write_memory (ipa_trace_buffer_lo,
- (unsigned char *) &ipa_traceframe,
- sizeof (ipa_traceframe));
+ target_write_memory (ipa_trace_buffer_lo, (unsigned char *) &ipa_traceframe,
+ sizeof (ipa_traceframe));
write_inferior_uinteger (ipa_sym_addrs.addr_traceframe_write_count, 0);
write_inferior_uinteger (ipa_sym_addrs.addr_traceframe_read_count, 0);
@@ -1485,8 +1487,9 @@ init_trace_buffer (LONGEST bufsize)
/* Make sure to internally allocate at least space for the EOB
marker. */
- alloc_size = (bufsize < TRACEFRAME_EOB_MARKER_SIZE
- ? TRACEFRAME_EOB_MARKER_SIZE : bufsize);
+ alloc_size
+ = (bufsize < TRACEFRAME_EOB_MARKER_SIZE ? TRACEFRAME_EOB_MARKER_SIZE
+ : bufsize);
trace_buffer_lo = (unsigned char *) xrealloc (trace_buffer_lo, alloc_size);
trace_buffer_hi = trace_buffer_lo + trace_buffer_size;
@@ -1504,7 +1507,7 @@ about_to_request_buffer_space (void)
{
/* GDBserver places breakpoint here while it goes about to flush
data at random times. */
- UNKNOWN_SIDE_EFFECTS();
+ UNKNOWN_SIDE_EFFECTS ();
}
#endif
@@ -1528,14 +1531,14 @@ trace_buffer_alloc (size_t amt)
unsigned char *new_start;
#endif
- trace_debug ("Want to allocate %ld+%ld bytes in trace buffer",
- (long) amt, (long) sizeof (struct traceframe));
+ trace_debug ("Want to allocate %ld+%ld bytes in trace buffer", (long) amt,
+ (long) sizeof (struct traceframe));
/* Account for the EOB marker. */
amt += TRACEFRAME_EOB_MARKER_SIZE;
#ifdef IN_PROCESS_AGENT
- again:
+again:
memory_barrier ();
/* Read the current token and extract the index to try to write to,
@@ -1551,8 +1554,7 @@ trace_buffer_alloc (size_t amt)
/* Start out with a copy of the current state. GDBserver may be
midway writing to the PREV_FILTERED TBC, but, that's OK, we won't
be able to commit anyway if that happens. */
- trace_buffer_ctrl[curr]
- = trace_buffer_ctrl[prev_filtered];
+ trace_buffer_ctrl[curr] = trace_buffer_ctrl[prev_filtered];
trace_debug ("trying curr=%u", curr);
#else
/* The GDBserver's agent doesn't need all that syncing, and always
@@ -1565,12 +1567,11 @@ trace_buffer_alloc (size_t amt)
especially for the small trace buffer sizes that are useful for
testing. */
trace_debug ("Trace buffer [%d] start=%d free=%d endfree=%d wrap=%d hi=%d",
- curr,
- (int) (tbctrl->start - trace_buffer_lo),
- (int) (tbctrl->free - trace_buffer_lo),
- (int) (tbctrl->end_free - trace_buffer_lo),
- (int) (tbctrl->wrap - trace_buffer_lo),
- (int) (trace_buffer_hi - trace_buffer_lo));
+ curr, (int) (tbctrl->start - trace_buffer_lo),
+ (int) (tbctrl->free - trace_buffer_lo),
+ (int) (tbctrl->end_free - trace_buffer_lo),
+ (int) (tbctrl->wrap - trace_buffer_lo),
+ (int) (trace_buffer_hi - trace_buffer_lo));
/* The algorithm here is to keep trying to get a contiguous block of
the requested size, possibly discarding older traceframes to free
@@ -1582,25 +1583,25 @@ trace_buffer_alloc (size_t amt)
{
/* First, if we have two free parts, try the upper one first. */
if (tbctrl->end_free < tbctrl->free)
- {
- if (tbctrl->free + amt <= trace_buffer_hi)
- /* We have enough in the upper part. */
- break;
- else
- {
- /* Our high part of free space wasn't enough. Give up
+ {
+ if (tbctrl->free + amt <= trace_buffer_hi)
+ /* We have enough in the upper part. */
+ break;
+ else
+ {
+ /* Our high part of free space wasn't enough. Give up
on it for now, set wraparound. We will recover the
space later, if/when the wrapped-around traceframe is
discarded. */
- trace_debug ("Upper part too small, setting wraparound");
- tbctrl->wrap = tbctrl->free;
- tbctrl->free = trace_buffer_lo;
- }
- }
+ trace_debug ("Upper part too small, setting wraparound");
+ tbctrl->wrap = tbctrl->free;
+ tbctrl->free = trace_buffer_lo;
+ }
+ }
/* The normal case. */
if (tbctrl->free + amt <= tbctrl->end_free)
- break;
+ break;
#ifdef IN_PROCESS_AGENT
/* The IP Agent's buffer is always circular. It isn't used
@@ -1611,10 +1612,10 @@ trace_buffer_alloc (size_t amt)
flush_trace_buffer ();
memory_barrier ();
if (tracing)
- {
- trace_debug ("gdbserver flushed buffer, retrying");
- goto again;
- }
+ {
+ trace_debug ("gdbserver flushed buffer, retrying");
+ goto again;
+ }
/* GDBserver cancelled the tracing. Bail out as well. */
return NULL;
@@ -1622,10 +1623,10 @@ trace_buffer_alloc (size_t amt)
/* If we're here, then neither part is big enough, and
non-circular trace buffers are now full. */
if (!circular_trace_buffer)
- {
- trace_debug ("Not enough space in the trace buffer");
- return NULL;
- }
+ {
+ trace_debug ("Not enough space in the trace buffer");
+ return NULL;
+ }
trace_debug ("Need more space in the trace buffer");
@@ -1633,13 +1634,13 @@ trace_buffer_alloc (size_t amt)
oldest traceframe and see if that helps. */
oldest = FIRST_TRACEFRAME ();
if (oldest->tpnum == 0)
- {
- /* Not good; we have no traceframes to free. Perhaps we're
+ {
+ /* Not good; we have no traceframes to free. Perhaps we're
asking for a block that is larger than the buffer? In
any case, give up. */
- trace_debug ("No traceframes to discard");
- return NULL;
- }
+ trace_debug ("No traceframes to discard");
+ return NULL;
+ }
/* We don't run this code in the in-process agent currently.
E.g., we could leave the in-process agent in autonomous
@@ -1652,22 +1653,21 @@ trace_buffer_alloc (size_t amt)
/* If we freed the traceframe that wrapped around, go back
to the non-wrap case. */
if (new_start < tbctrl->start)
- {
- trace_debug ("Discarding past the wraparound");
- tbctrl->wrap = trace_buffer_hi;
- }
+ {
+ trace_debug ("Discarding past the wraparound");
+ tbctrl->wrap = trace_buffer_hi;
+ }
tbctrl->start = new_start;
tbctrl->end_free = tbctrl->start;
trace_debug ("Discarded a traceframe\n"
- "Trace buffer [%d], start=%d free=%d "
- "endfree=%d wrap=%d hi=%d",
- curr,
- (int) (tbctrl->start - trace_buffer_lo),
- (int) (tbctrl->free - trace_buffer_lo),
- (int) (tbctrl->end_free - trace_buffer_lo),
- (int) (tbctrl->wrap - trace_buffer_lo),
- (int) (trace_buffer_hi - trace_buffer_lo));
+ "Trace buffer [%d], start=%d free=%d "
+ "endfree=%d wrap=%d hi=%d",
+ curr, (int) (tbctrl->start - trace_buffer_lo),
+ (int) (tbctrl->free - trace_buffer_lo),
+ (int) (tbctrl->end_free - trace_buffer_lo),
+ (int) (tbctrl->wrap - trace_buffer_lo),
+ (int) (trace_buffer_hi - trace_buffer_lo));
/* Now go back around the loop. The discard might have resulted
in either one or two pieces of free space, so we want to try
@@ -1691,18 +1691,17 @@ trace_buffer_alloc (size_t amt)
#ifdef IN_PROCESS_AGENT
/* Build the tentative token. */
commit_count = (((prev & GDBSERVER_FLUSH_COUNT_MASK_CURR) + 0x100)
- & GDBSERVER_FLUSH_COUNT_MASK_CURR);
- commit = (((prev & GDBSERVER_FLUSH_COUNT_MASK_CURR) << 12)
- | commit_count
- | curr);
+ & GDBSERVER_FLUSH_COUNT_MASK_CURR);
+ commit
+ = (((prev & GDBSERVER_FLUSH_COUNT_MASK_CURR) << 12) | commit_count | curr);
/* Try to commit it. */
readout = cmpxchg (&trace_buffer_ctrl_curr, prev, commit);
if (readout != prev)
{
trace_debug ("GDBserver has touched the trace buffer, restarting."
- " (prev=%08x, commit=%08x, readout=%08x)",
- prev, commit, readout);
+ " (prev=%08x, commit=%08x, readout=%08x)",
+ prev, commit, readout);
goto again;
}
@@ -1725,19 +1724,19 @@ trace_buffer_alloc (size_t amt)
refetch = trace_buffer_ctrl_curr;
if (refetch == commit
- || ((refetch & GDBSERVER_FLUSH_COUNT_MASK_PREV) >> 12) == commit_count)
+ || ((refetch & GDBSERVER_FLUSH_COUNT_MASK_PREV) >> 12) == commit_count)
{
- /* effective */
- trace_debug ("change is effective: (prev=%08x, commit=%08x, "
- "readout=%08x, refetch=%08x)",
- prev, commit, readout, refetch);
+ /* effective */
+ trace_debug ("change is effective: (prev=%08x, commit=%08x, "
+ "readout=%08x, refetch=%08x)",
+ prev, commit, readout, refetch);
}
else
{
- trace_debug ("GDBserver has touched the trace buffer, not effective."
- " (prev=%08x, commit=%08x, readout=%08x, refetch=%08x)",
- prev, commit, readout, refetch);
- goto again;
+ trace_debug ("GDBserver has touched the trace buffer, not effective."
+ " (prev=%08x, commit=%08x, readout=%08x, refetch=%08x)",
+ prev, commit, readout, refetch);
+ goto again;
}
}
#endif
@@ -1756,13 +1755,12 @@ trace_buffer_alloc (size_t amt)
{
trace_debug ("Allocated %d bytes", (int) amt);
trace_debug ("Trace buffer [%d] start=%d free=%d "
- "endfree=%d wrap=%d hi=%d",
- curr,
- (int) (tbctrl->start - trace_buffer_lo),
- (int) (tbctrl->free - trace_buffer_lo),
- (int) (tbctrl->end_free - trace_buffer_lo),
- (int) (tbctrl->wrap - trace_buffer_lo),
- (int) (trace_buffer_hi - trace_buffer_lo));
+ "endfree=%d wrap=%d hi=%d",
+ curr, (int) (tbctrl->start - trace_buffer_lo),
+ (int) (tbctrl->free - trace_buffer_lo),
+ (int) (tbctrl->end_free - trace_buffer_lo),
+ (int) (tbctrl->wrap - trace_buffer_lo),
+ (int) (trace_buffer_hi - trace_buffer_lo));
}
return rslt;
@@ -1780,7 +1778,7 @@ free_space (void)
return trace_buffer_end_free - trace_buffer_free;
else
return ((trace_buffer_end_free - trace_buffer_lo)
- + (trace_buffer_hi - trace_buffer_free));
+ + (trace_buffer_hi - trace_buffer_free));
}
/* An 'S' in continuation packets indicates remainder are for
@@ -1876,9 +1874,9 @@ remove_tracepoint (struct tracepoint *tpoint)
if (tp)
{
if (tp_prev)
- tp_prev->next = tp->next;
+ tp_prev->next = tp->next;
else
- tracepoints = tp->next;
+ tracepoints = tp->next;
xfree (tp);
}
@@ -1928,112 +1926,109 @@ add_tracepoint_action (struct tracepoint *tpoint, const char *packet)
struct tracepoint_action *action = NULL;
switch (*act)
- {
- case 'M':
- {
- struct collect_memory_action *maction =
- XNEW (struct collect_memory_action);
- ULONGEST basereg;
- int is_neg;
-
- maction->base.type = *act;
- action = &maction->base;
-
- ++act;
- is_neg = (*act == '-');
- if (*act == '-')
- ++act;
- act = unpack_varlen_hex (act, &basereg);
- ++act;
- act = unpack_varlen_hex (act, &maction->addr);
- ++act;
- act = unpack_varlen_hex (act, &maction->len);
- maction->basereg = (is_neg
- ? - (int) basereg
- : (int) basereg);
- trace_debug ("Want to collect %s bytes at 0x%s (basereg %d)",
- pulongest (maction->len),
- paddress (maction->addr), maction->basereg);
- break;
- }
- case 'R':
- {
- struct collect_registers_action *raction =
- XNEW (struct collect_registers_action);
-
- raction->base.type = *act;
- action = &raction->base;
-
- trace_debug ("Want to collect registers");
- ++act;
- /* skip past hex digits of mask for now */
- while (isxdigit(*act))
- ++act;
- break;
- }
- case 'L':
- {
- struct collect_static_trace_data_action *raction =
- XNEW (struct collect_static_trace_data_action);
-
- raction->base.type = *act;
- action = &raction->base;
-
- trace_debug ("Want to collect static trace data");
- ++act;
- break;
- }
- case 'S':
- trace_debug ("Unexpected step action, ignoring");
- ++act;
- break;
- case 'X':
- {
- struct eval_expr_action *xaction = XNEW (struct eval_expr_action);
-
- xaction->base.type = *act;
- action = &xaction->base;
-
- trace_debug ("Want to evaluate expression");
- xaction->expr = gdb_parse_agent_expr (&act);
- break;
- }
- default:
- trace_debug ("unknown trace action '%c', ignoring...", *act);
- break;
- case '-':
- break;
- }
+ {
+ case 'M':
+ {
+ struct collect_memory_action *maction
+ = XNEW (struct collect_memory_action);
+ ULONGEST basereg;
+ int is_neg;
+
+ maction->base.type = *act;
+ action = &maction->base;
+
+ ++act;
+ is_neg = (*act == '-');
+ if (*act == '-')
+ ++act;
+ act = unpack_varlen_hex (act, &basereg);
+ ++act;
+ act = unpack_varlen_hex (act, &maction->addr);
+ ++act;
+ act = unpack_varlen_hex (act, &maction->len);
+ maction->basereg = (is_neg ? -(int) basereg : (int) basereg);
+ trace_debug ("Want to collect %s bytes at 0x%s (basereg %d)",
+ pulongest (maction->len), paddress (maction->addr),
+ maction->basereg);
+ break;
+ }
+ case 'R':
+ {
+ struct collect_registers_action *raction
+ = XNEW (struct collect_registers_action);
+
+ raction->base.type = *act;
+ action = &raction->base;
+
+ trace_debug ("Want to collect registers");
+ ++act;
+ /* skip past hex digits of mask for now */
+ while (isxdigit (*act))
+ ++act;
+ break;
+ }
+ case 'L':
+ {
+ struct collect_static_trace_data_action *raction
+ = XNEW (struct collect_static_trace_data_action);
+
+ raction->base.type = *act;
+ action = &raction->base;
+
+ trace_debug ("Want to collect static trace data");
+ ++act;
+ break;
+ }
+ case 'S':
+ trace_debug ("Unexpected step action, ignoring");
+ ++act;
+ break;
+ case 'X':
+ {
+ struct eval_expr_action *xaction = XNEW (struct eval_expr_action);
+
+ xaction->base.type = *act;
+ action = &xaction->base;
+
+ trace_debug ("Want to evaluate expression");
+ xaction->expr = gdb_parse_agent_expr (&act);
+ break;
+ }
+ default:
+ trace_debug ("unknown trace action '%c', ignoring...", *act);
+ break;
+ case '-':
+ break;
+ }
if (action == NULL)
- break;
+ break;
if (seen_step_action_flag)
- {
- tpoint->num_step_actions++;
-
- tpoint->step_actions
- = XRESIZEVEC (struct tracepoint_action *, tpoint->step_actions,
- tpoint->num_step_actions);
- tpoint->step_actions_str
- = XRESIZEVEC (char *, tpoint->step_actions_str,
- tpoint->num_step_actions);
- tpoint->step_actions[tpoint->num_step_actions - 1] = action;
- tpoint->step_actions_str[tpoint->num_step_actions - 1]
- = savestring (act_start, act - act_start);
- }
+ {
+ tpoint->num_step_actions++;
+
+ tpoint->step_actions
+ = XRESIZEVEC (struct tracepoint_action *, tpoint->step_actions,
+ tpoint->num_step_actions);
+ tpoint->step_actions_str
+ = XRESIZEVEC (char *, tpoint->step_actions_str,
+ tpoint->num_step_actions);
+ tpoint->step_actions[tpoint->num_step_actions - 1] = action;
+ tpoint->step_actions_str[tpoint->num_step_actions - 1]
+ = savestring (act_start, act - act_start);
+ }
else
- {
- tpoint->numactions++;
- tpoint->actions
- = XRESIZEVEC (struct tracepoint_action *, tpoint->actions,
- tpoint->numactions);
- tpoint->actions_str
- = XRESIZEVEC (char *, tpoint->actions_str, tpoint->numactions);
- tpoint->actions[tpoint->numactions - 1] = action;
- tpoint->actions_str[tpoint->numactions - 1]
- = savestring (act_start, act - act_start);
- }
+ {
+ tpoint->numactions++;
+ tpoint->actions = XRESIZEVEC (struct tracepoint_action *,
+ tpoint->actions, tpoint->numactions);
+ tpoint->actions_str
+ = XRESIZEVEC (char *, tpoint->actions_str, tpoint->numactions);
+ tpoint->actions[tpoint->numactions - 1] = action;
+ tpoint->actions_str[tpoint->numactions - 1]
+ = savestring (act_start, act - act_start);
+ }
}
}
@@ -2117,15 +2112,15 @@ get_trace_state_variable_value (int num)
if (tsv->getter)
tsv->value = (tsv->getter) ();
- trace_debug ("get_trace_state_variable_value(%d) ==> %s",
- num, plongest (tsv->value));
+ trace_debug ("get_trace_state_variable_value(%d) ==> %s", num,
+ plongest (tsv->value));
return tsv->value;
}
/* This is needed for -Wmissing-declarations. */
IP_AGENT_EXPORT_FUNC void set_trace_state_variable_value (int num,
- LONGEST val);
+ LONGEST val);
IP_AGENT_EXPORT_FUNC void
set_trace_state_variable_value (int num, LONGEST val)
@@ -2209,8 +2204,8 @@ add_traceframe (struct tracepoint *tpoint)
/* Add a block to the traceframe currently being worked on. */
static unsigned char *
-add_traceframe_block (struct traceframe *tframe,
- struct tracepoint *tpoint, int amt)
+add_traceframe_block (struct traceframe *tframe, struct tracepoint *tpoint,
+ int amt)
{
unsigned char *block;
@@ -2250,12 +2245,11 @@ find_traceframe (int num)
struct traceframe *tframe;
int tfnum = 0;
- for (tframe = FIRST_TRACEFRAME ();
- tframe->tpnum != 0;
+ for (tframe = FIRST_TRACEFRAME (); tframe->tpnum != 0;
tframe = NEXT_TRACEFRAME (tframe))
{
if (tfnum == num)
- return tframe;
+ return tframe;
++tfnum;
}
@@ -2284,7 +2278,7 @@ get_traceframe_address (struct traceframe *tframe)
static struct traceframe *
find_next_traceframe_in_range (CORE_ADDR lo, CORE_ADDR hi, int inside_p,
- int *tfnump)
+ int *tfnump)
{
client_state &cs = get_client_state ();
struct traceframe *tframe;
@@ -2302,10 +2296,9 @@ find_next_traceframe_in_range (CORE_ADDR lo, CORE_ADDR hi, int inside_p,
for (; tframe->tpnum != 0; tframe = NEXT_TRACEFRAME (tframe))
{
tfaddr = get_traceframe_address (tframe);
- if (inside_p
- ? (lo <= tfaddr && tfaddr <= hi)
- : (lo > tfaddr || tfaddr > hi))
- return tframe;
+ if (inside_p ? (lo <= tfaddr && tfaddr <= hi)
+ : (lo > tfaddr || tfaddr > hi))
+ return tframe;
++*tfnump;
}
@@ -2335,7 +2328,7 @@ find_next_traceframe_by_tracepoint (int num, int *tfnump)
for (; tframe->tpnum != 0; tframe = NEXT_TRACEFRAME (tframe))
{
if (tframe->tpnum == num)
- return tframe;
+ return tframe;
++*tfnump;
}
@@ -2383,21 +2376,21 @@ cmd_qtinit (char *packet)
{
trace_debug ("Looking at var %d", tsv->number);
if (tsv->getter == NULL)
- {
- next = tsv->next;
- if (prev)
- prev->next = next;
- else
- trace_state_variables = next;
- trace_debug ("Deleting var %d", tsv->number);
- free (tsv);
- tsv = next;
- }
+ {
+ next = tsv->next;
+ if (prev)
+ prev->next = next;
+ else
+ trace_state_variables = next;
+ trace_debug ("Deleting var %d", tsv->number);
+ free (tsv);
+ tsv = next;
+ }
else
- {
- prev = tsv;
- tsv = tsv->next;
- }
+ {
+ prev = tsv;
+ tsv = tsv->next;
+ }
}
clear_trace_buffer ();
@@ -2437,45 +2430,43 @@ clear_installed_tracepoints (void)
/* Catch the case where we might try to remove a tracepoint that
was never actually installed. */
if (tpoint->handle == NULL)
- {
- trace_debug ("Tracepoint %d at 0x%s was "
- "never installed, nothing to clear",
- tpoint->number, paddress (tpoint->address));
- continue;
- }
+ {
+ trace_debug ("Tracepoint %d at 0x%s was "
+ "never installed, nothing to clear",
+ tpoint->number, paddress (tpoint->address));
+ continue;
+ }
switch (tpoint->type)
- {
- case trap_tracepoint:
- {
- struct breakpoint *bp
- = (struct breakpoint *) tpoint->handle;
-
- delete_breakpoint (bp);
- }
- break;
- case fast_tracepoint:
- {
- struct fast_tracepoint_jump *jump
- = (struct fast_tracepoint_jump *) tpoint->handle;
-
- delete_fast_tracepoint_jump (jump);
- }
- break;
- case static_tracepoint:
- if (prev_stpoint != NULL
- && prev_stpoint->address == tpoint->address)
- /* Nothing to do. We already unprobed a tracepoint set at
+ {
+ case trap_tracepoint:
+ {
+ struct breakpoint *bp = (struct breakpoint *) tpoint->handle;
+
+ delete_breakpoint (bp);
+ }
+ break;
+ case fast_tracepoint:
+ {
+ struct fast_tracepoint_jump *jump
+ = (struct fast_tracepoint_jump *) tpoint->handle;
+
+ delete_fast_tracepoint_jump (jump);
+ }
+ break;
+ case static_tracepoint:
+ if (prev_stpoint != NULL && prev_stpoint->address == tpoint->address)
+ /* Nothing to do. We already unprobed a tracepoint set at
this marker address (and there can only be one probe
per marker). */
- ;
- else
- {
- unprobe_marker_at (tpoint->address);
- prev_stpoint = tpoint;
- }
- break;
- }
+ ;
+ else
+ {
+ unprobe_marker_at (tpoint->address);
+ prev_stpoint = tpoint;
+ }
+ break;
+ }
tpoint->handle = NULL;
}
@@ -2519,13 +2510,13 @@ cmd_qtdp (char *own_buf)
{
/* Duplicate tracepoints are never allowed. */
if (tpoint)
- {
- trace_debug ("Tracepoint error: tracepoint %d"
- " at 0x%s already exists",
- (int) num, paddress (addr));
- write_enn (own_buf);
- return;
- }
+ {
+ trace_debug ("Tracepoint error: tracepoint %d"
+ " at 0x%s already exists",
+ (int) num, paddress (addr));
+ write_enn (own_buf);
+ return;
+ }
tpoint = add_tracepoint (num, addr);
@@ -2539,50 +2530,51 @@ cmd_qtdp (char *own_buf)
tpoint->pass_count = count;
/* See if we have any of the additional optional fields. */
while (*packet == ':')
- {
- ++packet;
- if (*packet == 'F')
- {
- tpoint->type = fast_tracepoint;
- ++packet;
- packet = unpack_varlen_hex (packet, &count);
- tpoint->orig_size = count;
- }
- else if (*packet == 'S')
- {
- tpoint->type = static_tracepoint;
- ++packet;
- }
- else if (*packet == 'X')
- {
- tpoint->cond = gdb_parse_agent_expr (&packet);
- }
- else if (*packet == '-')
- break;
- else if (*packet == '\0')
- break;
- else
- trace_debug ("Unknown optional tracepoint field");
- }
+ {
+ ++packet;
+ if (*packet == 'F')
+ {
+ tpoint->type = fast_tracepoint;
+ ++packet;
+ packet = unpack_varlen_hex (packet, &count);
+ tpoint->orig_size = count;
+ }
+ else if (*packet == 'S')
+ {
+ tpoint->type = static_tracepoint;
+ ++packet;
+ }
+ else if (*packet == 'X')
+ {
+ tpoint->cond = gdb_parse_agent_expr (&packet);
+ }
+ else if (*packet == '-')
+ break;
+ else if (*packet == '\0')
+ break;
+ else
+ trace_debug ("Unknown optional tracepoint field");
+ }
if (*packet == '-')
- {
- trail_hyphen = 1;
- trace_debug ("Also has actions\n");
- }
+ {
+ trail_hyphen = 1;
+ trace_debug ("Also has actions\n");
+ }
trace_debug ("Defined %stracepoint %d at 0x%s, "
- "enabled %d step %" PRIu64 " pass %" PRIu64,
- tpoint->type == fast_tracepoint ? "fast "
- : tpoint->type == static_tracepoint ? "static " : "",
- tpoint->number, paddress (tpoint->address), tpoint->enabled,
- tpoint->step_count, tpoint->pass_count);
+ "enabled %d step %" PRIu64 " pass %" PRIu64,
+ tpoint->type == fast_tracepoint ? "fast "
+ : tpoint->type == static_tracepoint ? "static "
+ : "",
+ tpoint->number, paddress (tpoint->address), tpoint->enabled,
+ tpoint->step_count, tpoint->pass_count);
}
else if (tpoint)
add_tracepoint_action (tpoint, packet);
else
{
trace_debug ("Tracepoint error: tracepoint %d at 0x%s not found",
- (int) num, paddress (addr));
+ (int) num, paddress (addr));
write_enn (own_buf);
return;
}
@@ -2605,52 +2597,51 @@ cmd_qtdp (char *own_buf)
/* Freeze threads. */
target_pause_all (true);
-
if (tpoint->type != trap_tracepoint)
- {
- /* Find another fast or static tracepoint at the same address. */
- for (tp = tracepoints; tp; tp = tp->next)
- {
- if (tp->address == tpoint->address && tp->type == tpoint->type
- && tp->number != tpoint->number)
- break;
- }
-
- /* TPOINT is installed at the same address as TP. */
- if (tp)
- {
- if (tpoint->type == fast_tracepoint)
- clone_fast_tracepoint (tpoint, tp);
- else if (tpoint->type == static_tracepoint)
- tpoint->handle = (void *) -1;
- }
- }
+ {
+ /* Find another fast or static tracepoint at the same address. */
+ for (tp = tracepoints; tp; tp = tp->next)
+ {
+ if (tp->address == tpoint->address && tp->type == tpoint->type
+ && tp->number != tpoint->number)
+ break;
+ }
+
+ /* TPOINT is installed at the same address as TP. */
+ if (tp)
+ {
+ if (tpoint->type == fast_tracepoint)
+ clone_fast_tracepoint (tpoint, tp);
+ else if (tpoint->type == static_tracepoint)
+ tpoint->handle = (void *) -1;
+ }
+ }
if (use_agent && tpoint->type == fast_tracepoint
- && agent_capability_check (AGENT_CAPA_FAST_TRACE))
- {
- /* Download and install fast tracepoint by agent. */
- if (tracepoint_send_agent (tpoint) == 0)
- write_ok (own_buf);
- else
- {
- write_enn (own_buf);
- remove_tracepoint (tpoint);
- }
- }
+ && agent_capability_check (AGENT_CAPA_FAST_TRACE))
+ {
+ /* Download and install fast tracepoint by agent. */
+ if (tracepoint_send_agent (tpoint) == 0)
+ write_ok (own_buf);
+ else
+ {
+ write_enn (own_buf);
+ remove_tracepoint (tpoint);
+ }
+ }
else
- {
- download_tracepoint (tpoint);
-
- if (tpoint->type == trap_tracepoint || tp == NULL)
- {
- install_tracepoint (tpoint, own_buf);
- if (strcmp (own_buf, "OK") != 0)
- remove_tracepoint (tpoint);
- }
- else
- write_ok (own_buf);
- }
+ {
+ download_tracepoint (tpoint);
+
+ if (tpoint->type == trap_tracepoint || tp == NULL)
+ {
+ install_tracepoint (tpoint, own_buf);
+ if (strcmp (own_buf, "OK") != 0)
+ remove_tracepoint (tpoint);
+ }
+ else
+ write_ok (own_buf);
+ }
target_unpause_all (true);
return;
@@ -2683,7 +2674,7 @@ cmd_qtdpsrc (char *own_buf)
if (!tpoint)
{
trace_debug ("Tracepoint error: tracepoint %d at 0x%s not found",
- (int) num, paddress (addr));
+ (int) num, paddress (addr));
write_enn (own_buf);
return;
}
@@ -2712,7 +2703,7 @@ cmd_qtdpsrc (char *own_buf)
if (tpoint->source_strings)
{
for (last = tpoint->source_strings; last->next; last = last->next)
- ;
+ ;
last->next = newlast;
}
else
@@ -2770,41 +2761,40 @@ cmd_qtenable_disable (char *own_buf, int enable)
if (tp)
{
if ((enable && tp->enabled) || (!enable && !tp->enabled))
- {
- trace_debug ("Tracepoint %d at 0x%s is already %s",
- (int) num, paddress (addr),
- enable ? "enabled" : "disabled");
- write_ok (own_buf);
- return;
- }
+ {
+ trace_debug ("Tracepoint %d at 0x%s is already %s", (int) num,
+ paddress (addr), enable ? "enabled" : "disabled");
+ write_ok (own_buf);
+ return;
+ }
trace_debug ("%s tracepoint %d at 0x%s",
- enable ? "Enabling" : "Disabling",
- (int) num, paddress (addr));
+ enable ? "Enabling" : "Disabling", (int) num,
+ paddress (addr));
tp->enabled = enable;
if (tp->type == fast_tracepoint || tp->type == static_tracepoint)
- {
- int offset = offsetof (struct tracepoint, enabled);
- CORE_ADDR obj_addr = tp->obj_addr_on_target + offset;
-
- int ret = write_inferior_int8 (obj_addr, enable);
- if (ret)
- {
- trace_debug ("Cannot write enabled flag into "
- "inferior process memory");
- write_enn (own_buf);
- return;
- }
- }
+ {
+ int offset = offsetof (struct tracepoint, enabled);
+ CORE_ADDR obj_addr = tp->obj_addr_on_target + offset;
+
+ int ret = write_inferior_int8 (obj_addr, enable);
+ if (ret)
+ {
+ trace_debug ("Cannot write enabled flag into "
+ "inferior process memory");
+ write_enn (own_buf);
+ return;
+ }
+ }
write_ok (own_buf);
}
else
{
- trace_debug ("Tracepoint %d at 0x%s not found",
- (int) num, paddress (addr));
+ trace_debug ("Tracepoint %d at 0x%s not found", (int) num,
+ paddress (addr));
write_enn (own_buf);
}
}
@@ -2825,10 +2815,10 @@ cmd_qtv (char *own_buf)
{
err = traceframe_read_tsv ((int) num, &val);
if (err)
- {
- strcpy (own_buf, "U");
- return;
- }
+ {
+ strcpy (own_buf, "U");
+ return;
+ }
}
/* Only make tsv's be undefined before the first trace run. After a
trace run is over, the user might want to see the last value of
@@ -2878,9 +2868,9 @@ cmd_qtro (char *own_buf)
while (*packet == ':')
{
- ++packet; /* skip a colon */
+ ++packet; /* skip a colon */
packet = unpack_varlen_hex (packet, &start);
- ++packet; /* skip a comma */
+ ++packet; /* skip a comma */
packet = unpack_varlen_hex (packet, &end);
roreg = XNEW (struct readonly_region);
@@ -2889,7 +2879,7 @@ cmd_qtro (char *own_buf)
roreg->next = readonly_regions;
readonly_regions = roreg;
trace_debug ("Added readonly region from 0x%s to 0x%s",
- paddress (roreg->start), paddress (roreg->end));
+ paddress (roreg->start), paddress (roreg->end));
}
write_ok (own_buf);
@@ -2921,10 +2911,10 @@ get_jump_space_head (void)
if (gdb_jump_pad_head == 0)
{
if (read_inferior_data_pointer (ipa_sym_addrs.addr_gdb_jump_pad_buffer,
- &gdb_jump_pad_head))
- {
- internal_error ("error extracting jump_pad_buffer");
- }
+ &gdb_jump_pad_head))
+ {
+ internal_error ("error extracting jump_pad_buffer");
+ }
}
return gdb_jump_pad_head;
@@ -2935,8 +2925,8 @@ get_jump_space_head (void)
static void
claim_jump_space (ULONGEST used)
{
- trace_debug ("claim_jump_space reserves %s bytes at %s",
- pulongest (used), paddress (gdb_jump_pad_head));
+ trace_debug ("claim_jump_space reserves %s bytes at %s", pulongest (used),
+ paddress (gdb_jump_pad_head));
gdb_jump_pad_head += used;
}
@@ -2953,16 +2943,17 @@ claim_trampoline_space (ULONGEST used, CORE_ADDR *trampoline)
if (!trampoline_buffer_head)
{
if (read_inferior_data_pointer (ipa_sym_addrs.addr_gdb_trampoline_buffer,
- &trampoline_buffer_tail))
- {
- internal_error ("error extracting trampoline_buffer");
- }
+ &trampoline_buffer_tail))
+ {
+ internal_error ("error extracting trampoline_buffer");
+ }
- if (read_inferior_data_pointer (ipa_sym_addrs.addr_gdb_trampoline_buffer_end,
- &trampoline_buffer_head))
- {
- internal_error ("error extracting trampoline_buffer_end");
- }
+ if (read_inferior_data_pointer (ipa_sym_addrs
+ .addr_gdb_trampoline_buffer_end,
+ &trampoline_buffer_head))
+ {
+ internal_error ("error extracting trampoline_buffer_end");
+ }
}
/* Start claiming space from the top of the trampoline space. If
@@ -2972,14 +2963,14 @@ claim_trampoline_space (ULONGEST used, CORE_ADDR *trampoline)
if (trampoline_buffer_head - trampoline_buffer_tail < used)
{
trace_debug ("claim_trampoline_space failed to reserve %s bytes",
- pulongest (used));
+ pulongest (used));
return 0;
}
trampoline_buffer_head -= used;
trace_debug ("claim_trampoline_space reserves %s bytes at %s",
- pulongest (used), paddress (trampoline_buffer_head));
+ pulongest (used), paddress (trampoline_buffer_head));
*trampoline = trampoline_buffer_head;
return 1;
@@ -2994,20 +2985,20 @@ have_fast_tracepoint_trampoline_buffer (char *buf)
CORE_ADDR trampoline_end, errbuf;
if (read_inferior_data_pointer (ipa_sym_addrs.addr_gdb_trampoline_buffer_end,
- &trampoline_end))
+ &trampoline_end))
{
internal_error ("error extracting trampoline_buffer_end");
}
-
+
if (buf)
{
buf[0] = '\0';
strcpy (buf, "was claiming");
- if (read_inferior_data_pointer (ipa_sym_addrs.addr_gdb_trampoline_buffer_error,
- &errbuf))
- {
- internal_error ("error extracting errbuf");
- }
+ if (read_inferior_data_pointer (
+ ipa_sym_addrs.addr_gdb_trampoline_buffer_error, &errbuf))
+ {
+ internal_error ("error extracting errbuf");
+ }
read_inferior_memory (errbuf, (unsigned char *) buf, 100);
}
@@ -3033,10 +3024,10 @@ probe_marker_at (CORE_ADDR address, char *errout)
if (err == 0)
{
if (*cmd == 'E')
- {
- strcpy (errout, cmd);
- return -1;
- }
+ {
+ strcpy (errout, cmd);
+ return -1;
+ }
}
return err;
@@ -3078,12 +3069,12 @@ install_fast_tracepoint (struct tracepoint *tpoint, char *errbuf)
if (tpoint->orig_size < target_get_min_fast_tracepoint_insn_len ())
{
trace_debug ("Requested a fast tracepoint on an instruction "
- "that is of less than the minimum length.");
+ "that is of less than the minimum length.");
return 0;
}
if (read_inferior_data_pointer (ipa_sym_addrs.addr_gdb_collect_ptr,
- &collect))
+ &collect))
{
error ("error extracting gdb_collect_ptr");
return 1;
@@ -3095,18 +3086,23 @@ install_fast_tracepoint (struct tracepoint *tpoint, char *errbuf)
trampoline_size = 0;
/* Install the jump pad. */
- err = target_install_fast_tracepoint_jump_pad
- (tpoint->obj_addr_on_target, tpoint->address, collect,
- ipa_sym_addrs.addr_collecting, tpoint->orig_size, &jentry,
- &trampoline, &trampoline_size, fjump, &fjump_size,
- &tpoint->adjusted_insn_addr, &tpoint->adjusted_insn_addr_end, errbuf);
+ err
+ = target_install_fast_tracepoint_jump_pad (tpoint->obj_addr_on_target,
+ tpoint->address, collect,
+ ipa_sym_addrs.addr_collecting,
+ tpoint->orig_size, &jentry,
+ &trampoline, &trampoline_size,
+ fjump, &fjump_size,
+ &tpoint->adjusted_insn_addr,
+ &tpoint->adjusted_insn_addr_end,
+ errbuf);
if (err)
return 1;
/* Wire it in. */
- tpoint->handle = set_fast_tracepoint_jump (tpoint->address, fjump,
- fjump_size);
+ tpoint->handle
+ = set_fast_tracepoint_jump (tpoint->address, fjump, fjump_size);
if (tpoint->handle != NULL)
{
@@ -3123,7 +3119,6 @@ install_fast_tracepoint (struct tracepoint *tpoint, char *errbuf)
return 0;
}
-
/* Install tracepoint TPOINT, and write reply message in OWN_BUF. */
static void
@@ -3138,36 +3133,35 @@ install_tracepoint (struct tracepoint *tpoint, char *own_buf)
ahead and install the trap. The breakpoints module
handles duplicated breakpoints, and the memory read
routine handles un-patching traps from memory reads. */
- tpoint->handle = set_breakpoint_at (tpoint->address,
- tracepoint_handler);
+ tpoint->handle = set_breakpoint_at (tpoint->address, tracepoint_handler);
}
- else if (tpoint->type == fast_tracepoint || tpoint->type == static_tracepoint)
+ else if (tpoint->type == fast_tracepoint
+ || tpoint->type == static_tracepoint)
{
if (!agent_loaded_p ())
- {
- trace_debug ("Requested a %s tracepoint, but fast "
- "tracepoints aren't supported.",
- tpoint->type == static_tracepoint ? "static" : "fast");
- write_e_ipa_not_loaded (own_buf);
- return;
- }
+ {
+ trace_debug ("Requested a %s tracepoint, but fast "
+ "tracepoints aren't supported.",
+ tpoint->type == static_tracepoint ? "static" : "fast");
+ write_e_ipa_not_loaded (own_buf);
+ return;
+ }
if (tpoint->type == static_tracepoint
- && !in_process_agent_supports_ust ())
- {
- trace_debug ("Requested a static tracepoint, but static "
- "tracepoints are not supported.");
- write_e_ust_not_loaded (own_buf);
- return;
- }
+ && !in_process_agent_supports_ust ())
+ {
+ trace_debug ("Requested a static tracepoint, but static "
+ "tracepoints are not supported.");
+ write_e_ust_not_loaded (own_buf);
+ return;
+ }
if (tpoint->type == fast_tracepoint)
- install_fast_tracepoint (tpoint, own_buf);
+ install_fast_tracepoint (tpoint, own_buf);
else
- {
- if (probe_marker_at (tpoint->address, own_buf) == 0)
- tpoint->handle = (void *) -1;
- }
-
+ {
+ if (probe_marker_at (tpoint->address, own_buf) == 0)
+ tpoint->handle = (void *) -1;
+ }
}
else
internal_error ("Unknown tracepoint type");
@@ -3175,7 +3169,7 @@ install_tracepoint (struct tracepoint *tpoint, char *own_buf)
if (tpoint->handle == NULL)
{
if (*own_buf == '\0')
- write_enn (own_buf);
+ write_enn (own_buf);
}
else
write_ok (own_buf);
@@ -3219,8 +3213,8 @@ cmd_qtstart (char *packet)
{
/* Tell IPA about the correct tdesc. */
if (write_inferior_integer (ipa_sym_addrs.addr_ipa_tdesc_idx,
- target_get_ipa_tdesc_idx ()))
- error ("Error setting ipa_tdesc_idx variable in lib");
+ target_get_ipa_tdesc_idx ()))
+ error ("Error setting ipa_tdesc_idx variable in lib");
}
/* Start out empty. */
@@ -3235,103 +3229,105 @@ cmd_qtstart (char *packet)
tpoint->traceframe_usage = 0;
if (tpoint->type == trap_tracepoint)
- {
- /* Tracepoints are installed as memory breakpoints. Just go
+ {
+ /* Tracepoints are installed as memory breakpoints. Just go
ahead and install the trap. The breakpoints module
handles duplicated breakpoints, and the memory read
routine handles un-patching traps from memory reads. */
- tpoint->handle = set_breakpoint_at (tpoint->address,
- tracepoint_handler);
- }
+ tpoint->handle
+ = set_breakpoint_at (tpoint->address, tracepoint_handler);
+ }
else if (tpoint->type == fast_tracepoint
- || tpoint->type == static_tracepoint)
- {
- if (maybe_write_ipa_not_loaded (packet))
- {
- trace_debug ("Requested a %s tracepoint, but fast "
- "tracepoints aren't supported.",
- tpoint->type == static_tracepoint
- ? "static" : "fast");
- break;
- }
-
- if (tpoint->type == fast_tracepoint)
- {
- int use_agent_p
- = use_agent && agent_capability_check (AGENT_CAPA_FAST_TRACE);
-
- if (prev_ftpoint != NULL
- && prev_ftpoint->address == tpoint->address)
- {
- if (use_agent_p)
- tracepoint_send_agent (tpoint);
- else
- download_tracepoint_1 (tpoint);
-
- clone_fast_tracepoint (tpoint, prev_ftpoint);
- }
- else
- {
- /* Tracepoint is installed successfully? */
- int installed = 0;
-
- /* Download and install fast tracepoint by agent. */
- if (use_agent_p)
- installed = !tracepoint_send_agent (tpoint);
- else
- {
- download_tracepoint_1 (tpoint);
- installed = !install_fast_tracepoint (tpoint, packet);
- }
-
- if (installed)
- prev_ftpoint = tpoint;
- }
- }
- else
- {
- if (!in_process_agent_supports_ust ())
- {
- trace_debug ("Requested a static tracepoint, but static "
- "tracepoints are not supported.");
- break;
- }
-
- download_tracepoint_1 (tpoint);
- /* Can only probe a given marker once. */
- if (prev_stpoint != NULL
- && prev_stpoint->address == tpoint->address)
- tpoint->handle = (void *) -1;
- else
- {
- if (probe_marker_at (tpoint->address, packet) == 0)
- {
- tpoint->handle = (void *) -1;
-
- /* So that we can handle multiple static tracepoints
+ || tpoint->type == static_tracepoint)
+ {
+ if (maybe_write_ipa_not_loaded (packet))
+ {
+ trace_debug ("Requested a %s tracepoint, but fast "
+ "tracepoints aren't supported.",
+ tpoint->type == static_tracepoint ? "static"
+ : "fast");
+ break;
+ }
+
+ if (tpoint->type == fast_tracepoint)
+ {
+ int use_agent_p
+ = use_agent && agent_capability_check (AGENT_CAPA_FAST_TRACE);
+
+ if (prev_ftpoint != NULL
+ && prev_ftpoint->address == tpoint->address)
+ {
+ if (use_agent_p)
+ tracepoint_send_agent (tpoint);
+ else
+ download_tracepoint_1 (tpoint);
+
+ clone_fast_tracepoint (tpoint, prev_ftpoint);
+ }
+ else
+ {
+ /* Tracepoint is installed successfully? */
+ int installed = 0;
+
+ /* Download and install fast tracepoint by agent. */
+ if (use_agent_p)
+ installed = !tracepoint_send_agent (tpoint);
+ else
+ {
+ download_tracepoint_1 (tpoint);
+ installed = !install_fast_tracepoint (tpoint, packet);
+ }
+
+ if (installed)
+ prev_ftpoint = tpoint;
+ }
+ }
+ else
+ {
+ if (!in_process_agent_supports_ust ())
+ {
+ trace_debug ("Requested a static tracepoint, but static "
+ "tracepoints are not supported.");
+ break;
+ }
+
+ download_tracepoint_1 (tpoint);
+ /* Can only probe a given marker once. */
+ if (prev_stpoint != NULL
+ && prev_stpoint->address == tpoint->address)
+ tpoint->handle = (void *) -1;
+ else
+ {
+ if (probe_marker_at (tpoint->address, packet) == 0)
+ {
+ tpoint->handle = (void *) -1;
+
+ /* So that we can handle multiple static tracepoints
at the same address easily. */
- prev_stpoint = tpoint;
- }
- }
- }
+ prev_stpoint = tpoint;
+ }
+ }
+ }
- prev_tpptr = tpptr;
- tpptr = tpoint->obj_addr_on_target;
+ prev_tpptr = tpptr;
+ tpptr = tpoint->obj_addr_on_target;
- if (tpoint == tracepoints)
- /* First object in list, set the head pointer in the
+ if (tpoint == tracepoints)
+ /* First object in list, set the head pointer in the
inferior. */
- write_inferior_data_pointer (ipa_sym_addrs.addr_tracepoints, tpptr);
- else
- write_inferior_data_pointer (prev_tpptr
- + offsetof (struct tracepoint, next),
- tpptr);
- }
+ write_inferior_data_pointer (ipa_sym_addrs.addr_tracepoints,
+ tpptr);
+ else
+ write_inferior_data_pointer (prev_tpptr
+ + offsetof (struct tracepoint,
+ next),
+ tpptr);
+ }
/* Any failure in the inner loop is sufficient cause to give
up. */
if (tpoint->handle == NULL)
- break;
+ break;
}
/* Any error in tracepoint insertion is unacceptable; better to
@@ -3341,7 +3337,7 @@ cmd_qtstart (char *packet)
{
clear_installed_tracepoints ();
if (*packet == '\0')
- write_enn (packet);
+ write_enn (packet);
target_unpause_all (true);
return;
}
@@ -3358,33 +3354,33 @@ cmd_qtstart (char *packet)
if (agent_loaded_p ())
{
if (write_inferior_integer (ipa_sym_addrs.addr_tracing, 1))
- {
- internal_error ("Error setting tracing variable in lib");
- }
+ {
+ internal_error ("Error setting tracing variable in lib");
+ }
if (write_inferior_data_pointer (ipa_sym_addrs.addr_stopping_tracepoint,
- 0))
- {
- internal_error ("Error clearing stopping_tracepoint variable"
- " in lib");
- }
+ 0))
+ {
+ internal_error ("Error clearing stopping_tracepoint variable"
+ " in lib");
+ }
if (write_inferior_integer (ipa_sym_addrs.addr_trace_buffer_is_full, 0))
- {
- internal_error ("Error clearing trace_buffer_is_full variable"
- " in lib");
- }
+ {
+ internal_error ("Error clearing trace_buffer_is_full variable"
+ " in lib");
+ }
stop_tracing_bkpt = set_breakpoint_at (ipa_sym_addrs.addr_stop_tracing,
- stop_tracing_handler);
+ stop_tracing_handler);
if (stop_tracing_bkpt == NULL)
- error ("Error setting stop_tracing breakpoint");
+ error ("Error setting stop_tracing breakpoint");
flush_trace_buffer_bkpt
- = set_breakpoint_at (ipa_sym_addrs.addr_flush_trace_buffer,
- flush_trace_buffer_handler);
+ = set_breakpoint_at (ipa_sym_addrs.addr_flush_trace_buffer,
+ flush_trace_buffer_handler);
if (flush_trace_buffer_bkpt == NULL)
- error ("Error setting flush_trace_buffer breakpoint");
+ error ("Error setting flush_trace_buffer breakpoint");
}
target_unpause_all (true);
@@ -3422,9 +3418,9 @@ stop_tracing (void)
if (agent_loaded_p ())
{
if (write_inferior_integer (ipa_sym_addrs.addr_tracing, 0))
- {
- internal_error ("Error clearing tracing variable in lib");
- }
+ {
+ internal_error ("Error clearing tracing variable in lib");
+ }
}
tracing_stop_time = get_timestamp ();
@@ -3433,9 +3429,9 @@ stop_tracing (void)
if (stopping_tracepoint)
{
trace_debug ("Stopping the trace because "
- "tracepoint %d was hit %" PRIu64 " times",
- stopping_tracepoint->number,
- stopping_tracepoint->pass_count);
+ "tracepoint %d was hit %" PRIu64 " times",
+ stopping_tracepoint->number,
+ stopping_tracepoint->pass_count);
tracing_stop_reason = "tpasscount";
tracing_stop_tpnum = stopping_tracepoint->number;
}
@@ -3559,7 +3555,7 @@ cmd_qtframe (char *own_buf)
++packet;
unpack_varlen_hex (packet, &hi);
trace_debug ("Want to find next traceframe in the range 0x%s to 0x%s",
- paddress (lo), paddress (hi));
+ paddress (lo), paddress (hi));
tframe = find_next_traceframe_in_range (lo, hi, 1, &tfnum);
}
else if (startswith (packet, "outside:"))
@@ -3569,8 +3565,8 @@ cmd_qtframe (char *own_buf)
++packet;
unpack_varlen_hex (packet, &hi);
trace_debug ("Want to find next traceframe "
- "outside the range 0x%s to 0x%s",
- paddress (lo), paddress (hi));
+ "outside the range 0x%s to 0x%s",
+ paddress (lo), paddress (hi));
tframe = find_next_traceframe_in_range (lo, hi, 0, &tfnum);
}
else if (startswith (packet, "tdp:"))
@@ -3586,12 +3582,12 @@ cmd_qtframe (char *own_buf)
unpack_varlen_hex (packet, &frame);
tfnum = (int) frame;
if (tfnum == -1)
- {
- trace_debug ("Want to stop looking at traceframes");
- cs.current_traceframe = -1;
- write_ok (own_buf);
- return;
- }
+ {
+ trace_debug ("Want to stop looking at traceframes");
+ cs.current_traceframe = -1;
+ write_ok (own_buf);
+ return;
+ }
trace_debug ("Want to look at traceframe %d", tfnum);
tframe = find_traceframe (tfnum);
}
@@ -3631,8 +3627,8 @@ cmd_qtstatus (char *packet)
buf3 = (char *) alloca (slen * 2 + 1);
bin2hex ((gdb_byte *) str, buf3, slen);
- trace_debug ("Returning trace status as %d, stop reason %s",
- tracing, tracing_stop_reason);
+ trace_debug ("Returning trace status as %d, stop reason %s", tracing,
+ tracing_stop_reason);
if (agent_loaded_p ())
{
@@ -3641,7 +3637,7 @@ cmd_qtstatus (char *packet)
upload_fast_traceframes ();
target_unpause_all (true);
- }
+ }
stop_reason_rsp = (char *) tracing_stop_reason;
@@ -3657,7 +3653,7 @@ cmd_qtstatus (char *packet)
result_name = stop_reason_rsp + strlen ("terror:");
hexstr_len = strlen (result_name) * 2;
p = stop_reason_rsp
- = (char *) alloca (strlen ("terror:") + hexstr_len + 1);
+ = (char *) alloca (strlen ("terror:") + hexstr_len + 1);
strcpy (p, "terror:");
p += strlen (p);
bin2hex ((gdb_byte *) result_name, p, strlen (result_name));
@@ -3666,29 +3662,28 @@ cmd_qtstatus (char *packet)
/* If this was a forced stop, include any stop note that was supplied. */
if (strcmp (stop_reason_rsp, "tstop") == 0)
{
- stop_reason_rsp = (char *) alloca (strlen ("tstop:") + strlen (buf3) + 1);
+ stop_reason_rsp
+ = (char *) alloca (strlen ("tstop:") + strlen (buf3) + 1);
strcpy (stop_reason_rsp, "tstop:");
strcat (stop_reason_rsp, buf3);
}
sprintf (packet,
- "T%d;"
- "%s:%x;"
- "tframes:%x;tcreated:%x;"
- "tfree:%x;tsize:%s;"
- "circular:%d;"
- "disconn:%d;"
- "starttime:%s;stoptime:%s;"
- "username:%s;notes:%s:",
- tracing ? 1 : 0,
- stop_reason_rsp, tracing_stop_tpnum,
- traceframe_count, traceframes_created,
- free_space (), phex_nz (trace_buffer_hi - trace_buffer_lo, 0),
- circular_trace_buffer,
- disconnected_tracing,
- phex_nz (tracing_start_time, sizeof (tracing_start_time)),
- phex_nz (tracing_stop_time, sizeof (tracing_stop_time)),
- buf1, buf2);
+ "T%d;"
+ "%s:%x;"
+ "tframes:%x;tcreated:%x;"
+ "tfree:%x;tsize:%s;"
+ "circular:%d;"
+ "disconn:%d;"
+ "starttime:%s;stoptime:%s;"
+ "username:%s;notes:%s:",
+ tracing ? 1 : 0, stop_reason_rsp, tracing_stop_tpnum,
+ traceframe_count, traceframes_created, free_space (),
+ phex_nz (trace_buffer_hi - trace_buffer_lo, 0),
+ circular_trace_buffer, disconnected_tracing,
+ phex_nz (tracing_start_time, sizeof (tracing_start_time)),
+ phex_nz (tracing_stop_time, sizeof (tracing_stop_time)), buf1,
+ buf2);
}
static void
@@ -3710,13 +3705,13 @@ cmd_qtp (char *own_buf)
if (!tpoint)
{
trace_debug ("Tracepoint error: tracepoint %d at 0x%s not found",
- (int) num, paddress (addr));
+ (int) num, paddress (addr));
write_enn (own_buf);
return;
}
sprintf (own_buf, "V%" PRIu64 ":%" PRIu64 "", tpoint->hit_count,
- tpoint->traceframe_usage);
+ tpoint->traceframe_usage);
}
/* State variables to help return all the tracepoint bits. */
@@ -3735,9 +3730,8 @@ response_tracepoint (char *packet, struct tracepoint *tpoint)
char *buf;
sprintf (packet, "T%x:%s:%c:%" PRIx64 ":%" PRIx64, tpoint->number,
- paddress (tpoint->address),
- (tpoint->enabled ? 'E' : 'D'), tpoint->step_count,
- tpoint->pass_count);
+ paddress (tpoint->address), (tpoint->enabled ? 'E' : 'D'),
+ tpoint->step_count, tpoint->pass_count);
if (tpoint->type == fast_tracepoint)
sprintf (packet + strlen (packet), ":F%x", tpoint->orig_size);
else if (tpoint->type == static_tracepoint)
@@ -3746,8 +3740,7 @@ response_tracepoint (char *packet, struct tracepoint *tpoint)
if (tpoint->cond)
{
buf = gdb_unparse_agent_expr (tpoint->cond);
- sprintf (packet + strlen (packet), ":X%x,%s",
- tpoint->cond->length, buf);
+ sprintf (packet + strlen (packet), ":X%x,%s", tpoint->cond->length, buf);
free (buf);
}
}
@@ -3759,20 +3752,19 @@ response_tracepoint (char *packet, struct tracepoint *tpoint)
per-packet. */
static void
-response_action (char *packet, struct tracepoint *tpoint,
- char *taction, int step)
+response_action (char *packet, struct tracepoint *tpoint, char *taction,
+ int step)
{
- sprintf (packet, "%c%x:%s:%s",
- (step ? 'S' : 'A'), tpoint->number, paddress (tpoint->address),
- taction);
+ sprintf (packet, "%c%x:%s:%s", (step ? 'S' : 'A'), tpoint->number,
+ paddress (tpoint->address), taction);
}
/* Compose a response that is an imitation of the syntax by which the
tracepoint source piece was originally downloaded. */
static void
-response_source (char *packet,
- struct tracepoint *tpoint, struct source_string *src)
+response_source (char *packet, struct tracepoint *tpoint,
+ struct source_string *src)
{
char *buf;
int len;
@@ -3781,9 +3773,8 @@ response_source (char *packet,
buf = (char *) alloca (len * 2 + 1);
bin2hex ((gdb_byte *) src->str, buf, len);
- sprintf (packet, "Z%x:%s:%s:%x:%x:%s",
- tpoint->number, paddress (tpoint->address),
- src->type, 0, len, buf);
+ sprintf (packet, "Z%x:%s:%s:%x:%x:%s", tpoint->number,
+ paddress (tpoint->address), src->type, 0, len, buf);
}
/* Return the first piece of tracepoint definition, and initialize the
@@ -3823,24 +3814,23 @@ cmd_qtsp (char *packet)
}
else if (cur_action < cur_tpoint->numactions)
{
- response_action (packet, cur_tpoint,
- cur_tpoint->actions_str[cur_action], 0);
+ response_action (packet, cur_tpoint, cur_tpoint->actions_str[cur_action],
+ 0);
++cur_action;
}
else if (cur_step_action < cur_tpoint->num_step_actions)
{
response_action (packet, cur_tpoint,
- cur_tpoint->step_actions_str[cur_step_action], 1);
+ cur_tpoint->step_actions_str[cur_step_action], 1);
++cur_step_action;
}
- else if ((cur_source_string
- ? cur_source_string->next
- : cur_tpoint->source_strings))
+ else if ((cur_source_string ? cur_source_string->next
+ : cur_tpoint->source_strings))
{
if (cur_source_string)
- cur_source_string = cur_source_string->next;
+ cur_source_string = cur_source_string->next;
else
- cur_source_string = cur_tpoint->source_strings;
+ cur_source_string = cur_tpoint->source_strings;
response_source (packet, cur_tpoint, cur_source_string);
}
else
@@ -3849,9 +3839,9 @@ cmd_qtsp (char *packet)
cur_action = cur_step_action = 0;
cur_source_string = NULL;
if (cur_tpoint)
- response_tracepoint (packet, cur_tpoint);
+ response_tracepoint (packet, cur_tpoint);
else
- strcpy (packet, "l");
+ strcpy (packet, "l");
}
}
@@ -3872,7 +3862,7 @@ response_tsv (char *packet, struct trace_state_variable *tsv)
}
sprintf (packet, "%x:%s:%x:%s", tsv->number, phex_nz (tsv->initial_value, 0),
- tsv->getter ? 1 : 0, buf);
+ tsv->getter ? 1 : 0, buf);
}
/* Return the first trace state variable definition, and initialize
@@ -3902,9 +3892,9 @@ cmd_qtsv (char *packet)
{
cur_tsv = cur_tsv->next;
if (cur_tsv)
- response_tsv (packet, cur_tsv);
+ response_tsv (packet, cur_tsv);
else
- strcpy (packet, "l");
+ strcpy (packet, "l");
}
else
strcpy (packet, "l");
@@ -3993,8 +3983,8 @@ cmd_qtbuffer (char *own_buf)
++packet; /* skip a comma */
unpack_varlen_hex (packet, &num);
- trace_debug ("Want to get trace buffer, %d bytes at offset 0x%s",
- (int) num, phex_nz (offset, 0));
+ trace_debug ("Want to get trace buffer, %d bytes at offset 0x%s", (int) num,
+ phex_nz (offset, 0));
tot = (trace_buffer_hi - trace_buffer_lo) - free_space ();
@@ -4023,7 +4013,7 @@ cmd_qtbuffer (char *own_buf)
num = tot - offset;
/* Trim to available packet size. */
- if (num >= (PBUFSIZ - 16) / 2 )
+ if (num >= (PBUFSIZ - 16) / 2)
num = (PBUFSIZ - 16) / 2;
bin2hex (tbp, own_buf, num);
@@ -4040,7 +4030,7 @@ cmd_bigqtbuffer_circular (char *own_buf)
unpack_varlen_hex (packet, &val);
circular_trace_buffer = val;
trace_debug ("Trace buffer is now %s",
- circular_trace_buffer ? "circular" : "linear");
+ circular_trace_buffer ? "circular" : "linear");
write_ok (own_buf);
}
@@ -4070,8 +4060,7 @@ cmd_bigqtbuffer_size (char *own_buf)
}
init_trace_buffer (sval);
- trace_debug ("Trace buffer is now %s bytes",
- plongest (trace_buffer_size));
+ trace_debug ("Trace buffer is now %s bytes", plongest (trace_buffer_size));
write_ok (own_buf);
}
@@ -4087,49 +4076,49 @@ cmd_qtnotes (char *own_buf)
while (*packet)
{
if (startswith (packet, "user:"))
- {
- packet += strlen ("user:");
- saved = packet;
- packet = strchr (packet, ';');
- nbytes = (packet - saved) / 2;
- user = (char *) xmalloc (nbytes + 1);
- nbytes = hex2bin (saved, (gdb_byte *) user, nbytes);
- user[nbytes] = '\0';
- ++packet; /* skip the semicolon */
- trace_debug ("User is '%s'", user);
- xfree (tracing_user_name);
- tracing_user_name = user;
- }
+ {
+ packet += strlen ("user:");
+ saved = packet;
+ packet = strchr (packet, ';');
+ nbytes = (packet - saved) / 2;
+ user = (char *) xmalloc (nbytes + 1);
+ nbytes = hex2bin (saved, (gdb_byte *) user, nbytes);
+ user[nbytes] = '\0';
+ ++packet; /* skip the semicolon */
+ trace_debug ("User is '%s'", user);
+ xfree (tracing_user_name);
+ tracing_user_name = user;
+ }
else if (startswith (packet, "notes:"))
- {
- packet += strlen ("notes:");
- saved = packet;
- packet = strchr (packet, ';');
- nbytes = (packet - saved) / 2;
- notes = (char *) xmalloc (nbytes + 1);
- nbytes = hex2bin (saved, (gdb_byte *) notes, nbytes);
- notes[nbytes] = '\0';
- ++packet; /* skip the semicolon */
- trace_debug ("Notes is '%s'", notes);
- xfree (tracing_notes);
- tracing_notes = notes;
- }
+ {
+ packet += strlen ("notes:");
+ saved = packet;
+ packet = strchr (packet, ';');
+ nbytes = (packet - saved) / 2;
+ notes = (char *) xmalloc (nbytes + 1);
+ nbytes = hex2bin (saved, (gdb_byte *) notes, nbytes);
+ notes[nbytes] = '\0';
+ ++packet; /* skip the semicolon */
+ trace_debug ("Notes is '%s'", notes);
+ xfree (tracing_notes);
+ tracing_notes = notes;
+ }
else if (startswith (packet, "tstop:"))
- {
- packet += strlen ("tstop:");
- saved = packet;
- packet = strchr (packet, ';');
- nbytes = (packet - saved) / 2;
- stopnote = (char *) xmalloc (nbytes + 1);
- nbytes = hex2bin (saved, (gdb_byte *) stopnote, nbytes);
- stopnote[nbytes] = '\0';
- ++packet; /* skip the semicolon */
- trace_debug ("tstop note is '%s'", stopnote);
- xfree (tracing_stop_note);
- tracing_stop_note = stopnote;
- }
+ {
+ packet += strlen ("tstop:");
+ saved = packet;
+ packet = strchr (packet, ';');
+ nbytes = (packet - saved) / 2;
+ stopnote = (char *) xmalloc (nbytes + 1);
+ nbytes = hex2bin (saved, (gdb_byte *) stopnote, nbytes);
+ stopnote[nbytes] = '\0';
+ ++packet; /* skip the semicolon */
+ trace_debug ("tstop note is '%s'", stopnote);
+ xfree (tracing_stop_note);
+ tracing_stop_note = stopnote;
+ }
else
- break;
+ break;
}
write_ok (own_buf);
@@ -4302,8 +4291,8 @@ handle_tracepoint_query (char *packet)
action covering the whole range. */
static void
-add_while_stepping_state (struct thread_info *tinfo,
- int tp_number, CORE_ADDR tp_address)
+add_while_stepping_state (struct thread_info *tinfo, int tp_number,
+ CORE_ADDR tp_address)
{
struct wstep_state *wstep = XNEW (struct wstep_state);
@@ -4378,8 +4367,8 @@ tracepoint_finished_step (struct thread_info *tinfo, CORE_ADDR stop_pc)
wstep_link = &tinfo->while_stepping;
trace_debug ("Thread %s finished a single-step for tracepoint %d at 0x%s",
- target_pid_to_str (tinfo->id).c_str (),
- wstep->tp_number, paddress (wstep->tp_address));
+ target_pid_to_str (tinfo->id).c_str (), wstep->tp_number,
+ paddress (wstep->tp_address));
ctx.base.type = trap_tracepoint;
ctx.regcache = get_thread_regcache (tinfo, 1);
@@ -4388,59 +4377,57 @@ tracepoint_finished_step (struct thread_info *tinfo, CORE_ADDR stop_pc)
{
tpoint = find_tracepoint (wstep->tp_number, wstep->tp_address);
if (tpoint == NULL)
- {
- trace_debug ("NO TRACEPOINT %d at 0x%s FOR THREAD %s!",
- wstep->tp_number, paddress (wstep->tp_address),
- target_pid_to_str (tinfo->id).c_str ());
-
- /* Unlink. */
- *wstep_link = wstep->next;
- release_while_stepping_state (wstep);
- wstep = *wstep_link;
- continue;
- }
+ {
+ trace_debug ("NO TRACEPOINT %d at 0x%s FOR THREAD %s!",
+ wstep->tp_number, paddress (wstep->tp_address),
+ target_pid_to_str (tinfo->id).c_str ());
+
+ /* Unlink. */
+ *wstep_link = wstep->next;
+ release_while_stepping_state (wstep);
+ wstep = *wstep_link;
+ continue;
+ }
/* We've just finished one step. */
++wstep->current_step;
/* Collect data. */
- collect_data_at_step ((struct tracepoint_hit_ctx *) &ctx,
- stop_pc, tpoint, wstep->current_step);
+ collect_data_at_step ((struct tracepoint_hit_ctx *) &ctx, stop_pc,
+ tpoint, wstep->current_step);
if (wstep->current_step >= tpoint->step_count)
- {
- /* The requested numbers of steps have occurred. */
- trace_debug ("Thread %s done stepping for tracepoint %d at 0x%s",
- target_pid_to_str (tinfo->id).c_str (),
- wstep->tp_number, paddress (wstep->tp_address));
-
- /* Unlink the wstep. */
- *wstep_link = wstep->next;
- release_while_stepping_state (wstep);
- wstep = *wstep_link;
-
- /* Only check the hit count now, which ensure that we do all
+ {
+ /* The requested numbers of steps have occurred. */
+ trace_debug ("Thread %s done stepping for tracepoint %d at 0x%s",
+ target_pid_to_str (tinfo->id).c_str (),
+ wstep->tp_number, paddress (wstep->tp_address));
+
+ /* Unlink the wstep. */
+ *wstep_link = wstep->next;
+ release_while_stepping_state (wstep);
+ wstep = *wstep_link;
+
+ /* Only check the hit count now, which ensure that we do all
our stepping before stopping the run. */
- if (tpoint->pass_count > 0
- && tpoint->hit_count >= tpoint->pass_count
- && stopping_tracepoint == NULL)
- stopping_tracepoint = tpoint;
- }
+ if (tpoint->pass_count > 0 && tpoint->hit_count >= tpoint->pass_count
+ && stopping_tracepoint == NULL)
+ stopping_tracepoint = tpoint;
+ }
else
- {
- /* Keep single-stepping until the requested numbers of steps
+ {
+ /* Keep single-stepping until the requested numbers of steps
have occurred. */
- wstep_link = &wstep->next;
- wstep = *wstep_link;
- }
+ wstep_link = &wstep->next;
+ wstep = *wstep_link;
+ }
- if (stopping_tracepoint
- || trace_buffer_is_full
- || expr_eval_result != expr_eval_no_error)
- {
- stop_tracing ();
- break;
- }
+ if (stopping_tracepoint || trace_buffer_is_full
+ || expr_eval_result != expr_eval_no_error)
+ {
+ stop_tracing ();
+ break;
+ }
}
return 1;
@@ -4473,49 +4460,48 @@ handle_tracepoint_bkpts (struct thread_info *tinfo, CORE_ADDR stop_pc)
trace_debug ("lib stopped at stop_tracing");
read_inferior_integer (ipa_sym_addrs.addr_trace_buffer_is_full,
- &ipa_trace_buffer_is_full);
+ &ipa_trace_buffer_is_full);
read_inferior_data_pointer (ipa_sym_addrs.addr_stopping_tracepoint,
- &ipa_stopping_tracepoint);
+ &ipa_stopping_tracepoint);
write_inferior_data_pointer (ipa_sym_addrs.addr_stopping_tracepoint, 0);
read_inferior_data_pointer (ipa_sym_addrs.addr_error_tracepoint,
- &ipa_error_tracepoint);
+ &ipa_error_tracepoint);
write_inferior_data_pointer (ipa_sym_addrs.addr_error_tracepoint, 0);
read_inferior_integer (ipa_sym_addrs.addr_expr_eval_result,
- &ipa_expr_eval_result);
+ &ipa_expr_eval_result);
write_inferior_integer (ipa_sym_addrs.addr_expr_eval_result, 0);
trace_debug ("lib: trace_buffer_is_full: %d, "
- "stopping_tracepoint: %s, "
- "ipa_expr_eval_result: %d, "
- "error_tracepoint: %s, ",
- ipa_trace_buffer_is_full,
- paddress (ipa_stopping_tracepoint),
- ipa_expr_eval_result,
- paddress (ipa_error_tracepoint));
+ "stopping_tracepoint: %s, "
+ "ipa_expr_eval_result: %d, "
+ "error_tracepoint: %s, ",
+ ipa_trace_buffer_is_full,
+ paddress (ipa_stopping_tracepoint), ipa_expr_eval_result,
+ paddress (ipa_error_tracepoint));
if (ipa_trace_buffer_is_full)
- trace_debug ("lib stopped due to full buffer.");
+ trace_debug ("lib stopped due to full buffer.");
if (ipa_stopping_tracepoint)
- trace_debug ("lib stopped due to tpoint");
+ trace_debug ("lib stopped due to tpoint");
if (ipa_error_tracepoint)
- trace_debug ("lib stopped due to error");
+ trace_debug ("lib stopped due to error");
if (ipa_stopping_tracepoint != 0)
- {
- stopping_tracepoint
- = fast_tracepoint_from_ipa_tpoint_address (ipa_stopping_tracepoint);
- }
+ {
+ stopping_tracepoint = fast_tracepoint_from_ipa_tpoint_address (
+ ipa_stopping_tracepoint);
+ }
else if (ipa_expr_eval_result != expr_eval_no_error)
- {
- expr_eval_result = ipa_expr_eval_result;
- error_tracepoint
- = fast_tracepoint_from_ipa_tpoint_address (ipa_error_tracepoint);
- }
+ {
+ expr_eval_result = ipa_expr_eval_result;
+ error_tracepoint
+ = fast_tracepoint_from_ipa_tpoint_address (ipa_error_tracepoint);
+ }
stop_tracing ();
return 1;
}
@@ -4554,36 +4540,35 @@ tracepoint_was_hit (struct thread_info *tinfo, CORE_ADDR stop_pc)
and probes will be executed in program. So static tracepoints
are collected there. */
if (tpoint->enabled && stop_pc == tpoint->address
- && tpoint->type != static_tracepoint)
- {
- trace_debug ("Thread %s at address of tracepoint %d at 0x%s",
- target_pid_to_str (tinfo->id).c_str (),
- tpoint->number, paddress (tpoint->address));
-
- /* Test the condition if present, and collect if true. */
- if (!tpoint->cond
- || (condition_true_at_tracepoint
- ((struct tracepoint_hit_ctx *) &ctx, tpoint)))
- collect_data_at_tracepoint ((struct tracepoint_hit_ctx *) &ctx,
- stop_pc, tpoint);
-
- if (stopping_tracepoint
- || trace_buffer_is_full
- || expr_eval_result != expr_eval_no_error)
- {
- stop_tracing ();
- }
- /* If the tracepoint had a 'while-stepping' action, then set
+ && tpoint->type != static_tracepoint)
+ {
+ trace_debug ("Thread %s at address of tracepoint %d at 0x%s",
+ target_pid_to_str (tinfo->id).c_str (), tpoint->number,
+ paddress (tpoint->address));
+
+ /* Test the condition if present, and collect if true. */
+ if (!tpoint->cond
+ || (condition_true_at_tracepoint (
+ (struct tracepoint_hit_ctx *) &ctx, tpoint)))
+ collect_data_at_tracepoint ((struct tracepoint_hit_ctx *) &ctx,
+ stop_pc, tpoint);
+
+ if (stopping_tracepoint || trace_buffer_is_full
+ || expr_eval_result != expr_eval_no_error)
+ {
+ stop_tracing ();
+ }
+ /* If the tracepoint had a 'while-stepping' action, then set
the thread to collect this tracepoint on the following
single-steps. */
- else if (tpoint->step_count > 0)
- {
- add_while_stepping_state (tinfo,
- tpoint->number, tpoint->address);
- }
+ else if (tpoint->step_count > 0)
+ {
+ add_while_stepping_state (tinfo, tpoint->number,
+ tpoint->address);
+ }
- ret = 1;
- }
+ ret = 1;
+ }
}
return ret;
@@ -4594,7 +4579,7 @@ tracepoint_was_hit (struct thread_info *tinfo, CORE_ADDR stop_pc)
#if defined IN_PROCESS_AGENT && defined HAVE_UST
struct ust_marker_data;
static void collect_ust_data_at_tracepoint (struct tracepoint_hit_ctx *ctx,
- struct traceframe *tframe);
+ struct traceframe *tframe);
#endif
/* Create a trace frame for the hit of the given tracepoint in the
@@ -4602,7 +4587,7 @@ static void collect_ust_data_at_tracepoint (struct tracepoint_hit_ctx *ctx,
static void
collect_data_at_tracepoint (struct tracepoint_hit_ctx *ctx, CORE_ADDR stop_pc,
- struct tracepoint *tpoint)
+ struct tracepoint *tpoint)
{
struct traceframe *tframe;
int acti;
@@ -4614,30 +4599,28 @@ collect_data_at_tracepoint (struct tracepoint_hit_ctx *ctx, CORE_ADDR stop_pc,
later, and finish the collection for this hit. This test is only
for nonstepping tracepoints, stepping tracepoints test at the end
of their while-stepping loop. */
- if (tpoint->pass_count > 0
- && tpoint->hit_count >= tpoint->pass_count
- && tpoint->step_count == 0
- && stopping_tracepoint == NULL)
+ if (tpoint->pass_count > 0 && tpoint->hit_count >= tpoint->pass_count
+ && tpoint->step_count == 0 && stopping_tracepoint == NULL)
stopping_tracepoint = tpoint;
trace_debug ("Making new traceframe for tracepoint %d at 0x%s, hit %" PRIu64,
- tpoint->number, paddress (tpoint->address), tpoint->hit_count);
+ tpoint->number, paddress (tpoint->address), tpoint->hit_count);
tframe = add_traceframe (tpoint);
if (tframe)
{
for (acti = 0; acti < tpoint->numactions; ++acti)
- {
+ {
#ifndef IN_PROCESS_AGENT
- trace_debug ("Tracepoint %d at 0x%s about to do action '%s'",
- tpoint->number, paddress (tpoint->address),
- tpoint->actions_str[acti]);
+ trace_debug ("Tracepoint %d at 0x%s about to do action '%s'",
+ tpoint->number, paddress (tpoint->address),
+ tpoint->actions_str[acti]);
#endif
- do_action_at_tracepoint (ctx, stop_pc, tpoint, tframe,
- tpoint->actions[acti]);
- }
+ do_action_at_tracepoint (ctx, stop_pc, tpoint, tframe,
+ tpoint->actions[acti]);
+ }
finish_traceframe (tframe);
}
@@ -4649,32 +4632,30 @@ collect_data_at_tracepoint (struct tracepoint_hit_ctx *ctx, CORE_ADDR stop_pc,
#ifndef IN_PROCESS_AGENT
static void
-collect_data_at_step (struct tracepoint_hit_ctx *ctx,
- CORE_ADDR stop_pc,
- struct tracepoint *tpoint, int current_step)
+collect_data_at_step (struct tracepoint_hit_ctx *ctx, CORE_ADDR stop_pc,
+ struct tracepoint *tpoint, int current_step)
{
struct traceframe *tframe;
int acti;
trace_debug ("Making new step traceframe for "
- "tracepoint %d at 0x%s, step %d of %" PRIu64 ", hit %" PRIu64,
- tpoint->number, paddress (tpoint->address),
- current_step, tpoint->step_count,
- tpoint->hit_count);
+ "tracepoint %d at 0x%s, step %d of %" PRIu64 ", hit %" PRIu64,
+ tpoint->number, paddress (tpoint->address), current_step,
+ tpoint->step_count, tpoint->hit_count);
tframe = add_traceframe (tpoint);
if (tframe)
{
for (acti = 0; acti < tpoint->num_step_actions; ++acti)
- {
- trace_debug ("Tracepoint %d at 0x%s about to do step action '%s'",
- tpoint->number, paddress (tpoint->address),
- tpoint->step_actions_str[acti]);
+ {
+ trace_debug ("Tracepoint %d at 0x%s about to do step action '%s'",
+ tpoint->number, paddress (tpoint->address),
+ tpoint->step_actions_str[acti]);
- do_action_at_tracepoint (ctx, stop_pc, tpoint, tframe,
- tpoint->step_actions[acti]);
- }
+ do_action_at_tracepoint (ctx, stop_pc, tpoint, tframe,
+ tpoint->step_actions[acti]);
+ }
finish_traceframe (tframe);
}
@@ -4704,32 +4685,32 @@ get_context_regcache (struct tracepoint_hit_ctx *ctx)
{
struct fast_tracepoint_ctx *fctx = (struct fast_tracepoint_ctx *) ctx;
if (!fctx->regcache_initted)
- {
- fctx->regcache_initted = 1;
- init_register_cache (&fctx->regcache, ipa_tdesc, fctx->regspace);
- supply_regblock (&fctx->regcache, NULL);
- supply_fast_tracepoint_registers (&fctx->regcache, fctx->regs);
- }
+ {
+ fctx->regcache_initted = 1;
+ init_register_cache (&fctx->regcache, ipa_tdesc, fctx->regspace);
+ supply_regblock (&fctx->regcache, NULL);
+ supply_fast_tracepoint_registers (&fctx->regcache, fctx->regs);
+ }
regcache = &fctx->regcache;
}
#ifdef HAVE_UST
if (ctx->type == static_tracepoint)
{
struct static_tracepoint_ctx *sctx
- = (struct static_tracepoint_ctx *) ctx;
+ = (struct static_tracepoint_ctx *) ctx;
if (!sctx->regcache_initted)
- {
- sctx->regcache_initted = 1;
- init_register_cache (&sctx->regcache, ipa_tdesc, sctx->regspace);
- supply_regblock (&sctx->regcache, NULL);
- /* Pass down the tracepoint address, because REGS doesn't
+ {
+ sctx->regcache_initted = 1;
+ init_register_cache (&sctx->regcache, ipa_tdesc, sctx->regspace);
+ supply_regblock (&sctx->regcache, NULL);
+ /* Pass down the tracepoint address, because REGS doesn't
include the PC, but we know what it must have been. */
- supply_static_tracepoint_registers (&sctx->regcache,
- (const unsigned char *)
- sctx->regs,
- sctx->tpoint->address);
- }
+ supply_static_tracepoint_registers (&sctx->regcache,
+ (const unsigned char *)
+ sctx->regs,
+ sctx->tpoint->address);
+ }
regcache = &sctx->regcache;
}
#endif
@@ -4747,11 +4728,9 @@ get_context_regcache (struct tracepoint_hit_ctx *ctx)
}
static void
-do_action_at_tracepoint (struct tracepoint_hit_ctx *ctx,
- CORE_ADDR stop_pc,
- struct tracepoint *tpoint,
- struct traceframe *tframe,
- struct tracepoint_action *taction)
+do_action_at_tracepoint (struct tracepoint_hit_ctx *ctx, CORE_ADDR stop_pc,
+ struct tracepoint *tpoint, struct traceframe *tframe,
+ struct tracepoint_action *taction)
{
enum eval_result_type err;
@@ -4759,54 +4738,54 @@ do_action_at_tracepoint (struct tracepoint_hit_ctx *ctx,
{
case 'M':
{
- struct collect_memory_action *maction;
- struct eval_agent_expr_context ax_ctx;
-
- maction = (struct collect_memory_action *) taction;
- ax_ctx.regcache = NULL;
- ax_ctx.tframe = tframe;
- ax_ctx.tpoint = tpoint;
-
- trace_debug ("Want to collect %s bytes at 0x%s (basereg %d)",
- pulongest (maction->len),
- paddress (maction->addr), maction->basereg);
- /* (should use basereg) */
- agent_mem_read (&ax_ctx, NULL, (CORE_ADDR) maction->addr,
- maction->len);
- break;
+ struct collect_memory_action *maction;
+ struct eval_agent_expr_context ax_ctx;
+
+ maction = (struct collect_memory_action *) taction;
+ ax_ctx.regcache = NULL;
+ ax_ctx.tframe = tframe;
+ ax_ctx.tpoint = tpoint;
+
+ trace_debug ("Want to collect %s bytes at 0x%s (basereg %d)",
+ pulongest (maction->len), paddress (maction->addr),
+ maction->basereg);
+ /* (should use basereg) */
+ agent_mem_read (&ax_ctx, NULL, (CORE_ADDR) maction->addr,
+ maction->len);
+ break;
}
case 'R':
{
- unsigned char *regspace;
- struct regcache tregcache;
- struct regcache *context_regcache;
- int regcache_size;
-
- trace_debug ("Want to collect registers");
-
- context_regcache = get_context_regcache (ctx);
- regcache_size = register_cache_size (context_regcache->tdesc);
-
- /* Collect all registers for now. */
- regspace = add_traceframe_block (tframe, tpoint, 1 + regcache_size);
- if (regspace == NULL)
- {
- trace_debug ("Trace buffer block allocation failed, skipping");
- break;
- }
- /* Identify a register block. */
- *regspace = 'R';
-
- /* Wrap the regblock in a register cache (in the stack, we
+ unsigned char *regspace;
+ struct regcache tregcache;
+ struct regcache *context_regcache;
+ int regcache_size;
+
+ trace_debug ("Want to collect registers");
+
+ context_regcache = get_context_regcache (ctx);
+ regcache_size = register_cache_size (context_regcache->tdesc);
+
+ /* Collect all registers for now. */
+ regspace = add_traceframe_block (tframe, tpoint, 1 + regcache_size);
+ if (regspace == NULL)
+ {
+ trace_debug ("Trace buffer block allocation failed, skipping");
+ break;
+ }
+ /* Identify a register block. */
+ *regspace = 'R';
+
+ /* Wrap the regblock in a register cache (in the stack, we
don't want to malloc here). */
- init_register_cache (&tregcache, context_regcache->tdesc,
- regspace + 1);
+ init_register_cache (&tregcache, context_regcache->tdesc,
+ regspace + 1);
- /* Copy the register data to the regblock. */
- regcache_cpy (&tregcache, context_regcache);
+ /* Copy the register data to the regblock. */
+ regcache_cpy (&tregcache, context_regcache);
#ifndef IN_PROCESS_AGENT
- /* On some platforms, trap-based tracepoints will have the PC
+ /* On some platforms, trap-based tracepoints will have the PC
pointing to the next instruction after the trap, but we
don't want the user or GDB trying to guess whether the
saved PC needs adjusting; so always record the adjusted
@@ -4816,44 +4795,43 @@ do_action_at_tracepoint (struct tracepoint_hit_ctx *ctx,
in-process lib (but not if GDBserver is collecting one
preemptively), since the PC had already been adjusted to
contain the tracepoint's address by the jump pad. */
- trace_debug ("Storing stop pc (0x%s) in regblock",
- paddress (stop_pc));
+ trace_debug ("Storing stop pc (0x%s) in regblock", paddress (stop_pc));
- /* This changes the regblock, not the thread's
+ /* This changes the regblock, not the thread's
regcache. */
- regcache_write_pc (&tregcache, stop_pc);
+ regcache_write_pc (&tregcache, stop_pc);
#endif
}
break;
case 'X':
{
- struct eval_expr_action *eaction;
- struct eval_agent_expr_context ax_ctx;
+ struct eval_expr_action *eaction;
+ struct eval_agent_expr_context ax_ctx;
- eaction = (struct eval_expr_action *) taction;
- ax_ctx.regcache = get_context_regcache (ctx);
- ax_ctx.tframe = tframe;
- ax_ctx.tpoint = tpoint;
+ eaction = (struct eval_expr_action *) taction;
+ ax_ctx.regcache = get_context_regcache (ctx);
+ ax_ctx.tframe = tframe;
+ ax_ctx.tpoint = tpoint;
- trace_debug ("Want to evaluate expression");
+ trace_debug ("Want to evaluate expression");
- err = gdb_eval_agent_expr (&ax_ctx, eaction->expr, NULL);
+ err = gdb_eval_agent_expr (&ax_ctx, eaction->expr, NULL);
- if (err != expr_eval_no_error)
- {
- record_tracepoint_error (tpoint, "action expression", err);
- return;
- }
+ if (err != expr_eval_no_error)
+ {
+ record_tracepoint_error (tpoint, "action expression", err);
+ return;
+ }
}
break;
case 'L':
{
#if defined IN_PROCESS_AGENT && defined HAVE_UST
- trace_debug ("Want to collect static trace data");
- collect_ust_data_at_tracepoint (ctx, tframe);
+ trace_debug ("Want to collect static trace data");
+ collect_ust_data_at_tracepoint (ctx, tframe);
#else
- trace_debug ("warning: collecting static trace data, "
- "but static tracepoints are not supported");
+ trace_debug ("warning: collecting static trace data, "
+ "but static tracepoints are not supported");
#endif
}
break;
@@ -4865,7 +4843,7 @@ do_action_at_tracepoint (struct tracepoint_hit_ctx *ctx,
static int
condition_true_at_tracepoint (struct tracepoint_hit_ctx *ctx,
- struct tracepoint *tpoint)
+ struct tracepoint *tpoint)
{
ULONGEST value = 0;
enum eval_result_type err;
@@ -4888,7 +4866,8 @@ condition_true_at_tracepoint (struct tracepoint_hit_ctx *ctx,
if (tpoint->compiled_cond)
{
struct fast_tracepoint_ctx *fctx = (struct fast_tracepoint_ctx *) ctx;
- err = ((condfn) (uintptr_t) (tpoint->compiled_cond)) (fctx->regs, &value);
+ err
+ = ((condfn) (uintptr_t) (tpoint->compiled_cond)) (fctx->regs, &value);
}
else
#endif
@@ -4908,9 +4887,8 @@ condition_true_at_tracepoint (struct tracepoint_hit_ctx *ctx,
return 0;
}
- trace_debug ("Tracepoint %d at 0x%s condition evals to %s",
- tpoint->number, paddress (tpoint->address),
- pulongest (value));
+ trace_debug ("Tracepoint %d at 0x%s condition evals to %s", tpoint->number,
+ paddress (tpoint->address), pulongest (value));
return (value ? 1 : 0);
}
@@ -4918,8 +4896,8 @@ condition_true_at_tracepoint (struct tracepoint_hit_ctx *ctx,
/* Do the recording of memory blocks for actions and bytecodes. */
int
-agent_mem_read (struct eval_agent_expr_context *ctx,
- unsigned char *to, CORE_ADDR from, ULONGEST len)
+agent_mem_read (struct eval_agent_expr_context *ctx, unsigned char *to,
+ CORE_ADDR from, ULONGEST len)
{
unsigned char *mspace;
ULONGEST remaining = len;
@@ -4941,7 +4919,7 @@ agent_mem_read (struct eval_agent_expr_context *ctx,
sp = 1 + sizeof (from) + sizeof (blocklen) + blocklen;
mspace = add_traceframe_block (ctx->tframe, ctx->tpoint, sp);
if (mspace == NULL)
- return 1;
+ return 1;
/* Identify block as a memory block. */
*mspace = 'M';
++mspace;
@@ -4960,8 +4938,8 @@ agent_mem_read (struct eval_agent_expr_context *ctx,
}
int
-agent_mem_read_string (struct eval_agent_expr_context *ctx,
- unsigned char *to, CORE_ADDR from, ULONGEST len)
+agent_mem_read_string (struct eval_agent_expr_context *ctx, unsigned char *to,
+ CORE_ADDR from, ULONGEST len)
{
unsigned char *buf, *mspace;
ULONGEST remaining = len;
@@ -4980,28 +4958,28 @@ agent_mem_read_string (struct eval_agent_expr_context *ctx,
harder to wrap correctly for the circular case, etc). */
buf = (unsigned char *) xmalloc (blocklen + 1);
for (i = 0; i < blocklen; ++i)
- {
- /* Read the string one byte at a time, in case the string is
+ {
+ /* Read the string one byte at a time, in case the string is
at the end of a valid memory area - we don't want a
correctly-terminated string to engender segvio
complaints. */
- read_inferior_memory (from + i, buf + i, 1);
-
- if (buf[i] == '\0')
- {
- blocklen = i + 1;
- /* Make sure outer loop stops now too. */
- remaining = blocklen;
- break;
- }
- }
+ read_inferior_memory (from + i, buf + i, 1);
+
+ if (buf[i] == '\0')
+ {
+ blocklen = i + 1;
+ /* Make sure outer loop stops now too. */
+ remaining = blocklen;
+ break;
+ }
+ }
sp = 1 + sizeof (from) + sizeof (blocklen) + blocklen;
mspace = add_traceframe_block (ctx->tframe, ctx->tpoint, sp);
if (mspace == NULL)
- {
- xfree (buf);
- return 1;
- }
+ {
+ xfree (buf);
+ return 1;
+ }
/* Identify block as a memory block. */
*mspace = 'M';
++mspace;
@@ -5028,7 +5006,7 @@ agent_tsv_read (struct eval_agent_expr_context *ctx, int n)
LONGEST val;
vspace = add_traceframe_block (ctx->tframe, ctx->tpoint,
- 1 + sizeof (n) + sizeof (LONGEST));
+ 1 + sizeof (n) + sizeof (LONGEST));
if (vspace == NULL)
return 1;
/* Identify block as a variable. */
@@ -5066,11 +5044,10 @@ match_blocktype (char blocktype, unsigned char *dataptr, void *data)
static unsigned char *
traceframe_walk_blocks (unsigned char *database, unsigned int datasize,
- int tfnum,
- int (*callback) (char blocktype,
- unsigned char *dataptr,
- void *data),
- void *data)
+ int tfnum,
+ int (*callback) (char blocktype,
+ unsigned char *dataptr, void *data),
+ void *data)
{
unsigned char *dataptr;
@@ -5082,52 +5059,51 @@ traceframe_walk_blocks (unsigned char *database, unsigned int datasize,
/* Iterate through a traceframe's blocks, looking for a block of the
requested type. */
- for (dataptr = database;
- dataptr < database + datasize;
+ for (dataptr = database; dataptr < database + datasize;
/* nothing */)
{
char blocktype;
unsigned short mlen;
if (dataptr == trace_buffer_wrap)
- {
- /* Adjust to reflect wrapping part of the frame around to
+ {
+ /* Adjust to reflect wrapping part of the frame around to
the beginning. */
- datasize = dataptr - database;
- dataptr = database = trace_buffer_lo;
- }
+ datasize = dataptr - database;
+ dataptr = database = trace_buffer_lo;
+ }
blocktype = *dataptr++;
if ((*callback) (blocktype, dataptr, data))
- return dataptr;
+ return dataptr;
switch (blocktype)
- {
- case 'R':
- /* Skip over the registers block. */
- dataptr += current_target_desc ()->registers_size;
- break;
- case 'M':
- /* Skip over the memory block. */
- dataptr += sizeof (CORE_ADDR);
- memcpy (&mlen, dataptr, sizeof (mlen));
- dataptr += (sizeof (mlen) + mlen);
- break;
- case 'V':
- /* Skip over the TSV block. */
- dataptr += (sizeof (int) + sizeof (LONGEST));
- break;
- case 'S':
- /* Skip over the static trace data block. */
- memcpy (&mlen, dataptr, sizeof (mlen));
- dataptr += (sizeof (mlen) + mlen);
- break;
- default:
- trace_debug ("traceframe %d has unknown block type 0x%x",
- tfnum, blocktype);
- return NULL;
- }
+ {
+ case 'R':
+ /* Skip over the registers block. */
+ dataptr += current_target_desc ()->registers_size;
+ break;
+ case 'M':
+ /* Skip over the memory block. */
+ dataptr += sizeof (CORE_ADDR);
+ memcpy (&mlen, dataptr, sizeof (mlen));
+ dataptr += (sizeof (mlen) + mlen);
+ break;
+ case 'V':
+ /* Skip over the TSV block. */
+ dataptr += (sizeof (int) + sizeof (LONGEST));
+ break;
+ case 'S':
+ /* Skip over the static trace data block. */
+ memcpy (&mlen, dataptr, sizeof (mlen));
+ dataptr += (sizeof (mlen) + mlen);
+ break;
+ default:
+ trace_debug ("traceframe %d has unknown block type 0x%x", tfnum,
+ blocktype);
+ return NULL;
+ }
}
return NULL;
@@ -5139,10 +5115,10 @@ traceframe_walk_blocks (unsigned char *database, unsigned int datasize,
static unsigned char *
traceframe_find_block_type (unsigned char *database, unsigned int datasize,
- int tfnum, char type_wanted)
+ int tfnum, char type_wanted)
{
- return traceframe_walk_blocks (database, datasize, tfnum,
- match_blocktype, &type_wanted);
+ return traceframe_walk_blocks (database, datasize, tfnum, match_blocktype,
+ &type_wanted);
}
static unsigned char *
@@ -5150,9 +5126,8 @@ traceframe_find_regblock (struct traceframe *tframe, int tfnum)
{
unsigned char *regblock;
- regblock = traceframe_find_block_type (tframe->data,
- tframe->data_size,
- tfnum, 'R');
+ regblock
+ = traceframe_find_block_type (tframe->data, tframe->data_size, tfnum, 'R');
if (regblock == NULL)
trace_debug ("traceframe %d has no register data", tfnum);
@@ -5188,7 +5163,7 @@ fetch_traceframe_registers (int tfnum, struct regcache *regcache, int regnum)
tracepoints. */
tpoint = find_next_tracepoint_by_number (NULL, tframe->tpnum);
if (tpoint != NULL)
- regcache_write_pc (regcache, tpoint->address);
+ regcache_write_pc (regcache, tpoint->address);
}
else
supply_regblock (regcache, dataptr);
@@ -5214,9 +5189,8 @@ traceframe_get_pc (struct traceframe *tframe)
/* Read a requested block of memory from a trace frame. */
int
-traceframe_read_mem (int tfnum, CORE_ADDR addr,
- unsigned char *buf, ULONGEST length,
- ULONGEST *nbytes)
+traceframe_read_mem (int tfnum, CORE_ADDR addr, unsigned char *buf,
+ ULONGEST length, ULONGEST *nbytes)
{
struct traceframe *tframe;
unsigned char *database, *dataptr;
@@ -5238,38 +5212,39 @@ traceframe_read_mem (int tfnum, CORE_ADDR addr,
database = dataptr = &tframe->data[0];
/* Iterate through a traceframe's blocks, looking for memory. */
- while ((dataptr = traceframe_find_block_type (dataptr,
- datasize
- - (dataptr - database),
- tfnum, 'M')) != NULL)
+ while (
+ (dataptr
+ = traceframe_find_block_type (dataptr, datasize - (dataptr - database),
+ tfnum, 'M'))
+ != NULL)
{
memcpy (&maddr, dataptr, sizeof (maddr));
dataptr += sizeof (maddr);
memcpy (&mlen, dataptr, sizeof (mlen));
dataptr += sizeof (mlen);
- trace_debug ("traceframe %d has %d bytes at %s",
- tfnum, mlen, paddress (maddr));
+ trace_debug ("traceframe %d has %d bytes at %s", tfnum, mlen,
+ paddress (maddr));
/* If the block includes the first part of the desired range,
return as much it has; GDB will re-request the remainder,
which might be in a different block of this trace frame. */
if (maddr <= addr && addr < (maddr + mlen))
- {
- ULONGEST amt = (maddr + mlen) - addr;
- if (amt > length)
- amt = length;
+ {
+ ULONGEST amt = (maddr + mlen) - addr;
+ if (amt > length)
+ amt = length;
- memcpy (buf, dataptr + (addr - maddr), amt);
- *nbytes = amt;
- return 0;
- }
+ memcpy (buf, dataptr + (addr - maddr), amt);
+ *nbytes = amt;
+ return 0;
+ }
/* Skip over this block. */
dataptr += mlen;
}
trace_debug ("traceframe %d has no memory data for the desired region",
- tfnum);
+ tfnum);
*nbytes = 0;
return 0;
@@ -5309,10 +5284,11 @@ traceframe_read_tsv (int tsvnum, LONGEST *val)
/* Iterate through a traceframe's blocks, looking for the last
matched tsv. */
- while ((dataptr = traceframe_find_block_type (dataptr,
- datasize
- - (dataptr - database),
- tfnum, 'V')) != NULL)
+ while (
+ (dataptr
+ = traceframe_find_block_type (dataptr, datasize - (dataptr - database),
+ tfnum, 'V'))
+ != NULL)
{
memcpy (&vnum, dataptr, sizeof (vnum));
dataptr += sizeof (vnum);
@@ -5321,18 +5297,17 @@ traceframe_read_tsv (int tsvnum, LONGEST *val)
/* Check that this is the variable we want. */
if (tsvnum == vnum)
- {
- memcpy (val, dataptr, sizeof (*val));
- found = 1;
- }
+ {
+ memcpy (val, dataptr, sizeof (*val));
+ found = 1;
+ }
/* Skip over this block. */
dataptr += sizeof (LONGEST);
}
if (!found)
- trace_debug ("traceframe %d has no data for variable %d",
- tfnum, tsvnum);
+ trace_debug ("traceframe %d has no data for variable %d", tfnum, tsvnum);
return !found;
}
@@ -5340,9 +5315,8 @@ traceframe_read_tsv (int tsvnum, LONGEST *val)
frame. */
int
-traceframe_read_sdata (int tfnum, ULONGEST offset,
- unsigned char *buf, ULONGEST length,
- ULONGEST *nbytes)
+traceframe_read_sdata (int tfnum, ULONGEST offset, unsigned char *buf,
+ ULONGEST length, ULONGEST *nbytes)
{
struct traceframe *tframe;
unsigned char *database, *dataptr;
@@ -5364,22 +5338,21 @@ traceframe_read_sdata (int tfnum, ULONGEST offset,
/* Iterate through a traceframe's blocks, looking for static
tracepoint data. */
- dataptr = traceframe_find_block_type (database, datasize,
- tfnum, 'S');
+ dataptr = traceframe_find_block_type (database, datasize, tfnum, 'S');
if (dataptr != NULL)
{
memcpy (&mlen, dataptr, sizeof (mlen));
dataptr += sizeof (mlen);
if (offset < mlen)
- {
- if (offset + length > mlen)
- length = mlen - offset;
+ {
+ if (offset + length > mlen)
+ length = mlen - offset;
- memcpy (buf, dataptr, length);
- *nbytes = length;
- }
+ memcpy (buf, dataptr, length);
+ *nbytes = length;
+ }
else
- *nbytes = 0;
+ *nbytes = 0;
return 0;
}
@@ -5402,35 +5375,35 @@ build_traceframe_info_xml (char blocktype, unsigned char *dataptr, void *data)
{
case 'M':
{
- unsigned short mlen;
- CORE_ADDR maddr;
-
- memcpy (&maddr, dataptr, sizeof (maddr));
- dataptr += sizeof (maddr);
- memcpy (&mlen, dataptr, sizeof (mlen));
- dataptr += sizeof (mlen);
- buffer_xml_printf (buffer,
- "<memory start=\"0x%s\" length=\"0x%s\"/>\n",
- paddress (maddr), phex_nz (mlen, sizeof (mlen)));
- break;
+ unsigned short mlen;
+ CORE_ADDR maddr;
+
+ memcpy (&maddr, dataptr, sizeof (maddr));
+ dataptr += sizeof (maddr);
+ memcpy (&mlen, dataptr, sizeof (mlen));
+ dataptr += sizeof (mlen);
+ buffer_xml_printf (buffer,
+ "<memory start=\"0x%s\" length=\"0x%s\"/>\n",
+ paddress (maddr), phex_nz (mlen, sizeof (mlen)));
+ break;
}
case 'V':
{
- int vnum;
+ int vnum;
- memcpy (&vnum, dataptr, sizeof (vnum));
- buffer_xml_printf (buffer, "<tvar id=\"%d\"/>\n", vnum);
- break;
+ memcpy (&vnum, dataptr, sizeof (vnum));
+ buffer_xml_printf (buffer, "<tvar id=\"%d\"/>\n", vnum);
+ break;
}
case 'R':
case 'S':
{
- break;
+ break;
}
default:
warning ("Unhandled trace block type (%d) '%c ' "
- "while building trace frame info.",
- blocktype, blocktype);
+ "while building trace frame info.",
+ blocktype, blocktype);
break;
}
@@ -5456,8 +5429,8 @@ traceframe_read_info (int tfnum, struct buffer *buffer)
}
buffer_grow_str (buffer, "<traceframe-info>\n");
- traceframe_walk_blocks (tframe->data, tframe->data_size,
- tfnum, build_traceframe_info_xml, buffer);
+ traceframe_walk_blocks (tframe->data, tframe->data_size, tfnum,
+ build_traceframe_info_xml, buffer);
buffer_grow_str0 (buffer, "</traceframe-info>\n");
return 0;
}
@@ -5472,7 +5445,7 @@ fast_tracepoint_from_jump_pad_address (CORE_ADDR pc)
for (tpoint = tracepoints; tpoint; tpoint = tpoint->next)
if (tpoint->type == fast_tracepoint)
if (tpoint->jump_pad <= pc && pc < tpoint->jump_pad_end)
- return tpoint;
+ return tpoint;
return NULL;
}
@@ -5486,9 +5459,9 @@ fast_tracepoint_from_trampoline_address (CORE_ADDR pc)
for (tpoint = tracepoints; tpoint; tpoint = tpoint->next)
{
- if (tpoint->type == fast_tracepoint
- && tpoint->trampoline <= pc && pc < tpoint->trampoline_end)
- return tpoint;
+ if (tpoint->type == fast_tracepoint && tpoint->trampoline <= pc
+ && pc < tpoint->trampoline_end)
+ return tpoint;
}
return NULL;
@@ -5506,7 +5479,7 @@ fast_tracepoint_from_ipa_tpoint_address (CORE_ADDR ipa_tpoint_obj)
for (tpoint = tracepoints; tpoint; tpoint = tpoint->next)
if (tpoint->type == fast_tracepoint)
if (tpoint->obj_addr_on_target == ipa_tpoint_obj)
- return tpoint;
+ return tpoint;
return NULL;
}
@@ -5550,9 +5523,8 @@ force_unlock_trace_buffer (void)
single-step it until this function returns 0. */
fast_tpoint_collect_result
-fast_tracepoint_collecting (CORE_ADDR thread_area,
- CORE_ADDR stop_pc,
- struct fast_tpoint_collect_status *status)
+fast_tracepoint_collecting (CORE_ADDR thread_area, CORE_ADDR stop_pc,
+ struct fast_tpoint_collect_status *status)
{
CORE_ADDR ipa_collecting;
CORE_ADDR ipa_gdb_jump_pad_buffer, ipa_gdb_jump_pad_buffer_end;
@@ -5584,29 +5556,29 @@ fast_tracepoint_collecting (CORE_ADDR thread_area,
in the jump pad. Single-step the thread until it leaves the
jump pad. */
- again:
+again:
tpoint = NULL;
needs_breakpoint = 0;
trace_debug ("fast_tracepoint_collecting");
if (read_inferior_data_pointer (ipa_sym_addrs.addr_gdb_jump_pad_buffer,
- &ipa_gdb_jump_pad_buffer))
+ &ipa_gdb_jump_pad_buffer))
{
internal_error ("error extracting `gdb_jump_pad_buffer'");
}
if (read_inferior_data_pointer (ipa_sym_addrs.addr_gdb_jump_pad_buffer_end,
- &ipa_gdb_jump_pad_buffer_end))
+ &ipa_gdb_jump_pad_buffer_end))
{
internal_error ("error extracting `gdb_jump_pad_buffer_end'");
}
if (read_inferior_data_pointer (ipa_sym_addrs.addr_gdb_trampoline_buffer,
- &ipa_gdb_trampoline_buffer))
+ &ipa_gdb_trampoline_buffer))
{
internal_error ("error extracting `gdb_trampoline_buffer'");
}
if (read_inferior_data_pointer (ipa_sym_addrs.addr_gdb_trampoline_buffer_end,
- &ipa_gdb_trampoline_buffer_end))
+ &ipa_gdb_trampoline_buffer_end))
{
internal_error ("error extracting `gdb_trampoline_buffer_end'");
}
@@ -5618,45 +5590,44 @@ fast_tracepoint_collecting (CORE_ADDR thread_area,
matching the jump pad address back to the tracepoint. */
tpoint = fast_tracepoint_from_jump_pad_address (stop_pc);
if (tpoint == NULL)
- {
- warning ("in jump pad, but no matching tpoint?");
- return fast_tpoint_collect_result::not_collecting;
- }
+ {
+ warning ("in jump pad, but no matching tpoint?");
+ return fast_tpoint_collect_result::not_collecting;
+ }
else
- {
- trace_debug ("in jump pad of tpoint (%d, %s); jump_pad(%s, %s); "
- "adj_insn(%s, %s)",
- tpoint->number, paddress (tpoint->address),
- paddress (tpoint->jump_pad),
- paddress (tpoint->jump_pad_end),
- paddress (tpoint->adjusted_insn_addr),
- paddress (tpoint->adjusted_insn_addr_end));
- }
+ {
+ trace_debug ("in jump pad of tpoint (%d, %s); jump_pad(%s, %s); "
+ "adj_insn(%s, %s)",
+ tpoint->number, paddress (tpoint->address),
+ paddress (tpoint->jump_pad),
+ paddress (tpoint->jump_pad_end),
+ paddress (tpoint->adjusted_insn_addr),
+ paddress (tpoint->adjusted_insn_addr_end));
+ }
/* Definitely in the jump pad. May or may not need
fast-exit-jump-pad breakpoint. */
- if (tpoint->jump_pad <= stop_pc
- && stop_pc < tpoint->adjusted_insn_addr)
- needs_breakpoint = 1;
+ if (tpoint->jump_pad <= stop_pc && stop_pc < tpoint->adjusted_insn_addr)
+ needs_breakpoint = 1;
}
else if (ipa_gdb_trampoline_buffer <= stop_pc
- && stop_pc < ipa_gdb_trampoline_buffer_end)
+ && stop_pc < ipa_gdb_trampoline_buffer_end)
{
/* We can tell which tracepoint(s) the thread is collecting by
matching the trampoline address back to the tracepoint. */
tpoint = fast_tracepoint_from_trampoline_address (stop_pc);
if (tpoint == NULL)
- {
- warning ("in trampoline, but no matching tpoint?");
- return fast_tpoint_collect_result::not_collecting;
- }
+ {
+ warning ("in trampoline, but no matching tpoint?");
+ return fast_tpoint_collect_result::not_collecting;
+ }
else
- {
- trace_debug ("in trampoline of tpoint (%d, %s); trampoline(%s, %s)",
- tpoint->number, paddress (tpoint->address),
- paddress (tpoint->trampoline),
- paddress (tpoint->trampoline_end));
- }
+ {
+ trace_debug ("in trampoline of tpoint (%d, %s); trampoline(%s, %s)",
+ tpoint->number, paddress (tpoint->address),
+ paddress (tpoint->trampoline),
+ paddress (tpoint->trampoline_end));
+ }
/* Have not reached jump pad yet, but treat the trampoline as a
part of the jump pad that is before the adjusted original
@@ -5672,42 +5643,43 @@ fast_tracepoint_collecting (CORE_ADDR thread_area,
lock to find out. */
if (read_inferior_data_pointer (ipa_sym_addrs.addr_collecting,
- &ipa_collecting))
- {
- trace_debug ("fast_tracepoint_collecting:"
- " failed reading 'collecting' in the inferior");
- return fast_tpoint_collect_result::not_collecting;
- }
+ &ipa_collecting))
+ {
+ trace_debug ("fast_tracepoint_collecting:"
+ " failed reading 'collecting' in the inferior");
+ return fast_tpoint_collect_result::not_collecting;
+ }
if (!ipa_collecting)
- {
- trace_debug ("fast_tracepoint_collecting: not collecting"
- " (and nobody is).");
- return fast_tpoint_collect_result::not_collecting;
- }
+ {
+ trace_debug ("fast_tracepoint_collecting: not collecting"
+ " (and nobody is).");
+ return fast_tpoint_collect_result::not_collecting;
+ }
/* Some thread is collecting. Check which. */
if (read_inferior_memory (ipa_collecting,
- (unsigned char *) &ipa_collecting_obj,
- sizeof (ipa_collecting_obj)) != 0)
- goto again;
+ (unsigned char *) &ipa_collecting_obj,
+ sizeof (ipa_collecting_obj))
+ != 0)
+ goto again;
if (ipa_collecting_obj.thread_area != thread_area)
- {
- trace_debug ("fast_tracepoint_collecting: not collecting "
- "(another thread is)");
- return fast_tpoint_collect_result::not_collecting;
- }
+ {
+ trace_debug ("fast_tracepoint_collecting: not collecting "
+ "(another thread is)");
+ return fast_tpoint_collect_result::not_collecting;
+ }
tpoint
- = fast_tracepoint_from_ipa_tpoint_address (ipa_collecting_obj.tpoint);
+ = fast_tracepoint_from_ipa_tpoint_address (ipa_collecting_obj.tpoint);
if (tpoint == NULL)
- {
- warning ("fast_tracepoint_collecting: collecting, "
- "but tpoint %s not found?",
- paddress ((CORE_ADDR) ipa_collecting_obj.tpoint));
- return fast_tpoint_collect_result::not_collecting;
- }
+ {
+ warning ("fast_tracepoint_collecting: collecting, "
+ "but tpoint %s not found?",
+ paddress ((CORE_ADDR) ipa_collecting_obj.tpoint));
+ return fast_tpoint_collect_result::not_collecting;
+ }
/* The thread is within `gdb_collect', skip over the rest of
fast tracepoint collection quickly using a breakpoint. */
@@ -5731,7 +5703,7 @@ fast_tracepoint_collecting (CORE_ADDR thread_area,
trace_debug ("\
fast_tracepoint_collecting, returning continue-until-break at %s",
- paddress (tpoint->adjusted_insn_addr));
+ paddress (tpoint->adjusted_insn_addr));
return fast_tpoint_collect_result::before_insn; /* continue */
}
@@ -5740,9 +5712,9 @@ fast_tracepoint_collecting, returning continue-until-break at %s",
/* Just single-step until exiting the jump pad. */
trace_debug ("fast_tracepoint_collecting, returning "
- "need-single-step (%s-%s)",
- paddress (tpoint->adjusted_insn_addr),
- paddress (tpoint->adjusted_insn_addr_end));
+ "need-single-step (%s-%s)",
+ paddress (tpoint->adjusted_insn_addr),
+ paddress (tpoint->adjusted_insn_addr_end));
return fast_tpoint_collect_result::at_insn; /* single-step */
}
@@ -5763,7 +5735,7 @@ EXTERN_C_POP
/* This is needed for -Wmissing-declarations. */
IP_AGENT_EXPORT_FUNC void gdb_collect (struct tracepoint *tpoint,
- unsigned char *regs);
+ unsigned char *regs);
/* This routine, called from the jump pad (in asm) is designed to be
called from the jump pads of fast tracepoints, thus it is on the
@@ -5797,44 +5769,43 @@ gdb_collect (struct tracepoint *tpoint, unsigned char *regs)
ctx.tpoint = ctx.tpoint->next)
{
if (!ctx.tpoint->enabled)
- continue;
+ continue;
/* Multiple tracepoints of different types, such as fast tracepoint and
static tracepoint, can be set at the same address. */
if (ctx.tpoint->type != tpoint->type)
- continue;
+ continue;
/* Test the condition if present, and collect if true. */
if (ctx.tpoint->cond == NULL
- || condition_true_at_tracepoint ((struct tracepoint_hit_ctx *) &ctx,
- ctx.tpoint))
- {
- collect_data_at_tracepoint ((struct tracepoint_hit_ctx *) &ctx,
- ctx.tpoint->address, ctx.tpoint);
+ || condition_true_at_tracepoint ((struct tracepoint_hit_ctx *) &ctx,
+ ctx.tpoint))
+ {
+ collect_data_at_tracepoint ((struct tracepoint_hit_ctx *) &ctx,
+ ctx.tpoint->address, ctx.tpoint);
- /* Note that this will cause original insns to be written back
+ /* Note that this will cause original insns to be written back
to where we jumped from, but that's OK because we're jumping
back to the next whole instruction. This will go badly if
instruction restoration is not atomic though. */
- if (stopping_tracepoint
- || trace_buffer_is_full
- || expr_eval_result != expr_eval_no_error)
- {
- stop_tracing ();
- break;
- }
- }
+ if (stopping_tracepoint || trace_buffer_is_full
+ || expr_eval_result != expr_eval_no_error)
+ {
+ stop_tracing ();
+ break;
+ }
+ }
else
- {
- /* If there was a condition and it evaluated to false, the only
+ {
+ /* If there was a condition and it evaluated to false, the only
way we would stop tracing is if there was an error during
condition expression evaluation. */
- if (expr_eval_result != expr_eval_no_error)
- {
- stop_tracing ();
- break;
- }
- }
+ if (expr_eval_result != expr_eval_no_error)
+ {
+ stop_tracing ();
+ break;
+ }
+ }
}
}
@@ -5852,9 +5823,11 @@ EXTERN_C_PUSH
IP_AGENT_EXPORT_VAR gdb_collect_ptr_type gdb_collect_ptr = gdb_collect;
IP_AGENT_EXPORT_VAR get_raw_reg_ptr_type get_raw_reg_ptr = get_raw_reg;
IP_AGENT_EXPORT_VAR get_trace_state_variable_value_ptr_type
- get_trace_state_variable_value_ptr = get_trace_state_variable_value;
+ get_trace_state_variable_value_ptr
+ = get_trace_state_variable_value;
IP_AGENT_EXPORT_VAR set_trace_state_variable_value_ptr_type
- set_trace_state_variable_value_ptr = set_trace_state_variable_value;
+ set_trace_state_variable_value_ptr
+ = set_trace_state_variable_value;
EXTERN_C_POP
#endif
@@ -5878,7 +5851,7 @@ get_get_tsv_func_addr (void)
{
CORE_ADDR res;
if (read_inferior_data_pointer (
- ipa_sym_addrs.addr_get_trace_state_variable_value_ptr, &res))
+ ipa_sym_addrs.addr_get_trace_state_variable_value_ptr, &res))
{
error ("error extracting get_trace_state_variable_value_ptr");
return 0;
@@ -5891,7 +5864,7 @@ get_set_tsv_func_addr (void)
{
CORE_ADDR res;
if (read_inferior_data_pointer (
- ipa_sym_addrs.addr_set_trace_state_variable_value_ptr, &res))
+ ipa_sym_addrs.addr_set_trace_state_variable_value_ptr, &res))
{
error ("error extracting set_trace_state_variable_value_ptr");
return 0;
@@ -5900,14 +5873,13 @@ get_set_tsv_func_addr (void)
}
static void
-compile_tracepoint_condition (struct tracepoint *tpoint,
- CORE_ADDR *jump_entry)
+compile_tracepoint_condition (struct tracepoint *tpoint, CORE_ADDR *jump_entry)
{
CORE_ADDR entry_point = *jump_entry;
enum eval_result_type err;
trace_debug ("Starting condition compilation for tracepoint %d\n",
- tpoint->number);
+ tpoint->number);
/* Initialize the global pointer to the code being built. */
current_insn_ptr = *jump_entry;
@@ -5924,7 +5896,7 @@ compile_tracepoint_condition (struct tracepoint *tpoint,
tpoint->compiled_cond = entry_point;
trace_debug ("Condition compilation for tracepoint %d complete\n",
- tpoint->number);
+ tpoint->number);
}
else
{
@@ -5933,8 +5905,8 @@ compile_tracepoint_condition (struct tracepoint *tpoint,
tpoint->compiled_cond = 0;
trace_debug ("Condition compilation for tracepoint %d failed, "
- "error code %d",
- tpoint->number, err);
+ "error code %d",
+ tpoint->number, err);
}
/* Update the code pointer passed in. Note that we do this even if
@@ -5965,10 +5937,10 @@ target_malloc (ULONGEST size)
{
/* We have the pointer *address*, need what it points to. */
if (read_inferior_data_pointer (ipa_sym_addrs.addr_gdb_tp_heap_buffer,
- &target_tp_heap))
- {
- internal_error ("couldn't get target heap head pointer");
- }
+ &target_tp_heap))
+ {
+ internal_error ("couldn't get target heap head pointer");
+ }
}
ptr = target_tp_heap;
@@ -5991,14 +5963,14 @@ download_agent_expr (struct agent_expr *expr)
expr_bytes = target_malloc (expr->length);
write_inferior_data_pointer (expr_addr + offsetof (struct agent_expr, bytes),
- expr_bytes);
+ expr_bytes);
target_write_memory (expr_bytes, expr->bytes, expr->length);
return expr_addr;
}
/* Align V up to N bits. */
-#define UALIGN(V, N) (((V) + ((N) - 1)) & ~((N) - 1))
+#define UALIGN(V, N) (((V) + ((N) -1)) & ~((N) -1))
/* Sync tracepoint with IPA, but leave maintenance of linked list to caller. */
@@ -6009,7 +5981,7 @@ download_tracepoint_1 (struct tracepoint *tpoint)
CORE_ADDR tpptr = 0;
gdb_assert (tpoint->type == fast_tracepoint
- || tpoint->type == static_tracepoint);
+ || tpoint->type == static_tracepoint);
if (tpoint->cond != NULL && target_emit_ops () != NULL)
{
@@ -6018,14 +5990,14 @@ download_tracepoint_1 (struct tracepoint *tpoint)
jentry = jump_entry = get_jump_space_head ();
if (tpoint->cond != NULL)
- {
- /* Pad to 8-byte alignment. (needed?) */
- /* Actually this should be left for the target to
+ {
+ /* Pad to 8-byte alignment. (needed?) */
+ /* Actually this should be left for the target to
decide. */
- jentry = UALIGN (jentry, 8);
+ jentry = UALIGN (jentry, 8);
- compile_tracepoint_condition (tpoint, &jentry);
- }
+ compile_tracepoint_condition (tpoint, &jentry);
+ }
/* Pad to 8-byte alignment. */
jentry = UALIGN (jentry, 8);
@@ -6046,12 +6018,11 @@ download_tracepoint_1 (struct tracepoint *tpoint)
target_tracepoint.hit_count = 0;
target_write_memory (tpptr, (unsigned char *) &target_tracepoint,
- sizeof (target_tracepoint));
+ sizeof (target_tracepoint));
if (tpoint->cond)
- write_inferior_data_pointer (tpptr
- + offsetof (struct tracepoint, cond),
- download_agent_expr (tpoint->cond));
+ write_inferior_data_pointer (tpptr + offsetof (struct tracepoint, cond),
+ download_agent_expr (tpoint->cond));
if (tpoint->numactions)
{
@@ -6060,22 +6031,22 @@ download_tracepoint_1 (struct tracepoint *tpoint)
/* The pointers array. */
actions_array
- = target_malloc (sizeof (*tpoint->actions) * tpoint->numactions);
- write_inferior_data_pointer (tpptr + offsetof (struct tracepoint,
- actions),
- actions_array);
+ = target_malloc (sizeof (*tpoint->actions) * tpoint->numactions);
+ write_inferior_data_pointer (tpptr
+ + offsetof (struct tracepoint, actions),
+ actions_array);
/* Now for each pointer, download the action. */
for (i = 0; i < tpoint->numactions; i++)
- {
- struct tracepoint_action *action = tpoint->actions[i];
- CORE_ADDR ipa_action = tracepoint_action_download (action);
+ {
+ struct tracepoint_action *action = tpoint->actions[i];
+ CORE_ADDR ipa_action = tracepoint_action_download (action);
- if (ipa_action != 0)
- write_inferior_data_pointer (actions_array
- + i * sizeof (*tpoint->actions),
- ipa_action);
- }
+ if (ipa_action != 0)
+ write_inferior_data_pointer (actions_array
+ + i * sizeof (*tpoint->actions),
+ ipa_action);
+ }
}
}
@@ -6140,17 +6111,17 @@ tracepoint_send_agent (struct tracepoint *tpoint)
/* The value of tracepoint's target address is stored in BUF. */
memcpy (&tpoint->obj_addr_on_target,
- &buf[IPA_PROTO_FAST_TRACE_ADDR_ON_TARGET], 8);
+ &buf[IPA_PROTO_FAST_TRACE_ADDR_ON_TARGET], 8);
if (tpoint->type == fast_tracepoint)
{
unsigned char *insn
- = (unsigned char *) &buf[IPA_PROTO_FAST_TRACE_FJUMP_INSN];
+ = (unsigned char *) &buf[IPA_PROTO_FAST_TRACE_FJUMP_INSN];
int fjump_size;
- trace_debug ("agent: read from cmd_buf 0x%x 0x%x\n",
- (unsigned int) tpoint->obj_addr_on_target,
- (unsigned int) gdb_jump_pad_head);
+ trace_debug ("agent: read from cmd_buf 0x%x 0x%x\n",
+ (unsigned int) tpoint->obj_addr_on_target,
+ (unsigned int) gdb_jump_pad_head);
memcpy (&gdb_jump_pad_head, &buf[IPA_PROTO_FAST_TRACE_JUMP_PAD], 8);
@@ -6158,7 +6129,7 @@ tracepoint_send_agent (struct tracepoint *tpoint)
memcpy (&fjump_size, &buf[IPA_PROTO_FAST_TRACE_FJUMP_SIZE], 4);
/* Wire it in. */
tpoint->handle
- = set_fast_tracepoint_jump (tpoint->address, insn, fjump_size);
+ = set_fast_tracepoint_jump (tpoint->address, insn, fjump_size);
}
return 0;
@@ -6169,8 +6140,7 @@ download_tracepoint (struct tracepoint *tpoint)
{
struct tracepoint *tp, *tp_prev;
- if (tpoint->type != fast_tracepoint
- && tpoint->type != static_tracepoint)
+ if (tpoint->type != fast_tracepoint && tpoint->type != static_tracepoint)
return;
download_tracepoint_1 (tpoint);
@@ -6181,7 +6151,7 @@ download_tracepoint (struct tracepoint *tpoint)
for (tp = tracepoints; tp != tpoint; tp = tp->next)
{
if (tp->type == fast_tracepoint || tp->type == static_tracepoint)
- tp_prev = tp;
+ tp_prev = tp;
}
if (tp_prev)
@@ -6190,27 +6160,26 @@ download_tracepoint (struct tracepoint *tpoint)
/* Insert TPOINT after TP_PREV in IPA. */
if (read_inferior_data_pointer (tp_prev->obj_addr_on_target
- + offsetof (struct tracepoint, next),
- &tp_prev_target_next_addr))
- {
- internal_error ("error reading `tp_prev->next'");
- }
+ + offsetof (struct tracepoint, next),
+ &tp_prev_target_next_addr))
+ {
+ internal_error ("error reading `tp_prev->next'");
+ }
/* tpoint->next = tp_prev->next */
write_inferior_data_pointer (tpoint->obj_addr_on_target
- + offsetof (struct tracepoint, next),
- tp_prev_target_next_addr);
+ + offsetof (struct tracepoint, next),
+ tp_prev_target_next_addr);
/* tp_prev->next = tpoint */
write_inferior_data_pointer (tp_prev->obj_addr_on_target
- + offsetof (struct tracepoint, next),
- tpoint->obj_addr_on_target);
+ + offsetof (struct tracepoint, next),
+ tpoint->obj_addr_on_target);
}
else
/* First object in list, set the head pointer in the
inferior. */
write_inferior_data_pointer (ipa_sym_addrs.addr_tracepoints,
- tpoint->obj_addr_on_target);
-
+ tpoint->obj_addr_on_target);
}
static void
@@ -6229,7 +6198,7 @@ download_trace_state_variables (void)
/* TSV's with a getter have been initialized equally in both the
inferior and GDBserver. Skip them. */
if (tsv->getter != NULL)
- continue;
+ continue;
target_tsv = *tsv;
@@ -6237,39 +6206,34 @@ download_trace_state_variables (void)
ptr = target_malloc (sizeof (*tsv));
if (tsv == trace_state_variables)
- {
- /* First object in list, set the head pointer in the
+ {
+ /* First object in list, set the head pointer in the
inferior. */
- write_inferior_data_pointer (ipa_sym_addrs.addr_trace_state_variables,
- ptr);
- }
+ write_inferior_data_pointer (
+ ipa_sym_addrs.addr_trace_state_variables, ptr);
+ }
else
- {
- write_inferior_data_pointer (prev_ptr
- + offsetof (struct trace_state_variable,
- next),
- ptr);
- }
+ {
+ write_inferior_data_pointer (
+ prev_ptr + offsetof (struct trace_state_variable, next), ptr);
+ }
/* Write the whole object. We'll fix up its pointers in a bit.
Assume no next, fixup when needed. */
target_tsv.next = NULL;
target_write_memory (ptr, (unsigned char *) &target_tsv,
- sizeof (target_tsv));
+ sizeof (target_tsv));
if (tsv->name != NULL)
- {
- size_t size = strlen (tsv->name) + 1;
- CORE_ADDR name_addr = target_malloc (size);
- target_write_memory (name_addr,
- (unsigned char *) tsv->name, size);
- write_inferior_data_pointer (ptr
- + offsetof (struct trace_state_variable,
- name),
- name_addr);
- }
+ {
+ size_t size = strlen (tsv->name) + 1;
+ CORE_ADDR name_addr = target_malloc (size);
+ target_write_memory (name_addr, (unsigned char *) tsv->name, size);
+ write_inferior_data_pointer (
+ ptr + offsetof (struct trace_state_variable, name), name_addr);
+ }
gdb_assert (tsv->getter == NULL);
}
@@ -6278,8 +6242,9 @@ download_trace_state_variables (void)
{
/* Fixup the next pointer in the last item in the list. */
write_inferior_data_pointer (prev_ptr
- + offsetof (struct trace_state_variable,
- next), 0);
+ + offsetof (struct trace_state_variable,
+ next),
+ 0);
}
}
@@ -6305,7 +6270,7 @@ upload_fast_traceframes (void)
CORE_ADDR ipa_trace_buffer_hi;
if (read_inferior_uinteger (ipa_sym_addrs.addr_traceframe_read_count,
- &ipa_traceframe_read_count_racy))
+ &ipa_traceframe_read_count_racy))
{
/* This will happen in most targets if the current thread is
running. */
@@ -6313,24 +6278,24 @@ upload_fast_traceframes (void)
}
if (read_inferior_uinteger (ipa_sym_addrs.addr_traceframe_write_count,
- &ipa_traceframe_write_count_racy))
+ &ipa_traceframe_write_count_racy))
return;
trace_debug ("ipa_traceframe_count (racy area): %d (w=%d, r=%d)",
- ipa_traceframe_write_count_racy
- - ipa_traceframe_read_count_racy,
- ipa_traceframe_write_count_racy,
- ipa_traceframe_read_count_racy);
+ ipa_traceframe_write_count_racy
+ - ipa_traceframe_read_count_racy,
+ ipa_traceframe_write_count_racy,
+ ipa_traceframe_read_count_racy);
if (ipa_traceframe_write_count_racy == ipa_traceframe_read_count_racy)
return;
about_to_request_buffer_space_bkpt
= set_breakpoint_at (ipa_sym_addrs.addr_about_to_request_buffer_space,
- NULL);
+ NULL);
if (read_inferior_uinteger (ipa_sym_addrs.addr_trace_buffer_ctrl_curr,
- &ipa_trace_buffer_ctrl_curr))
+ &ipa_trace_buffer_ctrl_curr))
return;
ipa_trace_buffer_ctrl_curr_old = ipa_trace_buffer_ctrl_curr;
@@ -6346,18 +6311,15 @@ upload_fast_traceframes (void)
counter = (prev + 0x100) & GDBSERVER_FLUSH_COUNT_MASK_CURR;
ipa_trace_buffer_ctrl_curr = (GDBSERVER_UPDATED_FLUSH_COUNT_BIT
- | (prev << 12)
- | counter
- | curr_tbctrl_idx);
+ | (prev << 12) | counter | curr_tbctrl_idx);
}
if (write_inferior_uinteger (ipa_sym_addrs.addr_trace_buffer_ctrl_curr,
- ipa_trace_buffer_ctrl_curr))
+ ipa_trace_buffer_ctrl_curr))
return;
- trace_debug ("Lib: Committed %08x -> %08x",
- ipa_trace_buffer_ctrl_curr_old,
- ipa_trace_buffer_ctrl_curr);
+ trace_debug ("Lib: Committed %08x -> %08x", ipa_trace_buffer_ctrl_curr_old,
+ ipa_trace_buffer_ctrl_curr);
/* Re-read these, now that we've installed the
`about_to_request_buffer_space' breakpoint/lock. A thread could
@@ -6369,21 +6331,21 @@ upload_fast_traceframes (void)
nesting), which would break the IP agent's "effective" detection
(see trace_alloc_trace_buffer). */
if (read_inferior_uinteger (ipa_sym_addrs.addr_traceframe_read_count,
- &ipa_traceframe_read_count))
+ &ipa_traceframe_read_count))
return;
if (read_inferior_uinteger (ipa_sym_addrs.addr_traceframe_write_count,
- &ipa_traceframe_write_count))
+ &ipa_traceframe_write_count))
return;
if (debug_threads)
{
trace_debug ("ipa_traceframe_count (blocked area): %d (w=%d, r=%d)",
- ipa_traceframe_write_count - ipa_traceframe_read_count,
- ipa_traceframe_write_count, ipa_traceframe_read_count);
+ ipa_traceframe_write_count - ipa_traceframe_read_count,
+ ipa_traceframe_write_count, ipa_traceframe_read_count);
if (ipa_traceframe_write_count != ipa_traceframe_write_count_racy
- || ipa_traceframe_read_count != ipa_traceframe_read_count_racy)
- trace_debug ("note that ipa_traceframe_count's parts changed");
+ || ipa_traceframe_read_count != ipa_traceframe_read_count_racy)
+ trace_debug ("note that ipa_traceframe_count's parts changed");
}
/* Get the address of the current TBC object (the IP agent has an
@@ -6394,41 +6356,41 @@ upload_fast_traceframes (void)
+= sizeof (struct ipa_trace_buffer_control) * curr_tbctrl_idx;
if (read_inferior_memory (ipa_trace_buffer_ctrl_addr,
- (unsigned char *) &ipa_trace_buffer_ctrl,
- sizeof (struct ipa_trace_buffer_control)))
+ (unsigned char *) &ipa_trace_buffer_ctrl,
+ sizeof (struct ipa_trace_buffer_control)))
return;
if (read_inferior_data_pointer (ipa_sym_addrs.addr_trace_buffer_lo,
- &ipa_trace_buffer_lo))
+ &ipa_trace_buffer_lo))
return;
if (read_inferior_data_pointer (ipa_sym_addrs.addr_trace_buffer_hi,
- &ipa_trace_buffer_hi))
+ &ipa_trace_buffer_hi))
return;
/* Offsets are easier to grok for debugging than raw addresses,
especially for the small trace buffer sizes that are useful for
testing. */
trace_debug ("Lib: Trace buffer [%d] start=%d free=%d "
- "endfree=%d wrap=%d hi=%d",
- curr_tbctrl_idx,
- (int) (ipa_trace_buffer_ctrl.start - ipa_trace_buffer_lo),
- (int) (ipa_trace_buffer_ctrl.free - ipa_trace_buffer_lo),
- (int) (ipa_trace_buffer_ctrl.end_free - ipa_trace_buffer_lo),
- (int) (ipa_trace_buffer_ctrl.wrap - ipa_trace_buffer_lo),
- (int) (ipa_trace_buffer_hi - ipa_trace_buffer_lo));
+ "endfree=%d wrap=%d hi=%d",
+ curr_tbctrl_idx,
+ (int) (ipa_trace_buffer_ctrl.start - ipa_trace_buffer_lo),
+ (int) (ipa_trace_buffer_ctrl.free - ipa_trace_buffer_lo),
+ (int) (ipa_trace_buffer_ctrl.end_free - ipa_trace_buffer_lo),
+ (int) (ipa_trace_buffer_ctrl.wrap - ipa_trace_buffer_lo),
+ (int) (ipa_trace_buffer_hi - ipa_trace_buffer_lo));
/* Note that the IPA's buffer is always circular. */
#define IPA_FIRST_TRACEFRAME() (ipa_trace_buffer_ctrl.start)
-#define IPA_NEXT_TRACEFRAME_1(TF, TFOBJ) \
+#define IPA_NEXT_TRACEFRAME_1(TF, TFOBJ) \
((TF) + sizeof (struct traceframe) + (TFOBJ)->data_size)
-#define IPA_NEXT_TRACEFRAME(TF, TFOBJ) \
- (IPA_NEXT_TRACEFRAME_1 (TF, TFOBJ) \
+#define IPA_NEXT_TRACEFRAME(TF, TFOBJ) \
+ (IPA_NEXT_TRACEFRAME_1 (TF, TFOBJ) \
- ((IPA_NEXT_TRACEFRAME_1 (TF, TFOBJ) >= ipa_trace_buffer_ctrl.wrap) \
- ? (ipa_trace_buffer_ctrl.wrap - ipa_trace_buffer_lo) \
- : 0))
+ ? (ipa_trace_buffer_ctrl.wrap - ipa_trace_buffer_lo) \
+ : 0))
tf = IPA_FIRST_TRACEFRAME ();
@@ -6440,16 +6402,16 @@ upload_fast_traceframes (void)
struct traceframe ipa_tframe;
if (read_inferior_memory (tf, (unsigned char *) &ipa_tframe,
- offsetof (struct traceframe, data)))
- error ("Uploading: couldn't read traceframe at %s\n", paddress (tf));
+ offsetof (struct traceframe, data)))
+ error ("Uploading: couldn't read traceframe at %s\n", paddress (tf));
if (ipa_tframe.tpnum == 0)
- {
- internal_error ("Uploading: No (more) fast traceframes, but"
- " ipa_traceframe_count == %u??\n",
- ipa_traceframe_write_count
- - ipa_traceframe_read_count);
- }
+ {
+ internal_error ("Uploading: No (more) fast traceframes, but"
+ " ipa_traceframe_count == %u??\n",
+ ipa_traceframe_write_count
+ - ipa_traceframe_read_count);
+ }
/* Note that this will be incorrect for multi-location
tracepoints... */
@@ -6457,80 +6419,77 @@ upload_fast_traceframes (void)
tframe = add_traceframe (tpoint);
if (tframe == NULL)
- {
- trace_buffer_is_full = 1;
- trace_debug ("Uploading: trace buffer is full");
- }
+ {
+ trace_buffer_is_full = 1;
+ trace_debug ("Uploading: trace buffer is full");
+ }
else
- {
- /* Copy the whole set of blocks in one go for now. FIXME:
+ {
+ /* Copy the whole set of blocks in one go for now. FIXME:
split this in smaller blocks. */
- block = add_traceframe_block (tframe, tpoint,
- ipa_tframe.data_size);
- if (block != NULL)
- {
- if (read_inferior_memory (tf
- + offsetof (struct traceframe, data),
- block, ipa_tframe.data_size))
- error ("Uploading: Couldn't read traceframe data at %s\n",
- paddress (tf + offsetof (struct traceframe, data)));
- }
-
- trace_debug ("Uploading: traceframe didn't fit");
- finish_traceframe (tframe);
- }
+ block = add_traceframe_block (tframe, tpoint, ipa_tframe.data_size);
+ if (block != NULL)
+ {
+ if (read_inferior_memory (tf
+ + offsetof (struct traceframe, data),
+ block, ipa_tframe.data_size))
+ error ("Uploading: Couldn't read traceframe data at %s\n",
+ paddress (tf + offsetof (struct traceframe, data)));
+ }
+
+ trace_debug ("Uploading: traceframe didn't fit");
+ finish_traceframe (tframe);
+ }
tf = IPA_NEXT_TRACEFRAME (tf, &ipa_tframe);
/* If we freed the traceframe that wrapped around, go back
to the non-wrap case. */
if (tf < ipa_trace_buffer_ctrl.start)
- {
- trace_debug ("Lib: Discarding past the wraparound");
- ipa_trace_buffer_ctrl.wrap = ipa_trace_buffer_hi;
- }
+ {
+ trace_debug ("Lib: Discarding past the wraparound");
+ ipa_trace_buffer_ctrl.wrap = ipa_trace_buffer_hi;
+ }
ipa_trace_buffer_ctrl.start = tf;
ipa_trace_buffer_ctrl.end_free = ipa_trace_buffer_ctrl.start;
++ipa_traceframe_read_count;
if (ipa_trace_buffer_ctrl.start == ipa_trace_buffer_ctrl.free
- && ipa_trace_buffer_ctrl.start == ipa_trace_buffer_ctrl.end_free)
- {
- trace_debug ("Lib: buffer is fully empty. "
- "Trace buffer [%d] start=%d free=%d endfree=%d",
- curr_tbctrl_idx,
- (int) (ipa_trace_buffer_ctrl.start
- - ipa_trace_buffer_lo),
- (int) (ipa_trace_buffer_ctrl.free
- - ipa_trace_buffer_lo),
- (int) (ipa_trace_buffer_ctrl.end_free
- - ipa_trace_buffer_lo));
-
- ipa_trace_buffer_ctrl.start = ipa_trace_buffer_lo;
- ipa_trace_buffer_ctrl.free = ipa_trace_buffer_lo;
- ipa_trace_buffer_ctrl.end_free = ipa_trace_buffer_hi;
- ipa_trace_buffer_ctrl.wrap = ipa_trace_buffer_hi;
- }
+ && ipa_trace_buffer_ctrl.start == ipa_trace_buffer_ctrl.end_free)
+ {
+ trace_debug (
+ "Lib: buffer is fully empty. "
+ "Trace buffer [%d] start=%d free=%d endfree=%d",
+ curr_tbctrl_idx,
+ (int) (ipa_trace_buffer_ctrl.start - ipa_trace_buffer_lo),
+ (int) (ipa_trace_buffer_ctrl.free - ipa_trace_buffer_lo),
+ (int) (ipa_trace_buffer_ctrl.end_free - ipa_trace_buffer_lo));
+
+ ipa_trace_buffer_ctrl.start = ipa_trace_buffer_lo;
+ ipa_trace_buffer_ctrl.free = ipa_trace_buffer_lo;
+ ipa_trace_buffer_ctrl.end_free = ipa_trace_buffer_hi;
+ ipa_trace_buffer_ctrl.wrap = ipa_trace_buffer_hi;
+ }
trace_debug ("Uploaded a traceframe\n"
- "Lib: Trace buffer [%d] start=%d free=%d "
- "endfree=%d wrap=%d hi=%d",
- curr_tbctrl_idx,
- (int) (ipa_trace_buffer_ctrl.start - ipa_trace_buffer_lo),
- (int) (ipa_trace_buffer_ctrl.free - ipa_trace_buffer_lo),
- (int) (ipa_trace_buffer_ctrl.end_free
- - ipa_trace_buffer_lo),
- (int) (ipa_trace_buffer_ctrl.wrap - ipa_trace_buffer_lo),
- (int) (ipa_trace_buffer_hi - ipa_trace_buffer_lo));
+ "Lib: Trace buffer [%d] start=%d free=%d "
+ "endfree=%d wrap=%d hi=%d",
+ curr_tbctrl_idx,
+ (int) (ipa_trace_buffer_ctrl.start - ipa_trace_buffer_lo),
+ (int) (ipa_trace_buffer_ctrl.free - ipa_trace_buffer_lo),
+ (int) (ipa_trace_buffer_ctrl.end_free
+ - ipa_trace_buffer_lo),
+ (int) (ipa_trace_buffer_ctrl.wrap - ipa_trace_buffer_lo),
+ (int) (ipa_trace_buffer_hi - ipa_trace_buffer_lo));
}
if (target_write_memory (ipa_trace_buffer_ctrl_addr,
- (unsigned char *) &ipa_trace_buffer_ctrl,
- sizeof (struct ipa_trace_buffer_control)))
+ (unsigned char *) &ipa_trace_buffer_ctrl,
+ sizeof (struct ipa_trace_buffer_control)))
return;
write_inferior_integer (ipa_sym_addrs.addr_traceframe_read_count,
- ipa_traceframe_read_count);
+ ipa_traceframe_read_count);
trace_debug ("Done uploading traceframes [%d]\n", curr_tbctrl_idx);
@@ -6563,8 +6522,8 @@ IP_AGENT_EXPORT_VAR char cmd_buf[IPA_CMD_BUF_SIZE];
#include <ust/ust.h>
#undef tracepoint
-extern int serialize_to_text (char *outbuf, int bufsize,
- const char *fmt, va_list ap);
+extern int serialize_to_text (char *outbuf, int bufsize, const char *fmt,
+ va_list ap);
#define GDB_PROBE_NAME "gdb"
@@ -6575,16 +6534,16 @@ extern int serialize_to_text (char *outbuf, int bufsize,
static struct
{
- int (*serialize_to_text) (char *outbuf, int bufsize,
- const char *fmt, va_list ap);
+ int (*serialize_to_text) (char *outbuf, int bufsize, const char *fmt,
+ va_list ap);
int (*ltt_probe_register) (struct ltt_available_probe *pdata);
int (*ltt_probe_unregister) (struct ltt_available_probe *pdata);
int (*ltt_marker_connect) (const char *channel, const char *mname,
- const char *pname);
+ const char *pname);
int (*ltt_marker_disconnect) (const char *channel, const char *mname,
- const char *pname);
+ const char *pname);
void (*marker_iter_start) (struct marker_iter *iter);
void (*marker_iter_next) (struct marker_iter *iter);
@@ -6597,14 +6556,15 @@ static struct
/* Cast through typeof to catch incompatible API changes. Since UST
only builds with gcc, we can freely use gcc extensions here
too. */
-#define GET_UST_SYM(SYM) \
- do \
- { \
- if (ust_ops.SYM == NULL) \
- ust_ops.SYM = (typeof (&SYM)) dlsym (RTLD_DEFAULT, #SYM); \
- if (ust_ops.SYM == NULL) \
- return 0; \
- } while (0)
+#define GET_UST_SYM(SYM) \
+ do \
+ { \
+ if (ust_ops.SYM == NULL) \
+ ust_ops.SYM = (typeof (&SYM)) dlsym (RTLD_DEFAULT, #SYM); \
+ if (ust_ops.SYM == NULL) \
+ return 0; \
+ } \
+ while (0)
#define USTF(SYM) ust_ops.SYM
@@ -6640,10 +6600,10 @@ ust_marker_to_static_tracepoint (const struct marker *mdata)
for (tpoint = tracepoints; tpoint; tpoint = tpoint->next)
{
if (tpoint->type != static_tracepoint)
- continue;
+ continue;
if (tpoint->address == (uintptr_t) mdata->location)
- return tpoint;
+ return tpoint;
}
return NULL;
@@ -6656,8 +6616,8 @@ ust_marker_to_static_tracepoint (const struct marker *mdata)
static void
gdb_probe (const struct marker *mdata, void *probe_private,
- struct registers *regs, void *call_private,
- const char *fmt, va_list *args)
+ struct registers *regs, void *call_private, const char *fmt,
+ va_list *args)
{
struct tracepoint *tpoint;
struct static_tracepoint_ctx ctx;
@@ -6690,9 +6650,9 @@ gdb_probe (const struct marker *mdata, void *probe_private,
if (tpoint == NULL)
{
trace_debug ("gdb_probe: marker not known: "
- "loc:0x%p, ch:\"%s\",n:\"%s\",f:\"%s\"",
- mdata->location, mdata->channel,
- mdata->name, mdata->format);
+ "loc:0x%p, ch:\"%s\",n:\"%s\",f:\"%s\"",
+ mdata->location, mdata->channel, mdata->name,
+ mdata->format);
return;
}
@@ -6705,22 +6665,20 @@ gdb_probe (const struct marker *mdata, void *probe_private,
ctx.tpoint = tpoint;
trace_debug ("gdb_probe: collecting marker: "
- "loc:0x%p, ch:\"%s\",n:\"%s\",f:\"%s\"",
- mdata->location, mdata->channel,
- mdata->name, mdata->format);
+ "loc:0x%p, ch:\"%s\",n:\"%s\",f:\"%s\"",
+ mdata->location, mdata->channel, mdata->name, mdata->format);
/* Test the condition if present, and collect if true. */
if (tpoint->cond == NULL
|| condition_true_at_tracepoint ((struct tracepoint_hit_ctx *) &ctx,
- tpoint))
+ tpoint))
{
collect_data_at_tracepoint ((struct tracepoint_hit_ctx *) &ctx,
- tpoint->address, tpoint);
+ tpoint->address, tpoint);
- if (stopping_tracepoint
- || trace_buffer_is_full
- || expr_eval_result != expr_eval_no_error)
- stop_tracing ();
+ if (stopping_tracepoint || trace_buffer_is_full
+ || expr_eval_result != expr_eval_no_error)
+ stop_tracing ();
}
else
{
@@ -6728,7 +6686,7 @@ gdb_probe (const struct marker *mdata, void *probe_private,
way we would stop tracing is if there was an error during
condition expression evaluation. */
if (expr_eval_result != expr_eval_no_error)
- stop_tracing ();
+ stop_tracing ();
}
}
@@ -6744,7 +6702,7 @@ gdb_probe (const struct marker *mdata, void *probe_private,
static void
collect_ust_data_at_tracepoint (struct tracepoint_hit_ctx *ctx,
- struct traceframe *tframe)
+ struct traceframe *tframe)
{
struct static_tracepoint_ctx *umd = (struct static_tracepoint_ctx *) ctx;
unsigned char *bufspace;
@@ -6755,19 +6713,19 @@ collect_ust_data_at_tracepoint (struct tracepoint_hit_ctx *ctx,
if (umd == NULL)
{
trace_debug ("Wanted to collect static trace data, "
- "but there's no static trace data");
+ "but there's no static trace data");
return;
}
va_copy (copy, *umd->args);
- size = USTF(serialize_to_text) (NULL, 0, umd->fmt, copy);
+ size = USTF (serialize_to_text) (NULL, 0, umd->fmt, copy);
va_end (copy);
trace_debug ("Want to collect ust data");
/* 'S' + size + string */
bufspace = add_traceframe_block (tframe, umd->tpoint,
- 1 + sizeof (blocklen) + size + 1);
+ 1 + sizeof (blocklen) + size + 1);
if (bufspace == NULL)
{
trace_debug ("Trace buffer block allocation failed, skipping");
@@ -6781,21 +6739,20 @@ collect_ust_data_at_tracepoint (struct tracepoint_hit_ctx *ctx,
memcpy (bufspace + 1, &blocklen, sizeof (blocklen));
va_copy (copy, *umd->args);
- USTF(serialize_to_text) ((char *) bufspace + 1 + sizeof (blocklen),
- size + 1, umd->fmt, copy);
+ USTF (serialize_to_text)
+ ((char *) bufspace + 1 + sizeof (blocklen), size + 1, umd->fmt, copy);
va_end (copy);
trace_debug ("Storing static tracepoint data in regblock: %s",
- bufspace + 1 + sizeof (blocklen));
+ bufspace + 1 + sizeof (blocklen));
}
/* The probe to register with lttng/ust. */
-static struct ltt_available_probe gdb_ust_probe =
- {
- GDB_PROBE_NAME,
- NULL,
- gdb_probe,
- };
+static struct ltt_available_probe gdb_ust_probe = {
+ GDB_PROBE_NAME,
+ NULL,
+ gdb_probe,
+};
#endif /* HAVE_UST */
#endif /* IN_PROCESS_AGENT */
@@ -6834,7 +6791,7 @@ run_inferior_command (char *cmd, int len)
#include <sys/un.h>
#ifndef UNIX_PATH_MAX
-#define UNIX_PATH_MAX sizeof(((struct sockaddr_un *) NULL)->sun_path)
+#define UNIX_PATH_MAX sizeof (((struct sockaddr_un *) NULL)->sun_path)
#endif
/* Where we put the socked used for synchronization. */
@@ -6863,7 +6820,8 @@ init_named_socket (const char *name)
if (strlen (name) >= ARRAY_SIZE (addr.sun_path))
{
- warning ("socket name too long for sockaddr_un::sun_path field: %s", name);
+ warning ("socket name too long for sockaddr_un::sun_path field: %s",
+ name);
return -1;
}
@@ -6875,11 +6833,11 @@ init_named_socket (const char *name)
/* File exists. */
result = unlink (name);
if (result == -1)
- {
- warning ("unlink failed: %s", safe_strerror (errno));
- close (fd);
- return -1;
- }
+ {
+ warning ("unlink failed: %s", safe_strerror (errno));
+ close (fd);
+ return -1;
+ }
warning ("socket %s already exists; overwriting", name);
}
@@ -6910,7 +6868,7 @@ gdb_agent_socket_init (void)
int result, fd;
result = snprintf (agent_socket_name, UNIX_PATH_MAX, "%s/gdb_ust%d",
- SOCK_DIR, getpid ());
+ SOCK_DIR, getpid ());
if (result >= UNIX_PATH_MAX)
{
trace_debug ("string overflow allocating socket name");
@@ -6920,8 +6878,9 @@ gdb_agent_socket_init (void)
fd = init_named_socket (agent_socket_name);
if (fd < 0)
warning ("Error initializing named socket (%s) for communication with the "
- "ust helper thread. Check that directory exists and that it "
- "is writable.", agent_socket_name);
+ "ust helper thread. Check that directory exists and that it "
+ "is writable.",
+ agent_socket_name);
return fd;
}
@@ -6938,8 +6897,8 @@ first_marker (void)
{
struct marker_iter iter;
- USTF(marker_iter_reset) (&iter);
- USTF(marker_iter_start) (&iter);
+ USTF (marker_iter_reset) (&iter);
+ USTF (marker_iter_start) (&iter);
return iter.marker;
}
@@ -6951,16 +6910,16 @@ next_marker (const struct marker *m)
{
struct marker_iter iter;
- USTF(marker_iter_reset) (&iter);
- USTF(marker_iter_start) (&iter);
+ USTF (marker_iter_reset) (&iter);
+ USTF (marker_iter_start) (&iter);
- for (; iter.marker != NULL; USTF(marker_iter_next) (&iter))
+ for (; iter.marker != NULL; USTF (marker_iter_next) (&iter))
{
if (iter.marker == m)
- {
- USTF(marker_iter_next) (&iter);
- return iter.marker;
- }
+ {
+ USTF (marker_iter_next) (&iter);
+ return iter.marker;
+ }
}
return NULL;
@@ -6988,8 +6947,7 @@ response_ust_marker (char *packet, const struct marker *st)
next_st = next_marker (st);
- tmp = xmalloc (strlen (st->channel) + 1 +
- strlen (st->name) + 1);
+ tmp = xmalloc (strlen (st->channel) + 1 + strlen (st->name) + 1);
sprintf (tmp, "%s/%s", st->channel, st->name);
strid = cstr_to_hexstr (tmp);
@@ -6997,10 +6955,8 @@ response_ust_marker (char *packet, const struct marker *st)
format = cstr_to_hexstr (st->format);
- sprintf (packet, "m%s:%s:%s",
- paddress ((uintptr_t) st->location),
- strid,
- format);
+ sprintf (packet, "m%s:%s:%s", paddress ((uintptr_t) st->location), strid,
+ format);
free (strid);
free (format);
@@ -7046,20 +7002,20 @@ unprobe_marker_at (char *packet)
p = unpack_varlen_hex (p, &address);
- USTF(marker_iter_reset) (&iter);
- USTF(marker_iter_start) (&iter);
- for (; iter.marker != NULL; USTF(marker_iter_next) (&iter))
- if ((uintptr_t ) iter.marker->location == address)
+ USTF (marker_iter_reset) (&iter);
+ USTF (marker_iter_start) (&iter);
+ for (; iter.marker != NULL; USTF (marker_iter_next) (&iter))
+ if ((uintptr_t) iter.marker->location == address)
{
- int result;
-
- result = USTF(ltt_marker_disconnect) (iter.marker->channel,
- iter.marker->name,
- GDB_PROBE_NAME);
- if (result < 0)
- warning ("could not disable marker %s/%s",
- iter.marker->channel, iter.marker->name);
- break;
+ int result;
+
+ result
+ = USTF (ltt_marker_disconnect) (iter.marker->channel,
+ iter.marker->name, GDB_PROBE_NAME);
+ if (result < 0)
+ warning ("could not disable marker %s/%s", iter.marker->channel,
+ iter.marker->name);
+ break;
}
}
@@ -7077,34 +7033,33 @@ probe_marker_at (char *packet)
p = unpack_varlen_hex (p, &address);
- USTF(marker_iter_reset) (&iter);
+ USTF (marker_iter_reset) (&iter);
- for (USTF(marker_iter_start) (&iter), m = iter.marker;
- m != NULL;
- USTF(marker_iter_next) (&iter), m = iter.marker)
- if ((uintptr_t ) m->location == address)
+ for (USTF (marker_iter_start) (&iter), m = iter.marker; m != NULL;
+ USTF (marker_iter_next) (&iter), m = iter.marker)
+ if ((uintptr_t) m->location == address)
{
- int result;
-
- trace_debug ("found marker for address. "
- "ltt_marker_connect (marker = %s/%s)",
- m->channel, m->name);
-
- result = USTF(ltt_marker_connect) (m->channel, m->name,
- GDB_PROBE_NAME);
- if (result && result != -EEXIST)
- trace_debug ("ltt_marker_connect (marker = %s/%s, errno = %d)",
- m->channel, m->name, -result);
-
- if (result < 0)
- {
- sprintf (packet, "E.could not connect marker: channel=%s, name=%s",
- m->channel, m->name);
- return -1;
- }
-
- strcpy (packet, "OK");
- return 0;
+ int result;
+
+ trace_debug ("found marker for address. "
+ "ltt_marker_connect (marker = %s/%s)",
+ m->channel, m->name);
+
+ result
+ = USTF (ltt_marker_connect) (m->channel, m->name, GDB_PROBE_NAME);
+ if (result && result != -EEXIST)
+ trace_debug ("ltt_marker_connect (marker = %s/%s, errno = %d)",
+ m->channel, m->name, -result);
+
+ if (result < 0)
+ {
+ sprintf (packet, "E.could not connect marker: channel=%s, name=%s",
+ m->channel, m->name);
+ return -1;
+ }
+
+ strcpy (packet, "OK");
+ return 0;
}
sprintf (packet, "E.no marker found at 0x%s", paddress (address));
@@ -7123,15 +7078,14 @@ cmd_qtstmat (char *packet)
p = unpack_varlen_hex (p, &address);
- USTF(marker_iter_reset) (&iter);
+ USTF (marker_iter_reset) (&iter);
- for (USTF(marker_iter_start) (&iter), m = iter.marker;
- m != NULL;
- USTF(marker_iter_next) (&iter), m = iter.marker)
- if ((uintptr_t ) m->location == address)
+ for (USTF (marker_iter_start) (&iter), m = iter.marker; m != NULL;
+ USTF (marker_iter_next) (&iter), m = iter.marker)
+ if ((uintptr_t) m->location == address)
{
- response_ust_marker (packet, m);
- return 0;
+ response_ust_marker (packet, m);
+ return 0;
}
strcpy (packet, "l");
@@ -7144,7 +7098,7 @@ gdb_ust_init (void)
if (!dlsym_ust ())
return;
- USTF(ltt_probe_register) (&gdb_ust_probe);
+ USTF (ltt_probe_register) (&gdb_ust_probe);
}
#endif /* HAVE_UST */
@@ -7171,100 +7125,101 @@ gdb_agent_helper_thread (void *arg)
listen_fd = gdb_agent_socket_init ();
if (helper_thread_id == 0)
- helper_thread_id = syscall (SYS_gettid);
+ helper_thread_id = syscall (SYS_gettid);
if (listen_fd == -1)
- {
- warning ("could not create sync socket");
- break;
- }
+ {
+ warning ("could not create sync socket");
+ break;
+ }
while (1)
- {
- socklen_t tmp;
- struct sockaddr_un sockaddr;
- int fd;
- char buf[1];
- int ret;
- int stop_loop = 0;
-
- tmp = sizeof (sockaddr);
-
- do
- {
- fd = accept (listen_fd, (struct sockaddr *) &sockaddr, &tmp);
- }
- /* It seems an ERESTARTSYS can escape out of accept. */
- while (fd == -512 || (fd == -1 && errno == EINTR));
-
- if (fd < 0)
- {
- warning ("Accept returned %d, error: %s",
- fd, safe_strerror (errno));
- break;
- }
-
- do
- {
- ret = read (fd, buf, 1);
- } while (ret == -1 && errno == EINTR);
-
- if (ret == -1)
- {
- warning ("reading socket (fd=%d) failed with %s",
- fd, safe_strerror (errno));
- close (fd);
- break;
- }
-
- if (cmd_buf[0])
- {
- if (startswith (cmd_buf, "close"))
- {
- stop_loop = 1;
- }
+ {
+ socklen_t tmp;
+ struct sockaddr_un sockaddr;
+ int fd;
+ char buf[1];
+ int ret;
+ int stop_loop = 0;
+
+ tmp = sizeof (sockaddr);
+
+ do
+ {
+ fd = accept (listen_fd, (struct sockaddr *) &sockaddr, &tmp);
+ }
+ /* It seems an ERESTARTSYS can escape out of accept. */
+ while (fd == -512 || (fd == -1 && errno == EINTR));
+
+ if (fd < 0)
+ {
+ warning ("Accept returned %d, error: %s", fd,
+ safe_strerror (errno));
+ break;
+ }
+
+ do
+ {
+ ret = read (fd, buf, 1);
+ }
+ while (ret == -1 && errno == EINTR);
+
+ if (ret == -1)
+ {
+ warning ("reading socket (fd=%d) failed with %s", fd,
+ safe_strerror (errno));
+ close (fd);
+ break;
+ }
+
+ if (cmd_buf[0])
+ {
+ if (startswith (cmd_buf, "close"))
+ {
+ stop_loop = 1;
+ }
#ifdef HAVE_UST
- else if (strcmp ("qTfSTM", cmd_buf) == 0)
- {
- cmd_qtfstm (cmd_buf);
- }
- else if (strcmp ("qTsSTM", cmd_buf) == 0)
- {
- cmd_qtsstm (cmd_buf);
- }
- else if (startswith (cmd_buf, "unprobe_marker_at:"))
- {
- unprobe_marker_at (cmd_buf);
- }
- else if (startswith (cmd_buf, "probe_marker_at:"))
- {
- probe_marker_at (cmd_buf);
- }
- else if (startswith (cmd_buf, "qTSTMat:"))
- {
- cmd_qtstmat (cmd_buf);
- }
+ else if (strcmp ("qTfSTM", cmd_buf) == 0)
+ {
+ cmd_qtfstm (cmd_buf);
+ }
+ else if (strcmp ("qTsSTM", cmd_buf) == 0)
+ {
+ cmd_qtsstm (cmd_buf);
+ }
+ else if (startswith (cmd_buf, "unprobe_marker_at:"))
+ {
+ unprobe_marker_at (cmd_buf);
+ }
+ else if (startswith (cmd_buf, "probe_marker_at:"))
+ {
+ probe_marker_at (cmd_buf);
+ }
+ else if (startswith (cmd_buf, "qTSTMat:"))
+ {
+ cmd_qtstmat (cmd_buf);
+ }
#endif /* HAVE_UST */
- }
+ }
- /* Fix compiler's warning: ignoring return value of 'write'. */
- ret = write (fd, buf, 1);
- close (fd);
+ /* Fix compiler's warning: ignoring return value of 'write'. */
+ ret = write (fd, buf, 1);
+ close (fd);
- if (stop_loop)
- {
- close (listen_fd);
- unlink (agent_socket_name);
+ if (stop_loop)
+ {
+ close (listen_fd);
+ unlink (agent_socket_name);
- /* Sleep endlessly to wait the whole inferior stops. This
+ /* Sleep endlessly to wait the whole inferior stops. This
thread can not exit because GDB or GDBserver may still need
'current_thread' (representing this thread) to access
inferior memory. Otherwise, this thread exits earlier than
other threads, and 'current_thread' is set to NULL. */
- while (1)
- sleep (10);
- }
- }
+ while (1)
+ sleep (10);
+ }
+ }
}
return NULL;
@@ -7293,10 +7248,7 @@ gdb_agent_init (void)
if (res)
perror_with_name ("pthread_sigmask (1)");
- res = pthread_create (&thread,
- NULL,
- gdb_agent_helper_thread,
- NULL);
+ res = pthread_create (&thread, NULL, gdb_agent_helper_thread, NULL);
res = pthread_sigmask (SIG_SETMASK, &orig_mask, NULL);
if (res)
@@ -7334,8 +7286,7 @@ set_trampoline_buffer_space (CORE_ADDR begin, CORE_ADDR end, char *errmsg)
strcpy (gdb_trampoline_buffer_error, "no buffer passed");
}
-static void __attribute__ ((constructor))
-initialize_tracepoint_ftlib (void)
+static void __attribute__ ((constructor)) initialize_tracepoint_ftlib (void)
{
initialize_tracepoint ();
@@ -7359,10 +7310,10 @@ getauxval (unsigned long type)
while (fread (data, sizeof (data), 1, f) > 0)
{
if (data[0] == type)
- {
- value = data[1];
- break;
- }
+ {
+ value = data[1];
+ break;
+ }
}
fclose (f);
diff --git a/gdbserver/tracepoint.h b/gdbserver/tracepoint.h
index a30f540d130..922803f67e6 100644
--- a/gdbserver/tracepoint.h
+++ b/gdbserver/tracepoint.h
@@ -26,23 +26,23 @@
void initialize_tracepoint (void);
#if defined(__GNUC__)
-# define ATTR_USED __attribute__((used))
-# define ATTR_NOINLINE __attribute__((noinline))
+#define ATTR_USED __attribute__ ((used))
+#define ATTR_NOINLINE __attribute__ ((noinline))
#else
-# define ATTR_USED
-# define ATTR_NOINLINE
+#define ATTR_USED
+#define ATTR_NOINLINE
#endif
/* How to make symbol public/exported. */
#if defined _WIN32 || defined __CYGWIN__
-# define EXPORTED_SYMBOL __declspec (dllexport)
+#define EXPORTED_SYMBOL __declspec (dllexport)
#else
-# if __GNUC__ >= 4
-# define EXPORTED_SYMBOL __attribute__ ((visibility ("default")))
-# else
-# define EXPORTED_SYMBOL
-# endif
+#if __GNUC__ >= 4
+#define EXPORTED_SYMBOL __attribute__ ((visibility ("default")))
+#else
+#define EXPORTED_SYMBOL
+#endif
#endif
/* Use these to make sure the functions and variables the IPA needs to
@@ -58,13 +58,13 @@ void initialize_tracepoint (void);
EXTERN_C_PUSH/EXTERN_C_POP around their definition. */
#ifdef IN_PROCESS_AGENT
-# define IP_AGENT_EXPORT_FUNC EXTERN_C EXPORTED_SYMBOL ATTR_NOINLINE ATTR_USED
-# define IP_AGENT_EXPORT_VAR EXPORTED_SYMBOL ATTR_USED
-# define IP_AGENT_EXPORT_VAR_DECL EXTERN_C EXPORTED_SYMBOL
+#define IP_AGENT_EXPORT_FUNC EXTERN_C EXPORTED_SYMBOL ATTR_NOINLINE ATTR_USED
+#define IP_AGENT_EXPORT_VAR EXPORTED_SYMBOL ATTR_USED
+#define IP_AGENT_EXPORT_VAR_DECL EXTERN_C EXPORTED_SYMBOL
#else
-# define IP_AGENT_EXPORT_FUNC static
-# define IP_AGENT_EXPORT_VAR
-# define IP_AGENT_EXPORT_VAR_DECL extern
+#define IP_AGENT_EXPORT_FUNC static
+#define IP_AGENT_EXPORT_VAR
+#define IP_AGENT_EXPORT_VAR_DECL extern
#endif
IP_AGENT_EXPORT_VAR_DECL int tracing;
@@ -84,16 +84,13 @@ int tracepoint_was_hit (struct thread_info *tinfo, CORE_ADDR stop_pc);
void release_while_stepping_state_list (struct thread_info *tinfo);
int in_readonly_region (CORE_ADDR addr, ULONGEST length);
-int traceframe_read_mem (int tfnum, CORE_ADDR addr,
- unsigned char *buf, ULONGEST length,
- ULONGEST *nbytes);
-int fetch_traceframe_registers (int tfnum,
- struct regcache *regcache,
- int regnum);
+int traceframe_read_mem (int tfnum, CORE_ADDR addr, unsigned char *buf,
+ ULONGEST length, ULONGEST *nbytes);
+int fetch_traceframe_registers (int tfnum, struct regcache *regcache,
+ int regnum);
-int traceframe_read_sdata (int tfnum, ULONGEST offset,
- unsigned char *buf, ULONGEST length,
- ULONGEST *nbytes);
+int traceframe_read_sdata (int tfnum, ULONGEST offset, unsigned char *buf,
+ ULONGEST length, ULONGEST *nbytes);
int traceframe_read_info (int tfnum, struct buffer *buffer);
@@ -128,9 +125,9 @@ enum class fast_tpoint_collect_result
at_insn,
};
-fast_tpoint_collect_result fast_tracepoint_collecting
- (CORE_ADDR thread_area, CORE_ADDR stop_pc,
- struct fast_tpoint_collect_status *status);
+fast_tpoint_collect_result
+fast_tracepoint_collecting (CORE_ADDR thread_area, CORE_ADDR stop_pc,
+ struct fast_tpoint_collect_status *status);
void force_unlock_trace_buffer (void);
@@ -140,12 +137,12 @@ int handle_tracepoint_bkpts (struct thread_info *tinfo, CORE_ADDR stop_pc);
void initialize_low_tracepoint (void);
const struct target_desc *get_ipa_tdesc (int idx);
void supply_fast_tracepoint_registers (struct regcache *regcache,
- const unsigned char *regs);
+ const unsigned char *regs);
void supply_static_tracepoint_registers (struct regcache *regcache,
- const unsigned char *regs,
- CORE_ADDR pc);
+ const unsigned char *regs,
+ CORE_ADDR pc);
void set_trampoline_buffer_space (CORE_ADDR begin, CORE_ADDR end,
- char *errmsg);
+ char *errmsg);
void *alloc_jump_pad_buffer (size_t size);
#ifndef HAVE_GETAUXVAL
unsigned long getauxval (unsigned long type);
@@ -164,9 +161,8 @@ struct eval_agent_expr_context;
/* Do memory copies for bytecodes. */
/* Do the recording of memory blocks for actions and bytecodes. */
-int agent_mem_read (struct eval_agent_expr_context *ctx,
- unsigned char *to, CORE_ADDR from,
- ULONGEST len);
+int agent_mem_read (struct eval_agent_expr_context *ctx, unsigned char *to,
+ CORE_ADDR from, ULONGEST len);
LONGEST agent_get_trace_state_variable_value (int num);
void agent_set_trace_state_variable_value (int num, LONGEST val);
@@ -175,9 +171,7 @@ void agent_set_trace_state_variable_value (int num, LONGEST val);
int agent_tsv_read (struct eval_agent_expr_context *ctx, int n);
int agent_mem_read_string (struct eval_agent_expr_context *ctx,
- unsigned char *to,
- CORE_ADDR from,
- ULONGEST len);
+ unsigned char *to, CORE_ADDR from, ULONGEST len);
/* The prototype the get_raw_reg function in the IPA. Each arch's
bytecode compiler emits calls to this function. */
diff --git a/gdbserver/utils.cc b/gdbserver/utils.cc
index a6f5bd7b600..3f5a23b7153 100644
--- a/gdbserver/utils.cc
+++ b/gdbserver/utils.cc
@@ -19,11 +19,11 @@
#include "server.h"
#ifdef IN_PROCESS_AGENT
-# define PREFIX "ipa: "
-# define TOOLNAME "GDBserver in-process agent"
+#define PREFIX "ipa: "
+#define TOOLNAME "GDBserver in-process agent"
#else
-# define PREFIX "gdbserver: "
-# define TOOLNAME "GDBserver"
+#define PREFIX "gdbserver: "
+#define TOOLNAME "GDBserver"
#endif
/* Generally useful subroutines used throughout the program. */
@@ -46,8 +46,8 @@ void
malloc_failure (long size)
{
fprintf (stderr,
- PREFIX "ran out of memory while trying to allocate %lu bytes\n",
- (unsigned long) size);
+ PREFIX "ran out of memory while trying to allocate %lu bytes\n",
+ (unsigned long) size);
abort_or_exit ();
}
@@ -101,8 +101,9 @@ vwarning (const char *string, va_list args)
void
internal_verror (const char *file, int line, const char *fmt, va_list args)
{
- fprintf (stderr, "\
-%s:%d: A problem internal to " TOOLNAME " has been detected.\n", file, line);
+ fprintf (stderr, "\
+%s:%d: A problem internal to " TOOLNAME " has been detected.\n",
+ file, line);
vfprintf (stderr, fmt, args);
fprintf (stderr, "\n");
abort_or_exit ();
@@ -113,8 +114,9 @@ internal_verror (const char *file, int line, const char *fmt, va_list args)
void
internal_vwarning (const char *file, int line, const char *fmt, va_list args)
{
- fprintf (stderr, "\
-%s:%d: A problem internal to " TOOLNAME " has been detected.\n", file, line);
+ fprintf (stderr, "\
+%s:%d: A problem internal to " TOOLNAME " has been detected.\n",
+ file, line);
vfprintf (stderr, fmt, args);
fprintf (stderr, "\n");
}
diff --git a/gdbserver/win32-i386-low.cc b/gdbserver/win32-i386-low.cc
index f78e0120678..9438ca670b0 100644
--- a/gdbserver/win32-i386-low.cc
+++ b/gdbserver/win32-i386-low.cc
@@ -42,7 +42,8 @@ static struct x86_debug_reg_state debug_reg_state;
static void
update_debug_registers (thread_info *thread)
{
- windows_thread_info *th = (windows_thread_info *) thread_target_data (thread);
+ windows_thread_info *th
+ = (windows_thread_info *) thread_target_data (thread);
/* The actual update is done later just before resuming the lwp,
we just mark that the registers need updating. */
@@ -81,39 +82,39 @@ win32_get_current_dr (int dr)
win32_require_context (th);
#ifdef __x86_64__
-#define RET_DR(DR) \
- case DR: \
- return th->wow64_context.Dr ## DR
+#define RET_DR(DR) \
+ case DR: \
+ return th->wow64_context.Dr##DR
if (windows_process.wow64_process)
{
switch (dr)
- {
- RET_DR (0);
- RET_DR (1);
- RET_DR (2);
- RET_DR (3);
- RET_DR (6);
- RET_DR (7);
- }
+ {
+ RET_DR (0);
+ RET_DR (1);
+ RET_DR (2);
+ RET_DR (3);
+ RET_DR (6);
+ RET_DR (7);
+ }
}
else
#undef RET_DR
#endif
-#define RET_DR(DR) \
- case DR: \
- return th->context.Dr ## DR
+#define RET_DR(DR) \
+ case DR: \
+ return th->context.Dr##DR
{
switch (dr)
- {
- RET_DR (0);
- RET_DR (1);
- RET_DR (2);
- RET_DR (3);
- RET_DR (6);
- RET_DR (7);
- }
+ {
+ RET_DR (0);
+ RET_DR (1);
+ RET_DR (2);
+ RET_DR (3);
+ RET_DR (6);
+ RET_DR (7);
+ }
}
#undef RET_DR
@@ -145,15 +146,10 @@ x86_dr_low_get_status (void)
}
/* Low-level function vector. */
-struct x86_dr_low_type x86_dr_low =
- {
- x86_dr_low_set_control,
- x86_dr_low_set_addr,
- x86_dr_low_get_addr,
- x86_dr_low_get_status,
- x86_dr_low_get_control,
- sizeof (void *),
- };
+struct x86_dr_low_type x86_dr_low = {
+ x86_dr_low_set_control, x86_dr_low_set_addr, x86_dr_low_get_addr,
+ x86_dr_low_get_status, x86_dr_low_get_control, sizeof (void *),
+};
/* Breakpoint/watchpoint support. */
@@ -172,8 +168,8 @@ i386_supports_z_point_type (char z_type)
}
static int
-i386_insert_point (enum raw_bkpt_type type, CORE_ADDR addr,
- int size, struct raw_breakpoint *bp)
+i386_insert_point (enum raw_bkpt_type type, CORE_ADDR addr, int size,
+ struct raw_breakpoint *bp)
{
switch (type)
{
@@ -181,11 +177,11 @@ i386_insert_point (enum raw_bkpt_type type, CORE_ADDR addr,
case raw_bkpt_type_write_wp:
case raw_bkpt_type_access_wp:
{
- enum target_hw_bp_type hw_type
- = raw_bkpt_type_to_target_hw_bp_type (type);
+ enum target_hw_bp_type hw_type
+ = raw_bkpt_type_to_target_hw_bp_type (type);
- return x86_dr_insert_watchpoint (&debug_reg_state,
- hw_type, addr, size);
+ return x86_dr_insert_watchpoint (&debug_reg_state, hw_type, addr,
+ size);
}
default:
/* Unsupported. */
@@ -194,8 +190,8 @@ i386_insert_point (enum raw_bkpt_type type, CORE_ADDR addr,
}
static int
-i386_remove_point (enum raw_bkpt_type type, CORE_ADDR addr,
- int size, struct raw_breakpoint *bp)
+i386_remove_point (enum raw_bkpt_type type, CORE_ADDR addr, int size,
+ struct raw_breakpoint *bp)
{
switch (type)
{
@@ -203,11 +199,11 @@ i386_remove_point (enum raw_bkpt_type type, CORE_ADDR addr,
case raw_bkpt_type_write_wp:
case raw_bkpt_type_access_wp:
{
- enum target_hw_bp_type hw_type
- = raw_bkpt_type_to_target_hw_bp_type (type);
+ enum target_hw_bp_type hw_type
+ = raw_bkpt_type_to_target_hw_bp_type (type);
- return x86_dr_remove_watchpoint (&debug_reg_state,
- hw_type, addr, size);
+ return x86_dr_remove_watchpoint (&debug_reg_state, hw_type, addr,
+ size);
}
default:
/* Unsupported. */
@@ -243,19 +239,17 @@ i386_get_thread_context (windows_thread_info *th)
the system doesn't support extended registers. */
static DWORD extended_registers = CONTEXT_EXTENDED_REGISTERS;
- again:
+again:
#ifdef __x86_64__
if (windows_process.wow64_process)
- th->wow64_context.ContextFlags = (CONTEXT_FULL
- | CONTEXT_FLOATING_POINT
- | CONTEXT_DEBUG_REGISTERS
- | extended_registers);
+ th->wow64_context.ContextFlags
+ = (CONTEXT_FULL | CONTEXT_FLOATING_POINT | CONTEXT_DEBUG_REGISTERS
+ | extended_registers);
else
#endif
- th->context.ContextFlags = (CONTEXT_FULL
- | CONTEXT_FLOATING_POINT
- | CONTEXT_DEBUG_REGISTERS
- | extended_registers);
+ th->context.ContextFlags
+ = (CONTEXT_FULL | CONTEXT_FLOATING_POINT | CONTEXT_DEBUG_REGISTERS
+ | extended_registers);
BOOL ret;
#ifdef __x86_64__
@@ -269,10 +263,10 @@ i386_get_thread_context (windows_thread_info *th)
DWORD e = GetLastError ();
if (extended_registers && e == ERROR_INVALID_PARAMETER)
- {
- extended_registers = 0;
- goto again;
- }
+ {
+ extended_registers = 0;
+ goto again;
+ }
error ("GetThreadContext failure %ld\n", (long) e);
}
@@ -289,26 +283,26 @@ i386_prepare_to_resume (windows_thread_info *th)
#ifdef __x86_64__
if (windows_process.wow64_process)
- {
- th->wow64_context.Dr0 = dr->dr_mirror[0];
- th->wow64_context.Dr1 = dr->dr_mirror[1];
- th->wow64_context.Dr2 = dr->dr_mirror[2];
- th->wow64_context.Dr3 = dr->dr_mirror[3];
- /* th->wow64_context.Dr6 = dr->dr_status_mirror;
+ {
+ th->wow64_context.Dr0 = dr->dr_mirror[0];
+ th->wow64_context.Dr1 = dr->dr_mirror[1];
+ th->wow64_context.Dr2 = dr->dr_mirror[2];
+ th->wow64_context.Dr3 = dr->dr_mirror[3];
+ /* th->wow64_context.Dr6 = dr->dr_status_mirror;
FIXME: should we set dr6 also ?? */
- th->wow64_context.Dr7 = dr->dr_control_mirror;
- }
+ th->wow64_context.Dr7 = dr->dr_control_mirror;
+ }
else
#endif
- {
- th->context.Dr0 = dr->dr_mirror[0];
- th->context.Dr1 = dr->dr_mirror[1];
- th->context.Dr2 = dr->dr_mirror[2];
- th->context.Dr3 = dr->dr_mirror[3];
- /* th->context.Dr6 = dr->dr_status_mirror;
+ {
+ th->context.Dr0 = dr->dr_mirror[0];
+ th->context.Dr1 = dr->dr_mirror[1];
+ th->context.Dr2 = dr->dr_mirror[2];
+ th->context.Dr3 = dr->dr_mirror[3];
+ /* th->context.Dr6 = dr->dr_status_mirror;
FIXME: should we set dr6 also ?? */
- th->context.Dr7 = dr->dr_control_mirror;
- }
+ th->context.Dr7 = dr->dr_control_mirror;
+ }
th->debug_registers_changed = false;
}
@@ -341,120 +335,80 @@ i386_single_step (windows_thread_info *th)
#ifdef __x86_64__
#define context_offset(x) (offsetof (WOW64_CONTEXT, x))
#else
-#define context_offset(x) ((int)&(((CONTEXT *)NULL)->x))
+#define context_offset(x) ((int) &(((CONTEXT *) NULL)->x))
#endif
-static const int i386_mappings[] = {
- context_offset (Eax),
- context_offset (Ecx),
- context_offset (Edx),
- context_offset (Ebx),
- context_offset (Esp),
- context_offset (Ebp),
- context_offset (Esi),
- context_offset (Edi),
- context_offset (Eip),
- context_offset (EFlags),
- context_offset (SegCs),
- context_offset (SegSs),
- context_offset (SegDs),
- context_offset (SegEs),
- context_offset (SegFs),
- context_offset (SegGs),
- context_offset (FloatSave.RegisterArea[0 * 10]),
- context_offset (FloatSave.RegisterArea[1 * 10]),
- context_offset (FloatSave.RegisterArea[2 * 10]),
- context_offset (FloatSave.RegisterArea[3 * 10]),
- context_offset (FloatSave.RegisterArea[4 * 10]),
- context_offset (FloatSave.RegisterArea[5 * 10]),
- context_offset (FloatSave.RegisterArea[6 * 10]),
- context_offset (FloatSave.RegisterArea[7 * 10]),
- context_offset (FloatSave.ControlWord),
- context_offset (FloatSave.StatusWord),
- context_offset (FloatSave.TagWord),
- context_offset (FloatSave.ErrorSelector),
- context_offset (FloatSave.ErrorOffset),
- context_offset (FloatSave.DataSelector),
- context_offset (FloatSave.DataOffset),
- context_offset (FloatSave.ErrorSelector),
- /* XMM0-7 */
- context_offset (ExtendedRegisters[10 * 16]),
- context_offset (ExtendedRegisters[11 * 16]),
- context_offset (ExtendedRegisters[12 * 16]),
- context_offset (ExtendedRegisters[13 * 16]),
- context_offset (ExtendedRegisters[14 * 16]),
- context_offset (ExtendedRegisters[15 * 16]),
- context_offset (ExtendedRegisters[16 * 16]),
- context_offset (ExtendedRegisters[17 * 16]),
- /* MXCSR */
- context_offset (ExtendedRegisters[24])
-};
+static const int i386_mappings[]
+ = { context_offset (Eax), context_offset (Ecx), context_offset (Edx),
+ context_offset (Ebx), context_offset (Esp), context_offset (Ebp),
+ context_offset (Esi), context_offset (Edi), context_offset (Eip),
+ context_offset (EFlags), context_offset (SegCs), context_offset (SegSs),
+ context_offset (SegDs), context_offset (SegEs), context_offset (SegFs),
+ context_offset (SegGs), context_offset (FloatSave.RegisterArea[0 * 10]),
+ context_offset (FloatSave.RegisterArea[1 * 10]),
+ context_offset (FloatSave.RegisterArea[2 * 10]),
+ context_offset (FloatSave.RegisterArea[3 * 10]),
+ context_offset (FloatSave.RegisterArea[4 * 10]),
+ context_offset (FloatSave.RegisterArea[5 * 10]),
+ context_offset (FloatSave.RegisterArea[6 * 10]),
+ context_offset (FloatSave.RegisterArea[7 * 10]),
+ context_offset (FloatSave.ControlWord),
+ context_offset (FloatSave.StatusWord),
+ context_offset (FloatSave.TagWord),
+ context_offset (FloatSave.ErrorSelector),
+ context_offset (FloatSave.ErrorOffset),
+ context_offset (FloatSave.DataSelector),
+ context_offset (FloatSave.DataOffset),
+ context_offset (FloatSave.ErrorSelector),
+ /* XMM0-7 */
+ context_offset (ExtendedRegisters[10 * 16]),
+ context_offset (ExtendedRegisters[11 * 16]),
+ context_offset (ExtendedRegisters[12 * 16]),
+ context_offset (ExtendedRegisters[13 * 16]),
+ context_offset (ExtendedRegisters[14 * 16]),
+ context_offset (ExtendedRegisters[15 * 16]),
+ context_offset (ExtendedRegisters[16 * 16]),
+ context_offset (ExtendedRegisters[17 * 16]),
+ /* MXCSR */
+ context_offset (ExtendedRegisters[24]) };
#undef context_offset
#ifdef __x86_64__
#define context_offset(x) (offsetof (CONTEXT, x))
-static const int amd64_mappings[] =
-{
- context_offset (Rax),
- context_offset (Rbx),
- context_offset (Rcx),
- context_offset (Rdx),
- context_offset (Rsi),
- context_offset (Rdi),
- context_offset (Rbp),
- context_offset (Rsp),
- context_offset (R8),
- context_offset (R9),
- context_offset (R10),
- context_offset (R11),
- context_offset (R12),
- context_offset (R13),
- context_offset (R14),
- context_offset (R15),
- context_offset (Rip),
- context_offset (EFlags),
- context_offset (SegCs),
- context_offset (SegSs),
- context_offset (SegDs),
- context_offset (SegEs),
- context_offset (SegFs),
- context_offset (SegGs),
- context_offset (FloatSave.FloatRegisters[0]),
- context_offset (FloatSave.FloatRegisters[1]),
- context_offset (FloatSave.FloatRegisters[2]),
- context_offset (FloatSave.FloatRegisters[3]),
- context_offset (FloatSave.FloatRegisters[4]),
- context_offset (FloatSave.FloatRegisters[5]),
- context_offset (FloatSave.FloatRegisters[6]),
- context_offset (FloatSave.FloatRegisters[7]),
- context_offset (FloatSave.ControlWord),
- context_offset (FloatSave.StatusWord),
- context_offset (FloatSave.TagWord),
- context_offset (FloatSave.ErrorSelector),
- context_offset (FloatSave.ErrorOffset),
- context_offset (FloatSave.DataSelector),
- context_offset (FloatSave.DataOffset),
- context_offset (FloatSave.ErrorSelector)
- /* XMM0-7 */ ,
- context_offset (Xmm0),
- context_offset (Xmm1),
- context_offset (Xmm2),
- context_offset (Xmm3),
- context_offset (Xmm4),
- context_offset (Xmm5),
- context_offset (Xmm6),
- context_offset (Xmm7),
- context_offset (Xmm8),
- context_offset (Xmm9),
- context_offset (Xmm10),
- context_offset (Xmm11),
- context_offset (Xmm12),
- context_offset (Xmm13),
- context_offset (Xmm14),
- context_offset (Xmm15),
- /* MXCSR */
- context_offset (FloatSave.MxCsr)
-};
+static const int amd64_mappings[]
+ = { context_offset (Rax), context_offset (Rbx), context_offset (Rcx),
+ context_offset (Rdx), context_offset (Rsi), context_offset (Rdi),
+ context_offset (Rbp), context_offset (Rsp), context_offset (R8),
+ context_offset (R9), context_offset (R10), context_offset (R11),
+ context_offset (R12), context_offset (R13), context_offset (R14),
+ context_offset (R15), context_offset (Rip), context_offset (EFlags),
+ context_offset (SegCs), context_offset (SegSs), context_offset (SegDs),
+ context_offset (SegEs), context_offset (SegFs), context_offset (SegGs),
+ context_offset (FloatSave.FloatRegisters[0]),
+ context_offset (FloatSave.FloatRegisters[1]),
+ context_offset (FloatSave.FloatRegisters[2]),
+ context_offset (FloatSave.FloatRegisters[3]),
+ context_offset (FloatSave.FloatRegisters[4]),
+ context_offset (FloatSave.FloatRegisters[5]),
+ context_offset (FloatSave.FloatRegisters[6]),
+ context_offset (FloatSave.FloatRegisters[7]),
+ context_offset (FloatSave.ControlWord),
+ context_offset (FloatSave.StatusWord),
+ context_offset (FloatSave.TagWord),
+ context_offset (FloatSave.ErrorSelector),
+ context_offset (FloatSave.ErrorOffset),
+ context_offset (FloatSave.DataSelector),
+ context_offset (FloatSave.DataOffset),
+ context_offset (FloatSave.ErrorSelector)
+ /* XMM0-7 */,
+ context_offset (Xmm0), context_offset (Xmm1), context_offset (Xmm2),
+ context_offset (Xmm3), context_offset (Xmm4), context_offset (Xmm5),
+ context_offset (Xmm6), context_offset (Xmm7), context_offset (Xmm8),
+ context_offset (Xmm9), context_offset (Xmm10), context_offset (Xmm11),
+ context_offset (Xmm12), context_offset (Xmm13), context_offset (Xmm14),
+ context_offset (Xmm15),
+ /* MXCSR */
+ context_offset (FloatSave.MxCsr) };
#undef context_offset
#endif /* __x86_64__ */
@@ -462,7 +416,7 @@ static const int amd64_mappings[] =
/* Fetch register from gdbserver regcache data. */
static void
i386_fetch_inferior_register (struct regcache *regcache,
- windows_thread_info *th, int r)
+ windows_thread_info *th, int r)
{
const int *mappings;
#ifdef __x86_64__
@@ -498,7 +452,7 @@ i386_fetch_inferior_register (struct regcache *regcache,
/* Store a new register value into the thread context of TH. */
static void
i386_store_inferior_register (struct regcache *regcache,
- windows_thread_info *th, int r)
+ windows_thread_info *th, int r)
{
const int *mappings;
#ifdef __x86_64__
@@ -528,8 +482,8 @@ i386_arch_setup (void)
struct target_desc *tdesc;
#ifdef __x86_64__
- tdesc = amd64_create_target_description (X86_XSTATE_SSE_MASK, false,
- false, false);
+ tdesc = amd64_create_target_description (X86_XSTATE_SSE_MASK, false, false,
+ false);
init_target_desc (tdesc, amd64_expedite_regs);
win32_tdesc = tdesc;
#endif
@@ -602,24 +556,22 @@ i386_win32_set_pc (struct regcache *regcache, CORE_ADDR pc)
}
}
-struct win32_target_ops the_low_target = {
- i386_arch_setup,
- i386_win32_num_regs,
- i386_initial_stuff,
- i386_get_thread_context,
- i386_prepare_to_resume,
- i386_thread_added,
- i386_fetch_inferior_register,
- i386_store_inferior_register,
- i386_single_step,
- &i386_win32_breakpoint,
- i386_win32_breakpoint_len,
- 1,
- i386_win32_get_pc,
- i386_win32_set_pc,
- i386_supports_z_point_type,
- i386_insert_point,
- i386_remove_point,
- x86_stopped_by_watchpoint,
- x86_stopped_data_address
-};
+struct win32_target_ops the_low_target = { i386_arch_setup,
+ i386_win32_num_regs,
+ i386_initial_stuff,
+ i386_get_thread_context,
+ i386_prepare_to_resume,
+ i386_thread_added,
+ i386_fetch_inferior_register,
+ i386_store_inferior_register,
+ i386_single_step,
+ &i386_win32_breakpoint,
+ i386_win32_breakpoint_len,
+ 1,
+ i386_win32_get_pc,
+ i386_win32_set_pc,
+ i386_supports_z_point_type,
+ i386_insert_point,
+ i386_remove_point,
+ x86_stopped_by_watchpoint,
+ x86_stopped_data_address };
diff --git a/gdbserver/win32-low.cc b/gdbserver/win32-low.cc
index 756507709d8..1ae7bb2829f 100644
--- a/gdbserver/win32-low.cc
+++ b/gdbserver/win32-low.cc
@@ -45,17 +45,24 @@ gdbserver_windows_process windows_process;
#include <sys/cygwin.h>
#endif
-#define OUTMSG(X) do { printf X; fflush (stderr); } while (0)
-
-#define OUTMSG2(X) \
- do \
- { \
- if (debug_threads) \
- { \
- printf X; \
- fflush (stderr); \
- } \
- } while (0)
+#define OUTMSG(X) \
+ do \
+ { \
+ printf X; \
+ fflush (stderr); \
+ } \
+ while (0)
+
+#define OUTMSG2(X) \
+ do \
+ { \
+ if (debug_threads) \
+ { \
+ printf X; \
+ fflush (stderr); \
+ } \
+ } \
+ while (0)
#ifndef _T
#define _T(x) TEXT (x)
@@ -143,14 +150,15 @@ win32_require_context (windows_thread_info *th)
/* See nat/windows-nat.h. */
windows_thread_info *
-gdbserver_windows_process::thread_rec
- (ptid_t ptid, thread_disposition_type disposition)
+gdbserver_windows_process::thread_rec (ptid_t ptid,
+ thread_disposition_type disposition)
{
thread_info *thread = find_thread_ptid (ptid);
if (thread == NULL)
return NULL;
- windows_thread_info *th = (windows_thread_info *) thread_target_data (thread);
+ windows_thread_info *th
+ = (windows_thread_info *) thread_target_data (thread);
if (disposition != DONT_INVALIDATE_CONTEXT)
win32_require_context (th);
return th;
@@ -187,7 +195,8 @@ child_add_thread (DWORD pid, DWORD tid, HANDLE h, void *tlb)
static void
delete_thread_info (thread_info *thread)
{
- windows_thread_info *th = (windows_thread_info *) thread_target_data (thread);
+ windows_thread_info *th
+ = (windows_thread_info *) thread_target_data (thread);
remove_thread (thread);
delete th;
@@ -215,13 +224,13 @@ bool
win32_process_target::supports_z_point_type (char z_type)
{
return (z_type == Z_PACKET_SW_BP
- || (the_low_target.supports_z_point_type != NULL
- && the_low_target.supports_z_point_type (z_type)));
+ || (the_low_target.supports_z_point_type != NULL
+ && the_low_target.supports_z_point_type (z_type)));
}
int
win32_process_target::insert_point (enum raw_bkpt_type type, CORE_ADDR addr,
- int size, raw_breakpoint *bp)
+ int size, raw_breakpoint *bp)
{
if (type == raw_bkpt_type_sw)
return insert_memory_breakpoint (bp);
@@ -234,7 +243,7 @@ win32_process_target::insert_point (enum raw_bkpt_type type, CORE_ADDR addr,
int
win32_process_target::remove_point (enum raw_bkpt_type type, CORE_ADDR addr,
- int size, raw_breakpoint *bp)
+ int size, raw_breakpoint *bp)
{
if (type == raw_bkpt_type_sw)
return remove_memory_breakpoint (bp);
@@ -263,11 +272,10 @@ win32_process_target::stopped_data_address ()
return 0;
}
-
/* Transfer memory from/to the debugged process. */
static int
-child_xfer_memory (CORE_ADDR memaddr, char *our, int len,
- int write, process_stratum_target *target)
+child_xfer_memory (CORE_ADDR memaddr, char *our, int len, int write,
+ process_stratum_target *target)
{
BOOL success;
SIZE_T done = 0;
@@ -277,17 +285,17 @@ child_xfer_memory (CORE_ADDR memaddr, char *our, int len,
if (write)
{
success = WriteProcessMemory (windows_process.handle, (LPVOID) addr,
- (LPCVOID) our, len, &done);
+ (LPCVOID) our, len, &done);
if (!success)
- lasterror = GetLastError ();
+ lasterror = GetLastError ();
FlushInstructionCache (windows_process.handle, (LPCVOID) addr, len);
}
else
{
success = ReadProcessMemory (windows_process.handle, (LPCVOID) addr,
- (LPVOID) our, len, &done);
+ (LPVOID) our, len, &done);
if (!success)
- lasterror = GetLastError ();
+ lasterror = GetLastError ();
}
if (!success && lasterror == ERROR_PARTIAL_COPY && done > 0)
return done;
@@ -317,21 +325,21 @@ do_initial_child_stuff (HANDLE proch, DWORD pid, int attached)
windows_process.open_process_used = true;
memset (&windows_process.current_event, 0,
- sizeof (windows_process.current_event));
+ sizeof (windows_process.current_event));
#ifdef __x86_64__
BOOL wow64;
if (!IsWow64Process (proch, &wow64))
{
DWORD err = GetLastError ();
- error ("Check if WOW64 process failed (error %d): %s\n",
- (int) err, strwinerror (err));
+ error ("Check if WOW64 process failed (error %d): %s\n", (int) err,
+ strwinerror (err));
}
windows_process.wow64_process = wow64;
if (windows_process.wow64_process
&& (Wow64GetThreadContext == nullptr
- || Wow64SetThreadContext == nullptr))
+ || Wow64SetThreadContext == nullptr))
error ("WOW64 debugging is not supported on this system.\n");
windows_process.ignore_first_breakpoint
@@ -363,19 +371,19 @@ do_initial_child_stuff (HANDLE proch, DWORD pid, int attached)
/* Note win32_wait doesn't return thread events. */
if (status.kind () != TARGET_WAITKIND_LOADED)
- {
- windows_process.cached_status = status;
- break;
- }
+ {
+ windows_process.cached_status = status;
+ break;
+ }
{
- struct thread_resume resume;
+ struct thread_resume resume;
- resume.thread = minus_one_ptid;
- resume.kind = resume_continue;
- resume.sig = 0;
+ resume.thread = minus_one_ptid;
+ resume.kind = resume_continue;
+ resume.sig = 0;
- the_target->resume (&resume, 1);
+ the_target->resume (&resume, 1);
}
}
@@ -404,29 +412,30 @@ do_initial_child_stuff (HANDLE proch, DWORD pid, int attached)
static void
continue_one_thread (thread_info *thread, int thread_id)
{
- windows_thread_info *th = (windows_thread_info *) thread_target_data (thread);
+ windows_thread_info *th
+ = (windows_thread_info *) thread_target_data (thread);
if (thread_id == -1 || thread_id == th->tid)
{
win32_prepare_to_resume (th);
if (th->suspended)
- {
- DWORD *context_flags;
+ {
+ DWORD *context_flags;
#ifdef __x86_64__
- if (windows_process.wow64_process)
- context_flags = &th->wow64_context.ContextFlags;
- else
+ if (windows_process.wow64_process)
+ context_flags = &th->wow64_context.ContextFlags;
+ else
#endif
- context_flags = &th->context.ContextFlags;
- if (*context_flags)
- {
- win32_set_thread_context (th);
- *context_flags = 0;
- }
-
- th->resume ();
- }
+ context_flags = &th->context.ContextFlags;
+ if (*context_flags)
+ {
+ win32_set_thread_context (th);
+ *context_flags = 0;
+ }
+
+ th->resume ();
+ }
}
}
@@ -439,10 +448,8 @@ child_continue (DWORD continue_status, int thread_id)
/* The inferior will only continue after the ContinueDebugEvent
call. */
- for_each_thread ([&] (thread_info *thread)
- {
- continue_one_thread (thread, thread_id);
- });
+ for_each_thread (
+ [&] (thread_info *thread) { continue_one_thread (thread, thread_id); });
windows_process.faked_breakpoint = 0;
return continue_last_debug_event (continue_status, debug_threads);
@@ -454,8 +461,7 @@ child_fetch_inferior_registers (struct regcache *regcache, int r)
{
int regno;
windows_thread_info *th
- = windows_process.thread_rec (current_thread_ptid (),
- INVALIDATE_CONTEXT);
+ = windows_process.thread_rec (current_thread_ptid (), INVALIDATE_CONTEXT);
if (r == -1 || r > NUM_REGS)
child_fetch_inferior_registers (regcache, NUM_REGS);
else
@@ -470,8 +476,7 @@ child_store_inferior_registers (struct regcache *regcache, int r)
{
int regno;
windows_thread_info *th
- = windows_process.thread_rec (current_thread_ptid (),
- INVALIDATE_CONTEXT);
+ = windows_process.thread_rec (current_thread_ptid (), INVALIDATE_CONTEXT);
if (r == -1 || r == 0 || r > NUM_REGS)
child_store_inferior_registers (regcache, NUM_REGS);
else
@@ -480,8 +485,8 @@ child_store_inferior_registers (struct regcache *regcache, int r)
}
static BOOL
-create_process (const char *program, char *args,
- DWORD flags, PROCESS_INFORMATION *pi)
+create_process (const char *program, char *args, DWORD flags,
+ PROCESS_INFORMATION *pi)
{
const std::string &inferior_cwd = get_inferior_cwd ();
BOOL ret;
@@ -496,17 +501,18 @@ create_process (const char *program, char *args,
strcpy (program_and_args, program);
strcat (program_and_args, " ");
strcat (program_and_args, args);
- ret = create_process (program, /* image name */
- program_and_args, /* command line */
- flags, /* start flags */
- NULL, /* environment */
- /* current directory */
- (inferior_cwd.empty ()
- ? NULL
- : gdb_tilde_expand (inferior_cwd.c_str ()).c_str()),
- get_client_state ().disable_randomization,
- &si, /* start info */
- pi); /* proc info */
+ ret
+ = create_process (program, /* image name */
+ program_and_args, /* command line */
+ flags, /* start flags */
+ NULL, /* environment */
+ /* current directory */
+ (inferior_cwd.empty ()
+ ? NULL
+ : gdb_tilde_expand (inferior_cwd.c_str ()).c_str ()),
+ get_client_state ().disable_randomization,
+ &si, /* start info */
+ pi); /* proc info */
return ret;
}
@@ -518,7 +524,7 @@ create_process (const char *program, char *args,
process with the process list. */
int
win32_process_target::create_inferior (const char *program,
- const std::vector<char *> &program_args)
+ const std::vector<char *> &program_args)
{
client_state &cs = get_client_state ();
#ifndef USE_WIN32API
@@ -551,7 +557,7 @@ win32_process_target::create_inferior (const char *program,
strcpy (orig_path, path_ptr);
cygwin_conv_path_list (CCP_POSIX_TO_WIN_A, path_ptr, new_path, size);
setenv ("PATH", new_path, 1);
- }
+ }
cygwin_conv_path (CCP_POSIX_TO_WIN_A, program, real_path, PATH_MAX);
program = real_path;
#endif
@@ -579,8 +585,8 @@ win32_process_target::create_inferior (const char *program,
if (!ret)
{
- error ("Error creating process \"%s %s\", (error %d): %s\n",
- program, args, (int) err, strwinerror (err));
+ error ("Error creating process \"%s %s\", (error %d): %s\n", program,
+ args, (int) err, strwinerror (err));
}
else
{
@@ -614,28 +620,28 @@ win32_process_target::attach (unsigned long pid)
if (h != NULL)
{
if (DebugActiveProcess (pid))
- {
- DebugSetProcessKillOnExit (FALSE);
+ {
+ DebugSetProcessKillOnExit (FALSE);
- /* win32_wait needs to know we're attaching. */
- windows_process.attaching = 1;
- do_initial_child_stuff (h, pid, 1);
- return 0;
- }
+ /* win32_wait needs to know we're attaching. */
+ windows_process.attaching = 1;
+ do_initial_child_stuff (h, pid, 1);
+ return 0;
+ }
CloseHandle (h);
}
err = GetLastError ();
- error ("Attach to process failed (error %d): %s\n",
- (int) err, strwinerror (err));
+ error ("Attach to process failed (error %d): %s\n", (int) err,
+ strwinerror (err));
}
/* See nat/windows-nat.h. */
int
-gdbserver_windows_process::handle_output_debug_string
- (struct target_waitstatus *ourstatus)
+gdbserver_windows_process::handle_output_debug_string (
+ struct target_waitstatus *ourstatus)
{
#define READ_BUFFER_LEN 1024
CORE_ADDR addr;
@@ -656,22 +662,22 @@ gdbserver_windows_process::handle_output_debug_string
in Unicode. */
WCHAR buffer[(READ_BUFFER_LEN + 1) / sizeof (WCHAR)] = { 0 };
if (read_inferior_memory (addr, (unsigned char *) buffer, nbytes) != 0)
- return 0;
+ return 0;
wcstombs (s, buffer, (nbytes + 1) / sizeof (WCHAR));
}
else
{
if (read_inferior_memory (addr, (unsigned char *) s, nbytes) != 0)
- return 0;
+ return 0;
}
if (!startswith (s, "cYg"))
{
if (!server_waiting)
- {
- OUTMSG2(("%s", s));
- return 0;
- }
+ {
+ OUTMSG2 (("%s", s));
+ return 0;
+ }
monitor_output (s);
}
@@ -703,15 +709,15 @@ win32_process_target::kill (process_info *process)
for (;;)
{
if (!child_continue (DBG_CONTINUE, -1))
- break;
+ break;
if (!wait_for_debug_event (&windows_process.current_event, INFINITE))
- break;
+ break;
if (windows_process.current_event.dwDebugEventCode
- == EXIT_PROCESS_DEBUG_EVENT)
- break;
+ == EXIT_PROCESS_DEBUG_EVENT)
+ break;
else if (windows_process.current_event.dwDebugEventCode
- == OUTPUT_DEBUG_STRING_EVENT)
- windows_process.handle_output_debug_string (nullptr);
+ == OUTPUT_DEBUG_STRING_EVENT)
+ windows_process.handle_output_debug_string (nullptr);
}
win32_clear_inferiors ();
@@ -807,16 +813,16 @@ win32_process_target::resume (thread_resume *resume_info, size_t n)
if (sig != GDB_SIGNAL_0)
{
if (windows_process.current_event.dwDebugEventCode
- != EXCEPTION_DEBUG_EVENT)
- {
- OUTMSG (("Cannot continue with signal %s here.\n",
- gdb_signal_to_string (sig)));
- }
+ != EXCEPTION_DEBUG_EVENT)
+ {
+ OUTMSG (("Cannot continue with signal %s here.\n",
+ gdb_signal_to_string (sig)));
+ }
else if (sig == windows_process.last_sig)
- continue_status = DBG_EXCEPTION_NOT_HANDLED;
+ continue_status = DBG_EXCEPTION_NOT_HANDLED;
else
- OUTMSG (("Can only continue with received signal %s.\n",
- gdb_signal_to_string (windows_process.last_sig)));
+ OUTMSG (("Can only continue with received signal %s.\n",
+ gdb_signal_to_string (windows_process.last_sig)));
}
windows_process.last_sig = GDB_SIGNAL_0;
@@ -831,28 +837,28 @@ win32_process_target::resume (thread_resume *resume_info, size_t n)
DWORD *context_flags;
#ifdef __x86_64__
if (windows_process.wow64_process)
- context_flags = &th->wow64_context.ContextFlags;
+ context_flags = &th->wow64_context.ContextFlags;
else
#endif
- context_flags = &th->context.ContextFlags;
+ context_flags = &th->context.ContextFlags;
if (*context_flags)
- {
- /* Move register values from the inferior into the thread
+ {
+ /* Move register values from the inferior into the thread
context structure. */
- regcache_invalidate ();
-
- if (step)
- {
- if (the_low_target.single_step != NULL)
- (*the_low_target.single_step) (th);
- else
- error ("Single stepping is not supported "
- "in this configuration.\n");
- }
-
- win32_set_thread_context (th);
- *context_flags = 0;
- }
+ regcache_invalidate ();
+
+ if (step)
+ {
+ if (the_low_target.single_step != NULL)
+ (*the_low_target.single_step) (th);
+ else
+ error ("Single stepping is not supported "
+ "in this configuration.\n");
+ }
+
+ win32_set_thread_context (th);
+ *context_flags = 0;
+ }
}
/* Allow continuing with the same signal that interrupted us.
@@ -886,17 +892,17 @@ gdbserver_windows_process::handle_load_dll (const char *name, LPVOID base)
FindClose (h);
strcpy (buf, name);
{
- char cwd[MAX_PATH + 1];
- char *p;
- if (GetCurrentDirectoryA (MAX_PATH + 1, cwd))
- {
- p = strrchr (buf, '\\');
- if (p)
- p[1] = '\0';
- SetCurrentDirectoryA (buf);
- GetFullPathNameA (w32_fd.cFileName, MAX_PATH, buf, &p);
- SetCurrentDirectoryA (cwd);
- }
+ char cwd[MAX_PATH + 1];
+ char *p;
+ if (GetCurrentDirectoryA (MAX_PATH + 1, cwd))
+ {
+ p = strrchr (buf, '\\');
+ if (p)
+ p[1] = '\0';
+ SetCurrentDirectoryA (buf);
+ GetFullPathNameA (w32_fd.cFileName, MAX_PATH, buf, &p);
+ SetCurrentDirectoryA (cwd);
+ }
}
}
@@ -920,8 +926,8 @@ gdbserver_windows_process::handle_load_dll (const char *name, LPVOID base)
void
gdbserver_windows_process::handle_unload_dll ()
{
- CORE_ADDR load_addr =
- (CORE_ADDR) (uintptr_t) current_event.u.UnloadDll.lpBaseOfDll;
+ CORE_ADDR load_addr
+ = (CORE_ADDR) (uintptr_t) current_event.u.UnloadDll.lpBaseOfDll;
/* The symbols in a dll are offset by 0x1000, which is the
offset from 0 of the first byte in an image - because
@@ -933,7 +939,8 @@ gdbserver_windows_process::handle_unload_dll ()
static void
suspend_one_thread (thread_info *thread)
{
- windows_thread_info *th = (windows_thread_info *) thread_target_data (thread);
+ windows_thread_info *th
+ = (windows_thread_info *) thread_target_data (thread);
th->suspend ();
}
@@ -941,12 +948,12 @@ suspend_one_thread (thread_info *thread)
static void
fake_breakpoint_event (void)
{
- OUTMSG2(("fake_breakpoint_event\n"));
+ OUTMSG2 (("fake_breakpoint_event\n"));
windows_process.faked_breakpoint = 1;
memset (&windows_process.current_event, 0,
- sizeof (windows_process.current_event));
+ sizeof (windows_process.current_event));
windows_process.current_event.dwThreadId = windows_process.main_thread_id;
windows_process.current_event.dwDebugEventCode = EXCEPTION_DEBUG_EVENT;
windows_process.current_event.u.Exception.ExceptionRecord.ExceptionCode
@@ -958,8 +965,8 @@ fake_breakpoint_event (void)
/* See nat/windows-nat.h. */
bool
-gdbserver_windows_process::handle_access_violation
- (const EXCEPTION_RECORD *rec)
+gdbserver_windows_process::handle_access_violation (
+ const EXCEPTION_RECORD *rec)
{
return false;
}
@@ -976,14 +983,16 @@ maybe_adjust_pc ()
windows_thread_info *th
= windows_process.thread_rec (current_thread_ptid (),
- DONT_INVALIDATE_CONTEXT);
+ DONT_INVALIDATE_CONTEXT);
th->stopped_at_software_breakpoint = false;
if (windows_process.current_event.dwDebugEventCode == EXCEPTION_DEBUG_EVENT
- && ((windows_process.current_event.u.Exception.ExceptionRecord.ExceptionCode
- == EXCEPTION_BREAKPOINT)
- || (windows_process.current_event.u.Exception.ExceptionRecord.ExceptionCode
- == STATUS_WX86_BREAKPOINT))
+ && ((windows_process.current_event.u.Exception.ExceptionRecord
+ .ExceptionCode
+ == EXCEPTION_BREAKPOINT)
+ || (windows_process.current_event.u.Exception.ExceptionRecord
+ .ExceptionCode
+ == STATUS_WX86_BREAKPOINT))
&& windows_process.child_initialization_done)
{
th->stopped_at_software_breakpoint = true;
@@ -997,7 +1006,7 @@ maybe_adjust_pc ()
static int
get_child_debug_event (DWORD *continue_status,
- struct target_waitstatus *ourstatus)
+ struct target_waitstatus *ourstatus)
{
ptid_t ptid;
@@ -1023,11 +1032,11 @@ get_child_debug_event (DWORD *continue_status,
= windows_process.fetch_pending_stop (debug_threads);
if (stop.has_value ())
{
- *ourstatus = stop->status;
- windows_process.current_event = stop->event;
- ptid = debug_event_ptid (&windows_process.current_event);
- switch_to_thread (find_thread_ptid (ptid));
- return 1;
+ *ourstatus = stop->status;
+ windows_process.current_event = stop->event;
+ ptid = debug_event_ptid (&windows_process.current_event);
+ switch_to_thread (find_thread_ptid (ptid));
+ return 1;
}
/* Keep the wait time low enough for comfortable remote
@@ -1035,101 +1044,100 @@ get_child_debug_event (DWORD *continue_status,
bottleneck. */
if (!wait_for_debug_event (&windows_process.current_event, 250))
{
- DWORD e = GetLastError();
+ DWORD e = GetLastError ();
- if (e == ERROR_PIPE_NOT_CONNECTED)
- {
- /* This will happen if the loader fails to succesfully
+ if (e == ERROR_PIPE_NOT_CONNECTED)
+ {
+ /* This will happen if the loader fails to succesfully
load the application, e.g., if the main executable
tries to pull in a non-existing export from a
DLL. */
- ourstatus->set_exited (1);
- return 1;
- }
+ ourstatus->set_exited (1);
+ return 1;
+ }
- return 0;
+ return 0;
}
}
- gotevent:
+gotevent:
switch (current_event->dwDebugEventCode)
{
case CREATE_THREAD_DEBUG_EVENT:
OUTMSG2 (("gdbserver: kernel event CREATE_THREAD_DEBUG_EVENT "
- "for pid=%u tid=%x)\n",
- (unsigned) current_event->dwProcessId,
- (unsigned) current_event->dwThreadId));
+ "for pid=%u tid=%x)\n",
+ (unsigned) current_event->dwProcessId,
+ (unsigned) current_event->dwThreadId));
/* Record the existence of this thread. */
- child_add_thread (current_event->dwProcessId,
- current_event->dwThreadId,
- current_event->u.CreateThread.hThread,
- current_event->u.CreateThread.lpThreadLocalBase);
+ child_add_thread (current_event->dwProcessId, current_event->dwThreadId,
+ current_event->u.CreateThread.hThread,
+ current_event->u.CreateThread.lpThreadLocalBase);
break;
case EXIT_THREAD_DEBUG_EVENT:
OUTMSG2 (("gdbserver: kernel event EXIT_THREAD_DEBUG_EVENT "
- "for pid=%u tid=%x\n",
- (unsigned) current_event->dwProcessId,
- (unsigned) current_event->dwThreadId));
+ "for pid=%u tid=%x\n",
+ (unsigned) current_event->dwProcessId,
+ (unsigned) current_event->dwThreadId));
child_delete_thread (current_event->dwProcessId,
- current_event->dwThreadId);
+ current_event->dwThreadId);
switch_to_thread (get_first_thread ());
return 1;
case CREATE_PROCESS_DEBUG_EVENT:
OUTMSG2 (("gdbserver: kernel event CREATE_PROCESS_DEBUG_EVENT "
- "for pid=%u tid=%x\n",
- (unsigned) current_event->dwProcessId,
- (unsigned) current_event->dwThreadId));
+ "for pid=%u tid=%x\n",
+ (unsigned) current_event->dwProcessId,
+ (unsigned) current_event->dwThreadId));
CloseHandle (current_event->u.CreateProcessInfo.hFile);
if (windows_process.open_process_used)
- {
- CloseHandle (windows_process.handle);
- windows_process.open_process_used = false;
- }
+ {
+ CloseHandle (windows_process.handle);
+ windows_process.open_process_used = false;
+ }
windows_process.handle = current_event->u.CreateProcessInfo.hProcess;
windows_process.main_thread_id = current_event->dwThreadId;
/* Add the main thread. */
child_add_thread (current_event->dwProcessId,
- windows_process.main_thread_id,
- current_event->u.CreateProcessInfo.hThread,
- current_event->u.CreateProcessInfo.lpThreadLocalBase);
+ windows_process.main_thread_id,
+ current_event->u.CreateProcessInfo.hThread,
+ current_event->u.CreateProcessInfo.lpThreadLocalBase);
break;
case EXIT_PROCESS_DEBUG_EVENT:
OUTMSG2 (("gdbserver: kernel event EXIT_PROCESS_DEBUG_EVENT "
- "for pid=%u tid=%x\n",
- (unsigned) current_event->dwProcessId,
- (unsigned) current_event->dwThreadId));
+ "for pid=%u tid=%x\n",
+ (unsigned) current_event->dwProcessId,
+ (unsigned) current_event->dwThreadId));
{
- DWORD exit_status = current_event->u.ExitProcess.dwExitCode;
- /* If the exit status looks like a fatal exception, but we
+ DWORD exit_status = current_event->u.ExitProcess.dwExitCode;
+ /* If the exit status looks like a fatal exception, but we
don't recognize the exception's code, make the original
exit status value available, to avoid losing information. */
- int exit_signal
- = WIFSIGNALED (exit_status) ? WTERMSIG (exit_status) : -1;
- if (exit_signal == -1)
- ourstatus->set_exited (exit_status);
- else
- ourstatus->set_signalled (gdb_signal_from_host (exit_signal));
+ int exit_signal
+ = WIFSIGNALED (exit_status) ? WTERMSIG (exit_status) : -1;
+ if (exit_signal == -1)
+ ourstatus->set_exited (exit_status);
+ else
+ ourstatus->set_signalled (gdb_signal_from_host (exit_signal));
}
child_continue (DBG_CONTINUE, windows_process.desired_stop_thread_id);
break;
case LOAD_DLL_DEBUG_EVENT:
OUTMSG2 (("gdbserver: kernel event LOAD_DLL_DEBUG_EVENT "
- "for pid=%u tid=%x\n",
- (unsigned) current_event->dwProcessId,
- (unsigned) current_event->dwThreadId));
+ "for pid=%u tid=%x\n",
+ (unsigned) current_event->dwProcessId,
+ (unsigned) current_event->dwThreadId));
CloseHandle (current_event->u.LoadDll.hFile);
- if (! windows_process.child_initialization_done)
- break;
+ if (!windows_process.child_initialization_done)
+ break;
windows_process.dll_loaded_event ();
ourstatus->set_loaded ();
@@ -1137,40 +1145,40 @@ get_child_debug_event (DWORD *continue_status,
case UNLOAD_DLL_DEBUG_EVENT:
OUTMSG2 (("gdbserver: kernel event UNLOAD_DLL_DEBUG_EVENT "
- "for pid=%u tid=%x\n",
- (unsigned) current_event->dwProcessId,
- (unsigned) current_event->dwThreadId));
- if (! windows_process.child_initialization_done)
- break;
+ "for pid=%u tid=%x\n",
+ (unsigned) current_event->dwProcessId,
+ (unsigned) current_event->dwThreadId));
+ if (!windows_process.child_initialization_done)
+ break;
windows_process.handle_unload_dll ();
ourstatus->set_loaded ();
break;
case EXCEPTION_DEBUG_EVENT:
OUTMSG2 (("gdbserver: kernel event EXCEPTION_DEBUG_EVENT "
- "for pid=%u tid=%x\n",
- (unsigned) current_event->dwProcessId,
- (unsigned) current_event->dwThreadId));
+ "for pid=%u tid=%x\n",
+ (unsigned) current_event->dwProcessId,
+ (unsigned) current_event->dwThreadId));
if (windows_process.handle_exception (ourstatus, debug_threads)
- == HANDLE_EXCEPTION_UNHANDLED)
- *continue_status = DBG_EXCEPTION_NOT_HANDLED;
+ == HANDLE_EXCEPTION_UNHANDLED)
+ *continue_status = DBG_EXCEPTION_NOT_HANDLED;
break;
case OUTPUT_DEBUG_STRING_EVENT:
/* A message from the kernel (or Cygwin). */
OUTMSG2 (("gdbserver: kernel event OUTPUT_DEBUG_STRING_EVENT "
- "for pid=%u tid=%x\n",
- (unsigned) current_event->dwProcessId,
- (unsigned) current_event->dwThreadId));
+ "for pid=%u tid=%x\n",
+ (unsigned) current_event->dwProcessId,
+ (unsigned) current_event->dwThreadId));
windows_process.handle_output_debug_string (nullptr);
break;
default:
OUTMSG2 (("gdbserver: kernel event unknown "
- "for pid=%u tid=%x code=%x\n",
- (unsigned) current_event->dwProcessId,
- (unsigned) current_event->dwThreadId,
- (unsigned) current_event->dwDebugEventCode));
+ "for pid=%u tid=%x code=%x\n",
+ (unsigned) current_event->dwProcessId,
+ (unsigned) current_event->dwThreadId,
+ (unsigned) current_event->dwDebugEventCode));
break;
}
@@ -1182,11 +1190,11 @@ get_child_debug_event (DWORD *continue_status,
/* Pending stop. See the comment by the definition of
"pending_stops" for details on why this is needed. */
OUTMSG2 (("get_windows_debug_event - "
- "unexpected stop in 0x%lx (expecting 0x%x)\n",
- ptid.lwp (), windows_process.desired_stop_thread_id));
+ "unexpected stop in 0x%lx (expecting 0x%x)\n",
+ ptid.lwp (), windows_process.desired_stop_thread_id));
maybe_adjust_pc ();
- windows_process.pending_stops.push_back
- ({(DWORD) ptid.lwp (), *ourstatus, *current_event});
+ windows_process.pending_stops.push_back (
+ { (DWORD) ptid.lwp (), *ourstatus, *current_event });
ourstatus->set_spurious ();
}
else
@@ -1200,7 +1208,7 @@ get_child_debug_event (DWORD *continue_status,
Returns the signal which caused the process to stop. */
ptid_t
win32_process_target::wait (ptid_t ptid, target_waitstatus *ourstatus,
- target_wait_flags options)
+ target_wait_flags options)
{
if (windows_process.cached_status.kind () != TARGET_WAITKIND_IGNORE)
{
@@ -1217,34 +1225,33 @@ win32_process_target::wait (ptid_t ptid, target_waitstatus *ourstatus,
{
DWORD continue_status;
if (!get_child_debug_event (&continue_status, ourstatus))
- continue;
+ continue;
switch (ourstatus->kind ())
- {
- case TARGET_WAITKIND_EXITED:
- OUTMSG2 (("Child exited with retcode = %x\n",
- ourstatus->exit_status ()));
- win32_clear_inferiors ();
- return ptid_t (windows_process.current_event.dwProcessId);
- case TARGET_WAITKIND_STOPPED:
- case TARGET_WAITKIND_SIGNALLED:
- case TARGET_WAITKIND_LOADED:
- {
- OUTMSG2 (("Child Stopped with signal = %d \n",
- ourstatus->sig ()));
- maybe_adjust_pc ();
- return debug_event_ptid (&windows_process.current_event);
- }
- default:
- OUTMSG (("Ignoring unknown internal event, %d\n",
- ourstatus->kind ()));
- /* fall-through */
- case TARGET_WAITKIND_SPURIOUS:
- /* do nothing, just continue */
- child_continue (continue_status,
- windows_process.desired_stop_thread_id);
- break;
- }
+ {
+ case TARGET_WAITKIND_EXITED:
+ OUTMSG2 (
+ ("Child exited with retcode = %x\n", ourstatus->exit_status ()));
+ win32_clear_inferiors ();
+ return ptid_t (windows_process.current_event.dwProcessId);
+ case TARGET_WAITKIND_STOPPED:
+ case TARGET_WAITKIND_SIGNALLED:
+ case TARGET_WAITKIND_LOADED:
+ {
+ OUTMSG2 (("Child Stopped with signal = %d \n", ourstatus->sig ()));
+ maybe_adjust_pc ();
+ return debug_event_ptid (&windows_process.current_event);
+ }
+ default:
+ OUTMSG (
+ ("Ignoring unknown internal event, %d\n", ourstatus->kind ()));
+ /* fall-through */
+ case TARGET_WAITKIND_SPURIOUS:
+ /* do nothing, just continue */
+ child_continue (continue_status,
+ windows_process.desired_stop_thread_id);
+ break;
+ }
}
}
@@ -1269,7 +1276,7 @@ win32_process_target::store_registers (regcache *regcache, int regno)
Read LEN bytes at MEMADDR into a buffer at MYADDR. */
int
win32_process_target::read_memory (CORE_ADDR memaddr, unsigned char *myaddr,
- int len)
+ int len)
{
return child_xfer_memory (memaddr, (char *) myaddr, len, 0, 0) != len;
}
@@ -1280,7 +1287,7 @@ win32_process_target::read_memory (CORE_ADDR memaddr, unsigned char *myaddr,
Returns 0 on success and errno on failure. */
int
win32_process_target::write_memory (CORE_ADDR memaddr,
- const unsigned char *myaddr, int len)
+ const unsigned char *myaddr, int len)
{
return child_xfer_memory (memaddr, (char *) myaddr, len, 1, 0) != len;
}
@@ -1319,10 +1326,9 @@ win32_process_target::supports_qxfer_siginfo ()
/* Write Windows signal info. */
int
-win32_process_target::qxfer_siginfo (const char *annex,
- unsigned char *readbuf,
- unsigned const char *writebuf,
- CORE_ADDR offset, int len)
+win32_process_target::qxfer_siginfo (const char *annex, unsigned char *readbuf,
+ unsigned const char *writebuf,
+ CORE_ADDR offset, int len)
{
if (windows_process.siginfo_er.ExceptionCode == 0)
return -1;
@@ -1343,14 +1349,14 @@ win32_process_target::qxfer_siginfo (const char *annex,
er32.ExceptionCode = windows_process.siginfo_er.ExceptionCode;
er32.ExceptionFlags = windows_process.siginfo_er.ExceptionFlags;
er32.ExceptionRecord
- = (uintptr_t) windows_process.siginfo_er.ExceptionRecord;
+ = (uintptr_t) windows_process.siginfo_er.ExceptionRecord;
er32.ExceptionAddress
- = (uintptr_t) windows_process.siginfo_er.ExceptionAddress;
+ = (uintptr_t) windows_process.siginfo_er.ExceptionAddress;
er32.NumberParameters = windows_process.siginfo_er.NumberParameters;
int i;
for (i = 0; i < EXCEPTION_MAXIMUM_PARAMETERS; i++)
- er32.ExceptionInformation[i]
- = windows_process.siginfo_er.ExceptionInformation[i];
+ er32.ExceptionInformation[i]
+ = windows_process.siginfo_er.ExceptionInformation[i];
}
#endif
@@ -1399,7 +1405,7 @@ win32_process_target::stopped_by_sw_breakpoint ()
{
windows_thread_info *th
= windows_process.thread_rec (current_thread_ptid (),
- DONT_INVALIDATE_CONTEXT);
+ DONT_INVALIDATE_CONTEXT);
return th == nullptr ? false : th->stopped_at_software_breakpoint;
}
@@ -1426,7 +1432,7 @@ win32_process_target::thread_name (ptid_t thread)
{
windows_thread_info *th
= windows_process.thread_rec (current_thread_ptid (),
- DONT_INVALIDATE_CONTEXT);
+ DONT_INVALIDATE_CONTEXT);
return th->thread_name ();
}
diff --git a/gdbserver/win32-low.h b/gdbserver/win32-low.h
index 6a0b8cf9c84..9da6debcf02 100644
--- a/gdbserver/win32-low.h
+++ b/gdbserver/win32-low.h
@@ -53,13 +53,13 @@ struct win32_target_ops
/* Fetch register from gdbserver regcache data. */
void (*fetch_inferior_register) (struct regcache *regcache,
- windows_nat::windows_thread_info *th,
- int r);
+ windows_nat::windows_thread_info *th,
+ int r);
/* Store a new register value into the thread context of TH. */
void (*store_inferior_register) (struct regcache *regcache,
- windows_nat::windows_thread_info *th,
- int r);
+ windows_nat::windows_thread_info *th,
+ int r);
void (*single_step) (windows_nat::windows_thread_info *th);
@@ -77,10 +77,10 @@ struct win32_target_ops
/* Breakpoint/Watchpoint related functions. See target.h for comments. */
int (*supports_z_point_type) (char z_type);
- int (*insert_point) (enum raw_bkpt_type type, CORE_ADDR addr,
- int size, struct raw_breakpoint *bp);
- int (*remove_point) (enum raw_bkpt_type type, CORE_ADDR addr,
- int size, struct raw_breakpoint *bp);
+ int (*insert_point) (enum raw_bkpt_type type, CORE_ADDR addr, int size,
+ struct raw_breakpoint *bp);
+ int (*remove_point) (enum raw_bkpt_type type, CORE_ADDR addr, int size,
+ struct raw_breakpoint *bp);
int (*stopped_by_watchpoint) (void);
CORE_ADDR (*stopped_data_address) (void);
};
@@ -92,9 +92,8 @@ extern struct win32_target_ops the_low_target;
class win32_process_target : public process_stratum_target
{
public:
-
int create_inferior (const char *program,
- const std::vector<char *> &program_args) override;
+ const std::vector<char *> &program_args) override;
int attach (unsigned long pid) override;
@@ -111,27 +110,26 @@ public:
void resume (thread_resume *resume_info, size_t n) override;
ptid_t wait (ptid_t ptid, target_waitstatus *status,
- target_wait_flags options) override;
+ target_wait_flags options) override;
void fetch_registers (regcache *regcache, int regno) override;
void store_registers (regcache *regcache, int regno) override;
- int read_memory (CORE_ADDR memaddr, unsigned char *myaddr,
- int len) override;
+ int read_memory (CORE_ADDR memaddr, unsigned char *myaddr, int len) override;
int write_memory (CORE_ADDR memaddr, const unsigned char *myaddr,
- int len) override;
+ int len) override;
void request_interrupt () override;
bool supports_z_point_type (char z_type) override;
- int insert_point (enum raw_bkpt_type type, CORE_ADDR addr,
- int size, raw_breakpoint *bp) override;
+ int insert_point (enum raw_bkpt_type type, CORE_ADDR addr, int size,
+ raw_breakpoint *bp) override;
- int remove_point (enum raw_bkpt_type type, CORE_ADDR addr,
- int size, raw_breakpoint *bp) override;
+ int remove_point (enum raw_bkpt_type type, CORE_ADDR addr, int size,
+ raw_breakpoint *bp) override;
bool supports_hardware_single_step () override;
@@ -142,8 +140,8 @@ public:
bool supports_qxfer_siginfo () override;
int qxfer_siginfo (const char *annex, unsigned char *readbuf,
- unsigned const char *writebuf,
- CORE_ADDR offset, int len) override;
+ unsigned const char *writebuf, CORE_ADDR offset,
+ int len) override;
bool supports_get_tib_address () override;
@@ -161,8 +159,7 @@ public:
const char *thread_name (ptid_t thread) override;
- bool supports_pid_to_exec_file () override
- { return true; }
+ bool supports_pid_to_exec_file () override { return true; }
const char *pid_to_exec_file (int pid) override;
@@ -174,10 +171,11 @@ public:
struct gdbserver_windows_process : public windows_nat::windows_process_info
{
- windows_nat::windows_thread_info *thread_rec
- (ptid_t ptid,
- windows_nat::thread_disposition_type disposition) override;
- int handle_output_debug_string (struct target_waitstatus *ourstatus) override;
+ windows_nat::windows_thread_info *
+ thread_rec (ptid_t ptid,
+ windows_nat::thread_disposition_type disposition) override;
+ int
+ handle_output_debug_string (struct target_waitstatus *ourstatus) override;
void handle_load_dll (const char *dll_name, LPVOID base) override;
void handle_unload_dll () override;
bool handle_access_violation (const EXCEPTION_RECORD *rec) override;
diff --git a/gdbserver/x86-low.cc b/gdbserver/x86-low.cc
index f6f7a3c2d2f..eddf963e9d1 100644
--- a/gdbserver/x86-low.cc
+++ b/gdbserver/x86-low.cc
@@ -29,10 +29,10 @@ x86_low_init_dregs (struct x86_debug_reg_state *state)
int i;
ALL_DEBUG_ADDRESS_REGISTERS (i)
- {
- state->dr_mirror[i] = 0;
- state->dr_ref_count[i] = 0;
- }
+ {
+ state->dr_mirror[i] = 0;
+ state->dr_ref_count[i] = 0;
+ }
state->dr_control_mirror = 0;
- state->dr_status_mirror = 0;
+ state->dr_status_mirror = 0;
}
diff --git a/gdbserver/x86-tdesc.h b/gdbserver/x86-tdesc.h
index 96103228856..eae5ef591c7 100644
--- a/gdbserver/x86-tdesc.h
+++ b/gdbserver/x86-tdesc.h
@@ -22,11 +22,11 @@
variable is used depends on host/configuration, we mark it
ATTRIBUTE_UNUSED to keep it simple here. */
static const char *i386_expedite_regs[] ATTRIBUTE_UNUSED
- = {"ebp", "esp", "eip", NULL};
+ = { "ebp", "esp", "eip", NULL };
#ifdef __x86_64__
/* The "expedite" registers for x86_64 targets. */
-static const char *amd64_expedite_regs[] = {"rbp", "rsp", "rip", NULL};
+static const char *amd64_expedite_regs[] = { "rbp", "rsp", "rip", NULL };
#endif
#endif /* GDBSERVER_X86_TDESC_H */
diff --git a/gdbserver/xtensa-xtregs.cc b/gdbserver/xtensa-xtregs.cc
index 12a4a25b729..837e008f01c 100644
--- a/gdbserver/xtensa-xtregs.cc
+++ b/gdbserver/xtensa-xtregs.cc
@@ -16,22 +16,22 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
-
-typedef struct {
- int gdb_regnum;
- int gdb_offset;
- int ptrace_cp_offset;
- int ptrace_offset;
- int size;
- int coproc;
- int dbnum;
- char* name
-;} xtensa_regtable_t;
-
-#define XTENSA_ELF_XTREG_SIZE 4
-
-const xtensa_regtable_t xtensa_regmap_table[] = {
+typedef struct
+{
+ int gdb_regnum;
+ int gdb_offset;
+ int ptrace_cp_offset;
+ int ptrace_offset;
+ int size;
+ int coproc;
+ int dbnum;
+ char *name;
+} xtensa_regtable_t;
+
+#define XTENSA_ELF_XTREG_SIZE 4
+
+const xtensa_regtable_t xtensa_regmap_table[] = {
/* gnum,gofs,cpofs,ofs,siz,cp, dbnum, name */
- { 44, 176, 0, 0, 4, -1, 0x020c, "scompare1" },
+ { 44, 176, 0, 0, 4, -1, 0x020c, "scompare1" },
{ 0 }
};
diff --git a/gdbsupport/agent.cc b/gdbsupport/agent.cc
index 531807be3d2..56f1a9f353a 100644
--- a/gdbsupport/agent.cc
+++ b/gdbsupport/agent.cc
@@ -30,8 +30,7 @@ bool debug_agent = false;
/* A stdarg wrapper for debug_vprintf. */
-static void ATTRIBUTE_PRINTF (1, 2)
-debug_agent_printf (const char *fmt, ...)
+static void ATTRIBUTE_PRINTF (1, 2) debug_agent_printf (const char *fmt, ...)
{
va_list ap;
@@ -66,9 +65,9 @@ static struct
const char *name;
int offset;
} symbol_list[] = {
- IPA_SYM(helper_thread_id),
- IPA_SYM(cmd_buf),
- IPA_SYM(capability),
+ IPA_SYM (helper_thread_id),
+ IPA_SYM (cmd_buf),
+ IPA_SYM (capability),
};
static struct ipa_sym_addresses_common ipa_sym_addrs;
@@ -91,16 +90,16 @@ agent_look_up_symbols (void *arg)
for (int i = 0; i < sizeof (symbol_list) / sizeof (symbol_list[0]); i++)
{
- CORE_ADDR *addrp =
- (CORE_ADDR *) ((char *) &ipa_sym_addrs + symbol_list[i].offset);
+ CORE_ADDR *addrp
+ = (CORE_ADDR *) ((char *) &ipa_sym_addrs + symbol_list[i].offset);
struct objfile *objfile = (struct objfile *) arg;
- if (find_minimal_symbol_address (symbol_list[i].name, addrp,
- objfile) != 0)
- {
- DEBUG_AGENT ("symbol `%s' not found\n", symbol_list[i].name);
- return -1;
- }
+ if (find_minimal_symbol_address (symbol_list[i].name, addrp, objfile)
+ != 0)
+ {
+ DEBUG_AGENT ("symbol `%s' not found\n", symbol_list[i].name);
+ return -1;
+ }
}
all_agent_symbols_looked_up = true;
@@ -110,11 +109,11 @@ agent_look_up_symbols (void *arg)
static unsigned int
agent_get_helper_thread_id (void)
{
- if (helper_thread_id == 0)
+ if (helper_thread_id == 0)
{
if (target_read_uint32 (ipa_sym_addrs.addr_helper_thread_id,
- &helper_thread_id))
- warning (_("Error reading helper thread's id in lib"));
+ &helper_thread_id))
+ warning (_ ("Error reading helper thread's id in lib"));
}
return helper_thread_id;
@@ -126,7 +125,7 @@ agent_get_helper_thread_id (void)
#define SOCK_DIR P_tmpdir
#ifndef UNIX_PATH_MAX
-#define UNIX_PATH_MAX sizeof(((struct sockaddr_un *) NULL)->sun_path)
+#define UNIX_PATH_MAX sizeof (((struct sockaddr_un *) NULL)->sun_path)
#endif
#endif
@@ -149,7 +148,7 @@ gdb_connect_sync_socket (int pid)
res = fd = gdb_socket_cloexec (PF_UNIX, SOCK_STREAM, 0);
if (res == -1)
{
- warning (_("error opening sync socket: %s"), safe_strerror (errno));
+ warning (_ ("error opening sync socket: %s"), safe_strerror (errno));
return -1;
}
@@ -158,7 +157,7 @@ gdb_connect_sync_socket (int pid)
res = xsnprintf (addr.sun_path, UNIX_PATH_MAX, "%s", path);
if (res >= UNIX_PATH_MAX)
{
- warning (_("string overflow allocating socket name"));
+ warning (_ ("string overflow allocating socket name"));
close (fd);
return -1;
}
@@ -166,9 +165,9 @@ gdb_connect_sync_socket (int pid)
res = connect (fd, (struct sockaddr *) &addr, sizeof (addr));
if (res == -1)
{
- warning (_("error connecting sync socket (%s): %s. "
- "Make sure the directory exists and that it is writable."),
- path, safe_strerror (errno));
+ warning (_ ("error connecting sync socket (%s): %s. "
+ "Make sure the directory exists and that it is writable."),
+ path, safe_strerror (errno));
close (fd);
return -1;
}
@@ -192,12 +191,12 @@ agent_run_command (int pid, const char *cmd, int len)
int tid = agent_get_helper_thread_id ();
ptid_t ptid = ptid_t (pid, tid);
- int ret = target_write_memory (ipa_sym_addrs.addr_cmd_buf,
- (gdb_byte *) cmd, len);
+ int ret
+ = target_write_memory (ipa_sym_addrs.addr_cmd_buf, (gdb_byte *) cmd, len);
if (ret != 0)
{
- warning (_("unable to write"));
+ warning (_ ("unable to write"));
return -1;
}
@@ -214,16 +213,18 @@ agent_run_command (int pid, const char *cmd, int len)
DEBUG_AGENT ("agent: signalling helper thread\n");
do
- {
- ret = write (fd, buf, 1);
- } while (ret == -1 && errno == EINTR);
+ {
+ ret = write (fd, buf, 1);
+ }
+ while (ret == -1 && errno == EINTR);
- DEBUG_AGENT ("agent: waiting for helper thread's response\n");
+ DEBUG_AGENT ("agent: waiting for helper thread's response\n");
do
- {
- ret = read (fd, buf, 1);
- } while (ret == -1 && errno == EINTR);
+ {
+ ret = read (fd, buf, 1);
+ }
+ while (ret == -1 && errno == EINTR);
close (fd);
@@ -243,11 +244,11 @@ agent_run_command (int pid, const char *cmd, int len)
if (fd >= 0)
{
if (target_read_memory (ipa_sym_addrs.addr_cmd_buf, (gdb_byte *) cmd,
- IPA_CMD_BUF_SIZE))
- {
- warning (_("Error reading command response"));
- return -1;
- }
+ IPA_CMD_BUF_SIZE))
+ {
+ warning (_ ("Error reading command response"));
+ return -1;
+ }
}
return 0;
@@ -264,8 +265,8 @@ agent_capability_check (enum agent_capa agent_capa)
if (agent_capability == 0)
{
if (target_read_uint32 (ipa_sym_addrs.addr_capability,
- &agent_capability))
- warning (_("Error reading capability of agent"));
+ &agent_capability))
+ warning (_ ("Error reading capability of agent"));
}
return (agent_capability & agent_capa) != 0;
}
diff --git a/gdbsupport/agent.h b/gdbsupport/agent.h
index dceb33f6bd5..cf181f2eefc 100644
--- a/gdbsupport/agent.h
+++ b/gdbsupport/agent.h
@@ -26,16 +26,16 @@ int agent_run_command (int pid, const char *cmd, int len);
int agent_look_up_symbols (void *);
-#define IPA_SYM_EXPORTED_NAME(SYM) gdb_agent_ ## SYM
+#define IPA_SYM_EXPORTED_NAME(SYM) gdb_agent_##SYM
/* Define an entry in an IPA symbol list array. If IPA_SYM is used, the macro
IPA_SYM_STRUCT_NAME must be defined to the structure name holding the IPA
symbol addresses in that particular file, before including
gdbsupport/agent.h. */
-#define IPA_SYM(SYM) \
- { \
- STRINGIFY (IPA_SYM_EXPORTED_NAME (SYM)), \
- offsetof (IPA_SYM_STRUCT_NAME, addr_ ## SYM) \
+#define IPA_SYM(SYM) \
+ { \
+ STRINGIFY (IPA_SYM_EXPORTED_NAME (SYM)), \
+ offsetof (IPA_SYM_STRUCT_NAME, addr_##SYM) \
}
/* The size in bytes of the buffer used to talk to the IPA helper
diff --git a/gdbsupport/alt-stack.h b/gdbsupport/alt-stack.h
index 142479338f0..e921f60516f 100644
--- a/gdbsupport/alt-stack.h
+++ b/gdbsupport/alt-stack.h
@@ -58,13 +58,12 @@ public:
DISABLE_COPY_AND_ASSIGN (alternate_signal_stack);
private:
-
#ifdef HAVE_SIGALTSTACK
gdb::unique_xmalloc_ptr<char> m_stack;
stack_t m_old_stack;
#endif
};
-}
+} // namespace gdb
#endif /* GDBSUPPORT_ALT_STACK_H */
diff --git a/gdbsupport/array-view.h b/gdbsupport/array-view.h
index 3d8248b08b7..9dd3fabf974 100644
--- a/gdbsupport/array-view.h
+++ b/gdbsupport/array-view.h
@@ -64,23 +64,24 @@
You can find unit tests covering the whole API in
unittests/array-view-selftests.c. */
-namespace gdb {
+namespace gdb
+{
-template <typename T>
+template<typename T>
class array_view
{
/* True iff decayed T is the same as decayed U. E.g., we want to
say that 'T&' is the same as 'const T'. */
- template <typename U>
+ template<typename U>
using IsDecayedT = typename std::is_same<typename std::decay<T>::type,
- typename std::decay<U>::type>;
+ typename std::decay<U>::type>;
/* True iff decayed T is the same as decayed U, and 'U *' is
implicitly convertible to 'T *'. This is a requirement for
several methods. */
- template <typename U>
- using DecayedConvertible = gdb::And<IsDecayedT<U>,
- std::is_convertible<U *, T *>>;
+ template<typename U>
+ using DecayedConvertible
+ = gdb::And<IsDecayedT<U>, std::is_convertible<U *, T *>>;
public:
using value_type = T;
@@ -89,68 +90,66 @@ public:
using size_type = size_t;
/* Default construction creates an empty view. */
- constexpr array_view () noexcept
- : m_array (nullptr), m_size (0)
- {}
+ constexpr array_view () noexcept : m_array (nullptr), m_size (0) {}
/* Create an array view over a single object of the type of an
array_view element. The created view as size==1. This is
templated on U to allow constructing a array_view<const T> over a
(non-const) T. The "convertible" requirement makes sure that you
can't create an array_view<T> over a const T. */
- template<typename U,
- typename = Requires<DecayedConvertible<U>>>
- constexpr array_view (U &elem) noexcept
- : m_array (&elem), m_size (1)
- {}
+ template<typename U, typename = Requires<DecayedConvertible<U>>>
+ constexpr array_view (U &elem) noexcept : m_array (&elem),
+ m_size (1)
+ {
+ }
/* Same as above, for rvalue references. */
- template<typename U,
- typename = Requires<DecayedConvertible<U>>>
- constexpr array_view (U &&elem) noexcept
- : m_array (&elem), m_size (1)
- {}
+ template<typename U, typename = Requires<DecayedConvertible<U>>>
+ constexpr array_view (U &&elem) noexcept : m_array (&elem),
+ m_size (1)
+ {
+ }
/* Create an array view from a pointer to an array and an element
count. */
- template<typename U,
- typename = Requires<DecayedConvertible<U>>>
+ template<typename U, typename = Requires<DecayedConvertible<U>>>
constexpr array_view (U *array, size_t size) noexcept
- : m_array (array), m_size (size)
- {}
+ : m_array (array),
+ m_size (size)
+ {
+ }
/* Create an array view from a range. This is templated on both U
an V to allow passing in a mix of 'const T *' and 'T *'. */
- template<typename U, typename V,
- typename = Requires<DecayedConvertible<U>>,
- typename = Requires<DecayedConvertible<V>>>
+ template<typename U, typename V, typename = Requires<DecayedConvertible<U>>,
+ typename = Requires<DecayedConvertible<V>>>
constexpr array_view (U *begin, V *end) noexcept
- : m_array (begin), m_size (end - begin)
- {}
+ : m_array (begin),
+ m_size (end - begin)
+ {
+ }
/* Create an array view from an array. */
- template<typename U, size_t Size,
- typename = Requires<DecayedConvertible<U>>>
+ template<typename U, size_t Size, typename = Requires<DecayedConvertible<U>>>
constexpr array_view (U (&array)[Size]) noexcept
- : m_array (array), m_size (Size)
- {}
+ : m_array (array),
+ m_size (Size)
+ {
+ }
/* Create an array view from a contiguous container. E.g.,
std::vector and std::array. */
template<typename Container,
- typename = Requires<gdb::Not<IsDecayedT<Container>>>,
- typename
- = Requires<DecayedConvertible
- <typename std::remove_pointer
- <decltype (std::declval<Container> ().data ())
- >::type>>,
- typename
- = Requires<std::is_convertible
- <decltype (std::declval<Container> ().size ()),
- size_type>>>
+ typename = Requires<gdb::Not<IsDecayedT<Container>>>,
+ typename = Requires<DecayedConvertible<typename std::remove_pointer<
+ decltype (std::declval<Container> ().data ())>::type>>,
+ typename = Requires<std::is_convertible<
+ decltype (std::declval<Container> ().size ()), size_type>>>
constexpr array_view (Container &&c) noexcept
- : m_array (c.data ()), m_size (c.size ())
- {}
+ : m_array (c.data ()),
+ m_size (c.size ())
+ {
+ }
/* Observer methods. Some of these can't be constexpr until we
require C++14. */
@@ -184,12 +183,13 @@ public:
/* Slice an array view. */
/* Return a new array view over SIZE elements starting at START. */
- constexpr array_view<T> slice (size_type start, size_type size) const noexcept
+ constexpr array_view<T> slice (size_type start,
+ size_type size) const noexcept
{
#if defined(_GLIBCXX_DEBUG) && __cplusplus >= 201402L
gdb_assert (start + size <= m_size);
#endif
- return {m_array + start, size};
+ return { m_array + start, size };
}
/* Return a new array view over all the elements after START,
@@ -199,7 +199,7 @@ public:
#if defined(_GLIBCXX_DEBUG) && __cplusplus >= 201402L
gdb_assert (start <= m_size);
#endif
- return {m_array + start, size () - start};
+ return { m_array + start, size () - start };
}
private:
@@ -211,8 +211,9 @@ private:
The two array views must have the same length. */
-template <typename U, typename T>
-void copy (gdb::array_view<U> src, gdb::array_view<T> dest)
+template<typename U, typename T>
+void
+copy (gdb::array_view<U> src, gdb::array_view<T> dest)
{
gdb_assert (dest.size () == src.size ());
if (dest.data () < src.data ())
@@ -225,7 +226,7 @@ void copy (gdb::array_view<U> src, gdb::array_view<T> dest)
RHS have the same sizes, and whether each pair of elements of LHS
and RHS at the same position compares equal. */
-template <typename T>
+template<typename T>
bool
operator== (const gdb::array_view<T> &lhs, const gdb::array_view<T> &rhs)
{
@@ -241,7 +242,7 @@ operator== (const gdb::array_view<T> &lhs, const gdb::array_view<T> &rhs)
/* Compare two array_views for inequality. */
-template <typename T>
+template<typename T>
bool
operator!= (const gdb::array_view<T> &lhs, const gdb::array_view<T> &rhs)
{
@@ -287,7 +288,7 @@ template<typename U>
constexpr inline array_view<U>
make_array_view (U *array, size_t size) noexcept
{
- return {array, size};
+ return { array, size };
}
} /* namespace gdb */
diff --git a/gdbsupport/block-signals.h b/gdbsupport/block-signals.h
index fe0900bb30d..853d7e3d7fe 100644
--- a/gdbsupport/block-signals.h
+++ b/gdbsupport/block-signals.h
@@ -57,12 +57,11 @@ public:
DISABLE_COPY_AND_ASSIGN (block_signals);
private:
-
#ifdef HAVE_SIGPROCMASK
sigset_t m_old_mask;
#endif
};
-}
+} // namespace gdb
#endif /* GDBSUPPORT_BLOCK_SIGNALS_H */
diff --git a/gdbsupport/break-common.h b/gdbsupport/break-common.h
index 82a9b3e0546..33a24aa08cc 100644
--- a/gdbsupport/break-common.h
+++ b/gdbsupport/break-common.h
@@ -21,11 +21,11 @@
#define COMMON_BREAK_COMMON_H
enum target_hw_bp_type
- {
- hw_write = 0, /* Common HW watchpoint */
- hw_read = 1, /* Read HW watchpoint */
- hw_access = 2, /* Access HW watchpoint */
- hw_execute = 3 /* Execute HW breakpoint */
- };
+{
+ hw_write = 0, /* Common HW watchpoint */
+ hw_read = 1, /* Read HW watchpoint */
+ hw_access = 2, /* Access HW watchpoint */
+ hw_execute = 3 /* Execute HW breakpoint */
+};
#endif /* COMMON_BREAK_COMMON_H */
diff --git a/gdbsupport/btrace-common.cc b/gdbsupport/btrace-common.cc
index 932a11888b0..26ac5c664b5 100644
--- a/gdbsupport/btrace-common.cc
+++ b/gdbsupport/btrace-common.cc
@@ -20,7 +20,6 @@
#include "common-defs.h"
#include "btrace-common.h"
-
/* See btrace-common.h. */
const char *
@@ -29,16 +28,16 @@ btrace_format_string (enum btrace_format format)
switch (format)
{
case BTRACE_FORMAT_NONE:
- return _("No or unknown format");
+ return _ ("No or unknown format");
case BTRACE_FORMAT_BTS:
- return _("Branch Trace Store");
+ return _ ("Branch Trace Store");
case BTRACE_FORMAT_PT:
- return _("Intel Processor Trace");
+ return _ ("Intel Processor Trace");
}
- internal_error (_("Unknown branch trace format"));
+ internal_error (_ ("Unknown branch trace format"));
}
/* See btrace-common.h. */
@@ -58,7 +57,7 @@ btrace_format_short_string (enum btrace_format format)
return "pt";
}
- internal_error (_("Unknown branch trace format"));
+ internal_error (_ ("Unknown branch trace format"));
}
/* See btrace-common.h. */
@@ -82,7 +81,7 @@ btrace_data::fini ()
return;
}
- internal_error (_("Unkown branch trace format."));
+ internal_error (_ ("Unkown branch trace format."));
}
/* See btrace-common.h. */
@@ -102,7 +101,7 @@ btrace_data::empty () const
return (variant.pt.size == 0);
}
- internal_error (_("Unkown branch trace format."));
+ internal_error (_ ("Unkown branch trace format."));
}
/* See btrace-common.h. */
@@ -117,8 +116,7 @@ btrace_data::clear ()
/* See btrace-common.h. */
int
-btrace_data_append (struct btrace_data *dst,
- const struct btrace_data *src)
+btrace_data_append (struct btrace_data *dst, const struct btrace_data *src)
{
switch (src->format)
{
@@ -127,65 +125,65 @@ btrace_data_append (struct btrace_data *dst,
case BTRACE_FORMAT_BTS:
switch (dst->format)
- {
- default:
- return -1;
+ {
+ default:
+ return -1;
- case BTRACE_FORMAT_NONE:
- dst->format = BTRACE_FORMAT_BTS;
- dst->variant.bts.blocks = new std::vector<btrace_block>;
+ case BTRACE_FORMAT_NONE:
+ dst->format = BTRACE_FORMAT_BTS;
+ dst->variant.bts.blocks = new std::vector<btrace_block>;
- /* Fall-through. */
- case BTRACE_FORMAT_BTS:
- {
- unsigned int blk;
+ /* Fall-through. */
+ case BTRACE_FORMAT_BTS:
+ {
+ unsigned int blk;
- /* We copy blocks in reverse order to have the oldest block at
+ /* We copy blocks in reverse order to have the oldest block at
index zero. */
- blk = src->variant.bts.blocks->size ();
- while (blk != 0)
- {
- const btrace_block &block
- = src->variant.bts.blocks->at (--blk);
- dst->variant.bts.blocks->push_back (block);
- }
- }
- }
+ blk = src->variant.bts.blocks->size ();
+ while (blk != 0)
+ {
+ const btrace_block &block
+ = src->variant.bts.blocks->at (--blk);
+ dst->variant.bts.blocks->push_back (block);
+ }
+ }
+ }
return 0;
case BTRACE_FORMAT_PT:
switch (dst->format)
- {
- default:
- return -1;
-
- case BTRACE_FORMAT_NONE:
- dst->format = BTRACE_FORMAT_PT;
- dst->variant.pt.data = NULL;
- dst->variant.pt.size = 0;
-
- /* fall-through. */
- case BTRACE_FORMAT_PT:
- {
- gdb_byte *data;
- size_t size;
-
- size = src->variant.pt.size + dst->variant.pt.size;
- data = (gdb_byte *) xmalloc (size);
-
- if (dst->variant.pt.size > 0)
- memcpy (data, dst->variant.pt.data, dst->variant.pt.size);
- memcpy (data + dst->variant.pt.size, src->variant.pt.data,
- src->variant.pt.size);
-
- xfree (dst->variant.pt.data);
-
- dst->variant.pt.data = data;
- dst->variant.pt.size = size;
- }
- }
+ {
+ default:
+ return -1;
+
+ case BTRACE_FORMAT_NONE:
+ dst->format = BTRACE_FORMAT_PT;
+ dst->variant.pt.data = NULL;
+ dst->variant.pt.size = 0;
+
+ /* fall-through. */
+ case BTRACE_FORMAT_PT:
+ {
+ gdb_byte *data;
+ size_t size;
+
+ size = src->variant.pt.size + dst->variant.pt.size;
+ data = (gdb_byte *) xmalloc (size);
+
+ if (dst->variant.pt.size > 0)
+ memcpy (data, dst->variant.pt.data, dst->variant.pt.size);
+ memcpy (data + dst->variant.pt.size, src->variant.pt.data,
+ src->variant.pt.size);
+
+ xfree (dst->variant.pt.data);
+
+ dst->variant.pt.data = data;
+ dst->variant.pt.size = size;
+ }
+ }
return 0;
}
- internal_error (_("Unkown branch trace format."));
+ internal_error (_ ("Unkown branch trace format."));
}
diff --git a/gdbsupport/btrace-common.h b/gdbsupport/btrace-common.h
index e287c93a6c1..2e1654b3b18 100644
--- a/gdbsupport/btrace-common.h
+++ b/gdbsupport/btrace-common.h
@@ -43,9 +43,7 @@ struct btrace_block
CORE_ADDR end;
/* Simple constructor. */
- btrace_block (CORE_ADDR begin, CORE_ADDR end)
- : begin (begin),
- end (end)
+ btrace_block (CORE_ADDR begin, CORE_ADDR end) : begin (begin), end (end)
{
/* Nothing. */
}
@@ -172,19 +170,16 @@ struct btrace_data
{
btrace_data () = default;
- ~btrace_data ()
- {
- fini ();
- }
+ ~btrace_data () { fini (); }
btrace_data &operator= (btrace_data &&other)
{
if (this != &other)
{
- fini ();
- format = other.format;
- variant = other.variant;
- other.format = BTRACE_FORMAT_NONE;
+ fini ();
+ format = other.format;
+ variant = other.variant;
+ other.format = BTRACE_FORMAT_NONE;
}
return *this;
}
@@ -207,7 +202,6 @@ struct btrace_data
} variant;
private:
-
DISABLE_COPY_AND_ASSIGN (btrace_data);
void fini ();
@@ -258,6 +252,6 @@ extern const char *btrace_format_short_string (enum btrace_format format);
Both SRC and DST must use the same format.
Returns zero on success; a negative number otherwise. */
extern int btrace_data_append (struct btrace_data *dst,
- const struct btrace_data *src);
+ const struct btrace_data *src);
#endif /* COMMON_BTRACE_COMMON_H */
diff --git a/gdbsupport/buffer.cc b/gdbsupport/buffer.cc
index da6f3af6472..f50c1e61ae4 100644
--- a/gdbsupport/buffer.cc
+++ b/gdbsupport/buffer.cc
@@ -62,7 +62,7 @@ buffer_init (struct buffer *buffer)
memset (buffer, 0, sizeof (*buffer));
}
-char*
+char *
buffer_finish (struct buffer *buffer)
{
char *ret = buffer->buffer;
@@ -86,93 +86,92 @@ buffer_xml_printf (struct buffer *buffer, const char *format, ...)
for (f = format; *f; f++)
{
if (percent)
- {
- char buf[32];
- char *str = buf;
- const char *f_old = f;
-
- switch (*f)
- {
- case 's':
- str = va_arg (ap, char *);
- break;
- case 'd':
- sprintf (str, "%d", va_arg (ap, int));
- break;
- case 'u':
- sprintf (str, "%u", va_arg (ap, unsigned int));
- break;
- case 'x':
- sprintf (str, "%x", va_arg (ap, unsigned int));
- break;
- case 'o':
- sprintf (str, "%o", va_arg (ap, unsigned int));
- break;
- case 'l':
- f++;
- switch (*f)
- {
- case 'd':
- sprintf (str, "%ld", va_arg (ap, long));
- break;
- case 'u':
- sprintf (str, "%lu", va_arg (ap, unsigned long));
- break;
- case 'x':
- sprintf (str, "%lx", va_arg (ap, unsigned long));
- break;
- case 'o':
- sprintf (str, "%lo", va_arg (ap, unsigned long));
- break;
- case 'l':
- f++;
- switch (*f)
- {
- case 'd':
- sprintf (str, "%" PRId64,
- (int64_t) va_arg (ap, long long));
- break;
- case 'u':
- sprintf (str, "%" PRIu64,
- (uint64_t) va_arg (ap, unsigned long long));
- break;
- case 'x':
- sprintf (str, "%" PRIx64,
- (uint64_t) va_arg (ap, unsigned long long));
- break;
- case 'o':
- sprintf (str, "%" PRIo64,
- (uint64_t) va_arg (ap, unsigned long long));
- break;
- default:
- str = 0;
- break;
- }
- break;
- default:
- str = 0;
- break;
- }
- break;
- default:
- str = 0;
- break;
- }
-
- if (str)
- {
- buffer_grow (buffer, prev, f_old - prev - 1);
- std::string p = xml_escape_text (str);
- buffer_grow_str (buffer, p.c_str ());
- prev = f + 1;
- }
- percent = 0;
- }
+ {
+ char buf[32];
+ char *str = buf;
+ const char *f_old = f;
+
+ switch (*f)
+ {
+ case 's':
+ str = va_arg (ap, char *);
+ break;
+ case 'd':
+ sprintf (str, "%d", va_arg (ap, int));
+ break;
+ case 'u':
+ sprintf (str, "%u", va_arg (ap, unsigned int));
+ break;
+ case 'x':
+ sprintf (str, "%x", va_arg (ap, unsigned int));
+ break;
+ case 'o':
+ sprintf (str, "%o", va_arg (ap, unsigned int));
+ break;
+ case 'l':
+ f++;
+ switch (*f)
+ {
+ case 'd':
+ sprintf (str, "%ld", va_arg (ap, long));
+ break;
+ case 'u':
+ sprintf (str, "%lu", va_arg (ap, unsigned long));
+ break;
+ case 'x':
+ sprintf (str, "%lx", va_arg (ap, unsigned long));
+ break;
+ case 'o':
+ sprintf (str, "%lo", va_arg (ap, unsigned long));
+ break;
+ case 'l':
+ f++;
+ switch (*f)
+ {
+ case 'd':
+ sprintf (str, "%" PRId64,
+ (int64_t) va_arg (ap, long long));
+ break;
+ case 'u':
+ sprintf (str, "%" PRIu64,
+ (uint64_t) va_arg (ap, unsigned long long));
+ break;
+ case 'x':
+ sprintf (str, "%" PRIx64,
+ (uint64_t) va_arg (ap, unsigned long long));
+ break;
+ case 'o':
+ sprintf (str, "%" PRIo64,
+ (uint64_t) va_arg (ap, unsigned long long));
+ break;
+ default:
+ str = 0;
+ break;
+ }
+ break;
+ default:
+ str = 0;
+ break;
+ }
+ break;
+ default:
+ str = 0;
+ break;
+ }
+
+ if (str)
+ {
+ buffer_grow (buffer, prev, f_old - prev - 1);
+ std::string p = xml_escape_text (str);
+ buffer_grow_str (buffer, p.c_str ());
+ prev = f + 1;
+ }
+ percent = 0;
+ }
else if (*f == '%')
- percent = 1;
+ percent = 1;
}
buffer_grow_str (buffer, prev);
va_end (ap);
}
-
diff --git a/gdbsupport/buffer.h b/gdbsupport/buffer.h
index 7323c3aacaa..f9d11b399f0 100644
--- a/gdbsupport/buffer.h
+++ b/gdbsupport/buffer.h
@@ -24,7 +24,7 @@ struct buffer
{
char *buffer;
size_t buffer_size; /* allocated size */
- size_t used_size; /* actually used size */
+ size_t used_size; /* actually used size */
};
/* Append DATA of size SIZE to the end of BUFFER. Grows the buffer to
@@ -49,7 +49,7 @@ void buffer_init (struct buffer *buffer);
/* Return a pointer into BUFFER data, effectively transferring
ownership of the buffer memory to the caller. Calling buffer_free
afterwards has no effect on the returned data. */
-char* buffer_finish (struct buffer *buffer);
+char *buffer_finish (struct buffer *buffer);
/* Simple printf to buffer function. Current implemented formatters:
%s - grow an xml escaped text in BUFFER.
@@ -60,9 +60,9 @@ char* buffer_finish (struct buffer *buffer);
void buffer_xml_printf (struct buffer *buffer, const char *format, ...)
ATTRIBUTE_PRINTF (2, 3);
-#define buffer_grow_str(BUFFER,STRING) \
+#define buffer_grow_str(BUFFER, STRING) \
buffer_grow (BUFFER, STRING, strlen (STRING))
-#define buffer_grow_str0(BUFFER,STRING) \
+#define buffer_grow_str0(BUFFER, STRING) \
buffer_grow (BUFFER, STRING, strlen (STRING) + 1)
#endif /* COMMON_BUFFER_H */
diff --git a/gdbsupport/buildargv.h b/gdbsupport/buildargv.h
index 03e0288ca3b..8c87b6968c9 100644
--- a/gdbsupport/buildargv.h
+++ b/gdbsupport/buildargv.h
@@ -28,29 +28,18 @@
class gdb_argv
{
public:
-
/* A constructor that initializes to NULL. */
- gdb_argv ()
- : m_argv (NULL)
- {
- }
+ gdb_argv () : m_argv (NULL) {}
/* A constructor that calls buildargv on STR. STR may be NULL, in
which case this object is initialized with a NULL array. */
- explicit gdb_argv (const char *str)
- : m_argv (NULL)
- {
- reset (str);
- }
+ explicit gdb_argv (const char *str) : m_argv (NULL) { reset (str); }
/* A constructor that takes ownership of an existing array. */
- explicit gdb_argv (char **array)
- : m_argv (array)
- {
- }
+ explicit gdb_argv (char **array) : m_argv (array) {}
gdb_argv (const gdb_argv &) = delete;
gdb_argv &operator= (const gdb_argv &) = delete;
@@ -69,10 +58,7 @@ public:
other.m_argv = nullptr;
}
- ~gdb_argv ()
- {
- freeargv (m_argv);
- }
+ ~gdb_argv () { freeargv (m_argv); }
/* Call buildargv on STR, storing the result in this object. Any
previous state is freed. STR may be NULL, in which case this
@@ -90,15 +76,9 @@ public:
/* Return the underlying array. */
- char **get ()
- {
- return m_argv;
- }
+ char **get () { return m_argv; }
- const char * const * get () const
- {
- return m_argv;
- }
+ const char *const *get () const { return m_argv; }
/* Return the underlying array, transferring ownership to the
caller. */
@@ -112,10 +92,7 @@ public:
/* Return the number of items in the array. */
- int count () const
- {
- return countargv (m_argv);
- }
+ int count () const { return countargv (m_argv); }
/* Index into the array. */
@@ -132,9 +109,9 @@ public:
return gdb::array_view<char *> (this->get (), this->count ());
}
- gdb::array_view<const char * const> as_array_view () const
+ gdb::array_view<const char *const> as_array_view () const
{
- return gdb::array_view<const char * const> (this->get (), this->count ());
+ return gdb::array_view<const char *const> (this->get (), this->count ());
}
/* Append arguments to this array. */
@@ -146,10 +123,10 @@ public:
for (int argi = 0; argi < argc; argi++)
{
- /* Transfer ownership of the string. */
- m_argv[size++] = other.m_argv[argi];
- /* Ensure that destruction of OTHER works correctly. */
- other.m_argv[argi] = nullptr;
+ /* Transfer ownership of the string. */
+ m_argv[size++] = other.m_argv[argi];
+ /* Ensure that destruction of OTHER works correctly. */
+ other.m_argv[argi] = nullptr;
}
m_argv[size] = nullptr;
}
@@ -172,30 +149,17 @@ public:
/* Return an iterator pointing to the start of the array. */
- iterator begin ()
- {
- return m_argv;
- }
+ iterator begin () { return m_argv; }
/* Return an iterator pointing to the end of the array. */
- iterator end ()
- {
- return m_argv + count ();
- }
+ iterator end () { return m_argv + count (); }
- bool operator!= (std::nullptr_t)
- {
- return m_argv != NULL;
- }
+ bool operator!= (std::nullptr_t) { return m_argv != NULL; }
- bool operator== (std::nullptr_t)
- {
- return m_argv == NULL;
- }
+ bool operator== (std::nullptr_t) { return m_argv == NULL; }
private:
-
/* The wrapped array. */
char **m_argv;
diff --git a/gdbsupport/byte-vector.h b/gdbsupport/byte-vector.h
index 6de60c91f25..c3c9a5ba0cd 100644
--- a/gdbsupport/byte-vector.h
+++ b/gdbsupport/byte-vector.h
@@ -20,7 +20,8 @@
#include "gdbsupport/def-vector.h"
-namespace gdb {
+namespace gdb
+{
/* byte_vector is a gdb_byte std::vector with a custom allocator that
unlike std::vector<gdb_byte> does not zero-initialize new elements
diff --git a/gdbsupport/cleanups.cc b/gdbsupport/cleanups.cc
index 4e49daf03b3..f10fb243064 100644
--- a/gdbsupport/cleanups.cc
+++ b/gdbsupport/cleanups.cc
@@ -73,7 +73,7 @@ static struct cleanup *final_cleanup_chain = SENTINEL_CLEANUP;
static struct cleanup *
make_my_cleanup2 (struct cleanup **pmy_chain, make_cleanup_ftype *function,
- void *arg, void (*free_arg) (void *))
+ void *arg, void (*free_arg) (void *))
{
struct cleanup *newobj = XNEW (struct cleanup);
struct cleanup *old_chain = *pmy_chain;
@@ -98,7 +98,7 @@ make_my_cleanup2 (struct cleanup **pmy_chain, make_cleanup_ftype *function,
static struct cleanup *
make_my_cleanup (struct cleanup **pmy_chain, make_cleanup_ftype *function,
- void *arg)
+ void *arg)
{
return make_my_cleanup2 (pmy_chain, function, arg, NULL);
}
@@ -120,17 +120,16 @@ make_final_cleanup (make_cleanup_ftype *function, void *arg)
Cleanups are performed until we get back to the old end of the chain. */
static void
-do_my_cleanups (struct cleanup **pmy_chain,
- struct cleanup *old_chain)
+do_my_cleanups (struct cleanup **pmy_chain, struct cleanup *old_chain)
{
struct cleanup *ptr;
while ((ptr = *pmy_chain) != old_chain)
{
- *pmy_chain = ptr->next; /* Do this first in case of recursion. */
+ *pmy_chain = ptr->next; /* Do this first in case of recursion. */
(*ptr->function) (ptr->arg);
if (ptr->free_arg)
- (*ptr->free_arg) (ptr->arg);
+ (*ptr->free_arg) (ptr->arg);
xfree (ptr);
}
}
diff --git a/gdbsupport/common-debug.cc b/gdbsupport/common-debug.cc
index 08d2be3fdcb..7d08fb53932 100644
--- a/gdbsupport/common-debug.cc
+++ b/gdbsupport/common-debug.cc
@@ -40,7 +40,7 @@ debug_printf (const char *fmt, ...)
void
debug_prefixed_printf (const char *module, const char *func,
- const char *format, ...)
+ const char *format, ...)
{
va_list ap;
@@ -53,7 +53,7 @@ debug_prefixed_printf (const char *module, const char *func,
void
debug_prefixed_vprintf (const char *module, const char *func,
- const char *format, va_list args)
+ const char *format, va_list args)
{
if (func != nullptr)
debug_printf ("%*s[%s] %s: ", debug_print_depth * 2, "", module, func);
diff --git a/gdbsupport/common-debug.h b/gdbsupport/common-debug.h
index 33b15a005f1..5e6fb44f900 100644
--- a/gdbsupport/common-debug.h
+++ b/gdbsupport/common-debug.h
@@ -33,27 +33,28 @@ extern bool show_debug_regs;
/* Print a formatted message to the appropriate channel for
debugging output for the client. */
-extern void debug_printf (const char *format, ...)
- ATTRIBUTE_PRINTF (1, 2);
+extern void debug_printf (const char *format, ...) ATTRIBUTE_PRINTF (1, 2);
/* Print a formatted message to the appropriate channel for
debugging output for the client. This function must be
provided by the client. */
extern void debug_vprintf (const char *format, va_list ap)
- ATTRIBUTE_PRINTF (1, 0);
+ ATTRIBUTE_PRINTF (1, 0);
/* Print a debug statement prefixed with the module and function name, and
with a newline at the end. */
-extern void ATTRIBUTE_PRINTF (3, 4) debug_prefixed_printf
- (const char *module, const char *func, const char *format, ...);
+extern void ATTRIBUTE_PRINTF (3, 4)
+ debug_prefixed_printf (const char *module, const char *func,
+ const char *format, ...);
/* Print a debug statement prefixed with the module and function name, and
with a newline at the end. */
-extern void ATTRIBUTE_PRINTF (3, 0) debug_prefixed_vprintf
- (const char *module, const char *func, const char *format, va_list args);
+extern void ATTRIBUTE_PRINTF (3, 0)
+ debug_prefixed_vprintf (const char *module, const char *func,
+ const char *format, va_list args);
/* Helper to define "_debug_print" macros.
@@ -64,19 +65,20 @@ extern void ATTRIBUTE_PRINTF (3, 0) debug_prefixed_vprintf
forwarded to debug_prefixed_printf. */
#define debug_prefixed_printf_cond(debug_enabled_cond, module, fmt, ...) \
- do \
- { \
- if (debug_enabled_cond) \
- debug_prefixed_printf (module, __func__, fmt, ##__VA_ARGS__); \
- } \
+ do \
+ { \
+ if (debug_enabled_cond) \
+ debug_prefixed_printf (module, __func__, fmt, ##__VA_ARGS__); \
+ } \
while (0)
-#define debug_prefixed_printf_cond_nofunc(debug_enabled_cond, module, fmt, ...) \
- do \
- { \
- if (debug_enabled_cond) \
- debug_prefixed_printf (module, nullptr, fmt, ##__VA_ARGS__); \
- } \
+#define debug_prefixed_printf_cond_nofunc(debug_enabled_cond, module, fmt, \
+ ...) \
+ do \
+ { \
+ if (debug_enabled_cond) \
+ debug_prefixed_printf (module, nullptr, fmt, ##__VA_ARGS__); \
+ } \
while (0)
/* Nesting depth of scoped_debug_start_end objects. */
@@ -110,10 +112,9 @@ struct scoped_debug_start_end
for the message on exit. */
scoped_debug_start_end (PT &debug_enabled, const char *module,
- const char *func, const char *start_prefix,
- const char *end_prefix, const char *fmt,
- va_list args)
- ATTRIBUTE_NULL_PRINTF (7, 0)
+ const char *func, const char *start_prefix,
+ const char *end_prefix, const char *fmt,
+ va_list args) ATTRIBUTE_NULL_PRINTF (7, 0)
: m_debug_enabled (debug_enabled),
m_module (module),
m_func (func),
@@ -122,17 +123,17 @@ struct scoped_debug_start_end
{
if (is_debug_enabled ())
{
- if (fmt != nullptr)
- {
- m_msg = string_vprintf (fmt, args);
- debug_prefixed_printf (m_module, m_func, "%s: %s",
- start_prefix, m_msg->c_str ());
- }
- else
- debug_prefixed_printf (m_module, m_func, "%s", start_prefix);
-
- ++debug_print_depth;
- m_must_decrement_print_depth = true;
+ if (fmt != nullptr)
+ {
+ m_msg = string_vprintf (fmt, args);
+ debug_prefixed_printf (m_module, m_func, "%s: %s", start_prefix,
+ m_msg->c_str ());
+ }
+ else
+ debug_prefixed_printf (m_module, m_func, "%s", start_prefix);
+
+ ++debug_print_depth;
+ m_must_decrement_print_depth = true;
}
}
@@ -159,33 +160,34 @@ struct scoped_debug_start_end
if (m_must_decrement_print_depth)
{
- gdb_assert (debug_print_depth > 0);
- --debug_print_depth;
+ gdb_assert (debug_print_depth > 0);
+ --debug_print_depth;
}
if (is_debug_enabled ())
{
- if (m_with_format)
- {
- if (m_msg.has_value ())
- debug_prefixed_printf (m_module, m_func, "%s: %s",
- m_end_prefix, m_msg->c_str ());
- else
- {
- /* A format string was passed to the constructor, but debug
+ if (m_with_format)
+ {
+ if (m_msg.has_value ())
+ debug_prefixed_printf (m_module, m_func, "%s: %s", m_end_prefix,
+ m_msg->c_str ());
+ else
+ {
+ /* A format string was passed to the constructor, but debug
control variable wasn't set at the time, so we don't have the
rendering of the format string. */
- debug_prefixed_printf (m_module, m_func, "%s: <%s debugging was not enabled on entry>",
- m_end_prefix, m_module);
- }
- }
- else
- debug_prefixed_printf (m_module, m_func, "%s", m_end_prefix);
+ debug_prefixed_printf (
+ m_module, m_func,
+ "%s: <%s debugging was not enabled on entry>", m_end_prefix,
+ m_module);
+ }
+ }
+ else
+ debug_prefixed_printf (m_module, m_func, "%s", m_end_prefix);
}
}
private:
-
/* This function is specialized based on the type PT. Returns true if
M_DEBUG_ENABLED indicates this debug setting is enabled, otherwise,
return false. */
@@ -240,14 +242,14 @@ scoped_debug_start_end<bool &>::is_debug_enabled () const
template<typename PT>
static inline scoped_debug_start_end<PT &> ATTRIBUTE_NULL_PRINTF (6, 7)
-make_scoped_debug_start_end (PT &&pred, const char *module, const char *func,
- const char *start_prefix,
- const char *end_prefix, const char *fmt, ...)
+ make_scoped_debug_start_end (PT &&pred, const char *module, const char *func,
+ const char *start_prefix,
+ const char *end_prefix, const char *fmt, ...)
{
va_list args;
va_start (args, fmt);
auto res = scoped_debug_start_end<PT &> (pred, module, func, start_prefix,
- end_prefix, fmt, args);
+ end_prefix, fmt, args);
va_end (args);
return res;
@@ -255,20 +257,18 @@ make_scoped_debug_start_end (PT &&pred, const char *module, const char *func,
/* Helper to define a module-specific start/end debug macro. */
-#define scoped_debug_start_end(debug_enabled, module, fmt, ...) \
- auto CONCAT(scoped_debug_start_end, __LINE__) \
- = make_scoped_debug_start_end (debug_enabled, module, \
- __func__, "start", "end", \
- fmt, ##__VA_ARGS__)
+#define scoped_debug_start_end(debug_enabled, module, fmt, ...) \
+ auto CONCAT (scoped_debug_start_end, __LINE__) \
+ = make_scoped_debug_start_end (debug_enabled, module, __func__, "start", \
+ "end", fmt, ##__VA_ARGS__)
/* Helper to define a module-specific enter/exit debug macro. This is a special
case of `scoped_debug_start_end` where the start and end messages are "enter"
and "exit", to denote entry and exit of a function. */
-#define scoped_debug_enter_exit(debug_enabled, module) \
- auto CONCAT(scoped_debug_start_end, __LINE__) \
- = make_scoped_debug_start_end (debug_enabled, module, \
- __func__, "enter", "exit", \
- nullptr)
+#define scoped_debug_enter_exit(debug_enabled, module) \
+ auto CONCAT (scoped_debug_start_end, __LINE__) \
+ = make_scoped_debug_start_end (debug_enabled, module, __func__, "enter", \
+ "exit", nullptr)
#endif /* COMMON_COMMON_DEBUG_H */
diff --git a/gdbsupport/common-defs.h b/gdbsupport/common-defs.h
index 5e529f6febf..b359ff85345 100644
--- a/gdbsupport/common-defs.h
+++ b/gdbsupport/common-defs.h
@@ -73,16 +73,16 @@
expose the required symbols.
NOTE: this must be kept in sync with common.m4. */
-#if defined (__MINGW32__) || defined (__CYGWIN__)
-# ifdef _WIN32_WINNT
-# if _WIN32_WINNT < 0x0501
-# undef _WIN32_WINNT
-# define _WIN32_WINNT 0x0501
-# endif
-# else
-# define _WIN32_WINNT 0x0501
-# endif
-#endif /* __MINGW32__ || __CYGWIN__ */
+#if defined(__MINGW32__) || defined(__CYGWIN__)
+#ifdef _WIN32_WINNT
+#if _WIN32_WINNT < 0x0501
+#undef _WIN32_WINNT
+#define _WIN32_WINNT 0x0501
+#endif
+#else
+#define _WIN32_WINNT 0x0501
+#endif
+#endif /* __MINGW32__ || __CYGWIN__ */
#include <stdarg.h>
#include <stdio.h>
@@ -96,7 +96,7 @@
#include <stdint.h>
#include <string.h>
#ifdef HAVE_STRINGS_H
-#include <strings.h> /* for strcasecmp and strncasecmp */
+#include <strings.h> /* for strcasecmp and strncasecmp */
#endif
#include <errno.h>
#if HAVE_ALLOCA_H
@@ -215,7 +215,9 @@
#include "gdbsupport/poison.h"
#define EXTERN_C extern "C"
-#define EXTERN_C_PUSH extern "C" {
+#define EXTERN_C_PUSH \
+ extern "C" \
+ {
#define EXTERN_C_POP }
/* Pull in gdb::unique_xmalloc_ptr. */
@@ -226,7 +228,7 @@
that always returns a pointer to a 4MB section reserved for
that. */
-#if defined (HAVE_SBRK) && !__APPLE__
+#if defined(HAVE_SBRK) && !__APPLE__
#define HAVE_USEFUL_SBRK 1
#endif
diff --git a/gdbsupport/common-exceptions.cc b/gdbsupport/common-exceptions.cc
index d0dd8081c41..51af43745bf 100644
--- a/gdbsupport/common-exceptions.cc
+++ b/gdbsupport/common-exceptions.cc
@@ -22,7 +22,8 @@
#include <forward_list>
/* Possible catcher states. */
-enum catcher_state {
+enum catcher_state
+{
/* Initial state, a new catcher has just been created. */
CATCHER_CREATED,
/* The catch code is running. */
@@ -33,7 +34,8 @@ enum catcher_state {
};
/* Possible catcher actions. */
-enum catcher_action {
+enum catcher_action
+{
CATCH_ITER,
CATCH_ITER_1,
CATCH_THROWING
@@ -68,67 +70,66 @@ exceptions_state_mc (enum catcher_action action)
{
case CATCHER_CREATED:
switch (action)
- {
- case CATCH_ITER:
- /* Allow the code to run the catcher. */
- catchers.front ().state = CATCHER_RUNNING;
- return 1;
- default:
- internal_error (_("bad state"));
- }
+ {
+ case CATCH_ITER:
+ /* Allow the code to run the catcher. */
+ catchers.front ().state = CATCHER_RUNNING;
+ return 1;
+ default:
+ internal_error (_ ("bad state"));
+ }
case CATCHER_RUNNING:
switch (action)
- {
- case CATCH_ITER:
- /* No error/quit has occured. */
- return 0;
- case CATCH_ITER_1:
- catchers.front ().state = CATCHER_RUNNING_1;
- return 1;
- case CATCH_THROWING:
- catchers.front ().state = CATCHER_ABORTING;
- /* See also throw_exception. */
- return 1;
- default:
- internal_error (_("bad switch"));
- }
+ {
+ case CATCH_ITER:
+ /* No error/quit has occured. */
+ return 0;
+ case CATCH_ITER_1:
+ catchers.front ().state = CATCHER_RUNNING_1;
+ return 1;
+ case CATCH_THROWING:
+ catchers.front ().state = CATCHER_ABORTING;
+ /* See also throw_exception. */
+ return 1;
+ default:
+ internal_error (_ ("bad switch"));
+ }
case CATCHER_RUNNING_1:
switch (action)
- {
- case CATCH_ITER:
- /* The did a "break" from the inner while loop. */
- return 0;
- case CATCH_ITER_1:
- catchers.front ().state = CATCHER_RUNNING;
- return 0;
- case CATCH_THROWING:
- catchers.front ().state = CATCHER_ABORTING;
- /* See also throw_exception. */
- return 1;
- default:
- internal_error (_("bad switch"));
- }
+ {
+ case CATCH_ITER:
+ /* The did a "break" from the inner while loop. */
+ return 0;
+ case CATCH_ITER_1:
+ catchers.front ().state = CATCHER_RUNNING;
+ return 0;
+ case CATCH_THROWING:
+ catchers.front ().state = CATCHER_ABORTING;
+ /* See also throw_exception. */
+ return 1;
+ default:
+ internal_error (_ ("bad switch"));
+ }
case CATCHER_ABORTING:
switch (action)
- {
- case CATCH_ITER:
- {
- /* Exit normally if this catcher can handle this
+ {
+ case CATCH_ITER:
+ {
+ /* Exit normally if this catcher can handle this
exception. The caller analyses the func return
values. */
- return 0;
- }
- default:
- internal_error (_("bad state"));
- }
+ return 0;
+ }
+ default:
+ internal_error (_ ("bad state"));
+ }
default:
- internal_error (_("bad switch"));
+ internal_error (_ ("bad switch"));
}
}
int
-exceptions_state_mc_catch (struct gdb_exception *exception,
- int mask)
+exceptions_state_mc_catch (struct gdb_exception *exception, int mask)
{
*exception = std::move (catchers.front ().exception);
catchers.pop_front ();
@@ -136,11 +137,11 @@ exceptions_state_mc_catch (struct gdb_exception *exception,
if (exception->reason < 0)
{
if (mask & RETURN_MASK (exception->reason))
- {
- /* Exit normally and let the caller handle the
+ {
+ /* Exit normally and let the caller handle the
exception. */
- return 1;
- }
+ return 1;
+ }
/* The caller didn't request that the event be caught, relay the
event to the next exception_catch/CATCH_SJLJ. */
@@ -191,8 +192,8 @@ throw_exception (gdb_exception &&exception)
}
static void ATTRIBUTE_NORETURN ATTRIBUTE_PRINTF (3, 0)
-throw_it (enum return_reason reason, enum errors error, const char *fmt,
- va_list ap)
+ throw_it (enum return_reason reason, enum errors error, const char *fmt,
+ va_list ap)
{
if (reason == RETURN_QUIT)
throw gdb_exception_quit (fmt, ap);
diff --git a/gdbsupport/common-exceptions.h b/gdbsupport/common-exceptions.h
index a2a4f5a3892..acc857aea70 100644
--- a/gdbsupport/common-exceptions.h
+++ b/gdbsupport/common-exceptions.h
@@ -31,14 +31,14 @@
use as the return value from an initial setjmp(). */
enum return_reason
- {
- /* User interrupt. */
- RETURN_QUIT = -2,
- /* Any other error. */
- RETURN_ERROR
- };
+{
+ /* User interrupt. */
+ RETURN_QUIT = -2,
+ /* Any other error. */
+ RETURN_ERROR
+};
-#define RETURN_MASK(reason) (1 << (int)(-reason))
+#define RETURN_MASK(reason) (1 << (int) (-reason))
typedef enum
{
@@ -49,7 +49,8 @@ typedef enum
/* Describe all exceptions. */
-enum errors {
+enum errors
+{
GDB_NO_ERROR,
/* Any generic error, the corresponding text is in
@@ -113,21 +114,14 @@ enum errors {
struct gdb_exception
{
- gdb_exception ()
- : reason ((enum return_reason) 0),
- error (GDB_NO_ERROR)
- {
- }
+ gdb_exception () : reason ((enum return_reason) 0), error (GDB_NO_ERROR) {}
- gdb_exception (enum return_reason r, enum errors e)
- : reason (r),
- error (e)
+ gdb_exception (enum return_reason r, enum errors e) : reason (r), error (e)
{
}
- gdb_exception (enum return_reason r, enum errors e,
- const char *fmt, va_list ap)
- ATTRIBUTE_PRINTF (4, 0)
+ gdb_exception (enum return_reason r, enum errors e, const char *fmt,
+ va_list ap) ATTRIBUTE_PRINTF (4, 0)
: reason (r),
error (e),
message (std::make_shared<std::string> (string_vprintf (fmt, ap)))
@@ -161,10 +155,7 @@ struct gdb_exception
/* Return the contents of the exception message, as a C string. The
string remains owned by the exception object. */
- const char *what () const noexcept
- {
- return message->c_str ();
- }
+ const char *what () const noexcept { return message->c_str (); }
/* Compare two exceptions. */
bool operator== (const gdb_exception &other) const
@@ -172,9 +163,8 @@ struct gdb_exception
const char *msg1 = message == nullptr ? "" : what ();
const char *msg2 = other.message == nullptr ? "" : other.what ();
- return (reason == other.reason
- && error == other.error
- && strcmp (msg1, msg2) == 0);
+ return (reason == other.reason && error == other.error
+ && strcmp (msg1, msg2) == 0);
}
/* Compare two exceptions. */
@@ -199,12 +189,12 @@ struct hash<gdb_exception>
{
size_t result = exc.reason + exc.error;
if (exc.message != nullptr)
- result += std::hash<std::string> {} (*exc.message);
+ result += std::hash<std::string> {}(*exc.message);
return result;
}
};
-}
+} // namespace std
/* Functions to drive the sjlj-based exceptions state machine. Though
declared here by necessity, these functions should be considered
@@ -243,22 +233,20 @@ extern int exceptions_state_mc_catch (struct gdb_exception *, int);
need to cross third-party library code compiled without exceptions
support (e.g., readline). */
-#define TRY_SJLJ \
- { \
- jmp_buf *buf = \
- exceptions_state_mc_init (); \
- setjmp (*buf); \
- } \
- while (exceptions_state_mc_action_iter ()) \
- while (exceptions_state_mc_action_iter_1 ())
-
-#define CATCH_SJLJ(EXCEPTION, MASK) \
- { \
- struct gdb_exception EXCEPTION; \
+#define TRY_SJLJ \
+ { \
+ jmp_buf *buf = exceptions_state_mc_init (); \
+ setjmp (*buf); \
+ } \
+ while (exceptions_state_mc_action_iter ()) \
+ while (exceptions_state_mc_action_iter_1 ())
+
+#define CATCH_SJLJ(EXCEPTION, MASK) \
+ { \
+ struct gdb_exception EXCEPTION; \
if (exceptions_state_mc_catch (&(EXCEPTION), MASK))
-#define END_CATCH_SJLJ \
- }
+#define END_CATCH_SJLJ }
/* The exception types client code may catch. They're just shims
around gdb_exception that add nothing but type info. Which is used
@@ -281,8 +269,7 @@ struct gdb_exception_error : public gdb_exception
struct gdb_exception_quit : public gdb_exception
{
- gdb_exception_quit (const char *fmt, va_list ap)
- ATTRIBUTE_PRINTF (2, 0)
+ gdb_exception_quit (const char *fmt, va_list ap) ATTRIBUTE_PRINTF (2, 0)
: gdb_exception (RETURN_QUIT, GDB_NO_ERROR, fmt, ap)
{
}
@@ -300,9 +287,7 @@ struct gdb_exception_quit : public gdb_exception
allocation error to be caught by all the CATCH/RETURN_MASK_ALL
spread around the codebase. */
-struct gdb_quit_bad_alloc
- : public gdb_exception_quit,
- public std::bad_alloc
+struct gdb_quit_bad_alloc : public gdb_exception_quit, public std::bad_alloc
{
explicit gdb_quit_bad_alloc (gdb_exception &&ex) noexcept
: gdb_exception_quit (std::move (ex)),
@@ -316,25 +301,25 @@ struct gdb_quit_bad_alloc
/* Throw an exception (as described by "struct gdb_exception"),
landing in the inner most containing exception handler established
using TRY/CATCH. */
-extern void throw_exception (gdb_exception &&exception)
- ATTRIBUTE_NORETURN;
+extern void throw_exception (gdb_exception &&exception) ATTRIBUTE_NORETURN;
/* Throw an exception by executing a LONG JUMP to the inner most
containing exception handler established using TRY_SJLJ. Necessary
in some cases where we need to throw GDB exceptions across
third-party library code (e.g., readline). */
extern void throw_exception_sjlj (const struct gdb_exception &exception)
- ATTRIBUTE_NORETURN;
+ ATTRIBUTE_NORETURN;
/* Convenience wrappers around throw_exception that throw GDB
errors. */
-extern void throw_verror (enum errors, const char *fmt, va_list ap)
- ATTRIBUTE_NORETURN ATTRIBUTE_PRINTF (2, 0);
-extern void throw_vquit (const char *fmt, va_list ap)
- ATTRIBUTE_NORETURN ATTRIBUTE_PRINTF (1, 0);
-extern void throw_error (enum errors error, const char *fmt, ...)
- ATTRIBUTE_NORETURN ATTRIBUTE_PRINTF (2, 3);
-extern void throw_quit (const char *fmt, ...)
- ATTRIBUTE_NORETURN ATTRIBUTE_PRINTF (1, 2);
+extern void throw_verror (enum errors, const char *fmt,
+ va_list ap) ATTRIBUTE_NORETURN
+ ATTRIBUTE_PRINTF (2, 0);
+extern void throw_vquit (const char *fmt, va_list ap) ATTRIBUTE_NORETURN
+ ATTRIBUTE_PRINTF (1, 0);
+extern void throw_error (enum errors error, const char *fmt,
+ ...) ATTRIBUTE_NORETURN ATTRIBUTE_PRINTF (2, 3);
+extern void throw_quit (const char *fmt, ...) ATTRIBUTE_NORETURN
+ ATTRIBUTE_PRINTF (1, 2);
#endif /* COMMON_COMMON_EXCEPTIONS_H */
diff --git a/gdbsupport/common-gdbthread.h b/gdbsupport/common-gdbthread.h
index a0368c3f830..052b787a110 100644
--- a/gdbsupport/common-gdbthread.h
+++ b/gdbsupport/common-gdbthread.h
@@ -23,6 +23,6 @@ struct process_stratum_target;
/* Switch from one thread to another. */
extern void switch_to_thread (process_stratum_target *proc_target,
- ptid_t ptid);
+ ptid_t ptid);
#endif /* COMMON_COMMON_GDBTHREAD_H */
diff --git a/gdbsupport/common-inferior.cc b/gdbsupport/common-inferior.cc
index 55149ec1f13..4f9c0e643fa 100644
--- a/gdbsupport/common-inferior.cc
+++ b/gdbsupport/common-inferior.cc
@@ -28,7 +28,7 @@ bool startup_with_shell = true;
/* See common-inferior.h. */
std::string
-construct_inferior_arguments (gdb::array_view<char * const> argv)
+construct_inferior_arguments (gdb::array_view<char *const> argv)
{
std::string result;
@@ -47,78 +47,78 @@ construct_inferior_arguments (gdb::array_view<char * const> argv)
static const char quote = '\'';
#endif
for (int i = 0; i < argv.size (); ++i)
- {
- if (i > 0)
- result += ' ';
+ {
+ if (i > 0)
+ result += ' ';
- /* Need to handle empty arguments specially. */
- if (argv[i][0] == '\0')
- {
- result += quote;
- result += quote;
- }
- else
- {
+ /* Need to handle empty arguments specially. */
+ if (argv[i][0] == '\0')
+ {
+ result += quote;
+ result += quote;
+ }
+ else
+ {
#ifdef __MINGW32__
- bool quoted = false;
+ bool quoted = false;
- if (strpbrk (argv[i], special))
- {
- quoted = true;
- result += quote;
- }
+ if (strpbrk (argv[i], special))
+ {
+ quoted = true;
+ result += quote;
+ }
#endif
- for (char *cp = argv[i]; *cp; ++cp)
- {
- if (*cp == '\n')
- {
- /* A newline cannot be quoted with a backslash (it
+ for (char *cp = argv[i]; *cp; ++cp)
+ {
+ if (*cp == '\n')
+ {
+ /* A newline cannot be quoted with a backslash (it
just disappears), only by putting it inside
quotes. */
- result += quote;
- result += '\n';
- result += quote;
- }
- else
- {
+ result += quote;
+ result += '\n';
+ result += quote;
+ }
+ else
+ {
#ifdef __MINGW32__
- if (*cp == quote)
+ if (*cp == quote)
#else
- if (strchr (special, *cp) != NULL)
+ if (strchr (special, *cp) != NULL)
#endif
- result += '\\';
- result += *cp;
- }
- }
+ result += '\\';
+ result += *cp;
+ }
+ }
#ifdef __MINGW32__
- if (quoted)
- result += quote;
+ if (quoted)
+ result += quote;
#endif
- }
- }
+ }
+ }
}
else
{
/* In this case we can't handle arguments that contain spaces,
tabs, or newlines -- see breakup_args(). */
for (char *arg : argv)
- {
- char *cp = strchr (arg, ' ');
- if (cp == NULL)
- cp = strchr (arg, '\t');
- if (cp == NULL)
- cp = strchr (arg, '\n');
- if (cp != NULL)
- error (_("can't handle command-line "
- "argument containing whitespace"));
- }
+ {
+ char *cp = strchr (arg, ' ');
+ if (cp == NULL)
+ cp = strchr (arg, '\t');
+ if (cp == NULL)
+ cp = strchr (arg, '\n');
+ if (cp != NULL)
+ error (_ ("can't handle command-line "
+ "argument containing whitespace"));
+ }
for (int i = 0; i < argv.size (); ++i)
- {
- if (i > 0)
- result += " ";
- result += argv[i];
- }
+ {
+ if (i > 0)
+ result += " ";
+ result += argv[i];
+ }
}
return result;
diff --git a/gdbsupport/common-inferior.h b/gdbsupport/common-inferior.h
index c468c7bf6a8..0b5b4871084 100644
--- a/gdbsupport/common-inferior.h
+++ b/gdbsupport/common-inferior.h
@@ -59,7 +59,6 @@ extern bool startup_with_shell;
/* Compute command-line string given argument vector. This does the
same shell processing as fork_inferior. */
-extern std::string
-construct_inferior_arguments (gdb::array_view<char * const>);
+extern std::string construct_inferior_arguments (gdb::array_view<char *const>);
#endif /* COMMON_COMMON_INFERIOR_H */
diff --git a/gdbsupport/common-regcache.cc b/gdbsupport/common-regcache.cc
index 3515bedb383..c2d2b9a4752 100644
--- a/gdbsupport/common-regcache.cc
+++ b/gdbsupport/common-regcache.cc
@@ -30,7 +30,7 @@ regcache_raw_get_unsigned (struct regcache *regcache, int regnum)
status = regcache_raw_read_unsigned (regcache, regnum, &value);
if (status == REG_UNAVAILABLE)
- throw_error (NOT_AVAILABLE_ERROR,
- _("Register %d is not available"), regnum);
+ throw_error (NOT_AVAILABLE_ERROR, _ ("Register %d is not available"),
+ regnum);
return value;
}
diff --git a/gdbsupport/common-regcache.h b/gdbsupport/common-regcache.h
index e462f532407..551b769ba56 100644
--- a/gdbsupport/common-regcache.h
+++ b/gdbsupport/common-regcache.h
@@ -23,22 +23,22 @@
/* This header is a stopgap until we have an independent regcache. */
enum register_status : signed char
- {
- /* The register value is not in the cache, and we don't know yet
+{
+ /* The register value is not in the cache, and we don't know yet
whether it's available in the target (or traceframe). */
- REG_UNKNOWN = 0,
+ REG_UNKNOWN = 0,
- /* The register value is valid and cached. */
- REG_VALID = 1,
+ /* The register value is valid and cached. */
+ REG_VALID = 1,
- /* The register value is unavailable. E.g., we're inspecting a
+ /* The register value is unavailable. E.g., we're inspecting a
traceframe, and this register wasn't collected. Note that this
is different a different "unavailable" from saying the register
does not exist in the target's architecture --- in that case,
the target should have given us a target description that does
not include the register in the first place. */
- REG_UNAVAILABLE = -1
- };
+ REG_UNAVAILABLE = -1
+};
/* Return a pointer to the register cache associated with the
thread specified by PTID. This function must be provided by
@@ -62,8 +62,9 @@ extern CORE_ADDR regcache_read_pc (struct regcache *regcache);
extern CORE_ADDR regcache_read_pc_protected (regcache *regcache);
/* Read a raw register into a unsigned integer. */
-extern enum register_status regcache_raw_read_unsigned
- (struct regcache *regcache, int regnum, ULONGEST *val);
+extern enum register_status
+regcache_raw_read_unsigned (struct regcache *regcache, int regnum,
+ ULONGEST *val);
ULONGEST regcache_raw_get_unsigned (struct regcache *regcache, int regnum);
diff --git a/gdbsupport/common-types.h b/gdbsupport/common-types.h
index e863d6505ea..8d39a15942d 100644
--- a/gdbsupport/common-types.h
+++ b/gdbsupport/common-types.h
@@ -39,6 +39,11 @@ typedef uint64_t ULONGEST;
/* * The largest ULONGEST value. */
#define ULONGEST_MAX (~(ULONGEST) 0)
-enum tribool { TRIBOOL_UNKNOWN = -1, TRIBOOL_FALSE = 0, TRIBOOL_TRUE = 1 };
+enum tribool
+{
+ TRIBOOL_UNKNOWN = -1,
+ TRIBOOL_FALSE = 0,
+ TRIBOOL_TRUE = 1
+};
#endif /* COMMON_COMMON_TYPES_H */
diff --git a/gdbsupport/common-utils.cc b/gdbsupport/common-utils.cc
index e382fb28d8f..e6ea18ab11e 100644
--- a/gdbsupport/common-utils.cc
+++ b/gdbsupport/common-utils.cc
@@ -54,7 +54,7 @@ xstrvprintf (const char *format, va_list ap)
status (the printed length) with a non-NULL buffer should never
happen, but just to be sure. */
if (ret == NULL || status < 0)
- internal_error (_("vasprintf call failed"));
+ internal_error (_ ("vasprintf call failed"));
return gdb::unique_xmalloc_ptr<char> (ret);
}
@@ -75,7 +75,7 @@ xsnprintf (char *str, size_t size, const char *format, ...)
/* See documentation in common-utils.h. */
std::string
-string_printf (const char* fmt, ...)
+string_printf (const char *fmt, ...)
{
va_list vp;
int size;
@@ -89,7 +89,7 @@ string_printf (const char* fmt, ...)
/* C++11 and later guarantee std::string uses contiguous memory and
always includes the terminating '\0'. */
va_start (vp, fmt);
- vsprintf (&str[0], fmt, vp); /* ARI: vsprintf */
+ vsprintf (&str[0], fmt, vp); /* ARI: vsprintf */
va_end (vp);
return str;
@@ -98,7 +98,7 @@ string_printf (const char* fmt, ...)
/* See documentation in common-utils.h. */
std::string
-string_vprintf (const char* fmt, va_list args)
+string_vprintf (const char *fmt, va_list args)
{
va_list vp;
size_t size;
@@ -116,7 +116,6 @@ string_vprintf (const char* fmt, va_list args)
return str;
}
-
/* See documentation in common-utils.h. */
std::string &
@@ -131,7 +130,6 @@ string_appendf (std::string &str, const char *fmt, ...)
return str;
}
-
/* See documentation in common-utils.h. */
std::string &
@@ -182,41 +180,41 @@ extract_string_maybe_quoted (const char **arg)
while (*p != '\0')
{
if (ISSPACE (*p) && !squote && !dquote && !bsquote)
- break;
+ break;
else
- {
- if (bsquote)
- {
- bsquote = false;
- result += *p;
- }
- else if (*p == '\\')
- bsquote = true;
- else if (squote)
- {
- if (*p == '\'')
- squote = false;
- else
- result += *p;
- }
- else if (dquote)
- {
- if (*p == '"')
- dquote = false;
- else
- result += *p;
- }
- else
- {
- if (*p == '\'')
- squote = true;
- else if (*p == '"')
- dquote = true;
- else
- result += *p;
- }
- p++;
- }
+ {
+ if (bsquote)
+ {
+ bsquote = false;
+ result += *p;
+ }
+ else if (*p == '\\')
+ bsquote = true;
+ else if (squote)
+ {
+ if (*p == '\'')
+ squote = false;
+ else
+ result += *p;
+ }
+ else if (dquote)
+ {
+ if (*p == '"')
+ dquote = false;
+ else
+ result += *p;
+ }
+ else
+ {
+ if (*p == '\'')
+ squote = true;
+ else if (*p == '"')
+ dquote = true;
+ else
+ result += *p;
+ }
+ p++;
+ }
}
*arg = p;
@@ -277,11 +275,11 @@ strtoulst (const char *num, const char **trailer, int base)
if (base == 0 || base == 16)
{
if (num[i] == '0' && (num[i + 1] == 'x' || num[i + 1] == 'X'))
- {
- i += 2;
- if (base == 0)
- base = 16;
- }
+ {
+ i += 2;
+ if (base == 0)
+ base = 16;
+ }
}
if (base == 0 && num[i] == '0')
@@ -303,13 +301,13 @@ strtoulst (const char *num, const char **trailer, int base)
high_part = high_part * base + (unsigned int) (result >> HIGH_BYTE_POSN);
result &= ((ULONGEST) 1 << HIGH_BYTE_POSN) - 1;
if (high_part > 0xff)
- {
- errno = ERANGE;
- result = ~ (ULONGEST) 0;
- high_part = 0;
- minus = 0;
- break;
- }
+ {
+ errno = ERANGE;
+ result = ~(ULONGEST) 0;
+ high_part = 0;
+ minus = 0;
+ break;
+ }
}
if (trailer != NULL)
@@ -383,7 +381,7 @@ ULONGEST
align_up (ULONGEST v, int n)
{
/* Check that N is really a power of two. */
- gdb_assert (n && (n & (n-1)) == 0);
+ gdb_assert (n && (n & (n - 1)) == 0);
return (v + n - 1) & -n;
}
@@ -393,7 +391,7 @@ ULONGEST
align_down (ULONGEST v, int n)
{
/* Check that N is really a power of two. */
- gdb_assert (n && (n & (n-1)) == 0);
+ gdb_assert (n && (n & (n - 1)) == 0);
return (v & -n);
}
@@ -409,7 +407,7 @@ fromhex (int a)
else if (a >= 'A' && a <= 'F')
return a - 'A' + 10;
else
- error (_("Invalid hex digit %d"), a);
+ error (_ ("Invalid hex digit %d"), a);
}
/* See gdbsupport/common-utils.h. */
@@ -422,11 +420,11 @@ hex2bin (const char *hex, gdb_byte *bin, int count)
for (i = 0; i < count; i++)
{
if (hex[0] == 0 || hex[1] == 0)
- {
- /* Hex string is short, or of uneven length.
+ {
+ /* Hex string is short, or of uneven length.
Return the count that has been converted so far. */
- return i;
- }
+ return i;
+ }
*bin++ = fromhex (hex[0]) * 16 + fromhex (hex[1]);
hex += 2;
}
diff --git a/gdbsupport/common-utils.h b/gdbsupport/common-utils.h
index 97dcb9fa8ce..b171c3b23da 100644
--- a/gdbsupport/common-utils.h
+++ b/gdbsupport/common-utils.h
@@ -28,9 +28,9 @@
#include "gdb_string_view.h"
#if defined HAVE_LIBXXHASH
-# include <xxhash.h>
+#include <xxhash.h>
#else
-# include "hashtab.h"
+#include "hashtab.h"
#endif
/* xmalloc(), xrealloc() and xcalloc() have already been declared in
@@ -42,29 +42,28 @@ void *xzalloc (size_t);
/* Like asprintf and vasprintf, but return the string, throw an error
if no memory. */
gdb::unique_xmalloc_ptr<char> xstrprintf (const char *format, ...)
- ATTRIBUTE_PRINTF (1, 2);
+ ATTRIBUTE_PRINTF (1, 2);
gdb::unique_xmalloc_ptr<char> xstrvprintf (const char *format, va_list ap)
- ATTRIBUTE_PRINTF (1, 0);
+ ATTRIBUTE_PRINTF (1, 0);
/* Like snprintf, but throw an error if the output buffer is too small. */
int xsnprintf (char *str, size_t size, const char *format, ...)
- ATTRIBUTE_PRINTF (3, 4);
+ ATTRIBUTE_PRINTF (3, 4);
/* Returns a std::string built from a printf-style format string. */
-std::string string_printf (const char* fmt, ...)
- ATTRIBUTE_PRINTF (1, 2);
+std::string string_printf (const char *fmt, ...) ATTRIBUTE_PRINTF (1, 2);
/* Like string_printf, but takes a va_list. */
-std::string string_vprintf (const char* fmt, va_list args)
+std::string string_vprintf (const char *fmt, va_list args)
ATTRIBUTE_PRINTF (1, 0);
/* Like string_printf, but appends to DEST instead of returning a new
std::string. */
-std::string &string_appendf (std::string &dest, const char* fmt, ...)
+std::string &string_appendf (std::string &dest, const char *fmt, ...)
ATTRIBUTE_PRINTF (2, 3);
/* Like string_appendf, but takes a va_list. */
-std::string &string_vappendf (std::string &dest, const char* fmt, va_list args)
+std::string &string_vappendf (std::string &dest, const char *fmt, va_list args)
ATTRIBUTE_PRINTF (2, 0);
/* Make a copy of the string at PTR with LEN characters
@@ -96,7 +95,8 @@ static inline bool
startswith (gdb::string_view string, gdb::string_view pattern)
{
return (string.length () >= pattern.length ()
- && strncmp (string.data (), pattern.data (), pattern.length ()) == 0);
+ && strncmp (string.data (), pattern.data (), pattern.length ())
+ == 0);
}
/* Return true if the strings are equal. */
@@ -141,7 +141,7 @@ extern void free_vector_argv (std::vector<char *> &v);
/* Return true if VALUE is in [LOW, HIGH]. */
-template <typename T>
+template<typename T>
static bool
in_inclusive_range (T value, T low, T high)
{
@@ -221,7 +221,9 @@ namespace gdb
struct string_view_hash
{
std::size_t operator() (gdb::string_view view) const
- { return fast_hash (view.data (), view.length ()); }
+ {
+ return fast_hash (view.data (), view.length ());
+ }
};
} /* namespace gdb */
diff --git a/gdbsupport/def-vector.h b/gdbsupport/def-vector.h
index 4d1df41a7a1..bdbf2d89e54 100644
--- a/gdbsupport/def-vector.h
+++ b/gdbsupport/def-vector.h
@@ -21,15 +21,16 @@
#include <vector>
#include "gdbsupport/default-init-alloc.h"
-namespace gdb {
+namespace gdb
+{
/* A vector that uses an allocator that default constructs using
default-initialization rather than value-initialization. The idea
is to use this when you don't want zero-initialization of elements
of vectors of trivial types. E.g., byte buffers. */
-template<typename T> using def_vector
- = std::vector<T, gdb::default_init_allocator<T>>;
+template<typename T>
+using def_vector = std::vector<T, gdb::default_init_allocator<T>>;
} /* namespace gdb */
diff --git a/gdbsupport/default-init-alloc.h b/gdbsupport/default-init-alloc.h
index 9c8b5a2c689..79fc70914c4 100644
--- a/gdbsupport/default-init-alloc.h
+++ b/gdbsupport/default-init-alloc.h
@@ -18,7 +18,8 @@
#ifndef COMMON_DEFAULT_INIT_ALLOC_H
#define COMMON_DEFAULT_INIT_ALLOC_H
-namespace gdb {
+namespace gdb
+{
/* An allocator that default constructs using default-initialization
rather than value-initialization. The idea is to use this when you
@@ -54,9 +55,9 @@ public:
/* .. and provide an override/overload for the case of default
construction (i.e., no arguments). This is where we construct
with default-init. */
- template <typename U>
- void construct (U *ptr)
- noexcept (std::is_nothrow_default_constructible<U>::value)
+ template<typename U>
+ void
+ construct (U *ptr) noexcept (std::is_nothrow_default_constructible<U>::value)
{
::new ((void *) ptr) U; /* default-init */
}
diff --git a/gdbsupport/eintr.h b/gdbsupport/eintr.h
index f78d0ec4a2f..3bb76931e90 100644
--- a/gdbsupport/eintr.h
+++ b/gdbsupport/eintr.h
@@ -51,7 +51,7 @@ namespace gdb
template<typename ErrorValType, typename Fun, typename... Args>
inline auto
-handle_eintr (ErrorValType errval, const Fun &f, const Args &... args)
+handle_eintr (ErrorValType errval, const Fun &f, const Args &...args)
-> decltype (f (args...))
{
decltype (f (args...)) ret;
diff --git a/gdbsupport/enum-flags.h b/gdbsupport/enum-flags.h
index 700037f6126..da24b413364 100644
--- a/gdbsupport/enum-flags.h
+++ b/gdbsupport/enum-flags.h
@@ -56,8 +56,8 @@
/* Use this to mark an enum as flags enum. It defines FLAGS_TYPE as
enum_flags wrapper class for ENUM, and enables the global operator
overloads for ENUM. */
-#define DEF_ENUM_FLAGS_TYPE(enum_type, flags_type) \
- typedef enum_flags<enum_type> flags_type; \
+#define DEF_ENUM_FLAGS_TYPE(enum_type, flags_type) \
+ typedef enum_flags<enum_type> flags_type; \
void is_enum_flags_enum_type (enum_type *)
/* To enable the global enum_flags operators for enum, declare an
@@ -78,22 +78,57 @@
/* Note that std::underlying_type<enum_type> is not what we want here,
since that returns unsigned int even when the enum decays to signed
int. */
-template<int size, bool sign> class integer_for_size { typedef void type; };
-template<> struct integer_for_size<1, 0> { typedef uint8_t type; };
-template<> struct integer_for_size<2, 0> { typedef uint16_t type; };
-template<> struct integer_for_size<4, 0> { typedef uint32_t type; };
-template<> struct integer_for_size<8, 0> { typedef uint64_t type; };
-template<> struct integer_for_size<1, 1> { typedef int8_t type; };
-template<> struct integer_for_size<2, 1> { typedef int16_t type; };
-template<> struct integer_for_size<4, 1> { typedef int32_t type; };
-template<> struct integer_for_size<8, 1> { typedef int64_t type; };
+template<int size, bool sign>
+class integer_for_size
+{
+ typedef void type;
+};
+template<>
+struct integer_for_size<1, 0>
+{
+ typedef uint8_t type;
+};
+template<>
+struct integer_for_size<2, 0>
+{
+ typedef uint16_t type;
+};
+template<>
+struct integer_for_size<4, 0>
+{
+ typedef uint32_t type;
+};
+template<>
+struct integer_for_size<8, 0>
+{
+ typedef uint64_t type;
+};
+template<>
+struct integer_for_size<1, 1>
+{
+ typedef int8_t type;
+};
+template<>
+struct integer_for_size<2, 1>
+{
+ typedef int16_t type;
+};
+template<>
+struct integer_for_size<4, 1>
+{
+ typedef int32_t type;
+};
+template<>
+struct integer_for_size<8, 1>
+{
+ typedef int64_t type;
+};
template<typename T>
struct enum_underlying_type
{
- typedef typename
- integer_for_size<sizeof (T), static_cast<bool>(T (-1) < T (0))>::type
- type;
+ typedef typename integer_for_size<sizeof (T), static_cast<bool> (
+ T (-1) < T (0))>::type type;
};
namespace enum_flags_detail
@@ -114,16 +149,16 @@ namespace enum_flags_detail
struct zero_type;
/* gdb::Requires trait helpers. */
-template <typename enum_type>
+template<typename enum_type>
using EnumIsUnsigned
= std::is_unsigned<typename enum_underlying_type<enum_type>::type>;
-template <typename enum_type>
+template<typename enum_type>
using EnumIsSigned
= std::is_signed<typename enum_underlying_type<enum_type>::type>;
-}
+} // namespace enum_flags_detail
-template <typename E>
+template<typename E>
class enum_flags
{
public:
@@ -139,24 +174,24 @@ public:
/* Convenience for to_string implementations, to build a
string_mapping array. */
-#define MAP_ENUM_FLAG(ENUM_FLAG) { ENUM_FLAG, #ENUM_FLAG }
+#define MAP_ENUM_FLAG(ENUM_FLAG) \
+ { \
+ ENUM_FLAG, #ENUM_FLAG \
+ }
public:
/* Allow default construction. */
- constexpr enum_flags ()
- : m_enum_value ((enum_type) 0)
- {}
+ constexpr enum_flags () : m_enum_value ((enum_type) 0) {}
/* The default move/copy ctor/assignment do the right thing. */
/* If you get an error saying these two overloads are ambiguous,
then you tried to mix values of different enum types. */
- constexpr enum_flags (enum_type e)
- : m_enum_value (e)
- {}
+ constexpr enum_flags (enum_type e) : m_enum_value (e) {}
constexpr enum_flags (enum_flags_detail::zero_type *zero)
: m_enum_value ((enum_type) 0)
- {}
+ {
+ }
enum_flags &operator&= (enum_flags e) &
{
@@ -180,16 +215,10 @@ public:
void operator^= (enum_flags e) && = delete;
/* Like raw enums, allow conversion to the underlying type. */
- constexpr operator underlying_type () const
- {
- return m_enum_value;
- }
+ constexpr operator underlying_type () const { return m_enum_value; }
/* Get the underlying value as a raw enum. */
- constexpr enum_type raw () const
- {
- return m_enum_value;
- }
+ constexpr enum_type raw () const { return m_enum_value; }
/* Binary operations involving some unrelated type (which would be a
bug) are implemented as non-members, and deleted. */
@@ -212,7 +241,7 @@ private:
enum_type m_enum_value;
};
-template <typename E>
+template<typename E>
using is_enum_flags_enum_type_t
= decltype (is_enum_flags_enum_type (std::declval<E *> ()));
@@ -220,60 +249,69 @@ using is_enum_flags_enum_type_t
/* Generate binary operators. */
-#define ENUM_FLAGS_GEN_BINOP(OPERATOR_OP, OP) \
- \
- /* Raw enum on both LHS/RHS. Returns raw enum type. */ \
- template <typename enum_type, \
- typename = is_enum_flags_enum_type_t<enum_type>> \
- constexpr enum_type \
- OPERATOR_OP (enum_type e1, enum_type e2) \
- { \
- using underlying = typename enum_flags<enum_type>::underlying_type; \
- return (enum_type) (underlying (e1) OP underlying (e2)); \
- } \
- \
- /* enum_flags on the LHS. */ \
- template <typename enum_type, \
- typename = is_enum_flags_enum_type_t<enum_type>> \
- constexpr enum_flags<enum_type> \
- OPERATOR_OP (enum_flags<enum_type> e1, enum_type e2) \
- { return e1.raw () OP e2; } \
- \
- /* enum_flags on the RHS. */ \
- template <typename enum_type, \
- typename = is_enum_flags_enum_type_t<enum_type>> \
- constexpr enum_flags<enum_type> \
- OPERATOR_OP (enum_type e1, enum_flags<enum_type> e2) \
- { return e1 OP e2.raw (); } \
- \
- /* enum_flags on both LHS/RHS. */ \
- template <typename enum_type, \
- typename = is_enum_flags_enum_type_t<enum_type>> \
- constexpr enum_flags<enum_type> \
- OPERATOR_OP (enum_flags<enum_type> e1, enum_flags<enum_type> e2) \
- { return e1.raw () OP e2.raw (); } \
- \
- /* Delete cases involving unrelated types. */ \
- \
- template <typename enum_type, typename unrelated_type, \
- typename = is_enum_flags_enum_type_t<enum_type>> \
- constexpr enum_flags<enum_type> \
- OPERATOR_OP (enum_type e1, unrelated_type e2) = delete; \
- \
- template <typename enum_type, typename unrelated_type, \
- typename = is_enum_flags_enum_type_t<enum_type>> \
- constexpr enum_flags<enum_type> \
- OPERATOR_OP (unrelated_type e1, enum_type e2) = delete; \
- \
- template <typename enum_type, typename unrelated_type, \
- typename = is_enum_flags_enum_type_t<enum_type>> \
- constexpr enum_flags<enum_type> \
- OPERATOR_OP (enum_flags<enum_type> e1, unrelated_type e2) = delete; \
- \
- template <typename enum_type, typename unrelated_type, \
- typename = is_enum_flags_enum_type_t<enum_type>> \
- constexpr enum_flags<enum_type> \
- OPERATOR_OP (unrelated_type e1, enum_flags<enum_type> e2) = delete;
+#define ENUM_FLAGS_GEN_BINOP(OPERATOR_OP, OP) \
+ \
+ /* Raw enum on both LHS/RHS. Returns raw enum type. */ \
+ template<typename enum_type, \
+ typename = is_enum_flags_enum_type_t<enum_type>> \
+ constexpr enum_type OPERATOR_OP (enum_type e1, enum_type e2) \
+ { \
+ using underlying = typename enum_flags<enum_type>::underlying_type; \
+ return (enum_type) (underlying (e1) OP underlying (e2)); \
+ } \
+ \
+ /* enum_flags on the LHS. */ \
+ template<typename enum_type, \
+ typename = is_enum_flags_enum_type_t<enum_type>> \
+ constexpr enum_flags<enum_type> OPERATOR_OP (enum_flags<enum_type> e1, \
+ enum_type e2) \
+ { \
+ return e1.raw () OP e2; \
+ } \
+ \
+ /* enum_flags on the RHS. */ \
+ template<typename enum_type, \
+ typename = is_enum_flags_enum_type_t<enum_type>> \
+ constexpr enum_flags<enum_type> OPERATOR_OP (enum_type e1, \
+ enum_flags<enum_type> e2) \
+ { \
+ return e1 OP e2.raw (); \
+ } \
+ \
+ /* enum_flags on both LHS/RHS. */ \
+ template<typename enum_type, \
+ typename = is_enum_flags_enum_type_t<enum_type>> \
+ constexpr enum_flags<enum_type> OPERATOR_OP (enum_flags<enum_type> e1, \
+ enum_flags<enum_type> e2) \
+ { \
+ return e1.raw () OP e2.raw (); \
+ } \
+ \
+ /* Delete cases involving unrelated types. */ \
+ \
+ template<typename enum_type, typename unrelated_type, \
+ typename = is_enum_flags_enum_type_t<enum_type>> \
+ constexpr enum_flags<enum_type> OPERATOR_OP (enum_type e1, \
+ unrelated_type e2) \
+ = delete; \
+ \
+ template<typename enum_type, typename unrelated_type, \
+ typename = is_enum_flags_enum_type_t<enum_type>> \
+ constexpr enum_flags<enum_type> OPERATOR_OP (unrelated_type e1, \
+ enum_type e2) \
+ = delete; \
+ \
+ template<typename enum_type, typename unrelated_type, \
+ typename = is_enum_flags_enum_type_t<enum_type>> \
+ constexpr enum_flags<enum_type> OPERATOR_OP (enum_flags<enum_type> e1, \
+ unrelated_type e2) \
+ = delete; \
+ \
+ template<typename enum_type, typename unrelated_type, \
+ typename = is_enum_flags_enum_type_t<enum_type>> \
+ constexpr enum_flags<enum_type> OPERATOR_OP (unrelated_type e1, \
+ enum_flags<enum_type> e2) \
+ = delete;
/* Generate non-member compound assignment operators. Only the raw
enum versions are defined here. The enum_flags versions are
@@ -295,31 +333,30 @@ using is_enum_flags_enum_type_t
If you really need to 'or' enumerators of different flag types,
cast to integer first.
*/
-#define ENUM_FLAGS_GEN_COMPOUND_ASSIGN(OPERATOR_OP, OP) \
- /* lval reference version. */ \
- template <typename enum_type, \
- typename = is_enum_flags_enum_type_t<enum_type>> \
- constexpr enum_type & \
- OPERATOR_OP (enum_type &e1, enum_type e2) \
- { return e1 = e1 OP e2; } \
- \
- /* rval reference version. */ \
- template <typename enum_type, \
- typename = is_enum_flags_enum_type_t<enum_type>> \
- void \
- OPERATOR_OP (enum_type &&e1, enum_type e2) = delete; \
- \
- /* Delete compound assignment from unrelated types. */ \
- \
- template <typename enum_type, typename other_enum_type, \
- typename = is_enum_flags_enum_type_t<enum_type>> \
- constexpr enum_type & \
- OPERATOR_OP (enum_type &e1, other_enum_type e2) = delete; \
- \
- template <typename enum_type, typename other_enum_type, \
- typename = is_enum_flags_enum_type_t<enum_type>> \
- void \
- OPERATOR_OP (enum_type &&e1, other_enum_type e2) = delete;
+#define ENUM_FLAGS_GEN_COMPOUND_ASSIGN(OPERATOR_OP, OP) \
+ /* lval reference version. */ \
+ template<typename enum_type, \
+ typename = is_enum_flags_enum_type_t<enum_type>> \
+ constexpr enum_type &OPERATOR_OP (enum_type &e1, enum_type e2) \
+ { \
+ return e1 = e1 OP e2; \
+ } \
+ \
+ /* rval reference version. */ \
+ template<typename enum_type, \
+ typename = is_enum_flags_enum_type_t<enum_type>> \
+ void OPERATOR_OP (enum_type &&e1, enum_type e2) = delete; \
+ \
+ /* Delete compound assignment from unrelated types. */ \
+ \
+ template<typename enum_type, typename other_enum_type, \
+ typename = is_enum_flags_enum_type_t<enum_type>> \
+ constexpr enum_type &OPERATOR_OP (enum_type &e1, other_enum_type e2) \
+ = delete; \
+ \
+ template<typename enum_type, typename other_enum_type, \
+ typename = is_enum_flags_enum_type_t<enum_type>> \
+ void OPERATOR_OP (enum_type &&e1, other_enum_type e2) = delete;
ENUM_FLAGS_GEN_BINOP (operator|, |)
ENUM_FLAGS_GEN_BINOP (operator&, &)
@@ -338,46 +375,50 @@ ENUM_FLAGS_GEN_COMPOUND_ASSIGN (operator^=, ^)
convertion to underlying type too, would trigger the built-in 'bool
operator==(unsigned, int)' operator. */
-#define ENUM_FLAGS_GEN_COMP(OPERATOR_OP, OP) \
- \
- /* enum_flags OP enum_flags */ \
- \
- template <typename enum_type> \
- constexpr bool \
- OPERATOR_OP (enum_flags<enum_type> lhs, enum_flags<enum_type> rhs) \
- { return lhs.raw () OP rhs.raw (); } \
- \
- /* enum_flags OP other */ \
- \
- template <typename enum_type> \
- constexpr bool \
- OPERATOR_OP (enum_flags<enum_type> lhs, enum_type rhs) \
- { return lhs.raw () OP rhs; } \
- \
- template <typename enum_type> \
- constexpr bool \
- OPERATOR_OP (enum_flags<enum_type> lhs, int rhs) \
- { return lhs.raw () OP rhs; } \
- \
- template <typename enum_type, typename U> \
- constexpr bool \
- OPERATOR_OP (enum_flags<enum_type> lhs, U rhs) = delete; \
- \
- /* other OP enum_flags */ \
- \
- template <typename enum_type> \
- constexpr bool \
- OPERATOR_OP (enum_type lhs, enum_flags<enum_type> rhs) \
- { return lhs OP rhs.raw (); } \
- \
- template <typename enum_type> \
- constexpr bool \
- OPERATOR_OP (int lhs, enum_flags<enum_type> rhs) \
- { return lhs OP rhs.raw (); } \
- \
- template <typename enum_type, typename U> \
- constexpr bool \
- OPERATOR_OP (U lhs, enum_flags<enum_type> rhs) = delete;
+#define ENUM_FLAGS_GEN_COMP(OPERATOR_OP, OP) \
+ \
+ /* enum_flags OP enum_flags */ \
+ \
+ template<typename enum_type> \
+ constexpr bool OPERATOR_OP (enum_flags<enum_type> lhs, \
+ enum_flags<enum_type> rhs) \
+ { \
+ return lhs.raw () OP rhs.raw (); \
+ } \
+ \
+ /* enum_flags OP other */ \
+ \
+ template<typename enum_type> \
+ constexpr bool OPERATOR_OP (enum_flags<enum_type> lhs, enum_type rhs) \
+ { \
+ return lhs.raw () OP rhs; \
+ } \
+ \
+ template<typename enum_type> \
+ constexpr bool OPERATOR_OP (enum_flags<enum_type> lhs, int rhs) \
+ { \
+ return lhs.raw () OP rhs; \
+ } \
+ \
+ template<typename enum_type, typename U> \
+ constexpr bool OPERATOR_OP (enum_flags<enum_type> lhs, U rhs) = delete; \
+ \
+ /* other OP enum_flags */ \
+ \
+ template<typename enum_type> \
+ constexpr bool OPERATOR_OP (enum_type lhs, enum_flags<enum_type> rhs) \
+ { \
+ return lhs OP rhs.raw (); \
+ } \
+ \
+ template<typename enum_type> \
+ constexpr bool OPERATOR_OP (int lhs, enum_flags<enum_type> rhs) \
+ { \
+ return lhs OP rhs.raw (); \
+ } \
+ \
+ template<typename enum_type, typename U> \
+ constexpr bool OPERATOR_OP (U lhs, enum_flags<enum_type> rhs) = delete;
ENUM_FLAGS_GEN_COMP (operator==, ==)
ENUM_FLAGS_GEN_COMP (operator!=, !=)
@@ -388,54 +429,50 @@ ENUM_FLAGS_GEN_COMP (operator!=, !=)
if it were not unsigned, undefined behavior could result. However,
asserting this in the class itself would require too many
unnecessary changes to usages of otherwise OK enum types. */
-template <typename enum_type,
- typename = is_enum_flags_enum_type_t<enum_type>,
- typename
- = gdb::Requires<enum_flags_detail::EnumIsUnsigned<enum_type>>>
+template<typename enum_type, typename = is_enum_flags_enum_type_t<enum_type>,
+ typename
+ = gdb::Requires<enum_flags_detail::EnumIsUnsigned<enum_type>>>
constexpr enum_type
-operator~ (enum_type e)
+operator~(enum_type e)
{
using underlying = typename enum_flags<enum_type>::underlying_type;
return (enum_type) ~underlying (e);
}
-template <typename enum_type,
- typename = is_enum_flags_enum_type_t<enum_type>,
- typename = gdb::Requires<enum_flags_detail::EnumIsSigned<enum_type>>>
-constexpr void operator~ (enum_type e) = delete;
+template<typename enum_type, typename = is_enum_flags_enum_type_t<enum_type>,
+ typename = gdb::Requires<enum_flags_detail::EnumIsSigned<enum_type>>>
+constexpr void operator~(enum_type e) = delete;
-template <typename enum_type,
- typename = is_enum_flags_enum_type_t<enum_type>,
- typename
- = gdb::Requires<enum_flags_detail::EnumIsUnsigned<enum_type>>>
+template<typename enum_type, typename = is_enum_flags_enum_type_t<enum_type>,
+ typename
+ = gdb::Requires<enum_flags_detail::EnumIsUnsigned<enum_type>>>
constexpr enum_flags<enum_type>
-operator~ (enum_flags<enum_type> e)
+operator~(enum_flags<enum_type> e)
{
using underlying = typename enum_flags<enum_type>::underlying_type;
return (enum_type) ~underlying (e);
}
-template <typename enum_type,
- typename = is_enum_flags_enum_type_t<enum_type>,
- typename = gdb::Requires<enum_flags_detail::EnumIsSigned<enum_type>>>
-constexpr void operator~ (enum_flags<enum_type> e) = delete;
+template<typename enum_type, typename = is_enum_flags_enum_type_t<enum_type>,
+ typename = gdb::Requires<enum_flags_detail::EnumIsSigned<enum_type>>>
+constexpr void operator~(enum_flags<enum_type> e) = delete;
/* Delete operator<< and operator>>. */
-template <typename enum_type, typename any_type,
- typename = is_enum_flags_enum_type_t<enum_type>>
+template<typename enum_type, typename any_type,
+ typename = is_enum_flags_enum_type_t<enum_type>>
void operator<< (const enum_type &, const any_type &) = delete;
-template <typename enum_type, typename any_type,
- typename = is_enum_flags_enum_type_t<enum_type>>
+template<typename enum_type, typename any_type,
+ typename = is_enum_flags_enum_type_t<enum_type>>
void operator<< (const enum_flags<enum_type> &, const any_type &) = delete;
-template <typename enum_type, typename any_type,
- typename = is_enum_flags_enum_type_t<enum_type>>
+template<typename enum_type, typename any_type,
+ typename = is_enum_flags_enum_type_t<enum_type>>
void operator>> (const enum_type &, const any_type &) = delete;
-template <typename enum_type, typename any_type,
- typename = is_enum_flags_enum_type_t<enum_type>>
+template<typename enum_type, typename any_type,
+ typename = is_enum_flags_enum_type_t<enum_type>>
void operator>> (const enum_flags<enum_type> &, const any_type &) = delete;
template<typename E>
@@ -451,20 +488,20 @@ enum_flags<E>::to_string (const string_mapping (&mapping)[N]) const
for (const auto &entry : mapping)
{
if ((flags & entry.flag) != 0)
- {
- /* Work with an unsigned version of the underlying type,
+ {
+ /* Work with an unsigned version of the underlying type,
because if enum_type's underlying type is signed, op~
won't be defined for it, and, bitwise operations on
signed types are implementation defined. */
- using uns = typename std::make_unsigned<underlying_type>::type;
- flags &= (enum_type) ~(uns) entry.flag;
+ using uns = typename std::make_unsigned<underlying_type>::type;
+ flags &= (enum_type) ~(uns) entry.flag;
- if (need_space)
- res += " ";
- res += entry.str;
+ if (need_space)
+ res += " ";
+ res += entry.str;
- need_space = true;
- }
+ need_space = true;
+ }
}
/* If there were flags not included in the mapping, print them as
@@ -472,7 +509,7 @@ enum_flags<E>::to_string (const string_mapping (&mapping)[N]) const
if (flags != 0)
{
if (need_space)
- res += " ";
+ res += " ";
res += hex_string (flags);
}
@@ -485,8 +522,7 @@ enum_flags<E>::to_string (const string_mapping (&mapping)[N]) const
/* In C, the flags type is just a typedef for the enum type. */
-#define DEF_ENUM_FLAGS_TYPE(enum_type, flags_type) \
- typedef enum_type flags_type
+#define DEF_ENUM_FLAGS_TYPE(enum_type, flags_type) typedef enum_type flags_type
#endif /* __cplusplus */
diff --git a/gdbsupport/environ.cc b/gdbsupport/environ.cc
index d4d81290bf7..36c8e56a5a9 100644
--- a/gdbsupport/environ.cc
+++ b/gdbsupport/environ.cc
@@ -43,7 +43,8 @@ gdb_environ::operator= (gdb_environ &&e)
/* See gdbsupport/environ.h. */
-gdb_environ gdb_environ::from_host_environ ()
+gdb_environ
+gdb_environ::from_host_environ ()
{
extern char **environ;
gdb_environ e;
@@ -55,7 +56,7 @@ gdb_environ gdb_environ::from_host_environ ()
{
/* Make sure we add the element before the last (NULL). */
e.m_environ_vector.insert (e.m_environ_vector.end () - 1,
- xstrdup (environ[i]));
+ xstrdup (environ[i]));
}
return e;
@@ -137,8 +138,7 @@ gdb_environ::unset (const char *var, bool update_unset_list)
/* We iterate until '.end () - 1' because the last element is
always NULL. */
for (it_env = m_environ_vector.begin ();
- it_env != m_environ_vector.end () - 1;
- ++it_env)
+ it_env != m_environ_vector.end () - 1; ++it_env)
if (match_var_in_string (*it_env, var, len))
break;
diff --git a/gdbsupport/environ.h b/gdbsupport/environ.h
index b6d30ce9046..df844bc07c1 100644
--- a/gdbsupport/environ.h
+++ b/gdbsupport/environ.h
@@ -35,10 +35,7 @@ public:
m_environ_vector.push_back (NULL);
}
- ~gdb_environ ()
- {
- clear ();
- }
+ ~gdb_environ () { clear (); }
/* Move constructor. */
gdb_environ (gdb_environ &&e)
diff --git a/gdbsupport/errors.cc b/gdbsupport/errors.cc
index 566be377e3f..b5b9cf93cdc 100644
--- a/gdbsupport/errors.cc
+++ b/gdbsupport/errors.cc
@@ -19,7 +19,7 @@
#include "common-defs.h"
#include "errors.h"
-#if defined (USE_WIN32API) || defined(__CYGWIN__)
+#if defined(USE_WIN32API) || defined(__CYGWIN__)
#include <windows.h>
#endif /* USE_WIN32API */
@@ -71,7 +71,7 @@ internal_warning_loc (const char *file, int line, const char *fmt, ...)
va_end (ap);
}
-#if defined (USE_WIN32API) || defined(__CYGWIN__)
+#if defined(USE_WIN32API) || defined(__CYGWIN__)
/* See errors.h. */
@@ -82,29 +82,23 @@ strwinerror (ULONGEST error)
TCHAR *msgbuf;
DWORD lasterr = GetLastError ();
DWORD chars = FormatMessage (FORMAT_MESSAGE_FROM_SYSTEM
- | FORMAT_MESSAGE_ALLOCATE_BUFFER,
- NULL,
- error,
- 0, /* Default language */
- (LPTSTR) &msgbuf,
- 0,
- NULL);
+ | FORMAT_MESSAGE_ALLOCATE_BUFFER,
+ NULL, error, 0, /* Default language */
+ (LPTSTR) &msgbuf, 0, NULL);
if (chars != 0)
{
/* If there is an \r\n appended, zap it. */
- if (chars >= 2
- && msgbuf[chars - 2] == '\r'
- && msgbuf[chars - 1] == '\n')
- {
- chars -= 2;
- msgbuf[chars] = 0;
- }
+ if (chars >= 2 && msgbuf[chars - 2] == '\r' && msgbuf[chars - 1] == '\n')
+ {
+ chars -= 2;
+ msgbuf[chars] = 0;
+ }
if (chars > ARRAY_SIZE (buf) - 1)
- {
- chars = ARRAY_SIZE (buf) - 1;
- msgbuf [chars] = 0;
- }
+ {
+ chars = ARRAY_SIZE (buf) - 1;
+ msgbuf[chars] = 0;
+ }
#ifdef UNICODE
wcstombs (buf, msgbuf, chars + 1);
diff --git a/gdbsupport/errors.h b/gdbsupport/errors.h
index 2304bc1e3d1..5dc2d697b26 100644
--- a/gdbsupport/errors.h
+++ b/gdbsupport/errors.h
@@ -25,22 +25,20 @@
vprintf-style argument list. The function "vwarning" must be
provided by the client. */
-extern void warning (const char *fmt, ...)
- ATTRIBUTE_PRINTF (1, 2);
+extern void warning (const char *fmt, ...) ATTRIBUTE_PRINTF (1, 2);
-extern void vwarning (const char *fmt, va_list args)
- ATTRIBUTE_PRINTF (1, 0);
+extern void vwarning (const char *fmt, va_list args) ATTRIBUTE_PRINTF (1, 0);
/* A non-predictable, non-fatal error was detected. The requested
operation cannot proceed. An error message is constructed using
a printf- or vprintf-style argument list. These functions do not
return. The function "verror" must be provided by the client. */
-extern void error (const char *fmt, ...)
- ATTRIBUTE_NORETURN ATTRIBUTE_PRINTF (1, 2);
+extern void error (const char *fmt, ...) ATTRIBUTE_NORETURN
+ ATTRIBUTE_PRINTF (1, 2);
-extern void verror (const char *fmt, va_list args)
- ATTRIBUTE_NORETURN ATTRIBUTE_PRINTF (1, 0);
+extern void verror (const char *fmt, va_list args) ATTRIBUTE_NORETURN
+ ATTRIBUTE_PRINTF (1, 0);
/* An internal error was detected. Internal errors indicate
programming errors such as assertion failures, as opposed to
@@ -53,16 +51,16 @@ extern void verror (const char *fmt, va_list args)
automatically. The function "internal_verror" must be provided
by the client. */
-extern void internal_error_loc (const char *file, int line,
- const char *fmt, ...)
- ATTRIBUTE_NORETURN ATTRIBUTE_PRINTF (3, 4);
+extern void internal_error_loc (const char *file, int line, const char *fmt,
+ ...) ATTRIBUTE_NORETURN
+ ATTRIBUTE_PRINTF (3, 4);
-#define internal_error(fmt, ...) \
+#define internal_error(fmt, ...) \
internal_error_loc (__FILE__, __LINE__, fmt, ##__VA_ARGS__)
-extern void internal_verror (const char *file, int line,
- const char *fmt, va_list args)
- ATTRIBUTE_NORETURN ATTRIBUTE_PRINTF (3, 0);
+extern void internal_verror (const char *file, int line, const char *fmt,
+ va_list args) ATTRIBUTE_NORETURN
+ ATTRIBUTE_PRINTF (3, 0);
/* An internal problem was detected, but the requested operation can
still proceed. Internal warnings indicate programming errors as
@@ -71,17 +69,14 @@ extern void internal_verror (const char *file, int line,
argument list. The function "internal_vwarning" must be provided
by the client. */
-extern void internal_warning_loc (const char *file, int line,
- const char *fmt, ...)
- ATTRIBUTE_PRINTF (3, 4);
+extern void internal_warning_loc (const char *file, int line, const char *fmt,
+ ...) ATTRIBUTE_PRINTF (3, 4);
-#define internal_warning(fmt, ...) \
+#define internal_warning(fmt, ...) \
internal_warning_loc (__FILE__, __LINE__, fmt, ##__VA_ARGS__)
-extern void internal_vwarning (const char *file, int line,
- const char *fmt, va_list args)
- ATTRIBUTE_PRINTF (3, 0);
-
+extern void internal_vwarning (const char *file, int line, const char *fmt,
+ va_list args) ATTRIBUTE_PRINTF (3, 0);
/* Like "error", but the error message is constructed by combining
STRING with the system error message for errno. This function does
diff --git a/gdbsupport/event-loop.cc b/gdbsupport/event-loop.cc
index 52e7fd2223f..f9260f71547 100644
--- a/gdbsupport/event-loop.cc
+++ b/gdbsupport/event-loop.cc
@@ -23,9 +23,9 @@
#include <chrono>
#ifdef HAVE_POLL
-#if defined (HAVE_POLL_H)
+#if defined(HAVE_POLL_H)
#include <poll.h>
-#elif defined (HAVE_SYS_POLL_H)
+#elif defined(HAVE_SYS_POLL_H)
#include <sys/poll.h>
#endif
#endif
@@ -43,9 +43,9 @@ debug_event_loop_kind debug_event_loop;
/* Tell create_file_handler what events we are interested in.
This is used by the select version of the event loop. */
-#define GDB_READABLE (1<<1)
-#define GDB_WRITABLE (1<<2)
-#define GDB_EXCEPTION (1<<3)
+#define GDB_READABLE (1 << 1)
+#define GDB_WRITABLE (1 << 2)
+#define GDB_EXCEPTION (1 << 3)
/* Information about each file descriptor we register with the event
loop. */
@@ -101,81 +101,79 @@ static bool use_poll = true;
in, for each fd. */
static struct
- {
- /* Ptr to head of file handler list. */
- file_handler *first_file_handler;
+{
+ /* Ptr to head of file handler list. */
+ file_handler *first_file_handler;
- /* Next file handler to handle, for the select variant. To level
+ /* Next file handler to handle, for the select variant. To level
the fairness across event sources, we serve file handlers in a
round-robin-like fashion. The number and order of the polled
file handlers may change between invocations, but this is good
enough. */
- file_handler *next_file_handler;
+ file_handler *next_file_handler;
#ifdef HAVE_POLL
- /* Ptr to array of pollfd structures. */
- struct pollfd *poll_fds;
+ /* Ptr to array of pollfd structures. */
+ struct pollfd *poll_fds;
- /* Next file descriptor to handle, for the poll variant. To level
+ /* Next file descriptor to handle, for the poll variant. To level
the fairness across event sources, we poll the file descriptors
in a round-robin-like fashion. The number and order of the
polled file descriptors may change between invocations, but
this is good enough. */
- int next_poll_fds_index;
+ int next_poll_fds_index;
- /* Timeout in milliseconds for calls to poll(). */
- int poll_timeout;
+ /* Timeout in milliseconds for calls to poll(). */
+ int poll_timeout;
#endif
- /* Masks to be used in the next call to select.
+ /* Masks to be used in the next call to select.
Bits are set in response to calls to create_file_handler. */
- fd_set check_masks[3];
+ fd_set check_masks[3];
- /* What file descriptors were found ready by select. */
- fd_set ready_masks[3];
+ /* What file descriptors were found ready by select. */
+ fd_set ready_masks[3];
- /* Number of file descriptors to monitor (for poll). */
- /* Number of valid bits (highest fd value + 1) (for select). */
- int num_fds;
+ /* Number of file descriptors to monitor (for poll). */
+ /* Number of valid bits (highest fd value + 1) (for select). */
+ int num_fds;
- /* Time structure for calls to select(). */
- struct timeval select_timeout;
+ /* Time structure for calls to select(). */
+ struct timeval select_timeout;
- /* Flag to tell whether the timeout should be used. */
- int timeout_valid;
- }
-gdb_notifier;
+ /* Flag to tell whether the timeout should be used. */
+ int timeout_valid;
+} gdb_notifier;
/* Structure associated with a timer. PROC will be executed at the
first occasion after WHEN. */
struct gdb_timer
- {
- std::chrono::steady_clock::time_point when;
- int timer_id;
- struct gdb_timer *next;
- timer_handler_func *proc; /* Function to call to do the work. */
- gdb_client_data client_data; /* Argument to async_handler_func. */
- };
+{
+ std::chrono::steady_clock::time_point when;
+ int timer_id;
+ struct gdb_timer *next;
+ timer_handler_func *proc; /* Function to call to do the work. */
+ gdb_client_data client_data; /* Argument to async_handler_func. */
+};
/* List of currently active timers. It is sorted in order of
increasing timers. */
static struct
- {
- /* Pointer to first in timer list. */
- struct gdb_timer *first_timer;
+{
+ /* Pointer to first in timer list. */
+ struct gdb_timer *first_timer;
- /* Id of the last timer created. */
- int num_timers;
- }
-timer_list;
+ /* Id of the last timer created. */
+ int num_timers;
+} timer_list;
static void create_file_handler (int fd, int mask, handler_func *proc,
- gdb_client_data client_data,
- std::string &&name, bool is_ui);
+ gdb_client_data client_data,
+ std::string &&name, bool is_ui);
static int gdb_wait_for_event (int);
static int update_wait_timeout (void);
static int poll_timers (void);
-
+
/* Process one high level event. If nothing is ready at this time,
wait at most MSTIMEOUT milliseconds for something to happen (via
gdb_wait_for_event), then process it. Returns >0 if something was
@@ -206,35 +204,35 @@ gdb_do_one_event (int mstimeout)
int res;
switch (event_source_head)
- {
- case 0:
- /* Are any timers that are ready? */
- res = poll_timers ();
- break;
- case 1:
- /* Are there events already waiting to be collected on the
+ {
+ case 0:
+ /* Are any timers that are ready? */
+ res = poll_timers ();
+ break;
+ case 1:
+ /* Are there events already waiting to be collected on the
monitored file descriptors? */
- res = gdb_wait_for_event (0);
- break;
- case 2:
- /* Are there any asynchronous event handlers ready? */
- res = check_async_event_handlers ();
- break;
- default:
- internal_error ("unexpected event_source_head %d",
- event_source_head);
- }
+ res = gdb_wait_for_event (0);
+ break;
+ case 2:
+ /* Are there any asynchronous event handlers ready? */
+ res = check_async_event_handlers ();
+ break;
+ default:
+ internal_error ("unexpected event_source_head %d",
+ event_source_head);
+ }
event_source_head++;
if (event_source_head == number_of_sources)
- event_source_head = 0;
+ event_source_head = 0;
if (res > 0)
- return 1;
+ return 1;
}
if (mstimeout == 0)
- return 0; /* 0ms timeout: do not wait for an event. */
+ return 0; /* 0ms timeout: do not wait for an event. */
/* Block waiting for a new event. If gdb_wait_for_event returns -1,
we should get out because this means that there are no event
@@ -248,19 +246,17 @@ gdb_do_one_event (int mstimeout)
gdb::optional<int> timer_id;
- SCOPE_EXIT
- {
- if (timer_id.has_value ())
- delete_timer (*timer_id);
- };
+ SCOPE_EXIT
+ {
+ if (timer_id.has_value ())
+ delete_timer (*timer_id);
+ };
if (mstimeout > 0)
- timer_id = create_timer (mstimeout,
- [] (gdb_client_data arg)
- {
- ((gdb::optional<int> *) arg)->reset ();
- },
- &timer_id);
+ timer_id = create_timer (
+ mstimeout,
+ [] (gdb_client_data arg) { ((gdb::optional<int> *) arg)->reset (); },
+ &timer_id);
return gdb_wait_for_event (1);
}
@@ -268,7 +264,7 @@ gdb_do_one_event (int mstimeout)
void
add_file_handler (int fd, handler_func *proc, gdb_client_data client_data,
- std::string &&name, bool is_ui)
+ std::string &&name, bool is_ui)
{
#ifdef HAVE_POLL
if (use_poll)
@@ -283,17 +279,17 @@ add_file_handler (int fd, handler_func *proc, gdb_client_data client_data,
fds.fd = fd;
fds.events = POLLIN;
if (poll (&fds, 1, 0) == 1 && (fds.revents & POLLNVAL))
- use_poll = false;
+ use_poll = false;
}
if (use_poll)
{
create_file_handler (fd, POLLIN, proc, client_data, std::move (name),
- is_ui);
+ is_ui);
}
else
#endif /* HAVE_POLL */
- create_file_handler (fd, GDB_READABLE | GDB_EXCEPTION,
- proc, client_data, std::move (name), is_ui);
+ create_file_handler (fd, GDB_READABLE | GDB_EXCEPTION, proc, client_data,
+ std::move (name), is_ui);
}
/* Helper for add_file_handler.
@@ -308,9 +304,9 @@ add_file_handler (int fd, handler_func *proc, gdb_client_data client_data,
occurs for FD. CLIENT_DATA is the argument to pass to PROC. */
static void
-create_file_handler (int fd, int mask, handler_func * proc,
- gdb_client_data client_data, std::string &&name,
- bool is_ui)
+create_file_handler (int fd, int mask, handler_func *proc,
+ gdb_client_data client_data, std::string &&name,
+ bool is_ui)
{
file_handler *file_ptr;
@@ -320,7 +316,7 @@ create_file_handler (int fd, int mask, handler_func * proc,
file_ptr = file_ptr->next_file)
{
if (file_ptr->fd == fd)
- break;
+ break;
}
/* It is a new file descriptor. Add it to the list. Otherwise, just
@@ -335,41 +331,40 @@ create_file_handler (int fd, int mask, handler_func * proc,
#ifdef HAVE_POLL
if (use_poll)
- {
- gdb_notifier.num_fds++;
- if (gdb_notifier.poll_fds)
- gdb_notifier.poll_fds =
- (struct pollfd *) xrealloc (gdb_notifier.poll_fds,
- (gdb_notifier.num_fds
- * sizeof (struct pollfd)));
- else
- gdb_notifier.poll_fds =
- XNEW (struct pollfd);
- (gdb_notifier.poll_fds + gdb_notifier.num_fds - 1)->fd = fd;
- (gdb_notifier.poll_fds + gdb_notifier.num_fds - 1)->events = mask;
- (gdb_notifier.poll_fds + gdb_notifier.num_fds - 1)->revents = 0;
- }
+ {
+ gdb_notifier.num_fds++;
+ if (gdb_notifier.poll_fds)
+ gdb_notifier.poll_fds
+ = (struct pollfd *) xrealloc (gdb_notifier.poll_fds,
+ (gdb_notifier.num_fds
+ * sizeof (struct pollfd)));
+ else
+ gdb_notifier.poll_fds = XNEW (struct pollfd);
+ (gdb_notifier.poll_fds + gdb_notifier.num_fds - 1)->fd = fd;
+ (gdb_notifier.poll_fds + gdb_notifier.num_fds - 1)->events = mask;
+ (gdb_notifier.poll_fds + gdb_notifier.num_fds - 1)->revents = 0;
+ }
else
#endif /* HAVE_POLL */
- {
- if (mask & GDB_READABLE)
- FD_SET (fd, &gdb_notifier.check_masks[0]);
- else
- FD_CLR (fd, &gdb_notifier.check_masks[0]);
-
- if (mask & GDB_WRITABLE)
- FD_SET (fd, &gdb_notifier.check_masks[1]);
- else
- FD_CLR (fd, &gdb_notifier.check_masks[1]);
-
- if (mask & GDB_EXCEPTION)
- FD_SET (fd, &gdb_notifier.check_masks[2]);
- else
- FD_CLR (fd, &gdb_notifier.check_masks[2]);
-
- if (gdb_notifier.num_fds <= fd)
- gdb_notifier.num_fds = fd + 1;
- }
+ {
+ if (mask & GDB_READABLE)
+ FD_SET (fd, &gdb_notifier.check_masks[0]);
+ else
+ FD_CLR (fd, &gdb_notifier.check_masks[0]);
+
+ if (mask & GDB_WRITABLE)
+ FD_SET (fd, &gdb_notifier.check_masks[1]);
+ else
+ FD_CLR (fd, &gdb_notifier.check_masks[1]);
+
+ if (mask & GDB_EXCEPTION)
+ FD_SET (fd, &gdb_notifier.check_masks[2]);
+ else
+ FD_CLR (fd, &gdb_notifier.check_masks[2]);
+
+ if (gdb_notifier.num_fds <= fd)
+ gdb_notifier.num_fds = fd + 1;
+ }
}
file_ptr->proc = proc;
@@ -418,7 +413,7 @@ delete_file_handler (int fd)
file_ptr = file_ptr->next_file)
{
if (file_ptr->fd == fd)
- break;
+ break;
}
if (file_ptr == NULL)
@@ -433,20 +428,20 @@ delete_file_handler (int fd)
/* Create a new poll_fds array by copying every fd's information
but the one we want to get rid of. */
- new_poll_fds = (struct pollfd *)
- xmalloc ((gdb_notifier.num_fds - 1) * sizeof (struct pollfd));
+ new_poll_fds = (struct pollfd *) xmalloc ((gdb_notifier.num_fds - 1)
+ * sizeof (struct pollfd));
for (i = 0, j = 0; i < gdb_notifier.num_fds; i++)
- {
- if ((gdb_notifier.poll_fds + i)->fd != fd)
- {
- (new_poll_fds + j)->fd = (gdb_notifier.poll_fds + i)->fd;
- (new_poll_fds + j)->events = (gdb_notifier.poll_fds + i)->events;
- (new_poll_fds + j)->revents
- = (gdb_notifier.poll_fds + i)->revents;
- j++;
- }
- }
+ {
+ if ((gdb_notifier.poll_fds + i)->fd != fd)
+ {
+ (new_poll_fds + j)->fd = (gdb_notifier.poll_fds + i)->fd;
+ (new_poll_fds + j)->events = (gdb_notifier.poll_fds + i)->events;
+ (new_poll_fds + j)->revents
+ = (gdb_notifier.poll_fds + i)->revents;
+ j++;
+ }
+ }
xfree (gdb_notifier.poll_fds);
gdb_notifier.poll_fds = new_poll_fds;
gdb_notifier.num_fds--;
@@ -455,26 +450,26 @@ delete_file_handler (int fd)
#endif /* HAVE_POLL */
{
if (file_ptr->mask & GDB_READABLE)
- FD_CLR (fd, &gdb_notifier.check_masks[0]);
+ FD_CLR (fd, &gdb_notifier.check_masks[0]);
if (file_ptr->mask & GDB_WRITABLE)
- FD_CLR (fd, &gdb_notifier.check_masks[1]);
+ FD_CLR (fd, &gdb_notifier.check_masks[1]);
if (file_ptr->mask & GDB_EXCEPTION)
- FD_CLR (fd, &gdb_notifier.check_masks[2]);
+ FD_CLR (fd, &gdb_notifier.check_masks[2]);
/* Find current max fd. */
if ((fd + 1) == gdb_notifier.num_fds)
- {
- gdb_notifier.num_fds--;
- for (i = gdb_notifier.num_fds; i; i--)
- {
- if (FD_ISSET (i - 1, &gdb_notifier.check_masks[0])
- || FD_ISSET (i - 1, &gdb_notifier.check_masks[1])
- || FD_ISSET (i - 1, &gdb_notifier.check_masks[2]))
- break;
- }
- gdb_notifier.num_fds = i;
- }
+ {
+ gdb_notifier.num_fds--;
+ for (i = gdb_notifier.num_fds; i; i--)
+ {
+ if (FD_ISSET (i - 1, &gdb_notifier.check_masks[0])
+ || FD_ISSET (i - 1, &gdb_notifier.check_masks[1])
+ || FD_ISSET (i - 1, &gdb_notifier.check_masks[2]))
+ break;
+ }
+ gdb_notifier.num_fds = i;
+ }
}
/* Deactivate the file descriptor, by clearing its mask,
@@ -487,10 +482,10 @@ delete_file_handler (int fd)
if (gdb_notifier.next_file_handler == file_ptr)
{
if (file_ptr->next_file == NULL
- && file_ptr == gdb_notifier.first_file_handler)
- gdb_notifier.next_file_handler = NULL;
+ && file_ptr == gdb_notifier.first_file_handler)
+ gdb_notifier.next_file_handler = NULL;
else
- get_next_file_handler_to_handle_and_advance ();
+ get_next_file_handler_to_handle_and_advance ();
}
/* Get rid of the file handler in the file handler list. */
@@ -499,9 +494,8 @@ delete_file_handler (int fd)
else
{
for (prev_ptr = gdb_notifier.first_file_handler;
- prev_ptr->next_file != file_ptr;
- prev_ptr = prev_ptr->next_file)
- ;
+ prev_ptr->next_file != file_ptr; prev_ptr = prev_ptr->next_file)
+ ;
prev_ptr->next_file = file_ptr->next_file;
}
@@ -537,30 +531,28 @@ handle_file_event (file_handler *file_ptr, int ready_mask)
mask = ready_mask & (file_ptr->mask | error_mask);
if ((mask & (POLLERR | POLLNVAL)) != 0)
- {
- /* Work in progress. We may need to tell somebody
+ {
+ /* Work in progress. We may need to tell somebody
what kind of error we had. */
- if (mask & POLLERR)
- warning (_("Error detected on fd %d"), file_ptr->fd);
- if (mask & POLLNVAL)
- warning (_("Invalid or non-`poll'able fd %d"),
- file_ptr->fd);
- file_ptr->error = 1;
- }
+ if (mask & POLLERR)
+ warning (_ ("Error detected on fd %d"), file_ptr->fd);
+ if (mask & POLLNVAL)
+ warning (_ ("Invalid or non-`poll'able fd %d"), file_ptr->fd);
+ file_ptr->error = 1;
+ }
else
- file_ptr->error = 0;
+ file_ptr->error = 0;
}
else
#endif /* HAVE_POLL */
{
if (ready_mask & GDB_EXCEPTION)
- {
- warning (_("Exception condition detected on fd %d"),
- file_ptr->fd);
- file_ptr->error = 1;
- }
+ {
+ warning (_ ("Exception condition detected on fd %d"), file_ptr->fd);
+ file_ptr->error = 1;
+ }
else
- file_ptr->error = 0;
+ file_ptr->error = 0;
mask = ready_mask & file_ptr->mask;
}
@@ -568,8 +560,8 @@ handle_file_event (file_handler *file_ptr, int ready_mask)
if (mask != 0)
{
event_loop_ui_debug_printf (file_ptr->is_ui,
- "invoking fd file handler `%s`",
- file_ptr->name.c_str ());
+ "invoking fd file handler `%s`",
+ file_ptr->name.c_str ());
file_ptr->proc (file_ptr->error, file_ptr->client_data);
}
}
@@ -602,17 +594,17 @@ gdb_wait_for_event (int block)
int timeout;
if (block)
- timeout = gdb_notifier.timeout_valid ? gdb_notifier.poll_timeout : -1;
+ timeout = gdb_notifier.timeout_valid ? gdb_notifier.poll_timeout : -1;
else
- timeout = 0;
+ timeout = 0;
num_found = poll (gdb_notifier.poll_fds,
- (unsigned long) gdb_notifier.num_fds, timeout);
+ (unsigned long) gdb_notifier.num_fds, timeout);
/* Don't print anything if we get out of poll because of a
signal. */
if (num_found == -1 && errno != EINTR)
- perror_with_name (("poll"));
+ perror_with_name (("poll"));
}
else
#endif /* HAVE_POLL */
@@ -621,47 +613,46 @@ gdb_wait_for_event (int block)
struct timeval *timeout_p;
if (block)
- timeout_p = gdb_notifier.timeout_valid
- ? &gdb_notifier.select_timeout : NULL;
+ timeout_p
+ = gdb_notifier.timeout_valid ? &gdb_notifier.select_timeout : NULL;
else
- {
- memset (&select_timeout, 0, sizeof (select_timeout));
- timeout_p = &select_timeout;
- }
+ {
+ memset (&select_timeout, 0, sizeof (select_timeout));
+ timeout_p = &select_timeout;
+ }
gdb_notifier.ready_masks[0] = gdb_notifier.check_masks[0];
gdb_notifier.ready_masks[1] = gdb_notifier.check_masks[1];
gdb_notifier.ready_masks[2] = gdb_notifier.check_masks[2];
- num_found = gdb_select (gdb_notifier.num_fds,
- &gdb_notifier.ready_masks[0],
- &gdb_notifier.ready_masks[1],
- &gdb_notifier.ready_masks[2],
- timeout_p);
+ num_found
+ = gdb_select (gdb_notifier.num_fds, &gdb_notifier.ready_masks[0],
+ &gdb_notifier.ready_masks[1],
+ &gdb_notifier.ready_masks[2], timeout_p);
/* Clear the masks after an error from select. */
if (num_found == -1)
- {
- FD_ZERO (&gdb_notifier.ready_masks[0]);
- FD_ZERO (&gdb_notifier.ready_masks[1]);
- FD_ZERO (&gdb_notifier.ready_masks[2]);
+ {
+ FD_ZERO (&gdb_notifier.ready_masks[0]);
+ FD_ZERO (&gdb_notifier.ready_masks[1]);
+ FD_ZERO (&gdb_notifier.ready_masks[2]);
- /* Dont print anything if we got a signal, let gdb handle
+ /* Dont print anything if we got a signal, let gdb handle
it. */
- if (errno != EINTR)
- perror_with_name (("select"));
- }
+ if (errno != EINTR)
+ perror_with_name (("select"));
+ }
}
/* Avoid looking at poll_fds[i]->revents if no event fired. */
if (num_found <= 0)
return 0;
- /* Run event handlers. We always run just one handler and go back
+ /* Run event handlers. We always run just one handler and go back
to polling, in case a handler changes the notifier list. Since
events for sources we haven't consumed yet wake poll/select
immediately, no event is lost. */
- /* To level the fairness across event descriptors, we handle them in
+ /* To level the fairness across event descriptors, we handle them in
a round-robin-like fashion. The number and order of descriptors
may change between invocations, but this is good enough. */
#ifdef HAVE_POLL
@@ -671,23 +662,22 @@ gdb_wait_for_event (int block)
int mask;
while (1)
- {
- if (gdb_notifier.next_poll_fds_index >= gdb_notifier.num_fds)
- gdb_notifier.next_poll_fds_index = 0;
- i = gdb_notifier.next_poll_fds_index++;
-
- gdb_assert (i < gdb_notifier.num_fds);
- if ((gdb_notifier.poll_fds + i)->revents)
- break;
- }
-
- for (file_ptr = gdb_notifier.first_file_handler;
- file_ptr != NULL;
- file_ptr = file_ptr->next_file)
- {
- if (file_ptr->fd == (gdb_notifier.poll_fds + i)->fd)
- break;
- }
+ {
+ if (gdb_notifier.next_poll_fds_index >= gdb_notifier.num_fds)
+ gdb_notifier.next_poll_fds_index = 0;
+ i = gdb_notifier.next_poll_fds_index++;
+
+ gdb_assert (i < gdb_notifier.num_fds);
+ if ((gdb_notifier.poll_fds + i)->revents)
+ break;
+ }
+
+ for (file_ptr = gdb_notifier.first_file_handler; file_ptr != NULL;
+ file_ptr = file_ptr->next_file)
+ {
+ if (file_ptr->fd == (gdb_notifier.poll_fds + i)->fd)
+ break;
+ }
gdb_assert (file_ptr != NULL);
mask = (gdb_notifier.poll_fds + i)->revents;
@@ -701,16 +691,16 @@ gdb_wait_for_event (int block)
int mask = 0;
do
- {
- file_ptr = get_next_file_handler_to_handle_and_advance ();
-
- if (FD_ISSET (file_ptr->fd, &gdb_notifier.ready_masks[0]))
- mask |= GDB_READABLE;
- if (FD_ISSET (file_ptr->fd, &gdb_notifier.ready_masks[1]))
- mask |= GDB_WRITABLE;
- if (FD_ISSET (file_ptr->fd, &gdb_notifier.ready_masks[2]))
- mask |= GDB_EXCEPTION;
- }
+ {
+ file_ptr = get_next_file_handler_to_handle_and_advance ();
+
+ if (FD_ISSET (file_ptr->fd, &gdb_notifier.ready_masks[0]))
+ mask |= GDB_READABLE;
+ if (FD_ISSET (file_ptr->fd, &gdb_notifier.ready_masks[1]))
+ mask |= GDB_WRITABLE;
+ if (FD_ISSET (file_ptr->fd, &gdb_notifier.ready_masks[2]))
+ mask |= GDB_EXCEPTION;
+ }
while (mask == 0);
handle_file_event (file_ptr, mask);
@@ -718,15 +708,14 @@ gdb_wait_for_event (int block)
}
return 0;
}
-
+
/* Create a timer that will expire in MS milliseconds from now. When
the timer is ready, PROC will be executed. At creation, the timer
is added to the timers queue. This queue is kept sorted in order
of increasing timers. Return a handle to the timer struct. */
int
-create_timer (int ms, timer_handler_func *proc,
- gdb_client_data client_data)
+create_timer (int ms, timer_handler_func *proc, gdb_client_data client_data)
{
using namespace std::chrono;
struct gdb_timer *timer_ptr, *timer_index, *prev_timer;
@@ -743,26 +732,23 @@ create_timer (int ms, timer_handler_func *proc,
/* Now add the timer to the timer queue, making sure it is sorted in
increasing order of expiration. */
- for (timer_index = timer_list.first_timer;
- timer_index != NULL;
+ for (timer_index = timer_list.first_timer; timer_index != NULL;
timer_index = timer_index->next)
{
if (timer_index->when > timer_ptr->when)
- break;
+ break;
}
if (timer_index == timer_list.first_timer)
{
timer_ptr->next = timer_list.first_timer;
timer_list.first_timer = timer_ptr;
-
}
else
{
for (prev_timer = timer_list.first_timer;
- prev_timer->next != timer_index;
- prev_timer = prev_timer->next)
- ;
+ prev_timer->next != timer_index; prev_timer = prev_timer->next)
+ ;
prev_timer->next = timer_ptr;
timer_ptr->next = timer_index;
@@ -785,7 +771,7 @@ delete_timer (int id)
timer_ptr = timer_ptr->next)
{
if (timer_ptr->timer_id == id)
- break;
+ break;
}
if (timer_ptr == NULL)
@@ -795,10 +781,9 @@ delete_timer (int id)
timer_list.first_timer = timer_ptr->next;
else
{
- for (prev_timer = timer_list.first_timer;
- prev_timer->next != timer_ptr;
- prev_timer = prev_timer->next)
- ;
+ for (prev_timer = timer_list.first_timer; prev_timer->next != timer_ptr;
+ prev_timer = prev_timer->next)
+ ;
prev_timer->next = timer_ptr->next;
}
delete timer_ptr;
@@ -835,31 +820,31 @@ update_wait_timeout (void)
struct timeval timeout;
if (timer_list.first_timer->when < time_now)
- {
- /* It expired already. */
- timeout.tv_sec = 0;
- timeout.tv_usec = 0;
- }
+ {
+ /* It expired already. */
+ timeout.tv_sec = 0;
+ timeout.tv_usec = 0;
+ }
else
- {
- steady_clock::duration d = timer_list.first_timer->when - time_now;
- timeout = duration_cast_timeval (d);
- }
+ {
+ steady_clock::duration d = timer_list.first_timer->when - time_now;
+ timeout = duration_cast_timeval (d);
+ }
- /* Update the timeout for select/ poll. */
+ /* Update the timeout for select/ poll. */
#ifdef HAVE_POLL
if (use_poll)
- gdb_notifier.poll_timeout = timeout.tv_sec * 1000;
+ gdb_notifier.poll_timeout = timeout.tv_sec * 1000;
else
#endif /* HAVE_POLL */
- {
- gdb_notifier.select_timeout.tv_sec = timeout.tv_sec;
- gdb_notifier.select_timeout.tv_usec = timeout.tv_usec;
- }
+ {
+ gdb_notifier.select_timeout.tv_sec = timeout.tv_sec;
+ gdb_notifier.select_timeout.tv_usec = timeout.tv_usec;
+ }
gdb_notifier.timeout_valid = 1;
if (timer_list.first_timer->when < time_now)
- return 1;
+ return 1;
}
else
gdb_notifier.timeout_valid = 0;
diff --git a/gdbsupport/event-loop.h b/gdbsupport/event-loop.h
index c9313745b5b..a53bdf7a8d0 100644
--- a/gdbsupport/event-loop.h
+++ b/gdbsupport/event-loop.h
@@ -89,12 +89,11 @@ extern void delete_file_handler (int fd);
If IS_UI is set, this file descriptor is used for a user interface. */
extern void add_file_handler (int fd, handler_func *proc,
- gdb_client_data client_data,
- std::string &&name, bool is_ui = false);
+ gdb_client_data client_data, std::string &&name,
+ bool is_ui = false);
-extern int create_timer (int milliseconds,
- timer_handler_func *proc,
- gdb_client_data client_data);
+extern int create_timer (int milliseconds, timer_handler_func *proc,
+ gdb_client_data client_data);
extern void delete_timer (int id);
/* Must be defined by client. */
@@ -128,21 +127,21 @@ extern debug_event_loop_kind debug_event_loop;
/* Print an "event loop" debug statement. */
-#define event_loop_debug_printf(fmt, ...) \
+#define event_loop_debug_printf(fmt, ...) \
debug_prefixed_printf_cond (debug_event_loop != debug_event_loop_kind::OFF, \
- "event-loop", fmt, ##__VA_ARGS__)
+ "event-loop", fmt, ##__VA_ARGS__)
/* Print an "event loop" debug statement that is know to come from a UI-related
event (e.g. calling the event handler for the fd of the CLI). */
-#define event_loop_ui_debug_printf(is_ui, fmt, ...) \
- do \
- { \
- if (debug_event_loop == debug_event_loop_kind::ALL \
- || (debug_event_loop == debug_event_loop_kind::ALL_EXCEPT_UI \
- && !is_ui)) \
- debug_prefixed_printf ("event-loop", __func__, fmt, ##__VA_ARGS__); \
- } \
+#define event_loop_ui_debug_printf(is_ui, fmt, ...) \
+ do \
+ { \
+ if (debug_event_loop == debug_event_loop_kind::ALL \
+ || (debug_event_loop == debug_event_loop_kind::ALL_EXCEPT_UI \
+ && !is_ui)) \
+ debug_prefixed_printf ("event-loop", __func__, fmt, ##__VA_ARGS__); \
+ } \
while (0)
#endif /* EVENT_LOOP_H */
diff --git a/gdbsupport/event-pipe.h b/gdbsupport/event-pipe.h
index 999dd4b9151..a6e2a6af9be 100644
--- a/gdbsupport/event-pipe.h
+++ b/gdbsupport/event-pipe.h
@@ -28,8 +28,8 @@
class event_pipe
{
public:
- event_pipe() = default;
- ~event_pipe();
+ event_pipe () = default;
+ ~event_pipe ();
DISABLE_COPY_AND_ASSIGN (event_pipe);
@@ -40,19 +40,18 @@ public:
void close_pipe ();
/* True if the event pipe has been opened. */
- bool is_open () const
- { return m_fds[0] != -1; }
+ bool is_open () const { return m_fds[0] != -1; }
/* The file descriptor of the waitable file to use in the event
loop. */
- int event_fd () const
- { return m_fds[0]; }
+ int event_fd () const { return m_fds[0]; }
/* Flush the event pipe. */
void flush ();
/* Put something in the pipe, so the event loop wakes up. */
void mark ();
+
private:
int m_fds[2] = { -1, -1 };
};
diff --git a/gdbsupport/fileio.cc b/gdbsupport/fileio.cc
index 5f4a3ee2ec3..e4302e34369 100644
--- a/gdbsupport/fileio.cc
+++ b/gdbsupport/fileio.cc
@@ -29,48 +29,48 @@ host_to_fileio_error (int error)
{
switch (error)
{
- case EPERM:
- return FILEIO_EPERM;
- case ENOENT:
- return FILEIO_ENOENT;
- case EINTR:
- return FILEIO_EINTR;
- case EIO:
- return FILEIO_EIO;
- case EBADF:
- return FILEIO_EBADF;
- case EACCES:
- return FILEIO_EACCES;
- case EFAULT:
- return FILEIO_EFAULT;
- case EBUSY:
- return FILEIO_EBUSY;
- case EEXIST:
- return FILEIO_EEXIST;
- case ENODEV:
- return FILEIO_ENODEV;
- case ENOTDIR:
- return FILEIO_ENOTDIR;
- case EISDIR:
- return FILEIO_EISDIR;
- case EINVAL:
- return FILEIO_EINVAL;
- case ENFILE:
- return FILEIO_ENFILE;
- case EMFILE:
- return FILEIO_EMFILE;
- case EFBIG:
- return FILEIO_EFBIG;
- case ENOSPC:
- return FILEIO_ENOSPC;
- case ESPIPE:
- return FILEIO_ESPIPE;
- case EROFS:
- return FILEIO_EROFS;
- case ENOSYS:
- return FILEIO_ENOSYS;
- case ENAMETOOLONG:
- return FILEIO_ENAMETOOLONG;
+ case EPERM:
+ return FILEIO_EPERM;
+ case ENOENT:
+ return FILEIO_ENOENT;
+ case EINTR:
+ return FILEIO_EINTR;
+ case EIO:
+ return FILEIO_EIO;
+ case EBADF:
+ return FILEIO_EBADF;
+ case EACCES:
+ return FILEIO_EACCES;
+ case EFAULT:
+ return FILEIO_EFAULT;
+ case EBUSY:
+ return FILEIO_EBUSY;
+ case EEXIST:
+ return FILEIO_EEXIST;
+ case ENODEV:
+ return FILEIO_ENODEV;
+ case ENOTDIR:
+ return FILEIO_ENOTDIR;
+ case EISDIR:
+ return FILEIO_EISDIR;
+ case EINVAL:
+ return FILEIO_EINVAL;
+ case ENFILE:
+ return FILEIO_ENFILE;
+ case EMFILE:
+ return FILEIO_EMFILE;
+ case EFBIG:
+ return FILEIO_EFBIG;
+ case ENOSPC:
+ return FILEIO_ENOSPC;
+ case ESPIPE:
+ return FILEIO_ESPIPE;
+ case EROFS:
+ return FILEIO_EROFS;
+ case ENOSYS:
+ return FILEIO_ENOSYS;
+ case ENAMETOOLONG:
+ return FILEIO_ENAMETOOLONG;
}
return FILEIO_EUNKNOWN;
}
@@ -82,48 +82,48 @@ fileio_error_to_host (fileio_error errnum)
{
switch (errnum)
{
- case FILEIO_EPERM:
- return EPERM;
- case FILEIO_ENOENT:
- return ENOENT;
- case FILEIO_EINTR:
- return EINTR;
- case FILEIO_EIO:
- return EIO;
- case FILEIO_EBADF:
- return EBADF;
- case FILEIO_EACCES:
- return EACCES;
- case FILEIO_EFAULT:
- return EFAULT;
- case FILEIO_EBUSY:
- return EBUSY;
- case FILEIO_EEXIST:
- return EEXIST;
- case FILEIO_ENODEV:
- return ENODEV;
- case FILEIO_ENOTDIR:
- return ENOTDIR;
- case FILEIO_EISDIR:
- return EISDIR;
- case FILEIO_EINVAL:
- return EINVAL;
- case FILEIO_ENFILE:
- return ENFILE;
- case FILEIO_EMFILE:
- return EMFILE;
- case FILEIO_EFBIG:
- return EFBIG;
- case FILEIO_ENOSPC:
- return ENOSPC;
- case FILEIO_ESPIPE:
- return ESPIPE;
- case FILEIO_EROFS:
- return EROFS;
- case FILEIO_ENOSYS:
- return ENOSYS;
- case FILEIO_ENAMETOOLONG:
- return ENAMETOOLONG;
+ case FILEIO_EPERM:
+ return EPERM;
+ case FILEIO_ENOENT:
+ return ENOENT;
+ case FILEIO_EINTR:
+ return EINTR;
+ case FILEIO_EIO:
+ return EIO;
+ case FILEIO_EBADF:
+ return EBADF;
+ case FILEIO_EACCES:
+ return EACCES;
+ case FILEIO_EFAULT:
+ return EFAULT;
+ case FILEIO_EBUSY:
+ return EBUSY;
+ case FILEIO_EEXIST:
+ return EEXIST;
+ case FILEIO_ENODEV:
+ return ENODEV;
+ case FILEIO_ENOTDIR:
+ return ENOTDIR;
+ case FILEIO_EISDIR:
+ return EISDIR;
+ case FILEIO_EINVAL:
+ return EINVAL;
+ case FILEIO_ENFILE:
+ return ENFILE;
+ case FILEIO_EMFILE:
+ return EMFILE;
+ case FILEIO_EFBIG:
+ return EFBIG;
+ case FILEIO_ENOSPC:
+ return ENOSPC;
+ case FILEIO_ESPIPE:
+ return ESPIPE;
+ case FILEIO_EROFS:
+ return EROFS;
+ case FILEIO_ENOSYS:
+ return ENOSYS;
+ case FILEIO_ENAMETOOLONG:
+ return ENAMETOOLONG;
}
return -1;
}
@@ -152,7 +152,7 @@ fileio_to_host_openflags (int fileio_open_flags, int *open_flags_p)
open_flags |= O_WRONLY;
if (fileio_open_flags & FILEIO_O_RDWR)
open_flags |= O_RDWR;
- /* On systems supporting binary and text mode, always open files
+ /* On systems supporting binary and text mode, always open files
in binary mode. */
#ifdef O_BINARY
open_flags |= O_BINARY;
@@ -298,9 +298,8 @@ host_to_fileio_stat (struct stat *st, struct fio_stat *fst)
/* FIXME: This is correct for DJGPP, but other systems that don't
have st_blocks, if any, might prefer 512 instead of st_blksize.
(eliz, 30-12-2003) */
- host_to_fileio_ulong (((LONGEST) st->st_size + blksize - 1)
- / blksize,
- fst->fst_blocks);
+ host_to_fileio_ulong (((LONGEST) st->st_size + blksize - 1) / blksize,
+ fst->fst_blocks);
#endif
host_to_fileio_time (st->st_atime, fst->fst_atime);
host_to_fileio_time (st->st_mtime, fst->fst_mtime);
diff --git a/gdbsupport/fileio.h b/gdbsupport/fileio.h
index 690ee215ec7..4a62d9a326a 100644
--- a/gdbsupport/fileio.h
+++ b/gdbsupport/fileio.h
@@ -29,76 +29,75 @@
corresponding implementation dependent constants in one module. */
/* open(2) flags */
-#define FILEIO_O_RDONLY 0x0
-#define FILEIO_O_WRONLY 0x1
-#define FILEIO_O_RDWR 0x2
-#define FILEIO_O_APPEND 0x8
-#define FILEIO_O_CREAT 0x200
-#define FILEIO_O_TRUNC 0x400
-#define FILEIO_O_EXCL 0x800
-#define FILEIO_O_SUPPORTED (FILEIO_O_RDONLY | FILEIO_O_WRONLY| \
- FILEIO_O_RDWR | FILEIO_O_APPEND| \
- FILEIO_O_CREAT | FILEIO_O_TRUNC| \
- FILEIO_O_EXCL)
+#define FILEIO_O_RDONLY 0x0
+#define FILEIO_O_WRONLY 0x1
+#define FILEIO_O_RDWR 0x2
+#define FILEIO_O_APPEND 0x8
+#define FILEIO_O_CREAT 0x200
+#define FILEIO_O_TRUNC 0x400
+#define FILEIO_O_EXCL 0x800
+#define FILEIO_O_SUPPORTED \
+ (FILEIO_O_RDONLY | FILEIO_O_WRONLY | FILEIO_O_RDWR | FILEIO_O_APPEND \
+ | FILEIO_O_CREAT | FILEIO_O_TRUNC | FILEIO_O_EXCL)
/* mode_t bits */
-#define FILEIO_S_IFREG 0100000
-#define FILEIO_S_IFDIR 040000
-#define FILEIO_S_IFCHR 020000
-#define FILEIO_S_IRUSR 0400
-#define FILEIO_S_IWUSR 0200
-#define FILEIO_S_IXUSR 0100
-#define FILEIO_S_IRWXU 0700
-#define FILEIO_S_IRGRP 040
-#define FILEIO_S_IWGRP 020
-#define FILEIO_S_IXGRP 010
-#define FILEIO_S_IRWXG 070
-#define FILEIO_S_IROTH 04
-#define FILEIO_S_IWOTH 02
-#define FILEIO_S_IXOTH 01
-#define FILEIO_S_IRWXO 07
-#define FILEIO_S_SUPPORTED (FILEIO_S_IFREG|FILEIO_S_IFDIR| \
- FILEIO_S_IRWXU|FILEIO_S_IRWXG| \
- FILEIO_S_IRWXO)
+#define FILEIO_S_IFREG 0100000
+#define FILEIO_S_IFDIR 040000
+#define FILEIO_S_IFCHR 020000
+#define FILEIO_S_IRUSR 0400
+#define FILEIO_S_IWUSR 0200
+#define FILEIO_S_IXUSR 0100
+#define FILEIO_S_IRWXU 0700
+#define FILEIO_S_IRGRP 040
+#define FILEIO_S_IWGRP 020
+#define FILEIO_S_IXGRP 010
+#define FILEIO_S_IRWXG 070
+#define FILEIO_S_IROTH 04
+#define FILEIO_S_IWOTH 02
+#define FILEIO_S_IXOTH 01
+#define FILEIO_S_IRWXO 07
+#define FILEIO_S_SUPPORTED \
+ (FILEIO_S_IFREG | FILEIO_S_IFDIR | FILEIO_S_IRWXU | FILEIO_S_IRWXG \
+ | FILEIO_S_IRWXO)
/* lseek(2) flags */
-#define FILEIO_SEEK_SET 0
-#define FILEIO_SEEK_CUR 1
-#define FILEIO_SEEK_END 2
+#define FILEIO_SEEK_SET 0
+#define FILEIO_SEEK_CUR 1
+#define FILEIO_SEEK_END 2
/* errno values */
enum fileio_error
{
- FILEIO_SUCCESS = 0,
- FILEIO_EPERM = 1,
- FILEIO_ENOENT = 2,
- FILEIO_EINTR = 4,
- FILEIO_EIO = 5,
- FILEIO_EBADF = 9,
- FILEIO_EACCES = 13,
- FILEIO_EFAULT = 14,
- FILEIO_EBUSY = 16,
- FILEIO_EEXIST = 17,
- FILEIO_ENODEV = 19,
- FILEIO_ENOTDIR = 20,
- FILEIO_EISDIR = 21,
- FILEIO_EINVAL = 22,
- FILEIO_ENFILE = 23,
- FILEIO_EMFILE = 24,
- FILEIO_EFBIG = 27,
- FILEIO_ENOSPC = 28,
- FILEIO_ESPIPE = 29,
- FILEIO_EROFS = 30,
- FILEIO_ENOSYS = 88,
- FILEIO_ENAMETOOLONG = 91,
- FILEIO_EUNKNOWN = 9999,
+ FILEIO_SUCCESS = 0,
+ FILEIO_EPERM = 1,
+ FILEIO_ENOENT = 2,
+ FILEIO_EINTR = 4,
+ FILEIO_EIO = 5,
+ FILEIO_EBADF = 9,
+ FILEIO_EACCES = 13,
+ FILEIO_EFAULT = 14,
+ FILEIO_EBUSY = 16,
+ FILEIO_EEXIST = 17,
+ FILEIO_ENODEV = 19,
+ FILEIO_ENOTDIR = 20,
+ FILEIO_EISDIR = 21,
+ FILEIO_EINVAL = 22,
+ FILEIO_ENFILE = 23,
+ FILEIO_EMFILE = 24,
+ FILEIO_EFBIG = 27,
+ FILEIO_ENOSPC = 28,
+ FILEIO_ESPIPE = 29,
+ FILEIO_EROFS = 30,
+ FILEIO_ENOSYS = 88,
+ FILEIO_ENAMETOOLONG = 91,
+ FILEIO_EUNKNOWN = 9999,
};
-#define FIO_INT_LEN 4
-#define FIO_UINT_LEN 4
-#define FIO_MODE_LEN 4
-#define FIO_TIME_LEN 4
-#define FIO_LONG_LEN 8
+#define FIO_INT_LEN 4
+#define FIO_UINT_LEN 4
+#define FIO_MODE_LEN 4
+#define FIO_TIME_LEN 4
+#define FIO_LONG_LEN 8
#define FIO_ULONG_LEN 8
typedef char fio_int_t[FIO_INT_LEN];
@@ -114,25 +113,25 @@ typedef char fio_ulong_t[FIO_ULONG_LEN];
struct fio_stat
{
- fio_uint_t fst_dev;
- fio_uint_t fst_ino;
- fio_mode_t fst_mode;
- fio_uint_t fst_nlink;
- fio_uint_t fst_uid;
- fio_uint_t fst_gid;
- fio_uint_t fst_rdev;
+ fio_uint_t fst_dev;
+ fio_uint_t fst_ino;
+ fio_mode_t fst_mode;
+ fio_uint_t fst_nlink;
+ fio_uint_t fst_uid;
+ fio_uint_t fst_gid;
+ fio_uint_t fst_rdev;
fio_ulong_t fst_size;
fio_ulong_t fst_blksize;
fio_ulong_t fst_blocks;
- fio_time_t fst_atime;
- fio_time_t fst_mtime;
- fio_time_t fst_ctime;
+ fio_time_t fst_atime;
+ fio_time_t fst_mtime;
+ fio_time_t fst_ctime;
};
struct fio_timeval
{
- fio_time_t ftv_sec;
- fio_long_t ftv_usec;
+ fio_time_t ftv_sec;
+ fio_long_t ftv_usec;
};
/* Convert a host-format errno value to a File-I/O error number. */
diff --git a/gdbsupport/filestuff.cc b/gdbsupport/filestuff.cc
index d73321026f1..535a064bf88 100644
--- a/gdbsupport/filestuff.cc
+++ b/gdbsupport/filestuff.cc
@@ -57,8 +57,6 @@
#define SOCK_CLOEXEC 0
#endif
-
-
#ifndef HAVE_FDWALK
#include <dirent.h>
@@ -86,51 +84,51 @@ fdwalk (int (*func) (void *, int), void *arg)
int result = 0;
for (entry = readdir (dir); entry != NULL; entry = readdir (dir))
- {
- long fd;
- char *tail;
-
- errno = 0;
- fd = strtol (entry->d_name, &tail, 10);
- if (*tail != '\0' || errno != 0)
- continue;
- if ((int) fd != fd)
- {
- /* What can we do here really? */
- continue;
- }
-
- if (fd == dirfd (dir))
- continue;
-
- result = func (arg, fd);
- if (result != 0)
- break;
- }
+ {
+ long fd;
+ char *tail;
+
+ errno = 0;
+ fd = strtol (entry->d_name, &tail, 10);
+ if (*tail != '\0' || errno != 0)
+ continue;
+ if ((int) fd != fd)
+ {
+ /* What can we do here really? */
+ continue;
+ }
+
+ if (fd == dirfd (dir))
+ continue;
+
+ result = func (arg, fd);
+ if (result != 0)
+ break;
+ }
closedir (dir);
return result;
}
- /* We may fall through to the next case. */
+ /* We may fall through to the next case. */
#endif
#ifdef HAVE_KINFO_GETFILE
int nfd;
- gdb::unique_xmalloc_ptr<struct kinfo_file[]> fdtbl
- (kinfo_getfile (getpid (), &nfd));
+ gdb::unique_xmalloc_ptr<struct kinfo_file[]> fdtbl (
+ kinfo_getfile (getpid (), &nfd));
if (fdtbl != NULL)
{
for (int i = 0; i < nfd; i++)
- {
- if (fdtbl[i].kf_fd >= 0)
- {
- int result = func (arg, fdtbl[i].kf_fd);
- if (result != 0)
- return result;
- }
- }
+ {
+ if (fdtbl[i].kf_fd >= 0)
+ {
+ int result = func (arg, fdtbl[i].kf_fd);
+ if (result != 0)
+ return result;
+ }
+ }
return 0;
}
- /* We may fall through to the next case. */
+ /* We may fall through to the next case. */
#endif
{
@@ -139,31 +137,32 @@ fdwalk (int (*func) (void *, int), void *arg)
#if defined(HAVE_GETRLIMIT) && defined(RLIMIT_NOFILE)
struct rlimit rlim;
- if (getrlimit (RLIMIT_NOFILE, &rlim) == 0 && rlim.rlim_max != RLIM_INFINITY)
+ if (getrlimit (RLIMIT_NOFILE, &rlim) == 0
+ && rlim.rlim_max != RLIM_INFINITY)
max = rlim.rlim_max;
else
#endif
{
#ifdef _SC_OPEN_MAX
- max = sysconf (_SC_OPEN_MAX);
+ max = sysconf (_SC_OPEN_MAX);
#else
- /* Whoops. */
- return 0;
+ /* Whoops. */
+ return 0;
#endif /* _SC_OPEN_MAX */
}
for (fd = 0; fd < max; ++fd)
{
- struct stat sb;
- int result;
+ struct stat sb;
+ int result;
- /* Only call FUNC for open fds. */
- if (fstat (fd, &sb) == -1)
- continue;
+ /* Only call FUNC for open fds. */
+ if (fstat (fd, &sb) == -1)
+ continue;
- result = func (arg, fd);
- if (result != 0)
- return result;
+ result = func (arg, fd);
+ if (result != 0)
+ return result;
}
return 0;
@@ -172,8 +171,6 @@ fdwalk (int (*func) (void *, int), void *arg)
#endif /* HAVE_FDWALK */
-
-
/* A vector holding all the fds open when notice_open_fds was called. We
don't use a hashtab because we don't expect there to be many open fds. */
@@ -227,10 +224,10 @@ do_close (void *ignore, int fd)
for (int val : open_fds)
{
if (fd == val)
- {
- /* Keep this one open. */
- return 0;
- }
+ {
+ /* Keep this one open. */
+ return 0;
+ }
}
close (fd);
@@ -245,8 +242,6 @@ close_most_fds (void)
fdwalk (do_close, NULL);
}
-
-
/* This is a tri-state flag. When zero it means we haven't yet tried
O_CLOEXEC. When positive it means that O_CLOEXEC works on this
host. When negative, it means that O_CLOEXEC doesn't work. We
@@ -270,12 +265,12 @@ mark_cloexec (int fd)
fcntl (fd, F_SETFD, old | FD_CLOEXEC);
if (trust_o_cloexec == 0)
- {
- if ((old & FD_CLOEXEC) != 0)
- trust_o_cloexec = 1;
- else
- trust_o_cloexec = -1;
- }
+ {
+ if ((old & FD_CLOEXEC) != 0)
+ trust_o_cloexec = 1;
+ else
+ trust_o_cloexec = -1;
+ }
}
#endif /* HAVE_F_GETFD */
}
@@ -302,8 +297,6 @@ socket_mark_cloexec (int fd)
#endif
-
-
/* See filestuff.h. */
scoped_fd
@@ -330,8 +323,8 @@ gdb_fopen_cloexec (const char *filename, const char *opentype)
unknown modes. Assume that if O_CLOEXEC is zero, then "e" isn't
supported. On MinGW, O_CLOEXEC is an alias of O_NOINHERIT, and
"e" isn't supported. */
- static int fopen_e_ever_failed_einval =
- O_CLOEXEC == 0 || O_CLOEXEC == O_NOINHERIT;
+ static int fopen_e_ever_failed_einval
+ = O_CLOEXEC == 0 || O_CLOEXEC == O_NOINHERIT;
if (!fopen_e_ever_failed_einval)
{
@@ -345,11 +338,11 @@ gdb_fopen_cloexec (const char *filename, const char *opentype)
result = fopen (filename, copy);
if (result == NULL && errno == EINVAL)
- {
- result = fopen (filename, opentype);
- if (result != NULL)
- fopen_e_ever_failed_einval = 1;
- }
+ {
+ result = fopen (filename, opentype);
+ if (result != NULL)
+ fopen_e_ever_failed_einval = 1;
+ }
}
else
result = fopen (filename, opentype);
@@ -364,8 +357,7 @@ gdb_fopen_cloexec (const char *filename, const char *opentype)
/* See filestuff.h. */
int
-gdb_socketpair_cloexec (int domain, int style, int protocol,
- int filedes[2])
+gdb_socketpair_cloexec (int domain, int style, int protocol, int filedes[2])
{
#ifdef HAVE_SOCKETPAIR
int result = socketpair (domain, style | SOCK_CLOEXEC, protocol, filedes);
@@ -418,7 +410,7 @@ gdb_pipe_cloexec (int filedes[2])
mark_cloexec (filedes[0]);
mark_cloexec (filedes[1]);
}
-#else /* HAVE_PIPE */
+#else /* HAVE_PIPE */
gdb_assert_not_reached ("pipe not available on this host");
#endif /* HAVE_PIPE */
#endif /* HAVE_PIPE2 */
@@ -442,7 +434,7 @@ is_regular_file (const char *name, int *errno_ptr)
if (status != 0)
{
if (errno != ENOENT)
- return true;
+ return true;
*errno_ptr = ENOENT;
return false;
}
@@ -463,7 +455,7 @@ bool
mkdir_recursive (const char *dir)
{
auto holder = make_unique_xstrdup (dir);
- char * const start = holder.get ();
+ char *const start = holder.get ();
char *component_start = start;
char *component_end = start;
@@ -471,16 +463,16 @@ mkdir_recursive (const char *dir)
{
/* Find the beginning of the next component. */
while (*component_start == '/')
- component_start++;
+ component_start++;
/* Are we done? */
if (*component_start == '\0')
- return true;
+ return true;
/* Find the slash or null-terminator after this component. */
component_end = component_start;
while (*component_end != '/' && *component_end != '\0')
- component_end++;
+ component_end++;
/* Temporarily replace the slash with a null terminator, so we can create
the directory up to this component. */
@@ -493,8 +485,8 @@ mkdir_recursive (const char *dir)
component, the caller will fail with ENOTDIR when trying to
open/create a file under that path. */
if (mkdir (start, 0700) != 0)
- if (errno != EEXIST)
- return false;
+ if (errno != EEXIST)
+ return false;
/* Restore the overwritten char. */
*component_end = saved_char;
@@ -522,14 +514,14 @@ read_text_file_to_string (const char *path)
int n = fread (&res[start_size], 1, chunk_size, file.get ());
if (n == chunk_size)
- continue;
+ continue;
gdb_assert (n < chunk_size);
/* Less than CHUNK means EOF or error. If it's an error, return
no value. */
if (ferror (file.get ()))
- return {};
+ return {};
/* Resize the string according to the data we read. */
res.resize (start_size + n);
diff --git a/gdbsupport/filestuff.h b/gdbsupport/filestuff.h
index 48bef51f259..c2f6de4f7f1 100644
--- a/gdbsupport/filestuff.h
+++ b/gdbsupport/filestuff.h
@@ -49,7 +49,7 @@ extern void close_most_fds (void);
close-on-exec flag set. */
extern scoped_fd gdb_open_cloexec (const char *filename, int flags,
- /* mode_t */ unsigned long mode);
+ /* mode_t */ unsigned long mode);
/* Like mkstemp, but ensures that the file descriptor is
close-on-exec. */
@@ -66,7 +66,7 @@ gdb_mkostemp_cloexec (char *name_template, int flags = 0)
static inline scoped_fd
gdb_open_cloexec (const std::string &filename, int flags,
- /* mode_t */ unsigned long mode)
+ /* mode_t */ unsigned long mode)
{
return gdb_open_cloexec (filename.c_str (), flags, mode);
}
@@ -75,7 +75,7 @@ gdb_open_cloexec (const std::string &filename, int flags,
close-on-exec flag set. */
extern gdb_file_up gdb_fopen_cloexec (const char *filename,
- const char *opentype);
+ const char *opentype);
/* Convenience wrapper for the above, which takes the filename as an
std::string. */
@@ -90,7 +90,7 @@ gdb_fopen_cloexec (const std::string &filename, const char *opentype)
have the close-on-exec flag set. */
extern int gdb_socketpair_cloexec (int domain, int style, int protocol,
- int filedes[2]);
+ int filedes[2]);
/* Like 'socket', but ensures that the returned file descriptor has
the close-on-exec flag set. */
@@ -104,10 +104,7 @@ extern int gdb_pipe_cloexec (int filedes[2]);
struct gdb_dir_deleter
{
- void operator() (DIR *dir) const
- {
- closedir (dir);
- }
+ void operator() (DIR *dir) const { closedir (dir); }
};
/* A unique pointer to a DIR. */
@@ -119,7 +116,6 @@ typedef std::unique_ptr<DIR, gdb_dir_deleter> gdb_dir_up;
we're expecting a regular file. */
extern bool is_regular_file (const char *name, int *errno_ptr);
-
/* A cheap (as in low-quality) recursive mkdir. Try to create all the
parents directories up to DIR and DIR itself. Stop if we hit an
error along the way. There is no attempt to remove created
diff --git a/gdbsupport/filtered-iterator.h b/gdbsupport/filtered-iterator.h
index d87484cadca..7336db273f4 100644
--- a/gdbsupport/filtered-iterator.h
+++ b/gdbsupport/filtered-iterator.h
@@ -40,7 +40,9 @@ public:
template<typename... Args>
explicit filtered_iterator (Args &&...args)
: m_it (std::forward<Args> (args)...)
- { skip_filtered (); }
+ {
+ skip_filtered ();
+ }
/* Create a one-past-end iterator. */
filtered_iterator () = default;
@@ -52,7 +54,8 @@ public:
filtered_iterator (filtered_iterator &&) = default;
filtered_iterator (const filtered_iterator &&other)
: filtered_iterator (static_cast<const filtered_iterator &> (other))
- {}
+ {
+ }
value_type operator* () const { return *m_it; }
@@ -63,19 +66,16 @@ public:
return *this;
}
- bool operator== (const self_type &other) const
- { return m_it == other.m_it; }
+ bool operator== (const self_type &other) const { return m_it == other.m_it; }
- bool operator!= (const self_type &other) const
- { return m_it != other.m_it; }
+ bool operator!= (const self_type &other) const { return m_it != other.m_it; }
private:
-
void skip_filtered ()
{
for (; m_it != m_end; ++m_it)
if (m_filter (*m_it))
- break;
+ break;
}
private:
diff --git a/gdbsupport/format.cc b/gdbsupport/format.cc
index 19f37ec8e0c..6c888a54ea3 100644
--- a/gdbsupport/format.cc
+++ b/gdbsupport/format.cc
@@ -45,57 +45,58 @@ format_pieces::format_pieces (const char **arg, bool gdb_extensions)
string = f;
while ((gdb_extensions || *s != '"') && *s != '\0')
- {
- int c = *s++;
- switch (c)
- {
- case '\0':
- continue;
-
- case '\\':
- switch (c = *s++)
- {
- case '\\':
- *f++ = '\\';
- break;
- case 'a':
- *f++ = '\a';
- break;
- case 'b':
- *f++ = '\b';
- break;
- case 'e':
- *f++ = '\e';
- break;
- case 'f':
- *f++ = '\f';
- break;
- case 'n':
- *f++ = '\n';
- break;
- case 'r':
- *f++ = '\r';
- break;
- case 't':
- *f++ = '\t';
- break;
- case 'v':
- *f++ = '\v';
- break;
- case '"':
- *f++ = '"';
- break;
- default:
- /* ??? TODO: handle other escape sequences. */
- error (_("Unrecognized escape character \\%c in format string."),
- c);
- }
- break;
-
- default:
- *f++ = c;
- }
- }
+ {
+ int c = *s++;
+ switch (c)
+ {
+ case '\0':
+ continue;
+
+ case '\\':
+ switch (c = *s++)
+ {
+ case '\\':
+ *f++ = '\\';
+ break;
+ case 'a':
+ *f++ = '\a';
+ break;
+ case 'b':
+ *f++ = '\b';
+ break;
+ case 'e':
+ *f++ = '\e';
+ break;
+ case 'f':
+ *f++ = '\f';
+ break;
+ case 'n':
+ *f++ = '\n';
+ break;
+ case 'r':
+ *f++ = '\r';
+ break;
+ case 't':
+ *f++ = '\t';
+ break;
+ case 'v':
+ *f++ = '\v';
+ break;
+ case '"':
+ *f++ = '"';
+ break;
+ default:
+ /* ??? TODO: handle other escape sequences. */
+ error (
+ _ ("Unrecognized escape character \\%c in format string."),
+ c);
+ }
+ break;
+
+ default:
+ *f++ = c;
+ }
+ }
/* Terminate our escape-processed copy. */
*f++ = '\0';
@@ -119,282 +120,282 @@ format_pieces::format_pieces (const char **arg, bool gdb_extensions)
while (*f)
if (*f++ == '%')
{
- int seen_hash = 0, seen_zero = 0, lcount = 0, seen_prec = 0;
- int seen_space = 0, seen_plus = 0;
- int seen_big_l = 0, seen_h = 0, seen_big_h = 0;
- int seen_big_d = 0, seen_double_big_d = 0;
- int seen_size_t = 0;
- int bad = 0;
- int n_int_args = 0;
- bool seen_i64 = false;
-
- /* Skip over "%%", it will become part of a literal piece. */
- if (*f == '%')
- {
- f++;
- continue;
- }
-
- sub_start = current_substring;
-
- strncpy (current_substring, prev_start, f - 1 - prev_start);
- current_substring += f - 1 - prev_start;
- *current_substring++ = '\0';
-
- if (*sub_start != '\0')
- m_pieces.emplace_back (sub_start, literal_piece, 0);
-
- percent_loc = f - 1;
-
- /* Check the validity of the format specifier, and work
+ int seen_hash = 0, seen_zero = 0, lcount = 0, seen_prec = 0;
+ int seen_space = 0, seen_plus = 0;
+ int seen_big_l = 0, seen_h = 0, seen_big_h = 0;
+ int seen_big_d = 0, seen_double_big_d = 0;
+ int seen_size_t = 0;
+ int bad = 0;
+ int n_int_args = 0;
+ bool seen_i64 = false;
+
+ /* Skip over "%%", it will become part of a literal piece. */
+ if (*f == '%')
+ {
+ f++;
+ continue;
+ }
+
+ sub_start = current_substring;
+
+ strncpy (current_substring, prev_start, f - 1 - prev_start);
+ current_substring += f - 1 - prev_start;
+ *current_substring++ = '\0';
+
+ if (*sub_start != '\0')
+ m_pieces.emplace_back (sub_start, literal_piece, 0);
+
+ percent_loc = f - 1;
+
+ /* Check the validity of the format specifier, and work
out what argument it expects. We only accept C89
format strings, with the exception of long long (which
we autoconf for). */
- /* The first part of a format specifier is a set of flag
+ /* The first part of a format specifier is a set of flag
characters. */
- while (*f != '\0' && strchr ("0-+ #", *f))
- {
- if (*f == '#')
- seen_hash = 1;
- else if (*f == '0')
- seen_zero = 1;
- else if (*f == ' ')
- seen_space = 1;
- else if (*f == '+')
- seen_plus = 1;
- f++;
- }
-
- /* The next part of a format specifier is a width. */
- if (gdb_extensions && *f == '*')
- {
- ++f;
- ++n_int_args;
- }
- else
- {
- while (*f != '\0' && strchr ("0123456789", *f))
- f++;
- }
-
- /* The next part of a format specifier is a precision. */
- if (*f == '.')
- {
- seen_prec = 1;
- f++;
- if (gdb_extensions && *f == '*')
- {
- ++f;
- ++n_int_args;
- }
- else
- {
- while (*f != '\0' && strchr ("0123456789", *f))
- f++;
- }
- }
-
- /* The next part of a format specifier is a length modifier. */
- switch (*f)
- {
- case 'h':
- seen_h = 1;
- f++;
- break;
- case 'l':
- f++;
- lcount++;
- if (*f == 'l')
- {
- f++;
- lcount++;
- }
- break;
- case 'L':
- seen_big_l = 1;
- f++;
- break;
- case 'H':
- /* Decimal32 modifier. */
- seen_big_h = 1;
- f++;
- break;
- case 'D':
- /* Decimal64 and Decimal128 modifiers. */
- f++;
-
- /* Check for a Decimal128. */
- if (*f == 'D')
- {
- f++;
- seen_double_big_d = 1;
- }
- else
- seen_big_d = 1;
- break;
- case 'z':
- /* For size_t or ssize_t. */
- seen_size_t = 1;
- f++;
- break;
- case 'I':
- /* Support the Windows '%I64' extension, because an
+ while (*f != '\0' && strchr ("0-+ #", *f))
+ {
+ if (*f == '#')
+ seen_hash = 1;
+ else if (*f == '0')
+ seen_zero = 1;
+ else if (*f == ' ')
+ seen_space = 1;
+ else if (*f == '+')
+ seen_plus = 1;
+ f++;
+ }
+
+ /* The next part of a format specifier is a width. */
+ if (gdb_extensions && *f == '*')
+ {
+ ++f;
+ ++n_int_args;
+ }
+ else
+ {
+ while (*f != '\0' && strchr ("0123456789", *f))
+ f++;
+ }
+
+ /* The next part of a format specifier is a precision. */
+ if (*f == '.')
+ {
+ seen_prec = 1;
+ f++;
+ if (gdb_extensions && *f == '*')
+ {
+ ++f;
+ ++n_int_args;
+ }
+ else
+ {
+ while (*f != '\0' && strchr ("0123456789", *f))
+ f++;
+ }
+ }
+
+ /* The next part of a format specifier is a length modifier. */
+ switch (*f)
+ {
+ case 'h':
+ seen_h = 1;
+ f++;
+ break;
+ case 'l':
+ f++;
+ lcount++;
+ if (*f == 'l')
+ {
+ f++;
+ lcount++;
+ }
+ break;
+ case 'L':
+ seen_big_l = 1;
+ f++;
+ break;
+ case 'H':
+ /* Decimal32 modifier. */
+ seen_big_h = 1;
+ f++;
+ break;
+ case 'D':
+ /* Decimal64 and Decimal128 modifiers. */
+ f++;
+
+ /* Check for a Decimal128. */
+ if (*f == 'D')
+ {
+ f++;
+ seen_double_big_d = 1;
+ }
+ else
+ seen_big_d = 1;
+ break;
+ case 'z':
+ /* For size_t or ssize_t. */
+ seen_size_t = 1;
+ f++;
+ break;
+ case 'I':
+ /* Support the Windows '%I64' extension, because an
earlier call to format_pieces might have converted %lld
to %I64d. */
- if (f[1] == '6' && f[2] == '4')
- {
- f += 3;
- lcount = 2;
- seen_i64 = true;
- }
- break;
- }
-
- switch (*f)
- {
- case 'u':
- if (seen_hash)
- bad = 1;
- /* FALLTHROUGH */
-
- case 'o':
- case 'x':
- case 'X':
- if (seen_space || seen_plus)
- bad = 1;
- /* FALLTHROUGH */
-
- case 'd':
- case 'i':
- if (seen_size_t)
- this_argclass = size_t_arg;
- else if (lcount == 0)
- this_argclass = int_arg;
- else if (lcount == 1)
- this_argclass = long_arg;
- else
- this_argclass = long_long_arg;
-
- if (seen_big_l)
- bad = 1;
- break;
-
- case 'c':
- this_argclass = lcount == 0 ? int_arg : wide_char_arg;
- if (lcount > 1 || seen_h || seen_big_l)
- bad = 1;
- if (seen_prec || seen_zero || seen_space || seen_plus)
- bad = 1;
- break;
-
- case 'p':
- this_argclass = ptr_arg;
- if (lcount || seen_h || seen_big_l)
- bad = 1;
- if (seen_prec)
- bad = 1;
- if (seen_hash || seen_zero || seen_space || seen_plus)
- bad = 1;
-
- if (gdb_extensions)
- {
- switch (f[1])
- {
- case 's':
- case 'F':
- case '[':
- case ']':
- f++;
- break;
- }
- }
-
- break;
-
- case 's':
- this_argclass = lcount == 0 ? string_arg : wide_string_arg;
- if (lcount > 1 || seen_h || seen_big_l)
- bad = 1;
- if (seen_zero || seen_space || seen_plus)
- bad = 1;
- break;
-
- case 'e':
- case 'f':
- case 'g':
- case 'E':
- case 'G':
- if (seen_double_big_d)
- this_argclass = dec128float_arg;
- else if (seen_big_d)
- this_argclass = dec64float_arg;
- else if (seen_big_h)
- this_argclass = dec32float_arg;
- else if (seen_big_l)
- this_argclass = long_double_arg;
- else
- this_argclass = double_arg;
-
- if (lcount || seen_h)
- bad = 1;
- break;
-
- case '*':
- error (_("`*' not supported for precision or width in printf"));
-
- case 'n':
- error (_("Format specifier `n' not supported in printf"));
-
- case '\0':
- error (_("Incomplete format specifier at end of format string"));
-
- default:
- error (_("Unrecognized format specifier '%c' in printf"), *f);
- }
-
- if (bad)
- error (_("Inappropriate modifiers to "
- "format specifier '%c' in printf"),
- *f);
-
- f++;
-
- sub_start = current_substring;
-
- if (lcount > 1 && !seen_i64 && USE_PRINTF_I64)
- {
- /* Windows' printf does support long long, but not the usual way.
+ if (f[1] == '6' && f[2] == '4')
+ {
+ f += 3;
+ lcount = 2;
+ seen_i64 = true;
+ }
+ break;
+ }
+
+ switch (*f)
+ {
+ case 'u':
+ if (seen_hash)
+ bad = 1;
+ /* FALLTHROUGH */
+
+ case 'o':
+ case 'x':
+ case 'X':
+ if (seen_space || seen_plus)
+ bad = 1;
+ /* FALLTHROUGH */
+
+ case 'd':
+ case 'i':
+ if (seen_size_t)
+ this_argclass = size_t_arg;
+ else if (lcount == 0)
+ this_argclass = int_arg;
+ else if (lcount == 1)
+ this_argclass = long_arg;
+ else
+ this_argclass = long_long_arg;
+
+ if (seen_big_l)
+ bad = 1;
+ break;
+
+ case 'c':
+ this_argclass = lcount == 0 ? int_arg : wide_char_arg;
+ if (lcount > 1 || seen_h || seen_big_l)
+ bad = 1;
+ if (seen_prec || seen_zero || seen_space || seen_plus)
+ bad = 1;
+ break;
+
+ case 'p':
+ this_argclass = ptr_arg;
+ if (lcount || seen_h || seen_big_l)
+ bad = 1;
+ if (seen_prec)
+ bad = 1;
+ if (seen_hash || seen_zero || seen_space || seen_plus)
+ bad = 1;
+
+ if (gdb_extensions)
+ {
+ switch (f[1])
+ {
+ case 's':
+ case 'F':
+ case '[':
+ case ']':
+ f++;
+ break;
+ }
+ }
+
+ break;
+
+ case 's':
+ this_argclass = lcount == 0 ? string_arg : wide_string_arg;
+ if (lcount > 1 || seen_h || seen_big_l)
+ bad = 1;
+ if (seen_zero || seen_space || seen_plus)
+ bad = 1;
+ break;
+
+ case 'e':
+ case 'f':
+ case 'g':
+ case 'E':
+ case 'G':
+ if (seen_double_big_d)
+ this_argclass = dec128float_arg;
+ else if (seen_big_d)
+ this_argclass = dec64float_arg;
+ else if (seen_big_h)
+ this_argclass = dec32float_arg;
+ else if (seen_big_l)
+ this_argclass = long_double_arg;
+ else
+ this_argclass = double_arg;
+
+ if (lcount || seen_h)
+ bad = 1;
+ break;
+
+ case '*':
+ error (_ ("`*' not supported for precision or width in printf"));
+
+ case 'n':
+ error (_ ("Format specifier `n' not supported in printf"));
+
+ case '\0':
+ error (_ ("Incomplete format specifier at end of format string"));
+
+ default:
+ error (_ ("Unrecognized format specifier '%c' in printf"), *f);
+ }
+
+ if (bad)
+ error (_ ("Inappropriate modifiers to "
+ "format specifier '%c' in printf"),
+ *f);
+
+ f++;
+
+ sub_start = current_substring;
+
+ if (lcount > 1 && !seen_i64 && USE_PRINTF_I64)
+ {
+ /* Windows' printf does support long long, but not the usual way.
Convert %lld to %I64d. */
- int length_before_ll = f - percent_loc - 1 - lcount;
-
- strncpy (current_substring, percent_loc, length_before_ll);
- strcpy (current_substring + length_before_ll, "I64");
- current_substring[length_before_ll + 3] =
- percent_loc[length_before_ll + lcount];
- current_substring += length_before_ll + 4;
- }
- else if (this_argclass == wide_string_arg
- || this_argclass == wide_char_arg)
- {
- /* Convert %ls or %lc to %s. */
- int length_before_ls = f - percent_loc - 2;
-
- strncpy (current_substring, percent_loc, length_before_ls);
- strcpy (current_substring + length_before_ls, "s");
- current_substring += length_before_ls + 2;
- }
- else
- {
- strncpy (current_substring, percent_loc, f - percent_loc);
- current_substring += f - percent_loc;
- }
-
- *current_substring++ = '\0';
-
- prev_start = f;
-
- m_pieces.emplace_back (sub_start, this_argclass, n_int_args);
+ int length_before_ll = f - percent_loc - 1 - lcount;
+
+ strncpy (current_substring, percent_loc, length_before_ll);
+ strcpy (current_substring + length_before_ll, "I64");
+ current_substring[length_before_ll + 3]
+ = percent_loc[length_before_ll + lcount];
+ current_substring += length_before_ll + 4;
+ }
+ else if (this_argclass == wide_string_arg
+ || this_argclass == wide_char_arg)
+ {
+ /* Convert %ls or %lc to %s. */
+ int length_before_ls = f - percent_loc - 2;
+
+ strncpy (current_substring, percent_loc, length_before_ls);
+ strcpy (current_substring + length_before_ls, "s");
+ current_substring += length_before_ls + 2;
+ }
+ else
+ {
+ strncpy (current_substring, percent_loc, f - percent_loc);
+ current_substring += f - percent_loc;
+ }
+
+ *current_substring++ = '\0';
+
+ prev_start = f;
+
+ m_pieces.emplace_back (sub_start, this_argclass, n_int_args);
}
/* Record the remainder of the string. */
diff --git a/gdbsupport/format.h b/gdbsupport/format.h
index 342b473c3ed..e4f9091b5e3 100644
--- a/gdbsupport/format.h
+++ b/gdbsupport/format.h
@@ -23,10 +23,10 @@
#include "gdbsupport/gdb_string_view.h"
#if defined(__MINGW32__) && !defined(PRINTF_HAS_LONG_LONG)
-# define USE_PRINTF_I64 1
-# define PRINTF_HAS_LONG_LONG
+#define USE_PRINTF_I64 1
+#define PRINTF_HAS_LONG_LONG
#else
-# define USE_PRINTF_I64 0
+#define USE_PRINTF_I64 0
#endif
/* The argclass represents the general type of data that goes with a
@@ -36,13 +36,22 @@
classed as int_arg. */
enum argclass
- {
- literal_piece,
- int_arg, long_arg, long_long_arg, size_t_arg, ptr_arg,
- string_arg, wide_string_arg, wide_char_arg,
- double_arg, long_double_arg,
- dec32float_arg, dec64float_arg, dec128float_arg
- };
+{
+ literal_piece,
+ int_arg,
+ long_arg,
+ long_long_arg,
+ size_t_arg,
+ ptr_arg,
+ string_arg,
+ wide_string_arg,
+ wide_char_arg,
+ double_arg,
+ long_double_arg,
+ dec32float_arg,
+ dec64float_arg,
+ dec128float_arg
+};
/* A format piece is a section of the format string that may include a
single print directive somewhere in it, and the associated class
@@ -60,7 +69,7 @@ struct format_piece
bool operator== (const format_piece &other) const
{
return (this->argclass == other.argclass
- && gdb::string_view (this->string) == other.string);
+ && gdb::string_view (this->string) == other.string);
}
const char *string;
@@ -74,7 +83,6 @@ struct format_piece
class format_pieces
{
public:
-
format_pieces (const char **arg, bool gdb_extensions = false);
~format_pieces () = default;
@@ -82,18 +90,11 @@ public:
typedef std::vector<format_piece>::iterator iterator;
- iterator begin ()
- {
- return m_pieces.begin ();
- }
+ iterator begin () { return m_pieces.begin (); }
- iterator end ()
- {
- return m_pieces.end ();
- }
+ iterator end () { return m_pieces.end (); }
private:
-
std::vector<format_piece> m_pieces;
gdb::unique_xmalloc_ptr<char> m_storage;
};
diff --git a/gdbsupport/forward-scope-exit.h b/gdbsupport/forward-scope-exit.h
index bf591ddf170..0972b324849 100644
--- a/gdbsupport/forward-scope-exit.h
+++ b/gdbsupport/forward-scope-exit.h
@@ -81,35 +81,28 @@ namespace detail
template<typename Function, Function *function, typename Signature>
struct forward_scope_exit;
-template<typename Function, Function *function,
- typename Res, typename... Args>
+template<typename Function, Function *function, typename Res, typename... Args>
class forward_scope_exit<Function, function, Res (Args...)>
- : public scope_exit_base<forward_scope_exit<Function,
- function,
- Res (Args...)>>
+ : public scope_exit_base<
+ forward_scope_exit<Function, function, Res (Args...)>>
{
/* For access to on_exit(). */
- friend scope_exit_base<forward_scope_exit<Function,
- function,
- Res (Args...)>>;
+ friend scope_exit_base<
+ forward_scope_exit<Function, function, Res (Args...)>>;
public:
- explicit forward_scope_exit (Args ...args)
+ explicit forward_scope_exit (Args... args)
: m_bind_function (function, args...)
{
/* Nothing. */
}
private:
- void on_exit ()
- {
- m_bind_function ();
- }
+ void on_exit () { m_bind_function (); }
/* The function and the arguments passed to the ctor, all packed in
a std::bind. */
- decltype (std::bind (function, std::declval<Args> ()...))
- m_bind_function;
+ decltype (std::bind (function, std::declval<Args> ()...)) m_bind_function;
};
} /* namespace detail */
diff --git a/gdbsupport/function-view.h b/gdbsupport/function-view.h
index cd62d40fd5e..09e5beffa82 100644
--- a/gdbsupport/function-view.h
+++ b/gdbsupport/function-view.h
@@ -193,9 +193,11 @@
unittests/function-view-selftests.c. */
#include "invoke-result.h"
-namespace gdb {
+namespace gdb
+{
-namespace fv_detail {
+namespace fv_detail
+{
/* Bits shared by all function_view instantiations that do not depend
on the template parameters. */
@@ -207,7 +209,7 @@ union erased_callable
/* For function objects. */
void *data;
- /* For function pointers. */
+ /* For function pointers. */
void (*fn) ();
};
@@ -222,32 +224,29 @@ template<typename Res, typename... Args>
class function_view<Res (Args...)>
{
template<typename From, typename To>
- using CompatibleReturnType
- = Or<std::is_void<To>,
- std::is_same<From, To>,
- std::is_convertible<From, To>>;
+ using CompatibleReturnType = Or<std::is_void<To>, std::is_same<From, To>,
+ std::is_convertible<From, To>>;
/* True if Func can be called with Args, and either the result is
Res, convertible to Res or Res is void. */
template<typename Callable,
- typename Res2 = typename gdb::invoke_result<Callable &, Args...>::type>
+ typename Res2 =
+ typename gdb::invoke_result<Callable &, Args...>::type>
struct IsCompatibleCallable : CompatibleReturnType<Res2, Res>
- {};
+ {
+ };
/* True if Callable is a function_view. Used to avoid hijacking the
copy ctor. */
- template <typename Callable>
+ template<typename Callable>
struct IsFunctionView
: std::is_same<function_view, typename std::decay<Callable>::type>
- {};
-
- public:
+ {
+ };
+public:
/* NULL by default. */
- constexpr function_view () noexcept
- : m_erased_callable {},
- m_invoker {}
- {}
+ constexpr function_view () noexcept : m_erased_callable {}, m_invoker {} {}
/* Default copy/assignment is fine. */
function_view (const function_view &) = default;
@@ -256,10 +255,9 @@ class function_view<Res (Args...)>
/* This is the main entry point. Use SFINAE to avoid hijacking the
copy constructor and to ensure that the target type is
compatible. */
- template
- <typename Callable,
- typename = Requires<Not<IsFunctionView<Callable>>>,
- typename = Requires<IsCompatibleCallable<Callable>>>
+ template<typename Callable,
+ typename = Requires<Not<IsFunctionView<Callable>>>,
+ typename = Requires<IsCompatibleCallable<Callable>>>
function_view (Callable &&callable) noexcept
{
bind (callable);
@@ -269,7 +267,8 @@ class function_view<Res (Args...)>
constexpr function_view (std::nullptr_t) noexcept
: m_erased_callable {},
m_invoker {}
- {}
+ {
+ }
/* Clear a function_view. */
function_view &operator= (std::nullptr_t) noexcept
@@ -282,28 +281,30 @@ class function_view<Res (Args...)>
we check M_INVOKER instead of M_ERASED_CALLABLE because we don't
know which member of the union is active right now. */
constexpr explicit operator bool () const noexcept
- { return m_invoker != nullptr; }
+ {
+ return m_invoker != nullptr;
+ }
/* Call the callable. */
- Res operator () (Args... args) const
- { return m_invoker (m_erased_callable, std::forward<Args> (args)...); }
-
- private:
+ Res operator() (Args... args) const
+ {
+ return m_invoker (m_erased_callable, std::forward<Args> (args)...);
+ }
+private:
/* Bind this function_view to a compatible function object
reference. */
- template <typename Callable>
+ template<typename Callable>
void bind (Callable &callable) noexcept
{
m_erased_callable.data = (void *) std::addressof (callable);
- m_invoker = [] (fv_detail::erased_callable ecall, Args... args)
- noexcept (noexcept (callable (std::forward<Args> (args)...))) -> Res
- {
- auto &restored_callable = *static_cast<Callable *> (ecall.data);
- /* The explicit cast to Res avoids a compile error when Res is
+ m_invoker = [] (fv_detail::erased_callable ecall, Args... args) noexcept (
+ noexcept (callable (std::forward<Args> (args)...))) -> Res {
+ auto &restored_callable = *static_cast<Callable *> (ecall.data);
+ /* The explicit cast to Res avoids a compile error when Res is
void and the callable returns non-void. */
- return (Res) restored_callable (std::forward<Args> (args)...);
- };
+ return (Res) restored_callable (std::forward<Args> (args)...);
+ };
}
/* Bind this function_view to a compatible function pointer.
@@ -317,14 +318,13 @@ class function_view<Res (Args...)>
void bind (Res2 (*fn) (Args2...)) noexcept
{
m_erased_callable.fn = reinterpret_cast<void (*) ()> (fn);
- m_invoker = [] (fv_detail::erased_callable ecall, Args... args)
- noexcept (noexcept (fn (std::forward<Args> (args)...))) -> Res
- {
- auto restored_fn = reinterpret_cast<Res2 (*) (Args2...)> (ecall.fn);
- /* The explicit cast to Res avoids a compile error when Res is
+ m_invoker = [] (fv_detail::erased_callable ecall, Args... args) noexcept (
+ noexcept (fn (std::forward<Args> (args)...))) -> Res {
+ auto restored_fn = reinterpret_cast<Res2 (*) (Args2...)> (ecall.fn);
+ /* The explicit cast to Res avoids a compile error when Res is
void and the callable returns non-void. */
- return (Res) restored_fn (std::forward<Args> (args)...);
- };
+ return (Res) restored_fn (std::forward<Args> (args)...);
+ };
}
/* Storage for the erased callable. */
@@ -343,24 +343,33 @@ class function_view<Res (Args...)>
template<typename Res, typename... Args>
constexpr inline bool
operator== (const function_view<Res (Args...)> &f, std::nullptr_t) noexcept
-{ return !static_cast<bool> (f); }
+{
+ return !static_cast<bool> (f);
+}
template<typename Res, typename... Args>
constexpr inline bool
operator== (std::nullptr_t, const function_view<Res (Args...)> &f) noexcept
-{ return !static_cast<bool> (f); }
+{
+ return !static_cast<bool> (f);
+}
template<typename Res, typename... Args>
constexpr inline bool
operator!= (const function_view<Res (Args...)> &f, std::nullptr_t) noexcept
-{ return static_cast<bool> (f); }
+{
+ return static_cast<bool> (f);
+}
template<typename Res, typename... Args>
constexpr inline bool
operator!= (std::nullptr_t, const function_view<Res (Args...)> &f) noexcept
-{ return static_cast<bool> (f); }
+{
+ return static_cast<bool> (f);
+}
-namespace fv_detail {
+namespace fv_detail
+{
/* Helper traits type to automatically find the right function_view
type for a callable. */
@@ -402,7 +411,7 @@ struct function_view_traits<Res (*&) (Args...)>
/* Reference to const function pointers. */
template<typename Res, typename... Args>
-struct function_view_traits<Res (* const &) (Args...)>
+struct function_view_traits<Res (*const &) (Args...)>
: function_view_traits<Res (Args...)>
{
};
@@ -429,8 +438,8 @@ struct function_view_traits<Res (Class::*) (Args...)>
operator(). */
template<typename FuncObj>
struct function_view_traits
- : function_view_traits <decltype
- (&std::remove_reference<FuncObj>::type::operator())>
+ : function_view_traits<
+ decltype (&std::remove_reference<FuncObj>::type::operator())>
{
};
@@ -439,8 +448,9 @@ struct function_view_traits
/* Make a function_view from a callable. Useful to automatically
deduce the function_view's template argument type. */
template<typename Callable>
-auto make_function_view (Callable &&callable)
- -> typename fv_detail::function_view_traits<Callable>::type
+auto
+make_function_view (Callable &&callable) ->
+ typename fv_detail::function_view_traits<Callable>::type
{
using fv = typename fv_detail::function_view_traits<Callable>::type;
return fv (std::forward<Callable> (callable));
diff --git a/gdbsupport/gdb-checked-static-cast.h b/gdbsupport/gdb-checked-static-cast.h
index bc75244bddd..8000cbb981d 100644
--- a/gdbsupport/gdb-checked-static-cast.h
+++ b/gdbsupport/gdb-checked-static-cast.h
@@ -50,8 +50,8 @@ checked_static_cast (V *v)
mistakes at compile time, this assert prevents anything other than
downcasts, or casts to same type. */
static_assert (std::is_base_of<V, T_no_P>::value
- || std::is_base_of<T_no_P, V>::value,
- "types must be related");
+ || std::is_base_of<T_no_P, V>::value,
+ "types must be related");
#ifdef DEVELOPMENT
if (v == nullptr)
@@ -66,6 +66,6 @@ checked_static_cast (V *v)
return result;
}
-}
+} // namespace gdb
#endif /* COMMON_GDB_CHECKED_DYNAMIC_CAST_H */
diff --git a/gdbsupport/gdb-dlfcn.cc b/gdbsupport/gdb-dlfcn.cc
index ee17536a988..8fd69676b7b 100644
--- a/gdbsupport/gdb-dlfcn.cc
+++ b/gdbsupport/gdb-dlfcn.cc
@@ -46,7 +46,8 @@ gdb_dlsym (const gdb_dlhandle_up &handle, const char *symbol)
void
dlclose_deleter::operator() (void *handle) const
{
- gdb_assert_not_reached ("gdb_dlclose should not be called on this platform.");
+ gdb_assert_not_reached (
+ "gdb_dlclose should not be called on this platform.");
}
int
@@ -70,21 +71,20 @@ gdb_dlopen (const char *filename)
return gdb_dlhandle_up (result);
#ifdef HAVE_DLFCN_H
- error (_("Could not load %s: %s"), filename, dlerror());
+ error (_ ("Could not load %s: %s"), filename, dlerror ());
#else
{
LPVOID buffer;
DWORD dw;
- dw = GetLastError();
+ dw = GetLastError ();
- FormatMessage (FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM |
- FORMAT_MESSAGE_IGNORE_INSERTS,
- NULL, dw, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
- (LPTSTR) &buffer,
- 0, NULL);
+ FormatMessage (FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM
+ | FORMAT_MESSAGE_IGNORE_INSERTS,
+ NULL, dw, MAKELANGID (LANG_NEUTRAL, SUBLANG_DEFAULT),
+ (LPTSTR) &buffer, 0, NULL);
- error (_("Could not load %s: %s"), filename, (char *) buffer);
+ error (_ ("Could not load %s: %s"), filename, (char *) buffer);
}
#endif
}
diff --git a/gdbsupport/gdb-dlfcn.h b/gdbsupport/gdb-dlfcn.h
index a51f9995ddc..bcc10d97428 100644
--- a/gdbsupport/gdb-dlfcn.h
+++ b/gdbsupport/gdb-dlfcn.h
@@ -46,6 +46,6 @@ void *gdb_dlsym (const gdb_dlhandle_up &handle, const char *symbol);
/* Return non-zero if the dynamic library functions are available on
this platform. */
-int is_dl_available(void);
+int is_dl_available (void);
#endif /* GDB_DLFCN_H */
diff --git a/gdbsupport/gdb-hashtab.h b/gdbsupport/gdb-hashtab.h
index 71611a59a8d..6d7fec1a7a8 100644
--- a/gdbsupport/gdb-hashtab.h
+++ b/gdbsupport/gdb-hashtab.h
@@ -24,10 +24,7 @@
/* A deleter for a hash table. */
struct htab_deleter
{
- void operator() (htab *ptr) const
- {
- htab_delete (ptr);
- }
+ void operator() (htab *ptr) const { htab_delete (ptr); }
};
/* A unique_ptr wrapper for htab_t. */
diff --git a/gdbsupport/gdb-sigmask.h b/gdbsupport/gdb-sigmask.h
index 492b10ef268..598ce090028 100644
--- a/gdbsupport/gdb-sigmask.h
+++ b/gdbsupport/gdb-sigmask.h
@@ -41,5 +41,4 @@
#endif /* HAVE_SIGPROCMASK */
-
#endif /* GDBSUPPORT_GDB_SIGMASK_H */
diff --git a/gdbsupport/gdb-xfree.h b/gdbsupport/gdb-xfree.h
index 1fb326d6670..cb5d7d9ffb0 100644
--- a/gdbsupport/gdb-xfree.h
+++ b/gdbsupport/gdb-xfree.h
@@ -23,7 +23,7 @@
/* GDB uses this instead of 'free', it detects when it is called on an
invalid type. */
-template <typename T>
+template<typename T>
static void
xfree (T *ptr)
{
@@ -32,9 +32,9 @@ data type. Use operator delete instead.");
if (ptr != NULL)
#ifdef GNULIB_NAMESPACE
- GNULIB_NAMESPACE::free (ptr); /* ARI: free */
+ GNULIB_NAMESPACE::free (ptr); /* ARI: free */
#else
- free (ptr); /* ARI: free */
+ free (ptr); /* ARI: free */
#endif
}
diff --git a/gdbsupport/gdb_assert.h b/gdbsupport/gdb_assert.h
index f399036e460..e7ef991928d 100644
--- a/gdbsupport/gdb_assert.h
+++ b/gdbsupport/gdb_assert.h
@@ -31,21 +31,22 @@
existing lower case macro <assert.h>:assert() that it is
replacing. */
-#define gdb_assert(expr) \
- ((void) ((expr) ? 0 : \
- (gdb_assert_fail (#expr, __FILE__, __LINE__, __func__), 0)))
+#define gdb_assert(expr) \
+ ((void) ((expr) \
+ ? 0 \
+ : (gdb_assert_fail (#expr, __FILE__, __LINE__, __func__), 0)))
/* This prints an "Assertion failed" message, asking the user if they
want to continue, dump core, or just exit. */
#define gdb_assert_fail(assertion, file, line, function) \
- internal_error_loc (file, line, _("%s: Assertion `%s' failed."), \
- function, assertion)
+ internal_error_loc (file, line, _ ("%s: Assertion `%s' failed."), function, \
+ assertion)
/* The canonical form of gdb_assert (0).
MESSAGE is a string to include in the error message. */
-#define gdb_assert_not_reached(message, ...) \
- internal_error_loc (__FILE__, __LINE__, _("%s: " message), __func__, \
- ##__VA_ARGS__)
+#define gdb_assert_not_reached(message, ...) \
+ internal_error_loc (__FILE__, __LINE__, _ ("%s: " message), __func__, \
+ ##__VA_ARGS__)
#endif /* COMMON_GDB_ASSERT_H */
diff --git a/gdbsupport/gdb_binary_search.h b/gdbsupport/gdb_binary_search.h
index b6771b920b9..4010a8c7093 100644
--- a/gdbsupport/gdb_binary_search.h
+++ b/gdbsupport/gdb_binary_search.h
@@ -17,13 +17,13 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
-
#ifndef GDBSUPPORT_GDB_BINARY_SEARCH_H
#define GDBSUPPORT_GDB_BINARY_SEARCH_H
#include <algorithm>
-namespace gdb {
+namespace gdb
+{
/* Implements a binary search using C++ iterators.
This differs from std::binary_search in that it returns an iterator for
@@ -39,17 +39,17 @@ namespace gdb {
The return value is an iterator pointing to the found element, or LAST if
no element was found. */
template<typename It, typename T, typename Comp>
-It binary_search (It first, It last, T el, Comp comp)
+It
+binary_search (It first, It last, T el, Comp comp)
{
auto lt = [&] (const typename std::iterator_traits<It>::value_type &a,
- const T &b)
- { return comp (a, b) < 0; };
+ const T &b) { return comp (a, b) < 0; };
auto lb = std::lower_bound (first, last, el, lt);
if (lb != last)
{
if (comp (*lb, el) == 0)
- return lb;
+ return lb;
}
return last;
}
diff --git a/gdbsupport/gdb_file.h b/gdbsupport/gdb_file.h
index 096e67dfc70..a78f9c80a63 100644
--- a/gdbsupport/gdb_file.h
+++ b/gdbsupport/gdb_file.h
@@ -24,10 +24,7 @@
struct gdb_file_deleter
{
- void operator() (FILE *file) const
- {
- fclose (file);
- }
+ void operator() (FILE *file) const { fclose (file); }
};
/* A unique pointer to a FILE. */
diff --git a/gdbsupport/gdb_locale.h b/gdbsupport/gdb_locale.h
index f7c8cd4839f..3703c5d4d68 100644
--- a/gdbsupport/gdb_locale.h
+++ b/gdbsupport/gdb_locale.h
@@ -20,20 +20,20 @@
#define COMMON_GDB_LOCALE_H
#ifdef HAVE_LOCALE_H
-# include <locale.h>
+#include <locale.h>
#endif
#ifdef ENABLE_NLS
-# include <libintl.h>
-# define _(String) gettext (String)
-# ifdef gettext_noop
-# define N_(String) gettext_noop (String)
-# else
-# define N_(String) (String)
-# endif
+#include <libintl.h>
+#define _(String) gettext (String)
+#ifdef gettext_noop
+#define N_(String) gettext_noop (String)
#else
-# define _(String) (String)
-# define N_(String) (String)
+#define N_(String) (String)
+#endif
+#else
+#define _(String) (String)
+#define N_(String) (String)
#endif
#ifdef HAVE_LANGINFO_CODESET
diff --git a/gdbsupport/gdb_obstack.cc b/gdbsupport/gdb_obstack.cc
index a37db9684a6..5a93072f7f3 100644
--- a/gdbsupport/gdb_obstack.cc
+++ b/gdbsupport/gdb_obstack.cc
@@ -36,7 +36,7 @@ obconcat (struct obstack *obstackp, ...)
const char *s = va_arg (ap, const char *);
if (s == NULL)
- break;
+ break;
obstack_grow_str (obstackp, s);
}
diff --git a/gdbsupport/gdb_obstack.h b/gdbsupport/gdb_obstack.h
index dbd8fab54d4..00d32db07da 100644
--- a/gdbsupport/gdb_obstack.h
+++ b/gdbsupport/gdb_obstack.h
@@ -17,15 +17,15 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
-#if !defined (GDB_OBSTACK_H)
+#if !defined(GDB_OBSTACK_H)
#define GDB_OBSTACK_H 1
#include "obstack.h"
/* Utility macros - wrap obstack alloc into something more robust. */
-template <typename T>
-static inline T*
+template<typename T>
+static inline T *
obstack_zalloc (struct obstack *ob)
{
static_assert (IsMallocable<T>::value, "Trying to use OBSTACK_ZALLOC with a \
@@ -33,28 +33,28 @@ non-POD data type. Use obstack_new instead.");
return ((T *) memset (obstack_alloc (ob, sizeof (T)), 0, sizeof (T)));
}
-#define OBSTACK_ZALLOC(OBSTACK,TYPE) obstack_zalloc<TYPE> ((OBSTACK))
+#define OBSTACK_ZALLOC(OBSTACK, TYPE) obstack_zalloc<TYPE> ((OBSTACK))
-template <typename T>
+template<typename T>
static inline T *
obstack_calloc (struct obstack *ob, size_t number)
{
static_assert (IsMallocable<T>::value, "Trying to use OBSTACK_CALLOC with a \
non-POD data type. Use obstack_new instead.");
return ((T *) memset (obstack_alloc (ob, number * sizeof (T)), 0,
- number * sizeof (T)));
+ number * sizeof (T)));
}
-#define OBSTACK_CALLOC(OBSTACK,NUMBER,TYPE) \
+#define OBSTACK_CALLOC(OBSTACK, NUMBER, TYPE) \
obstack_calloc<TYPE> ((OBSTACK), (NUMBER))
/* Allocate an object on OB and call its constructor. */
-template <typename T, typename... Args>
-static inline T*
-obstack_new (struct obstack *ob, Args&&... args)
+template<typename T, typename... Args>
+static inline T *
+obstack_new (struct obstack *ob, Args &&...args)
{
- T* object = (T *) obstack_alloc (ob, sizeof (T));
+ T *object = (T *) obstack_alloc (ob, sizeof (T));
object = new (object) T (std::forward<Args> (args)...);
return object;
}
@@ -71,9 +71,9 @@ obstack_new (struct obstack *ob, Args&&... args)
#define obstack_chunk_alloc xmalloc
#define obstack_chunk_free xfree
-#define obstack_grow_str(OBSTACK,STRING) \
+#define obstack_grow_str(OBSTACK, STRING) \
obstack_grow (OBSTACK, STRING, strlen (STRING))
-#define obstack_grow_str0(OBSTACK,STRING) \
+#define obstack_grow_str0(OBSTACK, STRING) \
obstack_grow0 (OBSTACK, STRING, strlen (STRING))
#define obstack_grow_wstr(OBSTACK, WSTRING) \
@@ -101,8 +101,7 @@ obstack_strdup (struct obstack *obstackp, const char *string)
static inline char *
obstack_strdup (struct obstack *obstackp, const std::string &string)
{
- return (char *) obstack_copy0 (obstackp, string.c_str (),
- string.size ());
+ return (char *) obstack_copy0 (obstackp, string.c_str (), string.size ());
}
/* Duplicate the first N characters of STRING, returning a
@@ -119,18 +118,15 @@ obstack_strndup (struct obstack *obstackp, const char *string, size_t n)
/* An obstack that frees itself on scope exit. */
struct auto_obstack : obstack
{
- auto_obstack ()
- { obstack_init (this); }
+ auto_obstack () { obstack_init (this); }
- ~auto_obstack ()
- { obstack_free (this, NULL); }
+ ~auto_obstack () { obstack_free (this, NULL); }
DISABLE_COPY_AND_ASSIGN (auto_obstack);
/* Free all memory in the obstack but leave it valid for further
allocation. */
- void clear ()
- { obstack_free (this, obstack_base (this)); }
+ void clear () { obstack_free (this, obstack_base (this)); }
};
/* Objects are allocated on obstack instead of heap. */
@@ -139,12 +135,12 @@ struct allocate_on_obstack
{
allocate_on_obstack () = default;
- void* operator new (size_t size, struct obstack *obstack)
+ void *operator new (size_t size, struct obstack *obstack)
{
return obstack_alloc (obstack, size);
}
- void* operator new[] (size_t size, struct obstack *obstack)
+ void *operator new[] (size_t size, struct obstack *obstack)
{
return obstack_alloc (obstack, size);
}
diff --git a/gdbsupport/gdb_optional.h b/gdbsupport/gdb_optional.h
index 9b7b7b2f7f4..a4a5582f1ca 100644
--- a/gdbsupport/gdb_optional.h
+++ b/gdbsupport/gdb_optional.h
@@ -51,19 +51,16 @@ template<typename T>
class optional
{
public:
-
- constexpr optional ()
- : m_dummy ()
- {}
+ constexpr optional () : m_dummy () {}
template<typename... Args>
- constexpr optional (in_place_t, Args &&... args)
+ constexpr optional (in_place_t, Args &&...args)
: m_item (std::forward<Args> (args)...),
m_instantiated (true)
- {}
+ {
+ }
- ~optional ()
- { this->reset (); }
+ ~optional () { this->reset (); }
/* Copy and move constructors. */
@@ -73,61 +70,58 @@ public:
this->emplace (other.get ());
}
- optional (optional &&other)
- noexcept(std::is_nothrow_move_constructible<T> ())
+ optional (optional &&other) noexcept (
+ std::is_nothrow_move_constructible<T> ())
{
if (other.m_instantiated)
this->emplace (std::move (other.get ()));
}
- constexpr optional (const T &other)
- : m_item (other),
- m_instantiated (true)
- {}
+ constexpr optional (const T &other) : m_item (other), m_instantiated (true)
+ {
+ }
- constexpr optional (T &&other)
- noexcept (std::is_nothrow_move_constructible<T> ())
+ constexpr optional (T &&other) noexcept (
+ std::is_nothrow_move_constructible<T> ())
: m_item (std::move (other)),
m_instantiated (true)
- {}
+ {
+ }
/* Assignment operators. */
- optional &
- operator= (const optional &other)
+ optional &operator= (const optional &other)
{
if (m_instantiated && other.m_instantiated)
this->get () = other.get ();
else
{
- if (other.m_instantiated)
- this->emplace (other.get ());
- else
- this->reset ();
+ if (other.m_instantiated)
+ this->emplace (other.get ());
+ else
+ this->reset ();
}
return *this;
}
- optional &
- operator= (optional &&other)
- noexcept (And<std::is_nothrow_move_constructible<T>,
- std::is_nothrow_move_assignable<T>> ())
+ optional &operator= (optional &&other) noexcept (
+ And<std::is_nothrow_move_constructible<T>,
+ std::is_nothrow_move_assignable<T>> ())
{
if (m_instantiated && other.m_instantiated)
this->get () = std::move (other.get ());
else
{
- if (other.m_instantiated)
- this->emplace (std::move (other.get ()));
- else
- this->reset ();
+ if (other.m_instantiated)
+ this->emplace (std::move (other.get ()));
+ else
+ this->reset ();
}
return *this;
}
- optional &
- operator= (const T &other)
+ optional &operator= (const T &other)
{
if (m_instantiated)
this->get () = other;
@@ -137,9 +131,8 @@ public:
}
optional &
- operator= (T &&other)
- noexcept (And<std::is_nothrow_move_constructible<T>,
- std::is_nothrow_move_assignable<T>> ())
+ operator= (T &&other) noexcept (And<std::is_nothrow_move_constructible<T>,
+ std::is_nothrow_move_assignable<T>> ())
{
if (m_instantiated)
this->get () = std::move (other);
@@ -149,38 +142,36 @@ public:
}
template<typename... Args>
- T &emplace (Args &&... args)
+ T &emplace (Args &&...args)
{
this->reset ();
- new (&m_item) T (std::forward<Args>(args)...);
+ new (&m_item) T (std::forward<Args> (args)...);
m_instantiated = true;
return this->get ();
}
/* Observers. */
- constexpr const T *operator-> () const
- { return std::addressof (this->get ()); }
+ constexpr const T *operator->() const
+ {
+ return std::addressof (this->get ());
+ }
- T *operator-> ()
- { return std::addressof (this->get ()); }
+ T *operator->() { return std::addressof (this->get ()); }
- constexpr const T &operator* () const &
- { return this->get (); }
+ constexpr const T &operator* () const & { return this->get (); }
- T &operator* () &
- { return this->get (); }
+ T &operator* () & { return this->get (); }
- T &&operator* () &&
- { return std::move (this->get ()); }
+ T &&operator* () && { return std::move (this->get ()); }
constexpr const T &&operator* () const &&
- { return std::move (this->get ()); }
+ {
+ return std::move (this->get ());
+ }
- constexpr explicit operator bool () const noexcept
- { return m_instantiated; }
+ constexpr explicit operator bool () const noexcept { return m_instantiated; }
- constexpr bool has_value () const noexcept
- { return m_instantiated; }
+ constexpr bool has_value () const noexcept { return m_instantiated; }
/* 'reset' is a 'safe' operation with no precondition. */
void reset () noexcept
@@ -190,7 +181,6 @@ public:
}
private:
-
/* Destroy the object. */
void destroy ()
{
@@ -218,7 +208,9 @@ private:
/* The object. */
union
{
- struct { } m_dummy;
+ struct
+ {
+ } m_dummy;
T m_item;
volatile char dont_use; /* Silences -Wmaybe-uninitialized warning, see
PR gcc/80635. */
@@ -228,6 +220,6 @@ private:
bool m_instantiated = false;
};
-}
+} // namespace gdb
#endif /* COMMON_GDB_OPTIONAL_H */
diff --git a/gdbsupport/gdb_proc_service.h b/gdbsupport/gdb_proc_service.h
index 19d40e0ee10..8094c5a78c1 100644
--- a/gdbsupport/gdb_proc_service.h
+++ b/gdbsupport/gdb_proc_service.h
@@ -64,9 +64,9 @@ EXTERN_C_POP
<sys/procfs.h> wasn't enough to find elf_fpregset_t, try the kernel
headers also (but don't if we don't need to). */
#ifndef HAVE_ELF_FPREGSET_T
-# ifdef HAVE_LINUX_ELF_H
-# include <linux/elf.h>
-# endif
+#ifdef HAVE_LINUX_ELF_H
+#include <linux/elf.h>
+#endif
#endif
EXTERN_C_PUSH
@@ -74,13 +74,13 @@ EXTERN_C_PUSH
/* Functions in this interface return one of these status codes. */
typedef enum
{
- PS_OK, /* Generic "call succeeded". */
- PS_ERR, /* Generic error. */
- PS_BADPID, /* Bad process handle. */
- PS_BADLID, /* Bad LWP identifier. */
- PS_BADADDR, /* Bad address. */
- PS_NOSYM, /* Could not find given symbol. */
- PS_NOFREGS /* FPU register set not available for given LWP. */
+ PS_OK, /* Generic "call succeeded". */
+ PS_ERR, /* Generic error. */
+ PS_BADPID, /* Bad process handle. */
+ PS_BADLID, /* Bad LWP identifier. */
+ PS_BADADDR, /* Bad address. */
+ PS_NOSYM, /* Could not find given symbol. */
+ PS_NOFREGS /* FPU register set not available for given LWP. */
} ps_err_e;
#ifndef HAVE_LWPID_T
@@ -103,27 +103,22 @@ typedef elf_fpregset_t prfpregset_t;
libthread_db. GDB's version is defined below. */
struct ps_prochandle;
-
/* Read or write process memory at the given address. */
-extern ps_err_e ps_pdread (struct ps_prochandle *,
- psaddr_t, void *, size_t);
-extern ps_err_e ps_pdwrite (struct ps_prochandle *,
- psaddr_t, const void *, size_t);
-extern ps_err_e ps_ptread (struct ps_prochandle *,
- psaddr_t, void *, size_t);
-extern ps_err_e ps_ptwrite (struct ps_prochandle *,
- psaddr_t, const void *, size_t);
-
+extern ps_err_e ps_pdread (struct ps_prochandle *, psaddr_t, void *, size_t);
+extern ps_err_e ps_pdwrite (struct ps_prochandle *, psaddr_t, const void *,
+ size_t);
+extern ps_err_e ps_ptread (struct ps_prochandle *, psaddr_t, void *, size_t);
+extern ps_err_e ps_ptwrite (struct ps_prochandle *, psaddr_t, const void *,
+ size_t);
/* Get and set the given LWP's general or FPU register set. */
-extern ps_err_e ps_lgetregs (struct ps_prochandle *,
- lwpid_t, prgregset_t);
-extern ps_err_e ps_lsetregs (struct ps_prochandle *,
- lwpid_t, const prgregset_t);
-extern ps_err_e ps_lgetfpregs (struct ps_prochandle *,
- lwpid_t, prfpregset_t *);
-extern ps_err_e ps_lsetfpregs (struct ps_prochandle *,
- lwpid_t, const prfpregset_t *);
+extern ps_err_e ps_lgetregs (struct ps_prochandle *, lwpid_t, prgregset_t);
+extern ps_err_e ps_lsetregs (struct ps_prochandle *, lwpid_t,
+ const prgregset_t);
+extern ps_err_e ps_lgetfpregs (struct ps_prochandle *, lwpid_t,
+ prfpregset_t *);
+extern ps_err_e ps_lsetfpregs (struct ps_prochandle *, lwpid_t,
+ const prfpregset_t *);
/* Return the PID of the process. */
extern pid_t ps_getpid (struct ps_prochandle *);
@@ -131,18 +126,15 @@ extern pid_t ps_getpid (struct ps_prochandle *);
/* Fetch the special per-thread address associated with the given LWP.
This call is only used on a few platforms (most use a normal register).
The meaning of the `int' parameter is machine-dependent. */
-extern ps_err_e ps_get_thread_area (struct ps_prochandle *,
- lwpid_t, int, psaddr_t *);
-
+extern ps_err_e ps_get_thread_area (struct ps_prochandle *, lwpid_t, int,
+ psaddr_t *);
/* Look up the named symbol in the named DSO in the symbol tables
associated with the process being debugged, filling in *SYM_ADDR
with the corresponding run-time address. */
extern ps_err_e ps_pglobal_lookup (struct ps_prochandle *,
- const char *object_name,
- const char *sym_name,
- psaddr_t *sym_addr);
-
+ const char *object_name,
+ const char *sym_name, psaddr_t *sym_addr);
/* Stop or continue the entire process. */
extern ps_err_e ps_pstop (struct ps_prochandle *);
@@ -155,13 +147,13 @@ extern ps_err_e ps_lcontinue (struct ps_prochandle *, lwpid_t);
/* The following are only defined in/called by Solaris. */
/* Get size of extra register set. */
-extern ps_err_e ps_lgetxregsize (struct ps_prochandle *ph,
- lwpid_t lwpid, int *xregsize);
+extern ps_err_e ps_lgetxregsize (struct ps_prochandle *ph, lwpid_t lwpid,
+ int *xregsize);
/* Get extra register set. */
extern ps_err_e ps_lgetxregs (struct ps_prochandle *ph, lwpid_t lwpid,
- caddr_t xregset);
+ caddr_t xregset);
extern ps_err_e ps_lsetxregs (struct ps_prochandle *ph, lwpid_t lwpid,
- caddr_t xregset);
+ caddr_t xregset);
/* Log a message (sends to gdb_stderr). */
extern void ps_plog (const char *fmt, ...);
@@ -173,8 +165,8 @@ EXTERN_C_POP
/* Make sure we export the needed symbols, in case GDB is built with
-fvisibility=hidden. */
-#define PS_EXPORT(SYM) \
- __attribute__((visibility ("default"))) decltype (SYM) SYM
+#define PS_EXPORT(SYM) \
+ __attribute__ ((visibility ("default"))) decltype (SYM) SYM
PS_EXPORT (ps_get_thread_area);
PS_EXPORT (ps_getpid);
diff --git a/gdbsupport/gdb_ref_ptr.h b/gdbsupport/gdb_ref_ptr.h
index 00f02b7cd48..786f80ee2c6 100644
--- a/gdbsupport/gdb_ref_ptr.h
+++ b/gdbsupport/gdb_ref_ptr.h
@@ -48,38 +48,26 @@ namespace gdb
template<typename T, typename Policy>
class ref_ptr
{
- public:
-
+public:
/* Create a new NULL instance. */
- ref_ptr ()
- : m_obj (NULL)
- {
- }
+ ref_ptr () : m_obj (NULL) {}
/* Create a new NULL instance. Note that this is not explicit. */
- ref_ptr (const std::nullptr_t)
- : m_obj (NULL)
- {
- }
+ ref_ptr (const std::nullptr_t) : m_obj (NULL) {}
/* Create a new instance. OBJ is a reference, management of which
is now transferred to this class. */
- explicit ref_ptr (T *obj)
- : m_obj (obj)
- {
- }
+ explicit ref_ptr (T *obj) : m_obj (obj) {}
/* Copy another instance. */
- ref_ptr (const ref_ptr &other)
- : m_obj (other.m_obj)
+ ref_ptr (const ref_ptr &other) : m_obj (other.m_obj)
{
if (m_obj != NULL)
Policy::incref (m_obj);
}
/* Transfer ownership from OTHER. */
- ref_ptr (ref_ptr &&other) noexcept
- : m_obj (other.m_obj)
+ ref_ptr (ref_ptr &&other) noexcept : m_obj (other.m_obj)
{
other.m_obj = NULL;
}
@@ -97,9 +85,9 @@ class ref_ptr
/* Do nothing on self-assignment. */
if (this != &other)
{
- reset (other.m_obj);
- if (m_obj != NULL)
- Policy::incref (m_obj);
+ reset (other.m_obj);
+ if (m_obj != NULL)
+ Policy::incref (m_obj);
}
return *this;
}
@@ -110,8 +98,8 @@ class ref_ptr
/* Do nothing on self-assignment. */
if (this != &other)
{
- reset (other.m_obj);
- other.m_obj = NULL;
+ reset (other.m_obj);
+ other.m_obj = NULL;
}
return *this;
}
@@ -127,10 +115,7 @@ class ref_ptr
/* Return this instance's referent without changing the state of
this class. */
- T *get () const
- {
- return m_obj;
- }
+ T *get () const { return m_obj; }
/* Return this instance's referent, and stop managing this
reference. The caller is now responsible for the ownership of
@@ -144,10 +129,7 @@ class ref_ptr
}
/* Let users refer to members of the underlying pointer. */
- T *operator-> () const
- {
- return m_obj;
- }
+ T *operator->() const { return m_obj; }
/* Acquire a new reference and return a ref_ptr that owns it. */
static ref_ptr<T, Policy> new_reference (T *obj)
@@ -156,73 +138,80 @@ class ref_ptr
return ref_ptr<T, Policy> (obj);
}
- private:
-
+private:
T *m_obj;
};
template<typename T, typename Policy>
-inline bool operator== (const ref_ptr<T, Policy> &lhs,
- const ref_ptr<T, Policy> &rhs)
+inline bool
+operator== (const ref_ptr<T, Policy> &lhs, const ref_ptr<T, Policy> &rhs)
{
return lhs.get () == rhs.get ();
}
template<typename T, typename Policy>
-inline bool operator== (const ref_ptr<T, Policy> &lhs, const T *rhs)
+inline bool
+operator== (const ref_ptr<T, Policy> &lhs, const T *rhs)
{
return lhs.get () == rhs;
}
template<typename T, typename Policy>
-inline bool operator== (const ref_ptr<T, Policy> &lhs, const std::nullptr_t)
+inline bool
+operator== (const ref_ptr<T, Policy> &lhs, const std::nullptr_t)
{
return lhs.get () == nullptr;
}
template<typename T, typename Policy>
-inline bool operator== (const T *lhs, const ref_ptr<T, Policy> &rhs)
+inline bool
+operator== (const T *lhs, const ref_ptr<T, Policy> &rhs)
{
return lhs == rhs.get ();
}
template<typename T, typename Policy>
-inline bool operator== (const std::nullptr_t, const ref_ptr<T, Policy> &rhs)
+inline bool
+operator== (const std::nullptr_t, const ref_ptr<T, Policy> &rhs)
{
return nullptr == rhs.get ();
}
template<typename T, typename Policy>
-inline bool operator!= (const ref_ptr<T, Policy> &lhs,
- const ref_ptr<T, Policy> &rhs)
+inline bool
+operator!= (const ref_ptr<T, Policy> &lhs, const ref_ptr<T, Policy> &rhs)
{
return lhs.get () != rhs.get ();
}
template<typename T, typename Policy>
-inline bool operator!= (const ref_ptr<T, Policy> &lhs, const T *rhs)
+inline bool
+operator!= (const ref_ptr<T, Policy> &lhs, const T *rhs)
{
return lhs.get () != rhs;
}
template<typename T, typename Policy>
-inline bool operator!= (const ref_ptr<T, Policy> &lhs, const std::nullptr_t)
+inline bool
+operator!= (const ref_ptr<T, Policy> &lhs, const std::nullptr_t)
{
return lhs.get () != nullptr;
}
template<typename T, typename Policy>
-inline bool operator!= (const T *lhs, const ref_ptr<T, Policy> &rhs)
+inline bool
+operator!= (const T *lhs, const ref_ptr<T, Policy> &rhs)
{
return lhs != rhs.get ();
}
template<typename T, typename Policy>
-inline bool operator!= (const std::nullptr_t, const ref_ptr<T, Policy> &rhs)
+inline bool
+operator!= (const std::nullptr_t, const ref_ptr<T, Policy> &rhs)
{
return nullptr != rhs.get ();
}
-}
+} // namespace gdb
#endif /* COMMON_GDB_REF_PTR_H */
diff --git a/gdbsupport/gdb_regex.cc b/gdbsupport/gdb_regex.cc
index ff9c1a1a436..8855d2d4a7d 100644
--- a/gdbsupport/gdb_regex.cc
+++ b/gdbsupport/gdb_regex.cc
@@ -20,7 +20,7 @@
#include "gdbsupport/def-vector.h"
compiled_regex::compiled_regex (const char *regex, int cflags,
- const char *message)
+ const char *message)
{
gdb_assert (regex != NULL);
gdb_assert (message != NULL);
@@ -42,16 +42,15 @@ compiled_regex::~compiled_regex ()
}
int
-compiled_regex::exec (const char *string, size_t nmatch,
- regmatch_t pmatch[], int eflags) const
+compiled_regex::exec (const char *string, size_t nmatch, regmatch_t pmatch[],
+ int eflags) const
{
return regexec (&m_pattern, string, nmatch, pmatch, eflags);
}
int
-compiled_regex::search (const char *string,
- int length, int start, int range,
- struct re_registers *regs)
+compiled_regex::search (const char *string, int length, int start, int range,
+ struct re_registers *regs)
{
return re_search (&m_pattern, string, length, start, range, regs);
}
diff --git a/gdbsupport/gdb_regex.h b/gdbsupport/gdb_regex.h
index 74c3ece62d1..aa89bee341a 100644
--- a/gdbsupport/gdb_regex.h
+++ b/gdbsupport/gdb_regex.h
@@ -19,7 +19,7 @@
#ifndef GDB_REGEX_H
#define GDB_REGEX_H 1
-# include "xregex.h"
+#include "xregex.h"
/* A compiled regex. This is mainly a wrapper around regex_t. The
the constructor throws on regcomp error and the destructor is
@@ -31,8 +31,7 @@ class compiled_regex
public:
/* Compile a regexp and throw an exception on error, including
MESSAGE. REGEX and MESSAGE must not be NULL. */
- compiled_regex (const char *regex, int cflags,
- const char *message)
+ compiled_regex (const char *regex, int cflags, const char *message)
ATTRIBUTE_NONNULL (2) ATTRIBUTE_NONNULL (4);
~compiled_regex ();
@@ -40,14 +39,13 @@ public:
DISABLE_COPY_AND_ASSIGN (compiled_regex);
/* Wrapper around ::regexec. */
- int exec (const char *string,
- size_t nmatch, regmatch_t pmatch[],
- int eflags) const;
+ int exec (const char *string, size_t nmatch, regmatch_t pmatch[],
+ int eflags) const;
/* Wrapper around ::re_search. (Not const because re_search's
regex_t parameter isn't either.) */
- int search (const char *string, int size, int startpos,
- int range, struct re_registers *regs);
+ int search (const char *string, int size, int startpos, int range,
+ struct re_registers *regs);
private:
/* The compiled pattern. */
diff --git a/gdbsupport/gdb_select.h b/gdbsupport/gdb_select.h
index 9928aae5a00..6699a589802 100644
--- a/gdbsupport/gdb_select.h
+++ b/gdbsupport/gdb_select.h
@@ -31,7 +31,7 @@
#endif
extern int gdb_select (int n, fd_set *readfds, fd_set *writefds,
- fd_set *exceptfds, struct timeval *timeout);
+ fd_set *exceptfds, struct timeval *timeout);
/* Convenience wrapper around gdb_select that returns -1/EINTR if
set_quit_flag is set, either on entry or from a signal handler or
@@ -42,10 +42,7 @@ extern int gdb_select (int n, fd_set *readfds, fd_set *writefds,
Note this does NOT return -1/EINTR if any signal handler other than
SIGINT runs, nor if the current SIGINT handler does not call
set_quit_flag. */
-extern int interruptible_select (int n,
- fd_set *readfds,
- fd_set *writefds,
- fd_set *exceptfds,
- struct timeval *timeout);
+extern int interruptible_select (int n, fd_set *readfds, fd_set *writefds,
+ fd_set *exceptfds, struct timeval *timeout);
#endif /* !defined(GDB_SELECT_H) */
diff --git a/gdbsupport/gdb_setjmp.h b/gdbsupport/gdb_setjmp.h
index 5fafb9e818e..38a6b80956a 100644
--- a/gdbsupport/gdb_setjmp.h
+++ b/gdbsupport/gdb_setjmp.h
@@ -22,15 +22,15 @@
#include <setjmp.h>
#ifdef HAVE_SIGSETJMP
-#define SIGJMP_BUF sigjmp_buf
-#define SIGSETJMP(buf,val) sigsetjmp((buf), val)
-#define SIGLONGJMP(buf,val) siglongjmp((buf), (val))
+#define SIGJMP_BUF sigjmp_buf
+#define SIGSETJMP(buf, val) sigsetjmp ((buf), val)
+#define SIGLONGJMP(buf, val) siglongjmp ((buf), (val))
#else
-#define SIGJMP_BUF jmp_buf
+#define SIGJMP_BUF jmp_buf
/* We ignore val here because that's safer and avoids having to check
whether _setjmp exists. */
-#define SIGSETJMP(buf,val) setjmp(buf)
-#define SIGLONGJMP(buf,val) longjmp((buf), (val))
+#define SIGSETJMP(buf, val) setjmp (buf)
+#define SIGLONGJMP(buf, val) longjmp ((buf), (val))
#endif
#endif /* COMMON_GDB_SETJMP_H */
diff --git a/gdbsupport/gdb_splay_tree.h b/gdbsupport/gdb_splay_tree.h
index 22d9bf69740..51de1887c87 100644
--- a/gdbsupport/gdb_splay_tree.h
+++ b/gdbsupport/gdb_splay_tree.h
@@ -22,14 +22,12 @@
#include "splay-tree.h"
-namespace gdb {
+namespace gdb
+{
struct splay_tree_deleter
{
- void operator() (splay_tree tree) const
- {
- splay_tree_delete (tree);
- }
+ void operator() (splay_tree tree) const { splay_tree_delete (tree); }
};
} /* namespace gdb */
@@ -37,6 +35,6 @@ struct splay_tree_deleter
/* A unique pointer to a splay tree. */
typedef std::unique_ptr<splay_tree_s, gdb::splay_tree_deleter>
- gdb_splay_tree_up;
+ gdb_splay_tree_up;
#endif /* COMMON_GDB_SPLAY_TREE_H */
diff --git a/gdbsupport/gdb_string_view.h b/gdbsupport/gdb_string_view.h
index 26a3a9f0910..968ef11bef8 100644
--- a/gdbsupport/gdb_string_view.h
+++ b/gdbsupport/gdb_string_view.h
@@ -1,6 +1,5 @@
// Components for manipulating non-owning sequences of characters -*- C++ -*-
-
#ifndef COMMON_GDB_STRING_VIEW_H
#define COMMON_GDB_STRING_VIEW_H
@@ -33,13 +32,13 @@
// N3762 basic_string_view library
//
-
#if __cplusplus >= 201703L
#include <string_view>
-namespace gdb {
- using string_view = std::string_view;
+namespace gdb
+{
+using string_view = std::string_view;
} /* namespace gdb */
#else /* __cplusplus < 201703L */
@@ -48,9 +47,10 @@ namespace gdb {
#include <limits>
#include "gdb_assert.h"
-namespace gdb {
+namespace gdb
+{
- /**
+/**
* @class basic_string_view <experimental/string_view>
* @brief A non-owning reference to a string.
*
@@ -69,498 +69,538 @@ namespace gdb {
* size_t _M_len
* @endcode
*/
- template<typename _CharT, typename _Traits = std::char_traits<_CharT>>
- class basic_string_view
- {
- public:
-
- // types
- using traits_type = _Traits;
- using value_type = _CharT;
- using pointer = const _CharT*;
- using const_pointer = const _CharT*;
- using reference = const _CharT&;
- using const_reference = const _CharT&;
- using const_iterator = const _CharT*;
- using iterator = const_iterator;
- using const_reverse_iterator = std::reverse_iterator<const_iterator>;
- using reverse_iterator = const_reverse_iterator;
- using size_type = size_t;
- using difference_type = ptrdiff_t;
- static constexpr size_type npos = size_type(-1);
-
- // [string.view.cons], construct/copy
-
- constexpr
- basic_string_view() noexcept
- : _M_len{0}, _M_str{nullptr}
- { }
-
- constexpr basic_string_view(const basic_string_view&) noexcept = default;
-
- template<typename _Allocator>
- basic_string_view(const std::basic_string<_CharT, _Traits,
- _Allocator>& __str) noexcept
- : _M_len{__str.length()}, _M_str{__str.data()}
- { }
-
- /*constexpr*/ basic_string_view(const _CharT* __str)
- : _M_len{__str == nullptr ? 0 : traits_type::length(__str)},
- _M_str{__str}
- { }
-
- constexpr basic_string_view(const _CharT* __str, size_type __len)
- : _M_len{__len},
- _M_str{__str}
- { }
-
- basic_string_view&
- operator=(const basic_string_view&) noexcept = default;
-
- // [string.view.iterators], iterators
-
- constexpr const_iterator
- begin() const noexcept
- { return this->_M_str; }
-
- constexpr const_iterator
- end() const noexcept
- { return this->_M_str + this->_M_len; }
-
- constexpr const_iterator
- cbegin() const noexcept
- { return this->_M_str; }
-
- constexpr const_iterator
- cend() const noexcept
- { return this->_M_str + this->_M_len; }
-
- const_reverse_iterator
- rbegin() const noexcept
- { return const_reverse_iterator(this->end()); }
-
- const_reverse_iterator
- rend() const noexcept
- { return const_reverse_iterator(this->begin()); }
-
- const_reverse_iterator
- crbegin() const noexcept
- { return const_reverse_iterator(this->end()); }
-
- const_reverse_iterator
- crend() const noexcept
- { return const_reverse_iterator(this->begin()); }
-
- // [string.view.capacity], capacity
-
- constexpr size_type
- size() const noexcept
- { return this->_M_len; }
-
- constexpr size_type
- length() const noexcept
- { return _M_len; }
-
- constexpr size_type
- max_size() const noexcept
- {
- return (npos - sizeof(size_type) - sizeof(void*))
- / sizeof(value_type) / 4;
- }
-
- constexpr bool
- empty() const noexcept
- { return this->_M_len == 0; }
-
- // [string.view.access], element access
-
- constexpr const _CharT&
- operator[](size_type __pos) const
- {
- // TODO: Assert to restore in a way compatible with the constexpr.
- // __glibcxx_assert(__pos < this->_M_len);
- return *(this->_M_str + __pos);
- }
-
- constexpr const _CharT&
- at(size_type __pos) const
- {
- return __pos < this->_M_len
- ? *(this->_M_str + __pos)
- : (error (_("basic_string_view::at: __pos "
- "(which is %zu) >= this->size() "
- "(which is %zu)"),
- __pos, this->size()),
- *this->_M_str);
- }
-
- constexpr const _CharT&
- front() const
- {
- // TODO: Assert to restore in a way compatible with the constexpr.
- // __glibcxx_assert(this->_M_len > 0);
- return *this->_M_str;
- }
-
- constexpr const _CharT&
- back() const
- {
- // TODO: Assert to restore in a way compatible with the constexpr.
- // __glibcxx_assert(this->_M_len > 0);
- return *(this->_M_str + this->_M_len - 1);
- }
-
- constexpr const _CharT*
- data() const noexcept
- { return this->_M_str; }
-
- // [string.view.modifiers], modifiers:
-
- /*constexpr*/ void
- remove_prefix(size_type __n)
- {
- gdb_assert (this->_M_len >= __n);
- this->_M_str += __n;
- this->_M_len -= __n;
- }
-
- /*constexpr*/ void
- remove_suffix(size_type __n)
- { this->_M_len -= __n; }
-
- /*constexpr*/ void
- swap(basic_string_view& __sv) noexcept
- {
- auto __tmp = *this;
- *this = __sv;
- __sv = __tmp;
- }
-
-
- // [string.view.ops], string operations:
-
- template<typename _Allocator>
- explicit operator std::basic_string<_CharT, _Traits, _Allocator>() const
- {
- return { this->_M_str, this->_M_len };
- }
-
- size_type
- copy(_CharT* __str, size_type __n, size_type __pos = 0) const
- {
- gdb_assert (__str != nullptr || __n == 0);
- if (__pos > this->_M_len)
- error (_("basic_string_view::copy: __pos "
- "(which is %zu) > this->size() "
- "(which is %zu)"),
- __pos, this->size());
- size_type __rlen{std::min(__n, size_type{this->_M_len - __pos})};
- for (auto __begin = this->_M_str + __pos,
- __end = __begin + __rlen; __begin != __end;)
- *__str++ = *__begin++;
- return __rlen;
- }
-
-
- // [string.view.ops], string operations:
-
- /*constexpr*/ basic_string_view
- substr(size_type __pos, size_type __n=npos) const
- {
- return __pos <= this->_M_len
- ? basic_string_view{this->_M_str + __pos,
- std::min(__n, size_type{this->_M_len - __pos})}
- : (error (_("basic_string_view::substr: __pos "
- "(which is %zu) > this->size() "
- "(which is %zu)"),
- __pos, this->size()), basic_string_view{});
- }
-
- /*constexpr*/ int
- compare(basic_string_view __str) const noexcept
- {
- int __ret = traits_type::compare(this->_M_str, __str._M_str,
- std::min(this->_M_len, __str._M_len));
- if (__ret == 0)
- __ret = _S_compare(this->_M_len, __str._M_len);
- return __ret;
- }
-
- /*constexpr*/ int
- compare(size_type __pos1, size_type __n1, basic_string_view __str) const
- { return this->substr(__pos1, __n1).compare(__str); }
-
- /*constexpr*/ int
- compare(size_type __pos1, size_type __n1,
- basic_string_view __str, size_type __pos2, size_type __n2) const
- { return this->substr(__pos1, __n1).compare(__str.substr(__pos2, __n2)); }
-
- /*constexpr*/ int
- compare(const _CharT* __str) const noexcept
- { return this->compare(basic_string_view{__str}); }
-
- /*constexpr*/ int
- compare(size_type __pos1, size_type __n1, const _CharT* __str) const
- { return this->substr(__pos1, __n1).compare(basic_string_view{__str}); }
-
- /*constexpr*/ int
- compare(size_type __pos1, size_type __n1,
- const _CharT* __str, size_type __n2) const
- {
- return this->substr(__pos1, __n1)
- .compare(basic_string_view(__str, __n2));
- }
-
- /*constexpr*/ size_type
- find(basic_string_view __str, size_type __pos = 0) const noexcept
- { return this->find(__str._M_str, __pos, __str._M_len); }
-
- /*constexpr*/ size_type
- find(_CharT __c, size_type __pos=0) const noexcept;
-
- /*constexpr*/ size_type
- find(const _CharT* __str, size_type __pos, size_type __n) const noexcept;
-
- /*constexpr*/ size_type
- find(const _CharT* __str, size_type __pos=0) const noexcept
- { return this->find(__str, __pos, traits_type::length(__str)); }
-
- /*constexpr*/ size_type
- rfind(basic_string_view __str, size_type __pos = npos) const noexcept
- { return this->rfind(__str._M_str, __pos, __str._M_len); }
-
- /*constexpr*/ size_type
- rfind(_CharT __c, size_type __pos = npos) const noexcept;
-
- /*constexpr*/ size_type
- rfind(const _CharT* __str, size_type __pos, size_type __n) const noexcept;
-
- /*constexpr*/ size_type
- rfind(const _CharT* __str, size_type __pos = npos) const noexcept
- { return this->rfind(__str, __pos, traits_type::length(__str)); }
-
- /*constexpr*/ size_type
- find_first_of(basic_string_view __str, size_type __pos = 0) const noexcept
- { return this->find_first_of(__str._M_str, __pos, __str._M_len); }
-
- /*constexpr*/ size_type
- find_first_of(_CharT __c, size_type __pos = 0) const noexcept
- { return this->find(__c, __pos); }
-
- /*constexpr*/ size_type
- find_first_of(const _CharT* __str, size_type __pos, size_type __n) const;
-
- /*constexpr*/ size_type
- find_first_of(const _CharT* __str, size_type __pos = 0) const noexcept
- { return this->find_first_of(__str, __pos, traits_type::length(__str)); }
-
- /*constexpr*/ size_type
- find_last_of(basic_string_view __str,
- size_type __pos = npos) const noexcept
- { return this->find_last_of(__str._M_str, __pos, __str._M_len); }
-
- size_type
- find_last_of(_CharT __c, size_type __pos=npos) const noexcept
- { return this->rfind(__c, __pos); }
-
- /*constexpr*/ size_type
- find_last_of(const _CharT* __str, size_type __pos, size_type __n) const;
-
- /*constexpr*/ size_type
- find_last_of(const _CharT* __str, size_type __pos = npos) const noexcept
- { return this->find_last_of(__str, __pos, traits_type::length(__str)); }
-
- /*constexpr*/ size_type
- find_first_not_of(basic_string_view __str,
- size_type __pos = 0) const noexcept
- { return this->find_first_not_of(__str._M_str, __pos, __str._M_len); }
-
- /*constexpr*/ size_type
- find_first_not_of(_CharT __c, size_type __pos = 0) const noexcept;
-
- /*constexpr*/ size_type
- find_first_not_of(const _CharT* __str,
- size_type __pos, size_type __n) const;
-
- /*constexpr*/ size_type
- find_first_not_of(const _CharT* __str, size_type __pos = 0) const noexcept
- {
- return this->find_first_not_of(__str, __pos,
- traits_type::length(__str));
- }
-
- /*constexpr*/ size_type
- find_last_not_of(basic_string_view __str,
- size_type __pos = npos) const noexcept
- { return this->find_last_not_of(__str._M_str, __pos, __str._M_len); }
-
- /*constexpr*/ size_type
- find_last_not_of(_CharT __c, size_type __pos = npos) const noexcept;
-
- /*constexpr*/ size_type
- find_last_not_of(const _CharT* __str,
- size_type __pos, size_type __n) const;
-
- /*constexpr*/ size_type
- find_last_not_of(const _CharT* __str,
- size_type __pos = npos) const noexcept
- {
- return this->find_last_not_of(__str, __pos,
- traits_type::length(__str));
- }
-
- private:
-
- static constexpr int
- _S_compare(size_type __n1, size_type __n2) noexcept
- {
- return difference_type(__n1 - __n2) > std::numeric_limits<int>::max()
- ? std::numeric_limits<int>::max()
- : difference_type(__n1 - __n2) < std::numeric_limits<int>::min()
- ? std::numeric_limits<int>::min()
- : static_cast<int>(difference_type(__n1 - __n2));
- }
-
- size_t _M_len;
- const _CharT* _M_str;
- };
-
- // [string.view.comparison], non-member basic_string_view comparison functions
-
- namespace __detail
- {
- // Identity transform to create a non-deduced context, so that only one
- // argument participates in template argument deduction and the other
- // argument gets implicitly converted to the deduced type. See n3766.html.
- template<typename _Tp>
- using __idt = typename std::common_type<_Tp>::type;
- }
-
- template<typename _CharT, typename _Traits>
- /*constexpr*/ bool
- operator==(basic_string_view<_CharT, _Traits> __x,
- basic_string_view<_CharT, _Traits> __y) noexcept
- { return __x.size() == __y.size() && __x.compare(__y) == 0; }
-
- template<typename _CharT, typename _Traits>
- /*constexpr*/ bool
- operator==(basic_string_view<_CharT, _Traits> __x,
- __detail::__idt<basic_string_view<_CharT, _Traits>> __y) noexcept
- { return __x.size() == __y.size() && __x.compare(__y) == 0; }
-
- template<typename _CharT, typename _Traits>
- /*constexpr*/ bool
- operator==(__detail::__idt<basic_string_view<_CharT, _Traits>> __x,
- basic_string_view<_CharT, _Traits> __y) noexcept
- { return __x.size() == __y.size() && __x.compare(__y) == 0; }
-
- template<typename _CharT, typename _Traits>
- /*constexpr*/ bool
- operator!=(basic_string_view<_CharT, _Traits> __x,
- basic_string_view<_CharT, _Traits> __y) noexcept
- { return !(__x == __y); }
-
- template<typename _CharT, typename _Traits>
- /*constexpr*/ bool
- operator!=(basic_string_view<_CharT, _Traits> __x,
- __detail::__idt<basic_string_view<_CharT, _Traits>> __y) noexcept
- { return !(__x == __y); }
-
- template<typename _CharT, typename _Traits>
- /*constexpr*/ bool
- operator!=(__detail::__idt<basic_string_view<_CharT, _Traits>> __x,
- basic_string_view<_CharT, _Traits> __y) noexcept
- { return !(__x == __y); }
-
- template<typename _CharT, typename _Traits>
- /*constexpr*/ bool
- operator< (basic_string_view<_CharT, _Traits> __x,
- basic_string_view<_CharT, _Traits> __y) noexcept
- { return __x.compare(__y) < 0; }
-
- template<typename _CharT, typename _Traits>
- /*constexpr*/ bool
- operator< (basic_string_view<_CharT, _Traits> __x,
- __detail::__idt<basic_string_view<_CharT, _Traits>> __y) noexcept
- { return __x.compare(__y) < 0; }
-
- template<typename _CharT, typename _Traits>
- /*constexpr*/ bool
- operator< (__detail::__idt<basic_string_view<_CharT, _Traits>> __x,
- basic_string_view<_CharT, _Traits> __y) noexcept
- { return __x.compare(__y) < 0; }
-
- template<typename _CharT, typename _Traits>
- /*constexpr*/ bool
- operator> (basic_string_view<_CharT, _Traits> __x,
- basic_string_view<_CharT, _Traits> __y) noexcept
- { return __x.compare(__y) > 0; }
-
- template<typename _CharT, typename _Traits>
- /*constexpr*/ bool
- operator> (basic_string_view<_CharT, _Traits> __x,
- __detail::__idt<basic_string_view<_CharT, _Traits>> __y) noexcept
- { return __x.compare(__y) > 0; }
-
- template<typename _CharT, typename _Traits>
- /*constexpr*/ bool
- operator> (__detail::__idt<basic_string_view<_CharT, _Traits>> __x,
- basic_string_view<_CharT, _Traits> __y) noexcept
- { return __x.compare(__y) > 0; }
-
- template<typename _CharT, typename _Traits>
- /*constexpr*/ bool
- operator<=(basic_string_view<_CharT, _Traits> __x,
- basic_string_view<_CharT, _Traits> __y) noexcept
- { return __x.compare(__y) <= 0; }
-
- template<typename _CharT, typename _Traits>
- /*constexpr*/ bool
- operator<=(basic_string_view<_CharT, _Traits> __x,
- __detail::__idt<basic_string_view<_CharT, _Traits>> __y) noexcept
- { return __x.compare(__y) <= 0; }
-
- template<typename _CharT, typename _Traits>
- /*constexpr*/ bool
- operator<=(__detail::__idt<basic_string_view<_CharT, _Traits>> __x,
- basic_string_view<_CharT, _Traits> __y) noexcept
- { return __x.compare(__y) <= 0; }
-
- template<typename _CharT, typename _Traits>
- /*constexpr*/ bool
- operator>=(basic_string_view<_CharT, _Traits> __x,
- basic_string_view<_CharT, _Traits> __y) noexcept
- { return __x.compare(__y) >= 0; }
-
- template<typename _CharT, typename _Traits>
- /*constexpr*/ bool
- operator>=(basic_string_view<_CharT, _Traits> __x,
- __detail::__idt<basic_string_view<_CharT, _Traits>> __y) noexcept
- { return __x.compare(__y) >= 0; }
-
- template<typename _CharT, typename _Traits>
- /*constexpr*/ bool
- operator>=(__detail::__idt<basic_string_view<_CharT, _Traits>> __x,
- basic_string_view<_CharT, _Traits> __y) noexcept
- { return __x.compare(__y) >= 0; }
-
- // basic_string_view typedef names
-
- using string_view = basic_string_view<char>;
+template<typename _CharT, typename _Traits = std::char_traits<_CharT>>
+class basic_string_view
+{
+public:
+ // types
+ using traits_type = _Traits;
+ using value_type = _CharT;
+ using pointer = const _CharT *;
+ using const_pointer = const _CharT *;
+ using reference = const _CharT &;
+ using const_reference = const _CharT &;
+ using const_iterator = const _CharT *;
+ using iterator = const_iterator;
+ using const_reverse_iterator = std::reverse_iterator<const_iterator>;
+ using reverse_iterator = const_reverse_iterator;
+ using size_type = size_t;
+ using difference_type = ptrdiff_t;
+ static constexpr size_type npos = size_type (-1);
+
+ // [string.view.cons], construct/copy
+
+ constexpr basic_string_view () noexcept : _M_len { 0 }, _M_str { nullptr } {}
+
+ constexpr basic_string_view (const basic_string_view &) noexcept = default;
+
+ template<typename _Allocator>
+ basic_string_view (
+ const std::basic_string<_CharT, _Traits, _Allocator> &__str) noexcept
+ : _M_len { __str.length () },
+ _M_str { __str.data () }
+ {
+ }
+
+ /*constexpr*/ basic_string_view (const _CharT *__str)
+ : _M_len { __str == nullptr ? 0 : traits_type::length (__str) },
+ _M_str { __str }
+ {
+ }
+
+ constexpr basic_string_view (const _CharT *__str, size_type __len)
+ : _M_len { __len },
+ _M_str { __str }
+ {
+ }
+
+ basic_string_view &operator= (const basic_string_view &) noexcept = default;
+
+ // [string.view.iterators], iterators
+
+ constexpr const_iterator begin () const noexcept { return this->_M_str; }
+
+ constexpr const_iterator end () const noexcept
+ {
+ return this->_M_str + this->_M_len;
+ }
+
+ constexpr const_iterator cbegin () const noexcept { return this->_M_str; }
+
+ constexpr const_iterator cend () const noexcept
+ {
+ return this->_M_str + this->_M_len;
+ }
+
+ const_reverse_iterator rbegin () const noexcept
+ {
+ return const_reverse_iterator (this->end ());
+ }
+
+ const_reverse_iterator rend () const noexcept
+ {
+ return const_reverse_iterator (this->begin ());
+ }
+
+ const_reverse_iterator crbegin () const noexcept
+ {
+ return const_reverse_iterator (this->end ());
+ }
+
+ const_reverse_iterator crend () const noexcept
+ {
+ return const_reverse_iterator (this->begin ());
+ }
+
+ // [string.view.capacity], capacity
+
+ constexpr size_type size () const noexcept { return this->_M_len; }
+
+ constexpr size_type length () const noexcept { return _M_len; }
+
+ constexpr size_type max_size () const noexcept
+ {
+ return (npos - sizeof (size_type) - sizeof (void *)) / sizeof (value_type)
+ / 4;
+ }
+
+ constexpr bool empty () const noexcept { return this->_M_len == 0; }
+
+ // [string.view.access], element access
+
+ constexpr const _CharT &operator[] (size_type __pos) const
+ {
+ // TODO: Assert to restore in a way compatible with the constexpr.
+ // __glibcxx_assert(__pos < this->_M_len);
+ return *(this->_M_str + __pos);
+ }
+
+ constexpr const _CharT &at (size_type __pos) const
+ {
+ return __pos < this->_M_len ? *(this->_M_str + __pos)
+ : (error (_ ("basic_string_view::at: __pos "
+ "(which is %zu) >= this->size() "
+ "(which is %zu)"),
+ __pos, this->size ()),
+ *this->_M_str);
+ }
+
+ constexpr const _CharT &front () const
+ {
+ // TODO: Assert to restore in a way compatible with the constexpr.
+ // __glibcxx_assert(this->_M_len > 0);
+ return *this->_M_str;
+ }
+
+ constexpr const _CharT &back () const
+ {
+ // TODO: Assert to restore in a way compatible with the constexpr.
+ // __glibcxx_assert(this->_M_len > 0);
+ return *(this->_M_str + this->_M_len - 1);
+ }
+
+ constexpr const _CharT *data () const noexcept { return this->_M_str; }
+
+ // [string.view.modifiers], modifiers:
+
+ /*constexpr*/ void remove_prefix (size_type __n)
+ {
+ gdb_assert (this->_M_len >= __n);
+ this->_M_str += __n;
+ this->_M_len -= __n;
+ }
+
+ /*constexpr*/ void remove_suffix (size_type __n) { this->_M_len -= __n; }
+
+ /*constexpr*/ void swap (basic_string_view &__sv) noexcept
+ {
+ auto __tmp = *this;
+ *this = __sv;
+ __sv = __tmp;
+ }
+
+ // [string.view.ops], string operations:
+
+ template<typename _Allocator>
+ explicit operator std::basic_string<_CharT, _Traits, _Allocator> () const
+ {
+ return { this->_M_str, this->_M_len };
+ }
+
+ size_type copy (_CharT *__str, size_type __n, size_type __pos = 0) const
+ {
+ gdb_assert (__str != nullptr || __n == 0);
+ if (__pos > this->_M_len)
+ error (_ ("basic_string_view::copy: __pos "
+ "(which is %zu) > this->size() "
+ "(which is %zu)"),
+ __pos, this->size ());
+ size_type __rlen { std::min (__n, size_type { this->_M_len - __pos }) };
+ for (auto __begin = this->_M_str + __pos, __end = __begin + __rlen;
+ __begin != __end;)
+ *__str++ = *__begin++;
+ return __rlen;
+ }
+
+ // [string.view.ops], string operations:
+
+ /*constexpr*/ basic_string_view substr (size_type __pos,
+ size_type __n = npos) const
+ {
+ return __pos <= this->_M_len
+ ? basic_string_view { this->_M_str + __pos,
+ std::min (__n, size_type { this->_M_len
+ - __pos }) }
+ : (error (_ ("basic_string_view::substr: __pos "
+ "(which is %zu) > this->size() "
+ "(which is %zu)"),
+ __pos, this->size ()),
+ basic_string_view {});
+ }
+
+ /*constexpr*/ int compare (basic_string_view __str) const noexcept
+ {
+ int __ret = traits_type::compare (this->_M_str, __str._M_str,
+ std::min (this->_M_len, __str._M_len));
+ if (__ret == 0)
+ __ret = _S_compare (this->_M_len, __str._M_len);
+ return __ret;
+ }
+
+ /*constexpr*/ int compare (size_type __pos1, size_type __n1,
+ basic_string_view __str) const
+ {
+ return this->substr (__pos1, __n1).compare (__str);
+ }
+
+ /*constexpr*/ int compare (size_type __pos1, size_type __n1,
+ basic_string_view __str, size_type __pos2,
+ size_type __n2) const
+ {
+ return this->substr (__pos1, __n1).compare (__str.substr (__pos2, __n2));
+ }
+
+ /*constexpr*/ int compare (const _CharT *__str) const noexcept
+ {
+ return this->compare (basic_string_view { __str });
+ }
+
+ /*constexpr*/ int compare (size_type __pos1, size_type __n1,
+ const _CharT *__str) const
+ {
+ return this->substr (__pos1, __n1).compare (basic_string_view { __str });
+ }
+
+ /*constexpr*/ int compare (size_type __pos1, size_type __n1,
+ const _CharT *__str, size_type __n2) const
+ {
+ return this->substr (__pos1, __n1)
+ .compare (basic_string_view (__str, __n2));
+ }
+
+ /*constexpr*/ size_type find (basic_string_view __str,
+ size_type __pos = 0) const noexcept
+ {
+ return this->find (__str._M_str, __pos, __str._M_len);
+ }
+
+ /*constexpr*/ size_type find (_CharT __c,
+ size_type __pos = 0) const noexcept;
+
+ /*constexpr*/ size_type find (const _CharT *__str, size_type __pos,
+ size_type __n) const noexcept;
+
+ /*constexpr*/ size_type find (const _CharT *__str,
+ size_type __pos = 0) const noexcept
+ {
+ return this->find (__str, __pos, traits_type::length (__str));
+ }
+
+ /*constexpr*/ size_type rfind (basic_string_view __str,
+ size_type __pos = npos) const noexcept
+ {
+ return this->rfind (__str._M_str, __pos, __str._M_len);
+ }
+
+ /*constexpr*/ size_type rfind (_CharT __c,
+ size_type __pos = npos) const noexcept;
+
+ /*constexpr*/ size_type rfind (const _CharT *__str, size_type __pos,
+ size_type __n) const noexcept;
+
+ /*constexpr*/ size_type rfind (const _CharT *__str,
+ size_type __pos = npos) const noexcept
+ {
+ return this->rfind (__str, __pos, traits_type::length (__str));
+ }
+
+ /*constexpr*/ size_type find_first_of (basic_string_view __str,
+ size_type __pos = 0) const noexcept
+ {
+ return this->find_first_of (__str._M_str, __pos, __str._M_len);
+ }
+
+ /*constexpr*/ size_type find_first_of (_CharT __c,
+ size_type __pos = 0) const noexcept
+ {
+ return this->find (__c, __pos);
+ }
+
+ /*constexpr*/ size_type find_first_of (const _CharT *__str, size_type __pos,
+ size_type __n) const;
+
+ /*constexpr*/ size_type find_first_of (const _CharT *__str,
+ size_type __pos = 0) const noexcept
+ {
+ return this->find_first_of (__str, __pos, traits_type::length (__str));
+ }
+
+ /*constexpr*/ size_type find_last_of (basic_string_view __str,
+ size_type __pos = npos) const noexcept
+ {
+ return this->find_last_of (__str._M_str, __pos, __str._M_len);
+ }
+
+ size_type find_last_of (_CharT __c, size_type __pos = npos) const noexcept
+ {
+ return this->rfind (__c, __pos);
+ }
+
+ /*constexpr*/ size_type find_last_of (const _CharT *__str, size_type __pos,
+ size_type __n) const;
+
+ /*constexpr*/ size_type find_last_of (const _CharT *__str,
+ size_type __pos = npos) const noexcept
+ {
+ return this->find_last_of (__str, __pos, traits_type::length (__str));
+ }
+
+ /*constexpr*/ size_type find_first_not_of (basic_string_view __str,
+ size_type __pos
+ = 0) const noexcept
+ {
+ return this->find_first_not_of (__str._M_str, __pos, __str._M_len);
+ }
+
+ /*constexpr*/ size_type find_first_not_of (_CharT __c, size_type __pos
+ = 0) const noexcept;
+
+ /*constexpr*/ size_type find_first_not_of (const _CharT *__str,
+ size_type __pos,
+ size_type __n) const;
+
+ /*constexpr*/ size_type
+ find_first_not_of (const _CharT *__str, size_type __pos = 0) const noexcept
+ {
+ return this->find_first_not_of (__str, __pos, traits_type::length (__str));
+ }
+
+ /*constexpr*/ size_type find_last_not_of (basic_string_view __str,
+ size_type __pos
+ = npos) const noexcept
+ {
+ return this->find_last_not_of (__str._M_str, __pos, __str._M_len);
+ }
+
+ /*constexpr*/ size_type find_last_not_of (_CharT __c, size_type __pos
+ = npos) const noexcept;
+
+ /*constexpr*/ size_type
+ find_last_not_of (const _CharT *__str, size_type __pos, size_type __n) const;
+
+ /*constexpr*/ size_type
+ find_last_not_of (const _CharT *__str, size_type __pos = npos) const noexcept
+ {
+ return this->find_last_not_of (__str, __pos, traits_type::length (__str));
+ }
+
+private:
+ static constexpr int _S_compare (size_type __n1, size_type __n2) noexcept
+ {
+ return difference_type (__n1 - __n2) > std::numeric_limits<int>::max ()
+ ? std::numeric_limits<int>::max ()
+ : difference_type (__n1 - __n2) < std::numeric_limits<int>::min ()
+ ? std::numeric_limits<int>::min ()
+ : static_cast<int> (difference_type (__n1 - __n2));
+ }
+
+ size_t _M_len;
+ const _CharT *_M_str;
+};
+
+// [string.view.comparison], non-member basic_string_view comparison functions
+
+namespace __detail
+{
+// Identity transform to create a non-deduced context, so that only one
+// argument participates in template argument deduction and the other
+// argument gets implicitly converted to the deduced type. See n3766.html.
+template<typename _Tp>
+using __idt = typename std::common_type<_Tp>::type;
+} // namespace __detail
+
+template<typename _CharT, typename _Traits>
+/*constexpr*/ bool
+operator== (basic_string_view<_CharT, _Traits> __x,
+ basic_string_view<_CharT, _Traits> __y) noexcept
+{
+ return __x.size () == __y.size () && __x.compare (__y) == 0;
+}
+
+template<typename _CharT, typename _Traits>
+/*constexpr*/ bool
+operator== (basic_string_view<_CharT, _Traits> __x,
+ __detail::__idt<basic_string_view<_CharT, _Traits>> __y) noexcept
+{
+ return __x.size () == __y.size () && __x.compare (__y) == 0;
+}
+
+template<typename _CharT, typename _Traits>
+/*constexpr*/ bool
+operator== (__detail::__idt<basic_string_view<_CharT, _Traits>> __x,
+ basic_string_view<_CharT, _Traits> __y) noexcept
+{
+ return __x.size () == __y.size () && __x.compare (__y) == 0;
+}
+
+template<typename _CharT, typename _Traits>
+/*constexpr*/ bool
+operator!= (basic_string_view<_CharT, _Traits> __x,
+ basic_string_view<_CharT, _Traits> __y) noexcept
+{
+ return !(__x == __y);
+}
+
+template<typename _CharT, typename _Traits>
+/*constexpr*/ bool
+operator!= (basic_string_view<_CharT, _Traits> __x,
+ __detail::__idt<basic_string_view<_CharT, _Traits>> __y) noexcept
+{
+ return !(__x == __y);
+}
+
+template<typename _CharT, typename _Traits>
+/*constexpr*/ bool
+operator!= (__detail::__idt<basic_string_view<_CharT, _Traits>> __x,
+ basic_string_view<_CharT, _Traits> __y) noexcept
+{
+ return !(__x == __y);
+}
+
+template<typename _CharT, typename _Traits>
+/*constexpr*/ bool
+operator<(basic_string_view<_CharT, _Traits> __x,
+ basic_string_view<_CharT, _Traits> __y) noexcept
+{
+ return __x.compare (__y) < 0;
+}
+
+template<typename _CharT, typename _Traits>
+/*constexpr*/ bool
+operator<(basic_string_view<_CharT, _Traits> __x,
+ __detail::__idt<basic_string_view<_CharT, _Traits>> __y) noexcept
+{
+ return __x.compare (__y) < 0;
+}
+
+template<typename _CharT, typename _Traits>
+/*constexpr*/ bool
+operator<(__detail::__idt<basic_string_view<_CharT, _Traits>> __x,
+ basic_string_view<_CharT, _Traits> __y) noexcept
+{
+ return __x.compare (__y) < 0;
+}
+
+template<typename _CharT, typename _Traits>
+/*constexpr*/ bool
+operator> (basic_string_view<_CharT, _Traits> __x,
+ basic_string_view<_CharT, _Traits> __y) noexcept
+{
+ return __x.compare (__y) > 0;
+}
+
+template<typename _CharT, typename _Traits>
+/*constexpr*/ bool
+operator> (basic_string_view<_CharT, _Traits> __x,
+ __detail::__idt<basic_string_view<_CharT, _Traits>> __y) noexcept
+{
+ return __x.compare (__y) > 0;
+}
+
+template<typename _CharT, typename _Traits>
+/*constexpr*/ bool
+operator> (__detail::__idt<basic_string_view<_CharT, _Traits>> __x,
+ basic_string_view<_CharT, _Traits> __y) noexcept
+{
+ return __x.compare (__y) > 0;
+}
+
+template<typename _CharT, typename _Traits>
+/*constexpr*/ bool
+operator<= (basic_string_view<_CharT, _Traits> __x,
+ basic_string_view<_CharT, _Traits> __y) noexcept
+{
+ return __x.compare (__y) <= 0;
+}
+
+template<typename _CharT, typename _Traits>
+/*constexpr*/ bool
+operator<= (basic_string_view<_CharT, _Traits> __x,
+ __detail::__idt<basic_string_view<_CharT, _Traits>> __y) noexcept
+{
+ return __x.compare (__y) <= 0;
+}
+
+template<typename _CharT, typename _Traits>
+/*constexpr*/ bool
+operator<= (__detail::__idt<basic_string_view<_CharT, _Traits>> __x,
+ basic_string_view<_CharT, _Traits> __y) noexcept
+{
+ return __x.compare (__y) <= 0;
+}
+
+template<typename _CharT, typename _Traits>
+/*constexpr*/ bool
+operator>= (basic_string_view<_CharT, _Traits> __x,
+ basic_string_view<_CharT, _Traits> __y) noexcept
+{
+ return __x.compare (__y) >= 0;
+}
+
+template<typename _CharT, typename _Traits>
+/*constexpr*/ bool
+operator>= (basic_string_view<_CharT, _Traits> __x,
+ __detail::__idt<basic_string_view<_CharT, _Traits>> __y) noexcept
+{
+ return __x.compare (__y) >= 0;
+}
+
+template<typename _CharT, typename _Traits>
+/*constexpr*/ bool
+operator>= (__detail::__idt<basic_string_view<_CharT, _Traits>> __x,
+ basic_string_view<_CharT, _Traits> __y) noexcept
+{
+ return __x.compare (__y) >= 0;
+}
+
+// basic_string_view typedef names
+
+using string_view = basic_string_view<char>;
} /* namespace gdb */
#include "gdb_string_view.tcc"
#endif // __cplusplus < 201703L
-namespace gdb {
+namespace gdb
+{
static inline std::string
-to_string(const gdb::string_view &view)
+to_string (const gdb::string_view &view)
{
return { view.data (), view.size () };
}
-}
+} // namespace gdb
#endif /* COMMON_GDB_STRING_VIEW_H */
diff --git a/gdbsupport/gdb_sys_time.h b/gdbsupport/gdb_sys_time.h
index 6ea1ae769a4..4451845dd64 100644
--- a/gdbsupport/gdb_sys_time.h
+++ b/gdbsupport/gdb_sys_time.h
@@ -31,8 +31,8 @@
native 'select' and libiberty, simply undefine away gnulib's
replacements. */
#if GNULIB_defined_struct_timeval
-# undef timeval
-# undef gettimeofday
+#undef timeval
+#undef gettimeofday
#endif
#endif /* COMMON_GDB_SYS_TIME_H */
diff --git a/gdbsupport/gdb_tilde_expand.cc b/gdbsupport/gdb_tilde_expand.cc
index d6bdb876d5c..b8814a9cfc5 100644
--- a/gdbsupport/gdb_tilde_expand.cc
+++ b/gdbsupport/gdb_tilde_expand.cc
@@ -31,37 +31,27 @@ public:
/* Construct a "gdb_glob" object by calling "glob" with the provided
parameters. This function can throw if "glob" fails. */
gdb_glob (const char *pattern, int flags,
- int (*errfunc) (const char *epath, int eerrno))
+ int (*errfunc) (const char *epath, int eerrno))
{
int ret = glob (pattern, flags, errfunc, &m_glob);
if (ret != 0)
{
- if (ret == GLOB_NOMATCH)
- error (_("Could not find a match for '%s'."), pattern);
- else
- error (_("glob could not process pattern '%s'."),
- pattern);
+ if (ret == GLOB_NOMATCH)
+ error (_ ("Could not find a match for '%s'."), pattern);
+ else
+ error (_ ("glob could not process pattern '%s'."), pattern);
}
}
/* Destroy the object and free M_GLOB. */
- ~gdb_glob ()
- {
- globfree (&m_glob);
- }
+ ~gdb_glob () { globfree (&m_glob); }
/* Return the GL_PATHC component of M_GLOB. */
- int pathc () const
- {
- return m_glob.gl_pathc;
- }
+ int pathc () const { return m_glob.gl_pathc; }
/* Return the GL_PATHV component of M_GLOB. */
- char **pathv () const
- {
- return m_glob.gl_pathv;
- }
+ char **pathv () const { return m_glob.gl_pathv; }
private:
/* The actual glob object we're dealing with. */
@@ -89,11 +79,9 @@ gdb_tilde_expand (const char *dir)
/* Look for the first dir separator (if any) and split d around it. */
const auto first_sep
- = std::find_if (d.cbegin (), d.cend(),
- [] (const char c) -> bool
- {
- return IS_DIR_SEPARATOR (c);
- });
+ = std::find_if (d.cbegin (), d.cend (), [] (const char c) -> bool {
+ return IS_DIR_SEPARATOR (c);
+ });
const std::string to_expand (d.cbegin (), first_sep);
const std::string remainder (first_sep, d.cend ());
diff --git a/gdbsupport/gdb_unique_ptr.h b/gdbsupport/gdb_unique_ptr.h
index a3ab62405d4..30819151a85 100644
--- a/gdbsupport/gdb_unique_ptr.h
+++ b/gdbsupport/gdb_unique_ptr.h
@@ -30,14 +30,14 @@ namespace gdb
xmalloc'ed memory. */
/* The deleter for std::unique_xmalloc_ptr. Uses xfree. */
-template <typename T>
+template<typename T>
struct xfree_deleter
{
void operator() (T *ptr) const { xfree (ptr); }
};
/* Same, for arrays. */
-template <typename T>
+template<typename T>
struct xfree_deleter<T[]>
{
void operator() (T *ptr) const { xfree (ptr); }
@@ -46,14 +46,14 @@ struct xfree_deleter<T[]>
/* Import the standard unique_ptr to our namespace with a custom
deleter. */
-template<typename T> using unique_xmalloc_ptr
- = std::unique_ptr<T, xfree_deleter<T>>;
+template<typename T>
+using unique_xmalloc_ptr = std::unique_ptr<T, xfree_deleter<T>>;
/* A no-op deleter. */
template<typename T>
struct noop_deleter
{
- void operator() (T *ptr) const { }
+ void operator() (T *ptr) const {}
};
} /* namespace gdb */
diff --git a/gdbsupport/gdb_unlinker.h b/gdbsupport/gdb_unlinker.h
index 689d9bcf18a..00b3a7d1b3c 100644
--- a/gdbsupport/gdb_unlinker.h
+++ b/gdbsupport/gdb_unlinker.h
@@ -30,10 +30,8 @@ namespace gdb
the "keep" method. */
class unlinker
{
- public:
-
- unlinker (const char *filename) ATTRIBUTE_NONNULL (2)
- : m_filename (filename)
+public:
+ unlinker (const char *filename) ATTRIBUTE_NONNULL (2) : m_filename (filename)
{
gdb_assert (filename != NULL);
}
@@ -45,16 +43,12 @@ class unlinker
}
/* Keep the file, rather than unlink it. */
- void keep ()
- {
- m_filename = NULL;
- }
-
- private:
+ void keep () { m_filename = NULL; }
+private:
const char *m_filename;
};
-}
+} // namespace gdb
#endif /* COMMON_GDB_UNLINKER_H */
diff --git a/gdbsupport/gdb_vecs.cc b/gdbsupport/gdb_vecs.cc
index 303d00363ca..bf2d5529122 100644
--- a/gdbsupport/gdb_vecs.cc
+++ b/gdbsupport/gdb_vecs.cc
@@ -25,9 +25,9 @@
STR into a char pointer vector. */
static void
-delim_string_to_char_ptr_vec_append
- (std::vector<gdb::unique_xmalloc_ptr<char>> *vecp, const char *str,
- char delimiter)
+delim_string_to_char_ptr_vec_append (
+ std::vector<gdb::unique_xmalloc_ptr<char>> *vecp, const char *str,
+ char delimiter)
{
do
{
@@ -37,12 +37,12 @@ delim_string_to_char_ptr_vec_append
next_field = strchr (str, delimiter);
if (next_field == NULL)
- this_len = strlen (str);
+ this_len = strlen (str);
else
- {
- this_len = next_field - str;
- next_field++;
- }
+ {
+ this_len = next_field - str;
+ next_field++;
+ }
this_field = (char *) xmalloc (this_len + 1);
memcpy (this_field, str, this_len);
@@ -60,7 +60,7 @@ std::vector<gdb::unique_xmalloc_ptr<char>>
delim_string_to_char_ptr_vec (const char *str, char delimiter)
{
std::vector<gdb::unique_xmalloc_ptr<char>> retval;
-
+
delim_string_to_char_ptr_vec_append (&retval, str, delimiter);
return retval;
@@ -69,8 +69,8 @@ delim_string_to_char_ptr_vec (const char *str, char delimiter)
/* See gdb_vecs.h. */
void
-dirnames_to_char_ptr_vec_append
- (std::vector<gdb::unique_xmalloc_ptr<char>> *vecp, const char *dirnames)
+dirnames_to_char_ptr_vec_append (
+ std::vector<gdb::unique_xmalloc_ptr<char>> *vecp, const char *dirnames)
{
delim_string_to_char_ptr_vec_append (vecp, dirnames, DIRNAME_SEPARATOR);
}
@@ -81,7 +81,7 @@ std::vector<gdb::unique_xmalloc_ptr<char>>
dirnames_to_char_ptr_vec (const char *dirnames)
{
std::vector<gdb::unique_xmalloc_ptr<char>> retval;
-
+
dirnames_to_char_ptr_vec_append (&retval, dirnames);
return retval;
diff --git a/gdbsupport/gdb_vecs.h b/gdbsupport/gdb_vecs.h
index 1f1b69b822b..959faf7f4da 100644
--- a/gdbsupport/gdb_vecs.h
+++ b/gdbsupport/gdb_vecs.h
@@ -25,12 +25,12 @@
You may modify the returned strings. */
extern std::vector<gdb::unique_xmalloc_ptr<char>>
- delim_string_to_char_ptr_vec (const char *str, char delimiter);
+delim_string_to_char_ptr_vec (const char *str, char delimiter);
/* Like dirnames_to_char_ptr_vec, but append the directories to *VECP. */
-extern void dirnames_to_char_ptr_vec_append
- (std::vector<gdb::unique_xmalloc_ptr<char>> *vecp, const char *dirnames);
+extern void dirnames_to_char_ptr_vec_append (
+ std::vector<gdb::unique_xmalloc_ptr<char>> *vecp, const char *dirnames);
/* Split DIRNAMES by DIRNAME_SEPARATOR delimiter and return a list of all the
elements in their original order. For empty string ("") DIRNAMES return
@@ -39,12 +39,12 @@ extern void dirnames_to_char_ptr_vec_append
You may modify the returned strings. */
extern std::vector<gdb::unique_xmalloc_ptr<char>>
- dirnames_to_char_ptr_vec (const char *dirnames);
+dirnames_to_char_ptr_vec (const char *dirnames);
/* Remove the element pointed by iterator IT from VEC, not preserving the order
of the remaining elements. Return the removed element. */
-template <typename T>
+template<typename T>
T
unordered_remove (std::vector<T> &vec, typename std::vector<T>::iterator it)
{
@@ -61,7 +61,7 @@ unordered_remove (std::vector<T> &vec, typename std::vector<T>::iterator it)
/* Remove the element at position IX from VEC, not preserving the order of the
remaining elements. Return the removed element. */
-template <typename T>
+template<typename T>
T
unordered_remove (std::vector<T> &vec, typename std::vector<T>::size_type ix)
{
@@ -73,7 +73,7 @@ unordered_remove (std::vector<T> &vec, typename std::vector<T>::size_type ix)
/* Remove the element at position IX from VEC, preserving the order the
remaining elements. Return the removed element. */
-template <typename T>
+template<typename T>
T
ordered_remove (std::vector<T> &vec, typename std::vector<T>::size_type ix)
{
diff --git a/gdbsupport/gdb_wait.cc b/gdbsupport/gdb_wait.cc
index c7a91ded80d..eda9e4ce5af 100644
--- a/gdbsupport/gdb_wait.cc
+++ b/gdbsupport/gdb_wait.cc
@@ -36,10 +36,10 @@
false positives is justified by the utility of reporting the
terminating signal in the "normal" cases. */
-# include <signal.h>
+#include <signal.h>
-# define WIN32_LEAN_AND_MEAN
-# include <windows.h> /* for EXCEPTION_* constants */
+#define WIN32_LEAN_AND_MEAN
+#include <windows.h> /* for EXCEPTION_* constants */
struct xlate_status
{
@@ -53,27 +53,25 @@ struct xlate_status
int
windows_status_to_termsig (unsigned long status)
{
- static const xlate_status status_xlate_tbl[] =
- {
- {EXCEPTION_ACCESS_VIOLATION, SIGSEGV},
- {EXCEPTION_IN_PAGE_ERROR, SIGSEGV},
- {EXCEPTION_INVALID_HANDLE, SIGSEGV},
- {EXCEPTION_ILLEGAL_INSTRUCTION, SIGILL},
- {EXCEPTION_NONCONTINUABLE_EXCEPTION, SIGILL},
- {EXCEPTION_ARRAY_BOUNDS_EXCEEDED, SIGSEGV},
- {EXCEPTION_FLT_DENORMAL_OPERAND, SIGFPE},
- {EXCEPTION_FLT_DIVIDE_BY_ZERO, SIGFPE},
- {EXCEPTION_FLT_INEXACT_RESULT, SIGFPE},
- {EXCEPTION_FLT_INVALID_OPERATION, SIGFPE},
- {EXCEPTION_FLT_OVERFLOW, SIGFPE},
- {EXCEPTION_FLT_STACK_CHECK, SIGFPE},
- {EXCEPTION_FLT_UNDERFLOW, SIGFPE},
- {EXCEPTION_INT_DIVIDE_BY_ZERO, SIGFPE},
- {EXCEPTION_INT_OVERFLOW, SIGFPE},
- {EXCEPTION_PRIV_INSTRUCTION, SIGILL},
- {EXCEPTION_STACK_OVERFLOW, SIGSEGV},
- {CONTROL_C_EXIT, SIGTERM}
- };
+ static const xlate_status status_xlate_tbl[]
+ = { { EXCEPTION_ACCESS_VIOLATION, SIGSEGV },
+ { EXCEPTION_IN_PAGE_ERROR, SIGSEGV },
+ { EXCEPTION_INVALID_HANDLE, SIGSEGV },
+ { EXCEPTION_ILLEGAL_INSTRUCTION, SIGILL },
+ { EXCEPTION_NONCONTINUABLE_EXCEPTION, SIGILL },
+ { EXCEPTION_ARRAY_BOUNDS_EXCEEDED, SIGSEGV },
+ { EXCEPTION_FLT_DENORMAL_OPERAND, SIGFPE },
+ { EXCEPTION_FLT_DIVIDE_BY_ZERO, SIGFPE },
+ { EXCEPTION_FLT_INEXACT_RESULT, SIGFPE },
+ { EXCEPTION_FLT_INVALID_OPERATION, SIGFPE },
+ { EXCEPTION_FLT_OVERFLOW, SIGFPE },
+ { EXCEPTION_FLT_STACK_CHECK, SIGFPE },
+ { EXCEPTION_FLT_UNDERFLOW, SIGFPE },
+ { EXCEPTION_INT_DIVIDE_BY_ZERO, SIGFPE },
+ { EXCEPTION_INT_OVERFLOW, SIGFPE },
+ { EXCEPTION_PRIV_INSTRUCTION, SIGILL },
+ { EXCEPTION_STACK_OVERFLOW, SIGSEGV },
+ { CONTROL_C_EXIT, SIGTERM } };
for (const xlate_status &x : status_xlate_tbl)
if (x.status == status)
@@ -82,4 +80,4 @@ windows_status_to_termsig (unsigned long status)
return -1;
}
-#endif /* __MINGW32__ */
+#endif /* __MINGW32__ */
diff --git a/gdbsupport/gdb_wait.h b/gdbsupport/gdb_wait.h
index f8d44c98e1b..7dfbd9dfd25 100644
--- a/gdbsupport/gdb_wait.h
+++ b/gdbsupport/gdb_wait.h
@@ -45,23 +45,23 @@
exception, as defined by the various EXCEPTION_* symbols in the
Windows API headers. See also gdb_wait.c. */
-#ifndef WIFEXITED
-# ifdef __MINGW32__
-# define WIFEXITED(w) (((w) & 0xC0000000) == 0)
-# else
-# define WIFEXITED(w) (((w)&0377) == 0)
-# endif
+#ifndef WIFEXITED
+#ifdef __MINGW32__
+#define WIFEXITED(w) (((w) &0xC0000000) == 0)
+#else
+#define WIFEXITED(w) (((w) &0377) == 0)
+#endif
#endif
-#ifndef WIFSIGNALED
-# ifdef __MINGW32__
-# define WIFSIGNALED(w) (((w) & 0xC0000000) == 0xC0000000)
-# else
-# define WIFSIGNALED(w) (((w)&0377) != 0177 && ((w)&~0377) == 0)
-# endif
+#ifndef WIFSIGNALED
+#ifdef __MINGW32__
+#define WIFSIGNALED(w) (((w) &0xC0000000) == 0xC0000000)
+#else
+#define WIFSIGNALED(w) (((w) &0377) != 0177 && ((w) & ~0377) == 0)
+#endif
#endif
-#ifndef WIFSTOPPED
+#ifndef WIFSTOPPED
#ifdef IBM6000
/* Unfortunately, the above comment (about being compatible in all Unix
@@ -69,50 +69,50 @@
status words like 0x57c (sigtrap received after load), and gdb would
choke on it. */
-#define WIFSTOPPED(w) ((w)&0x40)
+#define WIFSTOPPED(w) ((w) &0x40)
#else
-#define WIFSTOPPED(w) (((w)&0377) == 0177)
+#define WIFSTOPPED(w) (((w) &0377) == 0177)
#endif
#endif
-#ifndef WEXITSTATUS
-# ifdef __MINGW32__
-# define WEXITSTATUS(w) ((w) & ~0xC0000000)
-# else
-# define WEXITSTATUS(w) (((w) >> 8) & 0377) /* same as WRETCODE */
-# endif
+#ifndef WEXITSTATUS
+#ifdef __MINGW32__
+#define WEXITSTATUS(w) ((w) & ~0xC0000000)
+#else
+#define WEXITSTATUS(w) (((w) >> 8) & 0377) /* same as WRETCODE */
+#endif
#endif
-#ifndef WTERMSIG
-# ifdef __MINGW32__
+#ifndef WTERMSIG
+#ifdef __MINGW32__
extern int windows_status_to_termsig (unsigned long);
-# define WTERMSIG(w) windows_status_to_termsig (w)
-# else
-# define WTERMSIG(w) ((w) & 0177)
-# endif
+#define WTERMSIG(w) windows_status_to_termsig (w)
+#else
+#define WTERMSIG(w) ((w) &0177)
+#endif
#endif
-#ifndef WSTOPSIG
-#define WSTOPSIG WEXITSTATUS
+#ifndef WSTOPSIG
+#define WSTOPSIG WEXITSTATUS
#endif
/* These are not defined in POSIX, but are used by our programs. */
-#ifndef WSETEXIT
-# ifdef W_EXITCODE
-#define WSETEXIT(w,status) ((w) = W_EXITCODE(status,0))
-# else
-#define WSETEXIT(w,status) ((w) = (0 | ((status) << 8)))
-# endif
+#ifndef WSETEXIT
+#ifdef W_EXITCODE
+#define WSETEXIT(w, status) ((w) = W_EXITCODE (status, 0))
+#else
+#define WSETEXIT(w, status) ((w) = (0 | ((status) << 8)))
+#endif
#endif
#ifndef W_STOPCODE
#define W_STOPCODE(sig) ((sig) << 8 | 0x7f)
#endif
-#ifndef WSETSTOP
-#define WSETSTOP(w,sig) ((w) = W_STOPCODE(sig))
+#ifndef WSETSTOP
+#define WSETSTOP(w, sig) ((w) = W_STOPCODE (sig))
#endif
/* For native GNU/Linux we may use waitpid and the __WCLONE option.
@@ -121,15 +121,15 @@ extern int windows_status_to_termsig (unsigned long);
/* Bits in the third argument to `waitpid'. */
#ifndef WNOHANG
-#define WNOHANG 1 /* Don't block waiting. */
+#define WNOHANG 1 /* Don't block waiting. */
#endif
#ifndef WUNTRACED
-#define WUNTRACED 2 /* Report status of stopped children. */
+#define WUNTRACED 2 /* Report status of stopped children. */
#endif
#ifndef __WCLONE
-#define __WCLONE 0x80000000 /* Wait for cloned process. */
+#define __WCLONE 0x80000000 /* Wait for cloned process. */
#endif
#endif /* COMMON_GDB_WAIT_H */
diff --git a/gdbsupport/hash_enum.h b/gdbsupport/hash_enum.h
index 4867c2d318a..d03a6838e88 100644
--- a/gdbsupport/hash_enum.h
+++ b/gdbsupport/hash_enum.h
@@ -24,7 +24,8 @@
http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#2148
*/
-namespace gdb {
+namespace gdb
+{
/* Helper struct for hashing enum types. */
template<typename T>
diff --git a/gdbsupport/host-defs.h b/gdbsupport/host-defs.h
index 8459386054d..32dbcab5674 100644
--- a/gdbsupport/host-defs.h
+++ b/gdbsupport/host-defs.h
@@ -25,7 +25,7 @@
/* * Number of bits in a char or unsigned char for the target machine.
Just like CHAR_BIT in <limits.h> but describes the target machine. */
-#if !defined (TARGET_CHAR_BIT)
+#if !defined(TARGET_CHAR_BIT)
#define TARGET_CHAR_BIT 8
#endif
@@ -34,20 +34,20 @@
the number of bits in a host char. If not, use the same size
as the target. */
-#if defined (CHAR_BIT)
+#if defined(CHAR_BIT)
#define HOST_CHAR_BIT CHAR_BIT
#else
#define HOST_CHAR_BIT TARGET_CHAR_BIT
#endif
#ifdef __MSDOS__
-# define CANT_FORK
-# define GLOBAL_CURDIR
-# define DIRNAME_SEPARATOR ';'
+#define CANT_FORK
+#define GLOBAL_CURDIR
+#define DIRNAME_SEPARATOR ';'
#endif
-#if !defined (__CYGWIN__) && defined (_WIN32)
-# define DIRNAME_SEPARATOR ';'
+#if !defined(__CYGWIN__) && defined(_WIN32)
+#define DIRNAME_SEPARATOR ';'
#endif
#ifndef DIRNAME_SEPARATOR
diff --git a/gdbsupport/intrusive_list.h b/gdbsupport/intrusive_list.h
index 5c95f7019a8..5bd814439fb 100644
--- a/gdbsupport/intrusive_list.h
+++ b/gdbsupport/intrusive_list.h
@@ -27,10 +27,7 @@ template<typename T>
class intrusive_list_node
{
public:
- bool is_linked () const
- {
- return next != INTRUSIVE_LIST_UNLINKED_VALUE;
- }
+ bool is_linked () const { return next != INTRUSIVE_LIST_UNLINKED_VALUE; }
private:
T *next = INTRUSIVE_LIST_UNLINKED_VALUE;
@@ -56,8 +53,7 @@ private:
template<typename T>
struct intrusive_base_node
{
- static intrusive_list_node<T> *as_node (T *elem)
- { return elem; }
+ static intrusive_list_node<T> *as_node (T *elem) { return elem; }
};
/* For element types that keep the node as member field. */
@@ -66,7 +62,9 @@ template<typename T, intrusive_list_node<T> T::*MemberNode>
struct intrusive_member_node
{
static intrusive_list_node<T> *as_node (T *elem)
- { return &(elem->*MemberNode); }
+ {
+ return &(elem->*MemberNode);
+ }
};
/* Common code for forward and reverse iterators. */
@@ -86,30 +84,27 @@ struct intrusive_list_base_iterator
using node_type = intrusive_list_node<T>;
/* Create an iterator pointing to ELEM. */
- explicit intrusive_list_base_iterator (T *elem)
- : m_elem (elem)
- {}
+ explicit intrusive_list_base_iterator (T *elem) : m_elem (elem) {}
/* Create a past-the-end iterator. */
- intrusive_list_base_iterator ()
- : m_elem (nullptr)
- {}
+ intrusive_list_base_iterator () : m_elem (nullptr) {}
- reference operator* () const
- { return *m_elem; }
+ reference operator* () const { return *m_elem; }
- pointer operator-> () const
- { return m_elem; }
+ pointer operator->() const { return m_elem; }
bool operator== (const self_type &other) const
- { return m_elem == other.m_elem; }
+ {
+ return m_elem == other.m_elem;
+ }
bool operator!= (const self_type &other) const
- { return m_elem != other.m_elem; }
+ {
+ return m_elem != other.m_elem;
+ }
protected:
- static node_type *as_node (T *elem)
- { return AsNode::as_node (elem); }
+ static node_type *as_node (T *elem) { return AsNode::as_node (elem); }
/* A past-end-the iterator points to the list's head. */
pointer m_elem;
@@ -119,11 +114,12 @@ protected:
template<typename T, typename AsNode = intrusive_base_node<T>>
struct intrusive_list_iterator
- : public intrusive_list_base_iterator
- <T, AsNode, intrusive_list_iterator<T, AsNode>>
+ : public intrusive_list_base_iterator<T, AsNode,
+ intrusive_list_iterator<T, AsNode>>
{
- using base = intrusive_list_base_iterator
- <T, AsNode, intrusive_list_iterator<T, AsNode>>;
+ using base
+ = intrusive_list_base_iterator<T, AsNode,
+ intrusive_list_iterator<T, AsNode>>;
using self_type = typename base::self_type;
using node_type = typename base::node_type;
@@ -166,11 +162,12 @@ struct intrusive_list_iterator
template<typename T, typename AsNode = intrusive_base_node<T>>
struct intrusive_list_reverse_iterator
- : public intrusive_list_base_iterator
- <T, AsNode, intrusive_list_reverse_iterator<T, AsNode>>
+ : public intrusive_list_base_iterator<
+ T, AsNode, intrusive_list_reverse_iterator<T, AsNode>>
{
- using base = intrusive_list_base_iterator
- <T, AsNode, intrusive_list_reverse_iterator<T, AsNode>>;
+ using base
+ = intrusive_list_base_iterator<T, AsNode,
+ intrusive_list_reverse_iterator<T, AsNode>>;
using self_type = typename base::self_type;
/* Inherit constructor and M_NODE visibility from base. */
@@ -225,7 +222,7 @@ struct intrusive_list_reverse_iterator
where `member` is the name of the member. */
-template <typename T, typename AsNode = intrusive_base_node<T>>
+template<typename T, typename AsNode = intrusive_base_node<T>>
class intrusive_list
{
public:
@@ -245,10 +242,7 @@ public:
intrusive_list () = default;
- ~intrusive_list ()
- {
- clear ();
- }
+ ~intrusive_list () { clear (); }
intrusive_list (intrusive_list &&other)
: m_front (other.m_front),
@@ -274,10 +268,7 @@ public:
std::swap (m_back, other.m_back);
}
- iterator iterator_to (reference value)
- {
- return iterator (&value);
- }
+ iterator iterator_to (reference value) { return iterator (&value); }
const_iterator iterator_to (const_reference value)
{
@@ -369,8 +360,8 @@ public:
if (this->empty ())
{
- *this = std::move (other);
- return;
+ *this = std::move (other);
+ return;
}
/* [A ... B] + [C ... D] */
@@ -460,26 +451,26 @@ private:
if (m_front == &elem)
{
- gdb_assert (elem_node->prev == nullptr);
- m_front = elem_node->next;
+ gdb_assert (elem_node->prev == nullptr);
+ m_front = elem_node->next;
}
else
{
- gdb_assert (elem_node->prev != nullptr);
- intrusive_list_node<T> *prev_node = as_node (elem_node->prev);
- prev_node->next = elem_node->next;
+ gdb_assert (elem_node->prev != nullptr);
+ intrusive_list_node<T> *prev_node = as_node (elem_node->prev);
+ prev_node->next = elem_node->next;
}
if (m_back == &elem)
{
- gdb_assert (elem_node->next == nullptr);
- m_back = elem_node->prev;
+ gdb_assert (elem_node->next == nullptr);
+ m_back = elem_node->prev;
}
else
{
- gdb_assert (elem_node->next != nullptr);
- intrusive_list_node<T> *next_node = as_node (elem_node->next);
- next_node->prev = elem_node->prev;
+ gdb_assert (elem_node->next != nullptr);
+ intrusive_list_node<T> *next_node = as_node (elem_node->next);
+ next_node->prev = elem_node->prev;
}
elem_node->next = INTRUSIVE_LIST_UNLINKED_VALUE;
@@ -513,51 +504,27 @@ public:
{
while (!this->empty ())
{
- pointer p = &front ();
- pop_front ();
- disposer (p);
+ pointer p = &front ();
+ pop_front ();
+ disposer (p);
}
}
- bool empty () const
- {
- return m_front == nullptr;
- }
+ bool empty () const { return m_front == nullptr; }
- iterator begin () noexcept
- {
- return iterator (m_front);
- }
+ iterator begin () noexcept { return iterator (m_front); }
- const_iterator begin () const noexcept
- {
- return const_iterator (m_front);
- }
+ const_iterator begin () const noexcept { return const_iterator (m_front); }
- const_iterator cbegin () const noexcept
- {
- return const_iterator (m_front);
- }
+ const_iterator cbegin () const noexcept { return const_iterator (m_front); }
- iterator end () noexcept
- {
- return {};
- }
+ iterator end () noexcept { return {}; }
- const_iterator end () const noexcept
- {
- return {};
- }
+ const_iterator end () const noexcept { return {}; }
- const_iterator cend () const noexcept
- {
- return {};
- }
+ const_iterator cend () const noexcept { return {}; }
- reverse_iterator rbegin () noexcept
- {
- return reverse_iterator (m_back);
- }
+ reverse_iterator rbegin () noexcept { return reverse_iterator (m_back); }
const_reverse_iterator rbegin () const noexcept
{
@@ -569,26 +536,14 @@ public:
return const_reverse_iterator (m_back);
}
- reverse_iterator rend () noexcept
- {
- return {};
- }
+ reverse_iterator rend () noexcept { return {}; }
- const_reverse_iterator rend () const noexcept
- {
- return {};
- }
+ const_reverse_iterator rend () const noexcept { return {}; }
- const_reverse_iterator crend () const noexcept
- {
- return {};
- }
+ const_reverse_iterator crend () const noexcept { return {}; }
private:
- static node_type *as_node (T *elem)
- {
- return AsNode::as_node (elem);
- }
+ static node_type *as_node (T *elem) { return AsNode::as_node (elem); }
T *m_front = nullptr;
T *m_back = nullptr;
diff --git a/gdbsupport/iterator-range.h b/gdbsupport/iterator-range.h
index e934f5ebf01..433551041a5 100644
--- a/gdbsupport/iterator-range.h
+++ b/gdbsupport/iterator-range.h
@@ -22,7 +22,7 @@
/* A wrapper that allows using ranged for-loops on a range described by two
iterators. */
-template <typename IteratorType>
+template<typename IteratorType>
struct iterator_range
{
using iterator = IteratorType;
@@ -30,16 +30,18 @@ struct iterator_range
/* Create an iterator_range using BEGIN as the begin iterator.
Assume that the end iterator can be default-constructed. */
- template <typename... Args>
- iterator_range (Args &&...args)
- : m_begin (std::forward<Args> (args)...)
- {}
+ template<typename... Args>
+ iterator_range (Args &&...args) : m_begin (std::forward<Args> (args)...)
+ {
+ }
/* Create an iterator range using explicit BEGIN and END iterators. */
- template <typename... Args>
+ template<typename... Args>
iterator_range (IteratorType begin, IteratorType end)
- : m_begin (std::move (begin)), m_end (std::move (end))
- {}
+ : m_begin (std::move (begin)),
+ m_end (std::move (end))
+ {
+ }
/* Need these as the variadic constructor would be a better match
otherwise. */
@@ -47,15 +49,12 @@ struct iterator_range
iterator_range (const iterator_range &) = default;
iterator_range (iterator_range &&) = default;
- IteratorType begin () const
- { return m_begin; }
+ IteratorType begin () const { return m_begin; }
- IteratorType end () const
- { return m_end; }
+ IteratorType end () const { return m_end; }
/* The number of items in this iterator_range. */
- std::size_t size () const
- { return std::distance (m_begin, m_end); }
+ std::size_t size () const { return std::distance (m_begin, m_end); }
private:
IteratorType m_begin, m_end;
diff --git a/gdbsupport/job-control.cc b/gdbsupport/job-control.cc
index 57dc32c0345..4820832ba8e 100644
--- a/gdbsupport/job-control.cc
+++ b/gdbsupport/job-control.cc
@@ -70,7 +70,7 @@ have_job_control ()
{
/* OK, figure out whether we have job control. If termios is not
available, leave job_control 0. */
-#if defined (HAVE_TERMIOS_H)
+#if defined(HAVE_TERMIOS_H)
/* Do all systems with termios have the POSIX way of identifying job
control? I hope so. */
#ifdef _POSIX_JOB_CONTROL
@@ -79,7 +79,7 @@ have_job_control ()
#ifdef _SC_JOB_CONTROL
job_control = sysconf (_SC_JOB_CONTROL);
#else
- job_control = 0; /* Have to assume the worst. */
+ job_control = 0; /* Have to assume the worst. */
#endif /* _SC_JOB_CONTROL */
#endif /* _POSIX_JOB_CONTROL */
#endif /* HAVE_TERMIOS_H */
diff --git a/gdbsupport/netstuff.cc b/gdbsupport/netstuff.cc
index 55b142df7f5..e2bae0f1257 100644
--- a/gdbsupport/netstuff.cc
+++ b/gdbsupport/netstuff.cc
@@ -50,41 +50,40 @@ parse_connection_spec_without_prefix (std::string spec, struct addrinfo *hint)
- ai_family is not AF_INET, and
- spec[0] is '[', or
- the number of ':' on spec is greater than 1. */
- bool is_ipv6 = (hint->ai_family == AF_INET6
- || (hint->ai_family != AF_INET
- && (spec[0] == '['
- || std::count (spec.begin (),
- spec.end (), ':') > 1)));
+ bool is_ipv6
+ = (hint->ai_family == AF_INET6
+ || (hint->ai_family != AF_INET
+ && (spec[0] == '['
+ || std::count (spec.begin (), spec.end (), ':') > 1)));
if (is_ipv6)
{
if (spec[0] == '[')
- {
- /* IPv6 addresses can be written as '[ADDR]:PORT', and we
+ {
+ /* IPv6 addresses can be written as '[ADDR]:PORT', and we
support this notation. */
- size_t close_bracket_pos = spec.find_first_of (']');
+ size_t close_bracket_pos = spec.find_first_of (']');
- if (close_bracket_pos == std::string::npos)
- error (_("Missing close bracket in hostname '%s'"),
- spec.c_str ());
+ if (close_bracket_pos == std::string::npos)
+ error (_ ("Missing close bracket in hostname '%s'"),
+ spec.c_str ());
- hint->ai_family = AF_INET6;
+ hint->ai_family = AF_INET6;
- const char c = spec[close_bracket_pos + 1];
+ const char c = spec[close_bracket_pos + 1];
- if (c == '\0')
- last_colon_pos = std::string::npos;
- else if (c != ':')
- error (_("Invalid cruft after close bracket in '%s'"),
- spec.c_str ());
+ if (c == '\0')
+ last_colon_pos = std::string::npos;
+ else if (c != ':')
+ error (_ ("Invalid cruft after close bracket in '%s'"),
+ spec.c_str ());
- /* Erase both '[' and ']'. */
- spec.erase (0, 1);
- spec.erase (close_bracket_pos - 1, 1);
- }
+ /* Erase both '[' and ']'. */
+ spec.erase (0, 1);
+ spec.erase (close_bracket_pos - 1, 1);
+ }
else if (spec.find_first_of (']') != std::string::npos)
- error (_("Missing open bracket in hostname '%s'"),
- spec.c_str ());
+ error (_ ("Missing open bracket in hostname '%s'"), spec.c_str ());
}
if (last_colon_pos == 0)
@@ -119,35 +118,31 @@ parse_connection_spec (const char *spec, struct addrinfo *hint)
/* Struct to hold the association between valid prefixes, their
family and socktype. */
struct host_prefix
- {
- /* The prefix. */
- const char *prefix;
-
- /* The 'ai_family'. */
- int family;
-
- /* The 'ai_socktype'. */
- int socktype;
- };
- static const struct host_prefix prefixes[] =
- {
- { "udp:", AF_UNSPEC, SOCK_DGRAM },
- { "tcp:", AF_UNSPEC, SOCK_STREAM },
- { "udp4:", AF_INET, SOCK_DGRAM },
- { "tcp4:", AF_INET, SOCK_STREAM },
- { "udp6:", AF_INET6, SOCK_DGRAM },
- { "tcp6:", AF_INET6, SOCK_STREAM },
- };
+ {
+ /* The prefix. */
+ const char *prefix;
+
+ /* The 'ai_family'. */
+ int family;
+
+ /* The 'ai_socktype'. */
+ int socktype;
+ };
+ static const struct host_prefix prefixes[] = {
+ { "udp:", AF_UNSPEC, SOCK_DGRAM }, { "tcp:", AF_UNSPEC, SOCK_STREAM },
+ { "udp4:", AF_INET, SOCK_DGRAM }, { "tcp4:", AF_INET, SOCK_STREAM },
+ { "udp6:", AF_INET6, SOCK_DGRAM }, { "tcp6:", AF_INET6, SOCK_STREAM },
+ };
for (const host_prefix prefix : prefixes)
if (startswith (spec, prefix.prefix))
{
- spec += strlen (prefix.prefix);
- hint->ai_family = prefix.family;
- hint->ai_socktype = prefix.socktype;
- hint->ai_protocol
- = hint->ai_socktype == SOCK_DGRAM ? IPPROTO_UDP : IPPROTO_TCP;
- break;
+ spec += strlen (prefix.prefix);
+ hint->ai_family = prefix.family;
+ hint->ai_socktype = prefix.socktype;
+ hint->ai_protocol
+ = hint->ai_socktype == SOCK_DGRAM ? IPPROTO_UDP : IPPROTO_TCP;
+ break;
}
return parse_connection_spec_without_prefix (spec, hint);
diff --git a/gdbsupport/netstuff.h b/gdbsupport/netstuff.h
index f9cf3fceaa5..0ac2c8f4a00 100644
--- a/gdbsupport/netstuff.h
+++ b/gdbsupport/netstuff.h
@@ -31,10 +31,7 @@ class scoped_free_addrinfo
{
public:
/* Default constructor. */
- explicit scoped_free_addrinfo (struct addrinfo *ainfo)
- : m_res (ainfo)
- {
- }
+ explicit scoped_free_addrinfo (struct addrinfo *ainfo) : m_res (ainfo) {}
/* Destructor responsible for free'ing M_RES by calling
'freeaddrinfo'. */
@@ -58,19 +55,17 @@ struct parsed_connection_spec
std::string port_str;
};
-
/* Parse SPEC (which is a string in the form of "ADDR:PORT") and
return a 'parsed_connection_spec' structure with the proper fields
filled in. Also adjust HINT accordingly. */
extern parsed_connection_spec
- parse_connection_spec_without_prefix (std::string spec,
- struct addrinfo *hint);
+parse_connection_spec_without_prefix (std::string spec, struct addrinfo *hint);
/* Parse SPEC (which is a string in the form of
"[tcp[6]:|udp[6]:]ADDR:PORT") and return a 'parsed_connection_spec'
structure with the proper fields filled in. Also adjust HINT
accordingly. */
extern parsed_connection_spec parse_connection_spec (const char *spec,
- struct addrinfo *hint);
+ struct addrinfo *hint);
#endif /* COMMON_NETSTUFF_H */
diff --git a/gdbsupport/new-op.cc b/gdbsupport/new-op.cc
index 6a056ef508f..6737b5232c1 100644
--- a/gdbsupport/new-op.cc
+++ b/gdbsupport/new-op.cc
@@ -19,7 +19,7 @@
/* GCC does not understand __has_feature. */
#if !defined(__has_feature)
-# define __has_feature(x) 0
+#define __has_feature(x) 0
#endif
#if !__has_feature(address_sanitizer) && !defined(__SANITIZE_ADDRESS__)
@@ -56,7 +56,7 @@ operator new (std::size_t sz)
if (sz == 0)
sz = 1;
- void *p = malloc (sz); /* ARI: malloc */
+ void *p = malloc (sz); /* ARI: malloc */
if (p == NULL)
{
/* If the user decides to continue debugging, throw a
@@ -66,34 +66,34 @@ operator new (std::size_t sz)
can only ever throw std::bad_alloc, or something that extends
it. */
try
- {
- malloc_failure (sz);
- }
+ {
+ malloc_failure (sz);
+ }
catch (gdb_exception &ex)
- {
- throw gdb_quit_bad_alloc (std::move (ex));
- }
+ {
+ throw gdb_quit_bad_alloc (std::move (ex));
+ }
}
return p;
}
void *
-operator new (std::size_t sz, const std::nothrow_t&) noexcept
+operator new (std::size_t sz, const std::nothrow_t &) noexcept
{
/* malloc (0) is unpredictable; avoid it. */
if (sz == 0)
sz = 1;
- return malloc (sz); /* ARI: malloc */
+ return malloc (sz); /* ARI: malloc */
}
void *
operator new[] (std::size_t sz)
{
- return ::operator new (sz);
+ return ::operator new (sz);
}
-void*
-operator new[] (std::size_t sz, const std::nothrow_t&) noexcept
+void *
+operator new[] (std::size_t sz, const std::nothrow_t &) noexcept
{
return ::operator new (sz, std::nothrow);
}
@@ -110,7 +110,7 @@ operator delete (void *p) noexcept
}
void
-operator delete (void *p, const std::nothrow_t&) noexcept
+operator delete (void *p, const std::nothrow_t &) noexcept
{
return ::operator delete (p);
}
@@ -128,7 +128,7 @@ operator delete[] (void *p) noexcept
}
void
-operator delete[] (void *p, const std::nothrow_t&) noexcept
+operator delete[] (void *p, const std::nothrow_t &) noexcept
{
return ::operator delete (p, std::nothrow);
}
diff --git a/gdbsupport/next-iterator.h b/gdbsupport/next-iterator.h
index d4d98a058b8..d630f3c36ca 100644
--- a/gdbsupport/next-iterator.h
+++ b/gdbsupport/next-iterator.h
@@ -35,21 +35,12 @@ struct next_iterator
typedef std::forward_iterator_tag iterator_category;
typedef int difference_type;
- explicit next_iterator (T *item)
- : m_item (item)
- {
- }
+ explicit next_iterator (T *item) : m_item (item) {}
/* Create a one-past-the-end iterator. */
- next_iterator ()
- : m_item (nullptr)
- {
- }
+ next_iterator () : m_item (nullptr) {}
- value_type operator* () const
- {
- return m_item;
- }
+ value_type operator* () const { return m_item; }
bool operator== (const self_type &other) const
{
@@ -68,13 +59,12 @@ struct next_iterator
}
private:
-
T *m_item;
};
/* A convenience wrapper to make a range type around a next_iterator. */
-template <typename T>
+template<typename T>
using next_range = iterator_range<next_iterator<T>>;
#endif /* COMMON_NEXT_ITERATOR_H */
diff --git a/gdbsupport/observable.h b/gdbsupport/observable.h
index 1a009efafba..d8f8f46651e 100644
--- a/gdbsupport/observable.h
+++ b/gdbsupport/observable.h
@@ -64,19 +64,19 @@ struct token
namespace detail
{
- /* Types that don't depend on any template parameter. This saves a
+/* Types that don't depend on any template parameter. This saves a
bit of code and debug info size, compared to putting them inside
class observable. */
- /* Use for sorting algorithm, to indicate which observer we have
+/* Use for sorting algorithm, to indicate which observer we have
visited. */
- enum class visit_state
- {
- NOT_VISITED,
- VISITING,
- VISITED,
- };
-}
+enum class visit_state
+{
+ NOT_VISITED,
+ VISITING,
+ VISITED,
+};
+} // namespace detail
template<typename... T>
class observable
@@ -88,9 +88,13 @@ private:
struct observer
{
observer (const struct token *token, func_type func, const char *name,
- const std::vector<const struct token *> &dependencies)
- : token (token), func (func), name (name), dependencies (dependencies)
- {}
+ const std::vector<const struct token *> &dependencies)
+ : token (token),
+ func (func),
+ name (name),
+ dependencies (dependencies)
+ {
+ }
const struct token *token;
func_type func;
@@ -99,10 +103,7 @@ private:
};
public:
- explicit observable (const char *name)
- : m_name (name)
- {
- }
+ explicit observable (const char *name) : m_name (name) {}
DISABLE_COPY_AND_ASSIGN (observable);
@@ -115,7 +116,7 @@ public:
NAME is the name of the observer, used for debug output purposes. Its
lifetime must be at least as long as the observer is attached. */
void attach (const func_type &f, const char *name,
- const std::vector<const struct token *> &dependencies = {})
+ const std::vector<const struct token *> &dependencies = {})
{
attach (f, nullptr, name, dependencies);
}
@@ -131,7 +132,7 @@ public:
NAME is the name of the observer, used for debug output purposes. Its
lifetime must be at least as long as the observer is attached. */
void attach (const func_type &f, const token &t, const char *name,
- const std::vector<const struct token *> &dependencies = {})
+ const std::vector<const struct token *> &dependencies = {})
{
attach (f, &t, name, dependencies);
}
@@ -141,15 +142,12 @@ public:
calls. */
void detach (const token &t)
{
- auto iter = std::remove_if (m_observers.begin (),
- m_observers.end (),
- [&] (const observer &o)
- {
- return o.token == &t;
- });
+ auto iter
+ = std::remove_if (m_observers.begin (), m_observers.end (),
+ [&] (const observer &o) { return o.token == &t; });
observer_debug_printf ("Detaching observable %s from observer %s",
- iter->name, m_name);
+ iter->name, m_name);
m_observers.erase (iter, m_observers.end ());
}
@@ -161,14 +159,13 @@ public:
for (auto &&e : m_observers)
{
- OBSERVER_SCOPED_DEBUG_START_END ("calling observer %s of observable %s",
- e.name, m_name);
- e.func (args...);
+ OBSERVER_SCOPED_DEBUG_START_END (
+ "calling observer %s of observable %s", e.name, m_name);
+ e.func (args...);
}
}
private:
-
std::vector<observer> m_observers;
const char *m_name;
@@ -179,8 +176,8 @@ private:
If the observer is already visited, do nothing. */
void visit_for_sorting (std::vector<observer> &sorted_observers,
- std::vector<detail::visit_state> &visit_states,
- int index)
+ std::vector<detail::visit_state> &visit_states,
+ int index)
{
if (visit_states[index] == detail::visit_state::VISITED)
return;
@@ -193,10 +190,10 @@ private:
/* For each dependency of this observer... */
for (const token *dep : m_observers[index].dependencies)
{
- /* ... find the observer that has token DEP. If found, visit it. */
+ /* ... find the observer that has token DEP. If found, visit it. */
auto it_dep
- = std::find_if (m_observers.begin (), m_observers.end (),
- [&] (observer o) { return o.token == dep; });
+ = std::find_if (m_observers.begin (), m_observers.end (),
+ [&] (observer o) { return o.token == dep; });
if (it_dep != m_observers.end ())
{
int i = std::distance (m_observers.begin (), it_dep);
@@ -216,8 +213,8 @@ private:
void sort_observers ()
{
std::vector<observer> sorted_observers;
- std::vector<detail::visit_state> visit_states
- (m_observers.size (), detail::visit_state::NOT_VISITED);
+ std::vector<detail::visit_state>
+ visit_states (m_observers.size (), detail::visit_state::NOT_VISITED);
for (size_t i = 0; i < m_observers.size (); i++)
visit_for_sorting (sorted_observers, visit_states, i);
@@ -228,9 +225,8 @@ private:
void attach (const func_type &f, const token *t, const char *name,
const std::vector<const struct token *> &dependencies)
{
-
- observer_debug_printf ("Attaching observable %s to observer %s",
- name, m_name);
+ observer_debug_printf ("Attaching observable %s to observer %s", name,
+ m_name);
m_observers.emplace_back (t, f, name, dependencies);
diff --git a/gdbsupport/offset-type.h b/gdbsupport/offset-type.h
index d7e079caab9..310de4c4dc4 100644
--- a/gdbsupport/offset-type.h
+++ b/gdbsupport/offset-type.h
@@ -50,8 +50,10 @@
/* Declare TYPE as being an offset type. This declares the type and
enables the operators defined below. */
-#define DEFINE_OFFSET_TYPE(TYPE, UNDERLYING) \
- enum class TYPE : UNDERLYING {}; \
+#define DEFINE_OFFSET_TYPE(TYPE, UNDERLYING) \
+ enum class TYPE : UNDERLYING \
+ { \
+ }; \
void is_offset_type (TYPE)
/* The macro macro is all you need to know use offset types. The rest
@@ -76,53 +78,48 @@
/* Adding or subtracting an integer to an offset type shifts the
offset. This is like "PTR = PTR + INT" and "PTR += INT". */
-#define DEFINE_OFFSET_ARITHM_OP(OP) \
- template<typename E, \
- typename = decltype (is_offset_type (std::declval<E> ()))> \
- constexpr E \
- operator OP (E lhs, typename std::underlying_type<E>::type rhs) \
- { \
- using underlying = typename std::underlying_type<E>::type; \
- return (E) (static_cast<underlying> (lhs) OP rhs); \
- } \
- \
- template<typename E, \
- typename = decltype (is_offset_type (std::declval<E> ()))> \
- constexpr E \
- operator OP (typename std::underlying_type<E>::type lhs, E rhs) \
- { \
- using underlying = typename std::underlying_type<E>::type; \
- return (E) (lhs OP static_cast<underlying> (rhs)); \
- } \
- \
- template<typename E, \
- typename = decltype (is_offset_type (std::declval<E> ()))> \
- E & \
- operator OP ## = (E &lhs, typename std::underlying_type<E>::type rhs) \
- { \
- using underlying = typename std::underlying_type<E>::type; \
- lhs = (E) (static_cast<underlying> (lhs) OP rhs); \
- return lhs; \
+#define DEFINE_OFFSET_ARITHM_OP(OP) \
+ template<typename E, \
+ typename = decltype (is_offset_type (std::declval<E> ()))> \
+ constexpr E operator OP (E lhs, typename std::underlying_type<E>::type rhs) \
+ { \
+ using underlying = typename std::underlying_type<E>::type; \
+ return (E) (static_cast<underlying> (lhs) OP rhs); \
+ } \
+ \
+ template<typename E, \
+ typename = decltype (is_offset_type (std::declval<E> ()))> \
+ constexpr E operator OP (typename std::underlying_type<E>::type lhs, E rhs) \
+ { \
+ using underlying = typename std::underlying_type<E>::type; \
+ return (E) (lhs OP static_cast<underlying> (rhs)); \
+ } \
+ \
+ template<typename E, \
+ typename = decltype (is_offset_type (std::declval<E> ()))> \
+ E &operator OP##= (E &lhs, typename std::underlying_type<E>::type rhs) \
+ { \
+ using underlying = typename std::underlying_type<E>::type; \
+ lhs = (E) (static_cast<underlying> (lhs) OP rhs); \
+ return lhs; \
}
-DEFINE_OFFSET_ARITHM_OP(+)
-DEFINE_OFFSET_ARITHM_OP(-)
+DEFINE_OFFSET_ARITHM_OP (+)
+DEFINE_OFFSET_ARITHM_OP (-)
/* Adding two offset types doesn't make sense, just like "PTR + PTR"
doesn't make sense. This is defined as a deleted function so that
a compile error easily brings you to this comment. */
-template<typename E,
- typename = decltype (is_offset_type (std::declval<E> ()))>
-constexpr typename std::underlying_type<E>::type
-operator+ (E lhs, E rhs) = delete;
+template<typename E, typename = decltype (is_offset_type (std::declval<E> ()))>
+constexpr typename std::underlying_type<E>::type operator+ (E lhs, E rhs)
+ = delete;
/* Subtracting two offset types, however, gives you back the
difference between the offsets, as an underlying type. Similar to
how "PTR2 - PTR1" returns a ptrdiff_t. */
-template<typename E,
- typename = decltype (is_offset_type (std::declval<E> ()))>
+template<typename E, typename = decltype (is_offset_type (std::declval<E> ()))>
constexpr typename std::underlying_type<E>::type
operator- (E lhs, E rhs)
{
diff --git a/gdbsupport/packed.h b/gdbsupport/packed.h
index b18146c30eb..a1ffc937fcd 100644
--- a/gdbsupport/packed.h
+++ b/gdbsupport/packed.h
@@ -39,9 +39,9 @@
/* Clang targeting Windows does not support attribute gcc_struct, so
we use the alternative byte array implemention there. */
#if defined _WIN32 && defined __clang__
-# define PACKED_USE_ARRAY 1
+#define PACKED_USE_ARRAY 1
#else
-# define PACKED_USE_ARRAY 0
+#define PACKED_USE_ARRAY 0
#endif
/* For the preferred implementation, we need gcc_struct on Windows, as
@@ -49,9 +49,9 @@
what we want. Clang targeting Windows does not support attribute
gcc_struct. */
#if !PACKED_USE_ARRAY && defined _WIN32 && !defined __clang__
-# define ATTRIBUTE_GCC_STRUCT __attribute__((__gcc_struct__))
+#define ATTRIBUTE_GCC_STRUCT __attribute__ ((__gcc_struct__))
#else
-# define ATTRIBUTE_GCC_STRUCT
+#define ATTRIBUTE_GCC_STRUCT
#endif
template<typename T, size_t Bytes = sizeof (T)>
@@ -68,8 +68,8 @@ public:
ULONGEST tmp = val;
for (int i = (Bytes - 1); i >= 0; --i)
{
- m_bytes[i] = (gdb_byte) tmp;
- tmp >>= HOST_CHAR_BIT;
+ m_bytes[i] = (gdb_byte) tmp;
+ tmp >>= HOST_CHAR_BIT;
}
#else
m_val = val;
@@ -95,10 +95,10 @@ public:
ULONGEST tmp = 0;
for (int i = 0;;)
{
- tmp |= m_bytes[i];
- if (++i == Bytes)
- break;
- tmp <<= HOST_CHAR_BIT;
+ tmp |= m_bytes[i];
+ if (++i == Bytes)
+ break;
+ tmp <<= HOST_CHAR_BIT;
}
return (T) tmp;
#else
@@ -110,7 +110,7 @@ private:
#if PACKED_USE_ARRAY
gdb_byte m_bytes[Bytes];
#else
- T m_val : (Bytes * HOST_CHAR_BIT) ATTRIBUTE_PACKED;
+ T m_val : (Bytes *HOST_CHAR_BIT) ATTRIBUTE_PACKED;
#endif
};
@@ -122,38 +122,38 @@ private:
conversions to go from T to packed<T> to std::atomic<packed<T>>
(and back), and C++ only does one. */
-#define PACKED_ATOMIC_OP(OP) \
- template<typename T, size_t Bytes> \
- bool operator OP (const std::atomic<packed<T, Bytes>> &lhs, \
- const std::atomic<packed<T, Bytes>> &rhs) \
- { \
- return lhs.load () OP rhs.load (); \
- } \
- \
- template<typename T, size_t Bytes> \
- bool operator OP (T lhs, const std::atomic<packed<T, Bytes>> &rhs) \
- { \
- return lhs OP rhs.load (); \
- } \
- \
- template<typename T, size_t Bytes> \
- bool operator OP (const std::atomic<packed<T, Bytes>> &lhs, T rhs) \
- { \
- return lhs.load () OP rhs; \
- } \
- \
- template<typename T, size_t Bytes> \
- bool operator OP (const std::atomic<packed<T, Bytes>> &lhs, \
- packed<T, Bytes> rhs) \
- { \
- return lhs.load () OP rhs; \
- } \
- \
- template<typename T, size_t Bytes> \
- bool operator OP (packed<T, Bytes> lhs, \
- const std::atomic<packed<T, Bytes>> &rhs) \
- { \
- return lhs OP rhs.load (); \
+#define PACKED_ATOMIC_OP(OP) \
+ template<typename T, size_t Bytes> \
+ bool operator OP (const std::atomic<packed<T, Bytes>> &lhs, \
+ const std::atomic<packed<T, Bytes>> &rhs) \
+ { \
+ return lhs.load () OP rhs.load (); \
+ } \
+ \
+ template<typename T, size_t Bytes> \
+ bool operator OP (T lhs, const std::atomic<packed<T, Bytes>> &rhs) \
+ { \
+ return lhs OP rhs.load (); \
+ } \
+ \
+ template<typename T, size_t Bytes> \
+ bool operator OP (const std::atomic<packed<T, Bytes>> &lhs, T rhs) \
+ { \
+ return lhs.load () OP rhs; \
+ } \
+ \
+ template<typename T, size_t Bytes> \
+ bool operator OP (const std::atomic<packed<T, Bytes>> &lhs, \
+ packed<T, Bytes> rhs) \
+ { \
+ return lhs.load () OP rhs; \
+ } \
+ \
+ template<typename T, size_t Bytes> \
+ bool operator OP (packed<T, Bytes> lhs, \
+ const std::atomic<packed<T, Bytes>> &rhs) \
+ { \
+ return lhs OP rhs.load (); \
}
PACKED_ATOMIC_OP (==)
diff --git a/gdbsupport/parallel-for.h b/gdbsupport/parallel-for.h
index de9ebb15746..fc4c30dc97c 100644
--- a/gdbsupport/parallel-for.h
+++ b/gdbsupport/parallel-for.h
@@ -38,11 +38,7 @@ template<typename T>
struct par_for_accumulator
{
public:
-
- explicit par_for_accumulator (size_t n_threads)
- : m_futures (n_threads)
- {
- }
+ explicit par_for_accumulator (size_t n_threads) : m_futures (n_threads) {}
/* The result type that is accumulated. */
typedef std::vector<T> result_type;
@@ -71,13 +67,9 @@ public:
}
/* Resize the results to N. */
- void resize (size_t n)
- {
- m_futures.resize (n);
- }
+ void resize (size_t n) { m_futures.resize (n); }
private:
-
/* A vector of futures coming from the tasks run in the
background. */
std::vector<gdb::future<T>> m_futures;
@@ -88,11 +80,7 @@ template<>
struct par_for_accumulator<void>
{
public:
-
- explicit par_for_accumulator (size_t n_threads)
- : m_futures (n_threads)
- {
- }
+ explicit par_for_accumulator (size_t n_threads) : m_futures (n_threads) {}
/* This specialization does not compute results. */
typedef void result_type;
@@ -109,23 +97,19 @@ public:
for (auto &future : m_futures)
{
- /* Use 'get' and not 'wait', to propagate any exception. */
- future.get ();
+ /* Use 'get' and not 'wait', to propagate any exception. */
+ future.get ();
}
}
/* Resize the results to N. */
- void resize (size_t n)
- {
- m_futures.resize (n);
- }
+ void resize (size_t n) { m_futures.resize (n); }
private:
-
std::vector<gdb::future<void>> m_futures;
};
-}
+} // namespace detail
/* A very simple "parallel for". This splits the range of iterators
into subranges, and then passes each subrange to the callback. The
@@ -144,15 +128,14 @@ private:
the number of threads that were used. */
template<class RandomIt, class RangeFunction>
-typename gdb::detail::par_for_accumulator<
- typename gdb::invoke_result<RangeFunction, RandomIt, RandomIt>::type
- >::result_type
+typename gdb::detail::par_for_accumulator<typename gdb::invoke_result<
+ RangeFunction, RandomIt, RandomIt>::type>::result_type
parallel_for_each (unsigned n, RandomIt first, RandomIt last,
- RangeFunction callback,
- gdb::function_view<size_t(RandomIt)> task_size = nullptr)
+ RangeFunction callback,
+ gdb::function_view<size_t (RandomIt)> task_size = nullptr)
{
- using result_type
- = typename gdb::invoke_result<RangeFunction, RandomIt, RandomIt>::type;
+ using result_type =
+ typename gdb::invoke_result<RangeFunction, RandomIt, RandomIt>::type;
/* If enabled, print debug info about how the work is distributed across
the threads. */
@@ -170,34 +153,34 @@ parallel_for_each (unsigned n, RandomIt first, RandomIt last,
if (n_threads > 1)
{
if (task_size != nullptr)
- {
- gdb_assert (n == 1);
- for (RandomIt i = first; i != last; ++i)
- {
- size_t element_size = task_size (i);
- gdb_assert (element_size > 0);
- if (element_size > max_element_size)
- /* We could start scaling here, but that doesn't seem to be
+ {
+ gdb_assert (n == 1);
+ for (RandomIt i = first; i != last; ++i)
+ {
+ size_t element_size = task_size (i);
+ gdb_assert (element_size > 0);
+ if (element_size > max_element_size)
+ /* We could start scaling here, but that doesn't seem to be
worth the effort. */
- element_size = max_element_size;
- size_t prev_total_size = total_size;
- total_size += element_size;
- /* Check for overflow. */
- gdb_assert (prev_total_size < total_size);
- }
- size_per_thread = total_size / n_threads;
- }
+ element_size = max_element_size;
+ size_t prev_total_size = total_size;
+ total_size += element_size;
+ /* Check for overflow. */
+ gdb_assert (prev_total_size < total_size);
+ }
+ size_per_thread = total_size / n_threads;
+ }
else
- {
- /* Require that there should be at least N elements in a
+ {
+ /* Require that there should be at least N elements in a
thread. */
- gdb_assert (n > 0);
- if (n_elements / n_threads < n)
- n_threads = std::max (n_elements / n, (size_t) 1);
- elts_per_thread = n_elements / n_threads;
- elts_left_over = n_elements % n_threads;
- /* n_elements == n_threads * elts_per_thread + elts_left_over. */
- }
+ gdb_assert (n > 0);
+ if (n_elements / n_threads < n)
+ n_threads = std::max (n_elements / n, (size_t) 1);
+ elts_per_thread = n_elements / n_threads;
+ elts_left_over = n_elements % n_threads;
+ /* n_elements == n_threads * elts_per_thread + elts_left_over. */
+ }
}
size_t count = n_threads == 0 ? 0 : n_threads - 1;
@@ -205,17 +188,20 @@ parallel_for_each (unsigned n, RandomIt first, RandomIt last,
if (parallel_for_each_debug)
{
- debug_printf (_("Parallel for: n_elements: %zu\n"), n_elements);
+ debug_printf (_ ("Parallel for: n_elements: %zu\n"), n_elements);
if (task_size != nullptr)
- {
- debug_printf (_("Parallel for: total_size: %zu\n"), total_size);
- debug_printf (_("Parallel for: size_per_thread: %zu\n"), size_per_thread);
- }
+ {
+ debug_printf (_ ("Parallel for: total_size: %zu\n"), total_size);
+ debug_printf (_ ("Parallel for: size_per_thread: %zu\n"),
+ size_per_thread);
+ }
else
- {
- debug_printf (_("Parallel for: minimum elements per thread: %u\n"), n);
- debug_printf (_("Parallel for: elts_per_thread: %zu\n"), elts_per_thread);
- }
+ {
+ debug_printf (_ ("Parallel for: minimum elements per thread: %u\n"),
+ n);
+ debug_printf (_ ("Parallel for: elts_per_thread: %zu\n"),
+ elts_per_thread);
+ }
}
size_t remaining_size = total_size;
@@ -224,81 +210,77 @@ parallel_for_each (unsigned n, RandomIt first, RandomIt last,
RandomIt end;
size_t chunk_size = 0;
if (task_size == nullptr)
- {
- end = first + elts_per_thread;
- if (i < elts_left_over)
- /* Distribute the leftovers over the worker threads, to avoid having
+ {
+ end = first + elts_per_thread;
+ if (i < elts_left_over)
+ /* Distribute the leftovers over the worker threads, to avoid having
to handle all of them in a single thread. */
- end++;
- }
+ end++;
+ }
else
- {
- RandomIt j;
- for (j = first; j < last && chunk_size < size_per_thread; ++j)
- {
- size_t element_size = task_size (j);
- if (element_size > max_element_size)
- element_size = max_element_size;
- chunk_size += element_size;
- }
- end = j;
- remaining_size -= chunk_size;
- }
+ {
+ RandomIt j;
+ for (j = first; j < last && chunk_size < size_per_thread; ++j)
+ {
+ size_t element_size = task_size (j);
+ if (element_size > max_element_size)
+ element_size = max_element_size;
+ chunk_size += element_size;
+ }
+ end = j;
+ remaining_size -= chunk_size;
+ }
/* This case means we don't have enough elements to really
distribute them. Rather than ever submit a task that does
nothing, we short-circuit here. */
if (first == end)
- end = last;
+ end = last;
if (end == last)
- {
- /* We're about to dispatch the last batch of elements, which
+ {
+ /* We're about to dispatch the last batch of elements, which
we normally process in the main thread. So just truncate
the result list here. This avoids submitting empty tasks
to the thread pool. */
- count = i;
- results.resize (count);
- break;
- }
+ count = i;
+ results.resize (count);
+ break;
+ }
if (parallel_for_each_debug)
- {
- debug_printf (_("Parallel for: elements on worker thread %i\t: %zu"),
- i, (size_t)(end - first));
- if (task_size != nullptr)
- debug_printf (_("\t(size: %zu)"), chunk_size);
- debug_printf (_("\n"));
- }
- results.post (i, [=] ()
{
- return callback (first, end);
- });
+ debug_printf (_ (
+ "Parallel for: elements on worker thread %i\t: %zu"),
+ i, (size_t) (end - first));
+ if (task_size != nullptr)
+ debug_printf (_ ("\t(size: %zu)"), chunk_size);
+ debug_printf (_ ("\n"));
+ }
+ results.post (i, [=] () { return callback (first, end); });
first = end;
}
for (int i = count; i < n_worker_threads; ++i)
if (parallel_for_each_debug)
{
- debug_printf (_("Parallel for: elements on worker thread %i\t: 0"), i);
- if (task_size != nullptr)
- debug_printf (_("\t(size: 0)"));
- debug_printf (_("\n"));
+ debug_printf (_ ("Parallel for: elements on worker thread %i\t: 0"),
+ i);
+ if (task_size != nullptr)
+ debug_printf (_ ("\t(size: 0)"));
+ debug_printf (_ ("\n"));
}
/* Process all the remaining elements in the main thread. */
if (parallel_for_each_debug)
{
- debug_printf (_("Parallel for: elements on main thread\t\t: %zu"),
- (size_t)(last - first));
+ debug_printf (_ ("Parallel for: elements on main thread\t\t: %zu"),
+ (size_t) (last - first));
if (task_size != nullptr)
- debug_printf (_("\t(size: %zu)"), remaining_size);
- debug_printf (_("\n"));
+ debug_printf (_ ("\t(size: %zu)"), remaining_size);
+ debug_printf (_ ("\n"));
}
- return results.finish ([=] ()
- {
- return callback (first, last);
- });
+ return results.finish ([=] () { return callback (first, last); });
}
/* A sequential drop-in replacement of parallel_for_each. This can be useful
@@ -306,24 +288,21 @@ parallel_for_each (unsigned n, RandomIt first, RandomIt last,
multi-threading in a fine-grained way. */
template<class RandomIt, class RangeFunction>
-typename gdb::detail::par_for_accumulator<
- typename gdb::invoke_result<RangeFunction, RandomIt, RandomIt>::type
- >::result_type
+typename gdb::detail::par_for_accumulator<typename gdb::invoke_result<
+ RangeFunction, RandomIt, RandomIt>::type>::result_type
sequential_for_each (unsigned n, RandomIt first, RandomIt last,
- RangeFunction callback,
- gdb::function_view<size_t(RandomIt)> task_size = nullptr)
+ RangeFunction callback,
+ gdb::function_view<size_t (RandomIt)> task_size = nullptr)
{
- using result_type = typename gdb::invoke_result<RangeFunction, RandomIt, RandomIt>::type;
+ using result_type =
+ typename gdb::invoke_result<RangeFunction, RandomIt, RandomIt>::type;
gdb::detail::par_for_accumulator<result_type> results (0);
/* Process all the remaining elements in the main thread. */
- return results.finish ([=] ()
- {
- return callback (first, last);
- });
+ return results.finish ([=] () { return callback (first, last); });
}
-}
+} // namespace gdb
#endif /* GDBSUPPORT_PARALLEL_FOR_H */
diff --git a/gdbsupport/pathstuff.cc b/gdbsupport/pathstuff.cc
index d1a61f443d1..a601c173709 100644
--- a/gdbsupport/pathstuff.cc
+++ b/gdbsupport/pathstuff.cc
@@ -36,7 +36,7 @@ char *current_directory;
gdb::unique_xmalloc_ptr<char>
gdb_realpath (const char *filename)
{
-/* On most hosts, we rely on canonicalize_file_name to compute
+ /* On most hosts, we rely on canonicalize_file_name to compute
the FILENAME's realpath.
But the situation is slightly more complex on Windows, due to some
@@ -59,7 +59,7 @@ gdb_realpath (const char *filename)
does not exist locally), we rely instead on GetFullPathName to
perform the canonicalization. */
-#if defined (_WIN32)
+#if defined(_WIN32)
{
char buf[MAX_PATH];
DWORD len = GetFullPathName (filename, MAX_PATH, buf, NULL);
@@ -169,7 +169,7 @@ child_path (const char *parent, const char *child)
is nul due to CHILD containing the same path as PARENT, the
IS_DIR_SEPARATOR check will fail here. */
if (!IS_DIR_SEPARATOR (child[parent_len]))
- return NULL;
+ return NULL;
/* The first child component starts after the separator after the
common prefix. */
@@ -181,7 +181,7 @@ child_path (const char *parent, const char *child)
while (*child_component != '\0')
{
if (!IS_DIR_SEPARATOR (*child_component))
- return child_component;
+ return child_component;
child_component++;
}
@@ -200,10 +200,10 @@ path_join (gdb::array_view<const char *> paths)
const char *path = paths[i];
if (i > 0)
- gdb_assert (strlen (path) == 0 || !IS_ABSOLUTE_PATH (path));
+ gdb_assert (strlen (path) == 0 || !IS_ABSOLUTE_PATH (path));
if (!ret.empty () && !IS_DIR_SEPARATOR (ret.back ()))
- ret += '/';
+ ret += '/';
ret.append (path);
}
@@ -219,7 +219,7 @@ contains_dir_separator (const char *path)
for (; *path != '\0'; path++)
{
if (IS_DIR_SEPARATOR (*path))
- return true;
+ return true;
}
return false;
@@ -251,7 +251,7 @@ get_standard_cache_dir ()
{
/* Make sure the path is absolute and tilde-expanded. */
std::string abs = gdb_abspath (home);
- return path_join (abs.c_str (), HOME_CACHE_DIR, "gdb");
+ return path_join (abs.c_str (), HOME_CACHE_DIR, "gdb");
}
#ifdef WIN32
@@ -281,7 +281,7 @@ get_standard_temp_dir ()
if (tmp != nullptr)
return tmp;
- error (_("Couldn't find temp dir path, both TMP and TEMP are unset."));
+ error (_ ("Couldn't find temp dir path, both TMP and TEMP are unset."));
#else
const char *tmp = getenv ("TMPDIR");
@@ -352,7 +352,7 @@ find_gdb_home_config_file (const char *name, struct stat *buf)
if (!config_dir_file.empty ())
{
if (stat (config_dir_file.c_str (), buf) == 0)
- return config_dir_file;
+ return config_dir_file;
}
const char *homedir = getenv ("HOME");
@@ -362,7 +362,7 @@ find_gdb_home_config_file (const char *name, struct stat *buf)
std::string abs = gdb_abspath (homedir);
std::string path = string_printf ("%s/%s", abs.c_str (), name);
if (stat (path.c_str (), buf) == 0)
- return path;
+ return path;
}
return {};
diff --git a/gdbsupport/pathstuff.h b/gdbsupport/pathstuff.h
index b22a521e68d..77aa66e4d36 100644
--- a/gdbsupport/pathstuff.h
+++ b/gdbsupport/pathstuff.h
@@ -71,15 +71,14 @@ extern std::string path_join (gdb::array_view<const char *> paths);
/* Same as the above, but accept paths as distinct parameters. */
-template<typename ...Args>
+template<typename... Args>
std::string
path_join (Args... paths)
{
/* It doesn't make sense to join less than two paths. */
- gdb_static_assert (sizeof... (Args) >= 2);
+ gdb_static_assert (sizeof...(Args) >= 2);
- std::array<const char *, sizeof... (Args)> path_array
- { paths... };
+ std::array<const char *, sizeof...(Args)> path_array { paths... };
return path_join (gdb::array_view<const char *> (path_array));
}
@@ -147,7 +146,7 @@ extern std::string get_standard_config_filename (const char *filename);
'~/.config/gdb/gdbinit' and then '~/.gdbinit'. */
extern std::string find_gdb_home_config_file (const char *name,
- struct stat *buf);
+ struct stat *buf);
/* Return the file name of the user's shell. Normally this comes from
the SHELL environment variable. */
diff --git a/gdbsupport/poison.h b/gdbsupport/poison.h
index 956c3d856d8..ade81811667 100644
--- a/gdbsupport/poison.h
+++ b/gdbsupport/poison.h
@@ -47,13 +47,11 @@ be a compile-time error. */
/* Helper for SFINAE. True if "T *" is memsettable. I.e., if T is
either void, or POD. */
template<typename T>
-struct IsMemsettable
- : gdb::Or<std::is_void<T>,
- std::is_pod<T>>
-{};
+struct IsMemsettable : gdb::Or<std::is_void<T>, std::is_pod<T>>
+{
+};
-template <typename T,
- typename = gdb::Requires<gdb::Not<IsMemsettable<T>>>>
+template<typename T, typename = gdb::Requires<gdb::Not<IsMemsettable<T>>>>
void *memset (T *s, int c, size_t n) = delete;
#if HAVE_IS_TRIVIALLY_COPYABLE
@@ -64,23 +62,21 @@ void *memset (T *s, int c, size_t n) = delete;
/* True if "T *" is relocatable. I.e., copyable with memcpy/memmove.
I.e., T is either trivially copyable, or void. */
template<typename T>
-struct IsRelocatable
- : gdb::Or<std::is_void<T>,
- std::is_trivially_copyable<T>>
-{};
+struct IsRelocatable : gdb::Or<std::is_void<T>, std::is_trivially_copyable<T>>
+{
+};
/* True if both source and destination are relocatable. */
-template <typename D, typename S>
-using BothAreRelocatable
- = gdb::And<IsRelocatable<D>, IsRelocatable<S>>;
+template<typename D, typename S>
+using BothAreRelocatable = gdb::And<IsRelocatable<D>, IsRelocatable<S>>;
-template <typename D, typename S,
- typename = gdb::Requires<gdb::Not<BothAreRelocatable<D, S>>>>
+template<typename D, typename S,
+ typename = gdb::Requires<gdb::Not<BothAreRelocatable<D, S>>>>
void *memcpy (D *dest, const S *src, size_t n) = delete;
-template <typename D, typename S,
- typename = gdb::Requires<gdb::Not<BothAreRelocatable<D, S>>>>
+template<typename D, typename S,
+ typename = gdb::Requires<gdb::Not<BothAreRelocatable<D, S>>>>
void *memmove (D *dest, const S *src, size_t n) = delete;
#endif /* HAVE_IS_TRIVIALLY_COPYABLE */
@@ -98,7 +94,7 @@ using IsMallocable = std::true_type;
template<typename T>
using IsFreeable = gdb::Or<std::is_trivially_destructible<T>, std::is_void<T>>;
-template <typename T, typename = gdb::Requires<gdb::Not<IsFreeable<T>>>>
+template<typename T, typename = gdb::Requires<gdb::Not<IsFreeable<T>>>>
void free (T *ptr) = delete;
template<typename T>
@@ -111,7 +107,7 @@ data type. Use operator new instead.");
}
#undef XNEW
-#define XNEW(T) xnew<T>()
+#define XNEW(T) xnew<T> ()
template<typename T>
static T *
@@ -123,7 +119,7 @@ data type. Use operator new instead.");
}
#undef XCNEW
-#define XCNEW(T) xcnew<T>()
+#define XCNEW(T) xcnew<T> ()
template<typename T>
static void
@@ -191,7 +187,8 @@ xnewvar (size_t s)
{
static_assert (IsMallocable<T>::value, "Trying to use XNEWVAR with a \
non-POD data type.");
- return XNEWVAR (T, s);;
+ return XNEWVAR (T, s);
+ ;
}
#undef XNEWVAR
diff --git a/gdbsupport/preprocessor.h b/gdbsupport/preprocessor.h
index 26711255c58..cbb24d7d92c 100644
--- a/gdbsupport/preprocessor.h
+++ b/gdbsupport/preprocessor.h
@@ -21,7 +21,7 @@
/* Generally useful preprocessor bits. */
/* Concatenate two tokens. */
-#define CONCAT_1(a, b) a ## b
+#define CONCAT_1(a, b) a##b
#define CONCAT(a, b) CONCAT_1 (a, b)
/* Stringification. */
diff --git a/gdbsupport/print-utils.cc b/gdbsupport/print-utils.cc
index 3cc1ed6a9cb..d24e288e3c3 100644
--- a/gdbsupport/print-utils.cc
+++ b/gdbsupport/print-utils.cc
@@ -65,15 +65,15 @@ decimal2str (const char *sign, ULONGEST addr, int width)
xsnprintf (str, PRINT_CELL_SIZE, "%s%0*lu", sign, width, temp[0]);
break;
case 2:
- xsnprintf (str, PRINT_CELL_SIZE, "%s%0*lu%09lu", sign, width,
- temp[1], temp[0]);
+ xsnprintf (str, PRINT_CELL_SIZE, "%s%0*lu%09lu", sign, width, temp[1],
+ temp[0]);
break;
case 3:
xsnprintf (str, PRINT_CELL_SIZE, "%s%0*lu%09lu%09lu", sign, width,
- temp[2], temp[1], temp[0]);
+ temp[2], temp[1], temp[0]);
break;
default:
- internal_error (_("failed internal consistency check"));
+ internal_error (_ ("failed internal consistency check"));
}
return str;
@@ -103,19 +103,20 @@ octal2str (ULONGEST addr, int width)
{
case 1:
if (temp[0] == 0)
- xsnprintf (str, PRINT_CELL_SIZE, "%*o", width, 0);
+ xsnprintf (str, PRINT_CELL_SIZE, "%*o", width, 0);
else
- xsnprintf (str, PRINT_CELL_SIZE, "0%0*lo", width, temp[0]);
+ xsnprintf (str, PRINT_CELL_SIZE, "0%0*lo", width, temp[0]);
break;
case 2:
- xsnprintf (str, PRINT_CELL_SIZE, "0%0*lo%010lo", width, temp[1], temp[0]);
+ xsnprintf (str, PRINT_CELL_SIZE, "0%0*lo%010lo", width, temp[1],
+ temp[0]);
break;
case 3:
- xsnprintf (str, PRINT_CELL_SIZE, "0%0*lo%010lo%010lo", width,
- temp[2], temp[1], temp[0]);
+ xsnprintf (str, PRINT_CELL_SIZE, "0%0*lo%010lo%010lo", width, temp[2],
+ temp[1], temp[0]);
break;
default:
- internal_error (_("failed internal consistency check"));
+ internal_error (_ ("failed internal consistency check"));
}
return str;
@@ -155,8 +156,8 @@ phex (ULONGEST l, int sizeof_l)
case 8:
str = get_print_cell ();
xsnprintf (str, PRINT_CELL_SIZE, "%08lx%08lx",
- (unsigned long) (l >> thirty_two),
- (unsigned long) (l & 0xffffffff));
+ (unsigned long) (l >> thirty_two),
+ (unsigned long) (l & 0xffffffff));
break;
case 4:
str = get_print_cell ();
@@ -189,16 +190,16 @@ phex_nz (ULONGEST l, int sizeof_l)
{
case 8:
{
- unsigned long high = (unsigned long) (l >> thirty_two);
-
- str = get_print_cell ();
- if (high == 0)
- xsnprintf (str, PRINT_CELL_SIZE, "%lx",
- (unsigned long) (l & 0xffffffff));
- else
- xsnprintf (str, PRINT_CELL_SIZE, "%lx%08lx", high,
- (unsigned long) (l & 0xffffffff));
- break;
+ unsigned long high = (unsigned long) (l >> thirty_two);
+
+ str = get_print_cell ();
+ if (high == 0)
+ xsnprintf (str, PRINT_CELL_SIZE, "%lx",
+ (unsigned long) (l & 0xffffffff));
+ else
+ xsnprintf (str, PRINT_CELL_SIZE, "%lx%08lx", high,
+ (unsigned long) (l & 0xffffffff));
+ break;
}
case 4:
str = get_print_cell ();
@@ -244,7 +245,7 @@ hex_string_custom (LONGEST num, int width)
if (hex_len > width)
width = hex_len;
if (width + 2 >= PRINT_CELL_SIZE)
- internal_error (_("\
+ internal_error (_ ("\
hex_string_custom: insufficient space to store result"));
strcpy (result_end - width - 2, "0x");
@@ -256,45 +257,44 @@ hex_string_custom: insufficient space to store result"));
/* See print-utils.h. */
char *
-int_string (LONGEST val, int radix, int is_signed, int width,
- int use_c_format)
+int_string (LONGEST val, int radix, int is_signed, int width, int use_c_format)
{
switch (radix)
{
case 16:
{
- char *result;
-
- if (width == 0)
- result = hex_string (val);
- else
- result = hex_string_custom (val, width);
- if (! use_c_format)
- result += 2;
- return result;
+ char *result;
+
+ if (width == 0)
+ result = hex_string (val);
+ else
+ result = hex_string_custom (val, width);
+ if (!use_c_format)
+ result += 2;
+ return result;
}
case 10:
{
- if (is_signed && val < 0)
- /* Cast to unsigned before negating, to prevent runtime error:
+ if (is_signed && val < 0)
+ /* Cast to unsigned before negating, to prevent runtime error:
negation of -9223372036854775808 cannot be represented in type
'long int'; cast to an unsigned type to negate this value to
itself. */
- return decimal2str ("-", -(ULONGEST)val, width);
- else
- return decimal2str ("", val, width);
+ return decimal2str ("-", -(ULONGEST) val, width);
+ else
+ return decimal2str ("", val, width);
}
case 8:
{
- char *result = octal2str (val, width);
+ char *result = octal2str (val, width);
- if (use_c_format || val == 0)
- return result;
- else
- return result + 1;
+ if (use_c_format || val == 0)
+ return result;
+ else
+ return result + 1;
}
default:
- internal_error (_("failed internal consistency check"));
+ internal_error (_ ("failed internal consistency check"));
}
}
@@ -330,6 +330,6 @@ host_address_to_string_1 (const void *addr)
char *str = get_print_cell ();
xsnprintf (str, PRINT_CELL_SIZE, "0x%s",
- phex_nz ((uintptr_t) addr, sizeof (addr)));
+ phex_nz ((uintptr_t) addr, sizeof (addr)));
return str;
}
diff --git a/gdbsupport/print-utils.h b/gdbsupport/print-utils.h
index 7df9b0d9bf3..1cc3164ee4d 100644
--- a/gdbsupport/print-utils.h
+++ b/gdbsupport/print-utils.h
@@ -63,8 +63,8 @@ extern char *hex_string_custom (LONGEST num, int width);
* to use C format in all cases. If it is false, then 'x'
* and 'o' formats do not include a prefix (0x or leading 0). */
-extern char *int_string (LONGEST val, int radix, int is_signed, int width,
- int use_c_format);
+extern char *int_string (LONGEST val, int radix, int is_signed, int width,
+ int use_c_format);
/* Convert a CORE_ADDR into a string. */
diff --git a/gdbsupport/ptid.h b/gdbsupport/ptid.h
index aa296b83181..deb2ea83d9b 100644
--- a/gdbsupport/ptid.h
+++ b/gdbsupport/ptid.h
@@ -53,33 +53,31 @@ public:
represent a whole process, including all its lwps/threads. */
explicit constexpr ptid_t (pid_type pid, lwp_type lwp = 0, tid_type tid = 0)
- : m_pid (pid), m_lwp (lwp), m_tid (tid)
- {}
+ : m_pid (pid),
+ m_lwp (lwp),
+ m_tid (tid)
+ {
+ }
/* Fetch the pid (process id) component from the ptid. */
- constexpr pid_type pid () const
- { return m_pid; }
+ constexpr pid_type pid () const { return m_pid; }
/* Return true if the ptid's lwp member is non-zero. */
- constexpr bool lwp_p () const
- { return m_lwp != 0; }
+ constexpr bool lwp_p () const { return m_lwp != 0; }
/* Fetch the lwp (lightweight process) component from the ptid. */
- constexpr lwp_type lwp () const
- { return m_lwp; }
+ constexpr lwp_type lwp () const { return m_lwp; }
/* Return true if the ptid's tid member is non-zero. */
- constexpr bool tid_p () const
- { return m_tid != 0; }
+ constexpr bool tid_p () const { return m_tid != 0; }
/* Fetch the tid (thread id) component from a ptid. */
- constexpr tid_type tid () const
- { return m_tid; }
+ constexpr tid_type tid () const { return m_tid; }
/* Return true if the ptid represents a whole process, including all its
lwps/threads. Such ptids have the form of (pid, 0, 0), with
@@ -87,19 +85,16 @@ public:
constexpr bool is_pid () const
{
- return (*this != make_null ()
- && *this != make_minus_one ()
- && m_lwp == 0
- && m_tid == 0);
+ return (*this != make_null () && *this != make_minus_one () && m_lwp == 0
+ && m_tid == 0);
}
/* Compare two ptids to see if they are equal. */
constexpr bool operator== (const ptid_t &other) const
{
- return (m_pid == other.m_pid
- && m_lwp == other.m_lwp
- && m_tid == other.m_tid);
+ return (m_pid == other.m_pid && m_lwp == other.m_lwp
+ && m_tid == other.m_tid);
}
/* Compare two ptids to see if they are different. */
@@ -120,14 +115,14 @@ public:
constexpr bool matches (const ptid_t &filter) const
{
return (/* If filter represents any ptid, it's always a match. */
- filter == make_minus_one ()
- /* If filter is only a pid, any ptid with that pid
+ filter == make_minus_one ()
+ /* If filter is only a pid, any ptid with that pid
matches. */
- || (filter.is_pid () && m_pid == filter.pid ())
+ || (filter.is_pid () && m_pid == filter.pid ())
- /* Otherwise, this ptid only matches if it's exactly equal
+ /* Otherwise, this ptid only matches if it's exactly equal
to filter. */
- || *this == filter);
+ || *this == filter);
}
/* Return a string representation of the ptid.
@@ -138,13 +133,11 @@ public:
/* Make a null ptid. */
- static constexpr ptid_t make_null ()
- { return ptid_t (0, 0, 0); }
+ static constexpr ptid_t make_null () { return ptid_t (0, 0, 0); }
/* Make a minus one ptid. */
- static constexpr ptid_t make_minus_one ()
- { return ptid_t (-1, 0, 0); }
+ static constexpr ptid_t make_minus_one () { return ptid_t (-1, 0, 0); }
private:
/* Process id. */
@@ -165,9 +158,8 @@ struct hash_ptid
{
std::hash<long> long_hash;
- return (long_hash (ptid.pid ())
- + long_hash (ptid.lwp ())
- + long_hash (ptid.tid ()));
+ return (long_hash (ptid.pid ()) + long_hash (ptid.lwp ())
+ + long_hash (ptid.tid ()));
}
};
diff --git a/gdbsupport/range-chain.h b/gdbsupport/range-chain.h
index 01d6cf0e4fc..12cf7e6b242 100644
--- a/gdbsupport/range-chain.h
+++ b/gdbsupport/range-chain.h
@@ -29,10 +29,9 @@ struct range_chain
class iterator
{
public:
-
iterator (const std::vector<Range> &ranges, size_t idx)
: m_index (idx),
- m_ranges (ranges)
+ m_ranges (ranges)
{
skip_empty ();
}
@@ -40,27 +39,24 @@ struct range_chain
bool operator== (const iterator &other) const
{
if (m_index != other.m_index || &m_ranges != &other.m_ranges)
- return false;
+ return false;
if (m_current.has_value () != other.m_current.has_value ())
- return false;
+ return false;
if (m_current.has_value ())
- return *m_current == *other.m_current;
+ return *m_current == *other.m_current;
return true;
}
- bool operator!= (const iterator &other) const
- {
- return !(*this == other);
- }
+ bool operator!= (const iterator &other) const { return !(*this == other); }
iterator &operator++ ()
{
++*m_current;
if (*m_current == m_ranges[m_index].end ())
- {
- ++m_index;
- skip_empty ();
- }
+ {
+ ++m_index;
+ skip_empty ();
+ }
return *this;
}
@@ -76,11 +72,11 @@ struct range_chain
void skip_empty ()
{
for (; m_index < m_ranges.size (); ++m_index)
- {
- m_current = m_ranges[m_index].begin ();
- if (*m_current != m_ranges[m_index].end ())
- return;
- }
+ {
+ m_current = m_ranges[m_index].begin ();
+ if (*m_current != m_ranges[m_index].end ())
+ return;
+ }
m_current.reset ();
}
@@ -97,23 +93,15 @@ struct range_chain
/* Create a new range_chain. */
template<typename T>
- range_chain (T &&ranges)
- : m_ranges (std::forward<T> (ranges))
+ range_chain (T &&ranges) : m_ranges (std::forward<T> (ranges))
{
}
- iterator begin () const
- {
- return iterator (m_ranges, 0);
- }
+ iterator begin () const { return iterator (m_ranges, 0); }
- iterator end () const
- {
- return iterator (m_ranges, m_ranges.size ());
- }
+ iterator end () const { return iterator (m_ranges, m_ranges.size ()); }
private:
-
/* The sub-ranges. */
std::vector<Range> m_ranges;
};
diff --git a/gdbsupport/refcounted-object.h b/gdbsupport/refcounted-object.h
index d8fdb950043..eca885c8e97 100644
--- a/gdbsupport/refcounted-object.h
+++ b/gdbsupport/refcounted-object.h
@@ -56,15 +56,9 @@ private:
struct refcounted_object_ref_policy
{
- static void incref (refcounted_object *ptr)
- {
- ptr->incref ();
- }
+ static void incref (refcounted_object *ptr) { ptr->incref (); }
- static void decref (refcounted_object *ptr)
- {
- ptr->decref ();
- }
+ static void decref (refcounted_object *ptr) { ptr->decref (); }
};
#endif /* COMMON_REFCOUNTED_OBJECT_H */
diff --git a/gdbsupport/reference-to-pointer-iterator.h b/gdbsupport/reference-to-pointer-iterator.h
index 792659b1611..07b713a891b 100644
--- a/gdbsupport/reference-to-pointer-iterator.h
+++ b/gdbsupport/reference-to-pointer-iterator.h
@@ -26,7 +26,7 @@
lists, which yield references, and the rest of GDB, which for legacy reasons
expects to iterate on pointers. */
-template <typename IteratorType>
+template<typename IteratorType>
struct reference_to_pointer_iterator
{
using self_type = reference_to_pointer_iterator;
@@ -38,29 +38,32 @@ struct reference_to_pointer_iterator
/* Construct a reference_to_pointer_iterator, passing args to the underyling
iterator. */
- template <typename... Args>
+ template<typename... Args>
reference_to_pointer_iterator (Args &&...args)
: m_it (std::forward<Args> (args)...)
- {}
+ {
+ }
/* Create a past-the-end iterator.
Assumes that default-constructing an underlying iterator creates a
past-the-end iterator. */
- reference_to_pointer_iterator ()
- {}
+ reference_to_pointer_iterator () {}
/* Need these as the variadic constructor would be a better match
otherwise. */
reference_to_pointer_iterator (reference_to_pointer_iterator &) = default;
- reference_to_pointer_iterator (const reference_to_pointer_iterator &) = default;
+ reference_to_pointer_iterator (const reference_to_pointer_iterator &)
+ = default;
reference_to_pointer_iterator (reference_to_pointer_iterator &&) = default;
- reference_to_pointer_iterator &operator= (const reference_to_pointer_iterator &) = default;
- reference_to_pointer_iterator &operator= (reference_to_pointer_iterator &&) = default;
+ reference_to_pointer_iterator &
+ operator= (const reference_to_pointer_iterator &)
+ = default;
+ reference_to_pointer_iterator &operator= (reference_to_pointer_iterator &&)
+ = default;
- value_type operator* () const
- { return &*m_it; }
+ value_type operator* () const { return &*m_it; }
self_type &operator++ ()
{
@@ -68,11 +71,9 @@ struct reference_to_pointer_iterator
return *this;
}
- bool operator== (const self_type &other) const
- { return m_it == other.m_it; }
+ bool operator== (const self_type &other) const { return m_it == other.m_it; }
- bool operator!= (const self_type &other) const
- { return m_it != other.m_it; }
+ bool operator!= (const self_type &other) const { return m_it != other.m_it; }
private:
/* The underlying iterator. */
diff --git a/gdbsupport/rsp-low.cc b/gdbsupport/rsp-low.cc
index 3d8c2002956..a06f63d7d51 100644
--- a/gdbsupport/rsp-low.cc
+++ b/gdbsupport/rsp-low.cc
@@ -78,8 +78,8 @@ pack_hex_byte (char *pkt, int byte)
/* See rsp-low.h. */
const char *
-unpack_varlen_hex (const char *buff, /* packet to parse */
- ULONGEST *result)
+unpack_varlen_hex (const char *buff, /* packet to parse */
+ ULONGEST *result)
{
int nibble;
ULONGEST retval = 0;
@@ -113,11 +113,11 @@ hex2str (const char *hex, int count)
for (size_t i = 0; i < count; ++i)
{
if (hex[0] == '\0' || hex[1] == '\0')
- {
- /* Hex string is short, or of uneven length. Return what we
+ {
+ /* Hex string is short, or of uneven length. Return what we
have so far. */
- return ret;
- }
+ return ret;
+ }
ret += fromhex (hex[0]) * 16 + fromhex (hex[1]);
hex += 2;
}
@@ -170,8 +170,8 @@ needs_escaping (gdb_byte b)
int
remote_escape_output (const gdb_byte *buffer, int len_units, int unit_size,
- gdb_byte *out_buf, int *out_len_units,
- int out_maxlen_bytes)
+ gdb_byte *out_buf, int *out_len_units,
+ int out_maxlen_bytes)
{
int input_unit_index, output_byte_index = 0, byte_index_in_unit;
int number_escape_bytes_needed;
@@ -179,42 +179,38 @@ remote_escape_output (const gdb_byte *buffer, int len_units, int unit_size,
/* Try to copy integral addressable memory units until
(1) we run out of space or
(2) we copied all of them. */
- for (input_unit_index = 0;
- input_unit_index < len_units;
- input_unit_index++)
+ for (input_unit_index = 0; input_unit_index < len_units; input_unit_index++)
{
/* Find out how many escape bytes we need for this unit. */
number_escape_bytes_needed = 0;
- for (byte_index_in_unit = 0;
- byte_index_in_unit < unit_size;
- byte_index_in_unit++)
- {
- int idx = input_unit_index * unit_size + byte_index_in_unit;
- gdb_byte b = buffer[idx];
- if (needs_escaping (b))
- number_escape_bytes_needed++;
- }
+ for (byte_index_in_unit = 0; byte_index_in_unit < unit_size;
+ byte_index_in_unit++)
+ {
+ int idx = input_unit_index * unit_size + byte_index_in_unit;
+ gdb_byte b = buffer[idx];
+ if (needs_escaping (b))
+ number_escape_bytes_needed++;
+ }
/* Check if we have room to fit this escaped unit. */
- if (output_byte_index + unit_size + number_escape_bytes_needed >
- out_maxlen_bytes)
- break;
+ if (output_byte_index + unit_size + number_escape_bytes_needed
+ > out_maxlen_bytes)
+ break;
/* Copy the unit byte per byte, adding escapes. */
- for (byte_index_in_unit = 0;
- byte_index_in_unit < unit_size;
- byte_index_in_unit++)
- {
- int idx = input_unit_index * unit_size + byte_index_in_unit;
- gdb_byte b = buffer[idx];
- if (needs_escaping (b))
- {
- out_buf[output_byte_index++] = '}';
- out_buf[output_byte_index++] = b ^ 0x20;
- }
- else
- out_buf[output_byte_index++] = b;
- }
+ for (byte_index_in_unit = 0; byte_index_in_unit < unit_size;
+ byte_index_in_unit++)
+ {
+ int idx = input_unit_index * unit_size + byte_index_in_unit;
+ gdb_byte b = buffer[idx];
+ if (needs_escaping (b))
+ {
+ out_buf[output_byte_index++] = '}';
+ out_buf[output_byte_index++] = b ^ 0x20;
+ }
+ else
+ out_buf[output_byte_index++] = b;
+ }
}
*out_len_units = input_unit_index;
@@ -224,8 +220,8 @@ remote_escape_output (const gdb_byte *buffer, int len_units, int unit_size,
/* See rsp-low.h. */
int
-remote_unescape_input (const gdb_byte *buffer, int len,
- gdb_byte *out_buf, int out_maxlen)
+remote_unescape_input (const gdb_byte *buffer, int len, gdb_byte *out_buf,
+ int out_maxlen)
{
int input_index, output_index;
int escaped;
@@ -237,22 +233,21 @@ remote_unescape_input (const gdb_byte *buffer, int len,
gdb_byte b = buffer[input_index];
if (output_index + 1 > out_maxlen)
- error (_("Received too much data from the target."));
+ error (_ ("Received too much data from the target."));
if (escaped)
- {
- out_buf[output_index++] = b ^ 0x20;
- escaped = 0;
- }
+ {
+ out_buf[output_index++] = b ^ 0x20;
+ escaped = 0;
+ }
else if (b == '}')
- escaped = 1;
+ escaped = 1;
else
- out_buf[output_index++] = b;
+ out_buf[output_index++] = b;
}
if (escaped)
- error (_("Unmatched escape character in target response."));
+ error (_ ("Unmatched escape character in target response."));
return output_index;
}
-
diff --git a/gdbsupport/rsp-low.h b/gdbsupport/rsp-low.h
index 327d5f3a094..99e320c0001 100644
--- a/gdbsupport/rsp-low.h
+++ b/gdbsupport/rsp-low.h
@@ -67,8 +67,8 @@ extern std::string bin2hex (const gdb_byte *bin, int count);
for the server side as well as the client. */
extern int remote_escape_output (const gdb_byte *buffer, int len_units,
- int unit_size, gdb_byte *out_buf,
- int *out_len_units, int out_maxlen_bytes);
+ int unit_size, gdb_byte *out_buf,
+ int *out_len_units, int out_maxlen_bytes);
/* Convert BUFFER, escaped data LEN bytes long, into binary data
in OUT_BUF. Return the number of bytes written to OUT_BUF.
@@ -77,6 +77,6 @@ extern int remote_escape_output (const gdb_byte *buffer, int len_units,
This function reverses remote_escape_output. */
extern int remote_unescape_input (const gdb_byte *buffer, int len,
- gdb_byte *out_buf, int out_maxlen);
+ gdb_byte *out_buf, int out_maxlen);
#endif /* COMMON_RSP_LOW_H */
diff --git a/gdbsupport/run-time-clock.cc b/gdbsupport/run-time-clock.cc
index 77230d04534..f661314dd03 100644
--- a/gdbsupport/run-time-clock.cc
+++ b/gdbsupport/run-time-clock.cc
@@ -40,7 +40,7 @@ timeval_to_microseconds (struct timeval *tv)
void
run_time_clock::now (user_cpu_time_clock::time_point &user,
- system_cpu_time_clock::time_point &system) noexcept
+ system_cpu_time_clock::time_point &system) noexcept
{
#ifdef HAVE_GETRUSAGE
struct rusage rusage;
diff --git a/gdbsupport/run-time-clock.h b/gdbsupport/run-time-clock.h
index 41944b1a80e..f23f0e8c285 100644
--- a/gdbsupport/run-time-clock.h
+++ b/gdbsupport/run-time-clock.h
@@ -69,7 +69,7 @@ struct run_time_clock
supported. If not supported, then the combined user+kernel time
is returned in USER and SYSTEM is set to zero. */
static void now (user_cpu_time_clock::time_point &user,
- system_cpu_time_clock::time_point &system) noexcept;
+ system_cpu_time_clock::time_point &system) noexcept;
};
#endif /* COMMON_RUN_TIME_CLOCK_H */
diff --git a/gdbsupport/safe-iterator.h b/gdbsupport/safe-iterator.h
index bc8b4356540..433fb9e6d85 100644
--- a/gdbsupport/safe-iterator.h
+++ b/gdbsupport/safe-iterator.h
@@ -72,8 +72,7 @@ public:
}
/* Create a one-past-end iterator. */
- basic_safe_iterator ()
- {}
+ basic_safe_iterator () {}
value_type operator* () const { return *m_it; }
@@ -85,11 +84,9 @@ public:
return *this;
}
- bool operator== (const self_type &other) const
- { return m_it == other.m_it; }
+ bool operator== (const self_type &other) const { return m_it == other.m_it; }
- bool operator!= (const self_type &other) const
- { return m_it != other.m_it; }
+ bool operator!= (const self_type &other) const { return m_it != other.m_it; }
private:
/* The current element. */
@@ -109,26 +106,15 @@ template<typename Range>
class basic_safe_range
{
public:
-
typedef basic_safe_iterator<typename Range::iterator> iterator;
- explicit basic_safe_range (Range range)
- : m_range (range)
- {
- }
+ explicit basic_safe_range (Range range) : m_range (range) {}
- iterator begin ()
- {
- return iterator (m_range.begin (), m_range.end ());
- }
+ iterator begin () { return iterator (m_range.begin (), m_range.end ()); }
- iterator end ()
- {
- return iterator (m_range.end (), m_range.end ());
- }
+ iterator end () { return iterator (m_range.end (), m_range.end ()); }
private:
-
Range m_range;
};
diff --git a/gdbsupport/scope-exit.h b/gdbsupport/scope-exit.h
index cb8d9255869..41a82180512 100644
--- a/gdbsupport/scope-exit.h
+++ b/gdbsupport/scope-exit.h
@@ -54,7 +54,7 @@
that inherit this implement the on_exit() method, which is called
from scope_exit_base's dtor. */
-template <typename CRTP>
+template<typename CRTP>
class scope_exit_base
{
public:
@@ -64,8 +64,8 @@ public:
{
if (!m_released)
{
- auto *self = static_cast<CRTP *> (this);
- self->on_exit ();
+ auto *self = static_cast<CRTP *> (this);
+ self->on_exit ();
}
}
@@ -82,13 +82,9 @@ public:
/* If this is called, then the wrapped function will not be called
on destruction. */
- void release () noexcept
- {
- m_released = true;
- }
+ void release () noexcept { m_released = true; }
private:
-
/* True if released. Mutable because of the copy ctor hack
above. */
mutable bool m_released = false;
@@ -103,16 +99,15 @@ class scope_exit : public scope_exit_base<scope_exit<EF>>
friend scope_exit_base<scope_exit<EF>>;
public:
-
template<typename EFP,
- typename = gdb::Requires<std::is_constructible<EF, EFP>>>
+ typename = gdb::Requires<std::is_constructible<EF, EFP>>>
scope_exit (EFP &&f)
- try : m_exit_function ((!std::is_lvalue_reference<EFP>::value
- && std::is_nothrow_constructible<EF, EFP>::value)
- ? std::move (f)
- : f)
- {
- }
+ try : m_exit_function ((!std::is_lvalue_reference<EFP>::value
+ && std::is_nothrow_constructible<EF, EFP>::value)
+ ? std::move (f)
+ : f)
+ {
+ }
catch (...)
{
/* "If the initialization of exit_function throws an exception,
@@ -121,13 +116,12 @@ public:
}
template<typename EFP,
- typename = gdb::Requires<std::is_constructible<EF, EFP>>>
- scope_exit (scope_exit &&rhs)
- noexcept (std::is_nothrow_move_constructible<EF>::value
- || std::is_nothrow_copy_constructible<EF>::value)
- : m_exit_function (std::is_nothrow_constructible<EFP>::value
- ? std::move (rhs)
- : rhs)
+ typename = gdb::Requires<std::is_constructible<EF, EFP>>>
+ scope_exit (scope_exit &&rhs) noexcept (
+ std::is_nothrow_move_constructible<EF>::value
+ || std::is_nothrow_copy_constructible<EF>::value)
+ : m_exit_function (
+ std::is_nothrow_constructible<EFP>::value ? std::move (rhs) : rhs)
{
rhs.release ();
}
@@ -145,16 +139,13 @@ public:
void operator= (scope_exit &&) = delete;
private:
- void on_exit ()
- {
- m_exit_function ();
- }
+ void on_exit () { m_exit_function (); }
/* The function to call on scope exit. */
EF m_exit_function;
};
-template <typename EF>
+template<typename EF>
scope_exit<typename std::decay<EF>::type>
make_scope_exit (EF &&f)
{
@@ -164,7 +155,9 @@ make_scope_exit (EF &&f)
namespace detail
{
-enum class scope_exit_lhs {};
+enum class scope_exit_lhs
+{
+};
template<typename EF>
scope_exit<typename std::decay<EF>::type>
@@ -173,7 +166,7 @@ operator+ (scope_exit_lhs, EF &&rhs)
return scope_exit<typename std::decay<EF>::type> (std::forward<EF> (rhs));
}
-}
+} // namespace detail
/* Register a block of code to run on scope exit. Note that the local
context is captured by reference, which means you should be careful
@@ -181,6 +174,6 @@ operator+ (scope_exit_lhs, EF &&rhs)
scope exit runs. */
#define SCOPE_EXIT \
- auto CONCAT(scope_exit_, __LINE__) = ::detail::scope_exit_lhs () + [&] ()
+ auto CONCAT (scope_exit_, __LINE__) = ::detail::scope_exit_lhs () + [&]()
#endif /* COMMON_SCOPE_EXIT_H */
diff --git a/gdbsupport/scoped_fd.h b/gdbsupport/scoped_fd.h
index 6c0d4af9991..80d3082e2e5 100644
--- a/gdbsupport/scoped_fd.h
+++ b/gdbsupport/scoped_fd.h
@@ -30,8 +30,7 @@ class scoped_fd
public:
explicit scoped_fd (int fd = -1) noexcept : m_fd (fd) {}
- scoped_fd (scoped_fd &&other) noexcept
- : m_fd (other.m_fd)
+ scoped_fd (scoped_fd &&other) noexcept : m_fd (other.m_fd)
{
other.m_fd = -1;
}
@@ -46,10 +45,10 @@ public:
{
if (m_fd != other.m_fd)
{
- if (m_fd >= 0)
- close (m_fd);
- m_fd = other.m_fd;
- other.m_fd = -1;
+ if (m_fd >= 0)
+ close (m_fd);
+ m_fd = other.m_fd;
+ other.m_fd = -1;
}
return *this;
}
@@ -75,10 +74,7 @@ public:
return result;
}
- int get () const noexcept
- {
- return m_fd;
- }
+ int get () const noexcept { return m_fd; }
private:
int m_fd;
diff --git a/gdbsupport/scoped_ignore_signal.h b/gdbsupport/scoped_ignore_signal.h
index 1c015a9f5e8..4b6ab5c73e9 100644
--- a/gdbsupport/scoped_ignore_signal.h
+++ b/gdbsupport/scoped_ignore_signal.h
@@ -34,7 +34,7 @@
destructor could consume a signal raised due to actions done by
some other thread. */
-template <int Sig, bool ConsumePending>
+template<int Sig, bool ConsumePending>
class scoped_ignore_signal
{
public:
@@ -57,34 +57,34 @@ public:
#ifdef HAVE_SIGPROCMASK
if (!m_was_blocked)
{
- sigset_t set;
+ sigset_t set;
- sigemptyset (&set);
- sigaddset (&set, Sig);
+ sigemptyset (&set);
+ sigaddset (&set, Sig);
- /* If we got a pending Sig signal, consume it before
+ /* If we got a pending Sig signal, consume it before
unblocking. */
- if (ConsumePending)
- {
+ if (ConsumePending)
+ {
#ifdef HAVE_SIGTIMEDWAIT
- const timespec zero_timeout = {};
+ const timespec zero_timeout = {};
- sigtimedwait (&set, nullptr, &zero_timeout);
+ sigtimedwait (&set, nullptr, &zero_timeout);
#else
- sigset_t pending;
+ sigset_t pending;
- sigpending (&pending);
- if (sigismember (&pending, Sig))
- {
- int sig_found;
+ sigpending (&pending);
+ if (sigismember (&pending, Sig))
+ {
+ int sig_found;
- sigwait (&set, &sig_found);
- gdb_assert (sig_found == Sig);
- }
+ sigwait (&set, &sig_found);
+ gdb_assert (sig_found == Sig);
+ }
#endif
- }
+ }
- sigprocmask (SIG_UNBLOCK, &set, nullptr);
+ sigprocmask (SIG_UNBLOCK, &set, nullptr);
}
#else
signal (Sig, m_osig);
@@ -105,10 +105,8 @@ struct scoped_ignore_signal_nop
{
/* Note, these can't both be "= default", because otherwise the
compiler warns that variables of this type are not used. */
- scoped_ignore_signal_nop ()
- {}
- ~scoped_ignore_signal_nop ()
- {}
+ scoped_ignore_signal_nop () {}
+ ~scoped_ignore_signal_nop () {}
DISABLE_COPY_AND_ASSIGN (scoped_ignore_signal_nop);
};
diff --git a/gdbsupport/scoped_ignore_sigttou.h b/gdbsupport/scoped_ignore_sigttou.h
index aa01df25220..35c9e85881a 100644
--- a/gdbsupport/scoped_ignore_sigttou.h
+++ b/gdbsupport/scoped_ignore_sigttou.h
@@ -32,15 +32,9 @@ template<typename T>
class lazy_init
{
public:
- void emplace ()
- {
- new (&m_u.obj) T ();
- }
+ void emplace () { new (&m_u.obj) T (); }
- void reset ()
- {
- m_u.obj.~T ();
- }
+ void reset () { m_u.obj.~T (); }
private:
union u
diff --git a/gdbsupport/scoped_mmap.cc b/gdbsupport/scoped_mmap.cc
index e4096da95d0..08334d35407 100644
--- a/gdbsupport/scoped_mmap.cc
+++ b/gdbsupport/scoped_mmap.cc
@@ -37,9 +37,10 @@ mmap_file (const char *filename)
/* We can't map an empty file. */
if (size == 0)
- error (_("file to mmap is empty"));
+ error (_ ("file to mmap is empty"));
- scoped_mmap mmapped_file (nullptr, size, PROT_READ, MAP_PRIVATE, fd.get (), 0);
+ scoped_mmap mmapped_file (nullptr, size, PROT_READ, MAP_PRIVATE, fd.get (),
+ 0);
if (mmapped_file.get () == MAP_FAILED)
perror_with_name (("mmap"));
diff --git a/gdbsupport/scoped_mmap.h b/gdbsupport/scoped_mmap.h
index 456e5cefcc5..e0c15c005eb 100644
--- a/gdbsupport/scoped_mmap.h
+++ b/gdbsupport/scoped_mmap.h
@@ -32,15 +32,13 @@ class scoped_mmap
public:
scoped_mmap () noexcept : m_mem (MAP_FAILED), m_length (0) {}
scoped_mmap (void *addr, size_t length, int prot, int flags, int fd,
- off_t offset) noexcept : m_length (length)
+ off_t offset) noexcept
+ : m_length (length)
{
m_mem = mmap (addr, m_length, prot, flags, fd, offset);
}
- ~scoped_mmap ()
- {
- destroy ();
- }
+ ~scoped_mmap () { destroy (); }
scoped_mmap (scoped_mmap &&rhs) noexcept
: m_mem (rhs.m_mem),
@@ -61,7 +59,7 @@ public:
}
void reset (void *addr, size_t length, int prot, int flags, int fd,
- off_t offset) noexcept
+ off_t offset) noexcept
{
destroy ();
diff --git a/gdbsupport/scoped_restore.h b/gdbsupport/scoped_restore.h
index b7f31693669..9439b9f83df 100644
--- a/gdbsupport/scoped_restore.h
+++ b/gdbsupport/scoped_restore.h
@@ -26,13 +26,10 @@ class scoped_restore_base
public:
/* This informs the (scoped_restore_tmpl<T>) dtor that you no longer
want the original value restored. */
- void release () const
- { m_saved_var = NULL; }
+ void release () const { m_saved_var = NULL; }
protected:
- scoped_restore_base (void *saved_var)
- : m_saved_var (saved_var)
- {}
+ scoped_restore_base (void *saved_var) : m_saved_var (saved_var) {}
/* The type-erased saved variable. This is here so that clients can
call release() on a "scoped_restore" local, which is a typedef to
@@ -49,8 +46,7 @@ typedef const scoped_restore_base &scoped_restore;
template<typename T>
class scoped_restore_tmpl : public scoped_restore_base
{
- public:
-
+public:
/* Create a new scoped_restore object that saves the current value
of *VAR. *VAR will be restored when this scoped_restore object
is destroyed. */
@@ -65,7 +61,7 @@ class scoped_restore_tmpl : public scoped_restore_base
scoped_restore object is destroyed. This is templated on T2 to
allow passing VALUEs of types convertible to T.
E.g.: T='base'; T2='derived'. */
- template <typename T2>
+ template<typename T2>
scoped_restore_tmpl (T *var, T2 value)
: scoped_restore_base (var),
m_saved_value (*var)
@@ -74,7 +70,7 @@ class scoped_restore_tmpl : public scoped_restore_base
}
scoped_restore_tmpl (const scoped_restore_tmpl<T> &other)
- : scoped_restore_base {other.m_saved_var},
+ : scoped_restore_base { other.m_saved_var },
m_saved_value (other.m_saved_value)
{
other.m_saved_var = NULL;
@@ -89,8 +85,7 @@ class scoped_restore_tmpl : public scoped_restore_base
private:
/* Return a pointer to the saved variable with its type
restored. */
- T *saved_var ()
- { return static_cast<T *> (m_saved_var); }
+ T *saved_var () { return static_cast<T *> (m_saved_var); }
/* No need for this. It is intentionally not defined anywhere. */
scoped_restore_tmpl &operator= (const scoped_restore_tmpl &);
@@ -102,7 +97,8 @@ private:
/* Make a scoped_restore. This is useful because it lets template
argument deduction work. */
template<typename T>
-scoped_restore_tmpl<T> make_scoped_restore (T *var)
+scoped_restore_tmpl<T>
+make_scoped_restore (T *var)
{
return scoped_restore_tmpl<T> (var);
}
@@ -110,7 +106,8 @@ scoped_restore_tmpl<T> make_scoped_restore (T *var)
/* Make a scoped_restore. This is useful because it lets template
argument deduction work. */
template<typename T, typename T2>
-scoped_restore_tmpl<T> make_scoped_restore (T *var, T2 value)
+scoped_restore_tmpl<T>
+make_scoped_restore (T *var, T2 value)
{
return scoped_restore_tmpl<T> (var, value);
}
diff --git a/gdbsupport/search.cc b/gdbsupport/search.cc
index ace02d7e3c8..99c6e0124cc 100644
--- a/gdbsupport/search.cc
+++ b/gdbsupport/search.cc
@@ -27,11 +27,10 @@
target side with, for example, gdbserver). */
int
-simple_search_memory
- (gdb::function_view<target_read_memory_ftype> read_memory,
- CORE_ADDR start_addr, ULONGEST search_space_len,
- const gdb_byte *pattern, ULONGEST pattern_len,
- CORE_ADDR *found_addrp)
+simple_search_memory (gdb::function_view<target_read_memory_ftype> read_memory,
+ CORE_ADDR start_addr, ULONGEST search_space_len,
+ const gdb_byte *pattern, ULONGEST pattern_len,
+ CORE_ADDR *found_addrp)
{
const unsigned chunk_size = SEARCH_CHUNK_SIZE;
/* Buffer to hold memory contents for searching. */
@@ -49,9 +48,9 @@ simple_search_memory
if (!read_memory (start_addr, search_buf.data (), search_buf_size))
{
- warning (_("Unable to access %s bytes of target "
- "memory at %s, halting search."),
- pulongest (search_buf_size), hex_string (start_addr));
+ warning (_ ("Unable to access %s bytes of target "
+ "memory at %s, halting search."),
+ pulongest (search_buf_size), hex_string (start_addr));
return -1;
}
@@ -65,53 +64,52 @@ simple_search_memory
{
gdb_byte *found_ptr;
unsigned nr_search_bytes
- = std::min (search_space_len, (ULONGEST) search_buf_size);
+ = std::min (search_space_len, (ULONGEST) search_buf_size);
found_ptr = (gdb_byte *) memmem (search_buf.data (), nr_search_bytes,
- pattern, pattern_len);
+ pattern, pattern_len);
if (found_ptr != NULL)
- {
- CORE_ADDR found_addr = start_addr + (found_ptr - search_buf.data ());
+ {
+ CORE_ADDR found_addr = start_addr + (found_ptr - search_buf.data ());
- *found_addrp = found_addr;
- return 1;
- }
+ *found_addrp = found_addr;
+ return 1;
+ }
/* Not found in this chunk, skip to next chunk. */
/* Don't let search_space_len wrap here, it's unsigned. */
if (search_space_len >= chunk_size)
- search_space_len -= chunk_size;
+ search_space_len -= chunk_size;
else
- search_space_len = 0;
+ search_space_len = 0;
if (search_space_len >= pattern_len)
- {
- unsigned keep_len = search_buf_size - chunk_size;
- CORE_ADDR read_addr = start_addr + chunk_size + keep_len;
- int nr_to_read;
+ {
+ unsigned keep_len = search_buf_size - chunk_size;
+ CORE_ADDR read_addr = start_addr + chunk_size + keep_len;
+ int nr_to_read;
- /* Copy the trailing part of the previous iteration to the front
+ /* Copy the trailing part of the previous iteration to the front
of the buffer for the next iteration. */
- gdb_assert (keep_len == pattern_len - 1);
- if (keep_len > 0)
- memcpy (&search_buf[0], &search_buf[chunk_size], keep_len);
-
- nr_to_read = std::min (search_space_len - keep_len,
- (ULONGEST) chunk_size);
-
- if (!read_memory (read_addr, &search_buf[keep_len], nr_to_read))
- {
- warning (_("Unable to access %s bytes of target "
- "memory at %s, halting search."),
- plongest (nr_to_read),
- hex_string (read_addr));
- return -1;
- }
-
- start_addr += chunk_size;
- }
+ gdb_assert (keep_len == pattern_len - 1);
+ if (keep_len > 0)
+ memcpy (&search_buf[0], &search_buf[chunk_size], keep_len);
+
+ nr_to_read
+ = std::min (search_space_len - keep_len, (ULONGEST) chunk_size);
+
+ if (!read_memory (read_addr, &search_buf[keep_len], nr_to_read))
+ {
+ warning (_ ("Unable to access %s bytes of target "
+ "memory at %s, halting search."),
+ plongest (nr_to_read), hex_string (read_addr));
+ return -1;
+ }
+
+ start_addr += chunk_size;
+ }
}
/* Not found. */
diff --git a/gdbsupport/search.h b/gdbsupport/search.h
index 8501624bd0c..b56127e5f21 100644
--- a/gdbsupport/search.h
+++ b/gdbsupport/search.h
@@ -31,12 +31,10 @@
typedef bool target_read_memory_ftype (CORE_ADDR, gdb_byte *, size_t);
/* Utility implementation of searching memory. */
-extern int simple_search_memory
- (gdb::function_view<target_read_memory_ftype> read_memory,
- CORE_ADDR start_addr,
- ULONGEST search_space_len,
- const gdb_byte *pattern,
- ULONGEST pattern_len,
- CORE_ADDR *found_addrp);
+extern int
+simple_search_memory (gdb::function_view<target_read_memory_ftype> read_memory,
+ CORE_ADDR start_addr, ULONGEST search_space_len,
+ const gdb_byte *pattern, ULONGEST pattern_len,
+ CORE_ADDR *found_addrp);
#endif /* COMMON_SEARCH_H */
diff --git a/gdbsupport/selftest.cc b/gdbsupport/selftest.cc
index c2e39366145..bb63ce6ab96 100644
--- a/gdbsupport/selftest.cc
+++ b/gdbsupport/selftest.cc
@@ -38,8 +38,7 @@ static std::vector<selftests_generator> lazy_generators;
/* See selftest.h. */
void
-register_test (const std::string &name,
- std::function<void(void)> function)
+register_test (const std::string &name, std::function<void (void)> function)
{
/* Check that no test with this name already exist. */
auto status = tests.emplace (name, std::move (function));
@@ -80,36 +79,35 @@ run_tests (gdb::array_view<const char *const> filters, bool verbose)
bool run = false;
if (filters.empty ())
- run = true;
+ run = true;
else
- {
- for (const char *filter : filters)
- {
- if (test.name.find (filter) != std::string::npos)
- run = true;
- }
- }
+ {
+ for (const char *filter : filters)
+ {
+ if (test.name.find (filter) != std::string::npos)
+ run = true;
+ }
+ }
if (!run)
- continue;
+ continue;
try
- {
- debug_printf (_("Running selftest %s.\n"), test.name.c_str ());
- ++ran;
- test.test ();
- }
+ {
+ debug_printf (_ ("Running selftest %s.\n"), test.name.c_str ());
+ ++ran;
+ test.test ();
+ }
catch (const gdb_exception_error &ex)
- {
- ++failed;
- debug_printf ("Self test failed: %s\n", ex.what ());
- }
+ {
+ ++failed;
+ debug_printf ("Self test failed: %s\n", ex.what ());
+ }
reset ();
}
- debug_printf (_("Ran %d unit tests, %d failed\n"),
- ran, failed);
+ debug_printf (_ ("Ran %d unit tests, %d failed\n"), ran, failed);
}
/* See selftest.h. */
diff --git a/gdbsupport/selftest.h b/gdbsupport/selftest.h
index fba6baff78a..e441dc70ef3 100644
--- a/gdbsupport/selftest.h
+++ b/gdbsupport/selftest.h
@@ -36,10 +36,11 @@ namespace selftests
struct selftest
{
selftest (std::string name, std::function<void (void)> test)
- : name { std::move (name) }, test { std::move (test) }
- { }
- bool operator< (const selftest &rhs) const
- { return name < rhs.name; }
+ : name { std::move (name) },
+ test { std::move (test) }
+ {
+ }
+ bool operator<(const selftest &rhs) const { return name < rhs.name; }
std::string name;
std::function<void (void)> test;
@@ -60,7 +61,7 @@ extern bool run_verbose ();
/* Register a new self-test. */
extern void register_test (const std::string &name,
- std::function<void(void)> function);
+ std::function<void (void)> function);
/* A selftest generator is a callback function used to delay the generation
of selftests. */
@@ -79,18 +80,20 @@ extern void add_lazy_generator (selftests_generator generator);
element of FILTERS. */
extern void run_tests (gdb::array_view<const char *const> filters,
- bool verbose = false);
+ bool verbose = false);
/* Reset GDB or GDBserver's internal state. */
extern void reset ();
-}
+} // namespace selftests
/* Check that VALUE is true, and, if not, throw an exception. */
-#define SELF_CHECK(VALUE) \
- do { \
- if (!(VALUE)) \
- error (_("self-test failed at %s:%d"), __FILE__, __LINE__); \
- } while (0)
+#define SELF_CHECK(VALUE) \
+ do \
+ { \
+ if (!(VALUE)) \
+ error (_ ("self-test failed at %s:%d"), __FILE__, __LINE__); \
+ } \
+ while (0)
#endif /* COMMON_SELFTEST_H */
diff --git a/gdbsupport/signals-state-save-restore.cc b/gdbsupport/signals-state-save-restore.cc
index 3ec7a259c9c..7b865bd6312 100644
--- a/gdbsupport/signals-state-save-restore.cc
+++ b/gdbsupport/signals-state-save-restore.cc
@@ -38,7 +38,7 @@ save_original_signals_state (bool quiet)
int i;
int res;
- res = gdb_sigmask (0, NULL, &original_signal_mask);
+ res = gdb_sigmask (0, NULL, &original_signal_mask);
if (res == -1)
perror_with_name (("sigprocmask"));
@@ -50,36 +50,35 @@ save_original_signals_state (bool quiet)
res = sigaction (i, NULL, oldact);
if (res == -1 && errno == EINVAL)
- {
- /* Some signal numbers in the range are invalid. */
- continue;
- }
+ {
+ /* Some signal numbers in the range are invalid. */
+ continue;
+ }
else if (res == -1)
- perror_with_name (("sigaction"));
+ perror_with_name (("sigaction"));
/* If we find a custom signal handler already installed, then
this function was called too late. This is a warning instead
of an internal error because this can also happen if you
LD_PRELOAD a library that installs a signal handler early via
__attribute__((constructor)), like libSegFault.so. */
- if (!quiet
- && oldact->sa_handler != SIG_DFL
- && oldact->sa_handler != SIG_IGN)
- {
- found_preinstalled = true;
+ if (!quiet && oldact->sa_handler != SIG_DFL
+ && oldact->sa_handler != SIG_IGN)
+ {
+ found_preinstalled = true;
- /* Use raw fprintf here because we're being called in early
+ /* Use raw fprintf here because we're being called in early
startup, before GDB's filtered streams are created. */
- fprintf (stderr,
- _("warning: Found custom handler for signal "
- "%d (%s) preinstalled.\n"), i,
- strsignal (i));
- }
+ fprintf (stderr,
+ _ ("warning: Found custom handler for signal "
+ "%d (%s) preinstalled.\n"),
+ i, strsignal (i));
+ }
}
if (found_preinstalled)
{
- fprintf (stderr, _("\
+ fprintf (stderr, _ ("\
Some signal dispositions inherited from the environment (SIG_DFL/SIG_IGN)\n\
won't be propagated to spawned programs.\n"));
}
@@ -99,15 +98,15 @@ restore_original_signals_state (void)
{
res = sigaction (i, &original_signal_actions[i], NULL);
if (res == -1 && errno == EINVAL)
- {
- /* Some signal numbers in the range are invalid. */
- continue;
- }
+ {
+ /* Some signal numbers in the range are invalid. */
+ continue;
+ }
else if (res == -1)
- perror_with_name (("sigaction"));
+ perror_with_name (("sigaction"));
}
- res = gdb_sigmask (SIG_SETMASK, &original_signal_mask, NULL);
+ res = gdb_sigmask (SIG_SETMASK, &original_signal_mask, NULL);
if (res == -1)
perror_with_name (("sigprocmask"));
#endif
diff --git a/gdbsupport/signals.cc b/gdbsupport/signals.cc
index 0d700c03e32..2cefa20c867 100644
--- a/gdbsupport/signals.cc
+++ b/gdbsupport/signals.cc
@@ -32,24 +32,24 @@ struct gdbarch;
several for its own use. */
#ifndef REALTIME_LO
-# if defined(__SIGRTMIN)
-# define REALTIME_LO __SIGRTMIN
-# define REALTIME_HI (__SIGRTMAX + 1)
-# elif defined(SIGRTMIN)
-# define REALTIME_LO SIGRTMIN
-# define REALTIME_HI (SIGRTMAX + 1)
-# endif
+#if defined(__SIGRTMIN)
+#define REALTIME_LO __SIGRTMIN
+#define REALTIME_HI (__SIGRTMAX + 1)
+#elif defined(SIGRTMIN)
+#define REALTIME_LO SIGRTMIN
+#define REALTIME_HI (SIGRTMAX + 1)
+#endif
#endif
/* This table must match in order and size the signals in enum
gdb_signal. */
-static const struct {
+static const struct
+{
const char *symbol;
const char *name;
const char *string;
- } signals [] =
-{
+} signals[] = {
#define SET(symbol, constant, name, string) { #symbol, name, string },
#include "gdb/signals.def"
#undef SET
@@ -98,15 +98,13 @@ gdb_signal_from_name (const char *name)
instead. */
/* This ugly cast brought to you by the native VAX compiler. */
- for (sig = GDB_SIGNAL_HUP;
- sig < GDB_SIGNAL_LAST;
+ for (sig = GDB_SIGNAL_HUP; sig < GDB_SIGNAL_LAST;
sig = (enum gdb_signal) ((int) sig + 1))
- if (signals[sig].name != NULL
- && strcmp (name, signals[sig].name) == 0)
+ if (signals[sig].name != NULL && strcmp (name, signals[sig].name) == 0)
return sig;
return GDB_SIGNAL_UNKNOWN;
}
-
+
/* The following functions are to help certain targets deal
with the signal/waitstatus stuff. They could just as well be in
a file called native-utils.c or unixwaitstatus-utils.c or whatever. */
@@ -139,218 +137,216 @@ gdb_signal_from_host (int hostsig)
if (hostsig == SIGTERM)
return GDB_SIGNAL_TERM;
- /* All other signals need preprocessor conditionals. */
-#if defined (SIGHUP)
+ /* All other signals need preprocessor conditionals. */
+#if defined(SIGHUP)
if (hostsig == SIGHUP)
return GDB_SIGNAL_HUP;
#endif
-#if defined (SIGQUIT)
+#if defined(SIGQUIT)
if (hostsig == SIGQUIT)
return GDB_SIGNAL_QUIT;
#endif
-#if defined (SIGTRAP)
+#if defined(SIGTRAP)
if (hostsig == SIGTRAP)
return GDB_SIGNAL_TRAP;
#endif
-#if defined (SIGEMT)
+#if defined(SIGEMT)
if (hostsig == SIGEMT)
return GDB_SIGNAL_EMT;
#endif
-#if defined (SIGKILL)
+#if defined(SIGKILL)
if (hostsig == SIGKILL)
return GDB_SIGNAL_KILL;
#endif
-#if defined (SIGBUS)
+#if defined(SIGBUS)
if (hostsig == SIGBUS)
return GDB_SIGNAL_BUS;
#endif
-#if defined (SIGSYS)
+#if defined(SIGSYS)
if (hostsig == SIGSYS)
return GDB_SIGNAL_SYS;
#endif
-#if defined (SIGPIPE)
+#if defined(SIGPIPE)
if (hostsig == SIGPIPE)
return GDB_SIGNAL_PIPE;
#endif
-#if defined (SIGALRM)
+#if defined(SIGALRM)
if (hostsig == SIGALRM)
return GDB_SIGNAL_ALRM;
#endif
-#if defined (SIGUSR1)
+#if defined(SIGUSR1)
if (hostsig == SIGUSR1)
return GDB_SIGNAL_USR1;
#endif
-#if defined (SIGUSR2)
+#if defined(SIGUSR2)
if (hostsig == SIGUSR2)
return GDB_SIGNAL_USR2;
#endif
-#if defined (SIGCLD)
+#if defined(SIGCLD)
if (hostsig == SIGCLD)
return GDB_SIGNAL_CHLD;
#endif
-#if defined (SIGCHLD)
+#if defined(SIGCHLD)
if (hostsig == SIGCHLD)
return GDB_SIGNAL_CHLD;
#endif
-#if defined (SIGPWR)
+#if defined(SIGPWR)
if (hostsig == SIGPWR)
return GDB_SIGNAL_PWR;
#endif
-#if defined (SIGWINCH)
+#if defined(SIGWINCH)
if (hostsig == SIGWINCH)
return GDB_SIGNAL_WINCH;
#endif
-#if defined (SIGURG)
+#if defined(SIGURG)
if (hostsig == SIGURG)
return GDB_SIGNAL_URG;
#endif
-#if defined (SIGIO)
+#if defined(SIGIO)
if (hostsig == SIGIO)
return GDB_SIGNAL_IO;
#endif
-#if defined (SIGPOLL)
+#if defined(SIGPOLL)
if (hostsig == SIGPOLL)
return GDB_SIGNAL_POLL;
#endif
-#if defined (SIGSTOP)
+#if defined(SIGSTOP)
if (hostsig == SIGSTOP)
return GDB_SIGNAL_STOP;
#endif
-#if defined (SIGTSTP)
+#if defined(SIGTSTP)
if (hostsig == SIGTSTP)
return GDB_SIGNAL_TSTP;
#endif
-#if defined (SIGCONT)
+#if defined(SIGCONT)
if (hostsig == SIGCONT)
return GDB_SIGNAL_CONT;
#endif
-#if defined (SIGTTIN)
+#if defined(SIGTTIN)
if (hostsig == SIGTTIN)
return GDB_SIGNAL_TTIN;
#endif
-#if defined (SIGTTOU)
+#if defined(SIGTTOU)
if (hostsig == SIGTTOU)
return GDB_SIGNAL_TTOU;
#endif
-#if defined (SIGVTALRM)
+#if defined(SIGVTALRM)
if (hostsig == SIGVTALRM)
return GDB_SIGNAL_VTALRM;
#endif
-#if defined (SIGPROF)
+#if defined(SIGPROF)
if (hostsig == SIGPROF)
return GDB_SIGNAL_PROF;
#endif
-#if defined (SIGXCPU)
+#if defined(SIGXCPU)
if (hostsig == SIGXCPU)
return GDB_SIGNAL_XCPU;
#endif
-#if defined (SIGXFSZ)
+#if defined(SIGXFSZ)
if (hostsig == SIGXFSZ)
return GDB_SIGNAL_XFSZ;
#endif
-#if defined (SIGWIND)
+#if defined(SIGWIND)
if (hostsig == SIGWIND)
return GDB_SIGNAL_WIND;
#endif
-#if defined (SIGPHONE)
+#if defined(SIGPHONE)
if (hostsig == SIGPHONE)
return GDB_SIGNAL_PHONE;
#endif
-#if defined (SIGLOST)
+#if defined(SIGLOST)
if (hostsig == SIGLOST)
return GDB_SIGNAL_LOST;
#endif
-#if defined (SIGWAITING)
+#if defined(SIGWAITING)
if (hostsig == SIGWAITING)
return GDB_SIGNAL_WAITING;
#endif
-#if defined (SIGCANCEL)
+#if defined(SIGCANCEL)
if (hostsig == SIGCANCEL)
return GDB_SIGNAL_CANCEL;
#endif
-#if defined (SIGLWP)
+#if defined(SIGLWP)
if (hostsig == SIGLWP)
return GDB_SIGNAL_LWP;
#endif
-#if defined (SIGDANGER)
+#if defined(SIGDANGER)
if (hostsig == SIGDANGER)
return GDB_SIGNAL_DANGER;
#endif
-#if defined (SIGGRANT)
+#if defined(SIGGRANT)
if (hostsig == SIGGRANT)
return GDB_SIGNAL_GRANT;
#endif
-#if defined (SIGRETRACT)
+#if defined(SIGRETRACT)
if (hostsig == SIGRETRACT)
return GDB_SIGNAL_RETRACT;
#endif
-#if defined (SIGMSG)
+#if defined(SIGMSG)
if (hostsig == SIGMSG)
return GDB_SIGNAL_MSG;
#endif
-#if defined (SIGSOUND)
+#if defined(SIGSOUND)
if (hostsig == SIGSOUND)
return GDB_SIGNAL_SOUND;
#endif
-#if defined (SIGSAK)
+#if defined(SIGSAK)
if (hostsig == SIGSAK)
return GDB_SIGNAL_SAK;
#endif
-#if defined (SIGPRIO)
+#if defined(SIGPRIO)
if (hostsig == SIGPRIO)
return GDB_SIGNAL_PRIO;
#endif
- /* Mach exceptions. Assumes that the values for EXC_ are positive! */
-#if defined (EXC_BAD_ACCESS) && defined (_NSIG)
+ /* Mach exceptions. Assumes that the values for EXC_ are positive! */
+#if defined(EXC_BAD_ACCESS) && defined(_NSIG)
if (hostsig == _NSIG + EXC_BAD_ACCESS)
return GDB_EXC_BAD_ACCESS;
#endif
-#if defined (EXC_BAD_INSTRUCTION) && defined (_NSIG)
+#if defined(EXC_BAD_INSTRUCTION) && defined(_NSIG)
if (hostsig == _NSIG + EXC_BAD_INSTRUCTION)
return GDB_EXC_BAD_INSTRUCTION;
#endif
-#if defined (EXC_ARITHMETIC) && defined (_NSIG)
+#if defined(EXC_ARITHMETIC) && defined(_NSIG)
if (hostsig == _NSIG + EXC_ARITHMETIC)
return GDB_EXC_ARITHMETIC;
#endif
-#if defined (EXC_EMULATION) && defined (_NSIG)
+#if defined(EXC_EMULATION) && defined(_NSIG)
if (hostsig == _NSIG + EXC_EMULATION)
return GDB_EXC_EMULATION;
#endif
-#if defined (EXC_SOFTWARE) && defined (_NSIG)
+#if defined(EXC_SOFTWARE) && defined(_NSIG)
if (hostsig == _NSIG + EXC_SOFTWARE)
return GDB_EXC_SOFTWARE;
#endif
-#if defined (EXC_BREAKPOINT) && defined (_NSIG)
+#if defined(EXC_BREAKPOINT) && defined(_NSIG)
if (hostsig == _NSIG + EXC_BREAKPOINT)
return GDB_EXC_BREAKPOINT;
#endif
-#if defined (SIGINFO)
+#if defined(SIGINFO)
if (hostsig == SIGINFO)
return GDB_SIGNAL_INFO;
#endif
-#if defined (SIGLIBRT)
+#if defined(SIGLIBRT)
if (hostsig == SIGLIBRT)
return GDB_SIGNAL_LIBRT;
#endif
-#if defined (REALTIME_LO)
+#if defined(REALTIME_LO)
if (hostsig >= REALTIME_LO && hostsig < REALTIME_HI)
{
/* This block of GDB_SIGNAL_REALTIME value is in order. */
if (33 <= hostsig && hostsig <= 63)
- return (enum gdb_signal)
- (hostsig - 33 + (int) GDB_SIGNAL_REALTIME_33);
+ return (enum gdb_signal) (hostsig - 33 + (int) GDB_SIGNAL_REALTIME_33);
else if (hostsig == 32)
- return GDB_SIGNAL_REALTIME_32;
+ return GDB_SIGNAL_REALTIME_32;
else if (64 <= hostsig && hostsig <= 127)
- return (enum gdb_signal)
- (hostsig - 64 + (int) GDB_SIGNAL_REALTIME_64);
+ return (enum gdb_signal) (hostsig - 64 + (int) GDB_SIGNAL_REALTIME_64);
else
- error (_("GDB bug: target.c (gdb_signal_from_host): "
- "unrecognized real-time signal"));
+ error (_ ("GDB bug: target.c (gdb_signal_from_host): "
+ "unrecognized real-time signal"));
}
#endif
@@ -363,8 +359,7 @@ gdb_signal_from_host (int hostsig)
accordingly. */
static int
-do_gdb_signal_to_host (enum gdb_signal oursig,
- int *oursig_ok)
+do_gdb_signal_to_host (enum gdb_signal oursig, int *oursig_ok)
{
int retsig;
/* Silence the 'not used' warning, for targets that
@@ -397,229 +392,228 @@ do_gdb_signal_to_host (enum gdb_signal oursig,
return SIGTERM;
/* All other signals need preprocessor conditionals. */
-#if defined (SIGHUP)
+#if defined(SIGHUP)
case GDB_SIGNAL_HUP:
return SIGHUP;
#endif
-#if defined (SIGQUIT)
+#if defined(SIGQUIT)
case GDB_SIGNAL_QUIT:
return SIGQUIT;
#endif
-#if defined (SIGTRAP)
+#if defined(SIGTRAP)
case GDB_SIGNAL_TRAP:
return SIGTRAP;
#endif
-#if defined (SIGEMT)
+#if defined(SIGEMT)
case GDB_SIGNAL_EMT:
return SIGEMT;
#endif
-#if defined (SIGKILL)
+#if defined(SIGKILL)
case GDB_SIGNAL_KILL:
return SIGKILL;
#endif
-#if defined (SIGBUS)
+#if defined(SIGBUS)
case GDB_SIGNAL_BUS:
return SIGBUS;
#endif
-#if defined (SIGSYS)
+#if defined(SIGSYS)
case GDB_SIGNAL_SYS:
return SIGSYS;
#endif
-#if defined (SIGPIPE)
+#if defined(SIGPIPE)
case GDB_SIGNAL_PIPE:
return SIGPIPE;
#endif
-#if defined (SIGALRM)
+#if defined(SIGALRM)
case GDB_SIGNAL_ALRM:
return SIGALRM;
#endif
-#if defined (SIGUSR1)
+#if defined(SIGUSR1)
case GDB_SIGNAL_USR1:
return SIGUSR1;
#endif
-#if defined (SIGUSR2)
+#if defined(SIGUSR2)
case GDB_SIGNAL_USR2:
return SIGUSR2;
#endif
-#if defined (SIGCHLD) || defined (SIGCLD)
+#if defined(SIGCHLD) || defined(SIGCLD)
case GDB_SIGNAL_CHLD:
-#if defined (SIGCHLD)
+#if defined(SIGCHLD)
return SIGCHLD;
#else
return SIGCLD;
#endif
#endif /* SIGCLD or SIGCHLD */
-#if defined (SIGPWR)
+#if defined(SIGPWR)
case GDB_SIGNAL_PWR:
return SIGPWR;
#endif
-#if defined (SIGWINCH)
+#if defined(SIGWINCH)
case GDB_SIGNAL_WINCH:
return SIGWINCH;
#endif
-#if defined (SIGURG)
+#if defined(SIGURG)
case GDB_SIGNAL_URG:
return SIGURG;
#endif
-#if defined (SIGIO)
+#if defined(SIGIO)
case GDB_SIGNAL_IO:
return SIGIO;
#endif
-#if defined (SIGPOLL)
+#if defined(SIGPOLL)
case GDB_SIGNAL_POLL:
return SIGPOLL;
#endif
-#if defined (SIGSTOP)
+#if defined(SIGSTOP)
case GDB_SIGNAL_STOP:
return SIGSTOP;
#endif
-#if defined (SIGTSTP)
+#if defined(SIGTSTP)
case GDB_SIGNAL_TSTP:
return SIGTSTP;
#endif
-#if defined (SIGCONT)
+#if defined(SIGCONT)
case GDB_SIGNAL_CONT:
return SIGCONT;
#endif
-#if defined (SIGTTIN)
+#if defined(SIGTTIN)
case GDB_SIGNAL_TTIN:
return SIGTTIN;
#endif
-#if defined (SIGTTOU)
+#if defined(SIGTTOU)
case GDB_SIGNAL_TTOU:
return SIGTTOU;
#endif
-#if defined (SIGVTALRM)
+#if defined(SIGVTALRM)
case GDB_SIGNAL_VTALRM:
return SIGVTALRM;
#endif
-#if defined (SIGPROF)
+#if defined(SIGPROF)
case GDB_SIGNAL_PROF:
return SIGPROF;
#endif
-#if defined (SIGXCPU)
+#if defined(SIGXCPU)
case GDB_SIGNAL_XCPU:
return SIGXCPU;
#endif
-#if defined (SIGXFSZ)
+#if defined(SIGXFSZ)
case GDB_SIGNAL_XFSZ:
return SIGXFSZ;
#endif
-#if defined (SIGWIND)
+#if defined(SIGWIND)
case GDB_SIGNAL_WIND:
return SIGWIND;
#endif
-#if defined (SIGPHONE)
+#if defined(SIGPHONE)
case GDB_SIGNAL_PHONE:
return SIGPHONE;
#endif
-#if defined (SIGLOST)
+#if defined(SIGLOST)
case GDB_SIGNAL_LOST:
return SIGLOST;
#endif
-#if defined (SIGWAITING)
+#if defined(SIGWAITING)
case GDB_SIGNAL_WAITING:
return SIGWAITING;
#endif
-#if defined (SIGCANCEL)
+#if defined(SIGCANCEL)
case GDB_SIGNAL_CANCEL:
return SIGCANCEL;
#endif
-#if defined (SIGLWP)
+#if defined(SIGLWP)
case GDB_SIGNAL_LWP:
return SIGLWP;
#endif
-#if defined (SIGDANGER)
+#if defined(SIGDANGER)
case GDB_SIGNAL_DANGER:
return SIGDANGER;
#endif
-#if defined (SIGGRANT)
+#if defined(SIGGRANT)
case GDB_SIGNAL_GRANT:
return SIGGRANT;
#endif
-#if defined (SIGRETRACT)
+#if defined(SIGRETRACT)
case GDB_SIGNAL_RETRACT:
return SIGRETRACT;
#endif
-#if defined (SIGMSG)
+#if defined(SIGMSG)
case GDB_SIGNAL_MSG:
return SIGMSG;
#endif
-#if defined (SIGSOUND)
+#if defined(SIGSOUND)
case GDB_SIGNAL_SOUND:
return SIGSOUND;
#endif
-#if defined (SIGSAK)
+#if defined(SIGSAK)
case GDB_SIGNAL_SAK:
return SIGSAK;
#endif
-#if defined (SIGPRIO)
+#if defined(SIGPRIO)
case GDB_SIGNAL_PRIO:
return SIGPRIO;
#endif
/* Mach exceptions. Assumes that the values for EXC_ are positive! */
-#if defined (EXC_BAD_ACCESS) && defined (_NSIG)
+#if defined(EXC_BAD_ACCESS) && defined(_NSIG)
case GDB_EXC_BAD_ACCESS:
return _NSIG + EXC_BAD_ACCESS;
#endif
-#if defined (EXC_BAD_INSTRUCTION) && defined (_NSIG)
+#if defined(EXC_BAD_INSTRUCTION) && defined(_NSIG)
case GDB_EXC_BAD_INSTRUCTION:
return _NSIG + EXC_BAD_INSTRUCTION;
#endif
-#if defined (EXC_ARITHMETIC) && defined (_NSIG)
+#if defined(EXC_ARITHMETIC) && defined(_NSIG)
case GDB_EXC_ARITHMETIC:
return _NSIG + EXC_ARITHMETIC;
#endif
-#if defined (EXC_EMULATION) && defined (_NSIG)
+#if defined(EXC_EMULATION) && defined(_NSIG)
case GDB_EXC_EMULATION:
return _NSIG + EXC_EMULATION;
#endif
-#if defined (EXC_SOFTWARE) && defined (_NSIG)
+#if defined(EXC_SOFTWARE) && defined(_NSIG)
case GDB_EXC_SOFTWARE:
return _NSIG + EXC_SOFTWARE;
#endif
-#if defined (EXC_BREAKPOINT) && defined (_NSIG)
+#if defined(EXC_BREAKPOINT) && defined(_NSIG)
case GDB_EXC_BREAKPOINT:
return _NSIG + EXC_BREAKPOINT;
#endif
-#if defined (SIGINFO)
+#if defined(SIGINFO)
case GDB_SIGNAL_INFO:
return SIGINFO;
#endif
-#if defined (SIGLIBRT)
+#if defined(SIGLIBRT)
case GDB_SIGNAL_LIBRT:
return SIGLIBRT;
#endif
default:
-#if defined (REALTIME_LO)
+#if defined(REALTIME_LO)
retsig = 0;
- if (oursig >= GDB_SIGNAL_REALTIME_33
- && oursig <= GDB_SIGNAL_REALTIME_63)
- {
- /* This block of signals is continuous, and
+ if (oursig >= GDB_SIGNAL_REALTIME_33 && oursig <= GDB_SIGNAL_REALTIME_63)
+ {
+ /* This block of signals is continuous, and
GDB_SIGNAL_REALTIME_33 is 33 by definition. */
- retsig = (int) oursig - (int) GDB_SIGNAL_REALTIME_33 + 33;
- }
+ retsig = (int) oursig - (int) GDB_SIGNAL_REALTIME_33 + 33;
+ }
else if (oursig == GDB_SIGNAL_REALTIME_32)
- {
- /* GDB_SIGNAL_REALTIME_32 isn't contiguous with
+ {
+ /* GDB_SIGNAL_REALTIME_32 isn't contiguous with
GDB_SIGNAL_REALTIME_33. It is 32 by definition. */
- retsig = 32;
- }
+ retsig = 32;
+ }
else if (oursig >= GDB_SIGNAL_REALTIME_64
- && oursig <= GDB_SIGNAL_REALTIME_127)
- {
- /* This block of signals is continuous, and
+ && oursig <= GDB_SIGNAL_REALTIME_127)
+ {
+ /* This block of signals is continuous, and
GDB_SIGNAL_REALTIME_64 is 64 by definition. */
- retsig = (int) oursig - (int) GDB_SIGNAL_REALTIME_64 + 64;
- }
+ retsig = (int) oursig - (int) GDB_SIGNAL_REALTIME_64 + 64;
+ }
if (retsig >= REALTIME_LO && retsig < REALTIME_HI)
- return retsig;
+ return retsig;
#endif
*oursig_ok = 0;
@@ -644,8 +638,8 @@ gdb_signal_to_host (enum gdb_signal oursig)
{
/* The user might be trying to do "signal SIGSAK" where this system
doesn't have SIGSAK. */
- warning (_("Signal %s does not exist on this system."),
- gdb_signal_to_name (oursig));
+ warning (_ ("Signal %s does not exist on this system."),
+ gdb_signal_to_name (oursig));
return 0;
}
else
diff --git a/gdbsupport/symbol.h b/gdbsupport/symbol.h
index 826e2dc775e..8b8f9c8befd 100644
--- a/gdbsupport/symbol.h
+++ b/gdbsupport/symbol.h
@@ -32,6 +32,6 @@ struct objfile;
object files. This function must be provided by the client. */
extern int find_minimal_symbol_address (const char *name, CORE_ADDR *addr,
- struct objfile *objfile);
+ struct objfile *objfile);
#endif /* COMMON_SYMBOL_H */
diff --git a/gdbsupport/tdesc.cc b/gdbsupport/tdesc.cc
index 6ecb3232a86..5c4f8509e6a 100644
--- a/gdbsupport/tdesc.cc
+++ b/gdbsupport/tdesc.cc
@@ -21,9 +21,10 @@
#include "gdbsupport/tdesc.h"
tdesc_reg::tdesc_reg (struct tdesc_feature *feature, const std::string &name_,
- int regnum, int save_restore_, const char *group_,
- int bitsize_, const char *type_)
- : name (name_), target_regnum (regnum),
+ int regnum, int save_restore_, const char *group_,
+ int bitsize_, const char *type_)
+ : name (name_),
+ target_regnum (regnum),
save_restore (save_restore_),
group (group_ != NULL ? group_ : ""),
bitsize (bitsize_),
@@ -35,30 +36,29 @@ tdesc_reg::tdesc_reg (struct tdesc_feature *feature, const std::string &name_,
}
/* Predefined types. */
-static tdesc_type_builtin tdesc_predefined_types[] =
-{
- { "bool", TDESC_TYPE_BOOL },
- { "int8", TDESC_TYPE_INT8 },
- { "int16", TDESC_TYPE_INT16 },
- { "int32", TDESC_TYPE_INT32 },
- { "int64", TDESC_TYPE_INT64 },
- { "int128", TDESC_TYPE_INT128 },
- { "uint8", TDESC_TYPE_UINT8 },
- { "uint16", TDESC_TYPE_UINT16 },
- { "uint32", TDESC_TYPE_UINT32 },
- { "uint64", TDESC_TYPE_UINT64 },
- { "uint128", TDESC_TYPE_UINT128 },
- { "code_ptr", TDESC_TYPE_CODE_PTR },
- { "data_ptr", TDESC_TYPE_DATA_PTR },
- { "ieee_half", TDESC_TYPE_IEEE_HALF },
- { "ieee_single", TDESC_TYPE_IEEE_SINGLE },
- { "ieee_double", TDESC_TYPE_IEEE_DOUBLE },
- { "arm_fpa_ext", TDESC_TYPE_ARM_FPA_EXT },
- { "i387_ext", TDESC_TYPE_I387_EXT },
- { "bfloat16", TDESC_TYPE_BFLOAT16 }
-};
-
-void tdesc_feature::accept (tdesc_element_visitor &v) const
+static tdesc_type_builtin tdesc_predefined_types[]
+ = { { "bool", TDESC_TYPE_BOOL },
+ { "int8", TDESC_TYPE_INT8 },
+ { "int16", TDESC_TYPE_INT16 },
+ { "int32", TDESC_TYPE_INT32 },
+ { "int64", TDESC_TYPE_INT64 },
+ { "int128", TDESC_TYPE_INT128 },
+ { "uint8", TDESC_TYPE_UINT8 },
+ { "uint16", TDESC_TYPE_UINT16 },
+ { "uint32", TDESC_TYPE_UINT32 },
+ { "uint64", TDESC_TYPE_UINT64 },
+ { "uint128", TDESC_TYPE_UINT128 },
+ { "code_ptr", TDESC_TYPE_CODE_PTR },
+ { "data_ptr", TDESC_TYPE_DATA_PTR },
+ { "ieee_half", TDESC_TYPE_IEEE_HALF },
+ { "ieee_single", TDESC_TYPE_IEEE_SINGLE },
+ { "ieee_double", TDESC_TYPE_IEEE_DOUBLE },
+ { "arm_fpa_ext", TDESC_TYPE_ARM_FPA_EXT },
+ { "i387_ext", TDESC_TYPE_I387_EXT },
+ { "bfloat16", TDESC_TYPE_BFLOAT16 } };
+
+void
+tdesc_feature::accept (tdesc_element_visitor &v) const
{
v.visit_pre (this);
@@ -71,7 +71,8 @@ void tdesc_feature::accept (tdesc_element_visitor &v) const
v.visit_post (this);
}
-bool tdesc_feature::operator== (const tdesc_feature &other) const
+bool
+tdesc_feature::operator== (const tdesc_feature &other) const
{
if (name != other.name)
return false;
@@ -85,8 +86,8 @@ bool tdesc_feature::operator== (const tdesc_feature &other) const
const tdesc_reg_up &reg2 = other.registers[ix];
if (reg1 != reg2 && *reg1 != *reg2)
- return false;
- }
+ return false;
+ }
if (types.size () != other.types.size ())
return false;
@@ -97,7 +98,7 @@ bool tdesc_feature::operator== (const tdesc_feature &other) const
const tdesc_type_up &type2 = other.types[ix];
if (type1 != type2 && *type1 != *type2)
- return false;
+ return false;
}
return true;
@@ -136,12 +137,12 @@ tdesc_named_type (const struct tdesc_feature *feature, const char *id)
/* See gdbsupport/tdesc.h. */
void
-tdesc_create_reg (struct tdesc_feature *feature, const char *name,
- int regnum, int save_restore, const char *group,
- int bitsize, const char *type)
+tdesc_create_reg (struct tdesc_feature *feature, const char *name, int regnum,
+ int save_restore, const char *group, int bitsize,
+ const char *type)
{
- tdesc_reg *reg = new tdesc_reg (feature, name, regnum, save_restore,
- group, bitsize, type);
+ tdesc_reg *reg = new tdesc_reg (feature, name, regnum, save_restore, group,
+ bitsize, type);
feature->registers.emplace_back (reg);
}
@@ -150,7 +151,7 @@ tdesc_create_reg (struct tdesc_feature *feature, const char *name,
struct tdesc_type *
tdesc_create_vector (struct tdesc_feature *feature, const char *name,
- struct tdesc_type *field_type, int count)
+ struct tdesc_type *field_type, int count)
{
tdesc_type_vector *type = new tdesc_type_vector (name, field_type, count);
feature->types.emplace_back (type);
@@ -195,8 +196,7 @@ tdesc_create_union (struct tdesc_feature *feature, const char *name)
/* See gdbsupport/tdesc.h. */
tdesc_type_with_fields *
-tdesc_create_flags (struct tdesc_feature *feature, const char *name,
- int size)
+tdesc_create_flags (struct tdesc_feature *feature, const char *name, int size)
{
gdb_assert (size > 0);
@@ -210,8 +210,7 @@ tdesc_create_flags (struct tdesc_feature *feature, const char *name,
/* See gdbsupport/tdesc.h. */
tdesc_type_with_fields *
-tdesc_create_enum (struct tdesc_feature *feature, const char *name,
- int size)
+tdesc_create_enum (struct tdesc_feature *feature, const char *name, int size)
{
gdb_assert (size > 0);
@@ -226,10 +225,10 @@ tdesc_create_enum (struct tdesc_feature *feature, const char *name,
void
tdesc_add_field (tdesc_type_with_fields *type, const char *field_name,
- struct tdesc_type *field_type)
+ struct tdesc_type *field_type)
{
gdb_assert (type->kind == TDESC_TYPE_UNION
- || type->kind == TDESC_TYPE_STRUCT);
+ || type->kind == TDESC_TYPE_STRUCT);
/* Initialize start and end so we know this is not a bit-field
when we print-c-tdesc. */
@@ -240,10 +239,10 @@ tdesc_add_field (tdesc_type_with_fields *type, const char *field_name,
void
tdesc_add_typed_bitfield (tdesc_type_with_fields *type, const char *field_name,
- int start, int end, struct tdesc_type *field_type)
+ int start, int end, struct tdesc_type *field_type)
{
gdb_assert (type->kind == TDESC_TYPE_STRUCT
- || type->kind == TDESC_TYPE_FLAGS);
+ || type->kind == TDESC_TYPE_FLAGS);
gdb_assert (start >= 0 && end >= start);
type->fields.emplace_back (field_name, field_type, start, end);
@@ -253,7 +252,7 @@ tdesc_add_typed_bitfield (tdesc_type_with_fields *type, const char *field_name,
void
tdesc_add_bitfield (tdesc_type_with_fields *type, const char *field_name,
- int start, int end)
+ int start, int end)
{
struct tdesc_type *field_type;
@@ -270,53 +269,56 @@ tdesc_add_bitfield (tdesc_type_with_fields *type, const char *field_name,
/* See gdbsupport/tdesc.h. */
void
-tdesc_add_flag (tdesc_type_with_fields *type, int start,
- const char *flag_name)
+tdesc_add_flag (tdesc_type_with_fields *type, int start, const char *flag_name)
{
gdb_assert (type->kind == TDESC_TYPE_FLAGS
- || type->kind == TDESC_TYPE_STRUCT);
+ || type->kind == TDESC_TYPE_STRUCT);
type->fields.emplace_back (flag_name,
- tdesc_predefined_type (TDESC_TYPE_BOOL),
- start, start);
+ tdesc_predefined_type (TDESC_TYPE_BOOL), start,
+ start);
}
/* See gdbsupport/tdesc.h. */
void
tdesc_add_enum_value (tdesc_type_with_fields *type, int value,
- const char *name)
+ const char *name)
{
gdb_assert (type->kind == TDESC_TYPE_ENUM);
- type->fields.emplace_back (name,
- tdesc_predefined_type (TDESC_TYPE_INT32),
- value, -1);
+ type->fields.emplace_back (name, tdesc_predefined_type (TDESC_TYPE_INT32),
+ value, -1);
}
-void print_xml_feature::visit_pre (const tdesc_feature *e)
+void
+print_xml_feature::visit_pre (const tdesc_feature *e)
{
add_line ("<feature name=\"%s\">", e->name.c_str ());
indent (1);
}
-void print_xml_feature::visit_post (const tdesc_feature *e)
+void
+print_xml_feature::visit_post (const tdesc_feature *e)
{
indent (-1);
add_line ("</feature>");
}
-void print_xml_feature::visit (const tdesc_type_builtin *t)
+void
+print_xml_feature::visit (const tdesc_type_builtin *t)
{
- error (_("xml output is not supported for type \"%s\"."), t->name.c_str ());
+ error (_ ("xml output is not supported for type \"%s\"."), t->name.c_str ());
}
-void print_xml_feature::visit (const tdesc_type_vector *t)
+void
+print_xml_feature::visit (const tdesc_type_vector *t)
{
- add_line ("<vector id=\"%s\" type=\"%s\" count=\"%d\"/>",
- t->name.c_str (), t->element_type->name.c_str (), t->count);
+ add_line ("<vector id=\"%s\" type=\"%s\" count=\"%d\"/>", t->name.c_str (),
+ t->element_type->name.c_str (), t->count);
}
-void print_xml_feature::visit (const tdesc_type_with_fields *t)
+void
+print_xml_feature::visit (const tdesc_type_with_fields *t)
{
const static char *types[] = { "struct", "union", "flags", "enum" };
@@ -324,68 +326,66 @@ void print_xml_feature::visit (const tdesc_type_with_fields *t)
std::string tmp;
- string_appendf (tmp,
- "<%s id=\"%s\"", types[t->kind - TDESC_TYPE_STRUCT],
- t->name.c_str ());
+ string_appendf (tmp, "<%s id=\"%s\"", types[t->kind - TDESC_TYPE_STRUCT],
+ t->name.c_str ());
switch (t->kind)
{
case TDESC_TYPE_STRUCT:
case TDESC_TYPE_FLAGS:
if (t->size > 0)
- string_appendf (tmp, " size=\"%d\"", t->size);
+ string_appendf (tmp, " size=\"%d\"", t->size);
string_appendf (tmp, ">");
add_line (tmp);
for (const tdesc_type_field &f : t->fields)
- {
- tmp.clear ();
- string_appendf (tmp, " <field name=\"%s\"", f.name.c_str ());
- if (f.start != -1)
- string_appendf (tmp, " start=\"%d\" end=\"%d\"", f.start,
- f.end);
- string_appendf (tmp, " type=\"%s\"/>",
- f.type->name.c_str ());
- add_line (tmp);
- }
+ {
+ tmp.clear ();
+ string_appendf (tmp, " <field name=\"%s\"", f.name.c_str ());
+ if (f.start != -1)
+ string_appendf (tmp, " start=\"%d\" end=\"%d\"", f.start, f.end);
+ string_appendf (tmp, " type=\"%s\"/>", f.type->name.c_str ());
+ add_line (tmp);
+ }
break;
case TDESC_TYPE_ENUM:
if (t->size > 0)
- string_appendf (tmp, " size=\"%d\"", t->size);
+ string_appendf (tmp, " size=\"%d\"", t->size);
string_appendf (tmp, ">");
add_line (tmp);
/* The 'start' of the field is reused as the enum value. The 'end'
of the field is always set to -1 for enum values. */
for (const tdesc_type_field &f : t->fields)
- add_line (" <evalue name=\"%s\" value=\"%d\"/>",
- f.name.c_str (), f.start);
+ add_line (" <evalue name=\"%s\" value=\"%d\"/>", f.name.c_str (),
+ f.start);
break;
case TDESC_TYPE_UNION:
string_appendf (tmp, ">");
add_line (tmp);
for (const tdesc_type_field &f : t->fields)
- add_line (" <field name=\"%s\" type=\"%s\"/>",
- f.name.c_str (), f.type->name.c_str ());
+ add_line (" <field name=\"%s\" type=\"%s\"/>", f.name.c_str (),
+ f.type->name.c_str ());
break;
default:
- error (_("xml output is not supported for type \"%s\"."),
- t->name.c_str ());
+ error (_ ("xml output is not supported for type \"%s\"."),
+ t->name.c_str ());
}
add_line ("</%s>", types[t->kind - TDESC_TYPE_STRUCT]);
}
-void print_xml_feature::visit (const tdesc_reg *r)
+void
+print_xml_feature::visit (const tdesc_reg *r)
{
std::string tmp;
string_appendf (tmp,
- "<reg name=\"%s\" bitsize=\"%d\" type=\"%s\" regnum=\"%ld\"",
- r->name.c_str (), r->bitsize, r->type.c_str (),
- r->target_regnum);
+ "<reg name=\"%s\" bitsize=\"%d\" type=\"%s\" regnum=\"%ld\"",
+ r->name.c_str (), r->bitsize, r->type.c_str (),
+ r->target_regnum);
if (r->group.length () > 0)
string_appendf (tmp, " group=\"%s\"", r->group.c_str ());
@@ -398,7 +398,8 @@ void print_xml_feature::visit (const tdesc_reg *r)
add_line (tmp);
}
-void print_xml_feature::visit_pre (const target_desc *e)
+void
+print_xml_feature::visit_pre (const target_desc *e)
{
#ifndef IN_PROCESS_AGENT
add_line ("<?xml version=\"1.0\"?>");
@@ -406,8 +407,7 @@ void print_xml_feature::visit_pre (const target_desc *e)
add_line ("<target>");
indent (1);
if (tdesc_architecture_name (e))
- add_line ("<architecture>%s</architecture>",
- tdesc_architecture_name (e));
+ add_line ("<architecture>%s</architecture>", tdesc_architecture_name (e));
const char *osabi = tdesc_osabi_name (e);
if (osabi != nullptr)
@@ -417,11 +417,12 @@ void print_xml_feature::visit_pre (const target_desc *e)
= tdesc_compatible_info_list (e);
for (const auto &c : compatible_list)
add_line ("<compatible>%s</compatible>",
- tdesc_compatible_info_arch_name (c));
+ tdesc_compatible_info_arch_name (c));
#endif
}
-void print_xml_feature::visit_post (const target_desc *e)
+void
+print_xml_feature::visit_post (const target_desc *e)
{
indent (-1);
add_line ("</target>");
diff --git a/gdbsupport/tdesc.h b/gdbsupport/tdesc.h
index 40f0dac813c..8ee99a57ce0 100644
--- a/gdbsupport/tdesc.h
+++ b/gdbsupport/tdesc.h
@@ -31,29 +31,21 @@ struct target_desc;
class tdesc_element_visitor
{
public:
- virtual void visit_pre (const target_desc *e)
- {}
+ virtual void visit_pre (const target_desc *e) {}
- virtual void visit_post (const target_desc *e)
- {}
+ virtual void visit_post (const target_desc *e) {}
- virtual void visit_pre (const tdesc_feature *e)
- {}
+ virtual void visit_pre (const tdesc_feature *e) {}
- virtual void visit_post (const tdesc_feature *e)
- {}
+ virtual void visit_post (const tdesc_feature *e) {}
- virtual void visit (const tdesc_type_builtin *e)
- {}
+ virtual void visit (const tdesc_type_builtin *e) {}
- virtual void visit (const tdesc_type_vector *e)
- {}
+ virtual void visit (const tdesc_type_vector *e) {}
- virtual void visit (const tdesc_type_with_fields *e)
- {}
+ virtual void visit (const tdesc_type_with_fields *e) {}
- virtual void visit (const tdesc_reg *e)
- {}
+ virtual void visit (const tdesc_reg *e) {}
};
class tdesc_element
@@ -67,8 +59,8 @@ public:
struct tdesc_reg : tdesc_element
{
tdesc_reg (struct tdesc_feature *feature, const std::string &name_,
- int regnum, int save_restore_, const char *group_,
- int bitsize_, const char *type_);
+ int regnum, int save_restore_, const char *group_, int bitsize_,
+ const char *type_);
virtual ~tdesc_reg () = default;
@@ -108,25 +100,16 @@ struct tdesc_reg : tdesc_element
/* The target-described type corresponding to TYPE, if found. */
struct tdesc_type *tdesc_type;
- void accept (tdesc_element_visitor &v) const override
- {
- v.visit (this);
- }
+ void accept (tdesc_element_visitor &v) const override { v.visit (this); }
bool operator== (const tdesc_reg &other) const
{
- return (name == other.name
- && target_regnum == other.target_regnum
- && save_restore == other.save_restore
- && bitsize == other.bitsize
- && group == other.group
- && type == other.type);
+ return (name == other.name && target_regnum == other.target_regnum
+ && save_restore == other.save_restore && bitsize == other.bitsize
+ && group == other.group && type == other.type);
}
- bool operator!= (const tdesc_reg &other) const
- {
- return !(*this == other);
- }
+ bool operator!= (const tdesc_reg &other) const { return !(*this == other); }
};
typedef std::unique_ptr<tdesc_reg> tdesc_reg_up;
@@ -143,14 +126,14 @@ typedef std::unique_ptr<tdesc_compatible_info> tdesc_compatible_info_up;
/* Return a vector of compatibility information pointers from the target
description TARGET_DESC. */
-const std::vector<tdesc_compatible_info_up> &tdesc_compatible_info_list
- (const target_desc *target_desc);
+const std::vector<tdesc_compatible_info_up> &
+tdesc_compatible_info_list (const target_desc *target_desc);
/* Return the architecture name from a compatibility information
COMPATIBLE. */
-const char *tdesc_compatible_info_arch_name
- (const tdesc_compatible_info_up &compatible);
+const char *
+tdesc_compatible_info_arch_name (const tdesc_compatible_info_up &compatible);
enum tdesc_type_kind
{
@@ -186,8 +169,10 @@ enum tdesc_type_kind
struct tdesc_type : tdesc_element
{
tdesc_type (const std::string &name_, enum tdesc_type_kind kind_)
- : name (name_), kind (kind_)
- {}
+ : name (name_),
+ kind (kind_)
+ {
+ }
virtual ~tdesc_type () = default;
@@ -204,10 +189,7 @@ struct tdesc_type : tdesc_element
return name == other.name && kind == other.kind;
}
- bool operator!= (const tdesc_type &other) const
- {
- return !(*this == other);
- }
+ bool operator!= (const tdesc_type &other) const { return !(*this == other); }
};
typedef std::unique_ptr<tdesc_type> tdesc_type_up;
@@ -215,13 +197,11 @@ typedef std::unique_ptr<tdesc_type> tdesc_type_up;
struct tdesc_type_builtin : tdesc_type
{
tdesc_type_builtin (const std::string &name, enum tdesc_type_kind kind)
- : tdesc_type (name, kind)
- {}
-
- void accept (tdesc_element_visitor &v) const override
+ : tdesc_type (name, kind)
{
- v.visit (this);
}
+
+ void accept (tdesc_element_visitor &v) const override { v.visit (this); }
};
/* tdesc_type for vector types. */
@@ -229,16 +209,15 @@ struct tdesc_type_builtin : tdesc_type
struct tdesc_type_vector : tdesc_type
{
tdesc_type_vector (const std::string &name, tdesc_type *element_type_,
- int count_)
- : tdesc_type (name, TDESC_TYPE_VECTOR),
- element_type (element_type_), count (count_)
- {}
-
- void accept (tdesc_element_visitor &v) const override
+ int count_)
+ : tdesc_type (name, TDESC_TYPE_VECTOR),
+ element_type (element_type_),
+ count (count_)
{
- v.visit (this);
}
+ void accept (tdesc_element_visitor &v) const override { v.visit (this); }
+
struct tdesc_type *element_type;
int count;
};
@@ -247,10 +226,14 @@ struct tdesc_type_vector : tdesc_type
struct tdesc_type_field
{
- tdesc_type_field (const std::string &name_, tdesc_type *type_,
- int start_, int end_)
- : name (name_), type (type_), start (start_), end (end_)
- {}
+ tdesc_type_field (const std::string &name_, tdesc_type *type_, int start_,
+ int end_)
+ : name (name_),
+ type (type_),
+ start (start_),
+ end (end_)
+ {
+ }
std::string name;
struct tdesc_type *type;
@@ -265,15 +248,14 @@ struct tdesc_type_field
struct tdesc_type_with_fields : tdesc_type
{
tdesc_type_with_fields (const std::string &name, tdesc_type_kind kind,
- int size_ = 0)
- : tdesc_type (name, kind), size (size_)
- {}
-
- void accept (tdesc_element_visitor &v) const override
+ int size_ = 0)
+ : tdesc_type (name, kind),
+ size (size_)
{
- v.visit (this);
}
+ void accept (tdesc_element_visitor &v) const override { v.visit (this); }
+
std::vector<tdesc_type_field> fields;
int size;
};
@@ -283,9 +265,7 @@ struct tdesc_type_with_fields : tdesc_type
struct tdesc_feature : tdesc_element
{
- tdesc_feature (const std::string &name_)
- : name (name_)
- {}
+ tdesc_feature (const std::string &name_) : name (name_) {}
virtual ~tdesc_feature () = default;
@@ -331,8 +311,7 @@ typedef std::unique_ptr<target_desc, target_desc_deleter> target_desc_up;
target_desc_up allocate_target_description (void);
/* Set TARGET_DESC's architecture by NAME. */
-void set_tdesc_architecture (target_desc *target_desc,
- const char *name);
+void set_tdesc_architecture (target_desc *target_desc, const char *name);
/* Return the architecture associated with this target description as a string,
or NULL if no architecture was specified. */
@@ -348,47 +327,44 @@ const char *tdesc_osabi_name (const struct target_desc *target_desc);
/* Return the type associated with ID in the context of FEATURE, or
NULL if none. */
struct tdesc_type *tdesc_named_type (const struct tdesc_feature *feature,
- const char *id);
+ const char *id);
/* Return the created feature named NAME in target description TDESC. */
struct tdesc_feature *tdesc_create_feature (struct target_desc *tdesc,
- const char *name);
+ const char *name);
/* Return the created vector tdesc_type named NAME in FEATURE. */
struct tdesc_type *tdesc_create_vector (struct tdesc_feature *feature,
- const char *name,
- struct tdesc_type *field_type,
- int count);
+ const char *name,
+ struct tdesc_type *field_type,
+ int count);
/* Return the created struct tdesc_type named NAME in FEATURE. */
tdesc_type_with_fields *tdesc_create_struct (struct tdesc_feature *feature,
- const char *name);
+ const char *name);
/* Return the created union tdesc_type named NAME in FEATURE. */
tdesc_type_with_fields *tdesc_create_union (struct tdesc_feature *feature,
- const char *name);
+ const char *name);
/* Return the created flags tdesc_type named NAME in FEATURE. */
tdesc_type_with_fields *tdesc_create_flags (struct tdesc_feature *feature,
- const char *name,
- int size);
+ const char *name, int size);
/* Return the created enum tdesc_type named NAME in FEATURE. */
tdesc_type_with_fields *tdesc_create_enum (struct tdesc_feature *feature,
- const char *name,
- int size);
+ const char *name, int size);
/* Add a new field to TYPE. FIELD_NAME is its name, and FIELD_TYPE is
its type. */
void tdesc_add_field (tdesc_type_with_fields *type, const char *field_name,
- struct tdesc_type *field_type);
+ struct tdesc_type *field_type);
/* Add a new bitfield to TYPE, with range START to END. FIELD_NAME is its name,
and FIELD_TYPE is its type. */
void tdesc_add_typed_bitfield (tdesc_type_with_fields *type,
- const char *field_name,
- int start, int end,
- struct tdesc_type *field_type);
+ const char *field_name, int start, int end,
+ struct tdesc_type *field_type);
/* Set the total length of TYPE. Structs which contain bitfields may
omit the reserved bits, so the end of the last field may not
@@ -399,21 +375,21 @@ void tdesc_set_struct_size (tdesc_type_with_fields *type, int size);
Untyped bitfields become either uint32 or uint64 depending on the size
of the underlying type. */
void tdesc_add_bitfield (tdesc_type_with_fields *type, const char *field_name,
- int start, int end);
+ int start, int end);
/* A flag is just a typed(bool) single-bit bitfield.
This function is kept to minimize changes in generated files. */
void tdesc_add_flag (tdesc_type_with_fields *type, int start,
- const char *flag_name);
+ const char *flag_name);
/* Add field with VALUE and NAME to the enum TYPE. */
void tdesc_add_enum_value (tdesc_type_with_fields *type, int value,
- const char *name);
+ const char *name);
/* Create a register in feature FEATURE. */
void tdesc_create_reg (struct tdesc_feature *feature, const char *name,
- int regnum, int save_restore, const char *group,
- int bitsize, const char *type);
+ int regnum, int save_restore, const char *group,
+ int bitsize, const char *type);
/* Return the tdesc in string XML format. */
@@ -424,10 +400,7 @@ const char *tdesc_get_features_xml (const target_desc *tdesc);
class print_xml_feature : public tdesc_element_visitor
{
public:
- print_xml_feature (std::string *buffer_)
- : m_buffer (buffer_),
- m_depth (0)
- {}
+ print_xml_feature (std::string *buffer_) : m_buffer (buffer_), m_depth (0) {}
void visit_pre (const target_desc *e) override;
void visit_post (const target_desc *e) override;
@@ -439,15 +412,11 @@ public:
void visit (const tdesc_reg *reg) override;
private:
-
/* Called with a positive value of ADJUST when we move inside an element,
for example inside <target>, and with a negative value when we leave
the element. In this class this function does nothing, but a
sub-class can override this to track the current level of nesting. */
- void indent (int adjust)
- {
- m_depth += (adjust * 2);
- }
+ void indent (int adjust) { m_depth += (adjust * 2); }
/* Functions to add lines to the output buffer M_BUFFER. Each of these
functions appends a newline, so don't include one in the strings being
diff --git a/gdbsupport/thread-pool.cc b/gdbsupport/thread-pool.cc
index 1c871ed378f..43b09767219 100644
--- a/gdbsupport/thread-pool.cc
+++ b/gdbsupport/thread-pool.cc
@@ -47,14 +47,14 @@
ATTRIBUTE_UNUSED static void
do_set_thread_name (int (*set_name) (pthread_t, const char *, void *),
- const char *name)
+ const char *name)
{
set_name (pthread_self (), "%s", const_cast<char *> (name));
}
ATTRIBUTE_UNUSED static void
do_set_thread_name (int (*set_name) (pthread_t, const char *),
- const char *name)
+ const char *name)
{
set_name (pthread_self (), name);
}
@@ -73,7 +73,7 @@ set_thread_name (const char *name)
do_set_thread_name (pthread_setname_np, name);
}
-#elif defined (USE_WIN32API)
+#elif defined(USE_WIN32API)
#include <windows.h>
@@ -90,7 +90,7 @@ init_windows ()
if (hm)
dyn_SetThreadDescription
= (SetThreadDescription_ftype *) GetProcAddress (hm,
- "SetThreadDescription");
+ "SetThreadDescription");
/* On some versions of Windows, this function is only available in
KernelBase.dll, not kernel32.dll. */
@@ -98,9 +98,8 @@ init_windows ()
{
hm = LoadLibrary (TEXT ("KernelBase.dll"));
if (hm)
- dyn_SetThreadDescription
- = (SetThreadDescription_ftype *) GetProcAddress (hm,
- "SetThreadDescription");
+ dyn_SetThreadDescription = (SetThreadDescription_ftype *)
+ GetProcAddress (hm, "SetThreadDescription");
}
}
@@ -114,7 +113,7 @@ do_set_thread_name (const wchar_t *name)
dyn_SetThreadDescription (GetCurrentThread (), name);
}
-#define set_thread_name(NAME) do_set_thread_name (L ## NAME)
+#define set_thread_name(NAME) do_set_thread_name (L##NAME)
#else /* USE_WIN32API */
@@ -162,27 +161,27 @@ thread_pool::set_thread_count (size_t num_threads)
threads. */
block_signals blocker;
for (size_t i = m_thread_count; i < num_threads; ++i)
- {
- try
- {
- std::thread thread (&thread_pool::thread_function, this);
- thread.detach ();
- }
- catch (const std::system_error &)
- {
- /* libstdc++ may not implement std::thread, and will
+ {
+ try
+ {
+ std::thread thread (&thread_pool::thread_function, this);
+ thread.detach ();
+ }
+ catch (const std::system_error &)
+ {
+ /* libstdc++ may not implement std::thread, and will
throw an exception on use. It seems fine to ignore
this, and any other sort of startup failure here. */
- num_threads = i;
- break;
- }
- }
+ num_threads = i;
+ break;
+ }
+ }
}
/* If the new size is smaller, terminate some existing threads. */
if (num_threads < m_thread_count)
{
for (size_t i = num_threads; i < m_thread_count; ++i)
- m_tasks.emplace ();
+ m_tasks.emplace ();
m_tasks_cv.notify_all ();
}
@@ -228,17 +227,17 @@ thread_pool::thread_function ()
optional<task_t> t;
{
- /* We want to hold the lock while examining the task list, but
+ /* We want to hold the lock while examining the task list, but
not while invoking the task function. */
- std::unique_lock<std::mutex> guard (m_tasks_mutex);
- while (m_tasks.empty ())
- m_tasks_cv.wait (guard);
- t = std::move (m_tasks.front());
- m_tasks.pop ();
+ std::unique_lock<std::mutex> guard (m_tasks_mutex);
+ while (m_tasks.empty ())
+ m_tasks_cv.wait (guard);
+ t = std::move (m_tasks.front ());
+ m_tasks.pop ();
}
if (!t.has_value ())
- break;
+ break;
(*t) ();
}
}
diff --git a/gdbsupport/thread-pool.h b/gdbsupport/thread-pool.h
index 013c6abf8ea..847df64f063 100644
--- a/gdbsupport/thread-pool.h
+++ b/gdbsupport/thread-pool.h
@@ -57,11 +57,7 @@ template<typename T>
class future
{
public:
-
- explicit future (T value)
- : m_value (std::move (value))
- {
- }
+ explicit future (T value) : m_value (std::move (value)) {}
future () = default;
future (future &&other) = default;
@@ -69,12 +65,11 @@ public:
future &operator= (future &&other) = default;
future &operator= (const future &other) = delete;
- void wait () const { }
+ void wait () const {}
T get () { return std::move (m_value); }
private:
-
T m_value;
};
@@ -84,13 +79,12 @@ template<>
class future<void>
{
public:
- void wait () const { }
- void get () { }
+ void wait () const {}
+ void get () {}
};
#endif /* CXX_STD_THREAD */
-
/* A thread pool.
There is a single global thread pool, see g_thread_pool. Tasks can
@@ -150,7 +144,6 @@ public:
}
private:
-
thread_pool () = default;
#if CXX_STD_THREAD
@@ -180,6 +173,6 @@ private:
#endif /* CXX_STD_THREAD */
};
-}
+} // namespace gdb
#endif /* GDBSUPPORT_THREAD_POOL_H */
diff --git a/gdbsupport/traits.h b/gdbsupport/traits.h
index f6bb64911be..f3088f8cf05 100644
--- a/gdbsupport/traits.h
+++ b/gdbsupport/traits.h
@@ -22,7 +22,7 @@
/* GCC does not understand __has_feature. */
#if !defined(__has_feature)
-# define __has_feature(x) 0
+#define __has_feature(x) 0
#endif
/* HAVE_IS_TRIVIALLY_COPYABLE is defined as 1 iff
@@ -30,7 +30,7 @@
in GCC 5. */
#if (__has_feature(is_trivially_copyable) \
|| (defined __GNUC__ && __GNUC__ >= 5))
-# define HAVE_IS_TRIVIALLY_COPYABLE 1
+#define HAVE_IS_TRIVIALLY_COPYABLE 1
#endif
/* HAVE_IS_TRIVIALLY_CONSTRUCTIBLE is defined as 1 iff
@@ -38,16 +38,20 @@
in GCC 5. */
#if (__has_feature(is_trivially_constructible) \
|| (defined __GNUC__ && __GNUC__ >= 5))
-# define HAVE_IS_TRIVIALLY_CONSTRUCTIBLE 1
+#define HAVE_IS_TRIVIALLY_CONSTRUCTIBLE 1
#endif
-namespace gdb {
+namespace gdb
+{
/* Pre C++14-safe (CWG 1558) version of C++17's std::void_t. See
<http://en.cppreference.com/w/cpp/types/void_t>. */
template<typename... Ts>
-struct make_void { typedef void type; };
+struct make_void
+{
+ typedef void type;
+};
template<typename... Ts>
using void_t = typename make_void<Ts...>::type;
@@ -67,10 +71,11 @@ struct nonesuch
void operator= (const nonesuch &) = delete;
};
-namespace detection_detail {
+namespace detection_detail
+{
/* Implementation of the detection idiom (negative case). */
-template<typename Default, typename AlwaysVoid,
- template<typename...> class Op, typename... Args>
+template<typename Default, typename AlwaysVoid, template<typename...> class Op,
+ typename... Args>
struct detector
{
using value_t = std::false_type;
@@ -86,25 +91,22 @@ struct detector<Default, void_t<Op<Args...>>, Op, Args...>
};
/* Detect whether Op<Args...> is a valid type, use Default if not. */
-template<typename Default, template<typename...> class Op,
- typename... Args>
+template<typename Default, template<typename...> class Op, typename... Args>
using detected_or = detector<Default, void, Op, Args...>;
/* Op<Args...> if that is a valid type, otherwise Default. */
-template<typename Default, template<typename...> class Op,
- typename... Args>
-using detected_or_t
- = typename detected_or<Default, Op, Args...>::type;
+template<typename Default, template<typename...> class Op, typename... Args>
+using detected_or_t = typename detected_or<Default, Op, Args...>::type;
-} /* detection_detail */
+} // namespace detection_detail
template<template<typename...> class Op, typename... Args>
-using is_detected
- = typename detection_detail::detector<nonesuch, void, Op, Args...>::value_t;
+using is_detected =
+ typename detection_detail::detector<nonesuch, void, Op, Args...>::value_t;
template<template<typename...> class Op, typename... Args>
-using detected_t
- = typename detection_detail::detector<nonesuch, void, Op, Args...>::type;
+using detected_t =
+ typename detection_detail::detector<nonesuch, void, Op, Args...>::type;
template<typename Default, template<typename...> class Op, typename... Args>
using detected_or = detection_detail::detected_or<Default, Op, Args...>;
@@ -124,53 +126,60 @@ using is_detected_convertible
template<typename Predicate>
struct Not : public std::integral_constant<bool, !Predicate::value>
-{};
+{
+};
template<typename...>
struct Or;
template<>
struct Or<> : public std::false_type
-{};
+{
+};
template<typename B1>
struct Or<B1> : public B1
-{};
+{
+};
template<typename B1, typename B2>
-struct Or<B1, B2>
- : public std::conditional<B1::value, B1, B2>::type
-{};
+struct Or<B1, B2> : public std::conditional<B1::value, B1, B2>::type
+{
+};
-template<typename B1,typename B2,typename B3, typename... Bn>
+template<typename B1, typename B2, typename B3, typename... Bn>
struct Or<B1, B2, B3, Bn...>
: public std::conditional<B1::value, B1, Or<B2, B3, Bn...>>::type
-{};
+{
+};
template<typename...>
struct And;
template<>
struct And<> : public std::true_type
-{};
+{
+};
template<typename B1>
struct And<B1> : public B1
-{};
+{
+};
template<typename B1, typename B2>
-struct And<B1, B2>
- : public std::conditional<B1::value, B2, B1>::type
-{};
+struct And<B1, B2> : public std::conditional<B1::value, B2, B1>::type
+{
+};
template<typename B1, typename B2, typename B3, typename... Bn>
struct And<B1, B2, B3, Bn...>
: public std::conditional<B1::value, And<B2, B3, Bn...>, B1>::type
-{};
+{
+};
/* Concepts-light-like helper to make SFINAE logic easier to read. */
template<typename Condition>
using Requires = typename std::enable_if<Condition::value, void>::type;
-}
+} // namespace gdb
#endif /* COMMON_TRAITS_H */
diff --git a/gdbsupport/valid-expr.h b/gdbsupport/valid-expr.h
index 75734c88d22..6591b1444a0 100644
--- a/gdbsupport/valid-expr.h
+++ b/gdbsupport/valid-expr.h
@@ -55,57 +55,52 @@
line number, so client code should wrap sets of calls in a
test-specific namespace too, to fully guarantee uniqueness between
the multiple clients in the codebase. */
-#define CHECK_VALID_EXPR_INT(TYPENAMES, TYPES, VALID, EXPR_TYPE, EXPR) \
- namespace CONCAT (check_valid_expr, __LINE__) { \
- \
- template <TYPENAMES, typename = decltype (EXPR)> \
- struct archetype \
- { \
- }; \
- \
- static_assert (gdb::is_detected_exact<archetype<TYPES, EXPR_TYPE>, \
- archetype, TYPES>::value == VALID, \
- ""); \
+#define CHECK_VALID_EXPR_INT(TYPENAMES, TYPES, VALID, EXPR_TYPE, EXPR) \
+ namespace CONCAT (check_valid_expr, __LINE__) \
+ { \
+ \
+ template<TYPENAMES, typename = decltype (EXPR)> \
+ struct archetype \
+ { \
+ }; \
+ \
+ static_assert (gdb::is_detected_exact<archetype<TYPES, EXPR_TYPE>, \
+ archetype, TYPES>::value \
+ == VALID, \
+ ""); \
} /* namespace */
/* A few convenience macros that support expressions involving a
varying numbers of types. If you need more types, feel free to add
another variant. */
-#define CHECK_VALID_EXPR_1(T1, VALID, EXPR_TYPE, EXPR) \
- CHECK_VALID_EXPR_INT (ESC_PARENS (typename T1), \
- ESC_PARENS (T1), \
- VALID, EXPR_TYPE, EXPR)
+#define CHECK_VALID_EXPR_1(T1, VALID, EXPR_TYPE, EXPR) \
+ CHECK_VALID_EXPR_INT (ESC_PARENS (typename T1), ESC_PARENS (T1), VALID, \
+ EXPR_TYPE, EXPR)
-#define CHECK_VALID_EXPR_2(T1, T2, VALID, EXPR_TYPE, EXPR) \
- CHECK_VALID_EXPR_INT (ESC_PARENS(typename T1, typename T2), \
- ESC_PARENS (T1, T2), \
- VALID, EXPR_TYPE, EXPR)
+#define CHECK_VALID_EXPR_2(T1, T2, VALID, EXPR_TYPE, EXPR) \
+ CHECK_VALID_EXPR_INT (ESC_PARENS (typename T1, typename T2), \
+ ESC_PARENS (T1, T2), VALID, EXPR_TYPE, EXPR)
-#define CHECK_VALID_EXPR_3(T1, T2, T3, VALID, EXPR_TYPE, EXPR) \
+#define CHECK_VALID_EXPR_3(T1, T2, T3, VALID, EXPR_TYPE, EXPR) \
CHECK_VALID_EXPR_INT (ESC_PARENS (typename T1, typename T2, typename T3), \
- ESC_PARENS (T1, T2, T3), \
- VALID, EXPR_TYPE, EXPR)
-
-#define CHECK_VALID_EXPR_4(T1, T2, T3, T4, VALID, EXPR_TYPE, EXPR) \
- CHECK_VALID_EXPR_INT (ESC_PARENS (typename T1, typename T2, \
- typename T3, typename T4), \
- ESC_PARENS (T1, T2, T3, T4), \
- VALID, EXPR_TYPE, EXPR)
-
-#define CHECK_VALID_EXPR_5(T1, T2, T3, T4, T5, VALID, EXPR_TYPE, EXPR) \
- CHECK_VALID_EXPR_INT (ESC_PARENS (typename T1, typename T2, \
- typename T3, typename T4, \
- typename T5), \
- ESC_PARENS (T1, T2, T3, T4, T5), \
- VALID, EXPR_TYPE, EXPR)
-
-#define CHECK_VALID_EXPR_6(T1, T2, T3, T4, T5, T6, \
- VALID, EXPR_TYPE, EXPR) \
- CHECK_VALID_EXPR_INT (ESC_PARENS (typename T1, typename T2, \
- typename T3, typename T4, \
- typename T5, typename T6), \
- ESC_PARENS (T1, T2, T3, T4, T5, T6), \
- VALID, EXPR_TYPE, EXPR)
+ ESC_PARENS (T1, T2, T3), VALID, EXPR_TYPE, EXPR)
+
+#define CHECK_VALID_EXPR_4(T1, T2, T3, T4, VALID, EXPR_TYPE, EXPR) \
+ CHECK_VALID_EXPR_INT (ESC_PARENS (typename T1, typename T2, typename T3, \
+ typename T4), \
+ ESC_PARENS (T1, T2, T3, T4), VALID, EXPR_TYPE, EXPR)
+
+#define CHECK_VALID_EXPR_5(T1, T2, T3, T4, T5, VALID, EXPR_TYPE, EXPR) \
+ CHECK_VALID_EXPR_INT (ESC_PARENS (typename T1, typename T2, typename T3, \
+ typename T4, typename T5), \
+ ESC_PARENS (T1, T2, T3, T4, T5), VALID, EXPR_TYPE, \
+ EXPR)
+
+#define CHECK_VALID_EXPR_6(T1, T2, T3, T4, T5, T6, VALID, EXPR_TYPE, EXPR) \
+ CHECK_VALID_EXPR_INT (ESC_PARENS (typename T1, typename T2, typename T3, \
+ typename T4, typename T5, typename T6), \
+ ESC_PARENS (T1, T2, T3, T4, T5, T6), VALID, \
+ EXPR_TYPE, EXPR)
#endif /* COMMON_VALID_EXPR_H */
diff --git a/gdbsupport/x86-xstate.h b/gdbsupport/x86-xstate.h
index b8740fd8701..34a10e85f5e 100644
--- a/gdbsupport/x86-xstate.h
+++ b/gdbsupport/x86-xstate.h
@@ -21,56 +21,56 @@
#define COMMON_X86_XSTATE_H
/* The extended state feature bits. */
-#define X86_XSTATE_X87 (1ULL << 0)
-#define X86_XSTATE_SSE (1ULL << 1)
-#define X86_XSTATE_AVX (1ULL << 2)
-#define X86_XSTATE_BNDREGS (1ULL << 3)
-#define X86_XSTATE_BNDCFG (1ULL << 4)
-#define X86_XSTATE_MPX (X86_XSTATE_BNDREGS | X86_XSTATE_BNDCFG)
+#define X86_XSTATE_X87 (1ULL << 0)
+#define X86_XSTATE_SSE (1ULL << 1)
+#define X86_XSTATE_AVX (1ULL << 2)
+#define X86_XSTATE_BNDREGS (1ULL << 3)
+#define X86_XSTATE_BNDCFG (1ULL << 4)
+#define X86_XSTATE_MPX (X86_XSTATE_BNDREGS | X86_XSTATE_BNDCFG)
/* AVX 512 adds three feature bits. All three must be enabled. */
-#define X86_XSTATE_K (1ULL << 5)
-#define X86_XSTATE_ZMM_H (1ULL << 6)
-#define X86_XSTATE_ZMM (1ULL << 7)
-#define X86_XSTATE_AVX512 (X86_XSTATE_K | X86_XSTATE_ZMM_H \
- | X86_XSTATE_ZMM)
+#define X86_XSTATE_K (1ULL << 5)
+#define X86_XSTATE_ZMM_H (1ULL << 6)
+#define X86_XSTATE_ZMM (1ULL << 7)
+#define X86_XSTATE_AVX512 (X86_XSTATE_K | X86_XSTATE_ZMM_H | X86_XSTATE_ZMM)
-#define X86_XSTATE_PKRU (1ULL << 9)
+#define X86_XSTATE_PKRU (1ULL << 9)
/* Supported mask and size of the extended state. */
-#define X86_XSTATE_X87_MASK X86_XSTATE_X87
-#define X86_XSTATE_SSE_MASK (X86_XSTATE_X87 | X86_XSTATE_SSE)
-#define X86_XSTATE_AVX_MASK (X86_XSTATE_SSE_MASK | X86_XSTATE_AVX)
-#define X86_XSTATE_MPX_MASK (X86_XSTATE_SSE_MASK | X86_XSTATE_MPX)
-#define X86_XSTATE_AVX_MPX_MASK (X86_XSTATE_AVX_MASK | X86_XSTATE_MPX)
-#define X86_XSTATE_AVX_AVX512_MASK (X86_XSTATE_AVX_MASK | X86_XSTATE_AVX512)
-#define X86_XSTATE_AVX_MPX_AVX512_PKU_MASK (X86_XSTATE_AVX_MPX_MASK\
- | X86_XSTATE_AVX512 | X86_XSTATE_PKRU)
-
-#define X86_XSTATE_ALL_MASK (X86_XSTATE_AVX_MPX_AVX512_PKU_MASK)
-
-
-#define X86_XSTATE_SSE_SIZE 576
-#define X86_XSTATE_AVX_SIZE 832
-#define X86_XSTATE_BNDREGS_SIZE 1024
-#define X86_XSTATE_BNDCFG_SIZE 1088
-#define X86_XSTATE_AVX512_SIZE 2688
-#define X86_XSTATE_PKRU_SIZE 2696
-#define X86_XSTATE_MAX_SIZE 2696
-
+#define X86_XSTATE_X87_MASK X86_XSTATE_X87
+#define X86_XSTATE_SSE_MASK (X86_XSTATE_X87 | X86_XSTATE_SSE)
+#define X86_XSTATE_AVX_MASK (X86_XSTATE_SSE_MASK | X86_XSTATE_AVX)
+#define X86_XSTATE_MPX_MASK (X86_XSTATE_SSE_MASK | X86_XSTATE_MPX)
+#define X86_XSTATE_AVX_MPX_MASK (X86_XSTATE_AVX_MASK | X86_XSTATE_MPX)
+#define X86_XSTATE_AVX_AVX512_MASK (X86_XSTATE_AVX_MASK | X86_XSTATE_AVX512)
+#define X86_XSTATE_AVX_MPX_AVX512_PKU_MASK \
+ (X86_XSTATE_AVX_MPX_MASK | X86_XSTATE_AVX512 | X86_XSTATE_PKRU)
+
+#define X86_XSTATE_ALL_MASK (X86_XSTATE_AVX_MPX_AVX512_PKU_MASK)
+
+#define X86_XSTATE_SSE_SIZE 576
+#define X86_XSTATE_AVX_SIZE 832
+#define X86_XSTATE_BNDREGS_SIZE 1024
+#define X86_XSTATE_BNDCFG_SIZE 1088
+#define X86_XSTATE_AVX512_SIZE 2688
+#define X86_XSTATE_PKRU_SIZE 2696
+#define X86_XSTATE_MAX_SIZE 2696
/* In case one of the MPX XCR0 bits is set we consider we have MPX. */
-#define HAS_MPX(XCR0) (((XCR0) & X86_XSTATE_MPX) != 0)
-#define HAS_AVX(XCR0) (((XCR0) & X86_XSTATE_AVX) != 0)
-#define HAS_AVX512(XCR0) (((XCR0) & X86_XSTATE_AVX512) != 0)
-#define HAS_PKRU(XCR0) (((XCR0) & X86_XSTATE_PKRU) != 0)
+#define HAS_MPX(XCR0) (((XCR0) &X86_XSTATE_MPX) != 0)
+#define HAS_AVX(XCR0) (((XCR0) &X86_XSTATE_AVX) != 0)
+#define HAS_AVX512(XCR0) (((XCR0) &X86_XSTATE_AVX512) != 0)
+#define HAS_PKRU(XCR0) (((XCR0) &X86_XSTATE_PKRU) != 0)
/* Get I386 XSAVE extended state size. */
-#define X86_XSTATE_SIZE(XCR0) \
- (HAS_PKRU (XCR0) ? X86_XSTATE_PKRU_SIZE : \
- (HAS_AVX512 (XCR0) ? X86_XSTATE_AVX512_SIZE : \
- (HAS_MPX (XCR0) ? X86_XSTATE_BNDCFG_SIZE : \
- (HAS_AVX (XCR0) ? X86_XSTATE_AVX_SIZE : X86_XSTATE_SSE_SIZE))))
+#define X86_XSTATE_SIZE(XCR0) \
+ (HAS_PKRU (XCR0) \
+ ? X86_XSTATE_PKRU_SIZE \
+ : (HAS_AVX512 (XCR0) \
+ ? X86_XSTATE_AVX512_SIZE \
+ : (HAS_MPX (XCR0) ? X86_XSTATE_BNDCFG_SIZE \
+ : (HAS_AVX (XCR0) ? X86_XSTATE_AVX_SIZE \
+ : X86_XSTATE_SSE_SIZE))))
/* Initial value for fctrl register, as defined in the X86 manual, and
confirmed in the (Linux) kernel source. When the x87 floating point
diff --git a/gdbsupport/xml-utils.cc b/gdbsupport/xml-utils.cc
index 24860319284..23186e6acc7 100644
--- a/gdbsupport/xml-utils.cc
+++ b/gdbsupport/xml-utils.cc
@@ -42,23 +42,23 @@ xml_escape_text_append (std::string &result, const char *text)
switch (text[i])
{
case '\'':
- result += "&apos;";
- break;
+ result += "&apos;";
+ break;
case '\"':
- result += "&quot;";
- break;
+ result += "&quot;";
+ break;
case '&':
- result += "&amp;";
- break;
+ result += "&amp;";
+ break;
case '<':
- result += "&lt;";
- break;
+ result += "&lt;";
+ break;
case '>':
- result += "&gt;";
- break;
+ result += "&gt;";
+ break;
default:
- result += text[i];
- break;
+ result += text[i];
+ break;
}
}
@@ -78,89 +78,89 @@ string_xml_appendf (std::string &buffer, const char *format, ...)
for (f = format; *f; f++)
{
if (percent)
- {
- char buf[32];
- char *str = buf;
- const char *f_old = f;
-
- switch (*f)
- {
- case 's':
- str = va_arg (ap, char *);
- break;
- case 'd':
- sprintf (str, "%d", va_arg (ap, int));
- break;
- case 'u':
- sprintf (str, "%u", va_arg (ap, unsigned int));
- break;
- case 'x':
- sprintf (str, "%x", va_arg (ap, unsigned int));
- break;
- case 'o':
- sprintf (str, "%o", va_arg (ap, unsigned int));
- break;
- case 'l':
- f++;
- switch (*f)
- {
- case 'd':
- sprintf (str, "%ld", va_arg (ap, long));
- break;
- case 'u':
- sprintf (str, "%lu", va_arg (ap, unsigned long));
- break;
- case 'x':
- sprintf (str, "%lx", va_arg (ap, unsigned long));
- break;
- case 'o':
- sprintf (str, "%lo", va_arg (ap, unsigned long));
- break;
- case 'l':
- f++;
- switch (*f)
- {
- case 'd':
- sprintf (str, "%" PRId64,
- (int64_t) va_arg (ap, long long));
- break;
- case 'u':
- sprintf (str, "%" PRIu64,
- (uint64_t) va_arg (ap, unsigned long long));
- break;
- case 'x':
- sprintf (str, "%" PRIx64,
- (uint64_t) va_arg (ap, unsigned long long));
- break;
- case 'o':
- sprintf (str, "%" PRIo64,
- (uint64_t) va_arg (ap, unsigned long long));
- break;
- default:
- str = 0;
- break;
- }
- break;
- default:
- str = 0;
- break;
- }
- break;
- default:
- str = 0;
- break;
- }
-
- if (str)
- {
- buffer.append (prev, f_old - prev - 1);
- xml_escape_text_append (buffer, str);
- prev = f + 1;
- }
- percent = 0;
- }
+ {
+ char buf[32];
+ char *str = buf;
+ const char *f_old = f;
+
+ switch (*f)
+ {
+ case 's':
+ str = va_arg (ap, char *);
+ break;
+ case 'd':
+ sprintf (str, "%d", va_arg (ap, int));
+ break;
+ case 'u':
+ sprintf (str, "%u", va_arg (ap, unsigned int));
+ break;
+ case 'x':
+ sprintf (str, "%x", va_arg (ap, unsigned int));
+ break;
+ case 'o':
+ sprintf (str, "%o", va_arg (ap, unsigned int));
+ break;
+ case 'l':
+ f++;
+ switch (*f)
+ {
+ case 'd':
+ sprintf (str, "%ld", va_arg (ap, long));
+ break;
+ case 'u':
+ sprintf (str, "%lu", va_arg (ap, unsigned long));
+ break;
+ case 'x':
+ sprintf (str, "%lx", va_arg (ap, unsigned long));
+ break;
+ case 'o':
+ sprintf (str, "%lo", va_arg (ap, unsigned long));
+ break;
+ case 'l':
+ f++;
+ switch (*f)
+ {
+ case 'd':
+ sprintf (str, "%" PRId64,
+ (int64_t) va_arg (ap, long long));
+ break;
+ case 'u':
+ sprintf (str, "%" PRIu64,
+ (uint64_t) va_arg (ap, unsigned long long));
+ break;
+ case 'x':
+ sprintf (str, "%" PRIx64,
+ (uint64_t) va_arg (ap, unsigned long long));
+ break;
+ case 'o':
+ sprintf (str, "%" PRIo64,
+ (uint64_t) va_arg (ap, unsigned long long));
+ break;
+ default:
+ str = 0;
+ break;
+ }
+ break;
+ default:
+ str = 0;
+ break;
+ }
+ break;
+ default:
+ str = 0;
+ break;
+ }
+
+ if (str)
+ {
+ buffer.append (prev, f_old - prev - 1);
+ xml_escape_text_append (buffer, str);
+ prev = f + 1;
+ }
+ percent = 0;
+ }
else if (*f == '%')
- percent = 1;
+ percent = 1;
}
buffer.append (prev);